From: Andrea Amorese Date: Tue, 7 Sep 2021 09:22:13 +0000 (+0200) Subject: Built motion from commit 95bf52c0.|2.5.345 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=e863b5ee9645e3ae8418a7e0a07f41463bc128e8;p=motion2.git Built motion from commit 95bf52c0.|2.5.345 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 3b0e76a..8cc9221 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-06T15:56:25.492Z", + "time": "2021-09-07T09:10:36.739Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c4ec3bb..e57db0f 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-06T15:56:25.492Z", + "time": "2021-09-07T09:10:36.739Z", "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 0eb6dc5..2cc3784 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 _0x77d4=['browser','bot','script','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]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','exports','action','STRING','motionbar','jscripty','urlForward'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x77d4,0x108));var _0x477d=function(_0x35c53f,_0xe63aba){_0x35c53f=_0x35c53f-0x0;var _0x2a2772=_0x77d4[_0x35c53f];return _0x2a2772;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x18c0fe){return this['getDataValue'](_0x477d('0x1'));}},'action':{'type':Sequelize[_0x477d('0x2')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0x477d('0x3'),_0x477d('0x4'),_0x477d('0x5'),_0x477d('0x6'),_0x477d('0x7'),_0x477d('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x477d('0x2')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x477d('0x9')},'data3':{'type':Sequelize[_0x477d('0x2')](0x1000),'comment':_0x477d('0xa')},'data4':{'type':Sequelize[_0x477d('0x2')](0x1000),'comments':_0x477d('0xb')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x477d('0xc')},'data6':{'type':Sequelize['STRING'],'comments':_0x477d('0xd')},'data7':{'type':Sequelize[_0x477d('0xe')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x687b=['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]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser'];(function(_0x442f5f,_0xbab56b){var _0x215195=function(_0x21424e){while(--_0x21424e){_0x442f5f['push'](_0x442f5f['shift']());}};_0x215195(++_0xbab56b);}(_0x687b,0x14a));var _0xb687=function(_0x9aaca8,_0x222c1a){_0x9aaca8=_0x9aaca8-0x0;var _0x1a77bd=_0x687b[_0x9aaca8];return _0x1a77bd;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'name':{'type':Sequelize[_0xb687('0x2')],'get':function(_0x26d69b){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0xb687('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb687('0x4'),_0xb687('0x5'),_0xb687('0x6'),_0xb687('0x7'),_0xb687('0x8'),_0xb687('0x9'),_0xb687('0xa'),_0xb687('0xb')]],'msg':_0xb687('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xb687('0x3')](0x1000),'comment':_0xb687('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xb687('0xe')},'data3':{'type':Sequelize[_0xb687('0x3')](0x1000),'comment':_0xb687('0xf')},'data4':{'type':Sequelize[_0xb687('0x3')](0x1000),'comments':_0xb687('0x10')},'data5':{'type':Sequelize[_0xb687('0x3')](0x1000),'comments':_0xb687('0x11')},'data6':{'type':Sequelize[_0xb687('0x3')],'comments':_0xb687('0x12')},'data7':{'type':Sequelize['TEXT'],'comments':_0xb687('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index f5484fb..b6e0372 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 _0x7143=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0x7143,0xb2));var _0x3714=function(_0x368d74,_0x19f443){_0x368d74=_0x368d74-0x0;var _0x32a394=_0x7143[_0x368d74];return _0x32a394;};'use strict';var emlformat=require(_0x3714('0x0'));var rimraf=require(_0x3714('0x1'));var zipdir=require(_0x3714('0x2'));var jsonpatch=require(_0x3714('0x3'));var rp=require(_0x3714('0x4'));var moment=require(_0x3714('0x5'));var BPromise=require(_0x3714('0x6'));var Mustache=require(_0x3714('0x7'));var util=require(_0x3714('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3714('0x9'));var ejs=require(_0x3714('0xa'));var fs=require('fs');var fs_extra=require(_0x3714('0xb'));var _=require('lodash');var squel=require(_0x3714('0xc'));var crypto=require(_0x3714('0xd'));var jsforce=require(_0x3714('0xe'));var deskjs=require(_0x3714('0xf'));var toCsv=require(_0x3714('0x9'));var querystring=require(_0x3714('0x10'));var Papa=require(_0x3714('0x11'));var Redis=require(_0x3714('0x12'));var authService=require(_0x3714('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3714('0x14'));var hardwareService=require(_0x3714('0x15'));var logger=require(_0x3714('0x16'))(_0x3714('0x17'));var utils=require(_0x3714('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3714('0x19'));var db=require(_0x3714('0x1a'))['db'];function respondWithStatusCode(_0x385ee,_0x2f3cfe){_0x2f3cfe=_0x2f3cfe||0xcc;return function(_0x2f3acd){if(_0x2f3acd){return _0x385ee[_0x3714('0x1b')](_0x2f3cfe);}return _0x385ee[_0x3714('0x1c')](_0x2f3cfe)[_0x3714('0x1d')]();};}function respondWithResult(_0x4e774c,_0x472b4f){_0x472b4f=_0x472b4f||0xc8;return function(_0x176bfc){if(_0x176bfc){return _0x4e774c[_0x3714('0x1c')](_0x472b4f)[_0x3714('0x1e')](_0x176bfc);}};}function respondWithFilteredResult(_0xfa7b4c,_0x411724){return function(_0x6e0176){if(_0x6e0176){var _0x589258=typeof _0x411724[_0x3714('0x1f')]===_0x3714('0x20')&&typeof _0x411724[_0x3714('0x21')]===_0x3714('0x20');var _0x280e34=_0x6e0176[_0x3714('0x22')];var _0x2041c3=_0x589258?0x0:_0x411724['offset'];var _0x2de207=_0x589258?_0x6e0176['count']:_0x411724[_0x3714('0x1f')]+_0x411724[_0x3714('0x21')];var _0x321856;if(_0x2de207>=_0x280e34){_0x2de207=_0x280e34;_0x321856=0xc8;}else{_0x321856=0xce;}_0xfa7b4c['status'](_0x321856);return _0xfa7b4c[_0x3714('0x23')](_0x3714('0x24'),_0x2041c3+'-'+_0x2de207+'/'+_0x280e34)[_0x3714('0x1e')](_0x6e0176);}return null;};}function patchUpdates(_0x109e58){return function(_0x2c7e96){try{jsonpatch[_0x3714('0x25')](_0x2c7e96,_0x109e58,!![]);}catch(_0x54d92c){return BPromise[_0x3714('0x26')](_0x54d92c);}return _0x2c7e96['save']();};}function saveUpdates(_0x307377,_0x59d693){return function(_0x32ea38){if(_0x32ea38){return _0x32ea38['update'](_0x307377)[_0x3714('0x27')](function(_0x5cb7c5){return _0x5cb7c5;});}return null;};}function removeEntity(_0x3d721a,_0x3c5305){return function(_0x1ae742){if(_0x1ae742){return _0x1ae742[_0x3714('0x28')]()[_0x3714('0x27')](function(){_0x3d721a[_0x3714('0x1c')](0xcc)[_0x3714('0x1d')]();});}};}function handleEntityNotFound(_0x35e00b,_0x4ad0f0){return function(_0x4f8959){if(!_0x4f8959){_0x35e00b[_0x3714('0x1b')](0x194);}return _0x4f8959;};}function handleError(_0x20bcdf,_0x315164){_0x315164=_0x315164||0x1f4;return function(_0x5b62fa){logger[_0x3714('0x29')](_0x5b62fa[_0x3714('0x2a')]);if(_0x5b62fa[_0x3714('0x2b')]){delete _0x5b62fa[_0x3714('0x2b')];}_0x20bcdf[_0x3714('0x1c')](_0x315164)[_0x3714('0x2c')](_0x5b62fa);};}exports[_0x3714('0x2d')]=function(_0x5e0358,_0xf833ac){if(_0x5e0358['body']['id']){delete _0x5e0358[_0x3714('0x2e')]['id'];}return db[_0x3714('0x2f')][_0x3714('0x30')]({'where':{'id':_0x5e0358[_0x3714('0x31')]['id']}})[_0x3714('0x27')](handleEntityNotFound(_0xf833ac,null))['then'](saveUpdates(_0x5e0358[_0x3714('0x2e')],null))[_0x3714('0x27')](respondWithResult(_0xf833ac,null))['catch'](handleError(_0xf833ac,null));};exports[_0x3714('0x28')]=function(_0x57bd0c,_0x37c702){return db[_0x3714('0x2f')][_0x3714('0x30')]({'where':{'id':_0x57bd0c[_0x3714('0x31')]['id']}})[_0x3714('0x27')](handleEntityNotFound(_0x37c702,null))[_0x3714('0x27')](removeEntity(_0x37c702,null))[_0x3714('0x32')](handleError(_0x37c702,null));}; \ No newline at end of file +var _0x0bb2=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','error','stack','name','send','body','Action','find','params','then','catch','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x1610ee,_0x2b892e){var _0x583b6d=function(_0x2d4ed9){while(--_0x2d4ed9){_0x1610ee['push'](_0x1610ee['shift']());}};_0x583b6d(++_0x2b892e);}(_0x0bb2,0x79));var _0x20bb=function(_0x1b6471,_0x3e169b){_0x1b6471=_0x1b6471-0x0;var _0x51f7ae=_0x0bb2[_0x1b6471];return _0x51f7ae;};'use strict';var emlformat=require(_0x20bb('0x0'));var rimraf=require(_0x20bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20bb('0x2'));var rp=require('request-promise');var moment=require(_0x20bb('0x3'));var BPromise=require(_0x20bb('0x4'));var Mustache=require(_0x20bb('0x5'));var util=require(_0x20bb('0x6'));var path=require(_0x20bb('0x7'));var sox=require(_0x20bb('0x8'));var csv=require(_0x20bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20bb('0xa'));var _=require(_0x20bb('0xb'));var squel=require(_0x20bb('0xc'));var crypto=require(_0x20bb('0xd'));var jsforce=require(_0x20bb('0xe'));var deskjs=require(_0x20bb('0xf'));var toCsv=require(_0x20bb('0x9'));var querystring=require(_0x20bb('0x10'));var Papa=require('papaparse');var Redis=require(_0x20bb('0x11'));var authService=require(_0x20bb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x20bb('0x13'));var hardwareService=require(_0x20bb('0x14'));var logger=require('../../config/logger')(_0x20bb('0x15'));var utils=require(_0x20bb('0x16'));var config=require(_0x20bb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x20bb('0x18'))['db'];function respondWithStatusCode(_0x5161a9,_0x22408e){_0x22408e=_0x22408e||0xcc;return function(_0x4db8d7){if(_0x4db8d7){return _0x5161a9[_0x20bb('0x19')](_0x22408e);}return _0x5161a9[_0x20bb('0x1a')](_0x22408e)[_0x20bb('0x1b')]();};}function respondWithResult(_0x3b4b71,_0x318fee){_0x318fee=_0x318fee||0xc8;return function(_0x5ad127){if(_0x5ad127){return _0x3b4b71[_0x20bb('0x1a')](_0x318fee)[_0x20bb('0x1c')](_0x5ad127);}};}function respondWithFilteredResult(_0x32fb96,_0x2aa94d){return function(_0x452321){if(_0x452321){var _0xaaaa9=typeof _0x2aa94d[_0x20bb('0x1d')]===_0x20bb('0x1e')&&typeof _0x2aa94d[_0x20bb('0x1f')]==='undefined';var _0x3d637c=_0x452321[_0x20bb('0x20')];var _0x5482cc=_0xaaaa9?0x0:_0x2aa94d[_0x20bb('0x1d')];var _0x26fba6=_0xaaaa9?_0x452321[_0x20bb('0x20')]:_0x2aa94d[_0x20bb('0x1d')]+_0x2aa94d['limit'];var _0x2f03bc;if(_0x26fba6>=_0x3d637c){_0x26fba6=_0x3d637c;_0x2f03bc=0xc8;}else{_0x2f03bc=0xce;}_0x32fb96[_0x20bb('0x1a')](_0x2f03bc);return _0x32fb96[_0x20bb('0x21')](_0x20bb('0x22'),_0x5482cc+'-'+_0x26fba6+'/'+_0x3d637c)[_0x20bb('0x1c')](_0x452321);}return null;};}function patchUpdates(_0x341dc6){return function(_0x372b23){try{jsonpatch['apply'](_0x372b23,_0x341dc6,!![]);}catch(_0x388c62){return BPromise['reject'](_0x388c62);}return _0x372b23[_0x20bb('0x23')]();};}function saveUpdates(_0x4f123f,_0x22a16b){return function(_0x578555){if(_0x578555){return _0x578555[_0x20bb('0x24')](_0x4f123f)['then'](function(_0x2a4e0d){return _0x2a4e0d;});}return null;};}function removeEntity(_0x3d5e55,_0x5d8174){return function(_0x806a3d){if(_0x806a3d){return _0x806a3d['destroy']()['then'](function(){_0x3d5e55['status'](0xcc)[_0x20bb('0x1b')]();});}};}function handleEntityNotFound(_0x43c473,_0x101e3c){return function(_0x5dd0b2){if(!_0x5dd0b2){_0x43c473['sendStatus'](0x194);}return _0x5dd0b2;};}function handleError(_0x3cf361,_0x495d3b){_0x495d3b=_0x495d3b||0x1f4;return function(_0x1b5a03){logger[_0x20bb('0x25')](_0x1b5a03[_0x20bb('0x26')]);if(_0x1b5a03['name']){delete _0x1b5a03[_0x20bb('0x27')];}_0x3cf361[_0x20bb('0x1a')](_0x495d3b)[_0x20bb('0x28')](_0x1b5a03);};}exports[_0x20bb('0x24')]=function(_0x342259,_0x4a2188){if(_0x342259['body']['id']){delete _0x342259[_0x20bb('0x29')]['id'];}return db[_0x20bb('0x2a')][_0x20bb('0x2b')]({'where':{'id':_0x342259[_0x20bb('0x2c')]['id']}})[_0x20bb('0x2d')](handleEntityNotFound(_0x4a2188,null))[_0x20bb('0x2d')](saveUpdates(_0x342259[_0x20bb('0x29')],null))[_0x20bb('0x2d')](respondWithResult(_0x4a2188,null))[_0x20bb('0x2e')](handleError(_0x4a2188,null));};exports[_0x20bb('0x2f')]=function(_0x12758d,_0x4263f7){return db[_0x20bb('0x2a')][_0x20bb('0x2b')]({'where':{'id':_0x12758d[_0x20bb('0x2c')]['id']}})[_0x20bb('0x2d')](handleEntityNotFound(_0x4263f7,null))[_0x20bb('0x2d')](removeEntity(_0x4263f7,null))[_0x20bb('0x2e')](handleError(_0x4263f7,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 2e19b18..f305d50 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 _0xecce=['rimraf','../../config/environment','./action.attributes','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2fc9e3,_0x16dbfc){var _0x21733a=function(_0x31a1dc){while(--_0x31a1dc){_0x2fc9e3['push'](_0x2fc9e3['shift']());}};_0x21733a(++_0x16dbfc);}(_0xecce,0x100));var _0xeecc=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0xecce[_0x46111d];return _0xe82586;};'use strict';var _=require(_0xeecc('0x0'));var util=require(_0xeecc('0x1'));var logger=require(_0xeecc('0x2'))(_0xeecc('0x3'));var moment=require(_0xeecc('0x4'));var BPromise=require(_0xeecc('0x5'));var rp=require(_0xeecc('0x6'));var fs=require('fs');var path=require(_0xeecc('0x7'));var rimraf=require(_0xeecc('0x8'));var config=require(_0xeecc('0x9'));var attributes=require(_0xeecc('0xa'));module['exports']=function(_0x4b20e4,_0x36c154){return _0x4b20e4['define']('Action',attributes,{'tableName':_0xeecc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a36=['../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','api','moment','bluebird','path'];(function(_0x3fa3a7,_0x32da22){var _0x622de9=function(_0x22412d){while(--_0x22412d){_0x3fa3a7['push'](_0x3fa3a7['shift']());}};_0x622de9(++_0x32da22);}(_0x9a36,0x102));var _0x69a3=function(_0x510715,_0x881ef){_0x510715=_0x510715-0x0;var _0x75b012=_0x9a36[_0x510715];return _0x75b012;};'use strict';var _=require(_0x69a3('0x0'));var util=require(_0x69a3('0x1'));var logger=require('../../config/logger')(_0x69a3('0x2'));var moment=require(_0x69a3('0x3'));var BPromise=require(_0x69a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x69a3('0x5'));var rimraf=require('rimraf');var config=require(_0x69a3('0x6'));var attributes=require(_0x69a3('0x7'));module[_0x69a3('0x8')]=function(_0xfde780,_0x37ebb9){return _0xfde780[_0x69a3('0x9')](_0x69a3('0xa'),attributes,{'tableName':_0x69a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 7a512d1..9586e33 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x2498a7,_0x2db9c1){var _0x576b8f=function(_0x127b14){while(--_0x127b14){_0x2498a7['push'](_0x2498a7['shift']());}};_0x576b8f(++_0x2db9c1);}(_0xe14b,0x93));var _0xbe14=function(_0x171f9e,_0x2bdf80){_0x171f9e=_0x171f9e-0x0;var _0x12f8e3=_0xe14b[_0x171f9e];return _0x12f8e3;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0xf494,0x1c6));var _0x4f49=function(_0x46cd02,_0x1acf7b){_0x46cd02=_0x46cd02-0x0;var _0x332301=_0xf494[_0x46cd02];return _0x332301;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 634970a..c94b661 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 _0x06c4=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','/:id','isAuthenticated','update'];(function(_0x5d91cd,_0x29b695){var _0x59e455=function(_0x4c2e3c){while(--_0x4c2e3c){_0x5d91cd['push'](_0x5d91cd['shift']());}};_0x59e455(++_0x29b695);}(_0x06c4,0x197));var _0x406c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06c4[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x406c('0x0'));var util=require(_0x406c('0x1'));var path=require(_0x406c('0x2'));var timeout=require(_0x406c('0x3'));var express=require(_0x406c('0x4'));var router=express[_0x406c('0x5')]();var fs_extra=require(_0x406c('0x6'));var auth=require(_0x406c('0x7'));var interaction=require(_0x406c('0x8'));var config=require('../../config/environment');var controller=require(_0x406c('0x9'));router['put'](_0x406c('0xa'),auth[_0x406c('0xb')](),controller[_0x406c('0xc')]);router[_0x406c('0xd')]('/:id',auth[_0x406c('0xb')](),controller['destroy']);module[_0x406c('0xe')]=router; \ No newline at end of file +var _0x19ad=['update','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put'];(function(_0x11afcf,_0x46133b){var _0x209a87=function(_0x1d6b6c){while(--_0x1d6b6c){_0x11afcf['push'](_0x11afcf['shift']());}};_0x209a87(++_0x46133b);}(_0x19ad,0x1f2));var _0xd19a=function(_0x237aab,_0x523604){_0x237aab=_0x237aab-0x0;var _0x55b525=_0x19ad[_0x237aab];return _0x55b525;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd19a('0x0'));var timeout=require(_0xd19a('0x1'));var express=require(_0xd19a('0x2'));var router=express[_0xd19a('0x3')]();var fs_extra=require(_0xd19a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd19a('0x5'));var config=require(_0xd19a('0x6'));var controller=require(_0xd19a('0x7'));router[_0xd19a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd19a('0x9')]);router['delete'](_0xd19a('0xa'),auth['isAuthenticated'](),controller[_0xd19a('0xb')]);module[_0xd19a('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 4f06839..906d053 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 _0x8958=['TEXT','exports'];(function(_0x4186fa,_0x26a01c){var _0x136990=function(_0x13324f){while(--_0x13324f){_0x4186fa['push'](_0x4186fa['shift']());}};_0x136990(++_0x26a01c);}(_0x8958,0x93));var _0x8895=function(_0x5c8c78,_0x19fe62){_0x5c8c78=_0x5c8c78-0x0;var _0x18e46b=_0x8958[_0x5c8c78];return _0x18e46b;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8895('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xda19=['exports','STRING','TEXT'];(function(_0x1b4753,_0x15db6e){var _0x5e865f=function(_0x463cf7){while(--_0x463cf7){_0x1b4753['push'](_0x1b4753['shift']());}};_0x5e865f(++_0x15db6e);}(_0xda19,0xd5));var _0x9da1=function(_0x3ad13b,_0x4bf486){_0x3ad13b=_0x3ad13b-0x0;var _0x4e83fc=_0xda19[_0x3ad13b];return _0x4e83fc;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index cdeb5a7..13bf1c5 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 _0x4763=['params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','groupBy','orderBy','DESC','field','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','select','format','output','web','fullPath','%s-%s.%s','randomstring','csv','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','../../files/reports','countTable','run','runReport','operator','SELECT','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show'];(function(_0x1abcc3,_0x64d8cb){var _0x17db1e=function(_0x12dc6a){while(--_0x12dc6a){_0x1abcc3['push'](_0x1abcc3['shift']());}};_0x17db1e(++_0x64d8cb);}(_0x4763,0x101));var _0x3476=function(_0x351254,_0x3b15eb){_0x351254=_0x351254-0x0;var _0x41daae=_0x4763[_0x351254];return _0x41daae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3476('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3476('0x1'));var rp=require('request-promise');var moment=require(_0x3476('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3476('0x3'));var util=require('util');var path=require(_0x3476('0x4'));var sox=require(_0x3476('0x5'));var csv=require(_0x3476('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3476('0x7'));var _=require(_0x3476('0x8'));var squel=require(_0x3476('0x9'));var crypto=require(_0x3476('0xa'));var jsforce=require(_0x3476('0xb'));var deskjs=require(_0x3476('0xc'));var toCsv=require(_0x3476('0x6'));var querystring=require('querystring');var Papa=require(_0x3476('0xd'));var Redis=require(_0x3476('0xe'));var authService=require(_0x3476('0xf'));var qs=require(_0x3476('0x10'));var as=require(_0x3476('0x11'));var hardwareService=require(_0x3476('0x12'));var logger=require(_0x3476('0x13'))(_0x3476('0x14'));var utils=require(_0x3476('0x15'));var config=require(_0x3476('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x3476('0x17'))[_0x3476('0x18')];function respondWithStatusCode(_0x44325e,_0x2375e3){_0x2375e3=_0x2375e3||0xcc;return function(_0x37c120){if(_0x37c120){return _0x44325e[_0x3476('0x19')](_0x2375e3);}return _0x44325e[_0x3476('0x1a')](_0x2375e3)[_0x3476('0x1b')]();};}function respondWithResult(_0x4975f6,_0x555d0b){_0x555d0b=_0x555d0b||0xc8;return function(_0x1ba26f){if(_0x1ba26f){return _0x4975f6[_0x3476('0x1a')](_0x555d0b)['json'](_0x1ba26f);}};}function respondWithFilteredResult(_0x2e5927,_0x27ca56){return function(_0x1c3c72){if(_0x1c3c72){var _0x36bfda=typeof _0x27ca56[_0x3476('0x1c')]===_0x3476('0x1d')&&typeof _0x27ca56[_0x3476('0x1e')]===_0x3476('0x1d');var _0x4f8937=_0x1c3c72[_0x3476('0x1f')];var _0xadada2=_0x36bfda?0x0:_0x27ca56[_0x3476('0x1c')];var _0x3cebc3=_0x36bfda?_0x1c3c72['count']:_0x27ca56[_0x3476('0x1c')]+_0x27ca56[_0x3476('0x1e')];var _0x33581b;if(_0x3cebc3>=_0x4f8937){_0x3cebc3=_0x4f8937;_0x33581b=0xc8;}else{_0x33581b=0xce;}_0x2e5927['status'](_0x33581b);return _0x2e5927[_0x3476('0x20')](_0x3476('0x21'),_0xadada2+'-'+_0x3cebc3+'/'+_0x4f8937)[_0x3476('0x22')](_0x1c3c72);}return null;};}function patchUpdates(_0x4aa811){return function(_0x48220f){try{jsonpatch['apply'](_0x48220f,_0x4aa811,!![]);}catch(_0x40f1c0){return BPromise['reject'](_0x40f1c0);}return _0x48220f[_0x3476('0x23')]();};}function saveUpdates(_0x209dcd,_0x34c249){return function(_0x39a2a3){if(_0x39a2a3){return _0x39a2a3['update'](_0x209dcd)[_0x3476('0x24')](function(_0x39ff50){return _0x39ff50;});}return null;};}function removeEntity(_0x20d09c,_0x4132bc){return function(_0x3138bc){if(_0x3138bc){return _0x3138bc[_0x3476('0x25')]()[_0x3476('0x24')](function(){var _0x1cf62a=_0x3138bc['get']({'plain':!![]});var _0x5cb4da=_0x3476('0x26');return db[_0x3476('0x27')][_0x3476('0x25')]({'where':{'type':_0x5cb4da,'resourceId':_0x1cf62a['id']}})[_0x3476('0x24')](function(){return _0x3138bc;});})[_0x3476('0x24')](function(){_0x20d09c[_0x3476('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fc6ba,_0x3d3d26){return function(_0x4db559){if(!_0x4db559){_0x1fc6ba[_0x3476('0x19')](0x194);}return _0x4db559;};}function handleError(_0x39fa0e,_0x3bcca8){_0x3bcca8=_0x3bcca8||0x1f4;return function(_0x37a1f5){logger[_0x3476('0x28')](_0x37a1f5[_0x3476('0x29')]);if(_0x37a1f5[_0x3476('0x2a')]){delete _0x37a1f5[_0x3476('0x2a')];}_0x39fa0e[_0x3476('0x1a')](_0x3bcca8)[_0x3476('0x2b')](_0x37a1f5);};}exports[_0x3476('0x2c')]=function(_0x3e81c2,_0x15826d){var _0x51de84={},_0x32e7c5={},_0x2fad7e={'count':0x0,'rows':[]};var _0x5cbea3=_[_0x3476('0x2d')](db[_0x3476('0x2e')][_0x3476('0x2f')],function(_0xbc098a){return{'name':_0xbc098a[_0x3476('0x30')],'type':_0xbc098a['type'][_0x3476('0x31')]};});_0x32e7c5[_0x3476('0x32')]=_[_0x3476('0x2d')](_0x5cbea3,'name');_0x32e7c5[_0x3476('0x33')]=_[_0x3476('0x34')](_0x3e81c2[_0x3476('0x33')]);_0x32e7c5[_0x3476('0x35')]=_[_0x3476('0x36')](_0x32e7c5[_0x3476('0x32')],_0x32e7c5[_0x3476('0x33')]);_0x51de84[_0x3476('0x37')]=_[_0x3476('0x36')](_0x32e7c5['model'],qs[_0x3476('0x38')](_0x3e81c2[_0x3476('0x33')][_0x3476('0x38')]));_0x51de84[_0x3476('0x37')]=_0x51de84[_0x3476('0x37')][_0x3476('0x39')]?_0x51de84[_0x3476('0x37')]:_0x32e7c5[_0x3476('0x32')];if(!_0x3e81c2[_0x3476('0x33')][_0x3476('0x3a')](_0x3476('0x3b'))){_0x51de84['limit']=qs[_0x3476('0x1e')](_0x3e81c2['query'][_0x3476('0x1e')]);_0x51de84[_0x3476('0x1c')]=qs[_0x3476('0x1c')](_0x3e81c2['query'][_0x3476('0x1c')]);}_0x51de84[_0x3476('0x3c')]=qs['sort'](_0x3e81c2[_0x3476('0x33')][_0x3476('0x3d')]);_0x51de84[_0x3476('0x3e')]=qs['filters'](_[_0x3476('0x3f')](_0x3e81c2[_0x3476('0x33')],_0x32e7c5[_0x3476('0x35')]),_0x5cbea3);if(_0x3e81c2[_0x3476('0x33')][_0x3476('0x40')]){_0x51de84[_0x3476('0x3e')]=_[_0x3476('0x41')](_0x51de84['where'],{'$or':_[_0x3476('0x2d')](_0x5cbea3,function(_0x3b106b){if(_0x3b106b[_0x3476('0x42')]!==_0x3476('0x43')){var _0x4ccb7e={};_0x4ccb7e[_0x3b106b[_0x3476('0x2a')]]={'$like':'%'+_0x3e81c2['query'][_0x3476('0x40')]+'%'};return _0x4ccb7e;}})});}_0x51de84=_['merge']({},_0x51de84,_0x3e81c2[_0x3476('0x44')]);var _0x56b058={'where':_0x51de84[_0x3476('0x3e')]};return db['AnalyticCustomReport'][_0x3476('0x1f')](_0x56b058)[_0x3476('0x24')](function(_0x21cfb0){_0x2fad7e[_0x3476('0x1f')]=_0x21cfb0;if(_0x3e81c2[_0x3476('0x33')][_0x3476('0x45')]){_0x51de84[_0x3476('0x46')]=[{'all':!![]}];}return db[_0x3476('0x2e')][_0x3476('0x47')](_0x51de84);})['then'](function(_0x47f581){_0x2fad7e['rows']=_0x47f581;return _0x2fad7e;})[_0x3476('0x24')](respondWithFilteredResult(_0x15826d,_0x51de84))['catch'](handleError(_0x15826d,null));};exports[_0x3476('0x48')]=function(_0x316586,_0x4387ee){var _0x1e1842={'raw':![],'where':{'id':_0x316586[_0x3476('0x49')]['id']}},_0x53f9a1={};_0x53f9a1[_0x3476('0x32')]=_[_0x3476('0x34')](db[_0x3476('0x2e')][_0x3476('0x2f')]);_0x53f9a1[_0x3476('0x33')]=_['keys'](_0x316586['query']);_0x53f9a1[_0x3476('0x35')]=_[_0x3476('0x36')](_0x53f9a1[_0x3476('0x32')],_0x53f9a1[_0x3476('0x33')]);_0x1e1842[_0x3476('0x37')]=_['intersection'](_0x53f9a1[_0x3476('0x32')],qs[_0x3476('0x38')](_0x316586[_0x3476('0x33')]['fields']));_0x1e1842[_0x3476('0x37')]=_0x1e1842[_0x3476('0x37')][_0x3476('0x39')]?_0x1e1842[_0x3476('0x37')]:_0x53f9a1['model'];if(_0x316586[_0x3476('0x33')]['includeAll']){_0x1e1842['include']=[{'all':!![]}];}_0x1e1842=_['merge']({},_0x1e1842,_0x316586['options']);return db[_0x3476('0x2e')][_0x3476('0x4a')](_0x1e1842)[_0x3476('0x24')](handleEntityNotFound(_0x4387ee,null))['then'](respondWithResult(_0x4387ee,null))['catch'](handleError(_0x4387ee,null));};exports[_0x3476('0x4b')]=function(_0x27d9db,_0x547321){return db['AnalyticCustomReport'][_0x3476('0x4b')](_0x27d9db[_0x3476('0x4c')],{})['then'](function(_0x2eaf91){var _0x3b9e9d=_0x27d9db[_0x3476('0x4d')][_0x3476('0x4e')]({'plain':!![]});if(!_0x3b9e9d)throw new Error(_0x3476('0x4f'));if(_0x3b9e9d[_0x3476('0x50')]===_0x3476('0x4d')){var _0x204c3e=_0x2eaf91[_0x3476('0x4e')]({'plain':!![]});var _0x16d298='Reports';return db[_0x3476('0x51')][_0x3476('0x4a')]({'where':{'name':_0x16d298,'userProfileId':_0x3b9e9d[_0x3476('0x52')]},'raw':!![]})['then'](function(_0xeab126){if(_0xeab126&&_0xeab126[_0x3476('0x53')]===0x0){return db[_0x3476('0x27')]['create']({'name':_0x204c3e['name'],'resourceId':_0x204c3e['id'],'type':_0x3476('0x26'),'sectionId':_0xeab126['id']},{})['then'](function(){return _0x2eaf91;});}else{return _0x2eaf91;}})['catch'](function(_0x1bb12b){logger[_0x3476('0x28')](_0x3476('0x54'),_0x1bb12b);throw _0x1bb12b;});}return _0x2eaf91;})[_0x3476('0x24')](respondWithResult(_0x547321,0xc9))[_0x3476('0x55')](handleError(_0x547321,null));};exports[_0x3476('0x56')]=function(_0xf25413,_0x5e7663){if(_0xf25413[_0x3476('0x4c')]['id']){delete _0xf25413[_0x3476('0x4c')]['id'];}return db['AnalyticCustomReport'][_0x3476('0x4a')]({'where':{'id':_0xf25413[_0x3476('0x49')]['id']}})[_0x3476('0x24')](handleEntityNotFound(_0x5e7663,null))[_0x3476('0x24')](saveUpdates(_0xf25413[_0x3476('0x4c')],null))[_0x3476('0x24')](respondWithResult(_0x5e7663,null))[_0x3476('0x55')](handleError(_0x5e7663,null));};exports[_0x3476('0x25')]=function(_0x275ebe,_0x4e33bf){return db['AnalyticCustomReport']['find']({'where':{'id':_0x275ebe[_0x3476('0x49')]['id']}})[_0x3476('0x24')](handleEntityNotFound(_0x4e33bf,null))[_0x3476('0x24')](removeEntity(_0x4e33bf,null))['catch'](handleError(_0x4e33bf,null));};exports[_0x3476('0x57')]=function(_0x193404,_0x10d4c6){var _0x2a03e4=0xa;var _0x5d3f86=[_0x3476('0x58'),_0x3476('0x59'),_0x3476('0x5a'),_0x3476('0x5b')];var _0x1d7675={'SUM':_0x3476('0x5c'),'COUNT':_0x3476('0x5d'),'COUNT DISTINCT':_0x3476('0x5e'),'MAX':_0x3476('0x5f'),'MIN':_0x3476('0x60'),'AVG':_0x3476('0x61'),'GROUP_CONCAT':_0x3476('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x3476('0x63')};var _0x58c6f4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x3476('0x64'),'HOUR':_0x3476('0x65'),'ROUND':_0x3476('0x66'),'UNIX_TIMESTAMP':_0x3476('0x67')};var _0x228d67=function(_0x55a9d1){return!_[_0x3476('0x68')]([_0x3476('0x69'),_0x3476('0x6a'),_0x3476('0x6b'),_0x3476('0x6c')],_0x55a9d1);};var _0x28990a=function(_0x1bcea8){if(!_0x1bcea8||!_0x1bcea8[_0x3476('0x6d')][_0x3476('0x39')]){return'';}for(var _0x234835='(',_0x318aed=0x0;_0x318aed<_0x1bcea8[_0x3476('0x6d')][_0x3476('0x39')];_0x318aed+=0x1){_0x318aed>0x0&&(_0x234835+='\x20'+_0x1bcea8['operator']+'\x20');_0x234835+=_0x1bcea8['rules'][_0x318aed][_0x3476('0x6e')]?_0x28990a(_0x1bcea8[_0x3476('0x6d')][_0x318aed][_0x3476('0x6e')]):_0x1bcea8[_0x3476('0x6d')][_0x318aed]['field']+'\x20'+_0x1bcea8[_0x3476('0x6d')][_0x318aed][_0x3476('0x6f')]+(_0x228d67(_0x1bcea8[_0x3476('0x6d')][_0x318aed][_0x3476('0x6f')])?'\x20'+_0x1bcea8[_0x3476('0x6d')][_0x318aed][_0x3476('0x70')]:'');}return _0x234835+')';};var _0x190ebe={'where':{'id':_0x193404['params']['id']}},_0x1bec20,_0x13b08c,_0x109b9a,_0x1223bd,_0x17bf09;_0x190ebe=_[_0x3476('0x41')]({},_0x190ebe,_0x193404[_0x3476('0x44')]);return db[_0x3476('0x2e')][_0x3476('0x4a')](_0x190ebe)[_0x3476('0x24')](function(_0x37ed78){if(_0x37ed78){_0x1bec20=_0x37ed78;return _0x37ed78[_0x3476('0x71')]();}return null;})[_0x3476('0x24')](function(_0x580544){if(_0x580544){if(!_0x580544['length']){throw new db[(_0x3476('0x72'))][(_0x3476('0x73'))](_0x3476('0x74'),0x193);}_0x13b08c=_0x580544;return db[_0x3476('0x75')][_0x3476('0x47')]({'raw':!![]});}return null;})['then'](function(_0x34524d){if(_0x34524d){_0x109b9a=_[_0x3476('0x76')](_0x34524d,'id');var _0x56a045;var _0x51449b=squel['select']();_0x51449b[_0x3476('0x77')](_0x1bec20[_0x3476('0x78')]);for(var _0xcf1e6b=0x0;_0xcf1e6b<_0x13b08c[_0x3476('0x39')];_0xcf1e6b+=0x1){_0x56a045=_0x13b08c[_0xcf1e6b][_0x3476('0x79')]?_0x109b9a[_0x13b08c[_0xcf1e6b][_0x3476('0x79')]][_0x3476('0x7a')]:_0x13b08c[_0xcf1e6b]['field'];_0x56a045=_0x13b08c[_0xcf1e6b][_0x3476('0x7b')]?_[_0x3476('0x7c')](_0x1d7675[_0x13b08c[_0xcf1e6b]['function']],'%s',_0x56a045):_0x56a045;_0x56a045=_0x13b08c[_0xcf1e6b]['format']?_['replace'](_0x58c6f4[_0x13b08c[_0xcf1e6b]['format']],'%s',_0x56a045):_0x56a045;if(_0x13b08c[_0xcf1e6b][_0x3476('0x7d')]){_0x51449b[_0x3476('0x6e')](_0x56a045);}_0x13b08c[_0xcf1e6b]['orderBy']&&_0x51449b['order'](_0x56a045,_0x13b08c[_0xcf1e6b][_0x3476('0x7e')]===_0x3476('0x7f')?![]:!![]);_0x51449b[_0x3476('0x80')](_0x56a045,_0x13b08c[_0xcf1e6b][_0x3476('0x81')]||_0x56a045);}if(_0x1bec20[_0x3476('0x82')]){_0x1bec20[_0x3476('0x82')]=JSON[_0x3476('0x83')](_0x1bec20['joins']);for(var _0x204d42=0x0;_0x204d42<_0x1bec20[_0x3476('0x82')][_0x3476('0x39')];_0x204d42+=0x1){if(_0x1bec20['joins'][_0x204d42][_0x3476('0x42')]&&_[_0x3476('0x68')](_0x5d3f86,_0x1bec20[_0x3476('0x82')][_0x204d42][_0x3476('0x42')])&&_0x1bec20['joins'][_0x204d42][_0x3476('0x84')]&&_0x1bec20[_0x3476('0x82')][_0x204d42][_0x3476('0x85')]&&_0x1bec20[_0x3476('0x82')][_0x204d42]['foreignKey']){_0x51449b[_0x1bec20[_0x3476('0x82')][_0x204d42][_0x3476('0x42')]](_0x1bec20[_0x3476('0x82')][_0x204d42][_0x3476('0x85')],null,util['format'](_0x3476('0x86'),_0x1bec20[_0x3476('0x78')],_0x1bec20[_0x3476('0x82')][_0x204d42]['parentKey'],_0x1bec20[_0x3476('0x82')][_0x204d42][_0x3476('0x85')],_0x1bec20[_0x3476('0x82')][_0x204d42][_0x3476('0x87')]));}}}if(_0x1bec20[_0x3476('0x88')]){_0x1bec20[_0x3476('0x88')]=JSON[_0x3476('0x83')](_0x1bec20[_0x3476('0x88')]);_0x51449b[_0x3476('0x3e')](_0x28990a(_0x1bec20[_0x3476('0x88')][_0x3476('0x6e')]));}_0x17bf09=_0x51449b[_0x3476('0x89')]();_0x51449b['limit'](_0x2a03e4);_0x51449b[_0x3476('0x1c')](0x0);logger[_0x3476('0x8a')](_0x3476('0x8b'),_0x51449b[_0x3476('0x8c')]());return dbH[_0x3476('0x8d')]['query'](_0x51449b[_0x3476('0x8c')](),{'type':dbH[_0x3476('0x8d')][_0x3476('0x8e')]['SELECT']});}})[_0x3476('0x24')](respondWithResult(_0x10d4c6,null))[_0x3476('0x55')](handleError(_0x10d4c6,null));};function runReport(_0x191200,_0x1cd411,_0x3ee934){var _0x5b6404=_0x1cd411[_0x3476('0x2a')];var _0x11a2d1=0xa;var _0x3ab496=[_0x3476('0x58'),_0x3476('0x59'),_0x3476('0x5a'),_0x3476('0x5b')];var _0x596a13={'SUM':_0x3476('0x5c'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x3476('0x5f'),'MIN':_0x3476('0x60'),'AVG':_0x3476('0x61'),'GROUP_CONCAT':_0x3476('0x62'),'GROUP_CONCAT ASC':_0x3476('0x8f'),'GROUP_CONCAT DESC':_0x3476('0x63')};var _0xefc144={'SEC_TO_TIME':_0x3476('0x90'),'DATE':_0x3476('0x64'),'HOUR':_0x3476('0x65'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x7d9ee0=function(_0x26ec92){return!_[_0x3476('0x68')]([_0x3476('0x69'),_0x3476('0x6a'),_0x3476('0x6b'),_0x3476('0x6c')],_0x26ec92);};var _0x1dd0bf=function(_0x552a63){if(!_0x552a63||!_0x552a63[_0x3476('0x6d')][_0x3476('0x39')]){return'';}for(var _0x3fdf11='(',_0x215662=0x0;_0x215662<_0x552a63[_0x3476('0x6d')][_0x3476('0x39')];_0x215662+=0x1){_0x215662>0x0&&(_0x3fdf11+='\x20'+_0x552a63['operator']+'\x20');_0x3fdf11+=_0x552a63['rules'][_0x215662]['group']?_0x1dd0bf(_0x552a63[_0x3476('0x6d')][_0x215662][_0x3476('0x6e')]):_0x552a63['rules'][_0x215662][_0x3476('0x80')]+'\x20'+_0x552a63['rules'][_0x215662][_0x3476('0x6f')]+(_0x7d9ee0(_0x552a63[_0x3476('0x6d')][_0x215662][_0x3476('0x6f')])?'\x20'+_0x552a63['rules'][_0x215662][_0x3476('0x70')]:'');}return _0x3fdf11+')';};var _0x56182e={'where':{'id':_0x191200['id']}},_0x5b4a12,_0x18c773,_0x302aed,_0x45551f,_0x3f2a9c;_0x56182e=_[_0x3476('0x41')]({},_0x56182e,_0x3ee934);return db[_0x3476('0x2e')][_0x3476('0x4a')](_0x56182e)[_0x3476('0x24')](function(_0x3fae28){if(_0x3fae28){_0x5b4a12=_0x3fae28;return _0x3fae28[_0x3476('0x71')]();}return null;})[_0x3476('0x24')](function(_0x356b84){if(_0x356b84){if(!_0x356b84[_0x3476('0x39')]){throw new db[(_0x3476('0x72'))][(_0x3476('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x18c773=_0x356b84;return db[_0x3476('0x75')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x294f1c){if(_0x294f1c){_0x302aed=_[_0x3476('0x76')](_0x294f1c,'id');var _0x3b79de;var _0xcc1db3=squel[_0x3476('0x91')]();_0xcc1db3[_0x3476('0x77')](_0x5b4a12[_0x3476('0x78')]);for(var _0x403043=0x0;_0x403043<_0x18c773[_0x3476('0x39')];_0x403043+=0x1){_0x3b79de=_0x18c773[_0x403043]['MetricId']?_0x302aed[_0x18c773[_0x403043][_0x3476('0x79')]]['metric']:_0x18c773[_0x403043][_0x3476('0x80')];_0x3b79de=_0x18c773[_0x403043][_0x3476('0x7b')]?_[_0x3476('0x7c')](_0x596a13[_0x18c773[_0x403043][_0x3476('0x7b')]],'%s',_0x3b79de):_0x3b79de;_0x3b79de=_0x18c773[_0x403043]['format']?_[_0x3476('0x7c')](_0xefc144[_0x18c773[_0x403043][_0x3476('0x92')]],'%s',_0x3b79de):_0x3b79de;if(_0x18c773[_0x403043]['groupBy']){_0xcc1db3['group'](_0x3b79de);}_0x18c773[_0x403043][_0x3476('0x7e')]&&_0xcc1db3[_0x3476('0x3c')](_0x3b79de,_0x18c773[_0x403043][_0x3476('0x7e')]==='DESC'?![]:!![]);_0xcc1db3['field'](_0x3b79de,_0x18c773[_0x403043][_0x3476('0x81')]||_0x3b79de);}if(_0x5b4a12['joins']){_0x5b4a12[_0x3476('0x82')]=JSON[_0x3476('0x83')](_0x5b4a12[_0x3476('0x82')]);for(var _0x2f4f9d=0x0;_0x2f4f9d<_0x5b4a12[_0x3476('0x82')]['length'];_0x2f4f9d+=0x1){if(_0x5b4a12['joins'][_0x2f4f9d][_0x3476('0x42')]&&_['includes'](_0x3ab496,_0x5b4a12[_0x3476('0x82')][_0x2f4f9d]['type'])&&_0x5b4a12[_0x3476('0x82')][_0x2f4f9d][_0x3476('0x84')]&&_0x5b4a12[_0x3476('0x82')][_0x2f4f9d]['foreignTable']&&_0x5b4a12[_0x3476('0x82')][_0x2f4f9d][_0x3476('0x87')]){_0xcc1db3[_0x5b4a12[_0x3476('0x82')][_0x2f4f9d][_0x3476('0x42')]](_0x5b4a12[_0x3476('0x82')][_0x2f4f9d][_0x3476('0x85')],null,util[_0x3476('0x92')](_0x3476('0x86'),_0x5b4a12[_0x3476('0x78')],_0x5b4a12['joins'][_0x2f4f9d][_0x3476('0x84')],_0x5b4a12[_0x3476('0x82')][_0x2f4f9d][_0x3476('0x85')],_0x5b4a12[_0x3476('0x82')][_0x2f4f9d][_0x3476('0x87')]));}}}if(_0x5b4a12[_0x3476('0x88')]){_0x5b4a12[_0x3476('0x88')]=JSON[_0x3476('0x83')](_0x5b4a12[_0x3476('0x88')]);_0xcc1db3[_0x3476('0x3e')](_0x1dd0bf(_0x5b4a12[_0x3476('0x88')][_0x3476('0x6e')]));}_0x3f2a9c=_0xcc1db3[_0x3476('0x89')]();_0xcc1db3[_0x3476('0x1e')](_0x11a2d1);_0xcc1db3[_0x3476('0x1c')](0x0);return;}})['then'](function(){if(_0x1cd411[_0x3476('0x93')]===_0x3476('0x94')){return null;}var _0x201f2b=_['merge'](_0x1cd411,{'name':_0x1cd411[_0x3476('0x95')]||_0x1cd411[_0x3476('0x2a')]||_0x5b4a12['name'],'basename':_0x5b6404,'savename':util[_0x3476('0x92')](_0x3476('0x96'),_0x1cd411[_0x3476('0x2a')]||_0x5b4a12['name'],require(_0x3476('0x97'))['generate'](0x4),_0x1cd411[_0x3476('0x93')]||_0x3476('0x98')),'reportId':_0x5b4a12['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x3476('0x4b')](_0x201f2b,{'raw':!![]});})[_0x3476('0x24')](function(_0x4e0e9c){if(_0x5b4a12[_0x3476('0x78')]===_0x3476('0x99')){_0x3f2a9c[_0x3476('0x3e')](_0x5b4a12[_0x3476('0x78')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1cd411[_0x3476('0x9a')],_0x1cd411[_0x3476('0x9b')]);}else{_0x3f2a9c[_0x3476('0x3e')](_0x5b4a12[_0x3476('0x78')]+_0x3476('0x9c'),_0x1cd411['startDate'],_0x1cd411[_0x3476('0x9b')]);}if(_0x4e0e9c){logger['info'](_0x3476('0x9d'),_0x3f2a9c[_0x3476('0x8c')]());require(_0x3476('0x9e'))['fork'](path[_0x3476('0x58')](__dirname,'../../components/export/',_0x4e0e9c[_0x3476('0x93')]),[_0x4e0e9c['id'],_0x3f2a9c[_0x3476('0x8c')](),path['join'](__dirname,_0x3476('0x9f'),_0x4e0e9c['savename']),_0x5b6404]);return _0x4e0e9c;}else{var _0x162e09=squel[_0x3476('0x91')]();_0x162e09[_0x3476('0x77')]('('+_0x3f2a9c[_0x3476('0x8c')]()+')',_0x3476('0xa0'));_0x162e09[_0x3476('0x80')]('COUNT(*)',_0x3476('0x1f'));_0x3f2a9c[_0x3476('0x1e')](_0x1cd411[_0x3476('0x1e')]||_0x11a2d1);_0x3f2a9c['offset'](_0x1cd411[_0x3476('0x1c')]||0x0);return dbH['sequelize'][_0x3476('0x33')](_0x162e09[_0x3476('0x8c')](),{'type':dbH[_0x3476('0x8d')]['QueryTypes']['SELECT']})['then'](function(_0x44f35f){if(!_0x44f35f[_0x3476('0x39')]){_0x45551f=0x0;}else{_0x45551f=_0x44f35f[0x0][_0x3476('0x1f')]||0x0;}return dbH['sequelize']['query'](_0x3f2a9c['toString'](),{'type':dbH[_0x3476('0x8d')][_0x3476('0x8e')]['SELECT']});})['then'](function(_0x2b41e8){return{'rows':_0x2b41e8||[],'count':_0x45551f};});}});}exports[_0x3476('0xa1')]=function(_0x266858,_0x361cea){return runReport(_0x266858[_0x3476('0x49')],_0x266858[_0x3476('0x33')],_0x266858[_0x3476('0x44')])[_0x3476('0x24')](respondWithResult(_0x361cea,null))[_0x3476('0x55')](handleError(_0x361cea,null));};exports[_0x3476('0xa2')]=runReport;exports[_0x3476('0x33')]=function(_0x4d8ae0,_0x1f2297){var _0x356702=0xa;var _0x258211=['join','left_join',_0x3476('0x5a'),'cross_join'];var _0x58c09a={'SUM':_0x3476('0x5c'),'COUNT':_0x3476('0x5d'),'COUNT DISTINCT':_0x3476('0x5e'),'MAX':'MAX(%s)','MIN':_0x3476('0x60'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x3476('0x62'),'GROUP_CONCAT ASC':_0x3476('0x8f'),'GROUP_CONCAT DESC':_0x3476('0x63')};var _0x8855d3={'SEC_TO_TIME':_0x3476('0x90'),'DATE':_0x3476('0x64'),'HOUR':_0x3476('0x65'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x3476('0x67')};var _0x2b69f2=function(_0x2ad466){return!_['includes']([_0x3476('0x69'),'IS\x20NOT\x20NULL',_0x3476('0x6b'),_0x3476('0x6c')],_0x2ad466);};var _0x158acb=function(_0x2fb70d){if(!_0x2fb70d||!_0x2fb70d['rules'][_0x3476('0x39')]){return'';}for(var _0x21554d='(',_0x542220=0x0;_0x542220<_0x2fb70d[_0x3476('0x6d')][_0x3476('0x39')];_0x542220+=0x1){_0x542220>0x0&&(_0x21554d+='\x20'+_0x2fb70d[_0x3476('0xa3')]+'\x20');_0x21554d+=_0x2fb70d[_0x3476('0x6d')][_0x542220][_0x3476('0x6e')]?_0x158acb(_0x2fb70d['rules'][_0x542220][_0x3476('0x6e')]):_0x2fb70d[_0x3476('0x6d')][_0x542220][_0x3476('0x80')]+'\x20'+_0x2fb70d[_0x3476('0x6d')][_0x542220]['condition']+(_0x2b69f2(_0x2fb70d[_0x3476('0x6d')][_0x542220][_0x3476('0x6f')])?'\x20'+_0x2fb70d[_0x3476('0x6d')][_0x542220][_0x3476('0x70')]:'');}return _0x21554d+')';};var _0xb2dbb7={'where':{'id':_0x4d8ae0[_0x3476('0x49')]['id']}},_0x44702e,_0x1dc417,_0x2e30fb,_0xf1c911,_0x4a8caf;_0xb2dbb7=_[_0x3476('0x41')]({},_0xb2dbb7,_0x4d8ae0[_0x3476('0x44')]);return db[_0x3476('0x2e')][_0x3476('0x4a')](_0xb2dbb7)['then'](function(_0x2bd8f3){if(_0x2bd8f3){_0x44702e=_0x2bd8f3;return _0x2bd8f3[_0x3476('0x71')]();}return null;})['then'](function(_0x139510){if(_0x139510){if(!_0x139510[_0x3476('0x39')]){throw new db['Sequelize'][(_0x3476('0x73'))](_0x3476('0x74'),0x193);}_0x1dc417=_0x139510;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x3476('0x24')](function(_0x412947){if(_0x412947){_0x2e30fb=_['keyBy'](_0x412947,'id');var _0x4acd22;var _0x48aa78=squel['select']();_0x48aa78[_0x3476('0x77')](_0x44702e[_0x3476('0x78')]);for(var _0x4aefe9=0x0;_0x4aefe9<_0x1dc417[_0x3476('0x39')];_0x4aefe9+=0x1){_0x4acd22=_0x1dc417[_0x4aefe9][_0x3476('0x79')]?_0x2e30fb[_0x1dc417[_0x4aefe9][_0x3476('0x79')]]['metric']:_0x1dc417[_0x4aefe9][_0x3476('0x80')];_0x4acd22=_0x1dc417[_0x4aefe9][_0x3476('0x7b')]?_[_0x3476('0x7c')](_0x58c09a[_0x1dc417[_0x4aefe9][_0x3476('0x7b')]],'%s',_0x4acd22):_0x4acd22;_0x4acd22=_0x1dc417[_0x4aefe9]['format']?_[_0x3476('0x7c')](_0x8855d3[_0x1dc417[_0x4aefe9][_0x3476('0x92')]],'%s',_0x4acd22):_0x4acd22;if(_0x1dc417[_0x4aefe9][_0x3476('0x7d')]){_0x48aa78[_0x3476('0x6e')](_0x4acd22);}_0x1dc417[_0x4aefe9][_0x3476('0x7e')]&&_0x48aa78['order'](_0x4acd22,_0x1dc417[_0x4aefe9][_0x3476('0x7e')]==='DESC'?![]:!![]);_0x48aa78['field'](_0x4acd22,_0x1dc417[_0x4aefe9][_0x3476('0x81')]||_0x4acd22);}if(_0x44702e[_0x3476('0x82')]){_0x44702e[_0x3476('0x82')]=JSON[_0x3476('0x83')](_0x44702e[_0x3476('0x82')]);for(var _0x304681=0x0;_0x304681<_0x44702e[_0x3476('0x82')][_0x3476('0x39')];_0x304681+=0x1){if(_0x44702e['joins'][_0x304681]['type']&&_[_0x3476('0x68')](_0x258211,_0x44702e[_0x3476('0x82')][_0x304681][_0x3476('0x42')])&&_0x44702e[_0x3476('0x82')][_0x304681]['parentKey']&&_0x44702e['joins'][_0x304681][_0x3476('0x85')]&&_0x44702e[_0x3476('0x82')][_0x304681][_0x3476('0x87')]){_0x48aa78[_0x44702e['joins'][_0x304681][_0x3476('0x42')]](_0x44702e[_0x3476('0x82')][_0x304681][_0x3476('0x85')],null,util[_0x3476('0x92')](_0x3476('0x86'),_0x44702e[_0x3476('0x78')],_0x44702e['joins'][_0x304681][_0x3476('0x84')],_0x44702e['joins'][_0x304681][_0x3476('0x85')],_0x44702e[_0x3476('0x82')][_0x304681][_0x3476('0x87')]));}}}if(_0x44702e['conditions']){_0x44702e[_0x3476('0x88')]=JSON[_0x3476('0x83')](_0x44702e['conditions']);_0x48aa78['where'](_0x158acb(_0x44702e[_0x3476('0x88')]['group']));}_0x4a8caf=_0x48aa78[_0x3476('0x89')]();_0x48aa78['limit'](_0x356702);_0x48aa78[_0x3476('0x1c')](0x0);logger[_0x3476('0x8a')](_0x3476('0x8b'),_0x48aa78[_0x3476('0x8c')]());return dbH['sequelize'][_0x3476('0x33')](_0x48aa78[_0x3476('0x8c')](),{'type':dbH[_0x3476('0x8d')][_0x3476('0x8e')][_0x3476('0xa4')]});}})[_0x3476('0x24')](function(){return{'sql':_0x4a8caf['toString']()};})[_0x3476('0x24')](respondWithResult(_0x1f2297,null))[_0x3476('0x55')](handleError(_0x1f2297,null));}; \ No newline at end of file +var _0x23d0=['generate','output','custom','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','then','destroy','get','CustomReports','error','stack','name','send','index','map','AnalyticCustomReport','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','keys','length','create','body','user','role','Reports','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','join','SUM(%s)','COUNT(%s)','ROUND(%s)','IS\x20NOT\x20EMPTY','field','getFields','groupBy','%s.%s\x20=\x20%s.%s','parse','%s-%s.%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x23d0,0x14a));var _0x023d=function(_0x497c52,_0x380429){_0x497c52=_0x497c52-0x0;var _0x34131c=_0x23d0[_0x497c52];return _0x34131c;};'use strict';var emlformat=require(_0x023d('0x0'));var rimraf=require(_0x023d('0x1'));var zipdir=require(_0x023d('0x2'));var jsonpatch=require(_0x023d('0x3'));var rp=require(_0x023d('0x4'));var moment=require(_0x023d('0x5'));var BPromise=require(_0x023d('0x6'));var Mustache=require(_0x023d('0x7'));var util=require(_0x023d('0x8'));var path=require(_0x023d('0x9'));var sox=require(_0x023d('0xa'));var csv=require(_0x023d('0xb'));var ejs=require(_0x023d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x023d('0xd'));var squel=require(_0x023d('0xe'));var crypto=require('crypto');var jsforce=require(_0x023d('0xf'));var deskjs=require(_0x023d('0x10'));var toCsv=require(_0x023d('0xb'));var querystring=require(_0x023d('0x11'));var Papa=require(_0x023d('0x12'));var Redis=require('ioredis');var authService=require(_0x023d('0x13'));var qs=require(_0x023d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x023d('0x15'));var logger=require('../../config/logger')(_0x023d('0x16'));var utils=require(_0x023d('0x17'));var config=require(_0x023d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x023d('0x19'))['db'];var dbH=require(_0x023d('0x19'))['dbH'];function respondWithStatusCode(_0x19d2df,_0xe2881f){_0xe2881f=_0xe2881f||0xcc;return function(_0x390d9f){if(_0x390d9f){return _0x19d2df['sendStatus'](_0xe2881f);}return _0x19d2df[_0x023d('0x1a')](_0xe2881f)[_0x023d('0x1b')]();};}function respondWithResult(_0x2da28a,_0x211f81){_0x211f81=_0x211f81||0xc8;return function(_0xf6b2cc){if(_0xf6b2cc){return _0x2da28a['status'](_0x211f81)[_0x023d('0x1c')](_0xf6b2cc);}};}function respondWithFilteredResult(_0x225958,_0x8de180){return function(_0x8b53bf){if(_0x8b53bf){var _0x1e4687=typeof _0x8de180[_0x023d('0x1d')]===_0x023d('0x1e')&&typeof _0x8de180['limit']===_0x023d('0x1e');var _0x34a2e7=_0x8b53bf[_0x023d('0x1f')];var _0x499495=_0x1e4687?0x0:_0x8de180['offset'];var _0x25de32=_0x1e4687?_0x8b53bf['count']:_0x8de180[_0x023d('0x1d')]+_0x8de180['limit'];var _0x38ded7;if(_0x25de32>=_0x34a2e7){_0x25de32=_0x34a2e7;_0x38ded7=0xc8;}else{_0x38ded7=0xce;}_0x225958['status'](_0x38ded7);return _0x225958[_0x023d('0x20')]('Content-Range',_0x499495+'-'+_0x25de32+'/'+_0x34a2e7)[_0x023d('0x1c')](_0x8b53bf);}return null;};}function patchUpdates(_0x184881){return function(_0x42e9ef){try{jsonpatch[_0x023d('0x21')](_0x42e9ef,_0x184881,!![]);}catch(_0x45abe1){return BPromise[_0x023d('0x22')](_0x45abe1);}return _0x42e9ef['save']();};}function saveUpdates(_0x39f046,_0x552499){return function(_0x27e8fe){if(_0x27e8fe){return _0x27e8fe['update'](_0x39f046)[_0x023d('0x23')](function(_0x32552a){return _0x32552a;});}return null;};}function removeEntity(_0x3a9710,_0x2f0569){return function(_0x121834){if(_0x121834){return _0x121834[_0x023d('0x24')]()[_0x023d('0x23')](function(){var _0x4a0a41=_0x121834[_0x023d('0x25')]({'plain':!![]});var _0x29aff1=_0x023d('0x26');return db['UserProfileResource'][_0x023d('0x24')]({'where':{'type':_0x29aff1,'resourceId':_0x4a0a41['id']}})[_0x023d('0x23')](function(){return _0x121834;});})[_0x023d('0x23')](function(){_0x3a9710[_0x023d('0x1a')](0xcc)[_0x023d('0x1b')]();});}};}function handleEntityNotFound(_0x10f445,_0x501859){return function(_0x5b024a){if(!_0x5b024a){_0x10f445['sendStatus'](0x194);}return _0x5b024a;};}function handleError(_0x1527b6,_0x365e3d){_0x365e3d=_0x365e3d||0x1f4;return function(_0x4d6720){logger[_0x023d('0x27')](_0x4d6720[_0x023d('0x28')]);if(_0x4d6720[_0x023d('0x29')]){delete _0x4d6720['name'];}_0x1527b6[_0x023d('0x1a')](_0x365e3d)[_0x023d('0x2a')](_0x4d6720);};}exports[_0x023d('0x2b')]=function(_0x26f4ea,_0x111582){var _0x15b257={},_0x111088={},_0x1c7977={'count':0x0,'rows':[]};var _0x216f9a=_[_0x023d('0x2c')](db[_0x023d('0x2d')]['rawAttributes'],function(_0x167123){return{'name':_0x167123['fieldName'],'type':_0x167123[_0x023d('0x2e')][_0x023d('0x2f')]};});_0x111088[_0x023d('0x30')]=_[_0x023d('0x2c')](_0x216f9a,'name');_0x111088[_0x023d('0x31')]=_['keys'](_0x26f4ea[_0x023d('0x31')]);_0x111088[_0x023d('0x32')]=_[_0x023d('0x33')](_0x111088[_0x023d('0x30')],_0x111088[_0x023d('0x31')]);_0x15b257[_0x023d('0x34')]=_[_0x023d('0x33')](_0x111088['model'],qs[_0x023d('0x35')](_0x26f4ea['query'][_0x023d('0x35')]));_0x15b257[_0x023d('0x34')]=_0x15b257[_0x023d('0x34')]['length']?_0x15b257[_0x023d('0x34')]:_0x111088[_0x023d('0x30')];if(!_0x26f4ea[_0x023d('0x31')]['hasOwnProperty'](_0x023d('0x36'))){_0x15b257[_0x023d('0x37')]=qs['limit'](_0x26f4ea[_0x023d('0x31')][_0x023d('0x37')]);_0x15b257[_0x023d('0x1d')]=qs[_0x023d('0x1d')](_0x26f4ea['query'][_0x023d('0x1d')]);}_0x15b257[_0x023d('0x38')]=qs[_0x023d('0x39')](_0x26f4ea['query'][_0x023d('0x39')]);_0x15b257[_0x023d('0x3a')]=qs[_0x023d('0x32')](_['pick'](_0x26f4ea['query'],_0x111088[_0x023d('0x32')]),_0x216f9a);if(_0x26f4ea['query'][_0x023d('0x3b')]){_0x15b257[_0x023d('0x3a')]=_['merge'](_0x15b257[_0x023d('0x3a')],{'$or':_['map'](_0x216f9a,function(_0x4cd855){if(_0x4cd855[_0x023d('0x2e')]!==_0x023d('0x3c')){var _0x4877a2={};_0x4877a2[_0x4cd855[_0x023d('0x29')]]={'$like':'%'+_0x26f4ea[_0x023d('0x31')][_0x023d('0x3b')]+'%'};return _0x4877a2;}})});}_0x15b257=_[_0x023d('0x3d')]({},_0x15b257,_0x26f4ea[_0x023d('0x3e')]);var _0x56d4ca={'where':_0x15b257[_0x023d('0x3a')]};return db[_0x023d('0x2d')]['count'](_0x56d4ca)[_0x023d('0x23')](function(_0x521485){_0x1c7977[_0x023d('0x1f')]=_0x521485;if(_0x26f4ea[_0x023d('0x31')]['includeAll']){_0x15b257[_0x023d('0x3f')]=[{'all':!![]}];}return db[_0x023d('0x2d')][_0x023d('0x40')](_0x15b257);})['then'](function(_0x2e956e){_0x1c7977[_0x023d('0x41')]=_0x2e956e;return _0x1c7977;})[_0x023d('0x23')](respondWithFilteredResult(_0x111582,_0x15b257))[_0x023d('0x42')](handleError(_0x111582,null));};exports[_0x023d('0x43')]=function(_0x59bda4,_0x349a52){var _0x42d962={'raw':![],'where':{'id':_0x59bda4[_0x023d('0x44')]['id']}},_0x22d8f9={};_0x22d8f9['model']=_['keys'](db[_0x023d('0x2d')][_0x023d('0x45')]);_0x22d8f9[_0x023d('0x31')]=_[_0x023d('0x46')](_0x59bda4[_0x023d('0x31')]);_0x22d8f9[_0x023d('0x32')]=_['intersection'](_0x22d8f9[_0x023d('0x30')],_0x22d8f9[_0x023d('0x31')]);_0x42d962[_0x023d('0x34')]=_[_0x023d('0x33')](_0x22d8f9[_0x023d('0x30')],qs[_0x023d('0x35')](_0x59bda4[_0x023d('0x31')]['fields']));_0x42d962['attributes']=_0x42d962[_0x023d('0x34')][_0x023d('0x47')]?_0x42d962[_0x023d('0x34')]:_0x22d8f9[_0x023d('0x30')];if(_0x59bda4[_0x023d('0x31')]['includeAll']){_0x42d962[_0x023d('0x3f')]=[{'all':!![]}];}_0x42d962=_[_0x023d('0x3d')]({},_0x42d962,_0x59bda4[_0x023d('0x3e')]);return db['AnalyticCustomReport']['find'](_0x42d962)['then'](handleEntityNotFound(_0x349a52,null))['then'](respondWithResult(_0x349a52,null))['catch'](handleError(_0x349a52,null));};exports[_0x023d('0x48')]=function(_0x2eb8a4,_0x21c74f){return db[_0x023d('0x2d')]['create'](_0x2eb8a4[_0x023d('0x49')],{})[_0x023d('0x23')](function(_0x72f9d0){var _0x5ef50f=_0x2eb8a4[_0x023d('0x4a')][_0x023d('0x25')]({'plain':!![]});if(!_0x5ef50f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ef50f[_0x023d('0x4b')]===_0x023d('0x4a')){var _0x56262a=_0x72f9d0[_0x023d('0x25')]({'plain':!![]});var _0x2db8d0=_0x023d('0x4c');return db[_0x023d('0x4d')][_0x023d('0x4e')]({'where':{'name':_0x2db8d0,'userProfileId':_0x5ef50f[_0x023d('0x4f')]},'raw':!![]})[_0x023d('0x23')](function(_0x2f93ef){if(_0x2f93ef&&_0x2f93ef['autoAssociation']===0x0){return db[_0x023d('0x50')][_0x023d('0x48')]({'name':_0x56262a['name'],'resourceId':_0x56262a['id'],'type':_0x023d('0x26'),'sectionId':_0x2f93ef['id']},{})[_0x023d('0x23')](function(){return _0x72f9d0;});}else{return _0x72f9d0;}})[_0x023d('0x42')](function(_0x5a06f6){logger['error'](_0x023d('0x51'),_0x5a06f6);throw _0x5a06f6;});}return _0x72f9d0;})[_0x023d('0x23')](respondWithResult(_0x21c74f,0xc9))[_0x023d('0x42')](handleError(_0x21c74f,null));};exports[_0x023d('0x52')]=function(_0x1d2f36,_0x153530){if(_0x1d2f36[_0x023d('0x49')]['id']){delete _0x1d2f36['body']['id'];}return db['AnalyticCustomReport'][_0x023d('0x4e')]({'where':{'id':_0x1d2f36[_0x023d('0x44')]['id']}})['then'](handleEntityNotFound(_0x153530,null))['then'](saveUpdates(_0x1d2f36[_0x023d('0x49')],null))[_0x023d('0x23')](respondWithResult(_0x153530,null))[_0x023d('0x42')](handleError(_0x153530,null));};exports['destroy']=function(_0x50f11c,_0x279d34){return db[_0x023d('0x2d')][_0x023d('0x4e')]({'where':{'id':_0x50f11c[_0x023d('0x44')]['id']}})['then'](handleEntityNotFound(_0x279d34,null))['then'](removeEntity(_0x279d34,null))[_0x023d('0x42')](handleError(_0x279d34,null));};exports[_0x023d('0x53')]=function(_0x15c237,_0x2e6865){var _0x46bd50=0xa;var _0x76f573=['join',_0x023d('0x54'),_0x023d('0x55'),_0x023d('0x56')];var _0x127d90={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x023d('0x57'),'MAX':_0x023d('0x58'),'MIN':_0x023d('0x59'),'AVG':_0x023d('0x5a'),'GROUP_CONCAT':_0x023d('0x5b'),'GROUP_CONCAT ASC':_0x023d('0x5c'),'GROUP_CONCAT DESC':_0x023d('0x5d')};var _0x31a9bf={'SEC_TO_TIME':_0x023d('0x5e'),'DATE':_0x023d('0x5f'),'HOUR':_0x023d('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x023d('0x61')};var _0x39cd55=function(_0xa13727){return!_[_0x023d('0x62')]([_0x023d('0x63'),_0x023d('0x64'),_0x023d('0x65'),'IS\x20NOT\x20EMPTY'],_0xa13727);};var _0x61cebc=function(_0x31d85d){if(!_0x31d85d||!_0x31d85d[_0x023d('0x66')]['length']){return'';}for(var _0x5f5198='(',_0x25772d=0x0;_0x25772d<_0x31d85d[_0x023d('0x66')]['length'];_0x25772d+=0x1){_0x25772d>0x0&&(_0x5f5198+='\x20'+_0x31d85d[_0x023d('0x67')]+'\x20');_0x5f5198+=_0x31d85d[_0x023d('0x66')][_0x25772d]['group']?_0x61cebc(_0x31d85d[_0x023d('0x66')][_0x25772d][_0x023d('0x68')]):_0x31d85d[_0x023d('0x66')][_0x25772d]['field']+'\x20'+_0x31d85d[_0x023d('0x66')][_0x25772d][_0x023d('0x69')]+(_0x39cd55(_0x31d85d[_0x023d('0x66')][_0x25772d][_0x023d('0x69')])?'\x20'+_0x31d85d['rules'][_0x25772d][_0x023d('0x6a')]:'');}return _0x5f5198+')';};var _0x1de973={'where':{'id':_0x15c237[_0x023d('0x44')]['id']}},_0xea88e4,_0x7f7581,_0x3d00d5,_0x5f0858,_0x2b1574;_0x1de973=_[_0x023d('0x3d')]({},_0x1de973,_0x15c237[_0x023d('0x3e')]);return db['AnalyticCustomReport'][_0x023d('0x4e')](_0x1de973)[_0x023d('0x23')](function(_0x16a1d5){if(_0x16a1d5){_0xea88e4=_0x16a1d5;return _0x16a1d5['getFields']();}return null;})['then'](function(_0x22a7ab){if(_0x22a7ab){if(!_0x22a7ab[_0x023d('0x47')]){throw new db[(_0x023d('0x6b'))][(_0x023d('0x6c'))](_0x023d('0x6d'),0x193);}_0x7f7581=_0x22a7ab;return db[_0x023d('0x6e')][_0x023d('0x40')]({'raw':!![]});}return null;})['then'](function(_0x4a0423){if(_0x4a0423){_0x3d00d5=_[_0x023d('0x6f')](_0x4a0423,'id');var _0x4bbe6a;var _0x41d7ff=squel[_0x023d('0x70')]();_0x41d7ff[_0x023d('0x71')](_0xea88e4[_0x023d('0x72')]);for(var _0x4cfd80=0x0;_0x4cfd80<_0x7f7581[_0x023d('0x47')];_0x4cfd80+=0x1){_0x4bbe6a=_0x7f7581[_0x4cfd80]['MetricId']?_0x3d00d5[_0x7f7581[_0x4cfd80][_0x023d('0x73')]][_0x023d('0x74')]:_0x7f7581[_0x4cfd80]['field'];_0x4bbe6a=_0x7f7581[_0x4cfd80][_0x023d('0x75')]?_[_0x023d('0x76')](_0x127d90[_0x7f7581[_0x4cfd80][_0x023d('0x75')]],'%s',_0x4bbe6a):_0x4bbe6a;_0x4bbe6a=_0x7f7581[_0x4cfd80][_0x023d('0x77')]?_[_0x023d('0x76')](_0x31a9bf[_0x7f7581[_0x4cfd80][_0x023d('0x77')]],'%s',_0x4bbe6a):_0x4bbe6a;if(_0x7f7581[_0x4cfd80]['groupBy']){_0x41d7ff[_0x023d('0x68')](_0x4bbe6a);}_0x7f7581[_0x4cfd80]['orderBy']&&_0x41d7ff[_0x023d('0x38')](_0x4bbe6a,_0x7f7581[_0x4cfd80][_0x023d('0x78')]===_0x023d('0x79')?![]:!![]);_0x41d7ff['field'](_0x4bbe6a,_0x7f7581[_0x4cfd80][_0x023d('0x7a')]||_0x4bbe6a);}if(_0xea88e4[_0x023d('0x7b')]){_0xea88e4[_0x023d('0x7b')]=JSON['parse'](_0xea88e4['joins']);for(var _0x42fd51=0x0;_0x42fd51<_0xea88e4[_0x023d('0x7b')][_0x023d('0x47')];_0x42fd51+=0x1){if(_0xea88e4['joins'][_0x42fd51][_0x023d('0x2e')]&&_[_0x023d('0x62')](_0x76f573,_0xea88e4['joins'][_0x42fd51][_0x023d('0x2e')])&&_0xea88e4['joins'][_0x42fd51][_0x023d('0x7c')]&&_0xea88e4[_0x023d('0x7b')][_0x42fd51][_0x023d('0x7d')]&&_0xea88e4[_0x023d('0x7b')][_0x42fd51]['foreignKey']){_0x41d7ff[_0xea88e4[_0x023d('0x7b')][_0x42fd51][_0x023d('0x2e')]](_0xea88e4['joins'][_0x42fd51][_0x023d('0x7d')],null,util[_0x023d('0x77')]('%s.%s\x20=\x20%s.%s',_0xea88e4[_0x023d('0x72')],_0xea88e4[_0x023d('0x7b')][_0x42fd51][_0x023d('0x7c')],_0xea88e4['joins'][_0x42fd51][_0x023d('0x7d')],_0xea88e4[_0x023d('0x7b')][_0x42fd51][_0x023d('0x7e')]));}}}if(_0xea88e4[_0x023d('0x7f')]){_0xea88e4[_0x023d('0x7f')]=JSON['parse'](_0xea88e4[_0x023d('0x7f')]);_0x41d7ff[_0x023d('0x3a')](_0x61cebc(_0xea88e4['conditions'][_0x023d('0x68')]));}_0x2b1574=_0x41d7ff[_0x023d('0x80')]();_0x41d7ff[_0x023d('0x37')](_0x46bd50);_0x41d7ff[_0x023d('0x1d')](0x0);logger[_0x023d('0x81')](_0x023d('0x82'),_0x41d7ff[_0x023d('0x83')]());return dbH[_0x023d('0x84')]['query'](_0x41d7ff[_0x023d('0x83')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0x023d('0x23')](respondWithResult(_0x2e6865,null))[_0x023d('0x42')](handleError(_0x2e6865,null));};function runReport(_0x36314c,_0x35fcba,_0xc50702){var _0xfbe15=_0x35fcba[_0x023d('0x29')];var _0x7519de=0xa;var _0x242d8b=[_0x023d('0x85'),'left_join',_0x023d('0x55'),_0x023d('0x56')];var _0x9bfbd0={'SUM':_0x023d('0x86'),'COUNT':_0x023d('0x87'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x023d('0x58'),'MIN':_0x023d('0x59'),'AVG':_0x023d('0x5a'),'GROUP_CONCAT':_0x023d('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1ab717={'SEC_TO_TIME':_0x023d('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x023d('0x88'),'UNIX_TIMESTAMP':_0x023d('0x61')};var _0x27de73=function(_0x3144c2){return!_[_0x023d('0x62')](['IS\x20NULL',_0x023d('0x64'),_0x023d('0x65'),_0x023d('0x89')],_0x3144c2);};var _0x5b882c=function(_0x319c66){if(!_0x319c66||!_0x319c66['rules'][_0x023d('0x47')]){return'';}for(var _0x5d8e53='(',_0x12a7b5=0x0;_0x12a7b5<_0x319c66[_0x023d('0x66')][_0x023d('0x47')];_0x12a7b5+=0x1){_0x12a7b5>0x0&&(_0x5d8e53+='\x20'+_0x319c66[_0x023d('0x67')]+'\x20');_0x5d8e53+=_0x319c66['rules'][_0x12a7b5][_0x023d('0x68')]?_0x5b882c(_0x319c66[_0x023d('0x66')][_0x12a7b5]['group']):_0x319c66[_0x023d('0x66')][_0x12a7b5][_0x023d('0x8a')]+'\x20'+_0x319c66[_0x023d('0x66')][_0x12a7b5][_0x023d('0x69')]+(_0x27de73(_0x319c66[_0x023d('0x66')][_0x12a7b5][_0x023d('0x69')])?'\x20'+_0x319c66[_0x023d('0x66')][_0x12a7b5][_0x023d('0x6a')]:'');}return _0x5d8e53+')';};var _0x3747c1={'where':{'id':_0x36314c['id']}},_0x51eb0b,_0x298521,_0x551b69,_0x1a555d,_0x2b7da2;_0x3747c1=_[_0x023d('0x3d')]({},_0x3747c1,_0xc50702);return db[_0x023d('0x2d')]['find'](_0x3747c1)['then'](function(_0x420e1e){if(_0x420e1e){_0x51eb0b=_0x420e1e;return _0x420e1e[_0x023d('0x8b')]();}return null;})[_0x023d('0x23')](function(_0x27acb0){if(_0x27acb0){if(!_0x27acb0[_0x023d('0x47')]){throw new db['Sequelize'][(_0x023d('0x6c'))](_0x023d('0x6d'),0x193);}_0x298521=_0x27acb0;return db[_0x023d('0x6e')][_0x023d('0x40')]({'raw':!![]});}return null;})[_0x023d('0x23')](function(_0xecc9ce){if(_0xecc9ce){_0x551b69=_['keyBy'](_0xecc9ce,'id');var _0x5f1752;var _0x50d56c=squel['select']();_0x50d56c[_0x023d('0x71')](_0x51eb0b[_0x023d('0x72')]);for(var _0x24b7fb=0x0;_0x24b7fb<_0x298521[_0x023d('0x47')];_0x24b7fb+=0x1){_0x5f1752=_0x298521[_0x24b7fb][_0x023d('0x73')]?_0x551b69[_0x298521[_0x24b7fb][_0x023d('0x73')]][_0x023d('0x74')]:_0x298521[_0x24b7fb][_0x023d('0x8a')];_0x5f1752=_0x298521[_0x24b7fb][_0x023d('0x75')]?_['replace'](_0x9bfbd0[_0x298521[_0x24b7fb]['function']],'%s',_0x5f1752):_0x5f1752;_0x5f1752=_0x298521[_0x24b7fb][_0x023d('0x77')]?_[_0x023d('0x76')](_0x1ab717[_0x298521[_0x24b7fb][_0x023d('0x77')]],'%s',_0x5f1752):_0x5f1752;if(_0x298521[_0x24b7fb][_0x023d('0x8c')]){_0x50d56c[_0x023d('0x68')](_0x5f1752);}_0x298521[_0x24b7fb]['orderBy']&&_0x50d56c[_0x023d('0x38')](_0x5f1752,_0x298521[_0x24b7fb][_0x023d('0x78')]==='DESC'?![]:!![]);_0x50d56c[_0x023d('0x8a')](_0x5f1752,_0x298521[_0x24b7fb][_0x023d('0x7a')]||_0x5f1752);}if(_0x51eb0b[_0x023d('0x7b')]){_0x51eb0b['joins']=JSON['parse'](_0x51eb0b[_0x023d('0x7b')]);for(var _0x2e13d2=0x0;_0x2e13d2<_0x51eb0b[_0x023d('0x7b')][_0x023d('0x47')];_0x2e13d2+=0x1){if(_0x51eb0b[_0x023d('0x7b')][_0x2e13d2]['type']&&_[_0x023d('0x62')](_0x242d8b,_0x51eb0b[_0x023d('0x7b')][_0x2e13d2]['type'])&&_0x51eb0b[_0x023d('0x7b')][_0x2e13d2][_0x023d('0x7c')]&&_0x51eb0b[_0x023d('0x7b')][_0x2e13d2][_0x023d('0x7d')]&&_0x51eb0b[_0x023d('0x7b')][_0x2e13d2][_0x023d('0x7e')]){_0x50d56c[_0x51eb0b['joins'][_0x2e13d2][_0x023d('0x2e')]](_0x51eb0b['joins'][_0x2e13d2][_0x023d('0x7d')],null,util[_0x023d('0x77')](_0x023d('0x8d'),_0x51eb0b[_0x023d('0x72')],_0x51eb0b[_0x023d('0x7b')][_0x2e13d2][_0x023d('0x7c')],_0x51eb0b[_0x023d('0x7b')][_0x2e13d2][_0x023d('0x7d')],_0x51eb0b[_0x023d('0x7b')][_0x2e13d2][_0x023d('0x7e')]));}}}if(_0x51eb0b[_0x023d('0x7f')]){_0x51eb0b[_0x023d('0x7f')]=JSON[_0x023d('0x8e')](_0x51eb0b[_0x023d('0x7f')]);_0x50d56c['where'](_0x5b882c(_0x51eb0b[_0x023d('0x7f')][_0x023d('0x68')]));}_0x2b7da2=_0x50d56c[_0x023d('0x80')]();_0x50d56c['limit'](_0x7519de);_0x50d56c[_0x023d('0x1d')](0x0);return;}})['then'](function(){if(_0x35fcba['output']==='web'){return null;}var _0x8c4504=_[_0x023d('0x3d')](_0x35fcba,{'name':_0x35fcba['fullPath']||_0x35fcba[_0x023d('0x29')]||_0x51eb0b['name'],'basename':_0xfbe15,'savename':util[_0x023d('0x77')](_0x023d('0x8f'),_0x35fcba[_0x023d('0x29')]||_0x51eb0b[_0x023d('0x29')],require('randomstring')[_0x023d('0x90')](0x4),_0x35fcba[_0x023d('0x91')]||'csv'),'reportId':_0x51eb0b['id'],'reportType':_0x023d('0x92')});return db['AnalyticExtractedReport'][_0x023d('0x48')](_0x8c4504,{'raw':!![]});})[_0x023d('0x23')](function(_0x2da706){if(_0x51eb0b[_0x023d('0x72')]==='cdr'){_0x2b7da2[_0x023d('0x3a')](_0x51eb0b[_0x023d('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x35fcba[_0x023d('0x93')],_0x35fcba[_0x023d('0x94')]);}else{_0x2b7da2[_0x023d('0x3a')](_0x51eb0b[_0x023d('0x72')]+_0x023d('0x95'),_0x35fcba[_0x023d('0x93')],_0x35fcba[_0x023d('0x94')]);}if(_0x2da706){logger['info'](_0x023d('0x96'),_0x2b7da2['toString']());require(_0x023d('0x97'))[_0x023d('0x98')](path[_0x023d('0x85')](__dirname,'../../components/export/',_0x2da706['output']),[_0x2da706['id'],_0x2b7da2['toString'](),path[_0x023d('0x85')](__dirname,_0x023d('0x99'),_0x2da706[_0x023d('0x9a')]),_0xfbe15]);return _0x2da706;}else{var _0x4d16d1=squel[_0x023d('0x70')]();_0x4d16d1[_0x023d('0x71')]('('+_0x2b7da2['toString']()+')',_0x023d('0x9b'));_0x4d16d1[_0x023d('0x8a')](_0x023d('0x9c'),_0x023d('0x1f'));_0x2b7da2[_0x023d('0x37')](_0x35fcba[_0x023d('0x37')]||_0x7519de);_0x2b7da2['offset'](_0x35fcba['offset']||0x0);return dbH[_0x023d('0x84')][_0x023d('0x31')](_0x4d16d1[_0x023d('0x83')](),{'type':dbH[_0x023d('0x84')][_0x023d('0x9d')]['SELECT']})[_0x023d('0x23')](function(_0x204485){if(!_0x204485['length']){_0x1a555d=0x0;}else{_0x1a555d=_0x204485[0x0][_0x023d('0x1f')]||0x0;}return dbH['sequelize'][_0x023d('0x31')](_0x2b7da2[_0x023d('0x83')](),{'type':dbH[_0x023d('0x84')]['QueryTypes']['SELECT']});})[_0x023d('0x23')](function(_0x59484f){return{'rows':_0x59484f||[],'count':_0x1a555d};});}});}exports['run']=function(_0x41cba6,_0x3b75dd){return runReport(_0x41cba6['params'],_0x41cba6[_0x023d('0x31')],_0x41cba6[_0x023d('0x3e')])[_0x023d('0x23')](respondWithResult(_0x3b75dd,null))['catch'](handleError(_0x3b75dd,null));};exports['runReport']=runReport;exports['query']=function(_0x5d5be3,_0x432c89){var _0x45596e=0xa;var _0xb404f=[_0x023d('0x85'),'left_join',_0x023d('0x55'),_0x023d('0x56')];var _0xcab497={'SUM':_0x023d('0x86'),'COUNT':_0x023d('0x87'),'COUNT DISTINCT':_0x023d('0x57'),'MAX':_0x023d('0x58'),'MIN':'MIN(%s)','AVG':_0x023d('0x5a'),'GROUP_CONCAT':_0x023d('0x5b'),'GROUP_CONCAT ASC':_0x023d('0x5c'),'GROUP_CONCAT DESC':_0x023d('0x5d')};var _0x51264={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x023d('0x5f'),'HOUR':_0x023d('0x60'),'ROUND':_0x023d('0x88'),'UNIX_TIMESTAMP':_0x023d('0x61')};var _0xf8f955=function(_0x3155d6){return!_['includes']([_0x023d('0x63'),_0x023d('0x64'),'IS\x20EMPTY',_0x023d('0x89')],_0x3155d6);};var _0x246bee=function(_0x59d8d9){if(!_0x59d8d9||!_0x59d8d9[_0x023d('0x66')][_0x023d('0x47')]){return'';}for(var _0x74e785='(',_0x1fba26=0x0;_0x1fba26<_0x59d8d9[_0x023d('0x66')]['length'];_0x1fba26+=0x1){_0x1fba26>0x0&&(_0x74e785+='\x20'+_0x59d8d9['operator']+'\x20');_0x74e785+=_0x59d8d9[_0x023d('0x66')][_0x1fba26][_0x023d('0x68')]?_0x246bee(_0x59d8d9[_0x023d('0x66')][_0x1fba26][_0x023d('0x68')]):_0x59d8d9[_0x023d('0x66')][_0x1fba26][_0x023d('0x8a')]+'\x20'+_0x59d8d9[_0x023d('0x66')][_0x1fba26][_0x023d('0x69')]+(_0xf8f955(_0x59d8d9[_0x023d('0x66')][_0x1fba26]['condition'])?'\x20'+_0x59d8d9[_0x023d('0x66')][_0x1fba26][_0x023d('0x6a')]:'');}return _0x74e785+')';};var _0x1f8929={'where':{'id':_0x5d5be3[_0x023d('0x44')]['id']}},_0x384718,_0x33a680,_0x425e1f,_0x88c5c0,_0x27bdc1;_0x1f8929=_[_0x023d('0x3d')]({},_0x1f8929,_0x5d5be3[_0x023d('0x3e')]);return db[_0x023d('0x2d')][_0x023d('0x4e')](_0x1f8929)['then'](function(_0x481a6f){if(_0x481a6f){_0x384718=_0x481a6f;return _0x481a6f['getFields']();}return null;})['then'](function(_0x390717){if(_0x390717){if(!_0x390717[_0x023d('0x47')]){throw new db[(_0x023d('0x6b'))][(_0x023d('0x6c'))](_0x023d('0x6d'),0x193);}_0x33a680=_0x390717;return db[_0x023d('0x6e')][_0x023d('0x40')]({'raw':!![]});}return null;})['then'](function(_0x41c064){if(_0x41c064){_0x425e1f=_['keyBy'](_0x41c064,'id');var _0x1776b0;var _0x34b353=squel[_0x023d('0x70')]();_0x34b353[_0x023d('0x71')](_0x384718[_0x023d('0x72')]);for(var _0x36e8e5=0x0;_0x36e8e5<_0x33a680[_0x023d('0x47')];_0x36e8e5+=0x1){_0x1776b0=_0x33a680[_0x36e8e5][_0x023d('0x73')]?_0x425e1f[_0x33a680[_0x36e8e5][_0x023d('0x73')]]['metric']:_0x33a680[_0x36e8e5][_0x023d('0x8a')];_0x1776b0=_0x33a680[_0x36e8e5][_0x023d('0x75')]?_[_0x023d('0x76')](_0xcab497[_0x33a680[_0x36e8e5][_0x023d('0x75')]],'%s',_0x1776b0):_0x1776b0;_0x1776b0=_0x33a680[_0x36e8e5][_0x023d('0x77')]?_['replace'](_0x51264[_0x33a680[_0x36e8e5][_0x023d('0x77')]],'%s',_0x1776b0):_0x1776b0;if(_0x33a680[_0x36e8e5][_0x023d('0x8c')]){_0x34b353[_0x023d('0x68')](_0x1776b0);}_0x33a680[_0x36e8e5]['orderBy']&&_0x34b353[_0x023d('0x38')](_0x1776b0,_0x33a680[_0x36e8e5][_0x023d('0x78')]==='DESC'?![]:!![]);_0x34b353[_0x023d('0x8a')](_0x1776b0,_0x33a680[_0x36e8e5]['alias']||_0x1776b0);}if(_0x384718[_0x023d('0x7b')]){_0x384718[_0x023d('0x7b')]=JSON[_0x023d('0x8e')](_0x384718[_0x023d('0x7b')]);for(var _0x164cda=0x0;_0x164cda<_0x384718[_0x023d('0x7b')][_0x023d('0x47')];_0x164cda+=0x1){if(_0x384718['joins'][_0x164cda][_0x023d('0x2e')]&&_[_0x023d('0x62')](_0xb404f,_0x384718[_0x023d('0x7b')][_0x164cda][_0x023d('0x2e')])&&_0x384718[_0x023d('0x7b')][_0x164cda]['parentKey']&&_0x384718[_0x023d('0x7b')][_0x164cda][_0x023d('0x7d')]&&_0x384718[_0x023d('0x7b')][_0x164cda]['foreignKey']){_0x34b353[_0x384718[_0x023d('0x7b')][_0x164cda]['type']](_0x384718['joins'][_0x164cda]['foreignTable'],null,util[_0x023d('0x77')](_0x023d('0x8d'),_0x384718[_0x023d('0x72')],_0x384718[_0x023d('0x7b')][_0x164cda][_0x023d('0x7c')],_0x384718['joins'][_0x164cda][_0x023d('0x7d')],_0x384718['joins'][_0x164cda][_0x023d('0x7e')]));}}}if(_0x384718[_0x023d('0x7f')]){_0x384718['conditions']=JSON['parse'](_0x384718[_0x023d('0x7f')]);_0x34b353[_0x023d('0x3a')](_0x246bee(_0x384718[_0x023d('0x7f')]['group']));}_0x27bdc1=_0x34b353['clone']();_0x34b353[_0x023d('0x37')](_0x45596e);_0x34b353[_0x023d('0x1d')](0x0);logger[_0x023d('0x81')](_0x023d('0x82'),_0x34b353[_0x023d('0x83')]());return dbH['sequelize'][_0x023d('0x31')](_0x34b353['toString'](),{'type':dbH[_0x023d('0x84')]['QueryTypes']['SELECT']});}})[_0x023d('0x23')](function(){return{'sql':_0x27bdc1[_0x023d('0x83')]()};})['then'](respondWithResult(_0x432c89,null))[_0x023d('0x42')](handleError(_0x432c89,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 55136e3..5ae0d2d 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 _0x545a=['../../config/environment','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','path','rimraf'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x545a,0x124));var _0xa545=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x545a[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xa545('0x0'));var util=require(_0xa545('0x1'));var logger=require('../../config/logger')(_0xa545('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa545('0x3'));var rimraf=require(_0xa545('0x4'));var config=require(_0xa545('0x5'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x414723,_0x29522f){return _0x414723[_0xa545('0x6')](_0xa545('0x7'),attributes,{'tableName':_0xa545('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c6e=['api','moment','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger'];(function(_0x4fedb7,_0x5f3fea){var _0x32a2b1=function(_0x3d267b){while(--_0x3d267b){_0x4fedb7['push'](_0x4fedb7['shift']());}};_0x32a2b1(++_0x5f3fea);}(_0x3c6e,0xa2));var _0xe3c6=function(_0x762c59,_0x5e21c9){_0x762c59=_0x762c59-0x0;var _0x27c6f3=_0x3c6e[_0x762c59];return _0x27c6f3;};'use strict';var _=require(_0xe3c6('0x0'));var util=require(_0xe3c6('0x1'));var logger=require(_0xe3c6('0x2'))(_0xe3c6('0x3'));var moment=require(_0xe3c6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3c6('0x5'));var rimraf=require(_0xe3c6('0x6'));var config=require('../../config/environment');var attributes=require(_0xe3c6('0x7'));module[_0xe3c6('0x8')]=function(_0x2c99ab,_0x2670de){return _0x2c99ab[_0xe3c6('0x9')](_0xe3c6('0xa'),attributes,{'tableName':'analytics_custom_reports','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 b7865fe..10ba3ca 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 _0xdcd0=['http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x1f3074,_0x5ed151){var _0x2b4010=function(_0x482f11){while(--_0x482f11){_0x1f3074['push'](_0x1f3074['shift']());}};_0x2b4010(++_0x5ed151);}(_0xdcd0,0xd3));var _0x0dcd=function(_0x3cd8ac,_0x2f0eb9){_0x3cd8ac=_0x3cd8ac-0x0;var _0x5e9b88=_0xdcd0[_0x3cd8ac];return _0x5e9b88;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0dcd('0x0'));var BPromise=require(_0x0dcd('0x1'));var rs=require(_0x0dcd('0x2'));var fs=require('fs');var Redis=require(_0x0dcd('0x3'));var db=require(_0x0dcd('0x4'))['db'];var utils=require(_0x0dcd('0x5'));var logger=require(_0x0dcd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0dcd('0x7'));var client=jayson[_0x0dcd('0x8')][_0x0dcd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d7f65,_0x564e9a,_0x47859e){return new BPromise(function(_0x1b86c2,_0x592343){return client[_0x0dcd('0xa')](_0x3d7f65,_0x47859e)[_0x0dcd('0xb')](function(_0x313bc8){logger[_0x0dcd('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x564e9a,_0x0dcd('0xd'));logger[_0x0dcd('0xe')](_0x0dcd('0xf'),_0x564e9a,_0x0dcd('0xd'),JSON['stringify'](_0x313bc8));if(_0x313bc8[_0x0dcd('0x10')]){if(_0x313bc8[_0x0dcd('0x10')][_0x0dcd('0x11')]===0x1f4){logger[_0x0dcd('0x10')](_0x0dcd('0x12'),_0x564e9a,_0x313bc8[_0x0dcd('0x10')][_0x0dcd('0x13')]);return _0x592343(_0x313bc8[_0x0dcd('0x10')][_0x0dcd('0x13')]);}logger[_0x0dcd('0x10')](_0x0dcd('0x12'),_0x564e9a,_0x313bc8[_0x0dcd('0x10')]['message']);return _0x1b86c2(_0x313bc8['error']['message']);}else{logger[_0x0dcd('0xc')](_0x0dcd('0x12'),_0x564e9a,_0x0dcd('0xd'));_0x1b86c2(_0x313bc8[_0x0dcd('0x14')][_0x0dcd('0x13')]);}})[_0x0dcd('0x15')](function(_0x5e96b3){logger[_0x0dcd('0x10')](_0x0dcd('0x12'),_0x564e9a,_0x5e96b3);_0x592343(_0x5e96b3);});});} \ No newline at end of file +var _0xc939=['AnalyticCustomReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x5cef34,_0x5b3cd5){var _0x1c05ba=function(_0x4ac88f){while(--_0x4ac88f){_0x5cef34['push'](_0x5cef34['shift']());}};_0x1c05ba(++_0x5b3cd5);}(_0xc939,0xb2));var _0x9c93=function(_0x293a5e,_0x23d237){_0x293a5e=_0x293a5e-0x0;var _0x2644ec=_0xc939[_0x293a5e];return _0x2644ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9c93('0x0'));var BPromise=require(_0x9c93('0x1'));var rs=require(_0x9c93('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c93('0x3'))['db'];var utils=require(_0x9c93('0x4'));var logger=require(_0x9c93('0x5'))(_0x9c93('0x6'));var config=require(_0x9c93('0x7'));var jayson=require(_0x9c93('0x8'));var client=jayson['client'][_0x9c93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3711cc,_0x298d85,_0x4836b7){return new BPromise(function(_0x244145,_0x2ddd36){return client[_0x9c93('0xa')](_0x3711cc,_0x4836b7)[_0x9c93('0xb')](function(_0x467e2c){logger['info'](_0x9c93('0xc'),_0x298d85,'request\x20sent');logger[_0x9c93('0xd')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x298d85,'request\x20sent',JSON[_0x9c93('0xe')](_0x467e2c));if(_0x467e2c[_0x9c93('0xf')]){if(_0x467e2c[_0x9c93('0xf')][_0x9c93('0x10')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x298d85,_0x467e2c[_0x9c93('0xf')][_0x9c93('0x11')]);return _0x2ddd36(_0x467e2c[_0x9c93('0xf')]['message']);}logger[_0x9c93('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x298d85,_0x467e2c[_0x9c93('0xf')]['message']);return _0x244145(_0x467e2c[_0x9c93('0xf')][_0x9c93('0x11')]);}else{logger['info'](_0x9c93('0xc'),_0x298d85,_0x9c93('0x12'));_0x244145(_0x467e2c['result'][_0x9c93('0x11')]);}})['catch'](function(_0x5de8e7){logger[_0x9c93('0xf')](_0x9c93('0xc'),_0x298d85,_0x5de8e7);_0x2ddd36(_0x5de8e7);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index b92693d..209c21f 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 _0xf508=['../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','preview','/:id/run','run','/:id/query','query','post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xf508,0xa3));var _0x8f50=function(_0x3520b9,_0x4d6e7f){_0x3520b9=_0x3520b9-0x0;var _0x55a714=_0xf508[_0x3520b9];return _0x55a714;};'use strict';var multer=require('multer');var util=require(_0x8f50('0x0'));var path=require(_0x8f50('0x1'));var timeout=require(_0x8f50('0x2'));var express=require('express');var router=express[_0x8f50('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8f50('0x4'));var interaction=require(_0x8f50('0x5'));var config=require(_0x8f50('0x6'));var controller=require(_0x8f50('0x7'));router[_0x8f50('0x8')]('/',auth['isAuthenticated'](),controller[_0x8f50('0x9')]);router[_0x8f50('0x8')](_0x8f50('0xa'),auth[_0x8f50('0xb')](),controller[_0x8f50('0xc')]);router['get']('/:id/preview',auth[_0x8f50('0xb')](),controller[_0x8f50('0xd')]);router[_0x8f50('0x8')](_0x8f50('0xe'),auth[_0x8f50('0xb')](),controller[_0x8f50('0xf')]);router[_0x8f50('0x8')](_0x8f50('0x10'),auth[_0x8f50('0xb')](),controller[_0x8f50('0x11')]);router[_0x8f50('0x12')]('/',auth['isAuthenticated'](),controller[_0x8f50('0x13')]);router['put']('/:id',auth[_0x8f50('0xb')](),controller[_0x8f50('0x14')]);router[_0x8f50('0x15')](_0x8f50('0xa'),auth[_0x8f50('0xb')](),controller[_0x8f50('0x16')]);module[_0x8f50('0x17')]=router; \ No newline at end of file +var _0xcef9=['preview','/:id/run','run','/:id/query','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','/:id','/:id/preview','isAuthenticated'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcef9,0x7c));var _0x9cef=function(_0x1f0213,_0x3c3c9e){_0x1f0213=_0x1f0213-0x0;var _0x2048c4=_0xcef9[_0x1f0213];return _0x2048c4;};'use strict';var multer=require(_0x9cef('0x0'));var util=require(_0x9cef('0x1'));var path=require(_0x9cef('0x2'));var timeout=require(_0x9cef('0x3'));var express=require(_0x9cef('0x4'));var router=express[_0x9cef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9cef('0x6'));var interaction=require(_0x9cef('0x7'));var config=require(_0x9cef('0x8'));var controller=require(_0x9cef('0x9'));router[_0x9cef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9cef('0xa')](_0x9cef('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9cef('0xa')](_0x9cef('0xc'),auth[_0x9cef('0xd')](),controller[_0x9cef('0xe')]);router[_0x9cef('0xa')](_0x9cef('0xf'),auth[_0x9cef('0xd')](),controller[_0x9cef('0x10')]);router['get'](_0x9cef('0x11'),auth['isAuthenticated'](),controller['query']);router[_0x9cef('0x12')]('/',auth[_0x9cef('0xd')](),controller[_0x9cef('0x13')]);router[_0x9cef('0x14')](_0x9cef('0xb'),auth[_0x9cef('0xd')](),controller['update']);router['delete'](_0x9cef('0xb'),auth['isAuthenticated'](),controller[_0x9cef('0x15')]);module[_0x9cef('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 9a0c6e4..2ec3772 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 _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x1f848c,_0x29a629){var _0x5753aa=function(_0x525e86){while(--_0x525e86){_0x1f848c['push'](_0x1f848c['shift']());}};_0x5753aa(++_0x29a629);}(_0xeda8,0x104));var _0x8eda=function(_0x4a27a4,_0x398e32){_0x4a27a4=_0x4a27a4-0x0;var _0x45e450=_0xeda8[_0x4a27a4];return _0x45e450;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file +var _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x4e8e43,_0x1f54c9){var _0x1e489f=function(_0x5a5f5f){while(--_0x5a5f5f){_0x4e8e43['push'](_0x4e8e43['shift']());}};_0x1e489f(++_0x1f54c9);}(_0xeda8,0x104));var _0x8eda=function(_0x454c62,_0x568ba6){_0x454c62=_0x454c62-0x0;var _0x157465=_0xeda8[_0x454c62];return _0x157465;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 2a26df8..507002f 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 _0x4819=['keyBy','table','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','from','countTable','COUNT(*)','SELECT','run','cross_join','COUNT(DISTINCT\x20%s)','debug','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../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','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','AnalyticDefaultReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','body','preview','join','left_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','MetricId','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20EMPTY','operator','condition'];(function(_0x11cbbd,_0x5d4106){var _0x153af2=function(_0xd8cb94){while(--_0xd8cb94){_0x11cbbd['push'](_0x11cbbd['shift']());}};_0x153af2(++_0x5d4106);}(_0x4819,0xcd));var _0x9481=function(_0x15eab7,_0x49bed6){_0x15eab7=_0x15eab7-0x0;var _0x1f15c6=_0x4819[_0x15eab7];return _0x1f15c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];var dbH=require(_0x9481('0x19'))['dbH'];function respondWithStatusCode(_0x5aac02,_0xce6fa2){_0xce6fa2=_0xce6fa2||0xcc;return function(_0x150276){if(_0x150276){return _0x5aac02[_0x9481('0x1a')](_0xce6fa2);}return _0x5aac02[_0x9481('0x1b')](_0xce6fa2)[_0x9481('0x1c')]();};}function respondWithResult(_0xc7a0b5,_0x3fb97f){_0x3fb97f=_0x3fb97f||0xc8;return function(_0x495b30){if(_0x495b30){return _0xc7a0b5[_0x9481('0x1b')](_0x3fb97f)[_0x9481('0x1d')](_0x495b30);}};}function respondWithFilteredResult(_0x5b1fe6,_0x2266d5){return function(_0x518150){if(_0x518150){var _0x34108d=typeof _0x2266d5[_0x9481('0x1e')]===_0x9481('0x1f')&&typeof _0x2266d5[_0x9481('0x20')]==='undefined';var _0x5eda66=_0x518150[_0x9481('0x21')];var _0x50a559=_0x34108d?0x0:_0x2266d5['offset'];var _0x26671c=_0x34108d?_0x518150[_0x9481('0x21')]:_0x2266d5[_0x9481('0x1e')]+_0x2266d5[_0x9481('0x20')];var _0x7000e7;if(_0x26671c>=_0x5eda66){_0x26671c=_0x5eda66;_0x7000e7=0xc8;}else{_0x7000e7=0xce;}_0x5b1fe6[_0x9481('0x1b')](_0x7000e7);return _0x5b1fe6['set'](_0x9481('0x22'),_0x50a559+'-'+_0x26671c+'/'+_0x5eda66)[_0x9481('0x1d')](_0x518150);}return null;};}function patchUpdates(_0x45f9df){return function(_0x615e02){try{jsonpatch[_0x9481('0x23')](_0x615e02,_0x45f9df,!![]);}catch(_0x56da97){return BPromise[_0x9481('0x24')](_0x56da97);}return _0x615e02[_0x9481('0x25')]();};}function saveUpdates(_0x572599,_0x2bcf37){return function(_0xd1cd1a){if(_0xd1cd1a){return _0xd1cd1a[_0x9481('0x26')](_0x572599)[_0x9481('0x27')](function(_0x2dc02e){return _0x2dc02e;});}return null;};}function removeEntity(_0x49ecfa,_0x91e3d9){return function(_0x22f0b5){if(_0x22f0b5){return _0x22f0b5['destroy']()['then'](function(){var _0x12b0c3=_0x22f0b5[_0x9481('0x28')]({'plain':!![]});var _0x550fce=_0x9481('0x29');return db[_0x9481('0x2a')][_0x9481('0x2b')]({'where':{'type':_0x550fce,'resourceId':_0x12b0c3['id']}})[_0x9481('0x27')](function(){return _0x22f0b5;});})['then'](function(){_0x49ecfa[_0x9481('0x1b')](0xcc)[_0x9481('0x1c')]();});}};}function handleEntityNotFound(_0x3c2585,_0x587706){return function(_0x1791b2){if(!_0x1791b2){_0x3c2585['sendStatus'](0x194);}return _0x1791b2;};}function handleError(_0x2e1eff,_0xe153ab){_0xe153ab=_0xe153ab||0x1f4;return function(_0x22ab26){logger[_0x9481('0x2c')](_0x22ab26[_0x9481('0x2d')]);if(_0x22ab26['name']){delete _0x22ab26[_0x9481('0x2e')];}_0x2e1eff[_0x9481('0x1b')](_0xe153ab)[_0x9481('0x2f')](_0x22ab26);};}exports['index']=function(_0x56752e,_0x1addc8){var _0x427c25={},_0x42df68={},_0x2b33f8={'count':0x0,'rows':[]};var _0x5d9926=_['map'](db['AnalyticDefaultReport'][_0x9481('0x30')],function(_0x5d6c65){return{'name':_0x5d6c65[_0x9481('0x31')],'type':_0x5d6c65['type'][_0x9481('0x32')]};});_0x42df68[_0x9481('0x33')]=_[_0x9481('0x34')](_0x5d9926,_0x9481('0x2e'));_0x42df68[_0x9481('0x35')]=_['keys'](_0x56752e[_0x9481('0x35')]);_0x42df68[_0x9481('0x36')]=_[_0x9481('0x37')](_0x42df68['model'],_0x42df68[_0x9481('0x35')]);_0x427c25[_0x9481('0x38')]=_[_0x9481('0x37')](_0x42df68[_0x9481('0x33')],qs[_0x9481('0x39')](_0x56752e[_0x9481('0x35')]['fields']));_0x427c25[_0x9481('0x38')]=_0x427c25['attributes'][_0x9481('0x3a')]?_0x427c25[_0x9481('0x38')]:_0x42df68[_0x9481('0x33')];if(!_0x56752e[_0x9481('0x35')][_0x9481('0x3b')](_0x9481('0x3c'))){_0x427c25['limit']=qs[_0x9481('0x20')](_0x56752e[_0x9481('0x35')]['limit']);_0x427c25['offset']=qs[_0x9481('0x1e')](_0x56752e['query'][_0x9481('0x1e')]);}_0x427c25[_0x9481('0x3d')]=qs[_0x9481('0x3e')](_0x56752e[_0x9481('0x35')]['sort']);_0x427c25[_0x9481('0x3f')]=qs['filters'](_[_0x9481('0x40')](_0x56752e['query'],_0x42df68[_0x9481('0x36')]),_0x5d9926);if(_0x56752e['query'][_0x9481('0x41')]){_0x427c25[_0x9481('0x3f')]=_[_0x9481('0x42')](_0x427c25[_0x9481('0x3f')],{'$or':_[_0x9481('0x34')](_0x5d9926,function(_0x3b7998){if(_0x3b7998[_0x9481('0x43')]!=='VIRTUAL'){var _0x464080={};_0x464080[_0x3b7998[_0x9481('0x2e')]]={'$like':'%'+_0x56752e[_0x9481('0x35')][_0x9481('0x41')]+'%'};return _0x464080;}})});}_0x427c25=_[_0x9481('0x42')]({},_0x427c25,_0x56752e[_0x9481('0x44')]);var _0x2e4241={'where':_0x427c25['where']};return db[_0x9481('0x45')][_0x9481('0x21')](_0x2e4241)['then'](function(_0x704e81){_0x2b33f8[_0x9481('0x21')]=_0x704e81;if(_0x56752e[_0x9481('0x35')][_0x9481('0x46')]){_0x427c25[_0x9481('0x47')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x9481('0x48')](_0x427c25);})['then'](function(_0x23811a){_0x2b33f8[_0x9481('0x49')]=_0x23811a;return _0x2b33f8;})['then'](respondWithFilteredResult(_0x1addc8,_0x427c25))['catch'](handleError(_0x1addc8,null));};exports[_0x9481('0x4a')]=function(_0x1d0df0,_0x42b19a){var _0x4c4caf={'raw':!![],'where':{'id':_0x1d0df0[_0x9481('0x4b')]['id']}},_0x4402f6={};_0x4402f6['model']=_['keys'](db[_0x9481('0x45')]['rawAttributes']);_0x4402f6[_0x9481('0x35')]=_[_0x9481('0x4c')](_0x1d0df0[_0x9481('0x35')]);_0x4402f6[_0x9481('0x36')]=_[_0x9481('0x37')](_0x4402f6['model'],_0x4402f6[_0x9481('0x35')]);_0x4c4caf[_0x9481('0x38')]=_['intersection'](_0x4402f6[_0x9481('0x33')],qs[_0x9481('0x39')](_0x1d0df0[_0x9481('0x35')][_0x9481('0x39')]));_0x4c4caf[_0x9481('0x38')]=_0x4c4caf[_0x9481('0x38')][_0x9481('0x3a')]?_0x4c4caf[_0x9481('0x38')]:_0x4402f6[_0x9481('0x33')];if(_0x1d0df0['query'][_0x9481('0x46')]){_0x4c4caf['include']=[{'all':!![]}];}_0x4c4caf=_['merge']({},_0x4c4caf,_0x1d0df0[_0x9481('0x44')]);return db['AnalyticDefaultReport'][_0x9481('0x4d')](_0x4c4caf)[_0x9481('0x27')](handleEntityNotFound(_0x42b19a,null))['then'](respondWithResult(_0x42b19a,null))[_0x9481('0x4e')](handleError(_0x42b19a,null));};exports[_0x9481('0x4f')]=function(_0x2f3413,_0x13b674){return db[_0x9481('0x45')][_0x9481('0x4f')](_0x2f3413['body'],{})['then'](function(_0x424b22){var _0x44d7e0=_0x2f3413[_0x9481('0x50')][_0x9481('0x28')]({'plain':!![]});if(!_0x44d7e0)throw new Error(_0x9481('0x51'));if(_0x44d7e0[_0x9481('0x52')]===_0x9481('0x50')){var _0x3d2250=_0x424b22['get']({'plain':!![]});var _0x3972c1=_0x9481('0x53');return db[_0x9481('0x54')][_0x9481('0x4d')]({'where':{'name':_0x3972c1,'userProfileId':_0x44d7e0[_0x9481('0x55')]},'raw':!![]})['then'](function(_0x4c3048){if(_0x4c3048&&_0x4c3048[_0x9481('0x56')]===0x0){return db[_0x9481('0x2a')][_0x9481('0x4f')]({'name':_0x3d2250['name'],'resourceId':_0x3d2250['id'],'type':'DefaultReports','sectionId':_0x4c3048['id']},{})['then'](function(){return _0x424b22;});}else{return _0x424b22;}})['catch'](function(_0x538507){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x538507);throw _0x538507;});}return _0x424b22;})[_0x9481('0x27')](respondWithResult(_0x13b674,0xc9))[_0x9481('0x4e')](handleError(_0x13b674,null));};exports['update']=function(_0xd8351c,_0x5f210c){if(_0xd8351c[_0x9481('0x57')]['id']){delete _0xd8351c[_0x9481('0x57')]['id'];}return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0xd8351c[_0x9481('0x4b')]['id']}})[_0x9481('0x27')](handleEntityNotFound(_0x5f210c,null))[_0x9481('0x27')](saveUpdates(_0xd8351c['body'],null))[_0x9481('0x27')](respondWithResult(_0x5f210c,null))[_0x9481('0x4e')](handleError(_0x5f210c,null));};exports['destroy']=function(_0x16416a,_0x1240dc){return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0x16416a[_0x9481('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1240dc,null))[_0x9481('0x27')](removeEntity(_0x1240dc,null))[_0x9481('0x4e')](handleError(_0x1240dc,null));};exports[_0x9481('0x58')]=function(_0x3fc0f9,_0x559dd2){var _0x3ac428=0xa;var _0x2927f5=[_0x9481('0x59'),_0x9481('0x5a'),'right_join','cross_join'];var _0x5b4234={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x589b16={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x239676=function(_0x205b96){return!_['includes'](['IS\x20NULL',_0x9481('0x67'),'IS\x20EMPTY',_0x9481('0x68')],_0x205b96);};var _0x59637f=function(_0x9af916){if(!_0x9af916||!_0x9af916[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x492464='(',_0x28d331=0x0;_0x28d331<_0x9af916[_0x9481('0x69')]['length'];_0x28d331+=0x1){_0x28d331>0x0&&(_0x492464+='\x20'+_0x9af916['operator']+'\x20');_0x492464+=_0x9af916['rules'][_0x28d331]['group']?_0x59637f(_0x9af916[_0x9481('0x69')][_0x28d331]['group']):_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6a')]+'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331]['condition']+(_0x239676(_0x9af916[_0x9481('0x69')][_0x28d331]['condition'])?'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6b')]:'');}return _0x492464+')';};var _0x3c267b={'where':{'id':_0x3fc0f9[_0x9481('0x4b')]['id']}},_0x4f157d,_0x2f20b4,_0x40fed2,_0x4ff016,_0x321972;_0x3c267b=_[_0x9481('0x42')]({},_0x3c267b,_0x3fc0f9[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x3c267b)[_0x9481('0x27')](function(_0x32ebde){if(_0x32ebde){_0x4f157d=_0x32ebde;return _0x32ebde[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x237d9b){if(_0x237d9b){if(!_0x237d9b[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x2f20b4=_0x237d9b;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})['then'](function(_0x1e05f8){if(_0x1e05f8){_0x40fed2=_['keyBy'](_0x1e05f8,'id');var _0x47bf37;var _0x1a7892=squel['select']();_0x1a7892['from'](_0x4f157d['table']);for(var _0x1b1967=0x0;_0x1b1967<_0x2f20b4[_0x9481('0x3a')];_0x1b1967+=0x1){_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x71')]?_0x40fed2[_0x2f20b4[_0x1b1967][_0x9481('0x71')]]['metric']:_0x2f20b4[_0x1b1967][_0x9481('0x6a')];_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x72')]?_[_0x9481('0x73')](_0x5b4234[_0x2f20b4[_0x1b1967][_0x9481('0x72')]],'%s',_0x47bf37):_0x47bf37;_0x47bf37=_0x2f20b4[_0x1b1967]['format']?_['replace'](_0x589b16[_0x2f20b4[_0x1b1967][_0x9481('0x74')]],'%s',_0x47bf37):_0x47bf37;if(_0x2f20b4[_0x1b1967][_0x9481('0x75')]){_0x1a7892[_0x9481('0x76')](_0x47bf37);}_0x2f20b4[_0x1b1967][_0x9481('0x77')]&&_0x1a7892[_0x9481('0x3d')](_0x47bf37,_0x2f20b4[_0x1b1967]['orderBy']===_0x9481('0x78')?![]:!![]);_0x1a7892[_0x9481('0x6a')](_0x47bf37,_0x2f20b4[_0x1b1967][_0x9481('0x79')]||_0x47bf37);}if(_0x4f157d[_0x9481('0x7a')]){_0x4f157d[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x4f157d[_0x9481('0x7a')]);for(var _0x42a6d2=0x0;_0x42a6d2<_0x4f157d[_0x9481('0x7a')][_0x9481('0x3a')];_0x42a6d2+=0x1){if(_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2927f5,_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')])&&_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7d')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7e')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7f')]){_0x1a7892[_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]](_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x4f157d['table'],_0x4f157d[_0x9481('0x7a')][_0x42a6d2]['parentKey'],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7f')]));}}}if(_0x4f157d[_0x9481('0x80')]){_0x4f157d[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x4f157d['conditions']);_0x1a7892[_0x9481('0x3f')](_0x59637f(_0x4f157d['conditions'][_0x9481('0x76')]));}_0x321972=_0x1a7892[_0x9481('0x81')]();_0x1a7892[_0x9481('0x20')](_0x3ac428);_0x1a7892['offset'](0x0);logger['debug']('Limited\x20Query:',_0x1a7892[_0x9481('0x82')]());return dbH['sequelize']['query'](_0x1a7892[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')]['SELECT']});}})[_0x9481('0x27')](respondWithResult(_0x559dd2,null))[_0x9481('0x4e')](handleError(_0x559dd2,null));};function runReport(_0x545457,_0x226932,_0x3c8241){var _0x1ea93a=_0x226932[_0x9481('0x2e')];var _0x5f4be2=0xa;var _0x2e585d=['join',_0x9481('0x5a'),_0x9481('0x85'),'cross_join'];var _0x1c82a1={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x9481('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x55b428={'SEC_TO_TIME':_0x9481('0x86'),'DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9481('0x66')};var _0x31e097=function(_0x339a30){return!_[_0x9481('0x7c')]([_0x9481('0x87'),_0x9481('0x67'),_0x9481('0x88'),_0x9481('0x68')],_0x339a30);};var _0x22e787=function(_0x31b70b){if(!_0x31b70b||!_0x31b70b['rules'][_0x9481('0x3a')]){return'';}for(var _0x5c430e='(',_0x4f55b5=0x0;_0x4f55b5<_0x31b70b['rules'][_0x9481('0x3a')];_0x4f55b5+=0x1){_0x4f55b5>0x0&&(_0x5c430e+='\x20'+_0x31b70b[_0x9481('0x89')]+'\x20');_0x5c430e+=_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x76')]?_0x22e787(_0x31b70b[_0x9481('0x69')][_0x4f55b5]['group']):_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6a')]+'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')]+(_0x31e097(_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')])?'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6b')]:'');}return _0x5c430e+')';};var _0x28d924={'where':{'id':_0x545457['id']}},_0x426d56,_0x5808c8,_0x27be69,_0x1d49ba,_0x458a6f;_0x28d924=_[_0x9481('0x42')]({},_0x28d924,_0x3c8241);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x28d924)[_0x9481('0x27')](function(_0x1173e9){if(_0x1173e9){_0x426d56=_0x1173e9;return _0x1173e9[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x5557d7){if(_0x5557d7){if(!_0x5557d7[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x5808c8=_0x5557d7;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x3ae3e2){if(_0x3ae3e2){_0x27be69=_[_0x9481('0x8b')](_0x3ae3e2,'id');var _0x538fe0;var _0x44e2c2=squel['select']();_0x44e2c2['from'](_0x426d56[_0x9481('0x8c')]);for(var _0x382455=0x0;_0x382455<_0x5808c8[_0x9481('0x3a')];_0x382455+=0x1){_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x71')]?_0x27be69[_0x5808c8[_0x382455][_0x9481('0x71')]][_0x9481('0x8d')]:_0x5808c8[_0x382455]['field'];_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x72')]?_['replace'](_0x1c82a1[_0x5808c8[_0x382455][_0x9481('0x72')]],'%s',_0x538fe0):_0x538fe0;_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x74')]?_[_0x9481('0x73')](_0x55b428[_0x5808c8[_0x382455]['format']],'%s',_0x538fe0):_0x538fe0;if(_0x5808c8[_0x382455]['groupBy']){_0x44e2c2[_0x9481('0x76')](_0x538fe0);}_0x5808c8[_0x382455][_0x9481('0x77')]&&_0x44e2c2[_0x9481('0x3d')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x44e2c2[_0x9481('0x6a')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x79')]||_0x538fe0);}if(_0x426d56[_0x9481('0x7a')]){_0x426d56[_0x9481('0x7a')]=JSON['parse'](_0x426d56[_0x9481('0x7a')]);for(var _0xd64114=0x0;_0xd64114<_0x426d56['joins'][_0x9481('0x3a')];_0xd64114+=0x1){if(_0x426d56['joins'][_0xd64114][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2e585d,_0x426d56['joins'][_0xd64114][_0x9481('0x43')])&&_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')]&&_0x426d56['joins'][_0xd64114][_0x9481('0x7e')]&&_0x426d56[_0x9481('0x7a')][_0xd64114]['foreignKey']){_0x44e2c2[_0x426d56[_0x9481('0x7a')][_0xd64114]['type']](_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x426d56['table'],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7f')]));}}}if(_0x426d56['conditions']){_0x426d56[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x426d56[_0x9481('0x80')]);_0x44e2c2[_0x9481('0x3f')](_0x22e787(_0x426d56[_0x9481('0x80')][_0x9481('0x76')]));}_0x458a6f=_0x44e2c2[_0x9481('0x81')]();_0x44e2c2['limit'](_0x5f4be2);_0x44e2c2[_0x9481('0x1e')](0x0);return;}})[_0x9481('0x27')](function(){if(_0x226932[_0x9481('0x8e')]===_0x9481('0x8f')){return null;}var _0x4e5a8d=_[_0x9481('0x42')](_0x226932,{'name':_0x226932[_0x9481('0x90')]||_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],'basename':_0x1ea93a,'savename':util['format'](_0x9481('0x91'),_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],require(_0x9481('0x92'))[_0x9481('0x93')](0x4),_0x226932[_0x9481('0x8e')]||_0x9481('0x94')),'reportId':_0x426d56['id'],'reportType':_0x9481('0x95')});return db[_0x9481('0x96')][_0x9481('0x4f')](_0x4e5a8d,{'raw':!![]});})[_0x9481('0x27')](function(_0x5930d6){if(_0x426d56[_0x9481('0x8c')]==='cdr'){_0x458a6f[_0x9481('0x3f')](_0x426d56[_0x9481('0x8c')]+_0x9481('0x97'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}else{_0x458a6f['where'](_0x426d56[_0x9481('0x8c')]+_0x9481('0x9a'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}if(_0x5930d6){logger[_0x9481('0x9b')](_0x9481('0x9c'),_0x458a6f['toString']());require(_0x9481('0x9d'))[_0x9481('0x9e')](path[_0x9481('0x59')](__dirname,_0x9481('0x9f'),_0x5930d6[_0x9481('0x8e')]),[_0x5930d6['id'],_0x458a6f[_0x9481('0x82')](),path[_0x9481('0x59')](__dirname,_0x9481('0xa0'),_0x5930d6[_0x9481('0xa1')]),_0x1ea93a]);return _0x5930d6;}else{var _0x26a666=squel[_0x9481('0xa2')]();_0x26a666[_0x9481('0xa3')]('('+_0x458a6f['toString']()+')',_0x9481('0xa4'));_0x26a666[_0x9481('0x6a')](_0x9481('0xa5'),_0x9481('0x21'));_0x458a6f[_0x9481('0x20')](_0x226932[_0x9481('0x20')]||_0x5f4be2);_0x458a6f[_0x9481('0x1e')](_0x226932[_0x9481('0x1e')]||0x0);return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x26a666[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]})[_0x9481('0x27')](function(_0xcf83d2){if(!_0xcf83d2[_0x9481('0x3a')]){_0x1d49ba=0x0;}else{_0x1d49ba=_0xcf83d2[0x0][_0x9481('0x21')]||0x0;}return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x458a6f['toString'](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});})[_0x9481('0x27')](function(_0x4553fc){return{'rows':_0x4553fc||[],'count':_0x1d49ba};});}});}exports[_0x9481('0xa7')]=function(_0x55c4ab,_0x57928a){return runReport(_0x55c4ab[_0x9481('0x4b')],_0x55c4ab[_0x9481('0x35')],_0x55c4ab[_0x9481('0x44')])[_0x9481('0x27')](respondWithResult(_0x57928a,null))['catch'](handleError(_0x57928a,null));};exports['runReport']=runReport;exports['query']=function(_0x52b980,_0x5792b1){var _0x3a199b=0xa;var _0x4b779b=[_0x9481('0x59'),_0x9481('0x5a'),_0x9481('0x85'),_0x9481('0xa8')];var _0x55a65f={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':_0x9481('0xa9'),'MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x583490={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x1e40fe=function(_0x26c87b){return!_[_0x9481('0x7c')](['IS\x20NULL',_0x9481('0x67'),_0x9481('0x88'),'IS\x20NOT\x20EMPTY'],_0x26c87b);};var _0x4ea411=function(_0x1cdca0){if(!_0x1cdca0||!_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x15c53f='(',_0x7ee854=0x0;_0x7ee854<_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')];_0x7ee854+=0x1){_0x7ee854>0x0&&(_0x15c53f+='\x20'+_0x1cdca0[_0x9481('0x89')]+'\x20');_0x15c53f+=_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x76')]?_0x4ea411(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x76')]):_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x6a')]+'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x8a')]+(_0x1e40fe(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x8a')])?'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854]['value']:'');}return _0x15c53f+')';};var _0x49a6db={'where':{'id':_0x52b980['params']['id']}},_0x224b16,_0x83543f,_0x58c043,_0x97a67a,_0xe157e4;_0x49a6db=_[_0x9481('0x42')]({},_0x49a6db,_0x52b980[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x49a6db)['then'](function(_0x1a1058){if(_0x1a1058){_0x224b16=_0x1a1058;return _0x1a1058['getFields']();}return null;})[_0x9481('0x27')](function(_0x206661){if(_0x206661){if(!_0x206661[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x83543f=_0x206661;return db['AnalyticMetric'][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x40cdf9){if(_0x40cdf9){_0x58c043=_['keyBy'](_0x40cdf9,'id');var _0x5467fe;var _0x440d88=squel['select']();_0x440d88[_0x9481('0xa3')](_0x224b16['table']);for(var _0x2a0367=0x0;_0x2a0367<_0x83543f[_0x9481('0x3a')];_0x2a0367+=0x1){_0x5467fe=_0x83543f[_0x2a0367]['MetricId']?_0x58c043[_0x83543f[_0x2a0367][_0x9481('0x71')]][_0x9481('0x8d')]:_0x83543f[_0x2a0367][_0x9481('0x6a')];_0x5467fe=_0x83543f[_0x2a0367]['function']?_[_0x9481('0x73')](_0x55a65f[_0x83543f[_0x2a0367][_0x9481('0x72')]],'%s',_0x5467fe):_0x5467fe;_0x5467fe=_0x83543f[_0x2a0367][_0x9481('0x74')]?_[_0x9481('0x73')](_0x583490[_0x83543f[_0x2a0367][_0x9481('0x74')]],'%s',_0x5467fe):_0x5467fe;if(_0x83543f[_0x2a0367][_0x9481('0x75')]){_0x440d88[_0x9481('0x76')](_0x5467fe);}_0x83543f[_0x2a0367]['orderBy']&&_0x440d88[_0x9481('0x3d')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x440d88[_0x9481('0x6a')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x79')]||_0x5467fe);}if(_0x224b16['joins']){_0x224b16[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x7a')]);for(var _0x527ef6=0x0;_0x527ef6<_0x224b16['joins'][_0x9481('0x3a')];_0x527ef6+=0x1){if(_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x4b779b,_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')])&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7d')]&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')]&&_0x224b16['joins'][_0x527ef6][_0x9481('0x7f')]){_0x440d88[_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]](_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x224b16[_0x9481('0x8c')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['parentKey'],_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['foreignKey']));}}}if(_0x224b16[_0x9481('0x80')]){_0x224b16[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x80')]);_0x440d88['where'](_0x4ea411(_0x224b16[_0x9481('0x80')][_0x9481('0x76')]));}_0xe157e4=_0x440d88[_0x9481('0x81')]();_0x440d88[_0x9481('0x20')](_0x3a199b);_0x440d88['offset'](0x0);logger[_0x9481('0xaa')](_0x9481('0xab'),_0x440d88[_0x9481('0x82')]());return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x440d88[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});}})[_0x9481('0x27')](function(){return{'sql':_0xe157e4['toString']()};})[_0x9481('0x27')](respondWithResult(_0x5792b1,null))[_0x9481('0x4e')](handleError(_0x5792b1,null));}; \ No newline at end of file +var _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','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','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x419aa4,_0x5926a7){var _0x557d9b=function(_0x43c9ac){while(--_0x43c9ac){_0x419aa4['push'](_0x419aa4['shift']());}};_0x557d9b(++_0x5926a7);}(_0x7a54,0x106));var _0x47a5=function(_0x1f78c5,_0xd9836a){_0x1f78c5=_0x1f78c5-0x0;var _0x329c2a=_0x7a54[_0x1f78c5];return _0x329c2a;};'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'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 1db5f94..fd73569 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 _0x2605=['rimraf','../../config/environment','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x128188,_0x418a16){var _0x4bc209=function(_0x58c891){while(--_0x58c891){_0x128188['push'](_0x128188['shift']());}};_0x4bc209(++_0x418a16);}(_0x2605,0x95));var _0x5260=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0x2605[_0x415603];return _0x131e72;};'use strict';var _=require(_0x5260('0x0'));var util=require(_0x5260('0x1'));var logger=require('../../config/logger')(_0x5260('0x2'));var moment=require(_0x5260('0x3'));var BPromise=require(_0x5260('0x4'));var rp=require(_0x5260('0x5'));var fs=require('fs');var path=require(_0x5260('0x6'));var rimraf=require(_0x5260('0x7'));var config=require(_0x5260('0x8'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0xcb6479,_0x44da59){return _0xcb6479[_0x5260('0x9')](_0x5260('0xa'),attributes,{'tableName':_0x5260('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd92f=['AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./analyticDefaultReport.attributes','exports','define'];(function(_0x2deac4,_0xc27a2b){var _0x1c0bda=function(_0x1deceb){while(--_0x1deceb){_0x2deac4['push'](_0x2deac4['shift']());}};_0x1c0bda(++_0xc27a2b);}(_0xd92f,0x1be));var _0xfd92=function(_0x3259cb,_0xe76fbe){_0x3259cb=_0x3259cb-0x0;var _0x3538f5=_0xd92f[_0x3259cb];return _0x3538f5;};'use strict';var _=require(_0xfd92('0x0'));var util=require(_0xfd92('0x1'));var logger=require(_0xfd92('0x2'))(_0xfd92('0x3'));var moment=require('moment');var BPromise=require(_0xfd92('0x4'));var rp=require(_0xfd92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd92('0x6'));var config=require('../../config/environment');var attributes=require(_0xfd92('0x7'));module[_0xfd92('0x8')]=function(_0x51e773,_0x1ea32d){return _0x51e773[_0xfd92('0x9')](_0xfd92('0xa'),attributes,{'tableName':_0xfd92('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 79a5e41..54b07b5 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 _0x7eab=['../../config/utils','rpc','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','bluebird','ioredis','../../mysqldb'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x7eab,0x81));var _0xb7ea=function(_0x1090e5,_0x168c9d){_0x1090e5=_0x1090e5-0x0;var _0x487675=_0x7eab[_0x1090e5];return _0x487675;};'use strict';var _=require('lodash');var util=require(_0xb7ea('0x0'));var moment=require('moment');var BPromise=require(_0xb7ea('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7ea('0x2'));var db=require(_0xb7ea('0x3'))['db'];var utils=require(_0xb7ea('0x4'));var logger=require('../../config/logger')(_0xb7ea('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb7ea('0x6')][_0xb7ea('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x24e11f,_0xe1ad28,_0x3b19e0){return new BPromise(function(_0x25437e,_0x3fd4fc){return client[_0xb7ea('0x8')](_0x24e11f,_0x3b19e0)[_0xb7ea('0x9')](function(_0x59051c){logger[_0xb7ea('0xa')](_0xb7ea('0xb'),_0xe1ad28,'request\x20sent');logger[_0xb7ea('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0xe1ad28,_0xb7ea('0xd'),JSON[_0xb7ea('0xe')](_0x59051c));if(_0x59051c['error']){if(_0x59051c['error']['code']===0x1f4){logger[_0xb7ea('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xe1ad28,_0x59051c[_0xb7ea('0xf')][_0xb7ea('0x10')]);return _0x3fd4fc(_0x59051c['error'][_0xb7ea('0x10')]);}logger['error'](_0xb7ea('0xb'),_0xe1ad28,_0x59051c[_0xb7ea('0xf')][_0xb7ea('0x10')]);return _0x25437e(_0x59051c['error'][_0xb7ea('0x10')]);}else{logger['info'](_0xb7ea('0xb'),_0xe1ad28,_0xb7ea('0xd'));_0x25437e(_0x59051c[_0xb7ea('0x11')]['message']);}})[_0xb7ea('0x12')](function(_0x5b7efd){logger[_0xb7ea('0xf')](_0xb7ea('0xb'),_0xe1ad28,_0x5b7efd);_0x3fd4fc(_0x5b7efd);});});} \ No newline at end of file +var _0x87a1=['../../config/environment','jayson/promise','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x354ce7,_0x28272b){var _0x1a680e=function(_0x550b3e){while(--_0x550b3e){_0x354ce7['push'](_0x354ce7['shift']());}};_0x1a680e(++_0x28272b);}(_0x87a1,0x189));var _0x187a=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x87a1[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require(_0x187a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x187a('0x1'));var rs=require(_0x187a('0x2'));var fs=require('fs');var Redis=require(_0x187a('0x3'));var db=require(_0x187a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x187a('0x5'))('rpc');var config=require(_0x187a('0x6'));var jayson=require(_0x187a('0x7'));var client=jayson['client'][_0x187a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x576d38,_0x1646ad,_0x18e27d){return new BPromise(function(_0x36db44,_0x1416d9){return client[_0x187a('0x9')](_0x576d38,_0x18e27d)['then'](function(_0x2d56e9){logger[_0x187a('0xa')](_0x187a('0xb'),_0x1646ad,_0x187a('0xc'));logger[_0x187a('0xd')](_0x187a('0xe'),_0x1646ad,_0x187a('0xc'),JSON[_0x187a('0xf')](_0x2d56e9));if(_0x2d56e9['error']){if(_0x2d56e9[_0x187a('0x10')][_0x187a('0x11')]===0x1f4){logger['error'](_0x187a('0xb'),_0x1646ad,_0x2d56e9[_0x187a('0x10')][_0x187a('0x12')]);return _0x1416d9(_0x2d56e9[_0x187a('0x10')][_0x187a('0x12')]);}logger[_0x187a('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1646ad,_0x2d56e9[_0x187a('0x10')]['message']);return _0x36db44(_0x2d56e9[_0x187a('0x10')][_0x187a('0x12')]);}else{logger[_0x187a('0xa')](_0x187a('0xb'),_0x1646ad,_0x187a('0xc'));_0x36db44(_0x2d56e9[_0x187a('0x13')][_0x187a('0x12')]);}})[_0x187a('0x14')](function(_0x5c0715){logger[_0x187a('0x10')](_0x187a('0xb'),_0x1646ad,_0x5c0715);_0x1416d9(_0x5c0715);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 4a53c95..f089912 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 _0x523d=['create','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','/:id/query','post'];(function(_0x264f1c,_0x4b04de){var _0x4c5f59=function(_0xbfe297){while(--_0xbfe297){_0x264f1c['push'](_0x264f1c['shift']());}};_0x4c5f59(++_0x4b04de);}(_0x523d,0x119));var _0xd523=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x523d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd523('0x0'));var util=require('util');var path=require(_0xd523('0x1'));var timeout=require(_0xd523('0x2'));var express=require(_0xd523('0x3'));var router=express['Router']();var fs_extra=require(_0xd523('0x4'));var auth=require(_0xd523('0x5'));var interaction=require(_0xd523('0x6'));var config=require(_0xd523('0x7'));var controller=require(_0xd523('0x8'));router[_0xd523('0x9')]('/',auth[_0xd523('0xa')](),controller[_0xd523('0xb')]);router['get'](_0xd523('0xc'),auth[_0xd523('0xa')](),controller[_0xd523('0xd')]);router[_0xd523('0x9')](_0xd523('0xe'),auth[_0xd523('0xa')](),controller['preview']);router[_0xd523('0x9')](_0xd523('0xf'),auth[_0xd523('0xa')](),controller['run']);router['get'](_0xd523('0x10'),auth[_0xd523('0xa')](),controller['query']);router[_0xd523('0x11')]('/',auth['isAuthenticated'](),controller[_0xd523('0x12')]);router[_0xd523('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xd523('0x14')]);router[_0xd523('0x15')](_0xd523('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xd523('0x16')]=router; \ No newline at end of file +var _0x9da6=['../../config/environment','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','create','update','delete','destroy','util','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9da6,0xa6));var _0x69da=function(_0x10e5ca,_0x3040b4){_0x10e5ca=_0x10e5ca-0x0;var _0x38d756=_0x9da6[_0x10e5ca];return _0x38d756;};'use strict';var multer=require('multer');var util=require(_0x69da('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x69da('0x1'));var auth=require(_0x69da('0x2'));var interaction=require(_0x69da('0x3'));var config=require(_0x69da('0x4'));var controller=require('./analyticDefaultReport.controller');router[_0x69da('0x5')]('/',auth[_0x69da('0x6')](),controller[_0x69da('0x7')]);router[_0x69da('0x5')](_0x69da('0x8'),auth['isAuthenticated'](),controller[_0x69da('0x9')]);router[_0x69da('0x5')]('/:id/preview',auth[_0x69da('0x6')](),controller[_0x69da('0xa')]);router[_0x69da('0x5')](_0x69da('0xb'),auth[_0x69da('0x6')](),controller[_0x69da('0xc')]);router[_0x69da('0x5')]('/:id/query',auth[_0x69da('0x6')](),controller['query']);router['post']('/',auth['isAuthenticated'](),controller[_0x69da('0xd')]);router['put'](_0x69da('0x8'),auth[_0x69da('0x6')](),controller[_0x69da('0xe')]);router[_0x69da('0xf')](_0x69da('0x8'),auth['isAuthenticated'](),controller[_0x69da('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 89acb4a..a407dcb 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 _0x5bde=['csv','pdf','xlsx','DATE','ENUM','manual','scheduled','sequelize','moment','exports','STRING'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x5bde,0x10f));var _0xe5bd=function(_0xa9782,_0x2aeb09){_0xa9782=_0xa9782-0x0;var _0x57d9d9=_0x5bde[_0xa9782];return _0x57d9d9;};'use strict';var Sequelize=require(_0xe5bd('0x0'));var moment=require(_0xe5bd('0x1'));module[_0xe5bd('0x2')]={'name':{'type':Sequelize[_0xe5bd('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xe5bd('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xe5bd('0x4'),_0xe5bd('0x5'),_0xe5bd('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xe5bd('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xe5bd('0x7')]},'status':{'type':Sequelize[_0xe5bd('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xe5bd('0x8')](_0xe5bd('0x9'),_0xe5bd('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x44ee=['moment','STRING','ENUM','csv','xlsx','DATE','Loading','manual'];(function(_0x3bd0d3,_0x5276dc){var _0x5c029c=function(_0x4948e3){while(--_0x4948e3){_0x3bd0d3['push'](_0x3bd0d3['shift']());}};_0x5c029c(++_0x5276dc);}(_0x44ee,0x108));var _0xe44e=function(_0x264b14,_0x2594ff){_0x264b14=_0x264b14-0x0;var _0x17cd75=_0x44ee[_0x264b14];return _0x17cd75;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe44e('0x0'));module['exports']={'name':{'type':Sequelize[_0xe44e('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xe44e('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xe44e('0x2')](_0xe44e('0x3'),'pdf',_0xe44e('0x4')),'allowNull':![],'defaultValue':_0xe44e('0x3')},'savename':{'type':Sequelize[_0xe44e('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xe44e('0x5')]},'endDate':{'type':Sequelize[_0xe44e('0x5')]},'status':{'type':Sequelize[_0xe44e('0x1')],'defaultValue':_0xe44e('0x6')},'type':{'type':Sequelize[_0xe44e('0x2')](_0xe44e('0x7'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 6d899a7..0471bfe 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 _0xa6da=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','ExtractedReports','error','name','send','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','output','existsSync','root','server/files/reports','savename','ValidationError','join','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6da,0x1c4));var _0xaa6d=function(_0x214996,_0x14ae1d){_0x214996=_0x214996-0x0;var _0x231a2c=_0xa6da[_0x214996];return _0x231a2c;};'use strict';var emlformat=require(_0xaa6d('0x0'));var rimraf=require(_0xaa6d('0x1'));var zipdir=require(_0xaa6d('0x2'));var jsonpatch=require(_0xaa6d('0x3'));var rp=require(_0xaa6d('0x4'));var moment=require(_0xaa6d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaa6d('0x6'));var util=require(_0xaa6d('0x7'));var path=require(_0xaa6d('0x8'));var sox=require(_0xaa6d('0x9'));var csv=require(_0xaa6d('0xa'));var ejs=require(_0xaa6d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa6d('0xc'));var squel=require(_0xaa6d('0xd'));var crypto=require(_0xaa6d('0xe'));var jsforce=require(_0xaa6d('0xf'));var deskjs=require(_0xaa6d('0x10'));var toCsv=require(_0xaa6d('0xa'));var querystring=require(_0xaa6d('0x11'));var Papa=require('papaparse');var Redis=require(_0xaa6d('0x12'));var authService=require(_0xaa6d('0x13'));var qs=require(_0xaa6d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa6d('0x15'))(_0xaa6d('0x16'));var utils=require(_0xaa6d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xaa6d('0x18'));var db=require(_0xaa6d('0x19'))['db'];function respondWithStatusCode(_0x8c40e1,_0x3a5cee){_0x3a5cee=_0x3a5cee||0xcc;return function(_0x2991e7){if(_0x2991e7){return _0x8c40e1[_0xaa6d('0x1a')](_0x3a5cee);}return _0x8c40e1[_0xaa6d('0x1b')](_0x3a5cee)[_0xaa6d('0x1c')]();};}function respondWithResult(_0x5b4a5e,_0x2cdd78){_0x2cdd78=_0x2cdd78||0xc8;return function(_0x3d0252){if(_0x3d0252){return _0x5b4a5e[_0xaa6d('0x1b')](_0x2cdd78)[_0xaa6d('0x1d')](_0x3d0252);}};}function respondWithFilteredResult(_0x397475,_0x536dd5){return function(_0x412002){if(_0x412002){var _0x832eec=typeof _0x536dd5[_0xaa6d('0x1e')]===_0xaa6d('0x1f')&&typeof _0x536dd5[_0xaa6d('0x20')]==='undefined';var _0x167fd8=_0x412002[_0xaa6d('0x21')];var _0x17449a=_0x832eec?0x0:_0x536dd5[_0xaa6d('0x1e')];var _0x1821bb=_0x832eec?_0x412002[_0xaa6d('0x21')]:_0x536dd5[_0xaa6d('0x1e')]+_0x536dd5[_0xaa6d('0x20')];var _0xd7acbb;if(_0x1821bb>=_0x167fd8){_0x1821bb=_0x167fd8;_0xd7acbb=0xc8;}else{_0xd7acbb=0xce;}_0x397475[_0xaa6d('0x1b')](_0xd7acbb);return _0x397475[_0xaa6d('0x22')](_0xaa6d('0x23'),_0x17449a+'-'+_0x1821bb+'/'+_0x167fd8)[_0xaa6d('0x1d')](_0x412002);}return null;};}function patchUpdates(_0xb2e37a){return function(_0x4dd1a6){try{jsonpatch[_0xaa6d('0x24')](_0x4dd1a6,_0xb2e37a,!![]);}catch(_0x13e8c8){return BPromise[_0xaa6d('0x25')](_0x13e8c8);}return _0x4dd1a6[_0xaa6d('0x26')]();};}function saveUpdates(_0x113b7f,_0x38de51){return function(_0xcf01eb){if(_0xcf01eb){return _0xcf01eb[_0xaa6d('0x27')](_0x113b7f)[_0xaa6d('0x28')](function(_0x500f8e){return _0x500f8e;});}return null;};}function removeEntity(_0x3cb121,_0x5ea134){return function(_0x5483b4){if(_0x5483b4){return _0x5483b4['destroy']()['then'](function(){var _0x3a93fe=_0x5483b4[_0xaa6d('0x29')]({'plain':!![]});var _0x35d7ad=_0xaa6d('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x35d7ad,'resourceId':_0x3a93fe['id']}})[_0xaa6d('0x28')](function(){return _0x5483b4;});})[_0xaa6d('0x28')](function(){_0x3cb121[_0xaa6d('0x1b')](0xcc)[_0xaa6d('0x1c')]();});}};}function handleEntityNotFound(_0x23c4f3,_0x18e895){return function(_0x3c2c1c){if(!_0x3c2c1c){_0x23c4f3[_0xaa6d('0x1a')](0x194);}return _0x3c2c1c;};}function handleError(_0x25999e,_0x5e7ac0){_0x5e7ac0=_0x5e7ac0||0x1f4;return function(_0x171474){logger[_0xaa6d('0x2b')](_0x171474['stack']);if(_0x171474[_0xaa6d('0x2c')]){delete _0x171474[_0xaa6d('0x2c')];}_0x25999e[_0xaa6d('0x1b')](_0x5e7ac0)[_0xaa6d('0x2d')](_0x171474);};}exports['index']=function(_0x58d182,_0x5a59da){var _0x1dc38e={},_0x396a87={},_0xf0a877={'count':0x0,'rows':[]};var _0x587349=_['map'](db[_0xaa6d('0x2e')][_0xaa6d('0x2f')],function(_0x48d815){return{'name':_0x48d815[_0xaa6d('0x30')],'type':_0x48d815['type'][_0xaa6d('0x31')]};});_0x396a87[_0xaa6d('0x32')]=_['map'](_0x587349,_0xaa6d('0x2c'));_0x396a87[_0xaa6d('0x33')]=_[_0xaa6d('0x34')](_0x58d182['query']);_0x396a87['filters']=_['intersection'](_0x396a87['model'],_0x396a87['query']);_0x1dc38e[_0xaa6d('0x35')]=_[_0xaa6d('0x36')](_0x396a87['model'],qs['fields'](_0x58d182[_0xaa6d('0x33')][_0xaa6d('0x37')]));_0x1dc38e[_0xaa6d('0x35')]=_0x1dc38e[_0xaa6d('0x35')][_0xaa6d('0x38')]?_0x1dc38e[_0xaa6d('0x35')]:_0x396a87['model'];if(!_0x58d182['query'][_0xaa6d('0x39')]('nolimit')){_0x1dc38e[_0xaa6d('0x20')]=qs[_0xaa6d('0x20')](_0x58d182[_0xaa6d('0x33')][_0xaa6d('0x20')]);_0x1dc38e[_0xaa6d('0x1e')]=qs[_0xaa6d('0x1e')](_0x58d182[_0xaa6d('0x33')][_0xaa6d('0x1e')]);}_0x1dc38e[_0xaa6d('0x3a')]=qs[_0xaa6d('0x3b')](_0x58d182[_0xaa6d('0x33')][_0xaa6d('0x3b')]);_0x1dc38e['where']=qs[_0xaa6d('0x3c')](_['pick'](_0x58d182[_0xaa6d('0x33')],_0x396a87[_0xaa6d('0x3c')]),_0x587349);if(_0x58d182[_0xaa6d('0x33')][_0xaa6d('0x3d')]){_0x1dc38e[_0xaa6d('0x3e')]=_[_0xaa6d('0x3f')](_0x1dc38e[_0xaa6d('0x3e')],{'$or':_[_0xaa6d('0x40')](_0x587349,function(_0x2d847f){if(_0x2d847f[_0xaa6d('0x41')]!==_0xaa6d('0x42')){var _0x5b1e00={};_0x5b1e00[_0x2d847f[_0xaa6d('0x2c')]]={'$like':'%'+_0x58d182[_0xaa6d('0x33')][_0xaa6d('0x3d')]+'%'};return _0x5b1e00;}})});}_0x1dc38e=_[_0xaa6d('0x3f')]({},_0x1dc38e,_0x58d182[_0xaa6d('0x43')]);var _0x1d4940={'where':_0x1dc38e[_0xaa6d('0x3e')]};return db['AnalyticExtractedReport'][_0xaa6d('0x21')](_0x1d4940)[_0xaa6d('0x28')](function(_0x4eb416){_0xf0a877['count']=_0x4eb416;if(_0x58d182['query'][_0xaa6d('0x44')]){_0x1dc38e['include']=[{'all':!![]}];}return db[_0xaa6d('0x2e')][_0xaa6d('0x45')](_0x1dc38e);})[_0xaa6d('0x28')](function(_0xd6325e){_0xf0a877[_0xaa6d('0x46')]=_0xd6325e;return _0xf0a877;})[_0xaa6d('0x28')](respondWithFilteredResult(_0x5a59da,_0x1dc38e))[_0xaa6d('0x47')](handleError(_0x5a59da,null));};exports['show']=function(_0x442770,_0x3c2468){var _0x5c50cb={'raw':!![],'where':{'id':_0x442770['params']['id']}},_0x1cb05e={};_0x1cb05e[_0xaa6d('0x32')]=_['keys'](db['AnalyticExtractedReport'][_0xaa6d('0x2f')]);_0x1cb05e[_0xaa6d('0x33')]=_[_0xaa6d('0x34')](_0x442770['query']);_0x1cb05e[_0xaa6d('0x3c')]=_[_0xaa6d('0x36')](_0x1cb05e[_0xaa6d('0x32')],_0x1cb05e[_0xaa6d('0x33')]);_0x5c50cb['attributes']=_[_0xaa6d('0x36')](_0x1cb05e[_0xaa6d('0x32')],qs[_0xaa6d('0x37')](_0x442770[_0xaa6d('0x33')][_0xaa6d('0x37')]));_0x5c50cb['attributes']=_0x5c50cb[_0xaa6d('0x35')][_0xaa6d('0x38')]?_0x5c50cb[_0xaa6d('0x35')]:_0x1cb05e[_0xaa6d('0x32')];if(_0x442770[_0xaa6d('0x33')][_0xaa6d('0x44')]){_0x5c50cb[_0xaa6d('0x48')]=[{'all':!![]}];}_0x5c50cb=_[_0xaa6d('0x3f')]({},_0x5c50cb,_0x442770[_0xaa6d('0x43')]);return db[_0xaa6d('0x2e')][_0xaa6d('0x49')](_0x5c50cb)[_0xaa6d('0x28')](handleEntityNotFound(_0x3c2468,null))[_0xaa6d('0x28')](respondWithResult(_0x3c2468,null))[_0xaa6d('0x47')](handleError(_0x3c2468,null));};exports[_0xaa6d('0x4a')]=function(_0x1e99b5,_0x2f5de9){return db[_0xaa6d('0x2e')][_0xaa6d('0x4a')](_0x1e99b5[_0xaa6d('0x4b')],{})['then'](function(_0x14dbd1){var _0x3fe7cc=_0x1e99b5[_0xaa6d('0x4c')][_0xaa6d('0x29')]({'plain':!![]});if(!_0x3fe7cc)throw new Error(_0xaa6d('0x4d'));if(_0x3fe7cc[_0xaa6d('0x4e')]===_0xaa6d('0x4c')){var _0x2d26b7=_0x14dbd1[_0xaa6d('0x29')]({'plain':!![]});var _0x1cbf70=_0xaa6d('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x1cbf70,'userProfileId':_0x3fe7cc[_0xaa6d('0x4f')]},'raw':!![]})[_0xaa6d('0x28')](function(_0x1de6b7){if(_0x1de6b7&&_0x1de6b7[_0xaa6d('0x50')]===0x0){return db[_0xaa6d('0x51')][_0xaa6d('0x4a')]({'name':_0x2d26b7[_0xaa6d('0x2c')],'resourceId':_0x2d26b7['id'],'type':_0x1de6b7['name'],'sectionId':_0x1de6b7['id']},{})[_0xaa6d('0x28')](function(){return _0x14dbd1;});}else{return _0x14dbd1;}})['catch'](function(_0xd88e76){logger[_0xaa6d('0x2b')](_0xaa6d('0x52'),_0xd88e76);throw _0xd88e76;});}return _0x14dbd1;})[_0xaa6d('0x28')](respondWithResult(_0x2f5de9,0xc9))['catch'](handleError(_0x2f5de9,null));};exports[_0xaa6d('0x27')]=function(_0x4587f9,_0x52b9cc){if(_0x4587f9['body']['id']){delete _0x4587f9['body']['id'];}return db[_0xaa6d('0x2e')][_0xaa6d('0x49')]({'where':{'id':_0x4587f9[_0xaa6d('0x53')]['id']}})[_0xaa6d('0x28')](handleEntityNotFound(_0x52b9cc,null))[_0xaa6d('0x28')](saveUpdates(_0x4587f9[_0xaa6d('0x4b')],null))['then'](respondWithResult(_0x52b9cc,null))[_0xaa6d('0x47')](handleError(_0x52b9cc,null));};exports['destroy']=function(_0x40e861,_0x3f33ff){return db[_0xaa6d('0x2e')][_0xaa6d('0x49')]({'where':{'id':_0x40e861[_0xaa6d('0x53')]['id']}})['then'](handleEntityNotFound(_0x3f33ff,null))['then'](removeEntity(_0x3f33ff,null))[_0xaa6d('0x47')](handleError(_0x3f33ff,null));};exports[_0xaa6d('0x54')]=function(_0x560c84,_0x45c7a6,_0x26d94b){return db[_0xaa6d('0x2e')][_0xaa6d('0x49')]({'where':{'id':_0x560c84['params']['id']},'attributes':['name',_0xaa6d('0x55'),'savename',_0xaa6d('0x56')],'raw':!![]})[_0xaa6d('0x28')](handleEntityNotFound(_0x45c7a6,null))[_0xaa6d('0x28')](function(_0x4f2848){if(_0x4f2848){if(!fs[_0xaa6d('0x57')](path['join'](config[_0xaa6d('0x58')],_0xaa6d('0x59'),_0x4f2848[_0xaa6d('0x5a')]))){throw new db['Sequelize'][(_0xaa6d('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x560c84[_0xaa6d('0x33')]['exists']){return _0x45c7a6[_0xaa6d('0x1a')](0xc8);}return _0x45c7a6[_0xaa6d('0x54')](path[_0xaa6d('0x5c')](config[_0xaa6d('0x58')],_0xaa6d('0x59'),_0x4f2848[_0xaa6d('0x5a')]),util[_0xaa6d('0x5d')](_0xaa6d('0x5e'),_0x4f2848[_0xaa6d('0x55')]||_0x4f2848['name'],_0x4f2848['output'][_0xaa6d('0x5f')]()));}})['catch'](handleError(_0x45c7a6,null));}; \ No newline at end of file +var _0x30a1=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','ExtractedReports','error','stack','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','join','format','rimraf'];(function(_0x285fa9,_0x2580ac){var _0x59a827=function(_0x316f6c){while(--_0x316f6c){_0x285fa9['push'](_0x285fa9['shift']());}};_0x59a827(++_0x2580ac);}(_0x30a1,0x10d));var _0x130a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x30a1[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x130a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x130a('0x1'));var rp=require(_0x130a('0x2'));var moment=require('moment');var BPromise=require(_0x130a('0x3'));var Mustache=require(_0x130a('0x4'));var util=require(_0x130a('0x5'));var path=require(_0x130a('0x6'));var sox=require(_0x130a('0x7'));var csv=require(_0x130a('0x8'));var ejs=require(_0x130a('0x9'));var fs=require('fs');var fs_extra=require(_0x130a('0xa'));var _=require('lodash');var squel=require(_0x130a('0xb'));var crypto=require(_0x130a('0xc'));var jsforce=require(_0x130a('0xd'));var deskjs=require(_0x130a('0xe'));var toCsv=require(_0x130a('0x8'));var querystring=require(_0x130a('0xf'));var Papa=require(_0x130a('0x10'));var Redis=require(_0x130a('0x11'));var authService=require(_0x130a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x130a('0x13'));var logger=require(_0x130a('0x14'))(_0x130a('0x15'));var utils=require(_0x130a('0x16'));var config=require(_0x130a('0x17'));var licenseUtil=require(_0x130a('0x18'));var db=require(_0x130a('0x19'))['db'];function respondWithStatusCode(_0x2b82b2,_0x182f56){_0x182f56=_0x182f56||0xcc;return function(_0x3cadc6){if(_0x3cadc6){return _0x2b82b2[_0x130a('0x1a')](_0x182f56);}return _0x2b82b2[_0x130a('0x1b')](_0x182f56)[_0x130a('0x1c')]();};}function respondWithResult(_0x50e7c2,_0x41a431){_0x41a431=_0x41a431||0xc8;return function(_0x28be3c){if(_0x28be3c){return _0x50e7c2[_0x130a('0x1b')](_0x41a431)[_0x130a('0x1d')](_0x28be3c);}};}function respondWithFilteredResult(_0x64af5,_0x98d7eb){return function(_0x450264){if(_0x450264){var _0x2f3812=typeof _0x98d7eb[_0x130a('0x1e')]===_0x130a('0x1f')&&typeof _0x98d7eb[_0x130a('0x20')]===_0x130a('0x1f');var _0x178436=_0x450264['count'];var _0x1e189d=_0x2f3812?0x0:_0x98d7eb[_0x130a('0x1e')];var _0x3e0843=_0x2f3812?_0x450264[_0x130a('0x21')]:_0x98d7eb[_0x130a('0x1e')]+_0x98d7eb[_0x130a('0x20')];var _0x53e05c;if(_0x3e0843>=_0x178436){_0x3e0843=_0x178436;_0x53e05c=0xc8;}else{_0x53e05c=0xce;}_0x64af5['status'](_0x53e05c);return _0x64af5[_0x130a('0x22')]('Content-Range',_0x1e189d+'-'+_0x3e0843+'/'+_0x178436)[_0x130a('0x1d')](_0x450264);}return null;};}function patchUpdates(_0x4b1088){return function(_0x21d125){try{jsonpatch[_0x130a('0x23')](_0x21d125,_0x4b1088,!![]);}catch(_0x20baa6){return BPromise['reject'](_0x20baa6);}return _0x21d125[_0x130a('0x24')]();};}function saveUpdates(_0x25b51f,_0xdb760d){return function(_0xd8e70e){if(_0xd8e70e){return _0xd8e70e[_0x130a('0x25')](_0x25b51f)[_0x130a('0x26')](function(_0x581f68){return _0x581f68;});}return null;};}function removeEntity(_0x3163f8,_0x5e087c){return function(_0x13d3f1){if(_0x13d3f1){return _0x13d3f1[_0x130a('0x27')]()[_0x130a('0x26')](function(){var _0xb1db2a=_0x13d3f1[_0x130a('0x28')]({'plain':!![]});var _0x1787b4=_0x130a('0x29');return db['UserProfileResource'][_0x130a('0x27')]({'where':{'type':_0x1787b4,'resourceId':_0xb1db2a['id']}})[_0x130a('0x26')](function(){return _0x13d3f1;});})['then'](function(){_0x3163f8[_0x130a('0x1b')](0xcc)[_0x130a('0x1c')]();});}};}function handleEntityNotFound(_0x2add35,_0x40f480){return function(_0x156cfc){if(!_0x156cfc){_0x2add35[_0x130a('0x1a')](0x194);}return _0x156cfc;};}function handleError(_0x1282b5,_0x400696){_0x400696=_0x400696||0x1f4;return function(_0x4c1e5d){logger[_0x130a('0x2a')](_0x4c1e5d[_0x130a('0x2b')]);if(_0x4c1e5d['name']){delete _0x4c1e5d['name'];}_0x1282b5[_0x130a('0x1b')](_0x400696)['send'](_0x4c1e5d);};}exports['index']=function(_0x592a0f,_0xad9965){var _0x3b8538={},_0x45f0d4={},_0x3e51f5={'count':0x0,'rows':[]};var _0x4cf838=_[_0x130a('0x2c')](db[_0x130a('0x2d')][_0x130a('0x2e')],function(_0x4ee1fe){return{'name':_0x4ee1fe[_0x130a('0x2f')],'type':_0x4ee1fe[_0x130a('0x30')][_0x130a('0x31')]};});_0x45f0d4[_0x130a('0x32')]=_[_0x130a('0x2c')](_0x4cf838,_0x130a('0x33'));_0x45f0d4[_0x130a('0x34')]=_['keys'](_0x592a0f['query']);_0x45f0d4[_0x130a('0x35')]=_['intersection'](_0x45f0d4[_0x130a('0x32')],_0x45f0d4['query']);_0x3b8538[_0x130a('0x36')]=_[_0x130a('0x37')](_0x45f0d4[_0x130a('0x32')],qs[_0x130a('0x38')](_0x592a0f[_0x130a('0x34')]['fields']));_0x3b8538[_0x130a('0x36')]=_0x3b8538[_0x130a('0x36')][_0x130a('0x39')]?_0x3b8538['attributes']:_0x45f0d4[_0x130a('0x32')];if(!_0x592a0f[_0x130a('0x34')]['hasOwnProperty'](_0x130a('0x3a'))){_0x3b8538[_0x130a('0x20')]=qs[_0x130a('0x20')](_0x592a0f[_0x130a('0x34')][_0x130a('0x20')]);_0x3b8538[_0x130a('0x1e')]=qs['offset'](_0x592a0f['query'][_0x130a('0x1e')]);}_0x3b8538['order']=qs[_0x130a('0x3b')](_0x592a0f['query']['sort']);_0x3b8538[_0x130a('0x3c')]=qs['filters'](_[_0x130a('0x3d')](_0x592a0f[_0x130a('0x34')],_0x45f0d4['filters']),_0x4cf838);if(_0x592a0f[_0x130a('0x34')][_0x130a('0x3e')]){_0x3b8538[_0x130a('0x3c')]=_[_0x130a('0x3f')](_0x3b8538[_0x130a('0x3c')],{'$or':_[_0x130a('0x2c')](_0x4cf838,function(_0x5d7eeb){if(_0x5d7eeb[_0x130a('0x30')]!==_0x130a('0x40')){var _0x3e14b1={};_0x3e14b1[_0x5d7eeb[_0x130a('0x33')]]={'$like':'%'+_0x592a0f[_0x130a('0x34')][_0x130a('0x3e')]+'%'};return _0x3e14b1;}})});}_0x3b8538=_[_0x130a('0x3f')]({},_0x3b8538,_0x592a0f[_0x130a('0x41')]);var _0x141fd1={'where':_0x3b8538[_0x130a('0x3c')]};return db[_0x130a('0x2d')]['count'](_0x141fd1)[_0x130a('0x26')](function(_0x12cc06){_0x3e51f5['count']=_0x12cc06;if(_0x592a0f['query'][_0x130a('0x42')]){_0x3b8538['include']=[{'all':!![]}];}return db[_0x130a('0x2d')][_0x130a('0x43')](_0x3b8538);})[_0x130a('0x26')](function(_0x3aeaae){_0x3e51f5['rows']=_0x3aeaae;return _0x3e51f5;})[_0x130a('0x26')](respondWithFilteredResult(_0xad9965,_0x3b8538))[_0x130a('0x44')](handleError(_0xad9965,null));};exports[_0x130a('0x45')]=function(_0x234db3,_0x487aad){var _0x3954ac={'raw':!![],'where':{'id':_0x234db3['params']['id']}},_0x5739f1={};_0x5739f1[_0x130a('0x32')]=_['keys'](db[_0x130a('0x2d')]['rawAttributes']);_0x5739f1[_0x130a('0x34')]=_['keys'](_0x234db3[_0x130a('0x34')]);_0x5739f1[_0x130a('0x35')]=_[_0x130a('0x37')](_0x5739f1[_0x130a('0x32')],_0x5739f1['query']);_0x3954ac[_0x130a('0x36')]=_[_0x130a('0x37')](_0x5739f1[_0x130a('0x32')],qs['fields'](_0x234db3[_0x130a('0x34')][_0x130a('0x38')]));_0x3954ac[_0x130a('0x36')]=_0x3954ac[_0x130a('0x36')][_0x130a('0x39')]?_0x3954ac[_0x130a('0x36')]:_0x5739f1['model'];if(_0x234db3[_0x130a('0x34')]['includeAll']){_0x3954ac[_0x130a('0x46')]=[{'all':!![]}];}_0x3954ac=_['merge']({},_0x3954ac,_0x234db3['options']);return db[_0x130a('0x2d')]['find'](_0x3954ac)[_0x130a('0x26')](handleEntityNotFound(_0x487aad,null))['then'](respondWithResult(_0x487aad,null))[_0x130a('0x44')](handleError(_0x487aad,null));};exports[_0x130a('0x47')]=function(_0x380a2d,_0x1eed79){return db['AnalyticExtractedReport'][_0x130a('0x47')](_0x380a2d[_0x130a('0x48')],{})[_0x130a('0x26')](function(_0x329396){var _0xa50cce=_0x380a2d[_0x130a('0x49')][_0x130a('0x28')]({'plain':!![]});if(!_0xa50cce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa50cce['role']===_0x130a('0x49')){var _0x170871=_0x329396['get']({'plain':!![]});var _0x32ecaf=_0x130a('0x29');return db[_0x130a('0x4a')][_0x130a('0x4b')]({'where':{'name':_0x32ecaf,'userProfileId':_0xa50cce[_0x130a('0x4c')]},'raw':!![]})['then'](function(_0x7ef415){if(_0x7ef415&&_0x7ef415[_0x130a('0x4d')]===0x0){return db[_0x130a('0x4e')]['create']({'name':_0x170871[_0x130a('0x33')],'resourceId':_0x170871['id'],'type':_0x7ef415['name'],'sectionId':_0x7ef415['id']},{})[_0x130a('0x26')](function(){return _0x329396;});}else{return _0x329396;}})[_0x130a('0x44')](function(_0x561a22){logger[_0x130a('0x2a')](_0x130a('0x4f'),_0x561a22);throw _0x561a22;});}return _0x329396;})[_0x130a('0x26')](respondWithResult(_0x1eed79,0xc9))['catch'](handleError(_0x1eed79,null));};exports[_0x130a('0x25')]=function(_0x3d6cf5,_0x5e2e28){if(_0x3d6cf5[_0x130a('0x48')]['id']){delete _0x3d6cf5[_0x130a('0x48')]['id'];}return db[_0x130a('0x2d')][_0x130a('0x4b')]({'where':{'id':_0x3d6cf5['params']['id']}})[_0x130a('0x26')](handleEntityNotFound(_0x5e2e28,null))['then'](saveUpdates(_0x3d6cf5[_0x130a('0x48')],null))['then'](respondWithResult(_0x5e2e28,null))[_0x130a('0x44')](handleError(_0x5e2e28,null));};exports[_0x130a('0x27')]=function(_0x540188,_0x2a88b4){return db[_0x130a('0x2d')][_0x130a('0x4b')]({'where':{'id':_0x540188['params']['id']}})[_0x130a('0x26')](handleEntityNotFound(_0x2a88b4,null))[_0x130a('0x26')](removeEntity(_0x2a88b4,null))[_0x130a('0x44')](handleError(_0x2a88b4,null));};exports[_0x130a('0x50')]=function(_0x4d7d28,_0x5a666c,_0x2d8b16){return db[_0x130a('0x2d')]['find']({'where':{'id':_0x4d7d28['params']['id']},'attributes':[_0x130a('0x33'),_0x130a('0x51'),'savename',_0x130a('0x52')],'raw':!![]})[_0x130a('0x26')](handleEntityNotFound(_0x5a666c,null))[_0x130a('0x26')](function(_0x29c7b7){if(_0x29c7b7){if(!fs['existsSync'](path['join'](config['root'],_0x130a('0x53'),_0x29c7b7[_0x130a('0x54')]))){throw new db[(_0x130a('0x55'))]['ValidationError'](_0x130a('0x56'));}if(_0x4d7d28[_0x130a('0x34')][_0x130a('0x57')]){return _0x5a666c[_0x130a('0x1a')](0xc8);}return _0x5a666c[_0x130a('0x50')](path[_0x130a('0x58')](config['root'],_0x130a('0x53'),_0x29c7b7[_0x130a('0x54')]),util[_0x130a('0x59')]('%s.%s',_0x29c7b7[_0x130a('0x51')]||_0x29c7b7[_0x130a('0x33')],_0x29c7b7[_0x130a('0x52')]['toLowerCase']()));}})[_0x130a('0x44')](handleError(_0x5a666c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 9e17b0b..3f417f8 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 _0x77a1=['moment','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api'];(function(_0x3d4170,_0x5b822c){var _0x35e13d=function(_0x3edf1c){while(--_0x3edf1c){_0x3d4170['push'](_0x3d4170['shift']());}};_0x35e13d(++_0x5b822c);}(_0x77a1,0x128));var _0x177a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x77a1[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x177a('0x0'));var util=require(_0x177a('0x1'));var logger=require(_0x177a('0x2'))(_0x177a('0x3'));var moment=require(_0x177a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x177a('0x5'));var rimraf=require(_0x177a('0x6'));var config=require(_0x177a('0x7'));var attributes=require(_0x177a('0x8'));module['exports']=function(_0x323085,_0x1f3997){return _0x323085[_0x177a('0x9')](_0x177a('0xa'),attributes,{'tableName':_0x177a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb60=['bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment'];(function(_0x5159f5,_0x456131){var _0x36a93d=function(_0x59cb25){while(--_0x59cb25){_0x5159f5['push'](_0x5159f5['shift']());}};_0x36a93d(++_0x456131);}(_0xeb60,0x133));var _0x0eb6=function(_0x1ba0f0,_0x42a0d1){_0x1ba0f0=_0x1ba0f0-0x0;var _0x88f93=_0xeb60[_0x1ba0f0];return _0x88f93;};'use strict';var _=require(_0x0eb6('0x0'));var util=require(_0x0eb6('0x1'));var logger=require(_0x0eb6('0x2'))(_0x0eb6('0x3'));var moment=require(_0x0eb6('0x4'));var BPromise=require(_0x0eb6('0x5'));var rp=require(_0x0eb6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0eb6('0x7'));var config=require(_0x0eb6('0x8'));var attributes=require(_0x0eb6('0x9'));module[_0x0eb6('0xa')]=function(_0x2f0ac2,_0x15609a){return _0x2f0ac2['define'](_0x0eb6('0xb'),attributes,{'tableName':_0x0eb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 8329915..6d20098 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 _0x4b6f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b6f,0xea));var _0xf4b6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x4b6f[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xf4b6('0x0'));var util=require('util');var moment=require(_0xf4b6('0x1'));var BPromise=require(_0xf4b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4b6('0x3'));var db=require(_0xf4b6('0x4'))['db'];var utils=require(_0xf4b6('0x5'));var logger=require(_0xf4b6('0x6'))(_0xf4b6('0x7'));var config=require(_0xf4b6('0x8'));var jayson=require(_0xf4b6('0x9'));var client=jayson[_0xf4b6('0xa')][_0xf4b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5af3fd,_0x576812,_0x339db3){return new BPromise(function(_0x2fe65d,_0x62cb52){return client[_0xf4b6('0xc')](_0x5af3fd,_0x339db3)['then'](function(_0x518cdb){logger[_0xf4b6('0xd')](_0xf4b6('0xe'),_0x576812,'request\x20sent');logger[_0xf4b6('0xf')](_0xf4b6('0x10'),_0x576812,_0xf4b6('0x11'),JSON[_0xf4b6('0x12')](_0x518cdb));if(_0x518cdb['error']){if(_0x518cdb['error'][_0xf4b6('0x13')]===0x1f4){logger[_0xf4b6('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x576812,_0x518cdb['error'][_0xf4b6('0x15')]);return _0x62cb52(_0x518cdb[_0xf4b6('0x14')][_0xf4b6('0x15')]);}logger[_0xf4b6('0x14')](_0xf4b6('0xe'),_0x576812,_0x518cdb[_0xf4b6('0x14')][_0xf4b6('0x15')]);return _0x2fe65d(_0x518cdb[_0xf4b6('0x14')][_0xf4b6('0x15')]);}else{logger[_0xf4b6('0xd')](_0xf4b6('0xe'),_0x576812,_0xf4b6('0x11'));_0x2fe65d(_0x518cdb[_0xf4b6('0x16')]['message']);}})[_0xf4b6('0x17')](function(_0x2c21d1){logger[_0xf4b6('0x14')](_0xf4b6('0xe'),_0x576812,_0x2c21d1);_0x62cb52(_0x2c21d1);});});} \ No newline at end of file +var _0xb4d8=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4a425c,_0x4d5d28){var _0x1319cb=function(_0x5ec873){while(--_0x5ec873){_0x4a425c['push'](_0x4a425c['shift']());}};_0x1319cb(++_0x4d5d28);}(_0xb4d8,0xe8));var _0x8b4d=function(_0x256da0,_0x2d1a68){_0x256da0=_0x256da0-0x0;var _0x34d171=_0xb4d8[_0x256da0];return _0x34d171;};'use strict';var _=require(_0x8b4d('0x0'));var util=require(_0x8b4d('0x1'));var moment=require(_0x8b4d('0x2'));var BPromise=require(_0x8b4d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b4d('0x4'))['db'];var utils=require(_0x8b4d('0x5'));var logger=require(_0x8b4d('0x6'))(_0x8b4d('0x7'));var config=require(_0x8b4d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b4d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cd8b4,_0x55e6cf,_0x2053c8){return new BPromise(function(_0x3825e4,_0x7b0ae9){return client['request'](_0x4cd8b4,_0x2053c8)[_0x8b4d('0xa')](function(_0x35d06e){logger['info'](_0x8b4d('0xb'),_0x55e6cf,_0x8b4d('0xc'));logger[_0x8b4d('0xd')](_0x8b4d('0xe'),_0x55e6cf,_0x8b4d('0xc'),JSON[_0x8b4d('0xf')](_0x35d06e));if(_0x35d06e[_0x8b4d('0x10')]){if(_0x35d06e[_0x8b4d('0x10')][_0x8b4d('0x11')]===0x1f4){logger[_0x8b4d('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x55e6cf,_0x35d06e['error'][_0x8b4d('0x12')]);return _0x7b0ae9(_0x35d06e[_0x8b4d('0x10')][_0x8b4d('0x12')]);}logger[_0x8b4d('0x10')](_0x8b4d('0xb'),_0x55e6cf,_0x35d06e[_0x8b4d('0x10')]['message']);return _0x3825e4(_0x35d06e['error'][_0x8b4d('0x12')]);}else{logger[_0x8b4d('0x13')](_0x8b4d('0xb'),_0x55e6cf,_0x8b4d('0xc'));_0x3825e4(_0x35d06e['result'][_0x8b4d('0x12')]);}})[_0x8b4d('0x14')](function(_0x352d64){logger[_0x8b4d('0x10')](_0x8b4d('0xb'),_0x55e6cf,_0x352d64);_0x7b0ae9(_0x352d64);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index b0495b0..3b03844 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 _0x8fdf=['connect-timeout','express','Router','../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated','/:id/download','create','put','update','exports','multer','path'];(function(_0xbbb4ea,_0x25e2e5){var _0x3a43e7=function(_0x13acd8){while(--_0x13acd8){_0xbbb4ea['push'](_0xbbb4ea['shift']());}};_0x3a43e7(++_0x25e2e5);}(_0x8fdf,0x139));var _0xf8fd=function(_0x191e48,_0x2826e1){_0x191e48=_0x191e48-0x0;var _0x9fd630=_0x8fdf[_0x191e48];return _0x9fd630;};'use strict';var multer=require(_0xf8fd('0x0'));var util=require('util');var path=require(_0xf8fd('0x1'));var timeout=require(_0xf8fd('0x2'));var express=require(_0xf8fd('0x3'));var router=express[_0xf8fd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf8fd('0x5'));var controller=require(_0xf8fd('0x6'));router[_0xf8fd('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf8fd('0x7')](_0xf8fd('0x8'),auth[_0xf8fd('0x9')](),controller['show']);router[_0xf8fd('0x7')](_0xf8fd('0xa'),auth[_0xf8fd('0x9')](),controller['download']);router['post']('/',auth[_0xf8fd('0x9')](),controller[_0xf8fd('0xb')]);router[_0xf8fd('0xc')](_0xf8fd('0x8'),auth['isAuthenticated'](),controller[_0xf8fd('0xd')]);router['delete'](_0xf8fd('0x8'),auth[_0xf8fd('0x9')](),controller['destroy']);module[_0xf8fd('0xe')]=router; \ No newline at end of file +var _0x490d=['create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post'];(function(_0x42b4a5,_0x5900bb){var _0x2c885f=function(_0x1bf045){while(--_0x1bf045){_0x42b4a5['push'](_0x42b4a5['shift']());}};_0x2c885f(++_0x5900bb);}(_0x490d,0xcc));var _0xd490=function(_0x16783b,_0x42f3ed){_0x16783b=_0x16783b-0x0;var _0x2eaba3=_0x490d[_0x16783b];return _0x2eaba3;};'use strict';var multer=require(_0xd490('0x0'));var util=require(_0xd490('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd490('0x2'));var router=express[_0xd490('0x3')]();var fs_extra=require(_0xd490('0x4'));var auth=require(_0xd490('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd490('0x6'));var controller=require(_0xd490('0x7'));router['get']('/',auth[_0xd490('0x8')](),controller[_0xd490('0x9')]);router[_0xd490('0xa')](_0xd490('0xb'),auth['isAuthenticated'](),controller[_0xd490('0xc')]);router[_0xd490('0xa')](_0xd490('0xd'),auth[_0xd490('0x8')](),controller[_0xd490('0xe')]);router[_0xd490('0xf')]('/',auth[_0xd490('0x8')](),controller[_0xd490('0x10')]);router[_0xd490('0x11')]('/:id',auth[_0xd490('0x8')](),controller[_0xd490('0x12')]);router[_0xd490('0x13')]('/:id',auth[_0xd490('0x8')](),controller[_0xd490('0x14')]);module[_0xd490('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 3420d4f..5cc9028 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 _0xac55=['TEXT','STRING','exports'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xac55,0x1b2));var _0x5ac5=function(_0x1b5d74,_0x26cd51){_0x1b5d74=_0x1b5d74-0x0;var _0x27454b=_0xac55[_0x1b5d74];return _0x27454b;};'use strict';var Sequelize=require('sequelize');module[_0x5ac5('0x0')]={'field':{'type':Sequelize[_0x5ac5('0x1')]},'alias':{'type':Sequelize[_0x5ac5('0x2')]},'function':{'type':Sequelize[_0x5ac5('0x2')]},'format':{'type':Sequelize[_0x5ac5('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x5ac5('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbdce=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0xd9d96c,_0x2f1962){var _0x3a899f=function(_0x1bd4a9){while(--_0x1bd4a9){_0xd9d96c['push'](_0xd9d96c['shift']());}};_0x3a899f(++_0x2f1962);}(_0xbdce,0x127));var _0xebdc=function(_0x3e9e87,_0x14239a){_0x3e9e87=_0x3e9e87-0x0;var _0x2947d6=_0xbdce[_0x3e9e87];return _0x2947d6;};'use strict';var Sequelize=require(_0xebdc('0x0'));module[_0xebdc('0x1')]={'field':{'type':Sequelize[_0xebdc('0x2')]},'alias':{'type':Sequelize[_0xebdc('0x3')]},'function':{'type':Sequelize[_0xebdc('0x3')]},'format':{'type':Sequelize[_0xebdc('0x3')]},'groupBy':{'type':Sequelize[_0xebdc('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xebdc('0x3')]},'custom':{'type':Sequelize[_0xebdc('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index ac0f4ba..34ef4d1 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 _0x2c67=['where','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','bulkCreate','body','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','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','limit','undefined','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','filter'];(function(_0x257b17,_0x32cfe1){var _0x308889=function(_0x15dd9e){while(--_0x15dd9e){_0x257b17['push'](_0x257b17['shift']());}};_0x308889(++_0x32cfe1);}(_0x2c67,0x15a));var _0x72c6=function(_0x4d4723,_0xf2e0b5){_0x4d4723=_0x4d4723-0x0;var _0x7256c8=_0x2c67[_0x4d4723];return _0x7256c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x72c6('0x0'));var zipdir=require(_0x72c6('0x1'));var jsonpatch=require(_0x72c6('0x2'));var rp=require(_0x72c6('0x3'));var moment=require(_0x72c6('0x4'));var BPromise=require(_0x72c6('0x5'));var Mustache=require(_0x72c6('0x6'));var util=require(_0x72c6('0x7'));var path=require(_0x72c6('0x8'));var sox=require('sox');var csv=require(_0x72c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72c6('0xa'));var _=require('lodash');var squel=require(_0x72c6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x72c6('0x9'));var querystring=require('querystring');var Papa=require(_0x72c6('0xc'));var Redis=require(_0x72c6('0xd'));var authService=require(_0x72c6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x72c6('0xf'));var hardwareService=require(_0x72c6('0x10'));var logger=require(_0x72c6('0x11'))(_0x72c6('0x12'));var utils=require(_0x72c6('0x13'));var config=require(_0x72c6('0x14'));var licenseUtil=require(_0x72c6('0x15'));var db=require(_0x72c6('0x16'))['db'];function respondWithStatusCode(_0x5ea652,_0x150ae9){_0x150ae9=_0x150ae9||0xcc;return function(_0x3f2e39){if(_0x3f2e39){return _0x5ea652[_0x72c6('0x17')](_0x150ae9);}return _0x5ea652[_0x72c6('0x18')](_0x150ae9)[_0x72c6('0x19')]();};}function respondWithResult(_0x6aa7a7,_0x43ade5){_0x43ade5=_0x43ade5||0xc8;return function(_0x14adba){if(_0x14adba){return _0x6aa7a7[_0x72c6('0x18')](_0x43ade5)[_0x72c6('0x1a')](_0x14adba);}};}function respondWithFilteredResult(_0x3564c8,_0x39b208){return function(_0x2e264f){if(_0x2e264f){var _0x256ddf=typeof _0x39b208[_0x72c6('0x1b')]==='undefined'&&typeof _0x39b208[_0x72c6('0x1c')]===_0x72c6('0x1d');var _0x2f06d1=_0x2e264f[_0x72c6('0x1e')];var _0x4a37b9=_0x256ddf?0x0:_0x39b208['offset'];var _0x2f419d=_0x256ddf?_0x2e264f[_0x72c6('0x1e')]:_0x39b208[_0x72c6('0x1b')]+_0x39b208['limit'];var _0x2e735f;if(_0x2f419d>=_0x2f06d1){_0x2f419d=_0x2f06d1;_0x2e735f=0xc8;}else{_0x2e735f=0xce;}_0x3564c8[_0x72c6('0x18')](_0x2e735f);return _0x3564c8[_0x72c6('0x1f')](_0x72c6('0x20'),_0x4a37b9+'-'+_0x2f419d+'/'+_0x2f06d1)[_0x72c6('0x1a')](_0x2e264f);}return null;};}function patchUpdates(_0x930174){return function(_0x5ec82d){try{jsonpatch[_0x72c6('0x21')](_0x5ec82d,_0x930174,!![]);}catch(_0x37f37f){return BPromise['reject'](_0x37f37f);}return _0x5ec82d[_0x72c6('0x22')]();};}function saveUpdates(_0x1d3b24,_0xaf15d3){return function(_0x360b58){if(_0x360b58){return _0x360b58[_0x72c6('0x23')](_0x1d3b24)[_0x72c6('0x24')](function(_0x3db5db){return _0x3db5db;});}return null;};}function removeEntity(_0xce4fc9,_0xb6e969){return function(_0x3aa570){if(_0x3aa570){return _0x3aa570['destroy']()[_0x72c6('0x24')](function(){_0xce4fc9[_0x72c6('0x18')](0xcc)[_0x72c6('0x19')]();});}};}function handleEntityNotFound(_0x3afab2,_0x2257a9){return function(_0x31e4da){if(!_0x31e4da){_0x3afab2[_0x72c6('0x17')](0x194);}return _0x31e4da;};}function handleError(_0x3485d0,_0x2d4219){_0x2d4219=_0x2d4219||0x1f4;return function(_0xe93ead){logger[_0x72c6('0x25')](_0xe93ead[_0x72c6('0x26')]);if(_0xe93ead['name']){delete _0xe93ead[_0x72c6('0x27')];}_0x3485d0['status'](_0x2d4219)[_0x72c6('0x28')](_0xe93ead);};}exports[_0x72c6('0x29')]=function(_0x49086a,_0x496af8){var _0x1e47b0={},_0x3e3b97={},_0x47dc4b={'count':0x0,'rows':[]};var _0xb3bd84=_[_0x72c6('0x2a')](db[_0x72c6('0x2b')]['rawAttributes'],function(_0x169234){return{'name':_0x169234[_0x72c6('0x2c')],'type':_0x169234[_0x72c6('0x2d')][_0x72c6('0x2e')]};});_0x3e3b97[_0x72c6('0x2f')]=_[_0x72c6('0x2a')](_0xb3bd84,_0x72c6('0x27'));_0x3e3b97[_0x72c6('0x30')]=_[_0x72c6('0x31')](_0x49086a[_0x72c6('0x30')]);_0x3e3b97['filters']=_[_0x72c6('0x32')](_0x3e3b97[_0x72c6('0x2f')],_0x3e3b97[_0x72c6('0x30')]);_0x1e47b0['attributes']=_[_0x72c6('0x32')](_0x3e3b97[_0x72c6('0x2f')],qs[_0x72c6('0x33')](_0x49086a[_0x72c6('0x30')]['fields']));_0x1e47b0['attributes']=_0x1e47b0[_0x72c6('0x34')][_0x72c6('0x35')]?_0x1e47b0['attributes']:_0x3e3b97[_0x72c6('0x2f')];if(!_0x49086a[_0x72c6('0x30')][_0x72c6('0x36')]('nolimit')){_0x1e47b0[_0x72c6('0x1c')]=qs[_0x72c6('0x1c')](_0x49086a[_0x72c6('0x30')][_0x72c6('0x1c')]);_0x1e47b0['offset']=qs[_0x72c6('0x1b')](_0x49086a[_0x72c6('0x30')][_0x72c6('0x1b')]);}_0x1e47b0['order']=qs[_0x72c6('0x37')](_0x49086a[_0x72c6('0x30')]['sort']);_0x1e47b0['where']=qs[_0x72c6('0x38')](_[_0x72c6('0x39')](_0x49086a[_0x72c6('0x30')],_0x3e3b97[_0x72c6('0x38')]),_0xb3bd84);if(_0x49086a[_0x72c6('0x30')][_0x72c6('0x3a')]){_0x1e47b0[_0x72c6('0x3b')]=_[_0x72c6('0x3c')](_0x1e47b0[_0x72c6('0x3b')],{'$or':_[_0x72c6('0x2a')](_0xb3bd84,function(_0x4feba0){if(_0x4feba0[_0x72c6('0x2d')]!=='VIRTUAL'){var _0x2aba0e={};_0x2aba0e[_0x4feba0[_0x72c6('0x27')]]={'$like':'%'+_0x49086a[_0x72c6('0x30')]['filter']+'%'};return _0x2aba0e;}})});}_0x1e47b0=_[_0x72c6('0x3c')]({},_0x1e47b0,_0x49086a[_0x72c6('0x3d')]);var _0x446076={'where':_0x1e47b0[_0x72c6('0x3b')]};return db[_0x72c6('0x2b')]['count'](_0x446076)[_0x72c6('0x24')](function(_0x2cefc6){_0x47dc4b['count']=_0x2cefc6;if(_0x49086a[_0x72c6('0x30')][_0x72c6('0x3e')]){_0x1e47b0['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x72c6('0x3f')](_0x1e47b0);})[_0x72c6('0x24')](function(_0x5124dd){_0x47dc4b[_0x72c6('0x40')]=_0x5124dd;return _0x47dc4b;})[_0x72c6('0x24')](respondWithFilteredResult(_0x496af8,_0x1e47b0))[_0x72c6('0x41')](handleError(_0x496af8,null));};exports[_0x72c6('0x42')]=function(_0x27341e,_0xfa1d42){var _0x36cb9d={'raw':![],'where':{'id':_0x27341e[_0x72c6('0x43')]['id']}},_0x499c85={};_0x499c85[_0x72c6('0x2f')]=_[_0x72c6('0x31')](db[_0x72c6('0x2b')][_0x72c6('0x44')]);_0x499c85['query']=_[_0x72c6('0x31')](_0x27341e[_0x72c6('0x30')]);_0x499c85[_0x72c6('0x38')]=_[_0x72c6('0x32')](_0x499c85['model'],_0x499c85[_0x72c6('0x30')]);_0x36cb9d[_0x72c6('0x34')]=_[_0x72c6('0x32')](_0x499c85['model'],qs[_0x72c6('0x33')](_0x27341e[_0x72c6('0x30')][_0x72c6('0x33')]));_0x36cb9d[_0x72c6('0x34')]=_0x36cb9d['attributes'][_0x72c6('0x35')]?_0x36cb9d[_0x72c6('0x34')]:_0x499c85[_0x72c6('0x2f')];if(_0x27341e['query']['includeAll']){_0x36cb9d['include']=[{'all':!![]}];}_0x36cb9d=_[_0x72c6('0x3c')]({},_0x36cb9d,_0x27341e[_0x72c6('0x3d')]);return db['AnalyticFieldReport'][_0x72c6('0x45')](_0x36cb9d)[_0x72c6('0x24')](handleEntityNotFound(_0xfa1d42,null))[_0x72c6('0x24')](respondWithResult(_0xfa1d42,null))[_0x72c6('0x41')](handleError(_0xfa1d42,null));};exports['create']=function(_0x3ad014,_0x388f73){return db[_0x72c6('0x2b')][_0x72c6('0x46')](_0x3ad014['body'],{})['then'](respondWithResult(_0x388f73,0xc9))[_0x72c6('0x41')](handleError(_0x388f73,null));};exports[_0x72c6('0x47')]=function(_0x22c7dd,_0x4744b3){return db[_0x72c6('0x2b')][_0x72c6('0x47')](_0x22c7dd['body'],{'raw':![],'individualHooks':!![]})[_0x72c6('0x24')](respondWithResult(_0x4744b3,0xc9))[_0x72c6('0x41')](handleError(_0x4744b3,null));};exports[_0x72c6('0x23')]=function(_0x1af47f,_0x1d623c){if(_0x1af47f[_0x72c6('0x48')]['id']){delete _0x1af47f[_0x72c6('0x48')]['id'];}return db[_0x72c6('0x2b')][_0x72c6('0x45')]({'where':{'id':_0x1af47f[_0x72c6('0x43')]['id']}})[_0x72c6('0x24')](handleEntityNotFound(_0x1d623c,null))[_0x72c6('0x24')](saveUpdates(_0x1af47f['body'],null))[_0x72c6('0x24')](respondWithResult(_0x1d623c,null))['catch'](handleError(_0x1d623c,null));};exports[_0x72c6('0x49')]=function(_0x3e614a,_0x47f69e){return db[_0x72c6('0x2b')]['find']({'where':{'id':_0x3e614a['params']['id']}})[_0x72c6('0x24')](handleEntityNotFound(_0x47f69e,null))['then'](removeEntity(_0x47f69e,null))[_0x72c6('0x41')](handleError(_0x47f69e,null));};exports[_0x72c6('0x4a')]=function(_0x554838,_0x1b2981){return db[_0x72c6('0x2b')][_0x72c6('0x49')]({'where':{'id':_0x554838['query'][_0x72c6('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x72c6('0x24')](respondWithResult(_0x1b2981,0xcc))[_0x72c6('0x41')](handleError(_0x1b2981,null));};exports[_0x72c6('0x4c')]=function(_0x45b535,_0x432f34,_0x2a2cc5){return db[_0x72c6('0x4d')][_0x72c6('0x4e')]({'where':{'id':_0x45b535['params']['id']}})[_0x72c6('0x24')](handleEntityNotFound(_0x432f34,null))[_0x72c6('0x24')](function(_0x4a52ed){if(_0x4a52ed){return db['sequelize'][_0x72c6('0x4f')](function(_0x32c4b3){return db[_0x72c6('0x2b')][_0x72c6('0x49')]({'where':{'CustomReportId':_0x45b535[_0x72c6('0x43')]['id']},'transaction':_0x32c4b3})[_0x72c6('0x24')](function(_0xe6496b){var _0x2fb92a=_[_0x72c6('0x2a')](_0x45b535[_0x72c6('0x48')],function(_0x157ab6){delete _0x157ab6['id'];_0x157ab6[_0x72c6('0x50')]=_0x45b535[_0x72c6('0x43')]['id'];return _0x157ab6;});return db[_0x72c6('0x2b')][_0x72c6('0x47')](_0x2fb92a,{'transaction':_0x32c4b3});});})['then'](function(){return db[_0x72c6('0x2b')][_0x72c6('0x3f')]({'where':{'CustomReportId':_0x45b535[_0x72c6('0x43')]['id']}});});}})[_0x72c6('0x24')](respondWithResult(_0x432f34,null))[_0x72c6('0x41')](handleError(_0x432f34,null));}; \ No newline at end of file +var _0x5912=['squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','merge','VIRTUAL','filter','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash'];(function(_0x3171a1,_0x234956){var _0x5e1a0f=function(_0x58b55d){while(--_0x58b55d){_0x3171a1['push'](_0x3171a1['shift']());}};_0x5e1a0f(++_0x234956);}(_0x5912,0xd8));var _0x2591=function(_0x52e9a4,_0x5a25f5){_0x52e9a4=_0x52e9a4-0x0;var _0x1aefa2=_0x5912[_0x52e9a4];return _0x1aefa2;};'use strict';var emlformat=require(_0x2591('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2591('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2591('0x2'));var BPromise=require(_0x2591('0x3'));var Mustache=require(_0x2591('0x4'));var util=require(_0x2591('0x5'));var path=require(_0x2591('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2591('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2591('0x8'));var squel=require(_0x2591('0x9'));var crypto=require(_0x2591('0xa'));var jsforce=require(_0x2591('0xb'));var deskjs=require(_0x2591('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2591('0xd'));var Redis=require('ioredis');var authService=require(_0x2591('0xe'));var qs=require(_0x2591('0xf'));var as=require(_0x2591('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2591('0x11'));var utils=require(_0x2591('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2591('0x13'));var db=require(_0x2591('0x14'))['db'];function respondWithStatusCode(_0x2b019b,_0x254c8c){_0x254c8c=_0x254c8c||0xcc;return function(_0x2e0665){if(_0x2e0665){return _0x2b019b[_0x2591('0x15')](_0x254c8c);}return _0x2b019b[_0x2591('0x16')](_0x254c8c)[_0x2591('0x17')]();};}function respondWithResult(_0x186e4d,_0x273cc8){_0x273cc8=_0x273cc8||0xc8;return function(_0x205912){if(_0x205912){return _0x186e4d['status'](_0x273cc8)[_0x2591('0x18')](_0x205912);}};}function respondWithFilteredResult(_0x280ff1,_0x3c2dd6){return function(_0x55a061){if(_0x55a061){var _0xf86bd9=typeof _0x3c2dd6[_0x2591('0x19')]==='undefined'&&typeof _0x3c2dd6['limit']==='undefined';var _0x5f4ba9=_0x55a061['count'];var _0x2b2c36=_0xf86bd9?0x0:_0x3c2dd6[_0x2591('0x19')];var _0x8ff77a=_0xf86bd9?_0x55a061[_0x2591('0x1a')]:_0x3c2dd6[_0x2591('0x19')]+_0x3c2dd6[_0x2591('0x1b')];var _0x99ae6e;if(_0x8ff77a>=_0x5f4ba9){_0x8ff77a=_0x5f4ba9;_0x99ae6e=0xc8;}else{_0x99ae6e=0xce;}_0x280ff1[_0x2591('0x16')](_0x99ae6e);return _0x280ff1[_0x2591('0x1c')](_0x2591('0x1d'),_0x2b2c36+'-'+_0x8ff77a+'/'+_0x5f4ba9)[_0x2591('0x18')](_0x55a061);}return null;};}function patchUpdates(_0x54e3cd){return function(_0xdd5233){try{jsonpatch['apply'](_0xdd5233,_0x54e3cd,!![]);}catch(_0x1aa0b1){return BPromise['reject'](_0x1aa0b1);}return _0xdd5233[_0x2591('0x1e')]();};}function saveUpdates(_0x171844,_0x188d04){return function(_0x15c959){if(_0x15c959){return _0x15c959[_0x2591('0x1f')](_0x171844)[_0x2591('0x20')](function(_0x1d4cc9){return _0x1d4cc9;});}return null;};}function removeEntity(_0xc5af6d,_0x3c2e48){return function(_0x11238a){if(_0x11238a){return _0x11238a[_0x2591('0x21')]()[_0x2591('0x20')](function(){_0xc5af6d[_0x2591('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x429102,_0x2a3027){return function(_0x4f174b){if(!_0x4f174b){_0x429102['sendStatus'](0x194);}return _0x4f174b;};}function handleError(_0x2c8857,_0x1e834c){_0x1e834c=_0x1e834c||0x1f4;return function(_0xe10489){logger[_0x2591('0x22')](_0xe10489[_0x2591('0x23')]);if(_0xe10489['name']){delete _0xe10489[_0x2591('0x24')];}_0x2c8857[_0x2591('0x16')](_0x1e834c)[_0x2591('0x25')](_0xe10489);};}exports[_0x2591('0x26')]=function(_0x270d03,_0x16b42d){var _0x457008={},_0x353d9c={},_0x45a486={'count':0x0,'rows':[]};var _0x4d8a60=_['map'](db['AnalyticFieldReport'][_0x2591('0x27')],function(_0x58bcd8){return{'name':_0x58bcd8['fieldName'],'type':_0x58bcd8[_0x2591('0x28')][_0x2591('0x29')]};});_0x353d9c[_0x2591('0x2a')]=_[_0x2591('0x2b')](_0x4d8a60,_0x2591('0x24'));_0x353d9c['query']=_[_0x2591('0x2c')](_0x270d03[_0x2591('0x2d')]);_0x353d9c['filters']=_[_0x2591('0x2e')](_0x353d9c[_0x2591('0x2a')],_0x353d9c[_0x2591('0x2d')]);_0x457008[_0x2591('0x2f')]=_[_0x2591('0x2e')](_0x353d9c['model'],qs[_0x2591('0x30')](_0x270d03[_0x2591('0x2d')][_0x2591('0x30')]));_0x457008[_0x2591('0x2f')]=_0x457008[_0x2591('0x2f')]['length']?_0x457008[_0x2591('0x2f')]:_0x353d9c['model'];if(!_0x270d03['query'][_0x2591('0x31')]('nolimit')){_0x457008['limit']=qs[_0x2591('0x1b')](_0x270d03[_0x2591('0x2d')][_0x2591('0x1b')]);_0x457008[_0x2591('0x19')]=qs[_0x2591('0x19')](_0x270d03['query']['offset']);}_0x457008['order']=qs['sort'](_0x270d03[_0x2591('0x2d')][_0x2591('0x32')]);_0x457008[_0x2591('0x33')]=qs[_0x2591('0x34')](_['pick'](_0x270d03[_0x2591('0x2d')],_0x353d9c[_0x2591('0x34')]),_0x4d8a60);if(_0x270d03['query']['filter']){_0x457008[_0x2591('0x33')]=_[_0x2591('0x35')](_0x457008[_0x2591('0x33')],{'$or':_[_0x2591('0x2b')](_0x4d8a60,function(_0x36f656){if(_0x36f656[_0x2591('0x28')]!==_0x2591('0x36')){var _0x3de6ce={};_0x3de6ce[_0x36f656[_0x2591('0x24')]]={'$like':'%'+_0x270d03[_0x2591('0x2d')][_0x2591('0x37')]+'%'};return _0x3de6ce;}})});}_0x457008=_[_0x2591('0x35')]({},_0x457008,_0x270d03['options']);var _0x4c6658={'where':_0x457008[_0x2591('0x33')]};return db[_0x2591('0x38')][_0x2591('0x1a')](_0x4c6658)[_0x2591('0x20')](function(_0x6335d8){_0x45a486[_0x2591('0x1a')]=_0x6335d8;if(_0x270d03[_0x2591('0x2d')][_0x2591('0x39')]){_0x457008[_0x2591('0x3a')]=[{'all':!![]}];}return db[_0x2591('0x38')][_0x2591('0x3b')](_0x457008);})[_0x2591('0x20')](function(_0xe0af4f){_0x45a486[_0x2591('0x3c')]=_0xe0af4f;return _0x45a486;})['then'](respondWithFilteredResult(_0x16b42d,_0x457008))[_0x2591('0x3d')](handleError(_0x16b42d,null));};exports[_0x2591('0x3e')]=function(_0x535cb4,_0x3c5c2e){var _0x17e9a6={'raw':![],'where':{'id':_0x535cb4[_0x2591('0x3f')]['id']}},_0x4d9dbf={};_0x4d9dbf['model']=_[_0x2591('0x2c')](db['AnalyticFieldReport'][_0x2591('0x27')]);_0x4d9dbf[_0x2591('0x2d')]=_[_0x2591('0x2c')](_0x535cb4[_0x2591('0x2d')]);_0x4d9dbf[_0x2591('0x34')]=_['intersection'](_0x4d9dbf[_0x2591('0x2a')],_0x4d9dbf[_0x2591('0x2d')]);_0x17e9a6['attributes']=_[_0x2591('0x2e')](_0x4d9dbf[_0x2591('0x2a')],qs[_0x2591('0x30')](_0x535cb4[_0x2591('0x2d')][_0x2591('0x30')]));_0x17e9a6['attributes']=_0x17e9a6[_0x2591('0x2f')][_0x2591('0x40')]?_0x17e9a6[_0x2591('0x2f')]:_0x4d9dbf[_0x2591('0x2a')];if(_0x535cb4[_0x2591('0x2d')][_0x2591('0x39')]){_0x17e9a6['include']=[{'all':!![]}];}_0x17e9a6=_[_0x2591('0x35')]({},_0x17e9a6,_0x535cb4[_0x2591('0x41')]);return db[_0x2591('0x38')][_0x2591('0x42')](_0x17e9a6)[_0x2591('0x20')](handleEntityNotFound(_0x3c5c2e,null))[_0x2591('0x20')](respondWithResult(_0x3c5c2e,null))['catch'](handleError(_0x3c5c2e,null));};exports[_0x2591('0x43')]=function(_0x2e8cdb,_0x3d9f27){return db[_0x2591('0x38')][_0x2591('0x43')](_0x2e8cdb[_0x2591('0x44')],{})[_0x2591('0x20')](respondWithResult(_0x3d9f27,0xc9))[_0x2591('0x3d')](handleError(_0x3d9f27,null));};exports[_0x2591('0x45')]=function(_0x135e27,_0x276a23){return db[_0x2591('0x38')][_0x2591('0x45')](_0x135e27[_0x2591('0x44')],{'raw':![],'individualHooks':!![]})[_0x2591('0x20')](respondWithResult(_0x276a23,0xc9))['catch'](handleError(_0x276a23,null));};exports[_0x2591('0x1f')]=function(_0x53b7d0,_0x343d5e){if(_0x53b7d0[_0x2591('0x44')]['id']){delete _0x53b7d0[_0x2591('0x44')]['id'];}return db[_0x2591('0x38')][_0x2591('0x42')]({'where':{'id':_0x53b7d0[_0x2591('0x3f')]['id']}})[_0x2591('0x20')](handleEntityNotFound(_0x343d5e,null))[_0x2591('0x20')](saveUpdates(_0x53b7d0[_0x2591('0x44')],null))[_0x2591('0x20')](respondWithResult(_0x343d5e,null))['catch'](handleError(_0x343d5e,null));};exports[_0x2591('0x21')]=function(_0x47e4df,_0x6d07a9){return db[_0x2591('0x38')]['find']({'where':{'id':_0x47e4df['params']['id']}})[_0x2591('0x20')](handleEntityNotFound(_0x6d07a9,null))[_0x2591('0x20')](removeEntity(_0x6d07a9,null))['catch'](handleError(_0x6d07a9,null));};exports[_0x2591('0x46')]=function(_0x38ed9a,_0x5374c6){return db[_0x2591('0x38')][_0x2591('0x21')]({'where':{'id':_0x38ed9a[_0x2591('0x2d')][_0x2591('0x47')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5374c6,0xcc))[_0x2591('0x3d')](handleError(_0x5374c6,null));};exports[_0x2591('0x48')]=function(_0x51bf70,_0x221b11,_0x43f821){return db[_0x2591('0x49')][_0x2591('0x4a')]({'where':{'id':_0x51bf70['params']['id']}})[_0x2591('0x20')](handleEntityNotFound(_0x221b11,null))['then'](function(_0x1474df){if(_0x1474df){return db['sequelize']['transaction'](function(_0x31eb19){return db[_0x2591('0x38')]['destroy']({'where':{'CustomReportId':_0x51bf70[_0x2591('0x3f')]['id']},'transaction':_0x31eb19})[_0x2591('0x20')](function(_0x5a6805){var _0x549baa=_[_0x2591('0x2b')](_0x51bf70[_0x2591('0x44')],function(_0x5a12d2){delete _0x5a12d2['id'];_0x5a12d2['CustomReportId']=_0x51bf70[_0x2591('0x3f')]['id'];return _0x5a12d2;});return db[_0x2591('0x38')][_0x2591('0x45')](_0x549baa,{'transaction':_0x31eb19});});})[_0x2591('0x20')](function(){return db[_0x2591('0x38')][_0x2591('0x3b')]({'where':{'CustomReportId':_0x51bf70['params']['id']}});});}})[_0x2591('0x20')](respondWithResult(_0x221b11,null))['catch'](handleError(_0x221b11,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index beec9df..5729a17 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 _0xca6c=['../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5352d0,_0x41e8b4){var _0x352b00=function(_0x289f6c){while(--_0x289f6c){_0x5352d0['push'](_0x5352d0['shift']());}};_0x352b00(++_0x41e8b4);}(_0xca6c,0xe2));var _0xcca6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca6c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcca6('0x0'));var util=require(_0xcca6('0x1'));var logger=require(_0xcca6('0x2'))(_0xcca6('0x3'));var moment=require(_0xcca6('0x4'));var BPromise=require(_0xcca6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcca6('0x6'));var rimraf=require(_0xcca6('0x7'));var config=require(_0xcca6('0x8'));var attributes=require(_0xcca6('0x9'));module[_0xcca6('0xa')]=function(_0x450ba7,_0x2e508d){return _0x450ba7[_0xcca6('0xb')]('AnalyticFieldReport',attributes,{'tableName':_0xcca6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93d3=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x278502,_0x4da9e5){var _0x56ec50=function(_0x1714cf){while(--_0x1714cf){_0x278502['push'](_0x278502['shift']());}};_0x56ec50(++_0x4da9e5);}(_0x93d3,0xef));var _0x393d=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x93d3[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x393d('0x0'));var util=require('util');var logger=require(_0x393d('0x1'))('api');var moment=require(_0x393d('0x2'));var BPromise=require(_0x393d('0x3'));var rp=require(_0x393d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x393d('0x5'));var config=require(_0x393d('0x6'));var attributes=require(_0x393d('0x7'));module[_0x393d('0x8')]=function(_0x4e65bf,_0x2b1e80){return _0x4e65bf[_0x393d('0x9')](_0x393d('0xa'),attributes,{'tableName':_0x393d('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 6e32245..6762ef9 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 _0xa8f3=['http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x12c3f9,_0x28b5fb){var _0xc426f1=function(_0x125d7e){while(--_0x125d7e){_0x12c3f9['push'](_0x12c3f9['shift']());}};_0xc426f1(++_0x28b5fb);}(_0xa8f3,0xc0));var _0x3a8f=function(_0x7c71d6,_0x574cb7){_0x7c71d6=_0x7c71d6-0x0;var _0x53541a=_0xa8f3[_0x7c71d6];return _0x53541a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3a8f('0x0'));var BPromise=require(_0x3a8f('0x1'));var rs=require(_0x3a8f('0x2'));var fs=require('fs');var Redis=require(_0x3a8f('0x3'));var db=require(_0x3a8f('0x4'))['db'];var utils=require(_0x3a8f('0x5'));var logger=require(_0x3a8f('0x6'))('rpc');var config=require(_0x3a8f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3a8f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x424fb9,_0x29508a,_0x23953e){return new BPromise(function(_0x55da10,_0x2f355e){return client['request'](_0x424fb9,_0x23953e)[_0x3a8f('0x9')](function(_0x159532){logger[_0x3a8f('0xa')](_0x3a8f('0xb'),_0x29508a,_0x3a8f('0xc'));logger['debug'](_0x3a8f('0xd'),_0x29508a,_0x3a8f('0xc'),JSON[_0x3a8f('0xe')](_0x159532));if(_0x159532[_0x3a8f('0xf')]){if(_0x159532['error'][_0x3a8f('0x10')]===0x1f4){logger[_0x3a8f('0xf')](_0x3a8f('0xb'),_0x29508a,_0x159532['error'][_0x3a8f('0x11')]);return _0x2f355e(_0x159532[_0x3a8f('0xf')][_0x3a8f('0x11')]);}logger[_0x3a8f('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x29508a,_0x159532[_0x3a8f('0xf')][_0x3a8f('0x11')]);return _0x55da10(_0x159532['error'][_0x3a8f('0x11')]);}else{logger[_0x3a8f('0xa')](_0x3a8f('0xb'),_0x29508a,_0x3a8f('0xc'));_0x55da10(_0x159532[_0x3a8f('0x12')][_0x3a8f('0x11')]);}})[_0x3a8f('0x13')](function(_0x8f77cf){logger[_0x3a8f('0xf')](_0x3a8f('0xb'),_0x29508a,_0x8f77cf);_0x2f355e(_0x8f77cf);});});} \ No newline at end of file +var _0x7d13=['then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d13,0xf9));var _0x37d1=function(_0x2c8350,_0x5126ed){_0x2c8350=_0x2c8350-0x0;var _0x4d5530=_0x7d13[_0x2c8350];return _0x4d5530;};'use strict';var _=require(_0x37d1('0x0'));var util=require(_0x37d1('0x1'));var moment=require(_0x37d1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37d1('0x3'));var db=require(_0x37d1('0x4'))['db'];var utils=require(_0x37d1('0x5'));var logger=require(_0x37d1('0x6'))(_0x37d1('0x7'));var config=require('../../config/environment');var jayson=require(_0x37d1('0x8'));var client=jayson['client'][_0x37d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa5f1b6,_0x2464d5,_0x1cabd3){return new BPromise(function(_0x4547f2,_0x262d9c){return client[_0x37d1('0xa')](_0xa5f1b6,_0x1cabd3)[_0x37d1('0xb')](function(_0x2344b6){logger[_0x37d1('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2464d5,_0x37d1('0xd'));logger['debug'](_0x37d1('0xe'),_0x2464d5,_0x37d1('0xd'),JSON['stringify'](_0x2344b6));if(_0x2344b6[_0x37d1('0xf')]){if(_0x2344b6[_0x37d1('0xf')][_0x37d1('0x10')]===0x1f4){logger[_0x37d1('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2464d5,_0x2344b6[_0x37d1('0xf')][_0x37d1('0x11')]);return _0x262d9c(_0x2344b6[_0x37d1('0xf')][_0x37d1('0x11')]);}logger[_0x37d1('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2464d5,_0x2344b6[_0x37d1('0xf')][_0x37d1('0x11')]);return _0x4547f2(_0x2344b6[_0x37d1('0xf')][_0x37d1('0x11')]);}else{logger[_0x37d1('0xc')](_0x37d1('0x12'),_0x2464d5,_0x37d1('0xd'));_0x4547f2(_0x2344b6[_0x37d1('0x13')]['message']);}})['catch'](function(_0x176936){logger[_0x37d1('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2464d5,_0x176936);_0x262d9c(_0x176936);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c2a77cd..ca72934 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(_0x444a4b,_0x49d315){var _0x2d5c29=function(_0x2f2e03){while(--_0x2f2e03){_0x444a4b['push'](_0x444a4b['shift']());}};_0x2d5c29(++_0x49d315);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x5c2ee,_0x38274){var _0x18e7c4=function(_0x383911){while(--_0x383911){_0x5c2ee['push'](_0x5c2ee['shift']());}};_0x18e7c4(++_0x38274);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index c320870..6be9f66 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 _0xc9c3=['name','exports','STRING'];(function(_0x538bf9,_0x86e275){var _0x568885=function(_0x46cdc3){while(--_0x46cdc3){_0x538bf9['push'](_0x538bf9['shift']());}};_0x568885(++_0x86e275);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x3f3175,_0x4530f3){_0x3f3175=_0x3f3175-0x0;var _0x25ed12=_0xc9c3[_0x3f3175];return _0x25ed12;};'use strict';var Sequelize=require('sequelize');module[_0x3c9c('0x0')]={'name':{'type':Sequelize[_0x3c9c('0x1')],'allowNull':![],'unique':_0x3c9c('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x3c9c('0x1')]}}; \ No newline at end of file +var _0x0269=['STRING','sequelize'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0x0269,0x135));var _0x9026=function(_0x4938cb,_0x1453ec){_0x4938cb=_0x4938cb-0x0;var _0xa0dbe=_0x0269[_0x4938cb];return _0xa0dbe;};'use strict';var Sequelize=require(_0x9026('0x0'));module['exports']={'name':{'type':Sequelize[_0x9026('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x9026('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x9026('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 1034711..eb5344b 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 _0x34e8=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','catch','params','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','Metrics','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x4084eb,_0x30c6ad){var _0x4c1f1c=function(_0x1ca12e){while(--_0x1ca12e){_0x4084eb['push'](_0x4084eb['shift']());}};_0x4c1f1c(++_0x30c6ad);}(_0x34e8,0x12c));var _0x834e=function(_0x37d6b7,_0x1636af){_0x37d6b7=_0x37d6b7-0x0;var _0x2f049f=_0x34e8[_0x37d6b7];return _0x2f049f;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){var _0x338636=_0x58f4fd['get']({'plain':!![]});var _0x24fcf7=_0x834e('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x24fcf7,'resourceId':_0x338636['id']}})[_0x834e('0x2a')](function(){return _0x58f4fd;});})['then'](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3db026,_0x2cc2eb){return function(_0x3cd928){if(!_0x3cd928){_0x3db026[_0x834e('0x1c')](0x194);}return _0x3cd928;};}function handleError(_0x491919,_0x510780){_0x510780=_0x510780||0x1f4;return function(_0x4dc64a){logger['error'](_0x4dc64a[_0x834e('0x2d')]);if(_0x4dc64a[_0x834e('0x2e')]){delete _0x4dc64a[_0x834e('0x2e')];}_0x491919['status'](_0x510780)[_0x834e('0x2f')](_0x4dc64a);};}exports[_0x834e('0x30')]=function(_0x1f3671,_0x1e026a){var _0x4551f5={},_0x390119={},_0x3d149d={'count':0x0,'rows':[]};var _0xfaf716=_[_0x834e('0x31')](db['AnalyticMetric'][_0x834e('0x32')],function(_0x5cad11){return{'name':_0x5cad11[_0x834e('0x33')],'type':_0x5cad11[_0x834e('0x34')][_0x834e('0x35')]};});_0x390119[_0x834e('0x36')]=_[_0x834e('0x31')](_0xfaf716,_0x834e('0x2e'));_0x390119[_0x834e('0x37')]=_[_0x834e('0x38')](_0x1f3671[_0x834e('0x37')]);_0x390119[_0x834e('0x39')]=_['intersection'](_0x390119[_0x834e('0x36')],_0x390119[_0x834e('0x37')]);_0x4551f5[_0x834e('0x3a')]=_[_0x834e('0x3b')](_0x390119['model'],qs[_0x834e('0x3c')](_0x1f3671[_0x834e('0x37')]['fields']));_0x4551f5['attributes']=_0x4551f5['attributes'][_0x834e('0x3d')]?_0x4551f5[_0x834e('0x3a')]:_0x390119[_0x834e('0x36')];if(!_0x1f3671[_0x834e('0x37')][_0x834e('0x3e')](_0x834e('0x3f'))){_0x4551f5['limit']=qs[_0x834e('0x20')](_0x1f3671['query'][_0x834e('0x20')]);_0x4551f5[_0x834e('0x22')]=qs['offset'](_0x1f3671[_0x834e('0x37')][_0x834e('0x22')]);}_0x4551f5['order']=qs['sort'](_0x1f3671[_0x834e('0x37')][_0x834e('0x40')]);_0x4551f5[_0x834e('0x41')]=qs[_0x834e('0x39')](_[_0x834e('0x42')](_0x1f3671['query'],_0x390119[_0x834e('0x39')]),_0xfaf716);if(_0x1f3671['query']['filter']){_0x4551f5[_0x834e('0x41')]=_['merge'](_0x4551f5[_0x834e('0x41')],{'$or':_[_0x834e('0x31')](_0xfaf716,function(_0x16aea6){if(_0x16aea6[_0x834e('0x34')]!==_0x834e('0x43')){var _0x574ea8={};_0x574ea8[_0x16aea6[_0x834e('0x2e')]]={'$like':'%'+_0x1f3671[_0x834e('0x37')][_0x834e('0x44')]+'%'};return _0x574ea8;}})});}_0x4551f5=_['merge']({},_0x4551f5,_0x1f3671[_0x834e('0x45')]);var _0x16ac45={'where':_0x4551f5['where']};return db[_0x834e('0x46')]['count'](_0x16ac45)[_0x834e('0x2a')](function(_0x585335){_0x3d149d['count']=_0x585335;if(_0x1f3671['query'][_0x834e('0x47')]){_0x4551f5[_0x834e('0x48')]=[{'all':!![]}];}return db[_0x834e('0x46')][_0x834e('0x49')](_0x4551f5);})[_0x834e('0x2a')](function(_0x23feea){_0x3d149d[_0x834e('0x4a')]=_0x23feea;return _0x3d149d;})['then'](respondWithFilteredResult(_0x1e026a,_0x4551f5))[_0x834e('0x4b')](handleError(_0x1e026a,null));};exports['show']=function(_0x321efa,_0x540685){var _0x1df5b0={'raw':!![],'where':{'id':_0x321efa[_0x834e('0x4c')]['id']}},_0x5a5807={};_0x5a5807[_0x834e('0x36')]=_['keys'](db[_0x834e('0x46')][_0x834e('0x32')]);_0x5a5807[_0x834e('0x37')]=_[_0x834e('0x38')](_0x321efa[_0x834e('0x37')]);_0x5a5807[_0x834e('0x39')]=_[_0x834e('0x3b')](_0x5a5807[_0x834e('0x36')],_0x5a5807[_0x834e('0x37')]);_0x1df5b0[_0x834e('0x3a')]=_['intersection'](_0x5a5807[_0x834e('0x36')],qs[_0x834e('0x3c')](_0x321efa['query'][_0x834e('0x3c')]));_0x1df5b0[_0x834e('0x3a')]=_0x1df5b0[_0x834e('0x3a')][_0x834e('0x3d')]?_0x1df5b0[_0x834e('0x3a')]:_0x5a5807[_0x834e('0x36')];if(_0x321efa['query']['includeAll']){_0x1df5b0[_0x834e('0x48')]=[{'all':!![]}];}_0x1df5b0=_[_0x834e('0x4d')]({},_0x1df5b0,_0x321efa[_0x834e('0x45')]);return db[_0x834e('0x46')][_0x834e('0x4e')](_0x1df5b0)[_0x834e('0x2a')](handleEntityNotFound(_0x540685,null))[_0x834e('0x2a')](respondWithResult(_0x540685,null))[_0x834e('0x4b')](handleError(_0x540685,null));};exports[_0x834e('0x4f')]=function(_0x390c45,_0xf02f0d){return db[_0x834e('0x46')][_0x834e('0x4f')](_0x390c45[_0x834e('0x50')],{})[_0x834e('0x2a')](function(_0x1a3855){var _0x3df078=_0x390c45[_0x834e('0x51')][_0x834e('0x52')]({'plain':!![]});if(!_0x3df078)throw new Error(_0x834e('0x53'));if(_0x3df078['role']===_0x834e('0x51')){var _0x1f08b9=_0x1a3855['get']({'plain':!![]});var _0x3c00a3=_0x834e('0x2c');return db['UserProfileSection'][_0x834e('0x4e')]({'where':{'name':_0x3c00a3,'userProfileId':_0x3df078[_0x834e('0x54')]},'raw':!![]})[_0x834e('0x2a')](function(_0x35636e){if(_0x35636e&&_0x35636e[_0x834e('0x55')]===0x0){return db[_0x834e('0x56')][_0x834e('0x4f')]({'name':_0x1f08b9['name'],'resourceId':_0x1f08b9['id'],'type':_0x35636e[_0x834e('0x2e')],'sectionId':_0x35636e['id']},{})[_0x834e('0x2a')](function(){return _0x1a3855;});}else{return _0x1a3855;}})[_0x834e('0x4b')](function(_0x363675){logger[_0x834e('0x57')](_0x834e('0x58'),_0x363675);throw _0x363675;});}return _0x1a3855;})[_0x834e('0x2a')](respondWithResult(_0xf02f0d,0xc9))[_0x834e('0x4b')](handleError(_0xf02f0d,null));};exports['update']=function(_0x11778e,_0x4dc104){if(_0x11778e[_0x834e('0x50')]['id']){delete _0x11778e['body']['id'];}return db[_0x834e('0x46')]['find']({'where':{'id':_0x11778e['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4dc104,null))[_0x834e('0x2a')](saveUpdates(_0x11778e['body'],null))['then'](respondWithResult(_0x4dc104,null))[_0x834e('0x4b')](handleError(_0x4dc104,null));};exports[_0x834e('0x2b')]=function(_0x138ed2,_0x387365){return db[_0x834e('0x46')][_0x834e('0x4e')]({'where':{'id':_0x138ed2[_0x834e('0x4c')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x387365,null))['then'](removeEntity(_0x387365,null))[_0x834e('0x4b')](handleError(_0x387365,null));}; \ No newline at end of file +var _0x3e74=['status','set','Content-Range','apply','save','update','then','destroy','get','Metrics','sendStatus','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count'];(function(_0x121162,_0x45757a){var _0x5ae38f=function(_0x41bc8e){while(--_0x41bc8e){_0x121162['push'](_0x121162['shift']());}};_0x5ae38f(++_0x45757a);}(_0x3e74,0x175));var _0x43e7=function(_0x22319a,_0xeb29e9){_0x22319a=_0x22319a-0x0;var _0x4b5336=_0x3e74[_0x22319a];return _0x4b5336;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){var _0x4b2b9f=_0x4c9df3[_0x43e7('0x23')]({'plain':!![]});var _0x4ca5cf=_0x43e7('0x24');return db['UserProfileResource'][_0x43e7('0x22')]({'where':{'type':_0x4ca5cf,'resourceId':_0x4b2b9f['id']}})[_0x43e7('0x21')](function(){return _0x4c9df3;});})[_0x43e7('0x21')](function(){_0x454359[_0x43e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b7b3,_0x805b54){return function(_0x501551){if(!_0x501551){_0x52b7b3[_0x43e7('0x25')](0x194);}return _0x501551;};}function handleError(_0x40dc8f,_0x3565cf){_0x3565cf=_0x3565cf||0x1f4;return function(_0xb1fc63){logger['error'](_0xb1fc63[_0x43e7('0x26')]);if(_0xb1fc63[_0x43e7('0x27')]){delete _0xb1fc63[_0x43e7('0x27')];}_0x40dc8f[_0x43e7('0x1b')](_0x3565cf)[_0x43e7('0x28')](_0xb1fc63);};}exports[_0x43e7('0x29')]=function(_0x2b85a5,_0x31b2a6){var _0x3bf475={},_0x35dbcd={},_0x17df44={'count':0x0,'rows':[]};var _0x19725a=_[_0x43e7('0x2a')](db[_0x43e7('0x2b')]['rawAttributes'],function(_0x238321){return{'name':_0x238321[_0x43e7('0x2c')],'type':_0x238321[_0x43e7('0x2d')][_0x43e7('0x2e')]};});_0x35dbcd[_0x43e7('0x2f')]=_['map'](_0x19725a,_0x43e7('0x27'));_0x35dbcd[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x2b85a5[_0x43e7('0x30')]);_0x35dbcd['filters']=_['intersection'](_0x35dbcd['model'],_0x35dbcd[_0x43e7('0x30')]);_0x3bf475[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x35dbcd[_0x43e7('0x2f')],qs[_0x43e7('0x34')](_0x2b85a5[_0x43e7('0x30')]['fields']));_0x3bf475['attributes']=_0x3bf475['attributes']['length']?_0x3bf475['attributes']:_0x35dbcd['model'];if(!_0x2b85a5['query'][_0x43e7('0x35')]('nolimit')){_0x3bf475[_0x43e7('0x18')]=qs[_0x43e7('0x18')](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x18')]);_0x3bf475[_0x43e7('0x19')]=qs[_0x43e7('0x19')](_0x2b85a5[_0x43e7('0x30')]['offset']);}_0x3bf475['order']=qs['sort'](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x36')]);_0x3bf475[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_[_0x43e7('0x39')](_0x2b85a5[_0x43e7('0x30')],_0x35dbcd[_0x43e7('0x38')]),_0x19725a);if(_0x2b85a5[_0x43e7('0x30')]['filter']){_0x3bf475[_0x43e7('0x37')]=_[_0x43e7('0x3a')](_0x3bf475['where'],{'$or':_[_0x43e7('0x2a')](_0x19725a,function(_0x4c0c7a){if(_0x4c0c7a[_0x43e7('0x2d')]!==_0x43e7('0x3b')){var _0x1c6f45={};_0x1c6f45[_0x4c0c7a[_0x43e7('0x27')]]={'$like':'%'+_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x3c')]+'%'};return _0x1c6f45;}})});}_0x3bf475=_['merge']({},_0x3bf475,_0x2b85a5['options']);var _0x30dfa9={'where':_0x3bf475[_0x43e7('0x37')]};return db[_0x43e7('0x2b')][_0x43e7('0x1a')](_0x30dfa9)[_0x43e7('0x21')](function(_0x4a4a85){_0x17df44[_0x43e7('0x1a')]=_0x4a4a85;if(_0x2b85a5[_0x43e7('0x30')]['includeAll']){_0x3bf475[_0x43e7('0x3d')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x43e7('0x3e')](_0x3bf475);})['then'](function(_0x3d81ae){_0x17df44[_0x43e7('0x3f')]=_0x3d81ae;return _0x17df44;})[_0x43e7('0x21')](respondWithFilteredResult(_0x31b2a6,_0x3bf475))[_0x43e7('0x40')](handleError(_0x31b2a6,null));};exports['show']=function(_0x47d6a1,_0x103393){var _0x40c509={'raw':!![],'where':{'id':_0x47d6a1[_0x43e7('0x41')]['id']}},_0xe979b5={};_0xe979b5['model']=_['keys'](db['AnalyticMetric'][_0x43e7('0x42')]);_0xe979b5['query']=_[_0x43e7('0x31')](_0x47d6a1['query']);_0xe979b5['filters']=_[_0x43e7('0x33')](_0xe979b5['model'],_0xe979b5[_0x43e7('0x30')]);_0x40c509[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0xe979b5[_0x43e7('0x2f')],qs['fields'](_0x47d6a1[_0x43e7('0x30')][_0x43e7('0x34')]));_0x40c509[_0x43e7('0x32')]=_0x40c509[_0x43e7('0x32')][_0x43e7('0x43')]?_0x40c509[_0x43e7('0x32')]:_0xe979b5['model'];if(_0x47d6a1['query'][_0x43e7('0x44')]){_0x40c509[_0x43e7('0x3d')]=[{'all':!![]}];}_0x40c509=_[_0x43e7('0x3a')]({},_0x40c509,_0x47d6a1['options']);return db['AnalyticMetric']['find'](_0x40c509)[_0x43e7('0x21')](handleEntityNotFound(_0x103393,null))[_0x43e7('0x21')](respondWithResult(_0x103393,null))['catch'](handleError(_0x103393,null));};exports[_0x43e7('0x45')]=function(_0x47686e,_0x3c96fe){return db['AnalyticMetric']['create'](_0x47686e['body'],{})['then'](function(_0x214e7e){var _0xe955fc=_0x47686e['user'][_0x43e7('0x23')]({'plain':!![]});if(!_0xe955fc)throw new Error(_0x43e7('0x46'));if(_0xe955fc[_0x43e7('0x47')]===_0x43e7('0x48')){var _0x4a0ce5=_0x214e7e[_0x43e7('0x23')]({'plain':!![]});var _0x483f20='Metrics';return db[_0x43e7('0x49')][_0x43e7('0x4a')]({'where':{'name':_0x483f20,'userProfileId':_0xe955fc[_0x43e7('0x4b')]},'raw':!![]})[_0x43e7('0x21')](function(_0x13503c){if(_0x13503c&&_0x13503c[_0x43e7('0x4c')]===0x0){return db[_0x43e7('0x4d')][_0x43e7('0x45')]({'name':_0x4a0ce5[_0x43e7('0x27')],'resourceId':_0x4a0ce5['id'],'type':_0x13503c[_0x43e7('0x27')],'sectionId':_0x13503c['id']},{})['then'](function(){return _0x214e7e;});}else{return _0x214e7e;}})[_0x43e7('0x40')](function(_0x46c910){logger['error'](_0x43e7('0x4e'),_0x46c910);throw _0x46c910;});}return _0x214e7e;})['then'](respondWithResult(_0x3c96fe,0xc9))[_0x43e7('0x40')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x20')]=function(_0x34e2ec,_0x1f561f){if(_0x34e2ec[_0x43e7('0x4f')]['id']){delete _0x34e2ec['body']['id'];}return db['AnalyticMetric'][_0x43e7('0x4a')]({'where':{'id':_0x34e2ec[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x1f561f,null))[_0x43e7('0x21')](saveUpdates(_0x34e2ec[_0x43e7('0x4f')],null))[_0x43e7('0x21')](respondWithResult(_0x1f561f,null))[_0x43e7('0x40')](handleError(_0x1f561f,null));};exports[_0x43e7('0x22')]=function(_0x26d86c,_0x24e758){return db[_0x43e7('0x2b')]['find']({'where':{'id':_0x26d86c[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x24e758,null))['then'](removeEntity(_0x24e758,null))[_0x43e7('0x40')](handleError(_0x24e758,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 6e6151c..92856af 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 _0x78e0=['request-promise','path','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x24a956,_0x1a7a4f){var _0x38aac9=function(_0x12d778){while(--_0x12d778){_0x24a956['push'](_0x24a956['shift']());}};_0x38aac9(++_0x1a7a4f);}(_0x78e0,0x13e));var _0x078e=function(_0x2c50b7,_0x7604fb){_0x2c50b7=_0x2c50b7-0x0;var _0x46b5a9=_0x78e0[_0x2c50b7];return _0x46b5a9;};'use strict';var _=require(_0x078e('0x0'));var util=require(_0x078e('0x1'));var logger=require(_0x078e('0x2'))(_0x078e('0x3'));var moment=require(_0x078e('0x4'));var BPromise=require(_0x078e('0x5'));var rp=require(_0x078e('0x6'));var fs=require('fs');var path=require(_0x078e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x078e('0x8'));module[_0x078e('0x9')]=function(_0x8e71c,_0x35578b){return _0x8e71c[_0x078e('0xa')]('AnalyticMetric',attributes,{'tableName':_0x078e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48e3=['util','api','request-promise','path','rimraf','../../config/environment','exports','define','lodash'];(function(_0x1975e1,_0x30d279){var _0xda0396=function(_0x2a4f00){while(--_0x2a4f00){_0x1975e1['push'](_0x1975e1['shift']());}};_0xda0396(++_0x30d279);}(_0x48e3,0xe9));var _0x348e=function(_0x591fd2,_0x51e239){_0x591fd2=_0x591fd2-0x0;var _0xe42dbf=_0x48e3[_0x591fd2];return _0xe42dbf;};'use strict';var _=require(_0x348e('0x0'));var util=require(_0x348e('0x1'));var logger=require('../../config/logger')(_0x348e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x348e('0x3'));var fs=require('fs');var path=require(_0x348e('0x4'));var rimraf=require(_0x348e('0x5'));var config=require(_0x348e('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x348e('0x7')]=function(_0x5201ec,_0x5902cd){return _0x5201ec[_0x348e('0x8')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index b7ec39f..ac32548 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 _0x9d12=['rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x1505da,_0x1d3ad0){var _0xb81eed=function(_0x556f19){while(--_0x556f19){_0x1505da['push'](_0x1505da['shift']());}};_0xb81eed(++_0x1d3ad0);}(_0x9d12,0x1e8));var _0x29d1=function(_0x7e6081,_0x1fe1f8){_0x7e6081=_0x7e6081-0x0;var _0x436afe=_0x9d12[_0x7e6081];return _0x436afe;};'use strict';var _=require(_0x29d1('0x0'));var util=require(_0x29d1('0x1'));var moment=require(_0x29d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x29d1('0x3'));var fs=require('fs');var Redis=require(_0x29d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x29d1('0x5'));var logger=require('../../config/logger')(_0x29d1('0x6'));var config=require(_0x29d1('0x7'));var jayson=require(_0x29d1('0x8'));var client=jayson[_0x29d1('0x9')][_0x29d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28b1fa,_0x289d54,_0x55ca63){return new BPromise(function(_0x185f21,_0xca50db){return client[_0x29d1('0xb')](_0x28b1fa,_0x55ca63)['then'](function(_0x5c1a9c){logger[_0x29d1('0xc')](_0x29d1('0xd'),_0x289d54,_0x29d1('0xe'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x289d54,_0x29d1('0xe'),JSON[_0x29d1('0xf')](_0x5c1a9c));if(_0x5c1a9c[_0x29d1('0x10')]){if(_0x5c1a9c[_0x29d1('0x10')]['code']===0x1f4){logger[_0x29d1('0x10')](_0x29d1('0xd'),_0x289d54,_0x5c1a9c[_0x29d1('0x10')]['message']);return _0xca50db(_0x5c1a9c['error'][_0x29d1('0x11')]);}logger[_0x29d1('0x10')](_0x29d1('0xd'),_0x289d54,_0x5c1a9c[_0x29d1('0x10')][_0x29d1('0x11')]);return _0x185f21(_0x5c1a9c[_0x29d1('0x10')][_0x29d1('0x11')]);}else{logger[_0x29d1('0xc')](_0x29d1('0xd'),_0x289d54,'request\x20sent');_0x185f21(_0x5c1a9c[_0x29d1('0x12')][_0x29d1('0x11')]);}})['catch'](function(_0x437e43){logger[_0x29d1('0x10')](_0x29d1('0xd'),_0x289d54,_0x437e43);_0xca50db(_0x437e43);});});} \ No newline at end of file +var _0x6268=['request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticMetric,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x10ee19,_0x695dc){var _0x3fe5e0=function(_0x2ebdba){while(--_0x2ebdba){_0x10ee19['push'](_0x10ee19['shift']());}};_0x3fe5e0(++_0x695dc);}(_0x6268,0x193));var _0x8626=function(_0x296585,_0x2f6953){_0x296585=_0x296585-0x0;var _0x54f029=_0x6268[_0x296585];return _0x54f029;};'use strict';var _=require(_0x8626('0x0'));var util=require('util');var moment=require(_0x8626('0x1'));var BPromise=require('bluebird');var rs=require(_0x8626('0x2'));var fs=require('fs');var Redis=require(_0x8626('0x3'));var db=require(_0x8626('0x4'))['db'];var utils=require(_0x8626('0x5'));var logger=require(_0x8626('0x6'))('rpc');var config=require(_0x8626('0x7'));var jayson=require(_0x8626('0x8'));var client=jayson[_0x8626('0x9')][_0x8626('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38e89b,_0x4ab035,_0x5f152d){return new BPromise(function(_0x27c779,_0x2eba77){return client[_0x8626('0xb')](_0x38e89b,_0x5f152d)[_0x8626('0xc')](function(_0x96ff2){logger[_0x8626('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x4ab035,_0x8626('0xe'));logger[_0x8626('0xf')](_0x8626('0x10'),_0x4ab035,'request\x20sent',JSON[_0x8626('0x11')](_0x96ff2));if(_0x96ff2[_0x8626('0x12')]){if(_0x96ff2['error']['code']===0x1f4){logger[_0x8626('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x4ab035,_0x96ff2['error'][_0x8626('0x13')]);return _0x2eba77(_0x96ff2[_0x8626('0x12')][_0x8626('0x13')]);}logger[_0x8626('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x4ab035,_0x96ff2[_0x8626('0x12')]['message']);return _0x27c779(_0x96ff2['error']['message']);}else{logger['info'](_0x8626('0x14'),_0x4ab035,_0x8626('0xe'));_0x27c779(_0x96ff2[_0x8626('0x15')][_0x8626('0x13')]);}})[_0x8626('0x16')](function(_0x41567b){logger['error'](_0x8626('0x14'),_0x4ab035,_0x41567b);_0x2eba77(_0x41567b);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 92e26a5..c0af9db 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 _0x3641=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','util','express','Router'];(function(_0xb6cde3,_0x39a157){var _0x54cee9=function(_0x3dd8b5){while(--_0x3dd8b5){_0xb6cde3['push'](_0xb6cde3['shift']());}};_0x54cee9(++_0x39a157);}(_0x3641,0x173));var _0x1364=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3641[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x1364('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1364('0x1'));var router=express[_0x1364('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1364('0x3'));var interaction=require(_0x1364('0x4'));var config=require(_0x1364('0x5'));var controller=require('./analyticMetric.controller');router[_0x1364('0x6')]('/',auth['isAuthenticated'](),controller[_0x1364('0x7')]);router[_0x1364('0x6')](_0x1364('0x8'),auth['isAuthenticated'](),controller[_0x1364('0x9')]);router[_0x1364('0xa')]('/',auth[_0x1364('0xb')](),controller[_0x1364('0xc')]);router[_0x1364('0xd')](_0x1364('0x8'),auth[_0x1364('0xb')](),controller[_0x1364('0xe')]);router[_0x1364('0xf')](_0x1364('0x8'),auth[_0x1364('0xb')](),controller[_0x1364('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3cd8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x1c100b,_0x5e17a0){var _0x2417fe=function(_0x4f5756){while(--_0x4f5756){_0x1c100b['push'](_0x1c100b['shift']());}};_0x2417fe(++_0x5e17a0);}(_0x3cd8,0x150));var _0x83cd=function(_0x40015a,_0x415db5){_0x40015a=_0x40015a-0x0;var _0x42f8a4=_0x3cd8[_0x40015a];return _0x42f8a4;};'use strict';var multer=require(_0x83cd('0x0'));var util=require(_0x83cd('0x1'));var path=require(_0x83cd('0x2'));var timeout=require(_0x83cd('0x3'));var express=require(_0x83cd('0x4'));var router=express[_0x83cd('0x5')]();var fs_extra=require(_0x83cd('0x6'));var auth=require(_0x83cd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x83cd('0x8'));var controller=require(_0x83cd('0x9'));router[_0x83cd('0xa')]('/',auth[_0x83cd('0xb')](),controller[_0x83cd('0xc')]);router[_0x83cd('0xa')](_0x83cd('0xd'),auth[_0x83cd('0xb')](),controller[_0x83cd('0xe')]);router[_0x83cd('0xf')]('/',auth[_0x83cd('0xb')](),controller[_0x83cd('0x10')]);router[_0x83cd('0x11')](_0x83cd('0xd'),auth[_0x83cd('0xb')](),controller[_0x83cd('0x12')]);router[_0x83cd('0x13')](_0x83cd('0xd'),auth[_0x83cd('0xb')](),controller[_0x83cd('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 40d4892..effa97c 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 _0x8121=['TEXT','sequelize','exports'];(function(_0x2042f4,_0x2769b6){var _0x631749=function(_0x57f715){while(--_0x57f715){_0x2042f4['push'](_0x2042f4['shift']());}};_0x631749(++_0x2769b6);}(_0x8121,0xeb));var _0x1812=function(_0x302786,_0x459a42){_0x302786=_0x302786-0x0;var _0x55d41f=_0x8121[_0x302786];return _0x55d41f;};'use strict';var Sequelize=require(_0x1812('0x0'));module[_0x1812('0x1')]={'tree':{'type':Sequelize[_0x1812('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdc78=['exports','TEXT','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdc78,0x1ca));var _0x8dc7=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xdc78[_0x590a38];return _0xf36626;};'use strict';var Sequelize=require(_0x8dc7('0x0'));module[_0x8dc7('0x1')]={'tree':{'type':Sequelize[_0x8dc7('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 2ffddb7..01303e3 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 _0xcf1d=['map','rawAttributes','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','rows','catch','params','fields','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','end','error','name','send','index'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0xcf1d,0x18f));var _0xdcf1=function(_0x56e5dc,_0x481c8c){_0x56e5dc=_0x56e5dc-0x0;var _0x3b39a5=_0xcf1d[_0x56e5dc];return _0x3b39a5;};'use strict';var emlformat=require(_0xdcf1('0x0'));var rimraf=require(_0xdcf1('0x1'));var zipdir=require(_0xdcf1('0x2'));var jsonpatch=require(_0xdcf1('0x3'));var rp=require(_0xdcf1('0x4'));var moment=require(_0xdcf1('0x5'));var BPromise=require(_0xdcf1('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdcf1('0x7'));var sox=require(_0xdcf1('0x8'));var csv=require('to-csv');var ejs=require(_0xdcf1('0x9'));var fs=require('fs');var fs_extra=require(_0xdcf1('0xa'));var _=require(_0xdcf1('0xb'));var squel=require(_0xdcf1('0xc'));var crypto=require(_0xdcf1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdcf1('0xe'));var querystring=require(_0xdcf1('0xf'));var Papa=require(_0xdcf1('0x10'));var Redis=require(_0xdcf1('0x11'));var authService=require(_0xdcf1('0x12'));var qs=require(_0xdcf1('0x13'));var as=require(_0xdcf1('0x14'));var hardwareService=require(_0xdcf1('0x15'));var logger=require(_0xdcf1('0x16'))(_0xdcf1('0x17'));var utils=require(_0xdcf1('0x18'));var config=require(_0xdcf1('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcf1('0x1a'))['db'];function respondWithStatusCode(_0x17b630,_0xf32dc5){_0xf32dc5=_0xf32dc5||0xcc;return function(_0x307cc1){if(_0x307cc1){return _0x17b630[_0xdcf1('0x1b')](_0xf32dc5);}return _0x17b630[_0xdcf1('0x1c')](_0xf32dc5)['end']();};}function respondWithResult(_0x24529d,_0x493e0e){_0x493e0e=_0x493e0e||0xc8;return function(_0xa556b2){if(_0xa556b2){return _0x24529d['status'](_0x493e0e)['json'](_0xa556b2);}};}function respondWithFilteredResult(_0x2cca54,_0x3b4322){return function(_0x52cb9f){if(_0x52cb9f){var _0x5284d0=typeof _0x3b4322[_0xdcf1('0x1d')]===_0xdcf1('0x1e')&&typeof _0x3b4322[_0xdcf1('0x1f')]===_0xdcf1('0x1e');var _0x40bd27=_0x52cb9f[_0xdcf1('0x20')];var _0x280873=_0x5284d0?0x0:_0x3b4322['offset'];var _0x1543b4=_0x5284d0?_0x52cb9f[_0xdcf1('0x20')]:_0x3b4322[_0xdcf1('0x1d')]+_0x3b4322[_0xdcf1('0x1f')];var _0x375220;if(_0x1543b4>=_0x40bd27){_0x1543b4=_0x40bd27;_0x375220=0xc8;}else{_0x375220=0xce;}_0x2cca54[_0xdcf1('0x1c')](_0x375220);return _0x2cca54[_0xdcf1('0x21')](_0xdcf1('0x22'),_0x280873+'-'+_0x1543b4+'/'+_0x40bd27)[_0xdcf1('0x23')](_0x52cb9f);}return null;};}function patchUpdates(_0x9bfd1c){return function(_0x134099){try{jsonpatch[_0xdcf1('0x24')](_0x134099,_0x9bfd1c,!![]);}catch(_0x3a3427){return BPromise[_0xdcf1('0x25')](_0x3a3427);}return _0x134099[_0xdcf1('0x26')]();};}function saveUpdates(_0x17411e,_0x47f8a8){return function(_0x10424c){if(_0x10424c){return _0x10424c['update'](_0x17411e)[_0xdcf1('0x27')](function(_0xc54574){return _0xc54574;});}return null;};}function removeEntity(_0x30f7d2,_0x193442){return function(_0x1c45e6){if(_0x1c45e6){return _0x1c45e6['destroy']()[_0xdcf1('0x27')](function(){_0x30f7d2[_0xdcf1('0x1c')](0xcc)[_0xdcf1('0x28')]();});}};}function handleEntityNotFound(_0xba8d4b,_0x510911){return function(_0x3b632c){if(!_0x3b632c){_0xba8d4b[_0xdcf1('0x1b')](0x194);}return _0x3b632c;};}function handleError(_0x875a4f,_0x4cb54b){_0x4cb54b=_0x4cb54b||0x1f4;return function(_0xe0970){logger[_0xdcf1('0x29')](_0xe0970['stack']);if(_0xe0970[_0xdcf1('0x2a')]){delete _0xe0970['name'];}_0x875a4f[_0xdcf1('0x1c')](_0x4cb54b)[_0xdcf1('0x2b')](_0xe0970);};}exports[_0xdcf1('0x2c')]=function(_0x103114,_0x2ce686){var _0x20d419={},_0x459656={},_0x1d9b48={'count':0x0,'rows':[]};var _0x42be89=_[_0xdcf1('0x2d')](db['AnalyticTreeReport'][_0xdcf1('0x2e')],function(_0x583239){return{'name':_0x583239['fieldName'],'type':_0x583239[_0xdcf1('0x2f')][_0xdcf1('0x30')]};});_0x459656[_0xdcf1('0x31')]=_[_0xdcf1('0x2d')](_0x42be89,_0xdcf1('0x2a'));_0x459656[_0xdcf1('0x32')]=_[_0xdcf1('0x33')](_0x103114[_0xdcf1('0x32')]);_0x459656['filters']=_['intersection'](_0x459656[_0xdcf1('0x31')],_0x459656[_0xdcf1('0x32')]);_0x20d419[_0xdcf1('0x34')]=_[_0xdcf1('0x35')](_0x459656[_0xdcf1('0x31')],qs['fields'](_0x103114[_0xdcf1('0x32')]['fields']));_0x20d419[_0xdcf1('0x34')]=_0x20d419[_0xdcf1('0x34')][_0xdcf1('0x36')]?_0x20d419[_0xdcf1('0x34')]:_0x459656[_0xdcf1('0x31')];if(!_0x103114[_0xdcf1('0x32')][_0xdcf1('0x37')]('nolimit')){_0x20d419[_0xdcf1('0x1f')]=qs[_0xdcf1('0x1f')](_0x103114[_0xdcf1('0x32')]['limit']);_0x20d419[_0xdcf1('0x1d')]=qs[_0xdcf1('0x1d')](_0x103114[_0xdcf1('0x32')][_0xdcf1('0x1d')]);}_0x20d419['order']=qs[_0xdcf1('0x38')](_0x103114[_0xdcf1('0x32')][_0xdcf1('0x38')]);_0x20d419[_0xdcf1('0x39')]=qs[_0xdcf1('0x3a')](_['pick'](_0x103114[_0xdcf1('0x32')],_0x459656['filters']),_0x42be89);if(_0x103114[_0xdcf1('0x32')][_0xdcf1('0x3b')]){_0x20d419[_0xdcf1('0x39')]=_[_0xdcf1('0x3c')](_0x20d419['where'],{'$or':_[_0xdcf1('0x2d')](_0x42be89,function(_0x3fa7e7){if(_0x3fa7e7['type']!==_0xdcf1('0x3d')){var _0x3955b2={};_0x3955b2[_0x3fa7e7[_0xdcf1('0x2a')]]={'$like':'%'+_0x103114[_0xdcf1('0x32')][_0xdcf1('0x3b')]+'%'};return _0x3955b2;}})});}_0x20d419=_[_0xdcf1('0x3c')]({},_0x20d419,_0x103114[_0xdcf1('0x3e')]);var _0x4f29e5={'where':_0x20d419['where']};return db[_0xdcf1('0x3f')][_0xdcf1('0x20')](_0x4f29e5)[_0xdcf1('0x27')](function(_0x45fe65){_0x1d9b48['count']=_0x45fe65;if(_0x103114[_0xdcf1('0x32')][_0xdcf1('0x40')]){_0x20d419[_0xdcf1('0x41')]=[{'all':!![]}];}return db[_0xdcf1('0x3f')]['findAll'](_0x20d419);})['then'](function(_0x447aa0){_0x1d9b48[_0xdcf1('0x42')]=_0x447aa0;return _0x1d9b48;})[_0xdcf1('0x27')](respondWithFilteredResult(_0x2ce686,_0x20d419))[_0xdcf1('0x43')](handleError(_0x2ce686,null));};exports['show']=function(_0x2b1865,_0x19941f){var _0x4eaace={'raw':!![],'where':{'id':_0x2b1865[_0xdcf1('0x44')]['id']}},_0x2886e4={};_0x2886e4[_0xdcf1('0x31')]=_[_0xdcf1('0x33')](db[_0xdcf1('0x3f')][_0xdcf1('0x2e')]);_0x2886e4[_0xdcf1('0x32')]=_[_0xdcf1('0x33')](_0x2b1865[_0xdcf1('0x32')]);_0x2886e4[_0xdcf1('0x3a')]=_[_0xdcf1('0x35')](_0x2886e4['model'],_0x2886e4[_0xdcf1('0x32')]);_0x4eaace[_0xdcf1('0x34')]=_[_0xdcf1('0x35')](_0x2886e4[_0xdcf1('0x31')],qs[_0xdcf1('0x45')](_0x2b1865['query'][_0xdcf1('0x45')]));_0x4eaace[_0xdcf1('0x34')]=_0x4eaace[_0xdcf1('0x34')][_0xdcf1('0x36')]?_0x4eaace[_0xdcf1('0x34')]:_0x2886e4[_0xdcf1('0x31')];if(_0x2b1865[_0xdcf1('0x32')][_0xdcf1('0x40')]){_0x4eaace[_0xdcf1('0x41')]=[{'all':!![]}];}_0x4eaace=_[_0xdcf1('0x3c')]({},_0x4eaace,_0x2b1865[_0xdcf1('0x3e')]);return db['AnalyticTreeReport'][_0xdcf1('0x46')](_0x4eaace)[_0xdcf1('0x27')](handleEntityNotFound(_0x19941f,null))[_0xdcf1('0x27')](respondWithResult(_0x19941f,null))[_0xdcf1('0x43')](handleError(_0x19941f,null));};exports[_0xdcf1('0x47')]=function(_0x22bf0c,_0x419226){return db['AnalyticTreeReport'][_0xdcf1('0x47')](_0x22bf0c[_0xdcf1('0x48')],{})[_0xdcf1('0x27')](respondWithResult(_0x419226,0xc9))[_0xdcf1('0x43')](handleError(_0x419226,null));};exports['update']=function(_0x34e261,_0x2f9a01){if(_0x34e261[_0xdcf1('0x48')]['id']){delete _0x34e261[_0xdcf1('0x48')]['id'];}return db[_0xdcf1('0x3f')][_0xdcf1('0x46')]({'where':{'id':_0x34e261['params']['id']}})[_0xdcf1('0x27')](handleEntityNotFound(_0x2f9a01,null))['then'](saveUpdates(_0x34e261[_0xdcf1('0x48')],null))[_0xdcf1('0x27')](respondWithResult(_0x2f9a01,null))[_0xdcf1('0x43')](handleError(_0x2f9a01,null));};exports[_0xdcf1('0x49')]=function(_0x5c6e21,_0x348072){return db[_0xdcf1('0x3f')][_0xdcf1('0x46')]({'where':{'id':_0x5c6e21['params']['id']}})[_0xdcf1('0x27')](handleEntityNotFound(_0x348072,null))[_0xdcf1('0x27')](removeEntity(_0x348072,null))[_0xdcf1('0x43')](handleError(_0x348072,null));}; \ No newline at end of file +var _0x8363=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','include','find','create','body','params','destroy','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','AnalyticTreeReport','rawAttributes','type','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8363,0x9b));var _0x3836=function(_0x524ae5,_0x390c06){_0x524ae5=_0x524ae5-0x0;var _0x4d3065=_0x8363[_0x524ae5];return _0x4d3065;};'use strict';var emlformat=require(_0x3836('0x0'));var rimraf=require(_0x3836('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3836('0x2'));var moment=require(_0x3836('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3836('0x4'));var util=require(_0x3836('0x5'));var path=require(_0x3836('0x6'));var sox=require(_0x3836('0x7'));var csv=require(_0x3836('0x8'));var ejs=require(_0x3836('0x9'));var fs=require('fs');var fs_extra=require(_0x3836('0xa'));var _=require('lodash');var squel=require(_0x3836('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3836('0xc'));var Papa=require(_0x3836('0xd'));var Redis=require(_0x3836('0xe'));var authService=require(_0x3836('0xf'));var qs=require(_0x3836('0x10'));var as=require(_0x3836('0x11'));var hardwareService=require(_0x3836('0x12'));var logger=require('../../config/logger')(_0x3836('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3836('0x14'));var db=require(_0x3836('0x15'))['db'];function respondWithStatusCode(_0x5f3b31,_0x2e6e84){_0x2e6e84=_0x2e6e84||0xcc;return function(_0x2471b7){if(_0x2471b7){return _0x5f3b31[_0x3836('0x16')](_0x2e6e84);}return _0x5f3b31[_0x3836('0x17')](_0x2e6e84)[_0x3836('0x18')]();};}function respondWithResult(_0x172486,_0x307b7d){_0x307b7d=_0x307b7d||0xc8;return function(_0x51ba83){if(_0x51ba83){return _0x172486['status'](_0x307b7d)['json'](_0x51ba83);}};}function respondWithFilteredResult(_0x48282f,_0x32037a){return function(_0x5f3bfc){if(_0x5f3bfc){var _0xd8e0e5=typeof _0x32037a[_0x3836('0x19')]===_0x3836('0x1a')&&typeof _0x32037a[_0x3836('0x1b')]===_0x3836('0x1a');var _0x5002a2=_0x5f3bfc[_0x3836('0x1c')];var _0x4613f1=_0xd8e0e5?0x0:_0x32037a[_0x3836('0x19')];var _0x5643e7=_0xd8e0e5?_0x5f3bfc[_0x3836('0x1c')]:_0x32037a[_0x3836('0x19')]+_0x32037a[_0x3836('0x1b')];var _0x43bbe9;if(_0x5643e7>=_0x5002a2){_0x5643e7=_0x5002a2;_0x43bbe9=0xc8;}else{_0x43bbe9=0xce;}_0x48282f['status'](_0x43bbe9);return _0x48282f[_0x3836('0x1d')]('Content-Range',_0x4613f1+'-'+_0x5643e7+'/'+_0x5002a2)['json'](_0x5f3bfc);}return null;};}function patchUpdates(_0x371a5a){return function(_0x330564){try{jsonpatch[_0x3836('0x1e')](_0x330564,_0x371a5a,!![]);}catch(_0x5901ff){return BPromise[_0x3836('0x1f')](_0x5901ff);}return _0x330564[_0x3836('0x20')]();};}function saveUpdates(_0x3d9aa9,_0x384331){return function(_0x17299e){if(_0x17299e){return _0x17299e[_0x3836('0x21')](_0x3d9aa9)[_0x3836('0x22')](function(_0x204757){return _0x204757;});}return null;};}function removeEntity(_0x5daf69,_0x5ef26f){return function(_0x1654f2){if(_0x1654f2){return _0x1654f2['destroy']()['then'](function(){_0x5daf69[_0x3836('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4697ba,_0x40d2ff){return function(_0x15d8c7){if(!_0x15d8c7){_0x4697ba[_0x3836('0x16')](0x194);}return _0x15d8c7;};}function handleError(_0x444a80,_0x3acfde){_0x3acfde=_0x3acfde||0x1f4;return function(_0x11080f){logger[_0x3836('0x23')](_0x11080f[_0x3836('0x24')]);if(_0x11080f[_0x3836('0x25')]){delete _0x11080f[_0x3836('0x25')];}_0x444a80[_0x3836('0x17')](_0x3acfde)[_0x3836('0x26')](_0x11080f);};}exports['index']=function(_0x473d4b,_0x1b1332){var _0x1fa1d9={},_0x1ff0ae={},_0xb511e3={'count':0x0,'rows':[]};var _0x26cb43=_['map'](db[_0x3836('0x27')][_0x3836('0x28')],function(_0x1c912f){return{'name':_0x1c912f['fieldName'],'type':_0x1c912f[_0x3836('0x29')]['key']};});_0x1ff0ae['model']=_[_0x3836('0x2a')](_0x26cb43,_0x3836('0x25'));_0x1ff0ae[_0x3836('0x2b')]=_[_0x3836('0x2c')](_0x473d4b[_0x3836('0x2b')]);_0x1ff0ae[_0x3836('0x2d')]=_[_0x3836('0x2e')](_0x1ff0ae[_0x3836('0x2f')],_0x1ff0ae[_0x3836('0x2b')]);_0x1fa1d9['attributes']=_['intersection'](_0x1ff0ae[_0x3836('0x2f')],qs[_0x3836('0x30')](_0x473d4b['query']['fields']));_0x1fa1d9['attributes']=_0x1fa1d9[_0x3836('0x31')][_0x3836('0x32')]?_0x1fa1d9[_0x3836('0x31')]:_0x1ff0ae[_0x3836('0x2f')];if(!_0x473d4b['query']['hasOwnProperty'](_0x3836('0x33'))){_0x1fa1d9['limit']=qs[_0x3836('0x1b')](_0x473d4b[_0x3836('0x2b')]['limit']);_0x1fa1d9[_0x3836('0x19')]=qs['offset'](_0x473d4b[_0x3836('0x2b')][_0x3836('0x19')]);}_0x1fa1d9[_0x3836('0x34')]=qs[_0x3836('0x35')](_0x473d4b['query'][_0x3836('0x35')]);_0x1fa1d9[_0x3836('0x36')]=qs['filters'](_[_0x3836('0x37')](_0x473d4b['query'],_0x1ff0ae[_0x3836('0x2d')]),_0x26cb43);if(_0x473d4b['query'][_0x3836('0x38')]){_0x1fa1d9[_0x3836('0x36')]=_[_0x3836('0x39')](_0x1fa1d9[_0x3836('0x36')],{'$or':_[_0x3836('0x2a')](_0x26cb43,function(_0x246490){if(_0x246490['type']!==_0x3836('0x3a')){var _0x2413d5={};_0x2413d5[_0x246490[_0x3836('0x25')]]={'$like':'%'+_0x473d4b[_0x3836('0x2b')]['filter']+'%'};return _0x2413d5;}})});}_0x1fa1d9=_[_0x3836('0x39')]({},_0x1fa1d9,_0x473d4b[_0x3836('0x3b')]);var _0xae46a1={'where':_0x1fa1d9[_0x3836('0x36')]};return db['AnalyticTreeReport'][_0x3836('0x1c')](_0xae46a1)['then'](function(_0x3f93f6){_0xb511e3[_0x3836('0x1c')]=_0x3f93f6;if(_0x473d4b[_0x3836('0x2b')][_0x3836('0x3c')]){_0x1fa1d9['include']=[{'all':!![]}];}return db[_0x3836('0x27')][_0x3836('0x3d')](_0x1fa1d9);})['then'](function(_0x569be9){_0xb511e3['rows']=_0x569be9;return _0xb511e3;})[_0x3836('0x22')](respondWithFilteredResult(_0x1b1332,_0x1fa1d9))[_0x3836('0x3e')](handleError(_0x1b1332,null));};exports['show']=function(_0x1cef4c,_0xa331c8){var _0x5e2961={'raw':!![],'where':{'id':_0x1cef4c['params']['id']}},_0x3ce0f0={};_0x3ce0f0[_0x3836('0x2f')]=_['keys'](db[_0x3836('0x27')][_0x3836('0x28')]);_0x3ce0f0[_0x3836('0x2b')]=_['keys'](_0x1cef4c[_0x3836('0x2b')]);_0x3ce0f0[_0x3836('0x2d')]=_[_0x3836('0x2e')](_0x3ce0f0[_0x3836('0x2f')],_0x3ce0f0['query']);_0x5e2961[_0x3836('0x31')]=_['intersection'](_0x3ce0f0[_0x3836('0x2f')],qs[_0x3836('0x30')](_0x1cef4c[_0x3836('0x2b')][_0x3836('0x30')]));_0x5e2961[_0x3836('0x31')]=_0x5e2961[_0x3836('0x31')][_0x3836('0x32')]?_0x5e2961[_0x3836('0x31')]:_0x3ce0f0['model'];if(_0x1cef4c[_0x3836('0x2b')][_0x3836('0x3c')]){_0x5e2961[_0x3836('0x3f')]=[{'all':!![]}];}_0x5e2961=_['merge']({},_0x5e2961,_0x1cef4c[_0x3836('0x3b')]);return db[_0x3836('0x27')][_0x3836('0x40')](_0x5e2961)[_0x3836('0x22')](handleEntityNotFound(_0xa331c8,null))[_0x3836('0x22')](respondWithResult(_0xa331c8,null))[_0x3836('0x3e')](handleError(_0xa331c8,null));};exports[_0x3836('0x41')]=function(_0xdc611c,_0x28411a){return db[_0x3836('0x27')][_0x3836('0x41')](_0xdc611c[_0x3836('0x42')],{})[_0x3836('0x22')](respondWithResult(_0x28411a,0xc9))[_0x3836('0x3e')](handleError(_0x28411a,null));};exports[_0x3836('0x21')]=function(_0x12c8f1,_0x52c89a){if(_0x12c8f1[_0x3836('0x42')]['id']){delete _0x12c8f1[_0x3836('0x42')]['id'];}return db[_0x3836('0x27')]['find']({'where':{'id':_0x12c8f1[_0x3836('0x43')]['id']}})[_0x3836('0x22')](handleEntityNotFound(_0x52c89a,null))['then'](saveUpdates(_0x12c8f1['body'],null))[_0x3836('0x22')](respondWithResult(_0x52c89a,null))[_0x3836('0x3e')](handleError(_0x52c89a,null));};exports[_0x3836('0x44')]=function(_0x32904b,_0x40c269){return db[_0x3836('0x27')][_0x3836('0x40')]({'where':{'id':_0x32904b[_0x3836('0x43')]['id']}})['then'](handleEntityNotFound(_0x40c269,null))[_0x3836('0x22')](removeEntity(_0x40c269,null))['catch'](handleError(_0x40c269,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e97f249..e90ab28 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 _0x194c=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util','../../config/logger','api','moment'];(function(_0x33a167,_0x4f58d2){var _0xfa52e3=function(_0x3b3212){while(--_0x3b3212){_0x33a167['push'](_0x33a167['shift']());}};_0xfa52e3(++_0x4f58d2);}(_0x194c,0x14b));var _0xc194=function(_0x26d170,_0x196c4e){_0x26d170=_0x26d170-0x0;var _0x1a851f=_0x194c[_0x26d170];return _0x1a851f;};'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(_0xc194('0x7'));var rimraf=require(_0xc194('0x8'));var config=require(_0xc194('0x9'));var attributes=require(_0xc194('0xa'));module[_0xc194('0xb')]=function(_0x48680b,_0x5386a2){return _0x48680b[_0xc194('0xc')](_0xc194('0xd'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc496=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','define','util'];(function(_0x49648b,_0x1c5d3d){var _0x299231=function(_0x4aba30){while(--_0x4aba30){_0x49648b['push'](_0x49648b['shift']());}};_0x299231(++_0x1c5d3d);}(_0xc496,0xdb));var _0x6c49=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0xc496[_0x4c80d7];return _0x3c5095;};'use strict';var _=require('lodash');var util=require(_0x6c49('0x0'));var logger=require(_0x6c49('0x1'))(_0x6c49('0x2'));var moment=require(_0x6c49('0x3'));var BPromise=require(_0x6c49('0x4'));var rp=require(_0x6c49('0x5'));var fs=require('fs');var path=require(_0x6c49('0x6'));var rimraf=require(_0x6c49('0x7'));var config=require('../../config/environment');var attributes=require(_0x6c49('0x8'));module[_0x6c49('0x9')]=function(_0x2bfa3b,_0x562a6c){return _0x2bfa3b[_0x6c49('0xa')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 4408ebe..65066f7 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\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(_0x2699e8,_0x3069fb){var _0x10324e=function(_0x46039c){while(--_0x46039c){_0x2699e8['push'](_0x2699e8['shift']());}};_0x10324e(++_0x3069fb);}(_0x1261,0x144));var _0x1126=function(_0x283c87,_0x545688){_0x283c87=_0x283c87-0x0;var _0xde4143=_0x1261[_0x283c87];return _0xde4143;};'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')]('AnalyticTreeReport,\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 +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x535acc,_0x3f46d2){var _0xc506ae=function(_0xf003ac){while(--_0xf003ac){_0x535acc['push'](_0x535acc['shift']());}};_0xc506ae(++_0x3f46d2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index ab53e21..a4ad00a 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 _0xfcf1=['../../config/environment','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x41352f,_0x3ee601){var _0x240475=function(_0x54b397){while(--_0x54b397){_0x41352f['push'](_0x41352f['shift']());}};_0x240475(++_0x3ee601);}(_0xfcf1,0x82));var _0x1fcf=function(_0x3d118a,_0xc2c0d7){_0x3d118a=_0x3d118a-0x0;var _0xbdfbf3=_0xfcf1[_0x3d118a];return _0xbdfbf3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1fcf('0x0'));var express=require(_0x1fcf('0x1'));var router=express[_0x1fcf('0x2')]();var fs_extra=require(_0x1fcf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1fcf('0x4'));var config=require(_0x1fcf('0x5'));var controller=require('./analyticTreeReport.controller');router[_0x1fcf('0x6')]('/',auth[_0x1fcf('0x7')](),controller[_0x1fcf('0x8')]);router[_0x1fcf('0x6')](_0x1fcf('0x9'),auth['isAuthenticated'](),controller[_0x1fcf('0xa')]);router['post']('/',auth[_0x1fcf('0x7')](),controller['create']);router[_0x1fcf('0xb')](_0x1fcf('0x9'),auth[_0x1fcf('0x7')](),controller[_0x1fcf('0xc')]);router[_0x1fcf('0xd')](_0x1fcf('0x9'),auth[_0x1fcf('0x7')](),controller[_0x1fcf('0xe')]);module['exports']=router; \ No newline at end of file +var _0xfa90=['post','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x364f3d,_0x32d81d){var _0x248c05=function(_0x1c63db){while(--_0x1c63db){_0x364f3d['push'](_0x364f3d['shift']());}};_0x248c05(++_0x32d81d);}(_0xfa90,0x196));var _0x0fa9=function(_0x56d4cb,_0x4759c1){_0x56d4cb=_0x56d4cb-0x0;var _0x724ce0=_0xfa90[_0x56d4cb];return _0x724ce0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0fa9('0x0'));var timeout=require(_0x0fa9('0x1'));var express=require(_0x0fa9('0x2'));var router=express[_0x0fa9('0x3')]();var fs_extra=require(_0x0fa9('0x4'));var auth=require(_0x0fa9('0x5'));var interaction=require(_0x0fa9('0x6'));var config=require(_0x0fa9('0x7'));var controller=require(_0x0fa9('0x8'));router[_0x0fa9('0x9')]('/',auth[_0x0fa9('0xa')](),controller[_0x0fa9('0xb')]);router[_0x0fa9('0x9')](_0x0fa9('0xc'),auth['isAuthenticated'](),controller[_0x0fa9('0xd')]);router[_0x0fa9('0xe')]('/',auth[_0x0fa9('0xa')](),controller[_0x0fa9('0xf')]);router[_0x0fa9('0x10')](_0x0fa9('0xc'),auth[_0x0fa9('0xa')](),controller[_0x0fa9('0x11')]);router[_0x0fa9('0x12')](_0x0fa9('0xc'),auth[_0x0fa9('0xa')](),controller['destroy']);module[_0x0fa9('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index c0c1ab1..c0ea3e4 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 _0x3299=['exports','STRING'];(function(_0x57c88c,_0x4863a2){var _0x5a053e=function(_0xdf131a){while(--_0xdf131a){_0x57c88c['push'](_0x57c88c['shift']());}};_0x5a053e(++_0x4863a2);}(_0x3299,0x1bc));var _0x9329=function(_0x3414f9,_0x5903fd){_0x3414f9=_0x3414f9-0x0;var _0x1b7e95=_0x3299[_0x3414f9];return _0x1b7e95;};'use strict';var Sequelize=require('sequelize');module[_0x9329('0x0')]={'name':{'type':Sequelize[_0x9329('0x1')]},'basename':{'type':Sequelize[_0x9329('0x1')]},'type':{'type':Sequelize[_0x9329('0x1')]}}; \ No newline at end of file +var _0x7868=['sequelize','STRING'];(function(_0x1768d0,_0x56a46e){var _0x368058=function(_0x150276){while(--_0x150276){_0x1768d0['push'](_0x1768d0['shift']());}};_0x368058(++_0x56a46e);}(_0x7868,0x1c0));var _0x8786=function(_0x896db1,_0x2a0ff9){_0x896db1=_0x896db1-0x0;var _0xc1adb6=_0x7868[_0x896db1];return _0xc1adb6;};'use strict';var Sequelize=require(_0x8786('0x0'));module['exports']={'name':{'type':Sequelize[_0x8786('0x1')]},'basename':{'type':Sequelize[_0x8786('0x1')]},'type':{'type':Sequelize[_0x8786('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 186e3fc..2bbe63b 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 _0x8c49=['status','end','offset','undefined','limit','count','set','json','apply','reject','save','destroy','then','error','stack','name','index','map','Attachment','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','clone','params','get','updatedAt','body','createdAt','create','update','file','originalname','basename','filename','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3f271b,_0x647c39){var _0x45519e=function(_0x52354a){while(--_0x52354a){_0x3f271b['push'](_0x3f271b['shift']());}};_0x45519e(++_0x647c39);}(_0x8c49,0x1a3));var _0x98c4=function(_0x254842,_0x159c1f){_0x254842=_0x254842-0x0;var _0x364fad=_0x8c49[_0x254842];return _0x364fad;};'use strict';var emlformat=require(_0x98c4('0x0'));var rimraf=require(_0x98c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x98c4('0x2'));var moment=require(_0x98c4('0x3'));var BPromise=require(_0x98c4('0x4'));var Mustache=require(_0x98c4('0x5'));var util=require(_0x98c4('0x6'));var path=require(_0x98c4('0x7'));var sox=require(_0x98c4('0x8'));var csv=require(_0x98c4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98c4('0xa'));var _=require(_0x98c4('0xb'));var squel=require(_0x98c4('0xc'));var crypto=require(_0x98c4('0xd'));var jsforce=require(_0x98c4('0xe'));var deskjs=require(_0x98c4('0xf'));var toCsv=require(_0x98c4('0x9'));var querystring=require('querystring');var Papa=require(_0x98c4('0x10'));var Redis=require(_0x98c4('0x11'));var authService=require(_0x98c4('0x12'));var qs=require(_0x98c4('0x13'));var as=require(_0x98c4('0x14'));var hardwareService=require(_0x98c4('0x15'));var logger=require(_0x98c4('0x16'))('api');var utils=require(_0x98c4('0x17'));var config=require(_0x98c4('0x18'));var licenseUtil=require(_0x98c4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4eea15,_0x436b2e){_0x436b2e=_0x436b2e||0xcc;return function(_0x40aaee){if(_0x40aaee){return _0x4eea15['sendStatus'](_0x436b2e);}return _0x4eea15[_0x98c4('0x1a')](_0x436b2e)[_0x98c4('0x1b')]();};}function respondWithResult(_0x5a00ad,_0x40b4bc){_0x40b4bc=_0x40b4bc||0xc8;return function(_0x22796e){if(_0x22796e){return _0x5a00ad[_0x98c4('0x1a')](_0x40b4bc)['json'](_0x22796e);}};}function respondWithFilteredResult(_0x1fa951,_0x35c220){return function(_0x3e92ed){if(_0x3e92ed){var _0x2c2ca9=typeof _0x35c220[_0x98c4('0x1c')]===_0x98c4('0x1d')&&typeof _0x35c220[_0x98c4('0x1e')]==='undefined';var _0x2e6f6f=_0x3e92ed[_0x98c4('0x1f')];var _0x390046=_0x2c2ca9?0x0:_0x35c220['offset'];var _0x76e499=_0x2c2ca9?_0x3e92ed[_0x98c4('0x1f')]:_0x35c220[_0x98c4('0x1c')]+_0x35c220[_0x98c4('0x1e')];var _0x21b3dd;if(_0x76e499>=_0x2e6f6f){_0x76e499=_0x2e6f6f;_0x21b3dd=0xc8;}else{_0x21b3dd=0xce;}_0x1fa951[_0x98c4('0x1a')](_0x21b3dd);return _0x1fa951[_0x98c4('0x20')]('Content-Range',_0x390046+'-'+_0x76e499+'/'+_0x2e6f6f)[_0x98c4('0x21')](_0x3e92ed);}return null;};}function patchUpdates(_0x53540b){return function(_0x2a3c8c){try{jsonpatch[_0x98c4('0x22')](_0x2a3c8c,_0x53540b,!![]);}catch(_0x52a8eb){return BPromise[_0x98c4('0x23')](_0x52a8eb);}return _0x2a3c8c[_0x98c4('0x24')]();};}function saveUpdates(_0x41433f,_0x5a56c5){return function(_0x5ddf6c){if(_0x5ddf6c){return _0x5ddf6c['update'](_0x41433f)['then'](function(_0x46220a){return _0x46220a;});}return null;};}function removeEntity(_0x6967b0,_0x532024){return function(_0x3aa8a4){if(_0x3aa8a4){return _0x3aa8a4[_0x98c4('0x25')]()[_0x98c4('0x26')](function(){_0x6967b0[_0x98c4('0x1a')](0xcc)[_0x98c4('0x1b')]();});}};}function handleEntityNotFound(_0x3728c4,_0x205ed5){return function(_0x273720){if(!_0x273720){_0x3728c4['sendStatus'](0x194);}return _0x273720;};}function handleError(_0x376a7a,_0xaca3ad){_0xaca3ad=_0xaca3ad||0x1f4;return function(_0x3986a6){logger[_0x98c4('0x27')](_0x3986a6[_0x98c4('0x28')]);if(_0x3986a6[_0x98c4('0x29')]){delete _0x3986a6['name'];}_0x376a7a[_0x98c4('0x1a')](_0xaca3ad)['send'](_0x3986a6);};}exports[_0x98c4('0x2a')]=function(_0x174e65,_0x2632f9){var _0x3f4424={},_0x2dc05d={},_0x1b684e={'count':0x0,'rows':[]};var _0x50c81c=_[_0x98c4('0x2b')](db[_0x98c4('0x2c')]['rawAttributes'],function(_0x5717cd){return{'name':_0x5717cd['fieldName'],'type':_0x5717cd[_0x98c4('0x2d')][_0x98c4('0x2e')]};});_0x2dc05d[_0x98c4('0x2f')]=_['map'](_0x50c81c,_0x98c4('0x29'));_0x2dc05d[_0x98c4('0x30')]=_['keys'](_0x174e65[_0x98c4('0x30')]);_0x2dc05d[_0x98c4('0x31')]=_[_0x98c4('0x32')](_0x2dc05d[_0x98c4('0x2f')],_0x2dc05d[_0x98c4('0x30')]);_0x3f4424[_0x98c4('0x33')]=_['intersection'](_0x2dc05d['model'],qs[_0x98c4('0x34')](_0x174e65[_0x98c4('0x30')][_0x98c4('0x34')]));_0x3f4424[_0x98c4('0x33')]=_0x3f4424['attributes'][_0x98c4('0x35')]?_0x3f4424[_0x98c4('0x33')]:_0x2dc05d['model'];if(!_0x174e65[_0x98c4('0x30')][_0x98c4('0x36')](_0x98c4('0x37'))){_0x3f4424[_0x98c4('0x1e')]=qs[_0x98c4('0x1e')](_0x174e65[_0x98c4('0x30')][_0x98c4('0x1e')]);_0x3f4424[_0x98c4('0x1c')]=qs[_0x98c4('0x1c')](_0x174e65['query']['offset']);}_0x3f4424['order']=qs[_0x98c4('0x38')](_0x174e65[_0x98c4('0x30')][_0x98c4('0x38')]);_0x3f4424[_0x98c4('0x39')]=qs['filters'](_[_0x98c4('0x3a')](_0x174e65[_0x98c4('0x30')],_0x2dc05d[_0x98c4('0x31')]),_0x50c81c);if(_0x174e65['query'][_0x98c4('0x3b')]){_0x3f4424[_0x98c4('0x39')]=_[_0x98c4('0x3c')](_0x3f4424[_0x98c4('0x39')],{'$or':_['map'](_0x50c81c,function(_0x5ba2e7){if(_0x5ba2e7['type']!==_0x98c4('0x3d')){var _0x3c9568={};_0x3c9568[_0x5ba2e7[_0x98c4('0x29')]]={'$like':'%'+_0x174e65[_0x98c4('0x30')][_0x98c4('0x3b')]+'%'};return _0x3c9568;}})});}_0x3f4424=_[_0x98c4('0x3c')]({},_0x3f4424,_0x174e65[_0x98c4('0x3e')]);var _0x18afcc={'where':_0x3f4424[_0x98c4('0x39')]};return db['Attachment'][_0x98c4('0x1f')](_0x18afcc)['then'](function(_0x2df8fa){_0x1b684e[_0x98c4('0x1f')]=_0x2df8fa;if(_0x174e65[_0x98c4('0x30')][_0x98c4('0x3f')]){_0x3f4424[_0x98c4('0x40')]=[{'all':!![]}];}return db[_0x98c4('0x2c')]['findAll'](_0x3f4424);})[_0x98c4('0x26')](function(_0x3d94dc){_0x1b684e[_0x98c4('0x41')]=_0x3d94dc;return _0x1b684e;})['then'](respondWithFilteredResult(_0x2632f9,_0x3f4424))[_0x98c4('0x42')](handleError(_0x2632f9,null));};exports[_0x98c4('0x43')]=function(_0x114cd6,_0x4147a8){var _0x151827={'raw':!![],'where':{'id':_0x114cd6['params']['id']}},_0x123723={};_0x123723[_0x98c4('0x2f')]=_[_0x98c4('0x44')](db[_0x98c4('0x2c')]['rawAttributes']);_0x123723[_0x98c4('0x30')]=_[_0x98c4('0x44')](_0x114cd6[_0x98c4('0x30')]);_0x123723['filters']=_[_0x98c4('0x32')](_0x123723[_0x98c4('0x2f')],_0x123723[_0x98c4('0x30')]);_0x151827[_0x98c4('0x33')]=_['intersection'](_0x123723[_0x98c4('0x2f')],qs['fields'](_0x114cd6[_0x98c4('0x30')][_0x98c4('0x34')]));_0x151827[_0x98c4('0x33')]=_0x151827[_0x98c4('0x33')][_0x98c4('0x35')]?_0x151827['attributes']:_0x123723[_0x98c4('0x2f')];if(_0x114cd6[_0x98c4('0x30')][_0x98c4('0x3f')]){_0x151827['include']=[{'all':!![]}];}_0x151827=_['merge']({},_0x151827,_0x114cd6[_0x98c4('0x3e')]);return db[_0x98c4('0x2c')][_0x98c4('0x45')](_0x151827)['then'](handleEntityNotFound(_0x4147a8,null))[_0x98c4('0x26')](respondWithResult(_0x4147a8,null))[_0x98c4('0x42')](handleError(_0x4147a8,null));};exports[_0x98c4('0x46')]=function(_0x4bdf06,_0x3038e7){var _0x15e0b6={'where':{'id':_0x4bdf06[_0x98c4('0x47')]['id']}},_0x3961cb={};_0x3961cb['model']=_['keys'](db[_0x98c4('0x2c')]['rawAttributes']);_0x15e0b6[_0x98c4('0x33')]=_[_0x98c4('0x32')](_0x3961cb['model'],qs[_0x98c4('0x34')](_0x4bdf06['query'][_0x98c4('0x34')]));_0x15e0b6[_0x98c4('0x33')]=_0x15e0b6[_0x98c4('0x33')]['length']?_0x15e0b6['attributes']:_0x3961cb[_0x98c4('0x2f')];if(_0x4bdf06['query'][_0x98c4('0x3f')]){_0x15e0b6[_0x98c4('0x40')]=[{'all':!![]}];}_0x15e0b6=_['merge']({},_0x15e0b6,_0x4bdf06[_0x98c4('0x3e')]);return db[_0x98c4('0x2c')][_0x98c4('0x45')](_0x15e0b6)['then'](handleEntityNotFound(_0x3038e7,null))[_0x98c4('0x26')](function(_0x4e4329){if(_0x4e4329){var _0x92acc3=_0x4e4329[_0x98c4('0x48')]({'plain':!![]});_0x92acc3=qs['omit'](_0x92acc3,['id','createdAt',_0x98c4('0x49')]);_0x4bdf06[_0x98c4('0x4a')]=_['omit'](_0x4bdf06[_0x98c4('0x4a')],['id',_0x98c4('0x4b'),'updatedAt']);return db[_0x98c4('0x2c')][_0x98c4('0x4c')](_[_0x98c4('0x3c')](_0x92acc3,_0x4bdf06[_0x98c4('0x4a')]),{'include':_0x4bdf06[_0x98c4('0x30')][_0x98c4('0x3f')]?[{'all':!![]}]:undefined});}})[_0x98c4('0x26')](respondWithResult(_0x3038e7,0xc9))['catch'](handleError(_0x3038e7,null));};exports[_0x98c4('0x4d')]=function(_0x4a263e,_0x336063){if(_0x4a263e[_0x98c4('0x4a')]['id']){delete _0x4a263e['body']['id'];}return db['Attachment'][_0x98c4('0x45')]({'where':{'id':_0x4a263e['params']['id']}})[_0x98c4('0x26')](handleEntityNotFound(_0x336063,null))[_0x98c4('0x26')](saveUpdates(_0x4a263e[_0x98c4('0x4a')],null))['then'](respondWithResult(_0x336063,null))[_0x98c4('0x42')](handleError(_0x336063,null));};exports[_0x98c4('0x25')]=function(_0x20d916,_0x181f31){return db[_0x98c4('0x2c')][_0x98c4('0x45')]({'where':{'id':_0x20d916[_0x98c4('0x47')]['id']}})['then'](handleEntityNotFound(_0x181f31,null))[_0x98c4('0x26')](removeEntity(_0x181f31,null))['catch'](handleError(_0x181f31,null));};exports[_0x98c4('0x4c')]=function(_0x17daa6,_0x27ea82,_0x798a9a){_0x17daa6[_0x98c4('0x4a')][_0x98c4('0x29')]=_0x17daa6[_0x98c4('0x4e')][_0x98c4('0x4f')];_0x17daa6['body'][_0x98c4('0x50')]=_0x17daa6[_0x98c4('0x4e')][_0x98c4('0x51')];_0x17daa6[_0x98c4('0x4a')][_0x98c4('0x2d')]=_0x17daa6[_0x98c4('0x4e')]['mimetype'];return db['Attachment']['create'](_0x17daa6['body'])[_0x98c4('0x26')](respondWithResult(_0x27ea82,0xc9))[_0x98c4('0x42')](handleError(_0x27ea82,null));};exports[_0x98c4('0x52')]=function(_0xcefacb,_0x5c81c0,_0x1bc4e9){return db[_0x98c4('0x2c')][_0x98c4('0x53')]({'where':{'id':_0xcefacb[_0x98c4('0x47')]['id']},'raw':!![]})[_0x98c4('0x26')](handleEntityNotFound(_0x5c81c0,null))['then'](function(_0x5153dd){if(_0x5153dd){var _0x118bce=_0x5153dd[_0x98c4('0x54')]!==null;var _0x4199a2=path['join'](config[_0x98c4('0x55')],_0x98c4('0x56'));if(_0x118bce){_0x4199a2=path['join'](_0x4199a2,_0x98c4('0x57'));}var _0x5b0cb4=path[_0x98c4('0x58')](_0x4199a2,_0x5153dd['basename']);return _0x5c81c0[_0x98c4('0x52')](_0x5b0cb4);}})[_0x98c4('0x42')](handleError(_0x5c81c0,null));}; \ No newline at end of file +var _0x7afb=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','clone','omit','updatedAt','body','createdAt','create','destroy','file','originalname','basename','mimetype','download','findOne','ChatOfflineMessageId','root','join','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','Attachment','rawAttributes','type','query','keys','model','intersection','fields','attributes','length'];(function(_0xd775c9,_0x461a52){var _0x11f229=function(_0x40b28a){while(--_0x40b28a){_0xd775c9['push'](_0xd775c9['shift']());}};_0x11f229(++_0x461a52);}(_0x7afb,0x120));var _0xb7af=function(_0x13c4a0,_0x3a832a){_0x13c4a0=_0x13c4a0-0x0;var _0x107214=_0x7afb[_0x13c4a0];return _0x107214;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7af('0x0'));var zipdir=require(_0xb7af('0x1'));var jsonpatch=require(_0xb7af('0x2'));var rp=require(_0xb7af('0x3'));var moment=require(_0xb7af('0x4'));var BPromise=require(_0xb7af('0x5'));var Mustache=require('mustache');var util=require(_0xb7af('0x6'));var path=require(_0xb7af('0x7'));var sox=require(_0xb7af('0x8'));var csv=require(_0xb7af('0x9'));var ejs=require(_0xb7af('0xa'));var fs=require('fs');var fs_extra=require(_0xb7af('0xb'));var _=require(_0xb7af('0xc'));var squel=require(_0xb7af('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb7af('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb7af('0xf'));var Redis=require(_0xb7af('0x10'));var authService=require(_0xb7af('0x11'));var qs=require(_0xb7af('0x12'));var as=require(_0xb7af('0x13'));var hardwareService=require(_0xb7af('0x14'));var logger=require(_0xb7af('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xb7af('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb7af('0x17'))['db'];function respondWithStatusCode(_0x2804f5,_0x2aaf98){_0x2aaf98=_0x2aaf98||0xcc;return function(_0x4dc62e){if(_0x4dc62e){return _0x2804f5['sendStatus'](_0x2aaf98);}return _0x2804f5[_0xb7af('0x18')](_0x2aaf98)[_0xb7af('0x19')]();};}function respondWithResult(_0x68b73f,_0x4ab8dc){_0x4ab8dc=_0x4ab8dc||0xc8;return function(_0xf8c9b7){if(_0xf8c9b7){return _0x68b73f[_0xb7af('0x18')](_0x4ab8dc)[_0xb7af('0x1a')](_0xf8c9b7);}};}function respondWithFilteredResult(_0x411f58,_0x4df3e6){return function(_0x541a3e){if(_0x541a3e){var _0x580c72=typeof _0x4df3e6[_0xb7af('0x1b')]==='undefined'&&typeof _0x4df3e6['limit']==='undefined';var _0x59659c=_0x541a3e[_0xb7af('0x1c')];var _0x1c73b6=_0x580c72?0x0:_0x4df3e6[_0xb7af('0x1b')];var _0x315a21=_0x580c72?_0x541a3e[_0xb7af('0x1c')]:_0x4df3e6[_0xb7af('0x1b')]+_0x4df3e6[_0xb7af('0x1d')];var _0x164766;if(_0x315a21>=_0x59659c){_0x315a21=_0x59659c;_0x164766=0xc8;}else{_0x164766=0xce;}_0x411f58[_0xb7af('0x18')](_0x164766);return _0x411f58['set'](_0xb7af('0x1e'),_0x1c73b6+'-'+_0x315a21+'/'+_0x59659c)[_0xb7af('0x1a')](_0x541a3e);}return null;};}function patchUpdates(_0x12b4d4){return function(_0x4af3f2){try{jsonpatch[_0xb7af('0x1f')](_0x4af3f2,_0x12b4d4,!![]);}catch(_0x25e0f4){return BPromise[_0xb7af('0x20')](_0x25e0f4);}return _0x4af3f2[_0xb7af('0x21')]();};}function saveUpdates(_0x247191,_0x47a9f0){return function(_0x1424c6){if(_0x1424c6){return _0x1424c6[_0xb7af('0x22')](_0x247191)[_0xb7af('0x23')](function(_0xf44d27){return _0xf44d27;});}return null;};}function removeEntity(_0x146905,_0x379b8a){return function(_0x3557e7){if(_0x3557e7){return _0x3557e7['destroy']()[_0xb7af('0x23')](function(){_0x146905['status'](0xcc)[_0xb7af('0x19')]();});}};}function handleEntityNotFound(_0x83db82,_0x30d2a4){return function(_0xfc8357){if(!_0xfc8357){_0x83db82[_0xb7af('0x24')](0x194);}return _0xfc8357;};}function handleError(_0x82c4c0,_0x429955){_0x429955=_0x429955||0x1f4;return function(_0x6214e5){logger[_0xb7af('0x25')](_0x6214e5[_0xb7af('0x26')]);if(_0x6214e5[_0xb7af('0x27')]){delete _0x6214e5['name'];}_0x82c4c0['status'](_0x429955)[_0xb7af('0x28')](_0x6214e5);};}exports['index']=function(_0x513fa8,_0x5be4d2){var _0x14711f={},_0x8c0838={},_0x2b5707={'count':0x0,'rows':[]};var _0x65584f=_[_0xb7af('0x29')](db[_0xb7af('0x2a')][_0xb7af('0x2b')],function(_0x2e7d92){return{'name':_0x2e7d92['fieldName'],'type':_0x2e7d92[_0xb7af('0x2c')]['key']};});_0x8c0838['model']=_[_0xb7af('0x29')](_0x65584f,_0xb7af('0x27'));_0x8c0838[_0xb7af('0x2d')]=_[_0xb7af('0x2e')](_0x513fa8[_0xb7af('0x2d')]);_0x8c0838['filters']=_['intersection'](_0x8c0838[_0xb7af('0x2f')],_0x8c0838[_0xb7af('0x2d')]);_0x14711f['attributes']=_[_0xb7af('0x30')](_0x8c0838[_0xb7af('0x2f')],qs[_0xb7af('0x31')](_0x513fa8[_0xb7af('0x2d')][_0xb7af('0x31')]));_0x14711f['attributes']=_0x14711f[_0xb7af('0x32')][_0xb7af('0x33')]?_0x14711f[_0xb7af('0x32')]:_0x8c0838[_0xb7af('0x2f')];if(!_0x513fa8[_0xb7af('0x2d')][_0xb7af('0x34')](_0xb7af('0x35'))){_0x14711f['limit']=qs[_0xb7af('0x1d')](_0x513fa8[_0xb7af('0x2d')][_0xb7af('0x1d')]);_0x14711f[_0xb7af('0x1b')]=qs[_0xb7af('0x1b')](_0x513fa8['query'][_0xb7af('0x1b')]);}_0x14711f[_0xb7af('0x36')]=qs[_0xb7af('0x37')](_0x513fa8[_0xb7af('0x2d')][_0xb7af('0x37')]);_0x14711f[_0xb7af('0x38')]=qs['filters'](_[_0xb7af('0x39')](_0x513fa8['query'],_0x8c0838['filters']),_0x65584f);if(_0x513fa8['query'][_0xb7af('0x3a')]){_0x14711f[_0xb7af('0x38')]=_[_0xb7af('0x3b')](_0x14711f['where'],{'$or':_['map'](_0x65584f,function(_0x4e57ab){if(_0x4e57ab[_0xb7af('0x2c')]!==_0xb7af('0x3c')){var _0xbee9e6={};_0xbee9e6[_0x4e57ab[_0xb7af('0x27')]]={'$like':'%'+_0x513fa8[_0xb7af('0x2d')][_0xb7af('0x3a')]+'%'};return _0xbee9e6;}})});}_0x14711f=_['merge']({},_0x14711f,_0x513fa8[_0xb7af('0x3d')]);var _0x775539={'where':_0x14711f[_0xb7af('0x38')]};return db[_0xb7af('0x2a')][_0xb7af('0x1c')](_0x775539)[_0xb7af('0x23')](function(_0x5e3c57){_0x2b5707[_0xb7af('0x1c')]=_0x5e3c57;if(_0x513fa8[_0xb7af('0x2d')][_0xb7af('0x3e')]){_0x14711f[_0xb7af('0x3f')]=[{'all':!![]}];}return db[_0xb7af('0x2a')]['findAll'](_0x14711f);})[_0xb7af('0x23')](function(_0x23fd21){_0x2b5707['rows']=_0x23fd21;return _0x2b5707;})[_0xb7af('0x23')](respondWithFilteredResult(_0x5be4d2,_0x14711f))[_0xb7af('0x40')](handleError(_0x5be4d2,null));};exports[_0xb7af('0x41')]=function(_0x1fa571,_0x50c644){var _0x204de4={'raw':!![],'where':{'id':_0x1fa571[_0xb7af('0x42')]['id']}},_0x20f899={};_0x20f899[_0xb7af('0x2f')]=_['keys'](db[_0xb7af('0x2a')][_0xb7af('0x2b')]);_0x20f899['query']=_['keys'](_0x1fa571[_0xb7af('0x2d')]);_0x20f899['filters']=_[_0xb7af('0x30')](_0x20f899[_0xb7af('0x2f')],_0x20f899[_0xb7af('0x2d')]);_0x204de4[_0xb7af('0x32')]=_[_0xb7af('0x30')](_0x20f899[_0xb7af('0x2f')],qs[_0xb7af('0x31')](_0x1fa571['query'][_0xb7af('0x31')]));_0x204de4[_0xb7af('0x32')]=_0x204de4[_0xb7af('0x32')][_0xb7af('0x33')]?_0x204de4[_0xb7af('0x32')]:_0x20f899[_0xb7af('0x2f')];if(_0x1fa571[_0xb7af('0x2d')][_0xb7af('0x3e')]){_0x204de4['include']=[{'all':!![]}];}_0x204de4=_['merge']({},_0x204de4,_0x1fa571['options']);return db[_0xb7af('0x2a')][_0xb7af('0x43')](_0x204de4)[_0xb7af('0x23')](handleEntityNotFound(_0x50c644,null))[_0xb7af('0x23')](respondWithResult(_0x50c644,null))[_0xb7af('0x40')](handleError(_0x50c644,null));};exports[_0xb7af('0x44')]=function(_0xe4556b,_0x43e28c){var _0x447243={'where':{'id':_0xe4556b['params']['id']}},_0x15912b={};_0x15912b[_0xb7af('0x2f')]=_[_0xb7af('0x2e')](db[_0xb7af('0x2a')][_0xb7af('0x2b')]);_0x447243[_0xb7af('0x32')]=_[_0xb7af('0x30')](_0x15912b[_0xb7af('0x2f')],qs[_0xb7af('0x31')](_0xe4556b[_0xb7af('0x2d')][_0xb7af('0x31')]));_0x447243[_0xb7af('0x32')]=_0x447243['attributes']['length']?_0x447243[_0xb7af('0x32')]:_0x15912b[_0xb7af('0x2f')];if(_0xe4556b[_0xb7af('0x2d')][_0xb7af('0x3e')]){_0x447243[_0xb7af('0x3f')]=[{'all':!![]}];}_0x447243=_[_0xb7af('0x3b')]({},_0x447243,_0xe4556b['options']);return db[_0xb7af('0x2a')][_0xb7af('0x43')](_0x447243)[_0xb7af('0x23')](handleEntityNotFound(_0x43e28c,null))[_0xb7af('0x23')](function(_0x18edb8){if(_0x18edb8){var _0x5e3642=_0x18edb8['get']({'plain':!![]});_0x5e3642=qs[_0xb7af('0x45')](_0x5e3642,['id','createdAt',_0xb7af('0x46')]);_0xe4556b[_0xb7af('0x47')]=_[_0xb7af('0x45')](_0xe4556b['body'],['id',_0xb7af('0x48'),_0xb7af('0x46')]);return db['Attachment'][_0xb7af('0x49')](_[_0xb7af('0x3b')](_0x5e3642,_0xe4556b[_0xb7af('0x47')]),{'include':_0xe4556b['query'][_0xb7af('0x3e')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x43e28c,0xc9))['catch'](handleError(_0x43e28c,null));};exports['update']=function(_0x275d85,_0x519014){if(_0x275d85['body']['id']){delete _0x275d85['body']['id'];}return db['Attachment'][_0xb7af('0x43')]({'where':{'id':_0x275d85[_0xb7af('0x42')]['id']}})['then'](handleEntityNotFound(_0x519014,null))[_0xb7af('0x23')](saveUpdates(_0x275d85[_0xb7af('0x47')],null))[_0xb7af('0x23')](respondWithResult(_0x519014,null))['catch'](handleError(_0x519014,null));};exports[_0xb7af('0x4a')]=function(_0x1d43df,_0x127c61){return db[_0xb7af('0x2a')][_0xb7af('0x43')]({'where':{'id':_0x1d43df['params']['id']}})[_0xb7af('0x23')](handleEntityNotFound(_0x127c61,null))[_0xb7af('0x23')](removeEntity(_0x127c61,null))[_0xb7af('0x40')](handleError(_0x127c61,null));};exports[_0xb7af('0x49')]=function(_0x180b82,_0x224797,_0x25544d){_0x180b82[_0xb7af('0x47')][_0xb7af('0x27')]=_0x180b82[_0xb7af('0x4b')][_0xb7af('0x4c')];_0x180b82['body'][_0xb7af('0x4d')]=_0x180b82[_0xb7af('0x4b')]['filename'];_0x180b82[_0xb7af('0x47')][_0xb7af('0x2c')]=_0x180b82['file'][_0xb7af('0x4e')];return db[_0xb7af('0x2a')][_0xb7af('0x49')](_0x180b82[_0xb7af('0x47')])['then'](respondWithResult(_0x224797,0xc9))[_0xb7af('0x40')](handleError(_0x224797,null));};exports[_0xb7af('0x4f')]=function(_0x389c2e,_0x238c1b,_0x214782){return db[_0xb7af('0x2a')][_0xb7af('0x50')]({'where':{'id':_0x389c2e[_0xb7af('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x238c1b,null))[_0xb7af('0x23')](function(_0x2c1c57){if(_0x2c1c57){var _0x495cac=_0x2c1c57[_0xb7af('0x51')]!==null;var _0x43b233=path['join'](config[_0xb7af('0x52')],'server/files/attachments/');if(_0x495cac){_0x43b233=path[_0xb7af('0x53')](_0x43b233,_0xb7af('0x54'));}var _0x35d2ce=path[_0xb7af('0x53')](_0x43b233,_0x2c1c57['basename']);return _0x238c1b[_0xb7af('0x4f')](_0x35d2ce);}})[_0xb7af('0x40')](handleError(_0x238c1b,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 03b27f0..80f5acf 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 _0xb433=['rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1cf20f,_0x35344a){var _0x7189bb=function(_0x22d3a8){while(--_0x22d3a8){_0x1cf20f['push'](_0x1cf20f['shift']());}};_0x7189bb(++_0x35344a);}(_0xb433,0x1c7));var _0x3b43=function(_0x5e99ae,_0x37d21f){_0x5e99ae=_0x5e99ae-0x0;var _0x286019=_0xb433[_0x5e99ae];return _0x286019;};'use strict';var _=require(_0x3b43('0x0'));var util=require(_0x3b43('0x1'));var logger=require(_0x3b43('0x2'))(_0x3b43('0x3'));var moment=require('moment');var BPromise=require(_0x3b43('0x4'));var rp=require(_0x3b43('0x5'));var fs=require('fs');var path=require(_0x3b43('0x6'));var rimraf=require(_0x3b43('0x7'));var config=require(_0x3b43('0x8'));var attributes=require(_0x3b43('0x9'));module[_0x3b43('0xa')]=function(_0x55dae0,_0x4ec5e3){return _0x55dae0[_0x3b43('0xb')](_0x3b43('0xc'),attributes,{'tableName':_0x3b43('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a5e=['api','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports','define','Attachment','util','../../config/logger'];(function(_0x1503bb,_0xf6e95){var _0x10927b=function(_0x2c13bc){while(--_0x2c13bc){_0x1503bb['push'](_0x1503bb['shift']());}};_0x10927b(++_0xf6e95);}(_0x7a5e,0x6a));var _0xe7a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a5e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe7a5('0x0'));var logger=require(_0xe7a5('0x1'))(_0xe7a5('0x2'));var moment=require(_0xe7a5('0x3'));var BPromise=require(_0xe7a5('0x4'));var rp=require(_0xe7a5('0x5'));var fs=require('fs');var path=require(_0xe7a5('0x6'));var rimraf=require('rimraf');var config=require(_0xe7a5('0x7'));var attributes=require(_0xe7a5('0x8'));module[_0xe7a5('0x9')]=function(_0x46d0e3,_0x4b2314){return _0x46d0e3[_0xe7a5('0xa')](_0xe7a5('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 067a460..7fe85d0 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 _0x55e0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','Attachment','body','options','raw','stringify','lodash','util','moment','bluebird'];(function(_0x225387,_0x4b80f9){var _0x1d3948=function(_0x3dbb80){while(--_0x3dbb80){_0x225387['push'](_0x225387['shift']());}};_0x1d3948(++_0x4b80f9);}(_0x55e0,0xdc));var _0x055e=function(_0x1dfa23,_0x19e069){_0x1dfa23=_0x1dfa23-0x0;var _0x134989=_0x55e0[_0x1dfa23];return _0x134989;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});}exports[_0x055e('0x16')]=function(_0x4c85dd){var _0x36ef10=this;return new Promise(function(_0x2cf3de,_0x2f4a06){return db[_0x055e('0x17')]['create'](_0x4c85dd[_0x055e('0x18')],{'raw':_0x4c85dd[_0x055e('0x19')]?_0x4c85dd['options'][_0x055e('0x1a')]===undefined?!![]:![]:!![]})[_0x055e('0xb')](function(_0x10258f){logger[_0x055e('0xc')](_0x055e('0x16'),_0x4c85dd);logger[_0x055e('0xf')]('CreateAttachment',_0x4c85dd,JSON[_0x055e('0x1b')](_0x10258f));_0x2cf3de(_0x10258f);})[_0x055e('0x15')](function(_0x211594){logger['error'](_0x055e('0x16'),_0x211594[_0x055e('0x13')],_0x4c85dd);_0x2f4a06(_0x36ef10[_0x055e('0x11')](0x1f4,_0x211594[_0x055e('0x13')]));});});}; \ No newline at end of file +var _0xffe1=['message','result','catch','Attachment','create','body','options','raw','CreateAttachment','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1cb185,_0x378e4f){var _0x5df878=function(_0x2831c3){while(--_0x2831c3){_0x1cb185['push'](_0x1cb185['shift']());}};_0x5df878(++_0x378e4f);}(_0xffe1,0x175));var _0x1ffe=function(_0x3b7f54,_0x51254d){_0x3b7f54=_0x3b7f54-0x0;var _0x38b126=_0xffe1[_0x3b7f54];return _0x38b126;};'use strict';var _=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1ffe('0x2'));var fs=require('fs');var Redis=require(_0x1ffe('0x3'));var db=require(_0x1ffe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ffe('0x5'))(_0x1ffe('0x6'));var config=require(_0x1ffe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1ffe('0x8')][_0x1ffe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6bc1ed,_0x26e370,_0xb34112){return new BPromise(function(_0x8eee2b,_0x4d2a28){return client['request'](_0x6bc1ed,_0xb34112)[_0x1ffe('0xa')](function(_0x13556e){logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');logger[_0x1ffe('0xd')](_0x1ffe('0xe'),_0x26e370,_0x1ffe('0xf'),JSON[_0x1ffe('0x10')](_0x13556e));if(_0x13556e[_0x1ffe('0x11')]){if(_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x12')]===0x1f4){logger[_0x1ffe('0x11')]('Attachment,\x20%s,\x20%s',_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x4d2a28(_0x13556e['error'][_0x1ffe('0x13')]);}logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x8eee2b(_0x13556e['error'][_0x1ffe('0x13')]);}else{logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');_0x8eee2b(_0x13556e[_0x1ffe('0x14')]['message']);}})[_0x1ffe('0x15')](function(_0x565922){logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x565922);_0x4d2a28(_0x565922);});});}exports['CreateAttachment']=function(_0x561670){var _0x4dbd7f=this;return new Promise(function(_0x42b92c,_0x21950f){return db[_0x1ffe('0x16')][_0x1ffe('0x17')](_0x561670[_0x1ffe('0x18')],{'raw':_0x561670[_0x1ffe('0x19')]?_0x561670[_0x1ffe('0x19')][_0x1ffe('0x1a')]===undefined?!![]:![]:!![]})[_0x1ffe('0xa')](function(_0x38f189){logger[_0x1ffe('0xb')](_0x1ffe('0x1b'),_0x561670);logger['debug']('CreateAttachment',_0x561670,JSON[_0x1ffe('0x10')](_0x38f189));_0x42b92c(_0x38f189);})[_0x1ffe('0x15')](function(_0x95071c){logger['error']('CreateAttachment',_0x95071c[_0x1ffe('0x13')],_0x561670);_0x21950f(_0x4dbd7f[_0x1ffe('0x11')](0x1f4,_0x95071c[_0x1ffe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index d87f57a..a475332 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb28,0x106));var _0x8db2=function(_0x1818b6,_0x56d65a){_0x1818b6=_0x1818b6-0x0;var _0x3bea43=_0xdb28[_0x1818b6];return _0x3bea43;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x1109c8,_0x3a077f){var _0x4adeb2=function(_0x5b0ad9){while(--_0x5b0ad9){_0x1109c8['push'](_0x1109c8['shift']());}};_0x4adeb2(++_0x3a077f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ce01b,_0x75b57c){_0x4ce01b=_0x4ce01b-0x0;var _0x2a3dad=_0x5f2f[_0x4ce01b];return _0x2a3dad;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5bf453e..affe88b 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 _0xb0d1=['../../config/environment','../../components/auth/service','signToken','authenticate','google','profile','email','callback','/login','use','clientID','callbackURL','Setting','findOne','then','User','find','emails','admin','agent','disabled','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','passport','Strategy','../../mysqldb'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0xb0d1,0x102));var _0x1b0d=function(_0x40c915,_0x42da07){_0x40c915=_0x40c915-0x0;var _0x3e894a=_0xb0d1[_0x40c915];return _0x3e894a;};'use strict';var _=require('lodash');var passport=require(_0x1b0d('0x0'));var GoogleStrategy=require('passport-google-oauth20')[_0x1b0d('0x1')];var moment=require('moment');var db=require(_0x1b0d('0x2'))['db'];var config=require(_0x1b0d('0x3'));var signToken=require(_0x1b0d('0x4'))[_0x1b0d('0x5')];var utils=require('../../config/utils');exports['login']=passport[_0x1b0d('0x6')](_0x1b0d('0x7'),{'failureRedirect':'/login','scope':[_0x1b0d('0x8'),_0x1b0d('0x9')],'session':![]});exports[_0x1b0d('0xa')]=passport[_0x1b0d('0x6')](_0x1b0d('0x7'),{'failureRedirect':_0x1b0d('0xb'),'session':![]});passport[_0x1b0d('0xc')](new GoogleStrategy({'clientID':config[_0x1b0d('0x7')]?config[_0x1b0d('0x7')][_0x1b0d('0xd')]:'id','clientSecret':config[_0x1b0d('0x7')]?config[_0x1b0d('0x7')]['clientSecret']:'secret','callbackURL':config[_0x1b0d('0x7')]?config[_0x1b0d('0x7')][_0x1b0d('0xe')]:''},function(_0x4ce959,_0x38c40f,_0x5cec0d,_0x548f6a){var _0x223307,_0x2ab08e;return db[_0x1b0d('0xf')][_0x1b0d('0x10')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x1b0d('0x11')](function(_0xb79798){_0x223307=_0xb79798;return db[_0x1b0d('0x12')][_0x1b0d('0x13')]({'where':{'email':_['map'](_0x5cec0d[_0x1b0d('0x14')],'value'),'role':{'$or':[_0x1b0d('0x15'),'user',_0x1b0d('0x16')]}}});})['then'](function(_0x49241a){_0x2ab08e=_0x49241a;if(_0x2ab08e){if(_0x2ab08e[_0x1b0d('0x17')]){return _0x548f6a('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x223307['blockDuration']>0x0){if(_0x2ab08e['blocked']){if(moment(_0x2ab08e['blockedAt'])['add'](_0x223307['blockDuration'],_0x1b0d('0x18'))>moment()){return _0x548f6a(_0x1b0d('0x19'));}else{return utils[_0x1b0d('0x1a')](_0x2ab08e,0x0,![],null)['then'](function(){return utils['getLicense'](_0x2ab08e);})[_0x1b0d('0x11')](function(){return _0x548f6a(null,_0x2ab08e);});}}else{return utils[_0x1b0d('0x1b')](_0x2ab08e)['then'](function(){return _0x548f6a(null,_0x2ab08e);});}}else{return utils[_0x1b0d('0x1b')](_0x2ab08e)['then'](function(){return _0x548f6a(null,_0x2ab08e);});}}return _0x548f6a(_0x1b0d('0x19'));})[_0x1b0d('0x1c')](function(_0x4399ef){_0x548f6a(_0x4399ef);});})); \ No newline at end of file +var _0x74fb=['blocked','add','minutes','clearBlockUser','getLicense','catch','passport','moment','../../config/environment','signToken','../../config/utils','login','authenticate','google','/login','profile','email','callback','use','clientID','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','map','admin','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x558dad,_0x1a9b5a){var _0x1921ea=function(_0x2d44d6){while(--_0x2d44d6){_0x558dad['push'](_0x558dad['shift']());}};_0x1921ea(++_0x1a9b5a);}(_0x74fb,0xc0));var _0xb74f=function(_0xb61d88,_0x388bba){_0xb61d88=_0xb61d88-0x0;var _0x196a0d=_0x74fb[_0xb61d88];return _0x196a0d;};'use strict';var _=require('lodash');var passport=require(_0xb74f('0x0'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0xb74f('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xb74f('0x2'));var signToken=require('../../components/auth/service')[_0xb74f('0x3')];var utils=require(_0xb74f('0x4'));exports[_0xb74f('0x5')]=passport[_0xb74f('0x6')](_0xb74f('0x7'),{'failureRedirect':_0xb74f('0x8'),'scope':[_0xb74f('0x9'),_0xb74f('0xa')],'session':![]});exports[_0xb74f('0xb')]=passport['authenticate'](_0xb74f('0x7'),{'failureRedirect':_0xb74f('0x8'),'session':![]});passport[_0xb74f('0xc')](new GoogleStrategy({'clientID':config['google']?config[_0xb74f('0x7')][_0xb74f('0xd')]:'id','clientSecret':config[_0xb74f('0x7')]?config['google']['clientSecret']:'secret','callbackURL':config['google']?config[_0xb74f('0x7')][_0xb74f('0xe')]:''},function(_0x188204,_0x4b781c,_0x472424,_0x14211e){var _0xcf1a27,_0x146d58;return db[_0xb74f('0xf')][_0xb74f('0x10')]({'where':{'id':0x1},'attributes':[_0xb74f('0x11'),_0xb74f('0x12')],'raw':!![]})[_0xb74f('0x13')](function(_0x3a46e7){_0xcf1a27=_0x3a46e7;return db[_0xb74f('0x14')]['find']({'where':{'email':_[_0xb74f('0x15')](_0x472424['emails'],'value'),'role':{'$or':[_0xb74f('0x16'),'user','agent']}}});})[_0xb74f('0x13')](function(_0x2f7ea0){_0x146d58=_0x2f7ea0;if(_0x146d58){if(_0x146d58[_0xb74f('0x17')]){return _0x14211e(_0xb74f('0x18'));}else if(_0xcf1a27[_0xb74f('0x12')]>0x0){if(_0x146d58[_0xb74f('0x19')]){if(moment(_0x146d58['blockedAt'])[_0xb74f('0x1a')](_0xcf1a27[_0xb74f('0x12')],_0xb74f('0x1b'))>moment()){return _0x14211e(_0xb74f('0x18'));}else{return utils[_0xb74f('0x1c')](_0x146d58,0x0,![],null)[_0xb74f('0x13')](function(){return utils['getLicense'](_0x146d58);})[_0xb74f('0x13')](function(){return _0x14211e(null,_0x146d58);});}}else{return utils[_0xb74f('0x1d')](_0x146d58)[_0xb74f('0x13')](function(){return _0x14211e(null,_0x146d58);});}}else{return utils[_0xb74f('0x1d')](_0x146d58)[_0xb74f('0x13')](function(){return _0x14211e(null,_0x146d58);});}}return _0x14211e(_0xb74f('0x18'));})[_0xb74f('0x1e')](function(_0x210da8){_0x14211e(_0x210da8);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index fc4d653..a4aacba 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 _0x028b=['isMiddleware','setTokenCookie','passport','./authGoogle.controller','../../components/auth/service','get','login','callback'];(function(_0x396338,_0x37ff5c){var _0xe6137d=function(_0x39b0){while(--_0x39b0){_0x396338['push'](_0x396338['shift']());}};_0xe6137d(++_0x37ff5c);}(_0x028b,0x72));var _0xb028=function(_0x6fb838,_0x1bf52e){_0x6fb838=_0x6fb838-0x0;var _0x432f4c=_0x028b[_0x6fb838];return _0x432f4c;};'use strict';var express=require('express');var passport=require(_0xb028('0x0'));var router=express['Router']();var controller=require(_0xb028('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0xb028('0x2'));router[_0xb028('0x3')]('/',controller[_0xb028('0x4')]);router[_0xb028('0x3')]('/callback',controller[_0xb028('0x5')],authService[_0xb028('0x6')],userController[_0xb028('0x4')],authService[_0xb028('0x7')]);module['exports']=router; \ No newline at end of file +var _0x8c39=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','login','setTokenCookie','express'];(function(_0x34cc9a,_0xed9a16){var _0x2ff3c2=function(_0xb88913){while(--_0xb88913){_0x34cc9a['push'](_0x34cc9a['shift']());}};_0x2ff3c2(++_0xed9a16);}(_0x8c39,0x1df));var _0x98c3=function(_0x42b061,_0x3496ec){_0x42b061=_0x42b061-0x0;var _0x3fc8df=_0x8c39[_0x42b061];return _0x3fc8df;};'use strict';var express=require(_0x98c3('0x0'));var passport=require('passport');var router=express[_0x98c3('0x1')]();var controller=require(_0x98c3('0x2'));var userController=require(_0x98c3('0x3'));var authService=require(_0x98c3('0x4'));router[_0x98c3('0x5')]('/',controller['login']);router[_0x98c3('0x5')](_0x98c3('0x6'),controller[_0x98c3('0x7')],authService['isMiddleware'],userController[_0x98c3('0x8')],authService[_0x98c3('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 0ca715b..8a8263a 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 _0x3870=['passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blocked','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','minutes','clearBlockUser','disabled','catch','getLicense','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','forgot','body','Email\x20parameter\x20is\x20missing','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','util'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x3870,0x15b));var _0x0387=function(_0xd5182b,_0x292440){_0xd5182b=_0xd5182b-0x0;var _0x12086b=_0x3870[_0xd5182b];return _0x12086b;};'use strict';var util=require(_0x0387('0x0'));var passport=require(_0x0387('0x1'));var LocalStrategy=require(_0x0387('0x2'))[_0x0387('0x3')];var jayson=require(_0x0387('0x4'));var _=require(_0x0387('0x5'));var rs=require(_0x0387('0x6'));var moment=require(_0x0387('0x7'));var db=require(_0x0387('0x8'))['db'];var authService=require(_0x0387('0x9'));var utils=require(_0x0387('0xa'));var client=jayson[_0x0387('0xb')][_0x0387('0xc')]({'port':0x232b});function localAuthenticate(_0x363c4e,_0x4e7159,_0x4eff50,_0x12024e){var _0x1d926d,_0x4c94bd;return db[_0x0387('0xd')][_0x0387('0xe')]({'where':{'id':0x1},'attributes':[_0x0387('0xf'),_0x0387('0x10')],'raw':!![]})[_0x0387('0x11')](function(_0x4f3c52){_0x1d926d=_0x4f3c52;return _0x363c4e[_0x0387('0xe')]({'attributes':['id',_0x0387('0x12'),'password',_0x0387('0x13'),_0x0387('0x14'),'disabled',_0x0387('0x15'),'blockedAt',_0x0387('0x16')],'where':{'name':_0x4e7159,'role':{'$or':[_0x0387('0x17'),'user',_0x0387('0x18')]}}});})[_0x0387('0x11')](function(_0x42d06a){if(!_0x42d06a||_0x42d06a&&_0x42d06a[_0x0387('0x12')]!==_0x4e7159){throw new Error(_0x0387('0x19'));}else{_0x4c94bd=_0x42d06a;return _0x4c94bd;}})[_0x0387('0x11')](function(){_0x4c94bd[_0x0387('0x1a')](_0x4eff50,function(_0x1e564d,_0x4fffa1){var _0x4f2d8a=_0x4c94bd[_0x0387('0x16')]+0x1;if(_0x1e564d){return _0x12024e(_0x1e564d);}else if(!_0x4fffa1){if(_0x4c94bd['disabled']){return _0x12024e(null,![],{'message':_0x0387('0x19')});}else if(_0x1d926d[_0x0387('0xf')]>0x0){if(_0x4c94bd[_0x0387('0x15')]){if(_0x1d926d[_0x0387('0x10')]>0x0){if(moment(_0x4c94bd[_0x0387('0x1b')])[_0x0387('0x1c')](_0x1d926d[_0x0387('0x10')],_0x0387('0x1d'))>moment()){return _0x12024e(null,![],{'message':_0x0387('0x19')});}else{return utils[_0x0387('0x1e')](_0x4c94bd,_0x4f2d8a,![],null)[_0x0387('0x11')](function(){return _0x12024e(null,![],{'message':_0x0387('0x19')});});}}else{return _0x12024e(null,![],{'message':_0x0387('0x19')});}}else{if(_0x4f2d8a>=_0x1d926d[_0x0387('0xf')]){return utils[_0x0387('0x1e')](_0x4c94bd,0x0,!![],moment())[_0x0387('0x11')](function(){return _0x12024e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x0387('0x1e')](_0x4c94bd,_0x4f2d8a,![],null)[_0x0387('0x11')](function(){return _0x12024e(null,![],{'message':_0x0387('0x19')});});}}}else{return _0x12024e(null,![],{'message':_0x0387('0x19')});}}else{if(_0x4c94bd[_0x0387('0x1f')]){return _0x12024e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1d926d[_0x0387('0xf')]>0x0){if(_0x4c94bd[_0x0387('0x15')]){if(_0x1d926d[_0x0387('0x10')]>0x0){if(moment(_0x4c94bd[_0x0387('0x1b')])[_0x0387('0x1c')](_0x1d926d[_0x0387('0x10')],_0x0387('0x1d'))>moment()){return _0x12024e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0387('0x1e')](_0x4c94bd,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4c94bd);})[_0x0387('0x11')](function(){return _0x12024e(null,_0x4c94bd);});}}else{return _0x12024e(null,![],{'message':_0x0387('0x19')});}}else{return utils[_0x0387('0x1e')](_0x4c94bd,0x0,![],null)[_0x0387('0x11')](function(){return utils['getLicense'](_0x4c94bd);})['then'](function(){return _0x12024e(null,_0x4c94bd);})[_0x0387('0x20')](function(_0x5b6b8d){return _0x12024e(null,![],_0x5b6b8d);});}}else{if(_0x4c94bd[_0x0387('0x15')]){return _0x12024e(null,![],{'message':_0x0387('0x19')});}else{return utils[_0x0387('0x21')](_0x4c94bd)[_0x0387('0x11')](function(){return _0x12024e(null,_0x4c94bd);});}}}});})[_0x0387('0x20')](function(_0x37ec9a){return _0x12024e(null,![],_0x37ec9a);});}function sendServiceMail(_0x1772aa){return db[_0x0387('0x22')][_0x0387('0x23')]({'where':{'service':!![]},'attributes':['id',_0x0387('0x12'),_0x0387('0x24')],'include':[{'model':db[_0x0387('0x25')],'as':_0x0387('0x26')}]})[_0x0387('0x11')](function(_0x3ba63a){if(!_0x3ba63a){throw new Error(_0x0387('0x27'));}var _0x372733={'tls':{'rejectUnauthorized':![]}};if(_0x3ba63a[_0x0387('0x26')][_0x0387('0x28')]){_0x372733['service']=_0x3ba63a[_0x0387('0x26')]['service'];}else{_0x372733[_0x0387('0x29')]=_0x3ba63a['Smtp'][_0x0387('0x29')];_0x372733[_0x0387('0x2a')]=_0x3ba63a[_0x0387('0x26')][_0x0387('0x2a')];_0x372733[_0x0387('0x2b')]=_0x3ba63a[_0x0387('0x26')]['secure'];}if(_0x3ba63a['Smtp'][_0x0387('0x2c')]){_0x372733[_0x0387('0x2d')]={'user':_0x3ba63a['Smtp']['user'],'pass':_0x3ba63a['Smtp'][_0x0387('0x2e')]};}var _0x3fe791={'account':_0x372733,'message':_['merge']({'from':util[_0x0387('0x2f')](_0x0387('0x30'),_0x3ba63a[_0x0387('0x12')],_0x3ba63a[_0x0387('0x24')]||_0x3ba63a['Smtp'][_0x0387('0x31')])},_0x1772aa)};return client[_0x0387('0x32')](_0x0387('0x33'),_0x3fe791);})[_0x0387('0x11')](function(_0x3a2b79){if(_0x3a2b79[_0x0387('0x34')]){throw new Error(util[_0x0387('0x2f')](_0x0387('0x35'),_0x3a2b79[_0x0387('0x34')][_0x0387('0x36')]||JSON['stringify'](_0x3a2b79[_0x0387('0x34')])));}return!![];});}function handleError(_0x494a03,_0x48bf4,_0x4712af){return _0x494a03[_0x0387('0x37')](_0x48bf4||0x1f4)[_0x0387('0x38')]({'message':_0x4712af?_0x4712af[_0x0387('0x36')]||_0x4712af:''});}exports[_0x0387('0x39')]=function(_0x2da3e1,_0x3a4af4,_0x28b2e0){passport[_0x0387('0x1a')](_0x0387('0x3a'),function(_0x5ab176,_0x16858a,_0x5c8ff0){var _0x25f145=_0x5ab176||_0x5c8ff0;if(_0x25f145){return handleError(_0x3a4af4,0x191,_0x25f145);}if(!_0x16858a){return handleError(_0x3a4af4,0x194,{'message':_0x0387('0x3b')});}else{var _0x4fb6c9={'payload':{'id':_0x16858a['id'],'role':_0x16858a[_0x0387('0x14')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4fb6c9)[_0x0387('0x11')](function(_0xbfa0d1){_0x3a4af4['json']({'id':_0x16858a['id'],'token':_0xbfa0d1,'statusCall':'','isAlreadyLogged':_0x16858a[_0x0387('0x3c')]});});}})(_0x2da3e1,_0x3a4af4,_0x28b2e0);};exports[_0x0387('0x3d')]=function(_0x26ab17,_0x3c9d93,_0x26a836){if(!_0x26ab17[_0x0387('0x3e')]['email']){return handleError(_0x3c9d93,0x1f4,{'message':_0x0387('0x3f')});}var _0x25a64b=rs['generate']();_0x26ab17['body'][_0x0387('0x24')]=_0x26ab17['body'][_0x0387('0x24')]['trim']()[_0x0387('0x40')]();var _0x203213;return db[_0x0387('0xd')][_0x0387('0xe')]({'where':{'id':0x1},'attributes':[_0x0387('0xf'),_0x0387('0x10')],'raw':!![]})[_0x0387('0x11')](function(_0x4e7bd7){_0x203213=_0x4e7bd7;return db[_0x0387('0x41')][_0x0387('0x23')]({'where':{'email':_0x26ab17[_0x0387('0x3e')]['email']}});})[_0x0387('0x11')](function(_0x24c568){if(!_0x24c568){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x24c568[_0x0387('0x1f')]){throw new Error(_0x0387('0x42'));}if(_0x24c568[_0x0387('0x15')]){if(moment(_0x24c568[_0x0387('0x1b')])[_0x0387('0x1c')](_0x203213[_0x0387('0x10')],'minutes')>moment()){throw new Error(_0x0387('0x43'));}else{_0x24c568[_0x0387('0x15')]=![];_0x24c568[_0x0387('0x1b')]=null;}}_0x24c568[_0x0387('0x44')]=_0x25a64b;_0x24c568[_0x0387('0x45')]=Date[_0x0387('0x46')]()+0x36ee80;return _0x24c568[_0x0387('0x47')]();})[_0x0387('0x11')](function(){return sendServiceMail({'to':_0x26ab17[_0x0387('0x3e')][_0x0387('0x24')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x0387('0x48')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x0387('0x49')+_0x26ab17[_0x0387('0x4a')]['host']+_0x0387('0x4b')+_0x25a64b+'\x0a\x0a'+_0x0387('0x4c')});})['then'](function(){_0x3c9d93[_0x0387('0x37')](0xc8)[_0x0387('0x38')]({'message':_0x0387('0x4d')});})[_0x0387('0x20')](function(_0xf1fcb){return handleError(_0x3c9d93,0x1f4,_0xf1fcb);});};exports[_0x0387('0x4e')]=function(_0x7d7041,_0x43e744,_0xe58dc0){return db[_0x0387('0x41')]['find']({'where':{'resetPasswordToken':_0x7d7041[_0x0387('0x4f')]['token'],'resetPasswordExpires':{'$gt':Date[_0x0387('0x46')]()}}})['then'](function(_0x128720){if(!_0x128720){throw new Error(_0x0387('0x50'));}return db['Setting'][_0x0387('0xe')]({'attributes':['id','securePassword',_0x0387('0x51'),'passwordHistoryLimit']})['then'](function(_0x6e2118){if(_0x6e2118['securePassword'])authService[_0x0387('0x52')](_0x7d7041[_0x0387('0x3e')][_0x0387('0x53')]);if(!_0x6e2118['enforcePasswordHistory']||!_0x128720[_0x0387('0x54')])return _0x128720;authService[_0x0387('0x55')](_0x7d7041['body'][_0x0387('0x53')],_0x128720[_0x0387('0x54')],_0x6e2118['passwordHistoryLimit']);return _0x128720;})[_0x0387('0x11')](function(){_0x128720[_0x0387('0x53')]=_0x7d7041[_0x0387('0x3e')][_0x0387('0x53')];_0x128720[_0x0387('0x44')]=null;_0x128720['resetPasswordExpires']=null;return _0x128720[_0x0387('0x47')]();});})[_0x0387('0x11')](function(){_0x43e744[_0x0387('0x37')](0xc8)[_0x0387('0x38')]({'message':_0x0387('0x56')});})['catch'](function(_0x4b5860){return handleError(_0x43e744,0x1f4,_0x4b5860);});};passport['use'](new LocalStrategy({'usernameField':_0x0387('0x12'),'passwordField':'password'},function(_0x412e3d,_0x3d1c01,_0x18502b){return localAuthenticate(db['User'],_0x412e3d,_0x3d1c01,_0x18502b);})); \ No newline at end of file +var _0xd1e4=['json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','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','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','util','passport-local','Strategy','jayson/promise','lodash','../../mysqldb','../../components/auth/service','client','http','Setting','allowedLoginAttempts','findOne','name','password','salt','role','disabled','loginAttempts','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','blockedAt','blockDuration','minutes','clearBlockUser','add','getLicense','catch','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','auth','user','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','login','local','signToken'];(function(_0x4936fb,_0x10fda9){var _0x4430ab=function(_0xd722c3){while(--_0xd722c3){_0x4936fb['push'](_0x4936fb['shift']());}};_0x4430ab(++_0x10fda9);}(_0xd1e4,0xc5));var _0x4d1e=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xd1e4[_0x4a53d];return _0x27410e;};'use strict';var util=require(_0x4d1e('0x0'));var passport=require('passport');var LocalStrategy=require(_0x4d1e('0x1'))[_0x4d1e('0x2')];var jayson=require(_0x4d1e('0x3'));var _=require(_0x4d1e('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x4d1e('0x5'))['db'];var authService=require(_0x4d1e('0x6'));var utils=require('../../config/utils');var client=jayson[_0x4d1e('0x7')][_0x4d1e('0x8')]({'port':0x232b});function localAuthenticate(_0x31e9aa,_0x114a7e,_0x120de2,_0x199ea5){var _0x405b31,_0x1d9e26;return db[_0x4d1e('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x4d1e('0xa'),'blockDuration'],'raw':!![]})['then'](function(_0x31e2de){_0x405b31=_0x31e2de;return _0x31e9aa[_0x4d1e('0xb')]({'attributes':['id',_0x4d1e('0xc'),_0x4d1e('0xd'),_0x4d1e('0xe'),_0x4d1e('0xf'),_0x4d1e('0x10'),'blocked','blockedAt',_0x4d1e('0x11')],'where':{'name':_0x114a7e,'role':{'$or':['admin','user',_0x4d1e('0x12')]}}});})[_0x4d1e('0x13')](function(_0x22628f){if(!_0x22628f||_0x22628f&&_0x22628f['name']!==_0x114a7e){throw new Error(_0x4d1e('0x14'));}else{_0x1d9e26=_0x22628f;return _0x1d9e26;}})['then'](function(){_0x1d9e26[_0x4d1e('0x15')](_0x120de2,function(_0x1c3246,_0x3c36cd){var _0x42e67e=_0x1d9e26[_0x4d1e('0x11')]+0x1;if(_0x1c3246){return _0x199ea5(_0x1c3246);}else if(!_0x3c36cd){if(_0x1d9e26[_0x4d1e('0x10')]){return _0x199ea5(null,![],{'message':_0x4d1e('0x14')});}else if(_0x405b31['allowedLoginAttempts']>0x0){if(_0x1d9e26[_0x4d1e('0x16')]){if(_0x405b31['blockDuration']>0x0){if(moment(_0x1d9e26[_0x4d1e('0x17')])['add'](_0x405b31[_0x4d1e('0x18')],_0x4d1e('0x19'))>moment()){return _0x199ea5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x1d9e26,_0x42e67e,![],null)[_0x4d1e('0x13')](function(){return _0x199ea5(null,![],{'message':_0x4d1e('0x14')});});}}else{return _0x199ea5(null,![],{'message':_0x4d1e('0x14')});}}else{if(_0x42e67e>=_0x405b31[_0x4d1e('0xa')]){return utils[_0x4d1e('0x1a')](_0x1d9e26,0x0,!![],moment())[_0x4d1e('0x13')](function(){return _0x199ea5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x4d1e('0x1a')](_0x1d9e26,_0x42e67e,![],null)[_0x4d1e('0x13')](function(){return _0x199ea5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x199ea5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1d9e26[_0x4d1e('0x10')]){return _0x199ea5(null,![],{'message':_0x4d1e('0x14')});}else if(_0x405b31[_0x4d1e('0xa')]>0x0){if(_0x1d9e26[_0x4d1e('0x16')]){if(_0x405b31[_0x4d1e('0x18')]>0x0){if(moment(_0x1d9e26['blockedAt'])[_0x4d1e('0x1b')](_0x405b31[_0x4d1e('0x18')],_0x4d1e('0x19'))>moment()){return _0x199ea5(null,![],{'message':_0x4d1e('0x14')});}else{return utils[_0x4d1e('0x1a')](_0x1d9e26,0x0,![],null)[_0x4d1e('0x13')](function(){return utils[_0x4d1e('0x1c')](_0x1d9e26);})['then'](function(){return _0x199ea5(null,_0x1d9e26);});}}else{return _0x199ea5(null,![],{'message':_0x4d1e('0x14')});}}else{return utils[_0x4d1e('0x1a')](_0x1d9e26,0x0,![],null)[_0x4d1e('0x13')](function(){return utils[_0x4d1e('0x1c')](_0x1d9e26);})[_0x4d1e('0x13')](function(){return _0x199ea5(null,_0x1d9e26);})[_0x4d1e('0x1d')](function(_0x2aa9b4){return _0x199ea5(null,![],_0x2aa9b4);});}}else{if(_0x1d9e26[_0x4d1e('0x16')]){return _0x199ea5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x1d9e26)[_0x4d1e('0x13')](function(){return _0x199ea5(null,_0x1d9e26);});}}}});})['catch'](function(_0x5736bb){return _0x199ea5(null,![],_0x5736bb);});}function sendServiceMail(_0x56de54){return db['MailAccount'][_0x4d1e('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x4d1e('0xc'),_0x4d1e('0x1f')],'include':[{'model':db[_0x4d1e('0x20')],'as':_0x4d1e('0x21')}]})['then'](function(_0x5289e8){if(!_0x5289e8){throw new Error(_0x4d1e('0x22'));}var _0x5e8bba={'tls':{'rejectUnauthorized':![]}};if(_0x5289e8[_0x4d1e('0x21')][_0x4d1e('0x23')]){_0x5e8bba[_0x4d1e('0x23')]=_0x5289e8[_0x4d1e('0x21')]['service'];}else{_0x5e8bba[_0x4d1e('0x24')]=_0x5289e8['Smtp'][_0x4d1e('0x24')];_0x5e8bba['port']=_0x5289e8['Smtp'][_0x4d1e('0x25')];_0x5e8bba['secure']=_0x5289e8[_0x4d1e('0x21')]['secure'];}if(_0x5289e8[_0x4d1e('0x21')]['authentication']){_0x5e8bba[_0x4d1e('0x26')]={'user':_0x5289e8[_0x4d1e('0x21')][_0x4d1e('0x27')],'pass':_0x5289e8[_0x4d1e('0x21')]['pass']};}var _0x4a48d6={'account':_0x5e8bba,'message':_['merge']({'from':util[_0x4d1e('0x28')](_0x4d1e('0x29'),_0x5289e8[_0x4d1e('0xc')],_0x5289e8[_0x4d1e('0x1f')]||_0x5289e8[_0x4d1e('0x21')][_0x4d1e('0x27')])},_0x56de54)};return client[_0x4d1e('0x2a')](_0x4d1e('0x2b'),_0x4a48d6);})[_0x4d1e('0x13')](function(_0x5ca399){if(_0x5ca399[_0x4d1e('0x2c')]){throw new Error(util[_0x4d1e('0x28')](_0x4d1e('0x2d'),_0x5ca399[_0x4d1e('0x2c')]['message']||JSON[_0x4d1e('0x2e')](_0x5ca399[_0x4d1e('0x2c')])));}return!![];});}function handleError(_0x2c532c,_0x50a142,_0x3bb923){return _0x2c532c[_0x4d1e('0x2f')](_0x50a142||0x1f4)[_0x4d1e('0x30')]({'message':_0x3bb923?_0x3bb923['message']||_0x3bb923:''});}exports[_0x4d1e('0x31')]=function(_0x2af849,_0x2823a1,_0x35bc1d){passport['authenticate'](_0x4d1e('0x32'),function(_0x57ff5c,_0x3668e8,_0x381725){var _0x416915=_0x57ff5c||_0x381725;if(_0x416915){return handleError(_0x2823a1,0x191,_0x416915);}if(!_0x3668e8){return handleError(_0x2823a1,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x388bd8={'payload':{'id':_0x3668e8['id'],'role':_0x3668e8[_0x4d1e('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x4d1e('0x33')](_0x388bd8)[_0x4d1e('0x13')](function(_0x22c3f0){_0x2823a1[_0x4d1e('0x34')]({'id':_0x3668e8['id'],'token':_0x22c3f0,'statusCall':'','isAlreadyLogged':_0x3668e8[_0x4d1e('0x35')]});});}})(_0x2af849,_0x2823a1,_0x35bc1d);};exports[_0x4d1e('0x36')]=function(_0x29c2a1,_0x59ee7a,_0x3382f7){if(!_0x29c2a1['body']['email']){return handleError(_0x59ee7a,0x1f4,{'message':_0x4d1e('0x37')});}var _0x5332fc=rs[_0x4d1e('0x38')]();_0x29c2a1[_0x4d1e('0x39')][_0x4d1e('0x1f')]=_0x29c2a1[_0x4d1e('0x39')][_0x4d1e('0x1f')][_0x4d1e('0x3a')]()[_0x4d1e('0x3b')]();var _0x47db86;return db[_0x4d1e('0x9')][_0x4d1e('0xb')]({'where':{'id':0x1},'attributes':[_0x4d1e('0xa'),_0x4d1e('0x18')],'raw':!![]})[_0x4d1e('0x13')](function(_0x3dcd53){_0x47db86=_0x3dcd53;return db[_0x4d1e('0x3c')][_0x4d1e('0x1e')]({'where':{'email':_0x29c2a1[_0x4d1e('0x39')]['email']}});})['then'](function(_0x27c5c7){if(!_0x27c5c7){throw new Error(_0x4d1e('0x3d'));}if(_0x27c5c7[_0x4d1e('0x10')]){throw new Error(_0x4d1e('0x3e'));}if(_0x27c5c7[_0x4d1e('0x16')]){if(moment(_0x27c5c7['blockedAt'])[_0x4d1e('0x1b')](_0x47db86[_0x4d1e('0x18')],_0x4d1e('0x19'))>moment()){throw new Error(_0x4d1e('0x3f'));}else{_0x27c5c7[_0x4d1e('0x16')]=![];_0x27c5c7['blockedAt']=null;}}_0x27c5c7[_0x4d1e('0x40')]=_0x5332fc;_0x27c5c7[_0x4d1e('0x41')]=Date[_0x4d1e('0x42')]()+0x36ee80;return _0x27c5c7[_0x4d1e('0x43')]();})[_0x4d1e('0x13')](function(){return sendServiceMail({'to':_0x29c2a1[_0x4d1e('0x39')][_0x4d1e('0x1f')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x4d1e('0x44')+'https://'+_0x29c2a1[_0x4d1e('0x45')]['host']+_0x4d1e('0x46')+_0x5332fc+'\x0a\x0a'+_0x4d1e('0x47')});})[_0x4d1e('0x13')](function(){_0x59ee7a['status'](0xc8)[_0x4d1e('0x30')]({'message':'Reset\x20Email\x20sent!'});})[_0x4d1e('0x1d')](function(_0x1bcc23){return handleError(_0x59ee7a,0x1f4,_0x1bcc23);});};exports[_0x4d1e('0x48')]=function(_0x42d633,_0x54aa0a,_0x36ecf4){return db['User'][_0x4d1e('0x1e')]({'where':{'resetPasswordToken':_0x42d633[_0x4d1e('0x49')][_0x4d1e('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x4d1e('0x42')]()}}})[_0x4d1e('0x13')](function(_0xf0f351){if(!_0xf0f351){throw new Error(_0x4d1e('0x4b'));}return db[_0x4d1e('0x9')][_0x4d1e('0xb')]({'attributes':['id',_0x4d1e('0x4c'),_0x4d1e('0x4d'),_0x4d1e('0x4e')]})[_0x4d1e('0x13')](function(_0x421226){if(_0x421226[_0x4d1e('0x4c')])authService[_0x4d1e('0x4f')](_0x42d633[_0x4d1e('0x39')][_0x4d1e('0xd')]);if(!_0x421226[_0x4d1e('0x4d')]||!_0xf0f351[_0x4d1e('0x50')])return _0xf0f351;authService[_0x4d1e('0x51')](_0x42d633[_0x4d1e('0x39')][_0x4d1e('0xd')],_0xf0f351[_0x4d1e('0x50')],_0x421226[_0x4d1e('0x4e')]);return _0xf0f351;})[_0x4d1e('0x13')](function(){_0xf0f351[_0x4d1e('0xd')]=_0x42d633[_0x4d1e('0x39')][_0x4d1e('0xd')];_0xf0f351[_0x4d1e('0x40')]=null;_0xf0f351[_0x4d1e('0x41')]=null;return _0xf0f351['save']();});})['then'](function(){_0x54aa0a[_0x4d1e('0x2f')](0xc8)[_0x4d1e('0x30')]({'message':_0x4d1e('0x52')});})[_0x4d1e('0x1d')](function(_0x1951d1){return handleError(_0x54aa0a,0x1f4,_0x1951d1);});};passport['use'](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x4a0359,_0x4dd45b,_0x2a9c10){return localAuthenticate(db['User'],_0x4a0359,_0x4dd45b,_0x2a9c10);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 98a7a68..96c1e37 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 _0x9bc7=['/reset/:token','reset','express','Router','./authLocal.controller','post','login','forgot'];(function(_0x4737ac,_0x2936c7){var _0x20c463=function(_0x417ba5){while(--_0x417ba5){_0x4737ac['push'](_0x4737ac['shift']());}};_0x20c463(++_0x2936c7);}(_0x9bc7,0xba));var _0x79bc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9bc7[_0x397e5f];return _0x5302b8;};'use strict';var express=require(_0x79bc('0x0'));var router=express[_0x79bc('0x1')]();var controller=require(_0x79bc('0x2'));router[_0x79bc('0x3')]('/',controller[_0x79bc('0x4')]);router['post']('/forgot',controller[_0x79bc('0x5')]);router['post'](_0x79bc('0x6'),controller[_0x79bc('0x7')]);module['exports']=router; \ No newline at end of file +var _0x7b5a=['/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller'];(function(_0x104dd1,_0x1761f7){var _0x1fc831=function(_0x17ccfc){while(--_0x17ccfc){_0x104dd1['push'](_0x104dd1['shift']());}};_0x1fc831(++_0x1761f7);}(_0x7b5a,0xed));var _0xa7b5=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x7b5a[_0x46efd7];return _0x5637e4;};'use strict';var express=require(_0xa7b5('0x0'));var router=express[_0xa7b5('0x1')]();var controller=require(_0xa7b5('0x2'));router['post']('/',controller['login']);router['post'](_0xa7b5('0x3'),controller[_0xa7b5('0x4')]);router['post'](_0xa7b5('0x5'),controller[_0xa7b5('0x6')]);module[_0xa7b5('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index c6146cf..8d66d86 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 _0x13ea=['INTEGER','sequelize','exports','STRING'];(function(_0x430e18,_0x11a95c){var _0x58ef3e=function(_0x3af7c8){while(--_0x3af7c8){_0x430e18['push'](_0x430e18['shift']());}};_0x58ef3e(++_0x11a95c);}(_0x13ea,0x181));var _0xa13e=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0x13ea[_0x553a87];return _0x12d1e6;};'use strict';var Sequelize=require(_0xa13e('0x0'));module[_0xa13e('0x1')]={'name':{'type':Sequelize[_0xa13e('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xa13e('0x2')]},'description':{'type':Sequelize[_0xa13e('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa13e('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x529a=['exports','STRING','INTEGER','sequelize'];(function(_0x3483e3,_0x26a004){var _0x2f8465=function(_0x49bc2c){while(--_0x49bc2c){_0x3483e3['push'](_0x3483e3['shift']());}};_0x2f8465(++_0x26a004);}(_0x529a,0x67));var _0xa529=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x529a[_0x5cbf0e];return _0x1c76f8;};'use strict';var Sequelize=require(_0xa529('0x0'));module[_0xa529('0x1')]={'name':{'type':Sequelize[_0xa529('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa529('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 beee5a9..765894e 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 _0xad02=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','Automation','rawAttributes','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','order','addActions','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis'];(function(_0x265285,_0x2b534b){var _0x51da95=function(_0x756dbd){while(--_0x756dbd){_0x265285['push'](_0x265285['shift']());}};_0x51da95(++_0x2b534b);}(_0xad02,0x91));var _0x2ad0=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xad02[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ad0('0x0'));var zipdir=require(_0x2ad0('0x1'));var jsonpatch=require(_0x2ad0('0x2'));var rp=require(_0x2ad0('0x3'));var moment=require('moment');var BPromise=require(_0x2ad0('0x4'));var Mustache=require(_0x2ad0('0x5'));var util=require(_0x2ad0('0x6'));var path=require('path');var sox=require(_0x2ad0('0x7'));var csv=require(_0x2ad0('0x8'));var ejs=require(_0x2ad0('0x9'));var fs=require('fs');var fs_extra=require(_0x2ad0('0xa'));var _=require(_0x2ad0('0xb'));var squel=require(_0x2ad0('0xc'));var crypto=require(_0x2ad0('0xd'));var jsforce=require(_0x2ad0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2ad0('0x8'));var querystring=require(_0x2ad0('0xf'));var Papa=require('papaparse');var Redis=require(_0x2ad0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2ad0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ad0('0x12'));var logger=require(_0x2ad0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2ad0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ad0('0x15'))['db'];function respondWithStatusCode(_0x51d8fb,_0x5e360e){_0x5e360e=_0x5e360e||0xcc;return function(_0x1833c6){if(_0x1833c6){return _0x51d8fb['sendStatus'](_0x5e360e);}return _0x51d8fb[_0x2ad0('0x16')](_0x5e360e)[_0x2ad0('0x17')]();};}function respondWithResult(_0x4140dc,_0x354a26){_0x354a26=_0x354a26||0xc8;return function(_0x18ac38){if(_0x18ac38){return _0x4140dc[_0x2ad0('0x16')](_0x354a26)[_0x2ad0('0x18')](_0x18ac38);}};}function respondWithFilteredResult(_0x8bb893,_0x409707){return function(_0x19c26a){if(_0x19c26a){var _0x2842f1=typeof _0x409707[_0x2ad0('0x19')]==='undefined'&&typeof _0x409707[_0x2ad0('0x1a')]==='undefined';var _0x4e5bef=_0x19c26a['count'];var _0x5aa20e=_0x2842f1?0x0:_0x409707['offset'];var _0x388f97=_0x2842f1?_0x19c26a[_0x2ad0('0x1b')]:_0x409707['offset']+_0x409707[_0x2ad0('0x1a')];var _0x2f2c6b;if(_0x388f97>=_0x4e5bef){_0x388f97=_0x4e5bef;_0x2f2c6b=0xc8;}else{_0x2f2c6b=0xce;}_0x8bb893[_0x2ad0('0x16')](_0x2f2c6b);return _0x8bb893[_0x2ad0('0x1c')](_0x2ad0('0x1d'),_0x5aa20e+'-'+_0x388f97+'/'+_0x4e5bef)[_0x2ad0('0x18')](_0x19c26a);}return null;};}function patchUpdates(_0x18bcc7){return function(_0x3bb768){try{jsonpatch[_0x2ad0('0x1e')](_0x3bb768,_0x18bcc7,!![]);}catch(_0x441c7b){return BPromise['reject'](_0x441c7b);}return _0x3bb768[_0x2ad0('0x1f')]();};}function saveUpdates(_0x38711c,_0xdce4c5){return function(_0x4a2ec6){if(_0x4a2ec6){return _0x4a2ec6[_0x2ad0('0x20')](_0x38711c)[_0x2ad0('0x21')](function(_0x27d1f8){return _0x27d1f8;});}return null;};}function removeEntity(_0x29064d,_0x660878){return function(_0x199f58){if(_0x199f58){return _0x199f58[_0x2ad0('0x22')]()['then'](function(){_0x29064d[_0x2ad0('0x16')](0xcc)[_0x2ad0('0x17')]();});}};}function handleEntityNotFound(_0x1edace,_0x1bab0f){return function(_0x2f6d70){if(!_0x2f6d70){_0x1edace[_0x2ad0('0x23')](0x194);}return _0x2f6d70;};}function handleError(_0x569a96,_0x2aa8d4){_0x2aa8d4=_0x2aa8d4||0x1f4;return function(_0x62df07){logger[_0x2ad0('0x24')](_0x62df07['stack']);if(_0x62df07[_0x2ad0('0x25')]){delete _0x62df07[_0x2ad0('0x25')];}_0x569a96[_0x2ad0('0x16')](_0x2aa8d4)[_0x2ad0('0x26')](_0x62df07);};}exports['index']=function(_0x1c0a85,_0x22c12a){var _0x251d38={},_0x16c530={},_0x500636={'count':0x0,'rows':[]};var _0x360d91=_['map'](db[_0x2ad0('0x27')][_0x2ad0('0x28')],function(_0x386918){return{'name':_0x386918['fieldName'],'type':_0x386918['type'][_0x2ad0('0x29')]};});_0x16c530[_0x2ad0('0x2a')]=_['map'](_0x360d91,'name');_0x16c530['query']=_[_0x2ad0('0x2b')](_0x1c0a85['query']);_0x16c530[_0x2ad0('0x2c')]=_['intersection'](_0x16c530[_0x2ad0('0x2a')],_0x16c530[_0x2ad0('0x2d')]);_0x251d38[_0x2ad0('0x2e')]=_[_0x2ad0('0x2f')](_0x16c530['model'],qs['fields'](_0x1c0a85[_0x2ad0('0x2d')][_0x2ad0('0x30')]));_0x251d38['attributes']=_0x251d38[_0x2ad0('0x2e')][_0x2ad0('0x31')]?_0x251d38[_0x2ad0('0x2e')]:_0x16c530[_0x2ad0('0x2a')];if(!_0x1c0a85[_0x2ad0('0x2d')][_0x2ad0('0x32')](_0x2ad0('0x33'))){_0x251d38[_0x2ad0('0x1a')]=qs[_0x2ad0('0x1a')](_0x1c0a85[_0x2ad0('0x2d')]['limit']);_0x251d38[_0x2ad0('0x19')]=qs['offset'](_0x1c0a85['query'][_0x2ad0('0x19')]);}_0x251d38['order']=qs['sort'](_0x1c0a85[_0x2ad0('0x2d')][_0x2ad0('0x34')]);_0x251d38[_0x2ad0('0x35')]=qs[_0x2ad0('0x2c')](_[_0x2ad0('0x36')](_0x1c0a85[_0x2ad0('0x2d')],_0x16c530[_0x2ad0('0x2c')]),_0x360d91);if(_0x1c0a85[_0x2ad0('0x2d')][_0x2ad0('0x37')]){_0x251d38['where']=_[_0x2ad0('0x38')](_0x251d38['where'],{'$or':_[_0x2ad0('0x39')](_0x360d91,function(_0x28d949){if(_0x28d949[_0x2ad0('0x3a')]!==_0x2ad0('0x3b')){var _0x156857={};_0x156857[_0x28d949['name']]={'$like':'%'+_0x1c0a85[_0x2ad0('0x2d')][_0x2ad0('0x37')]+'%'};return _0x156857;}})});}_0x251d38=_['merge']({},_0x251d38,_0x1c0a85[_0x2ad0('0x3c')]);var _0x5bbfae={'where':_0x251d38['where']};return db[_0x2ad0('0x27')]['count'](_0x5bbfae)[_0x2ad0('0x21')](function(_0x5cc67e){_0x500636['count']=_0x5cc67e;if(_0x1c0a85[_0x2ad0('0x2d')][_0x2ad0('0x3d')]){_0x251d38[_0x2ad0('0x3e')]=[{'all':!![]}];}return db['Automation'][_0x2ad0('0x3f')](_0x251d38);})[_0x2ad0('0x21')](function(_0x442034){_0x500636[_0x2ad0('0x40')]=_0x442034;return _0x500636;})[_0x2ad0('0x21')](respondWithFilteredResult(_0x22c12a,_0x251d38))[_0x2ad0('0x41')](handleError(_0x22c12a,null));};exports[_0x2ad0('0x42')]=function(_0x4d26dd,_0x30cccf){var _0xed7c10={'raw':![],'where':{'id':_0x4d26dd[_0x2ad0('0x43')]['id']}},_0x1e79d7={};_0x1e79d7[_0x2ad0('0x2a')]=_[_0x2ad0('0x2b')](db['Automation'][_0x2ad0('0x28')]);_0x1e79d7['query']=_[_0x2ad0('0x2b')](_0x4d26dd[_0x2ad0('0x2d')]);_0x1e79d7[_0x2ad0('0x2c')]=_[_0x2ad0('0x2f')](_0x1e79d7[_0x2ad0('0x2a')],_0x1e79d7[_0x2ad0('0x2d')]);_0xed7c10[_0x2ad0('0x2e')]=_[_0x2ad0('0x2f')](_0x1e79d7[_0x2ad0('0x2a')],qs[_0x2ad0('0x30')](_0x4d26dd[_0x2ad0('0x2d')]['fields']));_0xed7c10[_0x2ad0('0x2e')]=_0xed7c10[_0x2ad0('0x2e')][_0x2ad0('0x31')]?_0xed7c10[_0x2ad0('0x2e')]:_0x1e79d7[_0x2ad0('0x2a')];if(_0x4d26dd[_0x2ad0('0x2d')][_0x2ad0('0x3d')]){_0xed7c10['include']=[{'all':!![]}];}_0xed7c10=_[_0x2ad0('0x38')]({},_0xed7c10,_0x4d26dd[_0x2ad0('0x3c')]);return db['Automation'][_0x2ad0('0x44')](_0xed7c10)['then'](handleEntityNotFound(_0x30cccf,null))[_0x2ad0('0x21')](respondWithResult(_0x30cccf,null))['catch'](handleError(_0x30cccf,null));};exports[_0x2ad0('0x45')]=function(_0x102db2,_0x46b882){return db[_0x2ad0('0x27')][_0x2ad0('0x45')](_0x102db2['body'],{})['then'](respondWithResult(_0x46b882,0xc9))[_0x2ad0('0x41')](handleError(_0x46b882,null));};exports[_0x2ad0('0x20')]=function(_0x458016,_0x465800){if(_0x458016[_0x2ad0('0x46')]['id']){delete _0x458016['body']['id'];}return db['Automation'][_0x2ad0('0x44')]({'where':{'id':_0x458016[_0x2ad0('0x43')]['id']}})[_0x2ad0('0x21')](handleEntityNotFound(_0x465800,null))[_0x2ad0('0x21')](saveUpdates(_0x458016[_0x2ad0('0x46')],null))[_0x2ad0('0x21')](respondWithResult(_0x465800,null))[_0x2ad0('0x41')](handleError(_0x465800,null));};exports[_0x2ad0('0x22')]=function(_0x1ac15a,_0x5b78c6){return db[_0x2ad0('0x27')][_0x2ad0('0x44')]({'where':{'id':_0x1ac15a['params']['id']}})[_0x2ad0('0x21')](handleEntityNotFound(_0x5b78c6,null))[_0x2ad0('0x21')](removeEntity(_0x5b78c6,null))[_0x2ad0('0x41')](handleError(_0x5b78c6,null));};exports[_0x2ad0('0x47')]=function(_0x3cb11c,_0x567335,_0x3f37ad){return db[_0x2ad0('0x48')]['find']({'where':{'id':_0x3cb11c[_0x2ad0('0x43')]['id']}})[_0x2ad0('0x21')](handleEntityNotFound(_0x567335,null))[_0x2ad0('0x21')](function(_0x2a0f31){if(_0x2a0f31){return _0x2a0f31[_0x2ad0('0x47')](_0x3cb11c[_0x2ad0('0x46')][_0x2ad0('0x49')],_[_0x2ad0('0x4a')](_0x3cb11c[_0x2ad0('0x46')],[_0x2ad0('0x49'),'id'])||{});}})['then'](respondWithResult(_0x567335,null))[_0x2ad0('0x41')](handleError(_0x567335,null));};exports[_0x2ad0('0x4b')]=function(_0x1ffb34,_0x4c8f0d,_0x5dc800){var _0x34fc35={};var _0x318060={};var _0x28f5ba;var _0xe4f19c;return db[_0x2ad0('0x27')][_0x2ad0('0x4c')]({'where':{'id':_0x1ffb34[_0x2ad0('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c8f0d,null))['then'](function(_0x3298a5){if(_0x3298a5){_0x28f5ba=_0x3298a5;_0x318060[_0x2ad0('0x2a')]=_['keys'](db[_0x2ad0('0x48')][_0x2ad0('0x28')]);_0x318060['query']=_['keys'](_0x1ffb34[_0x2ad0('0x2d')]);_0x318060[_0x2ad0('0x2c')]=_[_0x2ad0('0x2f')](_0x318060[_0x2ad0('0x2a')],_0x318060[_0x2ad0('0x2d')]);_0x34fc35[_0x2ad0('0x2e')]=_['intersection'](_0x318060['model'],qs[_0x2ad0('0x30')](_0x1ffb34[_0x2ad0('0x2d')][_0x2ad0('0x30')]));_0x34fc35[_0x2ad0('0x2e')]=_0x34fc35[_0x2ad0('0x2e')][_0x2ad0('0x31')]?_0x34fc35[_0x2ad0('0x2e')]:_0x318060[_0x2ad0('0x2a')];_0x34fc35[_0x2ad0('0x4d')]=qs[_0x2ad0('0x34')](_0x1ffb34[_0x2ad0('0x2d')]['sort']);_0x34fc35[_0x2ad0('0x35')]=qs[_0x2ad0('0x2c')](_[_0x2ad0('0x36')](_0x1ffb34[_0x2ad0('0x2d')],_0x318060[_0x2ad0('0x2c')]));if(_0x1ffb34[_0x2ad0('0x2d')]['filter']){_0x34fc35[_0x2ad0('0x35')]=_[_0x2ad0('0x38')](_0x34fc35[_0x2ad0('0x35')],{'$or':_[_0x2ad0('0x39')](_0x34fc35[_0x2ad0('0x2e')],function(_0x4935eb){var _0x3e96e2={};_0x3e96e2[_0x4935eb]={'$like':'%'+_0x1ffb34['query']['filter']+'%'};return _0x3e96e2;})});}_0x34fc35=_[_0x2ad0('0x38')]({},_0x34fc35,_0x1ffb34[_0x2ad0('0x3c')]);return _0x28f5ba[_0x2ad0('0x4b')](_0x34fc35);}})[_0x2ad0('0x21')](function(_0x51eccc){if(_0x51eccc){_0xe4f19c=_0x51eccc[_0x2ad0('0x31')];if(!_0x1ffb34['query'][_0x2ad0('0x32')](_0x2ad0('0x33'))){_0x34fc35[_0x2ad0('0x1a')]=qs[_0x2ad0('0x1a')](_0x1ffb34['query'][_0x2ad0('0x1a')]);_0x34fc35['offset']=qs['offset'](_0x1ffb34[_0x2ad0('0x2d')][_0x2ad0('0x19')]);}return _0x28f5ba[_0x2ad0('0x4b')](_0x34fc35);}})['then'](function(_0x5b81ea){if(_0x5b81ea){return _0x5b81ea?{'count':_0xe4f19c,'rows':_0x5b81ea}:null;}})[_0x2ad0('0x21')](respondWithResult(_0x4c8f0d,null))[_0x2ad0('0x41')](handleError(_0x4c8f0d,null));};exports[_0x2ad0('0x4e')]=function(_0x36835,_0x318b9d,_0x3e83a1){return db[_0x2ad0('0x4f')][_0x2ad0('0x44')]({'where':{'id':_0x36835[_0x2ad0('0x43')]['id']}})[_0x2ad0('0x21')](handleEntityNotFound(_0x318b9d,null))[_0x2ad0('0x21')](function(_0x2e9ca3){if(_0x2e9ca3){return _0x2e9ca3['addActions'](_0x36835[_0x2ad0('0x46')][_0x2ad0('0x49')],_[_0x2ad0('0x4a')](_0x36835['body'],[_0x2ad0('0x49'),'id'])||{});}})[_0x2ad0('0x21')](respondWithResult(_0x318b9d,null))[_0x2ad0('0x41')](handleError(_0x318b9d,null));};exports[_0x2ad0('0x50')]=function(_0x3c85ca,_0x12cca6,_0x668800){var _0x598804={};var _0x460dc5={};var _0x32c8e4;var _0x389540;return db[_0x2ad0('0x27')]['findOne']({'where':{'id':_0x3c85ca[_0x2ad0('0x43')]['id']}})[_0x2ad0('0x21')](handleEntityNotFound(_0x12cca6,null))[_0x2ad0('0x21')](function(_0x180875){if(_0x180875){_0x32c8e4=_0x180875;_0x460dc5['model']=_[_0x2ad0('0x2b')](db[_0x2ad0('0x4f')]['rawAttributes']);_0x460dc5[_0x2ad0('0x2d')]=_['keys'](_0x3c85ca[_0x2ad0('0x2d')]);_0x460dc5[_0x2ad0('0x2c')]=_['intersection'](_0x460dc5[_0x2ad0('0x2a')],_0x460dc5[_0x2ad0('0x2d')]);_0x598804[_0x2ad0('0x2e')]=_[_0x2ad0('0x2f')](_0x460dc5['model'],qs['fields'](_0x3c85ca[_0x2ad0('0x2d')]['fields']));_0x598804['attributes']=_0x598804['attributes'][_0x2ad0('0x31')]?_0x598804[_0x2ad0('0x2e')]:_0x460dc5[_0x2ad0('0x2a')];_0x598804[_0x2ad0('0x4d')]=qs['sort'](_0x3c85ca[_0x2ad0('0x2d')][_0x2ad0('0x34')]);_0x598804[_0x2ad0('0x35')]=qs[_0x2ad0('0x2c')](_[_0x2ad0('0x36')](_0x3c85ca[_0x2ad0('0x2d')],_0x460dc5[_0x2ad0('0x2c')]));if(_0x3c85ca['query'][_0x2ad0('0x37')]){_0x598804['where']=_['merge'](_0x598804[_0x2ad0('0x35')],{'$or':_[_0x2ad0('0x39')](_0x598804[_0x2ad0('0x2e')],function(_0x35781c){var _0x4b69c9={};_0x4b69c9[_0x35781c]={'$like':'%'+_0x3c85ca[_0x2ad0('0x2d')][_0x2ad0('0x37')]+'%'};return _0x4b69c9;})});}_0x598804=_[_0x2ad0('0x38')]({},_0x598804,_0x3c85ca[_0x2ad0('0x3c')]);return _0x32c8e4['getActions'](_0x598804);}})['then'](function(_0x1e1591){if(_0x1e1591){_0x389540=_0x1e1591[_0x2ad0('0x31')];if(!_0x3c85ca[_0x2ad0('0x2d')][_0x2ad0('0x32')]('nolimit')){_0x598804[_0x2ad0('0x1a')]=qs[_0x2ad0('0x1a')](_0x3c85ca[_0x2ad0('0x2d')][_0x2ad0('0x1a')]);_0x598804[_0x2ad0('0x19')]=qs[_0x2ad0('0x19')](_0x3c85ca[_0x2ad0('0x2d')]['offset']);}return _0x32c8e4[_0x2ad0('0x50')](_0x598804);}})[_0x2ad0('0x21')](function(_0x362b86){if(_0x362b86){return _0x362b86?{'count':_0x389540,'rows':_0x362b86}:null;}})[_0x2ad0('0x21')](respondWithResult(_0x12cca6,null))[_0x2ad0('0x41')](handleError(_0x12cca6,null));}; \ No newline at end of file +var _0xba74=['Content-Range','apply','reject','save','then','stack','name','send','index','map','Automation','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','addConditions','Condition','omit','ids','getConditions','findOne','pick','merge','addActions','Action','getActions','hasOwnProperty','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x3e6370,_0x72cdbe){var _0x349dd7=function(_0x223971){while(--_0x223971){_0x3e6370['push'](_0x3e6370['shift']());}};_0x349dd7(++_0x72cdbe);}(_0xba74,0x88));var _0x4ba7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xba74[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ba7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ba7('0x1'));var rp=require(_0x4ba7('0x2'));var moment=require(_0x4ba7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4ba7('0x4'));var util=require(_0x4ba7('0x5'));var path=require(_0x4ba7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ba7('0x7'));var _=require('lodash');var squel=require(_0x4ba7('0x8'));var crypto=require('crypto');var jsforce=require(_0x4ba7('0x9'));var deskjs=require(_0x4ba7('0xa'));var toCsv=require(_0x4ba7('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4ba7('0xc'));var authService=require(_0x4ba7('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4ba7('0xe'));var hardwareService=require(_0x4ba7('0xf'));var logger=require(_0x4ba7('0x10'))(_0x4ba7('0x11'));var utils=require(_0x4ba7('0x12'));var config=require(_0x4ba7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ba7('0x14'))['db'];function respondWithStatusCode(_0x357639,_0x33d1e8){_0x33d1e8=_0x33d1e8||0xcc;return function(_0x114449){if(_0x114449){return _0x357639[_0x4ba7('0x15')](_0x33d1e8);}return _0x357639[_0x4ba7('0x16')](_0x33d1e8)[_0x4ba7('0x17')]();};}function respondWithResult(_0x5aea5c,_0x1089a6){_0x1089a6=_0x1089a6||0xc8;return function(_0x1831a6){if(_0x1831a6){return _0x5aea5c[_0x4ba7('0x16')](_0x1089a6)[_0x4ba7('0x18')](_0x1831a6);}};}function respondWithFilteredResult(_0x176977,_0xa6b7dc){return function(_0x5357c4){if(_0x5357c4){var _0x46a5d7=typeof _0xa6b7dc[_0x4ba7('0x19')]===_0x4ba7('0x1a')&&typeof _0xa6b7dc['limit']===_0x4ba7('0x1a');var _0x4cf728=_0x5357c4[_0x4ba7('0x1b')];var _0x3e7b62=_0x46a5d7?0x0:_0xa6b7dc[_0x4ba7('0x19')];var _0x55ca2f=_0x46a5d7?_0x5357c4[_0x4ba7('0x1b')]:_0xa6b7dc[_0x4ba7('0x19')]+_0xa6b7dc[_0x4ba7('0x1c')];var _0x5133a5;if(_0x55ca2f>=_0x4cf728){_0x55ca2f=_0x4cf728;_0x5133a5=0xc8;}else{_0x5133a5=0xce;}_0x176977[_0x4ba7('0x16')](_0x5133a5);return _0x176977[_0x4ba7('0x1d')](_0x4ba7('0x1e'),_0x3e7b62+'-'+_0x55ca2f+'/'+_0x4cf728)['json'](_0x5357c4);}return null;};}function patchUpdates(_0x18220e){return function(_0x202ebc){try{jsonpatch[_0x4ba7('0x1f')](_0x202ebc,_0x18220e,!![]);}catch(_0x39de41){return BPromise[_0x4ba7('0x20')](_0x39de41);}return _0x202ebc[_0x4ba7('0x21')]();};}function saveUpdates(_0x2b8d2a,_0xc33e7e){return function(_0x46d7b7){if(_0x46d7b7){return _0x46d7b7['update'](_0x2b8d2a)[_0x4ba7('0x22')](function(_0x3e975d){return _0x3e975d;});}return null;};}function removeEntity(_0x579698,_0x315553){return function(_0x1da223){if(_0x1da223){return _0x1da223['destroy']()[_0x4ba7('0x22')](function(){_0x579698[_0x4ba7('0x16')](0xcc)[_0x4ba7('0x17')]();});}};}function handleEntityNotFound(_0x1ea3f8,_0xb6adab){return function(_0x3a1341){if(!_0x3a1341){_0x1ea3f8['sendStatus'](0x194);}return _0x3a1341;};}function handleError(_0x30870a,_0x5a8dc8){_0x5a8dc8=_0x5a8dc8||0x1f4;return function(_0x1f3d71){logger['error'](_0x1f3d71[_0x4ba7('0x23')]);if(_0x1f3d71[_0x4ba7('0x24')]){delete _0x1f3d71[_0x4ba7('0x24')];}_0x30870a[_0x4ba7('0x16')](_0x5a8dc8)[_0x4ba7('0x25')](_0x1f3d71);};}exports[_0x4ba7('0x26')]=function(_0x1376b2,_0x7e6177){var _0x3795f7={},_0x4e19fb={},_0x52048b={'count':0x0,'rows':[]};var _0x437f12=_[_0x4ba7('0x27')](db[_0x4ba7('0x28')]['rawAttributes'],function(_0x44b6b2){return{'name':_0x44b6b2[_0x4ba7('0x29')],'type':_0x44b6b2[_0x4ba7('0x2a')][_0x4ba7('0x2b')]};});_0x4e19fb['model']=_['map'](_0x437f12,_0x4ba7('0x24'));_0x4e19fb[_0x4ba7('0x2c')]=_[_0x4ba7('0x2d')](_0x1376b2['query']);_0x4e19fb['filters']=_[_0x4ba7('0x2e')](_0x4e19fb[_0x4ba7('0x2f')],_0x4e19fb['query']);_0x3795f7[_0x4ba7('0x30')]=_[_0x4ba7('0x2e')](_0x4e19fb[_0x4ba7('0x2f')],qs[_0x4ba7('0x31')](_0x1376b2['query'][_0x4ba7('0x31')]));_0x3795f7[_0x4ba7('0x30')]=_0x3795f7[_0x4ba7('0x30')][_0x4ba7('0x32')]?_0x3795f7['attributes']:_0x4e19fb[_0x4ba7('0x2f')];if(!_0x1376b2[_0x4ba7('0x2c')]['hasOwnProperty'](_0x4ba7('0x33'))){_0x3795f7[_0x4ba7('0x1c')]=qs[_0x4ba7('0x1c')](_0x1376b2['query'][_0x4ba7('0x1c')]);_0x3795f7[_0x4ba7('0x19')]=qs['offset'](_0x1376b2[_0x4ba7('0x2c')][_0x4ba7('0x19')]);}_0x3795f7[_0x4ba7('0x34')]=qs[_0x4ba7('0x35')](_0x1376b2[_0x4ba7('0x2c')]['sort']);_0x3795f7[_0x4ba7('0x36')]=qs[_0x4ba7('0x37')](_['pick'](_0x1376b2[_0x4ba7('0x2c')],_0x4e19fb[_0x4ba7('0x37')]),_0x437f12);if(_0x1376b2[_0x4ba7('0x2c')][_0x4ba7('0x38')]){_0x3795f7[_0x4ba7('0x36')]=_['merge'](_0x3795f7[_0x4ba7('0x36')],{'$or':_[_0x4ba7('0x27')](_0x437f12,function(_0x3f4ec3){if(_0x3f4ec3[_0x4ba7('0x2a')]!==_0x4ba7('0x39')){var _0x376b81={};_0x376b81[_0x3f4ec3['name']]={'$like':'%'+_0x1376b2[_0x4ba7('0x2c')]['filter']+'%'};return _0x376b81;}})});}_0x3795f7=_['merge']({},_0x3795f7,_0x1376b2[_0x4ba7('0x3a')]);var _0x382a0f={'where':_0x3795f7['where']};return db[_0x4ba7('0x28')][_0x4ba7('0x1b')](_0x382a0f)['then'](function(_0xbfec50){_0x52048b[_0x4ba7('0x1b')]=_0xbfec50;if(_0x1376b2[_0x4ba7('0x2c')][_0x4ba7('0x3b')]){_0x3795f7[_0x4ba7('0x3c')]=[{'all':!![]}];}return db[_0x4ba7('0x28')][_0x4ba7('0x3d')](_0x3795f7);})['then'](function(_0x2f152f){_0x52048b[_0x4ba7('0x3e')]=_0x2f152f;return _0x52048b;})[_0x4ba7('0x22')](respondWithFilteredResult(_0x7e6177,_0x3795f7))[_0x4ba7('0x3f')](handleError(_0x7e6177,null));};exports[_0x4ba7('0x40')]=function(_0x5d8174,_0x1d4cb6){var _0x55a748={'raw':![],'where':{'id':_0x5d8174[_0x4ba7('0x41')]['id']}},_0xeb5989={};_0xeb5989[_0x4ba7('0x2f')]=_[_0x4ba7('0x2d')](db['Automation'][_0x4ba7('0x42')]);_0xeb5989[_0x4ba7('0x2c')]=_[_0x4ba7('0x2d')](_0x5d8174[_0x4ba7('0x2c')]);_0xeb5989[_0x4ba7('0x37')]=_['intersection'](_0xeb5989[_0x4ba7('0x2f')],_0xeb5989[_0x4ba7('0x2c')]);_0x55a748['attributes']=_[_0x4ba7('0x2e')](_0xeb5989[_0x4ba7('0x2f')],qs[_0x4ba7('0x31')](_0x5d8174[_0x4ba7('0x2c')][_0x4ba7('0x31')]));_0x55a748[_0x4ba7('0x30')]=_0x55a748['attributes'][_0x4ba7('0x32')]?_0x55a748[_0x4ba7('0x30')]:_0xeb5989['model'];if(_0x5d8174[_0x4ba7('0x2c')][_0x4ba7('0x3b')]){_0x55a748[_0x4ba7('0x3c')]=[{'all':!![]}];}_0x55a748=_['merge']({},_0x55a748,_0x5d8174[_0x4ba7('0x3a')]);return db[_0x4ba7('0x28')][_0x4ba7('0x43')](_0x55a748)[_0x4ba7('0x22')](handleEntityNotFound(_0x1d4cb6,null))[_0x4ba7('0x22')](respondWithResult(_0x1d4cb6,null))[_0x4ba7('0x3f')](handleError(_0x1d4cb6,null));};exports[_0x4ba7('0x44')]=function(_0x422758,_0x73281c){return db[_0x4ba7('0x28')][_0x4ba7('0x44')](_0x422758['body'],{})[_0x4ba7('0x22')](respondWithResult(_0x73281c,0xc9))[_0x4ba7('0x3f')](handleError(_0x73281c,null));};exports['update']=function(_0x196e3e,_0x3051cc){if(_0x196e3e[_0x4ba7('0x45')]['id']){delete _0x196e3e[_0x4ba7('0x45')]['id'];}return db[_0x4ba7('0x28')][_0x4ba7('0x43')]({'where':{'id':_0x196e3e['params']['id']}})['then'](handleEntityNotFound(_0x3051cc,null))[_0x4ba7('0x22')](saveUpdates(_0x196e3e[_0x4ba7('0x45')],null))['then'](respondWithResult(_0x3051cc,null))[_0x4ba7('0x3f')](handleError(_0x3051cc,null));};exports[_0x4ba7('0x46')]=function(_0x426095,_0x57eff7){return db[_0x4ba7('0x28')][_0x4ba7('0x43')]({'where':{'id':_0x426095['params']['id']}})[_0x4ba7('0x22')](handleEntityNotFound(_0x57eff7,null))[_0x4ba7('0x22')](removeEntity(_0x57eff7,null))[_0x4ba7('0x3f')](handleError(_0x57eff7,null));};exports[_0x4ba7('0x47')]=function(_0x44a60a,_0x54e029,_0xf4acc){return db[_0x4ba7('0x48')][_0x4ba7('0x43')]({'where':{'id':_0x44a60a[_0x4ba7('0x41')]['id']}})['then'](handleEntityNotFound(_0x54e029,null))[_0x4ba7('0x22')](function(_0x404fe9){if(_0x404fe9){return _0x404fe9[_0x4ba7('0x47')](_0x44a60a[_0x4ba7('0x45')]['ids'],_[_0x4ba7('0x49')](_0x44a60a['body'],[_0x4ba7('0x4a'),'id'])||{});}})[_0x4ba7('0x22')](respondWithResult(_0x54e029,null))[_0x4ba7('0x3f')](handleError(_0x54e029,null));};exports[_0x4ba7('0x4b')]=function(_0xafe98a,_0x569b8e,_0x488431){var _0x15d570={};var _0x15141e={};var _0x323599;var _0x45d4ab;return db[_0x4ba7('0x28')][_0x4ba7('0x4c')]({'where':{'id':_0xafe98a[_0x4ba7('0x41')]['id']}})[_0x4ba7('0x22')](handleEntityNotFound(_0x569b8e,null))[_0x4ba7('0x22')](function(_0x42d633){if(_0x42d633){_0x323599=_0x42d633;_0x15141e[_0x4ba7('0x2f')]=_[_0x4ba7('0x2d')](db[_0x4ba7('0x48')][_0x4ba7('0x42')]);_0x15141e[_0x4ba7('0x2c')]=_[_0x4ba7('0x2d')](_0xafe98a[_0x4ba7('0x2c')]);_0x15141e[_0x4ba7('0x37')]=_[_0x4ba7('0x2e')](_0x15141e[_0x4ba7('0x2f')],_0x15141e[_0x4ba7('0x2c')]);_0x15d570['attributes']=_['intersection'](_0x15141e['model'],qs[_0x4ba7('0x31')](_0xafe98a[_0x4ba7('0x2c')][_0x4ba7('0x31')]));_0x15d570[_0x4ba7('0x30')]=_0x15d570[_0x4ba7('0x30')]['length']?_0x15d570[_0x4ba7('0x30')]:_0x15141e[_0x4ba7('0x2f')];_0x15d570[_0x4ba7('0x34')]=qs[_0x4ba7('0x35')](_0xafe98a[_0x4ba7('0x2c')][_0x4ba7('0x35')]);_0x15d570[_0x4ba7('0x36')]=qs['filters'](_[_0x4ba7('0x4d')](_0xafe98a['query'],_0x15141e[_0x4ba7('0x37')]));if(_0xafe98a[_0x4ba7('0x2c')][_0x4ba7('0x38')]){_0x15d570[_0x4ba7('0x36')]=_[_0x4ba7('0x4e')](_0x15d570[_0x4ba7('0x36')],{'$or':_[_0x4ba7('0x27')](_0x15d570[_0x4ba7('0x30')],function(_0x349743){var _0x215d14={};_0x215d14[_0x349743]={'$like':'%'+_0xafe98a[_0x4ba7('0x2c')][_0x4ba7('0x38')]+'%'};return _0x215d14;})});}_0x15d570=_[_0x4ba7('0x4e')]({},_0x15d570,_0xafe98a[_0x4ba7('0x3a')]);return _0x323599[_0x4ba7('0x4b')](_0x15d570);}})['then'](function(_0x187d92){if(_0x187d92){_0x45d4ab=_0x187d92['length'];if(!_0xafe98a[_0x4ba7('0x2c')]['hasOwnProperty'](_0x4ba7('0x33'))){_0x15d570[_0x4ba7('0x1c')]=qs[_0x4ba7('0x1c')](_0xafe98a[_0x4ba7('0x2c')][_0x4ba7('0x1c')]);_0x15d570[_0x4ba7('0x19')]=qs[_0x4ba7('0x19')](_0xafe98a[_0x4ba7('0x2c')]['offset']);}return _0x323599[_0x4ba7('0x4b')](_0x15d570);}})[_0x4ba7('0x22')](function(_0x47d1e9){if(_0x47d1e9){return _0x47d1e9?{'count':_0x45d4ab,'rows':_0x47d1e9}:null;}})[_0x4ba7('0x22')](respondWithResult(_0x569b8e,null))[_0x4ba7('0x3f')](handleError(_0x569b8e,null));};exports[_0x4ba7('0x4f')]=function(_0x1bbc81,_0x67d6e9,_0xcc84d4){return db[_0x4ba7('0x50')][_0x4ba7('0x43')]({'where':{'id':_0x1bbc81[_0x4ba7('0x41')]['id']}})['then'](handleEntityNotFound(_0x67d6e9,null))[_0x4ba7('0x22')](function(_0x1148e9){if(_0x1148e9){return _0x1148e9['addActions'](_0x1bbc81[_0x4ba7('0x45')][_0x4ba7('0x4a')],_[_0x4ba7('0x49')](_0x1bbc81['body'],[_0x4ba7('0x4a'),'id'])||{});}})[_0x4ba7('0x22')](respondWithResult(_0x67d6e9,null))[_0x4ba7('0x3f')](handleError(_0x67d6e9,null));};exports[_0x4ba7('0x51')]=function(_0x158e94,_0x27d49a,_0x2390fe){var _0x2150d8={};var _0x166ab5={};var _0x269737;var _0x3ea4eb;return db['Automation'][_0x4ba7('0x4c')]({'where':{'id':_0x158e94['params']['id']}})['then'](handleEntityNotFound(_0x27d49a,null))[_0x4ba7('0x22')](function(_0x289582){if(_0x289582){_0x269737=_0x289582;_0x166ab5[_0x4ba7('0x2f')]=_[_0x4ba7('0x2d')](db[_0x4ba7('0x50')]['rawAttributes']);_0x166ab5[_0x4ba7('0x2c')]=_[_0x4ba7('0x2d')](_0x158e94[_0x4ba7('0x2c')]);_0x166ab5[_0x4ba7('0x37')]=_[_0x4ba7('0x2e')](_0x166ab5[_0x4ba7('0x2f')],_0x166ab5[_0x4ba7('0x2c')]);_0x2150d8['attributes']=_[_0x4ba7('0x2e')](_0x166ab5[_0x4ba7('0x2f')],qs[_0x4ba7('0x31')](_0x158e94[_0x4ba7('0x2c')]['fields']));_0x2150d8[_0x4ba7('0x30')]=_0x2150d8['attributes']['length']?_0x2150d8['attributes']:_0x166ab5[_0x4ba7('0x2f')];_0x2150d8[_0x4ba7('0x34')]=qs[_0x4ba7('0x35')](_0x158e94[_0x4ba7('0x2c')][_0x4ba7('0x35')]);_0x2150d8[_0x4ba7('0x36')]=qs[_0x4ba7('0x37')](_['pick'](_0x158e94[_0x4ba7('0x2c')],_0x166ab5[_0x4ba7('0x37')]));if(_0x158e94[_0x4ba7('0x2c')][_0x4ba7('0x38')]){_0x2150d8[_0x4ba7('0x36')]=_['merge'](_0x2150d8['where'],{'$or':_[_0x4ba7('0x27')](_0x2150d8[_0x4ba7('0x30')],function(_0x5e0542){var _0x2ec843={};_0x2ec843[_0x5e0542]={'$like':'%'+_0x158e94[_0x4ba7('0x2c')][_0x4ba7('0x38')]+'%'};return _0x2ec843;})});}_0x2150d8=_[_0x4ba7('0x4e')]({},_0x2150d8,_0x158e94['options']);return _0x269737['getActions'](_0x2150d8);}})[_0x4ba7('0x22')](function(_0x5bb9eb){if(_0x5bb9eb){_0x3ea4eb=_0x5bb9eb['length'];if(!_0x158e94['query'][_0x4ba7('0x52')](_0x4ba7('0x33'))){_0x2150d8['limit']=qs[_0x4ba7('0x1c')](_0x158e94[_0x4ba7('0x2c')]['limit']);_0x2150d8[_0x4ba7('0x19')]=qs[_0x4ba7('0x19')](_0x158e94[_0x4ba7('0x2c')][_0x4ba7('0x19')]);}return _0x269737[_0x4ba7('0x51')](_0x2150d8);}})[_0x4ba7('0x22')](function(_0x4c9616){if(_0x4c9616){return _0x4c9616?{'count':_0x3ea4eb,'rows':_0x4c9616}:null;}})[_0x4ba7('0x22')](respondWithResult(_0x27d49a,null))[_0x4ba7('0x3f')](handleError(_0x27d49a,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8572bfa..3c6c3a7 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 _0x0bd2=['Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./automation.attributes','exports','define'];(function(_0x199326,_0x317e42){var _0x5a3fe4=function(_0xb6f415){while(--_0xb6f415){_0x199326['push'](_0x199326['shift']());}};_0x5a3fe4(++_0x317e42);}(_0x0bd2,0x1de));var _0x20bd=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x0bd2[_0x238671];return _0x474844;};'use strict';var _=require(_0x20bd('0x0'));var util=require(_0x20bd('0x1'));var logger=require(_0x20bd('0x2'))(_0x20bd('0x3'));var moment=require(_0x20bd('0x4'));var BPromise=require(_0x20bd('0x5'));var rp=require(_0x20bd('0x6'));var fs=require('fs');var path=require(_0x20bd('0x7'));var rimraf=require(_0x20bd('0x8'));var config=require('../../config/environment');var attributes=require(_0x20bd('0x9'));module[_0x20bd('0xa')]=function(_0x246338,_0x30786f){return _0x246338[_0x20bd('0xb')](_0x20bd('0xc'),attributes,{'tableName':_0x20bd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee9d=['Automation','lodash','util','moment','request-promise','path','rimraf','./automation.attributes','exports','define'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xee9d,0xa1));var _0xdee9=function(_0x46b063,_0x192c48){_0x46b063=_0x46b063-0x0;var _0x1c8a44=_0xee9d[_0x46b063];return _0x1c8a44;};'use strict';var _=require(_0xdee9('0x0'));var util=require(_0xdee9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdee9('0x2'));var BPromise=require('bluebird');var rp=require(_0xdee9('0x3'));var fs=require('fs');var path=require(_0xdee9('0x4'));var rimraf=require(_0xdee9('0x5'));var config=require('../../config/environment');var attributes=require(_0xdee9('0x6'));module[_0xdee9('0x7')]=function(_0xb4df9f,_0x5392f8){return _0xb4df9f[_0xdee9('0x8')](_0xdee9('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index ea47a40..520eeca 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 _0x16a2=['error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d4401,_0x3cbbb4){var _0x490c56=function(_0xc57aac){while(--_0xc57aac){_0x4d4401['push'](_0x4d4401['shift']());}};_0x490c56(++_0x3cbbb4);}(_0x16a2,0x1d0));var _0x216a=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0x16a2[_0x409deb];return _0x15a4f7;};'use strict';var _=require(_0x216a('0x0'));var util=require(_0x216a('0x1'));var moment=require(_0x216a('0x2'));var BPromise=require(_0x216a('0x3'));var rs=require(_0x216a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x216a('0x5'));var logger=require(_0x216a('0x6'))(_0x216a('0x7'));var config=require(_0x216a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x216a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6dbac7,_0x2dd88c,_0x55f347){return new BPromise(function(_0xf619f8,_0x20e3f7){return client[_0x216a('0xa')](_0x6dbac7,_0x55f347)[_0x216a('0xb')](function(_0x4ce00d){logger['info'](_0x216a('0xc'),_0x2dd88c,_0x216a('0xd'));logger['debug'](_0x216a('0xe'),_0x2dd88c,_0x216a('0xd'),JSON[_0x216a('0xf')](_0x4ce00d));if(_0x4ce00d[_0x216a('0x10')]){if(_0x4ce00d[_0x216a('0x10')]['code']===0x1f4){logger[_0x216a('0x10')](_0x216a('0xc'),_0x2dd88c,_0x4ce00d['error'][_0x216a('0x11')]);return _0x20e3f7(_0x4ce00d[_0x216a('0x10')]['message']);}logger[_0x216a('0x10')](_0x216a('0xc'),_0x2dd88c,_0x4ce00d['error'][_0x216a('0x11')]);return _0xf619f8(_0x4ce00d['error'][_0x216a('0x11')]);}else{logger[_0x216a('0x12')](_0x216a('0xc'),_0x2dd88c,_0x216a('0xd'));_0xf619f8(_0x4ce00d['result'][_0x216a('0x11')]);}})[_0x216a('0x13')](function(_0x4c1a4d){logger[_0x216a('0x10')]('Automation,\x20%s,\x20%s',_0x2dd88c,_0x4c1a4d);_0x20e3f7(_0x4c1a4d);});});} \ No newline at end of file +var _0xea28=['rpc','../../config/environment','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x407798,_0x32f5a8){var _0x1ae87b=function(_0xefadff){while(--_0xefadff){_0x407798['push'](_0x407798['shift']());}};_0x1ae87b(++_0x32f5a8);}(_0xea28,0x13a));var _0x8ea2=function(_0x3c1f25,_0x10a7bb){_0x3c1f25=_0x3c1f25-0x0;var _0x4fd989=_0xea28[_0x3c1f25];return _0x4fd989;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435d78,_0xb7f278,_0x39b1fa){return new BPromise(function(_0x28b5b8,_0x929304){return client[_0x8ea2('0xc')](_0x435d78,_0x39b1fa)[_0x8ea2('0xd')](function(_0x3de4a1){logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0xb7f278,_0x8ea2('0x10'),JSON[_0x8ea2('0x11')](_0x3de4a1));if(_0x3de4a1[_0x8ea2('0x12')]){if(_0x3de4a1['error'][_0x8ea2('0x13')]===0x1f4){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x929304(_0x3de4a1['error'][_0x8ea2('0x14')]);}logger['error']('Automation,\x20%s,\x20%s',_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x28b5b8(_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);}else{logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));_0x28b5b8(_0x3de4a1[_0x8ea2('0x15')][_0x8ea2('0x14')]);}})[_0x8ea2('0x16')](function(_0x2dfa7c){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x2dfa7c);_0x929304(_0x2dfa7c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 250d105..1798939 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 _0x15cb=['get','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','create','post','addConditions','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0x15cb,0x16f));var _0xb15c=function(_0x18db8a,_0x41f589){_0x18db8a=_0x18db8a-0x0;var _0x4af762=_0x15cb[_0x18db8a];return _0x4af762;};'use strict';var multer=require('multer');var util=require(_0xb15c('0x0'));var path=require('path');var timeout=require(_0xb15c('0x1'));var express=require('express');var router=express[_0xb15c('0x2')]();var fs_extra=require(_0xb15c('0x3'));var auth=require(_0xb15c('0x4'));var interaction=require(_0xb15c('0x5'));var config=require('../../config/environment');var controller=require(_0xb15c('0x6'));router[_0xb15c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb15c('0x7')](_0xb15c('0x8'),auth[_0xb15c('0x9')](),controller[_0xb15c('0xa')]);router[_0xb15c('0x7')](_0xb15c('0xb'),auth[_0xb15c('0x9')](),controller[_0xb15c('0xc')]);router['get'](_0xb15c('0xd'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth[_0xb15c('0x9')](),controller[_0xb15c('0xe')]);router[_0xb15c('0xf')](_0xb15c('0xb'),auth[_0xb15c('0x9')](),controller[_0xb15c('0x10')]);router['post']('/:id/actions',auth[_0xb15c('0x9')](),controller['addActions']);router[_0xb15c('0x11')](_0xb15c('0x8'),auth[_0xb15c('0x9')](),controller[_0xb15c('0x12')]);router[_0xb15c('0x13')](_0xb15c('0x8'),auth[_0xb15c('0x9')](),controller[_0xb15c('0x14')]);module[_0xb15c('0x15')]=router; \ No newline at end of file +var _0x2dd3=['/:id/actions','addActions','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','getActions','create','post','addConditions'];(function(_0xd99437,_0x308703){var _0x41d5d8=function(_0x4a53ef){while(--_0x4a53ef){_0xd99437['push'](_0xd99437['shift']());}};_0x41d5d8(++_0x308703);}(_0x2dd3,0x6e));var _0x32dd=function(_0x27b048,_0x457692){_0x27b048=_0x27b048-0x0;var _0x4955ec=_0x2dd3[_0x27b048];return _0x4955ec;};'use strict';var multer=require('multer');var util=require(_0x32dd('0x0'));var path=require(_0x32dd('0x1'));var timeout=require(_0x32dd('0x2'));var express=require(_0x32dd('0x3'));var router=express[_0x32dd('0x4')]();var fs_extra=require(_0x32dd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x32dd('0x6'));var config=require(_0x32dd('0x7'));var controller=require(_0x32dd('0x8'));router[_0x32dd('0x9')]('/',auth[_0x32dd('0xa')](),controller[_0x32dd('0xb')]);router[_0x32dd('0x9')](_0x32dd('0xc'),auth[_0x32dd('0xa')](),controller[_0x32dd('0xd')]);router['get'](_0x32dd('0xe'),auth['isAuthenticated'](),controller[_0x32dd('0xf')]);router[_0x32dd('0x9')]('/:id/actions',auth[_0x32dd('0xa')](),controller[_0x32dd('0x10')]);router['post']('/',auth[_0x32dd('0xa')](),controller[_0x32dd('0x11')]);router[_0x32dd('0x12')](_0x32dd('0xe'),auth['isAuthenticated'](),controller[_0x32dd('0x13')]);router[_0x32dd('0x12')](_0x32dd('0x14'),auth[_0x32dd('0xa')](),controller[_0x32dd('0x15')]);router[_0x32dd('0x16')](_0x32dd('0xc'),auth[_0x32dd('0xa')](),controller['update']);router[_0x32dd('0x17')](_0x32dd('0xc'),auth[_0x32dd('0xa')](),controller[_0x32dd('0x18')]);module[_0x32dd('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index f344b11..e4e0091 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 _0x3436=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#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\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)'];(function(_0x593f0e,_0x3555e7){var _0x116f30=function(_0x4df802){while(--_0x4df802){_0x593f0e['push'](_0x593f0e['shift']());}};_0x116f30(++_0x3555e7);}(_0x3436,0x131));var _0x6343=function(_0x234dd0,_0x385f57){_0x234dd0=_0x234dd0-0x0;var _0x1ce203=_0x3436[_0x234dd0];return _0x1ce203;};'use strict';var Sequelize=require('sequelize');module[_0x6343('0x0')]={'name':{'type':Sequelize[_0x6343('0x1')],'unique':_0x6343('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x6343('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x6343('0x4')},'description':{'type':Sequelize[_0x6343('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x6343('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6343('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6343('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x6343('0x7')](0x3)[_0x6343('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6343('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6343('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6343('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6343('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x6343('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6343('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6343('0x7')](0x5)[_0x6343('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6343('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6343('0x5')],'defaultValue':0x3,'comment':_0x6343('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6343('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6343('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6343('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x6343('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6343('0x1')],'defaultValue':_0x6343('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x6343('0x3')](_0x6343('0xf'),_0x6343('0x10'),_0x6343('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x6343('0x12')],'defaultValue':0x0,'comment':_0x6343('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x6343('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6343('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x6343('0x7')](0x9)[_0x6343('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6343('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6343('0x7')](0x9)[_0x6343('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6343('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x6343('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6343('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6343('0x7')](0x9)[_0x6343('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6343('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6343('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6343('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6343('0x7')](0x5)[_0x6343('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6343('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6343('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6343('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x6343('0x1c'),_0x6343('0x1d')),'defaultValue':_0x6343('0x1c')},'dialPrefix':{'type':Sequelize[_0x6343('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6343('0x1e')},'dialCutDigit':{'type':Sequelize[_0x6343('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6343('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6343('0x7')](0x3)[_0x6343('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6343('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6343('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x6343('0x7')](0x3)[_0x6343('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6343('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x6343('0x7')](0x5)[_0x6343('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6343('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6343('0x7')](0x5)[_0x6343('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6343('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x6343('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6343('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6343('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6343('0x7')](0x3)[_0x6343('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6343('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6343('0x25')}}; \ No newline at end of file +var _0x0b3a=['NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','ivr','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x1640c1,_0x4d6e1c){var _0x436883=function(_0x4ae471){while(--_0x4ae471){_0x1640c1['push'](_0x1640c1['shift']());}};_0x436883(++_0x4d6e1c);}(_0x0b3a,0x178));var _0xa0b3=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x0b3a[_0x1044e5];return _0x5ad0dd;};'use strict';var Sequelize=require('sequelize');module[_0xa0b3('0x0')]={'name':{'type':Sequelize[_0xa0b3('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xa0b3('0x2')),'allowNull':![],'defaultValue':_0xa0b3('0x2')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa0b3('0x3')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xa0b3('0x4')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa0b3('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xa0b3('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0b3('0x6')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa0b3('0x5')](0x3)[_0xa0b3('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0b3('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa0b3('0x5')](0x5)[_0xa0b3('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa0b3('0x8')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa0b3('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xa0b3('0x5')](0x5)[_0xa0b3('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa0b3('0x5')](0x3)[_0xa0b3('0x4')],'defaultValue':0x3,'comment':_0xa0b3('0x9')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa0b3('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa0b3('0xa')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa0b3('0x5')](0x3)[_0xa0b3('0x4')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa0b3('0xb')},'dialTimezone':{'type':Sequelize[_0xa0b3('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa0b3('0x1')],'defaultValue':_0xa0b3('0xc')},'dialCheckDuplicateType':{'type':Sequelize[_0xa0b3('0xd')](_0xa0b3('0xe'),_0xa0b3('0xf'),_0xa0b3('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa0b3('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa0b3('0x4')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa0b3('0x12')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xa0b3('0x4')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa0b3('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa0b3('0x4')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa0b3('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa0b3('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xa0b3('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa0b3('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa0b3('0x5')](0x9)[_0xa0b3('0x4')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa0b3('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa0b3('0x5')](0x9)[_0xa0b3('0x4')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa0b3('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa0b3('0x5')](0x5)[_0xa0b3('0x4')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa0b3('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xa0b3('0xd')](_0xa0b3('0x1a'),_0xa0b3('0x1b')),'defaultValue':_0xa0b3('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa0b3('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa0b3('0x1c')},'dialCutDigit':{'type':Sequelize[_0xa0b3('0x5')](0x3)[_0xa0b3('0x4')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa0b3('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa0b3('0x5')](0x3)[_0xa0b3('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0b3('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa0b3('0x5')](0x5)[_0xa0b3('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa0b3('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xa0b3('0x5')](0x3)[_0xa0b3('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0b3('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa0b3('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa0b3('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa0b3('0x5')](0x3)[_0xa0b3('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa0b3('0x5')](0x5)[_0xa0b3('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa0b3('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa0b3('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0b3('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa0b3('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa0b3('0x5')](0x3)[_0xa0b3('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0b3('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa0b3('0x5')](0x5)[_0xa0b3('0x4')],'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 1487d1b..b81f778 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 _0xa8af=['from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','rows','catch','params','include','create','body','user','IvrCampaigns','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','getHoppers','findOne','CmHopper','pick','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)'];(function(_0x4b64ef,_0x3c42d8){var _0x42caa8=function(_0x10d8c0){while(--_0x10d8c0){_0x4b64ef['push'](_0x4b64ef['shift']());}};_0x42caa8(++_0x3c42d8);}(_0xa8af,0x1a3));var _0xfa8a=function(_0x44db05,_0xa4ba06){_0x44db05=_0x44db05-0x0;var _0x46dd60=_0xa8af[_0x44db05];return _0x46dd60;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa8a('0x0'));var zipdir=require(_0xfa8a('0x1'));var jsonpatch=require(_0xfa8a('0x2'));var rp=require('request-promise');var moment=require(_0xfa8a('0x3'));var BPromise=require(_0xfa8a('0x4'));var Mustache=require('mustache');var util=require(_0xfa8a('0x5'));var path=require(_0xfa8a('0x6'));var sox=require(_0xfa8a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa8a('0x8'));var squel=require(_0xfa8a('0x9'));var crypto=require(_0xfa8a('0xa'));var jsforce=require(_0xfa8a('0xb'));var deskjs=require(_0xfa8a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfa8a('0xd'));var Papa=require(_0xfa8a('0xe'));var Redis=require(_0xfa8a('0xf'));var authService=require(_0xfa8a('0x10'));var qs=require(_0xfa8a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa8a('0x12'))(_0xfa8a('0x13'));var utils=require('../../config/utils');var config=require(_0xfa8a('0x14'));var licenseUtil=require(_0xfa8a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24bce2,_0xdcf5aa){_0xdcf5aa=_0xdcf5aa||0xcc;return function(_0x13b962){if(_0x13b962){return _0x24bce2['sendStatus'](_0xdcf5aa);}return _0x24bce2[_0xfa8a('0x16')](_0xdcf5aa)['end']();};}function respondWithResult(_0x58a506,_0x8165b8){_0x8165b8=_0x8165b8||0xc8;return function(_0x2e0e5c){if(_0x2e0e5c){return _0x58a506[_0xfa8a('0x16')](_0x8165b8)['json'](_0x2e0e5c);}};}function respondWithFilteredResult(_0x772dcd,_0x23fcad){return function(_0x18f2e5){if(_0x18f2e5){var _0x33c96a=typeof _0x23fcad[_0xfa8a('0x17')]===_0xfa8a('0x18')&&typeof _0x23fcad[_0xfa8a('0x19')]===_0xfa8a('0x18');var _0xd42409=_0x18f2e5['count'];var _0xf749e4=_0x33c96a?0x0:_0x23fcad[_0xfa8a('0x17')];var _0x15bbe1=_0x33c96a?_0x18f2e5[_0xfa8a('0x1a')]:_0x23fcad['offset']+_0x23fcad[_0xfa8a('0x19')];var _0x2a5429;if(_0x15bbe1>=_0xd42409){_0x15bbe1=_0xd42409;_0x2a5429=0xc8;}else{_0x2a5429=0xce;}_0x772dcd[_0xfa8a('0x16')](_0x2a5429);return _0x772dcd['set'](_0xfa8a('0x1b'),_0xf749e4+'-'+_0x15bbe1+'/'+_0xd42409)[_0xfa8a('0x1c')](_0x18f2e5);}return null;};}function patchUpdates(_0x3c4159){return function(_0x2df5d3){try{jsonpatch[_0xfa8a('0x1d')](_0x2df5d3,_0x3c4159,!![]);}catch(_0x39abe9){return BPromise['reject'](_0x39abe9);}return _0x2df5d3[_0xfa8a('0x1e')]();};}function saveUpdates(_0x189cdd,_0x1f5b64){return function(_0x1ec62b){if(_0x1ec62b){return _0x1ec62b[_0xfa8a('0x1f')](_0x189cdd)[_0xfa8a('0x20')](function(_0x54a129){return _0x54a129;});}return null;};}function removeEntity(_0x2f6612,_0x177eb0){return function(_0x13d320){if(_0x13d320){return _0x13d320[_0xfa8a('0x21')]()[_0xfa8a('0x20')](function(){var _0xd04c6d=_0x13d320[_0xfa8a('0x22')]({'plain':!![]});var _0x20e44f='IvrCampaigns';return db[_0xfa8a('0x23')]['destroy']({'where':{'type':_0x20e44f,'resourceId':_0xd04c6d['id']}})[_0xfa8a('0x20')](function(){return _0x13d320;});})[_0xfa8a('0x20')](function(){_0x2f6612[_0xfa8a('0x16')](0xcc)[_0xfa8a('0x24')]();});}};}function handleEntityNotFound(_0x566676,_0x580811){return function(_0x5d30dc){if(!_0x5d30dc){_0x566676[_0xfa8a('0x25')](0x194);}return _0x5d30dc;};}function handleError(_0x3ce58f,_0x48fb68){_0x48fb68=_0x48fb68||0x1f4;return function(_0x16c488){logger[_0xfa8a('0x26')](_0x16c488[_0xfa8a('0x27')]);if(_0x16c488[_0xfa8a('0x28')]){delete _0x16c488[_0xfa8a('0x28')];}_0x3ce58f[_0xfa8a('0x16')](_0x48fb68)[_0xfa8a('0x29')](_0x16c488);};}exports[_0xfa8a('0x2a')]=function(_0x1abbf7,_0x5a5d46){var _0x244914={},_0x406705={},_0x45e090={'count':0x0,'rows':[]};var _0x251b4b=_['map'](db[_0xfa8a('0x2b')][_0xfa8a('0x2c')],function(_0x472c3b){return{'name':_0x472c3b[_0xfa8a('0x2d')],'type':_0x472c3b[_0xfa8a('0x2e')][_0xfa8a('0x2f')]};});_0x406705[_0xfa8a('0x30')]=_[_0xfa8a('0x31')](_0x251b4b,'name');_0x406705[_0xfa8a('0x32')]=_[_0xfa8a('0x33')](_0x1abbf7[_0xfa8a('0x32')]);_0x406705['filters']=_[_0xfa8a('0x34')](_0x406705[_0xfa8a('0x30')],_0x406705[_0xfa8a('0x32')]);_0x244914[_0xfa8a('0x35')]=_['intersection'](_0x406705[_0xfa8a('0x30')],qs[_0xfa8a('0x36')](_0x1abbf7[_0xfa8a('0x32')]['fields']));_0x244914[_0xfa8a('0x35')]=_0x244914[_0xfa8a('0x35')][_0xfa8a('0x37')]?_0x244914[_0xfa8a('0x35')]:_0x406705[_0xfa8a('0x30')];if(!_0x1abbf7[_0xfa8a('0x32')][_0xfa8a('0x38')](_0xfa8a('0x39'))){_0x244914[_0xfa8a('0x19')]=qs[_0xfa8a('0x19')](_0x1abbf7[_0xfa8a('0x32')][_0xfa8a('0x19')]);_0x244914[_0xfa8a('0x17')]=qs[_0xfa8a('0x17')](_0x1abbf7[_0xfa8a('0x32')][_0xfa8a('0x17')]);}_0x244914[_0xfa8a('0x3a')]=qs[_0xfa8a('0x3b')](_0x1abbf7[_0xfa8a('0x32')][_0xfa8a('0x3b')]);_0x244914[_0xfa8a('0x3c')]=qs['filters'](_['pick'](_0x1abbf7[_0xfa8a('0x32')],_0x406705[_0xfa8a('0x3d')]),_0x251b4b);if(_0x1abbf7[_0xfa8a('0x32')]['filter']){_0x244914[_0xfa8a('0x3c')]=_[_0xfa8a('0x3e')](_0x244914[_0xfa8a('0x3c')],{'$or':_[_0xfa8a('0x31')](_0x251b4b,function(_0x2115b1){if(_0x2115b1['type']!=='VIRTUAL'){var _0x2684bb={};_0x2684bb[_0x2115b1[_0xfa8a('0x28')]]={'$like':'%'+_0x1abbf7['query'][_0xfa8a('0x3f')]+'%'};return _0x2684bb;}})});}_0x244914=_[_0xfa8a('0x3e')]({},_0x244914,_0x1abbf7[_0xfa8a('0x40')]);var _0x3fa1c3={'where':_0x244914[_0xfa8a('0x3c')]};return db[_0xfa8a('0x2b')]['count'](_0x3fa1c3)[_0xfa8a('0x20')](function(_0x3ed98f){_0x45e090[_0xfa8a('0x1a')]=_0x3ed98f;if(_0x1abbf7[_0xfa8a('0x32')]['includeAll']){_0x244914['include']=[{'all':!![]}];}return db[_0xfa8a('0x2b')]['findAll'](_0x244914);})[_0xfa8a('0x20')](function(_0x4023bd){_0x45e090[_0xfa8a('0x41')]=_0x4023bd;return _0x45e090;})[_0xfa8a('0x20')](respondWithFilteredResult(_0x5a5d46,_0x244914))[_0xfa8a('0x42')](handleError(_0x5a5d46,null));};exports['show']=function(_0x25937a,_0x2a2e10){var _0x5eb74d={'raw':![],'where':{'id':_0x25937a[_0xfa8a('0x43')]['id']}},_0x3fd6cb={};_0x3fd6cb[_0xfa8a('0x30')]=_[_0xfa8a('0x33')](db[_0xfa8a('0x2b')]['rawAttributes']);_0x3fd6cb[_0xfa8a('0x32')]=_[_0xfa8a('0x33')](_0x25937a[_0xfa8a('0x32')]);_0x3fd6cb['filters']=_[_0xfa8a('0x34')](_0x3fd6cb['model'],_0x3fd6cb[_0xfa8a('0x32')]);_0x5eb74d[_0xfa8a('0x35')]=_[_0xfa8a('0x34')](_0x3fd6cb[_0xfa8a('0x30')],qs[_0xfa8a('0x36')](_0x25937a['query'][_0xfa8a('0x36')]));_0x5eb74d[_0xfa8a('0x35')]=_0x5eb74d[_0xfa8a('0x35')][_0xfa8a('0x37')]?_0x5eb74d[_0xfa8a('0x35')]:_0x3fd6cb['model'];if(_0x25937a['query']['includeAll']){_0x5eb74d[_0xfa8a('0x44')]=[{'all':!![]}];}_0x5eb74d=_[_0xfa8a('0x3e')]({},_0x5eb74d,_0x25937a['options']);return db['Campaign']['find'](_0x5eb74d)[_0xfa8a('0x20')](handleEntityNotFound(_0x2a2e10,null))[_0xfa8a('0x20')](respondWithResult(_0x2a2e10,null))[_0xfa8a('0x42')](handleError(_0x2a2e10,null));};exports[_0xfa8a('0x45')]=function(_0x570c4c,_0x2f9d8d){return db[_0xfa8a('0x2b')][_0xfa8a('0x45')](_0x570c4c[_0xfa8a('0x46')],{})[_0xfa8a('0x20')](function(_0x4d6788){var _0x1ac16c=_0x570c4c[_0xfa8a('0x47')][_0xfa8a('0x22')]({'plain':!![]});if(!_0x1ac16c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ac16c['role']==='user'){var _0x29b668=_0x4d6788['get']({'plain':!![]});var _0x4b502a=_0xfa8a('0x48');return db['UserProfileSection'][_0xfa8a('0x49')]({'where':{'name':_0x4b502a,'userProfileId':_0x1ac16c[_0xfa8a('0x4a')]},'raw':!![]})[_0xfa8a('0x20')](function(_0xa54216){if(_0xa54216&&_0xa54216['autoAssociation']===0x0){return db[_0xfa8a('0x23')][_0xfa8a('0x45')]({'name':_0x29b668['name'],'resourceId':_0x29b668['id'],'type':_0xa54216['name'],'sectionId':_0xa54216['id']},{})['then'](function(){return _0x4d6788;});}else{return _0x4d6788;}})[_0xfa8a('0x42')](function(_0x11552c){logger['error'](_0xfa8a('0x4b'),_0x11552c);throw _0x11552c;});}return _0x4d6788;})['then'](respondWithResult(_0x2f9d8d,0xc9))[_0xfa8a('0x42')](handleError(_0x2f9d8d,null));};exports[_0xfa8a('0x4c')]=function(_0x394692,_0x19836a){var _0xb98a64={'where':{'id':_0x394692[_0xfa8a('0x43')]['id']}},_0x1f5660={};_0x1f5660[_0xfa8a('0x30')]=_[_0xfa8a('0x33')](db[_0xfa8a('0x2b')][_0xfa8a('0x2c')]);_0xb98a64[_0xfa8a('0x35')]=_[_0xfa8a('0x34')](_0x1f5660['model'],qs[_0xfa8a('0x36')](_0x394692[_0xfa8a('0x32')][_0xfa8a('0x36')]));_0xb98a64['attributes']=_0xb98a64[_0xfa8a('0x35')]['length']?_0xb98a64[_0xfa8a('0x35')]:_0x1f5660[_0xfa8a('0x30')];if(_0x394692[_0xfa8a('0x32')][_0xfa8a('0x4d')]){_0xb98a64[_0xfa8a('0x44')]=[{'all':!![]}];}_0xb98a64=_[_0xfa8a('0x3e')]({},_0xb98a64,_0x394692[_0xfa8a('0x40')]);return db[_0xfa8a('0x2b')][_0xfa8a('0x49')](_0xb98a64)[_0xfa8a('0x20')](handleEntityNotFound(_0x19836a,null))[_0xfa8a('0x20')](function(_0x111801){if(_0x111801){var _0x9c63da=_0x111801[_0xfa8a('0x22')]({'plain':!![]});_0x9c63da=qs[_0xfa8a('0x4e')](_0x9c63da,['id',_0xfa8a('0x4f'),_0xfa8a('0x50')]);_0x394692['body']=_[_0xfa8a('0x4e')](_0x394692[_0xfa8a('0x46')],['id',_0xfa8a('0x4f'),_0xfa8a('0x50')]);return db['Campaign'][_0xfa8a('0x45')](_[_0xfa8a('0x3e')](_0x9c63da,_0x394692[_0xfa8a('0x46')]),{'include':_0x394692[_0xfa8a('0x32')][_0xfa8a('0x4d')]?[{'all':!![]}]:undefined})[_0xfa8a('0x20')](function(_0x507be8){var _0x330835=_0x394692[_0xfa8a('0x47')][_0xfa8a('0x22')]({'plain':!![]});if(!_0x330835)throw new Error(_0xfa8a('0x51'));if(_0x330835[_0xfa8a('0x52')]===_0xfa8a('0x47')){var _0x408d0a=_0x507be8['get']({'plain':!![]});var _0x2fd617='IvrCampaigns';return db[_0xfa8a('0x53')][_0xfa8a('0x49')]({'where':{'name':_0x2fd617,'userProfileId':_0x330835[_0xfa8a('0x4a')]},'raw':!![]})[_0xfa8a('0x20')](function(_0x34820e){if(_0x34820e&&_0x34820e[_0xfa8a('0x54')]===0x0){return db[_0xfa8a('0x23')][_0xfa8a('0x45')]({'name':_0x408d0a['name'],'resourceId':_0x408d0a['id'],'type':_0x34820e['name'],'sectionId':_0x34820e['id']},{})['then'](function(){return _0x507be8;});}else{return _0x507be8;}})[_0xfa8a('0x42')](function(_0x1eac9d){logger[_0xfa8a('0x26')](_0xfa8a('0x4b'),_0x1eac9d);throw _0x1eac9d;});}return _0x507be8;});}})[_0xfa8a('0x20')](respondWithResult(_0x19836a,0xc9))[_0xfa8a('0x42')](handleError(_0x19836a,null));};exports[_0xfa8a('0x1f')]=function(_0x18ad25,_0x34ecc4){if(_0x18ad25['body']['id']){delete _0x18ad25[_0xfa8a('0x46')]['id'];}return db[_0xfa8a('0x2b')][_0xfa8a('0x49')]({'where':{'id':_0x18ad25[_0xfa8a('0x43')]['id']}})['then'](handleEntityNotFound(_0x34ecc4,null))['then'](saveUpdates(_0x18ad25['body'],null))[_0xfa8a('0x20')](respondWithResult(_0x34ecc4,null))[_0xfa8a('0x42')](handleError(_0x34ecc4,null));};exports[_0xfa8a('0x21')]=function(_0x651a3,_0x2922ab){return db['Campaign'][_0xfa8a('0x49')]({'where':{'id':_0x651a3[_0xfa8a('0x43')]['id']}})[_0xfa8a('0x20')](handleEntityNotFound(_0x2922ab,null))['then'](removeEntity(_0x2922ab,null))[_0xfa8a('0x42')](handleError(_0x2922ab,null));};exports[_0xfa8a('0x55')]=function(_0x2b36cf,_0x1e0d41,_0x5983fa){var _0x38c074={'raw':!![],'where':{}};var _0x32eceb={};var _0x51aa95={'count':0x0,'rows':[]};return db['Campaign'][_0xfa8a('0x56')]({'where':{'id':_0x2b36cf['params']['id']}})[_0xfa8a('0x20')](handleEntityNotFound(_0x1e0d41,null))[_0xfa8a('0x20')](function(_0x1a143b){if(_0x1a143b){_0x32eceb['model']=_[_0xfa8a('0x33')](db[_0xfa8a('0x57')][_0xfa8a('0x2c')]);_0x32eceb[_0xfa8a('0x32')]=_[_0xfa8a('0x33')](_0x2b36cf[_0xfa8a('0x32')]);_0x32eceb[_0xfa8a('0x3d')]=_['intersection'](_0x32eceb['model'],_0x32eceb['query']);_0x38c074['attributes']=_[_0xfa8a('0x34')](_0x32eceb['model'],qs[_0xfa8a('0x36')](_0x2b36cf[_0xfa8a('0x32')][_0xfa8a('0x36')]));_0x38c074[_0xfa8a('0x35')]=_0x38c074['attributes'][_0xfa8a('0x37')]?_0x38c074[_0xfa8a('0x35')]:_0x32eceb[_0xfa8a('0x30')];if(!_0x2b36cf['query']['hasOwnProperty'](_0xfa8a('0x39'))){_0x38c074[_0xfa8a('0x19')]=qs['limit'](_0x2b36cf[_0xfa8a('0x32')][_0xfa8a('0x19')]);_0x38c074[_0xfa8a('0x17')]=qs[_0xfa8a('0x17')](_0x2b36cf[_0xfa8a('0x32')][_0xfa8a('0x17')]);}_0x38c074[_0xfa8a('0x3a')]=qs[_0xfa8a('0x3b')](_0x2b36cf['query'][_0xfa8a('0x3b')]);_0x38c074[_0xfa8a('0x3c')]=qs[_0xfa8a('0x3d')](_[_0xfa8a('0x58')](_0x2b36cf[_0xfa8a('0x32')],_0x32eceb[_0xfa8a('0x3d')]));_0x38c074[_0xfa8a('0x3c')][_0xfa8a('0x59')]=_0x1a143b['id'];if(_0x2b36cf[_0xfa8a('0x32')][_0xfa8a('0x3f')]){_0x38c074[_0xfa8a('0x3c')]=_[_0xfa8a('0x3e')](_0x38c074['where'],{'$or':_[_0xfa8a('0x31')](_0x38c074[_0xfa8a('0x35')],function(_0x2c6ded){var _0x13ffa9={};_0x13ffa9[_0x2c6ded]={'$like':'%'+_0x2b36cf['query'][_0xfa8a('0x3f')]+'%'};return _0x13ffa9;})});}_0x38c074=_[_0xfa8a('0x3e')]({},_0x38c074,_0x2b36cf[_0xfa8a('0x40')]);return db[_0xfa8a('0x57')][_0xfa8a('0x1a')]({'where':_0x38c074[_0xfa8a('0x3c')]})[_0xfa8a('0x20')](function(_0x3c39e4){_0x51aa95[_0xfa8a('0x1a')]=_0x3c39e4;if(_0x2b36cf[_0xfa8a('0x32')][_0xfa8a('0x4d')]){_0x38c074[_0xfa8a('0x44')]=[{'all':!![]}];}return db['CmHopper'][_0xfa8a('0x5a')](_0x38c074);})['then'](function(_0x1a060c){_0x51aa95[_0xfa8a('0x41')]=_0x1a060c;return _0x51aa95;});}})[_0xfa8a('0x20')](respondWithFilteredResult(_0x1e0d41,_0x38c074))[_0xfa8a('0x42')](handleError(_0x1e0d41,null));};exports[_0xfa8a('0x5b')]=function(_0x53d537,_0x4e31ef,_0x18a817){var _0x1a7037={'raw':!![],'where':{}};var _0x25fe04={};var _0x3e22c8={'count':0x0,'rows':[]};return db['Campaign'][_0xfa8a('0x56')]({'where':{'id':_0x53d537[_0xfa8a('0x43')]['id']}})[_0xfa8a('0x20')](handleEntityNotFound(_0x4e31ef,null))[_0xfa8a('0x20')](function(_0x545e1f){if(_0x545e1f){_0x25fe04['model']=_[_0xfa8a('0x33')](db[_0xfa8a('0x5c')][_0xfa8a('0x2c')]);_0x25fe04['query']=_[_0xfa8a('0x33')](_0x53d537[_0xfa8a('0x32')]);_0x25fe04[_0xfa8a('0x3d')]=_['intersection'](_0x25fe04[_0xfa8a('0x30')],_0x25fe04[_0xfa8a('0x32')]);_0x1a7037[_0xfa8a('0x35')]=_[_0xfa8a('0x34')](_0x25fe04['model'],qs[_0xfa8a('0x36')](_0x53d537[_0xfa8a('0x32')][_0xfa8a('0x36')]));_0x1a7037[_0xfa8a('0x35')]=_0x1a7037[_0xfa8a('0x35')][_0xfa8a('0x37')]?_0x1a7037[_0xfa8a('0x35')]:_0x25fe04[_0xfa8a('0x30')];if(!_0x53d537['query'][_0xfa8a('0x38')](_0xfa8a('0x39'))){_0x1a7037['limit']=qs['limit'](_0x53d537[_0xfa8a('0x32')][_0xfa8a('0x19')]);_0x1a7037[_0xfa8a('0x17')]=qs[_0xfa8a('0x17')](_0x53d537[_0xfa8a('0x32')][_0xfa8a('0x17')]);}_0x1a7037[_0xfa8a('0x3a')]=qs[_0xfa8a('0x3b')](_0x53d537[_0xfa8a('0x32')]['sort']);_0x1a7037[_0xfa8a('0x3c')]=qs[_0xfa8a('0x3d')](_[_0xfa8a('0x58')](_0x53d537[_0xfa8a('0x32')],_0x25fe04[_0xfa8a('0x3d')]));_0x1a7037[_0xfa8a('0x3c')]['CampaignId']=_0x545e1f['id'];if(_0x53d537['query'][_0xfa8a('0x3f')]){_0x1a7037[_0xfa8a('0x3c')]=_[_0xfa8a('0x3e')](_0x1a7037[_0xfa8a('0x3c')],{'$or':_[_0xfa8a('0x31')](_0x1a7037[_0xfa8a('0x35')],function(_0x537ab7){var _0x4de1ca={};_0x4de1ca[_0x537ab7]={'$like':'%'+_0x53d537[_0xfa8a('0x32')]['filter']+'%'};return _0x4de1ca;})});}_0x1a7037=_['merge']({},_0x1a7037,_0x53d537[_0xfa8a('0x40')]);return db['CmHopperHistory'][_0xfa8a('0x1a')]({'where':_0x1a7037[_0xfa8a('0x3c')]})[_0xfa8a('0x20')](function(_0x117104){_0x3e22c8[_0xfa8a('0x1a')]=_0x117104;if(_0x53d537[_0xfa8a('0x32')][_0xfa8a('0x4d')]){_0x1a7037['include']=[{'all':!![]}];}return db[_0xfa8a('0x5c')][_0xfa8a('0x5a')](_0x1a7037);})[_0xfa8a('0x20')](function(_0x2e014b){_0x3e22c8[_0xfa8a('0x41')]=_0x2e014b;return _0x3e22c8;});}})['then'](respondWithFilteredResult(_0x4e31ef,_0x1a7037))[_0xfa8a('0x42')](handleError(_0x4e31ef,null));};exports[_0xfa8a('0x5d')]=function(_0x390a3e,_0x18c539,_0x50b91c){var _0x3cfe55={'raw':!![],'where':{}};var _0x901c8e={};var _0x21b3f8={'count':0x0,'rows':[]};return db[_0xfa8a('0x2b')]['findOne']({'where':{'id':_0x390a3e['params']['id']}})[_0xfa8a('0x20')](handleEntityNotFound(_0x18c539,null))[_0xfa8a('0x20')](function(_0x416160){if(_0x416160){_0x901c8e[_0xfa8a('0x30')]=_[_0xfa8a('0x33')](db['CmHopperFinal'][_0xfa8a('0x2c')]);_0x901c8e[_0xfa8a('0x32')]=_[_0xfa8a('0x33')](_0x390a3e['query']);_0x901c8e[_0xfa8a('0x3d')]=_[_0xfa8a('0x34')](_0x901c8e[_0xfa8a('0x30')],_0x901c8e[_0xfa8a('0x32')]);_0x3cfe55[_0xfa8a('0x35')]=_[_0xfa8a('0x34')](_0x901c8e[_0xfa8a('0x30')],qs['fields'](_0x390a3e[_0xfa8a('0x32')]['fields']));_0x3cfe55[_0xfa8a('0x35')]=_0x3cfe55[_0xfa8a('0x35')][_0xfa8a('0x37')]?_0x3cfe55[_0xfa8a('0x35')]:_0x901c8e['model'];if(!_0x390a3e['query'][_0xfa8a('0x38')](_0xfa8a('0x39'))){_0x3cfe55['limit']=qs['limit'](_0x390a3e[_0xfa8a('0x32')][_0xfa8a('0x19')]);_0x3cfe55[_0xfa8a('0x17')]=qs['offset'](_0x390a3e[_0xfa8a('0x32')][_0xfa8a('0x17')]);}_0x3cfe55['order']=qs[_0xfa8a('0x3b')](_0x390a3e[_0xfa8a('0x32')]['sort']);_0x3cfe55[_0xfa8a('0x3c')]=qs[_0xfa8a('0x3d')](_[_0xfa8a('0x58')](_0x390a3e[_0xfa8a('0x32')],_0x901c8e['filters']));_0x3cfe55[_0xfa8a('0x3c')][_0xfa8a('0x59')]=_0x416160['id'];if(_0x390a3e[_0xfa8a('0x32')]['filter']){_0x3cfe55[_0xfa8a('0x3c')]=_[_0xfa8a('0x3e')](_0x3cfe55[_0xfa8a('0x3c')],{'$or':_['map'](_0x3cfe55['attributes'],function(_0x2f6d4d){var _0x14f357={};_0x14f357[_0x2f6d4d]={'$like':'%'+_0x390a3e[_0xfa8a('0x32')]['filter']+'%'};return _0x14f357;})});}_0x3cfe55=_[_0xfa8a('0x3e')]({},_0x3cfe55,_0x390a3e[_0xfa8a('0x40')]);return db[_0xfa8a('0x5e')]['count']({'where':_0x3cfe55[_0xfa8a('0x3c')]})[_0xfa8a('0x20')](function(_0x32ff8d){_0x21b3f8['count']=_0x32ff8d;if(_0x390a3e[_0xfa8a('0x32')][_0xfa8a('0x4d')]){_0x3cfe55[_0xfa8a('0x44')]=[{'all':!![]}];}return db[_0xfa8a('0x5e')][_0xfa8a('0x5a')](_0x3cfe55);})[_0xfa8a('0x20')](function(_0xafda40){_0x21b3f8[_0xfa8a('0x41')]=_0xafda40;return _0x21b3f8;});}})[_0xfa8a('0x20')](respondWithFilteredResult(_0x18c539,_0x3cfe55))[_0xfa8a('0x42')](handleError(_0x18c539,null));};exports[_0xfa8a('0x5f')]=function(_0x5ecd96,_0x45d51b,_0x3b5997){var _0x2509ac={'raw':!![],'where':{}};var _0x42bd4e={};var _0x513bbb={'count':0x0,'rows':[]};return db['Campaign'][_0xfa8a('0x56')]({'where':{'id':_0x5ecd96['params']['id']}})[_0xfa8a('0x20')](handleEntityNotFound(_0x45d51b,null))[_0xfa8a('0x20')](function(_0x47c3c2){if(_0x47c3c2){_0x42bd4e[_0xfa8a('0x30')]=_[_0xfa8a('0x33')](db[_0xfa8a('0x60')][_0xfa8a('0x2c')]);_0x42bd4e[_0xfa8a('0x32')]=_[_0xfa8a('0x33')](_0x5ecd96[_0xfa8a('0x32')]);_0x42bd4e['filters']=_[_0xfa8a('0x34')](_0x42bd4e[_0xfa8a('0x30')],_0x42bd4e[_0xfa8a('0x32')]);_0x2509ac[_0xfa8a('0x35')]=_[_0xfa8a('0x34')](_0x42bd4e[_0xfa8a('0x30')],qs[_0xfa8a('0x36')](_0x5ecd96[_0xfa8a('0x32')][_0xfa8a('0x36')]));_0x2509ac[_0xfa8a('0x35')]=_0x2509ac[_0xfa8a('0x35')][_0xfa8a('0x37')]?_0x2509ac[_0xfa8a('0x35')]:_0x42bd4e['model'];if(!_0x5ecd96['query'][_0xfa8a('0x38')]('nolimit')){_0x2509ac[_0xfa8a('0x19')]=qs[_0xfa8a('0x19')](_0x5ecd96[_0xfa8a('0x32')][_0xfa8a('0x19')]);_0x2509ac['offset']=qs[_0xfa8a('0x17')](_0x5ecd96[_0xfa8a('0x32')][_0xfa8a('0x17')]);}_0x2509ac[_0xfa8a('0x3a')]=qs['sort'](_0x5ecd96[_0xfa8a('0x32')][_0xfa8a('0x3b')]);_0x2509ac[_0xfa8a('0x3c')]=qs['filters'](_[_0xfa8a('0x58')](_0x5ecd96[_0xfa8a('0x32')],_0x42bd4e[_0xfa8a('0x3d')]));_0x2509ac['where'][_0xfa8a('0x59')]=_0x47c3c2['id'];if(_0x5ecd96[_0xfa8a('0x32')][_0xfa8a('0x3f')]){_0x2509ac[_0xfa8a('0x3c')]=_['merge'](_0x2509ac[_0xfa8a('0x3c')],{'$or':_['map'](_0x2509ac[_0xfa8a('0x35')],function(_0x574eeb){var _0x114ab9={};_0x114ab9[_0x574eeb]={'$like':'%'+_0x5ecd96[_0xfa8a('0x32')][_0xfa8a('0x3f')]+'%'};return _0x114ab9;})});}_0x2509ac=_[_0xfa8a('0x3e')]({},_0x2509ac,_0x5ecd96[_0xfa8a('0x40')]);return db[_0xfa8a('0x60')]['count']({'where':_0x2509ac[_0xfa8a('0x3c')]})[_0xfa8a('0x20')](function(_0x191ef3){_0x513bbb[_0xfa8a('0x1a')]=_0x191ef3;if(_0x5ecd96['query'][_0xfa8a('0x4d')]){_0x2509ac[_0xfa8a('0x44')]=[{'all':!![]}];}return db[_0xfa8a('0x60')]['findAll'](_0x2509ac);})[_0xfa8a('0x20')](function(_0x21d285){_0x513bbb['rows']=_0x21d285;return _0x513bbb;});}})[_0xfa8a('0x20')](respondWithFilteredResult(_0x45d51b,_0x2509ac))[_0xfa8a('0x42')](handleError(_0x45d51b,null));};exports[_0xfa8a('0x61')]=function(_0x3337b7,_0x1df64c,_0x5bf66a){var _0xfa6d75={};var _0x2df9fe={};var _0x450de3;var _0x331319;return db[_0xfa8a('0x2b')][_0xfa8a('0x56')]({'where':{'id':_0x3337b7[_0xfa8a('0x43')]['id']}})['then'](handleEntityNotFound(_0x1df64c,null))[_0xfa8a('0x20')](function(_0x558afa){if(_0x558afa){_0x450de3=_0x558afa;_0x2df9fe[_0xfa8a('0x30')]=_['keys'](db[_0xfa8a('0x62')][_0xfa8a('0x2c')]);_0x2df9fe[_0xfa8a('0x32')]=_[_0xfa8a('0x33')](_0x3337b7[_0xfa8a('0x32')]);_0x2df9fe[_0xfa8a('0x3d')]=_[_0xfa8a('0x34')](_0x2df9fe[_0xfa8a('0x30')],_0x2df9fe['query']);_0xfa6d75[_0xfa8a('0x35')]=_['intersection'](_0x2df9fe['model'],qs[_0xfa8a('0x36')](_0x3337b7['query'][_0xfa8a('0x36')]));_0xfa6d75[_0xfa8a('0x35')]=_0xfa6d75[_0xfa8a('0x35')]['length']?_0xfa6d75[_0xfa8a('0x35')]:_0x2df9fe[_0xfa8a('0x30')];_0xfa6d75[_0xfa8a('0x3a')]=qs[_0xfa8a('0x3b')](_0x3337b7[_0xfa8a('0x32')]['sort']);_0xfa6d75[_0xfa8a('0x3c')]=qs['filters'](_[_0xfa8a('0x58')](_0x3337b7['query'],_0x2df9fe[_0xfa8a('0x3d')]));if(_0x3337b7[_0xfa8a('0x32')][_0xfa8a('0x3f')]){_0xfa6d75[_0xfa8a('0x3c')]=_[_0xfa8a('0x3e')](_0xfa6d75[_0xfa8a('0x3c')],{'$or':_[_0xfa8a('0x31')](_0xfa6d75[_0xfa8a('0x35')],function(_0x2b1741){var _0x5d9c79={};_0x5d9c79[_0x2b1741]={'$like':'%'+_0x3337b7[_0xfa8a('0x32')][_0xfa8a('0x3f')]+'%'};return _0x5d9c79;})});}_0xfa6d75=_[_0xfa8a('0x3e')]({},_0xfa6d75,_0x3337b7['options']);return _0x450de3['getLists'](_0xfa6d75);}})[_0xfa8a('0x20')](function(_0xf76ec7){if(_0xf76ec7){_0x331319=_0xf76ec7[_0xfa8a('0x37')];if(!_0x3337b7['query']['hasOwnProperty'](_0xfa8a('0x39'))){_0xfa6d75[_0xfa8a('0x19')]=qs[_0xfa8a('0x19')](_0x3337b7['query'][_0xfa8a('0x19')]);_0xfa6d75[_0xfa8a('0x17')]=qs['offset'](_0x3337b7[_0xfa8a('0x32')][_0xfa8a('0x17')]);}return _0x450de3[_0xfa8a('0x61')](_0xfa6d75);}})[_0xfa8a('0x20')](function(_0x3ff2e8){if(_0x3ff2e8){return _0x3ff2e8?{'count':_0x331319,'rows':_0x3ff2e8}:null;}})[_0xfa8a('0x20')](respondWithResult(_0x1df64c,null))['catch'](handleError(_0x1df64c,null));};exports[_0xfa8a('0x63')]=function(_0x39bd85,_0x1ce22b,_0x49fb0a){var _0x1989c8,_0x5f0df7;return db[_0xfa8a('0x2b')]['find']({'where':{'id':_0x39bd85[_0xfa8a('0x43')]['id']}})[_0xfa8a('0x20')](handleEntityNotFound(_0x1ce22b,null))[_0xfa8a('0x20')](function(_0x4b1ebd){if(_0x4b1ebd){_0x5f0df7=_0x4b1ebd;return _0x4b1ebd['addLists'](_0x39bd85[_0xfa8a('0x46')][_0xfa8a('0x64')],_['omit'](_0x39bd85[_0xfa8a('0x46')],[_0xfa8a('0x64'),'id'])||{});}return null;})[_0xfa8a('0x65')](function(_0x4a7d54){var _0x477612;_0x1989c8=_0x4a7d54||[];var _0x2c5374=[];if(_0x4a7d54){for(var _0x403122=0x0;_0x403122<_0x4a7d54['length'];_0x403122+=0x1){var _0x10eccd=_0x4a7d54[_0x403122][_0xfa8a('0x22')]({'plain':!![]});_0x5f0df7[_0xfa8a('0x66')]=_0x39bd85[_0xfa8a('0x46')][_0xfa8a('0x66')]?_0x39bd85[_0xfa8a('0x46')]['dialCheckDuplicateType']:_0x5f0df7[_0xfa8a('0x66')];switch(_0x5f0df7['dialCheckDuplicateType']){case _0xfa8a('0x67'):_0x477612=squel['insert']()[_0xfa8a('0x68')]('cm_hopper')[_0xfa8a('0x69')]([_0xfa8a('0x6a'),_0xfa8a('0x6b'),_0xfa8a('0x6c'),_0xfa8a('0x6d'),_0xfa8a('0x59'),'createdAt','updatedAt'],squel[_0xfa8a('0x6e')]()[_0xfa8a('0x6f')](_0xfa8a('0x6a'),_0xfa8a('0x6a'))[_0xfa8a('0x6f')](_0xfa8a('0x70'),_0xfa8a('0x6b'))['field']('id','ContactId')[_0xfa8a('0x6f')](_0x10eccd[_0xfa8a('0x71')][_0xfa8a('0x72')](),_0xfa8a('0x6d'))[_0xfa8a('0x6f')](_0x39bd85[_0xfa8a('0x43')]['id']['toString'](),_0xfa8a('0x59'))[_0xfa8a('0x6f')](_0xfa8a('0x70'),_0xfa8a('0x4f'))['field'](_0xfa8a('0x70'),_0xfa8a('0x50'))['from'](_0xfa8a('0x73'))[_0xfa8a('0x3c')](_0xfa8a('0x74'))['where'](_0xfa8a('0x75'),_0x10eccd[_0xfa8a('0x71')]['toString']())['where'](_0xfa8a('0x76'))[_0xfa8a('0x3c')](_0xfa8a('0x77'),squel[_0xfa8a('0x6e')]()[_0xfa8a('0x6f')](_0xfa8a('0x78'))[_0xfa8a('0x79')](_0xfa8a('0x7a'))['where'](_0xfa8a('0x7b'),_0x39bd85[_0xfa8a('0x43')]['id'][_0xfa8a('0x72')]()))[_0xfa8a('0x3c')](_0xfa8a('0x77'),squel[_0xfa8a('0x6e')]()['field'](_0xfa8a('0x7c'))[_0xfa8a('0x79')](_0xfa8a('0x7d'))['where'](_0xfa8a('0x7b'),_0x39bd85[_0xfa8a('0x43')]['id'][_0xfa8a('0x72')]())))['toString']();break;case _0xfa8a('0x7e'):_0x477612=squel[_0xfa8a('0x7f')]()[_0xfa8a('0x68')](_0xfa8a('0x7d'))[_0xfa8a('0x69')]([_0xfa8a('0x6a'),_0xfa8a('0x6b'),_0xfa8a('0x6c'),'ListId',_0xfa8a('0x59'),'createdAt','updatedAt'],squel[_0xfa8a('0x6e')]()[_0xfa8a('0x6f')](_0xfa8a('0x6a'),'phone')[_0xfa8a('0x6f')](_0xfa8a('0x70'),_0xfa8a('0x6b'))[_0xfa8a('0x6f')]('id',_0xfa8a('0x6c'))[_0xfa8a('0x6f')](_0x10eccd[_0xfa8a('0x71')][_0xfa8a('0x72')](),_0xfa8a('0x6d'))[_0xfa8a('0x6f')](_0x39bd85['params']['id']['toString'](),'CampaignId')[_0xfa8a('0x6f')](_0xfa8a('0x70'),'createdAt')[_0xfa8a('0x6f')]('NOW()','updatedAt')[_0xfa8a('0x79')]('cm_contacts')[_0xfa8a('0x3c')](_0xfa8a('0x74'))[_0xfa8a('0x3c')]('ListId\x20=\x20?',_0x10eccd[_0xfa8a('0x71')][_0xfa8a('0x72')]())[_0xfa8a('0x3c')](_0xfa8a('0x76'))[_0xfa8a('0x3c')](_0xfa8a('0x77'),squel[_0xfa8a('0x6e')]()['field']('COALESCE(phone,\x27\x27)')[_0xfa8a('0x79')](_0xfa8a('0x7d'))['where']('CampaignId\x20=\x20?',_0x39bd85['params']['id'][_0xfa8a('0x72')]())))[_0xfa8a('0x72')]();break;default:_0x477612=squel[_0xfa8a('0x7f')]()[_0xfa8a('0x68')](_0xfa8a('0x7d'))[_0xfa8a('0x69')]([_0xfa8a('0x6a'),'scheduledAt',_0xfa8a('0x6c'),_0xfa8a('0x6d'),_0xfa8a('0x59'),_0xfa8a('0x4f'),_0xfa8a('0x50')],squel['select']()[_0xfa8a('0x6f')](_0xfa8a('0x6a'),_0xfa8a('0x6a'))[_0xfa8a('0x6f')]('NOW()',_0xfa8a('0x6b'))[_0xfa8a('0x6f')]('id',_0xfa8a('0x6c'))['field'](_0x10eccd[_0xfa8a('0x71')][_0xfa8a('0x72')](),_0xfa8a('0x6d'))['field'](_0x39bd85[_0xfa8a('0x43')]['id'][_0xfa8a('0x72')](),_0xfa8a('0x59'))[_0xfa8a('0x6f')](_0xfa8a('0x70'),'createdAt')[_0xfa8a('0x6f')](_0xfa8a('0x70'),'updatedAt')[_0xfa8a('0x79')](_0xfa8a('0x73'))[_0xfa8a('0x3c')](_0xfa8a('0x74'))[_0xfa8a('0x3c')](_0xfa8a('0x75'),_0x10eccd[_0xfa8a('0x71')]['toString']())[_0xfa8a('0x3c')](_0xfa8a('0x76')))['toString']();}_0x2c5374[_0xfa8a('0x80')](db[_0xfa8a('0x81')]['query'](_0x477612));}return BPromise['all'](_0x2c5374);}})[_0xfa8a('0x20')](function(){return _0x1989c8;})[_0xfa8a('0x20')](respondWithResult(_0x1ce22b,null))[_0xfa8a('0x42')](handleError(_0x1ce22b,null));};exports[_0xfa8a('0x82')]=function(_0x5c7dd0,_0x4080d2,_0x5c98a8){return db[_0xfa8a('0x2b')][_0xfa8a('0x49')]({'where':{'id':_0x5c7dd0[_0xfa8a('0x43')]['id']}})[_0xfa8a('0x20')](handleEntityNotFound(_0x4080d2,null))[_0xfa8a('0x20')](function(_0x2de6bf){if(_0x2de6bf){return _0x2de6bf['removeLists'](_0x5c7dd0['query']['ids']);}})[_0xfa8a('0x20')](function(_0x1b4752){if(_0x1b4752){return db[_0xfa8a('0x57')][_0xfa8a('0x21')]({'where':{'ListId':_0x5c7dd0[_0xfa8a('0x32')][_0xfa8a('0x64')],'CampaignId':_0x5c7dd0[_0xfa8a('0x43')]['id']}})[_0xfa8a('0x20')](function(){return _0x1b4752;});}})[_0xfa8a('0x20')](respondWithStatusCode(_0x4080d2,null))[_0xfa8a('0x42')](handleError(_0x4080d2,null));};exports[_0xfa8a('0x83')]=function(_0x18fe18,_0x54c09c,_0x50e3d9){var _0x5b74a9={};var _0x533e9e={};var _0x21e787;var _0x13db86;return db[_0xfa8a('0x2b')]['findOne']({'where':{'id':_0x18fe18['params']['id']}})[_0xfa8a('0x20')](handleEntityNotFound(_0x54c09c,null))['then'](function(_0x4b6ded){if(_0x4b6ded){_0x21e787=_0x4b6ded;_0x533e9e['model']=_[_0xfa8a('0x33')](db[_0xfa8a('0x62')][_0xfa8a('0x2c')]);_0x533e9e['query']=_[_0xfa8a('0x33')](_0x18fe18[_0xfa8a('0x32')]);_0x533e9e[_0xfa8a('0x3d')]=_[_0xfa8a('0x34')](_0x533e9e[_0xfa8a('0x30')],_0x533e9e[_0xfa8a('0x32')]);_0x5b74a9[_0xfa8a('0x35')]=_[_0xfa8a('0x34')](_0x533e9e[_0xfa8a('0x30')],qs[_0xfa8a('0x36')](_0x18fe18['query']['fields']));_0x5b74a9[_0xfa8a('0x35')]=_0x5b74a9[_0xfa8a('0x35')][_0xfa8a('0x37')]?_0x5b74a9['attributes']:_0x533e9e[_0xfa8a('0x30')];_0x5b74a9[_0xfa8a('0x3a')]=qs[_0xfa8a('0x3b')](_0x18fe18[_0xfa8a('0x32')][_0xfa8a('0x3b')]);_0x5b74a9[_0xfa8a('0x3c')]=qs[_0xfa8a('0x3d')](_[_0xfa8a('0x58')](_0x18fe18[_0xfa8a('0x32')],_0x533e9e[_0xfa8a('0x3d')]));if(_0x18fe18[_0xfa8a('0x32')]['filter']){_0x5b74a9[_0xfa8a('0x3c')]=_['merge'](_0x5b74a9['where'],{'$or':_[_0xfa8a('0x31')](_0x5b74a9[_0xfa8a('0x35')],function(_0x4b41d7){var _0x406911={};_0x406911[_0x4b41d7]={'$like':'%'+_0x18fe18[_0xfa8a('0x32')][_0xfa8a('0x3f')]+'%'};return _0x406911;})});}_0x5b74a9=_['merge']({},_0x5b74a9,_0x18fe18[_0xfa8a('0x40')]);return _0x21e787[_0xfa8a('0x83')](_0x5b74a9);}})[_0xfa8a('0x20')](function(_0x25b8ab){if(_0x25b8ab){_0x13db86=_0x25b8ab[_0xfa8a('0x37')];if(!_0x18fe18[_0xfa8a('0x32')][_0xfa8a('0x38')](_0xfa8a('0x39'))){_0x5b74a9[_0xfa8a('0x19')]=qs[_0xfa8a('0x19')](_0x18fe18[_0xfa8a('0x32')][_0xfa8a('0x19')]);_0x5b74a9[_0xfa8a('0x17')]=qs[_0xfa8a('0x17')](_0x18fe18[_0xfa8a('0x32')][_0xfa8a('0x17')]);}return _0x21e787[_0xfa8a('0x83')](_0x5b74a9);}})['then'](function(_0x3a6a3b){if(_0x3a6a3b){return _0x3a6a3b?{'count':_0x13db86,'rows':_0x3a6a3b}:null;}})['then'](respondWithResult(_0x54c09c,null))[_0xfa8a('0x42')](handleError(_0x54c09c,null));};exports[_0xfa8a('0x84')]=function(_0x20025a,_0x5685f0,_0x105cde){var _0x4ee118,_0x585099;return db[_0xfa8a('0x2b')][_0xfa8a('0x49')]({'where':{'id':_0x20025a[_0xfa8a('0x43')]['id']}})[_0xfa8a('0x20')](handleEntityNotFound(_0x5685f0,null))[_0xfa8a('0x20')](function(_0x2f022a){if(_0x2f022a){_0x585099=_0x2f022a;return _0x2f022a[_0xfa8a('0x84')](_0x20025a[_0xfa8a('0x46')][_0xfa8a('0x64')],_[_0xfa8a('0x4e')](_0x20025a[_0xfa8a('0x46')],[_0xfa8a('0x64'),'id'])||{});}return null;})[_0xfa8a('0x65')](function(_0x46dcfc){var _0x26227c;_0x4ee118=_0x46dcfc||[];var _0x3899fa=[];if(_0x46dcfc){for(var _0x4fa5f4=0x0;_0x4fa5f4<_0x46dcfc[_0xfa8a('0x37')];_0x4fa5f4+=0x1){var _0x4b635c=_0x46dcfc[_0x4fa5f4][_0xfa8a('0x22')]({'plain':!![]});_0x26227c=squel['insert']()[_0xfa8a('0x68')](_0xfa8a('0x85'))[_0xfa8a('0x69')]([_0xfa8a('0x6a'),_0xfa8a('0x6c'),'ListId','CampaignId','createdAt',_0xfa8a('0x50')],squel[_0xfa8a('0x6e')]()[_0xfa8a('0x6f')](_0xfa8a('0x6a'),'phone')[_0xfa8a('0x6f')]('id',_0xfa8a('0x6c'))[_0xfa8a('0x6f')](_0x4b635c['CmListId'][_0xfa8a('0x72')](),_0xfa8a('0x6d'))[_0xfa8a('0x6f')](_0x20025a[_0xfa8a('0x43')]['id']['toString'](),_0xfa8a('0x59'))[_0xfa8a('0x6f')](_0xfa8a('0x70'),_0xfa8a('0x4f'))[_0xfa8a('0x6f')](_0xfa8a('0x70'),_0xfa8a('0x50'))['from'](_0xfa8a('0x73'))[_0xfa8a('0x3c')]('deletedAt\x20IS\x20NULL')[_0xfa8a('0x3c')]('ListId\x20=\x20?',_0x4b635c[_0xfa8a('0x71')]['toString']())[_0xfa8a('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0xfa8a('0x72')]();_0x3899fa[_0xfa8a('0x80')](db[_0xfa8a('0x81')][_0xfa8a('0x32')](_0x26227c));}return BPromise[_0xfa8a('0x86')](_0x3899fa);}})[_0xfa8a('0x20')](function(){return _0x4ee118;})[_0xfa8a('0x20')](respondWithResult(_0x5685f0,null))['catch'](handleError(_0x5685f0,null));};exports['removeBlackLists']=function(_0x34dbe6,_0x1b8844,_0x117074){return db['Campaign']['find']({'where':{'id':_0x34dbe6['params']['id']}})[_0xfa8a('0x20')](handleEntityNotFound(_0x1b8844,null))[_0xfa8a('0x20')](function(_0x402780){if(_0x402780){return _0x402780['removeBlackLists'](_0x34dbe6[_0xfa8a('0x32')]['ids']);}})[_0xfa8a('0x20')](function(_0x14b63a){if(_0x14b63a){return db[_0xfa8a('0x60')]['destroy']({'where':{'ListId':_0x34dbe6['query'][_0xfa8a('0x64')],'CampaignId':_0x34dbe6['params']['id']}})['then'](function(){return _0x14b63a;});}})['then'](respondWithStatusCode(_0x1b8844,null))[_0xfa8a('0x42')](handleError(_0x1b8844,null));}; \ No newline at end of file +var _0x58da=['path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','Campaign','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','create','user','role','IvrCampaigns','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','NOW()','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?','select','COALESCE(phone,\x27\x27)','cm_hopper','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x501946,_0x4bc611){var _0x4660af=function(_0x1834cd){while(--_0x1834cd){_0x501946['push'](_0x501946['shift']());}};_0x4660af(++_0x4bc611);}(_0x58da,0x186));var _0xa58d=function(_0x1eb3a5,_0x314b7d){_0x1eb3a5=_0x1eb3a5-0x0;var _0x47fcec=_0x58da[_0x1eb3a5];return _0x47fcec;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa58d('0x0'));var jsonpatch=require(_0xa58d('0x1'));var rp=require(_0xa58d('0x2'));var moment=require(_0xa58d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa58d('0x4'));var util=require(_0xa58d('0x5'));var path=require(_0xa58d('0x6'));var sox=require('sox');var csv=require(_0xa58d('0x7'));var ejs=require(_0xa58d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa58d('0x9'));var crypto=require(_0xa58d('0xa'));var jsforce=require(_0xa58d('0xb'));var deskjs=require(_0xa58d('0xc'));var toCsv=require(_0xa58d('0x7'));var querystring=require(_0xa58d('0xd'));var Papa=require(_0xa58d('0xe'));var Redis=require(_0xa58d('0xf'));var authService=require(_0xa58d('0x10'));var qs=require(_0xa58d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa58d('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa58d('0x13'))['db'];function respondWithStatusCode(_0x29f63c,_0xb97e04){_0xb97e04=_0xb97e04||0xcc;return function(_0x2d5eb1){if(_0x2d5eb1){return _0x29f63c[_0xa58d('0x14')](_0xb97e04);}return _0x29f63c[_0xa58d('0x15')](_0xb97e04)['end']();};}function respondWithResult(_0x4d0b53,_0x29e35b){_0x29e35b=_0x29e35b||0xc8;return function(_0x5b1ad5){if(_0x5b1ad5){return _0x4d0b53[_0xa58d('0x15')](_0x29e35b)[_0xa58d('0x16')](_0x5b1ad5);}};}function respondWithFilteredResult(_0x563685,_0x4930d5){return function(_0x189d5d){if(_0x189d5d){var _0x534258=typeof _0x4930d5[_0xa58d('0x17')]===_0xa58d('0x18')&&typeof _0x4930d5[_0xa58d('0x19')]===_0xa58d('0x18');var _0xd70789=_0x189d5d[_0xa58d('0x1a')];var _0x25205e=_0x534258?0x0:_0x4930d5[_0xa58d('0x17')];var _0x456ae0=_0x534258?_0x189d5d[_0xa58d('0x1a')]:_0x4930d5[_0xa58d('0x17')]+_0x4930d5[_0xa58d('0x19')];var _0x35c13c;if(_0x456ae0>=_0xd70789){_0x456ae0=_0xd70789;_0x35c13c=0xc8;}else{_0x35c13c=0xce;}_0x563685[_0xa58d('0x15')](_0x35c13c);return _0x563685[_0xa58d('0x1b')]('Content-Range',_0x25205e+'-'+_0x456ae0+'/'+_0xd70789)[_0xa58d('0x16')](_0x189d5d);}return null;};}function patchUpdates(_0x4eea21){return function(_0x324843){try{jsonpatch[_0xa58d('0x1c')](_0x324843,_0x4eea21,!![]);}catch(_0x260a8c){return BPromise[_0xa58d('0x1d')](_0x260a8c);}return _0x324843[_0xa58d('0x1e')]();};}function saveUpdates(_0x206e95,_0x3329d5){return function(_0x3427cf){if(_0x3427cf){return _0x3427cf[_0xa58d('0x1f')](_0x206e95)[_0xa58d('0x20')](function(_0x51d0b1){return _0x51d0b1;});}return null;};}function removeEntity(_0x5161d1,_0x4373e6){return function(_0x477384){if(_0x477384){return _0x477384[_0xa58d('0x21')]()[_0xa58d('0x20')](function(){var _0x259999=_0x477384[_0xa58d('0x22')]({'plain':!![]});var _0x5153e7='IvrCampaigns';return db[_0xa58d('0x23')][_0xa58d('0x21')]({'where':{'type':_0x5153e7,'resourceId':_0x259999['id']}})[_0xa58d('0x20')](function(){return _0x477384;});})['then'](function(){_0x5161d1[_0xa58d('0x15')](0xcc)[_0xa58d('0x24')]();});}};}function handleEntityNotFound(_0x13dea8,_0x13e01a){return function(_0x577315){if(!_0x577315){_0x13dea8[_0xa58d('0x14')](0x194);}return _0x577315;};}function handleError(_0x407ff9,_0x16b2b9){_0x16b2b9=_0x16b2b9||0x1f4;return function(_0x4960b9){logger['error'](_0x4960b9[_0xa58d('0x25')]);if(_0x4960b9[_0xa58d('0x26')]){delete _0x4960b9[_0xa58d('0x26')];}_0x407ff9['status'](_0x16b2b9)[_0xa58d('0x27')](_0x4960b9);};}exports[_0xa58d('0x28')]=function(_0x196dcd,_0x24aec9){var _0x17a17c={},_0x61d248={},_0x18b6bf={'count':0x0,'rows':[]};var _0x14a54b=_[_0xa58d('0x29')](db[_0xa58d('0x2a')][_0xa58d('0x2b')],function(_0x1f5068){return{'name':_0x1f5068[_0xa58d('0x2c')],'type':_0x1f5068['type']['key']};});_0x61d248[_0xa58d('0x2d')]=_[_0xa58d('0x29')](_0x14a54b,_0xa58d('0x26'));_0x61d248[_0xa58d('0x2e')]=_[_0xa58d('0x2f')](_0x196dcd[_0xa58d('0x2e')]);_0x61d248[_0xa58d('0x30')]=_[_0xa58d('0x31')](_0x61d248[_0xa58d('0x2d')],_0x61d248[_0xa58d('0x2e')]);_0x17a17c[_0xa58d('0x32')]=_['intersection'](_0x61d248[_0xa58d('0x2d')],qs[_0xa58d('0x33')](_0x196dcd[_0xa58d('0x2e')][_0xa58d('0x33')]));_0x17a17c[_0xa58d('0x32')]=_0x17a17c[_0xa58d('0x32')][_0xa58d('0x34')]?_0x17a17c['attributes']:_0x61d248[_0xa58d('0x2d')];if(!_0x196dcd['query'][_0xa58d('0x35')](_0xa58d('0x36'))){_0x17a17c['limit']=qs[_0xa58d('0x19')](_0x196dcd[_0xa58d('0x2e')][_0xa58d('0x19')]);_0x17a17c[_0xa58d('0x17')]=qs[_0xa58d('0x17')](_0x196dcd['query'][_0xa58d('0x17')]);}_0x17a17c[_0xa58d('0x37')]=qs[_0xa58d('0x38')](_0x196dcd[_0xa58d('0x2e')]['sort']);_0x17a17c[_0xa58d('0x39')]=qs[_0xa58d('0x30')](_[_0xa58d('0x3a')](_0x196dcd[_0xa58d('0x2e')],_0x61d248['filters']),_0x14a54b);if(_0x196dcd[_0xa58d('0x2e')][_0xa58d('0x3b')]){_0x17a17c[_0xa58d('0x39')]=_[_0xa58d('0x3c')](_0x17a17c['where'],{'$or':_[_0xa58d('0x29')](_0x14a54b,function(_0x14150a){if(_0x14150a[_0xa58d('0x3d')]!=='VIRTUAL'){var _0x2c6d7c={};_0x2c6d7c[_0x14150a[_0xa58d('0x26')]]={'$like':'%'+_0x196dcd[_0xa58d('0x2e')]['filter']+'%'};return _0x2c6d7c;}})});}_0x17a17c=_[_0xa58d('0x3c')]({},_0x17a17c,_0x196dcd[_0xa58d('0x3e')]);var _0x594327={'where':_0x17a17c['where']};return db['Campaign'][_0xa58d('0x1a')](_0x594327)[_0xa58d('0x20')](function(_0x2ffaba){_0x18b6bf[_0xa58d('0x1a')]=_0x2ffaba;if(_0x196dcd[_0xa58d('0x2e')][_0xa58d('0x3f')]){_0x17a17c[_0xa58d('0x40')]=[{'all':!![]}];}return db[_0xa58d('0x2a')][_0xa58d('0x41')](_0x17a17c);})['then'](function(_0x4f2b48){_0x18b6bf[_0xa58d('0x42')]=_0x4f2b48;return _0x18b6bf;})[_0xa58d('0x20')](respondWithFilteredResult(_0x24aec9,_0x17a17c))[_0xa58d('0x43')](handleError(_0x24aec9,null));};exports[_0xa58d('0x44')]=function(_0x1ded97,_0x53a8fe){var _0x217919={'raw':![],'where':{'id':_0x1ded97[_0xa58d('0x45')]['id']}},_0xc8e60e={};_0xc8e60e[_0xa58d('0x2d')]=_[_0xa58d('0x2f')](db[_0xa58d('0x2a')][_0xa58d('0x2b')]);_0xc8e60e[_0xa58d('0x2e')]=_[_0xa58d('0x2f')](_0x1ded97[_0xa58d('0x2e')]);_0xc8e60e['filters']=_[_0xa58d('0x31')](_0xc8e60e[_0xa58d('0x2d')],_0xc8e60e[_0xa58d('0x2e')]);_0x217919[_0xa58d('0x32')]=_[_0xa58d('0x31')](_0xc8e60e[_0xa58d('0x2d')],qs[_0xa58d('0x33')](_0x1ded97[_0xa58d('0x2e')][_0xa58d('0x33')]));_0x217919[_0xa58d('0x32')]=_0x217919[_0xa58d('0x32')][_0xa58d('0x34')]?_0x217919[_0xa58d('0x32')]:_0xc8e60e[_0xa58d('0x2d')];if(_0x1ded97[_0xa58d('0x2e')][_0xa58d('0x3f')]){_0x217919['include']=[{'all':!![]}];}_0x217919=_[_0xa58d('0x3c')]({},_0x217919,_0x1ded97[_0xa58d('0x3e')]);return db[_0xa58d('0x2a')]['find'](_0x217919)[_0xa58d('0x20')](handleEntityNotFound(_0x53a8fe,null))[_0xa58d('0x20')](respondWithResult(_0x53a8fe,null))[_0xa58d('0x43')](handleError(_0x53a8fe,null));};exports[_0xa58d('0x46')]=function(_0x2009ea,_0x58a1d6){return db[_0xa58d('0x2a')][_0xa58d('0x46')](_0x2009ea['body'],{})[_0xa58d('0x20')](function(_0xb44d32){var _0x218c0b=_0x2009ea[_0xa58d('0x47')][_0xa58d('0x22')]({'plain':!![]});if(!_0x218c0b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x218c0b[_0xa58d('0x48')]==='user'){var _0x47bf49=_0xb44d32['get']({'plain':!![]});var _0x555213=_0xa58d('0x49');return db['UserProfileSection'][_0xa58d('0x4a')]({'where':{'name':_0x555213,'userProfileId':_0x218c0b[_0xa58d('0x4b')]},'raw':!![]})[_0xa58d('0x20')](function(_0x414ac9){if(_0x414ac9&&_0x414ac9[_0xa58d('0x4c')]===0x0){return db['UserProfileResource'][_0xa58d('0x46')]({'name':_0x47bf49[_0xa58d('0x26')],'resourceId':_0x47bf49['id'],'type':_0x414ac9[_0xa58d('0x26')],'sectionId':_0x414ac9['id']},{})[_0xa58d('0x20')](function(){return _0xb44d32;});}else{return _0xb44d32;}})['catch'](function(_0x2a4427){logger[_0xa58d('0x4d')](_0xa58d('0x4e'),_0x2a4427);throw _0x2a4427;});}return _0xb44d32;})['then'](respondWithResult(_0x58a1d6,0xc9))['catch'](handleError(_0x58a1d6,null));};exports['clone']=function(_0x442310,_0x2c1ab3){var _0x57ca0a={'where':{'id':_0x442310['params']['id']}},_0x8ad881={};_0x8ad881[_0xa58d('0x2d')]=_[_0xa58d('0x2f')](db[_0xa58d('0x2a')][_0xa58d('0x2b')]);_0x57ca0a[_0xa58d('0x32')]=_['intersection'](_0x8ad881['model'],qs[_0xa58d('0x33')](_0x442310[_0xa58d('0x2e')][_0xa58d('0x33')]));_0x57ca0a['attributes']=_0x57ca0a['attributes'][_0xa58d('0x34')]?_0x57ca0a[_0xa58d('0x32')]:_0x8ad881['model'];if(_0x442310[_0xa58d('0x2e')][_0xa58d('0x3f')]){_0x57ca0a['include']=[{'all':!![]}];}_0x57ca0a=_[_0xa58d('0x3c')]({},_0x57ca0a,_0x442310[_0xa58d('0x3e')]);return db[_0xa58d('0x2a')][_0xa58d('0x4a')](_0x57ca0a)[_0xa58d('0x20')](handleEntityNotFound(_0x2c1ab3,null))[_0xa58d('0x20')](function(_0x1f2574){if(_0x1f2574){var _0x33353b=_0x1f2574[_0xa58d('0x22')]({'plain':!![]});_0x33353b=qs[_0xa58d('0x4f')](_0x33353b,['id',_0xa58d('0x50'),_0xa58d('0x51')]);_0x442310['body']=_[_0xa58d('0x4f')](_0x442310[_0xa58d('0x52')],['id',_0xa58d('0x50'),_0xa58d('0x51')]);return db[_0xa58d('0x2a')]['create'](_[_0xa58d('0x3c')](_0x33353b,_0x442310[_0xa58d('0x52')]),{'include':_0x442310[_0xa58d('0x2e')][_0xa58d('0x3f')]?[{'all':!![]}]:undefined})[_0xa58d('0x20')](function(_0x20f805){var _0x528b1c=_0x442310[_0xa58d('0x47')][_0xa58d('0x22')]({'plain':!![]});if(!_0x528b1c)throw new Error(_0xa58d('0x53'));if(_0x528b1c[_0xa58d('0x48')]===_0xa58d('0x47')){var _0x33cca3=_0x20f805[_0xa58d('0x22')]({'plain':!![]});var _0xc60504=_0xa58d('0x49');return db[_0xa58d('0x54')][_0xa58d('0x4a')]({'where':{'name':_0xc60504,'userProfileId':_0x528b1c[_0xa58d('0x4b')]},'raw':!![]})[_0xa58d('0x20')](function(_0x1c9b81){if(_0x1c9b81&&_0x1c9b81[_0xa58d('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x33cca3['name'],'resourceId':_0x33cca3['id'],'type':_0x1c9b81[_0xa58d('0x26')],'sectionId':_0x1c9b81['id']},{})['then'](function(){return _0x20f805;});}else{return _0x20f805;}})[_0xa58d('0x43')](function(_0xc2adb4){logger['error'](_0xa58d('0x4e'),_0xc2adb4);throw _0xc2adb4;});}return _0x20f805;});}})[_0xa58d('0x20')](respondWithResult(_0x2c1ab3,0xc9))['catch'](handleError(_0x2c1ab3,null));};exports[_0xa58d('0x1f')]=function(_0x3ed848,_0x34b90d){if(_0x3ed848['body']['id']){delete _0x3ed848[_0xa58d('0x52')]['id'];}return db[_0xa58d('0x2a')]['find']({'where':{'id':_0x3ed848[_0xa58d('0x45')]['id']}})[_0xa58d('0x20')](handleEntityNotFound(_0x34b90d,null))[_0xa58d('0x20')](saveUpdates(_0x3ed848[_0xa58d('0x52')],null))[_0xa58d('0x20')](respondWithResult(_0x34b90d,null))['catch'](handleError(_0x34b90d,null));};exports['destroy']=function(_0x122edf,_0x31caec){return db[_0xa58d('0x2a')][_0xa58d('0x4a')]({'where':{'id':_0x122edf[_0xa58d('0x45')]['id']}})['then'](handleEntityNotFound(_0x31caec,null))[_0xa58d('0x20')](removeEntity(_0x31caec,null))[_0xa58d('0x43')](handleError(_0x31caec,null));};exports[_0xa58d('0x55')]=function(_0x389a51,_0x2d55a1,_0x1a236e){var _0x5d2f64={'raw':!![],'where':{}};var _0x528ac4={};var _0x2debfa={'count':0x0,'rows':[]};return db[_0xa58d('0x2a')]['findOne']({'where':{'id':_0x389a51[_0xa58d('0x45')]['id']}})[_0xa58d('0x20')](handleEntityNotFound(_0x2d55a1,null))['then'](function(_0x315986){if(_0x315986){_0x528ac4[_0xa58d('0x2d')]=_[_0xa58d('0x2f')](db[_0xa58d('0x56')][_0xa58d('0x2b')]);_0x528ac4[_0xa58d('0x2e')]=_['keys'](_0x389a51['query']);_0x528ac4[_0xa58d('0x30')]=_[_0xa58d('0x31')](_0x528ac4['model'],_0x528ac4[_0xa58d('0x2e')]);_0x5d2f64[_0xa58d('0x32')]=_[_0xa58d('0x31')](_0x528ac4['model'],qs[_0xa58d('0x33')](_0x389a51[_0xa58d('0x2e')][_0xa58d('0x33')]));_0x5d2f64[_0xa58d('0x32')]=_0x5d2f64['attributes'][_0xa58d('0x34')]?_0x5d2f64[_0xa58d('0x32')]:_0x528ac4[_0xa58d('0x2d')];if(!_0x389a51['query'][_0xa58d('0x35')](_0xa58d('0x36'))){_0x5d2f64['limit']=qs[_0xa58d('0x19')](_0x389a51[_0xa58d('0x2e')][_0xa58d('0x19')]);_0x5d2f64[_0xa58d('0x17')]=qs[_0xa58d('0x17')](_0x389a51[_0xa58d('0x2e')][_0xa58d('0x17')]);}_0x5d2f64['order']=qs['sort'](_0x389a51[_0xa58d('0x2e')][_0xa58d('0x38')]);_0x5d2f64[_0xa58d('0x39')]=qs['filters'](_[_0xa58d('0x3a')](_0x389a51['query'],_0x528ac4[_0xa58d('0x30')]));_0x5d2f64['where'][_0xa58d('0x57')]=_0x315986['id'];if(_0x389a51[_0xa58d('0x2e')][_0xa58d('0x3b')]){_0x5d2f64[_0xa58d('0x39')]=_[_0xa58d('0x3c')](_0x5d2f64[_0xa58d('0x39')],{'$or':_[_0xa58d('0x29')](_0x5d2f64[_0xa58d('0x32')],function(_0xc644b3){var _0x560ffe={};_0x560ffe[_0xc644b3]={'$like':'%'+_0x389a51[_0xa58d('0x2e')][_0xa58d('0x3b')]+'%'};return _0x560ffe;})});}_0x5d2f64=_[_0xa58d('0x3c')]({},_0x5d2f64,_0x389a51[_0xa58d('0x3e')]);return db[_0xa58d('0x56')][_0xa58d('0x1a')]({'where':_0x5d2f64['where']})[_0xa58d('0x20')](function(_0x5a252f){_0x2debfa['count']=_0x5a252f;if(_0x389a51[_0xa58d('0x2e')][_0xa58d('0x3f')]){_0x5d2f64[_0xa58d('0x40')]=[{'all':!![]}];}return db[_0xa58d('0x56')][_0xa58d('0x41')](_0x5d2f64);})['then'](function(_0x44604f){_0x2debfa[_0xa58d('0x42')]=_0x44604f;return _0x2debfa;});}})[_0xa58d('0x20')](respondWithFilteredResult(_0x2d55a1,_0x5d2f64))[_0xa58d('0x43')](handleError(_0x2d55a1,null));};exports[_0xa58d('0x58')]=function(_0x563211,_0xf429d6,_0x2645e4){var _0x7ebb57={'raw':!![],'where':{}};var _0x335b1f={};var _0x4d147e={'count':0x0,'rows':[]};return db[_0xa58d('0x2a')][_0xa58d('0x59')]({'where':{'id':_0x563211[_0xa58d('0x45')]['id']}})['then'](handleEntityNotFound(_0xf429d6,null))[_0xa58d('0x20')](function(_0x1b2cc3){if(_0x1b2cc3){_0x335b1f[_0xa58d('0x2d')]=_[_0xa58d('0x2f')](db[_0xa58d('0x5a')][_0xa58d('0x2b')]);_0x335b1f[_0xa58d('0x2e')]=_['keys'](_0x563211[_0xa58d('0x2e')]);_0x335b1f[_0xa58d('0x30')]=_['intersection'](_0x335b1f[_0xa58d('0x2d')],_0x335b1f['query']);_0x7ebb57[_0xa58d('0x32')]=_[_0xa58d('0x31')](_0x335b1f[_0xa58d('0x2d')],qs['fields'](_0x563211[_0xa58d('0x2e')]['fields']));_0x7ebb57[_0xa58d('0x32')]=_0x7ebb57[_0xa58d('0x32')][_0xa58d('0x34')]?_0x7ebb57[_0xa58d('0x32')]:_0x335b1f['model'];if(!_0x563211['query'][_0xa58d('0x35')](_0xa58d('0x36'))){_0x7ebb57['limit']=qs[_0xa58d('0x19')](_0x563211[_0xa58d('0x2e')][_0xa58d('0x19')]);_0x7ebb57[_0xa58d('0x17')]=qs[_0xa58d('0x17')](_0x563211['query'][_0xa58d('0x17')]);}_0x7ebb57['order']=qs[_0xa58d('0x38')](_0x563211['query'][_0xa58d('0x38')]);_0x7ebb57['where']=qs[_0xa58d('0x30')](_['pick'](_0x563211[_0xa58d('0x2e')],_0x335b1f[_0xa58d('0x30')]));_0x7ebb57[_0xa58d('0x39')][_0xa58d('0x57')]=_0x1b2cc3['id'];if(_0x563211[_0xa58d('0x2e')]['filter']){_0x7ebb57[_0xa58d('0x39')]=_[_0xa58d('0x3c')](_0x7ebb57['where'],{'$or':_[_0xa58d('0x29')](_0x7ebb57[_0xa58d('0x32')],function(_0x556f98){var _0x32dfb2={};_0x32dfb2[_0x556f98]={'$like':'%'+_0x563211[_0xa58d('0x2e')][_0xa58d('0x3b')]+'%'};return _0x32dfb2;})});}_0x7ebb57=_['merge']({},_0x7ebb57,_0x563211[_0xa58d('0x3e')]);return db[_0xa58d('0x5a')][_0xa58d('0x1a')]({'where':_0x7ebb57[_0xa58d('0x39')]})[_0xa58d('0x20')](function(_0x44ba4a){_0x4d147e['count']=_0x44ba4a;if(_0x563211['query'][_0xa58d('0x3f')]){_0x7ebb57[_0xa58d('0x40')]=[{'all':!![]}];}return db[_0xa58d('0x5a')][_0xa58d('0x41')](_0x7ebb57);})[_0xa58d('0x20')](function(_0x4f58f9){_0x4d147e[_0xa58d('0x42')]=_0x4f58f9;return _0x4d147e;});}})[_0xa58d('0x20')](respondWithFilteredResult(_0xf429d6,_0x7ebb57))[_0xa58d('0x43')](handleError(_0xf429d6,null));};exports['getHopperFinals']=function(_0x84e979,_0x1c9c7d,_0x28414d){var _0x48ae3b={'raw':!![],'where':{}};var _0x50067f={};var _0x232224={'count':0x0,'rows':[]};return db[_0xa58d('0x2a')][_0xa58d('0x59')]({'where':{'id':_0x84e979[_0xa58d('0x45')]['id']}})[_0xa58d('0x20')](handleEntityNotFound(_0x1c9c7d,null))[_0xa58d('0x20')](function(_0xe84f0f){if(_0xe84f0f){_0x50067f[_0xa58d('0x2d')]=_[_0xa58d('0x2f')](db[_0xa58d('0x5b')]['rawAttributes']);_0x50067f['query']=_['keys'](_0x84e979[_0xa58d('0x2e')]);_0x50067f[_0xa58d('0x30')]=_[_0xa58d('0x31')](_0x50067f[_0xa58d('0x2d')],_0x50067f[_0xa58d('0x2e')]);_0x48ae3b[_0xa58d('0x32')]=_[_0xa58d('0x31')](_0x50067f[_0xa58d('0x2d')],qs[_0xa58d('0x33')](_0x84e979[_0xa58d('0x2e')]['fields']));_0x48ae3b[_0xa58d('0x32')]=_0x48ae3b[_0xa58d('0x32')][_0xa58d('0x34')]?_0x48ae3b[_0xa58d('0x32')]:_0x50067f['model'];if(!_0x84e979['query']['hasOwnProperty']('nolimit')){_0x48ae3b[_0xa58d('0x19')]=qs[_0xa58d('0x19')](_0x84e979['query'][_0xa58d('0x19')]);_0x48ae3b['offset']=qs['offset'](_0x84e979[_0xa58d('0x2e')][_0xa58d('0x17')]);}_0x48ae3b[_0xa58d('0x37')]=qs[_0xa58d('0x38')](_0x84e979[_0xa58d('0x2e')][_0xa58d('0x38')]);_0x48ae3b[_0xa58d('0x39')]=qs[_0xa58d('0x30')](_[_0xa58d('0x3a')](_0x84e979[_0xa58d('0x2e')],_0x50067f[_0xa58d('0x30')]));_0x48ae3b[_0xa58d('0x39')][_0xa58d('0x57')]=_0xe84f0f['id'];if(_0x84e979[_0xa58d('0x2e')][_0xa58d('0x3b')]){_0x48ae3b[_0xa58d('0x39')]=_[_0xa58d('0x3c')](_0x48ae3b[_0xa58d('0x39')],{'$or':_['map'](_0x48ae3b['attributes'],function(_0x4df06d){var _0x5461f8={};_0x5461f8[_0x4df06d]={'$like':'%'+_0x84e979[_0xa58d('0x2e')][_0xa58d('0x3b')]+'%'};return _0x5461f8;})});}_0x48ae3b=_[_0xa58d('0x3c')]({},_0x48ae3b,_0x84e979[_0xa58d('0x3e')]);return db[_0xa58d('0x5b')][_0xa58d('0x1a')]({'where':_0x48ae3b['where']})[_0xa58d('0x20')](function(_0x2f704e){_0x232224[_0xa58d('0x1a')]=_0x2f704e;if(_0x84e979[_0xa58d('0x2e')][_0xa58d('0x3f')]){_0x48ae3b[_0xa58d('0x40')]=[{'all':!![]}];}return db[_0xa58d('0x5b')][_0xa58d('0x41')](_0x48ae3b);})['then'](function(_0x25777c){_0x232224[_0xa58d('0x42')]=_0x25777c;return _0x232224;});}})[_0xa58d('0x20')](respondWithFilteredResult(_0x1c9c7d,_0x48ae3b))[_0xa58d('0x43')](handleError(_0x1c9c7d,null));};exports[_0xa58d('0x5c')]=function(_0x330ab1,_0x4a6e30,_0x245a38){var _0x55b0c3={'raw':!![],'where':{}};var _0xd067cf={};var _0x2df8df={'count':0x0,'rows':[]};return db[_0xa58d('0x2a')]['findOne']({'where':{'id':_0x330ab1[_0xa58d('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a6e30,null))[_0xa58d('0x20')](function(_0x2fb183){if(_0x2fb183){_0xd067cf[_0xa58d('0x2d')]=_[_0xa58d('0x2f')](db[_0xa58d('0x5d')][_0xa58d('0x2b')]);_0xd067cf['query']=_['keys'](_0x330ab1['query']);_0xd067cf[_0xa58d('0x30')]=_[_0xa58d('0x31')](_0xd067cf[_0xa58d('0x2d')],_0xd067cf['query']);_0x55b0c3[_0xa58d('0x32')]=_[_0xa58d('0x31')](_0xd067cf[_0xa58d('0x2d')],qs[_0xa58d('0x33')](_0x330ab1[_0xa58d('0x2e')]['fields']));_0x55b0c3[_0xa58d('0x32')]=_0x55b0c3[_0xa58d('0x32')][_0xa58d('0x34')]?_0x55b0c3[_0xa58d('0x32')]:_0xd067cf['model'];if(!_0x330ab1['query'][_0xa58d('0x35')](_0xa58d('0x36'))){_0x55b0c3[_0xa58d('0x19')]=qs[_0xa58d('0x19')](_0x330ab1[_0xa58d('0x2e')]['limit']);_0x55b0c3[_0xa58d('0x17')]=qs[_0xa58d('0x17')](_0x330ab1[_0xa58d('0x2e')]['offset']);}_0x55b0c3[_0xa58d('0x37')]=qs[_0xa58d('0x38')](_0x330ab1[_0xa58d('0x2e')][_0xa58d('0x38')]);_0x55b0c3['where']=qs[_0xa58d('0x30')](_[_0xa58d('0x3a')](_0x330ab1['query'],_0xd067cf[_0xa58d('0x30')]));_0x55b0c3[_0xa58d('0x39')][_0xa58d('0x57')]=_0x2fb183['id'];if(_0x330ab1[_0xa58d('0x2e')][_0xa58d('0x3b')]){_0x55b0c3[_0xa58d('0x39')]=_[_0xa58d('0x3c')](_0x55b0c3[_0xa58d('0x39')],{'$or':_[_0xa58d('0x29')](_0x55b0c3[_0xa58d('0x32')],function(_0x54e83c){var _0x2308f1={};_0x2308f1[_0x54e83c]={'$like':'%'+_0x330ab1[_0xa58d('0x2e')][_0xa58d('0x3b')]+'%'};return _0x2308f1;})});}_0x55b0c3=_[_0xa58d('0x3c')]({},_0x55b0c3,_0x330ab1[_0xa58d('0x3e')]);return db[_0xa58d('0x5d')][_0xa58d('0x1a')]({'where':_0x55b0c3[_0xa58d('0x39')]})[_0xa58d('0x20')](function(_0x460f92){_0x2df8df[_0xa58d('0x1a')]=_0x460f92;if(_0x330ab1[_0xa58d('0x2e')][_0xa58d('0x3f')]){_0x55b0c3[_0xa58d('0x40')]=[{'all':!![]}];}return db[_0xa58d('0x5d')][_0xa58d('0x41')](_0x55b0c3);})[_0xa58d('0x20')](function(_0x3e62d5){_0x2df8df['rows']=_0x3e62d5;return _0x2df8df;});}})[_0xa58d('0x20')](respondWithFilteredResult(_0x4a6e30,_0x55b0c3))['catch'](handleError(_0x4a6e30,null));};exports[_0xa58d('0x5e')]=function(_0x2341ec,_0x300464,_0x211348){var _0x14aaa9={};var _0x5b6299={};var _0x39764d;var _0x41d5a0;return db[_0xa58d('0x2a')][_0xa58d('0x59')]({'where':{'id':_0x2341ec[_0xa58d('0x45')]['id']}})[_0xa58d('0x20')](handleEntityNotFound(_0x300464,null))['then'](function(_0x34170a){if(_0x34170a){_0x39764d=_0x34170a;_0x5b6299[_0xa58d('0x2d')]=_[_0xa58d('0x2f')](db['CmList'][_0xa58d('0x2b')]);_0x5b6299['query']=_['keys'](_0x2341ec['query']);_0x5b6299[_0xa58d('0x30')]=_[_0xa58d('0x31')](_0x5b6299['model'],_0x5b6299[_0xa58d('0x2e')]);_0x14aaa9['attributes']=_[_0xa58d('0x31')](_0x5b6299['model'],qs[_0xa58d('0x33')](_0x2341ec[_0xa58d('0x2e')][_0xa58d('0x33')]));_0x14aaa9[_0xa58d('0x32')]=_0x14aaa9[_0xa58d('0x32')]['length']?_0x14aaa9[_0xa58d('0x32')]:_0x5b6299[_0xa58d('0x2d')];_0x14aaa9[_0xa58d('0x37')]=qs[_0xa58d('0x38')](_0x2341ec[_0xa58d('0x2e')]['sort']);_0x14aaa9[_0xa58d('0x39')]=qs[_0xa58d('0x30')](_[_0xa58d('0x3a')](_0x2341ec[_0xa58d('0x2e')],_0x5b6299['filters']));if(_0x2341ec['query'][_0xa58d('0x3b')]){_0x14aaa9[_0xa58d('0x39')]=_[_0xa58d('0x3c')](_0x14aaa9[_0xa58d('0x39')],{'$or':_[_0xa58d('0x29')](_0x14aaa9[_0xa58d('0x32')],function(_0x3ef662){var _0x1eb135={};_0x1eb135[_0x3ef662]={'$like':'%'+_0x2341ec[_0xa58d('0x2e')][_0xa58d('0x3b')]+'%'};return _0x1eb135;})});}_0x14aaa9=_['merge']({},_0x14aaa9,_0x2341ec['options']);return _0x39764d[_0xa58d('0x5e')](_0x14aaa9);}})[_0xa58d('0x20')](function(_0x284742){if(_0x284742){_0x41d5a0=_0x284742[_0xa58d('0x34')];if(!_0x2341ec[_0xa58d('0x2e')][_0xa58d('0x35')](_0xa58d('0x36'))){_0x14aaa9[_0xa58d('0x19')]=qs[_0xa58d('0x19')](_0x2341ec[_0xa58d('0x2e')][_0xa58d('0x19')]);_0x14aaa9[_0xa58d('0x17')]=qs[_0xa58d('0x17')](_0x2341ec[_0xa58d('0x2e')][_0xa58d('0x17')]);}return _0x39764d[_0xa58d('0x5e')](_0x14aaa9);}})['then'](function(_0x493ea2){if(_0x493ea2){return _0x493ea2?{'count':_0x41d5a0,'rows':_0x493ea2}:null;}})[_0xa58d('0x20')](respondWithResult(_0x300464,null))['catch'](handleError(_0x300464,null));};exports[_0xa58d('0x5f')]=function(_0x595c3c,_0x25492e,_0x148f7f){var _0x195334,_0x406575;return db[_0xa58d('0x2a')][_0xa58d('0x4a')]({'where':{'id':_0x595c3c[_0xa58d('0x45')]['id']}})[_0xa58d('0x20')](handleEntityNotFound(_0x25492e,null))[_0xa58d('0x20')](function(_0x34c01f){if(_0x34c01f){_0x406575=_0x34c01f;return _0x34c01f[_0xa58d('0x5f')](_0x595c3c[_0xa58d('0x52')]['ids'],_[_0xa58d('0x4f')](_0x595c3c[_0xa58d('0x52')],[_0xa58d('0x60'),'id'])||{});}return null;})[_0xa58d('0x61')](function(_0x4d6b5e){var _0x26a2d5;_0x195334=_0x4d6b5e||[];var _0x4e705d=[];if(_0x4d6b5e){for(var _0x1b1cca=0x0;_0x1b1cca<_0x4d6b5e[_0xa58d('0x34')];_0x1b1cca+=0x1){var _0x4f0550=_0x4d6b5e[_0x1b1cca][_0xa58d('0x22')]({'plain':!![]});_0x406575[_0xa58d('0x62')]=_0x595c3c[_0xa58d('0x52')][_0xa58d('0x62')]?_0x595c3c[_0xa58d('0x52')]['dialCheckDuplicateType']:_0x406575[_0xa58d('0x62')];switch(_0x406575[_0xa58d('0x62')]){case _0xa58d('0x63'):_0x26a2d5=squel[_0xa58d('0x64')]()[_0xa58d('0x65')]('cm_hopper')[_0xa58d('0x66')]([_0xa58d('0x67'),_0xa58d('0x68'),_0xa58d('0x69'),_0xa58d('0x6a'),_0xa58d('0x57'),'createdAt',_0xa58d('0x51')],squel['select']()[_0xa58d('0x6b')](_0xa58d('0x67'),_0xa58d('0x67'))['field']('NOW()',_0xa58d('0x68'))[_0xa58d('0x6b')]('id',_0xa58d('0x69'))[_0xa58d('0x6b')](_0x4f0550[_0xa58d('0x6c')][_0xa58d('0x6d')](),'ListId')[_0xa58d('0x6b')](_0x595c3c[_0xa58d('0x45')]['id'][_0xa58d('0x6d')](),_0xa58d('0x57'))[_0xa58d('0x6b')](_0xa58d('0x6e'),_0xa58d('0x50'))['field']('NOW()',_0xa58d('0x51'))[_0xa58d('0x6f')](_0xa58d('0x70'))[_0xa58d('0x39')](_0xa58d('0x71'))[_0xa58d('0x39')](_0xa58d('0x72'),_0x4f0550[_0xa58d('0x6c')][_0xa58d('0x6d')]())[_0xa58d('0x39')](_0xa58d('0x73'))[_0xa58d('0x39')](_0xa58d('0x74'),squel['select']()[_0xa58d('0x6b')](_0xa58d('0x75'))[_0xa58d('0x6f')](_0xa58d('0x76'))['where'](_0xa58d('0x77'),_0x595c3c[_0xa58d('0x45')]['id'][_0xa58d('0x6d')]()))[_0xa58d('0x39')](_0xa58d('0x74'),squel[_0xa58d('0x78')]()['field'](_0xa58d('0x79'))['from'](_0xa58d('0x7a'))[_0xa58d('0x39')](_0xa58d('0x77'),_0x595c3c[_0xa58d('0x45')]['id']['toString']())))[_0xa58d('0x6d')]();break;case'onlyIfOpen':_0x26a2d5=squel[_0xa58d('0x64')]()[_0xa58d('0x65')](_0xa58d('0x7a'))[_0xa58d('0x66')]([_0xa58d('0x67'),_0xa58d('0x68'),_0xa58d('0x69'),_0xa58d('0x6a'),_0xa58d('0x57'),_0xa58d('0x50'),'updatedAt'],squel[_0xa58d('0x78')]()['field'](_0xa58d('0x67'),_0xa58d('0x67'))[_0xa58d('0x6b')](_0xa58d('0x6e'),_0xa58d('0x68'))[_0xa58d('0x6b')]('id',_0xa58d('0x69'))[_0xa58d('0x6b')](_0x4f0550[_0xa58d('0x6c')][_0xa58d('0x6d')](),'ListId')['field'](_0x595c3c[_0xa58d('0x45')]['id']['toString'](),_0xa58d('0x57'))['field'](_0xa58d('0x6e'),_0xa58d('0x50'))['field']('NOW()',_0xa58d('0x51'))['from']('cm_contacts')[_0xa58d('0x39')](_0xa58d('0x71'))[_0xa58d('0x39')](_0xa58d('0x72'),_0x4f0550[_0xa58d('0x6c')][_0xa58d('0x6d')]())[_0xa58d('0x39')](_0xa58d('0x73'))[_0xa58d('0x39')](_0xa58d('0x74'),squel[_0xa58d('0x78')]()[_0xa58d('0x6b')](_0xa58d('0x79'))['from'](_0xa58d('0x7a'))[_0xa58d('0x39')](_0xa58d('0x77'),_0x595c3c[_0xa58d('0x45')]['id'][_0xa58d('0x6d')]())))[_0xa58d('0x6d')]();break;default:_0x26a2d5=squel[_0xa58d('0x64')]()[_0xa58d('0x65')]('cm_hopper')[_0xa58d('0x66')]([_0xa58d('0x67'),_0xa58d('0x68'),_0xa58d('0x69'),_0xa58d('0x6a'),_0xa58d('0x57'),'createdAt','updatedAt'],squel[_0xa58d('0x78')]()[_0xa58d('0x6b')](_0xa58d('0x67'),_0xa58d('0x67'))['field']('NOW()',_0xa58d('0x68'))[_0xa58d('0x6b')]('id',_0xa58d('0x69'))[_0xa58d('0x6b')](_0x4f0550[_0xa58d('0x6c')][_0xa58d('0x6d')](),_0xa58d('0x6a'))[_0xa58d('0x6b')](_0x595c3c['params']['id'][_0xa58d('0x6d')](),_0xa58d('0x57'))[_0xa58d('0x6b')](_0xa58d('0x6e'),_0xa58d('0x50'))['field']('NOW()','updatedAt')[_0xa58d('0x6f')](_0xa58d('0x70'))[_0xa58d('0x39')](_0xa58d('0x71'))[_0xa58d('0x39')](_0xa58d('0x72'),_0x4f0550[_0xa58d('0x6c')][_0xa58d('0x6d')]())[_0xa58d('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xa58d('0x6d')]();}_0x4e705d[_0xa58d('0x7b')](db[_0xa58d('0x7c')][_0xa58d('0x2e')](_0x26a2d5));}return BPromise[_0xa58d('0x7d')](_0x4e705d);}})[_0xa58d('0x20')](function(){return _0x195334;})['then'](respondWithResult(_0x25492e,null))[_0xa58d('0x43')](handleError(_0x25492e,null));};exports[_0xa58d('0x7e')]=function(_0x51c39b,_0x1bea8e,_0x22b235){return db[_0xa58d('0x2a')][_0xa58d('0x4a')]({'where':{'id':_0x51c39b['params']['id']}})[_0xa58d('0x20')](handleEntityNotFound(_0x1bea8e,null))[_0xa58d('0x20')](function(_0x56b41b){if(_0x56b41b){return _0x56b41b['removeLists'](_0x51c39b[_0xa58d('0x2e')]['ids']);}})[_0xa58d('0x20')](function(_0x89244e){if(_0x89244e){return db[_0xa58d('0x56')]['destroy']({'where':{'ListId':_0x51c39b[_0xa58d('0x2e')]['ids'],'CampaignId':_0x51c39b['params']['id']}})[_0xa58d('0x20')](function(){return _0x89244e;});}})[_0xa58d('0x20')](respondWithStatusCode(_0x1bea8e,null))[_0xa58d('0x43')](handleError(_0x1bea8e,null));};exports[_0xa58d('0x7f')]=function(_0x1745c2,_0x131206,_0x4bed1c){var _0x19243e={};var _0x4e4050={};var _0x33efd9;var _0x4aa8ff;return db[_0xa58d('0x2a')][_0xa58d('0x59')]({'where':{'id':_0x1745c2['params']['id']}})['then'](handleEntityNotFound(_0x131206,null))[_0xa58d('0x20')](function(_0x4474df){if(_0x4474df){_0x33efd9=_0x4474df;_0x4e4050[_0xa58d('0x2d')]=_[_0xa58d('0x2f')](db[_0xa58d('0x80')][_0xa58d('0x2b')]);_0x4e4050[_0xa58d('0x2e')]=_[_0xa58d('0x2f')](_0x1745c2[_0xa58d('0x2e')]);_0x4e4050['filters']=_['intersection'](_0x4e4050[_0xa58d('0x2d')],_0x4e4050[_0xa58d('0x2e')]);_0x19243e[_0xa58d('0x32')]=_[_0xa58d('0x31')](_0x4e4050[_0xa58d('0x2d')],qs['fields'](_0x1745c2[_0xa58d('0x2e')][_0xa58d('0x33')]));_0x19243e['attributes']=_0x19243e[_0xa58d('0x32')][_0xa58d('0x34')]?_0x19243e[_0xa58d('0x32')]:_0x4e4050[_0xa58d('0x2d')];_0x19243e['order']=qs['sort'](_0x1745c2[_0xa58d('0x2e')][_0xa58d('0x38')]);_0x19243e['where']=qs[_0xa58d('0x30')](_[_0xa58d('0x3a')](_0x1745c2['query'],_0x4e4050[_0xa58d('0x30')]));if(_0x1745c2['query'][_0xa58d('0x3b')]){_0x19243e['where']=_['merge'](_0x19243e[_0xa58d('0x39')],{'$or':_['map'](_0x19243e['attributes'],function(_0x232d42){var _0x3e49cc={};_0x3e49cc[_0x232d42]={'$like':'%'+_0x1745c2['query'][_0xa58d('0x3b')]+'%'};return _0x3e49cc;})});}_0x19243e=_[_0xa58d('0x3c')]({},_0x19243e,_0x1745c2[_0xa58d('0x3e')]);return _0x33efd9['getBlackLists'](_0x19243e);}})[_0xa58d('0x20')](function(_0x1ddc15){if(_0x1ddc15){_0x4aa8ff=_0x1ddc15[_0xa58d('0x34')];if(!_0x1745c2[_0xa58d('0x2e')][_0xa58d('0x35')](_0xa58d('0x36'))){_0x19243e['limit']=qs[_0xa58d('0x19')](_0x1745c2[_0xa58d('0x2e')]['limit']);_0x19243e['offset']=qs[_0xa58d('0x17')](_0x1745c2[_0xa58d('0x2e')]['offset']);}return _0x33efd9[_0xa58d('0x7f')](_0x19243e);}})[_0xa58d('0x20')](function(_0x310f72){if(_0x310f72){return _0x310f72?{'count':_0x4aa8ff,'rows':_0x310f72}:null;}})['then'](respondWithResult(_0x131206,null))[_0xa58d('0x43')](handleError(_0x131206,null));};exports[_0xa58d('0x81')]=function(_0x547bcd,_0x522dcd,_0x10c0f0){var _0xc4e573,_0x5c5900;return db[_0xa58d('0x2a')][_0xa58d('0x4a')]({'where':{'id':_0x547bcd[_0xa58d('0x45')]['id']}})[_0xa58d('0x20')](handleEntityNotFound(_0x522dcd,null))[_0xa58d('0x20')](function(_0x31f43e){if(_0x31f43e){_0x5c5900=_0x31f43e;return _0x31f43e[_0xa58d('0x81')](_0x547bcd[_0xa58d('0x52')][_0xa58d('0x60')],_['omit'](_0x547bcd[_0xa58d('0x52')],['ids','id'])||{});}return null;})[_0xa58d('0x61')](function(_0xa3114f){var _0x523bfc;_0xc4e573=_0xa3114f||[];var _0x1ece32=[];if(_0xa3114f){for(var _0x1a4015=0x0;_0x1a4015<_0xa3114f['length'];_0x1a4015+=0x1){var _0x30470d=_0xa3114f[_0x1a4015][_0xa58d('0x22')]({'plain':!![]});_0x523bfc=squel[_0xa58d('0x64')]()[_0xa58d('0x65')](_0xa58d('0x82'))[_0xa58d('0x66')](['phone',_0xa58d('0x69'),_0xa58d('0x6a'),_0xa58d('0x57'),'createdAt',_0xa58d('0x51')],squel[_0xa58d('0x78')]()['field'](_0xa58d('0x67'),_0xa58d('0x67'))[_0xa58d('0x6b')]('id',_0xa58d('0x69'))[_0xa58d('0x6b')](_0x30470d[_0xa58d('0x6c')][_0xa58d('0x6d')](),_0xa58d('0x6a'))[_0xa58d('0x6b')](_0x547bcd[_0xa58d('0x45')]['id']['toString'](),_0xa58d('0x57'))[_0xa58d('0x6b')]('NOW()',_0xa58d('0x50'))[_0xa58d('0x6b')](_0xa58d('0x6e'),_0xa58d('0x51'))[_0xa58d('0x6f')]('cm_contacts')[_0xa58d('0x39')](_0xa58d('0x71'))['where'](_0xa58d('0x72'),_0x30470d[_0xa58d('0x6c')][_0xa58d('0x6d')]())[_0xa58d('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xa58d('0x6d')]();_0x1ece32['push'](db['sequelize'][_0xa58d('0x2e')](_0x523bfc));}return BPromise[_0xa58d('0x7d')](_0x1ece32);}})[_0xa58d('0x20')](function(){return _0xc4e573;})[_0xa58d('0x20')](respondWithResult(_0x522dcd,null))[_0xa58d('0x43')](handleError(_0x522dcd,null));};exports[_0xa58d('0x83')]=function(_0x2cc818,_0x142278,_0x131611){return db[_0xa58d('0x2a')][_0xa58d('0x4a')]({'where':{'id':_0x2cc818[_0xa58d('0x45')]['id']}})[_0xa58d('0x20')](handleEntityNotFound(_0x142278,null))[_0xa58d('0x20')](function(_0x43b257){if(_0x43b257){return _0x43b257[_0xa58d('0x83')](_0x2cc818[_0xa58d('0x2e')]['ids']);}})[_0xa58d('0x20')](function(_0x33ae6c){if(_0x33ae6c){return db[_0xa58d('0x5d')]['destroy']({'where':{'ListId':_0x2cc818[_0xa58d('0x2e')][_0xa58d('0x60')],'CampaignId':_0x2cc818['params']['id']}})['then'](function(){return _0x33ae6c;});}})['then'](respondWithStatusCode(_0x142278,null))[_0xa58d('0x43')](handleError(_0x142278,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index e3ac5be..0c58180 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4587fe,_0x4b740c){var _0x379355=function(_0x24247c){while(--_0x24247c){_0x4587fe['push'](_0x4587fe['shift']());}};_0x379355(++_0x4b740c);}(_0x7a54,0x106));var _0x47a5=function(_0x1973dd,_0xdc168f){_0x1973dd=_0x1973dd-0x0;var _0x3f78fa=_0x7a54[_0x1973dd];return _0x3f78fa;};'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 7369453..9bd8093 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 _0x2cbd=['where','attributes','limit','include','map','model','GetCampaign','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Campaign','findAll','options'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x2cbd[_0x4e1a49];return _0x136aae;};'use strict';var _=require(_0xd2cb('0x0'));var util=require(_0xd2cb('0x1'));var moment=require('moment');var BPromise=require(_0xd2cb('0x2'));var rs=require(_0xd2cb('0x3'));var fs=require('fs');var Redis=require(_0xd2cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd2cb('0x5'));var logger=require(_0xd2cb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd2cb('0x7'));var client=jayson[_0xd2cb('0x8')][_0xd2cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ae725,_0x4c3593,_0x2c1ead){return new BPromise(function(_0x5ef97c,_0x173a87){return client['request'](_0x1ae725,_0x2c1ead)[_0xd2cb('0xa')](function(_0xd591f7){logger['info'](_0xd2cb('0xb'),_0x4c3593,_0xd2cb('0xc'));logger['debug'](_0xd2cb('0xd'),_0x4c3593,_0xd2cb('0xc'),JSON[_0xd2cb('0xe')](_0xd591f7));if(_0xd591f7[_0xd2cb('0xf')]){if(_0xd591f7[_0xd2cb('0xf')]['code']===0x1f4){logger[_0xd2cb('0xf')](_0xd2cb('0xb'),_0x4c3593,_0xd591f7[_0xd2cb('0xf')][_0xd2cb('0x10')]);return _0x173a87(_0xd591f7[_0xd2cb('0xf')]['message']);}logger[_0xd2cb('0xf')](_0xd2cb('0xb'),_0x4c3593,_0xd591f7[_0xd2cb('0xf')]['message']);return _0x5ef97c(_0xd591f7[_0xd2cb('0xf')][_0xd2cb('0x10')]);}else{logger['info'](_0xd2cb('0xb'),_0x4c3593,'request\x20sent');_0x5ef97c(_0xd591f7['result'][_0xd2cb('0x10')]);}})[_0xd2cb('0x11')](function(_0x1a24ac){logger[_0xd2cb('0xf')]('Campaign,\x20%s,\x20%s',_0x4c3593,_0x1a24ac);_0x173a87(_0x1a24ac);});});}exports['GetCampaign']=function(_0x2f41d1){var _0x13afe3=this;return new Promise(function(_0x5871e5,_0x5fba){return db[_0xd2cb('0x12')][_0xd2cb('0x13')]({'raw':_0x2f41d1['options']?_0x2f41d1[_0xd2cb('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2f41d1['options']?_0x2f41d1[_0xd2cb('0x14')][_0xd2cb('0x15')]||null:null,'attributes':_0x2f41d1[_0xd2cb('0x14')]?_0x2f41d1['options'][_0xd2cb('0x16')]||null:null,'limit':_0x2f41d1[_0xd2cb('0x14')]?_0x2f41d1[_0xd2cb('0x14')][_0xd2cb('0x17')]||null:null,'include':_0x2f41d1[_0xd2cb('0x14')]?_0x2f41d1[_0xd2cb('0x14')][_0xd2cb('0x18')]?_[_0xd2cb('0x19')](_0x2f41d1['options'][_0xd2cb('0x18')],function(_0x29f8f0){return{'model':db[_0x29f8f0['model']],'as':_0x29f8f0['as'],'attributes':_0x29f8f0[_0xd2cb('0x16')],'include':_0x29f8f0[_0xd2cb('0x18')]?_[_0xd2cb('0x19')](_0x29f8f0[_0xd2cb('0x18')],function(_0x46a378){return{'model':db[_0x46a378[_0xd2cb('0x1a')]],'as':_0x46a378['as'],'attributes':_0x46a378['attributes'],'include':_0x46a378[_0xd2cb('0x18')]?_['map'](_0x46a378['include'],function(_0x58bf1b){return{'model':db[_0x58bf1b[_0xd2cb('0x1a')]],'as':_0x58bf1b['as'],'attributes':_0x58bf1b[_0xd2cb('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd2cb('0xa')](function(_0x9b502c){logger['info'](_0xd2cb('0x1b'),_0x2f41d1);logger[_0xd2cb('0x1c')](_0xd2cb('0x1b'),_0x2f41d1,JSON[_0xd2cb('0xe')](_0x9b502c));_0x5871e5(_0x9b502c);})[_0xd2cb('0x11')](function(_0x1b9614){logger[_0xd2cb('0xf')](_0xd2cb('0x1b'),_0x1b9614[_0xd2cb('0x10')],_0x2f41d1);_0x5fba(_0x13afe3[_0xd2cb('0xf')](0x1f4,_0x1b9614['message']));});});}; \ No newline at end of file +var _0x14ee=['info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','options','raw','where','attributes','limit','map','model','include','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x49395e,_0x2485b2){var _0x25e677=function(_0x148f80){while(--_0x148f80){_0x49395e['push'](_0x49395e['shift']());}};_0x25e677(++_0x2485b2);}(_0x14ee,0x115));var _0xe14e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14ee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe14e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe14e('0x1'));var rs=require(_0xe14e('0x2'));var fs=require('fs');var Redis=require(_0xe14e('0x3'));var db=require(_0xe14e('0x4'))['db'];var utils=require(_0xe14e('0x5'));var logger=require(_0xe14e('0x6'))(_0xe14e('0x7'));var config=require(_0xe14e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1113a9,_0x439b30,_0x29b76d){return new BPromise(function(_0x10b6ac,_0x16ab9a){return client[_0xe14e('0x9')](_0x1113a9,_0x29b76d)[_0xe14e('0xa')](function(_0x2aaeb2){logger[_0xe14e('0xb')](_0xe14e('0xc'),_0x439b30,_0xe14e('0xd'));logger[_0xe14e('0xe')](_0xe14e('0xf'),_0x439b30,_0xe14e('0xd'),JSON[_0xe14e('0x10')](_0x2aaeb2));if(_0x2aaeb2['error']){if(_0x2aaeb2[_0xe14e('0x11')][_0xe14e('0x12')]===0x1f4){logger['error'](_0xe14e('0xc'),_0x439b30,_0x2aaeb2['error'][_0xe14e('0x13')]);return _0x16ab9a(_0x2aaeb2[_0xe14e('0x11')][_0xe14e('0x13')]);}logger[_0xe14e('0x11')](_0xe14e('0xc'),_0x439b30,_0x2aaeb2[_0xe14e('0x11')][_0xe14e('0x13')]);return _0x10b6ac(_0x2aaeb2['error'][_0xe14e('0x13')]);}else{logger[_0xe14e('0xb')]('Campaign,\x20%s,\x20%s',_0x439b30,_0xe14e('0xd'));_0x10b6ac(_0x2aaeb2[_0xe14e('0x14')][_0xe14e('0x13')]);}})[_0xe14e('0x15')](function(_0x425be5){logger[_0xe14e('0x11')](_0xe14e('0xc'),_0x439b30,_0x425be5);_0x16ab9a(_0x425be5);});});}exports[_0xe14e('0x16')]=function(_0x1478bb){var _0x50e2d7=this;return new Promise(function(_0x4de82e,_0x34db50){return db[_0xe14e('0x17')]['findAll']({'raw':_0x1478bb[_0xe14e('0x18')]?_0x1478bb[_0xe14e('0x18')][_0xe14e('0x19')]===undefined?!![]:![]:!![],'where':_0x1478bb['options']?_0x1478bb[_0xe14e('0x18')][_0xe14e('0x1a')]||null:null,'attributes':_0x1478bb[_0xe14e('0x18')]?_0x1478bb[_0xe14e('0x18')][_0xe14e('0x1b')]||null:null,'limit':_0x1478bb[_0xe14e('0x18')]?_0x1478bb[_0xe14e('0x18')][_0xe14e('0x1c')]||null:null,'include':_0x1478bb[_0xe14e('0x18')]?_0x1478bb[_0xe14e('0x18')]['include']?_[_0xe14e('0x1d')](_0x1478bb[_0xe14e('0x18')]['include'],function(_0x1893bd){return{'model':db[_0x1893bd[_0xe14e('0x1e')]],'as':_0x1893bd['as'],'attributes':_0x1893bd[_0xe14e('0x1b')],'include':_0x1893bd[_0xe14e('0x1f')]?_['map'](_0x1893bd[_0xe14e('0x1f')],function(_0x30643f){return{'model':db[_0x30643f[_0xe14e('0x1e')]],'as':_0x30643f['as'],'attributes':_0x30643f[_0xe14e('0x1b')],'include':_0x30643f[_0xe14e('0x1f')]?_['map'](_0x30643f['include'],function(_0x169adc){return{'model':db[_0x169adc[_0xe14e('0x1e')]],'as':_0x169adc['as'],'attributes':_0x169adc[_0xe14e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe14e('0xa')](function(_0x3deee9){logger[_0xe14e('0xb')](_0xe14e('0x16'),_0x1478bb);logger[_0xe14e('0xe')](_0xe14e('0x16'),_0x1478bb,JSON[_0xe14e('0x10')](_0x3deee9));_0x4de82e(_0x3deee9);})[_0xe14e('0x15')](function(_0x1916e1){logger['error']('GetCampaign',_0x1916e1[_0xe14e('0x13')],_0x1478bb);_0x34db50(_0x50e2d7[_0xe14e('0x11')](0x1f4,_0x1916e1['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 6c76115..2838cc9 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 _0xecd2=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','put','update','/:id','destroy','delete','removeLists','removeBlackLists','exports','multer','util'];(function(_0x23eaf2,_0x465cfb){var _0x54efb4=function(_0x5f3727){while(--_0x5f3727){_0x23eaf2['push'](_0x23eaf2['shift']());}};_0x54efb4(++_0x465cfb);}(_0xecd2,0x139));var _0x2ecd=function(_0x216d9f,_0x431bd4){_0x216d9f=_0x216d9f-0x0;var _0x4d4425=_0xecd2[_0x216d9f];return _0x4d4425;};'use strict';var multer=require(_0x2ecd('0x0'));var util=require(_0x2ecd('0x1'));var path=require('path');var timeout=require(_0x2ecd('0x2'));var express=require(_0x2ecd('0x3'));var router=express[_0x2ecd('0x4')]();var fs_extra=require(_0x2ecd('0x5'));var auth=require(_0x2ecd('0x6'));var interaction=require(_0x2ecd('0x7'));var config=require(_0x2ecd('0x8'));var controller=require('./campaign.controller');router[_0x2ecd('0x9')]('/',auth['isAuthenticated'](),controller[_0x2ecd('0xa')]);router[_0x2ecd('0x9')]('/:id',auth[_0x2ecd('0xb')](),controller[_0x2ecd('0xc')]);router[_0x2ecd('0x9')](_0x2ecd('0xd'),auth[_0x2ecd('0xb')](),controller['getHoppers']);router[_0x2ecd('0x9')](_0x2ecd('0xe'),auth[_0x2ecd('0xb')](),controller[_0x2ecd('0xf')]);router[_0x2ecd('0x9')]('/:id/hopper_finals',auth[_0x2ecd('0xb')](),controller[_0x2ecd('0x10')]);router[_0x2ecd('0x9')](_0x2ecd('0x11'),auth['isAuthenticated'](),controller['getHopperBlacks']);router['get'](_0x2ecd('0x12'),auth['isAuthenticated'](),controller[_0x2ecd('0x13')]);router[_0x2ecd('0x9')]('/:id/blacklists',auth[_0x2ecd('0xb')](),controller[_0x2ecd('0x14')]);router[_0x2ecd('0x15')]('/',auth['isAuthenticated'](),controller[_0x2ecd('0x16')]);router[_0x2ecd('0x15')](_0x2ecd('0x17'),auth[_0x2ecd('0xb')](),controller[_0x2ecd('0x18')]);router[_0x2ecd('0x15')](_0x2ecd('0x12'),auth[_0x2ecd('0xb')](),controller[_0x2ecd('0x19')]);router[_0x2ecd('0x15')](_0x2ecd('0x1a'),auth[_0x2ecd('0xb')](),controller['addBlackLists']);router[_0x2ecd('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x2ecd('0x1c')]);router['delete'](_0x2ecd('0x1d'),auth[_0x2ecd('0xb')](),controller[_0x2ecd('0x1e')]);router[_0x2ecd('0x1f')](_0x2ecd('0x12'),auth[_0x2ecd('0xb')](),controller[_0x2ecd('0x20')]);router['delete'](_0x2ecd('0x1a'),auth[_0x2ecd('0xb')](),controller[_0x2ecd('0x21')]);module[_0x2ecd('0x22')]=router; \ No newline at end of file +var _0x4d3d=['/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','exports','multer','path','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x5aa226,_0x211119){var _0xadc54b=function(_0x481866){while(--_0x481866){_0x5aa226['push'](_0x5aa226['shift']());}};_0xadc54b(++_0x211119);}(_0x4d3d,0x154));var _0xd4d3=function(_0x533668,_0xfe3a75){_0x533668=_0x533668-0x0;var _0x447a22=_0x4d3d[_0x533668];return _0x447a22;};'use strict';var multer=require(_0xd4d3('0x0'));var util=require('util');var path=require(_0xd4d3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd4d3('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd4d3('0x3'));var config=require(_0xd4d3('0x4'));var controller=require('./campaign.controller');router[_0xd4d3('0x5')]('/',auth[_0xd4d3('0x6')](),controller['index']);router[_0xd4d3('0x5')](_0xd4d3('0x7'),auth[_0xd4d3('0x6')](),controller['show']);router[_0xd4d3('0x5')](_0xd4d3('0x8'),auth[_0xd4d3('0x6')](),controller[_0xd4d3('0x9')]);router[_0xd4d3('0x5')]('/:id/hopper_histories',auth[_0xd4d3('0x6')](),controller[_0xd4d3('0xa')]);router[_0xd4d3('0x5')](_0xd4d3('0xb'),auth[_0xd4d3('0x6')](),controller[_0xd4d3('0xc')]);router[_0xd4d3('0x5')](_0xd4d3('0xd'),auth[_0xd4d3('0x6')](),controller[_0xd4d3('0xe')]);router[_0xd4d3('0x5')](_0xd4d3('0xf'),auth[_0xd4d3('0x6')](),controller[_0xd4d3('0x10')]);router[_0xd4d3('0x5')]('/:id/blacklists',auth[_0xd4d3('0x6')](),controller[_0xd4d3('0x11')]);router[_0xd4d3('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd4d3('0x12')]('/:id/clone',auth[_0xd4d3('0x6')](),controller[_0xd4d3('0x13')]);router['post'](_0xd4d3('0xf'),auth[_0xd4d3('0x6')](),controller[_0xd4d3('0x14')]);router['post'](_0xd4d3('0x15'),auth[_0xd4d3('0x6')](),controller[_0xd4d3('0x16')]);router[_0xd4d3('0x17')](_0xd4d3('0x7'),auth[_0xd4d3('0x6')](),controller[_0xd4d3('0x18')]);router[_0xd4d3('0x19')]('/:id',auth[_0xd4d3('0x6')](),controller[_0xd4d3('0x1a')]);router[_0xd4d3('0x19')](_0xd4d3('0xf'),auth[_0xd4d3('0x6')](),controller[_0xd4d3('0x1b')]);router['delete'](_0xd4d3('0x15'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xd4d3('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index bc1ae52..5d24e73 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 _0xae1e=['sequelize','STRING','TEXT','VIRTUAL'];(function(_0x173bfc,_0x180d0f){var _0x3f2c52=function(_0x491a1){while(--_0x491a1){_0x173bfc['push'](_0x173bfc['shift']());}};_0x3f2c52(++_0x180d0f);}(_0xae1e,0x160));var _0xeae1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xae1e[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xeae1('0x0'));module['exports']={'key':{'type':Sequelize[_0xeae1('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xeae1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeae1('0x1')]},'name':{'type':Sequelize[_0xeae1('0x3')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0x4048=['exports','STRING','VIRTUAL','key','sequelize'];(function(_0x1629cd,_0x1ad0d2){var _0x4f88e0=function(_0x1b37d3){while(--_0x1b37d3){_0x1629cd['push'](_0x1629cd['shift']());}};_0x4f88e0(++_0x1ad0d2);}(_0x4048,0x81));var _0x8404=function(_0x4fb152,_0x1a946c){_0x4fb152=_0x4fb152-0x0;var _0x21dc90=_0x4048[_0x4fb152];return _0x21dc90;};'use strict';var Sequelize=require(_0x8404('0x0'));module[_0x8404('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x8404('0x2')]},'name':{'type':Sequelize[_0x8404('0x3')],'get':function(){return this['getDataValue'](_0x8404('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 36e6cfc..094163a 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 _0x0144=['where','filters','filter','merge','includeAll','include','findAll','catch','show','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','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/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','count','offset','limit','set','apply','reject','update','then','destroy','CannedAnswers','UserProfileResource','end','error','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x531e48,_0x4bb96b){var _0x202971=function(_0x403bf5){while(--_0x403bf5){_0x531e48['push'](_0x531e48['shift']());}};_0x202971(++_0x4bb96b);}(_0x0144,0x77));var _0x4014=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0x0144[_0x1e381c];return _0x9b5ea9;};'use strict';var emlformat=require(_0x4014('0x0'));var rimraf=require(_0x4014('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4014('0x2'));var rp=require('request-promise');var moment=require(_0x4014('0x3'));var BPromise=require(_0x4014('0x4'));var Mustache=require(_0x4014('0x5'));var util=require(_0x4014('0x6'));var path=require(_0x4014('0x7'));var sox=require(_0x4014('0x8'));var csv=require(_0x4014('0x9'));var ejs=require(_0x4014('0xa'));var fs=require('fs');var fs_extra=require(_0x4014('0xb'));var _=require(_0x4014('0xc'));var squel=require(_0x4014('0xd'));var crypto=require(_0x4014('0xe'));var jsforce=require(_0x4014('0xf'));var deskjs=require(_0x4014('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4014('0x11'));var Papa=require(_0x4014('0x12'));var Redis=require(_0x4014('0x13'));var authService=require(_0x4014('0x14'));var qs=require(_0x4014('0x15'));var as=require(_0x4014('0x16'));var hardwareService=require(_0x4014('0x17'));var logger=require(_0x4014('0x18'))(_0x4014('0x19'));var utils=require(_0x4014('0x1a'));var config=require(_0x4014('0x1b'));var licenseUtil=require(_0x4014('0x1c'));var db=require(_0x4014('0x1d'))['db'];function respondWithStatusCode(_0x1bdcb3,_0x23bade){_0x23bade=_0x23bade||0xcc;return function(_0x2dfec3){if(_0x2dfec3){return _0x1bdcb3[_0x4014('0x1e')](_0x23bade);}return _0x1bdcb3[_0x4014('0x1f')](_0x23bade)['end']();};}function respondWithResult(_0x4dafd7,_0x1dec33){_0x1dec33=_0x1dec33||0xc8;return function(_0x1dc38b){if(_0x1dc38b){return _0x4dafd7[_0x4014('0x1f')](_0x1dec33)[_0x4014('0x20')](_0x1dc38b);}};}function respondWithFilteredResult(_0x3cc6e6,_0x51abed){return function(_0xe1c9c9){if(_0xe1c9c9){var _0x321492=typeof _0x51abed['offset']===_0x4014('0x21')&&typeof _0x51abed['limit']===_0x4014('0x21');var _0x58e4cd=_0xe1c9c9[_0x4014('0x22')];var _0x5cb2d2=_0x321492?0x0:_0x51abed[_0x4014('0x23')];var _0x1ec9bc=_0x321492?_0xe1c9c9[_0x4014('0x22')]:_0x51abed[_0x4014('0x23')]+_0x51abed[_0x4014('0x24')];var _0x296b35;if(_0x1ec9bc>=_0x58e4cd){_0x1ec9bc=_0x58e4cd;_0x296b35=0xc8;}else{_0x296b35=0xce;}_0x3cc6e6[_0x4014('0x1f')](_0x296b35);return _0x3cc6e6[_0x4014('0x25')]('Content-Range',_0x5cb2d2+'-'+_0x1ec9bc+'/'+_0x58e4cd)[_0x4014('0x20')](_0xe1c9c9);}return null;};}function patchUpdates(_0x4edd6f){return function(_0x336454){try{jsonpatch[_0x4014('0x26')](_0x336454,_0x4edd6f,!![]);}catch(_0x2994cd){return BPromise[_0x4014('0x27')](_0x2994cd);}return _0x336454['save']();};}function saveUpdates(_0x2dc06a,_0x523ab5){return function(_0xae97c8){if(_0xae97c8){return _0xae97c8[_0x4014('0x28')](_0x2dc06a)[_0x4014('0x29')](function(_0x3d5262){return _0x3d5262;});}return null;};}function removeEntity(_0xaa231d,_0x44dc8f){return function(_0x375438){if(_0x375438){return _0x375438[_0x4014('0x2a')]()[_0x4014('0x29')](function(){var _0x35ee41=_0x375438['get']({'plain':!![]});var _0x119eba=_0x4014('0x2b');return db[_0x4014('0x2c')][_0x4014('0x2a')]({'where':{'type':_0x119eba,'resourceId':_0x35ee41['id']}})[_0x4014('0x29')](function(){return _0x375438;});})[_0x4014('0x29')](function(){_0xaa231d[_0x4014('0x1f')](0xcc)[_0x4014('0x2d')]();});}};}function handleEntityNotFound(_0x30f960,_0x15920b){return function(_0x71902a){if(!_0x71902a){_0x30f960[_0x4014('0x1e')](0x194);}return _0x71902a;};}function handleError(_0x46ff74,_0x1ff217){_0x1ff217=_0x1ff217||0x1f4;return function(_0x419929){logger[_0x4014('0x2e')](_0x419929['stack']);if(_0x419929[_0x4014('0x2f')]){delete _0x419929['name'];}_0x46ff74[_0x4014('0x1f')](_0x1ff217)['send'](_0x419929);};}exports[_0x4014('0x30')]=function(_0x32259f,_0x1b8ba0){var _0x36353f={},_0x18fd9a={},_0x4510a2={'count':0x0,'rows':[]};var _0x12e55f=_[_0x4014('0x31')](db[_0x4014('0x32')][_0x4014('0x33')],function(_0x990a12){return{'name':_0x990a12[_0x4014('0x34')],'type':_0x990a12[_0x4014('0x35')][_0x4014('0x36')]};});_0x18fd9a[_0x4014('0x37')]=_[_0x4014('0x31')](_0x12e55f,_0x4014('0x2f'));_0x18fd9a['query']=_['keys'](_0x32259f[_0x4014('0x38')]);_0x18fd9a['filters']=_[_0x4014('0x39')](_0x18fd9a[_0x4014('0x37')],_0x18fd9a[_0x4014('0x38')]);_0x36353f[_0x4014('0x3a')]=_['intersection'](_0x18fd9a[_0x4014('0x37')],qs[_0x4014('0x3b')](_0x32259f[_0x4014('0x38')]['fields']));_0x36353f[_0x4014('0x3a')]=_0x36353f[_0x4014('0x3a')][_0x4014('0x3c')]?_0x36353f[_0x4014('0x3a')]:_0x18fd9a[_0x4014('0x37')];if(!_0x32259f['query'][_0x4014('0x3d')](_0x4014('0x3e'))){_0x36353f[_0x4014('0x24')]=qs['limit'](_0x32259f[_0x4014('0x38')][_0x4014('0x24')]);_0x36353f[_0x4014('0x23')]=qs[_0x4014('0x23')](_0x32259f[_0x4014('0x38')]['offset']);}_0x36353f[_0x4014('0x3f')]=qs[_0x4014('0x40')](_0x32259f[_0x4014('0x38')][_0x4014('0x40')]);_0x36353f[_0x4014('0x41')]=qs[_0x4014('0x42')](_['pick'](_0x32259f[_0x4014('0x38')],_0x18fd9a[_0x4014('0x42')]),_0x12e55f);if(_0x32259f['query'][_0x4014('0x43')]){_0x36353f[_0x4014('0x41')]=_[_0x4014('0x44')](_0x36353f['where'],{'$or':[{'key':{'$like':'%'+_0x32259f[_0x4014('0x38')][_0x4014('0x43')]+'%'}},{'value':{'$like':'%'+_0x32259f[_0x4014('0x38')][_0x4014('0x43')]+'%'}}]});}_0x36353f=_[_0x4014('0x44')]({},_0x36353f,_0x32259f['options']);var _0x6919b4={'where':_0x36353f[_0x4014('0x41')]};return db['CannedAnswer'][_0x4014('0x22')](_0x6919b4)['then'](function(_0x31b636){_0x4510a2[_0x4014('0x22')]=_0x31b636;if(_0x32259f[_0x4014('0x38')][_0x4014('0x45')]){_0x36353f[_0x4014('0x46')]=[{'all':!![]}];}return db[_0x4014('0x32')][_0x4014('0x47')](_0x36353f);})[_0x4014('0x29')](function(_0x492169){_0x4510a2['rows']=_0x492169;return _0x4510a2;})['then'](respondWithFilteredResult(_0x1b8ba0,_0x36353f))[_0x4014('0x48')](handleError(_0x1b8ba0,null));};exports[_0x4014('0x49')]=function(_0x16d795,_0x1ed3a5){var _0x30dbed={'raw':!![],'where':{'id':_0x16d795[_0x4014('0x4a')]['id']}},_0x28fa85={};_0x28fa85[_0x4014('0x37')]=_[_0x4014('0x4b')](db[_0x4014('0x32')]['rawAttributes']);_0x28fa85['query']=_[_0x4014('0x4b')](_0x16d795[_0x4014('0x38')]);_0x28fa85['filters']=_[_0x4014('0x39')](_0x28fa85[_0x4014('0x37')],_0x28fa85[_0x4014('0x38')]);_0x30dbed['attributes']=_[_0x4014('0x39')](_0x28fa85[_0x4014('0x37')],qs[_0x4014('0x3b')](_0x16d795[_0x4014('0x38')]['fields']));_0x30dbed['attributes']=_0x30dbed[_0x4014('0x3a')][_0x4014('0x3c')]?_0x30dbed[_0x4014('0x3a')]:_0x28fa85['model'];if(_0x16d795['query']['includeAll']){_0x30dbed[_0x4014('0x46')]=[{'all':!![]}];}_0x30dbed=_['merge']({},_0x30dbed,_0x16d795['options']);return db[_0x4014('0x32')][_0x4014('0x4c')](_0x30dbed)['then'](handleEntityNotFound(_0x1ed3a5,null))[_0x4014('0x29')](respondWithResult(_0x1ed3a5,null))[_0x4014('0x48')](handleError(_0x1ed3a5,null));};exports[_0x4014('0x28')]=function(_0x20ef13,_0x1d2891){if(_0x20ef13[_0x4014('0x4d')]['id']){delete _0x20ef13[_0x4014('0x4d')]['id'];}return db[_0x4014('0x32')][_0x4014('0x4c')]({'where':{'id':_0x20ef13[_0x4014('0x4a')]['id']}})[_0x4014('0x29')](handleEntityNotFound(_0x1d2891,null))[_0x4014('0x29')](saveUpdates(_0x20ef13[_0x4014('0x4d')],null))[_0x4014('0x29')](respondWithResult(_0x1d2891,null))[_0x4014('0x48')](handleError(_0x1d2891,null));};exports[_0x4014('0x2a')]=function(_0x3582eb,_0x4f8972){return db[_0x4014('0x32')][_0x4014('0x4c')]({'where':{'id':_0x3582eb['params']['id']}})['then'](handleEntityNotFound(_0x4f8972,null))[_0x4014('0x29')](removeEntity(_0x4f8972,null))[_0x4014('0x48')](handleError(_0x4f8972,null));};exports[_0x4014('0x4e')]=function(_0x308bf4,_0x1a600c){var _0x404028={'key':_0x308bf4[_0x4014('0x4d')]['key']};if(_0x308bf4[_0x4014('0x4d')][_0x4014('0x4f')]){_0x404028['MailAccountId']=_0x308bf4[_0x4014('0x4d')][_0x4014('0x4f')];}else if(_0x308bf4[_0x4014('0x4d')]['SmsAccountId']){_0x404028[_0x4014('0x50')]=_0x308bf4[_0x4014('0x4d')][_0x4014('0x50')];}else if(_0x308bf4[_0x4014('0x4d')]['OpenchannelAccountId']){_0x404028[_0x4014('0x51')]=_0x308bf4['body']['OpenchannelAccountId'];}else if(_0x308bf4['body'][_0x4014('0x52')]){_0x404028[_0x4014('0x52')]=_0x308bf4[_0x4014('0x4d')]['ChatWebsiteId'];}return db[_0x4014('0x32')][_0x4014('0x4c')]({'where':_0x404028})[_0x4014('0x29')](function(_0x2d4f66){if(_0x2d4f66){throw new db[(_0x4014('0x53'))]['ValidationError'](_0x4014('0x54'));}return db[_0x4014('0x32')]['create'](_0x308bf4['body']);})[_0x4014('0x29')](function(_0x3f89b0){var _0x5dafb7=_0x308bf4[_0x4014('0x55')][_0x4014('0x56')]({'plain':!![]});if(!_0x5dafb7)throw new Error(_0x4014('0x57'));if(_0x5dafb7[_0x4014('0x58')]===_0x4014('0x55')){var _0x1dbca8=_0x3f89b0['get']({'plain':!![]});return db[_0x4014('0x59')][_0x4014('0x4c')]({'where':{'name':_0x4014('0x2b'),'userProfileId':_0x5dafb7['userProfileId']},'raw':!![]})[_0x4014('0x29')](function(_0x1d972e){if(_0x1d972e&&_0x1d972e[_0x4014('0x5a')]===0x0){return db[_0x4014('0x2c')][_0x4014('0x4e')]({'name':_0x1dbca8['name'],'resourceId':_0x1dbca8['id'],'type':_0x1d972e['name'],'sectionId':_0x1d972e['id']},{})[_0x4014('0x29')](function(){return _0x3f89b0;});}else{return _0x3f89b0;}})[_0x4014('0x48')](function(_0x5c85d4){logger[_0x4014('0x2e')](_0x4014('0x5b'),_0x5c85d4);throw _0x5c85d4;});}return _0x3f89b0;})[_0x4014('0x29')](respondWithResult(_0x1a600c,0xc9))[_0x4014('0x48')](handleError(_0x1a600c,null));}; \ No newline at end of file +var _0xd5b3=['includeAll','include','findAll','catch','show','params','find','update','body','create','MailAccountId','SmsAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','CannedAnswer'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0xd5b3,0x1af));var _0x3d5b=function(_0x4a48cf,_0x5f1870){_0x4a48cf=_0x4a48cf-0x0;var _0x24a970=_0xd5b3[_0x4a48cf];return _0x24a970;};'use strict';var emlformat=require(_0x3d5b('0x0'));var rimraf=require(_0x3d5b('0x1'));var zipdir=require(_0x3d5b('0x2'));var jsonpatch=require(_0x3d5b('0x3'));var rp=require(_0x3d5b('0x4'));var moment=require(_0x3d5b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3d5b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3d5b('0x7'));var csv=require('to-csv');var ejs=require(_0x3d5b('0x8'));var fs=require('fs');var fs_extra=require(_0x3d5b('0x9'));var _=require(_0x3d5b('0xa'));var squel=require(_0x3d5b('0xb'));var crypto=require(_0x3d5b('0xc'));var jsforce=require(_0x3d5b('0xd'));var deskjs=require(_0x3d5b('0xe'));var toCsv=require(_0x3d5b('0xf'));var querystring=require(_0x3d5b('0x10'));var Papa=require(_0x3d5b('0x11'));var Redis=require('ioredis');var authService=require(_0x3d5b('0x12'));var qs=require(_0x3d5b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d5b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3d5b('0x15'));var licenseUtil=require(_0x3d5b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x348d41,_0x92256c){_0x92256c=_0x92256c||0xcc;return function(_0x75cf99){if(_0x75cf99){return _0x348d41[_0x3d5b('0x17')](_0x92256c);}return _0x348d41[_0x3d5b('0x18')](_0x92256c)['end']();};}function respondWithResult(_0x56145e,_0x21278b){_0x21278b=_0x21278b||0xc8;return function(_0xd0b694){if(_0xd0b694){return _0x56145e[_0x3d5b('0x18')](_0x21278b)[_0x3d5b('0x19')](_0xd0b694);}};}function respondWithFilteredResult(_0x1189b5,_0x4e281b){return function(_0xb105d4){if(_0xb105d4){var _0x6fc523=typeof _0x4e281b['offset']===_0x3d5b('0x1a')&&typeof _0x4e281b['limit']===_0x3d5b('0x1a');var _0x33f886=_0xb105d4[_0x3d5b('0x1b')];var _0x3658fd=_0x6fc523?0x0:_0x4e281b[_0x3d5b('0x1c')];var _0x1d824d=_0x6fc523?_0xb105d4[_0x3d5b('0x1b')]:_0x4e281b[_0x3d5b('0x1c')]+_0x4e281b[_0x3d5b('0x1d')];var _0xdd48a9;if(_0x1d824d>=_0x33f886){_0x1d824d=_0x33f886;_0xdd48a9=0xc8;}else{_0xdd48a9=0xce;}_0x1189b5['status'](_0xdd48a9);return _0x1189b5[_0x3d5b('0x1e')](_0x3d5b('0x1f'),_0x3658fd+'-'+_0x1d824d+'/'+_0x33f886)[_0x3d5b('0x19')](_0xb105d4);}return null;};}function patchUpdates(_0x33e9a8){return function(_0x4609c2){try{jsonpatch[_0x3d5b('0x20')](_0x4609c2,_0x33e9a8,!![]);}catch(_0x34a48a){return BPromise[_0x3d5b('0x21')](_0x34a48a);}return _0x4609c2[_0x3d5b('0x22')]();};}function saveUpdates(_0x2ac624,_0x1fc98c){return function(_0x4dc95c){if(_0x4dc95c){return _0x4dc95c['update'](_0x2ac624)[_0x3d5b('0x23')](function(_0x87ab6b){return _0x87ab6b;});}return null;};}function removeEntity(_0x5785f9,_0x3221c2){return function(_0x4c6a6c){if(_0x4c6a6c){return _0x4c6a6c[_0x3d5b('0x24')]()[_0x3d5b('0x23')](function(){var _0x3cd03c=_0x4c6a6c['get']({'plain':!![]});var _0x2780d1='CannedAnswers';return db['UserProfileResource'][_0x3d5b('0x24')]({'where':{'type':_0x2780d1,'resourceId':_0x3cd03c['id']}})['then'](function(){return _0x4c6a6c;});})[_0x3d5b('0x23')](function(){_0x5785f9[_0x3d5b('0x18')](0xcc)[_0x3d5b('0x25')]();});}};}function handleEntityNotFound(_0x32ac0a,_0x5ef57f){return function(_0x40624c){if(!_0x40624c){_0x32ac0a[_0x3d5b('0x17')](0x194);}return _0x40624c;};}function handleError(_0x2ac33d,_0x3c26b9){_0x3c26b9=_0x3c26b9||0x1f4;return function(_0x8f152f){logger[_0x3d5b('0x26')](_0x8f152f[_0x3d5b('0x27')]);if(_0x8f152f[_0x3d5b('0x28')]){delete _0x8f152f[_0x3d5b('0x28')];}_0x2ac33d['status'](_0x3c26b9)[_0x3d5b('0x29')](_0x8f152f);};}exports['index']=function(_0x2895a8,_0x3edce4){var _0x2044d7={},_0x4e0431={},_0xec513b={'count':0x0,'rows':[]};var _0x19721a=_[_0x3d5b('0x2a')](db['CannedAnswer'][_0x3d5b('0x2b')],function(_0x4c32d3){return{'name':_0x4c32d3['fieldName'],'type':_0x4c32d3['type'][_0x3d5b('0x2c')]};});_0x4e0431[_0x3d5b('0x2d')]=_[_0x3d5b('0x2a')](_0x19721a,_0x3d5b('0x28'));_0x4e0431[_0x3d5b('0x2e')]=_[_0x3d5b('0x2f')](_0x2895a8['query']);_0x4e0431[_0x3d5b('0x30')]=_[_0x3d5b('0x31')](_0x4e0431[_0x3d5b('0x2d')],_0x4e0431[_0x3d5b('0x2e')]);_0x2044d7[_0x3d5b('0x32')]=_[_0x3d5b('0x31')](_0x4e0431[_0x3d5b('0x2d')],qs['fields'](_0x2895a8[_0x3d5b('0x2e')][_0x3d5b('0x33')]));_0x2044d7[_0x3d5b('0x32')]=_0x2044d7[_0x3d5b('0x32')][_0x3d5b('0x34')]?_0x2044d7[_0x3d5b('0x32')]:_0x4e0431[_0x3d5b('0x2d')];if(!_0x2895a8[_0x3d5b('0x2e')][_0x3d5b('0x35')](_0x3d5b('0x36'))){_0x2044d7['limit']=qs['limit'](_0x2895a8[_0x3d5b('0x2e')][_0x3d5b('0x1d')]);_0x2044d7[_0x3d5b('0x1c')]=qs[_0x3d5b('0x1c')](_0x2895a8[_0x3d5b('0x2e')]['offset']);}_0x2044d7['order']=qs[_0x3d5b('0x37')](_0x2895a8[_0x3d5b('0x2e')]['sort']);_0x2044d7[_0x3d5b('0x38')]=qs[_0x3d5b('0x30')](_[_0x3d5b('0x39')](_0x2895a8['query'],_0x4e0431[_0x3d5b('0x30')]),_0x19721a);if(_0x2895a8[_0x3d5b('0x2e')]['filter']){_0x2044d7['where']=_[_0x3d5b('0x3a')](_0x2044d7[_0x3d5b('0x38')],{'$or':[{'key':{'$like':'%'+_0x2895a8[_0x3d5b('0x2e')]['filter']+'%'}},{'value':{'$like':'%'+_0x2895a8[_0x3d5b('0x2e')]['filter']+'%'}}]});}_0x2044d7=_[_0x3d5b('0x3a')]({},_0x2044d7,_0x2895a8[_0x3d5b('0x3b')]);var _0x532ce2={'where':_0x2044d7['where']};return db[_0x3d5b('0x3c')]['count'](_0x532ce2)['then'](function(_0x58d170){_0xec513b['count']=_0x58d170;if(_0x2895a8[_0x3d5b('0x2e')][_0x3d5b('0x3d')]){_0x2044d7[_0x3d5b('0x3e')]=[{'all':!![]}];}return db[_0x3d5b('0x3c')][_0x3d5b('0x3f')](_0x2044d7);})[_0x3d5b('0x23')](function(_0x34de69){_0xec513b['rows']=_0x34de69;return _0xec513b;})[_0x3d5b('0x23')](respondWithFilteredResult(_0x3edce4,_0x2044d7))[_0x3d5b('0x40')](handleError(_0x3edce4,null));};exports[_0x3d5b('0x41')]=function(_0x3ae5f0,_0x2ab674){var _0x4c02a9={'raw':!![],'where':{'id':_0x3ae5f0[_0x3d5b('0x42')]['id']}},_0x386a37={};_0x386a37['model']=_[_0x3d5b('0x2f')](db[_0x3d5b('0x3c')]['rawAttributes']);_0x386a37[_0x3d5b('0x2e')]=_[_0x3d5b('0x2f')](_0x3ae5f0[_0x3d5b('0x2e')]);_0x386a37[_0x3d5b('0x30')]=_['intersection'](_0x386a37[_0x3d5b('0x2d')],_0x386a37[_0x3d5b('0x2e')]);_0x4c02a9[_0x3d5b('0x32')]=_[_0x3d5b('0x31')](_0x386a37[_0x3d5b('0x2d')],qs['fields'](_0x3ae5f0[_0x3d5b('0x2e')][_0x3d5b('0x33')]));_0x4c02a9['attributes']=_0x4c02a9[_0x3d5b('0x32')][_0x3d5b('0x34')]?_0x4c02a9[_0x3d5b('0x32')]:_0x386a37[_0x3d5b('0x2d')];if(_0x3ae5f0['query'][_0x3d5b('0x3d')]){_0x4c02a9['include']=[{'all':!![]}];}_0x4c02a9=_['merge']({},_0x4c02a9,_0x3ae5f0['options']);return db[_0x3d5b('0x3c')][_0x3d5b('0x43')](_0x4c02a9)['then'](handleEntityNotFound(_0x2ab674,null))[_0x3d5b('0x23')](respondWithResult(_0x2ab674,null))['catch'](handleError(_0x2ab674,null));};exports[_0x3d5b('0x44')]=function(_0x34f498,_0x145970){if(_0x34f498['body']['id']){delete _0x34f498[_0x3d5b('0x45')]['id'];}return db['CannedAnswer'][_0x3d5b('0x43')]({'where':{'id':_0x34f498[_0x3d5b('0x42')]['id']}})[_0x3d5b('0x23')](handleEntityNotFound(_0x145970,null))[_0x3d5b('0x23')](saveUpdates(_0x34f498['body'],null))[_0x3d5b('0x23')](respondWithResult(_0x145970,null))[_0x3d5b('0x40')](handleError(_0x145970,null));};exports[_0x3d5b('0x24')]=function(_0x2be84e,_0x4023a6){return db[_0x3d5b('0x3c')][_0x3d5b('0x43')]({'where':{'id':_0x2be84e[_0x3d5b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4023a6,null))[_0x3d5b('0x23')](removeEntity(_0x4023a6,null))[_0x3d5b('0x40')](handleError(_0x4023a6,null));};exports[_0x3d5b('0x46')]=function(_0x398770,_0x50c171){var _0x5dd43c={'key':_0x398770[_0x3d5b('0x45')][_0x3d5b('0x2c')]};if(_0x398770[_0x3d5b('0x45')][_0x3d5b('0x47')]){_0x5dd43c['MailAccountId']=_0x398770[_0x3d5b('0x45')][_0x3d5b('0x47')];}else if(_0x398770[_0x3d5b('0x45')][_0x3d5b('0x48')]){_0x5dd43c[_0x3d5b('0x48')]=_0x398770[_0x3d5b('0x45')][_0x3d5b('0x48')];}else if(_0x398770['body']['OpenchannelAccountId']){_0x5dd43c['OpenchannelAccountId']=_0x398770['body']['OpenchannelAccountId'];}else if(_0x398770[_0x3d5b('0x45')]['ChatWebsiteId']){_0x5dd43c[_0x3d5b('0x49')]=_0x398770[_0x3d5b('0x45')][_0x3d5b('0x49')];}return db[_0x3d5b('0x3c')][_0x3d5b('0x43')]({'where':_0x5dd43c})['then'](function(_0xc390ce){if(_0xc390ce){throw new db['Sequelize']['ValidationError'](_0x3d5b('0x4a'));}return db[_0x3d5b('0x3c')][_0x3d5b('0x46')](_0x398770[_0x3d5b('0x45')]);})[_0x3d5b('0x23')](function(_0x46968d){var _0x5233ce=_0x398770[_0x3d5b('0x4b')][_0x3d5b('0x4c')]({'plain':!![]});if(!_0x5233ce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5233ce[_0x3d5b('0x4d')]==='user'){var _0x3ef569=_0x46968d['get']({'plain':!![]});return db[_0x3d5b('0x4e')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x5233ce[_0x3d5b('0x4f')]},'raw':!![]})[_0x3d5b('0x23')](function(_0x1e24b1){if(_0x1e24b1&&_0x1e24b1[_0x3d5b('0x50')]===0x0){return db['UserProfileResource'][_0x3d5b('0x46')]({'name':_0x3ef569['name'],'resourceId':_0x3ef569['id'],'type':_0x1e24b1['name'],'sectionId':_0x1e24b1['id']},{})[_0x3d5b('0x23')](function(){return _0x46968d;});}else{return _0x46968d;}})['catch'](function(_0x5a24c3){logger[_0x3d5b('0x26')](_0x3d5b('0x51'),_0x5a24c3);throw _0x5a24c3;});}return _0x46968d;})['then'](respondWithResult(_0x50c171,0xc9))[_0x3d5b('0x40')](handleError(_0x50c171,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 94d8f7a..18ae254 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 _0x1371=['request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x550ad2,_0x408485){var _0x38965e=function(_0x2530db){while(--_0x2530db){_0x550ad2['push'](_0x550ad2['shift']());}};_0x38965e(++_0x408485);}(_0x1371,0x91));var _0x1137=function(_0x2586b1,_0x283fe3){_0x2586b1=_0x2586b1-0x0;var _0x2db684=_0x1371[_0x2586b1];return _0x2db684;};'use strict';var _=require(_0x1137('0x0'));var util=require(_0x1137('0x1'));var logger=require(_0x1137('0x2'))('api');var moment=require(_0x1137('0x3'));var BPromise=require(_0x1137('0x4'));var rp=require(_0x1137('0x5'));var fs=require('fs');var path=require(_0x1137('0x6'));var rimraf=require(_0x1137('0x7'));var config=require(_0x1137('0x8'));var attributes=require(_0x1137('0x9'));module[_0x1137('0xa')]=function(_0x5d9cf0,_0x1933a8){return _0x5d9cf0['define'](_0x1137('0xb'),attributes,{'tableName':_0x1137('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1137('0xd'),'collate':_0x1137('0xe')});}; \ No newline at end of file +var _0x95c0=['../../config/logger','api','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5766b8,_0x3f562d){var _0x214b9f=function(_0x5ce922){while(--_0x5ce922){_0x5766b8['push'](_0x5766b8['shift']());}};_0x214b9f(++_0x3f562d);}(_0x95c0,0x74));var _0x095c=function(_0x5e0ee7,_0x5a440b){_0x5e0ee7=_0x5e0ee7-0x0;var _0x484cd2=_0x95c0[_0x5e0ee7];return _0x484cd2;};'use strict';var _=require(_0x095c('0x0'));var util=require('util');var logger=require(_0x095c('0x1'))(_0x095c('0x2'));var moment=require('moment');var BPromise=require(_0x095c('0x3'));var rp=require(_0x095c('0x4'));var fs=require('fs');var path=require(_0x095c('0x5'));var rimraf=require(_0x095c('0x6'));var config=require('../../config/environment');var attributes=require(_0x095c('0x7'));module[_0x095c('0x8')]=function(_0x2b7b3e,_0x92c19b){return _0x2b7b3e[_0x095c('0x9')](_0x095c('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x095c('0xb'),'collate':_0x095c('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 184a492..b90a4e3 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(_0x310f24,_0x31da0c){var _0x1844c3=function(_0x365951){while(--_0x365951){_0x310f24['push'](_0x310f24['shift']());}};_0x1844c3(++_0x31da0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x11f994,_0x205b18){var _0x23e41f=function(_0x4d0b3f){while(--_0x4d0b3f){_0x11f994['push'](_0x11f994['shift']());}};_0x23e41f(++_0x205b18);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var 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 09ef99d..d1dafa4 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 _0x1b00=['fs-extra','../../components/auth/service','isAuthenticated','index','get','create','/:id','update','destroy','util','path','express','Router'];(function(_0x1c208e,_0x2a0a5b){var _0x5104ff=function(_0x3ca41f){while(--_0x3ca41f){_0x1c208e['push'](_0x1c208e['shift']());}};_0x5104ff(++_0x2a0a5b);}(_0x1b00,0x18f));var _0x01b0=function(_0x11b3ef,_0x1116f5){_0x11b3ef=_0x11b3ef-0x0;var _0xb47b38=_0x1b00[_0x11b3ef];return _0xb47b38;};'use strict';var multer=require('multer');var util=require(_0x01b0('0x0'));var path=require(_0x01b0('0x1'));var timeout=require('connect-timeout');var express=require(_0x01b0('0x2'));var router=express[_0x01b0('0x3')]();var fs_extra=require(_0x01b0('0x4'));var auth=require(_0x01b0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x01b0('0x6')](),controller[_0x01b0('0x7')]);router[_0x01b0('0x8')]('/:id',auth[_0x01b0('0x6')](),controller['show']);router['post']('/',auth[_0x01b0('0x6')](),controller[_0x01b0('0x9')]);router['put'](_0x01b0('0xa'),auth[_0x01b0('0x6')](),controller[_0x01b0('0xb')]);router['delete'](_0x01b0('0xa'),auth['isAuthenticated'](),controller[_0x01b0('0xc')]);module['exports']=router; \ No newline at end of file +var _0x1aa1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','update','destroy','exports','multer','util','path'];(function(_0xfdb17b,_0x3491b7){var _0x1df0d9=function(_0x5dac2b){while(--_0x5dac2b){_0xfdb17b['push'](_0xfdb17b['shift']());}};_0x1df0d9(++_0x3491b7);}(_0x1aa1,0x19b));var _0x11aa=function(_0x549eac,_0x5d7829){_0x549eac=_0x549eac-0x0;var _0x376cf0=_0x1aa1[_0x549eac];return _0x376cf0;};'use strict';var multer=require(_0x11aa('0x0'));var util=require(_0x11aa('0x1'));var path=require(_0x11aa('0x2'));var timeout=require(_0x11aa('0x3'));var express=require(_0x11aa('0x4'));var router=express[_0x11aa('0x5')]();var fs_extra=require(_0x11aa('0x6'));var auth=require(_0x11aa('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x11aa('0x8'));router[_0x11aa('0x9')]('/',auth[_0x11aa('0xa')](),controller[_0x11aa('0xb')]);router[_0x11aa('0x9')](_0x11aa('0xc'),auth[_0x11aa('0xa')](),controller[_0x11aa('0xd')]);router[_0x11aa('0xe')]('/',auth[_0x11aa('0xa')](),controller['create']);router['put'](_0x11aa('0xc'),auth[_0x11aa('0xa')](),controller[_0x11aa('0xf')]);router['delete'](_0x11aa('0xc'),auth['isAuthenticated'](),controller[_0x11aa('0x10')]);module[_0x11aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index e27d140..df619d9 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 _0xb7fc=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x4461f5,_0x4469fa){var _0x38b6c7=function(_0x40ff08){while(--_0x40ff08){_0x4461f5['push'](_0x4461f5['shift']());}};_0x38b6c7(++_0x4469fa);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0xb7fc[_0x380307];return _0x9ea14b;};'use strict';var Sequelize=require(_0xcb7f('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xcb7f('0x1')},'clid':{'type':Sequelize[_0xcb7f('0x2')]},'src':{'type':Sequelize[_0xcb7f('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xcb7f('0x2')]},'dstchannel':{'type':Sequelize[_0xcb7f('0x2')]},'lastapp':{'type':Sequelize[_0xcb7f('0x2')]},'lastdata':{'type':Sequelize[_0xcb7f('0x2')]},'duration':{'type':Sequelize[_0xcb7f('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xcb7f('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xcb7f('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xcb7f('0x2')]},'userfield':{'type':Sequelize[_0xcb7f('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xcb7f('0x2')]},'sequence':{'type':Sequelize[_0xcb7f('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcb7f('0x2')]},'tag':{'type':Sequelize[_0xcb7f('0x2')]}}; \ No newline at end of file +var _0x02e5=['INTEGER','sequelize','exports','DATE','STRING'];(function(_0x131712,_0x2ed068){var _0x292b97=function(_0x106fbd){while(--_0x106fbd){_0x131712['push'](_0x131712['shift']());}};_0x292b97(++_0x2ed068);}(_0x02e5,0x132));var _0x502e=function(_0x25aa14,_0x1b846c){_0x25aa14=_0x25aa14-0x0;var _0x5812f8=_0x02e5[_0x25aa14];return _0x5812f8;};'use strict';var Sequelize=require(_0x502e('0x0'));module[_0x502e('0x1')]={'calldate':{'type':Sequelize[_0x502e('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x502e('0x3')]},'src':{'type':Sequelize[_0x502e('0x3')]},'dst':{'type':Sequelize[_0x502e('0x3')]},'dcontext':{'type':Sequelize[_0x502e('0x3')]},'channel':{'type':Sequelize[_0x502e('0x3')]},'dstchannel':{'type':Sequelize[_0x502e('0x3')]},'lastapp':{'type':Sequelize[_0x502e('0x3')]},'lastdata':{'type':Sequelize[_0x502e('0x3')]},'duration':{'type':Sequelize[_0x502e('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x502e('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x502e('0x3')]},'amaflags':{'type':Sequelize[_0x502e('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x502e('0x3')]},'userfield':{'type':Sequelize[_0x502e('0x3')]},'uniqueid':{'type':Sequelize[_0x502e('0x3')]},'linkedid':{'type':Sequelize[_0x502e('0x3')]},'sequence':{'type':Sequelize[_0x502e('0x3')]},'peeraccount':{'type':Sequelize[_0x502e('0x3')]},'type':{'type':Sequelize[_0x502e('0x3')]},'tag':{'type':Sequelize[_0x502e('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index bb0c156..10d7c1c 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 _0xcca7=['count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','Cdr','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','offset','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','findAll','catch','show','params','includeAll','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','limit','undefined'];(function(_0x5825eb,_0x1a6960){var _0x1a6ac8=function(_0x375e7e){while(--_0x375e7e){_0x5825eb['push'](_0x5825eb['shift']());}};_0x1a6ac8(++_0x1a6960);}(_0xcca7,0x1aa));var _0x7cca=function(_0xd7bb05,_0x127327){_0xd7bb05=_0xd7bb05-0x0;var _0x1a4c95=_0xcca7[_0xd7bb05];return _0x1a4c95;};'use strict';var emlformat=require(_0x7cca('0x0'));var rimraf=require(_0x7cca('0x1'));var zipdir=require(_0x7cca('0x2'));var jsonpatch=require(_0x7cca('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7cca('0x4'));var Mustache=require('mustache');var util=require(_0x7cca('0x5'));var path=require(_0x7cca('0x6'));var sox=require(_0x7cca('0x7'));var csv=require(_0x7cca('0x8'));var ejs=require(_0x7cca('0x9'));var fs=require('fs');var fs_extra=require(_0x7cca('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7cca('0xb'));var jsforce=require(_0x7cca('0xc'));var deskjs=require(_0x7cca('0xd'));var toCsv=require(_0x7cca('0x8'));var querystring=require(_0x7cca('0xe'));var Papa=require(_0x7cca('0xf'));var Redis=require(_0x7cca('0x10'));var authService=require(_0x7cca('0x11'));var qs=require(_0x7cca('0x12'));var as=require(_0x7cca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cca('0x14'))(_0x7cca('0x15'));var utils=require(_0x7cca('0x16'));var config=require(_0x7cca('0x17'));var licenseUtil=require(_0x7cca('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a14cc,_0x41e0a2){_0x41e0a2=_0x41e0a2||0xcc;return function(_0x2854c7){if(_0x2854c7){return _0x2a14cc['sendStatus'](_0x41e0a2);}return _0x2a14cc['status'](_0x41e0a2)[_0x7cca('0x19')]();};}function respondWithResult(_0x20c1b2,_0x27d671){_0x27d671=_0x27d671||0xc8;return function(_0x847cce){if(_0x847cce){return _0x20c1b2[_0x7cca('0x1a')](_0x27d671)[_0x7cca('0x1b')](_0x847cce);}};}function respondWithFilteredResult(_0x45143d,_0x5a357d){return function(_0x216d4b){if(_0x216d4b){var _0x533608=typeof _0x5a357d['offset']==='undefined'&&typeof _0x5a357d[_0x7cca('0x1c')]===_0x7cca('0x1d');var _0x1dd043=_0x216d4b[_0x7cca('0x1e')];var _0x44294b=_0x533608?0x0:_0x5a357d['offset'];var _0xb35e1d=_0x533608?_0x216d4b['count']:_0x5a357d['offset']+_0x5a357d['limit'];var _0x370469;if(_0xb35e1d>=_0x1dd043){_0xb35e1d=_0x1dd043;_0x370469=0xc8;}else{_0x370469=0xce;}_0x45143d[_0x7cca('0x1a')](_0x370469);return _0x45143d[_0x7cca('0x1f')](_0x7cca('0x20'),_0x44294b+'-'+_0xb35e1d+'/'+_0x1dd043)[_0x7cca('0x1b')](_0x216d4b);}return null;};}function patchUpdates(_0x45db2f){return function(_0x2e023c){try{jsonpatch[_0x7cca('0x21')](_0x2e023c,_0x45db2f,!![]);}catch(_0x4d7804){return BPromise[_0x7cca('0x22')](_0x4d7804);}return _0x2e023c[_0x7cca('0x23')]();};}function saveUpdates(_0x165d13,_0x4343a3){return function(_0x55b689){if(_0x55b689){return _0x55b689[_0x7cca('0x24')](_0x165d13)[_0x7cca('0x25')](function(_0x4367f9){return _0x4367f9;});}return null;};}function removeEntity(_0x119d76,_0x823d7d){return function(_0x3fc157){if(_0x3fc157){return _0x3fc157[_0x7cca('0x26')]()[_0x7cca('0x25')](function(){_0x119d76['status'](0xcc)[_0x7cca('0x19')]();});}};}function handleEntityNotFound(_0x1dd3b3,_0x1774fc){return function(_0xdaf07f){if(!_0xdaf07f){_0x1dd3b3[_0x7cca('0x27')](0x194);}return _0xdaf07f;};}function handleError(_0x21da68,_0x35ebe8){_0x35ebe8=_0x35ebe8||0x1f4;return function(_0x40ac86){logger['error'](_0x40ac86[_0x7cca('0x28')]);if(_0x40ac86['name']){delete _0x40ac86[_0x7cca('0x29')];}_0x21da68[_0x7cca('0x1a')](_0x35ebe8)['send'](_0x40ac86);};}exports[_0x7cca('0x2a')]=function(_0x3d91b1,_0x5533fb){var _0x249442={},_0x1cd53a={},_0x100061={'count':0x0,'rows':[]};var _0x52fb40=_['map'](db[_0x7cca('0x2b')][_0x7cca('0x2c')],function(_0x3797f4){return{'name':_0x3797f4[_0x7cca('0x2d')],'type':_0x3797f4[_0x7cca('0x2e')][_0x7cca('0x2f')]};});_0x1cd53a[_0x7cca('0x30')]=_['map'](_0x52fb40,'name');_0x1cd53a[_0x7cca('0x31')]=_[_0x7cca('0x32')](_0x3d91b1[_0x7cca('0x31')]);_0x1cd53a['filters']=_[_0x7cca('0x33')](_0x1cd53a['model'],_0x1cd53a[_0x7cca('0x31')]);_0x249442[_0x7cca('0x34')]=_[_0x7cca('0x33')](_0x1cd53a[_0x7cca('0x30')],qs['fields'](_0x3d91b1[_0x7cca('0x31')][_0x7cca('0x35')]));_0x249442[_0x7cca('0x34')]=_0x249442['attributes']['length']?_0x249442['attributes']:_0x1cd53a[_0x7cca('0x30')];if(!_0x3d91b1[_0x7cca('0x31')]['hasOwnProperty'](_0x7cca('0x36'))){_0x249442[_0x7cca('0x1c')]=qs[_0x7cca('0x1c')](_0x3d91b1[_0x7cca('0x31')][_0x7cca('0x1c')]);_0x249442[_0x7cca('0x37')]=qs[_0x7cca('0x37')](_0x3d91b1['query'][_0x7cca('0x37')]);}_0x249442[_0x7cca('0x38')]=qs[_0x7cca('0x39')](_0x3d91b1[_0x7cca('0x31')]['sort']);_0x249442[_0x7cca('0x3a')]=qs[_0x7cca('0x3b')](_[_0x7cca('0x3c')](_0x3d91b1['query'],_0x1cd53a[_0x7cca('0x3b')]),_0x52fb40);if(_0x3d91b1['query'][_0x7cca('0x3d')]){_0x249442[_0x7cca('0x3a')]=_[_0x7cca('0x3e')](_0x249442[_0x7cca('0x3a')],{'$or':_[_0x7cca('0x3f')](_0x52fb40,function(_0x25b3a9){if(_0x25b3a9[_0x7cca('0x2e')]!==_0x7cca('0x40')){var _0x3617b8={};_0x3617b8[_0x25b3a9['name']]={'$like':'%'+_0x3d91b1['query'][_0x7cca('0x3d')]+'%'};return _0x3617b8;}})});}_0x249442=_[_0x7cca('0x3e')]({},_0x249442,_0x3d91b1['options']);var _0x48d87f={'where':_0x249442[_0x7cca('0x3a')]};return db[_0x7cca('0x2b')][_0x7cca('0x1e')](_0x48d87f)[_0x7cca('0x25')](function(_0x371c67){_0x100061['count']=_0x371c67;if(_0x3d91b1[_0x7cca('0x31')]['includeAll']){_0x249442['include']=[{'all':!![]}];}return db[_0x7cca('0x2b')][_0x7cca('0x41')](_0x249442);})['then'](function(_0x3b120b){_0x100061['rows']=_0x3b120b;return _0x100061;})[_0x7cca('0x25')](respondWithFilteredResult(_0x5533fb,_0x249442))[_0x7cca('0x42')](handleError(_0x5533fb,null));};exports[_0x7cca('0x43')]=function(_0x47e2e6,_0xb966da){var _0x207250={'raw':!![],'where':{'id':_0x47e2e6[_0x7cca('0x44')]['id']}},_0x2e8d97={};_0x2e8d97['model']=_[_0x7cca('0x32')](db[_0x7cca('0x2b')][_0x7cca('0x2c')]);_0x2e8d97[_0x7cca('0x31')]=_[_0x7cca('0x32')](_0x47e2e6[_0x7cca('0x31')]);_0x2e8d97['filters']=_['intersection'](_0x2e8d97['model'],_0x2e8d97['query']);_0x207250[_0x7cca('0x34')]=_['intersection'](_0x2e8d97['model'],qs[_0x7cca('0x35')](_0x47e2e6[_0x7cca('0x31')][_0x7cca('0x35')]));_0x207250[_0x7cca('0x34')]=_0x207250[_0x7cca('0x34')]['length']?_0x207250[_0x7cca('0x34')]:_0x2e8d97[_0x7cca('0x30')];if(_0x47e2e6[_0x7cca('0x31')][_0x7cca('0x45')]){_0x207250[_0x7cca('0x46')]=[{'all':!![]}];}_0x207250=_[_0x7cca('0x3e')]({},_0x207250,_0x47e2e6[_0x7cca('0x47')]);return db[_0x7cca('0x2b')][_0x7cca('0x48')](_0x207250)[_0x7cca('0x25')](handleEntityNotFound(_0xb966da,null))[_0x7cca('0x25')](respondWithResult(_0xb966da,null))['catch'](handleError(_0xb966da,null));};exports['create']=function(_0x36f12f,_0x5913eb){return db[_0x7cca('0x2b')][_0x7cca('0x49')](_0x36f12f[_0x7cca('0x4a')],{})[_0x7cca('0x25')](respondWithResult(_0x5913eb,0xc9))[_0x7cca('0x42')](handleError(_0x5913eb,null));};exports[_0x7cca('0x24')]=function(_0x184b56,_0xe0059e){if(_0x184b56[_0x7cca('0x4a')]['id']){delete _0x184b56[_0x7cca('0x4a')]['id'];}return db['Cdr'][_0x7cca('0x48')]({'where':{'id':_0x184b56[_0x7cca('0x44')]['id']}})[_0x7cca('0x25')](handleEntityNotFound(_0xe0059e,null))[_0x7cca('0x25')](saveUpdates(_0x184b56[_0x7cca('0x4a')],null))[_0x7cca('0x25')](respondWithResult(_0xe0059e,null))[_0x7cca('0x42')](handleError(_0xe0059e,null));};exports[_0x7cca('0x26')]=function(_0x218114,_0x43c581){return db[_0x7cca('0x2b')][_0x7cca('0x48')]({'where':{'id':_0x218114[_0x7cca('0x44')]['id']}})[_0x7cca('0x25')](handleEntityNotFound(_0x43c581,null))[_0x7cca('0x25')](removeEntity(_0x43c581,null))[_0x7cca('0x42')](handleError(_0x43c581,null));};exports[_0x7cca('0x4b')]=function(_0x27c527,_0x343a64){return db[_0x7cca('0x2b')][_0x7cca('0x4b')]()[_0x7cca('0x25')](respondWithResult(_0x343a64,null))[_0x7cca('0x42')](handleError(_0x343a64,null));}; \ No newline at end of file +var _0x3eea=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','intersection','find','create','body','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','Cdr','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0x3eea,0x1ca));var _0xa3ee=function(_0xc5e768,_0xb62377){_0xc5e768=_0xc5e768-0x0;var _0x387050=_0x3eea[_0xc5e768];return _0x387050;};'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('0x2a')](_0x3fa094,'name');_0x78e581[_0xa3ee('0x31')]=_['keys'](_0x59c6f9[_0xa3ee('0x31')]);_0x78e581[_0xa3ee('0x32')]=_['intersection'](_0x78e581[_0xa3ee('0x30')],_0x78e581['query']);_0x4abf49[_0xa3ee('0x33')]=_['intersection'](_0x78e581[_0xa3ee('0x30')],qs[_0xa3ee('0x34')](_0x59c6f9[_0xa3ee('0x31')][_0xa3ee('0x34')]));_0x4abf49[_0xa3ee('0x33')]=_0x4abf49['attributes'][_0xa3ee('0x35')]?_0x4abf49[_0xa3ee('0x33')]:_0x78e581[_0xa3ee('0x30')];if(!_0x59c6f9['query'][_0xa3ee('0x36')]('nolimit')){_0x4abf49[_0xa3ee('0x1b')]=qs['limit'](_0x59c6f9[_0xa3ee('0x31')]['limit']);_0x4abf49[_0xa3ee('0x19')]=qs[_0xa3ee('0x19')](_0x59c6f9[_0xa3ee('0x31')][_0xa3ee('0x19')]);}_0x4abf49[_0xa3ee('0x37')]=qs[_0xa3ee('0x38')](_0x59c6f9[_0xa3ee('0x31')][_0xa3ee('0x38')]);_0x4abf49[_0xa3ee('0x39')]=qs[_0xa3ee('0x32')](_[_0xa3ee('0x3a')](_0x59c6f9[_0xa3ee('0x31')],_0x78e581[_0xa3ee('0x32')]),_0x3fa094);if(_0x59c6f9['query'][_0xa3ee('0x3b')]){_0x4abf49[_0xa3ee('0x39')]=_[_0xa3ee('0x3c')](_0x4abf49[_0xa3ee('0x39')],{'$or':_['map'](_0x3fa094,function(_0x257627){if(_0x257627[_0xa3ee('0x2e')]!==_0xa3ee('0x3d')){var _0x5b95e3={};_0x5b95e3[_0x257627[_0xa3ee('0x27')]]={'$like':'%'+_0x59c6f9[_0xa3ee('0x31')]['filter']+'%'};return _0x5b95e3;}})});}_0x4abf49=_[_0xa3ee('0x3c')]({},_0x4abf49,_0x59c6f9[_0xa3ee('0x3e')]);var _0x4ef99a={'where':_0x4abf49[_0xa3ee('0x39')]};return db[_0xa3ee('0x2b')][_0xa3ee('0x1c')](_0x4ef99a)[_0xa3ee('0x23')](function(_0x1f0023){_0x481358[_0xa3ee('0x1c')]=_0x1f0023;if(_0x59c6f9[_0xa3ee('0x31')][_0xa3ee('0x3f')]){_0x4abf49[_0xa3ee('0x40')]=[{'all':!![]}];}return db[_0xa3ee('0x2b')][_0xa3ee('0x41')](_0x4abf49);})['then'](function(_0x5aa4b3){_0x481358['rows']=_0x5aa4b3;return _0x481358;})[_0xa3ee('0x23')](respondWithFilteredResult(_0x5ba571,_0x4abf49))[_0xa3ee('0x42')](handleError(_0x5ba571,null));};exports['show']=function(_0xca106f,_0x425f69){var _0x279834={'raw':!![],'where':{'id':_0xca106f[_0xa3ee('0x43')]['id']}},_0x55f47f={};_0x55f47f['model']=_[_0xa3ee('0x44')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')]);_0x55f47f[_0xa3ee('0x31')]=_[_0xa3ee('0x44')](_0xca106f[_0xa3ee('0x31')]);_0x55f47f[_0xa3ee('0x32')]=_[_0xa3ee('0x45')](_0x55f47f[_0xa3ee('0x30')],_0x55f47f[_0xa3ee('0x31')]);_0x279834[_0xa3ee('0x33')]=_[_0xa3ee('0x45')](_0x55f47f[_0xa3ee('0x30')],qs[_0xa3ee('0x34')](_0xca106f[_0xa3ee('0x31')][_0xa3ee('0x34')]));_0x279834[_0xa3ee('0x33')]=_0x279834[_0xa3ee('0x33')]['length']?_0x279834[_0xa3ee('0x33')]:_0x55f47f[_0xa3ee('0x30')];if(_0xca106f[_0xa3ee('0x31')][_0xa3ee('0x3f')]){_0x279834['include']=[{'all':!![]}];}_0x279834=_[_0xa3ee('0x3c')]({},_0x279834,_0xca106f['options']);return db[_0xa3ee('0x2b')][_0xa3ee('0x46')](_0x279834)[_0xa3ee('0x23')](handleEntityNotFound(_0x425f69,null))[_0xa3ee('0x23')](respondWithResult(_0x425f69,null))[_0xa3ee('0x42')](handleError(_0x425f69,null));};exports[_0xa3ee('0x47')]=function(_0xd723ad,_0xbb0148){return db[_0xa3ee('0x2b')][_0xa3ee('0x47')](_0xd723ad['body'],{})[_0xa3ee('0x23')](respondWithResult(_0xbb0148,0xc9))['catch'](handleError(_0xbb0148,null));};exports['update']=function(_0xaad29c,_0x2f7171){if(_0xaad29c[_0xa3ee('0x48')]['id']){delete _0xaad29c[_0xa3ee('0x48')]['id'];}return db[_0xa3ee('0x2b')][_0xa3ee('0x46')]({'where':{'id':_0xaad29c[_0xa3ee('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f7171,null))[_0xa3ee('0x23')](saveUpdates(_0xaad29c[_0xa3ee('0x48')],null))['then'](respondWithResult(_0x2f7171,null))[_0xa3ee('0x42')](handleError(_0x2f7171,null));};exports[_0xa3ee('0x24')]=function(_0x2f1db4,_0x5ec981){return db['Cdr'][_0xa3ee('0x46')]({'where':{'id':_0x2f1db4[_0xa3ee('0x43')]['id']}})[_0xa3ee('0x23')](handleEntityNotFound(_0x5ec981,null))[_0xa3ee('0x23')](removeEntity(_0x5ec981,null))[_0xa3ee('0x42')](handleError(_0x5ec981,null));};exports['describe']=function(_0x55678e,_0x15b55e){return db[_0xa3ee('0x2b')]['describe']()[_0xa3ee('0x23')](respondWithResult(_0x15b55e,null))[_0xa3ee('0x42')](handleError(_0x15b55e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 9c0ad1a..9f58360 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4f6093,_0x3446a1){var _0x36ecf2=function(_0x49bde6){while(--_0x49bde6){_0x4f6093['push'](_0x4f6093['shift']());}};_0x36ecf2(++_0x3446a1);}(_0x7a54,0x106));var _0x47a5=function(_0x460948,_0x4d3677){_0x460948=_0x460948-0x0;var _0x28ace8=_0x7a54[_0x460948];return _0x28ace8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xe03697,_0x2ab613){var _0x198f59=function(_0x3f005f){while(--_0x3f005f){_0xe03697['push'](_0xe03697['shift']());}};_0x198f59(++_0x2ab613);}(_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 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 7dc07b8..b97f6ca 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 _0xff59=['info','request\x20sent','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2b44a1,_0xe7bc65){var _0x8bf442=function(_0x629c37){while(--_0x629c37){_0x2b44a1['push'](_0x2b44a1['shift']());}};_0x8bf442(++_0xe7bc65);}(_0xff59,0x104));var _0x9ff5=function(_0x5e4ef6,_0x421772){_0x5e4ef6=_0x5e4ef6-0x0;var _0x4e84ef=_0xff59[_0x5e4ef6];return _0x4e84ef;};'use strict';var _=require(_0x9ff5('0x0'));var util=require(_0x9ff5('0x1'));var moment=require(_0x9ff5('0x2'));var BPromise=require(_0x9ff5('0x3'));var rs=require(_0x9ff5('0x4'));var fs=require('fs');var Redis=require(_0x9ff5('0x5'));var db=require(_0x9ff5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9ff5('0x7'));var config=require(_0x9ff5('0x8'));var jayson=require(_0x9ff5('0x9'));var client=jayson['client'][_0x9ff5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a5b48,_0x4f36bf,_0x327447){return new BPromise(function(_0xcfa949,_0x33961f){return client[_0x9ff5('0xb')](_0x5a5b48,_0x327447)[_0x9ff5('0xc')](function(_0x3f04d5){logger[_0x9ff5('0xd')]('Cdr,\x20%s,\x20%s',_0x4f36bf,_0x9ff5('0xe'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x4f36bf,_0x9ff5('0xe'),JSON[_0x9ff5('0xf')](_0x3f04d5));if(_0x3f04d5[_0x9ff5('0x10')]){if(_0x3f04d5[_0x9ff5('0x10')][_0x9ff5('0x11')]===0x1f4){logger['error'](_0x9ff5('0x12'),_0x4f36bf,_0x3f04d5['error'][_0x9ff5('0x13')]);return _0x33961f(_0x3f04d5[_0x9ff5('0x10')][_0x9ff5('0x13')]);}logger['error'](_0x9ff5('0x12'),_0x4f36bf,_0x3f04d5[_0x9ff5('0x10')][_0x9ff5('0x13')]);return _0xcfa949(_0x3f04d5['error'][_0x9ff5('0x13')]);}else{logger[_0x9ff5('0xd')]('Cdr,\x20%s,\x20%s',_0x4f36bf,_0x9ff5('0xe'));_0xcfa949(_0x3f04d5[_0x9ff5('0x14')][_0x9ff5('0x13')]);}})['catch'](function(_0x272d27){logger[_0x9ff5('0x10')](_0x9ff5('0x12'),_0x4f36bf,_0x272d27);_0x33961f(_0x272d27);});});} \ No newline at end of file +var _0x558b=['http','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x31b5c1,_0x2dc3d8){var _0x66b16d=function(_0x18c83f){while(--_0x18c83f){_0x31b5c1['push'](_0x31b5c1['shift']());}};_0x66b16d(++_0x2dc3d8);}(_0x558b,0x1d9));var _0xb558=function(_0x1efb77,_0x17336f){_0x1efb77=_0x1efb77-0x0;var _0x571688=_0x558b[_0x1efb77];return _0x571688;};'use strict';var _=require(_0xb558('0x0'));var util=require(_0xb558('0x1'));var moment=require('moment');var BPromise=require(_0xb558('0x2'));var rs=require(_0xb558('0x3'));var fs=require('fs');var Redis=require(_0xb558('0x4'));var db=require(_0xb558('0x5'))['db'];var utils=require(_0xb558('0x6'));var logger=require(_0xb558('0x7'))('rpc');var config=require(_0xb558('0x8'));var jayson=require(_0xb558('0x9'));var client=jayson['client'][_0xb558('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2166ee,_0x3781dc,_0x7e425d){return new BPromise(function(_0x560d05,_0x59b759){return client[_0xb558('0xb')](_0x2166ee,_0x7e425d)[_0xb558('0xc')](function(_0x9a33f5){logger[_0xb558('0xd')](_0xb558('0xe'),_0x3781dc,'request\x20sent');logger[_0xb558('0xf')](_0xb558('0x10'),_0x3781dc,_0xb558('0x11'),JSON[_0xb558('0x12')](_0x9a33f5));if(_0x9a33f5[_0xb558('0x13')]){if(_0x9a33f5[_0xb558('0x13')][_0xb558('0x14')]===0x1f4){logger[_0xb558('0x13')](_0xb558('0xe'),_0x3781dc,_0x9a33f5[_0xb558('0x13')]['message']);return _0x59b759(_0x9a33f5[_0xb558('0x13')][_0xb558('0x15')]);}logger[_0xb558('0x13')](_0xb558('0xe'),_0x3781dc,_0x9a33f5[_0xb558('0x13')][_0xb558('0x15')]);return _0x560d05(_0x9a33f5['error'][_0xb558('0x15')]);}else{logger[_0xb558('0xd')](_0xb558('0xe'),_0x3781dc,_0xb558('0x11'));_0x560d05(_0x9a33f5['result'][_0xb558('0x15')]);}})[_0xb558('0x16')](function(_0x4302ab){logger[_0xb558('0x13')]('Cdr,\x20%s,\x20%s',_0x3781dc,_0x4302ab);_0x59b759(_0x4302ab);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 838de91..eff7cdc 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(_0x4d7c4f,_0x5e70d2){var _0x18c7e4=function(_0x3a528b){while(--_0x3a528b){_0x4d7c4f['push'](_0x4d7c4f['shift']());}};_0x18c7e4(++_0x5e70d2);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e8d3e,_0x18ed2e){_0x5e8d3e=_0x5e8d3e-0x0;var _0x1348c0=_0xb10b[_0x5e8d3e];return _0x1348c0;};'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 _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(_0x5a081d,_0x203cf6){var _0x25a8be=function(_0x1acccb){while(--_0x1acccb){_0x5a081d['push'](_0x5a081d['shift']());}};_0x25a8be(++_0x203cf6);}(_0xb10b,0x12a));var _0xbb10=function(_0x457299,_0xfba058){_0x457299=_0x457299-0x0;var _0x445d10=_0xb10b[_0x457299];return _0x445d10;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 1fe396c..13eed48 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 _0x9675=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x521277,_0x4d44e9){var _0x4b43a7=function(_0x29b080){while(--_0x29b080){_0x521277['push'](_0x521277['shift']());}};_0x4b43a7(++_0x4d44e9);}(_0x9675,0xb1));var _0x5967=function(_0x10e666,_0x15ceec){_0x10e666=_0x10e666-0x0;var _0x5add79=_0x9675[_0x10e666];return _0x5add79;};'use strict';var Sequelize=require(_0x5967('0x0'));module[_0x5967('0x1')]={'priority':{'type':Sequelize[_0x5967('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5967('0x3')],'allowNull':![],'defaultValue':_0x5967('0x4')},'appdata':{'type':Sequelize[_0x5967('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5967('0x3')],'defaultValue':_0x5967('0x6')}}; \ No newline at end of file +var _0xb46c=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x34a3b9,_0x32970e){var _0x116ae8=function(_0x19bd6c){while(--_0x19bd6c){_0x34a3b9['push'](_0x34a3b9['shift']());}};_0x116ae8(++_0x32970e);}(_0xb46c,0x17d));var _0xcb46=function(_0x114463,_0xbe6dd9){_0x114463=_0x114463-0x0;var _0x138c9a=_0xb46c[_0x114463];return _0x138c9a;};'use strict';var Sequelize=require(_0xcb46('0x0'));module['exports']={'priority':{'type':Sequelize[_0xcb46('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xcb46('0x2')],'allowNull':![],'defaultValue':_0xcb46('0x3')},'appdata':{'type':Sequelize[_0xcb46('0x4')]()},'description':{'type':Sequelize[_0xcb46('0x2')]},'interval':{'type':Sequelize[_0xcb46('0x2')],'defaultValue':_0xcb46('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 05bcccf..75ad846 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 _0x6a00=['filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query'];(function(_0x118f02,_0x3c79ef){var _0x377c83=function(_0x2a5db){while(--_0x2a5db){_0x118f02['push'](_0x118f02['shift']());}};_0x377c83(++_0x3c79ef);}(_0x6a00,0xc9));var _0x06a0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6a00[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x06a0('0x0'));var rimraf=require(_0x06a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06a0('0x2'));var rp=require(_0x06a0('0x3'));var moment=require(_0x06a0('0x4'));var BPromise=require(_0x06a0('0x5'));var Mustache=require(_0x06a0('0x6'));var util=require('util');var path=require('path');var sox=require(_0x06a0('0x7'));var csv=require(_0x06a0('0x8'));var ejs=require(_0x06a0('0x9'));var fs=require('fs');var fs_extra=require(_0x06a0('0xa'));var _=require(_0x06a0('0xb'));var squel=require(_0x06a0('0xc'));var crypto=require('crypto');var jsforce=require(_0x06a0('0xd'));var deskjs=require(_0x06a0('0xe'));var toCsv=require(_0x06a0('0x8'));var querystring=require(_0x06a0('0xf'));var Papa=require(_0x06a0('0x10'));var Redis=require(_0x06a0('0x11'));var authService=require(_0x06a0('0x12'));var qs=require(_0x06a0('0x13'));var as=require(_0x06a0('0x14'));var hardwareService=require(_0x06a0('0x15'));var logger=require(_0x06a0('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x06a0('0x17'));var licenseUtil=require(_0x06a0('0x18'));var db=require(_0x06a0('0x19'))['db'];function respondWithStatusCode(_0x1d2b7f,_0x688bf0){_0x688bf0=_0x688bf0||0xcc;return function(_0x177234){if(_0x177234){return _0x1d2b7f[_0x06a0('0x1a')](_0x688bf0);}return _0x1d2b7f[_0x06a0('0x1b')](_0x688bf0)['end']();};}function respondWithResult(_0x44c82a,_0x2d3f61){_0x2d3f61=_0x2d3f61||0xc8;return function(_0x26bba1){if(_0x26bba1){return _0x44c82a['status'](_0x2d3f61)[_0x06a0('0x1c')](_0x26bba1);}};}function respondWithFilteredResult(_0x2f694f,_0x363210){return function(_0x5560e3){if(_0x5560e3){var _0x4083e7=typeof _0x363210[_0x06a0('0x1d')]==='undefined'&&typeof _0x363210[_0x06a0('0x1e')]===_0x06a0('0x1f');var _0xacb02c=_0x5560e3[_0x06a0('0x20')];var _0x3d8836=_0x4083e7?0x0:_0x363210['offset'];var _0x3b6e74=_0x4083e7?_0x5560e3[_0x06a0('0x20')]:_0x363210[_0x06a0('0x1d')]+_0x363210[_0x06a0('0x1e')];var _0x3bce23;if(_0x3b6e74>=_0xacb02c){_0x3b6e74=_0xacb02c;_0x3bce23=0xc8;}else{_0x3bce23=0xce;}_0x2f694f[_0x06a0('0x1b')](_0x3bce23);return _0x2f694f[_0x06a0('0x21')](_0x06a0('0x22'),_0x3d8836+'-'+_0x3b6e74+'/'+_0xacb02c)[_0x06a0('0x1c')](_0x5560e3);}return null;};}function patchUpdates(_0x9772f5){return function(_0x52fc73){try{jsonpatch[_0x06a0('0x23')](_0x52fc73,_0x9772f5,!![]);}catch(_0x2b18b3){return BPromise[_0x06a0('0x24')](_0x2b18b3);}return _0x52fc73[_0x06a0('0x25')]();};}function saveUpdates(_0x422603,_0x304f8d){return function(_0x5b57d6){if(_0x5b57d6){return _0x5b57d6['update'](_0x422603)[_0x06a0('0x26')](function(_0x2ab1a2){return _0x2ab1a2;});}return null;};}function removeEntity(_0x4fc9a7,_0x151c35){return function(_0x1ae968){if(_0x1ae968){return _0x1ae968[_0x06a0('0x27')]()['then'](function(){_0x4fc9a7[_0x06a0('0x1b')](0xcc)[_0x06a0('0x28')]();});}};}function handleEntityNotFound(_0x4a7fff,_0x4a86ef){return function(_0x554064){if(!_0x554064){_0x4a7fff[_0x06a0('0x1a')](0x194);}return _0x554064;};}function handleError(_0x46efc2,_0x1ee00a){_0x1ee00a=_0x1ee00a||0x1f4;return function(_0x26f605){logger[_0x06a0('0x29')](_0x26f605[_0x06a0('0x2a')]);if(_0x26f605[_0x06a0('0x2b')]){delete _0x26f605[_0x06a0('0x2b')];}_0x46efc2[_0x06a0('0x1b')](_0x1ee00a)['send'](_0x26f605);};}exports[_0x06a0('0x2c')]=function(_0x49c8b0,_0xe26741){var _0x13d90={'raw':!![],'where':{'id':_0x49c8b0[_0x06a0('0x2d')]['id']}},_0x18b359={};_0x18b359[_0x06a0('0x2e')]=_[_0x06a0('0x2f')](db[_0x06a0('0x30')][_0x06a0('0x31')]);_0x18b359[_0x06a0('0x32')]=_['keys'](_0x49c8b0[_0x06a0('0x32')]);_0x18b359[_0x06a0('0x33')]=_[_0x06a0('0x34')](_0x18b359[_0x06a0('0x2e')],_0x18b359[_0x06a0('0x32')]);_0x13d90['attributes']=_[_0x06a0('0x34')](_0x18b359['model'],qs[_0x06a0('0x35')](_0x49c8b0[_0x06a0('0x32')]['fields']));_0x13d90['attributes']=_0x13d90[_0x06a0('0x36')][_0x06a0('0x37')]?_0x13d90[_0x06a0('0x36')]:_0x18b359[_0x06a0('0x2e')];if(_0x49c8b0['query'][_0x06a0('0x38')]){_0x13d90['include']=[{'all':!![]}];}_0x13d90=_[_0x06a0('0x39')]({},_0x13d90,_0x49c8b0[_0x06a0('0x3a')]);return db['ChatApplication'][_0x06a0('0x3b')](_0x13d90)[_0x06a0('0x26')](handleEntityNotFound(_0xe26741,null))['then'](respondWithResult(_0xe26741,null))[_0x06a0('0x3c')](handleError(_0xe26741,null));};exports[_0x06a0('0x3d')]=function(_0x5bd976,_0x5770b0){if(_0x5bd976[_0x06a0('0x3e')]['id']){delete _0x5bd976[_0x06a0('0x3e')]['id'];}return db['ChatApplication'][_0x06a0('0x3b')]({'where':{'id':_0x5bd976[_0x06a0('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5770b0,null))[_0x06a0('0x26')](saveUpdates(_0x5bd976[_0x06a0('0x3e')],null))[_0x06a0('0x26')](respondWithResult(_0x5770b0,null))[_0x06a0('0x3c')](handleError(_0x5770b0,null));};exports[_0x06a0('0x27')]=function(_0x49f689,_0x10d30a){return db[_0x06a0('0x30')]['find']({'where':{'id':_0x49f689[_0x06a0('0x2d')]['id']}})['then'](handleEntityNotFound(_0x10d30a,null))[_0x06a0('0x26')](removeEntity(_0x10d30a,null))[_0x06a0('0x3c')](handleError(_0x10d30a,null));}; \ No newline at end of file +var _0x6d4a=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','error','name','send','show','params','keys','ChatApplication','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','include','merge','catch','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x45f42e,_0x417bb){var _0x5704b6=function(_0x4d1621){while(--_0x4d1621){_0x45f42e['push'](_0x45f42e['shift']());}};_0x5704b6(++_0x417bb);}(_0x6d4a,0x117));var _0xa6d4=function(_0x4f7969,_0x3000a3){_0x4f7969=_0x4f7969-0x0;var _0xc01251=_0x6d4a[_0x4f7969];return _0xc01251;};'use strict';var emlformat=require(_0xa6d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6d4('0x1'));var jsonpatch=require(_0xa6d4('0x2'));var rp=require(_0xa6d4('0x3'));var moment=require(_0xa6d4('0x4'));var BPromise=require(_0xa6d4('0x5'));var Mustache=require(_0xa6d4('0x6'));var util=require(_0xa6d4('0x7'));var path=require(_0xa6d4('0x8'));var sox=require(_0xa6d4('0x9'));var csv=require(_0xa6d4('0xa'));var ejs=require(_0xa6d4('0xb'));var fs=require('fs');var fs_extra=require(_0xa6d4('0xc'));var _=require(_0xa6d4('0xd'));var squel=require(_0xa6d4('0xe'));var crypto=require('crypto');var jsforce=require(_0xa6d4('0xf'));var deskjs=require(_0xa6d4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa6d4('0x11'));var Papa=require(_0xa6d4('0x12'));var Redis=require(_0xa6d4('0x13'));var authService=require(_0xa6d4('0x14'));var qs=require(_0xa6d4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6d4('0x16'));var logger=require(_0xa6d4('0x17'))('api');var utils=require(_0xa6d4('0x18'));var config=require(_0xa6d4('0x19'));var licenseUtil=require(_0xa6d4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31ac95,_0x53b1c1){_0x53b1c1=_0x53b1c1||0xcc;return function(_0x23830f){if(_0x23830f){return _0x31ac95[_0xa6d4('0x1b')](_0x53b1c1);}return _0x31ac95['status'](_0x53b1c1)[_0xa6d4('0x1c')]();};}function respondWithResult(_0x101f40,_0x3a0d34){_0x3a0d34=_0x3a0d34||0xc8;return function(_0x9631de){if(_0x9631de){return _0x101f40[_0xa6d4('0x1d')](_0x3a0d34)[_0xa6d4('0x1e')](_0x9631de);}};}function respondWithFilteredResult(_0x2110d1,_0x3e714f){return function(_0x7420d8){if(_0x7420d8){var _0x17a926=typeof _0x3e714f[_0xa6d4('0x1f')]===_0xa6d4('0x20')&&typeof _0x3e714f['limit']===_0xa6d4('0x20');var _0x493077=_0x7420d8[_0xa6d4('0x21')];var _0x474b62=_0x17a926?0x0:_0x3e714f[_0xa6d4('0x1f')];var _0x4a7af1=_0x17a926?_0x7420d8[_0xa6d4('0x21')]:_0x3e714f[_0xa6d4('0x1f')]+_0x3e714f['limit'];var _0x3fa155;if(_0x4a7af1>=_0x493077){_0x4a7af1=_0x493077;_0x3fa155=0xc8;}else{_0x3fa155=0xce;}_0x2110d1[_0xa6d4('0x1d')](_0x3fa155);return _0x2110d1[_0xa6d4('0x22')](_0xa6d4('0x23'),_0x474b62+'-'+_0x4a7af1+'/'+_0x493077)[_0xa6d4('0x1e')](_0x7420d8);}return null;};}function patchUpdates(_0x5c40f5){return function(_0x3e0ae2){try{jsonpatch[_0xa6d4('0x24')](_0x3e0ae2,_0x5c40f5,!![]);}catch(_0xb7fbf9){return BPromise['reject'](_0xb7fbf9);}return _0x3e0ae2['save']();};}function saveUpdates(_0x3d98c2,_0x32bea3){return function(_0x46d32f){if(_0x46d32f){return _0x46d32f[_0xa6d4('0x25')](_0x3d98c2)[_0xa6d4('0x26')](function(_0x83abb5){return _0x83abb5;});}return null;};}function removeEntity(_0x4a744e,_0x1bf8cb){return function(_0xd4a69e){if(_0xd4a69e){return _0xd4a69e[_0xa6d4('0x27')]()[_0xa6d4('0x26')](function(){_0x4a744e[_0xa6d4('0x1d')](0xcc)[_0xa6d4('0x1c')]();});}};}function handleEntityNotFound(_0x4dca66,_0x3a3ed8){return function(_0x5589c5){if(!_0x5589c5){_0x4dca66[_0xa6d4('0x1b')](0x194);}return _0x5589c5;};}function handleError(_0x5928c9,_0x272759){_0x272759=_0x272759||0x1f4;return function(_0xf2f536){logger[_0xa6d4('0x28')](_0xf2f536['stack']);if(_0xf2f536[_0xa6d4('0x29')]){delete _0xf2f536[_0xa6d4('0x29')];}_0x5928c9['status'](_0x272759)[_0xa6d4('0x2a')](_0xf2f536);};}exports[_0xa6d4('0x2b')]=function(_0x501bd1,_0x581bae){var _0x44b967={'raw':!![],'where':{'id':_0x501bd1[_0xa6d4('0x2c')]['id']}},_0x378bf6={};_0x378bf6['model']=_[_0xa6d4('0x2d')](db[_0xa6d4('0x2e')][_0xa6d4('0x2f')]);_0x378bf6[_0xa6d4('0x30')]=_['keys'](_0x501bd1['query']);_0x378bf6['filters']=_[_0xa6d4('0x31')](_0x378bf6[_0xa6d4('0x32')],_0x378bf6[_0xa6d4('0x30')]);_0x44b967[_0xa6d4('0x33')]=_[_0xa6d4('0x31')](_0x378bf6[_0xa6d4('0x32')],qs[_0xa6d4('0x34')](_0x501bd1['query']['fields']));_0x44b967[_0xa6d4('0x33')]=_0x44b967[_0xa6d4('0x33')][_0xa6d4('0x35')]?_0x44b967[_0xa6d4('0x33')]:_0x378bf6[_0xa6d4('0x32')];if(_0x501bd1[_0xa6d4('0x30')][_0xa6d4('0x36')]){_0x44b967[_0xa6d4('0x37')]=[{'all':!![]}];}_0x44b967=_[_0xa6d4('0x38')]({},_0x44b967,_0x501bd1['options']);return db[_0xa6d4('0x2e')]['find'](_0x44b967)[_0xa6d4('0x26')](handleEntityNotFound(_0x581bae,null))[_0xa6d4('0x26')](respondWithResult(_0x581bae,null))[_0xa6d4('0x39')](handleError(_0x581bae,null));};exports[_0xa6d4('0x25')]=function(_0x3c9819,_0x3f3742){if(_0x3c9819[_0xa6d4('0x3a')]['id']){delete _0x3c9819['body']['id'];}return db['ChatApplication'][_0xa6d4('0x3b')]({'where':{'id':_0x3c9819[_0xa6d4('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3f3742,null))[_0xa6d4('0x26')](saveUpdates(_0x3c9819['body'],null))[_0xa6d4('0x26')](respondWithResult(_0x3f3742,null))[_0xa6d4('0x39')](handleError(_0x3f3742,null));};exports['destroy']=function(_0x5f0f00,_0x350ec4){return db[_0xa6d4('0x2e')]['find']({'where':{'id':_0x5f0f00[_0xa6d4('0x2c')]['id']}})[_0xa6d4('0x26')](handleEntityNotFound(_0x350ec4,null))[_0xa6d4('0x26')](removeEntity(_0x350ec4,null))[_0xa6d4('0x39')](handleError(_0x350ec4,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index fd440e9..f9d4477 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 _0xc72f=['chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','ChatApplication'];(function(_0x218956,_0x3cf682){var _0x33ba50=function(_0x1762ce){while(--_0x1762ce){_0x218956['push'](_0x218956['shift']());}};_0x33ba50(++_0x3cf682);}(_0xc72f,0x9e));var _0xfc72=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xc72f[_0x26f702];return _0x11417d;};'use strict';var _=require(_0xfc72('0x0'));var util=require(_0xfc72('0x1'));var logger=require(_0xfc72('0x2'))(_0xfc72('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc72('0x4'));var fs=require('fs');var path=require(_0xfc72('0x5'));var rimraf=require('rimraf');var config=require(_0xfc72('0x6'));var attributes=require('./chatApplication.attributes');module[_0xfc72('0x7')]=function(_0x466fb3,_0x2a19f0){return _0x466fb3[_0xfc72('0x8')](_0xfc72('0x9'),attributes,{'tableName':_0xfc72('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfc72('0xb')});}; \ No newline at end of file +var _0x5a08=['./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x5a08,0xc1));var _0x85a0=function(_0x15ff75,_0x42f7e0){_0x15ff75=_0x15ff75-0x0;var _0xac4237=_0x5a08[_0x15ff75];return _0xac4237;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x85a0('0x0'));var moment=require(_0x85a0('0x1'));var BPromise=require('bluebird');var rp=require(_0x85a0('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85a0('0x3'));var config=require(_0x85a0('0x4'));var attributes=require(_0x85a0('0x5'));module[_0x85a0('0x6')]=function(_0x2b1223,_0x541ec2){return _0x2b1223[_0x85a0('0x7')](_0x85a0('0x8'),attributes,{'tableName':_0x85a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x85a0('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index e809c3f..59cdb12 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 _0x84cf=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment'];(function(_0x4e5a22,_0x54599b){var _0x152e8d=function(_0x5964e5){while(--_0x5964e5){_0x4e5a22['push'](_0x4e5a22['shift']());}};_0x152e8d(++_0x54599b);}(_0x84cf,0xd9));var _0xf84c=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0x84cf[_0x1034ee];return _0x2922af;};'use strict';var _=require(_0xf84c('0x0'));var util=require(_0xf84c('0x1'));var moment=require(_0xf84c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf84c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf84c('0x4'));var logger=require(_0xf84c('0x5'))(_0xf84c('0x6'));var config=require(_0xf84c('0x7'));var jayson=require(_0xf84c('0x8'));var client=jayson[_0xf84c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5da053,_0x55558c,_0x58fdf5){return new BPromise(function(_0x365030,_0x5e15c1){return client['request'](_0x5da053,_0x58fdf5)[_0xf84c('0xa')](function(_0x305d57){logger[_0xf84c('0xb')](_0xf84c('0xc'),_0x55558c,_0xf84c('0xd'));logger[_0xf84c('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x55558c,_0xf84c('0xd'),JSON[_0xf84c('0xf')](_0x305d57));if(_0x305d57[_0xf84c('0x10')]){if(_0x305d57[_0xf84c('0x10')][_0xf84c('0x11')]===0x1f4){logger['error'](_0xf84c('0xc'),_0x55558c,_0x305d57['error'][_0xf84c('0x12')]);return _0x5e15c1(_0x305d57[_0xf84c('0x10')][_0xf84c('0x12')]);}logger[_0xf84c('0x10')]('ChatApplication,\x20%s,\x20%s',_0x55558c,_0x305d57[_0xf84c('0x10')][_0xf84c('0x12')]);return _0x365030(_0x305d57[_0xf84c('0x10')][_0xf84c('0x12')]);}else{logger[_0xf84c('0xb')](_0xf84c('0xc'),_0x55558c,_0xf84c('0xd'));_0x365030(_0x305d57[_0xf84c('0x13')]['message']);}})['catch'](function(_0x29ab77){logger[_0xf84c('0x10')]('ChatApplication,\x20%s,\x20%s',_0x55558c,_0x29ab77);_0x5e15c1(_0x29ab77);});});} \ No newline at end of file +var _0x842d=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x842d,0x175));var _0xd842=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0x842d[_0x3bf925];return _0x2128a1;};'use strict';var _=require('lodash');var util=require(_0xd842('0x0'));var moment=require(_0xd842('0x1'));var BPromise=require(_0xd842('0x2'));var rs=require(_0xd842('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd842('0x4'));var logger=require(_0xd842('0x5'))(_0xd842('0x6'));var config=require(_0xd842('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd842('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x704988,_0x5ad4ca,_0xd0e5d5){return new BPromise(function(_0x53e4c5,_0x3e5628){return client['request'](_0x704988,_0xd0e5d5)['then'](function(_0x13092d){logger[_0xd842('0x9')](_0xd842('0xa'),_0x5ad4ca,_0xd842('0xb'));logger[_0xd842('0xc')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x5ad4ca,'request\x20sent',JSON['stringify'](_0x13092d));if(_0x13092d[_0xd842('0xd')]){if(_0x13092d[_0xd842('0xd')][_0xd842('0xe')]===0x1f4){logger[_0xd842('0xd')](_0xd842('0xa'),_0x5ad4ca,_0x13092d[_0xd842('0xd')]['message']);return _0x3e5628(_0x13092d[_0xd842('0xd')]['message']);}logger[_0xd842('0xd')](_0xd842('0xa'),_0x5ad4ca,_0x13092d[_0xd842('0xd')]['message']);return _0x53e4c5(_0x13092d[_0xd842('0xd')]['message']);}else{logger[_0xd842('0x9')](_0xd842('0xa'),_0x5ad4ca,_0xd842('0xb'));_0x53e4c5(_0x13092d['result'][_0xd842('0xf')]);}})[_0xd842('0x10')](function(_0x1e70fe){logger[_0xd842('0xd')](_0xd842('0xa'),_0x5ad4ca,_0x1e70fe);_0x3e5628(_0x1e70fe);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 5065538..a8106fe 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 _0x2838=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','put','delete'];(function(_0x506a86,_0x41e1c9){var _0x5e1960=function(_0xbc7559){while(--_0xbc7559){_0x506a86['push'](_0x506a86['shift']());}};_0x5e1960(++_0x41e1c9);}(_0x2838,0x79));var _0x8283=function(_0xa087f5,_0x34fd10){_0xa087f5=_0xa087f5-0x0;var _0x4c8806=_0x2838[_0xa087f5];return _0x4c8806;};'use strict';var multer=require(_0x8283('0x0'));var util=require(_0x8283('0x1'));var path=require(_0x8283('0x2'));var timeout=require(_0x8283('0x3'));var express=require(_0x8283('0x4'));var router=express['Router']();var fs_extra=require(_0x8283('0x5'));var auth=require(_0x8283('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8283('0x7'));var controller=require(_0x8283('0x8'));router[_0x8283('0x9')](_0x8283('0xa'),auth[_0x8283('0xb')](),controller['show']);router[_0x8283('0xc')](_0x8283('0xa'),auth[_0x8283('0xb')](),controller['update']);router[_0x8283('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8283('0xe')]=router; \ No newline at end of file +var _0x9078=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x41ea62,_0x50e50d){var _0x35b5dd=function(_0xb3875e){while(--_0xb3875e){_0x41ea62['push'](_0x41ea62['shift']());}};_0x35b5dd(++_0x50e50d);}(_0x9078,0x171));var _0x8907=function(_0x34a1ea,_0x482eac){_0x34a1ea=_0x34a1ea-0x0;var _0x1f1f31=_0x9078[_0x34a1ea];return _0x1f1f31;};'use strict';var multer=require(_0x8907('0x0'));var util=require('util');var path=require(_0x8907('0x1'));var timeout=require(_0x8907('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8907('0x3'));var interaction=require(_0x8907('0x4'));var config=require(_0x8907('0x5'));var controller=require(_0x8907('0x6'));router[_0x8907('0x7')](_0x8907('0x8'),auth[_0x8907('0x9')](),controller[_0x8907('0xa')]);router[_0x8907('0xb')](_0x8907('0x8'),auth[_0x8907('0x9')](),controller[_0x8907('0xc')]);router['delete'](_0x8907('0x8'),auth['isAuthenticated'](),controller[_0x8907('0xd')]);module[_0x8907('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index ed0960b..12f72d5 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 _0xdc3c=['sequelize','STRING','BOOLEAN'];(function(_0x39afc1,_0x4db662){var _0x2f481f=function(_0x195ab3){while(--_0x195ab3){_0x39afc1['push'](_0x39afc1['shift']());}};_0x2f481f(++_0x4db662);}(_0xdc3c,0x147));var _0xcdc3=function(_0x5cbcb7,_0xb9ef49){_0x5cbcb7=_0x5cbcb7-0x0;var _0x50d1b1=_0xdc3c[_0x5cbcb7];return _0x50d1b1;};'use strict';var Sequelize=require(_0xcdc3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcdc3('0x1')]},'write':{'type':Sequelize[_0xcdc3('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7d2a=['sequelize','STRING','BOOLEAN'];(function(_0x573388,_0x207933){var _0x2e6ba8=function(_0x3223f9){while(--_0x3223f9){_0x573388['push'](_0x573388['shift']());}};_0x2e6ba8(++_0x207933);}(_0x7d2a,0x171));var _0xa7d2=function(_0x673c06,_0x18fccd){_0x673c06=_0x673c06-0x0;var _0x43f7b9=_0x7d2a[_0x673c06];return _0x43f7b9;};'use strict';var Sequelize=require(_0xa7d2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa7d2('0x1')]},'write':{'type':Sequelize[_0xa7d2('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index bb20c4c..e0bb3b4 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 _0xf599=['rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','create','body','update','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','sort','pick','removeMembers','addMessage','ChatGroupId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','count','limit','Content-Range','apply','then','destroy','sendStatus','stack','name','send','index','map','ChatGroup'];(function(_0x2b44d5,_0x1f35c8){var _0x5be7a1=function(_0x418581){while(--_0x418581){_0x2b44d5['push'](_0x2b44d5['shift']());}};_0x5be7a1(++_0x1f35c8);}(_0xf599,0x95));var _0x9f59=function(_0x517fa8,_0x3adce0){_0x517fa8=_0x517fa8-0x0;var _0x5409f4=_0xf599[_0x517fa8];return _0x5409f4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9f59('0x0'));var jsonpatch=require(_0x9f59('0x1'));var rp=require(_0x9f59('0x2'));var moment=require(_0x9f59('0x3'));var BPromise=require(_0x9f59('0x4'));var Mustache=require(_0x9f59('0x5'));var util=require(_0x9f59('0x6'));var path=require(_0x9f59('0x7'));var sox=require(_0x9f59('0x8'));var csv=require('to-csv');var ejs=require(_0x9f59('0x9'));var fs=require('fs');var fs_extra=require(_0x9f59('0xa'));var _=require(_0x9f59('0xb'));var squel=require(_0x9f59('0xc'));var crypto=require('crypto');var jsforce=require(_0x9f59('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9f59('0xe'));var querystring=require(_0x9f59('0xf'));var Papa=require(_0x9f59('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9f59('0x11'));var hardwareService=require(_0x9f59('0x12'));var logger=require('../../config/logger')(_0x9f59('0x13'));var utils=require(_0x9f59('0x14'));var config=require(_0x9f59('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f59('0x16'))['db'];config[_0x9f59('0x17')]=_[_0x9f59('0x18')](config[_0x9f59('0x17')],{'host':_0x9f59('0x19'),'port':0x18eb});var socket=require(_0x9f59('0x1a'))(new Redis(config[_0x9f59('0x17')]));require(_0x9f59('0x1b'))[_0x9f59('0x1c')](socket);function respondWithStatusCode(_0x3d8c12,_0x4f99f1){_0x4f99f1=_0x4f99f1||0xcc;return function(_0x30d1c2){if(_0x30d1c2){return _0x3d8c12['sendStatus'](_0x4f99f1);}return _0x3d8c12[_0x9f59('0x1d')](_0x4f99f1)[_0x9f59('0x1e')]();};}function respondWithResult(_0x5a8f4,_0x9f9af0){_0x9f9af0=_0x9f9af0||0xc8;return function(_0x488bcb){if(_0x488bcb){return _0x5a8f4['status'](_0x9f9af0)[_0x9f59('0x1f')](_0x488bcb);}};}function respondWithFilteredResult(_0x10b3fd,_0x8ad080){return function(_0x25f631){if(_0x25f631){var _0x4a5b4b=typeof _0x8ad080[_0x9f59('0x20')]===_0x9f59('0x21')&&typeof _0x8ad080['limit']===_0x9f59('0x21');var _0x135ba0=_0x25f631[_0x9f59('0x22')];var _0x502dd8=_0x4a5b4b?0x0:_0x8ad080[_0x9f59('0x20')];var _0x5955ac=_0x4a5b4b?_0x25f631[_0x9f59('0x22')]:_0x8ad080[_0x9f59('0x20')]+_0x8ad080[_0x9f59('0x23')];var _0x24cab9;if(_0x5955ac>=_0x135ba0){_0x5955ac=_0x135ba0;_0x24cab9=0xc8;}else{_0x24cab9=0xce;}_0x10b3fd[_0x9f59('0x1d')](_0x24cab9);return _0x10b3fd['set'](_0x9f59('0x24'),_0x502dd8+'-'+_0x5955ac+'/'+_0x135ba0)[_0x9f59('0x1f')](_0x25f631);}return null;};}function patchUpdates(_0x4e59e8){return function(_0x1eecda){try{jsonpatch[_0x9f59('0x25')](_0x1eecda,_0x4e59e8,!![]);}catch(_0x2a4552){return BPromise['reject'](_0x2a4552);}return _0x1eecda['save']();};}function saveUpdates(_0x5b9b24,_0xc66965){return function(_0xfb570d){if(_0xfb570d){return _0xfb570d['update'](_0x5b9b24)[_0x9f59('0x26')](function(_0x335032){return _0x335032;});}return null;};}function removeEntity(_0x2fb303,_0x4a0474){return function(_0x1918d5){if(_0x1918d5){return _0x1918d5[_0x9f59('0x27')]()[_0x9f59('0x26')](function(){_0x2fb303['status'](0xcc)[_0x9f59('0x1e')]();});}};}function handleEntityNotFound(_0x248e4b,_0x4eeba7){return function(_0x233dc7){if(!_0x233dc7){_0x248e4b[_0x9f59('0x28')](0x194);}return _0x233dc7;};}function handleError(_0x16ee31,_0x2d2381){_0x2d2381=_0x2d2381||0x1f4;return function(_0x26bf37){logger['error'](_0x26bf37[_0x9f59('0x29')]);if(_0x26bf37['name']){delete _0x26bf37[_0x9f59('0x2a')];}_0x16ee31[_0x9f59('0x1d')](_0x2d2381)[_0x9f59('0x2b')](_0x26bf37);};}exports[_0x9f59('0x2c')]=function(_0x4e4a01,_0x136965){var _0xcf2689={},_0x4d928e={},_0x25e3dd={'count':0x0,'rows':[]};var _0x564724=_[_0x9f59('0x2d')](db[_0x9f59('0x2e')][_0x9f59('0x2f')],function(_0x440d29){return{'name':_0x440d29[_0x9f59('0x30')],'type':_0x440d29['type'][_0x9f59('0x31')]};});_0x4d928e[_0x9f59('0x32')]=_[_0x9f59('0x2d')](_0x564724,_0x9f59('0x2a'));_0x4d928e[_0x9f59('0x33')]=_['keys'](_0x4e4a01[_0x9f59('0x33')]);_0x4d928e[_0x9f59('0x34')]=_[_0x9f59('0x35')](_0x4d928e[_0x9f59('0x32')],_0x4d928e['query']);_0xcf2689[_0x9f59('0x36')]=_['intersection'](_0x4d928e[_0x9f59('0x32')],qs['fields'](_0x4e4a01['query']['fields']));_0xcf2689['attributes']=_0xcf2689[_0x9f59('0x36')][_0x9f59('0x37')]?_0xcf2689['attributes']:_0x4d928e[_0x9f59('0x32')];if(!_0x4e4a01[_0x9f59('0x33')][_0x9f59('0x38')](_0x9f59('0x39'))){_0xcf2689[_0x9f59('0x23')]=qs[_0x9f59('0x23')](_0x4e4a01[_0x9f59('0x33')]['limit']);_0xcf2689[_0x9f59('0x20')]=qs['offset'](_0x4e4a01[_0x9f59('0x33')]['offset']);}_0xcf2689[_0x9f59('0x3a')]=qs['sort'](_0x4e4a01['query']['sort']);_0xcf2689[_0x9f59('0x3b')]=qs[_0x9f59('0x34')](_['pick'](_0x4e4a01[_0x9f59('0x33')],_0x4d928e['filters']),_0x564724);if(_0x4e4a01['query'][_0x9f59('0x3c')]){_0xcf2689['where']=_['merge'](_0xcf2689['where'],{'$or':_['map'](_0x564724,function(_0x433220){if(_0x433220[_0x9f59('0x3d')]!==_0x9f59('0x3e')){var _0x24dcb5={};_0x24dcb5[_0x433220[_0x9f59('0x2a')]]={'$like':'%'+_0x4e4a01[_0x9f59('0x33')][_0x9f59('0x3c')]+'%'};return _0x24dcb5;}})});}_0xcf2689=_[_0x9f59('0x3f')]({},_0xcf2689,_0x4e4a01[_0x9f59('0x40')]);var _0x14142a={'where':_0xcf2689[_0x9f59('0x3b')]};return db[_0x9f59('0x2e')]['count'](_0x14142a)['then'](function(_0x4821ff){_0x25e3dd['count']=_0x4821ff;if(_0x4e4a01[_0x9f59('0x33')][_0x9f59('0x41')]){_0xcf2689[_0x9f59('0x42')]=[{'all':!![]}];}return db['ChatGroup'][_0x9f59('0x43')](_0xcf2689);})[_0x9f59('0x26')](function(_0x57bdeb){_0x25e3dd[_0x9f59('0x44')]=_0x57bdeb;return _0x25e3dd;})[_0x9f59('0x26')](respondWithFilteredResult(_0x136965,_0xcf2689))[_0x9f59('0x45')](handleError(_0x136965,null));};exports[_0x9f59('0x46')]=function(_0x6c34da,_0xa34972){var _0x514bf9={'raw':!![],'where':{'id':_0x6c34da[_0x9f59('0x47')]['id']}},_0x5298c9={};_0x5298c9['model']=_['keys'](db[_0x9f59('0x2e')][_0x9f59('0x2f')]);_0x5298c9[_0x9f59('0x33')]=_[_0x9f59('0x48')](_0x6c34da[_0x9f59('0x33')]);_0x5298c9[_0x9f59('0x34')]=_[_0x9f59('0x35')](_0x5298c9[_0x9f59('0x32')],_0x5298c9['query']);_0x514bf9[_0x9f59('0x36')]=_[_0x9f59('0x35')](_0x5298c9[_0x9f59('0x32')],qs[_0x9f59('0x49')](_0x6c34da[_0x9f59('0x33')]['fields']));_0x514bf9['attributes']=_0x514bf9[_0x9f59('0x36')]['length']?_0x514bf9[_0x9f59('0x36')]:_0x5298c9[_0x9f59('0x32')];if(_0x6c34da[_0x9f59('0x33')][_0x9f59('0x41')]){_0x514bf9[_0x9f59('0x42')]=[{'all':!![]}];}_0x514bf9=_[_0x9f59('0x3f')]({},_0x514bf9,_0x6c34da[_0x9f59('0x40')]);return db[_0x9f59('0x2e')]['find'](_0x514bf9)[_0x9f59('0x26')](handleEntityNotFound(_0xa34972,null))[_0x9f59('0x26')](respondWithResult(_0xa34972,null))[_0x9f59('0x45')](handleError(_0xa34972,null));};exports[_0x9f59('0x4a')]=function(_0x4a50da,_0x473923){return db[_0x9f59('0x2e')]['create'](_0x4a50da[_0x9f59('0x4b')],{})[_0x9f59('0x26')](respondWithResult(_0x473923,0xc9))[_0x9f59('0x45')](handleError(_0x473923,null));};exports[_0x9f59('0x4c')]=function(_0x124851,_0x45f852){if(_0x124851[_0x9f59('0x4b')]['id']){delete _0x124851[_0x9f59('0x4b')]['id'];}return db[_0x9f59('0x2e')]['find']({'where':{'id':_0x124851['params']['id']}})[_0x9f59('0x26')](handleEntityNotFound(_0x45f852,null))[_0x9f59('0x26')](saveUpdates(_0x124851[_0x9f59('0x4b')],null))['then'](respondWithResult(_0x45f852,null))[_0x9f59('0x45')](handleError(_0x45f852,null));};exports[_0x9f59('0x27')]=function(_0x1e4907,_0x3e1d38){return db[_0x9f59('0x2e')][_0x9f59('0x4d')]({'where':{'id':_0x1e4907[_0x9f59('0x47')]['id']}})[_0x9f59('0x26')](handleEntityNotFound(_0x3e1d38,null))['then'](removeEntity(_0x3e1d38,null))['catch'](handleError(_0x3e1d38,null));};exports[_0x9f59('0x4e')]=function(_0x94a042,_0x3d030f){return db[_0x9f59('0x2e')]['describe']()[_0x9f59('0x26')](respondWithResult(_0x3d030f,null))[_0x9f59('0x45')](handleError(_0x3d030f,null));};exports[_0x9f59('0x4f')]=function(_0x324342,_0x331f0d,_0x3cc3e9){return db[_0x9f59('0x50')][_0x9f59('0x22')]({'where':{'ChatGroupId':_0x324342[_0x9f59('0x47')]['id'],'ToId':_0x324342[_0x9f59('0x51')]['id'],'read':![]}})['then'](function(_0x46f20c){return{'id':_[_0x9f59('0x52')](_0x324342['params']['id']),'count':_0x46f20c};})[_0x9f59('0x26')](respondWithResult(_0x331f0d,null))[_0x9f59('0x45')](handleError(_0x331f0d,null));};exports[_0x9f59('0x53')]=function(_0x2750bf,_0x19b543,_0x2db2aa){return db[_0x9f59('0x2e')][_0x9f59('0x4d')]({'where':{'id':_0x2750bf['params']['id']}})[_0x9f59('0x26')](handleEntityNotFound(_0x19b543,null))[_0x9f59('0x26')](function(_0x2fe438){if(_0x2fe438){return _0x2fe438['addMembers'](_0x2750bf[_0x9f59('0x4b')][_0x9f59('0x54')],_[_0x9f59('0x55')](_0x2750bf[_0x9f59('0x4b')],['ids','id'])||{});}})['then'](respondWithResult(_0x19b543,null))[_0x9f59('0x45')](handleError(_0x19b543,null));};exports[_0x9f59('0x56')]=function(_0x132c84,_0x18f73b,_0x3fc44d){var _0x2c4671={};var _0x379f06={};var _0x18cf88;var _0x30cdb4;return db['ChatGroup'][_0x9f59('0x57')]({'where':{'id':_0x132c84[_0x9f59('0x47')]['id']}})['then'](handleEntityNotFound(_0x18f73b,null))[_0x9f59('0x26')](function(_0x2ec5b6){if(_0x2ec5b6){_0x18cf88=_0x2ec5b6;_0x379f06[_0x9f59('0x32')]=_[_0x9f59('0x48')](db[_0x9f59('0x58')][_0x9f59('0x2f')]);_0x379f06[_0x9f59('0x33')]=_[_0x9f59('0x48')](_0x132c84[_0x9f59('0x33')]);_0x379f06[_0x9f59('0x34')]=_[_0x9f59('0x35')](_0x379f06[_0x9f59('0x32')],_0x379f06[_0x9f59('0x33')]);_0x2c4671['attributes']=_[_0x9f59('0x35')](_0x379f06[_0x9f59('0x32')],qs[_0x9f59('0x49')](_0x132c84[_0x9f59('0x33')][_0x9f59('0x49')]));_0x2c4671['attributes']=_0x2c4671[_0x9f59('0x36')][_0x9f59('0x37')]?_0x2c4671[_0x9f59('0x36')]:_0x379f06[_0x9f59('0x32')];_0x2c4671[_0x9f59('0x3a')]=qs[_0x9f59('0x59')](_0x132c84[_0x9f59('0x33')]['sort']);_0x2c4671[_0x9f59('0x3b')]=qs[_0x9f59('0x34')](_[_0x9f59('0x5a')](_0x132c84[_0x9f59('0x33')],_0x379f06['filters']));if(_0x132c84['query'][_0x9f59('0x3c')]){_0x2c4671[_0x9f59('0x3b')]=_['merge'](_0x2c4671[_0x9f59('0x3b')],{'$or':_[_0x9f59('0x2d')](_0x2c4671[_0x9f59('0x36')],function(_0xcce9eb){var _0xe2345e={};_0xe2345e[_0xcce9eb]={'$like':'%'+_0x132c84[_0x9f59('0x33')][_0x9f59('0x3c')]+'%'};return _0xe2345e;})});}_0x2c4671=_[_0x9f59('0x3f')]({},_0x2c4671,_0x132c84[_0x9f59('0x40')]);return _0x18cf88['getMembers'](_0x2c4671);}})['then'](function(_0x4e00c6){if(_0x4e00c6){_0x30cdb4=_0x4e00c6[_0x9f59('0x37')];if(!_0x132c84[_0x9f59('0x33')][_0x9f59('0x38')](_0x9f59('0x39'))){_0x2c4671[_0x9f59('0x23')]=qs['limit'](_0x132c84['query'][_0x9f59('0x23')]);_0x2c4671[_0x9f59('0x20')]=qs[_0x9f59('0x20')](_0x132c84[_0x9f59('0x33')][_0x9f59('0x20')]);}return _0x18cf88['getMembers'](_0x2c4671);}})[_0x9f59('0x26')](function(_0x29cafc){if(_0x29cafc){return _0x29cafc?{'count':_0x30cdb4,'rows':_0x29cafc}:null;}})[_0x9f59('0x26')](respondWithResult(_0x18f73b,null))['catch'](handleError(_0x18f73b,null));};exports[_0x9f59('0x5b')]=function(_0x2e9432,_0x1b44ff,_0x292331){return db[_0x9f59('0x2e')][_0x9f59('0x4d')]({'where':{'id':_0x2e9432[_0x9f59('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b44ff,null))[_0x9f59('0x26')](function(_0x53d596){if(_0x53d596){return _0x53d596['removeMembers'](_0x2e9432[_0x9f59('0x33')]['ids']);}})[_0x9f59('0x26')](respondWithStatusCode(_0x1b44ff,null))['catch'](handleError(_0x1b44ff,null));};exports[_0x9f59('0x5c')]=function(_0x1024de,_0x587e68,_0x293a56){if(_0x1024de[_0x9f59('0x4b')]['id']){delete _0x1024de['body']['id'];}return db['ChatGroup']['find']({'where':{'id':_0x1024de[_0x9f59('0x47')]['id']}})['then'](handleEntityNotFound(_0x587e68,null))[_0x9f59('0x26')](function(_0x340947){if(_0x340947){_0x1024de[_0x9f59('0x4b')][_0x9f59('0x5d')]=_0x340947['id'];return db[_0x9f59('0x50')]['create'](_0x1024de[_0x9f59('0x4b')]);}})[_0x9f59('0x26')](respondWithResult(_0x587e68,null))[_0x9f59('0x45')](handleError(_0x587e68,null));};exports['getMessages']=function(_0x5c6832,_0x4c7bbd,_0x47860e){var _0x52259a={};var _0x43074e={};var _0x114005;var _0x5bae34;return db[_0x9f59('0x2e')][_0x9f59('0x57')]({'where':{'id':_0x5c6832[_0x9f59('0x47')]['id']}})[_0x9f59('0x26')](handleEntityNotFound(_0x4c7bbd,null))[_0x9f59('0x26')](function(_0x5c051c){if(_0x5c051c){_0x114005=_0x5c051c;_0x43074e[_0x9f59('0x32')]=_[_0x9f59('0x48')](db[_0x9f59('0x50')]['rawAttributes']);_0x43074e[_0x9f59('0x33')]=_[_0x9f59('0x48')](_0x5c6832['query']);_0x43074e[_0x9f59('0x34')]=_['intersection'](_0x43074e['model'],_0x43074e[_0x9f59('0x33')]);_0x52259a[_0x9f59('0x36')]=_[_0x9f59('0x35')](_0x43074e[_0x9f59('0x32')],qs[_0x9f59('0x49')](_0x5c6832[_0x9f59('0x33')]['fields']));_0x52259a['attributes']=_0x52259a[_0x9f59('0x36')][_0x9f59('0x37')]?_0x52259a['attributes']:_0x43074e[_0x9f59('0x32')];_0x52259a[_0x9f59('0x3a')]=qs[_0x9f59('0x59')](_0x5c6832[_0x9f59('0x33')][_0x9f59('0x59')]);_0x52259a[_0x9f59('0x3b')]=qs[_0x9f59('0x34')](_[_0x9f59('0x5a')](_0x5c6832[_0x9f59('0x33')],_0x43074e[_0x9f59('0x34')]));if(_0x5c6832[_0x9f59('0x33')][_0x9f59('0x3c')]){_0x52259a[_0x9f59('0x3b')]=_['merge'](_0x52259a[_0x9f59('0x3b')],{'$or':_[_0x9f59('0x2d')](_0x52259a[_0x9f59('0x36')],function(_0x266d34){var _0x548ff8={};_0x548ff8[_0x266d34]={'$like':'%'+_0x5c6832[_0x9f59('0x33')][_0x9f59('0x3c')]+'%'};return _0x548ff8;})});}if(_0x5c6832[_0x9f59('0x33')][_0x9f59('0x5e')]){var _0x28f6b3=_0x5c6832['query'][_0x9f59('0x5e')]['split'](',');var _0x1fee5a={};_0x1fee5a[_0x28f6b3[0x0]]={'$gte':moment(_0x28f6b3[0x1])[_0x9f59('0x5f')](_0x9f59('0x60'))};_0x52259a[_0x9f59('0x3b')]=_[_0x9f59('0x3f')](_0x52259a[_0x9f59('0x3b')],_0x1fee5a);}_0x52259a=_[_0x9f59('0x3f')]({},_0x52259a,_0x5c6832[_0x9f59('0x40')]);return _0x114005[_0x9f59('0x61')](_0x52259a);}})[_0x9f59('0x26')](function(_0x46be9b){if(_0x46be9b){_0x5bae34=_0x46be9b['length'];if(!_0x5c6832['query'][_0x9f59('0x38')](_0x9f59('0x39'))){_0x52259a[_0x9f59('0x23')]=qs[_0x9f59('0x23')](_0x5c6832[_0x9f59('0x33')][_0x9f59('0x23')]);_0x52259a['offset']=qs['offset'](_0x5c6832[_0x9f59('0x33')][_0x9f59('0x20')]);}return _0x114005[_0x9f59('0x61')](_0x52259a);}})[_0x9f59('0x26')](function(_0xb4c4c9){if(_0xb4c4c9){return _0xb4c4c9?{'count':_0x5bae34,'rows':_0xb4c4c9}:null;}})[_0x9f59('0x26')](respondWithResult(_0x4c7bbd,null))['catch'](handleError(_0x4c7bbd,null));}; \ No newline at end of file +var _0xf701=['type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','rows','show','params','length','includeAll','find','catch','create','body','destroy','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','stack','name','index','map','ChatGroup','rawAttributes','fieldName'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xf701,0x19f));var _0x1f70=function(_0x5223b6,_0x2fe258){_0x5223b6=_0x5223b6-0x0;var _0x43b77d=_0xf701[_0x5223b6];return _0x43b77d;};'use strict';var emlformat=require(_0x1f70('0x0'));var rimraf=require(_0x1f70('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1f70('0x2'));var moment=require(_0x1f70('0x3'));var BPromise=require(_0x1f70('0x4'));var Mustache=require(_0x1f70('0x5'));var util=require(_0x1f70('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f70('0x7'));var fs=require('fs');var fs_extra=require(_0x1f70('0x8'));var _=require('lodash');var squel=require(_0x1f70('0x9'));var crypto=require(_0x1f70('0xa'));var jsforce=require(_0x1f70('0xb'));var deskjs=require(_0x1f70('0xc'));var toCsv=require(_0x1f70('0xd'));var querystring=require(_0x1f70('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1f70('0xf'));var hardwareService=require(_0x1f70('0x10'));var logger=require(_0x1f70('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x1f70('0x12'));var licenseUtil=require(_0x1f70('0x13'));var db=require(_0x1f70('0x14'))['db'];config[_0x1f70('0x15')]=_[_0x1f70('0x16')](config[_0x1f70('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f70('0x17'))(new Redis(config[_0x1f70('0x15')]));require(_0x1f70('0x18'))[_0x1f70('0x19')](socket);function respondWithStatusCode(_0x118954,_0x546830){_0x546830=_0x546830||0xcc;return function(_0x14f6f4){if(_0x14f6f4){return _0x118954[_0x1f70('0x1a')](_0x546830);}return _0x118954[_0x1f70('0x1b')](_0x546830)[_0x1f70('0x1c')]();};}function respondWithResult(_0x1fc0f4,_0x3c1fc2){_0x3c1fc2=_0x3c1fc2||0xc8;return function(_0x36d55f){if(_0x36d55f){return _0x1fc0f4[_0x1f70('0x1b')](_0x3c1fc2)[_0x1f70('0x1d')](_0x36d55f);}};}function respondWithFilteredResult(_0x709c8e,_0xac5a64){return function(_0x15ef87){if(_0x15ef87){var _0x468622=typeof _0xac5a64[_0x1f70('0x1e')]==='undefined'&&typeof _0xac5a64['limit']==='undefined';var _0x3479f2=_0x15ef87['count'];var _0x5e517a=_0x468622?0x0:_0xac5a64[_0x1f70('0x1e')];var _0x3ff1f8=_0x468622?_0x15ef87['count']:_0xac5a64['offset']+_0xac5a64[_0x1f70('0x1f')];var _0x3edc65;if(_0x3ff1f8>=_0x3479f2){_0x3ff1f8=_0x3479f2;_0x3edc65=0xc8;}else{_0x3edc65=0xce;}_0x709c8e[_0x1f70('0x1b')](_0x3edc65);return _0x709c8e[_0x1f70('0x20')](_0x1f70('0x21'),_0x5e517a+'-'+_0x3ff1f8+'/'+_0x3479f2)[_0x1f70('0x1d')](_0x15ef87);}return null;};}function patchUpdates(_0x4778fa){return function(_0x2a95c9){try{jsonpatch['apply'](_0x2a95c9,_0x4778fa,!![]);}catch(_0x4fd946){return BPromise[_0x1f70('0x22')](_0x4fd946);}return _0x2a95c9[_0x1f70('0x23')]();};}function saveUpdates(_0x12d71e,_0x1490b2){return function(_0x37ff10){if(_0x37ff10){return _0x37ff10[_0x1f70('0x24')](_0x12d71e)[_0x1f70('0x25')](function(_0x31d334){return _0x31d334;});}return null;};}function removeEntity(_0x1d8f75,_0x18b74c){return function(_0x540aba){if(_0x540aba){return _0x540aba['destroy']()['then'](function(){_0x1d8f75[_0x1f70('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13b9bd,_0x5e4b7d){return function(_0x3588b0){if(!_0x3588b0){_0x13b9bd[_0x1f70('0x1a')](0x194);}return _0x3588b0;};}function handleError(_0x45f263,_0x683eed){_0x683eed=_0x683eed||0x1f4;return function(_0x3a5ea6){logger['error'](_0x3a5ea6[_0x1f70('0x26')]);if(_0x3a5ea6[_0x1f70('0x27')]){delete _0x3a5ea6[_0x1f70('0x27')];}_0x45f263['status'](_0x683eed)['send'](_0x3a5ea6);};}exports[_0x1f70('0x28')]=function(_0x3ae24c,_0x1c9bf9){var _0x14434c={},_0x3035e0={},_0x199d43={'count':0x0,'rows':[]};var _0x3e3de1=_[_0x1f70('0x29')](db[_0x1f70('0x2a')][_0x1f70('0x2b')],function(_0x5469b5){return{'name':_0x5469b5[_0x1f70('0x2c')],'type':_0x5469b5[_0x1f70('0x2d')][_0x1f70('0x2e')]};});_0x3035e0['model']=_[_0x1f70('0x29')](_0x3e3de1,_0x1f70('0x27'));_0x3035e0[_0x1f70('0x2f')]=_[_0x1f70('0x30')](_0x3ae24c[_0x1f70('0x2f')]);_0x3035e0[_0x1f70('0x31')]=_[_0x1f70('0x32')](_0x3035e0[_0x1f70('0x33')],_0x3035e0['query']);_0x14434c[_0x1f70('0x34')]=_[_0x1f70('0x32')](_0x3035e0['model'],qs[_0x1f70('0x35')](_0x3ae24c[_0x1f70('0x2f')][_0x1f70('0x35')]));_0x14434c[_0x1f70('0x34')]=_0x14434c[_0x1f70('0x34')]['length']?_0x14434c[_0x1f70('0x34')]:_0x3035e0['model'];if(!_0x3ae24c['query'][_0x1f70('0x36')](_0x1f70('0x37'))){_0x14434c[_0x1f70('0x1f')]=qs[_0x1f70('0x1f')](_0x3ae24c[_0x1f70('0x2f')][_0x1f70('0x1f')]);_0x14434c[_0x1f70('0x1e')]=qs[_0x1f70('0x1e')](_0x3ae24c[_0x1f70('0x2f')][_0x1f70('0x1e')]);}_0x14434c[_0x1f70('0x38')]=qs[_0x1f70('0x39')](_0x3ae24c['query'][_0x1f70('0x39')]);_0x14434c[_0x1f70('0x3a')]=qs[_0x1f70('0x31')](_[_0x1f70('0x3b')](_0x3ae24c[_0x1f70('0x2f')],_0x3035e0[_0x1f70('0x31')]),_0x3e3de1);if(_0x3ae24c['query'][_0x1f70('0x3c')]){_0x14434c['where']=_[_0x1f70('0x3d')](_0x14434c[_0x1f70('0x3a')],{'$or':_['map'](_0x3e3de1,function(_0x3d730c){if(_0x3d730c[_0x1f70('0x2d')]!==_0x1f70('0x3e')){var _0x43688b={};_0x43688b[_0x3d730c[_0x1f70('0x27')]]={'$like':'%'+_0x3ae24c[_0x1f70('0x2f')]['filter']+'%'};return _0x43688b;}})});}_0x14434c=_[_0x1f70('0x3d')]({},_0x14434c,_0x3ae24c[_0x1f70('0x3f')]);var _0x147b70={'where':_0x14434c['where']};return db[_0x1f70('0x2a')][_0x1f70('0x40')](_0x147b70)[_0x1f70('0x25')](function(_0x119022){_0x199d43['count']=_0x119022;if(_0x3ae24c[_0x1f70('0x2f')]['includeAll']){_0x14434c[_0x1f70('0x41')]=[{'all':!![]}];}return db[_0x1f70('0x2a')]['findAll'](_0x14434c);})[_0x1f70('0x25')](function(_0x20721b){_0x199d43[_0x1f70('0x42')]=_0x20721b;return _0x199d43;})[_0x1f70('0x25')](respondWithFilteredResult(_0x1c9bf9,_0x14434c))['catch'](handleError(_0x1c9bf9,null));};exports[_0x1f70('0x43')]=function(_0x50b063,_0x46eb24){var _0x2e442a={'raw':!![],'where':{'id':_0x50b063[_0x1f70('0x44')]['id']}},_0x38d679={};_0x38d679[_0x1f70('0x33')]=_[_0x1f70('0x30')](db['ChatGroup'][_0x1f70('0x2b')]);_0x38d679[_0x1f70('0x2f')]=_[_0x1f70('0x30')](_0x50b063['query']);_0x38d679[_0x1f70('0x31')]=_[_0x1f70('0x32')](_0x38d679['model'],_0x38d679[_0x1f70('0x2f')]);_0x2e442a['attributes']=_[_0x1f70('0x32')](_0x38d679[_0x1f70('0x33')],qs['fields'](_0x50b063[_0x1f70('0x2f')][_0x1f70('0x35')]));_0x2e442a[_0x1f70('0x34')]=_0x2e442a[_0x1f70('0x34')][_0x1f70('0x45')]?_0x2e442a['attributes']:_0x38d679['model'];if(_0x50b063[_0x1f70('0x2f')][_0x1f70('0x46')]){_0x2e442a[_0x1f70('0x41')]=[{'all':!![]}];}_0x2e442a=_[_0x1f70('0x3d')]({},_0x2e442a,_0x50b063[_0x1f70('0x3f')]);return db[_0x1f70('0x2a')][_0x1f70('0x47')](_0x2e442a)[_0x1f70('0x25')](handleEntityNotFound(_0x46eb24,null))[_0x1f70('0x25')](respondWithResult(_0x46eb24,null))[_0x1f70('0x48')](handleError(_0x46eb24,null));};exports[_0x1f70('0x49')]=function(_0x3111a2,_0x2a3ed3){return db[_0x1f70('0x2a')][_0x1f70('0x49')](_0x3111a2['body'],{})[_0x1f70('0x25')](respondWithResult(_0x2a3ed3,0xc9))[_0x1f70('0x48')](handleError(_0x2a3ed3,null));};exports[_0x1f70('0x24')]=function(_0x30337a,_0x2eb4e0){if(_0x30337a[_0x1f70('0x4a')]['id']){delete _0x30337a[_0x1f70('0x4a')]['id'];}return db[_0x1f70('0x2a')][_0x1f70('0x47')]({'where':{'id':_0x30337a['params']['id']}})[_0x1f70('0x25')](handleEntityNotFound(_0x2eb4e0,null))['then'](saveUpdates(_0x30337a[_0x1f70('0x4a')],null))[_0x1f70('0x25')](respondWithResult(_0x2eb4e0,null))[_0x1f70('0x48')](handleError(_0x2eb4e0,null));};exports[_0x1f70('0x4b')]=function(_0x52fe14,_0x1911a8){return db['ChatGroup']['find']({'where':{'id':_0x52fe14[_0x1f70('0x44')]['id']}})[_0x1f70('0x25')](handleEntityNotFound(_0x1911a8,null))[_0x1f70('0x25')](removeEntity(_0x1911a8,null))['catch'](handleError(_0x1911a8,null));};exports['describe']=function(_0x284357,_0x55cea3){return db[_0x1f70('0x2a')]['describe']()['then'](respondWithResult(_0x55cea3,null))['catch'](handleError(_0x55cea3,null));};exports[_0x1f70('0x4c')]=function(_0x1e2c81,_0x173ac5,_0x90f2ef){return db[_0x1f70('0x4d')][_0x1f70('0x40')]({'where':{'ChatGroupId':_0x1e2c81[_0x1f70('0x44')]['id'],'ToId':_0x1e2c81[_0x1f70('0x4e')]['id'],'read':![]}})[_0x1f70('0x25')](function(_0xc5d0ba){return{'id':_[_0x1f70('0x4f')](_0x1e2c81['params']['id']),'count':_0xc5d0ba};})['then'](respondWithResult(_0x173ac5,null))[_0x1f70('0x48')](handleError(_0x173ac5,null));};exports['addMembers']=function(_0x28d23e,_0x103099,_0x4d5bea){return db[_0x1f70('0x2a')]['find']({'where':{'id':_0x28d23e[_0x1f70('0x44')]['id']}})['then'](handleEntityNotFound(_0x103099,null))[_0x1f70('0x25')](function(_0x139751){if(_0x139751){return _0x139751[_0x1f70('0x50')](_0x28d23e[_0x1f70('0x4a')]['ids'],_[_0x1f70('0x51')](_0x28d23e[_0x1f70('0x4a')],[_0x1f70('0x52'),'id'])||{});}})[_0x1f70('0x25')](respondWithResult(_0x103099,null))[_0x1f70('0x48')](handleError(_0x103099,null));};exports[_0x1f70('0x53')]=function(_0x45359b,_0x1074f0,_0x43e093){var _0x3c6905={};var _0x5b4047={};var _0x696e7f;var _0x4e810b;return db[_0x1f70('0x2a')][_0x1f70('0x54')]({'where':{'id':_0x45359b[_0x1f70('0x44')]['id']}})[_0x1f70('0x25')](handleEntityNotFound(_0x1074f0,null))['then'](function(_0x1ad467){if(_0x1ad467){_0x696e7f=_0x1ad467;_0x5b4047['model']=_[_0x1f70('0x30')](db['User'][_0x1f70('0x2b')]);_0x5b4047[_0x1f70('0x2f')]=_[_0x1f70('0x30')](_0x45359b[_0x1f70('0x2f')]);_0x5b4047[_0x1f70('0x31')]=_[_0x1f70('0x32')](_0x5b4047[_0x1f70('0x33')],_0x5b4047[_0x1f70('0x2f')]);_0x3c6905[_0x1f70('0x34')]=_[_0x1f70('0x32')](_0x5b4047[_0x1f70('0x33')],qs[_0x1f70('0x35')](_0x45359b[_0x1f70('0x2f')][_0x1f70('0x35')]));_0x3c6905[_0x1f70('0x34')]=_0x3c6905[_0x1f70('0x34')][_0x1f70('0x45')]?_0x3c6905[_0x1f70('0x34')]:_0x5b4047[_0x1f70('0x33')];_0x3c6905['order']=qs[_0x1f70('0x39')](_0x45359b['query'][_0x1f70('0x39')]);_0x3c6905[_0x1f70('0x3a')]=qs[_0x1f70('0x31')](_[_0x1f70('0x3b')](_0x45359b[_0x1f70('0x2f')],_0x5b4047[_0x1f70('0x31')]));if(_0x45359b[_0x1f70('0x2f')][_0x1f70('0x3c')]){_0x3c6905['where']=_[_0x1f70('0x3d')](_0x3c6905[_0x1f70('0x3a')],{'$or':_[_0x1f70('0x29')](_0x3c6905[_0x1f70('0x34')],function(_0x56af77){var _0x3ae651={};_0x3ae651[_0x56af77]={'$like':'%'+_0x45359b['query'][_0x1f70('0x3c')]+'%'};return _0x3ae651;})});}_0x3c6905=_[_0x1f70('0x3d')]({},_0x3c6905,_0x45359b['options']);return _0x696e7f[_0x1f70('0x53')](_0x3c6905);}})[_0x1f70('0x25')](function(_0x226ef2){if(_0x226ef2){_0x4e810b=_0x226ef2[_0x1f70('0x45')];if(!_0x45359b[_0x1f70('0x2f')][_0x1f70('0x36')](_0x1f70('0x37'))){_0x3c6905['limit']=qs[_0x1f70('0x1f')](_0x45359b['query'][_0x1f70('0x1f')]);_0x3c6905[_0x1f70('0x1e')]=qs[_0x1f70('0x1e')](_0x45359b[_0x1f70('0x2f')][_0x1f70('0x1e')]);}return _0x696e7f[_0x1f70('0x53')](_0x3c6905);}})[_0x1f70('0x25')](function(_0xf09936){if(_0xf09936){return _0xf09936?{'count':_0x4e810b,'rows':_0xf09936}:null;}})[_0x1f70('0x25')](respondWithResult(_0x1074f0,null))[_0x1f70('0x48')](handleError(_0x1074f0,null));};exports['removeMembers']=function(_0x59b858,_0x2be5a4,_0x16120c){return db['ChatGroup']['find']({'where':{'id':_0x59b858[_0x1f70('0x44')]['id']}})[_0x1f70('0x25')](handleEntityNotFound(_0x2be5a4,null))['then'](function(_0x5841d5){if(_0x5841d5){return _0x5841d5['removeMembers'](_0x59b858['query'][_0x1f70('0x52')]);}})[_0x1f70('0x25')](respondWithStatusCode(_0x2be5a4,null))[_0x1f70('0x48')](handleError(_0x2be5a4,null));};exports[_0x1f70('0x55')]=function(_0x35b592,_0x3351dc,_0x39dfad){if(_0x35b592[_0x1f70('0x4a')]['id']){delete _0x35b592['body']['id'];}return db['ChatGroup']['find']({'where':{'id':_0x35b592['params']['id']}})[_0x1f70('0x25')](handleEntityNotFound(_0x3351dc,null))[_0x1f70('0x25')](function(_0x37045a){if(_0x37045a){_0x35b592['body'][_0x1f70('0x56')]=_0x37045a['id'];return db[_0x1f70('0x4d')][_0x1f70('0x49')](_0x35b592[_0x1f70('0x4a')]);}})['then'](respondWithResult(_0x3351dc,null))[_0x1f70('0x48')](handleError(_0x3351dc,null));};exports['getMessages']=function(_0x14c52e,_0x32ebbe,_0x13f87b){var _0x2a2d94={};var _0x2ce3c8={};var _0xa4c064;var _0x54736e;return db['ChatGroup']['findOne']({'where':{'id':_0x14c52e[_0x1f70('0x44')]['id']}})[_0x1f70('0x25')](handleEntityNotFound(_0x32ebbe,null))[_0x1f70('0x25')](function(_0x41e9f9){if(_0x41e9f9){_0xa4c064=_0x41e9f9;_0x2ce3c8['model']=_['keys'](db['ChatInternalMessage']['rawAttributes']);_0x2ce3c8['query']=_[_0x1f70('0x30')](_0x14c52e['query']);_0x2ce3c8['filters']=_[_0x1f70('0x32')](_0x2ce3c8[_0x1f70('0x33')],_0x2ce3c8[_0x1f70('0x2f')]);_0x2a2d94[_0x1f70('0x34')]=_[_0x1f70('0x32')](_0x2ce3c8[_0x1f70('0x33')],qs[_0x1f70('0x35')](_0x14c52e['query']['fields']));_0x2a2d94[_0x1f70('0x34')]=_0x2a2d94['attributes']['length']?_0x2a2d94[_0x1f70('0x34')]:_0x2ce3c8[_0x1f70('0x33')];_0x2a2d94[_0x1f70('0x38')]=qs[_0x1f70('0x39')](_0x14c52e[_0x1f70('0x2f')][_0x1f70('0x39')]);_0x2a2d94[_0x1f70('0x3a')]=qs[_0x1f70('0x31')](_['pick'](_0x14c52e[_0x1f70('0x2f')],_0x2ce3c8[_0x1f70('0x31')]));if(_0x14c52e['query'][_0x1f70('0x3c')]){_0x2a2d94['where']=_['merge'](_0x2a2d94['where'],{'$or':_[_0x1f70('0x29')](_0x2a2d94[_0x1f70('0x34')],function(_0x15d4ad){var _0x3d7292={};_0x3d7292[_0x15d4ad]={'$like':'%'+_0x14c52e[_0x1f70('0x2f')][_0x1f70('0x3c')]+'%'};return _0x3d7292;})});}if(_0x14c52e[_0x1f70('0x2f')][_0x1f70('0x57')]){var _0x3d6d88=_0x14c52e[_0x1f70('0x2f')][_0x1f70('0x57')][_0x1f70('0x58')](',');var _0x24b354={};_0x24b354[_0x3d6d88[0x0]]={'$gte':moment(_0x3d6d88[0x1])[_0x1f70('0x59')](_0x1f70('0x5a'))};_0x2a2d94['where']=_['merge'](_0x2a2d94[_0x1f70('0x3a')],_0x24b354);}_0x2a2d94=_[_0x1f70('0x3d')]({},_0x2a2d94,_0x14c52e[_0x1f70('0x3f')]);return _0xa4c064['getMessages'](_0x2a2d94);}})[_0x1f70('0x25')](function(_0x1074d1){if(_0x1074d1){_0x54736e=_0x1074d1[_0x1f70('0x45')];if(!_0x14c52e[_0x1f70('0x2f')][_0x1f70('0x36')](_0x1f70('0x37'))){_0x2a2d94[_0x1f70('0x1f')]=qs[_0x1f70('0x1f')](_0x14c52e[_0x1f70('0x2f')][_0x1f70('0x1f')]);_0x2a2d94[_0x1f70('0x1e')]=qs[_0x1f70('0x1e')](_0x14c52e[_0x1f70('0x2f')][_0x1f70('0x1e')]);}return _0xa4c064[_0x1f70('0x5b')](_0x2a2d94);}})[_0x1f70('0x25')](function(_0x723843){if(_0x723843){return _0x723843?{'count':_0x54736e,'rows':_0x723843}:null;}})['then'](respondWithResult(_0x32ebbe,null))['catch'](handleError(_0x32ebbe,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index fae79ce..b0febfd 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 _0x04f8=['save','update','remove','emit','hook','events','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x04f8,0x1be));var _0x804f=function(_0xedb2ab,_0xf943aa){_0xedb2ab=_0xedb2ab-0x0;var _0x2dafee=_0x04f8[_0xedb2ab];return _0x2dafee;};'use strict';var EventEmitter=require(_0x804f('0x0'));var ChatGroup=require(_0x804f('0x1'))['db'][_0x804f('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x804f('0x3')](0x0);var events={'afterCreate':_0x804f('0x4'),'afterUpdate':_0x804f('0x5'),'afterDestroy':_0x804f('0x6')};function emitEvent(_0x23f7d3){return function(_0x294fe2,_0x2efd20,_0x33e36f){ChatGroupEvents[_0x804f('0x7')](_0x23f7d3+':'+_0x294fe2['id'],_0x294fe2);ChatGroupEvents[_0x804f('0x7')](_0x23f7d3,_0x294fe2);_0x33e36f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x804f('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x5a4f=['emit','hook','exports','events','ChatGroup','save','remove'];(function(_0x34d769,_0x200f77){var _0x5a1ab9=function(_0x27199c){while(--_0x27199c){_0x34d769['push'](_0x34d769['shift']());}};_0x5a1ab9(++_0x200f77);}(_0x5a4f,0x10d));var _0xf5a4=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5a4f[_0x3e5086];return _0xfeb102;};'use strict';var EventEmitter=require(_0xf5a4('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xf5a4('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf5a4('0x2'),'afterUpdate':'update','afterDestroy':_0xf5a4('0x3')};function emitEvent(_0x5e5a32){return function(_0x28a5e3,_0x2b45a3,_0x343cbf){ChatGroupEvents[_0xf5a4('0x4')](_0x5e5a32+':'+_0x28a5e3['id'],_0x28a5e3);ChatGroupEvents[_0xf5a4('0x4')](_0x5e5a32,_0x28a5e3);_0x343cbf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xf5a4('0x5')](e,emitEvent(event));}}module[_0xf5a4('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 409742c..98b8c67 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 _0xefe5=['request-promise','path','rimraf','../../config/environment','define','ChatGroup','chat_groups','lodash','util','api','moment','bluebird'];(function(_0x5d248d,_0x486827){var _0x1e6217=function(_0x3ceb24){while(--_0x3ceb24){_0x5d248d['push'](_0x5d248d['shift']());}};_0x1e6217(++_0x486827);}(_0xefe5,0xaf));var _0x5efe=function(_0x2742ba,_0x533c07){_0x2742ba=_0x2742ba-0x0;var _0x41b26a=_0xefe5[_0x2742ba];return _0x41b26a;};'use strict';var _=require(_0x5efe('0x0'));var util=require(_0x5efe('0x1'));var logger=require('../../config/logger')(_0x5efe('0x2'));var moment=require(_0x5efe('0x3'));var BPromise=require(_0x5efe('0x4'));var rp=require(_0x5efe('0x5'));var fs=require('fs');var path=require(_0x5efe('0x6'));var rimraf=require(_0x5efe('0x7'));var config=require(_0x5efe('0x8'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x38a58c,_0x5d38d9){return _0x38a58c[_0x5efe('0x9')](_0x5efe('0xa'),attributes,{'tableName':_0x5efe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe495=['rimraf','../../config/environment','./chatGroup.attributes','exports','define','lodash','util','api','bluebird','request-promise','path'];(function(_0x354e0a,_0x2174d1){var _0x314fc2=function(_0x4db033){while(--_0x4db033){_0x354e0a['push'](_0x354e0a['shift']());}};_0x314fc2(++_0x2174d1);}(_0xe495,0xb5));var _0x5e49=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xe495[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x5e49('0x0'));var util=require(_0x5e49('0x1'));var logger=require('../../config/logger')(_0x5e49('0x2'));var moment=require('moment');var BPromise=require(_0x5e49('0x3'));var rp=require(_0x5e49('0x4'));var fs=require('fs');var path=require(_0x5e49('0x5'));var rimraf=require(_0x5e49('0x6'));var config=require(_0x5e49('0x7'));var attributes=require(_0x5e49('0x8'));module[_0x5e49('0x9')]=function(_0x53cfbc,_0x118287){return _0x53cfbc[_0x5e49('0xa')]('ChatGroup',attributes,{'tableName':'chat_groups','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 795b68d..83a4aae 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 _0x7d86=['./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','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x21ef59,_0x21eb81){var _0x4992f5=function(_0x4da418){while(--_0x4da418){_0x21ef59['push'](_0x21ef59['shift']());}};_0x4992f5(++_0x21eb81);}(_0x7d86,0x86));var _0x67d8=function(_0x731707,_0x22ea5f){_0x731707=_0x731707-0x0;var _0xb7641f=_0x7d86[_0x731707];return _0xb7641f;};'use strict';var _=require(_0x67d8('0x0'));var util=require('util');var moment=require(_0x67d8('0x1'));var BPromise=require(_0x67d8('0x2'));var rs=require(_0x67d8('0x3'));var fs=require('fs');var Redis=require(_0x67d8('0x4'));var db=require(_0x67d8('0x5'))['db'];var utils=require(_0x67d8('0x6'));var logger=require(_0x67d8('0x7'))('rpc');var config=require(_0x67d8('0x8'));var jayson=require(_0x67d8('0x9'));var client=jayson[_0x67d8('0xa')][_0x67d8('0xb')]({'port':0x232a});config[_0x67d8('0xc')]=_[_0x67d8('0xd')](config[_0x67d8('0xc')],{'host':_0x67d8('0xe'),'port':0x18eb});var socket=require(_0x67d8('0xf'))(new Redis(config[_0x67d8('0xc')]));require(_0x67d8('0x10'))[_0x67d8('0x11')](socket);function respondWithRpcPromise(_0x243de2,_0x265552,_0x2b1fe6){return new BPromise(function(_0x47382c,_0x2e5a0f){return client[_0x67d8('0x12')](_0x243de2,_0x2b1fe6)[_0x67d8('0x13')](function(_0x46b7f8){logger[_0x67d8('0x14')]('ChatGroup,\x20%s,\x20%s',_0x265552,_0x67d8('0x15'));logger[_0x67d8('0x16')](_0x67d8('0x17'),_0x265552,'request\x20sent',JSON[_0x67d8('0x18')](_0x46b7f8));if(_0x46b7f8[_0x67d8('0x19')]){if(_0x46b7f8[_0x67d8('0x19')][_0x67d8('0x1a')]===0x1f4){logger[_0x67d8('0x19')](_0x67d8('0x1b'),_0x265552,_0x46b7f8[_0x67d8('0x19')]['message']);return _0x2e5a0f(_0x46b7f8[_0x67d8('0x19')][_0x67d8('0x1c')]);}logger[_0x67d8('0x19')]('ChatGroup,\x20%s,\x20%s',_0x265552,_0x46b7f8[_0x67d8('0x19')][_0x67d8('0x1c')]);return _0x47382c(_0x46b7f8['error'][_0x67d8('0x1c')]);}else{logger[_0x67d8('0x14')](_0x67d8('0x1b'),_0x265552,_0x67d8('0x15'));_0x47382c(_0x46b7f8[_0x67d8('0x1d')][_0x67d8('0x1c')]);}})['catch'](function(_0x3de8d1){logger[_0x67d8('0x19')](_0x67d8('0x1b'),_0x265552,_0x3de8d1);_0x2e5a0f(_0x3de8d1);});});} \ No newline at end of file +var _0x79de=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x79de,0x1a8));var _0xe79d=function(_0x25cd97,_0x2c9eb5){_0x25cd97=_0x25cd97-0x0;var _0xcf0eaa=_0x79de[_0x25cd97];return _0xcf0eaa;};'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});config[_0xe79d('0xb')]=_[_0xe79d('0xc')](config[_0xe79d('0xb')],{'host':_0xe79d('0xd'),'port':0x18eb});var socket=require(_0xe79d('0xe'))(new Redis(config['redis']));require(_0xe79d('0xf'))[_0xe79d('0x10')](socket);function respondWithRpcPromise(_0x1c1557,_0x34776b,_0x2de075){return new BPromise(function(_0x367821,_0x156e3b){return client[_0xe79d('0x11')](_0x1c1557,_0x2de075)[_0xe79d('0x12')](function(_0x59020d){logger[_0xe79d('0x13')](_0xe79d('0x14'),_0x34776b,_0xe79d('0x15'));logger[_0xe79d('0x16')](_0xe79d('0x17'),_0x34776b,'request\x20sent',JSON[_0xe79d('0x18')](_0x59020d));if(_0x59020d['error']){if(_0x59020d['error']['code']===0x1f4){logger[_0xe79d('0x19')](_0xe79d('0x14'),_0x34776b,_0x59020d[_0xe79d('0x19')][_0xe79d('0x1a')]);return _0x156e3b(_0x59020d[_0xe79d('0x19')][_0xe79d('0x1a')]);}logger[_0xe79d('0x19')](_0xe79d('0x14'),_0x34776b,_0x59020d['error'][_0xe79d('0x1a')]);return _0x367821(_0x59020d[_0xe79d('0x19')][_0xe79d('0x1a')]);}else{logger['info'](_0xe79d('0x14'),_0x34776b,'request\x20sent');_0x367821(_0x59020d['result'][_0xe79d('0x1a')]);}})['catch'](function(_0xf66faa){logger[_0xe79d('0x19')](_0xe79d('0x14'),_0x34776b,_0xf66faa);_0x156e3b(_0xf66faa);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 438eccb..387511f 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 _0x01be=['removeListener','length','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x5549ce,_0x38e9b1){var _0x6d2f06=function(_0x253754){while(--_0x253754){_0x5549ce['push'](_0x5549ce['shift']());}};_0x6d2f06(++_0x38e9b1);}(_0x01be,0x1d3));var _0xe01b=function(_0x52e5f3,_0x1308c9){_0x52e5f3=_0x52e5f3-0x0;var _0x2f1eaa=_0x01be[_0x52e5f3];return _0x2f1eaa;};'use strict';var ChatGroupEvents=require(_0xe01b('0x0'));var events=[_0xe01b('0x1'),_0xe01b('0x2'),_0xe01b('0x3')];function createListener(_0x25aa81,_0x2b5d29){return function(_0x3a4b4b){_0x2b5d29[_0xe01b('0x4')](_0x25aa81,_0x3a4b4b);};}function removeListener(_0x13b354,_0x19ec66){return function(){ChatGroupEvents[_0xe01b('0x5')](_0x13b354,_0x19ec66);};}exports['register']=function(_0x4d7aa5){for(var _0x2e1ef3=0x0,_0x45e113=events[_0xe01b('0x6')];_0x2e1ef3<_0x45e113;_0x2e1ef3++){var _0x170515=events[_0x2e1ef3];var _0x19d1eb=createListener(_0xe01b('0x7')+_0x170515,_0x4d7aa5);ChatGroupEvents['on'](_0x170515,_0x19d1eb);}}; \ No newline at end of file +var _0xd5be=['save','remove','emit','register','length','chatGroup:'];(function(_0x3406ef,_0x6b81a8){var _0x1591eb=function(_0x36a417){while(--_0x36a417){_0x3406ef['push'](_0x3406ef['shift']());}};_0x1591eb(++_0x6b81a8);}(_0xd5be,0x11a));var _0xed5b=function(_0x133e3b,_0x443cd6){_0x133e3b=_0x133e3b-0x0;var _0x199e72=_0xd5be[_0x133e3b];return _0x199e72;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xed5b('0x0'),_0xed5b('0x1'),'update'];function createListener(_0x4c3719,_0x2c358b){return function(_0x587f2b){_0x2c358b[_0xed5b('0x2')](_0x4c3719,_0x587f2b);};}function removeListener(_0x3095af,_0x48fe4b){return function(){ChatGroupEvents['removeListener'](_0x3095af,_0x48fe4b);};}exports[_0xed5b('0x3')]=function(_0x574c83){for(var _0x423b20=0x0,_0x4594d5=events[_0xed5b('0x4')];_0x423b20<_0x4594d5;_0x423b20++){var _0xd7fd3b=events[_0x423b20];var _0x46ad75=createListener(_0xed5b('0x5')+_0xd7fd3b,_0x574c83);ChatGroupEvents['on'](_0xd7fd3b,_0x46ad75);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 1e07c43..4040138 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 _0xf6f5=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','/:id/messages','update','destroy'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xf6f5,0xb1));var _0x5f6f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf6f5[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x5f6f('0x0'));var util=require(_0x5f6f('0x1'));var path=require(_0x5f6f('0x2'));var timeout=require(_0x5f6f('0x3'));var express=require(_0x5f6f('0x4'));var router=express[_0x5f6f('0x5')]();var fs_extra=require(_0x5f6f('0x6'));var auth=require(_0x5f6f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5f6f('0x8'));var controller=require(_0x5f6f('0x9'));router[_0x5f6f('0xa')]('/',auth[_0x5f6f('0xb')](),controller['index']);router[_0x5f6f('0xa')](_0x5f6f('0xc'),auth[_0x5f6f('0xb')](),controller['describe']);router[_0x5f6f('0xa')](_0x5f6f('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x5f6f('0xe'),auth['isAuthenticated'](),controller[_0x5f6f('0xf')]);router['get'](_0x5f6f('0x10'),auth[_0x5f6f('0xb')](),controller[_0x5f6f('0x11')]);router[_0x5f6f('0xa')]('/:id/messages',auth[_0x5f6f('0xb')](),controller[_0x5f6f('0x12')]);router[_0x5f6f('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5f6f('0x13')]('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0x5f6f('0x13')](_0x5f6f('0x14'),auth[_0x5f6f('0xb')](),controller['addMessage']);router['put'](_0x5f6f('0xd'),auth[_0x5f6f('0xb')](),controller[_0x5f6f('0x15')]);router['delete']('/:id',auth[_0x5f6f('0xb')](),controller[_0x5f6f('0x16')]);router[_0x5f6f('0x17')](_0x5f6f('0x10'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x5f6f('0x18')]=router; \ No newline at end of file +var _0xe582=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','getMessages','create','post','/:id/messages','addMessage','put','destroy'];(function(_0x504fdf,_0x279255){var _0x29f5c2=function(_0x5aa1ff){while(--_0x5aa1ff){_0x504fdf['push'](_0x504fdf['shift']());}};_0x29f5c2(++_0x279255);}(_0xe582,0x136));var _0x2e58=function(_0xf8886b,_0x504891){_0xf8886b=_0xf8886b-0x0;var _0x321bd5=_0xe582[_0xf8886b];return _0x321bd5;};'use strict';var multer=require(_0x2e58('0x0'));var util=require(_0x2e58('0x1'));var path=require(_0x2e58('0x2'));var timeout=require(_0x2e58('0x3'));var express=require(_0x2e58('0x4'));var router=express[_0x2e58('0x5')]();var fs_extra=require(_0x2e58('0x6'));var auth=require(_0x2e58('0x7'));var interaction=require(_0x2e58('0x8'));var config=require(_0x2e58('0x9'));var controller=require(_0x2e58('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2e58('0xb')]('/describe',auth[_0x2e58('0xc')](),controller[_0x2e58('0xd')]);router[_0x2e58('0xb')](_0x2e58('0xe'),auth[_0x2e58('0xc')](),controller['show']);router['get'](_0x2e58('0xf'),auth[_0x2e58('0xc')](),controller[_0x2e58('0x10')]);router[_0x2e58('0xb')](_0x2e58('0x11'),auth['isAuthenticated'](),controller[_0x2e58('0x12')]);router[_0x2e58('0xb')]('/:id/messages',auth[_0x2e58('0xc')](),controller[_0x2e58('0x13')]);router['post']('/',auth[_0x2e58('0xc')](),controller[_0x2e58('0x14')]);router[_0x2e58('0x15')]('/:id/members',auth[_0x2e58('0xc')](),controller['addMembers']);router[_0x2e58('0x15')](_0x2e58('0x16'),auth[_0x2e58('0xc')](),controller[_0x2e58('0x17')]);router[_0x2e58('0x18')]('/:id',auth[_0x2e58('0xc')](),controller['update']);router['delete']('/:id',auth[_0x2e58('0xc')](),controller[_0x2e58('0x19')]);router[_0x2e58('0x1a')](_0x2e58('0x11'),auth[_0x2e58('0xc')](),controller['removeMembers']);module[_0x2e58('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 922be46..43f29ab 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 _0xe511=['DATE','long','ENUM','out','sequelize','exports','INTEGER','star','thumb','TEXT','STRING'];(function(_0x1c2d76,_0x49ad65){var _0x52e0f1=function(_0x1c6109){while(--_0x1c6109){_0x1c2d76['push'](_0x1c2d76['shift']());}};_0x52e0f1(++_0x49ad65);}(_0xe511,0x16f));var _0x1e51=function(_0x5c7939,_0x22f61e){_0x5c7939=_0x5c7939-0x0;var _0x5bcfbc=_0xe511[_0x5c7939];return _0x5bcfbc;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1e51('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x1e51('0x3'),_0x1e51('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x1e51('0x5')]},'pathTranscript':{'type':Sequelize[_0x1e51('0x5')]},'mailTranscript':{'type':Sequelize[_0x1e51('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1e51('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1e51('0x6')]},'thirdDisposition':{'type':Sequelize[_0x1e51('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x1e51('0x6')]},'osName':{'type':Sequelize[_0x1e51('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x1e51('0x6')]},'deviceType':{'type':Sequelize[_0x1e51('0x6')]},'referer':{'type':Sequelize[_0x1e51('0x5')]},'customerIp':{'type':Sequelize[_0x1e51('0x6')]},'formData':{'type':Sequelize[_0x1e51('0x5')](_0x1e51('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x1e51('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x1e51('0x9')]('in',_0x1e51('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1e51('0x6')]},'customerPort':{'type':Sequelize[_0x1e51('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x1e51('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9147=['ENUM','out','BOOLEAN','sequelize','exports','INTEGER','star','thumb','TEXT','STRING','long','DATE'];(function(_0x5b3cd9,_0x2d63b0){var _0xb56750=function(_0x3d2036){while(--_0x3d2036){_0x5b3cd9['push'](_0x5b3cd9['shift']());}};_0xb56750(++_0x2d63b0);}(_0x9147,0x7b));var _0x7914=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x9147[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x7914('0x0'));module[_0x7914('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7914('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x7914('0x3'),_0x7914('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x7914('0x5')]},'pathTranscript':{'type':Sequelize[_0x7914('0x5')]},'mailTranscript':{'type':Sequelize[_0x7914('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7914('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7914('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x7914('0x6')]},'browserVersion':{'type':Sequelize[_0x7914('0x6')]},'osName':{'type':Sequelize[_0x7914('0x6')]},'osVersion':{'type':Sequelize[_0x7914('0x6')]},'deviceModel':{'type':Sequelize[_0x7914('0x6')]},'deviceVendor':{'type':Sequelize[_0x7914('0x6')]},'deviceType':{'type':Sequelize[_0x7914('0x6')]},'referer':{'type':Sequelize[_0x7914('0x5')]},'customerIp':{'type':Sequelize[_0x7914('0x6')]},'formData':{'type':Sequelize[_0x7914('0x5')](_0x7914('0x7'))},'read1stAt':{'type':Sequelize[_0x7914('0x8')]},'lastMsgAt':{'type':Sequelize[_0x7914('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x7914('0x9')]('in',_0x7914('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x7914('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x7914('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x7914('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 396e97f..48c8c4d 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 _0xea28=['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','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','sendStatus','stack','name','merge','contact','agent','interaction','account','Users','map','TagIds','Tags','split','forEach','index','ChatInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','ui.ChatInteractionId','from','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','Contact','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','compact','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','params','includeAll','options','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','now','pathTranscript','%s%d','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','fullname','[%s]\x20%s:\x20%s\x0a','direction','appendFileSync','MailServerOut','Smtp','service','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','include','findAll','rows','getMyMessages','secret','includeAgent','addTags','setTags','spread','emit','removeTags','files','attachments','transcript-%d-%s.zip','firstName','lastName','Messages','read','Account','Chat','Owner','YYYY-MM-DD\x20HH:mm:ss','browserName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','log','unlinkSync','eml-format','rimraf','zip-dir'];(function(_0x15bf27,_0x3a5b4e){var _0x36223c=function(_0x29816d){while(--_0x29816d){_0x15bf27['push'](_0x15bf27['shift']());}};_0x36223c(++_0x3a5b4e);}(_0xea28,0x13a));var _0x8ea2=function(_0x1a4c7e,_0x14063c){_0x1a4c7e=_0x1a4c7e-0x0;var _0x90bb8c=_0xea28[_0x1a4c7e];return _0x90bb8c;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x8ea2('0x16'));var logger=require(_0x8ea2('0x17'))(_0x8ea2('0x18'));var utils=require('../../config/utils');var config=require(_0x8ea2('0x19'));var licenseUtil=require(_0x8ea2('0x1a'));var db=require(_0x8ea2('0x1b'))['db'];config[_0x8ea2('0x1c')]=_[_0x8ea2('0x1d')](config['redis'],{'host':_0x8ea2('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8ea2('0x1f'))[_0x8ea2('0x20')](socket);var jayson=require(_0x8ea2('0x21'));var client=jayson[_0x8ea2('0x22')][_0x8ea2('0x23')]({'port':0x232b});var client9004=jayson[_0x8ea2('0x22')][_0x8ea2('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x11f5e8,_0x474873,_0x396aab,_0x2dfa7c){return new BPromise(function(_0x1c1715,_0x3bc774){var _0xaa8abf=_0x2dfa7c||client;return _0xaa8abf[_0x8ea2('0x24')](_0x11f5e8,_0x396aab)[_0x8ea2('0x25')](function(_0x467045){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x474873,_0x8ea2('0x28'));logger[_0x8ea2('0x29')](_0x8ea2('0x2a'),_0x474873,'request\x20sent',JSON['stringify'](_0x467045));if(_0x467045[_0x8ea2('0x2b')]){if(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2c')]===0x1f4){logger['error'](_0x8ea2('0x27'),_0x474873,_0x467045[_0x8ea2('0x2b')]['message']);return _0x3bc774(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);}logger[_0x8ea2('0x2b')](_0x8ea2('0x27'),_0x474873,_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);return _0x1c1715(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);}else{logger[_0x8ea2('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x474873,_0x8ea2('0x28'));_0x1c1715(_0x467045['result'][_0x8ea2('0x2d')]);}})[_0x8ea2('0x2e')](function(_0x29b38f){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x474873,_0x29b38f);_0x3bc774(_0x29b38f);});});}function respondWithStatusCode(_0x2e4da3,_0x4dc7bf){_0x4dc7bf=_0x4dc7bf||0xcc;return function(_0x200a49){if(_0x200a49){return _0x2e4da3['sendStatus'](_0x4dc7bf);}return _0x2e4da3[_0x8ea2('0x2f')](_0x4dc7bf)[_0x8ea2('0x30')]();};}function respondWithResult(_0x21c526,_0x266db8){_0x266db8=_0x266db8||0xc8;return function(_0x4e1b90){if(_0x4e1b90){return _0x21c526['status'](_0x266db8)[_0x8ea2('0x31')](_0x4e1b90);}};}function respondWithFilteredResult(_0x4da5b3,_0x4a9875){return function(_0x287078){if(_0x287078){var _0x24f187=typeof _0x4a9875[_0x8ea2('0x32')]===_0x8ea2('0x33')&&typeof _0x4a9875[_0x8ea2('0x34')]===_0x8ea2('0x33');var _0x316707=_0x287078[_0x8ea2('0x35')];var _0x9c5fac=_0x24f187?0x0:_0x4a9875['offset'];var _0x5b7ff9=_0x24f187?_0x287078[_0x8ea2('0x35')]:_0x4a9875[_0x8ea2('0x32')]+_0x4a9875['limit'];var _0x4a110f;if(_0x5b7ff9>=_0x316707){_0x5b7ff9=_0x316707;_0x4a110f=0xc8;}else{_0x4a110f=0xce;}_0x4da5b3[_0x8ea2('0x2f')](_0x4a110f);return _0x4da5b3['set'](_0x8ea2('0x36'),_0x9c5fac+'-'+_0x5b7ff9+'/'+_0x316707)[_0x8ea2('0x31')](_0x287078);}return null;};}function patchUpdates(_0x53fd06){return function(_0x17b21c){try{jsonpatch[_0x8ea2('0x37')](_0x17b21c,_0x53fd06,!![]);}catch(_0x33abc8){return BPromise['reject'](_0x33abc8);}return _0x17b21c['save']();};}function saveUpdates(_0x49a252,_0x3880c3){return function(_0x233e12){if(_0x233e12){return _0x233e12[_0x8ea2('0x38')](_0x49a252)['then'](function(_0x456487){return _0x456487;});}return null;};}function removeEntity(_0x391b08,_0x3d5bf0){return function(_0x278e5d){if(_0x278e5d){return _0x278e5d[_0x8ea2('0x39')]()[_0x8ea2('0x25')](function(){_0x391b08[_0x8ea2('0x2f')](0xcc)[_0x8ea2('0x30')]();});}};}function handleEntityNotFound(_0x5e9b1f,_0x955ef3){return function(_0x29e3f5){if(!_0x29e3f5){_0x5e9b1f[_0x8ea2('0x3a')](0x194);}return _0x29e3f5;};}function handleError(_0x467d97,_0x4eebc1){_0x4eebc1=_0x4eebc1||0x1f4;return function(_0x2a1f14){logger['error'](_0x2a1f14[_0x8ea2('0x3b')]);if(_0x2a1f14[_0x8ea2('0x3c')]){delete _0x2a1f14[_0x8ea2('0x3c')];}_0x467d97[_0x8ea2('0x2f')](_0x4eebc1)['send'](_0x2a1f14);};}function getMustacheRender(_0x2bed24,_0x531979){return Mustache['render'](_0x2bed24,_[_0x8ea2('0x3d')](_0x531979['body'],{'contact':_0x531979[_0x8ea2('0x3e')],'message':_0x531979[_0x8ea2('0x2d')],'agent':_0x531979[_0x8ea2('0x3f')],'interaction':_0x531979[_0x8ea2('0x40')],'account':_0x531979[_0x8ea2('0x41')]}))||'';}function getInteractionUsers(_0x4ae536,_0x84685d){return new BPromise(function(_0x5c5d2d,_0x12a6c2){try{if(_0x84685d[_0x4ae536['id']]){_0x4ae536[_0x8ea2('0x42')]=_[_0x8ea2('0x43')](_0x84685d[_0x4ae536['id']],function(_0x3995ff){return{'id':_0x3995ff['id'],'fullname':_0x3995ff['fullname']};});}}catch(_0x44e8bc){_0x12a6c2(_0x44e8bc);}_0x5c5d2d(_0x4ae536);});}function getInteractionTags(_0x57a6b8,_0x3f0c78){return new BPromise(function(_0x5ba351,_0x2ee78b){try{if(_0x57a6b8[_0x8ea2('0x44')]){_0x57a6b8[_0x8ea2('0x45')]=[];_0x57a6b8[_0x8ea2('0x44')][_0x8ea2('0x46')](',')[_0x8ea2('0x47')](function(_0x2f4fa8){_0x57a6b8['Tags']['push'](_0x3f0c78[_0x2f4fa8]);});}delete _0x57a6b8[_0x8ea2('0x44')];}catch(_0x53455a){_0x2ee78b(_0x53455a);}_0x5ba351(_0x57a6b8);});}function updateChatInteraction(_0x4b03fa,_0x59e2fa,_0x3cbc09){return new BPromise(function(_0x5d9ba0,_0x40a532){return getInteractionUsers(_0x4b03fa,_0x3cbc09)[_0x8ea2('0x25')](function(_0x39c944){return getInteractionTags(_0x39c944,_0x59e2fa);})[_0x8ea2('0x25')](function(_0x989d9b){_0x5d9ba0(_0x989d9b);})[_0x8ea2('0x2e')](function(_0x3b2219){_0x40a532(_0x3b2219);});});}exports[_0x8ea2('0x48')]=function(_0x5352b9,_0x3afb80){var _0x1ef615={},_0x1db25c={},_0x5cb6ad={'count':0x0,'rows':[]};var _0x2d6bbb=_[_0x8ea2('0x43')](db[_0x8ea2('0x49')][_0x8ea2('0x4a')],function(_0x20992d){return{'name':_0x20992d['fieldName'],'type':_0x20992d[_0x8ea2('0x4b')][_0x8ea2('0x4c')]};});_0x1db25c[_0x8ea2('0x4d')]=_['map'](_0x2d6bbb,_0x8ea2('0x3c'));_0x1db25c[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x5352b9[_0x8ea2('0x4e')]);_0x1db25c[_0x8ea2('0x50')]=_[_0x8ea2('0x51')](_0x1db25c[_0x8ea2('0x4d')],_0x1db25c[_0x8ea2('0x4e')]);_0x1ef615[_0x8ea2('0x52')]=_[_0x8ea2('0x51')](_0x1db25c[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x53')]));_0x1ef615['attributes']=_0x1ef615[_0x8ea2('0x52')][_0x8ea2('0x54')]?_0x1ef615[_0x8ea2('0x52')]:_0x1db25c[_0x8ea2('0x4d')];if(!_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x55')](_0x8ea2('0x56'))){_0x1ef615[_0x8ea2('0x34')]=qs['limit'](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x34')]);_0x1ef615[_0x8ea2('0x32')]=qs['offset'](_0x5352b9['query'][_0x8ea2('0x32')]);}_0x1ef615[_0x8ea2('0x57')]=qs[_0x8ea2('0x58')](_0x5352b9['query'][_0x8ea2('0x58')]);_0x1ef615[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_[_0x8ea2('0x5a')](_0x5352b9[_0x8ea2('0x4e')],_0x1db25c['filters']),_0x2d6bbb);var _0x4afd85=[];var _0x24a22a=squel[_0x8ea2('0x5b')]()[_0x8ea2('0x5c')]('id')['field'](_0x8ea2('0x3c'))[_0x8ea2('0x5c')](_0x8ea2('0x5d'))['from']('tools_tags');var _0x48aebf=squel['select']()['field'](_0x8ea2('0x5e'))[_0x8ea2('0x5c')]('u.fullname')['field'](_0x8ea2('0x5f'))[_0x8ea2('0x60')](_0x8ea2('0x61'),'ui')['left_join'](_0x8ea2('0x62'),'u',_0x8ea2('0x63'));var _0x59e3df=squel[_0x8ea2('0x5b')]()[_0x8ea2('0x60')](_0x8ea2('0x64'),'i')[_0x8ea2('0x65')](_0x8ea2('0x66'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x8ea2('0x67'))[_0x8ea2('0x65')](_0x8ea2('0x68'),'a',_0x8ea2('0x69'))[_0x8ea2('0x65')](_0x8ea2('0x6a'),'me',_0x8ea2('0x6b'))['left_join']('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0x8ea2('0x65')](_0x8ea2('0x6c'),'t',_0x8ea2('0x6d'));var _0x2bbec0=squel['expr']();var _0x11824e=[];var _0x2b8662=squel['expr']();var _0x21485a;if(_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x6e')]){_0x21485a=as[_0x8ea2('0x6f')](_0x5352b9[_0x8ea2('0x4e')]['search']);var _0x479c05=_0x21485a['sqlOperator'];for(var _0x53a62c=0x0;_0x53a62c<_0x21485a[_0x8ea2('0x70')][_0x8ea2('0x54')];_0x53a62c++){var _0x2d8221=_0x21485a[_0x8ea2('0x70')][_0x53a62c];var _0x491d3d='i';var _0x461d32=_[_0x8ea2('0x71')](_0x2d6bbb,[_0x8ea2('0x3c'),_0x2d8221[_0x8ea2('0x5c')]]);if(!_0x461d32){switch(_0x2d8221['field']){case _0x8ea2('0x72'):if(_0x2d8221['value']==0x1){_0x59e3df[_0x8ea2('0x73')]('`'+_0x2d8221['field']+_0x8ea2('0x74'));}else{_0x59e3df[_0x8ea2('0x73')]('`'+_0x2d8221['field']+'`\x20>\x200');}break;case _0x8ea2('0x75'):if(_0x2d8221['operator']===_0x8ea2('0x76')){if(_0x2d8221[_0x8ea2('0x77')][_0x8ea2('0x46')]('\x20')[_0x8ea2('0x54')]>0x1){_0x2bbec0[_0x479c05]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8ea2('0x78')](_0x2d8221[_0x8ea2('0x77')]),null);}else{var _0x39776d='%'+_0x2d8221[_0x8ea2('0x77')]+'%';_0x2bbec0[_0x479c05](_0x8ea2('0x79'),_0x39776d,_0x39776d,_0x39776d);}}else{_0x461d32=_[_0x8ea2('0x71')](_0x2d6bbb,[_0x8ea2('0x3c'),_0x8ea2('0x7a')]);_0x2d8221[_0x8ea2('0x5c')]=_0x8ea2('0x7a');_0x3d55db=as[_0x8ea2('0x7b')](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db['text'],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x30')]);}break;case _0x8ea2('0x7d'):var _0x219f78=_0x2d8221[_0x8ea2('0x77')][_0x8ea2('0x46')](',')[_0x8ea2('0x43')](function(_0xefb7b){return Number(_0xefb7b);});_0x219f78[_0x8ea2('0x47')](function(_0x35cfc5){_0x2b8662['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x35cfc5+',%');});_0x11824e=_[_0x8ea2('0x7e')](_0x11824e,_0x219f78);break;case _0x8ea2('0x7f'):if(_0x2d8221[_0x8ea2('0x80')]===_0x8ea2('0x76')){_0x2bbec0[_0x479c05](_0x8ea2('0x81'),'%'+_0x2d8221['value']+'%',null);}else{_0x461d32=_['find'](_0x2d6bbb,['name',_0x8ea2('0x82')]);_0x2d8221[_0x8ea2('0x5c')]=_0x8ea2('0x82');_0x3d55db=as[_0x8ea2('0x7b')](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db['value'][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')]['end']);}break;case'body':_0x3d55db=as[_0x8ea2('0x7b')]('me',null,_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x30')]);break;}}else{var _0x3d55db=as['buildExpression'](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db['value'][_0x8ea2('0x30')]);}}}else{var _0x356099=_(_0x5352b9[_0x8ea2('0x4e')])['keys']()[_0x8ea2('0x43')](function(_0x5c2d05){return _['some'](_0x2d6bbb,[_0x8ea2('0x3c'),_0x5c2d05])?_0x5c2d05:undefined;})[_0x8ea2('0x84')]()['value']();if(!_['isEmpty'](_0x356099)){_0x356099['forEach'](function(_0x167f15){if(_0x167f15==='ChatWebsiteId'){_0x59e3df['where'](_0x8ea2('0x85'),[][_0x8ea2('0x86')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15]));}else if(_0x167f15===_0x8ea2('0x87')){var _0x1681d8=JSON[_0x8ea2('0x88')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15])[_0x8ea2('0x89')];var _0x14a5de=JSON[_0x8ea2('0x88')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15])[_0x8ea2('0x8a')];_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0x8b'),_0x1681d8,_0x14a5de);}else{if(_0x5352b9['query'][_0x167f15]===_0x8ea2('0x8c')){_0x59e3df[_0x8ea2('0x59')]('i.'+_0x167f15+_0x8ea2('0x8d'));}else{_0x59e3df['where']('i.'+_0x167f15+_0x8ea2('0x8e'),_0x5352b9['query'][_0x167f15]);}}});}if(_0x5352b9[_0x8ea2('0x4e')]['read']){if(_0x5352b9[_0x8ea2('0x4e')]['read']==0x1){_0x59e3df[_0x8ea2('0x73')](_0x8ea2('0x8f'));}else{_0x59e3df['having'](_0x8ea2('0x90'));}}if(_0x5352b9['query'][_0x8ea2('0x91')]){_0x11824e=_[_0x8ea2('0x92')](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x91')])?_0x5352b9[_0x8ea2('0x4e')]['tag']:new Array(_0x5352b9['query'][_0x8ea2('0x91')]);_0x11824e['forEach'](function(_0x410f78){_0x2b8662['or'](_0x8ea2('0x93'),'%,'+_0x410f78+',%');});}if(_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x94')]){var _0x262cef=_0x5352b9[_0x8ea2('0x4e')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8ea2('0x95')](_0x262cef)){_0x2bbec0['or']('i.id\x20LIKE\x20?',_0x262cef+'%');}else{_0x2bbec0['or'](_0x8ea2('0x96'),qs[_0x8ea2('0x78')](_0x262cef))['or'](_0x8ea2('0x97'),_0x262cef+'%');}}}_0x59e3df[_0x8ea2('0x59')](_0x2bbec0);_0x59e3df[_0x8ea2('0x98')](_0x8ea2('0x99'));var _0x4b4d64={'type':db[_0x8ea2('0x9a')][_0x8ea2('0x9b')][_0x8ea2('0x9c')],'raw':!![]};var _0x335a96=_0x59e3df[_0x8ea2('0x9d')]();_0x335a96['field']('i.id');_0x335a96[_0x8ea2('0x5c')](_0x8ea2('0x9e'),_0x8ea2('0x72'));if(_0x1ef615[_0x8ea2('0x57')]){_0x1ef615[_0x8ea2('0x57')][_0x8ea2('0x47')](function(_0x2e0bbe){var _0x9c4960=_0x2e0bbe[0x0]===_0x8ea2('0x9f')?_0x2e0bbe[0x0]:'i.'+_0x2e0bbe[0x0];_0x59e3df[_0x8ea2('0x57')](_0x9c4960,_0x2e0bbe[0x1]===_0x8ea2('0xa0')?![]:!![]);});}if(!_[_0x8ea2('0xa1')](_0x11824e)){_0x59e3df[_0x8ea2('0x73')](_0x2b8662);_0x335a96[_0x8ea2('0x59')](_0x8ea2('0xa2'),_0x11824e);}BPromise[_0x8ea2('0xa3')]()[_0x8ea2('0x25')](function(){if(!_0x21485a){if(_0x5352b9['query']['ChatWebsiteId'])return;_0x335a96[_0x8ea2('0x59')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0xa4'));return;}if(_0x5352b9['user'][_0x8ea2('0xa5')]!=='agent')return;return _0x5352b9[_0x8ea2('0xa6')][_0x8ea2('0xa7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x17dee8){if(_[_0x8ea2('0xa1')](_0x17dee8)){_0x335a96[_0x8ea2('0x59')](_0x8ea2('0xa8'));_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0xa8'));}else{_0x335a96[_0x8ea2('0x59')](_0x8ea2('0x85'),_[_0x8ea2('0x43')](_0x17dee8,'id'));_0x59e3df[_0x8ea2('0x59')]('i.ChatWebsiteId\x20IN\x20?',_[_0x8ea2('0x43')](_0x17dee8,'id'));}});})[_0x8ea2('0x25')](function(){if(_0x5352b9['user'][_0x8ea2('0xa5')]==='agent'&&!_0x21485a&&!_0x5352b9['query']['ChatWebsiteId'])return[];return db[_0x8ea2('0xa9')]['query'](_0x335a96[_0x8ea2('0xaa')](),_0x4b4d64);})[_0x8ea2('0x25')](function(_0x12ed20){_0x5cb6ad[_0x8ea2('0x35')]=_0x12ed20[_0x8ea2('0x54')];if(_0x5cb6ad[_0x8ea2('0x35')]===0x0)return[];return db['sequelize'][_0x8ea2('0x4e')](_0x24a22a['toString'](),_0x4b4d64)[_0x8ea2('0x25')](function(_0x18aa81){_0x4afd85=_[_0x8ea2('0xab')](_0x18aa81,'id');_0x4b4d64=_[_0x8ea2('0x3d')](_0x4b4d64,{'model':db[_0x8ea2('0x49')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5352b9['query'][_0x8ea2('0x53')]){_0x1ef615[_0x8ea2('0x52')][_0x8ea2('0x47')](function(_0x2a82b2){_0x59e3df[_0x8ea2('0x5c')]('i.'+_0x2a82b2);});}else{_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0x9e'),_0x8ea2('0x72'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xac'),_0x8ea2('0xad'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xae'),_0x8ea2('0xaf'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb0'),_0x8ea2('0x9f'));_0x59e3df['field'](_0x8ea2('0xb1'));_0x59e3df['field']('c.firstName',_0x8ea2('0xb2'));_0x59e3df[_0x8ea2('0x5c')]('c.lastName',_0x8ea2('0xb3'));_0x59e3df[_0x8ea2('0x5c')]('c.email',_0x8ea2('0xb4'));_0x59e3df[_0x8ea2('0x5c')]('c.phone',_0x8ea2('0xb5'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb6'),_0x8ea2('0xb7'));_0x59e3df[_0x8ea2('0x5c')]('c.fax',_0x8ea2('0xb8'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb9'),_0x8ea2('0xba'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xbb'),_0x8ea2('0xbc'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xbd'),'TagIds');}if(_0x1ef615[_0x8ea2('0x34')])_0x59e3df['limit'](_0x1ef615[_0x8ea2('0x34')]);if(_0x1ef615[_0x8ea2('0x32')])_0x59e3df[_0x8ea2('0x32')](_0x1ef615[_0x8ea2('0x32')]);return db[_0x8ea2('0xa9')]['query'](_0x59e3df[_0x8ea2('0xaa')](),_0x4b4d64);})[_0x8ea2('0x25')](function(_0x4fdd16){if(_0x4fdd16['length']>0x0)_0x48aebf[_0x8ea2('0x59')](_0x8ea2('0xbe'),_['map'](_0x4fdd16,'id'));return db['sequelize'][_0x8ea2('0x4e')](_0x48aebf[_0x8ea2('0xaa')](),_0x4b4d64)['then'](function(_0x2b7e80){var _0x2f6673=_[_0x8ea2('0xbf')](_0x2b7e80,_0x8ea2('0xc0'));var _0xdf4de9=[];_0x4fdd16['forEach'](function(_0x2e3a5d){_0xdf4de9[_0x8ea2('0xc1')](updateChatInteraction(_0x2e3a5d,_0x4afd85,_0x2f6673));});return BPromise[_0x8ea2('0xc2')](_0xdf4de9);});});})[_0x8ea2('0x25')](function(_0x412af1){_0x5cb6ad['rows']=_0x412af1;return _0x5cb6ad;})[_0x8ea2('0x25')](respondWithFilteredResult(_0x3afb80,_0x1ef615))['catch'](handleError(_0x3afb80,null));};exports['show']=function(_0x9468be,_0x17e9fc){var _0x5c95ec={'raw':![],'where':{'id':_0x9468be[_0x8ea2('0xc3')]['id']}},_0x239516={};_0x239516[_0x8ea2('0x4d')]=_[_0x8ea2('0x4f')](db[_0x8ea2('0x49')][_0x8ea2('0x4a')]);_0x239516['query']=_[_0x8ea2('0x4f')](_0x9468be[_0x8ea2('0x4e')]);_0x239516[_0x8ea2('0x50')]=_['intersection'](_0x239516[_0x8ea2('0x4d')],_0x239516[_0x8ea2('0x4e')]);_0x5c95ec[_0x8ea2('0x52')]=_[_0x8ea2('0x51')](_0x239516[_0x8ea2('0x4d')],qs['fields'](_0x9468be[_0x8ea2('0x4e')][_0x8ea2('0x53')]));_0x5c95ec[_0x8ea2('0x52')]=_0x5c95ec[_0x8ea2('0x52')]['length']?_0x5c95ec['attributes']:_0x239516[_0x8ea2('0x4d')];if(_0x9468be['query'][_0x8ea2('0xc4')]){_0x5c95ec['include']=[{'all':!![]}];}_0x5c95ec=_[_0x8ea2('0x3d')]({},_0x5c95ec,_0x9468be[_0x8ea2('0xc5')]);return db[_0x8ea2('0x49')][_0x8ea2('0x71')](_0x5c95ec)[_0x8ea2('0x25')](handleEntityNotFound(_0x17e9fc,null))[_0x8ea2('0x25')](respondWithResult(_0x17e9fc,null))[_0x8ea2('0x2e')](handleError(_0x17e9fc,null));};exports['create']=function(_0x2c5677,_0x224fca){return db[_0x8ea2('0x49')][_0x8ea2('0xc6')](_0x2c5677[_0x8ea2('0xc7')],{})[_0x8ea2('0x25')](respondWithResult(_0x224fca,0xc9))['catch'](handleError(_0x224fca,null));};exports[_0x8ea2('0x38')]=function(_0x463372,_0x76085){if(_0x463372[_0x8ea2('0xc7')]['id']){delete _0x463372['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x463372[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x76085,null))[_0x8ea2('0x25')](saveUpdates(_0x463372['body'],null))[_0x8ea2('0x25')](respondWithResult(_0x76085,null))[_0x8ea2('0x2e')](handleError(_0x76085,null));};exports[_0x8ea2('0x39')]=function(_0x500b47,_0x331019){return db[_0x8ea2('0x49')]['find']({'where':{'id':_0x500b47[_0x8ea2('0xc3')]['id']}})['then'](handleEntityNotFound(_0x331019,null))['then'](removeEntity(_0x331019,null))[_0x8ea2('0x2e')](handleError(_0x331019,null));};exports[_0x8ea2('0xc8')]=function(_0x405020,_0x5c9359){return db[_0x8ea2('0x49')][_0x8ea2('0xc8')]()[_0x8ea2('0x25')](respondWithResult(_0x5c9359,null))[_0x8ea2('0x2e')](handleError(_0x5c9359,null));};exports[_0x8ea2('0xc9')]=function(_0x11c59e,_0x11b02a){var _0x5ab2c4=_0x11c59e[_0x8ea2('0xc3')]['id'];var _0x111f97;var _0xf76d70;var _0x384500;return db[_0x8ea2('0x49')][_0x8ea2('0xca')]({'where':{'id':_0x5ab2c4}})[_0x8ea2('0x25')](function(_0x568581){_0x111f97=_0x568581;return db[_0x8ea2('0xcb')][_0x8ea2('0xca')]({'where':{'id':_0x568581[_0x8ea2('0xcc')]},'attributes':['id',_0x8ea2('0xcd'),_0x8ea2('0xce'),'vidaooTopic',_0x8ea2('0xcf'),_0x8ea2('0xd0')],'raw':!![]});})[_0x8ea2('0x25')](function(_0x1c336e){if(_0x1c336e&&_0x1c336e[_0x8ea2('0xcd')]&&_0x1c336e[_0x8ea2('0xce')]){_0xf76d70=_0x1c336e;var _0x473ae2={'interaction':{'id':_0x5ab2c4},'agent':{'id':_0x11c59e[_0x8ea2('0xa6')]['id'],'name':_0x11c59e[_0x8ea2('0xa6')]['name'],'fullname':_0x11c59e['user']['fullname'],'email':_0x11c59e[_0x8ea2('0xa6')]['email']},'contact':_0x11c59e[_0x8ea2('0xc7')][_0x8ea2('0x3e')],'account':_0x11c59e[_0x8ea2('0xc7')][_0x8ea2('0x41')]};var _0x6c0ccc={'rejectUnauthorized':![],'method':_0x8ea2('0xd1'),'url':_0x8ea2('0xd2'),'headers':{'X-APIKEY':_0x1c336e[_0x8ea2('0xcd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x11c59e[_0x8ea2('0xa6')][_0x8ea2('0xd3')]],'buttons':null,'topic':_0xf76d70['vidaooTopic'],'note':_[_0x8ea2('0xd4')](_0xf76d70[_0x8ea2('0xcf')])?null:getMustacheRender(_0xf76d70[_0x8ea2('0xcf')],_0x473ae2),'metadata':null},'redirect':_0x8ea2('0xd5'),'json':!![]};try{if(!_[_0x8ea2('0xd4')](_0xf76d70[_0x8ea2('0xd0')])){var _0xc6888c=getMustacheRender(_0xf76d70[_0x8ea2('0xd0')],_0x473ae2);var _0x152d46=JSON[_0x8ea2('0x88')](_0xc6888c);_0x6c0ccc[_0x8ea2('0xc7')][_0x8ea2('0xd6')]=_0x152d46;}}catch(_0x465e7f){throw new db[(_0x8ea2('0x9a'))][(_0x8ea2('0xd7'))](_0x8ea2('0xd8'));}return rp(_0x6c0ccc);}else{throw new db[(_0x8ea2('0x9a'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x4b2c0f){_0x384500=_0x4b2c0f;if(_0x384500['id']){var _0x2fcddc={'body':_0x384500[_0x8ea2('0xd9')],'ChatWebsiteId':_0xf76d70['id'],'ChatInteractionId':_0x111f97['id'],'direction':'out','UserId':_0x11c59e[_0x8ea2('0xa6')]['id']};return db[_0x8ea2('0xda')][_0x8ea2('0xc6')](_0x2fcddc,{});}else{throw new db[(_0x8ea2('0x9a'))]['ValidationError'](_0x8ea2('0xdb'));}})['then'](function(){return _0x111f97[_0x8ea2('0xdc')]({'vidaooSessionId':_0x384500['id']});})[_0x8ea2('0x25')](respondWithResult(_0x11b02a,null))[_0x8ea2('0x2e')](handleError(_0x11b02a,null));};exports[_0x8ea2('0xdd')]=function(_0x3b6b03,_0x3292bc){if(_0x3b6b03['body']['id']){delete _0x3b6b03['body']['id'];}return db[_0x8ea2('0x49')][_0x8ea2('0x71')]({'where':{'id':_0x3b6b03['params']['id']},'include':[{'model':db[_0x8ea2('0xde')],'as':'Contact'}]})[_0x8ea2('0x25')](handleEntityNotFound(_0x3292bc,null))[_0x8ea2('0x25')](saveUpdates(_0x3b6b03[_0x8ea2('0xc7')],null))[_0x8ea2('0x25')](respondWithResult(_0x3292bc,null))[_0x8ea2('0x2e')](handleError(_0x3292bc,null));};exports[_0x8ea2('0xdf')]=function(_0x1383b4,_0x4c1b9d,_0x3f3822){if(_0x1383b4[_0x8ea2('0xc7')]['id']){delete _0x1383b4[_0x8ea2('0xc7')]['id'];}return db[_0x8ea2('0x49')][_0x8ea2('0x71')]({'where':{'id':_0x1383b4[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](function(_0x1c974d){if(!_0x1c974d){logger[_0x8ea2('0x2b')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x8ea2('0xdf'),0x194,_0x8ea2('0xe0'));_0x4c1b9d[_0x8ea2('0x3a')](0x194);}else{if(_0x1c974d['UserId']){throw new db[(_0x8ea2('0x9a'))][(_0x8ea2('0xd7'))](_0x8ea2('0xe1'));}}return _0x1c974d;})[_0x8ea2('0x25')](function(_0xe18090){if(_0xe18090){return _0xe18090[_0x8ea2('0x38')]({'closed':_0x1383b4['body']['closed'],'disposition':_0x1383b4[_0x8ea2('0xc7')][_0x8ea2('0xe2')]})[_0x8ea2('0x25')](function(_0x695f4a){return _0x695f4a;});}})[_0x8ea2('0x25')](function(_0x57ff72){return respondWithRpcPromise(_0x8ea2('0xe3'),'abandon',_0x1383b4[_0x8ea2('0xc7')],client9004);})[_0x8ea2('0x25')](respondWithResult(_0x4c1b9d,null))['catch'](handleError(_0x4c1b9d,null));};exports[_0x8ea2('0xe4')]=function(_0x254b51,_0x2c11d2,_0x2aaa88){_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0x3c')]=_0x254b51[_0x8ea2('0xe5')][_0x8ea2('0xe6')];_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0xe7')]=_0x254b51['file'][_0x8ea2('0xe8')];_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0x4b')]=_0x254b51['file'][_0x8ea2('0xe9')];return db['Attachment'][_0x8ea2('0xc6')](_0x254b51[_0x8ea2('0xc7')])[_0x8ea2('0x25')](respondWithResult(_0x2c11d2,0xc9))[_0x8ea2('0x2e')](handleError(_0x2c11d2,null));};exports[_0x8ea2('0xea')]=function(_0x1786ac,_0x7a45a8,_0x3a68e2){return db[_0x8ea2('0x49')]['findOne']({'where':{'id':_0x1786ac[_0x8ea2('0xc3')]['id']},'raw':!![]})[_0x8ea2('0x25')](handleEntityNotFound(_0x7a45a8,null))[_0x8ea2('0x25')](function(_0x8d4abd){if(_0x8d4abd){if(_0x8d4abd[_0x8ea2('0xeb')]){return _0x7a45a8[_0x8ea2('0x2f')](0x193)[_0x8ea2('0x31')]({'status':0x193,'message':_0x8ea2('0xec')});}return db[_0x8ea2('0xed')]['findOne']({'where':{'id':_0x1786ac[_0x8ea2('0x4e')][_0x8ea2('0xee')]},'raw':!![]})[_0x8ea2('0x25')](handleEntityNotFound(_0x7a45a8,null));}})[_0x8ea2('0x25')](function(_0xcbb6b3){if(_0xcbb6b3){var _0x4bdbe0=_0xcbb6b3[_0x8ea2('0xef')]!==null;var _0x44791f=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],_0x8ea2('0xf2'));if(_0x4bdbe0){_0x44791f=path['join'](_0x44791f,_0x8ea2('0xf3'));}var _0x4e7aff=path[_0x8ea2('0xf0')](_0x44791f,_0xcbb6b3[_0x8ea2('0xe7')]);return _0x7a45a8[_0x8ea2('0xf4')](_0x4e7aff);}})['catch'](handleError(_0x7a45a8,null));};exports[_0x8ea2('0xf5')]=function(_0x48a2e2,_0x4e804c){var _0x487bab=null;var _0x1a0966=null;var _0x50087b=null;var _0x196b89=null;if(_0x48a2e2[_0x8ea2('0xc7')]['id']){delete _0x48a2e2[_0x8ea2('0xc7')]['id'];}if(_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf6')]){_0x196b89=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],_0x8ea2('0xf7'),util['format']('transcript-%s.txt',Date[_0x8ea2('0xf8')]()));_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf9')]=_0x196b89;}return db['ChatInteraction']['find']({'where':{'id':_0x48a2e2['params']['id']},'include':[{'model':db[_0x8ea2('0xda')],'as':'Messages','include':[{'model':db['User'],'as':_0x8ea2('0x7f')}]}]})[_0x8ea2('0x25')](handleEntityNotFound(_0x4e804c,null))['then'](saveUpdates(_0x48a2e2['body'],null))[_0x8ea2('0x25')](function(_0x48eac8){if(_0x48eac8){_0x487bab=_0x48eac8;return db['ChatWebsite'][_0x8ea2('0x71')]({'where':{'id':_0x487bab[_0x8ea2('0xcc')]}});}})[_0x8ea2('0x25')](function(_0x54da21){if(_0x54da21){_0x50087b=_0x54da21;return db[_0x8ea2('0xde')][_0x8ea2('0x71')]({'where':{'id':_0x487bab[_0x8ea2('0x7a')]}});}})[_0x8ea2('0x25')](function(_0x3a43d5){if(_0x3a43d5){_0x1a0966=_0x3a43d5;if(_0x196b89){var _0x535b01=null;for(var _0x22e4cd=0x1;_0x22e4cd<_0x487bab['Messages'][_0x8ea2('0x54')];++_0x22e4cd){_0x535b01=_0x487bab['Messages'][_0x22e4cd];var _0x230a70=_0x535b01['UserId']?util['format'](_0x8ea2('0xfa'),_0x50087b[_0x8ea2('0xfb')],_0x535b01[_0x8ea2('0x82')]):_0x8ea2('0xfc');var _0x332670=_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xfd')]||util[_0x8ea2('0xfe')]('%s%d',_0x8ea2('0xff'),_0x535b01[_0x8ea2('0x7a')]);switch(_0x50087b[_0x8ea2('0x100')]){case _0x8ea2('0x101'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?util['format'](_0x8ea2('0xfa'),_0x50087b['agentAlias'],_0x535b01[_0x8ea2('0x82')]):'System';break;case _0x8ea2('0x102'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?_0x535b01[_0x8ea2('0x7f')][_0x8ea2('0x103')]||_0x535b01['User']['fullname']:'System';break;case _0x8ea2('0x104'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?_0x535b01['User'][_0x8ea2('0x105')]:_0x8ea2('0xfc');break;default:_0x230a70=_0x535b01[_0x8ea2('0x82')]?util[_0x8ea2('0xfe')](_0x8ea2('0xfa'),_0x50087b[_0x8ea2('0xfb')],_0x535b01[_0x8ea2('0x82')]):_0x8ea2('0xfc');}var _0x422280=util[_0x8ea2('0xfe')](_0x8ea2('0x106'),moment(_0x535b01[_0x8ea2('0x87')])[_0x8ea2('0xfe')]('MM/DD/YYYY\x20HH:mm:ss'),_0x535b01[_0x8ea2('0x107')]==='in'?_0x332670:_0x230a70,_0x535b01['body']);if(!_0x535b01['secret']){fs[_0x8ea2('0x108')](_0x196b89,_0x422280);}}return db['MailAccount'][_0x8ea2('0xca')]({'where':{'service':!![]},'include':[{'model':db[_0x8ea2('0x109')],'as':_0x8ea2('0x10a'),'raw':!![]}]});}}})[_0x8ea2('0x25')](function(_0xff0fae){if(_0xff0fae&&_0xff0fae['Smtp']&&_0x48a2e2[_0x8ea2('0xc7')]){var _0x3f5688={'tls':{'rejectUnauthorized':![]}};if(_0xff0fae[_0x8ea2('0x10a')]['service']){_0x3f5688['service']=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10b')];}else{_0x3f5688['host']=_0xff0fae[_0x8ea2('0x10a')]['host'];_0x3f5688[_0x8ea2('0x10c')]=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10c')];_0x3f5688[_0x8ea2('0x10d')]=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10d')];}if(_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10e')]){_0x3f5688[_0x8ea2('0x10f')]={'user':_0xff0fae['Smtp']['user'],'pass':_0xff0fae[_0x8ea2('0x10a')]['pass']};}return respondWithRpcPromise(_0x8ea2('0x110'),_0x8ea2('0x111'),{'account':_0x3f5688,'message':{'from':util[_0x8ea2('0xfe')](_0x8ea2('0x112'),_0xff0fae['name'],_0xff0fae[_0x8ea2('0xd3')]||_0xff0fae[_0x8ea2('0x10a')]['user']),'to':_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf6')],'subject':_0x8ea2('0x113'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x48a2e2['body'][_0x8ea2('0xf6')]),'attachments':[{'path':_0x196b89}]}})['then'](function(){return _0x487bab;})[_0x8ea2('0x2e')](function(_0x488acb){console[_0x8ea2('0x2b')](_0x488acb);});}else{return _0x487bab;}})[_0x8ea2('0x25')](respondWithStatusCode(_0x4e804c,0xc8))[_0x8ea2('0x2e')](handleError(_0x4e804c,null));};exports[_0x8ea2('0x114')]=function(_0x54925a,_0x295339,_0x55c23c){return db['ChatMessage']['find']({'where':{'id':_0x54925a[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x295339,null))[_0x8ea2('0x25')](function(_0x48b51d){if(_0x48b51d){return _0x48b51d[_0x8ea2('0x114')](_0x54925a[_0x8ea2('0xc7')][_0x8ea2('0x115')],_[_0x8ea2('0x116')](_0x54925a[_0x8ea2('0xc7')],[_0x8ea2('0x115'),'id'])||{});}})[_0x8ea2('0x25')](respondWithResult(_0x295339,null))[_0x8ea2('0x2e')](handleError(_0x295339,null));};exports[_0x8ea2('0x117')]=function(_0x102d70,_0x2b014d,_0xc35654){var _0x355b91={'raw':![],'where':{}};var _0x1cf414={};var _0x48e543={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8ea2('0xca')]({'where':{'id':_0x102d70['params']['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x2b014d,null))[_0x8ea2('0x25')](function(_0x3ebbc8){if(_0x3ebbc8){_0x1cf414['model']=_[_0x8ea2('0x4f')](db['ChatMessage']['rawAttributes']);_0x1cf414[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x102d70[_0x8ea2('0x4e')]);_0x1cf414[_0x8ea2('0x50')]=_[_0x8ea2('0x51')](_0x1cf414[_0x8ea2('0x4d')],_0x1cf414[_0x8ea2('0x4e')]);_0x355b91['attributes']=_[_0x8ea2('0x51')](_0x1cf414[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x102d70['query'][_0x8ea2('0x53')]));_0x355b91[_0x8ea2('0x52')]=_0x355b91[_0x8ea2('0x52')]['length']?_0x355b91[_0x8ea2('0x52')]:_0x1cf414[_0x8ea2('0x4d')];if(!_0x102d70[_0x8ea2('0x4e')]['hasOwnProperty']('nolimit')){_0x355b91[_0x8ea2('0x34')]=qs['limit'](_0x102d70[_0x8ea2('0x4e')]['limit']);_0x355b91[_0x8ea2('0x32')]=qs[_0x8ea2('0x32')](_0x102d70[_0x8ea2('0x4e')][_0x8ea2('0x32')]);}_0x355b91[_0x8ea2('0x57')]=qs['sort'](_0x102d70[_0x8ea2('0x4e')][_0x8ea2('0x58')]);_0x355b91[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_[_0x8ea2('0x5a')](_0x102d70[_0x8ea2('0x4e')],_0x1cf414['filters']));_0x355b91['where'][_0x8ea2('0xc0')]=_0x3ebbc8['id'];if(_0x102d70[_0x8ea2('0x4e')]['filter']){_0x355b91[_0x8ea2('0x59')]=_[_0x8ea2('0x3d')](_0x355b91[_0x8ea2('0x59')],{'$or':_[_0x8ea2('0x43')](_0x355b91['attributes'],function(_0x19ea2b){var _0x4450e8={};_0x4450e8[_0x19ea2b]={'$like':'%'+_0x102d70['query'][_0x8ea2('0x94')]+'%'};return _0x4450e8;})});}if(_0x102d70['query'][_0x8ea2('0x89')]){var _0x479b40=_0x102d70['query'][_0x8ea2('0x89')][_0x8ea2('0x46')](',');var _0xbb5964={};_0xbb5964[_0x479b40[0x0]]={'$gte':moment(_0x479b40[0x1])[_0x8ea2('0xfe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x355b91[_0x8ea2('0x59')]=_[_0x8ea2('0x3d')](_0x355b91[_0x8ea2('0x59')],_0xbb5964);}_0x355b91=_['merge']({},_0x355b91,_0x102d70[_0x8ea2('0xc5')]);return db[_0x8ea2('0xda')][_0x8ea2('0x35')]({'where':_0x355b91[_0x8ea2('0x59')]})[_0x8ea2('0x25')](function(_0x46d38e){_0x48e543[_0x8ea2('0x35')]=_0x46d38e;if(_0x102d70['query'][_0x8ea2('0xc4')]){_0x355b91[_0x8ea2('0x118')]=[{'all':!![]}];}return db[_0x8ea2('0xda')][_0x8ea2('0x119')](_0x355b91);})[_0x8ea2('0x25')](function(_0x23f247){_0x48e543[_0x8ea2('0x11a')]=_0x23f247;return _0x48e543;});}})[_0x8ea2('0x25')](respondWithFilteredResult(_0x2b014d,_0x355b91))[_0x8ea2('0x2e')](handleError(_0x2b014d,null));};exports[_0x8ea2('0x11b')]=function(_0x3a37fb,_0x455009,_0x556919){var _0x58a0e5={'where':{}},_0x3be2ce={},_0x56a973={'count':0x0,'rows':[]};return db[_0x8ea2('0x49')][_0x8ea2('0xca')]({'where':{'id':_0x3a37fb[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x455009,null))[_0x8ea2('0x25')](function(_0x515381){if(_0x515381){_0x3be2ce[_0x8ea2('0x4d')]=_[_0x8ea2('0x4f')](db['ChatMessage'][_0x8ea2('0x4a')]);_0x3be2ce[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x3a37fb[_0x8ea2('0x4e')]);_0x3be2ce['filters']=_[_0x8ea2('0x51')](_0x3be2ce[_0x8ea2('0x4d')],_0x3be2ce[_0x8ea2('0x4e')]);_0x58a0e5[_0x8ea2('0x52')]=_['intersection'](_0x3be2ce[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x3a37fb[_0x8ea2('0x4e')]['fields']));_0x58a0e5[_0x8ea2('0x52')]=_0x58a0e5[_0x8ea2('0x52')][_0x8ea2('0x54')]?_0x58a0e5['attributes']:_0x3be2ce['model'];if(!_0x3a37fb[_0x8ea2('0x4e')]['hasOwnProperty'](_0x8ea2('0x56'))){_0x58a0e5[_0x8ea2('0x34')]=qs[_0x8ea2('0x34')](_0x3a37fb[_0x8ea2('0x4e')]['limit']);_0x58a0e5[_0x8ea2('0x32')]=qs['offset'](_0x3a37fb['query']['offset']);}_0x58a0e5['order']=qs[_0x8ea2('0x58')](_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x58')]);_0x58a0e5[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_['pick'](_0x3a37fb['query'],_0x3be2ce[_0x8ea2('0x50')]));_0x58a0e5['where']['ChatInteractionId']=_0x515381['id'];if(_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x94')]){_0x58a0e5[_0x8ea2('0x59')]=_['merge'](_0x58a0e5[_0x8ea2('0x59')],{'$or':_['map'](_0x58a0e5[_0x8ea2('0x52')],function(_0x4041ec){var _0x56178b={};_0x56178b[_0x4041ec]={'$like':'%'+_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x94')]+'%'};return _0x56178b;})});}_0x58a0e5['where'][_0x8ea2('0x11c')]=![];if(_0x3a37fb[_0x8ea2('0x4e')]['id']){_0x58a0e5[_0x8ea2('0x59')]['id']={'$gt':_0x3a37fb[_0x8ea2('0x4e')]['id']};}_0x58a0e5=_[_0x8ea2('0x3d')]({},_0x58a0e5,_0x3a37fb[_0x8ea2('0xc5')]);return db[_0x8ea2('0xda')][_0x8ea2('0x35')]({'where':_0x58a0e5[_0x8ea2('0x59')]})['then'](function(_0xcedece){_0x56a973['count']=_0xcedece;_0x58a0e5[_0x8ea2('0x118')]=[];if(_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x11d')]){_0x58a0e5[_0x8ea2('0x118')][_0x8ea2('0xc1')]({'model':db[_0x8ea2('0x7f')],'as':_0x8ea2('0x7f'),'attributes':['id',_0x8ea2('0x105'),'alias']});}if(_0x3a37fb['query'][_0x8ea2('0xc4')]){_0x58a0e5[_0x8ea2('0x118')]=[{'all':!![]}];}return db[_0x8ea2('0xda')][_0x8ea2('0x119')](_0x58a0e5);})[_0x8ea2('0x25')](function(_0x52bf7c){_0x56a973[_0x8ea2('0x11a')]=_0x52bf7c;return _0x56a973;});}})[_0x8ea2('0x25')](respondWithFilteredResult(_0x455009,_0x58a0e5))['catch'](handleError(_0x455009,null));};exports[_0x8ea2('0x11e')]=function(_0x3be5d0,_0x3ac848,_0x52ce76){return db['ChatInteraction'][_0x8ea2('0x71')]({'where':{'id':_0x3be5d0['params']['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x3ac848,null))[_0x8ea2('0x25')](function(_0x1030c9){if(_0x1030c9){return _0x1030c9[_0x8ea2('0x11f')](_0x3be5d0[_0x8ea2('0xc7')][_0x8ea2('0x115')],_[_0x8ea2('0x116')](_0x3be5d0[_0x8ea2('0xc7')],[_0x8ea2('0x115'),'id'])||{})[_0x8ea2('0x120')](function(){return db[_0x8ea2('0x7d')][_0x8ea2('0x119')]({'attributes':['id',_0x8ea2('0x3c'),_0x8ea2('0x5d')],'where':{'id':_0x3be5d0[_0x8ea2('0xc7')][_0x8ea2('0x115')]}});})[_0x8ea2('0x25')](function(_0x452b94){socket[_0x8ea2('0x121')]('chatInteractionTags:save',{'id':Number(_0x3be5d0['params']['id']),'tags':_0x452b94||[]});return{'id':Number(_0x3be5d0['params']['id']),'tags':_0x452b94||[]};});}})[_0x8ea2('0x25')](respondWithResult(_0x3ac848,null))[_0x8ea2('0x2e')](handleError(_0x3ac848,null));};exports[_0x8ea2('0x122')]=function(_0x9410dd,_0x497671,_0x5e3e8d){return db[_0x8ea2('0x49')]['find']({'where':{'id':_0x9410dd[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x497671,null))[_0x8ea2('0x25')](function(_0x19b042){if(_0x19b042){return _0x19b042[_0x8ea2('0x122')](_0x9410dd[_0x8ea2('0x4e')][_0x8ea2('0x115')]);}})['then'](respondWithStatusCode(_0x497671,null))[_0x8ea2('0x2e')](handleError(_0x497671,null));};exports[_0x8ea2('0xf4')]=function(_0x2dc450,_0x34e1c5){var _0x5b929c=moment()['unix']()[_0x8ea2('0xaa')]();var _0x263123=path[_0x8ea2('0xf0')](config['root'],'server',_0x8ea2('0x123'),'tmp');var _0x40e8e6=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],'server',_0x8ea2('0x123'),_0x8ea2('0x124'));var _0x2dfabc=path[_0x8ea2('0xf0')](_0x263123,_0x5b929c);var _0x515049=util['format'](_0x8ea2('0x125'),_0x2dc450[_0x8ea2('0xc3')]['id'],_0x5b929c);var _0x39000d=path['join'](_0x263123,_0x515049);var _0x3a1752=[];_0x3a1752['push']({'model':db[_0x8ea2('0x7f')],'as':'User','attributes':['id',_0x8ea2('0x105')],'raw':!![]});_0x3a1752['push']({'model':db[_0x8ea2('0xde')],'as':_0x8ea2('0x75'),'attributes':['id',_0x8ea2('0x126'),_0x8ea2('0x127')],'raw':!![]});if(_0x2dc450['query'][_0x8ea2('0x124')]){_0x3a1752[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0xed')],'as':_0x8ea2('0xed'),'raw':!![]});}var _0x5ba508=[{'model':db[_0x8ea2('0xda')],'as':_0x8ea2('0x128'),'attributes':['id',_0x8ea2('0xc7'),_0x8ea2('0x87'),_0x8ea2('0x107'),'secret',_0x8ea2('0x129')],'include':_0x3a1752}];_0x5ba508[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0xcb')],'as':_0x8ea2('0x12a'),'attributes':['id','name']});_0x5ba508[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0x7f')],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction'][_0x8ea2('0x71')]({'where':{'id':_0x2dc450[_0x8ea2('0xc3')]['id']},'include':_0x5ba508})[_0x8ea2('0x25')](handleEntityNotFound(_0x34e1c5,null))[_0x8ea2('0x25')](function(_0x3c9013){if(_0x3c9013){var _0x103c43=_0x3c9013['get']({'plain':!![]});fs['mkdirSync'](_0x2dfabc);var _0xc099b6={'channel':_0x8ea2('0x12b'),'account':_0x103c43[_0x8ea2('0x12a')]['name'],'agent':_0x103c43['Owner']?_0x103c43[_0x8ea2('0x12c')][_0x8ea2('0x105')]:'N.A.','createdAt':moment(_0x103c43[_0x8ea2('0x87')])['format'](_0x8ea2('0x12d'))[_0x8ea2('0xaa')](),'closedAt':_0x103c43[_0x8ea2('0xeb')]?moment(_0x103c43['closedAt'])[_0x8ea2('0xfe')](_0x8ea2('0x12d'))['toString']():'','disposition':_0x103c43[_0x8ea2('0xe2')],'chatInfo':{'browser':_0x103c43[_0x8ea2('0x12e')],'os':_0x103c43['osName'],'referer':_0x103c43['referer'],'customerIp':_0x103c43[_0x8ea2('0x12f')],'customerPort':_0x103c43[_0x8ea2('0x130')]?_0x103c43[_0x8ea2('0x130')]:'N.A.'},'messages':_(_0x103c43[_0x8ea2('0x128')])[_0x8ea2('0x131')]()[_0x8ea2('0x94')]({'secret':![]})[_0x8ea2('0x43')](function(_0x36799a){if(_0x36799a['Attachment']){var _0x1cc1d9=path['join'](_0x40e8e6,_0x36799a[_0x8ea2('0xed')]['basename']);if(fs[_0x8ea2('0x132')](_0x1cc1d9)){fs[_0x8ea2('0x133')](_0x1cc1d9)[_0x8ea2('0x134')](fs[_0x8ea2('0x135')](path['join'](_0x2dfabc,_0x36799a[_0x8ea2('0xed')][_0x8ea2('0xe7')])));}}return{'date':moment(_0x36799a[_0x8ea2('0x87')])[_0x8ea2('0xfe')](_0x8ea2('0x12d'))[_0x8ea2('0xaa')](),'sender':_0x36799a[_0x8ea2('0x107')]===_0x8ea2('0x136')?_0x36799a[_0x8ea2('0x7f')]?_0x36799a[_0x8ea2('0x7f')][_0x8ea2('0x105')]:'System':_0x36799a[_0x8ea2('0x75')][_0x8ea2('0x126')]+(_0x36799a[_0x8ea2('0x75')]['lastName']?'\x20'+_0x36799a[_0x8ea2('0x75')][_0x8ea2('0x127')]:''),'body':_0x36799a[_0x8ea2('0xed')]?_0x36799a[_0x8ea2('0xed')][_0x8ea2('0xe7')]:_0x36799a[_0x8ea2('0xc7')],'direction':_0x36799a[_0x8ea2('0x107')]===_0x8ea2('0x136')?'A':'C','secret':_0x36799a[_0x8ea2('0x11c')],'read':_0x36799a[_0x8ea2('0x129')],'attachment':_0x36799a['Attachment']};})[_0x8ea2('0x77')]()};return ejs[_0x8ea2('0x137')](path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],'server',_0x8ea2('0x138'),_0x8ea2('0x139')),{'interaction':_0xc099b6})[_0x8ea2('0x25')](function(_0x10d2b3){var _0x12a217=path[_0x8ea2('0xf0')](_0x2dfabc,_0x8ea2('0x13a')+_0x103c43['id']+'-'+_0x5b929c+'.pdf');var _0x44b0dc={'path':_0x12a217,'channel':_0x8ea2('0x12b'),'interactionId':_0x103c43['id']};return pdf['createPdfFromHTML'](_0x10d2b3,_0x44b0dc);})[_0x8ea2('0x25')](function(){return new BPromise(function(_0x27f5e9,_0x19b678){zipdir(_0x2dfabc,{'saveTo':_0x39000d},function(_0x50ebcd,_0x5d6c63){if(_0x50ebcd)return _0x19b678(_0x50ebcd);return _0x27f5e9(_0x5d6c63);});})[_0x8ea2('0x25')](function(){return new BPromise(function(_0x55b3a1,_0x57e228){rimraf(_0x2dfabc,function(_0x3c669b){if(_0x3c669b)_0x57e228(_0x3c669b);return _0x55b3a1();});});})[_0x8ea2('0x25')](function(){return _0x34e1c5['download'](_0x39000d,_0x515049,function(_0x688d21){if(_0x688d21){console[_0x8ea2('0x13b')]('err',_0x688d21);}else{fs[_0x8ea2('0x13c')](_0x39000d);}});});});}else{return _0x34e1c5['sendStatus'](0xc8);}})[_0x8ea2('0x2e')](handleError(_0x34e1c5,null));}; \ No newline at end of file +var _0xef0f=['alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','mailTranscript','addMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','hasOwnProperty','includeAgent','addTags','setTags','omit','emit','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','mkdirSync','Chat','Owner','N.A.','browserName','osName','existsSync','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','save','update','destroy','end','stack','name','send','render','body','contact','interaction','account','Users','TagIds','Tags','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','select','field','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','ChatWebsiteId','sequelize','toString','count','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','Contact.firstName','Contact.lastName','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','params','keys','includeAll','include','options','create','describe','createVidaooSession','ChatWebsite','findOne','vidaooEscalation','vidaooTopic','vidaooMetadata','vidaooApiKey','email','isNull','vidaooNote','follow','metadata','ValidationError','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','originalname','basename','file','filename','mimetype','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','offline-chat/','server/files/chat/upload/','format','now','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias'];(function(_0x51ffbf,_0x5abec3){var _0x39bc43=function(_0x5ee21b){while(--_0x5ee21b){_0x51ffbf['push'](_0x51ffbf['shift']());}};_0x39bc43(++_0x5abec3);}(_0xef0f,0x168));var _0xfef0=function(_0x2e4545,_0xc5d28e){_0x2e4545=_0x2e4545-0x0;var _0x473ffd=_0xef0f[_0x2e4545];return _0x473ffd;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var pdf=require(_0xfef0('0x14'));var hardwareService=require(_0xfef0('0x15'));var logger=require(_0xfef0('0x16'))(_0xfef0('0x17'));var utils=require(_0xfef0('0x18'));var config=require(_0xfef0('0x19'));var licenseUtil=require(_0xfef0('0x1a'));var db=require('../../mysqldb')['db'];config[_0xfef0('0x1b')]=_[_0xfef0('0x1c')](config[_0xfef0('0x1b')],{'host':_0xfef0('0x1d'),'port':0x18eb});var socket=require(_0xfef0('0x1e'))(new Redis(config[_0xfef0('0x1b')]));require(_0xfef0('0x1f'))['register'](socket);var jayson=require(_0xfef0('0x20'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson['client'][_0xfef0('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x284b6d,_0x3510a7,_0x1bce2f,_0x2a96d9){return new BPromise(function(_0x3f9a6c,_0x155833){var _0x2887e6=_0x2a96d9||client;return _0x2887e6['request'](_0x284b6d,_0x1bce2f)[_0xfef0('0x22')](function(_0x1642cd){logger[_0xfef0('0x23')](_0xfef0('0x24'),_0x3510a7,_0xfef0('0x25'));logger['debug'](_0xfef0('0x26'),_0x3510a7,'request\x20sent',JSON[_0xfef0('0x27')](_0x1642cd));if(_0x1642cd[_0xfef0('0x28')]){if(_0x1642cd[_0xfef0('0x28')]['code']===0x1f4){logger[_0xfef0('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x3510a7,_0x1642cd[_0xfef0('0x28')][_0xfef0('0x29')]);return _0x155833(_0x1642cd['error']['message']);}logger['error'](_0xfef0('0x24'),_0x3510a7,_0x1642cd['error'][_0xfef0('0x29')]);return _0x3f9a6c(_0x1642cd[_0xfef0('0x28')][_0xfef0('0x29')]);}else{logger[_0xfef0('0x23')](_0xfef0('0x24'),_0x3510a7,_0xfef0('0x25'));_0x3f9a6c(_0x1642cd['result']['message']);}})[_0xfef0('0x2a')](function(_0x1ffaa4){logger[_0xfef0('0x28')](_0xfef0('0x24'),_0x3510a7,_0x1ffaa4);_0x155833(_0x1ffaa4);});});}function respondWithStatusCode(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0xcc;return function(_0x5df04f){if(_0x5df04f){return _0xab231c[_0xfef0('0x2b')](_0xf60f2);}return _0xab231c[_0xfef0('0x2c')](_0xf60f2)['end']();};}function respondWithResult(_0x1a6758,_0x394bad){_0x394bad=_0x394bad||0xc8;return function(_0xca0cce){if(_0xca0cce){return _0x1a6758[_0xfef0('0x2c')](_0x394bad)[_0xfef0('0x2d')](_0xca0cce);}};}function respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c){return function(_0x3e026a){if(_0x3e026a){var _0x26cb9a=typeof _0x3e3c4c[_0xfef0('0x2e')]===_0xfef0('0x2f')&&typeof _0x3e3c4c[_0xfef0('0x30')]==='undefined';var _0x445625=_0x3e026a['count'];var _0x4eaf74=_0x26cb9a?0x0:_0x3e3c4c[_0xfef0('0x2e')];var _0x2ae54a=_0x26cb9a?_0x3e026a['count']:_0x3e3c4c['offset']+_0x3e3c4c['limit'];var _0x4f65cd;if(_0x2ae54a>=_0x445625){_0x2ae54a=_0x445625;_0x4f65cd=0xc8;}else{_0x4f65cd=0xce;}_0x1ac4a3['status'](_0x4f65cd);return _0x1ac4a3[_0xfef0('0x31')](_0xfef0('0x32'),_0x4eaf74+'-'+_0x2ae54a+'/'+_0x445625)[_0xfef0('0x2d')](_0x3e026a);}return null;};}function patchUpdates(_0x5cda6b){return function(_0x4d0778){try{jsonpatch['apply'](_0x4d0778,_0x5cda6b,!![]);}catch(_0x1f8110){return BPromise['reject'](_0x1f8110);}return _0x4d0778[_0xfef0('0x33')]();};}function saveUpdates(_0x3783f9,_0x1b9f39){return function(_0x4a2773){if(_0x4a2773){return _0x4a2773[_0xfef0('0x34')](_0x3783f9)['then'](function(_0x4234e4){return _0x4234e4;});}return null;};}function removeEntity(_0x1f21b7,_0x234d49){return function(_0xe5188e){if(_0xe5188e){return _0xe5188e[_0xfef0('0x35')]()[_0xfef0('0x22')](function(){_0x1f21b7[_0xfef0('0x2c')](0xcc)[_0xfef0('0x36')]();});}};}function handleEntityNotFound(_0x590e37,_0x24ea7c){return function(_0xea09ec){if(!_0xea09ec){_0x590e37[_0xfef0('0x2b')](0x194);}return _0xea09ec;};}function handleError(_0x36b2d1,_0xae697){_0xae697=_0xae697||0x1f4;return function(_0x262341){logger[_0xfef0('0x28')](_0x262341[_0xfef0('0x37')]);if(_0x262341[_0xfef0('0x38')]){delete _0x262341[_0xfef0('0x38')];}_0x36b2d1[_0xfef0('0x2c')](_0xae697)[_0xfef0('0x39')](_0x262341);};}function getMustacheRender(_0x366667,_0x4a8af4){return Mustache[_0xfef0('0x3a')](_0x366667,_['merge'](_0x4a8af4[_0xfef0('0x3b')],{'contact':_0x4a8af4[_0xfef0('0x3c')],'message':_0x4a8af4[_0xfef0('0x29')],'agent':_0x4a8af4['agent'],'interaction':_0x4a8af4[_0xfef0('0x3d')],'account':_0x4a8af4[_0xfef0('0x3e')]}))||'';}function getInteractionUsers(_0x3f2753,_0x5537c8){return new BPromise(function(_0x8613a0,_0x3abcc5){try{if(_0x5537c8[_0x3f2753['id']]){_0x3f2753[_0xfef0('0x3f')]=_['map'](_0x5537c8[_0x3f2753['id']],function(_0x3a6667){return{'id':_0x3a6667['id'],'fullname':_0x3a6667['fullname']};});}}catch(_0x49ed48){_0x3abcc5(_0x49ed48);}_0x8613a0(_0x3f2753);});}function getInteractionTags(_0xf30aff,_0x547a5d){return new BPromise(function(_0x5c3305,_0xbf6ddd){try{if(_0xf30aff[_0xfef0('0x40')]){_0xf30aff[_0xfef0('0x41')]=[];_0xf30aff[_0xfef0('0x40')][_0xfef0('0x42')](',')[_0xfef0('0x43')](function(_0x4dd8f8){_0xf30aff[_0xfef0('0x41')][_0xfef0('0x44')](_0x547a5d[_0x4dd8f8]);});}delete _0xf30aff['TagIds'];}catch(_0x54d5cb){_0xbf6ddd(_0x54d5cb);}_0x5c3305(_0xf30aff);});}function updateChatInteraction(_0x1d554e,_0x5dc824,_0x1fc518){return new BPromise(function(_0x22c940,_0x3c100c){return getInteractionUsers(_0x1d554e,_0x1fc518)[_0xfef0('0x22')](function(_0x199c57){return getInteractionTags(_0x199c57,_0x5dc824);})[_0xfef0('0x22')](function(_0x166a7b){_0x22c940(_0x166a7b);})[_0xfef0('0x2a')](function(_0x4e63f3){_0x3c100c(_0x4e63f3);});});}exports[_0xfef0('0x45')]=function(_0x50e372,_0x4b6da1){var _0x18c656={},_0x17d7f2={},_0x5bf416={'count':0x0,'rows':[]};var _0x2af79f=_['map'](db[_0xfef0('0x46')][_0xfef0('0x47')],function(_0x1f252e){return{'name':_0x1f252e[_0xfef0('0x48')],'type':_0x1f252e['type'][_0xfef0('0x49')]};});_0x17d7f2[_0xfef0('0x4a')]=_['map'](_0x2af79f,'name');_0x17d7f2[_0xfef0('0x4b')]=_['keys'](_0x50e372[_0xfef0('0x4b')]);_0x17d7f2[_0xfef0('0x4c')]=_[_0xfef0('0x4d')](_0x17d7f2[_0xfef0('0x4a')],_0x17d7f2[_0xfef0('0x4b')]);_0x18c656[_0xfef0('0x4e')]=_['intersection'](_0x17d7f2[_0xfef0('0x4a')],qs['fields'](_0x50e372['query'][_0xfef0('0x4f')]));_0x18c656[_0xfef0('0x4e')]=_0x18c656[_0xfef0('0x4e')]['length']?_0x18c656[_0xfef0('0x4e')]:_0x17d7f2['model'];if(!_0x50e372['query']['hasOwnProperty'](_0xfef0('0x50'))){_0x18c656[_0xfef0('0x30')]=qs[_0xfef0('0x30')](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x30')]);_0x18c656[_0xfef0('0x2e')]=qs[_0xfef0('0x2e')](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x2e')]);}_0x18c656['order']=qs['sort'](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x51')]);_0x18c656[_0xfef0('0x52')]=qs[_0xfef0('0x4c')](_[_0xfef0('0x53')](_0x50e372[_0xfef0('0x4b')],_0x17d7f2[_0xfef0('0x4c')]),_0x2af79f);var _0x20b647=[];var _0x5e989f=squel[_0xfef0('0x54')]()[_0xfef0('0x55')]('id')[_0xfef0('0x55')](_0xfef0('0x38'))[_0xfef0('0x55')]('color')['from']('tools_tags');var _0x445f3f=squel[_0xfef0('0x54')]()[_0xfef0('0x55')](_0xfef0('0x56'))['field'](_0xfef0('0x57'))[_0xfef0('0x55')](_0xfef0('0x58'))[_0xfef0('0x59')](_0xfef0('0x5a'),'ui')[_0xfef0('0x5b')](_0xfef0('0x5c'),'u','u.id\x20=\x20ui.UserId');var _0x3458b0=squel[_0xfef0('0x54')]()['from'](_0xfef0('0x5d'),'i')['left_join'](_0xfef0('0x5e'),'c',_0xfef0('0x5f'))['left_join'](_0xfef0('0x5c'),'o','o.id\x20=\x20i.UserId')['left_join']('chat_websites','a',_0xfef0('0x60'))[_0xfef0('0x5b')](_0xfef0('0x61'),'me',_0xfef0('0x62'))[_0xfef0('0x5b')](_0xfef0('0x63'),'it','it.ChatInteractionId\x20=\x20i.id')[_0xfef0('0x5b')](_0xfef0('0x64'),'t',_0xfef0('0x65'));var _0x45abb3=squel[_0xfef0('0x66')]();var _0x58d95e=[];var _0x59d1b6=squel['expr']();var _0x135653;if(_0x50e372['query'][_0xfef0('0x67')]){_0x135653=as[_0xfef0('0x68')](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x67')]);var _0xd0255c=_0x135653['sqlOperator'];for(var _0x2abdb7=0x0;_0x2abdb7<_0x135653['conditions'][_0xfef0('0x69')];_0x2abdb7++){var _0x4a1316=_0x135653['conditions'][_0x2abdb7];var _0x3a12c5='i';var _0x3c5640=_[_0xfef0('0x6a')](_0x2af79f,[_0xfef0('0x38'),_0x4a1316[_0xfef0('0x55')]]);if(!_0x3c5640){switch(_0x4a1316[_0xfef0('0x55')]){case _0xfef0('0x6b'):if(_0x4a1316[_0xfef0('0x6c')]==0x1){_0x3458b0[_0xfef0('0x6d')]('`'+_0x4a1316[_0xfef0('0x55')]+_0xfef0('0x6e'));}else{_0x3458b0[_0xfef0('0x6d')]('`'+_0x4a1316['field']+_0xfef0('0x6f'));}break;case _0xfef0('0x70'):if(_0x4a1316[_0xfef0('0x71')]===_0xfef0('0x72')){if(_0x4a1316[_0xfef0('0x6c')]['split']('\x20')[_0xfef0('0x69')]>0x1){_0x45abb3[_0xd0255c](_0xfef0('0x73'),qs[_0xfef0('0x74')](_0x4a1316[_0xfef0('0x6c')]),null);}else{var _0x176fc7='%'+_0x4a1316[_0xfef0('0x6c')]+'%';_0x45abb3[_0xd0255c](_0xfef0('0x75'),_0x176fc7,_0x176fc7,_0x176fc7);}}else{_0x3c5640=_[_0xfef0('0x6a')](_0x2af79f,[_0xfef0('0x38'),_0xfef0('0x76')]);_0x4a1316['field']=_0xfef0('0x76');_0x1d7caf=as['buildExpression'](_0x3a12c5,_0x3c5640[_0xfef0('0x77')],_0x4a1316);_0x45abb3[_0xd0255c](_0x1d7caf[_0xfef0('0x78')],_0x1d7caf['value'][_0xfef0('0x79')],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x36')]);}break;case _0xfef0('0x7a'):var _0x1e0ad5=_0x4a1316['value'][_0xfef0('0x42')](',')[_0xfef0('0x7b')](function(_0x2ccb33){return Number(_0x2ccb33);});_0x1e0ad5['forEach'](function(_0x117b74){_0x59d1b6['or'](_0xfef0('0x7c'),'%,'+_0x117b74+',%');});_0x58d95e=_[_0xfef0('0x7d')](_0x58d95e,_0x1e0ad5);break;case _0xfef0('0x7e'):if(_0x4a1316[_0xfef0('0x71')]===_0xfef0('0x72')){_0x45abb3[_0xd0255c](_0xfef0('0x7f'),'%'+_0x4a1316['value']+'%',null);}else{_0x3c5640=_[_0xfef0('0x6a')](_0x2af79f,[_0xfef0('0x38'),_0xfef0('0x80')]);_0x4a1316[_0xfef0('0x55')]=_0xfef0('0x80');_0x1d7caf=as[_0xfef0('0x81')](_0x3a12c5,_0x3c5640['type'],_0x4a1316);_0x45abb3[_0xd0255c](_0x1d7caf[_0xfef0('0x78')],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x79')],_0x1d7caf[_0xfef0('0x6c')]['end']);}break;case _0xfef0('0x3b'):_0x1d7caf=as[_0xfef0('0x81')]('me',null,_0x4a1316);_0x45abb3[_0xd0255c](_0x1d7caf['text'],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x79')],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x36')]);break;}}else{var _0x1d7caf=as['buildExpression'](_0x3a12c5,_0x3c5640['type'],_0x4a1316);_0x45abb3[_0xd0255c](_0x1d7caf['text'],_0x1d7caf[_0xfef0('0x6c')][_0xfef0('0x79')],_0x1d7caf[_0xfef0('0x6c')]['end']);}}}else{var _0x24229e=_(_0x50e372['query'])['keys']()['map'](function(_0x2a92de){return _[_0xfef0('0x82')](_0x2af79f,['name',_0x2a92de])?_0x2a92de:undefined;})[_0xfef0('0x83')]()[_0xfef0('0x6c')]();if(!_[_0xfef0('0x84')](_0x24229e)){_0x24229e['forEach'](function(_0x3f2b55){if(_0x3f2b55==='ChatWebsiteId'){_0x3458b0['where'](_0xfef0('0x85'),[][_0xfef0('0x86')](_0x50e372[_0xfef0('0x4b')][_0x3f2b55]));}else if(_0x3f2b55===_0xfef0('0x87')){var _0x4df63b=JSON['parse'](_0x50e372['query'][_0x3f2b55])[_0xfef0('0x88')];var _0x546455=JSON[_0xfef0('0x89')](_0x50e372[_0xfef0('0x4b')][_0x3f2b55])[_0xfef0('0x8a')];_0x3458b0[_0xfef0('0x52')](_0xfef0('0x8b'),_0x4df63b,_0x546455);}else{if(_0x50e372['query'][_0x3f2b55]===_0xfef0('0x8c')){_0x3458b0['where']('i.'+_0x3f2b55+'\x20IS\x20NULL');}else{_0x3458b0[_0xfef0('0x52')]('i.'+_0x3f2b55+_0xfef0('0x8d'),_0x50e372[_0xfef0('0x4b')][_0x3f2b55]);}}});}if(_0x50e372[_0xfef0('0x4b')]['read']){if(_0x50e372['query'][_0xfef0('0x8e')]==0x1){_0x3458b0[_0xfef0('0x6d')]('`unreadMessages`\x20=\x200');}else{_0x3458b0[_0xfef0('0x6d')](_0xfef0('0x8f'));}}if(_0x50e372[_0xfef0('0x4b')][_0xfef0('0x90')]){_0x58d95e=_[_0xfef0('0x91')](_0x50e372[_0xfef0('0x4b')][_0xfef0('0x90')])?_0x50e372[_0xfef0('0x4b')][_0xfef0('0x90')]:new Array(_0x50e372[_0xfef0('0x4b')][_0xfef0('0x90')]);_0x58d95e[_0xfef0('0x43')](function(_0x3c1136){_0x59d1b6['or'](_0xfef0('0x7c'),'%,'+_0x3c1136+',%');});}if(_0x50e372[_0xfef0('0x4b')][_0xfef0('0x92')]){var _0x1a61e4=_0x50e372['query'][_0xfef0('0x92')][_0xfef0('0x93')]('\x5c','\x5c\x5c')[_0xfef0('0x93')](/'/g,'\x27\x27');if(qs[_0xfef0('0x94')](_0x1a61e4)){_0x45abb3['or'](_0xfef0('0x95'),_0x1a61e4+'%');}else{_0x45abb3['or'](_0xfef0('0x96'),qs[_0xfef0('0x74')](_0x1a61e4))['or'](_0xfef0('0x97'),_0x1a61e4+'%');}}}_0x3458b0[_0xfef0('0x52')](_0x45abb3);_0x3458b0[_0xfef0('0x98')](_0xfef0('0x99'));var _0x17c350={'type':db[_0xfef0('0x9a')]['QueryTypes'][_0xfef0('0x9b')],'raw':!![]};var _0x56af65=_0x3458b0['clone']();_0x56af65[_0xfef0('0x55')](_0xfef0('0x99'));_0x56af65['field'](_0xfef0('0x9c'),'unreadMessages');if(_0x18c656['order']){_0x18c656[_0xfef0('0x9d')][_0xfef0('0x43')](function(_0x4ebcf){var _0x437cb2=_0x4ebcf[0x0]==='contactName'?_0x4ebcf[0x0]:'i.'+_0x4ebcf[0x0];_0x3458b0[_0xfef0('0x9d')](_0x437cb2,_0x4ebcf[0x1]===_0xfef0('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0x58d95e)){_0x3458b0[_0xfef0('0x6d')](_0x59d1b6);_0x56af65[_0xfef0('0x52')](_0xfef0('0x9f'),_0x58d95e);}BPromise['resolve']()['then'](function(){if(!_0x135653){if(_0x50e372[_0xfef0('0x4b')]['ChatWebsiteId'])return;_0x56af65['where'](_0xfef0('0xa0'));_0x3458b0['where'](_0xfef0('0xa0'));return;}if(_0x50e372[_0xfef0('0xa1')][_0xfef0('0xa2')]!==_0xfef0('0xa3'))return;return _0x50e372[_0xfef0('0xa1')][_0xfef0('0xa4')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x22')](function(_0x28cc77){if(_[_0xfef0('0x84')](_0x28cc77)){_0x56af65[_0xfef0('0x52')]('i.ChatWebsiteId\x20IS\x20NULL');_0x3458b0[_0xfef0('0x52')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x56af65['where'](_0xfef0('0x85'),_['map'](_0x28cc77,'id'));_0x3458b0[_0xfef0('0x52')](_0xfef0('0x85'),_[_0xfef0('0x7b')](_0x28cc77,'id'));}});})[_0xfef0('0x22')](function(){if(_0x50e372[_0xfef0('0xa1')][_0xfef0('0xa2')]==='agent'&&!_0x135653&&!_0x50e372[_0xfef0('0x4b')][_0xfef0('0xa5')])return[];return db[_0xfef0('0xa6')][_0xfef0('0x4b')](_0x56af65[_0xfef0('0xa7')](),_0x17c350);})[_0xfef0('0x22')](function(_0x3cc27e){_0x5bf416[_0xfef0('0xa8')]=_0x3cc27e['length'];if(_0x5bf416[_0xfef0('0xa8')]===0x0)return[];return db[_0xfef0('0xa6')]['query'](_0x5e989f[_0xfef0('0xa7')](),_0x17c350)[_0xfef0('0x22')](function(_0x221b17){_0x20b647=_['keyBy'](_0x221b17,'id');_0x17c350=_[_0xfef0('0xa9')](_0x17c350,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50e372[_0xfef0('0x4b')][_0xfef0('0x4f')]){_0x18c656['attributes'][_0xfef0('0x43')](function(_0x51f79b){_0x3458b0[_0xfef0('0x55')]('i.'+_0x51f79b);});}else{_0x3458b0[_0xfef0('0x55')](_0xfef0('0x9c'),_0xfef0('0x6b'));_0x3458b0[_0xfef0('0x55')](_0xfef0('0xaa'),_0xfef0('0xab'));_0x3458b0[_0xfef0('0x55')](_0xfef0('0xac'),_0xfef0('0xad'));_0x3458b0[_0xfef0('0x55')]('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',_0xfef0('0xae'));_0x3458b0['field']('i.*');_0x3458b0[_0xfef0('0x55')]('c.firstName',_0xfef0('0xaf'));_0x3458b0['field']('c.lastName',_0xfef0('0xb0'));_0x3458b0['field']('c.email','Contact.email');_0x3458b0[_0xfef0('0x55')](_0xfef0('0xb1'),_0xfef0('0xb2'));_0x3458b0[_0xfef0('0x55')]('c.mobile',_0xfef0('0xb3'));_0x3458b0[_0xfef0('0x55')](_0xfef0('0xb4'),_0xfef0('0xb5'));_0x3458b0[_0xfef0('0x55')]('o.fullname','Owner.fullname');_0x3458b0[_0xfef0('0x55')](_0xfef0('0xb6'),'Owner.internal');_0x3458b0[_0xfef0('0x55')](_0xfef0('0xb7'),_0xfef0('0x40'));}if(_0x18c656[_0xfef0('0x30')])_0x3458b0[_0xfef0('0x30')](_0x18c656[_0xfef0('0x30')]);if(_0x18c656[_0xfef0('0x2e')])_0x3458b0[_0xfef0('0x2e')](_0x18c656['offset']);return db['sequelize'][_0xfef0('0x4b')](_0x3458b0[_0xfef0('0xa7')](),_0x17c350);})[_0xfef0('0x22')](function(_0x475eb7){if(_0x475eb7[_0xfef0('0x69')]>0x0)_0x445f3f[_0xfef0('0x52')](_0xfef0('0xb8'),_[_0xfef0('0x7b')](_0x475eb7,'id'));return db['sequelize']['query'](_0x445f3f[_0xfef0('0xa7')](),_0x17c350)[_0xfef0('0x22')](function(_0x374877){var _0xd780bb=_[_0xfef0('0xb9')](_0x374877,_0xfef0('0xba'));var _0x5ac2df=[];_0x475eb7[_0xfef0('0x43')](function(_0x1060c2){_0x5ac2df['push'](updateChatInteraction(_0x1060c2,_0x20b647,_0xd780bb));});return BPromise[_0xfef0('0xbb')](_0x5ac2df);});});})[_0xfef0('0x22')](function(_0x36873f){_0x5bf416[_0xfef0('0xbc')]=_0x36873f;return _0x5bf416;})[_0xfef0('0x22')](respondWithFilteredResult(_0x4b6da1,_0x18c656))[_0xfef0('0x2a')](handleError(_0x4b6da1,null));};exports['show']=function(_0x4dd6e8,_0x1084b9){var _0xd7c5b={'raw':![],'where':{'id':_0x4dd6e8[_0xfef0('0xbd')]['id']}},_0xd2c0be={};_0xd2c0be[_0xfef0('0x4a')]=_[_0xfef0('0xbe')](db['ChatInteraction'][_0xfef0('0x47')]);_0xd2c0be['query']=_[_0xfef0('0xbe')](_0x4dd6e8['query']);_0xd2c0be[_0xfef0('0x4c')]=_[_0xfef0('0x4d')](_0xd2c0be['model'],_0xd2c0be[_0xfef0('0x4b')]);_0xd7c5b[_0xfef0('0x4e')]=_[_0xfef0('0x4d')](_0xd2c0be['model'],qs['fields'](_0x4dd6e8['query'][_0xfef0('0x4f')]));_0xd7c5b['attributes']=_0xd7c5b[_0xfef0('0x4e')][_0xfef0('0x69')]?_0xd7c5b['attributes']:_0xd2c0be[_0xfef0('0x4a')];if(_0x4dd6e8['query'][_0xfef0('0xbf')]){_0xd7c5b[_0xfef0('0xc0')]=[{'all':!![]}];}_0xd7c5b=_[_0xfef0('0xa9')]({},_0xd7c5b,_0x4dd6e8[_0xfef0('0xc1')]);return db[_0xfef0('0x46')][_0xfef0('0x6a')](_0xd7c5b)[_0xfef0('0x22')](handleEntityNotFound(_0x1084b9,null))['then'](respondWithResult(_0x1084b9,null))[_0xfef0('0x2a')](handleError(_0x1084b9,null));};exports[_0xfef0('0xc2')]=function(_0x38f96f,_0x1bdf18){return db[_0xfef0('0x46')][_0xfef0('0xc2')](_0x38f96f[_0xfef0('0x3b')],{})[_0xfef0('0x22')](respondWithResult(_0x1bdf18,0xc9))[_0xfef0('0x2a')](handleError(_0x1bdf18,null));};exports[_0xfef0('0x34')]=function(_0x2a25cb,_0x34f1db){if(_0x2a25cb[_0xfef0('0x3b')]['id']){delete _0x2a25cb[_0xfef0('0x3b')]['id'];}return db['ChatInteraction'][_0xfef0('0x6a')]({'where':{'id':_0x2a25cb[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x34f1db,null))[_0xfef0('0x22')](saveUpdates(_0x2a25cb[_0xfef0('0x3b')],null))[_0xfef0('0x22')](respondWithResult(_0x34f1db,null))[_0xfef0('0x2a')](handleError(_0x34f1db,null));};exports[_0xfef0('0x35')]=function(_0x191072,_0x5b5a15){return db['ChatInteraction'][_0xfef0('0x6a')]({'where':{'id':_0x191072['params']['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x5b5a15,null))[_0xfef0('0x22')](removeEntity(_0x5b5a15,null))[_0xfef0('0x2a')](handleError(_0x5b5a15,null));};exports[_0xfef0('0xc3')]=function(_0xd9c290,_0x365938){return db[_0xfef0('0x46')][_0xfef0('0xc3')]()[_0xfef0('0x22')](respondWithResult(_0x365938,null))[_0xfef0('0x2a')](handleError(_0x365938,null));};exports[_0xfef0('0xc4')]=function(_0x4c6ddd,_0x17ac08){var _0x40afcb=_0x4c6ddd['params']['id'];var _0xaa5902;var _0x189964;var _0x524db7;return db[_0xfef0('0x46')]['findOne']({'where':{'id':_0x40afcb}})[_0xfef0('0x22')](function(_0x41aadf){_0xaa5902=_0x41aadf;return db[_0xfef0('0xc5')][_0xfef0('0xc6')]({'where':{'id':_0x41aadf[_0xfef0('0xa5')]},'attributes':['id','vidaooApiKey',_0xfef0('0xc7'),_0xfef0('0xc8'),'vidaooNote',_0xfef0('0xc9')],'raw':!![]});})['then'](function(_0x3a180e){if(_0x3a180e&&_0x3a180e[_0xfef0('0xca')]&&_0x3a180e[_0xfef0('0xc7')]){_0x189964=_0x3a180e;var _0x52fb8b={'interaction':{'id':_0x40afcb},'agent':{'id':_0x4c6ddd[_0xfef0('0xa1')]['id'],'name':_0x4c6ddd['user']['name'],'fullname':_0x4c6ddd[_0xfef0('0xa1')]['fullname'],'email':_0x4c6ddd[_0xfef0('0xa1')][_0xfef0('0xcb')]},'contact':_0x4c6ddd[_0xfef0('0x3b')][_0xfef0('0x3c')],'account':_0x4c6ddd[_0xfef0('0x3b')][_0xfef0('0x3e')]};var _0x7f9b61={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x3a180e[_0xfef0('0xca')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4c6ddd['user'][_0xfef0('0xcb')]],'buttons':null,'topic':_0x189964[_0xfef0('0xc8')],'note':_[_0xfef0('0xcc')](_0x189964[_0xfef0('0xcd')])?null:getMustacheRender(_0x189964[_0xfef0('0xcd')],_0x52fb8b),'metadata':null},'redirect':_0xfef0('0xce'),'json':!![]};try{if(!_[_0xfef0('0xcc')](_0x189964[_0xfef0('0xc9')])){var _0x4a3b68=getMustacheRender(_0x189964['vidaooMetadata'],_0x52fb8b);var _0x3c5471=JSON[_0xfef0('0x89')](_0x4a3b68);_0x7f9b61[_0xfef0('0x3b')][_0xfef0('0xcf')]=_0x3c5471;}}catch(_0xdbd7f2){throw new db['Sequelize']['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x7f9b61);}else{throw new db[(_0xfef0('0x9a'))][(_0xfef0('0xd0'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xfef0('0x22')](function(_0x4f171b){_0x524db7=_0x4f171b;if(_0x524db7['id']){var _0x236523={'body':_0x524db7[_0xfef0('0xd1')],'ChatWebsiteId':_0x189964['id'],'ChatInteractionId':_0xaa5902['id'],'direction':_0xfef0('0xd2'),'UserId':_0x4c6ddd[_0xfef0('0xa1')]['id']};return db[_0xfef0('0xd3')][_0xfef0('0xc2')](_0x236523,{});}else{throw new db[(_0xfef0('0x9a'))][(_0xfef0('0xd0'))](_0xfef0('0xd4'));}})[_0xfef0('0x22')](function(){return _0xaa5902[_0xfef0('0xd5')]({'vidaooSessionId':_0x524db7['id']});})['then'](respondWithResult(_0x17ac08,null))[_0xfef0('0x2a')](handleError(_0x17ac08,null));};exports['customUpdate']=function(_0xf763b1,_0x1fc6a0){if(_0xf763b1[_0xfef0('0x3b')]['id']){delete _0xf763b1[_0xfef0('0x3b')]['id'];}return db[_0xfef0('0x46')][_0xfef0('0x6a')]({'where':{'id':_0xf763b1[_0xfef0('0xbd')]['id']},'include':[{'model':db[_0xfef0('0xd6')],'as':_0xfef0('0x70')}]})['then'](handleEntityNotFound(_0x1fc6a0,null))['then'](saveUpdates(_0xf763b1[_0xfef0('0x3b')],null))['then'](respondWithResult(_0x1fc6a0,null))[_0xfef0('0x2a')](handleError(_0x1fc6a0,null));};exports[_0xfef0('0xd7')]=function(_0x45049d,_0x238112,_0x3a7c93){if(_0x45049d['body']['id']){delete _0x45049d[_0xfef0('0x3b')]['id'];}return db['ChatInteraction'][_0xfef0('0x6a')]({'where':{'id':_0x45049d[_0xfef0('0xbd')]['id']}})['then'](function(_0x34bcc3){if(!_0x34bcc3){logger['error'](_0xfef0('0xd8'),'abandon',0x194,'entity\x20not\x20found');_0x238112[_0xfef0('0x2b')](0x194);}else{if(_0x34bcc3['UserId']){throw new db[(_0xfef0('0x9a'))][(_0xfef0('0xd0'))](_0xfef0('0xd9'));}}return _0x34bcc3;})['then'](function(_0x5c7b35){if(_0x5c7b35){return _0x5c7b35[_0xfef0('0x34')]({'closed':_0x45049d[_0xfef0('0x3b')][_0xfef0('0xda')],'disposition':_0x45049d[_0xfef0('0x3b')][_0xfef0('0xdb')]})[_0xfef0('0x22')](function(_0x3107e2){return _0x3107e2;});}})[_0xfef0('0x22')](function(_0x325d36){return respondWithRpcPromise('AbandonInteraction',_0xfef0('0xd7'),_0x45049d[_0xfef0('0x3b')],client9004);})[_0xfef0('0x22')](respondWithResult(_0x238112,null))[_0xfef0('0x2a')](handleError(_0x238112,null));};exports[_0xfef0('0xdc')]=function(_0xb1df6f,_0x42604b,_0x5969d2){_0xb1df6f[_0xfef0('0x3b')][_0xfef0('0x38')]=_0xb1df6f['file'][_0xfef0('0xdd')];_0xb1df6f[_0xfef0('0x3b')][_0xfef0('0xde')]=_0xb1df6f[_0xfef0('0xdf')][_0xfef0('0xe0')];_0xb1df6f['body'][_0xfef0('0x77')]=_0xb1df6f['file'][_0xfef0('0xe1')];return db['Attachment']['create'](_0xb1df6f['body'])[_0xfef0('0x22')](respondWithResult(_0x42604b,0xc9))['catch'](handleError(_0x42604b,null));};exports['attachmentDownload']=function(_0x25fed0,_0x43453b,_0x4da5b0){return db[_0xfef0('0x46')][_0xfef0('0xc6')]({'where':{'id':_0x25fed0[_0xfef0('0xbd')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x43453b,null))['then'](function(_0x39a2a7){if(_0x39a2a7){if(_0x39a2a7[_0xfef0('0xda')]){return _0x43453b[_0xfef0('0x2c')](0x193)[_0xfef0('0x2d')]({'status':0x193,'message':_0xfef0('0xe2')});}return db[_0xfef0('0xe3')][_0xfef0('0xc6')]({'where':{'id':_0x25fed0['query'][_0xfef0('0xe4')]},'raw':!![]})[_0xfef0('0x22')](handleEntityNotFound(_0x43453b,null));}})[_0xfef0('0x22')](function(_0x4544fe){if(_0x4544fe){var _0x5c0f32=_0x4544fe['ChatOfflineMessageId']!==null;var _0x461c91=path[_0xfef0('0xe5')](config[_0xfef0('0xe6')],_0xfef0('0xe7'));if(_0x5c0f32){_0x461c91=path[_0xfef0('0xe5')](_0x461c91,_0xfef0('0xe8'));}var _0xe24c2d=path['join'](_0x461c91,_0x4544fe['basename']);return _0x43453b['download'](_0xe24c2d);}})[_0xfef0('0x2a')](handleError(_0x43453b,null));};exports['close']=function(_0x38ac84,_0x4a1406){var _0x2daf2a=null;var _0x4f703e=null;var _0x20cf67=null;var _0x235122=null;if(_0x38ac84[_0xfef0('0x3b')]['id']){delete _0x38ac84[_0xfef0('0x3b')]['id'];}if(_0x38ac84[_0xfef0('0x3b')]['mailTranscript']){_0x235122=path[_0xfef0('0xe5')](config[_0xfef0('0xe6')],_0xfef0('0xe9'),util[_0xfef0('0xea')]('transcript-%s.txt',Date[_0xfef0('0xeb')]()));_0x38ac84['body']['pathTranscript']=_0x235122;}return db[_0xfef0('0x46')]['find']({'where':{'id':_0x38ac84['params']['id']},'include':[{'model':db[_0xfef0('0xd3')],'as':'Messages','include':[{'model':db[_0xfef0('0x7e')],'as':_0xfef0('0x7e')}]}]})[_0xfef0('0x22')](handleEntityNotFound(_0x4a1406,null))[_0xfef0('0x22')](saveUpdates(_0x38ac84[_0xfef0('0x3b')],null))[_0xfef0('0x22')](function(_0x4f6c50){if(_0x4f6c50){_0x2daf2a=_0x4f6c50;return db[_0xfef0('0xc5')][_0xfef0('0x6a')]({'where':{'id':_0x2daf2a[_0xfef0('0xa5')]}});}})['then'](function(_0x3ac462){if(_0x3ac462){_0x20cf67=_0x3ac462;return db['CmContact'][_0xfef0('0x6a')]({'where':{'id':_0x2daf2a[_0xfef0('0x76')]}});}})[_0xfef0('0x22')](function(_0x5ef687){if(_0x5ef687){_0x4f703e=_0x5ef687;if(_0x235122){var _0x906e55=null;for(var _0x4cec7d=0x1;_0x4cec7d<_0x2daf2a['Messages'][_0xfef0('0x69')];++_0x4cec7d){_0x906e55=_0x2daf2a[_0xfef0('0xec')][_0x4cec7d];var _0x58a4ef=_0x906e55[_0xfef0('0x80')]?util[_0xfef0('0xea')](_0xfef0('0xed'),_0x20cf67[_0xfef0('0xee')],_0x906e55['UserId']):_0xfef0('0xef');var _0x484cc3=_0x38ac84[_0xfef0('0x3b')][_0xfef0('0xf0')]||util[_0xfef0('0xea')](_0xfef0('0xed'),_0xfef0('0xf1'),_0x906e55[_0xfef0('0x76')]);switch(_0x20cf67[_0xfef0('0xf2')]){case _0xfef0('0xf3'):_0x58a4ef=_0x906e55[_0xfef0('0x80')]?util['format'](_0xfef0('0xed'),_0x20cf67[_0xfef0('0xee')],_0x906e55['UserId']):_0xfef0('0xef');break;case'agent_alias':_0x58a4ef=_0x906e55[_0xfef0('0x80')]?_0x906e55[_0xfef0('0x7e')][_0xfef0('0xf4')]||_0x906e55[_0xfef0('0x7e')][_0xfef0('0xf5')]:'System';break;case _0xfef0('0xf6'):_0x58a4ef=_0x906e55[_0xfef0('0x80')]?_0x906e55[_0xfef0('0x7e')]['fullname']:'System';break;default:_0x58a4ef=_0x906e55[_0xfef0('0x80')]?util[_0xfef0('0xea')](_0xfef0('0xed'),_0x20cf67[_0xfef0('0xee')],_0x906e55['UserId']):_0xfef0('0xef');}var _0x4b4986=util[_0xfef0('0xea')](_0xfef0('0xf7'),moment(_0x906e55[_0xfef0('0x87')])[_0xfef0('0xea')](_0xfef0('0xf8')),_0x906e55['direction']==='in'?_0x484cc3:_0x58a4ef,_0x906e55[_0xfef0('0x3b')]);if(!_0x906e55[_0xfef0('0xf9')]){fs[_0xfef0('0xfa')](_0x235122,_0x4b4986);}}return db[_0xfef0('0xfb')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xfef0('0xfc')],'as':'Smtp','raw':!![]}]});}}})[_0xfef0('0x22')](function(_0x402c7d){if(_0x402c7d&&_0x402c7d[_0xfef0('0xfd')]&&_0x38ac84[_0xfef0('0x3b')]){var _0x5315eb={'tls':{'rejectUnauthorized':![]}};if(_0x402c7d['Smtp'][_0xfef0('0xfe')]){_0x5315eb[_0xfef0('0xfe')]=_0x402c7d[_0xfef0('0xfd')][_0xfef0('0xfe')];}else{_0x5315eb[_0xfef0('0xff')]=_0x402c7d[_0xfef0('0xfd')][_0xfef0('0xff')];_0x5315eb['port']=_0x402c7d['Smtp'][_0xfef0('0x100')];_0x5315eb[_0xfef0('0x101')]=_0x402c7d['Smtp'][_0xfef0('0x101')];}if(_0x402c7d['Smtp']['authentication']){_0x5315eb[_0xfef0('0x102')]={'user':_0x402c7d[_0xfef0('0xfd')][_0xfef0('0xa1')],'pass':_0x402c7d[_0xfef0('0xfd')][_0xfef0('0x103')]};}return respondWithRpcPromise('SendMail',_0xfef0('0x104'),{'account':_0x5315eb,'message':{'from':util[_0xfef0('0xea')](_0xfef0('0x105'),_0x402c7d[_0xfef0('0x38')],_0x402c7d['email']||_0x402c7d['Smtp']['user']),'to':_0x38ac84[_0xfef0('0x3b')]['mailTranscript'],'subject':_0xfef0('0x106'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x38ac84['body'][_0xfef0('0x107')]),'attachments':[{'path':_0x235122}]}})[_0xfef0('0x22')](function(){return _0x2daf2a;})['catch'](function(_0x411870){console['error'](_0x411870);});}else{return _0x2daf2a;}})[_0xfef0('0x22')](respondWithStatusCode(_0x4a1406,0xc8))[_0xfef0('0x2a')](handleError(_0x4a1406,null));};exports[_0xfef0('0x108')]=function(_0x9b2969,_0x1f842f,_0x36c978){return db[_0xfef0('0xd3')][_0xfef0('0x6a')]({'where':{'id':_0x9b2969[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x1f842f,null))['then'](function(_0x1d342a){if(_0x1d342a){return _0x1d342a[_0xfef0('0x108')](_0x9b2969['body'][_0xfef0('0x109')],_['omit'](_0x9b2969[_0xfef0('0x3b')],[_0xfef0('0x109'),'id'])||{});}})[_0xfef0('0x22')](respondWithResult(_0x1f842f,null))[_0xfef0('0x2a')](handleError(_0x1f842f,null));};exports[_0xfef0('0x10a')]=function(_0x422af1,_0xcb9eb8,_0x38e829){var _0x287403={'raw':![],'where':{}};var _0x2ebd8d={};var _0x115454={'count':0x0,'rows':[]};return db[_0xfef0('0x46')][_0xfef0('0xc6')]({'where':{'id':_0x422af1[_0xfef0('0xbd')]['id']}})['then'](handleEntityNotFound(_0xcb9eb8,null))[_0xfef0('0x22')](function(_0x5593de){if(_0x5593de){_0x2ebd8d['model']=_[_0xfef0('0xbe')](db['ChatMessage'][_0xfef0('0x47')]);_0x2ebd8d[_0xfef0('0x4b')]=_[_0xfef0('0xbe')](_0x422af1['query']);_0x2ebd8d[_0xfef0('0x4c')]=_[_0xfef0('0x4d')](_0x2ebd8d[_0xfef0('0x4a')],_0x2ebd8d[_0xfef0('0x4b')]);_0x287403[_0xfef0('0x4e')]=_[_0xfef0('0x4d')](_0x2ebd8d[_0xfef0('0x4a')],qs[_0xfef0('0x4f')](_0x422af1[_0xfef0('0x4b')][_0xfef0('0x4f')]));_0x287403[_0xfef0('0x4e')]=_0x287403[_0xfef0('0x4e')][_0xfef0('0x69')]?_0x287403[_0xfef0('0x4e')]:_0x2ebd8d['model'];if(!_0x422af1[_0xfef0('0x4b')]['hasOwnProperty'](_0xfef0('0x50'))){_0x287403['limit']=qs[_0xfef0('0x30')](_0x422af1[_0xfef0('0x4b')][_0xfef0('0x30')]);_0x287403[_0xfef0('0x2e')]=qs[_0xfef0('0x2e')](_0x422af1['query']['offset']);}_0x287403[_0xfef0('0x9d')]=qs[_0xfef0('0x51')](_0x422af1['query'][_0xfef0('0x51')]);_0x287403[_0xfef0('0x52')]=qs[_0xfef0('0x4c')](_[_0xfef0('0x53')](_0x422af1[_0xfef0('0x4b')],_0x2ebd8d[_0xfef0('0x4c')]));_0x287403[_0xfef0('0x52')][_0xfef0('0xba')]=_0x5593de['id'];if(_0x422af1['query'][_0xfef0('0x92')]){_0x287403[_0xfef0('0x52')]=_['merge'](_0x287403[_0xfef0('0x52')],{'$or':_['map'](_0x287403[_0xfef0('0x4e')],function(_0x41790c){var _0x189965={};_0x189965[_0x41790c]={'$like':'%'+_0x422af1[_0xfef0('0x4b')][_0xfef0('0x92')]+'%'};return _0x189965;})});}if(_0x422af1[_0xfef0('0x4b')][_0xfef0('0x88')]){var _0x5b1b34=_0x422af1[_0xfef0('0x4b')][_0xfef0('0x88')]['split'](',');var _0xfa83e1={};_0xfa83e1[_0x5b1b34[0x0]]={'$gte':moment(_0x5b1b34[0x1])[_0xfef0('0xea')](_0xfef0('0x10b'))};_0x287403['where']=_[_0xfef0('0xa9')](_0x287403[_0xfef0('0x52')],_0xfa83e1);}_0x287403=_[_0xfef0('0xa9')]({},_0x287403,_0x422af1[_0xfef0('0xc1')]);return db[_0xfef0('0xd3')][_0xfef0('0xa8')]({'where':_0x287403[_0xfef0('0x52')]})[_0xfef0('0x22')](function(_0x464d00){_0x115454[_0xfef0('0xa8')]=_0x464d00;if(_0x422af1['query'][_0xfef0('0xbf')]){_0x287403[_0xfef0('0xc0')]=[{'all':!![]}];}return db[_0xfef0('0xd3')][_0xfef0('0x10c')](_0x287403);})[_0xfef0('0x22')](function(_0x1b23f0){_0x115454['rows']=_0x1b23f0;return _0x115454;});}})['then'](respondWithFilteredResult(_0xcb9eb8,_0x287403))[_0xfef0('0x2a')](handleError(_0xcb9eb8,null));};exports['getMyMessages']=function(_0x30f7d5,_0x1a53fa,_0x14a37e){var _0x303128={'where':{}},_0x2b3263={},_0x43e758={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xfef0('0xc6')]({'where':{'id':_0x30f7d5[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x1a53fa,null))[_0xfef0('0x22')](function(_0x273e8b){if(_0x273e8b){_0x2b3263[_0xfef0('0x4a')]=_[_0xfef0('0xbe')](db['ChatMessage'][_0xfef0('0x47')]);_0x2b3263[_0xfef0('0x4b')]=_[_0xfef0('0xbe')](_0x30f7d5[_0xfef0('0x4b')]);_0x2b3263[_0xfef0('0x4c')]=_[_0xfef0('0x4d')](_0x2b3263['model'],_0x2b3263['query']);_0x303128[_0xfef0('0x4e')]=_[_0xfef0('0x4d')](_0x2b3263[_0xfef0('0x4a')],qs[_0xfef0('0x4f')](_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x4f')]));_0x303128[_0xfef0('0x4e')]=_0x303128[_0xfef0('0x4e')][_0xfef0('0x69')]?_0x303128[_0xfef0('0x4e')]:_0x2b3263[_0xfef0('0x4a')];if(!_0x30f7d5['query'][_0xfef0('0x10d')](_0xfef0('0x50'))){_0x303128[_0xfef0('0x30')]=qs[_0xfef0('0x30')](_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x30')]);_0x303128['offset']=qs[_0xfef0('0x2e')](_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x2e')]);}_0x303128[_0xfef0('0x9d')]=qs['sort'](_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x51')]);_0x303128['where']=qs[_0xfef0('0x4c')](_[_0xfef0('0x53')](_0x30f7d5[_0xfef0('0x4b')],_0x2b3263[_0xfef0('0x4c')]));_0x303128[_0xfef0('0x52')][_0xfef0('0xba')]=_0x273e8b['id'];if(_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x92')]){_0x303128['where']=_[_0xfef0('0xa9')](_0x303128[_0xfef0('0x52')],{'$or':_['map'](_0x303128['attributes'],function(_0x3081e){var _0xd34b68={};_0xd34b68[_0x3081e]={'$like':'%'+_0x30f7d5[_0xfef0('0x4b')]['filter']+'%'};return _0xd34b68;})});}_0x303128[_0xfef0('0x52')][_0xfef0('0xf9')]=![];if(_0x30f7d5['query']['id']){_0x303128[_0xfef0('0x52')]['id']={'$gt':_0x30f7d5[_0xfef0('0x4b')]['id']};}_0x303128=_[_0xfef0('0xa9')]({},_0x303128,_0x30f7d5[_0xfef0('0xc1')]);return db[_0xfef0('0xd3')]['count']({'where':_0x303128[_0xfef0('0x52')]})['then'](function(_0x63bcae){_0x43e758['count']=_0x63bcae;_0x303128[_0xfef0('0xc0')]=[];if(_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0x10e')]){_0x303128['include'][_0xfef0('0x44')]({'model':db[_0xfef0('0x7e')],'as':'User','attributes':['id','fullname',_0xfef0('0xf4')]});}if(_0x30f7d5[_0xfef0('0x4b')][_0xfef0('0xbf')]){_0x303128['include']=[{'all':!![]}];}return db[_0xfef0('0xd3')][_0xfef0('0x10c')](_0x303128);})['then'](function(_0x527d0d){_0x43e758[_0xfef0('0xbc')]=_0x527d0d;return _0x43e758;});}})[_0xfef0('0x22')](respondWithFilteredResult(_0x1a53fa,_0x303128))['catch'](handleError(_0x1a53fa,null));};exports[_0xfef0('0x10f')]=function(_0x3f68ed,_0x45a5e8,_0x33cecb){return db[_0xfef0('0x46')][_0xfef0('0x6a')]({'where':{'id':_0x3f68ed[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0x45a5e8,null))[_0xfef0('0x22')](function(_0x53ce05){if(_0x53ce05){return _0x53ce05[_0xfef0('0x110')](_0x3f68ed[_0xfef0('0x3b')][_0xfef0('0x109')],_[_0xfef0('0x111')](_0x3f68ed[_0xfef0('0x3b')],[_0xfef0('0x109'),'id'])||{})['spread'](function(){return db[_0xfef0('0x7a')][_0xfef0('0x10c')]({'attributes':['id','name','color'],'where':{'id':_0x3f68ed[_0xfef0('0x3b')][_0xfef0('0x109')]}});})[_0xfef0('0x22')](function(_0x4697ee){socket[_0xfef0('0x112')]('chatInteractionTags:save',{'id':Number(_0x3f68ed[_0xfef0('0xbd')]['id']),'tags':_0x4697ee||[]});return{'id':Number(_0x3f68ed[_0xfef0('0xbd')]['id']),'tags':_0x4697ee||[]};});}})[_0xfef0('0x22')](respondWithResult(_0x45a5e8,null))['catch'](handleError(_0x45a5e8,null));};exports[_0xfef0('0x113')]=function(_0x2a229b,_0xcb6d50,_0x53ed7e){return db['ChatInteraction'][_0xfef0('0x6a')]({'where':{'id':_0x2a229b[_0xfef0('0xbd')]['id']}})[_0xfef0('0x22')](handleEntityNotFound(_0xcb6d50,null))['then'](function(_0x241763){if(_0x241763){return _0x241763[_0xfef0('0x113')](_0x2a229b['query'][_0xfef0('0x109')]);}})[_0xfef0('0x22')](respondWithStatusCode(_0xcb6d50,null))['catch'](handleError(_0xcb6d50,null));};exports[_0xfef0('0x114')]=function(_0x57e2d8,_0x3fdeae){var _0x30b0a9=moment()[_0xfef0('0x115')]()['toString']();var _0x416d36=path[_0xfef0('0xe5')](config['root'],_0xfef0('0x116'),_0xfef0('0x117'),_0xfef0('0x118'));var _0x50b3d7=path[_0xfef0('0xe5')](config[_0xfef0('0xe6')],_0xfef0('0x116'),_0xfef0('0x117'),_0xfef0('0x119'));var _0x2a9a1e=path[_0xfef0('0xe5')](_0x416d36,_0x30b0a9);var _0x584c9b=util[_0xfef0('0xea')](_0xfef0('0x11a'),_0x57e2d8[_0xfef0('0xbd')]['id'],_0x30b0a9);var _0x4f4c4e=path[_0xfef0('0xe5')](_0x416d36,_0x584c9b);var _0x1c6ab9=[];_0x1c6ab9[_0xfef0('0x44')]({'model':db[_0xfef0('0x7e')],'as':_0xfef0('0x7e'),'attributes':['id',_0xfef0('0xf5')],'raw':!![]});_0x1c6ab9['push']({'model':db[_0xfef0('0xd6')],'as':'Contact','attributes':['id',_0xfef0('0x11b'),_0xfef0('0x11c')],'raw':!![]});if(_0x57e2d8[_0xfef0('0x4b')][_0xfef0('0x119')]){_0x1c6ab9[_0xfef0('0x44')]({'model':db[_0xfef0('0xe3')],'as':'Attachment','raw':!![]});}var _0x937d8e=[{'model':db[_0xfef0('0xd3')],'as':_0xfef0('0xec'),'attributes':['id',_0xfef0('0x3b'),'createdAt',_0xfef0('0x11d'),_0xfef0('0xf9'),'read'],'include':_0x1c6ab9}];_0x937d8e['push']({'model':db[_0xfef0('0xc5')],'as':_0xfef0('0x11e'),'attributes':['id',_0xfef0('0x38')]});_0x937d8e[_0xfef0('0x44')]({'model':db['User'],'as':'Owner','attributes':['id',_0xfef0('0xf5')]});return db[_0xfef0('0x46')][_0xfef0('0x6a')]({'where':{'id':_0x57e2d8[_0xfef0('0xbd')]['id']},'include':_0x937d8e})[_0xfef0('0x22')](handleEntityNotFound(_0x3fdeae,null))['then'](function(_0x2978cc){if(_0x2978cc){var _0x81bcee=_0x2978cc['get']({'plain':!![]});fs[_0xfef0('0x11f')](_0x2a9a1e);var _0xc8d0ca={'channel':_0xfef0('0x120'),'account':_0x81bcee[_0xfef0('0x11e')][_0xfef0('0x38')],'agent':_0x81bcee[_0xfef0('0x121')]?_0x81bcee['Owner']['fullname']:_0xfef0('0x122'),'createdAt':moment(_0x81bcee[_0xfef0('0x87')])[_0xfef0('0xea')](_0xfef0('0x10b'))['toString'](),'closedAt':_0x81bcee['closed']?moment(_0x81bcee['closedAt'])[_0xfef0('0xea')](_0xfef0('0x10b'))[_0xfef0('0xa7')]():'','disposition':_0x81bcee[_0xfef0('0xdb')],'chatInfo':{'browser':_0x81bcee[_0xfef0('0x123')],'os':_0x81bcee[_0xfef0('0x124')],'referer':_0x81bcee['referer'],'customerIp':_0x81bcee['customerIp'],'customerPort':_0x81bcee['customerPort']?_0x81bcee['customerPort']:'N.A.'},'messages':_(_0x81bcee[_0xfef0('0xec')])['tail']()[_0xfef0('0x92')]({'secret':![]})[_0xfef0('0x7b')](function(_0x46ab62){if(_0x46ab62[_0xfef0('0xe3')]){var _0x3507a8=path['join'](_0x50b3d7,_0x46ab62[_0xfef0('0xe3')][_0xfef0('0xde')]);if(fs[_0xfef0('0x125')](_0x3507a8)){fs['createReadStream'](_0x3507a8)[_0xfef0('0x126')](fs[_0xfef0('0x127')](path[_0xfef0('0xe5')](_0x2a9a1e,_0x46ab62[_0xfef0('0xe3')][_0xfef0('0xde')])));}}return{'date':moment(_0x46ab62[_0xfef0('0x87')])[_0xfef0('0xea')](_0xfef0('0x10b'))[_0xfef0('0xa7')](),'sender':_0x46ab62[_0xfef0('0x11d')]===_0xfef0('0xd2')?_0x46ab62[_0xfef0('0x7e')]?_0x46ab62[_0xfef0('0x7e')][_0xfef0('0xf5')]:_0xfef0('0xef'):_0x46ab62[_0xfef0('0x70')][_0xfef0('0x11b')]+(_0x46ab62[_0xfef0('0x70')][_0xfef0('0x11c')]?'\x20'+_0x46ab62[_0xfef0('0x70')]['lastName']:''),'body':_0x46ab62['Attachment']?_0x46ab62['Attachment']['basename']:_0x46ab62[_0xfef0('0x3b')],'direction':_0x46ab62[_0xfef0('0x11d')]===_0xfef0('0xd2')?'A':'C','secret':_0x46ab62['secret'],'read':_0x46ab62[_0xfef0('0x8e')],'attachment':_0x46ab62[_0xfef0('0xe3')]};})[_0xfef0('0x6c')]()};return ejs[_0xfef0('0x128')](path['join'](config['root'],'server',_0xfef0('0x129'),_0xfef0('0x12a')),{'interaction':_0xc8d0ca})[_0xfef0('0x22')](function(_0x2b1f64){var _0x55ecff=path[_0xfef0('0xe5')](_0x2a9a1e,_0xfef0('0x12b')+_0x81bcee['id']+'-'+_0x30b0a9+'.pdf');var _0x409147={'path':_0x55ecff,'channel':_0xfef0('0x120'),'interactionId':_0x81bcee['id']};return pdf[_0xfef0('0x12c')](_0x2b1f64,_0x409147);})[_0xfef0('0x22')](function(){return new BPromise(function(_0x27856d,_0x44081d){zipdir(_0x2a9a1e,{'saveTo':_0x4f4c4e},function(_0x177c9b,_0x322672){if(_0x177c9b)return _0x44081d(_0x177c9b);return _0x27856d(_0x322672);});})[_0xfef0('0x22')](function(){return new BPromise(function(_0x102b4e,_0x2a206b){rimraf(_0x2a9a1e,function(_0x279f5b){if(_0x279f5b)_0x2a206b(_0x279f5b);return _0x102b4e();});});})[_0xfef0('0x22')](function(){return _0x3fdeae[_0xfef0('0x114')](_0x4f4c4e,_0x584c9b,function(_0x44603e){if(_0x44603e){console['log'](_0xfef0('0x12d'),_0x44603e);}else{fs['unlinkSync'](_0x4f4c4e);}});});});}else{return _0x3fdeae[_0xfef0('0x2b')](0xc8);}})['catch'](handleError(_0x3fdeae,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index fb8d49b..9f3004b 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 _0xfed5=['emit','catch','events','../../mysqldb','ChatMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','length'];(function(_0x37dea0,_0x3d6829){var _0x4531d8=function(_0x1513c0){while(--_0x1513c0){_0x37dea0['push'](_0x37dea0['shift']());}};_0x4531d8(++_0x3d6829);}(_0xfed5,0x160));var _0x5fed=function(_0x92a2f0,_0x278a58){_0x92a2f0=_0x92a2f0-0x0;var _0x4913a0=_0xfed5[_0x92a2f0];return _0x4913a0;};'use strict';var EventEmitter=require(_0x5fed('0x0'));var ChatInteraction=require(_0x5fed('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x5fed('0x1'))['db'][_0x5fed('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5fed('0x3'),'afterUpdate':'update','afterDestroy':_0x5fed('0x4')};function emitEvent(_0x1f3ad9){return function(_0x3506aa,_0x2d5414,_0x3146c1){_0x3506aa[_0x5fed('0x5')]({'attributes':['id'],'raw':!![]})[_0x5fed('0x6')](function(_0x7d388){_0x3506aa[_0x5fed('0x7')](_0x5fed('0x8'),_0x7d388[_0x5fed('0x9')](function(_0x3d77ad){return{'id':_0x3d77ad['id']};}));return ChatMessage[_0x5fed('0xa')]({'where':{'ChatInteractionId':_0x3506aa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5fed('0x6')](function(_0x1100fe){_0x3506aa['setDataValue']('unreadMessages',_0x1100fe[_0x5fed('0xb')]);ChatInteractionEvents[_0x5fed('0xc')](_0x1f3ad9+':'+_0x3506aa['id'],_0x3506aa);ChatInteractionEvents[_0x5fed('0xc')](_0x1f3ad9,_0x3506aa);_0x3146c1(null);})[_0x5fed('0xd')](_0x3146c1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x11ff=['findAll','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','remove','getUsers','then','setDataValue','Users','map'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x11ff,0x1c7));var _0xf11f=function(_0x2b1f58,_0x16f9a9){_0x2b1f58=_0x2b1f58-0x0;var _0x4d6d8b=_0x11ff[_0x2b1f58];return _0x4d6d8b;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xf11f('0x0'))['db'][_0xf11f('0x1')];var ChatMessage=require(_0xf11f('0x0'))['db'][_0xf11f('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf11f('0x3')};function emitEvent(_0x2606ab){return function(_0x3934ca,_0x496ba4,_0x413884){_0x3934ca[_0xf11f('0x4')]({'attributes':['id'],'raw':!![]})[_0xf11f('0x5')](function(_0x51022c){_0x3934ca[_0xf11f('0x6')](_0xf11f('0x7'),_0x51022c[_0xf11f('0x8')](function(_0x4c6c19){return{'id':_0x4c6c19['id']};}));return ChatMessage[_0xf11f('0x9')]({'where':{'ChatInteractionId':_0x3934ca['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf11f('0x5')](function(_0x513177){_0x3934ca[_0xf11f('0x6')]('unreadMessages',_0x513177[_0xf11f('0xa')]);ChatInteractionEvents[_0xf11f('0xb')](_0x2606ab+':'+_0x3934ca['id'],_0x3934ca);ChatInteractionEvents['emit'](_0x2606ab,_0x3934ca);_0x413884(null);})[_0xf11f('0xc')](_0x413884(null));};}for(var e in events){if(events[_0xf11f('0xd')](e)){var event=events[e];ChatInteraction[_0xf11f('0xe')](e,emitEvent(event));}}module[_0xf11f('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 4094724..33f77d1 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 _0x4124=['bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment'];(function(_0x15c23a,_0x479e88){var _0x61e16d=function(_0x8f5b3f){while(--_0x8f5b3f){_0x15c23a['push'](_0x15c23a['shift']());}};_0x61e16d(++_0x479e88);}(_0x4124,0x7d));var _0x4412=function(_0x44c2c6,_0x2d471e){_0x44c2c6=_0x44c2c6-0x0;var _0x1e97ca=_0x4124[_0x44c2c6];return _0x1e97ca;};'use strict';var _=require(_0x4412('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4412('0x1'));var moment=require(_0x4412('0x2'));var BPromise=require(_0x4412('0x3'));var rp=require(_0x4412('0x4'));var fs=require('fs');var path=require(_0x4412('0x5'));var rimraf=require('rimraf');var config=require(_0x4412('0x6'));var attributes=require(_0x4412('0x7'));module[_0x4412('0x8')]=function(_0x1c34e9,_0x505792){return _0x1c34e9['define']('ChatInteraction',attributes,{'tableName':_0x4412('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9f4882,_0x163ab9,_0x13869e){if(_0x9f4882[_0x4412('0xa')](_0x4412('0xb'))){_0x9f4882['closedAt']=moment()[_0x4412('0xc')](_0x4412('0xd'));}_0x13869e(null,_0x9f4882);}},'charset':_0x4412('0xe'),'collate':_0x4412('0xf')});}; \ No newline at end of file +var _0xd5f1=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions'];(function(_0x1923ce,_0x40e8f9){var _0x1ef386=function(_0x68e5ab){while(--_0x68e5ab){_0x1923ce['push'](_0x1923ce['shift']());}};_0x1ef386(++_0x40e8f9);}(_0xd5f1,0x1b6));var _0x1d5f=function(_0x1e2843,_0x51fde1){_0x1e2843=_0x1e2843-0x0;var _0x43130c=_0xd5f1[_0x1e2843];return _0x43130c;};'use strict';var _=require('lodash');var util=require(_0x1d5f('0x0'));var logger=require(_0x1d5f('0x1'))(_0x1d5f('0x2'));var moment=require(_0x1d5f('0x3'));var BPromise=require('bluebird');var rp=require(_0x1d5f('0x4'));var fs=require('fs');var path=require(_0x1d5f('0x5'));var rimraf=require(_0x1d5f('0x6'));var config=require(_0x1d5f('0x7'));var attributes=require(_0x1d5f('0x8'));module['exports']=function(_0x7897db,_0xd89e6d){return _0x7897db[_0x1d5f('0x9')](_0x1d5f('0xa'),attributes,{'tableName':_0x1d5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3157a3,_0x1ae613,_0x2a73e7){if(_0x3157a3[_0x1d5f('0xc')](_0x1d5f('0xd'))){_0x3157a3['closedAt']=moment()[_0x1d5f('0xe')](_0x1d5f('0xf'));}_0x2a73e7(null,_0x3157a3);}},'charset':_0x1d5f('0x10'),'collate':_0x1d5f('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index ae7e9ce..0c710f9 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 _0x35a3=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','body','options','where','attributes','limit','AddTagsToChatInteraction','ChatInteraction','then','ids','omit','spread','AddTags'];(function(_0x43aa56,_0x5f228b){var _0x241e5b=function(_0x378ee6){while(--_0x378ee6){_0x43aa56['push'](_0x43aa56['shift']());}};_0x241e5b(++_0x5f228b);}(_0x35a3,0xea));var _0x335a=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x35a3[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x335a('0x0'));var util=require(_0x335a('0x1'));var moment=require(_0x335a('0x2'));var BPromise=require(_0x335a('0x3'));var rs=require(_0x335a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x335a('0x5'))['db'];var utils=require(_0x335a('0x6'));var logger=require(_0x335a('0x7'))(_0x335a('0x8'));var config=require('../../config/environment');var jayson=require(_0x335a('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x335a('0xa')]=_[_0x335a('0xb')](config[_0x335a('0xa')],{'host':_0x335a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x335a('0xa')]));require('./chatInteraction.socket')[_0x335a('0xd')](socket);function respondWithRpcPromise(_0xba3292,_0x459ace,_0x71728c){return new BPromise(function(_0x5a05f6,_0x41ca51){return client[_0x335a('0xe')](_0xba3292,_0x71728c)['then'](function(_0x575840){logger[_0x335a('0xf')](_0x335a('0x10'),_0x459ace,_0x335a('0x11'));logger[_0x335a('0x12')](_0x335a('0x13'),_0x459ace,_0x335a('0x11'),JSON[_0x335a('0x14')](_0x575840));if(_0x575840[_0x335a('0x15')]){if(_0x575840['error'][_0x335a('0x16')]===0x1f4){logger[_0x335a('0x15')](_0x335a('0x10'),_0x459ace,_0x575840[_0x335a('0x15')][_0x335a('0x17')]);return _0x41ca51(_0x575840['error']['message']);}logger[_0x335a('0x15')](_0x335a('0x10'),_0x459ace,_0x575840[_0x335a('0x15')][_0x335a('0x17')]);return _0x5a05f6(_0x575840['error'][_0x335a('0x17')]);}else{logger[_0x335a('0xf')](_0x335a('0x10'),_0x459ace,_0x335a('0x11'));_0x5a05f6(_0x575840[_0x335a('0x18')][_0x335a('0x17')]);}})[_0x335a('0x19')](function(_0xa69144){logger[_0x335a('0x15')](_0x335a('0x10'),_0x459ace,_0xa69144);_0x41ca51(_0xa69144);});});}exports[_0x335a('0x1a')]=function(_0x389524){var _0x2d5dad=this;return new Promise(function(_0x159fef,_0x5628cf){return db['ChatInteraction']['update'](_0x389524[_0x335a('0x1b')],{'raw':_0x389524[_0x335a('0x1c')]?_0x389524[_0x335a('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x389524[_0x335a('0x1c')]?_0x389524[_0x335a('0x1c')][_0x335a('0x1d')]||null:null,'attributes':_0x389524[_0x335a('0x1c')]?_0x389524[_0x335a('0x1c')][_0x335a('0x1e')]||null:null,'limit':_0x389524[_0x335a('0x1c')]?_0x389524[_0x335a('0x1c')][_0x335a('0x1f')]||null:null})['then'](function(_0x342b38){logger[_0x335a('0xf')](_0x335a('0x1a'),_0x389524);logger[_0x335a('0x12')](_0x335a('0x1a'),_0x389524,JSON['stringify'](_0x342b38));_0x159fef(_0x342b38);})['catch'](function(_0x103f35){logger[_0x335a('0x15')]('UpdateChatInteraction',_0x103f35[_0x335a('0x17')],_0x389524);_0x5628cf(_0x2d5dad['error'](0x1f4,_0x103f35[_0x335a('0x17')]));});});};exports[_0x335a('0x20')]=function(_0x1e8d0b){return new Promise(function(_0xc5fb46,_0xf6e6ea){return db[_0x335a('0x21')]['find']({'where':_0x1e8d0b[_0x335a('0x1c')]?_0x1e8d0b[_0x335a('0x1c')][_0x335a('0x1d')]||null:null})[_0x335a('0x22')](function(_0x34f49d){if(_0x34f49d){return _0x34f49d['addTags'](_0x1e8d0b['body'][_0x335a('0x23')],_[_0x335a('0x24')](_0x1e8d0b[_0x335a('0x1b')],[_0x335a('0x23'),'id'])||{});}})[_0x335a('0x25')](function(_0x239070){logger[_0x335a('0xf')](_0x335a('0x26'),_0x1e8d0b);logger[_0x335a('0x12')](_0x335a('0x26'),_0x1e8d0b,JSON[_0x335a('0x14')](_0x239070));_0xc5fb46(_0x239070);})['catch'](function(_0x36e7d6){logger[_0x335a('0x15')](_0x335a('0x26'),_0x36e7d6[_0x335a('0x17')],_0x1e8d0b);_0xf6e6ea(_this[_0x335a('0x15')](0x1f4,_0x36e7d6[_0x335a('0x17')]));});});}; \ No newline at end of file +var _0xceea=['util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','request','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ChatInteraction,\x20%s,\x20%s','result','catch','UpdateChatInteraction','update','options','where','then','AddTagsToChatInteraction','ChatInteraction','find','addTags','body','ids','AddTags','debug'];(function(_0x401481,_0x5b958d){var _0x4b75b0=function(_0x582743){while(--_0x582743){_0x401481['push'](_0x401481['shift']());}};_0x4b75b0(++_0x5b958d);}(_0xceea,0x144));var _0xacee=function(_0x16f9a5,_0x378b9c){_0x16f9a5=_0x16f9a5-0x0;var _0x1ac283=_0xceea[_0x16f9a5];return _0x1ac283;};'use strict';var _=require('lodash');var util=require(_0xacee('0x0'));var moment=require('moment');var BPromise=require(_0xacee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacee('0x2'))['db'];var utils=require(_0xacee('0x3'));var logger=require(_0xacee('0x4'))(_0xacee('0x5'));var config=require(_0xacee('0x6'));var jayson=require(_0xacee('0x7'));var client=jayson['client'][_0xacee('0x8')]({'port':0x232a});config['redis']=_[_0xacee('0x9')](config[_0xacee('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xacee('0xb'))(new Redis(config[_0xacee('0xa')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x585fa4,_0x4746d8,_0x1d692e){return new BPromise(function(_0x5ca888,_0x540e2a){return client[_0xacee('0xc')](_0x585fa4,_0x1d692e)['then'](function(_0x2b1faa){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x4746d8,_0xacee('0xd'));logger['debug'](_0xacee('0xe'),_0x4746d8,_0xacee('0xd'),JSON[_0xacee('0xf')](_0x2b1faa));if(_0x2b1faa[_0xacee('0x10')]){if(_0x2b1faa[_0xacee('0x10')][_0xacee('0x11')]===0x1f4){logger[_0xacee('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x4746d8,_0x2b1faa[_0xacee('0x10')][_0xacee('0x12')]);return _0x540e2a(_0x2b1faa[_0xacee('0x10')]['message']);}logger[_0xacee('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x4746d8,_0x2b1faa[_0xacee('0x10')][_0xacee('0x12')]);return _0x5ca888(_0x2b1faa[_0xacee('0x10')][_0xacee('0x12')]);}else{logger[_0xacee('0x13')](_0xacee('0x14'),_0x4746d8,_0xacee('0xd'));_0x5ca888(_0x2b1faa[_0xacee('0x15')][_0xacee('0x12')]);}})[_0xacee('0x16')](function(_0x6e740f){logger[_0xacee('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x4746d8,_0x6e740f);_0x540e2a(_0x6e740f);});});}exports[_0xacee('0x17')]=function(_0x216969){var _0x16acd2=this;return new Promise(function(_0x5b5de2,_0x5826db){return db['ChatInteraction'][_0xacee('0x18')](_0x216969['body'],{'raw':_0x216969[_0xacee('0x19')]?_0x216969[_0xacee('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x216969[_0xacee('0x19')]?_0x216969[_0xacee('0x19')][_0xacee('0x1a')]||null:null,'attributes':_0x216969[_0xacee('0x19')]?_0x216969['options']['attributes']||null:null,'limit':_0x216969['options']?_0x216969[_0xacee('0x19')]['limit']||null:null})[_0xacee('0x1b')](function(_0x3b5cc0){logger[_0xacee('0x13')](_0xacee('0x17'),_0x216969);logger['debug'](_0xacee('0x17'),_0x216969,JSON[_0xacee('0xf')](_0x3b5cc0));_0x5b5de2(_0x3b5cc0);})[_0xacee('0x16')](function(_0x2a2d85){logger[_0xacee('0x10')]('UpdateChatInteraction',_0x2a2d85[_0xacee('0x12')],_0x216969);_0x5826db(_0x16acd2[_0xacee('0x10')](0x1f4,_0x2a2d85[_0xacee('0x12')]));});});};exports[_0xacee('0x1c')]=function(_0x141332){return new Promise(function(_0xdcbb56,_0x25f54c){return db[_0xacee('0x1d')][_0xacee('0x1e')]({'where':_0x141332[_0xacee('0x19')]?_0x141332[_0xacee('0x19')][_0xacee('0x1a')]||null:null})['then'](function(_0x523c64){if(_0x523c64){return _0x523c64[_0xacee('0x1f')](_0x141332[_0xacee('0x20')][_0xacee('0x21')],_['omit'](_0x141332['body'],[_0xacee('0x21'),'id'])||{});}})['spread'](function(_0x47258d){logger[_0xacee('0x13')](_0xacee('0x22'),_0x141332);logger[_0xacee('0x23')](_0xacee('0x22'),_0x141332,JSON[_0xacee('0xf')](_0x47258d));_0xdcbb56(_0x47258d);})[_0xacee('0x16')](function(_0x402a1f){logger[_0xacee('0x10')]('AddTags',_0x402a1f[_0xacee('0x12')],_0x141332);_0x25f54c(_this[_0xacee('0x10')](0x1f4,_0x402a1f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index eee471e..052e45b 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 _0x3967=['register','length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener'];(function(_0xe09d0,_0x1e55d0){var _0x44ad05=function(_0x5095b0){while(--_0x5095b0){_0xe09d0['push'](_0xe09d0['shift']());}};_0x44ad05(++_0x1e55d0);}(_0x3967,0x159));var _0x7396=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x3967[_0xea35d1];return _0x1d7a7c;};'use strict';var ChatInteractionEvents=require(_0x7396('0x0'));var events=[_0x7396('0x1'),_0x7396('0x2'),_0x7396('0x3')];function createListener(_0x41dfa3,_0xd3d4f1){return function(_0x4a767c){_0xd3d4f1[_0x7396('0x4')](_0x41dfa3,_0x4a767c);};}function removeListener(_0x4855de,_0x1d2ff1){return function(){ChatInteractionEvents[_0x7396('0x5')](_0x4855de,_0x1d2ff1);};}exports[_0x7396('0x6')]=function(_0x353883){for(var _0x57085a=0x0,_0x2b6945=events[_0x7396('0x7')];_0x57085a<_0x2b6945;_0x57085a++){var _0x4b211b=events[_0x57085a];var _0x49fa0b=createListener(_0x7396('0x8')+_0x4b211b,_0x353883);ChatInteractionEvents['on'](_0x4b211b,_0x49fa0b);}}; \ No newline at end of file +var _0xda7a=['save','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x495b3d,_0x4d3da4){var _0x4cb329=function(_0xdef9f0){while(--_0xdef9f0){_0x495b3d['push'](_0x495b3d['shift']());}};_0x4cb329(++_0x4d3da4);}(_0xda7a,0x1d7));var _0xada7=function(_0xdfe111,_0x6eb3b7){_0xdfe111=_0xdfe111-0x0;var _0x17f006=_0xda7a[_0xdfe111];return _0x17f006;};'use strict';var ChatInteractionEvents=require(_0xada7('0x0'));var events=[_0xada7('0x1'),'remove',_0xada7('0x2')];function createListener(_0x596abd,_0x5500fa){return function(_0x8ea7a1){_0x5500fa[_0xada7('0x3')](_0x596abd,_0x8ea7a1);};}function removeListener(_0x58ebf6,_0x34fd72){return function(){ChatInteractionEvents[_0xada7('0x4')](_0x58ebf6,_0x34fd72);};}exports[_0xada7('0x5')]=function(_0x224f95){for(var _0x55ed5d=0x0,_0xb2e892=events[_0xada7('0x6')];_0x55ed5d<_0xb2e892;_0x55ed5d++){var _0x149444=events[_0x55ed5d];var _0x5cfa35=createListener(_0xada7('0x7')+_0x149444,_0x224f95);ChatInteractionEvents['on'](_0x149444,_0x5cfa35);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index b10093f..dba572f 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 _0x59fc=['exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','post','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','delete'];(function(_0x35950f,_0x5f4e80){var _0x54ca08=function(_0x450982){while(--_0x450982){_0x35950f['push'](_0x35950f['shift']());}};_0x54ca08(++_0x5f4e80);}(_0x59fc,0x119));var _0xc59f=function(_0x10c7f4,_0x127262){_0x10c7f4=_0x10c7f4-0x0;var _0x47cd57=_0x59fc[_0x10c7f4];return _0x47cd57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc59f('0x0'));var timeout=require(_0xc59f('0x1'));var express=require('express');var router=express[_0xc59f('0x2')]();var fs_extra=require(_0xc59f('0x3'));var auth=require(_0xc59f('0x4'));var interaction=require(_0xc59f('0x5'));var config=require(_0xc59f('0x6'));var controller=require(_0xc59f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc59f('0x8')]);router[_0xc59f('0x9')](_0xc59f('0xa'),auth[_0xc59f('0xb')](),controller[_0xc59f('0xc')]);router[_0xc59f('0x9')](_0xc59f('0xd'),auth['isChatInteractionAuthorized'](),controller['show']);router['get'](_0xc59f('0xe'),auth[_0xc59f('0xf')](),controller[_0xc59f('0x10')]);router[_0xc59f('0x9')](_0xc59f('0x11'),auth[_0xc59f('0xb')](),controller[_0xc59f('0x12')]);router[_0xc59f('0x9')](_0xc59f('0x13'),auth[_0xc59f('0xf')](),controller[_0xc59f('0x14')]);router[_0xc59f('0x9')](_0xc59f('0x15'),auth[_0xc59f('0xb')](),controller[_0xc59f('0x16')]);router['post']('/',auth[_0xc59f('0xb')](),controller[_0xc59f('0x17')]);router['post'](_0xc59f('0x18'),auth[_0xc59f('0xb')](),controller[_0xc59f('0x19')]);var upload=multer({'storage':multer[_0xc59f('0x1a')]({'destination':function(_0x2fb965,_0xd88251,_0x424664){_0x424664(null,path[_0xc59f('0x1b')](config[_0xc59f('0x1c')],_0xc59f('0x1d')));},'filename':function(_0x1838b8,_0xabe55f,_0x49de7c){_0x49de7c(null,util[_0xc59f('0x1e')](_0xc59f('0x1f'),Date[_0xc59f('0x20')](),_0xabe55f[_0xc59f('0x21')][_0xc59f('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xc59f('0x23'),upload[_0xc59f('0x24')](_0xc59f('0x25')),controller[_0xc59f('0x26')]);router[_0xc59f('0x27')](_0xc59f('0x11'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router['post'](_0xc59f('0x28'),auth['isAuthenticated'](),interaction[_0xc59f('0x29')](_0xc59f('0x2a'),_0xc59f('0x2b')),controller[_0xc59f('0x2c')]);router[_0xc59f('0x2d')](_0xc59f('0xd'),auth['isAuthenticated'](),interaction[_0xc59f('0x29')](_0xc59f('0x2a'),_0xc59f('0x2e')),controller['update']);router['put'](_0xc59f('0x2f'),controller[_0xc59f('0x30')]);router[_0xc59f('0x2d')](_0xc59f('0x31'),auth[_0xc59f('0xf')](),controller[_0xc59f('0x32')]);router[_0xc59f('0x2d')](_0xc59f('0x33'),controller[_0xc59f('0x34')]);router['delete'](_0xc59f('0xd'),auth[_0xc59f('0xb')](),interaction[_0xc59f('0x29')](_0xc59f('0x2a'),_0xc59f('0x35')),controller['destroy']);router[_0xc59f('0x36')](_0xc59f('0x28'),auth[_0xc59f('0xb')](),controller['removeTags']);module[_0xc59f('0x37')]=router; \ No newline at end of file +var _0x17fd=['file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','customUpdate','/:id/abandon','/:id/close','close','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','post','/:id/vidaoo','diskStorage','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single'];(function(_0x4e3102,_0x2cdaa7){var _0xd80cc0=function(_0x343dd4){while(--_0x343dd4){_0x4e3102['push'](_0x4e3102['shift']());}};_0xd80cc0(++_0x2cdaa7);}(_0x17fd,0x14a));var _0xd17f=function(_0x1be95f,_0x7cce06){_0x1be95f=_0x1be95f-0x0;var _0x2b3116=_0x17fd[_0x1be95f];return _0x2b3116;};'use strict';var multer=require(_0xd17f('0x0'));var util=require(_0xd17f('0x1'));var path=require('path');var timeout=require(_0xd17f('0x2'));var express=require(_0xd17f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd17f('0x4'));var interaction=require(_0xd17f('0x5'));var config=require(_0xd17f('0x6'));var controller=require(_0xd17f('0x7'));router[_0xd17f('0x8')]('/',auth[_0xd17f('0x9')](),controller[_0xd17f('0xa')]);router[_0xd17f('0x8')](_0xd17f('0xb'),auth[_0xd17f('0x9')](),controller[_0xd17f('0xc')]);router[_0xd17f('0x8')](_0xd17f('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xd17f('0xe')]);router[_0xd17f('0x8')](_0xd17f('0xf'),auth[_0xd17f('0x10')](),controller[_0xd17f('0x11')]);router[_0xd17f('0x8')](_0xd17f('0x12'),auth[_0xd17f('0x9')](),controller['getMessages']);router['get'](_0xd17f('0x13'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0xd17f('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xd17f('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd17f('0x14')](_0xd17f('0x15'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xd17f('0x16')]({'destination':function(_0x52b6b9,_0x25d862,_0x20538a){_0x20538a(null,path['join'](config['root'],_0xd17f('0x17')));},'filename':function(_0x1d8e1b,_0x548a92,_0x13eb6f){_0x13eb6f(null,util[_0xd17f('0x18')](_0xd17f('0x19'),Date['now'](),_0x548a92[_0xd17f('0x1a')][_0xd17f('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd17f('0x14')](_0xd17f('0x1c'),upload[_0xd17f('0x1d')](_0xd17f('0x1e')),controller['attachmentUpload']);router[_0xd17f('0x14')](_0xd17f('0x12'),auth['isChatInteractionAuthorized'](),controller[_0xd17f('0x1f')]);router[_0xd17f('0x14')](_0xd17f('0x20'),auth['isAuthenticated'](),interaction[_0xd17f('0x21')](_0xd17f('0x22'),_0xd17f('0x23')),controller[_0xd17f('0x24')]);router[_0xd17f('0x25')]('/:id',auth[_0xd17f('0x9')](),interaction[_0xd17f('0x21')]('chat','chatinteraction:update'),controller['update']);router[_0xd17f('0x25')]('/:id/custom_update',controller[_0xd17f('0x26')]);router[_0xd17f('0x25')](_0xd17f('0x27'),auth[_0xd17f('0x10')](),controller['abandon']);router['put'](_0xd17f('0x28'),controller[_0xd17f('0x29')]);router[_0xd17f('0x2a')](_0xd17f('0xd'),auth[_0xd17f('0x9')](),interaction['tracked'](_0xd17f('0x22'),'chatinteraction:destroy'),controller[_0xd17f('0x2b')]);router[_0xd17f('0x2a')](_0xd17f('0x20'),auth[_0xd17f('0x9')](),controller['removeTags']);module[_0xd17f('0x2c')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index c0bf785..f6412cb 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 _0xf68b=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x5b1bef,_0x3c6ca0){var _0x8d29f6=function(_0x5d362d){while(--_0x5d362d){_0x5b1bef['push'](_0x5b1bef['shift']());}};_0x8d29f6(++_0x3c6ca0);}(_0xf68b,0x171));var _0xbf68=function(_0x8a34c7,_0x237932){_0x8a34c7=_0x8a34c7-0x0;var _0x379318=_0xf68b[_0x8a34c7];return _0x379318;};'use strict';var Sequelize=require(_0xbf68('0x0'));module[_0xbf68('0x1')]={'body':{'type':Sequelize[_0xbf68('0x2')](_0xbf68('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbf68('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xbf68('0x5')]}}; \ No newline at end of file +var _0xf64f=['BOOLEAN','TEXT','medium'];(function(_0x14cb58,_0x214d62){var _0x5f097e=function(_0x5b8666){while(--_0x5b8666){_0x14cb58['push'](_0x14cb58['shift']());}};_0x5f097e(++_0x214d62);}(_0xf64f,0x160));var _0xff64=function(_0x1b7b59,_0x29f511){_0x1b7b59=_0x1b7b59-0x0;var _0x50ea30=_0xf64f[_0x1b7b59];return _0x50ea30;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xff64('0x0')](_0xff64('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xff64('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index ac4e27e..de6d849 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 _0x70f0=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','type','map','query','filters','model','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','catch','params','keys','fields','merge','find','create','body','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','length','resourceId','push','FromId','ToId','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x2ec24f,_0x52ff21){var _0x4acc7b=function(_0x3ea1e7){while(--_0x3ea1e7){_0x2ec24f['push'](_0x2ec24f['shift']());}};_0x4acc7b(++_0x52ff21);}(_0x70f0,0xce));var _0x070f=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0x70f0[_0x4f0e62];return _0x117ab8;};'use strict';var emlformat=require(_0x070f('0x0'));var rimraf=require(_0x070f('0x1'));var zipdir=require(_0x070f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x070f('0x3'));var moment=require(_0x070f('0x4'));var BPromise=require(_0x070f('0x5'));var Mustache=require('mustache');var util=require(_0x070f('0x6'));var path=require(_0x070f('0x7'));var sox=require(_0x070f('0x8'));var csv=require('to-csv');var ejs=require(_0x070f('0x9'));var fs=require('fs');var fs_extra=require(_0x070f('0xa'));var _=require(_0x070f('0xb'));var squel=require(_0x070f('0xc'));var crypto=require(_0x070f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x070f('0xe'));var toCsv=require(_0x070f('0xf'));var querystring=require(_0x070f('0x10'));var Papa=require(_0x070f('0x11'));var Redis=require(_0x070f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x070f('0x13'));var as=require(_0x070f('0x14'));var hardwareService=require(_0x070f('0x15'));var logger=require(_0x070f('0x16'))(_0x070f('0x17'));var utils=require('../../config/utils');var config=require(_0x070f('0x18'));var licenseUtil=require(_0x070f('0x19'));var db=require('../../mysqldb')['db'];config[_0x070f('0x1a')]=_[_0x070f('0x1b')](config[_0x070f('0x1a')],{'host':_0x070f('0x1c'),'port':0x18eb});var socket=require(_0x070f('0x1d'))(new Redis(config[_0x070f('0x1a')]));require('./chatInternalMessage.socket')[_0x070f('0x1e')](socket);function respondWithStatusCode(_0xc6c121,_0x27d22b){_0x27d22b=_0x27d22b||0xcc;return function(_0x5cffcb){if(_0x5cffcb){return _0xc6c121[_0x070f('0x1f')](_0x27d22b);}return _0xc6c121[_0x070f('0x20')](_0x27d22b)[_0x070f('0x21')]();};}function respondWithResult(_0x4324eb,_0x3716bb){_0x3716bb=_0x3716bb||0xc8;return function(_0x458cfb){if(_0x458cfb){return _0x4324eb[_0x070f('0x20')](_0x3716bb)[_0x070f('0x22')](_0x458cfb);}};}function respondWithFilteredResult(_0x4bf0d6,_0x257d60){return function(_0xdd7fb2){if(_0xdd7fb2){var _0x3b4ff7=typeof _0x257d60[_0x070f('0x23')]===_0x070f('0x24')&&typeof _0x257d60[_0x070f('0x25')]===_0x070f('0x24');var _0x5e4354=_0xdd7fb2[_0x070f('0x26')];var _0x3c951f=_0x3b4ff7?0x0:_0x257d60[_0x070f('0x23')];var _0x4e21f7=_0x3b4ff7?_0xdd7fb2[_0x070f('0x26')]:_0x257d60[_0x070f('0x23')]+_0x257d60[_0x070f('0x25')];var _0x4b17ba;if(_0x4e21f7>=_0x5e4354){_0x4e21f7=_0x5e4354;_0x4b17ba=0xc8;}else{_0x4b17ba=0xce;}_0x4bf0d6['status'](_0x4b17ba);return _0x4bf0d6[_0x070f('0x27')](_0x070f('0x28'),_0x3c951f+'-'+_0x4e21f7+'/'+_0x5e4354)['json'](_0xdd7fb2);}return null;};}function patchUpdates(_0x14e527){return function(_0x1244ca){try{jsonpatch['apply'](_0x1244ca,_0x14e527,!![]);}catch(_0x13840d){return BPromise['reject'](_0x13840d);}return _0x1244ca[_0x070f('0x29')]();};}function saveUpdates(_0x52fa74,_0xa86608){return function(_0x285d6f){if(_0x285d6f){return _0x285d6f[_0x070f('0x2a')](_0x52fa74)[_0x070f('0x2b')](function(_0x2734e5){return _0x2734e5;});}return null;};}function removeEntity(_0x4652a4,_0x4307c7){return function(_0x1a2bb1){if(_0x1a2bb1){return _0x1a2bb1[_0x070f('0x2c')]()['then'](function(){_0x4652a4[_0x070f('0x20')](0xcc)[_0x070f('0x21')]();});}};}function handleEntityNotFound(_0x484925,_0x1682e2){return function(_0x4209e7){if(!_0x4209e7){_0x484925[_0x070f('0x1f')](0x194);}return _0x4209e7;};}function handleError(_0x4c3402,_0x5f3fab){_0x5f3fab=_0x5f3fab||0x1f4;return function(_0xf07d2a){logger[_0x070f('0x2d')](_0xf07d2a[_0x070f('0x2e')]);if(_0xf07d2a['name']){delete _0xf07d2a[_0x070f('0x2f')];}_0x4c3402[_0x070f('0x20')](_0x5f3fab)[_0x070f('0x30')](_0xf07d2a);};}exports['index']=function(_0x13e0cb,_0x37e94a){var _0x4ab7c0={},_0x26079d={},_0x8af5f4={'count':0x0,'rows':[]};var _0x30839f=_['map'](db[_0x070f('0x31')][_0x070f('0x32')],function(_0x5e42fc){return{'name':_0x5e42fc[_0x070f('0x33')],'type':_0x5e42fc[_0x070f('0x34')]['key']};});_0x26079d['model']=_[_0x070f('0x35')](_0x30839f,_0x070f('0x2f'));_0x26079d[_0x070f('0x36')]=_['keys'](_0x13e0cb['query']);_0x26079d[_0x070f('0x37')]=_['intersection'](_0x26079d[_0x070f('0x38')],_0x26079d[_0x070f('0x36')]);_0x4ab7c0[_0x070f('0x39')]=_[_0x070f('0x3a')](_0x26079d['model'],qs['fields'](_0x13e0cb[_0x070f('0x36')]['fields']));_0x4ab7c0[_0x070f('0x39')]=_0x4ab7c0['attributes']['length']?_0x4ab7c0[_0x070f('0x39')]:_0x26079d[_0x070f('0x38')];if(!_0x13e0cb['query'][_0x070f('0x3b')](_0x070f('0x3c'))){_0x4ab7c0[_0x070f('0x25')]=qs['limit'](_0x13e0cb[_0x070f('0x36')][_0x070f('0x25')]);_0x4ab7c0[_0x070f('0x23')]=qs[_0x070f('0x23')](_0x13e0cb[_0x070f('0x36')]['offset']);}_0x4ab7c0[_0x070f('0x3d')]=qs[_0x070f('0x3e')](_0x13e0cb[_0x070f('0x36')][_0x070f('0x3e')]);_0x4ab7c0[_0x070f('0x3f')]=qs[_0x070f('0x37')](_[_0x070f('0x40')](_0x13e0cb[_0x070f('0x36')],_0x26079d[_0x070f('0x37')]),_0x30839f);if(_0x13e0cb[_0x070f('0x36')][_0x070f('0x41')]){_0x4ab7c0[_0x070f('0x3f')]=_['merge'](_0x4ab7c0['where'],{'$or':_[_0x070f('0x35')](_0x30839f,function(_0x106b4d){if(_0x106b4d[_0x070f('0x34')]!=='VIRTUAL'){var _0x200100={};_0x200100[_0x106b4d[_0x070f('0x2f')]]={'$like':'%'+_0x13e0cb['query'][_0x070f('0x41')]+'%'};return _0x200100;}})});}_0x4ab7c0=_['merge']({},_0x4ab7c0,_0x13e0cb[_0x070f('0x42')]);var _0x400666={'where':_0x4ab7c0[_0x070f('0x3f')]};return db['ChatInternalMessage'][_0x070f('0x26')](_0x400666)[_0x070f('0x2b')](function(_0x18cfca){_0x8af5f4[_0x070f('0x26')]=_0x18cfca;if(_0x13e0cb[_0x070f('0x36')][_0x070f('0x43')]){_0x4ab7c0[_0x070f('0x44')]=[{'all':!![]}];}return db[_0x070f('0x31')][_0x070f('0x45')](_0x4ab7c0);})[_0x070f('0x2b')](function(_0x1edfde){_0x8af5f4['rows']=_0x1edfde;return _0x8af5f4;})['then'](respondWithFilteredResult(_0x37e94a,_0x4ab7c0))[_0x070f('0x46')](handleError(_0x37e94a,null));};exports['show']=function(_0x202377,_0x19648c){var _0x1db1b5={'raw':!![],'where':{'id':_0x202377[_0x070f('0x47')]['id']}},_0x44a6f4={};_0x44a6f4[_0x070f('0x38')]=_[_0x070f('0x48')](db[_0x070f('0x31')][_0x070f('0x32')]);_0x44a6f4['query']=_[_0x070f('0x48')](_0x202377[_0x070f('0x36')]);_0x44a6f4[_0x070f('0x37')]=_[_0x070f('0x3a')](_0x44a6f4[_0x070f('0x38')],_0x44a6f4['query']);_0x1db1b5[_0x070f('0x39')]=_['intersection'](_0x44a6f4[_0x070f('0x38')],qs[_0x070f('0x49')](_0x202377[_0x070f('0x36')][_0x070f('0x49')]));_0x1db1b5[_0x070f('0x39')]=_0x1db1b5[_0x070f('0x39')]['length']?_0x1db1b5[_0x070f('0x39')]:_0x44a6f4[_0x070f('0x38')];if(_0x202377[_0x070f('0x36')]['includeAll']){_0x1db1b5[_0x070f('0x44')]=[{'all':!![]}];}_0x1db1b5=_[_0x070f('0x4a')]({},_0x1db1b5,_0x202377[_0x070f('0x42')]);return db[_0x070f('0x31')][_0x070f('0x4b')](_0x1db1b5)[_0x070f('0x2b')](handleEntityNotFound(_0x19648c,null))[_0x070f('0x2b')](respondWithResult(_0x19648c,null))[_0x070f('0x46')](handleError(_0x19648c,null));};exports[_0x070f('0x4c')]=function(_0x44f927,_0x5bd857){return db[_0x070f('0x31')]['create'](_0x44f927[_0x070f('0x4d')],{})[_0x070f('0x2b')](respondWithResult(_0x5bd857,0xc9))['catch'](handleError(_0x5bd857,null));};exports[_0x070f('0x2a')]=function(_0x2a53a3,_0x478108){if(_0x2a53a3[_0x070f('0x4d')]['id']){delete _0x2a53a3[_0x070f('0x4d')]['id'];}return db[_0x070f('0x31')][_0x070f('0x4b')]({'where':{'id':_0x2a53a3[_0x070f('0x47')]['id']}})['then'](handleEntityNotFound(_0x478108,null))[_0x070f('0x2b')](saveUpdates(_0x2a53a3[_0x070f('0x4d')],null))['then'](respondWithResult(_0x478108,null))[_0x070f('0x46')](handleError(_0x478108,null));};exports['destroy']=function(_0x4ba363,_0x395a5d){return db[_0x070f('0x31')][_0x070f('0x4b')]({'where':{'id':_0x4ba363[_0x070f('0x47')]['id']}})[_0x070f('0x2b')](handleEntityNotFound(_0x395a5d,null))[_0x070f('0x2b')](removeEntity(_0x395a5d,null))[_0x070f('0x46')](handleError(_0x395a5d,null));};exports[_0x070f('0x4e')]=function(_0x4e3fff,_0x3f2a44){return db[_0x070f('0x31')]['describe']()[_0x070f('0x2b')](respondWithResult(_0x3f2a44,null))['catch'](handleError(_0x3f2a44,null));};function wrapUser(_0x1b1b4e){return function(_0x1af920){var _0x486d6b=_0x1b1b4e[_0x070f('0x4f')]({'plain':!![]});_0x486d6b[_0x070f('0x50')]=[];if(_0x1af920){_0x486d6b['lastMessageAt']=_0x1af920[_0x070f('0x51')];_0x486d6b[_0x070f('0x52')]=_0x1af920;}else{_0x486d6b[_0x070f('0x53')]=moment(0x0)[_0x070f('0x54')](_0x070f('0x55'));_0x486d6b['lastMessage']={};}return _0x486d6b;};}exports[_0x070f('0x56')]=function(_0x35bd57,_0x5d49ad,_0x2b22a7){var _0x37dc65=[];return db[_0x070f('0x57')][_0x070f('0x45')]({'where':{'role':[_0x070f('0x58'),_0x070f('0x59'),_0x070f('0x5a')]},'attributes':['id',_0x070f('0x5b'),_0x070f('0x2f'),_0x070f('0x5c'),'userpic',_0x070f('0x5d'),_0x070f('0x5e'),_0x070f('0x5f'),_0x070f('0x60'),_0x070f('0x61')],'order':qs['sort'](_0x070f('0x62')),'include':[{'model':db[_0x070f('0x63')],'as':_0x070f('0x64'),'attributes':['id',_0x070f('0x2f'),'type'],'through':{'attributes':[]}}]})[_0x070f('0x2b')](function(_0x66a6b6){if(_0x66a6b6){var _0x4b50d5=_0x35bd57[_0x070f('0x5a')][_0x070f('0x4f')]({'plain':!![]});if(!_0x4b50d5)throw new Error(_0x070f('0x65'));if(_0x4b50d5[_0x070f('0x5c')]===_0x070f('0x5a')){return db['UserProfileSection'][_0x070f('0x4b')]({'where':{'name':_0x070f('0x66'),'userProfileId':_0x4b50d5[_0x070f('0x67')]},'raw':!![]})[_0x070f('0x2b')](function(_0x213b3b){if(_0x213b3b){if(_0x213b3b[_0x070f('0x68')]===0x0){return db[_0x070f('0x69')][_0x070f('0x45')]({'where':{'sectionId':_0x213b3b['id']},'raw':!![]})['then'](function(_0x150f20){var _0x5cad95=[];if(_[_0x070f('0x6a')](_0x150f20)){_0x5cad95=_[_0x070f('0x41')](_0x66a6b6,function(_0x58581b){if(_0x58581b[_0x070f('0x5c')]!=='agent'){return _0x58581b;}});return _0x5cad95;}else{for(var _0x13f914=0x0;_0x13f914<_0x66a6b6[_0x070f('0x6b')];_0x13f914++){var _0x38f6bd=_0x66a6b6[_0x13f914];if(_0x38f6bd[_0x070f('0x5c')]===_0x070f('0x58')){var _0xa677f1=_[_0x070f('0x4b')](_0x150f20,function(_0x2bd11b){return _0x2bd11b[_0x070f('0x6c')]===_0x38f6bd['id'];});if(_0xa677f1)_0x5cad95[_0x070f('0x6d')](_0x38f6bd);}else{_0x5cad95['push'](_0x38f6bd);}}return _0x5cad95;}});}else{return _0x66a6b6;}}else{var _0x4f637=_[_0x070f('0x41')](_0x66a6b6,function(_0x301937){if(_0x301937[_0x070f('0x5c')]!=='agent'){return _0x301937;}});return _0x4f637;}});}else{return _0x66a6b6;}}})[_0x070f('0x2b')](function(_0x1f7b56){var _0x1c3d47=[];if(_0x1f7b56){_0x37dc65=_0x1f7b56;for(var _0x26e395=0x0;_0x26e395<_0x1f7b56[_0x070f('0x6b')];_0x26e395+=0x1){_0x37dc65[_0x26e395][_0x070f('0x50')]=[];_0x1c3d47[_0x070f('0x6d')](db[_0x070f('0x31')]['find']({'where':{'FromId':[_0x35bd57[_0x070f('0x5a')]['id'],_0x1f7b56[_0x26e395]['id']],'ToId':[_0x35bd57[_0x070f('0x5a')]['id'],_0x1f7b56[_0x26e395]['id']],'ChatGroupId':null},'attributes':['id',_0x070f('0x51'),_0x070f('0x6e'),_0x070f('0x6f'),'read','body'],'order':qs[_0x070f('0x3e')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x070f('0x2b')](wrapUser(_0x1f7b56[_0x26e395])));}return BPromise[_0x070f('0x70')](_0x1c3d47);}return[];})[_0x070f('0x2b')](function(_0x527607){return{'rows':_0x527607,'count':_0x527607[_0x070f('0x6b')]};})[_0x070f('0x2b')](respondWithResult(_0x5d49ad,null))[_0x070f('0x46')](handleError(_0x5d49ad,null));}; \ No newline at end of file +var _0xe0a0=['crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','type','includeAll','findAll','show','params','keys','include','options','find','catch','create','update','body','describe','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','role','userpic','allowmessenger','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','UserProfileResource','agent','resourceId','push','ToId','read','-createdAt','all','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x25fded,_0x34216e){var _0x269156=function(_0x190fe0){while(--_0x190fe0){_0x25fded['push'](_0x25fded['shift']());}};_0x269156(++_0x34216e);}(_0xe0a0,0x1b4));var _0x0e0a=function(_0x268e62,_0x4d110b){_0x268e62=_0x268e62-0x0;var _0x7bf75a=_0xe0a0[_0x268e62];return _0x7bf75a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e0a('0x0'));var zipdir=require(_0x0e0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e0a('0x2'));var moment=require('moment');var BPromise=require(_0x0e0a('0x3'));var Mustache=require('mustache');var util=require(_0x0e0a('0x4'));var path=require(_0x0e0a('0x5'));var sox=require(_0x0e0a('0x6'));var csv=require(_0x0e0a('0x7'));var ejs=require(_0x0e0a('0x8'));var fs=require('fs');var fs_extra=require(_0x0e0a('0x9'));var _=require(_0x0e0a('0xa'));var squel=require(_0x0e0a('0xb'));var crypto=require(_0x0e0a('0xc'));var jsforce=require(_0x0e0a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0e0a('0x7'));var querystring=require(_0x0e0a('0xe'));var Papa=require('papaparse');var Redis=require(_0x0e0a('0xf'));var authService=require(_0x0e0a('0x10'));var qs=require(_0x0e0a('0x11'));var as=require(_0x0e0a('0x12'));var hardwareService=require(_0x0e0a('0x13'));var logger=require(_0x0e0a('0x14'))(_0x0e0a('0x15'));var utils=require(_0x0e0a('0x16'));var config=require(_0x0e0a('0x17'));var licenseUtil=require(_0x0e0a('0x18'));var db=require('../../mysqldb')['db'];config[_0x0e0a('0x19')]=_[_0x0e0a('0x1a')](config[_0x0e0a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e0a('0x1b'))(new Redis(config[_0x0e0a('0x19')]));require(_0x0e0a('0x1c'))[_0x0e0a('0x1d')](socket);function respondWithStatusCode(_0x52a3c7,_0x533aae){_0x533aae=_0x533aae||0xcc;return function(_0x57678e){if(_0x57678e){return _0x52a3c7['sendStatus'](_0x533aae);}return _0x52a3c7[_0x0e0a('0x1e')](_0x533aae)['end']();};}function respondWithResult(_0x38c041,_0x32e2e5){_0x32e2e5=_0x32e2e5||0xc8;return function(_0x9b2a3d){if(_0x9b2a3d){return _0x38c041[_0x0e0a('0x1e')](_0x32e2e5)[_0x0e0a('0x1f')](_0x9b2a3d);}};}function respondWithFilteredResult(_0x509934,_0x4b30e2){return function(_0x27e5b5){if(_0x27e5b5){var _0x38e35e=typeof _0x4b30e2[_0x0e0a('0x20')]===_0x0e0a('0x21')&&typeof _0x4b30e2['limit']===_0x0e0a('0x21');var _0x1be1b3=_0x27e5b5[_0x0e0a('0x22')];var _0x1d0483=_0x38e35e?0x0:_0x4b30e2[_0x0e0a('0x20')];var _0x48492f=_0x38e35e?_0x27e5b5[_0x0e0a('0x22')]:_0x4b30e2[_0x0e0a('0x20')]+_0x4b30e2[_0x0e0a('0x23')];var _0x446057;if(_0x48492f>=_0x1be1b3){_0x48492f=_0x1be1b3;_0x446057=0xc8;}else{_0x446057=0xce;}_0x509934[_0x0e0a('0x1e')](_0x446057);return _0x509934[_0x0e0a('0x24')](_0x0e0a('0x25'),_0x1d0483+'-'+_0x48492f+'/'+_0x1be1b3)[_0x0e0a('0x1f')](_0x27e5b5);}return null;};}function patchUpdates(_0x48eb07){return function(_0x220fc8){try{jsonpatch[_0x0e0a('0x26')](_0x220fc8,_0x48eb07,!![]);}catch(_0x578afe){return BPromise[_0x0e0a('0x27')](_0x578afe);}return _0x220fc8[_0x0e0a('0x28')]();};}function saveUpdates(_0x5ea290,_0x45cd95){return function(_0x2ee231){if(_0x2ee231){return _0x2ee231['update'](_0x5ea290)[_0x0e0a('0x29')](function(_0x13dc69){return _0x13dc69;});}return null;};}function removeEntity(_0x476df2,_0x3d2aad){return function(_0x1a9d80){if(_0x1a9d80){return _0x1a9d80[_0x0e0a('0x2a')]()[_0x0e0a('0x29')](function(){_0x476df2['status'](0xcc)[_0x0e0a('0x2b')]();});}};}function handleEntityNotFound(_0x52845c,_0x25431e){return function(_0x7657ea){if(!_0x7657ea){_0x52845c[_0x0e0a('0x2c')](0x194);}return _0x7657ea;};}function handleError(_0x1fa692,_0x5604fa){_0x5604fa=_0x5604fa||0x1f4;return function(_0x5796bb){logger[_0x0e0a('0x2d')](_0x5796bb[_0x0e0a('0x2e')]);if(_0x5796bb[_0x0e0a('0x2f')]){delete _0x5796bb[_0x0e0a('0x2f')];}_0x1fa692['status'](_0x5604fa)[_0x0e0a('0x30')](_0x5796bb);};}exports[_0x0e0a('0x31')]=function(_0x45028c,_0x48a4ba){var _0x3d87f5={},_0x72a797={},_0x1b117d={'count':0x0,'rows':[]};var _0x53f0d7=_[_0x0e0a('0x32')](db[_0x0e0a('0x33')][_0x0e0a('0x34')],function(_0x2866ce){return{'name':_0x2866ce[_0x0e0a('0x35')],'type':_0x2866ce['type'][_0x0e0a('0x36')]};});_0x72a797[_0x0e0a('0x37')]=_[_0x0e0a('0x32')](_0x53f0d7,_0x0e0a('0x2f'));_0x72a797[_0x0e0a('0x38')]=_['keys'](_0x45028c[_0x0e0a('0x38')]);_0x72a797['filters']=_[_0x0e0a('0x39')](_0x72a797['model'],_0x72a797[_0x0e0a('0x38')]);_0x3d87f5[_0x0e0a('0x3a')]=_[_0x0e0a('0x39')](_0x72a797[_0x0e0a('0x37')],qs[_0x0e0a('0x3b')](_0x45028c['query'][_0x0e0a('0x3b')]));_0x3d87f5[_0x0e0a('0x3a')]=_0x3d87f5[_0x0e0a('0x3a')][_0x0e0a('0x3c')]?_0x3d87f5[_0x0e0a('0x3a')]:_0x72a797[_0x0e0a('0x37')];if(!_0x45028c[_0x0e0a('0x38')]['hasOwnProperty'](_0x0e0a('0x3d'))){_0x3d87f5[_0x0e0a('0x23')]=qs['limit'](_0x45028c[_0x0e0a('0x38')][_0x0e0a('0x23')]);_0x3d87f5[_0x0e0a('0x20')]=qs[_0x0e0a('0x20')](_0x45028c[_0x0e0a('0x38')][_0x0e0a('0x20')]);}_0x3d87f5[_0x0e0a('0x3e')]=qs[_0x0e0a('0x3f')](_0x45028c[_0x0e0a('0x38')]['sort']);_0x3d87f5[_0x0e0a('0x40')]=qs['filters'](_[_0x0e0a('0x41')](_0x45028c[_0x0e0a('0x38')],_0x72a797[_0x0e0a('0x42')]),_0x53f0d7);if(_0x45028c['query'][_0x0e0a('0x43')]){_0x3d87f5[_0x0e0a('0x40')]=_[_0x0e0a('0x44')](_0x3d87f5[_0x0e0a('0x40')],{'$or':_[_0x0e0a('0x32')](_0x53f0d7,function(_0x20f89f){if(_0x20f89f[_0x0e0a('0x45')]!=='VIRTUAL'){var _0x1954a4={};_0x1954a4[_0x20f89f[_0x0e0a('0x2f')]]={'$like':'%'+_0x45028c[_0x0e0a('0x38')]['filter']+'%'};return _0x1954a4;}})});}_0x3d87f5=_[_0x0e0a('0x44')]({},_0x3d87f5,_0x45028c['options']);var _0x1f7a39={'where':_0x3d87f5[_0x0e0a('0x40')]};return db[_0x0e0a('0x33')][_0x0e0a('0x22')](_0x1f7a39)[_0x0e0a('0x29')](function(_0x3ca0b2){_0x1b117d['count']=_0x3ca0b2;if(_0x45028c['query'][_0x0e0a('0x46')]){_0x3d87f5['include']=[{'all':!![]}];}return db[_0x0e0a('0x33')][_0x0e0a('0x47')](_0x3d87f5);})[_0x0e0a('0x29')](function(_0x2a9db8){_0x1b117d['rows']=_0x2a9db8;return _0x1b117d;})[_0x0e0a('0x29')](respondWithFilteredResult(_0x48a4ba,_0x3d87f5))['catch'](handleError(_0x48a4ba,null));};exports[_0x0e0a('0x48')]=function(_0x33023d,_0x35e836){var _0x958553={'raw':!![],'where':{'id':_0x33023d[_0x0e0a('0x49')]['id']}},_0x28e85f={};_0x28e85f[_0x0e0a('0x37')]=_[_0x0e0a('0x4a')](db['ChatInternalMessage'][_0x0e0a('0x34')]);_0x28e85f['query']=_[_0x0e0a('0x4a')](_0x33023d[_0x0e0a('0x38')]);_0x28e85f[_0x0e0a('0x42')]=_[_0x0e0a('0x39')](_0x28e85f['model'],_0x28e85f['query']);_0x958553[_0x0e0a('0x3a')]=_[_0x0e0a('0x39')](_0x28e85f[_0x0e0a('0x37')],qs[_0x0e0a('0x3b')](_0x33023d[_0x0e0a('0x38')][_0x0e0a('0x3b')]));_0x958553[_0x0e0a('0x3a')]=_0x958553[_0x0e0a('0x3a')][_0x0e0a('0x3c')]?_0x958553[_0x0e0a('0x3a')]:_0x28e85f[_0x0e0a('0x37')];if(_0x33023d['query'][_0x0e0a('0x46')]){_0x958553[_0x0e0a('0x4b')]=[{'all':!![]}];}_0x958553=_[_0x0e0a('0x44')]({},_0x958553,_0x33023d[_0x0e0a('0x4c')]);return db['ChatInternalMessage'][_0x0e0a('0x4d')](_0x958553)[_0x0e0a('0x29')](handleEntityNotFound(_0x35e836,null))[_0x0e0a('0x29')](respondWithResult(_0x35e836,null))[_0x0e0a('0x4e')](handleError(_0x35e836,null));};exports[_0x0e0a('0x4f')]=function(_0x1e3c45,_0x4c1200){return db[_0x0e0a('0x33')][_0x0e0a('0x4f')](_0x1e3c45['body'],{})[_0x0e0a('0x29')](respondWithResult(_0x4c1200,0xc9))[_0x0e0a('0x4e')](handleError(_0x4c1200,null));};exports[_0x0e0a('0x50')]=function(_0x476645,_0x14c4be){if(_0x476645[_0x0e0a('0x51')]['id']){delete _0x476645[_0x0e0a('0x51')]['id'];}return db[_0x0e0a('0x33')]['find']({'where':{'id':_0x476645[_0x0e0a('0x49')]['id']}})['then'](handleEntityNotFound(_0x14c4be,null))['then'](saveUpdates(_0x476645['body'],null))['then'](respondWithResult(_0x14c4be,null))[_0x0e0a('0x4e')](handleError(_0x14c4be,null));};exports[_0x0e0a('0x2a')]=function(_0x594404,_0x41a0dd){return db[_0x0e0a('0x33')]['find']({'where':{'id':_0x594404['params']['id']}})[_0x0e0a('0x29')](handleEntityNotFound(_0x41a0dd,null))[_0x0e0a('0x29')](removeEntity(_0x41a0dd,null))[_0x0e0a('0x4e')](handleError(_0x41a0dd,null));};exports[_0x0e0a('0x52')]=function(_0x5ed341,_0x4fc9f7){return db['ChatInternalMessage'][_0x0e0a('0x52')]()['then'](respondWithResult(_0x4fc9f7,null))[_0x0e0a('0x4e')](handleError(_0x4fc9f7,null));};function wrapUser(_0x2dc755){return function(_0x2d0fe5){var _0x1621fc=_0x2dc755['get']({'plain':!![]});_0x1621fc[_0x0e0a('0x53')]=[];if(_0x2d0fe5){_0x1621fc['lastMessageAt']=_0x2d0fe5[_0x0e0a('0x54')];_0x1621fc[_0x0e0a('0x55')]=_0x2d0fe5;}else{_0x1621fc[_0x0e0a('0x56')]=moment(0x0)[_0x0e0a('0x57')](_0x0e0a('0x58'));_0x1621fc[_0x0e0a('0x55')]={};}return _0x1621fc;};}exports[_0x0e0a('0x59')]=function(_0x5adf90,_0xe1fe1b,_0x10b18f){var _0x3f7e76=[];return db[_0x0e0a('0x5a')][_0x0e0a('0x47')]({'where':{'role':['agent',_0x0e0a('0x5b'),_0x0e0a('0x5c')]},'attributes':['id',_0x0e0a('0x5d'),'name',_0x0e0a('0x5e'),_0x0e0a('0x5f'),'internal','online','lastLoginAt',_0x0e0a('0x60'),'showWebBar'],'order':qs[_0x0e0a('0x3f')](_0x0e0a('0x61')),'include':[{'model':db[_0x0e0a('0x62')],'as':_0x0e0a('0x63'),'attributes':['id',_0x0e0a('0x2f'),'type'],'through':{'attributes':[]}}]})[_0x0e0a('0x29')](function(_0x3fd13a){if(_0x3fd13a){var _0x101a06=_0x5adf90[_0x0e0a('0x5c')][_0x0e0a('0x64')]({'plain':!![]});if(!_0x101a06)throw new Error(_0x0e0a('0x65'));if(_0x101a06['role']==='user'){return db[_0x0e0a('0x66')][_0x0e0a('0x4d')]({'where':{'name':_0x0e0a('0x67'),'userProfileId':_0x101a06['userProfileId']},'raw':!![]})[_0x0e0a('0x29')](function(_0x55b878){if(_0x55b878){if(_0x55b878['autoAssociation']===0x0){return db[_0x0e0a('0x68')]['findAll']({'where':{'sectionId':_0x55b878['id']},'raw':!![]})['then'](function(_0x412fb1){var _0x277815=[];if(_['isEmpty'](_0x412fb1)){_0x277815=_[_0x0e0a('0x43')](_0x3fd13a,function(_0x31e370){if(_0x31e370[_0x0e0a('0x5e')]!=='agent'){return _0x31e370;}});return _0x277815;}else{for(var _0x5511c4=0x0;_0x5511c4<_0x3fd13a[_0x0e0a('0x3c')];_0x5511c4++){var _0x36ca55=_0x3fd13a[_0x5511c4];if(_0x36ca55['role']===_0x0e0a('0x69')){var _0x40742f=_['find'](_0x412fb1,function(_0xf36440){return _0xf36440[_0x0e0a('0x6a')]===_0x36ca55['id'];});if(_0x40742f)_0x277815['push'](_0x36ca55);}else{_0x277815[_0x0e0a('0x6b')](_0x36ca55);}}return _0x277815;}});}else{return _0x3fd13a;}}else{var _0x2c08da=_['filter'](_0x3fd13a,function(_0x659dca){if(_0x659dca[_0x0e0a('0x5e')]!=='agent'){return _0x659dca;}});return _0x2c08da;}});}else{return _0x3fd13a;}}})[_0x0e0a('0x29')](function(_0x1c69bd){var _0x1deb7e=[];if(_0x1c69bd){_0x3f7e76=_0x1c69bd;for(var _0x55e1df=0x0;_0x55e1df<_0x1c69bd[_0x0e0a('0x3c')];_0x55e1df+=0x1){_0x3f7e76[_0x55e1df][_0x0e0a('0x53')]=[];_0x1deb7e[_0x0e0a('0x6b')](db[_0x0e0a('0x33')][_0x0e0a('0x4d')]({'where':{'FromId':[_0x5adf90['user']['id'],_0x1c69bd[_0x55e1df]['id']],'ToId':[_0x5adf90[_0x0e0a('0x5c')]['id'],_0x1c69bd[_0x55e1df]['id']],'ChatGroupId':null},'attributes':['id',_0x0e0a('0x54'),'FromId',_0x0e0a('0x6c'),_0x0e0a('0x6d'),_0x0e0a('0x51')],'order':qs[_0x0e0a('0x3f')](_0x0e0a('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x0e0a('0x29')](wrapUser(_0x1c69bd[_0x55e1df])));}return BPromise[_0x0e0a('0x6f')](_0x1deb7e);}return[];})[_0x0e0a('0x29')](function(_0x42aa1f){return{'rows':_0x42aa1f,'count':_0x42aa1f[_0x0e0a('0x3c')]};})[_0x0e0a('0x29')](respondWithResult(_0xe1fe1b,null))[_0x0e0a('0x4e')](handleError(_0xe1fe1b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 669aab0..a1b4a64 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 _0x9632=['exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x38dd4e,_0x21899e){var _0x5991ac=function(_0x591367){while(--_0x591367){_0x38dd4e['push'](_0x38dd4e['shift']());}};_0x5991ac(++_0x21899e);}(_0x9632,0x109));var _0x2963=function(_0x470534,_0x8973a5){_0x470534=_0x470534-0x0;var _0x3e78c6=_0x9632[_0x470534];return _0x3e78c6;};'use strict';var EventEmitter=require(_0x2963('0x0'));var ChatInternalMessage=require(_0x2963('0x1'))['db'][_0x2963('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2963('0x3')](0x0);var events={'afterCreate':_0x2963('0x4'),'afterUpdate':_0x2963('0x5'),'afterDestroy':_0x2963('0x6')};function emitEvent(_0x5f5833){return function(_0x4aa47c,_0x7e629f,_0x263ab9){ChatInternalMessageEvents[_0x2963('0x7')](_0x5f5833+':'+_0x4aa47c['id'],_0x4aa47c);ChatInternalMessageEvents[_0x2963('0x7')](_0x5f5833,_0x4aa47c);_0x263ab9(null);};}for(var e in events){if(events[_0x2963('0x8')](e)){var event=events[e];ChatInternalMessage[_0x2963('0x9')](e,emitEvent(event));}}module[_0x2963('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x4aab=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x4aab,0x15e));var _0xb4aa=function(_0x1e2f07,_0x5442a8){_0x1e2f07=_0x1e2f07-0x0;var _0x17e8f0=_0x4aab[_0x1e2f07];return _0x17e8f0;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xb4aa('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb4aa('0x1')](0x0);var events={'afterCreate':_0xb4aa('0x2'),'afterUpdate':_0xb4aa('0x3'),'afterDestroy':_0xb4aa('0x4')};function emitEvent(_0x2ed5f0){return function(_0x5730a5,_0x23a9d1,_0x49c97f){ChatInternalMessageEvents[_0xb4aa('0x5')](_0x2ed5f0+':'+_0x5730a5['id'],_0x5730a5);ChatInternalMessageEvents[_0xb4aa('0x5')](_0x2ed5f0,_0x5730a5);_0x49c97f(null);};}for(var e in events){if(events[_0xb4aa('0x6')](e)){var event=events[e];ChatInternalMessage[_0xb4aa('0x7')](e,emitEvent(event));}}module[_0xb4aa('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 4df8f5f..8f420e5 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 _0xcebe=['moment','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x32c48c,_0x5d669e){var _0x133729=function(_0x369daa){while(--_0x369daa){_0x32c48c['push'](_0x32c48c['shift']());}};_0x133729(++_0x5d669e);}(_0xcebe,0x66));var _0xeceb=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xcebe[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xeceb('0x0'));var util=require('util');var logger=require(_0xeceb('0x1'))(_0xeceb('0x2'));var moment=require(_0xeceb('0x3'));var BPromise=require(_0xeceb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeceb('0x5'));var rimraf=require(_0xeceb('0x6'));var config=require(_0xeceb('0x7'));var attributes=require(_0xeceb('0x8'));module[_0xeceb('0x9')]=function(_0x5ac722,_0x45b512){return _0x5ac722[_0xeceb('0xa')](_0xeceb('0xb'),attributes,{'tableName':_0xeceb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeceb('0xd'),'collate':_0xeceb('0xe')});}; \ No newline at end of file +var _0x2ea5=['moment','request-promise','path','rimraf','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x580673,_0x4615d9){var _0x2c3dae=function(_0x3d21ad){while(--_0x3d21ad){_0x580673['push'](_0x580673['shift']());}};_0x2c3dae(++_0x4615d9);}(_0x2ea5,0x111));var _0x52ea=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2ea5[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x52ea('0x0'));var util=require(_0x52ea('0x1'));var logger=require(_0x52ea('0x2'))('api');var moment=require(_0x52ea('0x3'));var BPromise=require('bluebird');var rp=require(_0x52ea('0x4'));var fs=require('fs');var path=require(_0x52ea('0x5'));var rimraf=require(_0x52ea('0x6'));var config=require('../../config/environment');var attributes=require(_0x52ea('0x7'));module[_0x52ea('0x8')]=function(_0x3d5002,_0x2bf464){return _0x3d5002[_0x52ea('0x9')]('ChatInternalMessage',attributes,{'tableName':_0x52ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x52ea('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 6619752..58afd3a 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 _0x1d50=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util','../../mysqldb','../../config/utils'];(function(_0x3780dc,_0x196bff){var _0x4ae839=function(_0x45f6dc){while(--_0x45f6dc){_0x3780dc['push'](_0x3780dc['shift']());}};_0x4ae839(++_0x196bff);}(_0x1d50,0x1c7));var _0x01d5=function(_0x12c7e8,_0x44bd32){_0x12c7e8=_0x12c7e8-0x0;var _0x58f01a=_0x1d50[_0x12c7e8];return _0x58f01a;};'use strict';var _=require(_0x01d5('0x0'));var util=require(_0x01d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01d5('0x2'))['db'];var utils=require(_0x01d5('0x3'));var logger=require(_0x01d5('0x4'))('rpc');var config=require(_0x01d5('0x5'));var jayson=require(_0x01d5('0x6'));var client=jayson[_0x01d5('0x7')][_0x01d5('0x8')]({'port':0x232a});config[_0x01d5('0x9')]=_[_0x01d5('0xa')](config['redis'],{'host':_0x01d5('0xb'),'port':0x18eb});var socket=require(_0x01d5('0xc'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x01d5('0xd')](socket);function respondWithRpcPromise(_0x50ae8a,_0x1a44c7,_0x1b315d){return new BPromise(function(_0x12aaa9,_0x5d1edd){return client[_0x01d5('0xe')](_0x50ae8a,_0x1b315d)[_0x01d5('0xf')](function(_0xed0c54){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x1a44c7,_0x01d5('0x10'));logger[_0x01d5('0x11')](_0x01d5('0x12'),_0x1a44c7,_0x01d5('0x10'),JSON[_0x01d5('0x13')](_0xed0c54));if(_0xed0c54[_0x01d5('0x14')]){if(_0xed0c54[_0x01d5('0x14')][_0x01d5('0x15')]===0x1f4){logger[_0x01d5('0x14')](_0x01d5('0x16'),_0x1a44c7,_0xed0c54['error'][_0x01d5('0x17')]);return _0x5d1edd(_0xed0c54[_0x01d5('0x14')][_0x01d5('0x17')]);}logger[_0x01d5('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x1a44c7,_0xed0c54['error'][_0x01d5('0x17')]);return _0x12aaa9(_0xed0c54['error'][_0x01d5('0x17')]);}else{logger[_0x01d5('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x1a44c7,_0x01d5('0x10'));_0x12aaa9(_0xed0c54[_0x01d5('0x19')][_0x01d5('0x17')]);}})[_0x01d5('0x1a')](function(_0x12e7be){logger[_0x01d5('0x14')](_0x01d5('0x16'),_0x1a44c7,_0x12e7be);_0x5d1edd(_0x12e7be);});});} \ No newline at end of file +var _0xe73c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','message','error','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4b49c9,_0x290d55){var _0xab2d67=function(_0x3a8e9c){while(--_0x3a8e9c){_0x4b49c9['push'](_0x4b49c9['shift']());}};_0xab2d67(++_0x290d55);}(_0xe73c,0x167));var _0xce73=function(_0x285aad,_0x445f62){_0x285aad=_0x285aad-0x0;var _0x3f765f=_0xe73c[_0x285aad];return _0x3f765f;};'use strict';var _=require(_0xce73('0x0'));var util=require(_0xce73('0x1'));var moment=require(_0xce73('0x2'));var BPromise=require(_0xce73('0x3'));var rs=require(_0xce73('0x4'));var fs=require('fs');var Redis=require(_0xce73('0x5'));var db=require(_0xce73('0x6'))['db'];var utils=require(_0xce73('0x7'));var logger=require(_0xce73('0x8'))(_0xce73('0x9'));var config=require(_0xce73('0xa'));var jayson=require(_0xce73('0xb'));var client=jayson[_0xce73('0xc')]['http']({'port':0x232a});config[_0xce73('0xd')]=_['defaults'](config[_0xce73('0xd')],{'host':_0xce73('0xe'),'port':0x18eb});var socket=require(_0xce73('0xf'))(new Redis(config[_0xce73('0xd')]));require(_0xce73('0x10'))['register'](socket);function respondWithRpcPromise(_0x1c78ce,_0x5f2b4d,_0x147769){return new BPromise(function(_0x4863a8,_0x86e993){return client[_0xce73('0x11')](_0x1c78ce,_0x147769)['then'](function(_0x4412cb){logger[_0xce73('0x12')](_0xce73('0x13'),_0x5f2b4d,_0xce73('0x14'));logger[_0xce73('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5f2b4d,_0xce73('0x14'),JSON[_0xce73('0x16')](_0x4412cb));if(_0x4412cb['error']){if(_0x4412cb['error'][_0xce73('0x17')]===0x1f4){logger['error'](_0xce73('0x13'),_0x5f2b4d,_0x4412cb['error'][_0xce73('0x18')]);return _0x86e993(_0x4412cb[_0xce73('0x19')][_0xce73('0x18')]);}logger['error'](_0xce73('0x13'),_0x5f2b4d,_0x4412cb[_0xce73('0x19')]['message']);return _0x4863a8(_0x4412cb[_0xce73('0x19')][_0xce73('0x18')]);}else{logger[_0xce73('0x12')](_0xce73('0x13'),_0x5f2b4d,'request\x20sent');_0x4863a8(_0x4412cb[_0xce73('0x1a')][_0xce73('0x18')]);}})[_0xce73('0x1b')](function(_0x2820d4){logger['error'](_0xce73('0x13'),_0x5f2b4d,_0x2820d4);_0x86e993(_0x2820d4);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7aaac2d..ce1bc67 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 _0x1de6=['./chatInternalMessage.events','save','emit','removeListener','register','chatInternalMessage:'];(function(_0x14e2dc,_0x5f3535){var _0x1843c3=function(_0x56f5cc){while(--_0x56f5cc){_0x14e2dc['push'](_0x14e2dc['shift']());}};_0x1843c3(++_0x5f3535);}(_0x1de6,0xe4));var _0x61de=function(_0x35344a,_0x1790b6){_0x35344a=_0x35344a-0x0;var _0x285085=_0x1de6[_0x35344a];return _0x285085;};'use strict';var ChatInternalMessageEvents=require(_0x61de('0x0'));var events=[_0x61de('0x1'),'remove','update'];function createListener(_0x2fb0e1,_0x1df6b3){return function(_0x1950a7){_0x1df6b3[_0x61de('0x2')](_0x2fb0e1,_0x1950a7);};}function removeListener(_0x773d5,_0x5638ce){return function(){ChatInternalMessageEvents[_0x61de('0x3')](_0x773d5,_0x5638ce);};}exports[_0x61de('0x4')]=function(_0x430f64){for(var _0x4dafde=0x0,_0x4f3177=events['length'];_0x4dafde<_0x4f3177;_0x4dafde++){var _0x5f4654=events[_0x4dafde];var _0x5efab3=createListener(_0x61de('0x5')+_0x5f4654,_0x430f64);ChatInternalMessageEvents['on'](_0x5f4654,_0x5efab3);}}; \ No newline at end of file +var _0x8ae7=['remove','emit','length','chatInternalMessage:','save'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0x8ae7,0xbd));var _0x78ae=function(_0x52a71a,_0x18eb2d){_0x52a71a=_0x52a71a-0x0;var _0x57e72d=_0x8ae7[_0x52a71a];return _0x57e72d;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x78ae('0x0'),_0x78ae('0x1'),'update'];function createListener(_0x105d1d,_0x183203){return function(_0x15b56c){_0x183203[_0x78ae('0x2')](_0x105d1d,_0x15b56c);};}function removeListener(_0x4def10,_0x3269e2){return function(){ChatInternalMessageEvents['removeListener'](_0x4def10,_0x3269e2);};}exports['register']=function(_0x3bb778){for(var _0x3832ac=0x0,_0x5b2b03=events[_0x78ae('0x3')];_0x3832ac<_0x5b2b03;_0x3832ac++){var _0x229fac=events[_0x3832ac];var _0x2d2722=createListener(_0x78ae('0x4')+_0x229fac,_0x3bb778);ChatInternalMessageEvents['on'](_0x229fac,_0x2d2722);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 360d5b6..194beb5 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 _0x57e4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/users','getUsers','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x5266e7,_0x97b16b){var _0x5470f1=function(_0x10258e){while(--_0x10258e){_0x5266e7['push'](_0x5266e7['shift']());}};_0x5470f1(++_0x97b16b);}(_0x57e4,0x17a));var _0x457e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x57e4[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x457e('0x0'));var util=require(_0x457e('0x1'));var path=require(_0x457e('0x2'));var timeout=require('connect-timeout');var express=require(_0x457e('0x3'));var router=express[_0x457e('0x4')]();var fs_extra=require(_0x457e('0x5'));var auth=require(_0x457e('0x6'));var interaction=require(_0x457e('0x7'));var config=require(_0x457e('0x8'));var controller=require(_0x457e('0x9'));router[_0x457e('0xa')]('/',auth[_0x457e('0xb')](),controller[_0x457e('0xc')]);router[_0x457e('0xa')](_0x457e('0xd'),auth[_0x457e('0xb')](),controller['describe']);router[_0x457e('0xa')](_0x457e('0xe'),auth[_0x457e('0xb')](),controller[_0x457e('0xf')]);router[_0x457e('0xa')](_0x457e('0x10'),auth[_0x457e('0xb')](),controller[_0x457e('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x457e('0x12')]);router[_0x457e('0x13')](_0x457e('0x10'),controller[_0x457e('0x14')]);router[_0x457e('0x15')](_0x457e('0x10'),auth[_0x457e('0xb')](),controller[_0x457e('0x16')]);module[_0x457e('0x17')]=router; \ No newline at end of file +var _0x28ab=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','/users','getUsers','/:id','create','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x28ab,0x1f0));var _0xb28a=function(_0x585fbd,_0x4d5656){_0x585fbd=_0x585fbd-0x0;var _0x5a4d82=_0x28ab[_0x585fbd];return _0x5a4d82;};'use strict';var multer=require(_0xb28a('0x0'));var util=require(_0xb28a('0x1'));var path=require('path');var timeout=require(_0xb28a('0x2'));var express=require(_0xb28a('0x3'));var router=express[_0xb28a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb28a('0x5'));var interaction=require(_0xb28a('0x6'));var config=require(_0xb28a('0x7'));var controller=require(_0xb28a('0x8'));router[_0xb28a('0x9')]('/',auth['isAuthenticated'](),controller[_0xb28a('0xa')]);router['get'](_0xb28a('0xb'),auth[_0xb28a('0xc')](),controller['describe']);router['get'](_0xb28a('0xd'),auth['isAuthenticated'](),controller[_0xb28a('0xe')]);router[_0xb28a('0x9')](_0xb28a('0xf'),auth[_0xb28a('0xc')](),controller['show']);router['post']('/',auth[_0xb28a('0xc')](),controller[_0xb28a('0x10')]);router['put']('/:id',controller[_0xb28a('0x11')]);router[_0xb28a('0x12')](_0xb28a('0xf'),auth[_0xb28a('0xc')](),controller[_0xb28a('0x13')]);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 3762daa..713e577 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 _0x8130=['BOOLEAN','ENUM','out','STRING','sequelize','exports','medium'];(function(_0x6511bb,_0x5b2c5c){var _0x57501a=function(_0x3fcdd1){while(--_0x3fcdd1){_0x6511bb['push'](_0x6511bb['shift']());}};_0x57501a(++_0x5b2c5c);}(_0x8130,0x146));var _0x0813=function(_0x1b87f9,_0x30d453){_0x1b87f9=_0x1b87f9-0x0;var _0x3ab567=_0x8130[_0x1b87f9];return _0x3ab567;};'use strict';var Sequelize=require(_0x0813('0x0'));module[_0x0813('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0813('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0813('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0813('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0813('0x4')]('in',_0x0813('0x5')),'defaultValue':_0x0813('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x0813('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x152f=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x152f,0x144));var _0xf152=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x152f[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0xf152('0x0'));module[_0xf152('0x1')]={'body':{'type':Sequelize[_0xf152('0x2')](_0xf152('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf152('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf152('0x5')]('in',_0xf152('0x6')),'defaultValue':_0xf152('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf152('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf152('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 76ad628..daa5570 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 _0xed46=['info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','offset','undefined','limit','count','set','json','apply','reject','update','destroy','sendStatus','name','send','map','ChatMessage','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','merge','include','findAll','rows','catch','show','keys','length','includeAll','options','find','create','body','params','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','Sequelize','SELECT','rejectmessage','parse','formData','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','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','redis','socket.io-emitter','jayson/promise','client','http','request','then'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xed46,0x1f0));var _0x6ed4=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0xed46[_0x31172e];return _0x414ada;};'use strict';var emlformat=require(_0x6ed4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ed4('0x1'));var jsonpatch=require(_0x6ed4('0x2'));var rp=require('request-promise');var moment=require(_0x6ed4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ed4('0x4'));var util=require(_0x6ed4('0x5'));var path=require('path');var sox=require(_0x6ed4('0x6'));var csv=require(_0x6ed4('0x7'));var ejs=require(_0x6ed4('0x8'));var fs=require('fs');var fs_extra=require(_0x6ed4('0x9'));var _=require('lodash');var squel=require(_0x6ed4('0xa'));var crypto=require(_0x6ed4('0xb'));var jsforce=require(_0x6ed4('0xc'));var deskjs=require(_0x6ed4('0xd'));var toCsv=require(_0x6ed4('0x7'));var querystring=require(_0x6ed4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6ed4('0xf'));var qs=require(_0x6ed4('0x10'));var as=require(_0x6ed4('0x11'));var hardwareService=require(_0x6ed4('0x12'));var logger=require(_0x6ed4('0x13'))(_0x6ed4('0x14'));var utils=require(_0x6ed4('0x15'));var config=require(_0x6ed4('0x16'));var licenseUtil=require(_0x6ed4('0x17'));var db=require(_0x6ed4('0x18'))['db'];config[_0x6ed4('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6ed4('0x1a'))(new Redis(config[_0x6ed4('0x19')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x6ed4('0x1b'));var client=jayson[_0x6ed4('0x1c')][_0x6ed4('0x1d')]({'port':0x232c});var client9002=jayson[_0x6ed4('0x1c')][_0x6ed4('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x259dd6,_0x2ece2f,_0x3d0019,_0x51b6bb){return new BPromise(function(_0x50f5b8,_0x473d7c){var _0x470e9a=_0x51b6bb||client;return _0x470e9a[_0x6ed4('0x1e')](_0x259dd6,_0x3d0019)[_0x6ed4('0x1f')](function(_0x5f1432){logger[_0x6ed4('0x20')](_0x6ed4('0x21'),_0x2ece2f,_0x6ed4('0x22'));logger[_0x6ed4('0x23')](_0x6ed4('0x24'),_0x2ece2f,_0x6ed4('0x22'),JSON[_0x6ed4('0x25')](_0x5f1432));if(_0x5f1432['error']){if(_0x5f1432[_0x6ed4('0x26')][_0x6ed4('0x27')]===0x1f4){logger['error'](_0x6ed4('0x21'),_0x2ece2f,_0x5f1432[_0x6ed4('0x26')][_0x6ed4('0x28')]);return _0x473d7c(_0x5f1432['error']['message']);}logger[_0x6ed4('0x26')]('ChatMessage,\x20%s,\x20%s',_0x2ece2f,_0x5f1432[_0x6ed4('0x26')]['message']);return _0x50f5b8(_0x5f1432['error'][_0x6ed4('0x28')]);}else{logger[_0x6ed4('0x20')](_0x6ed4('0x21'),_0x2ece2f,'request\x20sent');_0x50f5b8(_0x5f1432[_0x6ed4('0x29')][_0x6ed4('0x28')]);}})['catch'](function(_0x1a90ba){logger[_0x6ed4('0x26')](_0x6ed4('0x21'),_0x2ece2f,_0x1a90ba);_0x473d7c(_0x1a90ba);});});}function respondWithStatusCode(_0x3d8eac,_0x2af3e1){_0x2af3e1=_0x2af3e1||0xcc;return function(_0x14caa8){if(_0x14caa8){return _0x3d8eac['sendStatus'](_0x2af3e1);}return _0x3d8eac[_0x6ed4('0x2a')](_0x2af3e1)['end']();};}function respondWithResult(_0x2551f8,_0x32b3d9){_0x32b3d9=_0x32b3d9||0xc8;return function(_0xbaa09f){if(_0xbaa09f){return _0x2551f8[_0x6ed4('0x2a')](_0x32b3d9)['json'](_0xbaa09f);}};}function respondWithFilteredResult(_0x4d1613,_0x2664a7){return function(_0x3e6bef){if(_0x3e6bef){var _0x56cb55=typeof _0x2664a7[_0x6ed4('0x2b')]===_0x6ed4('0x2c')&&typeof _0x2664a7[_0x6ed4('0x2d')]===_0x6ed4('0x2c');var _0x2b1e2b=_0x3e6bef[_0x6ed4('0x2e')];var _0x29e1c3=_0x56cb55?0x0:_0x2664a7[_0x6ed4('0x2b')];var _0x5b6e56=_0x56cb55?_0x3e6bef[_0x6ed4('0x2e')]:_0x2664a7['offset']+_0x2664a7[_0x6ed4('0x2d')];var _0x259700;if(_0x5b6e56>=_0x2b1e2b){_0x5b6e56=_0x2b1e2b;_0x259700=0xc8;}else{_0x259700=0xce;}_0x4d1613[_0x6ed4('0x2a')](_0x259700);return _0x4d1613[_0x6ed4('0x2f')]('Content-Range',_0x29e1c3+'-'+_0x5b6e56+'/'+_0x2b1e2b)[_0x6ed4('0x30')](_0x3e6bef);}return null;};}function patchUpdates(_0x37b795){return function(_0x40a131){try{jsonpatch[_0x6ed4('0x31')](_0x40a131,_0x37b795,!![]);}catch(_0x1d1c12){return BPromise[_0x6ed4('0x32')](_0x1d1c12);}return _0x40a131['save']();};}function saveUpdates(_0x297c80,_0x14b2f0){return function(_0x12cac0){if(_0x12cac0){return _0x12cac0[_0x6ed4('0x33')](_0x297c80)[_0x6ed4('0x1f')](function(_0x44ca5e){return _0x44ca5e;});}return null;};}function removeEntity(_0x5ce0e0,_0x324ba2){return function(_0x2b996a){if(_0x2b996a){return _0x2b996a[_0x6ed4('0x34')]()[_0x6ed4('0x1f')](function(){_0x5ce0e0[_0x6ed4('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a1df9,_0x2d6bd5){return function(_0x44250a){if(!_0x44250a){_0x4a1df9[_0x6ed4('0x35')](0x194);}return _0x44250a;};}function handleError(_0x5bbd37,_0x1b29d6){_0x1b29d6=_0x1b29d6||0x1f4;return function(_0xb8e154){logger['error'](_0xb8e154['stack']);if(_0xb8e154[_0x6ed4('0x36')]){delete _0xb8e154[_0x6ed4('0x36')];}_0x5bbd37[_0x6ed4('0x2a')](_0x1b29d6)[_0x6ed4('0x37')](_0xb8e154);};}exports['index']=function(_0x26907a,_0x45e006){var _0x1fb3ea={},_0x36812b={},_0x3b36f5={'count':0x0,'rows':[]};var _0x24ba21=_[_0x6ed4('0x38')](db[_0x6ed4('0x39')][_0x6ed4('0x3a')],function(_0x2ce7b0){return{'name':_0x2ce7b0[_0x6ed4('0x3b')],'type':_0x2ce7b0[_0x6ed4('0x3c')]['key']};});_0x36812b[_0x6ed4('0x3d')]=_['map'](_0x24ba21,_0x6ed4('0x36'));_0x36812b[_0x6ed4('0x3e')]=_['keys'](_0x26907a[_0x6ed4('0x3e')]);_0x36812b['filters']=_[_0x6ed4('0x3f')](_0x36812b[_0x6ed4('0x3d')],_0x36812b[_0x6ed4('0x3e')]);_0x1fb3ea[_0x6ed4('0x40')]=_[_0x6ed4('0x3f')](_0x36812b[_0x6ed4('0x3d')],qs[_0x6ed4('0x41')](_0x26907a['query'][_0x6ed4('0x41')]));_0x1fb3ea['attributes']=_0x1fb3ea['attributes']['length']?_0x1fb3ea[_0x6ed4('0x40')]:_0x36812b[_0x6ed4('0x3d')];if(!_0x26907a[_0x6ed4('0x3e')][_0x6ed4('0x42')](_0x6ed4('0x43'))){_0x1fb3ea[_0x6ed4('0x2d')]=qs[_0x6ed4('0x2d')](_0x26907a[_0x6ed4('0x3e')][_0x6ed4('0x2d')]);_0x1fb3ea[_0x6ed4('0x2b')]=qs['offset'](_0x26907a[_0x6ed4('0x3e')]['offset']);}_0x1fb3ea[_0x6ed4('0x44')]=qs[_0x6ed4('0x45')](_0x26907a['query'][_0x6ed4('0x45')]);_0x1fb3ea['where']=qs['filters'](_[_0x6ed4('0x46')](_0x26907a[_0x6ed4('0x3e')],_0x36812b[_0x6ed4('0x47')]),_0x24ba21);if(_0x26907a[_0x6ed4('0x3e')][_0x6ed4('0x48')]){_0x1fb3ea[_0x6ed4('0x49')]=_['merge'](_0x1fb3ea[_0x6ed4('0x49')],{'$or':_[_0x6ed4('0x38')](_0x24ba21,function(_0x34b24d){if(_0x34b24d['type']!==_0x6ed4('0x4a')){var _0x37cbfe={};_0x37cbfe[_0x34b24d['name']]={'$like':'%'+_0x26907a[_0x6ed4('0x3e')][_0x6ed4('0x48')]+'%'};return _0x37cbfe;}})});}_0x1fb3ea=_[_0x6ed4('0x4b')]({},_0x1fb3ea,_0x26907a['options']);var _0x4207ad={'where':_0x1fb3ea[_0x6ed4('0x49')]};return db['ChatMessage'][_0x6ed4('0x2e')](_0x4207ad)[_0x6ed4('0x1f')](function(_0x31e1d3){_0x3b36f5['count']=_0x31e1d3;if(_0x26907a[_0x6ed4('0x3e')]['includeAll']){_0x1fb3ea[_0x6ed4('0x4c')]=[{'all':!![]}];}return db[_0x6ed4('0x39')][_0x6ed4('0x4d')](_0x1fb3ea);})[_0x6ed4('0x1f')](function(_0x5cb306){_0x3b36f5[_0x6ed4('0x4e')]=_0x5cb306;return _0x3b36f5;})['then'](respondWithFilteredResult(_0x45e006,_0x1fb3ea))[_0x6ed4('0x4f')](handleError(_0x45e006,null));};exports[_0x6ed4('0x50')]=function(_0xea3c71,_0x5901bf){var _0x1ae4b6={'raw':!![],'where':{'id':_0xea3c71['params']['id']}},_0x2d6f82={};_0x2d6f82[_0x6ed4('0x3d')]=_[_0x6ed4('0x51')](db[_0x6ed4('0x39')][_0x6ed4('0x3a')]);_0x2d6f82[_0x6ed4('0x3e')]=_['keys'](_0xea3c71[_0x6ed4('0x3e')]);_0x2d6f82[_0x6ed4('0x47')]=_[_0x6ed4('0x3f')](_0x2d6f82[_0x6ed4('0x3d')],_0x2d6f82['query']);_0x1ae4b6[_0x6ed4('0x40')]=_[_0x6ed4('0x3f')](_0x2d6f82['model'],qs[_0x6ed4('0x41')](_0xea3c71[_0x6ed4('0x3e')]['fields']));_0x1ae4b6[_0x6ed4('0x40')]=_0x1ae4b6[_0x6ed4('0x40')][_0x6ed4('0x52')]?_0x1ae4b6[_0x6ed4('0x40')]:_0x2d6f82[_0x6ed4('0x3d')];if(_0xea3c71[_0x6ed4('0x3e')][_0x6ed4('0x53')]){_0x1ae4b6[_0x6ed4('0x4c')]=[{'all':!![]}];}_0x1ae4b6=_[_0x6ed4('0x4b')]({},_0x1ae4b6,_0xea3c71[_0x6ed4('0x54')]);return db[_0x6ed4('0x39')][_0x6ed4('0x55')](_0x1ae4b6)['then'](handleEntityNotFound(_0x5901bf,null))[_0x6ed4('0x1f')](respondWithResult(_0x5901bf,null))[_0x6ed4('0x4f')](handleError(_0x5901bf,null));};exports[_0x6ed4('0x56')]=function(_0x323f3c,_0x3889f0){return db['ChatMessage']['create'](_0x323f3c[_0x6ed4('0x57')],{})[_0x6ed4('0x1f')](respondWithResult(_0x3889f0,0xc9))[_0x6ed4('0x4f')](handleError(_0x3889f0,null));};exports['update']=function(_0x42cf79,_0x1dc8a0){if(_0x42cf79[_0x6ed4('0x57')]['id']){delete _0x42cf79[_0x6ed4('0x57')]['id'];}return db[_0x6ed4('0x39')]['find']({'where':{'id':_0x42cf79[_0x6ed4('0x58')]['id']}})[_0x6ed4('0x1f')](handleEntityNotFound(_0x1dc8a0,null))[_0x6ed4('0x1f')](saveUpdates(_0x42cf79['body'],null))[_0x6ed4('0x1f')](respondWithResult(_0x1dc8a0,null))[_0x6ed4('0x4f')](handleError(_0x1dc8a0,null));};exports[_0x6ed4('0x34')]=function(_0x500d6a,_0x335e4b){return db[_0x6ed4('0x39')]['find']({'where':{'id':_0x500d6a['params']['id']}})[_0x6ed4('0x1f')](handleEntityNotFound(_0x335e4b,null))[_0x6ed4('0x1f')](removeEntity(_0x335e4b,null))[_0x6ed4('0x4f')](handleError(_0x335e4b,null));};exports['describe']=function(_0x4ec17e,_0x1af94a){return db[_0x6ed4('0x39')][_0x6ed4('0x59')]()[_0x6ed4('0x1f')](respondWithResult(_0x1af94a,null))['catch'](handleError(_0x1af94a,null));};var interaction_log=require(_0x6ed4('0x13'))(_0x6ed4('0x5a'));exports[_0x6ed4('0x5b')]=function(_0x50dd97,_0x50cf1d,_0x2a4740){var _0x1b0cca={'agent':{},'channel':_0x6ed4('0x5c')};if(_0x50dd97['body']['id']){delete _0x50dd97[_0x6ed4('0x57')]['id'];}_0x50dd97[_0x6ed4('0x57')][_0x6ed4('0x5d')]=!![];_0x50dd97[_0x6ed4('0x57')][_0x6ed4('0x5e')]=moment()[_0x6ed4('0x5f')](_0x6ed4('0x60'));_0x50dd97[_0x6ed4('0x57')][_0x6ed4('0x61')]=_0x50dd97['body'][_0x6ed4('0x61')]||_0x50dd97[_0x6ed4('0x62')]['id'];_0x1b0cca[_0x6ed4('0x63')]['id']=_0x50dd97[_0x6ed4('0x57')]['UserId'];return db[_0x6ed4('0x39')]['find']({'where':{'id':_0x50dd97['params']['id'],'UserId':null}})[_0x6ed4('0x1f')](handleEntityNotFound(_0x50cf1d,null))['then'](saveUpdates(_0x50dd97['body'],null))['then'](function(_0x4b3365){if(_0x4b3365){_0x1b0cca['message']=_0x4b3365['get']({'plain':!![]});return db[_0x6ed4('0x64')][_0x6ed4('0x55')]({'where':{'id':_0x4b3365[_0x6ed4('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x50cf1d,null))[_0x6ed4('0x1f')](function(_0x1bbfe3){if(_0x1bbfe3){return _0x1bbfe3[_0x6ed4('0x33')]({'UserId':_0x50dd97[_0x6ed4('0x57')][_0x6ed4('0x61')],'read1stAt':_[_0x6ed4('0x66')](_0x1bbfe3[_0x6ed4('0x67')])?moment()[_0x6ed4('0x5f')](_0x6ed4('0x60')):undefined});}return null;})[_0x6ed4('0x1f')](function(_0x4fbfe3){if(_0x4fbfe3){_0x1b0cca[_0x6ed4('0x68')]=_0x4fbfe3[_0x6ed4('0x69')]({'plain':!![]});interaction_log[_0x6ed4('0x20')](_0x6ed4('0x6a'),_0x50dd97[_0x6ed4('0x62')]['id'],_0x50dd97[_0x6ed4('0x62')][_0x6ed4('0x36')],_0x50dd97[_0x6ed4('0x62')][_0x6ed4('0x6b')],_0x1b0cca[_0x6ed4('0x68')]['id'],_0x50dd97['body']?JSON[_0x6ed4('0x25')](_0x50dd97[_0x6ed4('0x57')]):_0x6ed4('0x6c'));return respondWithRpcPromise(_0x6ed4('0x6d'),'acceptMessage',_0x1b0cca);}return null;})[_0x6ed4('0x1f')](function(_0x12b227){var _0x12c156=_0x6ed4('0x6e')+_0x12b227[_0x6ed4('0x28')][_0x6ed4('0x6f')];return db['sequelize'][_0x6ed4('0x3e')](_0x12c156,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x6ed4('0x1f')](function(_0x4c4312){return _0x4c4312;});})['then'](function(_0x41edca){if(_0x41edca){_0x1b0cca[_0x6ed4('0x28')][_0x6ed4('0x70')]=_0x41edca[0x0];if(!_0x50dd97['body'][_0x6ed4('0x61')])return;return db[_0x6ed4('0x71')][_0x6ed4('0x55')]({'where':{'id':_0x50dd97[_0x6ed4('0x57')][_0x6ed4('0x61')],'role':_0x6ed4('0x63')},'attributes':['id',_0x6ed4('0x36'),_0x6ed4('0x72'),_0x6ed4('0x73'),_0x6ed4('0x74')],'raw':!![]});}return null;})[_0x6ed4('0x1f')](function(_0x4da3f3){if(!_0x4da3f3)return null;_0x1b0cca[_0x6ed4('0x28')][_0x6ed4('0x63')]=_0x4da3f3;return _0x1b0cca;})[_0x6ed4('0x1f')](function(_0x44d994){if(_0x44d994){if(_0x50dd97[_0x6ed4('0x57')][_0x6ed4('0x75')]){_0x1b0cca[_0x6ed4('0x28')][_0x6ed4('0x76')]=util[_0x6ed4('0x5f')](_0x6ed4('0x77'),_0x50dd97[_0x6ed4('0x62')]['name']);_0x1b0cca[_0x6ed4('0x28')][_0x6ed4('0x78')]=_0x1b0cca[_0x6ed4('0x78')];_0x1b0cca['message'][_0x6ed4('0x79')]=_0x1b0cca['channel'];_0x1b0cca[_0x6ed4('0x28')][_0x6ed4('0x7a')]='accept';return respondWithRpcPromise('EventManager',_0x6ed4('0x7b'),{'event':_0x6ed4('0x7c'),'message':_[_0x6ed4('0x4b')](_0x1b0cca['message'],JSON['parse'](_0x1b0cca['interaction']['formData']))},client9002)[_0x6ed4('0x1f')](function(){return _0x1b0cca;});}return _0x1b0cca;}return null;})[_0x6ed4('0x1f')](respondWithResult(_0x50cf1d,null))[_0x6ed4('0x4f')](handleError(_0x50cf1d,null));};var interaction_log=require(_0x6ed4('0x13'))(_0x6ed4('0x5a'));exports[_0x6ed4('0x32')]=function(_0x1b7d05,_0x3d00e6,_0xb7b367){var _0x57b930={'agent':{},'channel':'chat'};if(_0x1b7d05['body']['id']){delete _0x1b7d05['body']['id'];}_0x1b7d05[_0x6ed4('0x57')][_0x6ed4('0x61')]=_0x1b7d05[_0x6ed4('0x57')][_0x6ed4('0x61')]||_0x1b7d05[_0x6ed4('0x62')]['id'];_0x57b930[_0x6ed4('0x63')]['id']=_0x1b7d05['body'][_0x6ed4('0x61')];return db['ChatMessage'][_0x6ed4('0x55')]({'where':{'id':_0x1b7d05[_0x6ed4('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d00e6,null))[_0x6ed4('0x1f')](function(_0x57aa4b){if(_0x57aa4b){_0x57b930[_0x6ed4('0x28')]=_0x57aa4b['get']({'plain':!![]});return db[_0x6ed4('0x64')][_0x6ed4('0x55')]({'where':{'id':_0x57aa4b['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3d00e6,null))[_0x6ed4('0x1f')](function(_0x383c35){if(_0x383c35){_0x57b930[_0x6ed4('0x68')]=_0x383c35[_0x6ed4('0x69')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b7d05[_0x6ed4('0x62')]['id'],_0x1b7d05[_0x6ed4('0x62')]['name'],_0x1b7d05[_0x6ed4('0x62')]['role'],_0x57b930['interaction']['id'],_0x1b7d05['body']?JSON[_0x6ed4('0x25')](_0x1b7d05['body']):_0x6ed4('0x6c'));return respondWithRpcPromise(_0x6ed4('0x7d'),_0x6ed4('0x7e'),_0x57b930);}return null;})[_0x6ed4('0x1f')](function(_0x243cf3){var _0xc54993=_0x6ed4('0x6e')+_0x243cf3[_0x6ed4('0x28')]['ContactId'];return db['sequelize'][_0x6ed4('0x3e')](_0xc54993,{'type':db[_0x6ed4('0x7f')]['QueryTypes'][_0x6ed4('0x80')],'raw':!![]})[_0x6ed4('0x1f')](function(_0x6fe345){return _0x6fe345;});})[_0x6ed4('0x1f')](function(_0x127adf){if(_0x127adf){_0x57b930[_0x6ed4('0x28')][_0x6ed4('0x70')]=_0x127adf[0x0];if(!_0x1b7d05[_0x6ed4('0x57')][_0x6ed4('0x61')])return;return db['User'][_0x6ed4('0x55')]({'where':{'id':_0x1b7d05[_0x6ed4('0x57')]['UserId'],'role':_0x6ed4('0x63')},'attributes':['id','name',_0x6ed4('0x72'),'email',_0x6ed4('0x74')],'raw':!![]});}return null;})[_0x6ed4('0x1f')](function(_0x580b43){if(!_0x580b43)return null;_0x57b930[_0x6ed4('0x28')][_0x6ed4('0x63')]=_0x580b43;return _0x57b930;})[_0x6ed4('0x1f')](function(_0x1cddf8){if(_0x1cddf8){_0x1cddf8[_0x6ed4('0x28')]['interface']=util[_0x6ed4('0x5f')]('SIP/%s',_0x1b7d05[_0x6ed4('0x62')][_0x6ed4('0x36')]);_0x1cddf8['message'][_0x6ed4('0x78')]=_0x57b930['channel'];_0x1cddf8[_0x6ed4('0x28')][_0x6ed4('0x79')]=_0x57b930['channel'];_0x1cddf8['message'][_0x6ed4('0x7a')]=_0x6ed4('0x32');respondWithRpcPromise(_0x6ed4('0x7b'),_0x6ed4('0x7b'),{'event':_0x6ed4('0x81'),'message':_[_0x6ed4('0x4b')](_0x57b930[_0x6ed4('0x28')],JSON[_0x6ed4('0x82')](_0x57b930[_0x6ed4('0x68')][_0x6ed4('0x83')]))},client9002);return _0x57b930;}return null;})[_0x6ed4('0x1f')](respondWithResult(_0x3d00e6,null))[_0x6ed4('0x4f')](handleError(_0x3d00e6,null));}; \ No newline at end of file +var _0x1324=['index','ChatMessage','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','params','length','include','options','find','create','body','accept','read','readAt','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','channel','EventManager','acceptmessage','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','motionChannel','event','formData','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','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','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','stack','name','send'];(function(_0x3f1a30,_0x497fdc){var _0x386744=function(_0x4772b9){while(--_0x4772b9){_0x3f1a30['push'](_0x3f1a30['shift']());}};_0x386744(++_0x497fdc);}(_0x1324,0x1c3));var _0x4132=function(_0x34f942,_0x491219){_0x34f942=_0x34f942-0x0;var _0x436530=_0x1324[_0x34f942];return _0x436530;};'use strict';var emlformat=require(_0x4132('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4132('0x1'));var rp=require(_0x4132('0x2'));var moment=require(_0x4132('0x3'));var BPromise=require(_0x4132('0x4'));var Mustache=require(_0x4132('0x5'));var util=require('util');var path=require(_0x4132('0x6'));var sox=require(_0x4132('0x7'));var csv=require(_0x4132('0x8'));var ejs=require(_0x4132('0x9'));var fs=require('fs');var fs_extra=require(_0x4132('0xa'));var _=require(_0x4132('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4132('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4132('0x8'));var querystring=require(_0x4132('0xd'));var Papa=require('papaparse');var Redis=require(_0x4132('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4132('0xf'));var as=require(_0x4132('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4132('0x11'))(_0x4132('0x12'));var utils=require(_0x4132('0x13'));var config=require(_0x4132('0x14'));var licenseUtil=require(_0x4132('0x15'));var db=require(_0x4132('0x16'))['db'];config[_0x4132('0x17')]=_[_0x4132('0x18')](config[_0x4132('0x17')],{'host':_0x4132('0x19'),'port':0x18eb});var socket=require(_0x4132('0x1a'))(new Redis(config[_0x4132('0x17')]));require('./chatMessage.socket')[_0x4132('0x1b')](socket);var jayson=require(_0x4132('0x1c'));var client=jayson[_0x4132('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x4132('0x1d')][_0x4132('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x265b45,_0x55e53b,_0xf48165,_0x1b4fa2){return new BPromise(function(_0x4e4851,_0x39722e){var _0x457377=_0x1b4fa2||client;return _0x457377[_0x4132('0x1f')](_0x265b45,_0xf48165)[_0x4132('0x20')](function(_0x2cdccc){logger[_0x4132('0x21')](_0x4132('0x22'),_0x55e53b,'request\x20sent');logger[_0x4132('0x23')](_0x4132('0x24'),_0x55e53b,_0x4132('0x25'),JSON['stringify'](_0x2cdccc));if(_0x2cdccc[_0x4132('0x26')]){if(_0x2cdccc['error'][_0x4132('0x27')]===0x1f4){logger[_0x4132('0x26')](_0x4132('0x22'),_0x55e53b,_0x2cdccc[_0x4132('0x26')][_0x4132('0x28')]);return _0x39722e(_0x2cdccc[_0x4132('0x26')][_0x4132('0x28')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x55e53b,_0x2cdccc[_0x4132('0x26')]['message']);return _0x4e4851(_0x2cdccc[_0x4132('0x26')]['message']);}else{logger[_0x4132('0x21')](_0x4132('0x22'),_0x55e53b,'request\x20sent');_0x4e4851(_0x2cdccc[_0x4132('0x29')][_0x4132('0x28')]);}})['catch'](function(_0x757dbf){logger[_0x4132('0x26')](_0x4132('0x22'),_0x55e53b,_0x757dbf);_0x39722e(_0x757dbf);});});}function respondWithStatusCode(_0x44d69b,_0x582afb){_0x582afb=_0x582afb||0xcc;return function(_0x214a2b){if(_0x214a2b){return _0x44d69b[_0x4132('0x2a')](_0x582afb);}return _0x44d69b[_0x4132('0x2b')](_0x582afb)[_0x4132('0x2c')]();};}function respondWithResult(_0x682775,_0x78877f){_0x78877f=_0x78877f||0xc8;return function(_0x21ffea){if(_0x21ffea){return _0x682775['status'](_0x78877f)[_0x4132('0x2d')](_0x21ffea);}};}function respondWithFilteredResult(_0xce20fc,_0x41f3f7){return function(_0x4cdf5f){if(_0x4cdf5f){var _0x47f787=typeof _0x41f3f7[_0x4132('0x2e')]===_0x4132('0x2f')&&typeof _0x41f3f7[_0x4132('0x30')]===_0x4132('0x2f');var _0x56be7b=_0x4cdf5f[_0x4132('0x31')];var _0x222fa0=_0x47f787?0x0:_0x41f3f7[_0x4132('0x2e')];var _0x13bb50=_0x47f787?_0x4cdf5f[_0x4132('0x31')]:_0x41f3f7['offset']+_0x41f3f7[_0x4132('0x30')];var _0x4c5073;if(_0x13bb50>=_0x56be7b){_0x13bb50=_0x56be7b;_0x4c5073=0xc8;}else{_0x4c5073=0xce;}_0xce20fc[_0x4132('0x2b')](_0x4c5073);return _0xce20fc['set'](_0x4132('0x32'),_0x222fa0+'-'+_0x13bb50+'/'+_0x56be7b)[_0x4132('0x2d')](_0x4cdf5f);}return null;};}function patchUpdates(_0x1694d6){return function(_0x283f01){try{jsonpatch[_0x4132('0x33')](_0x283f01,_0x1694d6,!![]);}catch(_0x2dde48){return BPromise['reject'](_0x2dde48);}return _0x283f01['save']();};}function saveUpdates(_0x434d8a,_0x89da55){return function(_0x1e4980){if(_0x1e4980){return _0x1e4980[_0x4132('0x34')](_0x434d8a)[_0x4132('0x20')](function(_0x27e7ce){return _0x27e7ce;});}return null;};}function removeEntity(_0x5b5176,_0x189aab){return function(_0x51899d){if(_0x51899d){return _0x51899d[_0x4132('0x35')]()[_0x4132('0x20')](function(){_0x5b5176[_0x4132('0x2b')](0xcc)[_0x4132('0x2c')]();});}};}function handleEntityNotFound(_0x170bdc,_0x2068f1){return function(_0x3ae7fa){if(!_0x3ae7fa){_0x170bdc['sendStatus'](0x194);}return _0x3ae7fa;};}function handleError(_0x37c191,_0x13c87f){_0x13c87f=_0x13c87f||0x1f4;return function(_0x5ea871){logger[_0x4132('0x26')](_0x5ea871[_0x4132('0x36')]);if(_0x5ea871[_0x4132('0x37')]){delete _0x5ea871['name'];}_0x37c191[_0x4132('0x2b')](_0x13c87f)[_0x4132('0x38')](_0x5ea871);};}exports[_0x4132('0x39')]=function(_0x3b5e0e,_0x152f6a){var _0x20f490={},_0x17661f={},_0x1fdd69={'count':0x0,'rows':[]};var _0x353e55=_['map'](db[_0x4132('0x3a')]['rawAttributes'],function(_0x18724f){return{'name':_0x18724f[_0x4132('0x3b')],'type':_0x18724f[_0x4132('0x3c')][_0x4132('0x3d')]};});_0x17661f[_0x4132('0x3e')]=_[_0x4132('0x3f')](_0x353e55,_0x4132('0x37'));_0x17661f[_0x4132('0x40')]=_[_0x4132('0x41')](_0x3b5e0e[_0x4132('0x40')]);_0x17661f[_0x4132('0x42')]=_[_0x4132('0x43')](_0x17661f[_0x4132('0x3e')],_0x17661f['query']);_0x20f490['attributes']=_['intersection'](_0x17661f[_0x4132('0x3e')],qs[_0x4132('0x44')](_0x3b5e0e[_0x4132('0x40')][_0x4132('0x44')]));_0x20f490[_0x4132('0x45')]=_0x20f490[_0x4132('0x45')]['length']?_0x20f490[_0x4132('0x45')]:_0x17661f['model'];if(!_0x3b5e0e[_0x4132('0x40')]['hasOwnProperty'](_0x4132('0x46'))){_0x20f490[_0x4132('0x30')]=qs['limit'](_0x3b5e0e[_0x4132('0x40')][_0x4132('0x30')]);_0x20f490[_0x4132('0x2e')]=qs[_0x4132('0x2e')](_0x3b5e0e[_0x4132('0x40')][_0x4132('0x2e')]);}_0x20f490[_0x4132('0x47')]=qs[_0x4132('0x48')](_0x3b5e0e[_0x4132('0x40')][_0x4132('0x48')]);_0x20f490['where']=qs[_0x4132('0x42')](_[_0x4132('0x49')](_0x3b5e0e[_0x4132('0x40')],_0x17661f[_0x4132('0x42')]),_0x353e55);if(_0x3b5e0e[_0x4132('0x40')][_0x4132('0x4a')]){_0x20f490[_0x4132('0x4b')]=_['merge'](_0x20f490[_0x4132('0x4b')],{'$or':_[_0x4132('0x3f')](_0x353e55,function(_0x862b60){if(_0x862b60[_0x4132('0x3c')]!==_0x4132('0x4c')){var _0x5ce392={};_0x5ce392[_0x862b60[_0x4132('0x37')]]={'$like':'%'+_0x3b5e0e[_0x4132('0x40')][_0x4132('0x4a')]+'%'};return _0x5ce392;}})});}_0x20f490=_[_0x4132('0x4d')]({},_0x20f490,_0x3b5e0e['options']);var _0x1e8cd6={'where':_0x20f490[_0x4132('0x4b')]};return db[_0x4132('0x3a')][_0x4132('0x31')](_0x1e8cd6)['then'](function(_0x5bd51f){_0x1fdd69[_0x4132('0x31')]=_0x5bd51f;if(_0x3b5e0e['query'][_0x4132('0x4e')]){_0x20f490['include']=[{'all':!![]}];}return db['ChatMessage'][_0x4132('0x4f')](_0x20f490);})[_0x4132('0x20')](function(_0x295b42){_0x1fdd69[_0x4132('0x50')]=_0x295b42;return _0x1fdd69;})[_0x4132('0x20')](respondWithFilteredResult(_0x152f6a,_0x20f490))[_0x4132('0x51')](handleError(_0x152f6a,null));};exports['show']=function(_0x5c7d59,_0x246546){var _0xcbdae5={'raw':!![],'where':{'id':_0x5c7d59[_0x4132('0x52')]['id']}},_0x703f86={};_0x703f86['model']=_[_0x4132('0x41')](db['ChatMessage']['rawAttributes']);_0x703f86[_0x4132('0x40')]=_[_0x4132('0x41')](_0x5c7d59[_0x4132('0x40')]);_0x703f86['filters']=_[_0x4132('0x43')](_0x703f86[_0x4132('0x3e')],_0x703f86['query']);_0xcbdae5[_0x4132('0x45')]=_[_0x4132('0x43')](_0x703f86[_0x4132('0x3e')],qs[_0x4132('0x44')](_0x5c7d59[_0x4132('0x40')][_0x4132('0x44')]));_0xcbdae5['attributes']=_0xcbdae5[_0x4132('0x45')][_0x4132('0x53')]?_0xcbdae5[_0x4132('0x45')]:_0x703f86[_0x4132('0x3e')];if(_0x5c7d59['query'][_0x4132('0x4e')]){_0xcbdae5[_0x4132('0x54')]=[{'all':!![]}];}_0xcbdae5=_['merge']({},_0xcbdae5,_0x5c7d59[_0x4132('0x55')]);return db[_0x4132('0x3a')][_0x4132('0x56')](_0xcbdae5)['then'](handleEntityNotFound(_0x246546,null))[_0x4132('0x20')](respondWithResult(_0x246546,null))['catch'](handleError(_0x246546,null));};exports[_0x4132('0x57')]=function(_0x16f01a,_0x44a48a){return db[_0x4132('0x3a')][_0x4132('0x57')](_0x16f01a[_0x4132('0x58')],{})['then'](respondWithResult(_0x44a48a,0xc9))[_0x4132('0x51')](handleError(_0x44a48a,null));};exports[_0x4132('0x34')]=function(_0xa881f2,_0x25a238){if(_0xa881f2['body']['id']){delete _0xa881f2[_0x4132('0x58')]['id'];}return db[_0x4132('0x3a')][_0x4132('0x56')]({'where':{'id':_0xa881f2[_0x4132('0x52')]['id']}})[_0x4132('0x20')](handleEntityNotFound(_0x25a238,null))[_0x4132('0x20')](saveUpdates(_0xa881f2[_0x4132('0x58')],null))['then'](respondWithResult(_0x25a238,null))[_0x4132('0x51')](handleError(_0x25a238,null));};exports['destroy']=function(_0x13251c,_0x2c494d){return db['ChatMessage'][_0x4132('0x56')]({'where':{'id':_0x13251c[_0x4132('0x52')]['id']}})[_0x4132('0x20')](handleEntityNotFound(_0x2c494d,null))['then'](removeEntity(_0x2c494d,null))[_0x4132('0x51')](handleError(_0x2c494d,null));};exports['describe']=function(_0x22fd74,_0x36c2ef){return db[_0x4132('0x3a')]['describe']()[_0x4132('0x20')](respondWithResult(_0x36c2ef,null))[_0x4132('0x51')](handleError(_0x36c2ef,null));};var interaction_log=require(_0x4132('0x11'))('chat-interactions');exports[_0x4132('0x59')]=function(_0x51cf79,_0x38a024,_0x3c5343){var _0x5a0ffb={'agent':{},'channel':'chat'};if(_0x51cf79['body']['id']){delete _0x51cf79['body']['id'];}_0x51cf79[_0x4132('0x58')][_0x4132('0x5a')]=!![];_0x51cf79[_0x4132('0x58')][_0x4132('0x5b')]=moment()[_0x4132('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x51cf79['body'][_0x4132('0x5d')]=_0x51cf79[_0x4132('0x58')][_0x4132('0x5d')]||_0x51cf79[_0x4132('0x5e')]['id'];_0x5a0ffb[_0x4132('0x5f')]['id']=_0x51cf79['body'][_0x4132('0x5d')];return db[_0x4132('0x3a')][_0x4132('0x56')]({'where':{'id':_0x51cf79['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x38a024,null))['then'](saveUpdates(_0x51cf79[_0x4132('0x58')],null))[_0x4132('0x20')](function(_0x1ca24c){if(_0x1ca24c){_0x5a0ffb[_0x4132('0x28')]=_0x1ca24c[_0x4132('0x60')]({'plain':!![]});return db[_0x4132('0x61')][_0x4132('0x56')]({'where':{'id':_0x1ca24c[_0x4132('0x62')]}});}return null;})[_0x4132('0x20')](handleEntityNotFound(_0x38a024,null))[_0x4132('0x20')](function(_0x3b036c){if(_0x3b036c){return _0x3b036c[_0x4132('0x34')]({'UserId':_0x51cf79[_0x4132('0x58')][_0x4132('0x5d')],'read1stAt':_[_0x4132('0x63')](_0x3b036c[_0x4132('0x64')])?moment()[_0x4132('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4132('0x20')](function(_0x1ae50){if(_0x1ae50){_0x5a0ffb[_0x4132('0x65')]=_0x1ae50['get']({'plain':!![]});interaction_log[_0x4132('0x21')](_0x4132('0x66'),_0x51cf79[_0x4132('0x5e')]['id'],_0x51cf79[_0x4132('0x5e')][_0x4132('0x37')],_0x51cf79[_0x4132('0x5e')][_0x4132('0x67')],_0x5a0ffb[_0x4132('0x65')]['id'],_0x51cf79[_0x4132('0x58')]?JSON['stringify'](_0x51cf79[_0x4132('0x58')]):_0x4132('0x68'));return respondWithRpcPromise(_0x4132('0x69'),_0x4132('0x6a'),_0x5a0ffb);}return null;})['then'](function(_0x1feefe){var _0x2124a8=_0x4132('0x6b')+_0x1feefe[_0x4132('0x28')][_0x4132('0x6c')];return db[_0x4132('0x6d')][_0x4132('0x40')](_0x2124a8,{'type':db[_0x4132('0x6e')][_0x4132('0x6f')][_0x4132('0x70')],'raw':!![]})[_0x4132('0x20')](function(_0xd536f){return _0xd536f;});})['then'](function(_0x4acabc){if(_0x4acabc){_0x5a0ffb[_0x4132('0x28')]['contact']=_0x4acabc[0x0];if(!_0x51cf79[_0x4132('0x58')][_0x4132('0x5d')])return;return db[_0x4132('0x71')]['find']({'where':{'id':_0x51cf79[_0x4132('0x58')][_0x4132('0x5d')],'role':_0x4132('0x5f')},'attributes':['id',_0x4132('0x37'),_0x4132('0x72'),_0x4132('0x73'),_0x4132('0x74')],'raw':!![]});}return null;})['then'](function(_0x222575){if(!_0x222575)return null;_0x5a0ffb['message'][_0x4132('0x5f')]=_0x222575;return _0x5a0ffb;})[_0x4132('0x20')](function(_0xe142a7){if(_0xe142a7){if(_0x51cf79[_0x4132('0x58')][_0x4132('0x75')]){_0x5a0ffb[_0x4132('0x28')]['interface']=util[_0x4132('0x5c')]('SIP/%s',_0x51cf79[_0x4132('0x5e')][_0x4132('0x37')]);_0x5a0ffb['message']['channel']=_0x5a0ffb[_0x4132('0x76')];_0x5a0ffb[_0x4132('0x28')]['motionChannel']=_0x5a0ffb['channel'];_0x5a0ffb['message']['event']=_0x4132('0x59');return respondWithRpcPromise(_0x4132('0x77'),_0x4132('0x77'),{'event':_0x4132('0x78'),'message':_[_0x4132('0x4d')](_0x5a0ffb['message'],JSON['parse'](_0x5a0ffb[_0x4132('0x65')]['formData']))},client9002)['then'](function(){return _0x5a0ffb;});}return _0x5a0ffb;}return null;})[_0x4132('0x20')](respondWithResult(_0x38a024,null))[_0x4132('0x51')](handleError(_0x38a024,null));};var interaction_log=require(_0x4132('0x11'))('chat-interactions');exports[_0x4132('0x79')]=function(_0xbf1a1,_0x41e9cf,_0x324083){var _0x4cb757={'agent':{},'channel':'chat'};if(_0xbf1a1['body']['id']){delete _0xbf1a1[_0x4132('0x58')]['id'];}_0xbf1a1[_0x4132('0x58')][_0x4132('0x5d')]=_0xbf1a1[_0x4132('0x58')][_0x4132('0x5d')]||_0xbf1a1['user']['id'];_0x4cb757['agent']['id']=_0xbf1a1[_0x4132('0x58')][_0x4132('0x5d')];return db[_0x4132('0x3a')][_0x4132('0x56')]({'where':{'id':_0xbf1a1[_0x4132('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x41e9cf,null))[_0x4132('0x20')](function(_0x251787){if(_0x251787){_0x4cb757['message']=_0x251787[_0x4132('0x60')]({'plain':!![]});return db['ChatInteraction'][_0x4132('0x56')]({'where':{'id':_0x251787[_0x4132('0x62')]}});}return null;})[_0x4132('0x20')](handleEntityNotFound(_0x41e9cf,null))['then'](function(_0x1acbd7){if(_0x1acbd7){_0x4cb757[_0x4132('0x65')]=_0x1acbd7[_0x4132('0x60')]({'plain':!![]});interaction_log[_0x4132('0x21')](_0x4132('0x7a'),_0xbf1a1[_0x4132('0x5e')]['id'],_0xbf1a1[_0x4132('0x5e')][_0x4132('0x37')],_0xbf1a1['user']['role'],_0x4cb757[_0x4132('0x65')]['id'],_0xbf1a1[_0x4132('0x58')]?JSON[_0x4132('0x7b')](_0xbf1a1[_0x4132('0x58')]):_0x4132('0x68'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x4cb757);}return null;})['then'](function(_0x303ea5){var _0x3ab198=_0x4132('0x6b')+_0x303ea5[_0x4132('0x28')][_0x4132('0x6c')];return db['sequelize'][_0x4132('0x40')](_0x3ab198,{'type':db['Sequelize'][_0x4132('0x6f')][_0x4132('0x70')],'raw':!![]})['then'](function(_0x4b4dd3){return _0x4b4dd3;});})[_0x4132('0x20')](function(_0x7caf07){if(_0x7caf07){_0x4cb757[_0x4132('0x28')]['contact']=_0x7caf07[0x0];if(!_0xbf1a1[_0x4132('0x58')][_0x4132('0x5d')])return;return db[_0x4132('0x71')][_0x4132('0x56')]({'where':{'id':_0xbf1a1[_0x4132('0x58')][_0x4132('0x5d')],'role':_0x4132('0x5f')},'attributes':['id',_0x4132('0x37'),_0x4132('0x72'),_0x4132('0x73'),'internal'],'raw':!![]});}return null;})['then'](function(_0x32b857){if(!_0x32b857)return null;_0x4cb757[_0x4132('0x28')][_0x4132('0x5f')]=_0x32b857;return _0x4cb757;})[_0x4132('0x20')](function(_0x375125){if(_0x375125){_0x375125['message']['interface']=util[_0x4132('0x5c')]('SIP/%s',_0xbf1a1[_0x4132('0x5e')][_0x4132('0x37')]);_0x375125['message'][_0x4132('0x76')]=_0x4cb757[_0x4132('0x76')];_0x375125[_0x4132('0x28')][_0x4132('0x7c')]=_0x4cb757['channel'];_0x375125[_0x4132('0x28')][_0x4132('0x7d')]=_0x4132('0x79');respondWithRpcPromise(_0x4132('0x77'),_0x4132('0x77'),{'event':'rejectmessage','message':_[_0x4132('0x4d')](_0x4cb757[_0x4132('0x28')],JSON['parse'](_0x4cb757[_0x4132('0x65')][_0x4132('0x7e')]))},client9002);return _0x4cb757;}return null;})[_0x4132('0x20')](respondWithResult(_0x41e9cf,null))[_0x4132('0x51')](handleError(_0x41e9cf,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index bf46df1..e2bdc1d 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 _0xcbef=['events','../../mysqldb','ChatMessage','setMaxListeners','update','emit','hook'];(function(_0x549aca,_0x53345f){var _0x346043=function(_0x3aff24){while(--_0x3aff24){_0x549aca['push'](_0x549aca['shift']());}};_0x346043(++_0x53345f);}(_0xcbef,0x18f));var _0xfcbe=function(_0x3aac12,_0x5ce4a3){_0x3aac12=_0x3aac12-0x0;var _0x283857=_0xcbef[_0x3aac12];return _0x283857;};'use strict';var EventEmitter=require(_0xfcbe('0x0'));var ChatMessage=require(_0xfcbe('0x1'))['db'][_0xfcbe('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xfcbe('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfcbe('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3aab2c){return function(_0x2cc3bc,_0x562221,_0x432ff8){ChatMessageEvents[_0xfcbe('0x5')](_0x3aab2c+':'+_0x2cc3bc['id'],_0x2cc3bc);ChatMessageEvents[_0xfcbe('0x5')](_0x3aab2c,_0x2cc3bc);_0x432ff8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xfcbe('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x542e=['hook','events','../../mysqldb','ChatMessage','setMaxListeners','save','hasOwnProperty'];(function(_0x39ad08,_0x5394b4){var _0x14e210=function(_0x3577b4){while(--_0x3577b4){_0x39ad08['push'](_0x39ad08['shift']());}};_0x14e210(++_0x5394b4);}(_0x542e,0x112));var _0xe542=function(_0x3880b5,_0x356b35){_0x3880b5=_0x3880b5-0x0;var _0x10f090=_0x542e[_0x3880b5];return _0x10f090;};'use strict';var EventEmitter=require(_0xe542('0x0'));var ChatMessage=require(_0xe542('0x1'))['db'][_0xe542('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xe542('0x3')](0x0);var events={'afterCreate':_0xe542('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x16cc05){return function(_0x30c3e0,_0x95a90e,_0x50c0df){ChatMessageEvents['emit'](_0x16cc05+':'+_0x30c3e0['id'],_0x30c3e0);ChatMessageEvents['emit'](_0x16cc05,_0x30c3e0);_0x50c0df(null);};}for(var e in events){if(events[_0xe542('0x5')](e)){var event=events[e];ChatMessage[_0xe542('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 c7cde4e..1377b5b 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 _0x5a89=['define','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports'];(function(_0x4d64e1,_0xa487bf){var _0x4fc424=function(_0xb0be98){while(--_0xb0be98){_0x4d64e1['push'](_0x4d64e1['shift']());}};_0x4fc424(++_0xa487bf);}(_0x5a89,0x18d));var _0x95a8=function(_0x26efaf,_0x3d877e){_0x26efaf=_0x26efaf-0x0;var _0x11551e=_0x5a89[_0x26efaf];return _0x11551e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x95a8('0x0'));var moment=require(_0x95a8('0x1'));var BPromise=require(_0x95a8('0x2'));var rp=require(_0x95a8('0x3'));var fs=require('fs');var path=require(_0x95a8('0x4'));var rimraf=require(_0x95a8('0x5'));var config=require('../../config/environment');var attributes=require(_0x95a8('0x6'));module[_0x95a8('0x7')]=function(_0x58de54,_0x1bd09f){return _0x58de54[_0x95a8('0x8')]('ChatMessage',attributes,{'tableName':_0x95a8('0x9'),'paranoid':![],'indexes':[{'name':_0x95a8('0xa'),'fields':[_0x95a8('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22f400,_0x529652,_0x251e6d){var _0x268389=_0x58de54[_0x95a8('0xc')];var _0x180e61=_0x22f400[_0x95a8('0xd')]({'plain':!![]});if(_0x180e61[_0x95a8('0xe')]['toLowerCase']()==='in'||_0x180e61['direction'][_0x95a8('0xf')]()==='out'&&!_0x180e61['secret']&&!_[_0x95a8('0x10')](_0x180e61[_0x95a8('0x11')])){_0x268389[_0x95a8('0x12')][_0x95a8('0x13')]({'where':{'id':_0x180e61[_0x95a8('0x14')]}})[_0x95a8('0x15')](function(_0x2c424e){if(_0x2c424e){_0x2c424e[_0x95a8('0x16')]({'lastMsgAt':_0x180e61['createdAt'],'lastMsgDirection':_0x180e61['direction']['toLowerCase']()});}})[_0x95a8('0x17')](function(_0x2c4371){console[_0x95a8('0x18')](_0x2c4371);});}_0x251e6d();}},'charset':_0x95a8('0x19'),'collate':_0x95a8('0x1a')});}; \ No newline at end of file +var _0x7d9c=['then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./chatMessage.attributes','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','ChatInteraction','findOne'];(function(_0x136869,_0x3e8265){var _0x42427a=function(_0x208e05){while(--_0x208e05){_0x136869['push'](_0x136869['shift']());}};_0x42427a(++_0x3e8265);}(_0x7d9c,0x114));var _0xc7d9=function(_0x2cdca0,_0x55caad){_0x2cdca0=_0x2cdca0-0x0;var _0x3604a0=_0x7d9c[_0x2cdca0];return _0x3604a0;};'use strict';var _=require(_0xc7d9('0x0'));var util=require(_0xc7d9('0x1'));var logger=require(_0xc7d9('0x2'))(_0xc7d9('0x3'));var moment=require(_0xc7d9('0x4'));var BPromise=require('bluebird');var rp=require(_0xc7d9('0x5'));var fs=require('fs');var path=require(_0xc7d9('0x6'));var rimraf=require(_0xc7d9('0x7'));var config=require('../../config/environment');var attributes=require(_0xc7d9('0x8'));module['exports']=function(_0x56fa36,_0x5c5acc){return _0x56fa36['define'](_0xc7d9('0x9'),attributes,{'tableName':_0xc7d9('0xa'),'paranoid':![],'indexes':[{'name':_0xc7d9('0xb'),'fields':[_0xc7d9('0xc')],'type':_0xc7d9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa165e9,_0xaefec2,_0x278a52){var _0x3b7b24=_0x56fa36['models'];var _0x451989=_0xa165e9[_0xc7d9('0xe')]({'plain':!![]});if(_0x451989['direction'][_0xc7d9('0xf')]()==='in'||_0x451989[_0xc7d9('0x10')][_0xc7d9('0xf')]()==='out'&&!_0x451989[_0xc7d9('0x11')]&&!_[_0xc7d9('0x12')](_0x451989['UserId'])){_0x3b7b24[_0xc7d9('0x13')][_0xc7d9('0x14')]({'where':{'id':_0x451989['ChatInteractionId']}})[_0xc7d9('0x15')](function(_0x2fa443){if(_0x2fa443){_0x2fa443[_0xc7d9('0x16')]({'lastMsgAt':_0x451989[_0xc7d9('0x17')],'lastMsgDirection':_0x451989[_0xc7d9('0x10')]['toLowerCase']()});}})['catch'](function(_0x588001){console[_0xc7d9('0x18')](_0x588001);});}_0x278a52();}},'charset':_0xc7d9('0x19'),'collate':_0xc7d9('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index b7aa1ef..fa395c0 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 _0xa9e3=['options','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','register','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','CreateChatMessage','create','body'];(function(_0x3a85fd,_0x574d49){var _0x2b5c3d=function(_0x85683f){while(--_0x85683f){_0x3a85fd['push'](_0x3a85fd['shift']());}};_0x2b5c3d(++_0x574d49);}(_0xa9e3,0x124));var _0x3a9e=function(_0x1422e6,_0x5f2e29){_0x1422e6=_0x1422e6-0x0;var _0x5791f1=_0xa9e3[_0x1422e6];return _0x5791f1;};'use strict';var _=require(_0x3a9e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3a9e('0x1'));var rs=require(_0x3a9e('0x2'));var fs=require('fs');var Redis=require(_0x3a9e('0x3'));var db=require(_0x3a9e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a9e('0x5'))(_0x3a9e('0x6'));var config=require(_0x3a9e('0x7'));var jayson=require(_0x3a9e('0x8'));var client=jayson['client'][_0x3a9e('0x9')]({'port':0x232a});config['redis']=_[_0x3a9e('0xa')](config[_0x3a9e('0xb')],{'host':_0x3a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a9e('0xb')]));require('./chatMessage.socket')[_0x3a9e('0xd')](socket);function respondWithRpcPromise(_0x5284c8,_0x3f3e07,_0xd1ca51){return new BPromise(function(_0x11f27b,_0x483d2f){return client['request'](_0x5284c8,_0xd1ca51)[_0x3a9e('0xe')](function(_0x3bcc5a){logger[_0x3a9e('0xf')](_0x3a9e('0x10'),_0x3f3e07,'request\x20sent');logger[_0x3a9e('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3f3e07,_0x3a9e('0x12'),JSON[_0x3a9e('0x13')](_0x3bcc5a));if(_0x3bcc5a[_0x3a9e('0x14')]){if(_0x3bcc5a[_0x3a9e('0x14')][_0x3a9e('0x15')]===0x1f4){logger[_0x3a9e('0x14')]('ChatMessage,\x20%s,\x20%s',_0x3f3e07,_0x3bcc5a[_0x3a9e('0x14')][_0x3a9e('0x16')]);return _0x483d2f(_0x3bcc5a['error'][_0x3a9e('0x16')]);}logger[_0x3a9e('0x14')](_0x3a9e('0x10'),_0x3f3e07,_0x3bcc5a[_0x3a9e('0x14')][_0x3a9e('0x16')]);return _0x11f27b(_0x3bcc5a['error'][_0x3a9e('0x16')]);}else{logger[_0x3a9e('0xf')](_0x3a9e('0x10'),_0x3f3e07,_0x3a9e('0x12'));_0x11f27b(_0x3bcc5a['result']['message']);}})[_0x3a9e('0x17')](function(_0x459638){logger[_0x3a9e('0x14')]('ChatMessage,\x20%s,\x20%s',_0x3f3e07,_0x459638);_0x483d2f(_0x459638);});});}exports[_0x3a9e('0x18')]=function(_0x53354f){var _0x322134=this;return new Promise(function(_0x6e664c,_0xe995ec){return db['ChatMessage'][_0x3a9e('0x19')](_0x53354f[_0x3a9e('0x1a')],{'raw':_0x53354f[_0x3a9e('0x1b')]?_0x53354f['options'][_0x3a9e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4b297a){logger['info'](_0x3a9e('0x18'),_0x53354f);logger[_0x3a9e('0x11')](_0x3a9e('0x18'),_0x53354f,JSON[_0x3a9e('0x13')](_0x4b297a));_0x6e664c(_0x4b297a);})['catch'](function(_0x1466bc){logger[_0x3a9e('0x14')](_0x3a9e('0x18'),_0x1466bc[_0x3a9e('0x16')],_0x53354f);_0xe995ec(_0x322134['error'](0x1f4,_0x1466bc[_0x3a9e('0x16')]));});});}; \ No newline at end of file +var _0x653e=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','ChatMessage,\x20%s,\x20%s','result','CreateChatMessage','ChatMessage','create','body','options','raw','then','stringify'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0x653e,0xba));var _0xe653=function(_0x58b44a,_0x1a7aa6){_0x58b44a=_0x58b44a-0x0;var _0xd6779d=_0x653e[_0x58b44a];return _0xd6779d;};'use strict';var _=require(_0xe653('0x0'));var util=require(_0xe653('0x1'));var moment=require(_0xe653('0x2'));var BPromise=require(_0xe653('0x3'));var rs=require(_0xe653('0x4'));var fs=require('fs');var Redis=require(_0xe653('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe653('0x6'));var logger=require(_0xe653('0x7'))(_0xe653('0x8'));var config=require(_0xe653('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe653('0xa')][_0xe653('0xb')]({'port':0x232a});config[_0xe653('0xc')]=_[_0xe653('0xd')](config[_0xe653('0xc')],{'host':_0xe653('0xe'),'port':0x18eb});var socket=require(_0xe653('0xf'))(new Redis(config[_0xe653('0xc')]));require(_0xe653('0x10'))[_0xe653('0x11')](socket);function respondWithRpcPromise(_0x41e234,_0x5332f0,_0x4898b9){return new BPromise(function(_0x28a5d9,_0x226e83){return client[_0xe653('0x12')](_0x41e234,_0x4898b9)['then'](function(_0x122240){logger[_0xe653('0x13')]('ChatMessage,\x20%s,\x20%s',_0x5332f0,_0xe653('0x14'));logger[_0xe653('0x15')](_0xe653('0x16'),_0x5332f0,_0xe653('0x14'),JSON['stringify'](_0x122240));if(_0x122240[_0xe653('0x17')]){if(_0x122240[_0xe653('0x17')][_0xe653('0x18')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5332f0,_0x122240[_0xe653('0x17')]['message']);return _0x226e83(_0x122240[_0xe653('0x17')][_0xe653('0x19')]);}logger['error'](_0xe653('0x1a'),_0x5332f0,_0x122240[_0xe653('0x17')][_0xe653('0x19')]);return _0x28a5d9(_0x122240['error'][_0xe653('0x19')]);}else{logger['info'](_0xe653('0x1a'),_0x5332f0,'request\x20sent');_0x28a5d9(_0x122240[_0xe653('0x1b')][_0xe653('0x19')]);}})['catch'](function(_0x1c8c90){logger[_0xe653('0x17')]('ChatMessage,\x20%s,\x20%s',_0x5332f0,_0x1c8c90);_0x226e83(_0x1c8c90);});});}exports[_0xe653('0x1c')]=function(_0x7f2064){var _0x1c1a5d=this;return new Promise(function(_0x13420e,_0xee9de4){return db[_0xe653('0x1d')][_0xe653('0x1e')](_0x7f2064[_0xe653('0x1f')],{'raw':_0x7f2064['options']?_0x7f2064[_0xe653('0x20')][_0xe653('0x21')]===undefined?!![]:![]:!![]})[_0xe653('0x22')](function(_0x1bf9f7){logger[_0xe653('0x13')]('CreateChatMessage',_0x7f2064);logger[_0xe653('0x15')]('CreateChatMessage',_0x7f2064,JSON[_0xe653('0x23')](_0x1bf9f7));_0x13420e(_0x1bf9f7);})[_0xe653('0x24')](function(_0x2a3fae){logger[_0xe653('0x17')](_0xe653('0x1c'),_0x2a3fae[_0xe653('0x19')],_0x7f2064);_0xee9de4(_0x1c1a5d['error'](0x1f4,_0x2a3fae[_0xe653('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6132bc9..da33e7e 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 _0x207c=['length','chatMessage:','save','remove','update','emit'];(function(_0x346912,_0x42b72a){var _0x1cfac5=function(_0x23f5fd){while(--_0x23f5fd){_0x346912['push'](_0x346912['shift']());}};_0x1cfac5(++_0x42b72a);}(_0x207c,0x1e8));var _0xc207=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0x207c[_0x5da0d9];return _0x4b6d2f;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xc207('0x0'),_0xc207('0x1'),_0xc207('0x2')];function createListener(_0xaaba3d,_0x2b40be){return function(_0x12f1f2){_0x2b40be[_0xc207('0x3')](_0xaaba3d,_0x12f1f2);};}function removeListener(_0x4b9daa,_0x38ff02){return function(){ChatMessageEvents['removeListener'](_0x4b9daa,_0x38ff02);};}exports['register']=function(_0x55023e){for(var _0xc88789=0x0,_0x314561=events[_0xc207('0x4')];_0xc88789<_0x314561;_0xc88789++){var _0x59ff6f=events[_0xc88789];var _0x25cb97=createListener(_0xc207('0x5')+_0x59ff6f,_0x55023e);ChatMessageEvents['on'](_0x59ff6f,_0x25cb97);}}; \ No newline at end of file +var _0xb138=['update','removeListener','length','./chatMessage.events','save','remove'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0xb138,0x1dd));var _0x8b13=function(_0xaab22e,_0x3bab3c){_0xaab22e=_0xaab22e-0x0;var _0x1cd2fa=_0xb138[_0xaab22e];return _0x1cd2fa;};'use strict';var ChatMessageEvents=require(_0x8b13('0x0'));var events=[_0x8b13('0x1'),_0x8b13('0x2'),_0x8b13('0x3')];function createListener(_0xadad70,_0x185752){return function(_0x20c65c){_0x185752['emit'](_0xadad70,_0x20c65c);};}function removeListener(_0x4411a0,_0x241acb){return function(){ChatMessageEvents[_0x8b13('0x4')](_0x4411a0,_0x241acb);};}exports['register']=function(_0xd19a0f){for(var _0x13f7bd=0x0,_0x5d51b1=events[_0x8b13('0x5')];_0x13f7bd<_0x5d51b1;_0x13f7bd++){var _0x33d1a7=events[_0x13f7bd];var _0x22e157=createListener('chatMessage:'+_0x33d1a7,_0xd19a0f);ChatMessageEvents['on'](_0x33d1a7,_0x22e157);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index a4add30..997304d 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 _0x25fd=['create','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','tracked','chat'];(function(_0x441f45,_0x16130c){var _0x2bc267=function(_0x44f8a4){while(--_0x44f8a4){_0x441f45['push'](_0x441f45['shift']());}};_0x2bc267(++_0x16130c);}(_0x25fd,0xbe));var _0xd25f=function(_0x3b5fa9,_0x26cc61){_0x3b5fa9=_0x3b5fa9-0x0;var _0x36be9b=_0x25fd[_0x3b5fa9];return _0x36be9b;};'use strict';var multer=require(_0xd25f('0x0'));var util=require(_0xd25f('0x1'));var path=require(_0xd25f('0x2'));var timeout=require(_0xd25f('0x3'));var express=require(_0xd25f('0x4'));var router=express[_0xd25f('0x5')]();var fs_extra=require(_0xd25f('0x6'));var auth=require(_0xd25f('0x7'));var interaction=require(_0xd25f('0x8'));var config=require(_0xd25f('0x9'));var controller=require('./chatMessage.controller');router[_0xd25f('0xa')]('/',auth[_0xd25f('0xb')](),controller[_0xd25f('0xc')]);router[_0xd25f('0xa')](_0xd25f('0xd'),auth[_0xd25f('0xb')](),controller['describe']);router['get'](_0xd25f('0xe'),auth[_0xd25f('0xb')](),controller[_0xd25f('0xf')]);router['post']('/',auth[_0xd25f('0xb')](),interaction[_0xd25f('0x10')](_0xd25f('0x11'),'chatmessage:create'),controller[_0xd25f('0x12')]);router['put'](_0xd25f('0xe'),controller['update']);router[_0xd25f('0x13')](_0xd25f('0x14'),auth[_0xd25f('0xb')](),controller['accept']);router['put'](_0xd25f('0x15'),auth[_0xd25f('0xb')](),controller[_0xd25f('0x16')]);router[_0xd25f('0x17')](_0xd25f('0xe'),auth[_0xd25f('0xb')](),controller[_0xd25f('0x18')]);module[_0xd25f('0x19')]=router; \ No newline at end of file +var _0x1a0c=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','chat','chatmessage:create','create','put','accept','/:id/reject','reject','delete'];(function(_0x2cc69d,_0x38348d){var _0x85e776=function(_0x40945d){while(--_0x40945d){_0x2cc69d['push'](_0x2cc69d['shift']());}};_0x85e776(++_0x38348d);}(_0x1a0c,0x1a9));var _0xc1a0=function(_0x181a7b,_0x45b715){_0x181a7b=_0x181a7b-0x0;var _0x2344d4=_0x1a0c[_0x181a7b];return _0x2344d4;};'use strict';var multer=require(_0xc1a0('0x0'));var util=require(_0xc1a0('0x1'));var path=require('path');var timeout=require(_0xc1a0('0x2'));var express=require(_0xc1a0('0x3'));var router=express[_0xc1a0('0x4')]();var fs_extra=require(_0xc1a0('0x5'));var auth=require(_0xc1a0('0x6'));var interaction=require(_0xc1a0('0x7'));var config=require('../../config/environment');var controller=require(_0xc1a0('0x8'));router[_0xc1a0('0x9')]('/',auth[_0xc1a0('0xa')](),controller[_0xc1a0('0xb')]);router[_0xc1a0('0x9')](_0xc1a0('0xc'),auth[_0xc1a0('0xa')](),controller[_0xc1a0('0xd')]);router[_0xc1a0('0x9')](_0xc1a0('0xe'),auth[_0xc1a0('0xa')](),controller[_0xc1a0('0xf')]);router[_0xc1a0('0x10')]('/',auth[_0xc1a0('0xa')](),interaction['tracked'](_0xc1a0('0x11'),_0xc1a0('0x12')),controller[_0xc1a0('0x13')]);router[_0xc1a0('0x14')](_0xc1a0('0xe'),controller['update']);router[_0xc1a0('0x14')]('/:id/accept',auth[_0xc1a0('0xa')](),controller[_0xc1a0('0x15')]);router['put'](_0xc1a0('0x16'),auth[_0xc1a0('0xa')](),controller[_0xc1a0('0x17')]);router[_0xc1a0('0x18')](_0xc1a0('0xe'),auth[_0xc1a0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 37cb1d2..565c587 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 _0xa054=['TEXT'];(function(_0x3a3a4e,_0x29936a){var _0x566b76=function(_0x2af9b3){while(--_0x2af9b3){_0x3a3a4e['push'](_0x3a3a4e['shift']());}};_0x566b76(++_0x29936a);}(_0xa054,0x1df));var _0x4a05=function(_0x7b484,_0x195ad4){_0x7b484=_0x7b484-0x0;var _0x2ae1cf=_0xa054[_0x7b484];return _0x2ae1cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x4a05('0x0')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x3831=['exports','TEXT','medium'];(function(_0x442535,_0x127c80){var _0x1dbf31=function(_0x24d497){while(--_0x24d497){_0x442535['push'](_0x442535['shift']());}};_0x1dbf31(++_0x127c80);}(_0x3831,0x1bc));var _0x1383=function(_0x546f24,_0x485e39){_0x546f24=_0x546f24-0x0;var _0x6c3dac=_0x3831[_0x546f24];return _0x6c3dac;};'use strict';var Sequelize=require('sequelize');module[_0x1383('0x0')]={'body':{'type':Sequelize[_0x1383('0x1')](_0x1383('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index e49f2ea..4fc811f 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x7a54,0x106));var _0x47a5=function(_0x35606b,_0x233b32){_0x35606b=_0x35606b-0x0;var _0xef544=_0x7a54[_0x35606b];return _0xef544;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x7a54,0x106));var _0x47a5=function(_0x91d512,_0x1c9e7b){_0x91d512=_0x91d512-0x0;var _0x4c9045=_0x7a54[_0x91d512];return _0x4c9045;};'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.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 356c339..d119991 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 _0xf1b9=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','define'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf1b9,0x130));var _0x9f1b=function(_0x422d6d,_0x1809f6){_0x422d6d=_0x422d6d-0x0;var _0x2bdd94=_0xf1b9[_0x422d6d];return _0x2bdd94;};'use strict';var _=require(_0x9f1b('0x0'));var util=require(_0x9f1b('0x1'));var logger=require(_0x9f1b('0x2'))(_0x9f1b('0x3'));var moment=require(_0x9f1b('0x4'));var BPromise=require('bluebird');var rp=require(_0x9f1b('0x5'));var fs=require('fs');var path=require(_0x9f1b('0x6'));var rimraf=require(_0x9f1b('0x7'));var config=require(_0x9f1b('0x8'));var attributes=require(_0x9f1b('0x9'));module['exports']=function(_0x4c4810,_0x47640e){return _0x4c4810[_0x9f1b('0xa')](_0x9f1b('0xb'),attributes,{'tableName':_0x9f1b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9f1b('0xd'),'collate':_0x9f1b('0xe')});}; \ No newline at end of file +var _0x9e65=['api','moment','bluebird','request-promise','../../config/environment','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x104b47,_0x491eff){var _0x34a3f1=function(_0x467a15){while(--_0x467a15){_0x104b47['push'](_0x104b47['shift']());}};_0x34a3f1(++_0x491eff);}(_0x9e65,0xe7));var _0x59e6=function(_0x4d578c,_0x4d2ed2){_0x4d578c=_0x4d578c-0x0;var _0xf41cac=_0x9e65[_0x4d578c];return _0xf41cac;};'use strict';var _=require(_0x59e6('0x0'));var util=require(_0x59e6('0x1'));var logger=require(_0x59e6('0x2'))(_0x59e6('0x3'));var moment=require(_0x59e6('0x4'));var BPromise=require(_0x59e6('0x5'));var rp=require(_0x59e6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x59e6('0x7'));var attributes=require('./chatOfflineMessage.attributes');module[_0x59e6('0x8')]=function(_0x2016dd,_0x2d1c17){return _0x2016dd['define'](_0x59e6('0x9'),attributes,{'tableName':_0x59e6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x59e6('0xb'),'collate':_0x59e6('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2912454..5f3c737 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 _0x703e=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x471be4,_0x14b480){var _0x3fd1b8=function(_0x4fb57d){while(--_0x4fb57d){_0x471be4['push'](_0x471be4['shift']());}};_0x3fd1b8(++_0x14b480);}(_0x703e,0x1a5));var _0xe703=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x703e[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xe703('0x0'));var util=require(_0xe703('0x1'));var moment=require(_0xe703('0x2'));var BPromise=require(_0xe703('0x3'));var rs=require(_0xe703('0x4'));var fs=require('fs');var Redis=require(_0xe703('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe703('0x6'))(_0xe703('0x7'));var config=require(_0xe703('0x8'));var jayson=require(_0xe703('0x9'));var client=jayson['client'][_0xe703('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x332670,_0xcf84dd,_0x29d038){return new BPromise(function(_0x1e4bbd,_0x4b8271){return client[_0xe703('0xb')](_0x332670,_0x29d038)['then'](function(_0x359aff){logger[_0xe703('0xc')](_0xe703('0xd'),_0xcf84dd,_0xe703('0xe'));logger['debug'](_0xe703('0xf'),_0xcf84dd,_0xe703('0xe'),JSON[_0xe703('0x10')](_0x359aff));if(_0x359aff[_0xe703('0x11')]){if(_0x359aff['error'][_0xe703('0x12')]===0x1f4){logger[_0xe703('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0xcf84dd,_0x359aff['error']['message']);return _0x4b8271(_0x359aff['error'][_0xe703('0x13')]);}logger[_0xe703('0x11')](_0xe703('0xd'),_0xcf84dd,_0x359aff[_0xe703('0x11')][_0xe703('0x13')]);return _0x1e4bbd(_0x359aff[_0xe703('0x11')][_0xe703('0x13')]);}else{logger[_0xe703('0xc')](_0xe703('0xd'),_0xcf84dd,_0xe703('0xe'));_0x1e4bbd(_0x359aff[_0xe703('0x14')][_0xe703('0x13')]);}})[_0xe703('0x15')](function(_0xdd5c62){logger[_0xe703('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0xcf84dd,_0xdd5c62);_0x4b8271(_0xdd5c62);});});} \ No newline at end of file +var _0xcdcb=['http','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2b04f2,_0x32ec68){var _0x4f42b6=function(_0x14843e){while(--_0x14843e){_0x2b04f2['push'](_0x2b04f2['shift']());}};_0x4f42b6(++_0x32ec68);}(_0xcdcb,0xfd));var _0xbcdc=function(_0x1e77f3,_0x4b53b1){_0x1e77f3=_0x1e77f3-0x0;var _0x595418=_0xcdcb[_0x1e77f3];return _0x595418;};'use strict';var _=require(_0xbcdc('0x0'));var util=require(_0xbcdc('0x1'));var moment=require(_0xbcdc('0x2'));var BPromise=require(_0xbcdc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcdc('0x4'));var db=require(_0xbcdc('0x5'))['db'];var utils=require(_0xbcdc('0x6'));var logger=require('../../config/logger')(_0xbcdc('0x7'));var config=require(_0xbcdc('0x8'));var jayson=require(_0xbcdc('0x9'));var client=jayson[_0xbcdc('0xa')][_0xbcdc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38145d,_0x20f331,_0x53d47c){return new BPromise(function(_0x1d7b58,_0x6a5d81){return client['request'](_0x38145d,_0x53d47c)['then'](function(_0xdcc010){logger[_0xbcdc('0xc')](_0xbcdc('0xd'),_0x20f331,_0xbcdc('0xe'));logger[_0xbcdc('0xf')](_0xbcdc('0x10'),_0x20f331,'request\x20sent',JSON[_0xbcdc('0x11')](_0xdcc010));if(_0xdcc010[_0xbcdc('0x12')]){if(_0xdcc010[_0xbcdc('0x12')][_0xbcdc('0x13')]===0x1f4){logger['error'](_0xbcdc('0xd'),_0x20f331,_0xdcc010[_0xbcdc('0x12')]['message']);return _0x6a5d81(_0xdcc010[_0xbcdc('0x12')]['message']);}logger[_0xbcdc('0x12')](_0xbcdc('0xd'),_0x20f331,_0xdcc010[_0xbcdc('0x12')][_0xbcdc('0x14')]);return _0x1d7b58(_0xdcc010[_0xbcdc('0x12')][_0xbcdc('0x14')]);}else{logger[_0xbcdc('0xc')](_0xbcdc('0xd'),_0x20f331,'request\x20sent');_0x1d7b58(_0xdcc010[_0xbcdc('0x15')][_0xbcdc('0x14')]);}})['catch'](function(_0x6d0a33){logger[_0xbcdc('0x12')](_0xbcdc('0xd'),_0x20f331,_0x6d0a33);_0x6a5d81(_0x6d0a33);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 022ef9c..ea8cb77 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 _0xedbe=['express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0xedbe,0xcd));var _0xeedb=function(_0x462d69,_0x32ae47){_0x462d69=_0x462d69-0x0;var _0x27f637=_0xedbe[_0x462d69];return _0x27f637;};'use strict';var multer=require(_0xeedb('0x0'));var util=require(_0xeedb('0x1'));var path=require(_0xeedb('0x2'));var timeout=require(_0xeedb('0x3'));var express=require(_0xeedb('0x4'));var router=express[_0xeedb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xeedb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0xeedb('0x7')]('/',auth[_0xeedb('0x8')](),controller[_0xeedb('0x9')]);router[_0xeedb('0x7')](_0xeedb('0xa'),auth[_0xeedb('0x8')](),controller[_0xeedb('0xb')]);router[_0xeedb('0x7')](_0xeedb('0xc'),auth[_0xeedb('0x8')](),controller['show']);router[_0xeedb('0xd')]('/',auth['isAuthenticated'](),controller[_0xeedb('0xe')]);router[_0xeedb('0xf')](_0xeedb('0xc'),auth['isAuthenticated'](),controller[_0xeedb('0x10')]);router['delete'](_0xeedb('0xc'),auth[_0xeedb('0x8')](),controller[_0xeedb('0x11')]);module[_0xeedb('0x12')]=router; \ No newline at end of file +var _0xca44=['/:id','post','create','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','/describe','describe'];(function(_0x483caa,_0x1e2031){var _0x57144d=function(_0x53906f){while(--_0x53906f){_0x483caa['push'](_0x483caa['shift']());}};_0x57144d(++_0x1e2031);}(_0xca44,0xd7));var _0x4ca4=function(_0x2fcdb4,_0x4f881){_0x2fcdb4=_0x2fcdb4-0x0;var _0x10278a=_0xca44[_0x2fcdb4];return _0x10278a;};'use strict';var multer=require(_0x4ca4('0x0'));var util=require(_0x4ca4('0x1'));var path=require('path');var timeout=require(_0x4ca4('0x2'));var express=require(_0x4ca4('0x3'));var router=express['Router']();var fs_extra=require(_0x4ca4('0x4'));var auth=require(_0x4ca4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0x4ca4('0x6')]('/',auth[_0x4ca4('0x7')](),controller['index']);router[_0x4ca4('0x6')](_0x4ca4('0x8'),auth['isAuthenticated'](),controller[_0x4ca4('0x9')]);router['get'](_0x4ca4('0xa'),auth[_0x4ca4('0x7')](),controller['show']);router[_0x4ca4('0xb')]('/',auth[_0x4ca4('0x7')](),controller[_0x4ca4('0xc')]);router['put'](_0x4ca4('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x4ca4('0x7')](),controller[_0x4ca4('0xd')]);module[_0x4ca4('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 6325b1c..505d7b8 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 _0x01aa=['mouseOver','timeout','INTEGER','sequelize','ENUM'];(function(_0x1e49c2,_0x43d53f){var _0x2ea2c9=function(_0x2fdd91){while(--_0x2fdd91){_0x1e49c2['push'](_0x1e49c2['shift']());}};_0x2ea2c9(++_0x43d53f);}(_0x01aa,0x189));var _0xa01a=function(_0x2ab23d,_0x2dbf31){_0x2ab23d=_0x2ab23d-0x0;var _0x3e406c=_0x01aa[_0x2ab23d];return _0x3e406c;};'use strict';var Sequelize=require(_0xa01a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa01a('0x1')](_0xa01a('0x2'),_0xa01a('0x3')),'defaultValue':_0xa01a('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa01a('0x4')]}}; \ No newline at end of file +var _0x3d3c=['ENUM','mouseOver','timeout','sequelize','STRING'];(function(_0x8d221e,_0x4e45fb){var _0x461288=function(_0x440b9f){while(--_0x440b9f){_0x8d221e['push'](_0x8d221e['shift']());}};_0x461288(++_0x4e45fb);}(_0x3d3c,0x161));var _0xc3d3=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3d3c[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0xc3d3('0x0'));module['exports']={'name':{'type':Sequelize[_0xc3d3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc3d3('0x2')](_0xc3d3('0x3'),_0xc3d3('0x4')),'defaultValue':_0xc3d3('0x3')},'selector':{'type':Sequelize[_0xc3d3('0x1')]},'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 c80eebb..dbbe08b 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 _0x1b20=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','create','body','catch','params','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0xf7974d,_0xbab05e){var _0xb831ea=function(_0x5857cb){while(--_0x5857cb){_0xf7974d['push'](_0xf7974d['shift']());}};_0xb831ea(++_0xbab05e);}(_0x1b20,0x66));var _0x01b2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b20[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01b2('0x0'));var zipdir=require(_0x01b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x01b2('0x2'));var BPromise=require(_0x01b2('0x3'));var Mustache=require(_0x01b2('0x4'));var util=require(_0x01b2('0x5'));var path=require(_0x01b2('0x6'));var sox=require(_0x01b2('0x7'));var csv=require(_0x01b2('0x8'));var ejs=require(_0x01b2('0x9'));var fs=require('fs');var fs_extra=require(_0x01b2('0xa'));var _=require(_0x01b2('0xb'));var squel=require(_0x01b2('0xc'));var crypto=require(_0x01b2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x01b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x01b2('0xf'));var Papa=require(_0x01b2('0x10'));var Redis=require(_0x01b2('0x11'));var authService=require(_0x01b2('0x12'));var qs=require(_0x01b2('0x13'));var as=require(_0x01b2('0x14'));var hardwareService=require(_0x01b2('0x15'));var logger=require(_0x01b2('0x16'))('api');var utils=require(_0x01b2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x01b2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41a618,_0x8ac569){_0x8ac569=_0x8ac569||0xcc;return function(_0x2c6d4d){if(_0x2c6d4d){return _0x41a618[_0x01b2('0x19')](_0x8ac569);}return _0x41a618['status'](_0x8ac569)[_0x01b2('0x1a')]();};}function respondWithResult(_0x2e7b31,_0x4f1c15){_0x4f1c15=_0x4f1c15||0xc8;return function(_0x1626ba){if(_0x1626ba){return _0x2e7b31[_0x01b2('0x1b')](_0x4f1c15)['json'](_0x1626ba);}};}function respondWithFilteredResult(_0x299d0c,_0x3d5833){return function(_0x1a9734){if(_0x1a9734){var _0x3f68a8=typeof _0x3d5833['offset']==='undefined'&&typeof _0x3d5833[_0x01b2('0x1c')]===_0x01b2('0x1d');var _0x588dbe=_0x1a9734[_0x01b2('0x1e')];var _0x444236=_0x3f68a8?0x0:_0x3d5833[_0x01b2('0x1f')];var _0x5986f5=_0x3f68a8?_0x1a9734[_0x01b2('0x1e')]:_0x3d5833[_0x01b2('0x1f')]+_0x3d5833[_0x01b2('0x1c')];var _0xd2acbb;if(_0x5986f5>=_0x588dbe){_0x5986f5=_0x588dbe;_0xd2acbb=0xc8;}else{_0xd2acbb=0xce;}_0x299d0c[_0x01b2('0x1b')](_0xd2acbb);return _0x299d0c['set'](_0x01b2('0x20'),_0x444236+'-'+_0x5986f5+'/'+_0x588dbe)['json'](_0x1a9734);}return null;};}function patchUpdates(_0x7464e5){return function(_0x4c0008){try{jsonpatch[_0x01b2('0x21')](_0x4c0008,_0x7464e5,!![]);}catch(_0x266264){return BPromise[_0x01b2('0x22')](_0x266264);}return _0x4c0008['save']();};}function saveUpdates(_0x269b54,_0x2f01b0){return function(_0xc3027){if(_0xc3027){return _0xc3027[_0x01b2('0x23')](_0x269b54)[_0x01b2('0x24')](function(_0x479e94){return _0x479e94;});}return null;};}function removeEntity(_0x1874b9,_0x539db1){return function(_0x54e866){if(_0x54e866){return _0x54e866[_0x01b2('0x25')]()[_0x01b2('0x24')](function(){_0x1874b9[_0x01b2('0x1b')](0xcc)[_0x01b2('0x1a')]();});}};}function handleEntityNotFound(_0x2e32c1,_0x307229){return function(_0x4920f7){if(!_0x4920f7){_0x2e32c1[_0x01b2('0x19')](0x194);}return _0x4920f7;};}function handleError(_0x239543,_0x424cfd){_0x424cfd=_0x424cfd||0x1f4;return function(_0x17274f){logger['error'](_0x17274f[_0x01b2('0x26')]);if(_0x17274f['name']){delete _0x17274f[_0x01b2('0x27')];}_0x239543[_0x01b2('0x1b')](_0x424cfd)['send'](_0x17274f);};}exports[_0x01b2('0x28')]=function(_0x5efdda,_0x487c49){var _0x291d56={'raw':!![],'where':{'id':_0x5efdda['params']['id']}},_0x4363ec={};_0x4363ec[_0x01b2('0x29')]=_[_0x01b2('0x2a')](db[_0x01b2('0x2b')][_0x01b2('0x2c')]);_0x4363ec[_0x01b2('0x2d')]=_[_0x01b2('0x2a')](_0x5efdda[_0x01b2('0x2d')]);_0x4363ec[_0x01b2('0x2e')]=_[_0x01b2('0x2f')](_0x4363ec[_0x01b2('0x29')],_0x4363ec[_0x01b2('0x2d')]);_0x291d56['attributes']=_[_0x01b2('0x2f')](_0x4363ec[_0x01b2('0x29')],qs[_0x01b2('0x30')](_0x5efdda[_0x01b2('0x2d')][_0x01b2('0x30')]));_0x291d56[_0x01b2('0x31')]=_0x291d56['attributes']['length']?_0x291d56[_0x01b2('0x31')]:_0x4363ec['model'];if(_0x5efdda['query'][_0x01b2('0x32')]){_0x291d56[_0x01b2('0x33')]=[{'all':!![]}];}_0x291d56=_[_0x01b2('0x34')]({},_0x291d56,_0x5efdda[_0x01b2('0x35')]);return db['ChatProactiveAction'][_0x01b2('0x36')](_0x291d56)['then'](handleEntityNotFound(_0x487c49,null))[_0x01b2('0x24')](respondWithResult(_0x487c49,null))['catch'](handleError(_0x487c49,null));};exports['create']=function(_0x5e23dd,_0x2dc1c5){return db[_0x01b2('0x2b')][_0x01b2('0x37')](_0x5e23dd[_0x01b2('0x38')],{})['then'](respondWithResult(_0x2dc1c5,0xc9))[_0x01b2('0x39')](handleError(_0x2dc1c5,null));};exports[_0x01b2('0x23')]=function(_0x5865a3,_0xecbce4){if(_0x5865a3[_0x01b2('0x38')]['id']){delete _0x5865a3[_0x01b2('0x38')]['id'];}return db[_0x01b2('0x2b')][_0x01b2('0x36')]({'where':{'id':_0x5865a3[_0x01b2('0x3a')]['id']}})['then'](handleEntityNotFound(_0xecbce4,null))[_0x01b2('0x24')](saveUpdates(_0x5865a3[_0x01b2('0x38')],null))['then'](respondWithResult(_0xecbce4,null))['catch'](handleError(_0xecbce4,null));};exports[_0x01b2('0x25')]=function(_0x3d7e77,_0x4555c8){return db[_0x01b2('0x2b')][_0x01b2('0x36')]({'where':{'id':_0x3d7e77[_0x01b2('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4555c8,null))['then'](removeEntity(_0x4555c8,null))[_0x01b2('0x39')](handleError(_0x4555c8,null));}; \ No newline at end of file +var _0x06f4=['sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','stack','name','send','show','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','merge','options','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x06f4,0x136));var _0x406f=function(_0x300b5e,_0x57afe3){_0x300b5e=_0x300b5e-0x0;var _0x136524=_0x06f4[_0x300b5e];return _0x136524;};'use strict';var emlformat=require(_0x406f('0x0'));var rimraf=require(_0x406f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x406f('0x2'));var rp=require(_0x406f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x406f('0x4'));var util=require('util');var path=require(_0x406f('0x5'));var sox=require(_0x406f('0x6'));var csv=require(_0x406f('0x7'));var ejs=require(_0x406f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x406f('0x9'));var squel=require('squel');var crypto=require(_0x406f('0xa'));var jsforce=require(_0x406f('0xb'));var deskjs=require(_0x406f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x406f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x406f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x406f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x406f('0x10'))('api');var utils=require(_0x406f('0x11'));var config=require(_0x406f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x406f('0x13'))['db'];function respondWithStatusCode(_0x380382,_0x451592){_0x451592=_0x451592||0xcc;return function(_0x163de4){if(_0x163de4){return _0x380382[_0x406f('0x14')](_0x451592);}return _0x380382[_0x406f('0x15')](_0x451592)[_0x406f('0x16')]();};}function respondWithResult(_0xcc1d6,_0x4522b2){_0x4522b2=_0x4522b2||0xc8;return function(_0x5045e8){if(_0x5045e8){return _0xcc1d6[_0x406f('0x15')](_0x4522b2)['json'](_0x5045e8);}};}function respondWithFilteredResult(_0x1bf795,_0x28fda6){return function(_0x4498d9){if(_0x4498d9){var _0x5c80af=typeof _0x28fda6[_0x406f('0x17')]===_0x406f('0x18')&&typeof _0x28fda6['limit']==='undefined';var _0x11c759=_0x4498d9[_0x406f('0x19')];var _0x509bae=_0x5c80af?0x0:_0x28fda6[_0x406f('0x17')];var _0x57d93a=_0x5c80af?_0x4498d9[_0x406f('0x19')]:_0x28fda6[_0x406f('0x17')]+_0x28fda6[_0x406f('0x1a')];var _0x12bb0f;if(_0x57d93a>=_0x11c759){_0x57d93a=_0x11c759;_0x12bb0f=0xc8;}else{_0x12bb0f=0xce;}_0x1bf795['status'](_0x12bb0f);return _0x1bf795['set'](_0x406f('0x1b'),_0x509bae+'-'+_0x57d93a+'/'+_0x11c759)['json'](_0x4498d9);}return null;};}function patchUpdates(_0x33dd5f){return function(_0x5089b2){try{jsonpatch[_0x406f('0x1c')](_0x5089b2,_0x33dd5f,!![]);}catch(_0x3a1a36){return BPromise[_0x406f('0x1d')](_0x3a1a36);}return _0x5089b2['save']();};}function saveUpdates(_0x58c0d3,_0x518a88){return function(_0x11683){if(_0x11683){return _0x11683[_0x406f('0x1e')](_0x58c0d3)[_0x406f('0x1f')](function(_0x5ebb26){return _0x5ebb26;});}return null;};}function removeEntity(_0x102cfd,_0x5961cc){return function(_0x3dd3d1){if(_0x3dd3d1){return _0x3dd3d1[_0x406f('0x20')]()[_0x406f('0x1f')](function(){_0x102cfd[_0x406f('0x15')](0xcc)[_0x406f('0x16')]();});}};}function handleEntityNotFound(_0x51ac15,_0x55a4ee){return function(_0x81589c){if(!_0x81589c){_0x51ac15['sendStatus'](0x194);}return _0x81589c;};}function handleError(_0x467a3a,_0xa240d8){_0xa240d8=_0xa240d8||0x1f4;return function(_0x4ff1de){logger['error'](_0x4ff1de[_0x406f('0x21')]);if(_0x4ff1de['name']){delete _0x4ff1de[_0x406f('0x22')];}_0x467a3a[_0x406f('0x15')](_0xa240d8)[_0x406f('0x23')](_0x4ff1de);};}exports[_0x406f('0x24')]=function(_0x2c439b,_0x174e47){var _0x224bd0={'raw':!![],'where':{'id':_0x2c439b['params']['id']}},_0x2b41dd={};_0x2b41dd['model']=_[_0x406f('0x25')](db[_0x406f('0x26')][_0x406f('0x27')]);_0x2b41dd[_0x406f('0x28')]=_['keys'](_0x2c439b['query']);_0x2b41dd[_0x406f('0x29')]=_[_0x406f('0x2a')](_0x2b41dd['model'],_0x2b41dd['query']);_0x224bd0[_0x406f('0x2b')]=_[_0x406f('0x2a')](_0x2b41dd[_0x406f('0x2c')],qs[_0x406f('0x2d')](_0x2c439b[_0x406f('0x28')][_0x406f('0x2d')]));_0x224bd0[_0x406f('0x2b')]=_0x224bd0[_0x406f('0x2b')][_0x406f('0x2e')]?_0x224bd0[_0x406f('0x2b')]:_0x2b41dd[_0x406f('0x2c')];if(_0x2c439b[_0x406f('0x28')][_0x406f('0x2f')]){_0x224bd0['include']=[{'all':!![]}];}_0x224bd0=_[_0x406f('0x30')]({},_0x224bd0,_0x2c439b[_0x406f('0x31')]);return db[_0x406f('0x26')][_0x406f('0x32')](_0x224bd0)[_0x406f('0x1f')](handleEntityNotFound(_0x174e47,null))[_0x406f('0x1f')](respondWithResult(_0x174e47,null))[_0x406f('0x33')](handleError(_0x174e47,null));};exports[_0x406f('0x34')]=function(_0x3dc67b,_0x3fdc25){return db['ChatProactiveAction'][_0x406f('0x34')](_0x3dc67b[_0x406f('0x35')],{})[_0x406f('0x1f')](respondWithResult(_0x3fdc25,0xc9))[_0x406f('0x33')](handleError(_0x3fdc25,null));};exports[_0x406f('0x1e')]=function(_0x2a3cc1,_0x58108b){if(_0x2a3cc1['body']['id']){delete _0x2a3cc1[_0x406f('0x35')]['id'];}return db[_0x406f('0x26')]['find']({'where':{'id':_0x2a3cc1[_0x406f('0x36')]['id']}})['then'](handleEntityNotFound(_0x58108b,null))[_0x406f('0x1f')](saveUpdates(_0x2a3cc1[_0x406f('0x35')],null))[_0x406f('0x1f')](respondWithResult(_0x58108b,null))['catch'](handleError(_0x58108b,null));};exports[_0x406f('0x20')]=function(_0x147448,_0x3e3546){return db[_0x406f('0x26')][_0x406f('0x32')]({'where':{'id':_0x147448[_0x406f('0x36')]['id']}})[_0x406f('0x1f')](handleEntityNotFound(_0x3e3546,null))[_0x406f('0x1f')](removeEntity(_0x3e3546,null))[_0x406f('0x33')](handleError(_0x3e3546,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index aea9ced..b60600b 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 _0xbca3=['request-promise','path','../../config/environment','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api'];(function(_0x409251,_0x40f525){var _0x216f47=function(_0x517895){while(--_0x517895){_0x409251['push'](_0x409251['shift']());}};_0x216f47(++_0x40f525);}(_0xbca3,0x16d));var _0x3bca=function(_0x625777,_0x2674bb){_0x625777=_0x625777-0x0;var _0xd4c1ed=_0xbca3[_0x625777];return _0xd4c1ed;};'use strict';var _=require(_0x3bca('0x0'));var util=require('util');var logger=require(_0x3bca('0x1'))(_0x3bca('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3bca('0x3'));var fs=require('fs');var path=require(_0x3bca('0x4'));var rimraf=require('rimraf');var config=require(_0x3bca('0x5'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x3c2b70,_0x43cb01){return _0x3c2b70['define'](_0x3bca('0x6'),attributes,{'tableName':_0x3bca('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d63=['chat_proactive_actions','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5e279d,_0x3800d0){var _0x937234=function(_0x436cb4){while(--_0x436cb4){_0x5e279d['push'](_0x5e279d['shift']());}};_0x937234(++_0x3800d0);}(_0x1d63,0x1c3));var _0x31d6=function(_0x2f1cb0,_0x3a505e){_0x2f1cb0=_0x2f1cb0-0x0;var _0x1e99d4=_0x1d63[_0x2f1cb0];return _0x1e99d4;};'use strict';var _=require(_0x31d6('0x0'));var util=require('util');var logger=require(_0x31d6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x31d6('0x2'));var rp=require(_0x31d6('0x3'));var fs=require('fs');var path=require(_0x31d6('0x4'));var rimraf=require(_0x31d6('0x5'));var config=require(_0x31d6('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x31d6('0x7')]=function(_0x2ee9ec,_0x831b03){return _0x2ee9ec['define']('ChatProactiveAction',attributes,{'tableName':_0x31d6('0x8'),'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 6ede526..f03e4b2 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 _0x56f4=['http','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','ioredis','../../config/utils','rpc','../../config/environment','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56f4,0xb4));var _0x456f=function(_0x5aab34,_0x41c730){_0x5aab34=_0x5aab34-0x0;var _0x3a2694=_0x56f4[_0x5aab34];return _0x3a2694;};'use strict';var _=require('lodash');var util=require(_0x456f('0x0'));var moment=require(_0x456f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x456f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x456f('0x3'));var logger=require('../../config/logger')(_0x456f('0x4'));var config=require(_0x456f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x456f('0x6')][_0x456f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x431e93,_0x5c1249,_0xe6c8f4){return new BPromise(function(_0x1c3c22,_0x17d07c){return client['request'](_0x431e93,_0xe6c8f4)['then'](function(_0x3135c3){logger['info'](_0x456f('0x8'),_0x5c1249,_0x456f('0x9'));logger[_0x456f('0xa')](_0x456f('0xb'),_0x5c1249,'request\x20sent',JSON[_0x456f('0xc')](_0x3135c3));if(_0x3135c3[_0x456f('0xd')]){if(_0x3135c3['error'][_0x456f('0xe')]===0x1f4){logger[_0x456f('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x5c1249,_0x3135c3[_0x456f('0xd')][_0x456f('0xf')]);return _0x17d07c(_0x3135c3[_0x456f('0xd')][_0x456f('0xf')]);}logger[_0x456f('0xd')](_0x456f('0x8'),_0x5c1249,_0x3135c3[_0x456f('0xd')][_0x456f('0xf')]);return _0x1c3c22(_0x3135c3[_0x456f('0xd')][_0x456f('0xf')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5c1249,_0x456f('0x9'));_0x1c3c22(_0x3135c3[_0x456f('0x10')][_0x456f('0xf')]);}})['catch'](function(_0x109fbb){logger[_0x456f('0xd')](_0x456f('0x8'),_0x5c1249,_0x109fbb);_0x17d07c(_0x109fbb);});});} \ No newline at end of file +var _0xe5c3=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe5c3,0x138));var _0x3e5c=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xe5c3[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x3e5c('0x0'));var util=require(_0x3e5c('0x1'));var moment=require(_0x3e5c('0x2'));var BPromise=require(_0x3e5c('0x3'));var rs=require(_0x3e5c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e5c('0x5'))['db'];var utils=require(_0x3e5c('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3e5c('0x7'));var client=jayson[_0x3e5c('0x8')][_0x3e5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xaad3e7,_0xb1c650,_0x1b8cb0){return new BPromise(function(_0xf0ec4d,_0x2a3f83){return client[_0x3e5c('0xa')](_0xaad3e7,_0x1b8cb0)['then'](function(_0x56c1f6){logger[_0x3e5c('0xb')](_0x3e5c('0xc'),_0xb1c650,_0x3e5c('0xd'));logger[_0x3e5c('0xe')](_0x3e5c('0xf'),_0xb1c650,_0x3e5c('0xd'),JSON[_0x3e5c('0x10')](_0x56c1f6));if(_0x56c1f6['error']){if(_0x56c1f6[_0x3e5c('0x11')][_0x3e5c('0x12')]===0x1f4){logger[_0x3e5c('0x11')](_0x3e5c('0xc'),_0xb1c650,_0x56c1f6[_0x3e5c('0x11')][_0x3e5c('0x13')]);return _0x2a3f83(_0x56c1f6['error'][_0x3e5c('0x13')]);}logger[_0x3e5c('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0xb1c650,_0x56c1f6[_0x3e5c('0x11')][_0x3e5c('0x13')]);return _0xf0ec4d(_0x56c1f6['error']['message']);}else{logger['info'](_0x3e5c('0xc'),_0xb1c650,_0x3e5c('0xd'));_0xf0ec4d(_0x56c1f6[_0x3e5c('0x14')][_0x3e5c('0x13')]);}})[_0x3e5c('0x15')](function(_0x46bcf2){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0xb1c650,_0x46bcf2);_0x2a3f83(_0x46bcf2);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 1544478..7a26565 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 _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xabce,0x103));var _0xeabc=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xabce[_0x4bb66f];return _0xf2772f;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file +var _0x71ab=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x71ab,0x64));var _0xb71a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x71ab[_0x3e5086];return _0xfeb102;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xb')]);router[_0xb71a('0xc')]('/',auth[_0xb71a('0xa')](),controller[_0xb71a('0xd')]);router[_0xb71a('0xe')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xf')]);router[_0xb71a('0x10')]('/:id',auth[_0xb71a('0xa')](),controller['destroy']);module[_0xb71a('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index c18faf9..5ee52a6 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 _0x839d=['INTEGER','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x587f03,_0xd2ab1){var _0x32733f=function(_0xa9b9b3){while(--_0xa9b9b3){_0x587f03['push'](_0x587f03['shift']());}};_0x32733f(++_0xd2ab1);}(_0x839d,0x129));var _0xd839=function(_0x1248ad,_0x3fc0eb){_0x1248ad=_0x1248ad-0x0;var _0x5b9ce7=_0x839d[_0x1248ad];return _0x5b9ce7;};'use strict';var Sequelize=require(_0xd839('0x0'));module[_0xd839('0x1')]={'name':{'type':Sequelize[_0xd839('0x2')],'unique':_0xd839('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd839('0x2')]},'timeout':{'type':Sequelize[_0xd839('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xd839('0x5'),_0xd839('0x6'))}}; \ No newline at end of file +var _0x156f=['beepall','roundrobin','sequelize','exports','INTEGER','ENUM','rrmemory'];(function(_0x410344,_0x11c039){var _0x210ff4=function(_0x24501a){while(--_0x24501a){_0x410344['push'](_0x410344['shift']());}};_0x210ff4(++_0x11c039);}(_0x156f,0xfe));var _0xf156=function(_0x411895,_0x2c9e63){_0x411895=_0x411895-0x0;var _0x4efdc5=_0x156f[_0x411895];return _0x4efdc5;};'use strict';var Sequelize=require(_0xf156('0x0'));module[_0xf156('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf156('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf156('0x3')](_0xf156('0x4'),_0xf156('0x5'),_0xf156('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 762cbbf..ea4acab 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 _0x9f1a=['params','keys','rawAttributes','intersection','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','findOne','UserChatQueue','hasOwnProperty','nolimit','order','filters','pick','ChatQueueId','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','ChatQueues','UserProfileResource','end','stack','name','send','type','key','model','map','query','attributes','fields','length','sort','filter','where','merge','VIRTUAL','options','ChatQueue','rows'];(function(_0x13183f,_0x17d8a7){var _0x4435a7=function(_0x3720d6){while(--_0x3720d6){_0x13183f['push'](_0x13183f['shift']());}};_0x4435a7(++_0x17d8a7);}(_0x9f1a,0x18b));var _0xa9f1=function(_0xc3f8fe,_0x3387c4){_0xc3f8fe=_0xc3f8fe-0x0;var _0x586aa1=_0x9f1a[_0xc3f8fe];return _0x586aa1;};'use strict';var emlformat=require(_0xa9f1('0x0'));var rimraf=require(_0xa9f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9f1('0x2'));var rp=require(_0xa9f1('0x3'));var moment=require(_0xa9f1('0x4'));var BPromise=require(_0xa9f1('0x5'));var Mustache=require(_0xa9f1('0x6'));var util=require('util');var path=require(_0xa9f1('0x7'));var sox=require(_0xa9f1('0x8'));var csv=require('to-csv');var ejs=require(_0xa9f1('0x9'));var fs=require('fs');var fs_extra=require(_0xa9f1('0xa'));var _=require(_0xa9f1('0xb'));var squel=require('squel');var crypto=require(_0xa9f1('0xc'));var jsforce=require(_0xa9f1('0xd'));var deskjs=require(_0xa9f1('0xe'));var toCsv=require(_0xa9f1('0xf'));var querystring=require(_0xa9f1('0x10'));var Papa=require(_0xa9f1('0x11'));var Redis=require(_0xa9f1('0x12'));var authService=require(_0xa9f1('0x13'));var qs=require(_0xa9f1('0x14'));var as=require(_0xa9f1('0x15'));var hardwareService=require(_0xa9f1('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa9f1('0x17'));var db=require(_0xa9f1('0x18'))['db'];config[_0xa9f1('0x19')]=_[_0xa9f1('0x1a')](config['redis'],{'host':_0xa9f1('0x1b'),'port':0x18eb});var socket=require(_0xa9f1('0x1c'))(new Redis(config['redis']));require(_0xa9f1('0x1d'))[_0xa9f1('0x1e')](socket);var jayson=require(_0xa9f1('0x1f'));var client=jayson['client'][_0xa9f1('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2c8ba3,_0x28f2a7,_0x458e9c,_0x31ac32){return new BPromise(function(_0x904cd1,_0x10937f){var _0x183cb8=_0x31ac32||client;return _0x183cb8['request'](_0x2c8ba3,_0x458e9c)[_0xa9f1('0x21')](function(_0x4a8884){logger[_0xa9f1('0x22')](_0xa9f1('0x23'),_0x28f2a7,_0xa9f1('0x24'));logger[_0xa9f1('0x25')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x28f2a7,_0xa9f1('0x24'),JSON[_0xa9f1('0x26')](_0x4a8884));if(_0x4a8884[_0xa9f1('0x27')]){if(_0x4a8884[_0xa9f1('0x27')][_0xa9f1('0x28')]===0x1f4){logger[_0xa9f1('0x27')](_0xa9f1('0x23'),_0x28f2a7,_0x4a8884[_0xa9f1('0x27')][_0xa9f1('0x29')]);return _0x10937f(_0x4a8884[_0xa9f1('0x27')][_0xa9f1('0x29')]);}logger[_0xa9f1('0x27')](_0xa9f1('0x23'),_0x28f2a7,_0x4a8884[_0xa9f1('0x27')][_0xa9f1('0x29')]);return _0x904cd1(_0x4a8884[_0xa9f1('0x27')][_0xa9f1('0x29')]);}else{logger[_0xa9f1('0x22')](_0xa9f1('0x23'),_0x28f2a7,'request\x20sent');_0x904cd1(_0x4a8884[_0xa9f1('0x2a')][_0xa9f1('0x29')]);}})[_0xa9f1('0x2b')](function(_0x4e382b){logger[_0xa9f1('0x27')](_0xa9f1('0x23'),_0x28f2a7,_0x4e382b);_0x10937f(_0x4e382b);});});}function respondWithStatusCode(_0x133a3b,_0x32c3e2){_0x32c3e2=_0x32c3e2||0xcc;return function(_0x535476){if(_0x535476){return _0x133a3b[_0xa9f1('0x2c')](_0x32c3e2);}return _0x133a3b[_0xa9f1('0x2d')](_0x32c3e2)['end']();};}function respondWithResult(_0x1561ca,_0x5d595a){_0x5d595a=_0x5d595a||0xc8;return function(_0x124750){if(_0x124750){return _0x1561ca['status'](_0x5d595a)[_0xa9f1('0x2e')](_0x124750);}};}function respondWithFilteredResult(_0x31d744,_0x3e026d){return function(_0x102270){if(_0x102270){var _0x20663b=typeof _0x3e026d[_0xa9f1('0x2f')]===_0xa9f1('0x30')&&typeof _0x3e026d[_0xa9f1('0x31')]===_0xa9f1('0x30');var _0x175cc8=_0x102270[_0xa9f1('0x32')];var _0x2c2d29=_0x20663b?0x0:_0x3e026d['offset'];var _0x574376=_0x20663b?_0x102270[_0xa9f1('0x32')]:_0x3e026d[_0xa9f1('0x2f')]+_0x3e026d[_0xa9f1('0x31')];var _0x2f90e3;if(_0x574376>=_0x175cc8){_0x574376=_0x175cc8;_0x2f90e3=0xc8;}else{_0x2f90e3=0xce;}_0x31d744[_0xa9f1('0x2d')](_0x2f90e3);return _0x31d744[_0xa9f1('0x33')](_0xa9f1('0x34'),_0x2c2d29+'-'+_0x574376+'/'+_0x175cc8)[_0xa9f1('0x2e')](_0x102270);}return null;};}function patchUpdates(_0x14eddc){return function(_0x5283d3){try{jsonpatch[_0xa9f1('0x35')](_0x5283d3,_0x14eddc,!![]);}catch(_0xb32730){return BPromise['reject'](_0xb32730);}return _0x5283d3[_0xa9f1('0x36')]();};}function saveUpdates(_0x53b503,_0x2d45d4){return function(_0x378974){if(_0x378974){return _0x378974[_0xa9f1('0x37')](_0x53b503)['then'](function(_0x34c765){return _0x34c765;});}return null;};}function removeEntity(_0x37602d,_0x1f23c9){return function(_0x573203){if(_0x573203){return _0x573203['destroy']()[_0xa9f1('0x21')](function(){var _0x203170=_0x573203[_0xa9f1('0x38')]({'plain':!![]});var _0x479925=_0xa9f1('0x39');return db[_0xa9f1('0x3a')]['destroy']({'where':{'type':_0x479925,'resourceId':_0x203170['id']}})[_0xa9f1('0x21')](function(){return _0x573203;});})[_0xa9f1('0x21')](function(){_0x37602d[_0xa9f1('0x2d')](0xcc)[_0xa9f1('0x3b')]();});}};}function handleEntityNotFound(_0x164a74,_0x538dba){return function(_0x102e28){if(!_0x102e28){_0x164a74[_0xa9f1('0x2c')](0x194);}return _0x102e28;};}function handleError(_0x30dc8a,_0x4d9632){_0x4d9632=_0x4d9632||0x1f4;return function(_0xa54960){logger[_0xa9f1('0x27')](_0xa54960[_0xa9f1('0x3c')]);if(_0xa54960[_0xa9f1('0x3d')]){delete _0xa54960[_0xa9f1('0x3d')];}_0x30dc8a['status'](_0x4d9632)[_0xa9f1('0x3e')](_0xa54960);};}exports['index']=function(_0x4a7945,_0x25999d){var _0x2ad8eb={},_0x3eeb5f={},_0x1c2cab={'count':0x0,'rows':[]};var _0x16b5da=_['map'](db['ChatQueue']['rawAttributes'],function(_0x5b6d9c){return{'name':_0x5b6d9c['fieldName'],'type':_0x5b6d9c[_0xa9f1('0x3f')][_0xa9f1('0x40')]};});_0x3eeb5f[_0xa9f1('0x41')]=_[_0xa9f1('0x42')](_0x16b5da,_0xa9f1('0x3d'));_0x3eeb5f[_0xa9f1('0x43')]=_['keys'](_0x4a7945[_0xa9f1('0x43')]);_0x3eeb5f['filters']=_['intersection'](_0x3eeb5f[_0xa9f1('0x41')],_0x3eeb5f[_0xa9f1('0x43')]);_0x2ad8eb[_0xa9f1('0x44')]=_['intersection'](_0x3eeb5f[_0xa9f1('0x41')],qs[_0xa9f1('0x45')](_0x4a7945[_0xa9f1('0x43')]['fields']));_0x2ad8eb[_0xa9f1('0x44')]=_0x2ad8eb[_0xa9f1('0x44')][_0xa9f1('0x46')]?_0x2ad8eb[_0xa9f1('0x44')]:_0x3eeb5f[_0xa9f1('0x41')];if(!_0x4a7945[_0xa9f1('0x43')]['hasOwnProperty']('nolimit')){_0x2ad8eb[_0xa9f1('0x31')]=qs[_0xa9f1('0x31')](_0x4a7945['query'][_0xa9f1('0x31')]);_0x2ad8eb[_0xa9f1('0x2f')]=qs[_0xa9f1('0x2f')](_0x4a7945['query'][_0xa9f1('0x2f')]);}_0x2ad8eb['order']=qs[_0xa9f1('0x47')](_0x4a7945[_0xa9f1('0x43')]['sort']);_0x2ad8eb['where']=qs['filters'](_['pick'](_0x4a7945[_0xa9f1('0x43')],_0x3eeb5f['filters']),_0x16b5da);if(_0x4a7945['query'][_0xa9f1('0x48')]){_0x2ad8eb[_0xa9f1('0x49')]=_[_0xa9f1('0x4a')](_0x2ad8eb[_0xa9f1('0x49')],{'$or':_[_0xa9f1('0x42')](_0x16b5da,function(_0x102fd2){if(_0x102fd2['type']!==_0xa9f1('0x4b')){var _0x121157={};_0x121157[_0x102fd2[_0xa9f1('0x3d')]]={'$like':'%'+_0x4a7945[_0xa9f1('0x43')]['filter']+'%'};return _0x121157;}})});}_0x2ad8eb=_[_0xa9f1('0x4a')]({},_0x2ad8eb,_0x4a7945[_0xa9f1('0x4c')]);var _0x46fa00={'where':_0x2ad8eb[_0xa9f1('0x49')]};return db['ChatQueue'][_0xa9f1('0x32')](_0x46fa00)[_0xa9f1('0x21')](function(_0x1730ba){_0x1c2cab[_0xa9f1('0x32')]=_0x1730ba;if(_0x4a7945[_0xa9f1('0x43')]['includeAll']){_0x2ad8eb['include']=[{'all':!![]}];}return db[_0xa9f1('0x4d')]['findAll'](_0x2ad8eb);})[_0xa9f1('0x21')](function(_0x1eb8a6){_0x1c2cab[_0xa9f1('0x4e')]=_0x1eb8a6;return _0x1c2cab;})[_0xa9f1('0x21')](respondWithFilteredResult(_0x25999d,_0x2ad8eb))[_0xa9f1('0x2b')](handleError(_0x25999d,null));};exports['show']=function(_0x3e6412,_0x3e98e1){var _0x2c01ce={'raw':!![],'where':{'id':_0x3e6412[_0xa9f1('0x4f')]['id']}},_0x4baad6={};_0x4baad6[_0xa9f1('0x41')]=_[_0xa9f1('0x50')](db[_0xa9f1('0x4d')][_0xa9f1('0x51')]);_0x4baad6[_0xa9f1('0x43')]=_[_0xa9f1('0x50')](_0x3e6412[_0xa9f1('0x43')]);_0x4baad6['filters']=_[_0xa9f1('0x52')](_0x4baad6[_0xa9f1('0x41')],_0x4baad6[_0xa9f1('0x43')]);_0x2c01ce[_0xa9f1('0x44')]=_['intersection'](_0x4baad6['model'],qs['fields'](_0x3e6412[_0xa9f1('0x43')][_0xa9f1('0x45')]));_0x2c01ce['attributes']=_0x2c01ce[_0xa9f1('0x44')][_0xa9f1('0x46')]?_0x2c01ce[_0xa9f1('0x44')]:_0x4baad6[_0xa9f1('0x41')];if(_0x3e6412[_0xa9f1('0x43')][_0xa9f1('0x53')]){_0x2c01ce[_0xa9f1('0x54')]=[{'all':!![]}];}_0x2c01ce=_[_0xa9f1('0x4a')]({},_0x2c01ce,_0x3e6412[_0xa9f1('0x4c')]);return db[_0xa9f1('0x4d')][_0xa9f1('0x55')](_0x2c01ce)[_0xa9f1('0x21')](handleEntityNotFound(_0x3e98e1,null))['then'](respondWithResult(_0x3e98e1,null))['catch'](handleError(_0x3e98e1,null));};exports[_0xa9f1('0x56')]=function(_0x29ae97,_0x380653){return db[_0xa9f1('0x4d')][_0xa9f1('0x56')](_0x29ae97[_0xa9f1('0x57')],{})['then'](function(_0x561837){var _0x2d89da=_0x29ae97['user'][_0xa9f1('0x38')]({'plain':!![]});if(!_0x2d89da)throw new Error(_0xa9f1('0x58'));if(_0x2d89da[_0xa9f1('0x59')]===_0xa9f1('0x5a')){var _0x73c148=_0x561837['get']({'plain':!![]});var _0x52c9e7='ChatQueues';return db[_0xa9f1('0x5b')][_0xa9f1('0x55')]({'where':{'name':_0x52c9e7,'userProfileId':_0x2d89da[_0xa9f1('0x5c')]},'raw':!![]})[_0xa9f1('0x21')](function(_0x2f7fef){if(_0x2f7fef&&_0x2f7fef[_0xa9f1('0x5d')]===0x0){return db[_0xa9f1('0x3a')][_0xa9f1('0x56')]({'name':_0x73c148[_0xa9f1('0x3d')],'resourceId':_0x73c148['id'],'type':_0x2f7fef[_0xa9f1('0x3d')],'sectionId':_0x2f7fef['id']},{})[_0xa9f1('0x21')](function(){return _0x561837;});}else{return _0x561837;}})['catch'](function(_0x16e5ab){logger['error'](_0xa9f1('0x5e'),_0x16e5ab);throw _0x16e5ab;});}return _0x561837;})['then'](respondWithResult(_0x380653,0xc9))[_0xa9f1('0x2b')](handleError(_0x380653,null));};exports['update']=function(_0x4a644f,_0x1631a6){if(_0x4a644f['body']['id']){delete _0x4a644f[_0xa9f1('0x57')]['id'];}return db[_0xa9f1('0x4d')]['find']({'where':{'id':_0x4a644f[_0xa9f1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1631a6,null))['then'](saveUpdates(_0x4a644f[_0xa9f1('0x57')],null))[_0xa9f1('0x21')](respondWithResult(_0x1631a6,null))['catch'](handleError(_0x1631a6,null));};exports[_0xa9f1('0x5f')]=function(_0x4ec188,_0x1a14a3){return db[_0xa9f1('0x4d')][_0xa9f1('0x55')]({'where':{'id':_0x4ec188[_0xa9f1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1a14a3,null))[_0xa9f1('0x21')](removeEntity(_0x1a14a3,null))[_0xa9f1('0x2b')](handleError(_0x1a14a3,null));};exports[_0xa9f1('0x60')]=function(_0x5cff6c,_0x196ea1){return db[_0xa9f1('0x4d')][_0xa9f1('0x60')]()['then'](respondWithResult(_0x196ea1,null))[_0xa9f1('0x2b')](handleError(_0x196ea1,null));};exports['getMembers']=function(_0x39f68f,_0x17a3cb,_0xd3e84c){var _0x3fceed={'raw':!![],'where':{}},_0x135831={},_0x31b08c;return db[_0xa9f1('0x4d')][_0xa9f1('0x61')]({'where':{'id':_0x39f68f[_0xa9f1('0x4f')]['id']}})[_0xa9f1('0x21')](handleEntityNotFound(_0x17a3cb,null))[_0xa9f1('0x21')](function(_0x11e54){if(_0x11e54){_0x31b08c=_0x11e54[_0xa9f1('0x38')]({'plain':!![]});_0x135831[_0xa9f1('0x41')]=_[_0xa9f1('0x50')](db[_0xa9f1('0x62')]['rawAttributes']);_0x135831[_0xa9f1('0x43')]=_[_0xa9f1('0x50')](_0x39f68f[_0xa9f1('0x43')]);_0x135831['filters']=_[_0xa9f1('0x52')](_0x135831[_0xa9f1('0x41')],_0x135831[_0xa9f1('0x43')]);_0x3fceed[_0xa9f1('0x44')]=_[_0xa9f1('0x52')](_0x135831[_0xa9f1('0x41')],qs['fields'](_0x39f68f['query'][_0xa9f1('0x45')]));_0x3fceed['attributes']=_0x3fceed['attributes'][_0xa9f1('0x46')]?_0x3fceed[_0xa9f1('0x44')]:_0x135831[_0xa9f1('0x41')];if(!_0x39f68f[_0xa9f1('0x43')][_0xa9f1('0x63')](_0xa9f1('0x64'))){_0x3fceed['limit']=qs[_0xa9f1('0x31')](_0x39f68f[_0xa9f1('0x43')]['limit']);_0x3fceed[_0xa9f1('0x2f')]=qs[_0xa9f1('0x2f')](_0x39f68f[_0xa9f1('0x43')][_0xa9f1('0x2f')]);}_0x3fceed[_0xa9f1('0x65')]=qs[_0xa9f1('0x47')](_0x39f68f['query']['sort']);_0x3fceed[_0xa9f1('0x49')]=qs[_0xa9f1('0x66')](_[_0xa9f1('0x67')](_0x39f68f[_0xa9f1('0x43')],_0x135831[_0xa9f1('0x66')]));_0x3fceed['where'][_0xa9f1('0x68')]=_0x11e54['id'];if(_0x39f68f['query'][_0xa9f1('0x48')]){_0x3fceed[_0xa9f1('0x49')]=_[_0xa9f1('0x4a')](_0x3fceed[_0xa9f1('0x49')],{'$or':_['map'](_0x3fceed[_0xa9f1('0x44')],function(_0x2e76f6){var _0x197c5e={};_0x197c5e[_0x2e76f6]={'$like':'%'+_0x39f68f[_0xa9f1('0x43')][_0xa9f1('0x48')]+'%'};return _0x197c5e;})});}_0x3fceed=_[_0xa9f1('0x4a')]({},_0x3fceed,_0x39f68f['options']);return db[_0xa9f1('0x62')][_0xa9f1('0x69')](_0x3fceed);}})[_0xa9f1('0x21')](function(_0x1bcc5b){if(_0x1bcc5b){return db[_0xa9f1('0x6a')][_0xa9f1('0x6b')]({'where':{'id':_[_0xa9f1('0x42')](_0x1bcc5b,_0xa9f1('0x6c')),'role':_0xa9f1('0x6d')},'attributes':['id',_0xa9f1('0x3d'),_0xa9f1('0x6e'),_0xa9f1('0x6f'),_0xa9f1('0x70')]});}})[_0xa9f1('0x21')](function(_0x1712b6){if(_0x1712b6){return{'count':_0x1712b6[_0xa9f1('0x32')],'rows':_['map'](_0x1712b6['rows'],function(_0x5878a8){return{'membername':_0x5878a8['name'],'UserId':_0x5878a8['id'],'queue_name':_0x31b08c['name'],'ChatQueueId':_0x31b08c['id'],'interface':util[_0xa9f1('0x71')](_0xa9f1('0x72'),_0xa9f1('0x73'),_0x5878a8[_0xa9f1('0x3d')]),'penalty':0x0,'paused':_0x5878a8[_0xa9f1('0x6e')],'createdAt':_0x5878a8[_0xa9f1('0x70')],'updatedAt':_0x5878a8[_0xa9f1('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa9f1('0x21')](respondWithFilteredResult(_0x17a3cb,_0x3fceed))[_0xa9f1('0x2b')](handleError(_0x17a3cb,null));};exports[_0xa9f1('0x74')]=function(_0x27447b,_0x2c007a,_0x339e9c){var _0xebbab8={};var _0x216820={};var _0x19ef09;var _0x4ec40e;return db['ChatQueue'][_0xa9f1('0x61')]({'where':{'id':_0x27447b['params']['id']}})[_0xa9f1('0x21')](handleEntityNotFound(_0x2c007a,null))[_0xa9f1('0x21')](function(_0x1a3fbb){if(_0x1a3fbb){_0x19ef09=_0x1a3fbb;_0x216820[_0xa9f1('0x41')]=_[_0xa9f1('0x50')](db[_0xa9f1('0x75')][_0xa9f1('0x51')]);_0x216820['query']=_[_0xa9f1('0x50')](_0x27447b[_0xa9f1('0x43')]);_0x216820[_0xa9f1('0x66')]=_[_0xa9f1('0x52')](_0x216820[_0xa9f1('0x41')],_0x216820['query']);_0xebbab8['attributes']=_[_0xa9f1('0x52')](_0x216820['model'],qs[_0xa9f1('0x45')](_0x27447b[_0xa9f1('0x43')][_0xa9f1('0x45')]));_0xebbab8['attributes']=_0xebbab8[_0xa9f1('0x44')][_0xa9f1('0x46')]?_0xebbab8[_0xa9f1('0x44')]:_0x216820[_0xa9f1('0x41')];_0xebbab8[_0xa9f1('0x65')]=qs[_0xa9f1('0x47')](_0x27447b['query']['sort']);_0xebbab8[_0xa9f1('0x49')]=qs[_0xa9f1('0x66')](_[_0xa9f1('0x67')](_0x27447b[_0xa9f1('0x43')],_0x216820['filters']));if(_0x27447b[_0xa9f1('0x43')][_0xa9f1('0x48')]){_0xebbab8[_0xa9f1('0x49')]=_[_0xa9f1('0x4a')](_0xebbab8[_0xa9f1('0x49')],{'$or':_[_0xa9f1('0x42')](_0xebbab8[_0xa9f1('0x44')],function(_0x5eecfc){var _0x1bd32c={};_0x1bd32c[_0x5eecfc]={'$like':'%'+_0x27447b['query'][_0xa9f1('0x48')]+'%'};return _0x1bd32c;})});}_0xebbab8=_[_0xa9f1('0x4a')]({},_0xebbab8,_0x27447b[_0xa9f1('0x4c')]);return _0x19ef09[_0xa9f1('0x74')](_0xebbab8);}})['then'](function(_0x3ab568){if(_0x3ab568){_0x4ec40e=_0x3ab568[_0xa9f1('0x46')];if(!_0x27447b[_0xa9f1('0x43')][_0xa9f1('0x63')](_0xa9f1('0x64'))){_0xebbab8[_0xa9f1('0x31')]=qs[_0xa9f1('0x31')](_0x27447b[_0xa9f1('0x43')]['limit']);_0xebbab8['offset']=qs[_0xa9f1('0x2f')](_0x27447b[_0xa9f1('0x43')][_0xa9f1('0x2f')]);}return _0x19ef09[_0xa9f1('0x74')](_0xebbab8);}})['then'](function(_0x1af53f){if(_0x1af53f){return _0x1af53f?{'count':_0x4ec40e,'rows':_0x1af53f}:null;}})[_0xa9f1('0x21')](respondWithResult(_0x2c007a,null))[_0xa9f1('0x2b')](handleError(_0x2c007a,null));};exports[_0xa9f1('0x76')]=function(_0xc0d142,_0x41b1a6,_0x4544eb){var _0x109c46=_0xc0d142['body'][_0xa9f1('0x77')];return db[_0xa9f1('0x75')][_0xa9f1('0x69')]({'where':{'id':_0x109c46},'attributes':['id'],'include':[{'model':db[_0xa9f1('0x6a')],'as':_0xa9f1('0x78'),'attributes':['id',_0xa9f1('0x3d'),_0xa9f1('0x79'),_0xa9f1('0x7a'),_0xa9f1('0x7b')],'raw':!![]}]})[_0xa9f1('0x21')](function(_0x333b7c){if(_0x333b7c){var _0x2be8c5=_[_0xa9f1('0x7c')](_0x333b7c,function(_0x55d442){var _0x3cf1dd=_0x55d442[_0xa9f1('0x38')]({'plain':!![]});return _0x3cf1dd[_0xa9f1('0x78')];});return db[_0xa9f1('0x4d')]['find']({'where':{'id':_0xc0d142[_0xa9f1('0x4f')]['id']}})[_0xa9f1('0x21')](function(_0x4bd96e){return db[_0xa9f1('0x7d')][_0xa9f1('0x7e')](function(_0x202256){return _0x4bd96e['addTeams'](_0x109c46,{'transaction':_0x202256})['then'](function(){return BPromise[_0xa9f1('0x7f')](_0x2be8c5,function(_0x15d473){return db[_0xa9f1('0x62')][_0xa9f1('0x80')]({'where':{'UserId':_0x15d473['id'],'ChatQueueId':_0xc0d142[_0xa9f1('0x4f')]['id']},'transaction':_0x202256});});})[_0xa9f1('0x21')](function(){_0x2be8c5[_0xa9f1('0x81')](function(_0x192416){socket[_0xa9f1('0x82')](_0xa9f1('0x83'),{'UserId':_0x192416['id'],'ChatQueueId':_0x4bd96e['id']});});});});});}})[_0xa9f1('0x21')](respondWithStatusCode(_0x41b1a6,null))[_0xa9f1('0x2b')](handleError(_0x41b1a6,null));};exports[_0xa9f1('0x84')]=function(_0x37e6a5,_0x3bc368,_0x1c5ce4){return db[_0xa9f1('0x75')]['findAll']({'where':{'id':_0x37e6a5[_0xa9f1('0x43')][_0xa9f1('0x77')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa9f1('0x78'),'attributes':['id'],'raw':!![]}]})[_0xa9f1('0x21')](handleEntityNotFound(_0x3bc368,null))['then'](function(_0x5adfd3){var _0x47d89d=_[_0xa9f1('0x42')](_0x5adfd3,'id');var _0x4a098e=[];var _0x32f826=[];var _0xc457e2=squel[_0xa9f1('0x85')]();_0xc457e2['field']('tq.TeamId')[_0xa9f1('0x86')](_0xa9f1('0x87'),'tq')[_0xa9f1('0x88')](_0xa9f1('0x89'),'ut',_0xa9f1('0x8a'))[_0xa9f1('0x49')]('ChatQueueId\x20=\x20?',_0x37e6a5['params']['id']);for(var _0x1b06be=0x0;_0x1b06be<_0x5adfd3[_0xa9f1('0x46')];_0x1b06be+=0x1){let _0x497b1a=_0x5adfd3[_0x1b06be];for(var _0x458c48=0x0;_0x458c48<_0x497b1a['Agents']['length'];_0x458c48+=0x1){let _0x146201=_0x497b1a['Agents'][_0x458c48];var _0x4509b5=_0xc457e2[_0xa9f1('0x8b')]();_0x4509b5[_0xa9f1('0x49')](_0xa9f1('0x8c'),_0x146201['id']);_0x32f826[_0xa9f1('0x8d')](db[_0xa9f1('0x7d')]['query'](_0x4509b5['toString'](),{'type':db['sequelize'][_0xa9f1('0x8e')][_0xa9f1('0x8f')]})['then'](function(_0x1a245f){if(_0x1a245f[_0xa9f1('0x46')]===0x1){return _0x146201['id'];}else{var _0x38d5b3=_['every'](_[_0xa9f1('0x42')](_0x1a245f,_0xa9f1('0x90')),function(_0x1a849d){return _[_0xa9f1('0x91')](_0x47d89d,_0x1a849d);});if(_0x38d5b3){return _0x146201['id'];}}}));}}return BPromise[_0xa9f1('0x92')](_0x32f826)[_0xa9f1('0x21')](function(_0x351a73){_0x4a098e=_(_0x4a098e)[_0xa9f1('0x93')](_0x351a73)[_0xa9f1('0x94')]()[_0xa9f1('0x95')]();return db[_0xa9f1('0x4d')]['find']({'where':{'id':_0x37e6a5[_0xa9f1('0x4f')]['id']}})['then'](function(_0x38c8cd){return db[_0xa9f1('0x7d')][_0xa9f1('0x7e')](function(_0x30c17e){return _0x38c8cd[_0xa9f1('0x84')](_0x37e6a5[_0xa9f1('0x43')][_0xa9f1('0x77')],{'transaction':_0x30c17e})['then'](function(){if(!_[_0xa9f1('0x96')](_0x4a098e)){return _0x38c8cd[_0xa9f1('0x97')](_0x4a098e,{'transaction':_0x30c17e});}})['then'](function(){_0x4a098e[_0xa9f1('0x81')](function(_0x15d0af){socket[_0xa9f1('0x82')]('userChatQueue:remove',{'UserId':_0x15d0af,'ChatQueueId':_0x38c8cd['id']});});});});});});})[_0xa9f1('0x21')](respondWithStatusCode(_0x3bc368,null))[_0xa9f1('0x2b')](handleError(_0x3bc368,null));};exports[_0xa9f1('0x98')]=function(_0x3fcdc1,_0x49bb6d,_0x3ed41a){return db[_0xa9f1('0x4d')][_0xa9f1('0x55')]({'where':{'id':_0x3fcdc1['params']['id']}})[_0xa9f1('0x21')](handleEntityNotFound(_0x49bb6d,null))[_0xa9f1('0x21')](function(_0x4f7e4f){if(_0x4f7e4f){return _0x4f7e4f['addAgents'](_0x3fcdc1[_0xa9f1('0x57')][_0xa9f1('0x77')],_[_0xa9f1('0x99')](_0x3fcdc1[_0xa9f1('0x57')],[_0xa9f1('0x77'),'id'])||{})[_0xa9f1('0x9a')](function(_0x2aaba6){for(var _0x4022bc=0x0;_0x4022bc<_0x3fcdc1[_0xa9f1('0x57')]['ids'][_0xa9f1('0x46')];_0x4022bc+=0x1){socket[_0xa9f1('0x82')]('userChatQueue:save',{'UserId':Number(_0x3fcdc1['body'][_0xa9f1('0x77')][_0x4022bc]),'ChatQueueId':Number(_0x3fcdc1['params']['id'])});}return _0x2aaba6;});}})['then'](respondWithResult(_0x49bb6d,null))['catch'](handleError(_0x49bb6d,null));};exports[_0xa9f1('0x97')]=function(_0x48bec1,_0xa11623,_0x1e3fd1){return db['ChatQueue'][_0xa9f1('0x55')]({'where':{'id':_0x48bec1[_0xa9f1('0x4f')]['id']}})[_0xa9f1('0x21')](handleEntityNotFound(_0xa11623,null))[_0xa9f1('0x21')](function(_0x1825e8){if(_0x1825e8){return _0x1825e8['removeAgents'](_0x48bec1[_0xa9f1('0x43')][_0xa9f1('0x77')])[_0xa9f1('0x21')](function(){if(_[_0xa9f1('0x9b')](_0x48bec1[_0xa9f1('0x43')][_0xa9f1('0x77')])){for(var _0x434b2b=0x0;_0x434b2b<_0x48bec1[_0xa9f1('0x43')][_0xa9f1('0x77')][_0xa9f1('0x46')];_0x434b2b+=0x1){socket[_0xa9f1('0x82')]('userChatQueue:remove',{'UserId':Number(_0x48bec1['query'][_0xa9f1('0x77')][_0x434b2b]),'ChatQueueId':Number(_0x48bec1['params']['id'])});}}else{socket[_0xa9f1('0x82')](_0xa9f1('0x9c'),{'UserId':Number(_0x48bec1[_0xa9f1('0x43')][_0xa9f1('0x77')]),'ChatQueueId':Number(_0x48bec1['params']['id'])});}});}})['then'](respondWithStatusCode(_0xa11623,null))['catch'](handleError(_0xa11623,null));};exports['getAgents']=function(_0x49fab9,_0x22e5ad,_0x5361a0){var _0x3e17d6={};var _0x203340={};var _0x495346;var _0xc2d1b3;return db[_0xa9f1('0x4d')]['findOne']({'where':{'id':_0x49fab9[_0xa9f1('0x4f')]['id']}})[_0xa9f1('0x21')](handleEntityNotFound(_0x22e5ad,null))['then'](function(_0x45975c){if(_0x45975c){_0x495346=_0x45975c;_0x203340[_0xa9f1('0x41')]=_[_0xa9f1('0x50')](db[_0xa9f1('0x6a')]['rawAttributes']);_0x203340[_0xa9f1('0x43')]=_[_0xa9f1('0x50')](_0x49fab9[_0xa9f1('0x43')]);_0x203340[_0xa9f1('0x66')]=_[_0xa9f1('0x52')](_0x203340[_0xa9f1('0x41')],_0x203340[_0xa9f1('0x43')]);_0x3e17d6[_0xa9f1('0x44')]=_[_0xa9f1('0x52')](_0x203340[_0xa9f1('0x41')],qs[_0xa9f1('0x45')](_0x49fab9[_0xa9f1('0x43')]['fields']));_0x3e17d6[_0xa9f1('0x44')]=_0x3e17d6[_0xa9f1('0x44')][_0xa9f1('0x46')]?_0x3e17d6[_0xa9f1('0x44')]:_0x203340['model'];_0x3e17d6['order']=qs['sort'](_0x49fab9[_0xa9f1('0x43')][_0xa9f1('0x47')]);_0x3e17d6['where']=qs['filters'](_[_0xa9f1('0x67')](_0x49fab9[_0xa9f1('0x43')],_0x203340['filters']));if(_0x49fab9['query']['filter']){_0x3e17d6[_0xa9f1('0x49')]=_['merge'](_0x3e17d6[_0xa9f1('0x49')],{'$or':_[_0xa9f1('0x42')](_0x3e17d6[_0xa9f1('0x44')],function(_0x1b8cd8){var _0x52cc26={};_0x52cc26[_0x1b8cd8]={'$like':'%'+_0x49fab9[_0xa9f1('0x43')]['filter']+'%'};return _0x52cc26;})});}_0x3e17d6=_['merge']({},_0x3e17d6,_0x49fab9[_0xa9f1('0x4c')]);return _0x495346[_0xa9f1('0x9d')](_0x3e17d6);}})[_0xa9f1('0x21')](function(_0x10cd79){if(_0x10cd79){_0xc2d1b3=_0x10cd79['length'];if(!_0x49fab9[_0xa9f1('0x43')][_0xa9f1('0x63')](_0xa9f1('0x64'))){_0x3e17d6[_0xa9f1('0x31')]=qs[_0xa9f1('0x31')](_0x49fab9['query'][_0xa9f1('0x31')]);_0x3e17d6['offset']=qs[_0xa9f1('0x2f')](_0x49fab9[_0xa9f1('0x43')][_0xa9f1('0x2f')]);}return _0x495346['getAgents'](_0x3e17d6);}})['then'](function(_0x148f86){if(_0x148f86){return _0x148f86?{'count':_0xc2d1b3,'rows':_0x148f86}:null;}})['then'](respondWithResult(_0x22e5ad,null))['catch'](handleError(_0x22e5ad,null));}; \ No newline at end of file +var _0xc3a0=['json','undefined','count','offset','Content-Range','apply','reject','save','update','get','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatQueue','includeAll','findAll','rows','show','params','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','keys','UserChatQueue','nolimit','ChatQueueId','User','agent','updatedAt','createdAt','%s/%s','chatPause','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','emit','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','end','status'];(function(_0x37bfe2,_0x1c20e3){var _0x39bcd6=function(_0x3a8dbf){while(--_0x3a8dbf){_0x37bfe2['push'](_0x37bfe2['shift']());}};_0x39bcd6(++_0x1c20e3);}(_0xc3a0,0x68));var _0x0c3a=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0xc3a0[_0x1347f8];return _0x218368;};'use strict';var emlformat=require(_0x0c3a('0x0'));var rimraf=require(_0x0c3a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c3a('0x2'));var rp=require(_0x0c3a('0x3'));var moment=require('moment');var BPromise=require(_0x0c3a('0x4'));var Mustache=require(_0x0c3a('0x5'));var util=require(_0x0c3a('0x6'));var path=require('path');var sox=require(_0x0c3a('0x7'));var csv=require(_0x0c3a('0x8'));var ejs=require(_0x0c3a('0x9'));var fs=require('fs');var fs_extra=require(_0x0c3a('0xa'));var _=require(_0x0c3a('0xb'));var squel=require(_0x0c3a('0xc'));var crypto=require(_0x0c3a('0xd'));var jsforce=require(_0x0c3a('0xe'));var deskjs=require(_0x0c3a('0xf'));var toCsv=require(_0x0c3a('0x8'));var querystring=require(_0x0c3a('0x10'));var Papa=require(_0x0c3a('0x11'));var Redis=require('ioredis');var authService=require(_0x0c3a('0x12'));var qs=require(_0x0c3a('0x13'));var as=require(_0x0c3a('0x14'));var hardwareService=require(_0x0c3a('0x15'));var logger=require(_0x0c3a('0x16'))(_0x0c3a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0c3a('0x18'));var db=require('../../mysqldb')['db'];config[_0x0c3a('0x19')]=_[_0x0c3a('0x1a')](config[_0x0c3a('0x19')],{'host':_0x0c3a('0x1b'),'port':0x18eb});var socket=require(_0x0c3a('0x1c'))(new Redis(config['redis']));require(_0x0c3a('0x1d'))[_0x0c3a('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0c3a('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11a8c6,_0x537e14,_0x3df170,_0x4ae3fe){return new BPromise(function(_0x3a77d6,_0x44f358){var _0x1f089d=_0x4ae3fe||client;return _0x1f089d[_0x0c3a('0x20')](_0x11a8c6,_0x3df170)[_0x0c3a('0x21')](function(_0x29c66f){logger[_0x0c3a('0x22')](_0x0c3a('0x23'),_0x537e14,_0x0c3a('0x24'));logger[_0x0c3a('0x25')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x537e14,_0x0c3a('0x24'),JSON[_0x0c3a('0x26')](_0x29c66f));if(_0x29c66f[_0x0c3a('0x27')]){if(_0x29c66f[_0x0c3a('0x27')]['code']===0x1f4){logger[_0x0c3a('0x27')]('ChatQueue,\x20%s,\x20%s',_0x537e14,_0x29c66f[_0x0c3a('0x27')]['message']);return _0x44f358(_0x29c66f[_0x0c3a('0x27')][_0x0c3a('0x28')]);}logger[_0x0c3a('0x27')](_0x0c3a('0x23'),_0x537e14,_0x29c66f[_0x0c3a('0x27')][_0x0c3a('0x28')]);return _0x3a77d6(_0x29c66f['error']['message']);}else{logger[_0x0c3a('0x22')](_0x0c3a('0x23'),_0x537e14,_0x0c3a('0x24'));_0x3a77d6(_0x29c66f[_0x0c3a('0x29')][_0x0c3a('0x28')]);}})[_0x0c3a('0x2a')](function(_0x46f407){logger['error'](_0x0c3a('0x23'),_0x537e14,_0x46f407);_0x44f358(_0x46f407);});});}function respondWithStatusCode(_0x46e2d3,_0x3b5b70){_0x3b5b70=_0x3b5b70||0xcc;return function(_0x3cf5eb){if(_0x3cf5eb){return _0x46e2d3['sendStatus'](_0x3b5b70);}return _0x46e2d3['status'](_0x3b5b70)[_0x0c3a('0x2b')]();};}function respondWithResult(_0x7e3c7a,_0x311da5){_0x311da5=_0x311da5||0xc8;return function(_0x2ac140){if(_0x2ac140){return _0x7e3c7a[_0x0c3a('0x2c')](_0x311da5)[_0x0c3a('0x2d')](_0x2ac140);}};}function respondWithFilteredResult(_0x5a5d3d,_0x2af252){return function(_0x37b79b){if(_0x37b79b){var _0x102c96=typeof _0x2af252['offset']===_0x0c3a('0x2e')&&typeof _0x2af252['limit']===_0x0c3a('0x2e');var _0x150987=_0x37b79b[_0x0c3a('0x2f')];var _0x2f08d3=_0x102c96?0x0:_0x2af252[_0x0c3a('0x30')];var _0x2052d1=_0x102c96?_0x37b79b[_0x0c3a('0x2f')]:_0x2af252['offset']+_0x2af252['limit'];var _0x5744c2;if(_0x2052d1>=_0x150987){_0x2052d1=_0x150987;_0x5744c2=0xc8;}else{_0x5744c2=0xce;}_0x5a5d3d[_0x0c3a('0x2c')](_0x5744c2);return _0x5a5d3d['set'](_0x0c3a('0x31'),_0x2f08d3+'-'+_0x2052d1+'/'+_0x150987)[_0x0c3a('0x2d')](_0x37b79b);}return null;};}function patchUpdates(_0x1fa75f){return function(_0x4386ed){try{jsonpatch[_0x0c3a('0x32')](_0x4386ed,_0x1fa75f,!![]);}catch(_0x26bbc6){return BPromise[_0x0c3a('0x33')](_0x26bbc6);}return _0x4386ed[_0x0c3a('0x34')]();};}function saveUpdates(_0x188589,_0x123d30){return function(_0x33b0b8){if(_0x33b0b8){return _0x33b0b8[_0x0c3a('0x35')](_0x188589)[_0x0c3a('0x21')](function(_0x532b8d){return _0x532b8d;});}return null;};}function removeEntity(_0x2f2545,_0x3982ad){return function(_0x3c8434){if(_0x3c8434){return _0x3c8434['destroy']()[_0x0c3a('0x21')](function(){var _0xb505ba=_0x3c8434[_0x0c3a('0x36')]({'plain':!![]});var _0x5957a6='ChatQueues';return db[_0x0c3a('0x37')]['destroy']({'where':{'type':_0x5957a6,'resourceId':_0xb505ba['id']}})[_0x0c3a('0x21')](function(){return _0x3c8434;});})[_0x0c3a('0x21')](function(){_0x2f2545['status'](0xcc)[_0x0c3a('0x2b')]();});}};}function handleEntityNotFound(_0x29eb78,_0x45bf71){return function(_0x477a53){if(!_0x477a53){_0x29eb78[_0x0c3a('0x38')](0x194);}return _0x477a53;};}function handleError(_0x16f6f4,_0x51a449){_0x51a449=_0x51a449||0x1f4;return function(_0x92e1b5){logger['error'](_0x92e1b5[_0x0c3a('0x39')]);if(_0x92e1b5[_0x0c3a('0x3a')]){delete _0x92e1b5[_0x0c3a('0x3a')];}_0x16f6f4[_0x0c3a('0x2c')](_0x51a449)[_0x0c3a('0x3b')](_0x92e1b5);};}exports[_0x0c3a('0x3c')]=function(_0x105a9b,_0x52546a){var _0x1d06d9={},_0x759944={},_0x3a9d27={'count':0x0,'rows':[]};var _0x1af0a7=_[_0x0c3a('0x3d')](db['ChatQueue'][_0x0c3a('0x3e')],function(_0xe3d797){return{'name':_0xe3d797[_0x0c3a('0x3f')],'type':_0xe3d797[_0x0c3a('0x40')][_0x0c3a('0x41')]};});_0x759944[_0x0c3a('0x42')]=_[_0x0c3a('0x3d')](_0x1af0a7,'name');_0x759944[_0x0c3a('0x43')]=_['keys'](_0x105a9b[_0x0c3a('0x43')]);_0x759944[_0x0c3a('0x44')]=_[_0x0c3a('0x45')](_0x759944[_0x0c3a('0x42')],_0x759944[_0x0c3a('0x43')]);_0x1d06d9[_0x0c3a('0x46')]=_[_0x0c3a('0x45')](_0x759944[_0x0c3a('0x42')],qs['fields'](_0x105a9b[_0x0c3a('0x43')][_0x0c3a('0x47')]));_0x1d06d9['attributes']=_0x1d06d9[_0x0c3a('0x46')][_0x0c3a('0x48')]?_0x1d06d9[_0x0c3a('0x46')]:_0x759944[_0x0c3a('0x42')];if(!_0x105a9b['query'][_0x0c3a('0x49')]('nolimit')){_0x1d06d9[_0x0c3a('0x4a')]=qs[_0x0c3a('0x4a')](_0x105a9b[_0x0c3a('0x43')][_0x0c3a('0x4a')]);_0x1d06d9['offset']=qs[_0x0c3a('0x30')](_0x105a9b['query'][_0x0c3a('0x30')]);}_0x1d06d9[_0x0c3a('0x4b')]=qs[_0x0c3a('0x4c')](_0x105a9b[_0x0c3a('0x43')][_0x0c3a('0x4c')]);_0x1d06d9[_0x0c3a('0x4d')]=qs['filters'](_[_0x0c3a('0x4e')](_0x105a9b['query'],_0x759944[_0x0c3a('0x44')]),_0x1af0a7);if(_0x105a9b[_0x0c3a('0x43')]['filter']){_0x1d06d9[_0x0c3a('0x4d')]=_[_0x0c3a('0x4f')](_0x1d06d9[_0x0c3a('0x4d')],{'$or':_[_0x0c3a('0x3d')](_0x1af0a7,function(_0x1f6dab){if(_0x1f6dab['type']!==_0x0c3a('0x50')){var _0x2d059c={};_0x2d059c[_0x1f6dab['name']]={'$like':'%'+_0x105a9b[_0x0c3a('0x43')][_0x0c3a('0x51')]+'%'};return _0x2d059c;}})});}_0x1d06d9=_[_0x0c3a('0x4f')]({},_0x1d06d9,_0x105a9b[_0x0c3a('0x52')]);var _0x2520e1={'where':_0x1d06d9[_0x0c3a('0x4d')]};return db[_0x0c3a('0x53')][_0x0c3a('0x2f')](_0x2520e1)[_0x0c3a('0x21')](function(_0x5abea2){_0x3a9d27[_0x0c3a('0x2f')]=_0x5abea2;if(_0x105a9b['query'][_0x0c3a('0x54')]){_0x1d06d9['include']=[{'all':!![]}];}return db['ChatQueue'][_0x0c3a('0x55')](_0x1d06d9);})[_0x0c3a('0x21')](function(_0x3730d4){_0x3a9d27[_0x0c3a('0x56')]=_0x3730d4;return _0x3a9d27;})[_0x0c3a('0x21')](respondWithFilteredResult(_0x52546a,_0x1d06d9))[_0x0c3a('0x2a')](handleError(_0x52546a,null));};exports[_0x0c3a('0x57')]=function(_0x3610b2,_0x537c25){var _0x14789a={'raw':!![],'where':{'id':_0x3610b2[_0x0c3a('0x58')]['id']}},_0x38f3b6={};_0x38f3b6[_0x0c3a('0x42')]=_['keys'](db[_0x0c3a('0x53')][_0x0c3a('0x3e')]);_0x38f3b6[_0x0c3a('0x43')]=_['keys'](_0x3610b2[_0x0c3a('0x43')]);_0x38f3b6['filters']=_[_0x0c3a('0x45')](_0x38f3b6[_0x0c3a('0x42')],_0x38f3b6[_0x0c3a('0x43')]);_0x14789a[_0x0c3a('0x46')]=_[_0x0c3a('0x45')](_0x38f3b6[_0x0c3a('0x42')],qs[_0x0c3a('0x47')](_0x3610b2[_0x0c3a('0x43')][_0x0c3a('0x47')]));_0x14789a[_0x0c3a('0x46')]=_0x14789a['attributes']['length']?_0x14789a['attributes']:_0x38f3b6['model'];if(_0x3610b2[_0x0c3a('0x43')]['includeAll']){_0x14789a['include']=[{'all':!![]}];}_0x14789a=_[_0x0c3a('0x4f')]({},_0x14789a,_0x3610b2[_0x0c3a('0x52')]);return db['ChatQueue']['find'](_0x14789a)[_0x0c3a('0x21')](handleEntityNotFound(_0x537c25,null))[_0x0c3a('0x21')](respondWithResult(_0x537c25,null))[_0x0c3a('0x2a')](handleError(_0x537c25,null));};exports['create']=function(_0x304218,_0x5a08e3){return db[_0x0c3a('0x53')]['create'](_0x304218['body'],{})[_0x0c3a('0x21')](function(_0x3bc9eb){var _0x4db672=_0x304218[_0x0c3a('0x59')]['get']({'plain':!![]});if(!_0x4db672)throw new Error(_0x0c3a('0x5a'));if(_0x4db672['role']===_0x0c3a('0x59')){var _0x274ee2=_0x3bc9eb['get']({'plain':!![]});var _0x8a5e49=_0x0c3a('0x5b');return db[_0x0c3a('0x5c')][_0x0c3a('0x5d')]({'where':{'name':_0x8a5e49,'userProfileId':_0x4db672['userProfileId']},'raw':!![]})[_0x0c3a('0x21')](function(_0x2abb29){if(_0x2abb29&&_0x2abb29[_0x0c3a('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x274ee2[_0x0c3a('0x3a')],'resourceId':_0x274ee2['id'],'type':_0x2abb29[_0x0c3a('0x3a')],'sectionId':_0x2abb29['id']},{})['then'](function(){return _0x3bc9eb;});}else{return _0x3bc9eb;}})[_0x0c3a('0x2a')](function(_0x42e3a3){logger[_0x0c3a('0x27')](_0x0c3a('0x5f'),_0x42e3a3);throw _0x42e3a3;});}return _0x3bc9eb;})[_0x0c3a('0x21')](respondWithResult(_0x5a08e3,0xc9))[_0x0c3a('0x2a')](handleError(_0x5a08e3,null));};exports[_0x0c3a('0x35')]=function(_0x4dd3f7,_0x4e31bd){if(_0x4dd3f7[_0x0c3a('0x60')]['id']){delete _0x4dd3f7[_0x0c3a('0x60')]['id'];}return db['ChatQueue'][_0x0c3a('0x5d')]({'where':{'id':_0x4dd3f7[_0x0c3a('0x58')]['id']}})[_0x0c3a('0x21')](handleEntityNotFound(_0x4e31bd,null))['then'](saveUpdates(_0x4dd3f7[_0x0c3a('0x60')],null))['then'](respondWithResult(_0x4e31bd,null))[_0x0c3a('0x2a')](handleError(_0x4e31bd,null));};exports[_0x0c3a('0x61')]=function(_0x1bcba3,_0x1b0013){return db['ChatQueue'][_0x0c3a('0x5d')]({'where':{'id':_0x1bcba3[_0x0c3a('0x58')]['id']}})[_0x0c3a('0x21')](handleEntityNotFound(_0x1b0013,null))['then'](removeEntity(_0x1b0013,null))[_0x0c3a('0x2a')](handleError(_0x1b0013,null));};exports[_0x0c3a('0x62')]=function(_0x4ba4f3,_0x571cbe){return db[_0x0c3a('0x53')][_0x0c3a('0x62')]()[_0x0c3a('0x21')](respondWithResult(_0x571cbe,null))[_0x0c3a('0x2a')](handleError(_0x571cbe,null));};exports[_0x0c3a('0x63')]=function(_0x200227,_0x1dd4aa,_0x2f1cd4){var _0x52612b={'raw':!![],'where':{}},_0x288992={},_0xc3d422;return db[_0x0c3a('0x53')]['findOne']({'where':{'id':_0x200227[_0x0c3a('0x58')]['id']}})[_0x0c3a('0x21')](handleEntityNotFound(_0x1dd4aa,null))['then'](function(_0x17d7e1){if(_0x17d7e1){_0xc3d422=_0x17d7e1['get']({'plain':!![]});_0x288992[_0x0c3a('0x42')]=_[_0x0c3a('0x64')](db[_0x0c3a('0x65')][_0x0c3a('0x3e')]);_0x288992[_0x0c3a('0x43')]=_[_0x0c3a('0x64')](_0x200227['query']);_0x288992[_0x0c3a('0x44')]=_[_0x0c3a('0x45')](_0x288992[_0x0c3a('0x42')],_0x288992[_0x0c3a('0x43')]);_0x52612b[_0x0c3a('0x46')]=_[_0x0c3a('0x45')](_0x288992[_0x0c3a('0x42')],qs['fields'](_0x200227[_0x0c3a('0x43')][_0x0c3a('0x47')]));_0x52612b[_0x0c3a('0x46')]=_0x52612b['attributes'][_0x0c3a('0x48')]?_0x52612b[_0x0c3a('0x46')]:_0x288992['model'];if(!_0x200227[_0x0c3a('0x43')][_0x0c3a('0x49')](_0x0c3a('0x66'))){_0x52612b['limit']=qs[_0x0c3a('0x4a')](_0x200227[_0x0c3a('0x43')][_0x0c3a('0x4a')]);_0x52612b['offset']=qs[_0x0c3a('0x30')](_0x200227['query'][_0x0c3a('0x30')]);}_0x52612b[_0x0c3a('0x4b')]=qs['sort'](_0x200227['query']['sort']);_0x52612b['where']=qs[_0x0c3a('0x44')](_[_0x0c3a('0x4e')](_0x200227[_0x0c3a('0x43')],_0x288992['filters']));_0x52612b[_0x0c3a('0x4d')][_0x0c3a('0x67')]=_0x17d7e1['id'];if(_0x200227['query'][_0x0c3a('0x51')]){_0x52612b[_0x0c3a('0x4d')]=_[_0x0c3a('0x4f')](_0x52612b[_0x0c3a('0x4d')],{'$or':_['map'](_0x52612b[_0x0c3a('0x46')],function(_0x133389){var _0x5d01b3={};_0x5d01b3[_0x133389]={'$like':'%'+_0x200227[_0x0c3a('0x43')]['filter']+'%'};return _0x5d01b3;})});}_0x52612b=_[_0x0c3a('0x4f')]({},_0x52612b,_0x200227[_0x0c3a('0x52')]);return db['UserChatQueue'][_0x0c3a('0x55')](_0x52612b);}})['then'](function(_0x50a765){if(_0x50a765){return db[_0x0c3a('0x68')]['findAndCountAll']({'where':{'id':_[_0x0c3a('0x3d')](_0x50a765,'UserId'),'role':_0x0c3a('0x69')},'attributes':['id','name','chatPause',_0x0c3a('0x6a'),_0x0c3a('0x6b')]});}})['then'](function(_0x61a39c){if(_0x61a39c){return{'count':_0x61a39c[_0x0c3a('0x2f')],'rows':_[_0x0c3a('0x3d')](_0x61a39c['rows'],function(_0x3902a0){return{'membername':_0x3902a0[_0x0c3a('0x3a')],'UserId':_0x3902a0['id'],'queue_name':_0xc3d422[_0x0c3a('0x3a')],'ChatQueueId':_0xc3d422['id'],'interface':util['format'](_0x0c3a('0x6c'),'SIP',_0x3902a0[_0x0c3a('0x3a')]),'penalty':0x0,'paused':_0x3902a0[_0x0c3a('0x6d')],'createdAt':_0x3902a0[_0x0c3a('0x6b')],'updatedAt':_0x3902a0[_0x0c3a('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0c3a('0x21')](respondWithFilteredResult(_0x1dd4aa,_0x52612b))['catch'](handleError(_0x1dd4aa,null));};exports[_0x0c3a('0x6e')]=function(_0x299dd1,_0x663aa7,_0x33bdbe){var _0xd030d6={};var _0x20f0ee={};var _0x20a061;var _0x54ff79;return db[_0x0c3a('0x53')][_0x0c3a('0x6f')]({'where':{'id':_0x299dd1[_0x0c3a('0x58')]['id']}})[_0x0c3a('0x21')](handleEntityNotFound(_0x663aa7,null))[_0x0c3a('0x21')](function(_0x51bd40){if(_0x51bd40){_0x20a061=_0x51bd40;_0x20f0ee[_0x0c3a('0x42')]=_[_0x0c3a('0x64')](db[_0x0c3a('0x70')][_0x0c3a('0x3e')]);_0x20f0ee['query']=_['keys'](_0x299dd1[_0x0c3a('0x43')]);_0x20f0ee[_0x0c3a('0x44')]=_[_0x0c3a('0x45')](_0x20f0ee[_0x0c3a('0x42')],_0x20f0ee[_0x0c3a('0x43')]);_0xd030d6[_0x0c3a('0x46')]=_['intersection'](_0x20f0ee['model'],qs['fields'](_0x299dd1[_0x0c3a('0x43')][_0x0c3a('0x47')]));_0xd030d6['attributes']=_0xd030d6[_0x0c3a('0x46')][_0x0c3a('0x48')]?_0xd030d6[_0x0c3a('0x46')]:_0x20f0ee[_0x0c3a('0x42')];_0xd030d6[_0x0c3a('0x4b')]=qs[_0x0c3a('0x4c')](_0x299dd1['query']['sort']);_0xd030d6[_0x0c3a('0x4d')]=qs[_0x0c3a('0x44')](_[_0x0c3a('0x4e')](_0x299dd1[_0x0c3a('0x43')],_0x20f0ee[_0x0c3a('0x44')]));if(_0x299dd1['query'][_0x0c3a('0x51')]){_0xd030d6[_0x0c3a('0x4d')]=_[_0x0c3a('0x4f')](_0xd030d6['where'],{'$or':_['map'](_0xd030d6[_0x0c3a('0x46')],function(_0x37a052){var _0x126743={};_0x126743[_0x37a052]={'$like':'%'+_0x299dd1[_0x0c3a('0x43')]['filter']+'%'};return _0x126743;})});}_0xd030d6=_['merge']({},_0xd030d6,_0x299dd1[_0x0c3a('0x52')]);return _0x20a061[_0x0c3a('0x6e')](_0xd030d6);}})[_0x0c3a('0x21')](function(_0x340214){if(_0x340214){_0x54ff79=_0x340214[_0x0c3a('0x48')];if(!_0x299dd1[_0x0c3a('0x43')]['hasOwnProperty'](_0x0c3a('0x66'))){_0xd030d6[_0x0c3a('0x4a')]=qs[_0x0c3a('0x4a')](_0x299dd1[_0x0c3a('0x43')][_0x0c3a('0x4a')]);_0xd030d6[_0x0c3a('0x30')]=qs[_0x0c3a('0x30')](_0x299dd1[_0x0c3a('0x43')][_0x0c3a('0x30')]);}return _0x20a061[_0x0c3a('0x6e')](_0xd030d6);}})[_0x0c3a('0x21')](function(_0x4b73a9){if(_0x4b73a9){return _0x4b73a9?{'count':_0x54ff79,'rows':_0x4b73a9}:null;}})['then'](respondWithResult(_0x663aa7,null))[_0x0c3a('0x2a')](handleError(_0x663aa7,null));};exports[_0x0c3a('0x71')]=function(_0x1f8b40,_0x54b211,_0x5bbed3){var _0x2376d7=_0x1f8b40[_0x0c3a('0x60')][_0x0c3a('0x72')];return db[_0x0c3a('0x70')]['findAll']({'where':{'id':_0x2376d7},'attributes':['id'],'include':[{'model':db[_0x0c3a('0x68')],'as':_0x0c3a('0x73'),'attributes':['id','name',_0x0c3a('0x74'),_0x0c3a('0x75'),'interface'],'raw':!![]}]})[_0x0c3a('0x21')](function(_0xf3860c){if(_0xf3860c){var _0x14edd5=_[_0x0c3a('0x76')](_0xf3860c,function(_0x37ee18){var _0x4f6a72=_0x37ee18[_0x0c3a('0x36')]({'plain':!![]});return _0x4f6a72[_0x0c3a('0x73')];});return db[_0x0c3a('0x53')][_0x0c3a('0x5d')]({'where':{'id':_0x1f8b40[_0x0c3a('0x58')]['id']}})[_0x0c3a('0x21')](function(_0x3668f1){return db[_0x0c3a('0x77')][_0x0c3a('0x78')](function(_0x581dfc){return _0x3668f1[_0x0c3a('0x71')](_0x2376d7,{'transaction':_0x581dfc})[_0x0c3a('0x21')](function(){return BPromise['each'](_0x14edd5,function(_0x1cd980){return db[_0x0c3a('0x65')]['findOrCreate']({'where':{'UserId':_0x1cd980['id'],'ChatQueueId':_0x1f8b40[_0x0c3a('0x58')]['id']},'transaction':_0x581dfc});});})['then'](function(){_0x14edd5[_0x0c3a('0x79')](function(_0x3e18fe){socket['emit'](_0x0c3a('0x7a'),{'UserId':_0x3e18fe['id'],'ChatQueueId':_0x3668f1['id']});});});});});}})[_0x0c3a('0x21')](respondWithStatusCode(_0x54b211,null))['catch'](handleError(_0x54b211,null));};exports[_0x0c3a('0x7b')]=function(_0x1d5f9d,_0x227dcb,_0x24b57e){return db[_0x0c3a('0x70')][_0x0c3a('0x55')]({'where':{'id':_0x1d5f9d[_0x0c3a('0x43')][_0x0c3a('0x72')]},'attributes':['id'],'include':[{'model':db[_0x0c3a('0x68')],'as':_0x0c3a('0x73'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x227dcb,null))[_0x0c3a('0x21')](function(_0x53889e){var _0x21044d=_['map'](_0x53889e,'id');var _0x33061f=[];var _0x4f6720=[];var _0xb2bb9f=squel[_0x0c3a('0x7c')]();_0xb2bb9f[_0x0c3a('0x7d')](_0x0c3a('0x7e'))[_0x0c3a('0x7f')](_0x0c3a('0x80'),'tq')[_0x0c3a('0x81')](_0x0c3a('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0c3a('0x4d')]('ChatQueueId\x20=\x20?',_0x1d5f9d['params']['id']);for(var _0x14eb0d=0x0;_0x14eb0d<_0x53889e['length'];_0x14eb0d+=0x1){let _0x4bfc75=_0x53889e[_0x14eb0d];for(var _0xf2f47d=0x0;_0xf2f47d<_0x4bfc75[_0x0c3a('0x73')][_0x0c3a('0x48')];_0xf2f47d+=0x1){let _0x1b0320=_0x4bfc75[_0x0c3a('0x73')][_0xf2f47d];var _0x4d4673=_0xb2bb9f['clone']();_0x4d4673[_0x0c3a('0x4d')](_0x0c3a('0x83'),_0x1b0320['id']);_0x4f6720[_0x0c3a('0x84')](db[_0x0c3a('0x77')]['query'](_0x4d4673[_0x0c3a('0x85')](),{'type':db[_0x0c3a('0x77')]['QueryTypes'][_0x0c3a('0x86')]})[_0x0c3a('0x21')](function(_0x441b48){if(_0x441b48[_0x0c3a('0x48')]===0x1){return _0x1b0320['id'];}else{var _0xd6e526=_['every'](_[_0x0c3a('0x3d')](_0x441b48,_0x0c3a('0x87')),function(_0x4b60f1){return _[_0x0c3a('0x88')](_0x21044d,_0x4b60f1);});if(_0xd6e526){return _0x1b0320['id'];}}}));}}return BPromise[_0x0c3a('0x89')](_0x4f6720)[_0x0c3a('0x21')](function(_0x57d68f){_0x33061f=_(_0x33061f)[_0x0c3a('0x8a')](_0x57d68f)[_0x0c3a('0x8b')]()[_0x0c3a('0x8c')]();return db[_0x0c3a('0x53')][_0x0c3a('0x5d')]({'where':{'id':_0x1d5f9d[_0x0c3a('0x58')]['id']}})[_0x0c3a('0x21')](function(_0x224f24){return db[_0x0c3a('0x77')][_0x0c3a('0x78')](function(_0x4b6ce3){return _0x224f24['removeTeams'](_0x1d5f9d[_0x0c3a('0x43')]['ids'],{'transaction':_0x4b6ce3})[_0x0c3a('0x21')](function(){if(!_[_0x0c3a('0x8d')](_0x33061f)){return _0x224f24[_0x0c3a('0x8e')](_0x33061f,{'transaction':_0x4b6ce3});}})[_0x0c3a('0x21')](function(){_0x33061f[_0x0c3a('0x79')](function(_0x3144c1){socket['emit']('userChatQueue:remove',{'UserId':_0x3144c1,'ChatQueueId':_0x224f24['id']});});});});});});})[_0x0c3a('0x21')](respondWithStatusCode(_0x227dcb,null))['catch'](handleError(_0x227dcb,null));};exports[_0x0c3a('0x8f')]=function(_0x308ea3,_0x44429c,_0x12c609){return db[_0x0c3a('0x53')][_0x0c3a('0x5d')]({'where':{'id':_0x308ea3[_0x0c3a('0x58')]['id']}})[_0x0c3a('0x21')](handleEntityNotFound(_0x44429c,null))['then'](function(_0x4f4395){if(_0x4f4395){return _0x4f4395[_0x0c3a('0x8f')](_0x308ea3[_0x0c3a('0x60')][_0x0c3a('0x72')],_[_0x0c3a('0x90')](_0x308ea3[_0x0c3a('0x60')],[_0x0c3a('0x72'),'id'])||{})['spread'](function(_0x127fa1){for(var _0x3c414c=0x0;_0x3c414c<_0x308ea3[_0x0c3a('0x60')][_0x0c3a('0x72')][_0x0c3a('0x48')];_0x3c414c+=0x1){socket[_0x0c3a('0x91')](_0x0c3a('0x7a'),{'UserId':Number(_0x308ea3[_0x0c3a('0x60')][_0x0c3a('0x72')][_0x3c414c]),'ChatQueueId':Number(_0x308ea3[_0x0c3a('0x58')]['id'])});}return _0x127fa1;});}})[_0x0c3a('0x21')](respondWithResult(_0x44429c,null))[_0x0c3a('0x2a')](handleError(_0x44429c,null));};exports[_0x0c3a('0x8e')]=function(_0xd94f7a,_0x4c6c60,_0x34c4e6){return db[_0x0c3a('0x53')][_0x0c3a('0x5d')]({'where':{'id':_0xd94f7a[_0x0c3a('0x58')]['id']}})['then'](handleEntityNotFound(_0x4c6c60,null))[_0x0c3a('0x21')](function(_0x3229d4){if(_0x3229d4){return _0x3229d4[_0x0c3a('0x8e')](_0xd94f7a[_0x0c3a('0x43')][_0x0c3a('0x72')])[_0x0c3a('0x21')](function(){if(_[_0x0c3a('0x92')](_0xd94f7a[_0x0c3a('0x43')][_0x0c3a('0x72')])){for(var _0x154c2d=0x0;_0x154c2d<_0xd94f7a['query']['ids'][_0x0c3a('0x48')];_0x154c2d+=0x1){socket[_0x0c3a('0x91')](_0x0c3a('0x93'),{'UserId':Number(_0xd94f7a[_0x0c3a('0x43')][_0x0c3a('0x72')][_0x154c2d]),'ChatQueueId':Number(_0xd94f7a[_0x0c3a('0x58')]['id'])});}}else{socket['emit'](_0x0c3a('0x93'),{'UserId':Number(_0xd94f7a[_0x0c3a('0x43')][_0x0c3a('0x72')]),'ChatQueueId':Number(_0xd94f7a[_0x0c3a('0x58')]['id'])});}});}})[_0x0c3a('0x21')](respondWithStatusCode(_0x4c6c60,null))[_0x0c3a('0x2a')](handleError(_0x4c6c60,null));};exports[_0x0c3a('0x94')]=function(_0x49a745,_0x12bd51,_0x4e6c5b){var _0x310bcc={};var _0x13e93c={};var _0x44a985;var _0x40cbea;return db[_0x0c3a('0x53')][_0x0c3a('0x6f')]({'where':{'id':_0x49a745[_0x0c3a('0x58')]['id']}})[_0x0c3a('0x21')](handleEntityNotFound(_0x12bd51,null))['then'](function(_0x25d628){if(_0x25d628){_0x44a985=_0x25d628;_0x13e93c[_0x0c3a('0x42')]=_['keys'](db[_0x0c3a('0x68')][_0x0c3a('0x3e')]);_0x13e93c[_0x0c3a('0x43')]=_['keys'](_0x49a745[_0x0c3a('0x43')]);_0x13e93c['filters']=_[_0x0c3a('0x45')](_0x13e93c[_0x0c3a('0x42')],_0x13e93c[_0x0c3a('0x43')]);_0x310bcc['attributes']=_[_0x0c3a('0x45')](_0x13e93c['model'],qs[_0x0c3a('0x47')](_0x49a745[_0x0c3a('0x43')][_0x0c3a('0x47')]));_0x310bcc[_0x0c3a('0x46')]=_0x310bcc[_0x0c3a('0x46')]['length']?_0x310bcc[_0x0c3a('0x46')]:_0x13e93c[_0x0c3a('0x42')];_0x310bcc['order']=qs['sort'](_0x49a745[_0x0c3a('0x43')][_0x0c3a('0x4c')]);_0x310bcc[_0x0c3a('0x4d')]=qs[_0x0c3a('0x44')](_[_0x0c3a('0x4e')](_0x49a745[_0x0c3a('0x43')],_0x13e93c['filters']));if(_0x49a745[_0x0c3a('0x43')][_0x0c3a('0x51')]){_0x310bcc[_0x0c3a('0x4d')]=_[_0x0c3a('0x4f')](_0x310bcc['where'],{'$or':_[_0x0c3a('0x3d')](_0x310bcc[_0x0c3a('0x46')],function(_0x5a15a1){var _0x46d35b={};_0x46d35b[_0x5a15a1]={'$like':'%'+_0x49a745[_0x0c3a('0x43')][_0x0c3a('0x51')]+'%'};return _0x46d35b;})});}_0x310bcc=_['merge']({},_0x310bcc,_0x49a745['options']);return _0x44a985[_0x0c3a('0x94')](_0x310bcc);}})[_0x0c3a('0x21')](function(_0x2c2f79){if(_0x2c2f79){_0x40cbea=_0x2c2f79[_0x0c3a('0x48')];if(!_0x49a745[_0x0c3a('0x43')][_0x0c3a('0x49')](_0x0c3a('0x66'))){_0x310bcc[_0x0c3a('0x4a')]=qs[_0x0c3a('0x4a')](_0x49a745[_0x0c3a('0x43')]['limit']);_0x310bcc[_0x0c3a('0x30')]=qs['offset'](_0x49a745[_0x0c3a('0x43')][_0x0c3a('0x30')]);}return _0x44a985[_0x0c3a('0x94')](_0x310bcc);}})[_0x0c3a('0x21')](function(_0x3329a3){if(_0x3329a3){return _0x3329a3?{'count':_0x40cbea,'rows':_0x3329a3}:null;}})[_0x0c3a('0x21')](respondWithResult(_0x12bd51,null))[_0x0c3a('0x2a')](handleError(_0x12bd51,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 2d758f2..9f00fb2 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 _0x11d2=['hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x230175,_0x5a793c){var _0x1bfc61=function(_0x14c4bc){while(--_0x14c4bc){_0x230175['push'](_0x230175['shift']());}};_0x1bfc61(++_0x5a793c);}(_0x11d2,0x1c4));var _0x211d=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x11d2[_0x58e469];return _0x4c01c5;};'use strict';var EventEmitter=require(_0x211d('0x0'));var ChatQueue=require(_0x211d('0x1'))['db'][_0x211d('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x211d('0x3')](0x0);var events={'afterCreate':_0x211d('0x4'),'afterUpdate':_0x211d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x17b226){return function(_0x3dc88b,_0x33534e,_0x593482){ChatQueueEvents['emit'](_0x17b226+':'+_0x3dc88b['id'],_0x3dc88b);ChatQueueEvents[_0x211d('0x6')](_0x17b226,_0x3dc88b);_0x593482(null);};}for(var e in events){if(events[_0x211d('0x7')](e)){var event=events[e];ChatQueue[_0x211d('0x8')](e,emitEvent(event));}}module[_0x211d('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x5455=['hook','exports','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit'];(function(_0x3315c9,_0x28e2b5){var _0x1e7e6c=function(_0x46a067){while(--_0x46a067){_0x3315c9['push'](_0x3315c9['shift']());}};_0x1e7e6c(++_0x28e2b5);}(_0x5455,0x197));var _0x5545=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5455[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x5545('0x0'))['db'][_0x5545('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5545('0x2')](0x0);var events={'afterCreate':_0x5545('0x3'),'afterUpdate':_0x5545('0x4'),'afterDestroy':_0x5545('0x5')};function emitEvent(_0x39db57){return function(_0x4cd466,_0x48fce5,_0xc4bdd5){ChatQueueEvents[_0x5545('0x6')](_0x39db57+':'+_0x4cd466['id'],_0x4cd466);ChatQueueEvents['emit'](_0x39db57,_0x4cd466);_0xc4bdd5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x5545('0x7')](e,emitEvent(event));}}module[_0x5545('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 8b683fb..249c1fb 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 _0xdc9e=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util'];(function(_0x12dba2,_0x5437ec){var _0x2e565d=function(_0x2dfc72){while(--_0x2dfc72){_0x12dba2['push'](_0x12dba2['shift']());}};_0x2e565d(++_0x5437ec);}(_0xdc9e,0x185));var _0xedc9=function(_0xb90510,_0x3012e5){_0xb90510=_0xb90510-0x0;var _0xd0d64b=_0xdc9e[_0xb90510];return _0xd0d64b;};'use strict';var _=require('lodash');var util=require(_0xedc9('0x0'));var logger=require(_0xedc9('0x1'))(_0xedc9('0x2'));var moment=require('moment');var BPromise=require(_0xedc9('0x3'));var rp=require(_0xedc9('0x4'));var fs=require('fs');var path=require(_0xedc9('0x5'));var rimraf=require(_0xedc9('0x6'));var config=require(_0xedc9('0x7'));var attributes=require(_0xedc9('0x8'));module[_0xedc9('0x9')]=function(_0x1f307f,_0x140911){return _0x1f307f[_0xedc9('0xa')](_0xedc9('0xb'),attributes,{'tableName':_0xedc9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ead=['ChatQueue','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0x7ead,0x181));var _0xd7ea=function(_0x3e850d,_0x2b5931){_0x3e850d=_0x3e850d-0x0;var _0x59a5d4=_0x7ead[_0x3e850d];return _0x59a5d4;};'use strict';var _=require(_0xd7ea('0x0'));var util=require(_0xd7ea('0x1'));var logger=require(_0xd7ea('0x2'))(_0xd7ea('0x3'));var moment=require('moment');var BPromise=require(_0xd7ea('0x4'));var rp=require(_0xd7ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd7ea('0x6'));var config=require(_0xd7ea('0x7'));var attributes=require(_0xd7ea('0x8'));module[_0xd7ea('0x9')]=function(_0xeda1a2,_0x30926f){return _0xeda1a2[_0xd7ea('0xa')](_0xd7ea('0xb'),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 1df737a..9b8a099 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 _0xdc15=['model','map','then','stringify','ShowChatQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x3cf438,_0xbf8b42){var _0x4e972b=function(_0x61c3ec){while(--_0x61c3ec){_0x3cf438['push'](_0x3cf438['shift']());}};_0x4e972b(++_0xbf8b42);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0xdc15[_0x170772];return _0x3ef69c;};'use strict';var _=require(_0x5dc1('0x0'));var util=require('util');var moment=require(_0x5dc1('0x1'));var BPromise=require(_0x5dc1('0x2'));var rs=require(_0x5dc1('0x3'));var fs=require('fs');var Redis=require(_0x5dc1('0x4'));var db=require(_0x5dc1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5dc1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5dc1('0x7')]({'port':0x232a});config[_0x5dc1('0x8')]=_[_0x5dc1('0x9')](config[_0x5dc1('0x8')],{'host':_0x5dc1('0xa'),'port':0x18eb});var socket=require(_0x5dc1('0xb'))(new Redis(config[_0x5dc1('0x8')]));require(_0x5dc1('0xc'))[_0x5dc1('0xd')](socket);function respondWithRpcPromise(_0x45802d,_0x1241ff,_0x5254f5){return new BPromise(function(_0x5cbb50,_0x181c35){return client[_0x5dc1('0xe')](_0x45802d,_0x5254f5)['then'](function(_0x2f1526){logger[_0x5dc1('0xf')](_0x5dc1('0x10'),_0x1241ff,_0x5dc1('0x11'));logger[_0x5dc1('0x12')](_0x5dc1('0x13'),_0x1241ff,_0x5dc1('0x11'),JSON['stringify'](_0x2f1526));if(_0x2f1526[_0x5dc1('0x14')]){if(_0x2f1526[_0x5dc1('0x14')]['code']===0x1f4){logger[_0x5dc1('0x14')](_0x5dc1('0x10'),_0x1241ff,_0x2f1526['error'][_0x5dc1('0x15')]);return _0x181c35(_0x2f1526[_0x5dc1('0x14')][_0x5dc1('0x15')]);}logger['error'](_0x5dc1('0x10'),_0x1241ff,_0x2f1526['error']['message']);return _0x5cbb50(_0x2f1526[_0x5dc1('0x14')][_0x5dc1('0x15')]);}else{logger[_0x5dc1('0xf')]('ChatQueue,\x20%s,\x20%s',_0x1241ff,_0x5dc1('0x11'));_0x5cbb50(_0x2f1526[_0x5dc1('0x16')][_0x5dc1('0x15')]);}})[_0x5dc1('0x17')](function(_0x13fd5a){logger[_0x5dc1('0x14')](_0x5dc1('0x10'),_0x1241ff,_0x13fd5a);_0x181c35(_0x13fd5a);});});}exports[_0x5dc1('0x18')]=function(_0x52a1e2){var _0x3d6a6e=this;return new Promise(function(_0xdcd30f,_0x41ae80){return db[_0x5dc1('0x19')][_0x5dc1('0x1a')]({'raw':_0x52a1e2[_0x5dc1('0x1b')]?_0x52a1e2['options'][_0x5dc1('0x1c')]===undefined?!![]:![]:!![],'where':_0x52a1e2[_0x5dc1('0x1b')]?_0x52a1e2[_0x5dc1('0x1b')][_0x5dc1('0x1d')]||null:null,'attributes':_0x52a1e2[_0x5dc1('0x1b')]?_0x52a1e2[_0x5dc1('0x1b')][_0x5dc1('0x1e')]||null:null,'limit':_0x52a1e2[_0x5dc1('0x1b')]?_0x52a1e2[_0x5dc1('0x1b')][_0x5dc1('0x1f')]||null:null,'include':_0x52a1e2[_0x5dc1('0x1b')]?_0x52a1e2[_0x5dc1('0x1b')][_0x5dc1('0x20')]?_['map'](_0x52a1e2[_0x5dc1('0x1b')][_0x5dc1('0x20')],function(_0x531c00){return{'model':db[_0x531c00[_0x5dc1('0x21')]],'as':_0x531c00['as'],'attributes':_0x531c00[_0x5dc1('0x1e')],'include':_0x531c00[_0x5dc1('0x20')]?_[_0x5dc1('0x22')](_0x531c00[_0x5dc1('0x20')],function(_0x191668){return{'model':db[_0x191668[_0x5dc1('0x21')]],'as':_0x191668['as'],'attributes':_0x191668[_0x5dc1('0x1e')],'include':_0x191668[_0x5dc1('0x20')]?_[_0x5dc1('0x22')](_0x191668[_0x5dc1('0x20')],function(_0xddba38){return{'model':db[_0xddba38[_0x5dc1('0x21')]],'as':_0xddba38['as'],'attributes':_0xddba38[_0x5dc1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5dc1('0x23')](function(_0x308812){logger[_0x5dc1('0xf')](_0x5dc1('0x18'),_0x52a1e2);logger[_0x5dc1('0x12')]('GetChatQueue',_0x52a1e2,JSON[_0x5dc1('0x24')](_0x308812));_0xdcd30f(_0x308812);})[_0x5dc1('0x17')](function(_0x1331de){logger[_0x5dc1('0x14')](_0x5dc1('0x18'),_0x1331de['message'],_0x52a1e2);_0x41ae80(_0x3d6a6e[_0x5dc1('0x14')](0x1f4,_0x1331de['message']));});});};exports['ShowChatQueue']=function(_0x24ea38){var _0x3d442f=this;return new Promise(function(_0x444258,_0x2ec6fe){return db[_0x5dc1('0x19')]['find']({'raw':_0x24ea38[_0x5dc1('0x1b')]?_0x24ea38[_0x5dc1('0x1b')][_0x5dc1('0x1c')]===undefined?!![]:![]:!![],'where':_0x24ea38[_0x5dc1('0x1b')]?_0x24ea38[_0x5dc1('0x1b')][_0x5dc1('0x1d')]||null:null,'attributes':_0x24ea38['options']?_0x24ea38[_0x5dc1('0x1b')][_0x5dc1('0x1e')]||null:null,'include':_0x24ea38[_0x5dc1('0x1b')]?_0x24ea38[_0x5dc1('0x1b')][_0x5dc1('0x20')]?_[_0x5dc1('0x22')](_0x24ea38[_0x5dc1('0x1b')][_0x5dc1('0x20')],function(_0x36417e){return{'model':db[_0x36417e[_0x5dc1('0x21')]],'as':_0x36417e['as'],'attributes':_0x36417e[_0x5dc1('0x1e')],'include':_0x36417e[_0x5dc1('0x20')]?_['map'](_0x36417e[_0x5dc1('0x20')],function(_0x7d5bed){return{'model':db[_0x7d5bed[_0x5dc1('0x21')]],'as':_0x7d5bed['as'],'attributes':_0x7d5bed[_0x5dc1('0x1e')],'include':_0x7d5bed['include']?_[_0x5dc1('0x22')](_0x7d5bed[_0x5dc1('0x20')],function(_0x140653){return{'model':db[_0x140653[_0x5dc1('0x21')]],'as':_0x140653['as'],'attributes':_0x140653[_0x5dc1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5dc1('0x23')](function(_0x195926){logger[_0x5dc1('0xf')](_0x5dc1('0x25'),_0x24ea38);logger[_0x5dc1('0x12')](_0x5dc1('0x25'),_0x24ea38,JSON[_0x5dc1('0x24')](_0x195926));_0x444258(_0x195926);})[_0x5dc1('0x17')](function(_0xddab6a){logger['error'](_0x5dc1('0x25'),_0xddab6a[_0x5dc1('0x15')],_0x24ea38);_0x2ec6fe(_0x3d442f[_0x5dc1('0x14')](0x1f4,_0xddab6a[_0x5dc1('0x15')]));});});}; \ No newline at end of file +var _0x3a20=['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','result','catch','ChatQueue','options','raw','attributes','limit','include','model','map','GetChatQueue','debug','message','ShowChatQueue','find','where','util','bluebird','ioredis','rpc','jayson/promise','client','redis','localhost'];(function(_0x30fddd,_0x16fe5f){var _0x3005e3=function(_0x5028bb){while(--_0x5028bb){_0x30fddd['push'](_0x30fddd['shift']());}};_0x3005e3(++_0x16fe5f);}(_0x3a20,0xd0));var _0x03a2=function(_0x5a9fab,_0x512f96){_0x5a9fab=_0x5a9fab-0x0;var _0xd653b1=_0x3a20[_0x5a9fab];return _0xd653b1;};'use strict';var _=require('lodash');var util=require(_0x03a2('0x0'));var moment=require('moment');var BPromise=require(_0x03a2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03a2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x03a2('0x3'));var config=require('../../config/environment');var jayson=require(_0x03a2('0x4'));var client=jayson[_0x03a2('0x5')]['http']({'port':0x232a});config[_0x03a2('0x6')]=_['defaults'](config[_0x03a2('0x6')],{'host':_0x03a2('0x7'),'port':0x18eb});var socket=require(_0x03a2('0x8'))(new Redis(config[_0x03a2('0x6')]));require(_0x03a2('0x9'))[_0x03a2('0xa')](socket);function respondWithRpcPromise(_0x27a2e8,_0x23d23a,_0xcc4607){return new BPromise(function(_0x207cee,_0x3c3735){return client[_0x03a2('0xb')](_0x27a2e8,_0xcc4607)[_0x03a2('0xc')](function(_0x53a6a6){logger[_0x03a2('0xd')](_0x03a2('0xe'),_0x23d23a,_0x03a2('0xf'));logger['debug'](_0x03a2('0x10'),_0x23d23a,_0x03a2('0xf'),JSON[_0x03a2('0x11')](_0x53a6a6));if(_0x53a6a6[_0x03a2('0x12')]){if(_0x53a6a6[_0x03a2('0x12')][_0x03a2('0x13')]===0x1f4){logger[_0x03a2('0x12')](_0x03a2('0xe'),_0x23d23a,_0x53a6a6[_0x03a2('0x12')]['message']);return _0x3c3735(_0x53a6a6[_0x03a2('0x12')]['message']);}logger['error'](_0x03a2('0xe'),_0x23d23a,_0x53a6a6['error']['message']);return _0x207cee(_0x53a6a6['error']['message']);}else{logger[_0x03a2('0xd')](_0x03a2('0xe'),_0x23d23a,'request\x20sent');_0x207cee(_0x53a6a6[_0x03a2('0x14')]['message']);}})[_0x03a2('0x15')](function(_0x2cc397){logger['error'](_0x03a2('0xe'),_0x23d23a,_0x2cc397);_0x3c3735(_0x2cc397);});});}exports['GetChatQueue']=function(_0x86adba){var _0x2c9f84=this;return new Promise(function(_0x456896,_0x3dd4a8){return db[_0x03a2('0x16')]['findAll']({'raw':_0x86adba['options']?_0x86adba[_0x03a2('0x17')][_0x03a2('0x18')]===undefined?!![]:![]:!![],'where':_0x86adba['options']?_0x86adba['options']['where']||null:null,'attributes':_0x86adba[_0x03a2('0x17')]?_0x86adba[_0x03a2('0x17')][_0x03a2('0x19')]||null:null,'limit':_0x86adba[_0x03a2('0x17')]?_0x86adba[_0x03a2('0x17')][_0x03a2('0x1a')]||null:null,'include':_0x86adba['options']?_0x86adba[_0x03a2('0x17')][_0x03a2('0x1b')]?_['map'](_0x86adba[_0x03a2('0x17')][_0x03a2('0x1b')],function(_0x45eef2){return{'model':db[_0x45eef2[_0x03a2('0x1c')]],'as':_0x45eef2['as'],'attributes':_0x45eef2[_0x03a2('0x19')],'include':_0x45eef2[_0x03a2('0x1b')]?_[_0x03a2('0x1d')](_0x45eef2[_0x03a2('0x1b')],function(_0x2d895b){return{'model':db[_0x2d895b[_0x03a2('0x1c')]],'as':_0x2d895b['as'],'attributes':_0x2d895b['attributes'],'include':_0x2d895b[_0x03a2('0x1b')]?_['map'](_0x2d895b['include'],function(_0x14ee4b){return{'model':db[_0x14ee4b['model']],'as':_0x14ee4b['as'],'attributes':_0x14ee4b[_0x03a2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x03a2('0xc')](function(_0x4da330){logger[_0x03a2('0xd')](_0x03a2('0x1e'),_0x86adba);logger[_0x03a2('0x1f')]('GetChatQueue',_0x86adba,JSON[_0x03a2('0x11')](_0x4da330));_0x456896(_0x4da330);})[_0x03a2('0x15')](function(_0x526ef7){logger[_0x03a2('0x12')](_0x03a2('0x1e'),_0x526ef7[_0x03a2('0x20')],_0x86adba);_0x3dd4a8(_0x2c9f84[_0x03a2('0x12')](0x1f4,_0x526ef7[_0x03a2('0x20')]));});});};exports[_0x03a2('0x21')]=function(_0x5d7653){var _0x1eeeeb=this;return new Promise(function(_0x355167,_0x579591){return db[_0x03a2('0x16')][_0x03a2('0x22')]({'raw':_0x5d7653[_0x03a2('0x17')]?_0x5d7653[_0x03a2('0x17')][_0x03a2('0x18')]===undefined?!![]:![]:!![],'where':_0x5d7653[_0x03a2('0x17')]?_0x5d7653['options'][_0x03a2('0x23')]||null:null,'attributes':_0x5d7653[_0x03a2('0x17')]?_0x5d7653['options'][_0x03a2('0x19')]||null:null,'include':_0x5d7653[_0x03a2('0x17')]?_0x5d7653[_0x03a2('0x17')][_0x03a2('0x1b')]?_[_0x03a2('0x1d')](_0x5d7653[_0x03a2('0x17')][_0x03a2('0x1b')],function(_0x5a78e7){return{'model':db[_0x5a78e7[_0x03a2('0x1c')]],'as':_0x5a78e7['as'],'attributes':_0x5a78e7[_0x03a2('0x19')],'include':_0x5a78e7[_0x03a2('0x1b')]?_['map'](_0x5a78e7[_0x03a2('0x1b')],function(_0xb65ff5){return{'model':db[_0xb65ff5['model']],'as':_0xb65ff5['as'],'attributes':_0xb65ff5[_0x03a2('0x19')],'include':_0xb65ff5[_0x03a2('0x1b')]?_[_0x03a2('0x1d')](_0xb65ff5[_0x03a2('0x1b')],function(_0x51b56e){return{'model':db[_0x51b56e[_0x03a2('0x1c')]],'as':_0x51b56e['as'],'attributes':_0x51b56e[_0x03a2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x03a2('0xc')](function(_0x2e0c6e){logger[_0x03a2('0xd')](_0x03a2('0x21'),_0x5d7653);logger[_0x03a2('0x1f')](_0x03a2('0x21'),_0x5d7653,JSON['stringify'](_0x2e0c6e));_0x355167(_0x2e0c6e);})['catch'](function(_0x2acc62){logger[_0x03a2('0x12')](_0x03a2('0x21'),_0x2acc62[_0x03a2('0x20')],_0x5d7653);_0x579591(_0x1eeeeb['error'](0x1f4,_0x2acc62['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 5ba1f70..6ce646e 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 _0xe5b3=['remove','update','emit','removeListener','register','chatQueue:','save'];(function(_0x12c6a1,_0x213928){var _0x4aa8c1=function(_0x19195c){while(--_0x19195c){_0x12c6a1['push'](_0x12c6a1['shift']());}};_0x4aa8c1(++_0x213928);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3b0b34,_0xe6a14f){_0x3b0b34=_0x3b0b34-0x0;var _0x5f5496=_0xe5b3[_0x3b0b34];return _0x5f5496;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x3e5b('0x0'),_0x3e5b('0x1'),_0x3e5b('0x2')];function createListener(_0x1c38ed,_0x2a71ef){return function(_0x3171c5){_0x2a71ef[_0x3e5b('0x3')](_0x1c38ed,_0x3171c5);};}function removeListener(_0x1e58ed,_0x320b1e){return function(){ChatQueueEvents[_0x3e5b('0x4')](_0x1e58ed,_0x320b1e);};}exports[_0x3e5b('0x5')]=function(_0x54e1fb){for(var _0x174923=0x0,_0x5dcf55=events['length'];_0x174923<_0x5dcf55;_0x174923++){var _0x41d46f=events[_0x174923];var _0x3901c2=createListener(_0x3e5b('0x6')+_0x41d46f,_0x54e1fb);ChatQueueEvents['on'](_0x41d46f,_0x3901c2);}}; \ No newline at end of file +var _0x2bc6=['length','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x5d8e11,_0x1b2574){var _0x25fa53=function(_0x5376ce){while(--_0x5376ce){_0x5d8e11['push'](_0x5d8e11['shift']());}};_0x25fa53(++_0x1b2574);}(_0x2bc6,0x163));var _0x62bc=function(_0x40936a,_0x54a96f){_0x40936a=_0x40936a-0x0;var _0x4b432b=_0x2bc6[_0x40936a];return _0x4b432b;};'use strict';var ChatQueueEvents=require(_0x62bc('0x0'));var events=[_0x62bc('0x1'),_0x62bc('0x2'),'update'];function createListener(_0x4b4e73,_0x5a2676){return function(_0x5c5a2a){_0x5a2676[_0x62bc('0x3')](_0x4b4e73,_0x5c5a2a);};}function removeListener(_0x576608,_0x2a1959){return function(){ChatQueueEvents[_0x62bc('0x4')](_0x576608,_0x2a1959);};}exports['register']=function(_0x3cce26){for(var _0x450cb6=0x0,_0x40af10=events[_0x62bc('0x5')];_0x450cb6<_0x40af10;_0x450cb6++){var _0x3ed6ad=events[_0x450cb6];var _0x3f625c=createListener('chatQueue:'+_0x3ed6ad,_0x3cce26);ChatQueueEvents['on'](_0x3ed6ad,_0x3f625c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 2b6eaa3..aef7959 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(_0x5242ad,_0x30f60e){var _0x1c2c13=function(_0x3d4c26){while(--_0x3d4c26){_0x5242ad['push'](_0x5242ad['shift']());}};_0x1c2c13(++_0x30f60e);}(_0x7217,0x19e));var _0x7721=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7217[_0x411add];return _0x238242;};'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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3e74,0x175));var _0x43e7=function(_0x3c80bc,_0x24e125){_0x3c80bc=_0x3c80bc-0x0;var _0x3900f0=_0x3e74[_0x3c80bc];return _0x3900f0;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index d1a0947..c8ab68b 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 _0x9354=['exports','STRING','DATE','moment'];(function(_0x31f77c,_0x13d872){var _0x30ac12=function(_0x46bc61){while(--_0x46bc61){_0x31f77c['push'](_0x31f77c['shift']());}};_0x30ac12(++_0x13d872);}(_0x9354,0x77));var _0x4935=function(_0x399d76,_0xdc4493){_0x399d76=_0x399d76-0x0;var _0x3b19a1=_0x9354[_0x399d76];return _0x3b19a1;};'use strict';var moment=require(_0x4935('0x0'));var Sequelize=require('sequelize');module[_0x4935('0x1')]={'uniqueid':{'type':Sequelize[_0x4935('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4935('0x2')]},'joinAt':{'type':Sequelize[_0x4935('0x3')]},'leaveAt':{'type':Sequelize[_0x4935('0x3')]},'acceptAt':{'type':Sequelize[_0x4935('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4935('0x2')]}}; \ No newline at end of file +var _0x158a=['exports','STRING','DATE','moment'];(function(_0x282186,_0x433534){var _0x445ef5=function(_0x410099){while(--_0x410099){_0x282186['push'](_0x282186['shift']());}};_0x445ef5(++_0x433534);}(_0x158a,0xd7));var _0xa158=function(_0x2f7305,_0xc73a71){_0x2f7305=_0x2f7305-0x0;var _0x3a5ec1=_0x158a[_0x2f7305];return _0x3a5ec1;};'use strict';var moment=require(_0xa158('0x0'));var Sequelize=require('sequelize');module[_0xa158('0x1')]={'uniqueid':{'type':Sequelize[_0xa158('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa158('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa158('0x3')]},'exitAt':{'type':Sequelize[_0xa158('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 2aa97d5..8a1fa77 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 _0x68fd=['desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','save','then','destroy','sendStatus','stack','name','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','filter','merge','VIRTUAL','options','ChatQueueReport','include','catch','keys','includeAll','create','body','update','find','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x68fd,0x1e9));var _0xd68f=function(_0x49c3e2,_0x43be28){_0x49c3e2=_0x49c3e2-0x0;var _0x589289=_0x68fd[_0x49c3e2];return _0x589289;};'use strict';var emlformat=require(_0xd68f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd68f('0x1'));var jsonpatch=require(_0xd68f('0x2'));var rp=require('request-promise');var moment=require(_0xd68f('0x3'));var BPromise=require(_0xd68f('0x4'));var Mustache=require(_0xd68f('0x5'));var util=require(_0xd68f('0x6'));var path=require(_0xd68f('0x7'));var sox=require(_0xd68f('0x8'));var csv=require(_0xd68f('0x9'));var ejs=require(_0xd68f('0xa'));var fs=require('fs');var fs_extra=require(_0xd68f('0xb'));var _=require('lodash');var squel=require(_0xd68f('0xc'));var crypto=require(_0xd68f('0xd'));var jsforce=require(_0xd68f('0xe'));var deskjs=require(_0xd68f('0xf'));var toCsv=require(_0xd68f('0x9'));var querystring=require(_0xd68f('0x10'));var Papa=require(_0xd68f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd68f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd68f('0x13'));var logger=require(_0xd68f('0x14'))(_0xd68f('0x15'));var utils=require(_0xd68f('0x16'));var config=require(_0xd68f('0x17'));var licenseUtil=require(_0xd68f('0x18'));var db=require(_0xd68f('0x19'))['db'];function respondWithStatusCode(_0x52601f,_0x518883){_0x518883=_0x518883||0xcc;return function(_0x4b0be6){if(_0x4b0be6){return _0x52601f['sendStatus'](_0x518883);}return _0x52601f[_0xd68f('0x1a')](_0x518883)[_0xd68f('0x1b')]();};}function respondWithResult(_0x48f357,_0x9dbc9b){_0x9dbc9b=_0x9dbc9b||0xc8;return function(_0x8297c){if(_0x8297c){return _0x48f357[_0xd68f('0x1a')](_0x9dbc9b)[_0xd68f('0x1c')](_0x8297c);}};}function respondWithFilteredResult(_0x3a5bb2,_0x9a7fc6){return function(_0x203b3c){if(_0x203b3c){var _0x53aed0=typeof _0x9a7fc6[_0xd68f('0x1d')]==='undefined'&&typeof _0x9a7fc6['limit']===_0xd68f('0x1e');var _0x3115f3=_0x203b3c[_0xd68f('0x1f')];var _0x3fdfbf=_0x53aed0?0x0:_0x9a7fc6[_0xd68f('0x1d')];var _0xb01ed=_0x53aed0?_0x203b3c[_0xd68f('0x1f')]:_0x9a7fc6['offset']+_0x9a7fc6['limit'];var _0x14435f;if(_0xb01ed>=_0x3115f3){_0xb01ed=_0x3115f3;_0x14435f=0xc8;}else{_0x14435f=0xce;}_0x3a5bb2[_0xd68f('0x1a')](_0x14435f);return _0x3a5bb2[_0xd68f('0x20')](_0xd68f('0x21'),_0x3fdfbf+'-'+_0xb01ed+'/'+_0x3115f3)[_0xd68f('0x1c')](_0x203b3c);}return null;};}function patchUpdates(_0x4c192f){return function(_0x17d291){try{jsonpatch[_0xd68f('0x22')](_0x17d291,_0x4c192f,!![]);}catch(_0x3fbc0b){return BPromise['reject'](_0x3fbc0b);}return _0x17d291[_0xd68f('0x23')]();};}function saveUpdates(_0x1379e2,_0xeba444){return function(_0x590e04){if(_0x590e04){return _0x590e04['update'](_0x1379e2)[_0xd68f('0x24')](function(_0x5a3683){return _0x5a3683;});}return null;};}function removeEntity(_0x563cd3,_0x3cf02f){return function(_0x1ef099){if(_0x1ef099){return _0x1ef099[_0xd68f('0x25')]()[_0xd68f('0x24')](function(){_0x563cd3[_0xd68f('0x1a')](0xcc)[_0xd68f('0x1b')]();});}};}function handleEntityNotFound(_0x169dea,_0x277605){return function(_0xaceeb8){if(!_0xaceeb8){_0x169dea[_0xd68f('0x26')](0x194);}return _0xaceeb8;};}function handleError(_0x797b09,_0xea228d){_0xea228d=_0xea228d||0x1f4;return function(_0xee7d9d){logger['error'](_0xee7d9d[_0xd68f('0x27')]);if(_0xee7d9d[_0xd68f('0x28')]){delete _0xee7d9d['name'];}_0x797b09[_0xd68f('0x1a')](_0xea228d)['send'](_0xee7d9d);};}exports['index']=function(_0xcfadd4,_0x42f8d2){var _0x1eaebc={},_0x52a2dc={},_0xfee91c={'count':0x0,'rows':[]};var _0x4d3d2f=_[_0xd68f('0x29')](db['ChatQueueReport'][_0xd68f('0x2a')],function(_0x2dd737){return{'name':_0x2dd737[_0xd68f('0x2b')],'type':_0x2dd737[_0xd68f('0x2c')][_0xd68f('0x2d')]};});_0x52a2dc['model']=_[_0xd68f('0x29')](_0x4d3d2f,'name');_0x52a2dc[_0xd68f('0x2e')]=_['keys'](_0xcfadd4[_0xd68f('0x2e')]);_0x52a2dc[_0xd68f('0x2f')]=_[_0xd68f('0x30')](_0x52a2dc[_0xd68f('0x31')],_0x52a2dc['query']);_0x1eaebc[_0xd68f('0x32')]=_[_0xd68f('0x30')](_0x52a2dc[_0xd68f('0x31')],qs[_0xd68f('0x33')](_0xcfadd4['query'][_0xd68f('0x33')]));_0x1eaebc[_0xd68f('0x32')]=_0x1eaebc[_0xd68f('0x32')][_0xd68f('0x34')]?_0x1eaebc[_0xd68f('0x32')]:_0x52a2dc[_0xd68f('0x31')];if(!_0xcfadd4[_0xd68f('0x2e')][_0xd68f('0x35')]('nolimit')){_0x1eaebc[_0xd68f('0x36')]=qs[_0xd68f('0x36')](_0xcfadd4[_0xd68f('0x2e')][_0xd68f('0x36')]);_0x1eaebc[_0xd68f('0x1d')]=qs[_0xd68f('0x1d')](_0xcfadd4[_0xd68f('0x2e')][_0xd68f('0x1d')]);}_0x1eaebc['order']=qs[_0xd68f('0x37')](_0xcfadd4[_0xd68f('0x2e')][_0xd68f('0x37')]);_0x1eaebc[_0xd68f('0x38')]=qs[_0xd68f('0x2f')](_['pick'](_0xcfadd4[_0xd68f('0x2e')],_0x52a2dc[_0xd68f('0x2f')]),_0x4d3d2f);if(_0xcfadd4[_0xd68f('0x2e')][_0xd68f('0x39')]){_0x1eaebc[_0xd68f('0x38')]=_[_0xd68f('0x3a')](_0x1eaebc[_0xd68f('0x38')],{'$or':_[_0xd68f('0x29')](_0x4d3d2f,function(_0x582b38){if(_0x582b38[_0xd68f('0x2c')]!==_0xd68f('0x3b')){var _0x46c1be={};_0x46c1be[_0x582b38[_0xd68f('0x28')]]={'$like':'%'+_0xcfadd4[_0xd68f('0x2e')][_0xd68f('0x39')]+'%'};return _0x46c1be;}})});}_0x1eaebc=_['merge']({},_0x1eaebc,_0xcfadd4[_0xd68f('0x3c')]);var _0xb89fd3={'where':_0x1eaebc[_0xd68f('0x38')]};return db[_0xd68f('0x3d')][_0xd68f('0x1f')](_0xb89fd3)[_0xd68f('0x24')](function(_0x54cd1e){_0xfee91c[_0xd68f('0x1f')]=_0x54cd1e;if(_0xcfadd4[_0xd68f('0x2e')]['includeAll']){_0x1eaebc[_0xd68f('0x3e')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x1eaebc);})[_0xd68f('0x24')](function(_0x2016f1){_0xfee91c['rows']=_0x2016f1;return _0xfee91c;})[_0xd68f('0x24')](respondWithFilteredResult(_0x42f8d2,_0x1eaebc))[_0xd68f('0x3f')](handleError(_0x42f8d2,null));};exports['show']=function(_0x66b7a0,_0x2e1a2e){var _0x3d2dac={'raw':!![],'where':{'id':_0x66b7a0['params']['id']}},_0x645928={};_0x645928['model']=_['keys'](db[_0xd68f('0x3d')][_0xd68f('0x2a')]);_0x645928[_0xd68f('0x2e')]=_[_0xd68f('0x40')](_0x66b7a0[_0xd68f('0x2e')]);_0x645928[_0xd68f('0x2f')]=_[_0xd68f('0x30')](_0x645928[_0xd68f('0x31')],_0x645928[_0xd68f('0x2e')]);_0x3d2dac[_0xd68f('0x32')]=_[_0xd68f('0x30')](_0x645928['model'],qs['fields'](_0x66b7a0[_0xd68f('0x2e')][_0xd68f('0x33')]));_0x3d2dac[_0xd68f('0x32')]=_0x3d2dac[_0xd68f('0x32')][_0xd68f('0x34')]?_0x3d2dac[_0xd68f('0x32')]:_0x645928['model'];if(_0x66b7a0[_0xd68f('0x2e')][_0xd68f('0x41')]){_0x3d2dac[_0xd68f('0x3e')]=[{'all':!![]}];}_0x3d2dac=_[_0xd68f('0x3a')]({},_0x3d2dac,_0x66b7a0[_0xd68f('0x3c')]);return db[_0xd68f('0x3d')]['find'](_0x3d2dac)[_0xd68f('0x24')](handleEntityNotFound(_0x2e1a2e,null))[_0xd68f('0x24')](respondWithResult(_0x2e1a2e,null))[_0xd68f('0x3f')](handleError(_0x2e1a2e,null));};exports[_0xd68f('0x42')]=function(_0x6e90a1,_0x314c18){return db[_0xd68f('0x3d')][_0xd68f('0x42')](_0x6e90a1[_0xd68f('0x43')],{})['then'](respondWithResult(_0x314c18,0xc9))[_0xd68f('0x3f')](handleError(_0x314c18,null));};exports[_0xd68f('0x44')]=function(_0xd98ba2,_0x5bfd21){if(_0xd98ba2[_0xd68f('0x43')]['id']){delete _0xd98ba2[_0xd68f('0x43')]['id'];}return db[_0xd68f('0x3d')][_0xd68f('0x45')]({'where':{'id':_0xd98ba2[_0xd68f('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bfd21,null))['then'](saveUpdates(_0xd98ba2['body'],null))[_0xd68f('0x24')](respondWithResult(_0x5bfd21,null))[_0xd68f('0x3f')](handleError(_0x5bfd21,null));};exports['destroy']=function(_0x1f4bc6,_0x41bde1){return db[_0xd68f('0x3d')][_0xd68f('0x45')]({'where':{'id':_0x1f4bc6[_0xd68f('0x46')]['id']}})[_0xd68f('0x24')](handleEntityNotFound(_0x41bde1,null))[_0xd68f('0x24')](removeEntity(_0x41bde1,null))[_0xd68f('0x3f')](handleError(_0x41bde1,null));};exports[_0xd68f('0x47')]=function(_0x51b954,_0x28fb40){return db[_0xd68f('0x3d')][_0xd68f('0x47')]()[_0xd68f('0x24')](respondWithResult(_0x28fb40,null))[_0xd68f('0x3f')](handleError(_0x28fb40,null));}; \ No newline at end of file +var _0x3f1c=['params','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include'];(function(_0x5293ca,_0x1686b7){var _0x324f39=function(_0x35bca6){while(--_0x35bca6){_0x5293ca['push'](_0x5293ca['shift']());}};_0x324f39(++_0x1686b7);}(_0x3f1c,0xd4));var _0xc3f1=function(_0xb20282,_0x316206){_0xb20282=_0xb20282-0x0;var _0x3c1ab9=_0x3f1c[_0xb20282];return _0x3c1ab9;};'use strict';var emlformat=require(_0xc3f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc3f1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc3f1('0x2'));var Mustache=require(_0xc3f1('0x3'));var util=require(_0xc3f1('0x4'));var path=require(_0xc3f1('0x5'));var sox=require(_0xc3f1('0x6'));var csv=require('to-csv');var ejs=require(_0xc3f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3f1('0x8'));var squel=require(_0xc3f1('0x9'));var crypto=require(_0xc3f1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc3f1('0xb'));var querystring=require('querystring');var Papa=require(_0xc3f1('0xc'));var Redis=require(_0xc3f1('0xd'));var authService=require(_0xc3f1('0xe'));var qs=require(_0xc3f1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f1('0x10'));var logger=require('../../config/logger')(_0xc3f1('0x11'));var utils=require('../../config/utils');var config=require(_0xc3f1('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23bb14,_0x103df5){_0x103df5=_0x103df5||0xcc;return function(_0x25cb9e){if(_0x25cb9e){return _0x23bb14[_0xc3f1('0x13')](_0x103df5);}return _0x23bb14[_0xc3f1('0x14')](_0x103df5)[_0xc3f1('0x15')]();};}function respondWithResult(_0x5bbfb3,_0x5dbe5c){_0x5dbe5c=_0x5dbe5c||0xc8;return function(_0x1d9ea7){if(_0x1d9ea7){return _0x5bbfb3[_0xc3f1('0x14')](_0x5dbe5c)[_0xc3f1('0x16')](_0x1d9ea7);}};}function respondWithFilteredResult(_0x23eb8c,_0x4e8f05){return function(_0x4667af){if(_0x4667af){var _0xee643=typeof _0x4e8f05[_0xc3f1('0x17')]===_0xc3f1('0x18')&&typeof _0x4e8f05['limit']===_0xc3f1('0x18');var _0x59e1e3=_0x4667af[_0xc3f1('0x19')];var _0x420d75=_0xee643?0x0:_0x4e8f05[_0xc3f1('0x17')];var _0x3dc419=_0xee643?_0x4667af['count']:_0x4e8f05[_0xc3f1('0x17')]+_0x4e8f05[_0xc3f1('0x1a')];var _0x3f97b2;if(_0x3dc419>=_0x59e1e3){_0x3dc419=_0x59e1e3;_0x3f97b2=0xc8;}else{_0x3f97b2=0xce;}_0x23eb8c[_0xc3f1('0x14')](_0x3f97b2);return _0x23eb8c[_0xc3f1('0x1b')]('Content-Range',_0x420d75+'-'+_0x3dc419+'/'+_0x59e1e3)[_0xc3f1('0x16')](_0x4667af);}return null;};}function patchUpdates(_0x4f53c1){return function(_0x546627){try{jsonpatch[_0xc3f1('0x1c')](_0x546627,_0x4f53c1,!![]);}catch(_0x1d3ebb){return BPromise[_0xc3f1('0x1d')](_0x1d3ebb);}return _0x546627[_0xc3f1('0x1e')]();};}function saveUpdates(_0x53d054,_0x44d774){return function(_0x2df1a4){if(_0x2df1a4){return _0x2df1a4[_0xc3f1('0x1f')](_0x53d054)[_0xc3f1('0x20')](function(_0x151c8a){return _0x151c8a;});}return null;};}function removeEntity(_0x31a03c,_0x2f4d81){return function(_0x294f50){if(_0x294f50){return _0x294f50['destroy']()['then'](function(){_0x31a03c[_0xc3f1('0x14')](0xcc)[_0xc3f1('0x15')]();});}};}function handleEntityNotFound(_0x3b1eb9,_0x49d98d){return function(_0x5e1b6a){if(!_0x5e1b6a){_0x3b1eb9[_0xc3f1('0x13')](0x194);}return _0x5e1b6a;};}function handleError(_0x41b473,_0x1cf63f){_0x1cf63f=_0x1cf63f||0x1f4;return function(_0x4dd154){logger['error'](_0x4dd154[_0xc3f1('0x21')]);if(_0x4dd154[_0xc3f1('0x22')]){delete _0x4dd154['name'];}_0x41b473['status'](_0x1cf63f)[_0xc3f1('0x23')](_0x4dd154);};}exports[_0xc3f1('0x24')]=function(_0x5cb85d,_0x2d6cc4){var _0x22dac7={},_0x2f925e={},_0x3454a3={'count':0x0,'rows':[]};var _0x4103ef=_[_0xc3f1('0x25')](db[_0xc3f1('0x26')]['rawAttributes'],function(_0x22957c){return{'name':_0x22957c[_0xc3f1('0x27')],'type':_0x22957c[_0xc3f1('0x28')][_0xc3f1('0x29')]};});_0x2f925e[_0xc3f1('0x2a')]=_['map'](_0x4103ef,_0xc3f1('0x22'));_0x2f925e['query']=_[_0xc3f1('0x2b')](_0x5cb85d['query']);_0x2f925e['filters']=_[_0xc3f1('0x2c')](_0x2f925e[_0xc3f1('0x2a')],_0x2f925e['query']);_0x22dac7[_0xc3f1('0x2d')]=_[_0xc3f1('0x2c')](_0x2f925e['model'],qs[_0xc3f1('0x2e')](_0x5cb85d['query'][_0xc3f1('0x2e')]));_0x22dac7[_0xc3f1('0x2d')]=_0x22dac7[_0xc3f1('0x2d')][_0xc3f1('0x2f')]?_0x22dac7[_0xc3f1('0x2d')]:_0x2f925e['model'];if(!_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x31')]('nolimit')){_0x22dac7[_0xc3f1('0x1a')]=qs[_0xc3f1('0x1a')](_0x5cb85d[_0xc3f1('0x30')]['limit']);_0x22dac7[_0xc3f1('0x17')]=qs[_0xc3f1('0x17')](_0x5cb85d['query'][_0xc3f1('0x17')]);}_0x22dac7[_0xc3f1('0x32')]=qs['sort'](_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x33')]);_0x22dac7[_0xc3f1('0x34')]=qs[_0xc3f1('0x35')](_[_0xc3f1('0x36')](_0x5cb85d[_0xc3f1('0x30')],_0x2f925e[_0xc3f1('0x35')]),_0x4103ef);if(_0x5cb85d[_0xc3f1('0x30')][_0xc3f1('0x37')]){_0x22dac7[_0xc3f1('0x34')]=_[_0xc3f1('0x38')](_0x22dac7['where'],{'$or':_[_0xc3f1('0x25')](_0x4103ef,function(_0x5db660){if(_0x5db660['type']!==_0xc3f1('0x39')){var _0x4420ce={};_0x4420ce[_0x5db660[_0xc3f1('0x22')]]={'$like':'%'+_0x5cb85d['query'][_0xc3f1('0x37')]+'%'};return _0x4420ce;}})});}_0x22dac7=_[_0xc3f1('0x38')]({},_0x22dac7,_0x5cb85d[_0xc3f1('0x3a')]);var _0x29eefa={'where':_0x22dac7[_0xc3f1('0x34')]};return db[_0xc3f1('0x26')]['count'](_0x29eefa)[_0xc3f1('0x20')](function(_0x3afde8){_0x3454a3[_0xc3f1('0x19')]=_0x3afde8;if(_0x5cb85d['query']['includeAll']){_0x22dac7[_0xc3f1('0x3b')]=[{'all':!![]}];}return db[_0xc3f1('0x26')]['findAll'](_0x22dac7);})[_0xc3f1('0x20')](function(_0x30e012){_0x3454a3['rows']=_0x30e012;return _0x3454a3;})['then'](respondWithFilteredResult(_0x2d6cc4,_0x22dac7))['catch'](handleError(_0x2d6cc4,null));};exports['show']=function(_0x4a829c,_0x1904c0){var _0x1e8e55={'raw':!![],'where':{'id':_0x4a829c[_0xc3f1('0x3c')]['id']}},_0xfcf4a6={};_0xfcf4a6['model']=_['keys'](db[_0xc3f1('0x26')][_0xc3f1('0x3d')]);_0xfcf4a6[_0xc3f1('0x30')]=_[_0xc3f1('0x2b')](_0x4a829c[_0xc3f1('0x30')]);_0xfcf4a6[_0xc3f1('0x35')]=_[_0xc3f1('0x2c')](_0xfcf4a6[_0xc3f1('0x2a')],_0xfcf4a6[_0xc3f1('0x30')]);_0x1e8e55['attributes']=_[_0xc3f1('0x2c')](_0xfcf4a6[_0xc3f1('0x2a')],qs['fields'](_0x4a829c[_0xc3f1('0x30')][_0xc3f1('0x2e')]));_0x1e8e55[_0xc3f1('0x2d')]=_0x1e8e55[_0xc3f1('0x2d')]['length']?_0x1e8e55['attributes']:_0xfcf4a6['model'];if(_0x4a829c['query'][_0xc3f1('0x3e')]){_0x1e8e55[_0xc3f1('0x3b')]=[{'all':!![]}];}_0x1e8e55=_['merge']({},_0x1e8e55,_0x4a829c[_0xc3f1('0x3a')]);return db[_0xc3f1('0x26')][_0xc3f1('0x3f')](_0x1e8e55)[_0xc3f1('0x20')](handleEntityNotFound(_0x1904c0,null))[_0xc3f1('0x20')](respondWithResult(_0x1904c0,null))[_0xc3f1('0x40')](handleError(_0x1904c0,null));};exports[_0xc3f1('0x41')]=function(_0x581eca,_0x3fdb5c){return db[_0xc3f1('0x26')]['create'](_0x581eca[_0xc3f1('0x42')],{})[_0xc3f1('0x20')](respondWithResult(_0x3fdb5c,0xc9))[_0xc3f1('0x40')](handleError(_0x3fdb5c,null));};exports['update']=function(_0x1a7d8c,_0x2f370b){if(_0x1a7d8c['body']['id']){delete _0x1a7d8c[_0xc3f1('0x42')]['id'];}return db[_0xc3f1('0x26')][_0xc3f1('0x3f')]({'where':{'id':_0x1a7d8c[_0xc3f1('0x3c')]['id']}})[_0xc3f1('0x20')](handleEntityNotFound(_0x2f370b,null))[_0xc3f1('0x20')](saveUpdates(_0x1a7d8c[_0xc3f1('0x42')],null))[_0xc3f1('0x20')](respondWithResult(_0x2f370b,null))[_0xc3f1('0x40')](handleError(_0x2f370b,null));};exports['destroy']=function(_0x2966f2,_0x59245c){return db[_0xc3f1('0x26')][_0xc3f1('0x3f')]({'where':{'id':_0x2966f2[_0xc3f1('0x3c')]['id']}})[_0xc3f1('0x20')](handleEntityNotFound(_0x59245c,null))[_0xc3f1('0x20')](removeEntity(_0x59245c,null))[_0xc3f1('0x40')](handleError(_0x59245c,null));};exports[_0xc3f1('0x43')]=function(_0x58803a,_0x32aae1){return db[_0xc3f1('0x26')]['describe']()[_0xc3f1('0x20')](respondWithResult(_0x32aae1,null))[_0xc3f1('0x40')](handleError(_0x32aae1,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index a426add..cd21984 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(_0x112a3e,_0x23f15c){var _0x577bfc=function(_0x4c47c0){while(--_0x4c47c0){_0x112a3e['push'](_0x112a3e['shift']());}};_0x577bfc(++_0x23f15c);}(_0xe706,0xa3));var _0x6e70=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0xe706[_0x37a7c6];return _0x539905;};'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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x41c710,_0x58d524){var _0xa3bdd1=function(_0x5c5005){while(--_0x5c5005){_0x41c710['push'](_0x41c710['shift']());}};_0xa3bdd1(++_0x58d524);}(_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('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index bff41eb..5a3d309 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 _0x7d99=['where','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','UpdateChatQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d99,0x71));var _0x97d9=function(_0x58a8ad,_0x78776a){_0x58a8ad=_0x58a8ad-0x0;var _0x12c4af=_0x7d99[_0x58a8ad];return _0x12c4af;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x97d9('0x0'));var rs=require(_0x97d9('0x1'));var fs=require('fs');var Redis=require(_0x97d9('0x2'));var db=require(_0x97d9('0x3'))['db'];var utils=require(_0x97d9('0x4'));var logger=require(_0x97d9('0x5'))('rpc');var config=require(_0x97d9('0x6'));var jayson=require(_0x97d9('0x7'));var client=jayson[_0x97d9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bfcc4,_0x404d53,_0x13e3c6){return new BPromise(function(_0xabc019,_0x55b04f){return client[_0x97d9('0x9')](_0x4bfcc4,_0x13e3c6)[_0x97d9('0xa')](function(_0x8d649e){logger['info'](_0x97d9('0xb'),_0x404d53,_0x97d9('0xc'));logger[_0x97d9('0xd')](_0x97d9('0xe'),_0x404d53,_0x97d9('0xc'),JSON[_0x97d9('0xf')](_0x8d649e));if(_0x8d649e[_0x97d9('0x10')]){if(_0x8d649e[_0x97d9('0x10')]['code']===0x1f4){logger[_0x97d9('0x10')](_0x97d9('0xb'),_0x404d53,_0x8d649e['error'][_0x97d9('0x11')]);return _0x55b04f(_0x8d649e[_0x97d9('0x10')][_0x97d9('0x11')]);}logger[_0x97d9('0x10')](_0x97d9('0xb'),_0x404d53,_0x8d649e[_0x97d9('0x10')]['message']);return _0xabc019(_0x8d649e[_0x97d9('0x10')][_0x97d9('0x11')]);}else{logger[_0x97d9('0x12')](_0x97d9('0xb'),_0x404d53,_0x97d9('0xc'));_0xabc019(_0x8d649e['result'][_0x97d9('0x11')]);}})[_0x97d9('0x13')](function(_0x119939){logger['error'](_0x97d9('0xb'),_0x404d53,_0x119939);_0x55b04f(_0x119939);});});}exports[_0x97d9('0x14')]=function(_0x2e08f4){var _0x11f60d=this;return new Promise(function(_0x10541c,_0x42cd67){return db[_0x97d9('0x15')][_0x97d9('0x16')](_0x2e08f4['body'],{'raw':_0x2e08f4[_0x97d9('0x17')]?_0x2e08f4[_0x97d9('0x17')][_0x97d9('0x18')]===undefined?!![]:![]:!![]})[_0x97d9('0xa')](function(_0x274f07){logger[_0x97d9('0x12')]('CreateChatQueueReport',_0x2e08f4);logger[_0x97d9('0xd')]('CreateChatQueueReport',_0x2e08f4,JSON[_0x97d9('0xf')](_0x274f07));_0x10541c(_0x274f07);})[_0x97d9('0x13')](function(_0x295b8e){logger['error'](_0x97d9('0x14'),_0x295b8e['message'],_0x2e08f4);_0x42cd67(_0x11f60d[_0x97d9('0x10')](0x1f4,_0x295b8e[_0x97d9('0x11')]));});});};exports[_0x97d9('0x19')]=function(_0x36671d){var _0x40e535=this;return new Promise(function(_0x54fced,_0x5b9251){return db[_0x97d9('0x15')][_0x97d9('0x1a')](_0x36671d['body'],{'raw':_0x36671d['options']?_0x36671d[_0x97d9('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36671d[_0x97d9('0x17')]?_0x36671d[_0x97d9('0x17')][_0x97d9('0x1b')]||null:null,'attributes':_0x36671d[_0x97d9('0x17')]?_0x36671d[_0x97d9('0x17')]['attributes']||null:null,'limit':_0x36671d[_0x97d9('0x17')]?_0x36671d[_0x97d9('0x17')]['limit']||null:null})[_0x97d9('0xa')](function(_0x2832b6){logger['info']('UpdateChatQueueReport',_0x36671d);logger['debug'](_0x97d9('0x19'),_0x36671d,JSON[_0x97d9('0xf')](_0x2832b6));_0x54fced(_0x2832b6);})['catch'](function(_0x5cdc7a){logger[_0x97d9('0x10')](_0x97d9('0x19'),_0x5cdc7a[_0x97d9('0x11')],_0x36671d);_0x5b9251(_0x40e535['error'](0x1f4,_0x5cdc7a[_0x97d9('0x11')]));});});}; \ No newline at end of file +var _0xb78e=['rpc','../../config/environment','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','body','options','update','where','limit','UpdateChatQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x17f1d9,_0x475241){var _0x34f3e0=function(_0x39d46d){while(--_0x39d46d){_0x17f1d9['push'](_0x17f1d9['shift']());}};_0x34f3e0(++_0x475241);}(_0xb78e,0x1c9));var _0xeb78=function(_0x17320e,_0x3ad961){_0x17320e=_0x17320e-0x0;var _0x54be24=_0xb78e[_0x17320e];return _0x54be24;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ccc2f,_0x30c884,_0x2b7925){return new BPromise(function(_0x36963f,_0x5259aa){return client['request'](_0x1ccc2f,_0x2b7925)[_0xeb78('0xc')](function(_0x1c941d){logger[_0xeb78('0xd')](_0xeb78('0xe'),_0x30c884,_0xeb78('0xf'));logger[_0xeb78('0x10')](_0xeb78('0x11'),_0x30c884,_0xeb78('0xf'),JSON[_0xeb78('0x12')](_0x1c941d));if(_0x1c941d['error']){if(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x14')]===0x1f4){logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);return _0x5259aa(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);}logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d['error'][_0xeb78('0x15')]);return _0x36963f(_0x1c941d[_0xeb78('0x13')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x30c884,_0xeb78('0xf'));_0x36963f(_0x1c941d['result'][_0xeb78('0x15')]);}})[_0xeb78('0x16')](function(_0x49123d){logger[_0xeb78('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x30c884,_0x49123d);_0x5259aa(_0x49123d);});});}exports[_0xeb78('0x17')]=function(_0x92e410){var _0x576802=this;return new Promise(function(_0x45176e,_0xb97756){return db[_0xeb78('0x18')]['create'](_0x92e410[_0xeb78('0x19')],{'raw':_0x92e410[_0xeb78('0x1a')]?_0x92e410['options']['raw']===undefined?!![]:![]:!![]})[_0xeb78('0xc')](function(_0x106c5d){logger[_0xeb78('0xd')](_0xeb78('0x17'),_0x92e410);logger[_0xeb78('0x10')](_0xeb78('0x17'),_0x92e410,JSON[_0xeb78('0x12')](_0x106c5d));_0x45176e(_0x106c5d);})[_0xeb78('0x16')](function(_0x18f08d){logger['error']('CreateChatQueueReport',_0x18f08d['message'],_0x92e410);_0xb97756(_0x576802['error'](0x1f4,_0x18f08d[_0xeb78('0x15')]));});});};exports['UpdateChatQueueReport']=function(_0x2159c1){var _0x1fbf2f=this;return new Promise(function(_0x566336,_0x777ca3){return db['ChatQueueReport'][_0xeb78('0x1b')](_0x2159c1[_0xeb78('0x19')],{'raw':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1['options'][_0xeb78('0x1c')]||null:null,'attributes':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')]['attributes']||null:null,'limit':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')][_0xeb78('0x1d')]||null:null})[_0xeb78('0xc')](function(_0x3d4a97){logger[_0xeb78('0xd')](_0xeb78('0x1e'),_0x2159c1);logger[_0xeb78('0x10')](_0xeb78('0x1e'),_0x2159c1,JSON[_0xeb78('0x12')](_0x3d4a97));_0x566336(_0x3d4a97);})[_0xeb78('0x16')](function(_0x505468){logger['error']('UpdateChatQueueReport',_0x505468[_0xeb78('0x15')],_0x2159c1);_0x777ca3(_0x1fbf2f[_0xeb78('0x13')](0x1f4,_0x505468[_0xeb78('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 23d2518..31f3587 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 _0xab03=['create','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./chatQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x51eb77,_0x436673){var _0x4b26fe=function(_0x4db9dc){while(--_0x4db9dc){_0x51eb77['push'](_0x51eb77['shift']());}};_0x4b26fe(++_0x436673);}(_0xab03,0xe8));var _0x3ab0=function(_0x38d334,_0x320864){_0x38d334=_0x38d334-0x0;var _0x48b252=_0xab03[_0x38d334];return _0x48b252;};'use strict';var multer=require(_0x3ab0('0x0'));var util=require(_0x3ab0('0x1'));var path=require(_0x3ab0('0x2'));var timeout=require(_0x3ab0('0x3'));var express=require(_0x3ab0('0x4'));var router=express['Router']();var fs_extra=require(_0x3ab0('0x5'));var auth=require(_0x3ab0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3ab0('0x7'));router['get']('/',auth[_0x3ab0('0x8')](),controller['index']);router[_0x3ab0('0x9')](_0x3ab0('0xa'),auth[_0x3ab0('0x8')](),controller[_0x3ab0('0xb')]);router[_0x3ab0('0x9')](_0x3ab0('0xc'),auth[_0x3ab0('0x8')](),controller[_0x3ab0('0xd')]);router[_0x3ab0('0xe')]('/',auth[_0x3ab0('0x8')](),controller[_0x3ab0('0xf')]);router[_0x3ab0('0x10')]('/:id',auth[_0x3ab0('0x8')](),controller['update']);router[_0x3ab0('0x11')](_0x3ab0('0xc'),auth['isAuthenticated'](),controller[_0x3ab0('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd49b=['/:id','show','post','create','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd49b,0x1ec));var _0xbd49=function(_0xeb80e,_0x337608){_0xeb80e=_0xeb80e-0x0;var _0x68e9d7=_0xd49b[_0xeb80e];return _0x68e9d7;};'use strict';var multer=require(_0xbd49('0x0'));var util=require(_0xbd49('0x1'));var path=require(_0xbd49('0x2'));var timeout=require(_0xbd49('0x3'));var express=require(_0xbd49('0x4'));var router=express[_0xbd49('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbd49('0x6'));var config=require(_0xbd49('0x7'));var controller=require('./chatQueueReport.controller');router[_0xbd49('0x8')]('/',auth['isAuthenticated'](),controller[_0xbd49('0x9')]);router[_0xbd49('0x8')](_0xbd49('0xa'),auth[_0xbd49('0xb')](),controller['describe']);router[_0xbd49('0x8')](_0xbd49('0xc'),auth['isAuthenticated'](),controller[_0xbd49('0xd')]);router[_0xbd49('0xe')]('/',auth[_0xbd49('0xb')](),controller[_0xbd49('0xf')]);router['put'](_0xbd49('0xc'),auth['isAuthenticated'](),controller[_0xbd49('0x10')]);router['delete'](_0xbd49('0xc'),auth['isAuthenticated'](),controller[_0xbd49('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 7381845..38c10df 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2ccf3d,_0x261182){_0x2ccf3d=_0x2ccf3d-0x0;var _0x4c1ba3=_0xb43b[_0x2ccf3d];return _0x4c1ba3;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x353299,_0x3a6de0){var _0x29eead=function(_0x43b361){while(--_0x43b361){_0x353299['push'](_0x353299['shift']());}};_0x29eead(++_0x3a6de0);}(_0xedd9,0xfc));var _0x9edd=function(_0x53fdcb,_0xe152d1){_0x53fdcb=_0x53fdcb-0x0;var _0x3b0bd7=_0xedd9[_0x53fdcb];return _0x3b0bd7;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index a41d83f..78c46e5 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 _0x82b1=['count','set','reject','update','then','destroy','stack','name','send','ChatTransferReport','rawAttributes','fieldName','key','model','map','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','length','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x7be910,_0x2b381b){var _0x496ddf=function(_0x3ac518){while(--_0x3ac518){_0x7be910['push'](_0x7be910['shift']());}};_0x496ddf(++_0x2b381b);}(_0x82b1,0x107));var _0x182b=function(_0x11249d,_0x158871){_0x11249d=_0x11249d-0x0;var _0x3f1b5b=_0x82b1[_0x11249d];return _0x3f1b5b;};'use strict';var emlformat=require(_0x182b('0x0'));var rimraf=require(_0x182b('0x1'));var zipdir=require(_0x182b('0x2'));var jsonpatch=require(_0x182b('0x3'));var rp=require(_0x182b('0x4'));var moment=require(_0x182b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x182b('0x6'));var path=require(_0x182b('0x7'));var sox=require(_0x182b('0x8'));var csv=require('to-csv');var ejs=require(_0x182b('0x9'));var fs=require('fs');var fs_extra=require(_0x182b('0xa'));var _=require(_0x182b('0xb'));var squel=require('squel');var crypto=require(_0x182b('0xc'));var jsforce=require(_0x182b('0xd'));var deskjs=require(_0x182b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x182b('0xf'));var Papa=require(_0x182b('0x10'));var Redis=require(_0x182b('0x11'));var authService=require(_0x182b('0x12'));var qs=require(_0x182b('0x13'));var as=require(_0x182b('0x14'));var hardwareService=require(_0x182b('0x15'));var logger=require('../../config/logger')(_0x182b('0x16'));var utils=require(_0x182b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x182b('0x18'));var db=require(_0x182b('0x19'))['db'];function respondWithStatusCode(_0x30e6db,_0x143f0a){_0x143f0a=_0x143f0a||0xcc;return function(_0x3582aa){if(_0x3582aa){return _0x30e6db[_0x182b('0x1a')](_0x143f0a);}return _0x30e6db[_0x182b('0x1b')](_0x143f0a)[_0x182b('0x1c')]();};}function respondWithResult(_0x59b2a3,_0x5420cc){_0x5420cc=_0x5420cc||0xc8;return function(_0x254976){if(_0x254976){return _0x59b2a3[_0x182b('0x1b')](_0x5420cc)[_0x182b('0x1d')](_0x254976);}};}function respondWithFilteredResult(_0xaf554f,_0x290e5f){return function(_0x5ef6e4){if(_0x5ef6e4){var _0x1e9eef=typeof _0x290e5f[_0x182b('0x1e')]===_0x182b('0x1f')&&typeof _0x290e5f[_0x182b('0x20')]===_0x182b('0x1f');var _0x29cb4b=_0x5ef6e4[_0x182b('0x21')];var _0x1000b0=_0x1e9eef?0x0:_0x290e5f[_0x182b('0x1e')];var _0x2a5a8f=_0x1e9eef?_0x5ef6e4[_0x182b('0x21')]:_0x290e5f['offset']+_0x290e5f[_0x182b('0x20')];var _0x31329c;if(_0x2a5a8f>=_0x29cb4b){_0x2a5a8f=_0x29cb4b;_0x31329c=0xc8;}else{_0x31329c=0xce;}_0xaf554f[_0x182b('0x1b')](_0x31329c);return _0xaf554f[_0x182b('0x22')]('Content-Range',_0x1000b0+'-'+_0x2a5a8f+'/'+_0x29cb4b)[_0x182b('0x1d')](_0x5ef6e4);}return null;};}function patchUpdates(_0x3ed0e2){return function(_0x1c3ebd){try{jsonpatch['apply'](_0x1c3ebd,_0x3ed0e2,!![]);}catch(_0x1acf8f){return BPromise[_0x182b('0x23')](_0x1acf8f);}return _0x1c3ebd['save']();};}function saveUpdates(_0x89e411,_0x24755f){return function(_0x25fedf){if(_0x25fedf){return _0x25fedf[_0x182b('0x24')](_0x89e411)[_0x182b('0x25')](function(_0x32d51d){return _0x32d51d;});}return null;};}function removeEntity(_0x3d2abf,_0xf9a38f){return function(_0xc652db){if(_0xc652db){return _0xc652db[_0x182b('0x26')]()['then'](function(){_0x3d2abf[_0x182b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bce5a,_0x4ca5d8){return function(_0x501cc7){if(!_0x501cc7){_0x3bce5a[_0x182b('0x1a')](0x194);}return _0x501cc7;};}function handleError(_0x510ac0,_0x13fa4a){_0x13fa4a=_0x13fa4a||0x1f4;return function(_0x185e98){logger['error'](_0x185e98[_0x182b('0x27')]);if(_0x185e98[_0x182b('0x28')]){delete _0x185e98[_0x182b('0x28')];}_0x510ac0['status'](_0x13fa4a)[_0x182b('0x29')](_0x185e98);};}exports['index']=function(_0x4577a7,_0x435321){var _0x66e776={},_0x2dea66={},_0x302e45={'count':0x0,'rows':[]};var _0x42711b=_['map'](db[_0x182b('0x2a')][_0x182b('0x2b')],function(_0xec5121){return{'name':_0xec5121[_0x182b('0x2c')],'type':_0xec5121['type'][_0x182b('0x2d')]};});_0x2dea66[_0x182b('0x2e')]=_[_0x182b('0x2f')](_0x42711b,_0x182b('0x28'));_0x2dea66['query']=_[_0x182b('0x30')](_0x4577a7['query']);_0x2dea66[_0x182b('0x31')]=_[_0x182b('0x32')](_0x2dea66['model'],_0x2dea66['query']);_0x66e776[_0x182b('0x33')]=_[_0x182b('0x32')](_0x2dea66[_0x182b('0x2e')],qs[_0x182b('0x34')](_0x4577a7['query']['fields']));_0x66e776[_0x182b('0x33')]=_0x66e776[_0x182b('0x33')]['length']?_0x66e776['attributes']:_0x2dea66[_0x182b('0x2e')];if(!_0x4577a7[_0x182b('0x35')][_0x182b('0x36')](_0x182b('0x37'))){_0x66e776[_0x182b('0x20')]=qs[_0x182b('0x20')](_0x4577a7[_0x182b('0x35')]['limit']);_0x66e776['offset']=qs['offset'](_0x4577a7[_0x182b('0x35')][_0x182b('0x1e')]);}_0x66e776['order']=qs[_0x182b('0x38')](_0x4577a7[_0x182b('0x35')][_0x182b('0x38')]);_0x66e776[_0x182b('0x39')]=qs[_0x182b('0x31')](_[_0x182b('0x3a')](_0x4577a7[_0x182b('0x35')],_0x2dea66['filters']),_0x42711b);if(_0x4577a7[_0x182b('0x35')][_0x182b('0x3b')]){_0x66e776['where']=_['merge'](_0x66e776['where'],{'$or':_[_0x182b('0x2f')](_0x42711b,function(_0x179903){if(_0x179903[_0x182b('0x3c')]!==_0x182b('0x3d')){var _0x12892f={};_0x12892f[_0x179903[_0x182b('0x28')]]={'$like':'%'+_0x4577a7[_0x182b('0x35')][_0x182b('0x3b')]+'%'};return _0x12892f;}})});}_0x66e776=_[_0x182b('0x3e')]({},_0x66e776,_0x4577a7[_0x182b('0x3f')]);var _0x8d76cb={'where':_0x66e776[_0x182b('0x39')]};return db[_0x182b('0x2a')]['count'](_0x8d76cb)[_0x182b('0x25')](function(_0xc9fe13){_0x302e45[_0x182b('0x21')]=_0xc9fe13;if(_0x4577a7['query'][_0x182b('0x40')]){_0x66e776[_0x182b('0x41')]=[{'all':!![]}];}return db[_0x182b('0x2a')]['findAll'](_0x66e776);})[_0x182b('0x25')](function(_0x12d544){_0x302e45[_0x182b('0x42')]=_0x12d544;return _0x302e45;})['then'](respondWithFilteredResult(_0x435321,_0x66e776))[_0x182b('0x43')](handleError(_0x435321,null));};exports[_0x182b('0x44')]=function(_0x507c4e,_0x89e36a){var _0x35c7de={'raw':!![],'where':{'id':_0x507c4e['params']['id']}},_0x32302c={};_0x32302c[_0x182b('0x2e')]=_['keys'](db[_0x182b('0x2a')][_0x182b('0x2b')]);_0x32302c[_0x182b('0x35')]=_[_0x182b('0x30')](_0x507c4e[_0x182b('0x35')]);_0x32302c[_0x182b('0x31')]=_[_0x182b('0x32')](_0x32302c[_0x182b('0x2e')],_0x32302c[_0x182b('0x35')]);_0x35c7de['attributes']=_[_0x182b('0x32')](_0x32302c[_0x182b('0x2e')],qs[_0x182b('0x34')](_0x507c4e[_0x182b('0x35')]['fields']));_0x35c7de[_0x182b('0x33')]=_0x35c7de[_0x182b('0x33')][_0x182b('0x45')]?_0x35c7de['attributes']:_0x32302c[_0x182b('0x2e')];if(_0x507c4e[_0x182b('0x35')]['includeAll']){_0x35c7de[_0x182b('0x41')]=[{'all':!![]}];}_0x35c7de=_['merge']({},_0x35c7de,_0x507c4e['options']);return db[_0x182b('0x2a')]['find'](_0x35c7de)[_0x182b('0x25')](handleEntityNotFound(_0x89e36a,null))[_0x182b('0x25')](respondWithResult(_0x89e36a,null))[_0x182b('0x43')](handleError(_0x89e36a,null));};exports['create']=function(_0x2ca8b2,_0x3b43a7){return db[_0x182b('0x2a')][_0x182b('0x46')](_0x2ca8b2[_0x182b('0x47')],{})[_0x182b('0x25')](respondWithResult(_0x3b43a7,0xc9))[_0x182b('0x43')](handleError(_0x3b43a7,null));};exports['update']=function(_0x38141a,_0x29a345){if(_0x38141a['body']['id']){delete _0x38141a[_0x182b('0x47')]['id'];}return db[_0x182b('0x2a')][_0x182b('0x48')]({'where':{'id':_0x38141a[_0x182b('0x49')]['id']}})[_0x182b('0x25')](handleEntityNotFound(_0x29a345,null))[_0x182b('0x25')](saveUpdates(_0x38141a[_0x182b('0x47')],null))['then'](respondWithResult(_0x29a345,null))[_0x182b('0x43')](handleError(_0x29a345,null));};exports[_0x182b('0x26')]=function(_0x189ee6,_0x4c8de9){return db[_0x182b('0x2a')][_0x182b('0x48')]({'where':{'id':_0x189ee6['params']['id']}})[_0x182b('0x25')](handleEntityNotFound(_0x4c8de9,null))['then'](removeEntity(_0x4c8de9,null))[_0x182b('0x43')](handleError(_0x4c8de9,null));};exports['describe']=function(_0x25fc8c,_0x26f593){return db[_0x182b('0x2a')]['describe']()['then'](respondWithResult(_0x26f593,null))['catch'](handleError(_0x26f593,null));}; \ No newline at end of file +var _0xc4ef=['hasOwnProperty','where','filter','merge','type','then','includeAll','include','ChatTransferReport','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xc4ef,0x186));var _0xfc4e=function(_0x54fbff,_0x53470e){_0x54fbff=_0x54fbff-0x0;var _0x5cf619=_0xc4ef[_0x54fbff];return _0x5cf619;};'use strict';var emlformat=require(_0xfc4e('0x0'));var rimraf=require(_0xfc4e('0x1'));var zipdir=require(_0xfc4e('0x2'));var jsonpatch=require(_0xfc4e('0x3'));var rp=require(_0xfc4e('0x4'));var moment=require('moment');var BPromise=require(_0xfc4e('0x5'));var Mustache=require(_0xfc4e('0x6'));var util=require(_0xfc4e('0x7'));var path=require(_0xfc4e('0x8'));var sox=require('sox');var csv=require(_0xfc4e('0x9'));var ejs=require(_0xfc4e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfc4e('0xb'));var crypto=require(_0xfc4e('0xc'));var jsforce=require(_0xfc4e('0xd'));var deskjs=require(_0xfc4e('0xe'));var toCsv=require(_0xfc4e('0x9'));var querystring=require(_0xfc4e('0xf'));var Papa=require(_0xfc4e('0x10'));var Redis=require(_0xfc4e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfc4e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc4e('0x13'))(_0xfc4e('0x14'));var utils=require(_0xfc4e('0x15'));var config=require(_0xfc4e('0x16'));var licenseUtil=require(_0xfc4e('0x17'));var db=require(_0xfc4e('0x18'))['db'];function respondWithStatusCode(_0x263b63,_0x3326e7){_0x3326e7=_0x3326e7||0xcc;return function(_0x58350e){if(_0x58350e){return _0x263b63[_0xfc4e('0x19')](_0x3326e7);}return _0x263b63[_0xfc4e('0x1a')](_0x3326e7)[_0xfc4e('0x1b')]();};}function respondWithResult(_0x63c47e,_0x34bee7){_0x34bee7=_0x34bee7||0xc8;return function(_0x1fa4e3){if(_0x1fa4e3){return _0x63c47e['status'](_0x34bee7)['json'](_0x1fa4e3);}};}function respondWithFilteredResult(_0x743dfe,_0x5ca7a6){return function(_0x1d6f37){if(_0x1d6f37){var _0x329b55=typeof _0x5ca7a6[_0xfc4e('0x1c')]===_0xfc4e('0x1d')&&typeof _0x5ca7a6[_0xfc4e('0x1e')]===_0xfc4e('0x1d');var _0x26c656=_0x1d6f37[_0xfc4e('0x1f')];var _0x1251ec=_0x329b55?0x0:_0x5ca7a6['offset'];var _0x422c7f=_0x329b55?_0x1d6f37['count']:_0x5ca7a6[_0xfc4e('0x1c')]+_0x5ca7a6[_0xfc4e('0x1e')];var _0x2c0a9e;if(_0x422c7f>=_0x26c656){_0x422c7f=_0x26c656;_0x2c0a9e=0xc8;}else{_0x2c0a9e=0xce;}_0x743dfe[_0xfc4e('0x1a')](_0x2c0a9e);return _0x743dfe[_0xfc4e('0x20')](_0xfc4e('0x21'),_0x1251ec+'-'+_0x422c7f+'/'+_0x26c656)['json'](_0x1d6f37);}return null;};}function patchUpdates(_0x1243ab){return function(_0x407f05){try{jsonpatch[_0xfc4e('0x22')](_0x407f05,_0x1243ab,!![]);}catch(_0x2636ff){return BPromise[_0xfc4e('0x23')](_0x2636ff);}return _0x407f05[_0xfc4e('0x24')]();};}function saveUpdates(_0x1515dc,_0x3cb1df){return function(_0x2f18bb){if(_0x2f18bb){return _0x2f18bb[_0xfc4e('0x25')](_0x1515dc)['then'](function(_0x1166af){return _0x1166af;});}return null;};}function removeEntity(_0x18f842,_0x467b5f){return function(_0x5b60fa){if(_0x5b60fa){return _0x5b60fa['destroy']()['then'](function(){_0x18f842[_0xfc4e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10c95a,_0xcec202){return function(_0x4a5755){if(!_0x4a5755){_0x10c95a['sendStatus'](0x194);}return _0x4a5755;};}function handleError(_0x424d78,_0x466661){_0x466661=_0x466661||0x1f4;return function(_0x14c600){logger[_0xfc4e('0x26')](_0x14c600[_0xfc4e('0x27')]);if(_0x14c600[_0xfc4e('0x28')]){delete _0x14c600[_0xfc4e('0x28')];}_0x424d78[_0xfc4e('0x1a')](_0x466661)[_0xfc4e('0x29')](_0x14c600);};}exports[_0xfc4e('0x2a')]=function(_0xec3eec,_0x45cbbf){var _0x478dd3={},_0x126631={},_0x4e1992={'count':0x0,'rows':[]};var _0xa912a7=_[_0xfc4e('0x2b')](db['ChatTransferReport'][_0xfc4e('0x2c')],function(_0x3fe4cc){return{'name':_0x3fe4cc[_0xfc4e('0x2d')],'type':_0x3fe4cc['type']['key']};});_0x126631[_0xfc4e('0x2e')]=_[_0xfc4e('0x2b')](_0xa912a7,_0xfc4e('0x28'));_0x126631[_0xfc4e('0x2f')]=_[_0xfc4e('0x30')](_0xec3eec[_0xfc4e('0x2f')]);_0x126631[_0xfc4e('0x31')]=_['intersection'](_0x126631['model'],_0x126631[_0xfc4e('0x2f')]);_0x478dd3[_0xfc4e('0x32')]=_[_0xfc4e('0x33')](_0x126631[_0xfc4e('0x2e')],qs[_0xfc4e('0x34')](_0xec3eec[_0xfc4e('0x2f')]['fields']));_0x478dd3[_0xfc4e('0x32')]=_0x478dd3['attributes'][_0xfc4e('0x35')]?_0x478dd3[_0xfc4e('0x32')]:_0x126631['model'];if(!_0xec3eec[_0xfc4e('0x2f')][_0xfc4e('0x36')]('nolimit')){_0x478dd3[_0xfc4e('0x1e')]=qs[_0xfc4e('0x1e')](_0xec3eec[_0xfc4e('0x2f')][_0xfc4e('0x1e')]);_0x478dd3[_0xfc4e('0x1c')]=qs[_0xfc4e('0x1c')](_0xec3eec[_0xfc4e('0x2f')][_0xfc4e('0x1c')]);}_0x478dd3['order']=qs['sort'](_0xec3eec[_0xfc4e('0x2f')]['sort']);_0x478dd3[_0xfc4e('0x37')]=qs[_0xfc4e('0x31')](_['pick'](_0xec3eec[_0xfc4e('0x2f')],_0x126631[_0xfc4e('0x31')]),_0xa912a7);if(_0xec3eec[_0xfc4e('0x2f')][_0xfc4e('0x38')]){_0x478dd3['where']=_[_0xfc4e('0x39')](_0x478dd3[_0xfc4e('0x37')],{'$or':_[_0xfc4e('0x2b')](_0xa912a7,function(_0x163f1e){if(_0x163f1e[_0xfc4e('0x3a')]!=='VIRTUAL'){var _0x352df5={};_0x352df5[_0x163f1e['name']]={'$like':'%'+_0xec3eec[_0xfc4e('0x2f')][_0xfc4e('0x38')]+'%'};return _0x352df5;}})});}_0x478dd3=_[_0xfc4e('0x39')]({},_0x478dd3,_0xec3eec['options']);var _0x578f85={'where':_0x478dd3[_0xfc4e('0x37')]};return db['ChatTransferReport'][_0xfc4e('0x1f')](_0x578f85)[_0xfc4e('0x3b')](function(_0x129b62){_0x4e1992['count']=_0x129b62;if(_0xec3eec['query'][_0xfc4e('0x3c')]){_0x478dd3[_0xfc4e('0x3d')]=[{'all':!![]}];}return db[_0xfc4e('0x3e')][_0xfc4e('0x3f')](_0x478dd3);})['then'](function(_0x2a293f){_0x4e1992[_0xfc4e('0x40')]=_0x2a293f;return _0x4e1992;})['then'](respondWithFilteredResult(_0x45cbbf,_0x478dd3))[_0xfc4e('0x41')](handleError(_0x45cbbf,null));};exports[_0xfc4e('0x42')]=function(_0x3fc06d,_0x1e7e02){var _0x44a561={'raw':!![],'where':{'id':_0x3fc06d[_0xfc4e('0x43')]['id']}},_0x2e3899={};_0x2e3899[_0xfc4e('0x2e')]=_[_0xfc4e('0x30')](db[_0xfc4e('0x3e')][_0xfc4e('0x2c')]);_0x2e3899['query']=_['keys'](_0x3fc06d[_0xfc4e('0x2f')]);_0x2e3899[_0xfc4e('0x31')]=_[_0xfc4e('0x33')](_0x2e3899[_0xfc4e('0x2e')],_0x2e3899[_0xfc4e('0x2f')]);_0x44a561[_0xfc4e('0x32')]=_['intersection'](_0x2e3899['model'],qs[_0xfc4e('0x34')](_0x3fc06d[_0xfc4e('0x2f')][_0xfc4e('0x34')]));_0x44a561[_0xfc4e('0x32')]=_0x44a561[_0xfc4e('0x32')]['length']?_0x44a561[_0xfc4e('0x32')]:_0x2e3899[_0xfc4e('0x2e')];if(_0x3fc06d[_0xfc4e('0x2f')]['includeAll']){_0x44a561['include']=[{'all':!![]}];}_0x44a561=_[_0xfc4e('0x39')]({},_0x44a561,_0x3fc06d[_0xfc4e('0x44')]);return db[_0xfc4e('0x3e')][_0xfc4e('0x45')](_0x44a561)[_0xfc4e('0x3b')](handleEntityNotFound(_0x1e7e02,null))[_0xfc4e('0x3b')](respondWithResult(_0x1e7e02,null))[_0xfc4e('0x41')](handleError(_0x1e7e02,null));};exports[_0xfc4e('0x46')]=function(_0x2f8d4e,_0x1ff605){return db['ChatTransferReport'][_0xfc4e('0x46')](_0x2f8d4e[_0xfc4e('0x47')],{})[_0xfc4e('0x3b')](respondWithResult(_0x1ff605,0xc9))[_0xfc4e('0x41')](handleError(_0x1ff605,null));};exports[_0xfc4e('0x25')]=function(_0x5a7cb0,_0x1166ac){if(_0x5a7cb0['body']['id']){delete _0x5a7cb0[_0xfc4e('0x47')]['id'];}return db['ChatTransferReport'][_0xfc4e('0x45')]({'where':{'id':_0x5a7cb0['params']['id']}})[_0xfc4e('0x3b')](handleEntityNotFound(_0x1166ac,null))[_0xfc4e('0x3b')](saveUpdates(_0x5a7cb0['body'],null))[_0xfc4e('0x3b')](respondWithResult(_0x1166ac,null))[_0xfc4e('0x41')](handleError(_0x1166ac,null));};exports[_0xfc4e('0x48')]=function(_0x4f69b2,_0x2c384b){return db['ChatTransferReport']['find']({'where':{'id':_0x4f69b2[_0xfc4e('0x43')]['id']}})[_0xfc4e('0x3b')](handleEntityNotFound(_0x2c384b,null))['then'](removeEntity(_0x2c384b,null))['catch'](handleError(_0x2c384b,null));};exports['describe']=function(_0x4d79ed,_0x3ae8fc){return db['ChatTransferReport'][_0xfc4e('0x49')]()['then'](respondWithResult(_0x3ae8fc,null))['catch'](handleError(_0x3ae8fc,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 7998b40..56c1cc4 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 _0xd618=['path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','request-promise'];(function(_0x2b30a3,_0x24db19){var _0x34ab96=function(_0xaa913e){while(--_0xaa913e){_0x2b30a3['push'](_0x2b30a3['shift']());}};_0x34ab96(++_0x24db19);}(_0xd618,0x159));var _0x8d61=function(_0x3c1462,_0x4efc2c){_0x3c1462=_0x3c1462-0x0;var _0x4639cb=_0xd618[_0x3c1462];return _0x4639cb;};'use strict';var _=require(_0x8d61('0x0'));var util=require(_0x8d61('0x1'));var logger=require('../../config/logger')(_0x8d61('0x2'));var moment=require(_0x8d61('0x3'));var BPromise=require('bluebird');var rp=require(_0x8d61('0x4'));var fs=require('fs');var path=require(_0x8d61('0x5'));var rimraf=require(_0x8d61('0x6'));var config=require(_0x8d61('0x7'));var attributes=require(_0x8d61('0x8'));module[_0x8d61('0x9')]=function(_0x5e901e,_0x50ea84){return _0x5e901e[_0x8d61('0xa')](_0x8d61('0xb'),attributes,{'tableName':_0x8d61('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8d61('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc9a=['./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x4002f4,_0x36d357){var _0x348927=function(_0x165e63){while(--_0x165e63){_0x4002f4['push'](_0x4002f4['shift']());}};_0x348927(++_0x36d357);}(_0xdc9a,0x7d));var _0xadc9=function(_0x5286ac,_0x2ff1b4){_0x5286ac=_0x5286ac-0x0;var _0x4942ef=_0xdc9a[_0x5286ac];return _0x4942ef;};'use strict';var _=require('lodash');var util=require(_0xadc9('0x0'));var logger=require(_0xadc9('0x1'))(_0xadc9('0x2'));var moment=require(_0xadc9('0x3'));var BPromise=require(_0xadc9('0x4'));var rp=require(_0xadc9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xadc9('0x6'));var attributes=require(_0xadc9('0x7'));module[_0xadc9('0x8')]=function(_0x205628,_0x24a16c){return _0x205628[_0xadc9('0x9')]('ChatTransferReport',attributes,{'tableName':_0xadc9('0xa'),'paranoid':![],'indexes':[{'name':_0xadc9('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index fd94b00..85cb768 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 _0x0f79=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x2859d4,_0x163d14){var _0x353128=function(_0x81e2a){while(--_0x81e2a){_0x2859d4['push'](_0x2859d4['shift']());}};_0x353128(++_0x163d14);}(_0x0f79,0x1a9));var _0x90f7=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x0f79[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x90f7('0x0'));var util=require(_0x90f7('0x1'));var moment=require(_0x90f7('0x2'));var BPromise=require(_0x90f7('0x3'));var rs=require(_0x90f7('0x4'));var fs=require('fs');var Redis=require(_0x90f7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x90f7('0x6'));var logger=require(_0x90f7('0x7'))('rpc');var config=require(_0x90f7('0x8'));var jayson=require(_0x90f7('0x9'));var client=jayson[_0x90f7('0xa')][_0x90f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a7cc8,_0x4698c0,_0x4c2894){return new BPromise(function(_0x16351d,_0x295abb){return client[_0x90f7('0xc')](_0x4a7cc8,_0x4c2894)['then'](function(_0x9cd6a){logger[_0x90f7('0xd')](_0x90f7('0xe'),_0x4698c0,_0x90f7('0xf'));logger[_0x90f7('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4698c0,_0x90f7('0xf'),JSON[_0x90f7('0x11')](_0x9cd6a));if(_0x9cd6a[_0x90f7('0x12')]){if(_0x9cd6a[_0x90f7('0x12')][_0x90f7('0x13')]===0x1f4){logger[_0x90f7('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x4698c0,_0x9cd6a[_0x90f7('0x12')]['message']);return _0x295abb(_0x9cd6a['error'][_0x90f7('0x14')]);}logger[_0x90f7('0x12')](_0x90f7('0xe'),_0x4698c0,_0x9cd6a['error'][_0x90f7('0x14')]);return _0x16351d(_0x9cd6a[_0x90f7('0x12')][_0x90f7('0x14')]);}else{logger[_0x90f7('0xd')](_0x90f7('0xe'),_0x4698c0,_0x90f7('0xf'));_0x16351d(_0x9cd6a['result']['message']);}})[_0x90f7('0x15')](function(_0x2fae53){logger[_0x90f7('0x12')](_0x90f7('0xe'),_0x4698c0,_0x2fae53);_0x295abb(_0x2fae53);});});} \ No newline at end of file +var _0xe33d=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x62e4a1,_0x3c2605){var _0x974565=function(_0x3754c0){while(--_0x3754c0){_0x62e4a1['push'](_0x62e4a1['shift']());}};_0x974565(++_0x3c2605);}(_0xe33d,0xb0));var _0xde33=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xe33d[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0xde33('0x0'));var util=require('util');var moment=require(_0xde33('0x1'));var BPromise=require(_0xde33('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde33('0x3'));var db=require(_0xde33('0x4'))['db'];var utils=require(_0xde33('0x5'));var logger=require(_0xde33('0x6'))(_0xde33('0x7'));var config=require(_0xde33('0x8'));var jayson=require(_0xde33('0x9'));var client=jayson[_0xde33('0xa')][_0xde33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b2b6b,_0x16ed4a,_0x4e515f){return new BPromise(function(_0x358742,_0x1c4f17){return client['request'](_0x3b2b6b,_0x4e515f)[_0xde33('0xc')](function(_0x5dd2a5){logger[_0xde33('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x16ed4a,_0xde33('0xe'));logger[_0xde33('0xf')](_0xde33('0x10'),_0x16ed4a,_0xde33('0xe'),JSON[_0xde33('0x11')](_0x5dd2a5));if(_0x5dd2a5[_0xde33('0x12')]){if(_0x5dd2a5[_0xde33('0x12')][_0xde33('0x13')]===0x1f4){logger['error'](_0xde33('0x14'),_0x16ed4a,_0x5dd2a5[_0xde33('0x12')][_0xde33('0x15')]);return _0x1c4f17(_0x5dd2a5[_0xde33('0x12')][_0xde33('0x15')]);}logger[_0xde33('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x16ed4a,_0x5dd2a5[_0xde33('0x12')][_0xde33('0x15')]);return _0x358742(_0x5dd2a5['error'][_0xde33('0x15')]);}else{logger[_0xde33('0xd')](_0xde33('0x14'),_0x16ed4a,_0xde33('0xe'));_0x358742(_0x5dd2a5[_0xde33('0x16')][_0xde33('0x15')]);}})[_0xde33('0x17')](function(_0x45e98e){logger[_0xde33('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x16ed4a,_0x45e98e);_0x1c4f17(_0x45e98e);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 27eb97f..0906199 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 _0xc4b3=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x259368,_0x3ff697){var _0x9d7f35=function(_0x30bed3){while(--_0x30bed3){_0x259368['push'](_0x259368['shift']());}};_0x9d7f35(++_0x3ff697);}(_0xc4b3,0x1ed));var _0x3c4b=function(_0x2ad927,_0x5527cf){_0x2ad927=_0x2ad927-0x0;var _0x452b61=_0xc4b3[_0x2ad927];return _0x452b61;};'use strict';var multer=require(_0x3c4b('0x0'));var util=require(_0x3c4b('0x1'));var path=require('path');var timeout=require(_0x3c4b('0x2'));var express=require(_0x3c4b('0x3'));var router=express[_0x3c4b('0x4')]();var fs_extra=require(_0x3c4b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3c4b('0x6'));var config=require(_0x3c4b('0x7'));var controller=require(_0x3c4b('0x8'));router[_0x3c4b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3c4b('0xa'),auth[_0x3c4b('0xb')](),controller[_0x3c4b('0xc')]);router[_0x3c4b('0x9')](_0x3c4b('0xd'),auth[_0x3c4b('0xb')](),controller[_0x3c4b('0xe')]);router[_0x3c4b('0xf')]('/',auth[_0x3c4b('0xb')](),controller[_0x3c4b('0x10')]);router[_0x3c4b('0x11')](_0x3c4b('0xd'),auth[_0x3c4b('0xb')](),controller[_0x3c4b('0x12')]);router[_0x3c4b('0x13')](_0x3c4b('0xd'),auth['isAuthenticated'](),controller[_0x3c4b('0x14')]);module[_0x3c4b('0x15')]=router; \ No newline at end of file +var _0x6db8=['show','post','create','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4bf0a3,_0x375172){var _0x366e64=function(_0x1b0636){while(--_0x1b0636){_0x4bf0a3['push'](_0x4bf0a3['shift']());}};_0x366e64(++_0x375172);}(_0x6db8,0x17d));var _0x86db=function(_0x5b26cb,_0x527ab0){_0x5b26cb=_0x5b26cb-0x0;var _0x563d12=_0x6db8[_0x5b26cb];return _0x563d12;};'use strict';var multer=require(_0x86db('0x0'));var util=require(_0x86db('0x1'));var path=require(_0x86db('0x2'));var timeout=require('connect-timeout');var express=require(_0x86db('0x3'));var router=express['Router']();var fs_extra=require(_0x86db('0x4'));var auth=require(_0x86db('0x5'));var interaction=require(_0x86db('0x6'));var config=require(_0x86db('0x7'));var controller=require(_0x86db('0x8'));router[_0x86db('0x9')]('/',auth[_0x86db('0xa')](),controller[_0x86db('0xb')]);router['get'](_0x86db('0xc'),auth[_0x86db('0xa')](),controller[_0x86db('0xd')]);router[_0x86db('0x9')](_0x86db('0xe'),auth[_0x86db('0xa')](),controller[_0x86db('0xf')]);router[_0x86db('0x10')]('/',auth['isAuthenticated'](),controller[_0x86db('0x11')]);router[_0x86db('0x12')](_0x86db('0xe'),auth['isAuthenticated'](),controller[_0x86db('0x13')]);router[_0x86db('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x86db('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index b2d3a16..603fec0 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 _0xb203=['star','thumb','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','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','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb203,0x82));var _0x3b20=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb203[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x3b20('0x0'));var rs=require(_0x3b20('0x1'));module[_0x3b20('0x2')]={'name':{'type':Sequelize[_0x3b20('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x3b20('0x3')],'allowNull':![],'unique':_0x3b20('0x4')},'description':{'type':Sequelize[_0x3b20('0x3')]},'mapKey':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x5')},'key':{'type':Sequelize[_0x3b20('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3b20('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3b20('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3b20('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3b20('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3b20('0xa')](_0x3b20('0xb'),'squared'),'defaultValue':_0x3b20('0xb')},'header_online':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3b20('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3b20('0xd')},'header_offline':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3b20('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3b20('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x3b20('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x12')},'noteTitle':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x13')},'placeholderMessage':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x14')},'closingMessage':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0xd')},'skipMessageButton':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x15')},'conditionAgreement':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x16')},'ratingType':{'type':Sequelize[_0x3b20('0xa')](_0x3b20('0x17'),_0x3b20('0x18')),'defaultValue':_0x3b20('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x3b20('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3b20('0x10')],'defaultValue':function(){return JSON[_0x3b20('0x19')]({'items':[{'type':_0x3b20('0x1a'),'variable':null,'config':{'placeholder':_0x3b20('0x1b'),'type':_0x3b20('0x1c'),'required':!![]},'props':{'title':_0x3b20('0x1b'),'helpText':''}},{'type':_0x3b20('0x1a'),'props':{'title':_0x3b20('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3b20('0x5'),'type':_0x3b20('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x3b20('0x1d'))?JSON[_0x3b20('0x1e')](this[_0x3b20('0x1f')](_0x3b20('0x1d'))):{};},'set':function(_0x39eb12){return this[_0x3b20('0x20')](_0x3b20('0x1d'),JSON[_0x3b20('0x19')](_0x39eb12));}},'offlineForm':{'type':Sequelize[_0x3b20('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x3b20('0x1a'),'props':{'title':_0x3b20('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3b20('0x5'),'type':_0x3b20('0x5')},'variable':null},{'type':_0x3b20('0x21'),'config':{'placeholder':_0x3b20('0x22')},'props':{'title':_0x3b20('0x22'),'helpText':_0x3b20('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x3b20('0x1f')](_0x3b20('0x24'))?JSON['parse'](this[_0x3b20('0x1f')](_0x3b20('0x24'))):{};},'set':function(_0x203697){return this[_0x3b20('0x20')](_0x3b20('0x24'),JSON[_0x3b20('0x19')](_0x203697));}},'token':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3b20('0x3')]},'forwardOffline':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3b20('0x3')]},'waitingTitle':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x25')},'waitingMessage':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x26')},'offlineMessageBody':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x28')},'skipUnmanaged':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x15')},'sendUnmanaged':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3b20('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3b20('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3b20('0x10')],'defaultValue':function(){return _0x3b20('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x3b20('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x2a')},'verticalAlignment':{'type':Sequelize[_0x3b20('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x2b')},'defaultTitle':{'type':Sequelize[_0x3b20('0x3')]},'customerAvatar':{'type':Sequelize[_0x3b20('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3b20('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3b20('0x3')],'allowNull':![],'defaultValue':_0x3b20('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3b20('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3b20('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3b20('0x8')],'comment':_0x3b20('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![],'comment':_0x3b20('0x2e'),'set':function(_0x4e49ab){if(!_0x4e49ab)this['setDataValue'](_0x3b20('0x2f'),null);this['setDataValue'](_0x3b20('0x30'),_0x4e49ab);}},'vidaooEscalation':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3b20('0x3')]},'vidaooTopic':{'type':Sequelize[_0x3b20('0x3')],'allowNull':![],'defaultValue':_0x3b20('0x31')},'vidaooNote':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':function(){return _0x3b20('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x3b20('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x3b20('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3b20('0x10')]}}; \ No newline at end of file +var _0x8f34=['Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','email','#011F6A','INTEGER','rounded','squared','We\x20are\x20here!','Chat','Send','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Feedback','ENUM','star','stringify','name','text','input','setDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.'];(function(_0x275676,_0x3377a6){var _0x5550b=function(_0x548c66){while(--_0x548c66){_0x275676['push'](_0x275676['shift']());}};_0x5550b(++_0x3377a6);}(_0x8f34,0xeb));var _0x48f3=function(_0x6378ce,_0x212003){_0x6378ce=_0x6378ce-0x0;var _0x3a2027=_0x8f34[_0x6378ce];return _0x3a2027;};'use strict';var Sequelize=require(_0x48f3('0x0'));var rs=require(_0x48f3('0x1'));module['exports']={'name':{'type':Sequelize[_0x48f3('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x48f3('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x48f3('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x48f3('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x48f3('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x48f3('0x2')],'allowNull':![],'defaultValue':_0x48f3('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x48f3('0x2')],'allowNull':![],'defaultValue':_0x48f3('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x48f3('0x5')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x48f3('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x48f3('0x6'),_0x48f3('0x7')),'defaultValue':_0x48f3('0x6')},'header_online':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':_0x48f3('0x8')},'start_chat_button':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':_0x48f3('0x9')},'offline_chat_button':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':_0x48f3('0xa')},'header_offline':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':_0x48f3('0xc')},'defaultWhiteLabel':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x48f3('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x48f3('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':_0x48f3('0xf')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':_0x48f3('0x10')},'closingMessage':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':_0x48f3('0xa')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':_0x48f3('0x11')},'ratingType':{'type':Sequelize[_0x48f3('0x12')]('star','thumb'),'defaultValue':_0x48f3('0x13')},'ratingStarsNumber':{'type':Sequelize[_0x48f3('0x5')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x48f3('0x14')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x48f3('0x15'),'type':_0x48f3('0x16'),'required':!![]},'props':{'title':_0x48f3('0x15'),'helpText':''}},{'type':_0x48f3('0x17'),'props':{'title':_0x48f3('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x48f3('0x3'),'type':_0x48f3('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x4c8bf2){return this[_0x48f3('0x18')](_0x48f3('0x19'),JSON[_0x48f3('0x14')](_0x4c8bf2));}},'offlineForm':{'type':Sequelize[_0x48f3('0xd')],'defaultValue':function(){return JSON[_0x48f3('0x14')]({'items':[{'type':_0x48f3('0x17'),'props':{'title':_0x48f3('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x48f3('0x3'),'type':_0x48f3('0x3')},'variable':null},{'type':_0x48f3('0x1a'),'config':{'placeholder':_0x48f3('0x1b')},'props':{'title':_0x48f3('0x1b'),'helpText':_0x48f3('0x1c')}}],'fromKey':0x0});},'get':function(){return this[_0x48f3('0x1d')](_0x48f3('0x1e'))?JSON['parse'](this[_0x48f3('0x1d')](_0x48f3('0x1e'))):{};},'set':function(_0x67e581){return this[_0x48f3('0x18')]('offlineForm',JSON['stringify'](_0x67e581));}},'token':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':function(){return rs[_0x48f3('0x1f')]();}},'autoclose':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x48f3('0x2')]},'forwardOffline':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x48f3('0x2')]},'waitingTitle':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':_0x48f3('0x20')},'waitingMessage':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':_0x48f3('0x21')},'offlineMessageSubject':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':_0x48f3('0x22')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x48f3('0x23')},'sendUnmanaged':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x48f3('0xd')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x48f3('0x2')]},'notificationTemplate':{'type':Sequelize[_0x48f3('0xd')],'defaultValue':function(){return _0x48f3('0x24');}},'notificationSound':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':_0x48f3('0x25')},'waitForTheAssignedAgent':{'type':Sequelize[_0x48f3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x48f3('0x26')},'verticalAlignment':{'type':Sequelize[_0x48f3('0x5')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x48f3('0x2')]},'customerAvatar':{'type':Sequelize[_0x48f3('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x48f3('0x5')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x48f3('0x2')],'allowNull':![],'defaultValue':_0x48f3('0x27'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x48f3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x48f3('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x48f3('0xd')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x48f3('0x5')],'comment':_0x48f3('0x28')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x48f3('0x29'),'set':function(_0x8697e){if(!_0x8697e)this[_0x48f3('0x18')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x48f3('0x2a'),_0x8697e);}},'vidaooEscalation':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x48f3('0x2')],'allowNull':![],'defaultValue':_0x48f3('0x2b')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x48f3('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0x48f3('0xd')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x48f3('0xb')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x48f3('0xd')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index f0afdef..6e68c8b 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 _0x6046=['getLogo','join','root','server/files/images/logos/default_logo.svg','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','account','applications','orderBy','priority','from','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','offline','no\x20available\x20attributes','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','originalname','server','files','attachments','offline-chat','basename','openNewInteraction','Attachment','bulkCreate','MailServerOut','Smtp','service','host','port','secure','pass','SendMail','sendMail','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','Contact','Owner','internal','Tag','color','tag','Command','timezone','iftime\x20%s,%s','interval','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','inspect','getSnippet','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','remote','stringify','connection','remoteAddress','replace','backgroundColor','addApplications','sequelize','ChatApplication','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatWebsite.socket','jayson/promise','client','http','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','ChatWebsite,\x20%s,\x20%s','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','findAll','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','customerAvatar','systemAvatar'];(function(_0x2136b3,_0x4df7a6){var _0x48eec=function(_0x38677a){while(--_0x38677a){_0x2136b3['push'](_0x2136b3['shift']());}};_0x48eec(++_0x4df7a6);}(_0x6046,0x1e5));var _0x6604=function(_0x52a727,_0x5ce968){_0x52a727=_0x52a727-0x0;var _0xa1f633=_0x6046[_0x52a727];return _0xa1f633;};'use strict';var emlformat=require(_0x6604('0x0'));var rimraf=require(_0x6604('0x1'));var zipdir=require(_0x6604('0x2'));var jsonpatch=require(_0x6604('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6604('0x4'));var util=require(_0x6604('0x5'));var path=require('path');var sox=require(_0x6604('0x6'));var csv=require('to-csv');var ejs=require(_0x6604('0x7'));var fs=require('fs');var fs_extra=require(_0x6604('0x8'));var _=require(_0x6604('0x9'));var squel=require(_0x6604('0xa'));var crypto=require(_0x6604('0xb'));var jsforce=require(_0x6604('0xc'));var deskjs=require(_0x6604('0xd'));var toCsv=require(_0x6604('0xe'));var querystring=require(_0x6604('0xf'));var Papa=require(_0x6604('0x10'));var Redis=require(_0x6604('0x11'));var authService=require(_0x6604('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6604('0x13'));var hardwareService=require(_0x6604('0x14'));var logger=require(_0x6604('0x15'))(_0x6604('0x16'));var utils=require(_0x6604('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6604('0x18'));var db=require(_0x6604('0x19'))['db'];config['redis']=_[_0x6604('0x1a')](config[_0x6604('0x1b')],{'host':_0x6604('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6604('0x1b')]));require(_0x6604('0x1d'))['register'](socket);var jayson=require(_0x6604('0x1e'));var client=jayson[_0x6604('0x1f')][_0x6604('0x20')]({'port':0x232c});var client9002=jayson[_0x6604('0x1f')][_0x6604('0x20')]({'port':0x232a});var client9003=jayson[_0x6604('0x1f')][_0x6604('0x20')]({'port':0x232b});var client9001=jayson[_0x6604('0x1f')][_0x6604('0x20')]({'port':0x2329});function respondWithRpcPromise(_0x3853e4,_0x557c54,_0xd99ece,_0x443d3d){return new BPromise(function(_0xb22130,_0x22d335){var _0x4482f9=_0x443d3d||client;return _0x4482f9[_0x6604('0x21')](_0x3853e4,_0xd99ece)[_0x6604('0x22')](function(_0x5aa942){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x557c54,_0x6604('0x23'));logger[_0x6604('0x24')](_0x6604('0x25'),_0x557c54,_0x6604('0x23'),JSON['stringify'](_0x5aa942));if(_0x5aa942[_0x6604('0x26')]){if(_0x5aa942[_0x6604('0x26')][_0x6604('0x27')]===0x1f4){logger[_0x6604('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x557c54,_0x5aa942[_0x6604('0x26')][_0x6604('0x28')]);return _0x22d335(_0x5aa942[_0x6604('0x26')][_0x6604('0x28')]);}logger[_0x6604('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x557c54,_0x5aa942[_0x6604('0x26')]['message']);return _0xb22130(_0x5aa942[_0x6604('0x26')][_0x6604('0x28')]);}else{logger['info'](_0x6604('0x29'),_0x557c54,_0x6604('0x23'));_0xb22130(_0x5aa942['result']['message']);}})[_0x6604('0x2a')](function(_0x3b091e){logger['error'](_0x6604('0x29'),_0x557c54,_0x3b091e);_0x22d335(_0x3b091e);});});}function respondWithStatusCode(_0x4064e1,_0x35d38d){_0x35d38d=_0x35d38d||0xcc;return function(_0x452490){if(_0x452490){return _0x4064e1[_0x6604('0x2b')](_0x35d38d);}return _0x4064e1[_0x6604('0x2c')](_0x35d38d)[_0x6604('0x2d')]();};}function respondWithResult(_0x2319fa,_0x36d3a4){_0x36d3a4=_0x36d3a4||0xc8;return function(_0x30e7a3){if(_0x30e7a3){return _0x2319fa[_0x6604('0x2c')](_0x36d3a4)[_0x6604('0x2e')](_0x30e7a3);}};}function respondWithFilteredResult(_0x2c1cc8,_0x5c598e){return function(_0x2c0d88){if(_0x2c0d88){var _0x2da942=typeof _0x5c598e['offset']==='undefined'&&typeof _0x5c598e[_0x6604('0x2f')]===_0x6604('0x30');var _0x566441=_0x2c0d88[_0x6604('0x31')];var _0x7f20aa=_0x2da942?0x0:_0x5c598e[_0x6604('0x32')];var _0x45775c=_0x2da942?_0x2c0d88[_0x6604('0x31')]:_0x5c598e[_0x6604('0x32')]+_0x5c598e[_0x6604('0x2f')];var _0x816102;if(_0x45775c>=_0x566441){_0x45775c=_0x566441;_0x816102=0xc8;}else{_0x816102=0xce;}_0x2c1cc8['status'](_0x816102);return _0x2c1cc8[_0x6604('0x33')](_0x6604('0x34'),_0x7f20aa+'-'+_0x45775c+'/'+_0x566441)[_0x6604('0x2e')](_0x2c0d88);}return null;};}function patchUpdates(_0x532da4){return function(_0x2e99e5){try{jsonpatch[_0x6604('0x35')](_0x2e99e5,_0x532da4,!![]);}catch(_0x1252af){return BPromise[_0x6604('0x36')](_0x1252af);}return _0x2e99e5['save']();};}function saveUpdates(_0x25e308,_0x5591a3){return function(_0x3109b9){if(_0x3109b9){return _0x3109b9[_0x6604('0x37')](_0x25e308)[_0x6604('0x22')](function(_0x55f606){return _0x55f606;});}return null;};}function removeEntity(_0x41d610,_0x45a2af){return function(_0x2a3464){if(_0x2a3464){return _0x2a3464['destroy']()[_0x6604('0x22')](function(){var _0x3b1ae4=_0x2a3464[_0x6604('0x38')]({'plain':!![]});var _0x401994=_0x6604('0x39');return db[_0x6604('0x3a')][_0x6604('0x3b')]({'where':{'type':_0x401994,'resourceId':_0x3b1ae4['id']}})['then'](function(){return _0x2a3464;});})['then'](function(){_0x41d610['status'](0xcc)[_0x6604('0x2d')]();});}};}function handleEntityNotFound(_0x536329,_0x2052fb){return function(_0x1956a1){if(!_0x1956a1){_0x536329['sendStatus'](0x194);}return _0x1956a1;};}function handleError(_0x32be37,_0x12d66a){_0x12d66a=_0x12d66a||0x1f4;return function(_0x56d61e){logger[_0x6604('0x26')](_0x56d61e[_0x6604('0x3c')]);if(_0x56d61e[_0x6604('0x3d')]){delete _0x56d61e[_0x6604('0x3d')];}_0x32be37[_0x6604('0x2c')](_0x12d66a)[_0x6604('0x3e')](_0x56d61e);};}exports[_0x6604('0x3f')]=function(_0x4954de,_0x29870d){var _0x7bbef7={'include':[{'model':db[_0x6604('0x40')],'as':_0x6604('0x41')}]},_0x36f93c={},_0x30419c={'count':0x0,'rows':[]};var _0x37a0fe=_[_0x6604('0x42')](db[_0x6604('0x43')][_0x6604('0x44')],function(_0x25343f){return{'name':_0x25343f[_0x6604('0x45')],'type':_0x25343f[_0x6604('0x46')][_0x6604('0x47')]};});_0x36f93c[_0x6604('0x48')]=_[_0x6604('0x42')](_0x37a0fe,_0x6604('0x3d'));_0x36f93c[_0x6604('0x49')]=_[_0x6604('0x4a')](_0x4954de['query']);_0x36f93c[_0x6604('0x4b')]=_[_0x6604('0x4c')](_0x36f93c[_0x6604('0x48')],_0x36f93c[_0x6604('0x49')]);_0x7bbef7[_0x6604('0x4d')]=_['intersection'](_0x36f93c[_0x6604('0x48')],qs[_0x6604('0x4e')](_0x4954de['query'][_0x6604('0x4e')]));_0x7bbef7['attributes']=_0x7bbef7['attributes'][_0x6604('0x4f')]?_0x7bbef7[_0x6604('0x4d')]:_0x36f93c['model'];if(!_0x4954de[_0x6604('0x49')][_0x6604('0x50')](_0x6604('0x51'))){_0x7bbef7['limit']=qs[_0x6604('0x2f')](_0x4954de['query'][_0x6604('0x2f')]);_0x7bbef7[_0x6604('0x32')]=qs[_0x6604('0x32')](_0x4954de[_0x6604('0x49')][_0x6604('0x32')]);}_0x7bbef7[_0x6604('0x52')]=qs[_0x6604('0x53')](_0x4954de[_0x6604('0x49')]['sort']);_0x7bbef7[_0x6604('0x54')]=qs[_0x6604('0x4b')](_[_0x6604('0x55')](_0x4954de['query'],_0x36f93c[_0x6604('0x4b')]),_0x37a0fe);if(_0x4954de[_0x6604('0x49')][_0x6604('0x56')]){_0x7bbef7['where']=_[_0x6604('0x57')](_0x7bbef7['where'],{'$or':_[_0x6604('0x42')](_0x37a0fe,function(_0x3de11c){if(_0x3de11c['type']!==_0x6604('0x58')){var _0xe2f7d={};_0xe2f7d[_0x3de11c[_0x6604('0x3d')]]={'$like':'%'+_0x4954de['query']['filter']+'%'};return _0xe2f7d;}})});}_0x7bbef7=_[_0x6604('0x57')]({},_0x7bbef7,_0x4954de[_0x6604('0x59')]);var _0x31dc3e={'where':_0x7bbef7[_0x6604('0x54')]};return db['ChatWebsite'][_0x6604('0x31')](_0x31dc3e)[_0x6604('0x22')](function(_0x31f1ab){_0x30419c[_0x6604('0x31')]=_0x31f1ab;if(_0x4954de[_0x6604('0x49')][_0x6604('0x5a')]){_0x7bbef7[_0x6604('0x5b')]=[{'all':!![]}];}return db[_0x6604('0x43')]['findAll'](_0x7bbef7);})[_0x6604('0x22')](function(_0x39959c){_0x30419c[_0x6604('0x5c')]=_0x39959c;return _0x30419c;})[_0x6604('0x22')](respondWithFilteredResult(_0x29870d,_0x7bbef7))[_0x6604('0x2a')](handleError(_0x29870d,null));};exports[_0x6604('0x5d')]=function(_0x2e7f48,_0x3e3a42){var _0x164af={'raw':![],'where':{'id':_0x2e7f48[_0x6604('0x5e')]['id']},'include':[{'model':db[_0x6604('0x40')],'as':_0x6604('0x41')}]},_0x581150={};_0x581150[_0x6604('0x48')]=_[_0x6604('0x4a')](db[_0x6604('0x43')]['rawAttributes']);_0x581150[_0x6604('0x49')]=_['keys'](_0x2e7f48[_0x6604('0x49')]);_0x581150[_0x6604('0x4b')]=_[_0x6604('0x4c')](_0x581150[_0x6604('0x48')],_0x581150[_0x6604('0x49')]);_0x164af['attributes']=_['intersection'](_0x581150[_0x6604('0x48')],qs['fields'](_0x2e7f48[_0x6604('0x49')][_0x6604('0x4e')]));_0x164af[_0x6604('0x4d')]=_0x164af[_0x6604('0x4d')][_0x6604('0x4f')]?_0x164af[_0x6604('0x4d')]:_0x581150[_0x6604('0x48')];if(_0x2e7f48[_0x6604('0x49')]['includeAll']){_0x164af[_0x6604('0x5b')]=[{'all':!![]}];}_0x164af=_[_0x6604('0x57')]({},_0x164af,_0x2e7f48['options']);return db['ChatWebsite']['find'](_0x164af)[_0x6604('0x22')](handleEntityNotFound(_0x3e3a42,null))[_0x6604('0x22')](respondWithResult(_0x3e3a42,null))[_0x6604('0x2a')](handleError(_0x3e3a42,null));};exports[_0x6604('0x5f')]=function(_0x4abb3d,_0x54c5e8){return db[_0x6604('0x43')]['create'](_0x4abb3d[_0x6604('0x60')],{})['then'](function(_0x41136b){var _0x1e9806=_0x4abb3d[_0x6604('0x61')][_0x6604('0x38')]({'plain':!![]});if(!_0x1e9806)throw new Error(_0x6604('0x62'));if(_0x1e9806[_0x6604('0x63')]==='user'){var _0x25ac5b=_0x41136b[_0x6604('0x38')]({'plain':!![]});var _0x1c3b0d=_0x6604('0x39');return db[_0x6604('0x64')][_0x6604('0x65')]({'where':{'name':_0x1c3b0d,'userProfileId':_0x1e9806[_0x6604('0x66')]},'raw':!![]})['then'](function(_0x511498){if(_0x511498&&_0x511498[_0x6604('0x67')]===0x0){return db['UserProfileResource'][_0x6604('0x5f')]({'name':_0x25ac5b[_0x6604('0x3d')],'resourceId':_0x25ac5b['id'],'type':_0x511498[_0x6604('0x3d')],'sectionId':_0x511498['id']},{})[_0x6604('0x22')](function(){return _0x41136b;});}else{return _0x41136b;}})[_0x6604('0x2a')](function(_0x25f4e0){logger[_0x6604('0x26')](_0x6604('0x68'),_0x25f4e0);throw _0x25f4e0;});}return _0x41136b;})['then'](respondWithResult(_0x54c5e8,0xc9))[_0x6604('0x2a')](handleError(_0x54c5e8,null));};exports['update']=function(_0x42f82d,_0x108b5f){if(_0x42f82d['body']['id']){delete _0x42f82d['body']['id'];}return db[_0x6604('0x43')]['find']({'where':{'id':_0x42f82d['params']['id']},'include':[{'model':db[_0x6604('0x40')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x108b5f,null))[_0x6604('0x22')](saveUpdates(_0x42f82d['body'],null))['then'](respondWithResult(_0x108b5f,null))[_0x6604('0x2a')](handleError(_0x108b5f,null));};exports[_0x6604('0x3b')]=function(_0x30c72c,_0x6a21ef){return db['ChatWebsite'][_0x6604('0x65')]({'where':{'id':_0x30c72c[_0x6604('0x5e')]['id']}})['then'](handleEntityNotFound(_0x6a21ef,null))[_0x6604('0x22')](removeEntity(_0x6a21ef,null))[_0x6604('0x2a')](handleError(_0x6a21ef,null));};exports[_0x6604('0x69')]=function(_0x55c1c2,_0x64a7d9){return db[_0x6604('0x43')]['describe']()[_0x6604('0x22')](respondWithResult(_0x64a7d9,null))['catch'](handleError(_0x64a7d9,null));};exports['addDisposition']=function(_0x346dcb,_0x5335f8,_0x2cf3ee){if(_0x346dcb['body']['id']){delete _0x346dcb[_0x6604('0x60')]['id'];}return db[_0x6604('0x43')][_0x6604('0x65')]({'where':{'id':_0x346dcb[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x5335f8,null))[_0x6604('0x22')](function(_0x136abe){if(_0x136abe){_0x346dcb[_0x6604('0x60')][_0x6604('0x6a')]=_0x136abe['id'];return db[_0x6604('0x6b')]['create'](_0x346dcb[_0x6604('0x60')]);}})['then'](respondWithResult(_0x5335f8,null))['catch'](handleError(_0x5335f8,null));};exports['getDispositions']=function(_0x3f5eaf,_0x515249,_0xabd3d5){var _0x4494cc={'raw':![],'where':{}};var _0x5a83e8={};var _0x47c82f={'count':0x0,'rows':[]};return db[_0x6604('0x43')]['findOne']({'where':{'id':_0x3f5eaf['params']['id']}})['then'](handleEntityNotFound(_0x515249,null))['then'](function(_0x4f5d32){if(_0x4f5d32){_0x5a83e8['model']=_[_0x6604('0x4a')](db[_0x6604('0x6b')][_0x6604('0x44')]);_0x5a83e8[_0x6604('0x49')]=_[_0x6604('0x4a')](_0x3f5eaf['query']);_0x5a83e8['filters']=_[_0x6604('0x4c')](_0x5a83e8[_0x6604('0x48')],_0x5a83e8[_0x6604('0x49')]);_0x4494cc['attributes']=_[_0x6604('0x4c')](_0x5a83e8[_0x6604('0x48')],qs[_0x6604('0x4e')](_0x3f5eaf[_0x6604('0x49')][_0x6604('0x4e')]));_0x4494cc[_0x6604('0x4d')]=_0x4494cc[_0x6604('0x4d')]['length']?_0x4494cc[_0x6604('0x4d')]:_0x5a83e8['model'];if(!_0x3f5eaf[_0x6604('0x49')][_0x6604('0x50')](_0x6604('0x51'))){_0x4494cc[_0x6604('0x2f')]=qs[_0x6604('0x2f')](_0x3f5eaf[_0x6604('0x49')]['limit']);_0x4494cc[_0x6604('0x32')]=qs['offset'](_0x3f5eaf['query'][_0x6604('0x32')]);}_0x4494cc['order']=qs[_0x6604('0x53')](_0x3f5eaf[_0x6604('0x49')][_0x6604('0x53')]);_0x4494cc['where']=qs[_0x6604('0x4b')](_[_0x6604('0x55')](_0x3f5eaf[_0x6604('0x49')],_0x5a83e8[_0x6604('0x4b')]));_0x4494cc[_0x6604('0x54')][_0x6604('0x6a')]=_0x4f5d32['id'];if(_0x3f5eaf['query'][_0x6604('0x56')]){_0x4494cc[_0x6604('0x54')]=_['merge'](_0x4494cc[_0x6604('0x54')],{'$or':_[_0x6604('0x42')](_0x4494cc[_0x6604('0x4d')],function(_0x1a52ec){var _0xfb81bf={};_0xfb81bf[_0x1a52ec]={'$like':'%'+_0x3f5eaf[_0x6604('0x49')][_0x6604('0x56')]+'%'};return _0xfb81bf;})});}_0x4494cc=_[_0x6604('0x57')]({},_0x4494cc,_0x3f5eaf[_0x6604('0x59')]);return db[_0x6604('0x6b')][_0x6604('0x31')]({'where':_0x4494cc[_0x6604('0x54')]})['then'](function(_0x4d3fde){_0x47c82f[_0x6604('0x31')]=_0x4d3fde;if(_0x3f5eaf[_0x6604('0x49')]['includeAll']){_0x4494cc[_0x6604('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0x6604('0x6c')](_0x4494cc);})['then'](function(_0x1bc206){_0x47c82f[_0x6604('0x5c')]=_0x1bc206;return _0x47c82f;});}})['then'](respondWithFilteredResult(_0x515249,_0x4494cc))[_0x6604('0x2a')](handleError(_0x515249,null));};exports[_0x6604('0x6d')]=function(_0x14d916,_0x4a4da1,_0x333ad7){return db['ChatWebsite'][_0x6604('0x65')]({'where':{'id':_0x14d916[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x4a4da1,null))[_0x6604('0x22')](function(_0x10a3b3){if(_0x10a3b3){return _0x10a3b3[_0x6604('0x6d')](_0x14d916[_0x6604('0x49')][_0x6604('0x6e')]);}})['then'](respondWithStatusCode(_0x4a4da1,null))[_0x6604('0x2a')](handleError(_0x4a4da1,null));};exports['addAnswer']=function(_0x1fe4ee,_0x200d20,_0x42568d){if(_0x1fe4ee['body']['id']){delete _0x1fe4ee[_0x6604('0x60')]['id'];}return db[_0x6604('0x43')][_0x6604('0x65')]({'where':{'id':_0x1fe4ee[_0x6604('0x5e')]['id']}})['then'](handleEntityNotFound(_0x200d20,null))[_0x6604('0x22')](function(_0x17b973){if(_0x17b973){_0x1fe4ee[_0x6604('0x60')][_0x6604('0x6a')]=_0x17b973['id'];return db[_0x6604('0x6f')]['create'](_0x1fe4ee[_0x6604('0x60')]);}})[_0x6604('0x22')](respondWithResult(_0x200d20,null))['catch'](handleError(_0x200d20,null));};exports[_0x6604('0x70')]=function(_0x264bc2,_0x5914de,_0x138fda){var _0x41f739={'raw':![],'where':{}};var _0x46b275={};var _0x472a99={'count':0x0,'rows':[]};return db[_0x6604('0x43')][_0x6604('0x71')]({'where':{'id':_0x264bc2[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x5914de,null))[_0x6604('0x22')](function(_0x3e7632){if(_0x3e7632){_0x46b275[_0x6604('0x48')]=_[_0x6604('0x4a')](db[_0x6604('0x6f')][_0x6604('0x44')]);_0x46b275[_0x6604('0x49')]=_[_0x6604('0x4a')](_0x264bc2[_0x6604('0x49')]);_0x46b275['filters']=_[_0x6604('0x4c')](_0x46b275[_0x6604('0x48')],_0x46b275[_0x6604('0x49')]);_0x41f739[_0x6604('0x4d')]=_[_0x6604('0x4c')](_0x46b275[_0x6604('0x48')],qs[_0x6604('0x4e')](_0x264bc2[_0x6604('0x49')][_0x6604('0x4e')]));_0x41f739['attributes']=_0x41f739[_0x6604('0x4d')][_0x6604('0x4f')]?_0x41f739[_0x6604('0x4d')]:_0x46b275[_0x6604('0x48')];if(!_0x264bc2[_0x6604('0x49')][_0x6604('0x50')](_0x6604('0x51'))){_0x41f739[_0x6604('0x2f')]=qs['limit'](_0x264bc2[_0x6604('0x49')][_0x6604('0x2f')]);_0x41f739[_0x6604('0x32')]=qs['offset'](_0x264bc2[_0x6604('0x49')][_0x6604('0x32')]);}_0x41f739['order']=qs[_0x6604('0x53')](_0x264bc2[_0x6604('0x49')][_0x6604('0x53')]);_0x41f739['where']=qs['filters'](_['pick'](_0x264bc2[_0x6604('0x49')],_0x46b275[_0x6604('0x4b')]));_0x41f739[_0x6604('0x54')][_0x6604('0x6a')]=_0x3e7632['id'];if(_0x264bc2[_0x6604('0x49')][_0x6604('0x56')]){_0x41f739[_0x6604('0x54')]=_[_0x6604('0x57')](_0x41f739[_0x6604('0x54')],{'$or':_[_0x6604('0x42')](_0x41f739[_0x6604('0x4d')],function(_0x38bda3){var _0x1ab7d5={};_0x1ab7d5[_0x38bda3]={'$like':'%'+_0x264bc2[_0x6604('0x49')][_0x6604('0x56')]+'%'};return _0x1ab7d5;})});}_0x41f739=_[_0x6604('0x57')]({},_0x41f739,_0x264bc2[_0x6604('0x59')]);return db[_0x6604('0x6f')][_0x6604('0x31')]({'where':_0x41f739[_0x6604('0x54')]})[_0x6604('0x22')](function(_0x26b868){_0x472a99[_0x6604('0x31')]=_0x26b868;if(_0x264bc2[_0x6604('0x49')][_0x6604('0x5a')]){_0x41f739[_0x6604('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6604('0x6c')](_0x41f739);})[_0x6604('0x22')](function(_0x35cc78){_0x472a99[_0x6604('0x5c')]=_0x35cc78;return _0x472a99;});}})[_0x6604('0x22')](respondWithFilteredResult(_0x5914de,_0x41f739))[_0x6604('0x2a')](handleError(_0x5914de,null));};exports[_0x6604('0x72')]=function(_0x316bd3,_0x39514d,_0x278e84){return db[_0x6604('0x43')][_0x6604('0x65')]({'where':{'id':_0x316bd3[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x39514d,null))[_0x6604('0x22')](function(_0x556169){if(_0x556169){return _0x556169[_0x6604('0x72')](_0x316bd3[_0x6604('0x49')][_0x6604('0x6e')]);}})[_0x6604('0x22')](respondWithStatusCode(_0x39514d,null))[_0x6604('0x2a')](handleError(_0x39514d,null));};exports[_0x6604('0x73')]=function(_0x579704,_0x5ce005,_0x5be8ad){_0x579704['body'][_0x6604('0x74')]=_0x579704[_0x6604('0x75')]['filename'];return db[_0x6604('0x43')][_0x6604('0x65')]({'where':{'id':_0x579704[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x5ce005,null))[_0x6604('0x22')](saveUpdates(_0x579704[_0x6604('0x60')],null))[_0x6604('0x22')](respondWithResult(_0x5ce005,null))[_0x6604('0x2a')](handleError(_0x5ce005,null));};exports[_0x6604('0x76')]=function(_0x18797c,_0x2b7938,_0x3af02e){_0x18797c[_0x6604('0x60')][_0x6604('0x77')]=_0x18797c['file'][_0x6604('0x78')];return db[_0x6604('0x43')][_0x6604('0x65')]({'where':{'id':_0x18797c[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x2b7938,null))[_0x6604('0x22')](saveUpdates(_0x18797c[_0x6604('0x60')],null))[_0x6604('0x22')](respondWithResult(_0x2b7938,null))['catch'](handleError(_0x2b7938,null));};exports['addCustomerAvatar']=function(_0x50d3b3,_0x5667cf,_0x3bdd85){_0x50d3b3[_0x6604('0x60')][_0x6604('0x79')]=_0x50d3b3['file']['filename'];return db[_0x6604('0x43')][_0x6604('0x65')]({'where':{'id':_0x50d3b3[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x5667cf,null))['then'](saveUpdates(_0x50d3b3[_0x6604('0x60')],null))[_0x6604('0x22')](respondWithResult(_0x5667cf,null))[_0x6604('0x2a')](handleError(_0x5667cf,null));};exports['addSystemAvatar']=function(_0x3af970,_0x34549c,_0x283f94){_0x3af970[_0x6604('0x60')][_0x6604('0x7a')]=_0x3af970[_0x6604('0x75')][_0x6604('0x78')];return db[_0x6604('0x43')]['find']({'where':{'id':_0x3af970[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x34549c,null))[_0x6604('0x22')](saveUpdates(_0x3af970[_0x6604('0x60')],null))['then'](respondWithResult(_0x34549c,null))['catch'](handleError(_0x34549c,null));};exports[_0x6604('0x7b')]=function(_0x5b19a1,_0x2c6ed7,_0x29762e){var _0x5106a5=path[_0x6604('0x7c')](config[_0x6604('0x7d')],_0x6604('0x7e'));var _0x565faf={'where':{'id':_0x5b19a1[_0x6604('0x5e')]['id']},'attributes':['id',_0x6604('0x74')],'raw':!![]};var _0x55c540=![];return require(_0x6604('0x18'))['getLicense']()['then'](function(_0x177919){if(_0x177919){_0x55c540=_0x177919[_0x6604('0x7f')];}})[_0x6604('0x22')](function(){return db[_0x6604('0x43')][_0x6604('0x65')](_0x565faf);})['then'](handleEntityNotFound(_0x2c6ed7,null))['then'](function(_0x309afe){if(_0x309afe){if(!_[_0x6604('0x80')](_0x309afe[_0x6604('0x74')])){if(fs[_0x6604('0x81')](path[_0x6604('0x7c')](config['root'],_0x6604('0x82'),_0x309afe[_0x6604('0x74')]))&&_0x55c540){_0x5106a5=path[_0x6604('0x7c')](config[_0x6604('0x7d')],_0x6604('0x82'),_0x309afe[_0x6604('0x74')]);}}return _0x2c6ed7[_0x6604('0x83')](_0x5106a5);}})['catch'](handleError(_0x2c6ed7,null));};exports[_0x6604('0x84')]=function(_0x430749,_0x20dd10,_0x28fe49){var _0x2d248e=path[_0x6604('0x7c')](config[_0x6604('0x7d')],'server/files/images/avatars/default_avatar.png');var _0xd218aa={'where':{'id':_0x430749[_0x6604('0x5e')]['id']},'attributes':['id',_0x6604('0x77')],'raw':!![]};return db[_0x6604('0x43')][_0x6604('0x65')](_0xd218aa)['then'](handleEntityNotFound(_0x20dd10,null))['then'](function(_0xbdd013){if(_0xbdd013){if(!_['isNil'](_0xbdd013[_0x6604('0x77')])){if(fs['existsSync'](path[_0x6604('0x7c')](config['root'],_0x6604('0x85'),_0xbdd013['agentAvatar']))){_0x2d248e=path[_0x6604('0x7c')](config[_0x6604('0x7d')],_0x6604('0x85'),_0xbdd013[_0x6604('0x77')]);}}return _0x20dd10[_0x6604('0x83')](_0x2d248e);}})[_0x6604('0x2a')](handleError(_0x20dd10,null));};exports[_0x6604('0x86')]=function(_0x5b0aee,_0x45488b,_0x2f91c4){var _0x4f9e5a=path[_0x6604('0x7c')](config['root'],_0x6604('0x87'));var _0x432325={'where':{'id':_0x5b0aee[_0x6604('0x5e')]['id']},'attributes':['id','customerAvatar',_0x6604('0x88')],'raw':!![]};return db[_0x6604('0x43')][_0x6604('0x65')](_0x432325)[_0x6604('0x22')](handleEntityNotFound(_0x45488b,null))[_0x6604('0x22')](function(_0x8e9e1f){if(_0x8e9e1f){if(!_[_0x6604('0x80')](_0x8e9e1f[_0x6604('0x79')])){if(fs[_0x6604('0x81')](path[_0x6604('0x7c')](config['root'],_0x6604('0x85'),_0x8e9e1f[_0x6604('0x79')]))&&_0x8e9e1f[_0x6604('0x88')]){_0x4f9e5a=path['join'](config[_0x6604('0x7d')],_0x6604('0x85'),_0x8e9e1f[_0x6604('0x79')]);}}return _0x45488b[_0x6604('0x83')](_0x4f9e5a);}})[_0x6604('0x2a')](handleError(_0x45488b,null));};exports[_0x6604('0x89')]=function(_0x1948db,_0x288dc2,_0x34aa3a){var _0x5ebfe9=path['join'](config[_0x6604('0x7d')],'server/files/images/avatars/system_avatar.png');var _0x53ae80={'where':{'id':_0x1948db[_0x6604('0x5e')]['id']},'attributes':['id',_0x6604('0x7a')],'raw':!![]};return db[_0x6604('0x43')][_0x6604('0x65')](_0x53ae80)[_0x6604('0x22')](handleEntityNotFound(_0x288dc2,null))[_0x6604('0x22')](function(_0x2bf865){if(_0x2bf865){if(!_[_0x6604('0x80')](_0x2bf865[_0x6604('0x7a')])){if(fs[_0x6604('0x81')](path['join'](config['root'],'server/files/images/avatars/',_0x2bf865[_0x6604('0x7a')]))){_0x5ebfe9=path[_0x6604('0x7c')](config[_0x6604('0x7d')],_0x6604('0x85'),_0x2bf865[_0x6604('0x7a')]);}}return _0x288dc2[_0x6604('0x83')](_0x5ebfe9);}})[_0x6604('0x2a')](handleError(_0x288dc2,null));};exports[_0x6604('0x8a')]=function(_0x454256,_0x3eba19,_0x1b4dd0){var _0x4cd9d1=require(_0x6604('0x8b'));var _0x3684cb=new _0x4cd9d1();var _0x51fd33=_0x3684cb[_0x6604('0x8c')](_0x454256[_0x6604('0x8d')][_0x6604('0x8e')])[_0x6604('0x8f')]();var _0x416e9c={'body':_0x454256[_0x6604('0x60')],'channel':_0x6604('0x90')};var _0x45e704=[];var _0x515c3c=[];var _0x150341={};var _0x16e7fe=![];return db[_0x6604('0x91')][_0x6604('0x69')]()[_0x6604('0x22')](function(_0x220e39){if(!_0x220e39){throw new db[(_0x6604('0x92'))]['ValidationError']('no\x20available\x20attributes');}_0x45e704=_[_0x6604('0x93')](_[_0x6604('0x4a')](_0x220e39),['createdAt','updatedAt']);_0x515c3c=_[_0x6604('0x93')](_[_0x6604('0x4a')](_0x220e39),[_0x6604('0x94'),_0x6604('0x95'),_0x6604('0x96'),_0x6604('0x97')]);if(_0x454256[_0x6604('0x60')]['id']){delete _0x454256[_0x6604('0x60')]['id'];}if(_[_0x6604('0x80')](_0x454256[_0x6604('0x60')]['from'])){throw new db[(_0x6604('0x92'))][(_0x6604('0x98'))]('from\x20is\x20mandatory');}if(_[_0x6604('0x80')](_0x454256[_0x6604('0x60')][_0x6604('0x60')])||_0x454256[_0x6604('0x60')][_0x6604('0x60')]===''){throw new db['Sequelize'][(_0x6604('0x98'))](_0x6604('0x99'));}if(_['isNil'](_0x454256[_0x6604('0x60')][_0x6604('0x9a')])){throw new db[(_0x6604('0x92'))][(_0x6604('0x98'))](_0x6604('0x9b')+_0x515c3c);}if(!_['includes'](_0x515c3c,_0x454256[_0x6604('0x60')][_0x6604('0x9a')])){throw new db[(_0x6604('0x92'))][(_0x6604('0x98'))](_0x6604('0x9c')+_0x515c3c);}_0x150341[_0x454256['body'][_0x6604('0x9a')]]=_0x454256['body']['from'];})['then'](function(){return db[_0x6604('0x43')][_0x6604('0x65')]({'where':{'id':_0x454256[_0x6604('0x5e')]['id']},'include':[{'model':db[_0x6604('0x9d')],'as':_0x6604('0x9e'),'include':[{'model':db[_0x6604('0x91')],'as':_0x6604('0x9f'),'where':_0x150341,'limit':0x1,'order':[[_0x6604('0x95'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0x6604('0xa0')}]});})['then'](handleEntityNotFound(_0x3eba19,null))[_0x6604('0x22')](function(_0x4711b8){if(_0x4711b8&&_0x4711b8[_0x6604('0x9e')]){_0x416e9c[_0x6604('0xa1')]=_0x4711b8;_0x416e9c['applications']=_0x4711b8[_0x6604('0xa0')];_0x416e9c['list']=_0x4711b8[_0x6604('0x9e')];_0x416e9c[_0x6604('0xa2')]=_[_0x6604('0xa3')](_0x416e9c['applications'],[_0x6604('0xa4')],['asc']);if(_0x416e9c[_0x6604('0xa1')]['Applications']){delete _0x416e9c[_0x6604('0xa1')][_0x6604('0xa0')];}if(_0x416e9c[_0x6604('0xa1')][_0x6604('0x9e')]&&_0x416e9c[_0x6604('0xa1')]['List'][_0x6604('0x9f')]['length']){return _0x416e9c[_0x6604('0xa1')]['List'][_0x6604('0x9f')][0x0];}var _0x3de970=_['defaults'](_0x454256[_0x6604('0x60')],{'firstName':_0x454256[_0x6604('0x60')][_0x6604('0xa5')],'ListId':_0x4711b8[_0x6604('0x97')]});_0x3de970[_0x454256['body'][_0x6604('0x9a')]]=_0x454256['body']['from'];return db[_0x6604('0x91')][_0x6604('0x5f')](_0x3de970,{'fields':_0x45e704,'raw':!![]});}})[_0x6604('0x22')](handleEntityNotFound(_0x3eba19,null))[_0x6604('0x22')](function(_0x167013){_0x416e9c[_0x6604('0xa6')]=_0x167013;var _0x1df04b=_0x454256[_0x6604('0x60')][_0x6604('0xa7')];if(_0x454256['headers'][_0x6604('0xa8')]){_0x1df04b=_0x454256[_0x6604('0x8d')][_0x6604('0xa8')];}else if(_0x454256[_0x6604('0x8d')][_0x6604('0xa9')]){_0x1df04b=_[_0x6604('0xaa')](_0x454256[_0x6604('0x8d')][_0x6604('0xa9')][_0x6604('0xab')](','));}if(_0x167013){var _0x4ec5fe={'ContactId':_0x167013['id'],'ChatWebsiteId':_0x454256[_0x6604('0x5e')]['id'],'from':(_0x167013[_0x6604('0xac')]||'')+'\x20'+(_0x167013[_0x6604('0xad')]||''),'customerIp':_0x1df04b,'customerPort':_0x454256[_0x6604('0x8d')]['x-real-port']?_0x454256[_0x6604('0x8d')][_0x6604('0xae')]:null,'referer':_0x454256[_0x6604('0x60')][_0x6604('0xaf')],'browserName':_0x51fd33[_0x6604('0xb0')][_0x6604('0x3d')]&&_0x51fd33[_0x6604('0xb0')]['version']?util[_0x6604('0xb1')](_0x6604('0xb2'),_0x51fd33[_0x6604('0xb0')][_0x6604('0x3d')],_0x51fd33[_0x6604('0xb0')][_0x6604('0xb3')]):_0x6604('0xb4'),'browserVersion':_0x51fd33[_0x6604('0xb0')][_0x6604('0xb3')]||_0x6604('0xb4'),'osName':util[_0x6604('0xb1')](_0x6604('0xb2'),_0x51fd33['os'][_0x6604('0x3d')],_0x51fd33['os']['version']),'osVersion':_0x51fd33['os'][_0x6604('0xb3')],'deviceModel':_0x51fd33[_0x6604('0xb5')][_0x6604('0x48')]&&_0x51fd33[_0x6604('0xb5')]['vendor']?util[_0x6604('0xb1')](_0x6604('0xb6'),_0x51fd33[_0x6604('0xb5')][_0x6604('0x48')],_0x51fd33['device'][_0x6604('0xb7')],_0x51fd33['device'][_0x6604('0x46')]):null,'deviceVendor':_0x51fd33[_0x6604('0xb5')][_0x6604('0xb7')],'deviceType':_0x51fd33['device']['type'],'formData':JSON['stringify'](_0x454256['body'])};var _0x269979={'ChatWebsiteId':_0x454256['params']['id'],'closed':![]};if(_0x454256[_0x6604('0x60')][_0x6604('0xb8')]){_0x269979[_0x6604('0xb8')]=_0x454256[_0x6604('0x60')]['threadId'];return db[_0x6604('0xb9')][_0x6604('0x65')]({'where':_0x269979})[_0x6604('0x22')](function(_0x1423f2){if(_0x1423f2){return[_0x1423f2,![]];}_0x4ec5fe[_0x6604('0xb8')]=_0x454256[_0x6604('0x60')][_0x6604('0xb8')];_0x4ec5fe[_0x6604('0xba')]=_0x454256['body']['externalUrl'];return db[_0x6604('0xb9')]['create'](_0x4ec5fe)[_0x6604('0x22')](function(_0x2ad71a){return[_0x2ad71a,!![]];});});}_0x269979[_0x6604('0xbb')]=_0x167013['id'];if(_0x454256[_0x6604('0x60')][_0x6604('0xbc')]&&_0x454256[_0x6604('0x60')][_0x6604('0xbc')]['id']){_0x269979['id']=_0x454256[_0x6604('0x60')][_0x6604('0xbc')]['id'];return db['ChatInteraction'][_0x6604('0x65')]({'where':_0x269979})['then'](function(_0x2aa193){if(_0x2aa193){return[_0x2aa193,![]];}return db[_0x6604('0xb9')]['create'](_0x4ec5fe)[_0x6604('0x22')](function(_0x19e04d){return[_0x19e04d,!![]];});});}return db[_0x6604('0xb9')]['create'](_0x4ec5fe)['then'](function(_0x3a32b6){return[_0x3a32b6,!![]];});}})[_0x6604('0xbd')](function(_0x51736e,_0x562906){if(_0x51736e){_0x16e7fe=_0x562906;if(!_0x562906){var _0x3ecf24={'from':(_0x416e9c[_0x6604('0xa6')][_0x6604('0xac')]||'')+'\x20'+(_0x416e9c['contact'][_0x6604('0xad')]||'')};if(_0x454256['body'][_0x6604('0xb8')]&&_0x454256[_0x6604('0x60')]['messageId']&&_0x454256[_0x6604('0x60')][_0x6604('0xb8')]!=_0x454256[_0x6604('0x60')][_0x6604('0xbe')]){_0x3ecf24[_0x6604('0xb8')]=_0x454256[_0x6604('0x60')][_0x6604('0xbe')];}return _0x51736e[_0x6604('0x37')](_0x3ecf24);}else{return _0x51736e;}}})[_0x6604('0x22')](function(_0x45d7fd){_0x416e9c['interaction']=_0x45d7fd['get']({'plain':!![]});_0x416e9c['interaction'][_0x6604('0xbf')]=_0x16e7fe;if(_0x416e9c[_0x6604('0xbc')]['created']){if(_0x416e9c['account'][_0x6604('0xc0')]){_0x416e9c[_0x6604('0xa2')][_0x6604('0xc1')]({'id':0x0,'priority':_0x416e9c['applications'][_0x6604('0x4f')]+0x1,'app':'close','appdata':_0x6604('0xc2'),'interval':_0x6604('0xc3')});}}return db[_0x6604('0xc4')][_0x6604('0x5f')]({'body':_0x454256['body'][_0x6604('0x60')],'ChatWebsiteId':_0x454256[_0x6604('0x5e')]['id'],'ChatInteractionId':_0x45d7fd['id'],'direction':'in','ContactId':_0x416e9c[_0x6604('0xa6')]['id'],'AttachmentId':_0x454256[_0x6604('0x60')][_0x6604('0xc5')]});})[_0x6604('0x22')](function(_0x37b8d2){_0x416e9c['message']=_0x37b8d2;if(_0x416e9c[_0x6604('0xbc')][_0x6604('0xc6')]){return db[_0x6604('0xc7')][_0x6604('0x65')]({'attributes':['id',_0x6604('0x3d')],'where':{'id':_0x416e9c['interaction'][_0x6604('0xc6')]}})[_0x6604('0x22')](function(_0x245ba7){if(_0x245ba7){_0x416e9c[_0x6604('0xa2')][_0x6604('0xc8')]({'id':0x0,'priority':0x0,'app':_0x6604('0xc9'),'appdata':_0x245ba7[_0x6604('0x3d')]+','+(_0x416e9c[_0x6604('0xa1')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x416e9c[_0x6604('0xca')]=!![];}return respondWithRpcPromise(_0x6604('0xcb'),_0x6604('0xcc'),_0x416e9c);});}return respondWithRpcPromise(_0x6604('0xcb'),_0x6604('0xcc'),_0x416e9c);})[_0x6604('0x22')](function(_0x2ede9b){respondWithRpcPromise('EventManager',_0x6604('0xcd'),{'event':_0x6604('0x8a'),'message':_0x2ede9b},client9002);return _0x2ede9b;})[_0x6604('0x22')](respondWithResult(_0x3eba19,null))[_0x6604('0x2a')](handleError(_0x3eba19,null));};exports[_0x6604('0xce')]=function(_0x522a37,_0x151fa9,_0x167d4d){var _0x3ac09e,_0xa1e62c,_0x1f686a;var _0x60d55e=[];var _0x2d1cda=[];var _0x5376a6={};var _0x585736=_0x522a37['files']||[];var _0x4b8b78=[];var _0x236353;return db[_0x6604('0x91')][_0x6604('0x69')]()[_0x6604('0x22')](function(_0x1ad5ac){if(!_0x1ad5ac){throw new db[(_0x6604('0x92'))]['ValidationError'](_0x6604('0xcf'));}_0x2d1cda=_[_0x6604('0x93')](_['keys'](_0x1ad5ac),[_0x6604('0x94'),'updatedAt']);_0x60d55e=_[_0x6604('0x93')](_[_0x6604('0x4a')](_0x1ad5ac),[_0x6604('0x94'),_0x6604('0x95'),_0x6604('0x96'),_0x6604('0x97')]);if(_0x522a37[_0x6604('0x60')]['id']){delete _0x522a37['body']['id'];}if(_[_0x6604('0x80')](_0x522a37[_0x6604('0x60')]['from'])){throw _0x151fa9['status'](0x1f4)['send'](new db[(_0x6604('0x92'))][(_0x6604('0x98'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x522a37[_0x6604('0x60')]['body'])||_0x522a37['body'][_0x6604('0x60')]===''){throw _0x151fa9[_0x6604('0x2c')](0x1f4)[_0x6604('0x3e')](new db[(_0x6604('0x92'))]['ValidationError'](_0x6604('0x99')));}if(_[_0x6604('0x80')](_0x522a37[_0x6604('0x60')]['mapKeyOffline'])){throw _0x151fa9['status'](0x1f4)['send'](new db[(_0x6604('0x92'))][(_0x6604('0x98'))](_0x6604('0xd0')+_0x60d55e));}if(!_[_0x6604('0xd1')](_0x60d55e,_0x522a37[_0x6604('0x60')][_0x6604('0xd2')])){throw _0x151fa9[_0x6604('0x2c')](0x1f4)[_0x6604('0x3e')](new db[(_0x6604('0x92'))][(_0x6604('0x98'))](_0x6604('0xd3')+_0x60d55e));}_0x5376a6[_0x522a37[_0x6604('0x60')]['mapKeyOffline']]=_0x522a37['body'][_0x6604('0xa5')];})[_0x6604('0x22')](function(){return db[_0x6604('0x43')][_0x6604('0x65')]({'where':{'id':_0x522a37[_0x6604('0x5e')]['id']},'include':[{'model':db[_0x6604('0x9d')],'as':_0x6604('0x9e')},{'model':db[_0x6604('0xd4')],'as':_0x6604('0xd4')}]});})['then'](handleEntityNotFound(_0x151fa9,null))[_0x6604('0x22')](function(_0x33055b){if(_0x33055b&&_0x33055b[_0x6604('0x9e')]){_0xa1e62c=_0x33055b;var _0x2713e2=_[_0x6604('0x1a')](_0x522a37[_0x6604('0x60')],{'firstName':_0x522a37[_0x6604('0x60')][_0x6604('0xa5')],'phone':_0x522a37[_0x6604('0x60')][_0x6604('0xa5')],'ListId':_0x33055b['ListId']});_0x2713e2[_0x522a37[_0x6604('0x60')][_0x6604('0xd2')]]=_0x522a37[_0x6604('0x60')][_0x6604('0xa5')];return db[_0x6604('0x91')][_0x6604('0xd5')]({'where':_0x5376a6,'defaults':_0x2713e2});}})[_0x6604('0xbd')](function(_0x35b0b4){if(_0x35b0b4){_0x1f686a=_0x35b0b4;var _0x5e99e1=fs[_0x6604('0xd6')](path['join'](config[_0x6604('0x7d')],_0x6604('0xd7')),_0x6604('0xd8'));var _0x5ca3b7=ejs[_0x6604('0xd9')](_0x5e99e1,{'body':_[_0x6604('0xda')](_0x522a37[_0x6604('0x60')]['body']),'bodyTitle':_0xa1e62c[_0x6604('0xdb')]});return db['ChatOfflineMessage'][_0x6604('0x5f')]({'body':_0x5ca3b7,'ContactId':_0x35b0b4['id'],'ChatWebsiteId':_0xa1e62c['id']});}})['then'](function(_0x50e49f){_0x236353=_0x50e49f;if(_0x585736[_0x6604('0x4f')]){var _0x43f701=_0x585736['map'](function(_0x37391d){return{'name':_0x37391d[_0x6604('0xdc')],'basename':_0x37391d[_0x6604('0x78')],'type':_0x37391d['mimetype'],'ChatOfflineMessageId':_0x50e49f['id']};});_0x4b8b78=_0x43f701[_0x6604('0x42')](_0x570eef=>{var _0x30962f={'filename':_0x570eef['name'],'path':path['join'](config[_0x6604('0x7d')],_0x6604('0xdd'),_0x6604('0xde'),_0x6604('0xdf'),_0x6604('0xe0'),_0x570eef[_0x6604('0xe1')])};return _0x30962f;});if(!_0xa1e62c[_0x6604('0xe2')]){return db['sequelize']['transaction'](function(_0x515485){return db[_0x6604('0xe3')][_0x6604('0xe4')](_0x43f701,{'transaction':_0x515485});});}}})['then'](function(){if(_0x236353){_0x3ac09e=_0x236353;return db['MailAccount'][_0x6604('0x71')]({'where':{'active':!![]},'include':[{'model':db[_0x6604('0xe5')],'as':_0x6604('0xe6'),'raw':!![]}]});}})[_0x6604('0x22')](function(_0x51491e){if(_0x51491e&&_0x51491e['Smtp']&&_0xa1e62c['forwardOffline']&&_0xa1e62c['forwardOfflineAddress']){var _0x105687={'tls':{'rejectUnauthorized':![]}};if(_0x51491e['Smtp'][_0x6604('0xe7')]){_0x105687[_0x6604('0xe7')]=_0x51491e[_0x6604('0xe6')]['service'];}else{_0x105687[_0x6604('0xe8')]=_0x51491e[_0x6604('0xe6')][_0x6604('0xe8')];_0x105687[_0x6604('0xe9')]=_0x51491e[_0x6604('0xe6')]['port'];_0x105687[_0x6604('0xea')]=_0x51491e['Smtp'][_0x6604('0xea')];}if(_0x51491e['Smtp']['authentication']){_0x105687['auth']={'user':_0x51491e[_0x6604('0xe6')]['user'],'pass':_0x51491e['Smtp'][_0x6604('0xeb')]};}return respondWithRpcPromise(_0x6604('0xec'),_0x6604('0xed'),{'account':_0x105687,'message':{'from':util[_0x6604('0xb1')]('\x22%s\x22\x20<%s>',_0x51491e['name'],_0x51491e[_0x6604('0xee')]||_0x51491e[_0x6604('0xe6')]['user']),'to':_0xa1e62c[_0x6604('0xef')],'subject':_0xa1e62c[_0x6604('0xf0')],'html':_0x3ac09e['body'],'attachments':_0x4b8b78}},client9003)['then'](function(){return _0x3ac09e;})[_0x6604('0x2a')](function(_0x4be613){console['error'](_0x4be613);});}})[_0x6604('0x22')](function(){if(_0xa1e62c&&_0xa1e62c[_0x6604('0xe2')]&&_0xa1e62c[_0x6604('0xf1')]){var _0x503e81=[];if(_0x585736[_0x6604('0x4f')]){_0x503e81=_0x585736['map'](function(_0x2fa188){return{'name':_0x2fa188[_0x6604('0xdc')],'basename':_0x2fa188[_0x6604('0x78')],'type':_0x2fa188['mimetype'],'ChatOfflineMessageId':_0x236353['id']};});}var _0x55a35b;if(!_[_0x6604('0x80')](_0xa1e62c[_0x6604('0xf2')])){var _0x252a6c=_['map'](_0x522a37[_0x6604('0x60')],function(_0x236c8c){return _0x236c8c;});var _0x3028be=_['toPairsIn'](_0x252a6c)[0x0];var _0x276dfe=_[_0x6604('0xf3')](_0x3028be,function(_0xb59add){return _0xb59add;});_0x55a35b=_0x276dfe[0x1][_0xa1e62c[_0x6604('0xf2')]];}var _0x155bb9={'from':_0x1f686a['email'],'firstName':_0x1f686a[_0x6604('0xac')],'lastName':_0x1f686a[_0x6604('0xad')],'mapKey':_0x6604('0xee'),'message':{'from':_0x1f686a[_0x6604('0xee')],'to':_0xa1e62c['MailAccount'][_0x6604('0xee')],'cc':'','subject':_['isNil'](_0x55a35b)?_0xa1e62c[_0x6604('0xf0')]:_0x55a35b,'messageId':'','sentAt':new Date(),'attach':_0x503e81[_0x6604('0x4f')],'attachments':_0x503e81,'originChannel':_0x6604('0xf4'),'ChatWebsiteId':_0xa1e62c['id'],'ChatOfflineMessageId':_0x3ac09e['id'],'originTo':_0xa1e62c[_0x6604('0xd4')][_0x6604('0xee')]},'body':_0x3ac09e['body']};var _0x55bcfd={'account':{'id':_0xa1e62c[_0x6604('0xf1')]},'body':_0x155bb9,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x6604('0xf5'),_0x6604('0xf6'),_0x55bcfd,client9001)['then'](function(){return _0x3ac09e;})[_0x6604('0x2a')](function(_0x34adf7){console[_0x6604('0x26')](_0x34adf7);});}return;})[_0x6604('0x22')](function(){if(_0x3ac09e){return _0x3ac09e;}})[_0x6604('0x22')](respondWithResult(_0x151fa9,null))[_0x6604('0x2a')](function(_0x367189){console['error']('catch',_0x367189);for(var _0x14a669 of _0x585736){var _0x2e5daf=path['join'](config['root'],_0x6604('0xdd'),_0x6604('0xde'),_0x6604('0xdf'),'offline-chat',_0x14a669[_0x6604('0x78')]);fs_extra[_0x6604('0xf7')](_0x2e5daf)[_0x6604('0x2a')](function(_0x1b786f){console[_0x6604('0x26')]('Could\x20not\x20remove\x20attachment\x20file',_0x2e5daf,_0x1b786f);});}});};exports[_0x6604('0xf8')]=function(_0x51159b,_0x1b2c42,_0x3d7ba9){return db[_0x6604('0xb9')][_0x6604('0x65')]({'where':{'id':_0x51159b[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x1b2c42,null))[_0x6604('0x22')](function(_0x2d61f5){if(_0x2d61f5){return _0x2d61f5[_0x6604('0xf8')](_0x51159b[_0x6604('0x60')][_0x6604('0x6e')],_[_0x6604('0xf9')](_0x51159b[_0x6604('0x60')],[_0x6604('0x6e'),'id'])||{});}})[_0x6604('0x22')](respondWithResult(_0x1b2c42,null))[_0x6604('0x2a')](handleError(_0x1b2c42,null));};exports['getInteractions']=function(_0x544563,_0x197cdc,_0x4814bb){var _0x31af04={'raw':![],'where':{}};var _0x3b083b={};var _0x50d282={'count':0x0,'rows':[]};return db[_0x6604('0x43')][_0x6604('0x71')]({'where':{'id':_0x544563[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x197cdc,null))[_0x6604('0x22')](function(_0x4edf58){if(_0x4edf58){_0x3b083b[_0x6604('0x48')]=_['keys'](db[_0x6604('0xb9')][_0x6604('0x44')]);_0x3b083b['query']=_[_0x6604('0x4a')](_0x544563[_0x6604('0x49')]);_0x3b083b[_0x6604('0x4b')]=_[_0x6604('0x4c')](_0x3b083b[_0x6604('0x48')],_0x3b083b[_0x6604('0x49')]);_0x31af04[_0x6604('0x4d')]=_[_0x6604('0x4c')](_0x3b083b['model'],qs['fields'](_0x544563['query'][_0x6604('0x4e')]));_0x31af04[_0x6604('0x4d')]=_0x31af04['attributes']['length']?_0x31af04[_0x6604('0x4d')]:_0x3b083b[_0x6604('0x48')];if(!_0x544563['query'][_0x6604('0x50')](_0x6604('0x51'))){_0x31af04[_0x6604('0x2f')]=qs[_0x6604('0x2f')](_0x544563['query'][_0x6604('0x2f')]);_0x31af04['offset']=qs[_0x6604('0x32')](_0x544563['query'][_0x6604('0x32')]);}_0x31af04[_0x6604('0x52')]=qs['sort'](_0x544563[_0x6604('0x49')][_0x6604('0x53')]);_0x31af04[_0x6604('0x54')]=qs['filters'](_[_0x6604('0x55')](_0x544563['query'],_0x3b083b[_0x6604('0x4b')]));_0x31af04[_0x6604('0x54')][_0x6604('0x6a')]=_0x4edf58['id'];if(_0x544563[_0x6604('0x49')][_0x6604('0x56')]){_0x31af04['where']=_[_0x6604('0x57')](_0x31af04[_0x6604('0x54')],{'$or':_[_0x6604('0x42')](_0x31af04[_0x6604('0x4d')],function(_0x5d6a39){var _0x1ef894={};_0x1ef894[_0x5d6a39]={'$like':'%'+_0x544563[_0x6604('0x49')][_0x6604('0x56')]+'%'};return _0x1ef894;})});}_0x31af04=_[_0x6604('0x57')]({},_0x31af04,_0x544563['options']);return db[_0x6604('0xb9')][_0x6604('0x31')]({'where':_0x31af04[_0x6604('0x54')]})['then'](function(_0xa3f228){_0x50d282[_0x6604('0x31')]=_0xa3f228;if(_0x544563[_0x6604('0x49')]['includeAll']){_0x31af04[_0x6604('0x5b')]=[{'model':db[_0x6604('0x91')],'as':_0x6604('0xfa'),'required':![]},{'model':db[_0x6604('0xc7')],'as':_0x6604('0xfb'),'attributes':['name','fullname',_0x6604('0xfc')],'required':![]},{'model':db[_0x6604('0xfd')],'as':'Tags','attributes':['id',_0x6604('0x3d'),_0x6604('0xfe')],'where':_0x544563[_0x6604('0x49')][_0x6604('0xff')]?{'id':_0x544563[_0x6604('0x49')][_0x6604('0xff')]}:undefined,'required':_0x544563[_0x6604('0x49')][_0x6604('0xff')]?!![]:![]}];}return db[_0x6604('0xb9')][_0x6604('0x6c')](_0x31af04);})[_0x6604('0x22')](function(_0x549338){_0x50d282['rows']=_0x549338;return _0x50d282;});}})[_0x6604('0x22')](respondWithFilteredResult(_0x197cdc,_0x31af04))['catch'](handleError(_0x197cdc,null));};function iftimePromise(_0x44a126,_0x44f3e6){return respondWithRpcPromise(_0x6604('0x100'),'getSnippet',{'command':_0x44f3e6[_0x6604('0x101')]?util['format'](_0x6604('0x102'),_0x44a126[_0x6604('0x103')],_0x44f3e6[_0x6604('0x101')]):util['format']('iftime\x20%s',_0x44a126[_0x6604('0x103')])},client9002)[_0x6604('0x22')](function(_0x3ca12b){var _0x4739f2=_0x3ca12b&&_0x3ca12b[_0x6604('0x104')](_0x6604('0x105'))>=0x0?!![]:![];logger[_0x6604('0x106')](_0x6604('0x107'),_0x44f3e6['id'],_0x44a126['id'],_0x44a126[_0x6604('0x103')],_0x4739f2?_0x6604('0x108'):'OFFLINE',_0x44f3e6['timezone']?_0x44f3e6[_0x6604('0x101')]:'No\x20timezone');return _0x4739f2;})[_0x6604('0x2a')](function(_0x42714e){logger['error'](_0x6604('0x107'),_0x44f3e6['id'],_0x44a126['id'],_0x44a126[_0x6604('0x103')],util[_0x6604('0x109')](_0x42714e,{'showHidden':![],'depth':null}),_0x44f3e6[_0x6604('0x101')]?_0x44f3e6[_0x6604('0x101')]:'No\x20timezone');return![];});}exports[_0x6604('0x10a')]=function(_0x2ca97d,_0x332fd9,_0x432b42){var _0x3a0a3c=0x0;var _0xd606d3=0x0;var _0x4adc8f=![];var _0x2d73fb;var _0xbb9ba3;return db[_0x6604('0x43')][_0x6604('0x65')]({'where':{'id':_0x2ca97d[_0x6604('0x5e')]['id']},'include':[{'model':db['Interval'],'as':_0x6604('0x10b'),'include':[{'model':db['Interval'],'as':_0x6604('0x10c'),'attributes':['id',_0x6604('0x103')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x332fd9,null))[_0x6604('0x22')](function(_0x5259fb){if(_0x5259fb){_0x2d73fb=_0x5259fb;return _0x5259fb[_0x6604('0x10d')]({'raw':!![]});}})[_0x6604('0x22')](function(_0x4ef267){if(_0x2d73fb){if(_0x4ef267){_0xbb9ba3=_0x4ef267;}}return require(_0x6604('0x18'))['getLicense']();})[_0x6604('0x22')](function(_0x12f791){if(_0x12f791){_0xd606d3=_0x12f791[_0x6604('0x10e')];_0x4adc8f=_0x12f791[_0x6604('0x7f')];}})[_0x6604('0x22')](function(){return db['ChatInteraction'][_0x6604('0x31')]({'where':{'closed':![]}});})[_0x6604('0x22')](function(_0x2e2381){_0x3a0a3c=_0x2e2381;if(_0xd606d3&&_0x2e2381>_0xd606d3){return db[_0x6604('0x10f')][_0x6604('0x71')]({'where':{'id':0x1}})[_0x6604('0x22')](function(_0xe03f8){if(_0xe03f8){_0xe03f8[_0x6604('0x110')](_0x6604('0x111'));}});}})[_0x6604('0x22')](function(){if(_0x2d73fb[_0x6604('0x10b')]&&_0x2d73fb['Interval'][_0x6604('0x10c')]){var _0x5e0f10=[];for(var _0x5c5872=0x0;_0x5c5872<_0x2d73fb[_0x6604('0x10b')][_0x6604('0x10c')][_0x6604('0x4f')];_0x5c5872++){var _0x1afafd=_0x2d73fb[_0x6604('0x10b')]['Intervals'][_0x5c5872]['get']({'plain':!![]});_0x5e0f10[_0x6604('0xc1')](iftimePromise(_0x1afafd,_0x2d73fb));}return BPromise[_0x6604('0x112')](_0x5e0f10)['then'](function(_0x30f95d){return _[_0x6604('0x113')](_0x30f95d);});}else{return!![];}})['then'](function(_0x3df793){var _0x4d75bc=fs[_0x6604('0xd6')](path[_0x6604('0x7c')](config[_0x6604('0x7d')],'server/files/chat/iframe.ejs'),_0x6604('0xd8'));var _0x25ab00={'remote':_0x2d73fb[_0x6604('0x114')],'query':querystring[_0x6604('0x115')](_[_0x6604('0x57')](_0x2d73fb['get']({'plain':!![]}),{'customerIp':_0x2ca97d['headers'][_0x6604('0xa9')]||_0x2ca97d[_0x6604('0x8d')]['x-real-ip']||_0x2ca97d[_0x6604('0x116')][_0x6604('0x117')]||_0x2ca97d['ip'],'referer':_0x2ca97d[_0x6604('0x8d')][_0x6604('0xaf')],'openedInteractions':_0x3a0a3c,'maxInteractions':_0xd606d3,'virtual':_0x4adc8f['virtual'],'online':_0x3df793,'custom':_0x4adc8f}))[_0x6604('0x118')](/'/g,'\x5c\x27')};_0x332fd9[_0x6604('0x3e')](ejs['render'](Mustache[_0x6604('0xd9')](_0x4d75bc,_0x25ab00),{'proactiveActions':_0xbb9ba3,'alignment':_0x2d73fb['alignment'],'verticalAlignment':_0x2d73fb['verticalAlignment'],'div_color':_0x2d73fb[_0x6604('0xfe')],'text_color':_0x2d73fb['textColor'],'button_color':_0x2d73fb['color_button'],'background_color':_0x2d73fb[_0x6604('0x119')]}));})[_0x6604('0x2a')](handleError(_0x332fd9,null));};exports[_0x6604('0x11a')]=function(_0x790095,_0x5ba11e,_0x4fb8e2){return db[_0x6604('0x43')][_0x6604('0x71')]({'where':{'id':_0x790095[_0x6604('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5ba11e,null))[_0x6604('0x22')](function(_0x49d73b){if(_0x49d73b){return db[_0x6604('0x11b')]['transaction'](function(_0x3f9c21){return db[_0x6604('0x11c')][_0x6604('0x3b')]({'where':{'ChatWebsiteId':_0x790095[_0x6604('0x5e')]['id']},'transaction':_0x3f9c21})['then'](function(_0x17d88b){var _0xb04fa2=_[_0x6604('0x42')](_0x790095[_0x6604('0x60')],function(_0xa48af9){_0xa48af9[_0x6604('0x6a')]=_0x790095[_0x6604('0x5e')]['id'];return _0xa48af9;});return db[_0x6604('0x11c')]['bulkCreate'](_0xb04fa2,{'transaction':_0x3f9c21});});})[_0x6604('0x22')](function(){return db['ChatApplication'][_0x6604('0x11d')]({'where':{'ChatWebsiteId':_0x790095[_0x6604('0x5e')]['id']},'order':_0x6604('0xa4')});});}})[_0x6604('0x22')](respondWithResult(_0x5ba11e,null))['catch'](handleError(_0x5ba11e,null));};exports[_0x6604('0x11e')]=function(_0x2802a7,_0x49e778,_0x2afd26){var _0x45c3e8={};var _0x44927d={};var _0x442041;var _0x12ec30;return db['ChatWebsite'][_0x6604('0x71')]({'where':{'id':_0x2802a7[_0x6604('0x5e')]['id']}})['then'](handleEntityNotFound(_0x49e778,null))[_0x6604('0x22')](function(_0x16fbf3){if(_0x16fbf3){_0x442041=_0x16fbf3;_0x44927d[_0x6604('0x48')]=_[_0x6604('0x4a')](db['ChatApplication'][_0x6604('0x44')]);_0x44927d[_0x6604('0x49')]=_[_0x6604('0x4a')](_0x2802a7[_0x6604('0x49')]);_0x44927d[_0x6604('0x4b')]=_['intersection'](_0x44927d[_0x6604('0x48')],_0x44927d[_0x6604('0x49')]);_0x45c3e8[_0x6604('0x4d')]=_[_0x6604('0x4c')](_0x44927d['model'],qs['fields'](_0x2802a7[_0x6604('0x49')][_0x6604('0x4e')]));_0x45c3e8[_0x6604('0x4d')]=_0x45c3e8['attributes'][_0x6604('0x4f')]?_0x45c3e8[_0x6604('0x4d')]:_0x44927d[_0x6604('0x48')];_0x45c3e8[_0x6604('0x52')]=qs[_0x6604('0x53')](_0x2802a7['query'][_0x6604('0x53')]);_0x45c3e8[_0x6604('0x54')]=qs['filters'](_[_0x6604('0x55')](_0x2802a7[_0x6604('0x49')],_0x44927d[_0x6604('0x4b')]));if(_0x2802a7[_0x6604('0x49')][_0x6604('0x56')]){_0x45c3e8[_0x6604('0x54')]=_['merge'](_0x45c3e8['where'],{'$or':_[_0x6604('0x42')](_0x45c3e8[_0x6604('0x4d')],function(_0x41782b){var _0x29062d={};_0x29062d[_0x41782b]={'$like':'%'+_0x2802a7[_0x6604('0x49')]['filter']+'%'};return _0x29062d;})});}_0x45c3e8=_[_0x6604('0x57')]({},_0x45c3e8,_0x2802a7[_0x6604('0x59')]);return _0x442041[_0x6604('0x11e')](_0x45c3e8);}})['then'](function(_0x5eacd5){if(_0x5eacd5){_0x12ec30=_0x5eacd5[_0x6604('0x4f')];if(!_0x2802a7[_0x6604('0x49')][_0x6604('0x50')](_0x6604('0x51'))){_0x45c3e8[_0x6604('0x2f')]=qs[_0x6604('0x2f')](_0x2802a7['query'][_0x6604('0x2f')]);_0x45c3e8[_0x6604('0x32')]=qs[_0x6604('0x32')](_0x2802a7[_0x6604('0x49')][_0x6604('0x32')]);}return _0x442041[_0x6604('0x11e')](_0x45c3e8);}})['then'](function(_0x1aa201){if(_0x1aa201){return _0x1aa201?{'count':_0x12ec30,'rows':_0x1aa201}:null;}})[_0x6604('0x22')](respondWithResult(_0x49e778,null))['catch'](handleError(_0x49e778,null));};exports[_0x6604('0x11f')]=function(_0x51deb4,_0xdddcde,_0x13b6ff){return db['chatProactiveAction'][_0x6604('0x65')]({'where':{'id':_0x51deb4[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0xdddcde,null))[_0x6604('0x22')](function(_0x7af8bf){if(_0x7af8bf){return _0x7af8bf['addProactiveActions'](_0x51deb4[_0x6604('0x60')]['ids'],_[_0x6604('0xf9')](_0x51deb4['body'],[_0x6604('0x6e'),'id'])||{});}})[_0x6604('0x22')](respondWithResult(_0xdddcde,null))[_0x6604('0x2a')](handleError(_0xdddcde,null));};exports[_0x6604('0x10d')]=function(_0xbe4f2f,_0x4ac9e5,_0x469291){var _0x138727={};var _0x3c1d04={};var _0x4a0975;var _0x3016c3;return db[_0x6604('0x43')][_0x6604('0x71')]({'where':{'id':_0xbe4f2f['params']['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x4ac9e5,null))[_0x6604('0x22')](function(_0x52467a){if(_0x52467a){_0x4a0975=_0x52467a;_0x3c1d04['model']=_[_0x6604('0x4a')](db[_0x6604('0x120')][_0x6604('0x44')]);_0x3c1d04[_0x6604('0x49')]=_[_0x6604('0x4a')](_0xbe4f2f[_0x6604('0x49')]);_0x3c1d04[_0x6604('0x4b')]=_[_0x6604('0x4c')](_0x3c1d04[_0x6604('0x48')],_0x3c1d04['query']);_0x138727['attributes']=_[_0x6604('0x4c')](_0x3c1d04[_0x6604('0x48')],qs[_0x6604('0x4e')](_0xbe4f2f['query'][_0x6604('0x4e')]));_0x138727[_0x6604('0x4d')]=_0x138727[_0x6604('0x4d')][_0x6604('0x4f')]?_0x138727[_0x6604('0x4d')]:_0x3c1d04[_0x6604('0x48')];_0x138727['order']=qs[_0x6604('0x53')](_0xbe4f2f['query'][_0x6604('0x53')]);_0x138727[_0x6604('0x54')]=qs[_0x6604('0x4b')](_[_0x6604('0x55')](_0xbe4f2f['query'],_0x3c1d04[_0x6604('0x4b')]));if(_0xbe4f2f[_0x6604('0x49')][_0x6604('0x56')]){_0x138727['where']=_['merge'](_0x138727['where'],{'$or':_[_0x6604('0x42')](_0x138727[_0x6604('0x4d')],function(_0x137b95){var _0x2ee837={};_0x2ee837[_0x137b95]={'$like':'%'+_0xbe4f2f[_0x6604('0x49')][_0x6604('0x56')]+'%'};return _0x2ee837;})});}_0x138727=_[_0x6604('0x57')]({},_0x138727,_0xbe4f2f[_0x6604('0x59')]);return _0x4a0975[_0x6604('0x10d')](_0x138727);}})[_0x6604('0x22')](function(_0x12a348){if(_0x12a348){_0x3016c3=_0x12a348['length'];if(!_0xbe4f2f[_0x6604('0x49')]['hasOwnProperty'](_0x6604('0x51'))){_0x138727[_0x6604('0x2f')]=qs['limit'](_0xbe4f2f[_0x6604('0x49')]['limit']);_0x138727[_0x6604('0x32')]=qs[_0x6604('0x32')](_0xbe4f2f[_0x6604('0x49')]['offset']);}return _0x4a0975['getProactiveActions'](_0x138727);}})[_0x6604('0x22')](function(_0x47fe80){if(_0x47fe80){return _0x47fe80?{'count':_0x3016c3,'rows':_0x47fe80}:null;}})[_0x6604('0x22')](respondWithResult(_0x4ac9e5,null))['catch'](handleError(_0x4ac9e5,null));};exports[_0x6604('0x121')]=function(_0x15e334,_0x3308ab,_0x8fd21a){var _0x1e79ac=_0x15e334[_0x6604('0x49')]['online']==='false'?_0x6604('0x122'):_0x6604('0x123');return db['ChatWebsite']['find']({'attributes':['id',_0x1e79ac],'where':{'id':_0x15e334[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x3308ab,null))[_0x6604('0x22')](function(_0x40282e){if(_0x40282e){var _0x467a88=_0x40282e[_0x1e79ac];var _0x539004=_0x467a88&&_0x467a88[_0x6604('0x124')]?_0x467a88[_0x6604('0x124')]:[];_0x3308ab[_0x6604('0x3e')]({'fromKey':_[_0x6604('0x80')](_0x467a88[_0x6604('0x125')])?undefined:_0x467a88[_0x6604('0x125')],'count':_0x539004[_0x6604('0x4f')],'rows':_0x539004});}})[_0x6604('0x2a')](handleError(_0x3308ab,null));};exports[_0x6604('0x126')]=function(_0xd6cd1b,_0x317c27,_0x22c7aa){var _0x340a8e={'raw':![],'where':{}};var _0x191d40={};var _0x13eed4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x6604('0x71')]({'where':{'id':_0xd6cd1b[_0x6604('0x5e')]['id']}})['then'](handleEntityNotFound(_0x317c27,null))[_0x6604('0x22')](function(_0x1f12bf){if(_0x1f12bf){_0x191d40[_0x6604('0x48')]=_[_0x6604('0x4a')](db[_0x6604('0x127')]['rawAttributes']);_0x191d40['query']=_[_0x6604('0x4a')](_0xd6cd1b[_0x6604('0x49')]);_0x191d40[_0x6604('0x4b')]=_[_0x6604('0x4c')](_0x191d40['model'],_0x191d40[_0x6604('0x49')]);_0x340a8e['attributes']=_[_0x6604('0x4c')](_0x191d40[_0x6604('0x48')],qs[_0x6604('0x4e')](_0xd6cd1b[_0x6604('0x49')][_0x6604('0x4e')]));_0x340a8e[_0x6604('0x4d')]=_0x340a8e[_0x6604('0x4d')][_0x6604('0x4f')]?_0x340a8e[_0x6604('0x4d')]:_0x191d40[_0x6604('0x48')];if(!_0xd6cd1b[_0x6604('0x49')]['hasOwnProperty'](_0x6604('0x51'))){_0x340a8e[_0x6604('0x2f')]=qs['limit'](_0xd6cd1b[_0x6604('0x49')][_0x6604('0x2f')]);_0x340a8e['offset']=qs[_0x6604('0x32')](_0xd6cd1b[_0x6604('0x49')][_0x6604('0x32')]);}_0x340a8e[_0x6604('0x52')]=qs[_0x6604('0x53')](_0xd6cd1b['query']['sort']);_0x340a8e[_0x6604('0x54')]=qs[_0x6604('0x4b')](_[_0x6604('0x55')](_0xd6cd1b[_0x6604('0x49')],_0x191d40[_0x6604('0x4b')]));_0x340a8e[_0x6604('0x54')][_0x6604('0x6a')]=_0x1f12bf['id'];if(_0xd6cd1b['query'][_0x6604('0x56')]){_0x340a8e['where']=_[_0x6604('0x57')](_0x340a8e['where'],{'$or':_[_0x6604('0x42')](_0x340a8e['attributes'],function(_0x5b1a75){var _0x7ad0b1={};_0x7ad0b1[_0x5b1a75]={'$like':'%'+_0xd6cd1b['query'][_0x6604('0x56')]+'%'};return _0x7ad0b1;})});}_0x340a8e=_[_0x6604('0x57')]({},_0x340a8e,_0xd6cd1b[_0x6604('0x59')]);return db[_0x6604('0x127')][_0x6604('0x31')]({'where':_0x340a8e[_0x6604('0x54')]})['then'](function(_0x5310cc){_0x13eed4[_0x6604('0x31')]=_0x5310cc;if(_0xd6cd1b['query']['includeAll']){_0x340a8e[_0x6604('0x5b')]=[{'all':!![]}];}else{_0x340a8e[_0x6604('0x5b')]=[{'model':db[_0x6604('0x91')],'as':'Contact','required':![]},{'model':db[_0x6604('0xe3')],'as':_0x6604('0x128'),'required':![]}];}return db[_0x6604('0x127')][_0x6604('0x6c')](_0x340a8e);})['then'](function(_0x26928f){_0x13eed4[_0x6604('0x5c')]=_0x26928f;return _0x13eed4;});}})['then'](respondWithFilteredResult(_0x317c27,_0x340a8e))['catch'](handleError(_0x317c27,null));};exports[_0x6604('0x129')]=function(_0x19f558,_0x2de40c,_0xa77b4c){return db[_0x6604('0x43')][_0x6604('0x65')]({'where':{'id':_0x19f558[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x2de40c,null))[_0x6604('0x22')](function(_0x2459c0){if(_0x2459c0){return _0x2459c0['addAgents'](_0x19f558[_0x6604('0x60')][_0x6604('0x6e')],_[_0x6604('0xf9')](_0x19f558[_0x6604('0x60')],[_0x6604('0x6e'),'id'])||{})[_0x6604('0xbd')](function(_0x3bfd0a){for(var _0x433798=0x0;_0x433798<_0x19f558[_0x6604('0x60')]['ids'][_0x6604('0x4f')];_0x433798+=0x1){socket['emit'](_0x6604('0x12a'),{'UserId':Number(_0x19f558['body'][_0x6604('0x6e')][_0x433798]),'ChatWebsiteId':Number(_0x19f558[_0x6604('0x5e')]['id'])});}return _0x3bfd0a;});}})[_0x6604('0x22')](respondWithResult(_0x2de40c,null))[_0x6604('0x2a')](handleError(_0x2de40c,null));};exports[_0x6604('0x12b')]=function(_0x2674d9,_0x2f4e0a,_0x3cb6d4){return db[_0x6604('0x43')][_0x6604('0x65')]({'where':{'id':_0x2674d9[_0x6604('0x5e')]['id']}})[_0x6604('0x22')](handleEntityNotFound(_0x2f4e0a,null))[_0x6604('0x22')](function(_0x490ad6){if(_0x490ad6){return _0x490ad6[_0x6604('0x12b')](_0x2674d9[_0x6604('0x49')]['ids'])[_0x6604('0x22')](function(){if(_[_0x6604('0x12c')](_0x2674d9[_0x6604('0x49')][_0x6604('0x6e')])){for(var _0x5a9a5b=0x0;_0x5a9a5b<_0x2674d9[_0x6604('0x49')][_0x6604('0x6e')][_0x6604('0x4f')];_0x5a9a5b+=0x1){socket[_0x6604('0x12d')](_0x6604('0x12e'),{'UserId':Number(_0x2674d9[_0x6604('0x49')][_0x6604('0x6e')][_0x5a9a5b]),'ChatWebsiteId':Number(_0x2674d9['params']['id'])});}}else{socket[_0x6604('0x12d')](_0x6604('0x12e'),{'UserId':Number(_0x2674d9[_0x6604('0x49')][_0x6604('0x6e')]),'ChatWebsiteId':Number(_0x2674d9['params']['id'])});}});}})[_0x6604('0x22')](respondWithStatusCode(_0x2f4e0a,null))[_0x6604('0x2a')](handleError(_0x2f4e0a,null));};exports[_0x6604('0x12f')]=function(_0x2a242b,_0x2e1985,_0x4d37d1){var _0x353e4f={};var _0x2a5770={};var _0x35394c;var _0xc4defb;return db[_0x6604('0x43')]['findOne']({'where':{'id':_0x2a242b['params']['id']}})['then'](handleEntityNotFound(_0x2e1985,null))[_0x6604('0x22')](function(_0x32e8b5){if(_0x32e8b5){_0x35394c=_0x32e8b5;_0x2a5770['model']=_[_0x6604('0x4a')](db['User'][_0x6604('0x44')]);_0x2a5770[_0x6604('0x49')]=_[_0x6604('0x4a')](_0x2a242b[_0x6604('0x49')]);_0x2a5770['filters']=_[_0x6604('0x4c')](_0x2a5770[_0x6604('0x48')],_0x2a5770[_0x6604('0x49')]);_0x353e4f[_0x6604('0x4d')]=_['intersection'](_0x2a5770[_0x6604('0x48')],qs['fields'](_0x2a242b[_0x6604('0x49')]['fields']));_0x353e4f[_0x6604('0x4d')]=_0x353e4f[_0x6604('0x4d')][_0x6604('0x4f')]?_0x353e4f['attributes']:_0x2a5770[_0x6604('0x48')];_0x353e4f[_0x6604('0x52')]=qs[_0x6604('0x53')](_0x2a242b[_0x6604('0x49')][_0x6604('0x53')]);_0x353e4f[_0x6604('0x54')]=qs[_0x6604('0x4b')](_[_0x6604('0x55')](_0x2a242b['query'],_0x2a5770[_0x6604('0x4b')]));if(_0x2a242b[_0x6604('0x49')]['filter']){_0x353e4f[_0x6604('0x54')]=_[_0x6604('0x57')](_0x353e4f[_0x6604('0x54')],{'$or':_[_0x6604('0x42')](_0x353e4f[_0x6604('0x4d')],function(_0x1fe0ee){var _0x4affa2={};_0x4affa2[_0x1fe0ee]={'$like':'%'+_0x2a242b[_0x6604('0x49')][_0x6604('0x56')]+'%'};return _0x4affa2;})});}_0x353e4f=_['merge']({},_0x353e4f,_0x2a242b[_0x6604('0x59')]);return _0x35394c[_0x6604('0x12f')](_0x353e4f);}})['then'](function(_0x69eb46){if(_0x69eb46){_0xc4defb=_0x69eb46['length'];if(!_0x2a242b['query']['hasOwnProperty']('nolimit')){_0x353e4f[_0x6604('0x2f')]=qs[_0x6604('0x2f')](_0x2a242b[_0x6604('0x49')][_0x6604('0x2f')]);_0x353e4f[_0x6604('0x32')]=qs[_0x6604('0x32')](_0x2a242b['query']['offset']);}return _0x35394c['getAgents'](_0x353e4f);}})[_0x6604('0x22')](function(_0x1b7bcd){if(_0x1b7bcd){return _0x1b7bcd?{'count':_0xc4defb,'rows':_0x1b7bcd}:null;}})[_0x6604('0x22')](respondWithResult(_0x2e1985,null))[_0x6604('0x2a')](handleError(_0x2e1985,null));}; \ No newline at end of file +var _0xc426=['offline','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','service','host','port','secure','auth','pass','sendMail','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','ids','Contact','Owner','fullname','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','push','all','some','server/files/chat/iframe.ejs','x-real-ip','connection','replace','alignment','verticalAlignment','color','textColor','color_button','backgroundColor','addApplications','ChatApplication','destroy','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','ChatWebsite,\x20%s,\x20%s','message','result','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','ChatWebsites','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','keys','intersection','query','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','filters','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','findOne','Disposition','order','ChatWebsiteId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','getLogo','join','root','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','customerAvatar','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','List','DESC','account','applications','Applications','orderBy','priority','asc','Contacts','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','externalUrl','ContactId','interaction','ChatInteraction','spread','get','created','autoclose','close','unmanaged','*,*,*,*','User','UserId','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc426,0x1aa));var _0x6c42=function(_0x597117,_0x1e44f0){_0x597117=_0x597117-0x0;var _0x2ccb54=_0xc426[_0x597117];return _0x2ccb54;};'use strict';var emlformat=require(_0x6c42('0x0'));var rimraf=require(_0x6c42('0x1'));var zipdir=require(_0x6c42('0x2'));var jsonpatch=require(_0x6c42('0x3'));var rp=require(_0x6c42('0x4'));var moment=require(_0x6c42('0x5'));var BPromise=require(_0x6c42('0x6'));var Mustache=require('mustache');var util=require(_0x6c42('0x7'));var path=require(_0x6c42('0x8'));var sox=require(_0x6c42('0x9'));var csv=require(_0x6c42('0xa'));var ejs=require(_0x6c42('0xb'));var fs=require('fs');var fs_extra=require(_0x6c42('0xc'));var _=require(_0x6c42('0xd'));var squel=require(_0x6c42('0xe'));var crypto=require('crypto');var jsforce=require(_0x6c42('0xf'));var deskjs=require(_0x6c42('0x10'));var toCsv=require(_0x6c42('0xa'));var querystring=require(_0x6c42('0x11'));var Papa=require(_0x6c42('0x12'));var Redis=require(_0x6c42('0x13'));var authService=require(_0x6c42('0x14'));var qs=require(_0x6c42('0x15'));var as=require(_0x6c42('0x16'));var hardwareService=require(_0x6c42('0x17'));var logger=require('../../config/logger')(_0x6c42('0x18'));var utils=require(_0x6c42('0x19'));var config=require(_0x6c42('0x1a'));var licenseUtil=require(_0x6c42('0x1b'));var db=require(_0x6c42('0x1c'))['db'];config[_0x6c42('0x1d')]=_[_0x6c42('0x1e')](config[_0x6c42('0x1d')],{'host':_0x6c42('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c42('0x1d')]));require(_0x6c42('0x20'))[_0x6c42('0x21')](socket);var jayson=require(_0x6c42('0x22'));var client=jayson[_0x6c42('0x23')]['http']({'port':0x232c});var client9002=jayson[_0x6c42('0x23')]['http']({'port':0x232a});var client9003=jayson[_0x6c42('0x23')]['http']({'port':0x232b});var client9001=jayson[_0x6c42('0x23')][_0x6c42('0x24')]({'port':0x2329});function respondWithRpcPromise(_0x4102c6,_0x1bfa91,_0x330e3c,_0x1f3cd3){return new BPromise(function(_0x158403,_0x101fc8){var _0x52513c=_0x1f3cd3||client;return _0x52513c[_0x6c42('0x25')](_0x4102c6,_0x330e3c)[_0x6c42('0x26')](function(_0x25c746){logger[_0x6c42('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x1bfa91,'request\x20sent');logger[_0x6c42('0x28')](_0x6c42('0x29'),_0x1bfa91,_0x6c42('0x2a'),JSON['stringify'](_0x25c746));if(_0x25c746['error']){if(_0x25c746['error'][_0x6c42('0x2b')]===0x1f4){logger[_0x6c42('0x2c')](_0x6c42('0x2d'),_0x1bfa91,_0x25c746[_0x6c42('0x2c')][_0x6c42('0x2e')]);return _0x101fc8(_0x25c746[_0x6c42('0x2c')]['message']);}logger[_0x6c42('0x2c')](_0x6c42('0x2d'),_0x1bfa91,_0x25c746[_0x6c42('0x2c')][_0x6c42('0x2e')]);return _0x158403(_0x25c746[_0x6c42('0x2c')]['message']);}else{logger[_0x6c42('0x27')](_0x6c42('0x2d'),_0x1bfa91,_0x6c42('0x2a'));_0x158403(_0x25c746[_0x6c42('0x2f')]['message']);}})['catch'](function(_0x54c072){logger['error'](_0x6c42('0x2d'),_0x1bfa91,_0x54c072);_0x101fc8(_0x54c072);});});}function respondWithStatusCode(_0x38eb24,_0xec4058){_0xec4058=_0xec4058||0xcc;return function(_0x1f843f){if(_0x1f843f){return _0x38eb24[_0x6c42('0x30')](_0xec4058);}return _0x38eb24[_0x6c42('0x31')](_0xec4058)[_0x6c42('0x32')]();};}function respondWithResult(_0x103250,_0x507a50){_0x507a50=_0x507a50||0xc8;return function(_0x119333){if(_0x119333){return _0x103250['status'](_0x507a50)[_0x6c42('0x33')](_0x119333);}};}function respondWithFilteredResult(_0x2ff700,_0x225171){return function(_0x3b311f){if(_0x3b311f){var _0x1e475e=typeof _0x225171['offset']===_0x6c42('0x34')&&typeof _0x225171[_0x6c42('0x35')]===_0x6c42('0x34');var _0x30303f=_0x3b311f[_0x6c42('0x36')];var _0x17d940=_0x1e475e?0x0:_0x225171[_0x6c42('0x37')];var _0x8c8446=_0x1e475e?_0x3b311f['count']:_0x225171[_0x6c42('0x37')]+_0x225171[_0x6c42('0x35')];var _0x174669;if(_0x8c8446>=_0x30303f){_0x8c8446=_0x30303f;_0x174669=0xc8;}else{_0x174669=0xce;}_0x2ff700[_0x6c42('0x31')](_0x174669);return _0x2ff700['set'](_0x6c42('0x38'),_0x17d940+'-'+_0x8c8446+'/'+_0x30303f)[_0x6c42('0x33')](_0x3b311f);}return null;};}function patchUpdates(_0x13d75f){return function(_0x2709fc){try{jsonpatch[_0x6c42('0x39')](_0x2709fc,_0x13d75f,!![]);}catch(_0x1bd239){return BPromise[_0x6c42('0x3a')](_0x1bd239);}return _0x2709fc['save']();};}function saveUpdates(_0x37d6c6,_0x5eeec4){return function(_0x450474){if(_0x450474){return _0x450474[_0x6c42('0x3b')](_0x37d6c6)[_0x6c42('0x26')](function(_0x3d10c2){return _0x3d10c2;});}return null;};}function removeEntity(_0x3e0c29,_0x140919){return function(_0x1e22d4){if(_0x1e22d4){return _0x1e22d4['destroy']()['then'](function(){var _0x58533e=_0x1e22d4['get']({'plain':!![]});var _0x56ff72=_0x6c42('0x3c');return db[_0x6c42('0x3d')]['destroy']({'where':{'type':_0x56ff72,'resourceId':_0x58533e['id']}})[_0x6c42('0x26')](function(){return _0x1e22d4;});})[_0x6c42('0x26')](function(){_0x3e0c29['status'](0xcc)[_0x6c42('0x32')]();});}};}function handleEntityNotFound(_0x5a22c0,_0x59ae18){return function(_0x58171d){if(!_0x58171d){_0x5a22c0[_0x6c42('0x30')](0x194);}return _0x58171d;};}function handleError(_0x554279,_0x754a5b){_0x754a5b=_0x754a5b||0x1f4;return function(_0x32b039){logger[_0x6c42('0x2c')](_0x32b039['stack']);if(_0x32b039[_0x6c42('0x3e')]){delete _0x32b039[_0x6c42('0x3e')];}_0x554279['status'](_0x754a5b)['send'](_0x32b039);};}exports[_0x6c42('0x3f')]=function(_0x553e98,_0x3e0823){var _0x251978={'include':[{'model':db[_0x6c42('0x40')],'as':_0x6c42('0x41')}]},_0x58d297={},_0x9816e1={'count':0x0,'rows':[]};var _0x44db30=_[_0x6c42('0x42')](db[_0x6c42('0x43')][_0x6c42('0x44')],function(_0x5b6051){return{'name':_0x5b6051[_0x6c42('0x45')],'type':_0x5b6051[_0x6c42('0x46')]['key']};});_0x58d297[_0x6c42('0x47')]=_['map'](_0x44db30,'name');_0x58d297['query']=_[_0x6c42('0x48')](_0x553e98['query']);_0x58d297['filters']=_[_0x6c42('0x49')](_0x58d297[_0x6c42('0x47')],_0x58d297[_0x6c42('0x4a')]);_0x251978['attributes']=_[_0x6c42('0x49')](_0x58d297[_0x6c42('0x47')],qs[_0x6c42('0x4b')](_0x553e98[_0x6c42('0x4a')][_0x6c42('0x4b')]));_0x251978[_0x6c42('0x4c')]=_0x251978[_0x6c42('0x4c')]['length']?_0x251978[_0x6c42('0x4c')]:_0x58d297[_0x6c42('0x47')];if(!_0x553e98[_0x6c42('0x4a')][_0x6c42('0x4d')](_0x6c42('0x4e'))){_0x251978[_0x6c42('0x35')]=qs[_0x6c42('0x35')](_0x553e98['query']['limit']);_0x251978[_0x6c42('0x37')]=qs[_0x6c42('0x37')](_0x553e98[_0x6c42('0x4a')][_0x6c42('0x37')]);}_0x251978['order']=qs[_0x6c42('0x4f')](_0x553e98[_0x6c42('0x4a')][_0x6c42('0x4f')]);_0x251978[_0x6c42('0x50')]=qs['filters'](_[_0x6c42('0x51')](_0x553e98[_0x6c42('0x4a')],_0x58d297['filters']),_0x44db30);if(_0x553e98[_0x6c42('0x4a')][_0x6c42('0x52')]){_0x251978[_0x6c42('0x50')]=_['merge'](_0x251978[_0x6c42('0x50')],{'$or':_[_0x6c42('0x42')](_0x44db30,function(_0xa409ce){if(_0xa409ce[_0x6c42('0x46')]!==_0x6c42('0x53')){var _0x5ea356={};_0x5ea356[_0xa409ce[_0x6c42('0x3e')]]={'$like':'%'+_0x553e98[_0x6c42('0x4a')][_0x6c42('0x52')]+'%'};return _0x5ea356;}})});}_0x251978=_[_0x6c42('0x54')]({},_0x251978,_0x553e98[_0x6c42('0x55')]);var _0x35fb1b={'where':_0x251978['where']};return db[_0x6c42('0x43')][_0x6c42('0x36')](_0x35fb1b)['then'](function(_0x52378b){_0x9816e1[_0x6c42('0x36')]=_0x52378b;if(_0x553e98[_0x6c42('0x4a')][_0x6c42('0x56')]){_0x251978[_0x6c42('0x57')]=[{'all':!![]}];}return db[_0x6c42('0x43')][_0x6c42('0x58')](_0x251978);})[_0x6c42('0x26')](function(_0x260b07){_0x9816e1[_0x6c42('0x59')]=_0x260b07;return _0x9816e1;})[_0x6c42('0x26')](respondWithFilteredResult(_0x3e0823,_0x251978))[_0x6c42('0x5a')](handleError(_0x3e0823,null));};exports[_0x6c42('0x5b')]=function(_0x1de9cc,_0x284f8e){var _0x1c9ebf={'raw':![],'where':{'id':_0x1de9cc[_0x6c42('0x5c')]['id']},'include':[{'model':db[_0x6c42('0x40')],'as':_0x6c42('0x41')}]},_0x4a1513={};_0x4a1513['model']=_[_0x6c42('0x48')](db[_0x6c42('0x43')][_0x6c42('0x44')]);_0x4a1513[_0x6c42('0x4a')]=_[_0x6c42('0x48')](_0x1de9cc[_0x6c42('0x4a')]);_0x4a1513[_0x6c42('0x5d')]=_[_0x6c42('0x49')](_0x4a1513[_0x6c42('0x47')],_0x4a1513[_0x6c42('0x4a')]);_0x1c9ebf['attributes']=_[_0x6c42('0x49')](_0x4a1513['model'],qs['fields'](_0x1de9cc[_0x6c42('0x4a')][_0x6c42('0x4b')]));_0x1c9ebf[_0x6c42('0x4c')]=_0x1c9ebf['attributes'][_0x6c42('0x5e')]?_0x1c9ebf[_0x6c42('0x4c')]:_0x4a1513[_0x6c42('0x47')];if(_0x1de9cc[_0x6c42('0x4a')][_0x6c42('0x56')]){_0x1c9ebf[_0x6c42('0x57')]=[{'all':!![]}];}_0x1c9ebf=_['merge']({},_0x1c9ebf,_0x1de9cc[_0x6c42('0x55')]);return db['ChatWebsite'][_0x6c42('0x5f')](_0x1c9ebf)[_0x6c42('0x26')](handleEntityNotFound(_0x284f8e,null))['then'](respondWithResult(_0x284f8e,null))[_0x6c42('0x5a')](handleError(_0x284f8e,null));};exports['create']=function(_0x1522f6,_0x5547ae){return db[_0x6c42('0x43')][_0x6c42('0x60')](_0x1522f6[_0x6c42('0x61')],{})[_0x6c42('0x26')](function(_0x27b442){var _0x229e72=_0x1522f6[_0x6c42('0x62')]['get']({'plain':!![]});if(!_0x229e72)throw new Error(_0x6c42('0x63'));if(_0x229e72['role']==='user'){var _0x3140ab=_0x27b442['get']({'plain':!![]});var _0x5898dc=_0x6c42('0x3c');return db[_0x6c42('0x64')]['find']({'where':{'name':_0x5898dc,'userProfileId':_0x229e72[_0x6c42('0x65')]},'raw':!![]})['then'](function(_0x4b0674){if(_0x4b0674&&_0x4b0674['autoAssociation']===0x0){return db[_0x6c42('0x3d')][_0x6c42('0x60')]({'name':_0x3140ab[_0x6c42('0x3e')],'resourceId':_0x3140ab['id'],'type':_0x4b0674[_0x6c42('0x3e')],'sectionId':_0x4b0674['id']},{})[_0x6c42('0x26')](function(){return _0x27b442;});}else{return _0x27b442;}})['catch'](function(_0x550a86){logger[_0x6c42('0x2c')](_0x6c42('0x66'),_0x550a86);throw _0x550a86;});}return _0x27b442;})[_0x6c42('0x26')](respondWithResult(_0x5547ae,0xc9))[_0x6c42('0x5a')](handleError(_0x5547ae,null));};exports[_0x6c42('0x3b')]=function(_0x3cc1c1,_0x2f67f5){if(_0x3cc1c1[_0x6c42('0x61')]['id']){delete _0x3cc1c1[_0x6c42('0x61')]['id'];}return db[_0x6c42('0x43')][_0x6c42('0x5f')]({'where':{'id':_0x3cc1c1[_0x6c42('0x5c')]['id']},'include':[{'model':db[_0x6c42('0x40')],'as':_0x6c42('0x41')}]})[_0x6c42('0x26')](handleEntityNotFound(_0x2f67f5,null))[_0x6c42('0x26')](saveUpdates(_0x3cc1c1[_0x6c42('0x61')],null))['then'](respondWithResult(_0x2f67f5,null))[_0x6c42('0x5a')](handleError(_0x2f67f5,null));};exports['destroy']=function(_0x521a33,_0x3c3be0){return db['ChatWebsite']['find']({'where':{'id':_0x521a33['params']['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x3c3be0,null))[_0x6c42('0x26')](removeEntity(_0x3c3be0,null))['catch'](handleError(_0x3c3be0,null));};exports['describe']=function(_0x429182,_0x133ab3){return db['ChatWebsite'][_0x6c42('0x67')]()['then'](respondWithResult(_0x133ab3,null))[_0x6c42('0x5a')](handleError(_0x133ab3,null));};exports[_0x6c42('0x68')]=function(_0x4b0d56,_0x42e063,_0x2746f0){if(_0x4b0d56['body']['id']){delete _0x4b0d56[_0x6c42('0x61')]['id'];}return db[_0x6c42('0x43')][_0x6c42('0x5f')]({'where':{'id':_0x4b0d56[_0x6c42('0x5c')]['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x42e063,null))[_0x6c42('0x26')](function(_0x1ad827){if(_0x1ad827){_0x4b0d56[_0x6c42('0x61')]['ChatWebsiteId']=_0x1ad827['id'];return db['Disposition'][_0x6c42('0x60')](_0x4b0d56[_0x6c42('0x61')]);}})[_0x6c42('0x26')](respondWithResult(_0x42e063,null))['catch'](handleError(_0x42e063,null));};exports['getDispositions']=function(_0x569387,_0x156fbb,_0x53fd99){var _0x53757a={'raw':![],'where':{}};var _0x5dbbb3={};var _0x4cc303={'count':0x0,'rows':[]};return db[_0x6c42('0x43')][_0x6c42('0x69')]({'where':{'id':_0x569387[_0x6c42('0x5c')]['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x156fbb,null))[_0x6c42('0x26')](function(_0x57a586){if(_0x57a586){_0x5dbbb3[_0x6c42('0x47')]=_[_0x6c42('0x48')](db[_0x6c42('0x6a')]['rawAttributes']);_0x5dbbb3[_0x6c42('0x4a')]=_[_0x6c42('0x48')](_0x569387['query']);_0x5dbbb3['filters']=_['intersection'](_0x5dbbb3[_0x6c42('0x47')],_0x5dbbb3[_0x6c42('0x4a')]);_0x53757a['attributes']=_[_0x6c42('0x49')](_0x5dbbb3[_0x6c42('0x47')],qs[_0x6c42('0x4b')](_0x569387[_0x6c42('0x4a')][_0x6c42('0x4b')]));_0x53757a[_0x6c42('0x4c')]=_0x53757a[_0x6c42('0x4c')][_0x6c42('0x5e')]?_0x53757a[_0x6c42('0x4c')]:_0x5dbbb3[_0x6c42('0x47')];if(!_0x569387[_0x6c42('0x4a')]['hasOwnProperty'](_0x6c42('0x4e'))){_0x53757a[_0x6c42('0x35')]=qs[_0x6c42('0x35')](_0x569387['query'][_0x6c42('0x35')]);_0x53757a[_0x6c42('0x37')]=qs[_0x6c42('0x37')](_0x569387[_0x6c42('0x4a')][_0x6c42('0x37')]);}_0x53757a[_0x6c42('0x6b')]=qs[_0x6c42('0x4f')](_0x569387['query'][_0x6c42('0x4f')]);_0x53757a[_0x6c42('0x50')]=qs['filters'](_[_0x6c42('0x51')](_0x569387[_0x6c42('0x4a')],_0x5dbbb3[_0x6c42('0x5d')]));_0x53757a[_0x6c42('0x50')][_0x6c42('0x6c')]=_0x57a586['id'];if(_0x569387[_0x6c42('0x4a')][_0x6c42('0x52')]){_0x53757a[_0x6c42('0x50')]=_[_0x6c42('0x54')](_0x53757a[_0x6c42('0x50')],{'$or':_[_0x6c42('0x42')](_0x53757a[_0x6c42('0x4c')],function(_0x5e38d0){var _0x3d93d0={};_0x3d93d0[_0x5e38d0]={'$like':'%'+_0x569387['query'][_0x6c42('0x52')]+'%'};return _0x3d93d0;})});}_0x53757a=_[_0x6c42('0x54')]({},_0x53757a,_0x569387['options']);return db['Disposition'][_0x6c42('0x36')]({'where':_0x53757a[_0x6c42('0x50')]})[_0x6c42('0x26')](function(_0x141a54){_0x4cc303[_0x6c42('0x36')]=_0x141a54;if(_0x569387[_0x6c42('0x4a')]['includeAll']){_0x53757a[_0x6c42('0x57')]=[{'all':!![]}];}return db[_0x6c42('0x6a')]['findAll'](_0x53757a);})['then'](function(_0x3937e3){_0x4cc303[_0x6c42('0x59')]=_0x3937e3;return _0x4cc303;});}})[_0x6c42('0x26')](respondWithFilteredResult(_0x156fbb,_0x53757a))['catch'](handleError(_0x156fbb,null));};exports[_0x6c42('0x6d')]=function(_0x4c01e8,_0x898795,_0x261d7c){return db[_0x6c42('0x43')]['find']({'where':{'id':_0x4c01e8[_0x6c42('0x5c')]['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x898795,null))['then'](function(_0x5f1002){if(_0x5f1002){return _0x5f1002[_0x6c42('0x6d')](_0x4c01e8[_0x6c42('0x4a')]['ids']);}})[_0x6c42('0x26')](respondWithStatusCode(_0x898795,null))[_0x6c42('0x5a')](handleError(_0x898795,null));};exports[_0x6c42('0x6e')]=function(_0x1d7f44,_0x3eef24,_0x32f1cb){if(_0x1d7f44[_0x6c42('0x61')]['id']){delete _0x1d7f44[_0x6c42('0x61')]['id'];}return db[_0x6c42('0x43')][_0x6c42('0x5f')]({'where':{'id':_0x1d7f44[_0x6c42('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3eef24,null))['then'](function(_0x4c6745){if(_0x4c6745){_0x1d7f44['body'][_0x6c42('0x6c')]=_0x4c6745['id'];return db[_0x6c42('0x6f')][_0x6c42('0x60')](_0x1d7f44[_0x6c42('0x61')]);}})[_0x6c42('0x26')](respondWithResult(_0x3eef24,null))[_0x6c42('0x5a')](handleError(_0x3eef24,null));};exports[_0x6c42('0x70')]=function(_0x4cb3ca,_0x1aabed,_0x3a849a){var _0x4dae58={'raw':![],'where':{}};var _0x46e161={};var _0x381757={'count':0x0,'rows':[]};return db[_0x6c42('0x43')][_0x6c42('0x69')]({'where':{'id':_0x4cb3ca[_0x6c42('0x5c')]['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x1aabed,null))[_0x6c42('0x26')](function(_0x4fdc21){if(_0x4fdc21){_0x46e161[_0x6c42('0x47')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x46e161[_0x6c42('0x4a')]=_['keys'](_0x4cb3ca[_0x6c42('0x4a')]);_0x46e161[_0x6c42('0x5d')]=_[_0x6c42('0x49')](_0x46e161[_0x6c42('0x47')],_0x46e161[_0x6c42('0x4a')]);_0x4dae58[_0x6c42('0x4c')]=_[_0x6c42('0x49')](_0x46e161['model'],qs[_0x6c42('0x4b')](_0x4cb3ca['query'][_0x6c42('0x4b')]));_0x4dae58[_0x6c42('0x4c')]=_0x4dae58[_0x6c42('0x4c')][_0x6c42('0x5e')]?_0x4dae58['attributes']:_0x46e161[_0x6c42('0x47')];if(!_0x4cb3ca[_0x6c42('0x4a')][_0x6c42('0x4d')](_0x6c42('0x4e'))){_0x4dae58[_0x6c42('0x35')]=qs[_0x6c42('0x35')](_0x4cb3ca[_0x6c42('0x4a')][_0x6c42('0x35')]);_0x4dae58['offset']=qs[_0x6c42('0x37')](_0x4cb3ca[_0x6c42('0x4a')][_0x6c42('0x37')]);}_0x4dae58[_0x6c42('0x6b')]=qs['sort'](_0x4cb3ca[_0x6c42('0x4a')][_0x6c42('0x4f')]);_0x4dae58[_0x6c42('0x50')]=qs[_0x6c42('0x5d')](_[_0x6c42('0x51')](_0x4cb3ca['query'],_0x46e161['filters']));_0x4dae58[_0x6c42('0x50')][_0x6c42('0x6c')]=_0x4fdc21['id'];if(_0x4cb3ca[_0x6c42('0x4a')][_0x6c42('0x52')]){_0x4dae58['where']=_[_0x6c42('0x54')](_0x4dae58[_0x6c42('0x50')],{'$or':_['map'](_0x4dae58[_0x6c42('0x4c')],function(_0x4db975){var _0x1ee1ef={};_0x1ee1ef[_0x4db975]={'$like':'%'+_0x4cb3ca[_0x6c42('0x4a')][_0x6c42('0x52')]+'%'};return _0x1ee1ef;})});}_0x4dae58=_[_0x6c42('0x54')]({},_0x4dae58,_0x4cb3ca[_0x6c42('0x55')]);return db['CannedAnswer'][_0x6c42('0x36')]({'where':_0x4dae58[_0x6c42('0x50')]})[_0x6c42('0x26')](function(_0x48eecd){_0x381757[_0x6c42('0x36')]=_0x48eecd;if(_0x4cb3ca[_0x6c42('0x4a')][_0x6c42('0x56')]){_0x4dae58[_0x6c42('0x57')]=[{'all':!![]}];}return db[_0x6c42('0x6f')][_0x6c42('0x58')](_0x4dae58);})['then'](function(_0x2e9dc5){_0x381757[_0x6c42('0x59')]=_0x2e9dc5;return _0x381757;});}})['then'](respondWithFilteredResult(_0x1aabed,_0x4dae58))[_0x6c42('0x5a')](handleError(_0x1aabed,null));};exports[_0x6c42('0x71')]=function(_0x4b1120,_0x2d435d,_0x7fa76c){return db[_0x6c42('0x43')][_0x6c42('0x5f')]({'where':{'id':_0x4b1120[_0x6c42('0x5c')]['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x2d435d,null))[_0x6c42('0x26')](function(_0x3be030){if(_0x3be030){return _0x3be030[_0x6c42('0x71')](_0x4b1120[_0x6c42('0x4a')]['ids']);}})[_0x6c42('0x26')](respondWithStatusCode(_0x2d435d,null))[_0x6c42('0x5a')](handleError(_0x2d435d,null));};exports[_0x6c42('0x72')]=function(_0x2e04b5,_0x4e3d15,_0x3e13b6){_0x2e04b5[_0x6c42('0x61')][_0x6c42('0x73')]=_0x2e04b5[_0x6c42('0x74')][_0x6c42('0x75')];return db[_0x6c42('0x43')][_0x6c42('0x5f')]({'where':{'id':_0x2e04b5['params']['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x4e3d15,null))[_0x6c42('0x26')](saveUpdates(_0x2e04b5[_0x6c42('0x61')],null))[_0x6c42('0x26')](respondWithResult(_0x4e3d15,null))[_0x6c42('0x5a')](handleError(_0x4e3d15,null));};exports[_0x6c42('0x76')]=function(_0x576700,_0x5dada2,_0x443309){_0x576700['body'][_0x6c42('0x77')]=_0x576700[_0x6c42('0x74')][_0x6c42('0x75')];return db[_0x6c42('0x43')][_0x6c42('0x5f')]({'where':{'id':_0x576700[_0x6c42('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5dada2,null))[_0x6c42('0x26')](saveUpdates(_0x576700[_0x6c42('0x61')],null))[_0x6c42('0x26')](respondWithResult(_0x5dada2,null))['catch'](handleError(_0x5dada2,null));};exports[_0x6c42('0x78')]=function(_0x293de0,_0x4acaf2,_0x32c6db){_0x293de0[_0x6c42('0x61')]['customerAvatar']=_0x293de0[_0x6c42('0x74')][_0x6c42('0x75')];return db[_0x6c42('0x43')][_0x6c42('0x5f')]({'where':{'id':_0x293de0['params']['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x4acaf2,null))[_0x6c42('0x26')](saveUpdates(_0x293de0[_0x6c42('0x61')],null))[_0x6c42('0x26')](respondWithResult(_0x4acaf2,null))[_0x6c42('0x5a')](handleError(_0x4acaf2,null));};exports['addSystemAvatar']=function(_0x4660f4,_0xc40c1f,_0x4187cd){_0x4660f4[_0x6c42('0x61')]['systemAvatar']=_0x4660f4['file'][_0x6c42('0x75')];return db[_0x6c42('0x43')][_0x6c42('0x5f')]({'where':{'id':_0x4660f4[_0x6c42('0x5c')]['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0xc40c1f,null))[_0x6c42('0x26')](saveUpdates(_0x4660f4[_0x6c42('0x61')],null))[_0x6c42('0x26')](respondWithResult(_0xc40c1f,null))[_0x6c42('0x5a')](handleError(_0xc40c1f,null));};exports[_0x6c42('0x79')]=function(_0x2f5635,_0xd41b86,_0x14a0ac){var _0x106c6a=path[_0x6c42('0x7a')](config[_0x6c42('0x7b')],'server/files/images/logos/default_logo.svg');var _0x15e1f0={'where':{'id':_0x2f5635['params']['id']},'attributes':['id',_0x6c42('0x73')],'raw':!![]};var _0x4615f0=![];return require('../../config/license/util')[_0x6c42('0x7c')]()[_0x6c42('0x26')](function(_0x10945f){if(_0x10945f){_0x4615f0=_0x10945f[_0x6c42('0x7d')];}})[_0x6c42('0x26')](function(){return db[_0x6c42('0x43')][_0x6c42('0x5f')](_0x15e1f0);})[_0x6c42('0x26')](handleEntityNotFound(_0xd41b86,null))[_0x6c42('0x26')](function(_0x566bae){if(_0x566bae){if(!_[_0x6c42('0x7e')](_0x566bae[_0x6c42('0x73')])){if(fs['existsSync'](path['join'](config[_0x6c42('0x7b')],_0x6c42('0x7f'),_0x566bae[_0x6c42('0x73')]))&&_0x4615f0){_0x106c6a=path[_0x6c42('0x7a')](config['root'],_0x6c42('0x7f'),_0x566bae[_0x6c42('0x73')]);}}return _0xd41b86[_0x6c42('0x80')](_0x106c6a);}})['catch'](handleError(_0xd41b86,null));};exports[_0x6c42('0x81')]=function(_0x2105c6,_0x5f6bee,_0x5d7e0c){var _0x1566d2=path[_0x6c42('0x7a')](config[_0x6c42('0x7b')],'server/files/images/avatars/default_avatar.png');var _0x799bcf={'where':{'id':_0x2105c6[_0x6c42('0x5c')]['id']},'attributes':['id',_0x6c42('0x77')],'raw':!![]};return db[_0x6c42('0x43')][_0x6c42('0x5f')](_0x799bcf)[_0x6c42('0x26')](handleEntityNotFound(_0x5f6bee,null))[_0x6c42('0x26')](function(_0x474a5a){if(_0x474a5a){if(!_[_0x6c42('0x7e')](_0x474a5a[_0x6c42('0x77')])){if(fs['existsSync'](path[_0x6c42('0x7a')](config[_0x6c42('0x7b')],_0x6c42('0x82'),_0x474a5a[_0x6c42('0x77')]))){_0x1566d2=path[_0x6c42('0x7a')](config[_0x6c42('0x7b')],_0x6c42('0x82'),_0x474a5a['agentAvatar']);}}return _0x5f6bee[_0x6c42('0x80')](_0x1566d2);}})['catch'](handleError(_0x5f6bee,null));};exports[_0x6c42('0x83')]=function(_0x1f975c,_0x35c8f2,_0x13e8f5){var _0x1c6aca=path[_0x6c42('0x7a')](config[_0x6c42('0x7b')],'server/files/images/avatars/customer_avatar.png');var _0x11824e={'where':{'id':_0x1f975c[_0x6c42('0x5c')]['id']},'attributes':['id',_0x6c42('0x84'),_0x6c42('0x85')],'raw':!![]};return db['ChatWebsite'][_0x6c42('0x5f')](_0x11824e)['then'](handleEntityNotFound(_0x35c8f2,null))[_0x6c42('0x26')](function(_0x478669){if(_0x478669){if(!_[_0x6c42('0x7e')](_0x478669[_0x6c42('0x84')])){if(fs[_0x6c42('0x86')](path[_0x6c42('0x7a')](config[_0x6c42('0x7b')],'server/files/images/avatars/',_0x478669['customerAvatar']))&&_0x478669['showCustomerAvatar']){_0x1c6aca=path[_0x6c42('0x7a')](config['root'],_0x6c42('0x82'),_0x478669[_0x6c42('0x84')]);}}return _0x35c8f2[_0x6c42('0x80')](_0x1c6aca);}})[_0x6c42('0x5a')](handleError(_0x35c8f2,null));};exports[_0x6c42('0x87')]=function(_0x49a5a0,_0x38fe96,_0x501a14){var _0x581f11=path['join'](config[_0x6c42('0x7b')],_0x6c42('0x88'));var _0x10f55d={'where':{'id':_0x49a5a0[_0x6c42('0x5c')]['id']},'attributes':['id',_0x6c42('0x89')],'raw':!![]};return db[_0x6c42('0x43')][_0x6c42('0x5f')](_0x10f55d)[_0x6c42('0x26')](handleEntityNotFound(_0x38fe96,null))[_0x6c42('0x26')](function(_0x2d40ea){if(_0x2d40ea){if(!_[_0x6c42('0x7e')](_0x2d40ea[_0x6c42('0x89')])){if(fs[_0x6c42('0x86')](path[_0x6c42('0x7a')](config['root'],_0x6c42('0x82'),_0x2d40ea[_0x6c42('0x89')]))){_0x581f11=path[_0x6c42('0x7a')](config[_0x6c42('0x7b')],_0x6c42('0x82'),_0x2d40ea[_0x6c42('0x89')]);}}return _0x38fe96[_0x6c42('0x80')](_0x581f11);}})[_0x6c42('0x5a')](handleError(_0x38fe96,null));};exports[_0x6c42('0x8a')]=function(_0x1c6611,_0x5c4b3b,_0x311b6b){var _0x56aadd=require(_0x6c42('0x8b'));var _0x50decf=new _0x56aadd();var _0x185b1f=_0x50decf[_0x6c42('0x8c')](_0x1c6611['headers'][_0x6c42('0x8d')])[_0x6c42('0x8e')]();var _0x317123={'body':_0x1c6611['body'],'channel':'chat'};var _0x134072=[];var _0x2b282b=[];var _0x4638ad={};var _0x3b69d5=![];return db[_0x6c42('0x8f')]['describe']()[_0x6c42('0x26')](function(_0x1b7229){if(!_0x1b7229){throw new db[(_0x6c42('0x90'))][(_0x6c42('0x91'))](_0x6c42('0x92'));}_0x134072=_['difference'](_['keys'](_0x1b7229),[_0x6c42('0x93'),'updatedAt']);_0x2b282b=_[_0x6c42('0x94')](_[_0x6c42('0x48')](_0x1b7229),[_0x6c42('0x93'),_0x6c42('0x95'),_0x6c42('0x96'),_0x6c42('0x97')]);if(_0x1c6611['body']['id']){delete _0x1c6611[_0x6c42('0x61')]['id'];}if(_['isNil'](_0x1c6611[_0x6c42('0x61')]['from'])){throw new db['Sequelize'][(_0x6c42('0x91'))](_0x6c42('0x98'));}if(_['isNil'](_0x1c6611[_0x6c42('0x61')]['body'])||_0x1c6611[_0x6c42('0x61')][_0x6c42('0x61')]===''){throw new db[(_0x6c42('0x90'))][(_0x6c42('0x91'))](_0x6c42('0x99'));}if(_[_0x6c42('0x7e')](_0x1c6611[_0x6c42('0x61')][_0x6c42('0x9a')])){throw new db[(_0x6c42('0x90'))]['ValidationError'](_0x6c42('0x9b')+_0x2b282b);}if(!_[_0x6c42('0x9c')](_0x2b282b,_0x1c6611[_0x6c42('0x61')][_0x6c42('0x9a')])){throw new db['Sequelize'][(_0x6c42('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b282b);}_0x4638ad[_0x1c6611[_0x6c42('0x61')]['mapKey']]=_0x1c6611[_0x6c42('0x61')][_0x6c42('0x9d')];})[_0x6c42('0x26')](function(){return db[_0x6c42('0x43')][_0x6c42('0x5f')]({'where':{'id':_0x1c6611[_0x6c42('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x6c42('0x9e'),'include':[{'model':db[_0x6c42('0x8f')],'as':'Contacts','where':_0x4638ad,'limit':0x1,'order':[[_0x6c42('0x95'),_0x6c42('0x9f')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x6c42('0x26')](handleEntityNotFound(_0x5c4b3b,null))['then'](function(_0x7c4d72){if(_0x7c4d72&&_0x7c4d72[_0x6c42('0x9e')]){_0x317123[_0x6c42('0xa0')]=_0x7c4d72;_0x317123[_0x6c42('0xa1')]=_0x7c4d72[_0x6c42('0xa2')];_0x317123['list']=_0x7c4d72[_0x6c42('0x9e')];_0x317123['applications']=_[_0x6c42('0xa3')](_0x317123['applications'],[_0x6c42('0xa4')],[_0x6c42('0xa5')]);if(_0x317123[_0x6c42('0xa0')][_0x6c42('0xa2')]){delete _0x317123[_0x6c42('0xa0')][_0x6c42('0xa2')];}if(_0x317123['account'][_0x6c42('0x9e')]&&_0x317123[_0x6c42('0xa0')][_0x6c42('0x9e')]['Contacts'][_0x6c42('0x5e')]){return _0x317123[_0x6c42('0xa0')][_0x6c42('0x9e')][_0x6c42('0xa6')][0x0];}var _0x2fb67e=_['defaults'](_0x1c6611[_0x6c42('0x61')],{'firstName':_0x1c6611['body'][_0x6c42('0x9d')],'ListId':_0x7c4d72[_0x6c42('0x97')]});_0x2fb67e[_0x1c6611[_0x6c42('0x61')][_0x6c42('0x9a')]]=_0x1c6611[_0x6c42('0x61')][_0x6c42('0x9d')];return db[_0x6c42('0x8f')][_0x6c42('0x60')](_0x2fb67e,{'fields':_0x134072,'raw':!![]});}})[_0x6c42('0x26')](handleEntityNotFound(_0x5c4b3b,null))[_0x6c42('0x26')](function(_0x122555){_0x317123[_0x6c42('0xa7')]=_0x122555;var _0x501174=_0x1c6611[_0x6c42('0x61')][_0x6c42('0xa8')];if(_0x1c6611['headers'][_0x6c42('0xa9')]){_0x501174=_0x1c6611[_0x6c42('0xaa')]['cf-connecting-ip'];}else if(_0x1c6611['headers'][_0x6c42('0xab')]){_0x501174=_[_0x6c42('0xac')](_0x1c6611[_0x6c42('0xaa')][_0x6c42('0xab')][_0x6c42('0xad')](','));}if(_0x122555){var _0x4dc4ec={'ContactId':_0x122555['id'],'ChatWebsiteId':_0x1c6611[_0x6c42('0x5c')]['id'],'from':(_0x122555[_0x6c42('0xae')]||'')+'\x20'+(_0x122555[_0x6c42('0xaf')]||''),'customerIp':_0x501174,'customerPort':_0x1c6611[_0x6c42('0xaa')]['x-real-port']?_0x1c6611[_0x6c42('0xaa')][_0x6c42('0xb0')]:null,'referer':_0x1c6611['body'][_0x6c42('0xb1')],'browserName':_0x185b1f['browser'][_0x6c42('0x3e')]&&_0x185b1f[_0x6c42('0xb2')][_0x6c42('0xb3')]?util[_0x6c42('0xb4')](_0x6c42('0xb5'),_0x185b1f['browser']['name'],_0x185b1f[_0x6c42('0xb2')]['version']):_0x6c42('0xb6'),'browserVersion':_0x185b1f[_0x6c42('0xb2')][_0x6c42('0xb3')]||'unknown','osName':util[_0x6c42('0xb4')](_0x6c42('0xb5'),_0x185b1f['os'][_0x6c42('0x3e')],_0x185b1f['os']['version']),'osVersion':_0x185b1f['os'][_0x6c42('0xb3')],'deviceModel':_0x185b1f[_0x6c42('0xb7')]['model']&&_0x185b1f[_0x6c42('0xb7')][_0x6c42('0xb8')]?util[_0x6c42('0xb4')](_0x6c42('0xb9'),_0x185b1f['device']['model'],_0x185b1f[_0x6c42('0xb7')][_0x6c42('0xb8')],_0x185b1f[_0x6c42('0xb7')][_0x6c42('0x46')]):null,'deviceVendor':_0x185b1f['device'][_0x6c42('0xb8')],'deviceType':_0x185b1f[_0x6c42('0xb7')]['type'],'formData':JSON[_0x6c42('0xba')](_0x1c6611[_0x6c42('0x61')])};var _0x4bc090={'ChatWebsiteId':_0x1c6611['params']['id'],'closed':![]};if(_0x1c6611[_0x6c42('0x61')][_0x6c42('0xbb')]){_0x4bc090['threadId']=_0x1c6611[_0x6c42('0x61')]['threadId'];return db['ChatInteraction'][_0x6c42('0x5f')]({'where':_0x4bc090})[_0x6c42('0x26')](function(_0x2390e2){if(_0x2390e2){return[_0x2390e2,![]];}_0x4dc4ec[_0x6c42('0xbb')]=_0x1c6611[_0x6c42('0x61')][_0x6c42('0xbb')];_0x4dc4ec[_0x6c42('0xbc')]=_0x1c6611[_0x6c42('0x61')][_0x6c42('0xbc')];return db['ChatInteraction']['create'](_0x4dc4ec)[_0x6c42('0x26')](function(_0x4454ed){return[_0x4454ed,!![]];});});}_0x4bc090[_0x6c42('0xbd')]=_0x122555['id'];if(_0x1c6611[_0x6c42('0x61')][_0x6c42('0xbe')]&&_0x1c6611[_0x6c42('0x61')]['interaction']['id']){_0x4bc090['id']=_0x1c6611['body'][_0x6c42('0xbe')]['id'];return db[_0x6c42('0xbf')][_0x6c42('0x5f')]({'where':_0x4bc090})['then'](function(_0x130ea0){if(_0x130ea0){return[_0x130ea0,![]];}return db[_0x6c42('0xbf')][_0x6c42('0x60')](_0x4dc4ec)[_0x6c42('0x26')](function(_0x3bfa26){return[_0x3bfa26,!![]];});});}return db[_0x6c42('0xbf')][_0x6c42('0x60')](_0x4dc4ec)[_0x6c42('0x26')](function(_0x371e5f){return[_0x371e5f,!![]];});}})[_0x6c42('0xc0')](function(_0x273897,_0xee8102){if(_0x273897){_0x3b69d5=_0xee8102;if(!_0xee8102){var _0x5aa452={'from':(_0x317123[_0x6c42('0xa7')][_0x6c42('0xae')]||'')+'\x20'+(_0x317123[_0x6c42('0xa7')][_0x6c42('0xaf')]||'')};if(_0x1c6611[_0x6c42('0x61')]['threadId']&&_0x1c6611[_0x6c42('0x61')]['messageId']&&_0x1c6611['body'][_0x6c42('0xbb')]!=_0x1c6611['body']['messageId']){_0x5aa452['threadId']=_0x1c6611[_0x6c42('0x61')]['messageId'];}return _0x273897[_0x6c42('0x3b')](_0x5aa452);}else{return _0x273897;}}})[_0x6c42('0x26')](function(_0x4dfb1f){_0x317123[_0x6c42('0xbe')]=_0x4dfb1f[_0x6c42('0xc1')]({'plain':!![]});_0x317123[_0x6c42('0xbe')][_0x6c42('0xc2')]=_0x3b69d5;if(_0x317123['interaction']['created']){if(_0x317123['account'][_0x6c42('0xc3')]){_0x317123['applications']['push']({'id':0x0,'priority':_0x317123[_0x6c42('0xa1')][_0x6c42('0x5e')]+0x1,'app':_0x6c42('0xc4'),'appdata':_0x6c42('0xc5'),'interval':_0x6c42('0xc6')});}}return db['ChatMessage'][_0x6c42('0x60')]({'body':_0x1c6611[_0x6c42('0x61')]['body'],'ChatWebsiteId':_0x1c6611[_0x6c42('0x5c')]['id'],'ChatInteractionId':_0x4dfb1f['id'],'direction':'in','ContactId':_0x317123['contact']['id'],'AttachmentId':_0x1c6611['body']['AttachmentId']});})[_0x6c42('0x26')](function(_0x2eee75){_0x317123['message']=_0x2eee75;if(_0x317123[_0x6c42('0xbe')]['UserId']){return db[_0x6c42('0xc7')][_0x6c42('0x5f')]({'attributes':['id',_0x6c42('0x3e')],'where':{'id':_0x317123[_0x6c42('0xbe')][_0x6c42('0xc8')]}})[_0x6c42('0x26')](function(_0x65065f){if(_0x65065f){_0x317123[_0x6c42('0xa1')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x65065f['name']+','+(_0x317123[_0x6c42('0xa0')][_0x6c42('0xc9')]||0xa),'interval':'*,*,*,*'});_0x317123[_0x6c42('0xca')]=!![];}return respondWithRpcPromise('Start',_0x6c42('0xcb'),_0x317123);});}return respondWithRpcPromise(_0x6c42('0xcc'),'startRouting',_0x317123);})[_0x6c42('0x26')](function(_0x13681b){respondWithRpcPromise(_0x6c42('0xcd'),_0x6c42('0xcd'),{'event':_0x6c42('0x8a'),'message':_0x13681b},client9002);return _0x13681b;})[_0x6c42('0x26')](respondWithResult(_0x5c4b3b,null))[_0x6c42('0x5a')](handleError(_0x5c4b3b,null));};exports[_0x6c42('0xce')]=function(_0x2776dd,_0x2aaa67,_0x47ba72){var _0x5e6956,_0x1bb495,_0x2bec3e;var _0x41f2e9=[];var _0x38e857=[];var _0x5e9fdb={};var _0x370610=_0x2776dd[_0x6c42('0xcf')]||[];var _0x25a425=[];var _0xa17fb5;return db[_0x6c42('0x8f')][_0x6c42('0x67')]()[_0x6c42('0x26')](function(_0x32ce93){if(!_0x32ce93){throw new db['Sequelize'][(_0x6c42('0x91'))]('no\x20available\x20attributes');}_0x38e857=_[_0x6c42('0x94')](_[_0x6c42('0x48')](_0x32ce93),[_0x6c42('0x93'),'updatedAt']);_0x41f2e9=_['difference'](_['keys'](_0x32ce93),[_0x6c42('0x93'),_0x6c42('0x95'),_0x6c42('0x96'),_0x6c42('0x97')]);if(_0x2776dd[_0x6c42('0x61')]['id']){delete _0x2776dd[_0x6c42('0x61')]['id'];}if(_[_0x6c42('0x7e')](_0x2776dd[_0x6c42('0x61')][_0x6c42('0x9d')])){throw _0x2aaa67['status'](0x1f4)['send'](new db['Sequelize'][(_0x6c42('0x91'))](_0x6c42('0x98')));}if(_['isNil'](_0x2776dd[_0x6c42('0x61')]['body'])||_0x2776dd[_0x6c42('0x61')][_0x6c42('0x61')]===''){throw _0x2aaa67[_0x6c42('0x31')](0x1f4)[_0x6c42('0xd0')](new db[(_0x6c42('0x90'))][(_0x6c42('0x91'))](_0x6c42('0x99')));}if(_[_0x6c42('0x7e')](_0x2776dd[_0x6c42('0x61')][_0x6c42('0xd1')])){throw _0x2aaa67[_0x6c42('0x31')](0x1f4)[_0x6c42('0xd0')](new db[(_0x6c42('0x90'))][(_0x6c42('0x91'))](_0x6c42('0xd2')+_0x41f2e9));}if(!_[_0x6c42('0x9c')](_0x41f2e9,_0x2776dd[_0x6c42('0x61')][_0x6c42('0xd1')])){throw _0x2aaa67[_0x6c42('0x31')](0x1f4)[_0x6c42('0xd0')](new db[(_0x6c42('0x90'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x41f2e9));}_0x5e9fdb[_0x2776dd[_0x6c42('0x61')][_0x6c42('0xd1')]]=_0x2776dd[_0x6c42('0x61')]['from'];})['then'](function(){return db[_0x6c42('0x43')]['find']({'where':{'id':_0x2776dd[_0x6c42('0x5c')]['id']},'include':[{'model':db[_0x6c42('0xd3')],'as':'List'},{'model':db[_0x6c42('0xd4')],'as':_0x6c42('0xd4')}]});})[_0x6c42('0x26')](handleEntityNotFound(_0x2aaa67,null))[_0x6c42('0x26')](function(_0x55de95){if(_0x55de95&&_0x55de95[_0x6c42('0x9e')]){_0x1bb495=_0x55de95;var _0x4f44d1=_['defaults'](_0x2776dd[_0x6c42('0x61')],{'firstName':_0x2776dd[_0x6c42('0x61')][_0x6c42('0x9d')],'phone':_0x2776dd[_0x6c42('0x61')]['from'],'ListId':_0x55de95[_0x6c42('0x97')]});_0x4f44d1[_0x2776dd[_0x6c42('0x61')]['mapKeyOffline']]=_0x2776dd[_0x6c42('0x61')]['from'];return db[_0x6c42('0x8f')][_0x6c42('0xd5')]({'where':_0x5e9fdb,'defaults':_0x4f44d1});}})['spread'](function(_0x15a44e){if(_0x15a44e){_0x2bec3e=_0x15a44e;var _0xa94b8b=fs[_0x6c42('0xd6')](path['join'](config[_0x6c42('0x7b')],_0x6c42('0xd7')),_0x6c42('0xd8'));var _0x12f3f0=ejs[_0x6c42('0xd9')](_0xa94b8b,{'body':_[_0x6c42('0xda')](_0x2776dd[_0x6c42('0x61')][_0x6c42('0x61')]),'bodyTitle':_0x1bb495[_0x6c42('0xdb')]});return db[_0x6c42('0xdc')][_0x6c42('0x60')]({'body':_0x12f3f0,'ContactId':_0x15a44e['id'],'ChatWebsiteId':_0x1bb495['id']});}})[_0x6c42('0x26')](function(_0x1a52b1){_0xa17fb5=_0x1a52b1;if(_0x370610[_0x6c42('0x5e')]){var _0x535516=_0x370610['map'](function(_0x24658c){return{'name':_0x24658c[_0x6c42('0xdd')],'basename':_0x24658c[_0x6c42('0x75')],'type':_0x24658c[_0x6c42('0xde')],'ChatOfflineMessageId':_0x1a52b1['id']};});_0x25a425=_0x535516[_0x6c42('0x42')](_0x26a20b=>{var _0x323933={'filename':_0x26a20b['name'],'path':path[_0x6c42('0x7a')](config['root'],_0x6c42('0xdf'),_0x6c42('0xcf'),_0x6c42('0xe0'),_0x6c42('0xe1'),_0x26a20b[_0x6c42('0xe2')])};return _0x323933;});if(!_0x1bb495[_0x6c42('0xe3')]){return db[_0x6c42('0xe4')][_0x6c42('0xe5')](function(_0x1c7370){return db[_0x6c42('0xe6')][_0x6c42('0xe7')](_0x535516,{'transaction':_0x1c7370});});}}})['then'](function(){if(_0xa17fb5){_0x5e6956=_0xa17fb5;return db[_0x6c42('0xd4')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x6c42('0xe8')],'as':_0x6c42('0xe9'),'raw':!![]}]});}})['then'](function(_0x38e8eb){if(_0x38e8eb&&_0x38e8eb[_0x6c42('0xe9')]&&_0x1bb495['forwardOffline']&&_0x1bb495['forwardOfflineAddress']){var _0x112ed2={'tls':{'rejectUnauthorized':![]}};if(_0x38e8eb['Smtp'][_0x6c42('0xea')]){_0x112ed2[_0x6c42('0xea')]=_0x38e8eb[_0x6c42('0xe9')][_0x6c42('0xea')];}else{_0x112ed2[_0x6c42('0xeb')]=_0x38e8eb[_0x6c42('0xe9')][_0x6c42('0xeb')];_0x112ed2['port']=_0x38e8eb[_0x6c42('0xe9')][_0x6c42('0xec')];_0x112ed2[_0x6c42('0xed')]=_0x38e8eb['Smtp'][_0x6c42('0xed')];}if(_0x38e8eb[_0x6c42('0xe9')]['authentication']){_0x112ed2[_0x6c42('0xee')]={'user':_0x38e8eb[_0x6c42('0xe9')][_0x6c42('0x62')],'pass':_0x38e8eb[_0x6c42('0xe9')][_0x6c42('0xef')]};}return respondWithRpcPromise('SendMail',_0x6c42('0xf0'),{'account':_0x112ed2,'message':{'from':util[_0x6c42('0xb4')]('\x22%s\x22\x20<%s>',_0x38e8eb[_0x6c42('0x3e')],_0x38e8eb[_0x6c42('0xf1')]||_0x38e8eb[_0x6c42('0xe9')][_0x6c42('0x62')]),'to':_0x1bb495[_0x6c42('0xf2')],'subject':_0x1bb495[_0x6c42('0xf3')],'html':_0x5e6956[_0x6c42('0x61')],'attachments':_0x25a425}},client9003)[_0x6c42('0x26')](function(){return _0x5e6956;})[_0x6c42('0x5a')](function(_0x30fbcd){console['error'](_0x30fbcd);});}})['then'](function(){if(_0x1bb495&&_0x1bb495[_0x6c42('0xe3')]&&_0x1bb495[_0x6c42('0xf4')]){var _0x111bca=[];if(_0x370610['length']){_0x111bca=_0x370610[_0x6c42('0x42')](function(_0x70a565){return{'name':_0x70a565[_0x6c42('0xdd')],'basename':_0x70a565[_0x6c42('0x75')],'type':_0x70a565[_0x6c42('0xde')],'ChatOfflineMessageId':_0xa17fb5['id']};});}var _0x30c9f2;if(!_[_0x6c42('0x7e')](_0x1bb495[_0x6c42('0xf5')])){var _0x578714=_[_0x6c42('0x42')](_0x2776dd[_0x6c42('0x61')],function(_0x14f7c1){return _0x14f7c1;});var _0x406373=_[_0x6c42('0xf6')](_0x578714)[0x0];var _0x284a6e=_[_0x6c42('0xf7')](_0x406373,function(_0x11b065){return _0x11b065;});_0x30c9f2=_0x284a6e[0x1][_0x1bb495[_0x6c42('0xf5')]];}var _0x26d3b5={'from':_0x2bec3e['email'],'firstName':_0x2bec3e[_0x6c42('0xae')],'lastName':_0x2bec3e[_0x6c42('0xaf')],'mapKey':_0x6c42('0xf1'),'message':{'from':_0x2bec3e[_0x6c42('0xf1')],'to':_0x1bb495[_0x6c42('0xd4')][_0x6c42('0xf1')],'cc':'','subject':_[_0x6c42('0x7e')](_0x30c9f2)?_0x1bb495['offlineMessageSubject']:_0x30c9f2,'messageId':'','sentAt':new Date(),'attach':_0x111bca['length'],'attachments':_0x111bca,'originChannel':'Chat','ChatWebsiteId':_0x1bb495['id'],'ChatOfflineMessageId':_0x5e6956['id'],'originTo':_0x1bb495[_0x6c42('0xd4')][_0x6c42('0xf1')]},'body':_0x5e6956['body']};var _0x58f7cc={'account':{'id':_0x1bb495[_0x6c42('0xf4')]},'body':_0x26d3b5,'log':_0x6c42('0xf8')};return respondWithRpcPromise(_0x6c42('0xf8'),_0x6c42('0xf9'),_0x58f7cc,client9001)[_0x6c42('0x26')](function(){return _0x5e6956;})[_0x6c42('0x5a')](function(_0x422c69){console['error'](_0x422c69);});}return;})[_0x6c42('0x26')](function(){if(_0x5e6956){return _0x5e6956;}})[_0x6c42('0x26')](respondWithResult(_0x2aaa67,null))[_0x6c42('0x5a')](function(_0x2b2a22){console[_0x6c42('0x2c')](_0x6c42('0x5a'),_0x2b2a22);for(var _0x13a5c2 of _0x370610){var _0x3deee4=path[_0x6c42('0x7a')](config[_0x6c42('0x7b')],_0x6c42('0xdf'),_0x6c42('0xcf'),'attachments','offline-chat',_0x13a5c2['filename']);fs_extra[_0x6c42('0xfa')](_0x3deee4)[_0x6c42('0x5a')](function(_0x4592e3){console[_0x6c42('0x2c')](_0x6c42('0xfb'),_0x3deee4,_0x4592e3);});}});};exports[_0x6c42('0xfc')]=function(_0x50a200,_0x53c13e,_0x1c3087){return db[_0x6c42('0xbf')][_0x6c42('0x5f')]({'where':{'id':_0x50a200[_0x6c42('0x5c')]['id']}})['then'](handleEntityNotFound(_0x53c13e,null))[_0x6c42('0x26')](function(_0x5a4a3c){if(_0x5a4a3c){return _0x5a4a3c[_0x6c42('0xfc')](_0x50a200[_0x6c42('0x61')]['ids'],_[_0x6c42('0xfd')](_0x50a200[_0x6c42('0x61')],[_0x6c42('0xfe'),'id'])||{});}})['then'](respondWithResult(_0x53c13e,null))[_0x6c42('0x5a')](handleError(_0x53c13e,null));};exports['getInteractions']=function(_0xbb6721,_0x32273c,_0x560f48){var _0x4c27b7={'raw':![],'where':{}};var _0x599d25={};var _0x41837f={'count':0x0,'rows':[]};return db[_0x6c42('0x43')][_0x6c42('0x69')]({'where':{'id':_0xbb6721[_0x6c42('0x5c')]['id']}})['then'](handleEntityNotFound(_0x32273c,null))[_0x6c42('0x26')](function(_0x15e666){if(_0x15e666){_0x599d25['model']=_[_0x6c42('0x48')](db['ChatInteraction'][_0x6c42('0x44')]);_0x599d25['query']=_[_0x6c42('0x48')](_0xbb6721[_0x6c42('0x4a')]);_0x599d25[_0x6c42('0x5d')]=_[_0x6c42('0x49')](_0x599d25[_0x6c42('0x47')],_0x599d25[_0x6c42('0x4a')]);_0x4c27b7['attributes']=_['intersection'](_0x599d25[_0x6c42('0x47')],qs[_0x6c42('0x4b')](_0xbb6721[_0x6c42('0x4a')]['fields']));_0x4c27b7['attributes']=_0x4c27b7[_0x6c42('0x4c')][_0x6c42('0x5e')]?_0x4c27b7[_0x6c42('0x4c')]:_0x599d25[_0x6c42('0x47')];if(!_0xbb6721[_0x6c42('0x4a')][_0x6c42('0x4d')]('nolimit')){_0x4c27b7[_0x6c42('0x35')]=qs['limit'](_0xbb6721[_0x6c42('0x4a')]['limit']);_0x4c27b7[_0x6c42('0x37')]=qs[_0x6c42('0x37')](_0xbb6721[_0x6c42('0x4a')][_0x6c42('0x37')]);}_0x4c27b7['order']=qs[_0x6c42('0x4f')](_0xbb6721[_0x6c42('0x4a')][_0x6c42('0x4f')]);_0x4c27b7[_0x6c42('0x50')]=qs[_0x6c42('0x5d')](_[_0x6c42('0x51')](_0xbb6721[_0x6c42('0x4a')],_0x599d25[_0x6c42('0x5d')]));_0x4c27b7[_0x6c42('0x50')][_0x6c42('0x6c')]=_0x15e666['id'];if(_0xbb6721[_0x6c42('0x4a')][_0x6c42('0x52')]){_0x4c27b7[_0x6c42('0x50')]=_[_0x6c42('0x54')](_0x4c27b7[_0x6c42('0x50')],{'$or':_[_0x6c42('0x42')](_0x4c27b7[_0x6c42('0x4c')],function(_0x4745d4){var _0x578789={};_0x578789[_0x4745d4]={'$like':'%'+_0xbb6721[_0x6c42('0x4a')][_0x6c42('0x52')]+'%'};return _0x578789;})});}_0x4c27b7=_[_0x6c42('0x54')]({},_0x4c27b7,_0xbb6721[_0x6c42('0x55')]);return db[_0x6c42('0xbf')]['count']({'where':_0x4c27b7[_0x6c42('0x50')]})['then'](function(_0x1ca6d5){_0x41837f[_0x6c42('0x36')]=_0x1ca6d5;if(_0xbb6721[_0x6c42('0x4a')][_0x6c42('0x56')]){_0x4c27b7[_0x6c42('0x57')]=[{'model':db['CmContact'],'as':_0x6c42('0xff'),'required':![]},{'model':db['User'],'as':_0x6c42('0x100'),'attributes':[_0x6c42('0x3e'),_0x6c42('0x101'),_0x6c42('0x102')],'required':![]},{'model':db[_0x6c42('0x103')],'as':_0x6c42('0x104'),'attributes':['id',_0x6c42('0x3e'),'color'],'where':_0xbb6721[_0x6c42('0x4a')]['tag']?{'id':_0xbb6721['query'][_0x6c42('0x105')]}:undefined,'required':_0xbb6721[_0x6c42('0x4a')][_0x6c42('0x105')]?!![]:![]}];}return db[_0x6c42('0xbf')][_0x6c42('0x58')](_0x4c27b7);})['then'](function(_0x5dd838){_0x41837f['rows']=_0x5dd838;return _0x41837f;});}})[_0x6c42('0x26')](respondWithFilteredResult(_0x32273c,_0x4c27b7))[_0x6c42('0x5a')](handleError(_0x32273c,null));};function iftimePromise(_0x159cd9,_0x5445ae){return respondWithRpcPromise(_0x6c42('0x106'),_0x6c42('0x107'),{'command':_0x5445ae[_0x6c42('0x108')]?util[_0x6c42('0xb4')](_0x6c42('0x109'),_0x159cd9[_0x6c42('0x10a')],_0x5445ae[_0x6c42('0x108')]):util[_0x6c42('0xb4')]('iftime\x20%s',_0x159cd9[_0x6c42('0x10a')])},client9002)['then'](function(_0x459a52){var _0x5ba3bb=_0x459a52&&_0x459a52[_0x6c42('0x10b')](_0x6c42('0x10c'))>=0x0?!![]:![];logger[_0x6c42('0x27')](_0x6c42('0x10d'),_0x5445ae['id'],_0x159cd9['id'],_0x159cd9['interval'],_0x5ba3bb?_0x6c42('0x10e'):_0x6c42('0x10f'),_0x5445ae[_0x6c42('0x108')]?_0x5445ae[_0x6c42('0x108')]:_0x6c42('0x110'));return _0x5ba3bb;})[_0x6c42('0x5a')](function(_0x1e70eb){logger[_0x6c42('0x2c')](_0x6c42('0x10d'),_0x5445ae['id'],_0x159cd9['id'],_0x159cd9['interval'],util[_0x6c42('0x111')](_0x1e70eb,{'showHidden':![],'depth':null}),_0x5445ae['timezone']?_0x5445ae['timezone']:_0x6c42('0x110'));return![];});}exports[_0x6c42('0x107')]=function(_0x42b9df,_0x4c361f,_0x409e9e){var _0x2ffb0c=0x0;var _0x3df178=0x0;var _0xa7f013=![];var _0x5a8f3e;var _0x2bf3fa;return db[_0x6c42('0x43')][_0x6c42('0x5f')]({'where':{'id':_0x42b9df['params']['id']},'include':[{'model':db[_0x6c42('0x112')],'as':_0x6c42('0x112'),'include':[{'model':db['Interval'],'as':_0x6c42('0x113'),'attributes':['id',_0x6c42('0x10a')],'raw':!![]}]}]})[_0x6c42('0x26')](handleEntityNotFound(_0x4c361f,null))[_0x6c42('0x26')](function(_0xe9ddc8){if(_0xe9ddc8){_0x5a8f3e=_0xe9ddc8;return _0xe9ddc8[_0x6c42('0x114')]({'raw':!![]});}})[_0x6c42('0x26')](function(_0x48ee91){if(_0x5a8f3e){if(_0x48ee91){_0x2bf3fa=_0x48ee91;}}return require(_0x6c42('0x1b'))[_0x6c42('0x7c')]();})[_0x6c42('0x26')](function(_0x471833){if(_0x471833){_0x3df178=_0x471833[_0x6c42('0x115')];_0xa7f013=_0x471833[_0x6c42('0x7d')];}})['then'](function(){return db[_0x6c42('0xbf')]['count']({'where':{'closed':![]}});})['then'](function(_0x3b9894){_0x2ffb0c=_0x3b9894;if(_0x3df178&&_0x3b9894>_0x3df178){return db[_0x6c42('0x116')][_0x6c42('0x69')]({'where':{'id':0x1}})[_0x6c42('0x26')](function(_0x193f65){if(_0x193f65){_0x193f65[_0x6c42('0x117')](_0x6c42('0x118'));}});}})['then'](function(){if(_0x5a8f3e[_0x6c42('0x112')]&&_0x5a8f3e[_0x6c42('0x112')][_0x6c42('0x113')]){var _0x3a92cc=[];for(var _0x38afd4=0x0;_0x38afd4<_0x5a8f3e['Interval'][_0x6c42('0x113')][_0x6c42('0x5e')];_0x38afd4++){var _0x35edc5=_0x5a8f3e['Interval'][_0x6c42('0x113')][_0x38afd4]['get']({'plain':!![]});_0x3a92cc[_0x6c42('0x119')](iftimePromise(_0x35edc5,_0x5a8f3e));}return BPromise[_0x6c42('0x11a')](_0x3a92cc)[_0x6c42('0x26')](function(_0x2e7fb3){return _[_0x6c42('0x11b')](_0x2e7fb3);});}else{return!![];}})['then'](function(_0x1b689c){var _0x1327cd=fs[_0x6c42('0xd6')](path['join'](config[_0x6c42('0x7b')],_0x6c42('0x11c')),_0x6c42('0xd8'));var _0x4bac30={'remote':_0x5a8f3e['remote'],'query':querystring[_0x6c42('0xba')](_[_0x6c42('0x54')](_0x5a8f3e['get']({'plain':!![]}),{'customerIp':_0x42b9df[_0x6c42('0xaa')][_0x6c42('0xab')]||_0x42b9df['headers'][_0x6c42('0x11d')]||_0x42b9df[_0x6c42('0x11e')]['remoteAddress']||_0x42b9df['ip'],'referer':_0x42b9df[_0x6c42('0xaa')][_0x6c42('0xb1')],'openedInteractions':_0x2ffb0c,'maxInteractions':_0x3df178,'virtual':_0xa7f013['virtual'],'online':_0x1b689c,'custom':_0xa7f013}))[_0x6c42('0x11f')](/'/g,'\x5c\x27')};_0x4c361f[_0x6c42('0xd0')](ejs[_0x6c42('0xd9')](Mustache[_0x6c42('0xd9')](_0x1327cd,_0x4bac30),{'proactiveActions':_0x2bf3fa,'alignment':_0x5a8f3e[_0x6c42('0x120')],'verticalAlignment':_0x5a8f3e[_0x6c42('0x121')],'div_color':_0x5a8f3e[_0x6c42('0x122')],'text_color':_0x5a8f3e[_0x6c42('0x123')],'button_color':_0x5a8f3e[_0x6c42('0x124')],'background_color':_0x5a8f3e[_0x6c42('0x125')]}));})['catch'](handleError(_0x4c361f,null));};exports[_0x6c42('0x126')]=function(_0xb54d71,_0x4be00b,_0x3cea8e){return db[_0x6c42('0x43')][_0x6c42('0x69')]({'where':{'id':_0xb54d71[_0x6c42('0x5c')]['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x4be00b,null))[_0x6c42('0x26')](function(_0x2e79b3){if(_0x2e79b3){return db[_0x6c42('0xe4')]['transaction'](function(_0x1f6cc4){return db[_0x6c42('0x127')][_0x6c42('0x128')]({'where':{'ChatWebsiteId':_0xb54d71['params']['id']},'transaction':_0x1f6cc4})['then'](function(_0x1017af){var _0x55ea63=_[_0x6c42('0x42')](_0xb54d71[_0x6c42('0x61')],function(_0x3d2925){_0x3d2925[_0x6c42('0x6c')]=_0xb54d71[_0x6c42('0x5c')]['id'];return _0x3d2925;});return db['ChatApplication'][_0x6c42('0xe7')](_0x55ea63,{'transaction':_0x1f6cc4});});})[_0x6c42('0x26')](function(){return db[_0x6c42('0x127')]['findAndCountAll']({'where':{'ChatWebsiteId':_0xb54d71['params']['id']},'order':_0x6c42('0xa4')});});}})[_0x6c42('0x26')](respondWithResult(_0x4be00b,null))['catch'](handleError(_0x4be00b,null));};exports[_0x6c42('0x129')]=function(_0x4a1430,_0x1ab81a,_0x11a199){var _0x1a200c={};var _0x4cc4b4={};var _0x5dbfc3;var _0x55d6f5;return db[_0x6c42('0x43')][_0x6c42('0x69')]({'where':{'id':_0x4a1430['params']['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x1ab81a,null))[_0x6c42('0x26')](function(_0x1faba6){if(_0x1faba6){_0x5dbfc3=_0x1faba6;_0x4cc4b4[_0x6c42('0x47')]=_[_0x6c42('0x48')](db['ChatApplication'][_0x6c42('0x44')]);_0x4cc4b4[_0x6c42('0x4a')]=_[_0x6c42('0x48')](_0x4a1430[_0x6c42('0x4a')]);_0x4cc4b4[_0x6c42('0x5d')]=_[_0x6c42('0x49')](_0x4cc4b4[_0x6c42('0x47')],_0x4cc4b4['query']);_0x1a200c[_0x6c42('0x4c')]=_[_0x6c42('0x49')](_0x4cc4b4[_0x6c42('0x47')],qs[_0x6c42('0x4b')](_0x4a1430[_0x6c42('0x4a')][_0x6c42('0x4b')]));_0x1a200c['attributes']=_0x1a200c[_0x6c42('0x4c')][_0x6c42('0x5e')]?_0x1a200c[_0x6c42('0x4c')]:_0x4cc4b4[_0x6c42('0x47')];_0x1a200c[_0x6c42('0x6b')]=qs[_0x6c42('0x4f')](_0x4a1430['query'][_0x6c42('0x4f')]);_0x1a200c[_0x6c42('0x50')]=qs[_0x6c42('0x5d')](_[_0x6c42('0x51')](_0x4a1430[_0x6c42('0x4a')],_0x4cc4b4[_0x6c42('0x5d')]));if(_0x4a1430[_0x6c42('0x4a')][_0x6c42('0x52')]){_0x1a200c[_0x6c42('0x50')]=_[_0x6c42('0x54')](_0x1a200c['where'],{'$or':_[_0x6c42('0x42')](_0x1a200c[_0x6c42('0x4c')],function(_0x5d24ff){var _0x1e8eae={};_0x1e8eae[_0x5d24ff]={'$like':'%'+_0x4a1430[_0x6c42('0x4a')][_0x6c42('0x52')]+'%'};return _0x1e8eae;})});}_0x1a200c=_[_0x6c42('0x54')]({},_0x1a200c,_0x4a1430[_0x6c42('0x55')]);return _0x5dbfc3[_0x6c42('0x129')](_0x1a200c);}})['then'](function(_0x468cc4){if(_0x468cc4){_0x55d6f5=_0x468cc4[_0x6c42('0x5e')];if(!_0x4a1430[_0x6c42('0x4a')]['hasOwnProperty'](_0x6c42('0x4e'))){_0x1a200c[_0x6c42('0x35')]=qs[_0x6c42('0x35')](_0x4a1430[_0x6c42('0x4a')][_0x6c42('0x35')]);_0x1a200c[_0x6c42('0x37')]=qs[_0x6c42('0x37')](_0x4a1430[_0x6c42('0x4a')][_0x6c42('0x37')]);}return _0x5dbfc3['getApplications'](_0x1a200c);}})[_0x6c42('0x26')](function(_0x5189ef){if(_0x5189ef){return _0x5189ef?{'count':_0x55d6f5,'rows':_0x5189ef}:null;}})[_0x6c42('0x26')](respondWithResult(_0x1ab81a,null))[_0x6c42('0x5a')](handleError(_0x1ab81a,null));};exports[_0x6c42('0x12a')]=function(_0x5ac043,_0x120c62,_0x271780){return db[_0x6c42('0x12b')][_0x6c42('0x5f')]({'where':{'id':_0x5ac043[_0x6c42('0x5c')]['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x120c62,null))[_0x6c42('0x26')](function(_0x5e1a2b){if(_0x5e1a2b){return _0x5e1a2b[_0x6c42('0x12a')](_0x5ac043[_0x6c42('0x61')][_0x6c42('0xfe')],_['omit'](_0x5ac043[_0x6c42('0x61')],[_0x6c42('0xfe'),'id'])||{});}})[_0x6c42('0x26')](respondWithResult(_0x120c62,null))['catch'](handleError(_0x120c62,null));};exports['getProactiveActions']=function(_0x1d062f,_0x571ef7,_0x199d80){var _0x211c8f={};var _0xc22142={};var _0x2c0adf;var _0x11e9b9;return db[_0x6c42('0x43')][_0x6c42('0x69')]({'where':{'id':_0x1d062f[_0x6c42('0x5c')]['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x571ef7,null))[_0x6c42('0x26')](function(_0x3dbc9d){if(_0x3dbc9d){_0x2c0adf=_0x3dbc9d;_0xc22142[_0x6c42('0x47')]=_[_0x6c42('0x48')](db[_0x6c42('0x12c')][_0x6c42('0x44')]);_0xc22142['query']=_[_0x6c42('0x48')](_0x1d062f[_0x6c42('0x4a')]);_0xc22142[_0x6c42('0x5d')]=_['intersection'](_0xc22142[_0x6c42('0x47')],_0xc22142[_0x6c42('0x4a')]);_0x211c8f[_0x6c42('0x4c')]=_['intersection'](_0xc22142[_0x6c42('0x47')],qs[_0x6c42('0x4b')](_0x1d062f[_0x6c42('0x4a')][_0x6c42('0x4b')]));_0x211c8f[_0x6c42('0x4c')]=_0x211c8f['attributes'][_0x6c42('0x5e')]?_0x211c8f[_0x6c42('0x4c')]:_0xc22142[_0x6c42('0x47')];_0x211c8f['order']=qs[_0x6c42('0x4f')](_0x1d062f[_0x6c42('0x4a')][_0x6c42('0x4f')]);_0x211c8f['where']=qs[_0x6c42('0x5d')](_[_0x6c42('0x51')](_0x1d062f[_0x6c42('0x4a')],_0xc22142[_0x6c42('0x5d')]));if(_0x1d062f[_0x6c42('0x4a')][_0x6c42('0x52')]){_0x211c8f[_0x6c42('0x50')]=_[_0x6c42('0x54')](_0x211c8f[_0x6c42('0x50')],{'$or':_[_0x6c42('0x42')](_0x211c8f[_0x6c42('0x4c')],function(_0x2c9c20){var _0x3f9ff1={};_0x3f9ff1[_0x2c9c20]={'$like':'%'+_0x1d062f[_0x6c42('0x4a')][_0x6c42('0x52')]+'%'};return _0x3f9ff1;})});}_0x211c8f=_[_0x6c42('0x54')]({},_0x211c8f,_0x1d062f['options']);return _0x2c0adf['getProactiveActions'](_0x211c8f);}})[_0x6c42('0x26')](function(_0x5d6676){if(_0x5d6676){_0x11e9b9=_0x5d6676[_0x6c42('0x5e')];if(!_0x1d062f['query']['hasOwnProperty'](_0x6c42('0x4e'))){_0x211c8f['limit']=qs[_0x6c42('0x35')](_0x1d062f['query'][_0x6c42('0x35')]);_0x211c8f[_0x6c42('0x37')]=qs[_0x6c42('0x37')](_0x1d062f[_0x6c42('0x4a')][_0x6c42('0x37')]);}return _0x2c0adf['getProactiveActions'](_0x211c8f);}})['then'](function(_0x1b19d6){if(_0x1b19d6){return _0x1b19d6?{'count':_0x11e9b9,'rows':_0x1b19d6}:null;}})['then'](respondWithResult(_0x571ef7,null))[_0x6c42('0x5a')](handleError(_0x571ef7,null));};exports[_0x6c42('0x12d')]=function(_0x371584,_0x3e51fe,_0x280cf9){var _0x1c28a8=_0x371584[_0x6c42('0x4a')]['online']===_0x6c42('0x12e')?_0x6c42('0x12f'):_0x6c42('0x130');return db[_0x6c42('0x43')][_0x6c42('0x5f')]({'attributes':['id',_0x1c28a8],'where':{'id':_0x371584[_0x6c42('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3e51fe,null))[_0x6c42('0x26')](function(_0xebb84a){if(_0xebb84a){var _0xcdc188=_0xebb84a[_0x1c28a8];var _0x2232dd=_0xcdc188&&_0xcdc188['items']?_0xcdc188[_0x6c42('0x131')]:[];_0x3e51fe[_0x6c42('0xd0')]({'fromKey':_[_0x6c42('0x7e')](_0xcdc188[_0x6c42('0x132')])?undefined:_0xcdc188[_0x6c42('0x132')],'count':_0x2232dd[_0x6c42('0x5e')],'rows':_0x2232dd});}})[_0x6c42('0x5a')](handleError(_0x3e51fe,null));};exports[_0x6c42('0x133')]=function(_0x11c8d4,_0x296c5a,_0x470f5a){var _0x185fd2={'raw':![],'where':{}};var _0x2849aa={};var _0x2f45e4={'count':0x0,'rows':[]};return db[_0x6c42('0x43')][_0x6c42('0x69')]({'where':{'id':_0x11c8d4['params']['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x296c5a,null))['then'](function(_0x5f17db){if(_0x5f17db){_0x2849aa[_0x6c42('0x47')]=_[_0x6c42('0x48')](db[_0x6c42('0xdc')]['rawAttributes']);_0x2849aa[_0x6c42('0x4a')]=_[_0x6c42('0x48')](_0x11c8d4[_0x6c42('0x4a')]);_0x2849aa[_0x6c42('0x5d')]=_[_0x6c42('0x49')](_0x2849aa[_0x6c42('0x47')],_0x2849aa[_0x6c42('0x4a')]);_0x185fd2[_0x6c42('0x4c')]=_[_0x6c42('0x49')](_0x2849aa[_0x6c42('0x47')],qs[_0x6c42('0x4b')](_0x11c8d4['query'][_0x6c42('0x4b')]));_0x185fd2[_0x6c42('0x4c')]=_0x185fd2[_0x6c42('0x4c')]['length']?_0x185fd2['attributes']:_0x2849aa[_0x6c42('0x47')];if(!_0x11c8d4[_0x6c42('0x4a')][_0x6c42('0x4d')](_0x6c42('0x4e'))){_0x185fd2[_0x6c42('0x35')]=qs[_0x6c42('0x35')](_0x11c8d4[_0x6c42('0x4a')][_0x6c42('0x35')]);_0x185fd2[_0x6c42('0x37')]=qs[_0x6c42('0x37')](_0x11c8d4[_0x6c42('0x4a')][_0x6c42('0x37')]);}_0x185fd2[_0x6c42('0x6b')]=qs[_0x6c42('0x4f')](_0x11c8d4[_0x6c42('0x4a')][_0x6c42('0x4f')]);_0x185fd2[_0x6c42('0x50')]=qs[_0x6c42('0x5d')](_['pick'](_0x11c8d4[_0x6c42('0x4a')],_0x2849aa[_0x6c42('0x5d')]));_0x185fd2[_0x6c42('0x50')][_0x6c42('0x6c')]=_0x5f17db['id'];if(_0x11c8d4[_0x6c42('0x4a')]['filter']){_0x185fd2['where']=_['merge'](_0x185fd2[_0x6c42('0x50')],{'$or':_[_0x6c42('0x42')](_0x185fd2[_0x6c42('0x4c')],function(_0x19fb30){var _0x7bc6c5={};_0x7bc6c5[_0x19fb30]={'$like':'%'+_0x11c8d4[_0x6c42('0x4a')]['filter']+'%'};return _0x7bc6c5;})});}_0x185fd2=_['merge']({},_0x185fd2,_0x11c8d4[_0x6c42('0x55')]);return db['ChatOfflineMessage'][_0x6c42('0x36')]({'where':_0x185fd2[_0x6c42('0x50')]})[_0x6c42('0x26')](function(_0x211a56){_0x2f45e4[_0x6c42('0x36')]=_0x211a56;if(_0x11c8d4[_0x6c42('0x4a')]['includeAll']){_0x185fd2[_0x6c42('0x57')]=[{'all':!![]}];}else{_0x185fd2['include']=[{'model':db[_0x6c42('0x8f')],'as':_0x6c42('0xff'),'required':![]},{'model':db[_0x6c42('0xe6')],'as':_0x6c42('0x134'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x185fd2);})[_0x6c42('0x26')](function(_0x557dbf){_0x2f45e4[_0x6c42('0x59')]=_0x557dbf;return _0x2f45e4;});}})[_0x6c42('0x26')](respondWithFilteredResult(_0x296c5a,_0x185fd2))[_0x6c42('0x5a')](handleError(_0x296c5a,null));};exports['addAgents']=function(_0x346a49,_0x2dfdb3,_0x63664e){return db['ChatWebsite'][_0x6c42('0x5f')]({'where':{'id':_0x346a49[_0x6c42('0x5c')]['id']}})[_0x6c42('0x26')](handleEntityNotFound(_0x2dfdb3,null))[_0x6c42('0x26')](function(_0x27722a){if(_0x27722a){return _0x27722a[_0x6c42('0x135')](_0x346a49['body'][_0x6c42('0xfe')],_[_0x6c42('0xfd')](_0x346a49[_0x6c42('0x61')],[_0x6c42('0xfe'),'id'])||{})[_0x6c42('0xc0')](function(_0x29659c){for(var _0x2e573d=0x0;_0x2e573d<_0x346a49[_0x6c42('0x61')][_0x6c42('0xfe')]['length'];_0x2e573d+=0x1){socket['emit'](_0x6c42('0x136'),{'UserId':Number(_0x346a49[_0x6c42('0x61')][_0x6c42('0xfe')][_0x2e573d]),'ChatWebsiteId':Number(_0x346a49[_0x6c42('0x5c')]['id'])});}return _0x29659c;});}})[_0x6c42('0x26')](respondWithResult(_0x2dfdb3,null))[_0x6c42('0x5a')](handleError(_0x2dfdb3,null));};exports[_0x6c42('0x137')]=function(_0x597247,_0x3a6741,_0x32064a){return db[_0x6c42('0x43')]['find']({'where':{'id':_0x597247['params']['id']}})['then'](handleEntityNotFound(_0x3a6741,null))['then'](function(_0x493cb0){if(_0x493cb0){return _0x493cb0[_0x6c42('0x137')](_0x597247[_0x6c42('0x4a')]['ids'])[_0x6c42('0x26')](function(){if(_[_0x6c42('0x138')](_0x597247[_0x6c42('0x4a')][_0x6c42('0xfe')])){for(var _0xa3dd6a=0x0;_0xa3dd6a<_0x597247[_0x6c42('0x4a')]['ids'][_0x6c42('0x5e')];_0xa3dd6a+=0x1){socket[_0x6c42('0x139')](_0x6c42('0x13a'),{'UserId':Number(_0x597247[_0x6c42('0x4a')][_0x6c42('0xfe')][_0xa3dd6a]),'ChatWebsiteId':Number(_0x597247[_0x6c42('0x5c')]['id'])});}}else{socket[_0x6c42('0x139')](_0x6c42('0x13a'),{'UserId':Number(_0x597247[_0x6c42('0x4a')][_0x6c42('0xfe')]),'ChatWebsiteId':Number(_0x597247[_0x6c42('0x5c')]['id'])});}});}})[_0x6c42('0x26')](respondWithStatusCode(_0x3a6741,null))[_0x6c42('0x5a')](handleError(_0x3a6741,null));};exports['getAgents']=function(_0x3ebd5c,_0x309f91,_0x39d78c){var _0x2cc363={};var _0x25e91c={};var _0xb90e87;var _0x3426f0;return db[_0x6c42('0x43')][_0x6c42('0x69')]({'where':{'id':_0x3ebd5c['params']['id']}})['then'](handleEntityNotFound(_0x309f91,null))['then'](function(_0x312797){if(_0x312797){_0xb90e87=_0x312797;_0x25e91c[_0x6c42('0x47')]=_['keys'](db[_0x6c42('0xc7')]['rawAttributes']);_0x25e91c[_0x6c42('0x4a')]=_[_0x6c42('0x48')](_0x3ebd5c['query']);_0x25e91c[_0x6c42('0x5d')]=_[_0x6c42('0x49')](_0x25e91c[_0x6c42('0x47')],_0x25e91c['query']);_0x2cc363[_0x6c42('0x4c')]=_[_0x6c42('0x49')](_0x25e91c[_0x6c42('0x47')],qs[_0x6c42('0x4b')](_0x3ebd5c['query'][_0x6c42('0x4b')]));_0x2cc363[_0x6c42('0x4c')]=_0x2cc363[_0x6c42('0x4c')][_0x6c42('0x5e')]?_0x2cc363[_0x6c42('0x4c')]:_0x25e91c[_0x6c42('0x47')];_0x2cc363['order']=qs[_0x6c42('0x4f')](_0x3ebd5c[_0x6c42('0x4a')]['sort']);_0x2cc363[_0x6c42('0x50')]=qs[_0x6c42('0x5d')](_[_0x6c42('0x51')](_0x3ebd5c[_0x6c42('0x4a')],_0x25e91c['filters']));if(_0x3ebd5c[_0x6c42('0x4a')][_0x6c42('0x52')]){_0x2cc363[_0x6c42('0x50')]=_[_0x6c42('0x54')](_0x2cc363[_0x6c42('0x50')],{'$or':_['map'](_0x2cc363['attributes'],function(_0x2ba45c){var _0x126ea3={};_0x126ea3[_0x2ba45c]={'$like':'%'+_0x3ebd5c[_0x6c42('0x4a')][_0x6c42('0x52')]+'%'};return _0x126ea3;})});}_0x2cc363=_[_0x6c42('0x54')]({},_0x2cc363,_0x3ebd5c['options']);return _0xb90e87['getAgents'](_0x2cc363);}})[_0x6c42('0x26')](function(_0x479fec){if(_0x479fec){_0x3426f0=_0x479fec[_0x6c42('0x5e')];if(!_0x3ebd5c[_0x6c42('0x4a')][_0x6c42('0x4d')]('nolimit')){_0x2cc363[_0x6c42('0x35')]=qs[_0x6c42('0x35')](_0x3ebd5c[_0x6c42('0x4a')]['limit']);_0x2cc363['offset']=qs['offset'](_0x3ebd5c[_0x6c42('0x4a')][_0x6c42('0x37')]);}return _0xb90e87[_0x6c42('0x13b')](_0x2cc363);}})[_0x6c42('0x26')](function(_0x2e1f03){if(_0x2e1f03){return _0x2e1f03?{'count':_0x3426f0,'rows':_0x2e1f03}:null;}})[_0x6c42('0x26')](respondWithResult(_0x309f91,null))[_0x6c42('0x5a')](handleError(_0x309f91,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 67d1cd9..444ae15 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 _0x98d3=['events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x27f90e,_0x37c22f){var _0x496827=function(_0x20f80e){while(--_0x20f80e){_0x27f90e['push'](_0x27f90e['shift']());}};_0x496827(++_0x37c22f);}(_0x98d3,0x173));var _0x398d=function(_0x36aa07,_0xb2bf48){_0x36aa07=_0x36aa07-0x0;var _0xd326a8=_0x98d3[_0x36aa07];return _0xd326a8;};'use strict';var EventEmitter=require(_0x398d('0x0'));var ChatWebsite=require(_0x398d('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x398d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x398d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x465d4a){return function(_0x41f57c,_0x4f7a58,_0x547cbc){ChatWebsiteEvents[_0x398d('0x4')](_0x465d4a+':'+_0x41f57c['id'],_0x41f57c);ChatWebsiteEvents[_0x398d('0x4')](_0x465d4a,_0x41f57c);_0x547cbc(null);};}for(var e in events){if(events[_0x398d('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x398d('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xf50b=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xc420cf,_0x544398){var _0x1bbbd5=function(_0x1dbd2){while(--_0x1dbd2){_0xc420cf['push'](_0xc420cf['shift']());}};_0x1bbbd5(++_0x544398);}(_0xf50b,0xc8));var _0xbf50=function(_0x47b65a,_0x559aa2){_0x47b65a=_0x47b65a-0x0;var _0x33b27c=_0xf50b[_0x47b65a];return _0x33b27c;};'use strict';var EventEmitter=require(_0xbf50('0x0'));var ChatWebsite=require(_0xbf50('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xbf50('0x2')](0x0);var events={'afterCreate':_0xbf50('0x3'),'afterUpdate':_0xbf50('0x4'),'afterDestroy':_0xbf50('0x5')};function emitEvent(_0x5f0c1a){return function(_0x32217d,_0x4f5ba8,_0x36e4d6){ChatWebsiteEvents[_0xbf50('0x6')](_0x5f0c1a+':'+_0x32217d['id'],_0x32217d);ChatWebsiteEvents[_0xbf50('0x6')](_0x5f0c1a,_0x32217d);_0x36e4d6(null);};}for(var e in events){if(events[_0xbf50('0x7')](e)){var event=events[e];ChatWebsite[_0xbf50('0x8')](e,emitEvent(event));}}module[_0xbf50('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 85c7d53..8c83be7 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 _0x7001=['moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7001,0x14e));var _0x1700=function(_0x29fabf,_0x3d9197){_0x29fabf=_0x29fabf-0x0;var _0x3bc835=_0x7001[_0x29fabf];return _0x3bc835;};'use strict';var _=require(_0x1700('0x0'));var util=require(_0x1700('0x1'));var logger=require(_0x1700('0x2'))(_0x1700('0x3'));var moment=require(_0x1700('0x4'));var BPromise=require(_0x1700('0x5'));var rp=require(_0x1700('0x6'));var fs=require('fs');var path=require(_0x1700('0x7'));var rimraf=require('rimraf');var config=require(_0x1700('0x8'));var attributes=require('./chatWebsite.attributes');module[_0x1700('0x9')]=function(_0x810810,_0x1e97cd){return _0x810810[_0x1700('0xa')](_0x1700('0xb'),attributes,{'tableName':_0x1700('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3d4=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x346028,_0x3004e5){var _0x26f14e=function(_0x4bb1bc){while(--_0x4bb1bc){_0x346028['push'](_0x346028['shift']());}};_0x26f14e(++_0x3004e5);}(_0xf3d4,0xdb));var _0x4f3d=function(_0x37711f,_0x5de5c6){_0x37711f=_0x37711f-0x0;var _0x4f68b9=_0xf3d4[_0x37711f];return _0x4f68b9;};'use strict';var _=require(_0x4f3d('0x0'));var util=require(_0x4f3d('0x1'));var logger=require(_0x4f3d('0x2'))(_0x4f3d('0x3'));var moment=require('moment');var BPromise=require(_0x4f3d('0x4'));var rp=require(_0x4f3d('0x5'));var fs=require('fs');var path=require(_0x4f3d('0x6'));var rimraf=require(_0x4f3d('0x7'));var config=require(_0x4f3d('0x8'));var attributes=require(_0x4f3d('0x9'));module['exports']=function(_0x3dff70,_0x10add0){return _0x3dff70[_0x4f3d('0xa')](_0x4f3d('0xb'),attributes,{'tableName':_0x4f3d('0xc'),'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 93eb982..f85b9e6 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 _0x8afd=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0x8afd,0xde));var _0xd8af=function(_0x15aa24,_0x18c8b4){_0x15aa24=_0x15aa24-0x0;var _0x5f5ada=_0x8afd[_0x15aa24];return _0x5f5ada;};'use strict';var _=require(_0xd8af('0x0'));var util=require(_0xd8af('0x1'));var moment=require(_0xd8af('0x2'));var BPromise=require(_0xd8af('0x3'));var rs=require(_0xd8af('0x4'));var fs=require('fs');var Redis=require(_0xd8af('0x5'));var db=require(_0xd8af('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8af('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd8af('0x8'));var client=jayson[_0xd8af('0x9')]['http']({'port':0x232a});config['redis']=_[_0xd8af('0xa')](config['redis'],{'host':_0xd8af('0xb'),'port':0x18eb});var socket=require(_0xd8af('0xc'))(new Redis(config[_0xd8af('0xd')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x581c5e,_0x3d3f42,_0x308e8d){return new BPromise(function(_0x4b3425,_0x298e08){return client[_0xd8af('0xe')](_0x581c5e,_0x308e8d)[_0xd8af('0xf')](function(_0x69db32){logger['info'](_0xd8af('0x10'),_0x3d3f42,_0xd8af('0x11'));logger[_0xd8af('0x12')](_0xd8af('0x13'),_0x3d3f42,_0xd8af('0x11'),JSON[_0xd8af('0x14')](_0x69db32));if(_0x69db32['error']){if(_0x69db32[_0xd8af('0x15')][_0xd8af('0x16')]===0x1f4){logger[_0xd8af('0x15')](_0xd8af('0x10'),_0x3d3f42,_0x69db32[_0xd8af('0x15')][_0xd8af('0x17')]);return _0x298e08(_0x69db32[_0xd8af('0x15')]['message']);}logger[_0xd8af('0x15')](_0xd8af('0x10'),_0x3d3f42,_0x69db32[_0xd8af('0x15')][_0xd8af('0x17')]);return _0x4b3425(_0x69db32[_0xd8af('0x15')][_0xd8af('0x17')]);}else{logger[_0xd8af('0x18')](_0xd8af('0x10'),_0x3d3f42,'request\x20sent');_0x4b3425(_0x69db32[_0xd8af('0x19')][_0xd8af('0x17')]);}})[_0xd8af('0x1a')](function(_0x242e28){logger[_0xd8af('0x15')](_0xd8af('0x10'),_0x3d3f42,_0x242e28);_0x298e08(_0x242e28);});});} \ No newline at end of file +var _0x563f=['client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x563f,0x81));var _0xf563=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x563f[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xf563('0x0'));var moment=require(_0xf563('0x1'));var BPromise=require(_0xf563('0x2'));var rs=require(_0xf563('0x3'));var fs=require('fs');var Redis=require(_0xf563('0x4'));var db=require(_0xf563('0x5'))['db'];var utils=require(_0xf563('0x6'));var logger=require(_0xf563('0x7'))(_0xf563('0x8'));var config=require(_0xf563('0x9'));var jayson=require(_0xf563('0xa'));var client=jayson[_0xf563('0xb')][_0xf563('0xc')]({'port':0x232a});config['redis']=_[_0xf563('0xd')](config[_0xf563('0xe')],{'host':_0xf563('0xf'),'port':0x18eb});var socket=require(_0xf563('0x10'))(new Redis(config[_0xf563('0xe')]));require(_0xf563('0x11'))[_0xf563('0x12')](socket);function respondWithRpcPromise(_0x171ccb,_0x1c4fa6,_0x37d45c){return new BPromise(function(_0x5659a1,_0x5e8ab9){return client['request'](_0x171ccb,_0x37d45c)[_0xf563('0x13')](function(_0x1ba893){logger[_0xf563('0x14')](_0xf563('0x15'),_0x1c4fa6,_0xf563('0x16'));logger[_0xf563('0x17')](_0xf563('0x18'),_0x1c4fa6,_0xf563('0x16'),JSON['stringify'](_0x1ba893));if(_0x1ba893[_0xf563('0x19')]){if(_0x1ba893['error'][_0xf563('0x1a')]===0x1f4){logger[_0xf563('0x19')](_0xf563('0x15'),_0x1c4fa6,_0x1ba893[_0xf563('0x19')][_0xf563('0x1b')]);return _0x5e8ab9(_0x1ba893[_0xf563('0x19')]['message']);}logger[_0xf563('0x19')](_0xf563('0x15'),_0x1c4fa6,_0x1ba893[_0xf563('0x19')][_0xf563('0x1b')]);return _0x5659a1(_0x1ba893[_0xf563('0x19')][_0xf563('0x1b')]);}else{logger['info'](_0xf563('0x15'),_0x1c4fa6,_0xf563('0x16'));_0x5659a1(_0x1ba893['result'][_0xf563('0x1b')]);}})['catch'](function(_0x5299f3){logger[_0xf563('0x19')](_0xf563('0x15'),_0x1c4fa6,_0x5299f3);_0x5e8ab9(_0x5299f3);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d61d456..e6506b9 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 _0x549c=['remove','update','emit','removeListener','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x24c000,_0xa0a80a){var _0x50d65b=function(_0x3a0f83){while(--_0x3a0f83){_0x24c000['push'](_0x24c000['shift']());}};_0x50d65b(++_0xa0a80a);}(_0x549c,0x6e));var _0xc549=function(_0x462b00,_0x1276d6){_0x462b00=_0x462b00-0x0;var _0x4205e8=_0x549c[_0x462b00];return _0x4205e8;};'use strict';var ChatWebsiteEvents=require(_0xc549('0x0'));var events=[_0xc549('0x1'),_0xc549('0x2'),_0xc549('0x3')];function createListener(_0x917a6a,_0x1e4d8d){return function(_0x110217){_0x1e4d8d[_0xc549('0x4')](_0x917a6a,_0x110217);};}function removeListener(_0x2079d2,_0x18ba9a){return function(){ChatWebsiteEvents[_0xc549('0x5')](_0x2079d2,_0x18ba9a);};}exports['register']=function(_0xe15c7c){for(var _0x2a6a2b=0x0,_0x2dcb2b=events[_0xc549('0x6')];_0x2a6a2b<_0x2dcb2b;_0x2a6a2b++){var _0x5abdd3=events[_0x2a6a2b];var _0x13b4d9=createListener(_0xc549('0x7')+_0x5abdd3,_0xe15c7c);ChatWebsiteEvents['on'](_0x5abdd3,_0x13b4d9);}}; \ No newline at end of file +var _0xc846=['length','chatWebsite:','./chatWebsite.events','save','remove','update','removeListener','register'];(function(_0x5c31c1,_0x1aad79){var _0x1bdaf9=function(_0x33db97){while(--_0x33db97){_0x5c31c1['push'](_0x5c31c1['shift']());}};_0x1bdaf9(++_0x1aad79);}(_0xc846,0xb2));var _0x6c84=function(_0x449e84,_0x505ae7){_0x449e84=_0x449e84-0x0;var _0x72d311=_0xc846[_0x449e84];return _0x72d311;};'use strict';var ChatWebsiteEvents=require(_0x6c84('0x0'));var events=[_0x6c84('0x1'),_0x6c84('0x2'),_0x6c84('0x3')];function createListener(_0x484052,_0x59f942){return function(_0xb34698){_0x59f942['emit'](_0x484052,_0xb34698);};}function removeListener(_0xdce5d2,_0x1b02f0){return function(){ChatWebsiteEvents[_0x6c84('0x4')](_0xdce5d2,_0x1b02f0);};}exports[_0x6c84('0x5')]=function(_0x1e5e08){for(var _0x46952b=0x0,_0x5278ad=events[_0x6c84('0x6')];_0x46952b<_0x5278ad;_0x46952b++){var _0x39e998=events[_0x46952b];var _0x39dc87=createListener(_0x6c84('0x7')+_0x39e998,_0x1e5e08);ChatWebsiteEvents['on'](_0x39e998,_0x39dc87);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c37ef79..cfaac55 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 _0xed03=['isAuthenticated','index','/describe','describe','get','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','single','file','addLogo','server/files/images/avatars/','%s-%s','originalname','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','extname','any','offline','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','destroy','removeDispositions','removeAnswers','delete','exports','multer','util','path','connect-timeout','express','Router','./chatWebsite.controller'];(function(_0x246259,_0x353c38){var _0x1153b8=function(_0x6ce6fe){while(--_0x6ce6fe){_0x246259['push'](_0x246259['shift']());}};_0x1153b8(++_0x353c38);}(_0xed03,0x81));var _0x3ed0=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xed03[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x3ed0('0x0'));var util=require(_0x3ed0('0x1'));var path=require(_0x3ed0('0x2'));var timeout=require(_0x3ed0('0x3'));var express=require(_0x3ed0('0x4'));var router=express[_0x3ed0('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3ed0('0x6'));router['get']('/',auth[_0x3ed0('0x7')](),controller[_0x3ed0('0x8')]);router['get'](_0x3ed0('0x9'),auth[_0x3ed0('0x7')](),controller[_0x3ed0('0xa')]);router[_0x3ed0('0xb')](_0x3ed0('0xc'),auth[_0x3ed0('0x7')](),controller['show']);router['get'](_0x3ed0('0xd'),auth[_0x3ed0('0x7')](),controller[_0x3ed0('0xe')]);router[_0x3ed0('0xb')]('/:id/canned_answers',auth[_0x3ed0('0x7')](),controller[_0x3ed0('0xf')]);router[_0x3ed0('0xb')](_0x3ed0('0x10'),controller[_0x3ed0('0x11')]);router[_0x3ed0('0xb')](_0x3ed0('0x12'),controller['getAvatar']);router[_0x3ed0('0xb')](_0x3ed0('0x13'),controller[_0x3ed0('0x14')]);router[_0x3ed0('0xb')](_0x3ed0('0x15'),controller['getSystemAvatar']);router['get'](_0x3ed0('0x16'),auth[_0x3ed0('0x7')](),controller[_0x3ed0('0x17')]);router['get'](_0x3ed0('0x18'),controller[_0x3ed0('0x19')]);router['get']('/:id/applications',auth[_0x3ed0('0x7')](),controller['getApplications']);router[_0x3ed0('0xb')](_0x3ed0('0x1a'),auth['isAuthenticated'](),controller['getProactiveActions']);router['get'](_0x3ed0('0x1b'),controller[_0x3ed0('0x1c')]);router['get'](_0x3ed0('0x1d'),auth[_0x3ed0('0x7')](),controller[_0x3ed0('0x1e')]);router[_0x3ed0('0xb')](_0x3ed0('0x1f'),auth[_0x3ed0('0x7')](),controller['getAgents']);router['post']('/',auth[_0x3ed0('0x7')](),controller['create']);router[_0x3ed0('0x20')](_0x3ed0('0xd'),auth[_0x3ed0('0x7')](),controller[_0x3ed0('0x21')]);router[_0x3ed0('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3ed0('0x22')]);var upload=multer({'storage':multer[_0x3ed0('0x23')]({'destination':function(_0x37f9d3,_0x3d5099,_0x14d29d){_0x14d29d(null,path[_0x3ed0('0x24')](config[_0x3ed0('0x25')],_0x3ed0('0x26')));},'filename':function(_0x5aadf0,_0x31138e,_0x2fb377){_0x2fb377(null,util[_0x3ed0('0x27')]('%s-%s',Date[_0x3ed0('0x28')](),_0x31138e['originalname']));}})});router['post'](_0x3ed0('0x10'),upload[_0x3ed0('0x29')](_0x3ed0('0x2a')),controller[_0x3ed0('0x2b')]);var upload=multer({'storage':multer[_0x3ed0('0x23')]({'destination':function(_0x1f3ea3,_0x2303c1,_0x2d6eb4){_0x2d6eb4(null,path[_0x3ed0('0x24')](config['root'],_0x3ed0('0x2c')));},'filename':function(_0xaafa1a,_0x422db8,_0x268c66){_0x268c66(null,util[_0x3ed0('0x27')](_0x3ed0('0x2d'),Date['now'](),_0x422db8[_0x3ed0('0x2e')]));}})});router['post'](_0x3ed0('0x12'),upload[_0x3ed0('0x29')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0x3ed0('0x23')]({'destination':function(_0x4c92f9,_0x1ec490,_0x338b65){_0x338b65(null,path['join'](config[_0x3ed0('0x25')],'server/files/images/avatars/'));},'filename':function(_0x538ca5,_0x30fc0e,_0x4ec163){_0x4ec163(null,util[_0x3ed0('0x27')]('%s-%s',Date['now'](),_0x30fc0e[_0x3ed0('0x2e')]));}})});router[_0x3ed0('0x20')](_0x3ed0('0x13'),upload[_0x3ed0('0x29')](_0x3ed0('0x2a')),controller[_0x3ed0('0x2f')]);var upload=multer({'storage':multer[_0x3ed0('0x23')]({'destination':function(_0x7e8720,_0x4100b9,_0x22ca74){_0x22ca74(null,path[_0x3ed0('0x24')](config[_0x3ed0('0x25')],'server/files/images/avatars/'));},'filename':function(_0x3ac471,_0x542ae4,_0x1fedd4){_0x1fedd4(null,util['format'](_0x3ed0('0x2d'),Date['now'](),_0x542ae4[_0x3ed0('0x2e')]));}})});router[_0x3ed0('0x20')]('/:id/system_avatar',upload[_0x3ed0('0x29')](_0x3ed0('0x2a')),controller[_0x3ed0('0x30')]);router[_0x3ed0('0x20')](_0x3ed0('0x31'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x3ed0('0x23')]({'destination':function(_0x1df69b,_0x47fa92,_0x195f53){const _0x195a9b=path[_0x3ed0('0x24')](config['root'],_0x3ed0('0x32'),_0x3ed0('0x33'),_0x3ed0('0x34'));fs_extra[_0x3ed0('0x35')](_0x195a9b,function(){_0x195f53(null,_0x195a9b);});},'filename':function(_0x1d1c2f,_0x28fcb0,_0x2abca0){const _0x5dc2f0=_0x28fcb0[_0x3ed0('0x2e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1e3a53=path[_0x3ed0('0x36')](_0x5dc2f0);const _0x42e7f8=Date['now']()+'-'+_0x5dc2f0['replace'](_0x1e3a53,'')+_0x1e3a53;_0x2abca0(null,_0x42e7f8);}})});router[_0x3ed0('0x20')]('/:id/offline',offlineUploadMulter[_0x3ed0('0x37')](),controller[_0x3ed0('0x38')]);router[_0x3ed0('0x20')](_0x3ed0('0x16'),auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0x3ed0('0x39'),auth[_0x3ed0('0x7')](),controller[_0x3ed0('0x3a')]);router[_0x3ed0('0x20')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x3ed0('0x3b')]);router['post'](_0x3ed0('0x1f'),auth[_0x3ed0('0x7')](),controller[_0x3ed0('0x3c')]);router[_0x3ed0('0x3d')](_0x3ed0('0xc'),auth[_0x3ed0('0x7')](),controller[_0x3ed0('0x3e')]);router['delete'](_0x3ed0('0xc'),auth[_0x3ed0('0x7')](),controller[_0x3ed0('0x3f')]);router['delete'](_0x3ed0('0xd'),auth['isAuthenticated'](),controller[_0x3ed0('0x40')]);router['delete']('/:id/canned_answers',auth[_0x3ed0('0x7')](),controller[_0x3ed0('0x41')]);router[_0x3ed0('0x42')](_0x3ed0('0x1f'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x3ed0('0x43')]=router; \ No newline at end of file +var _0xec9f=['diskStorage','join','server/files/images/logos/','format','%s-%s','now','/:id/logo','single','file','addLogo','server/files/images/avatars/','originalname','addAvatar','root','addSystemAvatar','notify','server/files','attachments','ensureDir','extname','replace','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','/:id','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','/describe','describe','show','get','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/fields','/:id/offline_messages','/:id/users','getAgents','create','post','addDisposition','addAnswer'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xec9f,0xf8));var _0xfec9=function(_0x16380e,_0x18e0d5){_0x16380e=_0x16380e-0x0;var _0x1f3754=_0xec9f[_0x16380e];return _0x1f3754;};'use strict';var multer=require(_0xfec9('0x0'));var util=require(_0xfec9('0x1'));var path=require(_0xfec9('0x2'));var timeout=require(_0xfec9('0x3'));var express=require(_0xfec9('0x4'));var router=express[_0xfec9('0x5')]();var fs_extra=require(_0xfec9('0x6'));var auth=require(_0xfec9('0x7'));var interaction=require(_0xfec9('0x8'));var config=require(_0xfec9('0x9'));var controller=require(_0xfec9('0xa'));router['get']('/',auth[_0xfec9('0xb')](),controller[_0xfec9('0xc')]);router['get'](_0xfec9('0xd'),auth['isAuthenticated'](),controller[_0xfec9('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xfec9('0xf')]);router[_0xfec9('0x10')](_0xfec9('0x11'),auth[_0xfec9('0xb')](),controller['getDispositions']);router['get'](_0xfec9('0x12'),auth['isAuthenticated'](),controller[_0xfec9('0x13')]);router[_0xfec9('0x10')]('/:id/logo',controller[_0xfec9('0x14')]);router['get'](_0xfec9('0x15'),controller[_0xfec9('0x16')]);router[_0xfec9('0x10')](_0xfec9('0x17'),controller[_0xfec9('0x18')]);router[_0xfec9('0x10')](_0xfec9('0x19'),controller[_0xfec9('0x1a')]);router['get'](_0xfec9('0x1b'),auth[_0xfec9('0xb')](),controller[_0xfec9('0x1c')]);router[_0xfec9('0x10')](_0xfec9('0x1d'),controller['getSnippet']);router[_0xfec9('0x10')](_0xfec9('0x1e'),auth[_0xfec9('0xb')](),controller[_0xfec9('0x1f')]);router[_0xfec9('0x10')]('/:id/proactive_actions',auth[_0xfec9('0xb')](),controller['getProactiveActions']);router[_0xfec9('0x10')](_0xfec9('0x20'),controller['getFields']);router['get'](_0xfec9('0x21'),auth[_0xfec9('0xb')](),controller['getOfflineMessages']);router[_0xfec9('0x10')](_0xfec9('0x22'),auth[_0xfec9('0xb')](),controller[_0xfec9('0x23')]);router['post']('/',auth[_0xfec9('0xb')](),controller[_0xfec9('0x24')]);router[_0xfec9('0x25')]('/:id/dispositions',auth[_0xfec9('0xb')](),controller[_0xfec9('0x26')]);router[_0xfec9('0x25')](_0xfec9('0x12'),auth[_0xfec9('0xb')](),controller[_0xfec9('0x27')]);var upload=multer({'storage':multer[_0xfec9('0x28')]({'destination':function(_0x634874,_0x44cc0a,_0x2c5ab8){_0x2c5ab8(null,path[_0xfec9('0x29')](config['root'],_0xfec9('0x2a')));},'filename':function(_0x5b625d,_0x1ca040,_0x4c4378){_0x4c4378(null,util[_0xfec9('0x2b')](_0xfec9('0x2c'),Date[_0xfec9('0x2d')](),_0x1ca040['originalname']));}})});router[_0xfec9('0x25')](_0xfec9('0x2e'),upload[_0xfec9('0x2f')](_0xfec9('0x30')),controller[_0xfec9('0x31')]);var upload=multer({'storage':multer[_0xfec9('0x28')]({'destination':function(_0x5c90fb,_0x3c8394,_0x3a224c){_0x3a224c(null,path['join'](config['root'],_0xfec9('0x32')));},'filename':function(_0x74398e,_0x4dfd8b,_0x23d5c3){_0x23d5c3(null,util['format'](_0xfec9('0x2c'),Date['now'](),_0x4dfd8b[_0xfec9('0x33')]));}})});router[_0xfec9('0x25')](_0xfec9('0x15'),upload[_0xfec9('0x2f')](_0xfec9('0x30')),controller[_0xfec9('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c759a,_0x5246c1,_0x2625bc){_0x2625bc(null,path[_0xfec9('0x29')](config[_0xfec9('0x35')],_0xfec9('0x32')));},'filename':function(_0x322122,_0x1e9b7d,_0x4b4bce){_0x4b4bce(null,util[_0xfec9('0x2b')](_0xfec9('0x2c'),Date[_0xfec9('0x2d')](),_0x1e9b7d[_0xfec9('0x33')]));}})});router[_0xfec9('0x25')](_0xfec9('0x17'),upload[_0xfec9('0x2f')](_0xfec9('0x30')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xfec9('0x28')]({'destination':function(_0x5091c6,_0x27cbfe,_0x1302c7){_0x1302c7(null,path[_0xfec9('0x29')](config[_0xfec9('0x35')],'server/files/images/avatars/'));},'filename':function(_0x30101f,_0x118862,_0x36183d){_0x36183d(null,util[_0xfec9('0x2b')](_0xfec9('0x2c'),Date[_0xfec9('0x2d')](),_0x118862[_0xfec9('0x33')]));}})});router[_0xfec9('0x25')](_0xfec9('0x19'),upload['single']('file'),controller[_0xfec9('0x36')]);router[_0xfec9('0x25')]('/:id/notify',controller[_0xfec9('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0xfec9('0x28')]({'destination':function(_0x2a5ace,_0x11b95b,_0x2da4b2){const _0x49a153=path['join'](config[_0xfec9('0x35')],_0xfec9('0x38'),_0xfec9('0x39'),'offline-chat');fs_extra[_0xfec9('0x3a')](_0x49a153,function(){_0x2da4b2(null,_0x49a153);});},'filename':function(_0x35c0aa,_0x1a1588,_0x6435c1){const _0x7879d3=_0x1a1588[_0xfec9('0x33')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xbb17e6=path[_0xfec9('0x3b')](_0x7879d3);const _0x54dea3=Date[_0xfec9('0x2d')]()+'-'+_0x7879d3[_0xfec9('0x3c')](_0xbb17e6,'')+_0xbb17e6;_0x6435c1(null,_0x54dea3);}})});router[_0xfec9('0x25')]('/:id/offline',offlineUploadMulter[_0xfec9('0x3d')](),controller[_0xfec9('0x3e')]);router[_0xfec9('0x25')]('/:id/interactions',auth[_0xfec9('0xb')](),controller[_0xfec9('0x3f')]);router[_0xfec9('0x25')](_0xfec9('0x1e'),auth[_0xfec9('0xb')](),controller[_0xfec9('0x40')]);router[_0xfec9('0x25')]('/:id/proactive_actions',auth[_0xfec9('0xb')](),controller[_0xfec9('0x41')]);router[_0xfec9('0x25')](_0xfec9('0x22'),auth[_0xfec9('0xb')](),controller[_0xfec9('0x42')]);router['put'](_0xfec9('0x43'),auth[_0xfec9('0xb')](),controller[_0xfec9('0x44')]);router[_0xfec9('0x45')](_0xfec9('0x43'),auth[_0xfec9('0xb')](),controller['destroy']);router['delete'](_0xfec9('0x11'),auth[_0xfec9('0xb')](),controller[_0xfec9('0x46')]);router[_0xfec9('0x45')](_0xfec9('0x12'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xfec9('0x45')](_0xfec9('0x22'),auth[_0xfec9('0xb')](),controller['removeAgents']);module[_0xfec9('0x47')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c53c1ef..7ba7f63 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 _0xda19=['exports','STRING','AmazonAWS'];(function(_0x23b42c,_0x361405){var _0x17ffaf=function(_0x5df2f9){while(--_0x5df2f9){_0x23b42c['push'](_0x23b42c['shift']());}};_0x17ffaf(++_0x361405);}(_0xda19,0xd5));var _0x9da1=function(_0x4aa4c6,_0x2ce264){_0x4aa4c6=_0x4aa4c6-0x0;var _0x16c50c=_0xda19[_0x4aa4c6];return _0x16c50c;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x9da1('0x2'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x9da1('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3714=['exports','ENUM','AmazonAWS','Google','STRING','sequelize'];(function(_0x389a61,_0x20216c){var _0x1acde9=function(_0x3c72d3){while(--_0x3c72d3){_0x389a61['push'](_0x389a61['shift']());}};_0x1acde9(++_0x20216c);}(_0x3714,0x95));var _0x4371=function(_0x52db78,_0x474611){_0x52db78=_0x52db78-0x0;var _0x19ccd9=_0x3714[_0x52db78];return _0x19ccd9;};'use strict';var Sequelize=require(_0x4371('0x0'));module[_0x4371('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x4371('0x2')](_0x4371('0x3'),_0x4371('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x4371('0x5')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 45cb0f9..0bf3509 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 _0x0b0e=['hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x52bad1,_0xdab497){var _0xd6ca9=function(_0x3b1013){while(--_0x3b1013){_0x52bad1['push'](_0x52bad1['shift']());}};_0xd6ca9(++_0xdab497);}(_0x0b0e,0x187));var _0xe0b0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0b0e[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['CloudProvider'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['CloudProvider'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['CloudProvider']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));}; \ No newline at end of file +var _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','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'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b6735,_0x1c6cd4){_0x3b6735=_0x3b6735-0x0;var _0x364538=_0x5f2f[_0x3b6735];return _0x364538;};'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')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':!![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 6fa1aca..662b6ae 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 _0x3c6f=['./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x3406fd,_0x1942de){var _0x17c3fe=function(_0x2cb74c){while(--_0x2cb74c){_0x3406fd['push'](_0x3406fd['shift']());}};_0x17c3fe(++_0x1942de);}(_0x3c6f,0x17e));var _0xf3c6=function(_0x835dba,_0x27788d){_0x835dba=_0x835dba-0x0;var _0x3eaa4c=_0x3c6f[_0x835dba];return _0x3eaa4c;};'use strict';var _=require(_0xf3c6('0x0'));var util=require(_0xf3c6('0x1'));var logger=require(_0xf3c6('0x2'))(_0xf3c6('0x3'));var moment=require('moment');var BPromise=require(_0xf3c6('0x4'));var rp=require(_0xf3c6('0x5'));var fs=require('fs');var path=require(_0xf3c6('0x6'));var rimraf=require('rimraf');var config=require(_0xf3c6('0x7'));var attributes=require(_0xf3c6('0x8'));module[_0xf3c6('0x9')]=function(_0x44bb86,_0x2b6782){return _0x44bb86[_0xf3c6('0xa')](_0xf3c6('0xb'),attributes,{'tableName':_0xf3c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90f3=['CloudProvider','cloud_providers','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x90f3,0x1c2));var _0x390f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x90f3[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x390f('0x0'));var util=require('util');var logger=require(_0x390f('0x1'))(_0x390f('0x2'));var moment=require(_0x390f('0x3'));var BPromise=require(_0x390f('0x4'));var rp=require(_0x390f('0x5'));var fs=require('fs');var path=require(_0x390f('0x6'));var rimraf=require(_0x390f('0x7'));var config=require(_0x390f('0x8'));var attributes=require(_0x390f('0x9'));module[_0x390f('0xa')]=function(_0x1ecac5,_0x4f789){return _0x1ecac5[_0x390f('0xb')](_0x390f('0xc'),attributes,{'tableName':_0x390f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index e1952ab..211f5bb 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 _0xccef=['stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x7334e,_0x53a0c7){var _0x18d740=function(_0x1da359){while(--_0x1da359){_0x7334e['push'](_0x7334e['shift']());}};_0x18d740(++_0x53a0c7);}(_0xccef,0x1d4));var _0xfcce=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xccef[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xfcce('0x0'));var moment=require('moment');var BPromise=require(_0xfcce('0x1'));var rs=require(_0xfcce('0x2'));var fs=require('fs');var Redis=require(_0xfcce('0x3'));var db=require(_0xfcce('0x4'))['db'];var utils=require(_0xfcce('0x5'));var logger=require(_0xfcce('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfcce('0x7'));var client=jayson['client'][_0xfcce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd71971,_0x12d091,_0x4598c1){return new BPromise(function(_0x117bc3,_0x380c2c){return client[_0xfcce('0x9')](_0xd71971,_0x4598c1)['then'](function(_0x382ea5){logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x12d091,_0xfcce('0xc'));logger[_0xfcce('0xd')](_0xfcce('0xe'),_0x12d091,_0xfcce('0xc'),JSON[_0xfcce('0xf')](_0x382ea5));if(_0x382ea5[_0xfcce('0x10')]){if(_0x382ea5[_0xfcce('0x10')][_0xfcce('0x11')]===0x1f4){logger['error'](_0xfcce('0xb'),_0x12d091,_0x382ea5[_0xfcce('0x10')][_0xfcce('0x12')]);return _0x380c2c(_0x382ea5[_0xfcce('0x10')]['message']);}logger[_0xfcce('0x10')](_0xfcce('0xb'),_0x12d091,_0x382ea5['error']['message']);return _0x117bc3(_0x382ea5[_0xfcce('0x10')][_0xfcce('0x12')]);}else{logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x12d091,_0xfcce('0xc'));_0x117bc3(_0x382ea5[_0xfcce('0x13')][_0xfcce('0x12')]);}})[_0xfcce('0x14')](function(_0x2d7611){logger[_0xfcce('0x10')](_0xfcce('0xb'),_0x12d091,_0x2d7611);_0x380c2c(_0x2d7611);});});} \ No newline at end of file +var _0x3746=['catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x58fc2f,_0x111399){var _0x3a1312=function(_0x3d2ff2){while(--_0x3d2ff2){_0x58fc2f['push'](_0x58fc2f['shift']());}};_0x3a1312(++_0x111399);}(_0x3746,0xa9));var _0x6374=function(_0x22b140,_0x578fcf){_0x22b140=_0x22b140-0x0;var _0x49633b=_0x3746[_0x22b140];return _0x49633b;};'use strict';var _=require(_0x6374('0x0'));var util=require(_0x6374('0x1'));var moment=require('moment');var BPromise=require(_0x6374('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6374('0x3'));var db=require(_0x6374('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6374('0x5'));var config=require(_0x6374('0x6'));var jayson=require(_0x6374('0x7'));var client=jayson[_0x6374('0x8')][_0x6374('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46841a,_0x2e8717,_0x295cf9){return new BPromise(function(_0x330181,_0x30c9ac){return client['request'](_0x46841a,_0x295cf9)[_0x6374('0xa')](function(_0x5bd695){logger[_0x6374('0xb')](_0x6374('0xc'),_0x2e8717,_0x6374('0xd'));logger['debug'](_0x6374('0xe'),_0x2e8717,_0x6374('0xd'),JSON[_0x6374('0xf')](_0x5bd695));if(_0x5bd695['error']){if(_0x5bd695[_0x6374('0x10')][_0x6374('0x11')]===0x1f4){logger['error'](_0x6374('0xc'),_0x2e8717,_0x5bd695[_0x6374('0x10')][_0x6374('0x12')]);return _0x30c9ac(_0x5bd695['error'][_0x6374('0x12')]);}logger[_0x6374('0x10')](_0x6374('0xc'),_0x2e8717,_0x5bd695['error'][_0x6374('0x12')]);return _0x330181(_0x5bd695['error']['message']);}else{logger[_0x6374('0xb')]('CloudProvider,\x20%s,\x20%s',_0x2e8717,_0x6374('0xd'));_0x330181(_0x5bd695[_0x6374('0x13')][_0x6374('0x12')]);}})[_0x6374('0x14')](function(_0x287981){logger[_0x6374('0x10')](_0x6374('0xc'),_0x2e8717,_0x287981);_0x30c9ac(_0x287981);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index e5e2bcc..dd9deee 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 _0xf5c9=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','index'];(function(_0x978d33,_0x4cb311){var _0x39006c=function(_0x21ce68){while(--_0x21ce68){_0x978d33['push'](_0x978d33['shift']());}};_0x39006c(++_0x4cb311);}(_0xf5c9,0x15a));var _0x9f5c=function(_0x1d0b5a,_0x549a0b){_0x1d0b5a=_0x1d0b5a-0x0;var _0x573ca0=_0xf5c9[_0x1d0b5a];return _0x573ca0;};'use strict';var multer=require(_0x9f5c('0x0'));var util=require('util');var path=require(_0x9f5c('0x1'));var timeout=require(_0x9f5c('0x2'));var express=require(_0x9f5c('0x3'));var router=express[_0x9f5c('0x4')]();var fs_extra=require(_0x9f5c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f5c('0x6'));var config=require(_0x9f5c('0x7'));var controller=require(_0x9f5c('0x8'));router[_0x9f5c('0x9')]('/',auth['isAuthenticated'](),controller[_0x9f5c('0xa')]);router[_0x9f5c('0x9')](_0x9f5c('0xb'),auth['isAuthenticated'](),controller[_0x9f5c('0xc')]);router[_0x9f5c('0xd')]('/',auth[_0x9f5c('0xe')](),controller[_0x9f5c('0xf')]);router[_0x9f5c('0x10')](_0x9f5c('0xb'),auth['isAuthenticated'](),controller[_0x9f5c('0x11')]);router[_0x9f5c('0x12')](_0x9f5c('0xb'),auth[_0x9f5c('0xe')](),controller[_0x9f5c('0x13')]);module[_0x9f5c('0x14')]=router; \ No newline at end of file +var _0x543c=['destroy','multer','util','connect-timeout','express','fs-extra','../../config/environment','./cloudProvider.controller','index','/:id','isAuthenticated','create','put','update','delete'];(function(_0x185186,_0x4bccd6){var _0x5c25f0=function(_0x1a6830){while(--_0x1a6830){_0x185186['push'](_0x185186['shift']());}};_0x5c25f0(++_0x4bccd6);}(_0x543c,0x10f));var _0xc543=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x543c[_0x1044e5];return _0x5ad0dd;};'use strict';var multer=require(_0xc543('0x0'));var util=require(_0xc543('0x1'));var path=require('path');var timeout=require(_0xc543('0x2'));var express=require(_0xc543('0x3'));var router=express['Router']();var fs_extra=require(_0xc543('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc543('0x5'));var controller=require(_0xc543('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc543('0x7')]);router['get'](_0xc543('0x8'),auth[_0xc543('0x9')](),controller['show']);router['post']('/',auth[_0xc543('0x9')](),controller[_0xc543('0xa')]);router[_0xc543('0xb')](_0xc543('0x8'),auth[_0xc543('0x9')](),controller[_0xc543('0xc')]);router[_0xc543('0xd')](_0xc543('0x8'),auth[_0xc543('0x9')](),controller[_0xc543('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 2ac93a4..0f37588 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 _0x3367=['name','exports','STRING'];(function(_0xeb9339,_0x304d06){var _0xec4f28=function(_0x26720f){while(--_0x26720f){_0xeb9339['push'](_0xeb9339['shift']());}};_0xec4f28(++_0x304d06);}(_0x3367,0x1b7));var _0x7336=function(_0x297acc,_0x3f91b7){_0x297acc=_0x297acc-0x0;var _0x5b6e8b=_0x3367[_0x297acc];return _0x5b6e8b;};'use strict';var Sequelize=require('sequelize');module[_0x7336('0x0')]={'name':{'type':Sequelize[_0x7336('0x1')],'unique':_0x7336('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7336('0x1')]},'companyId':{'type':Sequelize[_0x7336('0x1')]},'website':{'type':Sequelize[_0x7336('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x7336('0x1')]},'type':{'type':Sequelize[_0x7336('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x7336('0x1')]},'city':{'type':Sequelize[_0x7336('0x1')]},'country':{'type':Sequelize[_0x7336('0x1')]},'email':{'type':Sequelize[_0x7336('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7336('0x1')]},'sStreet':{'type':Sequelize[_0x7336('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x7336('0x1')]},'sCountry':{'type':Sequelize[_0x7336('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5309=['exports','name','STRING'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x5309,0x156));var _0x9530=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0x5309[_0x58965a];return _0x254efc;};'use strict';var Sequelize=require('sequelize');module[_0x9530('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9530('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9530('0x2')]},'companyId':{'type':Sequelize[_0x9530('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9530('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x9530('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x9530('0x2')]},'country':{'type':Sequelize[_0x9530('0x2')]},'email':{'type':Sequelize[_0x9530('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9530('0x2')]},'sStreet':{'type':Sequelize[_0x9530('0x2')]},'sPostalCode':{'type':Sequelize[_0x9530('0x2')]},'sCity':{'type':Sequelize[_0x9530('0x2')]},'sCountry':{'type':Sequelize[_0x9530('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 3026d21..b66db57 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 _0x7fb7=['offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','error','stack','name','send','index','CmCompany','describe','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','merge','map','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','omit','getContacts','findOne','sort','filter','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0xdb4e73,_0x30b446){var _0x4578b4=function(_0x119eb5){while(--_0x119eb5){_0xdb4e73['push'](_0xdb4e73['shift']());}};_0x4578b4(++_0x30b446);}(_0x7fb7,0x1eb));var _0x77fb=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x7fb7[_0x1a72f3];return _0x57ef47;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x77fb('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77fb('0x1'));var moment=require('moment');var BPromise=require(_0x77fb('0x2'));var Mustache=require('mustache');var util=require(_0x77fb('0x3'));var path=require('path');var sox=require(_0x77fb('0x4'));var csv=require(_0x77fb('0x5'));var ejs=require(_0x77fb('0x6'));var fs=require('fs');var fs_extra=require(_0x77fb('0x7'));var _=require(_0x77fb('0x8'));var squel=require(_0x77fb('0x9'));var crypto=require('crypto');var jsforce=require(_0x77fb('0xa'));var deskjs=require(_0x77fb('0xb'));var toCsv=require(_0x77fb('0x5'));var querystring=require(_0x77fb('0xc'));var Papa=require('papaparse');var Redis=require(_0x77fb('0xd'));var authService=require(_0x77fb('0xe'));var qs=require(_0x77fb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77fb('0x10'));var logger=require(_0x77fb('0x11'))(_0x77fb('0x12'));var utils=require('../../config/utils');var config=require(_0x77fb('0x13'));var licenseUtil=require(_0x77fb('0x14'));var db=require(_0x77fb('0x15'))['db'];function respondWithStatusCode(_0x5691e2,_0x5d29ef){_0x5d29ef=_0x5d29ef||0xcc;return function(_0xe085ba){if(_0xe085ba){return _0x5691e2[_0x77fb('0x16')](_0x5d29ef);}return _0x5691e2[_0x77fb('0x17')](_0x5d29ef)['end']();};}function respondWithResult(_0x4c008a,_0x2d8621){_0x2d8621=_0x2d8621||0xc8;return function(_0x7e9bf3){if(_0x7e9bf3){return _0x4c008a['status'](_0x2d8621)[_0x77fb('0x18')](_0x7e9bf3);}};}function respondWithFilteredResult(_0x1aa5b4,_0x282465){return function(_0x14db64){if(_0x14db64){var _0x472b48=typeof _0x282465[_0x77fb('0x19')]===_0x77fb('0x1a')&&typeof _0x282465['limit']===_0x77fb('0x1a');var _0x1cd12c=_0x14db64[_0x77fb('0x1b')];var _0x236d16=_0x472b48?0x0:_0x282465[_0x77fb('0x19')];var _0xdc52eb=_0x472b48?_0x14db64['count']:_0x282465[_0x77fb('0x19')]+_0x282465[_0x77fb('0x1c')];var _0x4b13bc;if(_0xdc52eb>=_0x1cd12c){_0xdc52eb=_0x1cd12c;_0x4b13bc=0xc8;}else{_0x4b13bc=0xce;}_0x1aa5b4[_0x77fb('0x17')](_0x4b13bc);return _0x1aa5b4['set'](_0x77fb('0x1d'),_0x236d16+'-'+_0xdc52eb+'/'+_0x1cd12c)['json'](_0x14db64);}return null;};}function patchUpdates(_0x1109c4){return function(_0x10b577){try{jsonpatch['apply'](_0x10b577,_0x1109c4,!![]);}catch(_0x1bd589){return BPromise[_0x77fb('0x1e')](_0x1bd589);}return _0x10b577[_0x77fb('0x1f')]();};}function saveUpdates(_0x943835,_0x26217){return function(_0x37fa0c){if(_0x37fa0c){return _0x37fa0c[_0x77fb('0x20')](_0x943835)[_0x77fb('0x21')](function(_0x32fe6d){return _0x32fe6d;});}return null;};}function removeEntity(_0x3e64a6,_0x2fdb09){return function(_0x522167){if(_0x522167){return _0x522167[_0x77fb('0x22')]()['then'](function(){var _0xd511e5=_0x522167[_0x77fb('0x23')]({'plain':!![]});var _0x4e6890=_0x77fb('0x24');return db[_0x77fb('0x25')][_0x77fb('0x22')]({'where':{'type':_0x4e6890,'resourceId':_0xd511e5['id']}})[_0x77fb('0x21')](function(){return _0x522167;});})['then'](function(){_0x3e64a6['status'](0xcc)[_0x77fb('0x26')]();});}};}function handleEntityNotFound(_0x3a613e,_0x54b55c){return function(_0x5cd79e){if(!_0x5cd79e){_0x3a613e[_0x77fb('0x16')](0x194);}return _0x5cd79e;};}function handleError(_0x26baf8,_0x15186d){_0x15186d=_0x15186d||0x1f4;return function(_0xdc08de){logger[_0x77fb('0x27')](_0xdc08de[_0x77fb('0x28')]);if(_0xdc08de[_0x77fb('0x29')]){delete _0xdc08de[_0x77fb('0x29')];}_0x26baf8['status'](_0x15186d)[_0x77fb('0x2a')](_0xdc08de);};}exports[_0x77fb('0x2b')]=function(_0xfb0a20,_0x65e232){var _0x3c9fed={},_0xfe6e91={},_0x2256e1={'count':0x0,'rows':[]};return db[_0x77fb('0x2c')][_0x77fb('0x2d')]()[_0x77fb('0x21')](function(_0x5a1cb3){_0xfe6e91[_0x77fb('0x2e')]=_['keys'](_0x5a1cb3);_0xfe6e91[_0x77fb('0x2f')]=_['keys'](_0xfb0a20['query']);_0xfe6e91[_0x77fb('0x30')]=_['intersection'](_0xfe6e91['model'],_0xfe6e91[_0x77fb('0x2f')]);_0x3c9fed['attributes']=_[_0x77fb('0x31')](_0xfe6e91[_0x77fb('0x2e')],qs[_0x77fb('0x32')](_0xfb0a20[_0x77fb('0x2f')]['fields']));_0x3c9fed['attributes']=_0x3c9fed[_0x77fb('0x33')][_0x77fb('0x34')]?_0x3c9fed[_0x77fb('0x33')]:_0xfe6e91[_0x77fb('0x2e')];if(!_0xfb0a20[_0x77fb('0x2f')][_0x77fb('0x35')]('nolimit')){_0x3c9fed['limit']=qs['limit'](_0xfb0a20[_0x77fb('0x2f')][_0x77fb('0x1c')]);_0x3c9fed[_0x77fb('0x19')]=qs[_0x77fb('0x19')](_0xfb0a20[_0x77fb('0x2f')]['offset']);}_0x3c9fed[_0x77fb('0x36')]=qs['sort'](_0xfb0a20['query']['sort']);_0x3c9fed[_0x77fb('0x37')]=qs[_0x77fb('0x30')](_[_0x77fb('0x38')](_0xfb0a20[_0x77fb('0x2f')],_0xfe6e91[_0x77fb('0x30')]),_0x5a1cb3);if(_0xfb0a20['query']['filter']){_0x3c9fed[_0x77fb('0x37')]=_[_0x77fb('0x39')](_0x3c9fed[_0x77fb('0x37')],{'$or':_[_0x77fb('0x3a')](_0x3c9fed[_0x77fb('0x33')],function(_0x5f4acc){var _0x3b3195={};_0x3b3195[_0x5f4acc]={'$like':'%'+_0xfb0a20[_0x77fb('0x2f')]['filter']+'%'};return _0x3b3195;})});}_0x3c9fed=_['merge']({},_0x3c9fed,_0xfb0a20[_0x77fb('0x3b')]);var _0x1e3781={'where':_0x3c9fed[_0x77fb('0x37')]};return db[_0x77fb('0x2c')][_0x77fb('0x1b')](_0x1e3781)['then'](function(_0x37d8d2){_0x2256e1[_0x77fb('0x1b')]=_0x37d8d2;if(_0xfb0a20[_0x77fb('0x2f')][_0x77fb('0x3c')]){_0x3c9fed['include']=[{'all':!![]}];}return db['CmCompany'][_0x77fb('0x3d')](_0x3c9fed);})[_0x77fb('0x21')](function(_0x47fbe4){_0x2256e1[_0x77fb('0x3e')]=_0x47fbe4;return _0x2256e1;})[_0x77fb('0x21')](respondWithFilteredResult(_0x65e232,_0x3c9fed))[_0x77fb('0x3f')](handleError(_0x65e232,null));})['catch'](handleError(_0x65e232,null));};exports[_0x77fb('0x40')]=function(_0x5f3833,_0x27eb99){var _0x47b6c8={'raw':![],'where':{'id':_0x5f3833['params']['id']}},_0x49a9a3={};_0x49a9a3[_0x77fb('0x2e')]=_[_0x77fb('0x41')](db[_0x77fb('0x2c')][_0x77fb('0x42')]);_0x49a9a3[_0x77fb('0x2f')]=_[_0x77fb('0x41')](_0x5f3833[_0x77fb('0x2f')]);_0x49a9a3[_0x77fb('0x30')]=_[_0x77fb('0x31')](_0x49a9a3[_0x77fb('0x2e')],_0x49a9a3[_0x77fb('0x2f')]);_0x47b6c8[_0x77fb('0x33')]=_[_0x77fb('0x31')](_0x49a9a3[_0x77fb('0x2e')],qs[_0x77fb('0x32')](_0x5f3833[_0x77fb('0x2f')][_0x77fb('0x32')]));_0x47b6c8[_0x77fb('0x33')]=_0x47b6c8[_0x77fb('0x33')][_0x77fb('0x34')]?_0x47b6c8['attributes']:_0x49a9a3['model'];if(_0x5f3833['query'][_0x77fb('0x3c')]){_0x47b6c8[_0x77fb('0x43')]=[{'all':!![]}];}_0x47b6c8=_[_0x77fb('0x39')]({},_0x47b6c8,_0x5f3833[_0x77fb('0x3b')]);return db['CmCompany'][_0x77fb('0x44')](_0x47b6c8)[_0x77fb('0x21')](handleEntityNotFound(_0x27eb99,null))[_0x77fb('0x21')](respondWithResult(_0x27eb99,null))[_0x77fb('0x3f')](handleError(_0x27eb99,null));};exports[_0x77fb('0x45')]=function(_0x268ea3,_0x497bc6){return db['CmCompany']['create'](_0x268ea3[_0x77fb('0x46')],{})[_0x77fb('0x21')](function(_0x2f8271){var _0x805c34=_0x268ea3[_0x77fb('0x47')]['get']({'plain':!![]});if(!_0x805c34)throw new Error(_0x77fb('0x48'));if(_0x805c34[_0x77fb('0x49')]==='user'){var _0x330469=_0x2f8271[_0x77fb('0x23')]({'plain':!![]});var _0x89d273='Companies';return db[_0x77fb('0x4a')]['find']({'where':{'name':_0x89d273,'userProfileId':_0x805c34[_0x77fb('0x4b')]},'raw':!![]})[_0x77fb('0x21')](function(_0x2d2615){if(_0x2d2615&&_0x2d2615['autoAssociation']===0x0){return db[_0x77fb('0x25')][_0x77fb('0x45')]({'name':_0x330469[_0x77fb('0x29')],'resourceId':_0x330469['id'],'type':_0x2d2615['name'],'sectionId':_0x2d2615['id']},{})[_0x77fb('0x21')](function(){return _0x2f8271;});}else{return _0x2f8271;}})[_0x77fb('0x3f')](function(_0x13d1f7){logger['error'](_0x77fb('0x4c'),_0x13d1f7);throw _0x13d1f7;});}return _0x2f8271;})[_0x77fb('0x21')](respondWithResult(_0x497bc6,0xc9))[_0x77fb('0x3f')](handleError(_0x497bc6,null));};exports['update']=function(_0x5f4344,_0x3f7692){if(_0x5f4344[_0x77fb('0x46')]['id']){delete _0x5f4344[_0x77fb('0x46')]['id'];}return db['CmCompany'][_0x77fb('0x44')]({'where':{'id':_0x5f4344['params']['id']}})[_0x77fb('0x21')](handleEntityNotFound(_0x3f7692,null))[_0x77fb('0x21')](saveUpdates(_0x5f4344['body'],null))[_0x77fb('0x21')](respondWithResult(_0x3f7692,null))[_0x77fb('0x3f')](handleError(_0x3f7692,null));};exports[_0x77fb('0x22')]=function(_0x973eea,_0x3c5b6a){return db[_0x77fb('0x2c')][_0x77fb('0x44')]({'where':{'id':_0x973eea[_0x77fb('0x4d')]['id']}})[_0x77fb('0x21')](handleEntityNotFound(_0x3c5b6a,null))[_0x77fb('0x21')](removeEntity(_0x3c5b6a,null))[_0x77fb('0x3f')](handleError(_0x3c5b6a,null));};exports[_0x77fb('0x2d')]=function(_0x54607d,_0x14897e){return db[_0x77fb('0x2c')][_0x77fb('0x2d')]()[_0x77fb('0x21')](respondWithResult(_0x14897e,null))[_0x77fb('0x3f')](handleError(_0x14897e,null));};exports[_0x77fb('0x4e')]=function(_0x2840c0,_0x13452e,_0x10ee4c){return db[_0x77fb('0x4f')]['find']({'where':{'id':_0x2840c0[_0x77fb('0x4d')]['id']}})[_0x77fb('0x21')](handleEntityNotFound(_0x13452e,null))[_0x77fb('0x21')](function(_0x26606){if(_0x26606){return _0x26606[_0x77fb('0x4e')](_0x2840c0[_0x77fb('0x46')][_0x77fb('0x50')],_[_0x77fb('0x51')](_0x2840c0['body'],[_0x77fb('0x50'),'id'])||{});}})[_0x77fb('0x21')](respondWithResult(_0x13452e,null))[_0x77fb('0x3f')](handleError(_0x13452e,null));};exports[_0x77fb('0x52')]=function(_0x4d2110,_0x58316d,_0x592e2f){var _0x4748b3={};var _0x329cad={};var _0x3110fb;var _0x156776;return db[_0x77fb('0x2c')][_0x77fb('0x53')]({'where':{'id':_0x4d2110[_0x77fb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x58316d,null))['then'](function(_0x271d96){if(_0x271d96){_0x3110fb=_0x271d96;_0x329cad['model']=_[_0x77fb('0x41')](db[_0x77fb('0x4f')][_0x77fb('0x42')]);_0x329cad[_0x77fb('0x2f')]=_[_0x77fb('0x41')](_0x4d2110['query']);_0x329cad['filters']=_['intersection'](_0x329cad['model'],_0x329cad[_0x77fb('0x2f')]);_0x4748b3[_0x77fb('0x33')]=_[_0x77fb('0x31')](_0x329cad['model'],qs[_0x77fb('0x32')](_0x4d2110['query'][_0x77fb('0x32')]));_0x4748b3['attributes']=_0x4748b3['attributes'][_0x77fb('0x34')]?_0x4748b3['attributes']:_0x329cad[_0x77fb('0x2e')];_0x4748b3[_0x77fb('0x36')]=qs[_0x77fb('0x54')](_0x4d2110[_0x77fb('0x2f')]['sort']);_0x4748b3[_0x77fb('0x37')]=qs['filters'](_['pick'](_0x4d2110[_0x77fb('0x2f')],_0x329cad[_0x77fb('0x30')]));if(_0x4d2110[_0x77fb('0x2f')][_0x77fb('0x55')]){_0x4748b3[_0x77fb('0x37')]=_[_0x77fb('0x39')](_0x4748b3['where'],{'$or':_[_0x77fb('0x3a')](_0x4748b3['attributes'],function(_0x1d013e){var _0x104682={};_0x104682[_0x1d013e]={'$like':'%'+_0x4d2110['query'][_0x77fb('0x55')]+'%'};return _0x104682;})});}_0x4748b3=_[_0x77fb('0x39')]({},_0x4748b3,_0x4d2110[_0x77fb('0x3b')]);return _0x3110fb[_0x77fb('0x52')](_0x4748b3);}})['then'](function(_0x29db7f){if(_0x29db7f){_0x156776=_0x29db7f[_0x77fb('0x34')];if(!_0x4d2110[_0x77fb('0x2f')][_0x77fb('0x35')]('nolimit')){_0x4748b3[_0x77fb('0x1c')]=qs[_0x77fb('0x1c')](_0x4d2110['query']['limit']);_0x4748b3[_0x77fb('0x19')]=qs[_0x77fb('0x19')](_0x4d2110['query']['offset']);}return _0x3110fb[_0x77fb('0x52')](_0x4748b3);}})[_0x77fb('0x21')](function(_0x5e8072){if(_0x5e8072){return _0x5e8072?{'count':_0x156776,'rows':_0x5e8072}:null;}})[_0x77fb('0x21')](respondWithResult(_0x58316d,null))['catch'](handleError(_0x58316d,null));}; \ No newline at end of file +var _0xa215=['Companies','UserProfileResource','destroy','error','stack','name','send','index','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','map','filter','options','includeAll','CmCompany','findAll','rows','catch','show','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','CmContact','addContacts','ids','omit','findOne','pick','hasOwnProperty','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','get'];(function(_0x394c90,_0x562881){var _0x5059a3=function(_0x2c46f3){while(--_0x2c46f3){_0x394c90['push'](_0x394c90['shift']());}};_0x5059a3(++_0x562881);}(_0xa215,0x8b));var _0x5a21=function(_0x2b57fc,_0x4b3658){_0x2b57fc=_0x2b57fc-0x0;var _0x5bf238=_0xa215[_0x2b57fc];return _0x5bf238;};'use strict';var emlformat=require(_0x5a21('0x0'));var rimraf=require(_0x5a21('0x1'));var zipdir=require(_0x5a21('0x2'));var jsonpatch=require(_0x5a21('0x3'));var rp=require(_0x5a21('0x4'));var moment=require(_0x5a21('0x5'));var BPromise=require(_0x5a21('0x6'));var Mustache=require(_0x5a21('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5a21('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a21('0x9'));var _=require(_0x5a21('0xa'));var squel=require(_0x5a21('0xb'));var crypto=require(_0x5a21('0xc'));var jsforce=require(_0x5a21('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5a21('0xe'));var querystring=require(_0x5a21('0xf'));var Papa=require(_0x5a21('0x10'));var Redis=require('ioredis');var authService=require(_0x5a21('0x11'));var qs=require(_0x5a21('0x12'));var as=require(_0x5a21('0x13'));var hardwareService=require(_0x5a21('0x14'));var logger=require('../../config/logger')(_0x5a21('0x15'));var utils=require(_0x5a21('0x16'));var config=require(_0x5a21('0x17'));var licenseUtil=require(_0x5a21('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d56c3,_0x497d93){_0x497d93=_0x497d93||0xcc;return function(_0x383a3d){if(_0x383a3d){return _0x2d56c3[_0x5a21('0x19')](_0x497d93);}return _0x2d56c3['status'](_0x497d93)[_0x5a21('0x1a')]();};}function respondWithResult(_0x1b728b,_0x501704){_0x501704=_0x501704||0xc8;return function(_0x649eed){if(_0x649eed){return _0x1b728b[_0x5a21('0x1b')](_0x501704)[_0x5a21('0x1c')](_0x649eed);}};}function respondWithFilteredResult(_0x5747f0,_0x2e4db2){return function(_0x38c40e){if(_0x38c40e){var _0x5d61a4=typeof _0x2e4db2[_0x5a21('0x1d')]===_0x5a21('0x1e')&&typeof _0x2e4db2[_0x5a21('0x1f')]==='undefined';var _0x2dacc1=_0x38c40e[_0x5a21('0x20')];var _0xd7fee=_0x5d61a4?0x0:_0x2e4db2[_0x5a21('0x1d')];var _0x528ffd=_0x5d61a4?_0x38c40e[_0x5a21('0x20')]:_0x2e4db2[_0x5a21('0x1d')]+_0x2e4db2[_0x5a21('0x1f')];var _0x314711;if(_0x528ffd>=_0x2dacc1){_0x528ffd=_0x2dacc1;_0x314711=0xc8;}else{_0x314711=0xce;}_0x5747f0[_0x5a21('0x1b')](_0x314711);return _0x5747f0[_0x5a21('0x21')]('Content-Range',_0xd7fee+'-'+_0x528ffd+'/'+_0x2dacc1)[_0x5a21('0x1c')](_0x38c40e);}return null;};}function patchUpdates(_0x532188){return function(_0x39daec){try{jsonpatch[_0x5a21('0x22')](_0x39daec,_0x532188,!![]);}catch(_0x2cb798){return BPromise[_0x5a21('0x23')](_0x2cb798);}return _0x39daec[_0x5a21('0x24')]();};}function saveUpdates(_0x239f12,_0x3926c7){return function(_0x2d1a15){if(_0x2d1a15){return _0x2d1a15['update'](_0x239f12)[_0x5a21('0x25')](function(_0x552489){return _0x552489;});}return null;};}function removeEntity(_0x1967a8,_0x1529a8){return function(_0x56eb7a){if(_0x56eb7a){return _0x56eb7a['destroy']()['then'](function(){var _0x250255=_0x56eb7a[_0x5a21('0x26')]({'plain':!![]});var _0x56922e=_0x5a21('0x27');return db[_0x5a21('0x28')][_0x5a21('0x29')]({'where':{'type':_0x56922e,'resourceId':_0x250255['id']}})['then'](function(){return _0x56eb7a;});})['then'](function(){_0x1967a8[_0x5a21('0x1b')](0xcc)[_0x5a21('0x1a')]();});}};}function handleEntityNotFound(_0x1bc698,_0x3cdf14){return function(_0x3acbf1){if(!_0x3acbf1){_0x1bc698[_0x5a21('0x19')](0x194);}return _0x3acbf1;};}function handleError(_0x35e5cb,_0x210003){_0x210003=_0x210003||0x1f4;return function(_0x6a255a){logger[_0x5a21('0x2a')](_0x6a255a[_0x5a21('0x2b')]);if(_0x6a255a[_0x5a21('0x2c')]){delete _0x6a255a[_0x5a21('0x2c')];}_0x35e5cb[_0x5a21('0x1b')](_0x210003)[_0x5a21('0x2d')](_0x6a255a);};}exports[_0x5a21('0x2e')]=function(_0x578677,_0x286dd7){var _0x6c5ab5={},_0x46b6d2={},_0x2f833c={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x5a21('0x25')](function(_0x42080e){_0x46b6d2[_0x5a21('0x2f')]=_['keys'](_0x42080e);_0x46b6d2[_0x5a21('0x30')]=_[_0x5a21('0x31')](_0x578677[_0x5a21('0x30')]);_0x46b6d2[_0x5a21('0x32')]=_[_0x5a21('0x33')](_0x46b6d2['model'],_0x46b6d2[_0x5a21('0x30')]);_0x6c5ab5[_0x5a21('0x34')]=_[_0x5a21('0x33')](_0x46b6d2[_0x5a21('0x2f')],qs['fields'](_0x578677[_0x5a21('0x30')][_0x5a21('0x35')]));_0x6c5ab5[_0x5a21('0x34')]=_0x6c5ab5[_0x5a21('0x34')][_0x5a21('0x36')]?_0x6c5ab5['attributes']:_0x46b6d2[_0x5a21('0x2f')];if(!_0x578677[_0x5a21('0x30')]['hasOwnProperty'](_0x5a21('0x37'))){_0x6c5ab5[_0x5a21('0x1f')]=qs['limit'](_0x578677['query']['limit']);_0x6c5ab5[_0x5a21('0x1d')]=qs[_0x5a21('0x1d')](_0x578677[_0x5a21('0x30')][_0x5a21('0x1d')]);}_0x6c5ab5[_0x5a21('0x38')]=qs[_0x5a21('0x39')](_0x578677[_0x5a21('0x30')][_0x5a21('0x39')]);_0x6c5ab5[_0x5a21('0x3a')]=qs['filters'](_['pick'](_0x578677[_0x5a21('0x30')],_0x46b6d2[_0x5a21('0x32')]),_0x42080e);if(_0x578677[_0x5a21('0x30')]['filter']){_0x6c5ab5['where']=_[_0x5a21('0x3b')](_0x6c5ab5[_0x5a21('0x3a')],{'$or':_[_0x5a21('0x3c')](_0x6c5ab5[_0x5a21('0x34')],function(_0x3fe154){var _0x4e5b62={};_0x4e5b62[_0x3fe154]={'$like':'%'+_0x578677[_0x5a21('0x30')][_0x5a21('0x3d')]+'%'};return _0x4e5b62;})});}_0x6c5ab5=_[_0x5a21('0x3b')]({},_0x6c5ab5,_0x578677[_0x5a21('0x3e')]);var _0x3b1581={'where':_0x6c5ab5[_0x5a21('0x3a')]};return db['CmCompany'][_0x5a21('0x20')](_0x3b1581)[_0x5a21('0x25')](function(_0x5825db){_0x2f833c[_0x5a21('0x20')]=_0x5825db;if(_0x578677[_0x5a21('0x30')][_0x5a21('0x3f')]){_0x6c5ab5['include']=[{'all':!![]}];}return db[_0x5a21('0x40')][_0x5a21('0x41')](_0x6c5ab5);})[_0x5a21('0x25')](function(_0x394cd5){_0x2f833c[_0x5a21('0x42')]=_0x394cd5;return _0x2f833c;})[_0x5a21('0x25')](respondWithFilteredResult(_0x286dd7,_0x6c5ab5))[_0x5a21('0x43')](handleError(_0x286dd7,null));})[_0x5a21('0x43')](handleError(_0x286dd7,null));};exports[_0x5a21('0x44')]=function(_0x2c79f8,_0x288f19){var _0x3c2fba={'raw':![],'where':{'id':_0x2c79f8['params']['id']}},_0x41f642={};_0x41f642[_0x5a21('0x2f')]=_[_0x5a21('0x31')](db['CmCompany'][_0x5a21('0x45')]);_0x41f642[_0x5a21('0x30')]=_['keys'](_0x2c79f8[_0x5a21('0x30')]);_0x41f642[_0x5a21('0x32')]=_[_0x5a21('0x33')](_0x41f642['model'],_0x41f642[_0x5a21('0x30')]);_0x3c2fba[_0x5a21('0x34')]=_[_0x5a21('0x33')](_0x41f642[_0x5a21('0x2f')],qs[_0x5a21('0x35')](_0x2c79f8[_0x5a21('0x30')][_0x5a21('0x35')]));_0x3c2fba[_0x5a21('0x34')]=_0x3c2fba['attributes']['length']?_0x3c2fba[_0x5a21('0x34')]:_0x41f642['model'];if(_0x2c79f8[_0x5a21('0x30')][_0x5a21('0x3f')]){_0x3c2fba[_0x5a21('0x46')]=[{'all':!![]}];}_0x3c2fba=_[_0x5a21('0x3b')]({},_0x3c2fba,_0x2c79f8[_0x5a21('0x3e')]);return db[_0x5a21('0x40')][_0x5a21('0x47')](_0x3c2fba)[_0x5a21('0x25')](handleEntityNotFound(_0x288f19,null))[_0x5a21('0x25')](respondWithResult(_0x288f19,null))[_0x5a21('0x43')](handleError(_0x288f19,null));};exports[_0x5a21('0x48')]=function(_0x348499,_0x167f81){return db[_0x5a21('0x40')][_0x5a21('0x48')](_0x348499['body'],{})[_0x5a21('0x25')](function(_0x4064d2){var _0x1510fd=_0x348499[_0x5a21('0x49')][_0x5a21('0x26')]({'plain':!![]});if(!_0x1510fd)throw new Error(_0x5a21('0x4a'));if(_0x1510fd[_0x5a21('0x4b')]===_0x5a21('0x49')){var _0x2b0c9e=_0x4064d2[_0x5a21('0x26')]({'plain':!![]});var _0x4443ef=_0x5a21('0x27');return db['UserProfileSection'][_0x5a21('0x47')]({'where':{'name':_0x4443ef,'userProfileId':_0x1510fd[_0x5a21('0x4c')]},'raw':!![]})[_0x5a21('0x25')](function(_0x2ac51b){if(_0x2ac51b&&_0x2ac51b['autoAssociation']===0x0){return db[_0x5a21('0x28')]['create']({'name':_0x2b0c9e['name'],'resourceId':_0x2b0c9e['id'],'type':_0x2ac51b[_0x5a21('0x2c')],'sectionId':_0x2ac51b['id']},{})[_0x5a21('0x25')](function(){return _0x4064d2;});}else{return _0x4064d2;}})[_0x5a21('0x43')](function(_0x5c7053){logger[_0x5a21('0x2a')](_0x5a21('0x4d'),_0x5c7053);throw _0x5c7053;});}return _0x4064d2;})[_0x5a21('0x25')](respondWithResult(_0x167f81,0xc9))[_0x5a21('0x43')](handleError(_0x167f81,null));};exports['update']=function(_0x9b8f18,_0x34bb1c){if(_0x9b8f18[_0x5a21('0x4e')]['id']){delete _0x9b8f18['body']['id'];}return db[_0x5a21('0x40')][_0x5a21('0x47')]({'where':{'id':_0x9b8f18[_0x5a21('0x4f')]['id']}})[_0x5a21('0x25')](handleEntityNotFound(_0x34bb1c,null))[_0x5a21('0x25')](saveUpdates(_0x9b8f18[_0x5a21('0x4e')],null))['then'](respondWithResult(_0x34bb1c,null))[_0x5a21('0x43')](handleError(_0x34bb1c,null));};exports[_0x5a21('0x29')]=function(_0x3ecd5b,_0x33abec){return db[_0x5a21('0x40')]['find']({'where':{'id':_0x3ecd5b[_0x5a21('0x4f')]['id']}})[_0x5a21('0x25')](handleEntityNotFound(_0x33abec,null))[_0x5a21('0x25')](removeEntity(_0x33abec,null))[_0x5a21('0x43')](handleError(_0x33abec,null));};exports[_0x5a21('0x50')]=function(_0x35bb33,_0x34075b){return db[_0x5a21('0x40')]['describe']()[_0x5a21('0x25')](respondWithResult(_0x34075b,null))[_0x5a21('0x43')](handleError(_0x34075b,null));};exports['addContacts']=function(_0x40323c,_0xdc5a3d,_0x4a7a7b){return db[_0x5a21('0x51')][_0x5a21('0x47')]({'where':{'id':_0x40323c[_0x5a21('0x4f')]['id']}})[_0x5a21('0x25')](handleEntityNotFound(_0xdc5a3d,null))[_0x5a21('0x25')](function(_0x575723){if(_0x575723){return _0x575723[_0x5a21('0x52')](_0x40323c[_0x5a21('0x4e')][_0x5a21('0x53')],_[_0x5a21('0x54')](_0x40323c[_0x5a21('0x4e')],[_0x5a21('0x53'),'id'])||{});}})[_0x5a21('0x25')](respondWithResult(_0xdc5a3d,null))[_0x5a21('0x43')](handleError(_0xdc5a3d,null));};exports['getContacts']=function(_0xd3b6b6,_0x1b828b,_0x489e5c){var _0x122932={};var _0x1a4975={};var _0x747f8a;var _0x5563dc;return db[_0x5a21('0x40')][_0x5a21('0x55')]({'where':{'id':_0xd3b6b6[_0x5a21('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1b828b,null))[_0x5a21('0x25')](function(_0x13dbb6){if(_0x13dbb6){_0x747f8a=_0x13dbb6;_0x1a4975[_0x5a21('0x2f')]=_[_0x5a21('0x31')](db[_0x5a21('0x51')][_0x5a21('0x45')]);_0x1a4975[_0x5a21('0x30')]=_[_0x5a21('0x31')](_0xd3b6b6[_0x5a21('0x30')]);_0x1a4975[_0x5a21('0x32')]=_[_0x5a21('0x33')](_0x1a4975[_0x5a21('0x2f')],_0x1a4975['query']);_0x122932[_0x5a21('0x34')]=_['intersection'](_0x1a4975[_0x5a21('0x2f')],qs[_0x5a21('0x35')](_0xd3b6b6['query'][_0x5a21('0x35')]));_0x122932[_0x5a21('0x34')]=_0x122932[_0x5a21('0x34')][_0x5a21('0x36')]?_0x122932['attributes']:_0x1a4975['model'];_0x122932[_0x5a21('0x38')]=qs['sort'](_0xd3b6b6[_0x5a21('0x30')]['sort']);_0x122932[_0x5a21('0x3a')]=qs[_0x5a21('0x32')](_[_0x5a21('0x56')](_0xd3b6b6['query'],_0x1a4975[_0x5a21('0x32')]));if(_0xd3b6b6['query'][_0x5a21('0x3d')]){_0x122932[_0x5a21('0x3a')]=_[_0x5a21('0x3b')](_0x122932['where'],{'$or':_[_0x5a21('0x3c')](_0x122932[_0x5a21('0x34')],function(_0x3658b9){var _0x3f729a={};_0x3f729a[_0x3658b9]={'$like':'%'+_0xd3b6b6['query'][_0x5a21('0x3d')]+'%'};return _0x3f729a;})});}_0x122932=_[_0x5a21('0x3b')]({},_0x122932,_0xd3b6b6[_0x5a21('0x3e')]);return _0x747f8a['getContacts'](_0x122932);}})['then'](function(_0x539d86){if(_0x539d86){_0x5563dc=_0x539d86[_0x5a21('0x36')];if(!_0xd3b6b6[_0x5a21('0x30')][_0x5a21('0x57')](_0x5a21('0x37'))){_0x122932[_0x5a21('0x1f')]=qs['limit'](_0xd3b6b6[_0x5a21('0x30')][_0x5a21('0x1f')]);_0x122932['offset']=qs['offset'](_0xd3b6b6[_0x5a21('0x30')][_0x5a21('0x1d')]);}return _0x747f8a[_0x5a21('0x58')](_0x122932);}})[_0x5a21('0x25')](function(_0x1dfddc){if(_0x1dfddc){return _0x1dfddc?{'count':_0x5563dc,'rows':_0x1dfddc}:null;}})[_0x5a21('0x25')](respondWithResult(_0x1b828b,null))[_0x5a21('0x43')](handleError(_0x1b828b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 78749a9..0c25faf 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 _0x93fa=['./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20b4be,_0x2ed5d6){var _0x1f884e=function(_0x26a8f6){while(--_0x26a8f6){_0x20b4be['push'](_0x20b4be['shift']());}};_0x1f884e(++_0x2ed5d6);}(_0x93fa,0x123));var _0xa93f=function(_0x192b7d,_0x3db1eb){_0x192b7d=_0x192b7d-0x0;var _0x57e19a=_0x93fa[_0x192b7d];return _0x57e19a;};'use strict';var _=require('lodash');var util=require(_0xa93f('0x0'));var logger=require(_0xa93f('0x1'))(_0xa93f('0x2'));var moment=require('moment');var BPromise=require(_0xa93f('0x3'));var rp=require(_0xa93f('0x4'));var fs=require('fs');var path=require(_0xa93f('0x5'));var rimraf=require(_0xa93f('0x6'));var config=require(_0xa93f('0x7'));var attributes=require(_0xa93f('0x8'));module[_0xa93f('0x9')]=function(_0x1608f0,_0xca20c5){return _0x1608f0[_0xa93f('0xa')](_0xa93f('0xb'),attributes,{'tableName':_0xa93f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78f7=['path','../../config/environment','./cmCompany.attributes','define','lodash','util','moment','bluebird','request-promise'];(function(_0x2ac512,_0x18d0fc){var _0x41a20e=function(_0x4c1ac2){while(--_0x4c1ac2){_0x2ac512['push'](_0x2ac512['shift']());}};_0x41a20e(++_0x18d0fc);}(_0x78f7,0x8b));var _0x778f=function(_0x549fc5,_0x39e7f7){_0x549fc5=_0x549fc5-0x0;var _0x5d143a=_0x78f7[_0x549fc5];return _0x5d143a;};'use strict';var _=require(_0x778f('0x0'));var util=require(_0x778f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x778f('0x2'));var BPromise=require(_0x778f('0x3'));var rp=require(_0x778f('0x4'));var fs=require('fs');var path=require(_0x778f('0x5'));var rimraf=require('rimraf');var config=require(_0x778f('0x6'));var attributes=require(_0x778f('0x7'));module['exports']=function(_0x7522c9,_0x20431d){return _0x7522c9[_0x778f('0x8')]('CmCompany',attributes,{'tableName':'cm_companies','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 2f71caf..822470c 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 _0x49b8=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','debug','request\x20sent','error','CmCompany,\x20%s,\x20%s','message','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x49b8,0x14e));var _0x849b=function(_0x440fb7,_0x5eff99){_0x440fb7=_0x440fb7-0x0;var _0x3d1ba1=_0x49b8[_0x440fb7];return _0x3d1ba1;};'use strict';var _=require(_0x849b('0x0'));var util=require(_0x849b('0x1'));var moment=require('moment');var BPromise=require(_0x849b('0x2'));var rs=require(_0x849b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849b('0x4'))['db'];var utils=require(_0x849b('0x5'));var logger=require(_0x849b('0x6'))(_0x849b('0x7'));var config=require('../../config/environment');var jayson=require(_0x849b('0x8'));var client=jayson['client'][_0x849b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fda63,_0x38bef6,_0x511888){return new BPromise(function(_0x6fb0d4,_0xfa5bd8){return client['request'](_0x4fda63,_0x511888)['then'](function(_0x2a58e7){logger[_0x849b('0xa')]('CmCompany,\x20%s,\x20%s',_0x38bef6,'request\x20sent');logger[_0x849b('0xb')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x38bef6,_0x849b('0xc'),JSON['stringify'](_0x2a58e7));if(_0x2a58e7[_0x849b('0xd')]){if(_0x2a58e7[_0x849b('0xd')]['code']===0x1f4){logger[_0x849b('0xd')](_0x849b('0xe'),_0x38bef6,_0x2a58e7[_0x849b('0xd')][_0x849b('0xf')]);return _0xfa5bd8(_0x2a58e7[_0x849b('0xd')][_0x849b('0xf')]);}logger[_0x849b('0xd')](_0x849b('0xe'),_0x38bef6,_0x2a58e7[_0x849b('0xd')][_0x849b('0xf')]);return _0x6fb0d4(_0x2a58e7[_0x849b('0xd')]['message']);}else{logger['info'](_0x849b('0xe'),_0x38bef6,_0x849b('0xc'));_0x6fb0d4(_0x2a58e7['result']['message']);}})['catch'](function(_0x2cd89e){logger[_0x849b('0xd')](_0x849b('0xe'),_0x38bef6,_0x2cd89e);_0xfa5bd8(_0x2cd89e);});});} \ No newline at end of file +var _0x3227=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x532577,_0x22e2fe){var _0x5fdc7e=function(_0x48db58){while(--_0x48db58){_0x532577['push'](_0x532577['shift']());}};_0x5fdc7e(++_0x22e2fe);}(_0x3227,0xa5));var _0x7322=function(_0x15f73c,_0x1f40dd){_0x15f73c=_0x15f73c-0x0;var _0x1406b9=_0x3227[_0x15f73c];return _0x1406b9;};'use strict';var _=require(_0x7322('0x0'));var util=require(_0x7322('0x1'));var moment=require(_0x7322('0x2'));var BPromise=require('bluebird');var rs=require(_0x7322('0x3'));var fs=require('fs');var Redis=require(_0x7322('0x4'));var db=require(_0x7322('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7322('0x6'))(_0x7322('0x7'));var config=require(_0x7322('0x8'));var jayson=require(_0x7322('0x9'));var client=jayson['client'][_0x7322('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a4cf5,_0x49591c,_0x4e1455){return new BPromise(function(_0x249eba,_0x3f350b){return client[_0x7322('0xb')](_0x3a4cf5,_0x4e1455)[_0x7322('0xc')](function(_0x408b21){logger[_0x7322('0xd')](_0x7322('0xe'),_0x49591c,'request\x20sent');logger['debug'](_0x7322('0xf'),_0x49591c,_0x7322('0x10'),JSON[_0x7322('0x11')](_0x408b21));if(_0x408b21[_0x7322('0x12')]){if(_0x408b21['error'][_0x7322('0x13')]===0x1f4){logger['error'](_0x7322('0xe'),_0x49591c,_0x408b21[_0x7322('0x12')][_0x7322('0x14')]);return _0x3f350b(_0x408b21[_0x7322('0x12')]['message']);}logger[_0x7322('0x12')]('CmCompany,\x20%s,\x20%s',_0x49591c,_0x408b21[_0x7322('0x12')][_0x7322('0x14')]);return _0x249eba(_0x408b21[_0x7322('0x12')][_0x7322('0x14')]);}else{logger[_0x7322('0xd')]('CmCompany,\x20%s,\x20%s',_0x49591c,'request\x20sent');_0x249eba(_0x408b21[_0x7322('0x15')]['message']);}})[_0x7322('0x16')](function(_0x2ebcf8){logger[_0x7322('0x12')](_0x7322('0xe'),_0x49591c,_0x2ebcf8);_0x3f350b(_0x2ebcf8);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 274e164..f5b6cb1 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 _0x210a=['connect-timeout','express','Router','./cmCompany.controller','get','index','isAuthenticated','describe','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','util','path'];(function(_0x5a0f42,_0x366a65){var _0x26f2e0=function(_0x30c23d){while(--_0x30c23d){_0x5a0f42['push'](_0x5a0f42['shift']());}};_0x26f2e0(++_0x366a65);}(_0x210a,0x1c6));var _0xa210=function(_0xa9f124,_0x2f95d0){_0xa9f124=_0xa9f124-0x0;var _0x4c8c13=_0x210a[_0xa9f124];return _0x4c8c13;};'use strict';var multer=require('multer');var util=require(_0xa210('0x0'));var path=require(_0xa210('0x1'));var timeout=require(_0xa210('0x2'));var express=require(_0xa210('0x3'));var router=express[_0xa210('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa210('0x5'));router[_0xa210('0x6')]('/',auth['isAuthenticated'](),controller[_0xa210('0x7')]);router[_0xa210('0x6')]('/describe',auth[_0xa210('0x8')](),controller[_0xa210('0x9')]);router[_0xa210('0x6')](_0xa210('0xa'),auth[_0xa210('0x8')](),controller[_0xa210('0xb')]);router[_0xa210('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xa210('0xc')]);router[_0xa210('0xd')]('/',auth[_0xa210('0x8')](),controller[_0xa210('0xe')]);router[_0xa210('0xd')](_0xa210('0xf'),auth[_0xa210('0x8')](),controller[_0xa210('0x10')]);router[_0xa210('0x11')](_0xa210('0xa'),auth[_0xa210('0x8')](),controller[_0xa210('0x12')]);router['delete'](_0xa210('0xa'),auth[_0xa210('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x835c=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports'];(function(_0x13de45,_0x262db4){var _0x1356a5=function(_0xf77bec){while(--_0xf77bec){_0x13de45['push'](_0x13de45['shift']());}};_0x1356a5(++_0x262db4);}(_0x835c,0x145));var _0xc835=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x835c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc835('0x0'));var util=require(_0xc835('0x1'));var path=require(_0xc835('0x2'));var timeout=require(_0xc835('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc835('0x4'));var auth=require(_0xc835('0x5'));var interaction=require(_0xc835('0x6'));var config=require('../../config/environment');var controller=require(_0xc835('0x7'));router[_0xc835('0x8')]('/',auth[_0xc835('0x9')](),controller[_0xc835('0xa')]);router['get'](_0xc835('0xb'),auth[_0xc835('0x9')](),controller[_0xc835('0xc')]);router[_0xc835('0x8')](_0xc835('0xd'),auth[_0xc835('0x9')](),controller[_0xc835('0xe')]);router[_0xc835('0x8')](_0xc835('0xf'),auth[_0xc835('0x9')](),controller[_0xc835('0x10')]);router[_0xc835('0x11')]('/',auth[_0xc835('0x9')](),controller[_0xc835('0x12')]);router['post']('/:id/contacts',auth[_0xc835('0x9')](),controller[_0xc835('0x13')]);router[_0xc835('0x14')](_0xc835('0xd'),auth['isAuthenticated'](),controller[_0xc835('0x15')]);router[_0xc835('0x16')](_0xc835('0xd'),auth[_0xc835('0x9')](),controller[_0xc835('0x17')]);module[_0xc835('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6d4211a..6407c86 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 _0x84f1=['INTEGER','UNSIGNED','DATE','exports','STRING'];(function(_0x412c66,_0xef08be){var _0x1c60ea=function(_0x3ce599){while(--_0x3ce599){_0x412c66['push'](_0x412c66['shift']());}};_0x1c60ea(++_0xef08be);}(_0x84f1,0xbc));var _0x184f=function(_0x5c56f7,_0x2043ab){_0x5c56f7=_0x5c56f7-0x0;var _0x20afad=_0x84f1[_0x5c56f7];return _0x20afad;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x184f('0x0')]={'firstName':{'type':Sequelize[_0x184f('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x184f('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x184f('0x1')]},'city':{'type':Sequelize[_0x184f('0x1')]},'country':{'type':Sequelize[_0x184f('0x1')]},'dateOfBirth':{'type':Sequelize[_0x184f('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x184f('0x1')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x184f('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x184f('0x1')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x184f('0x1')]},'twitter':{'type':Sequelize[_0x184f('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x184f('0x1')]},'viber':{'type':Sequelize[_0x184f('0x1')]},'line':{'type':Sequelize[_0x184f('0x1')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x184f('0x2')]},'priority':{'type':Sequelize[_0x184f('0x2')](0x2)[_0x184f('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x184f('0x4')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x0871=['STRING','TEXT','UNSIGNED','NOW','lodash','exports'];(function(_0x16f793,_0x2b1803){var _0x378660=function(_0x19ea75){while(--_0x19ea75){_0x16f793['push'](_0x16f793['shift']());}};_0x378660(++_0x2b1803);}(_0x0871,0x17e));var _0x1087=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x0871[_0x2892da];return _0x28cff2;};'use strict';var _=require(_0x1087('0x0'));var Sequelize=require('sequelize');module[_0x1087('0x1')]={'firstName':{'type':Sequelize[_0x1087('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1087('0x2')]},'street':{'type':Sequelize[_0x1087('0x2')]},'postalCode':{'type':Sequelize[_0x1087('0x2')]},'city':{'type':Sequelize[_0x1087('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1087('0x3')]},'phone':{'type':Sequelize[_0x1087('0x2')]},'mobile':{'type':Sequelize[_0x1087('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1087('0x2')]},'url':{'type':Sequelize[_0x1087('0x2')]},'facebook':{'type':Sequelize[_0x1087('0x2')]},'fb_data':{'type':Sequelize[_0x1087('0x2')]},'twitter':{'type':Sequelize[_0x1087('0x2')]},'skype':{'type':Sequelize[_0x1087('0x2')]},'teams':{'type':Sequelize[_0x1087('0x2')]},'viber':{'type':Sequelize[_0x1087('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x1087('0x2')]},'telegram':{'type':Sequelize[_0x1087('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x1087('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x1087('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 379fb20..1f08409 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 _0x60cd=['split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','datetime','castTo','DATE','buildExpression','text','start','map','filter','isNil','Contact','isEmpty','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','order','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','ListId','sequelize','toString','keyBy','merge','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','describe','columnName','displayName','CmCustomField','findAll','alias','custom','values','body','get','mergeWith','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappQueueReport','each','duplicates','findOrCreate','spread','show','$and','omit','format','cf_%d','pickBy','table','setFields','toParam','phone','getTags','pick','options','setTags','rawAttributes','ContactId','include','getHopperHistories','includeAll','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','whatsapp','-createdAt','channel','includes','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','destination','starttime','endtime','duration','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','createdAt','VoiceCallReport','closed','closedAt','note','disposition','secondDisposition','thirdDisposition','Account','key','Owner','browserName','customerIp','ratingMessage','ratingType','ratingValue','referer','externalUrl','threadId','startCase','Interaction','sortBy','reverse','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','send','index','CmContact','keys','length','startsWith','cf_','push','findOne','trimStart','all','fieldType','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','select','field','name','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value'];(function(_0x31bd50,_0x4e6377){var _0x2e677c=function(_0x1ae46b){while(--_0x1ae46b){_0x31bd50['push'](_0x31bd50['shift']());}};_0x2e677c(++_0x4e6377);}(_0x60cd,0xd6));var _0xd60c=function(_0x3de79b,_0x554cc9){_0x3de79b=_0x3de79b-0x0;var _0x2dd0af=_0x60cd[_0x3de79b];return _0x2dd0af;};'use strict';var emlformat=require(_0xd60c('0x0'));var rimraf=require(_0xd60c('0x1'));var zipdir=require(_0xd60c('0x2'));var jsonpatch=require(_0xd60c('0x3'));var rp=require(_0xd60c('0x4'));var moment=require(_0xd60c('0x5'));var BPromise=require(_0xd60c('0x6'));var Mustache=require(_0xd60c('0x7'));var util=require('util');var path=require(_0xd60c('0x8'));var sox=require(_0xd60c('0x9'));var csv=require(_0xd60c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd60c('0xb'));var jsforce=require(_0xd60c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd60c('0xd'));var Papa=require(_0xd60c('0xe'));var Redis=require(_0xd60c('0xf'));var authService=require(_0xd60c('0x10'));var qs=require(_0xd60c('0x11'));var as=require(_0xd60c('0x12'));var hardwareService=require(_0xd60c('0x13'));var logger=require('../../config/logger')(_0xd60c('0x14'));var utils=require(_0xd60c('0x15'));var config=require(_0xd60c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd60c('0x17'))['db'];config[_0xd60c('0x18')]=_[_0xd60c('0x19')](config['redis'],{'host':_0xd60c('0x1a'),'port':0x18eb});var socket=require(_0xd60c('0x1b'))(new Redis(config[_0xd60c('0x18')]));require('./cmContact.socket')[_0xd60c('0x1c')](socket);function respondWithStatusCode(_0x7d4522,_0x2b3f3a){_0x2b3f3a=_0x2b3f3a||0xcc;return function(_0x11fc79){if(_0x11fc79){return _0x7d4522[_0xd60c('0x1d')](_0x2b3f3a);}return _0x7d4522[_0xd60c('0x1e')](_0x2b3f3a)['end']();};}function respondWithResult(_0x34f457,_0x17e4a4){_0x17e4a4=_0x17e4a4||0xc8;return function(_0x13693a){if(_0x13693a){return _0x34f457['status'](_0x17e4a4)['json'](_0x13693a);}};}function respondWithFilteredResult(_0x3a2d05,_0x3bc02f){return function(_0xb386f3){if(_0xb386f3){var _0x3f20df=typeof _0x3bc02f[_0xd60c('0x1f')]==='undefined'&&typeof _0x3bc02f[_0xd60c('0x20')]===_0xd60c('0x21');var _0x421d23=_0xb386f3[_0xd60c('0x22')];var _0x5159cf=_0x3f20df?0x0:_0x3bc02f['offset'];var _0x45ee69=_0x3f20df?_0xb386f3[_0xd60c('0x22')]:_0x3bc02f[_0xd60c('0x1f')]+_0x3bc02f['limit'];var _0x36bb66;if(_0x45ee69>=_0x421d23){_0x45ee69=_0x421d23;_0x36bb66=0xc8;}else{_0x36bb66=0xce;}_0x3a2d05[_0xd60c('0x1e')](_0x36bb66);return _0x3a2d05[_0xd60c('0x23')](_0xd60c('0x24'),_0x5159cf+'-'+_0x45ee69+'/'+_0x421d23)['json'](_0xb386f3);}return null;};}function patchUpdates(_0xaf88a2){return function(_0x358503){try{jsonpatch[_0xd60c('0x25')](_0x358503,_0xaf88a2,!![]);}catch(_0x65cf1a){return BPromise[_0xd60c('0x26')](_0x65cf1a);}return _0x358503[_0xd60c('0x27')]();};}function saveUpdates(_0x172ac9,_0x56688c){return function(_0x7bac9c){if(_0x7bac9c){return _0x7bac9c[_0xd60c('0x28')](_0x172ac9)[_0xd60c('0x29')](function(_0x9d7c44){return _0x9d7c44;});}return null;};}function removeEntity(_0x5c71a1,_0x3bea61){return function(_0x45ee63){if(_0x45ee63){return _0x45ee63[_0xd60c('0x2a')]()[_0xd60c('0x29')](function(){_0x5c71a1[_0xd60c('0x1e')](0xcc)[_0xd60c('0x2b')]();});}};}function handleEntityNotFound(_0x1b957e,_0x12e5f8){return function(_0x2cb405){if(!_0x2cb405){_0x1b957e[_0xd60c('0x1d')](0x194);}return _0x2cb405;};}function handleError(_0x70c395,_0x4e3204){_0x4e3204=_0x4e3204||0x1f4;return function(_0x5d3cf2){logger[_0xd60c('0x2c')](_0x5d3cf2['stack']);if(_0x5d3cf2['name']){delete _0x5d3cf2['name'];}_0x70c395[_0xd60c('0x1e')](_0x4e3204)[_0xd60c('0x2d')](_0x5d3cf2);};}exports[_0xd60c('0x2e')]=function(_0x4df057,_0x4c56d5){var _0x1d7c0e={},_0x46be5e={},_0x35b39f={'count':0x0,'rows':[]};return db[_0xd60c('0x2f')]['describe']()[_0xd60c('0x29')](function(_0x4c9d08){var _0x38ec2c=[];for(var _0x3ed066=0x0;_0x3ed0660x1){_0x100c96['or'](_0xd60c('0x6f'),qs[_0xd60c('0x70')](_0x17fe7d),null);}else{if(qs[_0xd60c('0x71')](_0x17fe7d)){_0x100c96['or'](_0xd60c('0x72'),_0x17fe7d+'%');_0x100c96['or']('c.phone\x20LIKE\x20?',_0x17fe7d+'%');_0x100c96['or'](_0xd60c('0x73'),_0x17fe7d+'%');_0x100c96['or']('c.fax\x20LIKE\x20?',_0x17fe7d+'%');}else if(qs[_0xd60c('0x74')](_0x17fe7d)){_0x100c96['or']('c.email\x20LIKE\x20?',_0x17fe7d+'%');}else{_0x100c96['or'](_0xd60c('0x75'),'%'+_0x17fe7d+'%');_0x100c96['or'](_0xd60c('0x76'),'%'+_0x17fe7d+'%');_0x100c96['or'](_0xd60c('0x77'),'%'+_0x17fe7d+'%');}}}}_0x3a87ba[_0xd60c('0x4f')](_0x100c96);_0x3a87ba[_0xd60c('0x78')](_0xd60c('0x79'));var _0x2acfd4={'type':db[_0xd60c('0x7a')][_0xd60c('0x7b')][_0xd60c('0x7c')],'raw':!![]};var _0x4e012f=_0x3a87ba['clone']()[_0xd60c('0x44')](_0xd60c('0x79'));if(_0x1d7c0e[_0xd60c('0x7d')]){_0x1d7c0e['order'][_0xd60c('0x5a')](function(_0x2dbc24){_0x3a87ba[_0xd60c('0x7d')]('c.'+_0x2dbc24[0x0],_0x2dbc24[0x1]===_0xd60c('0x7e')?![]:!![]);});}if(!_['isEmpty'](_0x1ec871)){_0x3a87ba[_0xd60c('0x7f')](_0x5778aa);_0x4e012f[_0xd60c('0x4f')](_0xd60c('0x80'),_0x1ec871);}BPromise[_0xd60c('0x81')]()[_0xd60c('0x29')](function(){if(!_0x3ade07)return;if(_0x4df057[_0xd60c('0x82')][_0xd60c('0x83')]!==_0xd60c('0x84'))return;if(!_[_0xd60c('0x85')](_0x3ade07['conditions'],[_0xd60c('0x44'),_0xd60c('0x5d')])){return _0x4df057[_0xd60c('0x82')][_0xd60c('0x86')]({'attributes':['id'],'raw':!![]})[_0xd60c('0x29')](function(_0x10dc87){if(_['isEmpty'](_0x10dc87)){_0x4e012f[_0xd60c('0x4f')](_0xd60c('0x87'));_0x3a87ba[_0xd60c('0x4f')](_0xd60c('0x87'));}else{_0x4e012f['where']('c.ListId\x20IN\x20?',_[_0xd60c('0x64')](_0x10dc87,'id'));_0x3a87ba[_0xd60c('0x4f')](_0xd60c('0x88'),_['map'](_0x10dc87,'id'));}});}})['then'](function(){if(_0x4df057[_0xd60c('0x82')][_0xd60c('0x83')]==='agent'&&!_0x3ade07&&!_0x4df057[_0xd60c('0x3b')][_0xd60c('0x89')])return[];return db[_0xd60c('0x8a')]['query'](_0x4e012f[_0xd60c('0x8b')](),_0x2acfd4);})[_0xd60c('0x29')](function(_0x23b0ef){_0x35b39f[_0xd60c('0x22')]=_0x23b0ef[_0xd60c('0x31')];if(_0x35b39f[_0xd60c('0x22')]===0x0)return[];return db[_0xd60c('0x8a')][_0xd60c('0x3b')](_0x3fcfe4['toString'](),_0x2acfd4)[_0xd60c('0x29')](function(_0x7c5766){_0x4bbb61=_[_0xd60c('0x8c')](_0x7c5766,'id');_0x2acfd4=_[_0xd60c('0x8d')](_0x2acfd4,{'model':db[_0xd60c('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4df057[_0xd60c('0x3b')][_0xd60c('0x3d')]){_0x1d7c0e['attributes'][_0xd60c('0x5a')](function(_0x17484f){_0x3a87ba[_0xd60c('0x44')]('c.'+_0x17484f);});}else{_0x3a87ba[_0xd60c('0x44')](_0xd60c('0x79'));_0x3a87ba['field']('c.firstName');_0x3a87ba[_0xd60c('0x44')](_0xd60c('0x8e'));_0x3a87ba[_0xd60c('0x44')](_0xd60c('0x8f'));_0x3a87ba['field'](_0xd60c('0x90'));_0x3a87ba[_0xd60c('0x44')](_0xd60c('0x91'));_0x3a87ba[_0xd60c('0x44')](_0xd60c('0x92'));_0x3a87ba[_0xd60c('0x44')](_0xd60c('0x93'));_0x3a87ba[_0xd60c('0x44')](_0xd60c('0x94'));_0x3a87ba[_0xd60c('0x44')]('c.deletedAt');_0x3a87ba[_0xd60c('0x44')](_0xd60c('0x95'));_0x3a87ba[_0xd60c('0x44')](_0xd60c('0x96'),'TagIds');}if(_0x1d7c0e['limit'])_0x3a87ba[_0xd60c('0x20')](_0x1d7c0e['limit']);if(_0x1d7c0e[_0xd60c('0x1f')])_0x3a87ba['offset'](_0x1d7c0e[_0xd60c('0x1f')]);return db[_0xd60c('0x8a')][_0xd60c('0x3b')](_0x3a87ba['toString'](),_0x2acfd4);});})['then'](function(_0x3fc795){_0x3fc795[_0xd60c('0x5a')](function(_0x16fc68){if(_0x16fc68[_0xd60c('0x97')]){_0x16fc68['Tags']=[];_0x16fc68[_0xd60c('0x97')][_0xd60c('0x59')](',')[_0xd60c('0x5a')](function(_0x40746b){_0x16fc68[_0xd60c('0x98')]['push'](_0x4bbb61[_0x40746b]);});}delete _0x16fc68[_0xd60c('0x97')];});_0x35b39f[_0xd60c('0x99')]=_0x3fc795;return _0x35b39f;})[_0xd60c('0x29')](respondWithFilteredResult(_0x4c56d5,_0x1d7c0e));})[_0xd60c('0x9a')](handleError(_0x4c56d5,null));};exports['destroy']=function(_0x41cfab,_0x192ac7){return db[_0xd60c('0x2f')][_0xd60c('0x56')]({'where':{'id':_0x41cfab[_0xd60c('0x9b')]['id']}})[_0xd60c('0x29')](handleEntityNotFound(_0x192ac7,null))[_0xd60c('0x29')](removeEntity(_0x192ac7,null))[_0xd60c('0x9a')](handleError(_0x192ac7,null));};exports[_0xd60c('0x9c')]=function(_0x16bf7d,_0x1b46f8){return db['CmContact'][_0xd60c('0x9c')]()[_0xd60c('0x29')](function(_0xbe5750){delete _0xbe5750['tags'];for(var _0x536912=0x0;_0x536912=_0x278251){_0x4f6dfd=_0x278251;_0x3f7f43=0xc8;}else{_0x3f7f43=0xce;}_0x17626d[_0xafc3('0x1e')](_0x3f7f43);return _0x17626d['set'](_0xafc3('0x23'),_0x360d18+'-'+_0x4f6dfd+'/'+_0x278251)['json'](_0x5bbb9b);}return null;};}function patchUpdates(_0x5a48dc){return function(_0x5e64ad){try{jsonpatch[_0xafc3('0x24')](_0x5e64ad,_0x5a48dc,!![]);}catch(_0x445d45){return BPromise[_0xafc3('0x25')](_0x445d45);}return _0x5e64ad[_0xafc3('0x26')]();};}function saveUpdates(_0x31573f,_0x4b7555){return function(_0x21ab50){if(_0x21ab50){return _0x21ab50[_0xafc3('0x27')](_0x31573f)[_0xafc3('0x28')](function(_0x385249){return _0x385249;});}return null;};}function removeEntity(_0x3bae0e,_0x291252){return function(_0x413641){if(_0x413641){return _0x413641[_0xafc3('0x29')]()[_0xafc3('0x28')](function(){_0x3bae0e[_0xafc3('0x1e')](0xcc)[_0xafc3('0x1f')]();});}};}function handleEntityNotFound(_0x1408d9,_0x4b5186){return function(_0x154990){if(!_0x154990){_0x1408d9[_0xafc3('0x1d')](0x194);}return _0x154990;};}function handleError(_0x10f01b,_0x599f42){_0x599f42=_0x599f42||0x1f4;return function(_0x186395){logger[_0xafc3('0x2a')](_0x186395[_0xafc3('0x2b')]);if(_0x186395[_0xafc3('0x2c')]){delete _0x186395[_0xafc3('0x2c')];}_0x10f01b[_0xafc3('0x1e')](_0x599f42)['send'](_0x186395);};}exports['index']=function(_0x2b980b,_0x3406ed){var _0x1b737d={},_0x440906={},_0x482a66={'count':0x0,'rows':[]};return db[_0xafc3('0x2d')]['describe']()[_0xafc3('0x28')](function(_0x44e0a9){var _0x4e759c=[];for(var _0x18e5eb=0x0;_0x18e5eb0x1){_0x1ba966['or'](_0xafc3('0x6d'),qs[_0xafc3('0x6e')](_0x2ac8de),null);}else{if(qs[_0xafc3('0x6f')](_0x2ac8de)){_0x1ba966['or'](_0xafc3('0x70'),_0x2ac8de+'%');_0x1ba966['or'](_0xafc3('0x71'),_0x2ac8de+'%');_0x1ba966['or'](_0xafc3('0x72'),_0x2ac8de+'%');_0x1ba966['or'](_0xafc3('0x73'),_0x2ac8de+'%');}else if(qs[_0xafc3('0x74')](_0x2ac8de)){_0x1ba966['or']('c.email\x20LIKE\x20?',_0x2ac8de+'%');}else{_0x1ba966['or'](_0xafc3('0x75'),'%'+_0x2ac8de+'%');_0x1ba966['or'](_0xafc3('0x76'),'%'+_0x2ac8de+'%');_0x1ba966['or'](_0xafc3('0x77'),'%'+_0x2ac8de+'%');}}}}_0x32a641[_0xafc3('0x40')](_0x1ba966);_0x32a641['group']('c.id');var _0x225cdc={'type':db[_0xafc3('0x78')][_0xafc3('0x79')][_0xafc3('0x7a')],'raw':!![]};var _0x10e8dd=_0x32a641[_0xafc3('0x7b')]()[_0xafc3('0x43')](_0xafc3('0x7c'));if(_0x1b737d[_0xafc3('0x3e')]){_0x1b737d[_0xafc3('0x3e')]['forEach'](function(_0x43398d){_0x32a641[_0xafc3('0x3e')]('c.'+_0x43398d[0x0],_0x43398d[0x1]===_0xafc3('0x7d')?![]:!![]);});}if(!_[_0xafc3('0x66')](_0x3e75bc)){_0x32a641[_0xafc3('0x7e')](_0x21fa5a);_0x10e8dd[_0xafc3('0x40')]('t.id\x20IN\x20?',_0x3e75bc);}BPromise[_0xafc3('0x7f')]()[_0xafc3('0x28')](function(){if(!_0x1d8c7c)return;if(_0x2b980b[_0xafc3('0x80')][_0xafc3('0x81')]!=='agent')return;if(!_[_0xafc3('0x82')](_0x1d8c7c['conditions'],[_0xafc3('0x43'),_0xafc3('0x57')])){return _0x2b980b[_0xafc3('0x80')]['getLists']({'attributes':['id'],'raw':!![]})[_0xafc3('0x28')](function(_0x559f71){if(_[_0xafc3('0x66')](_0x559f71)){_0x10e8dd[_0xafc3('0x40')](_0xafc3('0x83'));_0x32a641[_0xafc3('0x40')]('c.ListId\x20IS\x20NULL');}else{_0x10e8dd[_0xafc3('0x40')]('c.ListId\x20IN\x20?',_[_0xafc3('0x54')](_0x559f71,'id'));_0x32a641[_0xafc3('0x40')]('c.ListId\x20IN\x20?',_[_0xafc3('0x54')](_0x559f71,'id'));}});}})[_0xafc3('0x28')](function(){if(_0x2b980b['user']['role']===_0xafc3('0x84')&&!_0x1d8c7c&&!_0x2b980b[_0xafc3('0x37')]['ListId'])return[];return db['sequelize'][_0xafc3('0x37')](_0x10e8dd[_0xafc3('0x85')](),_0x225cdc);})['then'](function(_0x24e1ea){_0x482a66[_0xafc3('0x21')]=_0x24e1ea['length'];if(_0x482a66[_0xafc3('0x21')]===0x0)return[];return db[_0xafc3('0x86')][_0xafc3('0x37')](_0x5c7414[_0xafc3('0x85')](),_0x225cdc)[_0xafc3('0x28')](function(_0x57c261){_0x48ba54=_[_0xafc3('0x87')](_0x57c261,'id');_0x225cdc=_[_0xafc3('0x88')](_0x225cdc,{'model':db[_0xafc3('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b980b[_0xafc3('0x37')]['fields']){_0x1b737d[_0xafc3('0x3a')][_0xafc3('0x67')](function(_0x495376){_0x32a641[_0xafc3('0x43')]('c.'+_0x495376);});}else{_0x32a641[_0xafc3('0x43')](_0xafc3('0x7c'));_0x32a641['field'](_0xafc3('0x89'));_0x32a641[_0xafc3('0x43')](_0xafc3('0x8a'));_0x32a641[_0xafc3('0x43')](_0xafc3('0x8b'));_0x32a641[_0xafc3('0x43')]('c.mobile');_0x32a641[_0xafc3('0x43')](_0xafc3('0x8c'));_0x32a641[_0xafc3('0x43')]('c.email');_0x32a641[_0xafc3('0x43')](_0xafc3('0x8d'));_0x32a641[_0xafc3('0x43')](_0xafc3('0x8e'));_0x32a641[_0xafc3('0x43')]('c.deletedAt');_0x32a641[_0xafc3('0x43')](_0xafc3('0x8f'));_0x32a641[_0xafc3('0x43')](_0xafc3('0x90'),_0xafc3('0x91'));}if(_0x1b737d[_0xafc3('0x3d')])_0x32a641[_0xafc3('0x3d')](_0x1b737d[_0xafc3('0x3d')]);if(_0x1b737d[_0xafc3('0x22')])_0x32a641[_0xafc3('0x22')](_0x1b737d[_0xafc3('0x22')]);return db[_0xafc3('0x86')][_0xafc3('0x37')](_0x32a641[_0xafc3('0x85')](),_0x225cdc);});})[_0xafc3('0x28')](function(_0x16ff4d){_0x16ff4d[_0xafc3('0x67')](function(_0x444f37){if(_0x444f37[_0xafc3('0x91')]){_0x444f37[_0xafc3('0x92')]=[];_0x444f37['TagIds'][_0xafc3('0x53')](',')[_0xafc3('0x67')](function(_0x191647){_0x444f37[_0xafc3('0x92')][_0xafc3('0x31')](_0x48ba54[_0x191647]);});}delete _0x444f37[_0xafc3('0x91')];});_0x482a66['rows']=_0x16ff4d;return _0x482a66;})['then'](respondWithFilteredResult(_0x3406ed,_0x1b737d));})[_0xafc3('0x93')](handleError(_0x3406ed,null));};exports['destroy']=function(_0x4202fa,_0x57c9a9){return db[_0xafc3('0x2d')][_0xafc3('0x51')]({'where':{'id':_0x4202fa[_0xafc3('0x94')]['id']}})[_0xafc3('0x28')](handleEntityNotFound(_0x57c9a9,null))[_0xafc3('0x28')](removeEntity(_0x57c9a9,null))[_0xafc3('0x93')](handleError(_0x57c9a9,null));};exports[_0xafc3('0x95')]=function(_0x4d2799,_0x2ee48c){return db[_0xafc3('0x2d')][_0xafc3('0x95')]()[_0xafc3('0x28')](function(_0x520b5c){delete _0x520b5c[_0xafc3('0x96')];for(var _0xd4d4a0=0x0;_0xd4d4a0{}\s\\|]/g,'-');_0x60751(null,util[_0xa881('0x1f')](_0xa881('0x20'),path['basename'](_0x463af3['originalname'],path['extname'](_0x463af3[_0xa881('0x1e')])),Date['now'](),path[_0xa881('0x21')](_0x463af3['originalname'])));}})});router[_0xa881('0x16')]('/csv',upload[_0xa881('0x22')](_0xa881('0x23')),controller[_0xa881('0x24')]);var upload=multer({'storage':multer[_0xa881('0x1b')]({'destination':function(_0x4c1a33,_0x42be06,_0x1d0f5e){_0x1d0f5e(null,path['join'](config[_0xa881('0x1c')],'server/files/tmp'));},'filename':function(_0x3e077b,_0x48084c,_0x226174){_0x48084c[_0xa881('0x1e')]=_0x48084c['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x226174(null,util['format'](_0xa881('0x20'),path[_0xa881('0x25')](_0x48084c[_0xa881('0x1e')],path[_0xa881('0x21')](_0x48084c[_0xa881('0x1e')])),Date[_0xa881('0x26')](),path[_0xa881('0x21')](_0x48084c[_0xa881('0x1e')])));}})});router[_0xa881('0x16')](_0xa881('0x27'),upload[_0xa881('0x22')](_0xa881('0x23')),controller[_0xa881('0x28')]);router[_0xa881('0x16')](_0xa881('0x29'),auth[_0xa881('0x7')](),controller['import']);router[_0xa881('0x2a')](_0xa881('0x9'),auth[_0xa881('0x7')](),controller[_0xa881('0x2b')]);router[_0xa881('0x2c')](_0xa881('0x9'),auth['isAuthenticated'](),controller[_0xa881('0x2d')]);module[_0xa881('0x2e')]=router; \ No newline at end of file +var _0x824c=['getHoppers','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','/:id/journey','getJourney','/merge','merge','post','create','/create_many','bulkCreate','join','root','originalname','replace','format','%s-%s%s','basename','now','single','uploadCsv','diskStorage','server/files/tmp','extname','/upload','file','/upload/:id','import','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','show','/:id/tags','getTags','/:id/hoppers'];(function(_0x2c2987,_0xa032ab){var _0x2ad65d=function(_0x2acd84){while(--_0x2acd84){_0x2c2987['push'](_0x2c2987['shift']());}};_0x2ad65d(++_0xa032ab);}(_0x824c,0x1c3));var _0xc824=function(_0x493972,_0x2b9749){_0x493972=_0x493972-0x0;var _0x36ef07=_0x824c[_0x493972];return _0x36ef07;};'use strict';var multer=require('multer');var util=require(_0xc824('0x0'));var path=require(_0xc824('0x1'));var timeout=require('connect-timeout');var express=require(_0xc824('0x2'));var router=express[_0xc824('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc824('0x4'));var interaction=require(_0xc824('0x5'));var config=require(_0xc824('0x6'));var controller=require(_0xc824('0x7'));router[_0xc824('0x8')]('/',auth[_0xc824('0x9')](),controller[_0xc824('0xa')]);router['get'](_0xc824('0xb'),auth[_0xc824('0x9')](),controller[_0xc824('0xc')]);router[_0xc824('0x8')]('/:id',auth[_0xc824('0x9')](),controller[_0xc824('0xd')]);router[_0xc824('0x8')](_0xc824('0xe'),auth['isAuthenticated'](),controller[_0xc824('0xf')]);router[_0xc824('0x8')](_0xc824('0x10'),auth[_0xc824('0x9')](),controller[_0xc824('0x11')]);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xc824('0x8')](_0xc824('0x12'),auth[_0xc824('0x9')](),controller[_0xc824('0x13')]);router['get'](_0xc824('0x14'),auth[_0xc824('0x9')](),controller['getJscriptySessions']);router[_0xc824('0x8')](_0xc824('0x15'),auth[_0xc824('0x9')](),controller[_0xc824('0x16')]);router['post'](_0xc824('0x17'),auth[_0xc824('0x9')](),controller[_0xc824('0x18')]);router[_0xc824('0x19')]('/',auth['isAuthenticated'](),controller[_0xc824('0x1a')]);router[_0xc824('0x19')](_0xc824('0x1b'),auth[_0xc824('0x9')](),controller[_0xc824('0x1c')]);router[_0xc824('0x19')](_0xc824('0xe'),auth[_0xc824('0x9')](),controller['setTags']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3e11ee,_0x33a439,_0x1f32fb){_0x1f32fb(null,path[_0xc824('0x1d')](config[_0xc824('0x1e')],'server/files/tmp'));},'filename':function(_0x41ca66,_0x5dcafc,_0x391511){_0x5dcafc[_0xc824('0x1f')]=_0x5dcafc[_0xc824('0x1f')][_0xc824('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x391511(null,util[_0xc824('0x21')](_0xc824('0x22'),path[_0xc824('0x23')](_0x5dcafc[_0xc824('0x1f')],path['extname'](_0x5dcafc['originalname'])),Date[_0xc824('0x24')](),path['extname'](_0x5dcafc[_0xc824('0x1f')])));}})});router[_0xc824('0x19')]('/csv',upload[_0xc824('0x25')]('file'),controller[_0xc824('0x26')]);var upload=multer({'storage':multer[_0xc824('0x27')]({'destination':function(_0x400c7a,_0x2970fb,_0x226438){_0x226438(null,path[_0xc824('0x1d')](config[_0xc824('0x1e')],_0xc824('0x28')));},'filename':function(_0x5378d6,_0x1eb5de,_0x26c9c4){_0x1eb5de[_0xc824('0x1f')]=_0x1eb5de['originalname'][_0xc824('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x26c9c4(null,util['format'](_0xc824('0x22'),path[_0xc824('0x23')](_0x1eb5de['originalname'],path[_0xc824('0x29')](_0x1eb5de[_0xc824('0x1f')])),Date[_0xc824('0x24')](),path[_0xc824('0x29')](_0x1eb5de[_0xc824('0x1f')])));}})});router[_0xc824('0x19')](_0xc824('0x2a'),upload[_0xc824('0x25')](_0xc824('0x2b')),controller['upload']);router[_0xc824('0x19')](_0xc824('0x2c'),auth['isAuthenticated'](),controller[_0xc824('0x2d')]);router[_0xc824('0x2e')](_0xc824('0x2f'),auth['isAuthenticated'](),controller[_0xc824('0x30')]);router[_0xc824('0x31')](_0xc824('0x2f'),auth['isAuthenticated'](),controller[_0xc824('0x32')]);module[_0xc824('0x33')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index c61692d..7ecd447 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 _0x6a03=['TEXT','long','type','select','parse','values','stringify','BOOLEAN','ENUM','voice','sequelize','exports','getDataValue','alias','STRING','setDataValue'];(function(_0x36fce5,_0x1d352a){var _0x247a82=function(_0x42a314){while(--_0x42a314){_0x36fce5['push'](_0x36fce5['shift']());}};_0x247a82(++_0x1d352a);}(_0x6a03,0x11a));var _0x36a0=function(_0x25f564,_0x4a8dca){_0x25f564=_0x25f564-0x0;var _0x1ac7c7=_0x6a03[_0x25f564];return _0x1ac7c7;};'use strict';var Sequelize=require(_0x36a0('0x0'));var _=require('lodash');module[_0x36a0('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x164085){return this[_0x36a0('0x2')](_0x36a0('0x3'));}},'alias':{'type':Sequelize[_0x36a0('0x4')],'allowNull':![],'set':function(_0x3a9461){this[_0x36a0('0x5')](_0x36a0('0x3'),_0x3a9461?_0x3a9461:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x36a0('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x36a0('0x6')](_0x36a0('0x7')),'get':function(){if(this[_0x36a0('0x2')](_0x36a0('0x8'))===_0x36a0('0x9')){return JSON[_0x36a0('0xa')](this[_0x36a0('0x2')](_0x36a0('0xb')));}else{return this[_0x36a0('0x2')]('values');}},'set':function(_0x310f4e){if(Array['isArray'](_0x310f4e)){this[_0x36a0('0x5')]('values',JSON[_0x36a0('0xc')](_0x310f4e));}else{this[_0x36a0('0x5')]('values',_0x310f4e);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x36a0('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x36a0('0xe')](_0x36a0('0xf'))}}; \ No newline at end of file +var _0x4803=['VIRTUAL','alias','setDataValue','getDataValue','name','values','isArray','stringify','BOOLEAN','voice','exports'];(function(_0x339f36,_0xe5d8a){var _0x2e462c=function(_0x4ef0cc){while(--_0x4ef0cc){_0x339f36['push'](_0x339f36['shift']());}};_0x2e462c(++_0xe5d8a);}(_0x4803,0x8e));var _0x3480=function(_0x1e78b7,_0x7b9f57){_0x1e78b7=_0x1e78b7-0x0;var _0x3ce971=_0x4803[_0x1e78b7];return _0x3ce971;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x3480('0x0')]={'name':{'type':Sequelize[_0x3480('0x1')],'get':function(_0x186ac3){return this['getDataValue'](_0x3480('0x2'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5d2753){this[_0x3480('0x3')]('alias',_0x5d2753?_0x5d2753:this[_0x3480('0x4')](_0x3480('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x3480('0x4')]('type')==='select'){return JSON['parse'](this[_0x3480('0x4')]('values'));}else{return this[_0x3480('0x4')](_0x3480('0x6'));}},'set':function(_0x182bdc){if(Array[_0x3480('0x7')](_0x182bdc)){this['setDataValue'](_0x3480('0x6'),JSON[_0x3480('0x8')](_0x182bdc));}else{this[_0x3480('0x3')](_0x3480('0x6'),_0x182bdc);}}},'required':{'type':Sequelize[_0x3480('0x9')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x3480('0xa'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index cfdb92d..bc6c664 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 _0x8a58=['key','model','differenceBy','keys','intersection','query','fields','attributes','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','include','rows','show','find','catch','body','params','sequelize','transaction','TEXT','number','Sequelize','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','index','map','CmCustomField','fieldName'];(function(_0x1f0e87,_0x1e6c52){var _0x492200=function(_0x13174e){while(--_0x13174e){_0x1f0e87['push'](_0x1f0e87['shift']());}};_0x492200(++_0x1e6c52);}(_0x8a58,0x77));var _0x88a5=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x8a58[_0x1e2080];return _0x260111;};'use strict';var emlformat=require(_0x88a5('0x0'));var rimraf=require(_0x88a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x88a5('0x2'));var moment=require(_0x88a5('0x3'));var BPromise=require(_0x88a5('0x4'));var Mustache=require(_0x88a5('0x5'));var util=require(_0x88a5('0x6'));var path=require(_0x88a5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x88a5('0x8'));var fs=require('fs');var fs_extra=require(_0x88a5('0x9'));var _=require(_0x88a5('0xa'));var squel=require(_0x88a5('0xb'));var crypto=require(_0x88a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x88a5('0xd'));var toCsv=require(_0x88a5('0xe'));var querystring=require(_0x88a5('0xf'));var Papa=require(_0x88a5('0x10'));var Redis=require(_0x88a5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x88a5('0x12'));var as=require(_0x88a5('0x13'));var hardwareService=require(_0x88a5('0x14'));var logger=require(_0x88a5('0x15'))(_0x88a5('0x16'));var utils=require(_0x88a5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x88a5('0x18'));var db=require(_0x88a5('0x19'))['db'];function respondWithStatusCode(_0x423b09,_0xd53f9a){_0xd53f9a=_0xd53f9a||0xcc;return function(_0x2e84ba){if(_0x2e84ba){return _0x423b09[_0x88a5('0x1a')](_0xd53f9a);}return _0x423b09[_0x88a5('0x1b')](_0xd53f9a)[_0x88a5('0x1c')]();};}function respondWithResult(_0x34e21d,_0x3e3e00){_0x3e3e00=_0x3e3e00||0xc8;return function(_0x190b71){if(_0x190b71){return _0x34e21d[_0x88a5('0x1b')](_0x3e3e00)[_0x88a5('0x1d')](_0x190b71);}};}function respondWithFilteredResult(_0x1c73b6,_0x4ebef2){return function(_0x4f30ec){if(_0x4f30ec){var _0x1107ab=typeof _0x4ebef2[_0x88a5('0x1e')]===_0x88a5('0x1f')&&typeof _0x4ebef2[_0x88a5('0x20')]===_0x88a5('0x1f');var _0x22ac75=_0x4f30ec[_0x88a5('0x21')];var _0x3a3583=_0x1107ab?0x0:_0x4ebef2['offset'];var _0x23c59a=_0x1107ab?_0x4f30ec[_0x88a5('0x21')]:_0x4ebef2[_0x88a5('0x1e')]+_0x4ebef2['limit'];var _0xde619d;if(_0x23c59a>=_0x22ac75){_0x23c59a=_0x22ac75;_0xde619d=0xc8;}else{_0xde619d=0xce;}_0x1c73b6[_0x88a5('0x1b')](_0xde619d);return _0x1c73b6[_0x88a5('0x22')](_0x88a5('0x23'),_0x3a3583+'-'+_0x23c59a+'/'+_0x22ac75)[_0x88a5('0x1d')](_0x4f30ec);}return null;};}function patchUpdates(_0x1596ba){return function(_0x30ab1f){try{jsonpatch[_0x88a5('0x24')](_0x30ab1f,_0x1596ba,!![]);}catch(_0x42d4b4){return BPromise['reject'](_0x42d4b4);}return _0x30ab1f['save']();};}function saveUpdates(_0x5c3344,_0x3b1cb4){return function(_0x38246b){if(_0x38246b){return _0x38246b[_0x88a5('0x25')](_0x5c3344)['then'](function(_0x22593c){return _0x22593c;});}return null;};}function removeEntity(_0x5256df,_0x34a5f6){return function(_0x490d42){if(_0x490d42){return _0x490d42[_0x88a5('0x26')]()[_0x88a5('0x27')](function(){_0x5256df[_0x88a5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x338c83,_0x3e1dc7){return function(_0x4bf8fa){if(!_0x4bf8fa){_0x338c83[_0x88a5('0x1a')](0x194);}return _0x4bf8fa;};}function handleError(_0x1a7b0b,_0x311e87){_0x311e87=_0x311e87||0x1f4;return function(_0x191296){logger[_0x88a5('0x28')](_0x191296[_0x88a5('0x29')]);if(_0x191296[_0x88a5('0x2a')]){delete _0x191296['name'];}_0x1a7b0b['status'](_0x311e87)['send'](_0x191296);};}exports[_0x88a5('0x2b')]=function(_0x1b7927,_0x16c203){var _0x58074c={},_0x1bee72={},_0x3e7085={'count':0x0,'rows':[]};var _0x53d55f=_[_0x88a5('0x2c')](db[_0x88a5('0x2d')]['rawAttributes'],function(_0x17927a){return{'name':_0x17927a[_0x88a5('0x2e')],'type':_0x17927a['type'][_0x88a5('0x2f')]};});_0x1bee72[_0x88a5('0x30')]=_[_0x88a5('0x31')](_[_0x88a5('0x2c')](_0x53d55f,'name'),[_0x88a5('0x2a')]);_0x1bee72['query']=_[_0x88a5('0x32')](_0x1b7927['query']);_0x1bee72['filters']=_[_0x88a5('0x33')](_0x1bee72[_0x88a5('0x30')],_0x1bee72[_0x88a5('0x34')]);_0x58074c['attributes']=_['intersection'](_0x1bee72[_0x88a5('0x30')],qs[_0x88a5('0x35')](_0x1b7927[_0x88a5('0x34')][_0x88a5('0x35')]));_0x58074c['attributes']=_0x58074c[_0x88a5('0x36')]['length']?_0x58074c[_0x88a5('0x36')]:_0x1bee72[_0x88a5('0x30')];if(!_0x1b7927[_0x88a5('0x34')]['hasOwnProperty'](_0x88a5('0x37'))){_0x58074c[_0x88a5('0x20')]=qs[_0x88a5('0x20')](_0x1b7927['query'][_0x88a5('0x20')]);_0x58074c[_0x88a5('0x1e')]=qs[_0x88a5('0x1e')](_0x1b7927['query'][_0x88a5('0x1e')]);}_0x58074c[_0x88a5('0x38')]=qs[_0x88a5('0x39')](_0x1b7927[_0x88a5('0x34')]['sort']);_0x58074c[_0x88a5('0x3a')]=qs[_0x88a5('0x3b')](_['pick'](_0x1b7927[_0x88a5('0x34')],_0x1bee72['filters']),_0x53d55f);if(_0x1b7927[_0x88a5('0x34')][_0x88a5('0x3c')]){_0x58074c['where']=_[_0x88a5('0x3d')](_0x58074c[_0x88a5('0x3a')],{'$or':_[_0x88a5('0x2c')](_0x53d55f,function(_0x3d9477){if(_0x3d9477[_0x88a5('0x3e')]!=='VIRTUAL'){var _0x41da69={};_0x41da69[_0x3d9477['name']]={'$like':'%'+_0x1b7927[_0x88a5('0x34')][_0x88a5('0x3c')]+'%'};return _0x41da69;}})});}_0x58074c=_['merge']({},_0x58074c,_0x1b7927[_0x88a5('0x3f')]);var _0x2a8013={'where':_0x58074c[_0x88a5('0x3a')]};return db[_0x88a5('0x2d')][_0x88a5('0x21')](_0x2a8013)['then'](function(_0x17ed54){_0x3e7085['count']=_0x17ed54;if(_0x1b7927[_0x88a5('0x34')][_0x88a5('0x40')]){_0x58074c[_0x88a5('0x41')]=[{'all':!![]}];}return db[_0x88a5('0x2d')]['findAll'](_0x58074c);})['then'](function(_0xf2a2be){_0x3e7085[_0x88a5('0x42')]=_0xf2a2be;return _0x3e7085;})[_0x88a5('0x27')](respondWithFilteredResult(_0x16c203,_0x58074c))['catch'](handleError(_0x16c203,null));};exports[_0x88a5('0x43')]=function(_0x3f393f,_0x2fce76){var _0x49ca56={'raw':!![],'where':{'id':_0x3f393f['params']['id']}},_0x2e41bd={};_0x2e41bd[_0x88a5('0x30')]=_[_0x88a5('0x32')](db[_0x88a5('0x2d')]['rawAttributes']);_0x2e41bd[_0x88a5('0x34')]=_[_0x88a5('0x32')](_0x3f393f[_0x88a5('0x34')]);_0x2e41bd[_0x88a5('0x3b')]=_['intersection'](_0x2e41bd[_0x88a5('0x30')],_0x2e41bd[_0x88a5('0x34')]);_0x49ca56[_0x88a5('0x36')]=_[_0x88a5('0x33')](_0x2e41bd[_0x88a5('0x30')],qs['fields'](_0x3f393f['query']['fields']));_0x49ca56['attributes']=_0x49ca56['attributes']['length']?_0x49ca56[_0x88a5('0x36')]:_0x2e41bd[_0x88a5('0x30')];if(_0x3f393f[_0x88a5('0x34')][_0x88a5('0x40')]){_0x49ca56[_0x88a5('0x41')]=[{'all':!![]}];}_0x49ca56=_[_0x88a5('0x3d')]({},_0x49ca56,_0x3f393f[_0x88a5('0x3f')]);return db[_0x88a5('0x2d')][_0x88a5('0x44')](_0x49ca56)[_0x88a5('0x27')](handleEntityNotFound(_0x2fce76,null))[_0x88a5('0x27')](respondWithResult(_0x2fce76,null))[_0x88a5('0x45')](handleError(_0x2fce76,null));};exports['update']=function(_0x477aef,_0x43702a){if(_0x477aef[_0x88a5('0x46')]['id']){delete _0x477aef['body']['id'];}return db['CmCustomField']['find']({'where':{'id':_0x477aef[_0x88a5('0x47')]['id']}})[_0x88a5('0x27')](handleEntityNotFound(_0x43702a,null))[_0x88a5('0x27')](saveUpdates(_0x477aef['body'],null))[_0x88a5('0x27')](respondWithResult(_0x43702a,null))[_0x88a5('0x45')](handleError(_0x43702a,null));};exports[_0x88a5('0x26')]=function(_0x5dadf9,_0x42e71b){return db['CmCustomField'][_0x88a5('0x44')]({'where':{'id':_0x5dadf9['params']['id']}})[_0x88a5('0x27')](handleEntityNotFound(_0x42e71b,null))['then'](removeEntity(_0x42e71b,null))[_0x88a5('0x45')](handleError(_0x42e71b,null));};exports['create']=function(_0x44675f,_0xc690f9){var _0x5840f7;return db[_0x88a5('0x48')][_0x88a5('0x49')](function(_0x450b57){return db[_0x88a5('0x2d')]['create'](_0x44675f[_0x88a5('0x46')],{'transaction':_0x450b57})[_0x88a5('0x27')](function(_0x130f75){_0x5840f7=_0x130f75;var _0x315ea1={'type':db['Sequelize']['TEXT'],'transaction':_0x450b57};switch(_0x44675f['body'][_0x88a5('0x3e')]){case'text':_0x315ea1[_0x88a5('0x3e')]=db['Sequelize'][_0x88a5('0x4a')];break;case _0x88a5('0x4b'):_0x315ea1[_0x88a5('0x3e')]=db[_0x88a5('0x4c')][_0x88a5('0x4d')];break;case'switch':_0x315ea1[_0x88a5('0x3e')]=db[_0x88a5('0x4c')][_0x88a5('0x4e')];_0x315ea1['defaultValue']=![];break;default:}return db[_0x88a5('0x48')][_0x88a5('0x4f')][_0x88a5('0x50')](_0x88a5('0x51'),util['format'](_0x88a5('0x52'),_0x5840f7['id']),_0x315ea1);})[_0x88a5('0x27')](function(){return _0x5840f7;});})[_0x88a5('0x27')](respondWithResult(_0xc690f9,0xc9))[_0x88a5('0x45')](handleError(_0xc690f9,null));}; \ No newline at end of file +var _0x914a=['intersection','options','find','body','destroy','create','sequelize','transaction','TEXT','text','Sequelize','number','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','map','fieldName','type','model','differenceBy','keys','query','fields','attributes','length','order','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','CmCustomField','findAll','rows','catch','params'];(function(_0x122b19,_0x21eb2a){var _0x142584=function(_0x17552f){while(--_0x17552f){_0x122b19['push'](_0x122b19['shift']());}};_0x142584(++_0x21eb2a);}(_0x914a,0x6b));var _0xa914=function(_0x1e0a4a,_0x55752e){_0x1e0a4a=_0x1e0a4a-0x0;var _0x352afd=_0x914a[_0x1e0a4a];return _0x352afd;};'use strict';var emlformat=require(_0xa914('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa914('0x1'));var rp=require(_0xa914('0x2'));var moment=require(_0xa914('0x3'));var BPromise=require(_0xa914('0x4'));var Mustache=require(_0xa914('0x5'));var util=require(_0xa914('0x6'));var path=require(_0xa914('0x7'));var sox=require(_0xa914('0x8'));var csv=require(_0xa914('0x9'));var ejs=require(_0xa914('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa914('0xb'));var squel=require(_0xa914('0xc'));var crypto=require(_0xa914('0xd'));var jsforce=require(_0xa914('0xe'));var deskjs=require(_0xa914('0xf'));var toCsv=require(_0xa914('0x9'));var querystring=require(_0xa914('0x10'));var Papa=require(_0xa914('0x11'));var Redis=require(_0xa914('0x12'));var authService=require(_0xa914('0x13'));var qs=require(_0xa914('0x14'));var as=require(_0xa914('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa914('0x16'));var utils=require(_0xa914('0x17'));var config=require(_0xa914('0x18'));var licenseUtil=require(_0xa914('0x19'));var db=require(_0xa914('0x1a'))['db'];function respondWithStatusCode(_0x215ad1,_0x3fec24){_0x3fec24=_0x3fec24||0xcc;return function(_0x2a5bc6){if(_0x2a5bc6){return _0x215ad1[_0xa914('0x1b')](_0x3fec24);}return _0x215ad1[_0xa914('0x1c')](_0x3fec24)['end']();};}function respondWithResult(_0x1cb68f,_0x1834ed){_0x1834ed=_0x1834ed||0xc8;return function(_0x179871){if(_0x179871){return _0x1cb68f[_0xa914('0x1c')](_0x1834ed)[_0xa914('0x1d')](_0x179871);}};}function respondWithFilteredResult(_0x599993,_0x4275df){return function(_0xeba2e7){if(_0xeba2e7){var _0x534789=typeof _0x4275df[_0xa914('0x1e')]===_0xa914('0x1f')&&typeof _0x4275df[_0xa914('0x20')]==='undefined';var _0x8326c2=_0xeba2e7[_0xa914('0x21')];var _0x6ab1f4=_0x534789?0x0:_0x4275df[_0xa914('0x1e')];var _0x252bbf=_0x534789?_0xeba2e7['count']:_0x4275df[_0xa914('0x1e')]+_0x4275df[_0xa914('0x20')];var _0x333265;if(_0x252bbf>=_0x8326c2){_0x252bbf=_0x8326c2;_0x333265=0xc8;}else{_0x333265=0xce;}_0x599993['status'](_0x333265);return _0x599993['set'](_0xa914('0x22'),_0x6ab1f4+'-'+_0x252bbf+'/'+_0x8326c2)[_0xa914('0x1d')](_0xeba2e7);}return null;};}function patchUpdates(_0x98ab52){return function(_0x12af59){try{jsonpatch[_0xa914('0x23')](_0x12af59,_0x98ab52,!![]);}catch(_0x401390){return BPromise[_0xa914('0x24')](_0x401390);}return _0x12af59[_0xa914('0x25')]();};}function saveUpdates(_0x515de2,_0x5da71e){return function(_0x6eac20){if(_0x6eac20){return _0x6eac20[_0xa914('0x26')](_0x515de2)[_0xa914('0x27')](function(_0x63efb3){return _0x63efb3;});}return null;};}function removeEntity(_0x489159,_0x1ce420){return function(_0x55fb85){if(_0x55fb85){return _0x55fb85['destroy']()['then'](function(){_0x489159[_0xa914('0x1c')](0xcc)[_0xa914('0x28')]();});}};}function handleEntityNotFound(_0x460916,_0x2747e0){return function(_0x44a354){if(!_0x44a354){_0x460916[_0xa914('0x1b')](0x194);}return _0x44a354;};}function handleError(_0x4de560,_0x1d0eb2){_0x1d0eb2=_0x1d0eb2||0x1f4;return function(_0x291e90){logger['error'](_0x291e90[_0xa914('0x29')]);if(_0x291e90[_0xa914('0x2a')]){delete _0x291e90[_0xa914('0x2a')];}_0x4de560['status'](_0x1d0eb2)[_0xa914('0x2b')](_0x291e90);};}exports[_0xa914('0x2c')]=function(_0x43242f,_0x43fc31){var _0x2ccdab={},_0x581ba3={},_0x45af46={'count':0x0,'rows':[]};var _0x4d9874=_[_0xa914('0x2d')](db['CmCustomField']['rawAttributes'],function(_0x5598f6){return{'name':_0x5598f6[_0xa914('0x2e')],'type':_0x5598f6[_0xa914('0x2f')]['key']};});_0x581ba3[_0xa914('0x30')]=_[_0xa914('0x31')](_[_0xa914('0x2d')](_0x4d9874,_0xa914('0x2a')),[_0xa914('0x2a')]);_0x581ba3['query']=_[_0xa914('0x32')](_0x43242f[_0xa914('0x33')]);_0x581ba3['filters']=_['intersection'](_0x581ba3['model'],_0x581ba3[_0xa914('0x33')]);_0x2ccdab['attributes']=_['intersection'](_0x581ba3['model'],qs[_0xa914('0x34')](_0x43242f[_0xa914('0x33')][_0xa914('0x34')]));_0x2ccdab[_0xa914('0x35')]=_0x2ccdab[_0xa914('0x35')][_0xa914('0x36')]?_0x2ccdab[_0xa914('0x35')]:_0x581ba3[_0xa914('0x30')];if(!_0x43242f['query']['hasOwnProperty']('nolimit')){_0x2ccdab[_0xa914('0x20')]=qs[_0xa914('0x20')](_0x43242f[_0xa914('0x33')][_0xa914('0x20')]);_0x2ccdab[_0xa914('0x1e')]=qs[_0xa914('0x1e')](_0x43242f['query'][_0xa914('0x1e')]);}_0x2ccdab[_0xa914('0x37')]=qs['sort'](_0x43242f[_0xa914('0x33')]['sort']);_0x2ccdab['where']=qs[_0xa914('0x38')](_[_0xa914('0x39')](_0x43242f[_0xa914('0x33')],_0x581ba3['filters']),_0x4d9874);if(_0x43242f[_0xa914('0x33')][_0xa914('0x3a')]){_0x2ccdab[_0xa914('0x3b')]=_[_0xa914('0x3c')](_0x2ccdab[_0xa914('0x3b')],{'$or':_[_0xa914('0x2d')](_0x4d9874,function(_0x286c40){if(_0x286c40[_0xa914('0x2f')]!==_0xa914('0x3d')){var _0x555eaa={};_0x555eaa[_0x286c40[_0xa914('0x2a')]]={'$like':'%'+_0x43242f[_0xa914('0x33')][_0xa914('0x3a')]+'%'};return _0x555eaa;}})});}_0x2ccdab=_['merge']({},_0x2ccdab,_0x43242f['options']);var _0x151614={'where':_0x2ccdab[_0xa914('0x3b')]};return db['CmCustomField'][_0xa914('0x21')](_0x151614)[_0xa914('0x27')](function(_0x127613){_0x45af46['count']=_0x127613;if(_0x43242f['query'][_0xa914('0x3e')]){_0x2ccdab[_0xa914('0x3f')]=[{'all':!![]}];}return db[_0xa914('0x40')][_0xa914('0x41')](_0x2ccdab);})['then'](function(_0x11793a){_0x45af46[_0xa914('0x42')]=_0x11793a;return _0x45af46;})[_0xa914('0x27')](respondWithFilteredResult(_0x43fc31,_0x2ccdab))[_0xa914('0x43')](handleError(_0x43fc31,null));};exports['show']=function(_0x2bac16,_0x3c0ade){var _0xc28c54={'raw':!![],'where':{'id':_0x2bac16[_0xa914('0x44')]['id']}},_0xd3470a={};_0xd3470a[_0xa914('0x30')]=_['keys'](db[_0xa914('0x40')]['rawAttributes']);_0xd3470a[_0xa914('0x33')]=_[_0xa914('0x32')](_0x2bac16[_0xa914('0x33')]);_0xd3470a[_0xa914('0x38')]=_[_0xa914('0x45')](_0xd3470a[_0xa914('0x30')],_0xd3470a['query']);_0xc28c54[_0xa914('0x35')]=_[_0xa914('0x45')](_0xd3470a[_0xa914('0x30')],qs['fields'](_0x2bac16[_0xa914('0x33')][_0xa914('0x34')]));_0xc28c54[_0xa914('0x35')]=_0xc28c54['attributes'][_0xa914('0x36')]?_0xc28c54[_0xa914('0x35')]:_0xd3470a[_0xa914('0x30')];if(_0x2bac16[_0xa914('0x33')]['includeAll']){_0xc28c54['include']=[{'all':!![]}];}_0xc28c54=_[_0xa914('0x3c')]({},_0xc28c54,_0x2bac16[_0xa914('0x46')]);return db[_0xa914('0x40')][_0xa914('0x47')](_0xc28c54)[_0xa914('0x27')](handleEntityNotFound(_0x3c0ade,null))[_0xa914('0x27')](respondWithResult(_0x3c0ade,null))[_0xa914('0x43')](handleError(_0x3c0ade,null));};exports[_0xa914('0x26')]=function(_0x29373d,_0x597241){if(_0x29373d[_0xa914('0x48')]['id']){delete _0x29373d['body']['id'];}return db['CmCustomField']['find']({'where':{'id':_0x29373d[_0xa914('0x44')]['id']}})['then'](handleEntityNotFound(_0x597241,null))[_0xa914('0x27')](saveUpdates(_0x29373d[_0xa914('0x48')],null))[_0xa914('0x27')](respondWithResult(_0x597241,null))['catch'](handleError(_0x597241,null));};exports[_0xa914('0x49')]=function(_0x4be1af,_0x84ace8){return db[_0xa914('0x40')][_0xa914('0x47')]({'where':{'id':_0x4be1af[_0xa914('0x44')]['id']}})[_0xa914('0x27')](handleEntityNotFound(_0x84ace8,null))[_0xa914('0x27')](removeEntity(_0x84ace8,null))['catch'](handleError(_0x84ace8,null));};exports[_0xa914('0x4a')]=function(_0x198ebc,_0xa8ba5a){var _0x29fc80;return db[_0xa914('0x4b')][_0xa914('0x4c')](function(_0x35baf4){return db[_0xa914('0x40')]['create'](_0x198ebc[_0xa914('0x48')],{'transaction':_0x35baf4})[_0xa914('0x27')](function(_0x3d6dfc){_0x29fc80=_0x3d6dfc;var _0x3a80e8={'type':db['Sequelize'][_0xa914('0x4d')],'transaction':_0x35baf4};switch(_0x198ebc[_0xa914('0x48')][_0xa914('0x2f')]){case _0xa914('0x4e'):_0x3a80e8[_0xa914('0x2f')]=db[_0xa914('0x4f')][_0xa914('0x4d')];break;case _0xa914('0x50'):_0x3a80e8[_0xa914('0x2f')]=db[_0xa914('0x4f')]['INTEGER'];break;case _0xa914('0x51'):_0x3a80e8[_0xa914('0x2f')]=db[_0xa914('0x4f')][_0xa914('0x52')];_0x3a80e8['defaultValue']=![];break;default:}return db[_0xa914('0x4b')][_0xa914('0x53')][_0xa914('0x54')](_0xa914('0x55'),util[_0xa914('0x56')](_0xa914('0x57'),_0x29fc80['id']),_0x3a80e8);})[_0xa914('0x27')](function(){return _0x29fc80;});})[_0xa914('0x27')](respondWithResult(_0xa8ba5a,0xc9))['catch'](handleError(_0xa8ba5a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index c6f1fd8..ef494eb 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 _0x8024=['define','CmCustomField','lodash','util','../../config/logger','api','request-promise','path','rimraf','./cmCustomField.attributes','exports'];(function(_0x1bb720,_0x3cacfd){var _0x150c83=function(_0x4650e2){while(--_0x4650e2){_0x1bb720['push'](_0x1bb720['shift']());}};_0x150c83(++_0x3cacfd);}(_0x8024,0x16d));var _0x4802=function(_0x4ba92e,_0x26d2bc){_0x4ba92e=_0x4ba92e-0x0;var _0x5848ae=_0x8024[_0x4ba92e];return _0x5848ae;};'use strict';var _=require(_0x4802('0x0'));var util=require(_0x4802('0x1'));var logger=require(_0x4802('0x2'))(_0x4802('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4802('0x4'));var fs=require('fs');var path=require(_0x4802('0x5'));var rimraf=require(_0x4802('0x6'));var config=require('../../config/environment');var attributes=require(_0x4802('0x7'));module[_0x4802('0x8')]=function(_0xafb88,_0x3a2061){return _0xafb88[_0x4802('0x9')](_0x4802('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca04=['cm_custom_fields','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmCustomField'];(function(_0x22c479,_0x363ebc){var _0x119ef3=function(_0x485df6){while(--_0x485df6){_0x22c479['push'](_0x22c479['shift']());}};_0x119ef3(++_0x363ebc);}(_0xca04,0xbc));var _0x4ca0=function(_0x632bc2,_0x119815){_0x632bc2=_0x632bc2-0x0;var _0x441453=_0xca04[_0x632bc2];return _0x441453;};'use strict';var _=require('lodash');var util=require(_0x4ca0('0x0'));var logger=require(_0x4ca0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4ca0('0x2'));var rp=require(_0x4ca0('0x3'));var fs=require('fs');var path=require(_0x4ca0('0x4'));var rimraf=require(_0x4ca0('0x5'));var config=require(_0x4ca0('0x6'));var attributes=require('./cmCustomField.attributes');module[_0x4ca0('0x7')]=function(_0x1b373a,_0x2adf44){return _0x1b373a[_0x4ca0('0x8')](_0x4ca0('0x9'),attributes,{'tableName':_0x4ca0('0xa'),'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 6b39e8f..fe3bd98 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 _0x830f=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','code','error','CmCustomField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug'];(function(_0x257fa2,_0xd02273){var _0x390993=function(_0x190eae){while(--_0x190eae){_0x257fa2['push'](_0x257fa2['shift']());}};_0x390993(++_0xd02273);}(_0x830f,0x1d1));var _0xf830=function(_0x483ce7,_0x5137d4){_0x483ce7=_0x483ce7-0x0;var _0x27b976=_0x830f[_0x483ce7];return _0x27b976;};'use strict';var _=require('lodash');var util=require(_0xf830('0x0'));var moment=require(_0xf830('0x1'));var BPromise=require(_0xf830('0x2'));var rs=require(_0xf830('0x3'));var fs=require('fs');var Redis=require(_0xf830('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf830('0x5'));var logger=require(_0xf830('0x6'))(_0xf830('0x7'));var config=require(_0xf830('0x8'));var jayson=require(_0xf830('0x9'));var client=jayson['client'][_0xf830('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b8722,_0x15bd7c,_0x5ca223){return new BPromise(function(_0x52b405,_0x56be26){return client[_0xf830('0xb')](_0x5b8722,_0x5ca223)[_0xf830('0xc')](function(_0x4d89ff){logger['info']('CmCustomField,\x20%s,\x20%s',_0x15bd7c,_0xf830('0xd'));logger[_0xf830('0xe')](_0xf830('0xf'),_0x15bd7c,'request\x20sent',JSON[_0xf830('0x10')](_0x4d89ff));if(_0x4d89ff['error']){if(_0x4d89ff['error'][_0xf830('0x11')]===0x1f4){logger[_0xf830('0x12')](_0xf830('0x13'),_0x15bd7c,_0x4d89ff[_0xf830('0x12')][_0xf830('0x14')]);return _0x56be26(_0x4d89ff[_0xf830('0x12')][_0xf830('0x14')]);}logger['error'](_0xf830('0x13'),_0x15bd7c,_0x4d89ff[_0xf830('0x12')][_0xf830('0x14')]);return _0x52b405(_0x4d89ff[_0xf830('0x12')][_0xf830('0x14')]);}else{logger[_0xf830('0x15')](_0xf830('0x13'),_0x15bd7c,_0xf830('0xd'));_0x52b405(_0x4d89ff[_0xf830('0x16')][_0xf830('0x14')]);}})[_0xf830('0x17')](function(_0x1ced1b){logger[_0xf830('0x12')](_0xf830('0x13'),_0x15bd7c,_0x1ced1b);_0x56be26(_0x1ced1b);});});} \ No newline at end of file +var _0xab40=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring'];(function(_0x4c164e,_0x3be5e5){var _0x5cad93=function(_0x30e530){while(--_0x30e530){_0x4c164e['push'](_0x4c164e['shift']());}};_0x5cad93(++_0x3be5e5);}(_0xab40,0x64));var _0x0ab4=function(_0x4218a7,_0x387796){_0x4218a7=_0x4218a7-0x0;var _0x5b8252=_0xab40[_0x4218a7];return _0x5b8252;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require(_0x0ab4('0x2'));var BPromise=require(_0x0ab4('0x3'));var rs=require(_0x0ab4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0ab4('0x5'));var logger=require(_0x0ab4('0x6'))('rpc');var config=require(_0x0ab4('0x7'));var jayson=require(_0x0ab4('0x8'));var client=jayson[_0x0ab4('0x9')][_0x0ab4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27e4ca,_0x52b72c,_0x950f38){return new BPromise(function(_0x405e34,_0x11f8bf){return client[_0x0ab4('0xb')](_0x27e4ca,_0x950f38)[_0x0ab4('0xc')](function(_0x4e66f8){logger[_0x0ab4('0xd')](_0x0ab4('0xe'),_0x52b72c,_0x0ab4('0xf'));logger['debug'](_0x0ab4('0x10'),_0x52b72c,_0x0ab4('0xf'),JSON[_0x0ab4('0x11')](_0x4e66f8));if(_0x4e66f8['error']){if(_0x4e66f8[_0x0ab4('0x12')][_0x0ab4('0x13')]===0x1f4){logger[_0x0ab4('0x12')]('CmCustomField,\x20%s,\x20%s',_0x52b72c,_0x4e66f8[_0x0ab4('0x12')][_0x0ab4('0x14')]);return _0x11f8bf(_0x4e66f8[_0x0ab4('0x12')][_0x0ab4('0x14')]);}logger[_0x0ab4('0x12')]('CmCustomField,\x20%s,\x20%s',_0x52b72c,_0x4e66f8[_0x0ab4('0x12')][_0x0ab4('0x14')]);return _0x405e34(_0x4e66f8[_0x0ab4('0x12')]['message']);}else{logger[_0x0ab4('0xd')]('CmCustomField,\x20%s,\x20%s',_0x52b72c,_0x0ab4('0xf'));_0x405e34(_0x4e66f8['result']['message']);}})['catch'](function(_0x479541){logger[_0x0ab4('0x12')](_0x0ab4('0xe'),_0x52b72c,_0x479541);_0x11f8bf(_0x479541);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 3d6b916..5cce6b4 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 _0xd45e=['post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','/:id','show'];(function(_0x513c6c,_0x5cf188){var _0x563bff=function(_0x42dc3b){while(--_0x42dc3b){_0x513c6c['push'](_0x513c6c['shift']());}};_0x563bff(++_0x5cf188);}(_0xd45e,0x182));var _0xed45=function(_0x460b11,_0x13637f){_0x460b11=_0x460b11-0x0;var _0x2562a8=_0xd45e[_0x460b11];return _0x2562a8;};'use strict';var multer=require('multer');var util=require(_0xed45('0x0'));var path=require(_0xed45('0x1'));var timeout=require('connect-timeout');var express=require(_0xed45('0x2'));var router=express['Router']();var fs_extra=require(_0xed45('0x3'));var auth=require(_0xed45('0x4'));var interaction=require(_0xed45('0x5'));var config=require('../../config/environment');var controller=require(_0xed45('0x6'));router[_0xed45('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xed45('0x7')](_0xed45('0x8'),auth['isAuthenticated'](),controller[_0xed45('0x9')]);router[_0xed45('0xa')]('/',auth[_0xed45('0xb')](),controller[_0xed45('0xc')]);router[_0xed45('0xd')](_0xed45('0x8'),auth['isAuthenticated'](),controller[_0xed45('0xe')]);router[_0xed45('0xf')](_0xed45('0x8'),auth[_0xed45('0xb')](),controller[_0xed45('0x10')]);module[_0xed45('0x11')]=router; \ No newline at end of file +var _0xd8a7=['express','Router','fs-extra','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','get','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x1631cf,_0x581b97){var _0x377eb6=function(_0x5dba60){while(--_0x5dba60){_0x1631cf['push'](_0x1631cf['shift']());}};_0x377eb6(++_0x581b97);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x469a6e,_0x21d289){_0x469a6e=_0x469a6e-0x0;var _0x5df36a=_0xd8a7[_0x469a6e];return _0x5df36a;};'use strict';var multer=require(_0x7d8a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7d8a('0x1'));var router=express[_0x7d8a('0x2')]();var fs_extra=require(_0x7d8a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7d8a('0x4'));var config=require('../../config/environment');var controller=require(_0x7d8a('0x5'));router['get']('/',auth[_0x7d8a('0x6')](),controller['index']);router[_0x7d8a('0x7')](_0x7d8a('0x8'),auth[_0x7d8a('0x6')](),controller['show']);router[_0x7d8a('0x9')]('/',auth[_0x7d8a('0x6')](),controller[_0x7d8a('0xa')]);router[_0x7d8a('0xb')](_0x7d8a('0x8'),auth[_0x7d8a('0x6')](),controller[_0x7d8a('0xc')]);router[_0x7d8a('0xd')](_0x7d8a('0x8'),auth[_0x7d8a('0x6')](),controller[_0x7d8a('0xe')]);module[_0x7d8a('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 08564f9..bdb5cf2 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 _0xe85b=['DATE','format','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','sequelize','STRING'];(function(_0x19f733,_0xa2d8f8){var _0x7c1806=function(_0x54f1ad){while(--_0x54f1ad){_0x19f733['push'](_0x19f733['shift']());}};_0x7c1806(++_0xa2d8f8);}(_0xe85b,0x186));var _0xbe85=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0xe85b[_0x4450b1];return _0x399b0b;};'use strict';var moment=require('moment');var Sequelize=require(_0xbe85('0x0'));module['exports']={'phone':{'type':Sequelize[_0xbe85('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xbe85('0x2')],'defaultValue':moment()[_0xbe85('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xbe85('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbe85('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xbe85('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbe85('0x2')]},'priority':{'type':Sequelize[_0xbe85('0x4')](0x2)[_0xbe85('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xbe85('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xbe85('0x4')],'unique':_0xbe85('0x7')},'ListId':{'type':Sequelize[_0xbe85('0x4')],'unique':_0xbe85('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xbe85('0x4')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xbe85('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xbe85('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbe85('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbe85('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbe85('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8bfb=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','sequelize','exports'];(function(_0x278244,_0x58e656){var _0x4da48b=function(_0x2f76b0){while(--_0x2f76b0){_0x278244['push'](_0x278244['shift']());}};_0x4da48b(++_0x58e656);}(_0x8bfb,0x127));var _0xb8bf=function(_0x98b4b4,_0x32a016){_0x98b4b4=_0x98b4b4-0x0;var _0x5edf59=_0x8bfb[_0x98b4b4];return _0x5edf59;};'use strict';var moment=require('moment');var Sequelize=require(_0xb8bf('0x0'));module[_0xb8bf('0x1')]={'phone':{'type':Sequelize[_0xb8bf('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xb8bf('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb8bf('0x4')],'defaultValue':moment()[_0xb8bf('0x5')](_0xb8bf('0x6'))},'countbusyretry':{'type':Sequelize[_0xb8bf('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb8bf('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb8bf('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xb8bf('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb8bf('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb8bf('0x7')],'unique':_0xb8bf('0x8')},'ListId':{'type':Sequelize[_0xb8bf('0x7')],'unique':_0xb8bf('0x8')},'UserId':{'type':Sequelize[_0xb8bf('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xb8bf('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xb8bf('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xb8bf('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb8bf('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb8bf('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb8bf('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb8bf('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 5243c03..58145f3 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 _0x88d4=['$notIn','$like','$notILike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','CampaignId','VoiceQueueId','VoiceQueue','omit','dataValues','updatedAt','state','statedesc','deleted','membername','UserId','user','format','phone','campaigntype','CmContact','firstName','lastName','isNil','calleridname','getPreview','getVoiceQueues','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','sequelize','literal','findOne','scheduledat','LOCK','Contact','CmCompany','CmList','List','getOpenContacts','outbound','preview','isNumber','entity\x20not\x20found','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','apply','update','destroy','then','error','name','send','CmHopper','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','filters','concat','$and','$or','$gte','$lt','$ne','$eq','$not','$notBetween','$in'];(function(_0x21c1a8,_0x2772c3){var _0x3f7d73=function(_0x4002f6){while(--_0x4002f6){_0x21c1a8['push'](_0x21c1a8['shift']());}};_0x3f7d73(++_0x2772c3);}(_0x88d4,0x152));var _0x488d=function(_0x21b3a1,_0xdee3d2){_0x21b3a1=_0x21b3a1-0x0;var _0xd9620c=_0x88d4[_0x21b3a1];return _0xd9620c;};'use strict';var emlformat=require(_0x488d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x488d('0x1'));var moment=require(_0x488d('0x2'));var BPromise=require(_0x488d('0x3'));var Mustache=require(_0x488d('0x4'));var util=require(_0x488d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x488d('0x6'));var ejs=require(_0x488d('0x7'));var fs=require('fs');var fs_extra=require(_0x488d('0x8'));var _=require(_0x488d('0x9'));var squel=require(_0x488d('0xa'));var crypto=require(_0x488d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x488d('0xc'));var toCsv=require(_0x488d('0x6'));var querystring=require(_0x488d('0xd'));var Papa=require(_0x488d('0xe'));var Redis=require(_0x488d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x488d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x488d('0x11'))(_0x488d('0x12'));var utils=require(_0x488d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x488d('0x14'));var db=require(_0x488d('0x15'))['db'];function respondWithStatusCode(_0x3b4b30,_0x14954a){_0x14954a=_0x14954a||0xcc;return function(_0xb9b02b){if(_0xb9b02b){return _0x3b4b30[_0x488d('0x16')](_0x14954a);}return _0x3b4b30[_0x488d('0x17')](_0x14954a)[_0x488d('0x18')]();};}function respondWithResult(_0x157858,_0x300c21){_0x300c21=_0x300c21||0xc8;return function(_0x4dc44e){if(_0x4dc44e){return _0x157858[_0x488d('0x17')](_0x300c21)['json'](_0x4dc44e);}};}function respondWithFilteredResult(_0x4b3ed9,_0x33317a){return function(_0x2a39d9){if(_0x2a39d9){var _0xb5694e=typeof _0x33317a[_0x488d('0x19')]==='undefined'&&typeof _0x33317a['limit']===_0x488d('0x1a');var _0x5b29b7=_0x2a39d9[_0x488d('0x1b')];var _0x3f7365=_0xb5694e?0x0:_0x33317a[_0x488d('0x19')];var _0x12b9a8=_0xb5694e?_0x2a39d9[_0x488d('0x1b')]:_0x33317a[_0x488d('0x19')]+_0x33317a[_0x488d('0x1c')];var _0x145ed9;if(_0x12b9a8>=_0x5b29b7){_0x12b9a8=_0x5b29b7;_0x145ed9=0xc8;}else{_0x145ed9=0xce;}_0x4b3ed9[_0x488d('0x17')](_0x145ed9);return _0x4b3ed9[_0x488d('0x1d')]('Content-Range',_0x3f7365+'-'+_0x12b9a8+'/'+_0x5b29b7)['json'](_0x2a39d9);}return null;};}function patchUpdates(_0x213e7a){return function(_0x1e638a){try{jsonpatch[_0x488d('0x1e')](_0x1e638a,_0x213e7a,!![]);}catch(_0x502b2e){return BPromise['reject'](_0x502b2e);}return _0x1e638a['save']();};}function saveUpdates(_0x5041ab,_0x212c2a){return function(_0x2b6bb9){if(_0x2b6bb9){return _0x2b6bb9[_0x488d('0x1f')](_0x5041ab)['then'](function(_0x433417){return _0x433417;});}return null;};}function removeEntity(_0x3b02b4,_0x239bbd){return function(_0x1e5e1f){if(_0x1e5e1f){return _0x1e5e1f[_0x488d('0x20')]()[_0x488d('0x21')](function(){_0x3b02b4[_0x488d('0x17')](0xcc)[_0x488d('0x18')]();});}};}function handleEntityNotFound(_0x480afd,_0x5533e5){return function(_0x5578e7){if(!_0x5578e7){_0x480afd[_0x488d('0x16')](0x194);}return _0x5578e7;};}function handleError(_0x29fc94,_0x363fca){_0x363fca=_0x363fca||0x1f4;return function(_0x2e35e5){logger[_0x488d('0x22')](_0x2e35e5['stack']);if(_0x2e35e5[_0x488d('0x23')]){delete _0x2e35e5[_0x488d('0x23')];}_0x29fc94[_0x488d('0x17')](_0x363fca)[_0x488d('0x24')](_0x2e35e5);};}exports['index']=function(_0x1ad830,_0x501f44){var _0x1e2d4c={},_0x5e0360={},_0x36a383={'count':0x0,'rows':[]};var _0x136915=_['map'](db[_0x488d('0x25')][_0x488d('0x26')],function(_0x364abe){return{'name':_0x364abe[_0x488d('0x27')],'type':_0x364abe[_0x488d('0x28')][_0x488d('0x29')]};});_0x5e0360[_0x488d('0x2a')]=_[_0x488d('0x2b')](_0x136915,_0x488d('0x23'));_0x5e0360[_0x488d('0x2c')]=_[_0x488d('0x2d')](_0x1ad830[_0x488d('0x2c')]);_0x5e0360['filters']=_[_0x488d('0x2e')](_0x5e0360[_0x488d('0x2a')],_0x5e0360[_0x488d('0x2c')]);_0x5e0360[_0x488d('0x2f')]=_[_0x488d('0x30')](_0x5e0360['filters'],[_0x488d('0x31'),_0x488d('0x32'),'$gt',_0x488d('0x33'),_0x488d('0x34'),'$lte',_0x488d('0x35'),_0x488d('0x36'),_0x488d('0x37'),'$between',_0x488d('0x38'),_0x488d('0x39'),_0x488d('0x3a'),_0x488d('0x3b'),'$notLike','$iLike',_0x488d('0x3c'),_0x488d('0x3b'),_0x488d('0x3d'),_0x488d('0x3e'),'$contained',_0x488d('0x3f')]);_0x1e2d4c[_0x488d('0x40')]=_[_0x488d('0x2e')](_0x5e0360[_0x488d('0x2a')],qs[_0x488d('0x41')](_0x1ad830['query'][_0x488d('0x41')]));_0x1e2d4c['attributes']=_0x1e2d4c['attributes'][_0x488d('0x42')]?_0x1e2d4c[_0x488d('0x40')]:_0x5e0360[_0x488d('0x2a')];if(!_0x1ad830[_0x488d('0x2c')][_0x488d('0x43')](_0x488d('0x44'))){_0x1e2d4c[_0x488d('0x1c')]=qs[_0x488d('0x1c')](_0x1ad830[_0x488d('0x2c')]['limit']);_0x1e2d4c[_0x488d('0x19')]=qs[_0x488d('0x19')](_0x1ad830[_0x488d('0x2c')][_0x488d('0x19')]);}_0x1e2d4c['order']=qs[_0x488d('0x45')](_0x1ad830[_0x488d('0x2c')]['sort']);_0x1e2d4c[_0x488d('0x46')]=qs[_0x488d('0x2f')](_['pick'](_0x1ad830['query'],_0x5e0360[_0x488d('0x2f')]),_0x136915);if(_0x1ad830[_0x488d('0x2c')][_0x488d('0x47')]){_0x1e2d4c['where']=_[_0x488d('0x48')](_0x1e2d4c['where'],{'$or':_[_0x488d('0x2b')](_0x136915,function(_0x3ad5b7){if(_0x3ad5b7[_0x488d('0x28')]!==_0x488d('0x49')){var _0x332969={};_0x332969[_0x3ad5b7[_0x488d('0x23')]]={'$like':'%'+_0x1ad830[_0x488d('0x2c')]['filter']+'%'};return _0x332969;}})});}_0x1e2d4c=_[_0x488d('0x48')]({},_0x1e2d4c,_0x1ad830[_0x488d('0x4a')]);var _0x22075d={'where':_0x1e2d4c[_0x488d('0x46')]};return db[_0x488d('0x25')][_0x488d('0x1b')](_0x22075d)['then'](function(_0x31e0f7){_0x36a383['count']=_0x31e0f7;if(_0x1ad830['query'][_0x488d('0x4b')]){_0x1e2d4c['include']=[{'all':!![]}];}return db[_0x488d('0x25')][_0x488d('0x4c')](_0x1e2d4c);})[_0x488d('0x21')](function(_0x436a79){_0x36a383[_0x488d('0x4d')]=_0x436a79;return _0x36a383;})[_0x488d('0x21')](respondWithFilteredResult(_0x501f44,_0x1e2d4c))[_0x488d('0x4e')](handleError(_0x501f44,null));};exports[_0x488d('0x4f')]=function(_0x1b5154,_0x5f50ef){var _0xea7531={'raw':!![],'where':{'id':_0x1b5154[_0x488d('0x50')]['id']}},_0x5836e7={};_0x5836e7[_0x488d('0x2a')]=_['keys'](db[_0x488d('0x25')][_0x488d('0x26')]);_0x5836e7['query']=_[_0x488d('0x2d')](_0x1b5154[_0x488d('0x2c')]);_0x5836e7[_0x488d('0x2f')]=_['intersection'](_0x5836e7[_0x488d('0x2a')],_0x5836e7[_0x488d('0x2c')]);_0xea7531['attributes']=_[_0x488d('0x2e')](_0x5836e7['model'],qs['fields'](_0x1b5154[_0x488d('0x2c')]['fields']));_0xea7531[_0x488d('0x40')]=_0xea7531[_0x488d('0x40')][_0x488d('0x42')]?_0xea7531[_0x488d('0x40')]:_0x5836e7[_0x488d('0x2a')];if(_0x1b5154[_0x488d('0x2c')]['includeAll']){_0xea7531[_0x488d('0x51')]=[{'all':!![]}];}_0xea7531=_[_0x488d('0x48')]({},_0xea7531,_0x1b5154[_0x488d('0x4a')]);return db[_0x488d('0x25')][_0x488d('0x52')](_0xea7531)['then'](handleEntityNotFound(_0x5f50ef,null))[_0x488d('0x21')](respondWithResult(_0x5f50ef,null))[_0x488d('0x4e')](handleError(_0x5f50ef,null));};exports[_0x488d('0x53')]=function(_0x2192de,_0x27d1a3){return db[_0x488d('0x25')]['create'](_0x2192de[_0x488d('0x54')],{})[_0x488d('0x21')](respondWithResult(_0x27d1a3,0xc9))[_0x488d('0x4e')](handleError(_0x27d1a3,null));};exports[_0x488d('0x1f')]=function(_0x254936,_0x4d4f9d){if(_0x254936[_0x488d('0x54')]['id']){delete _0x254936[_0x488d('0x54')]['id'];}return db[_0x488d('0x25')]['find']({'where':{'id':_0x254936['params']['id']}})[_0x488d('0x21')](handleEntityNotFound(_0x4d4f9d,null))['then'](saveUpdates(_0x254936[_0x488d('0x54')],null))['then'](respondWithResult(_0x4d4f9d,null))[_0x488d('0x4e')](handleError(_0x4d4f9d,null));};exports[_0x488d('0x55')]=function(_0x1f1cd1,_0x1cbc87){return db[_0x488d('0x25')][_0x488d('0x55')]()['then'](respondWithResult(_0x1cbc87,null))[_0x488d('0x4e')](handleError(_0x1cbc87,null));};exports[_0x488d('0x20')]=function(_0x19533f,_0x1795b7){var _0x1f52c8;return db[_0x488d('0x25')][_0x488d('0x52')]({'where':{'id':_0x19533f[_0x488d('0x50')]['id']}})[_0x488d('0x21')](handleEntityNotFound(_0x1795b7,null))[_0x488d('0x21')](function(_0x5382ed){if(_0x5382ed){return _0x5382ed[_0x488d('0x20')]()['then'](function(_0x26363c){return _0x26363c;});}})[_0x488d('0x21')](function(_0x21134f){_0x1f52c8=_0x21134f;if(_0x21134f){if(_0x21134f['VoiceQueueId']||_0x21134f[_0x488d('0x56')]){return db[_0x21134f[_0x488d('0x57')]?_0x488d('0x58'):'Campaign'][_0x488d('0x52')]({'where':{'id':_0x21134f[_0x488d('0x57')]?_0x21134f['VoiceQueueId']:_0x21134f[_0x488d('0x56')]},'attributes':['id',_0x488d('0x23')],'raw':!![]});}}})[_0x488d('0x21')](function(_0x4706fe){var _0x434e20={};if(_0x4706fe){_[_0x488d('0x48')](_0x434e20,_[_0x488d('0x59')](_0x1f52c8[_0x488d('0x5a')],['createdAt',_0x488d('0x5b'),'id']));_0x434e20[_0x488d('0x5c')]=0x15;_0x434e20[_0x488d('0x5d')]=_0x488d('0x5e');_0x434e20['campaign']=_0x4706fe[_0x488d('0x23')];_0x434e20[_0x488d('0x5f')]=_0x19533f['user'][_0x488d('0x23')];_0x434e20[_0x488d('0x60')]=_0x19533f[_0x488d('0x61')]['id'];_0x434e20['deleted']=!![];_0x434e20['deletedat']=moment()[_0x488d('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x434e20['calleridnum']=_0x1f52c8[_0x488d('0x63')];_0x434e20[_0x488d('0x64')]=_0x1f52c8[_0x488d('0x57')]?'queue':'ivr';return db[_0x488d('0x65')][_0x488d('0x52')]({'where':{'id':_0x434e20['ContactId']},'attributes':[_0x488d('0x66'),_0x488d('0x67')]})['then'](function(_0x431750){if(!_[_0x488d('0x68')](_0x1795b7)&&!_['isNil'](_0x431750['firstName'])){_0x434e20[_0x488d('0x69')]=_0x431750[_0x488d('0x66')];if(!_['isNil'](_0x431750[_0x488d('0x67')])){_0x434e20[_0x488d('0x69')]+='\x20'+_0x431750[_0x488d('0x67')];}}})['finally'](function(){return db['CmHopperFinal'][_0x488d('0x53')](_0x434e20);});}})[_0x488d('0x21')](function(){return _0x1795b7[_0x488d('0x17')](0xcc)[_0x488d('0x18')]();})[_0x488d('0x4e')](handleError(_0x1795b7,null));};exports[_0x488d('0x6a')]=function(_0x24ae31,_0x5a9e5e,_0x34f526){var _0x6509cb=[];return db[_0x488d('0x65')][_0x488d('0x55')]()[_0x488d('0x21')](function(_0x57fadb){_0x6509cb=_['keys'](_0x57fadb);return _0x24ae31[_0x488d('0x61')][_0x488d('0x6b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x48b46f){if(_0x48b46f&&_0x48b46f[_0x488d('0x42')]){return db['sequelize']['transaction'](function(_0x5b2ce6){var _0x338388={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x488d('0x62')](_0x488d('0x6c'))},'VoiceQueueId':{'$in':_[_0x488d('0x2b')](_0x48b46f,'id')},'$or':[{'UserId':null},{'UserId':_0x24ae31['user']['id']}]};var _0x368b1b=[];if(_0x24ae31[_0x488d('0x54')][_0x488d('0x6d')]&&_0x24ae31[_0x488d('0x54')][_0x488d('0x6d')]===_0x488d('0x6e')){if(!_[_0x488d('0x6f')](_0x24ae31[_0x488d('0x54')][_0x488d('0x70')])){_0x338388['id']={'$in':_0x24ae31[_0x488d('0x54')][_0x488d('0x70')]};}_0x368b1b=[[_0x488d('0x71'),_0x488d('0x72')],[_0x488d('0x73'),_0x48b46f[0x0][_0x488d('0x74')]==='ASC'?_0x488d('0x75'):_0x488d('0x72')],db[_0x488d('0x76')][_0x488d('0x77')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x488d('0x75')]];}else{if(!_[_0x488d('0x6f')](_0x24ae31[_0x488d('0x54')][_0x488d('0x70')])){_0x338388['id']={'$notIn':_0x24ae31[_0x488d('0x54')][_0x488d('0x70')]};}_0x368b1b=[['priority','DESC'],[_0x488d('0x73'),_0x48b46f[0x0][_0x488d('0x74')]],db['sequelize'][_0x488d('0x77')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x488d('0x72')]];}return db[_0x488d('0x25')][_0x488d('0x78')]({'attributes':['id',_0x488d('0x79')],'where':_0x338388,'order':_0x368b1b,'transaction':_0x5b2ce6,'lock':_0x5b2ce6[_0x488d('0x7a')]['UPDATE'],'include':[{'model':db[_0x488d('0x65')],'as':_0x488d('0x7b'),'attributes':_0x6509cb,'include':[{'model':db[_0x488d('0x7c')],'as':'Company','attributes':['id',_0x488d('0x23')]}]},{'model':db[_0x488d('0x7d')],'as':_0x488d('0x7e'),'attributes':['id',_0x488d('0x23')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name','dialActive']}]})[_0x488d('0x21')](function(_0x3cf65b){if(_0x3cf65b){return _0x3cf65b[_0x488d('0x1f')]({'UserId':_0x24ae31[_0x488d('0x61')]['id']},{'transaction':_0x5b2ce6});}});});}})[_0x488d('0x21')](handleEntityNotFound(_0x5a9e5e,null))['then'](respondWithResult(_0x5a9e5e,null))[_0x488d('0x4e')](handleError(_0x5a9e5e,null));};exports[_0x488d('0x7f')]=function(_0x369b4d,_0x5d09fb,_0x3e830e){return _0x369b4d['user'][_0x488d('0x6b')]({'where':{'type':_0x488d('0x80'),'dialActive':!![],'dialMethod':_0x488d('0x81')},'attributes':['id'],'raw':!![]})[_0x488d('0x21')](function(_0x3dc5d3){if(_0x3dc5d3&&_0x3dc5d3[_0x488d('0x42')]){return db[_0x488d('0x25')][_0x488d('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x488d('0x62')](_0x488d('0x6c'))},'VoiceQueueId':{'$in':_[_0x488d('0x2b')](_0x3dc5d3,'id')},'$or':[{'UserId':null},{'UserId':_0x369b4d[_0x488d('0x61')]['id']}]}});}return 0x0;})[_0x488d('0x21')](function(_0x19ccbc){if(!_['isNil'](_0x19ccbc)&&_[_0x488d('0x82')](_0x19ccbc)){return _0x5d09fb[_0x488d('0x17')](0xc8)['json']({'contacts':_0x19ccbc});}else{logger[_0x488d('0x22')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x488d('0x7f'),0x194,_0x488d('0x83'));_0x5d09fb[_0x488d('0x16')](0x194);}})[_0x488d('0x4e')](handleError(_0x5d09fb,null));}; \ No newline at end of file +var _0x0a4a=['$gt','$gte','$ne','$eq','$not','$like','$iLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','keys','create','body','find','params','describe','VoiceQueue','Campaign','VoiceQueueId','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','firstName','lastName','isNil','calleridname','finally','CmContact','getVoiceQueues','preview','dialOrderByScheduledAt','direction','prev','isEmpty','hopperIds','priority','ASC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','Company','CmList','List','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','index','map','CmHopper','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','concat','$and','$or'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0x0a4a,0xe7));var _0xa0a4=function(_0x3f7ebc,_0x291344){_0x3f7ebc=_0x3f7ebc-0x0;var _0x319c10=_0x0a4a[_0x3f7ebc];return _0x319c10;};'use strict';var emlformat=require(_0xa0a4('0x0'));var rimraf=require(_0xa0a4('0x1'));var zipdir=require(_0xa0a4('0x2'));var jsonpatch=require(_0xa0a4('0x3'));var rp=require(_0xa0a4('0x4'));var moment=require(_0xa0a4('0x5'));var BPromise=require(_0xa0a4('0x6'));var Mustache=require(_0xa0a4('0x7'));var util=require(_0xa0a4('0x8'));var path=require(_0xa0a4('0x9'));var sox=require(_0xa0a4('0xa'));var csv=require('to-csv');var ejs=require(_0xa0a4('0xb'));var fs=require('fs');var fs_extra=require(_0xa0a4('0xc'));var _=require('lodash');var squel=require(_0xa0a4('0xd'));var crypto=require(_0xa0a4('0xe'));var jsforce=require(_0xa0a4('0xf'));var deskjs=require(_0xa0a4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa0a4('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa0a4('0x12'));var qs=require(_0xa0a4('0x13'));var as=require(_0xa0a4('0x14'));var hardwareService=require(_0xa0a4('0x15'));var logger=require('../../config/logger')(_0xa0a4('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa0a4('0x17'));var db=require(_0xa0a4('0x18'))['db'];function respondWithStatusCode(_0x51d8d4,_0x25212f){_0x25212f=_0x25212f||0xcc;return function(_0x163ae9){if(_0x163ae9){return _0x51d8d4['sendStatus'](_0x25212f);}return _0x51d8d4[_0xa0a4('0x19')](_0x25212f)[_0xa0a4('0x1a')]();};}function respondWithResult(_0x452517,_0x2e6fe2){_0x2e6fe2=_0x2e6fe2||0xc8;return function(_0x274760){if(_0x274760){return _0x452517[_0xa0a4('0x19')](_0x2e6fe2)[_0xa0a4('0x1b')](_0x274760);}};}function respondWithFilteredResult(_0x1ee399,_0x2a9a12){return function(_0x1a6373){if(_0x1a6373){var _0x62094e=typeof _0x2a9a12[_0xa0a4('0x1c')]==='undefined'&&typeof _0x2a9a12['limit']==='undefined';var _0x5a21a0=_0x1a6373[_0xa0a4('0x1d')];var _0x589ca2=_0x62094e?0x0:_0x2a9a12[_0xa0a4('0x1c')];var _0x529dfb=_0x62094e?_0x1a6373['count']:_0x2a9a12[_0xa0a4('0x1c')]+_0x2a9a12[_0xa0a4('0x1e')];var _0x21c480;if(_0x529dfb>=_0x5a21a0){_0x529dfb=_0x5a21a0;_0x21c480=0xc8;}else{_0x21c480=0xce;}_0x1ee399[_0xa0a4('0x19')](_0x21c480);return _0x1ee399[_0xa0a4('0x1f')]('Content-Range',_0x589ca2+'-'+_0x529dfb+'/'+_0x5a21a0)['json'](_0x1a6373);}return null;};}function patchUpdates(_0x13d8e9){return function(_0x4c67a3){try{jsonpatch[_0xa0a4('0x20')](_0x4c67a3,_0x13d8e9,!![]);}catch(_0x59defc){return BPromise['reject'](_0x59defc);}return _0x4c67a3[_0xa0a4('0x21')]();};}function saveUpdates(_0xb28916,_0x56b944){return function(_0xcc4d59){if(_0xcc4d59){return _0xcc4d59[_0xa0a4('0x22')](_0xb28916)[_0xa0a4('0x23')](function(_0x23621e){return _0x23621e;});}return null;};}function removeEntity(_0x10dd1b,_0x52903c){return function(_0x41856e){if(_0x41856e){return _0x41856e[_0xa0a4('0x24')]()[_0xa0a4('0x23')](function(){_0x10dd1b[_0xa0a4('0x19')](0xcc)[_0xa0a4('0x1a')]();});}};}function handleEntityNotFound(_0x4ac37f,_0x43f3fe){return function(_0x4e8082){if(!_0x4e8082){_0x4ac37f[_0xa0a4('0x25')](0x194);}return _0x4e8082;};}function handleError(_0x1901a3,_0x5bdb89){_0x5bdb89=_0x5bdb89||0x1f4;return function(_0x2fe20e){logger[_0xa0a4('0x26')](_0x2fe20e[_0xa0a4('0x27')]);if(_0x2fe20e['name']){delete _0x2fe20e['name'];}_0x1901a3['status'](_0x5bdb89)['send'](_0x2fe20e);};}exports[_0xa0a4('0x28')]=function(_0x2d62fa,_0x4b2d61){var _0x629156={},_0x565f1d={},_0x5f2443={'count':0x0,'rows':[]};var _0x5d9633=_[_0xa0a4('0x29')](db[_0xa0a4('0x2a')][_0xa0a4('0x2b')],function(_0x2db1ca){return{'name':_0x2db1ca[_0xa0a4('0x2c')],'type':_0x2db1ca[_0xa0a4('0x2d')][_0xa0a4('0x2e')]};});_0x565f1d['model']=_[_0xa0a4('0x29')](_0x5d9633,_0xa0a4('0x2f'));_0x565f1d[_0xa0a4('0x30')]=_['keys'](_0x2d62fa[_0xa0a4('0x30')]);_0x565f1d[_0xa0a4('0x31')]=_[_0xa0a4('0x32')](_0x565f1d[_0xa0a4('0x33')],_0x565f1d[_0xa0a4('0x30')]);_0x565f1d[_0xa0a4('0x31')]=_[_0xa0a4('0x34')](_0x565f1d[_0xa0a4('0x31')],[_0xa0a4('0x35'),_0xa0a4('0x36'),_0xa0a4('0x37'),_0xa0a4('0x38'),'$lt','$lte',_0xa0a4('0x39'),_0xa0a4('0x3a'),_0xa0a4('0x3b'),'$between','$notBetween','$in','$notIn',_0xa0a4('0x3c'),'$notLike',_0xa0a4('0x3d'),_0xa0a4('0x3e'),'$like','$overlap',_0xa0a4('0x3f'),_0xa0a4('0x40'),_0xa0a4('0x41')]);_0x629156[_0xa0a4('0x42')]=_[_0xa0a4('0x32')](_0x565f1d[_0xa0a4('0x33')],qs[_0xa0a4('0x43')](_0x2d62fa[_0xa0a4('0x30')][_0xa0a4('0x43')]));_0x629156[_0xa0a4('0x42')]=_0x629156[_0xa0a4('0x42')][_0xa0a4('0x44')]?_0x629156[_0xa0a4('0x42')]:_0x565f1d[_0xa0a4('0x33')];if(!_0x2d62fa[_0xa0a4('0x30')][_0xa0a4('0x45')]('nolimit')){_0x629156[_0xa0a4('0x1e')]=qs[_0xa0a4('0x1e')](_0x2d62fa[_0xa0a4('0x30')][_0xa0a4('0x1e')]);_0x629156['offset']=qs['offset'](_0x2d62fa[_0xa0a4('0x30')][_0xa0a4('0x1c')]);}_0x629156[_0xa0a4('0x46')]=qs[_0xa0a4('0x47')](_0x2d62fa[_0xa0a4('0x30')]['sort']);_0x629156[_0xa0a4('0x48')]=qs[_0xa0a4('0x31')](_[_0xa0a4('0x49')](_0x2d62fa[_0xa0a4('0x30')],_0x565f1d[_0xa0a4('0x31')]),_0x5d9633);if(_0x2d62fa['query'][_0xa0a4('0x4a')]){_0x629156['where']=_['merge'](_0x629156[_0xa0a4('0x48')],{'$or':_[_0xa0a4('0x29')](_0x5d9633,function(_0x5853a5){if(_0x5853a5[_0xa0a4('0x2d')]!==_0xa0a4('0x4b')){var _0x2ca583={};_0x2ca583[_0x5853a5['name']]={'$like':'%'+_0x2d62fa[_0xa0a4('0x30')][_0xa0a4('0x4a')]+'%'};return _0x2ca583;}})});}_0x629156=_[_0xa0a4('0x4c')]({},_0x629156,_0x2d62fa['options']);var _0x4f232b={'where':_0x629156[_0xa0a4('0x48')]};return db[_0xa0a4('0x2a')][_0xa0a4('0x1d')](_0x4f232b)[_0xa0a4('0x23')](function(_0x276a0f){_0x5f2443['count']=_0x276a0f;if(_0x2d62fa[_0xa0a4('0x30')][_0xa0a4('0x4d')]){_0x629156[_0xa0a4('0x4e')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x629156);})[_0xa0a4('0x23')](function(_0x156213){_0x5f2443[_0xa0a4('0x4f')]=_0x156213;return _0x5f2443;})[_0xa0a4('0x23')](respondWithFilteredResult(_0x4b2d61,_0x629156))[_0xa0a4('0x50')](handleError(_0x4b2d61,null));};exports[_0xa0a4('0x51')]=function(_0x4a267d,_0x57128f){var _0x51c18b={'raw':!![],'where':{'id':_0x4a267d['params']['id']}},_0x53d0a2={};_0x53d0a2[_0xa0a4('0x33')]=_['keys'](db[_0xa0a4('0x2a')]['rawAttributes']);_0x53d0a2[_0xa0a4('0x30')]=_[_0xa0a4('0x52')](_0x4a267d[_0xa0a4('0x30')]);_0x53d0a2['filters']=_[_0xa0a4('0x32')](_0x53d0a2[_0xa0a4('0x33')],_0x53d0a2[_0xa0a4('0x30')]);_0x51c18b[_0xa0a4('0x42')]=_[_0xa0a4('0x32')](_0x53d0a2[_0xa0a4('0x33')],qs[_0xa0a4('0x43')](_0x4a267d[_0xa0a4('0x30')]['fields']));_0x51c18b[_0xa0a4('0x42')]=_0x51c18b[_0xa0a4('0x42')]['length']?_0x51c18b['attributes']:_0x53d0a2[_0xa0a4('0x33')];if(_0x4a267d[_0xa0a4('0x30')][_0xa0a4('0x4d')]){_0x51c18b[_0xa0a4('0x4e')]=[{'all':!![]}];}_0x51c18b=_[_0xa0a4('0x4c')]({},_0x51c18b,_0x4a267d['options']);return db['CmHopper']['find'](_0x51c18b)['then'](handleEntityNotFound(_0x57128f,null))[_0xa0a4('0x23')](respondWithResult(_0x57128f,null))['catch'](handleError(_0x57128f,null));};exports[_0xa0a4('0x53')]=function(_0x1d3f1d,_0x335089){return db[_0xa0a4('0x2a')][_0xa0a4('0x53')](_0x1d3f1d[_0xa0a4('0x54')],{})[_0xa0a4('0x23')](respondWithResult(_0x335089,0xc9))[_0xa0a4('0x50')](handleError(_0x335089,null));};exports[_0xa0a4('0x22')]=function(_0x3a661f,_0x4ebeab){if(_0x3a661f[_0xa0a4('0x54')]['id']){delete _0x3a661f['body']['id'];}return db['CmHopper'][_0xa0a4('0x55')]({'where':{'id':_0x3a661f[_0xa0a4('0x56')]['id']}})[_0xa0a4('0x23')](handleEntityNotFound(_0x4ebeab,null))[_0xa0a4('0x23')](saveUpdates(_0x3a661f['body'],null))[_0xa0a4('0x23')](respondWithResult(_0x4ebeab,null))[_0xa0a4('0x50')](handleError(_0x4ebeab,null));};exports['describe']=function(_0x1831c5,_0x3e738b){return db[_0xa0a4('0x2a')][_0xa0a4('0x57')]()[_0xa0a4('0x23')](respondWithResult(_0x3e738b,null))[_0xa0a4('0x50')](handleError(_0x3e738b,null));};exports[_0xa0a4('0x24')]=function(_0xc4a1ee,_0x2de8ac){var _0x42b01d;return db[_0xa0a4('0x2a')][_0xa0a4('0x55')]({'where':{'id':_0xc4a1ee['params']['id']}})['then'](handleEntityNotFound(_0x2de8ac,null))['then'](function(_0x50c031){if(_0x50c031){return _0x50c031[_0xa0a4('0x24')]()[_0xa0a4('0x23')](function(_0x4e7ff2){return _0x4e7ff2;});}})[_0xa0a4('0x23')](function(_0x524a37){_0x42b01d=_0x524a37;if(_0x524a37){if(_0x524a37['VoiceQueueId']||_0x524a37['CampaignId']){return db[_0x524a37['VoiceQueueId']?_0xa0a4('0x58'):_0xa0a4('0x59')][_0xa0a4('0x55')]({'where':{'id':_0x524a37[_0xa0a4('0x5a')]?_0x524a37[_0xa0a4('0x5a')]:_0x524a37[_0xa0a4('0x5b')]},'attributes':['id',_0xa0a4('0x2f')],'raw':!![]});}}})['then'](function(_0x16c975){var _0x305eb3={};if(_0x16c975){_[_0xa0a4('0x4c')](_0x305eb3,_[_0xa0a4('0x5c')](_0x42b01d[_0xa0a4('0x5d')],[_0xa0a4('0x5e'),_0xa0a4('0x5f'),'id']));_0x305eb3[_0xa0a4('0x60')]=0x15;_0x305eb3[_0xa0a4('0x61')]=_0xa0a4('0x62');_0x305eb3['campaign']=_0x16c975['name'];_0x305eb3[_0xa0a4('0x63')]=_0xc4a1ee[_0xa0a4('0x64')][_0xa0a4('0x2f')];_0x305eb3[_0xa0a4('0x65')]=_0xc4a1ee[_0xa0a4('0x64')]['id'];_0x305eb3[_0xa0a4('0x62')]=!![];_0x305eb3[_0xa0a4('0x66')]=moment()[_0xa0a4('0x67')](_0xa0a4('0x68'));_0x305eb3[_0xa0a4('0x69')]=_0x42b01d[_0xa0a4('0x6a')];_0x305eb3[_0xa0a4('0x6b')]=_0x42b01d[_0xa0a4('0x5a')]?_0xa0a4('0x6c'):_0xa0a4('0x6d');return db['CmContact']['find']({'where':{'id':_0x305eb3['ContactId']},'attributes':[_0xa0a4('0x6e'),_0xa0a4('0x6f')]})[_0xa0a4('0x23')](function(_0x2717b9){if(!_[_0xa0a4('0x70')](_0x2de8ac)&&!_[_0xa0a4('0x70')](_0x2717b9['firstName'])){_0x305eb3[_0xa0a4('0x71')]=_0x2717b9[_0xa0a4('0x6e')];if(!_[_0xa0a4('0x70')](_0x2717b9[_0xa0a4('0x6f')])){_0x305eb3[_0xa0a4('0x71')]+='\x20'+_0x2717b9[_0xa0a4('0x6f')];}}})[_0xa0a4('0x72')](function(){return db['CmHopperFinal'][_0xa0a4('0x53')](_0x305eb3);});}})[_0xa0a4('0x23')](function(){return _0x2de8ac['status'](0xcc)[_0xa0a4('0x1a')]();})['catch'](handleError(_0x2de8ac,null));};exports['getPreview']=function(_0x1cd0b2,_0x46fac5,_0x506ae3){var _0xae2ff0=[];return db[_0xa0a4('0x73')][_0xa0a4('0x57')]()['then'](function(_0x8e2a07){_0xae2ff0=_[_0xa0a4('0x52')](_0x8e2a07);return _0x1cd0b2[_0xa0a4('0x64')][_0xa0a4('0x74')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa0a4('0x75')},'attributes':['id',_0xa0a4('0x76')],'raw':!![]});})[_0xa0a4('0x23')](function(_0x115f31){if(_0x115f31&&_0x115f31[_0xa0a4('0x44')]){return db['sequelize']['transaction'](function(_0x25959c){var _0x40269a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa0a4('0x67')](_0xa0a4('0x68'))},'VoiceQueueId':{'$in':_[_0xa0a4('0x29')](_0x115f31,'id')},'$or':[{'UserId':null},{'UserId':_0x1cd0b2[_0xa0a4('0x64')]['id']}]};var _0x260676=[];if(_0x1cd0b2[_0xa0a4('0x54')]['direction']&&_0x1cd0b2['body'][_0xa0a4('0x77')]===_0xa0a4('0x78')){if(!_[_0xa0a4('0x79')](_0x1cd0b2[_0xa0a4('0x54')]['hopperIds'])){_0x40269a['id']={'$in':_0x1cd0b2[_0xa0a4('0x54')][_0xa0a4('0x7a')]};}_0x260676=[[_0xa0a4('0x7b'),_0xa0a4('0x7c')],['scheduledAt',_0x115f31[0x0][_0xa0a4('0x76')]==='ASC'?'DESC':_0xa0a4('0x7c')],db[_0xa0a4('0x7d')]['literal'](_0xa0a4('0x7e')),['id',_0xa0a4('0x7f')]];}else{if(!_[_0xa0a4('0x79')](_0x1cd0b2[_0xa0a4('0x54')]['hopperIds'])){_0x40269a['id']={'$notIn':_0x1cd0b2[_0xa0a4('0x54')][_0xa0a4('0x7a')]};}_0x260676=[[_0xa0a4('0x7b'),_0xa0a4('0x7f')],[_0xa0a4('0x80'),_0x115f31[0x0]['dialOrderByScheduledAt']],db[_0xa0a4('0x7d')][_0xa0a4('0x81')](_0xa0a4('0x82')),['id',_0xa0a4('0x7c')]];}return db[_0xa0a4('0x2a')][_0xa0a4('0x83')]({'attributes':['id',_0xa0a4('0x84')],'where':_0x40269a,'order':_0x260676,'transaction':_0x25959c,'lock':_0x25959c[_0xa0a4('0x85')]['UPDATE'],'include':[{'model':db[_0xa0a4('0x73')],'as':_0xa0a4('0x86'),'attributes':_0xae2ff0,'include':[{'model':db['CmCompany'],'as':_0xa0a4('0x87'),'attributes':['id',_0xa0a4('0x2f')]}]},{'model':db[_0xa0a4('0x88')],'as':_0xa0a4('0x89'),'attributes':['id','name']},{'model':db[_0xa0a4('0x58')],'as':_0xa0a4('0x8a'),'attributes':['id',_0xa0a4('0x2f'),'dialActive']}]})['then'](function(_0xb0bcfe){if(_0xb0bcfe){return _0xb0bcfe['update']({'UserId':_0x1cd0b2[_0xa0a4('0x64')]['id']},{'transaction':_0x25959c});}});});}})[_0xa0a4('0x23')](handleEntityNotFound(_0x46fac5,null))[_0xa0a4('0x23')](respondWithResult(_0x46fac5,null))[_0xa0a4('0x50')](handleError(_0x46fac5,null));};exports[_0xa0a4('0x8b')]=function(_0x6068fb,_0x38414f,_0xb95db0){return _0x6068fb[_0xa0a4('0x64')][_0xa0a4('0x74')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa0a4('0x75')},'attributes':['id'],'raw':!![]})['then'](function(_0x178b43){if(_0x178b43&&_0x178b43[_0xa0a4('0x44')]){return db[_0xa0a4('0x2a')][_0xa0a4('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa0a4('0x67')](_0xa0a4('0x68'))},'VoiceQueueId':{'$in':_[_0xa0a4('0x29')](_0x178b43,'id')},'$or':[{'UserId':null},{'UserId':_0x6068fb['user']['id']}]}});}return 0x0;})[_0xa0a4('0x23')](function(_0x5781ee){if(!_[_0xa0a4('0x70')](_0x5781ee)&&_[_0xa0a4('0x8c')](_0x5781ee)){return _0x38414f['status'](0xc8)[_0xa0a4('0x1b')]({'contacts':_0x5781ee});}else{logger['error'](_0xa0a4('0x8d'),_0xa0a4('0x8b'),0x194,_0xa0a4('0x8e'));_0x38414f[_0xa0a4('0x25')](0x194);}})[_0xa0a4('0x50')](handleError(_0x38414f,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 682cccd..662b1cb 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 _0x1967=['scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x1967,0x173));var _0x7196=function(_0x5c16e3,_0x55e49a){_0x5c16e3=_0x5c16e3-0x0;var _0x29f670=_0x1967[_0x5c16e3];return _0x29f670;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['scheduledat']},{'name':_0x7196('0xe'),'fields':[_0x7196('0xe')]},{'name':_0x7196('0xf'),'fields':[_0x7196('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda19=['define','CmHopper','cm_hopper','scheduledat','priority','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xda19,0xd5));var _0x9da1=function(_0x542dcf,_0x3c67a0){_0x542dcf=_0x542dcf-0x0;var _0x2cf9ad=_0xda19[_0x542dcf];return _0x2cf9ad;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[{'name':_0x9da1('0xb'),'fields':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0x9da1('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index d80c83b..153a182 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 _0xbc91=['transaction','order','LOCK','UPDATE','CmContact','Contact','keys','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer','MoveContactManagedDialer','CountReScheduled','COUNT','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','describe','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopper','ShowCmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','sequelize'];(function(_0xfc85be,_0xf31ba5){var _0x41e301=function(_0x3c2cda){while(--_0x3c2cda){_0xfc85be['push'](_0xfc85be['shift']());}};_0x41e301(++_0xf31ba5);}(_0xbc91,0x173));var _0x1bc9=function(_0x3cf228,_0x1c5598){_0x3cf228=_0x3cf228-0x0;var _0x4888d2=_0xbc91[_0x3cf228];return _0x4888d2;};'use strict';var _=require(_0x1bc9('0x0'));var util=require(_0x1bc9('0x1'));var moment=require(_0x1bc9('0x2'));var BPromise=require(_0x1bc9('0x3'));var rs=require(_0x1bc9('0x4'));var fs=require('fs');var Redis=require(_0x1bc9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1bc9('0x6'))(_0x1bc9('0x7'));var config=require('../../config/environment');var jayson=require(_0x1bc9('0x8'));var client=jayson[_0x1bc9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2afebc,_0x3ddfff,_0x1e776e){return new BPromise(function(_0x2efc47,_0x19a277){return client[_0x1bc9('0xa')](_0x2afebc,_0x1e776e)[_0x1bc9('0xb')](function(_0x59a2e5){logger[_0x1bc9('0xc')](_0x1bc9('0xd'),_0x3ddfff,'request\x20sent');logger[_0x1bc9('0xe')](_0x1bc9('0xf'),_0x3ddfff,'request\x20sent',JSON[_0x1bc9('0x10')](_0x59a2e5));if(_0x59a2e5[_0x1bc9('0x11')]){if(_0x59a2e5[_0x1bc9('0x11')][_0x1bc9('0x12')]===0x1f4){logger['error'](_0x1bc9('0xd'),_0x3ddfff,_0x59a2e5['error'][_0x1bc9('0x13')]);return _0x19a277(_0x59a2e5[_0x1bc9('0x11')][_0x1bc9('0x13')]);}logger[_0x1bc9('0x11')](_0x1bc9('0xd'),_0x3ddfff,_0x59a2e5[_0x1bc9('0x11')]['message']);return _0x2efc47(_0x59a2e5[_0x1bc9('0x11')][_0x1bc9('0x13')]);}else{logger[_0x1bc9('0xc')](_0x1bc9('0xd'),_0x3ddfff,_0x1bc9('0x14'));_0x2efc47(_0x59a2e5['result']['message']);}})[_0x1bc9('0x15')](function(_0x4f00f8){logger['error'](_0x1bc9('0xd'),_0x3ddfff,_0x4f00f8);_0x19a277(_0x4f00f8);});});}exports['GetCmHopper']=function(_0x2d1691){var _0x53f033=this;return new Promise(function(_0x233bcb,_0x3e046b){return db[_0x1bc9('0x16')][_0x1bc9('0x17')]({'raw':_0x2d1691[_0x1bc9('0x18')]?_0x2d1691[_0x1bc9('0x18')][_0x1bc9('0x19')]===undefined?!![]:![]:!![],'where':_0x2d1691[_0x1bc9('0x18')]?_0x2d1691['options'][_0x1bc9('0x1a')]||null:null,'attributes':_0x2d1691[_0x1bc9('0x18')]?_0x2d1691[_0x1bc9('0x18')][_0x1bc9('0x1b')]||null:null,'limit':_0x2d1691[_0x1bc9('0x18')]?_0x2d1691[_0x1bc9('0x18')][_0x1bc9('0x1c')]||null:null,'include':_0x2d1691[_0x1bc9('0x18')]?_0x2d1691[_0x1bc9('0x18')][_0x1bc9('0x1d')]?_['map'](_0x2d1691[_0x1bc9('0x18')]['include'],function(_0x2c3a1a){return{'model':db[_0x2c3a1a['model']],'as':_0x2c3a1a['as'],'attributes':_0x2c3a1a['attributes'],'include':_0x2c3a1a[_0x1bc9('0x1d')]?_[_0x1bc9('0x1e')](_0x2c3a1a[_0x1bc9('0x1d')],function(_0x10fdc7){return{'model':db[_0x10fdc7[_0x1bc9('0x1f')]],'as':_0x10fdc7['as'],'attributes':_0x10fdc7[_0x1bc9('0x1b')],'include':_0x10fdc7[_0x1bc9('0x1d')]?_[_0x1bc9('0x1e')](_0x10fdc7[_0x1bc9('0x1d')],function(_0x363621){return{'model':db[_0x363621[_0x1bc9('0x1f')]],'as':_0x363621['as'],'attributes':_0x363621[_0x1bc9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1bc9('0xb')](function(_0x12c6d5){logger['info'](_0x1bc9('0x20'),_0x2d1691);logger[_0x1bc9('0xe')](_0x1bc9('0x20'),_0x2d1691,JSON['stringify'](_0x12c6d5));_0x233bcb(_0x12c6d5);})[_0x1bc9('0x15')](function(_0x31dfb7){logger[_0x1bc9('0x11')]('GetCmHopper',_0x31dfb7[_0x1bc9('0x13')],_0x2d1691);_0x3e046b(_0x53f033['error'](0x1f4,_0x31dfb7[_0x1bc9('0x13')]));});});};exports[_0x1bc9('0x21')]=function(_0x4b39f7){var _0x369e19=this;return new Promise(function(_0x46857f,_0xfe5b7a){return db['CmHopper'][_0x1bc9('0x22')]({'raw':_0x4b39f7[_0x1bc9('0x18')]?_0x4b39f7[_0x1bc9('0x18')][_0x1bc9('0x19')]===undefined?!![]:![]:!![],'where':_0x4b39f7[_0x1bc9('0x18')]?_0x4b39f7[_0x1bc9('0x18')][_0x1bc9('0x1a')]||null:null,'attributes':_0x4b39f7[_0x1bc9('0x18')]?_0x4b39f7['options'][_0x1bc9('0x1b')]||null:null,'include':_0x4b39f7['options']?_0x4b39f7[_0x1bc9('0x18')]['include']?_[_0x1bc9('0x1e')](_0x4b39f7[_0x1bc9('0x18')][_0x1bc9('0x1d')],function(_0xadceb5){return{'model':db[_0xadceb5['model']],'as':_0xadceb5['as'],'attributes':_0xadceb5[_0x1bc9('0x1b')],'include':_0xadceb5['include']?_[_0x1bc9('0x1e')](_0xadceb5[_0x1bc9('0x1d')],function(_0x19a720){return{'model':db[_0x19a720[_0x1bc9('0x1f')]],'as':_0x19a720['as'],'attributes':_0x19a720['attributes'],'include':_0x19a720[_0x1bc9('0x1d')]?_[_0x1bc9('0x1e')](_0x19a720[_0x1bc9('0x1d')],function(_0x570ad1){return{'model':db[_0x570ad1[_0x1bc9('0x1f')]],'as':_0x570ad1['as'],'attributes':_0x570ad1[_0x1bc9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1bc9('0xb')](function(_0xc68ded){logger['info']('ShowCmHopper',_0x4b39f7);logger[_0x1bc9('0xe')](_0x1bc9('0x21'),_0x4b39f7,JSON[_0x1bc9('0x10')](_0xc68ded));_0x46857f(_0xc68ded);})['catch'](function(_0x540f4c){logger['error']('ShowCmHopper',_0x540f4c[_0x1bc9('0x13')],_0x4b39f7);_0xfe5b7a(_0x369e19[_0x1bc9('0x11')](0x1f4,_0x540f4c['message']));});});};exports['CreateCmHopper']=function(_0x5a73da){var _0x585344=this;return new Promise(function(_0x2ab841,_0x49074f){return db['CmHopper'][_0x1bc9('0x23')](_0x5a73da[_0x1bc9('0x24')],{'raw':_0x5a73da[_0x1bc9('0x18')]?_0x5a73da[_0x1bc9('0x18')][_0x1bc9('0x19')]===undefined?!![]:![]:!![]})[_0x1bc9('0xb')](function(_0x22b7e5){logger[_0x1bc9('0xc')]('CreateCmHopper',_0x5a73da);logger[_0x1bc9('0xe')]('CreateCmHopper',_0x5a73da,JSON[_0x1bc9('0x10')](_0x22b7e5));_0x2ab841(_0x22b7e5);})['catch'](function(_0x51c5ef){logger['error'](_0x1bc9('0x25'),_0x51c5ef[_0x1bc9('0x13')],_0x5a73da);_0x49074f(_0x585344['error'](0x1f4,_0x51c5ef[_0x1bc9('0x13')]));});});};exports[_0x1bc9('0x26')]=function(_0x3ede0e){var _0x435b86=this;return new Promise(function(_0x49b11b,_0x2fb7c2){return db['CmHopper'][_0x1bc9('0x27')](_0x3ede0e[_0x1bc9('0x24')],{'raw':_0x3ede0e['options']?_0x3ede0e[_0x1bc9('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ede0e['options']?_0x3ede0e[_0x1bc9('0x18')][_0x1bc9('0x1a')]||null:null,'attributes':_0x3ede0e[_0x1bc9('0x18')]?_0x3ede0e[_0x1bc9('0x18')]['attributes']||null:null,'limit':_0x3ede0e['options']?_0x3ede0e[_0x1bc9('0x18')][_0x1bc9('0x1c')]||null:null})[_0x1bc9('0xb')](function(_0x4c5200){logger[_0x1bc9('0xc')](_0x1bc9('0x26'),_0x3ede0e);logger['debug']('UpdateCmHopper',_0x3ede0e,JSON['stringify'](_0x4c5200));_0x49b11b(_0x4c5200);})[_0x1bc9('0x15')](function(_0x282269){logger['error'](_0x1bc9('0x26'),_0x282269[_0x1bc9('0x13')],_0x3ede0e);_0x2fb7c2(_0x435b86[_0x1bc9('0x11')](0x1f4,_0x282269[_0x1bc9('0x13')]));});});};exports[_0x1bc9('0x28')]=function(_0x5d9fa3){var _0x4121d5=this;return new Promise(function(_0xac9268,_0xc82ceb){return db[_0x1bc9('0x16')][_0x1bc9('0x29')]({'where':_0x5d9fa3['options']?_0x5d9fa3[_0x1bc9('0x18')][_0x1bc9('0x1a')]||null:null})[_0x1bc9('0xb')](function(_0x2f2d8b){logger[_0x1bc9('0xc')](_0x1bc9('0x28'),_0x5d9fa3);logger['debug'](_0x1bc9('0x28'),_0x5d9fa3,JSON[_0x1bc9('0x10')](_0x2f2d8b));_0xac9268(_0x2f2d8b);})['catch'](function(_0x18073a){logger['error']('DestroyCmHopper',_0x18073a[_0x1bc9('0x13')],_0x5d9fa3);_0xc82ceb(_0x4121d5[_0x1bc9('0x11')](0x1f4,_0x18073a[_0x1bc9('0x13')]));});});};exports['GetContactDialer']=function(_0x288b3c){var _0x4f26c5=this;return new Promise(function(_0x26d917,_0x38be98){return db['CmContact']['describe']()[_0x1bc9('0xb')](function(_0x46b0ca){return db[_0x1bc9('0x2a')][_0x1bc9('0x2b')](function(_0x27d313){return db[_0x1bc9('0x16')][_0x1bc9('0x17')]({'where':_0x288b3c[_0x1bc9('0x18')]?_0x288b3c['options'][_0x1bc9('0x1a')]||null:null,'attributes':_0x288b3c[_0x1bc9('0x18')]?_0x288b3c[_0x1bc9('0x18')]['attributes']||null:null,'limit':_0x288b3c[_0x1bc9('0x18')]?_0x288b3c[_0x1bc9('0x18')][_0x1bc9('0x1c')]||null:null,'order':_0x288b3c[_0x1bc9('0x18')]?_0x288b3c[_0x1bc9('0x18')][_0x1bc9('0x2c')]||null:null,'transaction':_0x27d313,'lock':_0x27d313[_0x1bc9('0x2d')][_0x1bc9('0x2e')],'include':[{'model':db[_0x1bc9('0x2f')],'as':_0x1bc9('0x30'),'attributes':_[_0x1bc9('0x31')](_0x46b0ca)},{'model':db['User'],'as':_0x1bc9('0x32'),'attributes':['id',_0x1bc9('0x33'),_0x1bc9('0x34')]}]})[_0x1bc9('0xb')](function(_0x3d76a2){var _0x291e45=[];var _0x223d71=[];for(var _0x29fb02=0x0;_0x29fb02<_0x3d76a2[_0x1bc9('0x35')];_0x29fb02+=0x1){var _0xbaf9c2=_0x3d76a2[_0x29fb02][_0x1bc9('0x36')];if(_0xbaf9c2===null){_0x291e45[_0x1bc9('0x37')](_0x3d76a2[_0x29fb02][_0x1bc9('0x27')](_0x288b3c[_0x1bc9('0x24')],{'transaction':_0x27d313}));}else if(!_0x223d71[_0x1bc9('0x38')](_0xbaf9c2)){_0x223d71[_0x1bc9('0x37')](_0xbaf9c2);_0x291e45[_0x1bc9('0x37')](_0x3d76a2[_0x29fb02]['update'](_0x288b3c[_0x1bc9('0x24')],{'transaction':_0x27d313}));}}return BPromise[_0x1bc9('0x39')](_0x291e45);});})[_0x1bc9('0xb')](function(_0x411f73){logger['info'](_0x1bc9('0x3a'),_0x288b3c);logger['debug'](_0x1bc9('0x3a'),_0x288b3c,JSON[_0x1bc9('0x10')](_0x411f73));_0x26d917(_0x411f73);})[_0x1bc9('0x15')](function(_0x19de48){logger[_0x1bc9('0x11')](_0x1bc9('0x3a'),_0x19de48[_0x1bc9('0x13')],_0x288b3c);_0x38be98(_0x4f26c5[_0x1bc9('0x11')](0x1f4,_0x19de48['message']));});});});};exports[_0x1bc9('0x3b')]=function(_0x5d2410){var _0x1c6afe=this;return new Promise(function(_0x25c9f3,_0x23a254){return db[_0x1bc9('0x2a')][_0x1bc9('0x2b')](function(_0x2403e3){return db['CmHopperFinal'][_0x1bc9('0x23')](_0x5d2410[_0x1bc9('0x24')],{'raw':_0x5d2410[_0x1bc9('0x18')]?_0x5d2410[_0x1bc9('0x18')][_0x1bc9('0x19')]===undefined?!![]:![]:!![],'transaction':_0x2403e3})[_0x1bc9('0xb')](function(){return db[_0x1bc9('0x16')][_0x1bc9('0x29')]({'where':_0x5d2410[_0x1bc9('0x18')]?_0x5d2410[_0x1bc9('0x18')][_0x1bc9('0x1a')]||null:null,'transaction':_0x2403e3});});})[_0x1bc9('0xb')](function(_0x14f2e2){logger[_0x1bc9('0xc')](_0x1bc9('0x3b'),_0x5d2410);logger[_0x1bc9('0xe')](_0x1bc9('0x3b'),_0x5d2410,JSON['stringify'](_0x14f2e2));_0x25c9f3(_0x14f2e2);})[_0x1bc9('0x15')](function(_0x52febb){logger['error']('MoveContactManagedDialer',_0x52febb[_0x1bc9('0x13')],_0x5d2410);_0x23a254(_0x1c6afe[_0x1bc9('0x11')](0x1f4,_0x52febb[_0x1bc9('0x13')]));});});};exports[_0x1bc9('0x3c')]=function(_0xc13854){var _0x37bb28=this;return new Promise(function(_0x276fcc,_0x3b701f){return db[_0x1bc9('0x16')][_0x1bc9('0x17')]({'raw':_0xc13854['options']?_0xc13854[_0x1bc9('0x18')][_0x1bc9('0x19')]===undefined?!![]:![]:!![],'where':_0xc13854['options']?_0xc13854[_0x1bc9('0x18')]['where']||null:null,'attributes':[[db[_0x1bc9('0x2a')]['fn'](_0x1bc9('0x3d'),db[_0x1bc9('0x2a')]['fn']('IF',db[_0x1bc9('0x2a')]['literal']('`scheduledat`\x20>=\x20'+util['format'](_0x1bc9('0x3e'),moment()[_0x1bc9('0x3f')](_0x1bc9('0x40')))+'\x20,\x201,\x20null'))),_0x1bc9('0x41')]]})[_0x1bc9('0xb')](function(_0x2d8004){logger[_0x1bc9('0xc')]('CountReScheduled',_0xc13854);logger[_0x1bc9('0xe')](_0x1bc9('0x3c'),_0xc13854,JSON[_0x1bc9('0x10')](_0x2d8004));_0x276fcc(_0x2d8004);})[_0x1bc9('0x15')](function(_0x59341a){logger['error'](_0x1bc9('0x3c'),_0x59341a[_0x1bc9('0x13')],_0xc13854);_0x3b701f(_0x37bb28[_0x1bc9('0x11')](0x1f4,_0x59341a[_0x1bc9('0x13')]));});});};exports[_0x1bc9('0x42')]=function(_0x5e465a){var _0x212442=this;return new Promise(function(_0x39a076,_0x412ef7){return db[_0x1bc9('0x2f')][_0x1bc9('0x43')]()[_0x1bc9('0xb')](function(_0x40a875){return db['sequelize'][_0x1bc9('0x2b')](function(_0x20ebe1){return db[_0x1bc9('0x16')][_0x1bc9('0x17')]({'where':_0x5e465a[_0x1bc9('0x18')]?_0x5e465a['options'][_0x1bc9('0x1a')]||null:null,'attributes':_0x5e465a['options']?_0x5e465a[_0x1bc9('0x18')][_0x1bc9('0x1b')]||null:null,'limit':0x1,'order':_0x5e465a[_0x1bc9('0x18')]?_0x5e465a[_0x1bc9('0x18')][_0x1bc9('0x2c')]||null:null,'group':db[_0x1bc9('0x16')][_0x1bc9('0x36')],'transaction':_0x20ebe1,'lock':_0x20ebe1[_0x1bc9('0x2d')][_0x1bc9('0x2e')],'include':_0x5e465a[_0x1bc9('0x18')]?_0x5e465a['options'][_0x1bc9('0x1d')]?_['map'](_0x5e465a[_0x1bc9('0x18')][_0x1bc9('0x1d')],function(_0x46ee7c){return{'model':db[_0x46ee7c['model']],'as':_0x46ee7c['as'],'attributes':_0x46ee7c['attributes'],'include':_0x46ee7c[_0x1bc9('0x1d')]?_[_0x1bc9('0x1e')](_0x46ee7c[_0x1bc9('0x1d')],function(_0x124eaf){return{'model':db[_0x124eaf[_0x1bc9('0x1f')]],'as':_0x124eaf['as'],'attributes':_0x124eaf[_0x1bc9('0x1b')],'include':_0x124eaf['include']?_[_0x1bc9('0x1e')](_0x124eaf['include'],function(_0x1b8c7a){return{'model':db[_0x1b8c7a[_0x1bc9('0x1f')]],'as':_0x1b8c7a['as'],'attributes':_0x1b8c7a[_0x1bc9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1bc9('0xb')](function(_0x29d5ae){var _0x2c2c2e=[];for(var _0x20f5b5=0x0;_0x20f5b5<_0x29d5ae['length'];_0x20f5b5+=0x1){_0x2c2c2e['push'](_0x29d5ae[_0x20f5b5]['update'](_0x5e465a[_0x1bc9('0x24')],{'transaction':_0x20ebe1}));}return BPromise[_0x1bc9('0x39')](_0x2c2c2e);});})[_0x1bc9('0xb')](function(_0x135761){logger['info'](_0x1bc9('0x42'),_0x5e465a);logger[_0x1bc9('0xe')]('GetContactRecallMe',_0x5e465a,JSON[_0x1bc9('0x10')](_0x135761));_0x39a076(_0x135761);})[_0x1bc9('0x15')](function(_0x3d7a5d){logger['error'](_0x1bc9('0x42'),_0x3d7a5d[_0x1bc9('0x13')],_0x5e465a);_0x412ef7(_0x212442[_0x1bc9('0x11')](0x1f4,_0x3d7a5d[_0x1bc9('0x13')]));});});});};exports[_0x1bc9('0x44')]=function(_0x7b86f8){var _0x24e5f0=this;return new Promise(function(_0x13b654,_0x4cc84d){db[_0x1bc9('0x2f')][_0x1bc9('0x43')]()['then'](function(_0x51fa57){return db[_0x1bc9('0x16')][_0x1bc9('0x17')]({'raw':_0x7b86f8[_0x1bc9('0x18')]?_0x7b86f8[_0x1bc9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x7b86f8[_0x1bc9('0x18')]?_0x7b86f8[_0x1bc9('0x18')][_0x1bc9('0x1a')]||null:null,'attributes':_0x7b86f8[_0x1bc9('0x18')]?_0x7b86f8[_0x1bc9('0x18')][_0x1bc9('0x1b')]||null:null,'limit':_0x7b86f8['options']?_0x7b86f8[_0x1bc9('0x18')][_0x1bc9('0x1c')]||null:null,'include':_0x7b86f8[_0x1bc9('0x18')]?_0x7b86f8[_0x1bc9('0x18')][_0x1bc9('0x1d')]?_[_0x1bc9('0x1e')](_0x7b86f8['options'][_0x1bc9('0x1d')],function(_0x59a440){return{'model':db[_0x59a440[_0x1bc9('0x1f')]],'as':_0x59a440['as'],'attributes':_0x59a440['as']==='Contact'?_[_0x1bc9('0x31')](_0x51fa57):_0x59a440[_0x1bc9('0x1b')],'include':_0x59a440['include']?_[_0x1bc9('0x1e')](_0x59a440[_0x1bc9('0x1d')],function(_0x144cdc){return{'model':db[_0x144cdc[_0x1bc9('0x1f')]],'as':_0x144cdc['as'],'attributes':_0x144cdc[_0x1bc9('0x1b')],'include':_0x144cdc['include']?_[_0x1bc9('0x1e')](_0x144cdc['include'],function(_0x579847){return{'model':db[_0x579847[_0x1bc9('0x1f')]],'as':_0x579847['as'],'attributes':_0x579847[_0x1bc9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1bc9('0xb')](function(_0x51352a){logger[_0x1bc9('0xc')](_0x1bc9('0x20'),_0x7b86f8);logger[_0x1bc9('0xe')](_0x1bc9('0x20'),_0x7b86f8,JSON[_0x1bc9('0x10')](_0x51352a));_0x13b654(_0x51352a);})[_0x1bc9('0x15')](function(_0x4e3ab7){logger[_0x1bc9('0x11')]('GetCmHopper',_0x4e3ab7['message'],_0x7b86f8);_0x4cc84d(_0x24e5f0[_0x1bc9('0x11')](0x1f4,_0x4e3ab7[_0x1bc9('0x13')]));});});});}; \ No newline at end of file +var _0x2444=['catch','GetCmHopper','CmHopper','findAll','raw','options','where','attributes','include','model','map','ShowCmHopper','find','CreateCmHopper','create','body','update','limit','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','UserId','push','includes','all','MoveContactManagedDialer','transaction','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','length','GetContactRecallMe','GetCmHopperPreview','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5cfacb,_0x2c1da8){var _0x9c2954=function(_0x7d7659){while(--_0x7d7659){_0x5cfacb['push'](_0x5cfacb['shift']());}};_0x9c2954(++_0x2c1da8);}(_0x2444,0x1a0));var _0x4244=function(_0xddce0e,_0x12c9b4){_0xddce0e=_0xddce0e-0x0;var _0x3de9ff=_0x2444[_0xddce0e];return _0x3de9ff;};'use strict';var _=require(_0x4244('0x0'));var util=require(_0x4244('0x1'));var moment=require(_0x4244('0x2'));var BPromise=require('bluebird');var rs=require(_0x4244('0x3'));var fs=require('fs');var Redis=require(_0x4244('0x4'));var db=require(_0x4244('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4244('0x6'))('rpc');var config=require(_0x4244('0x7'));var jayson=require(_0x4244('0x8'));var client=jayson['client'][_0x4244('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x449b29,_0x2f4302,_0x5ed339){return new BPromise(function(_0x50745c,_0x348acd){return client[_0x4244('0xa')](_0x449b29,_0x5ed339)[_0x4244('0xb')](function(_0x36585a){logger[_0x4244('0xc')](_0x4244('0xd'),_0x2f4302,_0x4244('0xe'));logger[_0x4244('0xf')](_0x4244('0x10'),_0x2f4302,_0x4244('0xe'),JSON[_0x4244('0x11')](_0x36585a));if(_0x36585a['error']){if(_0x36585a[_0x4244('0x12')][_0x4244('0x13')]===0x1f4){logger[_0x4244('0x12')]('CmHopper,\x20%s,\x20%s',_0x2f4302,_0x36585a[_0x4244('0x12')]['message']);return _0x348acd(_0x36585a[_0x4244('0x12')][_0x4244('0x14')]);}logger['error'](_0x4244('0xd'),_0x2f4302,_0x36585a[_0x4244('0x12')][_0x4244('0x14')]);return _0x50745c(_0x36585a['error'][_0x4244('0x14')]);}else{logger[_0x4244('0xc')](_0x4244('0xd'),_0x2f4302,_0x4244('0xe'));_0x50745c(_0x36585a[_0x4244('0x15')]['message']);}})[_0x4244('0x16')](function(_0x1cb4a3){logger[_0x4244('0x12')](_0x4244('0xd'),_0x2f4302,_0x1cb4a3);_0x348acd(_0x1cb4a3);});});}exports[_0x4244('0x17')]=function(_0x2f81d6){var _0x1bfe5a=this;return new Promise(function(_0x3f51a8,_0x513e21){return db[_0x4244('0x18')][_0x4244('0x19')]({'raw':_0x2f81d6['options']?_0x2f81d6['options'][_0x4244('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f81d6['options']?_0x2f81d6[_0x4244('0x1b')][_0x4244('0x1c')]||null:null,'attributes':_0x2f81d6[_0x4244('0x1b')]?_0x2f81d6[_0x4244('0x1b')][_0x4244('0x1d')]||null:null,'limit':_0x2f81d6['options']?_0x2f81d6[_0x4244('0x1b')]['limit']||null:null,'include':_0x2f81d6[_0x4244('0x1b')]?_0x2f81d6[_0x4244('0x1b')][_0x4244('0x1e')]?_['map'](_0x2f81d6[_0x4244('0x1b')][_0x4244('0x1e')],function(_0x3f9b22){return{'model':db[_0x3f9b22[_0x4244('0x1f')]],'as':_0x3f9b22['as'],'attributes':_0x3f9b22[_0x4244('0x1d')],'include':_0x3f9b22[_0x4244('0x1e')]?_[_0x4244('0x20')](_0x3f9b22[_0x4244('0x1e')],function(_0x3583af){return{'model':db[_0x3583af['model']],'as':_0x3583af['as'],'attributes':_0x3583af[_0x4244('0x1d')],'include':_0x3583af[_0x4244('0x1e')]?_[_0x4244('0x20')](_0x3583af[_0x4244('0x1e')],function(_0x5183cf){return{'model':db[_0x5183cf[_0x4244('0x1f')]],'as':_0x5183cf['as'],'attributes':_0x5183cf[_0x4244('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4244('0xb')](function(_0x4ec1c3){logger[_0x4244('0xc')]('GetCmHopper',_0x2f81d6);logger[_0x4244('0xf')](_0x4244('0x17'),_0x2f81d6,JSON[_0x4244('0x11')](_0x4ec1c3));_0x3f51a8(_0x4ec1c3);})[_0x4244('0x16')](function(_0x1ef5eb){logger[_0x4244('0x12')](_0x4244('0x17'),_0x1ef5eb[_0x4244('0x14')],_0x2f81d6);_0x513e21(_0x1bfe5a[_0x4244('0x12')](0x1f4,_0x1ef5eb[_0x4244('0x14')]));});});};exports[_0x4244('0x21')]=function(_0x32f7d5){var _0x586a22=this;return new Promise(function(_0x275c9f,_0x12f9e7){return db['CmHopper'][_0x4244('0x22')]({'raw':_0x32f7d5[_0x4244('0x1b')]?_0x32f7d5[_0x4244('0x1b')][_0x4244('0x1a')]===undefined?!![]:![]:!![],'where':_0x32f7d5['options']?_0x32f7d5[_0x4244('0x1b')][_0x4244('0x1c')]||null:null,'attributes':_0x32f7d5[_0x4244('0x1b')]?_0x32f7d5[_0x4244('0x1b')][_0x4244('0x1d')]||null:null,'include':_0x32f7d5[_0x4244('0x1b')]?_0x32f7d5['options'][_0x4244('0x1e')]?_[_0x4244('0x20')](_0x32f7d5[_0x4244('0x1b')][_0x4244('0x1e')],function(_0x3c3582){return{'model':db[_0x3c3582[_0x4244('0x1f')]],'as':_0x3c3582['as'],'attributes':_0x3c3582[_0x4244('0x1d')],'include':_0x3c3582[_0x4244('0x1e')]?_[_0x4244('0x20')](_0x3c3582['include'],function(_0x257d49){return{'model':db[_0x257d49['model']],'as':_0x257d49['as'],'attributes':_0x257d49['attributes'],'include':_0x257d49[_0x4244('0x1e')]?_[_0x4244('0x20')](_0x257d49['include'],function(_0x28da35){return{'model':db[_0x28da35[_0x4244('0x1f')]],'as':_0x28da35['as'],'attributes':_0x28da35['attributes']};}):[]};}):[]};}):[]:[]})[_0x4244('0xb')](function(_0x5d0cd8){logger[_0x4244('0xc')]('ShowCmHopper',_0x32f7d5);logger[_0x4244('0xf')](_0x4244('0x21'),_0x32f7d5,JSON[_0x4244('0x11')](_0x5d0cd8));_0x275c9f(_0x5d0cd8);})[_0x4244('0x16')](function(_0x227021){logger[_0x4244('0x12')](_0x4244('0x21'),_0x227021[_0x4244('0x14')],_0x32f7d5);_0x12f9e7(_0x586a22[_0x4244('0x12')](0x1f4,_0x227021['message']));});});};exports[_0x4244('0x23')]=function(_0x230b2d){var _0x56e48f=this;return new Promise(function(_0x30425a,_0x32e2a0){return db['CmHopper'][_0x4244('0x24')](_0x230b2d[_0x4244('0x25')],{'raw':_0x230b2d[_0x4244('0x1b')]?_0x230b2d['options'][_0x4244('0x1a')]===undefined?!![]:![]:!![]})[_0x4244('0xb')](function(_0x2fa759){logger[_0x4244('0xc')](_0x4244('0x23'),_0x230b2d);logger['debug'](_0x4244('0x23'),_0x230b2d,JSON[_0x4244('0x11')](_0x2fa759));_0x30425a(_0x2fa759);})[_0x4244('0x16')](function(_0xd54542){logger[_0x4244('0x12')](_0x4244('0x23'),_0xd54542[_0x4244('0x14')],_0x230b2d);_0x32e2a0(_0x56e48f['error'](0x1f4,_0xd54542[_0x4244('0x14')]));});});};exports['UpdateCmHopper']=function(_0x27193d){var _0x3762cd=this;return new Promise(function(_0x22d3ae,_0x3b5d50){return db[_0x4244('0x18')][_0x4244('0x26')](_0x27193d[_0x4244('0x25')],{'raw':_0x27193d[_0x4244('0x1b')]?_0x27193d[_0x4244('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27193d['options']?_0x27193d[_0x4244('0x1b')][_0x4244('0x1c')]||null:null,'attributes':_0x27193d[_0x4244('0x1b')]?_0x27193d[_0x4244('0x1b')][_0x4244('0x1d')]||null:null,'limit':_0x27193d[_0x4244('0x1b')]?_0x27193d['options'][_0x4244('0x27')]||null:null})[_0x4244('0xb')](function(_0x3ef188){logger['info'](_0x4244('0x28'),_0x27193d);logger[_0x4244('0xf')](_0x4244('0x28'),_0x27193d,JSON[_0x4244('0x11')](_0x3ef188));_0x22d3ae(_0x3ef188);})['catch'](function(_0x53c7ba){logger[_0x4244('0x12')](_0x4244('0x28'),_0x53c7ba[_0x4244('0x14')],_0x27193d);_0x3b5d50(_0x3762cd[_0x4244('0x12')](0x1f4,_0x53c7ba[_0x4244('0x14')]));});});};exports[_0x4244('0x29')]=function(_0x25a272){var _0x247859=this;return new Promise(function(_0x8cea9b,_0x2f8dce){return db[_0x4244('0x18')][_0x4244('0x2a')]({'where':_0x25a272[_0x4244('0x1b')]?_0x25a272[_0x4244('0x1b')]['where']||null:null})[_0x4244('0xb')](function(_0x1c9ea7){logger[_0x4244('0xc')](_0x4244('0x29'),_0x25a272);logger[_0x4244('0xf')](_0x4244('0x29'),_0x25a272,JSON[_0x4244('0x11')](_0x1c9ea7));_0x8cea9b(_0x1c9ea7);})[_0x4244('0x16')](function(_0x19d44a){logger[_0x4244('0x12')](_0x4244('0x29'),_0x19d44a['message'],_0x25a272);_0x2f8dce(_0x247859[_0x4244('0x12')](0x1f4,_0x19d44a['message']));});});};exports[_0x4244('0x2b')]=function(_0xd348b7){var _0x73fa31=this;return new Promise(function(_0x60b491,_0x5e7915){return db[_0x4244('0x2c')][_0x4244('0x2d')]()[_0x4244('0xb')](function(_0x5385a7){return db[_0x4244('0x2e')]['transaction'](function(_0x2e0a0e){return db[_0x4244('0x18')][_0x4244('0x19')]({'where':_0xd348b7[_0x4244('0x1b')]?_0xd348b7['options'][_0x4244('0x1c')]||null:null,'attributes':_0xd348b7[_0x4244('0x1b')]?_0xd348b7[_0x4244('0x1b')][_0x4244('0x1d')]||null:null,'limit':_0xd348b7['options']?_0xd348b7[_0x4244('0x1b')][_0x4244('0x27')]||null:null,'order':_0xd348b7[_0x4244('0x1b')]?_0xd348b7[_0x4244('0x1b')][_0x4244('0x2f')]||null:null,'transaction':_0x2e0a0e,'lock':_0x2e0a0e[_0x4244('0x30')][_0x4244('0x31')],'include':[{'model':db[_0x4244('0x2c')],'as':_0x4244('0x32'),'attributes':_[_0x4244('0x33')](_0x5385a7)},{'model':db[_0x4244('0x34')],'as':_0x4244('0x35'),'attributes':['id',_0x4244('0x36'),_0x4244('0x37')]}]})[_0x4244('0xb')](function(_0x2bcf04){var _0x3bcff4=[];var _0x1d9764=[];for(var _0x24087f=0x0;_0x24087f<_0x2bcf04['length'];_0x24087f+=0x1){var _0x124bd9=_0x2bcf04[_0x24087f][_0x4244('0x38')];if(_0x124bd9===null){_0x3bcff4[_0x4244('0x39')](_0x2bcf04[_0x24087f]['update'](_0xd348b7[_0x4244('0x25')],{'transaction':_0x2e0a0e}));}else if(!_0x1d9764[_0x4244('0x3a')](_0x124bd9)){_0x1d9764[_0x4244('0x39')](_0x124bd9);_0x3bcff4[_0x4244('0x39')](_0x2bcf04[_0x24087f][_0x4244('0x26')](_0xd348b7[_0x4244('0x25')],{'transaction':_0x2e0a0e}));}}return BPromise[_0x4244('0x3b')](_0x3bcff4);});})['then'](function(_0x538d2d){logger['info'](_0x4244('0x2b'),_0xd348b7);logger[_0x4244('0xf')](_0x4244('0x2b'),_0xd348b7,JSON[_0x4244('0x11')](_0x538d2d));_0x60b491(_0x538d2d);})[_0x4244('0x16')](function(_0x2cedfc){logger[_0x4244('0x12')](_0x4244('0x2b'),_0x2cedfc[_0x4244('0x14')],_0xd348b7);_0x5e7915(_0x73fa31['error'](0x1f4,_0x2cedfc[_0x4244('0x14')]));});});});};exports[_0x4244('0x3c')]=function(_0x36d697){var _0x3cc5c4=this;return new Promise(function(_0x3670e8,_0x3c883b){return db['sequelize'][_0x4244('0x3d')](function(_0x200f60){return db['CmHopperFinal'][_0x4244('0x24')](_0x36d697[_0x4244('0x25')],{'raw':_0x36d697[_0x4244('0x1b')]?_0x36d697[_0x4244('0x1b')]['raw']===undefined?!![]:![]:!![],'transaction':_0x200f60})[_0x4244('0xb')](function(){return db[_0x4244('0x18')][_0x4244('0x2a')]({'where':_0x36d697['options']?_0x36d697[_0x4244('0x1b')][_0x4244('0x1c')]||null:null,'transaction':_0x200f60});});})[_0x4244('0xb')](function(_0x9b018b){logger[_0x4244('0xc')]('MoveContactManagedDialer',_0x36d697);logger['debug'](_0x4244('0x3c'),_0x36d697,JSON[_0x4244('0x11')](_0x9b018b));_0x3670e8(_0x9b018b);})[_0x4244('0x16')](function(_0x5a7c3b){logger[_0x4244('0x12')](_0x4244('0x3c'),_0x5a7c3b['message'],_0x36d697);_0x3c883b(_0x3cc5c4['error'](0x1f4,_0x5a7c3b['message']));});});};exports[_0x4244('0x3e')]=function(_0x43da9f){var _0x5afb29=this;return new Promise(function(_0x1aa04e,_0x301d78){return db[_0x4244('0x18')]['findAll']({'raw':_0x43da9f[_0x4244('0x1b')]?_0x43da9f[_0x4244('0x1b')][_0x4244('0x1a')]===undefined?!![]:![]:!![],'where':_0x43da9f[_0x4244('0x1b')]?_0x43da9f[_0x4244('0x1b')][_0x4244('0x1c')]||null:null,'attributes':[[db[_0x4244('0x2e')]['fn'](_0x4244('0x3f'),db[_0x4244('0x2e')]['fn']('IF',db[_0x4244('0x2e')][_0x4244('0x40')](_0x4244('0x41')+util[_0x4244('0x42')](_0x4244('0x43'),moment()[_0x4244('0x42')](_0x4244('0x44')))+'\x20,\x201,\x20null'))),_0x4244('0x45')]]})[_0x4244('0xb')](function(_0x41cdda){logger[_0x4244('0xc')](_0x4244('0x3e'),_0x43da9f);logger['debug'](_0x4244('0x3e'),_0x43da9f,JSON[_0x4244('0x11')](_0x41cdda));_0x1aa04e(_0x41cdda);})[_0x4244('0x16')](function(_0x31c20b){logger[_0x4244('0x12')](_0x4244('0x3e'),_0x31c20b[_0x4244('0x14')],_0x43da9f);_0x301d78(_0x5afb29[_0x4244('0x12')](0x1f4,_0x31c20b['message']));});});};exports['GetContactRecallMe']=function(_0x347869){var _0x193121=this;return new Promise(function(_0x548250,_0x3203fa){return db['CmContact'][_0x4244('0x2d')]()[_0x4244('0xb')](function(_0x43708e){return db[_0x4244('0x2e')]['transaction'](function(_0x91fcf1){return db[_0x4244('0x18')][_0x4244('0x19')]({'where':_0x347869['options']?_0x347869[_0x4244('0x1b')]['where']||null:null,'attributes':_0x347869[_0x4244('0x1b')]?_0x347869[_0x4244('0x1b')]['attributes']||null:null,'limit':0x1,'order':_0x347869[_0x4244('0x1b')]?_0x347869[_0x4244('0x1b')][_0x4244('0x2f')]||null:null,'group':db[_0x4244('0x18')][_0x4244('0x38')],'transaction':_0x91fcf1,'lock':_0x91fcf1[_0x4244('0x30')][_0x4244('0x31')],'include':_0x347869[_0x4244('0x1b')]?_0x347869[_0x4244('0x1b')]['include']?_[_0x4244('0x20')](_0x347869['options'][_0x4244('0x1e')],function(_0x4d0bbc){return{'model':db[_0x4d0bbc[_0x4244('0x1f')]],'as':_0x4d0bbc['as'],'attributes':_0x4d0bbc[_0x4244('0x1d')],'include':_0x4d0bbc[_0x4244('0x1e')]?_[_0x4244('0x20')](_0x4d0bbc[_0x4244('0x1e')],function(_0x1ce065){return{'model':db[_0x1ce065[_0x4244('0x1f')]],'as':_0x1ce065['as'],'attributes':_0x1ce065[_0x4244('0x1d')],'include':_0x1ce065[_0x4244('0x1e')]?_[_0x4244('0x20')](_0x1ce065[_0x4244('0x1e')],function(_0x3d528d){return{'model':db[_0x3d528d['model']],'as':_0x3d528d['as'],'attributes':_0x3d528d['attributes']};}):[]};}):[]};}):[]:[]})[_0x4244('0xb')](function(_0x22108a){var _0x34815e=[];for(var _0x2b1fb3=0x0;_0x2b1fb3<_0x22108a[_0x4244('0x46')];_0x2b1fb3+=0x1){_0x34815e['push'](_0x22108a[_0x2b1fb3]['update'](_0x347869[_0x4244('0x25')],{'transaction':_0x91fcf1}));}return BPromise[_0x4244('0x3b')](_0x34815e);});})['then'](function(_0x2295d7){logger[_0x4244('0xc')](_0x4244('0x47'),_0x347869);logger['debug'](_0x4244('0x47'),_0x347869,JSON['stringify'](_0x2295d7));_0x548250(_0x2295d7);})[_0x4244('0x16')](function(_0x4caf0d){logger[_0x4244('0x12')](_0x4244('0x47'),_0x4caf0d[_0x4244('0x14')],_0x347869);_0x3203fa(_0x193121[_0x4244('0x12')](0x1f4,_0x4caf0d['message']));});});});};exports[_0x4244('0x48')]=function(_0x4b571f){var _0x4c906b=this;return new Promise(function(_0x5f4e7d,_0x4a262b){db[_0x4244('0x2c')]['describe']()[_0x4244('0xb')](function(_0x25098e){return db[_0x4244('0x18')][_0x4244('0x19')]({'raw':_0x4b571f[_0x4244('0x1b')]?_0x4b571f[_0x4244('0x1b')][_0x4244('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b571f['options']?_0x4b571f[_0x4244('0x1b')]['where']||null:null,'attributes':_0x4b571f[_0x4244('0x1b')]?_0x4b571f[_0x4244('0x1b')][_0x4244('0x1d')]||null:null,'limit':_0x4b571f['options']?_0x4b571f[_0x4244('0x1b')][_0x4244('0x27')]||null:null,'include':_0x4b571f[_0x4244('0x1b')]?_0x4b571f[_0x4244('0x1b')]['include']?_[_0x4244('0x20')](_0x4b571f[_0x4244('0x1b')][_0x4244('0x1e')],function(_0x7c813){return{'model':db[_0x7c813[_0x4244('0x1f')]],'as':_0x7c813['as'],'attributes':_0x7c813['as']===_0x4244('0x32')?_[_0x4244('0x33')](_0x25098e):_0x7c813[_0x4244('0x1d')],'include':_0x7c813[_0x4244('0x1e')]?_['map'](_0x7c813[_0x4244('0x1e')],function(_0x50d727){return{'model':db[_0x50d727[_0x4244('0x1f')]],'as':_0x50d727['as'],'attributes':_0x50d727[_0x4244('0x1d')],'include':_0x50d727['include']?_[_0x4244('0x20')](_0x50d727[_0x4244('0x1e')],function(_0x37dea7){return{'model':db[_0x37dea7['model']],'as':_0x37dea7['as'],'attributes':_0x37dea7[_0x4244('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4244('0xb')](function(_0x428b33){logger[_0x4244('0xc')](_0x4244('0x17'),_0x4b571f);logger[_0x4244('0xf')](_0x4244('0x17'),_0x4b571f,JSON[_0x4244('0x11')](_0x428b33));_0x5f4e7d(_0x428b33);})[_0x4244('0x16')](function(_0x39f6ac){logger[_0x4244('0x12')](_0x4244('0x17'),_0x39f6ac[_0x4244('0x14')],_0x4b571f);_0x4a262b(_0x4c906b[_0x4244('0x12')](0x1f4,_0x39f6ac[_0x4244('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index dfaa80e..aba24ba 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 _0x92a3=['getPreview','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','getOpenContacts','isAuthenticated','post','create','/preview'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x92a3,0x1ea));var _0x392a=function(_0x291589,_0x394acd){_0x291589=_0x291589-0x0;var _0x304d5d=_0x92a3[_0x291589];return _0x304d5d;};'use strict';var multer=require(_0x392a('0x0'));var util=require(_0x392a('0x1'));var path=require('path');var timeout=require(_0x392a('0x2'));var express=require(_0x392a('0x3'));var router=express[_0x392a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x392a('0x5'));var interaction=require(_0x392a('0x6'));var config=require(_0x392a('0x7'));var controller=require('./cmHopper.controller');router[_0x392a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x392a('0x8')](_0x392a('0x9'),auth['isAuthenticated'](),controller[_0x392a('0xa')]);router[_0x392a('0x8')]('/opencontacts',auth['isAuthenticated'](),controller[_0x392a('0xb')]);router[_0x392a('0x8')]('/:id',auth[_0x392a('0xc')](),controller['show']);router[_0x392a('0xd')]('/',auth[_0x392a('0xc')](),controller[_0x392a('0xe')]);router[_0x392a('0xd')](_0x392a('0xf'),auth[_0x392a('0xc')](),controller[_0x392a('0x10')]);router[_0x392a('0x11')](_0x392a('0x12'),auth[_0x392a('0xc')](),controller[_0x392a('0x13')]);router[_0x392a('0x14')](_0x392a('0x12'),auth[_0x392a('0xc')](),controller['destroy']);module[_0x392a('0x15')]=router; \ No newline at end of file +var _0xde6f=['put','update','delete','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/opencontacts','/:id','show','/preview','getPreview'];(function(_0x2211d4,_0x592254){var _0x565b56=function(_0x576ba){while(--_0x576ba){_0x2211d4['push'](_0x2211d4['shift']());}};_0x565b56(++_0x592254);}(_0xde6f,0xcc));var _0xfde6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde6f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xfde6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfde6('0x1'));var router=express[_0xfde6('0x2')]();var fs_extra=require(_0xfde6('0x3'));var auth=require(_0xfde6('0x4'));var interaction=require(_0xfde6('0x5'));var config=require(_0xfde6('0x6'));var controller=require(_0xfde6('0x7'));router['get']('/',auth[_0xfde6('0x8')](),controller[_0xfde6('0x9')]);router[_0xfde6('0xa')]('/describe',auth[_0xfde6('0x8')](),controller['describe']);router[_0xfde6('0xa')](_0xfde6('0xb'),auth[_0xfde6('0x8')](),controller['getOpenContacts']);router[_0xfde6('0xa')](_0xfde6('0xc'),auth[_0xfde6('0x8')](),controller[_0xfde6('0xd')]);router['post']('/',auth[_0xfde6('0x8')](),controller['create']);router['post'](_0xfde6('0xe'),auth[_0xfde6('0x8')](),controller[_0xfde6('0xf')]);router[_0xfde6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfde6('0x11')]);router[_0xfde6('0x12')](_0xfde6('0xc'),auth[_0xfde6('0x8')](),controller[_0xfde6('0x13')]);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 8f23c11..8007e68 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 _0x4233=['exports','STRING','contactListQueue','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4233,0x199));var _0x3423=function(_0x32601f,_0x5787d8){_0x32601f=_0x32601f-0x0;var _0x5736c1=_0x4233[_0x32601f];return _0x5736c1;};'use strict';var moment=require('moment');var Sequelize=require(_0x3423('0x0'));module[_0x3423('0x1')]={'phone':{'type':Sequelize[_0x3423('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x3423('0x3')},'ListId':{'type':Sequelize[_0x3423('0x4')],'unique':_0x3423('0x3')},'VoiceQueueId':{'type':Sequelize[_0x3423('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xf131=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0xf131,0x1a1));var _0x1f13=function(_0x4fa2cf,_0x5ba401){_0x4fa2cf=_0x4fa2cf-0x0;var _0x3eadab=_0xf131[_0x4fa2cf];return _0x3eadab;};'use strict';var moment=require(_0x1f13('0x0'));var Sequelize=require(_0x1f13('0x1'));module[_0x1f13('0x2')]={'phone':{'type':Sequelize[_0x1f13('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1f13('0x4')],'unique':_0x1f13('0x5')},'ListId':{'type':Sequelize[_0x1f13('0x4')],'unique':_0x1f13('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x1f13('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0302196..d2ce3ef 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 _0x16c8=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','rows','params','include','find','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','limit','status','set','Content-Range','save','update','then','destroy','sendStatus','error','name','index','map','CmHopperBlack','rawAttributes'];(function(_0x1f9e79,_0x3b596d){var _0x420cde=function(_0x466a2d){while(--_0x466a2d){_0x1f9e79['push'](_0x1f9e79['shift']());}};_0x420cde(++_0x3b596d);}(_0x16c8,0x1eb));var _0x816c=function(_0x384a73,_0x397a28){_0x384a73=_0x384a73-0x0;var _0xbc72d8=_0x16c8[_0x384a73];return _0xbc72d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x816c('0x0'));var zipdir=require(_0x816c('0x1'));var jsonpatch=require(_0x816c('0x2'));var rp=require(_0x816c('0x3'));var moment=require(_0x816c('0x4'));var BPromise=require(_0x816c('0x5'));var Mustache=require(_0x816c('0x6'));var util=require(_0x816c('0x7'));var path=require(_0x816c('0x8'));var sox=require(_0x816c('0x9'));var csv=require(_0x816c('0xa'));var ejs=require(_0x816c('0xb'));var fs=require('fs');var fs_extra=require(_0x816c('0xc'));var _=require('lodash');var squel=require(_0x816c('0xd'));var crypto=require(_0x816c('0xe'));var jsforce=require(_0x816c('0xf'));var deskjs=require(_0x816c('0x10'));var toCsv=require(_0x816c('0xa'));var querystring=require(_0x816c('0x11'));var Papa=require(_0x816c('0x12'));var Redis=require(_0x816c('0x13'));var authService=require(_0x816c('0x14'));var qs=require(_0x816c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x816c('0x16'));var logger=require(_0x816c('0x17'))(_0x816c('0x18'));var utils=require(_0x816c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x816c('0x1a'));var db=require(_0x816c('0x1b'))['db'];function respondWithStatusCode(_0x30d092,_0x43ff61){_0x43ff61=_0x43ff61||0xcc;return function(_0x32bfe0){if(_0x32bfe0){return _0x30d092['sendStatus'](_0x43ff61);}return _0x30d092['status'](_0x43ff61)[_0x816c('0x1c')]();};}function respondWithResult(_0x1a5da6,_0x5e51bf){_0x5e51bf=_0x5e51bf||0xc8;return function(_0x5e1897){if(_0x5e1897){return _0x1a5da6['status'](_0x5e51bf)[_0x816c('0x1d')](_0x5e1897);}};}function respondWithFilteredResult(_0x2435d9,_0x291193){return function(_0x53a33){if(_0x53a33){var _0x2fc40c=typeof _0x291193[_0x816c('0x1e')]==='undefined'&&typeof _0x291193['limit']===_0x816c('0x1f');var _0x2dfcbb=_0x53a33[_0x816c('0x20')];var _0x31fbf6=_0x2fc40c?0x0:_0x291193['offset'];var _0x466810=_0x2fc40c?_0x53a33[_0x816c('0x20')]:_0x291193[_0x816c('0x1e')]+_0x291193[_0x816c('0x21')];var _0x5b262e;if(_0x466810>=_0x2dfcbb){_0x466810=_0x2dfcbb;_0x5b262e=0xc8;}else{_0x5b262e=0xce;}_0x2435d9[_0x816c('0x22')](_0x5b262e);return _0x2435d9[_0x816c('0x23')](_0x816c('0x24'),_0x31fbf6+'-'+_0x466810+'/'+_0x2dfcbb)['json'](_0x53a33);}return null;};}function patchUpdates(_0x47b301){return function(_0x2efd07){try{jsonpatch['apply'](_0x2efd07,_0x47b301,!![]);}catch(_0x28047e){return BPromise['reject'](_0x28047e);}return _0x2efd07[_0x816c('0x25')]();};}function saveUpdates(_0x3c8d96,_0x10bcfe){return function(_0x2321fe){if(_0x2321fe){return _0x2321fe[_0x816c('0x26')](_0x3c8d96)[_0x816c('0x27')](function(_0x18a51e){return _0x18a51e;});}return null;};}function removeEntity(_0x5e83ea,_0x416ef5){return function(_0x5d5d5d){if(_0x5d5d5d){return _0x5d5d5d[_0x816c('0x28')]()['then'](function(){_0x5e83ea['status'](0xcc)[_0x816c('0x1c')]();});}};}function handleEntityNotFound(_0x46d4aa,_0x44ab15){return function(_0x10320e){if(!_0x10320e){_0x46d4aa[_0x816c('0x29')](0x194);}return _0x10320e;};}function handleError(_0x3d6329,_0x51d717){_0x51d717=_0x51d717||0x1f4;return function(_0x21031d){logger[_0x816c('0x2a')](_0x21031d['stack']);if(_0x21031d[_0x816c('0x2b')]){delete _0x21031d[_0x816c('0x2b')];}_0x3d6329['status'](_0x51d717)['send'](_0x21031d);};}exports[_0x816c('0x2c')]=function(_0x9eb271,_0x6a7129){var _0x5f45de={},_0x2fbf13={},_0x3637cf={'count':0x0,'rows':[]};var _0x3f95d7=_[_0x816c('0x2d')](db[_0x816c('0x2e')][_0x816c('0x2f')],function(_0xf9e8bb){return{'name':_0xf9e8bb[_0x816c('0x30')],'type':_0xf9e8bb[_0x816c('0x31')][_0x816c('0x32')]};});_0x2fbf13[_0x816c('0x33')]=_['map'](_0x3f95d7,'name');_0x2fbf13[_0x816c('0x34')]=_[_0x816c('0x35')](_0x9eb271[_0x816c('0x34')]);_0x2fbf13[_0x816c('0x36')]=_[_0x816c('0x37')](_0x2fbf13[_0x816c('0x33')],_0x2fbf13[_0x816c('0x34')]);_0x5f45de[_0x816c('0x38')]=_[_0x816c('0x37')](_0x2fbf13[_0x816c('0x33')],qs[_0x816c('0x39')](_0x9eb271[_0x816c('0x34')][_0x816c('0x39')]));_0x5f45de[_0x816c('0x38')]=_0x5f45de[_0x816c('0x38')][_0x816c('0x3a')]?_0x5f45de[_0x816c('0x38')]:_0x2fbf13['model'];if(!_0x9eb271[_0x816c('0x34')][_0x816c('0x3b')](_0x816c('0x3c'))){_0x5f45de['limit']=qs[_0x816c('0x21')](_0x9eb271[_0x816c('0x34')]['limit']);_0x5f45de[_0x816c('0x1e')]=qs[_0x816c('0x1e')](_0x9eb271[_0x816c('0x34')][_0x816c('0x1e')]);}_0x5f45de[_0x816c('0x3d')]=qs['sort'](_0x9eb271[_0x816c('0x34')][_0x816c('0x3e')]);_0x5f45de[_0x816c('0x3f')]=qs[_0x816c('0x36')](_[_0x816c('0x40')](_0x9eb271['query'],_0x2fbf13['filters']),_0x3f95d7);if(_0x9eb271[_0x816c('0x34')]['filter']){_0x5f45de[_0x816c('0x3f')]=_['merge'](_0x5f45de[_0x816c('0x3f')],{'$or':_[_0x816c('0x2d')](_0x3f95d7,function(_0x51e0b0){if(_0x51e0b0[_0x816c('0x31')]!==_0x816c('0x41')){var _0x593971={};_0x593971[_0x51e0b0[_0x816c('0x2b')]]={'$like':'%'+_0x9eb271[_0x816c('0x34')][_0x816c('0x42')]+'%'};return _0x593971;}})});}_0x5f45de=_[_0x816c('0x43')]({},_0x5f45de,_0x9eb271[_0x816c('0x44')]);var _0x172e08={'where':_0x5f45de[_0x816c('0x3f')]};return db[_0x816c('0x2e')][_0x816c('0x20')](_0x172e08)[_0x816c('0x27')](function(_0x1c2b27){_0x3637cf['count']=_0x1c2b27;if(_0x9eb271['query'][_0x816c('0x45')]){_0x5f45de['include']=[{'all':!![]}];}return db[_0x816c('0x2e')]['findAll'](_0x5f45de);})[_0x816c('0x27')](function(_0xf5f0c3){_0x3637cf[_0x816c('0x46')]=_0xf5f0c3;return _0x3637cf;})['then'](respondWithFilteredResult(_0x6a7129,_0x5f45de))['catch'](handleError(_0x6a7129,null));};exports['show']=function(_0x5b61f7,_0x4f7c41){var _0x28a173={'raw':!![],'where':{'id':_0x5b61f7[_0x816c('0x47')]['id']}},_0x589d82={};_0x589d82['model']=_[_0x816c('0x35')](db[_0x816c('0x2e')][_0x816c('0x2f')]);_0x589d82[_0x816c('0x34')]=_[_0x816c('0x35')](_0x5b61f7[_0x816c('0x34')]);_0x589d82['filters']=_[_0x816c('0x37')](_0x589d82[_0x816c('0x33')],_0x589d82[_0x816c('0x34')]);_0x28a173[_0x816c('0x38')]=_[_0x816c('0x37')](_0x589d82[_0x816c('0x33')],qs[_0x816c('0x39')](_0x5b61f7[_0x816c('0x34')][_0x816c('0x39')]));_0x28a173[_0x816c('0x38')]=_0x28a173[_0x816c('0x38')]['length']?_0x28a173['attributes']:_0x589d82['model'];if(_0x5b61f7[_0x816c('0x34')][_0x816c('0x45')]){_0x28a173[_0x816c('0x48')]=[{'all':!![]}];}_0x28a173=_[_0x816c('0x43')]({},_0x28a173,_0x5b61f7[_0x816c('0x44')]);return db[_0x816c('0x2e')][_0x816c('0x49')](_0x28a173)[_0x816c('0x27')](handleEntityNotFound(_0x4f7c41,null))[_0x816c('0x27')](respondWithResult(_0x4f7c41,null))['catch'](handleError(_0x4f7c41,null));};exports[_0x816c('0x26')]=function(_0x4cc96d,_0x3909f7){if(_0x4cc96d[_0x816c('0x4a')]['id']){delete _0x4cc96d[_0x816c('0x4a')]['id'];}return db[_0x816c('0x2e')][_0x816c('0x49')]({'where':{'id':_0x4cc96d[_0x816c('0x47')]['id']}})[_0x816c('0x27')](handleEntityNotFound(_0x3909f7,null))['then'](saveUpdates(_0x4cc96d[_0x816c('0x4a')],null))['then'](respondWithResult(_0x3909f7,null))[_0x816c('0x4b')](handleError(_0x3909f7,null));};exports[_0x816c('0x28')]=function(_0x3f4272,_0x30e6cf){return db['CmHopperBlack'][_0x816c('0x49')]({'where':{'id':_0x3f4272['params']['id']}})[_0x816c('0x27')](handleEntityNotFound(_0x30e6cf,null))[_0x816c('0x27')](removeEntity(_0x30e6cf,null))['catch'](handleError(_0x30e6cf,null));};exports[_0x816c('0x4c')]=function(_0x1be73f,_0x40635d){return db[_0x816c('0x2e')][_0x816c('0x4c')]()[_0x816c('0x27')](respondWithResult(_0x40635d,null))[_0x816c('0x4b')](handleError(_0x40635d,null));}; \ No newline at end of file +var _0x8e19=['undefined','count','set','Content-Range','update','then','sendStatus','error','stack','send','index','map','CmHopperBlack','type','key','model','name','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','filter','includeAll','include','findAll','rows','show','params','options','catch','body','find','destroy','describe','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8e19,0x75));var _0x98e1=function(_0x452c0e,_0x2937f1){_0x452c0e=_0x452c0e-0x0;var _0x18e377=_0x8e19[_0x452c0e];return _0x18e377;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x98e1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x98e1('0x1'));var moment=require(_0x98e1('0x2'));var BPromise=require(_0x98e1('0x3'));var Mustache=require(_0x98e1('0x4'));var util=require(_0x98e1('0x5'));var path=require('path');var sox=require(_0x98e1('0x6'));var csv=require(_0x98e1('0x7'));var ejs=require(_0x98e1('0x8'));var fs=require('fs');var fs_extra=require(_0x98e1('0x9'));var _=require(_0x98e1('0xa'));var squel=require(_0x98e1('0xb'));var crypto=require(_0x98e1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x98e1('0xd'));var toCsv=require(_0x98e1('0x7'));var querystring=require(_0x98e1('0xe'));var Papa=require('papaparse');var Redis=require(_0x98e1('0xf'));var authService=require(_0x98e1('0x10'));var qs=require(_0x98e1('0x11'));var as=require(_0x98e1('0x12'));var hardwareService=require(_0x98e1('0x13'));var logger=require('../../config/logger')(_0x98e1('0x14'));var utils=require(_0x98e1('0x15'));var config=require(_0x98e1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98e1('0x17'))['db'];function respondWithStatusCode(_0xa7ee69,_0x4f3def){_0x4f3def=_0x4f3def||0xcc;return function(_0x2c1d8f){if(_0x2c1d8f){return _0xa7ee69['sendStatus'](_0x4f3def);}return _0xa7ee69[_0x98e1('0x18')](_0x4f3def)[_0x98e1('0x19')]();};}function respondWithResult(_0x5b4868,_0x4814e5){_0x4814e5=_0x4814e5||0xc8;return function(_0x4a6125){if(_0x4a6125){return _0x5b4868['status'](_0x4814e5)[_0x98e1('0x1a')](_0x4a6125);}};}function respondWithFilteredResult(_0x261bea,_0x4f106b){return function(_0x2e581a){if(_0x2e581a){var _0x3d0f44=typeof _0x4f106b[_0x98e1('0x1b')]==='undefined'&&typeof _0x4f106b[_0x98e1('0x1c')]===_0x98e1('0x1d');var _0x2a1243=_0x2e581a[_0x98e1('0x1e')];var _0x279b39=_0x3d0f44?0x0:_0x4f106b[_0x98e1('0x1b')];var _0x1d8e21=_0x3d0f44?_0x2e581a['count']:_0x4f106b[_0x98e1('0x1b')]+_0x4f106b[_0x98e1('0x1c')];var _0xe4f90a;if(_0x1d8e21>=_0x2a1243){_0x1d8e21=_0x2a1243;_0xe4f90a=0xc8;}else{_0xe4f90a=0xce;}_0x261bea[_0x98e1('0x18')](_0xe4f90a);return _0x261bea[_0x98e1('0x1f')](_0x98e1('0x20'),_0x279b39+'-'+_0x1d8e21+'/'+_0x2a1243)[_0x98e1('0x1a')](_0x2e581a);}return null;};}function patchUpdates(_0x9a5227){return function(_0x4ac882){try{jsonpatch['apply'](_0x4ac882,_0x9a5227,!![]);}catch(_0x44bdf8){return BPromise['reject'](_0x44bdf8);}return _0x4ac882['save']();};}function saveUpdates(_0x351607,_0x3f8233){return function(_0xcabb7f){if(_0xcabb7f){return _0xcabb7f[_0x98e1('0x21')](_0x351607)['then'](function(_0x3533b8){return _0x3533b8;});}return null;};}function removeEntity(_0x3b8283,_0x2aaed1){return function(_0x206689){if(_0x206689){return _0x206689['destroy']()[_0x98e1('0x22')](function(){_0x3b8283[_0x98e1('0x18')](0xcc)[_0x98e1('0x19')]();});}};}function handleEntityNotFound(_0x309184,_0x20b72c){return function(_0x5433d3){if(!_0x5433d3){_0x309184[_0x98e1('0x23')](0x194);}return _0x5433d3;};}function handleError(_0x26248c,_0x2fdd50){_0x2fdd50=_0x2fdd50||0x1f4;return function(_0x1360fb){logger[_0x98e1('0x24')](_0x1360fb[_0x98e1('0x25')]);if(_0x1360fb['name']){delete _0x1360fb['name'];}_0x26248c[_0x98e1('0x18')](_0x2fdd50)[_0x98e1('0x26')](_0x1360fb);};}exports[_0x98e1('0x27')]=function(_0x87fef6,_0x2132f2){var _0x476904={},_0xce0eec={},_0x30c95f={'count':0x0,'rows':[]};var _0x6f8eb6=_[_0x98e1('0x28')](db[_0x98e1('0x29')]['rawAttributes'],function(_0x3a50b2){return{'name':_0x3a50b2['fieldName'],'type':_0x3a50b2[_0x98e1('0x2a')][_0x98e1('0x2b')]};});_0xce0eec[_0x98e1('0x2c')]=_[_0x98e1('0x28')](_0x6f8eb6,_0x98e1('0x2d'));_0xce0eec[_0x98e1('0x2e')]=_[_0x98e1('0x2f')](_0x87fef6[_0x98e1('0x2e')]);_0xce0eec['filters']=_[_0x98e1('0x30')](_0xce0eec[_0x98e1('0x2c')],_0xce0eec[_0x98e1('0x2e')]);_0x476904['attributes']=_['intersection'](_0xce0eec[_0x98e1('0x2c')],qs['fields'](_0x87fef6[_0x98e1('0x2e')][_0x98e1('0x31')]));_0x476904['attributes']=_0x476904['attributes'][_0x98e1('0x32')]?_0x476904[_0x98e1('0x33')]:_0xce0eec['model'];if(!_0x87fef6[_0x98e1('0x2e')][_0x98e1('0x34')](_0x98e1('0x35'))){_0x476904[_0x98e1('0x1c')]=qs[_0x98e1('0x1c')](_0x87fef6[_0x98e1('0x2e')]['limit']);_0x476904[_0x98e1('0x1b')]=qs[_0x98e1('0x1b')](_0x87fef6['query'][_0x98e1('0x1b')]);}_0x476904[_0x98e1('0x36')]=qs[_0x98e1('0x37')](_0x87fef6[_0x98e1('0x2e')][_0x98e1('0x37')]);_0x476904['where']=qs['filters'](_[_0x98e1('0x38')](_0x87fef6[_0x98e1('0x2e')],_0xce0eec[_0x98e1('0x39')]),_0x6f8eb6);if(_0x87fef6[_0x98e1('0x2e')]['filter']){_0x476904[_0x98e1('0x3a')]=_[_0x98e1('0x3b')](_0x476904['where'],{'$or':_[_0x98e1('0x28')](_0x6f8eb6,function(_0x3442df){if(_0x3442df['type']!=='VIRTUAL'){var _0x1a8ac6={};_0x1a8ac6[_0x3442df[_0x98e1('0x2d')]]={'$like':'%'+_0x87fef6[_0x98e1('0x2e')][_0x98e1('0x3c')]+'%'};return _0x1a8ac6;}})});}_0x476904=_[_0x98e1('0x3b')]({},_0x476904,_0x87fef6['options']);var _0x15efb6={'where':_0x476904[_0x98e1('0x3a')]};return db[_0x98e1('0x29')][_0x98e1('0x1e')](_0x15efb6)[_0x98e1('0x22')](function(_0x3c6e19){_0x30c95f[_0x98e1('0x1e')]=_0x3c6e19;if(_0x87fef6[_0x98e1('0x2e')][_0x98e1('0x3d')]){_0x476904[_0x98e1('0x3e')]=[{'all':!![]}];}return db[_0x98e1('0x29')][_0x98e1('0x3f')](_0x476904);})[_0x98e1('0x22')](function(_0x9eae75){_0x30c95f[_0x98e1('0x40')]=_0x9eae75;return _0x30c95f;})[_0x98e1('0x22')](respondWithFilteredResult(_0x2132f2,_0x476904))['catch'](handleError(_0x2132f2,null));};exports[_0x98e1('0x41')]=function(_0x21d0e4,_0x29d4e3){var _0x25e712={'raw':!![],'where':{'id':_0x21d0e4[_0x98e1('0x42')]['id']}},_0x53f884={};_0x53f884[_0x98e1('0x2c')]=_[_0x98e1('0x2f')](db[_0x98e1('0x29')]['rawAttributes']);_0x53f884[_0x98e1('0x2e')]=_[_0x98e1('0x2f')](_0x21d0e4[_0x98e1('0x2e')]);_0x53f884['filters']=_[_0x98e1('0x30')](_0x53f884[_0x98e1('0x2c')],_0x53f884[_0x98e1('0x2e')]);_0x25e712[_0x98e1('0x33')]=_['intersection'](_0x53f884[_0x98e1('0x2c')],qs[_0x98e1('0x31')](_0x21d0e4['query'][_0x98e1('0x31')]));_0x25e712[_0x98e1('0x33')]=_0x25e712['attributes'][_0x98e1('0x32')]?_0x25e712[_0x98e1('0x33')]:_0x53f884[_0x98e1('0x2c')];if(_0x21d0e4['query'][_0x98e1('0x3d')]){_0x25e712[_0x98e1('0x3e')]=[{'all':!![]}];}_0x25e712=_[_0x98e1('0x3b')]({},_0x25e712,_0x21d0e4[_0x98e1('0x43')]);return db[_0x98e1('0x29')]['find'](_0x25e712)[_0x98e1('0x22')](handleEntityNotFound(_0x29d4e3,null))[_0x98e1('0x22')](respondWithResult(_0x29d4e3,null))[_0x98e1('0x44')](handleError(_0x29d4e3,null));};exports['update']=function(_0x3441c5,_0x28df25){if(_0x3441c5[_0x98e1('0x45')]['id']){delete _0x3441c5['body']['id'];}return db[_0x98e1('0x29')][_0x98e1('0x46')]({'where':{'id':_0x3441c5['params']['id']}})[_0x98e1('0x22')](handleEntityNotFound(_0x28df25,null))[_0x98e1('0x22')](saveUpdates(_0x3441c5['body'],null))[_0x98e1('0x22')](respondWithResult(_0x28df25,null))[_0x98e1('0x44')](handleError(_0x28df25,null));};exports[_0x98e1('0x47')]=function(_0x3a1345,_0x2fd200){return db[_0x98e1('0x29')][_0x98e1('0x46')]({'where':{'id':_0x3a1345['params']['id']}})[_0x98e1('0x22')](handleEntityNotFound(_0x2fd200,null))[_0x98e1('0x22')](removeEntity(_0x2fd200,null))[_0x98e1('0x44')](handleError(_0x2fd200,null));};exports[_0x98e1('0x48')]=function(_0x3509fa,_0x1a79c1){return db[_0x98e1('0x29')][_0x98e1('0x48')]()['then'](respondWithResult(_0x1a79c1,null))[_0x98e1('0x44')](handleError(_0x1a79c1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 23caf7a..6ad7b32 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 _0xdb5c=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','lodash','api','moment'];(function(_0x5aeee5,_0x2cf6cc){var _0x60fa21=function(_0x10bb61){while(--_0x10bb61){_0x5aeee5['push'](_0x5aeee5['shift']());}};_0x60fa21(++_0x2cf6cc);}(_0xdb5c,0xa8));var _0xcdb5=function(_0x4e5001,_0x37ac48){_0x4e5001=_0x4e5001-0x0;var _0x5d336d=_0xdb5c[_0x4e5001];return _0x5d336d;};'use strict';var _=require(_0xcdb5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcdb5('0x1'));var moment=require(_0xcdb5('0x2'));var BPromise=require('bluebird');var rp=require(_0xcdb5('0x3'));var fs=require('fs');var path=require(_0xcdb5('0x4'));var rimraf=require(_0xcdb5('0x5'));var config=require(_0xcdb5('0x6'));var attributes=require(_0xcdb5('0x7'));module['exports']=function(_0x582c75,_0x512a21){return _0x582c75[_0xcdb5('0x8')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23f8=['lodash','api','moment','bluebird','request-promise','../../config/environment','exports','define','cm_hopper_black'];(function(_0x5384f2,_0x5bf264){var _0xf1eaa5=function(_0x3b7519){while(--_0x3b7519){_0x5384f2['push'](_0x5384f2['shift']());}};_0xf1eaa5(++_0x5bf264);}(_0x23f8,0xc6));var _0x823f=function(_0x426e85,_0x13948d){_0x426e85=_0x426e85-0x0;var _0x6861b2=_0x23f8[_0x426e85];return _0x6861b2;};'use strict';var _=require(_0x823f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x823f('0x1'));var moment=require(_0x823f('0x2'));var BPromise=require(_0x823f('0x3'));var rp=require(_0x823f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x823f('0x5'));var attributes=require('./cmHopperBlack.attributes');module[_0x823f('0x6')]=function(_0x17ef65,_0x306aea){return _0x17ef65[_0x823f('0x7')]('CmHopperBlack',attributes,{'tableName':_0x823f('0x8'),'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 25ce2db..4138700 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 _0x7edb=['include','model','GetCmHopperBlack','debug','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CmHopperBlack','options','raw','where','attributes','limit','map'];(function(_0x2351c4,_0x1dca54){var _0x1dd3f8=function(_0x4c3fa2){while(--_0x4c3fa2){_0x2351c4['push'](_0x2351c4['shift']());}};_0x1dd3f8(++_0x1dca54);}(_0x7edb,0x141));var _0xb7ed=function(_0x38e831,_0x173fc0){_0x38e831=_0x38e831-0x0;var _0x497511=_0x7edb[_0x38e831];return _0x497511;};'use strict';var _=require('lodash');var util=require(_0xb7ed('0x0'));var moment=require(_0xb7ed('0x1'));var BPromise=require(_0xb7ed('0x2'));var rs=require(_0xb7ed('0x3'));var fs=require('fs');var Redis=require(_0xb7ed('0x4'));var db=require(_0xb7ed('0x5'))['db'];var utils=require(_0xb7ed('0x6'));var logger=require(_0xb7ed('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb7ed('0x8'));var client=jayson[_0xb7ed('0x9')][_0xb7ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7ffd22,_0x408228,_0x4f625c){return new BPromise(function(_0x521070,_0x37eaf1){return client[_0xb7ed('0xb')](_0x7ffd22,_0x4f625c)[_0xb7ed('0xc')](function(_0x5dfc7a){logger['info'](_0xb7ed('0xd'),_0x408228,_0xb7ed('0xe'));logger['debug'](_0xb7ed('0xf'),_0x408228,_0xb7ed('0xe'),JSON[_0xb7ed('0x10')](_0x5dfc7a));if(_0x5dfc7a[_0xb7ed('0x11')]){if(_0x5dfc7a[_0xb7ed('0x11')][_0xb7ed('0x12')]===0x1f4){logger[_0xb7ed('0x11')](_0xb7ed('0xd'),_0x408228,_0x5dfc7a[_0xb7ed('0x11')][_0xb7ed('0x13')]);return _0x37eaf1(_0x5dfc7a['error'][_0xb7ed('0x13')]);}logger[_0xb7ed('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x408228,_0x5dfc7a[_0xb7ed('0x11')][_0xb7ed('0x13')]);return _0x521070(_0x5dfc7a[_0xb7ed('0x11')][_0xb7ed('0x13')]);}else{logger[_0xb7ed('0x14')](_0xb7ed('0xd'),_0x408228,'request\x20sent');_0x521070(_0x5dfc7a[_0xb7ed('0x15')][_0xb7ed('0x13')]);}})[_0xb7ed('0x16')](function(_0x22a8bb){logger[_0xb7ed('0x11')](_0xb7ed('0xd'),_0x408228,_0x22a8bb);_0x37eaf1(_0x22a8bb);});});}exports['GetCmHopperBlack']=function(_0x58f60e){var _0x4e83a2=this;return new Promise(function(_0x2286af,_0x2449c9){return db[_0xb7ed('0x17')]['findAll']({'raw':_0x58f60e[_0xb7ed('0x18')]?_0x58f60e[_0xb7ed('0x18')][_0xb7ed('0x19')]===undefined?!![]:![]:!![],'where':_0x58f60e['options']?_0x58f60e[_0xb7ed('0x18')][_0xb7ed('0x1a')]||null:null,'attributes':_0x58f60e[_0xb7ed('0x18')]?_0x58f60e['options'][_0xb7ed('0x1b')]||null:null,'limit':_0x58f60e['options']?_0x58f60e[_0xb7ed('0x18')][_0xb7ed('0x1c')]||null:null,'include':_0x58f60e[_0xb7ed('0x18')]?_0x58f60e[_0xb7ed('0x18')]['include']?_[_0xb7ed('0x1d')](_0x58f60e[_0xb7ed('0x18')][_0xb7ed('0x1e')],function(_0x5e114b){return{'model':db[_0x5e114b[_0xb7ed('0x1f')]],'as':_0x5e114b['as'],'attributes':_0x5e114b[_0xb7ed('0x1b')],'include':_0x5e114b[_0xb7ed('0x1e')]?_[_0xb7ed('0x1d')](_0x5e114b[_0xb7ed('0x1e')],function(_0x4af7dc){return{'model':db[_0x4af7dc['model']],'as':_0x4af7dc['as'],'attributes':_0x4af7dc[_0xb7ed('0x1b')],'include':_0x4af7dc[_0xb7ed('0x1e')]?_[_0xb7ed('0x1d')](_0x4af7dc[_0xb7ed('0x1e')],function(_0x2b871e){return{'model':db[_0x2b871e[_0xb7ed('0x1f')]],'as':_0x2b871e['as'],'attributes':_0x2b871e[_0xb7ed('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb7ed('0xc')](function(_0x2dbe9f){logger[_0xb7ed('0x14')](_0xb7ed('0x20'),_0x58f60e);logger[_0xb7ed('0x21')](_0xb7ed('0x20'),_0x58f60e,JSON[_0xb7ed('0x10')](_0x2dbe9f));_0x2286af(_0x2dbe9f);})['catch'](function(_0x1a0afc){logger[_0xb7ed('0x11')](_0xb7ed('0x20'),_0x1a0afc[_0xb7ed('0x13')],_0x58f60e);_0x2449c9(_0x4e83a2[_0xb7ed('0x11')](0x1f4,_0x1a0afc[_0xb7ed('0x13')]));});});};exports[_0xb7ed('0x22')]=function(_0x21eb12){var _0x336cf8=this;return new Promise(function(_0x27ae90,_0x4a3ae5){return db['CmHopperBlack'][_0xb7ed('0x23')](_0x21eb12[_0xb7ed('0x24')],{'raw':_0x21eb12['options']?_0x21eb12[_0xb7ed('0x18')][_0xb7ed('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21eb12[_0xb7ed('0x18')]?_0x21eb12[_0xb7ed('0x18')]['where']||null:null,'attributes':_0x21eb12[_0xb7ed('0x18')]?_0x21eb12[_0xb7ed('0x18')][_0xb7ed('0x1b')]||null:null,'limit':_0x21eb12[_0xb7ed('0x18')]?_0x21eb12[_0xb7ed('0x18')]['limit']||null:null})[_0xb7ed('0xc')](function(_0x363ee6){logger[_0xb7ed('0x14')](_0xb7ed('0x22'),_0x21eb12);logger[_0xb7ed('0x21')](_0xb7ed('0x22'),_0x21eb12,JSON[_0xb7ed('0x10')](_0x363ee6));_0x27ae90(_0x363ee6);})[_0xb7ed('0x16')](function(_0xaf200c){logger[_0xb7ed('0x11')](_0xb7ed('0x22'),_0xaf200c['message'],_0x21eb12);_0x4a3ae5(_0x336cf8[_0xb7ed('0x11')](0x1f4,_0xaf200c[_0xb7ed('0x13')]));});});};exports[_0xb7ed('0x25')]=function(_0x2f5ddd){var _0x2217e5=this;return new Promise(function(_0x37e959,_0x33a883){return db[_0xb7ed('0x17')][_0xb7ed('0x26')]({'where':_0x2f5ddd['options']?_0x2f5ddd[_0xb7ed('0x18')]['where']||null:null})['then'](function(_0x5bd3b8){logger['info']('DestroyCmHopperBlack',_0x2f5ddd);logger[_0xb7ed('0x21')](_0xb7ed('0x25'),_0x2f5ddd,JSON[_0xb7ed('0x10')](_0x5bd3b8));_0x37e959(_0x5bd3b8);})[_0xb7ed('0x16')](function(_0x143b2c){logger[_0xb7ed('0x11')](_0xb7ed('0x25'),_0x143b2c['message'],_0x2f5ddd);_0x33a883(_0x2217e5[_0xb7ed('0x11')](0x1f4,_0x143b2c[_0xb7ed('0x13')]));});});}; \ No newline at end of file +var _0x8594=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','map','model','include','attributes','stringify','update','body','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','util','moment'];(function(_0x412766,_0x2a55e6){var _0x8d1282=function(_0x53b485){while(--_0x53b485){_0x412766['push'](_0x412766['shift']());}};_0x8d1282(++_0x2a55e6);}(_0x8594,0x142));var _0x4859=function(_0x3a05ae,_0x53dc8a){_0x3a05ae=_0x3a05ae-0x0;var _0x57d12a=_0x8594[_0x3a05ae];return _0x57d12a;};'use strict';var _=require('lodash');var util=require(_0x4859('0x0'));var moment=require(_0x4859('0x1'));var BPromise=require('bluebird');var rs=require(_0x4859('0x2'));var fs=require('fs');var Redis=require(_0x4859('0x3'));var db=require(_0x4859('0x4'))['db'];var utils=require(_0x4859('0x5'));var logger=require(_0x4859('0x6'))(_0x4859('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4859('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x190833,_0x33b9ff,_0x497209){return new BPromise(function(_0x328ebf,_0x1eca74){return client[_0x4859('0x9')](_0x190833,_0x497209)[_0x4859('0xa')](function(_0x42e2ba){logger[_0x4859('0xb')](_0x4859('0xc'),_0x33b9ff,_0x4859('0xd'));logger[_0x4859('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x33b9ff,_0x4859('0xd'),JSON['stringify'](_0x42e2ba));if(_0x42e2ba['error']){if(_0x42e2ba[_0x4859('0xf')][_0x4859('0x10')]===0x1f4){logger['error'](_0x4859('0xc'),_0x33b9ff,_0x42e2ba[_0x4859('0xf')][_0x4859('0x11')]);return _0x1eca74(_0x42e2ba['error'][_0x4859('0x11')]);}logger[_0x4859('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x33b9ff,_0x42e2ba[_0x4859('0xf')][_0x4859('0x11')]);return _0x328ebf(_0x42e2ba[_0x4859('0xf')]['message']);}else{logger[_0x4859('0xb')](_0x4859('0xc'),_0x33b9ff,_0x4859('0xd'));_0x328ebf(_0x42e2ba['result'][_0x4859('0x11')]);}})[_0x4859('0x12')](function(_0x4fec39){logger[_0x4859('0xf')](_0x4859('0xc'),_0x33b9ff,_0x4fec39);_0x1eca74(_0x4fec39);});});}exports[_0x4859('0x13')]=function(_0x4c6b48){var _0x189d1b=this;return new Promise(function(_0x27d892,_0x269c10){return db[_0x4859('0x14')][_0x4859('0x15')]({'raw':_0x4c6b48[_0x4859('0x16')]?_0x4c6b48[_0x4859('0x16')][_0x4859('0x17')]===undefined?!![]:![]:!![],'where':_0x4c6b48[_0x4859('0x16')]?_0x4c6b48[_0x4859('0x16')][_0x4859('0x18')]||null:null,'attributes':_0x4c6b48[_0x4859('0x16')]?_0x4c6b48[_0x4859('0x16')]['attributes']||null:null,'limit':_0x4c6b48['options']?_0x4c6b48[_0x4859('0x16')][_0x4859('0x19')]||null:null,'include':_0x4c6b48[_0x4859('0x16')]?_0x4c6b48[_0x4859('0x16')]['include']?_[_0x4859('0x1a')](_0x4c6b48[_0x4859('0x16')]['include'],function(_0x1d8433){return{'model':db[_0x1d8433[_0x4859('0x1b')]],'as':_0x1d8433['as'],'attributes':_0x1d8433['attributes'],'include':_0x1d8433['include']?_[_0x4859('0x1a')](_0x1d8433[_0x4859('0x1c')],function(_0x4f93a5){return{'model':db[_0x4f93a5['model']],'as':_0x4f93a5['as'],'attributes':_0x4f93a5[_0x4859('0x1d')],'include':_0x4f93a5['include']?_['map'](_0x4f93a5[_0x4859('0x1c')],function(_0x3042c2){return{'model':db[_0x3042c2[_0x4859('0x1b')]],'as':_0x3042c2['as'],'attributes':_0x3042c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x4859('0xa')](function(_0x5c875f){logger[_0x4859('0xb')](_0x4859('0x13'),_0x4c6b48);logger[_0x4859('0xe')](_0x4859('0x13'),_0x4c6b48,JSON[_0x4859('0x1e')](_0x5c875f));_0x27d892(_0x5c875f);})[_0x4859('0x12')](function(_0x189acd){logger['error']('GetCmHopperBlack',_0x189acd['message'],_0x4c6b48);_0x269c10(_0x189d1b['error'](0x1f4,_0x189acd[_0x4859('0x11')]));});});};exports['UpdateCmHopperBlack']=function(_0x5e10f8){var _0x3019f3=this;return new Promise(function(_0x76cd17,_0x2baba2){return db['CmHopperBlack'][_0x4859('0x1f')](_0x5e10f8[_0x4859('0x20')],{'raw':_0x5e10f8['options']?_0x5e10f8[_0x4859('0x16')][_0x4859('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e10f8['options']?_0x5e10f8[_0x4859('0x16')][_0x4859('0x18')]||null:null,'attributes':_0x5e10f8[_0x4859('0x16')]?_0x5e10f8[_0x4859('0x16')][_0x4859('0x1d')]||null:null,'limit':_0x5e10f8[_0x4859('0x16')]?_0x5e10f8['options'][_0x4859('0x19')]||null:null})['then'](function(_0x42d58d){logger[_0x4859('0xb')](_0x4859('0x21'),_0x5e10f8);logger[_0x4859('0xe')](_0x4859('0x21'),_0x5e10f8,JSON['stringify'](_0x42d58d));_0x76cd17(_0x42d58d);})[_0x4859('0x12')](function(_0xce0bae){logger[_0x4859('0xf')]('UpdateCmHopperBlack',_0xce0bae[_0x4859('0x11')],_0x5e10f8);_0x2baba2(_0x3019f3['error'](0x1f4,_0xce0bae[_0x4859('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x44d345){var _0x2e2f13=this;return new Promise(function(_0x3589dc,_0x4afb02){return db[_0x4859('0x14')][_0x4859('0x22')]({'where':_0x44d345[_0x4859('0x16')]?_0x44d345[_0x4859('0x16')][_0x4859('0x18')]||null:null})['then'](function(_0x41a3a1){logger[_0x4859('0xb')](_0x4859('0x23'),_0x44d345);logger[_0x4859('0xe')](_0x4859('0x23'),_0x44d345,JSON[_0x4859('0x1e')](_0x41a3a1));_0x3589dc(_0x41a3a1);})[_0x4859('0x12')](function(_0x11f307){logger[_0x4859('0xf')](_0x4859('0x23'),_0x11f307['message'],_0x44d345);_0x4afb02(_0x2e2f13['error'](0x1f4,_0x11f307[_0x4859('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 4ddc46d..1ea492e 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 _0x4bd3=['put','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x4bd3,0x174));var _0x34bd=function(_0x2fce37,_0x5ced4c){_0x2fce37=_0x2fce37-0x0;var _0x8c9c13=_0x4bd3[_0x2fce37];return _0x8c9c13;};'use strict';var multer=require(_0x34bd('0x0'));var util=require('util');var path=require(_0x34bd('0x1'));var timeout=require(_0x34bd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x34bd('0x3'));var interaction=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var controller=require('./cmHopperBlack.controller');router[_0x34bd('0x6')]('/',auth[_0x34bd('0x7')](),controller['index']);router[_0x34bd('0x6')](_0x34bd('0x8'),auth['isAuthenticated'](),controller[_0x34bd('0x9')]);router[_0x34bd('0x6')](_0x34bd('0xa'),auth[_0x34bd('0x7')](),controller[_0x34bd('0xb')]);router[_0x34bd('0xc')]('/:id',auth[_0x34bd('0x7')](),controller[_0x34bd('0xd')]);router[_0x34bd('0xe')](_0x34bd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x34bd('0xf')]=router; \ No newline at end of file +var _0x11e5=['update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','put'];(function(_0x5a8f47,_0x35b72f){var _0x45a798=function(_0x562c69){while(--_0x562c69){_0x5a8f47['push'](_0x5a8f47['shift']());}};_0x45a798(++_0x35b72f);}(_0x11e5,0x8b));var _0x511e=function(_0x57f345,_0x316929){_0x57f345=_0x57f345-0x0;var _0x255e43=_0x11e5[_0x57f345];return _0x255e43;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0x9')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0xd')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xe')]);router[_0x511e('0xf')](_0x511e('0xb'),auth['isAuthenticated'](),controller[_0x511e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 5026e17..02164e6 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 _0xc661=['diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','DATE','STRING','endtime','setDataValue','followuptime'];(function(_0x40288d,_0x1bad3c){var _0x23d77a=function(_0x2cd745){while(--_0x2cd745){_0x40288d['push'](_0x40288d['shift']());}};_0x23d77a(++_0x1bad3c);}(_0xc661,0x13b));var _0x1c66=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xc661[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0x1c66('0x0'));var moment=require(_0x1c66('0x1'));module[_0x1c66('0x2')]={'state':{'type':Sequelize[_0x1c66('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1c66('0x4')]},'countbusyretry':{'type':Sequelize[_0x1c66('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1c66('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1c66('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1c66('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1c66('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x1c66('0x5')]},'originatecalleridname':{'type':Sequelize[_0x1c66('0x5')]},'calleridnum':{'type':Sequelize[_0x1c66('0x5')]},'calleridname':{'type':Sequelize[_0x1c66('0x5')]},'starttime':{'type':Sequelize[_0x1c66('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x1c66('0x4')]},'endtime':{'type':Sequelize[_0x1c66('0x4')]},'ringtime':{'type':Sequelize[_0x1c66('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1c66('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1c66('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1c66('0x5')]},'campaign':{'type':Sequelize[_0x1c66('0x5')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1c66('0x5')]},'reason':{'type':Sequelize[_0x1c66('0x5')]},'disposition':{'type':Sequelize[_0x1c66('0x5')]},'secondDisposition':{'type':Sequelize[_0x1c66('0x5')]},'thirdDisposition':{'type':Sequelize[_0x1c66('0x5')]},'dispositionat':{'type':Sequelize[_0x1c66('0x4')],'set':function(_0x1009de){var _0x2c0b19=this['getDataValue'](_0x1c66('0x6'));if(_0x2c0b19&&_0x1009de){this[_0x1c66('0x7')](_0x1c66('0x8'),moment(_0x1009de)[_0x1c66('0x9')](moment(_0x2c0b19),_0x1c66('0xa')));}return this['setDataValue']('dispositionat',_0x1009de);}},'amd':{'type':Sequelize[_0x1c66('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1c66('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1c66('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1c66('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1c66('0x4')]},'recallme':{'type':Sequelize[_0x1c66('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1c66('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1c66('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1c66('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1c66('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1c66('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa3e1=['BOOLEAN','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff','seconds','dispositionat'];(function(_0x2c9ea0,_0x6bee8b){var _0x6824b8=function(_0x8aa267){while(--_0x8aa267){_0x2c9ea0['push'](_0x2c9ea0['shift']());}};_0x6824b8(++_0x6bee8b);}(_0xa3e1,0x18d));var _0x1a3e=function(_0x4e56a2,_0x5a241c){_0x4e56a2=_0x4e56a2-0x0;var _0x1e819c=_0xa3e1[_0x4e56a2];return _0x1e819c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1a3e('0x0')]={'state':{'type':Sequelize[_0x1a3e('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1a3e('0x2')]},'scheduledat':{'type':Sequelize[_0x1a3e('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1a3e('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1a3e('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1a3e('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1a3e('0x2')]},'starttime':{'type':Sequelize[_0x1a3e('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x1a3e('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1a3e('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1a3e('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1a3e('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1a3e('0x2')]},'campaign':{'type':Sequelize[_0x1a3e('0x2')]},'campaigntype':{'type':Sequelize[_0x1a3e('0x2')]},'membername':{'type':Sequelize[_0x1a3e('0x2')]},'reason':{'type':Sequelize[_0x1a3e('0x2')]},'disposition':{'type':Sequelize[_0x1a3e('0x2')]},'secondDisposition':{'type':Sequelize[_0x1a3e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1a3e('0x2')]},'dispositionat':{'type':Sequelize[_0x1a3e('0x3')],'set':function(_0x4fa994){var _0x1f1755=this[_0x1a3e('0x4')](_0x1a3e('0x5'));if(_0x1f1755&&_0x4fa994){this[_0x1a3e('0x6')]('followuptime',moment(_0x4fa994)[_0x1a3e('0x7')](moment(_0x1f1755),_0x1a3e('0x8')));}return this[_0x1a3e('0x6')](_0x1a3e('0x9'),_0x4fa994);}},'amd':{'type':Sequelize[_0x1a3e('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1a3e('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x1a3e('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1a3e('0x3')]},'callback':{'type':Sequelize[_0x1a3e('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1a3e('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1a3e('0x3')]},'deleted':{'type':Sequelize[_0x1a3e('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1a3e('0x3')]},'recallme':{'type':Sequelize[_0x1a3e('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1a3e('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x1a3e('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1a3e('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1a3e('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1a3e('0x1')],'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 83897f6..748d17e 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 _0x01d9=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noAnswerContacts','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','fromQuery','CampaignId','updatedAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment'];(function(_0x4be36d,_0x30b4bb){var _0x27ed25=function(_0x2cf42c){while(--_0x2cf42c){_0x4be36d['push'](_0x4be36d['shift']());}};_0x27ed25(++_0x30b4bb);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':!![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['CmHopperFinal'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')]()[_0x901d('0x28')](respondWithResult(_0x27459b,null))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x2cd965,_0x23f2a9){if(_0x2cd965['body']['uniqueid']){delete _0x2cd965[_0x901d('0x4c')][_0x901d('0x4d')];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'uniqueid':_0x2cd965[_0x901d('0x48')]['id']}})['then'](handleEntityNotFound(_0x23f2a9,null))['then'](saveUpdates(_0x2cd965[_0x901d('0x4c')],null))[_0x901d('0x28')](respondWithResult(_0x23f2a9,null))['catch'](handleError(_0x23f2a9,null));};exports[_0x901d('0x4e')]=function(_0x165207,_0x4d2b2d,_0x4512e5){return db['CmHopperFinal'][_0x901d('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x165207[_0x901d('0x48')]['id']},'attributes':[[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x53')))),_0x901d('0x54')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x55')))),'noAnswerContacts'],[db[_0x901d('0x50')]['fn']('COUNT',db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x56')))),_0x901d('0x57')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db['sequelize'][_0x901d('0x52')](_0x901d('0x58')))),_0x901d('0x59')],[db['sequelize']['fn'](_0x901d('0x51'),db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5a')))),'dropContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5b')))),'abandonedContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5c')))),'reCallContacts'],[db[_0x901d('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x901d('0x5d')))),_0x901d('0x5e')]]})[_0x901d('0x28')](handleEntityNotFound(_0x4d2b2d,null))['then'](respondWithResult(_0x4d2b2d,null))[_0x901d('0x46')](handleError(_0x4d2b2d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xabab57,_0x219c23,_0xecc8f9){return db[_0x901d('0x2f')][_0x901d('0x4f')]({'raw':![],'where':{'CampaignId':_0xabab57[_0x901d('0x48')]['id']},'attributes':[[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x53')))),_0x901d('0x54')],[db[_0x901d('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x55')))),_0x901d('0x5f')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x901d('0x57')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x58')))),_0x901d('0x59')],[db[_0x901d('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5a')))),_0x901d('0x60')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5b')))),'abandonedContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x901d('0x52')](_0x901d('0x5c')))),'reCallContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')]['literal'](_0x901d('0x5d')))),_0x901d('0x5e')]]})[_0x901d('0x28')](handleEntityNotFound(_0x219c23,null))[_0x901d('0x28')](respondWithResult(_0x219c23,null))[_0x901d('0x46')](handleError(_0x219c23,null));};exports[_0x901d('0x61')]=function(_0x5cff96,_0x130dfb,_0x302049){return db[_0x901d('0x62')]['find']({'where':{'id':_0x5cff96[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x130dfb,null))[_0x901d('0x28')](function(_0x4b5e3b){var _0x576d50;if(_0x4b5e3b){_0x576d50=squel['insert']()[_0x901d('0x63')](_0x901d('0x64'))['fromQuery'](['phone',_0x901d('0x65'),_0x901d('0x66'),_0x901d('0x67'),_0x901d('0x68'),_0x901d('0x69'),'updatedAt'],squel[_0x901d('0x6a')]()[_0x901d('0x6b')](_0x901d('0x6c'),_0x901d('0x6d'))['field'](_0x901d('0x6e'),'scheduledAt')[_0x901d('0x6b')]('ANY_VALUE(ContactId)',_0x901d('0x66'))[_0x901d('0x6b')](_0x901d('0x6f'),_0x901d('0x67'))[_0x901d('0x6b')](_0x901d('0x70'),_0x901d('0x68'))['field'](_0x901d('0x6e'),_0x901d('0x69'))['field'](_0x901d('0x6e'),'updatedAt')['from']('cm_hopper_final')['where'](_0x901d('0x71'),_0x5cff96[_0x901d('0x48')]['id']['toString']())[_0x901d('0x3e')](_0x901d('0x72'),_0x5cff96[_0x901d('0x4c')][_0x901d('0x73')][_0x901d('0x74')]())['where'](_0x901d('0x75'))[_0x901d('0x3e')](_0x901d('0x76'),squel['select']()[_0x901d('0x6b')](_0x901d('0x6d'))[_0x901d('0x77')](_0x901d('0x64'))[_0x901d('0x3e')](_0x901d('0x71'),_0x5cff96[_0x901d('0x48')]['id'][_0x901d('0x74')]()))[_0x901d('0x3e')](_0x901d('0x76'),squel[_0x901d('0x6a')]()[_0x901d('0x6b')](_0x901d('0x78'))['from'](_0x901d('0x79'))[_0x901d('0x3e')](_0x901d('0x71'),_0x5cff96[_0x901d('0x48')]['id'][_0x901d('0x74')]())[_0x901d('0x3e')](_0x901d('0x7a')))[_0x901d('0x7b')]('ContactId'))[_0x901d('0x74')]();return db[_0x901d('0x50')][_0x901d('0x35')](_0x576d50);}return[];})['then'](respondWithResult(_0x130dfb,null))[_0x901d('0x46')](handleError(_0x130dfb,null));};exports[_0x901d('0x7c')]=function(_0xa14cbd,_0x34f33f,_0x785f77){return db[_0x901d('0x7d')][_0x901d('0x4a')]({'where':{'id':_0xa14cbd[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x34f33f,null))[_0x901d('0x28')](function(_0x28b640){var _0x45601a;if(_0x28b640){_0x45601a=squel[_0x901d('0x7e')]()[_0x901d('0x63')](_0x901d('0x64'))[_0x901d('0x7f')](['phone',_0x901d('0x65'),_0x901d('0x66'),_0x901d('0x67'),_0x901d('0x80'),_0x901d('0x69'),_0x901d('0x81')],squel['select']()[_0x901d('0x6b')](_0x901d('0x6c'),_0x901d('0x6d'))[_0x901d('0x6b')](_0x901d('0x6e'),_0x901d('0x65'))[_0x901d('0x6b')]('ANY_VALUE(ContactId)',_0x901d('0x66'))['field'](_0x901d('0x6f'),_0x901d('0x67'))[_0x901d('0x6b')](_0x901d('0x82'),'CampaignId')['field']('NOW()','createdAt')[_0x901d('0x6b')](_0x901d('0x6e'),'updatedAt')['from']('cm_hopper_final')[_0x901d('0x3e')]('CampaignId\x20=\x20?',_0xa14cbd[_0x901d('0x48')]['id'][_0x901d('0x74')]())[_0x901d('0x3e')]('state\x20=\x20?',_0xa14cbd['body'][_0x901d('0x73')][_0x901d('0x74')]())[_0x901d('0x3e')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x901d('0x6a')]()[_0x901d('0x6b')]('phone')[_0x901d('0x77')]('cm_hopper')['where'](_0x901d('0x83'),_0xa14cbd['params']['id'][_0x901d('0x74')]()))[_0x901d('0x3e')](_0x901d('0x76'),squel[_0x901d('0x6a')]()[_0x901d('0x6b')](_0x901d('0x78'))['from'](_0x901d('0x79'))[_0x901d('0x3e')](_0x901d('0x83'),_0xa14cbd[_0x901d('0x48')]['id'][_0x901d('0x74')]())[_0x901d('0x3e')]('state\x20=\x204'))['group'](_0x901d('0x66')))[_0x901d('0x74')]();return db[_0x901d('0x50')][_0x901d('0x35')](_0x45601a);}return[];})[_0x901d('0x28')](respondWithResult(_0x34f33f,null))[_0x901d('0x46')](handleError(_0x34f33f,null));};exports[_0x901d('0x84')]=function(_0x306491,_0x3cb399,_0x101067){return db['CmHopper'][_0x901d('0x85')]({'where':{'VoiceQueueId':_0x306491[_0x901d('0x4c')][_0x901d('0x68')],'CampaignId':_0x306491[_0x901d('0x4c')][_0x901d('0x80')],'ContactId':_0x306491[_0x901d('0x4c')][_0x901d('0x66')]}})[_0x901d('0x28')](handleEntityNotFound(_0x3cb399,null))[_0x901d('0x28')](function(_0x17b7ef){if(_0x17b7ef){return _0x17b7ef;}return null;})[_0x901d('0x28')](respondWithResult(_0x3cb399,null))[_0x901d('0x46')](handleError(_0x3cb399,null));}; \ No newline at end of file +var _0x814b=['into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','Campaign','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','CmHopperFinal','includeAll','include','findAll','catch','params','find','describe','body','uniqueid','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','COUNT','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x814b,0x1a2));var _0xb814=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x814b[_0x5180c3];return _0x55c975;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}exports[_0xb814('0x2e')]=function(_0x52ed64,_0x9008b2){var _0x37d24d={},_0x530744={},_0x499f22={'count':0x0,'rows':[]};var _0x20577b=_[_0xb814('0x2f')](db['CmHopperFinal'][_0xb814('0x30')],function(_0x526610){return{'name':_0x526610[_0xb814('0x31')],'type':_0x526610['type']['key']};});_0x530744[_0xb814('0x32')]=_['map'](_0x20577b,_0xb814('0x2c'));_0x530744[_0xb814('0x33')]=_[_0xb814('0x34')](_0x52ed64['query']);_0x530744['filters']=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],_0x530744['query']);_0x37d24d[_0xb814('0x36')]=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],qs[_0xb814('0x37')](_0x52ed64[_0xb814('0x33')][_0xb814('0x37')]));_0x37d24d[_0xb814('0x36')]=_0x37d24d['attributes'][_0xb814('0x38')]?_0x37d24d[_0xb814('0x36')]:_0x530744[_0xb814('0x32')];if(!_0x52ed64[_0xb814('0x33')][_0xb814('0x39')]('nolimit')){_0x37d24d[_0xb814('0x21')]=qs['limit'](_0x52ed64[_0xb814('0x33')][_0xb814('0x21')]);_0x37d24d[_0xb814('0x1f')]=qs['offset'](_0x52ed64[_0xb814('0x33')][_0xb814('0x1f')]);}_0x37d24d['order']=qs[_0xb814('0x3a')](_0x52ed64[_0xb814('0x33')][_0xb814('0x3a')]);_0x37d24d[_0xb814('0x3b')]=qs[_0xb814('0x3c')](_[_0xb814('0x3d')](_0x52ed64['query'],_0x530744[_0xb814('0x3c')]),_0x20577b);if(_0x52ed64['query'][_0xb814('0x3e')]){_0x37d24d['where']=_[_0xb814('0x3f')](_0x37d24d['where'],{'$or':_[_0xb814('0x2f')](_0x20577b,function(_0x26675a){if(_0x26675a['type']!=='VIRTUAL'){var _0x5dd6bc={};_0x5dd6bc[_0x26675a['name']]={'$like':'%'+_0x52ed64[_0xb814('0x33')][_0xb814('0x3e')]+'%'};return _0x5dd6bc;}})});}_0x37d24d=_[_0xb814('0x3f')]({},_0x37d24d,_0x52ed64[_0xb814('0x40')]);var _0x51cdba={'where':_0x37d24d['where']};return db[_0xb814('0x41')]['count'](_0x51cdba)[_0xb814('0x28')](function(_0x1098eb){_0x499f22[_0xb814('0x22')]=_0x1098eb;if(_0x52ed64[_0xb814('0x33')][_0xb814('0x42')]){_0x37d24d[_0xb814('0x43')]=[{'all':!![]}];}return db[_0xb814('0x41')][_0xb814('0x44')](_0x37d24d);})[_0xb814('0x28')](function(_0x4b6ff8){_0x499f22['rows']=_0x4b6ff8;return _0x499f22;})['then'](respondWithFilteredResult(_0x9008b2,_0x37d24d))[_0xb814('0x45')](handleError(_0x9008b2,null));};exports['show']=function(_0x29416a,_0x580171){var _0x411723={'raw':!![],'where':{'id':_0x29416a[_0xb814('0x46')]['id']}},_0x44ff56={};_0x44ff56[_0xb814('0x32')]=_['keys'](db[_0xb814('0x41')][_0xb814('0x30')]);_0x44ff56[_0xb814('0x33')]=_[_0xb814('0x34')](_0x29416a[_0xb814('0x33')]);_0x44ff56[_0xb814('0x3c')]=_['intersection'](_0x44ff56[_0xb814('0x32')],_0x44ff56[_0xb814('0x33')]);_0x411723[_0xb814('0x36')]=_[_0xb814('0x35')](_0x44ff56[_0xb814('0x32')],qs[_0xb814('0x37')](_0x29416a[_0xb814('0x33')]['fields']));_0x411723['attributes']=_0x411723[_0xb814('0x36')][_0xb814('0x38')]?_0x411723[_0xb814('0x36')]:_0x44ff56[_0xb814('0x32')];if(_0x29416a[_0xb814('0x33')][_0xb814('0x42')]){_0x411723[_0xb814('0x43')]=[{'all':!![]}];}_0x411723=_[_0xb814('0x3f')]({},_0x411723,_0x29416a[_0xb814('0x40')]);return db[_0xb814('0x41')][_0xb814('0x47')](_0x411723)['then'](handleEntityNotFound(_0x580171,null))[_0xb814('0x28')](respondWithResult(_0x580171,null))[_0xb814('0x45')](handleError(_0x580171,null));};exports['describe']=function(_0x338e80,_0x55234d){return db[_0xb814('0x41')][_0xb814('0x48')]()[_0xb814('0x28')](respondWithResult(_0x55234d,null))[_0xb814('0x45')](handleError(_0x55234d,null));};exports[_0xb814('0x27')]=function(_0x4096d4,_0x2cc806){if(_0x4096d4[_0xb814('0x49')][_0xb814('0x4a')]){delete _0x4096d4[_0xb814('0x49')]['uniqueid'];}return db['CmHopperFinal'][_0xb814('0x47')]({'where':{'uniqueid':_0x4096d4[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x2cc806,null))[_0xb814('0x28')](saveUpdates(_0x4096d4[_0xb814('0x49')],null))[_0xb814('0x28')](respondWithResult(_0x2cc806,null))[_0xb814('0x45')](handleError(_0x2cc806,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x26fd0b,_0x388324,_0xf27a6e){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x26fd0b['params']['id']},'attributes':[[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),_0xb814('0x4d')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x4f')))),'noAnswerContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),'busyContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x51')))),'congestionContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x53')))),_0xb814('0x54')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x55')))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb814('0x57')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x388324,null))[_0xb814('0x28')](respondWithResult(_0x388324,null))[_0xb814('0x45')](handleError(_0x388324,null));};exports[_0xb814('0x5a')]=function(_0x2e5f99,_0x113350,_0x46014f){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'CampaignId':_0x2e5f99[_0xb814('0x46')]['id']},'attributes':[[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),'noSuchContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0xb814('0x5b')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),_0xb814('0x5c')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x51')))),_0xb814('0x5d')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x53')))),'dropContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x5e')))),_0xb814('0x57')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x113350,null))['then'](respondWithResult(_0x113350,null))[_0xb814('0x45')](handleError(_0x113350,null));};exports[_0xb814('0x5f')]=function(_0xee204,_0x5aabbe,_0x30f717){return db[_0xb814('0x60')][_0xb814('0x47')]({'where':{'id':_0xee204[_0xb814('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aabbe,null))['then'](function(_0x28eaf8){var _0x295488;if(_0x28eaf8){_0x295488=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))[_0xb814('0x64')]([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),_0xb814('0x69'),_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('ANY_VALUE(calleridnum)',_0xb814('0x65'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x66'))[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))[_0xb814('0x6d')](_0xb814('0x70'),_0xb814('0x69'))[_0xb814('0x6d')]('NOW()','createdAt')[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6b'))[_0xb814('0x71')]('cm_hopper_final')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())['where']('state\x20=\x20?',_0xee204[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('phone')[_0xb814('0x71')]('cm_hopper')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]()))['where'](_0xb814('0x74'),squel['select']()[_0xb814('0x6d')](_0xb814('0x75'))['from']('cm_hopper_final')[_0xb814('0x3b')](_0xb814('0x76'),_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x77')))[_0xb814('0x78')](_0xb814('0x67')))[_0xb814('0x72')]();return db[_0xb814('0x4b')]['query'](_0x295488);}return[];})['then'](respondWithResult(_0x5aabbe,null))['catch'](handleError(_0x5aabbe,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x52b6da,_0x45a202,_0x75a33){return db[_0xb814('0x79')]['find']({'where':{'id':_0x52b6da[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x45a202,null))[_0xb814('0x28')](function(_0x26ce5b){var _0x161658;if(_0x26ce5b){_0x161658=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))['fromQuery']([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),'CampaignId',_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x7a'),'phone')['field'](_0xb814('0x6e'),'scheduledAt')[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))['field'](_0xb814('0x7b'),_0xb814('0x7c'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6a'))[_0xb814('0x6d')](_0xb814('0x6e'),'updatedAt')['from'](_0xb814('0x7d'))['where']('CampaignId\x20=\x20?',_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x20?',_0x52b6da[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x65'))['from'](_0xb814('0x63'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da['params']['id'][_0xb814('0x72')]()))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x75'))[_0xb814('0x71')](_0xb814('0x7d'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x204'))['group'](_0xb814('0x67')))['toString']();return db[_0xb814('0x4b')][_0xb814('0x33')](_0x161658);}return[];})[_0xb814('0x28')](respondWithResult(_0x45a202,null))[_0xb814('0x45')](handleError(_0x45a202,null));};exports[_0xb814('0x7f')]=function(_0x2f1674,_0xf0610f,_0x5db5d0){return db['CmHopper'][_0xb814('0x80')]({'where':{'VoiceQueueId':_0x2f1674['body'][_0xb814('0x69')],'CampaignId':_0x2f1674[_0xb814('0x49')][_0xb814('0x7c')],'ContactId':_0x2f1674['body'][_0xb814('0x67')]}})[_0xb814('0x28')](handleEntityNotFound(_0xf0610f,null))[_0xb814('0x28')](function(_0x38c6da){if(_0x38c6da){return _0x38c6da;}return null;})[_0xb814('0x28')](respondWithResult(_0xf0610f,null))['catch'](handleError(_0xf0610f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ca395da..1aa8613 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 _0xfd34=['path','rimraf','../../config/environment','exports','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','moment','request-promise'];(function(_0x3ddd29,_0x26f096){var _0x34cb20=function(_0x6bbb15){while(--_0x6bbb15){_0x3ddd29['push'](_0x3ddd29['shift']());}};_0x34cb20(++_0x26f096);}(_0xfd34,0xee));var _0x4fd3=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0xfd34[_0x1911ed];return _0x11edaa;};'use strict';var _=require('lodash');var util=require(_0x4fd3('0x0'));var logger=require(_0x4fd3('0x1'))('api');var moment=require(_0x4fd3('0x2'));var BPromise=require('bluebird');var rp=require(_0x4fd3('0x3'));var fs=require('fs');var path=require(_0x4fd3('0x4'));var rimraf=require(_0x4fd3('0x5'));var config=require(_0x4fd3('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x4fd3('0x7')]=function(_0x5e4e09,_0x5a34b2){return _0x5e4e09['define']('CmHopperFinal',attributes,{'tableName':_0x4fd3('0x8'),'paranoid':![],'indexes':[{'name':_0x4fd3('0x9'),'fields':[_0x4fd3('0x9')]},{'name':_0x4fd3('0xa'),'fields':[_0x4fd3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d8e=['request-promise','path','rimraf','../../config/environment','define','cm_hopper_final','calleridnum','uniqueid','../../config/logger','api','bluebird'];(function(_0x3273a9,_0x1fba06){var _0x2cc2af=function(_0x33ce0b){while(--_0x33ce0b){_0x3273a9['push'](_0x3273a9['shift']());}};_0x2cc2af(++_0x1fba06);}(_0x4d8e,0x17e));var _0xe4d8=function(_0x3cb2a3,_0x47ee8a){_0x3cb2a3=_0x3cb2a3-0x0;var _0x391888=_0x4d8e[_0x3cb2a3];return _0x391888;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe4d8('0x0'))(_0xe4d8('0x1'));var moment=require('moment');var BPromise=require(_0xe4d8('0x2'));var rp=require(_0xe4d8('0x3'));var fs=require('fs');var path=require(_0xe4d8('0x4'));var rimraf=require(_0xe4d8('0x5'));var config=require(_0xe4d8('0x6'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x46574c,_0x1ce2b6){return _0x46574c[_0xe4d8('0x7')]('CmHopperFinal',attributes,{'tableName':_0xe4d8('0x8'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xe4d8('0x9')]},{'name':_0xe4d8('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 0528d19..6959e56 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(_0x59d4da,_0x1a602d){var _0x49e3d4=function(_0x1111b9){while(--_0x1111b9){_0x59d4da['push'](_0x59d4da['shift']());}};_0x49e3d4(++_0x1a602d);}(_0x7a54,0x106));var _0x47a5=function(_0x2fbb6d,_0x16ee64){_0x2fbb6d=_0x2fbb6d-0x0;var _0x222ebf=_0x7a54[_0x2fbb6d];return _0x222ebf;};'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(_0x261f9f,_0x15aa7c){var _0x1289f4=function(_0x51f620){while(--_0x51f620){_0x261f9f['push'](_0x261f9f['shift']());}};_0x1289f4(++_0x15aa7c);}(_0x7a54,0x106));var _0x47a5=function(_0x42b32a,_0x2d2442){_0x42b32a=_0x42b32a-0x0;var _0x332596=_0x7a54[_0x42b32a];return _0x332596;};'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 de037a3..358b5c8 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 _0xf3d8=['describe','/:id','show','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','get','/describe'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0xf3d8,0x175));var _0x8f3d=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0xf3d8[_0x397f37];return _0x31cae6;};'use strict';var multer=require(_0x8f3d('0x0'));var util=require(_0x8f3d('0x1'));var path=require(_0x8f3d('0x2'));var timeout=require(_0x8f3d('0x3'));var express=require('express');var router=express[_0x8f3d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8f3d('0x5'));var interaction=require(_0x8f3d('0x6'));var config=require('../../config/environment');var controller=require(_0x8f3d('0x7'));router['get']('/',auth[_0x8f3d('0x8')](),controller['index']);router[_0x8f3d('0x9')](_0x8f3d('0xa'),auth[_0x8f3d('0x8')](),controller[_0x8f3d('0xb')]);router[_0x8f3d('0x9')](_0x8f3d('0xc'),auth['isAuthenticated'](),controller[_0x8f3d('0xd')]);router['get']('/voice/queue/countAttributes/:id',auth[_0x8f3d('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x8f3d('0x9')](_0x8f3d('0xe'),auth[_0x8f3d('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x8f3d('0xf')](_0x8f3d('0x10'),auth[_0x8f3d('0x8')](),controller[_0x8f3d('0x11')]);router[_0x8f3d('0xf')](_0x8f3d('0x12'),auth[_0x8f3d('0x8')](),controller[_0x8f3d('0x13')]);router[_0x8f3d('0xf')]('/checkContactHopper',auth[_0x8f3d('0x8')](),controller[_0x8f3d('0x14')]);router[_0x8f3d('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8f3d('0x16')]);module[_0x8f3d('0x17')]=router; \ No newline at end of file +var _0x7c7f=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','put','exports','multer','util'];(function(_0x193f4d,_0x5554bc){var _0x1acb02=function(_0x3e4ad5){while(--_0x3e4ad5){_0x193f4d['push'](_0x193f4d['shift']());}};_0x1acb02(++_0x5554bc);}(_0x7c7f,0x163));var _0xf7c7=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x7c7f[_0x2ff238];return _0x204a56;};'use strict';var multer=require(_0xf7c7('0x0'));var util=require(_0xf7c7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf7c7('0x2'));var router=express[_0xf7c7('0x3')]();var fs_extra=require(_0xf7c7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf7c7('0x5'));var config=require(_0xf7c7('0x6'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0xf7c7('0x7')](),controller['index']);router['get'](_0xf7c7('0x8'),auth[_0xf7c7('0x7')](),controller[_0xf7c7('0x9')]);router[_0xf7c7('0xa')](_0xf7c7('0xb'),auth['isAuthenticated'](),controller[_0xf7c7('0xc')]);router['get'](_0xf7c7('0xd'),auth[_0xf7c7('0x7')](),controller[_0xf7c7('0xe')]);router[_0xf7c7('0xa')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xf7c7('0xf')](_0xf7c7('0x10'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xf7c7('0xf')](_0xf7c7('0x11'),auth[_0xf7c7('0x7')](),controller[_0xf7c7('0x12')]);router['post']('/checkContactHopper',auth[_0xf7c7('0x7')](),controller['checkContactHopper']);router[_0xf7c7('0x13')](_0xf7c7('0xb'),auth[_0xf7c7('0x7')](),controller['update']);module[_0xf7c7('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 2947c3d..4c8df79 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 _0x029f=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x30d69e,_0x45ec93){var _0x1c6fbe=function(_0x2f0bf8){while(--_0x2f0bf8){_0x30d69e['push'](_0x30d69e['shift']());}};_0x1c6fbe(++_0x45ec93);}(_0x029f,0x1d9));var _0xf029=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x029f[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xf029('0x0'));module[_0xf029('0x1')]={'state':{'type':Sequelize[_0xf029('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf029('0x3')]},'scheduledat':{'type':Sequelize[_0xf029('0x4')]},'countbusyretry':{'type':Sequelize[_0xf029('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf029('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf029('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf029('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf029('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xf029('0x3')]},'originatecalleridname':{'type':Sequelize[_0xf029('0x3')]},'calleridnum':{'type':Sequelize[_0xf029('0x3')]},'calleridname':{'type':Sequelize[_0xf029('0x3')]},'starttime':{'type':Sequelize[_0xf029('0x4')]},'responsetime':{'type':Sequelize[_0xf029('0x4')]},'answertime':{'type':Sequelize[_0xf029('0x4')]},'droptime':{'type':Sequelize[_0xf029('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xf029('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf029('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf029('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf029('0x3')]},'campaign':{'type':Sequelize[_0xf029('0x3')]},'campaigntype':{'type':Sequelize[_0xf029('0x3')]},'membername':{'type':Sequelize[_0xf029('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xf029('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xf029('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf029('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf029('0x4')]},'edited':{'type':Sequelize[_0xf029('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf029('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf029('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf029('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf029('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcc98=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcc98,0x1c0));var _0x8cc9=function(_0x70962,_0xa0ede7){_0x70962=_0x70962-0x0;var _0x330770=_0xcc98[_0x70962];return _0x330770;};'use strict';var Sequelize=require(_0x8cc9('0x0'));module[_0x8cc9('0x1')]={'state':{'type':Sequelize[_0x8cc9('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8cc9('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x8cc9('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8cc9('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8cc9('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8cc9('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8cc9('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8cc9('0x3')]},'originatecalleridname':{'type':Sequelize[_0x8cc9('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8cc9('0x3')]},'starttime':{'type':Sequelize[_0x8cc9('0x4')]},'responsetime':{'type':Sequelize[_0x8cc9('0x4')]},'answertime':{'type':Sequelize[_0x8cc9('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8cc9('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8cc9('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8cc9('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8cc9('0x3')]},'campaign':{'type':Sequelize[_0x8cc9('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8cc9('0x3')]},'reason':{'type':Sequelize[_0x8cc9('0x3')]},'amd':{'type':Sequelize[_0x8cc9('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x8cc9('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8cc9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8cc9('0x4')]},'recallme':{'type':Sequelize[_0x8cc9('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8cc9('0x4')]},'edited':{'type':Sequelize[_0x8cc9('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8cc9('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8cc9('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8cc9('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 89e6670..d37ad0b 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 _0x10d4=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','findAll','rows','show','params','catch','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','CmHopperHistory','rawAttributes'];(function(_0x2eea90,_0xa19cd8){var _0x2a917d=function(_0x972194){while(--_0x972194){_0x2eea90['push'](_0x2eea90['shift']());}};_0x2a917d(++_0xa19cd8);}(_0x10d4,0x1ce));var _0x410d=function(_0x2657fa,_0x15fab8){_0x2657fa=_0x2657fa-0x0;var _0x555b92=_0x10d4[_0x2657fa];return _0x555b92;};'use strict';var emlformat=require(_0x410d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x410d('0x1'));var jsonpatch=require(_0x410d('0x2'));var rp=require(_0x410d('0x3'));var moment=require(_0x410d('0x4'));var BPromise=require(_0x410d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x410d('0x6'));var sox=require(_0x410d('0x7'));var csv=require('to-csv');var ejs=require(_0x410d('0x8'));var fs=require('fs');var fs_extra=require(_0x410d('0x9'));var _=require(_0x410d('0xa'));var squel=require(_0x410d('0xb'));var crypto=require(_0x410d('0xc'));var jsforce=require(_0x410d('0xd'));var deskjs=require(_0x410d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x410d('0xf'));var Papa=require(_0x410d('0x10'));var Redis=require('ioredis');var authService=require(_0x410d('0x11'));var qs=require(_0x410d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x410d('0x13'))(_0x410d('0x14'));var utils=require('../../config/utils');var config=require(_0x410d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x410d('0x16'))['db'];function respondWithStatusCode(_0x2614b0,_0x27df10){_0x27df10=_0x27df10||0xcc;return function(_0x1c2883){if(_0x1c2883){return _0x2614b0[_0x410d('0x17')](_0x27df10);}return _0x2614b0['status'](_0x27df10)[_0x410d('0x18')]();};}function respondWithResult(_0x5572a7,_0x28a4aa){_0x28a4aa=_0x28a4aa||0xc8;return function(_0x2a9d58){if(_0x2a9d58){return _0x5572a7[_0x410d('0x19')](_0x28a4aa)[_0x410d('0x1a')](_0x2a9d58);}};}function respondWithFilteredResult(_0xf298b5,_0x1cef69){return function(_0xfb04b7){if(_0xfb04b7){var _0x3c4996=typeof _0x1cef69[_0x410d('0x1b')]===_0x410d('0x1c')&&typeof _0x1cef69[_0x410d('0x1d')]===_0x410d('0x1c');var _0x37cff2=_0xfb04b7[_0x410d('0x1e')];var _0x581466=_0x3c4996?0x0:_0x1cef69[_0x410d('0x1b')];var _0x18b61b=_0x3c4996?_0xfb04b7[_0x410d('0x1e')]:_0x1cef69[_0x410d('0x1b')]+_0x1cef69[_0x410d('0x1d')];var _0x5c177f;if(_0x18b61b>=_0x37cff2){_0x18b61b=_0x37cff2;_0x5c177f=0xc8;}else{_0x5c177f=0xce;}_0xf298b5[_0x410d('0x19')](_0x5c177f);return _0xf298b5[_0x410d('0x1f')]('Content-Range',_0x581466+'-'+_0x18b61b+'/'+_0x37cff2)['json'](_0xfb04b7);}return null;};}function patchUpdates(_0x55112a){return function(_0x3b1005){try{jsonpatch[_0x410d('0x20')](_0x3b1005,_0x55112a,!![]);}catch(_0x5a59bd){return BPromise['reject'](_0x5a59bd);}return _0x3b1005[_0x410d('0x21')]();};}function saveUpdates(_0x462348,_0x195a7d){return function(_0x3f6ed9){if(_0x3f6ed9){return _0x3f6ed9[_0x410d('0x22')](_0x462348)[_0x410d('0x23')](function(_0x1976c1){return _0x1976c1;});}return null;};}function removeEntity(_0x1fdf55,_0x3b67cc){return function(_0x4a6d2b){if(_0x4a6d2b){return _0x4a6d2b[_0x410d('0x24')]()[_0x410d('0x23')](function(){_0x1fdf55[_0x410d('0x19')](0xcc)[_0x410d('0x18')]();});}};}function handleEntityNotFound(_0x92fa0,_0xf8afe6){return function(_0x42625f){if(!_0x42625f){_0x92fa0['sendStatus'](0x194);}return _0x42625f;};}function handleError(_0xb6e4b0,_0x47cb13){_0x47cb13=_0x47cb13||0x1f4;return function(_0x24ba2b){logger[_0x410d('0x25')](_0x24ba2b[_0x410d('0x26')]);if(_0x24ba2b['name']){delete _0x24ba2b[_0x410d('0x27')];}_0xb6e4b0[_0x410d('0x19')](_0x47cb13)['send'](_0x24ba2b);};}exports['index']=function(_0x2c1698,_0x4add23){var _0x22f9c9={},_0x13fc09={},_0x2bf1cb={'count':0x0,'rows':[]};var _0x5e294e=_['map'](db[_0x410d('0x28')][_0x410d('0x29')],function(_0x19649e){return{'name':_0x19649e['fieldName'],'type':_0x19649e[_0x410d('0x2a')][_0x410d('0x2b')]};});_0x13fc09[_0x410d('0x2c')]=_['map'](_0x5e294e,_0x410d('0x27'));_0x13fc09[_0x410d('0x2d')]=_[_0x410d('0x2e')](_0x2c1698[_0x410d('0x2d')]);_0x13fc09[_0x410d('0x2f')]=_[_0x410d('0x30')](_0x13fc09[_0x410d('0x2c')],_0x13fc09[_0x410d('0x2d')]);_0x22f9c9[_0x410d('0x31')]=_[_0x410d('0x30')](_0x13fc09['model'],qs[_0x410d('0x32')](_0x2c1698[_0x410d('0x2d')][_0x410d('0x32')]));_0x22f9c9['attributes']=_0x22f9c9[_0x410d('0x31')][_0x410d('0x33')]?_0x22f9c9[_0x410d('0x31')]:_0x13fc09['model'];if(!_0x2c1698[_0x410d('0x2d')][_0x410d('0x34')](_0x410d('0x35'))){_0x22f9c9['limit']=qs[_0x410d('0x1d')](_0x2c1698[_0x410d('0x2d')]['limit']);_0x22f9c9[_0x410d('0x1b')]=qs[_0x410d('0x1b')](_0x2c1698['query'][_0x410d('0x1b')]);}_0x22f9c9[_0x410d('0x36')]=qs['sort'](_0x2c1698[_0x410d('0x2d')][_0x410d('0x37')]);_0x22f9c9[_0x410d('0x38')]=qs[_0x410d('0x2f')](_[_0x410d('0x39')](_0x2c1698[_0x410d('0x2d')],_0x13fc09[_0x410d('0x2f')]),_0x5e294e);if(_0x2c1698['query'][_0x410d('0x3a')]){_0x22f9c9['where']=_[_0x410d('0x3b')](_0x22f9c9[_0x410d('0x38')],{'$or':_[_0x410d('0x3c')](_0x5e294e,function(_0xb4ff39){if(_0xb4ff39[_0x410d('0x2a')]!=='VIRTUAL'){var _0x4df221={};_0x4df221[_0xb4ff39['name']]={'$like':'%'+_0x2c1698[_0x410d('0x2d')][_0x410d('0x3a')]+'%'};return _0x4df221;}})});}_0x22f9c9=_['merge']({},_0x22f9c9,_0x2c1698[_0x410d('0x3d')]);var _0x23062b={'where':_0x22f9c9[_0x410d('0x38')]};return db[_0x410d('0x28')][_0x410d('0x1e')](_0x23062b)['then'](function(_0xfdb2d0){_0x2bf1cb['count']=_0xfdb2d0;if(_0x2c1698[_0x410d('0x2d')][_0x410d('0x3e')]){_0x22f9c9['include']=[{'all':!![]}];}return db[_0x410d('0x28')][_0x410d('0x3f')](_0x22f9c9);})['then'](function(_0x94d1d2){_0x2bf1cb[_0x410d('0x40')]=_0x94d1d2;return _0x2bf1cb;})[_0x410d('0x23')](respondWithFilteredResult(_0x4add23,_0x22f9c9))['catch'](handleError(_0x4add23,null));};exports[_0x410d('0x41')]=function(_0x20f416,_0x112711){var _0x574122={'raw':!![],'where':{'id':_0x20f416[_0x410d('0x42')]['id']}},_0x1b0833={};_0x1b0833['model']=_['keys'](db[_0x410d('0x28')][_0x410d('0x29')]);_0x1b0833[_0x410d('0x2d')]=_['keys'](_0x20f416[_0x410d('0x2d')]);_0x1b0833[_0x410d('0x2f')]=_[_0x410d('0x30')](_0x1b0833[_0x410d('0x2c')],_0x1b0833[_0x410d('0x2d')]);_0x574122[_0x410d('0x31')]=_[_0x410d('0x30')](_0x1b0833['model'],qs[_0x410d('0x32')](_0x20f416[_0x410d('0x2d')][_0x410d('0x32')]));_0x574122[_0x410d('0x31')]=_0x574122[_0x410d('0x31')][_0x410d('0x33')]?_0x574122[_0x410d('0x31')]:_0x1b0833['model'];if(_0x20f416[_0x410d('0x2d')][_0x410d('0x3e')]){_0x574122['include']=[{'all':!![]}];}_0x574122=_[_0x410d('0x3b')]({},_0x574122,_0x20f416[_0x410d('0x3d')]);return db[_0x410d('0x28')]['find'](_0x574122)['then'](handleEntityNotFound(_0x112711,null))[_0x410d('0x23')](respondWithResult(_0x112711,null))[_0x410d('0x43')](handleError(_0x112711,null));};exports['create']=function(_0x4434af,_0x3b9d4a){return db[_0x410d('0x28')][_0x410d('0x44')](_0x4434af[_0x410d('0x45')],{})[_0x410d('0x23')](respondWithResult(_0x3b9d4a,0xc9))[_0x410d('0x43')](handleError(_0x3b9d4a,null));};exports[_0x410d('0x46')]=function(_0x11bec9,_0x35c6eb){return db['CmHopperHistory'][_0x410d('0x46')]()[_0x410d('0x23')](respondWithResult(_0x35c6eb,null))[_0x410d('0x43')](handleError(_0x35c6eb,null));};exports[_0x410d('0x22')]=function(_0x599c63,_0x3ad6ee){if(_0x599c63['body'][_0x410d('0x47')]){delete _0x599c63[_0x410d('0x45')][_0x410d('0x47')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x599c63[_0x410d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3ad6ee,null))[_0x410d('0x23')](saveUpdates(_0x599c63[_0x410d('0x45')],null))[_0x410d('0x23')](respondWithResult(_0x3ad6ee,null))[_0x410d('0x43')](handleError(_0x3ad6ee,null));}; \ No newline at end of file +var _0x7545=['json','apply','reject','save','update','destroy','then','error','stack','name','index','map','CmHopperHistory','fieldName','type','key','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','rows','params','model','rawAttributes','length','include','create','body','catch','describe','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','undefined','count','offset','Content-Range'];(function(_0x1a635e,_0x241651){var _0x5b3345=function(_0x5d94d8){while(--_0x5d94d8){_0x1a635e['push'](_0x1a635e['shift']());}};_0x5b3345(++_0x241651);}(_0x7545,0x10c));var _0x5754=function(_0x33d5d7,_0x4c3d7a){_0x33d5d7=_0x33d5d7-0x0;var _0x69bf0c=_0x7545[_0x33d5d7];return _0x69bf0c;};'use strict';var emlformat=require(_0x5754('0x0'));var rimraf=require(_0x5754('0x1'));var zipdir=require(_0x5754('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5754('0x3'));var moment=require(_0x5754('0x4'));var BPromise=require(_0x5754('0x5'));var Mustache=require(_0x5754('0x6'));var util=require('util');var path=require(_0x5754('0x7'));var sox=require(_0x5754('0x8'));var csv=require(_0x5754('0x9'));var ejs=require(_0x5754('0xa'));var fs=require('fs');var fs_extra=require(_0x5754('0xb'));var _=require(_0x5754('0xc'));var squel=require(_0x5754('0xd'));var crypto=require(_0x5754('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5754('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5754('0x10'));var Papa=require(_0x5754('0x11'));var Redis=require('ioredis');var authService=require(_0x5754('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5754('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5754('0x14'));var utils=require(_0x5754('0x15'));var config=require(_0x5754('0x16'));var licenseUtil=require(_0x5754('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27bc0d,_0xbd081){_0xbd081=_0xbd081||0xcc;return function(_0x5d6aa5){if(_0x5d6aa5){return _0x27bc0d[_0x5754('0x18')](_0xbd081);}return _0x27bc0d[_0x5754('0x19')](_0xbd081)[_0x5754('0x1a')]();};}function respondWithResult(_0x4da0c9,_0x48858e){_0x48858e=_0x48858e||0xc8;return function(_0x565174){if(_0x565174){return _0x4da0c9[_0x5754('0x19')](_0x48858e)['json'](_0x565174);}};}function respondWithFilteredResult(_0x1af655,_0x191e30){return function(_0x3ddb01){if(_0x3ddb01){var _0x37235a=typeof _0x191e30['offset']==='undefined'&&typeof _0x191e30[_0x5754('0x1b')]===_0x5754('0x1c');var _0x4af3a3=_0x3ddb01[_0x5754('0x1d')];var _0x41568c=_0x37235a?0x0:_0x191e30[_0x5754('0x1e')];var _0xeb600f=_0x37235a?_0x3ddb01['count']:_0x191e30[_0x5754('0x1e')]+_0x191e30[_0x5754('0x1b')];var _0x27ca03;if(_0xeb600f>=_0x4af3a3){_0xeb600f=_0x4af3a3;_0x27ca03=0xc8;}else{_0x27ca03=0xce;}_0x1af655[_0x5754('0x19')](_0x27ca03);return _0x1af655['set'](_0x5754('0x1f'),_0x41568c+'-'+_0xeb600f+'/'+_0x4af3a3)[_0x5754('0x20')](_0x3ddb01);}return null;};}function patchUpdates(_0x9efed9){return function(_0x72b953){try{jsonpatch[_0x5754('0x21')](_0x72b953,_0x9efed9,!![]);}catch(_0x356da4){return BPromise[_0x5754('0x22')](_0x356da4);}return _0x72b953[_0x5754('0x23')]();};}function saveUpdates(_0x24f264,_0x3af365){return function(_0x1d71dc){if(_0x1d71dc){return _0x1d71dc[_0x5754('0x24')](_0x24f264)['then'](function(_0xee4105){return _0xee4105;});}return null;};}function removeEntity(_0x44a065,_0x59cae9){return function(_0x261315){if(_0x261315){return _0x261315[_0x5754('0x25')]()[_0x5754('0x26')](function(){_0x44a065[_0x5754('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c5efc,_0x445335){return function(_0x4d2dff){if(!_0x4d2dff){_0x5c5efc[_0x5754('0x18')](0x194);}return _0x4d2dff;};}function handleError(_0x51ba23,_0x588e0e){_0x588e0e=_0x588e0e||0x1f4;return function(_0x24f369){logger[_0x5754('0x27')](_0x24f369[_0x5754('0x28')]);if(_0x24f369[_0x5754('0x29')]){delete _0x24f369[_0x5754('0x29')];}_0x51ba23['status'](_0x588e0e)['send'](_0x24f369);};}exports[_0x5754('0x2a')]=function(_0x5464d4,_0x18479f){var _0x15b81b={},_0x104bf5={},_0x2ebaa5={'count':0x0,'rows':[]};var _0x19452c=_[_0x5754('0x2b')](db[_0x5754('0x2c')]['rawAttributes'],function(_0x4735d8){return{'name':_0x4735d8[_0x5754('0x2d')],'type':_0x4735d8[_0x5754('0x2e')][_0x5754('0x2f')]};});_0x104bf5['model']=_[_0x5754('0x2b')](_0x19452c,_0x5754('0x29'));_0x104bf5[_0x5754('0x30')]=_[_0x5754('0x31')](_0x5464d4[_0x5754('0x30')]);_0x104bf5[_0x5754('0x32')]=_[_0x5754('0x33')](_0x104bf5['model'],_0x104bf5['query']);_0x15b81b[_0x5754('0x34')]=_['intersection'](_0x104bf5['model'],qs['fields'](_0x5464d4['query'][_0x5754('0x35')]));_0x15b81b[_0x5754('0x34')]=_0x15b81b[_0x5754('0x34')]['length']?_0x15b81b[_0x5754('0x34')]:_0x104bf5['model'];if(!_0x5464d4[_0x5754('0x30')]['hasOwnProperty'](_0x5754('0x36'))){_0x15b81b[_0x5754('0x1b')]=qs[_0x5754('0x1b')](_0x5464d4[_0x5754('0x30')][_0x5754('0x1b')]);_0x15b81b[_0x5754('0x1e')]=qs[_0x5754('0x1e')](_0x5464d4[_0x5754('0x30')][_0x5754('0x1e')]);}_0x15b81b[_0x5754('0x37')]=qs[_0x5754('0x38')](_0x5464d4[_0x5754('0x30')][_0x5754('0x38')]);_0x15b81b[_0x5754('0x39')]=qs[_0x5754('0x32')](_[_0x5754('0x3a')](_0x5464d4['query'],_0x104bf5[_0x5754('0x32')]),_0x19452c);if(_0x5464d4['query']['filter']){_0x15b81b[_0x5754('0x39')]=_['merge'](_0x15b81b[_0x5754('0x39')],{'$or':_[_0x5754('0x2b')](_0x19452c,function(_0x5c149f){if(_0x5c149f[_0x5754('0x2e')]!==_0x5754('0x3b')){var _0x43205a={};_0x43205a[_0x5c149f[_0x5754('0x29')]]={'$like':'%'+_0x5464d4['query'][_0x5754('0x3c')]+'%'};return _0x43205a;}})});}_0x15b81b=_[_0x5754('0x3d')]({},_0x15b81b,_0x5464d4['options']);var _0x4965de={'where':_0x15b81b[_0x5754('0x39')]};return db[_0x5754('0x2c')][_0x5754('0x1d')](_0x4965de)[_0x5754('0x26')](function(_0x3fa9f9){_0x2ebaa5['count']=_0x3fa9f9;if(_0x5464d4[_0x5754('0x30')][_0x5754('0x3e')]){_0x15b81b['include']=[{'all':!![]}];}return db[_0x5754('0x2c')][_0x5754('0x3f')](_0x15b81b);})['then'](function(_0x3dce69){_0x2ebaa5[_0x5754('0x40')]=_0x3dce69;return _0x2ebaa5;})[_0x5754('0x26')](respondWithFilteredResult(_0x18479f,_0x15b81b))['catch'](handleError(_0x18479f,null));};exports['show']=function(_0x52169b,_0x3eeec0){var _0x488170={'raw':!![],'where':{'id':_0x52169b[_0x5754('0x41')]['id']}},_0x583efb={};_0x583efb[_0x5754('0x42')]=_['keys'](db[_0x5754('0x2c')][_0x5754('0x43')]);_0x583efb[_0x5754('0x30')]=_['keys'](_0x52169b['query']);_0x583efb[_0x5754('0x32')]=_[_0x5754('0x33')](_0x583efb['model'],_0x583efb['query']);_0x488170[_0x5754('0x34')]=_[_0x5754('0x33')](_0x583efb[_0x5754('0x42')],qs[_0x5754('0x35')](_0x52169b['query'][_0x5754('0x35')]));_0x488170['attributes']=_0x488170['attributes'][_0x5754('0x44')]?_0x488170[_0x5754('0x34')]:_0x583efb[_0x5754('0x42')];if(_0x52169b['query']['includeAll']){_0x488170[_0x5754('0x45')]=[{'all':!![]}];}_0x488170=_['merge']({},_0x488170,_0x52169b['options']);return db[_0x5754('0x2c')]['find'](_0x488170)[_0x5754('0x26')](handleEntityNotFound(_0x3eeec0,null))[_0x5754('0x26')](respondWithResult(_0x3eeec0,null))['catch'](handleError(_0x3eeec0,null));};exports[_0x5754('0x46')]=function(_0x3af3f3,_0x366a24){return db[_0x5754('0x2c')]['create'](_0x3af3f3[_0x5754('0x47')],{})[_0x5754('0x26')](respondWithResult(_0x366a24,0xc9))[_0x5754('0x48')](handleError(_0x366a24,null));};exports[_0x5754('0x49')]=function(_0x3b702e,_0x38dfa6){return db['CmHopperHistory'][_0x5754('0x49')]()['then'](respondWithResult(_0x38dfa6,null))['catch'](handleError(_0x38dfa6,null));};exports[_0x5754('0x24')]=function(_0xc295e,_0x400376){if(_0xc295e[_0x5754('0x47')]['uniqueid']){delete _0xc295e[_0x5754('0x47')]['uniqueid'];}return db[_0x5754('0x2c')][_0x5754('0x4a')]({'where':{'uniqueid':_0xc295e['params']['id']}})[_0x5754('0x26')](handleEntityNotFound(_0x400376,null))[_0x5754('0x26')](saveUpdates(_0xc295e['body'],null))[_0x5754('0x26')](respondWithResult(_0x400376,null))[_0x5754('0x48')](handleError(_0x400376,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index c958327..01aea68 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 _0x6343=['../../config/logger','api','rimraf','../../config/environment','exports','define','CmHopperHistory','endtime','uniqueid'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x6343,0x168));var _0x3634=function(_0x284f1c,_0x3b85be){_0x284f1c=_0x284f1c-0x0;var _0x446273=_0x6343[_0x284f1c];return _0x446273;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3634('0x0'))(_0x3634('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var attributes=require('./cmHopperHistory.attributes');module[_0x3634('0x4')]=function(_0x388c18,_0x4bb496){return _0x388c18[_0x3634('0x5')](_0x3634('0x6'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x3634('0x7')]},{'name':_0x3634('0x8'),'fields':[_0x3634('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1751=['exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0x2cbc0c,_0xdce901){var _0x267a5d=function(_0x568625){while(--_0x568625){_0x2cbc0c['push'](_0x2cbc0c['shift']());}};_0x267a5d(++_0xdce901);}(_0x1751,0x76));var _0x1175=function(_0x168b22,_0x1a61f2){_0x168b22=_0x168b22-0x0;var _0x25e237=_0x1751[_0x168b22];return _0x25e237;};'use strict';var _=require(_0x1175('0x0'));var util=require(_0x1175('0x1'));var logger=require(_0x1175('0x2'))(_0x1175('0x3'));var moment=require('moment');var BPromise=require(_0x1175('0x4'));var rp=require(_0x1175('0x5'));var fs=require('fs');var path=require(_0x1175('0x6'));var rimraf=require(_0x1175('0x7'));var config=require(_0x1175('0x8'));var attributes=require(_0x1175('0x9'));module[_0x1175('0xa')]=function(_0x171756,_0x3f99ca){return _0x171756[_0x1175('0xb')](_0x1175('0xc'),attributes,{'tableName':_0x1175('0xd'),'paranoid':![],'indexes':[{'name':_0x1175('0xe'),'fields':[_0x1175('0xe')]},{'name':_0x1175('0xf'),'fields':[_0x1175('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 8329a0c..52e8a70 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 _0xf6a9=['raw','then','debug','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options'];(function(_0x4863d6,_0x75760b){var _0x243e43=function(_0x46241c){while(--_0x46241c){_0x4863d6['push'](_0x4863d6['shift']());}};_0x243e43(++_0x75760b);}(_0xf6a9,0x176));var _0x9f6a=function(_0x3c7166,_0x397079){_0x3c7166=_0x3c7166-0x0;var _0x498153=_0xf6a9[_0x3c7166];return _0x498153;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9f6a('0x0'));var BPromise=require('bluebird');var rs=require(_0x9f6a('0x1'));var fs=require('fs');var Redis=require(_0x9f6a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f6a('0x3'));var logger=require(_0x9f6a('0x4'))(_0x9f6a('0x5'));var config=require(_0x9f6a('0x6'));var jayson=require(_0x9f6a('0x7'));var client=jayson[_0x9f6a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x272496,_0x3c0549,_0x529af0){return new BPromise(function(_0x12b9a0,_0x39a057){return client['request'](_0x272496,_0x529af0)['then'](function(_0x3c9a34){logger[_0x9f6a('0x9')]('CmHopperHistory,\x20%s,\x20%s',_0x3c0549,_0x9f6a('0xa'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x3c0549,_0x9f6a('0xa'),JSON[_0x9f6a('0xb')](_0x3c9a34));if(_0x3c9a34['error']){if(_0x3c9a34[_0x9f6a('0xc')]['code']===0x1f4){logger[_0x9f6a('0xc')](_0x9f6a('0xd'),_0x3c0549,_0x3c9a34[_0x9f6a('0xc')][_0x9f6a('0xe')]);return _0x39a057(_0x3c9a34[_0x9f6a('0xc')][_0x9f6a('0xe')]);}logger['error'](_0x9f6a('0xd'),_0x3c0549,_0x3c9a34[_0x9f6a('0xc')][_0x9f6a('0xe')]);return _0x12b9a0(_0x3c9a34['error']['message']);}else{logger[_0x9f6a('0x9')](_0x9f6a('0xd'),_0x3c0549,'request\x20sent');_0x12b9a0(_0x3c9a34[_0x9f6a('0xf')][_0x9f6a('0xe')]);}})[_0x9f6a('0x10')](function(_0xc4406d){logger[_0x9f6a('0xc')](_0x9f6a('0xd'),_0x3c0549,_0xc4406d);_0x39a057(_0xc4406d);});});}exports[_0x9f6a('0x11')]=function(_0x474e16){var _0xf93c37=this;return new Promise(function(_0x168df3,_0x34c84e){return db[_0x9f6a('0x12')][_0x9f6a('0x13')](_0x474e16[_0x9f6a('0x14')],{'raw':_0x474e16[_0x9f6a('0x15')]?_0x474e16[_0x9f6a('0x15')][_0x9f6a('0x16')]===undefined?!![]:![]:!![]})[_0x9f6a('0x17')](function(_0x7336c7){logger[_0x9f6a('0x9')]('CreateCmHopperHistory',_0x474e16);logger[_0x9f6a('0x18')](_0x9f6a('0x11'),_0x474e16,JSON[_0x9f6a('0xb')](_0x7336c7));_0x168df3(_0x7336c7);})[_0x9f6a('0x10')](function(_0x5c245a){logger[_0x9f6a('0xc')](_0x9f6a('0x11'),_0x5c245a[_0x9f6a('0xe')],_0x474e16);_0x34c84e(_0xf93c37[_0x9f6a('0xc')](0x1f4,_0x5c245a['message']));});});};exports[_0x9f6a('0x19')]=function(_0x3d4fb3){var _0x160fa5=this;return new Promise(function(_0x4292b3,_0x4a65f5){return db['CmHopperHistory'][_0x9f6a('0x1a')]({'raw':_0x3d4fb3[_0x9f6a('0x15')]?_0x3d4fb3[_0x9f6a('0x15')][_0x9f6a('0x16')]===undefined?!![]:![]:!![],'where':_0x3d4fb3[_0x9f6a('0x15')]?_0x3d4fb3[_0x9f6a('0x15')][_0x9f6a('0x1b')]||null:null,'attributes':[[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')][_0x9f6a('0x1e')]('id')),_0x9f6a('0x1f')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')]['literal'](_0x9f6a('0x20')))),_0x9f6a('0x21')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x23')))),_0x9f6a('0x24')],[db[_0x9f6a('0x1c')]['fn']('COUNT',db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x25')))),_0x9f6a('0x26')],[db[_0x9f6a('0x1c')]['fn']('AVG',db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x27')))),_0x9f6a('0x28')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x29'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x2a')))),_0x9f6a('0x2b')]]})['then'](function(_0x376913){logger[_0x9f6a('0x9')](_0x9f6a('0x19'),_0x3d4fb3);logger[_0x9f6a('0x18')](_0x9f6a('0x19'),_0x3d4fb3,JSON['stringify'](_0x376913));_0x4292b3(_0x376913);})['catch'](function(_0x54328d){logger[_0x9f6a('0xc')](_0x9f6a('0x19'),_0x54328d[_0x9f6a('0xe')],_0x3d4fb3);_0x4a65f5(_0x160fa5[_0x9f6a('0xc')](0x1f4,_0x54328d[_0x9f6a('0xe')]));});});};exports[_0x9f6a('0x2c')]=function(_0x2da67c){var _0x4e0ecb=this;return new Promise(function(_0x163979,_0xc63b2){return db[_0x9f6a('0x12')][_0x9f6a('0x1a')]({'raw':_0x2da67c['options']?_0x2da67c[_0x9f6a('0x15')][_0x9f6a('0x16')]===undefined?!![]:![]:!![],'where':_0x2da67c['options']?_0x2da67c[_0x9f6a('0x15')][_0x9f6a('0x1b')]||null:null,'attributes':[['campaign',_0x9f6a('0x2d')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x9f6a('0x2e')],[db['sequelize']['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')]['literal'](_0x9f6a('0x2f')))),_0x9f6a('0x30')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x9f6a('0x20')))),_0x9f6a('0x31')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db['sequelize']['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x9f6a('0x32')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db['sequelize'][_0x9f6a('0x22')](_0x9f6a('0x33')))),'outboundDropCallsDayCallersExit'],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x9f6a('0x34')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x35')))),_0x9f6a('0x36')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db['sequelize'][_0x9f6a('0x22')](_0x9f6a('0x37')))),_0x9f6a('0x38')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')]['literal'](_0x9f6a('0x39')))),_0x9f6a('0x3a')],[db[_0x9f6a('0x1c')]['fn']('COUNT',db[_0x9f6a('0x1c')]['fn']('IF',db['sequelize'][_0x9f6a('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0x9f6a('0x3b')],[db['sequelize']['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x3c')))),_0x9f6a('0x3a')],[db[_0x9f6a('0x1c')]['fn']('COUNT',db[_0x9f6a('0x1c')]['fn']('IF',db[_0x9f6a('0x1c')][_0x9f6a('0x22')](_0x9f6a('0x3d')))),_0x9f6a('0x3e')]],'group':[_0x9f6a('0x3f')]})[_0x9f6a('0x17')](function(_0x318b0c){logger[_0x9f6a('0x9')](_0x9f6a('0x2c'),_0x2da67c);logger[_0x9f6a('0x18')]('GetVoiceQueueHopperHistory',_0x2da67c,JSON[_0x9f6a('0xb')](_0x318b0c));_0x163979(_0x318b0c);})[_0x9f6a('0x10')](function(_0x2e2e6a){logger['error'](_0x9f6a('0x2c'),_0x2e2e6a[_0x9f6a('0xe')],_0x2da67c);_0xc63b2(_0x4e0ecb[_0x9f6a('0xc')](0x1f4,_0x2e2e6a[_0x9f6a('0xe')]));});});};exports[_0x9f6a('0x40')]=function(_0x5b12e6){var _0x1bbeab=this;return new Promise(function(_0x550623,_0x5070db){return db[_0x9f6a('0x12')][_0x9f6a('0x1a')]({'raw':_0x5b12e6[_0x9f6a('0x15')]?_0x5b12e6[_0x9f6a('0x15')][_0x9f6a('0x16')]===undefined?!![]:![]:!![],'where':_0x5b12e6[_0x9f6a('0x15')]?_0x5b12e6[_0x9f6a('0x15')]['where']||null:null,'attributes':[['campaign','name'],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db[_0x9f6a('0x1c')][_0x9f6a('0x1e')]('id')),_0x9f6a('0x41')],[db[_0x9f6a('0x1c')]['fn'](_0x9f6a('0x1d'),db['sequelize']['fn']('IF',db[_0x9f6a('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x9f6a('0x17')](function(_0x27daf3){logger[_0x9f6a('0x9')]('GetCampaignHopperHistory',_0x5b12e6);logger[_0x9f6a('0x18')](_0x9f6a('0x40'),_0x5b12e6,JSON[_0x9f6a('0xb')](_0x27daf3));_0x550623(_0x27daf3);})[_0x9f6a('0x10')](function(_0x39a922){logger[_0x9f6a('0xc')](_0x9f6a('0x40'),_0x39a922[_0x9f6a('0xe')],_0x5b12e6);_0x5070db(_0x1bbeab['error'](0x1f4,_0x39a922[_0x9f6a('0xe')]));});});}; \ No newline at end of file +var _0xd549=['outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','name','ivrAnswerCallsDay','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','findAll','raw','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG','GetVoiceQueueHopperHistory','where','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null'];(function(_0x50e593,_0x530268){var _0x297937=function(_0x15aa35){while(--_0x15aa35){_0x50e593['push'](_0x50e593['shift']());}};_0x297937(++_0x530268);}(_0xd549,0xde));var _0x9d54=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd549[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x9d54('0x0'));var util=require('util');var moment=require(_0x9d54('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d54('0x2'));var db=require(_0x9d54('0x3'))['db'];var utils=require(_0x9d54('0x4'));var logger=require(_0x9d54('0x5'))(_0x9d54('0x6'));var config=require(_0x9d54('0x7'));var jayson=require(_0x9d54('0x8'));var client=jayson[_0x9d54('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3765ef,_0x3fa989,_0x1956f3){return new BPromise(function(_0x40a78a,_0x2af0da){return client['request'](_0x3765ef,_0x1956f3)[_0x9d54('0xa')](function(_0x149e11){logger[_0x9d54('0xb')](_0x9d54('0xc'),_0x3fa989,_0x9d54('0xd'));logger[_0x9d54('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x3fa989,_0x9d54('0xd'),JSON[_0x9d54('0xf')](_0x149e11));if(_0x149e11[_0x9d54('0x10')]){if(_0x149e11[_0x9d54('0x10')][_0x9d54('0x11')]===0x1f4){logger[_0x9d54('0x10')](_0x9d54('0xc'),_0x3fa989,_0x149e11[_0x9d54('0x10')][_0x9d54('0x12')]);return _0x2af0da(_0x149e11[_0x9d54('0x10')]['message']);}logger['error'](_0x9d54('0xc'),_0x3fa989,_0x149e11[_0x9d54('0x10')][_0x9d54('0x12')]);return _0x40a78a(_0x149e11[_0x9d54('0x10')][_0x9d54('0x12')]);}else{logger[_0x9d54('0xb')](_0x9d54('0xc'),_0x3fa989,_0x9d54('0xd'));_0x40a78a(_0x149e11['result']['message']);}})[_0x9d54('0x13')](function(_0xf44352){logger[_0x9d54('0x10')](_0x9d54('0xc'),_0x3fa989,_0xf44352);_0x2af0da(_0xf44352);});});}exports[_0x9d54('0x14')]=function(_0x293ff1){var _0x4acd49=this;return new Promise(function(_0x18fcb4,_0xec828b){return db[_0x9d54('0x15')][_0x9d54('0x16')](_0x293ff1[_0x9d54('0x17')],{'raw':_0x293ff1[_0x9d54('0x18')]?_0x293ff1['options']['raw']===undefined?!![]:![]:!![]})[_0x9d54('0xa')](function(_0x4f6580){logger[_0x9d54('0xb')](_0x9d54('0x14'),_0x293ff1);logger[_0x9d54('0xe')](_0x9d54('0x14'),_0x293ff1,JSON['stringify'](_0x4f6580));_0x18fcb4(_0x4f6580);})['catch'](function(_0xebb506){logger[_0x9d54('0x10')]('CreateCmHopperHistory',_0xebb506[_0x9d54('0x12')],_0x293ff1);_0xec828b(_0x4acd49[_0x9d54('0x10')](0x1f4,_0xebb506[_0x9d54('0x12')]));});});};exports[_0x9d54('0x19')]=function(_0xce5c49){var _0x2fdc1f=this;return new Promise(function(_0x7472d,_0x480051){return db[_0x9d54('0x15')][_0x9d54('0x1a')]({'raw':_0xce5c49[_0x9d54('0x18')]?_0xce5c49[_0x9d54('0x18')][_0x9d54('0x1b')]===undefined?!![]:![]:!![],'where':_0xce5c49[_0x9d54('0x18')]?_0xce5c49['options']['where']||null:null,'attributes':[[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db['sequelize'][_0x9d54('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db['sequelize'][_0x9d54('0x1f')](_0x9d54('0x20')))),_0x9d54('0x21')],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')][_0x9d54('0x1f')](_0x9d54('0x22')))),_0x9d54('0x23')],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')][_0x9d54('0x1f')](_0x9d54('0x24')))),_0x9d54('0x25')],[db['sequelize']['fn']('AVG',db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')][_0x9d54('0x1f')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x9d54('0x26')],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x27'),db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x9d54('0xa')](function(_0x52b5c7){logger[_0x9d54('0xb')]('AvgHandleTime',_0xce5c49);logger[_0x9d54('0xe')](_0x9d54('0x19'),_0xce5c49,JSON[_0x9d54('0xf')](_0x52b5c7));_0x7472d(_0x52b5c7);})[_0x9d54('0x13')](function(_0x540406){logger['error'](_0x9d54('0x19'),_0x540406['message'],_0xce5c49);_0x480051(_0x2fdc1f['error'](0x1f4,_0x540406[_0x9d54('0x12')]));});});};exports[_0x9d54('0x28')]=function(_0x32fa29){var _0x316646=this;return new Promise(function(_0x3efb66,_0x24cc9c){return db[_0x9d54('0x15')][_0x9d54('0x1a')]({'raw':_0x32fa29[_0x9d54('0x18')]?_0x32fa29[_0x9d54('0x18')][_0x9d54('0x1b')]===undefined?!![]:![]:!![],'where':_0x32fa29[_0x9d54('0x18')]?_0x32fa29[_0x9d54('0x18')][_0x9d54('0x29')]||null:null,'attributes':[[_0x9d54('0x2a'),'name'],[db[_0x9d54('0x1c')]['fn']('COUNT',db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')][_0x9d54('0x1f')](_0x9d54('0x2b')))),_0x9d54('0x2c')],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')]['literal'](_0x9d54('0x2d')))),_0x9d54('0x2e')],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')][_0x9d54('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x9d54('0x2f')],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')][_0x9d54('0x1f')](_0x9d54('0x30')))),_0x9d54('0x31')],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')][_0x9d54('0x1f')](_0x9d54('0x32')))),_0x9d54('0x33')],[db['sequelize']['fn'](_0x9d54('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x9d54('0x1f')](_0x9d54('0x34')))),_0x9d54('0x35')],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')]['literal'](_0x9d54('0x36')))),_0x9d54('0x37')],[db['sequelize']['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db['sequelize'][_0x9d54('0x1f')](_0x9d54('0x38')))),_0x9d54('0x39')],[db[_0x9d54('0x1c')]['fn']('COUNT',db[_0x9d54('0x1c')]['fn']('IF',db['sequelize'][_0x9d54('0x1f')]('`state`\x20=\x2013,\x201,\x20null'))),_0x9d54('0x3a')],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')]['literal'](_0x9d54('0x3b')))),'outboundOriginateFailureCallsDay'],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')][_0x9d54('0x1f')](_0x9d54('0x3c')))),_0x9d54('0x3d')],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db['sequelize']['fn']('IF',db[_0x9d54('0x1c')][_0x9d54('0x1f')](_0x9d54('0x3e')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')][_0x9d54('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),_0x9d54('0x3d')],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x9d54('0x1f')](_0x9d54('0x3f')))),'outboundReCallsDay']],'group':[_0x9d54('0x2a')]})[_0x9d54('0xa')](function(_0x2b8d61){logger[_0x9d54('0xb')]('GetVoiceQueueHopperHistory',_0x32fa29);logger['debug'](_0x9d54('0x28'),_0x32fa29,JSON[_0x9d54('0xf')](_0x2b8d61));_0x3efb66(_0x2b8d61);})[_0x9d54('0x13')](function(_0x2a7d33){logger['error'](_0x9d54('0x28'),_0x2a7d33[_0x9d54('0x12')],_0x32fa29);_0x24cc9c(_0x316646[_0x9d54('0x10')](0x1f4,_0x2a7d33['message']));});});};exports[_0x9d54('0x40')]=function(_0x268c88){var _0x357c2f=this;return new Promise(function(_0x3a78ab,_0x2d1862){return db[_0x9d54('0x15')][_0x9d54('0x1a')]({'raw':_0x268c88[_0x9d54('0x18')]?_0x268c88[_0x9d54('0x18')][_0x9d54('0x1b')]===undefined?!![]:![]:!![],'where':_0x268c88['options']?_0x268c88[_0x9d54('0x18')][_0x9d54('0x29')]||null:null,'attributes':[['campaign',_0x9d54('0x41')],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')][_0x9d54('0x1e')]('id')),'ivrTotalCallsDays'],[db[_0x9d54('0x1c')]['fn'](_0x9d54('0x1d'),db[_0x9d54('0x1c')]['fn']('IF',db[_0x9d54('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x9d54('0x42')]],'group':[_0x9d54('0x2a')]})[_0x9d54('0xa')](function(_0x2f52c2){logger[_0x9d54('0xb')](_0x9d54('0x40'),_0x268c88);logger[_0x9d54('0xe')](_0x9d54('0x40'),_0x268c88,JSON[_0x9d54('0xf')](_0x2f52c2));_0x3a78ab(_0x2f52c2);})[_0x9d54('0x13')](function(_0x5e5954){logger[_0x9d54('0x10')](_0x9d54('0x40'),_0x5e5954[_0x9d54('0x12')],_0x268c88);_0x2d1862(_0x357c2f['error'](0x1f4,_0x5e5954['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 57ceef2..ab6825f 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 _0x78b4=['index','/describe','isAuthenticated','describe','show','post','create','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x78b4,0xa9));var _0x478b=function(_0x8e4a17,_0x44ead5){_0x8e4a17=_0x8e4a17-0x0;var _0x395a7b=_0x78b4[_0x8e4a17];return _0x395a7b;};'use strict';var multer=require('multer');var util=require(_0x478b('0x0'));var path=require(_0x478b('0x1'));var timeout=require(_0x478b('0x2'));var express=require(_0x478b('0x3'));var router=express[_0x478b('0x4')]();var fs_extra=require(_0x478b('0x5'));var auth=require(_0x478b('0x6'));var interaction=require(_0x478b('0x7'));var config=require(_0x478b('0x8'));var controller=require(_0x478b('0x9'));router[_0x478b('0xa')]('/',auth['isAuthenticated'](),controller[_0x478b('0xb')]);router[_0x478b('0xa')](_0x478b('0xc'),auth[_0x478b('0xd')](),controller[_0x478b('0xe')]);router[_0x478b('0xa')]('/:id',auth[_0x478b('0xd')](),controller[_0x478b('0xf')]);router[_0x478b('0x10')]('/',auth['isAuthenticated'](),controller[_0x478b('0x11')]);router[_0x478b('0x12')]('/:id',auth[_0x478b('0xd')](),controller[_0x478b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x715a=['post','put','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show'];(function(_0x54e186,_0x42cc32){var _0x284e52=function(_0x252b82){while(--_0x252b82){_0x54e186['push'](_0x54e186['shift']());}};_0x284e52(++_0x42cc32);}(_0x715a,0x13d));var _0xa715=function(_0x2c1a7b,_0x42c521){_0x2c1a7b=_0x2c1a7b-0x0;var _0x3e8fa2=_0x715a[_0x2c1a7b];return _0x3e8fa2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa715('0x0'));var timeout=require(_0xa715('0x1'));var express=require(_0xa715('0x2'));var router=express[_0xa715('0x3')]();var fs_extra=require(_0xa715('0x4'));var auth=require(_0xa715('0x5'));var interaction=require(_0xa715('0x6'));var config=require(_0xa715('0x7'));var controller=require('./cmHopperHistory.controller');router[_0xa715('0x8')]('/',auth[_0xa715('0x9')](),controller['index']);router[_0xa715('0x8')](_0xa715('0xa'),auth[_0xa715('0x9')](),controller['describe']);router['get'](_0xa715('0xb'),auth[_0xa715('0x9')](),controller[_0xa715('0xc')]);router[_0xa715('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa715('0xe')](_0xa715('0xb'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 6bb6ff9..4997e93 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 _0x9f62=['STRING','exports','name'];(function(_0x2e3b8e,_0x5db5fd){var _0x3cbeef=function(_0x4794b8){while(--_0x4794b8){_0x2e3b8e['push'](_0x2e3b8e['shift']());}};_0x3cbeef(++_0x5db5fd);}(_0x9f62,0x154));var _0x29f6=function(_0xc0a92c,_0x5bb057){_0xc0a92c=_0xc0a92c-0x0;var _0x2cf131=_0x9f62[_0xc0a92c];return _0x2cf131;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x29f6('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x29f6('0x2')]},'dialPrefix':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file +var _0x1247=['exports','STRING','sequelize'];(function(_0x2da4a0,_0x20dca9){var _0x577e99=function(_0x5a7549){while(--_0x5a7549){_0x2da4a0['push'](_0x2da4a0['shift']());}};_0x577e99(++_0x20dca9);}(_0x1247,0xb6));var _0x7124=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x1247[_0x40822a];return _0x357420;};'use strict';var Sequelize=require(_0x7124('0x0'));module[_0x7124('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7124('0x2')]},'dialPrefix':{'type':Sequelize[_0x7124('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index f3611ee..50a285c 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 _0xf4f3=['update','then','Lists','UserProfileResource','destroy','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ListId','Disposition','getDispositions','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','each','omit','success','errors','push','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf4f3,0x6b));var _0x3f4f=function(_0xd238cd,_0x160ee2){_0xd238cd=_0xd238cd-0x0;var _0xaf3282=_0xf4f3[_0xd238cd];return _0xaf3282;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3f4f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f4f('0x1'));var moment=require(_0x3f4f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3f4f('0x3'));var util=require(_0x3f4f('0x4'));var path=require(_0x3f4f('0x5'));var sox=require(_0x3f4f('0x6'));var csv=require(_0x3f4f('0x7'));var ejs=require(_0x3f4f('0x8'));var fs=require('fs');var fs_extra=require(_0x3f4f('0x9'));var _=require('lodash');var squel=require(_0x3f4f('0xa'));var crypto=require(_0x3f4f('0xb'));var jsforce=require(_0x3f4f('0xc'));var deskjs=require(_0x3f4f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3f4f('0xe'));var Redis=require(_0x3f4f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3f4f('0x10'));var as=require(_0x3f4f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3f4f('0x12'));var utils=require('../../config/utils');var config=require(_0x3f4f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f4f('0x14'))['db'];config[_0x3f4f('0x15')]=_[_0x3f4f('0x16')](config[_0x3f4f('0x15')],{'host':_0x3f4f('0x17'),'port':0x18eb});var socket=require(_0x3f4f('0x18'))(new Redis(config[_0x3f4f('0x15')]));require(_0x3f4f('0x19'))['register'](socket);function respondWithStatusCode(_0x240233,_0x10db32){_0x10db32=_0x10db32||0xcc;return function(_0x38dfe9){if(_0x38dfe9){return _0x240233[_0x3f4f('0x1a')](_0x10db32);}return _0x240233['status'](_0x10db32)[_0x3f4f('0x1b')]();};}function respondWithResult(_0x9701c,_0x46c2c2){_0x46c2c2=_0x46c2c2||0xc8;return function(_0x42a466){if(_0x42a466){return _0x9701c[_0x3f4f('0x1c')](_0x46c2c2)[_0x3f4f('0x1d')](_0x42a466);}};}function respondWithFilteredResult(_0x16302b,_0x55fad2){return function(_0x110340){if(_0x110340){var _0x1ed9b0=typeof _0x55fad2[_0x3f4f('0x1e')]==='undefined'&&typeof _0x55fad2[_0x3f4f('0x1f')]===_0x3f4f('0x20');var _0x3c5ae5=_0x110340[_0x3f4f('0x21')];var _0x5bb4f4=_0x1ed9b0?0x0:_0x55fad2[_0x3f4f('0x1e')];var _0x1be0c3=_0x1ed9b0?_0x110340[_0x3f4f('0x21')]:_0x55fad2[_0x3f4f('0x1e')]+_0x55fad2[_0x3f4f('0x1f')];var _0x43caa0;if(_0x1be0c3>=_0x3c5ae5){_0x1be0c3=_0x3c5ae5;_0x43caa0=0xc8;}else{_0x43caa0=0xce;}_0x16302b['status'](_0x43caa0);return _0x16302b[_0x3f4f('0x22')](_0x3f4f('0x23'),_0x5bb4f4+'-'+_0x1be0c3+'/'+_0x3c5ae5)[_0x3f4f('0x1d')](_0x110340);}return null;};}function patchUpdates(_0x10e23b){return function(_0x5add6d){try{jsonpatch[_0x3f4f('0x24')](_0x5add6d,_0x10e23b,!![]);}catch(_0x2603f9){return BPromise[_0x3f4f('0x25')](_0x2603f9);}return _0x5add6d[_0x3f4f('0x26')]();};}function saveUpdates(_0x119b38,_0x59eb67){return function(_0x281bd6){if(_0x281bd6){return _0x281bd6[_0x3f4f('0x27')](_0x119b38)[_0x3f4f('0x28')](function(_0x4e1e9f){return _0x4e1e9f;});}return null;};}function removeEntity(_0x167383,_0xcb26a4){return function(_0xab4212){if(_0xab4212){return _0xab4212['destroy']()[_0x3f4f('0x28')](function(){var _0x321da9=_0xab4212['get']({'plain':!![]});var _0x242f45=_0x3f4f('0x29');return db[_0x3f4f('0x2a')][_0x3f4f('0x2b')]({'where':{'type':_0x242f45,'resourceId':_0x321da9['id']}})[_0x3f4f('0x28')](function(){return _0xab4212;});})[_0x3f4f('0x28')](function(){_0x167383['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x140a6f,_0x4bdcad){return function(_0xb00b95){if(!_0xb00b95){_0x140a6f[_0x3f4f('0x1a')](0x194);}return _0xb00b95;};}function handleError(_0x483262,_0x300d5b){_0x300d5b=_0x300d5b||0x1f4;return function(_0x13ae09){logger[_0x3f4f('0x2c')](_0x13ae09[_0x3f4f('0x2d')]);if(_0x13ae09[_0x3f4f('0x2e')]){delete _0x13ae09[_0x3f4f('0x2e')];}_0x483262[_0x3f4f('0x1c')](_0x300d5b)[_0x3f4f('0x2f')](_0x13ae09);};}exports[_0x3f4f('0x30')]=function(_0x228234,_0x2a72db){var _0x5f1b5a={},_0x2c5ef7={},_0x29755c={'count':0x0,'rows':[]};var _0xad2b47=_[_0x3f4f('0x31')](db[_0x3f4f('0x32')][_0x3f4f('0x33')],function(_0x191efe){return{'name':_0x191efe[_0x3f4f('0x34')],'type':_0x191efe[_0x3f4f('0x35')]['key']};});_0x2c5ef7['model']=_[_0x3f4f('0x31')](_0xad2b47,_0x3f4f('0x2e'));_0x2c5ef7[_0x3f4f('0x36')]=_['keys'](_0x228234['query']);_0x2c5ef7[_0x3f4f('0x37')]=_[_0x3f4f('0x38')](_0x2c5ef7[_0x3f4f('0x39')],_0x2c5ef7[_0x3f4f('0x36')]);_0x5f1b5a[_0x3f4f('0x3a')]=_['intersection'](_0x2c5ef7[_0x3f4f('0x39')],qs[_0x3f4f('0x3b')](_0x228234['query']['fields']));_0x5f1b5a[_0x3f4f('0x3a')]=_0x5f1b5a[_0x3f4f('0x3a')][_0x3f4f('0x3c')]?_0x5f1b5a['attributes']:_0x2c5ef7[_0x3f4f('0x39')];if(!_0x228234[_0x3f4f('0x36')][_0x3f4f('0x3d')](_0x3f4f('0x3e'))){_0x5f1b5a[_0x3f4f('0x1f')]=qs['limit'](_0x228234[_0x3f4f('0x36')][_0x3f4f('0x1f')]);_0x5f1b5a[_0x3f4f('0x1e')]=qs[_0x3f4f('0x1e')](_0x228234[_0x3f4f('0x36')]['offset']);}_0x5f1b5a[_0x3f4f('0x3f')]=qs[_0x3f4f('0x40')](_0x228234['query']['sort']);_0x5f1b5a[_0x3f4f('0x41')]=qs['filters'](_[_0x3f4f('0x42')](_0x228234[_0x3f4f('0x36')],_0x2c5ef7[_0x3f4f('0x37')]),_0xad2b47);if(_0x228234[_0x3f4f('0x36')][_0x3f4f('0x43')]){_0x5f1b5a[_0x3f4f('0x41')]=_[_0x3f4f('0x44')](_0x5f1b5a[_0x3f4f('0x41')],{'$or':_['map'](_0xad2b47,function(_0xffdecf){if(_0xffdecf[_0x3f4f('0x35')]!==_0x3f4f('0x45')){var _0x1d0fbe={};_0x1d0fbe[_0xffdecf[_0x3f4f('0x2e')]]={'$like':'%'+_0x228234[_0x3f4f('0x36')][_0x3f4f('0x43')]+'%'};return _0x1d0fbe;}})});}_0x5f1b5a=_['merge']({},_0x5f1b5a,_0x228234[_0x3f4f('0x46')]);var _0x16ec9b={'where':_0x5f1b5a[_0x3f4f('0x41')]};return db[_0x3f4f('0x32')][_0x3f4f('0x21')](_0x16ec9b)[_0x3f4f('0x28')](function(_0x44a3f2){_0x29755c[_0x3f4f('0x21')]=_0x44a3f2;if(_0x228234['query'][_0x3f4f('0x47')]){_0x5f1b5a[_0x3f4f('0x48')]=[{'all':!![]}];}return db['CmList'][_0x3f4f('0x49')](_0x5f1b5a);})[_0x3f4f('0x28')](function(_0x36c42b){_0x29755c[_0x3f4f('0x4a')]=_0x36c42b;return _0x29755c;})['then'](respondWithFilteredResult(_0x2a72db,_0x5f1b5a))[_0x3f4f('0x4b')](handleError(_0x2a72db,null));};exports['show']=function(_0x1dab35,_0x34f752){var _0xab9922={'raw':![],'where':{'id':_0x1dab35['params']['id']}},_0x522bf4={};_0x522bf4[_0x3f4f('0x39')]=_['keys'](db[_0x3f4f('0x32')][_0x3f4f('0x33')]);_0x522bf4[_0x3f4f('0x36')]=_[_0x3f4f('0x4c')](_0x1dab35[_0x3f4f('0x36')]);_0x522bf4[_0x3f4f('0x37')]=_[_0x3f4f('0x38')](_0x522bf4['model'],_0x522bf4['query']);_0xab9922[_0x3f4f('0x3a')]=_[_0x3f4f('0x38')](_0x522bf4[_0x3f4f('0x39')],qs[_0x3f4f('0x3b')](_0x1dab35[_0x3f4f('0x36')]['fields']));_0xab9922[_0x3f4f('0x3a')]=_0xab9922[_0x3f4f('0x3a')][_0x3f4f('0x3c')]?_0xab9922['attributes']:_0x522bf4[_0x3f4f('0x39')];if(_0x1dab35[_0x3f4f('0x36')]['includeAll']){_0xab9922[_0x3f4f('0x48')]=[{'all':!![]}];}_0xab9922=_[_0x3f4f('0x44')]({},_0xab9922,_0x1dab35['options']);return db[_0x3f4f('0x32')][_0x3f4f('0x4d')](_0xab9922)[_0x3f4f('0x28')](handleEntityNotFound(_0x34f752,null))[_0x3f4f('0x28')](respondWithResult(_0x34f752,null))[_0x3f4f('0x4b')](handleError(_0x34f752,null));};exports[_0x3f4f('0x4e')]=function(_0x26ada8,_0x53e08e){return db[_0x3f4f('0x32')][_0x3f4f('0x4e')](_0x26ada8['body'],{})[_0x3f4f('0x28')](function(_0x5ac27a){var _0x2dd489=_0x26ada8['user'][_0x3f4f('0x4f')]({'plain':!![]});if(!_0x2dd489)throw new Error(_0x3f4f('0x50'));if(_0x2dd489[_0x3f4f('0x51')]===_0x3f4f('0x52')){var _0x420e2c=_0x5ac27a[_0x3f4f('0x4f')]({'plain':!![]});var _0x131501=_0x3f4f('0x29');return db[_0x3f4f('0x53')][_0x3f4f('0x4d')]({'where':{'name':_0x131501,'userProfileId':_0x2dd489[_0x3f4f('0x54')]},'raw':!![]})[_0x3f4f('0x28')](function(_0x413c6f){if(_0x413c6f&&_0x413c6f[_0x3f4f('0x55')]===0x0){return db[_0x3f4f('0x2a')][_0x3f4f('0x4e')]({'name':_0x420e2c['name'],'resourceId':_0x420e2c['id'],'type':_0x413c6f[_0x3f4f('0x2e')],'sectionId':_0x413c6f['id']},{})[_0x3f4f('0x28')](function(){return _0x5ac27a;});}else{return _0x5ac27a;}})[_0x3f4f('0x4b')](function(_0x4e7357){logger[_0x3f4f('0x2c')](_0x3f4f('0x56'),_0x4e7357);throw _0x4e7357;});}return _0x5ac27a;})['then'](respondWithResult(_0x53e08e,0xc9))[_0x3f4f('0x4b')](handleError(_0x53e08e,null));};exports[_0x3f4f('0x27')]=function(_0x568005,_0xd45d3b){if(_0x568005[_0x3f4f('0x57')]['id']){delete _0x568005[_0x3f4f('0x57')]['id'];}return db['CmList']['find']({'where':{'id':_0x568005['params']['id']}})[_0x3f4f('0x28')](handleEntityNotFound(_0xd45d3b,null))[_0x3f4f('0x28')](saveUpdates(_0x568005[_0x3f4f('0x57')],null))['then'](respondWithResult(_0xd45d3b,null))[_0x3f4f('0x4b')](handleError(_0xd45d3b,null));};exports[_0x3f4f('0x2b')]=function(_0x232e41,_0x495f44){return db['CmList']['find']({'where':{'id':_0x232e41[_0x3f4f('0x58')]['id']}})[_0x3f4f('0x28')](handleEntityNotFound(_0x495f44,null))[_0x3f4f('0x28')](removeEntity(_0x495f44,null))[_0x3f4f('0x4b')](handleError(_0x495f44,null));};exports['describe']=function(_0x5c131c,_0x5ee0d7){return db[_0x3f4f('0x32')][_0x3f4f('0x59')]()['then'](respondWithResult(_0x5ee0d7,null))['catch'](handleError(_0x5ee0d7,null));};exports[_0x3f4f('0x5a')]=function(_0x396901,_0x4cf9ca,_0x1f39e9){if(_0x396901['body']['id']){delete _0x396901['body']['id'];}return db[_0x3f4f('0x32')][_0x3f4f('0x4d')]({'where':{'id':_0x396901[_0x3f4f('0x58')]['id']}})[_0x3f4f('0x28')](handleEntityNotFound(_0x4cf9ca,null))[_0x3f4f('0x28')](function(_0x526ae3){if(_0x526ae3){_0x396901[_0x3f4f('0x57')][_0x3f4f('0x5b')]=_0x526ae3['id'];return db[_0x3f4f('0x5c')]['create'](_0x396901['body']);}})[_0x3f4f('0x28')](respondWithResult(_0x4cf9ca,null))['catch'](handleError(_0x4cf9ca,null));};exports[_0x3f4f('0x5d')]=function(_0x1d7176,_0x118cd5,_0x26c333){var _0x3f2a17={'raw':![],'where':{}};var _0x1b5444={};var _0x349c29={'count':0x0,'rows':[]};return db[_0x3f4f('0x32')]['findOne']({'where':{'id':_0x1d7176['params']['id']}})[_0x3f4f('0x28')](handleEntityNotFound(_0x118cd5,null))['then'](function(_0x569e7f){if(_0x569e7f){_0x1b5444['model']=_[_0x3f4f('0x4c')](db[_0x3f4f('0x5c')][_0x3f4f('0x33')]);_0x1b5444['query']=_[_0x3f4f('0x4c')](_0x1d7176['query']);_0x1b5444[_0x3f4f('0x37')]=_[_0x3f4f('0x38')](_0x1b5444['model'],_0x1b5444[_0x3f4f('0x36')]);_0x3f2a17[_0x3f4f('0x3a')]=_[_0x3f4f('0x38')](_0x1b5444[_0x3f4f('0x39')],qs[_0x3f4f('0x3b')](_0x1d7176[_0x3f4f('0x36')][_0x3f4f('0x3b')]));_0x3f2a17[_0x3f4f('0x3a')]=_0x3f2a17['attributes'][_0x3f4f('0x3c')]?_0x3f2a17['attributes']:_0x1b5444[_0x3f4f('0x39')];if(!_0x1d7176[_0x3f4f('0x36')][_0x3f4f('0x3d')]('nolimit')){_0x3f2a17[_0x3f4f('0x1f')]=qs[_0x3f4f('0x1f')](_0x1d7176['query'][_0x3f4f('0x1f')]);_0x3f2a17[_0x3f4f('0x1e')]=qs[_0x3f4f('0x1e')](_0x1d7176['query'][_0x3f4f('0x1e')]);}_0x3f2a17[_0x3f4f('0x3f')]=qs[_0x3f4f('0x40')](_0x1d7176['query']['sort']);_0x3f2a17[_0x3f4f('0x41')]=qs[_0x3f4f('0x37')](_['pick'](_0x1d7176[_0x3f4f('0x36')],_0x1b5444[_0x3f4f('0x37')]));_0x3f2a17[_0x3f4f('0x41')][_0x3f4f('0x5b')]=_0x569e7f['id'];if(_0x1d7176[_0x3f4f('0x36')][_0x3f4f('0x43')]){_0x3f2a17['where']=_[_0x3f4f('0x44')](_0x3f2a17['where'],{'$or':_[_0x3f4f('0x31')](_0x3f2a17['attributes'],function(_0x492203){var _0x209f3d={};_0x209f3d[_0x492203]={'$like':'%'+_0x1d7176[_0x3f4f('0x36')][_0x3f4f('0x43')]+'%'};return _0x209f3d;})});}_0x3f2a17=_[_0x3f4f('0x44')]({},_0x3f2a17,_0x1d7176[_0x3f4f('0x46')]);return db[_0x3f4f('0x5c')]['count']({'where':_0x3f2a17[_0x3f4f('0x41')]})[_0x3f4f('0x28')](function(_0x4e9c6f){_0x349c29['count']=_0x4e9c6f;if(_0x1d7176['query'][_0x3f4f('0x47')]){_0x3f2a17[_0x3f4f('0x48')]=[{'all':!![]}];}return db[_0x3f4f('0x5c')][_0x3f4f('0x49')](_0x3f2a17);})[_0x3f4f('0x28')](function(_0x4a795e){_0x349c29[_0x3f4f('0x4a')]=_0x4a795e;return _0x349c29;});}})['then'](respondWithFilteredResult(_0x118cd5,_0x3f2a17))[_0x3f4f('0x4b')](handleError(_0x118cd5,null));};exports[_0x3f4f('0x5e')]=function(_0x2012db,_0x48102e,_0x112152){return db[_0x3f4f('0x32')][_0x3f4f('0x4d')]({'where':{'id':_0x2012db[_0x3f4f('0x58')]['id']}})[_0x3f4f('0x28')](handleEntityNotFound(_0x48102e,null))[_0x3f4f('0x28')](function(_0x5a7622){if(_0x5a7622){return _0x5a7622['removeDispositions'](_0x2012db[_0x3f4f('0x36')][_0x3f4f('0x5f')]);}})[_0x3f4f('0x28')](respondWithStatusCode(_0x48102e,null))[_0x3f4f('0x4b')](handleError(_0x48102e,null));};exports[_0x3f4f('0x60')]=function(_0x466aae,_0x31a11e,_0x1fbbf1){return db['CmList'][_0x3f4f('0x4d')]({'where':{'id':_0x466aae[_0x3f4f('0x58')]['id']}})[_0x3f4f('0x28')](handleEntityNotFound(_0x31a11e,null))[_0x3f4f('0x28')](function(_0x339fcb){if(_0x339fcb){var _0x4c4494=[];var _0x185f2a={'success':[],'errors':[]};return db[_0x3f4f('0x61')][_0x3f4f('0x59')]()['then'](function(_0x38f0ee){if(_0x466aae[_0x3f4f('0x57')][_0x3f4f('0x62')]&&_['isArray'](_0x466aae[_0x3f4f('0x57')][_0x3f4f('0x62')])){if(_0x466aae[_0x3f4f('0x57')][_0x3f4f('0x62')][_0x3f4f('0x3c')]){_0x466aae[_0x3f4f('0x57')]['tags']=_0x466aae['body']['tags'][_0x3f4f('0x63')](';')+';';}else{_0x466aae['body'][_0x3f4f('0x62')]=null;}}else{_0x466aae[_0x3f4f('0x57')]['tags']=null;}if(_0x466aae[_0x3f4f('0x57')]&&_[_0x3f4f('0x64')](_0x466aae[_0x3f4f('0x57')])){for(var _0x170d4c=0x0;_0x170d4c<_0x466aae[_0x3f4f('0x57')][_0x3f4f('0x3c')];_0x170d4c+=0x1){_0x466aae[_0x3f4f('0x57')][_0x170d4c][_0x3f4f('0x5b')]=_0x466aae['params']['id'];_0x4c4494['push'](_0x466aae[_0x3f4f('0x57')][_0x170d4c]);}return BPromise[_0x3f4f('0x65')](_0x4c4494,function(_0x9ab20f){return db[_0x3f4f('0x61')][_0x3f4f('0x4e')](_[_0x3f4f('0x66')](_0x9ab20f,['ids','id'])||{},{'fields':_[_0x3f4f('0x4c')](_0x38f0ee),'raw':!![]})[_0x3f4f('0x28')](function(_0x321354){_0x185f2a[_0x3f4f('0x67')]['push'](_0x321354['dataValues']);})[_0x3f4f('0x4b')](function(_0x213034){_0x185f2a[_0x3f4f('0x68')][_0x3f4f('0x69')]({'data':_0x9ab20f,'error':_0x213034['message']});});})[_0x3f4f('0x28')](function(_0x4bb902){return _0x185f2a;})['catch'](function(_0x356fa3){return _0x356fa3;});}else{_0x31a11e['status'](0x190)[_0x3f4f('0x1d')]({'message':_0x3f4f('0x6a')});}});}})[_0x3f4f('0x28')](respondWithResult(_0x31a11e,null))[_0x3f4f('0x4b')](handleError(_0x31a11e,null));};exports[_0x3f4f('0x6b')]=function(_0x49f8f8,_0x25e81d,_0x46c3da){var _0x282350;return db[_0x3f4f('0x32')]['find']({'where':{'id':_0x49f8f8[_0x3f4f('0x58')]['id']},'include':[{'model':db[_0x3f4f('0x6c')],'as':_0x3f4f('0x6d')}]})[_0x3f4f('0x28')](handleEntityNotFound(_0x25e81d,null))[_0x3f4f('0x28')](function(_0x2ac514){if(_0x2ac514){_0x282350=_0x2ac514;return db[_0x3f4f('0x61')]['rawAttributes'];}})[_0x3f4f('0x28')](function(_0x1c305f){if(_0x1c305f){var _0x5c85a3={};var _0x422cea={};_0x422cea['model']=_[_0x3f4f('0x6e')](_[_0x3f4f('0x4c')](_0x1c305f),_[_0x3f4f('0x31')](_0x282350[_0x3f4f('0x6d')],function(_0x550433){return util[_0x3f4f('0x6f')]('cf_%d',_0x550433['id']);}));_0x422cea[_0x3f4f('0x36')]=_[_0x3f4f('0x4c')](_0x49f8f8[_0x3f4f('0x36')]);_0x422cea['filters']=_[_0x3f4f('0x38')](_0x422cea[_0x3f4f('0x39')],_0x422cea[_0x3f4f('0x36')]);_0x5c85a3[_0x3f4f('0x3a')]=_[_0x3f4f('0x38')](_0x422cea[_0x3f4f('0x39')],qs[_0x3f4f('0x3b')](_0x49f8f8[_0x3f4f('0x36')][_0x3f4f('0x3b')]));_0x5c85a3[_0x3f4f('0x3a')]=_0x5c85a3[_0x3f4f('0x3a')][_0x3f4f('0x3c')]?_0x5c85a3['attributes']:_0x422cea[_0x3f4f('0x39')];if(!_0x49f8f8[_0x3f4f('0x36')][_0x3f4f('0x3d')](_0x3f4f('0x3e'))){_0x5c85a3['limit']=qs[_0x3f4f('0x1f')](_0x49f8f8['query'][_0x3f4f('0x1f')]);_0x5c85a3[_0x3f4f('0x1e')]=qs['offset'](_0x49f8f8[_0x3f4f('0x36')][_0x3f4f('0x1e')]);}_0x5c85a3['order']=qs['sort'](_0x49f8f8[_0x3f4f('0x36')][_0x3f4f('0x40')]);_0x5c85a3[_0x3f4f('0x41')]=qs['filters'](_[_0x3f4f('0x42')](_0x49f8f8['query'],_0x422cea[_0x3f4f('0x37')]));_0x5c85a3[_0x3f4f('0x70')]=!![];if(_0x49f8f8[_0x3f4f('0x36')][_0x3f4f('0x43')]){_0x5c85a3[_0x3f4f('0x41')]=_['merge'](_0x5c85a3[_0x3f4f('0x41')],{'$or':_['map'](_0x5c85a3[_0x3f4f('0x3a')],function(_0x6a98d3){var _0x2a0ed7={};_0x2a0ed7[_0x6a98d3]={'$like':'%'+_0x49f8f8[_0x3f4f('0x36')][_0x3f4f('0x43')]+'%'};return _0x2a0ed7;})});}_0x5c85a3=_[_0x3f4f('0x44')]({},_0x5c85a3,_0x49f8f8[_0x3f4f('0x46')]);return _0x282350[_0x3f4f('0x6b')](_0x5c85a3);}})[_0x3f4f('0x28')](respondWithResult(_0x25e81d,null))[_0x3f4f('0x4b')](handleError(_0x25e81d,null));};exports[_0x3f4f('0x71')]=function(_0x3de245,_0x23667f,_0x310768){var _0x5420f1;return db[_0x3f4f('0x32')][_0x3f4f('0x4d')]({'where':{'id':_0x3de245[_0x3f4f('0x58')]['id']},'include':[{'model':db[_0x3f4f('0x6c')],'as':_0x3f4f('0x6d')}]})[_0x3f4f('0x28')](handleEntityNotFound(_0x23667f,null))[_0x3f4f('0x28')](function(_0x3f38fc){if(_0x3f38fc){_0x5420f1=_0x3f38fc;return db[_0x3f4f('0x61')][_0x3f4f('0x33')];}})['then'](function(_0x8b81e6){if(_0x8b81e6){var _0x4a91a1={};var _0x1201ac={};_0x1201ac['model']=_['concat'](_[_0x3f4f('0x4c')](_0x8b81e6),_[_0x3f4f('0x31')](_0x5420f1[_0x3f4f('0x6d')],function(_0x213980){return util[_0x3f4f('0x6f')]('cf_%d',_0x213980['id']);}));_0x1201ac[_0x3f4f('0x36')]=_[_0x3f4f('0x4c')](_0x3de245['query']);_0x1201ac[_0x3f4f('0x37')]=_[_0x3f4f('0x38')](_0x1201ac['model'],_0x1201ac[_0x3f4f('0x36')]);_0x4a91a1[_0x3f4f('0x3a')]=_[_0x3f4f('0x38')](_0x1201ac[_0x3f4f('0x39')],qs[_0x3f4f('0x3b')](_0x3de245['query'][_0x3f4f('0x3b')]));_0x4a91a1[_0x3f4f('0x3a')]=_0x4a91a1[_0x3f4f('0x3a')][_0x3f4f('0x3c')]?_0x4a91a1[_0x3f4f('0x3a')]:_0x1201ac[_0x3f4f('0x39')];if(!_0x3de245[_0x3f4f('0x36')][_0x3f4f('0x3d')](_0x3f4f('0x3e'))){_0x4a91a1[_0x3f4f('0x1f')]=qs['limit'](_0x3de245[_0x3f4f('0x36')][_0x3f4f('0x1f')]);_0x4a91a1[_0x3f4f('0x1e')]=qs['offset'](_0x3de245[_0x3f4f('0x36')]['offset']);}_0x4a91a1[_0x3f4f('0x3f')]=qs[_0x3f4f('0x40')](_0x3de245[_0x3f4f('0x36')][_0x3f4f('0x40')]);_0x4a91a1[_0x3f4f('0x41')]=qs[_0x3f4f('0x37')](_[_0x3f4f('0x42')](_0x3de245['query'],_0x1201ac[_0x3f4f('0x37')]));_0x4a91a1[_0x3f4f('0x70')]=!![];if(_0x3de245[_0x3f4f('0x36')][_0x3f4f('0x43')]){_0x4a91a1[_0x3f4f('0x41')]=_[_0x3f4f('0x44')](_0x4a91a1[_0x3f4f('0x41')],{'$or':_[_0x3f4f('0x31')](_0x4a91a1[_0x3f4f('0x3a')],function(_0x1bf5d7){var _0x9ef63b={};_0x9ef63b[_0x1bf5d7]={'$like':'%'+_0x3de245['query'][_0x3f4f('0x43')]+'%'};return _0x9ef63b;})});}_0x4a91a1=_[_0x3f4f('0x44')]({},_0x4a91a1,_0x3de245[_0x3f4f('0x46')]);return _0x5420f1[_0x3f4f('0x6b')](_0x4a91a1);}})['then'](function(_0x478c4d){if(!_[_0x3f4f('0x72')](_0x478c4d)){var _0x4b6b26=toCsv(_0x478c4d);var _0x3084e5=Date[_0x3f4f('0x73')]();fs[_0x3f4f('0x74')](util[_0x3f4f('0x6f')](_0x3f4f('0x75'),_0x5420f1['id'],_0x3084e5),_0x4b6b26);_0x23667f[_0x3f4f('0x76')](_0x3f4f('0x77'),_0x3f4f('0x78')+util['format'](_0x3f4f('0x79'),_0x5420f1['id'],_0x3084e5));_0x23667f[_0x3f4f('0x76')](_0x3f4f('0x7a'),_0x3f4f('0x7b'));return _0x23667f[_0x3f4f('0x7c')](util[_0x3f4f('0x6f')](_0x3f4f('0x75'),_0x5420f1['id'],_0x3084e5));}else{return _0x23667f[_0x3f4f('0x1a')](0xcc);}})[_0x3f4f('0x4b')](handleError(_0x23667f,null));};exports[_0x3f4f('0x7d')]=function(_0x32f8e5,_0x545fb1,_0xae16e5){var _0x24d53f;delete _0x32f8e5[_0x3f4f('0x57')]['id'];return db[_0x3f4f('0x32')][_0x3f4f('0x7e')]({'where':{'id':_0x32f8e5[_0x3f4f('0x58')]['id']}})['then'](handleEntityNotFound(_0x545fb1,null))[_0x3f4f('0x28')](function(_0x5a28ce){if(_0x5a28ce){return db[_0x3f4f('0x7f')][_0x3f4f('0x80')](function(_0x543b6b){return db[_0x3f4f('0x6c')][_0x3f4f('0x4e')](_0x32f8e5['body'],{'transaction':_0x543b6b})['then'](function(_0x5debb6){_0x24d53f=_0x5debb6;return _0x5a28ce[_0x3f4f('0x81')](_0x5debb6,{'transaction':_0x543b6b});})[_0x3f4f('0x28')](function(){var _0x517ab4={'type':db[_0x3f4f('0x82')][_0x3f4f('0x83')],'transaction':_0x543b6b};switch(_0x32f8e5['body'][_0x3f4f('0x35')]){case _0x3f4f('0x84'):_0x517ab4[_0x3f4f('0x35')]=db[_0x3f4f('0x82')][_0x3f4f('0x83')];break;case _0x3f4f('0x85'):_0x517ab4[_0x3f4f('0x35')]=db[_0x3f4f('0x82')]['INTEGER'];break;case _0x3f4f('0x86'):_0x517ab4['type']=db[_0x3f4f('0x82')]['BOOLEAN'];_0x517ab4['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0x3f4f('0x87')]('cm_contacts',util[_0x3f4f('0x6f')](_0x3f4f('0x88'),_0x24d53f['id']),_0x517ab4);})[_0x3f4f('0x28')](function(){return _0x24d53f;});});}})[_0x3f4f('0x28')](respondWithResult(_0x545fb1,null))[_0x3f4f('0x4b')](handleError(_0x545fb1,null));};exports[_0x3f4f('0x89')]=function(_0x10cd1d,_0x2271bf,_0x3cbe45){var _0x3bbb96={};var _0x3f626b={};var _0x45fb98;var _0xafd1ea;return db[_0x3f4f('0x32')][_0x3f4f('0x7e')]({'where':{'id':_0x10cd1d[_0x3f4f('0x58')]['id']}})[_0x3f4f('0x28')](handleEntityNotFound(_0x2271bf,null))['then'](function(_0x5839c3){if(_0x5839c3){_0x45fb98=_0x5839c3;_0x3f626b['model']=_['keys'](db['CmCustomField'][_0x3f4f('0x33')]);_0x3f626b[_0x3f4f('0x36')]=_['keys'](_0x10cd1d['query']);_0x3f626b[_0x3f4f('0x37')]=_[_0x3f4f('0x38')](_0x3f626b[_0x3f4f('0x39')],_0x3f626b[_0x3f4f('0x36')]);_0x3bbb96[_0x3f4f('0x3a')]=_[_0x3f4f('0x38')](_0x3f626b[_0x3f4f('0x39')],qs[_0x3f4f('0x3b')](_0x10cd1d['query']['fields']));_0x3bbb96[_0x3f4f('0x3a')]=_0x3bbb96[_0x3f4f('0x3a')]['length']?_0x3bbb96[_0x3f4f('0x3a')]:_0x3f626b['model'];_0x3bbb96[_0x3f4f('0x3f')]=qs['sort'](_0x10cd1d[_0x3f4f('0x36')][_0x3f4f('0x40')]);_0x3bbb96[_0x3f4f('0x41')]=qs[_0x3f4f('0x37')](_[_0x3f4f('0x42')](_0x10cd1d[_0x3f4f('0x36')],_0x3f626b[_0x3f4f('0x37')]));_0x3bbb96[_0x3f4f('0x41')]=_[_0x3f4f('0x44')](_0x3bbb96['where'],{'$or':[{'ListId':_0x5839c3['id']},{'ListId':null}]});if(_0x10cd1d[_0x3f4f('0x36')][_0x3f4f('0x43')]){_0x3bbb96[_0x3f4f('0x41')]=_[_0x3f4f('0x44')](_0x3bbb96[_0x3f4f('0x41')],{'$or':_['map'](_0x3bbb96['attributes'],function(_0x1080e0){var _0x1c2c3b={};_0x1c2c3b[_0x1080e0]={'$like':'%'+_0x10cd1d['query'][_0x3f4f('0x43')]+'%'};return _0x1c2c3b;})});}_0x3bbb96=_[_0x3f4f('0x44')]({},_0x3bbb96,_0x10cd1d[_0x3f4f('0x46')]);return db[_0x3f4f('0x6c')][_0x3f4f('0x8a')](_0x3bbb96);}})[_0x3f4f('0x28')](respondWithResult(_0x2271bf,null))[_0x3f4f('0x4b')](handleError(_0x2271bf,null));};exports[_0x3f4f('0x8b')]=function(_0x397bef,_0x5a2872,_0x3e373d){return db['CmList'][_0x3f4f('0x4d')]({'where':{'id':_0x397bef[_0x3f4f('0x58')]['id']}})[_0x3f4f('0x28')](handleEntityNotFound(_0x5a2872,null))['then'](function(_0x394307){if(_0x394307){return _0x394307[_0x3f4f('0x8b')](_0x397bef[_0x3f4f('0x57')][_0x3f4f('0x5f')],_['omit'](_0x397bef[_0x3f4f('0x57')],[_0x3f4f('0x5f'),'id'])||{})['spread'](function(_0x3ea715){for(var _0x8e9494=0x0;_0x8e9494<_0x397bef[_0x3f4f('0x57')][_0x3f4f('0x5f')][_0x3f4f('0x3c')];_0x8e9494+=0x1){socket[_0x3f4f('0x8c')](_0x3f4f('0x8d'),{'UserId':Number(_0x397bef[_0x3f4f('0x57')][_0x3f4f('0x5f')][_0x8e9494]),'CmListId':Number(_0x397bef[_0x3f4f('0x58')]['id'])});}return _0x3ea715;});}})['then'](respondWithResult(_0x5a2872,null))[_0x3f4f('0x4b')](handleError(_0x5a2872,null));};exports[_0x3f4f('0x8e')]=function(_0x2795ea,_0x4f0ab1,_0x4b0002){return db['CmList'][_0x3f4f('0x4d')]({'where':{'id':_0x2795ea[_0x3f4f('0x58')]['id']}})[_0x3f4f('0x28')](handleEntityNotFound(_0x4f0ab1,null))[_0x3f4f('0x28')](function(_0x420ce5){if(_0x420ce5){return _0x420ce5[_0x3f4f('0x8e')](_0x2795ea['query'][_0x3f4f('0x5f')])['then'](function(){if(_[_0x3f4f('0x64')](_0x2795ea[_0x3f4f('0x36')]['ids'])){for(var _0x214e86=0x0;_0x214e86<_0x2795ea[_0x3f4f('0x36')][_0x3f4f('0x5f')][_0x3f4f('0x3c')];_0x214e86+=0x1){socket[_0x3f4f('0x8c')](_0x3f4f('0x8f'),{'UserId':Number(_0x2795ea[_0x3f4f('0x36')][_0x3f4f('0x5f')][_0x214e86]),'CmListId':Number(_0x2795ea[_0x3f4f('0x58')]['id'])});}}else{socket[_0x3f4f('0x8c')]('userCmList:remove',{'UserId':Number(_0x2795ea['query']['ids']),'CmListId':Number(_0x2795ea[_0x3f4f('0x58')]['id'])});}});}})[_0x3f4f('0x28')](respondWithStatusCode(_0x4f0ab1,null))[_0x3f4f('0x4b')](handleError(_0x4f0ab1,null));};exports[_0x3f4f('0x90')]=function(_0x36a3d0,_0x55a6f7,_0x2a6e81){var _0x5e312a={};var _0x511f65={};var _0x531652;var _0x5ecdc3;return db['CmList']['findOne']({'where':{'id':_0x36a3d0[_0x3f4f('0x58')]['id']}})[_0x3f4f('0x28')](handleEntityNotFound(_0x55a6f7,null))[_0x3f4f('0x28')](function(_0x1a8dd7){if(_0x1a8dd7){_0x531652=_0x1a8dd7;_0x511f65[_0x3f4f('0x39')]=_[_0x3f4f('0x4c')](db[_0x3f4f('0x91')][_0x3f4f('0x33')]);_0x511f65[_0x3f4f('0x36')]=_[_0x3f4f('0x4c')](_0x36a3d0[_0x3f4f('0x36')]);_0x511f65[_0x3f4f('0x37')]=_[_0x3f4f('0x38')](_0x511f65[_0x3f4f('0x39')],_0x511f65[_0x3f4f('0x36')]);_0x5e312a[_0x3f4f('0x3a')]=_[_0x3f4f('0x38')](_0x511f65[_0x3f4f('0x39')],qs['fields'](_0x36a3d0[_0x3f4f('0x36')]['fields']));_0x5e312a[_0x3f4f('0x3a')]=_0x5e312a[_0x3f4f('0x3a')]['length']?_0x5e312a[_0x3f4f('0x3a')]:_0x511f65['model'];_0x5e312a['order']=qs['sort'](_0x36a3d0['query']['sort']);_0x5e312a[_0x3f4f('0x41')]=qs['filters'](_['pick'](_0x36a3d0[_0x3f4f('0x36')],_0x511f65[_0x3f4f('0x37')]));if(_0x36a3d0[_0x3f4f('0x36')][_0x3f4f('0x43')]){_0x5e312a['where']=_[_0x3f4f('0x44')](_0x5e312a[_0x3f4f('0x41')],{'$or':_[_0x3f4f('0x31')](_0x5e312a[_0x3f4f('0x3a')],function(_0x4862ed){var _0x5ed340={};_0x5ed340[_0x4862ed]={'$like':'%'+_0x36a3d0[_0x3f4f('0x36')]['filter']+'%'};return _0x5ed340;})});}_0x5e312a=_['merge']({},_0x5e312a,_0x36a3d0[_0x3f4f('0x46')]);return _0x531652['getAgents'](_0x5e312a);}})[_0x3f4f('0x28')](function(_0x308733){if(_0x308733){_0x5ecdc3=_0x308733[_0x3f4f('0x3c')];if(!_0x36a3d0[_0x3f4f('0x36')][_0x3f4f('0x3d')]('nolimit')){_0x5e312a[_0x3f4f('0x1f')]=qs['limit'](_0x36a3d0[_0x3f4f('0x36')][_0x3f4f('0x1f')]);_0x5e312a[_0x3f4f('0x1e')]=qs[_0x3f4f('0x1e')](_0x36a3d0[_0x3f4f('0x36')][_0x3f4f('0x1e')]);}return _0x531652['getAgents'](_0x5e312a);}})[_0x3f4f('0x28')](function(_0xefbc4e){if(_0xefbc4e){return _0xefbc4e?{'count':_0x5ecdc3,'rows':_0xefbc4e}:null;}})[_0x3f4f('0x28')](respondWithResult(_0x55a6f7,null))[_0x3f4f('0x4b')](handleError(_0x55a6f7,null));}; \ No newline at end of file +var _0x024e=['send','index','CmList','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','get','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getDispositions','findOne','Disposition','order','ListId','removeDispositions','addContacts','CmContact','tags','isArray','join','push','omit','success','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','addColumn','cf_%s','findAndCountAll','addAgents','ids','spread','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','json','reject','save','then','destroy','Lists','UserProfileResource','stack','name'];(function(_0x3f67fc,_0x4311da){var _0x1f90e2=function(_0x385ba7){while(--_0x385ba7){_0x3f67fc['push'](_0x3f67fc['shift']());}};_0x1f90e2(++_0x4311da);}(_0x024e,0x177));var _0xe024=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x024e[_0x55fa03];return _0x2cd7cd;};'use strict';var emlformat=require(_0xe024('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe024('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe024('0x2'));var moment=require(_0xe024('0x3'));var BPromise=require(_0xe024('0x4'));var Mustache=require(_0xe024('0x5'));var util=require(_0xe024('0x6'));var path=require(_0xe024('0x7'));var sox=require(_0xe024('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe024('0x9'));var _=require('lodash');var squel=require(_0xe024('0xa'));var crypto=require(_0xe024('0xb'));var jsforce=require(_0xe024('0xc'));var deskjs=require(_0xe024('0xd'));var toCsv=require(_0xe024('0xe'));var querystring=require(_0xe024('0xf'));var Papa=require('papaparse');var Redis=require(_0xe024('0x10'));var authService=require(_0xe024('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe024('0x12'));var hardwareService=require(_0xe024('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe024('0x14'));var db=require(_0xe024('0x15'))['db'];config[_0xe024('0x16')]=_['defaults'](config[_0xe024('0x16')],{'host':_0xe024('0x17'),'port':0x18eb});var socket=require(_0xe024('0x18'))(new Redis(config[_0xe024('0x16')]));require('./cmList.socket')[_0xe024('0x19')](socket);function respondWithStatusCode(_0x4a65d7,_0x5b6d3d){_0x5b6d3d=_0x5b6d3d||0xcc;return function(_0x219507){if(_0x219507){return _0x4a65d7[_0xe024('0x1a')](_0x5b6d3d);}return _0x4a65d7[_0xe024('0x1b')](_0x5b6d3d)[_0xe024('0x1c')]();};}function respondWithResult(_0x21fa82,_0x5cce19){_0x5cce19=_0x5cce19||0xc8;return function(_0x4da40e){if(_0x4da40e){return _0x21fa82[_0xe024('0x1b')](_0x5cce19)['json'](_0x4da40e);}};}function respondWithFilteredResult(_0x331788,_0xe3465f){return function(_0x3dbb97){if(_0x3dbb97){var _0x20cb84=typeof _0xe3465f[_0xe024('0x1d')]===_0xe024('0x1e')&&typeof _0xe3465f['limit']===_0xe024('0x1e');var _0x3d381d=_0x3dbb97[_0xe024('0x1f')];var _0x127648=_0x20cb84?0x0:_0xe3465f[_0xe024('0x1d')];var _0x173727=_0x20cb84?_0x3dbb97[_0xe024('0x1f')]:_0xe3465f[_0xe024('0x1d')]+_0xe3465f[_0xe024('0x20')];var _0x57fd61;if(_0x173727>=_0x3d381d){_0x173727=_0x3d381d;_0x57fd61=0xc8;}else{_0x57fd61=0xce;}_0x331788[_0xe024('0x1b')](_0x57fd61);return _0x331788['set']('Content-Range',_0x127648+'-'+_0x173727+'/'+_0x3d381d)[_0xe024('0x21')](_0x3dbb97);}return null;};}function patchUpdates(_0xaacee5){return function(_0x193647){try{jsonpatch['apply'](_0x193647,_0xaacee5,!![]);}catch(_0x3f4493){return BPromise[_0xe024('0x22')](_0x3f4493);}return _0x193647[_0xe024('0x23')]();};}function saveUpdates(_0x42dcc5,_0x3bd0aa){return function(_0xaa8b4e){if(_0xaa8b4e){return _0xaa8b4e['update'](_0x42dcc5)[_0xe024('0x24')](function(_0x5cb78a){return _0x5cb78a;});}return null;};}function removeEntity(_0x432f22,_0x4424c0){return function(_0x42158f){if(_0x42158f){return _0x42158f[_0xe024('0x25')]()[_0xe024('0x24')](function(){var _0x234c5f=_0x42158f['get']({'plain':!![]});var _0xe74d1b=_0xe024('0x26');return db[_0xe024('0x27')][_0xe024('0x25')]({'where':{'type':_0xe74d1b,'resourceId':_0x234c5f['id']}})[_0xe024('0x24')](function(){return _0x42158f;});})[_0xe024('0x24')](function(){_0x432f22[_0xe024('0x1b')](0xcc)[_0xe024('0x1c')]();});}};}function handleEntityNotFound(_0x3d24e9,_0x139612){return function(_0x492e15){if(!_0x492e15){_0x3d24e9['sendStatus'](0x194);}return _0x492e15;};}function handleError(_0x2bedd5,_0x14c31f){_0x14c31f=_0x14c31f||0x1f4;return function(_0xab9a6e){logger['error'](_0xab9a6e[_0xe024('0x28')]);if(_0xab9a6e[_0xe024('0x29')]){delete _0xab9a6e[_0xe024('0x29')];}_0x2bedd5['status'](_0x14c31f)[_0xe024('0x2a')](_0xab9a6e);};}exports[_0xe024('0x2b')]=function(_0x177209,_0x3474b7){var _0x3c4a93={},_0x590c05={},_0x92006b={'count':0x0,'rows':[]};var _0x1941cc=_['map'](db[_0xe024('0x2c')][_0xe024('0x2d')],function(_0x2035f6){return{'name':_0x2035f6[_0xe024('0x2e')],'type':_0x2035f6['type']['key']};});_0x590c05['model']=_['map'](_0x1941cc,'name');_0x590c05[_0xe024('0x2f')]=_[_0xe024('0x30')](_0x177209[_0xe024('0x2f')]);_0x590c05[_0xe024('0x31')]=_[_0xe024('0x32')](_0x590c05[_0xe024('0x33')],_0x590c05[_0xe024('0x2f')]);_0x3c4a93['attributes']=_['intersection'](_0x590c05[_0xe024('0x33')],qs[_0xe024('0x34')](_0x177209['query'][_0xe024('0x34')]));_0x3c4a93['attributes']=_0x3c4a93[_0xe024('0x35')][_0xe024('0x36')]?_0x3c4a93[_0xe024('0x35')]:_0x590c05[_0xe024('0x33')];if(!_0x177209['query'][_0xe024('0x37')](_0xe024('0x38'))){_0x3c4a93['limit']=qs['limit'](_0x177209[_0xe024('0x2f')]['limit']);_0x3c4a93['offset']=qs[_0xe024('0x1d')](_0x177209[_0xe024('0x2f')][_0xe024('0x1d')]);}_0x3c4a93['order']=qs[_0xe024('0x39')](_0x177209[_0xe024('0x2f')][_0xe024('0x39')]);_0x3c4a93[_0xe024('0x3a')]=qs['filters'](_[_0xe024('0x3b')](_0x177209[_0xe024('0x2f')],_0x590c05[_0xe024('0x31')]),_0x1941cc);if(_0x177209['query'][_0xe024('0x3c')]){_0x3c4a93[_0xe024('0x3a')]=_[_0xe024('0x3d')](_0x3c4a93[_0xe024('0x3a')],{'$or':_[_0xe024('0x3e')](_0x1941cc,function(_0x4279a1){if(_0x4279a1[_0xe024('0x3f')]!=='VIRTUAL'){var _0x56d70b={};_0x56d70b[_0x4279a1[_0xe024('0x29')]]={'$like':'%'+_0x177209[_0xe024('0x2f')]['filter']+'%'};return _0x56d70b;}})});}_0x3c4a93=_[_0xe024('0x3d')]({},_0x3c4a93,_0x177209[_0xe024('0x40')]);var _0x53fb4f={'where':_0x3c4a93[_0xe024('0x3a')]};return db[_0xe024('0x2c')][_0xe024('0x1f')](_0x53fb4f)[_0xe024('0x24')](function(_0x506d2c){_0x92006b['count']=_0x506d2c;if(_0x177209['query'][_0xe024('0x41')]){_0x3c4a93[_0xe024('0x42')]=[{'all':!![]}];}return db[_0xe024('0x2c')][_0xe024('0x43')](_0x3c4a93);})[_0xe024('0x24')](function(_0x2ceca2){_0x92006b[_0xe024('0x44')]=_0x2ceca2;return _0x92006b;})[_0xe024('0x24')](respondWithFilteredResult(_0x3474b7,_0x3c4a93))[_0xe024('0x45')](handleError(_0x3474b7,null));};exports[_0xe024('0x46')]=function(_0x3a6a7a,_0xacce3e){var _0x12378a={'raw':![],'where':{'id':_0x3a6a7a[_0xe024('0x47')]['id']}},_0x3d801d={};_0x3d801d[_0xe024('0x33')]=_['keys'](db['CmList'][_0xe024('0x2d')]);_0x3d801d[_0xe024('0x2f')]=_[_0xe024('0x30')](_0x3a6a7a[_0xe024('0x2f')]);_0x3d801d[_0xe024('0x31')]=_[_0xe024('0x32')](_0x3d801d[_0xe024('0x33')],_0x3d801d[_0xe024('0x2f')]);_0x12378a[_0xe024('0x35')]=_[_0xe024('0x32')](_0x3d801d[_0xe024('0x33')],qs[_0xe024('0x34')](_0x3a6a7a[_0xe024('0x2f')][_0xe024('0x34')]));_0x12378a[_0xe024('0x35')]=_0x12378a[_0xe024('0x35')][_0xe024('0x36')]?_0x12378a[_0xe024('0x35')]:_0x3d801d[_0xe024('0x33')];if(_0x3a6a7a['query'][_0xe024('0x41')]){_0x12378a[_0xe024('0x42')]=[{'all':!![]}];}_0x12378a=_[_0xe024('0x3d')]({},_0x12378a,_0x3a6a7a['options']);return db['CmList'][_0xe024('0x48')](_0x12378a)[_0xe024('0x24')](handleEntityNotFound(_0xacce3e,null))['then'](respondWithResult(_0xacce3e,null))[_0xe024('0x45')](handleError(_0xacce3e,null));};exports['create']=function(_0x19c36b,_0x3368cd){return db[_0xe024('0x2c')][_0xe024('0x49')](_0x19c36b['body'],{})['then'](function(_0x73839){var _0x912803=_0x19c36b[_0xe024('0x4a')][_0xe024('0x4b')]({'plain':!![]});if(!_0x912803)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x912803[_0xe024('0x4c')]===_0xe024('0x4a')){var _0x209529=_0x73839['get']({'plain':!![]});var _0x1edc1f=_0xe024('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x1edc1f,'userProfileId':_0x912803[_0xe024('0x4d')]},'raw':!![]})[_0xe024('0x24')](function(_0x2dbc4){if(_0x2dbc4&&_0x2dbc4[_0xe024('0x4e')]===0x0){return db['UserProfileResource'][_0xe024('0x49')]({'name':_0x209529[_0xe024('0x29')],'resourceId':_0x209529['id'],'type':_0x2dbc4[_0xe024('0x29')],'sectionId':_0x2dbc4['id']},{})['then'](function(){return _0x73839;});}else{return _0x73839;}})['catch'](function(_0x266139){logger[_0xe024('0x4f')](_0xe024('0x50'),_0x266139);throw _0x266139;});}return _0x73839;})['then'](respondWithResult(_0x3368cd,0xc9))['catch'](handleError(_0x3368cd,null));};exports[_0xe024('0x51')]=function(_0x533dd6,_0x507cba){if(_0x533dd6[_0xe024('0x52')]['id']){delete _0x533dd6['body']['id'];}return db[_0xe024('0x2c')][_0xe024('0x48')]({'where':{'id':_0x533dd6[_0xe024('0x47')]['id']}})[_0xe024('0x24')](handleEntityNotFound(_0x507cba,null))[_0xe024('0x24')](saveUpdates(_0x533dd6[_0xe024('0x52')],null))[_0xe024('0x24')](respondWithResult(_0x507cba,null))[_0xe024('0x45')](handleError(_0x507cba,null));};exports[_0xe024('0x25')]=function(_0x2cafb3,_0x26ea00){return db[_0xe024('0x2c')][_0xe024('0x48')]({'where':{'id':_0x2cafb3[_0xe024('0x47')]['id']}})[_0xe024('0x24')](handleEntityNotFound(_0x26ea00,null))['then'](removeEntity(_0x26ea00,null))[_0xe024('0x45')](handleError(_0x26ea00,null));};exports[_0xe024('0x53')]=function(_0x7bb38a,_0x508832){return db[_0xe024('0x2c')]['describe']()[_0xe024('0x24')](respondWithResult(_0x508832,null))[_0xe024('0x45')](handleError(_0x508832,null));};exports['addDisposition']=function(_0xaf8b5e,_0x24525e,_0x43b47e){if(_0xaf8b5e[_0xe024('0x52')]['id']){delete _0xaf8b5e[_0xe024('0x52')]['id'];}return db[_0xe024('0x2c')][_0xe024('0x48')]({'where':{'id':_0xaf8b5e[_0xe024('0x47')]['id']}})['then'](handleEntityNotFound(_0x24525e,null))[_0xe024('0x24')](function(_0x7646ec){if(_0x7646ec){_0xaf8b5e[_0xe024('0x52')]['ListId']=_0x7646ec['id'];return db['Disposition'][_0xe024('0x49')](_0xaf8b5e[_0xe024('0x52')]);}})[_0xe024('0x24')](respondWithResult(_0x24525e,null))[_0xe024('0x45')](handleError(_0x24525e,null));};exports[_0xe024('0x54')]=function(_0x352dfb,_0x3924d6,_0x5c7a4f){var _0x26fda9={'raw':![],'where':{}};var _0x24c214={};var _0x31b2f2={'count':0x0,'rows':[]};return db[_0xe024('0x2c')][_0xe024('0x55')]({'where':{'id':_0x352dfb['params']['id']}})['then'](handleEntityNotFound(_0x3924d6,null))[_0xe024('0x24')](function(_0x16a4b1){if(_0x16a4b1){_0x24c214[_0xe024('0x33')]=_[_0xe024('0x30')](db[_0xe024('0x56')][_0xe024('0x2d')]);_0x24c214['query']=_[_0xe024('0x30')](_0x352dfb[_0xe024('0x2f')]);_0x24c214['filters']=_[_0xe024('0x32')](_0x24c214[_0xe024('0x33')],_0x24c214[_0xe024('0x2f')]);_0x26fda9[_0xe024('0x35')]=_[_0xe024('0x32')](_0x24c214[_0xe024('0x33')],qs[_0xe024('0x34')](_0x352dfb[_0xe024('0x2f')][_0xe024('0x34')]));_0x26fda9[_0xe024('0x35')]=_0x26fda9[_0xe024('0x35')][_0xe024('0x36')]?_0x26fda9[_0xe024('0x35')]:_0x24c214[_0xe024('0x33')];if(!_0x352dfb[_0xe024('0x2f')][_0xe024('0x37')](_0xe024('0x38'))){_0x26fda9[_0xe024('0x20')]=qs[_0xe024('0x20')](_0x352dfb[_0xe024('0x2f')][_0xe024('0x20')]);_0x26fda9['offset']=qs[_0xe024('0x1d')](_0x352dfb[_0xe024('0x2f')]['offset']);}_0x26fda9[_0xe024('0x57')]=qs[_0xe024('0x39')](_0x352dfb['query'][_0xe024('0x39')]);_0x26fda9[_0xe024('0x3a')]=qs[_0xe024('0x31')](_['pick'](_0x352dfb['query'],_0x24c214[_0xe024('0x31')]));_0x26fda9[_0xe024('0x3a')][_0xe024('0x58')]=_0x16a4b1['id'];if(_0x352dfb[_0xe024('0x2f')][_0xe024('0x3c')]){_0x26fda9['where']=_[_0xe024('0x3d')](_0x26fda9[_0xe024('0x3a')],{'$or':_[_0xe024('0x3e')](_0x26fda9[_0xe024('0x35')],function(_0x42905c){var _0x54ed84={};_0x54ed84[_0x42905c]={'$like':'%'+_0x352dfb[_0xe024('0x2f')][_0xe024('0x3c')]+'%'};return _0x54ed84;})});}_0x26fda9=_[_0xe024('0x3d')]({},_0x26fda9,_0x352dfb[_0xe024('0x40')]);return db['Disposition'][_0xe024('0x1f')]({'where':_0x26fda9[_0xe024('0x3a')]})[_0xe024('0x24')](function(_0x179868){_0x31b2f2[_0xe024('0x1f')]=_0x179868;if(_0x352dfb[_0xe024('0x2f')][_0xe024('0x41')]){_0x26fda9[_0xe024('0x42')]=[{'all':!![]}];}return db[_0xe024('0x56')]['findAll'](_0x26fda9);})['then'](function(_0x3263ae){_0x31b2f2[_0xe024('0x44')]=_0x3263ae;return _0x31b2f2;});}})[_0xe024('0x24')](respondWithFilteredResult(_0x3924d6,_0x26fda9))['catch'](handleError(_0x3924d6,null));};exports[_0xe024('0x59')]=function(_0xfa3771,_0x23794f,_0x130bf3){return db['CmList'][_0xe024('0x48')]({'where':{'id':_0xfa3771[_0xe024('0x47')]['id']}})[_0xe024('0x24')](handleEntityNotFound(_0x23794f,null))['then'](function(_0xadf081){if(_0xadf081){return _0xadf081[_0xe024('0x59')](_0xfa3771['query']['ids']);}})['then'](respondWithStatusCode(_0x23794f,null))[_0xe024('0x45')](handleError(_0x23794f,null));};exports[_0xe024('0x5a')]=function(_0x487ffe,_0x29c581,_0x270afa){return db[_0xe024('0x2c')][_0xe024('0x48')]({'where':{'id':_0x487ffe[_0xe024('0x47')]['id']}})['then'](handleEntityNotFound(_0x29c581,null))[_0xe024('0x24')](function(_0x1b9dd6){if(_0x1b9dd6){var _0x2bfc07=[];var _0x389282={'success':[],'errors':[]};return db[_0xe024('0x5b')][_0xe024('0x53')]()[_0xe024('0x24')](function(_0x1cd4d5){if(_0x487ffe[_0xe024('0x52')][_0xe024('0x5c')]&&_[_0xe024('0x5d')](_0x487ffe['body'][_0xe024('0x5c')])){if(_0x487ffe[_0xe024('0x52')][_0xe024('0x5c')]['length']){_0x487ffe['body']['tags']=_0x487ffe[_0xe024('0x52')][_0xe024('0x5c')][_0xe024('0x5e')](';')+';';}else{_0x487ffe[_0xe024('0x52')]['tags']=null;}}else{_0x487ffe[_0xe024('0x52')][_0xe024('0x5c')]=null;}if(_0x487ffe['body']&&_[_0xe024('0x5d')](_0x487ffe[_0xe024('0x52')])){for(var _0x339330=0x0;_0x339330<_0x487ffe[_0xe024('0x52')][_0xe024('0x36')];_0x339330+=0x1){_0x487ffe[_0xe024('0x52')][_0x339330][_0xe024('0x58')]=_0x487ffe[_0xe024('0x47')]['id'];_0x2bfc07[_0xe024('0x5f')](_0x487ffe[_0xe024('0x52')][_0x339330]);}return BPromise['each'](_0x2bfc07,function(_0x460022){return db[_0xe024('0x5b')]['create'](_[_0xe024('0x60')](_0x460022,['ids','id'])||{},{'fields':_[_0xe024('0x30')](_0x1cd4d5),'raw':!![]})[_0xe024('0x24')](function(_0x203d25){_0x389282[_0xe024('0x61')][_0xe024('0x5f')](_0x203d25['dataValues']);})[_0xe024('0x45')](function(_0x160756){_0x389282['errors'][_0xe024('0x5f')]({'data':_0x460022,'error':_0x160756[_0xe024('0x62')]});});})['then'](function(_0x3597a0){return _0x389282;})[_0xe024('0x45')](function(_0x34d255){return _0x34d255;});}else{_0x29c581['status'](0x190)[_0xe024('0x21')]({'message':_0xe024('0x63')});}});}})[_0xe024('0x24')](respondWithResult(_0x29c581,null))['catch'](handleError(_0x29c581,null));};exports['getContacts']=function(_0xbd0c55,_0x148718,_0x3fd3a1){var _0x50bab3;return db[_0xe024('0x2c')][_0xe024('0x48')]({'where':{'id':_0xbd0c55[_0xe024('0x47')]['id']},'include':[{'model':db[_0xe024('0x64')],'as':_0xe024('0x65')}]})[_0xe024('0x24')](handleEntityNotFound(_0x148718,null))[_0xe024('0x24')](function(_0x43aeff){if(_0x43aeff){_0x50bab3=_0x43aeff;return db['CmContact'][_0xe024('0x2d')];}})[_0xe024('0x24')](function(_0x347070){if(_0x347070){var _0x200725={};var _0x333963={};_0x333963[_0xe024('0x33')]=_[_0xe024('0x66')](_[_0xe024('0x30')](_0x347070),_[_0xe024('0x3e')](_0x50bab3[_0xe024('0x65')],function(_0x3e059b){return util[_0xe024('0x67')](_0xe024('0x68'),_0x3e059b['id']);}));_0x333963['query']=_[_0xe024('0x30')](_0xbd0c55[_0xe024('0x2f')]);_0x333963[_0xe024('0x31')]=_[_0xe024('0x32')](_0x333963[_0xe024('0x33')],_0x333963['query']);_0x200725[_0xe024('0x35')]=_[_0xe024('0x32')](_0x333963[_0xe024('0x33')],qs[_0xe024('0x34')](_0xbd0c55[_0xe024('0x2f')][_0xe024('0x34')]));_0x200725[_0xe024('0x35')]=_0x200725['attributes'][_0xe024('0x36')]?_0x200725[_0xe024('0x35')]:_0x333963['model'];if(!_0xbd0c55[_0xe024('0x2f')]['hasOwnProperty'](_0xe024('0x38'))){_0x200725[_0xe024('0x20')]=qs['limit'](_0xbd0c55['query'][_0xe024('0x20')]);_0x200725['offset']=qs[_0xe024('0x1d')](_0xbd0c55['query'][_0xe024('0x1d')]);}_0x200725[_0xe024('0x57')]=qs['sort'](_0xbd0c55[_0xe024('0x2f')]['sort']);_0x200725[_0xe024('0x3a')]=qs[_0xe024('0x31')](_['pick'](_0xbd0c55[_0xe024('0x2f')],_0x333963[_0xe024('0x31')]));_0x200725[_0xe024('0x69')]=!![];if(_0xbd0c55[_0xe024('0x2f')]['filter']){_0x200725[_0xe024('0x3a')]=_[_0xe024('0x3d')](_0x200725['where'],{'$or':_[_0xe024('0x3e')](_0x200725[_0xe024('0x35')],function(_0x53ba63){var _0x39c176={};_0x39c176[_0x53ba63]={'$like':'%'+_0xbd0c55['query']['filter']+'%'};return _0x39c176;})});}_0x200725=_['merge']({},_0x200725,_0xbd0c55['options']);return _0x50bab3[_0xe024('0x6a')](_0x200725);}})[_0xe024('0x24')](respondWithResult(_0x148718,null))[_0xe024('0x45')](handleError(_0x148718,null));};exports[_0xe024('0x6b')]=function(_0x5701c0,_0xf46998,_0x5cc477){var _0x53d48e;return db[_0xe024('0x2c')][_0xe024('0x48')]({'where':{'id':_0x5701c0[_0xe024('0x47')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xe024('0x65')}]})[_0xe024('0x24')](handleEntityNotFound(_0xf46998,null))[_0xe024('0x24')](function(_0x8f851a){if(_0x8f851a){_0x53d48e=_0x8f851a;return db['CmContact'][_0xe024('0x2d')];}})[_0xe024('0x24')](function(_0x1adfbc){if(_0x1adfbc){var _0x42bcf1={};var _0x2a4e49={};_0x2a4e49['model']=_['concat'](_['keys'](_0x1adfbc),_[_0xe024('0x3e')](_0x53d48e[_0xe024('0x65')],function(_0x411f47){return util[_0xe024('0x67')](_0xe024('0x68'),_0x411f47['id']);}));_0x2a4e49[_0xe024('0x2f')]=_['keys'](_0x5701c0['query']);_0x2a4e49['filters']=_[_0xe024('0x32')](_0x2a4e49[_0xe024('0x33')],_0x2a4e49[_0xe024('0x2f')]);_0x42bcf1['attributes']=_[_0xe024('0x32')](_0x2a4e49[_0xe024('0x33')],qs['fields'](_0x5701c0[_0xe024('0x2f')][_0xe024('0x34')]));_0x42bcf1['attributes']=_0x42bcf1[_0xe024('0x35')]['length']?_0x42bcf1['attributes']:_0x2a4e49[_0xe024('0x33')];if(!_0x5701c0[_0xe024('0x2f')][_0xe024('0x37')](_0xe024('0x38'))){_0x42bcf1['limit']=qs['limit'](_0x5701c0[_0xe024('0x2f')]['limit']);_0x42bcf1[_0xe024('0x1d')]=qs[_0xe024('0x1d')](_0x5701c0['query'][_0xe024('0x1d')]);}_0x42bcf1[_0xe024('0x57')]=qs['sort'](_0x5701c0['query'][_0xe024('0x39')]);_0x42bcf1[_0xe024('0x3a')]=qs['filters'](_[_0xe024('0x3b')](_0x5701c0[_0xe024('0x2f')],_0x2a4e49[_0xe024('0x31')]));_0x42bcf1[_0xe024('0x69')]=!![];if(_0x5701c0['query'][_0xe024('0x3c')]){_0x42bcf1[_0xe024('0x3a')]=_['merge'](_0x42bcf1[_0xe024('0x3a')],{'$or':_[_0xe024('0x3e')](_0x42bcf1[_0xe024('0x35')],function(_0x2c0e8e){var _0x5c12dd={};_0x5c12dd[_0x2c0e8e]={'$like':'%'+_0x5701c0['query'][_0xe024('0x3c')]+'%'};return _0x5c12dd;})});}_0x42bcf1=_[_0xe024('0x3d')]({},_0x42bcf1,_0x5701c0[_0xe024('0x40')]);return _0x53d48e[_0xe024('0x6a')](_0x42bcf1);}})[_0xe024('0x24')](function(_0x4471f7){if(!_['isEmpty'](_0x4471f7)){var _0x6d4a2=toCsv(_0x4471f7);var _0x40a9ea=Date[_0xe024('0x6c')]();fs[_0xe024('0x6d')](util['format'](_0xe024('0x6e'),_0x53d48e['id'],_0x40a9ea),_0x6d4a2);_0xf46998[_0xe024('0x6f')](_0xe024('0x70'),_0xe024('0x71')+util['format'](_0xe024('0x72'),_0x53d48e['id'],_0x40a9ea));_0xf46998[_0xe024('0x6f')](_0xe024('0x73'),_0xe024('0x74'));return _0xf46998['download'](util['format'](_0xe024('0x6e'),_0x53d48e['id'],_0x40a9ea));}else{return _0xf46998['sendStatus'](0xcc);}})[_0xe024('0x45')](handleError(_0xf46998,null));};exports[_0xe024('0x75')]=function(_0x56de3c,_0xaac858,_0x85b2c){var _0x23e853;delete _0x56de3c[_0xe024('0x52')]['id'];return db['CmList'][_0xe024('0x55')]({'where':{'id':_0x56de3c[_0xe024('0x47')]['id']}})['then'](handleEntityNotFound(_0xaac858,null))['then'](function(_0x25193f){if(_0x25193f){return db['sequelize']['transaction'](function(_0x3358f0){return db[_0xe024('0x64')][_0xe024('0x49')](_0x56de3c[_0xe024('0x52')],{'transaction':_0x3358f0})[_0xe024('0x24')](function(_0x413f39){_0x23e853=_0x413f39;return _0x25193f[_0xe024('0x76')](_0x413f39,{'transaction':_0x3358f0});})['then'](function(){var _0x3c6dbe={'type':db[_0xe024('0x77')][_0xe024('0x78')],'transaction':_0x3358f0};switch(_0x56de3c[_0xe024('0x52')][_0xe024('0x3f')]){case _0xe024('0x79'):_0x3c6dbe[_0xe024('0x3f')]=db[_0xe024('0x77')][_0xe024('0x78')];break;case _0xe024('0x7a'):_0x3c6dbe[_0xe024('0x3f')]=db[_0xe024('0x77')][_0xe024('0x7b')];break;case _0xe024('0x7c'):_0x3c6dbe['type']=db[_0xe024('0x77')][_0xe024('0x7d')];_0x3c6dbe[_0xe024('0x7e')]=![];break;default:}return db[_0xe024('0x7f')]['queryInterface'][_0xe024('0x80')]('cm_contacts',util[_0xe024('0x67')](_0xe024('0x81'),_0x23e853['id']),_0x3c6dbe);})[_0xe024('0x24')](function(){return _0x23e853;});});}})[_0xe024('0x24')](respondWithResult(_0xaac858,null))['catch'](handleError(_0xaac858,null));};exports['getCustomFields']=function(_0x3773f2,_0x4c6189,_0x1e9efb){var _0x124429={};var _0x2658d2={};var _0x9a109e;var _0x228b0d;return db['CmList'][_0xe024('0x55')]({'where':{'id':_0x3773f2['params']['id']}})['then'](handleEntityNotFound(_0x4c6189,null))[_0xe024('0x24')](function(_0x3ff568){if(_0x3ff568){_0x9a109e=_0x3ff568;_0x2658d2['model']=_[_0xe024('0x30')](db['CmCustomField'][_0xe024('0x2d')]);_0x2658d2[_0xe024('0x2f')]=_['keys'](_0x3773f2[_0xe024('0x2f')]);_0x2658d2[_0xe024('0x31')]=_[_0xe024('0x32')](_0x2658d2['model'],_0x2658d2[_0xe024('0x2f')]);_0x124429[_0xe024('0x35')]=_[_0xe024('0x32')](_0x2658d2[_0xe024('0x33')],qs['fields'](_0x3773f2[_0xe024('0x2f')]['fields']));_0x124429[_0xe024('0x35')]=_0x124429[_0xe024('0x35')][_0xe024('0x36')]?_0x124429[_0xe024('0x35')]:_0x2658d2[_0xe024('0x33')];_0x124429[_0xe024('0x57')]=qs[_0xe024('0x39')](_0x3773f2[_0xe024('0x2f')][_0xe024('0x39')]);_0x124429[_0xe024('0x3a')]=qs[_0xe024('0x31')](_[_0xe024('0x3b')](_0x3773f2[_0xe024('0x2f')],_0x2658d2['filters']));_0x124429['where']=_[_0xe024('0x3d')](_0x124429[_0xe024('0x3a')],{'$or':[{'ListId':_0x3ff568['id']},{'ListId':null}]});if(_0x3773f2['query']['filter']){_0x124429[_0xe024('0x3a')]=_['merge'](_0x124429[_0xe024('0x3a')],{'$or':_['map'](_0x124429[_0xe024('0x35')],function(_0x473af8){var _0x308c0d={};_0x308c0d[_0x473af8]={'$like':'%'+_0x3773f2[_0xe024('0x2f')]['filter']+'%'};return _0x308c0d;})});}_0x124429=_[_0xe024('0x3d')]({},_0x124429,_0x3773f2[_0xe024('0x40')]);return db[_0xe024('0x64')][_0xe024('0x82')](_0x124429);}})[_0xe024('0x24')](respondWithResult(_0x4c6189,null))[_0xe024('0x45')](handleError(_0x4c6189,null));};exports[_0xe024('0x83')]=function(_0x3c15f8,_0x232ddc,_0x30c132){return db[_0xe024('0x2c')][_0xe024('0x48')]({'where':{'id':_0x3c15f8[_0xe024('0x47')]['id']}})[_0xe024('0x24')](handleEntityNotFound(_0x232ddc,null))['then'](function(_0x4b5a98){if(_0x4b5a98){return _0x4b5a98[_0xe024('0x83')](_0x3c15f8[_0xe024('0x52')][_0xe024('0x84')],_[_0xe024('0x60')](_0x3c15f8['body'],[_0xe024('0x84'),'id'])||{})[_0xe024('0x85')](function(_0x516e2d){for(var _0x194941=0x0;_0x194941<_0x3c15f8[_0xe024('0x52')][_0xe024('0x84')]['length'];_0x194941+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x3c15f8[_0xe024('0x52')][_0xe024('0x84')][_0x194941]),'CmListId':Number(_0x3c15f8[_0xe024('0x47')]['id'])});}return _0x516e2d;});}})[_0xe024('0x24')](respondWithResult(_0x232ddc,null))[_0xe024('0x45')](handleError(_0x232ddc,null));};exports[_0xe024('0x86')]=function(_0x2863a1,_0x2b163a,_0x5ec398){return db[_0xe024('0x2c')][_0xe024('0x48')]({'where':{'id':_0x2863a1[_0xe024('0x47')]['id']}})[_0xe024('0x24')](handleEntityNotFound(_0x2b163a,null))[_0xe024('0x24')](function(_0x1eeaef){if(_0x1eeaef){return _0x1eeaef[_0xe024('0x86')](_0x2863a1[_0xe024('0x2f')][_0xe024('0x84')])[_0xe024('0x24')](function(){if(_[_0xe024('0x5d')](_0x2863a1[_0xe024('0x2f')][_0xe024('0x84')])){for(var _0x5bc836=0x0;_0x5bc836<_0x2863a1[_0xe024('0x2f')]['ids'][_0xe024('0x36')];_0x5bc836+=0x1){socket[_0xe024('0x87')](_0xe024('0x88'),{'UserId':Number(_0x2863a1[_0xe024('0x2f')][_0xe024('0x84')][_0x5bc836]),'CmListId':Number(_0x2863a1[_0xe024('0x47')]['id'])});}}else{socket['emit'](_0xe024('0x88'),{'UserId':Number(_0x2863a1['query'][_0xe024('0x84')]),'CmListId':Number(_0x2863a1[_0xe024('0x47')]['id'])});}});}})[_0xe024('0x24')](respondWithStatusCode(_0x2b163a,null))['catch'](handleError(_0x2b163a,null));};exports[_0xe024('0x89')]=function(_0xeaa48d,_0xfa888f,_0x511af5){var _0x49ff75={};var _0x3ba6a1={};var _0xb668aa;var _0x7fedc5;return db[_0xe024('0x2c')]['findOne']({'where':{'id':_0xeaa48d['params']['id']}})[_0xe024('0x24')](handleEntityNotFound(_0xfa888f,null))[_0xe024('0x24')](function(_0x529eef){if(_0x529eef){_0xb668aa=_0x529eef;_0x3ba6a1['model']=_[_0xe024('0x30')](db[_0xe024('0x8a')][_0xe024('0x2d')]);_0x3ba6a1[_0xe024('0x2f')]=_['keys'](_0xeaa48d[_0xe024('0x2f')]);_0x3ba6a1[_0xe024('0x31')]=_[_0xe024('0x32')](_0x3ba6a1[_0xe024('0x33')],_0x3ba6a1['query']);_0x49ff75[_0xe024('0x35')]=_['intersection'](_0x3ba6a1[_0xe024('0x33')],qs[_0xe024('0x34')](_0xeaa48d['query'][_0xe024('0x34')]));_0x49ff75[_0xe024('0x35')]=_0x49ff75[_0xe024('0x35')][_0xe024('0x36')]?_0x49ff75[_0xe024('0x35')]:_0x3ba6a1['model'];_0x49ff75[_0xe024('0x57')]=qs[_0xe024('0x39')](_0xeaa48d[_0xe024('0x2f')][_0xe024('0x39')]);_0x49ff75[_0xe024('0x3a')]=qs['filters'](_[_0xe024('0x3b')](_0xeaa48d[_0xe024('0x2f')],_0x3ba6a1['filters']));if(_0xeaa48d['query'][_0xe024('0x3c')]){_0x49ff75[_0xe024('0x3a')]=_[_0xe024('0x3d')](_0x49ff75[_0xe024('0x3a')],{'$or':_[_0xe024('0x3e')](_0x49ff75[_0xe024('0x35')],function(_0x14b4db){var _0x3788f2={};_0x3788f2[_0x14b4db]={'$like':'%'+_0xeaa48d[_0xe024('0x2f')][_0xe024('0x3c')]+'%'};return _0x3788f2;})});}_0x49ff75=_['merge']({},_0x49ff75,_0xeaa48d[_0xe024('0x40')]);return _0xb668aa[_0xe024('0x89')](_0x49ff75);}})[_0xe024('0x24')](function(_0x31b147){if(_0x31b147){_0x7fedc5=_0x31b147['length'];if(!_0xeaa48d[_0xe024('0x2f')]['hasOwnProperty']('nolimit')){_0x49ff75[_0xe024('0x20')]=qs[_0xe024('0x20')](_0xeaa48d[_0xe024('0x2f')]['limit']);_0x49ff75['offset']=qs[_0xe024('0x1d')](_0xeaa48d['query'][_0xe024('0x1d')]);}return _0xb668aa[_0xe024('0x89')](_0x49ff75);}})[_0xe024('0x24')](function(_0x1e9b85){if(_0x1e9b85){return _0x1e9b85?{'count':_0x7fedc5,'rows':_0x1e9b85}:null;}})[_0xe024('0x24')](respondWithResult(_0xfa888f,null))[_0xe024('0x45')](handleError(_0xfa888f,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 7a55892..4814230 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x7217,0x19e));var _0x7721=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x7217[_0x102e37];return _0x35a07c;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x2a5a5a,_0x5a4047){var _0x2d6dc6=function(_0x4975a5){while(--_0x4975a5){_0x2a5a5a['push'](_0x2a5a5a['shift']());}};_0x2d6dc6(++_0x5a4047);}(_0x814b,0x1a2));var _0xb814=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0x814b[_0x55a89e];return _0x3aa2bd;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 73cc23a..2da11d6 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 _0x6f7a=['CmList','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x22e6b8,_0x3b8104){_0x22e6b8=_0x22e6b8-0x0;var _0x5e2913=_0x6f7a[_0x22e6b8];return _0x5e2913;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var moment=require('moment');var BPromise=require(_0xa6f7('0x4'));var rp=require(_0xa6f7('0x5'));var fs=require('fs');var path=require(_0xa6f7('0x6'));var rimraf=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var attributes=require(_0xa6f7('0x9'));module[_0xa6f7('0xa')]=function(_0x20cccd,_0x1fdd5f){return _0x20cccd[_0xa6f7('0xb')](_0xa6f7('0xc'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./cmList.attributes','exports','define','cm_lists','../../config/logger','api','moment','bluebird','path'];(function(_0x5ed44a,_0x34d2f1){var _0x6e12a8=function(_0x208ac9){while(--_0x208ac9){_0x5ed44a['push'](_0x5ed44a['shift']());}};_0x6e12a8(++_0x34d2f1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0xcb91[_0x2fbcf6];return _0x3e7265;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('CmList',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 2a45197..d0fa843 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 _0x60c0=['message','result','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x60c0,0x6a));var _0x060c=function(_0x126af7,_0x25fa06){_0x126af7=_0x126af7-0x0;var _0x25b500=_0x60c0[_0x126af7];return _0x25b500;};'use strict';var _=require('lodash');var util=require(_0x060c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x060c('0x1'));var fs=require('fs');var Redis=require(_0x060c('0x2'));var db=require(_0x060c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x060c('0x4'))(_0x060c('0x5'));var config=require(_0x060c('0x6'));var jayson=require(_0x060c('0x7'));var client=jayson[_0x060c('0x8')]['http']({'port':0x232a});config['redis']=_[_0x060c('0x9')](config[_0x060c('0xa')],{'host':_0x060c('0xb'),'port':0x18eb});var socket=require(_0x060c('0xc'))(new Redis(config['redis']));require(_0x060c('0xd'))['register'](socket);function respondWithRpcPromise(_0x416724,_0x370db1,_0x86ebd6){return new BPromise(function(_0xc415bc,_0x7c3b83){return client[_0x060c('0xe')](_0x416724,_0x86ebd6)[_0x060c('0xf')](function(_0x4e0dd7){logger[_0x060c('0x10')](_0x060c('0x11'),_0x370db1,_0x060c('0x12'));logger[_0x060c('0x13')](_0x060c('0x14'),_0x370db1,'request\x20sent',JSON[_0x060c('0x15')](_0x4e0dd7));if(_0x4e0dd7['error']){if(_0x4e0dd7[_0x060c('0x16')][_0x060c('0x17')]===0x1f4){logger[_0x060c('0x16')]('CmList,\x20%s,\x20%s',_0x370db1,_0x4e0dd7[_0x060c('0x16')]['message']);return _0x7c3b83(_0x4e0dd7[_0x060c('0x16')][_0x060c('0x18')]);}logger[_0x060c('0x16')]('CmList,\x20%s,\x20%s',_0x370db1,_0x4e0dd7[_0x060c('0x16')][_0x060c('0x18')]);return _0xc415bc(_0x4e0dd7[_0x060c('0x16')][_0x060c('0x18')]);}else{logger[_0x060c('0x10')](_0x060c('0x11'),_0x370db1,_0x060c('0x12'));_0xc415bc(_0x4e0dd7[_0x060c('0x19')][_0x060c('0x18')]);}})['catch'](function(_0x15b2a6){logger['error'](_0x060c('0x11'),_0x370db1,_0x15b2a6);_0x7c3b83(_0x15b2a6);});});} \ No newline at end of file +var _0x8104=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','info','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CmList,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2e3cbc,_0x263b68){var _0x125727=function(_0x4ce177){while(--_0x4ce177){_0x2e3cbc['push'](_0x2e3cbc['shift']());}};_0x125727(++_0x263b68);}(_0x8104,0x6f));var _0x4810=function(_0x1f19b1,_0x5e81f5){_0x1f19b1=_0x1f19b1-0x0;var _0x503c07=_0x8104[_0x1f19b1];return _0x503c07;};'use strict';var _=require(_0x4810('0x0'));var util=require(_0x4810('0x1'));var moment=require('moment');var BPromise=require(_0x4810('0x2'));var rs=require(_0x4810('0x3'));var fs=require('fs');var Redis=require(_0x4810('0x4'));var db=require(_0x4810('0x5'))['db'];var utils=require(_0x4810('0x6'));var logger=require(_0x4810('0x7'))(_0x4810('0x8'));var config=require(_0x4810('0x9'));var jayson=require(_0x4810('0xa'));var client=jayson[_0x4810('0xb')][_0x4810('0xc')]({'port':0x232a});config[_0x4810('0xd')]=_[_0x4810('0xe')](config[_0x4810('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4810('0xf'))(new Redis(config[_0x4810('0xd')]));require(_0x4810('0x10'))[_0x4810('0x11')](socket);function respondWithRpcPromise(_0x9e883e,_0x13365f,_0x427cb4){return new BPromise(function(_0x3b398c,_0x1069de){return client[_0x4810('0x12')](_0x9e883e,_0x427cb4)['then'](function(_0x130387){logger[_0x4810('0x13')]('CmList,\x20%s,\x20%s',_0x13365f,'request\x20sent');logger[_0x4810('0x14')](_0x4810('0x15'),_0x13365f,'request\x20sent',JSON[_0x4810('0x16')](_0x130387));if(_0x130387[_0x4810('0x17')]){if(_0x130387['error'][_0x4810('0x18')]===0x1f4){logger[_0x4810('0x17')]('CmList,\x20%s,\x20%s',_0x13365f,_0x130387[_0x4810('0x17')][_0x4810('0x19')]);return _0x1069de(_0x130387[_0x4810('0x17')][_0x4810('0x19')]);}logger[_0x4810('0x17')]('CmList,\x20%s,\x20%s',_0x13365f,_0x130387[_0x4810('0x17')][_0x4810('0x19')]);return _0x3b398c(_0x130387[_0x4810('0x17')][_0x4810('0x19')]);}else{logger[_0x4810('0x13')]('CmList,\x20%s,\x20%s',_0x13365f,_0x4810('0x1a'));_0x3b398c(_0x130387[_0x4810('0x1b')][_0x4810('0x19')]);}})[_0x4810('0x1c')](function(_0x4c01dd){logger[_0x4810('0x17')](_0x4810('0x1d'),_0x13365f,_0x4c01dd);_0x1069de(_0x4c01dd);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 84fa2c1..9bee451 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 _0xf674=['remove','update','emit','removeListener','register','length','./cmList.events','save'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xf674,0x86));var _0x4f67=function(_0x5c082a,_0x19ac27){_0x5c082a=_0x5c082a-0x0;var _0x3b60ac=_0xf674[_0x5c082a];return _0x3b60ac;};'use strict';var CmListEvents=require(_0x4f67('0x0'));var events=[_0x4f67('0x1'),_0x4f67('0x2'),_0x4f67('0x3')];function createListener(_0x4d1a11,_0x525571){return function(_0x459f9c){_0x525571[_0x4f67('0x4')](_0x4d1a11,_0x459f9c);};}function removeListener(_0x21daf8,_0x42d308){return function(){CmListEvents[_0x4f67('0x5')](_0x21daf8,_0x42d308);};}exports[_0x4f67('0x6')]=function(_0x49181d){for(var _0x11deb1=0x0,_0x4278ba=events[_0x4f67('0x7')];_0x11deb1<_0x4278ba;_0x11deb1++){var _0x1e778b=events[_0x11deb1];var _0x5cb80d=createListener('cmList:'+_0x1e778b,_0x49181d);CmListEvents['on'](_0x1e778b,_0x5cb80d);}}; \ No newline at end of file +var _0x52ad=['removeListener','register','length','cmList:','remove','update','emit'];(function(_0x2082d1,_0x466083){var _0x405f3d=function(_0x4761b1){while(--_0x4761b1){_0x2082d1['push'](_0x2082d1['shift']());}};_0x405f3d(++_0x466083);}(_0x52ad,0xeb));var _0xd52a=function(_0x556b98,_0x4a891b){_0x556b98=_0x556b98-0x0;var _0x181034=_0x52ad[_0x556b98];return _0x181034;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xd52a('0x0'),_0xd52a('0x1')];function createListener(_0x487050,_0xcab12a){return function(_0x40245f){_0xcab12a[_0xd52a('0x2')](_0x487050,_0x40245f);};}function removeListener(_0xad5fb9,_0x5afc71){return function(){CmListEvents[_0xd52a('0x3')](_0xad5fb9,_0x5afc71);};}exports[_0xd52a('0x4')]=function(_0x2d64d2){for(var _0x2acdd6=0x0,_0x57689d=events[_0xd52a('0x5')];_0x2acdd6<_0x57689d;_0x2acdd6++){var _0x38ed89=events[_0x2acdd6];var _0x4f3433=createListener(_0xd52a('0x6')+_0x38ed89,_0x2d64d2);CmListEvents['on'](_0x38ed89,_0x4f3433);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 2f738d5..a320953 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 _0x1d91=['addCustomField','addAgents','put','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','create','post','addContacts'];(function(_0x34ccaf,_0x3e83fa){var _0x51678c=function(_0x43eeaa){while(--_0x43eeaa){_0x34ccaf['push'](_0x34ccaf['shift']());}};_0x51678c(++_0x3e83fa);}(_0x1d91,0xac));var _0x11d9=function(_0x24f88a,_0x5a04e8){_0x24f88a=_0x24f88a-0x0;var _0x344d1b=_0x1d91[_0x24f88a];return _0x344d1b;};'use strict';var multer=require(_0x11d9('0x0'));var util=require(_0x11d9('0x1'));var path=require(_0x11d9('0x2'));var timeout=require(_0x11d9('0x3'));var express=require(_0x11d9('0x4'));var router=express['Router']();var fs_extra=require(_0x11d9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x11d9('0x6'));var config=require(_0x11d9('0x7'));var controller=require('./cmList.controller');router['get']('/',auth[_0x11d9('0x8')](),controller[_0x11d9('0x9')]);router[_0x11d9('0xa')](_0x11d9('0xb'),auth[_0x11d9('0x8')](),controller[_0x11d9('0xc')]);router[_0x11d9('0xa')](_0x11d9('0xd'),auth[_0x11d9('0x8')](),controller[_0x11d9('0xe')]);router['get'](_0x11d9('0xf'),auth[_0x11d9('0x8')](),controller[_0x11d9('0x10')]);router[_0x11d9('0xa')](_0x11d9('0x11'),auth[_0x11d9('0x8')](),controller['getContacts']);router[_0x11d9('0xa')](_0x11d9('0x12'),auth[_0x11d9('0x8')](),controller[_0x11d9('0x13')]);router['get'](_0x11d9('0x14'),auth[_0x11d9('0x8')](),controller[_0x11d9('0x15')]);router['get'](_0x11d9('0x16'),auth[_0x11d9('0x8')](),controller['getAgents']);router['post']('/',auth[_0x11d9('0x8')](),controller[_0x11d9('0x17')]);router[_0x11d9('0x18')](_0x11d9('0xf'),auth[_0x11d9('0x8')](),controller['addDisposition']);router[_0x11d9('0x18')](_0x11d9('0x11'),auth['isAuthenticated'](),controller[_0x11d9('0x19')]);router['post'](_0x11d9('0x14'),auth['isAuthenticated'](),controller[_0x11d9('0x1a')]);router[_0x11d9('0x18')](_0x11d9('0x16'),auth['isAuthenticated'](),controller[_0x11d9('0x1b')]);router[_0x11d9('0x1c')](_0x11d9('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x11d9('0x1d')]('/:id',auth[_0x11d9('0x8')](),controller['destroy']);router[_0x11d9('0x1d')](_0x11d9('0xf'),auth[_0x11d9('0x8')](),controller[_0x11d9('0x1e')]);router[_0x11d9('0x1d')](_0x11d9('0x16'),auth['isAuthenticated'](),controller[_0x11d9('0x1f')]);module[_0x11d9('0x20')]=router; \ No newline at end of file +var _0x08dd=['describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','addContacts','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x4d44b7,_0x4a9439){var _0x41f95f=function(_0x20d0ba){while(--_0x20d0ba){_0x4d44b7['push'](_0x4d44b7['shift']());}};_0x41f95f(++_0x4a9439);}(_0x08dd,0x75));var _0xd08d=function(_0x3d1206,_0x790a48){_0x3d1206=_0x3d1206-0x0;var _0x476f11=_0x08dd[_0x3d1206];return _0x476f11;};'use strict';var multer=require('multer');var util=require(_0xd08d('0x0'));var path=require(_0xd08d('0x1'));var timeout=require('connect-timeout');var express=require(_0xd08d('0x2'));var router=express[_0xd08d('0x3')]();var fs_extra=require(_0xd08d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd08d('0x5'));var config=require(_0xd08d('0x6'));var controller=require('./cmList.controller');router[_0xd08d('0x7')]('/',auth[_0xd08d('0x8')](),controller[_0xd08d('0x9')]);router[_0xd08d('0x7')](_0xd08d('0xa'),auth[_0xd08d('0x8')](),controller[_0xd08d('0xb')]);router[_0xd08d('0x7')](_0xd08d('0xc'),auth[_0xd08d('0x8')](),controller['show']);router[_0xd08d('0x7')](_0xd08d('0xd'),auth[_0xd08d('0x8')](),controller[_0xd08d('0xe')]);router['get'](_0xd08d('0xf'),auth['isAuthenticated'](),controller[_0xd08d('0x10')]);router['get'](_0xd08d('0x11'),auth[_0xd08d('0x8')](),controller[_0xd08d('0x12')]);router[_0xd08d('0x7')]('/:id/fields',auth[_0xd08d('0x8')](),controller[_0xd08d('0x13')]);router[_0xd08d('0x7')](_0xd08d('0x14'),auth[_0xd08d('0x8')](),controller[_0xd08d('0x15')]);router[_0xd08d('0x16')]('/',auth[_0xd08d('0x8')](),controller['create']);router[_0xd08d('0x16')](_0xd08d('0xd'),auth[_0xd08d('0x8')](),controller['addDisposition']);router[_0xd08d('0x16')](_0xd08d('0xf'),auth[_0xd08d('0x8')](),controller[_0xd08d('0x17')]);router[_0xd08d('0x16')]('/:id/fields',auth[_0xd08d('0x8')](),controller['addCustomField']);router['post'](_0xd08d('0x14'),auth[_0xd08d('0x8')](),controller[_0xd08d('0x18')]);router[_0xd08d('0x19')](_0xd08d('0xc'),auth[_0xd08d('0x8')](),controller[_0xd08d('0x1a')]);router[_0xd08d('0x1b')](_0xd08d('0xc'),auth[_0xd08d('0x8')](),controller[_0xd08d('0x1c')]);router[_0xd08d('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xd08d('0x1d')]);router['delete'](_0xd08d('0x14'),auth[_0xd08d('0x8')](),controller[_0xd08d('0x1e')]);module[_0xd08d('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index c1f798d..95f13eb 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 _0x8762=['VIRTUAL','getDataValue','field','STRING','sequelize','exports'];(function(_0x114ac9,_0x407081){var _0x550200=function(_0x31474f){while(--_0x31474f){_0x114ac9['push'](_0x114ac9['shift']());}};_0x550200(++_0x407081);}(_0x8762,0x19c));var _0x2876=function(_0xc35f83,_0x2b9e74){_0xc35f83=_0xc35f83-0x0;var _0x1e7b65=_0x8762[_0xc35f83];return _0x1e7b65;};'use strict';var Sequelize=require(_0x2876('0x0'));module[_0x2876('0x1')]={'name':{'type':Sequelize[_0x2876('0x2')],'get':function(_0x5c55b9){return this[_0x2876('0x3')](_0x2876('0x4'));}},'field':{'type':Sequelize[_0x2876('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x2876('0x5')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe6f1=['VIRTUAL','getDataValue','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe6f1,0x1cf));var _0x1e6f=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0xe6f1[_0x5bd4f6];return _0x33a165;};'use strict';var Sequelize=require(_0x1e6f('0x0'));module['exports']={'name':{'type':Sequelize[_0x1e6f('0x1')],'get':function(_0xcb3429){return this[_0x1e6f('0x2')]('field');}},'field':{'type':Sequelize[_0x1e6f('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x1e6f('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x1e6f('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index b19525a..a4fb672 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(_0x4f403d,_0x1658ca){var _0x426e45=function(_0x4021f5){while(--_0x4021f5){_0x4f403d['push'](_0x4f403d['shift']());}};_0x426e45(++_0x1658ca);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x568949,_0x12deae){var _0x55f754=function(_0x13cd81){while(--_0x13cd81){_0x568949['push'](_0x568949['shift']());}};_0x55f754(++_0x12deae);}(_0x7a54,0x106));var _0x47a5=function(_0xbbb45a,_0x237524){_0xbbb45a=_0xbbb45a-0x0;var _0x2e9b82=_0x7a54[_0xbbb45a];return _0x2e9b82;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 12758d6..8046a74 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 _0xdc0c=['define','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc0c,0xe0));var _0xcdc0=function(_0x24edc3,_0x349c68){_0x24edc3=_0x24edc3-0x0;var _0x1a37c2=_0xdc0c[_0x24edc3];return _0x1a37c2;};'use strict';var _=require('lodash');var util=require(_0xcdc0('0x0'));var logger=require(_0xcdc0('0x1'))(_0xcdc0('0x2'));var moment=require(_0xcdc0('0x3'));var BPromise=require(_0xcdc0('0x4'));var rp=require(_0xcdc0('0x5'));var fs=require('fs');var path=require(_0xcdc0('0x6'));var rimraf=require(_0xcdc0('0x7'));var config=require(_0xcdc0('0x8'));var attributes=require(_0xcdc0('0x9'));module['exports']=function(_0x267afb,_0x55068e){return _0x267afb[_0xcdc0('0xa')](_0xcdc0('0xb'),attributes,{'tableName':_0xcdc0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fd0=['../../config/environment','./condition.attributes','define','Condition','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5b2539,_0x378372){var _0x5f3e4a=function(_0x48676d){while(--_0x48676d){_0x5b2539['push'](_0x5b2539['shift']());}};_0x5f3e4a(++_0x378372);}(_0x1fd0,0x1a8));var _0x01fd=function(_0x25afa7,_0x2fca3f){_0x25afa7=_0x25afa7-0x0;var _0x2d6275=_0x1fd0[_0x25afa7];return _0x2d6275;};'use strict';var _=require(_0x01fd('0x0'));var util=require(_0x01fd('0x1'));var logger=require(_0x01fd('0x2'))(_0x01fd('0x3'));var moment=require(_0x01fd('0x4'));var BPromise=require(_0x01fd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x01fd('0x6'));var attributes=require(_0x01fd('0x7'));module['exports']=function(_0x527f50,_0x499cbd){return _0x527f50[_0x01fd('0x8')](_0x01fd('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 49b91a7..e5b1a03 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 _0xc148=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','moment','bluebird'];(function(_0x48a35a,_0x525fa2){var _0xde851=function(_0x120d6e){while(--_0x120d6e){_0x48a35a['push'](_0x48a35a['shift']());}};_0xde851(++_0x525fa2);}(_0xc148,0x9f));var _0x8c14=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc148[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x8c14('0x0'));var util=require('util');var moment=require(_0x8c14('0x1'));var BPromise=require(_0x8c14('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c14('0x4'));var logger=require(_0x8c14('0x5'))(_0x8c14('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c14('0x7'));var client=jayson['client'][_0x8c14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f3110,_0x26da8e,_0x4dea3f){return new BPromise(function(_0x47ed32,_0x3f17ef){return client[_0x8c14('0x9')](_0x1f3110,_0x4dea3f)[_0x8c14('0xa')](function(_0x252373){logger[_0x8c14('0xb')](_0x8c14('0xc'),_0x26da8e,_0x8c14('0xd'));logger[_0x8c14('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x26da8e,_0x8c14('0xd'),JSON['stringify'](_0x252373));if(_0x252373[_0x8c14('0xf')]){if(_0x252373[_0x8c14('0xf')][_0x8c14('0x10')]===0x1f4){logger[_0x8c14('0xf')](_0x8c14('0xc'),_0x26da8e,_0x252373[_0x8c14('0xf')][_0x8c14('0x11')]);return _0x3f17ef(_0x252373[_0x8c14('0xf')]['message']);}logger['error'](_0x8c14('0xc'),_0x26da8e,_0x252373['error']['message']);return _0x47ed32(_0x252373[_0x8c14('0xf')][_0x8c14('0x11')]);}else{logger[_0x8c14('0xb')]('Condition,\x20%s,\x20%s',_0x26da8e,_0x8c14('0xd'));_0x47ed32(_0x252373['result'][_0x8c14('0x11')]);}})['catch'](function(_0x19a920){logger[_0x8c14('0xf')](_0x8c14('0xc'),_0x26da8e,_0x19a920);_0x3f17ef(_0x19a920);});});} \ No newline at end of file +var _0xcbaf=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util'];(function(_0x3e3b59,_0x3ca5a5){var _0x55aa86=function(_0x1f4adb){while(--_0x1f4adb){_0x3e3b59['push'](_0x3e3b59['shift']());}};_0x55aa86(++_0x3ca5a5);}(_0xcbaf,0x12a));var _0xfcba=function(_0x56d552,_0x12320c){_0x56d552=_0x56d552-0x0;var _0x7be710=_0xcbaf[_0x56d552];return _0x7be710;};'use strict';var _=require(_0xfcba('0x0'));var util=require(_0xfcba('0x1'));var moment=require('moment');var BPromise=require(_0xfcba('0x2'));var rs=require(_0xfcba('0x3'));var fs=require('fs');var Redis=require(_0xfcba('0x4'));var db=require(_0xfcba('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfcba('0x6'));var config=require('../../config/environment');var jayson=require(_0xfcba('0x7'));var client=jayson['client'][_0xfcba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a8143,_0x161509,_0x478966){return new BPromise(function(_0x15e9e5,_0x8ab8d1){return client[_0xfcba('0x9')](_0x1a8143,_0x478966)[_0xfcba('0xa')](function(_0x437feb){logger[_0xfcba('0xb')](_0xfcba('0xc'),_0x161509,_0xfcba('0xd'));logger[_0xfcba('0xe')](_0xfcba('0xf'),_0x161509,_0xfcba('0xd'),JSON[_0xfcba('0x10')](_0x437feb));if(_0x437feb[_0xfcba('0x11')]){if(_0x437feb[_0xfcba('0x11')]['code']===0x1f4){logger[_0xfcba('0x11')](_0xfcba('0xc'),_0x161509,_0x437feb[_0xfcba('0x11')][_0xfcba('0x12')]);return _0x8ab8d1(_0x437feb[_0xfcba('0x11')][_0xfcba('0x12')]);}logger[_0xfcba('0x11')](_0xfcba('0xc'),_0x161509,_0x437feb[_0xfcba('0x11')]['message']);return _0x15e9e5(_0x437feb['error'][_0xfcba('0x12')]);}else{logger[_0xfcba('0xb')](_0xfcba('0xc'),_0x161509,_0xfcba('0xd'));_0x15e9e5(_0x437feb[_0xfcba('0x13')]['message']);}})['catch'](function(_0x33a5e2){logger[_0xfcba('0x11')](_0xfcba('0xc'),_0x161509,_0x33a5e2);_0x8ab8d1(_0x33a5e2);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 1db42de..ca80f5f 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 _0xf2dd=['isAuthenticated','delete','destroy','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x80995c,_0x398cd8){var _0x5ab7c5=function(_0x233120){while(--_0x233120){_0x80995c['push'](_0x80995c['shift']());}};_0x5ab7c5(++_0x398cd8);}(_0xf2dd,0xcf));var _0xdf2d=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0xf2dd[_0x5f25b3];return _0x4ab9bf;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdf2d('0x0'));var express=require(_0xdf2d('0x1'));var router=express['Router']();var fs_extra=require(_0xdf2d('0x2'));var auth=require(_0xdf2d('0x3'));var interaction=require(_0xdf2d('0x4'));var config=require(_0xdf2d('0x5'));var controller=require(_0xdf2d('0x6'));router[_0xdf2d('0x7')](_0xdf2d('0x8'),auth[_0xdf2d('0x9')](),controller['update']);router[_0xdf2d('0xa')](_0xdf2d('0x8'),auth['isAuthenticated'](),controller[_0xdf2d('0xb')]);module['exports']=router; \ No newline at end of file +var _0x306d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','util','path'];(function(_0x474cfa,_0x17268e){var _0x465523=function(_0x52fed4){while(--_0x52fed4){_0x474cfa['push'](_0x474cfa['shift']());}};_0x465523(++_0x17268e);}(_0x306d,0x11f));var _0xd306=function(_0xdc16ae,_0x1f3dca){_0xdc16ae=_0xdc16ae-0x0;var _0x99b852=_0x306d[_0xdc16ae];return _0x99b852;};'use strict';var multer=require('multer');var util=require(_0xd306('0x0'));var path=require(_0xd306('0x1'));var timeout=require(_0xd306('0x2'));var express=require(_0xd306('0x3'));var router=express[_0xd306('0x4')]();var fs_extra=require(_0xd306('0x5'));var auth=require(_0xd306('0x6'));var interaction=require(_0xd306('0x7'));var config=require(_0xd306('0x8'));var controller=require(_0xd306('0x9'));router[_0xd306('0xa')](_0xd306('0xb'),auth[_0xd306('0xc')](),controller[_0xd306('0xd')]);router[_0xd306('0xe')](_0xd306('0xb'),auth[_0xd306('0xc')](),controller[_0xd306('0xf')]);module[_0xd306('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 7719ad8..d2437f7 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 _0xbaf0=['name','exports','STRING'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x113755,_0x217fc8){var _0x20e6ef=function(_0x19091d){while(--_0x19091d){_0x113755['push'](_0x113755['shift']());}};_0x20e6ef(++_0x217fc8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index e2cbf45..c9758e1 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 _0x815f=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','fields','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','findOne','order','getItems','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./dashboard.socket','register','status','end','json','offset'];(function(_0x3fbad3,_0x3ae2fd){var _0x5d77fd=function(_0x59f7cf){while(--_0x59f7cf){_0x3fbad3['push'](_0x3fbad3['shift']());}};_0x5d77fd(++_0x3ae2fd);}(_0x815f,0x150));var _0xf815=function(_0x54e20f,_0x208261){_0x54e20f=_0x54e20f-0x0;var _0x2cdd74=_0x815f[_0x54e20f];return _0x2cdd74;};'use strict';var emlformat=require(_0xf815('0x0'));var rimraf=require(_0xf815('0x1'));var zipdir=require(_0xf815('0x2'));var jsonpatch=require(_0xf815('0x3'));var rp=require('request-promise');var moment=require(_0xf815('0x4'));var BPromise=require(_0xf815('0x5'));var Mustache=require('mustache');var util=require(_0xf815('0x6'));var path=require(_0xf815('0x7'));var sox=require(_0xf815('0x8'));var csv=require(_0xf815('0x9'));var ejs=require(_0xf815('0xa'));var fs=require('fs');var fs_extra=require(_0xf815('0xb'));var _=require(_0xf815('0xc'));var squel=require('squel');var crypto=require(_0xf815('0xd'));var jsforce=require(_0xf815('0xe'));var deskjs=require(_0xf815('0xf'));var toCsv=require(_0xf815('0x9'));var querystring=require(_0xf815('0x10'));var Papa=require(_0xf815('0x11'));var Redis=require(_0xf815('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf815('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf815('0x14'));var logger=require('../../config/logger')(_0xf815('0x15'));var utils=require(_0xf815('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf815('0x17'));var db=require(_0xf815('0x18'))['db'];config[_0xf815('0x19')]=_[_0xf815('0x1a')](config[_0xf815('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf815('0x1b'))[_0xf815('0x1c')](socket);function respondWithStatusCode(_0xacbf83,_0x281915){_0x281915=_0x281915||0xcc;return function(_0x5c0188){if(_0x5c0188){return _0xacbf83['sendStatus'](_0x281915);}return _0xacbf83[_0xf815('0x1d')](_0x281915)[_0xf815('0x1e')]();};}function respondWithResult(_0xa4d05a,_0x5ea072){_0x5ea072=_0x5ea072||0xc8;return function(_0xc4be7){if(_0xc4be7){return _0xa4d05a[_0xf815('0x1d')](_0x5ea072)[_0xf815('0x1f')](_0xc4be7);}};}function respondWithFilteredResult(_0x14851e,_0x12dd29){return function(_0x599b1e){if(_0x599b1e){var _0x3453ee=typeof _0x12dd29[_0xf815('0x20')]===_0xf815('0x21')&&typeof _0x12dd29[_0xf815('0x22')]==='undefined';var _0x577d8d=_0x599b1e[_0xf815('0x23')];var _0x1eaef3=_0x3453ee?0x0:_0x12dd29[_0xf815('0x20')];var _0xea583b=_0x3453ee?_0x599b1e[_0xf815('0x23')]:_0x12dd29[_0xf815('0x20')]+_0x12dd29[_0xf815('0x22')];var _0x1f9b1a;if(_0xea583b>=_0x577d8d){_0xea583b=_0x577d8d;_0x1f9b1a=0xc8;}else{_0x1f9b1a=0xce;}_0x14851e[_0xf815('0x1d')](_0x1f9b1a);return _0x14851e['set'](_0xf815('0x24'),_0x1eaef3+'-'+_0xea583b+'/'+_0x577d8d)[_0xf815('0x1f')](_0x599b1e);}return null;};}function patchUpdates(_0x79ad0d){return function(_0x1b1add){try{jsonpatch[_0xf815('0x25')](_0x1b1add,_0x79ad0d,!![]);}catch(_0x5e665c){return BPromise[_0xf815('0x26')](_0x5e665c);}return _0x1b1add[_0xf815('0x27')]();};}function saveUpdates(_0x3f27ad,_0x5eb62f){return function(_0x4f4f3a){if(_0x4f4f3a){return _0x4f4f3a[_0xf815('0x28')](_0x3f27ad)[_0xf815('0x29')](function(_0x18eb4a){return _0x18eb4a;});}return null;};}function removeEntity(_0x1194d1,_0x2223b3){return function(_0x5a8e4d){if(_0x5a8e4d){return _0x5a8e4d[_0xf815('0x2a')]()[_0xf815('0x29')](function(){var _0x439b52=_0x5a8e4d[_0xf815('0x2b')]({'plain':!![]});var _0x460113=_0xf815('0x2c');return db[_0xf815('0x2d')][_0xf815('0x2a')]({'where':{'type':_0x460113,'resourceId':_0x439b52['id']}})[_0xf815('0x29')](function(){return _0x5a8e4d;});})['then'](function(){_0x1194d1['status'](0xcc)[_0xf815('0x1e')]();});}};}function handleEntityNotFound(_0x28a02f,_0x5c49cc){return function(_0x32d34a){if(!_0x32d34a){_0x28a02f['sendStatus'](0x194);}return _0x32d34a;};}function handleError(_0x8ae33b,_0x2fabfe){_0x2fabfe=_0x2fabfe||0x1f4;return function(_0x1ce177){logger[_0xf815('0x2e')](_0x1ce177[_0xf815('0x2f')]);if(_0x1ce177['name']){delete _0x1ce177['name'];}_0x8ae33b[_0xf815('0x1d')](_0x2fabfe)[_0xf815('0x30')](_0x1ce177);};}exports[_0xf815('0x31')]=function(_0x1b51c9,_0x278640){var _0x5976b5={},_0x9ccc41={},_0xdaf11b={'count':0x0,'rows':[]};var _0x11fa81=_[_0xf815('0x32')](db[_0xf815('0x33')][_0xf815('0x34')],function(_0x3eed39){return{'name':_0x3eed39[_0xf815('0x35')],'type':_0x3eed39[_0xf815('0x36')][_0xf815('0x37')]};});_0x9ccc41[_0xf815('0x38')]=_[_0xf815('0x32')](_0x11fa81,_0xf815('0x39'));_0x9ccc41[_0xf815('0x3a')]=_['keys'](_0x1b51c9[_0xf815('0x3a')]);_0x9ccc41[_0xf815('0x3b')]=_[_0xf815('0x3c')](_0x9ccc41[_0xf815('0x38')],_0x9ccc41[_0xf815('0x3a')]);_0x5976b5[_0xf815('0x3d')]=_[_0xf815('0x3c')](_0x9ccc41[_0xf815('0x38')],qs['fields'](_0x1b51c9[_0xf815('0x3a')]['fields']));_0x5976b5['attributes']=_0x5976b5[_0xf815('0x3d')]['length']?_0x5976b5[_0xf815('0x3d')]:_0x9ccc41[_0xf815('0x38')];if(!_0x1b51c9[_0xf815('0x3a')][_0xf815('0x3e')](_0xf815('0x3f'))){_0x5976b5['limit']=qs[_0xf815('0x22')](_0x1b51c9[_0xf815('0x3a')][_0xf815('0x22')]);_0x5976b5['offset']=qs[_0xf815('0x20')](_0x1b51c9[_0xf815('0x3a')][_0xf815('0x20')]);}_0x5976b5['order']=qs[_0xf815('0x40')](_0x1b51c9[_0xf815('0x3a')][_0xf815('0x40')]);_0x5976b5[_0xf815('0x41')]=qs['filters'](_[_0xf815('0x42')](_0x1b51c9['query'],_0x9ccc41[_0xf815('0x3b')]),_0x11fa81);if(_0x1b51c9[_0xf815('0x3a')][_0xf815('0x43')]){_0x5976b5[_0xf815('0x41')]=_[_0xf815('0x44')](_0x5976b5[_0xf815('0x41')],{'$or':_['map'](_0x11fa81,function(_0x3dbcf3){if(_0x3dbcf3[_0xf815('0x36')]!==_0xf815('0x45')){var _0x1be313={};_0x1be313[_0x3dbcf3[_0xf815('0x39')]]={'$like':'%'+_0x1b51c9[_0xf815('0x3a')]['filter']+'%'};return _0x1be313;}})});}_0x5976b5=_[_0xf815('0x44')]({},_0x5976b5,_0x1b51c9[_0xf815('0x46')]);var _0x129783={'where':_0x5976b5[_0xf815('0x41')]};return db['Dashboard'][_0xf815('0x23')](_0x129783)['then'](function(_0x29a97a){_0xdaf11b[_0xf815('0x23')]=_0x29a97a;if(_0x1b51c9['query'][_0xf815('0x47')]){_0x5976b5[_0xf815('0x48')]=[{'all':!![]}];}return db[_0xf815('0x33')][_0xf815('0x49')](_0x5976b5);})[_0xf815('0x29')](function(_0x4e0633){_0xdaf11b['rows']=_0x4e0633;return _0xdaf11b;})[_0xf815('0x29')](respondWithFilteredResult(_0x278640,_0x5976b5))[_0xf815('0x4a')](handleError(_0x278640,null));};exports[_0xf815('0x4b')]=function(_0xc1305d,_0x2c7d73){var _0x4240d0={'raw':![],'where':{'id':_0xc1305d['params']['id']}},_0x36e6e6={};_0x36e6e6['model']=_[_0xf815('0x4c')](db[_0xf815('0x33')]['rawAttributes']);_0x36e6e6[_0xf815('0x3a')]=_[_0xf815('0x4c')](_0xc1305d[_0xf815('0x3a')]);_0x36e6e6[_0xf815('0x3b')]=_['intersection'](_0x36e6e6['model'],_0x36e6e6['query']);_0x4240d0[_0xf815('0x3d')]=_[_0xf815('0x3c')](_0x36e6e6[_0xf815('0x38')],qs[_0xf815('0x4d')](_0xc1305d['query'][_0xf815('0x4d')]));_0x4240d0[_0xf815('0x3d')]=_0x4240d0[_0xf815('0x3d')][_0xf815('0x4e')]?_0x4240d0[_0xf815('0x3d')]:_0x36e6e6[_0xf815('0x38')];if(_0xc1305d[_0xf815('0x3a')][_0xf815('0x47')]){_0x4240d0['include']=[{'all':!![]}];}_0x4240d0=_[_0xf815('0x44')]({},_0x4240d0,_0xc1305d[_0xf815('0x46')]);return db[_0xf815('0x33')]['find'](_0x4240d0)[_0xf815('0x29')](handleEntityNotFound(_0x2c7d73,null))[_0xf815('0x29')](respondWithResult(_0x2c7d73,null))[_0xf815('0x4a')](handleError(_0x2c7d73,null));};exports[_0xf815('0x4f')]=function(_0x56e7d4,_0x3d43b9){return db['Dashboard']['create'](_0x56e7d4[_0xf815('0x50')],{})[_0xf815('0x29')](function(_0x280d93){var _0x1be315=_0x56e7d4[_0xf815('0x51')]['get']({'plain':!![]});if(!_0x1be315)throw new Error(_0xf815('0x52'));if(_0x1be315[_0xf815('0x53')]===_0xf815('0x51')){var _0x5107e5=_0x280d93[_0xf815('0x2b')]({'plain':!![]});var _0x2ab262=_0xf815('0x2c');return db[_0xf815('0x54')][_0xf815('0x55')]({'where':{'name':_0x2ab262,'userProfileId':_0x1be315[_0xf815('0x56')]},'raw':!![]})[_0xf815('0x29')](function(_0x100898){if(_0x100898&&_0x100898[_0xf815('0x57')]===0x0){return db['UserProfileResource'][_0xf815('0x4f')]({'name':_0x5107e5[_0xf815('0x39')],'resourceId':_0x5107e5['id'],'type':_0x100898[_0xf815('0x39')],'sectionId':_0x100898['id']},{})[_0xf815('0x29')](function(){return _0x280d93;});}else{return _0x280d93;}})[_0xf815('0x4a')](function(_0x25d7ee){logger[_0xf815('0x2e')](_0xf815('0x58'),_0x25d7ee);throw _0x25d7ee;});}return _0x280d93;})[_0xf815('0x29')](respondWithResult(_0x3d43b9,0xc9))['catch'](handleError(_0x3d43b9,null));};exports[_0xf815('0x59')]=function(_0x16b464,_0x288d90){var _0x1f026a={'where':{'id':_0x16b464[_0xf815('0x5a')]['id']}},_0x468444={};_0x468444['model']=_['keys'](db[_0xf815('0x33')][_0xf815('0x34')]);_0x1f026a[_0xf815('0x3d')]=_[_0xf815('0x3c')](_0x468444[_0xf815('0x38')],qs['fields'](_0x16b464[_0xf815('0x3a')][_0xf815('0x4d')]));_0x1f026a[_0xf815('0x3d')]=_0x1f026a['attributes'][_0xf815('0x4e')]?_0x1f026a[_0xf815('0x3d')]:_0x468444['model'];if(_0x16b464[_0xf815('0x3a')][_0xf815('0x47')]){_0x1f026a[_0xf815('0x48')]=[{'all':!![]}];}_0x1f026a=_[_0xf815('0x44')]({},_0x1f026a,_0x16b464[_0xf815('0x46')]);return db['Dashboard'][_0xf815('0x55')](_0x1f026a)[_0xf815('0x29')](handleEntityNotFound(_0x288d90,null))['then'](function(_0x397901){if(_0x397901){var _0x557b2a=_0x397901[_0xf815('0x2b')]({'plain':!![]});_0x557b2a=qs[_0xf815('0x5b')](_0x557b2a,['id',_0xf815('0x5c'),_0xf815('0x5d')]);_0x16b464['body']=_[_0xf815('0x5b')](_0x16b464[_0xf815('0x50')],['id',_0xf815('0x5c'),_0xf815('0x5d')]);return db[_0xf815('0x33')][_0xf815('0x4f')](_[_0xf815('0x44')](_0x557b2a,_0x16b464[_0xf815('0x50')]),{'include':_0x16b464['query'][_0xf815('0x47')]?[{'all':!![]}]:undefined})[_0xf815('0x29')](function(_0x38d771){var _0xdf0274=_0x16b464['user'][_0xf815('0x2b')]({'plain':!![]});if(!_0xdf0274)throw new Error(_0xf815('0x52'));if(_0xdf0274['role']==='user'){var _0x4ae69a=_0x38d771['get']({'plain':!![]});var _0x126f15=_0xf815('0x2c');return db[_0xf815('0x54')]['find']({'where':{'name':_0x126f15,'userProfileId':_0xdf0274[_0xf815('0x56')]},'raw':!![]})[_0xf815('0x29')](function(_0x6ac926){if(_0x6ac926&&_0x6ac926[_0xf815('0x57')]===0x0){return db[_0xf815('0x2d')][_0xf815('0x4f')]({'name':_0x4ae69a['name'],'resourceId':_0x4ae69a['id'],'type':_0x6ac926[_0xf815('0x39')],'sectionId':_0x6ac926['id']},{})[_0xf815('0x29')](function(){return _0x38d771;});}else{return _0x38d771;}})[_0xf815('0x4a')](function(_0x4d81c1){logger[_0xf815('0x2e')](_0xf815('0x58'),_0x4d81c1);throw _0x4d81c1;});}return _0x38d771;});}})[_0xf815('0x29')](respondWithResult(_0x288d90,0xc9))[_0xf815('0x4a')](handleError(_0x288d90,null));};exports[_0xf815('0x28')]=function(_0x15af4d,_0x2d6a92){if(_0x15af4d[_0xf815('0x50')]['id']){delete _0x15af4d['body']['id'];}return db[_0xf815('0x33')][_0xf815('0x55')]({'where':{'id':_0x15af4d[_0xf815('0x5a')]['id']}})[_0xf815('0x29')](handleEntityNotFound(_0x2d6a92,null))[_0xf815('0x29')](saveUpdates(_0x15af4d[_0xf815('0x50')],null))[_0xf815('0x29')](respondWithResult(_0x2d6a92,null))[_0xf815('0x4a')](handleError(_0x2d6a92,null));};exports[_0xf815('0x2a')]=function(_0x254bdb,_0x2fe528){return db[_0xf815('0x33')]['find']({'where':{'id':_0x254bdb[_0xf815('0x5a')]['id']}})[_0xf815('0x29')](handleEntityNotFound(_0x2fe528,null))[_0xf815('0x29')](removeEntity(_0x2fe528,null))[_0xf815('0x4a')](handleError(_0x2fe528,null));};function widgetAttributes(_0x2981f6){try{switch(_0x2981f6['type']){case _0xf815('0x5e'):return[{'name':_0xf815('0x5f'),'value':_0x2981f6[_0xf815('0x5f')]||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6[_0xf815('0x60')][0x0]?_0x2981f6['attrs'][0x0][_0xf815('0x61')]:undefined)||_0xf815('0x62')}];case _0xf815('0x63'):return[{'name':_0xf815('0x64'),'value':_0x2981f6[_0xf815('0x64')]||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6[_0xf815('0x60')][0x0]?_0x2981f6[_0xf815('0x60')][0x0][_0xf815('0x61')]:undefined)||''}];case _0xf815('0x65'):return[{'name':_0xf815('0x66'),'value':_0x2981f6[_0xf815('0x66')]||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6['attrs'][0x0]?_0x2981f6[_0xf815('0x60')][0x0][_0xf815('0x61')]:undefined)||_0xf815('0x67')},{'name':_0xf815('0x68'),'value':_0x2981f6[_0xf815('0x68')]||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6[_0xf815('0x60')][0x1]?_0x2981f6[_0xf815('0x60')][0x1][_0xf815('0x61')]:undefined)||'0.00'},{'name':_0xf815('0x69'),'value':_0x2981f6[_0xf815('0x69')]||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6[_0xf815('0x60')][0x2]?_0x2981f6[_0xf815('0x60')][0x2][_0xf815('0x61')]:undefined)||0xc}];case _0xf815('0x6a'):return[{'name':'attrMetric','value':_0x2981f6[_0xf815('0x6b')]||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6[_0xf815('0x60')][0x0]?_0x2981f6[_0xf815('0x60')][0x0][_0xf815('0x61')]:undefined)||'total'},{'name':_0xf815('0x6c'),'value':_0x2981f6[_0xf815('0x6c')]||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6['attrs'][0x1]?_0x2981f6[_0xf815('0x60')][0x1][_0xf815('0x61')]:undefined)||[]},{'name':_0xf815('0x69'),'value':_0x2981f6[_0xf815('0x69')]||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6['attrs'][0x2]?_0x2981f6[_0xf815('0x60')][0x2][_0xf815('0x61')]:undefined)||0x14}];case'multibar-chart':case _0xf815('0x6d'):return[{'name':_0xf815('0x6e'),'value':_0x2981f6['attrSerie1']||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6[_0xf815('0x60')][0x0]?_0x2981f6[_0xf815('0x60')][0x0][_0xf815('0x61')]:undefined)||_0xf815('0x6f')},{'name':_0xf815('0x70'),'value':_0x2981f6['attrSerie2']||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6[_0xf815('0x60')][0x1]?_0x2981f6[_0xf815('0x60')][0x1][_0xf815('0x61')]:undefined)||null},{'name':_0xf815('0x71'),'value':_0x2981f6[_0xf815('0x71')]||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6[_0xf815('0x60')][0x2]?_0x2981f6[_0xf815('0x60')][0x2][_0xf815('0x61')]:undefined)||null},{'name':_0xf815('0x6c'),'value':_0x2981f6[_0xf815('0x6c')]||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6[_0xf815('0x60')][0x3]?_0x2981f6[_0xf815('0x60')][0x3][_0xf815('0x61')]:undefined)||[]}];case _0xf815('0x72'):return[{'name':_0xf815('0x73'),'type':_0x2981f6[_0xf815('0x74')]||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6['attrs'][0x0]?_0x2981f6['attrs'][0x0][_0xf815('0x36')]:undefined)||null,'value':_0x2981f6['attrReport']||(_0x2981f6[_0xf815('0x60')]&&_0x2981f6[_0xf815('0x60')][0x0]?_0x2981f6[_0xf815('0x60')][0x0][_0xf815('0x61')]:undefined)||null},{'name':_0xf815('0x75'),'value':_0x2981f6[_0xf815('0x75')]||(_0x2981f6['attrs']&&_0x2981f6['attrs'][0x1]?_0x2981f6[_0xf815('0x60')][0x1][_0xf815('0x61')]:undefined)||0x0}];default:return[];}}catch(_0xcb1152){logger[_0xf815('0x2e')](_0xf815('0x76'),JSON['stringify'](_0xcb1152));return[];}}exports[_0xf815('0x77')]=function(_0x47c2c2,_0x559fc2,_0x268bcb){if(_0x47c2c2['body']['id']){delete _0x47c2c2[_0xf815('0x50')]['id'];}return db[_0xf815('0x33')][_0xf815('0x55')]({'where':{'id':_0x47c2c2[_0xf815('0x5a')]['id']}})[_0xf815('0x29')](handleEntityNotFound(_0x559fc2,null))[_0xf815('0x29')](function(_0x253ec2){if(_0x253ec2){_0x47c2c2['body']['DashboardId']=_0x253ec2['id'];_0x47c2c2[_0xf815('0x50')][_0xf815('0x60')]=widgetAttributes(_0x47c2c2[_0xf815('0x50')]);return db['DashboardItem'][_0xf815('0x4f')](_0x47c2c2['body']);}})[_0xf815('0x29')](respondWithResult(_0x559fc2,null))[_0xf815('0x4a')](handleError(_0x559fc2,null));};exports['getItems']=function(_0x57f015,_0xcbdb9b,_0x93d4bd){var _0x4856bd={};var _0x49dc06={};var _0x1b1d55;var _0x2b9373;return db[_0xf815('0x33')][_0xf815('0x78')]({'where':{'id':_0x57f015[_0xf815('0x5a')]['id']}})['then'](handleEntityNotFound(_0xcbdb9b,null))[_0xf815('0x29')](function(_0x3bdf82){if(_0x3bdf82){_0x1b1d55=_0x3bdf82;_0x49dc06['model']=_['keys'](db['DashboardItem'][_0xf815('0x34')]);_0x49dc06[_0xf815('0x3a')]=_['keys'](_0x57f015[_0xf815('0x3a')]);_0x49dc06['filters']=_[_0xf815('0x3c')](_0x49dc06[_0xf815('0x38')],_0x49dc06[_0xf815('0x3a')]);_0x4856bd[_0xf815('0x3d')]=_[_0xf815('0x3c')](_0x49dc06[_0xf815('0x38')],qs['fields'](_0x57f015[_0xf815('0x3a')][_0xf815('0x4d')]));_0x4856bd[_0xf815('0x3d')]=_0x4856bd['attributes'][_0xf815('0x4e')]?_0x4856bd[_0xf815('0x3d')]:_0x49dc06[_0xf815('0x38')];_0x4856bd[_0xf815('0x79')]=qs[_0xf815('0x40')](_0x57f015[_0xf815('0x3a')][_0xf815('0x40')]);_0x4856bd['where']=qs['filters'](_['pick'](_0x57f015['query'],_0x49dc06[_0xf815('0x3b')]));if(_0x57f015[_0xf815('0x3a')][_0xf815('0x43')]){_0x4856bd[_0xf815('0x41')]=_[_0xf815('0x44')](_0x4856bd[_0xf815('0x41')],{'$or':_[_0xf815('0x32')](_0x4856bd[_0xf815('0x3d')],function(_0x57ffd3){var _0x3ddb3f={};_0x3ddb3f[_0x57ffd3]={'$like':'%'+_0x57f015[_0xf815('0x3a')][_0xf815('0x43')]+'%'};return _0x3ddb3f;})});}_0x4856bd=_['merge']({},_0x4856bd,_0x57f015[_0xf815('0x46')]);return _0x1b1d55[_0xf815('0x7a')](_0x4856bd);}})[_0xf815('0x29')](function(_0xc5d8f){if(_0xc5d8f){_0x2b9373=_0xc5d8f[_0xf815('0x4e')];if(!_0x57f015['query']['hasOwnProperty']('nolimit')){_0x4856bd['limit']=qs[_0xf815('0x22')](_0x57f015[_0xf815('0x3a')][_0xf815('0x22')]);_0x4856bd[_0xf815('0x20')]=qs[_0xf815('0x20')](_0x57f015[_0xf815('0x3a')][_0xf815('0x20')]);}return _0x1b1d55['getItems'](_0x4856bd);}})[_0xf815('0x29')](function(_0x334c7b){if(_0x334c7b){return _0x334c7b?{'count':_0x2b9373,'rows':_0x334c7b}:null;}})['then'](respondWithResult(_0xcbdb9b,null))[_0xf815('0x4a')](handleError(_0xcbdb9b,null));}; \ No newline at end of file +var _0xba82=['DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','CustomDashboards','UserProfileResource','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','attributes','Dashboard','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','user','error','update','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId'];(function(_0x239180,_0x5a7f9c){var _0x17c1bd=function(_0x492a40){while(--_0x492a40){_0x239180['push'](_0x239180['shift']());}};_0x17c1bd(++_0x5a7f9c);}(_0xba82,0x101));var _0x2ba8=function(_0x251d67,_0xc36e2b){_0x251d67=_0x251d67-0x0;var _0x423d29=_0xba82[_0x251d67];return _0x423d29;};'use strict';var emlformat=require(_0x2ba8('0x0'));var rimraf=require(_0x2ba8('0x1'));var zipdir=require(_0x2ba8('0x2'));var jsonpatch=require(_0x2ba8('0x3'));var rp=require(_0x2ba8('0x4'));var moment=require(_0x2ba8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2ba8('0x6'));var util=require(_0x2ba8('0x7'));var path=require(_0x2ba8('0x8'));var sox=require(_0x2ba8('0x9'));var csv=require(_0x2ba8('0xa'));var ejs=require(_0x2ba8('0xb'));var fs=require('fs');var fs_extra=require(_0x2ba8('0xc'));var _=require(_0x2ba8('0xd'));var squel=require(_0x2ba8('0xe'));var crypto=require(_0x2ba8('0xf'));var jsforce=require(_0x2ba8('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2ba8('0xa'));var querystring=require(_0x2ba8('0x11'));var Papa=require(_0x2ba8('0x12'));var Redis=require(_0x2ba8('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2ba8('0x14'));var hardwareService=require(_0x2ba8('0x15'));var logger=require(_0x2ba8('0x16'))('api');var utils=require(_0x2ba8('0x17'));var config=require(_0x2ba8('0x18'));var licenseUtil=require(_0x2ba8('0x19'));var db=require(_0x2ba8('0x1a'))['db'];config['redis']=_[_0x2ba8('0x1b')](config[_0x2ba8('0x1c')],{'host':_0x2ba8('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ba8('0x1c')]));require(_0x2ba8('0x1e'))[_0x2ba8('0x1f')](socket);function respondWithStatusCode(_0x3a5834,_0x2975e2){_0x2975e2=_0x2975e2||0xcc;return function(_0x59c75d){if(_0x59c75d){return _0x3a5834[_0x2ba8('0x20')](_0x2975e2);}return _0x3a5834[_0x2ba8('0x21')](_0x2975e2)[_0x2ba8('0x22')]();};}function respondWithResult(_0x30a1a9,_0x5f2904){_0x5f2904=_0x5f2904||0xc8;return function(_0x257d9c){if(_0x257d9c){return _0x30a1a9[_0x2ba8('0x21')](_0x5f2904)[_0x2ba8('0x23')](_0x257d9c);}};}function respondWithFilteredResult(_0x509ff9,_0x41b511){return function(_0x35f16b){if(_0x35f16b){var _0xf03c04=typeof _0x41b511[_0x2ba8('0x24')]===_0x2ba8('0x25')&&typeof _0x41b511[_0x2ba8('0x26')]===_0x2ba8('0x25');var _0x3e6b3c=_0x35f16b[_0x2ba8('0x27')];var _0x43136f=_0xf03c04?0x0:_0x41b511[_0x2ba8('0x24')];var _0x502ce4=_0xf03c04?_0x35f16b[_0x2ba8('0x27')]:_0x41b511[_0x2ba8('0x24')]+_0x41b511[_0x2ba8('0x26')];var _0x11e7c4;if(_0x502ce4>=_0x3e6b3c){_0x502ce4=_0x3e6b3c;_0x11e7c4=0xc8;}else{_0x11e7c4=0xce;}_0x509ff9['status'](_0x11e7c4);return _0x509ff9[_0x2ba8('0x28')](_0x2ba8('0x29'),_0x43136f+'-'+_0x502ce4+'/'+_0x3e6b3c)['json'](_0x35f16b);}return null;};}function patchUpdates(_0x3921c7){return function(_0x4dad15){try{jsonpatch[_0x2ba8('0x2a')](_0x4dad15,_0x3921c7,!![]);}catch(_0x5230a3){return BPromise[_0x2ba8('0x2b')](_0x5230a3);}return _0x4dad15[_0x2ba8('0x2c')]();};}function saveUpdates(_0x5a0ef4,_0x19da07){return function(_0x383414){if(_0x383414){return _0x383414['update'](_0x5a0ef4)[_0x2ba8('0x2d')](function(_0x3675f1){return _0x3675f1;});}return null;};}function removeEntity(_0x46d903,_0x416704){return function(_0x2a76ad){if(_0x2a76ad){return _0x2a76ad['destroy']()[_0x2ba8('0x2d')](function(){var _0x274d18=_0x2a76ad[_0x2ba8('0x2e')]({'plain':!![]});var _0x4b6778=_0x2ba8('0x2f');return db[_0x2ba8('0x30')][_0x2ba8('0x31')]({'where':{'type':_0x4b6778,'resourceId':_0x274d18['id']}})[_0x2ba8('0x2d')](function(){return _0x2a76ad;});})['then'](function(){_0x46d903[_0x2ba8('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c3170,_0x4aa636){return function(_0x3f009e){if(!_0x3f009e){_0x3c3170[_0x2ba8('0x20')](0x194);}return _0x3f009e;};}function handleError(_0x5159f2,_0x188d37){_0x188d37=_0x188d37||0x1f4;return function(_0x57b45f){logger['error'](_0x57b45f['stack']);if(_0x57b45f[_0x2ba8('0x32')]){delete _0x57b45f[_0x2ba8('0x32')];}_0x5159f2[_0x2ba8('0x21')](_0x188d37)['send'](_0x57b45f);};}exports[_0x2ba8('0x33')]=function(_0x3794c8,_0x3cc2a0){var _0x4a593c={},_0xc5795d={},_0x4a1b16={'count':0x0,'rows':[]};var _0xb421ee=_[_0x2ba8('0x34')](db['Dashboard'][_0x2ba8('0x35')],function(_0x353a07){return{'name':_0x353a07[_0x2ba8('0x36')],'type':_0x353a07[_0x2ba8('0x37')][_0x2ba8('0x38')]};});_0xc5795d[_0x2ba8('0x39')]=_[_0x2ba8('0x34')](_0xb421ee,_0x2ba8('0x32'));_0xc5795d[_0x2ba8('0x3a')]=_[_0x2ba8('0x3b')](_0x3794c8['query']);_0xc5795d['filters']=_['intersection'](_0xc5795d[_0x2ba8('0x39')],_0xc5795d['query']);_0x4a593c['attributes']=_[_0x2ba8('0x3c')](_0xc5795d[_0x2ba8('0x39')],qs[_0x2ba8('0x3d')](_0x3794c8[_0x2ba8('0x3a')][_0x2ba8('0x3d')]));_0x4a593c['attributes']=_0x4a593c['attributes'][_0x2ba8('0x3e')]?_0x4a593c['attributes']:_0xc5795d['model'];if(!_0x3794c8['query'][_0x2ba8('0x3f')](_0x2ba8('0x40'))){_0x4a593c[_0x2ba8('0x26')]=qs['limit'](_0x3794c8[_0x2ba8('0x3a')][_0x2ba8('0x26')]);_0x4a593c['offset']=qs[_0x2ba8('0x24')](_0x3794c8[_0x2ba8('0x3a')][_0x2ba8('0x24')]);}_0x4a593c[_0x2ba8('0x41')]=qs['sort'](_0x3794c8[_0x2ba8('0x3a')][_0x2ba8('0x42')]);_0x4a593c[_0x2ba8('0x43')]=qs[_0x2ba8('0x44')](_[_0x2ba8('0x45')](_0x3794c8[_0x2ba8('0x3a')],_0xc5795d[_0x2ba8('0x44')]),_0xb421ee);if(_0x3794c8[_0x2ba8('0x3a')][_0x2ba8('0x46')]){_0x4a593c['where']=_['merge'](_0x4a593c[_0x2ba8('0x43')],{'$or':_[_0x2ba8('0x34')](_0xb421ee,function(_0x4d5ea0){if(_0x4d5ea0[_0x2ba8('0x37')]!=='VIRTUAL'){var _0x2bb069={};_0x2bb069[_0x4d5ea0['name']]={'$like':'%'+_0x3794c8['query'][_0x2ba8('0x46')]+'%'};return _0x2bb069;}})});}_0x4a593c=_[_0x2ba8('0x47')]({},_0x4a593c,_0x3794c8[_0x2ba8('0x48')]);var _0x298455={'where':_0x4a593c[_0x2ba8('0x43')]};return db['Dashboard'][_0x2ba8('0x27')](_0x298455)[_0x2ba8('0x2d')](function(_0x4249ab){_0x4a1b16['count']=_0x4249ab;if(_0x3794c8[_0x2ba8('0x3a')][_0x2ba8('0x49')]){_0x4a593c[_0x2ba8('0x4a')]=[{'all':!![]}];}return db['Dashboard'][_0x2ba8('0x4b')](_0x4a593c);})[_0x2ba8('0x2d')](function(_0x2a4f03){_0x4a1b16[_0x2ba8('0x4c')]=_0x2a4f03;return _0x4a1b16;})[_0x2ba8('0x2d')](respondWithFilteredResult(_0x3cc2a0,_0x4a593c))[_0x2ba8('0x4d')](handleError(_0x3cc2a0,null));};exports['show']=function(_0x252300,_0x321d1e){var _0xe7d23c={'raw':![],'where':{'id':_0x252300[_0x2ba8('0x4e')]['id']}},_0x190730={};_0x190730[_0x2ba8('0x39')]=_[_0x2ba8('0x3b')](db['Dashboard'][_0x2ba8('0x35')]);_0x190730[_0x2ba8('0x3a')]=_['keys'](_0x252300['query']);_0x190730[_0x2ba8('0x44')]=_['intersection'](_0x190730[_0x2ba8('0x39')],_0x190730[_0x2ba8('0x3a')]);_0xe7d23c[_0x2ba8('0x4f')]=_['intersection'](_0x190730[_0x2ba8('0x39')],qs['fields'](_0x252300[_0x2ba8('0x3a')][_0x2ba8('0x3d')]));_0xe7d23c[_0x2ba8('0x4f')]=_0xe7d23c[_0x2ba8('0x4f')]['length']?_0xe7d23c[_0x2ba8('0x4f')]:_0x190730[_0x2ba8('0x39')];if(_0x252300['query']['includeAll']){_0xe7d23c[_0x2ba8('0x4a')]=[{'all':!![]}];}_0xe7d23c=_[_0x2ba8('0x47')]({},_0xe7d23c,_0x252300[_0x2ba8('0x48')]);return db[_0x2ba8('0x50')]['find'](_0xe7d23c)[_0x2ba8('0x2d')](handleEntityNotFound(_0x321d1e,null))[_0x2ba8('0x2d')](respondWithResult(_0x321d1e,null))[_0x2ba8('0x4d')](handleError(_0x321d1e,null));};exports[_0x2ba8('0x51')]=function(_0x4b4179,_0x43b3bf){return db['Dashboard']['create'](_0x4b4179[_0x2ba8('0x52')],{})[_0x2ba8('0x2d')](function(_0x105633){var _0x40abda=_0x4b4179['user'][_0x2ba8('0x2e')]({'plain':!![]});if(!_0x40abda)throw new Error(_0x2ba8('0x53'));if(_0x40abda[_0x2ba8('0x54')]==='user'){var _0x1b2071=_0x105633[_0x2ba8('0x2e')]({'plain':!![]});var _0x383d1a=_0x2ba8('0x2f');return db[_0x2ba8('0x55')]['find']({'where':{'name':_0x383d1a,'userProfileId':_0x40abda[_0x2ba8('0x56')]},'raw':!![]})[_0x2ba8('0x2d')](function(_0x5eafb5){if(_0x5eafb5&&_0x5eafb5[_0x2ba8('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x1b2071[_0x2ba8('0x32')],'resourceId':_0x1b2071['id'],'type':_0x5eafb5[_0x2ba8('0x32')],'sectionId':_0x5eafb5['id']},{})[_0x2ba8('0x2d')](function(){return _0x105633;});}else{return _0x105633;}})[_0x2ba8('0x4d')](function(_0x3c283d){logger['error'](_0x2ba8('0x58'),_0x3c283d);throw _0x3c283d;});}return _0x105633;})[_0x2ba8('0x2d')](respondWithResult(_0x43b3bf,0xc9))[_0x2ba8('0x4d')](handleError(_0x43b3bf,null));};exports[_0x2ba8('0x59')]=function(_0x3a23a3,_0x4969e4){var _0x639f97={'where':{'id':_0x3a23a3[_0x2ba8('0x4e')]['id']}},_0x121e18={};_0x121e18[_0x2ba8('0x39')]=_[_0x2ba8('0x3b')](db[_0x2ba8('0x50')][_0x2ba8('0x35')]);_0x639f97['attributes']=_[_0x2ba8('0x3c')](_0x121e18['model'],qs[_0x2ba8('0x3d')](_0x3a23a3[_0x2ba8('0x3a')][_0x2ba8('0x3d')]));_0x639f97['attributes']=_0x639f97[_0x2ba8('0x4f')][_0x2ba8('0x3e')]?_0x639f97[_0x2ba8('0x4f')]:_0x121e18[_0x2ba8('0x39')];if(_0x3a23a3[_0x2ba8('0x3a')]['includeAll']){_0x639f97[_0x2ba8('0x4a')]=[{'all':!![]}];}_0x639f97=_[_0x2ba8('0x47')]({},_0x639f97,_0x3a23a3[_0x2ba8('0x48')]);return db['Dashboard'][_0x2ba8('0x5a')](_0x639f97)[_0x2ba8('0x2d')](handleEntityNotFound(_0x4969e4,null))[_0x2ba8('0x2d')](function(_0x9b50af){if(_0x9b50af){var _0x2534d6=_0x9b50af[_0x2ba8('0x2e')]({'plain':!![]});_0x2534d6=qs[_0x2ba8('0x5b')](_0x2534d6,['id',_0x2ba8('0x5c'),_0x2ba8('0x5d')]);_0x3a23a3['body']=_[_0x2ba8('0x5b')](_0x3a23a3[_0x2ba8('0x52')],['id',_0x2ba8('0x5c'),_0x2ba8('0x5d')]);return db['Dashboard'][_0x2ba8('0x51')](_[_0x2ba8('0x47')](_0x2534d6,_0x3a23a3[_0x2ba8('0x52')]),{'include':_0x3a23a3[_0x2ba8('0x3a')][_0x2ba8('0x49')]?[{'all':!![]}]:undefined})[_0x2ba8('0x2d')](function(_0x237e32){var _0x6b9b35=_0x3a23a3[_0x2ba8('0x5e')][_0x2ba8('0x2e')]({'plain':!![]});if(!_0x6b9b35)throw new Error(_0x2ba8('0x53'));if(_0x6b9b35[_0x2ba8('0x54')]===_0x2ba8('0x5e')){var _0x4d49b7=_0x237e32['get']({'plain':!![]});var _0x9f6415=_0x2ba8('0x2f');return db['UserProfileSection'][_0x2ba8('0x5a')]({'where':{'name':_0x9f6415,'userProfileId':_0x6b9b35[_0x2ba8('0x56')]},'raw':!![]})[_0x2ba8('0x2d')](function(_0x2df00c){if(_0x2df00c&&_0x2df00c[_0x2ba8('0x57')]===0x0){return db[_0x2ba8('0x30')][_0x2ba8('0x51')]({'name':_0x4d49b7[_0x2ba8('0x32')],'resourceId':_0x4d49b7['id'],'type':_0x2df00c[_0x2ba8('0x32')],'sectionId':_0x2df00c['id']},{})[_0x2ba8('0x2d')](function(){return _0x237e32;});}else{return _0x237e32;}})['catch'](function(_0x31bebf){logger[_0x2ba8('0x5f')](_0x2ba8('0x58'),_0x31bebf);throw _0x31bebf;});}return _0x237e32;});}})[_0x2ba8('0x2d')](respondWithResult(_0x4969e4,0xc9))[_0x2ba8('0x4d')](handleError(_0x4969e4,null));};exports[_0x2ba8('0x60')]=function(_0x244bf9,_0x1f776a){if(_0x244bf9[_0x2ba8('0x52')]['id']){delete _0x244bf9['body']['id'];}return db[_0x2ba8('0x50')]['find']({'where':{'id':_0x244bf9[_0x2ba8('0x4e')]['id']}})[_0x2ba8('0x2d')](handleEntityNotFound(_0x1f776a,null))[_0x2ba8('0x2d')](saveUpdates(_0x244bf9['body'],null))[_0x2ba8('0x2d')](respondWithResult(_0x1f776a,null))[_0x2ba8('0x4d')](handleError(_0x1f776a,null));};exports[_0x2ba8('0x31')]=function(_0x12982a,_0x57b052){return db[_0x2ba8('0x50')][_0x2ba8('0x5a')]({'where':{'id':_0x12982a[_0x2ba8('0x4e')]['id']}})[_0x2ba8('0x2d')](handleEntityNotFound(_0x57b052,null))[_0x2ba8('0x2d')](removeEntity(_0x57b052,null))[_0x2ba8('0x4d')](handleError(_0x57b052,null));};function widgetAttributes(_0x4d361b){try{switch(_0x4d361b[_0x2ba8('0x37')]){case'iframe':return[{'name':_0x2ba8('0x61'),'value':_0x4d361b[_0x2ba8('0x61')]||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b[_0x2ba8('0x62')][0x0]?_0x4d361b[_0x2ba8('0x62')][0x0][_0x2ba8('0x63')]:undefined)||_0x2ba8('0x64')}];case _0x2ba8('0x65'):return[{'name':_0x2ba8('0x66'),'value':_0x4d361b[_0x2ba8('0x66')]||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b[_0x2ba8('0x62')][0x0]?_0x4d361b['attrs'][0x0][_0x2ba8('0x63')]:undefined)||''}];case _0x2ba8('0x67'):return[{'name':_0x2ba8('0x68'),'value':_0x4d361b['attrHourFormat']||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b['attrs'][0x0]?_0x4d361b[_0x2ba8('0x62')][0x0][_0x2ba8('0x63')]:undefined)||_0x2ba8('0x69')},{'name':_0x2ba8('0x6a'),'value':_0x4d361b[_0x2ba8('0x6a')]||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b[_0x2ba8('0x62')][0x1]?_0x4d361b['attrs'][0x1][_0x2ba8('0x63')]:undefined)||_0x2ba8('0x6b')},{'name':_0x2ba8('0x6c'),'value':_0x4d361b['attrFontSize']||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b[_0x2ba8('0x62')][0x2]?_0x4d361b['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x2ba8('0x6d'),'value':_0x4d361b[_0x2ba8('0x6d')]||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b[_0x2ba8('0x62')][0x0]?_0x4d361b[_0x2ba8('0x62')][0x0][_0x2ba8('0x63')]:undefined)||_0x2ba8('0x6e')},{'name':_0x2ba8('0x6f'),'value':_0x4d361b[_0x2ba8('0x6f')]||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b[_0x2ba8('0x62')][0x1]?_0x4d361b[_0x2ba8('0x62')][0x1][_0x2ba8('0x63')]:undefined)||[]},{'name':_0x2ba8('0x6c'),'value':_0x4d361b[_0x2ba8('0x6c')]||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b[_0x2ba8('0x62')][0x2]?_0x4d361b[_0x2ba8('0x62')][0x2]['value']:undefined)||0x14}];case _0x2ba8('0x70'):case _0x2ba8('0x71'):return[{'name':'attrSerie1','value':_0x4d361b[_0x2ba8('0x72')]||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b['attrs'][0x0]?_0x4d361b[_0x2ba8('0x62')][0x0][_0x2ba8('0x63')]:undefined)||_0x2ba8('0x6e')},{'name':_0x2ba8('0x73'),'value':_0x4d361b[_0x2ba8('0x73')]||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b[_0x2ba8('0x62')][0x1]?_0x4d361b[_0x2ba8('0x62')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x4d361b[_0x2ba8('0x74')]||(_0x4d361b['attrs']&&_0x4d361b['attrs'][0x2]?_0x4d361b['attrs'][0x2][_0x2ba8('0x63')]:undefined)||null},{'name':_0x2ba8('0x6f'),'value':_0x4d361b['attrVoiceQueues']||(_0x4d361b['attrs']&&_0x4d361b['attrs'][0x3]?_0x4d361b[_0x2ba8('0x62')][0x3][_0x2ba8('0x63')]:undefined)||[]}];case _0x2ba8('0x75'):return[{'name':_0x2ba8('0x76'),'type':_0x4d361b[_0x2ba8('0x77')]||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b[_0x2ba8('0x62')][0x0]?_0x4d361b['attrs'][0x0][_0x2ba8('0x37')]:undefined)||null,'value':_0x4d361b[_0x2ba8('0x76')]||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b[_0x2ba8('0x62')][0x0]?_0x4d361b[_0x2ba8('0x62')][0x0]['value']:undefined)||null},{'name':_0x2ba8('0x78'),'value':_0x4d361b['attrRefresh']||(_0x4d361b[_0x2ba8('0x62')]&&_0x4d361b[_0x2ba8('0x62')][0x1]?_0x4d361b[_0x2ba8('0x62')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1b6d4f){logger[_0x2ba8('0x5f')]('widgetAttributes:\x20%s',JSON[_0x2ba8('0x79')](_0x1b6d4f));return[];}}exports[_0x2ba8('0x7a')]=function(_0x5c4a72,_0x443226,_0x4d14b7){if(_0x5c4a72[_0x2ba8('0x52')]['id']){delete _0x5c4a72['body']['id'];}return db[_0x2ba8('0x50')][_0x2ba8('0x5a')]({'where':{'id':_0x5c4a72[_0x2ba8('0x4e')]['id']}})[_0x2ba8('0x2d')](handleEntityNotFound(_0x443226,null))['then'](function(_0x3eb6d8){if(_0x3eb6d8){_0x5c4a72[_0x2ba8('0x52')][_0x2ba8('0x7b')]=_0x3eb6d8['id'];_0x5c4a72[_0x2ba8('0x52')][_0x2ba8('0x62')]=widgetAttributes(_0x5c4a72['body']);return db[_0x2ba8('0x7c')][_0x2ba8('0x51')](_0x5c4a72[_0x2ba8('0x52')]);}})['then'](respondWithResult(_0x443226,null))[_0x2ba8('0x4d')](handleError(_0x443226,null));};exports[_0x2ba8('0x7d')]=function(_0x5e90c6,_0x434dec,_0x4ad8a6){var _0x31dbc5={};var _0x59794a={};var _0x6dc61a;var _0x3ffbcc;return db[_0x2ba8('0x50')][_0x2ba8('0x7e')]({'where':{'id':_0x5e90c6[_0x2ba8('0x4e')]['id']}})[_0x2ba8('0x2d')](handleEntityNotFound(_0x434dec,null))[_0x2ba8('0x2d')](function(_0x33d6ee){if(_0x33d6ee){_0x6dc61a=_0x33d6ee;_0x59794a[_0x2ba8('0x39')]=_[_0x2ba8('0x3b')](db[_0x2ba8('0x7c')][_0x2ba8('0x35')]);_0x59794a[_0x2ba8('0x3a')]=_[_0x2ba8('0x3b')](_0x5e90c6[_0x2ba8('0x3a')]);_0x59794a[_0x2ba8('0x44')]=_[_0x2ba8('0x3c')](_0x59794a[_0x2ba8('0x39')],_0x59794a[_0x2ba8('0x3a')]);_0x31dbc5[_0x2ba8('0x4f')]=_[_0x2ba8('0x3c')](_0x59794a[_0x2ba8('0x39')],qs[_0x2ba8('0x3d')](_0x5e90c6[_0x2ba8('0x3a')][_0x2ba8('0x3d')]));_0x31dbc5['attributes']=_0x31dbc5[_0x2ba8('0x4f')]['length']?_0x31dbc5[_0x2ba8('0x4f')]:_0x59794a[_0x2ba8('0x39')];_0x31dbc5['order']=qs[_0x2ba8('0x42')](_0x5e90c6[_0x2ba8('0x3a')][_0x2ba8('0x42')]);_0x31dbc5['where']=qs[_0x2ba8('0x44')](_[_0x2ba8('0x45')](_0x5e90c6['query'],_0x59794a['filters']));if(_0x5e90c6['query'][_0x2ba8('0x46')]){_0x31dbc5[_0x2ba8('0x43')]=_[_0x2ba8('0x47')](_0x31dbc5[_0x2ba8('0x43')],{'$or':_[_0x2ba8('0x34')](_0x31dbc5[_0x2ba8('0x4f')],function(_0x4377d8){var _0x39b969={};_0x39b969[_0x4377d8]={'$like':'%'+_0x5e90c6['query'][_0x2ba8('0x46')]+'%'};return _0x39b969;})});}_0x31dbc5=_[_0x2ba8('0x47')]({},_0x31dbc5,_0x5e90c6['options']);return _0x6dc61a[_0x2ba8('0x7d')](_0x31dbc5);}})[_0x2ba8('0x2d')](function(_0x2d4c41){if(_0x2d4c41){_0x3ffbcc=_0x2d4c41[_0x2ba8('0x3e')];if(!_0x5e90c6['query'][_0x2ba8('0x3f')](_0x2ba8('0x40'))){_0x31dbc5[_0x2ba8('0x26')]=qs[_0x2ba8('0x26')](_0x5e90c6[_0x2ba8('0x3a')][_0x2ba8('0x26')]);_0x31dbc5[_0x2ba8('0x24')]=qs['offset'](_0x5e90c6['query'][_0x2ba8('0x24')]);}return _0x6dc61a[_0x2ba8('0x7d')](_0x31dbc5);}})['then'](function(_0x233d27){if(_0x233d27){return _0x233d27?{'count':_0x3ffbcc,'rows':_0x233d27}:null;}})[_0x2ba8('0x2d')](respondWithResult(_0x434dec,null))['catch'](handleError(_0x434dec,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7ada97d..b698d39 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 _0x8600=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x8600,0xc3));var _0x0860=function(_0x3c40f4,_0x500b8a){_0x3c40f4=_0x3c40f4-0x0;var _0x1209d=_0x8600[_0x3c40f4];return _0x1209d;};'use strict';var EventEmitter=require(_0x0860('0x0'));var Dashboard=require(_0x0860('0x1'))['db'][_0x0860('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0860('0x3')](0x0);var events={'afterCreate':_0x0860('0x4'),'afterUpdate':_0x0860('0x5'),'afterDestroy':_0x0860('0x6')};function emitEvent(_0x30c5d3){return function(_0x5306a3,_0x10a42e,_0x54bf31){DashboardEvents['emit'](_0x30c5d3+':'+_0x5306a3['id'],_0x5306a3);DashboardEvents[_0x0860('0x7')](_0x30c5d3,_0x5306a3);_0x54bf31(null);};}for(var e in events){if(events[_0x0860('0x8')](e)){var event=events[e];Dashboard[_0x0860('0x9')](e,emitEvent(event));}}module[_0x0860('0xa')]=DashboardEvents; \ No newline at end of file +var _0x4ba3=['exports','events','../../mysqldb','save','update','remove','hasOwnProperty','hook'];(function(_0x3d7c7c,_0x9e421e){var _0x509320=function(_0x3e6f59){while(--_0x3e6f59){_0x3d7c7c['push'](_0x3d7c7c['shift']());}};_0x509320(++_0x9e421e);}(_0x4ba3,0xe9));var _0x34ba=function(_0x3d4a1b,_0x198962){_0x3d4a1b=_0x3d4a1b-0x0;var _0x2ed213=_0x4ba3[_0x3d4a1b];return _0x2ed213;};'use strict';var EventEmitter=require(_0x34ba('0x0'));var Dashboard=require(_0x34ba('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x34ba('0x2'),'afterUpdate':_0x34ba('0x3'),'afterDestroy':_0x34ba('0x4')};function emitEvent(_0x1e43b9){return function(_0x4be4fb,_0x47cc57,_0x5eeda2){DashboardEvents['emit'](_0x1e43b9+':'+_0x4be4fb['id'],_0x4be4fb);DashboardEvents['emit'](_0x1e43b9,_0x4be4fb);_0x5eeda2(null);};}for(var e in events){if(events[_0x34ba('0x5')](e)){var event=events[e];Dashboard[_0x34ba('0x6')](e,emitEvent(event));}}module[_0x34ba('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index fc0c88d..603d779 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 _0x5c9b=['exports','define','Dashboard','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./dashboard.attributes'];(function(_0x14be99,_0x92d4b7){var _0x2a2e8e=function(_0x3d5c50){while(--_0x3d5c50){_0x14be99['push'](_0x14be99['shift']());}};_0x2a2e8e(++_0x92d4b7);}(_0x5c9b,0x13b));var _0xb5c9=function(_0x209240,_0x2c1498){_0x209240=_0x209240-0x0;var _0x281685=_0x5c9b[_0x209240];return _0x281685;};'use strict';var _=require(_0xb5c9('0x0'));var util=require(_0xb5c9('0x1'));var logger=require(_0xb5c9('0x2'))(_0xb5c9('0x3'));var moment=require(_0xb5c9('0x4'));var BPromise=require(_0xb5c9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5c9('0x6'));var rimraf=require(_0xb5c9('0x7'));var config=require('../../config/environment');var attributes=require(_0xb5c9('0x8'));module[_0xb5c9('0x9')]=function(_0x975f8a,_0x1cd33c){return _0x975f8a[_0xb5c9('0xa')](_0xb5c9('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13e9=['moment','bluebird','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api'];(function(_0x30c20e,_0x22570e){var _0x350839=function(_0x56e382){while(--_0x56e382){_0x30c20e['push'](_0x30c20e['shift']());}};_0x350839(++_0x22570e);}(_0x13e9,0xf3));var _0x913e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x13e9[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x913e('0x0'));var util=require(_0x913e('0x1'));var logger=require(_0x913e('0x2'))(_0x913e('0x3'));var moment=require(_0x913e('0x4'));var BPromise=require(_0x913e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x913e('0x6'));var config=require(_0x913e('0x7'));var attributes=require(_0x913e('0x8'));module[_0x913e('0x9')]=function(_0x4535f9,_0xaaeb06){return _0x4535f9[_0x913e('0xa')](_0x913e('0xb'),attributes,{'tableName':_0x913e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 7b6c9c4..9b9b50b 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 _0xebc1=['register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./dashboard.socket'];(function(_0x378d29,_0x428e00){var _0x50c498=function(_0x57dc69){while(--_0x57dc69){_0x378d29['push'](_0x378d29['shift']());}};_0x50c498(++_0x428e00);}(_0xebc1,0x135));var _0x1ebc=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0xebc1[_0x462999];return _0x4b1366;};'use strict';var _=require(_0x1ebc('0x0'));var util=require(_0x1ebc('0x1'));var moment=require(_0x1ebc('0x2'));var BPromise=require('bluebird');var rs=require(_0x1ebc('0x3'));var fs=require('fs');var Redis=require(_0x1ebc('0x4'));var db=require(_0x1ebc('0x5'))['db'];var utils=require(_0x1ebc('0x6'));var logger=require(_0x1ebc('0x7'))(_0x1ebc('0x8'));var config=require(_0x1ebc('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1ebc('0xa')]({'port':0x232a});config[_0x1ebc('0xb')]=_[_0x1ebc('0xc')](config[_0x1ebc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ebc('0xd'))(new Redis(config[_0x1ebc('0xb')]));require(_0x1ebc('0xe'))[_0x1ebc('0xf')](socket);function respondWithRpcPromise(_0x51bb37,_0x2b423e,_0x379cee){return new BPromise(function(_0x2d4575,_0x2302c7){return client[_0x1ebc('0x10')](_0x51bb37,_0x379cee)[_0x1ebc('0x11')](function(_0x489e04){logger['info'](_0x1ebc('0x12'),_0x2b423e,_0x1ebc('0x13'));logger[_0x1ebc('0x14')](_0x1ebc('0x15'),_0x2b423e,_0x1ebc('0x13'),JSON['stringify'](_0x489e04));if(_0x489e04[_0x1ebc('0x16')]){if(_0x489e04[_0x1ebc('0x16')][_0x1ebc('0x17')]===0x1f4){logger['error'](_0x1ebc('0x12'),_0x2b423e,_0x489e04[_0x1ebc('0x16')][_0x1ebc('0x18')]);return _0x2302c7(_0x489e04[_0x1ebc('0x16')][_0x1ebc('0x18')]);}logger['error'](_0x1ebc('0x12'),_0x2b423e,_0x489e04['error']['message']);return _0x2d4575(_0x489e04[_0x1ebc('0x16')]['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x2b423e,_0x1ebc('0x13'));_0x2d4575(_0x489e04[_0x1ebc('0x19')][_0x1ebc('0x18')]);}})[_0x1ebc('0x1a')](function(_0x470c95){logger[_0x1ebc('0x16')](_0x1ebc('0x12'),_0x2b423e,_0x470c95);_0x2302c7(_0x470c95);});});} \ No newline at end of file +var _0xf90c=['jayson/promise','client','redis','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xf90c,0x13a));var _0xcf90=function(_0x9cacdf,_0x5c9a78){_0x9cacdf=_0x9cacdf-0x0;var _0x4c65cf=_0xf90c[_0x9cacdf];return _0x4c65cf;};'use strict';var _=require(_0xcf90('0x0'));var util=require(_0xcf90('0x1'));var moment=require(_0xcf90('0x2'));var BPromise=require(_0xcf90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf90('0x4'));var db=require(_0xcf90('0x5'))['db'];var utils=require(_0xcf90('0x6'));var logger=require(_0xcf90('0x7'))(_0xcf90('0x8'));var config=require(_0xcf90('0x9'));var jayson=require(_0xcf90('0xa'));var client=jayson[_0xcf90('0xb')]['http']({'port':0x232a});config[_0xcf90('0xc')]=_['defaults'](config[_0xcf90('0xc')],{'host':_0xcf90('0xd'),'port':0x18eb});var socket=require(_0xcf90('0xe'))(new Redis(config[_0xcf90('0xc')]));require(_0xcf90('0xf'))['register'](socket);function respondWithRpcPromise(_0xf541a1,_0x7f1757,_0x25aba2){return new BPromise(function(_0x5027b4,_0x443974){return client[_0xcf90('0x10')](_0xf541a1,_0x25aba2)[_0xcf90('0x11')](function(_0x1eecb9){logger[_0xcf90('0x12')](_0xcf90('0x13'),_0x7f1757,_0xcf90('0x14'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x7f1757,_0xcf90('0x14'),JSON[_0xcf90('0x15')](_0x1eecb9));if(_0x1eecb9[_0xcf90('0x16')]){if(_0x1eecb9['error'][_0xcf90('0x17')]===0x1f4){logger[_0xcf90('0x16')](_0xcf90('0x13'),_0x7f1757,_0x1eecb9[_0xcf90('0x16')][_0xcf90('0x18')]);return _0x443974(_0x1eecb9['error'][_0xcf90('0x18')]);}logger[_0xcf90('0x16')](_0xcf90('0x13'),_0x7f1757,_0x1eecb9[_0xcf90('0x16')][_0xcf90('0x18')]);return _0x5027b4(_0x1eecb9[_0xcf90('0x16')][_0xcf90('0x18')]);}else{logger[_0xcf90('0x12')](_0xcf90('0x13'),_0x7f1757,_0xcf90('0x14'));_0x5027b4(_0x1eecb9[_0xcf90('0x19')]['message']);}})[_0xcf90('0x1a')](function(_0x1ecde6){logger[_0xcf90('0x16')](_0xcf90('0x13'),_0x7f1757,_0x1ecde6);_0x443974(_0x1ecde6);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 21d18a5..12d8a18 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 _0x1a57=['update','emit','removeListener','register','length','./dashboard.events','save','remove'];(function(_0x131a65,_0x23669c){var _0x2fb153=function(_0x27156f){while(--_0x27156f){_0x131a65['push'](_0x131a65['shift']());}};_0x2fb153(++_0x23669c);}(_0x1a57,0x11d));var _0x71a5=function(_0x6dce05,_0x539eb6){_0x6dce05=_0x6dce05-0x0;var _0x7f486=_0x1a57[_0x6dce05];return _0x7f486;};'use strict';var DashboardEvents=require(_0x71a5('0x0'));var events=[_0x71a5('0x1'),_0x71a5('0x2'),_0x71a5('0x3')];function createListener(_0x4ef5eb,_0x1791a9){return function(_0xd0fa61){_0x1791a9[_0x71a5('0x4')](_0x4ef5eb,_0xd0fa61);};}function removeListener(_0xaae910,_0x8db865){return function(){DashboardEvents[_0x71a5('0x5')](_0xaae910,_0x8db865);};}exports[_0x71a5('0x6')]=function(_0x4174c3){for(var _0x3d49f2=0x0,_0x556a5c=events[_0x71a5('0x7')];_0x3d49f2<_0x556a5c;_0x3d49f2++){var _0x2dbbc7=events[_0x3d49f2];var _0x379873=createListener('dashboard:'+_0x2dbbc7,_0x4174c3);DashboardEvents['on'](_0x2dbbc7,_0x379873);}}; \ No newline at end of file +var _0x0114=['emit','removeListener','register','length','dashboard:','./dashboard.events','save','remove','update'];(function(_0x27400e,_0x3ae0d5){var _0x4c741c=function(_0x14614f){while(--_0x14614f){_0x27400e['push'](_0x27400e['shift']());}};_0x4c741c(++_0x3ae0d5);}(_0x0114,0x8c));var _0x4011=function(_0x44c0d5,_0x1e3dd1){_0x44c0d5=_0x44c0d5-0x0;var _0x328306=_0x0114[_0x44c0d5];return _0x328306;};'use strict';var DashboardEvents=require(_0x4011('0x0'));var events=[_0x4011('0x1'),_0x4011('0x2'),_0x4011('0x3')];function createListener(_0x26e190,_0x2a07b0){return function(_0x9023e2){_0x2a07b0[_0x4011('0x4')](_0x26e190,_0x9023e2);};}function removeListener(_0x19db86,_0x17bb49){return function(){DashboardEvents[_0x4011('0x5')](_0x19db86,_0x17bb49);};}exports[_0x4011('0x6')]=function(_0x6ce0eb){for(var _0x16ac67=0x0,_0x2902b7=events[_0x4011('0x7')];_0x16ac67<_0x2902b7;_0x16ac67++){var _0x28ab62=events[_0x16ac67];var _0x3fa9ea=createListener(_0x4011('0x8')+_0x28ab62,_0x6ce0eb);DashboardEvents['on'](_0x28ab62,_0x3fa9ea);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 8351e6b..f3d95c4 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 _0x284b=['create','/:id/clone','clone','addItem','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','post'];(function(_0x547791,_0x50d8ec){var _0x545953=function(_0x3c0410){while(--_0x3c0410){_0x547791['push'](_0x547791['shift']());}};_0x545953(++_0x50d8ec);}(_0x284b,0x1d7));var _0xb284=function(_0x305cb6,_0x43827c){_0x305cb6=_0x305cb6-0x0;var _0x5845cf=_0x284b[_0x305cb6];return _0x5845cf;};'use strict';var multer=require('multer');var util=require(_0xb284('0x0'));var path=require(_0xb284('0x1'));var timeout=require(_0xb284('0x2'));var express=require(_0xb284('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb284('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb284('0x5'));var controller=require(_0xb284('0x6'));router[_0xb284('0x7')]('/',auth[_0xb284('0x8')](),controller[_0xb284('0x9')]);router[_0xb284('0x7')](_0xb284('0xa'),auth[_0xb284('0x8')](),controller['show']);router[_0xb284('0x7')](_0xb284('0xb'),auth[_0xb284('0x8')](),controller['getItems']);router[_0xb284('0xc')]('/',auth['isAuthenticated'](),controller[_0xb284('0xd')]);router[_0xb284('0xc')](_0xb284('0xe'),auth[_0xb284('0x8')](),controller[_0xb284('0xf')]);router['post'](_0xb284('0xb'),auth[_0xb284('0x8')](),controller[_0xb284('0x10')]);router[_0xb284('0x11')](_0xb284('0xa'),auth[_0xb284('0x8')](),controller[_0xb284('0x12')]);router[_0xb284('0x13')](_0xb284('0xa'),auth['isAuthenticated'](),controller[_0xb284('0x14')]);module[_0xb284('0x15')]=router; \ No newline at end of file +var _0x9b05=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./dashboard.controller','get','/:id','isAuthenticated','show','post','create','/:id/clone','/:id/items','addItem','put','update','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b05,0x160));var _0x59b0=function(_0x3d7f0e,_0x104d69){_0x3d7f0e=_0x3d7f0e-0x0;var _0x3e45dd=_0x9b05[_0x3d7f0e];return _0x3e45dd;};'use strict';var multer=require(_0x59b0('0x0'));var util=require(_0x59b0('0x1'));var path=require(_0x59b0('0x2'));var timeout=require(_0x59b0('0x3'));var express=require(_0x59b0('0x4'));var router=express[_0x59b0('0x5')]();var fs_extra=require(_0x59b0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x59b0('0x7'));var config=require('../../config/environment');var controller=require(_0x59b0('0x8'));router[_0x59b0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x59b0('0x9')](_0x59b0('0xa'),auth[_0x59b0('0xb')](),controller[_0x59b0('0xc')]);router['get']('/:id/items',auth[_0x59b0('0xb')](),controller['getItems']);router[_0x59b0('0xd')]('/',auth[_0x59b0('0xb')](),controller[_0x59b0('0xe')]);router[_0x59b0('0xd')](_0x59b0('0xf'),auth['isAuthenticated'](),controller['clone']);router[_0x59b0('0xd')](_0x59b0('0x10'),auth[_0x59b0('0xb')](),controller[_0x59b0('0x11')]);router[_0x59b0('0x12')]('/:id',auth[_0x59b0('0xb')](),controller[_0x59b0('0x13')]);router['delete'](_0x59b0('0xa'),auth[_0x59b0('0xb')](),controller[_0x59b0('0x14')]);module[_0x59b0('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 e69dccf..c885476 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 _0x71ab=['setDataValue','stringify','INTEGER','#2196f3','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x71ab,0x64));var _0xb71a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71ab[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xb71a('0x0'));var _=require('lodash');module[_0xb71a('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb71a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb71a('0x3')](_0xb71a('0x4')),'get':function(){try{return JSON[_0xb71a('0x5')](this[_0xb71a('0x6')](_0xb71a('0x7')));}catch(_0x2192e8){return[];}},'set':function(_0x38d931){try{this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')](_0x38d931));}catch(_0x2a4c86){this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb71a('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':_0xb71a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb71a('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5d17=['#ffffff','sequelize','squel','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0x5d17,0x114));var _0x75d1=function(_0x44b5d9,_0xe28bb1){_0x44b5d9=_0x44b5d9-0x0;var _0x25d599=_0x5d17[_0x44b5d9];return _0x25d599;};'use strict';var Sequelize=require(_0x75d1('0x0'));var squel=require(_0x75d1('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x75d1('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x75d1('0x3')]('long'),'get':function(){try{return JSON[_0x75d1('0x4')](this[_0x75d1('0x5')](_0x75d1('0x6')));}catch(_0x32bd45){return[];}},'set':function(_0x56ac0a){try{this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')](_0x56ac0a));}catch(_0x1ee61b){this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x75d1('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x75d1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x75d1('0x2')]},'titleFontSize':{'type':Sequelize[_0x75d1('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 5c0647b..71ebaa9 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 _0x2e86=['attrRefresh','error','widgetAttributes:\x20%s','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','limit','undefined','offset','count','set','apply','reject','update','then','destroy','name','send','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','options','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','multibar-chart','attrSerie2','attrSerie3','web-report','reportType','attrReport'];(function(_0x25fa17,_0x4e2a9a){var _0x4bee71=function(_0x77c7c7){while(--_0x77c7c7){_0x25fa17['push'](_0x25fa17['shift']());}};_0x4bee71(++_0x4e2a9a);}(_0x2e86,0x1cc));var _0x62e8=function(_0x325255,_0x57e53b){_0x325255=_0x325255-0x0;var _0x43b8bf=_0x2e86[_0x325255];return _0x43b8bf;};'use strict';var emlformat=require(_0x62e8('0x0'));var rimraf=require(_0x62e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x62e8('0x2'));var moment=require(_0x62e8('0x3'));var BPromise=require(_0x62e8('0x4'));var Mustache=require(_0x62e8('0x5'));var util=require(_0x62e8('0x6'));var path=require(_0x62e8('0x7'));var sox=require(_0x62e8('0x8'));var csv=require(_0x62e8('0x9'));var ejs=require(_0x62e8('0xa'));var fs=require('fs');var fs_extra=require(_0x62e8('0xb'));var _=require(_0x62e8('0xc'));var squel=require(_0x62e8('0xd'));var crypto=require(_0x62e8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x62e8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x62e8('0x10'));var Papa=require('papaparse');var Redis=require(_0x62e8('0x11'));var authService=require(_0x62e8('0x12'));var qs=require(_0x62e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62e8('0x14'));var logger=require(_0x62e8('0x15'))(_0x62e8('0x16'));var utils=require(_0x62e8('0x17'));var config=require(_0x62e8('0x18'));var licenseUtil=require(_0x62e8('0x19'));var db=require(_0x62e8('0x1a'))['db'];config[_0x62e8('0x1b')]=_[_0x62e8('0x1c')](config[_0x62e8('0x1b')],{'host':_0x62e8('0x1d'),'port':0x18eb});var socket=require(_0x62e8('0x1e'))(new Redis(config[_0x62e8('0x1b')]));require(_0x62e8('0x1f'))[_0x62e8('0x20')](socket);function respondWithStatusCode(_0x5b20d4,_0x3d1e9c){_0x3d1e9c=_0x3d1e9c||0xcc;return function(_0x2e64cc){if(_0x2e64cc){return _0x5b20d4[_0x62e8('0x21')](_0x3d1e9c);}return _0x5b20d4[_0x62e8('0x22')](_0x3d1e9c)[_0x62e8('0x23')]();};}function respondWithResult(_0x51e057,_0x39df1f){_0x39df1f=_0x39df1f||0xc8;return function(_0x2684ce){if(_0x2684ce){return _0x51e057[_0x62e8('0x22')](_0x39df1f)[_0x62e8('0x24')](_0x2684ce);}};}function respondWithFilteredResult(_0x1c5680,_0x445b86){return function(_0x34b1c8){if(_0x34b1c8){var _0x4e9edc=typeof _0x445b86['offset']==='undefined'&&typeof _0x445b86[_0x62e8('0x25')]===_0x62e8('0x26');var _0x2b61dc=_0x34b1c8['count'];var _0xd4e4f4=_0x4e9edc?0x0:_0x445b86[_0x62e8('0x27')];var _0x5c0fca=_0x4e9edc?_0x34b1c8[_0x62e8('0x28')]:_0x445b86['offset']+_0x445b86[_0x62e8('0x25')];var _0x426bca;if(_0x5c0fca>=_0x2b61dc){_0x5c0fca=_0x2b61dc;_0x426bca=0xc8;}else{_0x426bca=0xce;}_0x1c5680['status'](_0x426bca);return _0x1c5680[_0x62e8('0x29')]('Content-Range',_0xd4e4f4+'-'+_0x5c0fca+'/'+_0x2b61dc)[_0x62e8('0x24')](_0x34b1c8);}return null;};}function patchUpdates(_0xdee5d6){return function(_0x297c26){try{jsonpatch[_0x62e8('0x2a')](_0x297c26,_0xdee5d6,!![]);}catch(_0x20e5f4){return BPromise[_0x62e8('0x2b')](_0x20e5f4);}return _0x297c26['save']();};}function saveUpdates(_0x5419a4,_0x94c64){return function(_0x2aed03){if(_0x2aed03){return _0x2aed03[_0x62e8('0x2c')](_0x5419a4)[_0x62e8('0x2d')](function(_0x1c9188){return _0x1c9188;});}return null;};}function removeEntity(_0x19b3ac,_0x12dd82){return function(_0x40f554){if(_0x40f554){return _0x40f554[_0x62e8('0x2e')]()[_0x62e8('0x2d')](function(){_0x19b3ac[_0x62e8('0x22')](0xcc)[_0x62e8('0x23')]();});}};}function handleEntityNotFound(_0x5358e0,_0x13dc45){return function(_0x50232d){if(!_0x50232d){_0x5358e0['sendStatus'](0x194);}return _0x50232d;};}function handleError(_0x2c4bfa,_0x555661){_0x555661=_0x555661||0x1f4;return function(_0x5945ca){logger['error'](_0x5945ca['stack']);if(_0x5945ca[_0x62e8('0x2f')]){delete _0x5945ca[_0x62e8('0x2f')];}_0x2c4bfa[_0x62e8('0x22')](_0x555661)[_0x62e8('0x30')](_0x5945ca);};}exports['show']=function(_0x3a2be8,_0x1c748d){var _0x488f2f={'raw':![],'where':{'id':_0x3a2be8[_0x62e8('0x31')]['id']}},_0x1475b6={};_0x1475b6[_0x62e8('0x32')]=_['keys'](db[_0x62e8('0x33')][_0x62e8('0x34')]);_0x1475b6[_0x62e8('0x35')]=_[_0x62e8('0x36')](_0x3a2be8['query']);_0x1475b6[_0x62e8('0x37')]=_[_0x62e8('0x38')](_0x1475b6['model'],_0x1475b6[_0x62e8('0x35')]);_0x488f2f[_0x62e8('0x39')]=_[_0x62e8('0x38')](_0x1475b6[_0x62e8('0x32')],qs[_0x62e8('0x3a')](_0x3a2be8[_0x62e8('0x35')][_0x62e8('0x3a')]));_0x488f2f['attributes']=_0x488f2f[_0x62e8('0x39')][_0x62e8('0x3b')]?_0x488f2f['attributes']:_0x1475b6['model'];if(_0x3a2be8['query'][_0x62e8('0x3c')]){_0x488f2f[_0x62e8('0x3d')]=[{'all':!![]}];}_0x488f2f=_['merge']({},_0x488f2f,_0x3a2be8[_0x62e8('0x3e')]);return db['DashboardItem']['find'](_0x488f2f)['then'](handleEntityNotFound(_0x1c748d,null))[_0x62e8('0x2d')](respondWithResult(_0x1c748d,null))[_0x62e8('0x3f')](handleError(_0x1c748d,null));};exports[_0x62e8('0x2e')]=function(_0x2be5a7,_0x42bc22){return db[_0x62e8('0x33')]['find']({'where':{'id':_0x2be5a7[_0x62e8('0x31')]['id']}})[_0x62e8('0x2d')](handleEntityNotFound(_0x42bc22,null))[_0x62e8('0x2d')](removeEntity(_0x42bc22,null))[_0x62e8('0x3f')](handleError(_0x42bc22,null));};function widgetAttributes(_0x4cbb2b){try{switch(_0x4cbb2b[_0x62e8('0x40')]){case _0x62e8('0x41'):return[{'name':'attrUrl','value':_0x4cbb2b[_0x62e8('0x42')]||(_0x4cbb2b[_0x62e8('0x43')]&&_0x4cbb2b[_0x62e8('0x43')][0x0]?_0x4cbb2b[_0x62e8('0x43')][0x0][_0x62e8('0x44')]:undefined)||'https://'}];case _0x62e8('0x45'):return[{'name':_0x62e8('0x46'),'value':_0x4cbb2b[_0x62e8('0x46')]||(_0x4cbb2b[_0x62e8('0x43')]&&_0x4cbb2b[_0x62e8('0x43')][0x0]?_0x4cbb2b['attrs'][0x0][_0x62e8('0x44')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x4cbb2b[_0x62e8('0x47')]||(_0x4cbb2b['attrs']&&_0x4cbb2b[_0x62e8('0x43')][0x0]?_0x4cbb2b[_0x62e8('0x43')][0x0][_0x62e8('0x44')]:undefined)||_0x62e8('0x48')},{'name':_0x62e8('0x49'),'value':_0x4cbb2b[_0x62e8('0x49')]||(_0x4cbb2b[_0x62e8('0x43')]&&_0x4cbb2b[_0x62e8('0x43')][0x1]?_0x4cbb2b['attrs'][0x1][_0x62e8('0x44')]:undefined)||_0x62e8('0x4a')},{'name':'attrFontSize','value':_0x4cbb2b['attrFontSize']||(_0x4cbb2b[_0x62e8('0x43')]&&_0x4cbb2b[_0x62e8('0x43')][0x2]?_0x4cbb2b[_0x62e8('0x43')][0x2][_0x62e8('0x44')]:undefined)||0xc}];case _0x62e8('0x4b'):return[{'name':_0x62e8('0x4c'),'value':_0x4cbb2b[_0x62e8('0x4c')]||(_0x4cbb2b[_0x62e8('0x43')]&&_0x4cbb2b[_0x62e8('0x43')][0x0]?_0x4cbb2b['attrs'][0x0][_0x62e8('0x44')]:undefined)||_0x62e8('0x4d')},{'name':_0x62e8('0x4e'),'value':_0x4cbb2b[_0x62e8('0x4e')]||(_0x4cbb2b['attrs']&&_0x4cbb2b[_0x62e8('0x43')][0x1]?_0x4cbb2b[_0x62e8('0x43')][0x1][_0x62e8('0x44')]:undefined)||[]},{'name':_0x62e8('0x4f'),'value':_0x4cbb2b[_0x62e8('0x4f')]||(_0x4cbb2b['attrs']&&_0x4cbb2b[_0x62e8('0x43')][0x2]?_0x4cbb2b['attrs'][0x2][_0x62e8('0x44')]:undefined)||0x14}];case _0x62e8('0x50'):case'pie-chart':return[{'name':'attrSerie1','value':_0x4cbb2b['attrSerie1']||(_0x4cbb2b[_0x62e8('0x43')]&&_0x4cbb2b[_0x62e8('0x43')][0x0]?_0x4cbb2b['attrs'][0x0][_0x62e8('0x44')]:undefined)||_0x62e8('0x4d')},{'name':_0x62e8('0x51'),'value':_0x4cbb2b[_0x62e8('0x51')]||(_0x4cbb2b[_0x62e8('0x43')]&&_0x4cbb2b[_0x62e8('0x43')][0x1]?_0x4cbb2b[_0x62e8('0x43')][0x1]['value']:undefined)||null},{'name':_0x62e8('0x52'),'value':_0x4cbb2b['attrSerie3']||(_0x4cbb2b['attrs']&&_0x4cbb2b['attrs'][0x2]?_0x4cbb2b[_0x62e8('0x43')][0x2][_0x62e8('0x44')]:undefined)||null},{'name':_0x62e8('0x4e'),'value':_0x4cbb2b[_0x62e8('0x4e')]||(_0x4cbb2b[_0x62e8('0x43')]&&_0x4cbb2b[_0x62e8('0x43')][0x3]?_0x4cbb2b['attrs'][0x3][_0x62e8('0x44')]:undefined)||[]}];case _0x62e8('0x53'):return[{'name':'attrReport','type':_0x4cbb2b[_0x62e8('0x54')]||(_0x4cbb2b[_0x62e8('0x43')]&&_0x4cbb2b[_0x62e8('0x43')][0x0]?_0x4cbb2b[_0x62e8('0x43')][0x0]['type']:undefined)||null,'value':_0x4cbb2b[_0x62e8('0x55')]||(_0x4cbb2b[_0x62e8('0x43')]&&_0x4cbb2b[_0x62e8('0x43')][0x0]?_0x4cbb2b[_0x62e8('0x43')][0x0][_0x62e8('0x44')]:undefined)||null},{'name':_0x62e8('0x56'),'value':_0x4cbb2b[_0x62e8('0x56')]||(_0x4cbb2b['attrs']&&_0x4cbb2b[_0x62e8('0x43')][0x1]?_0x4cbb2b[_0x62e8('0x43')][0x1][_0x62e8('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x419662){logger[_0x62e8('0x57')](_0x62e8('0x58'),JSON['stringify'](_0x419662));return[];}}exports[_0x62e8('0x59')]=function(_0x56057a,_0x54f9c8){if(_0x56057a[_0x62e8('0x5a')]){_0x56057a['body'][_0x62e8('0x43')]=widgetAttributes(_0x56057a[_0x62e8('0x5a')]);}return db[_0x62e8('0x33')]['create'](_0x56057a['body'],{})[_0x62e8('0x2d')](respondWithResult(_0x54f9c8,0xc9))[_0x62e8('0x3f')](handleError(_0x54f9c8,null));};exports[_0x62e8('0x2c')]=function(_0x377eee,_0x4d3217){if(_0x377eee[_0x62e8('0x5a')]['id']){delete _0x377eee[_0x62e8('0x5a')]['id'];}_0x377eee['body'][_0x62e8('0x43')]=widgetAttributes(_0x377eee[_0x62e8('0x5a')]);return db['DashboardItem']['find']({'where':{'id':_0x377eee[_0x62e8('0x31')]['id']}})['then'](handleEntityNotFound(_0x4d3217,null))['then'](saveUpdates(_0x377eee[_0x62e8('0x5a')],null))['then'](respondWithResult(_0x4d3217,null))[_0x62e8('0x3f')](handleError(_0x4d3217,null));}; \ No newline at end of file +var _0xe7be=['0.00','attrMetric','attrVoiceQueues','attrFontSize','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','type','attrReport','attrRefresh','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','then','destroy','error','name','send','show','model','keys','rawAttributes','query','intersection','attributes','fields','includeAll','include','options','find','DashboardItem','params','catch','attrUrl','attrs','https://','custom','attrPath','attrHourFormat','value','HH:mm:ss','attrTimezone'];(function(_0xe2c53d,_0x5b19a5){var _0x58bda5=function(_0x398ac0){while(--_0x398ac0){_0xe2c53d['push'](_0xe2c53d['shift']());}};_0x58bda5(++_0x5b19a5);}(_0xe7be,0x16a));var _0xee7b=function(_0x163d89,_0x16dfa7){_0x163d89=_0x163d89-0x0;var _0x4affa6=_0xe7be[_0x163d89];return _0x4affa6;};'use strict';var emlformat=require(_0xee7b('0x0'));var rimraf=require(_0xee7b('0x1'));var zipdir=require(_0xee7b('0x2'));var jsonpatch=require(_0xee7b('0x3'));var rp=require('request-promise');var moment=require(_0xee7b('0x4'));var BPromise=require(_0xee7b('0x5'));var Mustache=require(_0xee7b('0x6'));var util=require(_0xee7b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xee7b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee7b('0x9'));var _=require(_0xee7b('0xa'));var squel=require(_0xee7b('0xb'));var crypto=require('crypto');var jsforce=require(_0xee7b('0xc'));var deskjs=require(_0xee7b('0xd'));var toCsv=require(_0xee7b('0x8'));var querystring=require(_0xee7b('0xe'));var Papa=require(_0xee7b('0xf'));var Redis=require('ioredis');var authService=require(_0xee7b('0x10'));var qs=require(_0xee7b('0x11'));var as=require(_0xee7b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee7b('0x13'))(_0xee7b('0x14'));var utils=require(_0xee7b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xee7b('0x16'));var db=require(_0xee7b('0x17'))['db'];config[_0xee7b('0x18')]=_['defaults'](config['redis'],{'host':_0xee7b('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee7b('0x18')]));require(_0xee7b('0x1a'))[_0xee7b('0x1b')](socket);function respondWithStatusCode(_0x1ee8e7,_0x491c9c){_0x491c9c=_0x491c9c||0xcc;return function(_0x7d5f5a){if(_0x7d5f5a){return _0x1ee8e7[_0xee7b('0x1c')](_0x491c9c);}return _0x1ee8e7[_0xee7b('0x1d')](_0x491c9c)[_0xee7b('0x1e')]();};}function respondWithResult(_0x4093ef,_0x947ba6){_0x947ba6=_0x947ba6||0xc8;return function(_0x576346){if(_0x576346){return _0x4093ef['status'](_0x947ba6)[_0xee7b('0x1f')](_0x576346);}};}function respondWithFilteredResult(_0x4ab366,_0x49202d){return function(_0x430dd2){if(_0x430dd2){var _0x229c94=typeof _0x49202d[_0xee7b('0x20')]===_0xee7b('0x21')&&typeof _0x49202d[_0xee7b('0x22')]==='undefined';var _0x532447=_0x430dd2['count'];var _0x1ec1b5=_0x229c94?0x0:_0x49202d['offset'];var _0x403544=_0x229c94?_0x430dd2['count']:_0x49202d['offset']+_0x49202d[_0xee7b('0x22')];var _0xbcd573;if(_0x403544>=_0x532447){_0x403544=_0x532447;_0xbcd573=0xc8;}else{_0xbcd573=0xce;}_0x4ab366[_0xee7b('0x1d')](_0xbcd573);return _0x4ab366[_0xee7b('0x23')](_0xee7b('0x24'),_0x1ec1b5+'-'+_0x403544+'/'+_0x532447)[_0xee7b('0x1f')](_0x430dd2);}return null;};}function patchUpdates(_0x5e7c8f){return function(_0x2d8971){try{jsonpatch['apply'](_0x2d8971,_0x5e7c8f,!![]);}catch(_0x3effc7){return BPromise[_0xee7b('0x25')](_0x3effc7);}return _0x2d8971[_0xee7b('0x26')]();};}function saveUpdates(_0x17cbd1,_0x427a1d){return function(_0x397666){if(_0x397666){return _0x397666['update'](_0x17cbd1)[_0xee7b('0x27')](function(_0x1464c3){return _0x1464c3;});}return null;};}function removeEntity(_0x163339,_0x3575b4){return function(_0x4a4cae){if(_0x4a4cae){return _0x4a4cae[_0xee7b('0x28')]()[_0xee7b('0x27')](function(){_0x163339[_0xee7b('0x1d')](0xcc)[_0xee7b('0x1e')]();});}};}function handleEntityNotFound(_0x52fcca,_0x43820a){return function(_0x10d136){if(!_0x10d136){_0x52fcca['sendStatus'](0x194);}return _0x10d136;};}function handleError(_0x200f7b,_0x484bd8){_0x484bd8=_0x484bd8||0x1f4;return function(_0x12e347){logger[_0xee7b('0x29')](_0x12e347['stack']);if(_0x12e347[_0xee7b('0x2a')]){delete _0x12e347[_0xee7b('0x2a')];}_0x200f7b[_0xee7b('0x1d')](_0x484bd8)[_0xee7b('0x2b')](_0x12e347);};}exports[_0xee7b('0x2c')]=function(_0x47c49f,_0x178615){var _0x31a1db={'raw':![],'where':{'id':_0x47c49f['params']['id']}},_0x233e4a={};_0x233e4a[_0xee7b('0x2d')]=_[_0xee7b('0x2e')](db['DashboardItem'][_0xee7b('0x2f')]);_0x233e4a[_0xee7b('0x30')]=_[_0xee7b('0x2e')](_0x47c49f['query']);_0x233e4a['filters']=_[_0xee7b('0x31')](_0x233e4a['model'],_0x233e4a[_0xee7b('0x30')]);_0x31a1db[_0xee7b('0x32')]=_[_0xee7b('0x31')](_0x233e4a[_0xee7b('0x2d')],qs[_0xee7b('0x33')](_0x47c49f[_0xee7b('0x30')]['fields']));_0x31a1db[_0xee7b('0x32')]=_0x31a1db[_0xee7b('0x32')]['length']?_0x31a1db[_0xee7b('0x32')]:_0x233e4a[_0xee7b('0x2d')];if(_0x47c49f[_0xee7b('0x30')][_0xee7b('0x34')]){_0x31a1db[_0xee7b('0x35')]=[{'all':!![]}];}_0x31a1db=_['merge']({},_0x31a1db,_0x47c49f[_0xee7b('0x36')]);return db['DashboardItem'][_0xee7b('0x37')](_0x31a1db)[_0xee7b('0x27')](handleEntityNotFound(_0x178615,null))['then'](respondWithResult(_0x178615,null))['catch'](handleError(_0x178615,null));};exports[_0xee7b('0x28')]=function(_0xbcb3d2,_0x404460){return db[_0xee7b('0x38')]['find']({'where':{'id':_0xbcb3d2[_0xee7b('0x39')]['id']}})[_0xee7b('0x27')](handleEntityNotFound(_0x404460,null))[_0xee7b('0x27')](removeEntity(_0x404460,null))[_0xee7b('0x3a')](handleError(_0x404460,null));};function widgetAttributes(_0xa2f0d8){try{switch(_0xa2f0d8['type']){case'iframe':return[{'name':_0xee7b('0x3b'),'value':_0xa2f0d8[_0xee7b('0x3b')]||(_0xa2f0d8[_0xee7b('0x3c')]&&_0xa2f0d8[_0xee7b('0x3c')][0x0]?_0xa2f0d8['attrs'][0x0]['value']:undefined)||_0xee7b('0x3d')}];case _0xee7b('0x3e'):return[{'name':_0xee7b('0x3f'),'value':_0xa2f0d8['attrPath']||(_0xa2f0d8[_0xee7b('0x3c')]&&_0xa2f0d8[_0xee7b('0x3c')][0x0]?_0xa2f0d8[_0xee7b('0x3c')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xee7b('0x40'),'value':_0xa2f0d8['attrHourFormat']||(_0xa2f0d8['attrs']&&_0xa2f0d8['attrs'][0x0]?_0xa2f0d8['attrs'][0x0][_0xee7b('0x41')]:undefined)||_0xee7b('0x42')},{'name':_0xee7b('0x43'),'value':_0xa2f0d8['attrTimezone']||(_0xa2f0d8[_0xee7b('0x3c')]&&_0xa2f0d8['attrs'][0x1]?_0xa2f0d8['attrs'][0x1][_0xee7b('0x41')]:undefined)||_0xee7b('0x44')},{'name':'attrFontSize','value':_0xa2f0d8['attrFontSize']||(_0xa2f0d8[_0xee7b('0x3c')]&&_0xa2f0d8['attrs'][0x2]?_0xa2f0d8[_0xee7b('0x3c')][0x2][_0xee7b('0x41')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0xa2f0d8[_0xee7b('0x45')]||(_0xa2f0d8[_0xee7b('0x3c')]&&_0xa2f0d8[_0xee7b('0x3c')][0x0]?_0xa2f0d8[_0xee7b('0x3c')][0x0][_0xee7b('0x41')]:undefined)||'total'},{'name':_0xee7b('0x46'),'value':_0xa2f0d8[_0xee7b('0x46')]||(_0xa2f0d8[_0xee7b('0x3c')]&&_0xa2f0d8[_0xee7b('0x3c')][0x1]?_0xa2f0d8['attrs'][0x1]['value']:undefined)||[]},{'name':_0xee7b('0x47'),'value':_0xa2f0d8[_0xee7b('0x47')]||(_0xa2f0d8[_0xee7b('0x3c')]&&_0xa2f0d8[_0xee7b('0x3c')][0x2]?_0xa2f0d8[_0xee7b('0x3c')][0x2]['value']:undefined)||0x14}];case _0xee7b('0x48'):case _0xee7b('0x49'):return[{'name':_0xee7b('0x4a'),'value':_0xa2f0d8['attrSerie1']||(_0xa2f0d8[_0xee7b('0x3c')]&&_0xa2f0d8['attrs'][0x0]?_0xa2f0d8[_0xee7b('0x3c')][0x0][_0xee7b('0x41')]:undefined)||_0xee7b('0x4b')},{'name':'attrSerie2','value':_0xa2f0d8[_0xee7b('0x4c')]||(_0xa2f0d8['attrs']&&_0xa2f0d8[_0xee7b('0x3c')][0x1]?_0xa2f0d8['attrs'][0x1][_0xee7b('0x41')]:undefined)||null},{'name':_0xee7b('0x4d'),'value':_0xa2f0d8['attrSerie3']||(_0xa2f0d8[_0xee7b('0x3c')]&&_0xa2f0d8['attrs'][0x2]?_0xa2f0d8[_0xee7b('0x3c')][0x2]['value']:undefined)||null},{'name':_0xee7b('0x46'),'value':_0xa2f0d8[_0xee7b('0x46')]||(_0xa2f0d8[_0xee7b('0x3c')]&&_0xa2f0d8['attrs'][0x3]?_0xa2f0d8[_0xee7b('0x3c')][0x3][_0xee7b('0x41')]:undefined)||[]}];case _0xee7b('0x4e'):return[{'name':'attrReport','type':_0xa2f0d8[_0xee7b('0x4f')]||(_0xa2f0d8[_0xee7b('0x3c')]&&_0xa2f0d8[_0xee7b('0x3c')][0x0]?_0xa2f0d8['attrs'][0x0][_0xee7b('0x50')]:undefined)||null,'value':_0xa2f0d8[_0xee7b('0x51')]||(_0xa2f0d8[_0xee7b('0x3c')]&&_0xa2f0d8[_0xee7b('0x3c')][0x0]?_0xa2f0d8[_0xee7b('0x3c')][0x0][_0xee7b('0x41')]:undefined)||null},{'name':_0xee7b('0x52'),'value':_0xa2f0d8[_0xee7b('0x52')]||(_0xa2f0d8['attrs']&&_0xa2f0d8[_0xee7b('0x3c')][0x1]?_0xa2f0d8[_0xee7b('0x3c')][0x1][_0xee7b('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x4e3cc1){logger['error']('widgetAttributes:\x20%s',JSON['stringify'](_0x4e3cc1));return[];}}exports[_0xee7b('0x53')]=function(_0x2cdad6,_0x22e458){if(_0x2cdad6[_0xee7b('0x54')]){_0x2cdad6['body'][_0xee7b('0x3c')]=widgetAttributes(_0x2cdad6[_0xee7b('0x54')]);}return db['DashboardItem'][_0xee7b('0x53')](_0x2cdad6[_0xee7b('0x54')],{})[_0xee7b('0x27')](respondWithResult(_0x22e458,0xc9))[_0xee7b('0x3a')](handleError(_0x22e458,null));};exports[_0xee7b('0x55')]=function(_0x38f803,_0x883081){if(_0x38f803[_0xee7b('0x54')]['id']){delete _0x38f803[_0xee7b('0x54')]['id'];}_0x38f803[_0xee7b('0x54')][_0xee7b('0x3c')]=widgetAttributes(_0x38f803['body']);return db[_0xee7b('0x38')][_0xee7b('0x37')]({'where':{'id':_0x38f803[_0xee7b('0x39')]['id']}})[_0xee7b('0x27')](handleEntityNotFound(_0x883081,null))[_0xee7b('0x27')](saveUpdates(_0x38f803[_0xee7b('0x54')],null))[_0xee7b('0x27')](respondWithResult(_0x883081,null))[_0xee7b('0x3a')](handleError(_0x883081,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index ec1e2f2..bc9bd9c 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 _0x1ab8=['remove','emit','hasOwnProperty','hook','../../mysqldb','DashboardItem','update'];(function(_0x2e46c4,_0xa6838e){var _0x4a2f37=function(_0x418e30){while(--_0x418e30){_0x2e46c4['push'](_0x2e46c4['shift']());}};_0x4a2f37(++_0xa6838e);}(_0x1ab8,0xa5));var _0x81ab=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1ab8[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x81ab('0x0'))['db'][_0x81ab('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x81ab('0x2'),'afterDestroy':_0x81ab('0x3')};function emitEvent(_0x76ceda){return function(_0x1b7a5c,_0x2fb580,_0x506d2f){DashboardItemEvents[_0x81ab('0x4')](_0x76ceda+':'+_0x1b7a5c['id'],_0x1b7a5c);DashboardItemEvents[_0x81ab('0x4')](_0x76ceda,_0x1b7a5c);_0x506d2f(null);};}for(var e in events){if(events[_0x81ab('0x5')](e)){var event=events[e];DashboardItem[_0x81ab('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x3d05=['DashboardItem','save','remove','emit','exports','events'];(function(_0x44ca90,_0x3144a0){var _0x535a44=function(_0x5cf870){while(--_0x5cf870){_0x44ca90['push'](_0x44ca90['shift']());}};_0x535a44(++_0x3144a0);}(_0x3d05,0x185));var _0x53d0=function(_0x419b6a,_0x265b43){_0x419b6a=_0x419b6a-0x0;var _0x229232=_0x3d05[_0x419b6a];return _0x229232;};'use strict';var EventEmitter=require(_0x53d0('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x53d0('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x53d0('0x2'),'afterUpdate':'update','afterDestroy':_0x53d0('0x3')};function emitEvent(_0x4f11db){return function(_0x55e671,_0x4f3907,_0x141cc4){DashboardItemEvents[_0x53d0('0x4')](_0x4f11db+':'+_0x55e671['id'],_0x55e671);DashboardItemEvents['emit'](_0x4f11db,_0x55e671);_0x141cc4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x53d0('0x5')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 5579fba..fcf1cdc 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 _0x0725=['api','moment','request-promise','path','rimraf','./dashboardItem.attributes','exports','util'];(function(_0x1edc08,_0x326fa4){var _0x4c8faf=function(_0xec5a2a){while(--_0xec5a2a){_0x1edc08['push'](_0x1edc08['shift']());}};_0x4c8faf(++_0x326fa4);}(_0x0725,0x167));var _0x5072=function(_0x344cf5,_0x38dd7e){_0x344cf5=_0x344cf5-0x0;var _0x50a26c=_0x0725[_0x344cf5];return _0x50a26c;};'use strict';var _=require('lodash');var util=require(_0x5072('0x0'));var logger=require('../../config/logger')(_0x5072('0x1'));var moment=require(_0x5072('0x2'));var BPromise=require('bluebird');var rp=require(_0x5072('0x3'));var fs=require('fs');var path=require(_0x5072('0x4'));var rimraf=require(_0x5072('0x5'));var config=require('../../config/environment');var attributes=require(_0x5072('0x6'));module[_0x5072('0x7')]=function(_0x1954ea,_0x4a62a0){return _0x1954ea['define']('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d79=['bluebird','request-promise','path','rimraf','../../config/environment','define','dashboard_items','lodash','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d79,0x125));var _0x98d7=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x8d79[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0x98d7('0x0'));var util=require(_0x98d7('0x1'));var logger=require(_0x98d7('0x2'))('api');var moment=require(_0x98d7('0x3'));var BPromise=require(_0x98d7('0x4'));var rp=require(_0x98d7('0x5'));var fs=require('fs');var path=require(_0x98d7('0x6'));var rimraf=require(_0x98d7('0x7'));var config=require(_0x98d7('0x8'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x583b77,_0x5a844b){return _0x583b77[_0x98d7('0x9')]('DashboardItem',attributes,{'tableName':_0x98d7('0xa'),'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 a46fa44..c978939 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 _0xd292=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x7c16d6,_0x32069a){var _0x27417a=function(_0x1b90e1){while(--_0x1b90e1){_0x7c16d6['push'](_0x7c16d6['shift']());}};_0x27417a(++_0x32069a);}(_0xd292,0x188));var _0x2d29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd292[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2d29('0x0'));var util=require(_0x2d29('0x1'));var moment=require(_0x2d29('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d29('0x4'))['db'];var utils=require(_0x2d29('0x5'));var logger=require(_0x2d29('0x6'))(_0x2d29('0x7'));var config=require('../../config/environment');var jayson=require(_0x2d29('0x8'));var client=jayson[_0x2d29('0x9')][_0x2d29('0xa')]({'port':0x232a});config[_0x2d29('0xb')]=_[_0x2d29('0xc')](config[_0x2d29('0xb')],{'host':_0x2d29('0xd'),'port':0x18eb});var socket=require(_0x2d29('0xe'))(new Redis(config[_0x2d29('0xb')]));require(_0x2d29('0xf'))['register'](socket);function respondWithRpcPromise(_0x5c3844,_0x432771,_0x245d23){return new BPromise(function(_0x450e91,_0x389677){return client['request'](_0x5c3844,_0x245d23)[_0x2d29('0x10')](function(_0x422842){logger[_0x2d29('0x11')](_0x2d29('0x12'),_0x432771,'request\x20sent');logger[_0x2d29('0x13')](_0x2d29('0x14'),_0x432771,_0x2d29('0x15'),JSON[_0x2d29('0x16')](_0x422842));if(_0x422842[_0x2d29('0x17')]){if(_0x422842[_0x2d29('0x17')][_0x2d29('0x18')]===0x1f4){logger[_0x2d29('0x17')](_0x2d29('0x12'),_0x432771,_0x422842['error'][_0x2d29('0x19')]);return _0x389677(_0x422842[_0x2d29('0x17')][_0x2d29('0x19')]);}logger[_0x2d29('0x17')](_0x2d29('0x12'),_0x432771,_0x422842[_0x2d29('0x17')]['message']);return _0x450e91(_0x422842['error'][_0x2d29('0x19')]);}else{logger[_0x2d29('0x11')]('DashboardItem,\x20%s,\x20%s',_0x432771,_0x2d29('0x15'));_0x450e91(_0x422842[_0x2d29('0x1a')]['message']);}})[_0x2d29('0x1b')](function(_0xeaca14){logger[_0x2d29('0x17')]('DashboardItem,\x20%s,\x20%s',_0x432771,_0xeaca14);_0x389677(_0xeaca14);});});} \ No newline at end of file +var _0x4058=['then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request'];(function(_0x178d95,_0x5880c1){var _0x55688c=function(_0x481551){while(--_0x481551){_0x178d95['push'](_0x178d95['shift']());}};_0x55688c(++_0x5880c1);}(_0x4058,0x1d4));var _0x8405=function(_0x3f518d,_0x3ad15e){_0x3f518d=_0x3f518d-0x0;var _0x21400e=_0x4058[_0x3f518d];return _0x21400e;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8405('0x2'))['db'];var utils=require(_0x8405('0x3'));var logger=require(_0x8405('0x4'))(_0x8405('0x5'));var config=require('../../config/environment');var jayson=require(_0x8405('0x6'));var client=jayson['client'][_0x8405('0x7')]({'port':0x232a});config[_0x8405('0x8')]=_[_0x8405('0x9')](config[_0x8405('0x8')],{'host':_0x8405('0xa'),'port':0x18eb});var socket=require(_0x8405('0xb'))(new Redis(config[_0x8405('0x8')]));require(_0x8405('0xc'))[_0x8405('0xd')](socket);function respondWithRpcPromise(_0x3905e7,_0x12052e,_0x29d835){return new BPromise(function(_0x3e24a2,_0x551f69){return client[_0x8405('0xe')](_0x3905e7,_0x29d835)[_0x8405('0xf')](function(_0x4ae067){logger[_0x8405('0x10')](_0x8405('0x11'),_0x12052e,_0x8405('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x12052e,_0x8405('0x12'),JSON[_0x8405('0x13')](_0x4ae067));if(_0x4ae067[_0x8405('0x14')]){if(_0x4ae067[_0x8405('0x14')]['code']===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x12052e,_0x4ae067[_0x8405('0x14')]['message']);return _0x551f69(_0x4ae067[_0x8405('0x14')][_0x8405('0x15')]);}logger[_0x8405('0x14')](_0x8405('0x11'),_0x12052e,_0x4ae067['error'][_0x8405('0x15')]);return _0x3e24a2(_0x4ae067[_0x8405('0x14')][_0x8405('0x15')]);}else{logger[_0x8405('0x10')](_0x8405('0x11'),_0x12052e,_0x8405('0x12'));_0x3e24a2(_0x4ae067['result'][_0x8405('0x15')]);}})[_0x8405('0x16')](function(_0x1a4dba){logger['error'](_0x8405('0x11'),_0x12052e,_0x1a4dba);_0x551f69(_0x1a4dba);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 4807364..bb835d7 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 _0x991f=['update','removeListener','register','length','dashboardItem:','save','remove'];(function(_0x39f9de,_0x51b2f2){var _0x389ecb=function(_0x476bf4){while(--_0x476bf4){_0x39f9de['push'](_0x39f9de['shift']());}};_0x389ecb(++_0x51b2f2);}(_0x991f,0xfa));var _0xf991=function(_0x5993ea,_0x49cac4){_0x5993ea=_0x5993ea-0x0;var _0x149c1b=_0x991f[_0x5993ea];return _0x149c1b;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xf991('0x0'),_0xf991('0x1'),_0xf991('0x2')];function createListener(_0x231935,_0x224200){return function(_0x5abd39){_0x224200['emit'](_0x231935,_0x5abd39);};}function removeListener(_0x50650b,_0x227a9f){return function(){DashboardItemEvents[_0xf991('0x3')](_0x50650b,_0x227a9f);};}exports[_0xf991('0x4')]=function(_0x3b4cfb){for(var _0x5511a1=0x0,_0x53d6ce=events[_0xf991('0x5')];_0x5511a1<_0x53d6ce;_0x5511a1++){var _0xe0ed08=events[_0x5511a1];var _0x2aa0df=createListener(_0xf991('0x6')+_0xe0ed08,_0x3b4cfb);DashboardItemEvents['on'](_0xe0ed08,_0x2aa0df);}}; \ No newline at end of file +var _0xc62e=['remove','update','emit','removeListener','register','length','save'];(function(_0x203cc5,_0x185a86){var _0xe224b1=function(_0x22d57a){while(--_0x22d57a){_0x203cc5['push'](_0x203cc5['shift']());}};_0xe224b1(++_0x185a86);}(_0xc62e,0x109));var _0xec62=function(_0x5cc9e4,_0x2d1a8f){_0x5cc9e4=_0x5cc9e4-0x0;var _0x3914df=_0xc62e[_0x5cc9e4];return _0x3914df;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xec62('0x0'),_0xec62('0x1'),_0xec62('0x2')];function createListener(_0x3834b0,_0x19cb0d){return function(_0x4f4855){_0x19cb0d[_0xec62('0x3')](_0x3834b0,_0x4f4855);};}function removeListener(_0xcbf4a8,_0x179470){return function(){DashboardItemEvents[_0xec62('0x4')](_0xcbf4a8,_0x179470);};}exports[_0xec62('0x5')]=function(_0xbcc4d0){for(var _0x252b1c=0x0,_0x6e676b=events[_0xec62('0x6')];_0x252b1c<_0x6e676b;_0x252b1c++){var _0x474668=events[_0x252b1c];var _0x264a1d=createListener('dashboardItem:'+_0x474668,_0xbcc4d0);DashboardItemEvents['on'](_0x474668,_0x264a1d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 40fad5e..b941019 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 _0x53ce=['./dashboardItem.controller','get','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x4de945,_0x2d4c16){var _0x579a7e=function(_0x270238){while(--_0x270238){_0x4de945['push'](_0x4de945['shift']());}};_0x579a7e(++_0x2d4c16);}(_0x53ce,0xc6));var _0xe53c=function(_0x24b1d5,_0x4dc057){_0x24b1d5=_0x24b1d5-0x0;var _0x4e2fb7=_0x53ce[_0x24b1d5];return _0x4e2fb7;};'use strict';var multer=require(_0xe53c('0x0'));var util=require(_0xe53c('0x1'));var path=require('path');var timeout=require(_0xe53c('0x2'));var express=require('express');var router=express[_0xe53c('0x3')]();var fs_extra=require(_0xe53c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe53c('0x5'));var config=require('../../config/environment');var controller=require(_0xe53c('0x6'));router[_0xe53c('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe53c('0x8')]('/',auth[_0xe53c('0x9')](),controller[_0xe53c('0xa')]);router[_0xe53c('0xb')](_0xe53c('0xc'),auth[_0xe53c('0x9')](),controller[_0xe53c('0xd')]);router[_0xe53c('0xe')](_0xe53c('0xc'),auth[_0xe53c('0x9')](),controller[_0xe53c('0xf')]);module[_0xe53c('0x10')]=router; \ No newline at end of file +var _0x7a5d=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','/:id','isAuthenticated','show','create','update'];(function(_0x3e900b,_0x376796){var _0x59c846=function(_0x4efa61){while(--_0x4efa61){_0x3e900b['push'](_0x3e900b['shift']());}};_0x59c846(++_0x376796);}(_0x7a5d,0x83));var _0xd7a5=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7a5d[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0xd7a5('0x0'));var util=require('util');var path=require(_0xd7a5('0x1'));var timeout=require(_0xd7a5('0x2'));var express=require(_0xd7a5('0x3'));var router=express[_0xd7a5('0x4')]();var fs_extra=require(_0xd7a5('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd7a5('0x6'));var controller=require('./dashboardItem.controller');router[_0xd7a5('0x7')](_0xd7a5('0x8'),auth[_0xd7a5('0x9')](),controller[_0xd7a5('0xa')]);router['post']('/',auth[_0xd7a5('0x9')](),controller[_0xd7a5('0xb')]);router['put'](_0xd7a5('0x8'),auth[_0xd7a5('0x9')](),controller[_0xd7a5('0xc')]);router[_0xd7a5('0xd')](_0xd7a5('0x8'),auth[_0xd7a5('0x9')](),controller[_0xd7a5('0xe')]);module[_0xd7a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index d9ed2a3..c05157c 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 _0xbd5a=['ENUM','first','second','sequelize','exports','STRING'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0xbd5a,0xc3));var _0xabd5=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xbd5a[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0xabd5('0x0'));module[_0xabd5('0x1')]={'name':{'type':Sequelize[_0xabd5('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xabd5('0x3')](_0xabd5('0x4'),_0xabd5('0x5'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7cde=['sequelize','exports','STRING','first'];(function(_0x1dc53e,_0x1acbce){var _0x3abbbf=function(_0x33fd53){while(--_0x33fd53){_0x1dc53e['push'](_0x1dc53e['shift']());}};_0x3abbbf(++_0x1acbce);}(_0x7cde,0xe8));var _0xe7cd=function(_0x489fca,_0x4b1055){_0x489fca=_0x489fca-0x0;var _0x5ac34e=_0x7cde[_0x489fca];return _0x5ac34e;};'use strict';var Sequelize=require(_0xe7cd('0x0'));module[_0xe7cd('0x1')]={'name':{'type':Sequelize[_0xe7cd('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xe7cd('0x3'),'second','third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xe7cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index d417721..a36a446 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 _0xfb82=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Disposition','include','findAll','rows','catch','params','rawAttributes','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query'];(function(_0xc733ac,_0x179905){var _0x448a79=function(_0x5ed708){while(--_0x5ed708){_0xc733ac['push'](_0xc733ac['shift']());}};_0x448a79(++_0x179905);}(_0xfb82,0x17f));var _0x2fb8=function(_0x7694a0,_0x2d6a8e){_0x7694a0=_0x7694a0-0x0;var _0x3ef50a=_0xfb82[_0x7694a0];return _0x3ef50a;};'use strict';var emlformat=require(_0x2fb8('0x0'));var rimraf=require(_0x2fb8('0x1'));var zipdir=require(_0x2fb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fb8('0x3'));var moment=require(_0x2fb8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2fb8('0x5'));var util=require(_0x2fb8('0x6'));var path=require(_0x2fb8('0x7'));var sox=require(_0x2fb8('0x8'));var csv=require(_0x2fb8('0x9'));var ejs=require(_0x2fb8('0xa'));var fs=require('fs');var fs_extra=require(_0x2fb8('0xb'));var _=require(_0x2fb8('0xc'));var squel=require(_0x2fb8('0xd'));var crypto=require(_0x2fb8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2fb8('0xf'));var toCsv=require(_0x2fb8('0x9'));var querystring=require(_0x2fb8('0x10'));var Papa=require(_0x2fb8('0x11'));var Redis=require(_0x2fb8('0x12'));var authService=require(_0x2fb8('0x13'));var qs=require(_0x2fb8('0x14'));var as=require(_0x2fb8('0x15'));var hardwareService=require(_0x2fb8('0x16'));var logger=require(_0x2fb8('0x17'))(_0x2fb8('0x18'));var utils=require('../../config/utils');var config=require(_0x2fb8('0x19'));var licenseUtil=require(_0x2fb8('0x1a'));var db=require(_0x2fb8('0x1b'))['db'];function respondWithStatusCode(_0xab96fc,_0x54cc1d){_0x54cc1d=_0x54cc1d||0xcc;return function(_0x58d8ff){if(_0x58d8ff){return _0xab96fc[_0x2fb8('0x1c')](_0x54cc1d);}return _0xab96fc['status'](_0x54cc1d)[_0x2fb8('0x1d')]();};}function respondWithResult(_0x4e70f9,_0x5cb3ec){_0x5cb3ec=_0x5cb3ec||0xc8;return function(_0x222e0d){if(_0x222e0d){return _0x4e70f9[_0x2fb8('0x1e')](_0x5cb3ec)['json'](_0x222e0d);}};}function respondWithFilteredResult(_0x59f271,_0x205dd8){return function(_0x392d31){if(_0x392d31){var _0x3fa923=typeof _0x205dd8[_0x2fb8('0x1f')]==='undefined'&&typeof _0x205dd8[_0x2fb8('0x20')]===_0x2fb8('0x21');var _0x48296c=_0x392d31[_0x2fb8('0x22')];var _0x40d128=_0x3fa923?0x0:_0x205dd8[_0x2fb8('0x1f')];var _0x524c14=_0x3fa923?_0x392d31['count']:_0x205dd8[_0x2fb8('0x1f')]+_0x205dd8[_0x2fb8('0x20')];var _0x428292;if(_0x524c14>=_0x48296c){_0x524c14=_0x48296c;_0x428292=0xc8;}else{_0x428292=0xce;}_0x59f271[_0x2fb8('0x1e')](_0x428292);return _0x59f271['set'](_0x2fb8('0x23'),_0x40d128+'-'+_0x524c14+'/'+_0x48296c)[_0x2fb8('0x24')](_0x392d31);}return null;};}function patchUpdates(_0x1aa17e){return function(_0x18f5ed){try{jsonpatch[_0x2fb8('0x25')](_0x18f5ed,_0x1aa17e,!![]);}catch(_0x5ea296){return BPromise[_0x2fb8('0x26')](_0x5ea296);}return _0x18f5ed[_0x2fb8('0x27')]();};}function saveUpdates(_0x3890f3,_0x564fb3){return function(_0x4a4576){if(_0x4a4576){return _0x4a4576[_0x2fb8('0x28')](_0x3890f3)[_0x2fb8('0x29')](function(_0x1ea35b){return _0x1ea35b;});}return null;};}function removeEntity(_0x2f8cc9,_0x475883){return function(_0x4d6a94){if(_0x4d6a94){return _0x4d6a94[_0x2fb8('0x2a')]()[_0x2fb8('0x29')](function(){var _0x3f3399=_0x4d6a94[_0x2fb8('0x2b')]({'plain':!![]});var _0x3bfc46=_0x2fb8('0x2c');return db[_0x2fb8('0x2d')]['destroy']({'where':{'type':_0x3bfc46,'resourceId':_0x3f3399['id']}})[_0x2fb8('0x29')](function(){return _0x4d6a94;});})['then'](function(){_0x2f8cc9[_0x2fb8('0x1e')](0xcc)[_0x2fb8('0x1d')]();});}};}function handleEntityNotFound(_0x77bdc2,_0x3b86de){return function(_0x2054c9){if(!_0x2054c9){_0x77bdc2[_0x2fb8('0x1c')](0x194);}return _0x2054c9;};}function handleError(_0x98892e,_0x1a3394){_0x1a3394=_0x1a3394||0x1f4;return function(_0x4f9adf){logger[_0x2fb8('0x2e')](_0x4f9adf[_0x2fb8('0x2f')]);if(_0x4f9adf[_0x2fb8('0x30')]){delete _0x4f9adf[_0x2fb8('0x30')];}_0x98892e[_0x2fb8('0x1e')](_0x1a3394)[_0x2fb8('0x31')](_0x4f9adf);};}exports[_0x2fb8('0x32')]=function(_0x556cc0,_0x50d06c){var _0x24fce9={},_0x148418={},_0x50c07d={'count':0x0,'rows':[]};var _0x5d6930=_[_0x2fb8('0x33')](db['Disposition']['rawAttributes'],function(_0xd3e701){return{'name':_0xd3e701[_0x2fb8('0x34')],'type':_0xd3e701[_0x2fb8('0x35')][_0x2fb8('0x36')]};});_0x148418[_0x2fb8('0x37')]=_[_0x2fb8('0x33')](_0x5d6930,_0x2fb8('0x30'));_0x148418[_0x2fb8('0x38')]=_['keys'](_0x556cc0['query']);_0x148418[_0x2fb8('0x39')]=_[_0x2fb8('0x3a')](_0x148418[_0x2fb8('0x37')],_0x148418[_0x2fb8('0x38')]);_0x24fce9[_0x2fb8('0x3b')]=_[_0x2fb8('0x3a')](_0x148418[_0x2fb8('0x37')],qs['fields'](_0x556cc0[_0x2fb8('0x38')][_0x2fb8('0x3c')]));_0x24fce9[_0x2fb8('0x3b')]=_0x24fce9[_0x2fb8('0x3b')][_0x2fb8('0x3d')]?_0x24fce9[_0x2fb8('0x3b')]:_0x148418[_0x2fb8('0x37')];if(!_0x556cc0['query'][_0x2fb8('0x3e')](_0x2fb8('0x3f'))){_0x24fce9[_0x2fb8('0x20')]=qs['limit'](_0x556cc0[_0x2fb8('0x38')][_0x2fb8('0x20')]);_0x24fce9[_0x2fb8('0x1f')]=qs[_0x2fb8('0x1f')](_0x556cc0[_0x2fb8('0x38')]['offset']);}_0x24fce9[_0x2fb8('0x40')]=qs[_0x2fb8('0x41')](_0x556cc0['query']['sort']);_0x24fce9[_0x2fb8('0x42')]=qs[_0x2fb8('0x39')](_[_0x2fb8('0x43')](_0x556cc0['query'],_0x148418[_0x2fb8('0x39')]),_0x5d6930);if(_0x556cc0['query'][_0x2fb8('0x44')]){_0x24fce9[_0x2fb8('0x42')]=_[_0x2fb8('0x45')](_0x24fce9[_0x2fb8('0x42')],{'$or':_[_0x2fb8('0x33')](_0x5d6930,function(_0x124c7c){if(_0x124c7c['type']!=='VIRTUAL'){var _0x3b7a8d={};_0x3b7a8d[_0x124c7c[_0x2fb8('0x30')]]={'$like':'%'+_0x556cc0[_0x2fb8('0x38')][_0x2fb8('0x44')]+'%'};return _0x3b7a8d;}})});}_0x24fce9=_[_0x2fb8('0x45')]({},_0x24fce9,_0x556cc0[_0x2fb8('0x46')]);var _0x4a9ae6={'where':_0x24fce9[_0x2fb8('0x42')]};return db[_0x2fb8('0x47')][_0x2fb8('0x22')](_0x4a9ae6)[_0x2fb8('0x29')](function(_0x1585c8){_0x50c07d['count']=_0x1585c8;if(_0x556cc0['query']['includeAll']){_0x24fce9[_0x2fb8('0x48')]=[{'all':!![]}];}return db['Disposition'][_0x2fb8('0x49')](_0x24fce9);})['then'](function(_0x381bb9){_0x50c07d[_0x2fb8('0x4a')]=_0x381bb9;return _0x50c07d;})[_0x2fb8('0x29')](respondWithFilteredResult(_0x50d06c,_0x24fce9))[_0x2fb8('0x4b')](handleError(_0x50d06c,null));};exports['show']=function(_0x313eb5,_0x237119){var _0x495c91={'raw':!![],'where':{'id':_0x313eb5[_0x2fb8('0x4c')]['id']}},_0x17d967={};_0x17d967[_0x2fb8('0x37')]=_['keys'](db[_0x2fb8('0x47')][_0x2fb8('0x4d')]);_0x17d967['query']=_[_0x2fb8('0x4e')](_0x313eb5[_0x2fb8('0x38')]);_0x17d967[_0x2fb8('0x39')]=_[_0x2fb8('0x3a')](_0x17d967[_0x2fb8('0x37')],_0x17d967[_0x2fb8('0x38')]);_0x495c91[_0x2fb8('0x3b')]=_['intersection'](_0x17d967[_0x2fb8('0x37')],qs['fields'](_0x313eb5[_0x2fb8('0x38')][_0x2fb8('0x3c')]));_0x495c91[_0x2fb8('0x3b')]=_0x495c91['attributes'][_0x2fb8('0x3d')]?_0x495c91[_0x2fb8('0x3b')]:_0x17d967[_0x2fb8('0x37')];if(_0x313eb5[_0x2fb8('0x38')][_0x2fb8('0x4f')]){_0x495c91[_0x2fb8('0x48')]=[{'all':!![]}];}_0x495c91=_[_0x2fb8('0x45')]({},_0x495c91,_0x313eb5[_0x2fb8('0x46')]);return db[_0x2fb8('0x47')][_0x2fb8('0x50')](_0x495c91)[_0x2fb8('0x29')](handleEntityNotFound(_0x237119,null))[_0x2fb8('0x29')](respondWithResult(_0x237119,null))[_0x2fb8('0x4b')](handleError(_0x237119,null));};exports[_0x2fb8('0x51')]=function(_0x1f0d7a,_0x166090){return db[_0x2fb8('0x47')]['create'](_0x1f0d7a[_0x2fb8('0x52')],{})[_0x2fb8('0x29')](function(_0x38f9bb){var _0xd2ee31=_0x1f0d7a['user'][_0x2fb8('0x2b')]({'plain':!![]});if(!_0xd2ee31)throw new Error(_0x2fb8('0x53'));if(_0xd2ee31['role']===_0x2fb8('0x54')){var _0x5d7f08=_0x38f9bb[_0x2fb8('0x2b')]({'plain':!![]});var _0x2feb11=_0x2fb8('0x2c');return db[_0x2fb8('0x55')][_0x2fb8('0x50')]({'where':{'name':_0x2feb11,'userProfileId':_0xd2ee31[_0x2fb8('0x56')]},'raw':!![]})['then'](function(_0x48eafc){if(_0x48eafc&&_0x48eafc[_0x2fb8('0x57')]===0x0){return db['UserProfileResource'][_0x2fb8('0x51')]({'name':_0x5d7f08[_0x2fb8('0x30')],'resourceId':_0x5d7f08['id'],'type':_0x48eafc[_0x2fb8('0x30')],'sectionId':_0x48eafc['id']},{})['then'](function(){return _0x38f9bb;});}else{return _0x38f9bb;}})['catch'](function(_0x276e83){logger[_0x2fb8('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x276e83);throw _0x276e83;});}return _0x38f9bb;})[_0x2fb8('0x29')](respondWithResult(_0x166090,0xc9))[_0x2fb8('0x4b')](handleError(_0x166090,null));};exports['update']=function(_0x1c5e9a,_0xac8544){if(_0x1c5e9a[_0x2fb8('0x52')]['id']){delete _0x1c5e9a[_0x2fb8('0x52')]['id'];}return db[_0x2fb8('0x47')][_0x2fb8('0x50')]({'where':{'id':_0x1c5e9a[_0x2fb8('0x4c')]['id']}})[_0x2fb8('0x29')](handleEntityNotFound(_0xac8544,null))[_0x2fb8('0x29')](saveUpdates(_0x1c5e9a[_0x2fb8('0x52')],null))[_0x2fb8('0x29')](respondWithResult(_0xac8544,null))['catch'](handleError(_0xac8544,null));};exports['destroy']=function(_0x4436a0,_0x1e7be2){return db[_0x2fb8('0x47')][_0x2fb8('0x50')]({'where':{'id':_0x4436a0[_0x2fb8('0x4c')]['id']}})[_0x2fb8('0x29')](handleEntityNotFound(_0x1e7be2,null))[_0x2fb8('0x29')](removeEntity(_0x1e7be2,null))['catch'](handleError(_0x1e7be2,null));}; \ No newline at end of file +var _0x0999=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','Disposition','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','include','catch','show','params','length','merge','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','eml-format','zip-dir','request-promise'];(function(_0x48f7cf,_0x4baa04){var _0xc201c0=function(_0x23ff34){while(--_0x23ff34){_0x48f7cf['push'](_0x48f7cf['shift']());}};_0xc201c0(++_0x4baa04);}(_0x0999,0xa5));var _0x9099=function(_0x2ecb67,_0x8ec62d){_0x2ecb67=_0x2ecb67-0x0;var _0x168079=_0x0999[_0x2ecb67];return _0x168079;};'use strict';var emlformat=require(_0x9099('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9099('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9099('0x2'));var moment=require('moment');var BPromise=require(_0x9099('0x3'));var Mustache=require(_0x9099('0x4'));var util=require(_0x9099('0x5'));var path=require(_0x9099('0x6'));var sox=require(_0x9099('0x7'));var csv=require(_0x9099('0x8'));var ejs=require(_0x9099('0x9'));var fs=require('fs');var fs_extra=require(_0x9099('0xa'));var _=require(_0x9099('0xb'));var squel=require(_0x9099('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9099('0xd'));var toCsv=require(_0x9099('0x8'));var querystring=require('querystring');var Papa=require(_0x9099('0xe'));var Redis=require(_0x9099('0xf'));var authService=require(_0x9099('0x10'));var qs=require(_0x9099('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9099('0x12'));var logger=require(_0x9099('0x13'))(_0x9099('0x14'));var utils=require(_0x9099('0x15'));var config=require(_0x9099('0x16'));var licenseUtil=require(_0x9099('0x17'));var db=require(_0x9099('0x18'))['db'];function respondWithStatusCode(_0xdf629b,_0x17f89b){_0x17f89b=_0x17f89b||0xcc;return function(_0x5b6ba1){if(_0x5b6ba1){return _0xdf629b[_0x9099('0x19')](_0x17f89b);}return _0xdf629b[_0x9099('0x1a')](_0x17f89b)['end']();};}function respondWithResult(_0xd49b1e,_0x25afea){_0x25afea=_0x25afea||0xc8;return function(_0x5b33aa){if(_0x5b33aa){return _0xd49b1e[_0x9099('0x1a')](_0x25afea)['json'](_0x5b33aa);}};}function respondWithFilteredResult(_0x5477a5,_0x47b93a){return function(_0x12194c){if(_0x12194c){var _0x85a049=typeof _0x47b93a[_0x9099('0x1b')]===_0x9099('0x1c')&&typeof _0x47b93a['limit']===_0x9099('0x1c');var _0x3900d7=_0x12194c['count'];var _0x187d84=_0x85a049?0x0:_0x47b93a['offset'];var _0x2a1a96=_0x85a049?_0x12194c[_0x9099('0x1d')]:_0x47b93a['offset']+_0x47b93a[_0x9099('0x1e')];var _0x409470;if(_0x2a1a96>=_0x3900d7){_0x2a1a96=_0x3900d7;_0x409470=0xc8;}else{_0x409470=0xce;}_0x5477a5['status'](_0x409470);return _0x5477a5['set'](_0x9099('0x1f'),_0x187d84+'-'+_0x2a1a96+'/'+_0x3900d7)[_0x9099('0x20')](_0x12194c);}return null;};}function patchUpdates(_0x424f53){return function(_0x466667){try{jsonpatch[_0x9099('0x21')](_0x466667,_0x424f53,!![]);}catch(_0x1e97ea){return BPromise['reject'](_0x1e97ea);}return _0x466667[_0x9099('0x22')]();};}function saveUpdates(_0x4fda23,_0x5b434c){return function(_0x284fa9){if(_0x284fa9){return _0x284fa9[_0x9099('0x23')](_0x4fda23)[_0x9099('0x24')](function(_0x49dc7a){return _0x49dc7a;});}return null;};}function removeEntity(_0x379d1c,_0x1affbf){return function(_0x5f2fb1){if(_0x5f2fb1){return _0x5f2fb1[_0x9099('0x25')]()[_0x9099('0x24')](function(){var _0x176d6e=_0x5f2fb1['get']({'plain':!![]});var _0x545d7c='Dispositions';return db['UserProfileResource'][_0x9099('0x25')]({'where':{'type':_0x545d7c,'resourceId':_0x176d6e['id']}})[_0x9099('0x24')](function(){return _0x5f2fb1;});})[_0x9099('0x24')](function(){_0x379d1c['status'](0xcc)[_0x9099('0x26')]();});}};}function handleEntityNotFound(_0x287eb7,_0x328756){return function(_0x1b195c){if(!_0x1b195c){_0x287eb7[_0x9099('0x19')](0x194);}return _0x1b195c;};}function handleError(_0x2c803f,_0x45294c){_0x45294c=_0x45294c||0x1f4;return function(_0x359a51){logger[_0x9099('0x27')](_0x359a51[_0x9099('0x28')]);if(_0x359a51['name']){delete _0x359a51[_0x9099('0x29')];}_0x2c803f['status'](_0x45294c)[_0x9099('0x2a')](_0x359a51);};}exports[_0x9099('0x2b')]=function(_0x3c47a2,_0x38135c){var _0x1d700a={},_0x57148d={},_0x1f4259={'count':0x0,'rows':[]};var _0x16c9a3=_['map'](db[_0x9099('0x2c')][_0x9099('0x2d')],function(_0x40176b){return{'name':_0x40176b[_0x9099('0x2e')],'type':_0x40176b['type']['key']};});_0x57148d['model']=_[_0x9099('0x2f')](_0x16c9a3,_0x9099('0x29'));_0x57148d['query']=_[_0x9099('0x30')](_0x3c47a2[_0x9099('0x31')]);_0x57148d[_0x9099('0x32')]=_[_0x9099('0x33')](_0x57148d[_0x9099('0x34')],_0x57148d['query']);_0x1d700a[_0x9099('0x35')]=_[_0x9099('0x33')](_0x57148d[_0x9099('0x34')],qs['fields'](_0x3c47a2['query'][_0x9099('0x36')]));_0x1d700a['attributes']=_0x1d700a[_0x9099('0x35')]['length']?_0x1d700a['attributes']:_0x57148d[_0x9099('0x34')];if(!_0x3c47a2['query'][_0x9099('0x37')](_0x9099('0x38'))){_0x1d700a[_0x9099('0x1e')]=qs[_0x9099('0x1e')](_0x3c47a2[_0x9099('0x31')][_0x9099('0x1e')]);_0x1d700a[_0x9099('0x1b')]=qs[_0x9099('0x1b')](_0x3c47a2[_0x9099('0x31')][_0x9099('0x1b')]);}_0x1d700a[_0x9099('0x39')]=qs[_0x9099('0x3a')](_0x3c47a2[_0x9099('0x31')][_0x9099('0x3a')]);_0x1d700a['where']=qs['filters'](_[_0x9099('0x3b')](_0x3c47a2[_0x9099('0x31')],_0x57148d[_0x9099('0x32')]),_0x16c9a3);if(_0x3c47a2[_0x9099('0x31')][_0x9099('0x3c')]){_0x1d700a[_0x9099('0x3d')]=_['merge'](_0x1d700a[_0x9099('0x3d')],{'$or':_[_0x9099('0x2f')](_0x16c9a3,function(_0x262c62){if(_0x262c62[_0x9099('0x3e')]!==_0x9099('0x3f')){var _0x202fdb={};_0x202fdb[_0x262c62['name']]={'$like':'%'+_0x3c47a2[_0x9099('0x31')]['filter']+'%'};return _0x202fdb;}})});}_0x1d700a=_['merge']({},_0x1d700a,_0x3c47a2[_0x9099('0x40')]);var _0x6cddf2={'where':_0x1d700a[_0x9099('0x3d')]};return db[_0x9099('0x2c')][_0x9099('0x1d')](_0x6cddf2)[_0x9099('0x24')](function(_0x56a94d){_0x1f4259['count']=_0x56a94d;if(_0x3c47a2[_0x9099('0x31')][_0x9099('0x41')]){_0x1d700a[_0x9099('0x42')]=[{'all':!![]}];}return db[_0x9099('0x2c')]['findAll'](_0x1d700a);})['then'](function(_0x588550){_0x1f4259['rows']=_0x588550;return _0x1f4259;})[_0x9099('0x24')](respondWithFilteredResult(_0x38135c,_0x1d700a))[_0x9099('0x43')](handleError(_0x38135c,null));};exports[_0x9099('0x44')]=function(_0x501e45,_0x4a468d){var _0x235850={'raw':!![],'where':{'id':_0x501e45[_0x9099('0x45')]['id']}},_0x345194={};_0x345194['model']=_['keys'](db[_0x9099('0x2c')][_0x9099('0x2d')]);_0x345194['query']=_[_0x9099('0x30')](_0x501e45[_0x9099('0x31')]);_0x345194[_0x9099('0x32')]=_[_0x9099('0x33')](_0x345194[_0x9099('0x34')],_0x345194[_0x9099('0x31')]);_0x235850[_0x9099('0x35')]=_[_0x9099('0x33')](_0x345194[_0x9099('0x34')],qs[_0x9099('0x36')](_0x501e45[_0x9099('0x31')][_0x9099('0x36')]));_0x235850[_0x9099('0x35')]=_0x235850['attributes'][_0x9099('0x46')]?_0x235850[_0x9099('0x35')]:_0x345194[_0x9099('0x34')];if(_0x501e45[_0x9099('0x31')]['includeAll']){_0x235850[_0x9099('0x42')]=[{'all':!![]}];}_0x235850=_[_0x9099('0x47')]({},_0x235850,_0x501e45[_0x9099('0x40')]);return db[_0x9099('0x2c')][_0x9099('0x48')](_0x235850)[_0x9099('0x24')](handleEntityNotFound(_0x4a468d,null))[_0x9099('0x24')](respondWithResult(_0x4a468d,null))['catch'](handleError(_0x4a468d,null));};exports[_0x9099('0x49')]=function(_0x5a91c2,_0x497314){return db['Disposition'][_0x9099('0x49')](_0x5a91c2['body'],{})[_0x9099('0x24')](function(_0x1bd32d){var _0x15e2dc=_0x5a91c2[_0x9099('0x4a')][_0x9099('0x4b')]({'plain':!![]});if(!_0x15e2dc)throw new Error(_0x9099('0x4c'));if(_0x15e2dc[_0x9099('0x4d')]===_0x9099('0x4a')){var _0x5978f4=_0x1bd32d[_0x9099('0x4b')]({'plain':!![]});var _0x179ea9=_0x9099('0x4e');return db[_0x9099('0x4f')]['find']({'where':{'name':_0x179ea9,'userProfileId':_0x15e2dc[_0x9099('0x50')]},'raw':!![]})[_0x9099('0x24')](function(_0x57a79b){if(_0x57a79b&&_0x57a79b[_0x9099('0x51')]===0x0){return db[_0x9099('0x52')][_0x9099('0x49')]({'name':_0x5978f4[_0x9099('0x29')],'resourceId':_0x5978f4['id'],'type':_0x57a79b['name'],'sectionId':_0x57a79b['id']},{})['then'](function(){return _0x1bd32d;});}else{return _0x1bd32d;}})[_0x9099('0x43')](function(_0x4347fa){logger[_0x9099('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4347fa);throw _0x4347fa;});}return _0x1bd32d;})[_0x9099('0x24')](respondWithResult(_0x497314,0xc9))['catch'](handleError(_0x497314,null));};exports[_0x9099('0x23')]=function(_0x1b4354,_0x52c704){if(_0x1b4354[_0x9099('0x53')]['id']){delete _0x1b4354[_0x9099('0x53')]['id'];}return db[_0x9099('0x2c')][_0x9099('0x48')]({'where':{'id':_0x1b4354[_0x9099('0x45')]['id']}})['then'](handleEntityNotFound(_0x52c704,null))[_0x9099('0x24')](saveUpdates(_0x1b4354[_0x9099('0x53')],null))['then'](respondWithResult(_0x52c704,null))['catch'](handleError(_0x52c704,null));};exports[_0x9099('0x25')]=function(_0x463c78,_0x42d54f){return db['Disposition'][_0x9099('0x48')]({'where':{'id':_0x463c78[_0x9099('0x45')]['id']}})[_0x9099('0x24')](handleEntityNotFound(_0x42d54f,null))[_0x9099('0x24')](removeEntity(_0x42d54f,null))[_0x9099('0x43')](handleError(_0x42d54f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ca51092..c784fdf 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 _0x25e1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger','api'];(function(_0x4a608c,_0x6f950f){var _0x2749c3=function(_0x50ccef){while(--_0x50ccef){_0x4a608c['push'](_0x4a608c['shift']());}};_0x2749c3(++_0x6f950f);}(_0x25e1,0xd4));var _0x125e=function(_0x272b42,_0x1ccd6f){_0x272b42=_0x272b42-0x0;var _0xd7bc8b=_0x25e1[_0x272b42];return _0xd7bc8b;};'use strict';var _=require(_0x125e('0x0'));var util=require(_0x125e('0x1'));var logger=require(_0x125e('0x2'))(_0x125e('0x3'));var moment=require(_0x125e('0x4'));var BPromise=require(_0x125e('0x5'));var rp=require(_0x125e('0x6'));var fs=require('fs');var path=require(_0x125e('0x7'));var rimraf=require(_0x125e('0x8'));var config=require(_0x125e('0x9'));var attributes=require(_0x125e('0xa'));module[_0x125e('0xb')]=function(_0xc10154,_0x42a932){return _0xc10154['define'](_0x125e('0xc'),attributes,{'tableName':_0x125e('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x125e('0xe'),'fields':[_0x125e('0xf'),'ListId']},{'unique':!![],'name':_0x125e('0x10'),'fields':[_0x125e('0xf'),_0x125e('0x11')]},{'unique':!![],'name':'name_mail','fields':[_0x125e('0xf'),_0x125e('0x12')]},{'unique':!![],'name':_0x125e('0x13'),'fields':[_0x125e('0xf'),_0x125e('0x14')]},{'unique':!![],'name':'name_fax','fields':[_0x125e('0xf'),_0x125e('0x15')]},{'unique':!![],'name':_0x125e('0x16'),'fields':[_0x125e('0xf'),_0x125e('0x17')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x125e('0xf'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe73=['name_whatsapp','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','define','tools_dispositions','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0xbe73,0x18d));var _0x3be7=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0xbe73[_0x261b8a];return _0x3455e8;};'use strict';var _=require(_0x3be7('0x0'));var util=require(_0x3be7('0x1'));var logger=require(_0x3be7('0x2'))('api');var moment=require(_0x3be7('0x3'));var BPromise=require(_0x3be7('0x4'));var rp=require(_0x3be7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3be7('0x6'));var config=require(_0x3be7('0x7'));var attributes=require(_0x3be7('0x8'));module['exports']=function(_0x556aef,_0x1f4b7d){return _0x556aef[_0x3be7('0x9')]('Disposition',attributes,{'tableName':_0x3be7('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x3be7('0xb'),_0x3be7('0xc')]},{'unique':!![],'name':'name_chat','fields':['name',_0x3be7('0xd')]},{'unique':!![],'name':_0x3be7('0xe'),'fields':[_0x3be7('0xb'),_0x3be7('0xf')]},{'unique':!![],'name':_0x3be7('0x10'),'fields':[_0x3be7('0xb'),_0x3be7('0x11')]},{'unique':!![],'name':_0x3be7('0x12'),'fields':[_0x3be7('0xb'),'FaxAccountId']},{'unique':!![],'name':_0x3be7('0x13'),'fields':[_0x3be7('0xb'),_0x3be7('0x14')]},{'unique':!![],'name':_0x3be7('0x15'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 0542448..f88c8e4 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(_0x1dc36e,_0x199891){var _0x3968f0=function(_0xe9d222){while(--_0xe9d222){_0x1dc36e['push'](_0x1dc36e['shift']());}};_0x3968f0(++_0x199891);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0xc130c1,_0x3169c7){var _0x8488ad=function(_0x5147b6){while(--_0x5147b6){_0xc130c1['push'](_0xc130c1['shift']());}};_0x8488ad(++_0x3169c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 a05264a..90400e2 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 _0x4f4d=['Router','../../components/interaction/service','./disposition.controller','isAuthenticated','index','get','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f4d,0x1c6));var _0xd4f4=function(_0x590da5,_0x298084){_0x590da5=_0x590da5-0x0;var _0x54d4c4=_0x4f4d[_0x590da5];return _0x54d4c4;};'use strict';var multer=require(_0xd4f4('0x0'));var util=require(_0xd4f4('0x1'));var path=require(_0xd4f4('0x2'));var timeout=require(_0xd4f4('0x3'));var express=require(_0xd4f4('0x4'));var router=express[_0xd4f4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd4f4('0x6'));var config=require('../../config/environment');var controller=require(_0xd4f4('0x7'));router['get']('/',auth[_0xd4f4('0x8')](),controller[_0xd4f4('0x9')]);router[_0xd4f4('0xa')](_0xd4f4('0xb'),auth['isAuthenticated'](),controller[_0xd4f4('0xc')]);router['post']('/',auth[_0xd4f4('0x8')](),controller['create']);router['put']('/:id',auth[_0xd4f4('0x8')](),controller[_0xd4f4('0xd')]);router[_0xd4f4('0xe')](_0xd4f4('0xb'),auth[_0xd4f4('0x8')](),controller[_0xd4f4('0xf')]);module[_0xd4f4('0x10')]=router; \ No newline at end of file +var _0x786b=['create','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x2a9f1d,_0x454517){var _0x5e0f4d=function(_0x5f3dfc){while(--_0x5f3dfc){_0x2a9f1d['push'](_0x2a9f1d['shift']());}};_0x5e0f4d(++_0x454517);}(_0x786b,0x111));var _0xb786=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x786b[_0x67f95e];return _0x538f5a;};'use strict';var multer=require(_0xb786('0x0'));var util=require(_0xb786('0x1'));var path=require('path');var timeout=require(_0xb786('0x2'));var express=require(_0xb786('0x3'));var router=express[_0xb786('0x4')]();var fs_extra=require(_0xb786('0x5'));var auth=require(_0xb786('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb786('0x7'));var controller=require(_0xb786('0x8'));router[_0xb786('0x9')]('/',auth['isAuthenticated'](),controller[_0xb786('0xa')]);router[_0xb786('0x9')](_0xb786('0xb'),auth[_0xb786('0xc')](),controller[_0xb786('0xd')]);router[_0xb786('0xe')]('/',auth[_0xb786('0xc')](),controller[_0xb786('0xf')]);router['put'](_0xb786('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xb786('0x10')](_0xb786('0xb'),auth[_0xb786('0xc')](),controller['destroy']);module[_0xb786('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 2345710..284aabe 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 _0xd606=['exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize'];(function(_0x471566,_0x4b8a79){var _0x162279=function(_0x231e7f){while(--_0x231e7f){_0x471566['push'](_0x471566['shift']());}};_0x162279(++_0x4b8a79);}(_0xd606,0xbf));var _0x6d60=function(_0x7e1554,_0x514d85){_0x7e1554=_0x7e1554-0x0;var _0x4002cf=_0xd606[_0x7e1554];return _0x4002cf;};'use strict';var Sequelize=require(_0x6d60('0x0'));module[_0x6d60('0x1')]={'name':{'type':Sequelize[_0x6d60('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x6d60('0x3')](_0x6d60('0x4'),'no'),'defaultValue':_0x6d60('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x6d60('0x5')},'localstationid':{'type':Sequelize[_0x6d60('0x2')],'unique':_0x6d60('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x6d60('0x7'),_0x6d60('0x8'),_0x6d60('0x9'),_0x6d60('0xa'),_0x6d60('0xb'),'14400'),'defaultValue':_0x6d60('0x8')},'maxrate':{'type':Sequelize[_0x6d60('0x3')](_0x6d60('0x7'),_0x6d60('0x8'),_0x6d60('0x9'),_0x6d60('0xa'),_0x6d60('0xb'),_0x6d60('0xc')),'defaultValue':_0x6d60('0xc')},'modem':{'type':Sequelize[_0x6d60('0x2')],'defaultValue':_0x6d60('0xd')},'gateway':{'type':Sequelize[_0x6d60('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6d60('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6d60('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x6d60('0xf'),_0x6d60('0x10'),_0x6d60('0x11'),_0x6d60('0x12')),'defaultValue':_0x6d60('0xf')},'key':{'type':Sequelize[_0x6d60('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6d60('0x13')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6d60('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6d60('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6d60('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6d60('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6d60('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6d60('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6d60('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x6d60('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x6d60('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x35486b){if(!_0x35486b)this[_0x6d60('0x16')](_0x6d60('0x17'),null);this[_0x6d60('0x16')]('mandatoryDisposition',_0x35486b);}}}; \ No newline at end of file +var _0xb48d=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','9600','14400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x503ea8,_0x22e391){var _0x427e5d=function(_0x1484e8){while(--_0x1484e8){_0x503ea8['push'](_0x503ea8['shift']());}};_0x427e5d(++_0x22e391);}(_0xb48d,0xfe));var _0xdb48=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb48d[_0xc67528];return _0x38e26d;};'use strict';var Sequelize=require(_0xdb48('0x0'));module[_0xdb48('0x1')]={'name':{'type':Sequelize[_0xdb48('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdb48('0x2')]},'ecm':{'type':Sequelize[_0xdb48('0x3')](_0xdb48('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xdb48('0x2')],'defaultValue':_0xdb48('0x5')},'localstationid':{'type':Sequelize[_0xdb48('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xdb48('0x3')](_0xdb48('0x6'),_0xdb48('0x7'),'7200',_0xdb48('0x8'),'12000',_0xdb48('0x9')),'defaultValue':_0xdb48('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0xdb48('0x6'),'4800','7200',_0xdb48('0x8'),_0xdb48('0xa'),'14400'),'defaultValue':_0xdb48('0x9')},'modem':{'type':Sequelize[_0xdb48('0x2')],'defaultValue':_0xdb48('0xb')},'gateway':{'type':Sequelize[_0xdb48('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xdb48('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xdb48('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xdb48('0x3')](_0xdb48('0xd'),_0xdb48('0xe'),_0xdb48('0xf'),_0xdb48('0x10')),'defaultValue':_0xdb48('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdb48('0x11');}},'notificationSound':{'type':Sequelize[_0xdb48('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdb48('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdb48('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdb48('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdb48('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdb48('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xdb48('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x341c9d){if(!_0x341c9d)this[_0xdb48('0x14')]('mandatoryDispositionPauseId',null);this[_0xdb48('0x14')]('mandatoryDisposition',_0x341c9d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 34bb858..73b5768 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 _0x1cdc=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','FaxAccount','include','catch','show','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','join','root','CheckAfterSend','isNil','from','format','ListId','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','emit','userFaxAccount:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra'];(function(_0x5bdebf,_0x1f1be1){var _0x51a85b=function(_0x29d7bb){while(--_0x29d7bb){_0x5bdebf['push'](_0x5bdebf['shift']());}};_0x51a85b(++_0x1f1be1);}(_0x1cdc,0x178));var _0xc1cd=function(_0x2a303f,_0x4dc898){_0x2a303f=_0x2a303f-0x0;var _0x30324c=_0x1cdc[_0x2a303f];return _0x30324c;};'use strict';var emlformat=require(_0xc1cd('0x0'));var rimraf=require(_0xc1cd('0x1'));var zipdir=require(_0xc1cd('0x2'));var jsonpatch=require(_0xc1cd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc1cd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc1cd('0x5'));var sox=require(_0xc1cd('0x6'));var csv=require(_0xc1cd('0x7'));var ejs=require(_0xc1cd('0x8'));var fs=require('fs');var fs_extra=require(_0xc1cd('0x9'));var _=require(_0xc1cd('0xa'));var squel=require(_0xc1cd('0xb'));var crypto=require(_0xc1cd('0xc'));var jsforce=require(_0xc1cd('0xd'));var deskjs=require(_0xc1cd('0xe'));var toCsv=require(_0xc1cd('0x7'));var querystring=require(_0xc1cd('0xf'));var Papa=require(_0xc1cd('0x10'));var Redis=require(_0xc1cd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc1cd('0x12'));var as=require(_0xc1cd('0x13'));var hardwareService=require(_0xc1cd('0x14'));var logger=require('../../config/logger')(_0xc1cd('0x15'));var utils=require(_0xc1cd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc1cd('0x17'));var db=require(_0xc1cd('0x18'))['db'];config[_0xc1cd('0x19')]=_[_0xc1cd('0x1a')](config[_0xc1cd('0x19')],{'host':_0xc1cd('0x1b'),'port':0x18eb});var socket=require(_0xc1cd('0x1c'))(new Redis(config[_0xc1cd('0x19')]));require('./faxAccount.socket')[_0xc1cd('0x1d')](socket);var jayson=require(_0xc1cd('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc1cd('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e941f,_0x3a309e,_0x23a636,_0x47899d){return new BPromise(function(_0x5c2c6f,_0x1903b1){var _0x346e15=_0x47899d||client;return _0x346e15[_0xc1cd('0x20')](_0x4e941f,_0x23a636)[_0xc1cd('0x21')](function(_0x20e1db){logger[_0xc1cd('0x22')]('FaxAccount,\x20%s,\x20%s',_0x3a309e,_0xc1cd('0x23'));logger[_0xc1cd('0x24')](_0xc1cd('0x25'),_0x3a309e,_0xc1cd('0x23'),JSON[_0xc1cd('0x26')](_0x20e1db));if(_0x20e1db['error']){if(_0x20e1db[_0xc1cd('0x27')][_0xc1cd('0x28')]===0x1f4){logger[_0xc1cd('0x27')](_0xc1cd('0x29'),_0x3a309e,_0x20e1db[_0xc1cd('0x27')][_0xc1cd('0x2a')]);return _0x1903b1(_0x20e1db[_0xc1cd('0x27')][_0xc1cd('0x2a')]);}logger['error'](_0xc1cd('0x29'),_0x3a309e,_0x20e1db[_0xc1cd('0x27')][_0xc1cd('0x2a')]);return _0x5c2c6f(_0x20e1db['error'][_0xc1cd('0x2a')]);}else{logger[_0xc1cd('0x22')](_0xc1cd('0x29'),_0x3a309e,_0xc1cd('0x23'));_0x5c2c6f(_0x20e1db['result'][_0xc1cd('0x2a')]);}})['catch'](function(_0x1f36cd){logger[_0xc1cd('0x27')]('FaxAccount,\x20%s,\x20%s',_0x3a309e,_0x1f36cd);_0x1903b1(_0x1f36cd);});});}function respondWithStatusCode(_0x1ff073,_0x5d394e){_0x5d394e=_0x5d394e||0xcc;return function(_0x1d484b){if(_0x1d484b){return _0x1ff073[_0xc1cd('0x2b')](_0x5d394e);}return _0x1ff073[_0xc1cd('0x2c')](_0x5d394e)[_0xc1cd('0x2d')]();};}function respondWithResult(_0x2aac39,_0x4db2e4){_0x4db2e4=_0x4db2e4||0xc8;return function(_0x36fe19){if(_0x36fe19){return _0x2aac39['status'](_0x4db2e4)[_0xc1cd('0x2e')](_0x36fe19);}};}function respondWithFilteredResult(_0x41a695,_0x4a802d){return function(_0x316884){if(_0x316884){var _0x405e04=typeof _0x4a802d[_0xc1cd('0x2f')]==='undefined'&&typeof _0x4a802d['limit']===_0xc1cd('0x30');var _0xa78472=_0x316884[_0xc1cd('0x31')];var _0x168e81=_0x405e04?0x0:_0x4a802d[_0xc1cd('0x2f')];var _0x298670=_0x405e04?_0x316884[_0xc1cd('0x31')]:_0x4a802d[_0xc1cd('0x2f')]+_0x4a802d[_0xc1cd('0x32')];var _0x4caa8b;if(_0x298670>=_0xa78472){_0x298670=_0xa78472;_0x4caa8b=0xc8;}else{_0x4caa8b=0xce;}_0x41a695[_0xc1cd('0x2c')](_0x4caa8b);return _0x41a695['set'](_0xc1cd('0x33'),_0x168e81+'-'+_0x298670+'/'+_0xa78472)[_0xc1cd('0x2e')](_0x316884);}return null;};}function patchUpdates(_0x14238c){return function(_0x559504){try{jsonpatch[_0xc1cd('0x34')](_0x559504,_0x14238c,!![]);}catch(_0x508475){return BPromise[_0xc1cd('0x35')](_0x508475);}return _0x559504[_0xc1cd('0x36')]();};}function saveUpdates(_0x15f2ad,_0x53d2d4){return function(_0xf9f71e){if(_0xf9f71e){return _0xf9f71e[_0xc1cd('0x37')](_0x15f2ad)[_0xc1cd('0x21')](function(_0x386828){return _0x386828;});}return null;};}function removeEntity(_0x554f36,_0x7012c9){return function(_0x3fa99e){if(_0x3fa99e){return _0x3fa99e[_0xc1cd('0x38')]()['then'](function(){var _0x249657=_0x3fa99e[_0xc1cd('0x39')]({'plain':!![]});var _0x11e346='FaxAccounts';return db[_0xc1cd('0x3a')]['destroy']({'where':{'type':_0x11e346,'resourceId':_0x249657['id']}})[_0xc1cd('0x21')](function(){return _0x3fa99e;});})[_0xc1cd('0x21')](function(){_0x554f36['status'](0xcc)[_0xc1cd('0x2d')]();});}};}function handleEntityNotFound(_0x487f16,_0xa09b91){return function(_0x48bec3){if(!_0x48bec3){_0x487f16[_0xc1cd('0x2b')](0x194);}return _0x48bec3;};}function handleError(_0x74b7c7,_0x2dbf64){_0x2dbf64=_0x2dbf64||0x1f4;return function(_0x1b849c){logger[_0xc1cd('0x27')](_0x1b849c[_0xc1cd('0x3b')]);if(_0x1b849c['name']){delete _0x1b849c[_0xc1cd('0x3c')];}_0x74b7c7[_0xc1cd('0x2c')](_0x2dbf64)[_0xc1cd('0x3d')](_0x1b849c);};}exports[_0xc1cd('0x3e')]=function(_0x5645a3,_0x53a808){var _0x114add={'include':[{'model':db[_0xc1cd('0x3f')],'as':_0xc1cd('0x40')}]},_0x36da47={},_0x2580b3={'count':0x0,'rows':[]};var _0x3190bf=_[_0xc1cd('0x41')](db['FaxAccount'][_0xc1cd('0x42')],function(_0x1e302b){return{'name':_0x1e302b[_0xc1cd('0x43')],'type':_0x1e302b[_0xc1cd('0x44')][_0xc1cd('0x45')]};});_0x36da47[_0xc1cd('0x46')]=_[_0xc1cd('0x41')](_0x3190bf,_0xc1cd('0x3c'));_0x36da47[_0xc1cd('0x47')]=_['keys'](_0x5645a3[_0xc1cd('0x47')]);_0x36da47[_0xc1cd('0x48')]=_[_0xc1cd('0x49')](_0x36da47['model'],_0x36da47['query']);_0x114add[_0xc1cd('0x4a')]=_[_0xc1cd('0x49')](_0x36da47[_0xc1cd('0x46')],qs[_0xc1cd('0x4b')](_0x5645a3[_0xc1cd('0x47')][_0xc1cd('0x4b')]));_0x114add['attributes']=_0x114add[_0xc1cd('0x4a')][_0xc1cd('0x4c')]?_0x114add[_0xc1cd('0x4a')]:_0x36da47[_0xc1cd('0x46')];if(!_0x5645a3[_0xc1cd('0x47')]['hasOwnProperty'](_0xc1cd('0x4d'))){_0x114add['limit']=qs[_0xc1cd('0x32')](_0x5645a3[_0xc1cd('0x47')][_0xc1cd('0x32')]);_0x114add[_0xc1cd('0x2f')]=qs[_0xc1cd('0x2f')](_0x5645a3[_0xc1cd('0x47')][_0xc1cd('0x2f')]);}_0x114add['order']=qs[_0xc1cd('0x4e')](_0x5645a3['query'][_0xc1cd('0x4e')]);_0x114add[_0xc1cd('0x4f')]=qs[_0xc1cd('0x48')](_[_0xc1cd('0x50')](_0x5645a3[_0xc1cd('0x47')],_0x36da47['filters']),_0x3190bf);if(_0x5645a3[_0xc1cd('0x47')][_0xc1cd('0x51')]){_0x114add[_0xc1cd('0x4f')]=_['merge'](_0x114add[_0xc1cd('0x4f')],{'$or':_[_0xc1cd('0x41')](_0x3190bf,function(_0x2f2545){if(_0x2f2545[_0xc1cd('0x44')]!==_0xc1cd('0x52')){var _0x32c758={};_0x32c758[_0x2f2545[_0xc1cd('0x3c')]]={'$like':'%'+_0x5645a3[_0xc1cd('0x47')][_0xc1cd('0x51')]+'%'};return _0x32c758;}})});}_0x114add=_[_0xc1cd('0x53')]({},_0x114add,_0x5645a3[_0xc1cd('0x54')]);var _0x1a3eac={'where':_0x114add[_0xc1cd('0x4f')]};return db[_0xc1cd('0x55')][_0xc1cd('0x31')](_0x1a3eac)[_0xc1cd('0x21')](function(_0x521f96){_0x2580b3[_0xc1cd('0x31')]=_0x521f96;if(_0x5645a3['query']['includeAll']){_0x114add[_0xc1cd('0x56')]=[{'all':!![]}];}return db[_0xc1cd('0x55')]['findAll'](_0x114add);})[_0xc1cd('0x21')](function(_0x47ef70){_0x2580b3['rows']=_0x47ef70;return _0x2580b3;})[_0xc1cd('0x21')](respondWithFilteredResult(_0x53a808,_0x114add))[_0xc1cd('0x57')](handleError(_0x53a808,null));};exports[_0xc1cd('0x58')]=function(_0x5c4eff,_0x1fbd69){var _0x38d2a9={'raw':![],'where':{'id':_0x5c4eff['params']['id']},'include':[{'model':db[_0xc1cd('0x3f')],'as':_0xc1cd('0x40')}]},_0x70c1de={};_0x70c1de[_0xc1cd('0x46')]=_['keys'](db['FaxAccount'][_0xc1cd('0x42')]);_0x70c1de['query']=_[_0xc1cd('0x59')](_0x5c4eff['query']);_0x70c1de[_0xc1cd('0x48')]=_[_0xc1cd('0x49')](_0x70c1de[_0xc1cd('0x46')],_0x70c1de[_0xc1cd('0x47')]);_0x38d2a9[_0xc1cd('0x4a')]=_['intersection'](_0x70c1de[_0xc1cd('0x46')],qs['fields'](_0x5c4eff['query'][_0xc1cd('0x4b')]));_0x38d2a9['attributes']=_0x38d2a9[_0xc1cd('0x4a')]['length']?_0x38d2a9[_0xc1cd('0x4a')]:_0x70c1de[_0xc1cd('0x46')];if(_0x5c4eff[_0xc1cd('0x47')][_0xc1cd('0x5a')]){_0x38d2a9[_0xc1cd('0x56')]=[{'all':!![]}];}_0x38d2a9=_[_0xc1cd('0x53')]({},_0x38d2a9,_0x5c4eff[_0xc1cd('0x54')]);return db[_0xc1cd('0x55')][_0xc1cd('0x5b')](_0x38d2a9)['then'](handleEntityNotFound(_0x1fbd69,null))['then'](respondWithResult(_0x1fbd69,null))[_0xc1cd('0x57')](handleError(_0x1fbd69,null));};exports[_0xc1cd('0x5c')]=function(_0xc46ab9,_0x5c0fad){return db[_0xc1cd('0x55')]['create'](_0xc46ab9[_0xc1cd('0x5d')],{})[_0xc1cd('0x21')](function(_0x582222){var _0x1a12cf=_0xc46ab9[_0xc1cd('0x5e')][_0xc1cd('0x39')]({'plain':!![]});if(!_0x1a12cf)throw new Error(_0xc1cd('0x5f'));if(_0x1a12cf['role']===_0xc1cd('0x5e')){var _0x3489d7=_0x582222[_0xc1cd('0x39')]({'plain':!![]});var _0x3d0e79=_0xc1cd('0x60');return db['UserProfileSection'][_0xc1cd('0x5b')]({'where':{'name':_0x3d0e79,'userProfileId':_0x1a12cf[_0xc1cd('0x61')]},'raw':!![]})['then'](function(_0x432442){if(_0x432442&&_0x432442['autoAssociation']===0x0){return db[_0xc1cd('0x3a')]['create']({'name':_0x3489d7['name'],'resourceId':_0x3489d7['id'],'type':_0x432442[_0xc1cd('0x3c')],'sectionId':_0x432442['id']},{})[_0xc1cd('0x21')](function(){return _0x582222;});}else{return _0x582222;}})[_0xc1cd('0x57')](function(_0x2685c9){logger[_0xc1cd('0x27')](_0xc1cd('0x62'),_0x2685c9);throw _0x2685c9;});}return _0x582222;})[_0xc1cd('0x21')](respondWithResult(_0x5c0fad,0xc9))[_0xc1cd('0x57')](handleError(_0x5c0fad,null));};exports[_0xc1cd('0x37')]=function(_0x48e503,_0x34926e){if(_0x48e503['body']['id']){delete _0x48e503[_0xc1cd('0x5d')]['id'];}return db[_0xc1cd('0x55')]['find']({'where':{'id':_0x48e503[_0xc1cd('0x63')]['id']},'include':[{'model':db['Pause'],'as':_0xc1cd('0x40')}]})['then'](handleEntityNotFound(_0x34926e,null))[_0xc1cd('0x21')](saveUpdates(_0x48e503['body'],null))[_0xc1cd('0x21')](respondWithResult(_0x34926e,null))[_0xc1cd('0x57')](handleError(_0x34926e,null));};exports['destroy']=function(_0x39f2b1,_0x5841d7){return db[_0xc1cd('0x55')][_0xc1cd('0x5b')]({'where':{'id':_0x39f2b1['params']['id']}})[_0xc1cd('0x21')](handleEntityNotFound(_0x5841d7,null))[_0xc1cd('0x21')](removeEntity(_0x5841d7,null))['catch'](handleError(_0x5841d7,null));};exports[_0xc1cd('0x64')]=function(_0x3a9ceb,_0x80aaa6){return db[_0xc1cd('0x55')][_0xc1cd('0x64')]()[_0xc1cd('0x21')](respondWithResult(_0x80aaa6,null))[_0xc1cd('0x57')](handleError(_0x80aaa6,null));};exports[_0xc1cd('0x65')]=function(_0x4372b7,_0x26f00d,_0x6edffd){if(_0x4372b7[_0xc1cd('0x5d')]['id']){delete _0x4372b7[_0xc1cd('0x5d')]['id'];}return db[_0xc1cd('0x55')][_0xc1cd('0x5b')]({'where':{'id':_0x4372b7['params']['id']}})[_0xc1cd('0x21')](handleEntityNotFound(_0x26f00d,null))[_0xc1cd('0x21')](function(_0x1bb02c){if(_0x1bb02c){_0x4372b7[_0xc1cd('0x5d')][_0xc1cd('0x66')]=_0x1bb02c['id'];return db[_0xc1cd('0x67')][_0xc1cd('0x5c')](_0x4372b7[_0xc1cd('0x5d')]);}})[_0xc1cd('0x21')](respondWithResult(_0x26f00d,null))[_0xc1cd('0x57')](handleError(_0x26f00d,null));};exports[_0xc1cd('0x68')]=function(_0x423e01,_0x440d59,_0x37cff6){var _0x165f59={'raw':![],'where':{}};var _0x16a431={};var _0x28f656={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc1cd('0x69')]({'where':{'id':_0x423e01[_0xc1cd('0x63')]['id']}})['then'](handleEntityNotFound(_0x440d59,null))[_0xc1cd('0x21')](function(_0x38def5){if(_0x38def5){_0x16a431[_0xc1cd('0x46')]=_['keys'](db[_0xc1cd('0x67')][_0xc1cd('0x42')]);_0x16a431[_0xc1cd('0x47')]=_[_0xc1cd('0x59')](_0x423e01[_0xc1cd('0x47')]);_0x16a431[_0xc1cd('0x48')]=_[_0xc1cd('0x49')](_0x16a431[_0xc1cd('0x46')],_0x16a431[_0xc1cd('0x47')]);_0x165f59[_0xc1cd('0x4a')]=_['intersection'](_0x16a431[_0xc1cd('0x46')],qs['fields'](_0x423e01[_0xc1cd('0x47')][_0xc1cd('0x4b')]));_0x165f59[_0xc1cd('0x4a')]=_0x165f59[_0xc1cd('0x4a')][_0xc1cd('0x4c')]?_0x165f59[_0xc1cd('0x4a')]:_0x16a431[_0xc1cd('0x46')];if(!_0x423e01['query'][_0xc1cd('0x6a')](_0xc1cd('0x4d'))){_0x165f59[_0xc1cd('0x32')]=qs[_0xc1cd('0x32')](_0x423e01[_0xc1cd('0x47')][_0xc1cd('0x32')]);_0x165f59[_0xc1cd('0x2f')]=qs[_0xc1cd('0x2f')](_0x423e01[_0xc1cd('0x47')]['offset']);}_0x165f59[_0xc1cd('0x6b')]=qs['sort'](_0x423e01[_0xc1cd('0x47')]['sort']);_0x165f59[_0xc1cd('0x4f')]=qs['filters'](_[_0xc1cd('0x50')](_0x423e01[_0xc1cd('0x47')],_0x16a431['filters']));_0x165f59[_0xc1cd('0x4f')][_0xc1cd('0x66')]=_0x38def5['id'];if(_0x423e01[_0xc1cd('0x47')]['filter']){_0x165f59[_0xc1cd('0x4f')]=_[_0xc1cd('0x53')](_0x165f59[_0xc1cd('0x4f')],{'$or':_[_0xc1cd('0x41')](_0x165f59[_0xc1cd('0x4a')],function(_0xf3c14c){var _0x24732b={};_0x24732b[_0xf3c14c]={'$like':'%'+_0x423e01['query'][_0xc1cd('0x51')]+'%'};return _0x24732b;})});}_0x165f59=_[_0xc1cd('0x53')]({},_0x165f59,_0x423e01[_0xc1cd('0x54')]);return db['Disposition'][_0xc1cd('0x31')]({'where':_0x165f59['where']})[_0xc1cd('0x21')](function(_0x3831d5){_0x28f656['count']=_0x3831d5;if(_0x423e01[_0xc1cd('0x47')][_0xc1cd('0x5a')]){_0x165f59[_0xc1cd('0x56')]=[{'all':!![]}];}return db[_0xc1cd('0x67')][_0xc1cd('0x6c')](_0x165f59);})[_0xc1cd('0x21')](function(_0x1bc2ac){_0x28f656[_0xc1cd('0x6d')]=_0x1bc2ac;return _0x28f656;});}})[_0xc1cd('0x21')](respondWithFilteredResult(_0x440d59,_0x165f59))[_0xc1cd('0x57')](handleError(_0x440d59,null));};exports[_0xc1cd('0x6e')]=function(_0x4e17a3,_0x59b9ca,_0x5efbfb){return db[_0xc1cd('0x55')][_0xc1cd('0x5b')]({'where':{'id':_0x4e17a3[_0xc1cd('0x63')]['id']}})[_0xc1cd('0x21')](handleEntityNotFound(_0x59b9ca,null))[_0xc1cd('0x21')](function(_0x36f0a1){if(_0x36f0a1){return _0x36f0a1[_0xc1cd('0x6e')](_0x4e17a3[_0xc1cd('0x47')][_0xc1cd('0x6f')]);}})[_0xc1cd('0x21')](respondWithStatusCode(_0x59b9ca,null))[_0xc1cd('0x57')](handleError(_0x59b9ca,null));};exports[_0xc1cd('0x70')]=function(_0x42635f,_0x3b06f6,_0x178f32){if(_0x42635f[_0xc1cd('0x5d')]['id']){delete _0x42635f[_0xc1cd('0x5d')]['id'];}return db[_0xc1cd('0x55')]['find']({'where':{'id':_0x42635f['params']['id']}})['then'](handleEntityNotFound(_0x3b06f6,null))['then'](function(_0x242fa4){if(_0x242fa4){_0x42635f[_0xc1cd('0x5d')]['FaxAccountId']=_0x242fa4['id'];return db[_0xc1cd('0x71')]['create'](_0x42635f[_0xc1cd('0x5d')]);}})[_0xc1cd('0x21')](respondWithResult(_0x3b06f6,null))[_0xc1cd('0x57')](handleError(_0x3b06f6,null));};exports[_0xc1cd('0x72')]=function(_0x501d30,_0x2ba4e7,_0x308c97){var _0x226ab7={'raw':![],'where':{}};var _0x4675e6={};var _0x2e5832={'count':0x0,'rows':[]};return db[_0xc1cd('0x55')][_0xc1cd('0x69')]({'where':{'id':_0x501d30[_0xc1cd('0x63')]['id']}})['then'](handleEntityNotFound(_0x2ba4e7,null))[_0xc1cd('0x21')](function(_0x43c4b5){if(_0x43c4b5){_0x4675e6['model']=_['keys'](db['CannedAnswer'][_0xc1cd('0x42')]);_0x4675e6[_0xc1cd('0x47')]=_['keys'](_0x501d30[_0xc1cd('0x47')]);_0x4675e6[_0xc1cd('0x48')]=_[_0xc1cd('0x49')](_0x4675e6['model'],_0x4675e6[_0xc1cd('0x47')]);_0x226ab7[_0xc1cd('0x4a')]=_[_0xc1cd('0x49')](_0x4675e6[_0xc1cd('0x46')],qs[_0xc1cd('0x4b')](_0x501d30['query']['fields']));_0x226ab7[_0xc1cd('0x4a')]=_0x226ab7[_0xc1cd('0x4a')][_0xc1cd('0x4c')]?_0x226ab7['attributes']:_0x4675e6['model'];if(!_0x501d30[_0xc1cd('0x47')]['hasOwnProperty'](_0xc1cd('0x4d'))){_0x226ab7[_0xc1cd('0x32')]=qs[_0xc1cd('0x32')](_0x501d30['query'][_0xc1cd('0x32')]);_0x226ab7['offset']=qs['offset'](_0x501d30[_0xc1cd('0x47')][_0xc1cd('0x2f')]);}_0x226ab7[_0xc1cd('0x6b')]=qs['sort'](_0x501d30[_0xc1cd('0x47')]['sort']);_0x226ab7[_0xc1cd('0x4f')]=qs[_0xc1cd('0x48')](_['pick'](_0x501d30[_0xc1cd('0x47')],_0x4675e6[_0xc1cd('0x48')]));_0x226ab7[_0xc1cd('0x4f')][_0xc1cd('0x66')]=_0x43c4b5['id'];if(_0x501d30[_0xc1cd('0x47')][_0xc1cd('0x51')]){_0x226ab7['where']=_[_0xc1cd('0x53')](_0x226ab7[_0xc1cd('0x4f')],{'$or':_[_0xc1cd('0x41')](_0x226ab7[_0xc1cd('0x4a')],function(_0x540870){var _0x16680d={};_0x16680d[_0x540870]={'$like':'%'+_0x501d30['query'][_0xc1cd('0x51')]+'%'};return _0x16680d;})});}_0x226ab7=_[_0xc1cd('0x53')]({},_0x226ab7,_0x501d30[_0xc1cd('0x54')]);return db[_0xc1cd('0x71')]['count']({'where':_0x226ab7[_0xc1cd('0x4f')]})[_0xc1cd('0x21')](function(_0x40b4e1){_0x2e5832[_0xc1cd('0x31')]=_0x40b4e1;if(_0x501d30[_0xc1cd('0x47')]['includeAll']){_0x226ab7[_0xc1cd('0x56')]=[{'all':!![]}];}return db[_0xc1cd('0x71')][_0xc1cd('0x6c')](_0x226ab7);})[_0xc1cd('0x21')](function(_0x240da8){_0x2e5832[_0xc1cd('0x6d')]=_0x240da8;return _0x2e5832;});}})[_0xc1cd('0x21')](respondWithFilteredResult(_0x2ba4e7,_0x226ab7))[_0xc1cd('0x57')](handleError(_0x2ba4e7,null));};exports[_0xc1cd('0x73')]=function(_0x3229ee,_0x26e468,_0x4c920d){return db[_0xc1cd('0x55')]['find']({'where':{'id':_0x3229ee['params']['id']}})['then'](handleEntityNotFound(_0x26e468,null))['then'](function(_0x24b800){if(_0x24b800){return _0x24b800[_0xc1cd('0x73')](_0x3229ee[_0xc1cd('0x47')][_0xc1cd('0x6f')]);}})[_0xc1cd('0x21')](respondWithStatusCode(_0x26e468,null))[_0xc1cd('0x57')](handleError(_0x26e468,null));};exports[_0xc1cd('0x74')]=function(_0x41bfdd,_0x52ef1a,_0x464fc6){return db['FaxInteraction'][_0xc1cd('0x5b')]({'where':{'id':_0x41bfdd[_0xc1cd('0x63')]['id']}})[_0xc1cd('0x21')](handleEntityNotFound(_0x52ef1a,null))[_0xc1cd('0x21')](function(_0x1923ae){if(_0x1923ae){return _0x1923ae[_0xc1cd('0x74')](_0x41bfdd[_0xc1cd('0x5d')]['ids'],_[_0xc1cd('0x75')](_0x41bfdd[_0xc1cd('0x5d')],['ids','id'])||{});}})[_0xc1cd('0x21')](respondWithResult(_0x52ef1a,null))[_0xc1cd('0x57')](handleError(_0x52ef1a,null));};exports[_0xc1cd('0x76')]=function(_0x1002b3,_0xac9a4,_0x1687a7){var _0x114161={'raw':![],'where':{}};var _0x229671={};var _0x34198a={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc1cd('0x69')]({'where':{'id':_0x1002b3['params']['id']}})[_0xc1cd('0x21')](handleEntityNotFound(_0xac9a4,null))[_0xc1cd('0x21')](function(_0x3e5ed7){if(_0x3e5ed7){_0x229671[_0xc1cd('0x46')]=_[_0xc1cd('0x59')](db[_0xc1cd('0x77')]['rawAttributes']);_0x229671[_0xc1cd('0x47')]=_[_0xc1cd('0x59')](_0x1002b3[_0xc1cd('0x47')]);_0x229671[_0xc1cd('0x48')]=_[_0xc1cd('0x49')](_0x229671[_0xc1cd('0x46')],_0x229671['query']);_0x114161['attributes']=_[_0xc1cd('0x49')](_0x229671[_0xc1cd('0x46')],qs[_0xc1cd('0x4b')](_0x1002b3[_0xc1cd('0x47')]['fields']));_0x114161['attributes']=_0x114161[_0xc1cd('0x4a')][_0xc1cd('0x4c')]?_0x114161[_0xc1cd('0x4a')]:_0x229671['model'];if(!_0x1002b3[_0xc1cd('0x47')][_0xc1cd('0x6a')](_0xc1cd('0x4d'))){_0x114161[_0xc1cd('0x32')]=qs[_0xc1cd('0x32')](_0x1002b3[_0xc1cd('0x47')][_0xc1cd('0x32')]);_0x114161[_0xc1cd('0x2f')]=qs[_0xc1cd('0x2f')](_0x1002b3['query'][_0xc1cd('0x2f')]);}_0x114161[_0xc1cd('0x6b')]=qs[_0xc1cd('0x4e')](_0x1002b3['query'][_0xc1cd('0x4e')]);_0x114161[_0xc1cd('0x4f')]=qs['filters'](_[_0xc1cd('0x50')](_0x1002b3[_0xc1cd('0x47')],_0x229671[_0xc1cd('0x48')]));_0x114161[_0xc1cd('0x4f')]['FaxAccountId']=_0x3e5ed7['id'];if(_0x1002b3[_0xc1cd('0x47')]['filter']){_0x114161[_0xc1cd('0x4f')]=_[_0xc1cd('0x53')](_0x114161[_0xc1cd('0x4f')],{'$or':_['map'](_0x114161[_0xc1cd('0x4a')],function(_0x274151){var _0x1cc475={};_0x1cc475[_0x274151]={'$like':'%'+_0x1002b3[_0xc1cd('0x47')][_0xc1cd('0x51')]+'%'};return _0x1cc475;})});}_0x114161=_['merge']({},_0x114161,_0x1002b3[_0xc1cd('0x54')]);return db[_0xc1cd('0x77')][_0xc1cd('0x31')]({'where':_0x114161[_0xc1cd('0x4f')]})[_0xc1cd('0x21')](function(_0x30aae5){_0x34198a['count']=_0x30aae5;if(_0x1002b3[_0xc1cd('0x47')][_0xc1cd('0x5a')]){_0x114161[_0xc1cd('0x56')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0xc1cd('0x78'),'attributes':['name',_0xc1cd('0x79'),_0xc1cd('0x7a')],'required':![]},{'model':db['Tag'],'as':_0xc1cd('0x7b'),'attributes':['id','name',_0xc1cd('0x7c')],'where':_0x1002b3[_0xc1cd('0x47')]['tag']?{'id':_0x1002b3['query'][_0xc1cd('0x7d')]}:undefined,'required':_0x1002b3[_0xc1cd('0x47')][_0xc1cd('0x7d')]?!![]:![]}];}return db[_0xc1cd('0x77')]['findAll'](_0x114161);})[_0xc1cd('0x21')](function(_0x2cc612){_0x34198a[_0xc1cd('0x6d')]=_0x2cc612;return _0x34198a;});}})[_0xc1cd('0x21')](respondWithFilteredResult(_0xac9a4,_0x114161))['catch'](handleError(_0xac9a4,null));};exports[_0xc1cd('0x7e')]=function(_0x386e07,_0x3548c3,_0x1ab818){return db['FaxAccount'][_0xc1cd('0x69')]({'where':{'id':_0x386e07[_0xc1cd('0x63')]['id']}})['then'](handleEntityNotFound(_0x3548c3,null))['then'](function(_0x18420a){if(_0x18420a){return db[_0xc1cd('0x7f')][_0xc1cd('0x80')](function(_0x3cf2b7){return db[_0xc1cd('0x81')][_0xc1cd('0x38')]({'where':{'FaxAccountId':_0x386e07[_0xc1cd('0x63')]['id']},'transaction':_0x3cf2b7})['then'](function(_0xdd95dd){var _0x40f0af=_[_0xc1cd('0x41')](_0x386e07[_0xc1cd('0x5d')],function(_0x2e121d){_0x2e121d[_0xc1cd('0x66')]=_0x386e07[_0xc1cd('0x63')]['id'];return _0x2e121d;});return db[_0xc1cd('0x81')][_0xc1cd('0x82')](_0x40f0af,{'transaction':_0x3cf2b7});});})['then'](function(){return db[_0xc1cd('0x81')][_0xc1cd('0x83')]({'where':{'FaxAccountId':_0x386e07[_0xc1cd('0x63')]['id']},'order':'priority'});});}})[_0xc1cd('0x21')](respondWithResult(_0x3548c3,null))[_0xc1cd('0x57')](handleError(_0x3548c3,null));};exports[_0xc1cd('0x84')]=function(_0x16e7b8,_0x5ac01a,_0x2e3cc7){var _0x49dcad={};var _0x52c916={};var _0x55a300;var _0x12f1d3;return db[_0xc1cd('0x55')][_0xc1cd('0x69')]({'where':{'id':_0x16e7b8['params']['id']}})[_0xc1cd('0x21')](handleEntityNotFound(_0x5ac01a,null))[_0xc1cd('0x21')](function(_0x10a5fc){if(_0x10a5fc){_0x55a300=_0x10a5fc;_0x52c916[_0xc1cd('0x46')]=_['keys'](db['FaxApplication']['rawAttributes']);_0x52c916[_0xc1cd('0x47')]=_[_0xc1cd('0x59')](_0x16e7b8['query']);_0x52c916[_0xc1cd('0x48')]=_['intersection'](_0x52c916['model'],_0x52c916[_0xc1cd('0x47')]);_0x49dcad['attributes']=_[_0xc1cd('0x49')](_0x52c916[_0xc1cd('0x46')],qs[_0xc1cd('0x4b')](_0x16e7b8[_0xc1cd('0x47')]['fields']));_0x49dcad[_0xc1cd('0x4a')]=_0x49dcad[_0xc1cd('0x4a')][_0xc1cd('0x4c')]?_0x49dcad[_0xc1cd('0x4a')]:_0x52c916['model'];_0x49dcad[_0xc1cd('0x6b')]=qs['sort'](_0x16e7b8['query'][_0xc1cd('0x4e')]);_0x49dcad['where']=qs[_0xc1cd('0x48')](_[_0xc1cd('0x50')](_0x16e7b8[_0xc1cd('0x47')],_0x52c916['filters']));if(_0x16e7b8[_0xc1cd('0x47')][_0xc1cd('0x51')]){_0x49dcad['where']=_['merge'](_0x49dcad[_0xc1cd('0x4f')],{'$or':_[_0xc1cd('0x41')](_0x49dcad['attributes'],function(_0x8e6351){var _0x298348={};_0x298348[_0x8e6351]={'$like':'%'+_0x16e7b8[_0xc1cd('0x47')]['filter']+'%'};return _0x298348;})});}_0x49dcad=_[_0xc1cd('0x53')]({},_0x49dcad,_0x16e7b8['options']);return _0x55a300[_0xc1cd('0x84')](_0x49dcad);}})['then'](function(_0x8588ed){if(_0x8588ed){_0x12f1d3=_0x8588ed[_0xc1cd('0x4c')];if(!_0x16e7b8[_0xc1cd('0x47')][_0xc1cd('0x6a')](_0xc1cd('0x4d'))){_0x49dcad[_0xc1cd('0x32')]=qs[_0xc1cd('0x32')](_0x16e7b8[_0xc1cd('0x47')][_0xc1cd('0x32')]);_0x49dcad[_0xc1cd('0x2f')]=qs[_0xc1cd('0x2f')](_0x16e7b8[_0xc1cd('0x47')][_0xc1cd('0x2f')]);}return _0x55a300[_0xc1cd('0x84')](_0x49dcad);}})[_0xc1cd('0x21')](function(_0xfa7530){if(_0xfa7530){return _0xfa7530?{'count':_0x12f1d3,'rows':_0xfa7530}:null;}})['then'](respondWithResult(_0x5ac01a,null))['catch'](handleError(_0x5ac01a,null));};function Extension(_0x1f4fb0,_0x409b35,_0x321bd4,_0xc11e80){this['context']=_0xc1cd('0x85');this[_0xc1cd('0x86')]=_0x1f4fb0[_0xc1cd('0x87')];this[_0xc1cd('0x88')]=_0xc11e80;this[_0xc1cd('0x44')]=_0xc1cd('0x89');this['description']=_0xc1cd('0x8a');this[_0xc1cd('0x66')]=_0x1f4fb0['id'];this['priority']=_0x409b35;this[_0xc1cd('0x8b')]=_0x321bd4;}function createExtensionsReciveFax(_0x263f57){var _0x363232=0x1;var _0x8b15f5=[];_0x8b15f5[_0xc1cd('0x8c')](new Extension(_0x263f57,_0x363232,'',_0xc1cd('0x8d')));_0x363232+=0x1;_0x8b15f5[_0xc1cd('0x8c')](new Extension(_0x263f57,_0x363232,_0xc1cd('0x8e'),_0xc1cd('0x8f')));_0x363232+=0x1;for(var _0x2f881e in _0x263f57){if(_0x263f57[_0xc1cd('0x6a')](_0x2f881e)&&(_0x2f881e==='ecm'||_0x2f881e==='localstationid'||_0x2f881e===_0xc1cd('0x90')||_0x2f881e===_0xc1cd('0x91')||_0x2f881e===_0xc1cd('0x92')||_0x2f881e==='maxrate'||_0x2f881e===_0xc1cd('0x93')||_0x2f881e===_0xc1cd('0x94')||_0x2f881e===_0xc1cd('0x95'))){_0x8b15f5['push'](new Extension(_0x263f57,_0x363232,'FAXOPT('+_0x2f881e+')='+_0x263f57[_0x2f881e],_0xc1cd('0x8f')));_0x363232+=0x1;}}_0x8b15f5[_0xc1cd('0x8c')](new Extension(_0x263f57,_0x363232,'6',_0xc1cd('0x96')));_0x363232+=0x1;_0x8b15f5[_0xc1cd('0x8c')](new Extension(_0x263f57,_0x363232,_0xc1cd('0x97'),'ReceiveFax'));_0x363232=0x0;return _0x8b15f5;}exports[_0xc1cd('0x98')]=function(_0x292316,_0x260a22,_0x2d131d){var _0x1d69c6;return db[_0xc1cd('0x7f')]['transaction'](function(_0x4e0388){return db[_0xc1cd('0x55')][_0xc1cd('0x5c')](_0x292316[_0xc1cd('0x5d')],{'transaction':_0x4e0388})['then'](function(_0x3bc8e1){_0x1d69c6=_0x3bc8e1[_0xc1cd('0x39')]({'plain':!![]});return db[_0xc1cd('0x99')][_0xc1cd('0x82')](createExtensionsReciveFax(_0x1d69c6),{'transaction':_0x4e0388});});})[_0xc1cd('0x21')](function(){return _0x1d69c6;})[_0xc1cd('0x21')](respondWithResult(_0x260a22,null))[_0xc1cd('0x57')](handleError(_0x260a22,null));};exports[_0xc1cd('0x9a')]=function(_0x93da86,_0x3a94f8,_0x401ff4){var _0x6726f6;return db[_0xc1cd('0x7f')][_0xc1cd('0x80')](function(_0x40632f){return db[_0xc1cd('0x55')][_0xc1cd('0x37')](_0x93da86[_0xc1cd('0x5d')],{'where':{'id':_0x93da86[_0xc1cd('0x5d')]['id']},'transaction':_0x40632f})[_0xc1cd('0x21')](function(_0x18cba4){return db[_0xc1cd('0x99')][_0xc1cd('0x38')]({'where':{'FaxAccountId':_0x93da86[_0xc1cd('0x5d')]['id']},'transaction':_0x40632f})[_0xc1cd('0x21')](function(_0x328842){return db['VoiceExtension'][_0xc1cd('0x82')](createExtensionsReciveFax(_['omit'](_0x93da86['body'],[_0xc1cd('0x9b'),_0xc1cd('0x45'),_0xc1cd('0x9c'),_0xc1cd('0x9d'),'TrunkId','ListId'])),{'transaction':_0x40632f});});});})[_0xc1cd('0x21')](function(){return db[_0xc1cd('0x55')][_0xc1cd('0x9e')](_0x93da86[_0xc1cd('0x5d')]['id']);})[_0xc1cd('0x21')](respondWithResult(_0x3a94f8,null))['catch'](handleError(_0x3a94f8,null));};exports[_0xc1cd('0x9f')]=function(_0x33920b,_0x4c9ebf,_0x59243c){var _0xeee9e={'raw':!![],'where':{}};var _0x4664d1={};var _0x57701d={'count':0x0,'rows':[]};return db[_0xc1cd('0x55')]['findOne']({'where':{'id':_0x33920b[_0xc1cd('0x63')]['id']}})[_0xc1cd('0x21')](handleEntityNotFound(_0x4c9ebf,null))[_0xc1cd('0x21')](function(_0x86ad5a){if(_0x86ad5a){_0x4664d1[_0xc1cd('0x46')]=_['keys'](db[_0xc1cd('0xa0')][_0xc1cd('0x42')]);_0x4664d1['query']=_['keys'](_0x33920b[_0xc1cd('0x47')]);_0x4664d1[_0xc1cd('0x48')]=_[_0xc1cd('0x49')](_0x4664d1[_0xc1cd('0x46')],_0x4664d1[_0xc1cd('0x47')]);_0xeee9e[_0xc1cd('0x4a')]=_['intersection'](_0x4664d1['model'],qs['fields'](_0x33920b[_0xc1cd('0x47')][_0xc1cd('0x4b')]));_0xeee9e[_0xc1cd('0x4a')]=_0xeee9e[_0xc1cd('0x4a')][_0xc1cd('0x4c')]?_0xeee9e['attributes']:_0x4664d1[_0xc1cd('0x46')];if(!_0x33920b[_0xc1cd('0x47')][_0xc1cd('0x6a')](_0xc1cd('0x4d'))){_0xeee9e[_0xc1cd('0x32')]=qs[_0xc1cd('0x32')](_0x33920b[_0xc1cd('0x47')][_0xc1cd('0x32')]);_0xeee9e['offset']=qs[_0xc1cd('0x2f')](_0x33920b[_0xc1cd('0x47')]['offset']);}_0xeee9e['order']=qs[_0xc1cd('0x4e')](_0x33920b['query'][_0xc1cd('0x4e')]);_0xeee9e[_0xc1cd('0x4f')]=qs[_0xc1cd('0x48')](_[_0xc1cd('0x50')](_0x33920b[_0xc1cd('0x47')],_0x4664d1[_0xc1cd('0x48')]));_0xeee9e[_0xc1cd('0x4f')][_0xc1cd('0x66')]=_0x86ad5a['id'];if(_0x33920b[_0xc1cd('0x47')]['filter']){_0xeee9e[_0xc1cd('0x4f')]=_[_0xc1cd('0x53')](_0xeee9e[_0xc1cd('0x4f')],{'$or':_[_0xc1cd('0x41')](_0xeee9e[_0xc1cd('0x4a')],function(_0x3cabb5){var _0x3ad08f={};_0x3ad08f[_0x3cabb5]={'$like':'%'+_0x33920b[_0xc1cd('0x47')]['filter']+'%'};return _0x3ad08f;})});}if(_0x33920b[_0xc1cd('0x47')][_0xc1cd('0xa1')]){var _0x3b6fa9=_0x33920b[_0xc1cd('0x47')][_0xc1cd('0xa1')]['split'](',');var _0x5bd189={};_0x5bd189[_0x3b6fa9[0x0]]={'$gte':moment(_0x3b6fa9[0x1])['format'](_0xc1cd('0xa2'))};_0xeee9e[_0xc1cd('0x4f')]=_[_0xc1cd('0x53')](_0xeee9e['where'],_0x5bd189);}_0xeee9e=_[_0xc1cd('0x53')]({},_0xeee9e,_0x33920b[_0xc1cd('0x54')]);return db['FaxMessage']['count']({'where':_0xeee9e['where']})[_0xc1cd('0x21')](function(_0x4fa15f){_0x57701d[_0xc1cd('0x31')]=_0x4fa15f;if(_0x33920b[_0xc1cd('0x47')][_0xc1cd('0x5a')]){_0xeee9e[_0xc1cd('0x56')]=[{'all':!![]}];}return db[_0xc1cd('0xa0')][_0xc1cd('0x6c')](_0xeee9e);})[_0xc1cd('0x21')](function(_0xcc2466){_0x57701d[_0xc1cd('0x6d')]=_0xcc2466;return _0x57701d;});}})[_0xc1cd('0x21')](respondWithFilteredResult(_0x4c9ebf,_0xeee9e))['catch'](handleError(_0x4c9ebf,null));};exports['send']=function(_0x4eab91,_0x3bfc50,_0x240eeb){var _0x4c4de3,_0x5c07e3={},_0x32198c;if(_0x4eab91['body']['to']){_0x32198c=_0x4eab91[_0xc1cd('0x5d')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x4eab91['params']['id']},'include':[{'model':db[_0xc1cd('0xa3')],'as':_0xc1cd('0xa4'),'include':[{'model':db[_0xc1cd('0xa5')],'as':_0xc1cd('0xa6'),'where':{'fax':_0x32198c},'limit':0x1,'order':[[_0xc1cd('0x9d'),_0xc1cd('0xa7')]]}]}]})[_0xc1cd('0x21')](handleEntityNotFound(_0x3bfc50,null))[_0xc1cd('0x21')](function(_0x2ac132){_0x4c4de3=_0x2ac132;if(_0x4eab91['body'][_0xc1cd('0xa8')]&&_0x4eab91['body'][_0xc1cd('0xa8')][_0xc1cd('0x4c')]){for(var _0x39febf=0x0;_0x39febf<_0x4eab91[_0xc1cd('0x5d')][_0xc1cd('0xa8')][_0xc1cd('0x4c')];_0x39febf+=0x1){_0x4eab91[_0xc1cd('0x5d')][_0xc1cd('0xa8')][_0x39febf]={'filename':_0x4eab91[_0xc1cd('0x5d')][_0xc1cd('0xa8')][_0x39febf][_0xc1cd('0x3c')],'id':_0x4eab91[_0xc1cd('0x5d')][_0xc1cd('0xa8')][_0x39febf]['id'],'path':path[_0xc1cd('0xa9')](config[_0xc1cd('0xaa')],'server/files/attachments',_0x4eab91[_0xc1cd('0x5d')]['attachments'][_0x39febf]['basename'])};}}return respondWithRpcPromise(_0xc1cd('0xab'),'CheckAfterSend',{'FaxAccountId':_[_0xc1cd('0xac')](_0x4eab91[_0xc1cd('0x63')]['id'])?undefined:_0x4eab91[_0xc1cd('0x63')]['id'],'path':_['isNil'](_0x4eab91[_0xc1cd('0x5d')][_0xc1cd('0xa8')][0x0][_0xc1cd('0x5')])?undefined:_0x4eab91['body']['attachments'][0x0][_0xc1cd('0x5')],'fax':_[_0xc1cd('0xac')](_0x4eab91[_0xc1cd('0x5d')]['to'][0x0])?undefined:_0x4eab91[_0xc1cd('0x5d')]['to'][0x0]},client9002);})[_0xc1cd('0x21')](function(){if(_0x4c4de3){if(_['isNil'](_0x4eab91[_0xc1cd('0x5d')][_0xc1cd('0xad')])){_0x4eab91[_0xc1cd('0x5d')][_0xc1cd('0xad')]=util[_0xc1cd('0xae')]('\x22%s\x22\x20<%s>',_0x4c4de3[_0xc1cd('0x3c')],_0x4c4de3['fax']);}if(_0x4c4de3[_0xc1cd('0xa4')]){if(_0x4c4de3[_0xc1cd('0xa4')][_0xc1cd('0xa6')][_0xc1cd('0x4c')]){return _0x4c4de3['List']['Contacts'][0x0];}else{return db[_0xc1cd('0xa5')][_0xc1cd('0x5c')](_[_0xc1cd('0x1a')](_0x4eab91[_0xc1cd('0x5d')],{'firstName':_0x4eab91[_0xc1cd('0x5d')]['to'][0x0],'phone':_0x4eab91['body']['to'][0x0],'fax':_0x4eab91[_0xc1cd('0x5d')]['to'][0x0],'ListId':_0x4c4de3[_0xc1cd('0xaf')]}));}}else{throw new Error(_0xc1cd('0xb0'));}}else{throw new Error(_0xc1cd('0xb1'));}})['then'](function(_0x3cb49a){if(_0x3cb49a){return db[_0xc1cd('0x77')][_0xc1cd('0x5b')]({'where':{'ContactId':_0x3cb49a['id'],'closed':![],'FaxAccountId':_0x4c4de3['id']}})['then'](function(_0x117237){if(_0x117237){return[_0x117237,![]];}return db[_0xc1cd('0x77')][_0xc1cd('0x5c')]({'UserId':_0x4eab91[_0xc1cd('0x5e')]['id'],'ContactId':_0x3cb49a['id'],'FaxAccountId':_0x4c4de3['id'],'fax':_0x4eab91['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x4eab91[_0xc1cd('0x5d')],{'read':![],'body':_0x4eab91[_0xc1cd('0x5d')]['attachments'][0x0][_0xc1cd('0xb2')],'FaxAccountId':_0x4c4de3['id'],'UserId':_0x4eab91['user']['id'],'ContactId':_0x3cb49a['id'],'AttachmentId':_0x4eab91[_0xc1cd('0x5d')][_0xc1cd('0xa8')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xc1cd('0xb3')}]})['then'](function(_0x5ad344){return[_0x5ad344,!![]];});});}else{throw new Error(_0xc1cd('0xb4'));}})[_0xc1cd('0xb5')](function(_0x2cc46f,_0x267383){if(_0x267383){return _0x2cc46f;}return db[_0xc1cd('0xa0')][_0xc1cd('0x5c')]({'direction':_0xc1cd('0xb6'),'read':![],'body':_0x4eab91[_0xc1cd('0x5d')][_0xc1cd('0xa8')][0x0][_0xc1cd('0xb2')],'FaxAccountId':_0x4c4de3['id'],'FaxInteractionId':_0x2cc46f['id'],'UserId':_0x4eab91[_0xc1cd('0x5e')]['id'],'ContactId':_0x2cc46f['ContactId'],'AttachmentId':_0x4eab91[_0xc1cd('0x5d')][_0xc1cd('0xa8')][0x0]['id']})[_0xc1cd('0x21')](function(_0x4d10ea){_0x2cc46f[_0xc1cd('0xb7')][_0xc1cd('0xb3')]=[];_0x2cc46f[_0xc1cd('0xb7')][_0xc1cd('0xb3')][_0xc1cd('0x8c')](_0x4d10ea[_0xc1cd('0xb7')]);return _0x2cc46f;});})[_0xc1cd('0x21')](function(_0x37c0aa){respondWithRpcPromise('SendFax',_0xc1cd('0xb8'),{'FaxAccountId':_['isNil'](_0x4eab91['params']['id'])?undefined:_0x4eab91[_0xc1cd('0x63')]['id'],'path':_['isNil'](_0x4eab91['body'][_0xc1cd('0xa8')][0x0][_0xc1cd('0x5')])?undefined:_0x4eab91[_0xc1cd('0x5d')][_0xc1cd('0xa8')][0x0][_0xc1cd('0x5')],'fax':_[_0xc1cd('0xac')](_0x4eab91['body']['to'][0x0])?undefined:_0x4eab91[_0xc1cd('0x5d')]['to'][0x0],'AttachmentId':_0x4eab91['body'][_0xc1cd('0xa8')][0x0]['id']},client9002)['then'](function(_0x207c86){logger[_0xc1cd('0x22')](_0xc1cd('0xb9'),_0x207c86);})['catch'](function(_0x11c744){logger['info'](_0xc1cd('0xb9'),_0x11c744);});return _0x37c0aa;})[_0xc1cd('0x21')](respondWithResult(_0x3bfc50,null))[_0xc1cd('0x57')](handleError(_0x3bfc50,null));};exports[_0xc1cd('0xba')]=function(_0x37cc06,_0x29b305,_0x4e688c){return db['FaxAccount'][_0xc1cd('0x5b')]({'where':{'id':_0x37cc06[_0xc1cd('0x63')]['id']}})[_0xc1cd('0x21')](handleEntityNotFound(_0x29b305,null))[_0xc1cd('0x21')](function(_0x5a1d82){if(_0x5a1d82){return _0x5a1d82['addAgents'](_0x37cc06[_0xc1cd('0x5d')][_0xc1cd('0x6f')],_[_0xc1cd('0x75')](_0x37cc06[_0xc1cd('0x5d')],[_0xc1cd('0x6f'),'id'])||{})[_0xc1cd('0xb5')](function(_0x3d3cc2){for(var _0x1ae922=0x0;_0x1ae922<_0x37cc06[_0xc1cd('0x5d')][_0xc1cd('0x6f')]['length'];_0x1ae922+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x37cc06[_0xc1cd('0x5d')][_0xc1cd('0x6f')][_0x1ae922]),'FaxAccountId':Number(_0x37cc06[_0xc1cd('0x63')]['id'])});}return _0x3d3cc2;});}})[_0xc1cd('0x21')](respondWithResult(_0x29b305,null))[_0xc1cd('0x57')](handleError(_0x29b305,null));};exports[_0xc1cd('0xbb')]=function(_0x3f7d52,_0x114277,_0x1a5496){return db[_0xc1cd('0x55')][_0xc1cd('0x5b')]({'where':{'id':_0x3f7d52['params']['id']}})[_0xc1cd('0x21')](handleEntityNotFound(_0x114277,null))[_0xc1cd('0x21')](function(_0x526833){if(_0x526833){return _0x526833['removeAgents'](_0x3f7d52[_0xc1cd('0x47')]['ids'])[_0xc1cd('0x21')](function(){if(_[_0xc1cd('0xbc')](_0x3f7d52['query'][_0xc1cd('0x6f')])){for(var _0x5485f6=0x0;_0x5485f6<_0x3f7d52[_0xc1cd('0x47')][_0xc1cd('0x6f')]['length'];_0x5485f6+=0x1){socket[_0xc1cd('0xbd')](_0xc1cd('0xbe'),{'UserId':Number(_0x3f7d52['query'][_0xc1cd('0x6f')][_0x5485f6]),'FaxAccountId':Number(_0x3f7d52[_0xc1cd('0x63')]['id'])});}}else{socket['emit'](_0xc1cd('0xbe'),{'UserId':Number(_0x3f7d52['query']['ids']),'FaxAccountId':Number(_0x3f7d52['params']['id'])});}});}})[_0xc1cd('0x21')](respondWithStatusCode(_0x114277,null))['catch'](handleError(_0x114277,null));};exports['getAgents']=function(_0x1ff055,_0x26b814,_0x48be7e){var _0x4fa95e={};var _0x8446d8={};var _0x3cf001;var _0x1b082e;return db[_0xc1cd('0x55')][_0xc1cd('0x69')]({'where':{'id':_0x1ff055[_0xc1cd('0x63')]['id']}})['then'](handleEntityNotFound(_0x26b814,null))['then'](function(_0x3ff38b){if(_0x3ff38b){_0x3cf001=_0x3ff38b;_0x8446d8[_0xc1cd('0x46')]=_[_0xc1cd('0x59')](db[_0xc1cd('0xbf')][_0xc1cd('0x42')]);_0x8446d8[_0xc1cd('0x47')]=_[_0xc1cd('0x59')](_0x1ff055['query']);_0x8446d8[_0xc1cd('0x48')]=_[_0xc1cd('0x49')](_0x8446d8[_0xc1cd('0x46')],_0x8446d8[_0xc1cd('0x47')]);_0x4fa95e[_0xc1cd('0x4a')]=_['intersection'](_0x8446d8['model'],qs['fields'](_0x1ff055[_0xc1cd('0x47')]['fields']));_0x4fa95e['attributes']=_0x4fa95e[_0xc1cd('0x4a')][_0xc1cd('0x4c')]?_0x4fa95e[_0xc1cd('0x4a')]:_0x8446d8[_0xc1cd('0x46')];_0x4fa95e[_0xc1cd('0x6b')]=qs['sort'](_0x1ff055[_0xc1cd('0x47')][_0xc1cd('0x4e')]);_0x4fa95e['where']=qs[_0xc1cd('0x48')](_[_0xc1cd('0x50')](_0x1ff055[_0xc1cd('0x47')],_0x8446d8[_0xc1cd('0x48')]));if(_0x1ff055[_0xc1cd('0x47')][_0xc1cd('0x51')]){_0x4fa95e[_0xc1cd('0x4f')]=_[_0xc1cd('0x53')](_0x4fa95e[_0xc1cd('0x4f')],{'$or':_[_0xc1cd('0x41')](_0x4fa95e['attributes'],function(_0xffb10f){var _0x1de4f8={};_0x1de4f8[_0xffb10f]={'$like':'%'+_0x1ff055[_0xc1cd('0x47')]['filter']+'%'};return _0x1de4f8;})});}_0x4fa95e=_[_0xc1cd('0x53')]({},_0x4fa95e,_0x1ff055[_0xc1cd('0x54')]);return _0x3cf001[_0xc1cd('0xc0')](_0x4fa95e);}})[_0xc1cd('0x21')](function(_0x115852){if(_0x115852){_0x1b082e=_0x115852[_0xc1cd('0x4c')];if(!_0x1ff055[_0xc1cd('0x47')][_0xc1cd('0x6a')](_0xc1cd('0x4d'))){_0x4fa95e[_0xc1cd('0x32')]=qs[_0xc1cd('0x32')](_0x1ff055[_0xc1cd('0x47')][_0xc1cd('0x32')]);_0x4fa95e[_0xc1cd('0x2f')]=qs['offset'](_0x1ff055['query']['offset']);}return _0x3cf001[_0xc1cd('0xc0')](_0x4fa95e);}})[_0xc1cd('0x21')](function(_0x51af60){if(_0x51af60){return _0x51af60?{'count':_0x1b082e,'rows':_0x51af60}:null;}})[_0xc1cd('0x21')](respondWithResult(_0x26b814,null))[_0xc1cd('0x57')](handleError(_0x26b814,null));}; \ No newline at end of file +var _0xae15=['context','from-voip-provider','exten','system','appdata','push','Answer','CDR(type)=inbound-fax','Set','localstationid','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','dataValues','SendFax','path','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','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','offset','count','limit','set','Content-Range','json','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','send','index','Pause','mandatoryDispositionPause','FaxAccount','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications'];(function(_0x14a948,_0x209aed){var _0x139523=function(_0xf1b83b){while(--_0xf1b83b){_0x14a948['push'](_0x14a948['shift']());}};_0x139523(++_0x209aed);}(_0xae15,0x1cf));var _0x5ae1=function(_0x3c6bc2,_0x20df0a){_0x3c6bc2=_0x3c6bc2-0x0;var _0x2af9c0=_0xae15[_0x3c6bc2];return _0x2af9c0;};'use strict';var emlformat=require(_0x5ae1('0x0'));var rimraf=require(_0x5ae1('0x1'));var zipdir=require(_0x5ae1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ae1('0x3'));var moment=require(_0x5ae1('0x4'));var BPromise=require(_0x5ae1('0x5'));var Mustache=require(_0x5ae1('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5ae1('0x7'));var csv=require(_0x5ae1('0x8'));var ejs=require(_0x5ae1('0x9'));var fs=require('fs');var fs_extra=require(_0x5ae1('0xa'));var _=require(_0x5ae1('0xb'));var squel=require(_0x5ae1('0xc'));var crypto=require('crypto');var jsforce=require(_0x5ae1('0xd'));var deskjs=require(_0x5ae1('0xe'));var toCsv=require(_0x5ae1('0x8'));var querystring=require('querystring');var Papa=require(_0x5ae1('0xf'));var Redis=require(_0x5ae1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5ae1('0x11'));var as=require(_0x5ae1('0x12'));var hardwareService=require(_0x5ae1('0x13'));var logger=require(_0x5ae1('0x14'))('api');var utils=require(_0x5ae1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5ae1('0x16'))['db'];config[_0x5ae1('0x17')]=_[_0x5ae1('0x18')](config['redis'],{'host':_0x5ae1('0x19'),'port':0x18eb});var socket=require(_0x5ae1('0x1a'))(new Redis(config['redis']));require(_0x5ae1('0x1b'))[_0x5ae1('0x1c')](socket);var jayson=require(_0x5ae1('0x1d'));var client=jayson[_0x5ae1('0x1e')][_0x5ae1('0x1f')]({'port':0x232c});var client9002=jayson[_0x5ae1('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x105b78,_0x39137c,_0x43308d,_0x22353f){return new BPromise(function(_0x1326c7,_0x531c93){var _0xe750a5=_0x22353f||client;return _0xe750a5[_0x5ae1('0x20')](_0x105b78,_0x43308d)[_0x5ae1('0x21')](function(_0x2d5f8a){logger[_0x5ae1('0x22')](_0x5ae1('0x23'),_0x39137c,_0x5ae1('0x24'));logger[_0x5ae1('0x25')](_0x5ae1('0x26'),_0x39137c,'request\x20sent',JSON[_0x5ae1('0x27')](_0x2d5f8a));if(_0x2d5f8a[_0x5ae1('0x28')]){if(_0x2d5f8a['error'][_0x5ae1('0x29')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x39137c,_0x2d5f8a[_0x5ae1('0x28')][_0x5ae1('0x2a')]);return _0x531c93(_0x2d5f8a[_0x5ae1('0x28')][_0x5ae1('0x2a')]);}logger[_0x5ae1('0x28')](_0x5ae1('0x23'),_0x39137c,_0x2d5f8a[_0x5ae1('0x28')][_0x5ae1('0x2a')]);return _0x1326c7(_0x2d5f8a[_0x5ae1('0x28')][_0x5ae1('0x2a')]);}else{logger['info'](_0x5ae1('0x23'),_0x39137c,_0x5ae1('0x24'));_0x1326c7(_0x2d5f8a[_0x5ae1('0x2b')][_0x5ae1('0x2a')]);}})[_0x5ae1('0x2c')](function(_0x185c3f){logger['error'](_0x5ae1('0x23'),_0x39137c,_0x185c3f);_0x531c93(_0x185c3f);});});}function respondWithStatusCode(_0x619188,_0x19838b){_0x19838b=_0x19838b||0xcc;return function(_0x5319f5){if(_0x5319f5){return _0x619188[_0x5ae1('0x2d')](_0x19838b);}return _0x619188[_0x5ae1('0x2e')](_0x19838b)[_0x5ae1('0x2f')]();};}function respondWithResult(_0x28e9be,_0x5e6e16){_0x5e6e16=_0x5e6e16||0xc8;return function(_0x39f49e){if(_0x39f49e){return _0x28e9be[_0x5ae1('0x2e')](_0x5e6e16)['json'](_0x39f49e);}};}function respondWithFilteredResult(_0x523b43,_0x583d7c){return function(_0x449fad){if(_0x449fad){var _0x3ef2a4=typeof _0x583d7c[_0x5ae1('0x30')]==='undefined'&&typeof _0x583d7c['limit']==='undefined';var _0x11c824=_0x449fad[_0x5ae1('0x31')];var _0x3af4db=_0x3ef2a4?0x0:_0x583d7c[_0x5ae1('0x30')];var _0x17f03b=_0x3ef2a4?_0x449fad[_0x5ae1('0x31')]:_0x583d7c[_0x5ae1('0x30')]+_0x583d7c[_0x5ae1('0x32')];var _0x4aefcc;if(_0x17f03b>=_0x11c824){_0x17f03b=_0x11c824;_0x4aefcc=0xc8;}else{_0x4aefcc=0xce;}_0x523b43[_0x5ae1('0x2e')](_0x4aefcc);return _0x523b43[_0x5ae1('0x33')](_0x5ae1('0x34'),_0x3af4db+'-'+_0x17f03b+'/'+_0x11c824)[_0x5ae1('0x35')](_0x449fad);}return null;};}function patchUpdates(_0x3fb66b){return function(_0x1db002){try{jsonpatch['apply'](_0x1db002,_0x3fb66b,!![]);}catch(_0x19a1d5){return BPromise['reject'](_0x19a1d5);}return _0x1db002[_0x5ae1('0x36')]();};}function saveUpdates(_0x2dec8c,_0x140b77){return function(_0x3334cd){if(_0x3334cd){return _0x3334cd[_0x5ae1('0x37')](_0x2dec8c)[_0x5ae1('0x21')](function(_0x1362eb){return _0x1362eb;});}return null;};}function removeEntity(_0x3f4a87,_0x1a3185){return function(_0x40bc0f){if(_0x40bc0f){return _0x40bc0f['destroy']()[_0x5ae1('0x21')](function(){var _0x32142c=_0x40bc0f[_0x5ae1('0x38')]({'plain':!![]});var _0xfae32b=_0x5ae1('0x39');return db[_0x5ae1('0x3a')][_0x5ae1('0x3b')]({'where':{'type':_0xfae32b,'resourceId':_0x32142c['id']}})[_0x5ae1('0x21')](function(){return _0x40bc0f;});})['then'](function(){_0x3f4a87[_0x5ae1('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2403,_0x2cc232){return function(_0x174b19){if(!_0x174b19){_0x4c2403[_0x5ae1('0x2d')](0x194);}return _0x174b19;};}function handleError(_0x5ae975,_0x4ee1fb){_0x4ee1fb=_0x4ee1fb||0x1f4;return function(_0x49c1e6){logger[_0x5ae1('0x28')](_0x49c1e6[_0x5ae1('0x3c')]);if(_0x49c1e6['name']){delete _0x49c1e6['name'];}_0x5ae975[_0x5ae1('0x2e')](_0x4ee1fb)[_0x5ae1('0x3d')](_0x49c1e6);};}exports[_0x5ae1('0x3e')]=function(_0x263eb7,_0x587599){var _0x482212={'include':[{'model':db[_0x5ae1('0x3f')],'as':_0x5ae1('0x40')}]},_0x25e63f={},_0x33873a={'count':0x0,'rows':[]};var _0x3e03cc=_['map'](db[_0x5ae1('0x41')]['rawAttributes'],function(_0x771b53){return{'name':_0x771b53['fieldName'],'type':_0x771b53[_0x5ae1('0x42')][_0x5ae1('0x43')]};});_0x25e63f[_0x5ae1('0x44')]=_[_0x5ae1('0x45')](_0x3e03cc,_0x5ae1('0x46'));_0x25e63f['query']=_[_0x5ae1('0x47')](_0x263eb7[_0x5ae1('0x48')]);_0x25e63f[_0x5ae1('0x49')]=_[_0x5ae1('0x4a')](_0x25e63f[_0x5ae1('0x44')],_0x25e63f[_0x5ae1('0x48')]);_0x482212[_0x5ae1('0x4b')]=_['intersection'](_0x25e63f[_0x5ae1('0x44')],qs['fields'](_0x263eb7[_0x5ae1('0x48')][_0x5ae1('0x4c')]));_0x482212['attributes']=_0x482212[_0x5ae1('0x4b')][_0x5ae1('0x4d')]?_0x482212[_0x5ae1('0x4b')]:_0x25e63f[_0x5ae1('0x44')];if(!_0x263eb7[_0x5ae1('0x48')][_0x5ae1('0x4e')](_0x5ae1('0x4f'))){_0x482212[_0x5ae1('0x32')]=qs[_0x5ae1('0x32')](_0x263eb7['query'][_0x5ae1('0x32')]);_0x482212['offset']=qs[_0x5ae1('0x30')](_0x263eb7[_0x5ae1('0x48')][_0x5ae1('0x30')]);}_0x482212[_0x5ae1('0x50')]=qs['sort'](_0x263eb7['query'][_0x5ae1('0x51')]);_0x482212[_0x5ae1('0x52')]=qs['filters'](_[_0x5ae1('0x53')](_0x263eb7[_0x5ae1('0x48')],_0x25e63f['filters']),_0x3e03cc);if(_0x263eb7[_0x5ae1('0x48')][_0x5ae1('0x54')]){_0x482212[_0x5ae1('0x52')]=_[_0x5ae1('0x55')](_0x482212[_0x5ae1('0x52')],{'$or':_[_0x5ae1('0x45')](_0x3e03cc,function(_0x4dcee4){if(_0x4dcee4[_0x5ae1('0x42')]!==_0x5ae1('0x56')){var _0x463e19={};_0x463e19[_0x4dcee4[_0x5ae1('0x46')]]={'$like':'%'+_0x263eb7[_0x5ae1('0x48')][_0x5ae1('0x54')]+'%'};return _0x463e19;}})});}_0x482212=_[_0x5ae1('0x55')]({},_0x482212,_0x263eb7[_0x5ae1('0x57')]);var _0x597219={'where':_0x482212[_0x5ae1('0x52')]};return db[_0x5ae1('0x41')][_0x5ae1('0x31')](_0x597219)['then'](function(_0x499c02){_0x33873a[_0x5ae1('0x31')]=_0x499c02;if(_0x263eb7[_0x5ae1('0x48')][_0x5ae1('0x58')]){_0x482212['include']=[{'all':!![]}];}return db[_0x5ae1('0x41')][_0x5ae1('0x59')](_0x482212);})[_0x5ae1('0x21')](function(_0x572f67){_0x33873a[_0x5ae1('0x5a')]=_0x572f67;return _0x33873a;})['then'](respondWithFilteredResult(_0x587599,_0x482212))['catch'](handleError(_0x587599,null));};exports[_0x5ae1('0x5b')]=function(_0x1aeb4,_0x4f0442){var _0x20a562={'raw':![],'where':{'id':_0x1aeb4[_0x5ae1('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x5ae1('0x40')}]},_0x5e36b0={};_0x5e36b0['model']=_[_0x5ae1('0x47')](db[_0x5ae1('0x41')][_0x5ae1('0x5d')]);_0x5e36b0[_0x5ae1('0x48')]=_[_0x5ae1('0x47')](_0x1aeb4[_0x5ae1('0x48')]);_0x5e36b0['filters']=_[_0x5ae1('0x4a')](_0x5e36b0[_0x5ae1('0x44')],_0x5e36b0[_0x5ae1('0x48')]);_0x20a562[_0x5ae1('0x4b')]=_[_0x5ae1('0x4a')](_0x5e36b0[_0x5ae1('0x44')],qs[_0x5ae1('0x4c')](_0x1aeb4[_0x5ae1('0x48')][_0x5ae1('0x4c')]));_0x20a562['attributes']=_0x20a562[_0x5ae1('0x4b')][_0x5ae1('0x4d')]?_0x20a562[_0x5ae1('0x4b')]:_0x5e36b0[_0x5ae1('0x44')];if(_0x1aeb4[_0x5ae1('0x48')][_0x5ae1('0x58')]){_0x20a562[_0x5ae1('0x5e')]=[{'all':!![]}];}_0x20a562=_[_0x5ae1('0x55')]({},_0x20a562,_0x1aeb4[_0x5ae1('0x57')]);return db[_0x5ae1('0x41')][_0x5ae1('0x5f')](_0x20a562)[_0x5ae1('0x21')](handleEntityNotFound(_0x4f0442,null))['then'](respondWithResult(_0x4f0442,null))['catch'](handleError(_0x4f0442,null));};exports[_0x5ae1('0x60')]=function(_0x546ad9,_0x2c028c){return db[_0x5ae1('0x41')][_0x5ae1('0x60')](_0x546ad9[_0x5ae1('0x61')],{})[_0x5ae1('0x21')](function(_0x1fee8f){var _0x3011ca=_0x546ad9[_0x5ae1('0x62')][_0x5ae1('0x38')]({'plain':!![]});if(!_0x3011ca)throw new Error(_0x5ae1('0x63'));if(_0x3011ca[_0x5ae1('0x64')]===_0x5ae1('0x62')){var _0x5323fd=_0x1fee8f[_0x5ae1('0x38')]({'plain':!![]});var _0x594119=_0x5ae1('0x39');return db['UserProfileSection'][_0x5ae1('0x5f')]({'where':{'name':_0x594119,'userProfileId':_0x3011ca[_0x5ae1('0x65')]},'raw':!![]})[_0x5ae1('0x21')](function(_0x2c629d){if(_0x2c629d&&_0x2c629d[_0x5ae1('0x66')]===0x0){return db[_0x5ae1('0x3a')][_0x5ae1('0x60')]({'name':_0x5323fd['name'],'resourceId':_0x5323fd['id'],'type':_0x2c629d[_0x5ae1('0x46')],'sectionId':_0x2c629d['id']},{})[_0x5ae1('0x21')](function(){return _0x1fee8f;});}else{return _0x1fee8f;}})[_0x5ae1('0x2c')](function(_0x47cea9){logger[_0x5ae1('0x28')](_0x5ae1('0x67'),_0x47cea9);throw _0x47cea9;});}return _0x1fee8f;})[_0x5ae1('0x21')](respondWithResult(_0x2c028c,0xc9))['catch'](handleError(_0x2c028c,null));};exports['update']=function(_0x58d77a,_0x2c33e1){if(_0x58d77a[_0x5ae1('0x61')]['id']){delete _0x58d77a[_0x5ae1('0x61')]['id'];}return db[_0x5ae1('0x41')][_0x5ae1('0x5f')]({'where':{'id':_0x58d77a[_0x5ae1('0x5c')]['id']},'include':[{'model':db[_0x5ae1('0x3f')],'as':_0x5ae1('0x40')}]})[_0x5ae1('0x21')](handleEntityNotFound(_0x2c33e1,null))[_0x5ae1('0x21')](saveUpdates(_0x58d77a['body'],null))['then'](respondWithResult(_0x2c33e1,null))[_0x5ae1('0x2c')](handleError(_0x2c33e1,null));};exports[_0x5ae1('0x3b')]=function(_0x14238f,_0x13c80e){return db[_0x5ae1('0x41')][_0x5ae1('0x5f')]({'where':{'id':_0x14238f[_0x5ae1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x13c80e,null))[_0x5ae1('0x21')](removeEntity(_0x13c80e,null))[_0x5ae1('0x2c')](handleError(_0x13c80e,null));};exports[_0x5ae1('0x68')]=function(_0xef00da,_0x576273){return db[_0x5ae1('0x41')][_0x5ae1('0x68')]()[_0x5ae1('0x21')](respondWithResult(_0x576273,null))[_0x5ae1('0x2c')](handleError(_0x576273,null));};exports[_0x5ae1('0x69')]=function(_0x1b3926,_0x4e1654,_0x29f574){if(_0x1b3926['body']['id']){delete _0x1b3926[_0x5ae1('0x61')]['id'];}return db[_0x5ae1('0x41')][_0x5ae1('0x5f')]({'where':{'id':_0x1b3926[_0x5ae1('0x5c')]['id']}})[_0x5ae1('0x21')](handleEntityNotFound(_0x4e1654,null))[_0x5ae1('0x21')](function(_0x86a67a){if(_0x86a67a){_0x1b3926[_0x5ae1('0x61')][_0x5ae1('0x6a')]=_0x86a67a['id'];return db[_0x5ae1('0x6b')][_0x5ae1('0x60')](_0x1b3926['body']);}})[_0x5ae1('0x21')](respondWithResult(_0x4e1654,null))[_0x5ae1('0x2c')](handleError(_0x4e1654,null));};exports[_0x5ae1('0x6c')]=function(_0x2bd872,_0x482401,_0x10a418){var _0x26e27e={'raw':![],'where':{}};var _0x2211f2={};var _0x5e6b5f={'count':0x0,'rows':[]};return db[_0x5ae1('0x41')][_0x5ae1('0x6d')]({'where':{'id':_0x2bd872[_0x5ae1('0x5c')]['id']}})[_0x5ae1('0x21')](handleEntityNotFound(_0x482401,null))[_0x5ae1('0x21')](function(_0x39fae6){if(_0x39fae6){_0x2211f2[_0x5ae1('0x44')]=_[_0x5ae1('0x47')](db['Disposition'][_0x5ae1('0x5d')]);_0x2211f2[_0x5ae1('0x48')]=_[_0x5ae1('0x47')](_0x2bd872[_0x5ae1('0x48')]);_0x2211f2[_0x5ae1('0x49')]=_[_0x5ae1('0x4a')](_0x2211f2[_0x5ae1('0x44')],_0x2211f2['query']);_0x26e27e[_0x5ae1('0x4b')]=_[_0x5ae1('0x4a')](_0x2211f2[_0x5ae1('0x44')],qs[_0x5ae1('0x4c')](_0x2bd872[_0x5ae1('0x48')][_0x5ae1('0x4c')]));_0x26e27e[_0x5ae1('0x4b')]=_0x26e27e[_0x5ae1('0x4b')][_0x5ae1('0x4d')]?_0x26e27e['attributes']:_0x2211f2['model'];if(!_0x2bd872['query'][_0x5ae1('0x4e')](_0x5ae1('0x4f'))){_0x26e27e[_0x5ae1('0x32')]=qs[_0x5ae1('0x32')](_0x2bd872[_0x5ae1('0x48')][_0x5ae1('0x32')]);_0x26e27e[_0x5ae1('0x30')]=qs[_0x5ae1('0x30')](_0x2bd872['query']['offset']);}_0x26e27e[_0x5ae1('0x50')]=qs['sort'](_0x2bd872[_0x5ae1('0x48')][_0x5ae1('0x51')]);_0x26e27e[_0x5ae1('0x52')]=qs['filters'](_[_0x5ae1('0x53')](_0x2bd872['query'],_0x2211f2['filters']));_0x26e27e[_0x5ae1('0x52')][_0x5ae1('0x6a')]=_0x39fae6['id'];if(_0x2bd872[_0x5ae1('0x48')][_0x5ae1('0x54')]){_0x26e27e['where']=_[_0x5ae1('0x55')](_0x26e27e[_0x5ae1('0x52')],{'$or':_[_0x5ae1('0x45')](_0x26e27e['attributes'],function(_0x526a85){var _0x37a7e2={};_0x37a7e2[_0x526a85]={'$like':'%'+_0x2bd872[_0x5ae1('0x48')]['filter']+'%'};return _0x37a7e2;})});}_0x26e27e=_[_0x5ae1('0x55')]({},_0x26e27e,_0x2bd872[_0x5ae1('0x57')]);return db[_0x5ae1('0x6b')][_0x5ae1('0x31')]({'where':_0x26e27e[_0x5ae1('0x52')]})[_0x5ae1('0x21')](function(_0x2efdc8){_0x5e6b5f[_0x5ae1('0x31')]=_0x2efdc8;if(_0x2bd872['query']['includeAll']){_0x26e27e[_0x5ae1('0x5e')]=[{'all':!![]}];}return db['Disposition'][_0x5ae1('0x59')](_0x26e27e);})['then'](function(_0xbaad2){_0x5e6b5f[_0x5ae1('0x5a')]=_0xbaad2;return _0x5e6b5f;});}})['then'](respondWithFilteredResult(_0x482401,_0x26e27e))[_0x5ae1('0x2c')](handleError(_0x482401,null));};exports[_0x5ae1('0x6e')]=function(_0x4720bb,_0x2d1248,_0x6afaac){return db[_0x5ae1('0x41')][_0x5ae1('0x5f')]({'where':{'id':_0x4720bb['params']['id']}})[_0x5ae1('0x21')](handleEntityNotFound(_0x2d1248,null))[_0x5ae1('0x21')](function(_0x39a2e2){if(_0x39a2e2){return _0x39a2e2[_0x5ae1('0x6e')](_0x4720bb['query']['ids']);}})[_0x5ae1('0x21')](respondWithStatusCode(_0x2d1248,null))[_0x5ae1('0x2c')](handleError(_0x2d1248,null));};exports['addAnswer']=function(_0xf49859,_0xf90b12,_0x422cbe){if(_0xf49859[_0x5ae1('0x61')]['id']){delete _0xf49859[_0x5ae1('0x61')]['id'];}return db[_0x5ae1('0x41')]['find']({'where':{'id':_0xf49859[_0x5ae1('0x5c')]['id']}})[_0x5ae1('0x21')](handleEntityNotFound(_0xf90b12,null))[_0x5ae1('0x21')](function(_0xc5e450){if(_0xc5e450){_0xf49859[_0x5ae1('0x61')][_0x5ae1('0x6a')]=_0xc5e450['id'];return db['CannedAnswer']['create'](_0xf49859['body']);}})[_0x5ae1('0x21')](respondWithResult(_0xf90b12,null))[_0x5ae1('0x2c')](handleError(_0xf90b12,null));};exports[_0x5ae1('0x6f')]=function(_0x5917aa,_0x514ff5,_0x2258bd){var _0x35aa9e={'raw':![],'where':{}};var _0x2cb6da={};var _0x9fe772={'count':0x0,'rows':[]};return db[_0x5ae1('0x41')][_0x5ae1('0x6d')]({'where':{'id':_0x5917aa[_0x5ae1('0x5c')]['id']}})[_0x5ae1('0x21')](handleEntityNotFound(_0x514ff5,null))['then'](function(_0x56ff79){if(_0x56ff79){_0x2cb6da['model']=_[_0x5ae1('0x47')](db[_0x5ae1('0x70')][_0x5ae1('0x5d')]);_0x2cb6da[_0x5ae1('0x48')]=_[_0x5ae1('0x47')](_0x5917aa['query']);_0x2cb6da[_0x5ae1('0x49')]=_[_0x5ae1('0x4a')](_0x2cb6da[_0x5ae1('0x44')],_0x2cb6da[_0x5ae1('0x48')]);_0x35aa9e[_0x5ae1('0x4b')]=_['intersection'](_0x2cb6da[_0x5ae1('0x44')],qs['fields'](_0x5917aa[_0x5ae1('0x48')][_0x5ae1('0x4c')]));_0x35aa9e['attributes']=_0x35aa9e['attributes'][_0x5ae1('0x4d')]?_0x35aa9e[_0x5ae1('0x4b')]:_0x2cb6da[_0x5ae1('0x44')];if(!_0x5917aa[_0x5ae1('0x48')][_0x5ae1('0x4e')](_0x5ae1('0x4f'))){_0x35aa9e[_0x5ae1('0x32')]=qs['limit'](_0x5917aa[_0x5ae1('0x48')][_0x5ae1('0x32')]);_0x35aa9e[_0x5ae1('0x30')]=qs[_0x5ae1('0x30')](_0x5917aa[_0x5ae1('0x48')][_0x5ae1('0x30')]);}_0x35aa9e[_0x5ae1('0x50')]=qs[_0x5ae1('0x51')](_0x5917aa[_0x5ae1('0x48')][_0x5ae1('0x51')]);_0x35aa9e[_0x5ae1('0x52')]=qs[_0x5ae1('0x49')](_[_0x5ae1('0x53')](_0x5917aa[_0x5ae1('0x48')],_0x2cb6da['filters']));_0x35aa9e[_0x5ae1('0x52')]['FaxAccountId']=_0x56ff79['id'];if(_0x5917aa[_0x5ae1('0x48')]['filter']){_0x35aa9e[_0x5ae1('0x52')]=_['merge'](_0x35aa9e['where'],{'$or':_['map'](_0x35aa9e[_0x5ae1('0x4b')],function(_0x9536b2){var _0xd1b1a1={};_0xd1b1a1[_0x9536b2]={'$like':'%'+_0x5917aa['query'][_0x5ae1('0x54')]+'%'};return _0xd1b1a1;})});}_0x35aa9e=_[_0x5ae1('0x55')]({},_0x35aa9e,_0x5917aa['options']);return db[_0x5ae1('0x70')][_0x5ae1('0x31')]({'where':_0x35aa9e['where']})[_0x5ae1('0x21')](function(_0x5767b7){_0x9fe772[_0x5ae1('0x31')]=_0x5767b7;if(_0x5917aa['query'][_0x5ae1('0x58')]){_0x35aa9e['include']=[{'all':!![]}];}return db[_0x5ae1('0x70')]['findAll'](_0x35aa9e);})['then'](function(_0xbd7f12){_0x9fe772[_0x5ae1('0x5a')]=_0xbd7f12;return _0x9fe772;});}})[_0x5ae1('0x21')](respondWithFilteredResult(_0x514ff5,_0x35aa9e))[_0x5ae1('0x2c')](handleError(_0x514ff5,null));};exports['removeAnswers']=function(_0x5f4675,_0x395e39,_0x2eaabf){return db[_0x5ae1('0x41')][_0x5ae1('0x5f')]({'where':{'id':_0x5f4675['params']['id']}})[_0x5ae1('0x21')](handleEntityNotFound(_0x395e39,null))[_0x5ae1('0x21')](function(_0x37ba28){if(_0x37ba28){return _0x37ba28[_0x5ae1('0x71')](_0x5f4675['query'][_0x5ae1('0x72')]);}})[_0x5ae1('0x21')](respondWithStatusCode(_0x395e39,null))[_0x5ae1('0x2c')](handleError(_0x395e39,null));};exports[_0x5ae1('0x73')]=function(_0x5b6faa,_0x52e55a,_0x3c89d1){return db[_0x5ae1('0x74')][_0x5ae1('0x5f')]({'where':{'id':_0x5b6faa[_0x5ae1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x52e55a,null))[_0x5ae1('0x21')](function(_0x31f872){if(_0x31f872){return _0x31f872['addInteraction'](_0x5b6faa[_0x5ae1('0x61')][_0x5ae1('0x72')],_[_0x5ae1('0x75')](_0x5b6faa[_0x5ae1('0x61')],[_0x5ae1('0x72'),'id'])||{});}})[_0x5ae1('0x21')](respondWithResult(_0x52e55a,null))[_0x5ae1('0x2c')](handleError(_0x52e55a,null));};exports[_0x5ae1('0x76')]=function(_0x16985a,_0x3f95e7,_0x305332){var _0x31c041={'raw':![],'where':{}};var _0x337fe9={};var _0x33985f={'count':0x0,'rows':[]};return db[_0x5ae1('0x41')][_0x5ae1('0x6d')]({'where':{'id':_0x16985a[_0x5ae1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3f95e7,null))['then'](function(_0x3c0e53){if(_0x3c0e53){_0x337fe9[_0x5ae1('0x44')]=_['keys'](db[_0x5ae1('0x74')]['rawAttributes']);_0x337fe9[_0x5ae1('0x48')]=_[_0x5ae1('0x47')](_0x16985a['query']);_0x337fe9[_0x5ae1('0x49')]=_[_0x5ae1('0x4a')](_0x337fe9[_0x5ae1('0x44')],_0x337fe9[_0x5ae1('0x48')]);_0x31c041[_0x5ae1('0x4b')]=_[_0x5ae1('0x4a')](_0x337fe9['model'],qs[_0x5ae1('0x4c')](_0x16985a[_0x5ae1('0x48')][_0x5ae1('0x4c')]));_0x31c041[_0x5ae1('0x4b')]=_0x31c041[_0x5ae1('0x4b')][_0x5ae1('0x4d')]?_0x31c041[_0x5ae1('0x4b')]:_0x337fe9['model'];if(!_0x16985a[_0x5ae1('0x48')][_0x5ae1('0x4e')](_0x5ae1('0x4f'))){_0x31c041[_0x5ae1('0x32')]=qs[_0x5ae1('0x32')](_0x16985a['query'][_0x5ae1('0x32')]);_0x31c041['offset']=qs[_0x5ae1('0x30')](_0x16985a[_0x5ae1('0x48')][_0x5ae1('0x30')]);}_0x31c041[_0x5ae1('0x50')]=qs[_0x5ae1('0x51')](_0x16985a[_0x5ae1('0x48')][_0x5ae1('0x51')]);_0x31c041['where']=qs[_0x5ae1('0x49')](_[_0x5ae1('0x53')](_0x16985a[_0x5ae1('0x48')],_0x337fe9[_0x5ae1('0x49')]));_0x31c041[_0x5ae1('0x52')]['FaxAccountId']=_0x3c0e53['id'];if(_0x16985a[_0x5ae1('0x48')][_0x5ae1('0x54')]){_0x31c041[_0x5ae1('0x52')]=_[_0x5ae1('0x55')](_0x31c041[_0x5ae1('0x52')],{'$or':_['map'](_0x31c041[_0x5ae1('0x4b')],function(_0x12ccd9){var _0x1bdf7a={};_0x1bdf7a[_0x12ccd9]={'$like':'%'+_0x16985a[_0x5ae1('0x48')][_0x5ae1('0x54')]+'%'};return _0x1bdf7a;})});}_0x31c041=_[_0x5ae1('0x55')]({},_0x31c041,_0x16985a['options']);return db['FaxInteraction'][_0x5ae1('0x31')]({'where':_0x31c041[_0x5ae1('0x52')]})[_0x5ae1('0x21')](function(_0xe06cd2){_0x33985f['count']=_0xe06cd2;if(_0x16985a[_0x5ae1('0x48')][_0x5ae1('0x58')]){_0x31c041['include']=[{'model':db['CmContact'],'as':_0x5ae1('0x77'),'required':![]},{'model':db['User'],'as':_0x5ae1('0x78'),'attributes':[_0x5ae1('0x46'),_0x5ae1('0x79'),'internal'],'required':![]},{'model':db[_0x5ae1('0x7a')],'as':_0x5ae1('0x7b'),'attributes':['id',_0x5ae1('0x46'),_0x5ae1('0x7c')],'where':_0x16985a[_0x5ae1('0x48')][_0x5ae1('0x7d')]?{'id':_0x16985a[_0x5ae1('0x48')][_0x5ae1('0x7d')]}:undefined,'required':_0x16985a[_0x5ae1('0x48')][_0x5ae1('0x7d')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x31c041);})[_0x5ae1('0x21')](function(_0x5a0b89){_0x33985f[_0x5ae1('0x5a')]=_0x5a0b89;return _0x33985f;});}})[_0x5ae1('0x21')](respondWithFilteredResult(_0x3f95e7,_0x31c041))[_0x5ae1('0x2c')](handleError(_0x3f95e7,null));};exports[_0x5ae1('0x7e')]=function(_0x201cc7,_0x287aa9,_0x565f4a){return db[_0x5ae1('0x41')][_0x5ae1('0x6d')]({'where':{'id':_0x201cc7[_0x5ae1('0x5c')]['id']}})[_0x5ae1('0x21')](handleEntityNotFound(_0x287aa9,null))[_0x5ae1('0x21')](function(_0x22beb1){if(_0x22beb1){return db[_0x5ae1('0x7f')][_0x5ae1('0x80')](function(_0x11f438){return db[_0x5ae1('0x81')]['destroy']({'where':{'FaxAccountId':_0x201cc7[_0x5ae1('0x5c')]['id']},'transaction':_0x11f438})['then'](function(_0xabad7c){var _0x40c850=_[_0x5ae1('0x45')](_0x201cc7['body'],function(_0x3978a8){_0x3978a8[_0x5ae1('0x6a')]=_0x201cc7[_0x5ae1('0x5c')]['id'];return _0x3978a8;});return db['FaxApplication'][_0x5ae1('0x82')](_0x40c850,{'transaction':_0x11f438});});})[_0x5ae1('0x21')](function(){return db[_0x5ae1('0x81')][_0x5ae1('0x83')]({'where':{'FaxAccountId':_0x201cc7[_0x5ae1('0x5c')]['id']},'order':_0x5ae1('0x84')});});}})[_0x5ae1('0x21')](respondWithResult(_0x287aa9,null))[_0x5ae1('0x2c')](handleError(_0x287aa9,null));};exports['getApplications']=function(_0x4d8f16,_0x4b0cf5,_0x18fcfc){var _0xbad2df={};var _0x3401fb={};var _0xd68f06;var _0x35bcf2;return db[_0x5ae1('0x41')][_0x5ae1('0x6d')]({'where':{'id':_0x4d8f16[_0x5ae1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4b0cf5,null))['then'](function(_0x2f4ad2){if(_0x2f4ad2){_0xd68f06=_0x2f4ad2;_0x3401fb[_0x5ae1('0x44')]=_['keys'](db[_0x5ae1('0x81')][_0x5ae1('0x5d')]);_0x3401fb[_0x5ae1('0x48')]=_[_0x5ae1('0x47')](_0x4d8f16['query']);_0x3401fb[_0x5ae1('0x49')]=_['intersection'](_0x3401fb['model'],_0x3401fb['query']);_0xbad2df[_0x5ae1('0x4b')]=_[_0x5ae1('0x4a')](_0x3401fb['model'],qs[_0x5ae1('0x4c')](_0x4d8f16[_0x5ae1('0x48')]['fields']));_0xbad2df[_0x5ae1('0x4b')]=_0xbad2df[_0x5ae1('0x4b')]['length']?_0xbad2df[_0x5ae1('0x4b')]:_0x3401fb[_0x5ae1('0x44')];_0xbad2df[_0x5ae1('0x50')]=qs[_0x5ae1('0x51')](_0x4d8f16[_0x5ae1('0x48')][_0x5ae1('0x51')]);_0xbad2df[_0x5ae1('0x52')]=qs[_0x5ae1('0x49')](_[_0x5ae1('0x53')](_0x4d8f16['query'],_0x3401fb[_0x5ae1('0x49')]));if(_0x4d8f16[_0x5ae1('0x48')][_0x5ae1('0x54')]){_0xbad2df['where']=_[_0x5ae1('0x55')](_0xbad2df[_0x5ae1('0x52')],{'$or':_['map'](_0xbad2df['attributes'],function(_0x11bb02){var _0x5af781={};_0x5af781[_0x11bb02]={'$like':'%'+_0x4d8f16[_0x5ae1('0x48')][_0x5ae1('0x54')]+'%'};return _0x5af781;})});}_0xbad2df=_['merge']({},_0xbad2df,_0x4d8f16['options']);return _0xd68f06[_0x5ae1('0x85')](_0xbad2df);}})[_0x5ae1('0x21')](function(_0xb5e89){if(_0xb5e89){_0x35bcf2=_0xb5e89[_0x5ae1('0x4d')];if(!_0x4d8f16[_0x5ae1('0x48')][_0x5ae1('0x4e')](_0x5ae1('0x4f'))){_0xbad2df[_0x5ae1('0x32')]=qs[_0x5ae1('0x32')](_0x4d8f16['query'][_0x5ae1('0x32')]);_0xbad2df[_0x5ae1('0x30')]=qs[_0x5ae1('0x30')](_0x4d8f16[_0x5ae1('0x48')]['offset']);}return _0xd68f06[_0x5ae1('0x85')](_0xbad2df);}})[_0x5ae1('0x21')](function(_0x23c89f){if(_0x23c89f){return _0x23c89f?{'count':_0x35bcf2,'rows':_0x23c89f}:null;}})[_0x5ae1('0x21')](respondWithResult(_0x4b0cf5,null))[_0x5ae1('0x2c')](handleError(_0x4b0cf5,null));};function Extension(_0x282086,_0x3d0432,_0x524bd2,_0x1f70d7){this[_0x5ae1('0x86')]=_0x5ae1('0x87');this[_0x5ae1('0x88')]=_0x282086['localstationid'];this['app']=_0x1f70d7;this[_0x5ae1('0x42')]=_0x5ae1('0x89');this['description']='Fax\x20Extension';this[_0x5ae1('0x6a')]=_0x282086['id'];this[_0x5ae1('0x84')]=_0x3d0432;this[_0x5ae1('0x8a')]=_0x524bd2;}function createExtensionsReciveFax(_0x3c6065){var _0x35b8c4=0x1;var _0x496ba3=[];_0x496ba3[_0x5ae1('0x8b')](new Extension(_0x3c6065,_0x35b8c4,'',_0x5ae1('0x8c')));_0x35b8c4+=0x1;_0x496ba3[_0x5ae1('0x8b')](new Extension(_0x3c6065,_0x35b8c4,_0x5ae1('0x8d'),_0x5ae1('0x8e')));_0x35b8c4+=0x1;for(var _0x5771f9 in _0x3c6065){if(_0x3c6065[_0x5ae1('0x4e')](_0x5771f9)&&(_0x5771f9==='ecm'||_0x5771f9===_0x5ae1('0x8f')||_0x5771f9==='gateway'||_0x5771f9===_0x5ae1('0x90')||_0x5771f9===_0x5ae1('0x91')||_0x5771f9===_0x5ae1('0x92')||_0x5771f9===_0x5ae1('0x93')||_0x5771f9===_0x5ae1('0x94')||_0x5771f9===_0x5ae1('0x95'))){_0x496ba3[_0x5ae1('0x8b')](new Extension(_0x3c6065,_0x35b8c4,_0x5ae1('0x96')+_0x5771f9+')='+_0x3c6065[_0x5771f9],_0x5ae1('0x8e')));_0x35b8c4+=0x1;}}_0x496ba3[_0x5ae1('0x8b')](new Extension(_0x3c6065,_0x35b8c4,'6',_0x5ae1('0x97')));_0x35b8c4+=0x1;_0x496ba3[_0x5ae1('0x8b')](new Extension(_0x3c6065,_0x35b8c4,_0x5ae1('0x98'),_0x5ae1('0x99')));_0x35b8c4=0x0;return _0x496ba3;}exports[_0x5ae1('0x9a')]=function(_0x237284,_0x3ac174,_0x1dc12f){var _0x36b98c;return db[_0x5ae1('0x7f')][_0x5ae1('0x80')](function(_0x392466){return db[_0x5ae1('0x41')][_0x5ae1('0x60')](_0x237284[_0x5ae1('0x61')],{'transaction':_0x392466})['then'](function(_0x220b82){_0x36b98c=_0x220b82[_0x5ae1('0x38')]({'plain':!![]});return db[_0x5ae1('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x36b98c),{'transaction':_0x392466});});})[_0x5ae1('0x21')](function(){return _0x36b98c;})[_0x5ae1('0x21')](respondWithResult(_0x3ac174,null))[_0x5ae1('0x2c')](handleError(_0x3ac174,null));};exports[_0x5ae1('0x9c')]=function(_0x56eb4f,_0x2abf6a,_0xf9f8d4){var _0x370bf2;return db[_0x5ae1('0x7f')][_0x5ae1('0x80')](function(_0x19fefb){return db[_0x5ae1('0x41')]['update'](_0x56eb4f[_0x5ae1('0x61')],{'where':{'id':_0x56eb4f['body']['id']},'transaction':_0x19fefb})[_0x5ae1('0x21')](function(_0x1a5905){return db[_0x5ae1('0x9b')][_0x5ae1('0x3b')]({'where':{'FaxAccountId':_0x56eb4f[_0x5ae1('0x61')]['id']},'transaction':_0x19fefb})[_0x5ae1('0x21')](function(_0xfa363f){return db[_0x5ae1('0x9b')][_0x5ae1('0x82')](createExtensionsReciveFax(_[_0x5ae1('0x75')](_0x56eb4f[_0x5ae1('0x61')],[_0x5ae1('0x9d'),_0x5ae1('0x43'),_0x5ae1('0x9e'),_0x5ae1('0x9f'),'TrunkId',_0x5ae1('0xa0')])),{'transaction':_0x19fefb});});});})['then'](function(){return db[_0x5ae1('0x41')][_0x5ae1('0xa1')](_0x56eb4f[_0x5ae1('0x61')]['id']);})[_0x5ae1('0x21')](respondWithResult(_0x2abf6a,null))[_0x5ae1('0x2c')](handleError(_0x2abf6a,null));};exports[_0x5ae1('0xa2')]=function(_0x32a034,_0x33aadf,_0x557296){var _0x2c58a6={'raw':!![],'where':{}};var _0x464258={};var _0x4e3c3b={'count':0x0,'rows':[]};return db[_0x5ae1('0x41')][_0x5ae1('0x6d')]({'where':{'id':_0x32a034['params']['id']}})[_0x5ae1('0x21')](handleEntityNotFound(_0x33aadf,null))[_0x5ae1('0x21')](function(_0x3d52e5){if(_0x3d52e5){_0x464258[_0x5ae1('0x44')]=_[_0x5ae1('0x47')](db[_0x5ae1('0xa3')][_0x5ae1('0x5d')]);_0x464258[_0x5ae1('0x48')]=_[_0x5ae1('0x47')](_0x32a034['query']);_0x464258[_0x5ae1('0x49')]=_[_0x5ae1('0x4a')](_0x464258[_0x5ae1('0x44')],_0x464258[_0x5ae1('0x48')]);_0x2c58a6[_0x5ae1('0x4b')]=_['intersection'](_0x464258['model'],qs['fields'](_0x32a034[_0x5ae1('0x48')][_0x5ae1('0x4c')]));_0x2c58a6[_0x5ae1('0x4b')]=_0x2c58a6[_0x5ae1('0x4b')]['length']?_0x2c58a6[_0x5ae1('0x4b')]:_0x464258[_0x5ae1('0x44')];if(!_0x32a034[_0x5ae1('0x48')]['hasOwnProperty'](_0x5ae1('0x4f'))){_0x2c58a6[_0x5ae1('0x32')]=qs[_0x5ae1('0x32')](_0x32a034[_0x5ae1('0x48')][_0x5ae1('0x32')]);_0x2c58a6[_0x5ae1('0x30')]=qs[_0x5ae1('0x30')](_0x32a034[_0x5ae1('0x48')][_0x5ae1('0x30')]);}_0x2c58a6[_0x5ae1('0x50')]=qs[_0x5ae1('0x51')](_0x32a034['query'][_0x5ae1('0x51')]);_0x2c58a6['where']=qs[_0x5ae1('0x49')](_['pick'](_0x32a034[_0x5ae1('0x48')],_0x464258[_0x5ae1('0x49')]));_0x2c58a6[_0x5ae1('0x52')][_0x5ae1('0x6a')]=_0x3d52e5['id'];if(_0x32a034[_0x5ae1('0x48')]['filter']){_0x2c58a6[_0x5ae1('0x52')]=_[_0x5ae1('0x55')](_0x2c58a6['where'],{'$or':_[_0x5ae1('0x45')](_0x2c58a6['attributes'],function(_0x468406){var _0x5c4510={};_0x5c4510[_0x468406]={'$like':'%'+_0x32a034['query'][_0x5ae1('0x54')]+'%'};return _0x5c4510;})});}if(_0x32a034[_0x5ae1('0x48')][_0x5ae1('0xa4')]){var _0x3b955e=_0x32a034[_0x5ae1('0x48')][_0x5ae1('0xa4')][_0x5ae1('0xa5')](',');var _0x501673={};_0x501673[_0x3b955e[0x0]]={'$gte':moment(_0x3b955e[0x1])[_0x5ae1('0xa6')](_0x5ae1('0xa7'))};_0x2c58a6[_0x5ae1('0x52')]=_['merge'](_0x2c58a6[_0x5ae1('0x52')],_0x501673);}_0x2c58a6=_[_0x5ae1('0x55')]({},_0x2c58a6,_0x32a034['options']);return db[_0x5ae1('0xa3')][_0x5ae1('0x31')]({'where':_0x2c58a6['where']})[_0x5ae1('0x21')](function(_0x18beea){_0x4e3c3b[_0x5ae1('0x31')]=_0x18beea;if(_0x32a034[_0x5ae1('0x48')][_0x5ae1('0x58')]){_0x2c58a6['include']=[{'all':!![]}];}return db['FaxMessage'][_0x5ae1('0x59')](_0x2c58a6);})[_0x5ae1('0x21')](function(_0x4074dd){_0x4e3c3b['rows']=_0x4074dd;return _0x4e3c3b;});}})[_0x5ae1('0x21')](respondWithFilteredResult(_0x33aadf,_0x2c58a6))[_0x5ae1('0x2c')](handleError(_0x33aadf,null));};exports[_0x5ae1('0x3d')]=function(_0x2d4185,_0x5dde5e,_0x2c998d){var _0x3e550e,_0x3d391a={},_0x2bd215;if(_0x2d4185['body']['to']){_0x2bd215=_0x2d4185['body']['to'][0x0];}return db[_0x5ae1('0x41')]['find']({'where':{'id':_0x2d4185[_0x5ae1('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x5ae1('0xa8'),'include':[{'model':db[_0x5ae1('0xa9')],'as':_0x5ae1('0xaa'),'where':{'fax':_0x2bd215},'limit':0x1,'order':[[_0x5ae1('0x9f'),_0x5ae1('0xab')]]}]}]})[_0x5ae1('0x21')](handleEntityNotFound(_0x5dde5e,null))[_0x5ae1('0x21')](function(_0x5b8a7f){_0x3e550e=_0x5b8a7f;if(_0x2d4185[_0x5ae1('0x61')][_0x5ae1('0xac')]&&_0x2d4185[_0x5ae1('0x61')]['attachments'][_0x5ae1('0x4d')]){for(var _0x3c1251=0x0;_0x3c1251<_0x2d4185['body'][_0x5ae1('0xac')][_0x5ae1('0x4d')];_0x3c1251+=0x1){_0x2d4185[_0x5ae1('0x61')][_0x5ae1('0xac')][_0x3c1251]={'filename':_0x2d4185[_0x5ae1('0x61')][_0x5ae1('0xac')][_0x3c1251]['name'],'id':_0x2d4185[_0x5ae1('0x61')]['attachments'][_0x3c1251]['id'],'path':path['join'](config[_0x5ae1('0xad')],_0x5ae1('0xae'),_0x2d4185[_0x5ae1('0x61')]['attachments'][_0x3c1251][_0x5ae1('0xaf')])};}}return respondWithRpcPromise(_0x5ae1('0xb0'),_0x5ae1('0xb0'),{'FaxAccountId':_[_0x5ae1('0xb1')](_0x2d4185['params']['id'])?undefined:_0x2d4185[_0x5ae1('0x5c')]['id'],'path':_[_0x5ae1('0xb1')](_0x2d4185[_0x5ae1('0x61')][_0x5ae1('0xac')][0x0]['path'])?undefined:_0x2d4185[_0x5ae1('0x61')][_0x5ae1('0xac')][0x0]['path'],'fax':_[_0x5ae1('0xb1')](_0x2d4185['body']['to'][0x0])?undefined:_0x2d4185[_0x5ae1('0x61')]['to'][0x0]},client9002);})[_0x5ae1('0x21')](function(){if(_0x3e550e){if(_[_0x5ae1('0xb1')](_0x2d4185[_0x5ae1('0x61')][_0x5ae1('0xb2')])){_0x2d4185['body'][_0x5ae1('0xb2')]=util[_0x5ae1('0xa6')](_0x5ae1('0xb3'),_0x3e550e[_0x5ae1('0x46')],_0x3e550e[_0x5ae1('0xb4')]);}if(_0x3e550e['List']){if(_0x3e550e[_0x5ae1('0xa8')][_0x5ae1('0xaa')][_0x5ae1('0x4d')]){return _0x3e550e[_0x5ae1('0xa8')][_0x5ae1('0xaa')][0x0];}else{return db[_0x5ae1('0xa9')]['create'](_['defaults'](_0x2d4185['body'],{'firstName':_0x2d4185[_0x5ae1('0x61')]['to'][0x0],'phone':_0x2d4185[_0x5ae1('0x61')]['to'][0x0],'fax':_0x2d4185[_0x5ae1('0x61')]['to'][0x0],'ListId':_0x3e550e[_0x5ae1('0xa0')]}));}}else{throw new Error(_0x5ae1('0xb5'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x25eeeb){if(_0x25eeeb){return db[_0x5ae1('0x74')][_0x5ae1('0x5f')]({'where':{'ContactId':_0x25eeeb['id'],'closed':![],'FaxAccountId':_0x3e550e['id']}})['then'](function(_0xd0212f){if(_0xd0212f){return[_0xd0212f,![]];}return db[_0x5ae1('0x74')]['create']({'UserId':_0x2d4185['user']['id'],'ContactId':_0x25eeeb['id'],'FaxAccountId':_0x3e550e['id'],'fax':_0x2d4185[_0x5ae1('0x61')]['to'][0x0],'firstMsgDirection':_0x5ae1('0xb6'),'Messages':[_[_0x5ae1('0x55')](_0x2d4185[_0x5ae1('0x61')],{'read':![],'body':_0x2d4185[_0x5ae1('0x61')][_0x5ae1('0xac')][0x0][_0x5ae1('0xb7')],'FaxAccountId':_0x3e550e['id'],'UserId':_0x2d4185[_0x5ae1('0x62')]['id'],'ContactId':_0x25eeeb['id'],'AttachmentId':_0x2d4185[_0x5ae1('0x61')][_0x5ae1('0xac')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x5ae1('0xb8')}]})[_0x5ae1('0x21')](function(_0x477bde){return[_0x477bde,!![]];});});}else{throw new Error(_0x5ae1('0xb9'));}})['spread'](function(_0x4eef11,_0x5d1ff7){if(_0x5d1ff7){return _0x4eef11;}return db[_0x5ae1('0xa3')][_0x5ae1('0x60')]({'direction':_0x5ae1('0xb6'),'read':![],'body':_0x2d4185['body'][_0x5ae1('0xac')][0x0][_0x5ae1('0xb7')],'FaxAccountId':_0x3e550e['id'],'FaxInteractionId':_0x4eef11['id'],'UserId':_0x2d4185[_0x5ae1('0x62')]['id'],'ContactId':_0x4eef11['ContactId'],'AttachmentId':_0x2d4185[_0x5ae1('0x61')][_0x5ae1('0xac')][0x0]['id']})[_0x5ae1('0x21')](function(_0x349ff1){_0x4eef11[_0x5ae1('0xba')][_0x5ae1('0xb8')]=[];_0x4eef11[_0x5ae1('0xba')]['Messages']['push'](_0x349ff1[_0x5ae1('0xba')]);return _0x4eef11;});})['then'](function(_0x29ce06){respondWithRpcPromise('SendFax',_0x5ae1('0xbb'),{'FaxAccountId':_[_0x5ae1('0xb1')](_0x2d4185['params']['id'])?undefined:_0x2d4185[_0x5ae1('0x5c')]['id'],'path':_['isNil'](_0x2d4185['body'][_0x5ae1('0xac')][0x0][_0x5ae1('0xbc')])?undefined:_0x2d4185[_0x5ae1('0x61')][_0x5ae1('0xac')][0x0][_0x5ae1('0xbc')],'fax':_[_0x5ae1('0xb1')](_0x2d4185[_0x5ae1('0x61')]['to'][0x0])?undefined:_0x2d4185[_0x5ae1('0x61')]['to'][0x0],'AttachmentId':_0x2d4185[_0x5ae1('0x61')][_0x5ae1('0xac')][0x0]['id']},client9002)[_0x5ae1('0x21')](function(_0x1c0843){logger[_0x5ae1('0x22')]('SendFaxRpc,\x20%s',_0x1c0843);})[_0x5ae1('0x2c')](function(_0x487bc2){logger[_0x5ae1('0x22')](_0x5ae1('0xbd'),_0x487bc2);});return _0x29ce06;})['then'](respondWithResult(_0x5dde5e,null))[_0x5ae1('0x2c')](handleError(_0x5dde5e,null));};exports[_0x5ae1('0xbe')]=function(_0x31fbd0,_0x37ebf6,_0x33c231){return db['FaxAccount'][_0x5ae1('0x5f')]({'where':{'id':_0x31fbd0['params']['id']}})[_0x5ae1('0x21')](handleEntityNotFound(_0x37ebf6,null))[_0x5ae1('0x21')](function(_0x1f4528){if(_0x1f4528){return _0x1f4528[_0x5ae1('0xbe')](_0x31fbd0[_0x5ae1('0x61')][_0x5ae1('0x72')],_['omit'](_0x31fbd0[_0x5ae1('0x61')],[_0x5ae1('0x72'),'id'])||{})[_0x5ae1('0xbf')](function(_0xfaeb26){for(var _0x262c3c=0x0;_0x262c3c<_0x31fbd0[_0x5ae1('0x61')][_0x5ae1('0x72')][_0x5ae1('0x4d')];_0x262c3c+=0x1){socket['emit'](_0x5ae1('0xc0'),{'UserId':Number(_0x31fbd0[_0x5ae1('0x61')][_0x5ae1('0x72')][_0x262c3c]),'FaxAccountId':Number(_0x31fbd0[_0x5ae1('0x5c')]['id'])});}return _0xfaeb26;});}})['then'](respondWithResult(_0x37ebf6,null))['catch'](handleError(_0x37ebf6,null));};exports[_0x5ae1('0xc1')]=function(_0x3efc93,_0xb01116,_0x49c053){return db[_0x5ae1('0x41')][_0x5ae1('0x5f')]({'where':{'id':_0x3efc93[_0x5ae1('0x5c')]['id']}})['then'](handleEntityNotFound(_0xb01116,null))[_0x5ae1('0x21')](function(_0x4e138b){if(_0x4e138b){return _0x4e138b[_0x5ae1('0xc1')](_0x3efc93['query']['ids'])[_0x5ae1('0x21')](function(){if(_[_0x5ae1('0xc2')](_0x3efc93[_0x5ae1('0x48')]['ids'])){for(var _0x5c0d6d=0x0;_0x5c0d6d<_0x3efc93[_0x5ae1('0x48')][_0x5ae1('0x72')][_0x5ae1('0x4d')];_0x5c0d6d+=0x1){socket[_0x5ae1('0xc3')](_0x5ae1('0xc4'),{'UserId':Number(_0x3efc93[_0x5ae1('0x48')]['ids'][_0x5c0d6d]),'FaxAccountId':Number(_0x3efc93[_0x5ae1('0x5c')]['id'])});}}else{socket[_0x5ae1('0xc3')]('userFaxAccount:remove',{'UserId':Number(_0x3efc93[_0x5ae1('0x48')][_0x5ae1('0x72')]),'FaxAccountId':Number(_0x3efc93['params']['id'])});}});}})['then'](respondWithStatusCode(_0xb01116,null))[_0x5ae1('0x2c')](handleError(_0xb01116,null));};exports[_0x5ae1('0xc5')]=function(_0x2dfa38,_0xc9b0a6,_0x152af9){var _0x5428e6={};var _0x5706bc={};var _0x468659;var _0x40683f;return db['FaxAccount']['findOne']({'where':{'id':_0x2dfa38[_0x5ae1('0x5c')]['id']}})['then'](handleEntityNotFound(_0xc9b0a6,null))[_0x5ae1('0x21')](function(_0x50ad14){if(_0x50ad14){_0x468659=_0x50ad14;_0x5706bc['model']=_[_0x5ae1('0x47')](db[_0x5ae1('0xc6')][_0x5ae1('0x5d')]);_0x5706bc[_0x5ae1('0x48')]=_[_0x5ae1('0x47')](_0x2dfa38[_0x5ae1('0x48')]);_0x5706bc['filters']=_[_0x5ae1('0x4a')](_0x5706bc[_0x5ae1('0x44')],_0x5706bc[_0x5ae1('0x48')]);_0x5428e6['attributes']=_[_0x5ae1('0x4a')](_0x5706bc['model'],qs[_0x5ae1('0x4c')](_0x2dfa38['query'][_0x5ae1('0x4c')]));_0x5428e6[_0x5ae1('0x4b')]=_0x5428e6[_0x5ae1('0x4b')][_0x5ae1('0x4d')]?_0x5428e6['attributes']:_0x5706bc[_0x5ae1('0x44')];_0x5428e6[_0x5ae1('0x50')]=qs[_0x5ae1('0x51')](_0x2dfa38[_0x5ae1('0x48')][_0x5ae1('0x51')]);_0x5428e6[_0x5ae1('0x52')]=qs[_0x5ae1('0x49')](_[_0x5ae1('0x53')](_0x2dfa38[_0x5ae1('0x48')],_0x5706bc[_0x5ae1('0x49')]));if(_0x2dfa38['query']['filter']){_0x5428e6[_0x5ae1('0x52')]=_['merge'](_0x5428e6[_0x5ae1('0x52')],{'$or':_[_0x5ae1('0x45')](_0x5428e6[_0x5ae1('0x4b')],function(_0x179454){var _0x496a96={};_0x496a96[_0x179454]={'$like':'%'+_0x2dfa38['query']['filter']+'%'};return _0x496a96;})});}_0x5428e6=_[_0x5ae1('0x55')]({},_0x5428e6,_0x2dfa38['options']);return _0x468659['getAgents'](_0x5428e6);}})[_0x5ae1('0x21')](function(_0x449100){if(_0x449100){_0x40683f=_0x449100['length'];if(!_0x2dfa38['query'][_0x5ae1('0x4e')](_0x5ae1('0x4f'))){_0x5428e6['limit']=qs[_0x5ae1('0x32')](_0x2dfa38['query'][_0x5ae1('0x32')]);_0x5428e6[_0x5ae1('0x30')]=qs[_0x5ae1('0x30')](_0x2dfa38['query'][_0x5ae1('0x30')]);}return _0x468659[_0x5ae1('0xc5')](_0x5428e6);}})[_0x5ae1('0x21')](function(_0x2c3b84){if(_0x2c3b84){return _0x2c3b84?{'count':_0x40683f,'rows':_0x2c3b84}:null;}})[_0x5ae1('0x21')](respondWithResult(_0xc9b0a6,null))[_0x5ae1('0x2c')](handleError(_0xc9b0a6,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index d9942ce..4472fce 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 _0xfda1=['events','../../mysqldb','FaxAccount','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfda1,0x1a7));var _0x1fda=function(_0x4859ff,_0x1b0362){_0x4859ff=_0x4859ff-0x0;var _0x446603=_0xfda1[_0x4859ff];return _0x446603;};'use strict';var EventEmitter=require(_0x1fda('0x0'));var FaxAccount=require(_0x1fda('0x1'))['db'][_0x1fda('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x1fda('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1fda('0x4')};function emitEvent(_0x1dc27d){return function(_0x2871b1,_0x4ab091,_0x48494e){FaxAccountEvents[_0x1fda('0x5')](_0x1dc27d+':'+_0x2871b1['id'],_0x2871b1);FaxAccountEvents['emit'](_0x1dc27d,_0x2871b1);_0x48494e(null);};}for(var e in events){if(events[_0x1fda('0x6')](e)){var event=events[e];FaxAccount[_0x1fda('0x7')](e,emitEvent(event));}}module[_0x1fda('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x6706=['remove','emit','exports','../../mysqldb','FaxAccount','setMaxListeners','update'];(function(_0xe78eff,_0x28c974){var _0x1c83a9=function(_0x349364){while(--_0x349364){_0xe78eff['push'](_0xe78eff['shift']());}};_0x1c83a9(++_0x28c974);}(_0x6706,0x114));var _0x6670=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6706[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x6670('0x0'))['db'][_0x6670('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x6670('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6670('0x3'),'afterDestroy':_0x6670('0x4')};function emitEvent(_0x1e698e){return function(_0x12d810,_0x5ca3f7,_0x38a069){FaxAccountEvents[_0x6670('0x5')](_0x1e698e+':'+_0x12d810['id'],_0x12d810);FaxAccountEvents[_0x6670('0x5')](_0x1e698e,_0x12d810);_0x38a069(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x6670('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 29bb285..7649116 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 _0x8848=['bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','define','fax_accounts','../../config/logger','api'];(function(_0x430035,_0x5e2788){var _0x223968=function(_0x4211b5){while(--_0x4211b5){_0x430035['push'](_0x430035['shift']());}};_0x223968(++_0x5e2788);}(_0x8848,0x1c0));var _0x8884=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x8848[_0x5f3f88];return _0xd08119;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8884('0x0'))(_0x8884('0x1'));var moment=require('moment');var BPromise=require(_0x8884('0x2'));var rp=require(_0x8884('0x3'));var fs=require('fs');var path=require(_0x8884('0x4'));var rimraf=require(_0x8884('0x5'));var config=require('../../config/environment');var attributes=require(_0x8884('0x6'));module[_0x8884('0x7')]=function(_0x3b04ee,_0x2dfae3){return _0x3b04ee[_0x8884('0x8')]('FaxAccount',attributes,{'tableName':_0x8884('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4be=['moment','bluebird','request-promise','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api'];(function(_0x3d3111,_0x2b43fd){var _0x5e7112=function(_0x12c23a){while(--_0x12c23a){_0x3d3111['push'](_0x3d3111['shift']());}};_0x5e7112(++_0x2b43fd);}(_0xb4be,0x11a));var _0xeb4b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb4be[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xeb4b('0x0'));var util=require(_0xeb4b('0x1'));var logger=require(_0xeb4b('0x2'))(_0xeb4b('0x3'));var moment=require(_0xeb4b('0x4'));var BPromise=require(_0xeb4b('0x5'));var rp=require(_0xeb4b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xeb4b('0x7')]=function(_0x1c1d1f,_0x58b48a){return _0x1c1d1f[_0xeb4b('0x8')](_0xeb4b('0x9'),attributes,{'tableName':_0xeb4b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 7855fae..326b223 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 _0xaa4d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','register','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','FaxAccount','findAll','options','where','attributes','include','model','map','then','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','mapKey','includes','account','CmList','DESC','FaxApplication','Applications','List','applications','list','orderBy','Contacts','length','create','contact','FaxInteraction','Contact\x20not\x20found','get','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','UserId','find','name','unshift','waitForTheAssignedAgent','startRouting','Start','util','moment','randomstring'];(function(_0x289837,_0x492605){var _0x243004=function(_0x548f3f){while(--_0x548f3f){_0x289837['push'](_0x289837['shift']());}};_0x243004(++_0x492605);}(_0xaa4d,0x14d));var _0xdaa4=function(_0x190725,_0x4c879f){_0x190725=_0x190725-0x0;var _0x4fe2de=_0xaa4d[_0x190725];return _0x4fe2de;};'use strict';var _=require('lodash');var util=require(_0xdaa4('0x0'));var moment=require(_0xdaa4('0x1'));var BPromise=require('bluebird');var rs=require(_0xdaa4('0x2'));var fs=require('fs');var Redis=require(_0xdaa4('0x3'));var db=require(_0xdaa4('0x4'))['db'];var utils=require(_0xdaa4('0x5'));var logger=require(_0xdaa4('0x6'))(_0xdaa4('0x7'));var config=require('../../config/environment');var jayson=require(_0xdaa4('0x8'));var client=jayson[_0xdaa4('0x9')][_0xdaa4('0xa')]({'port':0x232c});config['redis']=_[_0xdaa4('0xb')](config[_0xdaa4('0xc')],{'host':_0xdaa4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdaa4('0xc')]));require('./faxAccount.socket')[_0xdaa4('0xe')](socket);function respondWithRpcPromise(_0x1ba6ce,_0x367784,_0x2d91c0){return new BPromise(function(_0x2dfafd,_0x14f85e){return client[_0xdaa4('0xf')](_0x1ba6ce,_0x2d91c0)['then'](function(_0x32261c){logger['info'](_0xdaa4('0x10'),_0x367784,_0xdaa4('0x11'));logger[_0xdaa4('0x12')](_0xdaa4('0x13'),_0x367784,_0xdaa4('0x11'),JSON[_0xdaa4('0x14')](_0x32261c));if(_0x32261c[_0xdaa4('0x15')]){if(_0x32261c[_0xdaa4('0x15')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x367784,_0x32261c['error'][_0xdaa4('0x16')]);return _0x14f85e(_0x32261c['error'][_0xdaa4('0x16')]);}logger[_0xdaa4('0x15')](_0xdaa4('0x10'),_0x367784,_0x32261c[_0xdaa4('0x15')]['message']);return _0x2dfafd(_0x32261c[_0xdaa4('0x15')][_0xdaa4('0x16')]);}else{logger[_0xdaa4('0x17')](_0xdaa4('0x10'),_0x367784,_0xdaa4('0x11'));_0x2dfafd(_0x32261c[_0xdaa4('0x18')][_0xdaa4('0x16')]);}})[_0xdaa4('0x19')](function(_0xc54658){logger['error'](_0xdaa4('0x10'),_0x367784,_0xc54658);_0x14f85e(_0xc54658);});});}exports['GetFaxAccount']=function(_0x824ef){var _0x2aa1e5=this;return new Promise(function(_0x166301,_0x4cf977){return db[_0xdaa4('0x1a')][_0xdaa4('0x1b')]({'raw':_0x824ef[_0xdaa4('0x1c')]?_0x824ef[_0xdaa4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x824ef[_0xdaa4('0x1c')]?_0x824ef['options'][_0xdaa4('0x1d')]||null:null,'attributes':_0x824ef[_0xdaa4('0x1c')]?_0x824ef[_0xdaa4('0x1c')][_0xdaa4('0x1e')]||null:null,'limit':_0x824ef[_0xdaa4('0x1c')]?_0x824ef[_0xdaa4('0x1c')]['limit']||null:null,'include':_0x824ef['options']?_0x824ef[_0xdaa4('0x1c')][_0xdaa4('0x1f')]?_['map'](_0x824ef[_0xdaa4('0x1c')]['include'],function(_0x5cff63){return{'model':db[_0x5cff63[_0xdaa4('0x20')]],'as':_0x5cff63['as'],'attributes':_0x5cff63['attributes'],'include':_0x5cff63[_0xdaa4('0x1f')]?_[_0xdaa4('0x21')](_0x5cff63['include'],function(_0x18b504){return{'model':db[_0x18b504[_0xdaa4('0x20')]],'as':_0x18b504['as'],'attributes':_0x18b504[_0xdaa4('0x1e')],'include':_0x18b504['include']?_[_0xdaa4('0x21')](_0x18b504['include'],function(_0x28e46b){return{'model':db[_0x28e46b[_0xdaa4('0x20')]],'as':_0x28e46b['as'],'attributes':_0x28e46b[_0xdaa4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdaa4('0x22')](function(_0x2ffa9a){logger[_0xdaa4('0x17')](_0xdaa4('0x23'),_0x824ef);logger['debug'](_0xdaa4('0x23'),_0x824ef,JSON['stringify'](_0x2ffa9a));_0x166301(_0x2ffa9a);})[_0xdaa4('0x19')](function(_0x5e667d){logger[_0xdaa4('0x15')]('GetFaxAccount',_0x5e667d[_0xdaa4('0x16')],_0x824ef);_0x4cf977(_0x2aa1e5[_0xdaa4('0x15')](0x1f4,_0x5e667d[_0xdaa4('0x16')]));});});};exports[_0xdaa4('0x24')]=function(_0x44a0c2,_0x37c593,_0x25bf24){var _0x5a03ee=this;return new Promise(function(_0x1ac36b,_0x511bd4){var _0x35cf52={'body':_0x44a0c2[_0xdaa4('0x25')],'channel':_0xdaa4('0x26')};var _0x73888c=[];var _0x1a3a4f=[];var _0x2f915a={};return db[_0xdaa4('0x27')][_0xdaa4('0x28')]()[_0xdaa4('0x22')](function(_0x2979ae){if(!_0x2979ae){throw new db['Sequelize'][(_0xdaa4('0x29'))](_0xdaa4('0x2a'));}_0x73888c=_[_0xdaa4('0x2b')](_['keys'](_0x2979ae),[_0xdaa4('0x2c'),'updatedAt']);_0x1a3a4f=_[_0xdaa4('0x2b')](_['keys'](_0x2979ae),['createdAt',_0xdaa4('0x2d'),_0xdaa4('0x2e'),_0xdaa4('0x2f')]);if(_0x44a0c2[_0xdaa4('0x25')]['id']){delete _0x44a0c2[_0xdaa4('0x25')]['id'];}if(_['isNil'](_0x44a0c2[_0xdaa4('0x25')][_0xdaa4('0x30')])){throw new db[(_0xdaa4('0x31'))][(_0xdaa4('0x29'))](_0xdaa4('0x32'));}if(_[_0xdaa4('0x33')](_0x44a0c2[_0xdaa4('0x25')][_0xdaa4('0x25')])||_0x44a0c2[_0xdaa4('0x25')][_0xdaa4('0x25')]===''){throw new db['Sequelize'][(_0xdaa4('0x29'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x44a0c2[_0xdaa4('0x25')][_0xdaa4('0x34')])){throw new db[(_0xdaa4('0x31'))][(_0xdaa4('0x29'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1a3a4f);}if(!_[_0xdaa4('0x35')](_0x1a3a4f,_0x44a0c2[_0xdaa4('0x25')][_0xdaa4('0x34')])){throw new db[(_0xdaa4('0x31'))][(_0xdaa4('0x29'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1a3a4f);}_0x2f915a[_0x44a0c2[_0xdaa4('0x25')][_0xdaa4('0x34')]]=_0x44a0c2['body'][_0xdaa4('0x30')];})[_0xdaa4('0x22')](function(){return db['FaxAccount']['find']({'where':{'id':_0x44a0c2[_0xdaa4('0x36')]['id']},'include':[{'model':db[_0xdaa4('0x37')],'as':'List','include':[{'model':db[_0xdaa4('0x27')],'as':'Contacts','where':_0x2f915a,'limit':0x1,'order':[[_0xdaa4('0x2d'),_0xdaa4('0x38')]]}]},{'model':db[_0xdaa4('0x39')],'as':_0xdaa4('0x3a')}]});})['then'](function(_0x4dc8ce){if(_0x4dc8ce&&_0x4dc8ce[_0xdaa4('0x3b')]){var _0x4d0dff=_0x4dc8ce['get']({'plain':!![]});_0x35cf52[_0xdaa4('0x36')]=_0x4d0dff;_0x35cf52[_0xdaa4('0x3c')]=_0x4d0dff[_0xdaa4('0x3a')];_0x35cf52[_0xdaa4('0x3d')]=_0x4d0dff[_0xdaa4('0x3b')];_0x35cf52[_0xdaa4('0x3c')]=_[_0xdaa4('0x3e')](_0x35cf52[_0xdaa4('0x3c')],['priority'],['asc']);if(_0x35cf52['account']['Applications']){delete _0x35cf52[_0xdaa4('0x36')]['Applications'];}if(_0x35cf52['account'][_0xdaa4('0x3b')]&&_0x35cf52[_0xdaa4('0x36')][_0xdaa4('0x3b')][_0xdaa4('0x3f')][_0xdaa4('0x40')]){return _0x35cf52[_0xdaa4('0x36')]['List']['Contacts'][0x0];}var _0x6d0746=_[_0xdaa4('0xb')](_0x44a0c2[_0xdaa4('0x25')],{'firstName':_0x44a0c2['body'][_0xdaa4('0x30')],'ListId':_0x4d0dff[_0xdaa4('0x2f')]});_0x6d0746[_0x44a0c2[_0xdaa4('0x25')][_0xdaa4('0x34')]]=_0x44a0c2[_0xdaa4('0x25')][_0xdaa4('0x30')];return db[_0xdaa4('0x27')][_0xdaa4('0x41')](_0x6d0746,{'fields':_0x73888c,'raw':!![]});}})[_0xdaa4('0x22')](function(_0xb52997){_0x35cf52[_0xdaa4('0x42')]=_0xb52997;if(_0xb52997){var _0x17ddb0={'ContactId':_0xb52997['id'],'FaxAccountId':_0x44a0c2[_0xdaa4('0x36')]['id'],'fax':_0xb52997['fax']};return db[_0xdaa4('0x43')]['find']({'where':{'ContactId':_0xb52997['id'],'closed':![],'FaxAccountId':_0x44a0c2[_0xdaa4('0x36')]['id']}})[_0xdaa4('0x22')](function(_0x236e64){if(_0x236e64){return[_0x236e64,![]];}return db[_0xdaa4('0x43')]['create'](_0x17ddb0)[_0xdaa4('0x22')](function(_0x5190b7){return[_0x5190b7,!![]];});});}else{throw new Error(_0xdaa4('0x44'));}})['spread'](function(_0x2dc4b1,_0x282fa4){var _0x163070=_0x2dc4b1[_0xdaa4('0x45')]({'plain':!![]});if(_0x282fa4){if(_0x35cf52['account'][_0xdaa4('0x46')]){_0x35cf52[_0xdaa4('0x3c')][_0xdaa4('0x47')]({'id':0x0,'priority':_0x35cf52['applications'][_0xdaa4('0x40')]+0x1,'app':_0xdaa4('0x48'),'appdata':_0xdaa4('0x49'),'interval':_0xdaa4('0x4a')});}_0x163070['created']=!![];}else{_0x163070[_0xdaa4('0x4b')]=![];}_0x35cf52['interaction']=_0x163070;return db['FaxMessage'][_0xdaa4('0x41')]({'body':_0x44a0c2['body']['body'],'FaxAccountId':_0x44a0c2[_0xdaa4('0x36')]['id'],'FaxInteractionId':_0x2dc4b1['id'],'direction':'in','ContactId':_0x2dc4b1['ContactId'],'AttachmentId':_0x44a0c2[_0xdaa4('0x25')]['AttachmentId']});})[_0xdaa4('0x22')](function(_0x2e3781){_0x35cf52[_0xdaa4('0x16')]=_0x2e3781;if(_0x35cf52[_0xdaa4('0x4c')][_0xdaa4('0x4d')]){return db['User'][_0xdaa4('0x4e')]({'attributes':['id',_0xdaa4('0x4f')],'where':{'id':_0x35cf52[_0xdaa4('0x4c')][_0xdaa4('0x4d')]}})[_0xdaa4('0x22')](function(_0xf0bb41){if(_0xf0bb41){_0x35cf52[_0xdaa4('0x3c')][_0xdaa4('0x50')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xf0bb41['name']+','+(_0x35cf52[_0xdaa4('0x36')][_0xdaa4('0x51')]||0xa),'interval':_0xdaa4('0x4a')});}return respondWithRpcPromise('Start',_0xdaa4('0x52'),_0x35cf52);});}return respondWithRpcPromise(_0xdaa4('0x53'),_0xdaa4('0x52'),_0x35cf52);})['then'](function(_0x4e528a){_0x1ac36b(_0x4e528a);})[_0xdaa4('0x19')](function(_0x1b6e86){_0x511bd4(_0x5a03ee[_0xdaa4('0x15')](0x1f4,_0x1b6e86[_0xdaa4('0x16')]));});});}; \ No newline at end of file +var _0xf680=['register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','NotifyFaxAccount','fax','CmContact','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','body','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','FaxAccount','find','account','CmList','List','Contacts','updatedAt','DESC','Applications','get','list','applications','orderBy','priority','asc','length','ListId','contact','FaxInteraction','create','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./faxAccount.socket'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xf680,0x10e));var _0x0f68=function(_0x3c8a1d,_0x518b71){_0x3c8a1d=_0x3c8a1d-0x0;var _0x1347c2=_0xf680[_0x3c8a1d];return _0x1347c2;};'use strict';var _=require(_0x0f68('0x0'));var util=require(_0x0f68('0x1'));var moment=require(_0x0f68('0x2'));var BPromise=require(_0x0f68('0x3'));var rs=require(_0x0f68('0x4'));var fs=require('fs');var Redis=require(_0x0f68('0x5'));var db=require(_0x0f68('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f68('0x7'))(_0x0f68('0x8'));var config=require('../../config/environment');var jayson=require(_0x0f68('0x9'));var client=jayson['client'][_0x0f68('0xa')]({'port':0x232c});config[_0x0f68('0xb')]=_[_0x0f68('0xc')](config[_0x0f68('0xb')],{'host':_0x0f68('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0f68('0xe'))[_0x0f68('0xf')](socket);function respondWithRpcPromise(_0x4da8e3,_0x15e483,_0x3612f4){return new BPromise(function(_0x402d1f,_0xa6c85c){return client[_0x0f68('0x10')](_0x4da8e3,_0x3612f4)[_0x0f68('0x11')](function(_0x49d1f1){logger[_0x0f68('0x12')](_0x0f68('0x13'),_0x15e483,_0x0f68('0x14'));logger[_0x0f68('0x15')](_0x0f68('0x16'),_0x15e483,'request\x20sent',JSON[_0x0f68('0x17')](_0x49d1f1));if(_0x49d1f1[_0x0f68('0x18')]){if(_0x49d1f1['error'][_0x0f68('0x19')]===0x1f4){logger[_0x0f68('0x18')](_0x0f68('0x13'),_0x15e483,_0x49d1f1['error'][_0x0f68('0x1a')]);return _0xa6c85c(_0x49d1f1[_0x0f68('0x18')]['message']);}logger[_0x0f68('0x18')]('FaxAccount,\x20%s,\x20%s',_0x15e483,_0x49d1f1[_0x0f68('0x18')][_0x0f68('0x1a')]);return _0x402d1f(_0x49d1f1[_0x0f68('0x18')][_0x0f68('0x1a')]);}else{logger[_0x0f68('0x12')]('FaxAccount,\x20%s,\x20%s',_0x15e483,_0x0f68('0x14'));_0x402d1f(_0x49d1f1['result']['message']);}})['catch'](function(_0x66dc30){logger[_0x0f68('0x18')](_0x0f68('0x13'),_0x15e483,_0x66dc30);_0xa6c85c(_0x66dc30);});});}exports[_0x0f68('0x1b')]=function(_0x3f6046){var _0x55209c=this;return new Promise(function(_0xc38689,_0x314c2b){return db['FaxAccount'][_0x0f68('0x1c')]({'raw':_0x3f6046[_0x0f68('0x1d')]?_0x3f6046[_0x0f68('0x1d')][_0x0f68('0x1e')]===undefined?!![]:![]:!![],'where':_0x3f6046[_0x0f68('0x1d')]?_0x3f6046[_0x0f68('0x1d')][_0x0f68('0x1f')]||null:null,'attributes':_0x3f6046['options']?_0x3f6046[_0x0f68('0x1d')][_0x0f68('0x20')]||null:null,'limit':_0x3f6046[_0x0f68('0x1d')]?_0x3f6046[_0x0f68('0x1d')][_0x0f68('0x21')]||null:null,'include':_0x3f6046[_0x0f68('0x1d')]?_0x3f6046['options']['include']?_[_0x0f68('0x22')](_0x3f6046['options'][_0x0f68('0x23')],function(_0x22ccbb){return{'model':db[_0x22ccbb[_0x0f68('0x24')]],'as':_0x22ccbb['as'],'attributes':_0x22ccbb['attributes'],'include':_0x22ccbb['include']?_[_0x0f68('0x22')](_0x22ccbb[_0x0f68('0x23')],function(_0x5282b7){return{'model':db[_0x5282b7[_0x0f68('0x24')]],'as':_0x5282b7['as'],'attributes':_0x5282b7[_0x0f68('0x20')],'include':_0x5282b7['include']?_[_0x0f68('0x22')](_0x5282b7['include'],function(_0x41c219){return{'model':db[_0x41c219[_0x0f68('0x24')]],'as':_0x41c219['as'],'attributes':_0x41c219[_0x0f68('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0f68('0x11')](function(_0x1ee953){logger['info']('GetFaxAccount',_0x3f6046);logger['debug']('GetFaxAccount',_0x3f6046,JSON[_0x0f68('0x17')](_0x1ee953));_0xc38689(_0x1ee953);})[_0x0f68('0x25')](function(_0x4c0c83){logger[_0x0f68('0x18')](_0x0f68('0x1b'),_0x4c0c83[_0x0f68('0x1a')],_0x3f6046);_0x314c2b(_0x55209c[_0x0f68('0x18')](0x1f4,_0x4c0c83[_0x0f68('0x1a')]));});});};exports[_0x0f68('0x26')]=function(_0x374ccb,_0x41b5d7,_0x2b0ba2){var _0x467a49=this;return new Promise(function(_0x280679,_0x96dec4){var _0x55fd5d={'body':_0x374ccb['body'],'channel':_0x0f68('0x27')};var _0x5663bb=[];var _0x594ed1=[];var _0x90ab84={};return db[_0x0f68('0x28')]['describe']()[_0x0f68('0x11')](function(_0x8fb53f){if(!_0x8fb53f){throw new db[(_0x0f68('0x29'))]['ValidationError'](_0x0f68('0x2a'));}_0x5663bb=_[_0x0f68('0x2b')](_[_0x0f68('0x2c')](_0x8fb53f),[_0x0f68('0x2d'),'updatedAt']);_0x594ed1=_[_0x0f68('0x2b')](_['keys'](_0x8fb53f),[_0x0f68('0x2d'),'updatedAt','CompanyId','ListId']);if(_0x374ccb[_0x0f68('0x2e')]['id']){delete _0x374ccb['body']['id'];}if(_[_0x0f68('0x2f')](_0x374ccb[_0x0f68('0x2e')][_0x0f68('0x30')])){throw new db['Sequelize'][(_0x0f68('0x31'))](_0x0f68('0x32'));}if(_[_0x0f68('0x2f')](_0x374ccb[_0x0f68('0x2e')][_0x0f68('0x2e')])||_0x374ccb['body']['body']===''){throw new db[(_0x0f68('0x29'))][(_0x0f68('0x31'))](_0x0f68('0x33'));}if(_[_0x0f68('0x2f')](_0x374ccb['body']['mapKey'])){throw new db['Sequelize'][(_0x0f68('0x31'))](_0x0f68('0x34')+_0x594ed1);}if(!_[_0x0f68('0x35')](_0x594ed1,_0x374ccb['body']['mapKey'])){throw new db[(_0x0f68('0x29'))][(_0x0f68('0x31'))](_0x0f68('0x36')+_0x594ed1);}_0x90ab84[_0x374ccb[_0x0f68('0x2e')][_0x0f68('0x37')]]=_0x374ccb[_0x0f68('0x2e')][_0x0f68('0x30')];})[_0x0f68('0x11')](function(){return db[_0x0f68('0x38')][_0x0f68('0x39')]({'where':{'id':_0x374ccb[_0x0f68('0x3a')]['id']},'include':[{'model':db[_0x0f68('0x3b')],'as':_0x0f68('0x3c'),'include':[{'model':db[_0x0f68('0x28')],'as':_0x0f68('0x3d'),'where':_0x90ab84,'limit':0x1,'order':[[_0x0f68('0x3e'),_0x0f68('0x3f')]]}]},{'model':db['FaxApplication'],'as':_0x0f68('0x40')}]});})[_0x0f68('0x11')](function(_0x22beae){if(_0x22beae&&_0x22beae[_0x0f68('0x3c')]){var _0x53053c=_0x22beae[_0x0f68('0x41')]({'plain':!![]});_0x55fd5d[_0x0f68('0x3a')]=_0x53053c;_0x55fd5d['applications']=_0x53053c[_0x0f68('0x40')];_0x55fd5d[_0x0f68('0x42')]=_0x53053c[_0x0f68('0x3c')];_0x55fd5d[_0x0f68('0x43')]=_[_0x0f68('0x44')](_0x55fd5d['applications'],[_0x0f68('0x45')],[_0x0f68('0x46')]);if(_0x55fd5d[_0x0f68('0x3a')][_0x0f68('0x40')]){delete _0x55fd5d[_0x0f68('0x3a')]['Applications'];}if(_0x55fd5d['account'][_0x0f68('0x3c')]&&_0x55fd5d[_0x0f68('0x3a')][_0x0f68('0x3c')]['Contacts'][_0x0f68('0x47')]){return _0x55fd5d[_0x0f68('0x3a')]['List'][_0x0f68('0x3d')][0x0];}var _0x3d4781=_[_0x0f68('0xc')](_0x374ccb[_0x0f68('0x2e')],{'firstName':_0x374ccb[_0x0f68('0x2e')][_0x0f68('0x30')],'ListId':_0x53053c[_0x0f68('0x48')]});_0x3d4781[_0x374ccb[_0x0f68('0x2e')][_0x0f68('0x37')]]=_0x374ccb[_0x0f68('0x2e')][_0x0f68('0x30')];return db[_0x0f68('0x28')]['create'](_0x3d4781,{'fields':_0x5663bb,'raw':!![]});}})[_0x0f68('0x11')](function(_0x3e5aed){_0x55fd5d[_0x0f68('0x49')]=_0x3e5aed;if(_0x3e5aed){var _0x3782c7={'ContactId':_0x3e5aed['id'],'FaxAccountId':_0x374ccb[_0x0f68('0x3a')]['id'],'fax':_0x3e5aed[_0x0f68('0x27')]};return db[_0x0f68('0x4a')]['find']({'where':{'ContactId':_0x3e5aed['id'],'closed':![],'FaxAccountId':_0x374ccb[_0x0f68('0x3a')]['id']}})['then'](function(_0x7ef3b7){if(_0x7ef3b7){return[_0x7ef3b7,![]];}return db[_0x0f68('0x4a')][_0x0f68('0x4b')](_0x3782c7)[_0x0f68('0x11')](function(_0x39ac50){return[_0x39ac50,!![]];});});}else{throw new Error(_0x0f68('0x4c'));}})[_0x0f68('0x4d')](function(_0x2f349a,_0x5499bd){var _0x1b7974=_0x2f349a[_0x0f68('0x41')]({'plain':!![]});if(_0x5499bd){if(_0x55fd5d[_0x0f68('0x3a')]['autoclose']){_0x55fd5d[_0x0f68('0x43')][_0x0f68('0x4e')]({'id':0x0,'priority':_0x55fd5d[_0x0f68('0x43')]['length']+0x1,'app':_0x0f68('0x4f'),'appdata':_0x0f68('0x50'),'interval':_0x0f68('0x51')});}_0x1b7974[_0x0f68('0x52')]=!![];}else{_0x1b7974[_0x0f68('0x52')]=![];}_0x55fd5d['interaction']=_0x1b7974;return db[_0x0f68('0x53')][_0x0f68('0x4b')]({'body':_0x374ccb[_0x0f68('0x2e')][_0x0f68('0x2e')],'FaxAccountId':_0x374ccb[_0x0f68('0x3a')]['id'],'FaxInteractionId':_0x2f349a['id'],'direction':'in','ContactId':_0x2f349a[_0x0f68('0x54')],'AttachmentId':_0x374ccb[_0x0f68('0x2e')][_0x0f68('0x55')]});})[_0x0f68('0x11')](function(_0x406ca1){_0x55fd5d[_0x0f68('0x1a')]=_0x406ca1;if(_0x55fd5d[_0x0f68('0x56')][_0x0f68('0x57')]){return db[_0x0f68('0x58')][_0x0f68('0x39')]({'attributes':['id',_0x0f68('0x59')],'where':{'id':_0x55fd5d[_0x0f68('0x56')][_0x0f68('0x57')]}})[_0x0f68('0x11')](function(_0x1d5400){if(_0x1d5400){_0x55fd5d[_0x0f68('0x43')][_0x0f68('0x5a')]({'id':0x0,'priority':0x0,'app':_0x0f68('0x5b'),'appdata':_0x1d5400[_0x0f68('0x59')]+','+(_0x55fd5d[_0x0f68('0x3a')][_0x0f68('0x5c')]||0xa),'interval':_0x0f68('0x51')});}return respondWithRpcPromise(_0x0f68('0x5d'),_0x0f68('0x5e'),_0x55fd5d);});}return respondWithRpcPromise('Start',_0x0f68('0x5e'),_0x55fd5d);})[_0x0f68('0x11')](function(_0x383ef2){_0x280679(_0x383ef2);})[_0x0f68('0x25')](function(_0x59d3dc){_0x96dec4(_0x467a49[_0x0f68('0x18')](0x1f4,_0x59d3dc[_0x0f68('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index aa15087..0438a5c 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 _0x96ac=['removeListener','length','faxAccount:','save','remove','update'];(function(_0x1484bb,_0x2ee5bc){var _0x4dd0e1=function(_0x18b8d1){while(--_0x18b8d1){_0x1484bb['push'](_0x1484bb['shift']());}};_0x4dd0e1(++_0x2ee5bc);}(_0x96ac,0x81));var _0xc96a=function(_0x47d093,_0x70899b){_0x47d093=_0x47d093-0x0;var _0x315e55=_0x96ac[_0x47d093];return _0x315e55;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xc96a('0x0'),_0xc96a('0x1'),_0xc96a('0x2')];function createListener(_0x7dee22,_0x449721){return function(_0x5ba3d3){_0x449721['emit'](_0x7dee22,_0x5ba3d3);};}function removeListener(_0x1ceb0d,_0x587fbf){return function(){FaxAccountEvents[_0xc96a('0x3')](_0x1ceb0d,_0x587fbf);};}exports['register']=function(_0x76e68b){for(var _0x24384b=0x0,_0x2d11e2=events[_0xc96a('0x4')];_0x24384b<_0x2d11e2;_0x24384b++){var _0x377e72=events[_0x24384b];var _0x46a799=createListener(_0xc96a('0x5')+_0x377e72,_0x76e68b);FaxAccountEvents['on'](_0x377e72,_0x46a799);}}; \ No newline at end of file +var _0xa0d8=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x10e57f,_0x5ba064){var _0x36f808=function(_0x59d164){while(--_0x59d164){_0x10e57f['push'](_0x10e57f['shift']());}};_0x36f808(++_0x5ba064);}(_0xa0d8,0x166));var _0x8a0d=function(_0x58d459,_0x12201c){_0x58d459=_0x58d459-0x0;var _0x4d5a8e=_0xa0d8[_0x58d459];return _0x4d5a8e;};'use strict';var FaxAccountEvents=require(_0x8a0d('0x0'));var events=[_0x8a0d('0x1'),'remove',_0x8a0d('0x2')];function createListener(_0x120bb1,_0x2a42a4){return function(_0x39111d){_0x2a42a4[_0x8a0d('0x3')](_0x120bb1,_0x39111d);};}function removeListener(_0x3ee4b9,_0x4a00fb){return function(){FaxAccountEvents[_0x8a0d('0x4')](_0x3ee4b9,_0x4a00fb);};}exports[_0x8a0d('0x5')]=function(_0x5ebe99){for(var _0x34cdac=0x0,_0x4e3f48=events[_0x8a0d('0x6')];_0x34cdac<_0x4e3f48;_0x34cdac++){var _0x595991=events[_0x34cdac];var _0x37a4cf=createListener(_0x8a0d('0x7')+_0x595991,_0x5ebe99);FaxAccountEvents['on'](_0x595991,_0x37a4cf);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 984b855..9aafe0c 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x36e5d5,_0x46bdd3){var _0x1cca07=function(_0x195808){while(--_0x195808){_0x36e5d5['push'](_0x36e5d5['shift']());}};_0x1cca07(++_0x46bdd3);}(_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/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0xc24c3,_0x2e6c00){var _0x1cc270=function(_0x512b22){while(--_0x512b22){_0xc24c3['push'](_0xc24c3['shift']());}};_0x1cc270(++_0x2e6c00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 86d803b..f03f693 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 _0x47ce=['INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x47ce,0x77));var _0xe47c=function(_0x38fa95,_0x3482f6){_0x38fa95=_0x38fa95-0x0;var _0x593d4b=_0x47ce[_0x38fa95];return _0x593d4b;};'use strict';var Sequelize=require(_0xe47c('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe47c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe47c('0x2')],'allowNull':![],'defaultValue':_0xe47c('0x3')},'appdata':{'type':Sequelize[_0xe47c('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe47c('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe002=['exports','INTEGER','STRING'];(function(_0xbf9e4c,_0x4626f4){var _0x4fc6bd=function(_0x461b30){while(--_0x461b30){_0xbf9e4c['push'](_0xbf9e4c['shift']());}};_0x4fc6bd(++_0x4626f4);}(_0xe002,0x192));var _0x2e00=function(_0xd1a252,_0x16396f){_0xd1a252=_0xd1a252-0x0;var _0x560ee1=_0xe002[_0xd1a252];return _0x560ee1;};'use strict';var Sequelize=require('sequelize');module[_0x2e00('0x0')]={'priority':{'type':Sequelize[_0x2e00('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2e00('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2e00('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 2972d23..a311184 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 _0x36b4=['name','send','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','include','findAll','rows','show','params','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0x36b4,0x158));var _0x436b=function(_0x432fb3,_0x48cd6c){_0x432fb3=_0x432fb3-0x0;var _0x5cbf50=_0x36b4[_0x432fb3];return _0x5cbf50;};'use strict';var emlformat=require(_0x436b('0x0'));var rimraf=require(_0x436b('0x1'));var zipdir=require(_0x436b('0x2'));var jsonpatch=require(_0x436b('0x3'));var rp=require(_0x436b('0x4'));var moment=require(_0x436b('0x5'));var BPromise=require(_0x436b('0x6'));var Mustache=require(_0x436b('0x7'));var util=require(_0x436b('0x8'));var path=require(_0x436b('0x9'));var sox=require(_0x436b('0xa'));var csv=require(_0x436b('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x436b('0xc'));var _=require(_0x436b('0xd'));var squel=require(_0x436b('0xe'));var crypto=require(_0x436b('0xf'));var jsforce=require(_0x436b('0x10'));var deskjs=require(_0x436b('0x11'));var toCsv=require(_0x436b('0xb'));var querystring=require(_0x436b('0x12'));var Papa=require(_0x436b('0x13'));var Redis=require(_0x436b('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x436b('0x15'));var as=require(_0x436b('0x16'));var hardwareService=require(_0x436b('0x17'));var logger=require('../../config/logger')(_0x436b('0x18'));var utils=require(_0x436b('0x19'));var config=require(_0x436b('0x1a'));var licenseUtil=require(_0x436b('0x1b'));var db=require(_0x436b('0x1c'))['db'];function respondWithStatusCode(_0x15ba6e,_0x1ced6f){_0x1ced6f=_0x1ced6f||0xcc;return function(_0x315fa2){if(_0x315fa2){return _0x15ba6e[_0x436b('0x1d')](_0x1ced6f);}return _0x15ba6e[_0x436b('0x1e')](_0x1ced6f)[_0x436b('0x1f')]();};}function respondWithResult(_0x5236a7,_0x5ce26b){_0x5ce26b=_0x5ce26b||0xc8;return function(_0x46df26){if(_0x46df26){return _0x5236a7['status'](_0x5ce26b)[_0x436b('0x20')](_0x46df26);}};}function respondWithFilteredResult(_0xa53917,_0x170643){return function(_0x168ffc){if(_0x168ffc){var _0xbccd83=typeof _0x170643[_0x436b('0x21')]===_0x436b('0x22')&&typeof _0x170643['limit']==='undefined';var _0x3d3104=_0x168ffc['count'];var _0x379ee6=_0xbccd83?0x0:_0x170643['offset'];var _0x2bd0c4=_0xbccd83?_0x168ffc[_0x436b('0x23')]:_0x170643[_0x436b('0x21')]+_0x170643[_0x436b('0x24')];var _0x2b0e9b;if(_0x2bd0c4>=_0x3d3104){_0x2bd0c4=_0x3d3104;_0x2b0e9b=0xc8;}else{_0x2b0e9b=0xce;}_0xa53917[_0x436b('0x1e')](_0x2b0e9b);return _0xa53917[_0x436b('0x25')](_0x436b('0x26'),_0x379ee6+'-'+_0x2bd0c4+'/'+_0x3d3104)[_0x436b('0x20')](_0x168ffc);}return null;};}function patchUpdates(_0x47e105){return function(_0x481e20){try{jsonpatch['apply'](_0x481e20,_0x47e105,!![]);}catch(_0x173ca7){return BPromise[_0x436b('0x27')](_0x173ca7);}return _0x481e20[_0x436b('0x28')]();};}function saveUpdates(_0x3bd2d8,_0x529912){return function(_0xabca7){if(_0xabca7){return _0xabca7[_0x436b('0x29')](_0x3bd2d8)[_0x436b('0x2a')](function(_0x2f14b5){return _0x2f14b5;});}return null;};}function removeEntity(_0x49bd89,_0x38005b){return function(_0x1a0d94){if(_0x1a0d94){return _0x1a0d94[_0x436b('0x2b')]()[_0x436b('0x2a')](function(){_0x49bd89[_0x436b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf552fa,_0x4d58d3){return function(_0xce8b90){if(!_0xce8b90){_0xf552fa['sendStatus'](0x194);}return _0xce8b90;};}function handleError(_0x2b1e57,_0xf54404){_0xf54404=_0xf54404||0x1f4;return function(_0x4b137f){logger[_0x436b('0x2c')](_0x4b137f[_0x436b('0x2d')]);if(_0x4b137f[_0x436b('0x2e')]){delete _0x4b137f['name'];}_0x2b1e57[_0x436b('0x1e')](_0xf54404)[_0x436b('0x2f')](_0x4b137f);};}exports['index']=function(_0x476c92,_0x158aa2){var _0x5f4ec0={},_0x3118db={},_0x3812c9={'count':0x0,'rows':[]};var _0xe5088a=_[_0x436b('0x30')](db[_0x436b('0x31')][_0x436b('0x32')],function(_0x5d8de1){return{'name':_0x5d8de1[_0x436b('0x33')],'type':_0x5d8de1[_0x436b('0x34')][_0x436b('0x35')]};});_0x3118db[_0x436b('0x36')]=_[_0x436b('0x30')](_0xe5088a,_0x436b('0x2e'));_0x3118db[_0x436b('0x37')]=_[_0x436b('0x38')](_0x476c92['query']);_0x3118db[_0x436b('0x39')]=_['intersection'](_0x3118db[_0x436b('0x36')],_0x3118db[_0x436b('0x37')]);_0x5f4ec0[_0x436b('0x3a')]=_[_0x436b('0x3b')](_0x3118db[_0x436b('0x36')],qs['fields'](_0x476c92[_0x436b('0x37')][_0x436b('0x3c')]));_0x5f4ec0[_0x436b('0x3a')]=_0x5f4ec0['attributes']['length']?_0x5f4ec0[_0x436b('0x3a')]:_0x3118db[_0x436b('0x36')];if(!_0x476c92[_0x436b('0x37')]['hasOwnProperty'](_0x436b('0x3d'))){_0x5f4ec0[_0x436b('0x24')]=qs[_0x436b('0x24')](_0x476c92[_0x436b('0x37')][_0x436b('0x24')]);_0x5f4ec0['offset']=qs[_0x436b('0x21')](_0x476c92[_0x436b('0x37')][_0x436b('0x21')]);}_0x5f4ec0[_0x436b('0x3e')]=qs[_0x436b('0x3f')](_0x476c92[_0x436b('0x37')][_0x436b('0x3f')]);_0x5f4ec0[_0x436b('0x40')]=qs[_0x436b('0x39')](_[_0x436b('0x41')](_0x476c92[_0x436b('0x37')],_0x3118db[_0x436b('0x39')]),_0xe5088a);if(_0x476c92[_0x436b('0x37')]['filter']){_0x5f4ec0['where']=_[_0x436b('0x42')](_0x5f4ec0[_0x436b('0x40')],{'$or':_[_0x436b('0x30')](_0xe5088a,function(_0xddf8a8){if(_0xddf8a8[_0x436b('0x34')]!==_0x436b('0x43')){var _0x3e1402={};_0x3e1402[_0xddf8a8[_0x436b('0x2e')]]={'$like':'%'+_0x476c92[_0x436b('0x37')]['filter']+'%'};return _0x3e1402;}})});}_0x5f4ec0=_[_0x436b('0x42')]({},_0x5f4ec0,_0x476c92['options']);var _0x284bff={'where':_0x5f4ec0['where']};return db['FaxApplication']['count'](_0x284bff)[_0x436b('0x2a')](function(_0x376401){_0x3812c9[_0x436b('0x23')]=_0x376401;if(_0x476c92['query']['includeAll']){_0x5f4ec0[_0x436b('0x44')]=[{'all':!![]}];}return db[_0x436b('0x31')][_0x436b('0x45')](_0x5f4ec0);})[_0x436b('0x2a')](function(_0x2ad752){_0x3812c9[_0x436b('0x46')]=_0x2ad752;return _0x3812c9;})[_0x436b('0x2a')](respondWithFilteredResult(_0x158aa2,_0x5f4ec0))['catch'](handleError(_0x158aa2,null));};exports[_0x436b('0x47')]=function(_0x2259ab,_0x1ea52f){var _0x3a7645={'raw':!![],'where':{'id':_0x2259ab[_0x436b('0x48')]['id']}},_0x92c426={};_0x92c426[_0x436b('0x36')]=_[_0x436b('0x38')](db[_0x436b('0x31')][_0x436b('0x32')]);_0x92c426[_0x436b('0x37')]=_[_0x436b('0x38')](_0x2259ab['query']);_0x92c426['filters']=_[_0x436b('0x3b')](_0x92c426[_0x436b('0x36')],_0x92c426[_0x436b('0x37')]);_0x3a7645['attributes']=_[_0x436b('0x3b')](_0x92c426[_0x436b('0x36')],qs[_0x436b('0x3c')](_0x2259ab[_0x436b('0x37')][_0x436b('0x3c')]));_0x3a7645[_0x436b('0x3a')]=_0x3a7645[_0x436b('0x3a')]['length']?_0x3a7645[_0x436b('0x3a')]:_0x92c426[_0x436b('0x36')];if(_0x2259ab[_0x436b('0x37')]['includeAll']){_0x3a7645[_0x436b('0x44')]=[{'all':!![]}];}_0x3a7645=_['merge']({},_0x3a7645,_0x2259ab[_0x436b('0x49')]);return db[_0x436b('0x31')]['find'](_0x3a7645)['then'](handleEntityNotFound(_0x1ea52f,null))[_0x436b('0x2a')](respondWithResult(_0x1ea52f,null))[_0x436b('0x4a')](handleError(_0x1ea52f,null));};exports[_0x436b('0x4b')]=function(_0xa3983b,_0x27ad5f){return db[_0x436b('0x31')][_0x436b('0x4b')](_0xa3983b[_0x436b('0x4c')],{})[_0x436b('0x2a')](respondWithResult(_0x27ad5f,0xc9))[_0x436b('0x4a')](handleError(_0x27ad5f,null));};exports['update']=function(_0xc71701,_0x244811){if(_0xc71701[_0x436b('0x4c')]['id']){delete _0xc71701[_0x436b('0x4c')]['id'];}return db[_0x436b('0x31')]['find']({'where':{'id':_0xc71701[_0x436b('0x48')]['id']}})[_0x436b('0x2a')](handleEntityNotFound(_0x244811,null))[_0x436b('0x2a')](saveUpdates(_0xc71701['body'],null))[_0x436b('0x2a')](respondWithResult(_0x244811,null))[_0x436b('0x4a')](handleError(_0x244811,null));};exports['destroy']=function(_0x3c631e,_0x18bd86){return db[_0x436b('0x31')][_0x436b('0x4d')]({'where':{'id':_0x3c631e[_0x436b('0x48')]['id']}})[_0x436b('0x2a')](handleEntityNotFound(_0x18bd86,null))['then'](removeEntity(_0x18bd86,null))['catch'](handleError(_0x18bd86,null));}; \ No newline at end of file +var _0x458e=['../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','index','map','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','type','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','show','keys','FaxApplication','rawAttributes','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x4a0e02,_0x349949){var _0x5c3fc5=function(_0x1a10a1){while(--_0x1a10a1){_0x4a0e02['push'](_0x4a0e02['shift']());}};_0x5c3fc5(++_0x349949);}(_0x458e,0x15f));var _0xe458=function(_0x1deaec,_0x270f3a){_0x1deaec=_0x1deaec-0x0;var _0x475d5f=_0x458e[_0x1deaec];return _0x475d5f;};'use strict';var emlformat=require(_0xe458('0x0'));var rimraf=require(_0xe458('0x1'));var zipdir=require(_0xe458('0x2'));var jsonpatch=require(_0xe458('0x3'));var rp=require(_0xe458('0x4'));var moment=require('moment');var BPromise=require(_0xe458('0x5'));var Mustache=require(_0xe458('0x6'));var util=require(_0xe458('0x7'));var path=require(_0xe458('0x8'));var sox=require(_0xe458('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe458('0xa'));var _=require('lodash');var squel=require(_0xe458('0xb'));var crypto=require(_0xe458('0xc'));var jsforce=require(_0xe458('0xd'));var deskjs=require(_0xe458('0xe'));var toCsv=require(_0xe458('0xf'));var querystring=require('querystring');var Papa=require(_0xe458('0x10'));var Redis=require(_0xe458('0x11'));var authService=require(_0xe458('0x12'));var qs=require(_0xe458('0x13'));var as=require(_0xe458('0x14'));var hardwareService=require(_0xe458('0x15'));var logger=require('../../config/logger')(_0xe458('0x16'));var utils=require('../../config/utils');var config=require(_0xe458('0x17'));var licenseUtil=require(_0xe458('0x18'));var db=require(_0xe458('0x19'))['db'];function respondWithStatusCode(_0x23127f,_0x207bf8){_0x207bf8=_0x207bf8||0xcc;return function(_0x431ab7){if(_0x431ab7){return _0x23127f['sendStatus'](_0x207bf8);}return _0x23127f[_0xe458('0x1a')](_0x207bf8)[_0xe458('0x1b')]();};}function respondWithResult(_0x3fd64b,_0xc3d1ea){_0xc3d1ea=_0xc3d1ea||0xc8;return function(_0x6f39c6){if(_0x6f39c6){return _0x3fd64b['status'](_0xc3d1ea)[_0xe458('0x1c')](_0x6f39c6);}};}function respondWithFilteredResult(_0x14fd22,_0x331ee4){return function(_0x1bd9b4){if(_0x1bd9b4){var _0x29658a=typeof _0x331ee4[_0xe458('0x1d')]==='undefined'&&typeof _0x331ee4['limit']===_0xe458('0x1e');var _0x479e94=_0x1bd9b4['count'];var _0x1b3300=_0x29658a?0x0:_0x331ee4[_0xe458('0x1d')];var _0x130591=_0x29658a?_0x1bd9b4['count']:_0x331ee4[_0xe458('0x1d')]+_0x331ee4[_0xe458('0x1f')];var _0x4ed8b8;if(_0x130591>=_0x479e94){_0x130591=_0x479e94;_0x4ed8b8=0xc8;}else{_0x4ed8b8=0xce;}_0x14fd22[_0xe458('0x1a')](_0x4ed8b8);return _0x14fd22[_0xe458('0x20')](_0xe458('0x21'),_0x1b3300+'-'+_0x130591+'/'+_0x479e94)['json'](_0x1bd9b4);}return null;};}function patchUpdates(_0x4862aa){return function(_0x900dde){try{jsonpatch['apply'](_0x900dde,_0x4862aa,!![]);}catch(_0xdcba71){return BPromise[_0xe458('0x22')](_0xdcba71);}return _0x900dde[_0xe458('0x23')]();};}function saveUpdates(_0x19a9b8,_0x250079){return function(_0x56c871){if(_0x56c871){return _0x56c871[_0xe458('0x24')](_0x19a9b8)[_0xe458('0x25')](function(_0x1cfde6){return _0x1cfde6;});}return null;};}function removeEntity(_0xca35f8,_0x584b14){return function(_0x25358a){if(_0x25358a){return _0x25358a[_0xe458('0x26')]()[_0xe458('0x25')](function(){_0xca35f8[_0xe458('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15fcef,_0x7e0a86){return function(_0x56b1fc){if(!_0x56b1fc){_0x15fcef[_0xe458('0x27')](0x194);}return _0x56b1fc;};}function handleError(_0x5d93c8,_0xdefb77){_0xdefb77=_0xdefb77||0x1f4;return function(_0x571a41){logger['error'](_0x571a41[_0xe458('0x28')]);if(_0x571a41[_0xe458('0x29')]){delete _0x571a41[_0xe458('0x29')];}_0x5d93c8['status'](_0xdefb77)['send'](_0x571a41);};}exports[_0xe458('0x2a')]=function(_0x125ca9,_0xc4bf0){var _0x5ab842={},_0x352e87={},_0x453f95={'count':0x0,'rows':[]};var _0x310b04=_[_0xe458('0x2b')](db['FaxApplication']['rawAttributes'],function(_0x1850d0){return{'name':_0x1850d0[_0xe458('0x2c')],'type':_0x1850d0['type'][_0xe458('0x2d')]};});_0x352e87[_0xe458('0x2e')]=_[_0xe458('0x2b')](_0x310b04,_0xe458('0x29'));_0x352e87[_0xe458('0x2f')]=_['keys'](_0x125ca9[_0xe458('0x2f')]);_0x352e87['filters']=_['intersection'](_0x352e87[_0xe458('0x2e')],_0x352e87[_0xe458('0x2f')]);_0x5ab842[_0xe458('0x30')]=_[_0xe458('0x31')](_0x352e87['model'],qs[_0xe458('0x32')](_0x125ca9[_0xe458('0x2f')][_0xe458('0x32')]));_0x5ab842[_0xe458('0x30')]=_0x5ab842[_0xe458('0x30')][_0xe458('0x33')]?_0x5ab842[_0xe458('0x30')]:_0x352e87[_0xe458('0x2e')];if(!_0x125ca9[_0xe458('0x2f')][_0xe458('0x34')](_0xe458('0x35'))){_0x5ab842['limit']=qs[_0xe458('0x1f')](_0x125ca9[_0xe458('0x2f')]['limit']);_0x5ab842[_0xe458('0x1d')]=qs[_0xe458('0x1d')](_0x125ca9[_0xe458('0x2f')][_0xe458('0x1d')]);}_0x5ab842[_0xe458('0x36')]=qs['sort'](_0x125ca9[_0xe458('0x2f')]['sort']);_0x5ab842[_0xe458('0x37')]=qs[_0xe458('0x38')](_[_0xe458('0x39')](_0x125ca9[_0xe458('0x2f')],_0x352e87[_0xe458('0x38')]),_0x310b04);if(_0x125ca9[_0xe458('0x2f')]['filter']){_0x5ab842[_0xe458('0x37')]=_[_0xe458('0x3a')](_0x5ab842['where'],{'$or':_[_0xe458('0x2b')](_0x310b04,function(_0x4f1608){if(_0x4f1608[_0xe458('0x3b')]!==_0xe458('0x3c')){var _0x3a6f69={};_0x3a6f69[_0x4f1608[_0xe458('0x29')]]={'$like':'%'+_0x125ca9[_0xe458('0x2f')][_0xe458('0x3d')]+'%'};return _0x3a6f69;}})});}_0x5ab842=_[_0xe458('0x3a')]({},_0x5ab842,_0x125ca9[_0xe458('0x3e')]);var _0x4dfc0f={'where':_0x5ab842[_0xe458('0x37')]};return db['FaxApplication'][_0xe458('0x3f')](_0x4dfc0f)[_0xe458('0x25')](function(_0x17d835){_0x453f95[_0xe458('0x3f')]=_0x17d835;if(_0x125ca9[_0xe458('0x2f')][_0xe458('0x40')]){_0x5ab842['include']=[{'all':!![]}];}return db['FaxApplication'][_0xe458('0x41')](_0x5ab842);})['then'](function(_0x8898c5){_0x453f95[_0xe458('0x42')]=_0x8898c5;return _0x453f95;})[_0xe458('0x25')](respondWithFilteredResult(_0xc4bf0,_0x5ab842))[_0xe458('0x43')](handleError(_0xc4bf0,null));};exports[_0xe458('0x44')]=function(_0x1f2c3e,_0x3b2e11){var _0x8be25b={'raw':!![],'where':{'id':_0x1f2c3e['params']['id']}},_0x178e95={};_0x178e95['model']=_[_0xe458('0x45')](db[_0xe458('0x46')][_0xe458('0x47')]);_0x178e95['query']=_[_0xe458('0x45')](_0x1f2c3e[_0xe458('0x2f')]);_0x178e95[_0xe458('0x38')]=_[_0xe458('0x31')](_0x178e95['model'],_0x178e95['query']);_0x8be25b[_0xe458('0x30')]=_[_0xe458('0x31')](_0x178e95['model'],qs[_0xe458('0x32')](_0x1f2c3e[_0xe458('0x2f')][_0xe458('0x32')]));_0x8be25b[_0xe458('0x30')]=_0x8be25b[_0xe458('0x30')][_0xe458('0x33')]?_0x8be25b[_0xe458('0x30')]:_0x178e95[_0xe458('0x2e')];if(_0x1f2c3e[_0xe458('0x2f')][_0xe458('0x40')]){_0x8be25b['include']=[{'all':!![]}];}_0x8be25b=_[_0xe458('0x3a')]({},_0x8be25b,_0x1f2c3e['options']);return db[_0xe458('0x46')][_0xe458('0x48')](_0x8be25b)[_0xe458('0x25')](handleEntityNotFound(_0x3b2e11,null))['then'](respondWithResult(_0x3b2e11,null))['catch'](handleError(_0x3b2e11,null));};exports['create']=function(_0x1ad946,_0x131c51){return db[_0xe458('0x46')]['create'](_0x1ad946[_0xe458('0x49')],{})[_0xe458('0x25')](respondWithResult(_0x131c51,0xc9))[_0xe458('0x43')](handleError(_0x131c51,null));};exports[_0xe458('0x24')]=function(_0x2622d0,_0x50abc1){if(_0x2622d0[_0xe458('0x49')]['id']){delete _0x2622d0['body']['id'];}return db[_0xe458('0x46')][_0xe458('0x48')]({'where':{'id':_0x2622d0[_0xe458('0x4a')]['id']}})[_0xe458('0x25')](handleEntityNotFound(_0x50abc1,null))[_0xe458('0x25')](saveUpdates(_0x2622d0['body'],null))[_0xe458('0x25')](respondWithResult(_0x50abc1,null))['catch'](handleError(_0x50abc1,null));};exports[_0xe458('0x26')]=function(_0x337de4,_0x4d029c){return db['FaxApplication'][_0xe458('0x48')]({'where':{'id':_0x337de4[_0xe458('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4d029c,null))[_0xe458('0x25')](removeEntity(_0x4d029c,null))['catch'](handleError(_0x4d029c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 077eccd..d136e14 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 _0x6450=['../../config/logger','api','request-promise','path','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2929b0,_0x2f5b5b){var _0x3d639a=function(_0x3499e9){while(--_0x3499e9){_0x2929b0['push'](_0x2929b0['shift']());}};_0x3d639a(++_0x2f5b5b);}(_0x6450,0x11c));var _0x0645=function(_0x1abe03,_0x43ba11){_0x1abe03=_0x1abe03-0x0;var _0x57f5b6=_0x6450[_0x1abe03];return _0x57f5b6;};'use strict';var _=require(_0x0645('0x0'));var util=require(_0x0645('0x1'));var logger=require(_0x0645('0x2'))(_0x0645('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0645('0x4'));var fs=require('fs');var path=require(_0x0645('0x5'));var rimraf=require('rimraf');var config=require(_0x0645('0x6'));var attributes=require(_0x0645('0x7'));module['exports']=function(_0x5968bb,_0x36af69){return _0x5968bb[_0x0645('0x8')](_0x0645('0x9'),attributes,{'tableName':_0x0645('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0645('0xb'),'collate':_0x0645('0xc')});}; \ No newline at end of file +var _0xe8e1=['define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x3c48e2,_0x11b592){var _0x1c9aeb=function(_0x3374a7){while(--_0x3374a7){_0x3c48e2['push'](_0x3c48e2['shift']());}};_0x1c9aeb(++_0x11b592);}(_0xe8e1,0x155));var _0x1e8e=function(_0x27b4c7,_0xd847e6){_0x27b4c7=_0x27b4c7-0x0;var _0x3000b9=_0xe8e1[_0x27b4c7];return _0x3000b9;};'use strict';var _=require(_0x1e8e('0x0'));var util=require(_0x1e8e('0x1'));var logger=require(_0x1e8e('0x2'))(_0x1e8e('0x3'));var moment=require(_0x1e8e('0x4'));var BPromise=require(_0x1e8e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e8e('0x6'));var rimraf=require('rimraf');var config=require(_0x1e8e('0x7'));var attributes=require('./faxApplication.attributes');module[_0x1e8e('0x8')]=function(_0x503338,_0x816276){return _0x503338[_0x1e8e('0x9')](_0x1e8e('0xa'),attributes,{'tableName':_0x1e8e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1e8e('0xc'),'collate':_0x1e8e('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 20de04f..5e3c3bb 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 _0xc40f=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxApplication','FaxApplication','body','options','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x21a95e,_0x4de45e){var _0x828e72=function(_0x5adae3){while(--_0x5adae3){_0x21a95e['push'](_0x21a95e['shift']());}};_0x828e72(++_0x4de45e);}(_0xc40f,0x1f0));var _0xfc40=function(_0x49d033,_0x99e25a){_0x49d033=_0x49d033-0x0;var _0xaf160c=_0xc40f[_0x49d033];return _0xaf160c;};'use strict';var _=require(_0xfc40('0x0'));var util=require('util');var moment=require(_0xfc40('0x1'));var BPromise=require(_0xfc40('0x2'));var rs=require(_0xfc40('0x3'));var fs=require('fs');var Redis=require(_0xfc40('0x4'));var db=require(_0xfc40('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfc40('0x6'));var config=require(_0xfc40('0x7'));var jayson=require(_0xfc40('0x8'));var client=jayson[_0xfc40('0x9')][_0xfc40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2004ed,_0x29cdae,_0x1d1d59){return new BPromise(function(_0xe44a59,_0x4f7334){return client[_0xfc40('0xb')](_0x2004ed,_0x1d1d59)[_0xfc40('0xc')](function(_0x590261){logger[_0xfc40('0xd')](_0xfc40('0xe'),_0x29cdae,_0xfc40('0xf'));logger[_0xfc40('0x10')](_0xfc40('0x11'),_0x29cdae,_0xfc40('0xf'),JSON[_0xfc40('0x12')](_0x590261));if(_0x590261['error']){if(_0x590261[_0xfc40('0x13')][_0xfc40('0x14')]===0x1f4){logger['error'](_0xfc40('0xe'),_0x29cdae,_0x590261[_0xfc40('0x13')]['message']);return _0x4f7334(_0x590261['error'][_0xfc40('0x15')]);}logger[_0xfc40('0x13')](_0xfc40('0xe'),_0x29cdae,_0x590261[_0xfc40('0x13')]['message']);return _0xe44a59(_0x590261[_0xfc40('0x13')][_0xfc40('0x15')]);}else{logger[_0xfc40('0xd')](_0xfc40('0xe'),_0x29cdae,_0xfc40('0xf'));_0xe44a59(_0x590261['result']['message']);}})[_0xfc40('0x16')](function(_0x272531){logger['error']('FaxApplication,\x20%s,\x20%s',_0x29cdae,_0x272531);_0x4f7334(_0x272531);});});}exports[_0xfc40('0x17')]=function(_0x2a1877){var _0x49a129=this;return new Promise(function(_0x5d45ee,_0x12e81a){return db[_0xfc40('0x18')]['update'](_0x2a1877[_0xfc40('0x19')],{'raw':_0x2a1877['options']?_0x2a1877[_0xfc40('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a1877['options']?_0x2a1877[_0xfc40('0x1a')][_0xfc40('0x1b')]||null:null,'attributes':_0x2a1877[_0xfc40('0x1a')]?_0x2a1877['options'][_0xfc40('0x1c')]||null:null,'limit':_0x2a1877['options']?_0x2a1877[_0xfc40('0x1a')][_0xfc40('0x1d')]||null:null})[_0xfc40('0xc')](function(_0x544111){logger[_0xfc40('0xd')](_0xfc40('0x17'),_0x2a1877);logger['debug']('UpdateFaxApplication',_0x2a1877,JSON[_0xfc40('0x12')](_0x544111));_0x5d45ee(_0x544111);})['catch'](function(_0x92a6d5){logger[_0xfc40('0x13')](_0xfc40('0x17'),_0x92a6d5[_0xfc40('0x15')],_0x2a1877);_0x12e81a(_0x49a129[_0xfc40('0x13')](0x1f4,_0x92a6d5[_0xfc40('0x15')]));});});}; \ No newline at end of file +var _0x5f2b=['request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f2b,0x17a));var _0xb5f2=function(_0x46e655,_0x1e9324){_0x46e655=_0x46e655-0x0;var _0x59ee8e=_0x5f2b[_0x46e655];return _0x59ee8e;};'use strict';var _=require(_0xb5f2('0x0'));var util=require(_0xb5f2('0x1'));var moment=require(_0xb5f2('0x2'));var BPromise=require(_0xb5f2('0x3'));var rs=require(_0xb5f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5f2('0x5'))['db'];var utils=require(_0xb5f2('0x6'));var logger=require(_0xb5f2('0x7'))(_0xb5f2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb5f2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9067,_0x3edd25,_0x11262f){return new BPromise(function(_0x6d314e,_0x29a64b){return client['request'](_0x1f9067,_0x11262f)[_0xb5f2('0xa')](function(_0x289e9d){logger[_0xb5f2('0xb')]('FaxApplication,\x20%s,\x20%s',_0x3edd25,_0xb5f2('0xc'));logger[_0xb5f2('0xd')](_0xb5f2('0xe'),_0x3edd25,_0xb5f2('0xc'),JSON[_0xb5f2('0xf')](_0x289e9d));if(_0x289e9d[_0xb5f2('0x10')]){if(_0x289e9d[_0xb5f2('0x10')][_0xb5f2('0x11')]===0x1f4){logger[_0xb5f2('0x10')](_0xb5f2('0x12'),_0x3edd25,_0x289e9d['error'][_0xb5f2('0x13')]);return _0x29a64b(_0x289e9d[_0xb5f2('0x10')][_0xb5f2('0x13')]);}logger[_0xb5f2('0x10')](_0xb5f2('0x12'),_0x3edd25,_0x289e9d[_0xb5f2('0x10')][_0xb5f2('0x13')]);return _0x6d314e(_0x289e9d[_0xb5f2('0x10')][_0xb5f2('0x13')]);}else{logger[_0xb5f2('0xb')](_0xb5f2('0x12'),_0x3edd25,_0xb5f2('0xc'));_0x6d314e(_0x289e9d[_0xb5f2('0x14')][_0xb5f2('0x13')]);}})[_0xb5f2('0x15')](function(_0x1c3bdc){logger[_0xb5f2('0x10')](_0xb5f2('0x12'),_0x3edd25,_0x1c3bdc);_0x29a64b(_0x1c3bdc);});});}exports[_0xb5f2('0x16')]=function(_0x214a43){var _0xae836d=this;return new Promise(function(_0x22cf47,_0x5baa23){return db[_0xb5f2('0x17')]['update'](_0x214a43[_0xb5f2('0x18')],{'raw':_0x214a43[_0xb5f2('0x19')]?_0x214a43['options'][_0xb5f2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x214a43['options']?_0x214a43[_0xb5f2('0x19')][_0xb5f2('0x1b')]||null:null,'attributes':_0x214a43[_0xb5f2('0x19')]?_0x214a43['options'][_0xb5f2('0x1c')]||null:null,'limit':_0x214a43[_0xb5f2('0x19')]?_0x214a43[_0xb5f2('0x19')][_0xb5f2('0x1d')]||null:null})['then'](function(_0xced05f){logger['info'](_0xb5f2('0x16'),_0x214a43);logger[_0xb5f2('0xd')](_0xb5f2('0x16'),_0x214a43,JSON[_0xb5f2('0xf')](_0xced05f));_0x22cf47(_0xced05f);})[_0xb5f2('0x15')](function(_0x22ecc9){logger[_0xb5f2('0x10')](_0xb5f2('0x16'),_0x22ecc9[_0xb5f2('0x13')],_0x214a43);_0x5baa23(_0xae836d[_0xb5f2('0x10')](0x1f4,_0x22ecc9[_0xb5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 483f8b2..2618e55 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 _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x955f,0x1eb));var _0xf955=function(_0x5814e5,_0x29006f){_0x5814e5=_0x5814e5-0x0;var _0x4f251d=_0x955f[_0x5814e5];return _0x4f251d;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./faxApplication.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router; \ No newline at end of file +var _0xe5b5=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5ced9c,_0x5ab2e2){var _0x10ae2f=function(_0x20811b){while(--_0x20811b){_0x5ced9c['push'](_0x5ced9c['shift']());}};_0x10ae2f(++_0x5ab2e2);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0xe5b5[_0x39a2d6];return _0x23af66;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0x10')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0x12')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x13')]);router['delete'](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x14')]);module[_0x5e5b('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 76d00cb..2211208 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 _0xea5c=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x2052cc,_0x4f76dc){var _0x58609f=function(_0x28bdc9){while(--_0x28bdc9){_0x2052cc['push'](_0x2052cc['shift']());}};_0x58609f(++_0x4f76dc);}(_0xea5c,0x160));var _0xcea5=function(_0x2eb423,_0x151394){_0x2eb423=_0x2eb423-0x0;var _0x591797=_0xea5c[_0x2eb423];return _0x591797;};'use strict';var Sequelize=require('sequelize');module[_0xcea5('0x0')]={'closed':{'type':Sequelize[_0xcea5('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcea5('0x2')]},'disposition':{'type':Sequelize[_0xcea5('0x3')]},'secondDisposition':{'type':Sequelize[_0xcea5('0x3')]},'thirdDisposition':{'type':Sequelize[_0xcea5('0x3')]},'note':{'type':Sequelize[_0xcea5('0x3')]},'read1stAt':{'type':Sequelize[_0xcea5('0x2')]},'fax':{'type':Sequelize[_0xcea5('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xcea5('0x4')]('in',_0xcea5('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcea5('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xcea5('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x140d=['out','sequelize','BOOLEAN','STRING','DATE','ENUM'];(function(_0x599da4,_0x2ec53d){var _0x380805=function(_0x15d390){while(--_0x15d390){_0x599da4['push'](_0x599da4['shift']());}};_0x380805(++_0x2ec53d);}(_0x140d,0x1d5));var _0xd140=function(_0x163996,_0x2e08d8){_0x163996=_0x163996-0x0;var _0x2b0c7f=_0x140d[_0x163996];return _0x2b0c7f;};'use strict';var Sequelize=require(_0xd140('0x0'));module['exports']={'closed':{'type':Sequelize[_0xd140('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd140('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd140('0x2')]},'note':{'type':Sequelize[_0xd140('0x2')]},'read1stAt':{'type':Sequelize[_0xd140('0x3')]},'fax':{'type':Sequelize[_0xd140('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xd140('0x4')]('in',_0xd140('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd140('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd140('0x4')]('in',_0xd140('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index b1b3f0f..2c7dfdf 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 _0xbeef=['me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20>\x200','Contact','operator','value','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','parse','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','sequelize','toString','merge','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','catch','show','params','include','create','body','describe','addMessage','ids','omit','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','basename','existsSync','createWriteStream','resolve','download','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','push','index','FaxInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','from','u.id','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts'];(function(_0x322306,_0x31fc80){var _0x4f9152=function(_0x565bbf){while(--_0x565bbf){_0x322306['push'](_0x322306['shift']());}};_0x4f9152(++_0x31fc80);}(_0xbeef,0x7e));var _0xfbee=function(_0xe84df3,_0x385250){_0xe84df3=_0xe84df3-0x0;var _0x5528c8=_0xbeef[_0xe84df3];return _0x5528c8;};'use strict';var emlformat=require(_0xfbee('0x0'));var rimraf=require(_0xfbee('0x1'));var zipdir=require(_0xfbee('0x2'));var jsonpatch=require(_0xfbee('0x3'));var rp=require(_0xfbee('0x4'));var moment=require(_0xfbee('0x5'));var BPromise=require(_0xfbee('0x6'));var Mustache=require(_0xfbee('0x7'));var util=require(_0xfbee('0x8'));var path=require(_0xfbee('0x9'));var sox=require('sox');var csv=require(_0xfbee('0xa'));var ejs=require(_0xfbee('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfbee('0xc'));var crypto=require(_0xfbee('0xd'));var jsforce=require(_0xfbee('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfbee('0xa'));var querystring=require(_0xfbee('0xf'));var Papa=require(_0xfbee('0x10'));var Redis=require(_0xfbee('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfbee('0x12'));var hardwareService=require(_0xfbee('0x13'));var logger=require(_0xfbee('0x14'))(_0xfbee('0x15'));var utils=require(_0xfbee('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfbee('0x17'));var db=require('../../mysqldb')['db'];config[_0xfbee('0x18')]=_[_0xfbee('0x19')](config[_0xfbee('0x18')],{'host':_0xfbee('0x1a'),'port':0x18eb});var socket=require(_0xfbee('0x1b'))(new Redis(config[_0xfbee('0x18')]));require(_0xfbee('0x1c'))[_0xfbee('0x1d')](socket);function respondWithStatusCode(_0x17435b,_0x69f62b){_0x69f62b=_0x69f62b||0xcc;return function(_0x55ab0e){if(_0x55ab0e){return _0x17435b[_0xfbee('0x1e')](_0x69f62b);}return _0x17435b[_0xfbee('0x1f')](_0x69f62b)['end']();};}function respondWithResult(_0x468333,_0x1e1ca7){_0x1e1ca7=_0x1e1ca7||0xc8;return function(_0xf3eecd){if(_0xf3eecd){return _0x468333[_0xfbee('0x1f')](_0x1e1ca7)['json'](_0xf3eecd);}};}function respondWithFilteredResult(_0x5d463d,_0xf48ea9){return function(_0x5068fd){if(_0x5068fd){var _0x9a002=typeof _0xf48ea9[_0xfbee('0x20')]===_0xfbee('0x21')&&typeof _0xf48ea9[_0xfbee('0x22')]===_0xfbee('0x21');var _0x2bb71e=_0x5068fd['count'];var _0x27ae2a=_0x9a002?0x0:_0xf48ea9[_0xfbee('0x20')];var _0x597d34=_0x9a002?_0x5068fd[_0xfbee('0x23')]:_0xf48ea9[_0xfbee('0x20')]+_0xf48ea9['limit'];var _0x591186;if(_0x597d34>=_0x2bb71e){_0x597d34=_0x2bb71e;_0x591186=0xc8;}else{_0x591186=0xce;}_0x5d463d[_0xfbee('0x1f')](_0x591186);return _0x5d463d[_0xfbee('0x24')](_0xfbee('0x25'),_0x27ae2a+'-'+_0x597d34+'/'+_0x2bb71e)[_0xfbee('0x26')](_0x5068fd);}return null;};}function patchUpdates(_0x46120f){return function(_0x119700){try{jsonpatch['apply'](_0x119700,_0x46120f,!![]);}catch(_0x5a84f2){return BPromise[_0xfbee('0x27')](_0x5a84f2);}return _0x119700[_0xfbee('0x28')]();};}function saveUpdates(_0x5dfb7d,_0x565812){return function(_0x57e661){if(_0x57e661){return _0x57e661[_0xfbee('0x29')](_0x5dfb7d)['then'](function(_0x33dd47){return _0x33dd47;});}return null;};}function removeEntity(_0x1dd001,_0x197e03){return function(_0x3682c4){if(_0x3682c4){return _0x3682c4[_0xfbee('0x2a')]()[_0xfbee('0x2b')](function(){_0x1dd001[_0xfbee('0x1f')](0xcc)[_0xfbee('0x2c')]();});}};}function handleEntityNotFound(_0x45a449,_0x3a0404){return function(_0x3d78e6){if(!_0x3d78e6){_0x45a449[_0xfbee('0x1e')](0x194);}return _0x3d78e6;};}function handleError(_0xd0bf5e,_0x5aa21a){_0x5aa21a=_0x5aa21a||0x1f4;return function(_0x4cce61){logger[_0xfbee('0x2d')](_0x4cce61[_0xfbee('0x2e')]);if(_0x4cce61[_0xfbee('0x2f')]){delete _0x4cce61[_0xfbee('0x2f')];}_0xd0bf5e[_0xfbee('0x1f')](_0x5aa21a)[_0xfbee('0x30')](_0x4cce61);};}function getInteractionUsers(_0x4feccf,_0x2359c1){return new BPromise(function(_0x2bdf9a,_0x305024){try{if(_0x2359c1[_0x4feccf['id']]){_0x4feccf[_0xfbee('0x31')]=_[_0xfbee('0x32')](_0x2359c1[_0x4feccf['id']],function(_0x359d68){return{'id':_0x359d68['id'],'fullname':_0x359d68[_0xfbee('0x33')]};});}}catch(_0x4416e6){_0x305024(_0x4416e6);}_0x2bdf9a(_0x4feccf);});}function getInteractionTags(_0x2a8367,_0x3969e6){return new BPromise(function(_0x26c2c9,_0x20f08b){try{if(_0x2a8367[_0xfbee('0x34')]){_0x2a8367[_0xfbee('0x35')]=[];_0x2a8367[_0xfbee('0x34')]['split'](',')['forEach'](function(_0xbf67ef){_0x2a8367[_0xfbee('0x35')][_0xfbee('0x36')](_0x3969e6[_0xbf67ef]);});}delete _0x2a8367[_0xfbee('0x34')];}catch(_0x5eff1b){_0x20f08b(_0x5eff1b);}_0x26c2c9(_0x2a8367);});}function updateFaxInteraction(_0x3ddff5,_0x4bfdae,_0x2ac302){return new BPromise(function(_0x57f20b,_0x4f39b9){return getInteractionUsers(_0x3ddff5,_0x2ac302)[_0xfbee('0x2b')](function(_0x5ea686){return getInteractionTags(_0x5ea686,_0x4bfdae);})[_0xfbee('0x2b')](function(_0x2487d8){_0x57f20b(_0x2487d8);})['catch'](function(_0x5e3f3d){_0x4f39b9(_0x5e3f3d);});});}exports[_0xfbee('0x37')]=function(_0x5386da,_0x402b63){var _0x103096={},_0xd4a8a9={},_0x10368f={'count':0x0,'rows':[]};var _0x1dd75d=_[_0xfbee('0x32')](db[_0xfbee('0x38')][_0xfbee('0x39')],function(_0x3408e9){return{'name':_0x3408e9[_0xfbee('0x3a')],'type':_0x3408e9[_0xfbee('0x3b')][_0xfbee('0x3c')]};});_0xd4a8a9[_0xfbee('0x3d')]=_[_0xfbee('0x32')](_0x1dd75d,_0xfbee('0x2f'));_0xd4a8a9['query']=_[_0xfbee('0x3e')](_0x5386da[_0xfbee('0x3f')]);_0xd4a8a9[_0xfbee('0x40')]=_[_0xfbee('0x41')](_0xd4a8a9['model'],_0xd4a8a9[_0xfbee('0x3f')]);_0x103096['attributes']=_[_0xfbee('0x41')](_0xd4a8a9[_0xfbee('0x3d')],qs['fields'](_0x5386da['query'][_0xfbee('0x42')]));_0x103096[_0xfbee('0x43')]=_0x103096[_0xfbee('0x43')]['length']?_0x103096['attributes']:_0xd4a8a9['model'];if(!_0x5386da[_0xfbee('0x3f')][_0xfbee('0x44')](_0xfbee('0x45'))){_0x103096[_0xfbee('0x22')]=qs['limit'](_0x5386da['query'][_0xfbee('0x22')]);_0x103096['offset']=qs[_0xfbee('0x20')](_0x5386da[_0xfbee('0x3f')][_0xfbee('0x20')]);}_0x103096[_0xfbee('0x46')]=qs[_0xfbee('0x47')](_0x5386da[_0xfbee('0x3f')][_0xfbee('0x47')]);_0x103096['where']=qs[_0xfbee('0x40')](_[_0xfbee('0x48')](_0x5386da[_0xfbee('0x3f')],_0xd4a8a9[_0xfbee('0x40')]),_0x1dd75d);var _0x55a2af=[];var _0x4ec7b1=squel[_0xfbee('0x49')]()[_0xfbee('0x4a')]('id')[_0xfbee('0x4a')](_0xfbee('0x2f'))[_0xfbee('0x4a')]('color')[_0xfbee('0x4b')]('tools_tags');var _0x3fd296=squel['select']()['field'](_0xfbee('0x4c'))['field']('u.fullname')['field']('ui.FaxInteractionId')[_0xfbee('0x4b')]('user_has_fax_interactions','ui')[_0xfbee('0x4d')](_0xfbee('0x4e'),'u',_0xfbee('0x4f'));var _0x7ae1ff=squel[_0xfbee('0x49')]()['from'](_0xfbee('0x50'),'i')[_0xfbee('0x4d')](_0xfbee('0x51'),'c',_0xfbee('0x52'))[_0xfbee('0x4d')](_0xfbee('0x4e'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xfbee('0x53'),'a','a.id\x20=\x20i.FaxAccountId')[_0xfbee('0x4d')]('fax_messages','me',_0xfbee('0x54'))[_0xfbee('0x4d')](_0xfbee('0x55'),'it','it.FaxInteractionId\x20=\x20i.id')[_0xfbee('0x4d')]('tools_tags','t',_0xfbee('0x56'));var _0x5b0011=squel[_0xfbee('0x57')]();var _0x499bec=[];var _0x5c8912=squel[_0xfbee('0x57')]();var _0x2cd6a6;if(_0x5386da[_0xfbee('0x3f')][_0xfbee('0x58')]){_0x2cd6a6=as[_0xfbee('0x59')](_0x5386da[_0xfbee('0x3f')][_0xfbee('0x58')]);var _0x3a03e1=_0x2cd6a6[_0xfbee('0x5a')];for(var _0x527532=0x0;_0x527532<_0x2cd6a6[_0xfbee('0x5b')][_0xfbee('0x5c')];_0x527532++){var _0x36932d=_0x2cd6a6[_0xfbee('0x5b')][_0x527532];var _0x312b7e='i';var _0x2afbf7=_[_0xfbee('0x5d')](_0x1dd75d,['name',_0x36932d[_0xfbee('0x4a')]]);if(!_0x2afbf7){switch(_0x36932d[_0xfbee('0x4a')]){case _0xfbee('0x5e'):if(_0x36932d['value']==0x1){_0x7ae1ff[_0xfbee('0x5f')]('`'+_0x36932d['field']+'`\x20=\x200');}else{_0x7ae1ff[_0xfbee('0x5f')]('`'+_0x36932d['field']+_0xfbee('0x60'));}break;case _0xfbee('0x61'):if(_0x36932d[_0xfbee('0x62')]==='$substring'){if(_0x36932d[_0xfbee('0x63')][_0xfbee('0x64')]('\x20')[_0xfbee('0x5c')]>0x1){_0x5b0011[_0x3a03e1]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x36932d[_0xfbee('0x63')]),null);}else{var _0x55fabd='%'+_0x36932d[_0xfbee('0x63')]+'%';_0x5b0011[_0x3a03e1](_0xfbee('0x65'),_0x55fabd,_0x55fabd,_0x55fabd);}}else{_0x2afbf7=_[_0xfbee('0x5d')](_0x1dd75d,[_0xfbee('0x2f'),_0xfbee('0x66')]);_0x36932d['field']=_0xfbee('0x66');_0x4b6806=as['buildExpression'](_0x312b7e,_0x2afbf7[_0xfbee('0x3b')],_0x36932d);_0x5b0011[_0x3a03e1](_0x4b6806[_0xfbee('0x67')],_0x4b6806['value']['start'],_0x4b6806[_0xfbee('0x63')][_0xfbee('0x2c')]);}break;case'Tag':var _0x5c18d4=_0x36932d[_0xfbee('0x63')][_0xfbee('0x64')](',')[_0xfbee('0x32')](function(_0x173f72){return Number(_0x173f72);});_0x5c18d4[_0xfbee('0x68')](function(_0x1a29c7){_0x5c8912['or'](_0xfbee('0x69'),'%,'+_0x1a29c7+',%');});_0x499bec=_[_0xfbee('0x6a')](_0x499bec,_0x5c18d4);break;case _0xfbee('0x6b'):if(_0x36932d[_0xfbee('0x62')]===_0xfbee('0x6c')){_0x5b0011[_0x3a03e1](_0xfbee('0x6d'),'%'+_0x36932d[_0xfbee('0x63')]+'%',null);}else{_0x2afbf7=_['find'](_0x1dd75d,[_0xfbee('0x2f'),'UserId']);_0x36932d[_0xfbee('0x4a')]=_0xfbee('0x6e');_0x4b6806=as[_0xfbee('0x6f')](_0x312b7e,_0x2afbf7[_0xfbee('0x3b')],_0x36932d);_0x5b0011[_0x3a03e1](_0x4b6806['text'],_0x4b6806[_0xfbee('0x63')][_0xfbee('0x70')],_0x4b6806[_0xfbee('0x63')][_0xfbee('0x2c')]);}break;case'body':_0x4b6806=as[_0xfbee('0x6f')]('me',null,_0x36932d);_0x5b0011[_0x3a03e1](_0x4b6806[_0xfbee('0x67')],_0x4b6806['value'][_0xfbee('0x70')],_0x4b6806['value']['end']);break;}}else{var _0x4b6806=as[_0xfbee('0x6f')](_0x312b7e,_0x2afbf7['type'],_0x36932d);_0x5b0011[_0x3a03e1](_0x4b6806['text'],_0x4b6806[_0xfbee('0x63')][_0xfbee('0x70')],_0x4b6806['value'][_0xfbee('0x2c')]);}}}else{var _0x2fc7c9=_(_0x5386da[_0xfbee('0x3f')])[_0xfbee('0x3e')]()[_0xfbee('0x32')](function(_0x356026){return _[_0xfbee('0x71')](_0x1dd75d,[_0xfbee('0x2f'),_0x356026])?_0x356026:undefined;})[_0xfbee('0x72')]()[_0xfbee('0x63')]();if(!_[_0xfbee('0x73')](_0x2fc7c9)){_0x2fc7c9['forEach'](function(_0x53f86c){if(_0x53f86c===_0xfbee('0x74')){_0x7ae1ff[_0xfbee('0x75')](_0xfbee('0x76'),[]['concat'](_0x5386da[_0xfbee('0x3f')][_0x53f86c]));}else if(_0x53f86c==='createdAt'){var _0x113fa0=JSON[_0xfbee('0x77')](_0x5386da[_0xfbee('0x3f')][_0x53f86c])['$gte'];var _0x26e1f=JSON[_0xfbee('0x77')](_0x5386da[_0xfbee('0x3f')][_0x53f86c])['$lte'];_0x7ae1ff['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x113fa0,_0x26e1f);}else{if(_0x5386da[_0xfbee('0x3f')][_0x53f86c]==='null'){_0x7ae1ff[_0xfbee('0x75')]('i.'+_0x53f86c+'\x20IS\x20NULL');}else{_0x7ae1ff['where']('i.'+_0x53f86c+_0xfbee('0x78'),_0x5386da['query'][_0x53f86c]);}}});}if(_0x5386da[_0xfbee('0x3f')][_0xfbee('0x79')]){if(_0x5386da[_0xfbee('0x3f')][_0xfbee('0x79')]==0x1){_0x7ae1ff[_0xfbee('0x5f')](_0xfbee('0x7a'));}else{_0x7ae1ff[_0xfbee('0x5f')](_0xfbee('0x7b'));}}if(_0x5386da[_0xfbee('0x3f')]['tag']){_0x499bec=_[_0xfbee('0x7c')](_0x5386da['query']['tag'])?_0x5386da[_0xfbee('0x3f')][_0xfbee('0x7d')]:new Array(_0x5386da[_0xfbee('0x3f')]['tag']);_0x499bec['forEach'](function(_0x396923){_0x5c8912['or'](_0xfbee('0x69'),'%,'+_0x396923+',%');});}if(_0x5386da[_0xfbee('0x3f')][_0xfbee('0x7e')]){var _0x587a6e=_0x5386da[_0xfbee('0x3f')][_0xfbee('0x7e')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x587a6e)){_0x5b0011['or'](_0xfbee('0x7f'),_0x587a6e+'%')['or'](_0xfbee('0x80'),_0x587a6e+'%');}_0x5b0011['or'](_0xfbee('0x81'),_0x587a6e+'%');}}_0x7ae1ff[_0xfbee('0x75')](_0x5b0011);_0x7ae1ff[_0xfbee('0x82')](_0xfbee('0x83'));var _0x51475a={'type':db[_0xfbee('0x84')]['QueryTypes'][_0xfbee('0x85')],'raw':!![]};var _0x29f060=_0x7ae1ff[_0xfbee('0x86')]();_0x29f060[_0xfbee('0x4a')](_0xfbee('0x83'));_0x29f060[_0xfbee('0x4a')](_0xfbee('0x87'),_0xfbee('0x5e'));if(_0x103096['order']){_0x103096[_0xfbee('0x46')][_0xfbee('0x68')](function(_0x586f38){var _0x2c0ac9=_0x586f38[0x0]===_0xfbee('0x88')?_0x586f38[0x0]:'i.'+_0x586f38[0x0];_0x7ae1ff[_0xfbee('0x46')](_0x2c0ac9,_0x586f38[0x1]==='DESC'?![]:!![]);});}if(!_[_0xfbee('0x73')](_0x499bec)){_0x7ae1ff['having'](_0x5c8912);_0x29f060[_0xfbee('0x75')](_0xfbee('0x89'),_0x499bec);}BPromise['resolve']()['then'](function(){if(!_0x2cd6a6){if(_0x5386da[_0xfbee('0x3f')][_0xfbee('0x74')])return;_0x29f060[_0xfbee('0x75')](_0xfbee('0x8a'));_0x7ae1ff['where'](_0xfbee('0x8a'));return;}if(_0x5386da['user'][_0xfbee('0x8b')]!==_0xfbee('0x8c'))return;return _0x5386da[_0xfbee('0x8d')][_0xfbee('0x8e')]({'attributes':['id'],'raw':!![]})[_0xfbee('0x2b')](function(_0x187479){if(_[_0xfbee('0x73')](_0x187479)){_0x29f060[_0xfbee('0x75')]('i.FaxAccountId\x20IS\x20NULL');_0x7ae1ff[_0xfbee('0x75')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x29f060[_0xfbee('0x75')](_0xfbee('0x76'),_[_0xfbee('0x32')](_0x187479,'id'));_0x7ae1ff[_0xfbee('0x75')](_0xfbee('0x76'),_[_0xfbee('0x32')](_0x187479,'id'));}});})[_0xfbee('0x2b')](function(){if(_0x5386da['user']['role']===_0xfbee('0x8c')&&!_0x2cd6a6&&!_0x5386da[_0xfbee('0x3f')]['FaxAccountId'])return[];return db[_0xfbee('0x8f')][_0xfbee('0x3f')](_0x29f060[_0xfbee('0x90')](),_0x51475a);})[_0xfbee('0x2b')](function(_0x581845){_0x10368f[_0xfbee('0x23')]=_0x581845['length'];if(_0x10368f['count']===0x0)return[];return db['sequelize'][_0xfbee('0x3f')](_0x4ec7b1[_0xfbee('0x90')](),_0x51475a)['then'](function(_0x3fc31e){_0x55a2af=_['keyBy'](_0x3fc31e,'id');_0x51475a=_[_0xfbee('0x91')](_0x51475a,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5386da[_0xfbee('0x3f')][_0xfbee('0x42')]){_0x103096[_0xfbee('0x43')][_0xfbee('0x68')](function(_0x4f3577){_0x7ae1ff['field']('i.'+_0x4f3577);});}else{_0x7ae1ff[_0xfbee('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xfbee('0x5e'));_0x7ae1ff[_0xfbee('0x4a')]('a.key','Account.key');_0x7ae1ff[_0xfbee('0x4a')](_0xfbee('0x92'),_0xfbee('0x93'));_0x7ae1ff[_0xfbee('0x4a')](_0xfbee('0x94'),_0xfbee('0x88'));_0x7ae1ff[_0xfbee('0x4a')](_0xfbee('0x95'));_0x7ae1ff[_0xfbee('0x4a')]('c.firstName',_0xfbee('0x96'));_0x7ae1ff[_0xfbee('0x4a')](_0xfbee('0x97'),_0xfbee('0x98'));_0x7ae1ff[_0xfbee('0x4a')]('c.email',_0xfbee('0x99'));_0x7ae1ff[_0xfbee('0x4a')]('c.phone','Contact.phone');_0x7ae1ff[_0xfbee('0x4a')](_0xfbee('0x9a'),_0xfbee('0x9b'));_0x7ae1ff[_0xfbee('0x4a')](_0xfbee('0x9c'),_0xfbee('0x9d'));_0x7ae1ff[_0xfbee('0x4a')](_0xfbee('0x9e'),_0xfbee('0x9f'));_0x7ae1ff[_0xfbee('0x4a')](_0xfbee('0xa0'),'Owner.internal');_0x7ae1ff[_0xfbee('0x4a')](_0xfbee('0xa1'),'TagIds');}if(_0x103096[_0xfbee('0x22')])_0x7ae1ff['limit'](_0x103096['limit']);if(_0x103096[_0xfbee('0x20')])_0x7ae1ff['offset'](_0x103096[_0xfbee('0x20')]);return db[_0xfbee('0x8f')][_0xfbee('0x3f')](_0x7ae1ff[_0xfbee('0x90')](),_0x51475a);})['then'](function(_0x57d9f5){if(_0x57d9f5[_0xfbee('0x5c')]>0x0)_0x3fd296[_0xfbee('0x75')](_0xfbee('0xa2'),_[_0xfbee('0x32')](_0x57d9f5,'id'));return db[_0xfbee('0x8f')]['query'](_0x3fd296[_0xfbee('0x90')](),_0x51475a)[_0xfbee('0x2b')](function(_0x2e43e5){var _0x143981=_['groupBy'](_0x2e43e5,_0xfbee('0xa3'));var _0x451a84=[];_0x57d9f5[_0xfbee('0x68')](function(_0x1b5dab){_0x451a84[_0xfbee('0x36')](updateFaxInteraction(_0x1b5dab,_0x55a2af,_0x143981));});return BPromise[_0xfbee('0xa4')](_0x451a84);});});})[_0xfbee('0x2b')](function(_0x10607f){_0x10368f[_0xfbee('0xa5')]=_0x10607f;return _0x10368f;})[_0xfbee('0x2b')](respondWithFilteredResult(_0x402b63,_0x103096))[_0xfbee('0xa6')](handleError(_0x402b63,null));};exports[_0xfbee('0xa7')]=function(_0x2f899f,_0x4bfa2c){var _0x4ae7d9={'raw':![],'where':{'id':_0x2f899f[_0xfbee('0xa8')]['id']}},_0x2c2f96={};_0x2c2f96['model']=_[_0xfbee('0x3e')](db[_0xfbee('0x38')][_0xfbee('0x39')]);_0x2c2f96[_0xfbee('0x3f')]=_[_0xfbee('0x3e')](_0x2f899f['query']);_0x2c2f96[_0xfbee('0x40')]=_['intersection'](_0x2c2f96[_0xfbee('0x3d')],_0x2c2f96[_0xfbee('0x3f')]);_0x4ae7d9[_0xfbee('0x43')]=_[_0xfbee('0x41')](_0x2c2f96[_0xfbee('0x3d')],qs['fields'](_0x2f899f[_0xfbee('0x3f')][_0xfbee('0x42')]));_0x4ae7d9['attributes']=_0x4ae7d9[_0xfbee('0x43')][_0xfbee('0x5c')]?_0x4ae7d9[_0xfbee('0x43')]:_0x2c2f96['model'];if(_0x2f899f[_0xfbee('0x3f')]['includeAll']){_0x4ae7d9[_0xfbee('0xa9')]=[{'all':!![]}];}_0x4ae7d9=_[_0xfbee('0x91')]({},_0x4ae7d9,_0x2f899f['options']);return db[_0xfbee('0x38')]['find'](_0x4ae7d9)[_0xfbee('0x2b')](handleEntityNotFound(_0x4bfa2c,null))[_0xfbee('0x2b')](respondWithResult(_0x4bfa2c,null))[_0xfbee('0xa6')](handleError(_0x4bfa2c,null));};exports[_0xfbee('0xaa')]=function(_0x1ef9c2,_0x26c57c){return db[_0xfbee('0x38')]['create'](_0x1ef9c2[_0xfbee('0xab')],{})[_0xfbee('0x2b')](respondWithResult(_0x26c57c,0xc9))[_0xfbee('0xa6')](handleError(_0x26c57c,null));};exports['update']=function(_0x7cda71,_0x553d18){if(_0x7cda71[_0xfbee('0xab')]['id']){delete _0x7cda71[_0xfbee('0xab')]['id'];}return db[_0xfbee('0x38')]['find']({'where':{'id':_0x7cda71[_0xfbee('0xa8')]['id']}})[_0xfbee('0x2b')](handleEntityNotFound(_0x553d18,null))['then'](saveUpdates(_0x7cda71['body'],null))[_0xfbee('0x2b')](respondWithResult(_0x553d18,null))['catch'](handleError(_0x553d18,null));};exports[_0xfbee('0x2a')]=function(_0x3ea974,_0x526811){return db[_0xfbee('0x38')][_0xfbee('0x5d')]({'where':{'id':_0x3ea974['params']['id']}})[_0xfbee('0x2b')](handleEntityNotFound(_0x526811,null))[_0xfbee('0x2b')](removeEntity(_0x526811,null))[_0xfbee('0xa6')](handleError(_0x526811,null));};exports[_0xfbee('0xac')]=function(_0x101b6d,_0x3c4512){return db[_0xfbee('0x38')][_0xfbee('0xac')]()[_0xfbee('0x2b')](respondWithResult(_0x3c4512,null))['catch'](handleError(_0x3c4512,null));};exports[_0xfbee('0xad')]=function(_0xc5ad0f,_0x3f0003,_0xf69e22){return db['FaxMessage'][_0xfbee('0x5d')]({'where':{'id':_0xc5ad0f[_0xfbee('0xa8')]['id']}})[_0xfbee('0x2b')](handleEntityNotFound(_0x3f0003,null))[_0xfbee('0x2b')](function(_0x52f5c8){if(_0x52f5c8){return _0x52f5c8['addMessage'](_0xc5ad0f[_0xfbee('0xab')][_0xfbee('0xae')],_[_0xfbee('0xaf')](_0xc5ad0f[_0xfbee('0xab')],['ids','id'])||{});}})[_0xfbee('0x2b')](respondWithResult(_0x3f0003,null))[_0xfbee('0xa6')](handleError(_0x3f0003,null));};exports['getMessages']=function(_0x2a5a11,_0x8b0ebc,_0x229aee){var _0x5b994b={'raw':![],'where':{}};var _0x5cf3dd={};var _0x3ca58f={'count':0x0,'rows':[]};return db[_0xfbee('0x38')]['findOne']({'where':{'id':_0x2a5a11[_0xfbee('0xa8')]['id']}})['then'](handleEntityNotFound(_0x8b0ebc,null))[_0xfbee('0x2b')](function(_0x27b7ce){if(_0x27b7ce){_0x5cf3dd['model']=_['keys'](db[_0xfbee('0xb0')][_0xfbee('0x39')]);_0x5cf3dd[_0xfbee('0x3f')]=_[_0xfbee('0x3e')](_0x2a5a11['query']);_0x5cf3dd[_0xfbee('0x40')]=_[_0xfbee('0x41')](_0x5cf3dd[_0xfbee('0x3d')],_0x5cf3dd[_0xfbee('0x3f')]);_0x5b994b[_0xfbee('0x43')]=_[_0xfbee('0x41')](_0x5cf3dd[_0xfbee('0x3d')],qs[_0xfbee('0x42')](_0x2a5a11[_0xfbee('0x3f')][_0xfbee('0x42')]));_0x5b994b['attributes']=_0x5b994b[_0xfbee('0x43')][_0xfbee('0x5c')]?_0x5b994b[_0xfbee('0x43')]:_0x5cf3dd[_0xfbee('0x3d')];if(!_0x2a5a11[_0xfbee('0x3f')][_0xfbee('0x44')](_0xfbee('0x45'))){_0x5b994b[_0xfbee('0x22')]=qs[_0xfbee('0x22')](_0x2a5a11[_0xfbee('0x3f')][_0xfbee('0x22')]);_0x5b994b[_0xfbee('0x20')]=qs['offset'](_0x2a5a11[_0xfbee('0x3f')][_0xfbee('0x20')]);}_0x5b994b['order']=qs['sort'](_0x2a5a11[_0xfbee('0x3f')]['sort']);_0x5b994b[_0xfbee('0x75')]=qs[_0xfbee('0x40')](_[_0xfbee('0x48')](_0x2a5a11[_0xfbee('0x3f')],_0x5cf3dd[_0xfbee('0x40')]));_0x5b994b[_0xfbee('0x75')][_0xfbee('0xa3')]=_0x27b7ce['id'];if(_0x2a5a11['query'][_0xfbee('0x7e')]){_0x5b994b[_0xfbee('0x75')]=_[_0xfbee('0x91')](_0x5b994b['where'],{'$or':_[_0xfbee('0x32')](_0x5b994b['attributes'],function(_0xf6462){var _0x5afe5b={};_0x5afe5b[_0xf6462]={'$like':'%'+_0x2a5a11[_0xfbee('0x3f')]['filter']+'%'};return _0x5afe5b;})});}if(_0x2a5a11['query'][_0xfbee('0xb1')]){var _0x475290=_0x2a5a11['query'][_0xfbee('0xb1')]['split'](',');var _0x51e924={};_0x51e924[_0x475290[0x0]]={'$gte':moment(_0x475290[0x1])[_0xfbee('0xb2')](_0xfbee('0xb3'))};_0x5b994b[_0xfbee('0x75')]=_[_0xfbee('0x91')](_0x5b994b['where'],_0x51e924);}_0x5b994b=_[_0xfbee('0x91')]({},_0x5b994b,_0x2a5a11[_0xfbee('0xb4')]);return db[_0xfbee('0xb0')][_0xfbee('0x23')]({'where':_0x5b994b[_0xfbee('0x75')]})['then'](function(_0x4cd1ef){_0x3ca58f['count']=_0x4cd1ef;if(_0x2a5a11[_0xfbee('0x3f')][_0xfbee('0xb5')]){_0x5b994b[_0xfbee('0xa9')]=[{'all':!![]}];}return db[_0xfbee('0xb0')][_0xfbee('0xb6')](_0x5b994b);})[_0xfbee('0x2b')](function(_0x1fbb9a){_0x3ca58f[_0xfbee('0xa5')]=_0x1fbb9a;return _0x3ca58f;});}})[_0xfbee('0x2b')](respondWithFilteredResult(_0x8b0ebc,_0x5b994b))[_0xfbee('0xa6')](handleError(_0x8b0ebc,null));};exports[_0xfbee('0xb7')]=function(_0x2dc12d,_0x249e80,_0x5d76f0){return db[_0xfbee('0x38')][_0xfbee('0x5d')]({'where':{'id':_0x2dc12d[_0xfbee('0xa8')]['id']}})[_0xfbee('0x2b')](handleEntityNotFound(_0x249e80,null))[_0xfbee('0x2b')](function(_0x57e7f5){if(_0x57e7f5){return _0x57e7f5[_0xfbee('0xb8')](_0x2dc12d[_0xfbee('0xab')][_0xfbee('0xae')],_[_0xfbee('0xaf')](_0x2dc12d['body'],[_0xfbee('0xae'),'id'])||{})[_0xfbee('0xb9')](function(){return db[_0xfbee('0xba')][_0xfbee('0xb6')]({'attributes':['id',_0xfbee('0x2f'),_0xfbee('0xbb')],'where':{'id':_0x2dc12d[_0xfbee('0xab')][_0xfbee('0xae')]}});})[_0xfbee('0x2b')](function(_0x307de7){socket[_0xfbee('0xbc')](_0xfbee('0xbd'),{'id':Number(_0x2dc12d['params']['id']),'tags':_0x307de7||[]});return{'id':Number(_0x2dc12d[_0xfbee('0xa8')]['id']),'tags':_0x307de7||[]};});}})[_0xfbee('0x2b')](respondWithResult(_0x249e80,null))['catch'](handleError(_0x249e80,null));};exports[_0xfbee('0xbe')]=function(_0x299616,_0x401b8d,_0x51ce66){return db[_0xfbee('0x38')][_0xfbee('0x5d')]({'where':{'id':_0x299616[_0xfbee('0xa8')]['id']}})['then'](handleEntityNotFound(_0x401b8d,null))[_0xfbee('0x2b')](function(_0x53dd63){if(_0x53dd63){return _0x53dd63['removeTags'](_0x299616[_0xfbee('0x3f')][_0xfbee('0xae')]);}})[_0xfbee('0x2b')](respondWithStatusCode(_0x401b8d,null))[_0xfbee('0xa6')](handleError(_0x401b8d,null));};exports['download']=function(_0x457cd2,_0xd11c9d){var _0x51870f=moment()[_0xfbee('0xbf')]()['toString']();var _0x254466=path[_0xfbee('0xc0')](config['root'],_0xfbee('0xc1'),_0xfbee('0xc2'),_0xfbee('0xc3'));var _0x3c3405=path[_0xfbee('0xc0')](config[_0xfbee('0xc4')],'server',_0xfbee('0xc2'),_0xfbee('0xc5'));var _0x597905=path[_0xfbee('0xc0')](_0x254466,_0x51870f);var _0x57fdb0=util['format'](_0xfbee('0xc6'),_0x457cd2[_0xfbee('0xa8')]['id'],_0x51870f);var _0x40ecd3=path[_0xfbee('0xc0')](_0x254466,_0x57fdb0);var _0x2d3a01=[];_0x2d3a01['push']({'model':db[_0xfbee('0xc7')],'as':_0xfbee('0xc7'),'raw':!![]});var _0x56b083=[{'model':db[_0xfbee('0xb0')],'as':'Messages','attributes':['id',_0xfbee('0xab'),_0xfbee('0xc8')],'include':_0x2d3a01}];return db['FaxInteraction'][_0xfbee('0x5d')]({'where':{'id':_0x457cd2[_0xfbee('0xa8')]['id']},'include':_0x56b083})['then'](handleEntityNotFound(_0xd11c9d,null))[_0xfbee('0x2b')](function(_0x4ee843){if(_0x4ee843&&_0x4ee843[_0xfbee('0xc9')]){var _0x3a586a=_0x4ee843[_0xfbee('0xca')]({'plain':!![]});fs['mkdirSync'](_0x597905);for(var _0x4174b4=0x0;_0x4174b4<_0x3a586a['Messages'][_0xfbee('0x5c')];_0x4174b4++){var _0x4f7391=_0x3a586a[_0xfbee('0xc9')][_0x4174b4][_0xfbee('0xc7')];if(_0x4f7391){var _0x2fcf0b=path[_0xfbee('0xc0')](_0x3c3405,_0x4f7391[_0xfbee('0xcb')]);if(fs[_0xfbee('0xcc')](_0x2fcf0b)){fs['createReadStream'](_0x2fcf0b)['pipe'](fs[_0xfbee('0xcd')](path[_0xfbee('0xc0')](_0x597905,_0x4f7391[_0xfbee('0xcb')])));}}}return BPromise[_0xfbee('0xce')]()[_0xfbee('0x2b')](function(){return new BPromise(function(_0x33509d,_0x1a1096){zipdir(_0x597905,{'saveTo':_0x40ecd3},function(_0xf2dd5c,_0x14f764){if(_0xf2dd5c)return _0x1a1096(_0xf2dd5c);return _0x33509d(_0x14f764);});})['then'](function(){return new BPromise(function(_0x24a28b,_0x49ec66){rimraf(_0x597905,function(_0x33a6e1){if(_0x33a6e1)_0x49ec66(_0x33a6e1);return _0x24a28b();});});})[_0xfbee('0x2b')](function(){return _0xd11c9d[_0xfbee('0xcf')](_0x40ecd3,_0x57fdb0,function(_0x826a30){if(_0x826a30){console[_0xfbee('0xd0')](_0xfbee('0xd1'),_0x826a30);}else{fs['unlinkSync'](_0x40ecd3);}});});});}else{return _0xd11c9d[_0xfbee('0x1e')](0xc8);}})['catch'](handleError(_0xd11c9d,null));}; \ No newline at end of file +var _0xff82=['fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','FaxAccountId','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','show','rawAttributes','includeAll','include','create','body','params','destroy','describe','addMessage','FaxMessage','ids','omit','filter','$gte','options','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','Attachment','Messages','get','basename','existsSync','resolve','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','index','fieldName','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xff82,0x89));var _0x2ff8=function(_0x33f1bc,_0x389005){_0x33f1bc=_0x33f1bc-0x0;var _0x29e247=_0xff82[_0x33f1bc];return _0x29e247;};'use strict';var emlformat=require(_0x2ff8('0x0'));var rimraf=require(_0x2ff8('0x1'));var zipdir=require(_0x2ff8('0x2'));var jsonpatch=require(_0x2ff8('0x3'));var rp=require(_0x2ff8('0x4'));var moment=require(_0x2ff8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2ff8('0x6'));var util=require(_0x2ff8('0x7'));var path=require(_0x2ff8('0x8'));var sox=require(_0x2ff8('0x9'));var csv=require(_0x2ff8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ff8('0xb'));var _=require(_0x2ff8('0xc'));var squel=require(_0x2ff8('0xd'));var crypto=require(_0x2ff8('0xe'));var jsforce=require(_0x2ff8('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2ff8('0x10'));var Papa=require(_0x2ff8('0x11'));var Redis=require(_0x2ff8('0x12'));var authService=require(_0x2ff8('0x13'));var qs=require(_0x2ff8('0x14'));var as=require(_0x2ff8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ff8('0x16'))(_0x2ff8('0x17'));var utils=require(_0x2ff8('0x18'));var config=require(_0x2ff8('0x19'));var licenseUtil=require(_0x2ff8('0x1a'));var db=require(_0x2ff8('0x1b'))['db'];config[_0x2ff8('0x1c')]=_[_0x2ff8('0x1d')](config['redis'],{'host':_0x2ff8('0x1e'),'port':0x18eb});var socket=require(_0x2ff8('0x1f'))(new Redis(config['redis']));require(_0x2ff8('0x20'))[_0x2ff8('0x21')](socket);function respondWithStatusCode(_0x107c32,_0x45216c){_0x45216c=_0x45216c||0xcc;return function(_0x58ffe8){if(_0x58ffe8){return _0x107c32[_0x2ff8('0x22')](_0x45216c);}return _0x107c32[_0x2ff8('0x23')](_0x45216c)[_0x2ff8('0x24')]();};}function respondWithResult(_0x15749e,_0x34ebcc){_0x34ebcc=_0x34ebcc||0xc8;return function(_0x5def13){if(_0x5def13){return _0x15749e[_0x2ff8('0x23')](_0x34ebcc)[_0x2ff8('0x25')](_0x5def13);}};}function respondWithFilteredResult(_0xe94b8a,_0x399e8e){return function(_0x4febad){if(_0x4febad){var _0x1f0c84=typeof _0x399e8e[_0x2ff8('0x26')]===_0x2ff8('0x27')&&typeof _0x399e8e[_0x2ff8('0x28')]===_0x2ff8('0x27');var _0x2ece79=_0x4febad[_0x2ff8('0x29')];var _0x3855e2=_0x1f0c84?0x0:_0x399e8e['offset'];var _0x1171c1=_0x1f0c84?_0x4febad[_0x2ff8('0x29')]:_0x399e8e[_0x2ff8('0x26')]+_0x399e8e[_0x2ff8('0x28')];var _0x53b9b5;if(_0x1171c1>=_0x2ece79){_0x1171c1=_0x2ece79;_0x53b9b5=0xc8;}else{_0x53b9b5=0xce;}_0xe94b8a[_0x2ff8('0x23')](_0x53b9b5);return _0xe94b8a[_0x2ff8('0x2a')](_0x2ff8('0x2b'),_0x3855e2+'-'+_0x1171c1+'/'+_0x2ece79)[_0x2ff8('0x25')](_0x4febad);}return null;};}function patchUpdates(_0x143deb){return function(_0x1ac17e){try{jsonpatch[_0x2ff8('0x2c')](_0x1ac17e,_0x143deb,!![]);}catch(_0x449ca3){return BPromise[_0x2ff8('0x2d')](_0x449ca3);}return _0x1ac17e[_0x2ff8('0x2e')]();};}function saveUpdates(_0x4dac04,_0x25dd37){return function(_0x4ddb67){if(_0x4ddb67){return _0x4ddb67[_0x2ff8('0x2f')](_0x4dac04)[_0x2ff8('0x30')](function(_0x23c889){return _0x23c889;});}return null;};}function removeEntity(_0x2d335e,_0x3067d6){return function(_0x56b81f){if(_0x56b81f){return _0x56b81f['destroy']()[_0x2ff8('0x30')](function(){_0x2d335e['status'](0xcc)[_0x2ff8('0x24')]();});}};}function handleEntityNotFound(_0x46bae7,_0x4c69e6){return function(_0xf8b7ad){if(!_0xf8b7ad){_0x46bae7['sendStatus'](0x194);}return _0xf8b7ad;};}function handleError(_0x490fe2,_0xec2396){_0xec2396=_0xec2396||0x1f4;return function(_0x158c22){logger[_0x2ff8('0x31')](_0x158c22[_0x2ff8('0x32')]);if(_0x158c22[_0x2ff8('0x33')]){delete _0x158c22[_0x2ff8('0x33')];}_0x490fe2[_0x2ff8('0x23')](_0xec2396)[_0x2ff8('0x34')](_0x158c22);};}function getInteractionUsers(_0x155c7c,_0x50c051){return new BPromise(function(_0x1b8a10,_0x106395){try{if(_0x50c051[_0x155c7c['id']]){_0x155c7c[_0x2ff8('0x35')]=_[_0x2ff8('0x36')](_0x50c051[_0x155c7c['id']],function(_0x5233ce){return{'id':_0x5233ce['id'],'fullname':_0x5233ce[_0x2ff8('0x37')]};});}}catch(_0x3cb82f){_0x106395(_0x3cb82f);}_0x1b8a10(_0x155c7c);});}function getInteractionTags(_0x31683e,_0x3228f1){return new BPromise(function(_0x174cfc,_0x5b1010){try{if(_0x31683e['TagIds']){_0x31683e[_0x2ff8('0x38')]=[];_0x31683e[_0x2ff8('0x39')][_0x2ff8('0x3a')](',')[_0x2ff8('0x3b')](function(_0x583e56){_0x31683e['Tags'][_0x2ff8('0x3c')](_0x3228f1[_0x583e56]);});}delete _0x31683e['TagIds'];}catch(_0x3af2bc){_0x5b1010(_0x3af2bc);}_0x174cfc(_0x31683e);});}function updateFaxInteraction(_0x53fc4b,_0x5a3cf3,_0x50c9d8){return new BPromise(function(_0x53edef,_0x97843e){return getInteractionUsers(_0x53fc4b,_0x50c9d8)[_0x2ff8('0x30')](function(_0x5ccb0d){return getInteractionTags(_0x5ccb0d,_0x5a3cf3);})['then'](function(_0x1b6305){_0x53edef(_0x1b6305);})[_0x2ff8('0x3d')](function(_0x143e2e){_0x97843e(_0x143e2e);});});}exports[_0x2ff8('0x3e')]=function(_0x178dae,_0x471309){var _0x508903={},_0x23d98b={},_0x10d357={'count':0x0,'rows':[]};var _0x7d3a23=_[_0x2ff8('0x36')](db['FaxInteraction']['rawAttributes'],function(_0x2f7bab){return{'name':_0x2f7bab[_0x2ff8('0x3f')],'type':_0x2f7bab['type']['key']};});_0x23d98b[_0x2ff8('0x40')]=_['map'](_0x7d3a23,'name');_0x23d98b['query']=_[_0x2ff8('0x41')](_0x178dae[_0x2ff8('0x42')]);_0x23d98b['filters']=_[_0x2ff8('0x43')](_0x23d98b['model'],_0x23d98b[_0x2ff8('0x42')]);_0x508903[_0x2ff8('0x44')]=_[_0x2ff8('0x43')](_0x23d98b[_0x2ff8('0x40')],qs[_0x2ff8('0x45')](_0x178dae[_0x2ff8('0x42')][_0x2ff8('0x45')]));_0x508903['attributes']=_0x508903[_0x2ff8('0x44')][_0x2ff8('0x46')]?_0x508903[_0x2ff8('0x44')]:_0x23d98b[_0x2ff8('0x40')];if(!_0x178dae[_0x2ff8('0x42')][_0x2ff8('0x47')](_0x2ff8('0x48'))){_0x508903[_0x2ff8('0x28')]=qs['limit'](_0x178dae[_0x2ff8('0x42')][_0x2ff8('0x28')]);_0x508903['offset']=qs[_0x2ff8('0x26')](_0x178dae[_0x2ff8('0x42')][_0x2ff8('0x26')]);}_0x508903[_0x2ff8('0x49')]=qs[_0x2ff8('0x4a')](_0x178dae[_0x2ff8('0x42')][_0x2ff8('0x4a')]);_0x508903[_0x2ff8('0x4b')]=qs['filters'](_[_0x2ff8('0x4c')](_0x178dae[_0x2ff8('0x42')],_0x23d98b[_0x2ff8('0x4d')]),_0x7d3a23);var _0x3e1309=[];var _0x309284=squel[_0x2ff8('0x4e')]()[_0x2ff8('0x4f')]('id')[_0x2ff8('0x4f')](_0x2ff8('0x33'))[_0x2ff8('0x4f')](_0x2ff8('0x50'))[_0x2ff8('0x51')](_0x2ff8('0x52'));var _0x5f5a38=squel['select']()[_0x2ff8('0x4f')](_0x2ff8('0x53'))['field'](_0x2ff8('0x54'))[_0x2ff8('0x4f')](_0x2ff8('0x55'))[_0x2ff8('0x51')](_0x2ff8('0x56'),'ui')['left_join'](_0x2ff8('0x57'),'u','u.id\x20=\x20ui.UserId');var _0xc514a7=squel[_0x2ff8('0x4e')]()[_0x2ff8('0x51')](_0x2ff8('0x58'),'i')[_0x2ff8('0x59')](_0x2ff8('0x5a'),'c',_0x2ff8('0x5b'))[_0x2ff8('0x59')](_0x2ff8('0x57'),'o',_0x2ff8('0x5c'))['left_join'](_0x2ff8('0x5d'),'a',_0x2ff8('0x5e'))[_0x2ff8('0x59')](_0x2ff8('0x5f'),'me',_0x2ff8('0x60'))['left_join'](_0x2ff8('0x61'),'it',_0x2ff8('0x62'))[_0x2ff8('0x59')]('tools_tags','t',_0x2ff8('0x63'));var _0x1051d7=squel[_0x2ff8('0x64')]();var _0x27c2eb=[];var _0x369e79=squel[_0x2ff8('0x64')]();var _0x512695;if(_0x178dae['query'][_0x2ff8('0x65')]){_0x512695=as['parseSearch'](_0x178dae[_0x2ff8('0x42')][_0x2ff8('0x65')]);var _0x5c743a=_0x512695[_0x2ff8('0x66')];for(var _0x59c95c=0x0;_0x59c95c<_0x512695[_0x2ff8('0x67')][_0x2ff8('0x46')];_0x59c95c++){var _0x27861b=_0x512695[_0x2ff8('0x67')][_0x59c95c];var _0x248748='i';var _0x25eb83=_['find'](_0x7d3a23,[_0x2ff8('0x33'),_0x27861b[_0x2ff8('0x4f')]]);if(!_0x25eb83){switch(_0x27861b[_0x2ff8('0x4f')]){case _0x2ff8('0x68'):if(_0x27861b[_0x2ff8('0x69')]==0x1){_0xc514a7[_0x2ff8('0x6a')]('`'+_0x27861b[_0x2ff8('0x4f')]+_0x2ff8('0x6b'));}else{_0xc514a7['having']('`'+_0x27861b[_0x2ff8('0x4f')]+_0x2ff8('0x6c'));}break;case'Contact':if(_0x27861b[_0x2ff8('0x6d')]==='$substring'){if(_0x27861b[_0x2ff8('0x69')]['split']('\x20')[_0x2ff8('0x46')]>0x1){_0x1051d7[_0x5c743a](_0x2ff8('0x6e'),qs[_0x2ff8('0x6f')](_0x27861b[_0x2ff8('0x69')]),null);}else{var _0x4392c0='%'+_0x27861b[_0x2ff8('0x69')]+'%';_0x1051d7[_0x5c743a](_0x2ff8('0x70'),_0x4392c0,_0x4392c0,_0x4392c0);}}else{_0x25eb83=_[_0x2ff8('0x71')](_0x7d3a23,[_0x2ff8('0x33'),'ContactId']);_0x27861b[_0x2ff8('0x4f')]=_0x2ff8('0x72');_0x28aeeb=as[_0x2ff8('0x73')](_0x248748,_0x25eb83[_0x2ff8('0x74')],_0x27861b);_0x1051d7[_0x5c743a](_0x28aeeb[_0x2ff8('0x75')],_0x28aeeb[_0x2ff8('0x69')][_0x2ff8('0x76')],_0x28aeeb['value']['end']);}break;case _0x2ff8('0x77'):var _0x3100ab=_0x27861b[_0x2ff8('0x69')][_0x2ff8('0x3a')](',')[_0x2ff8('0x36')](function(_0x1d8a15){return Number(_0x1d8a15);});_0x3100ab[_0x2ff8('0x3b')](function(_0x515004){_0x369e79['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x515004+',%');});_0x27c2eb=_[_0x2ff8('0x78')](_0x27c2eb,_0x3100ab);break;case _0x2ff8('0x79'):if(_0x27861b[_0x2ff8('0x6d')]==='$substring'){_0x1051d7[_0x5c743a](_0x2ff8('0x7a'),'%'+_0x27861b[_0x2ff8('0x69')]+'%',null);}else{_0x25eb83=_[_0x2ff8('0x71')](_0x7d3a23,[_0x2ff8('0x33'),_0x2ff8('0x7b')]);_0x27861b[_0x2ff8('0x4f')]=_0x2ff8('0x7b');_0x28aeeb=as[_0x2ff8('0x73')](_0x248748,_0x25eb83[_0x2ff8('0x74')],_0x27861b);_0x1051d7[_0x5c743a](_0x28aeeb[_0x2ff8('0x75')],_0x28aeeb[_0x2ff8('0x69')][_0x2ff8('0x76')],_0x28aeeb[_0x2ff8('0x69')][_0x2ff8('0x24')]);}break;case'body':_0x28aeeb=as['buildExpression']('me',null,_0x27861b);_0x1051d7[_0x5c743a](_0x28aeeb[_0x2ff8('0x75')],_0x28aeeb[_0x2ff8('0x69')][_0x2ff8('0x76')],_0x28aeeb[_0x2ff8('0x69')][_0x2ff8('0x24')]);break;}}else{var _0x28aeeb=as[_0x2ff8('0x73')](_0x248748,_0x25eb83[_0x2ff8('0x74')],_0x27861b);_0x1051d7[_0x5c743a](_0x28aeeb['text'],_0x28aeeb[_0x2ff8('0x69')]['start'],_0x28aeeb['value'][_0x2ff8('0x24')]);}}}else{var _0xe8860f=_(_0x178dae['query'])[_0x2ff8('0x41')]()[_0x2ff8('0x36')](function(_0x36d949){return _[_0x2ff8('0x7c')](_0x7d3a23,[_0x2ff8('0x33'),_0x36d949])?_0x36d949:undefined;})[_0x2ff8('0x7d')]()['value']();if(!_[_0x2ff8('0x7e')](_0xe8860f)){_0xe8860f[_0x2ff8('0x3b')](function(_0x38698f){if(_0x38698f===_0x2ff8('0x7f')){_0xc514a7[_0x2ff8('0x4b')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x178dae[_0x2ff8('0x42')][_0x38698f]));}else if(_0x38698f===_0x2ff8('0x80')){var _0x12c102=JSON[_0x2ff8('0x81')](_0x178dae[_0x2ff8('0x42')][_0x38698f])['$gte'];var _0x526c8f=JSON[_0x2ff8('0x81')](_0x178dae[_0x2ff8('0x42')][_0x38698f])[_0x2ff8('0x82')];_0xc514a7[_0x2ff8('0x4b')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x12c102,_0x526c8f);}else{if(_0x178dae[_0x2ff8('0x42')][_0x38698f]==='null'){_0xc514a7['where']('i.'+_0x38698f+_0x2ff8('0x83'));}else{_0xc514a7[_0x2ff8('0x4b')]('i.'+_0x38698f+_0x2ff8('0x84'),_0x178dae['query'][_0x38698f]);}}});}if(_0x178dae['query']['read']){if(_0x178dae['query'][_0x2ff8('0x85')]==0x1){_0xc514a7[_0x2ff8('0x6a')](_0x2ff8('0x86'));}else{_0xc514a7['having']('`unreadMessages`\x20>\x200');}}if(_0x178dae[_0x2ff8('0x42')][_0x2ff8('0x87')]){_0x27c2eb=_[_0x2ff8('0x88')](_0x178dae[_0x2ff8('0x42')][_0x2ff8('0x87')])?_0x178dae[_0x2ff8('0x42')][_0x2ff8('0x87')]:new Array(_0x178dae[_0x2ff8('0x42')]['tag']);_0x27c2eb[_0x2ff8('0x3b')](function(_0x51e209){_0x369e79['or'](_0x2ff8('0x89'),'%,'+_0x51e209+',%');});}if(_0x178dae[_0x2ff8('0x42')]['filter']){var _0x55fcf5=_0x178dae[_0x2ff8('0x42')]['filter'][_0x2ff8('0x8a')]('\x5c','\x5c\x5c')[_0x2ff8('0x8a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x55fcf5)){_0x1051d7['or'](_0x2ff8('0x8b'),_0x55fcf5+'%')['or'](_0x2ff8('0x8c'),_0x55fcf5+'%');}_0x1051d7['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x55fcf5+'%');}}_0xc514a7['where'](_0x1051d7);_0xc514a7[_0x2ff8('0x8d')]('i.id');var _0x1cfa25={'type':db[_0x2ff8('0x8e')][_0x2ff8('0x8f')][_0x2ff8('0x90')],'raw':!![]};var _0x55cb3e=_0xc514a7[_0x2ff8('0x91')]();_0x55cb3e[_0x2ff8('0x4f')](_0x2ff8('0x92'));_0x55cb3e[_0x2ff8('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2ff8('0x68'));if(_0x508903[_0x2ff8('0x49')]){_0x508903[_0x2ff8('0x49')]['forEach'](function(_0x38b039){var _0x336138=_0x38b039[0x0]===_0x2ff8('0x93')?_0x38b039[0x0]:'i.'+_0x38b039[0x0];_0xc514a7[_0x2ff8('0x49')](_0x336138,_0x38b039[0x1]===_0x2ff8('0x94')?![]:!![]);});}if(!_[_0x2ff8('0x7e')](_0x27c2eb)){_0xc514a7[_0x2ff8('0x6a')](_0x369e79);_0x55cb3e[_0x2ff8('0x4b')](_0x2ff8('0x95'),_0x27c2eb);}BPromise['resolve']()['then'](function(){if(!_0x512695){if(_0x178dae[_0x2ff8('0x42')][_0x2ff8('0x7f')])return;_0x55cb3e[_0x2ff8('0x4b')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0xc514a7[_0x2ff8('0x4b')](_0x2ff8('0x96'));return;}if(_0x178dae[_0x2ff8('0x97')]['role']!=='agent')return;return _0x178dae['user'][_0x2ff8('0x98')]({'attributes':['id'],'raw':!![]})[_0x2ff8('0x30')](function(_0x3b32c3){if(_[_0x2ff8('0x7e')](_0x3b32c3)){_0x55cb3e[_0x2ff8('0x4b')](_0x2ff8('0x99'));_0xc514a7[_0x2ff8('0x4b')](_0x2ff8('0x99'));}else{_0x55cb3e[_0x2ff8('0x4b')](_0x2ff8('0x9a'),_[_0x2ff8('0x36')](_0x3b32c3,'id'));_0xc514a7['where'](_0x2ff8('0x9a'),_[_0x2ff8('0x36')](_0x3b32c3,'id'));}});})[_0x2ff8('0x30')](function(){if(_0x178dae[_0x2ff8('0x97')]['role']===_0x2ff8('0x9b')&&!_0x512695&&!_0x178dae['query'][_0x2ff8('0x7f')])return[];return db[_0x2ff8('0x9c')][_0x2ff8('0x42')](_0x55cb3e['toString'](),_0x1cfa25);})[_0x2ff8('0x30')](function(_0x444881){_0x10d357[_0x2ff8('0x29')]=_0x444881['length'];if(_0x10d357[_0x2ff8('0x29')]===0x0)return[];return db[_0x2ff8('0x9c')][_0x2ff8('0x42')](_0x309284[_0x2ff8('0x9d')](),_0x1cfa25)[_0x2ff8('0x30')](function(_0x35ace4){_0x3e1309=_[_0x2ff8('0x9e')](_0x35ace4,'id');_0x1cfa25=_[_0x2ff8('0x9f')](_0x1cfa25,{'model':db[_0x2ff8('0xa0')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x178dae['query'][_0x2ff8('0x45')]){_0x508903[_0x2ff8('0x44')]['forEach'](function(_0x340492){_0xc514a7[_0x2ff8('0x4f')]('i.'+_0x340492);});}else{_0xc514a7[_0x2ff8('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0xc514a7[_0x2ff8('0x4f')](_0x2ff8('0xa1'),_0x2ff8('0xa2'));_0xc514a7['field'](_0x2ff8('0xa3'),'Account.mandatoryDisposition');_0xc514a7[_0x2ff8('0x4f')](_0x2ff8('0xa4'),'contactName');_0xc514a7[_0x2ff8('0x4f')](_0x2ff8('0xa5'));_0xc514a7[_0x2ff8('0x4f')]('c.firstName',_0x2ff8('0xa6'));_0xc514a7[_0x2ff8('0x4f')](_0x2ff8('0xa7'),_0x2ff8('0xa8'));_0xc514a7[_0x2ff8('0x4f')](_0x2ff8('0xa9'),_0x2ff8('0xaa'));_0xc514a7['field']('c.phone',_0x2ff8('0xab'));_0xc514a7[_0x2ff8('0x4f')](_0x2ff8('0xac'),'Contact.mobile');_0xc514a7[_0x2ff8('0x4f')](_0x2ff8('0xad'),_0x2ff8('0xae'));_0xc514a7['field'](_0x2ff8('0xaf'),_0x2ff8('0xb0'));_0xc514a7[_0x2ff8('0x4f')](_0x2ff8('0xb1'),_0x2ff8('0xb2'));_0xc514a7[_0x2ff8('0x4f')](_0x2ff8('0xb3'),'TagIds');}if(_0x508903[_0x2ff8('0x28')])_0xc514a7[_0x2ff8('0x28')](_0x508903[_0x2ff8('0x28')]);if(_0x508903['offset'])_0xc514a7[_0x2ff8('0x26')](_0x508903[_0x2ff8('0x26')]);return db[_0x2ff8('0x9c')][_0x2ff8('0x42')](_0xc514a7[_0x2ff8('0x9d')](),_0x1cfa25);})[_0x2ff8('0x30')](function(_0x30cd5e){if(_0x30cd5e[_0x2ff8('0x46')]>0x0)_0x5f5a38['where'](_0x2ff8('0xb4'),_[_0x2ff8('0x36')](_0x30cd5e,'id'));return db[_0x2ff8('0x9c')][_0x2ff8('0x42')](_0x5f5a38['toString'](),_0x1cfa25)[_0x2ff8('0x30')](function(_0x3d9aa1){var _0x32cf42=_[_0x2ff8('0xb5')](_0x3d9aa1,_0x2ff8('0xb6'));var _0x58aff4=[];_0x30cd5e['forEach'](function(_0x5b649e){_0x58aff4[_0x2ff8('0x3c')](updateFaxInteraction(_0x5b649e,_0x3e1309,_0x32cf42));});return BPromise['all'](_0x58aff4);});});})[_0x2ff8('0x30')](function(_0x4d0fcb){_0x10d357[_0x2ff8('0xb7')]=_0x4d0fcb;return _0x10d357;})[_0x2ff8('0x30')](respondWithFilteredResult(_0x471309,_0x508903))[_0x2ff8('0x3d')](handleError(_0x471309,null));};exports[_0x2ff8('0xb8')]=function(_0x124b5c,_0xd4cdf1){var _0x475215={'raw':![],'where':{'id':_0x124b5c['params']['id']}},_0x1bae53={};_0x1bae53['model']=_[_0x2ff8('0x41')](db[_0x2ff8('0xa0')][_0x2ff8('0xb9')]);_0x1bae53[_0x2ff8('0x42')]=_['keys'](_0x124b5c['query']);_0x1bae53[_0x2ff8('0x4d')]=_['intersection'](_0x1bae53[_0x2ff8('0x40')],_0x1bae53[_0x2ff8('0x42')]);_0x475215[_0x2ff8('0x44')]=_[_0x2ff8('0x43')](_0x1bae53[_0x2ff8('0x40')],qs[_0x2ff8('0x45')](_0x124b5c[_0x2ff8('0x42')][_0x2ff8('0x45')]));_0x475215['attributes']=_0x475215[_0x2ff8('0x44')][_0x2ff8('0x46')]?_0x475215[_0x2ff8('0x44')]:_0x1bae53[_0x2ff8('0x40')];if(_0x124b5c['query'][_0x2ff8('0xba')]){_0x475215[_0x2ff8('0xbb')]=[{'all':!![]}];}_0x475215=_[_0x2ff8('0x9f')]({},_0x475215,_0x124b5c['options']);return db[_0x2ff8('0xa0')][_0x2ff8('0x71')](_0x475215)[_0x2ff8('0x30')](handleEntityNotFound(_0xd4cdf1,null))['then'](respondWithResult(_0xd4cdf1,null))[_0x2ff8('0x3d')](handleError(_0xd4cdf1,null));};exports[_0x2ff8('0xbc')]=function(_0x20a66b,_0x3a4224){return db['FaxInteraction']['create'](_0x20a66b['body'],{})[_0x2ff8('0x30')](respondWithResult(_0x3a4224,0xc9))[_0x2ff8('0x3d')](handleError(_0x3a4224,null));};exports[_0x2ff8('0x2f')]=function(_0x8c4fb2,_0x11c750){if(_0x8c4fb2[_0x2ff8('0xbd')]['id']){delete _0x8c4fb2[_0x2ff8('0xbd')]['id'];}return db['FaxInteraction'][_0x2ff8('0x71')]({'where':{'id':_0x8c4fb2[_0x2ff8('0xbe')]['id']}})[_0x2ff8('0x30')](handleEntityNotFound(_0x11c750,null))['then'](saveUpdates(_0x8c4fb2[_0x2ff8('0xbd')],null))['then'](respondWithResult(_0x11c750,null))[_0x2ff8('0x3d')](handleError(_0x11c750,null));};exports[_0x2ff8('0xbf')]=function(_0x4109d4,_0xe3f7c1){return db[_0x2ff8('0xa0')][_0x2ff8('0x71')]({'where':{'id':_0x4109d4[_0x2ff8('0xbe')]['id']}})['then'](handleEntityNotFound(_0xe3f7c1,null))[_0x2ff8('0x30')](removeEntity(_0xe3f7c1,null))[_0x2ff8('0x3d')](handleError(_0xe3f7c1,null));};exports[_0x2ff8('0xc0')]=function(_0x4b7e9f,_0x1cda24){return db[_0x2ff8('0xa0')][_0x2ff8('0xc0')]()[_0x2ff8('0x30')](respondWithResult(_0x1cda24,null))[_0x2ff8('0x3d')](handleError(_0x1cda24,null));};exports[_0x2ff8('0xc1')]=function(_0x256cc9,_0x3676de,_0x51823c){return db[_0x2ff8('0xc2')]['find']({'where':{'id':_0x256cc9[_0x2ff8('0xbe')]['id']}})[_0x2ff8('0x30')](handleEntityNotFound(_0x3676de,null))[_0x2ff8('0x30')](function(_0x44bddc){if(_0x44bddc){return _0x44bddc[_0x2ff8('0xc1')](_0x256cc9[_0x2ff8('0xbd')][_0x2ff8('0xc3')],_[_0x2ff8('0xc4')](_0x256cc9[_0x2ff8('0xbd')],[_0x2ff8('0xc3'),'id'])||{});}})[_0x2ff8('0x30')](respondWithResult(_0x3676de,null))[_0x2ff8('0x3d')](handleError(_0x3676de,null));};exports['getMessages']=function(_0x5e5f37,_0x46d485,_0x20e5a7){var _0x567057={'raw':![],'where':{}};var _0x4dcec6={};var _0x1ebb23={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x5e5f37['params']['id']}})['then'](handleEntityNotFound(_0x46d485,null))[_0x2ff8('0x30')](function(_0xe08a8c){if(_0xe08a8c){_0x4dcec6[_0x2ff8('0x40')]=_[_0x2ff8('0x41')](db[_0x2ff8('0xc2')][_0x2ff8('0xb9')]);_0x4dcec6[_0x2ff8('0x42')]=_['keys'](_0x5e5f37[_0x2ff8('0x42')]);_0x4dcec6[_0x2ff8('0x4d')]=_[_0x2ff8('0x43')](_0x4dcec6[_0x2ff8('0x40')],_0x4dcec6['query']);_0x567057[_0x2ff8('0x44')]=_[_0x2ff8('0x43')](_0x4dcec6['model'],qs[_0x2ff8('0x45')](_0x5e5f37['query'][_0x2ff8('0x45')]));_0x567057['attributes']=_0x567057[_0x2ff8('0x44')][_0x2ff8('0x46')]?_0x567057[_0x2ff8('0x44')]:_0x4dcec6[_0x2ff8('0x40')];if(!_0x5e5f37['query'][_0x2ff8('0x47')](_0x2ff8('0x48'))){_0x567057['limit']=qs[_0x2ff8('0x28')](_0x5e5f37['query'][_0x2ff8('0x28')]);_0x567057[_0x2ff8('0x26')]=qs['offset'](_0x5e5f37[_0x2ff8('0x42')][_0x2ff8('0x26')]);}_0x567057['order']=qs[_0x2ff8('0x4a')](_0x5e5f37['query']['sort']);_0x567057['where']=qs[_0x2ff8('0x4d')](_['pick'](_0x5e5f37['query'],_0x4dcec6[_0x2ff8('0x4d')]));_0x567057['where'][_0x2ff8('0xb6')]=_0xe08a8c['id'];if(_0x5e5f37['query'][_0x2ff8('0xc5')]){_0x567057['where']=_[_0x2ff8('0x9f')](_0x567057[_0x2ff8('0x4b')],{'$or':_['map'](_0x567057[_0x2ff8('0x44')],function(_0x335518){var _0x235bf0={};_0x235bf0[_0x335518]={'$like':'%'+_0x5e5f37[_0x2ff8('0x42')][_0x2ff8('0xc5')]+'%'};return _0x235bf0;})});}if(_0x5e5f37[_0x2ff8('0x42')][_0x2ff8('0xc6')]){var _0x29ec87=_0x5e5f37['query'][_0x2ff8('0xc6')][_0x2ff8('0x3a')](',');var _0x354329={};_0x354329[_0x29ec87[0x0]]={'$gte':moment(_0x29ec87[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x567057[_0x2ff8('0x4b')]=_[_0x2ff8('0x9f')](_0x567057[_0x2ff8('0x4b')],_0x354329);}_0x567057=_[_0x2ff8('0x9f')]({},_0x567057,_0x5e5f37[_0x2ff8('0xc7')]);return db['FaxMessage'][_0x2ff8('0x29')]({'where':_0x567057[_0x2ff8('0x4b')]})[_0x2ff8('0x30')](function(_0x3c9ec1){_0x1ebb23[_0x2ff8('0x29')]=_0x3c9ec1;if(_0x5e5f37[_0x2ff8('0x42')][_0x2ff8('0xba')]){_0x567057[_0x2ff8('0xbb')]=[{'all':!![]}];}return db[_0x2ff8('0xc2')][_0x2ff8('0xc8')](_0x567057);})['then'](function(_0x547b32){_0x1ebb23[_0x2ff8('0xb7')]=_0x547b32;return _0x1ebb23;});}})[_0x2ff8('0x30')](respondWithFilteredResult(_0x46d485,_0x567057))[_0x2ff8('0x3d')](handleError(_0x46d485,null));};exports[_0x2ff8('0xc9')]=function(_0x26b8bf,_0x234abb,_0x5a09ad){return db[_0x2ff8('0xa0')]['find']({'where':{'id':_0x26b8bf[_0x2ff8('0xbe')]['id']}})[_0x2ff8('0x30')](handleEntityNotFound(_0x234abb,null))[_0x2ff8('0x30')](function(_0x561cc9){if(_0x561cc9){return _0x561cc9[_0x2ff8('0xca')](_0x26b8bf[_0x2ff8('0xbd')][_0x2ff8('0xc3')],_[_0x2ff8('0xc4')](_0x26b8bf[_0x2ff8('0xbd')],[_0x2ff8('0xc3'),'id'])||{})[_0x2ff8('0xcb')](function(){return db[_0x2ff8('0x77')][_0x2ff8('0xc8')]({'attributes':['id',_0x2ff8('0x33'),_0x2ff8('0x50')],'where':{'id':_0x26b8bf[_0x2ff8('0xbd')][_0x2ff8('0xc3')]}});})[_0x2ff8('0x30')](function(_0x10e68b){socket[_0x2ff8('0xcc')](_0x2ff8('0xcd'),{'id':Number(_0x26b8bf[_0x2ff8('0xbe')]['id']),'tags':_0x10e68b||[]});return{'id':Number(_0x26b8bf[_0x2ff8('0xbe')]['id']),'tags':_0x10e68b||[]};});}})[_0x2ff8('0x30')](respondWithResult(_0x234abb,null))[_0x2ff8('0x3d')](handleError(_0x234abb,null));};exports[_0x2ff8('0xce')]=function(_0x557a58,_0x21836c,_0x55554e){return db['FaxInteraction'][_0x2ff8('0x71')]({'where':{'id':_0x557a58[_0x2ff8('0xbe')]['id']}})[_0x2ff8('0x30')](handleEntityNotFound(_0x21836c,null))[_0x2ff8('0x30')](function(_0x5c89b6){if(_0x5c89b6){return _0x5c89b6['removeTags'](_0x557a58[_0x2ff8('0x42')][_0x2ff8('0xc3')]);}})[_0x2ff8('0x30')](respondWithStatusCode(_0x21836c,null))[_0x2ff8('0x3d')](handleError(_0x21836c,null));};exports[_0x2ff8('0xcf')]=function(_0x3b1056,_0x151088){var _0x1926ac=moment()[_0x2ff8('0xd0')]()[_0x2ff8('0x9d')]();var _0x57e20c=path[_0x2ff8('0xd1')](config[_0x2ff8('0xd2')],_0x2ff8('0xd3'),_0x2ff8('0xd4'),_0x2ff8('0xd5'));var _0x32fd68=path[_0x2ff8('0xd1')](config['root'],_0x2ff8('0xd3'),_0x2ff8('0xd4'),_0x2ff8('0xd6'));var _0xf031bb=path[_0x2ff8('0xd1')](_0x57e20c,_0x1926ac);var _0x30f5ef=util[_0x2ff8('0xd7')]('transcript-%d-%s.zip',_0x3b1056[_0x2ff8('0xbe')]['id'],_0x1926ac);var _0x236372=path[_0x2ff8('0xd1')](_0x57e20c,_0x30f5ef);var _0x21f3b0=[];_0x21f3b0[_0x2ff8('0x3c')]({'model':db[_0x2ff8('0xd8')],'as':'Attachment','raw':!![]});var _0x285750=[{'model':db[_0x2ff8('0xc2')],'as':'Messages','attributes':['id',_0x2ff8('0xbd'),_0x2ff8('0x80')],'include':_0x21f3b0}];return db[_0x2ff8('0xa0')][_0x2ff8('0x71')]({'where':{'id':_0x3b1056[_0x2ff8('0xbe')]['id']},'include':_0x285750})[_0x2ff8('0x30')](handleEntityNotFound(_0x151088,null))['then'](function(_0x545c97){if(_0x545c97&&_0x545c97[_0x2ff8('0xd9')]){var _0xafd9ea=_0x545c97[_0x2ff8('0xda')]({'plain':!![]});fs['mkdirSync'](_0xf031bb);for(var _0x39164a=0x0;_0x39164a<_0xafd9ea[_0x2ff8('0xd9')][_0x2ff8('0x46')];_0x39164a++){var _0x36142f=_0xafd9ea['Messages'][_0x39164a][_0x2ff8('0xd8')];if(_0x36142f){var _0x35cadb=path['join'](_0x32fd68,_0x36142f[_0x2ff8('0xdb')]);if(fs[_0x2ff8('0xdc')](_0x35cadb)){fs['createReadStream'](_0x35cadb)['pipe'](fs['createWriteStream'](path[_0x2ff8('0xd1')](_0xf031bb,_0x36142f[_0x2ff8('0xdb')])));}}}return BPromise[_0x2ff8('0xdd')]()['then'](function(){return new BPromise(function(_0x32c1dc,_0x4f662d){zipdir(_0xf031bb,{'saveTo':_0x236372},function(_0x5dec6a,_0x2756c7){if(_0x5dec6a)return _0x4f662d(_0x5dec6a);return _0x32c1dc(_0x2756c7);});})[_0x2ff8('0x30')](function(){return new BPromise(function(_0x2c4cad,_0x1ba700){rimraf(_0xf031bb,function(_0x142eae){if(_0x142eae)_0x1ba700(_0x142eae);return _0x2c4cad();});});})[_0x2ff8('0x30')](function(){return _0x151088[_0x2ff8('0xcf')](_0x236372,_0x30f5ef,function(_0x3b0ace){if(_0x3b0ace){console[_0x2ff8('0xde')](_0x2ff8('0xdf'),_0x3b0ace);}else{fs[_0x2ff8('0xe0')](_0x236372);}});});});}else{return _0x151088['sendStatus'](0xc8);}})[_0x2ff8('0x3d')](handleError(_0x151088,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 070f65a..e5a5967 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 _0x4c75=['then','setDataValue','Users','map','findAll','length','catch','hook','exports','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','getUsers'];(function(_0x552e3d,_0xbf994f){var _0x5cf8b1=function(_0x4c07dd){while(--_0x4c07dd){_0x552e3d['push'](_0x552e3d['shift']());}};_0x5cf8b1(++_0xbf994f);}(_0x4c75,0x69));var _0x54c7=function(_0x21eb3c,_0x7ce88b){_0x21eb3c=_0x21eb3c-0x0;var _0x4bd2aa=_0x4c75[_0x21eb3c];return _0x4bd2aa;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x54c7('0x0'))['db'][_0x54c7('0x1')];var FaxMessage=require(_0x54c7('0x0'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x54c7('0x2')](0x0);var events={'afterCreate':_0x54c7('0x3'),'afterUpdate':_0x54c7('0x4'),'afterDestroy':_0x54c7('0x5')};function emitEvent(_0xe625ed){return function(_0x3510c1,_0x361b12,_0x391d94){_0x3510c1[_0x54c7('0x6')]({'attributes':['id'],'raw':!![]})[_0x54c7('0x7')](function(_0x4070b2){_0x3510c1[_0x54c7('0x8')](_0x54c7('0x9'),_0x4070b2[_0x54c7('0xa')](function(_0xa8467e){return{'id':_0xa8467e['id']};}));return FaxMessage[_0x54c7('0xb')]({'where':{'FaxInteractionId':_0x3510c1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x227cd7){_0x3510c1[_0x54c7('0x8')]('unreadMessages',_0x227cd7[_0x54c7('0xc')]);FaxInteractionEvents['emit'](_0xe625ed+':'+_0x3510c1['id'],_0x3510c1);FaxInteractionEvents['emit'](_0xe625ed,_0x3510c1);_0x391d94(null);})[_0x54c7('0xd')](_0x391d94(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x54c7('0xe')](e,emitEvent(event));}}module[_0x54c7('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0xb125=['FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers','then','Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x36141e,_0x584aad){var _0x115fba=function(_0x49b235){while(--_0x49b235){_0x36141e['push'](_0x36141e['shift']());}};_0x115fba(++_0x584aad);}(_0xb125,0xdd));var _0x5b12=function(_0x37941e,_0x101a10){_0x37941e=_0x37941e-0x0;var _0x5d1984=_0xb125[_0x37941e];return _0x5d1984;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0x5b12('0x0')];var FaxMessage=require('../../mysqldb')['db'][_0x5b12('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5b12('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b12('0x3'),'afterDestroy':_0x5b12('0x4')};function emitEvent(_0x5a2917){return function(_0x312433,_0x5a475f,_0x9a9110){_0x312433[_0x5b12('0x5')]({'attributes':['id'],'raw':!![]})[_0x5b12('0x6')](function(_0x730844){_0x312433['setDataValue'](_0x5b12('0x7'),_0x730844[_0x5b12('0x8')](function(_0x3c8fff){return{'id':_0x3c8fff['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x312433['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5b12('0x6')](function(_0x347c18){_0x312433[_0x5b12('0x9')](_0x5b12('0xa'),_0x347c18[_0x5b12('0xb')]);FaxInteractionEvents['emit'](_0x5a2917+':'+_0x312433['id'],_0x312433);FaxInteractionEvents[_0x5b12('0xc')](_0x5a2917,_0x312433);_0x9a9110(null);})[_0x5b12('0xd')](_0x9a9110(null));};}for(var e in events){if(events[_0x5b12('0xe')](e)){var event=events[e];FaxInteraction[_0x5b12('0xf')](e,emitEvent(event));}}module[_0x5b12('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 8b0d1fc..b620450 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 _0x6b1e=['bluebird','path','rimraf','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','api','moment'];(function(_0xea83d,_0x56cccf){var _0x1bf313=function(_0xa51540){while(--_0xa51540){_0xea83d['push'](_0xea83d['shift']());}};_0x1bf313(++_0x56cccf);}(_0x6b1e,0x9a));var _0xe6b1=function(_0x199bdd,_0x5f09e2){_0x199bdd=_0x199bdd-0x0;var _0x5c4f2f=_0x6b1e[_0x199bdd];return _0x5c4f2f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe6b1('0x0'));var moment=require(_0xe6b1('0x1'));var BPromise=require(_0xe6b1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6b1('0x3'));var rimraf=require(_0xe6b1('0x4'));var config=require('../../config/environment');var attributes=require(_0xe6b1('0x5'));module['exports']=function(_0x15c4af,_0x32de64){return _0x15c4af[_0xe6b1('0x6')](_0xe6b1('0x7'),attributes,{'tableName':_0xe6b1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x35d861,_0x694fa,_0x5e6b73){if(_0x35d861[_0xe6b1('0x9')](_0xe6b1('0xa'))){_0x35d861[_0xe6b1('0xb')]=moment()[_0xe6b1('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5e6b73(null,_0x35d861);}}});}; \ No newline at end of file +var _0xc5ce=['bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','util','api','moment'];(function(_0x5c3d68,_0x31929a){var _0x107f52=function(_0x43d0af){while(--_0x43d0af){_0x5c3d68['push'](_0x5c3d68['shift']());}};_0x107f52(++_0x31929a);}(_0xc5ce,0x7d));var _0xec5c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc5ce[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0xec5c('0x0'));var logger=require('../../config/logger')(_0xec5c('0x1'));var moment=require(_0xec5c('0x2'));var BPromise=require(_0xec5c('0x3'));var rp=require(_0xec5c('0x4'));var fs=require('fs');var path=require(_0xec5c('0x5'));var rimraf=require('rimraf');var config=require(_0xec5c('0x6'));var attributes=require(_0xec5c('0x7'));module[_0xec5c('0x8')]=function(_0x3c335b,_0xf61ad){return _0x3c335b[_0xec5c('0x9')](_0xec5c('0xa'),attributes,{'tableName':_0xec5c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b7a5c,_0x1c3415,_0x407713){if(_0x5b7a5c[_0xec5c('0xc')](_0xec5c('0xd'))){_0x5b7a5c[_0xec5c('0xe')]=moment()[_0xec5c('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x407713(null,_0x5b7a5c);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index c0c505b..4b07fe0 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 _0xc012=['stringify','error','code','message','catch','update','body','options','raw','UpdateFaxInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x586fa2,_0x1a45bc){var _0x515be9=function(_0x4e90d5){while(--_0x4e90d5){_0x586fa2['push'](_0x586fa2['shift']());}};_0x515be9(++_0x1a45bc);}(_0xc012,0x1e5));var _0x2c01=function(_0x16eed2,_0x14d1d2){_0x16eed2=_0x16eed2-0x0;var _0x102394=_0xc012[_0x16eed2];return _0x102394;};'use strict';var _=require(_0x2c01('0x0'));var util=require(_0x2c01('0x1'));var moment=require(_0x2c01('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2c01('0x3'));var logger=require(_0x2c01('0x4'))('rpc');var config=require(_0x2c01('0x5'));var jayson=require(_0x2c01('0x6'));var client=jayson[_0x2c01('0x7')][_0x2c01('0x8')]({'port':0x232a});config[_0x2c01('0x9')]=_[_0x2c01('0xa')](config[_0x2c01('0x9')],{'host':_0x2c01('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c01('0x9')]));require(_0x2c01('0xc'))['register'](socket);function respondWithRpcPromise(_0x1cfa89,_0xfbbfd1,_0x2cbf26){return new BPromise(function(_0x28a032,_0x1ef471){return client['request'](_0x1cfa89,_0x2cbf26)[_0x2c01('0xd')](function(_0x530724){logger[_0x2c01('0xe')](_0x2c01('0xf'),_0xfbbfd1,_0x2c01('0x10'));logger[_0x2c01('0x11')](_0x2c01('0x12'),_0xfbbfd1,_0x2c01('0x10'),JSON[_0x2c01('0x13')](_0x530724));if(_0x530724[_0x2c01('0x14')]){if(_0x530724[_0x2c01('0x14')][_0x2c01('0x15')]===0x1f4){logger[_0x2c01('0x14')](_0x2c01('0xf'),_0xfbbfd1,_0x530724[_0x2c01('0x14')]['message']);return _0x1ef471(_0x530724['error'][_0x2c01('0x16')]);}logger[_0x2c01('0x14')](_0x2c01('0xf'),_0xfbbfd1,_0x530724['error'][_0x2c01('0x16')]);return _0x28a032(_0x530724['error'][_0x2c01('0x16')]);}else{logger[_0x2c01('0xe')]('FaxInteraction,\x20%s,\x20%s',_0xfbbfd1,_0x2c01('0x10'));_0x28a032(_0x530724['result'][_0x2c01('0x16')]);}})[_0x2c01('0x17')](function(_0x129b26){logger[_0x2c01('0x14')]('FaxInteraction,\x20%s,\x20%s',_0xfbbfd1,_0x129b26);_0x1ef471(_0x129b26);});});}exports['UpdateFaxInteraction']=function(_0x48cf7b){var _0x52de5f=this;return new Promise(function(_0x40c1c7,_0x16b9b8){return db['FaxInteraction'][_0x2c01('0x18')](_0x48cf7b[_0x2c01('0x19')],{'raw':_0x48cf7b[_0x2c01('0x1a')]?_0x48cf7b[_0x2c01('0x1a')][_0x2c01('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48cf7b['options']?_0x48cf7b[_0x2c01('0x1a')]['where']||null:null,'attributes':_0x48cf7b['options']?_0x48cf7b['options']['attributes']||null:null,'limit':_0x48cf7b[_0x2c01('0x1a')]?_0x48cf7b['options']['limit']||null:null})[_0x2c01('0xd')](function(_0x166cc9){logger[_0x2c01('0xe')]('UpdateFaxInteraction',_0x48cf7b);logger[_0x2c01('0x11')](_0x2c01('0x1c'),_0x48cf7b,JSON[_0x2c01('0x13')](_0x166cc9));_0x40c1c7(_0x166cc9);})[_0x2c01('0x17')](function(_0x3080d9){logger[_0x2c01('0x14')](_0x2c01('0x1c'),_0x3080d9['message'],_0x48cf7b);_0x16b9b8(_0x52de5f[_0x2c01('0x14')](0x1f4,_0x3080d9['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x10cb81){return new Promise(function(_0x4ba9f5,_0x3ab028){return db['FaxInteraction'][_0x2c01('0x1d')]({'where':_0x10cb81['options']?_0x10cb81[_0x2c01('0x1a')][_0x2c01('0x1e')]||null:null})['then'](function(_0x1b9c1c){if(_0x1b9c1c){return _0x1b9c1c[_0x2c01('0x1f')](_0x10cb81[_0x2c01('0x19')][_0x2c01('0x20')],_[_0x2c01('0x21')](_0x10cb81['body'],[_0x2c01('0x20'),'id'])||{});}})[_0x2c01('0x22')](function(_0x487a5c){logger['info'](_0x2c01('0x23'),_0x10cb81);logger['debug'](_0x2c01('0x23'),_0x10cb81,JSON[_0x2c01('0x13')](_0x487a5c));_0x4ba9f5(_0x487a5c);})[_0x2c01('0x17')](function(_0x2d7434){logger[_0x2c01('0x14')](_0x2c01('0x23'),_0x2d7434[_0x2c01('0x16')],_0x10cb81);_0x3ab028(_this[_0x2c01('0x14')](0x1f4,_0x2d7434['message']));});});}; \ No newline at end of file +var _0x0ac2=['update','options','where','limit','then','debug','stringify','AddTagsToFaxInteraction','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction'];(function(_0x1be611,_0x3d837a){var _0x22a1cb=function(_0x3cccaa){while(--_0x3cccaa){_0x1be611['push'](_0x1be611['shift']());}};_0x22a1cb(++_0x3d837a);}(_0x0ac2,0x1ed));var _0x20ac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ac2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x20ac('0x0'));var util=require(_0x20ac('0x1'));var moment=require(_0x20ac('0x2'));var BPromise=require(_0x20ac('0x3'));var rs=require(_0x20ac('0x4'));var fs=require('fs');var Redis=require(_0x20ac('0x5'));var db=require(_0x20ac('0x6'))['db'];var utils=require(_0x20ac('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x20ac('0x8'));var jayson=require(_0x20ac('0x9'));var client=jayson[_0x20ac('0xa')]['http']({'port':0x232a});config[_0x20ac('0xb')]=_[_0x20ac('0xc')](config[_0x20ac('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x20ac('0xd'))(new Redis(config[_0x20ac('0xb')]));require('./faxInteraction.socket')[_0x20ac('0xe')](socket);function respondWithRpcPromise(_0x1d6709,_0x41b5bf,_0x32727c){return new BPromise(function(_0x392efb,_0x1b1ad1){return client[_0x20ac('0xf')](_0x1d6709,_0x32727c)['then'](function(_0x5448d7){logger[_0x20ac('0x10')](_0x20ac('0x11'),_0x41b5bf,'request\x20sent');logger['debug'](_0x20ac('0x12'),_0x41b5bf,_0x20ac('0x13'),JSON['stringify'](_0x5448d7));if(_0x5448d7[_0x20ac('0x14')]){if(_0x5448d7[_0x20ac('0x14')][_0x20ac('0x15')]===0x1f4){logger[_0x20ac('0x14')](_0x20ac('0x11'),_0x41b5bf,_0x5448d7['error'][_0x20ac('0x16')]);return _0x1b1ad1(_0x5448d7['error'][_0x20ac('0x16')]);}logger[_0x20ac('0x14')](_0x20ac('0x11'),_0x41b5bf,_0x5448d7[_0x20ac('0x14')][_0x20ac('0x16')]);return _0x392efb(_0x5448d7['error']['message']);}else{logger[_0x20ac('0x10')](_0x20ac('0x11'),_0x41b5bf,_0x20ac('0x13'));_0x392efb(_0x5448d7[_0x20ac('0x17')][_0x20ac('0x16')]);}})[_0x20ac('0x18')](function(_0x37a342){logger[_0x20ac('0x14')](_0x20ac('0x11'),_0x41b5bf,_0x37a342);_0x1b1ad1(_0x37a342);});});}exports[_0x20ac('0x19')]=function(_0x3c1bdc){var _0x51b3ae=this;return new Promise(function(_0x4b90d0,_0x54d20e){return db[_0x20ac('0x1a')][_0x20ac('0x1b')](_0x3c1bdc['body'],{'raw':_0x3c1bdc['options']?_0x3c1bdc[_0x20ac('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c1bdc['options']?_0x3c1bdc[_0x20ac('0x1c')][_0x20ac('0x1d')]||null:null,'attributes':_0x3c1bdc['options']?_0x3c1bdc[_0x20ac('0x1c')]['attributes']||null:null,'limit':_0x3c1bdc[_0x20ac('0x1c')]?_0x3c1bdc[_0x20ac('0x1c')][_0x20ac('0x1e')]||null:null})[_0x20ac('0x1f')](function(_0x12f23a){logger[_0x20ac('0x10')](_0x20ac('0x19'),_0x3c1bdc);logger[_0x20ac('0x20')](_0x20ac('0x19'),_0x3c1bdc,JSON[_0x20ac('0x21')](_0x12f23a));_0x4b90d0(_0x12f23a);})[_0x20ac('0x18')](function(_0x37a4c5){logger['error'](_0x20ac('0x19'),_0x37a4c5[_0x20ac('0x16')],_0x3c1bdc);_0x54d20e(_0x51b3ae['error'](0x1f4,_0x37a4c5[_0x20ac('0x16')]));});});};exports[_0x20ac('0x22')]=function(_0x185f47){return new Promise(function(_0xa66f64,_0x16993b){return db[_0x20ac('0x1a')]['find']({'where':_0x185f47['options']?_0x185f47[_0x20ac('0x1c')][_0x20ac('0x1d')]||null:null})['then'](function(_0x15e3a7){if(_0x15e3a7){return _0x15e3a7[_0x20ac('0x23')](_0x185f47[_0x20ac('0x24')][_0x20ac('0x25')],_[_0x20ac('0x26')](_0x185f47[_0x20ac('0x24')],['ids','id'])||{});}})['spread'](function(_0x7a1789){logger[_0x20ac('0x10')](_0x20ac('0x27'),_0x185f47);logger[_0x20ac('0x20')](_0x20ac('0x27'),_0x185f47,JSON[_0x20ac('0x21')](_0x7a1789));_0xa66f64(_0x7a1789);})[_0x20ac('0x18')](function(_0x10de07){logger[_0x20ac('0x14')]('AddTags',_0x10de07[_0x20ac('0x16')],_0x185f47);_0x16993b(_this[_0x20ac('0x14')](0x1f4,_0x10de07[_0x20ac('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index a56150e..2aa4066 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 _0xef07=['register','length','faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener'];(function(_0x3a1e5e,_0x25b7a4){var _0x3566e0=function(_0x4246a4){while(--_0x4246a4){_0x3a1e5e['push'](_0x3a1e5e['shift']());}};_0x3566e0(++_0x25b7a4);}(_0xef07,0x111));var _0x7ef0=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xef07[_0x142020];return _0x40da8f;};'use strict';var FaxInteractionEvents=require(_0x7ef0('0x0'));var events=[_0x7ef0('0x1'),_0x7ef0('0x2'),_0x7ef0('0x3')];function createListener(_0x3267ee,_0x6d5911){return function(_0x445750){_0x6d5911[_0x7ef0('0x4')](_0x3267ee,_0x445750);};}function removeListener(_0x3e0a99,_0x562512){return function(){FaxInteractionEvents[_0x7ef0('0x5')](_0x3e0a99,_0x562512);};}exports[_0x7ef0('0x6')]=function(_0x257ef3){for(var _0x404d7f=0x0,_0x3546ed=events[_0x7ef0('0x7')];_0x404d7f<_0x3546ed;_0x404d7f++){var _0x3860a4=events[_0x404d7f];var _0x1838bf=createListener(_0x7ef0('0x8')+_0x3860a4,_0x257ef3);FaxInteractionEvents['on'](_0x3860a4,_0x1838bf);}}; \ No newline at end of file +var _0x605b=['remove','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x5a3e63,_0x3e102c){var _0x53aac1=function(_0xd87a63){while(--_0xd87a63){_0x5a3e63['push'](_0x5a3e63['shift']());}};_0x53aac1(++_0x3e102c);}(_0x605b,0x84));var _0xb605=function(_0x511b10,_0x5c1a9b){_0x511b10=_0x511b10-0x0;var _0x5dcdde=_0x605b[_0x511b10];return _0x5dcdde;};'use strict';var FaxInteractionEvents=require(_0xb605('0x0'));var events=['save',_0xb605('0x1'),'update'];function createListener(_0x5647af,_0x274b04){return function(_0x26461a){_0x274b04[_0xb605('0x2')](_0x5647af,_0x26461a);};}function removeListener(_0x306c10,_0xc01520){return function(){FaxInteractionEvents[_0xb605('0x3')](_0x306c10,_0xc01520);};}exports[_0xb605('0x4')]=function(_0x2712c9){for(var _0x41e678=0x0,_0x167fc5=events[_0xb605('0x5')];_0x41e678<_0x167fc5;_0x41e678++){var _0xbdfcc0=events[_0x41e678];var _0x552938=createListener(_0xb605('0x6')+_0xbdfcc0,_0x2712c9);FaxInteractionEvents['on'](_0xbdfcc0,_0x552938);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 4dfd115..dbc95e2 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 _0x15da=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','/describe','describe','/:id/messages','getMessages','isAuthenticated','post','addMessage','/:id/tags','tracked','addTags','put','/:id','fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router'];(function(_0x1b5d1a,_0x419f1){var _0x2378cb=function(_0x2ce7e4){while(--_0x2ce7e4){_0x1b5d1a['push'](_0x1b5d1a['shift']());}};_0x2378cb(++_0x419f1);}(_0x15da,0x96));var _0xa15d=function(_0x2fd02e,_0x8ebcc5){_0x2fd02e=_0x2fd02e-0x0;var _0x4d7f54=_0x15da[_0x2fd02e];return _0x4d7f54;};'use strict';var multer=require(_0xa15d('0x0'));var util=require(_0xa15d('0x1'));var path=require(_0xa15d('0x2'));var timeout=require(_0xa15d('0x3'));var express=require('express');var router=express[_0xa15d('0x4')]();var fs_extra=require(_0xa15d('0x5'));var auth=require(_0xa15d('0x6'));var interaction=require(_0xa15d('0x7'));var config=require(_0xa15d('0x8'));var controller=require(_0xa15d('0x9'));router[_0xa15d('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa15d('0xa')](_0xa15d('0xb'),auth['isAuthenticated'](),controller[_0xa15d('0xc')]);router[_0xa15d('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xa15d('0xd'),auth['isAuthenticated'](),controller[_0xa15d('0xe')]);router[_0xa15d('0xa')]('/:id/download',auth[_0xa15d('0xf')](),controller['download']);router[_0xa15d('0x10')]('/',auth[_0xa15d('0xf')](),controller['create']);router[_0xa15d('0x10')](_0xa15d('0xd'),auth[_0xa15d('0xf')](),controller[_0xa15d('0x11')]);router[_0xa15d('0x10')](_0xa15d('0x12'),auth[_0xa15d('0xf')](),interaction[_0xa15d('0x13')]('fax','faxinteraction:addtags'),controller[_0xa15d('0x14')]);router[_0xa15d('0x15')](_0xa15d('0x16'),auth[_0xa15d('0xf')](),interaction[_0xa15d('0x13')](_0xa15d('0x17'),_0xa15d('0x18')),controller[_0xa15d('0x19')]);router[_0xa15d('0x1a')](_0xa15d('0x16'),auth[_0xa15d('0xf')](),interaction[_0xa15d('0x13')](_0xa15d('0x17'),_0xa15d('0x1b')),controller[_0xa15d('0x1c')]);router[_0xa15d('0x1a')](_0xa15d('0x12'),auth[_0xa15d('0xf')](),controller[_0xa15d('0x1d')]);module[_0xa15d('0x1e')]=router; \ No newline at end of file +var _0x521a=['/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','show','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x4aac6a,_0x292818){var _0x5d9428=function(_0x6055df){while(--_0x6055df){_0x4aac6a['push'](_0x4aac6a['shift']());}};_0x5d9428(++_0x292818);}(_0x521a,0x184));var _0xa521=function(_0x120098,_0xc0adeb){_0x120098=_0x120098-0x0;var _0x4ea17b=_0x521a[_0x120098];return _0x4ea17b;};'use strict';var multer=require(_0xa521('0x0'));var util=require(_0xa521('0x1'));var path=require(_0xa521('0x2'));var timeout=require('connect-timeout');var express=require(_0xa521('0x3'));var router=express[_0xa521('0x4')]();var fs_extra=require(_0xa521('0x5'));var auth=require(_0xa521('0x6'));var interaction=require(_0xa521('0x7'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router['get']('/',auth[_0xa521('0x8')](),controller[_0xa521('0x9')]);router[_0xa521('0xa')](_0xa521('0xb'),auth[_0xa521('0x8')](),controller['describe']);router[_0xa521('0xa')]('/:id',auth[_0xa521('0x8')](),controller[_0xa521('0xc')]);router[_0xa521('0xa')](_0xa521('0xd'),auth[_0xa521('0x8')](),controller[_0xa521('0xe')]);router[_0xa521('0xa')](_0xa521('0xf'),auth[_0xa521('0x8')](),controller[_0xa521('0x10')]);router[_0xa521('0x11')]('/',auth[_0xa521('0x8')](),controller['create']);router[_0xa521('0x11')](_0xa521('0xd'),auth[_0xa521('0x8')](),controller['addMessage']);router['post'](_0xa521('0x12'),auth['isAuthenticated'](),interaction[_0xa521('0x13')](_0xa521('0x14'),_0xa521('0x15')),controller[_0xa521('0x16')]);router[_0xa521('0x17')](_0xa521('0x18'),auth[_0xa521('0x8')](),interaction[_0xa521('0x13')](_0xa521('0x14'),'faxinteraction:update'),controller[_0xa521('0x19')]);router[_0xa521('0x1a')]('/:id',auth[_0xa521('0x8')](),interaction[_0xa521('0x13')]('fax','faxinteraction:destroy'),controller[_0xa521('0x1b')]);router['delete'](_0xa521('0x12'),auth['isAuthenticated'](),controller['removeTags']);module[_0xa521('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 5608c09..50e4772 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 _0x8d0e=['ENUM','out','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x472db5,_0x23ad6c){var _0x20cf0e=function(_0x164cb8){while(--_0x164cb8){_0x472db5['push'](_0x472db5['shift']());}};_0x20cf0e(++_0x23ad6c);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0xb8626c,_0x49051f){_0xb8626c=_0xb8626c-0x0;var _0x4ab402=_0x8d0e[_0xb8626c];return _0x4ab402;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'body':{'type':Sequelize[_0xe8d0('0x2')](_0xe8d0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe8d0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe8d0('0x5')]('in',_0xe8d0('0x6')),'defaultValue':_0xe8d0('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xe8d0('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb7cf=['exports','TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x59b48b,_0x584733){var _0x4c3f79=function(_0x3f2e94){while(--_0x3f2e94){_0x59b48b['push'](_0x59b48b['shift']());}};_0x4c3f79(++_0x584733);}(_0xb7cf,0xca));var _0xfb7c=function(_0x131604,_0x475a68){_0x131604=_0x131604-0x0;var _0x4a2aea=_0xb7cf[_0x131604];return _0x4a2aea;};'use strict';var Sequelize=require(_0xfb7c('0x0'));module[_0xfb7c('0x1')]={'body':{'type':Sequelize[_0xfb7c('0x2')](_0xfb7c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfb7c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfb7c('0x5')),'defaultValue':_0xfb7c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xfb7c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xfb7c('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 03d7961..0f6587a 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 _0xa509=['get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','fullname','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','destroy','end','name','send','index','map','FaxMessage','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','show','params','rawAttributes','include','find','body','fax-interactions','accept','fax','read','readAt','format','UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa509,0xbc));var _0x9a50=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa509[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9a50('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a50('0x1'));var jsonpatch=require(_0x9a50('0x2'));var rp=require('request-promise');var moment=require(_0x9a50('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9a50('0x4'));var util=require(_0x9a50('0x5'));var path=require(_0x9a50('0x6'));var sox=require(_0x9a50('0x7'));var csv=require(_0x9a50('0x8'));var ejs=require(_0x9a50('0x9'));var fs=require('fs');var fs_extra=require(_0x9a50('0xa'));var _=require(_0x9a50('0xb'));var squel=require(_0x9a50('0xc'));var crypto=require(_0x9a50('0xd'));var jsforce=require(_0x9a50('0xe'));var deskjs=require(_0x9a50('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9a50('0x10'));var Papa=require(_0x9a50('0x11'));var Redis=require(_0x9a50('0x12'));var authService=require(_0x9a50('0x13'));var qs=require(_0x9a50('0x14'));var as=require(_0x9a50('0x15'));var hardwareService=require(_0x9a50('0x16'));var logger=require(_0x9a50('0x17'))(_0x9a50('0x18'));var utils=require(_0x9a50('0x19'));var config=require(_0x9a50('0x1a'));var licenseUtil=require(_0x9a50('0x1b'));var db=require(_0x9a50('0x1c'))['db'];config[_0x9a50('0x1d')]=_[_0x9a50('0x1e')](config['redis'],{'host':_0x9a50('0x1f'),'port':0x18eb});var socket=require(_0x9a50('0x20'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x9a50('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9a50('0x22')][_0x9a50('0x23')]({'port':0x232c});var client9002=jayson[_0x9a50('0x22')][_0x9a50('0x23')]({'port':0x232a});function respondWithRpcPromise(_0xdfd1f7,_0x26513b,_0x1caeee,_0x4434b0){return new BPromise(function(_0x424de5,_0x5b2285){var _0x588e18=_0x4434b0||client;return _0x588e18[_0x9a50('0x24')](_0xdfd1f7,_0x1caeee)[_0x9a50('0x25')](function(_0x26e83b){logger[_0x9a50('0x26')](_0x9a50('0x27'),_0x26513b,_0x9a50('0x28'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x26513b,'request\x20sent',JSON[_0x9a50('0x29')](_0x26e83b));if(_0x26e83b[_0x9a50('0x2a')]){if(_0x26e83b[_0x9a50('0x2a')][_0x9a50('0x2b')]===0x1f4){logger[_0x9a50('0x2a')](_0x9a50('0x27'),_0x26513b,_0x26e83b['error'][_0x9a50('0x2c')]);return _0x5b2285(_0x26e83b[_0x9a50('0x2a')]['message']);}logger[_0x9a50('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x26513b,_0x26e83b['error']['message']);return _0x424de5(_0x26e83b['error'][_0x9a50('0x2c')]);}else{logger[_0x9a50('0x26')](_0x9a50('0x27'),_0x26513b,'request\x20sent');_0x424de5(_0x26e83b[_0x9a50('0x2d')][_0x9a50('0x2c')]);}})[_0x9a50('0x2e')](function(_0x4760d5){logger[_0x9a50('0x2a')](_0x9a50('0x27'),_0x26513b,_0x4760d5);_0x5b2285(_0x4760d5);});});}function respondWithStatusCode(_0x326ccc,_0x10fe4a){_0x10fe4a=_0x10fe4a||0xcc;return function(_0x3eda1e){if(_0x3eda1e){return _0x326ccc[_0x9a50('0x2f')](_0x10fe4a);}return _0x326ccc['status'](_0x10fe4a)['end']();};}function respondWithResult(_0x495171,_0x4e4736){_0x4e4736=_0x4e4736||0xc8;return function(_0xf357f){if(_0xf357f){return _0x495171['status'](_0x4e4736)[_0x9a50('0x30')](_0xf357f);}};}function respondWithFilteredResult(_0x52b3d1,_0x318413){return function(_0x53b109){if(_0x53b109){var _0x2e6aef=typeof _0x318413[_0x9a50('0x31')]===_0x9a50('0x32')&&typeof _0x318413[_0x9a50('0x33')]===_0x9a50('0x32');var _0x5197a8=_0x53b109[_0x9a50('0x34')];var _0x4f2795=_0x2e6aef?0x0:_0x318413[_0x9a50('0x31')];var _0x12653b=_0x2e6aef?_0x53b109[_0x9a50('0x34')]:_0x318413[_0x9a50('0x31')]+_0x318413['limit'];var _0x27f1b0;if(_0x12653b>=_0x5197a8){_0x12653b=_0x5197a8;_0x27f1b0=0xc8;}else{_0x27f1b0=0xce;}_0x52b3d1[_0x9a50('0x35')](_0x27f1b0);return _0x52b3d1['set'](_0x9a50('0x36'),_0x4f2795+'-'+_0x12653b+'/'+_0x5197a8)[_0x9a50('0x30')](_0x53b109);}return null;};}function patchUpdates(_0x10560f){return function(_0x7b0f02){try{jsonpatch[_0x9a50('0x37')](_0x7b0f02,_0x10560f,!![]);}catch(_0x3ef6df){return BPromise[_0x9a50('0x38')](_0x3ef6df);}return _0x7b0f02[_0x9a50('0x39')]();};}function saveUpdates(_0x23bf27,_0xd72dab){return function(_0x45b71d){if(_0x45b71d){return _0x45b71d[_0x9a50('0x3a')](_0x23bf27)[_0x9a50('0x25')](function(_0x50d0f5){return _0x50d0f5;});}return null;};}function removeEntity(_0x391b1b,_0x2a0f72){return function(_0x11aca3){if(_0x11aca3){return _0x11aca3[_0x9a50('0x3b')]()[_0x9a50('0x25')](function(){_0x391b1b[_0x9a50('0x35')](0xcc)[_0x9a50('0x3c')]();});}};}function handleEntityNotFound(_0x5ea31c,_0x6c23f7){return function(_0x1debba){if(!_0x1debba){_0x5ea31c[_0x9a50('0x2f')](0x194);}return _0x1debba;};}function handleError(_0x294c01,_0x35106f){_0x35106f=_0x35106f||0x1f4;return function(_0x3860e8){logger[_0x9a50('0x2a')](_0x3860e8['stack']);if(_0x3860e8[_0x9a50('0x3d')]){delete _0x3860e8[_0x9a50('0x3d')];}_0x294c01[_0x9a50('0x35')](_0x35106f)[_0x9a50('0x3e')](_0x3860e8);};}exports[_0x9a50('0x3f')]=function(_0x29d520,_0x12e8e0){var _0x127233={},_0x2536d8={},_0x25828c={'count':0x0,'rows':[]};var _0x4e1fb0=_[_0x9a50('0x40')](db[_0x9a50('0x41')]['rawAttributes'],function(_0x459561){return{'name':_0x459561['fieldName'],'type':_0x459561[_0x9a50('0x42')][_0x9a50('0x43')]};});_0x2536d8[_0x9a50('0x44')]=_['map'](_0x4e1fb0,_0x9a50('0x3d'));_0x2536d8[_0x9a50('0x45')]=_[_0x9a50('0x46')](_0x29d520[_0x9a50('0x45')]);_0x2536d8[_0x9a50('0x47')]=_[_0x9a50('0x48')](_0x2536d8[_0x9a50('0x44')],_0x2536d8[_0x9a50('0x45')]);_0x127233['attributes']=_[_0x9a50('0x48')](_0x2536d8['model'],qs[_0x9a50('0x49')](_0x29d520['query'][_0x9a50('0x49')]));_0x127233['attributes']=_0x127233[_0x9a50('0x4a')][_0x9a50('0x4b')]?_0x127233[_0x9a50('0x4a')]:_0x2536d8[_0x9a50('0x44')];if(!_0x29d520[_0x9a50('0x45')]['hasOwnProperty'](_0x9a50('0x4c'))){_0x127233[_0x9a50('0x33')]=qs[_0x9a50('0x33')](_0x29d520[_0x9a50('0x45')][_0x9a50('0x33')]);_0x127233[_0x9a50('0x31')]=qs[_0x9a50('0x31')](_0x29d520['query']['offset']);}_0x127233['order']=qs[_0x9a50('0x4d')](_0x29d520[_0x9a50('0x45')][_0x9a50('0x4d')]);_0x127233[_0x9a50('0x4e')]=qs[_0x9a50('0x47')](_[_0x9a50('0x4f')](_0x29d520[_0x9a50('0x45')],_0x2536d8[_0x9a50('0x47')]),_0x4e1fb0);if(_0x29d520[_0x9a50('0x45')][_0x9a50('0x50')]){_0x127233[_0x9a50('0x4e')]=_[_0x9a50('0x51')](_0x127233[_0x9a50('0x4e')],{'$or':_[_0x9a50('0x40')](_0x4e1fb0,function(_0x35129f){if(_0x35129f[_0x9a50('0x42')]!=='VIRTUAL'){var _0x3b181e={};_0x3b181e[_0x35129f[_0x9a50('0x3d')]]={'$like':'%'+_0x29d520[_0x9a50('0x45')][_0x9a50('0x50')]+'%'};return _0x3b181e;}})});}_0x127233=_[_0x9a50('0x51')]({},_0x127233,_0x29d520[_0x9a50('0x52')]);var _0x41e185={'where':_0x127233[_0x9a50('0x4e')]};return db[_0x9a50('0x41')][_0x9a50('0x34')](_0x41e185)[_0x9a50('0x25')](function(_0xa48660){_0x25828c[_0x9a50('0x34')]=_0xa48660;if(_0x29d520[_0x9a50('0x45')][_0x9a50('0x53')]){_0x127233['include']=[{'all':!![]}];}return db['FaxMessage'][_0x9a50('0x54')](_0x127233);})['then'](function(_0xcde26f){_0x25828c['rows']=_0xcde26f;return _0x25828c;})[_0x9a50('0x25')](respondWithFilteredResult(_0x12e8e0,_0x127233))[_0x9a50('0x2e')](handleError(_0x12e8e0,null));};exports[_0x9a50('0x55')]=function(_0x48153d,_0x47fd43){var _0x55c17d={'raw':!![],'where':{'id':_0x48153d[_0x9a50('0x56')]['id']}},_0x2cc437={};_0x2cc437[_0x9a50('0x44')]=_['keys'](db[_0x9a50('0x41')][_0x9a50('0x57')]);_0x2cc437[_0x9a50('0x45')]=_[_0x9a50('0x46')](_0x48153d[_0x9a50('0x45')]);_0x2cc437[_0x9a50('0x47')]=_['intersection'](_0x2cc437[_0x9a50('0x44')],_0x2cc437['query']);_0x55c17d[_0x9a50('0x4a')]=_[_0x9a50('0x48')](_0x2cc437[_0x9a50('0x44')],qs[_0x9a50('0x49')](_0x48153d['query']['fields']));_0x55c17d['attributes']=_0x55c17d[_0x9a50('0x4a')][_0x9a50('0x4b')]?_0x55c17d['attributes']:_0x2cc437[_0x9a50('0x44')];if(_0x48153d[_0x9a50('0x45')][_0x9a50('0x53')]){_0x55c17d[_0x9a50('0x58')]=[{'all':!![]}];}_0x55c17d=_[_0x9a50('0x51')]({},_0x55c17d,_0x48153d[_0x9a50('0x52')]);return db['FaxMessage'][_0x9a50('0x59')](_0x55c17d)[_0x9a50('0x25')](handleEntityNotFound(_0x47fd43,null))['then'](respondWithResult(_0x47fd43,null))[_0x9a50('0x2e')](handleError(_0x47fd43,null));};exports[_0x9a50('0x3a')]=function(_0x1fcb8c,_0x5ff00c){if(_0x1fcb8c[_0x9a50('0x5a')]['id']){delete _0x1fcb8c[_0x9a50('0x5a')]['id'];}return db[_0x9a50('0x41')]['find']({'where':{'id':_0x1fcb8c[_0x9a50('0x56')]['id']}})[_0x9a50('0x25')](handleEntityNotFound(_0x5ff00c,null))['then'](saveUpdates(_0x1fcb8c[_0x9a50('0x5a')],null))['then'](respondWithResult(_0x5ff00c,null))[_0x9a50('0x2e')](handleError(_0x5ff00c,null));};exports[_0x9a50('0x3b')]=function(_0x5c4503,_0x3316ad){return db[_0x9a50('0x41')][_0x9a50('0x59')]({'where':{'id':_0x5c4503['params']['id']}})[_0x9a50('0x25')](handleEntityNotFound(_0x3316ad,null))[_0x9a50('0x25')](removeEntity(_0x3316ad,null))[_0x9a50('0x2e')](handleError(_0x3316ad,null));};exports['describe']=function(_0x570a81,_0x4a8fca){return db[_0x9a50('0x41')]['describe']()[_0x9a50('0x25')](respondWithResult(_0x4a8fca,null))[_0x9a50('0x2e')](handleError(_0x4a8fca,null));};var interaction_log=require(_0x9a50('0x17'))(_0x9a50('0x5b'));exports[_0x9a50('0x5c')]=function(_0x3c1b65,_0x4e4a63,_0x3f7303){var _0x17cd52={'agent':{},'channel':_0x9a50('0x5d')};if(_0x3c1b65[_0x9a50('0x5a')]['id']){delete _0x3c1b65[_0x9a50('0x5a')]['id'];}_0x3c1b65[_0x9a50('0x5a')][_0x9a50('0x5e')]=!![];_0x3c1b65['body'][_0x9a50('0x5f')]=moment()[_0x9a50('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c1b65[_0x9a50('0x5a')][_0x9a50('0x61')]=_0x3c1b65[_0x9a50('0x5a')]['UserId']||_0x3c1b65['user']['id'];_0x17cd52['agent']['id']=_0x3c1b65['body'][_0x9a50('0x61')];return db[_0x9a50('0x41')]['find']({'where':{'id':_0x3c1b65[_0x9a50('0x56')]['id'],'UserId':null}})[_0x9a50('0x25')](handleEntityNotFound(_0x4e4a63,null))[_0x9a50('0x25')](saveUpdates(_0x3c1b65[_0x9a50('0x5a')],null))[_0x9a50('0x25')](function(_0x504690){if(_0x504690){_0x17cd52[_0x9a50('0x2c')]=_0x504690[_0x9a50('0x62')]({'plain':!![]});return db[_0x9a50('0x63')][_0x9a50('0x59')]({'where':{'id':_0x504690[_0x9a50('0x64')]}});}return null;})[_0x9a50('0x25')](handleEntityNotFound(_0x4e4a63,null))[_0x9a50('0x25')](function(_0x564a6d){if(_0x564a6d){return _0x564a6d[_0x9a50('0x3a')]({'UserId':_0x3c1b65[_0x9a50('0x5a')][_0x9a50('0x61')],'read1stAt':_['isNil'](_0x564a6d['read1stAt'])?moment()[_0x9a50('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9a50('0x25')](function(_0x2621be){if(_0x2621be){_0x17cd52[_0x9a50('0x65')]=_0x2621be['get']({'plain':!![]});interaction_log[_0x9a50('0x26')](_0x9a50('0x66'),_0x3c1b65[_0x9a50('0x67')]['id'],_0x3c1b65[_0x9a50('0x67')][_0x9a50('0x3d')],_0x3c1b65['user'][_0x9a50('0x68')],_0x17cd52[_0x9a50('0x65')]['id'],_0x3c1b65[_0x9a50('0x5a')]?JSON[_0x9a50('0x29')](_0x3c1b65['body']):_0x9a50('0x69'));return respondWithRpcPromise(_0x9a50('0x6a'),'acceptMessage',_0x17cd52);}return null;})[_0x9a50('0x25')](function(_0x8818a4){var _0x216f2d=_0x9a50('0x6b')+_0x8818a4[_0x9a50('0x2c')][_0x9a50('0x6c')];return db[_0x9a50('0x6d')][_0x9a50('0x45')](_0x216f2d,{'type':db[_0x9a50('0x6e')][_0x9a50('0x6f')]['SELECT'],'raw':!![]})[_0x9a50('0x25')](function(_0x449480){return _0x449480;});})[_0x9a50('0x25')](function(_0x2f37dd){if(_0x2f37dd){_0x17cd52[_0x9a50('0x2c')][_0x9a50('0x70')]=_0x2f37dd[0x0];if(!_0x3c1b65[_0x9a50('0x5a')]['UserId'])return;return db['User'][_0x9a50('0x59')]({'where':{'id':_0x3c1b65[_0x9a50('0x5a')][_0x9a50('0x61')],'role':'agent'},'attributes':['id',_0x9a50('0x3d'),'fullname','email',_0x9a50('0x71')],'raw':!![]});}return null;})[_0x9a50('0x25')](function(_0x5348ff){if(!_0x5348ff)return null;_0x17cd52[_0x9a50('0x2c')][_0x9a50('0x72')]=_0x5348ff;return _0x17cd52;})[_0x9a50('0x25')](function(_0xaa52cb){if(_0xaa52cb){if(_0x3c1b65[_0x9a50('0x5a')][_0x9a50('0x73')]){_0x17cd52[_0x9a50('0x2c')][_0x9a50('0x74')]=util[_0x9a50('0x60')](_0x9a50('0x75'),_0x3c1b65['user'][_0x9a50('0x3d')]);_0x17cd52[_0x9a50('0x2c')]['channel']=_0x17cd52[_0x9a50('0x76')];_0x17cd52[_0x9a50('0x2c')][_0x9a50('0x77')]=_0x17cd52['channel'];_0x17cd52['message'][_0x9a50('0x78')]='accept';return respondWithRpcPromise(_0x9a50('0x79'),'EventManager',{'event':_0x9a50('0x7a'),'message':_0x17cd52['message']},client9002)[_0x9a50('0x25')](function(){return _0x17cd52;});}return _0x17cd52;}return null;})['then'](respondWithResult(_0x4e4a63,null))[_0x9a50('0x2e')](handleError(_0x4e4a63,null));};var interaction_log=require(_0x9a50('0x17'))(_0x9a50('0x5b'));exports['reject']=function(_0x4fd11c,_0x559939,_0x4067c9){var _0x6433ac={'agent':{},'channel':_0x9a50('0x5d')};if(_0x4fd11c['body']['id']){delete _0x4fd11c[_0x9a50('0x5a')]['id'];}_0x4fd11c[_0x9a50('0x5a')][_0x9a50('0x61')]=_0x4fd11c[_0x9a50('0x5a')][_0x9a50('0x61')]||_0x4fd11c[_0x9a50('0x67')]['id'];_0x6433ac[_0x9a50('0x72')]['id']=_0x4fd11c[_0x9a50('0x5a')][_0x9a50('0x61')];return db[_0x9a50('0x41')]['find']({'where':{'id':_0x4fd11c[_0x9a50('0x56')]['id'],'UserId':null}})[_0x9a50('0x25')](handleEntityNotFound(_0x559939,null))[_0x9a50('0x25')](function(_0x2b547b){if(_0x2b547b){_0x6433ac[_0x9a50('0x2c')]=_0x2b547b[_0x9a50('0x62')]({'plain':!![]});return db[_0x9a50('0x63')]['find']({'where':{'id':_0x2b547b[_0x9a50('0x64')]}});}return null;})[_0x9a50('0x25')](handleEntityNotFound(_0x559939,null))[_0x9a50('0x25')](function(_0x1d3e23){if(_0x1d3e23){_0x6433ac['interaction']=_0x1d3e23[_0x9a50('0x62')]({'plain':!![]});interaction_log[_0x9a50('0x26')](_0x9a50('0x7b'),_0x4fd11c[_0x9a50('0x67')]['id'],_0x4fd11c['user'][_0x9a50('0x3d')],_0x4fd11c[_0x9a50('0x67')]['role'],_0x6433ac['interaction']['id'],_0x4fd11c[_0x9a50('0x5a')]?JSON[_0x9a50('0x29')](_0x4fd11c[_0x9a50('0x5a')]):'null');return respondWithRpcPromise(_0x9a50('0x7c'),_0x9a50('0x7d'),_0x6433ac);}return null;})['then'](function(_0x55e466){var _0x1fa5bf=_0x9a50('0x6b')+_0x55e466[_0x9a50('0x2c')][_0x9a50('0x6c')];return db['sequelize']['query'](_0x1fa5bf,{'type':db[_0x9a50('0x6e')][_0x9a50('0x6f')]['SELECT'],'raw':!![]})[_0x9a50('0x25')](function(_0x43684d){return _0x43684d;});})['then'](function(_0x4e2941){if(_0x4e2941){_0x6433ac['message'][_0x9a50('0x70')]=_0x4e2941[0x0];if(!_0x4fd11c[_0x9a50('0x5a')][_0x9a50('0x61')])return;return db[_0x9a50('0x7e')][_0x9a50('0x59')]({'where':{'id':_0x4fd11c[_0x9a50('0x5a')]['UserId'],'role':_0x9a50('0x72')},'attributes':['id',_0x9a50('0x3d'),_0x9a50('0x7f'),'email',_0x9a50('0x71')],'raw':!![]});}return null;})[_0x9a50('0x25')](function(_0x288150){if(!_0x288150)return null;_0x6433ac[_0x9a50('0x2c')][_0x9a50('0x72')]=_0x288150;return _0x6433ac;})[_0x9a50('0x25')](function(_0x5e189c){if(_0x5e189c){_0x5e189c[_0x9a50('0x2c')][_0x9a50('0x74')]=util[_0x9a50('0x60')]('SIP/%s',_0x4fd11c['user']['name']);_0x5e189c[_0x9a50('0x2c')]['channel']=_0x6433ac[_0x9a50('0x76')];_0x5e189c[_0x9a50('0x2c')][_0x9a50('0x77')]=_0x6433ac[_0x9a50('0x76')];_0x5e189c[_0x9a50('0x2c')][_0x9a50('0x78')]=_0x9a50('0x38');respondWithRpcPromise(_0x9a50('0x79'),'EventManager',{'event':'rejectmessage','message':_0x5e189c[_0x9a50('0x2c')]},client9002);return _0x6433ac;}return null;})[_0x9a50('0x25')](respondWithResult(_0x559939,null))[_0x9a50('0x2e')](handleError(_0x559939,null));};exports['create']=function(_0x63973e,_0x4695f5){var _0x4d52ec;return db[_0x9a50('0x41')]['create'](_0x63973e[_0x9a50('0x5a')],{})[_0x9a50('0x25')](function(_0x3b5804){_0x4d52ec=_0x3b5804;return db[_0x9a50('0x80')][_0x9a50('0x81')]({'where':{'id':_0x4d52ec['ContactId']}});})[_0x9a50('0x25')](function(_0x41ccdb){if(_[_0x9a50('0x82')](_0x41ccdb)){return;}else{_0x4d52ec[_0x9a50('0x5d')]=_0x41ccdb[_0x9a50('0x5d')];return db[_0x9a50('0x83')][_0x9a50('0x81')]({'where':{'id':_0x4d52ec[_0x9a50('0x84')]}});}})[_0x9a50('0x25')](function(_0x4f7a8a){return respondWithRpcPromise(_0x9a50('0x85'),_0x9a50('0x85'),{'FaxAccountId':_['isNil'](_0x63973e[_0x9a50('0x5a')])?undefined:_0x63973e[_0x9a50('0x5a')][_0x9a50('0x86')],'path':_['isNil'](_0x4f7a8a)?undefined:util[_0x9a50('0x60')](_0x9a50('0x87'),_0x4f7a8a[_0x9a50('0x88')]),'fax':_['isNil'](_0x4d52ec['fax'])?undefined:_0x4d52ec[_0x9a50('0x5d')],'AttachmentId':_0x4d52ec[_0x9a50('0x84')]},client9002);})['then'](respondWithResult(_0x4695f5,0xc9))[_0x9a50('0x2e')](handleError(_0x4695f5,null));};exports[_0x9a50('0x89')]=function(_0x202298,_0x1b3a2f){var _0x4fa4a5=path[_0x9a50('0x8a')](config[_0x9a50('0x8b')],_0x9a50('0x8c'),_0x9a50('0x8d'),_0x9a50('0x8e'));return db['FaxMessage'][_0x9a50('0x59')]({'where':{'id':_0x202298[_0x9a50('0x56')]['id']},'include':[{'model':db[_0x9a50('0x83')],'as':'Attachment'}]})[_0x9a50('0x25')](handleEntityNotFound(_0x1b3a2f,null))['then'](function(_0x588ed8){if(_0x588ed8){return _0x1b3a2f[_0x9a50('0x89')](path[_0x9a50('0x8a')](_0x4fa4a5,_0x588ed8['Attachment'][_0x9a50('0x88')]));}})[_0x9a50('0x2e')](handleError(_0x1b3a2f,null));}; \ No newline at end of file +var _0x4632=['error','code','message','result','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','include','findAll','show','params','includeAll','options','catch','body','find','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','contact','motionChannel','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','join','root','server','files','Attachment','download','basename','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4198db,_0x4e1eb2){var _0x136d5e=function(_0x2e578e){while(--_0x2e578e){_0x4198db['push'](_0x4198db['shift']());}};_0x136d5e(++_0x4e1eb2);}(_0x4632,0x186));var _0x2463=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x4632[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require(_0x2463('0x0'));var rimraf=require(_0x2463('0x1'));var zipdir=require(_0x2463('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2463('0x3'));var moment=require(_0x2463('0x4'));var BPromise=require(_0x2463('0x5'));var Mustache=require(_0x2463('0x6'));var util=require(_0x2463('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2463('0x8'));var ejs=require(_0x2463('0x9'));var fs=require('fs');var fs_extra=require(_0x2463('0xa'));var _=require('lodash');var squel=require(_0x2463('0xb'));var crypto=require(_0x2463('0xc'));var jsforce=require(_0x2463('0xd'));var deskjs=require(_0x2463('0xe'));var toCsv=require(_0x2463('0x8'));var querystring=require(_0x2463('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2463('0x10'));var qs=require(_0x2463('0x11'));var as=require(_0x2463('0x12'));var hardwareService=require(_0x2463('0x13'));var logger=require(_0x2463('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2463('0x15'));var db=require(_0x2463('0x16'))['db'];config[_0x2463('0x17')]=_[_0x2463('0x18')](config[_0x2463('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2463('0x19'))(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);var jayson=require(_0x2463('0x1a'));var client=jayson[_0x2463('0x1b')][_0x2463('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x2463('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x431a55,_0x1caa8a,_0x52e91e,_0x91cc0c){return new BPromise(function(_0x269bbd,_0x437145){var _0x185f52=_0x91cc0c||client;return _0x185f52[_0x2463('0x1d')](_0x431a55,_0x52e91e)['then'](function(_0x28ebd8){logger[_0x2463('0x1e')](_0x2463('0x1f'),_0x1caa8a,_0x2463('0x20'));logger[_0x2463('0x21')](_0x2463('0x22'),_0x1caa8a,_0x2463('0x20'),JSON[_0x2463('0x23')](_0x28ebd8));if(_0x28ebd8[_0x2463('0x24')]){if(_0x28ebd8['error'][_0x2463('0x25')]===0x1f4){logger['error'](_0x2463('0x1f'),_0x1caa8a,_0x28ebd8[_0x2463('0x24')]['message']);return _0x437145(_0x28ebd8[_0x2463('0x24')]['message']);}logger[_0x2463('0x24')](_0x2463('0x1f'),_0x1caa8a,_0x28ebd8['error'][_0x2463('0x26')]);return _0x269bbd(_0x28ebd8['error']['message']);}else{logger['info'](_0x2463('0x1f'),_0x1caa8a,_0x2463('0x20'));_0x269bbd(_0x28ebd8[_0x2463('0x27')][_0x2463('0x26')]);}})['catch'](function(_0x2ee75b){logger[_0x2463('0x24')](_0x2463('0x1f'),_0x1caa8a,_0x2ee75b);_0x437145(_0x2ee75b);});});}function respondWithStatusCode(_0x4967f0,_0x136901){_0x136901=_0x136901||0xcc;return function(_0x5cf63d){if(_0x5cf63d){return _0x4967f0['sendStatus'](_0x136901);}return _0x4967f0[_0x2463('0x28')](_0x136901)[_0x2463('0x29')]();};}function respondWithResult(_0x5d9622,_0x1d2c42){_0x1d2c42=_0x1d2c42||0xc8;return function(_0x1cff1a){if(_0x1cff1a){return _0x5d9622[_0x2463('0x28')](_0x1d2c42)[_0x2463('0x2a')](_0x1cff1a);}};}function respondWithFilteredResult(_0x5894eb,_0x2e4f83){return function(_0x30a9f3){if(_0x30a9f3){var _0x251042=typeof _0x2e4f83['offset']===_0x2463('0x2b')&&typeof _0x2e4f83[_0x2463('0x2c')]===_0x2463('0x2b');var _0xf15319=_0x30a9f3[_0x2463('0x2d')];var _0x34e470=_0x251042?0x0:_0x2e4f83['offset'];var _0x1ec6a7=_0x251042?_0x30a9f3[_0x2463('0x2d')]:_0x2e4f83[_0x2463('0x2e')]+_0x2e4f83['limit'];var _0x3d9b4b;if(_0x1ec6a7>=_0xf15319){_0x1ec6a7=_0xf15319;_0x3d9b4b=0xc8;}else{_0x3d9b4b=0xce;}_0x5894eb[_0x2463('0x28')](_0x3d9b4b);return _0x5894eb[_0x2463('0x2f')](_0x2463('0x30'),_0x34e470+'-'+_0x1ec6a7+'/'+_0xf15319)[_0x2463('0x2a')](_0x30a9f3);}return null;};}function patchUpdates(_0xb764b){return function(_0x1d3347){try{jsonpatch[_0x2463('0x31')](_0x1d3347,_0xb764b,!![]);}catch(_0x1d92d9){return BPromise[_0x2463('0x32')](_0x1d92d9);}return _0x1d3347['save']();};}function saveUpdates(_0x48308e,_0xcf4f80){return function(_0x5859f6){if(_0x5859f6){return _0x5859f6[_0x2463('0x33')](_0x48308e)[_0x2463('0x34')](function(_0x588392){return _0x588392;});}return null;};}function removeEntity(_0x56af36,_0x142577){return function(_0x353beb){if(_0x353beb){return _0x353beb[_0x2463('0x35')]()['then'](function(){_0x56af36[_0x2463('0x28')](0xcc)[_0x2463('0x29')]();});}};}function handleEntityNotFound(_0x18d0d4,_0x213aca){return function(_0x487b3f){if(!_0x487b3f){_0x18d0d4[_0x2463('0x36')](0x194);}return _0x487b3f;};}function handleError(_0x5703a8,_0x228536){_0x228536=_0x228536||0x1f4;return function(_0x3ccaf5){logger[_0x2463('0x24')](_0x3ccaf5[_0x2463('0x37')]);if(_0x3ccaf5[_0x2463('0x38')]){delete _0x3ccaf5[_0x2463('0x38')];}_0x5703a8[_0x2463('0x28')](_0x228536)['send'](_0x3ccaf5);};}exports['index']=function(_0x13bad8,_0xfc11cf){var _0x44ee3b={},_0x29f94b={},_0x563237={'count':0x0,'rows':[]};var _0x2a435f=_[_0x2463('0x39')](db[_0x2463('0x3a')][_0x2463('0x3b')],function(_0x52f2fe){return{'name':_0x52f2fe[_0x2463('0x3c')],'type':_0x52f2fe[_0x2463('0x3d')][_0x2463('0x3e')]};});_0x29f94b[_0x2463('0x3f')]=_[_0x2463('0x39')](_0x2a435f,_0x2463('0x38'));_0x29f94b[_0x2463('0x40')]=_[_0x2463('0x41')](_0x13bad8[_0x2463('0x40')]);_0x29f94b[_0x2463('0x42')]=_['intersection'](_0x29f94b['model'],_0x29f94b[_0x2463('0x40')]);_0x44ee3b[_0x2463('0x43')]=_[_0x2463('0x44')](_0x29f94b[_0x2463('0x3f')],qs[_0x2463('0x45')](_0x13bad8['query'][_0x2463('0x45')]));_0x44ee3b[_0x2463('0x43')]=_0x44ee3b[_0x2463('0x43')][_0x2463('0x46')]?_0x44ee3b['attributes']:_0x29f94b['model'];if(!_0x13bad8[_0x2463('0x40')]['hasOwnProperty'](_0x2463('0x47'))){_0x44ee3b['limit']=qs[_0x2463('0x2c')](_0x13bad8['query'][_0x2463('0x2c')]);_0x44ee3b[_0x2463('0x2e')]=qs[_0x2463('0x2e')](_0x13bad8['query'][_0x2463('0x2e')]);}_0x44ee3b[_0x2463('0x48')]=qs[_0x2463('0x49')](_0x13bad8['query'][_0x2463('0x49')]);_0x44ee3b[_0x2463('0x4a')]=qs[_0x2463('0x42')](_[_0x2463('0x4b')](_0x13bad8[_0x2463('0x40')],_0x29f94b[_0x2463('0x42')]),_0x2a435f);if(_0x13bad8[_0x2463('0x40')][_0x2463('0x4c')]){_0x44ee3b[_0x2463('0x4a')]=_['merge'](_0x44ee3b[_0x2463('0x4a')],{'$or':_[_0x2463('0x39')](_0x2a435f,function(_0x46dab8){if(_0x46dab8[_0x2463('0x3d')]!=='VIRTUAL'){var _0x2b44ee={};_0x2b44ee[_0x46dab8[_0x2463('0x38')]]={'$like':'%'+_0x13bad8[_0x2463('0x40')][_0x2463('0x4c')]+'%'};return _0x2b44ee;}})});}_0x44ee3b=_[_0x2463('0x4d')]({},_0x44ee3b,_0x13bad8['options']);var _0x4ba15b={'where':_0x44ee3b['where']};return db[_0x2463('0x3a')][_0x2463('0x2d')](_0x4ba15b)[_0x2463('0x34')](function(_0x247b6c){_0x563237['count']=_0x247b6c;if(_0x13bad8['query']['includeAll']){_0x44ee3b[_0x2463('0x4e')]=[{'all':!![]}];}return db['FaxMessage'][_0x2463('0x4f')](_0x44ee3b);})[_0x2463('0x34')](function(_0x1a7ff4){_0x563237['rows']=_0x1a7ff4;return _0x563237;})[_0x2463('0x34')](respondWithFilteredResult(_0xfc11cf,_0x44ee3b))['catch'](handleError(_0xfc11cf,null));};exports[_0x2463('0x50')]=function(_0x569681,_0x13493c){var _0x3ed658={'raw':!![],'where':{'id':_0x569681[_0x2463('0x51')]['id']}},_0x25da47={};_0x25da47[_0x2463('0x3f')]=_['keys'](db[_0x2463('0x3a')]['rawAttributes']);_0x25da47['query']=_[_0x2463('0x41')](_0x569681[_0x2463('0x40')]);_0x25da47['filters']=_[_0x2463('0x44')](_0x25da47[_0x2463('0x3f')],_0x25da47[_0x2463('0x40')]);_0x3ed658['attributes']=_[_0x2463('0x44')](_0x25da47[_0x2463('0x3f')],qs[_0x2463('0x45')](_0x569681[_0x2463('0x40')]['fields']));_0x3ed658['attributes']=_0x3ed658[_0x2463('0x43')][_0x2463('0x46')]?_0x3ed658[_0x2463('0x43')]:_0x25da47[_0x2463('0x3f')];if(_0x569681[_0x2463('0x40')][_0x2463('0x52')]){_0x3ed658[_0x2463('0x4e')]=[{'all':!![]}];}_0x3ed658=_[_0x2463('0x4d')]({},_0x3ed658,_0x569681[_0x2463('0x53')]);return db['FaxMessage']['find'](_0x3ed658)[_0x2463('0x34')](handleEntityNotFound(_0x13493c,null))['then'](respondWithResult(_0x13493c,null))[_0x2463('0x54')](handleError(_0x13493c,null));};exports[_0x2463('0x33')]=function(_0x9f1cc7,_0x4d16f9){if(_0x9f1cc7[_0x2463('0x55')]['id']){delete _0x9f1cc7[_0x2463('0x55')]['id'];}return db['FaxMessage'][_0x2463('0x56')]({'where':{'id':_0x9f1cc7[_0x2463('0x51')]['id']}})[_0x2463('0x34')](handleEntityNotFound(_0x4d16f9,null))[_0x2463('0x34')](saveUpdates(_0x9f1cc7['body'],null))[_0x2463('0x34')](respondWithResult(_0x4d16f9,null))[_0x2463('0x54')](handleError(_0x4d16f9,null));};exports['destroy']=function(_0x3a92ec,_0x1bcbe9){return db[_0x2463('0x3a')]['find']({'where':{'id':_0x3a92ec[_0x2463('0x51')]['id']}})[_0x2463('0x34')](handleEntityNotFound(_0x1bcbe9,null))[_0x2463('0x34')](removeEntity(_0x1bcbe9,null))[_0x2463('0x54')](handleError(_0x1bcbe9,null));};exports[_0x2463('0x57')]=function(_0x53209c,_0x3ac42e){return db[_0x2463('0x3a')][_0x2463('0x57')]()[_0x2463('0x34')](respondWithResult(_0x3ac42e,null))[_0x2463('0x54')](handleError(_0x3ac42e,null));};var interaction_log=require('../../config/logger')(_0x2463('0x58'));exports[_0x2463('0x59')]=function(_0x2d9aab,_0x4756c6,_0x488f26){var _0x13e54d={'agent':{},'channel':'fax'};if(_0x2d9aab[_0x2463('0x55')]['id']){delete _0x2d9aab[_0x2463('0x55')]['id'];}_0x2d9aab[_0x2463('0x55')][_0x2463('0x5a')]=!![];_0x2d9aab[_0x2463('0x55')][_0x2463('0x5b')]=moment()[_0x2463('0x5c')](_0x2463('0x5d'));_0x2d9aab[_0x2463('0x55')]['UserId']=_0x2d9aab[_0x2463('0x55')][_0x2463('0x5e')]||_0x2d9aab[_0x2463('0x5f')]['id'];_0x13e54d[_0x2463('0x60')]['id']=_0x2d9aab[_0x2463('0x55')][_0x2463('0x5e')];return db[_0x2463('0x3a')][_0x2463('0x56')]({'where':{'id':_0x2d9aab[_0x2463('0x51')]['id'],'UserId':null}})[_0x2463('0x34')](handleEntityNotFound(_0x4756c6,null))['then'](saveUpdates(_0x2d9aab[_0x2463('0x55')],null))['then'](function(_0x14961a){if(_0x14961a){_0x13e54d[_0x2463('0x26')]=_0x14961a[_0x2463('0x61')]({'plain':!![]});return db['FaxInteraction'][_0x2463('0x56')]({'where':{'id':_0x14961a['FaxInteractionId']}});}return null;})[_0x2463('0x34')](handleEntityNotFound(_0x4756c6,null))[_0x2463('0x34')](function(_0x57078b){if(_0x57078b){return _0x57078b['update']({'UserId':_0x2d9aab[_0x2463('0x55')][_0x2463('0x5e')],'read1stAt':_[_0x2463('0x62')](_0x57078b[_0x2463('0x63')])?moment()[_0x2463('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2463('0x34')](function(_0x451dfa){if(_0x451dfa){_0x13e54d[_0x2463('0x64')]=_0x451dfa[_0x2463('0x61')]({'plain':!![]});interaction_log[_0x2463('0x1e')](_0x2463('0x65'),_0x2d9aab[_0x2463('0x5f')]['id'],_0x2d9aab[_0x2463('0x5f')][_0x2463('0x38')],_0x2d9aab[_0x2463('0x5f')]['role'],_0x13e54d[_0x2463('0x64')]['id'],_0x2d9aab[_0x2463('0x55')]?JSON[_0x2463('0x23')](_0x2d9aab[_0x2463('0x55')]):_0x2463('0x66'));return respondWithRpcPromise(_0x2463('0x67'),_0x2463('0x68'),_0x13e54d);}return null;})[_0x2463('0x34')](function(_0x3aa4e1){var _0x569aea=_0x2463('0x69')+_0x3aa4e1[_0x2463('0x26')][_0x2463('0x6a')];return db[_0x2463('0x6b')][_0x2463('0x40')](_0x569aea,{'type':db[_0x2463('0x6c')][_0x2463('0x6d')]['SELECT'],'raw':!![]})[_0x2463('0x34')](function(_0x53c509){return _0x53c509;});})[_0x2463('0x34')](function(_0x24fcb0){if(_0x24fcb0){_0x13e54d[_0x2463('0x26')]['contact']=_0x24fcb0[0x0];if(!_0x2d9aab[_0x2463('0x55')][_0x2463('0x5e')])return;return db['User']['find']({'where':{'id':_0x2d9aab['body']['UserId'],'role':_0x2463('0x60')},'attributes':['id',_0x2463('0x38'),_0x2463('0x6e'),_0x2463('0x6f'),_0x2463('0x70')],'raw':!![]});}return null;})[_0x2463('0x34')](function(_0x4498c5){if(!_0x4498c5)return null;_0x13e54d['message'][_0x2463('0x60')]=_0x4498c5;return _0x13e54d;})['then'](function(_0x243e47){if(_0x243e47){if(_0x2d9aab[_0x2463('0x55')][_0x2463('0x71')]){_0x13e54d['message'][_0x2463('0x72')]=util[_0x2463('0x5c')](_0x2463('0x73'),_0x2d9aab[_0x2463('0x5f')]['name']);_0x13e54d['message'][_0x2463('0x74')]=_0x13e54d[_0x2463('0x74')];_0x13e54d['message']['motionChannel']=_0x13e54d['channel'];_0x13e54d[_0x2463('0x26')][_0x2463('0x75')]=_0x2463('0x59');return respondWithRpcPromise(_0x2463('0x76'),_0x2463('0x76'),{'event':_0x2463('0x77'),'message':_0x13e54d[_0x2463('0x26')]},client9002)['then'](function(){return _0x13e54d;});}return _0x13e54d;}return null;})['then'](respondWithResult(_0x4756c6,null))[_0x2463('0x54')](handleError(_0x4756c6,null));};var interaction_log=require(_0x2463('0x14'))(_0x2463('0x58'));exports[_0x2463('0x32')]=function(_0x267475,_0x5a9ae8,_0x109554){var _0x3bc527={'agent':{},'channel':_0x2463('0x78')};if(_0x267475[_0x2463('0x55')]['id']){delete _0x267475[_0x2463('0x55')]['id'];}_0x267475[_0x2463('0x55')][_0x2463('0x5e')]=_0x267475['body'][_0x2463('0x5e')]||_0x267475[_0x2463('0x5f')]['id'];_0x3bc527[_0x2463('0x60')]['id']=_0x267475[_0x2463('0x55')][_0x2463('0x5e')];return db[_0x2463('0x3a')][_0x2463('0x56')]({'where':{'id':_0x267475['params']['id'],'UserId':null}})[_0x2463('0x34')](handleEntityNotFound(_0x5a9ae8,null))['then'](function(_0x42f647){if(_0x42f647){_0x3bc527[_0x2463('0x26')]=_0x42f647[_0x2463('0x61')]({'plain':!![]});return db[_0x2463('0x79')][_0x2463('0x56')]({'where':{'id':_0x42f647['FaxInteractionId']}});}return null;})[_0x2463('0x34')](handleEntityNotFound(_0x5a9ae8,null))[_0x2463('0x34')](function(_0x28b54f){if(_0x28b54f){_0x3bc527['interaction']=_0x28b54f[_0x2463('0x61')]({'plain':!![]});interaction_log['info'](_0x2463('0x7a'),_0x267475[_0x2463('0x5f')]['id'],_0x267475[_0x2463('0x5f')]['name'],_0x267475[_0x2463('0x5f')]['role'],_0x3bc527[_0x2463('0x64')]['id'],_0x267475[_0x2463('0x55')]?JSON[_0x2463('0x23')](_0x267475[_0x2463('0x55')]):_0x2463('0x66'));return respondWithRpcPromise(_0x2463('0x7b'),'rejectMessage',_0x3bc527);}return null;})[_0x2463('0x34')](function(_0x4d0325){var _0x22cb27=_0x2463('0x69')+_0x4d0325[_0x2463('0x26')][_0x2463('0x6a')];return db['sequelize'][_0x2463('0x40')](_0x22cb27,{'type':db[_0x2463('0x6c')][_0x2463('0x6d')][_0x2463('0x7c')],'raw':!![]})[_0x2463('0x34')](function(_0xb1e0a1){return _0xb1e0a1;});})['then'](function(_0x12670e){if(_0x12670e){_0x3bc527[_0x2463('0x26')][_0x2463('0x7d')]=_0x12670e[0x0];if(!_0x267475['body'][_0x2463('0x5e')])return;return db['User'][_0x2463('0x56')]({'where':{'id':_0x267475[_0x2463('0x55')][_0x2463('0x5e')],'role':_0x2463('0x60')},'attributes':['id',_0x2463('0x38'),_0x2463('0x6e'),_0x2463('0x6f'),'internal'],'raw':!![]});}return null;})[_0x2463('0x34')](function(_0x556924){if(!_0x556924)return null;_0x3bc527['message'][_0x2463('0x60')]=_0x556924;return _0x3bc527;})[_0x2463('0x34')](function(_0x24106e){if(_0x24106e){_0x24106e[_0x2463('0x26')]['interface']=util[_0x2463('0x5c')]('SIP/%s',_0x267475[_0x2463('0x5f')][_0x2463('0x38')]);_0x24106e[_0x2463('0x26')][_0x2463('0x74')]=_0x3bc527['channel'];_0x24106e[_0x2463('0x26')][_0x2463('0x7e')]=_0x3bc527[_0x2463('0x74')];_0x24106e[_0x2463('0x26')][_0x2463('0x75')]=_0x2463('0x32');respondWithRpcPromise(_0x2463('0x76'),_0x2463('0x76'),{'event':_0x2463('0x7f'),'message':_0x24106e['message']},client9002);return _0x3bc527;}return null;})[_0x2463('0x34')](respondWithResult(_0x5a9ae8,null))['catch'](handleError(_0x5a9ae8,null));};exports[_0x2463('0x80')]=function(_0x19420c,_0x5080f2){var _0x3e18d6;return db[_0x2463('0x3a')][_0x2463('0x80')](_0x19420c[_0x2463('0x55')],{})[_0x2463('0x34')](function(_0x3f8716){_0x3e18d6=_0x3f8716;return db[_0x2463('0x81')][_0x2463('0x82')]({'where':{'id':_0x3e18d6[_0x2463('0x6a')]}});})[_0x2463('0x34')](function(_0x2e160a){if(_['isNil'](_0x2e160a)){return;}else{_0x3e18d6[_0x2463('0x78')]=_0x2e160a[_0x2463('0x78')];return db['Attachment'][_0x2463('0x82')]({'where':{'id':_0x3e18d6[_0x2463('0x83')]}});}})['then'](function(_0x27a181){return respondWithRpcPromise('SendFax',_0x2463('0x84'),{'FaxAccountId':_[_0x2463('0x62')](_0x19420c['body'])?undefined:_0x19420c[_0x2463('0x55')][_0x2463('0x85')],'path':_[_0x2463('0x62')](_0x27a181)?undefined:util[_0x2463('0x5c')](_0x2463('0x86'),_0x27a181['basename']),'fax':_[_0x2463('0x62')](_0x3e18d6['fax'])?undefined:_0x3e18d6[_0x2463('0x78')],'AttachmentId':_0x3e18d6['AttachmentId']},client9002);})['then'](respondWithResult(_0x5080f2,0xc9))[_0x2463('0x54')](handleError(_0x5080f2,null));};exports['download']=function(_0x4d95ef,_0x1c8a8a){var _0x1a3eba=path[_0x2463('0x87')](config[_0x2463('0x88')],_0x2463('0x89'),_0x2463('0x8a'),'attachments');return db[_0x2463('0x3a')][_0x2463('0x56')]({'where':{'id':_0x4d95ef['params']['id']},'include':[{'model':db[_0x2463('0x8b')],'as':_0x2463('0x8b')}]})[_0x2463('0x34')](handleEntityNotFound(_0x1c8a8a,null))[_0x2463('0x34')](function(_0x32717e){if(_0x32717e){return _0x1c8a8a[_0x2463('0x8c')](path[_0x2463('0x87')](_0x1a3eba,_0x32717e['Attachment'][_0x2463('0x8d')]));}})[_0x2463('0x54')](handleError(_0x1c8a8a,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index a2d4b24..0c173d1 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 _0xaaee=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x709374,_0x53be76){var _0x5de4ac=function(_0x32bbdf){while(--_0x32bbdf){_0x709374['push'](_0x709374['shift']());}};_0x5de4ac(++_0x53be76);}(_0xaaee,0x132));var _0xeaae=function(_0x435c58,_0x40a316){_0x435c58=_0x435c58-0x0;var _0x4489bd=_0xaaee[_0x435c58];return _0x4489bd;};'use strict';var EventEmitter=require(_0xeaae('0x0'));var FaxMessage=require(_0xeaae('0x1'))['db'][_0xeaae('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xeaae('0x3')](0x0);var events={'afterCreate':_0xeaae('0x4'),'afterUpdate':'update','afterDestroy':_0xeaae('0x5')};function emitEvent(_0x2778d9){return function(_0x2e683a,_0xdbaacc,_0x25adbc){FaxMessageEvents[_0xeaae('0x6')](_0x2778d9+':'+_0x2e683a['id'],_0x2e683a);FaxMessageEvents[_0xeaae('0x6')](_0x2778d9,_0x2e683a);_0x25adbc(null);};}for(var e in events){if(events[_0xeaae('0x7')](e)){var event=events[e];FaxMessage[_0xeaae('0x8')](e,emitEvent(event));}}module[_0xeaae('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x187d=['save','update','remove','emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners'];(function(_0x4ba194,_0x3de795){var _0xb2d307=function(_0x1daaeb){while(--_0x1daaeb){_0x4ba194['push'](_0x4ba194['shift']());}};_0xb2d307(++_0x3de795);}(_0x187d,0x93));var _0xd187=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x187d[_0x2b5eae];return _0x5f3ac9;};'use strict';var EventEmitter=require(_0xd187('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xd187('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xd187('0x2')](0x0);var events={'afterCreate':_0xd187('0x3'),'afterUpdate':_0xd187('0x4'),'afterDestroy':_0xd187('0x5')};function emitEvent(_0x201b79){return function(_0x58622a,_0x28fa0b,_0x163807){FaxMessageEvents['emit'](_0x201b79+':'+_0x58622a['id'],_0x58622a);FaxMessageEvents[_0xd187('0x6')](_0x201b79,_0x58622a);_0x163807(null);};}for(var e in events){if(events[_0xd187('0x7')](e)){var event=events[e];FaxMessage[_0xd187('0x8')](e,emitEvent(event));}}module[_0xd187('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 57343e2..78aedea 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 _0x7843=['secret','isNil','UserId','findOne','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','models','get','direction','toLowerCase','out'];(function(_0x578e04,_0x43c433){var _0x54f2b5=function(_0x2930f9){while(--_0x2930f9){_0x578e04['push'](_0x578e04['shift']());}};_0x54f2b5(++_0x43c433);}(_0x7843,0x117));var _0x3784=function(_0x57cf6a,_0x153bfc){_0x57cf6a=_0x57cf6a-0x0;var _0x37686b=_0x7843[_0x57cf6a];return _0x37686b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3784('0x0'));var moment=require(_0x3784('0x1'));var BPromise=require(_0x3784('0x2'));var rp=require(_0x3784('0x3'));var fs=require('fs');var path=require(_0x3784('0x4'));var rimraf=require(_0x3784('0x5'));var config=require(_0x3784('0x6'));var attributes=require(_0x3784('0x7'));module[_0x3784('0x8')]=function(_0xfb716c,_0x2df090){return _0xfb716c[_0x3784('0x9')](_0x3784('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x3784('0xb'),'fields':[_0x3784('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f3e38,_0xd1deb3,_0x4a98e7){var _0x5b2742=_0xfb716c[_0x3784('0xd')];var _0x3c48f5=_0x4f3e38[_0x3784('0xe')]({'plain':!![]});if(_0x3c48f5[_0x3784('0xf')][_0x3784('0x10')]()==='in'||_0x3c48f5[_0x3784('0xf')][_0x3784('0x10')]()===_0x3784('0x11')&&!_0x3c48f5[_0x3784('0x12')]&&!_[_0x3784('0x13')](_0x3c48f5[_0x3784('0x14')])){_0x5b2742['FaxInteraction'][_0x3784('0x15')]({'where':{'id':_0x3c48f5['FaxInteractionId']}})['then'](function(_0x427beb){if(_0x427beb){_0x427beb['update']({'lastMsgAt':_0x3c48f5[_0x3784('0x16')],'lastMsgDirection':_0x3c48f5[_0x3784('0xf')][_0x3784('0x10')]()});}})[_0x3784('0x17')](function(_0x2f2c9b){console[_0x3784('0x18')](_0x2f2c9b);});}_0x4a98e7();}},'charset':_0x3784('0x19'),'collate':_0x3784('0x1a')});}; \ No newline at end of file +var _0x196e=['then','update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','FULLTEXT','models','direction','out','secret','UserId','findOne','FaxInteractionId'];(function(_0x269ca1,_0x45e8b6){var _0x181526=function(_0x2bf7e4){while(--_0x2bf7e4){_0x269ca1['push'](_0x269ca1['shift']());}};_0x181526(++_0x45e8b6);}(_0x196e,0xd5));var _0xe196=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x196e[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xe196('0x0'));var util=require(_0xe196('0x1'));var logger=require(_0xe196('0x2'))(_0xe196('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe196('0x4'));var fs=require('fs');var path=require(_0xe196('0x5'));var rimraf=require('rimraf');var config=require(_0xe196('0x6'));var attributes=require(_0xe196('0x7'));module[_0xe196('0x8')]=function(_0x5d1438,_0x5afd23){return _0x5d1438[_0xe196('0x9')](_0xe196('0xa'),attributes,{'tableName':_0xe196('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xe196('0xc')],'type':_0xe196('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x517ede,_0x80c857,_0x3b8861){var _0x193583=_0x5d1438[_0xe196('0xe')];var _0xbdf849=_0x517ede['get']({'plain':!![]});if(_0xbdf849[_0xe196('0xf')]['toLowerCase']()==='in'||_0xbdf849[_0xe196('0xf')]['toLowerCase']()===_0xe196('0x10')&&!_0xbdf849[_0xe196('0x11')]&&!_['isNil'](_0xbdf849[_0xe196('0x12')])){_0x193583['FaxInteraction'][_0xe196('0x13')]({'where':{'id':_0xbdf849[_0xe196('0x14')]}})[_0xe196('0x15')](function(_0x164c35){if(_0x164c35){_0x164c35[_0xe196('0x16')]({'lastMsgAt':_0xbdf849[_0xe196('0x17')],'lastMsgDirection':_0xbdf849[_0xe196('0xf')]['toLowerCase']()});}})[_0xe196('0x18')](function(_0x3514ce){console['error'](_0x3514ce);});}_0x3b8861();}},'charset':_0xe196('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index ac1bf0a..a790095 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 _0x7bae=['request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxMessage,\x20%s,\x20%s','create','body','options','raw','CreateFaxMessage','debug','FaxMessage','update','where','limit','UpdateFaxMessage','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7bae,0x13b));var _0xe7ba=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x7bae[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});config[_0xe7ba('0xa')]=_[_0xe7ba('0xb')](config[_0xe7ba('0xa')],{'host':_0xe7ba('0xc'),'port':0x18eb});var socket=require(_0xe7ba('0xd'))(new Redis(config[_0xe7ba('0xa')]));require(_0xe7ba('0xe'))['register'](socket);function respondWithRpcPromise(_0x3df8bf,_0xe57e33,_0x375ebb){return new BPromise(function(_0x276bc3,_0x15083a){return client[_0xe7ba('0xf')](_0x3df8bf,_0x375ebb)[_0xe7ba('0x10')](function(_0x448bcc){logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0xe7ba('0x12'));logger['debug'](_0xe7ba('0x13'),_0xe57e33,_0xe7ba('0x12'),JSON[_0xe7ba('0x14')](_0x448bcc));if(_0x448bcc[_0xe7ba('0x15')]){if(_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x17')]);return _0x15083a(_0x448bcc[_0xe7ba('0x15')]['message']);}logger[_0xe7ba('0x15')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc['error']['message']);return _0x276bc3(_0x448bcc[_0xe7ba('0x15')]['message']);}else{logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,'request\x20sent');_0x276bc3(_0x448bcc['result'][_0xe7ba('0x17')]);}})[_0xe7ba('0x18')](function(_0x39ca38){logger[_0xe7ba('0x15')](_0xe7ba('0x19'),_0xe57e33,_0x39ca38);_0x15083a(_0x39ca38);});});}exports['CreateFaxMessage']=function(_0x149c62){var _0x20c653=this;return new Promise(function(_0x3b40fb,_0x136ec6){return db['FaxMessage'][_0xe7ba('0x1a')](_0x149c62[_0xe7ba('0x1b')],{'raw':_0x149c62['options']?_0x149c62[_0xe7ba('0x1c')][_0xe7ba('0x1d')]===undefined?!![]:![]:!![]})[_0xe7ba('0x10')](function(_0x7ab9e4){logger[_0xe7ba('0x11')](_0xe7ba('0x1e'),_0x149c62);logger[_0xe7ba('0x1f')](_0xe7ba('0x1e'),_0x149c62,JSON[_0xe7ba('0x14')](_0x7ab9e4));_0x3b40fb(_0x7ab9e4);})[_0xe7ba('0x18')](function(_0x58cf43){logger['error']('CreateFaxMessage',_0x58cf43['message'],_0x149c62);_0x136ec6(_0x20c653[_0xe7ba('0x15')](0x1f4,_0x58cf43['message']));});});};exports['UpdateFaxMessage']=function(_0x5ece11){var _0x255def=this;return new Promise(function(_0x32cc00,_0xe32862){return db[_0xe7ba('0x20')][_0xe7ba('0x21')](_0x5ece11[_0xe7ba('0x1b')],{'raw':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11['options'][_0xe7ba('0x22')]||null:null,'attributes':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['attributes']||null:null,'limit':_0x5ece11['options']?_0x5ece11[_0xe7ba('0x1c')][_0xe7ba('0x23')]||null:null})[_0xe7ba('0x10')](function(_0x20b6cd){logger[_0xe7ba('0x11')]('UpdateFaxMessage',_0x5ece11);logger[_0xe7ba('0x1f')](_0xe7ba('0x24'),_0x5ece11,JSON['stringify'](_0x20b6cd));_0x32cc00(_0x20b6cd);})[_0xe7ba('0x18')](function(_0x530227){logger['error'](_0xe7ba('0x24'),_0x530227[_0xe7ba('0x17')],_0x5ece11);_0xe32862(_0x255def[_0xe7ba('0x15')](0x1f4,_0x530227['message']));});});}; \ No newline at end of file +var _0x81bd=['debug','request\x20sent','stringify','error','message','result','catch','CreateFaxMessage','create','body','options','raw','FaxMessage','update','limit','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s'];(function(_0x9e46bb,_0x1853b1){var _0x3aef85=function(_0x54ac0d){while(--_0x54ac0d){_0x9e46bb['push'](_0x9e46bb['shift']());}};_0x3aef85(++_0x1853b1);}(_0x81bd,0x7c));var _0xd81b=function(_0x4f74a5,_0x1fd979){_0x4f74a5=_0x4f74a5-0x0;var _0x5be8b2=_0x81bd[_0x4f74a5];return _0x5be8b2;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});config[_0xd81b('0xc')]=_['defaults'](config['redis'],{'host':_0xd81b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0xc')]));require(_0xd81b('0xe'))[_0xd81b('0xf')](socket);function respondWithRpcPromise(_0x86dab6,_0x17fba4,_0x1ff60f){return new BPromise(function(_0x4391be,_0x17e09f){return client[_0xd81b('0x10')](_0x86dab6,_0x1ff60f)[_0xd81b('0x11')](function(_0x215b92){logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,'request\x20sent');logger[_0xd81b('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x17fba4,_0xd81b('0x15'),JSON[_0xd81b('0x16')](_0x215b92));if(_0x215b92['error']){if(_0x215b92[_0xd81b('0x17')]['code']===0x1f4){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);return _0x17e09f(_0x215b92[_0xd81b('0x17')]['message']);}logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92['error'][_0xd81b('0x18')]);return _0x4391be(_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);}else{logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,_0xd81b('0x15'));_0x4391be(_0x215b92[_0xd81b('0x19')][_0xd81b('0x18')]);}})[_0xd81b('0x1a')](function(_0x285164){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x285164);_0x17e09f(_0x285164);});});}exports[_0xd81b('0x1b')]=function(_0x3518f0){var _0x156894=this;return new Promise(function(_0x4f8c0b,_0x5f101a){return db['FaxMessage'][_0xd81b('0x1c')](_0x3518f0[_0xd81b('0x1d')],{'raw':_0x3518f0[_0xd81b('0x1e')]?_0x3518f0['options'][_0xd81b('0x1f')]===undefined?!![]:![]:!![]})[_0xd81b('0x11')](function(_0x542ee2){logger[_0xd81b('0x12')](_0xd81b('0x1b'),_0x3518f0);logger[_0xd81b('0x14')](_0xd81b('0x1b'),_0x3518f0,JSON[_0xd81b('0x16')](_0x542ee2));_0x4f8c0b(_0x542ee2);})[_0xd81b('0x1a')](function(_0x255011){logger[_0xd81b('0x17')](_0xd81b('0x1b'),_0x255011[_0xd81b('0x18')],_0x3518f0);_0x5f101a(_0x156894[_0xd81b('0x17')](0x1f4,_0x255011[_0xd81b('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x28768f){var _0x99dbc9=this;return new Promise(function(_0xe3637a,_0x31b9fd){return db[_0xd81b('0x20')][_0xd81b('0x21')](_0x28768f[_0xd81b('0x1d')],{'raw':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28768f[_0xd81b('0x1e')]?_0x28768f['options']['where']||null:null,'attributes':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['attributes']||null:null,'limit':_0x28768f['options']?_0x28768f[_0xd81b('0x1e')][_0xd81b('0x22')]||null:null})[_0xd81b('0x11')](function(_0x289f54){logger[_0xd81b('0x12')](_0xd81b('0x23'),_0x28768f);logger['debug'](_0xd81b('0x23'),_0x28768f,JSON[_0xd81b('0x16')](_0x289f54));_0xe3637a(_0x289f54);})['catch'](function(_0x56d80b){logger[_0xd81b('0x17')](_0xd81b('0x23'),_0x56d80b['message'],_0x28768f);_0x31b9fd(_0x99dbc9['error'](0x1f4,_0x56d80b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index fd500fe..9511856 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 _0x0387=['register','length','faxMessage:','./faxMessage.events','save','remove','update','removeListener'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0x0387,0x133));var _0x7038=function(_0x51b221,_0xe21018){_0x51b221=_0x51b221-0x0;var _0x54d5ec=_0x0387[_0x51b221];return _0x54d5ec;};'use strict';var FaxMessageEvents=require(_0x7038('0x0'));var events=[_0x7038('0x1'),_0x7038('0x2'),_0x7038('0x3')];function createListener(_0xd193bf,_0xadbd33){return function(_0x5cd4e7){_0xadbd33['emit'](_0xd193bf,_0x5cd4e7);};}function removeListener(_0x504e7c,_0x38805e){return function(){FaxMessageEvents[_0x7038('0x4')](_0x504e7c,_0x38805e);};}exports[_0x7038('0x5')]=function(_0x4c88d7){for(var _0x4a5095=0x0,_0x11e937=events[_0x7038('0x6')];_0x4a5095<_0x11e937;_0x4a5095++){var _0x2d841e=events[_0x4a5095];var _0x3cb9b1=createListener(_0x7038('0x7')+_0x2d841e,_0x4c88d7);FaxMessageEvents['on'](_0x2d841e,_0x3cb9b1);}}; \ No newline at end of file +var _0x8aee=['update','emit','length','./faxMessage.events','save','remove'];(function(_0x4083c2,_0x6bfb6b){var _0x5a6d9e=function(_0x42a929){while(--_0x42a929){_0x4083c2['push'](_0x4083c2['shift']());}};_0x5a6d9e(++_0x6bfb6b);}(_0x8aee,0xc9));var _0xe8ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aee[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require(_0xe8ae('0x0'));var events=[_0xe8ae('0x1'),_0xe8ae('0x2'),_0xe8ae('0x3')];function createListener(_0x2fa840,_0x54f08c){return function(_0x2965a){_0x54f08c[_0xe8ae('0x4')](_0x2fa840,_0x2965a);};}function removeListener(_0x5a9a9f,_0x5746bf){return function(){FaxMessageEvents['removeListener'](_0x5a9a9f,_0x5746bf);};}exports['register']=function(_0x27af16){for(var _0x5dd363=0x0,_0x389234=events[_0xe8ae('0x5')];_0x5dd363<_0x389234;_0x5dd363++){var _0x1b9f5d=events[_0x5dd363];var _0x1f2613=createListener('faxMessage:'+_0x1b9f5d,_0x27af16);FaxMessageEvents['on'](_0x1b9f5d,_0x1f2613);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 5faf5b8..b4dce82 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 _0x6e6c=['reject','/:id','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/download','download','post','tracked','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_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('./faxMessage.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('0xc')]('/',auth[_0xc6e6('0x7')](),interaction[_0xc6e6('0xd')](_0xc6e6('0xe'),_0xc6e6('0xf')),controller['create']);router[_0xc6e6('0x10')]('/:id',auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x11')]);router[_0xc6e6('0x10')](_0xc6e6('0x12'),auth['isAuthenticated'](),controller[_0xc6e6('0x13')]);router[_0xc6e6('0x10')](_0xc6e6('0x14'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x15')]);router['delete'](_0xc6e6('0x16'),auth[_0xc6e6('0x7')](),controller['destroy']);module[_0xc6e6('0x17')]=router; \ No newline at end of file +var _0xc368=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','download','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','delete','destroy','exports','util','connect-timeout'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xc368,0x7b));var _0x8c36=function(_0xdaad6d,_0x4ac118){_0xdaad6d=_0xdaad6d-0x0;var _0x279208=_0xc368[_0xdaad6d];return _0x279208;};'use strict';var multer=require('multer');var util=require(_0x8c36('0x0'));var path=require('path');var timeout=require(_0x8c36('0x1'));var express=require(_0x8c36('0x2'));var router=express[_0x8c36('0x3')]();var fs_extra=require(_0x8c36('0x4'));var auth=require(_0x8c36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c36('0x6'));var controller=require(_0x8c36('0x7'));router[_0x8c36('0x8')]('/',auth[_0x8c36('0x9')](),controller['index']);router['get'](_0x8c36('0xa'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xb')]);router[_0x8c36('0x8')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller['show']);router['get']('/:id/download',auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router['post']('/',auth[_0x8c36('0x9')](),interaction[_0x8c36('0xe')](_0x8c36('0xf'),_0x8c36('0x10')),controller[_0x8c36('0x11')]);router[_0x8c36('0x12')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x13')]);router[_0x8c36('0x12')](_0x8c36('0x14'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x15')]);router[_0x8c36('0x12')]('/:id/reject',auth[_0x8c36('0x9')](),controller['reject']);router[_0x8c36('0x16')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x17')]);module[_0x8c36('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index b1f1b1f..ef19d1d 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 _0x7969=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7969,0xd0));var _0x9796=function(_0x5ea3bf,_0x363963){_0x5ea3bf=_0x5ea3bf-0x0;var _0x2508ff=_0x7969[_0x5ea3bf];return _0x2508ff;};'use strict';var Sequelize=require('sequelize');module[_0x9796('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9796('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9796('0x2')]},'timeout':{'type':Sequelize[_0x9796('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9796('0x4')](_0x9796('0x5'),_0x9796('0x6'),_0x9796('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9796('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcc66=['INTEGER','ENUM','rrmemory','sequelize','exports','STRING','name'];(function(_0xb0ef2b,_0x477bf9){var _0xc7b097=function(_0x3ecad0){while(--_0x3ecad0){_0xb0ef2b['push'](_0xb0ef2b['shift']());}};_0xc7b097(++_0x477bf9);}(_0xcc66,0x1f4));var _0x6cc6=function(_0x5902d3,_0x56299f){_0x5902d3=_0x5902d3-0x0;var _0x30079e=_0xcc66[_0x5902d3];return _0x30079e;};'use strict';var Sequelize=require(_0x6cc6('0x0'));module[_0x6cc6('0x1')]={'name':{'type':Sequelize[_0x6cc6('0x2')],'unique':_0x6cc6('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6cc6('0x2')]},'timeout':{'type':Sequelize[_0x6cc6('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6cc6('0x5')](_0x6cc6('0x6'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6cc6('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 61f9c95..27a81aa 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 _0xed9c=['nolimit','order','pick','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','faxPause','createdAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userFaxQueue:save','removeTeams','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','forEach','addAgents','removeAgents','userFaxQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserFaxQueue'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0xed9c,0x1d2));var _0xced9=function(_0x53b862,_0x1eb8a1){_0x53b862=_0x53b862-0x0;var _0xfa7ce1=_0xed9c[_0x53b862];return _0xfa7ce1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xced9('0x0'));var zipdir=require(_0xced9('0x1'));var jsonpatch=require(_0xced9('0x2'));var rp=require(_0xced9('0x3'));var moment=require(_0xced9('0x4'));var BPromise=require(_0xced9('0x5'));var Mustache=require(_0xced9('0x6'));var util=require(_0xced9('0x7'));var path=require('path');var sox=require(_0xced9('0x8'));var csv=require(_0xced9('0x9'));var ejs=require(_0xced9('0xa'));var fs=require('fs');var fs_extra=require(_0xced9('0xb'));var _=require('lodash');var squel=require(_0xced9('0xc'));var crypto=require(_0xced9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xced9('0xe'));var toCsv=require(_0xced9('0x9'));var querystring=require(_0xced9('0xf'));var Papa=require(_0xced9('0x10'));var Redis=require(_0xced9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xced9('0x12'));var hardwareService=require(_0xced9('0x13'));var logger=require('../../config/logger')(_0xced9('0x14'));var utils=require(_0xced9('0x15'));var config=require(_0xced9('0x16'));var licenseUtil=require(_0xced9('0x17'));var db=require('../../mysqldb')['db'];config[_0xced9('0x18')]=_['defaults'](config[_0xced9('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xced9('0x19'))(new Redis(config[_0xced9('0x18')]));require(_0xced9('0x1a'))['register'](socket);function respondWithStatusCode(_0x46748b,_0x2c2e2b){_0x2c2e2b=_0x2c2e2b||0xcc;return function(_0xd8e628){if(_0xd8e628){return _0x46748b[_0xced9('0x1b')](_0x2c2e2b);}return _0x46748b[_0xced9('0x1c')](_0x2c2e2b)[_0xced9('0x1d')]();};}function respondWithResult(_0x17142a,_0x7110e7){_0x7110e7=_0x7110e7||0xc8;return function(_0x2703e9){if(_0x2703e9){return _0x17142a[_0xced9('0x1c')](_0x7110e7)[_0xced9('0x1e')](_0x2703e9);}};}function respondWithFilteredResult(_0x29a76e,_0x2c4e5a){return function(_0x544c38){if(_0x544c38){var _0x1e1b11=typeof _0x2c4e5a['offset']==='undefined'&&typeof _0x2c4e5a[_0xced9('0x1f')]===_0xced9('0x20');var _0x2902cd=_0x544c38[_0xced9('0x21')];var _0x2bfd39=_0x1e1b11?0x0:_0x2c4e5a[_0xced9('0x22')];var _0xda8b71=_0x1e1b11?_0x544c38[_0xced9('0x21')]:_0x2c4e5a[_0xced9('0x22')]+_0x2c4e5a[_0xced9('0x1f')];var _0x1e35d9;if(_0xda8b71>=_0x2902cd){_0xda8b71=_0x2902cd;_0x1e35d9=0xc8;}else{_0x1e35d9=0xce;}_0x29a76e[_0xced9('0x1c')](_0x1e35d9);return _0x29a76e['set'](_0xced9('0x23'),_0x2bfd39+'-'+_0xda8b71+'/'+_0x2902cd)[_0xced9('0x1e')](_0x544c38);}return null;};}function patchUpdates(_0x2ddc02){return function(_0x4ade99){try{jsonpatch['apply'](_0x4ade99,_0x2ddc02,!![]);}catch(_0x45ecb1){return BPromise[_0xced9('0x24')](_0x45ecb1);}return _0x4ade99[_0xced9('0x25')]();};}function saveUpdates(_0x2eba63,_0x13996f){return function(_0x53d56a){if(_0x53d56a){return _0x53d56a[_0xced9('0x26')](_0x2eba63)[_0xced9('0x27')](function(_0x5d4193){return _0x5d4193;});}return null;};}function removeEntity(_0x5e80a8,_0x128ded){return function(_0x9ebde7){if(_0x9ebde7){return _0x9ebde7['destroy']()[_0xced9('0x27')](function(){var _0x51d6c9=_0x9ebde7[_0xced9('0x28')]({'plain':!![]});var _0x46fddb='FaxQueues';return db[_0xced9('0x29')][_0xced9('0x2a')]({'where':{'type':_0x46fddb,'resourceId':_0x51d6c9['id']}})[_0xced9('0x27')](function(){return _0x9ebde7;});})['then'](function(){_0x5e80a8[_0xced9('0x1c')](0xcc)[_0xced9('0x1d')]();});}};}function handleEntityNotFound(_0x33caa0,_0x5e628d){return function(_0x28ee9b){if(!_0x28ee9b){_0x33caa0[_0xced9('0x1b')](0x194);}return _0x28ee9b;};}function handleError(_0x44b600,_0x2bf0a8){_0x2bf0a8=_0x2bf0a8||0x1f4;return function(_0x145d15){logger[_0xced9('0x2b')](_0x145d15[_0xced9('0x2c')]);if(_0x145d15['name']){delete _0x145d15[_0xced9('0x2d')];}_0x44b600[_0xced9('0x1c')](_0x2bf0a8)[_0xced9('0x2e')](_0x145d15);};}exports[_0xced9('0x2f')]=function(_0x5e6600,_0x4e82cf){var _0x3ba688={},_0x581818={},_0xa250dd={'count':0x0,'rows':[]};var _0x21e8f7=_['map'](db[_0xced9('0x30')][_0xced9('0x31')],function(_0x8bd20){return{'name':_0x8bd20[_0xced9('0x32')],'type':_0x8bd20[_0xced9('0x33')][_0xced9('0x34')]};});_0x581818[_0xced9('0x35')]=_[_0xced9('0x36')](_0x21e8f7,_0xced9('0x2d'));_0x581818[_0xced9('0x37')]=_[_0xced9('0x38')](_0x5e6600[_0xced9('0x37')]);_0x581818[_0xced9('0x39')]=_[_0xced9('0x3a')](_0x581818[_0xced9('0x35')],_0x581818[_0xced9('0x37')]);_0x3ba688[_0xced9('0x3b')]=_[_0xced9('0x3a')](_0x581818['model'],qs[_0xced9('0x3c')](_0x5e6600[_0xced9('0x37')]['fields']));_0x3ba688[_0xced9('0x3b')]=_0x3ba688['attributes'][_0xced9('0x3d')]?_0x3ba688[_0xced9('0x3b')]:_0x581818[_0xced9('0x35')];if(!_0x5e6600['query'][_0xced9('0x3e')]('nolimit')){_0x3ba688[_0xced9('0x1f')]=qs[_0xced9('0x1f')](_0x5e6600[_0xced9('0x37')]['limit']);_0x3ba688[_0xced9('0x22')]=qs[_0xced9('0x22')](_0x5e6600[_0xced9('0x37')][_0xced9('0x22')]);}_0x3ba688['order']=qs[_0xced9('0x3f')](_0x5e6600[_0xced9('0x37')][_0xced9('0x3f')]);_0x3ba688[_0xced9('0x40')]=qs['filters'](_['pick'](_0x5e6600[_0xced9('0x37')],_0x581818['filters']),_0x21e8f7);if(_0x5e6600[_0xced9('0x37')][_0xced9('0x41')]){_0x3ba688['where']=_[_0xced9('0x42')](_0x3ba688[_0xced9('0x40')],{'$or':_[_0xced9('0x36')](_0x21e8f7,function(_0x21a704){if(_0x21a704[_0xced9('0x33')]!==_0xced9('0x43')){var _0x4bb59d={};_0x4bb59d[_0x21a704[_0xced9('0x2d')]]={'$like':'%'+_0x5e6600[_0xced9('0x37')][_0xced9('0x41')]+'%'};return _0x4bb59d;}})});}_0x3ba688=_['merge']({},_0x3ba688,_0x5e6600[_0xced9('0x44')]);var _0x4a9450={'where':_0x3ba688[_0xced9('0x40')]};return db[_0xced9('0x30')][_0xced9('0x21')](_0x4a9450)[_0xced9('0x27')](function(_0x39ba23){_0xa250dd[_0xced9('0x21')]=_0x39ba23;if(_0x5e6600[_0xced9('0x37')]['includeAll']){_0x3ba688[_0xced9('0x45')]=[{'all':!![]}];}return db[_0xced9('0x30')][_0xced9('0x46')](_0x3ba688);})[_0xced9('0x27')](function(_0x5c9969){_0xa250dd[_0xced9('0x47')]=_0x5c9969;return _0xa250dd;})['then'](respondWithFilteredResult(_0x4e82cf,_0x3ba688))[_0xced9('0x48')](handleError(_0x4e82cf,null));};exports['show']=function(_0x2161e9,_0x41739e){var _0xfb2e55={'raw':!![],'where':{'id':_0x2161e9[_0xced9('0x49')]['id']}},_0x3119d9={};_0x3119d9[_0xced9('0x35')]=_[_0xced9('0x38')](db[_0xced9('0x30')][_0xced9('0x31')]);_0x3119d9[_0xced9('0x37')]=_[_0xced9('0x38')](_0x2161e9[_0xced9('0x37')]);_0x3119d9[_0xced9('0x39')]=_[_0xced9('0x3a')](_0x3119d9[_0xced9('0x35')],_0x3119d9[_0xced9('0x37')]);_0xfb2e55['attributes']=_['intersection'](_0x3119d9[_0xced9('0x35')],qs[_0xced9('0x3c')](_0x2161e9['query'][_0xced9('0x3c')]));_0xfb2e55['attributes']=_0xfb2e55['attributes'][_0xced9('0x3d')]?_0xfb2e55[_0xced9('0x3b')]:_0x3119d9[_0xced9('0x35')];if(_0x2161e9[_0xced9('0x37')][_0xced9('0x4a')]){_0xfb2e55[_0xced9('0x45')]=[{'all':!![]}];}_0xfb2e55=_[_0xced9('0x42')]({},_0xfb2e55,_0x2161e9[_0xced9('0x44')]);return db[_0xced9('0x30')]['find'](_0xfb2e55)['then'](handleEntityNotFound(_0x41739e,null))[_0xced9('0x27')](respondWithResult(_0x41739e,null))[_0xced9('0x48')](handleError(_0x41739e,null));};exports[_0xced9('0x4b')]=function(_0xe8379c,_0x1b57e2){return db[_0xced9('0x30')][_0xced9('0x4b')](_0xe8379c[_0xced9('0x4c')],{})['then'](function(_0x1ae783){var _0x3cec92=_0xe8379c['user'][_0xced9('0x28')]({'plain':!![]});if(!_0x3cec92)throw new Error(_0xced9('0x4d'));if(_0x3cec92[_0xced9('0x4e')]===_0xced9('0x4f')){var _0x2db067=_0x1ae783[_0xced9('0x28')]({'plain':!![]});var _0x232430='FaxQueues';return db[_0xced9('0x50')][_0xced9('0x51')]({'where':{'name':_0x232430,'userProfileId':_0x3cec92['userProfileId']},'raw':!![]})['then'](function(_0x383720){if(_0x383720&&_0x383720[_0xced9('0x52')]===0x0){return db[_0xced9('0x29')][_0xced9('0x4b')]({'name':_0x2db067[_0xced9('0x2d')],'resourceId':_0x2db067['id'],'type':_0x383720[_0xced9('0x2d')],'sectionId':_0x383720['id']},{})['then'](function(){return _0x1ae783;});}else{return _0x1ae783;}})[_0xced9('0x48')](function(_0x6b408a){logger[_0xced9('0x2b')](_0xced9('0x53'),_0x6b408a);throw _0x6b408a;});}return _0x1ae783;})['then'](respondWithResult(_0x1b57e2,0xc9))[_0xced9('0x48')](handleError(_0x1b57e2,null));};exports[_0xced9('0x26')]=function(_0x2e6f23,_0x2bb9cf){if(_0x2e6f23['body']['id']){delete _0x2e6f23[_0xced9('0x4c')]['id'];}return db[_0xced9('0x30')]['find']({'where':{'id':_0x2e6f23[_0xced9('0x49')]['id']}})[_0xced9('0x27')](handleEntityNotFound(_0x2bb9cf,null))['then'](saveUpdates(_0x2e6f23['body'],null))[_0xced9('0x27')](respondWithResult(_0x2bb9cf,null))['catch'](handleError(_0x2bb9cf,null));};exports[_0xced9('0x2a')]=function(_0x576d43,_0x1a6ca2){return db[_0xced9('0x30')][_0xced9('0x51')]({'where':{'id':_0x576d43[_0xced9('0x49')]['id']}})[_0xced9('0x27')](handleEntityNotFound(_0x1a6ca2,null))[_0xced9('0x27')](removeEntity(_0x1a6ca2,null))['catch'](handleError(_0x1a6ca2,null));};exports[_0xced9('0x54')]=function(_0x46a83c,_0x4e3448){return db[_0xced9('0x30')][_0xced9('0x54')]()[_0xced9('0x27')](respondWithResult(_0x4e3448,null))[_0xced9('0x48')](handleError(_0x4e3448,null));};exports['getMembers']=function(_0x2132b9,_0x3026a4,_0x4b37b9){var _0x3795be={'raw':!![],'where':{}},_0x43b0c6={},_0x48dd4f;return db[_0xced9('0x30')]['findOne']({'where':{'id':_0x2132b9['params']['id']}})[_0xced9('0x27')](handleEntityNotFound(_0x3026a4,null))[_0xced9('0x27')](function(_0x502bc0){if(_0x502bc0){_0x48dd4f=_0x502bc0[_0xced9('0x28')]({'plain':!![]});_0x43b0c6[_0xced9('0x35')]=_['keys'](db[_0xced9('0x55')][_0xced9('0x31')]);_0x43b0c6[_0xced9('0x37')]=_[_0xced9('0x38')](_0x2132b9[_0xced9('0x37')]);_0x43b0c6['filters']=_['intersection'](_0x43b0c6[_0xced9('0x35')],_0x43b0c6[_0xced9('0x37')]);_0x3795be[_0xced9('0x3b')]=_['intersection'](_0x43b0c6[_0xced9('0x35')],qs[_0xced9('0x3c')](_0x2132b9[_0xced9('0x37')]['fields']));_0x3795be[_0xced9('0x3b')]=_0x3795be[_0xced9('0x3b')][_0xced9('0x3d')]?_0x3795be[_0xced9('0x3b')]:_0x43b0c6[_0xced9('0x35')];if(!_0x2132b9['query'][_0xced9('0x3e')](_0xced9('0x56'))){_0x3795be[_0xced9('0x1f')]=qs[_0xced9('0x1f')](_0x2132b9[_0xced9('0x37')][_0xced9('0x1f')]);_0x3795be[_0xced9('0x22')]=qs[_0xced9('0x22')](_0x2132b9[_0xced9('0x37')]['offset']);}_0x3795be[_0xced9('0x57')]=qs[_0xced9('0x3f')](_0x2132b9[_0xced9('0x37')][_0xced9('0x3f')]);_0x3795be['where']=qs[_0xced9('0x39')](_[_0xced9('0x58')](_0x2132b9['query'],_0x43b0c6[_0xced9('0x39')]));_0x3795be[_0xced9('0x40')]['FaxQueueId']=_0x502bc0['id'];if(_0x2132b9[_0xced9('0x37')][_0xced9('0x41')]){_0x3795be['where']=_['merge'](_0x3795be['where'],{'$or':_['map'](_0x3795be[_0xced9('0x3b')],function(_0x4e1271){var _0x5a2272={};_0x5a2272[_0x4e1271]={'$like':'%'+_0x2132b9[_0xced9('0x37')][_0xced9('0x41')]+'%'};return _0x5a2272;})});}_0x3795be=_[_0xced9('0x42')]({},_0x3795be,_0x2132b9['options']);return db[_0xced9('0x55')]['findAll'](_0x3795be);}})[_0xced9('0x27')](function(_0x43b03d){if(_0x43b03d){return db[_0xced9('0x59')][_0xced9('0x5a')]({'where':{'id':_[_0xced9('0x36')](_0x43b03d,_0xced9('0x5b')),'role':_0xced9('0x5c')},'attributes':['id',_0xced9('0x2d'),'faxPause',_0xced9('0x5d'),'createdAt']});}})[_0xced9('0x27')](function(_0x429e72){if(_0x429e72){return{'count':_0x429e72['count'],'rows':_[_0xced9('0x36')](_0x429e72[_0xced9('0x47')],function(_0x333de1){return{'membername':_0x333de1[_0xced9('0x2d')],'UserId':_0x333de1['id'],'queue_name':_0x48dd4f['name'],'FaxQueueId':_0x48dd4f['id'],'interface':util[_0xced9('0x5e')](_0xced9('0x5f'),_0xced9('0x60'),_0x333de1[_0xced9('0x2d')]),'penalty':0x0,'paused':_0x333de1[_0xced9('0x61')],'createdAt':_0x333de1[_0xced9('0x62')],'updatedAt':_0x333de1[_0xced9('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xced9('0x27')](respondWithFilteredResult(_0x3026a4,_0x3795be))['catch'](handleError(_0x3026a4,null));};exports[_0xced9('0x63')]=function(_0x1a23fe,_0xa3bbcd,_0x2e1b43){var _0xc19be={};var _0x6c4d89={};var _0x369ad7;var _0x25ae1a;return db[_0xced9('0x30')]['findOne']({'where':{'id':_0x1a23fe[_0xced9('0x49')]['id']}})['then'](handleEntityNotFound(_0xa3bbcd,null))['then'](function(_0x49ec49){if(_0x49ec49){_0x369ad7=_0x49ec49;_0x6c4d89[_0xced9('0x35')]=_[_0xced9('0x38')](db[_0xced9('0x64')][_0xced9('0x31')]);_0x6c4d89[_0xced9('0x37')]=_['keys'](_0x1a23fe[_0xced9('0x37')]);_0x6c4d89['filters']=_[_0xced9('0x3a')](_0x6c4d89[_0xced9('0x35')],_0x6c4d89[_0xced9('0x37')]);_0xc19be[_0xced9('0x3b')]=_[_0xced9('0x3a')](_0x6c4d89[_0xced9('0x35')],qs['fields'](_0x1a23fe[_0xced9('0x37')][_0xced9('0x3c')]));_0xc19be[_0xced9('0x3b')]=_0xc19be[_0xced9('0x3b')]['length']?_0xc19be[_0xced9('0x3b')]:_0x6c4d89[_0xced9('0x35')];_0xc19be[_0xced9('0x57')]=qs['sort'](_0x1a23fe[_0xced9('0x37')][_0xced9('0x3f')]);_0xc19be[_0xced9('0x40')]=qs[_0xced9('0x39')](_['pick'](_0x1a23fe[_0xced9('0x37')],_0x6c4d89[_0xced9('0x39')]));if(_0x1a23fe['query']['filter']){_0xc19be['where']=_[_0xced9('0x42')](_0xc19be[_0xced9('0x40')],{'$or':_['map'](_0xc19be[_0xced9('0x3b')],function(_0x168fe5){var _0x220dc9={};_0x220dc9[_0x168fe5]={'$like':'%'+_0x1a23fe[_0xced9('0x37')][_0xced9('0x41')]+'%'};return _0x220dc9;})});}_0xc19be=_[_0xced9('0x42')]({},_0xc19be,_0x1a23fe[_0xced9('0x44')]);return _0x369ad7[_0xced9('0x63')](_0xc19be);}})[_0xced9('0x27')](function(_0x514d59){if(_0x514d59){_0x25ae1a=_0x514d59[_0xced9('0x3d')];if(!_0x1a23fe['query'][_0xced9('0x3e')](_0xced9('0x56'))){_0xc19be['limit']=qs[_0xced9('0x1f')](_0x1a23fe[_0xced9('0x37')][_0xced9('0x1f')]);_0xc19be[_0xced9('0x22')]=qs['offset'](_0x1a23fe['query'][_0xced9('0x22')]);}return _0x369ad7[_0xced9('0x63')](_0xc19be);}})[_0xced9('0x27')](function(_0x1a1199){if(_0x1a1199){return _0x1a1199?{'count':_0x25ae1a,'rows':_0x1a1199}:null;}})[_0xced9('0x27')](respondWithResult(_0xa3bbcd,null))[_0xced9('0x48')](handleError(_0xa3bbcd,null));};exports[_0xced9('0x65')]=function(_0x4b2303,_0x322629,_0x362fa9){var _0x2b192c=_0x4b2303[_0xced9('0x4c')][_0xced9('0x66')];return db['Team'][_0xced9('0x46')]({'where':{'id':_0x2b192c},'attributes':['id'],'include':[{'model':db[_0xced9('0x59')],'as':_0xced9('0x67'),'attributes':['id',_0xced9('0x2d'),'online',_0xced9('0x68'),_0xced9('0x69')],'raw':!![]}]})[_0xced9('0x27')](function(_0x269e0f){if(_0x269e0f){var _0xc43467=_[_0xced9('0x6a')](_0x269e0f,function(_0x2d39db){var _0x51a5c0=_0x2d39db[_0xced9('0x28')]({'plain':!![]});return _0x51a5c0[_0xced9('0x67')];});return db['FaxQueue'][_0xced9('0x51')]({'where':{'id':_0x4b2303[_0xced9('0x49')]['id']}})['then'](function(_0x5da778){return db[_0xced9('0x6b')]['transaction'](function(_0x277c2f){return _0x5da778['addTeams'](_0x2b192c,{'transaction':_0x277c2f})['then'](function(){return BPromise[_0xced9('0x6c')](_0xc43467,function(_0x132077){return db[_0xced9('0x55')][_0xced9('0x6d')]({'where':{'UserId':_0x132077['id'],'FaxQueueId':_0x4b2303[_0xced9('0x49')]['id']},'transaction':_0x277c2f});});})[_0xced9('0x27')](function(){_0xc43467['forEach'](function(_0x4016ff){socket[_0xced9('0x6e')](_0xced9('0x6f'),{'UserId':_0x4016ff['id'],'FaxQueueId':_0x5da778['id']});});});});});}})[_0xced9('0x27')](respondWithStatusCode(_0x322629,null))[_0xced9('0x48')](handleError(_0x322629,null));};exports[_0xced9('0x70')]=function(_0x3f7797,_0x1ab105,_0xdcc648){return db['Team']['findAll']({'where':{'id':_0x3f7797[_0xced9('0x37')][_0xced9('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xced9('0x67'),'attributes':['id'],'raw':!![]}]})[_0xced9('0x27')](handleEntityNotFound(_0x1ab105,null))['then'](function(_0x35d7e0){var _0x7c8d5c=_[_0xced9('0x36')](_0x35d7e0,'id');var _0x2b2a5d=[];var _0x2f5c16=[];var _0x425ead=squel['select']();_0x425ead[_0xced9('0x71')]('tq.TeamId')[_0xced9('0x72')](_0xced9('0x73'),'tq')[_0xced9('0x74')](_0xced9('0x75'),'ut',_0xced9('0x76'))[_0xced9('0x40')](_0xced9('0x77'),_0x3f7797['params']['id']);for(var _0x45d369=0x0;_0x45d369<_0x35d7e0[_0xced9('0x3d')];_0x45d369+=0x1){let _0x5475ac=_0x35d7e0[_0x45d369];for(var _0x18a1a4=0x0;_0x18a1a4<_0x5475ac[_0xced9('0x67')]['length'];_0x18a1a4+=0x1){let _0x2232d7=_0x5475ac['Agents'][_0x18a1a4];var _0x109533=_0x425ead[_0xced9('0x78')]();_0x109533[_0xced9('0x40')](_0xced9('0x79'),_0x2232d7['id']);_0x2f5c16['push'](db[_0xced9('0x6b')][_0xced9('0x37')](_0x109533[_0xced9('0x7a')](),{'type':db[_0xced9('0x6b')]['QueryTypes'][_0xced9('0x7b')]})[_0xced9('0x27')](function(_0x4cb592){if(_0x4cb592[_0xced9('0x3d')]===0x1){return _0x2232d7['id'];}else{var _0x4f4081=_[_0xced9('0x7c')](_[_0xced9('0x36')](_0x4cb592,_0xced9('0x7d')),function(_0x7f0532){return _[_0xced9('0x7e')](_0x7c8d5c,_0x7f0532);});if(_0x4f4081){return _0x2232d7['id'];}}}));}}return BPromise[_0xced9('0x7f')](_0x2f5c16)[_0xced9('0x27')](function(_0x55e6f7){_0x2b2a5d=_(_0x2b2a5d)[_0xced9('0x80')](_0x55e6f7)[_0xced9('0x81')]()[_0xced9('0x82')]();return db[_0xced9('0x30')][_0xced9('0x51')]({'where':{'id':_0x3f7797['params']['id']}})['then'](function(_0x444fd1){return db[_0xced9('0x6b')][_0xced9('0x83')](function(_0x42c604){return _0x444fd1[_0xced9('0x70')](_0x3f7797[_0xced9('0x37')]['ids'],{'transaction':_0x42c604})['then'](function(){if(!_[_0xced9('0x84')](_0x2b2a5d)){return _0x444fd1['removeAgents'](_0x2b2a5d,{'transaction':_0x42c604});}})['then'](function(){_0x2b2a5d[_0xced9('0x85')](function(_0x570868){socket[_0xced9('0x6e')]('userFaxQueue:remove',{'UserId':_0x570868,'FaxQueueId':_0x444fd1['id']});});});});});});})['then'](respondWithStatusCode(_0x1ab105,null))['catch'](handleError(_0x1ab105,null));};exports[_0xced9('0x86')]=function(_0x47b926,_0x14b4c6,_0x2308b6){return db[_0xced9('0x30')]['find']({'where':{'id':_0x47b926['params']['id']}})[_0xced9('0x27')](handleEntityNotFound(_0x14b4c6,null))['then'](function(_0x324292){if(_0x324292){return _0x324292[_0xced9('0x86')](_0x47b926[_0xced9('0x4c')]['ids'],_['omit'](_0x47b926[_0xced9('0x4c')],[_0xced9('0x66'),'id'])||{})['spread'](function(_0x584347){for(var _0x38650b=0x0;_0x38650b<_0x47b926[_0xced9('0x4c')][_0xced9('0x66')][_0xced9('0x3d')];_0x38650b+=0x1){socket[_0xced9('0x6e')](_0xced9('0x6f'),{'UserId':Number(_0x47b926['body'][_0xced9('0x66')][_0x38650b]),'FaxQueueId':Number(_0x47b926[_0xced9('0x49')]['id'])});}return _0x584347;});}})[_0xced9('0x27')](respondWithResult(_0x14b4c6,null))[_0xced9('0x48')](handleError(_0x14b4c6,null));};exports['removeAgents']=function(_0x346fb5,_0x314166,_0xe77f9f){return db[_0xced9('0x30')][_0xced9('0x51')]({'where':{'id':_0x346fb5[_0xced9('0x49')]['id']}})[_0xced9('0x27')](handleEntityNotFound(_0x314166,null))['then'](function(_0x4c9a22){if(_0x4c9a22){return _0x4c9a22[_0xced9('0x87')](_0x346fb5['query'][_0xced9('0x66')])[_0xced9('0x27')](function(){if(_['isArray'](_0x346fb5[_0xced9('0x37')]['ids'])){for(var _0x5a9163=0x0;_0x5a9163<_0x346fb5[_0xced9('0x37')][_0xced9('0x66')]['length'];_0x5a9163+=0x1){socket[_0xced9('0x6e')](_0xced9('0x88'),{'UserId':Number(_0x346fb5[_0xced9('0x37')][_0xced9('0x66')][_0x5a9163]),'FaxQueueId':Number(_0x346fb5[_0xced9('0x49')]['id'])});}}else{socket[_0xced9('0x6e')](_0xced9('0x88'),{'UserId':Number(_0x346fb5[_0xced9('0x37')][_0xced9('0x66')]),'FaxQueueId':Number(_0x346fb5[_0xced9('0x49')]['id'])});}});}})[_0xced9('0x27')](respondWithStatusCode(_0x314166,null))[_0xced9('0x48')](handleError(_0x314166,null));};exports[_0xced9('0x89')]=function(_0x4b3857,_0xb8f2d4,_0xf45787){var _0x545533={};var _0x39faca={};var _0x149cc4;var _0x4c9695;return db[_0xced9('0x30')]['findOne']({'where':{'id':_0x4b3857[_0xced9('0x49')]['id']}})[_0xced9('0x27')](handleEntityNotFound(_0xb8f2d4,null))[_0xced9('0x27')](function(_0xc60b79){if(_0xc60b79){_0x149cc4=_0xc60b79;_0x39faca[_0xced9('0x35')]=_[_0xced9('0x38')](db[_0xced9('0x59')]['rawAttributes']);_0x39faca[_0xced9('0x37')]=_[_0xced9('0x38')](_0x4b3857[_0xced9('0x37')]);_0x39faca['filters']=_[_0xced9('0x3a')](_0x39faca['model'],_0x39faca[_0xced9('0x37')]);_0x545533[_0xced9('0x3b')]=_[_0xced9('0x3a')](_0x39faca['model'],qs[_0xced9('0x3c')](_0x4b3857['query'][_0xced9('0x3c')]));_0x545533['attributes']=_0x545533['attributes'][_0xced9('0x3d')]?_0x545533[_0xced9('0x3b')]:_0x39faca[_0xced9('0x35')];_0x545533[_0xced9('0x57')]=qs[_0xced9('0x3f')](_0x4b3857[_0xced9('0x37')][_0xced9('0x3f')]);_0x545533[_0xced9('0x40')]=qs[_0xced9('0x39')](_['pick'](_0x4b3857[_0xced9('0x37')],_0x39faca[_0xced9('0x39')]));if(_0x4b3857['query'][_0xced9('0x41')]){_0x545533[_0xced9('0x40')]=_[_0xced9('0x42')](_0x545533['where'],{'$or':_[_0xced9('0x36')](_0x545533['attributes'],function(_0x14b070){var _0x41b1ed={};_0x41b1ed[_0x14b070]={'$like':'%'+_0x4b3857[_0xced9('0x37')][_0xced9('0x41')]+'%'};return _0x41b1ed;})});}_0x545533=_['merge']({},_0x545533,_0x4b3857[_0xced9('0x44')]);return _0x149cc4[_0xced9('0x89')](_0x545533);}})[_0xced9('0x27')](function(_0x35d72c){if(_0x35d72c){_0x4c9695=_0x35d72c[_0xced9('0x3d')];if(!_0x4b3857['query'][_0xced9('0x3e')](_0xced9('0x56'))){_0x545533['limit']=qs[_0xced9('0x1f')](_0x4b3857[_0xced9('0x37')][_0xced9('0x1f')]);_0x545533[_0xced9('0x22')]=qs[_0xced9('0x22')](_0x4b3857[_0xced9('0x37')][_0xced9('0x22')]);}return _0x149cc4['getAgents'](_0x545533);}})['then'](function(_0xf316c6){if(_0xf316c6){return _0xf316c6?{'count':_0x4c9695,'rows':_0xf316c6}:null;}})['then'](respondWithResult(_0xb8f2d4,null))['catch'](handleError(_0xb8f2d4,null));}; \ No newline at end of file +var _0x9b60=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','index','map','FaxQueue','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','describe','params','UserFaxQueue','FaxQueueId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','addTeams','ids','User','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1e087d,_0x224bf1){var _0x275f2f=function(_0x2541aa){while(--_0x2541aa){_0x1e087d['push'](_0x1e087d['shift']());}};_0x275f2f(++_0x224bf1);}(_0x9b60,0x104));var _0x09b6=function(_0x283c47,_0x1f612f){_0x283c47=_0x283c47-0x0;var _0x270a21=_0x9b60[_0x283c47];return _0x270a21;};'use strict';var emlformat=require(_0x09b6('0x0'));var rimraf=require(_0x09b6('0x1'));var zipdir=require(_0x09b6('0x2'));var jsonpatch=require(_0x09b6('0x3'));var rp=require('request-promise');var moment=require(_0x09b6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x09b6('0x5'));var util=require('util');var path=require(_0x09b6('0x6'));var sox=require(_0x09b6('0x7'));var csv=require(_0x09b6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09b6('0x9'));var _=require(_0x09b6('0xa'));var squel=require(_0x09b6('0xb'));var crypto=require(_0x09b6('0xc'));var jsforce=require(_0x09b6('0xd'));var deskjs=require(_0x09b6('0xe'));var toCsv=require(_0x09b6('0x8'));var querystring=require(_0x09b6('0xf'));var Papa=require(_0x09b6('0x10'));var Redis=require(_0x09b6('0x11'));var authService=require(_0x09b6('0x12'));var qs=require(_0x09b6('0x13'));var as=require(_0x09b6('0x14'));var hardwareService=require(_0x09b6('0x15'));var logger=require(_0x09b6('0x16'))('api');var utils=require(_0x09b6('0x17'));var config=require(_0x09b6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x09b6('0x19'))['db'];config['redis']=_['defaults'](config[_0x09b6('0x1a')],{'host':_0x09b6('0x1b'),'port':0x18eb});var socket=require(_0x09b6('0x1c'))(new Redis(config[_0x09b6('0x1a')]));require(_0x09b6('0x1d'))[_0x09b6('0x1e')](socket);function respondWithStatusCode(_0x77fd90,_0x178ef3){_0x178ef3=_0x178ef3||0xcc;return function(_0x4e250e){if(_0x4e250e){return _0x77fd90[_0x09b6('0x1f')](_0x178ef3);}return _0x77fd90[_0x09b6('0x20')](_0x178ef3)[_0x09b6('0x21')]();};}function respondWithResult(_0x90b401,_0x11a812){_0x11a812=_0x11a812||0xc8;return function(_0x1ad9a8){if(_0x1ad9a8){return _0x90b401[_0x09b6('0x20')](_0x11a812)[_0x09b6('0x22')](_0x1ad9a8);}};}function respondWithFilteredResult(_0x573d05,_0x22bbfc){return function(_0x57a873){if(_0x57a873){var _0x11ec0c=typeof _0x22bbfc[_0x09b6('0x23')]==='undefined'&&typeof _0x22bbfc[_0x09b6('0x24')]===_0x09b6('0x25');var _0x41a109=_0x57a873[_0x09b6('0x26')];var _0x55b98a=_0x11ec0c?0x0:_0x22bbfc[_0x09b6('0x23')];var _0x460508=_0x11ec0c?_0x57a873[_0x09b6('0x26')]:_0x22bbfc[_0x09b6('0x23')]+_0x22bbfc['limit'];var _0x19ed61;if(_0x460508>=_0x41a109){_0x460508=_0x41a109;_0x19ed61=0xc8;}else{_0x19ed61=0xce;}_0x573d05[_0x09b6('0x20')](_0x19ed61);return _0x573d05[_0x09b6('0x27')](_0x09b6('0x28'),_0x55b98a+'-'+_0x460508+'/'+_0x41a109)['json'](_0x57a873);}return null;};}function patchUpdates(_0x10520e){return function(_0x4fd132){try{jsonpatch[_0x09b6('0x29')](_0x4fd132,_0x10520e,!![]);}catch(_0x4f70cf){return BPromise[_0x09b6('0x2a')](_0x4f70cf);}return _0x4fd132[_0x09b6('0x2b')]();};}function saveUpdates(_0x12d612,_0x48c311){return function(_0x4507f1){if(_0x4507f1){return _0x4507f1[_0x09b6('0x2c')](_0x12d612)[_0x09b6('0x2d')](function(_0xb63f13){return _0xb63f13;});}return null;};}function removeEntity(_0x4f8db8,_0x55c90b){return function(_0x25078c){if(_0x25078c){return _0x25078c[_0x09b6('0x2e')]()[_0x09b6('0x2d')](function(){var _0x3bfe26=_0x25078c['get']({'plain':!![]});var _0x1fbe1d='FaxQueues';return db[_0x09b6('0x2f')][_0x09b6('0x2e')]({'where':{'type':_0x1fbe1d,'resourceId':_0x3bfe26['id']}})[_0x09b6('0x2d')](function(){return _0x25078c;});})['then'](function(){_0x4f8db8[_0x09b6('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b7ac7,_0x2bc0ff){return function(_0x244398){if(!_0x244398){_0x1b7ac7[_0x09b6('0x1f')](0x194);}return _0x244398;};}function handleError(_0x206695,_0x25b019){_0x25b019=_0x25b019||0x1f4;return function(_0x498902){logger['error'](_0x498902[_0x09b6('0x30')]);if(_0x498902[_0x09b6('0x31')]){delete _0x498902['name'];}_0x206695[_0x09b6('0x20')](_0x25b019)['send'](_0x498902);};}exports[_0x09b6('0x32')]=function(_0xe87e2d,_0x11a39e){var _0x45ce26={},_0x245595={},_0x4ee67f={'count':0x0,'rows':[]};var _0x1420ab=_[_0x09b6('0x33')](db[_0x09b6('0x34')][_0x09b6('0x35')],function(_0x2ce49f){return{'name':_0x2ce49f['fieldName'],'type':_0x2ce49f['type']['key']};});_0x245595['model']=_[_0x09b6('0x33')](_0x1420ab,_0x09b6('0x31'));_0x245595[_0x09b6('0x36')]=_[_0x09b6('0x37')](_0xe87e2d[_0x09b6('0x36')]);_0x245595[_0x09b6('0x38')]=_[_0x09b6('0x39')](_0x245595[_0x09b6('0x3a')],_0x245595[_0x09b6('0x36')]);_0x45ce26[_0x09b6('0x3b')]=_[_0x09b6('0x39')](_0x245595[_0x09b6('0x3a')],qs[_0x09b6('0x3c')](_0xe87e2d['query'][_0x09b6('0x3c')]));_0x45ce26[_0x09b6('0x3b')]=_0x45ce26[_0x09b6('0x3b')][_0x09b6('0x3d')]?_0x45ce26['attributes']:_0x245595[_0x09b6('0x3a')];if(!_0xe87e2d[_0x09b6('0x36')][_0x09b6('0x3e')](_0x09b6('0x3f'))){_0x45ce26['limit']=qs[_0x09b6('0x24')](_0xe87e2d[_0x09b6('0x36')][_0x09b6('0x24')]);_0x45ce26[_0x09b6('0x23')]=qs[_0x09b6('0x23')](_0xe87e2d[_0x09b6('0x36')][_0x09b6('0x23')]);}_0x45ce26[_0x09b6('0x40')]=qs[_0x09b6('0x41')](_0xe87e2d[_0x09b6('0x36')]['sort']);_0x45ce26['where']=qs[_0x09b6('0x38')](_[_0x09b6('0x42')](_0xe87e2d[_0x09b6('0x36')],_0x245595[_0x09b6('0x38')]),_0x1420ab);if(_0xe87e2d[_0x09b6('0x36')][_0x09b6('0x43')]){_0x45ce26[_0x09b6('0x44')]=_[_0x09b6('0x45')](_0x45ce26[_0x09b6('0x44')],{'$or':_['map'](_0x1420ab,function(_0x2c321e){if(_0x2c321e['type']!==_0x09b6('0x46')){var _0x2304f3={};_0x2304f3[_0x2c321e[_0x09b6('0x31')]]={'$like':'%'+_0xe87e2d[_0x09b6('0x36')]['filter']+'%'};return _0x2304f3;}})});}_0x45ce26=_[_0x09b6('0x45')]({},_0x45ce26,_0xe87e2d[_0x09b6('0x47')]);var _0x3c6bf9={'where':_0x45ce26[_0x09b6('0x44')]};return db[_0x09b6('0x34')][_0x09b6('0x26')](_0x3c6bf9)[_0x09b6('0x2d')](function(_0x2ea566){_0x4ee67f['count']=_0x2ea566;if(_0xe87e2d['query'][_0x09b6('0x48')]){_0x45ce26[_0x09b6('0x49')]=[{'all':!![]}];}return db[_0x09b6('0x34')][_0x09b6('0x4a')](_0x45ce26);})[_0x09b6('0x2d')](function(_0x1b2dc9){_0x4ee67f[_0x09b6('0x4b')]=_0x1b2dc9;return _0x4ee67f;})[_0x09b6('0x2d')](respondWithFilteredResult(_0x11a39e,_0x45ce26))['catch'](handleError(_0x11a39e,null));};exports[_0x09b6('0x4c')]=function(_0x445a99,_0x462999){var _0x579480={'raw':!![],'where':{'id':_0x445a99['params']['id']}},_0x191dab={};_0x191dab[_0x09b6('0x3a')]=_[_0x09b6('0x37')](db[_0x09b6('0x34')][_0x09b6('0x35')]);_0x191dab[_0x09b6('0x36')]=_['keys'](_0x445a99['query']);_0x191dab[_0x09b6('0x38')]=_[_0x09b6('0x39')](_0x191dab[_0x09b6('0x3a')],_0x191dab['query']);_0x579480[_0x09b6('0x3b')]=_[_0x09b6('0x39')](_0x191dab['model'],qs['fields'](_0x445a99[_0x09b6('0x36')][_0x09b6('0x3c')]));_0x579480[_0x09b6('0x3b')]=_0x579480[_0x09b6('0x3b')]['length']?_0x579480[_0x09b6('0x3b')]:_0x191dab['model'];if(_0x445a99['query']['includeAll']){_0x579480[_0x09b6('0x49')]=[{'all':!![]}];}_0x579480=_['merge']({},_0x579480,_0x445a99[_0x09b6('0x47')]);return db[_0x09b6('0x34')]['find'](_0x579480)[_0x09b6('0x2d')](handleEntityNotFound(_0x462999,null))[_0x09b6('0x2d')](respondWithResult(_0x462999,null))[_0x09b6('0x4d')](handleError(_0x462999,null));};exports[_0x09b6('0x4e')]=function(_0xecb29e,_0x199e37){return db[_0x09b6('0x34')][_0x09b6('0x4e')](_0xecb29e[_0x09b6('0x4f')],{})[_0x09b6('0x2d')](function(_0x467ca4){var _0x1e544e=_0xecb29e[_0x09b6('0x50')][_0x09b6('0x51')]({'plain':!![]});if(!_0x1e544e)throw new Error(_0x09b6('0x52'));if(_0x1e544e[_0x09b6('0x53')]===_0x09b6('0x50')){var _0x22ccf1=_0x467ca4[_0x09b6('0x51')]({'plain':!![]});var _0x2c1df='FaxQueues';return db[_0x09b6('0x54')][_0x09b6('0x55')]({'where':{'name':_0x2c1df,'userProfileId':_0x1e544e['userProfileId']},'raw':!![]})['then'](function(_0x3b53fb){if(_0x3b53fb&&_0x3b53fb[_0x09b6('0x56')]===0x0){return db[_0x09b6('0x2f')][_0x09b6('0x4e')]({'name':_0x22ccf1[_0x09b6('0x31')],'resourceId':_0x22ccf1['id'],'type':_0x3b53fb[_0x09b6('0x31')],'sectionId':_0x3b53fb['id']},{})[_0x09b6('0x2d')](function(){return _0x467ca4;});}else{return _0x467ca4;}})[_0x09b6('0x4d')](function(_0x450b75){logger[_0x09b6('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x450b75);throw _0x450b75;});}return _0x467ca4;})[_0x09b6('0x2d')](respondWithResult(_0x199e37,0xc9))['catch'](handleError(_0x199e37,null));};exports[_0x09b6('0x2c')]=function(_0x58cd97,_0x4bd1b0){if(_0x58cd97[_0x09b6('0x4f')]['id']){delete _0x58cd97[_0x09b6('0x4f')]['id'];}return db[_0x09b6('0x34')][_0x09b6('0x55')]({'where':{'id':_0x58cd97['params']['id']}})[_0x09b6('0x2d')](handleEntityNotFound(_0x4bd1b0,null))[_0x09b6('0x2d')](saveUpdates(_0x58cd97[_0x09b6('0x4f')],null))[_0x09b6('0x2d')](respondWithResult(_0x4bd1b0,null))[_0x09b6('0x4d')](handleError(_0x4bd1b0,null));};exports[_0x09b6('0x2e')]=function(_0x1a9400,_0x4c6568){return db[_0x09b6('0x34')][_0x09b6('0x55')]({'where':{'id':_0x1a9400['params']['id']}})[_0x09b6('0x2d')](handleEntityNotFound(_0x4c6568,null))[_0x09b6('0x2d')](removeEntity(_0x4c6568,null))[_0x09b6('0x4d')](handleError(_0x4c6568,null));};exports[_0x09b6('0x58')]=function(_0x9be98b,_0x4f7064){return db[_0x09b6('0x34')]['describe']()[_0x09b6('0x2d')](respondWithResult(_0x4f7064,null))['catch'](handleError(_0x4f7064,null));};exports['getMembers']=function(_0x207ada,_0x2e3fe9,_0x2e3464){var _0x101c06={'raw':!![],'where':{}},_0x420a17={},_0x1eaa01;return db[_0x09b6('0x34')]['findOne']({'where':{'id':_0x207ada[_0x09b6('0x59')]['id']}})[_0x09b6('0x2d')](handleEntityNotFound(_0x2e3fe9,null))[_0x09b6('0x2d')](function(_0x1c42b7){if(_0x1c42b7){_0x1eaa01=_0x1c42b7[_0x09b6('0x51')]({'plain':!![]});_0x420a17[_0x09b6('0x3a')]=_['keys'](db[_0x09b6('0x5a')][_0x09b6('0x35')]);_0x420a17[_0x09b6('0x36')]=_['keys'](_0x207ada[_0x09b6('0x36')]);_0x420a17[_0x09b6('0x38')]=_[_0x09b6('0x39')](_0x420a17[_0x09b6('0x3a')],_0x420a17[_0x09b6('0x36')]);_0x101c06[_0x09b6('0x3b')]=_[_0x09b6('0x39')](_0x420a17['model'],qs[_0x09b6('0x3c')](_0x207ada[_0x09b6('0x36')]['fields']));_0x101c06['attributes']=_0x101c06['attributes'][_0x09b6('0x3d')]?_0x101c06[_0x09b6('0x3b')]:_0x420a17['model'];if(!_0x207ada[_0x09b6('0x36')][_0x09b6('0x3e')](_0x09b6('0x3f'))){_0x101c06[_0x09b6('0x24')]=qs['limit'](_0x207ada[_0x09b6('0x36')][_0x09b6('0x24')]);_0x101c06[_0x09b6('0x23')]=qs[_0x09b6('0x23')](_0x207ada[_0x09b6('0x36')]['offset']);}_0x101c06[_0x09b6('0x40')]=qs[_0x09b6('0x41')](_0x207ada[_0x09b6('0x36')][_0x09b6('0x41')]);_0x101c06['where']=qs[_0x09b6('0x38')](_[_0x09b6('0x42')](_0x207ada['query'],_0x420a17['filters']));_0x101c06[_0x09b6('0x44')][_0x09b6('0x5b')]=_0x1c42b7['id'];if(_0x207ada['query'][_0x09b6('0x43')]){_0x101c06['where']=_[_0x09b6('0x45')](_0x101c06[_0x09b6('0x44')],{'$or':_['map'](_0x101c06[_0x09b6('0x3b')],function(_0x193f5a){var _0x105776={};_0x105776[_0x193f5a]={'$like':'%'+_0x207ada[_0x09b6('0x36')][_0x09b6('0x43')]+'%'};return _0x105776;})});}_0x101c06=_['merge']({},_0x101c06,_0x207ada[_0x09b6('0x47')]);return db['UserFaxQueue'][_0x09b6('0x4a')](_0x101c06);}})[_0x09b6('0x2d')](function(_0x3442c6){if(_0x3442c6){return db['User']['findAndCountAll']({'where':{'id':_[_0x09b6('0x33')](_0x3442c6,'UserId'),'role':_0x09b6('0x5c')},'attributes':['id',_0x09b6('0x31'),_0x09b6('0x5d'),_0x09b6('0x5e'),_0x09b6('0x5f')]});}})[_0x09b6('0x2d')](function(_0x148eb2){if(_0x148eb2){return{'count':_0x148eb2[_0x09b6('0x26')],'rows':_[_0x09b6('0x33')](_0x148eb2['rows'],function(_0x466dc8){return{'membername':_0x466dc8[_0x09b6('0x31')],'UserId':_0x466dc8['id'],'queue_name':_0x1eaa01['name'],'FaxQueueId':_0x1eaa01['id'],'interface':util['format'](_0x09b6('0x60'),_0x09b6('0x61'),_0x466dc8['name']),'penalty':0x0,'paused':_0x466dc8[_0x09b6('0x5d')],'createdAt':_0x466dc8[_0x09b6('0x5f')],'updatedAt':_0x466dc8[_0x09b6('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x09b6('0x2d')](respondWithFilteredResult(_0x2e3fe9,_0x101c06))[_0x09b6('0x4d')](handleError(_0x2e3fe9,null));};exports['getTeams']=function(_0x5d15e4,_0x381bdd,_0xa0c9b7){var _0x265a1f={};var _0x1f11c2={};var _0x3c072b;var _0x1d3a6a;return db[_0x09b6('0x34')]['findOne']({'where':{'id':_0x5d15e4[_0x09b6('0x59')]['id']}})['then'](handleEntityNotFound(_0x381bdd,null))[_0x09b6('0x2d')](function(_0x2f17e8){if(_0x2f17e8){_0x3c072b=_0x2f17e8;_0x1f11c2[_0x09b6('0x3a')]=_[_0x09b6('0x37')](db[_0x09b6('0x62')][_0x09b6('0x35')]);_0x1f11c2[_0x09b6('0x36')]=_['keys'](_0x5d15e4[_0x09b6('0x36')]);_0x1f11c2[_0x09b6('0x38')]=_[_0x09b6('0x39')](_0x1f11c2[_0x09b6('0x3a')],_0x1f11c2['query']);_0x265a1f[_0x09b6('0x3b')]=_[_0x09b6('0x39')](_0x1f11c2[_0x09b6('0x3a')],qs[_0x09b6('0x3c')](_0x5d15e4[_0x09b6('0x36')][_0x09b6('0x3c')]));_0x265a1f[_0x09b6('0x3b')]=_0x265a1f[_0x09b6('0x3b')][_0x09b6('0x3d')]?_0x265a1f['attributes']:_0x1f11c2[_0x09b6('0x3a')];_0x265a1f[_0x09b6('0x40')]=qs['sort'](_0x5d15e4['query'][_0x09b6('0x41')]);_0x265a1f[_0x09b6('0x44')]=qs['filters'](_[_0x09b6('0x42')](_0x5d15e4[_0x09b6('0x36')],_0x1f11c2[_0x09b6('0x38')]));if(_0x5d15e4[_0x09b6('0x36')][_0x09b6('0x43')]){_0x265a1f[_0x09b6('0x44')]=_[_0x09b6('0x45')](_0x265a1f[_0x09b6('0x44')],{'$or':_[_0x09b6('0x33')](_0x265a1f[_0x09b6('0x3b')],function(_0x28aef5){var _0x3f6cee={};_0x3f6cee[_0x28aef5]={'$like':'%'+_0x5d15e4[_0x09b6('0x36')][_0x09b6('0x43')]+'%'};return _0x3f6cee;})});}_0x265a1f=_[_0x09b6('0x45')]({},_0x265a1f,_0x5d15e4['options']);return _0x3c072b[_0x09b6('0x63')](_0x265a1f);}})['then'](function(_0x4cc4ab){if(_0x4cc4ab){_0x1d3a6a=_0x4cc4ab[_0x09b6('0x3d')];if(!_0x5d15e4[_0x09b6('0x36')][_0x09b6('0x3e')]('nolimit')){_0x265a1f[_0x09b6('0x24')]=qs[_0x09b6('0x24')](_0x5d15e4[_0x09b6('0x36')][_0x09b6('0x24')]);_0x265a1f[_0x09b6('0x23')]=qs[_0x09b6('0x23')](_0x5d15e4[_0x09b6('0x36')][_0x09b6('0x23')]);}return _0x3c072b[_0x09b6('0x63')](_0x265a1f);}})['then'](function(_0x2240ca){if(_0x2240ca){return _0x2240ca?{'count':_0x1d3a6a,'rows':_0x2240ca}:null;}})[_0x09b6('0x2d')](respondWithResult(_0x381bdd,null))[_0x09b6('0x4d')](handleError(_0x381bdd,null));};exports[_0x09b6('0x64')]=function(_0x598fc5,_0x20b47d,_0x2c78aa){var _0x558e8e=_0x598fc5[_0x09b6('0x4f')][_0x09b6('0x65')];return db[_0x09b6('0x62')][_0x09b6('0x4a')]({'where':{'id':_0x558e8e},'attributes':['id'],'include':[{'model':db[_0x09b6('0x66')],'as':_0x09b6('0x67'),'attributes':['id','name',_0x09b6('0x68'),'voicePause',_0x09b6('0x69')],'raw':!![]}]})[_0x09b6('0x2d')](function(_0x478098){if(_0x478098){var _0x30d0d7=_[_0x09b6('0x6a')](_0x478098,function(_0x459876){var _0x4b4f15=_0x459876['get']({'plain':!![]});return _0x4b4f15['Agents'];});return db[_0x09b6('0x34')][_0x09b6('0x55')]({'where':{'id':_0x598fc5[_0x09b6('0x59')]['id']}})['then'](function(_0x4c8712){return db['sequelize'][_0x09b6('0x6b')](function(_0x3da1db){return _0x4c8712[_0x09b6('0x64')](_0x558e8e,{'transaction':_0x3da1db})[_0x09b6('0x2d')](function(){return BPromise[_0x09b6('0x6c')](_0x30d0d7,function(_0xa90e1b){return db[_0x09b6('0x5a')][_0x09b6('0x6d')]({'where':{'UserId':_0xa90e1b['id'],'FaxQueueId':_0x598fc5[_0x09b6('0x59')]['id']},'transaction':_0x3da1db});});})[_0x09b6('0x2d')](function(){_0x30d0d7[_0x09b6('0x6e')](function(_0x12cd05){socket[_0x09b6('0x6f')](_0x09b6('0x70'),{'UserId':_0x12cd05['id'],'FaxQueueId':_0x4c8712['id']});});});});});}})[_0x09b6('0x2d')](respondWithStatusCode(_0x20b47d,null))[_0x09b6('0x4d')](handleError(_0x20b47d,null));};exports['removeTeams']=function(_0x4e11a7,_0x338762,_0x4ba738){return db[_0x09b6('0x62')]['findAll']({'where':{'id':_0x4e11a7[_0x09b6('0x36')][_0x09b6('0x65')]},'attributes':['id'],'include':[{'model':db[_0x09b6('0x66')],'as':_0x09b6('0x67'),'attributes':['id'],'raw':!![]}]})[_0x09b6('0x2d')](handleEntityNotFound(_0x338762,null))[_0x09b6('0x2d')](function(_0x470aba){var _0x4cecc7=_[_0x09b6('0x33')](_0x470aba,'id');var _0x55dd9f=[];var _0x354558=[];var _0x572ce1=squel[_0x09b6('0x71')]();_0x572ce1[_0x09b6('0x72')](_0x09b6('0x73'))['from'](_0x09b6('0x74'),'tq')[_0x09b6('0x75')](_0x09b6('0x76'),'ut',_0x09b6('0x77'))['where'](_0x09b6('0x78'),_0x4e11a7['params']['id']);for(var _0x8bfdcd=0x0;_0x8bfdcd<_0x470aba[_0x09b6('0x3d')];_0x8bfdcd+=0x1){let _0xd3da3f=_0x470aba[_0x8bfdcd];for(var _0x41ab28=0x0;_0x41ab28<_0xd3da3f[_0x09b6('0x67')][_0x09b6('0x3d')];_0x41ab28+=0x1){let _0x47efc0=_0xd3da3f[_0x09b6('0x67')][_0x41ab28];var _0x3b9a80=_0x572ce1['clone']();_0x3b9a80[_0x09b6('0x44')]('ut.UserId\x20=\x20?',_0x47efc0['id']);_0x354558['push'](db[_0x09b6('0x79')][_0x09b6('0x36')](_0x3b9a80[_0x09b6('0x7a')](),{'type':db[_0x09b6('0x79')][_0x09b6('0x7b')][_0x09b6('0x7c')]})['then'](function(_0x587630){if(_0x587630[_0x09b6('0x3d')]===0x1){return _0x47efc0['id'];}else{var _0x518284=_[_0x09b6('0x7d')](_['map'](_0x587630,_0x09b6('0x7e')),function(_0x20a220){return _[_0x09b6('0x7f')](_0x4cecc7,_0x20a220);});if(_0x518284){return _0x47efc0['id'];}}}));}}return BPromise[_0x09b6('0x80')](_0x354558)[_0x09b6('0x2d')](function(_0x5cedbf){_0x55dd9f=_(_0x55dd9f)['union'](_0x5cedbf)[_0x09b6('0x81')]()[_0x09b6('0x82')]();return db[_0x09b6('0x34')]['find']({'where':{'id':_0x4e11a7['params']['id']}})[_0x09b6('0x2d')](function(_0x4fbac8){return db[_0x09b6('0x79')][_0x09b6('0x6b')](function(_0x445517){return _0x4fbac8[_0x09b6('0x83')](_0x4e11a7['query'][_0x09b6('0x65')],{'transaction':_0x445517})[_0x09b6('0x2d')](function(){if(!_[_0x09b6('0x84')](_0x55dd9f)){return _0x4fbac8[_0x09b6('0x85')](_0x55dd9f,{'transaction':_0x445517});}})['then'](function(){_0x55dd9f[_0x09b6('0x6e')](function(_0x167141){socket[_0x09b6('0x6f')](_0x09b6('0x86'),{'UserId':_0x167141,'FaxQueueId':_0x4fbac8['id']});});});});});});})[_0x09b6('0x2d')](respondWithStatusCode(_0x338762,null))[_0x09b6('0x4d')](handleError(_0x338762,null));};exports[_0x09b6('0x87')]=function(_0x5308c1,_0x44c8dd,_0x21a80a){return db[_0x09b6('0x34')][_0x09b6('0x55')]({'where':{'id':_0x5308c1['params']['id']}})[_0x09b6('0x2d')](handleEntityNotFound(_0x44c8dd,null))[_0x09b6('0x2d')](function(_0x5ccd80){if(_0x5ccd80){return _0x5ccd80['addAgents'](_0x5308c1['body'][_0x09b6('0x65')],_[_0x09b6('0x88')](_0x5308c1[_0x09b6('0x4f')],[_0x09b6('0x65'),'id'])||{})['spread'](function(_0x4e5dac){for(var _0x52742a=0x0;_0x52742a<_0x5308c1[_0x09b6('0x4f')][_0x09b6('0x65')][_0x09b6('0x3d')];_0x52742a+=0x1){socket[_0x09b6('0x6f')](_0x09b6('0x70'),{'UserId':Number(_0x5308c1[_0x09b6('0x4f')][_0x09b6('0x65')][_0x52742a]),'FaxQueueId':Number(_0x5308c1[_0x09b6('0x59')]['id'])});}return _0x4e5dac;});}})['then'](respondWithResult(_0x44c8dd,null))[_0x09b6('0x4d')](handleError(_0x44c8dd,null));};exports['removeAgents']=function(_0x38ecd2,_0x9510cb,_0x3d61f8){return db[_0x09b6('0x34')][_0x09b6('0x55')]({'where':{'id':_0x38ecd2[_0x09b6('0x59')]['id']}})[_0x09b6('0x2d')](handleEntityNotFound(_0x9510cb,null))['then'](function(_0x5534ba){if(_0x5534ba){return _0x5534ba[_0x09b6('0x85')](_0x38ecd2['query'][_0x09b6('0x65')])[_0x09b6('0x2d')](function(){if(_['isArray'](_0x38ecd2[_0x09b6('0x36')][_0x09b6('0x65')])){for(var _0x841279=0x0;_0x841279<_0x38ecd2[_0x09b6('0x36')][_0x09b6('0x65')][_0x09b6('0x3d')];_0x841279+=0x1){socket[_0x09b6('0x6f')](_0x09b6('0x86'),{'UserId':Number(_0x38ecd2[_0x09b6('0x36')]['ids'][_0x841279]),'FaxQueueId':Number(_0x38ecd2[_0x09b6('0x59')]['id'])});}}else{socket[_0x09b6('0x6f')](_0x09b6('0x86'),{'UserId':Number(_0x38ecd2['query'][_0x09b6('0x65')]),'FaxQueueId':Number(_0x38ecd2['params']['id'])});}});}})[_0x09b6('0x2d')](respondWithStatusCode(_0x9510cb,null))['catch'](handleError(_0x9510cb,null));};exports[_0x09b6('0x89')]=function(_0x1c3c7b,_0xc9e5e0,_0x1caf5d){var _0x1a9275={};var _0x1f5e3e={};var _0x4967bc;var _0x4e16bb;return db[_0x09b6('0x34')][_0x09b6('0x8a')]({'where':{'id':_0x1c3c7b[_0x09b6('0x59')]['id']}})[_0x09b6('0x2d')](handleEntityNotFound(_0xc9e5e0,null))[_0x09b6('0x2d')](function(_0x4a2761){if(_0x4a2761){_0x4967bc=_0x4a2761;_0x1f5e3e[_0x09b6('0x3a')]=_['keys'](db[_0x09b6('0x66')][_0x09b6('0x35')]);_0x1f5e3e[_0x09b6('0x36')]=_[_0x09b6('0x37')](_0x1c3c7b[_0x09b6('0x36')]);_0x1f5e3e[_0x09b6('0x38')]=_[_0x09b6('0x39')](_0x1f5e3e[_0x09b6('0x3a')],_0x1f5e3e[_0x09b6('0x36')]);_0x1a9275[_0x09b6('0x3b')]=_[_0x09b6('0x39')](_0x1f5e3e[_0x09b6('0x3a')],qs[_0x09b6('0x3c')](_0x1c3c7b[_0x09b6('0x36')][_0x09b6('0x3c')]));_0x1a9275['attributes']=_0x1a9275[_0x09b6('0x3b')][_0x09b6('0x3d')]?_0x1a9275[_0x09b6('0x3b')]:_0x1f5e3e['model'];_0x1a9275['order']=qs[_0x09b6('0x41')](_0x1c3c7b['query'][_0x09b6('0x41')]);_0x1a9275[_0x09b6('0x44')]=qs[_0x09b6('0x38')](_[_0x09b6('0x42')](_0x1c3c7b['query'],_0x1f5e3e[_0x09b6('0x38')]));if(_0x1c3c7b[_0x09b6('0x36')][_0x09b6('0x43')]){_0x1a9275[_0x09b6('0x44')]=_['merge'](_0x1a9275[_0x09b6('0x44')],{'$or':_[_0x09b6('0x33')](_0x1a9275[_0x09b6('0x3b')],function(_0x504c05){var _0x2cfaf9={};_0x2cfaf9[_0x504c05]={'$like':'%'+_0x1c3c7b[_0x09b6('0x36')][_0x09b6('0x43')]+'%'};return _0x2cfaf9;})});}_0x1a9275=_[_0x09b6('0x45')]({},_0x1a9275,_0x1c3c7b[_0x09b6('0x47')]);return _0x4967bc[_0x09b6('0x89')](_0x1a9275);}})['then'](function(_0x5d2d17){if(_0x5d2d17){_0x4e16bb=_0x5d2d17['length'];if(!_0x1c3c7b[_0x09b6('0x36')][_0x09b6('0x3e')](_0x09b6('0x3f'))){_0x1a9275[_0x09b6('0x24')]=qs[_0x09b6('0x24')](_0x1c3c7b[_0x09b6('0x36')][_0x09b6('0x24')]);_0x1a9275[_0x09b6('0x23')]=qs[_0x09b6('0x23')](_0x1c3c7b[_0x09b6('0x36')][_0x09b6('0x23')]);}return _0x4967bc[_0x09b6('0x89')](_0x1a9275);}})[_0x09b6('0x2d')](function(_0x1d67b5){if(_0x1d67b5){return _0x1d67b5?{'count':_0x4e16bb,'rows':_0x1d67b5}:null;}})[_0x09b6('0x2d')](respondWithResult(_0xc9e5e0,null))[_0x09b6('0x4d')](handleError(_0xc9e5e0,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5606753..b8bf9c7 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 _0x65a9=['FaxQueue','remove','emit','hasOwnProperty','events'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x65a9,0x17b));var _0x965a=function(_0x4bf0f7,_0x277f34){_0x4bf0f7=_0x4bf0f7-0x0;var _0x5e7d90=_0x65a9[_0x4bf0f7];return _0x5e7d90;};'use strict';var EventEmitter=require(_0x965a('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x965a('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x965a('0x2')};function emitEvent(_0x20a87d){return function(_0x1ae61f,_0xc919cf,_0x555258){FaxQueueEvents[_0x965a('0x3')](_0x20a87d+':'+_0x1ae61f['id'],_0x1ae61f);FaxQueueEvents[_0x965a('0x3')](_0x20a87d,_0x1ae61f);_0x555258(null);};}for(var e in events){if(events[_0x965a('0x4')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xec00=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','update','remove'];(function(_0x2f478a,_0x23a91e){var _0x195ae2=function(_0x1feb34){while(--_0x1feb34){_0x2f478a['push'](_0x2f478a['shift']());}};_0x195ae2(++_0x23a91e);}(_0xec00,0x19e));var _0x0ec0=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0xec00[_0x4c260a];return _0x17bbdd;};'use strict';var EventEmitter=require(_0x0ec0('0x0'));var FaxQueue=require(_0x0ec0('0x1'))['db'][_0x0ec0('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0ec0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0ec0('0x4'),'afterDestroy':_0x0ec0('0x5')};function emitEvent(_0x426760){return function(_0x3c16d3,_0x4566ed,_0x383561){FaxQueueEvents[_0x0ec0('0x6')](_0x426760+':'+_0x3c16d3['id'],_0x3c16d3);FaxQueueEvents[_0x0ec0('0x6')](_0x426760,_0x3c16d3);_0x383561(null);};}for(var e in events){if(events[_0x0ec0('0x7')](e)){var event=events[e];FaxQueue[_0x0ec0('0x8')](e,emitEvent(event));}}module[_0x0ec0('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 59fc44d..124f3e1 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 _0xe002=['fax_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./faxQueue.attributes','define','FaxQueue'];(function(_0x591687,_0x18ae5d){var _0x20c561=function(_0xdcc75c){while(--_0xdcc75c){_0x591687['push'](_0x591687['shift']());}};_0x20c561(++_0x18ae5d);}(_0xe002,0x114));var _0x2e00=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0xe002[_0x30182f];return _0x5207db;};'use strict';var _=require(_0x2e00('0x0'));var util=require(_0x2e00('0x1'));var logger=require(_0x2e00('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2e00('0x3'));var rp=require(_0x2e00('0x4'));var fs=require('fs');var path=require(_0x2e00('0x5'));var rimraf=require(_0x2e00('0x6'));var config=require('../../config/environment');var attributes=require(_0x2e00('0x7'));module['exports']=function(_0x491c3c,_0x1d8d2a){return _0x491c3c[_0x2e00('0x8')](_0x2e00('0x9'),attributes,{'tableName':_0x2e00('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67fb=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0x67fb,0x1df));var _0xb67f=function(_0x3a3f23,_0x1ab20b){_0x3a3f23=_0x3a3f23-0x0;var _0x8b67ff=_0x67fb[_0x3a3f23];return _0x8b67ff;};'use strict';var _=require(_0xb67f('0x0'));var util=require('util');var logger=require(_0xb67f('0x1'))(_0xb67f('0x2'));var moment=require('moment');var BPromise=require(_0xb67f('0x3'));var rp=require(_0xb67f('0x4'));var fs=require('fs');var path=require(_0xb67f('0x5'));var rimraf=require('rimraf');var config=require(_0xb67f('0x6'));var attributes=require(_0xb67f('0x7'));module[_0xb67f('0x8')]=function(_0x44c9cc,_0x1f3c43){return _0x44c9cc[_0xb67f('0x9')](_0xb67f('0xa'),attributes,{'tableName':_0xb67f('0xb'),'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 3460f28..b962388 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 _0x5e90=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','localhost','redis','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetFaxQueue','options','raw','where','limit','include','map','model','attributes','catch','ShowFaxQueue','find'];(function(_0x19bd82,_0x2cc0cc){var _0x602143=function(_0x107978){while(--_0x107978){_0x19bd82['push'](_0x19bd82['shift']());}};_0x602143(++_0x2cc0cc);}(_0x5e90,0x6f));var _0x05e9=function(_0xd0d9fe,_0x53118f){_0xd0d9fe=_0xd0d9fe-0x0;var _0x309a56=_0x5e90[_0xd0d9fe];return _0x309a56;};'use strict';var _=require(_0x05e9('0x0'));var util=require(_0x05e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05e9('0x2'));var db=require(_0x05e9('0x3'))['db'];var utils=require(_0x05e9('0x4'));var logger=require(_0x05e9('0x5'))(_0x05e9('0x6'));var config=require('../../config/environment');var jayson=require(_0x05e9('0x7'));var client=jayson[_0x05e9('0x8')][_0x05e9('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x05e9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05e9('0xb')]));require(_0x05e9('0xc'))[_0x05e9('0xd')](socket);function respondWithRpcPromise(_0x3cd452,_0x39e065,_0x461695){return new BPromise(function(_0x5db079,_0x30f75b){return client[_0x05e9('0xe')](_0x3cd452,_0x461695)[_0x05e9('0xf')](function(_0xe54396){logger[_0x05e9('0x10')](_0x05e9('0x11'),_0x39e065,'request\x20sent');logger[_0x05e9('0x12')](_0x05e9('0x13'),_0x39e065,_0x05e9('0x14'),JSON[_0x05e9('0x15')](_0xe54396));if(_0xe54396[_0x05e9('0x16')]){if(_0xe54396['error'][_0x05e9('0x17')]===0x1f4){logger[_0x05e9('0x16')](_0x05e9('0x11'),_0x39e065,_0xe54396['error'][_0x05e9('0x18')]);return _0x30f75b(_0xe54396['error'][_0x05e9('0x18')]);}logger[_0x05e9('0x16')]('FaxQueue,\x20%s,\x20%s',_0x39e065,_0xe54396[_0x05e9('0x16')][_0x05e9('0x18')]);return _0x5db079(_0xe54396[_0x05e9('0x16')][_0x05e9('0x18')]);}else{logger[_0x05e9('0x10')](_0x05e9('0x11'),_0x39e065,'request\x20sent');_0x5db079(_0xe54396['result'][_0x05e9('0x18')]);}})['catch'](function(_0x28e215){logger['error']('FaxQueue,\x20%s,\x20%s',_0x39e065,_0x28e215);_0x30f75b(_0x28e215);});});}exports[_0x05e9('0x19')]=function(_0x4e8966){var _0x275dd8=this;return new Promise(function(_0x1c06fd,_0x2e911b){return db['FaxQueue']['findAll']({'raw':_0x4e8966[_0x05e9('0x1a')]?_0x4e8966[_0x05e9('0x1a')][_0x05e9('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e8966[_0x05e9('0x1a')]?_0x4e8966[_0x05e9('0x1a')][_0x05e9('0x1c')]||null:null,'attributes':_0x4e8966[_0x05e9('0x1a')]?_0x4e8966[_0x05e9('0x1a')]['attributes']||null:null,'limit':_0x4e8966['options']?_0x4e8966[_0x05e9('0x1a')][_0x05e9('0x1d')]||null:null,'include':_0x4e8966[_0x05e9('0x1a')]?_0x4e8966['options'][_0x05e9('0x1e')]?_[_0x05e9('0x1f')](_0x4e8966['options'][_0x05e9('0x1e')],function(_0x37288f){return{'model':db[_0x37288f[_0x05e9('0x20')]],'as':_0x37288f['as'],'attributes':_0x37288f[_0x05e9('0x21')],'include':_0x37288f[_0x05e9('0x1e')]?_[_0x05e9('0x1f')](_0x37288f[_0x05e9('0x1e')],function(_0x35b3d2){return{'model':db[_0x35b3d2[_0x05e9('0x20')]],'as':_0x35b3d2['as'],'attributes':_0x35b3d2[_0x05e9('0x21')],'include':_0x35b3d2[_0x05e9('0x1e')]?_[_0x05e9('0x1f')](_0x35b3d2['include'],function(_0x17a112){return{'model':db[_0x17a112[_0x05e9('0x20')]],'as':_0x17a112['as'],'attributes':_0x17a112[_0x05e9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x05e9('0xf')](function(_0x1028e3){logger[_0x05e9('0x10')](_0x05e9('0x19'),_0x4e8966);logger[_0x05e9('0x12')](_0x05e9('0x19'),_0x4e8966,JSON[_0x05e9('0x15')](_0x1028e3));_0x1c06fd(_0x1028e3);})[_0x05e9('0x22')](function(_0x46ef22){logger[_0x05e9('0x16')](_0x05e9('0x19'),_0x46ef22['message'],_0x4e8966);_0x2e911b(_0x275dd8[_0x05e9('0x16')](0x1f4,_0x46ef22[_0x05e9('0x18')]));});});};exports[_0x05e9('0x23')]=function(_0x20e65e){var _0x11d60a=this;return new Promise(function(_0x402abd,_0x49c7ab){return db['FaxQueue'][_0x05e9('0x24')]({'raw':_0x20e65e[_0x05e9('0x1a')]?_0x20e65e['options'][_0x05e9('0x1b')]===undefined?!![]:![]:!![],'where':_0x20e65e[_0x05e9('0x1a')]?_0x20e65e[_0x05e9('0x1a')]['where']||null:null,'attributes':_0x20e65e['options']?_0x20e65e[_0x05e9('0x1a')][_0x05e9('0x21')]||null:null,'include':_0x20e65e[_0x05e9('0x1a')]?_0x20e65e[_0x05e9('0x1a')][_0x05e9('0x1e')]?_[_0x05e9('0x1f')](_0x20e65e['options'][_0x05e9('0x1e')],function(_0x4df7c0){return{'model':db[_0x4df7c0[_0x05e9('0x20')]],'as':_0x4df7c0['as'],'attributes':_0x4df7c0['attributes'],'include':_0x4df7c0[_0x05e9('0x1e')]?_['map'](_0x4df7c0[_0x05e9('0x1e')],function(_0x52ec7d){return{'model':db[_0x52ec7d['model']],'as':_0x52ec7d['as'],'attributes':_0x52ec7d[_0x05e9('0x21')],'include':_0x52ec7d[_0x05e9('0x1e')]?_[_0x05e9('0x1f')](_0x52ec7d[_0x05e9('0x1e')],function(_0x2c2e65){return{'model':db[_0x2c2e65['model']],'as':_0x2c2e65['as'],'attributes':_0x2c2e65[_0x05e9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x05e9('0xf')](function(_0x15cc1d){logger[_0x05e9('0x10')](_0x05e9('0x23'),_0x20e65e);logger[_0x05e9('0x12')](_0x05e9('0x23'),_0x20e65e,JSON['stringify'](_0x15cc1d));_0x402abd(_0x15cc1d);})['catch'](function(_0x1753f8){logger[_0x05e9('0x16')]('ShowFaxQueue',_0x1753f8[_0x05e9('0x18')],_0x20e65e);_0x49c7ab(_0x11d60a[_0x05e9('0x16')](0x1f4,_0x1753f8[_0x05e9('0x18')]));});});}; \ No newline at end of file +var _0xc0e5=['redis','localhost','socket.io-emitter','register','request','then','request\x20sent','error','code','FaxQueue,\x20%s,\x20%s','message','info','result','catch','findAll','options','raw','where','limit','include','map','model','attributes','GetFaxQueue','debug','stringify','ShowFaxQueue','FaxQueue','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0e5,0x95));var _0x5c0e=function(_0x20d6f0,_0x33e54c){_0x20d6f0=_0x20d6f0-0x0;var _0x105ceb=_0xc0e5[_0x20d6f0];return _0x105ceb;};'use strict';var _=require('lodash');var util=require(_0x5c0e('0x0'));var moment=require(_0x5c0e('0x1'));var BPromise=require('bluebird');var rs=require(_0x5c0e('0x2'));var fs=require('fs');var Redis=require(_0x5c0e('0x3'));var db=require(_0x5c0e('0x4'))['db'];var utils=require(_0x5c0e('0x5'));var logger=require(_0x5c0e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5c0e('0x7'));var client=jayson[_0x5c0e('0x8')][_0x5c0e('0x9')]({'port':0x232a});config['redis']=_[_0x5c0e('0xa')](config[_0x5c0e('0xb')],{'host':_0x5c0e('0xc'),'port':0x18eb});var socket=require(_0x5c0e('0xd'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x5c0e('0xe')](socket);function respondWithRpcPromise(_0x12131b,_0x4dd47f,_0x3b68f3){return new BPromise(function(_0x30184a,_0x29a55f){return client[_0x5c0e('0xf')](_0x12131b,_0x3b68f3)[_0x5c0e('0x10')](function(_0x3ed78d){logger['info']('FaxQueue,\x20%s,\x20%s',_0x4dd47f,_0x5c0e('0x11'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x4dd47f,_0x5c0e('0x11'),JSON['stringify'](_0x3ed78d));if(_0x3ed78d['error']){if(_0x3ed78d[_0x5c0e('0x12')][_0x5c0e('0x13')]===0x1f4){logger[_0x5c0e('0x12')](_0x5c0e('0x14'),_0x4dd47f,_0x3ed78d[_0x5c0e('0x12')][_0x5c0e('0x15')]);return _0x29a55f(_0x3ed78d[_0x5c0e('0x12')][_0x5c0e('0x15')]);}logger[_0x5c0e('0x12')]('FaxQueue,\x20%s,\x20%s',_0x4dd47f,_0x3ed78d[_0x5c0e('0x12')][_0x5c0e('0x15')]);return _0x30184a(_0x3ed78d[_0x5c0e('0x12')][_0x5c0e('0x15')]);}else{logger[_0x5c0e('0x16')](_0x5c0e('0x14'),_0x4dd47f,_0x5c0e('0x11'));_0x30184a(_0x3ed78d[_0x5c0e('0x17')]['message']);}})[_0x5c0e('0x18')](function(_0x45ca15){logger[_0x5c0e('0x12')](_0x5c0e('0x14'),_0x4dd47f,_0x45ca15);_0x29a55f(_0x45ca15);});});}exports['GetFaxQueue']=function(_0x344409){var _0x269623=this;return new Promise(function(_0x118b35,_0x3ca6fa){return db['FaxQueue'][_0x5c0e('0x19')]({'raw':_0x344409[_0x5c0e('0x1a')]?_0x344409[_0x5c0e('0x1a')][_0x5c0e('0x1b')]===undefined?!![]:![]:!![],'where':_0x344409[_0x5c0e('0x1a')]?_0x344409[_0x5c0e('0x1a')][_0x5c0e('0x1c')]||null:null,'attributes':_0x344409['options']?_0x344409[_0x5c0e('0x1a')]['attributes']||null:null,'limit':_0x344409['options']?_0x344409[_0x5c0e('0x1a')][_0x5c0e('0x1d')]||null:null,'include':_0x344409[_0x5c0e('0x1a')]?_0x344409[_0x5c0e('0x1a')][_0x5c0e('0x1e')]?_[_0x5c0e('0x1f')](_0x344409[_0x5c0e('0x1a')]['include'],function(_0x2428ad){return{'model':db[_0x2428ad[_0x5c0e('0x20')]],'as':_0x2428ad['as'],'attributes':_0x2428ad[_0x5c0e('0x21')],'include':_0x2428ad[_0x5c0e('0x1e')]?_['map'](_0x2428ad['include'],function(_0x1f9c7c){return{'model':db[_0x1f9c7c[_0x5c0e('0x20')]],'as':_0x1f9c7c['as'],'attributes':_0x1f9c7c[_0x5c0e('0x21')],'include':_0x1f9c7c[_0x5c0e('0x1e')]?_['map'](_0x1f9c7c['include'],function(_0x326742){return{'model':db[_0x326742['model']],'as':_0x326742['as'],'attributes':_0x326742[_0x5c0e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5c0e('0x10')](function(_0x32ef17){logger[_0x5c0e('0x16')](_0x5c0e('0x22'),_0x344409);logger[_0x5c0e('0x23')](_0x5c0e('0x22'),_0x344409,JSON[_0x5c0e('0x24')](_0x32ef17));_0x118b35(_0x32ef17);})[_0x5c0e('0x18')](function(_0x587a5b){logger[_0x5c0e('0x12')]('GetFaxQueue',_0x587a5b['message'],_0x344409);_0x3ca6fa(_0x269623[_0x5c0e('0x12')](0x1f4,_0x587a5b['message']));});});};exports[_0x5c0e('0x25')]=function(_0xacb67f){var _0x5e3ade=this;return new Promise(function(_0x2e8010,_0x5d7f84){return db[_0x5c0e('0x26')][_0x5c0e('0x27')]({'raw':_0xacb67f[_0x5c0e('0x1a')]?_0xacb67f[_0x5c0e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xacb67f['options']?_0xacb67f['options']['where']||null:null,'attributes':_0xacb67f[_0x5c0e('0x1a')]?_0xacb67f[_0x5c0e('0x1a')][_0x5c0e('0x21')]||null:null,'include':_0xacb67f[_0x5c0e('0x1a')]?_0xacb67f[_0x5c0e('0x1a')][_0x5c0e('0x1e')]?_['map'](_0xacb67f[_0x5c0e('0x1a')][_0x5c0e('0x1e')],function(_0x5e258a){return{'model':db[_0x5e258a[_0x5c0e('0x20')]],'as':_0x5e258a['as'],'attributes':_0x5e258a[_0x5c0e('0x21')],'include':_0x5e258a[_0x5c0e('0x1e')]?_['map'](_0x5e258a['include'],function(_0x85db30){return{'model':db[_0x85db30[_0x5c0e('0x20')]],'as':_0x85db30['as'],'attributes':_0x85db30['attributes'],'include':_0x85db30['include']?_[_0x5c0e('0x1f')](_0x85db30[_0x5c0e('0x1e')],function(_0x42c9b6){return{'model':db[_0x42c9b6[_0x5c0e('0x20')]],'as':_0x42c9b6['as'],'attributes':_0x42c9b6[_0x5c0e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5c0e('0x10')](function(_0x7f54d1){logger[_0x5c0e('0x16')]('ShowFaxQueue',_0xacb67f);logger[_0x5c0e('0x23')](_0x5c0e('0x25'),_0xacb67f,JSON['stringify'](_0x7f54d1));_0x2e8010(_0x7f54d1);})['catch'](function(_0x1d3758){logger[_0x5c0e('0x12')](_0x5c0e('0x25'),_0x1d3758[_0x5c0e('0x15')],_0xacb67f);_0x5d7f84(_0x5e3ade['error'](0x1f4,_0x1d3758['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 6fc9e0b..3d30d4f 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 _0xdf36=['register','length','faxQueue:','./faxQueue.events','save','emit'];(function(_0x1cc668,_0x5bfe73){var _0x464b4b=function(_0x1c74af){while(--_0x1c74af){_0x1cc668['push'](_0x1cc668['shift']());}};_0x464b4b(++_0x5bfe73);}(_0xdf36,0x1d1));var _0x6df3=function(_0x25dde7,_0x4f8aad){_0x25dde7=_0x25dde7-0x0;var _0x14017d=_0xdf36[_0x25dde7];return _0x14017d;};'use strict';var FaxQueueEvents=require(_0x6df3('0x0'));var events=[_0x6df3('0x1'),'remove','update'];function createListener(_0x1f6dcf,_0x2fc92a){return function(_0x49fc07){_0x2fc92a[_0x6df3('0x2')](_0x1f6dcf,_0x49fc07);};}function removeListener(_0x544cc6,_0xb5772d){return function(){FaxQueueEvents['removeListener'](_0x544cc6,_0xb5772d);};}exports[_0x6df3('0x3')]=function(_0x2e42da){for(var _0x85438=0x0,_0x465f99=events[_0x6df3('0x4')];_0x85438<_0x465f99;_0x85438++){var _0x1c391f=events[_0x85438];var _0x469daf=createListener(_0x6df3('0x5')+_0x1c391f,_0x2e42da);FaxQueueEvents['on'](_0x1c391f,_0x469daf);}}; \ No newline at end of file +var _0x21e9=['faxQueue:','save','removeListener','register','length'];(function(_0x4606c7,_0x1b12f9){var _0x348014=function(_0x2443e9){while(--_0x2443e9){_0x4606c7['push'](_0x4606c7['shift']());}};_0x348014(++_0x1b12f9);}(_0x21e9,0x164));var _0x921e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x21e9[_0x1facfa];return _0x9ec701;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x921e('0x0'),'remove','update'];function createListener(_0x238b5d,_0x3aaf52){return function(_0x2da1ff){_0x3aaf52['emit'](_0x238b5d,_0x2da1ff);};}function removeListener(_0x3738e8,_0x1626cb){return function(){FaxQueueEvents[_0x921e('0x1')](_0x3738e8,_0x1626cb);};}exports[_0x921e('0x2')]=function(_0x2b56a6){for(var _0x364155=0x0,_0x204b1e=events[_0x921e('0x3')];_0x364155<_0x204b1e;_0x364155++){var _0x2761e7=events[_0x364155];var _0x26f529=createListener(_0x921e('0x4')+_0x2761e7,_0x2b56a6);FaxQueueEvents['on'](_0x2761e7,_0x26f529);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6b23422..0fbd365 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 _0x6d38=['../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','/:id','/:id/members','/:id/teams','getAgents','post','create','/:id/users','addAgents','put','update','destroy','delete','removeTeams','removeAgents','util','path','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x6d38[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['get'](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller['getMembers']);router['get'](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['getTeams']);router[_0x86d3('0x9')]('/:id/users',auth[_0x86d3('0x7')](),controller[_0x86d3('0xe')]);router[_0x86d3('0xf')]('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x10')]);router[_0x86d3('0xf')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['addTeams']);router[_0x86d3('0xf')](_0x86d3('0x11'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x12')]);router[_0x86d3('0x13')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x14')]);router['delete'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x15')]);router[_0x86d3('0x16')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x17')]);router[_0x86d3('0x16')](_0x86d3('0x11'),auth['isAuthenticated'](),controller[_0x86d3('0x18')]);module['exports']=router; \ No newline at end of file +var _0x5d0a=['fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','create','post','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','Router'];(function(_0x32ee04,_0x1b0d32){var _0x1ddece=function(_0x58ebef){while(--_0x58ebef){_0x32ee04['push'](_0x32ee04['shift']());}};_0x1ddece(++_0x1b0d32);}(_0x5d0a,0x175));var _0xa5d0=function(_0x107b01,_0x5c0923){_0x107b01=_0x107b01-0x0;var _0x23f38b=_0x5d0a[_0x107b01];return _0x23f38b;};'use strict';var multer=require(_0xa5d0('0x0'));var util=require('util');var path=require(_0xa5d0('0x1'));var timeout=require('connect-timeout');var express=require(_0xa5d0('0x2'));var router=express[_0xa5d0('0x3')]();var fs_extra=require(_0xa5d0('0x4'));var auth=require(_0xa5d0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa5d0('0x6'));var controller=require(_0xa5d0('0x7'));router[_0xa5d0('0x8')]('/',auth[_0xa5d0('0x9')](),controller[_0xa5d0('0xa')]);router[_0xa5d0('0x8')](_0xa5d0('0xb'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0xc')]);router[_0xa5d0('0x8')](_0xa5d0('0xd'),auth['isAuthenticated'](),controller[_0xa5d0('0xe')]);router[_0xa5d0('0x8')](_0xa5d0('0xf'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x10')]);router[_0xa5d0('0x8')](_0xa5d0('0x11'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x12')]);router[_0xa5d0('0x8')]('/:id/users',auth[_0xa5d0('0x9')](),controller['getAgents']);router['post']('/',auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x13')]);router[_0xa5d0('0x14')](_0xa5d0('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0xa5d0('0x14')](_0xa5d0('0x15'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x16')]);router[_0xa5d0('0x17')](_0xa5d0('0xd'),auth[_0xa5d0('0x9')](),controller['update']);router[_0xa5d0('0x18')]('/:id',auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x19')]);router['delete']('/:id/teams',auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x1a')]);router['delete'](_0xa5d0('0x15'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x1b')]);module[_0xa5d0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 4fc2450..74761ee 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 _0x62c7=['STRING','DATE','sequelize'];(function(_0x48255f,_0x3b60ab){var _0x56f294=function(_0x54af0f){while(--_0x54af0f){_0x48255f['push'](_0x48255f['shift']());}};_0x56f294(++_0x3b60ab);}(_0x62c7,0x107));var _0x762c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x62c7[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require('moment');var Sequelize=require(_0x762c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x762c('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x762c('0x1')]},'joinAt':{'type':Sequelize[_0x762c('0x2')]},'leaveAt':{'type':Sequelize[_0x762c('0x2')]},'acceptAt':{'type':Sequelize[_0x762c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1561=['sequelize','STRING','DATE','moment'];(function(_0x26cf77,_0x183d5c){var _0x58b93f=function(_0x2161bf){while(--_0x2161bf){_0x26cf77['push'](_0x26cf77['shift']());}};_0x58b93f(++_0x183d5c);}(_0x1561,0x1b7));var _0x1156=function(_0x41b655,_0x3cd993){_0x41b655=_0x41b655-0x0;var _0x4f3906=_0x1561[_0x41b655];return _0x4f3906;};'use strict';var moment=require(_0x1156('0x0'));var Sequelize=require(_0x1156('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1156('0x2')]},'joinAt':{'type':Sequelize[_0x1156('0x3')]},'leaveAt':{'type':Sequelize[_0x1156('0x3')]},'acceptAt':{'type':Sequelize[_0x1156('0x3')]},'exitAt':{'type':Sequelize[_0x1156('0x3')]},'reason':{'type':Sequelize[_0x1156('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b740a8f..a9214c6 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 _0x1c4d=['body','update','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','save','then','destroy','end','error','stack','name','send','map','FaxQueueReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create'];(function(_0x2b5da1,_0x301fbf){var _0x2d20c4=function(_0x587753){while(--_0x587753){_0x2b5da1['push'](_0x2b5da1['shift']());}};_0x2d20c4(++_0x301fbf);}(_0x1c4d,0x1d7));var _0xd1c4=function(_0x3a8f25,_0x27a46b){_0x3a8f25=_0x3a8f25-0x0;var _0x495234=_0x1c4d[_0x3a8f25];return _0x495234;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd1c4('0x0'));var zipdir=require(_0xd1c4('0x1'));var jsonpatch=require(_0xd1c4('0x2'));var rp=require('request-promise');var moment=require(_0xd1c4('0x3'));var BPromise=require(_0xd1c4('0x4'));var Mustache=require(_0xd1c4('0x5'));var util=require(_0xd1c4('0x6'));var path=require('path');var sox=require(_0xd1c4('0x7'));var csv=require('to-csv');var ejs=require(_0xd1c4('0x8'));var fs=require('fs');var fs_extra=require(_0xd1c4('0x9'));var _=require(_0xd1c4('0xa'));var squel=require(_0xd1c4('0xb'));var crypto=require(_0xd1c4('0xc'));var jsforce=require(_0xd1c4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd1c4('0xe'));var querystring=require(_0xd1c4('0xf'));var Papa=require('papaparse');var Redis=require(_0xd1c4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd1c4('0x11'));var as=require(_0xd1c4('0x12'));var hardwareService=require(_0xd1c4('0x13'));var logger=require(_0xd1c4('0x14'))(_0xd1c4('0x15'));var utils=require(_0xd1c4('0x16'));var config=require(_0xd1c4('0x17'));var licenseUtil=require(_0xd1c4('0x18'));var db=require(_0xd1c4('0x19'))['db'];function respondWithStatusCode(_0x350a49,_0x337fb8){_0x337fb8=_0x337fb8||0xcc;return function(_0x4f5d13){if(_0x4f5d13){return _0x350a49[_0xd1c4('0x1a')](_0x337fb8);}return _0x350a49[_0xd1c4('0x1b')](_0x337fb8)['end']();};}function respondWithResult(_0x57520b,_0x3dd0cf){_0x3dd0cf=_0x3dd0cf||0xc8;return function(_0x5bec0f){if(_0x5bec0f){return _0x57520b[_0xd1c4('0x1b')](_0x3dd0cf)['json'](_0x5bec0f);}};}function respondWithFilteredResult(_0x4e0840,_0x40ac72){return function(_0x5aed19){if(_0x5aed19){var _0x3f309f=typeof _0x40ac72[_0xd1c4('0x1c')]===_0xd1c4('0x1d')&&typeof _0x40ac72['limit']===_0xd1c4('0x1d');var _0x3cc7d3=_0x5aed19[_0xd1c4('0x1e')];var _0x41c496=_0x3f309f?0x0:_0x40ac72[_0xd1c4('0x1c')];var _0x39e0bb=_0x3f309f?_0x5aed19['count']:_0x40ac72[_0xd1c4('0x1c')]+_0x40ac72[_0xd1c4('0x1f')];var _0x4289f0;if(_0x39e0bb>=_0x3cc7d3){_0x39e0bb=_0x3cc7d3;_0x4289f0=0xc8;}else{_0x4289f0=0xce;}_0x4e0840[_0xd1c4('0x1b')](_0x4289f0);return _0x4e0840['set'](_0xd1c4('0x20'),_0x41c496+'-'+_0x39e0bb+'/'+_0x3cc7d3)[_0xd1c4('0x21')](_0x5aed19);}return null;};}function patchUpdates(_0x2dbdbb){return function(_0x57de1d){try{jsonpatch[_0xd1c4('0x22')](_0x57de1d,_0x2dbdbb,!![]);}catch(_0x28ef14){return BPromise['reject'](_0x28ef14);}return _0x57de1d[_0xd1c4('0x23')]();};}function saveUpdates(_0x3fddef,_0x49f1db){return function(_0x2a4498){if(_0x2a4498){return _0x2a4498['update'](_0x3fddef)[_0xd1c4('0x24')](function(_0x5df0f2){return _0x5df0f2;});}return null;};}function removeEntity(_0x469798,_0x5d24e7){return function(_0x291e66){if(_0x291e66){return _0x291e66[_0xd1c4('0x25')]()[_0xd1c4('0x24')](function(){_0x469798[_0xd1c4('0x1b')](0xcc)[_0xd1c4('0x26')]();});}};}function handleEntityNotFound(_0x23f9af,_0x706f8c){return function(_0x278562){if(!_0x278562){_0x23f9af[_0xd1c4('0x1a')](0x194);}return _0x278562;};}function handleError(_0x541990,_0x3db26f){_0x3db26f=_0x3db26f||0x1f4;return function(_0x2cdf75){logger[_0xd1c4('0x27')](_0x2cdf75[_0xd1c4('0x28')]);if(_0x2cdf75[_0xd1c4('0x29')]){delete _0x2cdf75[_0xd1c4('0x29')];}_0x541990['status'](_0x3db26f)[_0xd1c4('0x2a')](_0x2cdf75);};}exports['index']=function(_0x349c92,_0x3b9fd4){var _0x3aa8ea={},_0x3ef290={},_0xc72fe4={'count':0x0,'rows':[]};var _0x48748b=_[_0xd1c4('0x2b')](db[_0xd1c4('0x2c')]['rawAttributes'],function(_0x18367e){return{'name':_0x18367e[_0xd1c4('0x2d')],'type':_0x18367e[_0xd1c4('0x2e')][_0xd1c4('0x2f')]};});_0x3ef290['model']=_[_0xd1c4('0x2b')](_0x48748b,'name');_0x3ef290[_0xd1c4('0x30')]=_[_0xd1c4('0x31')](_0x349c92[_0xd1c4('0x30')]);_0x3ef290[_0xd1c4('0x32')]=_[_0xd1c4('0x33')](_0x3ef290['model'],_0x3ef290['query']);_0x3aa8ea[_0xd1c4('0x34')]=_[_0xd1c4('0x33')](_0x3ef290[_0xd1c4('0x35')],qs[_0xd1c4('0x36')](_0x349c92['query'][_0xd1c4('0x36')]));_0x3aa8ea[_0xd1c4('0x34')]=_0x3aa8ea[_0xd1c4('0x34')][_0xd1c4('0x37')]?_0x3aa8ea[_0xd1c4('0x34')]:_0x3ef290[_0xd1c4('0x35')];if(!_0x349c92['query'][_0xd1c4('0x38')](_0xd1c4('0x39'))){_0x3aa8ea[_0xd1c4('0x1f')]=qs['limit'](_0x349c92[_0xd1c4('0x30')][_0xd1c4('0x1f')]);_0x3aa8ea[_0xd1c4('0x1c')]=qs[_0xd1c4('0x1c')](_0x349c92[_0xd1c4('0x30')][_0xd1c4('0x1c')]);}_0x3aa8ea[_0xd1c4('0x3a')]=qs[_0xd1c4('0x3b')](_0x349c92['query'][_0xd1c4('0x3b')]);_0x3aa8ea['where']=qs[_0xd1c4('0x32')](_[_0xd1c4('0x3c')](_0x349c92['query'],_0x3ef290[_0xd1c4('0x32')]),_0x48748b);if(_0x349c92[_0xd1c4('0x30')][_0xd1c4('0x3d')]){_0x3aa8ea['where']=_[_0xd1c4('0x3e')](_0x3aa8ea['where'],{'$or':_[_0xd1c4('0x2b')](_0x48748b,function(_0x39781c){if(_0x39781c[_0xd1c4('0x2e')]!==_0xd1c4('0x3f')){var _0x4eaf1a={};_0x4eaf1a[_0x39781c['name']]={'$like':'%'+_0x349c92[_0xd1c4('0x30')]['filter']+'%'};return _0x4eaf1a;}})});}_0x3aa8ea=_[_0xd1c4('0x3e')]({},_0x3aa8ea,_0x349c92[_0xd1c4('0x40')]);var _0x356881={'where':_0x3aa8ea['where']};return db[_0xd1c4('0x2c')][_0xd1c4('0x1e')](_0x356881)['then'](function(_0x2ab872){_0xc72fe4[_0xd1c4('0x1e')]=_0x2ab872;if(_0x349c92['query'][_0xd1c4('0x41')]){_0x3aa8ea[_0xd1c4('0x42')]=[{'all':!![]}];}return db[_0xd1c4('0x2c')][_0xd1c4('0x43')](_0x3aa8ea);})[_0xd1c4('0x24')](function(_0x216690){_0xc72fe4[_0xd1c4('0x44')]=_0x216690;return _0xc72fe4;})[_0xd1c4('0x24')](respondWithFilteredResult(_0x3b9fd4,_0x3aa8ea))[_0xd1c4('0x45')](handleError(_0x3b9fd4,null));};exports[_0xd1c4('0x46')]=function(_0x5a374d,_0x14cabb){var _0x4112a3={'raw':!![],'where':{'id':_0x5a374d[_0xd1c4('0x47')]['id']}},_0x12df99={};_0x12df99[_0xd1c4('0x35')]=_[_0xd1c4('0x31')](db['FaxQueueReport'][_0xd1c4('0x48')]);_0x12df99[_0xd1c4('0x30')]=_[_0xd1c4('0x31')](_0x5a374d['query']);_0x12df99['filters']=_[_0xd1c4('0x33')](_0x12df99[_0xd1c4('0x35')],_0x12df99[_0xd1c4('0x30')]);_0x4112a3[_0xd1c4('0x34')]=_[_0xd1c4('0x33')](_0x12df99[_0xd1c4('0x35')],qs[_0xd1c4('0x36')](_0x5a374d['query'][_0xd1c4('0x36')]));_0x4112a3[_0xd1c4('0x34')]=_0x4112a3['attributes'][_0xd1c4('0x37')]?_0x4112a3[_0xd1c4('0x34')]:_0x12df99[_0xd1c4('0x35')];if(_0x5a374d[_0xd1c4('0x30')][_0xd1c4('0x41')]){_0x4112a3[_0xd1c4('0x42')]=[{'all':!![]}];}_0x4112a3=_[_0xd1c4('0x3e')]({},_0x4112a3,_0x5a374d['options']);return db[_0xd1c4('0x2c')][_0xd1c4('0x49')](_0x4112a3)['then'](handleEntityNotFound(_0x14cabb,null))[_0xd1c4('0x24')](respondWithResult(_0x14cabb,null))[_0xd1c4('0x45')](handleError(_0x14cabb,null));};exports[_0xd1c4('0x4a')]=function(_0x4b63e0,_0x327f16){return db[_0xd1c4('0x2c')][_0xd1c4('0x4a')](_0x4b63e0[_0xd1c4('0x4b')],{})['then'](respondWithResult(_0x327f16,0xc9))[_0xd1c4('0x45')](handleError(_0x327f16,null));};exports[_0xd1c4('0x4c')]=function(_0x5e64f5,_0x49a7e4){if(_0x5e64f5[_0xd1c4('0x4b')]['id']){delete _0x5e64f5['body']['id'];}return db['FaxQueueReport'][_0xd1c4('0x49')]({'where':{'id':_0x5e64f5['params']['id']}})['then'](handleEntityNotFound(_0x49a7e4,null))[_0xd1c4('0x24')](saveUpdates(_0x5e64f5['body'],null))['then'](respondWithResult(_0x49a7e4,null))[_0xd1c4('0x45')](handleError(_0x49a7e4,null));};exports['destroy']=function(_0x26487c,_0x14ef2a){return db[_0xd1c4('0x2c')][_0xd1c4('0x49')]({'where':{'id':_0x26487c[_0xd1c4('0x47')]['id']}})['then'](handleEntityNotFound(_0x14ef2a,null))['then'](removeEntity(_0x14ef2a,null))[_0xd1c4('0x45')](handleError(_0x14ef2a,null));};exports[_0xd1c4('0x4d')]=function(_0x10bb3a,_0x1f3a66){return db[_0xd1c4('0x2c')]['describe']()[_0xd1c4('0x24')](respondWithResult(_0x1f3a66,null))[_0xd1c4('0x45')](handleError(_0x1f3a66,null));}; \ No newline at end of file +var _0xb4e6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','update','then','end','error','stack','name','index','FaxQueueReport','rawAttributes','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filters','merge','where','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x281f7b,_0x3248c1){var _0x2df3fb=function(_0x26e8f2){while(--_0x26e8f2){_0x281f7b['push'](_0x281f7b['shift']());}};_0x2df3fb(++_0x3248c1);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0xb4e6[_0x1911ed];return _0x11edaa;};'use strict';var emlformat=require(_0x6b4e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b4e('0x1'));var jsonpatch=require(_0x6b4e('0x2'));var rp=require(_0x6b4e('0x3'));var moment=require(_0x6b4e('0x4'));var BPromise=require(_0x6b4e('0x5'));var Mustache=require(_0x6b4e('0x6'));var util=require(_0x6b4e('0x7'));var path=require('path');var sox=require(_0x6b4e('0x8'));var csv=require(_0x6b4e('0x9'));var ejs=require(_0x6b4e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b4e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b4e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b4e('0xd'));var Papa=require(_0x6b4e('0xe'));var Redis=require(_0x6b4e('0xf'));var authService=require(_0x6b4e('0x10'));var qs=require(_0x6b4e('0x11'));var as=require(_0x6b4e('0x12'));var hardwareService=require(_0x6b4e('0x13'));var logger=require('../../config/logger')(_0x6b4e('0x14'));var utils=require(_0x6b4e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6b4e('0x16'));var db=require(_0x6b4e('0x17'))['db'];function respondWithStatusCode(_0x432399,_0x2b2ce0){_0x2b2ce0=_0x2b2ce0||0xcc;return function(_0x9f8f6c){if(_0x9f8f6c){return _0x432399[_0x6b4e('0x18')](_0x2b2ce0);}return _0x432399[_0x6b4e('0x19')](_0x2b2ce0)['end']();};}function respondWithResult(_0x36f8a5,_0x29bdee){_0x29bdee=_0x29bdee||0xc8;return function(_0x4788cf){if(_0x4788cf){return _0x36f8a5[_0x6b4e('0x19')](_0x29bdee)['json'](_0x4788cf);}};}function respondWithFilteredResult(_0x355f10,_0x2195c1){return function(_0x3ba513){if(_0x3ba513){var _0x42e265=typeof _0x2195c1[_0x6b4e('0x1a')]===_0x6b4e('0x1b')&&typeof _0x2195c1['limit']==='undefined';var _0x67496d=_0x3ba513[_0x6b4e('0x1c')];var _0x10d2b1=_0x42e265?0x0:_0x2195c1[_0x6b4e('0x1a')];var _0x101d0a=_0x42e265?_0x3ba513[_0x6b4e('0x1c')]:_0x2195c1[_0x6b4e('0x1a')]+_0x2195c1[_0x6b4e('0x1d')];var _0x35aee1;if(_0x101d0a>=_0x67496d){_0x101d0a=_0x67496d;_0x35aee1=0xc8;}else{_0x35aee1=0xce;}_0x355f10[_0x6b4e('0x19')](_0x35aee1);return _0x355f10[_0x6b4e('0x1e')]('Content-Range',_0x10d2b1+'-'+_0x101d0a+'/'+_0x67496d)[_0x6b4e('0x1f')](_0x3ba513);}return null;};}function patchUpdates(_0x248fea){return function(_0x31fb9d){try{jsonpatch[_0x6b4e('0x20')](_0x31fb9d,_0x248fea,!![]);}catch(_0x5e5dcd){return BPromise[_0x6b4e('0x21')](_0x5e5dcd);}return _0x31fb9d['save']();};}function saveUpdates(_0x2503a5,_0x163dea){return function(_0x165a99){if(_0x165a99){return _0x165a99[_0x6b4e('0x22')](_0x2503a5)[_0x6b4e('0x23')](function(_0x346566){return _0x346566;});}return null;};}function removeEntity(_0x3e636f,_0x5c33be){return function(_0x2e36db){if(_0x2e36db){return _0x2e36db['destroy']()[_0x6b4e('0x23')](function(){_0x3e636f[_0x6b4e('0x19')](0xcc)[_0x6b4e('0x24')]();});}};}function handleEntityNotFound(_0xdba4fe,_0x4ec9cc){return function(_0xec7d35){if(!_0xec7d35){_0xdba4fe[_0x6b4e('0x18')](0x194);}return _0xec7d35;};}function handleError(_0x4e217c,_0x32102f){_0x32102f=_0x32102f||0x1f4;return function(_0x381ff0){logger[_0x6b4e('0x25')](_0x381ff0[_0x6b4e('0x26')]);if(_0x381ff0['name']){delete _0x381ff0[_0x6b4e('0x27')];}_0x4e217c[_0x6b4e('0x19')](_0x32102f)['send'](_0x381ff0);};}exports[_0x6b4e('0x28')]=function(_0x453beb,_0x2f1129){var _0x143de5={},_0x4a6c90={},_0x445278={'count':0x0,'rows':[]};var _0x4007b6=_['map'](db[_0x6b4e('0x29')][_0x6b4e('0x2a')],function(_0x37b636){return{'name':_0x37b636['fieldName'],'type':_0x37b636['type'][_0x6b4e('0x2b')]};});_0x4a6c90[_0x6b4e('0x2c')]=_[_0x6b4e('0x2d')](_0x4007b6,'name');_0x4a6c90[_0x6b4e('0x2e')]=_[_0x6b4e('0x2f')](_0x453beb[_0x6b4e('0x2e')]);_0x4a6c90['filters']=_['intersection'](_0x4a6c90[_0x6b4e('0x2c')],_0x4a6c90['query']);_0x143de5[_0x6b4e('0x30')]=_[_0x6b4e('0x31')](_0x4a6c90['model'],qs[_0x6b4e('0x32')](_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x32')]));_0x143de5[_0x6b4e('0x30')]=_0x143de5['attributes']['length']?_0x143de5[_0x6b4e('0x30')]:_0x4a6c90[_0x6b4e('0x2c')];if(!_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x33')](_0x6b4e('0x34'))){_0x143de5[_0x6b4e('0x1d')]=qs[_0x6b4e('0x1d')](_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x1d')]);_0x143de5[_0x6b4e('0x1a')]=qs[_0x6b4e('0x1a')](_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x1a')]);}_0x143de5['order']=qs[_0x6b4e('0x35')](_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x35')]);_0x143de5['where']=qs[_0x6b4e('0x36')](_['pick'](_0x453beb[_0x6b4e('0x2e')],_0x4a6c90[_0x6b4e('0x36')]),_0x4007b6);if(_0x453beb[_0x6b4e('0x2e')]['filter']){_0x143de5['where']=_[_0x6b4e('0x37')](_0x143de5[_0x6b4e('0x38')],{'$or':_['map'](_0x4007b6,function(_0x4d61dc){if(_0x4d61dc[_0x6b4e('0x39')]!==_0x6b4e('0x3a')){var _0x303507={};_0x303507[_0x4d61dc[_0x6b4e('0x27')]]={'$like':'%'+_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x3b')]+'%'};return _0x303507;}})});}_0x143de5=_[_0x6b4e('0x37')]({},_0x143de5,_0x453beb[_0x6b4e('0x3c')]);var _0x2faf8d={'where':_0x143de5[_0x6b4e('0x38')]};return db[_0x6b4e('0x29')]['count'](_0x2faf8d)[_0x6b4e('0x23')](function(_0x5516e7){_0x445278['count']=_0x5516e7;if(_0x453beb[_0x6b4e('0x2e')][_0x6b4e('0x3d')]){_0x143de5[_0x6b4e('0x3e')]=[{'all':!![]}];}return db[_0x6b4e('0x29')][_0x6b4e('0x3f')](_0x143de5);})['then'](function(_0x4e545c){_0x445278[_0x6b4e('0x40')]=_0x4e545c;return _0x445278;})['then'](respondWithFilteredResult(_0x2f1129,_0x143de5))[_0x6b4e('0x41')](handleError(_0x2f1129,null));};exports[_0x6b4e('0x42')]=function(_0x4d8227,_0xf70c24){var _0x50f0e7={'raw':!![],'where':{'id':_0x4d8227['params']['id']}},_0x3dec0f={};_0x3dec0f[_0x6b4e('0x2c')]=_[_0x6b4e('0x2f')](db[_0x6b4e('0x29')][_0x6b4e('0x2a')]);_0x3dec0f['query']=_[_0x6b4e('0x2f')](_0x4d8227[_0x6b4e('0x2e')]);_0x3dec0f[_0x6b4e('0x36')]=_['intersection'](_0x3dec0f[_0x6b4e('0x2c')],_0x3dec0f[_0x6b4e('0x2e')]);_0x50f0e7[_0x6b4e('0x30')]=_[_0x6b4e('0x31')](_0x3dec0f[_0x6b4e('0x2c')],qs[_0x6b4e('0x32')](_0x4d8227[_0x6b4e('0x2e')][_0x6b4e('0x32')]));_0x50f0e7[_0x6b4e('0x30')]=_0x50f0e7['attributes'][_0x6b4e('0x43')]?_0x50f0e7[_0x6b4e('0x30')]:_0x3dec0f[_0x6b4e('0x2c')];if(_0x4d8227[_0x6b4e('0x2e')][_0x6b4e('0x3d')]){_0x50f0e7['include']=[{'all':!![]}];}_0x50f0e7=_[_0x6b4e('0x37')]({},_0x50f0e7,_0x4d8227['options']);return db[_0x6b4e('0x29')][_0x6b4e('0x44')](_0x50f0e7)[_0x6b4e('0x23')](handleEntityNotFound(_0xf70c24,null))[_0x6b4e('0x23')](respondWithResult(_0xf70c24,null))['catch'](handleError(_0xf70c24,null));};exports[_0x6b4e('0x45')]=function(_0x46467e,_0x1d0eb3){return db['FaxQueueReport'][_0x6b4e('0x45')](_0x46467e[_0x6b4e('0x46')],{})[_0x6b4e('0x23')](respondWithResult(_0x1d0eb3,0xc9))[_0x6b4e('0x41')](handleError(_0x1d0eb3,null));};exports[_0x6b4e('0x22')]=function(_0x33c797,_0x289dfa){if(_0x33c797[_0x6b4e('0x46')]['id']){delete _0x33c797[_0x6b4e('0x46')]['id'];}return db[_0x6b4e('0x29')]['find']({'where':{'id':_0x33c797[_0x6b4e('0x47')]['id']}})[_0x6b4e('0x23')](handleEntityNotFound(_0x289dfa,null))[_0x6b4e('0x23')](saveUpdates(_0x33c797['body'],null))[_0x6b4e('0x23')](respondWithResult(_0x289dfa,null))[_0x6b4e('0x41')](handleError(_0x289dfa,null));};exports[_0x6b4e('0x48')]=function(_0x738ee5,_0x73c6be){return db[_0x6b4e('0x29')][_0x6b4e('0x44')]({'where':{'id':_0x738ee5[_0x6b4e('0x47')]['id']}})[_0x6b4e('0x23')](handleEntityNotFound(_0x73c6be,null))[_0x6b4e('0x23')](removeEntity(_0x73c6be,null))[_0x6b4e('0x41')](handleError(_0x73c6be,null));};exports['describe']=function(_0x4e183b,_0x2e67cd){return db[_0x6b4e('0x29')][_0x6b4e('0x49')]()[_0x6b4e('0x23')](respondWithResult(_0x2e67cd,null))['catch'](handleError(_0x2e67cd,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 684dcd4..3c6ed50 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x5a2757,_0x1f8ebb){var _0x2cede4=function(_0x88beed){while(--_0x88beed){_0x5a2757['push'](_0x5a2757['shift']());}};_0x2cede4(++_0x1f8ebb);}(_0x326f,0xd1));var _0xf326=function(_0x3e29d4,_0x1bf533){_0x3e29d4=_0x3e29d4-0x0;var _0x2dc92f=_0x326f[_0x3e29d4];return _0x2dc92f;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x3b6830,_0xe57e96){var _0x3b25b8=function(_0x12c720){while(--_0x12c720){_0x3b6830['push'](_0x3b6830['shift']());}};_0x3b25b8(++_0xe57e96);}(_0xe14b,0x93));var _0xbe14=function(_0xb9bd0,_0x19dbfd){_0xb9bd0=_0xb9bd0-0x0;var _0x56544f=_0xe14b[_0xb9bd0];return _0x56544f;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 84a4bfa..41b8094 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 _0x6365=['../../mysqldb','../../config/logger','client','http','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','UpdateFaxQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x413a17,_0x1a770e){var _0x271aa6=function(_0x5e1c70){while(--_0x5e1c70){_0x413a17['push'](_0x413a17['shift']());}};_0x271aa6(++_0x1a770e);}(_0x6365,0xcc));var _0x5636=function(_0x1a5a7a,_0xd80317){_0x1a5a7a=_0x1a5a7a-0x0;var _0x436035=_0x6365[_0x1a5a7a];return _0x436035;};'use strict';var _=require(_0x5636('0x0'));var util=require(_0x5636('0x1'));var moment=require(_0x5636('0x2'));var BPromise=require(_0x5636('0x3'));var rs=require(_0x5636('0x4'));var fs=require('fs');var Redis=require(_0x5636('0x5'));var db=require(_0x5636('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5636('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5636('0x8')][_0x5636('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x135bb6,_0x1f9b74,_0x28437c){return new BPromise(function(_0xdf042d,_0x963f07){return client['request'](_0x135bb6,_0x28437c)[_0x5636('0xa')](function(_0x11b3cb){logger[_0x5636('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x1f9b74,_0x5636('0xc'));logger[_0x5636('0xd')](_0x5636('0xe'),_0x1f9b74,_0x5636('0xc'),JSON[_0x5636('0xf')](_0x11b3cb));if(_0x11b3cb[_0x5636('0x10')]){if(_0x11b3cb[_0x5636('0x10')][_0x5636('0x11')]===0x1f4){logger['error'](_0x5636('0x12'),_0x1f9b74,_0x11b3cb[_0x5636('0x10')][_0x5636('0x13')]);return _0x963f07(_0x11b3cb[_0x5636('0x10')]['message']);}logger[_0x5636('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x1f9b74,_0x11b3cb[_0x5636('0x10')][_0x5636('0x13')]);return _0xdf042d(_0x11b3cb[_0x5636('0x10')]['message']);}else{logger[_0x5636('0xb')](_0x5636('0x12'),_0x1f9b74,'request\x20sent');_0xdf042d(_0x11b3cb['result'][_0x5636('0x13')]);}})[_0x5636('0x14')](function(_0x5a8833){logger[_0x5636('0x10')](_0x5636('0x12'),_0x1f9b74,_0x5a8833);_0x963f07(_0x5a8833);});});}exports[_0x5636('0x15')]=function(_0x24e305){var _0x1fa36e=this;return new Promise(function(_0x2da2ed,_0x114a96){return db[_0x5636('0x16')][_0x5636('0x17')](_0x24e305['body'],{'raw':_0x24e305['options']?_0x24e305[_0x5636('0x18')][_0x5636('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x13467a){logger[_0x5636('0xb')](_0x5636('0x15'),_0x24e305);logger[_0x5636('0xd')]('CreateFaxQueueReport',_0x24e305,JSON['stringify'](_0x13467a));_0x2da2ed(_0x13467a);})[_0x5636('0x14')](function(_0x460c51){logger[_0x5636('0x10')](_0x5636('0x15'),_0x460c51[_0x5636('0x13')],_0x24e305);_0x114a96(_0x1fa36e[_0x5636('0x10')](0x1f4,_0x460c51['message']));});});};exports[_0x5636('0x1a')]=function(_0x3b6512){var _0xec4250=this;return new Promise(function(_0x1b82c1,_0x3cb95b){return db[_0x5636('0x16')][_0x5636('0x1b')](_0x3b6512['body'],{'raw':_0x3b6512['options']?_0x3b6512[_0x5636('0x18')][_0x5636('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b6512[_0x5636('0x18')]?_0x3b6512[_0x5636('0x18')][_0x5636('0x1c')]||null:null,'attributes':_0x3b6512['options']?_0x3b6512[_0x5636('0x18')]['attributes']||null:null,'limit':_0x3b6512['options']?_0x3b6512[_0x5636('0x18')][_0x5636('0x1d')]||null:null})['then'](function(_0x1559a7){logger[_0x5636('0xb')](_0x5636('0x1a'),_0x3b6512);logger[_0x5636('0xd')]('UpdateFaxQueueReport',_0x3b6512,JSON[_0x5636('0xf')](_0x1559a7));_0x1b82c1(_0x1559a7);})[_0x5636('0x14')](function(_0x1c601b){logger[_0x5636('0x10')](_0x5636('0x1a'),_0x1c601b['message'],_0x3b6512);_0x3cb95b(_0xec4250['error'](0x1f4,_0x1c601b['message']));});});}; \ No newline at end of file +var _0x6bad=['attributes','limit','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','options','catch','UpdateFaxQueueReport','update','body','raw','where'];(function(_0x454f8a,_0x10b9fe){var _0x3faf56=function(_0xe22c7d){while(--_0xe22c7d){_0x454f8a['push'](_0x454f8a['shift']());}};_0x3faf56(++_0x10b9fe);}(_0x6bad,0xfa));var _0xd6ba=function(_0x1b73c8,_0x2e7966){_0x1b73c8=_0x1b73c8-0x0;var _0x53b8c3=_0x6bad[_0x1b73c8];return _0x53b8c3;};'use strict';var _=require('lodash');var util=require(_0xd6ba('0x0'));var moment=require(_0xd6ba('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6ba('0x3'));var logger=require(_0xd6ba('0x4'))(_0xd6ba('0x5'));var config=require(_0xd6ba('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd6ba('0x7')][_0xd6ba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c8880,_0x127410,_0x4c3cd1){return new BPromise(function(_0x40c3a1,_0x43a103){return client[_0xd6ba('0x9')](_0x2c8880,_0x4c3cd1)[_0xd6ba('0xa')](function(_0x555b94){logger[_0xd6ba('0xb')](_0xd6ba('0xc'),_0x127410,_0xd6ba('0xd'));logger[_0xd6ba('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x127410,'request\x20sent',JSON[_0xd6ba('0xf')](_0x555b94));if(_0x555b94[_0xd6ba('0x10')]){if(_0x555b94[_0xd6ba('0x10')][_0xd6ba('0x11')]===0x1f4){logger[_0xd6ba('0x10')](_0xd6ba('0xc'),_0x127410,_0x555b94[_0xd6ba('0x10')][_0xd6ba('0x12')]);return _0x43a103(_0x555b94[_0xd6ba('0x10')][_0xd6ba('0x12')]);}logger['error'](_0xd6ba('0xc'),_0x127410,_0x555b94['error'][_0xd6ba('0x12')]);return _0x40c3a1(_0x555b94[_0xd6ba('0x10')][_0xd6ba('0x12')]);}else{logger[_0xd6ba('0xb')](_0xd6ba('0xc'),_0x127410,_0xd6ba('0xd'));_0x40c3a1(_0x555b94[_0xd6ba('0x13')][_0xd6ba('0x12')]);}})['catch'](function(_0x9fb56d){logger[_0xd6ba('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x127410,_0x9fb56d);_0x43a103(_0x9fb56d);});});}exports[_0xd6ba('0x14')]=function(_0x2e790d){var _0x14a249=this;return new Promise(function(_0x56bd54,_0x1db94a){return db[_0xd6ba('0x15')]['create'](_0x2e790d['body'],{'raw':_0x2e790d[_0xd6ba('0x16')]?_0x2e790d[_0xd6ba('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xd6ba('0xa')](function(_0x46c66b){logger['info'](_0xd6ba('0x14'),_0x2e790d);logger[_0xd6ba('0xe')](_0xd6ba('0x14'),_0x2e790d,JSON[_0xd6ba('0xf')](_0x46c66b));_0x56bd54(_0x46c66b);})[_0xd6ba('0x17')](function(_0x38470f){logger[_0xd6ba('0x10')](_0xd6ba('0x14'),_0x38470f[_0xd6ba('0x12')],_0x2e790d);_0x1db94a(_0x14a249['error'](0x1f4,_0x38470f[_0xd6ba('0x12')]));});});};exports[_0xd6ba('0x18')]=function(_0x42d8ec){var _0x1a9a91=this;return new Promise(function(_0x54965d,_0x591243){return db[_0xd6ba('0x15')][_0xd6ba('0x19')](_0x42d8ec[_0xd6ba('0x1a')],{'raw':_0x42d8ec[_0xd6ba('0x16')]?_0x42d8ec['options'][_0xd6ba('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42d8ec[_0xd6ba('0x16')]?_0x42d8ec[_0xd6ba('0x16')][_0xd6ba('0x1c')]||null:null,'attributes':_0x42d8ec[_0xd6ba('0x16')]?_0x42d8ec[_0xd6ba('0x16')][_0xd6ba('0x1d')]||null:null,'limit':_0x42d8ec[_0xd6ba('0x16')]?_0x42d8ec[_0xd6ba('0x16')][_0xd6ba('0x1e')]||null:null})[_0xd6ba('0xa')](function(_0x520da2){logger[_0xd6ba('0xb')](_0xd6ba('0x18'),_0x42d8ec);logger[_0xd6ba('0xe')](_0xd6ba('0x18'),_0x42d8ec,JSON[_0xd6ba('0xf')](_0x520da2));_0x54965d(_0x520da2);})[_0xd6ba('0x17')](function(_0x56f1d2){logger[_0xd6ba('0x10')](_0xd6ba('0x18'),_0x56f1d2[_0xd6ba('0x12')],_0x42d8ec);_0x591243(_0x1a9a91[_0xd6ba('0x10')](0x1f4,_0x56f1d2[_0xd6ba('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index fc8b244..6275d78 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 _0xba6c=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','exports','multer'];(function(_0x3ec3b9,_0xdc5c4b){var _0x68034f=function(_0x54c63f){while(--_0x54c63f){_0x3ec3b9['push'](_0x3ec3b9['shift']());}};_0x68034f(++_0xdc5c4b);}(_0xba6c,0x1e2));var _0xcba6=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0xba6c[_0x2b305c];return _0x5d8c85;};'use strict';var multer=require(_0xcba6('0x0'));var util=require(_0xcba6('0x1'));var path=require('path');var timeout=require(_0xcba6('0x2'));var express=require(_0xcba6('0x3'));var router=express['Router']();var fs_extra=require(_0xcba6('0x4'));var auth=require(_0xcba6('0x5'));var interaction=require(_0xcba6('0x6'));var config=require(_0xcba6('0x7'));var controller=require(_0xcba6('0x8'));router[_0xcba6('0x9')]('/',auth[_0xcba6('0xa')](),controller[_0xcba6('0xb')]);router['get']('/describe',auth[_0xcba6('0xa')](),controller[_0xcba6('0xc')]);router[_0xcba6('0x9')]('/:id',auth[_0xcba6('0xa')](),controller[_0xcba6('0xd')]);router[_0xcba6('0xe')]('/',auth[_0xcba6('0xa')](),controller[_0xcba6('0xf')]);router[_0xcba6('0x10')](_0xcba6('0x11'),auth[_0xcba6('0xa')](),controller[_0xcba6('0x12')]);router[_0xcba6('0x13')](_0xcba6('0x11'),auth[_0xcba6('0xa')](),controller['destroy']);module[_0xcba6('0x14')]=router; \ No newline at end of file +var _0x4cbe=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x4cbe,0x1b7));var _0xe4cb=function(_0x195299,_0x7a1c77){_0x195299=_0x195299-0x0;var _0x258842=_0x4cbe[_0x195299];return _0x258842;};'use strict';var multer=require(_0xe4cb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe4cb('0x1'));var express=require(_0xe4cb('0x2'));var router=express[_0xe4cb('0x3')]();var fs_extra=require(_0xe4cb('0x4'));var auth=require(_0xe4cb('0x5'));var interaction=require(_0xe4cb('0x6'));var config=require('../../config/environment');var controller=require(_0xe4cb('0x7'));router['get']('/',auth[_0xe4cb('0x8')](),controller['index']);router[_0xe4cb('0x9')](_0xe4cb('0xa'),auth[_0xe4cb('0x8')](),controller[_0xe4cb('0xb')]);router[_0xe4cb('0x9')](_0xe4cb('0xc'),auth[_0xe4cb('0x8')](),controller[_0xe4cb('0xd')]);router[_0xe4cb('0xe')]('/',auth[_0xe4cb('0x8')](),controller[_0xe4cb('0xf')]);router[_0xe4cb('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe4cb('0x11')]);router[_0xe4cb('0x12')](_0xe4cb('0xc'),auth[_0xe4cb('0x8')](),controller['destroy']);module[_0xe4cb('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 52bff21..3d4232b 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x15e44f,_0x153e50){var _0x5aac56=function(_0x2e7ca2){while(--_0x2e7ca2){_0x15e44f['push'](_0x15e44f['shift']());}};_0x5aac56(++_0x153e50);}(_0xedd9,0xfc));var _0x9edd=function(_0x2bf40f,_0x36c9da){_0x2bf40f=_0x2bf40f-0x0;var _0x57c391=_0xedd9[_0x2bf40f];return _0x57c391;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x2445e2,_0xc4a747){var _0x1e5736=function(_0x4a6509){while(--_0x4a6509){_0x2445e2['push'](_0x2445e2['shift']());}};_0x1e5736(++_0xc4a747);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3f92d8,_0x5df4a2){_0x3f92d8=_0x3f92d8-0x0;var _0x3dc9ce=_0xf4eb[_0x3f92d8];return _0x3dc9ce;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 4090107..5c8ee1e 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 _0x4ae7=['params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','send','map','FaxTransferReport','rawAttributes','fieldName','type','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','options','find','catch','create','body'];(function(_0x3538e4,_0x3a5cfd){var _0x43263e=function(_0x1ce98d){while(--_0x1ce98d){_0x3538e4['push'](_0x3538e4['shift']());}};_0x43263e(++_0x3a5cfd);}(_0x4ae7,0x127));var _0x74ae=function(_0x23aa9d,_0x32b572){_0x23aa9d=_0x23aa9d-0x0;var _0x5ba5bb=_0x4ae7[_0x23aa9d];return _0x5ba5bb;};'use strict';var emlformat=require(_0x74ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74ae('0x1'));var jsonpatch=require(_0x74ae('0x2'));var rp=require(_0x74ae('0x3'));var moment=require(_0x74ae('0x4'));var BPromise=require(_0x74ae('0x5'));var Mustache=require(_0x74ae('0x6'));var util=require(_0x74ae('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x74ae('0x8'));var ejs=require(_0x74ae('0x9'));var fs=require('fs');var fs_extra=require(_0x74ae('0xa'));var _=require(_0x74ae('0xb'));var squel=require('squel');var crypto=require(_0x74ae('0xc'));var jsforce=require(_0x74ae('0xd'));var deskjs=require(_0x74ae('0xe'));var toCsv=require(_0x74ae('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x74ae('0xf'));var authService=require(_0x74ae('0x10'));var qs=require(_0x74ae('0x11'));var as=require(_0x74ae('0x12'));var hardwareService=require(_0x74ae('0x13'));var logger=require('../../config/logger')(_0x74ae('0x14'));var utils=require(_0x74ae('0x15'));var config=require(_0x74ae('0x16'));var licenseUtil=require(_0x74ae('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30c674,_0x55caa1){_0x55caa1=_0x55caa1||0xcc;return function(_0x63fc5b){if(_0x63fc5b){return _0x30c674['sendStatus'](_0x55caa1);}return _0x30c674[_0x74ae('0x18')](_0x55caa1)[_0x74ae('0x19')]();};}function respondWithResult(_0x3402ca,_0x508aba){_0x508aba=_0x508aba||0xc8;return function(_0x42e9bf){if(_0x42e9bf){return _0x3402ca['status'](_0x508aba)[_0x74ae('0x1a')](_0x42e9bf);}};}function respondWithFilteredResult(_0x4c6008,_0x36f6d9){return function(_0x3bde22){if(_0x3bde22){var _0x29acbd=typeof _0x36f6d9['offset']===_0x74ae('0x1b')&&typeof _0x36f6d9[_0x74ae('0x1c')]==='undefined';var _0x10a742=_0x3bde22[_0x74ae('0x1d')];var _0x2a5633=_0x29acbd?0x0:_0x36f6d9[_0x74ae('0x1e')];var _0x55aeb0=_0x29acbd?_0x3bde22[_0x74ae('0x1d')]:_0x36f6d9[_0x74ae('0x1e')]+_0x36f6d9[_0x74ae('0x1c')];var _0x30ea72;if(_0x55aeb0>=_0x10a742){_0x55aeb0=_0x10a742;_0x30ea72=0xc8;}else{_0x30ea72=0xce;}_0x4c6008[_0x74ae('0x18')](_0x30ea72);return _0x4c6008[_0x74ae('0x1f')](_0x74ae('0x20'),_0x2a5633+'-'+_0x55aeb0+'/'+_0x10a742)[_0x74ae('0x1a')](_0x3bde22);}return null;};}function patchUpdates(_0x11eeab){return function(_0x3a0e26){try{jsonpatch[_0x74ae('0x21')](_0x3a0e26,_0x11eeab,!![]);}catch(_0x5ce13a){return BPromise['reject'](_0x5ce13a);}return _0x3a0e26[_0x74ae('0x22')]();};}function saveUpdates(_0x32426f,_0x1b156e){return function(_0x4e45c1){if(_0x4e45c1){return _0x4e45c1[_0x74ae('0x23')](_0x32426f)['then'](function(_0x28b8ae){return _0x28b8ae;});}return null;};}function removeEntity(_0xa26e1e,_0x89b73b){return function(_0x2da8b2){if(_0x2da8b2){return _0x2da8b2['destroy']()[_0x74ae('0x24')](function(){_0xa26e1e[_0x74ae('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22df32,_0x3ebee7){return function(_0x30a3a9){if(!_0x30a3a9){_0x22df32['sendStatus'](0x194);}return _0x30a3a9;};}function handleError(_0x2cc403,_0x39a4ed){_0x39a4ed=_0x39a4ed||0x1f4;return function(_0x44c3b7){logger['error'](_0x44c3b7[_0x74ae('0x25')]);if(_0x44c3b7['name']){delete _0x44c3b7['name'];}_0x2cc403['status'](_0x39a4ed)[_0x74ae('0x26')](_0x44c3b7);};}exports['index']=function(_0x3be896,_0x299816){var _0x1e2a37={},_0x409f3a={},_0x1e1e02={'count':0x0,'rows':[]};var _0x56604a=_[_0x74ae('0x27')](db[_0x74ae('0x28')][_0x74ae('0x29')],function(_0x454789){return{'name':_0x454789[_0x74ae('0x2a')],'type':_0x454789[_0x74ae('0x2b')]['key']};});_0x409f3a['model']=_['map'](_0x56604a,_0x74ae('0x2c'));_0x409f3a[_0x74ae('0x2d')]=_[_0x74ae('0x2e')](_0x3be896[_0x74ae('0x2d')]);_0x409f3a[_0x74ae('0x2f')]=_['intersection'](_0x409f3a[_0x74ae('0x30')],_0x409f3a[_0x74ae('0x2d')]);_0x1e2a37[_0x74ae('0x31')]=_[_0x74ae('0x32')](_0x409f3a[_0x74ae('0x30')],qs[_0x74ae('0x33')](_0x3be896[_0x74ae('0x2d')]['fields']));_0x1e2a37[_0x74ae('0x31')]=_0x1e2a37['attributes'][_0x74ae('0x34')]?_0x1e2a37[_0x74ae('0x31')]:_0x409f3a[_0x74ae('0x30')];if(!_0x3be896[_0x74ae('0x2d')][_0x74ae('0x35')](_0x74ae('0x36'))){_0x1e2a37[_0x74ae('0x1c')]=qs['limit'](_0x3be896[_0x74ae('0x2d')][_0x74ae('0x1c')]);_0x1e2a37[_0x74ae('0x1e')]=qs[_0x74ae('0x1e')](_0x3be896[_0x74ae('0x2d')]['offset']);}_0x1e2a37[_0x74ae('0x37')]=qs[_0x74ae('0x38')](_0x3be896[_0x74ae('0x2d')][_0x74ae('0x38')]);_0x1e2a37[_0x74ae('0x39')]=qs['filters'](_['pick'](_0x3be896[_0x74ae('0x2d')],_0x409f3a['filters']),_0x56604a);if(_0x3be896[_0x74ae('0x2d')][_0x74ae('0x3a')]){_0x1e2a37[_0x74ae('0x39')]=_[_0x74ae('0x3b')](_0x1e2a37[_0x74ae('0x39')],{'$or':_[_0x74ae('0x27')](_0x56604a,function(_0x3bbab4){if(_0x3bbab4[_0x74ae('0x2b')]!==_0x74ae('0x3c')){var _0x3ec4d2={};_0x3ec4d2[_0x3bbab4[_0x74ae('0x2c')]]={'$like':'%'+_0x3be896['query'][_0x74ae('0x3a')]+'%'};return _0x3ec4d2;}})});}_0x1e2a37=_[_0x74ae('0x3b')]({},_0x1e2a37,_0x3be896['options']);var _0x37a443={'where':_0x1e2a37[_0x74ae('0x39')]};return db[_0x74ae('0x28')][_0x74ae('0x1d')](_0x37a443)['then'](function(_0x141ae2){_0x1e1e02['count']=_0x141ae2;if(_0x3be896[_0x74ae('0x2d')][_0x74ae('0x3d')]){_0x1e2a37[_0x74ae('0x3e')]=[{'all':!![]}];}return db[_0x74ae('0x28')][_0x74ae('0x3f')](_0x1e2a37);})[_0x74ae('0x24')](function(_0x4d3935){_0x1e1e02[_0x74ae('0x40')]=_0x4d3935;return _0x1e1e02;})[_0x74ae('0x24')](respondWithFilteredResult(_0x299816,_0x1e2a37))['catch'](handleError(_0x299816,null));};exports['show']=function(_0x2b7e9d,_0x395ef1){var _0x489b91={'raw':!![],'where':{'id':_0x2b7e9d['params']['id']}},_0x2d3490={};_0x2d3490['model']=_['keys'](db[_0x74ae('0x28')][_0x74ae('0x29')]);_0x2d3490['query']=_[_0x74ae('0x2e')](_0x2b7e9d[_0x74ae('0x2d')]);_0x2d3490[_0x74ae('0x2f')]=_[_0x74ae('0x32')](_0x2d3490['model'],_0x2d3490[_0x74ae('0x2d')]);_0x489b91['attributes']=_[_0x74ae('0x32')](_0x2d3490[_0x74ae('0x30')],qs[_0x74ae('0x33')](_0x2b7e9d['query'][_0x74ae('0x33')]));_0x489b91[_0x74ae('0x31')]=_0x489b91['attributes'][_0x74ae('0x34')]?_0x489b91[_0x74ae('0x31')]:_0x2d3490[_0x74ae('0x30')];if(_0x2b7e9d[_0x74ae('0x2d')][_0x74ae('0x3d')]){_0x489b91[_0x74ae('0x3e')]=[{'all':!![]}];}_0x489b91=_[_0x74ae('0x3b')]({},_0x489b91,_0x2b7e9d[_0x74ae('0x41')]);return db[_0x74ae('0x28')][_0x74ae('0x42')](_0x489b91)['then'](handleEntityNotFound(_0x395ef1,null))[_0x74ae('0x24')](respondWithResult(_0x395ef1,null))[_0x74ae('0x43')](handleError(_0x395ef1,null));};exports[_0x74ae('0x44')]=function(_0x54b7f9,_0x1e423b){return db[_0x74ae('0x28')][_0x74ae('0x44')](_0x54b7f9[_0x74ae('0x45')],{})[_0x74ae('0x24')](respondWithResult(_0x1e423b,0xc9))['catch'](handleError(_0x1e423b,null));};exports[_0x74ae('0x23')]=function(_0x466a34,_0x2c22c3){if(_0x466a34[_0x74ae('0x45')]['id']){delete _0x466a34[_0x74ae('0x45')]['id'];}return db['FaxTransferReport'][_0x74ae('0x42')]({'where':{'id':_0x466a34[_0x74ae('0x46')]['id']}})[_0x74ae('0x24')](handleEntityNotFound(_0x2c22c3,null))[_0x74ae('0x24')](saveUpdates(_0x466a34[_0x74ae('0x45')],null))[_0x74ae('0x24')](respondWithResult(_0x2c22c3,null))[_0x74ae('0x43')](handleError(_0x2c22c3,null));};exports[_0x74ae('0x47')]=function(_0x9f2e59,_0x174f5e){return db['FaxTransferReport'][_0x74ae('0x42')]({'where':{'id':_0x9f2e59[_0x74ae('0x46')]['id']}})[_0x74ae('0x24')](handleEntityNotFound(_0x174f5e,null))['then'](removeEntity(_0x174f5e,null))[_0x74ae('0x43')](handleError(_0x174f5e,null));};exports[_0x74ae('0x48')]=function(_0x21c934,_0x355dc2){return db[_0x74ae('0x28')][_0x74ae('0x48')]()[_0x74ae('0x24')](respondWithResult(_0x355dc2,null))[_0x74ae('0x43')](handleError(_0x355dc2,null));}; \ No newline at end of file +var _0xb424=['status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','destroy','name','send','index','map','FaxTransferReport','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','includeAll','include','catch','show','params','keys','rawAttributes','options','find','body','describe','eml-format','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x555961,_0x2eb850){var _0x433cc0=function(_0xd24ccc){while(--_0xd24ccc){_0x555961['push'](_0x555961['shift']());}};_0x433cc0(++_0x2eb850);}(_0xb424,0x17d));var _0x4b42=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0xb424[_0x55677b];return _0x104b88;};'use strict';var emlformat=require(_0x4b42('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4b42('0x1'));var rp=require(_0x4b42('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4b42('0x3'));var path=require(_0x4b42('0x4'));var sox=require(_0x4b42('0x5'));var csv=require(_0x4b42('0x6'));var ejs=require(_0x4b42('0x7'));var fs=require('fs');var fs_extra=require(_0x4b42('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4b42('0x9'));var jsforce=require(_0x4b42('0xa'));var deskjs=require(_0x4b42('0xb'));var toCsv=require(_0x4b42('0x6'));var querystring=require(_0x4b42('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b42('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b42('0xe'));var logger=require(_0x4b42('0xf'))(_0x4b42('0x10'));var utils=require(_0x4b42('0x11'));var config=require(_0x4b42('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b42('0x13'))['db'];function respondWithStatusCode(_0x1cd116,_0x69be61){_0x69be61=_0x69be61||0xcc;return function(_0x4ce4f8){if(_0x4ce4f8){return _0x1cd116[_0x4b42('0x14')](_0x69be61);}return _0x1cd116[_0x4b42('0x15')](_0x69be61)[_0x4b42('0x16')]();};}function respondWithResult(_0x184941,_0x212fe0){_0x212fe0=_0x212fe0||0xc8;return function(_0x5eed53){if(_0x5eed53){return _0x184941[_0x4b42('0x15')](_0x212fe0)['json'](_0x5eed53);}};}function respondWithFilteredResult(_0x34eba0,_0xfb5ea2){return function(_0x58bf56){if(_0x58bf56){var _0x357ae9=typeof _0xfb5ea2['offset']===_0x4b42('0x17')&&typeof _0xfb5ea2[_0x4b42('0x18')]===_0x4b42('0x17');var _0x515ccf=_0x58bf56[_0x4b42('0x19')];var _0x4bc5ff=_0x357ae9?0x0:_0xfb5ea2['offset'];var _0xae04e3=_0x357ae9?_0x58bf56[_0x4b42('0x19')]:_0xfb5ea2[_0x4b42('0x1a')]+_0xfb5ea2[_0x4b42('0x18')];var _0x2555d2;if(_0xae04e3>=_0x515ccf){_0xae04e3=_0x515ccf;_0x2555d2=0xc8;}else{_0x2555d2=0xce;}_0x34eba0[_0x4b42('0x15')](_0x2555d2);return _0x34eba0['set'](_0x4b42('0x1b'),_0x4bc5ff+'-'+_0xae04e3+'/'+_0x515ccf)[_0x4b42('0x1c')](_0x58bf56);}return null;};}function patchUpdates(_0x272d5d){return function(_0x308cd9){try{jsonpatch[_0x4b42('0x1d')](_0x308cd9,_0x272d5d,!![]);}catch(_0xa4ae3a){return BPromise[_0x4b42('0x1e')](_0xa4ae3a);}return _0x308cd9['save']();};}function saveUpdates(_0xa27785,_0x242809){return function(_0x43d627){if(_0x43d627){return _0x43d627[_0x4b42('0x1f')](_0xa27785)[_0x4b42('0x20')](function(_0x17d56f){return _0x17d56f;});}return null;};}function removeEntity(_0x1467b6,_0x57ca9e){return function(_0x279aed){if(_0x279aed){return _0x279aed[_0x4b42('0x21')]()[_0x4b42('0x20')](function(){_0x1467b6[_0x4b42('0x15')](0xcc)[_0x4b42('0x16')]();});}};}function handleEntityNotFound(_0xcbf48e,_0x28ee67){return function(_0x4325f3){if(!_0x4325f3){_0xcbf48e[_0x4b42('0x14')](0x194);}return _0x4325f3;};}function handleError(_0x3fdb91,_0x2dbbbe){_0x2dbbbe=_0x2dbbbe||0x1f4;return function(_0x136ae3){logger['error'](_0x136ae3['stack']);if(_0x136ae3['name']){delete _0x136ae3[_0x4b42('0x22')];}_0x3fdb91[_0x4b42('0x15')](_0x2dbbbe)[_0x4b42('0x23')](_0x136ae3);};}exports[_0x4b42('0x24')]=function(_0x2fc91a,_0x49f8d7){var _0x15836d={},_0x5d93c7={},_0x4230db={'count':0x0,'rows':[]};var _0x57930a=_[_0x4b42('0x25')](db[_0x4b42('0x26')]['rawAttributes'],function(_0x24c126){return{'name':_0x24c126[_0x4b42('0x27')],'type':_0x24c126[_0x4b42('0x28')][_0x4b42('0x29')]};});_0x5d93c7[_0x4b42('0x2a')]=_[_0x4b42('0x25')](_0x57930a,_0x4b42('0x22'));_0x5d93c7[_0x4b42('0x2b')]=_['keys'](_0x2fc91a[_0x4b42('0x2b')]);_0x5d93c7['filters']=_[_0x4b42('0x2c')](_0x5d93c7['model'],_0x5d93c7[_0x4b42('0x2b')]);_0x15836d['attributes']=_[_0x4b42('0x2c')](_0x5d93c7[_0x4b42('0x2a')],qs[_0x4b42('0x2d')](_0x2fc91a['query'][_0x4b42('0x2d')]));_0x15836d[_0x4b42('0x2e')]=_0x15836d[_0x4b42('0x2e')][_0x4b42('0x2f')]?_0x15836d[_0x4b42('0x2e')]:_0x5d93c7['model'];if(!_0x2fc91a[_0x4b42('0x2b')][_0x4b42('0x30')](_0x4b42('0x31'))){_0x15836d['limit']=qs[_0x4b42('0x18')](_0x2fc91a['query'][_0x4b42('0x18')]);_0x15836d['offset']=qs[_0x4b42('0x1a')](_0x2fc91a[_0x4b42('0x2b')]['offset']);}_0x15836d['order']=qs[_0x4b42('0x32')](_0x2fc91a[_0x4b42('0x2b')]['sort']);_0x15836d[_0x4b42('0x33')]=qs[_0x4b42('0x34')](_[_0x4b42('0x35')](_0x2fc91a[_0x4b42('0x2b')],_0x5d93c7[_0x4b42('0x34')]),_0x57930a);if(_0x2fc91a[_0x4b42('0x2b')][_0x4b42('0x36')]){_0x15836d[_0x4b42('0x33')]=_[_0x4b42('0x37')](_0x15836d[_0x4b42('0x33')],{'$or':_[_0x4b42('0x25')](_0x57930a,function(_0xc1f792){if(_0xc1f792['type']!=='VIRTUAL'){var _0x5e92f7={};_0x5e92f7[_0xc1f792[_0x4b42('0x22')]]={'$like':'%'+_0x2fc91a[_0x4b42('0x2b')][_0x4b42('0x36')]+'%'};return _0x5e92f7;}})});}_0x15836d=_[_0x4b42('0x37')]({},_0x15836d,_0x2fc91a['options']);var _0x58cc8b={'where':_0x15836d[_0x4b42('0x33')]};return db[_0x4b42('0x26')][_0x4b42('0x19')](_0x58cc8b)[_0x4b42('0x20')](function(_0x3ee123){_0x4230db[_0x4b42('0x19')]=_0x3ee123;if(_0x2fc91a[_0x4b42('0x2b')][_0x4b42('0x38')]){_0x15836d[_0x4b42('0x39')]=[{'all':!![]}];}return db[_0x4b42('0x26')]['findAll'](_0x15836d);})[_0x4b42('0x20')](function(_0x46c42d){_0x4230db['rows']=_0x46c42d;return _0x4230db;})['then'](respondWithFilteredResult(_0x49f8d7,_0x15836d))[_0x4b42('0x3a')](handleError(_0x49f8d7,null));};exports[_0x4b42('0x3b')]=function(_0x448c97,_0x2e19a4){var _0x3e6a8b={'raw':!![],'where':{'id':_0x448c97[_0x4b42('0x3c')]['id']}},_0x2b4631={};_0x2b4631[_0x4b42('0x2a')]=_[_0x4b42('0x3d')](db[_0x4b42('0x26')][_0x4b42('0x3e')]);_0x2b4631['query']=_[_0x4b42('0x3d')](_0x448c97[_0x4b42('0x2b')]);_0x2b4631[_0x4b42('0x34')]=_[_0x4b42('0x2c')](_0x2b4631[_0x4b42('0x2a')],_0x2b4631['query']);_0x3e6a8b[_0x4b42('0x2e')]=_[_0x4b42('0x2c')](_0x2b4631['model'],qs[_0x4b42('0x2d')](_0x448c97[_0x4b42('0x2b')][_0x4b42('0x2d')]));_0x3e6a8b['attributes']=_0x3e6a8b['attributes'][_0x4b42('0x2f')]?_0x3e6a8b[_0x4b42('0x2e')]:_0x2b4631['model'];if(_0x448c97[_0x4b42('0x2b')][_0x4b42('0x38')]){_0x3e6a8b[_0x4b42('0x39')]=[{'all':!![]}];}_0x3e6a8b=_[_0x4b42('0x37')]({},_0x3e6a8b,_0x448c97[_0x4b42('0x3f')]);return db[_0x4b42('0x26')][_0x4b42('0x40')](_0x3e6a8b)[_0x4b42('0x20')](handleEntityNotFound(_0x2e19a4,null))[_0x4b42('0x20')](respondWithResult(_0x2e19a4,null))[_0x4b42('0x3a')](handleError(_0x2e19a4,null));};exports['create']=function(_0x315666,_0x52f9e4){return db['FaxTransferReport']['create'](_0x315666[_0x4b42('0x41')],{})[_0x4b42('0x20')](respondWithResult(_0x52f9e4,0xc9))[_0x4b42('0x3a')](handleError(_0x52f9e4,null));};exports[_0x4b42('0x1f')]=function(_0x128605,_0x582d3a){if(_0x128605[_0x4b42('0x41')]['id']){delete _0x128605['body']['id'];}return db[_0x4b42('0x26')][_0x4b42('0x40')]({'where':{'id':_0x128605[_0x4b42('0x3c')]['id']}})[_0x4b42('0x20')](handleEntityNotFound(_0x582d3a,null))[_0x4b42('0x20')](saveUpdates(_0x128605[_0x4b42('0x41')],null))['then'](respondWithResult(_0x582d3a,null))['catch'](handleError(_0x582d3a,null));};exports[_0x4b42('0x21')]=function(_0x41b2d6,_0x4fff29){return db[_0x4b42('0x26')][_0x4b42('0x40')]({'where':{'id':_0x41b2d6[_0x4b42('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4fff29,null))[_0x4b42('0x20')](removeEntity(_0x4fff29,null))['catch'](handleError(_0x4fff29,null));};exports[_0x4b42('0x42')]=function(_0x58b6d8,_0x5cebef){return db[_0x4b42('0x26')][_0x4b42('0x42')]()[_0x4b42('0x20')](respondWithResult(_0x5cebef,null))[_0x4b42('0x3a')](handleError(_0x5cebef,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index e6d5396..b8f9cc8 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 _0x4458=['../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x28cc67,_0x5192ba){var _0x203e16=function(_0x4ccba7){while(--_0x4ccba7){_0x28cc67['push'](_0x28cc67['shift']());}};_0x203e16(++_0x5192ba);}(_0x4458,0xe6));var _0x8445=function(_0x3268c4,_0x1b18ff){_0x3268c4=_0x3268c4-0x0;var _0x24272c=_0x4458[_0x3268c4];return _0x24272c;};'use strict';var _=require(_0x8445('0x0'));var util=require(_0x8445('0x1'));var logger=require(_0x8445('0x2'))(_0x8445('0x3'));var moment=require(_0x8445('0x4'));var BPromise=require('bluebird');var rp=require(_0x8445('0x5'));var fs=require('fs');var path=require(_0x8445('0x6'));var rimraf=require(_0x8445('0x7'));var config=require(_0x8445('0x8'));var attributes=require(_0x8445('0x9'));module['exports']=function(_0x598ea0,_0x2bc375){return _0x598ea0[_0x8445('0xa')](_0x8445('0xb'),attributes,{'tableName':_0x8445('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8445('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x845f=['bluebird','request-promise','path','rimraf','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x114695,_0x240599){var _0xa4e956=function(_0xa70109){while(--_0xa70109){_0x114695['push'](_0x114695['shift']());}};_0xa4e956(++_0x240599);}(_0x845f,0x1b8));var _0xf845=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x845f[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xf845('0x0'));var util=require(_0xf845('0x1'));var logger=require(_0xf845('0x2'))('api');var moment=require(_0xf845('0x3'));var BPromise=require(_0xf845('0x4'));var rp=require(_0xf845('0x5'));var fs=require('fs');var path=require(_0xf845('0x6'));var rimraf=require(_0xf845('0x7'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0xf845('0x8')]=function(_0x27a328,_0x1efcaa){return _0x27a328[_0xf845('0x9')]('FaxTransferReport',attributes,{'tableName':_0xf845('0xa'),'paranoid':![],'indexes':[{'name':_0xf845('0xb'),'fields':[_0xf845('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 1972fd8..d57f834 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 _0x51c0=['request','then','info','request\x20sent','debug','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1fa841,_0x37a70c){var _0x384b67=function(_0x248c40){while(--_0x248c40){_0x1fa841['push'](_0x1fa841['shift']());}};_0x384b67(++_0x37a70c);}(_0x51c0,0xc2));var _0x051c=function(_0x406ccc,_0x3d9f5d){_0x406ccc=_0x406ccc-0x0;var _0x275d2e=_0x51c0[_0x406ccc];return _0x275d2e;};'use strict';var _=require(_0x051c('0x0'));var util=require(_0x051c('0x1'));var moment=require('moment');var BPromise=require(_0x051c('0x2'));var rs=require(_0x051c('0x3'));var fs=require('fs');var Redis=require(_0x051c('0x4'));var db=require(_0x051c('0x5'))['db'];var utils=require(_0x051c('0x6'));var logger=require(_0x051c('0x7'))(_0x051c('0x8'));var config=require(_0x051c('0x9'));var jayson=require(_0x051c('0xa'));var client=jayson[_0x051c('0xb')][_0x051c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcb88da,_0x56f649,_0x1038d6){return new BPromise(function(_0x323310,_0x3e58c3){return client[_0x051c('0xd')](_0xcb88da,_0x1038d6)[_0x051c('0xe')](function(_0x3727c5){logger[_0x051c('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x56f649,_0x051c('0x10'));logger[_0x051c('0x11')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x56f649,_0x051c('0x10'),JSON[_0x051c('0x12')](_0x3727c5));if(_0x3727c5[_0x051c('0x13')]){if(_0x3727c5[_0x051c('0x13')][_0x051c('0x14')]===0x1f4){logger[_0x051c('0x13')](_0x051c('0x15'),_0x56f649,_0x3727c5['error']['message']);return _0x3e58c3(_0x3727c5[_0x051c('0x13')][_0x051c('0x16')]);}logger[_0x051c('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x56f649,_0x3727c5[_0x051c('0x13')]['message']);return _0x323310(_0x3727c5['error']['message']);}else{logger[_0x051c('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x56f649,_0x051c('0x10'));_0x323310(_0x3727c5['result'][_0x051c('0x16')]);}})['catch'](function(_0x20d80e){logger[_0x051c('0x13')](_0x051c('0x15'),_0x56f649,_0x20d80e);_0x3e58c3(_0x20d80e);});});} \ No newline at end of file +var _0x81eb=['http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x126391,_0x3845b2){var _0x391a18=function(_0x57211e){while(--_0x57211e){_0x126391['push'](_0x126391['shift']());}};_0x391a18(++_0x3845b2);}(_0x81eb,0x1d4));var _0xb81e=function(_0x1aa6ab,_0x464f5e){_0x1aa6ab=_0x1aa6ab-0x0;var _0x468408=_0x81eb[_0x1aa6ab];return _0x468408;};'use strict';var _=require(_0xb81e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb81e('0x1'));var rs=require(_0xb81e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb81e('0x3'));var logger=require(_0xb81e('0x4'))('rpc');var config=require(_0xb81e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb81e('0x6')][_0xb81e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xff35db,_0x37531f,_0x521923){return new BPromise(function(_0x50aeb3,_0x57d4d8){return client['request'](_0xff35db,_0x521923)[_0xb81e('0x8')](function(_0x3a46e3){logger[_0xb81e('0x9')](_0xb81e('0xa'),_0x37531f,_0xb81e('0xb'));logger[_0xb81e('0xc')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x37531f,_0xb81e('0xb'),JSON[_0xb81e('0xd')](_0x3a46e3));if(_0x3a46e3['error']){if(_0x3a46e3['error'][_0xb81e('0xe')]===0x1f4){logger[_0xb81e('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x37531f,_0x3a46e3[_0xb81e('0xf')][_0xb81e('0x10')]);return _0x57d4d8(_0x3a46e3[_0xb81e('0xf')][_0xb81e('0x10')]);}logger['error'](_0xb81e('0xa'),_0x37531f,_0x3a46e3[_0xb81e('0xf')]['message']);return _0x50aeb3(_0x3a46e3[_0xb81e('0xf')][_0xb81e('0x10')]);}else{logger[_0xb81e('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x37531f,_0xb81e('0xb'));_0x50aeb3(_0x3a46e3[_0xb81e('0x11')][_0xb81e('0x10')]);}})[_0xb81e('0x12')](function(_0x2c5428){logger['error'](_0xb81e('0xa'),_0x37531f,_0x2c5428);_0x57d4d8(_0x2c5428);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 6e96f5d..4047f61 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 _0x803a=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x803a,0x151));var _0xa803=function(_0x1e0b07,_0x4d284f){_0x1e0b07=_0x1e0b07-0x0;var _0x541329=_0x803a[_0x1e0b07];return _0x541329;};'use strict';var multer=require('multer');var util=require(_0xa803('0x0'));var path=require(_0xa803('0x1'));var timeout=require(_0xa803('0x2'));var express=require(_0xa803('0x3'));var router=express[_0xa803('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa803('0x5'));var interaction=require(_0xa803('0x6'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0xa803('0x7')]('/',auth[_0xa803('0x8')](),controller[_0xa803('0x9')]);router['get']('/describe',auth[_0xa803('0x8')](),controller['describe']);router['get'](_0xa803('0xa'),auth[_0xa803('0x8')](),controller[_0xa803('0xb')]);router[_0xa803('0xc')]('/',auth[_0xa803('0x8')](),controller['create']);router[_0xa803('0xd')](_0xa803('0xa'),auth[_0xa803('0x8')](),controller[_0xa803('0xe')]);router[_0xa803('0xf')](_0xa803('0xa'),auth[_0xa803('0x8')](),controller[_0xa803('0x10')]);module[_0xa803('0x11')]=router; \ No newline at end of file +var _0x3409=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put'];(function(_0xd237c1,_0x28c2f1){var _0x3f86d9=function(_0x55ab0c){while(--_0x55ab0c){_0xd237c1['push'](_0xd237c1['shift']());}};_0x3f86d9(++_0x28c2f1);}(_0x3409,0xd3));var _0x9340=function(_0x9a9d49,_0x1e3432){_0x9a9d49=_0x9a9d49-0x0;var _0x48e3b9=_0x3409[_0x9a9d49];return _0x48e3b9;};'use strict';var multer=require(_0x9340('0x0'));var util=require('util');var path=require(_0x9340('0x1'));var timeout=require(_0x9340('0x2'));var express=require(_0x9340('0x3'));var router=express[_0x9340('0x4')]();var fs_extra=require(_0x9340('0x5'));var auth=require(_0x9340('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9340('0x7'));var controller=require(_0x9340('0x8'));router[_0x9340('0x9')]('/',auth[_0x9340('0xa')](),controller['index']);router['get'](_0x9340('0xb'),auth[_0x9340('0xa')](),controller[_0x9340('0xc')]);router[_0x9340('0x9')](_0x9340('0xd'),auth[_0x9340('0xa')](),controller['show']);router[_0x9340('0xe')]('/',auth[_0x9340('0xa')](),controller[_0x9340('0xf')]);router[_0x9340('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9340('0x11')](_0x9340('0xd'),auth[_0x9340('0xa')](),controller[_0x9340('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c144f80..d74ddfb 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 _0x16e4=['../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','util','path','connect-timeout','Router','fs-extra'];(function(_0x3fa404,_0x7742ec){var _0x52ad4a=function(_0x1688ef){while(--_0x1688ef){_0x3fa404['push'](_0x3fa404['shift']());}};_0x52ad4a(++_0x7742ec);}(_0x16e4,0x14b));var _0x416e=function(_0x58c9d6,_0x3d25f6){_0x58c9d6=_0x58c9d6-0x0;var _0x387344=_0x16e4[_0x58c9d6];return _0x387344;};'use strict';var multer=require('multer');var util=require(_0x416e('0x0'));var path=require(_0x416e('0x1'));var timeout=require(_0x416e('0x2'));var express=require('express');var router=express[_0x416e('0x3')]();var fs_extra=require(_0x416e('0x4'));var auth=require(_0x416e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x416e('0x6'));var controller=require(_0x416e('0x7'));router[_0x416e('0x8')]('/',auth[_0x416e('0x9')](),controller['index']);router[_0x416e('0x8')](_0x416e('0xa'),auth[_0x416e('0x9')](),controller[_0x416e('0xb')]);router[_0x416e('0x8')]('/:id/configurations',auth[_0x416e('0x9')](),controller[_0x416e('0xc')]);router['get'](_0x416e('0xd'),auth[_0x416e('0x9')](),controller[_0x416e('0xe')]);router[_0x416e('0xf')]('/',auth[_0x416e('0x9')](),controller[_0x416e('0x10')]);router[_0x416e('0xf')]('/:id/configurations',auth[_0x416e('0x9')](),controller[_0x416e('0x11')]);router[_0x416e('0x12')]('/:id',auth[_0x416e('0x9')](),controller[_0x416e('0x13')]);router['delete'](_0x416e('0xa'),auth[_0x416e('0x9')](),controller[_0x416e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4994=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','update','exports','util','connect-timeout','express','Router'];(function(_0x34b357,_0x219e90){var _0x598474=function(_0x34474a){while(--_0x34474a){_0x34b357['push'](_0x34b357['shift']());}};_0x598474(++_0x219e90);}(_0x4994,0x122));var _0x4499=function(_0x4aa269,_0x294bf7){_0x4aa269=_0x4aa269-0x0;var _0x2cd354=_0x4994[_0x4aa269];return _0x2cd354;};'use strict';var multer=require('multer');var util=require(_0x4499('0x0'));var path=require('path');var timeout=require(_0x4499('0x1'));var express=require(_0x4499('0x2'));var router=express[_0x4499('0x3')]();var fs_extra=require(_0x4499('0x4'));var auth=require(_0x4499('0x5'));var interaction=require(_0x4499('0x6'));var config=require(_0x4499('0x7'));var controller=require(_0x4499('0x8'));router['get']('/',auth[_0x4499('0x9')](),controller['index']);router[_0x4499('0xa')](_0x4499('0xb'),auth[_0x4499('0x9')](),controller['show']);router['get'](_0x4499('0xc'),auth[_0x4499('0x9')](),controller[_0x4499('0xd')]);router[_0x4499('0xa')](_0x4499('0xe'),auth[_0x4499('0x9')](),controller['getFields']);router['post']('/',auth[_0x4499('0x9')](),controller[_0x4499('0xf')]);router[_0x4499('0x10')](_0x4499('0xc'),auth[_0x4499('0x9')](),controller[_0x4499('0x11')]);router[_0x4499('0x12')](_0x4499('0xb'),auth['isAuthenticated'](),controller[_0x4499('0x13')]);router['delete'](_0x4499('0xb'),auth[_0x4499('0x9')](),controller['destroy']);module[_0x4499('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 eba95a3..263f91e 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 _0x3356=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x3356,0x16e));var _0x6335=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3356[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x6335('0x0'));module[_0x6335('0x1')]={'name':{'type':Sequelize[_0x6335('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6335('0x2')]},'remoteUri':{'type':Sequelize[_0x6335('0x2')]},'authType':{'type':Sequelize[_0x6335('0x3')](_0x6335('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x6335('0x2')]},'consumerSecret':{'type':Sequelize[_0x6335('0x2')]},'token':{'type':Sequelize[_0x6335('0x2')]},'tokenSecret':{'type':Sequelize[_0x6335('0x2')]},'serverUrl':{'type':Sequelize[_0x6335('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6335('0x3')](_0x6335('0x5'),_0x6335('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x0044=['STRING','ENUM','basic','newTab','integrationTab','sequelize','exports'];(function(_0x1a6bb1,_0x12deb7){var _0x39d839=function(_0x1da365){while(--_0x1da365){_0x1a6bb1['push'](_0x1a6bb1['shift']());}};_0x39d839(++_0x12deb7);}(_0x0044,0x17f));var _0x4004=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x0044[_0x879e31];return _0x3467e8;};'use strict';var Sequelize=require(_0x4004('0x0'));module[_0x4004('0x1')]={'name':{'type':Sequelize[_0x4004('0x2')]},'description':{'type':Sequelize[_0x4004('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4004('0x2')]},'authType':{'type':Sequelize[_0x4004('0x3')](_0x4004('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x4004('0x2')]},'consumerKey':{'type':Sequelize[_0x4004('0x2')]},'consumerSecret':{'type':Sequelize[_0x4004('0x2')]},'token':{'type':Sequelize[_0x4004('0x2')]},'tokenSecret':{'type':Sequelize[_0x4004('0x2')]},'serverUrl':{'type':Sequelize[_0x4004('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x4004('0x5')),'defaultValue':_0x4004('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f00a917..83529d1 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 _0x9aab=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','find','destroy','getConfigurations','findOne','DeskConfiguration','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','Authorization','Basic\x20%s','%s:%s','toString','base64','_embedded','active','label','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order'];(function(_0x5c38a2,_0x9979d6){var _0xe72404=function(_0x69962a){while(--_0x69962a){_0x5c38a2['push'](_0x5c38a2['shift']());}};_0xe72404(++_0x9979d6);}(_0x9aab,0x112));var _0xb9aa=function(_0xe3f172,_0x385476){_0xe3f172=_0xe3f172-0x0;var _0x247b16=_0x9aab[_0xe3f172];return _0x247b16;};'use strict';var emlformat=require(_0xb9aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb9aa('0x1'));var jsonpatch=require(_0xb9aa('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb9aa('0x3'));var Mustache=require(_0xb9aa('0x4'));var util=require(_0xb9aa('0x5'));var path=require(_0xb9aa('0x6'));var sox=require(_0xb9aa('0x7'));var csv=require(_0xb9aa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9aa('0x9'));var _=require('lodash');var squel=require(_0xb9aa('0xa'));var crypto=require(_0xb9aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb9aa('0xc'));var toCsv=require(_0xb9aa('0x8'));var querystring=require(_0xb9aa('0xd'));var Papa=require('papaparse');var Redis=require(_0xb9aa('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb9aa('0xf'));var as=require(_0xb9aa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb9aa('0x11'));var utils=require(_0xb9aa('0x12'));var config=require(_0xb9aa('0x13'));var licenseUtil=require(_0xb9aa('0x14'));var db=require(_0xb9aa('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x380ba2,_0xc2a42e){_0xc2a42e=_0xc2a42e||0xcc;return function(_0xc3e5db){if(_0xc3e5db){return _0x380ba2[_0xb9aa('0x16')](_0xc2a42e);}return _0x380ba2['status'](_0xc2a42e)[_0xb9aa('0x17')]();};}function respondWithResult(_0x358cc6,_0x4756b5){_0x4756b5=_0x4756b5||0xc8;return function(_0x5ce47e){if(_0x5ce47e){return _0x358cc6[_0xb9aa('0x18')](_0x4756b5)[_0xb9aa('0x19')](_0x5ce47e);}};}function respondWithFilteredResult(_0xf35415,_0x2c5035){return function(_0x55b8a8){if(_0x55b8a8){var _0x260e35=typeof _0x2c5035[_0xb9aa('0x1a')]===_0xb9aa('0x1b')&&typeof _0x2c5035[_0xb9aa('0x1c')]===_0xb9aa('0x1b');var _0x1b8caf=_0x55b8a8[_0xb9aa('0x1d')];var _0x5ea372=_0x260e35?0x0:_0x2c5035[_0xb9aa('0x1a')];var _0x33006f=_0x260e35?_0x55b8a8[_0xb9aa('0x1d')]:_0x2c5035[_0xb9aa('0x1a')]+_0x2c5035[_0xb9aa('0x1c')];var _0x445dbf;if(_0x33006f>=_0x1b8caf){_0x33006f=_0x1b8caf;_0x445dbf=0xc8;}else{_0x445dbf=0xce;}_0xf35415[_0xb9aa('0x18')](_0x445dbf);return _0xf35415[_0xb9aa('0x1e')]('Content-Range',_0x5ea372+'-'+_0x33006f+'/'+_0x1b8caf)[_0xb9aa('0x19')](_0x55b8a8);}return null;};}function patchUpdates(_0x28ec7a){return function(_0x575e46){try{jsonpatch[_0xb9aa('0x1f')](_0x575e46,_0x28ec7a,!![]);}catch(_0x40a1ab){return BPromise[_0xb9aa('0x20')](_0x40a1ab);}return _0x575e46[_0xb9aa('0x21')]();};}function saveUpdates(_0x15d994,_0x4f27b6){return function(_0x20d1da){if(_0x20d1da){return _0x20d1da[_0xb9aa('0x22')](_0x15d994)['then'](function(_0x1ee41a){return _0x1ee41a;});}return null;};}function removeEntity(_0x4b10a3,_0x294092){return function(_0x25fa8c){if(_0x25fa8c){return _0x25fa8c['destroy']()[_0xb9aa('0x23')](function(){_0x4b10a3[_0xb9aa('0x18')](0xcc)[_0xb9aa('0x17')]();});}};}function handleEntityNotFound(_0x45242a,_0x2c3683){return function(_0x4dbd38){if(!_0x4dbd38){_0x45242a[_0xb9aa('0x16')](0x194);}return _0x4dbd38;};}function handleError(_0x13b6ce,_0x2d32d6){_0x2d32d6=_0x2d32d6||0x1f4;return function(_0x1178f4){logger[_0xb9aa('0x24')](_0x1178f4[_0xb9aa('0x25')]);if(_0x1178f4[_0xb9aa('0x26')]){delete _0x1178f4[_0xb9aa('0x26')];}_0x13b6ce[_0xb9aa('0x18')](_0x2d32d6)[_0xb9aa('0x27')](_0x1178f4);};}exports['index']=function(_0x3c58c5,_0x17e14d){var _0x378fc4={},_0x852dec={},_0x525a5b={'count':0x0,'rows':[]};var _0x5eeb50=_[_0xb9aa('0x28')](db[_0xb9aa('0x29')][_0xb9aa('0x2a')],function(_0x4ff10e){return{'name':_0x4ff10e[_0xb9aa('0x2b')],'type':_0x4ff10e[_0xb9aa('0x2c')][_0xb9aa('0x2d')]};});_0x852dec['model']=_[_0xb9aa('0x28')](_0x5eeb50,_0xb9aa('0x26'));_0x852dec[_0xb9aa('0x2e')]=_[_0xb9aa('0x2f')](_0x3c58c5['query']);_0x852dec[_0xb9aa('0x30')]=_[_0xb9aa('0x31')](_0x852dec[_0xb9aa('0x32')],_0x852dec[_0xb9aa('0x2e')]);_0x378fc4[_0xb9aa('0x33')]=_[_0xb9aa('0x31')](_0x852dec[_0xb9aa('0x32')],qs[_0xb9aa('0x34')](_0x3c58c5[_0xb9aa('0x2e')][_0xb9aa('0x34')]));_0x378fc4['attributes']=_0x378fc4['attributes'][_0xb9aa('0x35')]?_0x378fc4['attributes']:_0x852dec[_0xb9aa('0x32')];if(!_0x3c58c5['query'][_0xb9aa('0x36')]('nolimit')){_0x378fc4[_0xb9aa('0x1c')]=qs[_0xb9aa('0x1c')](_0x3c58c5['query'][_0xb9aa('0x1c')]);_0x378fc4[_0xb9aa('0x1a')]=qs['offset'](_0x3c58c5['query'][_0xb9aa('0x1a')]);}_0x378fc4[_0xb9aa('0x37')]=qs[_0xb9aa('0x38')](_0x3c58c5['query'][_0xb9aa('0x38')]);_0x378fc4[_0xb9aa('0x39')]=qs[_0xb9aa('0x30')](_[_0xb9aa('0x3a')](_0x3c58c5[_0xb9aa('0x2e')],_0x852dec[_0xb9aa('0x30')]),_0x5eeb50);if(_0x3c58c5['query'][_0xb9aa('0x3b')]){_0x378fc4['where']=_[_0xb9aa('0x3c')](_0x378fc4['where'],{'$or':_[_0xb9aa('0x28')](_0x5eeb50,function(_0x151565){if(_0x151565['type']!==_0xb9aa('0x3d')){var _0x4c09d0={};_0x4c09d0[_0x151565[_0xb9aa('0x26')]]={'$like':'%'+_0x3c58c5[_0xb9aa('0x2e')]['filter']+'%'};return _0x4c09d0;}})});}_0x378fc4=_['merge']({},_0x378fc4,_0x3c58c5[_0xb9aa('0x3e')]);var _0x554c56={'where':_0x378fc4['where']};return db['DeskAccount'][_0xb9aa('0x1d')](_0x554c56)['then'](function(_0x198492){_0x525a5b[_0xb9aa('0x1d')]=_0x198492;if(_0x3c58c5[_0xb9aa('0x2e')][_0xb9aa('0x3f')]){_0x378fc4[_0xb9aa('0x40')]=[{'all':!![]}];}return db['DeskAccount'][_0xb9aa('0x41')](_0x378fc4);})['then'](function(_0x37fb37){_0x525a5b['rows']=_0x37fb37;return _0x525a5b;})['then'](respondWithFilteredResult(_0x17e14d,_0x378fc4))[_0xb9aa('0x42')](handleError(_0x17e14d,null));};exports['show']=function(_0x550fa3,_0x542c22){var _0x5f1ed2={'raw':![],'where':{'id':_0x550fa3[_0xb9aa('0x43')]['id']}},_0x4b0ad9={};_0x4b0ad9[_0xb9aa('0x32')]=_['keys'](db['DeskAccount'][_0xb9aa('0x2a')]);_0x4b0ad9[_0xb9aa('0x2e')]=_['keys'](_0x550fa3[_0xb9aa('0x2e')]);_0x4b0ad9[_0xb9aa('0x30')]=_[_0xb9aa('0x31')](_0x4b0ad9[_0xb9aa('0x32')],_0x4b0ad9[_0xb9aa('0x2e')]);_0x5f1ed2[_0xb9aa('0x33')]=_[_0xb9aa('0x31')](_0x4b0ad9[_0xb9aa('0x32')],qs[_0xb9aa('0x34')](_0x550fa3[_0xb9aa('0x2e')][_0xb9aa('0x34')]));_0x5f1ed2[_0xb9aa('0x33')]=_0x5f1ed2['attributes'][_0xb9aa('0x35')]?_0x5f1ed2[_0xb9aa('0x33')]:_0x4b0ad9[_0xb9aa('0x32')];if(_0x550fa3[_0xb9aa('0x2e')][_0xb9aa('0x3f')]){_0x5f1ed2[_0xb9aa('0x40')]=[{'all':!![]}];}_0x5f1ed2=_['merge']({},_0x5f1ed2,_0x550fa3['options']);return db[_0xb9aa('0x29')]['find'](_0x5f1ed2)[_0xb9aa('0x23')](handleEntityNotFound(_0x542c22,null))[_0xb9aa('0x23')](respondWithResult(_0x542c22,null))[_0xb9aa('0x42')](handleError(_0x542c22,null));};exports[_0xb9aa('0x44')]=function(_0x2c138d,_0x414b5f){return db['DeskAccount'][_0xb9aa('0x44')](_0x2c138d[_0xb9aa('0x45')],{})['then'](respondWithResult(_0x414b5f,0xc9))[_0xb9aa('0x42')](handleError(_0x414b5f,null));};exports[_0xb9aa('0x22')]=function(_0x22de0c,_0x428df1){if(_0x22de0c[_0xb9aa('0x45')]['id']){delete _0x22de0c[_0xb9aa('0x45')]['id'];}return db[_0xb9aa('0x29')][_0xb9aa('0x46')]({'where':{'id':_0x22de0c[_0xb9aa('0x43')]['id']}})[_0xb9aa('0x23')](handleEntityNotFound(_0x428df1,null))['then'](saveUpdates(_0x22de0c[_0xb9aa('0x45')],null))[_0xb9aa('0x23')](respondWithResult(_0x428df1,null))[_0xb9aa('0x42')](handleError(_0x428df1,null));};exports[_0xb9aa('0x47')]=function(_0x2dc94b,_0x22e099){return db[_0xb9aa('0x29')]['find']({'where':{'id':_0x2dc94b[_0xb9aa('0x43')]['id']}})[_0xb9aa('0x23')](handleEntityNotFound(_0x22e099,null))[_0xb9aa('0x23')](removeEntity(_0x22e099,null))[_0xb9aa('0x42')](handleError(_0x22e099,null));};exports[_0xb9aa('0x48')]=function(_0x128c51,_0x3ed5d6,_0x2095b3){var _0x1ea8f5={};var _0x44ce8e={};var _0x5c750a;var _0xa04c2e;return db[_0xb9aa('0x29')][_0xb9aa('0x49')]({'where':{'id':_0x128c51['params']['id']}})[_0xb9aa('0x23')](handleEntityNotFound(_0x3ed5d6,null))[_0xb9aa('0x23')](function(_0x22d4f0){if(_0x22d4f0){_0x5c750a=_0x22d4f0;_0x44ce8e['model']=_[_0xb9aa('0x2f')](db[_0xb9aa('0x4a')][_0xb9aa('0x2a')]);_0x44ce8e['query']=_[_0xb9aa('0x2f')](_0x128c51[_0xb9aa('0x2e')]);_0x44ce8e['filters']=_[_0xb9aa('0x31')](_0x44ce8e[_0xb9aa('0x32')],_0x44ce8e[_0xb9aa('0x2e')]);_0x1ea8f5[_0xb9aa('0x33')]=_[_0xb9aa('0x31')](_0x44ce8e['model'],qs['fields'](_0x128c51['query'][_0xb9aa('0x34')]));_0x1ea8f5[_0xb9aa('0x33')]=_0x1ea8f5[_0xb9aa('0x33')][_0xb9aa('0x35')]?_0x1ea8f5['attributes']:_0x44ce8e['model'];_0x1ea8f5[_0xb9aa('0x37')]=qs[_0xb9aa('0x38')](_0x128c51[_0xb9aa('0x2e')]['sort']);_0x1ea8f5[_0xb9aa('0x39')]=qs[_0xb9aa('0x30')](_['pick'](_0x128c51['query'],_0x44ce8e[_0xb9aa('0x30')]));if(_0x128c51[_0xb9aa('0x2e')][_0xb9aa('0x3b')]){_0x1ea8f5[_0xb9aa('0x39')]=_[_0xb9aa('0x3c')](_0x1ea8f5['where'],{'$or':_[_0xb9aa('0x28')](_0x1ea8f5[_0xb9aa('0x33')],function(_0x23a5c4){var _0xf65e32={};_0xf65e32[_0x23a5c4]={'$like':'%'+_0x128c51[_0xb9aa('0x2e')][_0xb9aa('0x3b')]+'%'};return _0xf65e32;})});}_0x1ea8f5=_['merge']({},_0x1ea8f5,_0x128c51['options']);return _0x5c750a[_0xb9aa('0x48')](_0x1ea8f5);}})['then'](function(_0x2ea5bf){if(_0x2ea5bf){_0xa04c2e=_0x2ea5bf['length'];if(!_0x128c51['query']['hasOwnProperty'](_0xb9aa('0x4b'))){_0x1ea8f5['limit']=qs[_0xb9aa('0x1c')](_0x128c51[_0xb9aa('0x2e')][_0xb9aa('0x1c')]);_0x1ea8f5[_0xb9aa('0x1a')]=qs[_0xb9aa('0x1a')](_0x128c51[_0xb9aa('0x2e')][_0xb9aa('0x1a')]);}return _0x5c750a[_0xb9aa('0x48')](_0x1ea8f5);}})['then'](function(_0x13ee1d){if(_0x13ee1d){return _0x13ee1d?{'count':_0xa04c2e,'rows':_0x13ee1d}:null;}})[_0xb9aa('0x23')](respondWithResult(_0x3ed5d6,null))[_0xb9aa('0x42')](handleError(_0x3ed5d6,null));};exports['addConfiguration']=function(_0x3b5e71,_0xffdedd,_0x3d10ee){if(_0x3b5e71['body']['id']){delete _0x3b5e71[_0xb9aa('0x45')]['id'];}return db['DeskAccount'][_0xb9aa('0x49')]({'where':{'id':_0x3b5e71[_0xb9aa('0x43')]['id']}})['then'](handleEntityNotFound(_0xffdedd,null))['then'](function(_0x523684){if(_0x523684){_0x3b5e71[_0xb9aa('0x45')][_0xb9aa('0x4c')]=_0x523684['id'];_0x3b5e71[_0xb9aa('0x45')]['Subjects']=integrations[_0xb9aa('0x4d')](_0x3b5e71[_0xb9aa('0x45')][_0xb9aa('0x4e')],_0x3b5e71[_0xb9aa('0x45')][_0xb9aa('0x2c')]);_0x3b5e71[_0xb9aa('0x45')][_0xb9aa('0x4f')]=integrations[_0xb9aa('0x50')](_0x3b5e71[_0xb9aa('0x45')][_0xb9aa('0x4e')],_0x3b5e71['body'][_0xb9aa('0x2c')]);return db[_0xb9aa('0x4a')][_0xb9aa('0x44')](_0x3b5e71[_0xb9aa('0x45')],{'include':[{'model':db[_0xb9aa('0x51')],'as':_0xb9aa('0x52')},{'model':db['DeskField'],'as':_0xb9aa('0x4f')}]});}return null;})[_0xb9aa('0x23')](respondWithResult(_0xffdedd,null))['catch'](handleError(_0xffdedd,null));};exports[_0xb9aa('0x53')]=function(_0x3cea4a,_0x12e4a8,_0x59b030){var _0x1876b0=[{'name':_0xb9aa('0x54'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4085e7='';return db[_0xb9aa('0x29')][_0xb9aa('0x49')]({'where':{'id':_0x3cea4a[_0xb9aa('0x43')]['id']},'attributes':['id',_0xb9aa('0x55'),'authType',_0xb9aa('0x56'),_0xb9aa('0x57'),_0xb9aa('0x58'),_0xb9aa('0x59'),_0xb9aa('0x5a'),'tokenSecret']})[_0xb9aa('0x23')](handleEntityNotFound(_0x12e4a8,null))[_0xb9aa('0x23')](function(_0x320563){if(_0x320563){_0x4085e7=_0x320563[_0xb9aa('0x55')];var _0x3b8757=_0x4085e7[_0xb9aa('0x5b')](-0x1);if(_0x3b8757==='/'){_0x4085e7=_0x4085e7[_0xb9aa('0x5c')](0x0,_0x4085e7[_0xb9aa('0x5d')](_0x3b8757));}var _0x407e4a={'method':_0xb9aa('0x5e'),'uri':util[_0xb9aa('0x5f')](_0xb9aa('0x60'),_0x4085e7),'headers':{'Content-Type':_0xb9aa('0x61'),'Accept':_0xb9aa('0x61')},'json':!![]};if(_0x320563[_0xb9aa('0x62')]==='basic'){_0x407e4a['headers'][_0xb9aa('0x63')]=util[_0xb9aa('0x5f')](_0xb9aa('0x64'),new Buffer(util['format'](_0xb9aa('0x65'),_0x320563[_0xb9aa('0x56')],_0x320563[_0xb9aa('0x57')]))[_0xb9aa('0x66')](_0xb9aa('0x67')));}return rp(_0x407e4a)[_0xb9aa('0x23')](function(_0x256dbd){return _0x1876b0['concat'](_[_0xb9aa('0x28')](_0x256dbd[_0xb9aa('0x68')]['entries'],function(_0x5426a3){return{'id':_0x5426a3[_0xb9aa('0x26')],'name':_0x5426a3[_0xb9aa('0x26')],'type':_0x5426a3[_0xb9aa('0x2c')],'active':_0x5426a3[_0xb9aa('0x69')],'label':_0x5426a3[_0xb9aa('0x6a')],'custom':!![]};}));});}})[_0xb9aa('0x23')](function(_0xa22e8a){return{'count':_0xa22e8a[_0xb9aa('0x35')],'rows':_0xa22e8a};})['then'](respondWithResult(_0x12e4a8,null))['catch'](function(_0x1bbd11){var _0x5405db=_0x3cea4a['query']['test']?0x1f4:_0x1bbd11['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb9aa('0x53'),_0x5405db,JSON[_0xb9aa('0x6b')](_0x1bbd11));delete _0x1bbd11[_0xb9aa('0x26')];if(_0x5405db===0x191){_0x5405db=0x190;}_0x12e4a8[_0xb9aa('0x18')](_0x5405db)[_0xb9aa('0x27')](_0x3cea4a[_0xb9aa('0x2e')]['test']?{'message':_0xb9aa('0x6c'),'statusCode':_0x1bbd11[_0xb9aa('0x6d')]}:_0x1bbd11);});}; \ No newline at end of file +var _0x55b3=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','index','map','DeskAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','getSubjects','channel','DeskField','Descriptions','getFields','priority','authType','username','password','consumerKey','consumerSecret','token','remoteUri','slice','substring','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','base64','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x2b20c1,_0x2272d8){var _0x2728d9=function(_0x46d098){while(--_0x46d098){_0x2b20c1['push'](_0x2b20c1['shift']());}};_0x2728d9(++_0x2272d8);}(_0x55b3,0xda));var _0x355b=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x55b3[_0x307d86];return _0x361745;};'use strict';var emlformat=require(_0x355b('0x0'));var rimraf=require(_0x355b('0x1'));var zipdir=require(_0x355b('0x2'));var jsonpatch=require(_0x355b('0x3'));var rp=require(_0x355b('0x4'));var moment=require(_0x355b('0x5'));var BPromise=require(_0x355b('0x6'));var Mustache=require(_0x355b('0x7'));var util=require(_0x355b('0x8'));var path=require(_0x355b('0x9'));var sox=require('sox');var csv=require(_0x355b('0xa'));var ejs=require(_0x355b('0xb'));var fs=require('fs');var fs_extra=require(_0x355b('0xc'));var _=require(_0x355b('0xd'));var squel=require(_0x355b('0xe'));var crypto=require(_0x355b('0xf'));var jsforce=require(_0x355b('0x10'));var deskjs=require(_0x355b('0x11'));var toCsv=require(_0x355b('0xa'));var querystring=require(_0x355b('0x12'));var Papa=require(_0x355b('0x13'));var Redis=require(_0x355b('0x14'));var authService=require(_0x355b('0x15'));var qs=require(_0x355b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x355b('0x17'))(_0x355b('0x18'));var utils=require(_0x355b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x355b('0x1a'));var db=require(_0x355b('0x1b'))['db'];var integrations=require(_0x355b('0x1c'));function respondWithStatusCode(_0x2d8b21,_0x3f2ff2){_0x3f2ff2=_0x3f2ff2||0xcc;return function(_0x35e918){if(_0x35e918){return _0x2d8b21[_0x355b('0x1d')](_0x3f2ff2);}return _0x2d8b21[_0x355b('0x1e')](_0x3f2ff2)['end']();};}function respondWithResult(_0x115776,_0x1b05b8){_0x1b05b8=_0x1b05b8||0xc8;return function(_0x522e36){if(_0x522e36){return _0x115776[_0x355b('0x1e')](_0x1b05b8)[_0x355b('0x1f')](_0x522e36);}};}function respondWithFilteredResult(_0x328757,_0x48abe6){return function(_0x4a8bde){if(_0x4a8bde){var _0x4a2e5d=typeof _0x48abe6[_0x355b('0x20')]===_0x355b('0x21')&&typeof _0x48abe6[_0x355b('0x22')]===_0x355b('0x21');var _0x52baf9=_0x4a8bde['count'];var _0x2847e1=_0x4a2e5d?0x0:_0x48abe6[_0x355b('0x20')];var _0x311feb=_0x4a2e5d?_0x4a8bde['count']:_0x48abe6['offset']+_0x48abe6[_0x355b('0x22')];var _0x53c787;if(_0x311feb>=_0x52baf9){_0x311feb=_0x52baf9;_0x53c787=0xc8;}else{_0x53c787=0xce;}_0x328757['status'](_0x53c787);return _0x328757[_0x355b('0x23')](_0x355b('0x24'),_0x2847e1+'-'+_0x311feb+'/'+_0x52baf9)['json'](_0x4a8bde);}return null;};}function patchUpdates(_0x40943e){return function(_0x564ac6){try{jsonpatch[_0x355b('0x25')](_0x564ac6,_0x40943e,!![]);}catch(_0x4d681b){return BPromise[_0x355b('0x26')](_0x4d681b);}return _0x564ac6[_0x355b('0x27')]();};}function saveUpdates(_0x256ea9,_0x48d2cd){return function(_0x3e19e6){if(_0x3e19e6){return _0x3e19e6[_0x355b('0x28')](_0x256ea9)['then'](function(_0x473e95){return _0x473e95;});}return null;};}function removeEntity(_0x184d4d,_0x2db562){return function(_0x27865b){if(_0x27865b){return _0x27865b[_0x355b('0x29')]()[_0x355b('0x2a')](function(){_0x184d4d[_0x355b('0x1e')](0xcc)[_0x355b('0x2b')]();});}};}function handleEntityNotFound(_0x6f077f,_0x2a2bb5){return function(_0x5eed40){if(!_0x5eed40){_0x6f077f[_0x355b('0x1d')](0x194);}return _0x5eed40;};}function handleError(_0x218417,_0xf5926){_0xf5926=_0xf5926||0x1f4;return function(_0x2fb720){logger[_0x355b('0x2c')](_0x2fb720['stack']);if(_0x2fb720[_0x355b('0x2d')]){delete _0x2fb720[_0x355b('0x2d')];}_0x218417[_0x355b('0x1e')](_0xf5926)[_0x355b('0x2e')](_0x2fb720);};}exports[_0x355b('0x2f')]=function(_0x4db026,_0x278e19){var _0x52e3a0={},_0x3486a2={},_0x2f8568={'count':0x0,'rows':[]};var _0x374dbc=_[_0x355b('0x30')](db[_0x355b('0x31')][_0x355b('0x32')],function(_0x245b1c){return{'name':_0x245b1c['fieldName'],'type':_0x245b1c['type'][_0x355b('0x33')]};});_0x3486a2[_0x355b('0x34')]=_['map'](_0x374dbc,_0x355b('0x2d'));_0x3486a2[_0x355b('0x35')]=_[_0x355b('0x36')](_0x4db026[_0x355b('0x35')]);_0x3486a2[_0x355b('0x37')]=_[_0x355b('0x38')](_0x3486a2[_0x355b('0x34')],_0x3486a2[_0x355b('0x35')]);_0x52e3a0['attributes']=_[_0x355b('0x38')](_0x3486a2[_0x355b('0x34')],qs[_0x355b('0x39')](_0x4db026[_0x355b('0x35')][_0x355b('0x39')]));_0x52e3a0[_0x355b('0x3a')]=_0x52e3a0[_0x355b('0x3a')][_0x355b('0x3b')]?_0x52e3a0[_0x355b('0x3a')]:_0x3486a2['model'];if(!_0x4db026[_0x355b('0x35')][_0x355b('0x3c')]('nolimit')){_0x52e3a0[_0x355b('0x22')]=qs['limit'](_0x4db026[_0x355b('0x35')][_0x355b('0x22')]);_0x52e3a0['offset']=qs['offset'](_0x4db026[_0x355b('0x35')][_0x355b('0x20')]);}_0x52e3a0[_0x355b('0x3d')]=qs[_0x355b('0x3e')](_0x4db026['query']['sort']);_0x52e3a0[_0x355b('0x3f')]=qs[_0x355b('0x37')](_[_0x355b('0x40')](_0x4db026[_0x355b('0x35')],_0x3486a2[_0x355b('0x37')]),_0x374dbc);if(_0x4db026[_0x355b('0x35')][_0x355b('0x41')]){_0x52e3a0[_0x355b('0x3f')]=_[_0x355b('0x42')](_0x52e3a0[_0x355b('0x3f')],{'$or':_['map'](_0x374dbc,function(_0x513653){if(_0x513653[_0x355b('0x43')]!==_0x355b('0x44')){var _0x4aad3b={};_0x4aad3b[_0x513653[_0x355b('0x2d')]]={'$like':'%'+_0x4db026[_0x355b('0x35')][_0x355b('0x41')]+'%'};return _0x4aad3b;}})});}_0x52e3a0=_[_0x355b('0x42')]({},_0x52e3a0,_0x4db026[_0x355b('0x45')]);var _0x52991d={'where':_0x52e3a0[_0x355b('0x3f')]};return db[_0x355b('0x31')]['count'](_0x52991d)[_0x355b('0x2a')](function(_0x3bcd06){_0x2f8568['count']=_0x3bcd06;if(_0x4db026[_0x355b('0x35')][_0x355b('0x46')]){_0x52e3a0[_0x355b('0x47')]=[{'all':!![]}];}return db['DeskAccount'][_0x355b('0x48')](_0x52e3a0);})[_0x355b('0x2a')](function(_0x7b7347){_0x2f8568['rows']=_0x7b7347;return _0x2f8568;})['then'](respondWithFilteredResult(_0x278e19,_0x52e3a0))[_0x355b('0x49')](handleError(_0x278e19,null));};exports[_0x355b('0x4a')]=function(_0x48f424,_0x2ed536){var _0x333782={'raw':![],'where':{'id':_0x48f424[_0x355b('0x4b')]['id']}},_0x7c9790={};_0x7c9790['model']=_[_0x355b('0x36')](db[_0x355b('0x31')]['rawAttributes']);_0x7c9790[_0x355b('0x35')]=_[_0x355b('0x36')](_0x48f424['query']);_0x7c9790[_0x355b('0x37')]=_['intersection'](_0x7c9790[_0x355b('0x34')],_0x7c9790['query']);_0x333782['attributes']=_[_0x355b('0x38')](_0x7c9790[_0x355b('0x34')],qs[_0x355b('0x39')](_0x48f424[_0x355b('0x35')][_0x355b('0x39')]));_0x333782[_0x355b('0x3a')]=_0x333782['attributes'][_0x355b('0x3b')]?_0x333782['attributes']:_0x7c9790[_0x355b('0x34')];if(_0x48f424[_0x355b('0x35')]['includeAll']){_0x333782[_0x355b('0x47')]=[{'all':!![]}];}_0x333782=_[_0x355b('0x42')]({},_0x333782,_0x48f424[_0x355b('0x45')]);return db['DeskAccount'][_0x355b('0x4c')](_0x333782)[_0x355b('0x2a')](handleEntityNotFound(_0x2ed536,null))[_0x355b('0x2a')](respondWithResult(_0x2ed536,null))[_0x355b('0x49')](handleError(_0x2ed536,null));};exports[_0x355b('0x4d')]=function(_0xdf2310,_0x5c41f4){return db['DeskAccount'][_0x355b('0x4d')](_0xdf2310[_0x355b('0x4e')],{})[_0x355b('0x2a')](respondWithResult(_0x5c41f4,0xc9))[_0x355b('0x49')](handleError(_0x5c41f4,null));};exports[_0x355b('0x28')]=function(_0x523400,_0x51c82f){if(_0x523400['body']['id']){delete _0x523400[_0x355b('0x4e')]['id'];}return db['DeskAccount'][_0x355b('0x4c')]({'where':{'id':_0x523400[_0x355b('0x4b')]['id']}})[_0x355b('0x2a')](handleEntityNotFound(_0x51c82f,null))[_0x355b('0x2a')](saveUpdates(_0x523400[_0x355b('0x4e')],null))['then'](respondWithResult(_0x51c82f,null))[_0x355b('0x49')](handleError(_0x51c82f,null));};exports[_0x355b('0x29')]=function(_0x571016,_0x5de828){return db[_0x355b('0x31')][_0x355b('0x4c')]({'where':{'id':_0x571016[_0x355b('0x4b')]['id']}})[_0x355b('0x2a')](handleEntityNotFound(_0x5de828,null))[_0x355b('0x2a')](removeEntity(_0x5de828,null))['catch'](handleError(_0x5de828,null));};exports[_0x355b('0x4f')]=function(_0x5217bc,_0x2f028d,_0x40b792){var _0x436b8={};var _0x21a8a4={};var _0x5325d9;var _0x5c5132;return db[_0x355b('0x31')][_0x355b('0x50')]({'where':{'id':_0x5217bc[_0x355b('0x4b')]['id']}})[_0x355b('0x2a')](handleEntityNotFound(_0x2f028d,null))[_0x355b('0x2a')](function(_0x549a61){if(_0x549a61){_0x5325d9=_0x549a61;_0x21a8a4[_0x355b('0x34')]=_[_0x355b('0x36')](db[_0x355b('0x51')][_0x355b('0x32')]);_0x21a8a4[_0x355b('0x35')]=_[_0x355b('0x36')](_0x5217bc[_0x355b('0x35')]);_0x21a8a4[_0x355b('0x37')]=_[_0x355b('0x38')](_0x21a8a4[_0x355b('0x34')],_0x21a8a4[_0x355b('0x35')]);_0x436b8[_0x355b('0x3a')]=_[_0x355b('0x38')](_0x21a8a4[_0x355b('0x34')],qs[_0x355b('0x39')](_0x5217bc[_0x355b('0x35')][_0x355b('0x39')]));_0x436b8[_0x355b('0x3a')]=_0x436b8['attributes'][_0x355b('0x3b')]?_0x436b8[_0x355b('0x3a')]:_0x21a8a4[_0x355b('0x34')];_0x436b8[_0x355b('0x3d')]=qs['sort'](_0x5217bc[_0x355b('0x35')][_0x355b('0x3e')]);_0x436b8[_0x355b('0x3f')]=qs[_0x355b('0x37')](_[_0x355b('0x40')](_0x5217bc[_0x355b('0x35')],_0x21a8a4[_0x355b('0x37')]));if(_0x5217bc[_0x355b('0x35')]['filter']){_0x436b8[_0x355b('0x3f')]=_[_0x355b('0x42')](_0x436b8[_0x355b('0x3f')],{'$or':_[_0x355b('0x30')](_0x436b8[_0x355b('0x3a')],function(_0x32b407){var _0x55f2d1={};_0x55f2d1[_0x32b407]={'$like':'%'+_0x5217bc['query'][_0x355b('0x41')]+'%'};return _0x55f2d1;})});}_0x436b8=_['merge']({},_0x436b8,_0x5217bc[_0x355b('0x45')]);return _0x5325d9[_0x355b('0x4f')](_0x436b8);}})[_0x355b('0x2a')](function(_0x18855f){if(_0x18855f){_0x5c5132=_0x18855f[_0x355b('0x3b')];if(!_0x5217bc[_0x355b('0x35')][_0x355b('0x3c')]('nolimit')){_0x436b8[_0x355b('0x22')]=qs[_0x355b('0x22')](_0x5217bc[_0x355b('0x35')]['limit']);_0x436b8[_0x355b('0x20')]=qs[_0x355b('0x20')](_0x5217bc[_0x355b('0x35')][_0x355b('0x20')]);}return _0x5325d9[_0x355b('0x4f')](_0x436b8);}})[_0x355b('0x2a')](function(_0x28bd37){if(_0x28bd37){return _0x28bd37?{'count':_0x5c5132,'rows':_0x28bd37}:null;}})[_0x355b('0x2a')](respondWithResult(_0x2f028d,null))[_0x355b('0x49')](handleError(_0x2f028d,null));};exports['addConfiguration']=function(_0x4f3386,_0x27dc47,_0x4e0173){if(_0x4f3386[_0x355b('0x4e')]['id']){delete _0x4f3386['body']['id'];}return db[_0x355b('0x31')][_0x355b('0x50')]({'where':{'id':_0x4f3386[_0x355b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x27dc47,null))[_0x355b('0x2a')](function(_0xb9c701){if(_0xb9c701){_0x4f3386[_0x355b('0x4e')][_0x355b('0x52')]=_0xb9c701['id'];_0x4f3386[_0x355b('0x4e')][_0x355b('0x53')]=integrations[_0x355b('0x54')](_0x4f3386[_0x355b('0x4e')][_0x355b('0x55')],_0x4f3386[_0x355b('0x4e')][_0x355b('0x43')]);_0x4f3386[_0x355b('0x4e')]['Descriptions']=integrations['getDescriptions'](_0x4f3386[_0x355b('0x4e')][_0x355b('0x55')],_0x4f3386['body'][_0x355b('0x43')]);return db[_0x355b('0x51')][_0x355b('0x4d')](_0x4f3386[_0x355b('0x4e')],{'include':[{'model':db[_0x355b('0x56')],'as':'Subjects'},{'model':db[_0x355b('0x56')],'as':_0x355b('0x57')}]});}return null;})[_0x355b('0x2a')](respondWithResult(_0x27dc47,null))[_0x355b('0x49')](handleError(_0x27dc47,null));};exports[_0x355b('0x58')]=function(_0xaf77d6,_0xf14ed0,_0x1db67f){var _0x436046=[{'name':_0x355b('0x59'),'label':_0x355b('0x59'),'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 _0x1586fd='';return db['DeskAccount'][_0x355b('0x50')]({'where':{'id':_0xaf77d6[_0x355b('0x4b')]['id']},'attributes':['id','remoteUri',_0x355b('0x5a'),_0x355b('0x5b'),_0x355b('0x5c'),_0x355b('0x5d'),_0x355b('0x5e'),_0x355b('0x5f'),'tokenSecret']})[_0x355b('0x2a')](handleEntityNotFound(_0xf14ed0,null))[_0x355b('0x2a')](function(_0x3c06dd){if(_0x3c06dd){_0x1586fd=_0x3c06dd[_0x355b('0x60')];var _0x23a87f=_0x1586fd[_0x355b('0x61')](-0x1);if(_0x23a87f==='/'){_0x1586fd=_0x1586fd[_0x355b('0x62')](0x0,_0x1586fd['lastIndexOf'](_0x23a87f));}var _0x3d55ab={'method':'GET','uri':util[_0x355b('0x63')](_0x355b('0x64'),_0x1586fd),'headers':{'Content-Type':_0x355b('0x65'),'Accept':'application/json'},'json':!![]};if(_0x3c06dd[_0x355b('0x5a')]===_0x355b('0x66')){_0x3d55ab[_0x355b('0x67')][_0x355b('0x68')]=util['format'](_0x355b('0x69'),new Buffer(util[_0x355b('0x63')](_0x355b('0x6a'),_0x3c06dd[_0x355b('0x5b')],_0x3c06dd[_0x355b('0x5c')]))['toString'](_0x355b('0x6b')));}return rp(_0x3d55ab)[_0x355b('0x2a')](function(_0xfe6f08){return _0x436046[_0x355b('0x6c')](_['map'](_0xfe6f08[_0x355b('0x6d')]['entries'],function(_0x23f3b8){return{'id':_0x23f3b8[_0x355b('0x2d')],'name':_0x23f3b8['name'],'type':_0x23f3b8[_0x355b('0x43')],'active':_0x23f3b8[_0x355b('0x6e')],'label':_0x23f3b8[_0x355b('0x6f')],'custom':!![]};}));});}})['then'](function(_0x13e8d6){return{'count':_0x13e8d6['length'],'rows':_0x13e8d6};})[_0x355b('0x2a')](respondWithResult(_0xf14ed0,null))[_0x355b('0x49')](function(_0x47236a){var _0x3ded3b=_0xaf77d6['query'][_0x355b('0x70')]?0x1f4:_0x47236a[_0x355b('0x71')]||0x1f4;logger['error'](_0x355b('0x72'),_0x355b('0x58'),_0x3ded3b,JSON[_0x355b('0x73')](_0x47236a));delete _0x47236a['name'];if(_0x3ded3b===0x191){_0x3ded3b=0x190;}_0xf14ed0[_0x355b('0x1e')](_0x3ded3b)[_0x355b('0x2e')](_0xaf77d6[_0x355b('0x35')][_0x355b('0x70')]?{'message':_0x355b('0x74'),'statusCode':_0x47236a['statusCode']}:_0x47236a);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 200fea0..1bcd69e 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 _0x4143=['../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','moment','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4143,0xa0));var _0x3414=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x4143[_0xf71120];return _0xbe2fd3;};'use strict';var _=require('lodash');var util=require(_0x3414('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3414('0x1'));var BPromise=require('bluebird');var rp=require(_0x3414('0x2'));var fs=require('fs');var path=require(_0x3414('0x3'));var rimraf=require(_0x3414('0x4'));var config=require(_0x3414('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x3414('0x6'));module[_0x3414('0x7')]=function(_0x3948d0,_0xb149c1){return _0x3948d0[_0x3414('0x8')](_0x3414('0x9'),attributes,{'tableName':_0x3414('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd312=['util','api','moment','bluebird','request-promise','path','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x1293d7,_0x127007){var _0x5b8eda=function(_0xfc4621){while(--_0xfc4621){_0x1293d7['push'](_0x1293d7['shift']());}};_0x5b8eda(++_0x127007);}(_0xd312,0x1af));var _0x2d31=function(_0x248889,_0x1dca42){_0x248889=_0x248889-0x0;var _0x22c594=_0xd312[_0x248889];return _0x22c594;};'use strict';var _=require(_0x2d31('0x0'));var util=require(_0x2d31('0x1'));var logger=require('../../config/logger')(_0x2d31('0x2'));var moment=require(_0x2d31('0x3'));var BPromise=require(_0x2d31('0x4'));var rp=require(_0x2d31('0x5'));var fs=require('fs');var path=require(_0x2d31('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2d31('0x7'));var integrations=require(_0x2d31('0x8'));module['exports']=function(_0x1479cd,_0x186b68){return _0x1479cd[_0x2d31('0x9')](_0x2d31('0xa'),attributes,{'tableName':_0x2d31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 5d1d232..40780c3 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 _0xad18=['map','model','attributes','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','DeskAccount,\x20%s,\x20%s','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad18,0xfa));var _0x8ad1=function(_0x13891e,_0x4977fc){_0x13891e=_0x13891e-0x0;var _0x3d679a=_0xad18[_0x13891e];return _0x3d679a;};'use strict';var _=require(_0x8ad1('0x0'));var util=require(_0x8ad1('0x1'));var moment=require(_0x8ad1('0x2'));var BPromise=require(_0x8ad1('0x3'));var rs=require(_0x8ad1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ad1('0x5'))['db'];var utils=require(_0x8ad1('0x6'));var logger=require('../../config/logger')(_0x8ad1('0x7'));var config=require(_0x8ad1('0x8'));var jayson=require(_0x8ad1('0x9'));var client=jayson[_0x8ad1('0xa')][_0x8ad1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bf82f,_0x1106df,_0x5a477a){return new BPromise(function(_0x5206e7,_0x341f00){return client['request'](_0x2bf82f,_0x5a477a)[_0x8ad1('0xc')](function(_0x22ddac){logger[_0x8ad1('0xd')]('DeskAccount,\x20%s,\x20%s',_0x1106df,_0x8ad1('0xe'));logger[_0x8ad1('0xf')](_0x8ad1('0x10'),_0x1106df,'request\x20sent',JSON[_0x8ad1('0x11')](_0x22ddac));if(_0x22ddac[_0x8ad1('0x12')]){if(_0x22ddac[_0x8ad1('0x12')]['code']===0x1f4){logger[_0x8ad1('0x12')](_0x8ad1('0x13'),_0x1106df,_0x22ddac[_0x8ad1('0x12')][_0x8ad1('0x14')]);return _0x341f00(_0x22ddac[_0x8ad1('0x12')][_0x8ad1('0x14')]);}logger[_0x8ad1('0x12')](_0x8ad1('0x13'),_0x1106df,_0x22ddac[_0x8ad1('0x12')][_0x8ad1('0x14')]);return _0x5206e7(_0x22ddac[_0x8ad1('0x12')]['message']);}else{logger[_0x8ad1('0xd')](_0x8ad1('0x13'),_0x1106df,_0x8ad1('0xe'));_0x5206e7(_0x22ddac['result'][_0x8ad1('0x14')]);}})[_0x8ad1('0x15')](function(_0x5bbbbb){logger[_0x8ad1('0x12')](_0x8ad1('0x13'),_0x1106df,_0x5bbbbb);_0x341f00(_0x5bbbbb);});});}exports[_0x8ad1('0x16')]=function(_0x574597){var _0x4a045f=this;return new Promise(function(_0x289cde,_0x3d7118){return db[_0x8ad1('0x17')][_0x8ad1('0x18')]({'raw':_0x574597[_0x8ad1('0x19')]?_0x574597['options'][_0x8ad1('0x1a')]===undefined?!![]:![]:!![],'where':_0x574597[_0x8ad1('0x19')]?_0x574597[_0x8ad1('0x19')][_0x8ad1('0x1b')]||null:null,'attributes':_0x574597[_0x8ad1('0x19')]?_0x574597[_0x8ad1('0x19')]['attributes']||null:null,'limit':_0x574597[_0x8ad1('0x19')]?_0x574597[_0x8ad1('0x19')][_0x8ad1('0x1c')]||null:null,'include':_0x574597[_0x8ad1('0x19')]?_0x574597[_0x8ad1('0x19')][_0x8ad1('0x1d')]?_[_0x8ad1('0x1e')](_0x574597['options'][_0x8ad1('0x1d')],function(_0x50e7f6){return{'model':db[_0x50e7f6[_0x8ad1('0x1f')]],'as':_0x50e7f6['as'],'attributes':_0x50e7f6[_0x8ad1('0x20')],'include':_0x50e7f6['include']?_[_0x8ad1('0x1e')](_0x50e7f6['include'],function(_0x1f2c2a){return{'model':db[_0x1f2c2a[_0x8ad1('0x1f')]],'as':_0x1f2c2a['as'],'attributes':_0x1f2c2a[_0x8ad1('0x20')],'include':_0x1f2c2a[_0x8ad1('0x1d')]?_['map'](_0x1f2c2a[_0x8ad1('0x1d')],function(_0x162820){return{'model':db[_0x162820[_0x8ad1('0x1f')]],'as':_0x162820['as'],'attributes':_0x162820[_0x8ad1('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc8c7f2){logger[_0x8ad1('0xd')]('GetDeskAccount',_0x574597);logger[_0x8ad1('0xf')](_0x8ad1('0x16'),_0x574597,JSON[_0x8ad1('0x11')](_0xc8c7f2));_0x289cde(_0xc8c7f2);})['catch'](function(_0x8bc61b){logger[_0x8ad1('0x12')](_0x8ad1('0x16'),_0x8bc61b[_0x8ad1('0x14')],_0x574597);_0x3d7118(_0x4a045f['error'](0x1f4,_0x8bc61b[_0x8ad1('0x14')]));});});};exports[_0x8ad1('0x21')]=function(_0x32567f){var _0x2a8091=this;return new Promise(function(_0x5e4e50,_0x115eb0){return db['DeskAccount'][_0x8ad1('0x22')]({'raw':_0x32567f[_0x8ad1('0x19')]?_0x32567f['options'][_0x8ad1('0x1a')]===undefined?!![]:![]:!![],'where':_0x32567f['options']?_0x32567f[_0x8ad1('0x19')][_0x8ad1('0x1b')]||null:null,'attributes':_0x32567f[_0x8ad1('0x19')]?_0x32567f['options'][_0x8ad1('0x20')]||null:null,'include':_0x32567f[_0x8ad1('0x19')]?_0x32567f[_0x8ad1('0x19')]['include']?_[_0x8ad1('0x1e')](_0x32567f[_0x8ad1('0x19')][_0x8ad1('0x1d')],function(_0x3c3a9d){return{'model':db[_0x3c3a9d[_0x8ad1('0x1f')]],'as':_0x3c3a9d['as'],'attributes':_0x3c3a9d[_0x8ad1('0x20')],'include':_0x3c3a9d[_0x8ad1('0x1d')]?_[_0x8ad1('0x1e')](_0x3c3a9d[_0x8ad1('0x1d')],function(_0x463acb){return{'model':db[_0x463acb[_0x8ad1('0x1f')]],'as':_0x463acb['as'],'attributes':_0x463acb[_0x8ad1('0x20')],'include':_0x463acb[_0x8ad1('0x1d')]?_['map'](_0x463acb[_0x8ad1('0x1d')],function(_0x500d8b){return{'model':db[_0x500d8b[_0x8ad1('0x1f')]],'as':_0x500d8b['as'],'attributes':_0x500d8b['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ad1('0xc')](function(_0x10f932){logger[_0x8ad1('0xd')](_0x8ad1('0x21'),_0x32567f);logger['debug'](_0x8ad1('0x21'),_0x32567f,JSON[_0x8ad1('0x11')](_0x10f932));_0x5e4e50(_0x10f932);})[_0x8ad1('0x15')](function(_0x11bf63){logger[_0x8ad1('0x12')](_0x8ad1('0x21'),_0x11bf63[_0x8ad1('0x14')],_0x32567f);_0x115eb0(_0x2a8091[_0x8ad1('0x12')](0x1f4,_0x11bf63[_0x8ad1('0x14')]));});});}; \ No newline at end of file +var _0xcb32=['moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetDeskAccount','DeskAccount','options','where','limit','include','map','model','attributes','stringify','catch','find','raw','ShowDeskAccount','lodash'];(function(_0x48ad71,_0x202970){var _0x93f06d=function(_0x19c7e5){while(--_0x19c7e5){_0x48ad71['push'](_0x48ad71['shift']());}};_0x93f06d(++_0x202970);}(_0xcb32,0x1b9));var _0x2cb3=function(_0x56e3bc,_0x5af526){_0x56e3bc=_0x56e3bc-0x0;var _0x2a6f23=_0xcb32[_0x56e3bc];return _0x2a6f23;};'use strict';var _=require(_0x2cb3('0x0'));var util=require('util');var moment=require(_0x2cb3('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cb3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cb3('0x3'))['db'];var utils=require(_0x2cb3('0x4'));var logger=require('../../config/logger')(_0x2cb3('0x5'));var config=require(_0x2cb3('0x6'));var jayson=require(_0x2cb3('0x7'));var client=jayson[_0x2cb3('0x8')][_0x2cb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22832e,_0x3ee196,_0x259c59){return new BPromise(function(_0x53e6ca,_0x5df182){return client[_0x2cb3('0xa')](_0x22832e,_0x259c59)[_0x2cb3('0xb')](function(_0x174c86){logger[_0x2cb3('0xc')](_0x2cb3('0xd'),_0x3ee196,_0x2cb3('0xe'));logger[_0x2cb3('0xf')](_0x2cb3('0x10'),_0x3ee196,'request\x20sent',JSON['stringify'](_0x174c86));if(_0x174c86[_0x2cb3('0x11')]){if(_0x174c86['error'][_0x2cb3('0x12')]===0x1f4){logger[_0x2cb3('0x11')](_0x2cb3('0xd'),_0x3ee196,_0x174c86[_0x2cb3('0x11')][_0x2cb3('0x13')]);return _0x5df182(_0x174c86[_0x2cb3('0x11')]['message']);}logger[_0x2cb3('0x11')](_0x2cb3('0xd'),_0x3ee196,_0x174c86[_0x2cb3('0x11')][_0x2cb3('0x13')]);return _0x53e6ca(_0x174c86['error']['message']);}else{logger[_0x2cb3('0xc')](_0x2cb3('0xd'),_0x3ee196,'request\x20sent');_0x53e6ca(_0x174c86['result']['message']);}})['catch'](function(_0x38ed53){logger[_0x2cb3('0x11')](_0x2cb3('0xd'),_0x3ee196,_0x38ed53);_0x5df182(_0x38ed53);});});}exports[_0x2cb3('0x14')]=function(_0x3332e0){var _0x4121f4=this;return new Promise(function(_0x1dcb71,_0x35d888){return db[_0x2cb3('0x15')]['findAll']({'raw':_0x3332e0[_0x2cb3('0x16')]?_0x3332e0[_0x2cb3('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3332e0['options']?_0x3332e0[_0x2cb3('0x16')][_0x2cb3('0x17')]||null:null,'attributes':_0x3332e0[_0x2cb3('0x16')]?_0x3332e0['options']['attributes']||null:null,'limit':_0x3332e0[_0x2cb3('0x16')]?_0x3332e0[_0x2cb3('0x16')][_0x2cb3('0x18')]||null:null,'include':_0x3332e0[_0x2cb3('0x16')]?_0x3332e0[_0x2cb3('0x16')][_0x2cb3('0x19')]?_[_0x2cb3('0x1a')](_0x3332e0[_0x2cb3('0x16')][_0x2cb3('0x19')],function(_0x702e17){return{'model':db[_0x702e17[_0x2cb3('0x1b')]],'as':_0x702e17['as'],'attributes':_0x702e17[_0x2cb3('0x1c')],'include':_0x702e17['include']?_[_0x2cb3('0x1a')](_0x702e17[_0x2cb3('0x19')],function(_0x49d9f4){return{'model':db[_0x49d9f4[_0x2cb3('0x1b')]],'as':_0x49d9f4['as'],'attributes':_0x49d9f4[_0x2cb3('0x1c')],'include':_0x49d9f4[_0x2cb3('0x19')]?_[_0x2cb3('0x1a')](_0x49d9f4[_0x2cb3('0x19')],function(_0x5b0a62){return{'model':db[_0x5b0a62[_0x2cb3('0x1b')]],'as':_0x5b0a62['as'],'attributes':_0x5b0a62[_0x2cb3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5086aa){logger['info'](_0x2cb3('0x14'),_0x3332e0);logger['debug'](_0x2cb3('0x14'),_0x3332e0,JSON[_0x2cb3('0x1d')](_0x5086aa));_0x1dcb71(_0x5086aa);})[_0x2cb3('0x1e')](function(_0x465cbf){logger[_0x2cb3('0x11')](_0x2cb3('0x14'),_0x465cbf[_0x2cb3('0x13')],_0x3332e0);_0x35d888(_0x4121f4[_0x2cb3('0x11')](0x1f4,_0x465cbf[_0x2cb3('0x13')]));});});};exports['ShowDeskAccount']=function(_0x2f5e60){var _0x44c2b3=this;return new Promise(function(_0x5166fe,_0xcf95d4){return db[_0x2cb3('0x15')][_0x2cb3('0x1f')]({'raw':_0x2f5e60[_0x2cb3('0x16')]?_0x2f5e60['options'][_0x2cb3('0x20')]===undefined?!![]:![]:!![],'where':_0x2f5e60[_0x2cb3('0x16')]?_0x2f5e60['options'][_0x2cb3('0x17')]||null:null,'attributes':_0x2f5e60[_0x2cb3('0x16')]?_0x2f5e60[_0x2cb3('0x16')][_0x2cb3('0x1c')]||null:null,'include':_0x2f5e60[_0x2cb3('0x16')]?_0x2f5e60[_0x2cb3('0x16')]['include']?_[_0x2cb3('0x1a')](_0x2f5e60[_0x2cb3('0x16')][_0x2cb3('0x19')],function(_0x57c58b){return{'model':db[_0x57c58b[_0x2cb3('0x1b')]],'as':_0x57c58b['as'],'attributes':_0x57c58b['attributes'],'include':_0x57c58b['include']?_['map'](_0x57c58b[_0x2cb3('0x19')],function(_0x5e2310){return{'model':db[_0x5e2310[_0x2cb3('0x1b')]],'as':_0x5e2310['as'],'attributes':_0x5e2310[_0x2cb3('0x1c')],'include':_0x5e2310[_0x2cb3('0x19')]?_[_0x2cb3('0x1a')](_0x5e2310[_0x2cb3('0x19')],function(_0x1dba70){return{'model':db[_0x1dba70[_0x2cb3('0x1b')]],'as':_0x1dba70['as'],'attributes':_0x1dba70[_0x2cb3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2cb3('0xb')](function(_0x58ef19){logger[_0x2cb3('0xc')](_0x2cb3('0x21'),_0x2f5e60);logger[_0x2cb3('0xf')](_0x2cb3('0x21'),_0x2f5e60,JSON[_0x2cb3('0x1d')](_0x58ef19));_0x5166fe(_0x58ef19);})[_0x2cb3('0x1e')](function(_0xdf1578){logger[_0x2cb3('0x11')](_0x2cb3('0x21'),_0xdf1578[_0x2cb3('0x13')],_0x2f5e60);_0xcf95d4(_0x44c2b3[_0x2cb3('0x11')](0x1f4,_0xdf1578[_0x2cb3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 763a64b..589b437 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 _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(_0x163c76,_0x3acf6e){var _0x26bbd3=function(_0x5705d5){while(--_0x5705d5){_0x163c76['push'](_0x163c76['shift']());}};_0x26bbd3(++_0x3acf6e);}(_0x008c,0x188));var _0xc008=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0x008c[_0x5b077b];return _0x16faf7;};'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 +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x59cda9,_0x47d4c4){var _0x26c18f=function(_0x4cff5f){while(--_0x4cff5f){_0x59cda9['push'](_0x59cda9['shift']());}};_0x26c18f(++_0x47d4c4);}(_0x55ca,0x126));var _0xa55c=function(_0xd75b98,_0x15ad99){_0xd75b98=_0xd75b98-0x0;var _0xdd720e=_0x55ca[_0xd75b98];return _0xdd720e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 5630974..ac34865 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 _0x0e27=['exports','STRING','sequelize'];(function(_0x47f8ae,_0xa9bad7){var _0x1e4625=function(_0x1efd68){while(--_0x1efd68){_0x47f8ae['push'](_0x47f8ae['shift']());}};_0x1e4625(++_0xa9bad7);}(_0x0e27,0x1be));var _0x70e2=function(_0x4e5ff7,_0x1c555f){_0x4e5ff7=_0x4e5ff7-0x0;var _0xd3aec=_0x0e27[_0x4e5ff7];return _0xd3aec;};'use strict';var Sequelize=require(_0x70e2('0x0'));module[_0x70e2('0x1')]={'name':{'type':Sequelize[_0x70e2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4206=['exports','STRING'];(function(_0x496591,_0x4f4c0f){var _0x3d39f8=function(_0x55a2b4){while(--_0x55a2b4){_0x496591['push'](_0x496591['shift']());}};_0x3d39f8(++_0x4f4c0f);}(_0x4206,0xcc));var _0x6420=function(_0x1fbced,_0x27eab8){_0x1fbced=_0x1fbced-0x0;var _0x26f480=_0x4206[_0x1fbced];return _0x26f480;};'use strict';var Sequelize=require('sequelize');module[_0x6420('0x0')]={'name':{'type':Sequelize[_0x6420('0x1')]},'description':{'type':Sequelize[_0x6420('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 0c1c18c..9a2e697 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 _0xb842=['error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','include','DeskConfiguration','findAll','rows','catch','show','params','includeAll','create','body','destroy','find','findOne','hasOwnProperty','getSubjects','DeskField','order','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../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'];(function(_0xae1d4,_0x4d95ab){var _0x132812=function(_0x38f5c8){while(--_0x38f5c8){_0xae1d4['push'](_0xae1d4['shift']());}};_0x132812(++_0x4d95ab);}(_0xb842,0x80));var _0x2b84=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xb842[_0x3070dc];return _0x431489;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b84('0x0'));var zipdir=require(_0x2b84('0x1'));var jsonpatch=require(_0x2b84('0x2'));var rp=require(_0x2b84('0x3'));var moment=require(_0x2b84('0x4'));var BPromise=require(_0x2b84('0x5'));var Mustache=require(_0x2b84('0x6'));var util=require('util');var path=require(_0x2b84('0x7'));var sox=require(_0x2b84('0x8'));var csv=require(_0x2b84('0x9'));var ejs=require(_0x2b84('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2b84('0xb'));var crypto=require(_0x2b84('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2b84('0xd'));var toCsv=require(_0x2b84('0x9'));var querystring=require(_0x2b84('0xe'));var Papa=require(_0x2b84('0xf'));var Redis=require(_0x2b84('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2b84('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b84('0x12'))(_0x2b84('0x13'));var utils=require(_0x2b84('0x14'));var config=require(_0x2b84('0x15'));var licenseUtil=require(_0x2b84('0x16'));var db=require(_0x2b84('0x17'))['db'];function respondWithStatusCode(_0x2a7f95,_0x2ff74a){_0x2ff74a=_0x2ff74a||0xcc;return function(_0x30d290){if(_0x30d290){return _0x2a7f95[_0x2b84('0x18')](_0x2ff74a);}return _0x2a7f95['status'](_0x2ff74a)[_0x2b84('0x19')]();};}function respondWithResult(_0x2b15b2,_0xebd207){_0xebd207=_0xebd207||0xc8;return function(_0x36d925){if(_0x36d925){return _0x2b15b2[_0x2b84('0x1a')](_0xebd207)[_0x2b84('0x1b')](_0x36d925);}};}function respondWithFilteredResult(_0x1efdad,_0x2c765c){return function(_0x3a199c){if(_0x3a199c){var _0x2a8e27=typeof _0x2c765c[_0x2b84('0x1c')]===_0x2b84('0x1d')&&typeof _0x2c765c[_0x2b84('0x1e')]===_0x2b84('0x1d');var _0x4feece=_0x3a199c[_0x2b84('0x1f')];var _0x299b64=_0x2a8e27?0x0:_0x2c765c['offset'];var _0x217537=_0x2a8e27?_0x3a199c[_0x2b84('0x1f')]:_0x2c765c[_0x2b84('0x1c')]+_0x2c765c['limit'];var _0x128ab7;if(_0x217537>=_0x4feece){_0x217537=_0x4feece;_0x128ab7=0xc8;}else{_0x128ab7=0xce;}_0x1efdad[_0x2b84('0x1a')](_0x128ab7);return _0x1efdad[_0x2b84('0x20')](_0x2b84('0x21'),_0x299b64+'-'+_0x217537+'/'+_0x4feece)['json'](_0x3a199c);}return null;};}function patchUpdates(_0x3ccdb1){return function(_0x562b84){try{jsonpatch[_0x2b84('0x22')](_0x562b84,_0x3ccdb1,!![]);}catch(_0x44b0ea){return BPromise['reject'](_0x44b0ea);}return _0x562b84[_0x2b84('0x23')]();};}function saveUpdates(_0x39960b,_0x3af76e){return function(_0x3fee4c){if(_0x3fee4c){return _0x3fee4c[_0x2b84('0x24')](_0x39960b)[_0x2b84('0x25')](function(_0x3c9bb5){return _0x3c9bb5;});}return null;};}function removeEntity(_0x43c58c,_0x4bc162){return function(_0x51d0c1){if(_0x51d0c1){return _0x51d0c1['destroy']()[_0x2b84('0x25')](function(){_0x43c58c['status'](0xcc)[_0x2b84('0x19')]();});}};}function handleEntityNotFound(_0x23f8f3,_0x227b10){return function(_0x3a7712){if(!_0x3a7712){_0x23f8f3['sendStatus'](0x194);}return _0x3a7712;};}function handleError(_0x1682ab,_0x3b06c4){_0x3b06c4=_0x3b06c4||0x1f4;return function(_0x403773){logger[_0x2b84('0x26')](_0x403773[_0x2b84('0x27')]);if(_0x403773[_0x2b84('0x28')]){delete _0x403773[_0x2b84('0x28')];}_0x1682ab[_0x2b84('0x1a')](_0x3b06c4)[_0x2b84('0x29')](_0x403773);};}exports[_0x2b84('0x2a')]=function(_0x5028e8,_0x151e75){var _0x2e3904={},_0x4082e1={},_0xef65a8={'count':0x0,'rows':[]};var _0x5084a1=_[_0x2b84('0x2b')](db['DeskConfiguration'][_0x2b84('0x2c')],function(_0x4b9455){return{'name':_0x4b9455['fieldName'],'type':_0x4b9455['type'][_0x2b84('0x2d')]};});_0x4082e1['model']=_[_0x2b84('0x2b')](_0x5084a1,_0x2b84('0x28'));_0x4082e1[_0x2b84('0x2e')]=_[_0x2b84('0x2f')](_0x5028e8[_0x2b84('0x2e')]);_0x4082e1[_0x2b84('0x30')]=_[_0x2b84('0x31')](_0x4082e1[_0x2b84('0x32')],_0x4082e1[_0x2b84('0x2e')]);_0x2e3904[_0x2b84('0x33')]=_[_0x2b84('0x31')](_0x4082e1[_0x2b84('0x32')],qs[_0x2b84('0x34')](_0x5028e8[_0x2b84('0x2e')][_0x2b84('0x34')]));_0x2e3904['attributes']=_0x2e3904[_0x2b84('0x33')][_0x2b84('0x35')]?_0x2e3904[_0x2b84('0x33')]:_0x4082e1[_0x2b84('0x32')];if(!_0x5028e8[_0x2b84('0x2e')]['hasOwnProperty'](_0x2b84('0x36'))){_0x2e3904['limit']=qs[_0x2b84('0x1e')](_0x5028e8['query']['limit']);_0x2e3904['offset']=qs[_0x2b84('0x1c')](_0x5028e8[_0x2b84('0x2e')][_0x2b84('0x1c')]);}_0x2e3904['order']=qs['sort'](_0x5028e8[_0x2b84('0x2e')][_0x2b84('0x37')]);_0x2e3904['where']=qs[_0x2b84('0x30')](_[_0x2b84('0x38')](_0x5028e8['query'],_0x4082e1[_0x2b84('0x30')]),_0x5084a1);if(_0x5028e8[_0x2b84('0x2e')][_0x2b84('0x39')]){_0x2e3904['where']=_[_0x2b84('0x3a')](_0x2e3904[_0x2b84('0x3b')],{'$or':_[_0x2b84('0x2b')](_0x5084a1,function(_0x3d5cac){if(_0x3d5cac['type']!==_0x2b84('0x3c')){var _0x2103ca={};_0x2103ca[_0x3d5cac[_0x2b84('0x28')]]={'$like':'%'+_0x5028e8[_0x2b84('0x2e')][_0x2b84('0x39')]+'%'};return _0x2103ca;}})});}_0x2e3904=_[_0x2b84('0x3a')]({},_0x2e3904,_0x5028e8[_0x2b84('0x3d')]);var _0x232c1e={'where':_0x2e3904[_0x2b84('0x3b')]};return db['DeskConfiguration'][_0x2b84('0x1f')](_0x232c1e)['then'](function(_0x21327a){_0xef65a8[_0x2b84('0x1f')]=_0x21327a;if(_0x5028e8[_0x2b84('0x2e')]['includeAll']){_0x2e3904[_0x2b84('0x3e')]=[{'all':!![]}];}return db[_0x2b84('0x3f')][_0x2b84('0x40')](_0x2e3904);})[_0x2b84('0x25')](function(_0xf4dc79){_0xef65a8[_0x2b84('0x41')]=_0xf4dc79;return _0xef65a8;})[_0x2b84('0x25')](respondWithFilteredResult(_0x151e75,_0x2e3904))[_0x2b84('0x42')](handleError(_0x151e75,null));};exports[_0x2b84('0x43')]=function(_0x208759,_0x5be2a5){var _0x3223d9={'raw':![],'where':{'id':_0x208759[_0x2b84('0x44')]['id']}},_0x409add={};_0x409add[_0x2b84('0x32')]=_[_0x2b84('0x2f')](db[_0x2b84('0x3f')][_0x2b84('0x2c')]);_0x409add['query']=_[_0x2b84('0x2f')](_0x208759[_0x2b84('0x2e')]);_0x409add['filters']=_['intersection'](_0x409add[_0x2b84('0x32')],_0x409add[_0x2b84('0x2e')]);_0x3223d9[_0x2b84('0x33')]=_[_0x2b84('0x31')](_0x409add[_0x2b84('0x32')],qs[_0x2b84('0x34')](_0x208759[_0x2b84('0x2e')][_0x2b84('0x34')]));_0x3223d9[_0x2b84('0x33')]=_0x3223d9[_0x2b84('0x33')]['length']?_0x3223d9['attributes']:_0x409add['model'];if(_0x208759[_0x2b84('0x2e')][_0x2b84('0x45')]){_0x3223d9[_0x2b84('0x3e')]=[{'all':!![]}];}_0x3223d9=_['merge']({},_0x3223d9,_0x208759['options']);return db[_0x2b84('0x3f')]['find'](_0x3223d9)[_0x2b84('0x25')](handleEntityNotFound(_0x5be2a5,null))[_0x2b84('0x25')](respondWithResult(_0x5be2a5,null))[_0x2b84('0x42')](handleError(_0x5be2a5,null));};exports[_0x2b84('0x46')]=function(_0x4d7b18,_0x413fbc){return db[_0x2b84('0x3f')][_0x2b84('0x46')](_0x4d7b18[_0x2b84('0x47')],{})['then'](respondWithResult(_0x413fbc,0xc9))['catch'](handleError(_0x413fbc,null));};exports[_0x2b84('0x24')]=function(_0x514ca4,_0x108dd1){if(_0x514ca4[_0x2b84('0x47')]['id']){delete _0x514ca4[_0x2b84('0x47')]['id'];}return db[_0x2b84('0x3f')]['find']({'where':{'id':_0x514ca4[_0x2b84('0x44')]['id']}})[_0x2b84('0x25')](handleEntityNotFound(_0x108dd1,null))[_0x2b84('0x25')](saveUpdates(_0x514ca4[_0x2b84('0x47')],null))[_0x2b84('0x25')](respondWithResult(_0x108dd1,null))[_0x2b84('0x42')](handleError(_0x108dd1,null));};exports[_0x2b84('0x48')]=function(_0x458975,_0x4c3088){return db[_0x2b84('0x3f')][_0x2b84('0x49')]({'where':{'id':_0x458975[_0x2b84('0x44')]['id']}})[_0x2b84('0x25')](handleEntityNotFound(_0x4c3088,null))[_0x2b84('0x25')](removeEntity(_0x4c3088,null))[_0x2b84('0x42')](handleError(_0x4c3088,null));};exports['getFields']=function(_0x3cbc2f,_0x5bad95,_0x3aac8b){var _0x3b034b={};var _0x3e0a6e={};var _0x3d5683;var _0x3a632b;return db[_0x2b84('0x3f')][_0x2b84('0x4a')]({'where':{'id':_0x3cbc2f['params']['id']}})[_0x2b84('0x25')](handleEntityNotFound(_0x5bad95,null))[_0x2b84('0x25')](function(_0x2a19bc){if(_0x2a19bc){_0x3d5683=_0x2a19bc;_0x3e0a6e[_0x2b84('0x32')]=_[_0x2b84('0x2f')](db['DeskField'][_0x2b84('0x2c')]);_0x3e0a6e['query']=_[_0x2b84('0x2f')](_0x3cbc2f[_0x2b84('0x2e')]);_0x3e0a6e[_0x2b84('0x30')]=_[_0x2b84('0x31')](_0x3e0a6e[_0x2b84('0x32')],_0x3e0a6e[_0x2b84('0x2e')]);_0x3b034b[_0x2b84('0x33')]=_['intersection'](_0x3e0a6e[_0x2b84('0x32')],qs[_0x2b84('0x34')](_0x3cbc2f[_0x2b84('0x2e')][_0x2b84('0x34')]));_0x3b034b[_0x2b84('0x33')]=_0x3b034b[_0x2b84('0x33')][_0x2b84('0x35')]?_0x3b034b[_0x2b84('0x33')]:_0x3e0a6e['model'];_0x3b034b['order']=qs['sort'](_0x3cbc2f[_0x2b84('0x2e')]['sort']);_0x3b034b[_0x2b84('0x3b')]=qs[_0x2b84('0x30')](_[_0x2b84('0x38')](_0x3cbc2f[_0x2b84('0x2e')],_0x3e0a6e[_0x2b84('0x30')]));if(_0x3cbc2f[_0x2b84('0x2e')][_0x2b84('0x39')]){_0x3b034b[_0x2b84('0x3b')]=_['merge'](_0x3b034b[_0x2b84('0x3b')],{'$or':_[_0x2b84('0x2b')](_0x3b034b[_0x2b84('0x33')],function(_0x1f327e){var _0x1a58a3={};_0x1a58a3[_0x1f327e]={'$like':'%'+_0x3cbc2f['query'][_0x2b84('0x39')]+'%'};return _0x1a58a3;})});}_0x3b034b=_[_0x2b84('0x3a')]({},_0x3b034b,_0x3cbc2f[_0x2b84('0x3d')]);return _0x3d5683['getFields'](_0x3b034b);}})['then'](function(_0x21e381){if(_0x21e381){_0x3a632b=_0x21e381[_0x2b84('0x35')];if(!_0x3cbc2f['query'][_0x2b84('0x4b')]('nolimit')){_0x3b034b[_0x2b84('0x1e')]=qs['limit'](_0x3cbc2f[_0x2b84('0x2e')][_0x2b84('0x1e')]);_0x3b034b['offset']=qs[_0x2b84('0x1c')](_0x3cbc2f[_0x2b84('0x2e')][_0x2b84('0x1c')]);}return _0x3d5683['getFields'](_0x3b034b);}})[_0x2b84('0x25')](function(_0x24152d){if(_0x24152d){return _0x24152d?{'count':_0x3a632b,'rows':_0x24152d}:null;}})['then'](respondWithResult(_0x5bad95,null))[_0x2b84('0x42')](handleError(_0x5bad95,null));};exports[_0x2b84('0x4c')]=function(_0x3df477,_0x237f84,_0x25f97f){var _0x4b03a1={};var _0x1d7176={};var _0x130c2b;var _0x562e87;return db[_0x2b84('0x3f')][_0x2b84('0x4a')]({'where':{'id':_0x3df477[_0x2b84('0x44')]['id']}})[_0x2b84('0x25')](handleEntityNotFound(_0x237f84,null))[_0x2b84('0x25')](function(_0x326da3){if(_0x326da3){_0x130c2b=_0x326da3;_0x1d7176['model']=_[_0x2b84('0x2f')](db[_0x2b84('0x4d')][_0x2b84('0x2c')]);_0x1d7176['query']=_[_0x2b84('0x2f')](_0x3df477[_0x2b84('0x2e')]);_0x1d7176['filters']=_[_0x2b84('0x31')](_0x1d7176[_0x2b84('0x32')],_0x1d7176[_0x2b84('0x2e')]);_0x4b03a1[_0x2b84('0x33')]=_[_0x2b84('0x31')](_0x1d7176[_0x2b84('0x32')],qs['fields'](_0x3df477['query'][_0x2b84('0x34')]));_0x4b03a1[_0x2b84('0x33')]=_0x4b03a1[_0x2b84('0x33')][_0x2b84('0x35')]?_0x4b03a1[_0x2b84('0x33')]:_0x1d7176[_0x2b84('0x32')];_0x4b03a1[_0x2b84('0x4e')]=qs[_0x2b84('0x37')](_0x3df477['query'][_0x2b84('0x37')]);_0x4b03a1[_0x2b84('0x3b')]=qs[_0x2b84('0x30')](_[_0x2b84('0x38')](_0x3df477[_0x2b84('0x2e')],_0x1d7176[_0x2b84('0x30')]));if(_0x3df477['query'][_0x2b84('0x39')]){_0x4b03a1['where']=_[_0x2b84('0x3a')](_0x4b03a1[_0x2b84('0x3b')],{'$or':_[_0x2b84('0x2b')](_0x4b03a1[_0x2b84('0x33')],function(_0x33c66a){var _0x37c34f={};_0x37c34f[_0x33c66a]={'$like':'%'+_0x3df477[_0x2b84('0x2e')][_0x2b84('0x39')]+'%'};return _0x37c34f;})});}_0x4b03a1=_[_0x2b84('0x3a')]({},_0x4b03a1,_0x3df477[_0x2b84('0x3d')]);return _0x130c2b['getSubjects'](_0x4b03a1);}})[_0x2b84('0x25')](function(_0x261c82){if(_0x261c82){_0x562e87=_0x261c82[_0x2b84('0x35')];if(!_0x3df477[_0x2b84('0x2e')][_0x2b84('0x4b')]('nolimit')){_0x4b03a1[_0x2b84('0x1e')]=qs['limit'](_0x3df477[_0x2b84('0x2e')][_0x2b84('0x1e')]);_0x4b03a1[_0x2b84('0x1c')]=qs[_0x2b84('0x1c')](_0x3df477[_0x2b84('0x2e')]['offset']);}return _0x130c2b[_0x2b84('0x4c')](_0x4b03a1);}})[_0x2b84('0x25')](function(_0x3c7eef){if(_0x3c7eef){return _0x3c7eef?{'count':_0x562e87,'rows':_0x3c7eef}:null;}})[_0x2b84('0x25')](respondWithResult(_0x237f84,null))[_0x2b84('0x42')](handleError(_0x237f84,null));};exports[_0x2b84('0x4f')]=function(_0x566fd1,_0x5e7c88,_0x3f17fa){var _0x1a41f2={};var _0x19e970={};var _0x2d23da;var _0x8712c1;return db[_0x2b84('0x3f')][_0x2b84('0x4a')]({'where':{'id':_0x566fd1[_0x2b84('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e7c88,null))[_0x2b84('0x25')](function(_0x40b4c5){if(_0x40b4c5){_0x2d23da=_0x40b4c5;_0x19e970['model']=_[_0x2b84('0x2f')](db[_0x2b84('0x4d')][_0x2b84('0x2c')]);_0x19e970[_0x2b84('0x2e')]=_[_0x2b84('0x2f')](_0x566fd1[_0x2b84('0x2e')]);_0x19e970['filters']=_[_0x2b84('0x31')](_0x19e970[_0x2b84('0x32')],_0x19e970['query']);_0x1a41f2[_0x2b84('0x33')]=_[_0x2b84('0x31')](_0x19e970[_0x2b84('0x32')],qs['fields'](_0x566fd1[_0x2b84('0x2e')][_0x2b84('0x34')]));_0x1a41f2[_0x2b84('0x33')]=_0x1a41f2[_0x2b84('0x33')][_0x2b84('0x35')]?_0x1a41f2[_0x2b84('0x33')]:_0x19e970['model'];_0x1a41f2['order']=qs[_0x2b84('0x37')](_0x566fd1[_0x2b84('0x2e')][_0x2b84('0x37')]);_0x1a41f2[_0x2b84('0x3b')]=qs['filters'](_[_0x2b84('0x38')](_0x566fd1['query'],_0x19e970[_0x2b84('0x30')]));if(_0x566fd1[_0x2b84('0x2e')]['filter']){_0x1a41f2['where']=_[_0x2b84('0x3a')](_0x1a41f2[_0x2b84('0x3b')],{'$or':_[_0x2b84('0x2b')](_0x1a41f2[_0x2b84('0x33')],function(_0x1647bb){var _0x1600a9={};_0x1600a9[_0x1647bb]={'$like':'%'+_0x566fd1['query'][_0x2b84('0x39')]+'%'};return _0x1600a9;})});}_0x1a41f2=_['merge']({},_0x1a41f2,_0x566fd1[_0x2b84('0x3d')]);return _0x2d23da['getDescriptions'](_0x1a41f2);}})[_0x2b84('0x25')](function(_0x33a303){if(_0x33a303){_0x8712c1=_0x33a303[_0x2b84('0x35')];if(!_0x566fd1['query'][_0x2b84('0x4b')]('nolimit')){_0x1a41f2[_0x2b84('0x1e')]=qs['limit'](_0x566fd1[_0x2b84('0x2e')]['limit']);_0x1a41f2[_0x2b84('0x1c')]=qs[_0x2b84('0x1c')](_0x566fd1[_0x2b84('0x2e')][_0x2b84('0x1c')]);}return _0x2d23da[_0x2b84('0x4f')](_0x1a41f2);}})['then'](function(_0x28e2c7){if(_0x28e2c7){return _0x28e2c7?{'count':_0x8712c1,'rows':_0x28e2c7}:null;}})[_0x2b84('0x25')](respondWithResult(_0x5e7c88,null))['catch'](handleError(_0x5e7c88,null));};exports[_0x2b84('0x50')]=function(_0x9116f9,_0x844427,_0x2c0a38){var _0x5bd648={};var _0x9f0aad={};var _0x3e2908;var _0x33c616;return db[_0x2b84('0x3f')][_0x2b84('0x4a')]({'where':{'id':_0x9116f9[_0x2b84('0x44')]['id']}})[_0x2b84('0x25')](handleEntityNotFound(_0x844427,null))['then'](function(_0x558710){if(_0x558710){_0x3e2908=_0x558710;_0x9f0aad['model']=_[_0x2b84('0x2f')](db[_0x2b84('0x51')]['rawAttributes']);_0x9f0aad['query']=_[_0x2b84('0x2f')](_0x9116f9[_0x2b84('0x2e')]);_0x9f0aad[_0x2b84('0x30')]=_['intersection'](_0x9f0aad[_0x2b84('0x32')],_0x9f0aad[_0x2b84('0x2e')]);_0x5bd648[_0x2b84('0x33')]=_[_0x2b84('0x31')](_0x9f0aad['model'],qs[_0x2b84('0x34')](_0x9116f9[_0x2b84('0x2e')][_0x2b84('0x34')]));_0x5bd648['attributes']=_0x5bd648['attributes']['length']?_0x5bd648['attributes']:_0x9f0aad[_0x2b84('0x32')];_0x5bd648[_0x2b84('0x4e')]=qs['sort'](_0x9116f9[_0x2b84('0x2e')][_0x2b84('0x37')]);_0x5bd648[_0x2b84('0x3b')]=qs[_0x2b84('0x30')](_[_0x2b84('0x38')](_0x9116f9[_0x2b84('0x2e')],_0x9f0aad[_0x2b84('0x30')]));if(_0x9116f9['query'][_0x2b84('0x39')]){_0x5bd648[_0x2b84('0x3b')]=_[_0x2b84('0x3a')](_0x5bd648[_0x2b84('0x3b')],{'$or':_[_0x2b84('0x2b')](_0x5bd648[_0x2b84('0x33')],function(_0x723c83){var _0x4bf00d={};_0x4bf00d[_0x723c83]={'$like':'%'+_0x9116f9['query']['filter']+'%'};return _0x4bf00d;})});}_0x5bd648=_[_0x2b84('0x3a')]({},_0x5bd648,_0x9116f9[_0x2b84('0x3d')]);return _0x3e2908[_0x2b84('0x50')](_0x5bd648);}})['then'](function(_0x3df27c){if(_0x3df27c){_0x33c616=_0x3df27c[_0x2b84('0x35')];if(!_0x9116f9[_0x2b84('0x2e')][_0x2b84('0x4b')](_0x2b84('0x36'))){_0x5bd648[_0x2b84('0x1e')]=qs[_0x2b84('0x1e')](_0x9116f9['query'][_0x2b84('0x1e')]);_0x5bd648[_0x2b84('0x1c')]=qs[_0x2b84('0x1c')](_0x9116f9[_0x2b84('0x2e')][_0x2b84('0x1c')]);}return _0x3e2908[_0x2b84('0x50')](_0x5bd648);}})['then'](function(_0x209e1e){if(_0x209e1e){return _0x209e1e?{'count':_0x33c616,'rows':_0x209e1e}:null;}})['then'](respondWithResult(_0x844427,null))[_0x2b84('0x42')](handleError(_0x844427,null));};exports[_0x2b84('0x52')]=function(_0x147b3b,_0x4879e6,_0x1bcc02){if(_0x147b3b[_0x2b84('0x47')]['id']){delete _0x147b3b[_0x2b84('0x47')]['id'];}return db[_0x2b84('0x3f')][_0x2b84('0x4a')]({'where':{'id':_0x147b3b['params']['id']}})['then'](handleEntityNotFound(_0x4879e6,null))['then'](function(_0x2e62e1){if(_0x2e62e1){return _0x2e62e1[_0x2b84('0x52')](_0x147b3b[_0x2b84('0x47')]['ids']||[]);}return null;})[_0x2b84('0x25')](respondWithResult(_0x4879e6,null))[_0x2b84('0x42')](handleError(_0x4879e6,null));}; \ No newline at end of file +var _0xae29=['rows','catch','show','params','options','find','create','body','keys','DeskField','order','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','key','map','query','filters','model','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','filter','merge','type','includeAll','include','findAll'];(function(_0x809052,_0x5e5de5){var _0x4b7211=function(_0x50d6b5){while(--_0x50d6b5){_0x809052['push'](_0x809052['shift']());}};_0x4b7211(++_0x5e5de5);}(_0xae29,0x1c7));var _0x9ae2=function(_0x4756c2,_0x3c5da3){_0x4756c2=_0x4756c2-0x0;var _0x4a5022=_0xae29[_0x4756c2];return _0x4a5022;};'use strict';var emlformat=require(_0x9ae2('0x0'));var rimraf=require(_0x9ae2('0x1'));var zipdir=require(_0x9ae2('0x2'));var jsonpatch=require(_0x9ae2('0x3'));var rp=require(_0x9ae2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9ae2('0x5'));var util=require(_0x9ae2('0x6'));var path=require(_0x9ae2('0x7'));var sox=require('sox');var csv=require(_0x9ae2('0x8'));var ejs=require(_0x9ae2('0x9'));var fs=require('fs');var fs_extra=require(_0x9ae2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9ae2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9ae2('0xc'));var toCsv=require(_0x9ae2('0x8'));var querystring=require('querystring');var Papa=require(_0x9ae2('0xd'));var Redis=require(_0x9ae2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9ae2('0xf'));var as=require(_0x9ae2('0x10'));var hardwareService=require(_0x9ae2('0x11'));var logger=require(_0x9ae2('0x12'))(_0x9ae2('0x13'));var utils=require(_0x9ae2('0x14'));var config=require(_0x9ae2('0x15'));var licenseUtil=require(_0x9ae2('0x16'));var db=require(_0x9ae2('0x17'))['db'];function respondWithStatusCode(_0xddc646,_0xa96820){_0xa96820=_0xa96820||0xcc;return function(_0x2fedb4){if(_0x2fedb4){return _0xddc646['sendStatus'](_0xa96820);}return _0xddc646[_0x9ae2('0x18')](_0xa96820)[_0x9ae2('0x19')]();};}function respondWithResult(_0xb8b380,_0x55c857){_0x55c857=_0x55c857||0xc8;return function(_0x5ae21a){if(_0x5ae21a){return _0xb8b380[_0x9ae2('0x18')](_0x55c857)[_0x9ae2('0x1a')](_0x5ae21a);}};}function respondWithFilteredResult(_0xb5aef,_0x11fcbd){return function(_0x434a4d){if(_0x434a4d){var _0xece235=typeof _0x11fcbd['offset']==='undefined'&&typeof _0x11fcbd['limit']===_0x9ae2('0x1b');var _0x4aa124=_0x434a4d[_0x9ae2('0x1c')];var _0x3ca326=_0xece235?0x0:_0x11fcbd[_0x9ae2('0x1d')];var _0x404de2=_0xece235?_0x434a4d[_0x9ae2('0x1c')]:_0x11fcbd[_0x9ae2('0x1d')]+_0x11fcbd['limit'];var _0xdceb85;if(_0x404de2>=_0x4aa124){_0x404de2=_0x4aa124;_0xdceb85=0xc8;}else{_0xdceb85=0xce;}_0xb5aef[_0x9ae2('0x18')](_0xdceb85);return _0xb5aef[_0x9ae2('0x1e')](_0x9ae2('0x1f'),_0x3ca326+'-'+_0x404de2+'/'+_0x4aa124)[_0x9ae2('0x1a')](_0x434a4d);}return null;};}function patchUpdates(_0x5aa755){return function(_0x4f806c){try{jsonpatch[_0x9ae2('0x20')](_0x4f806c,_0x5aa755,!![]);}catch(_0x5db027){return BPromise[_0x9ae2('0x21')](_0x5db027);}return _0x4f806c[_0x9ae2('0x22')]();};}function saveUpdates(_0xd4e71b,_0x487662){return function(_0x5465db){if(_0x5465db){return _0x5465db[_0x9ae2('0x23')](_0xd4e71b)[_0x9ae2('0x24')](function(_0x502073){return _0x502073;});}return null;};}function removeEntity(_0x4911fb,_0x37bbdc){return function(_0x555ed4){if(_0x555ed4){return _0x555ed4[_0x9ae2('0x25')]()['then'](function(){_0x4911fb[_0x9ae2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4abd4b,_0x375959){return function(_0x2c6cb1){if(!_0x2c6cb1){_0x4abd4b[_0x9ae2('0x26')](0x194);}return _0x2c6cb1;};}function handleError(_0x18a630,_0x20b4ad){_0x20b4ad=_0x20b4ad||0x1f4;return function(_0x5dab19){logger[_0x9ae2('0x27')](_0x5dab19[_0x9ae2('0x28')]);if(_0x5dab19[_0x9ae2('0x29')]){delete _0x5dab19[_0x9ae2('0x29')];}_0x18a630[_0x9ae2('0x18')](_0x20b4ad)[_0x9ae2('0x2a')](_0x5dab19);};}exports[_0x9ae2('0x2b')]=function(_0x3791d7,_0x2dfad0){var _0x5c92aa={},_0xee33a2={},_0x13fb34={'count':0x0,'rows':[]};var _0x3884c0=_['map'](db[_0x9ae2('0x2c')][_0x9ae2('0x2d')],function(_0x18a639){return{'name':_0x18a639[_0x9ae2('0x2e')],'type':_0x18a639['type'][_0x9ae2('0x2f')]};});_0xee33a2['model']=_[_0x9ae2('0x30')](_0x3884c0,'name');_0xee33a2['query']=_['keys'](_0x3791d7[_0x9ae2('0x31')]);_0xee33a2[_0x9ae2('0x32')]=_['intersection'](_0xee33a2[_0x9ae2('0x33')],_0xee33a2[_0x9ae2('0x31')]);_0x5c92aa[_0x9ae2('0x34')]=_[_0x9ae2('0x35')](_0xee33a2[_0x9ae2('0x33')],qs[_0x9ae2('0x36')](_0x3791d7[_0x9ae2('0x31')][_0x9ae2('0x36')]));_0x5c92aa['attributes']=_0x5c92aa['attributes'][_0x9ae2('0x37')]?_0x5c92aa['attributes']:_0xee33a2[_0x9ae2('0x33')];if(!_0x3791d7[_0x9ae2('0x31')]['hasOwnProperty'](_0x9ae2('0x38'))){_0x5c92aa[_0x9ae2('0x39')]=qs['limit'](_0x3791d7[_0x9ae2('0x31')]['limit']);_0x5c92aa[_0x9ae2('0x1d')]=qs[_0x9ae2('0x1d')](_0x3791d7[_0x9ae2('0x31')][_0x9ae2('0x1d')]);}_0x5c92aa['order']=qs[_0x9ae2('0x3a')](_0x3791d7[_0x9ae2('0x31')][_0x9ae2('0x3a')]);_0x5c92aa[_0x9ae2('0x3b')]=qs[_0x9ae2('0x32')](_[_0x9ae2('0x3c')](_0x3791d7[_0x9ae2('0x31')],_0xee33a2['filters']),_0x3884c0);if(_0x3791d7[_0x9ae2('0x31')][_0x9ae2('0x3d')]){_0x5c92aa[_0x9ae2('0x3b')]=_[_0x9ae2('0x3e')](_0x5c92aa[_0x9ae2('0x3b')],{'$or':_[_0x9ae2('0x30')](_0x3884c0,function(_0x1b1ad7){if(_0x1b1ad7[_0x9ae2('0x3f')]!=='VIRTUAL'){var _0x56a058={};_0x56a058[_0x1b1ad7['name']]={'$like':'%'+_0x3791d7[_0x9ae2('0x31')]['filter']+'%'};return _0x56a058;}})});}_0x5c92aa=_[_0x9ae2('0x3e')]({},_0x5c92aa,_0x3791d7['options']);var _0x57deda={'where':_0x5c92aa['where']};return db[_0x9ae2('0x2c')][_0x9ae2('0x1c')](_0x57deda)[_0x9ae2('0x24')](function(_0x5e47ef){_0x13fb34[_0x9ae2('0x1c')]=_0x5e47ef;if(_0x3791d7['query'][_0x9ae2('0x40')]){_0x5c92aa[_0x9ae2('0x41')]=[{'all':!![]}];}return db[_0x9ae2('0x2c')][_0x9ae2('0x42')](_0x5c92aa);})[_0x9ae2('0x24')](function(_0x31b9be){_0x13fb34[_0x9ae2('0x43')]=_0x31b9be;return _0x13fb34;})['then'](respondWithFilteredResult(_0x2dfad0,_0x5c92aa))[_0x9ae2('0x44')](handleError(_0x2dfad0,null));};exports[_0x9ae2('0x45')]=function(_0x111d40,_0x198776){var _0x3fa651={'raw':![],'where':{'id':_0x111d40[_0x9ae2('0x46')]['id']}},_0x3f8b7e={};_0x3f8b7e[_0x9ae2('0x33')]=_['keys'](db[_0x9ae2('0x2c')][_0x9ae2('0x2d')]);_0x3f8b7e['query']=_['keys'](_0x111d40[_0x9ae2('0x31')]);_0x3f8b7e[_0x9ae2('0x32')]=_[_0x9ae2('0x35')](_0x3f8b7e['model'],_0x3f8b7e[_0x9ae2('0x31')]);_0x3fa651['attributes']=_['intersection'](_0x3f8b7e[_0x9ae2('0x33')],qs[_0x9ae2('0x36')](_0x111d40[_0x9ae2('0x31')][_0x9ae2('0x36')]));_0x3fa651['attributes']=_0x3fa651['attributes'][_0x9ae2('0x37')]?_0x3fa651[_0x9ae2('0x34')]:_0x3f8b7e[_0x9ae2('0x33')];if(_0x111d40[_0x9ae2('0x31')][_0x9ae2('0x40')]){_0x3fa651['include']=[{'all':!![]}];}_0x3fa651=_[_0x9ae2('0x3e')]({},_0x3fa651,_0x111d40[_0x9ae2('0x47')]);return db['DeskConfiguration'][_0x9ae2('0x48')](_0x3fa651)[_0x9ae2('0x24')](handleEntityNotFound(_0x198776,null))[_0x9ae2('0x24')](respondWithResult(_0x198776,null))[_0x9ae2('0x44')](handleError(_0x198776,null));};exports[_0x9ae2('0x49')]=function(_0xa81f47,_0x5b5738){return db[_0x9ae2('0x2c')][_0x9ae2('0x49')](_0xa81f47['body'],{})[_0x9ae2('0x24')](respondWithResult(_0x5b5738,0xc9))['catch'](handleError(_0x5b5738,null));};exports[_0x9ae2('0x23')]=function(_0x4ecd8f,_0x48699d){if(_0x4ecd8f[_0x9ae2('0x4a')]['id']){delete _0x4ecd8f['body']['id'];}return db[_0x9ae2('0x2c')][_0x9ae2('0x48')]({'where':{'id':_0x4ecd8f[_0x9ae2('0x46')]['id']}})['then'](handleEntityNotFound(_0x48699d,null))[_0x9ae2('0x24')](saveUpdates(_0x4ecd8f['body'],null))[_0x9ae2('0x24')](respondWithResult(_0x48699d,null))[_0x9ae2('0x44')](handleError(_0x48699d,null));};exports[_0x9ae2('0x25')]=function(_0x3c19d2,_0x1d2852){return db['DeskConfiguration'][_0x9ae2('0x48')]({'where':{'id':_0x3c19d2[_0x9ae2('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d2852,null))[_0x9ae2('0x24')](removeEntity(_0x1d2852,null))[_0x9ae2('0x44')](handleError(_0x1d2852,null));};exports['getFields']=function(_0x544875,_0x42a123,_0x44bfe6){var _0x257634={};var _0x3fbbe8={};var _0x5126e6;var _0x871316;return db[_0x9ae2('0x2c')]['findOne']({'where':{'id':_0x544875['params']['id']}})[_0x9ae2('0x24')](handleEntityNotFound(_0x42a123,null))[_0x9ae2('0x24')](function(_0x1a6a58){if(_0x1a6a58){_0x5126e6=_0x1a6a58;_0x3fbbe8['model']=_[_0x9ae2('0x4b')](db[_0x9ae2('0x4c')]['rawAttributes']);_0x3fbbe8[_0x9ae2('0x31')]=_['keys'](_0x544875['query']);_0x3fbbe8['filters']=_[_0x9ae2('0x35')](_0x3fbbe8[_0x9ae2('0x33')],_0x3fbbe8[_0x9ae2('0x31')]);_0x257634[_0x9ae2('0x34')]=_[_0x9ae2('0x35')](_0x3fbbe8[_0x9ae2('0x33')],qs[_0x9ae2('0x36')](_0x544875[_0x9ae2('0x31')][_0x9ae2('0x36')]));_0x257634[_0x9ae2('0x34')]=_0x257634[_0x9ae2('0x34')][_0x9ae2('0x37')]?_0x257634[_0x9ae2('0x34')]:_0x3fbbe8['model'];_0x257634[_0x9ae2('0x4d')]=qs[_0x9ae2('0x3a')](_0x544875['query']['sort']);_0x257634['where']=qs[_0x9ae2('0x32')](_[_0x9ae2('0x3c')](_0x544875['query'],_0x3fbbe8[_0x9ae2('0x32')]));if(_0x544875[_0x9ae2('0x31')][_0x9ae2('0x3d')]){_0x257634['where']=_[_0x9ae2('0x3e')](_0x257634[_0x9ae2('0x3b')],{'$or':_[_0x9ae2('0x30')](_0x257634[_0x9ae2('0x34')],function(_0x43f0ba){var _0x1054e5={};_0x1054e5[_0x43f0ba]={'$like':'%'+_0x544875['query'][_0x9ae2('0x3d')]+'%'};return _0x1054e5;})});}_0x257634=_['merge']({},_0x257634,_0x544875[_0x9ae2('0x47')]);return _0x5126e6[_0x9ae2('0x4e')](_0x257634);}})[_0x9ae2('0x24')](function(_0x5834d3){if(_0x5834d3){_0x871316=_0x5834d3[_0x9ae2('0x37')];if(!_0x544875['query'][_0x9ae2('0x4f')](_0x9ae2('0x38'))){_0x257634[_0x9ae2('0x39')]=qs[_0x9ae2('0x39')](_0x544875[_0x9ae2('0x31')][_0x9ae2('0x39')]);_0x257634[_0x9ae2('0x1d')]=qs['offset'](_0x544875['query'][_0x9ae2('0x1d')]);}return _0x5126e6[_0x9ae2('0x4e')](_0x257634);}})[_0x9ae2('0x24')](function(_0x485286){if(_0x485286){return _0x485286?{'count':_0x871316,'rows':_0x485286}:null;}})[_0x9ae2('0x24')](respondWithResult(_0x42a123,null))[_0x9ae2('0x44')](handleError(_0x42a123,null));};exports[_0x9ae2('0x50')]=function(_0x4a35e7,_0xa4c5f6,_0x522cbf){var _0x3fdb62={};var _0x59a2a6={};var _0x4e3afc;var _0x4eee33;return db[_0x9ae2('0x2c')][_0x9ae2('0x51')]({'where':{'id':_0x4a35e7['params']['id']}})['then'](handleEntityNotFound(_0xa4c5f6,null))['then'](function(_0x578332){if(_0x578332){_0x4e3afc=_0x578332;_0x59a2a6[_0x9ae2('0x33')]=_[_0x9ae2('0x4b')](db['DeskField'][_0x9ae2('0x2d')]);_0x59a2a6[_0x9ae2('0x31')]=_[_0x9ae2('0x4b')](_0x4a35e7[_0x9ae2('0x31')]);_0x59a2a6['filters']=_[_0x9ae2('0x35')](_0x59a2a6[_0x9ae2('0x33')],_0x59a2a6[_0x9ae2('0x31')]);_0x3fdb62[_0x9ae2('0x34')]=_[_0x9ae2('0x35')](_0x59a2a6[_0x9ae2('0x33')],qs['fields'](_0x4a35e7[_0x9ae2('0x31')]['fields']));_0x3fdb62[_0x9ae2('0x34')]=_0x3fdb62[_0x9ae2('0x34')][_0x9ae2('0x37')]?_0x3fdb62[_0x9ae2('0x34')]:_0x59a2a6['model'];_0x3fdb62[_0x9ae2('0x4d')]=qs[_0x9ae2('0x3a')](_0x4a35e7[_0x9ae2('0x31')]['sort']);_0x3fdb62[_0x9ae2('0x3b')]=qs[_0x9ae2('0x32')](_[_0x9ae2('0x3c')](_0x4a35e7[_0x9ae2('0x31')],_0x59a2a6[_0x9ae2('0x32')]));if(_0x4a35e7['query']['filter']){_0x3fdb62[_0x9ae2('0x3b')]=_['merge'](_0x3fdb62[_0x9ae2('0x3b')],{'$or':_[_0x9ae2('0x30')](_0x3fdb62[_0x9ae2('0x34')],function(_0x31ad32){var _0x51f420={};_0x51f420[_0x31ad32]={'$like':'%'+_0x4a35e7['query']['filter']+'%'};return _0x51f420;})});}_0x3fdb62=_[_0x9ae2('0x3e')]({},_0x3fdb62,_0x4a35e7[_0x9ae2('0x47')]);return _0x4e3afc[_0x9ae2('0x50')](_0x3fdb62);}})[_0x9ae2('0x24')](function(_0x16ee2c){if(_0x16ee2c){_0x4eee33=_0x16ee2c[_0x9ae2('0x37')];if(!_0x4a35e7[_0x9ae2('0x31')][_0x9ae2('0x4f')](_0x9ae2('0x38'))){_0x3fdb62[_0x9ae2('0x39')]=qs[_0x9ae2('0x39')](_0x4a35e7[_0x9ae2('0x31')][_0x9ae2('0x39')]);_0x3fdb62[_0x9ae2('0x1d')]=qs[_0x9ae2('0x1d')](_0x4a35e7[_0x9ae2('0x31')][_0x9ae2('0x1d')]);}return _0x4e3afc[_0x9ae2('0x50')](_0x3fdb62);}})[_0x9ae2('0x24')](function(_0x18f7c1){if(_0x18f7c1){return _0x18f7c1?{'count':_0x4eee33,'rows':_0x18f7c1}:null;}})[_0x9ae2('0x24')](respondWithResult(_0xa4c5f6,null))[_0x9ae2('0x44')](handleError(_0xa4c5f6,null));};exports['getDescriptions']=function(_0x4135b4,_0x1fae6b,_0x4c40c4){var _0x128d8b={};var _0xeda5e8={};var _0x306b1b;var _0x3ebddf;return db['DeskConfiguration'][_0x9ae2('0x51')]({'where':{'id':_0x4135b4[_0x9ae2('0x46')]['id']}})[_0x9ae2('0x24')](handleEntityNotFound(_0x1fae6b,null))[_0x9ae2('0x24')](function(_0x4c4642){if(_0x4c4642){_0x306b1b=_0x4c4642;_0xeda5e8[_0x9ae2('0x33')]=_[_0x9ae2('0x4b')](db[_0x9ae2('0x4c')][_0x9ae2('0x2d')]);_0xeda5e8['query']=_[_0x9ae2('0x4b')](_0x4135b4[_0x9ae2('0x31')]);_0xeda5e8[_0x9ae2('0x32')]=_[_0x9ae2('0x35')](_0xeda5e8[_0x9ae2('0x33')],_0xeda5e8[_0x9ae2('0x31')]);_0x128d8b['attributes']=_[_0x9ae2('0x35')](_0xeda5e8['model'],qs[_0x9ae2('0x36')](_0x4135b4[_0x9ae2('0x31')][_0x9ae2('0x36')]));_0x128d8b[_0x9ae2('0x34')]=_0x128d8b[_0x9ae2('0x34')][_0x9ae2('0x37')]?_0x128d8b[_0x9ae2('0x34')]:_0xeda5e8['model'];_0x128d8b[_0x9ae2('0x4d')]=qs['sort'](_0x4135b4[_0x9ae2('0x31')][_0x9ae2('0x3a')]);_0x128d8b[_0x9ae2('0x3b')]=qs['filters'](_[_0x9ae2('0x3c')](_0x4135b4[_0x9ae2('0x31')],_0xeda5e8[_0x9ae2('0x32')]));if(_0x4135b4[_0x9ae2('0x31')][_0x9ae2('0x3d')]){_0x128d8b['where']=_[_0x9ae2('0x3e')](_0x128d8b['where'],{'$or':_['map'](_0x128d8b['attributes'],function(_0x41ab26){var _0x193a55={};_0x193a55[_0x41ab26]={'$like':'%'+_0x4135b4[_0x9ae2('0x31')][_0x9ae2('0x3d')]+'%'};return _0x193a55;})});}_0x128d8b=_[_0x9ae2('0x3e')]({},_0x128d8b,_0x4135b4[_0x9ae2('0x47')]);return _0x306b1b[_0x9ae2('0x52')](_0x128d8b);}})[_0x9ae2('0x24')](function(_0x2a9fac){if(_0x2a9fac){_0x3ebddf=_0x2a9fac['length'];if(!_0x4135b4['query'][_0x9ae2('0x4f')]('nolimit')){_0x128d8b[_0x9ae2('0x39')]=qs[_0x9ae2('0x39')](_0x4135b4[_0x9ae2('0x31')][_0x9ae2('0x39')]);_0x128d8b[_0x9ae2('0x1d')]=qs['offset'](_0x4135b4[_0x9ae2('0x31')][_0x9ae2('0x1d')]);}return _0x306b1b[_0x9ae2('0x52')](_0x128d8b);}})[_0x9ae2('0x24')](function(_0x5d51c5){if(_0x5d51c5){return _0x5d51c5?{'count':_0x3ebddf,'rows':_0x5d51c5}:null;}})[_0x9ae2('0x24')](respondWithResult(_0x1fae6b,null))[_0x9ae2('0x44')](handleError(_0x1fae6b,null));};exports[_0x9ae2('0x53')]=function(_0x1bf8cd,_0x6e3828,_0x592ac0){var _0x585ce7={};var _0x2bc5ac={};var _0x38fed2;var _0x1ba3c3;return db[_0x9ae2('0x2c')][_0x9ae2('0x51')]({'where':{'id':_0x1bf8cd[_0x9ae2('0x46')]['id']}})['then'](handleEntityNotFound(_0x6e3828,null))[_0x9ae2('0x24')](function(_0x138342){if(_0x138342){_0x38fed2=_0x138342;_0x2bc5ac[_0x9ae2('0x33')]=_[_0x9ae2('0x4b')](db[_0x9ae2('0x54')][_0x9ae2('0x2d')]);_0x2bc5ac[_0x9ae2('0x31')]=_['keys'](_0x1bf8cd['query']);_0x2bc5ac[_0x9ae2('0x32')]=_[_0x9ae2('0x35')](_0x2bc5ac['model'],_0x2bc5ac[_0x9ae2('0x31')]);_0x585ce7[_0x9ae2('0x34')]=_[_0x9ae2('0x35')](_0x2bc5ac[_0x9ae2('0x33')],qs[_0x9ae2('0x36')](_0x1bf8cd[_0x9ae2('0x31')]['fields']));_0x585ce7[_0x9ae2('0x34')]=_0x585ce7[_0x9ae2('0x34')][_0x9ae2('0x37')]?_0x585ce7[_0x9ae2('0x34')]:_0x2bc5ac[_0x9ae2('0x33')];_0x585ce7[_0x9ae2('0x4d')]=qs['sort'](_0x1bf8cd[_0x9ae2('0x31')][_0x9ae2('0x3a')]);_0x585ce7[_0x9ae2('0x3b')]=qs[_0x9ae2('0x32')](_['pick'](_0x1bf8cd[_0x9ae2('0x31')],_0x2bc5ac[_0x9ae2('0x32')]));if(_0x1bf8cd[_0x9ae2('0x31')][_0x9ae2('0x3d')]){_0x585ce7[_0x9ae2('0x3b')]=_['merge'](_0x585ce7[_0x9ae2('0x3b')],{'$or':_[_0x9ae2('0x30')](_0x585ce7['attributes'],function(_0x2323e9){var _0x2e7517={};_0x2e7517[_0x2323e9]={'$like':'%'+_0x1bf8cd['query'][_0x9ae2('0x3d')]+'%'};return _0x2e7517;})});}_0x585ce7=_[_0x9ae2('0x3e')]({},_0x585ce7,_0x1bf8cd[_0x9ae2('0x47')]);return _0x38fed2['getTags'](_0x585ce7);}})[_0x9ae2('0x24')](function(_0x36e170){if(_0x36e170){_0x1ba3c3=_0x36e170[_0x9ae2('0x37')];if(!_0x1bf8cd[_0x9ae2('0x31')][_0x9ae2('0x4f')](_0x9ae2('0x38'))){_0x585ce7['limit']=qs['limit'](_0x1bf8cd['query']['limit']);_0x585ce7[_0x9ae2('0x1d')]=qs[_0x9ae2('0x1d')](_0x1bf8cd[_0x9ae2('0x31')][_0x9ae2('0x1d')]);}return _0x38fed2[_0x9ae2('0x53')](_0x585ce7);}})['then'](function(_0x39b8d1){if(_0x39b8d1){return _0x39b8d1?{'count':_0x1ba3c3,'rows':_0x39b8d1}:null;}})[_0x9ae2('0x24')](respondWithResult(_0x6e3828,null))['catch'](handleError(_0x6e3828,null));};exports[_0x9ae2('0x55')]=function(_0xcbd8c4,_0x42b1d7,_0x4c0e62){if(_0xcbd8c4[_0x9ae2('0x4a')]['id']){delete _0xcbd8c4[_0x9ae2('0x4a')]['id'];}return db[_0x9ae2('0x2c')][_0x9ae2('0x51')]({'where':{'id':_0xcbd8c4[_0x9ae2('0x46')]['id']}})['then'](handleEntityNotFound(_0x42b1d7,null))[_0x9ae2('0x24')](function(_0x3811d2){if(_0x3811d2){return _0x3811d2['setTags'](_0xcbd8c4[_0x9ae2('0x4a')][_0x9ae2('0x56')]||[]);}return null;})['then'](respondWithResult(_0x42b1d7,null))['catch'](handleError(_0x42b1d7,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 32dd33f..8d82f99 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 _0x51a0=['define','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports'];(function(_0x448d54,_0x5344df){var _0x3af01a=function(_0x4fb10c){while(--_0x4fb10c){_0x448d54['push'](_0x448d54['shift']());}};_0x3af01a(++_0x5344df);}(_0x51a0,0x1c9));var _0x051a=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0x51a0[_0x39479f];return _0x4a6d96;};'use strict';var _=require(_0x051a('0x0'));var util=require(_0x051a('0x1'));var logger=require(_0x051a('0x2'))(_0x051a('0x3'));var moment=require(_0x051a('0x4'));var BPromise=require(_0x051a('0x5'));var rp=require(_0x051a('0x6'));var fs=require('fs');var path=require(_0x051a('0x7'));var rimraf=require(_0x051a('0x8'));var config=require('../../config/environment');var attributes=require(_0x051a('0x9'));module[_0x051a('0xa')]=function(_0x32f30e,_0x23c6f8){return _0x32f30e[_0x051a('0xb')]('DeskConfiguration',attributes,{'tableName':_0x051a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e7f=['./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x131ed2,_0x2b56c0){var _0x27d2a3=function(_0x1bc472){while(--_0x1bc472){_0x131ed2['push'](_0x131ed2['shift']());}};_0x27d2a3(++_0x2b56c0);}(_0x6e7f,0xc4));var _0xf6e7=function(_0x596d9d,_0x5e9fd0){_0x596d9d=_0x596d9d-0x0;var _0x5210ea=_0x6e7f[_0x596d9d];return _0x5210ea;};'use strict';var _=require(_0xf6e7('0x0'));var util=require(_0xf6e7('0x1'));var logger=require(_0xf6e7('0x2'))(_0xf6e7('0x3'));var moment=require(_0xf6e7('0x4'));var BPromise=require(_0xf6e7('0x5'));var rp=require(_0xf6e7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf6e7('0x7'));var attributes=require(_0xf6e7('0x8'));module['exports']=function(_0x3f3444,_0x1039cb){return _0x3f3444[_0xf6e7('0x9')](_0xf6e7('0xa'),attributes,{'tableName':_0xf6e7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index c354f8e..c28bd59 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 _0xb78e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0x334688,_0xf68c2c){var _0x42dc15=function(_0x17f90a){while(--_0x17f90a){_0x334688['push'](_0x334688['shift']());}};_0x42dc15(++_0xf68c2c);}(_0xb78e,0x1c9));var _0xeb78=function(_0x390cbb,_0x49c689){_0x390cbb=_0x390cbb-0x0;var _0x1f6fbb=_0xb78e[_0x390cbb];return _0x1f6fbb;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ccc2f,_0x30c884,_0x2b7925){return new BPromise(function(_0x36963f,_0x5259aa){return client['request'](_0x1ccc2f,_0x2b7925)[_0xeb78('0xc')](function(_0x1c941d){logger[_0xeb78('0xd')](_0xeb78('0xe'),_0x30c884,_0xeb78('0xf'));logger[_0xeb78('0x10')](_0xeb78('0x11'),_0x30c884,_0xeb78('0xf'),JSON[_0xeb78('0x12')](_0x1c941d));if(_0x1c941d['error']){if(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x14')]===0x1f4){logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);return _0x5259aa(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);}logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d['error'][_0xeb78('0x15')]);return _0x36963f(_0x1c941d[_0xeb78('0x13')]['message']);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x30c884,_0xeb78('0xf'));_0x36963f(_0x1c941d['result'][_0xeb78('0x15')]);}})[_0xeb78('0x16')](function(_0x49123d){logger[_0xeb78('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x30c884,_0x49123d);_0x5259aa(_0x49123d);});});} \ No newline at end of file +var _0x20d6=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x168249,_0x19d89f){var _0xe8a479=function(_0x5c7209){while(--_0x5c7209){_0x168249['push'](_0x168249['shift']());}};_0xe8a479(++_0x19d89f);}(_0x20d6,0x1b8));var _0x620d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x20d6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var moment=require(_0x620d('0x2'));var BPromise=require(_0x620d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x620d('0x4'));var db=require(_0x620d('0x5'))['db'];var utils=require(_0x620d('0x6'));var logger=require(_0x620d('0x7'))(_0x620d('0x8'));var config=require(_0x620d('0x9'));var jayson=require(_0x620d('0xa'));var client=jayson[_0x620d('0xb')][_0x620d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3aa4f3,_0x260d43,_0x52657f){return new BPromise(function(_0x3d93af,_0x478aeb){return client['request'](_0x3aa4f3,_0x52657f)[_0x620d('0xd')](function(_0x473790){logger[_0x620d('0xe')](_0x620d('0xf'),_0x260d43,_0x620d('0x10'));logger[_0x620d('0x11')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x260d43,_0x620d('0x10'),JSON[_0x620d('0x12')](_0x473790));if(_0x473790['error']){if(_0x473790[_0x620d('0x13')][_0x620d('0x14')]===0x1f4){logger[_0x620d('0x13')](_0x620d('0xf'),_0x260d43,_0x473790[_0x620d('0x13')][_0x620d('0x15')]);return _0x478aeb(_0x473790[_0x620d('0x13')][_0x620d('0x15')]);}logger['error'](_0x620d('0xf'),_0x260d43,_0x473790[_0x620d('0x13')][_0x620d('0x15')]);return _0x3d93af(_0x473790[_0x620d('0x13')][_0x620d('0x15')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x260d43,'request\x20sent');_0x3d93af(_0x473790[_0x620d('0x16')]['message']);}})[_0x620d('0x17')](function(_0x20a91e){logger[_0x620d('0x13')](_0x620d('0xf'),_0x260d43,_0x20a91e);_0x478aeb(_0x20a91e);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 23017f6..a0e89c0 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 _0x1c38=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','post','put','/:id','update','delete'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0x1c38,0x188));var _0x81c3=function(_0x38c24b,_0x5a4734){_0x38c24b=_0x38c24b-0x0;var _0x4f8737=_0x1c38[_0x38c24b];return _0x4f8737;};'use strict';var multer=require('multer');var util=require(_0x81c3('0x0'));var path=require(_0x81c3('0x1'));var timeout=require(_0x81c3('0x2'));var express=require('express');var router=express[_0x81c3('0x3')]();var fs_extra=require(_0x81c3('0x4'));var auth=require(_0x81c3('0x5'));var interaction=require(_0x81c3('0x6'));var config=require(_0x81c3('0x7'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0x81c3('0x8')](),controller[_0x81c3('0x9')]);router[_0x81c3('0xa')]('/:id',auth[_0x81c3('0x8')](),controller['show']);router[_0x81c3('0xb')]('/',auth[_0x81c3('0x8')](),controller['create']);router[_0x81c3('0xc')](_0x81c3('0xd'),auth[_0x81c3('0x8')](),controller[_0x81c3('0xe')]);router[_0x81c3('0xf')](_0x81c3('0xd'),auth[_0x81c3('0x8')](),controller['destroy']);module[_0x81c3('0x10')]=router; \ No newline at end of file +var _0x842e=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3143b1,_0xfcdd6b){var _0x4d2c06=function(_0x1b4191){while(--_0x1b4191){_0x3143b1['push'](_0x3143b1['shift']());}};_0x4d2c06(++_0xfcdd6b);}(_0x842e,0x1c1));var _0xe842=function(_0x2db667,_0x193cf5){_0x2db667=_0x2db667-0x0;var _0x83ff9=_0x842e[_0x2db667];return _0x83ff9;};'use strict';var multer=require(_0xe842('0x0'));var util=require(_0xe842('0x1'));var path=require('path');var timeout=require(_0xe842('0x2'));var express=require(_0xe842('0x3'));var router=express[_0xe842('0x4')]();var fs_extra=require(_0xe842('0x5'));var auth=require(_0xe842('0x6'));var interaction=require(_0xe842('0x7'));var config=require(_0xe842('0x8'));var controller=require(_0xe842('0x9'));router[_0xe842('0xa')]('/',auth[_0xe842('0xb')](),controller[_0xe842('0xc')]);router['get'](_0xe842('0xd'),auth[_0xe842('0xb')](),controller[_0xe842('0xe')]);router['post']('/',auth[_0xe842('0xb')](),controller['create']);router[_0xe842('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe842('0x10')](_0xe842('0xd'),auth[_0xe842('0xb')](),controller[_0xe842('0x11')]);module[_0xe842('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index d7f1dbf..44adf32 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 _0x20fc=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2f5c6c,_0x3ba4b8){var _0x18bd1c=function(_0x258345){while(--_0x258345){_0x2f5c6c['push'](_0x2f5c6c['shift']());}};_0x18bd1c(++_0x3ba4b8);}(_0x20fc,0x101));var _0xc20f=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x20fc[_0x4b174a];return _0x3cd7bf;};'use strict';var Sequelize=require(_0xc20f('0x0'));module[_0xc20f('0x1')]={'type':{'type':Sequelize[_0xc20f('0x2')](_0xc20f('0x3'),_0xc20f('0x4'),_0xc20f('0x5'),_0xc20f('0x6'),_0xc20f('0x7')),'defaultValue':_0xc20f('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc20f('0x8')]},'keyType':{'type':Sequelize[_0xc20f('0x2')]('string',_0xc20f('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc20f('0x8')]},'nameField':{'type':Sequelize[_0xc20f('0x8')]},'customField':{'type':Sequelize[_0xc20f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc20f('0x8')]}}; \ No newline at end of file +var _0xd0f2=['string','picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports'];(function(_0x400930,_0x18ea40){var _0x38ecae=function(_0x18fca9){while(--_0x18fca9){_0x400930['push'](_0x400930['shift']());}};_0x38ecae(++_0x18ea40);}(_0xd0f2,0x7e));var _0x2d0f=function(_0x54d2bd,_0x57c539){_0x54d2bd=_0x54d2bd-0x0;var _0x34f0d4=_0xd0f2[_0x54d2bd];return _0x34f0d4;};'use strict';var Sequelize=require(_0x2d0f('0x0'));module[_0x2d0f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2d0f('0x2'),'variable','customVariable','keyValue',_0x2d0f('0x3')),'defaultValue':_0x2d0f('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2d0f('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0x2d0f('0x5'),_0x2d0f('0x6'))},'keyContent':{'type':Sequelize[_0x2d0f('0x4')]},'idField':{'type':Sequelize[_0x2d0f('0x4')]},'nameField':{'type':Sequelize[_0x2d0f('0x4')]},'customField':{'type':Sequelize[_0x2d0f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2d0f('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 5dbc6be..2ae579c 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 _0x9790=['querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','includeAll','findAll','catch','show','rawAttributes','keys','find','create','body','params','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x219935,_0x5b7d02){var _0x130409=function(_0x56409e){while(--_0x56409e){_0x219935['push'](_0x219935['shift']());}};_0x130409(++_0x5b7d02);}(_0x9790,0xc1));var _0x0979=function(_0x34ea04,_0x58e973){_0x34ea04=_0x34ea04-0x0;var _0x40e25f=_0x9790[_0x34ea04];return _0x40e25f;};'use strict';var emlformat=require(_0x0979('0x0'));var rimraf=require(_0x0979('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0979('0x2'));var moment=require(_0x0979('0x3'));var BPromise=require(_0x0979('0x4'));var Mustache=require('mustache');var util=require(_0x0979('0x5'));var path=require('path');var sox=require(_0x0979('0x6'));var csv=require(_0x0979('0x7'));var ejs=require(_0x0979('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0979('0x9'));var squel=require(_0x0979('0xa'));var crypto=require(_0x0979('0xb'));var jsforce=require(_0x0979('0xc'));var deskjs=require(_0x0979('0xd'));var toCsv=require(_0x0979('0x7'));var querystring=require(_0x0979('0xe'));var Papa=require('papaparse');var Redis=require(_0x0979('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0979('0x10'));var logger=require(_0x0979('0x11'))('api');var utils=require(_0x0979('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0979('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1138ba,_0x30e6bc){_0x30e6bc=_0x30e6bc||0xcc;return function(_0x574bc2){if(_0x574bc2){return _0x1138ba[_0x0979('0x14')](_0x30e6bc);}return _0x1138ba['status'](_0x30e6bc)[_0x0979('0x15')]();};}function respondWithResult(_0x468cfb,_0x556253){_0x556253=_0x556253||0xc8;return function(_0x22379e){if(_0x22379e){return _0x468cfb[_0x0979('0x16')](_0x556253)['json'](_0x22379e);}};}function respondWithFilteredResult(_0x678287,_0x8dd21e){return function(_0x4981a7){if(_0x4981a7){var _0x2be243=typeof _0x8dd21e[_0x0979('0x17')]===_0x0979('0x18')&&typeof _0x8dd21e[_0x0979('0x19')]===_0x0979('0x18');var _0x4870dc=_0x4981a7['count'];var _0x3c09ee=_0x2be243?0x0:_0x8dd21e[_0x0979('0x17')];var _0xe7795a=_0x2be243?_0x4981a7[_0x0979('0x1a')]:_0x8dd21e[_0x0979('0x17')]+_0x8dd21e[_0x0979('0x19')];var _0x373bb5;if(_0xe7795a>=_0x4870dc){_0xe7795a=_0x4870dc;_0x373bb5=0xc8;}else{_0x373bb5=0xce;}_0x678287[_0x0979('0x16')](_0x373bb5);return _0x678287[_0x0979('0x1b')](_0x0979('0x1c'),_0x3c09ee+'-'+_0xe7795a+'/'+_0x4870dc)[_0x0979('0x1d')](_0x4981a7);}return null;};}function patchUpdates(_0x36622e){return function(_0xc29350){try{jsonpatch[_0x0979('0x1e')](_0xc29350,_0x36622e,!![]);}catch(_0x19a9bb){return BPromise[_0x0979('0x1f')](_0x19a9bb);}return _0xc29350[_0x0979('0x20')]();};}function saveUpdates(_0x240e37,_0x5ee346){return function(_0x4222c0){if(_0x4222c0){return _0x4222c0[_0x0979('0x21')](_0x240e37)['then'](function(_0x2a8b8b){return _0x2a8b8b;});}return null;};}function removeEntity(_0xf5c90f,_0x476d8f){return function(_0x6af79d){if(_0x6af79d){return _0x6af79d[_0x0979('0x22')]()[_0x0979('0x23')](function(){_0xf5c90f[_0x0979('0x16')](0xcc)[_0x0979('0x15')]();});}};}function handleEntityNotFound(_0xaeda03,_0x467b08){return function(_0x5b9e6f){if(!_0x5b9e6f){_0xaeda03[_0x0979('0x14')](0x194);}return _0x5b9e6f;};}function handleError(_0x34e240,_0x183065){_0x183065=_0x183065||0x1f4;return function(_0x2518c4){logger['error'](_0x2518c4[_0x0979('0x24')]);if(_0x2518c4[_0x0979('0x25')]){delete _0x2518c4[_0x0979('0x25')];}_0x34e240[_0x0979('0x16')](_0x183065)[_0x0979('0x26')](_0x2518c4);};}exports[_0x0979('0x27')]=function(_0x2f3126,_0x1c93fd){var _0x27e510={},_0x32b52e={},_0x407930={'count':0x0,'rows':[]};var _0x1c2369=_[_0x0979('0x28')](db[_0x0979('0x29')]['rawAttributes'],function(_0x4f16bd){return{'name':_0x4f16bd[_0x0979('0x2a')],'type':_0x4f16bd[_0x0979('0x2b')][_0x0979('0x2c')]};});_0x32b52e[_0x0979('0x2d')]=_[_0x0979('0x28')](_0x1c2369,_0x0979('0x25'));_0x32b52e[_0x0979('0x2e')]=_['keys'](_0x2f3126[_0x0979('0x2e')]);_0x32b52e[_0x0979('0x2f')]=_[_0x0979('0x30')](_0x32b52e[_0x0979('0x2d')],_0x32b52e[_0x0979('0x2e')]);_0x27e510[_0x0979('0x31')]=_['intersection'](_0x32b52e[_0x0979('0x2d')],qs[_0x0979('0x32')](_0x2f3126[_0x0979('0x2e')][_0x0979('0x32')]));_0x27e510[_0x0979('0x31')]=_0x27e510[_0x0979('0x31')][_0x0979('0x33')]?_0x27e510[_0x0979('0x31')]:_0x32b52e[_0x0979('0x2d')];if(!_0x2f3126[_0x0979('0x2e')][_0x0979('0x34')](_0x0979('0x35'))){_0x27e510[_0x0979('0x19')]=qs[_0x0979('0x19')](_0x2f3126[_0x0979('0x2e')][_0x0979('0x19')]);_0x27e510['offset']=qs[_0x0979('0x17')](_0x2f3126['query'][_0x0979('0x17')]);}_0x27e510['order']=qs[_0x0979('0x36')](_0x2f3126[_0x0979('0x2e')][_0x0979('0x36')]);_0x27e510[_0x0979('0x37')]=qs[_0x0979('0x2f')](_[_0x0979('0x38')](_0x2f3126['query'],_0x32b52e[_0x0979('0x2f')]),_0x1c2369);if(_0x2f3126['query']['filter']){_0x27e510[_0x0979('0x37')]=_[_0x0979('0x39')](_0x27e510[_0x0979('0x37')],{'$or':_[_0x0979('0x28')](_0x1c2369,function(_0x3d385b){if(_0x3d385b[_0x0979('0x2b')]!=='VIRTUAL'){var _0x1258a8={};_0x1258a8[_0x3d385b[_0x0979('0x25')]]={'$like':'%'+_0x2f3126['query']['filter']+'%'};return _0x1258a8;}})});}_0x27e510=_[_0x0979('0x39')]({},_0x27e510,_0x2f3126[_0x0979('0x3a')]);var _0x1647b9={'where':_0x27e510[_0x0979('0x37')]};return db['DeskField'][_0x0979('0x1a')](_0x1647b9)['then'](function(_0x579169){_0x407930['count']=_0x579169;if(_0x2f3126[_0x0979('0x2e')][_0x0979('0x3b')]){_0x27e510['include']=[{'all':!![]}];}return db['DeskField'][_0x0979('0x3c')](_0x27e510);})[_0x0979('0x23')](function(_0x4b88bd){_0x407930['rows']=_0x4b88bd;return _0x407930;})[_0x0979('0x23')](respondWithFilteredResult(_0x1c93fd,_0x27e510))[_0x0979('0x3d')](handleError(_0x1c93fd,null));};exports[_0x0979('0x3e')]=function(_0x272ba7,_0xbbee68){var _0x3c4494={'raw':!![],'where':{'id':_0x272ba7['params']['id']}},_0x2b2e3a={};_0x2b2e3a[_0x0979('0x2d')]=_['keys'](db[_0x0979('0x29')][_0x0979('0x3f')]);_0x2b2e3a['query']=_[_0x0979('0x40')](_0x272ba7['query']);_0x2b2e3a[_0x0979('0x2f')]=_[_0x0979('0x30')](_0x2b2e3a[_0x0979('0x2d')],_0x2b2e3a[_0x0979('0x2e')]);_0x3c4494[_0x0979('0x31')]=_[_0x0979('0x30')](_0x2b2e3a[_0x0979('0x2d')],qs['fields'](_0x272ba7[_0x0979('0x2e')]['fields']));_0x3c4494[_0x0979('0x31')]=_0x3c4494[_0x0979('0x31')][_0x0979('0x33')]?_0x3c4494[_0x0979('0x31')]:_0x2b2e3a[_0x0979('0x2d')];if(_0x272ba7[_0x0979('0x2e')][_0x0979('0x3b')]){_0x3c4494['include']=[{'all':!![]}];}_0x3c4494=_[_0x0979('0x39')]({},_0x3c4494,_0x272ba7['options']);return db['DeskField'][_0x0979('0x41')](_0x3c4494)[_0x0979('0x23')](handleEntityNotFound(_0xbbee68,null))['then'](respondWithResult(_0xbbee68,null))['catch'](handleError(_0xbbee68,null));};exports[_0x0979('0x42')]=function(_0x15d3bd,_0x1887f6){return db['DeskField'][_0x0979('0x42')](_0x15d3bd['body'],{})[_0x0979('0x23')](respondWithResult(_0x1887f6,0xc9))[_0x0979('0x3d')](handleError(_0x1887f6,null));};exports[_0x0979('0x21')]=function(_0x1e4679,_0x2b699b){if(_0x1e4679[_0x0979('0x43')]['id']){delete _0x1e4679[_0x0979('0x43')]['id'];}return db['DeskField']['find']({'where':{'id':_0x1e4679[_0x0979('0x44')]['id']}})[_0x0979('0x23')](handleEntityNotFound(_0x2b699b,null))['then'](saveUpdates(_0x1e4679['body'],null))['then'](respondWithResult(_0x2b699b,null))[_0x0979('0x3d')](handleError(_0x2b699b,null));};exports['destroy']=function(_0x2bb6c2,_0x2fc38a){return db[_0x0979('0x29')][_0x0979('0x41')]({'where':{'id':_0x2bb6c2[_0x0979('0x44')]['id']}})['then'](handleEntityNotFound(_0x2fc38a,null))['then'](removeEntity(_0x2fc38a,null))[_0x0979('0x3d')](handleError(_0x2fc38a,null));}; \ No newline at end of file +var _0xd101=['apply','reject','update','then','destroy','error','stack','name','send','map','DeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0xf07548,_0x2779f1){var _0xf8987d=function(_0x5e5a5){while(--_0x5e5a5){_0xf07548['push'](_0xf07548['shift']());}};_0xf8987d(++_0x2779f1);}(_0xd101,0xc1));var _0x1d10=function(_0x4f013c,_0x394a41){_0x4f013c=_0x4f013c-0x0;var _0x2cdf77=_0xd101[_0x4f013c];return _0x2cdf77;};'use strict';var emlformat=require(_0x1d10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1d10('0x1'));var jsonpatch=require(_0x1d10('0x2'));var rp=require(_0x1d10('0x3'));var moment=require(_0x1d10('0x4'));var BPromise=require(_0x1d10('0x5'));var Mustache=require(_0x1d10('0x6'));var util=require(_0x1d10('0x7'));var path=require(_0x1d10('0x8'));var sox=require('sox');var csv=require(_0x1d10('0x9'));var ejs=require(_0x1d10('0xa'));var fs=require('fs');var fs_extra=require(_0x1d10('0xb'));var _=require(_0x1d10('0xc'));var squel=require(_0x1d10('0xd'));var crypto=require(_0x1d10('0xe'));var jsforce=require(_0x1d10('0xf'));var deskjs=require(_0x1d10('0x10'));var toCsv=require(_0x1d10('0x9'));var querystring=require(_0x1d10('0x11'));var Papa=require(_0x1d10('0x12'));var Redis=require(_0x1d10('0x13'));var authService=require(_0x1d10('0x14'));var qs=require(_0x1d10('0x15'));var as=require(_0x1d10('0x16'));var hardwareService=require(_0x1d10('0x17'));var logger=require(_0x1d10('0x18'))('api');var utils=require(_0x1d10('0x19'));var config=require(_0x1d10('0x1a'));var licenseUtil=require(_0x1d10('0x1b'));var db=require(_0x1d10('0x1c'))['db'];function respondWithStatusCode(_0x268506,_0x5b71d8){_0x5b71d8=_0x5b71d8||0xcc;return function(_0x3f6bd8){if(_0x3f6bd8){return _0x268506[_0x1d10('0x1d')](_0x5b71d8);}return _0x268506[_0x1d10('0x1e')](_0x5b71d8)[_0x1d10('0x1f')]();};}function respondWithResult(_0x2224ff,_0x183bc4){_0x183bc4=_0x183bc4||0xc8;return function(_0x56bc3d){if(_0x56bc3d){return _0x2224ff[_0x1d10('0x1e')](_0x183bc4)[_0x1d10('0x20')](_0x56bc3d);}};}function respondWithFilteredResult(_0x306953,_0x2ad3c0){return function(_0x4f014a){if(_0x4f014a){var _0x3aedf7=typeof _0x2ad3c0[_0x1d10('0x21')]===_0x1d10('0x22')&&typeof _0x2ad3c0[_0x1d10('0x23')]===_0x1d10('0x22');var _0x382b37=_0x4f014a[_0x1d10('0x24')];var _0x4f3e2a=_0x3aedf7?0x0:_0x2ad3c0[_0x1d10('0x21')];var _0x1163dd=_0x3aedf7?_0x4f014a[_0x1d10('0x24')]:_0x2ad3c0[_0x1d10('0x21')]+_0x2ad3c0[_0x1d10('0x23')];var _0x5e61f8;if(_0x1163dd>=_0x382b37){_0x1163dd=_0x382b37;_0x5e61f8=0xc8;}else{_0x5e61f8=0xce;}_0x306953['status'](_0x5e61f8);return _0x306953[_0x1d10('0x25')]('Content-Range',_0x4f3e2a+'-'+_0x1163dd+'/'+_0x382b37)['json'](_0x4f014a);}return null;};}function patchUpdates(_0x5774f9){return function(_0x237b92){try{jsonpatch[_0x1d10('0x26')](_0x237b92,_0x5774f9,!![]);}catch(_0x24717c){return BPromise[_0x1d10('0x27')](_0x24717c);}return _0x237b92['save']();};}function saveUpdates(_0x5e5315,_0x140147){return function(_0x5da6cf){if(_0x5da6cf){return _0x5da6cf[_0x1d10('0x28')](_0x5e5315)[_0x1d10('0x29')](function(_0x160802){return _0x160802;});}return null;};}function removeEntity(_0x37f22d,_0x127b37){return function(_0x3601ba){if(_0x3601ba){return _0x3601ba[_0x1d10('0x2a')]()[_0x1d10('0x29')](function(){_0x37f22d[_0x1d10('0x1e')](0xcc)[_0x1d10('0x1f')]();});}};}function handleEntityNotFound(_0xf1e4c8,_0x5abc58){return function(_0x666012){if(!_0x666012){_0xf1e4c8[_0x1d10('0x1d')](0x194);}return _0x666012;};}function handleError(_0x475934,_0x15f2ee){_0x15f2ee=_0x15f2ee||0x1f4;return function(_0x18e7d9){logger[_0x1d10('0x2b')](_0x18e7d9[_0x1d10('0x2c')]);if(_0x18e7d9[_0x1d10('0x2d')]){delete _0x18e7d9['name'];}_0x475934[_0x1d10('0x1e')](_0x15f2ee)[_0x1d10('0x2e')](_0x18e7d9);};}exports['index']=function(_0x13a3dc,_0x52d514){var _0x4db221={},_0x41b5b8={},_0x597aea={'count':0x0,'rows':[]};var _0xa4e6aa=_[_0x1d10('0x2f')](db[_0x1d10('0x30')][_0x1d10('0x31')],function(_0x1a43fd){return{'name':_0x1a43fd[_0x1d10('0x32')],'type':_0x1a43fd['type']['key']};});_0x41b5b8[_0x1d10('0x33')]=_[_0x1d10('0x2f')](_0xa4e6aa,_0x1d10('0x2d'));_0x41b5b8[_0x1d10('0x34')]=_[_0x1d10('0x35')](_0x13a3dc[_0x1d10('0x34')]);_0x41b5b8[_0x1d10('0x36')]=_[_0x1d10('0x37')](_0x41b5b8[_0x1d10('0x33')],_0x41b5b8[_0x1d10('0x34')]);_0x4db221['attributes']=_[_0x1d10('0x37')](_0x41b5b8['model'],qs[_0x1d10('0x38')](_0x13a3dc[_0x1d10('0x34')]['fields']));_0x4db221[_0x1d10('0x39')]=_0x4db221['attributes'][_0x1d10('0x3a')]?_0x4db221[_0x1d10('0x39')]:_0x41b5b8[_0x1d10('0x33')];if(!_0x13a3dc[_0x1d10('0x34')][_0x1d10('0x3b')]('nolimit')){_0x4db221['limit']=qs[_0x1d10('0x23')](_0x13a3dc[_0x1d10('0x34')][_0x1d10('0x23')]);_0x4db221['offset']=qs['offset'](_0x13a3dc['query'][_0x1d10('0x21')]);}_0x4db221['order']=qs[_0x1d10('0x3c')](_0x13a3dc[_0x1d10('0x34')][_0x1d10('0x3c')]);_0x4db221[_0x1d10('0x3d')]=qs['filters'](_['pick'](_0x13a3dc[_0x1d10('0x34')],_0x41b5b8[_0x1d10('0x36')]),_0xa4e6aa);if(_0x13a3dc[_0x1d10('0x34')][_0x1d10('0x3e')]){_0x4db221['where']=_[_0x1d10('0x3f')](_0x4db221['where'],{'$or':_[_0x1d10('0x2f')](_0xa4e6aa,function(_0xec1f49){if(_0xec1f49[_0x1d10('0x40')]!==_0x1d10('0x41')){var _0x38addd={};_0x38addd[_0xec1f49[_0x1d10('0x2d')]]={'$like':'%'+_0x13a3dc[_0x1d10('0x34')][_0x1d10('0x3e')]+'%'};return _0x38addd;}})});}_0x4db221=_[_0x1d10('0x3f')]({},_0x4db221,_0x13a3dc[_0x1d10('0x42')]);var _0x1cae38={'where':_0x4db221[_0x1d10('0x3d')]};return db[_0x1d10('0x30')]['count'](_0x1cae38)['then'](function(_0x35b2e3){_0x597aea[_0x1d10('0x24')]=_0x35b2e3;if(_0x13a3dc[_0x1d10('0x34')][_0x1d10('0x43')]){_0x4db221[_0x1d10('0x44')]=[{'all':!![]}];}return db[_0x1d10('0x30')][_0x1d10('0x45')](_0x4db221);})['then'](function(_0x1a67e9){_0x597aea[_0x1d10('0x46')]=_0x1a67e9;return _0x597aea;})[_0x1d10('0x29')](respondWithFilteredResult(_0x52d514,_0x4db221))['catch'](handleError(_0x52d514,null));};exports[_0x1d10('0x47')]=function(_0x427cd7,_0x2ee987){var _0x598973={'raw':!![],'where':{'id':_0x427cd7[_0x1d10('0x48')]['id']}},_0x5795f1={};_0x5795f1[_0x1d10('0x33')]=_[_0x1d10('0x35')](db[_0x1d10('0x30')][_0x1d10('0x31')]);_0x5795f1[_0x1d10('0x34')]=_[_0x1d10('0x35')](_0x427cd7['query']);_0x5795f1[_0x1d10('0x36')]=_[_0x1d10('0x37')](_0x5795f1['model'],_0x5795f1[_0x1d10('0x34')]);_0x598973['attributes']=_[_0x1d10('0x37')](_0x5795f1['model'],qs['fields'](_0x427cd7[_0x1d10('0x34')][_0x1d10('0x38')]));_0x598973[_0x1d10('0x39')]=_0x598973[_0x1d10('0x39')][_0x1d10('0x3a')]?_0x598973[_0x1d10('0x39')]:_0x5795f1[_0x1d10('0x33')];if(_0x427cd7[_0x1d10('0x34')][_0x1d10('0x43')]){_0x598973['include']=[{'all':!![]}];}_0x598973=_['merge']({},_0x598973,_0x427cd7[_0x1d10('0x42')]);return db[_0x1d10('0x30')][_0x1d10('0x49')](_0x598973)[_0x1d10('0x29')](handleEntityNotFound(_0x2ee987,null))[_0x1d10('0x29')](respondWithResult(_0x2ee987,null))[_0x1d10('0x4a')](handleError(_0x2ee987,null));};exports['create']=function(_0x2db27f,_0x1b8513){return db[_0x1d10('0x30')][_0x1d10('0x4b')](_0x2db27f[_0x1d10('0x4c')],{})[_0x1d10('0x29')](respondWithResult(_0x1b8513,0xc9))[_0x1d10('0x4a')](handleError(_0x1b8513,null));};exports[_0x1d10('0x28')]=function(_0x39bf64,_0x32a9a9){if(_0x39bf64[_0x1d10('0x4c')]['id']){delete _0x39bf64[_0x1d10('0x4c')]['id'];}return db[_0x1d10('0x30')][_0x1d10('0x49')]({'where':{'id':_0x39bf64['params']['id']}})['then'](handleEntityNotFound(_0x32a9a9,null))[_0x1d10('0x29')](saveUpdates(_0x39bf64['body'],null))['then'](respondWithResult(_0x32a9a9,null))[_0x1d10('0x4a')](handleError(_0x32a9a9,null));};exports[_0x1d10('0x2a')]=function(_0x375fb1,_0x35d8fb){return db[_0x1d10('0x30')]['find']({'where':{'id':_0x375fb1['params']['id']}})['then'](handleEntityNotFound(_0x35d8fb,null))['then'](removeEntity(_0x35d8fb,null))[_0x1d10('0x4a')](handleError(_0x35d8fb,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 48b55e9..633104b 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 _0x1689=['../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','util','../../config/logger','request-promise','rimraf'];(function(_0xe75d90,_0x574b98){var _0x346f6f=function(_0x302350){while(--_0x302350){_0xe75d90['push'](_0xe75d90['shift']());}};_0x346f6f(++_0x574b98);}(_0x1689,0x1f4));var _0x9168=function(_0x521afb,_0x48a27f){_0x521afb=_0x521afb-0x0;var _0x16652a=_0x1689[_0x521afb];return _0x16652a;};'use strict';var _=require('lodash');var util=require(_0x9168('0x0'));var logger=require(_0x9168('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9168('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9168('0x3'));var config=require(_0x9168('0x4'));var attributes=require(_0x9168('0x5'));module[_0x9168('0x6')]=function(_0x567f2b,_0x547655){return _0x567f2b[_0x9168('0x7')]('DeskField',attributes,{'tableName':_0x9168('0x8'),'paranoid':![],'indexes':[{'name':_0x9168('0x9'),'fields':[_0x9168('0xa'),_0x9168('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc73b=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField'];(function(_0x3f29bc,_0x102fa1){var _0x253de9=function(_0x3ee168){while(--_0x3ee168){_0x3f29bc['push'](_0x3f29bc['shift']());}};_0x253de9(++_0x102fa1);}(_0xc73b,0x196));var _0xbc73=function(_0x4d9702,_0x429add){_0x4d9702=_0x4d9702-0x0;var _0xc8f0d=_0xc73b[_0x4d9702];return _0xc8f0d;};'use strict';var _=require(_0xbc73('0x0'));var util=require(_0xbc73('0x1'));var logger=require(_0xbc73('0x2'))(_0xbc73('0x3'));var moment=require(_0xbc73('0x4'));var BPromise=require(_0xbc73('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc73('0x6'));var rimraf=require('rimraf');var config=require(_0xbc73('0x7'));var attributes=require('./intDeskField.attributes');module[_0xbc73('0x8')]=function(_0x300c77,_0x308f7e){return _0x300c77[_0xbc73('0x9')](_0xbc73('0xa'),attributes,{'tableName':_0xbc73('0xb'),'paranoid':![],'indexes':[{'name':_0xbc73('0xc'),'fields':[_0xbc73('0xd'),_0xbc73('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 8b9e088..ead2fe7 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 _0x51e2=['request\x20sent','debug','stringify','error','code','DeskField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x8873fc,_0x5943b2){var _0x5b401f=function(_0x462d78){while(--_0x462d78){_0x8873fc['push'](_0x8873fc['shift']());}};_0x5b401f(++_0x5943b2);}(_0x51e2,0x191));var _0x251e=function(_0x1c853b,_0x4adb87){_0x1c853b=_0x1c853b-0x0;var _0x26296c=_0x51e2[_0x1c853b];return _0x26296c;};'use strict';var _=require(_0x251e('0x0'));var util=require(_0x251e('0x1'));var moment=require(_0x251e('0x2'));var BPromise=require('bluebird');var rs=require(_0x251e('0x3'));var fs=require('fs');var Redis=require(_0x251e('0x4'));var db=require(_0x251e('0x5'))['db'];var utils=require(_0x251e('0x6'));var logger=require(_0x251e('0x7'))(_0x251e('0x8'));var config=require('../../config/environment');var jayson=require(_0x251e('0x9'));var client=jayson[_0x251e('0xa')][_0x251e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbfd7c4,_0x16f8a2,_0x2640b7){return new BPromise(function(_0x2e1c2e,_0x3a75c7){return client[_0x251e('0xc')](_0xbfd7c4,_0x2640b7)['then'](function(_0x5a396e){logger['info']('DeskField,\x20%s,\x20%s',_0x16f8a2,_0x251e('0xd'));logger[_0x251e('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x16f8a2,_0x251e('0xd'),JSON[_0x251e('0xf')](_0x5a396e));if(_0x5a396e[_0x251e('0x10')]){if(_0x5a396e[_0x251e('0x10')][_0x251e('0x11')]===0x1f4){logger[_0x251e('0x10')](_0x251e('0x12'),_0x16f8a2,_0x5a396e['error'][_0x251e('0x13')]);return _0x3a75c7(_0x5a396e[_0x251e('0x10')][_0x251e('0x13')]);}logger[_0x251e('0x10')](_0x251e('0x12'),_0x16f8a2,_0x5a396e[_0x251e('0x10')]['message']);return _0x2e1c2e(_0x5a396e[_0x251e('0x10')][_0x251e('0x13')]);}else{logger[_0x251e('0x14')](_0x251e('0x12'),_0x16f8a2,_0x251e('0xd'));_0x2e1c2e(_0x5a396e[_0x251e('0x15')]['message']);}})[_0x251e('0x16')](function(_0x3ea25d){logger['error'](_0x251e('0x12'),_0x16f8a2,_0x3ea25d);_0x3a75c7(_0x3ea25d);});});} \ No newline at end of file +var _0x4046=['request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xf7f849,_0x150058){var _0x2916f2=function(_0x27be89){while(--_0x27be89){_0xf7f849['push'](_0xf7f849['shift']());}};_0x2916f2(++_0x150058);}(_0x4046,0x14e));var _0x6404=function(_0x3195a3,_0x314dc4){_0x3195a3=_0x3195a3-0x0;var _0x34959e=_0x4046[_0x3195a3];return _0x34959e;};'use strict';var _=require(_0x6404('0x0'));var util=require('util');var moment=require(_0x6404('0x1'));var BPromise=require(_0x6404('0x2'));var rs=require(_0x6404('0x3'));var fs=require('fs');var Redis=require(_0x6404('0x4'));var db=require(_0x6404('0x5'))['db'];var utils=require(_0x6404('0x6'));var logger=require(_0x6404('0x7'))(_0x6404('0x8'));var config=require('../../config/environment');var jayson=require(_0x6404('0x9'));var client=jayson[_0x6404('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd1f1e7,_0x2a41ad,_0x1a7d51){return new BPromise(function(_0x463581,_0x2cf22c){return client[_0x6404('0xb')](_0xd1f1e7,_0x1a7d51)[_0x6404('0xc')](function(_0x559c79){logger[_0x6404('0xd')](_0x6404('0xe'),_0x2a41ad,_0x6404('0xf'));logger[_0x6404('0x10')](_0x6404('0x11'),_0x2a41ad,_0x6404('0xf'),JSON[_0x6404('0x12')](_0x559c79));if(_0x559c79['error']){if(_0x559c79['error'][_0x6404('0x13')]===0x1f4){logger[_0x6404('0x14')](_0x6404('0xe'),_0x2a41ad,_0x559c79['error']['message']);return _0x2cf22c(_0x559c79[_0x6404('0x14')][_0x6404('0x15')]);}logger[_0x6404('0x14')]('DeskField,\x20%s,\x20%s',_0x2a41ad,_0x559c79[_0x6404('0x14')][_0x6404('0x15')]);return _0x463581(_0x559c79[_0x6404('0x14')][_0x6404('0x15')]);}else{logger[_0x6404('0xd')](_0x6404('0xe'),_0x2a41ad,'request\x20sent');_0x463581(_0x559c79['result'][_0x6404('0x15')]);}})[_0x6404('0x16')](function(_0x3746f7){logger[_0x6404('0x14')](_0x6404('0xe'),_0x2a41ad,_0x3746f7);_0x2cf22c(_0x3746f7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index aeec511..842e18e 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 _0x5507=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0x5507,0x1e0));var _0x7550=function(_0x14e7f2,_0x4bdd32){_0x14e7f2=_0x14e7f2-0x0;var _0x4979a0=_0x5507[_0x14e7f2];return _0x4979a0;};'use strict';var multer=require(_0x7550('0x0'));var util=require(_0x7550('0x1'));var path=require(_0x7550('0x2'));var timeout=require(_0x7550('0x3'));var express=require(_0x7550('0x4'));var router=express[_0x7550('0x5')]();var fs_extra=require(_0x7550('0x6'));var auth=require(_0x7550('0x7'));var interaction=require(_0x7550('0x8'));var config=require('../../config/environment');var controller=require(_0x7550('0x9'));router[_0x7550('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7550('0xa')]('/:id',auth[_0x7550('0xb')](),controller[_0x7550('0xc')]);router[_0x7550('0xa')](_0x7550('0xd'),auth[_0x7550('0xb')](),controller[_0x7550('0xe')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x7550('0xf')]('/',auth[_0x7550('0xb')](),controller['create']);router[_0x7550('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7550('0x10')]);router[_0x7550('0x11')](_0x7550('0x12'),auth[_0x7550('0xb')](),controller[_0x7550('0x13')]);router[_0x7550('0x14')](_0x7550('0x12'),auth[_0x7550('0xb')](),controller[_0x7550('0x15')]);module[_0x7550('0x16')]=router; \ No newline at end of file +var _0xa5a1=['get','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xa5a1,0x188));var _0x1a5a=function(_0x2f5297,_0x2b93fc){_0x2f5297=_0x2f5297-0x0;var _0x446f62=_0xa5a1[_0x2f5297];return _0x446f62;};'use strict';var multer=require(_0x1a5a('0x0'));var util=require('util');var path=require(_0x1a5a('0x1'));var timeout=require(_0x1a5a('0x2'));var express=require(_0x1a5a('0x3'));var router=express[_0x1a5a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1a5a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1a5a('0x6'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x1a5a('0x7')](),controller['index']);router[_0x1a5a('0x8')](_0x1a5a('0x9'),auth['isAuthenticated'](),controller[_0x1a5a('0xa')]);router[_0x1a5a('0x8')]('/:id/configurations',auth[_0x1a5a('0x7')](),controller[_0x1a5a('0xb')]);router[_0x1a5a('0x8')]('/:id/fields',auth[_0x1a5a('0x7')](),controller[_0x1a5a('0xc')]);router[_0x1a5a('0xd')]('/',auth[_0x1a5a('0x7')](),controller[_0x1a5a('0xe')]);router[_0x1a5a('0xd')](_0x1a5a('0xf'),auth[_0x1a5a('0x7')](),controller['addConfiguration']);router[_0x1a5a('0x10')](_0x1a5a('0x9'),auth['isAuthenticated'](),controller[_0x1a5a('0x11')]);router['delete']('/:id',auth[_0x1a5a('0x7')](),controller[_0x1a5a('0x12')]);module[_0x1a5a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 795461c..a7253a7 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 _0xece1=['exports','STRING','sequelize'];(function(_0x11c742,_0x497ace){var _0x58a3ec=function(_0x1ffe0b){while(--_0x1ffe0b){_0x11c742['push'](_0x11c742['shift']());}};_0x58a3ec(++_0x497ace);}(_0xece1,0x89));var _0x1ece=function(_0x478de7,_0x3deb50){_0x478de7=_0x478de7-0x0;var _0x290cbd=_0xece1[_0x478de7];return _0x290cbd;};'use strict';var Sequelize=require(_0x1ece('0x0'));module[_0x1ece('0x1')]={'name':{'type':Sequelize[_0x1ece('0x2')]},'username':{'type':Sequelize[_0x1ece('0x2')]},'password':{'type':Sequelize[_0x1ece('0x2')]},'remoteUri':{'type':Sequelize[_0x1ece('0x2')]},'tenantId':{'type':Sequelize[_0x1ece('0x2')]},'clientId':{'type':Sequelize[_0x1ece('0x2')]},'clientSecret':{'type':Sequelize[_0x1ece('0x2')]},'serverUrl':{'type':Sequelize[_0x1ece('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd758=['STRING','sequelize','exports'];(function(_0x272a9e,_0x458100){var _0x1beb15=function(_0x329038){while(--_0x329038){_0x272a9e['push'](_0x272a9e['shift']());}};_0x1beb15(++_0x458100);}(_0xd758,0x172));var _0x8d75=function(_0x10f1c5,_0x124134){_0x10f1c5=_0x10f1c5-0x0;var _0x20a4e8=_0xd758[_0x10f1c5];return _0x20a4e8;};'use strict';var Sequelize=require(_0x8d75('0x0'));module[_0x8d75('0x1')]={'name':{'type':Sequelize[_0x8d75('0x2')]},'username':{'type':Sequelize[_0x8d75('0x2')]},'password':{'type':Sequelize[_0x8d75('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x8d75('0x2')]},'clientSecret':{'type':Sequelize[_0x8d75('0x2')]},'serverUrl':{'type':Sequelize[_0x8d75('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 9bc75d4..2b78632 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 _0x9f62=['findAll','show','params','includeAll','find','catch','create','body','update','getConfigurations','Dynamics365Configuration','merge','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','POST','/oauth2/token','username','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','LogicalName','forEach','@odata.type','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','DecimalAttributeMetadata','statusCode','stack','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','include'];(function(_0x302e1d,_0x4a06ad){var _0x547282=function(_0x25a5b6){while(--_0x25a5b6){_0x302e1d['push'](_0x302e1d['shift']());}};_0x547282(++_0x4a06ad);}(_0x9f62,0x154));var _0x29f6=function(_0x2c780d,_0x5c03a1){_0x2c780d=_0x2c780d-0x0;var _0x580dfd=_0x9f62[_0x2c780d];return _0x580dfd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x57b2d2,_0x2ae0e4){_0x2ae0e4=_0x2ae0e4||0xcc;return function(_0x55cf4){if(_0x55cf4){return _0x57b2d2[_0x29f6('0x13')](_0x2ae0e4);}return _0x57b2d2[_0x29f6('0x14')](_0x2ae0e4)[_0x29f6('0x15')]();};}function respondWithResult(_0x156c96,_0x35d2e2){_0x35d2e2=_0x35d2e2||0xc8;return function(_0x2418ee){if(_0x2418ee){return _0x156c96[_0x29f6('0x14')](_0x35d2e2)[_0x29f6('0x16')](_0x2418ee);}};}function respondWithFilteredResult(_0x28d314,_0x370484){return function(_0x1dde97){if(_0x1dde97){var _0x3a75d0=typeof _0x370484[_0x29f6('0x17')]===_0x29f6('0x18')&&typeof _0x370484[_0x29f6('0x19')]==='undefined';var _0x51c92f=_0x1dde97[_0x29f6('0x1a')];var _0x3af478=_0x3a75d0?0x0:_0x370484[_0x29f6('0x17')];var _0x5c8246=_0x3a75d0?_0x1dde97[_0x29f6('0x1a')]:_0x370484[_0x29f6('0x17')]+_0x370484['limit'];var _0x159227;if(_0x5c8246>=_0x51c92f){_0x5c8246=_0x51c92f;_0x159227=0xc8;}else{_0x159227=0xce;}_0x28d314[_0x29f6('0x14')](_0x159227);return _0x28d314[_0x29f6('0x1b')](_0x29f6('0x1c'),_0x3af478+'-'+_0x5c8246+'/'+_0x51c92f)[_0x29f6('0x16')](_0x1dde97);}return null;};}function patchUpdates(_0x2bfb3d){return function(_0x5673c8){try{jsonpatch[_0x29f6('0x1d')](_0x5673c8,_0x2bfb3d,!![]);}catch(_0x59def4){return BPromise['reject'](_0x59def4);}return _0x5673c8[_0x29f6('0x1e')]();};}function saveUpdates(_0x1fa159,_0x39c6b3){return function(_0xafb5dd){if(_0xafb5dd){return _0xafb5dd['update'](_0x1fa159)[_0x29f6('0x1f')](function(_0x49f67d){return _0x49f67d;});}return null;};}function removeEntity(_0xd4179c,_0xcce041){return function(_0x4200cc){if(_0x4200cc){return _0x4200cc[_0x29f6('0x20')]()['then'](function(){_0xd4179c[_0x29f6('0x14')](0xcc)[_0x29f6('0x15')]();});}};}function handleEntityNotFound(_0x47c385,_0x1401fb){return function(_0x45f792){if(!_0x45f792){_0x47c385[_0x29f6('0x13')](0x194);}return _0x45f792;};}function handleError(_0x342038,_0x84ccb7){_0x84ccb7=_0x84ccb7||0x1f4;return function(_0x4333bc){logger[_0x29f6('0x21')](_0x4333bc['stack']);if(_0x4333bc[_0x29f6('0x22')]){delete _0x4333bc[_0x29f6('0x22')];}_0x342038[_0x29f6('0x14')](_0x84ccb7)[_0x29f6('0x23')](_0x4333bc);};}exports[_0x29f6('0x24')]=function(_0x16a6ad,_0x3790f5){var _0x17b2f2={},_0x3d88db={},_0x13a3a2={'count':0x0,'rows':[]};var _0x2915bc=_[_0x29f6('0x25')](db[_0x29f6('0x26')][_0x29f6('0x27')],function(_0x375564){return{'name':_0x375564[_0x29f6('0x28')],'type':_0x375564[_0x29f6('0x29')]['key']};});_0x3d88db['model']=_[_0x29f6('0x25')](_0x2915bc,'name');_0x3d88db[_0x29f6('0x2a')]=_[_0x29f6('0x2b')](_0x16a6ad[_0x29f6('0x2a')]);_0x3d88db[_0x29f6('0x2c')]=_['intersection'](_0x3d88db['model'],_0x3d88db[_0x29f6('0x2a')]);_0x17b2f2[_0x29f6('0x2d')]=_[_0x29f6('0x2e')](_0x3d88db[_0x29f6('0x2f')],qs[_0x29f6('0x30')](_0x16a6ad[_0x29f6('0x2a')][_0x29f6('0x30')]));_0x17b2f2[_0x29f6('0x2d')]=_0x17b2f2[_0x29f6('0x2d')][_0x29f6('0x31')]?_0x17b2f2[_0x29f6('0x2d')]:_0x3d88db[_0x29f6('0x2f')];if(!_0x16a6ad[_0x29f6('0x2a')][_0x29f6('0x32')]('nolimit')){_0x17b2f2['limit']=qs[_0x29f6('0x19')](_0x16a6ad[_0x29f6('0x2a')][_0x29f6('0x19')]);_0x17b2f2['offset']=qs[_0x29f6('0x17')](_0x16a6ad[_0x29f6('0x2a')][_0x29f6('0x17')]);}_0x17b2f2[_0x29f6('0x33')]=qs[_0x29f6('0x34')](_0x16a6ad['query'][_0x29f6('0x34')]);_0x17b2f2[_0x29f6('0x35')]=qs[_0x29f6('0x2c')](_[_0x29f6('0x36')](_0x16a6ad['query'],_0x3d88db[_0x29f6('0x2c')]),_0x2915bc);if(_0x16a6ad[_0x29f6('0x2a')][_0x29f6('0x37')]){_0x17b2f2[_0x29f6('0x35')]=_['merge'](_0x17b2f2['where'],{'$or':_[_0x29f6('0x25')](_0x2915bc,function(_0x4bfc80){if(_0x4bfc80[_0x29f6('0x29')]!=='VIRTUAL'){var _0x3a1a75={};_0x3a1a75[_0x4bfc80['name']]={'$like':'%'+_0x16a6ad[_0x29f6('0x2a')][_0x29f6('0x37')]+'%'};return _0x3a1a75;}})});}_0x17b2f2=_['merge']({},_0x17b2f2,_0x16a6ad[_0x29f6('0x38')]);var _0x5d2553={'where':_0x17b2f2[_0x29f6('0x35')]};return db[_0x29f6('0x26')]['count'](_0x5d2553)[_0x29f6('0x1f')](function(_0xc6a6b1){_0x13a3a2[_0x29f6('0x1a')]=_0xc6a6b1;if(_0x16a6ad[_0x29f6('0x2a')]['includeAll']){_0x17b2f2[_0x29f6('0x39')]=[{'all':!![]}];}return db[_0x29f6('0x26')][_0x29f6('0x3a')](_0x17b2f2);})[_0x29f6('0x1f')](function(_0x1dbd17){_0x13a3a2['rows']=_0x1dbd17;return _0x13a3a2;})[_0x29f6('0x1f')](respondWithFilteredResult(_0x3790f5,_0x17b2f2))['catch'](handleError(_0x3790f5,null));};exports[_0x29f6('0x3b')]=function(_0x552257,_0xbfe671){var _0x3a8a12={'raw':![],'where':{'id':_0x552257[_0x29f6('0x3c')]['id']}},_0x4b1524={};_0x4b1524[_0x29f6('0x2f')]=_[_0x29f6('0x2b')](db[_0x29f6('0x26')]['rawAttributes']);_0x4b1524[_0x29f6('0x2a')]=_[_0x29f6('0x2b')](_0x552257[_0x29f6('0x2a')]);_0x4b1524['filters']=_[_0x29f6('0x2e')](_0x4b1524['model'],_0x4b1524[_0x29f6('0x2a')]);_0x3a8a12['attributes']=_['intersection'](_0x4b1524['model'],qs[_0x29f6('0x30')](_0x552257[_0x29f6('0x2a')][_0x29f6('0x30')]));_0x3a8a12[_0x29f6('0x2d')]=_0x3a8a12[_0x29f6('0x2d')][_0x29f6('0x31')]?_0x3a8a12[_0x29f6('0x2d')]:_0x4b1524[_0x29f6('0x2f')];if(_0x552257[_0x29f6('0x2a')][_0x29f6('0x3d')]){_0x3a8a12['include']=[{'all':!![]}];}_0x3a8a12=_['merge']({},_0x3a8a12,_0x552257[_0x29f6('0x38')]);return db[_0x29f6('0x26')][_0x29f6('0x3e')](_0x3a8a12)[_0x29f6('0x1f')](handleEntityNotFound(_0xbfe671,null))['then'](respondWithResult(_0xbfe671,null))[_0x29f6('0x3f')](handleError(_0xbfe671,null));};exports[_0x29f6('0x40')]=function(_0x532df5,_0x21f023){return db[_0x29f6('0x26')][_0x29f6('0x40')](_0x532df5[_0x29f6('0x41')],{})[_0x29f6('0x1f')](respondWithResult(_0x21f023,0xc9))[_0x29f6('0x3f')](handleError(_0x21f023,null));};exports[_0x29f6('0x42')]=function(_0x1f03b6,_0x2ca712){if(_0x1f03b6[_0x29f6('0x41')]['id']){delete _0x1f03b6[_0x29f6('0x41')]['id'];}return db[_0x29f6('0x26')]['find']({'where':{'id':_0x1f03b6[_0x29f6('0x3c')]['id']}})[_0x29f6('0x1f')](handleEntityNotFound(_0x2ca712,null))[_0x29f6('0x1f')](saveUpdates(_0x1f03b6[_0x29f6('0x41')],null))[_0x29f6('0x1f')](respondWithResult(_0x2ca712,null))['catch'](handleError(_0x2ca712,null));};exports[_0x29f6('0x20')]=function(_0x52be22,_0x546c91){return db[_0x29f6('0x26')][_0x29f6('0x3e')]({'where':{'id':_0x52be22[_0x29f6('0x3c')]['id']}})[_0x29f6('0x1f')](handleEntityNotFound(_0x546c91,null))[_0x29f6('0x1f')](removeEntity(_0x546c91,null))['catch'](handleError(_0x546c91,null));};exports[_0x29f6('0x43')]=function(_0x458ada,_0x5f42f3,_0x3bf079){var _0x513515={};var _0x288cf2={};var _0x241fb0;var _0x27601d;return db[_0x29f6('0x26')]['findOne']({'where':{'id':_0x458ada[_0x29f6('0x3c')]['id']}})[_0x29f6('0x1f')](handleEntityNotFound(_0x5f42f3,null))[_0x29f6('0x1f')](function(_0x217428){if(_0x217428){_0x241fb0=_0x217428;_0x288cf2[_0x29f6('0x2f')]=_[_0x29f6('0x2b')](db[_0x29f6('0x44')]['rawAttributes']);_0x288cf2[_0x29f6('0x2a')]=_[_0x29f6('0x2b')](_0x458ada[_0x29f6('0x2a')]);_0x288cf2[_0x29f6('0x2c')]=_[_0x29f6('0x2e')](_0x288cf2[_0x29f6('0x2f')],_0x288cf2[_0x29f6('0x2a')]);_0x513515[_0x29f6('0x2d')]=_[_0x29f6('0x2e')](_0x288cf2[_0x29f6('0x2f')],qs['fields'](_0x458ada['query'][_0x29f6('0x30')]));_0x513515[_0x29f6('0x2d')]=_0x513515[_0x29f6('0x2d')]['length']?_0x513515[_0x29f6('0x2d')]:_0x288cf2['model'];_0x513515['order']=qs[_0x29f6('0x34')](_0x458ada[_0x29f6('0x2a')]['sort']);_0x513515['where']=qs[_0x29f6('0x2c')](_[_0x29f6('0x36')](_0x458ada[_0x29f6('0x2a')],_0x288cf2['filters']));if(_0x458ada[_0x29f6('0x2a')][_0x29f6('0x37')]){_0x513515[_0x29f6('0x35')]=_[_0x29f6('0x45')](_0x513515[_0x29f6('0x35')],{'$or':_[_0x29f6('0x25')](_0x513515[_0x29f6('0x2d')],function(_0x33b1d7){var _0x2fb6f8={};_0x2fb6f8[_0x33b1d7]={'$like':'%'+_0x458ada[_0x29f6('0x2a')][_0x29f6('0x37')]+'%'};return _0x2fb6f8;})});}_0x513515=_[_0x29f6('0x45')]({},_0x513515,_0x458ada[_0x29f6('0x38')]);return _0x241fb0['getConfigurations'](_0x513515);}})['then'](function(_0x2bd7d9){if(_0x2bd7d9){_0x27601d=_0x2bd7d9['length'];if(!_0x458ada[_0x29f6('0x2a')][_0x29f6('0x32')](_0x29f6('0x46'))){_0x513515[_0x29f6('0x19')]=qs[_0x29f6('0x19')](_0x458ada['query'][_0x29f6('0x19')]);_0x513515[_0x29f6('0x17')]=qs[_0x29f6('0x17')](_0x458ada[_0x29f6('0x2a')][_0x29f6('0x17')]);}return _0x241fb0['getConfigurations'](_0x513515);}})[_0x29f6('0x1f')](function(_0x5accac){if(_0x5accac){return _0x5accac?{'count':_0x27601d,'rows':_0x5accac}:null;}})['then'](respondWithResult(_0x5f42f3,null))[_0x29f6('0x3f')](handleError(_0x5f42f3,null));};exports[_0x29f6('0x47')]=function(_0x5526b6,_0x3df82a,_0xff3886){if(_0x5526b6['body']['id']){delete _0x5526b6[_0x29f6('0x41')]['id'];}return db[_0x29f6('0x26')][_0x29f6('0x48')]({'where':{'id':_0x5526b6[_0x29f6('0x3c')]['id']}})[_0x29f6('0x1f')](handleEntityNotFound(_0x3df82a,null))[_0x29f6('0x1f')](function(_0x31903f){if(_0x31903f){_0x5526b6['body'][_0x29f6('0x49')]=_0x31903f['id'];_0x5526b6['body'][_0x29f6('0x4a')]=integrations['getSubjects'](_0x5526b6['body'][_0x29f6('0x4b')],_0x5526b6[_0x29f6('0x41')][_0x29f6('0x29')]);_0x5526b6['body'][_0x29f6('0x4c')]=integrations[_0x29f6('0x4d')](_0x5526b6[_0x29f6('0x41')]['channel'],_0x5526b6[_0x29f6('0x41')][_0x29f6('0x29')]);return db[_0x29f6('0x44')][_0x29f6('0x40')](_0x5526b6[_0x29f6('0x41')],{'include':[{'model':db[_0x29f6('0x4e')],'as':_0x29f6('0x4a')},{'model':db[_0x29f6('0x4e')],'as':'Descriptions'}]});}return null;})[_0x29f6('0x1f')](respondWithResult(_0x3df82a,null))[_0x29f6('0x3f')](handleError(_0x3df82a,null));};exports[_0x29f6('0x4f')]=function(_0x456578,_0x1636f1,_0x122a1a){var _0x1b14f5=_0x456578[_0x29f6('0x2a')]['ticketType'];var _0x245a53=_0x1b14f5===_0x29f6('0x50')?'Incident':_0x29f6('0x51');var _0x5b87b4='';var _0x1b48e8='';var _0x5a383f='';var _0x5bde9f='';var _0x2c8e28='';var _0x4474f6='';var _0x5d8d05='';var _0x504fb8='';var _0x512ca5=[_0x29f6('0x52'),_0x29f6('0x53'),_0x29f6('0x54'),_0x29f6('0x55'),_0x29f6('0x56'),_0x29f6('0x57'),_0x29f6('0x58'),'regardingobjectid',_0x29f6('0x59'),_0x29f6('0x5a')];var _0x411f3e=[_0x29f6('0x5b'),'accountidyominame',_0x29f6('0x5c'),_0x29f6('0x5d'),_0x29f6('0x5e'),_0x29f6('0x5f'),_0x29f6('0x60'),'contractidname',_0x29f6('0x61'),_0x29f6('0x62'),_0x29f6('0x63'),_0x29f6('0x64'),_0x29f6('0x65'),_0x29f6('0x66'),'createdonbehalfbyyominame',_0x29f6('0x67'),'customeridtype','customeridyominame','emailaddress',_0x29f6('0x68'),'entityimage_timestamp',_0x29f6('0x69'),_0x29f6('0x6a'),_0x29f6('0x6b'),_0x29f6('0x6c'),_0x29f6('0x6d'),_0x29f6('0x6e'),_0x29f6('0x6f'),'kbarticleidname',_0x29f6('0x70'),'masteridname',_0x29f6('0x71'),_0x29f6('0x72'),_0x29f6('0x73'),_0x29f6('0x74'),_0x29f6('0x75'),_0x29f6('0x76'),_0x29f6('0x77'),_0x29f6('0x78'),_0x29f6('0x79'),_0x29f6('0x7a'),_0x29f6('0x7b'),_0x29f6('0x7c'),'owneridname','owneridtype','owneridyominame',_0x29f6('0x7d'),_0x29f6('0x7e'),'primarycontactidyominame',_0x29f6('0x7f'),'productidname',_0x29f6('0x80'),_0x29f6('0x81'),_0x29f6('0x82'),_0x29f6('0x83'),_0x29f6('0x84'),_0x29f6('0x85'),_0x29f6('0x86'),_0x29f6('0x87'),_0x29f6('0x88'),_0x29f6('0x89'),'statecode',_0x29f6('0x8a'),'subjectidname',_0x29f6('0x8b'),_0x29f6('0x8c'),_0x29f6('0x8d'),_0x29f6('0x8e'),_0x29f6('0x8f'),_0x29f6('0x90')];var _0x41d718=_0x512ca5[_0x29f6('0x91')](_0x411f3e);return db['Dynamics365Account'][_0x29f6('0x48')]({'where':{'id':_0x456578[_0x29f6('0x3c')]['id']},'attributes':['id','username','password',_0x29f6('0x92'),_0x29f6('0x93'),_0x29f6('0x94'),_0x29f6('0x95')]})[_0x29f6('0x1f')](handleEntityNotFound(_0x1636f1,null))[_0x29f6('0x1f')](function(_0xbb3661){if(_0xbb3661){_0x504fb8=_0xbb3661[_0x29f6('0x92')];var _0x7dd8b4=_0x504fb8[_0x29f6('0x96')](-0x1);if(_0x7dd8b4==='/'){_0x504fb8=_0x504fb8[_0x29f6('0x97')](0x0,_0x504fb8[_0x29f6('0x98')](_0x7dd8b4));}_0x5d8d05=util['format']('%s/api/data/v9.0/',_0x504fb8);var _0x2e2f16={'method':_0x29f6('0x99'),'uri':'https://login.microsoftonline.com/'+_0xbb3661[_0x29f6('0x93')]+_0x29f6('0x9a'),'form':{'client_id':_0xbb3661[_0x29f6('0x94')],'resource':_0x504fb8,'username':_0xbb3661[_0x29f6('0x9b')],'password':_0xbb3661[_0x29f6('0x9c')],'grant_type':_0x29f6('0x9c'),'client_secret':_0xbb3661[_0x29f6('0x95')]},'json':!![]};return rp(_0x2e2f16);}})['then'](function(_0x240792){_0x4474f6=_0x240792[_0x29f6('0x9d')];var _0x2b6d46={'method':'GET','uri':encodeURI(_0x5d8d05+_0x29f6('0x9e')+_0x245a53+'\x27'),'headers':{'Authorization':_0x29f6('0x9f')+_0x4474f6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2b6d46);})[_0x29f6('0x1f')](function(_0x24fd9b){var _0x4c6186=_0x24fd9b[_0x29f6('0xa0')][0x0];var _0x4c7a12=_0x4c6186[_0x29f6('0xa1')];var _0x27b428={'method':_0x29f6('0xa2'),'uri':_0x5d8d05+_0x29f6('0xa3')+_0x4c7a12+_0x29f6('0xa4'),'headers':{'Authorization':_0x29f6('0x9f')+_0x4474f6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x27b428);})['then'](function(_0x3301ed){_0x5b87b4=_0x3301ed;_0x1b48e8=_0x5b87b4[_0x29f6('0xa5')];_0x1b48e8=_['remove'](_0x1b48e8,function(_0x3025df){return!_0x41d718['includes'](_0x3025df[_0x29f6('0xa6')]);});var _0x1f28ad=[];var _0xaa5519=[];_0x1b48e8[_0x29f6('0xa7')](function(_0x13d7b7){if(_0x13d7b7[_0x29f6('0xa8')]){var _0x3454f8=_0x13d7b7['@odata.type'][_0x29f6('0x97')](_0x13d7b7[_0x29f6('0xa8')][_0x29f6('0x98')]('.')+0x1);if(_0x3454f8==='PicklistAttributeMetadata'){_0x1f28ad['push'](getSelectList(_0x5d8d05,_0x1b14f5,_0xaa5519,_0x5b87b4['MetadataId'],_0x13d7b7['MetadataId'],_0x4474f6));}}});return Promise[_0x29f6('0xa9')](_0x1f28ad);})['then'](function(_0x537a8d){_0x5a383f=_0x537a8d[0x0];var _0x4ef1d4=[];var _0x257a39=[];_0x1b48e8[_0x29f6('0xa7')](function(_0x37e2b9){if(!_[_0x29f6('0xaa')](_0x37e2b9[_0x29f6('0xa8')])){var _0x5acdcc=_0x37e2b9[_0x29f6('0xa8')]['substring'](_0x37e2b9[_0x29f6('0xa8')][_0x29f6('0x98')]('.')+0x1);if(_0x5acdcc===_0x29f6('0xab')){_0x4ef1d4[_0x29f6('0xac')](getBooleanList(_0x5d8d05,_0x1b14f5,_0x257a39,_0x5b87b4['MetadataId'],_0x37e2b9['MetadataId'],_0x4474f6));}}});return Promise[_0x29f6('0xa9')](_0x4ef1d4);})[_0x29f6('0x1f')](function(_0x41a1e2){_0x5bde9f=_0x41a1e2[0x0];var _0x49c727=[];var _0x4246c0=[];_0x1b48e8[_0x29f6('0xa7')](function(_0x4b1827){if(_0x4b1827[_0x29f6('0xa8')]){var _0x3b29ba=_0x4b1827[_0x29f6('0xa8')][_0x29f6('0x97')](_0x4b1827[_0x29f6('0xa8')][_0x29f6('0x98')]('.')+0x1);if(_0x3b29ba===_0x29f6('0xad')||_0x3b29ba===_0x29f6('0xae')||_0x3b29ba===_0x29f6('0xaf')||_0x3b29ba===_0x29f6('0xb0')||_0x3b29ba==='MemoAttributeMetadata'||_0x3b29ba===_0x29f6('0xb1')||_0x3b29ba==='StatusAttributeMetadata'||_0x3b29ba==='EntityNameAttributeMetadata'||_0x3b29ba==='StateAttributeMetadata'||_0x3b29ba===_0x29f6('0xb2')){_0x49c727[_0x29f6('0xac')](getInputList(_0x5d8d05,_0x1b14f5,_0x3b29ba,_0x4246c0,_0x5b87b4['MetadataId'],_0x4b1827['MetadataId'],_0x4474f6));}}});return Promise[_0x29f6('0xa9')](_0x49c727);})[_0x29f6('0x1f')](function(_0x588422){_0x2c8e28=_0x588422[0x0];var _0x5605dd=_0x5a383f['concat'](_0x5bde9f)['concat'](_0x2c8e28);var _0x22da5b={'count':_0x5605dd['length'],'rows':_0x5605dd};return _0x22da5b;})[_0x29f6('0x1f')](respondWithResult(_0x1636f1,null))[_0x29f6('0x3f')](function(_0x5e1ae0){var _0x58952f=_0x456578[_0x29f6('0x2a')]['test']?0x1f4:_0x5e1ae0[_0x29f6('0xb3')]||0x1f4;logger[_0x29f6('0x21')](_0x5e1ae0[_0x29f6('0xb4')]);delete _0x5e1ae0[_0x29f6('0x22')];if(_0x58952f===0x191){_0x58952f=0x190;}_0x1636f1[_0x29f6('0x14')](_0x58952f)[_0x29f6('0x23')](_0x456578[_0x29f6('0x2a')][_0x29f6('0xb5')]?{'message':_0x29f6('0xb6'),'statusCode':_0x5e1ae0[_0x29f6('0xb3')]}:_0x5e1ae0);});};function getSelectList(_0x3bcf4a,_0x111a15,_0x16dd3,_0x3c2282,_0x5076ed,_0x24757e){var _0x252bab={'method':_0x29f6('0xa2'),'uri':_0x3bcf4a+_0x29f6('0xa3')+_0x3c2282+_0x29f6('0xb7')+_0x5076ed+_0x29f6('0xb8')+_0x29f6('0xb9'),'headers':{'Authorization':'Bearer\x20'+_0x24757e,'If-None-Match':null,'OData-Version':_0x29f6('0xba')},'json':!![]};return rp(_0x252bab)['then'](function(_0x3f26ba){var _0x540c1c=[];var _0x3f9f31=_0x3f26ba[_0x29f6('0xbb')][_0x29f6('0xbc')];_0x3f9f31[_0x29f6('0xa7')](function(_0x2dc960){_0x540c1c[_0x29f6('0xac')]({'name':_0x2dc960[_0x29f6('0xbd')]['UserLocalizedLabel'][_0x29f6('0xbd')],'value':String(_0x2dc960[_0x29f6('0xbe')])});});var _0x5f043e={'id':_0x111a15+'_'+_0x3f26ba['LogicalName'],'name':_0x3f26ba[_0x29f6('0xbf')][_0x29f6('0xc0')][_0x29f6('0xbd')],'custom':![],'options':_0x540c1c};_0x16dd3[_0x29f6('0xac')](_0x5f043e);return _0x16dd3;});}function getBooleanList(_0x5df735,_0x246144,_0x2fd65b,_0x4dfb51,_0x3d8d44,_0x380327){var _0x210321={'method':_0x29f6('0xa2'),'uri':_0x5df735+_0x29f6('0xa3')+_0x4dfb51+_0x29f6('0xb7')+_0x3d8d44+_0x29f6('0xc1'),'headers':{'Authorization':_0x29f6('0x9f')+_0x380327,'If-None-Match':null,'OData-Version':_0x29f6('0xba')},'json':!![]};return rp(_0x210321)[_0x29f6('0x1f')](function(_0x290cce){var _0x1b8f62=[];_0x1b8f62[_0x29f6('0xac')]({'name':_0x290cce['OptionSet'][_0x29f6('0xc2')][_0x29f6('0xbd')][_0x29f6('0xc0')][_0x29f6('0xbd')],'value':'true'},{'name':_0x290cce[_0x29f6('0xbb')][_0x29f6('0xc3')][_0x29f6('0xbd')]['UserLocalizedLabel'][_0x29f6('0xbd')],'value':_0x29f6('0xc4')});var _0x4d02ae={'id':_0x246144+'_'+_0x290cce[_0x29f6('0xa6')],'name':_0x290cce[_0x29f6('0xbf')][_0x29f6('0xc0')][_0x29f6('0xbd')],'custom':![],'options':_0x1b8f62};_0x2fd65b[_0x29f6('0xac')](_0x4d02ae);return _0x2fd65b;});}function getInputList(_0x2f0981,_0x6c90c3,_0x1bf0e8,_0xcf8b37,_0x303732,_0x1dfd8a,_0x5bc6df){var _0x512055={'method':_0x29f6('0xa2'),'uri':_0x2f0981+_0x29f6('0xa3')+_0x303732+_0x29f6('0xb7')+_0x1dfd8a+_0x29f6('0xc5')+_0x1bf0e8+_0x29f6('0xc6'),'headers':{'Authorization':_0x29f6('0x9f')+_0x5bc6df,'If-None-Match':null,'OData-Version':_0x29f6('0xba')},'json':!![]};return rp(_0x512055)[_0x29f6('0x1f')](function(_0x51c777){var _0x5bd286={'id':_0x6c90c3+'_'+_0x51c777['LogicalName'],'name':_0x51c777[_0x29f6('0xbf')][_0x29f6('0xc0')]?_0x51c777[_0x29f6('0xbf')][_0x29f6('0xc0')]['Label']:_0x51c777[_0x29f6('0xa6')],'custom':![],'options':[]};_0xcf8b37[_0x29f6('0xac')](_0x5bd286);return _0xcf8b37;});} \ No newline at end of file +var _0x212b=['getFields','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','kbarticleidname','lastonholdtime','masteridname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','concat','username','password','remoteUri','tenantId','clientId','substring','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','PicklistAttributeMetadata','push','MetadataId','all','isNil','@odata.type','lastIndexOf','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getConfigurations','findOne','Dynamics365Configuration','filter','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field'];(function(_0x3671a3,_0x3fe748){var _0x4d5248=function(_0x333b19){while(--_0x333b19){_0x3671a3['push'](_0x3671a3['shift']());}};_0x4d5248(++_0x3fe748);}(_0x212b,0x148));var _0xb212=function(_0x1e1ae8,_0x50fb22){_0x1e1ae8=_0x1e1ae8-0x0;var _0x34e1d2=_0x212b[_0x1e1ae8];return _0x34e1d2;};'use strict';var emlformat=require(_0xb212('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb212('0x1'));var jsonpatch=require(_0xb212('0x2'));var rp=require(_0xb212('0x3'));var moment=require(_0xb212('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb212('0x5'));var util=require(_0xb212('0x6'));var path=require(_0xb212('0x7'));var sox=require('sox');var csv=require(_0xb212('0x8'));var ejs=require(_0xb212('0x9'));var fs=require('fs');var fs_extra=require(_0xb212('0xa'));var _=require('lodash');var squel=require(_0xb212('0xb'));var crypto=require(_0xb212('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb212('0xd'));var toCsv=require(_0xb212('0x8'));var querystring=require(_0xb212('0xe'));var Papa=require('papaparse');var Redis=require(_0xb212('0xf'));var authService=require(_0xb212('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb212('0x11'))('api');var utils=require(_0xb212('0x12'));var config=require(_0xb212('0x13'));var licenseUtil=require(_0xb212('0x14'));var db=require(_0xb212('0x15'))['db'];var integrations=require(_0xb212('0x16'));function respondWithStatusCode(_0x1dd322,_0x11ea42){_0x11ea42=_0x11ea42||0xcc;return function(_0x1da076){if(_0x1da076){return _0x1dd322[_0xb212('0x17')](_0x11ea42);}return _0x1dd322[_0xb212('0x18')](_0x11ea42)[_0xb212('0x19')]();};}function respondWithResult(_0x2f12bf,_0x5118f5){_0x5118f5=_0x5118f5||0xc8;return function(_0x576095){if(_0x576095){return _0x2f12bf['status'](_0x5118f5)['json'](_0x576095);}};}function respondWithFilteredResult(_0x105d4c,_0x11dcab){return function(_0x1b2f6d){if(_0x1b2f6d){var _0x5221a0=typeof _0x11dcab[_0xb212('0x1a')]===_0xb212('0x1b')&&typeof _0x11dcab[_0xb212('0x1c')]===_0xb212('0x1b');var _0x320802=_0x1b2f6d[_0xb212('0x1d')];var _0x35ffa2=_0x5221a0?0x0:_0x11dcab[_0xb212('0x1a')];var _0x38c19f=_0x5221a0?_0x1b2f6d[_0xb212('0x1d')]:_0x11dcab[_0xb212('0x1a')]+_0x11dcab[_0xb212('0x1c')];var _0x26ccdb;if(_0x38c19f>=_0x320802){_0x38c19f=_0x320802;_0x26ccdb=0xc8;}else{_0x26ccdb=0xce;}_0x105d4c['status'](_0x26ccdb);return _0x105d4c['set'](_0xb212('0x1e'),_0x35ffa2+'-'+_0x38c19f+'/'+_0x320802)[_0xb212('0x1f')](_0x1b2f6d);}return null;};}function patchUpdates(_0x228a57){return function(_0x40ff27){try{jsonpatch[_0xb212('0x20')](_0x40ff27,_0x228a57,!![]);}catch(_0xd703d0){return BPromise[_0xb212('0x21')](_0xd703d0);}return _0x40ff27[_0xb212('0x22')]();};}function saveUpdates(_0x3b9361,_0x30aaba){return function(_0x45a641){if(_0x45a641){return _0x45a641[_0xb212('0x23')](_0x3b9361)[_0xb212('0x24')](function(_0x491c3b){return _0x491c3b;});}return null;};}function removeEntity(_0x5e0c12,_0x25d40e){return function(_0x3d01f9){if(_0x3d01f9){return _0x3d01f9[_0xb212('0x25')]()[_0xb212('0x24')](function(){_0x5e0c12[_0xb212('0x18')](0xcc)[_0xb212('0x19')]();});}};}function handleEntityNotFound(_0x2aafe4,_0x4ca0a2){return function(_0x10e4f2){if(!_0x10e4f2){_0x2aafe4['sendStatus'](0x194);}return _0x10e4f2;};}function handleError(_0xd1180f,_0x32849a){_0x32849a=_0x32849a||0x1f4;return function(_0xfd638d){logger['error'](_0xfd638d[_0xb212('0x26')]);if(_0xfd638d[_0xb212('0x27')]){delete _0xfd638d[_0xb212('0x27')];}_0xd1180f['status'](_0x32849a)[_0xb212('0x28')](_0xfd638d);};}exports[_0xb212('0x29')]=function(_0x882231,_0xdf3d5d){var _0xd069d9={},_0x3cd772={},_0x429f03={'count':0x0,'rows':[]};var _0x170adf=_[_0xb212('0x2a')](db[_0xb212('0x2b')][_0xb212('0x2c')],function(_0x1d37e0){return{'name':_0x1d37e0[_0xb212('0x2d')],'type':_0x1d37e0[_0xb212('0x2e')][_0xb212('0x2f')]};});_0x3cd772['model']=_['map'](_0x170adf,_0xb212('0x27'));_0x3cd772[_0xb212('0x30')]=_['keys'](_0x882231[_0xb212('0x30')]);_0x3cd772[_0xb212('0x31')]=_[_0xb212('0x32')](_0x3cd772[_0xb212('0x33')],_0x3cd772[_0xb212('0x30')]);_0xd069d9[_0xb212('0x34')]=_[_0xb212('0x32')](_0x3cd772[_0xb212('0x33')],qs['fields'](_0x882231['query'][_0xb212('0x35')]));_0xd069d9[_0xb212('0x34')]=_0xd069d9[_0xb212('0x34')][_0xb212('0x36')]?_0xd069d9[_0xb212('0x34')]:_0x3cd772[_0xb212('0x33')];if(!_0x882231[_0xb212('0x30')][_0xb212('0x37')](_0xb212('0x38'))){_0xd069d9[_0xb212('0x1c')]=qs[_0xb212('0x1c')](_0x882231[_0xb212('0x30')][_0xb212('0x1c')]);_0xd069d9['offset']=qs[_0xb212('0x1a')](_0x882231[_0xb212('0x30')][_0xb212('0x1a')]);}_0xd069d9[_0xb212('0x39')]=qs[_0xb212('0x3a')](_0x882231['query'][_0xb212('0x3a')]);_0xd069d9[_0xb212('0x3b')]=qs['filters'](_[_0xb212('0x3c')](_0x882231['query'],_0x3cd772[_0xb212('0x31')]),_0x170adf);if(_0x882231[_0xb212('0x30')]['filter']){_0xd069d9[_0xb212('0x3b')]=_[_0xb212('0x3d')](_0xd069d9[_0xb212('0x3b')],{'$or':_[_0xb212('0x2a')](_0x170adf,function(_0x4f4c48){if(_0x4f4c48[_0xb212('0x2e')]!==_0xb212('0x3e')){var _0x563971={};_0x563971[_0x4f4c48[_0xb212('0x27')]]={'$like':'%'+_0x882231['query']['filter']+'%'};return _0x563971;}})});}_0xd069d9=_[_0xb212('0x3d')]({},_0xd069d9,_0x882231[_0xb212('0x3f')]);var _0x445cbe={'where':_0xd069d9[_0xb212('0x3b')]};return db[_0xb212('0x2b')][_0xb212('0x1d')](_0x445cbe)[_0xb212('0x24')](function(_0x50c33a){_0x429f03[_0xb212('0x1d')]=_0x50c33a;if(_0x882231[_0xb212('0x30')][_0xb212('0x40')]){_0xd069d9[_0xb212('0x41')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xb212('0x42')](_0xd069d9);})['then'](function(_0x48d758){_0x429f03[_0xb212('0x43')]=_0x48d758;return _0x429f03;})[_0xb212('0x24')](respondWithFilteredResult(_0xdf3d5d,_0xd069d9))[_0xb212('0x44')](handleError(_0xdf3d5d,null));};exports[_0xb212('0x45')]=function(_0x4df445,_0x180930){var _0x413245={'raw':![],'where':{'id':_0x4df445[_0xb212('0x46')]['id']}},_0x32122f={};_0x32122f[_0xb212('0x33')]=_[_0xb212('0x47')](db[_0xb212('0x2b')][_0xb212('0x2c')]);_0x32122f[_0xb212('0x30')]=_['keys'](_0x4df445[_0xb212('0x30')]);_0x32122f['filters']=_[_0xb212('0x32')](_0x32122f['model'],_0x32122f[_0xb212('0x30')]);_0x413245[_0xb212('0x34')]=_['intersection'](_0x32122f[_0xb212('0x33')],qs[_0xb212('0x35')](_0x4df445[_0xb212('0x30')][_0xb212('0x35')]));_0x413245[_0xb212('0x34')]=_0x413245['attributes']['length']?_0x413245[_0xb212('0x34')]:_0x32122f[_0xb212('0x33')];if(_0x4df445[_0xb212('0x30')][_0xb212('0x40')]){_0x413245[_0xb212('0x41')]=[{'all':!![]}];}_0x413245=_[_0xb212('0x3d')]({},_0x413245,_0x4df445[_0xb212('0x3f')]);return db[_0xb212('0x2b')]['find'](_0x413245)['then'](handleEntityNotFound(_0x180930,null))['then'](respondWithResult(_0x180930,null))[_0xb212('0x44')](handleError(_0x180930,null));};exports['create']=function(_0x6861cc,_0x42fdf5){return db[_0xb212('0x2b')][_0xb212('0x48')](_0x6861cc[_0xb212('0x49')],{})[_0xb212('0x24')](respondWithResult(_0x42fdf5,0xc9))[_0xb212('0x44')](handleError(_0x42fdf5,null));};exports['update']=function(_0x4d6d1b,_0x13fed8){if(_0x4d6d1b[_0xb212('0x49')]['id']){delete _0x4d6d1b[_0xb212('0x49')]['id'];}return db['Dynamics365Account'][_0xb212('0x4a')]({'where':{'id':_0x4d6d1b[_0xb212('0x46')]['id']}})[_0xb212('0x24')](handleEntityNotFound(_0x13fed8,null))[_0xb212('0x24')](saveUpdates(_0x4d6d1b[_0xb212('0x49')],null))[_0xb212('0x24')](respondWithResult(_0x13fed8,null))[_0xb212('0x44')](handleError(_0x13fed8,null));};exports[_0xb212('0x25')]=function(_0x56a00d,_0x193b54){return db[_0xb212('0x2b')][_0xb212('0x4a')]({'where':{'id':_0x56a00d[_0xb212('0x46')]['id']}})[_0xb212('0x24')](handleEntityNotFound(_0x193b54,null))[_0xb212('0x24')](removeEntity(_0x193b54,null))[_0xb212('0x44')](handleError(_0x193b54,null));};exports[_0xb212('0x4b')]=function(_0x59d707,_0x502817,_0xf32ef){var _0x189925={};var _0x5d1399={};var _0x3d05e2;var _0x4047d5;return db[_0xb212('0x2b')][_0xb212('0x4c')]({'where':{'id':_0x59d707[_0xb212('0x46')]['id']}})['then'](handleEntityNotFound(_0x502817,null))['then'](function(_0x5261f4){if(_0x5261f4){_0x3d05e2=_0x5261f4;_0x5d1399[_0xb212('0x33')]=_[_0xb212('0x47')](db[_0xb212('0x4d')][_0xb212('0x2c')]);_0x5d1399[_0xb212('0x30')]=_[_0xb212('0x47')](_0x59d707['query']);_0x5d1399[_0xb212('0x31')]=_['intersection'](_0x5d1399['model'],_0x5d1399[_0xb212('0x30')]);_0x189925[_0xb212('0x34')]=_[_0xb212('0x32')](_0x5d1399[_0xb212('0x33')],qs[_0xb212('0x35')](_0x59d707[_0xb212('0x30')][_0xb212('0x35')]));_0x189925[_0xb212('0x34')]=_0x189925[_0xb212('0x34')][_0xb212('0x36')]?_0x189925[_0xb212('0x34')]:_0x5d1399[_0xb212('0x33')];_0x189925[_0xb212('0x39')]=qs[_0xb212('0x3a')](_0x59d707['query']['sort']);_0x189925['where']=qs['filters'](_[_0xb212('0x3c')](_0x59d707['query'],_0x5d1399[_0xb212('0x31')]));if(_0x59d707[_0xb212('0x30')][_0xb212('0x4e')]){_0x189925[_0xb212('0x3b')]=_[_0xb212('0x3d')](_0x189925[_0xb212('0x3b')],{'$or':_[_0xb212('0x2a')](_0x189925[_0xb212('0x34')],function(_0x1c7dcc){var _0x431391={};_0x431391[_0x1c7dcc]={'$like':'%'+_0x59d707['query'][_0xb212('0x4e')]+'%'};return _0x431391;})});}_0x189925=_['merge']({},_0x189925,_0x59d707['options']);return _0x3d05e2[_0xb212('0x4b')](_0x189925);}})[_0xb212('0x24')](function(_0x4b492c){if(_0x4b492c){_0x4047d5=_0x4b492c[_0xb212('0x36')];if(!_0x59d707[_0xb212('0x30')][_0xb212('0x37')](_0xb212('0x38'))){_0x189925[_0xb212('0x1c')]=qs[_0xb212('0x1c')](_0x59d707[_0xb212('0x30')][_0xb212('0x1c')]);_0x189925[_0xb212('0x1a')]=qs[_0xb212('0x1a')](_0x59d707[_0xb212('0x30')]['offset']);}return _0x3d05e2[_0xb212('0x4b')](_0x189925);}})[_0xb212('0x24')](function(_0x535a3){if(_0x535a3){return _0x535a3?{'count':_0x4047d5,'rows':_0x535a3}:null;}})[_0xb212('0x24')](respondWithResult(_0x502817,null))[_0xb212('0x44')](handleError(_0x502817,null));};exports[_0xb212('0x4f')]=function(_0x4c7873,_0x5da21,_0x18f926){if(_0x4c7873[_0xb212('0x49')]['id']){delete _0x4c7873[_0xb212('0x49')]['id'];}return db[_0xb212('0x2b')][_0xb212('0x4c')]({'where':{'id':_0x4c7873[_0xb212('0x46')]['id']}})[_0xb212('0x24')](handleEntityNotFound(_0x5da21,null))[_0xb212('0x24')](function(_0x8b5088){if(_0x8b5088){_0x4c7873['body'][_0xb212('0x50')]=_0x8b5088['id'];_0x4c7873['body'][_0xb212('0x51')]=integrations['getSubjects'](_0x4c7873[_0xb212('0x49')][_0xb212('0x52')],_0x4c7873[_0xb212('0x49')][_0xb212('0x2e')]);_0x4c7873[_0xb212('0x49')][_0xb212('0x53')]=integrations[_0xb212('0x54')](_0x4c7873[_0xb212('0x49')][_0xb212('0x52')],_0x4c7873['body'][_0xb212('0x2e')]);return db[_0xb212('0x4d')][_0xb212('0x48')](_0x4c7873['body'],{'include':[{'model':db[_0xb212('0x55')],'as':'Subjects'},{'model':db[_0xb212('0x55')],'as':_0xb212('0x53')}]});}return null;})[_0xb212('0x24')](respondWithResult(_0x5da21,null))[_0xb212('0x44')](handleError(_0x5da21,null));};exports[_0xb212('0x56')]=function(_0xfa09db,_0x1a551c,_0x275f8f){var _0x40ee58=_0xfa09db[_0xb212('0x30')][_0xb212('0x57')];var _0xad1832=_0x40ee58==='incident'?_0xb212('0x58'):_0xb212('0x59');var _0x519ecb='';var _0x5a802='';var _0xa86161='';var _0x39f7fc='';var _0x1e48de='';var _0x470bca='';var _0x2ba351='';var _0x3d005b='';var _0x549842=[_0xb212('0x5a'),_0xb212('0x5b'),_0xb212('0x5c'),_0xb212('0x5d'),'caseorigincode',_0xb212('0x5e'),_0xb212('0x5f'),_0xb212('0x60'),'directioncode',_0xb212('0x61')];var _0x1380d8=['accountidname',_0xb212('0x62'),_0xb212('0x63'),'billedserviceunits',_0xb212('0x64'),_0xb212('0x65'),_0xb212('0x66'),_0xb212('0x67'),_0xb212('0x68'),_0xb212('0x69'),'createdbyname',_0xb212('0x6a'),_0xb212('0x6b'),_0xb212('0x6c'),_0xb212('0x6d'),'customeridname',_0xb212('0x6e'),_0xb212('0x6f'),_0xb212('0x70'),_0xb212('0x71'),_0xb212('0x72'),_0xb212('0x73'),_0xb212('0x74'),_0xb212('0x75'),_0xb212('0x76'),_0xb212('0x77'),'importsequencenumber','influencescore',_0xb212('0x78'),_0xb212('0x79'),_0xb212('0x7a'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0xb212('0x7b'),_0xb212('0x7c'),_0xb212('0x7d'),_0xb212('0x7e'),_0xb212('0x7f'),_0xb212('0x80'),_0xb212('0x81'),_0xb212('0x82'),_0xb212('0x83'),'overriddencreatedon',_0xb212('0x84'),_0xb212('0x85'),'owneridyominame','parentcaseidname',_0xb212('0x86'),_0xb212('0x87'),_0xb212('0x88'),_0xb212('0x89'),'productserialnumber',_0xb212('0x8a'),_0xb212('0x8b'),_0xb212('0x8c'),_0xb212('0x8d'),_0xb212('0x8e'),'sentimentvalue',_0xb212('0x8f'),'slaname',_0xb212('0x90'),'statecode',_0xb212('0x91'),_0xb212('0x92'),_0xb212('0x93'),_0xb212('0x94'),'transactioncurrencyidname',_0xb212('0x95'),'utcconversiontimezonecode','versionnumber'];var _0x51ee80=_0x549842[_0xb212('0x96')](_0x1380d8);return db[_0xb212('0x2b')][_0xb212('0x4c')]({'where':{'id':_0xfa09db[_0xb212('0x46')]['id']},'attributes':['id',_0xb212('0x97'),_0xb212('0x98'),_0xb212('0x99'),_0xb212('0x9a'),_0xb212('0x9b'),'clientSecret']})['then'](handleEntityNotFound(_0x1a551c,null))[_0xb212('0x24')](function(_0x3ebadb){if(_0x3ebadb){_0x3d005b=_0x3ebadb['remoteUri'];var _0x35dbde=_0x3d005b['slice'](-0x1);if(_0x35dbde==='/'){_0x3d005b=_0x3d005b[_0xb212('0x9c')](0x0,_0x3d005b['lastIndexOf'](_0x35dbde));}_0x2ba351=util[_0xb212('0x9d')](_0xb212('0x9e'),_0x3d005b);var _0x159ae1={'method':'POST','uri':_0xb212('0x9f')+_0x3ebadb[_0xb212('0x9a')]+_0xb212('0xa0'),'form':{'client_id':_0x3ebadb[_0xb212('0x9b')],'resource':_0x3d005b,'username':_0x3ebadb[_0xb212('0x97')],'password':_0x3ebadb[_0xb212('0x98')],'grant_type':'password','client_secret':_0x3ebadb[_0xb212('0xa1')]},'json':!![]};return rp(_0x159ae1);}})['then'](function(_0x425c7a){_0x470bca=_0x425c7a[_0xb212('0xa2')];var _0x520f24={'method':_0xb212('0xa3'),'uri':encodeURI(_0x2ba351+_0xb212('0xa4')+_0xad1832+'\x27'),'headers':{'Authorization':_0xb212('0xa5')+_0x470bca,'If-None-Match':null,'OData-Version':_0xb212('0xa6')},'json':!![]};return rp(_0x520f24);})['then'](function(_0x2c6c90){var _0x5f132f=_0x2c6c90[_0xb212('0xa7')][0x0];var _0x4b56bf=_0x5f132f['MetadataId'];var _0x120fa4={'method':_0xb212('0xa3'),'uri':_0x2ba351+_0xb212('0xa8')+_0x4b56bf+_0xb212('0xa9'),'headers':{'Authorization':_0xb212('0xa5')+_0x470bca,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x120fa4);})[_0xb212('0x24')](function(_0x3419e1){_0x519ecb=_0x3419e1;_0x5a802=_0x519ecb['Attributes'];_0x5a802=_[_0xb212('0xaa')](_0x5a802,function(_0x5b1e60){return!_0x51ee80[_0xb212('0xab')](_0x5b1e60[_0xb212('0xac')]);});var _0x62173d=[];var _0x513b15=[];_0x5a802[_0xb212('0xad')](function(_0x3f9867){if(_0x3f9867['@odata.type']){var _0x45bf9a=_0x3f9867['@odata.type'][_0xb212('0x9c')](_0x3f9867['@odata.type']['lastIndexOf']('.')+0x1);if(_0x45bf9a===_0xb212('0xae')){_0x62173d[_0xb212('0xaf')](getSelectList(_0x2ba351,_0x40ee58,_0x513b15,_0x519ecb[_0xb212('0xb0')],_0x3f9867['MetadataId'],_0x470bca));}}});return Promise[_0xb212('0xb1')](_0x62173d);})['then'](function(_0x3fbf27){_0xa86161=_0x3fbf27[0x0];var _0x4188e9=[];var _0x34109e=[];_0x5a802['forEach'](function(_0x2b4a8d){if(!_[_0xb212('0xb2')](_0x2b4a8d[_0xb212('0xb3')])){var _0x51d0d3=_0x2b4a8d['@odata.type'][_0xb212('0x9c')](_0x2b4a8d[_0xb212('0xb3')][_0xb212('0xb4')]('.')+0x1);if(_0x51d0d3===_0xb212('0xb5')){_0x4188e9[_0xb212('0xaf')](getBooleanList(_0x2ba351,_0x40ee58,_0x34109e,_0x519ecb[_0xb212('0xb0')],_0x2b4a8d[_0xb212('0xb0')],_0x470bca));}}});return Promise[_0xb212('0xb1')](_0x4188e9);})[_0xb212('0x24')](function(_0x2294f3){_0x39f7fc=_0x2294f3[0x0];var _0x3f2c55=[];var _0x33ba1e=[];_0x5a802['forEach'](function(_0x2bd0e1){if(_0x2bd0e1['@odata.type']){var _0x2ca534=_0x2bd0e1[_0xb212('0xb3')]['substring'](_0x2bd0e1[_0xb212('0xb3')][_0xb212('0xb4')]('.')+0x1);if(_0x2ca534===_0xb212('0xb6')||_0x2ca534===_0xb212('0xb7')||_0x2ca534===_0xb212('0xb8')||_0x2ca534==='IntegerAttributeMetadata'||_0x2ca534===_0xb212('0xb9')||_0x2ca534===_0xb212('0xba')||_0x2ca534==='StatusAttributeMetadata'||_0x2ca534===_0xb212('0xbb')||_0x2ca534===_0xb212('0xbc')||_0x2ca534===_0xb212('0xbd')){_0x3f2c55['push'](getInputList(_0x2ba351,_0x40ee58,_0x2ca534,_0x33ba1e,_0x519ecb[_0xb212('0xb0')],_0x2bd0e1[_0xb212('0xb0')],_0x470bca));}}});return Promise[_0xb212('0xb1')](_0x3f2c55);})[_0xb212('0x24')](function(_0x23f93b){_0x1e48de=_0x23f93b[0x0];var _0x37cba4=_0xa86161[_0xb212('0x96')](_0x39f7fc)[_0xb212('0x96')](_0x1e48de);var _0x4312bc={'count':_0x37cba4['length'],'rows':_0x37cba4};return _0x4312bc;})[_0xb212('0x24')](respondWithResult(_0x1a551c,null))[_0xb212('0x44')](function(_0x154816){var _0x3d9d4f=_0xfa09db['query'][_0xb212('0xbe')]?0x1f4:_0x154816[_0xb212('0xbf')]||0x1f4;logger[_0xb212('0xc0')](_0x154816[_0xb212('0x26')]);delete _0x154816[_0xb212('0x27')];if(_0x3d9d4f===0x191){_0x3d9d4f=0x190;}_0x1a551c[_0xb212('0x18')](_0x3d9d4f)[_0xb212('0x28')](_0xfa09db[_0xb212('0x30')][_0xb212('0xbe')]?{'message':'Wrong\x20credentials','statusCode':_0x154816[_0xb212('0xbf')]}:_0x154816);});};function getSelectList(_0x242e6d,_0x19f1a5,_0x5a0058,_0x2ce934,_0x52f86a,_0x2efb0f){var _0x2c9878={'method':_0xb212('0xa3'),'uri':_0x242e6d+_0xb212('0xa8')+_0x2ce934+')/Attributes('+_0x52f86a+_0xb212('0xc1')+_0xb212('0xc2'),'headers':{'Authorization':_0xb212('0xa5')+_0x2efb0f,'If-None-Match':null,'OData-Version':_0xb212('0xa6')},'json':!![]};return rp(_0x2c9878)['then'](function(_0x458a7a){var _0x2aa728=[];var _0x56fa3c=_0x458a7a[_0xb212('0xc3')][_0xb212('0xc4')];_0x56fa3c[_0xb212('0xad')](function(_0x361861){_0x2aa728[_0xb212('0xaf')]({'name':_0x361861[_0xb212('0xc5')][_0xb212('0xc6')][_0xb212('0xc5')],'value':String(_0x361861['Value'])});});var _0x2d2482={'id':_0x19f1a5+'_'+_0x458a7a['LogicalName'],'name':_0x458a7a[_0xb212('0xc7')][_0xb212('0xc6')]['Label'],'custom':![],'options':_0x2aa728};_0x5a0058[_0xb212('0xaf')](_0x2d2482);return _0x5a0058;});}function getBooleanList(_0x15c2a1,_0x46d827,_0x31dd8d,_0x1dfbcb,_0x5befb0,_0x364786){var _0x2db2d7={'method':_0xb212('0xa3'),'uri':_0x15c2a1+'EntityDefinitions('+_0x1dfbcb+_0xb212('0xc8')+_0x5befb0+_0xb212('0xc9'),'headers':{'Authorization':_0xb212('0xa5')+_0x364786,'If-None-Match':null,'OData-Version':_0xb212('0xa6')},'json':!![]};return rp(_0x2db2d7)[_0xb212('0x24')](function(_0xd20aa3){var _0xcde1c3=[];_0xcde1c3[_0xb212('0xaf')]({'name':_0xd20aa3[_0xb212('0xc3')][_0xb212('0xca')]['Label']['UserLocalizedLabel'][_0xb212('0xc5')],'value':_0xb212('0xcb')},{'name':_0xd20aa3['OptionSet'][_0xb212('0xcc')][_0xb212('0xc5')][_0xb212('0xc6')][_0xb212('0xc5')],'value':_0xb212('0xcd')});var _0x49472e={'id':_0x46d827+'_'+_0xd20aa3['LogicalName'],'name':_0xd20aa3[_0xb212('0xc7')][_0xb212('0xc6')][_0xb212('0xc5')],'custom':![],'options':_0xcde1c3};_0x31dd8d['push'](_0x49472e);return _0x31dd8d;});}function getInputList(_0x409567,_0x3a8bc7,_0x456e6a,_0xac7d29,_0x1e31e5,_0x2ab307,_0x1f02e9){var _0x1963cd={'method':_0xb212('0xa3'),'uri':_0x409567+_0xb212('0xa8')+_0x1e31e5+_0xb212('0xc8')+_0x2ab307+')/Microsoft.Dynamics.CRM.'+_0x456e6a+_0xb212('0xce'),'headers':{'Authorization':'Bearer\x20'+_0x1f02e9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1963cd)[_0xb212('0x24')](function(_0x30683d){var _0x53b37d={'id':_0x3a8bc7+'_'+_0x30683d[_0xb212('0xac')],'name':_0x30683d[_0xb212('0xc7')]['UserLocalizedLabel']?_0x30683d['DisplayName'][_0xb212('0xc6')][_0xb212('0xc5')]:_0x30683d['LogicalName'],'custom':![],'options':[]};_0xac7d29['push'](_0x53b37d);return _0xac7d29;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 23aea3a..926be32 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x1bf8ce,_0x302731){var _0x20a5c1=function(_0x1318f2){while(--_0x1318f2){_0x1bf8ce['push'](_0x1bf8ce['shift']());}};_0x20a5c1(++_0x302731);}(_0xe706,0xa3));var _0x6e70=function(_0x36153d,_0x4fed67){_0x36153d=_0x36153d-0x0;var _0xfdacff=_0xe706[_0x36153d];return _0xfdacff;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6c30c9,_0xfc4595){var _0x8c1042=function(_0x5458ec){while(--_0x5458ec){_0x6c30c9['push'](_0x6c30c9['shift']());}};_0x8c1042(++_0xfc4595);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index f1f8dae..09fc54b 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 _0x88d7=['http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Account','options','raw','where','limit','include','map','model','attributes','GetDynamics365Account','catch','ShowDynamics365Account','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3d8650,_0x3e12da){var _0xbcb4e6=function(_0x35a1d3){while(--_0x35a1d3){_0x3d8650['push'](_0x3d8650['shift']());}};_0xbcb4e6(++_0x3e12da);}(_0x88d7,0x16b));var _0x788d=function(_0x403caf,_0x5b31e4){_0x403caf=_0x403caf-0x0;var _0x4d6784=_0x88d7[_0x403caf];return _0x4d6784;};'use strict';var _=require(_0x788d('0x0'));var util=require(_0x788d('0x1'));var moment=require(_0x788d('0x2'));var BPromise=require('bluebird');var rs=require(_0x788d('0x3'));var fs=require('fs');var Redis=require(_0x788d('0x4'));var db=require(_0x788d('0x5'))['db'];var utils=require(_0x788d('0x6'));var logger=require('../../config/logger')(_0x788d('0x7'));var config=require(_0x788d('0x8'));var jayson=require(_0x788d('0x9'));var client=jayson[_0x788d('0xa')][_0x788d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x493ff8,_0x5a8a9e,_0x3b0179){return new BPromise(function(_0xc196b1,_0x5581bd){return client['request'](_0x493ff8,_0x3b0179)[_0x788d('0xc')](function(_0x5f3719){logger[_0x788d('0xd')](_0x788d('0xe'),_0x5a8a9e,_0x788d('0xf'));logger[_0x788d('0x10')](_0x788d('0x11'),_0x5a8a9e,'request\x20sent',JSON[_0x788d('0x12')](_0x5f3719));if(_0x5f3719[_0x788d('0x13')]){if(_0x5f3719[_0x788d('0x13')]['code']===0x1f4){logger['error'](_0x788d('0xe'),_0x5a8a9e,_0x5f3719[_0x788d('0x13')][_0x788d('0x14')]);return _0x5581bd(_0x5f3719[_0x788d('0x13')]['message']);}logger[_0x788d('0x13')](_0x788d('0xe'),_0x5a8a9e,_0x5f3719[_0x788d('0x13')][_0x788d('0x14')]);return _0xc196b1(_0x5f3719['error'][_0x788d('0x14')]);}else{logger[_0x788d('0xd')](_0x788d('0xe'),_0x5a8a9e,_0x788d('0xf'));_0xc196b1(_0x5f3719['result'][_0x788d('0x14')]);}})['catch'](function(_0x5acaa4){logger[_0x788d('0x13')](_0x788d('0xe'),_0x5a8a9e,_0x5acaa4);_0x5581bd(_0x5acaa4);});});}exports['GetDynamics365Account']=function(_0xf79d31){var _0xcdfd36=this;return new Promise(function(_0x5eca78,_0x55c5fd){return db[_0x788d('0x15')]['findAll']({'raw':_0xf79d31['options']?_0xf79d31[_0x788d('0x16')][_0x788d('0x17')]===undefined?!![]:![]:!![],'where':_0xf79d31[_0x788d('0x16')]?_0xf79d31[_0x788d('0x16')][_0x788d('0x18')]||null:null,'attributes':_0xf79d31[_0x788d('0x16')]?_0xf79d31[_0x788d('0x16')]['attributes']||null:null,'limit':_0xf79d31[_0x788d('0x16')]?_0xf79d31[_0x788d('0x16')][_0x788d('0x19')]||null:null,'include':_0xf79d31['options']?_0xf79d31['options'][_0x788d('0x1a')]?_[_0x788d('0x1b')](_0xf79d31['options'][_0x788d('0x1a')],function(_0x3493be){return{'model':db[_0x3493be[_0x788d('0x1c')]],'as':_0x3493be['as'],'attributes':_0x3493be[_0x788d('0x1d')],'include':_0x3493be[_0x788d('0x1a')]?_[_0x788d('0x1b')](_0x3493be['include'],function(_0x37a68a){return{'model':db[_0x37a68a['model']],'as':_0x37a68a['as'],'attributes':_0x37a68a[_0x788d('0x1d')],'include':_0x37a68a['include']?_[_0x788d('0x1b')](_0x37a68a[_0x788d('0x1a')],function(_0x67f172){return{'model':db[_0x67f172[_0x788d('0x1c')]],'as':_0x67f172['as'],'attributes':_0x67f172[_0x788d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x788d('0xc')](function(_0x94567c){logger[_0x788d('0xd')](_0x788d('0x1e'),_0xf79d31);logger[_0x788d('0x10')]('GetDynamics365Account',_0xf79d31,JSON[_0x788d('0x12')](_0x94567c));_0x5eca78(_0x94567c);})[_0x788d('0x1f')](function(_0x33bd48){logger[_0x788d('0x13')]('GetDynamics365Account',_0x33bd48[_0x788d('0x14')],_0xf79d31);_0x55c5fd(_0xcdfd36[_0x788d('0x13')](0x1f4,_0x33bd48[_0x788d('0x14')]));});});};exports[_0x788d('0x20')]=function(_0x4ad339){var _0x440f97=this;return new Promise(function(_0x1262b4,_0x523dea){return db['Dynamics365Account'][_0x788d('0x21')]({'raw':_0x4ad339[_0x788d('0x16')]?_0x4ad339['options'][_0x788d('0x17')]===undefined?!![]:![]:!![],'where':_0x4ad339[_0x788d('0x16')]?_0x4ad339[_0x788d('0x16')][_0x788d('0x18')]||null:null,'attributes':_0x4ad339[_0x788d('0x16')]?_0x4ad339[_0x788d('0x16')][_0x788d('0x1d')]||null:null,'include':_0x4ad339[_0x788d('0x16')]?_0x4ad339['options'][_0x788d('0x1a')]?_[_0x788d('0x1b')](_0x4ad339[_0x788d('0x16')][_0x788d('0x1a')],function(_0x75c11d){return{'model':db[_0x75c11d[_0x788d('0x1c')]],'as':_0x75c11d['as'],'attributes':_0x75c11d[_0x788d('0x1d')],'include':_0x75c11d[_0x788d('0x1a')]?_['map'](_0x75c11d[_0x788d('0x1a')],function(_0x168ecd){return{'model':db[_0x168ecd[_0x788d('0x1c')]],'as':_0x168ecd['as'],'attributes':_0x168ecd[_0x788d('0x1d')],'include':_0x168ecd[_0x788d('0x1a')]?_['map'](_0x168ecd['include'],function(_0x2cc8ad){return{'model':db[_0x2cc8ad['model']],'as':_0x2cc8ad['as'],'attributes':_0x2cc8ad[_0x788d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x788d('0xc')](function(_0x61d4ce){logger[_0x788d('0xd')](_0x788d('0x20'),_0x4ad339);logger['debug'](_0x788d('0x20'),_0x4ad339,JSON[_0x788d('0x12')](_0x61d4ce));_0x1262b4(_0x61d4ce);})['catch'](function(_0x5b2e3b){logger[_0x788d('0x13')](_0x788d('0x20'),_0x5b2e3b['message'],_0x4ad339);_0x523dea(_0x440f97['error'](0x1f4,_0x5b2e3b[_0x788d('0x14')]));});});}; \ No newline at end of file +var _0x7ea9=['raw','where','attributes','limit','include','map','model','GetDynamics365Account','stringify','ShowDynamics365Account','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','result','catch','Dynamics365Account','findAll','options'];(function(_0x1fd3e2,_0x1a6772){var _0x5a9210=function(_0x37e9c3){while(--_0x37e9c3){_0x1fd3e2['push'](_0x1fd3e2['shift']());}};_0x5a9210(++_0x1a6772);}(_0x7ea9,0x1c5));var _0x97ea=function(_0x5750ad,_0x34c717){_0x5750ad=_0x5750ad-0x0;var _0xc4d9de=_0x7ea9[_0x5750ad];return _0xc4d9de;};'use strict';var _=require(_0x97ea('0x0'));var util=require(_0x97ea('0x1'));var moment=require(_0x97ea('0x2'));var BPromise=require('bluebird');var rs=require(_0x97ea('0x3'));var fs=require('fs');var Redis=require(_0x97ea('0x4'));var db=require(_0x97ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x97ea('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x97ea('0x7')][_0x97ea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bca15,_0x547712,_0x4ea297){return new BPromise(function(_0x47c28f,_0x548a71){return client[_0x97ea('0x9')](_0x1bca15,_0x4ea297)[_0x97ea('0xa')](function(_0x513a75){logger[_0x97ea('0xb')](_0x97ea('0xc'),_0x547712,_0x97ea('0xd'));logger[_0x97ea('0xe')](_0x97ea('0xf'),_0x547712,_0x97ea('0xd'),JSON['stringify'](_0x513a75));if(_0x513a75[_0x97ea('0x10')]){if(_0x513a75[_0x97ea('0x10')]['code']===0x1f4){logger['error'](_0x97ea('0xc'),_0x547712,_0x513a75['error'][_0x97ea('0x11')]);return _0x548a71(_0x513a75[_0x97ea('0x10')]['message']);}logger[_0x97ea('0x10')](_0x97ea('0xc'),_0x547712,_0x513a75['error']['message']);return _0x47c28f(_0x513a75[_0x97ea('0x10')]['message']);}else{logger[_0x97ea('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x547712,'request\x20sent');_0x47c28f(_0x513a75[_0x97ea('0x12')][_0x97ea('0x11')]);}})[_0x97ea('0x13')](function(_0x3bcd06){logger[_0x97ea('0x10')](_0x97ea('0xc'),_0x547712,_0x3bcd06);_0x548a71(_0x3bcd06);});});}exports['GetDynamics365Account']=function(_0xec9175){var _0x4be284=this;return new Promise(function(_0xd4a38c,_0x5cb55e){return db[_0x97ea('0x14')][_0x97ea('0x15')]({'raw':_0xec9175[_0x97ea('0x16')]?_0xec9175[_0x97ea('0x16')][_0x97ea('0x17')]===undefined?!![]:![]:!![],'where':_0xec9175[_0x97ea('0x16')]?_0xec9175['options'][_0x97ea('0x18')]||null:null,'attributes':_0xec9175[_0x97ea('0x16')]?_0xec9175[_0x97ea('0x16')][_0x97ea('0x19')]||null:null,'limit':_0xec9175[_0x97ea('0x16')]?_0xec9175[_0x97ea('0x16')][_0x97ea('0x1a')]||null:null,'include':_0xec9175[_0x97ea('0x16')]?_0xec9175[_0x97ea('0x16')][_0x97ea('0x1b')]?_[_0x97ea('0x1c')](_0xec9175[_0x97ea('0x16')]['include'],function(_0x4fd9ad){return{'model':db[_0x4fd9ad[_0x97ea('0x1d')]],'as':_0x4fd9ad['as'],'attributes':_0x4fd9ad['attributes'],'include':_0x4fd9ad[_0x97ea('0x1b')]?_[_0x97ea('0x1c')](_0x4fd9ad['include'],function(_0x409e7b){return{'model':db[_0x409e7b[_0x97ea('0x1d')]],'as':_0x409e7b['as'],'attributes':_0x409e7b[_0x97ea('0x19')],'include':_0x409e7b['include']?_['map'](_0x409e7b[_0x97ea('0x1b')],function(_0x2145c3){return{'model':db[_0x2145c3[_0x97ea('0x1d')]],'as':_0x2145c3['as'],'attributes':_0x2145c3[_0x97ea('0x19')]};}):[]};}):[]};}):[]:[]})[_0x97ea('0xa')](function(_0x35e5a5){logger[_0x97ea('0xb')](_0x97ea('0x1e'),_0xec9175);logger[_0x97ea('0xe')](_0x97ea('0x1e'),_0xec9175,JSON[_0x97ea('0x1f')](_0x35e5a5));_0xd4a38c(_0x35e5a5);})[_0x97ea('0x13')](function(_0x15e767){logger[_0x97ea('0x10')](_0x97ea('0x1e'),_0x15e767[_0x97ea('0x11')],_0xec9175);_0x5cb55e(_0x4be284[_0x97ea('0x10')](0x1f4,_0x15e767[_0x97ea('0x11')]));});});};exports[_0x97ea('0x20')]=function(_0x4a49e3){var _0x4871b3=this;return new Promise(function(_0x526091,_0x1b7c97){return db[_0x97ea('0x14')][_0x97ea('0x21')]({'raw':_0x4a49e3['options']?_0x4a49e3[_0x97ea('0x16')][_0x97ea('0x17')]===undefined?!![]:![]:!![],'where':_0x4a49e3[_0x97ea('0x16')]?_0x4a49e3['options']['where']||null:null,'attributes':_0x4a49e3[_0x97ea('0x16')]?_0x4a49e3[_0x97ea('0x16')][_0x97ea('0x19')]||null:null,'include':_0x4a49e3[_0x97ea('0x16')]?_0x4a49e3[_0x97ea('0x16')][_0x97ea('0x1b')]?_['map'](_0x4a49e3[_0x97ea('0x16')]['include'],function(_0x20c29a){return{'model':db[_0x20c29a['model']],'as':_0x20c29a['as'],'attributes':_0x20c29a[_0x97ea('0x19')],'include':_0x20c29a[_0x97ea('0x1b')]?_[_0x97ea('0x1c')](_0x20c29a[_0x97ea('0x1b')],function(_0x39c9a7){return{'model':db[_0x39c9a7['model']],'as':_0x39c9a7['as'],'attributes':_0x39c9a7[_0x97ea('0x19')],'include':_0x39c9a7[_0x97ea('0x1b')]?_[_0x97ea('0x1c')](_0x39c9a7[_0x97ea('0x1b')],function(_0x54ef60){return{'model':db[_0x54ef60[_0x97ea('0x1d')]],'as':_0x54ef60['as'],'attributes':_0x54ef60['attributes']};}):[]};}):[]};}):[]:[]})[_0x97ea('0xa')](function(_0x2f4365){logger[_0x97ea('0xb')](_0x97ea('0x20'),_0x4a49e3);logger[_0x97ea('0xe')](_0x97ea('0x20'),_0x4a49e3,JSON['stringify'](_0x2f4365));_0x526091(_0x2f4365);})[_0x97ea('0x13')](function(_0x41ee08){logger[_0x97ea('0x10')](_0x97ea('0x20'),_0x41ee08[_0x97ea('0x11')],_0x4a49e3);_0x1b7c97(_0x4871b3['error'](0x1f4,_0x41ee08[_0x97ea('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a456d6c..b8f024c 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 _0xfc6d=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x549aa6,_0x376239){var _0x40a74e=function(_0x4a6a45){while(--_0x4a6a45){_0x549aa6['push'](_0x549aa6['shift']());}};_0x40a74e(++_0x376239);}(_0xfc6d,0x1e6));var _0xdfc6=function(_0x1fe791,_0x1f1c15){_0x1fe791=_0x1fe791-0x0;var _0xd89f4b=_0xfc6d[_0x1fe791];return _0xd89f4b;};'use strict';var multer=require(_0xdfc6('0x0'));var util=require(_0xdfc6('0x1'));var path=require(_0xdfc6('0x2'));var timeout=require(_0xdfc6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdfc6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdfc6('0x5'));var config=require(_0xdfc6('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xdfc6('0x7')]('/',auth['isAuthenticated'](),controller[_0xdfc6('0x8')]);router[_0xdfc6('0x7')](_0xdfc6('0x9'),auth[_0xdfc6('0xa')](),controller[_0xdfc6('0xb')]);router[_0xdfc6('0x7')](_0xdfc6('0xc'),auth[_0xdfc6('0xa')](),controller[_0xdfc6('0xd')]);router[_0xdfc6('0x7')](_0xdfc6('0xe'),auth[_0xdfc6('0xa')](),controller[_0xdfc6('0xf')]);router[_0xdfc6('0x7')](_0xdfc6('0x10'),auth['isAuthenticated'](),controller[_0xdfc6('0x11')]);router[_0xdfc6('0x12')]('/',auth[_0xdfc6('0xa')](),controller[_0xdfc6('0x13')]);router['put'](_0xdfc6('0x9'),auth[_0xdfc6('0xa')](),controller[_0xdfc6('0x14')]);router[_0xdfc6('0x15')](_0xdfc6('0x9'),auth[_0xdfc6('0xa')](),controller[_0xdfc6('0x16')]);module[_0xdfc6('0x17')]=router; \ No newline at end of file +var _0xa664=['./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x50e115,_0x5ac2bc){var _0x3b94be=function(_0xc875ca){while(--_0xc875ca){_0x50e115['push'](_0x50e115['shift']());}};_0x3b94be(++_0x5ac2bc);}(_0xa664,0x132));var _0x4a66=function(_0x3b3235,_0x345e3c){_0x3b3235=_0x3b3235-0x0;var _0x15b7ad=_0xa664[_0x3b3235];return _0x15b7ad;};'use strict';var multer=require('multer');var util=require(_0x4a66('0x0'));var path=require(_0x4a66('0x1'));var timeout=require(_0x4a66('0x2'));var express=require(_0x4a66('0x3'));var router=express['Router']();var fs_extra=require(_0x4a66('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4a66('0x5'));var controller=require(_0x4a66('0x6'));router[_0x4a66('0x7')]('/',auth[_0x4a66('0x8')](),controller[_0x4a66('0x9')]);router[_0x4a66('0x7')](_0x4a66('0xa'),auth['isAuthenticated'](),controller[_0x4a66('0xb')]);router[_0x4a66('0x7')](_0x4a66('0xc'),auth[_0x4a66('0x8')](),controller['getFields']);router[_0x4a66('0x7')](_0x4a66('0xd'),auth['isAuthenticated'](),controller[_0x4a66('0xe')]);router[_0x4a66('0x7')](_0x4a66('0xf'),auth[_0x4a66('0x8')](),controller[_0x4a66('0x10')]);router[_0x4a66('0x11')]('/',auth[_0x4a66('0x8')](),controller[_0x4a66('0x12')]);router[_0x4a66('0x13')](_0x4a66('0xa'),auth[_0x4a66('0x8')](),controller[_0x4a66('0x14')]);router[_0x4a66('0x15')](_0x4a66('0xa'),auth[_0x4a66('0x8')](),controller[_0x4a66('0x16')]);module[_0x4a66('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 7468897..0b873e7 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 _0xd458=['incident','phonecall','exports','STRING','ENUM'];(function(_0x221344,_0x539d6b){var _0x3ca9e0=function(_0x36165e){while(--_0x36165e){_0x221344['push'](_0x221344['shift']());}};_0x3ca9e0(++_0x539d6b);}(_0xd458,0x18d));var _0x8d45=function(_0x23c6ff,_0x150b73){_0x23c6ff=_0x23c6ff-0x0;var _0x57bc4f=_0xd458[_0x23c6ff];return _0x57bc4f;};'use strict';var Sequelize=require('sequelize');module[_0x8d45('0x0')]={'name':{'type':Sequelize[_0x8d45('0x1')]},'description':{'type':Sequelize[_0x8d45('0x1')]},'ticketType':{'type':Sequelize[_0x8d45('0x2')](_0x8d45('0x3'),_0x8d45('0x4')),'defaultValue':_0x8d45('0x3')}}; \ No newline at end of file +var _0x70d7=['ENUM','incident','phonecall','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70d7,0x1ac));var _0x770d=function(_0x59efbb,_0x1b77e1){_0x59efbb=_0x59efbb-0x0;var _0x1e143c=_0x70d7[_0x59efbb];return _0x1e143c;};'use strict';var Sequelize=require('sequelize');module[_0x770d('0x0')]={'name':{'type':Sequelize[_0x770d('0x1')]},'description':{'type':Sequelize[_0x770d('0x1')]},'ticketType':{'type':Sequelize[_0x770d('0x2')](_0x770d('0x3'),_0x770d('0x4')),'defaultValue':_0x770d('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 3e9590e..61e9280 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 _0xf2b4=['apply','reject','save','update','then','stack','name','send','index','map','Dynamics365Configuration','type','key','model','query','filters','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','rawAttributes','intersection','catch','create','body','find','getFields','findOne','nolimit','getSubjects','Dynamics365Field','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xf2b4,0x16d));var _0x4f2b=function(_0x1265db,_0x112fdc){_0x1265db=_0x1265db-0x0;var _0x1cd1e7=_0xf2b4[_0x1265db];return _0x1cd1e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f2b('0x0'));var zipdir=require(_0x4f2b('0x1'));var jsonpatch=require(_0x4f2b('0x2'));var rp=require('request-promise');var moment=require(_0x4f2b('0x3'));var BPromise=require(_0x4f2b('0x4'));var Mustache=require('mustache');var util=require(_0x4f2b('0x5'));var path=require('path');var sox=require(_0x4f2b('0x6'));var csv=require(_0x4f2b('0x7'));var ejs=require(_0x4f2b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f2b('0x9'));var _=require(_0x4f2b('0xa'));var squel=require(_0x4f2b('0xb'));var crypto=require(_0x4f2b('0xc'));var jsforce=require(_0x4f2b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4f2b('0x7'));var querystring=require(_0x4f2b('0xe'));var Papa=require(_0x4f2b('0xf'));var Redis=require(_0x4f2b('0x10'));var authService=require(_0x4f2b('0x11'));var qs=require(_0x4f2b('0x12'));var as=require(_0x4f2b('0x13'));var hardwareService=require(_0x4f2b('0x14'));var logger=require(_0x4f2b('0x15'))(_0x4f2b('0x16'));var utils=require(_0x4f2b('0x17'));var config=require(_0x4f2b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f2b('0x19'))['db'];function respondWithStatusCode(_0x567880,_0x3ed517){_0x3ed517=_0x3ed517||0xcc;return function(_0x3b76db){if(_0x3b76db){return _0x567880[_0x4f2b('0x1a')](_0x3ed517);}return _0x567880[_0x4f2b('0x1b')](_0x3ed517)[_0x4f2b('0x1c')]();};}function respondWithResult(_0x51dd32,_0x11bcc4){_0x11bcc4=_0x11bcc4||0xc8;return function(_0x4be681){if(_0x4be681){return _0x51dd32[_0x4f2b('0x1b')](_0x11bcc4)['json'](_0x4be681);}};}function respondWithFilteredResult(_0x19f17e,_0x2df5bb){return function(_0xb58012){if(_0xb58012){var _0x30bd71=typeof _0x2df5bb[_0x4f2b('0x1d')]===_0x4f2b('0x1e')&&typeof _0x2df5bb[_0x4f2b('0x1f')]===_0x4f2b('0x1e');var _0x2a7450=_0xb58012[_0x4f2b('0x20')];var _0x379343=_0x30bd71?0x0:_0x2df5bb[_0x4f2b('0x1d')];var _0x2dac12=_0x30bd71?_0xb58012['count']:_0x2df5bb[_0x4f2b('0x1d')]+_0x2df5bb[_0x4f2b('0x1f')];var _0x182447;if(_0x2dac12>=_0x2a7450){_0x2dac12=_0x2a7450;_0x182447=0xc8;}else{_0x182447=0xce;}_0x19f17e['status'](_0x182447);return _0x19f17e[_0x4f2b('0x21')]('Content-Range',_0x379343+'-'+_0x2dac12+'/'+_0x2a7450)[_0x4f2b('0x22')](_0xb58012);}return null;};}function patchUpdates(_0x402241){return function(_0x49c3fc){try{jsonpatch[_0x4f2b('0x23')](_0x49c3fc,_0x402241,!![]);}catch(_0x5c2cec){return BPromise[_0x4f2b('0x24')](_0x5c2cec);}return _0x49c3fc[_0x4f2b('0x25')]();};}function saveUpdates(_0x4f9dee,_0x30b49e){return function(_0x29b7bf){if(_0x29b7bf){return _0x29b7bf[_0x4f2b('0x26')](_0x4f9dee)['then'](function(_0x54d954){return _0x54d954;});}return null;};}function removeEntity(_0x35ad2c,_0x33a12b){return function(_0x2fcc43){if(_0x2fcc43){return _0x2fcc43['destroy']()[_0x4f2b('0x27')](function(){_0x35ad2c[_0x4f2b('0x1b')](0xcc)[_0x4f2b('0x1c')]();});}};}function handleEntityNotFound(_0x2c5d65,_0x25251f){return function(_0x13816d){if(!_0x13816d){_0x2c5d65[_0x4f2b('0x1a')](0x194);}return _0x13816d;};}function handleError(_0x580ec4,_0x3f4105){_0x3f4105=_0x3f4105||0x1f4;return function(_0x48c5cf){logger['error'](_0x48c5cf[_0x4f2b('0x28')]);if(_0x48c5cf['name']){delete _0x48c5cf[_0x4f2b('0x29')];}_0x580ec4[_0x4f2b('0x1b')](_0x3f4105)[_0x4f2b('0x2a')](_0x48c5cf);};}exports[_0x4f2b('0x2b')]=function(_0x2e53aa,_0x10ca4f){var _0x45c70e={},_0x456ead={},_0x4b722c={'count':0x0,'rows':[]};var _0x1706ac=_[_0x4f2b('0x2c')](db[_0x4f2b('0x2d')]['rawAttributes'],function(_0x25fac0){return{'name':_0x25fac0['fieldName'],'type':_0x25fac0[_0x4f2b('0x2e')][_0x4f2b('0x2f')]};});_0x456ead[_0x4f2b('0x30')]=_[_0x4f2b('0x2c')](_0x1706ac,'name');_0x456ead['query']=_['keys'](_0x2e53aa[_0x4f2b('0x31')]);_0x456ead[_0x4f2b('0x32')]=_['intersection'](_0x456ead[_0x4f2b('0x30')],_0x456ead[_0x4f2b('0x31')]);_0x45c70e[_0x4f2b('0x33')]=_['intersection'](_0x456ead['model'],qs[_0x4f2b('0x34')](_0x2e53aa[_0x4f2b('0x31')]['fields']));_0x45c70e[_0x4f2b('0x33')]=_0x45c70e[_0x4f2b('0x33')][_0x4f2b('0x35')]?_0x45c70e[_0x4f2b('0x33')]:_0x456ead[_0x4f2b('0x30')];if(!_0x2e53aa[_0x4f2b('0x31')]['hasOwnProperty']('nolimit')){_0x45c70e['limit']=qs[_0x4f2b('0x1f')](_0x2e53aa[_0x4f2b('0x31')][_0x4f2b('0x1f')]);_0x45c70e[_0x4f2b('0x1d')]=qs[_0x4f2b('0x1d')](_0x2e53aa[_0x4f2b('0x31')][_0x4f2b('0x1d')]);}_0x45c70e[_0x4f2b('0x36')]=qs[_0x4f2b('0x37')](_0x2e53aa['query'][_0x4f2b('0x37')]);_0x45c70e[_0x4f2b('0x38')]=qs[_0x4f2b('0x32')](_[_0x4f2b('0x39')](_0x2e53aa[_0x4f2b('0x31')],_0x456ead[_0x4f2b('0x32')]),_0x1706ac);if(_0x2e53aa[_0x4f2b('0x31')][_0x4f2b('0x3a')]){_0x45c70e[_0x4f2b('0x38')]=_[_0x4f2b('0x3b')](_0x45c70e['where'],{'$or':_['map'](_0x1706ac,function(_0x3fbbef){if(_0x3fbbef['type']!==_0x4f2b('0x3c')){var _0x555d82={};_0x555d82[_0x3fbbef['name']]={'$like':'%'+_0x2e53aa[_0x4f2b('0x31')][_0x4f2b('0x3a')]+'%'};return _0x555d82;}})});}_0x45c70e=_[_0x4f2b('0x3b')]({},_0x45c70e,_0x2e53aa[_0x4f2b('0x3d')]);var _0x21135f={'where':_0x45c70e[_0x4f2b('0x38')]};return db[_0x4f2b('0x2d')][_0x4f2b('0x20')](_0x21135f)[_0x4f2b('0x27')](function(_0x33ec95){_0x4b722c[_0x4f2b('0x20')]=_0x33ec95;if(_0x2e53aa['query'][_0x4f2b('0x3e')]){_0x45c70e[_0x4f2b('0x3f')]=[{'all':!![]}];}return db[_0x4f2b('0x2d')][_0x4f2b('0x40')](_0x45c70e);})[_0x4f2b('0x27')](function(_0x3a20b2){_0x4b722c['rows']=_0x3a20b2;return _0x4b722c;})[_0x4f2b('0x27')](respondWithFilteredResult(_0x10ca4f,_0x45c70e))['catch'](handleError(_0x10ca4f,null));};exports['show']=function(_0x56df9d,_0x4bfa76){var _0x5bf998={'raw':![],'where':{'id':_0x56df9d[_0x4f2b('0x41')]['id']}},_0x367fbe={};_0x367fbe[_0x4f2b('0x30')]=_[_0x4f2b('0x42')](db[_0x4f2b('0x2d')][_0x4f2b('0x43')]);_0x367fbe[_0x4f2b('0x31')]=_[_0x4f2b('0x42')](_0x56df9d[_0x4f2b('0x31')]);_0x367fbe[_0x4f2b('0x32')]=_[_0x4f2b('0x44')](_0x367fbe[_0x4f2b('0x30')],_0x367fbe[_0x4f2b('0x31')]);_0x5bf998[_0x4f2b('0x33')]=_['intersection'](_0x367fbe[_0x4f2b('0x30')],qs['fields'](_0x56df9d[_0x4f2b('0x31')]['fields']));_0x5bf998['attributes']=_0x5bf998['attributes'][_0x4f2b('0x35')]?_0x5bf998[_0x4f2b('0x33')]:_0x367fbe['model'];if(_0x56df9d[_0x4f2b('0x31')]['includeAll']){_0x5bf998[_0x4f2b('0x3f')]=[{'all':!![]}];}_0x5bf998=_[_0x4f2b('0x3b')]({},_0x5bf998,_0x56df9d[_0x4f2b('0x3d')]);return db['Dynamics365Configuration']['find'](_0x5bf998)[_0x4f2b('0x27')](handleEntityNotFound(_0x4bfa76,null))[_0x4f2b('0x27')](respondWithResult(_0x4bfa76,null))[_0x4f2b('0x45')](handleError(_0x4bfa76,null));};exports[_0x4f2b('0x46')]=function(_0x5bfd5b,_0x577072){return db['Dynamics365Configuration']['create'](_0x5bfd5b[_0x4f2b('0x47')],{})[_0x4f2b('0x27')](respondWithResult(_0x577072,0xc9))[_0x4f2b('0x45')](handleError(_0x577072,null));};exports[_0x4f2b('0x26')]=function(_0x47ec7d,_0x58f2d4){if(_0x47ec7d[_0x4f2b('0x47')]['id']){delete _0x47ec7d[_0x4f2b('0x47')]['id'];}return db[_0x4f2b('0x2d')]['find']({'where':{'id':_0x47ec7d[_0x4f2b('0x41')]['id']}})[_0x4f2b('0x27')](handleEntityNotFound(_0x58f2d4,null))[_0x4f2b('0x27')](saveUpdates(_0x47ec7d[_0x4f2b('0x47')],null))[_0x4f2b('0x27')](respondWithResult(_0x58f2d4,null))['catch'](handleError(_0x58f2d4,null));};exports['destroy']=function(_0x44f5bf,_0x358bec){return db[_0x4f2b('0x2d')][_0x4f2b('0x48')]({'where':{'id':_0x44f5bf['params']['id']}})[_0x4f2b('0x27')](handleEntityNotFound(_0x358bec,null))[_0x4f2b('0x27')](removeEntity(_0x358bec,null))[_0x4f2b('0x45')](handleError(_0x358bec,null));};exports[_0x4f2b('0x49')]=function(_0x4dd8a7,_0x4d19cd,_0x2f5dd6){var _0x16552c={};var _0x42322e={};var _0x45583e;var _0x12d4a6;return db[_0x4f2b('0x2d')][_0x4f2b('0x4a')]({'where':{'id':_0x4dd8a7[_0x4f2b('0x41')]['id']}})[_0x4f2b('0x27')](handleEntityNotFound(_0x4d19cd,null))[_0x4f2b('0x27')](function(_0x57c21a){if(_0x57c21a){_0x45583e=_0x57c21a;_0x42322e['model']=_[_0x4f2b('0x42')](db['Dynamics365Field'][_0x4f2b('0x43')]);_0x42322e[_0x4f2b('0x31')]=_[_0x4f2b('0x42')](_0x4dd8a7['query']);_0x42322e['filters']=_[_0x4f2b('0x44')](_0x42322e[_0x4f2b('0x30')],_0x42322e['query']);_0x16552c[_0x4f2b('0x33')]=_[_0x4f2b('0x44')](_0x42322e[_0x4f2b('0x30')],qs[_0x4f2b('0x34')](_0x4dd8a7[_0x4f2b('0x31')][_0x4f2b('0x34')]));_0x16552c['attributes']=_0x16552c['attributes'][_0x4f2b('0x35')]?_0x16552c[_0x4f2b('0x33')]:_0x42322e['model'];_0x16552c[_0x4f2b('0x36')]=qs[_0x4f2b('0x37')](_0x4dd8a7['query'][_0x4f2b('0x37')]);_0x16552c['where']=qs[_0x4f2b('0x32')](_[_0x4f2b('0x39')](_0x4dd8a7[_0x4f2b('0x31')],_0x42322e[_0x4f2b('0x32')]));if(_0x4dd8a7[_0x4f2b('0x31')][_0x4f2b('0x3a')]){_0x16552c['where']=_['merge'](_0x16552c[_0x4f2b('0x38')],{'$or':_[_0x4f2b('0x2c')](_0x16552c[_0x4f2b('0x33')],function(_0x76bd50){var _0x19d062={};_0x19d062[_0x76bd50]={'$like':'%'+_0x4dd8a7[_0x4f2b('0x31')][_0x4f2b('0x3a')]+'%'};return _0x19d062;})});}_0x16552c=_[_0x4f2b('0x3b')]({},_0x16552c,_0x4dd8a7[_0x4f2b('0x3d')]);return _0x45583e[_0x4f2b('0x49')](_0x16552c);}})[_0x4f2b('0x27')](function(_0x357b64){if(_0x357b64){_0x12d4a6=_0x357b64[_0x4f2b('0x35')];if(!_0x4dd8a7[_0x4f2b('0x31')]['hasOwnProperty'](_0x4f2b('0x4b'))){_0x16552c[_0x4f2b('0x1f')]=qs[_0x4f2b('0x1f')](_0x4dd8a7[_0x4f2b('0x31')][_0x4f2b('0x1f')]);_0x16552c[_0x4f2b('0x1d')]=qs[_0x4f2b('0x1d')](_0x4dd8a7[_0x4f2b('0x31')]['offset']);}return _0x45583e[_0x4f2b('0x49')](_0x16552c);}})[_0x4f2b('0x27')](function(_0x16d9e4){if(_0x16d9e4){return _0x16d9e4?{'count':_0x12d4a6,'rows':_0x16d9e4}:null;}})[_0x4f2b('0x27')](respondWithResult(_0x4d19cd,null))['catch'](handleError(_0x4d19cd,null));};exports[_0x4f2b('0x4c')]=function(_0x4f7241,_0x2379f6,_0x4e8978){var _0x37823b={};var _0x5781da={};var _0x1c6361;var _0x3aa280;return db['Dynamics365Configuration'][_0x4f2b('0x4a')]({'where':{'id':_0x4f7241['params']['id']}})[_0x4f2b('0x27')](handleEntityNotFound(_0x2379f6,null))[_0x4f2b('0x27')](function(_0x3cff20){if(_0x3cff20){_0x1c6361=_0x3cff20;_0x5781da[_0x4f2b('0x30')]=_[_0x4f2b('0x42')](db[_0x4f2b('0x4d')]['rawAttributes']);_0x5781da[_0x4f2b('0x31')]=_[_0x4f2b('0x42')](_0x4f7241['query']);_0x5781da[_0x4f2b('0x32')]=_['intersection'](_0x5781da[_0x4f2b('0x30')],_0x5781da[_0x4f2b('0x31')]);_0x37823b[_0x4f2b('0x33')]=_[_0x4f2b('0x44')](_0x5781da[_0x4f2b('0x30')],qs['fields'](_0x4f7241[_0x4f2b('0x31')]['fields']));_0x37823b[_0x4f2b('0x33')]=_0x37823b[_0x4f2b('0x33')][_0x4f2b('0x35')]?_0x37823b[_0x4f2b('0x33')]:_0x5781da[_0x4f2b('0x30')];_0x37823b[_0x4f2b('0x36')]=qs[_0x4f2b('0x37')](_0x4f7241[_0x4f2b('0x31')]['sort']);_0x37823b[_0x4f2b('0x38')]=qs[_0x4f2b('0x32')](_['pick'](_0x4f7241[_0x4f2b('0x31')],_0x5781da['filters']));if(_0x4f7241[_0x4f2b('0x31')]['filter']){_0x37823b[_0x4f2b('0x38')]=_[_0x4f2b('0x3b')](_0x37823b[_0x4f2b('0x38')],{'$or':_[_0x4f2b('0x2c')](_0x37823b[_0x4f2b('0x33')],function(_0x41b056){var _0x360e7e={};_0x360e7e[_0x41b056]={'$like':'%'+_0x4f7241['query']['filter']+'%'};return _0x360e7e;})});}_0x37823b=_[_0x4f2b('0x3b')]({},_0x37823b,_0x4f7241[_0x4f2b('0x3d')]);return _0x1c6361[_0x4f2b('0x4c')](_0x37823b);}})['then'](function(_0x6aaff4){if(_0x6aaff4){_0x3aa280=_0x6aaff4[_0x4f2b('0x35')];if(!_0x4f7241[_0x4f2b('0x31')][_0x4f2b('0x4e')](_0x4f2b('0x4b'))){_0x37823b['limit']=qs[_0x4f2b('0x1f')](_0x4f7241[_0x4f2b('0x31')][_0x4f2b('0x1f')]);_0x37823b['offset']=qs['offset'](_0x4f7241[_0x4f2b('0x31')][_0x4f2b('0x1d')]);}return _0x1c6361[_0x4f2b('0x4c')](_0x37823b);}})['then'](function(_0x417c10){if(_0x417c10){return _0x417c10?{'count':_0x3aa280,'rows':_0x417c10}:null;}})['then'](respondWithResult(_0x2379f6,null))[_0x4f2b('0x45')](handleError(_0x2379f6,null));};exports[_0x4f2b('0x4f')]=function(_0x1bfc54,_0x2c1b7d,_0x573e50){var _0x5506b1={};var _0x507e3c={};var _0x42d9eb;var _0x13f5c9;return db['Dynamics365Configuration'][_0x4f2b('0x4a')]({'where':{'id':_0x1bfc54['params']['id']}})[_0x4f2b('0x27')](handleEntityNotFound(_0x2c1b7d,null))[_0x4f2b('0x27')](function(_0x470fe9){if(_0x470fe9){_0x42d9eb=_0x470fe9;_0x507e3c[_0x4f2b('0x30')]=_['keys'](db[_0x4f2b('0x4d')][_0x4f2b('0x43')]);_0x507e3c['query']=_[_0x4f2b('0x42')](_0x1bfc54[_0x4f2b('0x31')]);_0x507e3c[_0x4f2b('0x32')]=_[_0x4f2b('0x44')](_0x507e3c[_0x4f2b('0x30')],_0x507e3c[_0x4f2b('0x31')]);_0x5506b1[_0x4f2b('0x33')]=_['intersection'](_0x507e3c[_0x4f2b('0x30')],qs['fields'](_0x1bfc54['query'][_0x4f2b('0x34')]));_0x5506b1[_0x4f2b('0x33')]=_0x5506b1[_0x4f2b('0x33')][_0x4f2b('0x35')]?_0x5506b1[_0x4f2b('0x33')]:_0x507e3c[_0x4f2b('0x30')];_0x5506b1['order']=qs[_0x4f2b('0x37')](_0x1bfc54[_0x4f2b('0x31')]['sort']);_0x5506b1[_0x4f2b('0x38')]=qs[_0x4f2b('0x32')](_[_0x4f2b('0x39')](_0x1bfc54[_0x4f2b('0x31')],_0x507e3c[_0x4f2b('0x32')]));if(_0x1bfc54[_0x4f2b('0x31')][_0x4f2b('0x3a')]){_0x5506b1[_0x4f2b('0x38')]=_[_0x4f2b('0x3b')](_0x5506b1[_0x4f2b('0x38')],{'$or':_[_0x4f2b('0x2c')](_0x5506b1['attributes'],function(_0x22524b){var _0x31fee6={};_0x31fee6[_0x22524b]={'$like':'%'+_0x1bfc54[_0x4f2b('0x31')][_0x4f2b('0x3a')]+'%'};return _0x31fee6;})});}_0x5506b1=_['merge']({},_0x5506b1,_0x1bfc54[_0x4f2b('0x3d')]);return _0x42d9eb[_0x4f2b('0x4f')](_0x5506b1);}})[_0x4f2b('0x27')](function(_0x6e35c){if(_0x6e35c){_0x13f5c9=_0x6e35c[_0x4f2b('0x35')];if(!_0x1bfc54[_0x4f2b('0x31')][_0x4f2b('0x4e')]('nolimit')){_0x5506b1['limit']=qs[_0x4f2b('0x1f')](_0x1bfc54[_0x4f2b('0x31')][_0x4f2b('0x1f')]);_0x5506b1[_0x4f2b('0x1d')]=qs['offset'](_0x1bfc54[_0x4f2b('0x31')][_0x4f2b('0x1d')]);}return _0x42d9eb['getDescriptions'](_0x5506b1);}})['then'](function(_0xf6bc70){if(_0xf6bc70){return _0xf6bc70?{'count':_0x13f5c9,'rows':_0xf6bc70}:null;}})[_0x4f2b('0x27')](respondWithResult(_0x2c1b7d,null))[_0x4f2b('0x45')](handleError(_0x2c1b7d,null));}; \ No newline at end of file +var _0x6728=['Content-Range','reject','update','destroy','then','error','stack','name','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','findOne','Dynamics365Field','length','nolimit','getFields','getSubjects','getDescriptions','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set'];(function(_0x264c54,_0x3308cc){var _0x319ff7=function(_0x33fb38){while(--_0x33fb38){_0x264c54['push'](_0x264c54['shift']());}};_0x319ff7(++_0x3308cc);}(_0x6728,0xc9));var _0x8672=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0x6728[_0x2f54b6];return _0x169f21;};'use strict';var emlformat=require(_0x8672('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8672('0x1'));var rp=require('request-promise');var moment=require(_0x8672('0x2'));var BPromise=require(_0x8672('0x3'));var Mustache=require(_0x8672('0x4'));var util=require(_0x8672('0x5'));var path=require(_0x8672('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8672('0x7'));var fs=require('fs');var fs_extra=require(_0x8672('0x8'));var _=require(_0x8672('0x9'));var squel=require(_0x8672('0xa'));var crypto=require('crypto');var jsforce=require(_0x8672('0xb'));var deskjs=require(_0x8672('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8672('0xd'));var Papa=require('papaparse');var Redis=require(_0x8672('0xe'));var authService=require(_0x8672('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8672('0x10'));var hardwareService=require(_0x8672('0x11'));var logger=require(_0x8672('0x12'))('api');var utils=require(_0x8672('0x13'));var config=require(_0x8672('0x14'));var licenseUtil=require(_0x8672('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5188a2,_0xed6db4){_0xed6db4=_0xed6db4||0xcc;return function(_0x65ba5a){if(_0x65ba5a){return _0x5188a2[_0x8672('0x16')](_0xed6db4);}return _0x5188a2[_0x8672('0x17')](_0xed6db4)[_0x8672('0x18')]();};}function respondWithResult(_0x51785a,_0x1524cf){_0x1524cf=_0x1524cf||0xc8;return function(_0x5e196f){if(_0x5e196f){return _0x51785a[_0x8672('0x17')](_0x1524cf)['json'](_0x5e196f);}};}function respondWithFilteredResult(_0x4c424b,_0x1374f7){return function(_0x2f340d){if(_0x2f340d){var _0x2496ac=typeof _0x1374f7[_0x8672('0x19')]==='undefined'&&typeof _0x1374f7[_0x8672('0x1a')]===_0x8672('0x1b');var _0x257b55=_0x2f340d[_0x8672('0x1c')];var _0x4b4b3d=_0x2496ac?0x0:_0x1374f7[_0x8672('0x19')];var _0x3acce4=_0x2496ac?_0x2f340d[_0x8672('0x1c')]:_0x1374f7[_0x8672('0x19')]+_0x1374f7[_0x8672('0x1a')];var _0x50fd7e;if(_0x3acce4>=_0x257b55){_0x3acce4=_0x257b55;_0x50fd7e=0xc8;}else{_0x50fd7e=0xce;}_0x4c424b[_0x8672('0x17')](_0x50fd7e);return _0x4c424b[_0x8672('0x1d')](_0x8672('0x1e'),_0x4b4b3d+'-'+_0x3acce4+'/'+_0x257b55)['json'](_0x2f340d);}return null;};}function patchUpdates(_0x1132e6){return function(_0x244621){try{jsonpatch['apply'](_0x244621,_0x1132e6,!![]);}catch(_0x1d8816){return BPromise[_0x8672('0x1f')](_0x1d8816);}return _0x244621['save']();};}function saveUpdates(_0x13384c,_0x1d2653){return function(_0x3fc568){if(_0x3fc568){return _0x3fc568[_0x8672('0x20')](_0x13384c)['then'](function(_0x12dc78){return _0x12dc78;});}return null;};}function removeEntity(_0x4bb20d,_0x16b74c){return function(_0x5c6168){if(_0x5c6168){return _0x5c6168[_0x8672('0x21')]()[_0x8672('0x22')](function(){_0x4bb20d['status'](0xcc)[_0x8672('0x18')]();});}};}function handleEntityNotFound(_0x180722,_0xd981dd){return function(_0xba8cd7){if(!_0xba8cd7){_0x180722[_0x8672('0x16')](0x194);}return _0xba8cd7;};}function handleError(_0x59b779,_0x1409f1){_0x1409f1=_0x1409f1||0x1f4;return function(_0x5d810e){logger[_0x8672('0x23')](_0x5d810e[_0x8672('0x24')]);if(_0x5d810e['name']){delete _0x5d810e[_0x8672('0x25')];}_0x59b779[_0x8672('0x17')](_0x1409f1)['send'](_0x5d810e);};}exports['index']=function(_0x475440,_0x317977){var _0x29cf4c={},_0x4424fa={},_0x206c07={'count':0x0,'rows':[]};var _0x515768=_[_0x8672('0x26')](db[_0x8672('0x27')][_0x8672('0x28')],function(_0xd73429){return{'name':_0xd73429[_0x8672('0x29')],'type':_0xd73429['type'][_0x8672('0x2a')]};});_0x4424fa[_0x8672('0x2b')]=_['map'](_0x515768,_0x8672('0x25'));_0x4424fa['query']=_[_0x8672('0x2c')](_0x475440['query']);_0x4424fa[_0x8672('0x2d')]=_[_0x8672('0x2e')](_0x4424fa[_0x8672('0x2b')],_0x4424fa[_0x8672('0x2f')]);_0x29cf4c[_0x8672('0x30')]=_['intersection'](_0x4424fa[_0x8672('0x2b')],qs[_0x8672('0x31')](_0x475440['query']['fields']));_0x29cf4c['attributes']=_0x29cf4c[_0x8672('0x30')]['length']?_0x29cf4c['attributes']:_0x4424fa[_0x8672('0x2b')];if(!_0x475440[_0x8672('0x2f')][_0x8672('0x32')]('nolimit')){_0x29cf4c[_0x8672('0x1a')]=qs[_0x8672('0x1a')](_0x475440[_0x8672('0x2f')][_0x8672('0x1a')]);_0x29cf4c['offset']=qs[_0x8672('0x19')](_0x475440[_0x8672('0x2f')][_0x8672('0x19')]);}_0x29cf4c[_0x8672('0x33')]=qs[_0x8672('0x34')](_0x475440['query'][_0x8672('0x34')]);_0x29cf4c['where']=qs[_0x8672('0x2d')](_[_0x8672('0x35')](_0x475440['query'],_0x4424fa['filters']),_0x515768);if(_0x475440[_0x8672('0x2f')][_0x8672('0x36')]){_0x29cf4c[_0x8672('0x37')]=_[_0x8672('0x38')](_0x29cf4c[_0x8672('0x37')],{'$or':_[_0x8672('0x26')](_0x515768,function(_0x113538){if(_0x113538[_0x8672('0x39')]!==_0x8672('0x3a')){var _0x4ef262={};_0x4ef262[_0x113538[_0x8672('0x25')]]={'$like':'%'+_0x475440[_0x8672('0x2f')][_0x8672('0x36')]+'%'};return _0x4ef262;}})});}_0x29cf4c=_[_0x8672('0x38')]({},_0x29cf4c,_0x475440[_0x8672('0x3b')]);var _0x3e04e5={'where':_0x29cf4c[_0x8672('0x37')]};return db[_0x8672('0x27')][_0x8672('0x1c')](_0x3e04e5)[_0x8672('0x22')](function(_0x1df725){_0x206c07[_0x8672('0x1c')]=_0x1df725;if(_0x475440[_0x8672('0x2f')][_0x8672('0x3c')]){_0x29cf4c[_0x8672('0x3d')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x8672('0x3e')](_0x29cf4c);})[_0x8672('0x22')](function(_0x559dc9){_0x206c07[_0x8672('0x3f')]=_0x559dc9;return _0x206c07;})[_0x8672('0x22')](respondWithFilteredResult(_0x317977,_0x29cf4c))['catch'](handleError(_0x317977,null));};exports[_0x8672('0x40')]=function(_0x3152d6,_0x500795){var _0x1b53cf={'raw':![],'where':{'id':_0x3152d6[_0x8672('0x41')]['id']}},_0x192e46={};_0x192e46[_0x8672('0x2b')]=_['keys'](db[_0x8672('0x27')][_0x8672('0x28')]);_0x192e46[_0x8672('0x2f')]=_[_0x8672('0x2c')](_0x3152d6[_0x8672('0x2f')]);_0x192e46['filters']=_[_0x8672('0x2e')](_0x192e46['model'],_0x192e46['query']);_0x1b53cf[_0x8672('0x30')]=_['intersection'](_0x192e46[_0x8672('0x2b')],qs[_0x8672('0x31')](_0x3152d6[_0x8672('0x2f')][_0x8672('0x31')]));_0x1b53cf[_0x8672('0x30')]=_0x1b53cf[_0x8672('0x30')]['length']?_0x1b53cf[_0x8672('0x30')]:_0x192e46['model'];if(_0x3152d6[_0x8672('0x2f')]['includeAll']){_0x1b53cf[_0x8672('0x3d')]=[{'all':!![]}];}_0x1b53cf=_[_0x8672('0x38')]({},_0x1b53cf,_0x3152d6[_0x8672('0x3b')]);return db[_0x8672('0x27')]['find'](_0x1b53cf)[_0x8672('0x22')](handleEntityNotFound(_0x500795,null))[_0x8672('0x22')](respondWithResult(_0x500795,null))[_0x8672('0x42')](handleError(_0x500795,null));};exports['create']=function(_0x86e200,_0x6ef217){return db[_0x8672('0x27')][_0x8672('0x43')](_0x86e200[_0x8672('0x44')],{})[_0x8672('0x22')](respondWithResult(_0x6ef217,0xc9))[_0x8672('0x42')](handleError(_0x6ef217,null));};exports['update']=function(_0xf219aa,_0x55dc5e){if(_0xf219aa[_0x8672('0x44')]['id']){delete _0xf219aa[_0x8672('0x44')]['id'];}return db[_0x8672('0x27')][_0x8672('0x45')]({'where':{'id':_0xf219aa[_0x8672('0x41')]['id']}})[_0x8672('0x22')](handleEntityNotFound(_0x55dc5e,null))[_0x8672('0x22')](saveUpdates(_0xf219aa[_0x8672('0x44')],null))[_0x8672('0x22')](respondWithResult(_0x55dc5e,null))[_0x8672('0x42')](handleError(_0x55dc5e,null));};exports[_0x8672('0x21')]=function(_0xbe9f24,_0x193280){return db[_0x8672('0x27')]['find']({'where':{'id':_0xbe9f24[_0x8672('0x41')]['id']}})[_0x8672('0x22')](handleEntityNotFound(_0x193280,null))[_0x8672('0x22')](removeEntity(_0x193280,null))['catch'](handleError(_0x193280,null));};exports['getFields']=function(_0x170b7a,_0x1c7f20,_0x5571f8){var _0x3bea21={};var _0x2f703a={};var _0x18b3ea;var _0x4cccf0;return db[_0x8672('0x27')][_0x8672('0x46')]({'where':{'id':_0x170b7a['params']['id']}})['then'](handleEntityNotFound(_0x1c7f20,null))[_0x8672('0x22')](function(_0x3fc00d){if(_0x3fc00d){_0x18b3ea=_0x3fc00d;_0x2f703a[_0x8672('0x2b')]=_['keys'](db[_0x8672('0x47')][_0x8672('0x28')]);_0x2f703a[_0x8672('0x2f')]=_[_0x8672('0x2c')](_0x170b7a[_0x8672('0x2f')]);_0x2f703a[_0x8672('0x2d')]=_[_0x8672('0x2e')](_0x2f703a['model'],_0x2f703a[_0x8672('0x2f')]);_0x3bea21[_0x8672('0x30')]=_['intersection'](_0x2f703a[_0x8672('0x2b')],qs[_0x8672('0x31')](_0x170b7a[_0x8672('0x2f')][_0x8672('0x31')]));_0x3bea21[_0x8672('0x30')]=_0x3bea21[_0x8672('0x30')][_0x8672('0x48')]?_0x3bea21[_0x8672('0x30')]:_0x2f703a['model'];_0x3bea21[_0x8672('0x33')]=qs[_0x8672('0x34')](_0x170b7a[_0x8672('0x2f')][_0x8672('0x34')]);_0x3bea21[_0x8672('0x37')]=qs[_0x8672('0x2d')](_['pick'](_0x170b7a['query'],_0x2f703a[_0x8672('0x2d')]));if(_0x170b7a[_0x8672('0x2f')][_0x8672('0x36')]){_0x3bea21[_0x8672('0x37')]=_[_0x8672('0x38')](_0x3bea21['where'],{'$or':_[_0x8672('0x26')](_0x3bea21[_0x8672('0x30')],function(_0xda7303){var _0x4483f0={};_0x4483f0[_0xda7303]={'$like':'%'+_0x170b7a[_0x8672('0x2f')][_0x8672('0x36')]+'%'};return _0x4483f0;})});}_0x3bea21=_[_0x8672('0x38')]({},_0x3bea21,_0x170b7a[_0x8672('0x3b')]);return _0x18b3ea['getFields'](_0x3bea21);}})[_0x8672('0x22')](function(_0x21878f){if(_0x21878f){_0x4cccf0=_0x21878f[_0x8672('0x48')];if(!_0x170b7a[_0x8672('0x2f')][_0x8672('0x32')](_0x8672('0x49'))){_0x3bea21[_0x8672('0x1a')]=qs[_0x8672('0x1a')](_0x170b7a[_0x8672('0x2f')][_0x8672('0x1a')]);_0x3bea21['offset']=qs[_0x8672('0x19')](_0x170b7a[_0x8672('0x2f')][_0x8672('0x19')]);}return _0x18b3ea[_0x8672('0x4a')](_0x3bea21);}})[_0x8672('0x22')](function(_0x86e98){if(_0x86e98){return _0x86e98?{'count':_0x4cccf0,'rows':_0x86e98}:null;}})[_0x8672('0x22')](respondWithResult(_0x1c7f20,null))['catch'](handleError(_0x1c7f20,null));};exports[_0x8672('0x4b')]=function(_0x5b65a2,_0x4dfffc,_0x14f11e){var _0x4c34f6={};var _0x41edec={};var _0x7be83b;var _0x1aa373;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x5b65a2[_0x8672('0x41')]['id']}})[_0x8672('0x22')](handleEntityNotFound(_0x4dfffc,null))['then'](function(_0x18d879){if(_0x18d879){_0x7be83b=_0x18d879;_0x41edec[_0x8672('0x2b')]=_[_0x8672('0x2c')](db[_0x8672('0x47')][_0x8672('0x28')]);_0x41edec[_0x8672('0x2f')]=_['keys'](_0x5b65a2['query']);_0x41edec['filters']=_['intersection'](_0x41edec[_0x8672('0x2b')],_0x41edec[_0x8672('0x2f')]);_0x4c34f6[_0x8672('0x30')]=_[_0x8672('0x2e')](_0x41edec[_0x8672('0x2b')],qs[_0x8672('0x31')](_0x5b65a2[_0x8672('0x2f')][_0x8672('0x31')]));_0x4c34f6[_0x8672('0x30')]=_0x4c34f6[_0x8672('0x30')][_0x8672('0x48')]?_0x4c34f6['attributes']:_0x41edec[_0x8672('0x2b')];_0x4c34f6[_0x8672('0x33')]=qs[_0x8672('0x34')](_0x5b65a2[_0x8672('0x2f')][_0x8672('0x34')]);_0x4c34f6['where']=qs[_0x8672('0x2d')](_[_0x8672('0x35')](_0x5b65a2['query'],_0x41edec['filters']));if(_0x5b65a2[_0x8672('0x2f')][_0x8672('0x36')]){_0x4c34f6[_0x8672('0x37')]=_[_0x8672('0x38')](_0x4c34f6[_0x8672('0x37')],{'$or':_[_0x8672('0x26')](_0x4c34f6[_0x8672('0x30')],function(_0x53e6ca){var _0x33060d={};_0x33060d[_0x53e6ca]={'$like':'%'+_0x5b65a2[_0x8672('0x2f')]['filter']+'%'};return _0x33060d;})});}_0x4c34f6=_[_0x8672('0x38')]({},_0x4c34f6,_0x5b65a2[_0x8672('0x3b')]);return _0x7be83b[_0x8672('0x4b')](_0x4c34f6);}})['then'](function(_0x2a7bbf){if(_0x2a7bbf){_0x1aa373=_0x2a7bbf[_0x8672('0x48')];if(!_0x5b65a2[_0x8672('0x2f')]['hasOwnProperty'](_0x8672('0x49'))){_0x4c34f6[_0x8672('0x1a')]=qs[_0x8672('0x1a')](_0x5b65a2[_0x8672('0x2f')][_0x8672('0x1a')]);_0x4c34f6[_0x8672('0x19')]=qs['offset'](_0x5b65a2['query'][_0x8672('0x19')]);}return _0x7be83b[_0x8672('0x4b')](_0x4c34f6);}})[_0x8672('0x22')](function(_0x3d5993){if(_0x3d5993){return _0x3d5993?{'count':_0x1aa373,'rows':_0x3d5993}:null;}})[_0x8672('0x22')](respondWithResult(_0x4dfffc,null))['catch'](handleError(_0x4dfffc,null));};exports['getDescriptions']=function(_0x501e07,_0x2624d4,_0x44fbf6){var _0x185499={};var _0x3bd322={};var _0xc2fe26;var _0x1dc494;return db[_0x8672('0x27')]['findOne']({'where':{'id':_0x501e07[_0x8672('0x41')]['id']}})[_0x8672('0x22')](handleEntityNotFound(_0x2624d4,null))[_0x8672('0x22')](function(_0x46a9db){if(_0x46a9db){_0xc2fe26=_0x46a9db;_0x3bd322[_0x8672('0x2b')]=_[_0x8672('0x2c')](db[_0x8672('0x47')]['rawAttributes']);_0x3bd322[_0x8672('0x2f')]=_['keys'](_0x501e07[_0x8672('0x2f')]);_0x3bd322[_0x8672('0x2d')]=_[_0x8672('0x2e')](_0x3bd322[_0x8672('0x2b')],_0x3bd322['query']);_0x185499[_0x8672('0x30')]=_['intersection'](_0x3bd322[_0x8672('0x2b')],qs[_0x8672('0x31')](_0x501e07[_0x8672('0x2f')][_0x8672('0x31')]));_0x185499[_0x8672('0x30')]=_0x185499[_0x8672('0x30')]['length']?_0x185499[_0x8672('0x30')]:_0x3bd322[_0x8672('0x2b')];_0x185499[_0x8672('0x33')]=qs[_0x8672('0x34')](_0x501e07[_0x8672('0x2f')][_0x8672('0x34')]);_0x185499['where']=qs['filters'](_[_0x8672('0x35')](_0x501e07['query'],_0x3bd322[_0x8672('0x2d')]));if(_0x501e07[_0x8672('0x2f')][_0x8672('0x36')]){_0x185499[_0x8672('0x37')]=_[_0x8672('0x38')](_0x185499['where'],{'$or':_['map'](_0x185499[_0x8672('0x30')],function(_0x251c49){var _0x2b4753={};_0x2b4753[_0x251c49]={'$like':'%'+_0x501e07['query']['filter']+'%'};return _0x2b4753;})});}_0x185499=_[_0x8672('0x38')]({},_0x185499,_0x501e07[_0x8672('0x3b')]);return _0xc2fe26[_0x8672('0x4c')](_0x185499);}})[_0x8672('0x22')](function(_0x39e3c0){if(_0x39e3c0){_0x1dc494=_0x39e3c0['length'];if(!_0x501e07[_0x8672('0x2f')][_0x8672('0x32')]('nolimit')){_0x185499[_0x8672('0x1a')]=qs['limit'](_0x501e07[_0x8672('0x2f')][_0x8672('0x1a')]);_0x185499['offset']=qs[_0x8672('0x19')](_0x501e07[_0x8672('0x2f')][_0x8672('0x19')]);}return _0xc2fe26[_0x8672('0x4c')](_0x185499);}})[_0x8672('0x22')](function(_0x3ab4b1){if(_0x3ab4b1){return _0x3ab4b1?{'count':_0x1dc494,'rows':_0x3ab4b1}:null;}})[_0x8672('0x22')](respondWithResult(_0x2624d4,null))[_0x8672('0x42')](handleError(_0x2624d4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 10150a0..6ac90bd 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 _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x118dbc,_0x2515fa){var _0x38372d=function(_0x4d49a1){while(--_0x4d49a1){_0x118dbc['push'](_0x118dbc['shift']());}};_0x38372d(++_0x2515fa);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5ae032,_0x2562ab){_0x5ae032=_0x5ae032-0x0;var _0x5c8874=_0xb43b[_0x5ae032];return _0x5c8874;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0xb57d84,_0xa8a016){var _0x71e896=function(_0x30ddd5){while(--_0x30ddd5){_0xb57d84['push'](_0xb57d84['shift']());}};_0x71e896(++_0xa8a016);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5abb6a,_0x44bd1){_0x5abb6a=_0x5abb6a-0x0;var _0x33b867=_0xb43b[_0x5abb6a];return _0x33b867;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 2ead5aa..60ae9d8 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 _0xa5ea=['error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','http','request','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xa5ea,0x15a));var _0xaa5e=function(_0x1855f3,_0x9d2dfd){_0x1855f3=_0x1855f3-0x0;var _0x2f7726=_0xa5ea[_0x1855f3];return _0x2f7726;};'use strict';var _=require('lodash');var util=require(_0xaa5e('0x0'));var moment=require(_0xaa5e('0x1'));var BPromise=require(_0xaa5e('0x2'));var rs=require(_0xaa5e('0x3'));var fs=require('fs');var Redis=require(_0xaa5e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaa5e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaa5e('0x6'));var client=jayson['client'][_0xaa5e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x62783b,_0x2e06f5,_0x4951c5){return new BPromise(function(_0x5704ac,_0x5b400b){return client[_0xaa5e('0x8')](_0x62783b,_0x4951c5)['then'](function(_0x568c65){logger['info'](_0xaa5e('0x9'),_0x2e06f5,'request\x20sent');logger[_0xaa5e('0xa')](_0xaa5e('0xb'),_0x2e06f5,_0xaa5e('0xc'),JSON[_0xaa5e('0xd')](_0x568c65));if(_0x568c65['error']){if(_0x568c65[_0xaa5e('0xe')][_0xaa5e('0xf')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x2e06f5,_0x568c65[_0xaa5e('0xe')][_0xaa5e('0x10')]);return _0x5b400b(_0x568c65[_0xaa5e('0xe')]['message']);}logger[_0xaa5e('0xe')](_0xaa5e('0x9'),_0x2e06f5,_0x568c65[_0xaa5e('0xe')][_0xaa5e('0x10')]);return _0x5704ac(_0x568c65[_0xaa5e('0xe')][_0xaa5e('0x10')]);}else{logger[_0xaa5e('0x11')](_0xaa5e('0x9'),_0x2e06f5,_0xaa5e('0xc'));_0x5704ac(_0x568c65[_0xaa5e('0x12')]['message']);}})[_0xaa5e('0x13')](function(_0x30b702){logger[_0xaa5e('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2e06f5,_0x30b702);_0x5b400b(_0x30b702);});});} \ No newline at end of file +var _0xfbd5=['error','code','message','result','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x27ec43,_0x4ac512){var _0x125770=function(_0x5b8f48){while(--_0x5b8f48){_0x27ec43['push'](_0x27ec43['shift']());}};_0x125770(++_0x4ac512);}(_0xfbd5,0x1d2));var _0x5fbd=function(_0x5770f8,_0x8f659b){_0x5770f8=_0x5770f8-0x0;var _0x4dd636=_0xfbd5[_0x5770f8];return _0x4dd636;};'use strict';var _=require('lodash');var util=require(_0x5fbd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5fbd('0x1'));var fs=require('fs');var Redis=require(_0x5fbd('0x2'));var db=require(_0x5fbd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5fbd('0x4'))('rpc');var config=require(_0x5fbd('0x5'));var jayson=require(_0x5fbd('0x6'));var client=jayson[_0x5fbd('0x7')][_0x5fbd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x458302,_0x29fe59,_0x4944f6){return new BPromise(function(_0x59c512,_0x56f175){return client[_0x5fbd('0x9')](_0x458302,_0x4944f6)[_0x5fbd('0xa')](function(_0xcfdccd){logger[_0x5fbd('0xb')](_0x5fbd('0xc'),_0x29fe59,_0x5fbd('0xd'));logger[_0x5fbd('0xe')](_0x5fbd('0xf'),_0x29fe59,'request\x20sent',JSON[_0x5fbd('0x10')](_0xcfdccd));if(_0xcfdccd[_0x5fbd('0x11')]){if(_0xcfdccd[_0x5fbd('0x11')][_0x5fbd('0x12')]===0x1f4){logger[_0x5fbd('0x11')](_0x5fbd('0xc'),_0x29fe59,_0xcfdccd[_0x5fbd('0x11')][_0x5fbd('0x13')]);return _0x56f175(_0xcfdccd[_0x5fbd('0x11')][_0x5fbd('0x13')]);}logger[_0x5fbd('0x11')](_0x5fbd('0xc'),_0x29fe59,_0xcfdccd[_0x5fbd('0x11')][_0x5fbd('0x13')]);return _0x59c512(_0xcfdccd['error'][_0x5fbd('0x13')]);}else{logger[_0x5fbd('0xb')](_0x5fbd('0xc'),_0x29fe59,_0x5fbd('0xd'));_0x59c512(_0xcfdccd[_0x5fbd('0x14')][_0x5fbd('0x13')]);}})['catch'](function(_0xef24d3){logger[_0x5fbd('0x11')](_0x5fbd('0xc'),_0x29fe59,_0xef24d3);_0x56f175(_0xef24d3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index bf4b104..3f002cc 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 _0x49f8=['index','show','post','create','put','/:id','update','delete','destroy','exports','connect-timeout','Router','fs-extra','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated'];(function(_0x730ba1,_0x12cf0c){var _0x56f431=function(_0x9bdb8a){while(--_0x9bdb8a){_0x730ba1['push'](_0x730ba1['shift']());}};_0x56f431(++_0x12cf0c);}(_0x49f8,0x12b));var _0x849f=function(_0x15395c,_0x1751a2){_0x15395c=_0x15395c-0x0;var _0x8cfff5=_0x49f8[_0x15395c];return _0x8cfff5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x849f('0x0'));var express=require('express');var router=express[_0x849f('0x1')]();var fs_extra=require(_0x849f('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x849f('0x3'));var config=require('../../config/environment');var controller=require(_0x849f('0x4'));router[_0x849f('0x5')]('/',auth[_0x849f('0x6')](),controller[_0x849f('0x7')]);router[_0x849f('0x5')]('/:id',auth[_0x849f('0x6')](),controller[_0x849f('0x8')]);router[_0x849f('0x9')]('/',auth[_0x849f('0x6')](),controller[_0x849f('0xa')]);router[_0x849f('0xb')](_0x849f('0xc'),auth[_0x849f('0x6')](),controller[_0x849f('0xd')]);router[_0x849f('0xe')]('/:id',auth[_0x849f('0x6')](),controller[_0x849f('0xf')]);module[_0x849f('0x10')]=router; \ No newline at end of file +var _0xe2ad=['isAuthenticated','post','create','put','/:id','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','./intDynamics365Field.controller','get'];(function(_0x1db9f4,_0x350402){var _0x3f7de3=function(_0x3d447e){while(--_0x3d447e){_0x1db9f4['push'](_0x1db9f4['shift']());}};_0x3f7de3(++_0x350402);}(_0xe2ad,0x1ab));var _0xde2a=function(_0x7dfcac,_0xa7b5ba){_0x7dfcac=_0x7dfcac-0x0;var _0x5bda81=_0xe2ad[_0x7dfcac];return _0x5bda81;};'use strict';var multer=require(_0xde2a('0x0'));var util=require(_0xde2a('0x1'));var path=require(_0xde2a('0x2'));var timeout=require('connect-timeout');var express=require(_0xde2a('0x3'));var router=express['Router']();var fs_extra=require(_0xde2a('0x4'));var auth=require(_0xde2a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xde2a('0x6'));router[_0xde2a('0x7')]('/',auth[_0xde2a('0x8')](),controller['index']);router[_0xde2a('0x7')]('/:id',auth[_0xde2a('0x8')](),controller['show']);router[_0xde2a('0x9')]('/',auth[_0xde2a('0x8')](),controller[_0xde2a('0xa')]);router[_0xde2a('0xb')](_0xde2a('0xc'),auth[_0xde2a('0x8')](),controller['update']);router[_0xde2a('0xd')](_0xde2a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xde2a('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 3e4b10a..00b5d9e 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 _0xd0be=['sequelize','exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN'];(function(_0x413b13,_0x4a25de){var _0x1cad2e=function(_0x757303){while(--_0x757303){_0x413b13['push'](_0x413b13['shift']());}};_0x1cad2e(++_0x4a25de);}(_0xd0be,0x15e));var _0xed0b=function(_0x448545,_0x293e6f){_0x448545=_0x448545-0x0;var _0x4e7c06=_0xd0be[_0x448545];return _0x4e7c06;};'use strict';var Sequelize=require(_0xed0b('0x0'));module[_0xed0b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xed0b('0x2'),'variable',_0xed0b('0x3'),_0xed0b('0x4'),_0xed0b('0x5')),'defaultValue':_0xed0b('0x2')},'content':{'type':Sequelize[_0xed0b('0x6')]},'key':{'type':Sequelize[_0xed0b('0x6')]},'keyType':{'type':Sequelize[_0xed0b('0x7')](_0xed0b('0x2'),_0xed0b('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0xed0b('0x6')]},'idField':{'type':Sequelize[_0xed0b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xed0b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xed0b('0x6')]}}; \ No newline at end of file +var _0x848c=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0xc3dc22,_0x49102b){var _0x1b354f=function(_0x56bc17){while(--_0x56bc17){_0xc3dc22['push'](_0xc3dc22['shift']());}};_0x1b354f(++_0x49102b);}(_0x848c,0x1af));var _0xc848=function(_0x5c2b99,_0x45f10b){_0x5c2b99=_0x5c2b99-0x0;var _0x23f66d=_0x848c[_0x5c2b99];return _0x23f66d;};'use strict';var Sequelize=require(_0xc848('0x0'));module[_0xc848('0x1')]={'type':{'type':Sequelize[_0xc848('0x2')](_0xc848('0x3'),_0xc848('0x4'),_0xc848('0x5'),_0xc848('0x6'),_0xc848('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc848('0x8')]},'key':{'type':Sequelize[_0xc848('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xc848('0x3'),_0xc848('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xc848('0x8')]},'idField':{'type':Sequelize[_0xc848('0x8')]},'nameField':{'type':Sequelize[_0xc848('0x8')]},'customField':{'type':Sequelize[_0xc848('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc848('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index dfed4af..dbbfd5d 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 _0x8e70=['zip-dir','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','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','count','offset','set','apply','reject','update','destroy','sendStatus','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','then','rows','catch','show','params','keys','include','options','find','create','body','rimraf'];(function(_0x253b34,_0x5dea9e){var _0x58262e=function(_0x559173){while(--_0x559173){_0x253b34['push'](_0x253b34['shift']());}};_0x58262e(++_0x5dea9e);}(_0x8e70,0x8d));var _0x08e7=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x8e70[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x08e7('0x0'));var zipdir=require(_0x08e7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x08e7('0x2'));var BPromise=require(_0x08e7('0x3'));var Mustache=require(_0x08e7('0x4'));var util=require(_0x08e7('0x5'));var path=require('path');var sox=require(_0x08e7('0x6'));var csv=require(_0x08e7('0x7'));var ejs=require(_0x08e7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x08e7('0x9'));var squel=require(_0x08e7('0xa'));var crypto=require(_0x08e7('0xb'));var jsforce=require(_0x08e7('0xc'));var deskjs=require(_0x08e7('0xd'));var toCsv=require(_0x08e7('0x7'));var querystring=require('querystring');var Papa=require(_0x08e7('0xe'));var Redis=require(_0x08e7('0xf'));var authService=require(_0x08e7('0x10'));var qs=require(_0x08e7('0x11'));var as=require(_0x08e7('0x12'));var hardwareService=require(_0x08e7('0x13'));var logger=require(_0x08e7('0x14'))(_0x08e7('0x15'));var utils=require(_0x08e7('0x16'));var config=require(_0x08e7('0x17'));var licenseUtil=require(_0x08e7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x92b120,_0x489177){_0x489177=_0x489177||0xcc;return function(_0x16c6e3){if(_0x16c6e3){return _0x92b120['sendStatus'](_0x489177);}return _0x92b120[_0x08e7('0x19')](_0x489177)['end']();};}function respondWithResult(_0x5432b3,_0x515ffb){_0x515ffb=_0x515ffb||0xc8;return function(_0x55c10d){if(_0x55c10d){return _0x5432b3['status'](_0x515ffb)[_0x08e7('0x1a')](_0x55c10d);}};}function respondWithFilteredResult(_0x1f898c,_0x38701){return function(_0x5de62b){if(_0x5de62b){var _0x382159=typeof _0x38701['offset']===_0x08e7('0x1b')&&typeof _0x38701[_0x08e7('0x1c')]===_0x08e7('0x1b');var _0x48bebd=_0x5de62b[_0x08e7('0x1d')];var _0x593b50=_0x382159?0x0:_0x38701[_0x08e7('0x1e')];var _0x1d4d23=_0x382159?_0x5de62b[_0x08e7('0x1d')]:_0x38701[_0x08e7('0x1e')]+_0x38701['limit'];var _0x46d307;if(_0x1d4d23>=_0x48bebd){_0x1d4d23=_0x48bebd;_0x46d307=0xc8;}else{_0x46d307=0xce;}_0x1f898c[_0x08e7('0x19')](_0x46d307);return _0x1f898c[_0x08e7('0x1f')]('Content-Range',_0x593b50+'-'+_0x1d4d23+'/'+_0x48bebd)[_0x08e7('0x1a')](_0x5de62b);}return null;};}function patchUpdates(_0x58aaab){return function(_0x69e330){try{jsonpatch[_0x08e7('0x20')](_0x69e330,_0x58aaab,!![]);}catch(_0x2072c3){return BPromise[_0x08e7('0x21')](_0x2072c3);}return _0x69e330['save']();};}function saveUpdates(_0x190267,_0x1ac789){return function(_0x173a06){if(_0x173a06){return _0x173a06[_0x08e7('0x22')](_0x190267)['then'](function(_0x241676){return _0x241676;});}return null;};}function removeEntity(_0x1e427c,_0x4f22f6){return function(_0x29512f){if(_0x29512f){return _0x29512f[_0x08e7('0x23')]()['then'](function(){_0x1e427c[_0x08e7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54fbc0,_0x51a40a){return function(_0x3f4522){if(!_0x3f4522){_0x54fbc0[_0x08e7('0x24')](0x194);}return _0x3f4522;};}function handleError(_0x500726,_0x19fde4){_0x19fde4=_0x19fde4||0x1f4;return function(_0x3bff1f){logger['error'](_0x3bff1f['stack']);if(_0x3bff1f[_0x08e7('0x25')]){delete _0x3bff1f['name'];}_0x500726['status'](_0x19fde4)[_0x08e7('0x26')](_0x3bff1f);};}exports[_0x08e7('0x27')]=function(_0x429c9c,_0x53ee00){var _0x41b037={},_0x58453e={},_0x228f52={'count':0x0,'rows':[]};var _0x47e15d=_[_0x08e7('0x28')](db[_0x08e7('0x29')][_0x08e7('0x2a')],function(_0x498251){return{'name':_0x498251['fieldName'],'type':_0x498251[_0x08e7('0x2b')][_0x08e7('0x2c')]};});_0x58453e[_0x08e7('0x2d')]=_[_0x08e7('0x28')](_0x47e15d,_0x08e7('0x25'));_0x58453e[_0x08e7('0x2e')]=_['keys'](_0x429c9c['query']);_0x58453e[_0x08e7('0x2f')]=_[_0x08e7('0x30')](_0x58453e[_0x08e7('0x2d')],_0x58453e[_0x08e7('0x2e')]);_0x41b037['attributes']=_['intersection'](_0x58453e[_0x08e7('0x2d')],qs[_0x08e7('0x31')](_0x429c9c['query'][_0x08e7('0x31')]));_0x41b037[_0x08e7('0x32')]=_0x41b037[_0x08e7('0x32')][_0x08e7('0x33')]?_0x41b037[_0x08e7('0x32')]:_0x58453e[_0x08e7('0x2d')];if(!_0x429c9c[_0x08e7('0x2e')]['hasOwnProperty']('nolimit')){_0x41b037[_0x08e7('0x1c')]=qs[_0x08e7('0x1c')](_0x429c9c['query'][_0x08e7('0x1c')]);_0x41b037['offset']=qs[_0x08e7('0x1e')](_0x429c9c[_0x08e7('0x2e')][_0x08e7('0x1e')]);}_0x41b037[_0x08e7('0x34')]=qs['sort'](_0x429c9c['query'][_0x08e7('0x35')]);_0x41b037[_0x08e7('0x36')]=qs[_0x08e7('0x2f')](_[_0x08e7('0x37')](_0x429c9c[_0x08e7('0x2e')],_0x58453e[_0x08e7('0x2f')]),_0x47e15d);if(_0x429c9c['query'][_0x08e7('0x38')]){_0x41b037[_0x08e7('0x36')]=_[_0x08e7('0x39')](_0x41b037[_0x08e7('0x36')],{'$or':_[_0x08e7('0x28')](_0x47e15d,function(_0x5b7cc1){if(_0x5b7cc1['type']!==_0x08e7('0x3a')){var _0x4b3f5e={};_0x4b3f5e[_0x5b7cc1[_0x08e7('0x25')]]={'$like':'%'+_0x429c9c[_0x08e7('0x2e')][_0x08e7('0x38')]+'%'};return _0x4b3f5e;}})});}_0x41b037=_['merge']({},_0x41b037,_0x429c9c['options']);var _0x2b32a4={'where':_0x41b037[_0x08e7('0x36')]};return db[_0x08e7('0x29')][_0x08e7('0x1d')](_0x2b32a4)['then'](function(_0x45ab03){_0x228f52[_0x08e7('0x1d')]=_0x45ab03;if(_0x429c9c['query'][_0x08e7('0x3b')]){_0x41b037['include']=[{'all':!![]}];}return db[_0x08e7('0x29')]['findAll'](_0x41b037);})[_0x08e7('0x3c')](function(_0x2d2349){_0x228f52[_0x08e7('0x3d')]=_0x2d2349;return _0x228f52;})['then'](respondWithFilteredResult(_0x53ee00,_0x41b037))[_0x08e7('0x3e')](handleError(_0x53ee00,null));};exports[_0x08e7('0x3f')]=function(_0x3116f2,_0x59d57b){var _0x441967={'raw':!![],'where':{'id':_0x3116f2[_0x08e7('0x40')]['id']}},_0x5ac51b={};_0x5ac51b['model']=_['keys'](db['Dynamics365Field'][_0x08e7('0x2a')]);_0x5ac51b[_0x08e7('0x2e')]=_[_0x08e7('0x41')](_0x3116f2[_0x08e7('0x2e')]);_0x5ac51b[_0x08e7('0x2f')]=_['intersection'](_0x5ac51b[_0x08e7('0x2d')],_0x5ac51b[_0x08e7('0x2e')]);_0x441967[_0x08e7('0x32')]=_[_0x08e7('0x30')](_0x5ac51b[_0x08e7('0x2d')],qs[_0x08e7('0x31')](_0x3116f2[_0x08e7('0x2e')][_0x08e7('0x31')]));_0x441967[_0x08e7('0x32')]=_0x441967[_0x08e7('0x32')][_0x08e7('0x33')]?_0x441967[_0x08e7('0x32')]:_0x5ac51b[_0x08e7('0x2d')];if(_0x3116f2[_0x08e7('0x2e')]['includeAll']){_0x441967[_0x08e7('0x42')]=[{'all':!![]}];}_0x441967=_[_0x08e7('0x39')]({},_0x441967,_0x3116f2[_0x08e7('0x43')]);return db[_0x08e7('0x29')][_0x08e7('0x44')](_0x441967)[_0x08e7('0x3c')](handleEntityNotFound(_0x59d57b,null))[_0x08e7('0x3c')](respondWithResult(_0x59d57b,null))[_0x08e7('0x3e')](handleError(_0x59d57b,null));};exports[_0x08e7('0x45')]=function(_0x2d0f89,_0x10dacb){return db[_0x08e7('0x29')]['create'](_0x2d0f89[_0x08e7('0x46')],{})['then'](respondWithResult(_0x10dacb,0xc9))[_0x08e7('0x3e')](handleError(_0x10dacb,null));};exports[_0x08e7('0x22')]=function(_0xf4dc38,_0x49de30){if(_0xf4dc38['body']['id']){delete _0xf4dc38[_0x08e7('0x46')]['id'];}return db['Dynamics365Field'][_0x08e7('0x44')]({'where':{'id':_0xf4dc38[_0x08e7('0x40')]['id']}})[_0x08e7('0x3c')](handleEntityNotFound(_0x49de30,null))[_0x08e7('0x3c')](saveUpdates(_0xf4dc38[_0x08e7('0x46')],null))['then'](respondWithResult(_0x49de30,null))[_0x08e7('0x3e')](handleError(_0x49de30,null));};exports['destroy']=function(_0xa719fc,_0x447659){return db[_0x08e7('0x29')][_0x08e7('0x44')]({'where':{'id':_0xa719fc['params']['id']}})[_0x08e7('0x3c')](handleEntityNotFound(_0x447659,null))[_0x08e7('0x3c')](removeEntity(_0x447659,null))[_0x08e7('0x3e')](handleError(_0x447659,null));}; \ No newline at end of file +var _0xc532=['nolimit','order','sort','where','pick','filter','VIRTUAL','options','Dynamics365Field','includeAll','include','rows','show','rawAttributes','merge','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc532,0x148));var _0x2c53=function(_0x199e63,_0x28cb1a){_0x199e63=_0x199e63-0x0;var _0x3f861f=_0xc532[_0x199e63];return _0x3f861f;};'use strict';var emlformat=require(_0x2c53('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c53('0x1'));var jsonpatch=require(_0x2c53('0x2'));var rp=require('request-promise');var moment=require(_0x2c53('0x3'));var BPromise=require(_0x2c53('0x4'));var Mustache=require(_0x2c53('0x5'));var util=require('util');var path=require(_0x2c53('0x6'));var sox=require(_0x2c53('0x7'));var csv=require(_0x2c53('0x8'));var ejs=require(_0x2c53('0x9'));var fs=require('fs');var fs_extra=require(_0x2c53('0xa'));var _=require(_0x2c53('0xb'));var squel=require(_0x2c53('0xc'));var crypto=require(_0x2c53('0xd'));var jsforce=require(_0x2c53('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2c53('0xf'));var Papa=require(_0x2c53('0x10'));var Redis=require(_0x2c53('0x11'));var authService=require(_0x2c53('0x12'));var qs=require(_0x2c53('0x13'));var as=require(_0x2c53('0x14'));var hardwareService=require(_0x2c53('0x15'));var logger=require('../../config/logger')(_0x2c53('0x16'));var utils=require('../../config/utils');var config=require(_0x2c53('0x17'));var licenseUtil=require(_0x2c53('0x18'));var db=require(_0x2c53('0x19'))['db'];function respondWithStatusCode(_0x27f57b,_0x310baf){_0x310baf=_0x310baf||0xcc;return function(_0x5dc455){if(_0x5dc455){return _0x27f57b[_0x2c53('0x1a')](_0x310baf);}return _0x27f57b[_0x2c53('0x1b')](_0x310baf)[_0x2c53('0x1c')]();};}function respondWithResult(_0x4171f3,_0x1d4b97){_0x1d4b97=_0x1d4b97||0xc8;return function(_0x55217a){if(_0x55217a){return _0x4171f3[_0x2c53('0x1b')](_0x1d4b97)['json'](_0x55217a);}};}function respondWithFilteredResult(_0x4b3ad4,_0x2a98ff){return function(_0x5f4307){if(_0x5f4307){var _0x266b26=typeof _0x2a98ff[_0x2c53('0x1d')]===_0x2c53('0x1e')&&typeof _0x2a98ff[_0x2c53('0x1f')]===_0x2c53('0x1e');var _0x2e3b51=_0x5f4307['count'];var _0x4d8f90=_0x266b26?0x0:_0x2a98ff[_0x2c53('0x1d')];var _0x26621a=_0x266b26?_0x5f4307[_0x2c53('0x20')]:_0x2a98ff[_0x2c53('0x1d')]+_0x2a98ff[_0x2c53('0x1f')];var _0xd35545;if(_0x26621a>=_0x2e3b51){_0x26621a=_0x2e3b51;_0xd35545=0xc8;}else{_0xd35545=0xce;}_0x4b3ad4[_0x2c53('0x1b')](_0xd35545);return _0x4b3ad4[_0x2c53('0x21')](_0x2c53('0x22'),_0x4d8f90+'-'+_0x26621a+'/'+_0x2e3b51)['json'](_0x5f4307);}return null;};}function patchUpdates(_0x37c840){return function(_0x3c9fec){try{jsonpatch['apply'](_0x3c9fec,_0x37c840,!![]);}catch(_0x301172){return BPromise[_0x2c53('0x23')](_0x301172);}return _0x3c9fec[_0x2c53('0x24')]();};}function saveUpdates(_0xbeedf,_0x67ef94){return function(_0x187678){if(_0x187678){return _0x187678[_0x2c53('0x25')](_0xbeedf)['then'](function(_0x100ec2){return _0x100ec2;});}return null;};}function removeEntity(_0x2153e2,_0xf315d4){return function(_0x58e670){if(_0x58e670){return _0x58e670[_0x2c53('0x26')]()[_0x2c53('0x27')](function(){_0x2153e2[_0x2c53('0x1b')](0xcc)[_0x2c53('0x1c')]();});}};}function handleEntityNotFound(_0xc9ab13,_0x45bb84){return function(_0x3cdc16){if(!_0x3cdc16){_0xc9ab13[_0x2c53('0x1a')](0x194);}return _0x3cdc16;};}function handleError(_0x3f5b08,_0x464712){_0x464712=_0x464712||0x1f4;return function(_0x2190b0){logger['error'](_0x2190b0[_0x2c53('0x28')]);if(_0x2190b0['name']){delete _0x2190b0[_0x2c53('0x29')];}_0x3f5b08[_0x2c53('0x1b')](_0x464712)[_0x2c53('0x2a')](_0x2190b0);};}exports[_0x2c53('0x2b')]=function(_0x5ed94e,_0x59245b){var _0x4936ce={},_0x3c235d={},_0x5e8f31={'count':0x0,'rows':[]};var _0x47cfe0=_['map'](db['Dynamics365Field']['rawAttributes'],function(_0x1c5b69){return{'name':_0x1c5b69[_0x2c53('0x2c')],'type':_0x1c5b69[_0x2c53('0x2d')][_0x2c53('0x2e')]};});_0x3c235d[_0x2c53('0x2f')]=_[_0x2c53('0x30')](_0x47cfe0,_0x2c53('0x29'));_0x3c235d[_0x2c53('0x31')]=_[_0x2c53('0x32')](_0x5ed94e['query']);_0x3c235d[_0x2c53('0x33')]=_[_0x2c53('0x34')](_0x3c235d[_0x2c53('0x2f')],_0x3c235d[_0x2c53('0x31')]);_0x4936ce['attributes']=_[_0x2c53('0x34')](_0x3c235d['model'],qs[_0x2c53('0x35')](_0x5ed94e['query']['fields']));_0x4936ce[_0x2c53('0x36')]=_0x4936ce[_0x2c53('0x36')][_0x2c53('0x37')]?_0x4936ce[_0x2c53('0x36')]:_0x3c235d[_0x2c53('0x2f')];if(!_0x5ed94e[_0x2c53('0x31')][_0x2c53('0x38')](_0x2c53('0x39'))){_0x4936ce[_0x2c53('0x1f')]=qs[_0x2c53('0x1f')](_0x5ed94e[_0x2c53('0x31')][_0x2c53('0x1f')]);_0x4936ce[_0x2c53('0x1d')]=qs['offset'](_0x5ed94e['query'][_0x2c53('0x1d')]);}_0x4936ce[_0x2c53('0x3a')]=qs[_0x2c53('0x3b')](_0x5ed94e['query']['sort']);_0x4936ce[_0x2c53('0x3c')]=qs['filters'](_[_0x2c53('0x3d')](_0x5ed94e[_0x2c53('0x31')],_0x3c235d['filters']),_0x47cfe0);if(_0x5ed94e[_0x2c53('0x31')][_0x2c53('0x3e')]){_0x4936ce[_0x2c53('0x3c')]=_['merge'](_0x4936ce['where'],{'$or':_['map'](_0x47cfe0,function(_0x3ca270){if(_0x3ca270[_0x2c53('0x2d')]!==_0x2c53('0x3f')){var _0x22e25e={};_0x22e25e[_0x3ca270[_0x2c53('0x29')]]={'$like':'%'+_0x5ed94e[_0x2c53('0x31')][_0x2c53('0x3e')]+'%'};return _0x22e25e;}})});}_0x4936ce=_['merge']({},_0x4936ce,_0x5ed94e[_0x2c53('0x40')]);var _0xc763c6={'where':_0x4936ce[_0x2c53('0x3c')]};return db[_0x2c53('0x41')]['count'](_0xc763c6)[_0x2c53('0x27')](function(_0x30843e){_0x5e8f31[_0x2c53('0x20')]=_0x30843e;if(_0x5ed94e['query'][_0x2c53('0x42')]){_0x4936ce[_0x2c53('0x43')]=[{'all':!![]}];}return db[_0x2c53('0x41')]['findAll'](_0x4936ce);})['then'](function(_0x3a47ba){_0x5e8f31[_0x2c53('0x44')]=_0x3a47ba;return _0x5e8f31;})['then'](respondWithFilteredResult(_0x59245b,_0x4936ce))['catch'](handleError(_0x59245b,null));};exports[_0x2c53('0x45')]=function(_0x1f5e92,_0x2269fe){var _0x379356={'raw':!![],'where':{'id':_0x1f5e92['params']['id']}},_0xbab96e={};_0xbab96e[_0x2c53('0x2f')]=_[_0x2c53('0x32')](db[_0x2c53('0x41')][_0x2c53('0x46')]);_0xbab96e['query']=_[_0x2c53('0x32')](_0x1f5e92['query']);_0xbab96e['filters']=_[_0x2c53('0x34')](_0xbab96e[_0x2c53('0x2f')],_0xbab96e[_0x2c53('0x31')]);_0x379356[_0x2c53('0x36')]=_['intersection'](_0xbab96e[_0x2c53('0x2f')],qs[_0x2c53('0x35')](_0x1f5e92[_0x2c53('0x31')][_0x2c53('0x35')]));_0x379356[_0x2c53('0x36')]=_0x379356['attributes']['length']?_0x379356[_0x2c53('0x36')]:_0xbab96e[_0x2c53('0x2f')];if(_0x1f5e92[_0x2c53('0x31')][_0x2c53('0x42')]){_0x379356[_0x2c53('0x43')]=[{'all':!![]}];}_0x379356=_[_0x2c53('0x47')]({},_0x379356,_0x1f5e92[_0x2c53('0x40')]);return db[_0x2c53('0x41')][_0x2c53('0x48')](_0x379356)[_0x2c53('0x27')](handleEntityNotFound(_0x2269fe,null))[_0x2c53('0x27')](respondWithResult(_0x2269fe,null))[_0x2c53('0x49')](handleError(_0x2269fe,null));};exports[_0x2c53('0x4a')]=function(_0x59460b,_0x1ba508){return db[_0x2c53('0x41')][_0x2c53('0x4a')](_0x59460b[_0x2c53('0x4b')],{})[_0x2c53('0x27')](respondWithResult(_0x1ba508,0xc9))[_0x2c53('0x49')](handleError(_0x1ba508,null));};exports[_0x2c53('0x25')]=function(_0x556425,_0x10f298){if(_0x556425[_0x2c53('0x4b')]['id']){delete _0x556425[_0x2c53('0x4b')]['id'];}return db[_0x2c53('0x41')]['find']({'where':{'id':_0x556425[_0x2c53('0x4c')]['id']}})[_0x2c53('0x27')](handleEntityNotFound(_0x10f298,null))[_0x2c53('0x27')](saveUpdates(_0x556425[_0x2c53('0x4b')],null))[_0x2c53('0x27')](respondWithResult(_0x10f298,null))[_0x2c53('0x49')](handleError(_0x10f298,null));};exports[_0x2c53('0x26')]=function(_0x769097,_0x4edff6){return db[_0x2c53('0x41')][_0x2c53('0x48')]({'where':{'id':_0x769097[_0x2c53('0x4c')]['id']}})[_0x2c53('0x27')](handleEntityNotFound(_0x4edff6,null))[_0x2c53('0x27')](removeEntity(_0x4edff6,null))['catch'](handleError(_0x4edff6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 50abf61..541b99b 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 _0xb1b0=['int_dynamics365_fields','dynamics365_unique_index','api','moment','bluebird','path','rimraf','exports','define','Dynamics365Field'];(function(_0x929c80,_0x5b9401){var _0x31c2b5=function(_0x1a9b8d){while(--_0x1a9b8d){_0x929c80['push'](_0x929c80['shift']());}};_0x31c2b5(++_0x5b9401);}(_0xb1b0,0xfc));var _0x0b1b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb1b0[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0b1b('0x0'));var moment=require(_0x0b1b('0x1'));var BPromise=require(_0x0b1b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b1b('0x3'));var rimraf=require(_0x0b1b('0x4'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x0b1b('0x5')]=function(_0x23d988,_0x5261de){return _0x23d988[_0x0b1b('0x6')](_0x0b1b('0x7'),attributes,{'tableName':_0x0b1b('0x8'),'paranoid':![],'indexes':[{'name':_0x0b1b('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67f6=['bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','../../config/logger','moment'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0x67f6,0x15e));var _0x667f=function(_0x5ad556,_0x4225cf){_0x5ad556=_0x5ad556-0x0;var _0x1b3a01=_0x67f6[_0x5ad556];return _0x1b3a01;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x667f('0x0'))('api');var moment=require(_0x667f('0x1'));var BPromise=require(_0x667f('0x2'));var rp=require(_0x667f('0x3'));var fs=require('fs');var path=require(_0x667f('0x4'));var rimraf=require(_0x667f('0x5'));var config=require('../../config/environment');var attributes=require(_0x667f('0x6'));module[_0x667f('0x7')]=function(_0x478fe8,_0x1301d2){return _0x478fe8[_0x667f('0x8')](_0x667f('0x9'),attributes,{'tableName':_0x667f('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 0c9985f..306fde2 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 _0x2d54=['../../config/environment','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0x2d54,0x84));var _0x42d5=function(_0x53ff3b,_0x58f396){_0x53ff3b=_0x53ff3b-0x0;var _0x4d7ac2=_0x2d54[_0x53ff3b];return _0x4d7ac2;};'use strict';var _=require(_0x42d5('0x0'));var util=require(_0x42d5('0x1'));var moment=require(_0x42d5('0x2'));var BPromise=require(_0x42d5('0x3'));var rs=require(_0x42d5('0x4'));var fs=require('fs');var Redis=require(_0x42d5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x42d5('0x6'));var logger=require(_0x42d5('0x7'))('rpc');var config=require(_0x42d5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x42d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4895fd,_0x5b237a,_0x4765ba){return new BPromise(function(_0x2c1d3c,_0x1f1ecc){return client[_0x42d5('0xa')](_0x4895fd,_0x4765ba)['then'](function(_0x3d404f){logger[_0x42d5('0xb')](_0x42d5('0xc'),_0x5b237a,_0x42d5('0xd'));logger[_0x42d5('0xe')](_0x42d5('0xf'),_0x5b237a,_0x42d5('0xd'),JSON['stringify'](_0x3d404f));if(_0x3d404f[_0x42d5('0x10')]){if(_0x3d404f[_0x42d5('0x10')][_0x42d5('0x11')]===0x1f4){logger[_0x42d5('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x5b237a,_0x3d404f[_0x42d5('0x10')][_0x42d5('0x12')]);return _0x1f1ecc(_0x3d404f[_0x42d5('0x10')][_0x42d5('0x12')]);}logger['error'](_0x42d5('0xc'),_0x5b237a,_0x3d404f[_0x42d5('0x10')][_0x42d5('0x12')]);return _0x2c1d3c(_0x3d404f['error']['message']);}else{logger[_0x42d5('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x5b237a,_0x42d5('0xd'));_0x2c1d3c(_0x3d404f['result'][_0x42d5('0x12')]);}})[_0x42d5('0x13')](function(_0x5334a5){logger[_0x42d5('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x5b237a,_0x5334a5);_0x1f1ecc(_0x5334a5);});});} \ No newline at end of file +var _0xb626=['request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xb626,0x13f));var _0x6b62=function(_0x3ae5a5,_0x1bf802){_0x3ae5a5=_0x3ae5a5-0x0;var _0x35673d=_0xb626[_0x3ae5a5];return _0x35673d;};'use strict';var _=require(_0x6b62('0x0'));var util=require(_0x6b62('0x1'));var moment=require('moment');var BPromise=require(_0x6b62('0x2'));var rs=require(_0x6b62('0x3'));var fs=require('fs');var Redis=require(_0x6b62('0x4'));var db=require(_0x6b62('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b62('0x6'))(_0x6b62('0x7'));var config=require('../../config/environment');var jayson=require(_0x6b62('0x8'));var client=jayson[_0x6b62('0x9')][_0x6b62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbabc23,_0x28f485,_0x1a9906){return new BPromise(function(_0x2ab472,_0x11bd77){return client[_0x6b62('0xb')](_0xbabc23,_0x1a9906)[_0x6b62('0xc')](function(_0x3c9593){logger['info'](_0x6b62('0xd'),_0x28f485,_0x6b62('0xe'));logger[_0x6b62('0xf')](_0x6b62('0x10'),_0x28f485,_0x6b62('0xe'),JSON['stringify'](_0x3c9593));if(_0x3c9593['error']){if(_0x3c9593[_0x6b62('0x11')][_0x6b62('0x12')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x28f485,_0x3c9593[_0x6b62('0x11')][_0x6b62('0x13')]);return _0x11bd77(_0x3c9593[_0x6b62('0x11')][_0x6b62('0x13')]);}logger[_0x6b62('0x11')](_0x6b62('0xd'),_0x28f485,_0x3c9593[_0x6b62('0x11')][_0x6b62('0x13')]);return _0x2ab472(_0x3c9593['error'][_0x6b62('0x13')]);}else{logger['info'](_0x6b62('0xd'),_0x28f485,'request\x20sent');_0x2ab472(_0x3c9593[_0x6b62('0x14')]['message']);}})[_0x6b62('0x15')](function(_0x572679){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x28f485,_0x572679);_0x11bd77(_0x572679);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 17eb57b..0b5213e 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 _0x552d=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','/:id'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0x552d,0x7a));var _0xd552=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x552d[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xd552('0x0'));var util=require('util');var path=require(_0xd552('0x1'));var timeout=require(_0xd552('0x2'));var express=require(_0xd552('0x3'));var router=express[_0xd552('0x4')]();var fs_extra=require(_0xd552('0x5'));var auth=require(_0xd552('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd552('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0xd552('0x8')]('/',auth[_0xd552('0x9')](),controller[_0xd552('0xa')]);router[_0xd552('0x8')]('/:id',auth[_0xd552('0x9')](),controller[_0xd552('0xb')]);router[_0xd552('0x8')](_0xd552('0xc'),auth['isAuthenticated'](),controller[_0xd552('0xd')]);router[_0xd552('0x8')](_0xd552('0xe'),auth[_0xd552('0x9')](),controller[_0xd552('0xf')]);router[_0xd552('0x10')]('/',auth['isAuthenticated'](),controller[_0xd552('0x11')]);router[_0xd552('0x10')](_0xd552('0xc'),auth[_0xd552('0x9')](),controller[_0xd552('0x12')]);router[_0xd552('0x13')]('/:id',auth[_0xd552('0x9')](),controller[_0xd552('0x14')]);router['delete'](_0xd552('0x15'),auth[_0xd552('0x9')](),controller[_0xd552('0x16')]);module[_0xd552('0x17')]=router; \ No newline at end of file +var _0x6359=['getFields','post','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','Router','../../config/environment','get','isAuthenticated','show','getConfigurations','/:id/fields'];(function(_0x18c898,_0x3c09fe){var _0x3a11cd=function(_0x5987f2){while(--_0x5987f2){_0x18c898['push'](_0x18c898['shift']());}};_0x3a11cd(++_0x3c09fe);}(_0x6359,0xce));var _0x9635=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6359[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x9635('0x0'));var util=require(_0x9635('0x1'));var path=require(_0x9635('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9635('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9635('0x4'));var controller=require('./intFreshdeskAccount.controller');router[_0x9635('0x5')]('/',auth[_0x9635('0x6')](),controller['index']);router[_0x9635('0x5')]('/:id',auth[_0x9635('0x6')](),controller[_0x9635('0x7')]);router[_0x9635('0x5')]('/:id/configurations',auth[_0x9635('0x6')](),controller[_0x9635('0x8')]);router['get'](_0x9635('0x9'),auth['isAuthenticated'](),controller[_0x9635('0xa')]);router[_0x9635('0xb')]('/',auth[_0x9635('0x6')](),controller['create']);router[_0x9635('0xb')]('/:id/configurations',auth[_0x9635('0x6')](),controller[_0x9635('0xc')]);router[_0x9635('0xd')](_0x9635('0xe'),auth[_0x9635('0x6')](),controller[_0x9635('0xf')]);router['delete'](_0x9635('0xe'),auth[_0x9635('0x6')](),controller[_0x9635('0x10')]);module[_0x9635('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index d68d95e..cda38e8 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 _0xdf55=['exports','STRING','remoteUri','sequelize'];(function(_0xf4eca8,_0x546625){var _0x271262=function(_0x1a6003){while(--_0x1a6003){_0xf4eca8['push'](_0xf4eca8['shift']());}};_0x271262(++_0x546625);}(_0xdf55,0x83));var _0x5df5=function(_0x3bb0d4,_0xe492ec){_0x3bb0d4=_0x3bb0d4-0x0;var _0x269be3=_0xdf55[_0x3bb0d4];return _0x269be3;};'use strict';var Sequelize=require(_0x5df5('0x0'));module[_0x5df5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5df5('0x2')]},'username':{'type':Sequelize[_0x5df5('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x5df5('0x2')]},'remoteUri':{'type':Sequelize[_0x5df5('0x2')],'unique':_0x5df5('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4b17=['username','sequelize','STRING'];(function(_0x181c12,_0x1f9bf7){var _0x475336=function(_0xd2e09d){while(--_0xd2e09d){_0x181c12['push'](_0x181c12['shift']());}};_0x475336(++_0x1f9bf7);}(_0x4b17,0x10f));var _0x74b1=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x4b17[_0x1a7846];return _0x48049;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x74b1('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x74b1('0x1')],'unique':_0x74b1('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x74b1('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 5f8a0a8..b18cd68 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 _0xb248=['Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','find','create','body','catch','getConfigurations','FreshdeskConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','agent','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','set'];(function(_0x4e9182,_0x3b49b1){var _0x17aef7=function(_0x516e65){while(--_0x516e65){_0x4e9182['push'](_0x4e9182['shift']());}};_0x17aef7(++_0x3b49b1);}(_0xb248,0xc6));var _0x8b24=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xb248[_0x255d5b];return _0x3e141a;};'use strict';var emlformat=require(_0x8b24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b24('0x1'));var jsonpatch=require(_0x8b24('0x2'));var rp=require(_0x8b24('0x3'));var moment=require(_0x8b24('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b24('0x5'));var util=require(_0x8b24('0x6'));var path=require('path');var sox=require(_0x8b24('0x7'));var csv=require(_0x8b24('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b24('0x9'));var _=require(_0x8b24('0xa'));var squel=require('squel');var crypto=require(_0x8b24('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b24('0xc'));var toCsv=require(_0x8b24('0x8'));var querystring=require(_0x8b24('0xd'));var Papa=require('papaparse');var Redis=require(_0x8b24('0xe'));var authService=require(_0x8b24('0xf'));var qs=require(_0x8b24('0x10'));var as=require(_0x8b24('0x11'));var hardwareService=require(_0x8b24('0x12'));var logger=require(_0x8b24('0x13'))(_0x8b24('0x14'));var utils=require(_0x8b24('0x15'));var config=require(_0x8b24('0x16'));var licenseUtil=require(_0x8b24('0x17'));var db=require(_0x8b24('0x18'))['db'];var integrations=require(_0x8b24('0x19'));function respondWithStatusCode(_0x40c1e6,_0x40ea49){_0x40ea49=_0x40ea49||0xcc;return function(_0x495ba4){if(_0x495ba4){return _0x40c1e6['sendStatus'](_0x40ea49);}return _0x40c1e6[_0x8b24('0x1a')](_0x40ea49)[_0x8b24('0x1b')]();};}function respondWithResult(_0xf92148,_0x32a451){_0x32a451=_0x32a451||0xc8;return function(_0x22a11e){if(_0x22a11e){return _0xf92148[_0x8b24('0x1a')](_0x32a451)[_0x8b24('0x1c')](_0x22a11e);}};}function respondWithFilteredResult(_0x3cd934,_0x4e66ae){return function(_0x5a5745){if(_0x5a5745){var _0x552a28=typeof _0x4e66ae[_0x8b24('0x1d')]==='undefined'&&typeof _0x4e66ae['limit']===_0x8b24('0x1e');var _0x1d7722=_0x5a5745['count'];var _0x1bafdf=_0x552a28?0x0:_0x4e66ae['offset'];var _0x3b4805=_0x552a28?_0x5a5745['count']:_0x4e66ae[_0x8b24('0x1d')]+_0x4e66ae['limit'];var _0x9ab9bd;if(_0x3b4805>=_0x1d7722){_0x3b4805=_0x1d7722;_0x9ab9bd=0xc8;}else{_0x9ab9bd=0xce;}_0x3cd934[_0x8b24('0x1a')](_0x9ab9bd);return _0x3cd934[_0x8b24('0x1f')](_0x8b24('0x20'),_0x1bafdf+'-'+_0x3b4805+'/'+_0x1d7722)[_0x8b24('0x1c')](_0x5a5745);}return null;};}function patchUpdates(_0x44aae9){return function(_0x2f62b3){try{jsonpatch['apply'](_0x2f62b3,_0x44aae9,!![]);}catch(_0x265879){return BPromise[_0x8b24('0x21')](_0x265879);}return _0x2f62b3['save']();};}function saveUpdates(_0xd9b96,_0x13dd68){return function(_0x2225a6){if(_0x2225a6){return _0x2225a6[_0x8b24('0x22')](_0xd9b96)[_0x8b24('0x23')](function(_0x10b721){return _0x10b721;});}return null;};}function removeEntity(_0x347591,_0x3fddf8){return function(_0x2e8c46){if(_0x2e8c46){return _0x2e8c46[_0x8b24('0x24')]()[_0x8b24('0x23')](function(){_0x347591[_0x8b24('0x1a')](0xcc)[_0x8b24('0x1b')]();});}};}function handleEntityNotFound(_0x3d541e,_0x19600a){return function(_0x35d496){if(!_0x35d496){_0x3d541e[_0x8b24('0x25')](0x194);}return _0x35d496;};}function handleError(_0x1a62e9,_0x44ee85){_0x44ee85=_0x44ee85||0x1f4;return function(_0x279837){logger[_0x8b24('0x26')](_0x279837[_0x8b24('0x27')]);if(_0x279837[_0x8b24('0x28')]){delete _0x279837[_0x8b24('0x28')];}_0x1a62e9[_0x8b24('0x1a')](_0x44ee85)[_0x8b24('0x29')](_0x279837);};}exports[_0x8b24('0x2a')]=function(_0x140a50,_0x5d3958){var _0x36ff89={},_0x59d6e1={},_0xadbba0={'count':0x0,'rows':[]};var _0x14316c=_[_0x8b24('0x2b')](db[_0x8b24('0x2c')][_0x8b24('0x2d')],function(_0x4de1cf){return{'name':_0x4de1cf[_0x8b24('0x2e')],'type':_0x4de1cf[_0x8b24('0x2f')][_0x8b24('0x30')]};});_0x59d6e1['model']=_['map'](_0x14316c,'name');_0x59d6e1[_0x8b24('0x31')]=_[_0x8b24('0x32')](_0x140a50[_0x8b24('0x31')]);_0x59d6e1[_0x8b24('0x33')]=_[_0x8b24('0x34')](_0x59d6e1[_0x8b24('0x35')],_0x59d6e1[_0x8b24('0x31')]);_0x36ff89[_0x8b24('0x36')]=_[_0x8b24('0x34')](_0x59d6e1['model'],qs[_0x8b24('0x37')](_0x140a50[_0x8b24('0x31')][_0x8b24('0x37')]));_0x36ff89['attributes']=_0x36ff89[_0x8b24('0x36')][_0x8b24('0x38')]?_0x36ff89[_0x8b24('0x36')]:_0x59d6e1[_0x8b24('0x35')];if(!_0x140a50[_0x8b24('0x31')][_0x8b24('0x39')](_0x8b24('0x3a'))){_0x36ff89[_0x8b24('0x3b')]=qs[_0x8b24('0x3b')](_0x140a50['query'][_0x8b24('0x3b')]);_0x36ff89[_0x8b24('0x1d')]=qs['offset'](_0x140a50[_0x8b24('0x31')][_0x8b24('0x1d')]);}_0x36ff89['order']=qs[_0x8b24('0x3c')](_0x140a50[_0x8b24('0x31')][_0x8b24('0x3c')]);_0x36ff89[_0x8b24('0x3d')]=qs['filters'](_[_0x8b24('0x3e')](_0x140a50[_0x8b24('0x31')],_0x59d6e1[_0x8b24('0x33')]),_0x14316c);if(_0x140a50[_0x8b24('0x31')][_0x8b24('0x3f')]){_0x36ff89[_0x8b24('0x3d')]=_['merge'](_0x36ff89[_0x8b24('0x3d')],{'$or':_[_0x8b24('0x2b')](_0x14316c,function(_0x2d70bc){if(_0x2d70bc[_0x8b24('0x2f')]!==_0x8b24('0x40')){var _0x3405b2={};_0x3405b2[_0x2d70bc[_0x8b24('0x28')]]={'$like':'%'+_0x140a50[_0x8b24('0x31')][_0x8b24('0x3f')]+'%'};return _0x3405b2;}})});}_0x36ff89=_[_0x8b24('0x41')]({},_0x36ff89,_0x140a50[_0x8b24('0x42')]);var _0x531425={'where':_0x36ff89[_0x8b24('0x3d')]};return db['FreshdeskAccount'][_0x8b24('0x43')](_0x531425)[_0x8b24('0x23')](function(_0x191905){_0xadbba0['count']=_0x191905;if(_0x140a50[_0x8b24('0x31')][_0x8b24('0x44')]){_0x36ff89[_0x8b24('0x45')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x8b24('0x46')](_0x36ff89);})['then'](function(_0x507021){_0xadbba0[_0x8b24('0x47')]=_0x507021;return _0xadbba0;})['then'](respondWithFilteredResult(_0x5d3958,_0x36ff89))['catch'](handleError(_0x5d3958,null));};exports[_0x8b24('0x48')]=function(_0xd3f68,_0x3ee117){var _0x3c6dc2={'raw':![],'where':{'id':_0xd3f68[_0x8b24('0x49')]['id']}},_0x44a734={};_0x44a734[_0x8b24('0x35')]=_['keys'](db['FreshdeskAccount'][_0x8b24('0x2d')]);_0x44a734[_0x8b24('0x31')]=_[_0x8b24('0x32')](_0xd3f68[_0x8b24('0x31')]);_0x44a734['filters']=_[_0x8b24('0x34')](_0x44a734[_0x8b24('0x35')],_0x44a734[_0x8b24('0x31')]);_0x3c6dc2['attributes']=_[_0x8b24('0x34')](_0x44a734['model'],qs[_0x8b24('0x37')](_0xd3f68[_0x8b24('0x31')]['fields']));_0x3c6dc2[_0x8b24('0x36')]=_0x3c6dc2[_0x8b24('0x36')][_0x8b24('0x38')]?_0x3c6dc2[_0x8b24('0x36')]:_0x44a734[_0x8b24('0x35')];if(_0xd3f68[_0x8b24('0x31')][_0x8b24('0x44')]){_0x3c6dc2[_0x8b24('0x45')]=[{'all':!![]}];}_0x3c6dc2=_[_0x8b24('0x41')]({},_0x3c6dc2,_0xd3f68[_0x8b24('0x42')]);return db[_0x8b24('0x2c')][_0x8b24('0x4a')](_0x3c6dc2)['then'](handleEntityNotFound(_0x3ee117,null))[_0x8b24('0x23')](respondWithResult(_0x3ee117,null))['catch'](handleError(_0x3ee117,null));};exports[_0x8b24('0x4b')]=function(_0x43cd46,_0x4f9a82){return db['FreshdeskAccount'][_0x8b24('0x4b')](_0x43cd46[_0x8b24('0x4c')],{})[_0x8b24('0x23')](respondWithResult(_0x4f9a82,0xc9))[_0x8b24('0x4d')](handleError(_0x4f9a82,null));};exports[_0x8b24('0x22')]=function(_0x22619e,_0x3d0d0b){if(_0x22619e[_0x8b24('0x4c')]['id']){delete _0x22619e['body']['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x22619e[_0x8b24('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d0d0b,null))[_0x8b24('0x23')](saveUpdates(_0x22619e[_0x8b24('0x4c')],null))[_0x8b24('0x23')](respondWithResult(_0x3d0d0b,null))[_0x8b24('0x4d')](handleError(_0x3d0d0b,null));};exports['destroy']=function(_0x3bc90a,_0x3df397){return db[_0x8b24('0x2c')][_0x8b24('0x4a')]({'where':{'id':_0x3bc90a[_0x8b24('0x49')]['id']}})[_0x8b24('0x23')](handleEntityNotFound(_0x3df397,null))[_0x8b24('0x23')](removeEntity(_0x3df397,null))[_0x8b24('0x4d')](handleError(_0x3df397,null));};exports[_0x8b24('0x4e')]=function(_0x2a03fc,_0x229377,_0x1f4882){var _0x12b0ea={};var _0x437919={};var _0x1b7687;var _0x19bf6f;return db[_0x8b24('0x2c')]['findOne']({'where':{'id':_0x2a03fc[_0x8b24('0x49')]['id']}})[_0x8b24('0x23')](handleEntityNotFound(_0x229377,null))[_0x8b24('0x23')](function(_0x3dcec6){if(_0x3dcec6){_0x1b7687=_0x3dcec6;_0x437919['model']=_[_0x8b24('0x32')](db[_0x8b24('0x4f')][_0x8b24('0x2d')]);_0x437919[_0x8b24('0x31')]=_[_0x8b24('0x32')](_0x2a03fc[_0x8b24('0x31')]);_0x437919[_0x8b24('0x33')]=_[_0x8b24('0x34')](_0x437919[_0x8b24('0x35')],_0x437919[_0x8b24('0x31')]);_0x12b0ea[_0x8b24('0x36')]=_[_0x8b24('0x34')](_0x437919[_0x8b24('0x35')],qs[_0x8b24('0x37')](_0x2a03fc[_0x8b24('0x31')][_0x8b24('0x37')]));_0x12b0ea['attributes']=_0x12b0ea['attributes']['length']?_0x12b0ea[_0x8b24('0x36')]:_0x437919['model'];_0x12b0ea['order']=qs[_0x8b24('0x3c')](_0x2a03fc[_0x8b24('0x31')]['sort']);_0x12b0ea[_0x8b24('0x3d')]=qs[_0x8b24('0x33')](_[_0x8b24('0x3e')](_0x2a03fc[_0x8b24('0x31')],_0x437919[_0x8b24('0x33')]));if(_0x2a03fc[_0x8b24('0x31')][_0x8b24('0x3f')]){_0x12b0ea['where']=_[_0x8b24('0x41')](_0x12b0ea[_0x8b24('0x3d')],{'$or':_[_0x8b24('0x2b')](_0x12b0ea['attributes'],function(_0x4dd8cc){var _0x2abfed={};_0x2abfed[_0x4dd8cc]={'$like':'%'+_0x2a03fc[_0x8b24('0x31')][_0x8b24('0x3f')]+'%'};return _0x2abfed;})});}_0x12b0ea=_['merge']({},_0x12b0ea,_0x2a03fc[_0x8b24('0x42')]);return _0x1b7687['getConfigurations'](_0x12b0ea);}})[_0x8b24('0x23')](function(_0x402ec9){if(_0x402ec9){_0x19bf6f=_0x402ec9[_0x8b24('0x38')];if(!_0x2a03fc[_0x8b24('0x31')][_0x8b24('0x39')]('nolimit')){_0x12b0ea[_0x8b24('0x3b')]=qs[_0x8b24('0x3b')](_0x2a03fc[_0x8b24('0x31')][_0x8b24('0x3b')]);_0x12b0ea[_0x8b24('0x1d')]=qs['offset'](_0x2a03fc['query'][_0x8b24('0x1d')]);}return _0x1b7687[_0x8b24('0x4e')](_0x12b0ea);}})[_0x8b24('0x23')](function(_0x568530){if(_0x568530){return _0x568530?{'count':_0x19bf6f,'rows':_0x568530}:null;}})[_0x8b24('0x23')](respondWithResult(_0x229377,null))[_0x8b24('0x4d')](handleError(_0x229377,null));};exports['addConfiguration']=function(_0x4ecc6c,_0x77e133,_0x2d54ba){if(_0x4ecc6c[_0x8b24('0x4c')]['id']){delete _0x4ecc6c[_0x8b24('0x4c')]['id'];}return db[_0x8b24('0x2c')][_0x8b24('0x50')]({'where':{'id':_0x4ecc6c[_0x8b24('0x49')]['id']}})[_0x8b24('0x23')](handleEntityNotFound(_0x77e133,null))[_0x8b24('0x23')](function(_0x5afbc9){if(_0x5afbc9){_0x4ecc6c[_0x8b24('0x4c')][_0x8b24('0x51')]=_0x5afbc9['id'];_0x4ecc6c[_0x8b24('0x4c')][_0x8b24('0x52')]=integrations[_0x8b24('0x53')](_0x4ecc6c['body']['channel'],_0x4ecc6c[_0x8b24('0x4c')][_0x8b24('0x2f')]);_0x4ecc6c['body'][_0x8b24('0x54')]=integrations['getDescriptions'](_0x4ecc6c[_0x8b24('0x4c')]['channel'],_0x4ecc6c['body'][_0x8b24('0x2f')]);return db[_0x8b24('0x4f')]['create'](_0x4ecc6c[_0x8b24('0x4c')],{'include':[{'model':db['FreshdeskField'],'as':_0x8b24('0x52')},{'model':db['FreshdeskField'],'as':_0x8b24('0x54')}]});}return null;})[_0x8b24('0x23')](respondWithResult(_0x77e133,null))[_0x8b24('0x4d')](handleError(_0x77e133,null));};exports[_0x8b24('0x55')]=function(_0x57bedb,_0x80db9,_0x3abc65){var _0x304b57='';return db[_0x8b24('0x2c')]['findOne']({'where':{'id':_0x57bedb[_0x8b24('0x49')]['id']},'attributes':['id',_0x8b24('0x56'),_0x8b24('0x57')]})[_0x8b24('0x23')](handleEntityNotFound(_0x80db9,null))['then'](function(_0x525617){if(_0x525617){_0x304b57=_0x525617['remoteUri'];var _0x346fac=_0x304b57[_0x8b24('0x58')](-0x1);if(_0x346fac==='/'){_0x304b57=_0x304b57[_0x8b24('0x59')](0x0,_0x304b57[_0x8b24('0x5a')](_0x346fac));}return rp({'method':_0x8b24('0x5b'),'uri':util[_0x8b24('0x5c')]('%s/%s',_0x304b57,_0x8b24('0x5d')),'headers':{'Authorization':util['format'](_0x8b24('0x5e'),new Buffer(util[_0x8b24('0x5c')](_0x8b24('0x5f'),_0x525617[_0x8b24('0x57')]))[_0x8b24('0x60')](_0x8b24('0x61')))},'json':!![]});}})[_0x8b24('0x23')](function(_0x5078c7){if(_0x5078c7){var _0x4d86c8=[_0x8b24('0x62'),'subject',_0x8b24('0x63'),'description',_0x8b24('0x1a'),_0x8b24('0x64'),_0x8b24('0x65'),_0x8b24('0x66'),_0x8b24('0x67'),_0x8b24('0x65'),_0x8b24('0x68')];_[_0x8b24('0x69')](_0x5078c7,function(_0x1bad3c){return _0x4d86c8[_0x8b24('0x6a')](_0x1bad3c[_0x8b24('0x28')])||!_0x1bad3c[_0x8b24('0x6b')]&&_0x1bad3c[_0x8b24('0x2f')]!==_0x8b24('0x6c')&&_0x1bad3c[_0x8b24('0x2f')]!==_0x8b24('0x6d');});return{'count':_0x5078c7[_0x8b24('0x38')],'rows':_['map'](_0x5078c7,function(_0x41ee80){return{'id':_0x41ee80['name'],'name':_0x41ee80[_0x8b24('0x6e')],'custom':!_0x41ee80[_0x8b24('0x6b')],'options':_0x41ee80[_0x8b24('0x6f')]?_[_0x8b24('0x2b')](_0x41ee80[_0x8b24('0x6f')],function(_0x1cd82d){return{'name':_[_0x8b24('0x70')](_0x1cd82d),'value':_0x1cd82d};}):[]};})};}})[_0x8b24('0x23')](respondWithResult(_0x80db9,null))['catch'](function(_0x4fd50a){var _0x169054=_0x57bedb[_0x8b24('0x31')]['test']?0x1f4:_0x4fd50a['statusCode']||0x1f4;logger[_0x8b24('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x8b24('0x55'),_0x169054,JSON['stringify'](_0x4fd50a));delete _0x4fd50a[_0x8b24('0x28')];if(_0x169054===0x191){_0x169054=0x190;}_0x80db9[_0x8b24('0x1a')](_0x169054)[_0x8b24('0x29')](_0x57bedb[_0x8b24('0x31')][_0x8b24('0x71')]?{'message':_0x8b24('0x72'),'statusCode':_0x4fd50a['statusCode']}:_0x4fd50a);});}; \ No newline at end of file +var _0x0647=['end','json','offset','limit','undefined','count','set','apply','reject','update','then','error','send','map','FreshdeskAccount','fieldName','type','key','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','catch','params','rawAttributes','fields','find','create','body','destroy','getConfigurations','keys','FreshdeskConfiguration','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','apiKey','toString','base64','requester','agent','description','priority','group','source','company','remove','includes','custom_text','custom_dropdown','label','default','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0647,0xd0));var _0x7064=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x0647[_0xc67528];return _0x38e26d;};'use strict';var emlformat=require(_0x7064('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7064('0x1'));var jsonpatch=require(_0x7064('0x2'));var rp=require(_0x7064('0x3'));var moment=require(_0x7064('0x4'));var BPromise=require(_0x7064('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7064('0x6'));var sox=require(_0x7064('0x7'));var csv=require(_0x7064('0x8'));var ejs=require(_0x7064('0x9'));var fs=require('fs');var fs_extra=require(_0x7064('0xa'));var _=require(_0x7064('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7064('0xc'));var deskjs=require(_0x7064('0xd'));var toCsv=require(_0x7064('0x8'));var querystring=require('querystring');var Papa=require(_0x7064('0xe'));var Redis=require(_0x7064('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7064('0x10'));var as=require(_0x7064('0x11'));var hardwareService=require(_0x7064('0x12'));var logger=require('../../config/logger')(_0x7064('0x13'));var utils=require(_0x7064('0x14'));var config=require(_0x7064('0x15'));var licenseUtil=require(_0x7064('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7064('0x17'));function respondWithStatusCode(_0x4151b6,_0x268a94){_0x268a94=_0x268a94||0xcc;return function(_0x44dcbe){if(_0x44dcbe){return _0x4151b6[_0x7064('0x18')](_0x268a94);}return _0x4151b6[_0x7064('0x19')](_0x268a94)[_0x7064('0x1a')]();};}function respondWithResult(_0x3badc8,_0x57e440){_0x57e440=_0x57e440||0xc8;return function(_0x596343){if(_0x596343){return _0x3badc8['status'](_0x57e440)[_0x7064('0x1b')](_0x596343);}};}function respondWithFilteredResult(_0x15a1c0,_0x36378c){return function(_0x4b39db){if(_0x4b39db){var _0x22cd86=typeof _0x36378c[_0x7064('0x1c')]==='undefined'&&typeof _0x36378c[_0x7064('0x1d')]===_0x7064('0x1e');var _0xd47aac=_0x4b39db[_0x7064('0x1f')];var _0x181ca0=_0x22cd86?0x0:_0x36378c[_0x7064('0x1c')];var _0x3f3695=_0x22cd86?_0x4b39db[_0x7064('0x1f')]:_0x36378c[_0x7064('0x1c')]+_0x36378c[_0x7064('0x1d')];var _0x3b6ace;if(_0x3f3695>=_0xd47aac){_0x3f3695=_0xd47aac;_0x3b6ace=0xc8;}else{_0x3b6ace=0xce;}_0x15a1c0[_0x7064('0x19')](_0x3b6ace);return _0x15a1c0[_0x7064('0x20')]('Content-Range',_0x181ca0+'-'+_0x3f3695+'/'+_0xd47aac)[_0x7064('0x1b')](_0x4b39db);}return null;};}function patchUpdates(_0x141983){return function(_0x10662b){try{jsonpatch[_0x7064('0x21')](_0x10662b,_0x141983,!![]);}catch(_0x5919bd){return BPromise[_0x7064('0x22')](_0x5919bd);}return _0x10662b['save']();};}function saveUpdates(_0x446730,_0x6eed9e){return function(_0x4ace22){if(_0x4ace22){return _0x4ace22[_0x7064('0x23')](_0x446730)[_0x7064('0x24')](function(_0x1a62a2){return _0x1a62a2;});}return null;};}function removeEntity(_0x464e8a,_0x167149){return function(_0x54817c){if(_0x54817c){return _0x54817c['destroy']()[_0x7064('0x24')](function(){_0x464e8a['status'](0xcc)[_0x7064('0x1a')]();});}};}function handleEntityNotFound(_0x3b12b6,_0x25d627){return function(_0x4a0326){if(!_0x4a0326){_0x3b12b6[_0x7064('0x18')](0x194);}return _0x4a0326;};}function handleError(_0x178150,_0x2fedca){_0x2fedca=_0x2fedca||0x1f4;return function(_0x99fa4b){logger[_0x7064('0x25')](_0x99fa4b['stack']);if(_0x99fa4b['name']){delete _0x99fa4b['name'];}_0x178150['status'](_0x2fedca)[_0x7064('0x26')](_0x99fa4b);};}exports['index']=function(_0x4406d5,_0x411c32){var _0x51b526={},_0x40a434={},_0x2b26a9={'count':0x0,'rows':[]};var _0x1d169d=_[_0x7064('0x27')](db[_0x7064('0x28')]['rawAttributes'],function(_0x41db8a){return{'name':_0x41db8a[_0x7064('0x29')],'type':_0x41db8a[_0x7064('0x2a')][_0x7064('0x2b')]};});_0x40a434['model']=_['map'](_0x1d169d,'name');_0x40a434[_0x7064('0x2c')]=_['keys'](_0x4406d5[_0x7064('0x2c')]);_0x40a434[_0x7064('0x2d')]=_['intersection'](_0x40a434[_0x7064('0x2e')],_0x40a434[_0x7064('0x2c')]);_0x51b526[_0x7064('0x2f')]=_[_0x7064('0x30')](_0x40a434['model'],qs['fields'](_0x4406d5[_0x7064('0x2c')]['fields']));_0x51b526[_0x7064('0x2f')]=_0x51b526[_0x7064('0x2f')][_0x7064('0x31')]?_0x51b526['attributes']:_0x40a434[_0x7064('0x2e')];if(!_0x4406d5[_0x7064('0x2c')][_0x7064('0x32')](_0x7064('0x33'))){_0x51b526['limit']=qs['limit'](_0x4406d5[_0x7064('0x2c')][_0x7064('0x1d')]);_0x51b526['offset']=qs[_0x7064('0x1c')](_0x4406d5[_0x7064('0x2c')][_0x7064('0x1c')]);}_0x51b526[_0x7064('0x34')]=qs[_0x7064('0x35')](_0x4406d5[_0x7064('0x2c')][_0x7064('0x35')]);_0x51b526[_0x7064('0x36')]=qs[_0x7064('0x2d')](_[_0x7064('0x37')](_0x4406d5[_0x7064('0x2c')],_0x40a434['filters']),_0x1d169d);if(_0x4406d5[_0x7064('0x2c')][_0x7064('0x38')]){_0x51b526[_0x7064('0x36')]=_[_0x7064('0x39')](_0x51b526[_0x7064('0x36')],{'$or':_['map'](_0x1d169d,function(_0xb26b7){if(_0xb26b7[_0x7064('0x2a')]!==_0x7064('0x3a')){var _0x32a75a={};_0x32a75a[_0xb26b7[_0x7064('0x3b')]]={'$like':'%'+_0x4406d5[_0x7064('0x2c')]['filter']+'%'};return _0x32a75a;}})});}_0x51b526=_[_0x7064('0x39')]({},_0x51b526,_0x4406d5[_0x7064('0x3c')]);var _0x5ce599={'where':_0x51b526[_0x7064('0x36')]};return db[_0x7064('0x28')][_0x7064('0x1f')](_0x5ce599)[_0x7064('0x24')](function(_0x2485af){_0x2b26a9[_0x7064('0x1f')]=_0x2485af;if(_0x4406d5[_0x7064('0x2c')][_0x7064('0x3d')]){_0x51b526[_0x7064('0x3e')]=[{'all':!![]}];}return db[_0x7064('0x28')][_0x7064('0x3f')](_0x51b526);})[_0x7064('0x24')](function(_0x243991){_0x2b26a9['rows']=_0x243991;return _0x2b26a9;})[_0x7064('0x24')](respondWithFilteredResult(_0x411c32,_0x51b526))[_0x7064('0x40')](handleError(_0x411c32,null));};exports['show']=function(_0x272e3c,_0x2e45bd){var _0x10e45f={'raw':![],'where':{'id':_0x272e3c[_0x7064('0x41')]['id']}},_0x38733f={};_0x38733f[_0x7064('0x2e')]=_['keys'](db['FreshdeskAccount'][_0x7064('0x42')]);_0x38733f[_0x7064('0x2c')]=_['keys'](_0x272e3c[_0x7064('0x2c')]);_0x38733f[_0x7064('0x2d')]=_['intersection'](_0x38733f[_0x7064('0x2e')],_0x38733f['query']);_0x10e45f['attributes']=_['intersection'](_0x38733f[_0x7064('0x2e')],qs[_0x7064('0x43')](_0x272e3c['query'][_0x7064('0x43')]));_0x10e45f[_0x7064('0x2f')]=_0x10e45f['attributes'][_0x7064('0x31')]?_0x10e45f[_0x7064('0x2f')]:_0x38733f['model'];if(_0x272e3c[_0x7064('0x2c')][_0x7064('0x3d')]){_0x10e45f[_0x7064('0x3e')]=[{'all':!![]}];}_0x10e45f=_['merge']({},_0x10e45f,_0x272e3c['options']);return db[_0x7064('0x28')][_0x7064('0x44')](_0x10e45f)[_0x7064('0x24')](handleEntityNotFound(_0x2e45bd,null))[_0x7064('0x24')](respondWithResult(_0x2e45bd,null))[_0x7064('0x40')](handleError(_0x2e45bd,null));};exports[_0x7064('0x45')]=function(_0x379aa0,_0x53fdd9){return db['FreshdeskAccount'][_0x7064('0x45')](_0x379aa0[_0x7064('0x46')],{})[_0x7064('0x24')](respondWithResult(_0x53fdd9,0xc9))[_0x7064('0x40')](handleError(_0x53fdd9,null));};exports[_0x7064('0x23')]=function(_0x56fda1,_0x1e205d){if(_0x56fda1['body']['id']){delete _0x56fda1['body']['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x56fda1['params']['id']}})['then'](handleEntityNotFound(_0x1e205d,null))['then'](saveUpdates(_0x56fda1[_0x7064('0x46')],null))['then'](respondWithResult(_0x1e205d,null))[_0x7064('0x40')](handleError(_0x1e205d,null));};exports[_0x7064('0x47')]=function(_0xfa02c0,_0x43bbdc){return db[_0x7064('0x28')][_0x7064('0x44')]({'where':{'id':_0xfa02c0['params']['id']}})['then'](handleEntityNotFound(_0x43bbdc,null))['then'](removeEntity(_0x43bbdc,null))[_0x7064('0x40')](handleError(_0x43bbdc,null));};exports[_0x7064('0x48')]=function(_0x4aeade,_0x362c9d,_0x130877){var _0x485c30={};var _0x425e31={};var _0xba86e0;var _0x4f7e16;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x4aeade[_0x7064('0x41')]['id']}})['then'](handleEntityNotFound(_0x362c9d,null))[_0x7064('0x24')](function(_0x388a59){if(_0x388a59){_0xba86e0=_0x388a59;_0x425e31[_0x7064('0x2e')]=_[_0x7064('0x49')](db[_0x7064('0x4a')]['rawAttributes']);_0x425e31['query']=_[_0x7064('0x49')](_0x4aeade['query']);_0x425e31[_0x7064('0x2d')]=_[_0x7064('0x30')](_0x425e31[_0x7064('0x2e')],_0x425e31[_0x7064('0x2c')]);_0x485c30[_0x7064('0x2f')]=_[_0x7064('0x30')](_0x425e31['model'],qs['fields'](_0x4aeade[_0x7064('0x2c')][_0x7064('0x43')]));_0x485c30[_0x7064('0x2f')]=_0x485c30[_0x7064('0x2f')][_0x7064('0x31')]?_0x485c30[_0x7064('0x2f')]:_0x425e31[_0x7064('0x2e')];_0x485c30['order']=qs[_0x7064('0x35')](_0x4aeade['query'][_0x7064('0x35')]);_0x485c30[_0x7064('0x36')]=qs['filters'](_[_0x7064('0x37')](_0x4aeade[_0x7064('0x2c')],_0x425e31[_0x7064('0x2d')]));if(_0x4aeade[_0x7064('0x2c')][_0x7064('0x38')]){_0x485c30[_0x7064('0x36')]=_[_0x7064('0x39')](_0x485c30[_0x7064('0x36')],{'$or':_[_0x7064('0x27')](_0x485c30['attributes'],function(_0x1458ad){var _0x2b5915={};_0x2b5915[_0x1458ad]={'$like':'%'+_0x4aeade[_0x7064('0x2c')]['filter']+'%'};return _0x2b5915;})});}_0x485c30=_['merge']({},_0x485c30,_0x4aeade[_0x7064('0x3c')]);return _0xba86e0['getConfigurations'](_0x485c30);}})['then'](function(_0x3f5275){if(_0x3f5275){_0x4f7e16=_0x3f5275['length'];if(!_0x4aeade[_0x7064('0x2c')][_0x7064('0x32')](_0x7064('0x33'))){_0x485c30[_0x7064('0x1d')]=qs[_0x7064('0x1d')](_0x4aeade['query']['limit']);_0x485c30[_0x7064('0x1c')]=qs['offset'](_0x4aeade['query'][_0x7064('0x1c')]);}return _0xba86e0[_0x7064('0x48')](_0x485c30);}})[_0x7064('0x24')](function(_0x22b5d1){if(_0x22b5d1){return _0x22b5d1?{'count':_0x4f7e16,'rows':_0x22b5d1}:null;}})[_0x7064('0x24')](respondWithResult(_0x362c9d,null))[_0x7064('0x40')](handleError(_0x362c9d,null));};exports[_0x7064('0x4b')]=function(_0x45e281,_0x286b88,_0x5df312){if(_0x45e281['body']['id']){delete _0x45e281[_0x7064('0x46')]['id'];}return db[_0x7064('0x28')][_0x7064('0x4c')]({'where':{'id':_0x45e281[_0x7064('0x41')]['id']}})['then'](handleEntityNotFound(_0x286b88,null))['then'](function(_0xe7fb0e){if(_0xe7fb0e){_0x45e281[_0x7064('0x46')][_0x7064('0x4d')]=_0xe7fb0e['id'];_0x45e281[_0x7064('0x46')]['Subjects']=integrations[_0x7064('0x4e')](_0x45e281[_0x7064('0x46')][_0x7064('0x4f')],_0x45e281[_0x7064('0x46')][_0x7064('0x2a')]);_0x45e281[_0x7064('0x46')][_0x7064('0x50')]=integrations[_0x7064('0x51')](_0x45e281['body'][_0x7064('0x4f')],_0x45e281[_0x7064('0x46')][_0x7064('0x2a')]);return db[_0x7064('0x4a')][_0x7064('0x45')](_0x45e281[_0x7064('0x46')],{'include':[{'model':db['FreshdeskField'],'as':_0x7064('0x52')},{'model':db[_0x7064('0x53')],'as':_0x7064('0x50')}]});}return null;})[_0x7064('0x24')](respondWithResult(_0x286b88,null))['catch'](handleError(_0x286b88,null));};exports[_0x7064('0x54')]=function(_0x4d194a,_0x32f9d6,_0x551b41){var _0x80e6ca='';return db[_0x7064('0x28')][_0x7064('0x4c')]({'where':{'id':_0x4d194a[_0x7064('0x41')]['id']},'attributes':['id',_0x7064('0x55'),'apiKey']})[_0x7064('0x24')](handleEntityNotFound(_0x32f9d6,null))[_0x7064('0x24')](function(_0x3ea8ea){if(_0x3ea8ea){_0x80e6ca=_0x3ea8ea['remoteUri'];var _0x25ac68=_0x80e6ca[_0x7064('0x56')](-0x1);if(_0x25ac68==='/'){_0x80e6ca=_0x80e6ca[_0x7064('0x57')](0x0,_0x80e6ca[_0x7064('0x58')](_0x25ac68));}return rp({'method':_0x7064('0x59'),'uri':util[_0x7064('0x5a')](_0x7064('0x5b'),_0x80e6ca,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0x7064('0x5c'),new Buffer(util[_0x7064('0x5a')](_0x7064('0x5d'),_0x3ea8ea[_0x7064('0x5e')]))[_0x7064('0x5f')](_0x7064('0x60')))},'json':!![]});}})[_0x7064('0x24')](function(_0x22a1e8){if(_0x22a1e8){var _0x479213=[_0x7064('0x61'),'subject',_0x7064('0x62'),_0x7064('0x63'),_0x7064('0x19'),_0x7064('0x64'),_0x7064('0x65'),_0x7064('0x66'),'ticket_type',_0x7064('0x65'),_0x7064('0x67')];_[_0x7064('0x68')](_0x22a1e8,function(_0x5a0518){return _0x479213[_0x7064('0x69')](_0x5a0518[_0x7064('0x3b')])||!_0x5a0518['default']&&_0x5a0518[_0x7064('0x2a')]!==_0x7064('0x6a')&&_0x5a0518[_0x7064('0x2a')]!==_0x7064('0x6b');});return{'count':_0x22a1e8[_0x7064('0x31')],'rows':_[_0x7064('0x27')](_0x22a1e8,function(_0x10f334){return{'id':_0x10f334[_0x7064('0x3b')],'name':_0x10f334[_0x7064('0x6c')],'custom':!_0x10f334[_0x7064('0x6d')],'options':_0x10f334[_0x7064('0x6e')]?_['map'](_0x10f334['choices'],function(_0x120b50){return{'name':_[_0x7064('0x6f')](_0x120b50),'value':_0x120b50};}):[]};})};}})[_0x7064('0x24')](respondWithResult(_0x32f9d6,null))[_0x7064('0x40')](function(_0x37c64c){var _0x310c8e=_0x4d194a[_0x7064('0x2c')]['test']?0x1f4:_0x37c64c['statusCode']||0x1f4;logger[_0x7064('0x25')](_0x7064('0x70'),'getFields',_0x310c8e,JSON[_0x7064('0x71')](_0x37c64c));delete _0x37c64c[_0x7064('0x3b')];if(_0x310c8e===0x191){_0x310c8e=0x190;}_0x32f9d6[_0x7064('0x19')](_0x310c8e)[_0x7064('0x26')](_0x4d194a['query'][_0x7064('0x72')]?{'message':_0x7064('0x73'),'statusCode':_0x37c64c[_0x7064('0x74')]}:_0x37c64c);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 3d868ff..98345f4 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 _0x328f=['../../components/integrations/configuration','exports','int_freshdesk_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x3c371c,_0x1c6d69){var _0x1ebecc=function(_0x587a96){while(--_0x587a96){_0x3c371c['push'](_0x3c371c['shift']());}};_0x1ebecc(++_0x1c6d69);}(_0x328f,0x9f));var _0xf328=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x328f[_0x231e16];return _0x570a7c;};'use strict';var _=require('lodash');var util=require(_0xf328('0x0'));var logger=require(_0xf328('0x1'))(_0xf328('0x2'));var moment=require('moment');var BPromise=require(_0xf328('0x3'));var rp=require(_0xf328('0x4'));var fs=require('fs');var path=require(_0xf328('0x5'));var rimraf=require(_0xf328('0x6'));var config=require(_0xf328('0x7'));var attributes=require(_0xf328('0x8'));var integrations=require(_0xf328('0x9'));module[_0xf328('0xa')]=function(_0x5f1dee,_0x4345d0){return _0x5f1dee['define']('FreshdeskAccount',attributes,{'tableName':_0xf328('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b9c=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x60a45c,_0x43c0b3){var _0x4aa8e9=function(_0x1f7ad0){while(--_0x1f7ad0){_0x60a45c['push'](_0x60a45c['shift']());}};_0x4aa8e9(++_0x43c0b3);}(_0x1b9c,0x1d4));var _0xc1b9=function(_0x214ef9,_0x28f211){_0x214ef9=_0x214ef9-0x0;var _0x58578b=_0x1b9c[_0x214ef9];return _0x58578b;};'use strict';var _=require(_0xc1b9('0x0'));var util=require(_0xc1b9('0x1'));var logger=require('../../config/logger')(_0xc1b9('0x2'));var moment=require(_0xc1b9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc1b9('0x4'));var fs=require('fs');var path=require(_0xc1b9('0x5'));var rimraf=require(_0xc1b9('0x6'));var config=require(_0xc1b9('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xc1b9('0x8'));module[_0xc1b9('0x9')]=function(_0x300d31,_0x110b8e){return _0x300d31[_0xc1b9('0xa')](_0xc1b9('0xb'),attributes,{'tableName':_0xc1b9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 6170861..37beab6 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 _0x3c06=['http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','include','model','map','GetFreshdeskAccount','ShowFreshdeskAccount','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x462bc3,_0x20667f){var _0x1861dc=function(_0x4fbc5e){while(--_0x4fbc5e){_0x462bc3['push'](_0x462bc3['shift']());}};_0x1861dc(++_0x20667f);}(_0x3c06,0xf7));var _0x63c0=function(_0x45e875,_0x4f2ee6){_0x45e875=_0x45e875-0x0;var _0x127d46=_0x3c06[_0x45e875];return _0x127d46;};'use strict';var _=require(_0x63c0('0x0'));var util=require(_0x63c0('0x1'));var moment=require(_0x63c0('0x2'));var BPromise=require(_0x63c0('0x3'));var rs=require(_0x63c0('0x4'));var fs=require('fs');var Redis=require(_0x63c0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x63c0('0x6'));var logger=require(_0x63c0('0x7'))(_0x63c0('0x8'));var config=require(_0x63c0('0x9'));var jayson=require(_0x63c0('0xa'));var client=jayson[_0x63c0('0xb')][_0x63c0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e1f3f,_0x5929e9,_0x10fe3a){return new BPromise(function(_0x349be4,_0x1bfdda){return client[_0x63c0('0xd')](_0x4e1f3f,_0x10fe3a)[_0x63c0('0xe')](function(_0x5ed566){logger['info'](_0x63c0('0xf'),_0x5929e9,_0x63c0('0x10'));logger[_0x63c0('0x11')](_0x63c0('0x12'),_0x5929e9,_0x63c0('0x10'),JSON['stringify'](_0x5ed566));if(_0x5ed566[_0x63c0('0x13')]){if(_0x5ed566['error']['code']===0x1f4){logger[_0x63c0('0x13')](_0x63c0('0xf'),_0x5929e9,_0x5ed566['error'][_0x63c0('0x14')]);return _0x1bfdda(_0x5ed566[_0x63c0('0x13')]['message']);}logger[_0x63c0('0x13')](_0x63c0('0xf'),_0x5929e9,_0x5ed566['error']['message']);return _0x349be4(_0x5ed566[_0x63c0('0x13')][_0x63c0('0x14')]);}else{logger[_0x63c0('0x15')](_0x63c0('0xf'),_0x5929e9,_0x63c0('0x10'));_0x349be4(_0x5ed566[_0x63c0('0x16')][_0x63c0('0x14')]);}})[_0x63c0('0x17')](function(_0x35112e){logger[_0x63c0('0x13')](_0x63c0('0xf'),_0x5929e9,_0x35112e);_0x1bfdda(_0x35112e);});});}exports['GetFreshdeskAccount']=function(_0x28986e){var _0x1b3080=this;return new Promise(function(_0x29166f,_0x3f0be2){return db[_0x63c0('0x18')][_0x63c0('0x19')]({'raw':_0x28986e['options']?_0x28986e[_0x63c0('0x1a')][_0x63c0('0x1b')]===undefined?!![]:![]:!![],'where':_0x28986e[_0x63c0('0x1a')]?_0x28986e[_0x63c0('0x1a')][_0x63c0('0x1c')]||null:null,'attributes':_0x28986e[_0x63c0('0x1a')]?_0x28986e['options'][_0x63c0('0x1d')]||null:null,'limit':_0x28986e[_0x63c0('0x1a')]?_0x28986e[_0x63c0('0x1a')]['limit']||null:null,'include':_0x28986e[_0x63c0('0x1a')]?_0x28986e[_0x63c0('0x1a')][_0x63c0('0x1e')]?_['map'](_0x28986e[_0x63c0('0x1a')][_0x63c0('0x1e')],function(_0x394934){return{'model':db[_0x394934[_0x63c0('0x1f')]],'as':_0x394934['as'],'attributes':_0x394934[_0x63c0('0x1d')],'include':_0x394934['include']?_[_0x63c0('0x20')](_0x394934[_0x63c0('0x1e')],function(_0x5cd87a){return{'model':db[_0x5cd87a[_0x63c0('0x1f')]],'as':_0x5cd87a['as'],'attributes':_0x5cd87a[_0x63c0('0x1d')],'include':_0x5cd87a[_0x63c0('0x1e')]?_[_0x63c0('0x20')](_0x5cd87a[_0x63c0('0x1e')],function(_0x5dcc26){return{'model':db[_0x5dcc26['model']],'as':_0x5dcc26['as'],'attributes':_0x5dcc26[_0x63c0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5582ad){logger[_0x63c0('0x15')]('GetFreshdeskAccount',_0x28986e);logger[_0x63c0('0x11')](_0x63c0('0x21'),_0x28986e,JSON['stringify'](_0x5582ad));_0x29166f(_0x5582ad);})[_0x63c0('0x17')](function(_0x4391cd){logger[_0x63c0('0x13')]('GetFreshdeskAccount',_0x4391cd['message'],_0x28986e);_0x3f0be2(_0x1b3080[_0x63c0('0x13')](0x1f4,_0x4391cd[_0x63c0('0x14')]));});});};exports[_0x63c0('0x22')]=function(_0x53bbce){var _0x268bd9=this;return new Promise(function(_0x9c0f13,_0x624b8f){return db['FreshdeskAccount'][_0x63c0('0x23')]({'raw':_0x53bbce[_0x63c0('0x1a')]?_0x53bbce[_0x63c0('0x1a')][_0x63c0('0x1b')]===undefined?!![]:![]:!![],'where':_0x53bbce['options']?_0x53bbce[_0x63c0('0x1a')][_0x63c0('0x1c')]||null:null,'attributes':_0x53bbce[_0x63c0('0x1a')]?_0x53bbce[_0x63c0('0x1a')][_0x63c0('0x1d')]||null:null,'include':_0x53bbce[_0x63c0('0x1a')]?_0x53bbce['options']['include']?_['map'](_0x53bbce[_0x63c0('0x1a')][_0x63c0('0x1e')],function(_0x59c7fa){return{'model':db[_0x59c7fa['model']],'as':_0x59c7fa['as'],'attributes':_0x59c7fa[_0x63c0('0x1d')],'include':_0x59c7fa['include']?_[_0x63c0('0x20')](_0x59c7fa['include'],function(_0x9f4720){return{'model':db[_0x9f4720[_0x63c0('0x1f')]],'as':_0x9f4720['as'],'attributes':_0x9f4720[_0x63c0('0x1d')],'include':_0x9f4720['include']?_[_0x63c0('0x20')](_0x9f4720[_0x63c0('0x1e')],function(_0x3599d9){return{'model':db[_0x3599d9[_0x63c0('0x1f')]],'as':_0x3599d9['as'],'attributes':_0x3599d9['attributes']};}):[]};}):[]};}):[]:[]})[_0x63c0('0xe')](function(_0x4553b4){logger[_0x63c0('0x15')](_0x63c0('0x22'),_0x53bbce);logger[_0x63c0('0x11')](_0x63c0('0x22'),_0x53bbce,JSON[_0x63c0('0x24')](_0x4553b4));_0x9c0f13(_0x4553b4);})['catch'](function(_0x1c1f72){logger[_0x63c0('0x13')](_0x63c0('0x22'),_0x1c1f72['message'],_0x53bbce);_0x624b8f(_0x268bd9[_0x63c0('0x13')](0x1f4,_0x1c1f72['message']));});});}; \ No newline at end of file +var _0x487e=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','message','FreshdeskAccount,\x20%s,\x20%s','info','result','GetFreshdeskAccount','FreshdeskAccount','options','where','map','include','model','attributes','catch','ShowFreshdeskAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x281ecd,_0x1c713a){var _0xbb4382=function(_0x512fa2){while(--_0x512fa2){_0x281ecd['push'](_0x281ecd['shift']());}};_0xbb4382(++_0x1c713a);}(_0x487e,0x1bb));var _0xe487=function(_0x1db421,_0xc6e695){_0x1db421=_0x1db421-0x0;var _0x233741=_0x487e[_0x1db421];return _0x233741;};'use strict';var _=require(_0xe487('0x0'));var util=require('util');var moment=require(_0xe487('0x1'));var BPromise=require(_0xe487('0x2'));var rs=require(_0xe487('0x3'));var fs=require('fs');var Redis=require(_0xe487('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe487('0x5'));var logger=require('../../config/logger')(_0xe487('0x6'));var config=require(_0xe487('0x7'));var jayson=require(_0xe487('0x8'));var client=jayson['client'][_0xe487('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ba149,_0x11f1bf,_0x508b6d){return new BPromise(function(_0x41a10c,_0x3b61fc){return client[_0xe487('0xa')](_0x3ba149,_0x508b6d)[_0xe487('0xb')](function(_0x59c10a){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x11f1bf,_0xe487('0xc'));logger[_0xe487('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x11f1bf,_0xe487('0xc'),JSON[_0xe487('0xe')](_0x59c10a));if(_0x59c10a[_0xe487('0xf')]){if(_0x59c10a[_0xe487('0xf')]['code']===0x1f4){logger[_0xe487('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x11f1bf,_0x59c10a[_0xe487('0xf')]['message']);return _0x3b61fc(_0x59c10a['error'][_0xe487('0x10')]);}logger[_0xe487('0xf')](_0xe487('0x11'),_0x11f1bf,_0x59c10a[_0xe487('0xf')]['message']);return _0x41a10c(_0x59c10a[_0xe487('0xf')]['message']);}else{logger[_0xe487('0x12')](_0xe487('0x11'),_0x11f1bf,_0xe487('0xc'));_0x41a10c(_0x59c10a[_0xe487('0x13')][_0xe487('0x10')]);}})['catch'](function(_0x5755af){logger[_0xe487('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x11f1bf,_0x5755af);_0x3b61fc(_0x5755af);});});}exports[_0xe487('0x14')]=function(_0x518d5e){var _0x392f3e=this;return new Promise(function(_0x140cba,_0x50f141){return db[_0xe487('0x15')]['findAll']({'raw':_0x518d5e[_0xe487('0x16')]?_0x518d5e[_0xe487('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x518d5e[_0xe487('0x16')]?_0x518d5e['options'][_0xe487('0x17')]||null:null,'attributes':_0x518d5e[_0xe487('0x16')]?_0x518d5e[_0xe487('0x16')]['attributes']||null:null,'limit':_0x518d5e['options']?_0x518d5e['options']['limit']||null:null,'include':_0x518d5e[_0xe487('0x16')]?_0x518d5e[_0xe487('0x16')]['include']?_[_0xe487('0x18')](_0x518d5e['options'][_0xe487('0x19')],function(_0x458fdc){return{'model':db[_0x458fdc[_0xe487('0x1a')]],'as':_0x458fdc['as'],'attributes':_0x458fdc['attributes'],'include':_0x458fdc[_0xe487('0x19')]?_[_0xe487('0x18')](_0x458fdc[_0xe487('0x19')],function(_0x3a151d){return{'model':db[_0x3a151d[_0xe487('0x1a')]],'as':_0x3a151d['as'],'attributes':_0x3a151d[_0xe487('0x1b')],'include':_0x3a151d[_0xe487('0x19')]?_[_0xe487('0x18')](_0x3a151d[_0xe487('0x19')],function(_0x35fef6){return{'model':db[_0x35fef6[_0xe487('0x1a')]],'as':_0x35fef6['as'],'attributes':_0x35fef6[_0xe487('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe487('0xb')](function(_0x38ef3b){logger[_0xe487('0x12')](_0xe487('0x14'),_0x518d5e);logger[_0xe487('0xd')]('GetFreshdeskAccount',_0x518d5e,JSON[_0xe487('0xe')](_0x38ef3b));_0x140cba(_0x38ef3b);})[_0xe487('0x1c')](function(_0x376924){logger['error'](_0xe487('0x14'),_0x376924[_0xe487('0x10')],_0x518d5e);_0x50f141(_0x392f3e[_0xe487('0xf')](0x1f4,_0x376924['message']));});});};exports[_0xe487('0x1d')]=function(_0x5ae8db){var _0x3c37ae=this;return new Promise(function(_0x51a08e,_0x477af0){return db['FreshdeskAccount'][_0xe487('0x1e')]({'raw':_0x5ae8db['options']?_0x5ae8db[_0xe487('0x16')][_0xe487('0x1f')]===undefined?!![]:![]:!![],'where':_0x5ae8db[_0xe487('0x16')]?_0x5ae8db[_0xe487('0x16')][_0xe487('0x17')]||null:null,'attributes':_0x5ae8db[_0xe487('0x16')]?_0x5ae8db[_0xe487('0x16')][_0xe487('0x1b')]||null:null,'include':_0x5ae8db[_0xe487('0x16')]?_0x5ae8db['options']['include']?_[_0xe487('0x18')](_0x5ae8db[_0xe487('0x16')][_0xe487('0x19')],function(_0x11ff33){return{'model':db[_0x11ff33['model']],'as':_0x11ff33['as'],'attributes':_0x11ff33[_0xe487('0x1b')],'include':_0x11ff33[_0xe487('0x19')]?_['map'](_0x11ff33[_0xe487('0x19')],function(_0x154d06){return{'model':db[_0x154d06[_0xe487('0x1a')]],'as':_0x154d06['as'],'attributes':_0x154d06[_0xe487('0x1b')],'include':_0x154d06[_0xe487('0x19')]?_[_0xe487('0x18')](_0x154d06[_0xe487('0x19')],function(_0x228e4e){return{'model':db[_0x228e4e['model']],'as':_0x228e4e['as'],'attributes':_0x228e4e[_0xe487('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe487('0xb')](function(_0x1ca088){logger['info']('ShowFreshdeskAccount',_0x5ae8db);logger[_0xe487('0xd')](_0xe487('0x1d'),_0x5ae8db,JSON['stringify'](_0x1ca088));_0x51a08e(_0x1ca088);})[_0xe487('0x1c')](function(_0x495207){logger[_0xe487('0xf')](_0xe487('0x1d'),_0x495207['message'],_0x5ae8db);_0x477af0(_0x3c37ae[_0xe487('0xf')](0x1f4,_0x495207[_0xe487('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index e00d218..7435475 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 _0x7f64=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','util','path','connect-timeout','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7f64,0x1d6));var _0x47f6=function(_0x527361,_0x1d96b4){_0x527361=_0x527361-0x0;var _0x1fcb80=_0x7f64[_0x527361];return _0x1fcb80;};'use strict';var multer=require('multer');var util=require(_0x47f6('0x0'));var path=require(_0x47f6('0x1'));var timeout=require(_0x47f6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x47f6('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x47f6('0x4'));var controller=require(_0x47f6('0x5'));router[_0x47f6('0x6')]('/',auth[_0x47f6('0x7')](),controller['index']);router[_0x47f6('0x6')](_0x47f6('0x8'),auth[_0x47f6('0x7')](),controller[_0x47f6('0x9')]);router[_0x47f6('0x6')](_0x47f6('0xa'),auth[_0x47f6('0x7')](),controller['getFields']);router['get'](_0x47f6('0xb'),auth[_0x47f6('0x7')](),controller[_0x47f6('0xc')]);router[_0x47f6('0x6')](_0x47f6('0xd'),auth[_0x47f6('0x7')](),controller[_0x47f6('0xe')]);router[_0x47f6('0x6')](_0x47f6('0xf'),auth[_0x47f6('0x7')](),controller[_0x47f6('0x10')]);router[_0x47f6('0x11')]('/',auth[_0x47f6('0x7')](),controller[_0x47f6('0x12')]);router[_0x47f6('0x11')](_0x47f6('0xf'),auth[_0x47f6('0x7')](),controller[_0x47f6('0x13')]);router[_0x47f6('0x14')](_0x47f6('0x8'),auth['isAuthenticated'](),controller[_0x47f6('0x15')]);router[_0x47f6('0x16')](_0x47f6('0x8'),auth['isAuthenticated'](),controller[_0x47f6('0x17')]);module['exports']=router; \ No newline at end of file +var _0x2377=['get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller'];(function(_0x187bb2,_0x2f59bf){var _0x4af854=function(_0x1c91ce){while(--_0x1c91ce){_0x187bb2['push'](_0x187bb2['shift']());}};_0x4af854(++_0x2f59bf);}(_0x2377,0x156));var _0x7237=function(_0x154c40,_0x4ba7a4){_0x154c40=_0x154c40-0x0;var _0x301f9e=_0x2377[_0x154c40];return _0x301f9e;};'use strict';var multer=require(_0x7237('0x0'));var util=require(_0x7237('0x1'));var path=require(_0x7237('0x2'));var timeout=require(_0x7237('0x3'));var express=require(_0x7237('0x4'));var router=express[_0x7237('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7237('0x6'));var interaction=require(_0x7237('0x7'));var config=require('../../config/environment');var controller=require(_0x7237('0x8'));router[_0x7237('0x9')]('/',auth[_0x7237('0xa')](),controller[_0x7237('0xb')]);router[_0x7237('0x9')](_0x7237('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7237('0x9')](_0x7237('0xd'),auth[_0x7237('0xa')](),controller[_0x7237('0xe')]);router[_0x7237('0x9')](_0x7237('0xf'),auth[_0x7237('0xa')](),controller[_0x7237('0x10')]);router[_0x7237('0x9')](_0x7237('0x11'),auth['isAuthenticated'](),controller[_0x7237('0x12')]);router[_0x7237('0x9')](_0x7237('0x13'),auth[_0x7237('0xa')](),controller[_0x7237('0x14')]);router['post']('/',auth[_0x7237('0xa')](),controller['create']);router[_0x7237('0x15')](_0x7237('0x13'),auth[_0x7237('0xa')](),controller[_0x7237('0x16')]);router['put'](_0x7237('0xc'),auth[_0x7237('0xa')](),controller[_0x7237('0x17')]);router[_0x7237('0x18')](_0x7237('0xc'),auth[_0x7237('0xa')](),controller[_0x7237('0x19')]);module[_0x7237('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 9974cca..4739dde 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 _0x39df=['STRING'];(function(_0x38c477,_0x126732){var _0x129e65=function(_0x5893f3){while(--_0x5893f3){_0x38c477['push'](_0x38c477['shift']());}};_0x129e65(++_0x126732);}(_0x39df,0x77));var _0xf39d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x39df[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf39d('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfcff=['sequelize','STRING'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0xfcff,0x140));var _0xffcf=function(_0x5aa31d,_0x262152){_0x5aa31d=_0x5aa31d-0x0;var _0x5e07ae=_0xfcff[_0x5aa31d];return _0x5e07ae;};'use strict';var Sequelize=require(_0xffcf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xffcf('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 7400cf7..09635fb 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 _0x53ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getFields','FreshdeskField','hasOwnProperty','getSubjects','findOne','getDescriptions','nolimit','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4f3dee,_0x46bb90){var _0x291aad=function(_0x3ca8f5){while(--_0x3ca8f5){_0x4f3dee['push'](_0x4f3dee['shift']());}};_0x291aad(++_0x46bb90);}(_0x53ca,0x147));var _0xa53c=function(_0x27bf12,_0x4a4bdd){_0x27bf12=_0x27bf12-0x0;var _0x105dc2=_0x53ca[_0x27bf12];return _0x105dc2;};'use strict';var emlformat=require(_0xa53c('0x0'));var rimraf=require(_0xa53c('0x1'));var zipdir=require(_0xa53c('0x2'));var jsonpatch=require(_0xa53c('0x3'));var rp=require(_0xa53c('0x4'));var moment=require(_0xa53c('0x5'));var BPromise=require(_0xa53c('0x6'));var Mustache=require(_0xa53c('0x7'));var util=require('util');var path=require('path');var sox=require(_0xa53c('0x8'));var csv=require(_0xa53c('0x9'));var ejs=require(_0xa53c('0xa'));var fs=require('fs');var fs_extra=require(_0xa53c('0xb'));var _=require(_0xa53c('0xc'));var squel=require(_0xa53c('0xd'));var crypto=require(_0xa53c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa53c('0x9'));var querystring=require('querystring');var Papa=require(_0xa53c('0xf'));var Redis=require(_0xa53c('0x10'));var authService=require(_0xa53c('0x11'));var qs=require(_0xa53c('0x12'));var as=require(_0xa53c('0x13'));var hardwareService=require(_0xa53c('0x14'));var logger=require(_0xa53c('0x15'))(_0xa53c('0x16'));var utils=require(_0xa53c('0x17'));var config=require(_0xa53c('0x18'));var licenseUtil=require(_0xa53c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2986b4,_0x3f4e7a){_0x3f4e7a=_0x3f4e7a||0xcc;return function(_0x4013cd){if(_0x4013cd){return _0x2986b4[_0xa53c('0x1a')](_0x3f4e7a);}return _0x2986b4[_0xa53c('0x1b')](_0x3f4e7a)[_0xa53c('0x1c')]();};}function respondWithResult(_0x2d9a8b,_0x7638){_0x7638=_0x7638||0xc8;return function(_0x49e166){if(_0x49e166){return _0x2d9a8b[_0xa53c('0x1b')](_0x7638)[_0xa53c('0x1d')](_0x49e166);}};}function respondWithFilteredResult(_0x211cf7,_0x2aa3eb){return function(_0x1a7e4a){if(_0x1a7e4a){var _0x20a9c9=typeof _0x2aa3eb[_0xa53c('0x1e')]===_0xa53c('0x1f')&&typeof _0x2aa3eb[_0xa53c('0x20')]===_0xa53c('0x1f');var _0x5c9f8a=_0x1a7e4a[_0xa53c('0x21')];var _0x3c3c0b=_0x20a9c9?0x0:_0x2aa3eb[_0xa53c('0x1e')];var _0x4d388b=_0x20a9c9?_0x1a7e4a[_0xa53c('0x21')]:_0x2aa3eb[_0xa53c('0x1e')]+_0x2aa3eb[_0xa53c('0x20')];var _0x169349;if(_0x4d388b>=_0x5c9f8a){_0x4d388b=_0x5c9f8a;_0x169349=0xc8;}else{_0x169349=0xce;}_0x211cf7[_0xa53c('0x1b')](_0x169349);return _0x211cf7[_0xa53c('0x22')](_0xa53c('0x23'),_0x3c3c0b+'-'+_0x4d388b+'/'+_0x5c9f8a)[_0xa53c('0x1d')](_0x1a7e4a);}return null;};}function patchUpdates(_0x3f62ef){return function(_0x1312b2){try{jsonpatch[_0xa53c('0x24')](_0x1312b2,_0x3f62ef,!![]);}catch(_0x25ad69){return BPromise[_0xa53c('0x25')](_0x25ad69);}return _0x1312b2['save']();};}function saveUpdates(_0xa13a37,_0x20dbd1){return function(_0x26502e){if(_0x26502e){return _0x26502e[_0xa53c('0x26')](_0xa13a37)['then'](function(_0x41bd45){return _0x41bd45;});}return null;};}function removeEntity(_0x5cb1c8,_0x120f63){return function(_0x2139f2){if(_0x2139f2){return _0x2139f2[_0xa53c('0x27')]()[_0xa53c('0x28')](function(){_0x5cb1c8[_0xa53c('0x1b')](0xcc)[_0xa53c('0x1c')]();});}};}function handleEntityNotFound(_0x4eda47,_0x48d6e6){return function(_0x5a2fcf){if(!_0x5a2fcf){_0x4eda47[_0xa53c('0x1a')](0x194);}return _0x5a2fcf;};}function handleError(_0x52f500,_0x299a1e){_0x299a1e=_0x299a1e||0x1f4;return function(_0x12fc38){logger[_0xa53c('0x29')](_0x12fc38['stack']);if(_0x12fc38[_0xa53c('0x2a')]){delete _0x12fc38['name'];}_0x52f500[_0xa53c('0x1b')](_0x299a1e)[_0xa53c('0x2b')](_0x12fc38);};}exports['index']=function(_0x21a433,_0x69f89a){var _0x5a34ca={},_0x56af48={},_0x4788ab={'count':0x0,'rows':[]};var _0x29af2f=_[_0xa53c('0x2c')](db[_0xa53c('0x2d')][_0xa53c('0x2e')],function(_0x15272e){return{'name':_0x15272e[_0xa53c('0x2f')],'type':_0x15272e[_0xa53c('0x30')][_0xa53c('0x31')]};});_0x56af48[_0xa53c('0x32')]=_[_0xa53c('0x2c')](_0x29af2f,_0xa53c('0x2a'));_0x56af48[_0xa53c('0x33')]=_[_0xa53c('0x34')](_0x21a433[_0xa53c('0x33')]);_0x56af48[_0xa53c('0x35')]=_[_0xa53c('0x36')](_0x56af48[_0xa53c('0x32')],_0x56af48['query']);_0x5a34ca['attributes']=_[_0xa53c('0x36')](_0x56af48[_0xa53c('0x32')],qs[_0xa53c('0x37')](_0x21a433['query']['fields']));_0x5a34ca[_0xa53c('0x38')]=_0x5a34ca['attributes'][_0xa53c('0x39')]?_0x5a34ca[_0xa53c('0x38')]:_0x56af48[_0xa53c('0x32')];if(!_0x21a433[_0xa53c('0x33')]['hasOwnProperty']('nolimit')){_0x5a34ca[_0xa53c('0x20')]=qs['limit'](_0x21a433['query'][_0xa53c('0x20')]);_0x5a34ca[_0xa53c('0x1e')]=qs['offset'](_0x21a433[_0xa53c('0x33')][_0xa53c('0x1e')]);}_0x5a34ca[_0xa53c('0x3a')]=qs[_0xa53c('0x3b')](_0x21a433[_0xa53c('0x33')][_0xa53c('0x3b')]);_0x5a34ca[_0xa53c('0x3c')]=qs[_0xa53c('0x35')](_[_0xa53c('0x3d')](_0x21a433[_0xa53c('0x33')],_0x56af48[_0xa53c('0x35')]),_0x29af2f);if(_0x21a433[_0xa53c('0x33')][_0xa53c('0x3e')]){_0x5a34ca[_0xa53c('0x3c')]=_['merge'](_0x5a34ca[_0xa53c('0x3c')],{'$or':_[_0xa53c('0x2c')](_0x29af2f,function(_0x23b8e9){if(_0x23b8e9[_0xa53c('0x30')]!==_0xa53c('0x3f')){var _0x7f47ae={};_0x7f47ae[_0x23b8e9[_0xa53c('0x2a')]]={'$like':'%'+_0x21a433['query'][_0xa53c('0x3e')]+'%'};return _0x7f47ae;}})});}_0x5a34ca=_[_0xa53c('0x40')]({},_0x5a34ca,_0x21a433[_0xa53c('0x41')]);var _0x39ae0e={'where':_0x5a34ca[_0xa53c('0x3c')]};return db[_0xa53c('0x2d')]['count'](_0x39ae0e)[_0xa53c('0x28')](function(_0x53813c){_0x4788ab[_0xa53c('0x21')]=_0x53813c;if(_0x21a433[_0xa53c('0x33')]['includeAll']){_0x5a34ca[_0xa53c('0x42')]=[{'all':!![]}];}return db[_0xa53c('0x2d')][_0xa53c('0x43')](_0x5a34ca);})['then'](function(_0x23ca0b){_0x4788ab[_0xa53c('0x44')]=_0x23ca0b;return _0x4788ab;})[_0xa53c('0x28')](respondWithFilteredResult(_0x69f89a,_0x5a34ca))[_0xa53c('0x45')](handleError(_0x69f89a,null));};exports[_0xa53c('0x46')]=function(_0x22964f,_0x25c2cb){var _0x3b2be6={'raw':![],'where':{'id':_0x22964f[_0xa53c('0x47')]['id']}},_0x16df23={};_0x16df23['model']=_[_0xa53c('0x34')](db[_0xa53c('0x2d')][_0xa53c('0x2e')]);_0x16df23[_0xa53c('0x33')]=_[_0xa53c('0x34')](_0x22964f[_0xa53c('0x33')]);_0x16df23[_0xa53c('0x35')]=_['intersection'](_0x16df23['model'],_0x16df23['query']);_0x3b2be6['attributes']=_[_0xa53c('0x36')](_0x16df23['model'],qs[_0xa53c('0x37')](_0x22964f['query'][_0xa53c('0x37')]));_0x3b2be6[_0xa53c('0x38')]=_0x3b2be6[_0xa53c('0x38')][_0xa53c('0x39')]?_0x3b2be6[_0xa53c('0x38')]:_0x16df23[_0xa53c('0x32')];if(_0x22964f['query'][_0xa53c('0x48')]){_0x3b2be6['include']=[{'all':!![]}];}_0x3b2be6=_[_0xa53c('0x40')]({},_0x3b2be6,_0x22964f[_0xa53c('0x41')]);return db['FreshdeskConfiguration'][_0xa53c('0x49')](_0x3b2be6)['then'](handleEntityNotFound(_0x25c2cb,null))[_0xa53c('0x28')](respondWithResult(_0x25c2cb,null))[_0xa53c('0x45')](handleError(_0x25c2cb,null));};exports[_0xa53c('0x4a')]=function(_0x598a36,_0x2de786){return db[_0xa53c('0x2d')][_0xa53c('0x4a')](_0x598a36[_0xa53c('0x4b')],{})[_0xa53c('0x28')](respondWithResult(_0x2de786,0xc9))[_0xa53c('0x45')](handleError(_0x2de786,null));};exports['update']=function(_0x2464e6,_0x2f5b40){if(_0x2464e6[_0xa53c('0x4b')]['id']){delete _0x2464e6['body']['id'];}return db[_0xa53c('0x2d')][_0xa53c('0x49')]({'where':{'id':_0x2464e6[_0xa53c('0x47')]['id']}})[_0xa53c('0x28')](handleEntityNotFound(_0x2f5b40,null))[_0xa53c('0x28')](saveUpdates(_0x2464e6['body'],null))['then'](respondWithResult(_0x2f5b40,null))[_0xa53c('0x45')](handleError(_0x2f5b40,null));};exports['destroy']=function(_0x10d4a4,_0x2f8ae3){return db['FreshdeskConfiguration'][_0xa53c('0x49')]({'where':{'id':_0x10d4a4[_0xa53c('0x47')]['id']}})[_0xa53c('0x28')](handleEntityNotFound(_0x2f8ae3,null))['then'](removeEntity(_0x2f8ae3,null))['catch'](handleError(_0x2f8ae3,null));};exports[_0xa53c('0x4c')]=function(_0x2ced11,_0x4d5387,_0x392d5f){var _0x5d8274={};var _0x56b24c={};var _0x58dcdc;var _0x57aa7a;return db[_0xa53c('0x2d')]['findOne']({'where':{'id':_0x2ced11[_0xa53c('0x47')]['id']}})[_0xa53c('0x28')](handleEntityNotFound(_0x4d5387,null))[_0xa53c('0x28')](function(_0x4c631c){if(_0x4c631c){_0x58dcdc=_0x4c631c;_0x56b24c[_0xa53c('0x32')]=_[_0xa53c('0x34')](db[_0xa53c('0x4d')]['rawAttributes']);_0x56b24c[_0xa53c('0x33')]=_[_0xa53c('0x34')](_0x2ced11[_0xa53c('0x33')]);_0x56b24c[_0xa53c('0x35')]=_[_0xa53c('0x36')](_0x56b24c['model'],_0x56b24c[_0xa53c('0x33')]);_0x5d8274['attributes']=_[_0xa53c('0x36')](_0x56b24c[_0xa53c('0x32')],qs[_0xa53c('0x37')](_0x2ced11[_0xa53c('0x33')]['fields']));_0x5d8274[_0xa53c('0x38')]=_0x5d8274['attributes'][_0xa53c('0x39')]?_0x5d8274[_0xa53c('0x38')]:_0x56b24c[_0xa53c('0x32')];_0x5d8274[_0xa53c('0x3a')]=qs['sort'](_0x2ced11[_0xa53c('0x33')][_0xa53c('0x3b')]);_0x5d8274[_0xa53c('0x3c')]=qs['filters'](_['pick'](_0x2ced11[_0xa53c('0x33')],_0x56b24c[_0xa53c('0x35')]));if(_0x2ced11[_0xa53c('0x33')][_0xa53c('0x3e')]){_0x5d8274[_0xa53c('0x3c')]=_['merge'](_0x5d8274[_0xa53c('0x3c')],{'$or':_[_0xa53c('0x2c')](_0x5d8274['attributes'],function(_0x135a4e){var _0x446214={};_0x446214[_0x135a4e]={'$like':'%'+_0x2ced11[_0xa53c('0x33')][_0xa53c('0x3e')]+'%'};return _0x446214;})});}_0x5d8274=_[_0xa53c('0x40')]({},_0x5d8274,_0x2ced11[_0xa53c('0x41')]);return _0x58dcdc[_0xa53c('0x4c')](_0x5d8274);}})['then'](function(_0x1ab4f0){if(_0x1ab4f0){_0x57aa7a=_0x1ab4f0[_0xa53c('0x39')];if(!_0x2ced11[_0xa53c('0x33')][_0xa53c('0x4e')]('nolimit')){_0x5d8274[_0xa53c('0x20')]=qs['limit'](_0x2ced11[_0xa53c('0x33')][_0xa53c('0x20')]);_0x5d8274[_0xa53c('0x1e')]=qs[_0xa53c('0x1e')](_0x2ced11['query'][_0xa53c('0x1e')]);}return _0x58dcdc[_0xa53c('0x4c')](_0x5d8274);}})[_0xa53c('0x28')](function(_0x6f5826){if(_0x6f5826){return _0x6f5826?{'count':_0x57aa7a,'rows':_0x6f5826}:null;}})[_0xa53c('0x28')](respondWithResult(_0x4d5387,null))['catch'](handleError(_0x4d5387,null));};exports[_0xa53c('0x4f')]=function(_0x1fbb89,_0x198a63,_0x5b519a){var _0x1a74b7={};var _0xdd0a56={};var _0x517190;var _0x520f0f;return db[_0xa53c('0x2d')][_0xa53c('0x50')]({'where':{'id':_0x1fbb89[_0xa53c('0x47')]['id']}})[_0xa53c('0x28')](handleEntityNotFound(_0x198a63,null))['then'](function(_0x3bd624){if(_0x3bd624){_0x517190=_0x3bd624;_0xdd0a56[_0xa53c('0x32')]=_[_0xa53c('0x34')](db['FreshdeskField'][_0xa53c('0x2e')]);_0xdd0a56[_0xa53c('0x33')]=_[_0xa53c('0x34')](_0x1fbb89[_0xa53c('0x33')]);_0xdd0a56[_0xa53c('0x35')]=_[_0xa53c('0x36')](_0xdd0a56[_0xa53c('0x32')],_0xdd0a56[_0xa53c('0x33')]);_0x1a74b7[_0xa53c('0x38')]=_['intersection'](_0xdd0a56['model'],qs['fields'](_0x1fbb89[_0xa53c('0x33')]['fields']));_0x1a74b7[_0xa53c('0x38')]=_0x1a74b7[_0xa53c('0x38')]['length']?_0x1a74b7[_0xa53c('0x38')]:_0xdd0a56[_0xa53c('0x32')];_0x1a74b7['order']=qs[_0xa53c('0x3b')](_0x1fbb89['query'][_0xa53c('0x3b')]);_0x1a74b7[_0xa53c('0x3c')]=qs['filters'](_['pick'](_0x1fbb89[_0xa53c('0x33')],_0xdd0a56['filters']));if(_0x1fbb89[_0xa53c('0x33')][_0xa53c('0x3e')]){_0x1a74b7[_0xa53c('0x3c')]=_[_0xa53c('0x40')](_0x1a74b7[_0xa53c('0x3c')],{'$or':_['map'](_0x1a74b7[_0xa53c('0x38')],function(_0x9365a4){var _0x54c3d2={};_0x54c3d2[_0x9365a4]={'$like':'%'+_0x1fbb89[_0xa53c('0x33')][_0xa53c('0x3e')]+'%'};return _0x54c3d2;})});}_0x1a74b7=_[_0xa53c('0x40')]({},_0x1a74b7,_0x1fbb89[_0xa53c('0x41')]);return _0x517190['getSubjects'](_0x1a74b7);}})['then'](function(_0x2aa77b){if(_0x2aa77b){_0x520f0f=_0x2aa77b['length'];if(!_0x1fbb89['query'][_0xa53c('0x4e')]('nolimit')){_0x1a74b7[_0xa53c('0x20')]=qs[_0xa53c('0x20')](_0x1fbb89[_0xa53c('0x33')][_0xa53c('0x20')]);_0x1a74b7['offset']=qs['offset'](_0x1fbb89['query'][_0xa53c('0x1e')]);}return _0x517190[_0xa53c('0x4f')](_0x1a74b7);}})[_0xa53c('0x28')](function(_0x2154ba){if(_0x2154ba){return _0x2154ba?{'count':_0x520f0f,'rows':_0x2154ba}:null;}})['then'](respondWithResult(_0x198a63,null))[_0xa53c('0x45')](handleError(_0x198a63,null));};exports[_0xa53c('0x51')]=function(_0x4d9dc1,_0x48872c,_0x134b2d){var _0xe5f887={};var _0x1eee8e={};var _0x2a66f5;var _0x190ab4;return db[_0xa53c('0x2d')][_0xa53c('0x50')]({'where':{'id':_0x4d9dc1[_0xa53c('0x47')]['id']}})[_0xa53c('0x28')](handleEntityNotFound(_0x48872c,null))['then'](function(_0x561c5d){if(_0x561c5d){_0x2a66f5=_0x561c5d;_0x1eee8e['model']=_['keys'](db['FreshdeskField'][_0xa53c('0x2e')]);_0x1eee8e[_0xa53c('0x33')]=_[_0xa53c('0x34')](_0x4d9dc1['query']);_0x1eee8e[_0xa53c('0x35')]=_[_0xa53c('0x36')](_0x1eee8e['model'],_0x1eee8e[_0xa53c('0x33')]);_0xe5f887[_0xa53c('0x38')]=_[_0xa53c('0x36')](_0x1eee8e[_0xa53c('0x32')],qs[_0xa53c('0x37')](_0x4d9dc1['query'][_0xa53c('0x37')]));_0xe5f887[_0xa53c('0x38')]=_0xe5f887[_0xa53c('0x38')][_0xa53c('0x39')]?_0xe5f887[_0xa53c('0x38')]:_0x1eee8e['model'];_0xe5f887[_0xa53c('0x3a')]=qs[_0xa53c('0x3b')](_0x4d9dc1[_0xa53c('0x33')][_0xa53c('0x3b')]);_0xe5f887['where']=qs[_0xa53c('0x35')](_[_0xa53c('0x3d')](_0x4d9dc1[_0xa53c('0x33')],_0x1eee8e['filters']));if(_0x4d9dc1[_0xa53c('0x33')]['filter']){_0xe5f887[_0xa53c('0x3c')]=_[_0xa53c('0x40')](_0xe5f887[_0xa53c('0x3c')],{'$or':_['map'](_0xe5f887[_0xa53c('0x38')],function(_0xb024db){var _0x49e93e={};_0x49e93e[_0xb024db]={'$like':'%'+_0x4d9dc1['query'][_0xa53c('0x3e')]+'%'};return _0x49e93e;})});}_0xe5f887=_[_0xa53c('0x40')]({},_0xe5f887,_0x4d9dc1['options']);return _0x2a66f5['getDescriptions'](_0xe5f887);}})[_0xa53c('0x28')](function(_0x344c28){if(_0x344c28){_0x190ab4=_0x344c28[_0xa53c('0x39')];if(!_0x4d9dc1[_0xa53c('0x33')][_0xa53c('0x4e')](_0xa53c('0x52'))){_0xe5f887[_0xa53c('0x20')]=qs[_0xa53c('0x20')](_0x4d9dc1[_0xa53c('0x33')]['limit']);_0xe5f887[_0xa53c('0x1e')]=qs[_0xa53c('0x1e')](_0x4d9dc1[_0xa53c('0x33')][_0xa53c('0x1e')]);}return _0x2a66f5[_0xa53c('0x51')](_0xe5f887);}})[_0xa53c('0x28')](function(_0x4e01eb){if(_0x4e01eb){return _0x4e01eb?{'count':_0x190ab4,'rows':_0x4e01eb}:null;}})[_0xa53c('0x28')](respondWithResult(_0x48872c,null))[_0xa53c('0x45')](handleError(_0x48872c,null));};exports[_0xa53c('0x53')]=function(_0x1434e2,_0x39e585,_0x47f067){var _0x5f1274={};var _0x2bd04d={};var _0x2dc224;var _0x19f32d;return db['FreshdeskConfiguration'][_0xa53c('0x50')]({'where':{'id':_0x1434e2['params']['id']}})[_0xa53c('0x28')](handleEntityNotFound(_0x39e585,null))[_0xa53c('0x28')](function(_0x11eb48){if(_0x11eb48){_0x2dc224=_0x11eb48;_0x2bd04d[_0xa53c('0x32')]=_[_0xa53c('0x34')](db[_0xa53c('0x54')]['rawAttributes']);_0x2bd04d[_0xa53c('0x33')]=_[_0xa53c('0x34')](_0x1434e2[_0xa53c('0x33')]);_0x2bd04d[_0xa53c('0x35')]=_[_0xa53c('0x36')](_0x2bd04d[_0xa53c('0x32')],_0x2bd04d[_0xa53c('0x33')]);_0x5f1274['attributes']=_[_0xa53c('0x36')](_0x2bd04d[_0xa53c('0x32')],qs[_0xa53c('0x37')](_0x1434e2[_0xa53c('0x33')]['fields']));_0x5f1274['attributes']=_0x5f1274[_0xa53c('0x38')][_0xa53c('0x39')]?_0x5f1274[_0xa53c('0x38')]:_0x2bd04d[_0xa53c('0x32')];_0x5f1274['order']=qs[_0xa53c('0x3b')](_0x1434e2[_0xa53c('0x33')]['sort']);_0x5f1274[_0xa53c('0x3c')]=qs[_0xa53c('0x35')](_[_0xa53c('0x3d')](_0x1434e2[_0xa53c('0x33')],_0x2bd04d[_0xa53c('0x35')]));if(_0x1434e2['query'][_0xa53c('0x3e')]){_0x5f1274[_0xa53c('0x3c')]=_[_0xa53c('0x40')](_0x5f1274[_0xa53c('0x3c')],{'$or':_[_0xa53c('0x2c')](_0x5f1274[_0xa53c('0x38')],function(_0x5f61db){var _0x2aab7c={};_0x2aab7c[_0x5f61db]={'$like':'%'+_0x1434e2['query'][_0xa53c('0x3e')]+'%'};return _0x2aab7c;})});}_0x5f1274=_[_0xa53c('0x40')]({},_0x5f1274,_0x1434e2[_0xa53c('0x41')]);return _0x2dc224['getTags'](_0x5f1274);}})['then'](function(_0x38f134){if(_0x38f134){_0x19f32d=_0x38f134[_0xa53c('0x39')];if(!_0x1434e2[_0xa53c('0x33')]['hasOwnProperty'](_0xa53c('0x52'))){_0x5f1274['limit']=qs[_0xa53c('0x20')](_0x1434e2[_0xa53c('0x33')][_0xa53c('0x20')]);_0x5f1274['offset']=qs[_0xa53c('0x1e')](_0x1434e2[_0xa53c('0x33')][_0xa53c('0x1e')]);}return _0x2dc224['getTags'](_0x5f1274);}})['then'](function(_0x438a70){if(_0x438a70){return _0x438a70?{'count':_0x19f32d,'rows':_0x438a70}:null;}})[_0xa53c('0x28')](respondWithResult(_0x39e585,null))[_0xa53c('0x45')](handleError(_0x39e585,null));};exports[_0xa53c('0x55')]=function(_0x5060c0,_0xa01636,_0x3e96df){if(_0x5060c0[_0xa53c('0x4b')]['id']){delete _0x5060c0[_0xa53c('0x4b')]['id'];}return db[_0xa53c('0x2d')][_0xa53c('0x50')]({'where':{'id':_0x5060c0[_0xa53c('0x47')]['id']}})['then'](handleEntityNotFound(_0xa01636,null))[_0xa53c('0x28')](function(_0x37ac15){if(_0x37ac15){return _0x37ac15[_0xa53c('0x55')](_0x5060c0[_0xa53c('0x4b')][_0xa53c('0x56')]||[]);}return null;})[_0xa53c('0x28')](respondWithResult(_0xa01636,null))['catch'](handleError(_0xa01636,null));}; \ No newline at end of file +var _0x6da0=['update','then','error','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','FreshdeskConfiguration','includeAll','findAll','catch','show','params','rawAttributes','include','options','find','create','body','getFields','findOne','nolimit','getSubjects','getDescriptions','FreshdeskField','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save'];(function(_0x40a850,_0xf1be0f){var _0x542a3a=function(_0x736dfc){while(--_0x736dfc){_0x40a850['push'](_0x40a850['shift']());}};_0x542a3a(++_0xf1be0f);}(_0x6da0,0x81));var _0x06da=function(_0x58b15a,_0x50ad09){_0x58b15a=_0x58b15a-0x0;var _0xdba8f1=_0x6da0[_0x58b15a];return _0xdba8f1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x06da('0x0'));var jsonpatch=require(_0x06da('0x1'));var rp=require(_0x06da('0x2'));var moment=require(_0x06da('0x3'));var BPromise=require(_0x06da('0x4'));var Mustache=require('mustache');var util=require(_0x06da('0x5'));var path=require(_0x06da('0x6'));var sox=require('sox');var csv=require(_0x06da('0x7'));var ejs=require(_0x06da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x06da('0x9'));var crypto=require(_0x06da('0xa'));var jsforce=require(_0x06da('0xb'));var deskjs=require(_0x06da('0xc'));var toCsv=require(_0x06da('0x7'));var querystring=require('querystring');var Papa=require(_0x06da('0xd'));var Redis=require('ioredis');var authService=require(_0x06da('0xe'));var qs=require(_0x06da('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06da('0x10'));var logger=require(_0x06da('0x11'))(_0x06da('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x06da('0x13'));var db=require(_0x06da('0x14'))['db'];function respondWithStatusCode(_0x589a65,_0x3136d6){_0x3136d6=_0x3136d6||0xcc;return function(_0x622363){if(_0x622363){return _0x589a65[_0x06da('0x15')](_0x3136d6);}return _0x589a65[_0x06da('0x16')](_0x3136d6)[_0x06da('0x17')]();};}function respondWithResult(_0x4bcf39,_0x2a8353){_0x2a8353=_0x2a8353||0xc8;return function(_0x115478){if(_0x115478){return _0x4bcf39[_0x06da('0x16')](_0x2a8353)[_0x06da('0x18')](_0x115478);}};}function respondWithFilteredResult(_0x24ef9f,_0x3acacc){return function(_0x2fef6e){if(_0x2fef6e){var _0x393a69=typeof _0x3acacc['offset']===_0x06da('0x19')&&typeof _0x3acacc[_0x06da('0x1a')]===_0x06da('0x19');var _0x2b0d2c=_0x2fef6e['count'];var _0xa94571=_0x393a69?0x0:_0x3acacc['offset'];var _0x36cbca=_0x393a69?_0x2fef6e[_0x06da('0x1b')]:_0x3acacc[_0x06da('0x1c')]+_0x3acacc[_0x06da('0x1a')];var _0x44e1b5;if(_0x36cbca>=_0x2b0d2c){_0x36cbca=_0x2b0d2c;_0x44e1b5=0xc8;}else{_0x44e1b5=0xce;}_0x24ef9f[_0x06da('0x16')](_0x44e1b5);return _0x24ef9f['set'](_0x06da('0x1d'),_0xa94571+'-'+_0x36cbca+'/'+_0x2b0d2c)[_0x06da('0x18')](_0x2fef6e);}return null;};}function patchUpdates(_0x1edee1){return function(_0x383553){try{jsonpatch[_0x06da('0x1e')](_0x383553,_0x1edee1,!![]);}catch(_0x2e123c){return BPromise[_0x06da('0x1f')](_0x2e123c);}return _0x383553[_0x06da('0x20')]();};}function saveUpdates(_0x5837d0,_0x14a61a){return function(_0x234a36){if(_0x234a36){return _0x234a36[_0x06da('0x21')](_0x5837d0)[_0x06da('0x22')](function(_0xa8bf08){return _0xa8bf08;});}return null;};}function removeEntity(_0x5628fb,_0x292375){return function(_0x6bf98){if(_0x6bf98){return _0x6bf98['destroy']()[_0x06da('0x22')](function(){_0x5628fb[_0x06da('0x16')](0xcc)[_0x06da('0x17')]();});}};}function handleEntityNotFound(_0x24bbd8,_0xb8be73){return function(_0x4d5d60){if(!_0x4d5d60){_0x24bbd8[_0x06da('0x15')](0x194);}return _0x4d5d60;};}function handleError(_0x4d3c9e,_0x526a07){_0x526a07=_0x526a07||0x1f4;return function(_0x58ca11){logger[_0x06da('0x23')](_0x58ca11['stack']);if(_0x58ca11[_0x06da('0x24')]){delete _0x58ca11['name'];}_0x4d3c9e['status'](_0x526a07)[_0x06da('0x25')](_0x58ca11);};}exports[_0x06da('0x26')]=function(_0x56d28f,_0x3cbc9b){var _0x146793={},_0x17bf8e={},_0x53136d={'count':0x0,'rows':[]};var _0x2b9d43=_['map'](db['FreshdeskConfiguration']['rawAttributes'],function(_0x3dcb16){return{'name':_0x3dcb16[_0x06da('0x27')],'type':_0x3dcb16[_0x06da('0x28')][_0x06da('0x29')]};});_0x17bf8e[_0x06da('0x2a')]=_[_0x06da('0x2b')](_0x2b9d43,'name');_0x17bf8e['query']=_[_0x06da('0x2c')](_0x56d28f[_0x06da('0x2d')]);_0x17bf8e[_0x06da('0x2e')]=_[_0x06da('0x2f')](_0x17bf8e['model'],_0x17bf8e[_0x06da('0x2d')]);_0x146793['attributes']=_[_0x06da('0x2f')](_0x17bf8e['model'],qs[_0x06da('0x30')](_0x56d28f[_0x06da('0x2d')][_0x06da('0x30')]));_0x146793[_0x06da('0x31')]=_0x146793[_0x06da('0x31')][_0x06da('0x32')]?_0x146793[_0x06da('0x31')]:_0x17bf8e['model'];if(!_0x56d28f['query'][_0x06da('0x33')]('nolimit')){_0x146793[_0x06da('0x1a')]=qs[_0x06da('0x1a')](_0x56d28f[_0x06da('0x2d')][_0x06da('0x1a')]);_0x146793[_0x06da('0x1c')]=qs[_0x06da('0x1c')](_0x56d28f[_0x06da('0x2d')]['offset']);}_0x146793[_0x06da('0x34')]=qs['sort'](_0x56d28f[_0x06da('0x2d')][_0x06da('0x35')]);_0x146793[_0x06da('0x36')]=qs[_0x06da('0x2e')](_[_0x06da('0x37')](_0x56d28f['query'],_0x17bf8e[_0x06da('0x2e')]),_0x2b9d43);if(_0x56d28f[_0x06da('0x2d')][_0x06da('0x38')]){_0x146793[_0x06da('0x36')]=_[_0x06da('0x39')](_0x146793[_0x06da('0x36')],{'$or':_['map'](_0x2b9d43,function(_0x2b10df){if(_0x2b10df[_0x06da('0x28')]!==_0x06da('0x3a')){var _0x1d3f67={};_0x1d3f67[_0x2b10df['name']]={'$like':'%'+_0x56d28f[_0x06da('0x2d')][_0x06da('0x38')]+'%'};return _0x1d3f67;}})});}_0x146793=_[_0x06da('0x39')]({},_0x146793,_0x56d28f['options']);var _0x340dcb={'where':_0x146793[_0x06da('0x36')]};return db[_0x06da('0x3b')][_0x06da('0x1b')](_0x340dcb)['then'](function(_0x1dac59){_0x53136d['count']=_0x1dac59;if(_0x56d28f[_0x06da('0x2d')][_0x06da('0x3c')]){_0x146793['include']=[{'all':!![]}];}return db[_0x06da('0x3b')][_0x06da('0x3d')](_0x146793);})[_0x06da('0x22')](function(_0x2ab5bd){_0x53136d['rows']=_0x2ab5bd;return _0x53136d;})[_0x06da('0x22')](respondWithFilteredResult(_0x3cbc9b,_0x146793))[_0x06da('0x3e')](handleError(_0x3cbc9b,null));};exports[_0x06da('0x3f')]=function(_0x21cebd,_0x1aaed4){var _0x4e7356={'raw':![],'where':{'id':_0x21cebd[_0x06da('0x40')]['id']}},_0x3b22d2={};_0x3b22d2[_0x06da('0x2a')]=_[_0x06da('0x2c')](db['FreshdeskConfiguration'][_0x06da('0x41')]);_0x3b22d2[_0x06da('0x2d')]=_[_0x06da('0x2c')](_0x21cebd['query']);_0x3b22d2[_0x06da('0x2e')]=_[_0x06da('0x2f')](_0x3b22d2[_0x06da('0x2a')],_0x3b22d2['query']);_0x4e7356[_0x06da('0x31')]=_[_0x06da('0x2f')](_0x3b22d2[_0x06da('0x2a')],qs[_0x06da('0x30')](_0x21cebd[_0x06da('0x2d')]['fields']));_0x4e7356[_0x06da('0x31')]=_0x4e7356[_0x06da('0x31')]['length']?_0x4e7356[_0x06da('0x31')]:_0x3b22d2[_0x06da('0x2a')];if(_0x21cebd['query'][_0x06da('0x3c')]){_0x4e7356[_0x06da('0x42')]=[{'all':!![]}];}_0x4e7356=_[_0x06da('0x39')]({},_0x4e7356,_0x21cebd[_0x06da('0x43')]);return db[_0x06da('0x3b')][_0x06da('0x44')](_0x4e7356)['then'](handleEntityNotFound(_0x1aaed4,null))[_0x06da('0x22')](respondWithResult(_0x1aaed4,null))[_0x06da('0x3e')](handleError(_0x1aaed4,null));};exports[_0x06da('0x45')]=function(_0x5a60a3,_0x18b69f){return db[_0x06da('0x3b')][_0x06da('0x45')](_0x5a60a3[_0x06da('0x46')],{})[_0x06da('0x22')](respondWithResult(_0x18b69f,0xc9))[_0x06da('0x3e')](handleError(_0x18b69f,null));};exports['update']=function(_0x3610ef,_0x245f1){if(_0x3610ef[_0x06da('0x46')]['id']){delete _0x3610ef[_0x06da('0x46')]['id'];}return db[_0x06da('0x3b')][_0x06da('0x44')]({'where':{'id':_0x3610ef[_0x06da('0x40')]['id']}})[_0x06da('0x22')](handleEntityNotFound(_0x245f1,null))[_0x06da('0x22')](saveUpdates(_0x3610ef[_0x06da('0x46')],null))[_0x06da('0x22')](respondWithResult(_0x245f1,null))[_0x06da('0x3e')](handleError(_0x245f1,null));};exports['destroy']=function(_0x1aab21,_0x1764df){return db['FreshdeskConfiguration'][_0x06da('0x44')]({'where':{'id':_0x1aab21[_0x06da('0x40')]['id']}})[_0x06da('0x22')](handleEntityNotFound(_0x1764df,null))[_0x06da('0x22')](removeEntity(_0x1764df,null))[_0x06da('0x3e')](handleError(_0x1764df,null));};exports[_0x06da('0x47')]=function(_0x3d5cf5,_0x47bb9f,_0x296339){var _0x4c4b0e={};var _0x2e043c={};var _0x4868e1;var _0x8424b3;return db['FreshdeskConfiguration'][_0x06da('0x48')]({'where':{'id':_0x3d5cf5[_0x06da('0x40')]['id']}})[_0x06da('0x22')](handleEntityNotFound(_0x47bb9f,null))['then'](function(_0x478ec8){if(_0x478ec8){_0x4868e1=_0x478ec8;_0x2e043c[_0x06da('0x2a')]=_[_0x06da('0x2c')](db['FreshdeskField']['rawAttributes']);_0x2e043c['query']=_[_0x06da('0x2c')](_0x3d5cf5[_0x06da('0x2d')]);_0x2e043c['filters']=_['intersection'](_0x2e043c[_0x06da('0x2a')],_0x2e043c[_0x06da('0x2d')]);_0x4c4b0e[_0x06da('0x31')]=_[_0x06da('0x2f')](_0x2e043c[_0x06da('0x2a')],qs[_0x06da('0x30')](_0x3d5cf5[_0x06da('0x2d')][_0x06da('0x30')]));_0x4c4b0e[_0x06da('0x31')]=_0x4c4b0e[_0x06da('0x31')][_0x06da('0x32')]?_0x4c4b0e[_0x06da('0x31')]:_0x2e043c[_0x06da('0x2a')];_0x4c4b0e[_0x06da('0x34')]=qs[_0x06da('0x35')](_0x3d5cf5[_0x06da('0x2d')][_0x06da('0x35')]);_0x4c4b0e[_0x06da('0x36')]=qs['filters'](_[_0x06da('0x37')](_0x3d5cf5[_0x06da('0x2d')],_0x2e043c[_0x06da('0x2e')]));if(_0x3d5cf5['query'][_0x06da('0x38')]){_0x4c4b0e[_0x06da('0x36')]=_['merge'](_0x4c4b0e[_0x06da('0x36')],{'$or':_[_0x06da('0x2b')](_0x4c4b0e['attributes'],function(_0x42f511){var _0x25c602={};_0x25c602[_0x42f511]={'$like':'%'+_0x3d5cf5[_0x06da('0x2d')][_0x06da('0x38')]+'%'};return _0x25c602;})});}_0x4c4b0e=_[_0x06da('0x39')]({},_0x4c4b0e,_0x3d5cf5[_0x06da('0x43')]);return _0x4868e1['getFields'](_0x4c4b0e);}})['then'](function(_0x3198d5){if(_0x3198d5){_0x8424b3=_0x3198d5[_0x06da('0x32')];if(!_0x3d5cf5[_0x06da('0x2d')]['hasOwnProperty'](_0x06da('0x49'))){_0x4c4b0e[_0x06da('0x1a')]=qs[_0x06da('0x1a')](_0x3d5cf5[_0x06da('0x2d')]['limit']);_0x4c4b0e[_0x06da('0x1c')]=qs['offset'](_0x3d5cf5[_0x06da('0x2d')][_0x06da('0x1c')]);}return _0x4868e1[_0x06da('0x47')](_0x4c4b0e);}})[_0x06da('0x22')](function(_0x72c54d){if(_0x72c54d){return _0x72c54d?{'count':_0x8424b3,'rows':_0x72c54d}:null;}})[_0x06da('0x22')](respondWithResult(_0x47bb9f,null))[_0x06da('0x3e')](handleError(_0x47bb9f,null));};exports[_0x06da('0x4a')]=function(_0x1dfe9f,_0x2910aa,_0x483417){var _0x520acb={};var _0x2cac1e={};var _0x902d21;var _0x513c93;return db['FreshdeskConfiguration'][_0x06da('0x48')]({'where':{'id':_0x1dfe9f[_0x06da('0x40')]['id']}})[_0x06da('0x22')](handleEntityNotFound(_0x2910aa,null))[_0x06da('0x22')](function(_0x46b0c4){if(_0x46b0c4){_0x902d21=_0x46b0c4;_0x2cac1e[_0x06da('0x2a')]=_[_0x06da('0x2c')](db['FreshdeskField'][_0x06da('0x41')]);_0x2cac1e[_0x06da('0x2d')]=_[_0x06da('0x2c')](_0x1dfe9f[_0x06da('0x2d')]);_0x2cac1e[_0x06da('0x2e')]=_[_0x06da('0x2f')](_0x2cac1e[_0x06da('0x2a')],_0x2cac1e[_0x06da('0x2d')]);_0x520acb[_0x06da('0x31')]=_[_0x06da('0x2f')](_0x2cac1e[_0x06da('0x2a')],qs[_0x06da('0x30')](_0x1dfe9f[_0x06da('0x2d')][_0x06da('0x30')]));_0x520acb['attributes']=_0x520acb[_0x06da('0x31')][_0x06da('0x32')]?_0x520acb['attributes']:_0x2cac1e[_0x06da('0x2a')];_0x520acb['order']=qs['sort'](_0x1dfe9f[_0x06da('0x2d')]['sort']);_0x520acb[_0x06da('0x36')]=qs[_0x06da('0x2e')](_[_0x06da('0x37')](_0x1dfe9f[_0x06da('0x2d')],_0x2cac1e[_0x06da('0x2e')]));if(_0x1dfe9f[_0x06da('0x2d')][_0x06da('0x38')]){_0x520acb[_0x06da('0x36')]=_[_0x06da('0x39')](_0x520acb[_0x06da('0x36')],{'$or':_['map'](_0x520acb[_0x06da('0x31')],function(_0x24e9a8){var _0x1f51c8={};_0x1f51c8[_0x24e9a8]={'$like':'%'+_0x1dfe9f[_0x06da('0x2d')][_0x06da('0x38')]+'%'};return _0x1f51c8;})});}_0x520acb=_[_0x06da('0x39')]({},_0x520acb,_0x1dfe9f[_0x06da('0x43')]);return _0x902d21[_0x06da('0x4a')](_0x520acb);}})[_0x06da('0x22')](function(_0x1ec9fa){if(_0x1ec9fa){_0x513c93=_0x1ec9fa[_0x06da('0x32')];if(!_0x1dfe9f[_0x06da('0x2d')][_0x06da('0x33')](_0x06da('0x49'))){_0x520acb['limit']=qs[_0x06da('0x1a')](_0x1dfe9f[_0x06da('0x2d')][_0x06da('0x1a')]);_0x520acb['offset']=qs[_0x06da('0x1c')](_0x1dfe9f[_0x06da('0x2d')][_0x06da('0x1c')]);}return _0x902d21[_0x06da('0x4a')](_0x520acb);}})[_0x06da('0x22')](function(_0x5667db){if(_0x5667db){return _0x5667db?{'count':_0x513c93,'rows':_0x5667db}:null;}})[_0x06da('0x22')](respondWithResult(_0x2910aa,null))[_0x06da('0x3e')](handleError(_0x2910aa,null));};exports[_0x06da('0x4b')]=function(_0x515f55,_0x37503a,_0x3cb93c){var _0x19eb9c={};var _0x10976={};var _0x19a52b;var _0x2e4ebe;return db[_0x06da('0x3b')][_0x06da('0x48')]({'where':{'id':_0x515f55[_0x06da('0x40')]['id']}})[_0x06da('0x22')](handleEntityNotFound(_0x37503a,null))[_0x06da('0x22')](function(_0x15cf57){if(_0x15cf57){_0x19a52b=_0x15cf57;_0x10976[_0x06da('0x2a')]=_[_0x06da('0x2c')](db[_0x06da('0x4c')][_0x06da('0x41')]);_0x10976[_0x06da('0x2d')]=_[_0x06da('0x2c')](_0x515f55[_0x06da('0x2d')]);_0x10976[_0x06da('0x2e')]=_[_0x06da('0x2f')](_0x10976[_0x06da('0x2a')],_0x10976['query']);_0x19eb9c[_0x06da('0x31')]=_[_0x06da('0x2f')](_0x10976[_0x06da('0x2a')],qs['fields'](_0x515f55[_0x06da('0x2d')]['fields']));_0x19eb9c[_0x06da('0x31')]=_0x19eb9c['attributes']['length']?_0x19eb9c[_0x06da('0x31')]:_0x10976[_0x06da('0x2a')];_0x19eb9c[_0x06da('0x34')]=qs[_0x06da('0x35')](_0x515f55[_0x06da('0x2d')][_0x06da('0x35')]);_0x19eb9c['where']=qs[_0x06da('0x2e')](_[_0x06da('0x37')](_0x515f55[_0x06da('0x2d')],_0x10976[_0x06da('0x2e')]));if(_0x515f55[_0x06da('0x2d')]['filter']){_0x19eb9c[_0x06da('0x36')]=_[_0x06da('0x39')](_0x19eb9c[_0x06da('0x36')],{'$or':_[_0x06da('0x2b')](_0x19eb9c[_0x06da('0x31')],function(_0x405fa0){var _0x536dd6={};_0x536dd6[_0x405fa0]={'$like':'%'+_0x515f55[_0x06da('0x2d')][_0x06da('0x38')]+'%'};return _0x536dd6;})});}_0x19eb9c=_[_0x06da('0x39')]({},_0x19eb9c,_0x515f55['options']);return _0x19a52b[_0x06da('0x4b')](_0x19eb9c);}})[_0x06da('0x22')](function(_0x87e57d){if(_0x87e57d){_0x2e4ebe=_0x87e57d[_0x06da('0x32')];if(!_0x515f55[_0x06da('0x2d')][_0x06da('0x33')](_0x06da('0x49'))){_0x19eb9c[_0x06da('0x1a')]=qs[_0x06da('0x1a')](_0x515f55['query'][_0x06da('0x1a')]);_0x19eb9c[_0x06da('0x1c')]=qs[_0x06da('0x1c')](_0x515f55[_0x06da('0x2d')]['offset']);}return _0x19a52b[_0x06da('0x4b')](_0x19eb9c);}})['then'](function(_0x2ee484){if(_0x2ee484){return _0x2ee484?{'count':_0x2e4ebe,'rows':_0x2ee484}:null;}})[_0x06da('0x22')](respondWithResult(_0x37503a,null))[_0x06da('0x3e')](handleError(_0x37503a,null));};exports[_0x06da('0x4d')]=function(_0x3fd1bb,_0x2b4e89,_0x627933){var _0x2a873b={};var _0x198920={};var _0x2293aa;var _0x4be322;return db[_0x06da('0x3b')][_0x06da('0x48')]({'where':{'id':_0x3fd1bb['params']['id']}})[_0x06da('0x22')](handleEntityNotFound(_0x2b4e89,null))['then'](function(_0x3cbe47){if(_0x3cbe47){_0x2293aa=_0x3cbe47;_0x198920[_0x06da('0x2a')]=_[_0x06da('0x2c')](db[_0x06da('0x4e')][_0x06da('0x41')]);_0x198920['query']=_[_0x06da('0x2c')](_0x3fd1bb[_0x06da('0x2d')]);_0x198920[_0x06da('0x2e')]=_[_0x06da('0x2f')](_0x198920[_0x06da('0x2a')],_0x198920[_0x06da('0x2d')]);_0x2a873b[_0x06da('0x31')]=_['intersection'](_0x198920[_0x06da('0x2a')],qs['fields'](_0x3fd1bb[_0x06da('0x2d')][_0x06da('0x30')]));_0x2a873b[_0x06da('0x31')]=_0x2a873b[_0x06da('0x31')][_0x06da('0x32')]?_0x2a873b['attributes']:_0x198920[_0x06da('0x2a')];_0x2a873b[_0x06da('0x34')]=qs[_0x06da('0x35')](_0x3fd1bb[_0x06da('0x2d')][_0x06da('0x35')]);_0x2a873b[_0x06da('0x36')]=qs[_0x06da('0x2e')](_['pick'](_0x3fd1bb[_0x06da('0x2d')],_0x198920['filters']));if(_0x3fd1bb['query'][_0x06da('0x38')]){_0x2a873b[_0x06da('0x36')]=_['merge'](_0x2a873b[_0x06da('0x36')],{'$or':_[_0x06da('0x2b')](_0x2a873b[_0x06da('0x31')],function(_0x4cfa81){var _0xbc8a17={};_0xbc8a17[_0x4cfa81]={'$like':'%'+_0x3fd1bb[_0x06da('0x2d')][_0x06da('0x38')]+'%'};return _0xbc8a17;})});}_0x2a873b=_[_0x06da('0x39')]({},_0x2a873b,_0x3fd1bb[_0x06da('0x43')]);return _0x2293aa[_0x06da('0x4d')](_0x2a873b);}})[_0x06da('0x22')](function(_0x2e14e6){if(_0x2e14e6){_0x4be322=_0x2e14e6[_0x06da('0x32')];if(!_0x3fd1bb['query'][_0x06da('0x33')](_0x06da('0x49'))){_0x2a873b['limit']=qs[_0x06da('0x1a')](_0x3fd1bb['query'][_0x06da('0x1a')]);_0x2a873b[_0x06da('0x1c')]=qs[_0x06da('0x1c')](_0x3fd1bb[_0x06da('0x2d')]['offset']);}return _0x2293aa['getTags'](_0x2a873b);}})['then'](function(_0x3372b1){if(_0x3372b1){return _0x3372b1?{'count':_0x4be322,'rows':_0x3372b1}:null;}})[_0x06da('0x22')](respondWithResult(_0x2b4e89,null))['catch'](handleError(_0x2b4e89,null));};exports[_0x06da('0x4f')]=function(_0x4e3b8e,_0x34a9ff,_0xbbf137){if(_0x4e3b8e[_0x06da('0x46')]['id']){delete _0x4e3b8e['body']['id'];}return db[_0x06da('0x3b')][_0x06da('0x48')]({'where':{'id':_0x4e3b8e[_0x06da('0x40')]['id']}})[_0x06da('0x22')](handleEntityNotFound(_0x34a9ff,null))[_0x06da('0x22')](function(_0x443314){if(_0x443314){return _0x443314[_0x06da('0x4f')](_0x4e3b8e[_0x06da('0x46')][_0x06da('0x50')]||[]);}return null;})[_0x06da('0x22')](respondWithResult(_0x34a9ff,null))[_0x06da('0x3e')](handleError(_0x34a9ff,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index b159b35..6ad0f92 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 _0xeaaf=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment','request-promise','rimraf','exports','define'];(function(_0x3d504d,_0x221070){var _0x485412=function(_0x442c87){while(--_0x442c87){_0x3d504d['push'](_0x3d504d['shift']());}};_0x485412(++_0x221070);}(_0xeaaf,0x1ba));var _0xfeaa=function(_0x36227f,_0x2aa8d3){_0x36227f=_0x36227f-0x0;var _0x2b7945=_0xeaaf[_0x36227f];return _0x2b7945;};'use strict';var _=require(_0xfeaa('0x0'));var util=require(_0xfeaa('0x1'));var logger=require('../../config/logger')(_0xfeaa('0x2'));var moment=require(_0xfeaa('0x3'));var BPromise=require('bluebird');var rp=require(_0xfeaa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfeaa('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xfeaa('0x6')]=function(_0x332a67,_0x4f4875){return _0x332a67[_0xfeaa('0x7')](_0xfeaa('0x8'),attributes,{'tableName':_0xfeaa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2854=['api','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','int_freshdesk_configurations','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2854,0x7b));var _0x4285=function(_0x1c8dfa,_0x39953d){_0x1c8dfa=_0x1c8dfa-0x0;var _0x5a3b93=_0x2854[_0x1c8dfa];return _0x5a3b93;};'use strict';var _=require(_0x4285('0x0'));var util=require(_0x4285('0x1'));var logger=require(_0x4285('0x2'))(_0x4285('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4285('0x4'));var rimraf=require(_0x4285('0x5'));var config=require(_0x4285('0x6'));var attributes=require(_0x4285('0x7'));module['exports']=function(_0x4815ee,_0x3ecf41){return _0x4815ee['define']('FreshdeskConfiguration',attributes,{'tableName':_0x4285('0x8'),'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 1f7a1e3..063bac3 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 _0xc48c=['request\x20sent','debug','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','info'];(function(_0x2eca6f,_0x42fa0b){var _0x4427e5=function(_0x441aa8){while(--_0x441aa8){_0x2eca6f['push'](_0x2eca6f['shift']());}};_0x4427e5(++_0x42fa0b);}(_0xc48c,0x1ad));var _0xcc48=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc48c[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xcc48('0x0'));var util=require(_0xcc48('0x1'));var moment=require(_0xcc48('0x2'));var BPromise=require(_0xcc48('0x3'));var rs=require(_0xcc48('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc48('0x5'))['db'];var utils=require(_0xcc48('0x6'));var logger=require('../../config/logger')(_0xcc48('0x7'));var config=require(_0xcc48('0x8'));var jayson=require(_0xcc48('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x529812,_0x504377,_0x3715e1){return new BPromise(function(_0x43c8cd,_0x1cdb37){return client['request'](_0x529812,_0x3715e1)['then'](function(_0x4b81a2){logger[_0xcc48('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x504377,_0xcc48('0xb'));logger[_0xcc48('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x504377,'request\x20sent',JSON[_0xcc48('0xd')](_0x4b81a2));if(_0x4b81a2['error']){if(_0x4b81a2[_0xcc48('0xe')][_0xcc48('0xf')]===0x1f4){logger[_0xcc48('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x504377,_0x4b81a2['error'][_0xcc48('0x10')]);return _0x1cdb37(_0x4b81a2['error'][_0xcc48('0x10')]);}logger[_0xcc48('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x504377,_0x4b81a2[_0xcc48('0xe')][_0xcc48('0x10')]);return _0x43c8cd(_0x4b81a2[_0xcc48('0xe')][_0xcc48('0x10')]);}else{logger[_0xcc48('0xa')](_0xcc48('0x11'),_0x504377,_0xcc48('0xb'));_0x43c8cd(_0x4b81a2[_0xcc48('0x12')]['message']);}})[_0xcc48('0x13')](function(_0x1f3fb6){logger[_0xcc48('0xe')](_0xcc48('0x11'),_0x504377,_0x1f3fb6);_0x1cdb37(_0x1f3fb6);});});} \ No newline at end of file +var _0x13c1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13c1,0x9d));var _0x113c=function(_0x57189a,_0x4af7b9){_0x57189a=_0x57189a-0x0;var _0x5a649c=_0x13c1[_0x57189a];return _0x5a649c;};'use strict';var _=require(_0x113c('0x0'));var util=require(_0x113c('0x1'));var moment=require(_0x113c('0x2'));var BPromise=require(_0x113c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x113c('0x4'));var db=require(_0x113c('0x5'))['db'];var utils=require(_0x113c('0x6'));var logger=require(_0x113c('0x7'))('rpc');var config=require(_0x113c('0x8'));var jayson=require(_0x113c('0x9'));var client=jayson['client'][_0x113c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb7eac5,_0x31418c,_0x538384){return new BPromise(function(_0x43f4d8,_0x45fc00){return client['request'](_0xb7eac5,_0x538384)[_0x113c('0xb')](function(_0x3d5180){logger[_0x113c('0xc')](_0x113c('0xd'),_0x31418c,_0x113c('0xe'));logger[_0x113c('0xf')](_0x113c('0x10'),_0x31418c,'request\x20sent',JSON[_0x113c('0x11')](_0x3d5180));if(_0x3d5180[_0x113c('0x12')]){if(_0x3d5180[_0x113c('0x12')][_0x113c('0x13')]===0x1f4){logger[_0x113c('0x12')](_0x113c('0xd'),_0x31418c,_0x3d5180[_0x113c('0x12')][_0x113c('0x14')]);return _0x45fc00(_0x3d5180[_0x113c('0x12')][_0x113c('0x14')]);}logger[_0x113c('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x31418c,_0x3d5180[_0x113c('0x12')]['message']);return _0x43f4d8(_0x3d5180[_0x113c('0x12')][_0x113c('0x14')]);}else{logger[_0x113c('0xc')](_0x113c('0xd'),_0x31418c,_0x113c('0xe'));_0x43f4d8(_0x3d5180[_0x113c('0x15')]['message']);}})[_0x113c('0x16')](function(_0x5cbc11){logger['error'](_0x113c('0xd'),_0x31418c,_0x5cbc11);_0x45fc00(_0x5cbc11);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index abf71ee..f55dee3 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 _0x8bf8=['destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','index','isAuthenticated','post','create','put','/:id','update','delete'];(function(_0x3c762f,_0x3aef31){var _0x2c4547=function(_0xe0e5cb){while(--_0xe0e5cb){_0x3c762f['push'](_0x3c762f['shift']());}};_0x2c4547(++_0x3aef31);}(_0x8bf8,0x146));var _0x88bf=function(_0x19fd58,_0x5d2adf){_0x19fd58=_0x19fd58-0x0;var _0x55d734=_0x8bf8[_0x19fd58];return _0x55d734;};'use strict';var multer=require(_0x88bf('0x0'));var util=require(_0x88bf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x88bf('0x2'));var router=express['Router']();var fs_extra=require(_0x88bf('0x3'));var auth=require(_0x88bf('0x4'));var interaction=require(_0x88bf('0x5'));var config=require('../../config/environment');var controller=require(_0x88bf('0x6'));router[_0x88bf('0x7')]('/',auth['isAuthenticated'](),controller[_0x88bf('0x8')]);router[_0x88bf('0x7')]('/:id',auth[_0x88bf('0x9')](),controller['show']);router[_0x88bf('0xa')]('/',auth[_0x88bf('0x9')](),controller[_0x88bf('0xb')]);router[_0x88bf('0xc')](_0x88bf('0xd'),auth[_0x88bf('0x9')](),controller[_0x88bf('0xe')]);router[_0x88bf('0xf')]('/:id',auth[_0x88bf('0x9')](),controller[_0x88bf('0x10')]);module[_0x88bf('0x11')]=router; \ No newline at end of file +var _0x7a97=['/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x270dba,_0x1817d2){var _0x36b83b=function(_0x15a276){while(--_0x15a276){_0x270dba['push'](_0x270dba['shift']());}};_0x36b83b(++_0x1817d2);}(_0x7a97,0xa8));var _0x77a9=function(_0xa19fc3,_0x1a1c12){_0xa19fc3=_0xa19fc3-0x0;var _0x9664c7=_0x7a97[_0xa19fc3];return _0x9664c7;};'use strict';var multer=require(_0x77a9('0x0'));var util=require(_0x77a9('0x1'));var path=require(_0x77a9('0x2'));var timeout=require(_0x77a9('0x3'));var express=require('express');var router=express[_0x77a9('0x4')]();var fs_extra=require(_0x77a9('0x5'));var auth=require(_0x77a9('0x6'));var interaction=require(_0x77a9('0x7'));var config=require(_0x77a9('0x8'));var controller=require(_0x77a9('0x9'));router[_0x77a9('0xa')]('/',auth[_0x77a9('0xb')](),controller['index']);router[_0x77a9('0xa')](_0x77a9('0xc'),auth[_0x77a9('0xb')](),controller[_0x77a9('0xd')]);router[_0x77a9('0xe')]('/',auth[_0x77a9('0xb')](),controller[_0x77a9('0xf')]);router[_0x77a9('0x10')](_0x77a9('0xc'),auth[_0x77a9('0xb')](),controller[_0x77a9('0x11')]);router['delete'](_0x77a9('0xc'),auth[_0x77a9('0xb')](),controller[_0x77a9('0x12')]);module[_0x77a9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index f9616b0..3970e56 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 _0xc432=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc432,0xe4));var _0x2c43=function(_0x27e6fb,_0x57a3a0){_0x27e6fb=_0x27e6fb-0x0;var _0x212949=_0xc432[_0x27e6fb];return _0x212949;};'use strict';var Sequelize=require(_0x2c43('0x0'));module[_0x2c43('0x1')]={'type':{'type':Sequelize[_0x2c43('0x2')](_0x2c43('0x3'),_0x2c43('0x4'),'customVariable',_0x2c43('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2c43('0x6')]},'key':{'type':Sequelize[_0x2c43('0x6')]},'keyType':{'type':Sequelize[_0x2c43('0x2')](_0x2c43('0x3'),_0x2c43('0x4'),_0x2c43('0x7'))},'keyContent':{'type':Sequelize[_0x2c43('0x6')]},'idField':{'type':Sequelize[_0x2c43('0x6')]},'nameField':{'type':Sequelize[_0x2c43('0x6')]},'customField':{'type':Sequelize[_0x2c43('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2c43('0x6')]}}; \ No newline at end of file +var _0x488e=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0x488e,0x9a));var _0xe488=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x488e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe488('0x0'));module[_0xe488('0x1')]={'type':{'type':Sequelize[_0xe488('0x2')](_0xe488('0x3'),_0xe488('0x4'),_0xe488('0x5'),_0xe488('0x6'),'picklist'),'defaultValue':_0xe488('0x3')},'content':{'type':Sequelize[_0xe488('0x7')]},'key':{'type':Sequelize[_0xe488('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xe488('0x3'),_0xe488('0x4'),_0xe488('0x5'))},'keyContent':{'type':Sequelize[_0xe488('0x7')]},'idField':{'type':Sequelize[_0xe488('0x7')]},'nameField':{'type':Sequelize[_0xe488('0x7')]},'customField':{'type':Sequelize[_0xe488('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe488('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index cda3e6e..41e5a90 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 _0xcecc=['end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','options','count','FreshdeskField','findAll','rows','catch','rawAttributes','includeAll','include','find','create','body','params','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x42d082,_0x3ba3a1){var _0x5d463f=function(_0x1472f5){while(--_0x1472f5){_0x42d082['push'](_0x42d082['shift']());}};_0x5d463f(++_0x3ba3a1);}(_0xcecc,0x186));var _0xccec=function(_0x5136d2,_0x550aff){_0x5136d2=_0x5136d2-0x0;var _0x29099a=_0xcecc[_0x5136d2];return _0x29099a;};'use strict';var emlformat=require(_0xccec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xccec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xccec('0x2'));var BPromise=require(_0xccec('0x3'));var Mustache=require(_0xccec('0x4'));var util=require(_0xccec('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xccec('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xccec('0x7'));var _=require(_0xccec('0x8'));var squel=require(_0xccec('0x9'));var crypto=require('crypto');var jsforce=require(_0xccec('0xa'));var deskjs=require(_0xccec('0xb'));var toCsv=require('to-csv');var querystring=require(_0xccec('0xc'));var Papa=require(_0xccec('0xd'));var Redis=require(_0xccec('0xe'));var authService=require(_0xccec('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xccec('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccec('0x11'))(_0xccec('0x12'));var utils=require('../../config/utils');var config=require(_0xccec('0x13'));var licenseUtil=require(_0xccec('0x14'));var db=require(_0xccec('0x15'))['db'];function respondWithStatusCode(_0x5ad07a,_0x349054){_0x349054=_0x349054||0xcc;return function(_0x2ac888){if(_0x2ac888){return _0x5ad07a[_0xccec('0x16')](_0x349054);}return _0x5ad07a[_0xccec('0x17')](_0x349054)[_0xccec('0x18')]();};}function respondWithResult(_0x4b4c3d,_0x2882d9){_0x2882d9=_0x2882d9||0xc8;return function(_0x566a81){if(_0x566a81){return _0x4b4c3d['status'](_0x2882d9)['json'](_0x566a81);}};}function respondWithFilteredResult(_0x8ff6a6,_0x3482d4){return function(_0x18e7d0){if(_0x18e7d0){var _0x69a776=typeof _0x3482d4[_0xccec('0x19')]===_0xccec('0x1a')&&typeof _0x3482d4[_0xccec('0x1b')]===_0xccec('0x1a');var _0x199e52=_0x18e7d0['count'];var _0x518016=_0x69a776?0x0:_0x3482d4['offset'];var _0x970c66=_0x69a776?_0x18e7d0['count']:_0x3482d4[_0xccec('0x19')]+_0x3482d4[_0xccec('0x1b')];var _0x88741b;if(_0x970c66>=_0x199e52){_0x970c66=_0x199e52;_0x88741b=0xc8;}else{_0x88741b=0xce;}_0x8ff6a6['status'](_0x88741b);return _0x8ff6a6[_0xccec('0x1c')](_0xccec('0x1d'),_0x518016+'-'+_0x970c66+'/'+_0x199e52)[_0xccec('0x1e')](_0x18e7d0);}return null;};}function patchUpdates(_0x4a7f08){return function(_0x2fedff){try{jsonpatch[_0xccec('0x1f')](_0x2fedff,_0x4a7f08,!![]);}catch(_0x2163e7){return BPromise['reject'](_0x2163e7);}return _0x2fedff[_0xccec('0x20')]();};}function saveUpdates(_0x57c27c,_0x9065a3){return function(_0x4b2666){if(_0x4b2666){return _0x4b2666[_0xccec('0x21')](_0x57c27c)[_0xccec('0x22')](function(_0x312da0){return _0x312da0;});}return null;};}function removeEntity(_0x50794d,_0x3d83e1){return function(_0x6be7ac){if(_0x6be7ac){return _0x6be7ac[_0xccec('0x23')]()[_0xccec('0x22')](function(){_0x50794d[_0xccec('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44bc44,_0xb0b0da){return function(_0x2d8fa0){if(!_0x2d8fa0){_0x44bc44[_0xccec('0x16')](0x194);}return _0x2d8fa0;};}function handleError(_0x4c8dbe,_0x27b541){_0x27b541=_0x27b541||0x1f4;return function(_0x52ddd7){logger['error'](_0x52ddd7['stack']);if(_0x52ddd7[_0xccec('0x24')]){delete _0x52ddd7[_0xccec('0x24')];}_0x4c8dbe[_0xccec('0x17')](_0x27b541)[_0xccec('0x25')](_0x52ddd7);};}exports[_0xccec('0x26')]=function(_0x3e8557,_0x3ca9c7){var _0x59bb66={},_0x11085d={},_0x5ee7c1={'count':0x0,'rows':[]};var _0x23e324=_[_0xccec('0x27')](db['FreshdeskField']['rawAttributes'],function(_0x1e93e3){return{'name':_0x1e93e3[_0xccec('0x28')],'type':_0x1e93e3['type'][_0xccec('0x29')]};});_0x11085d[_0xccec('0x2a')]=_[_0xccec('0x27')](_0x23e324,_0xccec('0x24'));_0x11085d['query']=_[_0xccec('0x2b')](_0x3e8557[_0xccec('0x2c')]);_0x11085d[_0xccec('0x2d')]=_[_0xccec('0x2e')](_0x11085d[_0xccec('0x2a')],_0x11085d[_0xccec('0x2c')]);_0x59bb66[_0xccec('0x2f')]=_[_0xccec('0x2e')](_0x11085d['model'],qs[_0xccec('0x30')](_0x3e8557[_0xccec('0x2c')][_0xccec('0x30')]));_0x59bb66['attributes']=_0x59bb66['attributes'][_0xccec('0x31')]?_0x59bb66[_0xccec('0x2f')]:_0x11085d[_0xccec('0x2a')];if(!_0x3e8557[_0xccec('0x2c')]['hasOwnProperty'](_0xccec('0x32'))){_0x59bb66['limit']=qs['limit'](_0x3e8557[_0xccec('0x2c')][_0xccec('0x1b')]);_0x59bb66[_0xccec('0x19')]=qs[_0xccec('0x19')](_0x3e8557[_0xccec('0x2c')][_0xccec('0x19')]);}_0x59bb66['order']=qs['sort'](_0x3e8557[_0xccec('0x2c')][_0xccec('0x33')]);_0x59bb66[_0xccec('0x34')]=qs[_0xccec('0x2d')](_['pick'](_0x3e8557[_0xccec('0x2c')],_0x11085d['filters']),_0x23e324);if(_0x3e8557[_0xccec('0x2c')][_0xccec('0x35')]){_0x59bb66[_0xccec('0x34')]=_[_0xccec('0x36')](_0x59bb66[_0xccec('0x34')],{'$or':_['map'](_0x23e324,function(_0x2a3a54){if(_0x2a3a54[_0xccec('0x37')]!=='VIRTUAL'){var _0x3ce4ee={};_0x3ce4ee[_0x2a3a54[_0xccec('0x24')]]={'$like':'%'+_0x3e8557[_0xccec('0x2c')][_0xccec('0x35')]+'%'};return _0x3ce4ee;}})});}_0x59bb66=_['merge']({},_0x59bb66,_0x3e8557[_0xccec('0x38')]);var _0x1526ca={'where':_0x59bb66[_0xccec('0x34')]};return db['FreshdeskField'][_0xccec('0x39')](_0x1526ca)['then'](function(_0x256e9b){_0x5ee7c1[_0xccec('0x39')]=_0x256e9b;if(_0x3e8557[_0xccec('0x2c')]['includeAll']){_0x59bb66['include']=[{'all':!![]}];}return db[_0xccec('0x3a')][_0xccec('0x3b')](_0x59bb66);})[_0xccec('0x22')](function(_0x4c0184){_0x5ee7c1[_0xccec('0x3c')]=_0x4c0184;return _0x5ee7c1;})[_0xccec('0x22')](respondWithFilteredResult(_0x3ca9c7,_0x59bb66))[_0xccec('0x3d')](handleError(_0x3ca9c7,null));};exports['show']=function(_0x720b56,_0x3b0472){var _0x262e25={'raw':!![],'where':{'id':_0x720b56['params']['id']}},_0x1dfd34={};_0x1dfd34['model']=_[_0xccec('0x2b')](db[_0xccec('0x3a')][_0xccec('0x3e')]);_0x1dfd34['query']=_[_0xccec('0x2b')](_0x720b56[_0xccec('0x2c')]);_0x1dfd34[_0xccec('0x2d')]=_[_0xccec('0x2e')](_0x1dfd34[_0xccec('0x2a')],_0x1dfd34[_0xccec('0x2c')]);_0x262e25['attributes']=_[_0xccec('0x2e')](_0x1dfd34[_0xccec('0x2a')],qs[_0xccec('0x30')](_0x720b56[_0xccec('0x2c')][_0xccec('0x30')]));_0x262e25[_0xccec('0x2f')]=_0x262e25[_0xccec('0x2f')][_0xccec('0x31')]?_0x262e25['attributes']:_0x1dfd34[_0xccec('0x2a')];if(_0x720b56[_0xccec('0x2c')][_0xccec('0x3f')]){_0x262e25[_0xccec('0x40')]=[{'all':!![]}];}_0x262e25=_['merge']({},_0x262e25,_0x720b56[_0xccec('0x38')]);return db[_0xccec('0x3a')][_0xccec('0x41')](_0x262e25)['then'](handleEntityNotFound(_0x3b0472,null))[_0xccec('0x22')](respondWithResult(_0x3b0472,null))['catch'](handleError(_0x3b0472,null));};exports[_0xccec('0x42')]=function(_0xa6ef39,_0x1f6de7){return db['FreshdeskField'][_0xccec('0x42')](_0xa6ef39[_0xccec('0x43')],{})[_0xccec('0x22')](respondWithResult(_0x1f6de7,0xc9))['catch'](handleError(_0x1f6de7,null));};exports[_0xccec('0x21')]=function(_0x28064b,_0x25c627){if(_0x28064b[_0xccec('0x43')]['id']){delete _0x28064b[_0xccec('0x43')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x28064b['params']['id']}})[_0xccec('0x22')](handleEntityNotFound(_0x25c627,null))[_0xccec('0x22')](saveUpdates(_0x28064b[_0xccec('0x43')],null))[_0xccec('0x22')](respondWithResult(_0x25c627,null))[_0xccec('0x3d')](handleError(_0x25c627,null));};exports[_0xccec('0x23')]=function(_0x5b4826,_0x1ddc01){return db['FreshdeskField'][_0xccec('0x41')]({'where':{'id':_0x5b4826[_0xccec('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ddc01,null))[_0xccec('0x22')](removeEntity(_0x1ddc01,null))[_0xccec('0x3d')](handleError(_0x1ddc01,null));}; \ No newline at end of file +var _0x1ba2=['name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','keys','find','create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','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','status','end','offset','undefined','limit','count','Content-Range','json','save','destroy','then','sendStatus','error','stack'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x21ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21ba('0x2'));var moment=require(_0x21ba('0x3'));var BPromise=require(_0x21ba('0x4'));var Mustache=require(_0x21ba('0x5'));var util=require(_0x21ba('0x6'));var path=require('path');var sox=require(_0x21ba('0x7'));var csv=require(_0x21ba('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x21ba('0x9'));var _=require('lodash');var squel=require(_0x21ba('0xa'));var crypto=require(_0x21ba('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x21ba('0xc'));var toCsv=require('to-csv');var querystring=require(_0x21ba('0xd'));var Papa=require(_0x21ba('0xe'));var Redis=require('ioredis');var authService=require(_0x21ba('0xf'));var qs=require(_0x21ba('0x10'));var as=require(_0x21ba('0x11'));var hardwareService=require(_0x21ba('0x12'));var logger=require(_0x21ba('0x13'))(_0x21ba('0x14'));var utils=require(_0x21ba('0x15'));var config=require(_0x21ba('0x16'));var licenseUtil=require(_0x21ba('0x17'));var db=require(_0x21ba('0x18'))['db'];function respondWithStatusCode(_0x10fae1,_0x2bc413){_0x2bc413=_0x2bc413||0xcc;return function(_0x48f552){if(_0x48f552){return _0x10fae1['sendStatus'](_0x2bc413);}return _0x10fae1[_0x21ba('0x19')](_0x2bc413)[_0x21ba('0x1a')]();};}function respondWithResult(_0x214f8e,_0x4f43e2){_0x4f43e2=_0x4f43e2||0xc8;return function(_0x4b9fd2){if(_0x4b9fd2){return _0x214f8e[_0x21ba('0x19')](_0x4f43e2)['json'](_0x4b9fd2);}};}function respondWithFilteredResult(_0x3591cd,_0x494588){return function(_0x179063){if(_0x179063){var _0x2e7b03=typeof _0x494588[_0x21ba('0x1b')]===_0x21ba('0x1c')&&typeof _0x494588[_0x21ba('0x1d')]==='undefined';var _0x1ab5ed=_0x179063['count'];var _0xc995ee=_0x2e7b03?0x0:_0x494588[_0x21ba('0x1b')];var _0x1f2f48=_0x2e7b03?_0x179063[_0x21ba('0x1e')]:_0x494588[_0x21ba('0x1b')]+_0x494588[_0x21ba('0x1d')];var _0x1eb6ed;if(_0x1f2f48>=_0x1ab5ed){_0x1f2f48=_0x1ab5ed;_0x1eb6ed=0xc8;}else{_0x1eb6ed=0xce;}_0x3591cd[_0x21ba('0x19')](_0x1eb6ed);return _0x3591cd['set'](_0x21ba('0x1f'),_0xc995ee+'-'+_0x1f2f48+'/'+_0x1ab5ed)[_0x21ba('0x20')](_0x179063);}return null;};}function patchUpdates(_0x58ba99){return function(_0x213a83){try{jsonpatch['apply'](_0x213a83,_0x58ba99,!![]);}catch(_0x3f9bc8){return BPromise['reject'](_0x3f9bc8);}return _0x213a83[_0x21ba('0x21')]();};}function saveUpdates(_0x43383f,_0x30ac7a){return function(_0x7abe9d){if(_0x7abe9d){return _0x7abe9d['update'](_0x43383f)['then'](function(_0x5a47da){return _0x5a47da;});}return null;};}function removeEntity(_0x4b63fb,_0x2e4b49){return function(_0x1529ec){if(_0x1529ec){return _0x1529ec[_0x21ba('0x22')]()[_0x21ba('0x23')](function(){_0x4b63fb[_0x21ba('0x19')](0xcc)[_0x21ba('0x1a')]();});}};}function handleEntityNotFound(_0x2f4d96,_0x3ab7d3){return function(_0x97ed7d){if(!_0x97ed7d){_0x2f4d96[_0x21ba('0x24')](0x194);}return _0x97ed7d;};}function handleError(_0x240e3f,_0xb9b6d8){_0xb9b6d8=_0xb9b6d8||0x1f4;return function(_0x2f7414){logger[_0x21ba('0x25')](_0x2f7414[_0x21ba('0x26')]);if(_0x2f7414[_0x21ba('0x27')]){delete _0x2f7414[_0x21ba('0x27')];}_0x240e3f[_0x21ba('0x19')](_0xb9b6d8)[_0x21ba('0x28')](_0x2f7414);};}exports[_0x21ba('0x29')]=function(_0x3d8dff,_0x9535d8){var _0x3e19cf={},_0x1b4ebe={},_0x47c14b={'count':0x0,'rows':[]};var _0x2975e2=_[_0x21ba('0x2a')](db[_0x21ba('0x2b')][_0x21ba('0x2c')],function(_0x9a2cc){return{'name':_0x9a2cc[_0x21ba('0x2d')],'type':_0x9a2cc[_0x21ba('0x2e')]['key']};});_0x1b4ebe[_0x21ba('0x2f')]=_[_0x21ba('0x2a')](_0x2975e2,_0x21ba('0x27'));_0x1b4ebe[_0x21ba('0x30')]=_['keys'](_0x3d8dff['query']);_0x1b4ebe[_0x21ba('0x31')]=_[_0x21ba('0x32')](_0x1b4ebe[_0x21ba('0x2f')],_0x1b4ebe[_0x21ba('0x30')]);_0x3e19cf[_0x21ba('0x33')]=_['intersection'](_0x1b4ebe[_0x21ba('0x2f')],qs['fields'](_0x3d8dff[_0x21ba('0x30')][_0x21ba('0x34')]));_0x3e19cf[_0x21ba('0x33')]=_0x3e19cf[_0x21ba('0x33')][_0x21ba('0x35')]?_0x3e19cf[_0x21ba('0x33')]:_0x1b4ebe[_0x21ba('0x2f')];if(!_0x3d8dff[_0x21ba('0x30')][_0x21ba('0x36')]('nolimit')){_0x3e19cf['limit']=qs[_0x21ba('0x1d')](_0x3d8dff[_0x21ba('0x30')][_0x21ba('0x1d')]);_0x3e19cf[_0x21ba('0x1b')]=qs['offset'](_0x3d8dff[_0x21ba('0x30')][_0x21ba('0x1b')]);}_0x3e19cf['order']=qs[_0x21ba('0x37')](_0x3d8dff[_0x21ba('0x30')][_0x21ba('0x37')]);_0x3e19cf[_0x21ba('0x38')]=qs[_0x21ba('0x31')](_[_0x21ba('0x39')](_0x3d8dff[_0x21ba('0x30')],_0x1b4ebe['filters']),_0x2975e2);if(_0x3d8dff[_0x21ba('0x30')]['filter']){_0x3e19cf[_0x21ba('0x38')]=_['merge'](_0x3e19cf[_0x21ba('0x38')],{'$or':_[_0x21ba('0x2a')](_0x2975e2,function(_0x1213eb){if(_0x1213eb[_0x21ba('0x2e')]!==_0x21ba('0x3a')){var _0x807ad7={};_0x807ad7[_0x1213eb[_0x21ba('0x27')]]={'$like':'%'+_0x3d8dff[_0x21ba('0x30')][_0x21ba('0x3b')]+'%'};return _0x807ad7;}})});}_0x3e19cf=_[_0x21ba('0x3c')]({},_0x3e19cf,_0x3d8dff[_0x21ba('0x3d')]);var _0x2adf90={'where':_0x3e19cf[_0x21ba('0x38')]};return db['FreshdeskField'][_0x21ba('0x1e')](_0x2adf90)[_0x21ba('0x23')](function(_0x387105){_0x47c14b[_0x21ba('0x1e')]=_0x387105;if(_0x3d8dff[_0x21ba('0x30')]['includeAll']){_0x3e19cf[_0x21ba('0x3e')]=[{'all':!![]}];}return db['FreshdeskField'][_0x21ba('0x3f')](_0x3e19cf);})[_0x21ba('0x23')](function(_0x24ccf6){_0x47c14b[_0x21ba('0x40')]=_0x24ccf6;return _0x47c14b;})[_0x21ba('0x23')](respondWithFilteredResult(_0x9535d8,_0x3e19cf))[_0x21ba('0x41')](handleError(_0x9535d8,null));};exports[_0x21ba('0x42')]=function(_0x58bce3,_0x4a38b5){var _0x1323cf={'raw':!![],'where':{'id':_0x58bce3[_0x21ba('0x43')]['id']}},_0x57207b={};_0x57207b[_0x21ba('0x2f')]=_[_0x21ba('0x44')](db[_0x21ba('0x2b')][_0x21ba('0x2c')]);_0x57207b[_0x21ba('0x30')]=_['keys'](_0x58bce3[_0x21ba('0x30')]);_0x57207b[_0x21ba('0x31')]=_['intersection'](_0x57207b[_0x21ba('0x2f')],_0x57207b['query']);_0x1323cf[_0x21ba('0x33')]=_['intersection'](_0x57207b['model'],qs[_0x21ba('0x34')](_0x58bce3[_0x21ba('0x30')]['fields']));_0x1323cf['attributes']=_0x1323cf[_0x21ba('0x33')][_0x21ba('0x35')]?_0x1323cf[_0x21ba('0x33')]:_0x57207b[_0x21ba('0x2f')];if(_0x58bce3['query']['includeAll']){_0x1323cf[_0x21ba('0x3e')]=[{'all':!![]}];}_0x1323cf=_[_0x21ba('0x3c')]({},_0x1323cf,_0x58bce3[_0x21ba('0x3d')]);return db[_0x21ba('0x2b')][_0x21ba('0x45')](_0x1323cf)['then'](handleEntityNotFound(_0x4a38b5,null))[_0x21ba('0x23')](respondWithResult(_0x4a38b5,null))[_0x21ba('0x41')](handleError(_0x4a38b5,null));};exports[_0x21ba('0x46')]=function(_0x486770,_0x57cd36){return db['FreshdeskField'][_0x21ba('0x46')](_0x486770[_0x21ba('0x47')],{})[_0x21ba('0x23')](respondWithResult(_0x57cd36,0xc9))[_0x21ba('0x41')](handleError(_0x57cd36,null));};exports[_0x21ba('0x48')]=function(_0x592461,_0x3254ce){if(_0x592461[_0x21ba('0x47')]['id']){delete _0x592461[_0x21ba('0x47')]['id'];}return db['FreshdeskField'][_0x21ba('0x45')]({'where':{'id':_0x592461[_0x21ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x3254ce,null))[_0x21ba('0x23')](saveUpdates(_0x592461[_0x21ba('0x47')],null))[_0x21ba('0x23')](respondWithResult(_0x3254ce,null))[_0x21ba('0x41')](handleError(_0x3254ce,null));};exports['destroy']=function(_0x163bf4,_0x3b018a){return db[_0x21ba('0x2b')][_0x21ba('0x45')]({'where':{'id':_0x163bf4[_0x21ba('0x43')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x3b018a,null))[_0x21ba('0x23')](removeEntity(_0x3b018a,null))[_0x21ba('0x41')](handleError(_0x3b018a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0b6c465..66ac314 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 _0x5b7c=['./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x11a023,_0xb960e6){var _0x14bdb0=function(_0x2b81fa){while(--_0x2b81fa){_0x11a023['push'](_0x11a023['shift']());}};_0x14bdb0(++_0xb960e6);}(_0x5b7c,0x107));var _0xc5b7=function(_0x32eb0c,_0x284f89){_0x32eb0c=_0x32eb0c-0x0;var _0x1cce79=_0x5b7c[_0x32eb0c];return _0x1cce79;};'use strict';var _=require('lodash');var util=require(_0xc5b7('0x0'));var logger=require(_0xc5b7('0x1'))(_0xc5b7('0x2'));var moment=require(_0xc5b7('0x3'));var BPromise=require(_0xc5b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc5b7('0x5'));var config=require(_0xc5b7('0x6'));var attributes=require(_0xc5b7('0x7'));module[_0xc5b7('0x8')]=function(_0x19138f,_0xf59e73){return _0x19138f[_0xc5b7('0x9')](_0xc5b7('0xa'),attributes,{'tableName':_0xc5b7('0xb'),'paranoid':![],'indexes':[{'name':_0xc5b7('0xc'),'fields':[_0xc5b7('0xd'),_0xc5b7('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d8e=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define'];(function(_0x52bdd5,_0x9ec0b1){var _0x468f78=function(_0x44e7cf){while(--_0x44e7cf){_0x52bdd5['push'](_0x52bdd5['shift']());}};_0x468f78(++_0x9ec0b1);}(_0x0d8e,0x16a));var _0xe0d8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0d8e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe0d8('0x0'));var util=require(_0xe0d8('0x1'));var logger=require(_0xe0d8('0x2'))(_0xe0d8('0x3'));var moment=require(_0xe0d8('0x4'));var BPromise=require(_0xe0d8('0x5'));var rp=require(_0xe0d8('0x6'));var fs=require('fs');var path=require(_0xe0d8('0x7'));var rimraf=require(_0xe0d8('0x8'));var config=require(_0xe0d8('0x9'));var attributes=require(_0xe0d8('0xa'));module['exports']=function(_0x14f1e5,_0x1e633b){return _0x14f1e5[_0xe0d8('0xb')](_0xe0d8('0xc'),attributes,{'tableName':_0xe0d8('0xd'),'paranoid':![],'indexes':[{'name':_0xe0d8('0xe'),'fields':[_0xe0d8('0xf'),_0xe0d8('0x10')],'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 48dda74..75792b0 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 _0xbd7b=['FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xbd7b,0x1ec));var _0xbbd7=function(_0x821ca5,_0x487dbd){_0x821ca5=_0x821ca5-0x0;var _0x39076b=_0xbd7b[_0x821ca5];return _0x39076b;};'use strict';var _=require('lodash');var util=require(_0xbbd7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbbd7('0x1'));var fs=require('fs');var Redis=require(_0xbbd7('0x2'));var db=require(_0xbbd7('0x3'))['db'];var utils=require(_0xbbd7('0x4'));var logger=require(_0xbbd7('0x5'))(_0xbbd7('0x6'));var config=require('../../config/environment');var jayson=require(_0xbbd7('0x7'));var client=jayson[_0xbbd7('0x8')][_0xbbd7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41d1f3,_0xd52a6d,_0x13a6f6){return new BPromise(function(_0x2846e4,_0x2ffaaf){return client[_0xbbd7('0xa')](_0x41d1f3,_0x13a6f6)['then'](function(_0x313998){logger[_0xbbd7('0xb')](_0xbbd7('0xc'),_0xd52a6d,_0xbbd7('0xd'));logger[_0xbbd7('0xe')](_0xbbd7('0xf'),_0xd52a6d,_0xbbd7('0xd'),JSON[_0xbbd7('0x10')](_0x313998));if(_0x313998['error']){if(_0x313998[_0xbbd7('0x11')][_0xbbd7('0x12')]===0x1f4){logger[_0xbbd7('0x11')](_0xbbd7('0xc'),_0xd52a6d,_0x313998[_0xbbd7('0x11')][_0xbbd7('0x13')]);return _0x2ffaaf(_0x313998[_0xbbd7('0x11')][_0xbbd7('0x13')]);}logger[_0xbbd7('0x11')]('FreshdeskField,\x20%s,\x20%s',_0xd52a6d,_0x313998[_0xbbd7('0x11')][_0xbbd7('0x13')]);return _0x2846e4(_0x313998[_0xbbd7('0x11')]['message']);}else{logger['info'](_0xbbd7('0xc'),_0xd52a6d,_0xbbd7('0xd'));_0x2846e4(_0x313998[_0xbbd7('0x14')][_0xbbd7('0x13')]);}})['catch'](function(_0x132b73){logger['error'](_0xbbd7('0xc'),_0xd52a6d,_0x132b73);_0x2ffaaf(_0x132b73);});});} \ No newline at end of file +var _0xd730=['client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise'];(function(_0x83cc9d,_0x35838e){var _0x1251d0=function(_0x383fe5){while(--_0x383fe5){_0x83cc9d['push'](_0x83cc9d['shift']());}};_0x1251d0(++_0x35838e);}(_0xd730,0x77));var _0x0d73=function(_0x16ffa3,_0x51f93c){_0x16ffa3=_0x16ffa3-0x0;var _0x436da4=_0xd730[_0x16ffa3];return _0x436da4;};'use strict';var _=require(_0x0d73('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0d73('0x1'));var rs=require(_0x0d73('0x2'));var fs=require('fs');var Redis=require(_0x0d73('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d73('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0d73('0x5'));var jayson=require(_0x0d73('0x6'));var client=jayson[_0x0d73('0x7')][_0x0d73('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4de08b,_0x4e7835,_0x14d4b4){return new BPromise(function(_0x13d779,_0x35e6df){return client['request'](_0x4de08b,_0x14d4b4)[_0x0d73('0x9')](function(_0x1a6917){logger[_0x0d73('0xa')](_0x0d73('0xb'),_0x4e7835,_0x0d73('0xc'));logger[_0x0d73('0xd')](_0x0d73('0xe'),_0x4e7835,_0x0d73('0xc'),JSON[_0x0d73('0xf')](_0x1a6917));if(_0x1a6917[_0x0d73('0x10')]){if(_0x1a6917[_0x0d73('0x10')][_0x0d73('0x11')]===0x1f4){logger[_0x0d73('0x10')](_0x0d73('0xb'),_0x4e7835,_0x1a6917[_0x0d73('0x10')][_0x0d73('0x12')]);return _0x35e6df(_0x1a6917[_0x0d73('0x10')]['message']);}logger[_0x0d73('0x10')](_0x0d73('0xb'),_0x4e7835,_0x1a6917[_0x0d73('0x10')][_0x0d73('0x12')]);return _0x13d779(_0x1a6917[_0x0d73('0x10')][_0x0d73('0x12')]);}else{logger[_0x0d73('0xa')](_0x0d73('0xb'),_0x4e7835,_0x0d73('0xc'));_0x13d779(_0x1a6917[_0x0d73('0x13')]['message']);}})[_0x0d73('0x14')](function(_0x5363ae){logger[_0x0d73('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x4e7835,_0x5363ae);_0x35e6df(_0x5363ae);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 62caa1d..c838a00 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 _0x9c00=['create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x87b382,_0x367e72){var _0x2c6907=function(_0x1c50d3){while(--_0x1c50d3){_0x87b382['push'](_0x87b382['shift']());}};_0x2c6907(++_0x367e72);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5b620e,_0x266273){_0x5b620e=_0x5b620e-0x0;var _0x6b7008=_0x9c00[_0x5b620e];return _0x6b7008;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x8')]('/:id/configurations',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0xf')]('/',auth[_0x09c0('0xa')](),controller[_0x09c0('0x10')]);router[_0x09c0('0xf')](_0x09c0('0x11'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x12')]);router[_0x09c0('0x13')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x14')]);router[_0x09c0('0x15')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x16')]);module[_0x09c0('0x17')]=router; \ No newline at end of file +var _0x7072=['put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x2c5a2d,_0xdc73d0){var _0x10c414=function(_0x1b8cd0){while(--_0x1b8cd0){_0x2c5a2d['push'](_0x2c5a2d['shift']());}};_0x10c414(++_0xdc73d0);}(_0x7072,0x138));var _0x2707=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x7072[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x5'));var config=require('../../config/environment');var controller=require(_0x2707('0x6'));router[_0x2707('0x7')]('/',auth[_0x2707('0x8')](),controller[_0x2707('0x9')]);router[_0x2707('0x7')](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0xb')]);router[_0x2707('0x7')](_0x2707('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x2707('0x7')](_0x2707('0xd'),auth[_0x2707('0x8')](),controller[_0x2707('0xe')]);router[_0x2707('0xf')]('/',auth[_0x2707('0x8')](),controller[_0x2707('0x10')]);router[_0x2707('0xf')](_0x2707('0xc'),auth[_0x2707('0x8')](),controller[_0x2707('0x11')]);router[_0x2707('0x12')](_0x2707('0xa'),auth['isAuthenticated'](),controller[_0x2707('0x13')]);router['delete'](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0x14')]);module[_0x2707('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 c8cc2f5..98f6401 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 _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0xebd93c,_0x10b64f){var _0x3cb229=function(_0x40f20){while(--_0x40f20){_0xebd93c['push'](_0xebd93c['shift']());}};_0x3cb229(++_0x10b64f);}(_0x7916,0x128));var _0x6791=function(_0x4bc132,_0x1a47c1){_0x4bc132=_0x4bc132-0x0;var _0x1242e8=_0x7916[_0x4bc132];return _0x1242e8;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x33af=['exports','STRING','username','remoteUri'];(function(_0x58df29,_0x5773f7){var _0x37136f=function(_0x11d73c){while(--_0x11d73c){_0x58df29['push'](_0x58df29['shift']());}};_0x37136f(++_0x5773f7);}(_0x33af,0xec));var _0xf33a=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x33af[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require('sequelize');module[_0xf33a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf33a('0x1')]},'username':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x2')},'apiKey':{'type':Sequelize[_0xf33a('0x1')]},'remoteUri':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 7acded3..69f8668 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 _0x6e87=['stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','status','send','map','FreshsalesAccount','rawAttributes','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','fields','find','create','body','update','params','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','remoteUri','apiKey','username','slice','substring','lastIndexOf','GET','format','%s%s','users','email','test','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x6e87,0x6a));var _0x76e8=function(_0x57480b,_0xb14e90){_0x57480b=_0x57480b-0x0;var _0x40c092=_0x6e87[_0x57480b];return _0x40c092;};'use strict';var emlformat=require(_0x76e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76e8('0x1'));var jsonpatch=require(_0x76e8('0x2'));var rp=require(_0x76e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x76e8('0x4'));var util=require(_0x76e8('0x5'));var path=require(_0x76e8('0x6'));var sox=require(_0x76e8('0x7'));var csv=require('to-csv');var ejs=require(_0x76e8('0x8'));var fs=require('fs');var fs_extra=require(_0x76e8('0x9'));var _=require(_0x76e8('0xa'));var squel=require(_0x76e8('0xb'));var crypto=require(_0x76e8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x76e8('0xd'));var toCsv=require(_0x76e8('0xe'));var querystring=require(_0x76e8('0xf'));var Papa=require(_0x76e8('0x10'));var Redis=require(_0x76e8('0x11'));var authService=require(_0x76e8('0x12'));var qs=require(_0x76e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76e8('0x14'));var logger=require(_0x76e8('0x15'))(_0x76e8('0x16'));var utils=require('../../config/utils');var config=require(_0x76e8('0x17'));var licenseUtil=require(_0x76e8('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x76e8('0x19'));function respondWithStatusCode(_0x53053f,_0x568825){_0x568825=_0x568825||0xcc;return function(_0x4fa46c){if(_0x4fa46c){return _0x53053f[_0x76e8('0x1a')](_0x568825);}return _0x53053f['status'](_0x568825)['end']();};}function respondWithResult(_0x11fe0a,_0x389ee5){_0x389ee5=_0x389ee5||0xc8;return function(_0x411890){if(_0x411890){return _0x11fe0a['status'](_0x389ee5)[_0x76e8('0x1b')](_0x411890);}};}function respondWithFilteredResult(_0x1933f9,_0x825f79){return function(_0x12ad26){if(_0x12ad26){var _0x29a594=typeof _0x825f79[_0x76e8('0x1c')]==='undefined'&&typeof _0x825f79[_0x76e8('0x1d')]==='undefined';var _0x146d73=_0x12ad26['count'];var _0x36f070=_0x29a594?0x0:_0x825f79[_0x76e8('0x1c')];var _0x3c9a6b=_0x29a594?_0x12ad26[_0x76e8('0x1e')]:_0x825f79[_0x76e8('0x1c')]+_0x825f79[_0x76e8('0x1d')];var _0x38464f;if(_0x3c9a6b>=_0x146d73){_0x3c9a6b=_0x146d73;_0x38464f=0xc8;}else{_0x38464f=0xce;}_0x1933f9['status'](_0x38464f);return _0x1933f9[_0x76e8('0x1f')](_0x76e8('0x20'),_0x36f070+'-'+_0x3c9a6b+'/'+_0x146d73)['json'](_0x12ad26);}return null;};}function patchUpdates(_0xe1c89a){return function(_0x30cd27){try{jsonpatch[_0x76e8('0x21')](_0x30cd27,_0xe1c89a,!![]);}catch(_0x81fa0c){return BPromise[_0x76e8('0x22')](_0x81fa0c);}return _0x30cd27[_0x76e8('0x23')]();};}function saveUpdates(_0x3dc5b2,_0x2c1548){return function(_0x1a3b6c){if(_0x1a3b6c){return _0x1a3b6c['update'](_0x3dc5b2)[_0x76e8('0x24')](function(_0x485ffc){return _0x485ffc;});}return null;};}function removeEntity(_0x2822f7,_0x48bb32){return function(_0x1dd34b){if(_0x1dd34b){return _0x1dd34b[_0x76e8('0x25')]()['then'](function(){_0x2822f7['status'](0xcc)[_0x76e8('0x26')]();});}};}function handleEntityNotFound(_0x1f9082,_0x20611c){return function(_0x438575){if(!_0x438575){_0x1f9082[_0x76e8('0x1a')](0x194);}return _0x438575;};}function handleError(_0x31e423,_0x30c0ba){_0x30c0ba=_0x30c0ba||0x1f4;return function(_0x11b6f0){logger[_0x76e8('0x27')](_0x11b6f0[_0x76e8('0x28')]);if(_0x11b6f0[_0x76e8('0x29')]){delete _0x11b6f0[_0x76e8('0x29')];}_0x31e423[_0x76e8('0x2a')](_0x30c0ba)[_0x76e8('0x2b')](_0x11b6f0);};}exports['index']=function(_0x53dca1,_0x52949c){var _0x449455={},_0x336221={},_0x3e1cdf={'count':0x0,'rows':[]};var _0x56e44d=_[_0x76e8('0x2c')](db[_0x76e8('0x2d')][_0x76e8('0x2e')],function(_0x28c881){return{'name':_0x28c881['fieldName'],'type':_0x28c881['type']['key']};});_0x336221[_0x76e8('0x2f')]=_['map'](_0x56e44d,_0x76e8('0x29'));_0x336221[_0x76e8('0x30')]=_[_0x76e8('0x31')](_0x53dca1[_0x76e8('0x30')]);_0x336221[_0x76e8('0x32')]=_['intersection'](_0x336221[_0x76e8('0x2f')],_0x336221[_0x76e8('0x30')]);_0x449455[_0x76e8('0x33')]=_[_0x76e8('0x34')](_0x336221[_0x76e8('0x2f')],qs['fields'](_0x53dca1[_0x76e8('0x30')]['fields']));_0x449455[_0x76e8('0x33')]=_0x449455[_0x76e8('0x33')][_0x76e8('0x35')]?_0x449455[_0x76e8('0x33')]:_0x336221[_0x76e8('0x2f')];if(!_0x53dca1[_0x76e8('0x30')][_0x76e8('0x36')](_0x76e8('0x37'))){_0x449455[_0x76e8('0x1d')]=qs['limit'](_0x53dca1[_0x76e8('0x30')][_0x76e8('0x1d')]);_0x449455[_0x76e8('0x1c')]=qs['offset'](_0x53dca1['query'][_0x76e8('0x1c')]);}_0x449455[_0x76e8('0x38')]=qs[_0x76e8('0x39')](_0x53dca1[_0x76e8('0x30')][_0x76e8('0x39')]);_0x449455[_0x76e8('0x3a')]=qs[_0x76e8('0x32')](_[_0x76e8('0x3b')](_0x53dca1['query'],_0x336221[_0x76e8('0x32')]),_0x56e44d);if(_0x53dca1[_0x76e8('0x30')]['filter']){_0x449455[_0x76e8('0x3a')]=_[_0x76e8('0x3c')](_0x449455[_0x76e8('0x3a')],{'$or':_['map'](_0x56e44d,function(_0x28cca9){if(_0x28cca9[_0x76e8('0x3d')]!==_0x76e8('0x3e')){var _0x40fc8f={};_0x40fc8f[_0x28cca9[_0x76e8('0x29')]]={'$like':'%'+_0x53dca1['query'][_0x76e8('0x3f')]+'%'};return _0x40fc8f;}})});}_0x449455=_['merge']({},_0x449455,_0x53dca1[_0x76e8('0x40')]);var _0x5e2b43={'where':_0x449455['where']};return db[_0x76e8('0x2d')][_0x76e8('0x1e')](_0x5e2b43)[_0x76e8('0x24')](function(_0x28d198){_0x3e1cdf[_0x76e8('0x1e')]=_0x28d198;if(_0x53dca1[_0x76e8('0x30')][_0x76e8('0x41')]){_0x449455['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x76e8('0x42')](_0x449455);})[_0x76e8('0x24')](function(_0x3f6d7a){_0x3e1cdf[_0x76e8('0x43')]=_0x3f6d7a;return _0x3e1cdf;})['then'](respondWithFilteredResult(_0x52949c,_0x449455))[_0x76e8('0x44')](handleError(_0x52949c,null));};exports[_0x76e8('0x45')]=function(_0x1bc3a1,_0x120a61){var _0x5a6099={'raw':![],'where':{'id':_0x1bc3a1['params']['id']}},_0x1520b3={};_0x1520b3[_0x76e8('0x2f')]=_[_0x76e8('0x31')](db['FreshsalesAccount']['rawAttributes']);_0x1520b3['query']=_[_0x76e8('0x31')](_0x1bc3a1[_0x76e8('0x30')]);_0x1520b3[_0x76e8('0x32')]=_['intersection'](_0x1520b3[_0x76e8('0x2f')],_0x1520b3['query']);_0x5a6099[_0x76e8('0x33')]=_['intersection'](_0x1520b3['model'],qs[_0x76e8('0x46')](_0x1bc3a1['query'][_0x76e8('0x46')]));_0x5a6099[_0x76e8('0x33')]=_0x5a6099[_0x76e8('0x33')][_0x76e8('0x35')]?_0x5a6099[_0x76e8('0x33')]:_0x1520b3['model'];if(_0x1bc3a1['query']['includeAll']){_0x5a6099['include']=[{'all':!![]}];}_0x5a6099=_['merge']({},_0x5a6099,_0x1bc3a1[_0x76e8('0x40')]);return db[_0x76e8('0x2d')][_0x76e8('0x47')](_0x5a6099)[_0x76e8('0x24')](handleEntityNotFound(_0x120a61,null))[_0x76e8('0x24')](respondWithResult(_0x120a61,null))['catch'](handleError(_0x120a61,null));};exports[_0x76e8('0x48')]=function(_0x3fc60f,_0x309470){return db[_0x76e8('0x2d')][_0x76e8('0x48')](_0x3fc60f[_0x76e8('0x49')],{})[_0x76e8('0x24')](respondWithResult(_0x309470,0xc9))[_0x76e8('0x44')](handleError(_0x309470,null));};exports[_0x76e8('0x4a')]=function(_0x562a0f,_0xd9708){if(_0x562a0f[_0x76e8('0x49')]['id']){delete _0x562a0f['body']['id'];}return db[_0x76e8('0x2d')][_0x76e8('0x47')]({'where':{'id':_0x562a0f[_0x76e8('0x4b')]['id']}})['then'](handleEntityNotFound(_0xd9708,null))['then'](saveUpdates(_0x562a0f[_0x76e8('0x49')],null))['then'](respondWithResult(_0xd9708,null))[_0x76e8('0x44')](handleError(_0xd9708,null));};exports[_0x76e8('0x25')]=function(_0xd7b1f9,_0x54c34d){return db[_0x76e8('0x2d')][_0x76e8('0x47')]({'where':{'id':_0xd7b1f9[_0x76e8('0x4b')]['id']}})[_0x76e8('0x24')](handleEntityNotFound(_0x54c34d,null))[_0x76e8('0x24')](removeEntity(_0x54c34d,null))[_0x76e8('0x44')](handleError(_0x54c34d,null));};exports[_0x76e8('0x4c')]=function(_0x461592,_0x155ba5,_0xaf9065){var _0x55caf5={};var _0x38da9d={};var _0x4b51c8;var _0x4cd510;return db['FreshsalesAccount'][_0x76e8('0x4d')]({'where':{'id':_0x461592[_0x76e8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x155ba5,null))[_0x76e8('0x24')](function(_0x267375){if(_0x267375){_0x4b51c8=_0x267375;_0x38da9d['model']=_[_0x76e8('0x31')](db[_0x76e8('0x4e')]['rawAttributes']);_0x38da9d[_0x76e8('0x30')]=_[_0x76e8('0x31')](_0x461592[_0x76e8('0x30')]);_0x38da9d['filters']=_[_0x76e8('0x34')](_0x38da9d['model'],_0x38da9d[_0x76e8('0x30')]);_0x55caf5['attributes']=_[_0x76e8('0x34')](_0x38da9d[_0x76e8('0x2f')],qs[_0x76e8('0x46')](_0x461592['query'][_0x76e8('0x46')]));_0x55caf5['attributes']=_0x55caf5[_0x76e8('0x33')][_0x76e8('0x35')]?_0x55caf5[_0x76e8('0x33')]:_0x38da9d[_0x76e8('0x2f')];_0x55caf5[_0x76e8('0x38')]=qs[_0x76e8('0x39')](_0x461592[_0x76e8('0x30')][_0x76e8('0x39')]);_0x55caf5['where']=qs[_0x76e8('0x32')](_[_0x76e8('0x3b')](_0x461592[_0x76e8('0x30')],_0x38da9d[_0x76e8('0x32')]));if(_0x461592[_0x76e8('0x30')]['filter']){_0x55caf5[_0x76e8('0x3a')]=_[_0x76e8('0x3c')](_0x55caf5[_0x76e8('0x3a')],{'$or':_[_0x76e8('0x2c')](_0x55caf5['attributes'],function(_0x324123){var _0x28008a={};_0x28008a[_0x324123]={'$like':'%'+_0x461592[_0x76e8('0x30')][_0x76e8('0x3f')]+'%'};return _0x28008a;})});}_0x55caf5=_['merge']({},_0x55caf5,_0x461592[_0x76e8('0x40')]);return _0x4b51c8[_0x76e8('0x4c')](_0x55caf5);}})[_0x76e8('0x24')](function(_0x5895ee){if(_0x5895ee){_0x4cd510=_0x5895ee['length'];if(!_0x461592[_0x76e8('0x30')]['hasOwnProperty']('nolimit')){_0x55caf5[_0x76e8('0x1d')]=qs[_0x76e8('0x1d')](_0x461592['query']['limit']);_0x55caf5['offset']=qs[_0x76e8('0x1c')](_0x461592[_0x76e8('0x30')]['offset']);}return _0x4b51c8['getConfigurations'](_0x55caf5);}})[_0x76e8('0x24')](function(_0x49c9e9){if(_0x49c9e9){return _0x49c9e9?{'count':_0x4cd510,'rows':_0x49c9e9}:null;}})['then'](respondWithResult(_0x155ba5,null))[_0x76e8('0x44')](handleError(_0x155ba5,null));};exports[_0x76e8('0x4f')]=function(_0x48c7dc,_0x47e146,_0x5c7581){if(_0x48c7dc['body']['id']){delete _0x48c7dc[_0x76e8('0x49')]['id'];}return db['FreshsalesAccount'][_0x76e8('0x4d')]({'where':{'id':_0x48c7dc[_0x76e8('0x4b')]['id']}})[_0x76e8('0x24')](handleEntityNotFound(_0x47e146,null))[_0x76e8('0x24')](function(_0x5a68b7){if(_0x5a68b7){_0x48c7dc[_0x76e8('0x49')]['AccountId']=_0x5a68b7['id'];_0x48c7dc[_0x76e8('0x49')][_0x76e8('0x50')]=integrations[_0x76e8('0x51')](_0x48c7dc[_0x76e8('0x49')][_0x76e8('0x52')],_0x48c7dc[_0x76e8('0x49')]['type']);_0x48c7dc[_0x76e8('0x49')][_0x76e8('0x53')]=integrations[_0x76e8('0x54')](_0x48c7dc[_0x76e8('0x49')][_0x76e8('0x52')],_0x48c7dc['body'][_0x76e8('0x3d')]);return db[_0x76e8('0x4e')][_0x76e8('0x48')](_0x48c7dc['body'],{'include':[{'model':db[_0x76e8('0x55')],'as':_0x76e8('0x50')},{'model':db[_0x76e8('0x55')],'as':'Descriptions'}]});}return null;})[_0x76e8('0x24')](respondWithResult(_0x47e146,null))[_0x76e8('0x44')](handleError(_0x47e146,null));};exports[_0x76e8('0x56')]=function(_0x258a30,_0x3c4929,_0x41d790){var _0x1d72c3='';var _0x203ebd='';return db['FreshsalesAccount'][_0x76e8('0x4d')]({'where':{'id':_0x258a30['params']['id']},'attributes':['id','username',_0x76e8('0x57'),_0x76e8('0x58')]})['then'](handleEntityNotFound(_0x3c4929,null))[_0x76e8('0x24')](function(_0x3ffdb7){if(_0x3ffdb7){_0x203ebd=_0x3ffdb7[_0x76e8('0x59')];_0x1d72c3=_0x3ffdb7[_0x76e8('0x57')];var _0x369b02=_0x3ffdb7[_0x76e8('0x57')][_0x76e8('0x5a')](-0x1);if(_0x369b02==='/'){_0x1d72c3=_0x1d72c3[_0x76e8('0x5b')](0x0,_0x1d72c3[_0x76e8('0x5c')](_0x369b02));}return rp({'method':_0x76e8('0x5d'),'uri':util[_0x76e8('0x5e')](_0x76e8('0x5f'),_0x1d72c3,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x3ffdb7[_0x76e8('0x58')]},'json':!![]});}})[_0x76e8('0x24')](function(_0xb18af5){if(_0xb18af5){var _0x977e78=_0xb18af5[_0x76e8('0x60')];var _0x589907=![];var _0x21ae12=null;for(_0x21ae12=0x0;_0x21ae12<_0x977e78[_0x76e8('0x35')];_0x21ae12++){if(_0x977e78[_0x21ae12][_0x76e8('0x61')]===_0x203ebd){_0x589907=!![];}}if(_0x589907){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x76e8('0x24')](respondWithResult(_0x3c4929,null))['catch'](function(_0x1271b9){var _0x7f8495=_0x258a30['query'][_0x76e8('0x62')]?0x1f4:_0x1271b9['statusCode']||0x1f4;logger[_0x76e8('0x27')](_0x76e8('0x63'),_0x76e8('0x56'),_0x7f8495,JSON[_0x76e8('0x64')](_0x1271b9));delete _0x1271b9[_0x76e8('0x29')];if(_0x7f8495===0x191){_0x7f8495=0x190;}_0x3c4929[_0x76e8('0x2a')](_0x7f8495)[_0x76e8('0x2b')](_0x258a30[_0x76e8('0x30')][_0x76e8('0x62')]?{'message':_0x76e8('0x65'),'statusCode':_0x1271b9[_0x76e8('0x66')]}:_0x1271b9);});}; \ No newline at end of file +var _0xc242=['getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','then','destroy','end','error','stack','name','index','map','FreshsalesAccount','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','include','rows','catch','params','rawAttributes','includeAll','options','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','AccountId','Subjects','channel','Descriptions'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xc242,0x73));var _0x2c24=function(_0x469e0e,_0x127814){_0x469e0e=_0x469e0e-0x0;var _0xaf59fe=_0xc242[_0x469e0e];return _0xaf59fe;};'use strict';var emlformat=require(_0x2c24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c24('0x1'));var jsonpatch=require(_0x2c24('0x2'));var rp=require(_0x2c24('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c24('0x4'));var path=require(_0x2c24('0x5'));var sox=require(_0x2c24('0x6'));var csv=require('to-csv');var ejs=require(_0x2c24('0x7'));var fs=require('fs');var fs_extra=require(_0x2c24('0x8'));var _=require(_0x2c24('0x9'));var squel=require(_0x2c24('0xa'));var crypto=require(_0x2c24('0xb'));var jsforce=require(_0x2c24('0xc'));var deskjs=require(_0x2c24('0xd'));var toCsv=require(_0x2c24('0xe'));var querystring=require(_0x2c24('0xf'));var Papa=require('papaparse');var Redis=require(_0x2c24('0x10'));var authService=require(_0x2c24('0x11'));var qs=require(_0x2c24('0x12'));var as=require(_0x2c24('0x13'));var hardwareService=require(_0x2c24('0x14'));var logger=require('../../config/logger')(_0x2c24('0x15'));var utils=require(_0x2c24('0x16'));var config=require(_0x2c24('0x17'));var licenseUtil=require(_0x2c24('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2c24('0x19'));function respondWithStatusCode(_0x4d0a9f,_0x460282){_0x460282=_0x460282||0xcc;return function(_0x1b9461){if(_0x1b9461){return _0x4d0a9f[_0x2c24('0x1a')](_0x460282);}return _0x4d0a9f['status'](_0x460282)['end']();};}function respondWithResult(_0x5c2dc8,_0x41a7e1){_0x41a7e1=_0x41a7e1||0xc8;return function(_0x588a3d){if(_0x588a3d){return _0x5c2dc8[_0x2c24('0x1b')](_0x41a7e1)[_0x2c24('0x1c')](_0x588a3d);}};}function respondWithFilteredResult(_0x49fa1e,_0x2a31a0){return function(_0x47ff0f){if(_0x47ff0f){var _0x106236=typeof _0x2a31a0[_0x2c24('0x1d')]===_0x2c24('0x1e')&&typeof _0x2a31a0['limit']===_0x2c24('0x1e');var _0x4f8a38=_0x47ff0f['count'];var _0x3f7a3b=_0x106236?0x0:_0x2a31a0[_0x2c24('0x1d')];var _0x10bd66=_0x106236?_0x47ff0f[_0x2c24('0x1f')]:_0x2a31a0[_0x2c24('0x1d')]+_0x2a31a0[_0x2c24('0x20')];var _0x29bd10;if(_0x10bd66>=_0x4f8a38){_0x10bd66=_0x4f8a38;_0x29bd10=0xc8;}else{_0x29bd10=0xce;}_0x49fa1e['status'](_0x29bd10);return _0x49fa1e[_0x2c24('0x21')]('Content-Range',_0x3f7a3b+'-'+_0x10bd66+'/'+_0x4f8a38)[_0x2c24('0x1c')](_0x47ff0f);}return null;};}function patchUpdates(_0x164fde){return function(_0x5b997e){try{jsonpatch[_0x2c24('0x22')](_0x5b997e,_0x164fde,!![]);}catch(_0x242b1f){return BPromise['reject'](_0x242b1f);}return _0x5b997e[_0x2c24('0x23')]();};}function saveUpdates(_0x4c0387,_0x232258){return function(_0x4892f6){if(_0x4892f6){return _0x4892f6['update'](_0x4c0387)[_0x2c24('0x24')](function(_0x4abe07){return _0x4abe07;});}return null;};}function removeEntity(_0x5520d4,_0x2f6670){return function(_0x3620d6){if(_0x3620d6){return _0x3620d6[_0x2c24('0x25')]()[_0x2c24('0x24')](function(){_0x5520d4[_0x2c24('0x1b')](0xcc)[_0x2c24('0x26')]();});}};}function handleEntityNotFound(_0x524a33,_0xe1495b){return function(_0x4859cb){if(!_0x4859cb){_0x524a33[_0x2c24('0x1a')](0x194);}return _0x4859cb;};}function handleError(_0x2ab287,_0x58f4e5){_0x58f4e5=_0x58f4e5||0x1f4;return function(_0xb3776f){logger[_0x2c24('0x27')](_0xb3776f[_0x2c24('0x28')]);if(_0xb3776f[_0x2c24('0x29')]){delete _0xb3776f[_0x2c24('0x29')];}_0x2ab287['status'](_0x58f4e5)['send'](_0xb3776f);};}exports[_0x2c24('0x2a')]=function(_0x51a912,_0x3c9fcc){var _0x5b096f={},_0x248b12={},_0x34be01={'count':0x0,'rows':[]};var _0x467db8=_[_0x2c24('0x2b')](db[_0x2c24('0x2c')]['rawAttributes'],function(_0x547881){return{'name':_0x547881[_0x2c24('0x2d')],'type':_0x547881['type'][_0x2c24('0x2e')]};});_0x248b12[_0x2c24('0x2f')]=_[_0x2c24('0x2b')](_0x467db8,_0x2c24('0x29'));_0x248b12[_0x2c24('0x30')]=_[_0x2c24('0x31')](_0x51a912[_0x2c24('0x30')]);_0x248b12[_0x2c24('0x32')]=_['intersection'](_0x248b12[_0x2c24('0x2f')],_0x248b12['query']);_0x5b096f[_0x2c24('0x33')]=_[_0x2c24('0x34')](_0x248b12[_0x2c24('0x2f')],qs[_0x2c24('0x35')](_0x51a912[_0x2c24('0x30')][_0x2c24('0x35')]));_0x5b096f[_0x2c24('0x33')]=_0x5b096f['attributes'][_0x2c24('0x36')]?_0x5b096f[_0x2c24('0x33')]:_0x248b12[_0x2c24('0x2f')];if(!_0x51a912[_0x2c24('0x30')][_0x2c24('0x37')]('nolimit')){_0x5b096f['limit']=qs['limit'](_0x51a912[_0x2c24('0x30')][_0x2c24('0x20')]);_0x5b096f[_0x2c24('0x1d')]=qs[_0x2c24('0x1d')](_0x51a912[_0x2c24('0x30')][_0x2c24('0x1d')]);}_0x5b096f[_0x2c24('0x38')]=qs[_0x2c24('0x39')](_0x51a912[_0x2c24('0x30')][_0x2c24('0x39')]);_0x5b096f[_0x2c24('0x3a')]=qs[_0x2c24('0x32')](_[_0x2c24('0x3b')](_0x51a912[_0x2c24('0x30')],_0x248b12['filters']),_0x467db8);if(_0x51a912[_0x2c24('0x30')][_0x2c24('0x3c')]){_0x5b096f[_0x2c24('0x3a')]=_[_0x2c24('0x3d')](_0x5b096f['where'],{'$or':_[_0x2c24('0x2b')](_0x467db8,function(_0x594277){if(_0x594277[_0x2c24('0x3e')]!=='VIRTUAL'){var _0x267c34={};_0x267c34[_0x594277['name']]={'$like':'%'+_0x51a912[_0x2c24('0x30')]['filter']+'%'};return _0x267c34;}})});}_0x5b096f=_[_0x2c24('0x3d')]({},_0x5b096f,_0x51a912['options']);var _0x47fdbc={'where':_0x5b096f['where']};return db['FreshsalesAccount']['count'](_0x47fdbc)[_0x2c24('0x24')](function(_0x296fbd){_0x34be01[_0x2c24('0x1f')]=_0x296fbd;if(_0x51a912[_0x2c24('0x30')]['includeAll']){_0x5b096f[_0x2c24('0x3f')]=[{'all':!![]}];}return db[_0x2c24('0x2c')]['findAll'](_0x5b096f);})['then'](function(_0x269988){_0x34be01[_0x2c24('0x40')]=_0x269988;return _0x34be01;})['then'](respondWithFilteredResult(_0x3c9fcc,_0x5b096f))[_0x2c24('0x41')](handleError(_0x3c9fcc,null));};exports['show']=function(_0x255b81,_0x4695a9){var _0xce98b1={'raw':![],'where':{'id':_0x255b81[_0x2c24('0x42')]['id']}},_0x279d79={};_0x279d79[_0x2c24('0x2f')]=_[_0x2c24('0x31')](db[_0x2c24('0x2c')][_0x2c24('0x43')]);_0x279d79[_0x2c24('0x30')]=_['keys'](_0x255b81[_0x2c24('0x30')]);_0x279d79['filters']=_[_0x2c24('0x34')](_0x279d79[_0x2c24('0x2f')],_0x279d79[_0x2c24('0x30')]);_0xce98b1[_0x2c24('0x33')]=_[_0x2c24('0x34')](_0x279d79[_0x2c24('0x2f')],qs[_0x2c24('0x35')](_0x255b81[_0x2c24('0x30')][_0x2c24('0x35')]));_0xce98b1[_0x2c24('0x33')]=_0xce98b1[_0x2c24('0x33')][_0x2c24('0x36')]?_0xce98b1['attributes']:_0x279d79['model'];if(_0x255b81[_0x2c24('0x30')][_0x2c24('0x44')]){_0xce98b1[_0x2c24('0x3f')]=[{'all':!![]}];}_0xce98b1=_[_0x2c24('0x3d')]({},_0xce98b1,_0x255b81[_0x2c24('0x45')]);return db[_0x2c24('0x2c')][_0x2c24('0x46')](_0xce98b1)[_0x2c24('0x24')](handleEntityNotFound(_0x4695a9,null))['then'](respondWithResult(_0x4695a9,null))[_0x2c24('0x41')](handleError(_0x4695a9,null));};exports[_0x2c24('0x47')]=function(_0x27b2f4,_0x3cad28){return db[_0x2c24('0x2c')][_0x2c24('0x47')](_0x27b2f4[_0x2c24('0x48')],{})['then'](respondWithResult(_0x3cad28,0xc9))[_0x2c24('0x41')](handleError(_0x3cad28,null));};exports['update']=function(_0x4022c1,_0x2e67f3){if(_0x4022c1['body']['id']){delete _0x4022c1['body']['id'];}return db[_0x2c24('0x2c')][_0x2c24('0x46')]({'where':{'id':_0x4022c1[_0x2c24('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e67f3,null))[_0x2c24('0x24')](saveUpdates(_0x4022c1['body'],null))['then'](respondWithResult(_0x2e67f3,null))['catch'](handleError(_0x2e67f3,null));};exports[_0x2c24('0x25')]=function(_0x4f8f9d,_0x1d98fe){return db[_0x2c24('0x2c')][_0x2c24('0x46')]({'where':{'id':_0x4f8f9d[_0x2c24('0x42')]['id']}})[_0x2c24('0x24')](handleEntityNotFound(_0x1d98fe,null))['then'](removeEntity(_0x1d98fe,null))[_0x2c24('0x41')](handleError(_0x1d98fe,null));};exports[_0x2c24('0x49')]=function(_0x29e00b,_0x22c127,_0x46d24e){var _0x3908de={};var _0x21a962={};var _0x3de72e;var _0x3067a8;return db[_0x2c24('0x2c')][_0x2c24('0x4a')]({'where':{'id':_0x29e00b[_0x2c24('0x42')]['id']}})[_0x2c24('0x24')](handleEntityNotFound(_0x22c127,null))[_0x2c24('0x24')](function(_0x5242ee){if(_0x5242ee){_0x3de72e=_0x5242ee;_0x21a962[_0x2c24('0x2f')]=_[_0x2c24('0x31')](db[_0x2c24('0x4b')][_0x2c24('0x43')]);_0x21a962[_0x2c24('0x30')]=_[_0x2c24('0x31')](_0x29e00b[_0x2c24('0x30')]);_0x21a962[_0x2c24('0x32')]=_[_0x2c24('0x34')](_0x21a962[_0x2c24('0x2f')],_0x21a962[_0x2c24('0x30')]);_0x3908de[_0x2c24('0x33')]=_['intersection'](_0x21a962[_0x2c24('0x2f')],qs[_0x2c24('0x35')](_0x29e00b[_0x2c24('0x30')]['fields']));_0x3908de[_0x2c24('0x33')]=_0x3908de['attributes']['length']?_0x3908de['attributes']:_0x21a962[_0x2c24('0x2f')];_0x3908de[_0x2c24('0x38')]=qs['sort'](_0x29e00b[_0x2c24('0x30')]['sort']);_0x3908de['where']=qs[_0x2c24('0x32')](_[_0x2c24('0x3b')](_0x29e00b['query'],_0x21a962['filters']));if(_0x29e00b['query'][_0x2c24('0x3c')]){_0x3908de[_0x2c24('0x3a')]=_[_0x2c24('0x3d')](_0x3908de['where'],{'$or':_['map'](_0x3908de[_0x2c24('0x33')],function(_0x123af9){var _0x590360={};_0x590360[_0x123af9]={'$like':'%'+_0x29e00b[_0x2c24('0x30')][_0x2c24('0x3c')]+'%'};return _0x590360;})});}_0x3908de=_[_0x2c24('0x3d')]({},_0x3908de,_0x29e00b['options']);return _0x3de72e[_0x2c24('0x49')](_0x3908de);}})[_0x2c24('0x24')](function(_0x195f66){if(_0x195f66){_0x3067a8=_0x195f66[_0x2c24('0x36')];if(!_0x29e00b['query']['hasOwnProperty'](_0x2c24('0x4c'))){_0x3908de[_0x2c24('0x20')]=qs[_0x2c24('0x20')](_0x29e00b[_0x2c24('0x30')][_0x2c24('0x20')]);_0x3908de[_0x2c24('0x1d')]=qs['offset'](_0x29e00b['query']['offset']);}return _0x3de72e[_0x2c24('0x49')](_0x3908de);}})['then'](function(_0x5dfcec){if(_0x5dfcec){return _0x5dfcec?{'count':_0x3067a8,'rows':_0x5dfcec}:null;}})[_0x2c24('0x24')](respondWithResult(_0x22c127,null))[_0x2c24('0x41')](handleError(_0x22c127,null));};exports['addConfiguration']=function(_0x2d8a9d,_0x28a837,_0x1e3a87){if(_0x2d8a9d[_0x2c24('0x48')]['id']){delete _0x2d8a9d['body']['id'];}return db[_0x2c24('0x2c')][_0x2c24('0x4a')]({'where':{'id':_0x2d8a9d[_0x2c24('0x42')]['id']}})[_0x2c24('0x24')](handleEntityNotFound(_0x28a837,null))[_0x2c24('0x24')](function(_0x4d1b38){if(_0x4d1b38){_0x2d8a9d[_0x2c24('0x48')][_0x2c24('0x4d')]=_0x4d1b38['id'];_0x2d8a9d[_0x2c24('0x48')][_0x2c24('0x4e')]=integrations['getSubjects'](_0x2d8a9d['body'][_0x2c24('0x4f')],_0x2d8a9d[_0x2c24('0x48')][_0x2c24('0x3e')]);_0x2d8a9d['body'][_0x2c24('0x50')]=integrations[_0x2c24('0x51')](_0x2d8a9d[_0x2c24('0x48')][_0x2c24('0x4f')],_0x2d8a9d[_0x2c24('0x48')]['type']);return db['FreshsalesConfiguration'][_0x2c24('0x47')](_0x2d8a9d[_0x2c24('0x48')],{'include':[{'model':db[_0x2c24('0x52')],'as':_0x2c24('0x4e')},{'model':db[_0x2c24('0x52')],'as':_0x2c24('0x50')}]});}return null;})[_0x2c24('0x24')](respondWithResult(_0x28a837,null))[_0x2c24('0x41')](handleError(_0x28a837,null));};exports[_0x2c24('0x53')]=function(_0x5841e3,_0x1ce4b8,_0x178996){var _0x1cb7b1='';var _0x574517='';return db[_0x2c24('0x2c')][_0x2c24('0x4a')]({'where':{'id':_0x5841e3[_0x2c24('0x42')]['id']},'attributes':['id',_0x2c24('0x54'),_0x2c24('0x55'),_0x2c24('0x56')]})[_0x2c24('0x24')](handleEntityNotFound(_0x1ce4b8,null))[_0x2c24('0x24')](function(_0x1805c6){if(_0x1805c6){_0x574517=_0x1805c6[_0x2c24('0x54')];_0x1cb7b1=_0x1805c6['remoteUri'];var _0x2da7ed=_0x1805c6[_0x2c24('0x55')][_0x2c24('0x57')](-0x1);if(_0x2da7ed==='/'){_0x1cb7b1=_0x1cb7b1['substring'](0x0,_0x1cb7b1[_0x2c24('0x58')](_0x2da7ed));}return rp({'method':'GET','uri':util['format'](_0x2c24('0x59'),_0x1cb7b1,'/api/selector/owners'),'headers':{'Authorization':_0x2c24('0x5a')+_0x1805c6[_0x2c24('0x56')]},'json':!![]});}})[_0x2c24('0x24')](function(_0x45f5a7){if(_0x45f5a7){var _0x6c34ff=_0x45f5a7[_0x2c24('0x5b')];var _0x5bdf8c=![];var _0x239d15=null;for(_0x239d15=0x0;_0x239d15<_0x6c34ff[_0x2c24('0x36')];_0x239d15++){if(_0x6c34ff[_0x239d15][_0x2c24('0x5c')]===_0x574517){_0x5bdf8c=!![];}}if(_0x5bdf8c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2c24('0x5d')});}}})[_0x2c24('0x24')](respondWithResult(_0x1ce4b8,null))[_0x2c24('0x41')](function(_0xf40c28){var _0x5361c0=_0x5841e3[_0x2c24('0x30')]['test']?0x1f4:_0xf40c28[_0x2c24('0x5e')]||0x1f4;logger[_0x2c24('0x27')](_0x2c24('0x5f'),_0x2c24('0x53'),_0x5361c0,JSON['stringify'](_0xf40c28));delete _0xf40c28[_0x2c24('0x29')];if(_0x5361c0===0x191){_0x5361c0=0x190;}_0x1ce4b8[_0x2c24('0x1b')](_0x5361c0)[_0x2c24('0x60')](_0x5841e3[_0x2c24('0x30')]['test']?{'message':_0x2c24('0x61'),'statusCode':_0xf40c28[_0x2c24('0x5e')]}:_0xf40c28);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 3e734fd..37376c0 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 _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xfcf0[_0x3c2a69];return _0x596bc8;};'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'));var integrations=require(_0x0fcf('0x9'));module[_0x0fcf('0xa')]=function(_0x1a7b03,_0x61bbb9){return _0x1a7b03[_0x0fcf('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x0fcf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['rimraf','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1fb55e,_0x525eec){var _0x1e2f0a=function(_0x3c9355){while(--_0x3c9355){_0x1fb55e['push'](_0x1fb55e['shift']());}};_0x1e2f0a(++_0x525eec);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x200c95,_0x387ecb){_0x200c95=_0x200c95-0x0;var _0xef7c28=_0xc1c6[_0x200c95];return _0xef7c28;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x6c1c('0x7'));module['exports']=function(_0x50c1bb,_0x582bec){return _0x50c1bb[_0x6c1c('0x8')](_0x6c1c('0x9'),attributes,{'tableName':_0x6c1c('0xa'),'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 2b5009d..0f99b42 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 _0xba34=['request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x5c5ada,_0xbfd4e8){var _0x1bb8c1=function(_0x5695c1){while(--_0x5695c1){_0x5c5ada['push'](_0x5c5ada['shift']());}};_0x1bb8c1(++_0xbfd4e8);}(_0xba34,0x119));var _0x4ba3=function(_0x2b62d2,_0x27d2b3){_0x2b62d2=_0x2b62d2-0x0;var _0x17fdcd=_0xba34[_0x2b62d2];return _0x17fdcd;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});}exports[_0x4ba3('0x18')]=function(_0x5ff7ce){var _0x451c92=this;return new Promise(function(_0x556290,_0x2519bb){return db[_0x4ba3('0x19')][_0x4ba3('0x1a')]({'raw':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ff7ce['options']?_0x5ff7ce['options'][_0x4ba3('0x1d')]||null:null,'attributes':_0x5ff7ce['options']?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1e')]||null:null,'limit':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1f')]||null:null,'include':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce['options'][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x5ff7ce['options'][_0x4ba3('0x20')],function(_0x4ffe39){return{'model':db[_0x4ffe39[_0x4ba3('0x22')]],'as':_0x4ffe39['as'],'attributes':_0x4ffe39[_0x4ba3('0x1e')],'include':_0x4ffe39[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x4ffe39[_0x4ba3('0x20')],function(_0xe29a49){return{'model':db[_0xe29a49[_0x4ba3('0x22')]],'as':_0xe29a49['as'],'attributes':_0xe29a49[_0x4ba3('0x1e')],'include':_0xe29a49[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xe29a49['include'],function(_0x252f37){return{'model':db[_0x252f37[_0x4ba3('0x22')]],'as':_0x252f37['as'],'attributes':_0x252f37[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10537e){logger[_0x4ba3('0xd')](_0x4ba3('0x18'),_0x5ff7ce);logger['debug'](_0x4ba3('0x18'),_0x5ff7ce,JSON[_0x4ba3('0x12')](_0x10537e));_0x556290(_0x10537e);})[_0x4ba3('0x17')](function(_0x22394d){logger['error']('GetFreshsalesAccount',_0x22394d[_0x4ba3('0x15')],_0x5ff7ce);_0x2519bb(_0x451c92[_0x4ba3('0x13')](0x1f4,_0x22394d[_0x4ba3('0x15')]));});});};exports[_0x4ba3('0x23')]=function(_0x2cb5d5){var _0x11f88f=this;return new Promise(function(_0x48b3b7,_0x27444b){return db[_0x4ba3('0x19')][_0x4ba3('0x24')]({'raw':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5['options']['attributes']||null:null,'include':_0x2cb5d5['options']?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0x137f9b){return{'model':db[_0x137f9b[_0x4ba3('0x22')]],'as':_0x137f9b['as'],'attributes':_0x137f9b[_0x4ba3('0x1e')],'include':_0x137f9b[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x137f9b[_0x4ba3('0x20')],function(_0x3439cb){return{'model':db[_0x3439cb['model']],'as':_0x3439cb['as'],'attributes':_0x3439cb[_0x4ba3('0x1e')],'include':_0x3439cb[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x3439cb['include'],function(_0x188f8c){return{'model':db[_0x188f8c['model']],'as':_0x188f8c['as'],'attributes':_0x188f8c[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xc')](function(_0x426e11){logger[_0x4ba3('0xd')](_0x4ba3('0x23'),_0x2cb5d5);logger[_0x4ba3('0x10')]('ShowFreshsalesAccount',_0x2cb5d5,JSON[_0x4ba3('0x12')](_0x426e11));_0x48b3b7(_0x426e11);})[_0x4ba3('0x17')](function(_0x2e77d4){logger['error'](_0x4ba3('0x23'),_0x2e77d4[_0x4ba3('0x15')],_0x2cb5d5);_0x27444b(_0x11f88f['error'](0x1f4,_0x2e77d4[_0x4ba3('0x15')]));});});}; \ No newline at end of file +var _0x77e6=['result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include','model','map','GetFreshsalesAccount','ShowFreshsalesAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message'];(function(_0x4a1a1f,_0x438857){var _0x121600=function(_0x5e4053){while(--_0x5e4053){_0x4a1a1f['push'](_0x4a1a1f['shift']());}};_0x121600(++_0x438857);}(_0x77e6,0x1a6));var _0x677e=function(_0x555bc8,_0x3737d4){_0x555bc8=_0x555bc8-0x0;var _0x23d4f3=_0x77e6[_0x555bc8];return _0x23d4f3;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d314,_0x4d1a57,_0x5a5dd3){return new BPromise(function(_0x2eb40c,_0x4c519f){return client[_0x677e('0xb')](_0x40d314,_0x5a5dd3)[_0x677e('0xc')](function(_0x552931){logger[_0x677e('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x4d1a57,_0x677e('0xe'));logger[_0x677e('0xf')](_0x677e('0x10'),_0x4d1a57,_0x677e('0xe'),JSON[_0x677e('0x11')](_0x552931));if(_0x552931[_0x677e('0x12')]){if(_0x552931[_0x677e('0x12')][_0x677e('0x13')]===0x1f4){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x552931[_0x677e('0x12')][_0x677e('0x15')]);return _0x4c519f(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x4d1a57,_0x552931['error'][_0x677e('0x15')]);return _0x2eb40c(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}else{logger[_0x677e('0xd')](_0x677e('0x14'),_0x4d1a57,_0x677e('0xe'));_0x2eb40c(_0x552931[_0x677e('0x16')][_0x677e('0x15')]);}})[_0x677e('0x17')](function(_0x32d306){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x32d306);_0x4c519f(_0x32d306);});});}exports['GetFreshsalesAccount']=function(_0x1c5124){var _0x2ef2bf=this;return new Promise(function(_0x385b06,_0x221b6d){return db[_0x677e('0x18')][_0x677e('0x19')]({'raw':_0x1c5124['options']?_0x1c5124[_0x677e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1b')]||null:null,'attributes':_0x1c5124['options']?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1c')]||null:null,'limit':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1d')]||null:null,'include':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')]['include']?_['map'](_0x1c5124['options'][_0x677e('0x1e')],function(_0x154fce){return{'model':db[_0x154fce[_0x677e('0x1f')]],'as':_0x154fce['as'],'attributes':_0x154fce[_0x677e('0x1c')],'include':_0x154fce[_0x677e('0x1e')]?_[_0x677e('0x20')](_0x154fce[_0x677e('0x1e')],function(_0x42f2b8){return{'model':db[_0x42f2b8[_0x677e('0x1f')]],'as':_0x42f2b8['as'],'attributes':_0x42f2b8[_0x677e('0x1c')],'include':_0x42f2b8['include']?_['map'](_0x42f2b8[_0x677e('0x1e')],function(_0x184f68){return{'model':db[_0x184f68['model']],'as':_0x184f68['as'],'attributes':_0x184f68[_0x677e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x677e('0xc')](function(_0xf6b3ad){logger[_0x677e('0xd')](_0x677e('0x21'),_0x1c5124);logger[_0x677e('0xf')]('GetFreshsalesAccount',_0x1c5124,JSON[_0x677e('0x11')](_0xf6b3ad));_0x385b06(_0xf6b3ad);})[_0x677e('0x17')](function(_0xeca8e2){logger[_0x677e('0x12')](_0x677e('0x21'),_0xeca8e2[_0x677e('0x15')],_0x1c5124);_0x221b6d(_0x2ef2bf[_0x677e('0x12')](0x1f4,_0xeca8e2[_0x677e('0x15')]));});});};exports[_0x677e('0x22')]=function(_0x4c5113){var _0x22ccfb=this;return new Promise(function(_0x3cac19,_0x2fb815){return db[_0x677e('0x18')][_0x677e('0x23')]({'raw':_0x4c5113[_0x677e('0x1a')]?_0x4c5113[_0x677e('0x1a')][_0x677e('0x24')]===undefined?!![]:![]:!![],'where':_0x4c5113[_0x677e('0x1a')]?_0x4c5113[_0x677e('0x1a')]['where']||null:null,'attributes':_0x4c5113[_0x677e('0x1a')]?_0x4c5113[_0x677e('0x1a')][_0x677e('0x1c')]||null:null,'include':_0x4c5113[_0x677e('0x1a')]?_0x4c5113[_0x677e('0x1a')][_0x677e('0x1e')]?_['map'](_0x4c5113[_0x677e('0x1a')][_0x677e('0x1e')],function(_0x2d0bc0){return{'model':db[_0x2d0bc0['model']],'as':_0x2d0bc0['as'],'attributes':_0x2d0bc0[_0x677e('0x1c')],'include':_0x2d0bc0[_0x677e('0x1e')]?_[_0x677e('0x20')](_0x2d0bc0[_0x677e('0x1e')],function(_0x35c945){return{'model':db[_0x35c945['model']],'as':_0x35c945['as'],'attributes':_0x35c945[_0x677e('0x1c')],'include':_0x35c945[_0x677e('0x1e')]?_[_0x677e('0x20')](_0x35c945[_0x677e('0x1e')],function(_0x548b22){return{'model':db[_0x548b22[_0x677e('0x1f')]],'as':_0x548b22['as'],'attributes':_0x548b22[_0x677e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x677e('0xc')](function(_0x576443){logger['info'](_0x677e('0x22'),_0x4c5113);logger[_0x677e('0xf')]('ShowFreshsalesAccount',_0x4c5113,JSON[_0x677e('0x11')](_0x576443));_0x3cac19(_0x576443);})[_0x677e('0x17')](function(_0x497dca){logger['error'](_0x677e('0x22'),_0x497dca[_0x677e('0x15')],_0x4c5113);_0x2fb815(_0x22ccfb['error'](0x1f4,_0x497dca['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 7350ace..63e400f 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 _0x77da=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/subjects','getDescriptions','/:id/fields','getFields','post','put','update','destroy','multer','util','path'];(function(_0xef2a14,_0x4c359a){var _0x242a4d=function(_0x3227c9){while(--_0x3227c9){_0xef2a14['push'](_0xef2a14['shift']());}};_0x242a4d(++_0x4c359a);}(_0x77da,0x162));var _0xa77d=function(_0x2b94e9,_0xb94360){_0x2b94e9=_0x2b94e9-0x0;var _0x3f4fb4=_0x77da[_0x2b94e9];return _0x3f4fb4;};'use strict';var multer=require(_0xa77d('0x0'));var util=require(_0xa77d('0x1'));var path=require(_0xa77d('0x2'));var timeout=require(_0xa77d('0x3'));var express=require(_0xa77d('0x4'));var router=express[_0xa77d('0x5')]();var fs_extra=require(_0xa77d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa77d('0x7'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0xa77d('0x8')]('/',auth['isAuthenticated'](),controller[_0xa77d('0x9')]);router[_0xa77d('0x8')](_0xa77d('0xa'),auth[_0xa77d('0xb')](),controller[_0xa77d('0xc')]);router[_0xa77d('0x8')](_0xa77d('0xd'),auth[_0xa77d('0xb')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xa77d('0xb')](),controller[_0xa77d('0xe')]);router[_0xa77d('0x8')](_0xa77d('0xf'),auth[_0xa77d('0xb')](),controller[_0xa77d('0x10')]);router[_0xa77d('0x11')]('/',auth[_0xa77d('0xb')](),controller['create']);router[_0xa77d('0x12')](_0xa77d('0xa'),auth['isAuthenticated'](),controller[_0xa77d('0x13')]);router['delete']('/:id',auth[_0xa77d('0xb')](),controller[_0xa77d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3c22=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','getFields','post','create','put','update'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x3c22,0xdb));var _0x23c2=function(_0x55229e,_0x1d115e){_0x55229e=_0x55229e-0x0;var _0x4e938f=_0x3c22[_0x55229e];return _0x4e938f;};'use strict';var multer=require(_0x23c2('0x0'));var util=require(_0x23c2('0x1'));var path=require('path');var timeout=require(_0x23c2('0x2'));var express=require('express');var router=express[_0x23c2('0x3')]();var fs_extra=require(_0x23c2('0x4'));var auth=require(_0x23c2('0x5'));var interaction=require(_0x23c2('0x6'));var config=require(_0x23c2('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x23c2('0x8')]('/',auth[_0x23c2('0x9')](),controller[_0x23c2('0xa')]);router['get'](_0x23c2('0xb'),auth[_0x23c2('0x9')](),controller[_0x23c2('0xc')]);router[_0x23c2('0x8')](_0x23c2('0xd'),auth[_0x23c2('0x9')](),controller['getSubjects']);router['get'](_0x23c2('0xe'),auth['isAuthenticated'](),controller[_0x23c2('0xf')]);router[_0x23c2('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x23c2('0x10')]);router[_0x23c2('0x11')]('/',auth[_0x23c2('0x9')](),controller[_0x23c2('0x12')]);router[_0x23c2('0x13')](_0x23c2('0xb'),auth[_0x23c2('0x9')](),controller[_0x23c2('0x14')]);router[_0x23c2('0x15')](_0x23c2('0xb'),auth[_0x23c2('0x9')](),controller[_0x23c2('0x16')]);module[_0x23c2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 2072fa7..c198a1d 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 _0xd825=['exports','STRING','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd825,0x119));var _0x5d82=function(_0x2bab7d,_0x445f4c){_0x2bab7d=_0x2bab7d-0x0;var _0x27e4f9=_0xd825[_0x2bab7d];return _0x27e4f9;};'use strict';var Sequelize=require(_0x5d82('0x0'));module[_0x5d82('0x1')]={'name':{'type':Sequelize[_0x5d82('0x2')]},'description':{'type':Sequelize[_0x5d82('0x2')]}}; \ No newline at end of file +var _0x6729=['exports','STRING','sequelize'];(function(_0x2134cb,_0x1f95e7){var _0x114e62=function(_0x3885a1){while(--_0x3885a1){_0x2134cb['push'](_0x2134cb['shift']());}};_0x114e62(++_0x1f95e7);}(_0x6729,0x74));var _0x9672=function(_0x141ef3,_0x1c5be7){_0x141ef3=_0x141ef3-0x0;var _0x3c55fd=_0x6729[_0x141ef3];return _0x3c55fd;};'use strict';var Sequelize=require(_0x9672('0x0'));module[_0x9672('0x1')]={'name':{'type':Sequelize[_0x9672('0x2')]},'description':{'type':Sequelize[_0x9672('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 2b7aa1a..a6745c7 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 _0x122c=['type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','includeAll','rows','catch','show','params','keys','length','include','options','find','create','body','FreshsalesField','order','getSubjects','findOne','getDescriptions','getFields','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','map','FreshsalesConfiguration','rawAttributes'];(function(_0x119961,_0x38c0a1){var _0x147fe2=function(_0xd2e914){while(--_0xd2e914){_0x119961['push'](_0x119961['shift']());}};_0x147fe2(++_0x38c0a1);}(_0x122c,0x1dd));var _0xc122=function(_0x539160,_0xf49ca){_0x539160=_0x539160-0x0;var _0x45e1e5=_0x122c[_0x539160];return _0x45e1e5;};'use strict';var emlformat=require(_0xc122('0x0'));var rimraf=require(_0xc122('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc122('0x2'));var moment=require(_0xc122('0x3'));var BPromise=require(_0xc122('0x4'));var Mustache=require(_0xc122('0x5'));var util=require('util');var path=require(_0xc122('0x6'));var sox=require(_0xc122('0x7'));var csv=require(_0xc122('0x8'));var ejs=require(_0xc122('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc122('0xa'));var squel=require(_0xc122('0xb'));var crypto=require('crypto');var jsforce=require(_0xc122('0xc'));var deskjs=require(_0xc122('0xd'));var toCsv=require(_0xc122('0x8'));var querystring=require(_0xc122('0xe'));var Papa=require('papaparse');var Redis=require(_0xc122('0xf'));var authService=require(_0xc122('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc122('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc122('0x12'))('api');var utils=require(_0xc122('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc122('0x14'));var db=require(_0xc122('0x15'))['db'];function respondWithStatusCode(_0x2fcdb2,_0x27f3db){_0x27f3db=_0x27f3db||0xcc;return function(_0x3e41c8){if(_0x3e41c8){return _0x2fcdb2['sendStatus'](_0x27f3db);}return _0x2fcdb2[_0xc122('0x16')](_0x27f3db)[_0xc122('0x17')]();};}function respondWithResult(_0x41754d,_0x3ad441){_0x3ad441=_0x3ad441||0xc8;return function(_0x54a4b5){if(_0x54a4b5){return _0x41754d[_0xc122('0x16')](_0x3ad441)[_0xc122('0x18')](_0x54a4b5);}};}function respondWithFilteredResult(_0x386f4c,_0x3dd0cb){return function(_0x4ea839){if(_0x4ea839){var _0x5972b7=typeof _0x3dd0cb[_0xc122('0x19')]==='undefined'&&typeof _0x3dd0cb[_0xc122('0x1a')]===_0xc122('0x1b');var _0x2aea62=_0x4ea839[_0xc122('0x1c')];var _0x31a98e=_0x5972b7?0x0:_0x3dd0cb[_0xc122('0x19')];var _0x2d994c=_0x5972b7?_0x4ea839['count']:_0x3dd0cb[_0xc122('0x19')]+_0x3dd0cb['limit'];var _0x4d05e8;if(_0x2d994c>=_0x2aea62){_0x2d994c=_0x2aea62;_0x4d05e8=0xc8;}else{_0x4d05e8=0xce;}_0x386f4c[_0xc122('0x16')](_0x4d05e8);return _0x386f4c[_0xc122('0x1d')](_0xc122('0x1e'),_0x31a98e+'-'+_0x2d994c+'/'+_0x2aea62)[_0xc122('0x18')](_0x4ea839);}return null;};}function patchUpdates(_0x24bb9a){return function(_0x5096d7){try{jsonpatch[_0xc122('0x1f')](_0x5096d7,_0x24bb9a,!![]);}catch(_0xc063aa){return BPromise['reject'](_0xc063aa);}return _0x5096d7[_0xc122('0x20')]();};}function saveUpdates(_0x28aa86,_0x24b00f){return function(_0x15e7ed){if(_0x15e7ed){return _0x15e7ed[_0xc122('0x21')](_0x28aa86)[_0xc122('0x22')](function(_0x512b8b){return _0x512b8b;});}return null;};}function removeEntity(_0x4ee22e,_0x1bb363){return function(_0x5f59fa){if(_0x5f59fa){return _0x5f59fa[_0xc122('0x23')]()[_0xc122('0x22')](function(){_0x4ee22e['status'](0xcc)[_0xc122('0x17')]();});}};}function handleEntityNotFound(_0x5437b0,_0x16b203){return function(_0x179801){if(!_0x179801){_0x5437b0['sendStatus'](0x194);}return _0x179801;};}function handleError(_0x2f09be,_0x431bc9){_0x431bc9=_0x431bc9||0x1f4;return function(_0x512019){logger[_0xc122('0x24')](_0x512019['stack']);if(_0x512019['name']){delete _0x512019[_0xc122('0x25')];}_0x2f09be['status'](_0x431bc9)['send'](_0x512019);};}exports['index']=function(_0x1c9eb7,_0x4d1806){var _0x822769={},_0x469a1f={},_0x2b05c0={'count':0x0,'rows':[]};var _0x54909c=_[_0xc122('0x26')](db[_0xc122('0x27')][_0xc122('0x28')],function(_0x2f79b5){return{'name':_0x2f79b5['fieldName'],'type':_0x2f79b5[_0xc122('0x29')][_0xc122('0x2a')]};});_0x469a1f['model']=_[_0xc122('0x26')](_0x54909c,'name');_0x469a1f[_0xc122('0x2b')]=_['keys'](_0x1c9eb7['query']);_0x469a1f['filters']=_[_0xc122('0x2c')](_0x469a1f[_0xc122('0x2d')],_0x469a1f[_0xc122('0x2b')]);_0x822769[_0xc122('0x2e')]=_['intersection'](_0x469a1f[_0xc122('0x2d')],qs[_0xc122('0x2f')](_0x1c9eb7[_0xc122('0x2b')][_0xc122('0x2f')]));_0x822769[_0xc122('0x2e')]=_0x822769[_0xc122('0x2e')]['length']?_0x822769['attributes']:_0x469a1f[_0xc122('0x2d')];if(!_0x1c9eb7[_0xc122('0x2b')][_0xc122('0x30')](_0xc122('0x31'))){_0x822769[_0xc122('0x1a')]=qs[_0xc122('0x1a')](_0x1c9eb7[_0xc122('0x2b')][_0xc122('0x1a')]);_0x822769[_0xc122('0x19')]=qs['offset'](_0x1c9eb7[_0xc122('0x2b')]['offset']);}_0x822769['order']=qs[_0xc122('0x32')](_0x1c9eb7[_0xc122('0x2b')][_0xc122('0x32')]);_0x822769[_0xc122('0x33')]=qs[_0xc122('0x34')](_[_0xc122('0x35')](_0x1c9eb7[_0xc122('0x2b')],_0x469a1f['filters']),_0x54909c);if(_0x1c9eb7['query'][_0xc122('0x36')]){_0x822769[_0xc122('0x33')]=_[_0xc122('0x37')](_0x822769[_0xc122('0x33')],{'$or':_[_0xc122('0x26')](_0x54909c,function(_0xcb45d2){if(_0xcb45d2['type']!=='VIRTUAL'){var _0x5523dc={};_0x5523dc[_0xcb45d2[_0xc122('0x25')]]={'$like':'%'+_0x1c9eb7['query'][_0xc122('0x36')]+'%'};return _0x5523dc;}})});}_0x822769=_['merge']({},_0x822769,_0x1c9eb7['options']);var _0xc76b3a={'where':_0x822769[_0xc122('0x33')]};return db['FreshsalesConfiguration']['count'](_0xc76b3a)[_0xc122('0x22')](function(_0x4fc39e){_0x2b05c0[_0xc122('0x1c')]=_0x4fc39e;if(_0x1c9eb7[_0xc122('0x2b')][_0xc122('0x38')]){_0x822769['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x822769);})[_0xc122('0x22')](function(_0x11e135){_0x2b05c0[_0xc122('0x39')]=_0x11e135;return _0x2b05c0;})[_0xc122('0x22')](respondWithFilteredResult(_0x4d1806,_0x822769))[_0xc122('0x3a')](handleError(_0x4d1806,null));};exports[_0xc122('0x3b')]=function(_0x286ac0,_0x1ed7e2){var _0x5e1a9c={'raw':![],'where':{'id':_0x286ac0[_0xc122('0x3c')]['id']}},_0x291a05={};_0x291a05[_0xc122('0x2d')]=_['keys'](db['FreshsalesConfiguration'][_0xc122('0x28')]);_0x291a05[_0xc122('0x2b')]=_[_0xc122('0x3d')](_0x286ac0[_0xc122('0x2b')]);_0x291a05[_0xc122('0x34')]=_[_0xc122('0x2c')](_0x291a05[_0xc122('0x2d')],_0x291a05['query']);_0x5e1a9c[_0xc122('0x2e')]=_['intersection'](_0x291a05['model'],qs['fields'](_0x286ac0[_0xc122('0x2b')][_0xc122('0x2f')]));_0x5e1a9c[_0xc122('0x2e')]=_0x5e1a9c[_0xc122('0x2e')][_0xc122('0x3e')]?_0x5e1a9c[_0xc122('0x2e')]:_0x291a05[_0xc122('0x2d')];if(_0x286ac0[_0xc122('0x2b')]['includeAll']){_0x5e1a9c[_0xc122('0x3f')]=[{'all':!![]}];}_0x5e1a9c=_[_0xc122('0x37')]({},_0x5e1a9c,_0x286ac0[_0xc122('0x40')]);return db[_0xc122('0x27')][_0xc122('0x41')](_0x5e1a9c)['then'](handleEntityNotFound(_0x1ed7e2,null))[_0xc122('0x22')](respondWithResult(_0x1ed7e2,null))[_0xc122('0x3a')](handleError(_0x1ed7e2,null));};exports[_0xc122('0x42')]=function(_0x3e0053,_0x3f1c20){return db[_0xc122('0x27')][_0xc122('0x42')](_0x3e0053[_0xc122('0x43')],{})[_0xc122('0x22')](respondWithResult(_0x3f1c20,0xc9))[_0xc122('0x3a')](handleError(_0x3f1c20,null));};exports[_0xc122('0x21')]=function(_0x296639,_0x36615b){if(_0x296639['body']['id']){delete _0x296639[_0xc122('0x43')]['id'];}return db[_0xc122('0x27')][_0xc122('0x41')]({'where':{'id':_0x296639[_0xc122('0x3c')]['id']}})[_0xc122('0x22')](handleEntityNotFound(_0x36615b,null))[_0xc122('0x22')](saveUpdates(_0x296639[_0xc122('0x43')],null))[_0xc122('0x22')](respondWithResult(_0x36615b,null))[_0xc122('0x3a')](handleError(_0x36615b,null));};exports[_0xc122('0x23')]=function(_0x4080e4,_0x54535a){return db[_0xc122('0x27')]['find']({'where':{'id':_0x4080e4[_0xc122('0x3c')]['id']}})[_0xc122('0x22')](handleEntityNotFound(_0x54535a,null))[_0xc122('0x22')](removeEntity(_0x54535a,null))[_0xc122('0x3a')](handleError(_0x54535a,null));};exports['getSubjects']=function(_0x1286ad,_0x2a5702,_0x46155b){var _0x4da6ae={};var _0x3116ba={};var _0x5abf29;var _0x16ad6f;return db[_0xc122('0x27')]['findOne']({'where':{'id':_0x1286ad['params']['id']}})[_0xc122('0x22')](handleEntityNotFound(_0x2a5702,null))[_0xc122('0x22')](function(_0x4e11f7){if(_0x4e11f7){_0x5abf29=_0x4e11f7;_0x3116ba[_0xc122('0x2d')]=_[_0xc122('0x3d')](db[_0xc122('0x44')][_0xc122('0x28')]);_0x3116ba[_0xc122('0x2b')]=_[_0xc122('0x3d')](_0x1286ad[_0xc122('0x2b')]);_0x3116ba[_0xc122('0x34')]=_[_0xc122('0x2c')](_0x3116ba['model'],_0x3116ba['query']);_0x4da6ae[_0xc122('0x2e')]=_['intersection'](_0x3116ba[_0xc122('0x2d')],qs[_0xc122('0x2f')](_0x1286ad[_0xc122('0x2b')][_0xc122('0x2f')]));_0x4da6ae[_0xc122('0x2e')]=_0x4da6ae[_0xc122('0x2e')]['length']?_0x4da6ae[_0xc122('0x2e')]:_0x3116ba[_0xc122('0x2d')];_0x4da6ae[_0xc122('0x45')]=qs[_0xc122('0x32')](_0x1286ad[_0xc122('0x2b')][_0xc122('0x32')]);_0x4da6ae['where']=qs['filters'](_[_0xc122('0x35')](_0x1286ad[_0xc122('0x2b')],_0x3116ba[_0xc122('0x34')]));if(_0x1286ad[_0xc122('0x2b')][_0xc122('0x36')]){_0x4da6ae[_0xc122('0x33')]=_[_0xc122('0x37')](_0x4da6ae[_0xc122('0x33')],{'$or':_['map'](_0x4da6ae[_0xc122('0x2e')],function(_0x57651){var _0x339c3f={};_0x339c3f[_0x57651]={'$like':'%'+_0x1286ad[_0xc122('0x2b')]['filter']+'%'};return _0x339c3f;})});}_0x4da6ae=_['merge']({},_0x4da6ae,_0x1286ad['options']);return _0x5abf29[_0xc122('0x46')](_0x4da6ae);}})[_0xc122('0x22')](function(_0x5e298a){if(_0x5e298a){_0x16ad6f=_0x5e298a[_0xc122('0x3e')];if(!_0x1286ad['query'][_0xc122('0x30')](_0xc122('0x31'))){_0x4da6ae[_0xc122('0x1a')]=qs[_0xc122('0x1a')](_0x1286ad[_0xc122('0x2b')][_0xc122('0x1a')]);_0x4da6ae[_0xc122('0x19')]=qs[_0xc122('0x19')](_0x1286ad['query']['offset']);}return _0x5abf29['getSubjects'](_0x4da6ae);}})[_0xc122('0x22')](function(_0x10314d){if(_0x10314d){return _0x10314d?{'count':_0x16ad6f,'rows':_0x10314d}:null;}})['then'](respondWithResult(_0x2a5702,null))['catch'](handleError(_0x2a5702,null));};exports['getDescriptions']=function(_0x3d1c02,_0x44e1b1,_0xdbd7c6){var _0x4ed014={};var _0x545306={};var _0x5f16ad;var _0x1feecb;return db[_0xc122('0x27')][_0xc122('0x47')]({'where':{'id':_0x3d1c02[_0xc122('0x3c')]['id']}})['then'](handleEntityNotFound(_0x44e1b1,null))[_0xc122('0x22')](function(_0x574ebd){if(_0x574ebd){_0x5f16ad=_0x574ebd;_0x545306[_0xc122('0x2d')]=_[_0xc122('0x3d')](db['FreshsalesField'][_0xc122('0x28')]);_0x545306[_0xc122('0x2b')]=_['keys'](_0x3d1c02[_0xc122('0x2b')]);_0x545306[_0xc122('0x34')]=_[_0xc122('0x2c')](_0x545306[_0xc122('0x2d')],_0x545306[_0xc122('0x2b')]);_0x4ed014['attributes']=_[_0xc122('0x2c')](_0x545306[_0xc122('0x2d')],qs['fields'](_0x3d1c02['query']['fields']));_0x4ed014[_0xc122('0x2e')]=_0x4ed014[_0xc122('0x2e')][_0xc122('0x3e')]?_0x4ed014[_0xc122('0x2e')]:_0x545306[_0xc122('0x2d')];_0x4ed014[_0xc122('0x45')]=qs['sort'](_0x3d1c02[_0xc122('0x2b')][_0xc122('0x32')]);_0x4ed014[_0xc122('0x33')]=qs[_0xc122('0x34')](_[_0xc122('0x35')](_0x3d1c02['query'],_0x545306[_0xc122('0x34')]));if(_0x3d1c02[_0xc122('0x2b')][_0xc122('0x36')]){_0x4ed014[_0xc122('0x33')]=_['merge'](_0x4ed014[_0xc122('0x33')],{'$or':_[_0xc122('0x26')](_0x4ed014[_0xc122('0x2e')],function(_0x55c236){var _0x4cc2b2={};_0x4cc2b2[_0x55c236]={'$like':'%'+_0x3d1c02[_0xc122('0x2b')][_0xc122('0x36')]+'%'};return _0x4cc2b2;})});}_0x4ed014=_[_0xc122('0x37')]({},_0x4ed014,_0x3d1c02[_0xc122('0x40')]);return _0x5f16ad[_0xc122('0x48')](_0x4ed014);}})['then'](function(_0x328edd){if(_0x328edd){_0x1feecb=_0x328edd[_0xc122('0x3e')];if(!_0x3d1c02[_0xc122('0x2b')][_0xc122('0x30')](_0xc122('0x31'))){_0x4ed014[_0xc122('0x1a')]=qs[_0xc122('0x1a')](_0x3d1c02[_0xc122('0x2b')][_0xc122('0x1a')]);_0x4ed014[_0xc122('0x19')]=qs[_0xc122('0x19')](_0x3d1c02[_0xc122('0x2b')][_0xc122('0x19')]);}return _0x5f16ad['getDescriptions'](_0x4ed014);}})[_0xc122('0x22')](function(_0x3d4aa8){if(_0x3d4aa8){return _0x3d4aa8?{'count':_0x1feecb,'rows':_0x3d4aa8}:null;}})['then'](respondWithResult(_0x44e1b1,null))['catch'](handleError(_0x44e1b1,null));};exports['getFields']=function(_0x5ee108,_0x298286,_0x226881){var _0x4d58a5={};var _0x2caaa7={};var _0x4b0261;var _0x2a6682;return db[_0xc122('0x27')][_0xc122('0x47')]({'where':{'id':_0x5ee108['params']['id']}})[_0xc122('0x22')](handleEntityNotFound(_0x298286,null))[_0xc122('0x22')](function(_0x1d2077){if(_0x1d2077){_0x4b0261=_0x1d2077;_0x2caaa7[_0xc122('0x2d')]=_[_0xc122('0x3d')](db['FreshsalesField'][_0xc122('0x28')]);_0x2caaa7['query']=_[_0xc122('0x3d')](_0x5ee108[_0xc122('0x2b')]);_0x2caaa7[_0xc122('0x34')]=_[_0xc122('0x2c')](_0x2caaa7[_0xc122('0x2d')],_0x2caaa7[_0xc122('0x2b')]);_0x4d58a5[_0xc122('0x2e')]=_[_0xc122('0x2c')](_0x2caaa7[_0xc122('0x2d')],qs[_0xc122('0x2f')](_0x5ee108[_0xc122('0x2b')][_0xc122('0x2f')]));_0x4d58a5[_0xc122('0x2e')]=_0x4d58a5[_0xc122('0x2e')][_0xc122('0x3e')]?_0x4d58a5[_0xc122('0x2e')]:_0x2caaa7[_0xc122('0x2d')];_0x4d58a5[_0xc122('0x45')]=qs[_0xc122('0x32')](_0x5ee108[_0xc122('0x2b')]['sort']);_0x4d58a5[_0xc122('0x33')]=qs[_0xc122('0x34')](_['pick'](_0x5ee108[_0xc122('0x2b')],_0x2caaa7['filters']));if(_0x5ee108['query'][_0xc122('0x36')]){_0x4d58a5[_0xc122('0x33')]=_[_0xc122('0x37')](_0x4d58a5['where'],{'$or':_['map'](_0x4d58a5['attributes'],function(_0xdb1549){var _0x356271={};_0x356271[_0xdb1549]={'$like':'%'+_0x5ee108[_0xc122('0x2b')][_0xc122('0x36')]+'%'};return _0x356271;})});}_0x4d58a5=_[_0xc122('0x37')]({},_0x4d58a5,_0x5ee108[_0xc122('0x40')]);return _0x4b0261[_0xc122('0x49')](_0x4d58a5);}})[_0xc122('0x22')](function(_0x5099fe){if(_0x5099fe){_0x2a6682=_0x5099fe['length'];if(!_0x5ee108[_0xc122('0x2b')][_0xc122('0x30')](_0xc122('0x31'))){_0x4d58a5[_0xc122('0x1a')]=qs[_0xc122('0x1a')](_0x5ee108[_0xc122('0x2b')][_0xc122('0x1a')]);_0x4d58a5[_0xc122('0x19')]=qs['offset'](_0x5ee108[_0xc122('0x2b')]['offset']);}return _0x4b0261[_0xc122('0x49')](_0x4d58a5);}})[_0xc122('0x22')](function(_0x14187e){if(_0x14187e){return _0x14187e?{'count':_0x2a6682,'rows':_0x14187e}:null;}})[_0xc122('0x22')](respondWithResult(_0x298286,null))[_0xc122('0x3a')](handleError(_0x298286,null));}; \ No newline at end of file +var _0xcc24=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','sendStatus','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','includeAll','catch','create','body','find','params','findOne','FreshsalesField','order','pick','getDescriptions','hasOwnProperty','nolimit','getFields','eml-format'];(function(_0x5e483e,_0x394879){var _0x51017a=function(_0x39a2d0){while(--_0x39a2d0){_0x5e483e['push'](_0x5e483e['shift']());}};_0x51017a(++_0x394879);}(_0xcc24,0x1bb));var _0x4cc2=function(_0x1570dd,_0xca6699){_0x1570dd=_0x1570dd-0x0;var _0x5de0bc=_0xcc24[_0x1570dd];return _0x5de0bc;};'use strict';var emlformat=require(_0x4cc2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4cc2('0x1'));var jsonpatch=require(_0x4cc2('0x2'));var rp=require(_0x4cc2('0x3'));var moment=require('moment');var BPromise=require(_0x4cc2('0x4'));var Mustache=require(_0x4cc2('0x5'));var util=require(_0x4cc2('0x6'));var path=require(_0x4cc2('0x7'));var sox=require(_0x4cc2('0x8'));var csv=require(_0x4cc2('0x9'));var ejs=require(_0x4cc2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4cc2('0xb'));var squel=require('squel');var crypto=require(_0x4cc2('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4cc2('0x9'));var querystring=require(_0x4cc2('0xd'));var Papa=require(_0x4cc2('0xe'));var Redis=require(_0x4cc2('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4cc2('0x10'))(_0x4cc2('0x11'));var utils=require(_0x4cc2('0x12'));var config=require(_0x4cc2('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4cc2('0x14'))['db'];function respondWithStatusCode(_0x1c1dff,_0x294eac){_0x294eac=_0x294eac||0xcc;return function(_0x2c7dc7){if(_0x2c7dc7){return _0x1c1dff['sendStatus'](_0x294eac);}return _0x1c1dff[_0x4cc2('0x15')](_0x294eac)['end']();};}function respondWithResult(_0x401d84,_0x1e35ff){_0x1e35ff=_0x1e35ff||0xc8;return function(_0x4056f5){if(_0x4056f5){return _0x401d84[_0x4cc2('0x15')](_0x1e35ff)[_0x4cc2('0x16')](_0x4056f5);}};}function respondWithFilteredResult(_0x5da9ba,_0x385876){return function(_0x660f6d){if(_0x660f6d){var _0x3af650=typeof _0x385876[_0x4cc2('0x17')]===_0x4cc2('0x18')&&typeof _0x385876[_0x4cc2('0x19')]==='undefined';var _0x351149=_0x660f6d[_0x4cc2('0x1a')];var _0x3a3186=_0x3af650?0x0:_0x385876['offset'];var _0x1df537=_0x3af650?_0x660f6d[_0x4cc2('0x1a')]:_0x385876[_0x4cc2('0x17')]+_0x385876[_0x4cc2('0x19')];var _0xe9a663;if(_0x1df537>=_0x351149){_0x1df537=_0x351149;_0xe9a663=0xc8;}else{_0xe9a663=0xce;}_0x5da9ba[_0x4cc2('0x15')](_0xe9a663);return _0x5da9ba['set'](_0x4cc2('0x1b'),_0x3a3186+'-'+_0x1df537+'/'+_0x351149)['json'](_0x660f6d);}return null;};}function patchUpdates(_0x33cc52){return function(_0x30f1a4){try{jsonpatch['apply'](_0x30f1a4,_0x33cc52,!![]);}catch(_0x39fe04){return BPromise[_0x4cc2('0x1c')](_0x39fe04);}return _0x30f1a4[_0x4cc2('0x1d')]();};}function saveUpdates(_0x57ae24,_0x1e6226){return function(_0x4d81df){if(_0x4d81df){return _0x4d81df[_0x4cc2('0x1e')](_0x57ae24)[_0x4cc2('0x1f')](function(_0x1eb610){return _0x1eb610;});}return null;};}function removeEntity(_0x3a6b09,_0x2d905c){return function(_0x498420){if(_0x498420){return _0x498420['destroy']()[_0x4cc2('0x1f')](function(){_0x3a6b09[_0x4cc2('0x15')](0xcc)[_0x4cc2('0x20')]();});}};}function handleEntityNotFound(_0x142fae,_0x5db1f1){return function(_0x5f2dd7){if(!_0x5f2dd7){_0x142fae[_0x4cc2('0x21')](0x194);}return _0x5f2dd7;};}function handleError(_0x19b97f,_0x354459){_0x354459=_0x354459||0x1f4;return function(_0x596bc6){logger['error'](_0x596bc6[_0x4cc2('0x22')]);if(_0x596bc6[_0x4cc2('0x23')]){delete _0x596bc6[_0x4cc2('0x23')];}_0x19b97f[_0x4cc2('0x15')](_0x354459)[_0x4cc2('0x24')](_0x596bc6);};}exports[_0x4cc2('0x25')]=function(_0x45874d,_0x39d30b){var _0x433a7b={},_0x2ea885={},_0xa48fff={'count':0x0,'rows':[]};var _0x16369d=_[_0x4cc2('0x26')](db[_0x4cc2('0x27')][_0x4cc2('0x28')],function(_0x20cc66){return{'name':_0x20cc66['fieldName'],'type':_0x20cc66['type'][_0x4cc2('0x29')]};});_0x2ea885[_0x4cc2('0x2a')]=_[_0x4cc2('0x26')](_0x16369d,'name');_0x2ea885[_0x4cc2('0x2b')]=_[_0x4cc2('0x2c')](_0x45874d[_0x4cc2('0x2b')]);_0x2ea885[_0x4cc2('0x2d')]=_[_0x4cc2('0x2e')](_0x2ea885[_0x4cc2('0x2a')],_0x2ea885[_0x4cc2('0x2b')]);_0x433a7b['attributes']=_[_0x4cc2('0x2e')](_0x2ea885['model'],qs[_0x4cc2('0x2f')](_0x45874d['query'][_0x4cc2('0x2f')]));_0x433a7b[_0x4cc2('0x30')]=_0x433a7b[_0x4cc2('0x30')][_0x4cc2('0x31')]?_0x433a7b[_0x4cc2('0x30')]:_0x2ea885['model'];if(!_0x45874d['query']['hasOwnProperty']('nolimit')){_0x433a7b[_0x4cc2('0x19')]=qs[_0x4cc2('0x19')](_0x45874d[_0x4cc2('0x2b')]['limit']);_0x433a7b[_0x4cc2('0x17')]=qs[_0x4cc2('0x17')](_0x45874d[_0x4cc2('0x2b')][_0x4cc2('0x17')]);}_0x433a7b['order']=qs[_0x4cc2('0x32')](_0x45874d[_0x4cc2('0x2b')][_0x4cc2('0x32')]);_0x433a7b['where']=qs[_0x4cc2('0x2d')](_['pick'](_0x45874d[_0x4cc2('0x2b')],_0x2ea885[_0x4cc2('0x2d')]),_0x16369d);if(_0x45874d[_0x4cc2('0x2b')]['filter']){_0x433a7b[_0x4cc2('0x33')]=_[_0x4cc2('0x34')](_0x433a7b['where'],{'$or':_[_0x4cc2('0x26')](_0x16369d,function(_0x2d6698){if(_0x2d6698[_0x4cc2('0x35')]!==_0x4cc2('0x36')){var _0x400e49={};_0x400e49[_0x2d6698[_0x4cc2('0x23')]]={'$like':'%'+_0x45874d[_0x4cc2('0x2b')][_0x4cc2('0x37')]+'%'};return _0x400e49;}})});}_0x433a7b=_[_0x4cc2('0x34')]({},_0x433a7b,_0x45874d[_0x4cc2('0x38')]);var _0xfb921d={'where':_0x433a7b[_0x4cc2('0x33')]};return db[_0x4cc2('0x27')][_0x4cc2('0x1a')](_0xfb921d)[_0x4cc2('0x1f')](function(_0x8af6f1){_0xa48fff['count']=_0x8af6f1;if(_0x45874d[_0x4cc2('0x2b')]['includeAll']){_0x433a7b[_0x4cc2('0x39')]=[{'all':!![]}];}return db[_0x4cc2('0x27')][_0x4cc2('0x3a')](_0x433a7b);})['then'](function(_0x55599d){_0xa48fff[_0x4cc2('0x3b')]=_0x55599d;return _0xa48fff;})[_0x4cc2('0x1f')](respondWithFilteredResult(_0x39d30b,_0x433a7b))['catch'](handleError(_0x39d30b,null));};exports['show']=function(_0x2d8cef,_0x1648f2){var _0x245edc={'raw':![],'where':{'id':_0x2d8cef['params']['id']}},_0x4d89c8={};_0x4d89c8[_0x4cc2('0x2a')]=_[_0x4cc2('0x2c')](db['FreshsalesConfiguration'][_0x4cc2('0x28')]);_0x4d89c8[_0x4cc2('0x2b')]=_[_0x4cc2('0x2c')](_0x2d8cef[_0x4cc2('0x2b')]);_0x4d89c8[_0x4cc2('0x2d')]=_['intersection'](_0x4d89c8[_0x4cc2('0x2a')],_0x4d89c8[_0x4cc2('0x2b')]);_0x245edc[_0x4cc2('0x30')]=_[_0x4cc2('0x2e')](_0x4d89c8[_0x4cc2('0x2a')],qs[_0x4cc2('0x2f')](_0x2d8cef[_0x4cc2('0x2b')][_0x4cc2('0x2f')]));_0x245edc[_0x4cc2('0x30')]=_0x245edc['attributes'][_0x4cc2('0x31')]?_0x245edc[_0x4cc2('0x30')]:_0x4d89c8[_0x4cc2('0x2a')];if(_0x2d8cef['query'][_0x4cc2('0x3c')]){_0x245edc[_0x4cc2('0x39')]=[{'all':!![]}];}_0x245edc=_['merge']({},_0x245edc,_0x2d8cef['options']);return db[_0x4cc2('0x27')]['find'](_0x245edc)[_0x4cc2('0x1f')](handleEntityNotFound(_0x1648f2,null))[_0x4cc2('0x1f')](respondWithResult(_0x1648f2,null))[_0x4cc2('0x3d')](handleError(_0x1648f2,null));};exports['create']=function(_0xf198ef,_0x30f1d5){return db[_0x4cc2('0x27')][_0x4cc2('0x3e')](_0xf198ef[_0x4cc2('0x3f')],{})[_0x4cc2('0x1f')](respondWithResult(_0x30f1d5,0xc9))[_0x4cc2('0x3d')](handleError(_0x30f1d5,null));};exports['update']=function(_0x36bf62,_0x35b3f7){if(_0x36bf62[_0x4cc2('0x3f')]['id']){delete _0x36bf62[_0x4cc2('0x3f')]['id'];}return db[_0x4cc2('0x27')][_0x4cc2('0x40')]({'where':{'id':_0x36bf62['params']['id']}})[_0x4cc2('0x1f')](handleEntityNotFound(_0x35b3f7,null))[_0x4cc2('0x1f')](saveUpdates(_0x36bf62[_0x4cc2('0x3f')],null))[_0x4cc2('0x1f')](respondWithResult(_0x35b3f7,null))[_0x4cc2('0x3d')](handleError(_0x35b3f7,null));};exports['destroy']=function(_0x52569b,_0x29627b){return db[_0x4cc2('0x27')][_0x4cc2('0x40')]({'where':{'id':_0x52569b[_0x4cc2('0x41')]['id']}})[_0x4cc2('0x1f')](handleEntityNotFound(_0x29627b,null))[_0x4cc2('0x1f')](removeEntity(_0x29627b,null))[_0x4cc2('0x3d')](handleError(_0x29627b,null));};exports['getSubjects']=function(_0x1d9b22,_0x1b8a60,_0x4629b9){var _0x58c149={};var _0x516420={};var _0x5f4328;var _0xa81833;return db['FreshsalesConfiguration'][_0x4cc2('0x42')]({'where':{'id':_0x1d9b22['params']['id']}})['then'](handleEntityNotFound(_0x1b8a60,null))[_0x4cc2('0x1f')](function(_0x158a58){if(_0x158a58){_0x5f4328=_0x158a58;_0x516420[_0x4cc2('0x2a')]=_[_0x4cc2('0x2c')](db[_0x4cc2('0x43')][_0x4cc2('0x28')]);_0x516420[_0x4cc2('0x2b')]=_['keys'](_0x1d9b22[_0x4cc2('0x2b')]);_0x516420['filters']=_['intersection'](_0x516420[_0x4cc2('0x2a')],_0x516420[_0x4cc2('0x2b')]);_0x58c149[_0x4cc2('0x30')]=_[_0x4cc2('0x2e')](_0x516420[_0x4cc2('0x2a')],qs['fields'](_0x1d9b22[_0x4cc2('0x2b')][_0x4cc2('0x2f')]));_0x58c149[_0x4cc2('0x30')]=_0x58c149[_0x4cc2('0x30')]['length']?_0x58c149['attributes']:_0x516420[_0x4cc2('0x2a')];_0x58c149[_0x4cc2('0x44')]=qs[_0x4cc2('0x32')](_0x1d9b22[_0x4cc2('0x2b')][_0x4cc2('0x32')]);_0x58c149[_0x4cc2('0x33')]=qs[_0x4cc2('0x2d')](_[_0x4cc2('0x45')](_0x1d9b22[_0x4cc2('0x2b')],_0x516420[_0x4cc2('0x2d')]));if(_0x1d9b22[_0x4cc2('0x2b')]['filter']){_0x58c149[_0x4cc2('0x33')]=_[_0x4cc2('0x34')](_0x58c149[_0x4cc2('0x33')],{'$or':_['map'](_0x58c149[_0x4cc2('0x30')],function(_0x4278d2){var _0x453c7c={};_0x453c7c[_0x4278d2]={'$like':'%'+_0x1d9b22[_0x4cc2('0x2b')]['filter']+'%'};return _0x453c7c;})});}_0x58c149=_[_0x4cc2('0x34')]({},_0x58c149,_0x1d9b22[_0x4cc2('0x38')]);return _0x5f4328['getSubjects'](_0x58c149);}})[_0x4cc2('0x1f')](function(_0x2d3a84){if(_0x2d3a84){_0xa81833=_0x2d3a84['length'];if(!_0x1d9b22['query']['hasOwnProperty']('nolimit')){_0x58c149[_0x4cc2('0x19')]=qs[_0x4cc2('0x19')](_0x1d9b22[_0x4cc2('0x2b')]['limit']);_0x58c149[_0x4cc2('0x17')]=qs['offset'](_0x1d9b22[_0x4cc2('0x2b')][_0x4cc2('0x17')]);}return _0x5f4328['getSubjects'](_0x58c149);}})[_0x4cc2('0x1f')](function(_0x3b4393){if(_0x3b4393){return _0x3b4393?{'count':_0xa81833,'rows':_0x3b4393}:null;}})[_0x4cc2('0x1f')](respondWithResult(_0x1b8a60,null))[_0x4cc2('0x3d')](handleError(_0x1b8a60,null));};exports[_0x4cc2('0x46')]=function(_0x2aa368,_0x92eb05,_0x1cec64){var _0x18f5a1={};var _0x2816be={};var _0x3efeac;var _0xc34750;return db['FreshsalesConfiguration'][_0x4cc2('0x42')]({'where':{'id':_0x2aa368[_0x4cc2('0x41')]['id']}})['then'](handleEntityNotFound(_0x92eb05,null))[_0x4cc2('0x1f')](function(_0x31ddec){if(_0x31ddec){_0x3efeac=_0x31ddec;_0x2816be[_0x4cc2('0x2a')]=_[_0x4cc2('0x2c')](db[_0x4cc2('0x43')][_0x4cc2('0x28')]);_0x2816be[_0x4cc2('0x2b')]=_[_0x4cc2('0x2c')](_0x2aa368['query']);_0x2816be['filters']=_[_0x4cc2('0x2e')](_0x2816be[_0x4cc2('0x2a')],_0x2816be[_0x4cc2('0x2b')]);_0x18f5a1['attributes']=_[_0x4cc2('0x2e')](_0x2816be[_0x4cc2('0x2a')],qs[_0x4cc2('0x2f')](_0x2aa368['query'][_0x4cc2('0x2f')]));_0x18f5a1[_0x4cc2('0x30')]=_0x18f5a1[_0x4cc2('0x30')][_0x4cc2('0x31')]?_0x18f5a1[_0x4cc2('0x30')]:_0x2816be[_0x4cc2('0x2a')];_0x18f5a1[_0x4cc2('0x44')]=qs[_0x4cc2('0x32')](_0x2aa368[_0x4cc2('0x2b')][_0x4cc2('0x32')]);_0x18f5a1[_0x4cc2('0x33')]=qs[_0x4cc2('0x2d')](_['pick'](_0x2aa368['query'],_0x2816be[_0x4cc2('0x2d')]));if(_0x2aa368[_0x4cc2('0x2b')][_0x4cc2('0x37')]){_0x18f5a1[_0x4cc2('0x33')]=_[_0x4cc2('0x34')](_0x18f5a1[_0x4cc2('0x33')],{'$or':_[_0x4cc2('0x26')](_0x18f5a1[_0x4cc2('0x30')],function(_0x59e947){var _0x2bbf7d={};_0x2bbf7d[_0x59e947]={'$like':'%'+_0x2aa368[_0x4cc2('0x2b')][_0x4cc2('0x37')]+'%'};return _0x2bbf7d;})});}_0x18f5a1=_[_0x4cc2('0x34')]({},_0x18f5a1,_0x2aa368[_0x4cc2('0x38')]);return _0x3efeac[_0x4cc2('0x46')](_0x18f5a1);}})[_0x4cc2('0x1f')](function(_0x5140f9){if(_0x5140f9){_0xc34750=_0x5140f9[_0x4cc2('0x31')];if(!_0x2aa368[_0x4cc2('0x2b')][_0x4cc2('0x47')](_0x4cc2('0x48'))){_0x18f5a1[_0x4cc2('0x19')]=qs[_0x4cc2('0x19')](_0x2aa368[_0x4cc2('0x2b')][_0x4cc2('0x19')]);_0x18f5a1[_0x4cc2('0x17')]=qs[_0x4cc2('0x17')](_0x2aa368['query'][_0x4cc2('0x17')]);}return _0x3efeac['getDescriptions'](_0x18f5a1);}})[_0x4cc2('0x1f')](function(_0x305b07){if(_0x305b07){return _0x305b07?{'count':_0xc34750,'rows':_0x305b07}:null;}})[_0x4cc2('0x1f')](respondWithResult(_0x92eb05,null))[_0x4cc2('0x3d')](handleError(_0x92eb05,null));};exports[_0x4cc2('0x49')]=function(_0x10b9b8,_0x25e232,_0x59261f){var _0x1fca1d={};var _0x3932c6={};var _0x341cdc;var _0x353862;return db[_0x4cc2('0x27')][_0x4cc2('0x42')]({'where':{'id':_0x10b9b8['params']['id']}})[_0x4cc2('0x1f')](handleEntityNotFound(_0x25e232,null))[_0x4cc2('0x1f')](function(_0x4bbacf){if(_0x4bbacf){_0x341cdc=_0x4bbacf;_0x3932c6[_0x4cc2('0x2a')]=_[_0x4cc2('0x2c')](db[_0x4cc2('0x43')][_0x4cc2('0x28')]);_0x3932c6['query']=_[_0x4cc2('0x2c')](_0x10b9b8[_0x4cc2('0x2b')]);_0x3932c6[_0x4cc2('0x2d')]=_[_0x4cc2('0x2e')](_0x3932c6[_0x4cc2('0x2a')],_0x3932c6['query']);_0x1fca1d[_0x4cc2('0x30')]=_[_0x4cc2('0x2e')](_0x3932c6[_0x4cc2('0x2a')],qs[_0x4cc2('0x2f')](_0x10b9b8['query'][_0x4cc2('0x2f')]));_0x1fca1d[_0x4cc2('0x30')]=_0x1fca1d[_0x4cc2('0x30')][_0x4cc2('0x31')]?_0x1fca1d['attributes']:_0x3932c6['model'];_0x1fca1d[_0x4cc2('0x44')]=qs[_0x4cc2('0x32')](_0x10b9b8[_0x4cc2('0x2b')][_0x4cc2('0x32')]);_0x1fca1d['where']=qs[_0x4cc2('0x2d')](_[_0x4cc2('0x45')](_0x10b9b8[_0x4cc2('0x2b')],_0x3932c6[_0x4cc2('0x2d')]));if(_0x10b9b8[_0x4cc2('0x2b')][_0x4cc2('0x37')]){_0x1fca1d[_0x4cc2('0x33')]=_[_0x4cc2('0x34')](_0x1fca1d['where'],{'$or':_[_0x4cc2('0x26')](_0x1fca1d[_0x4cc2('0x30')],function(_0x84d357){var _0x4200e3={};_0x4200e3[_0x84d357]={'$like':'%'+_0x10b9b8[_0x4cc2('0x2b')][_0x4cc2('0x37')]+'%'};return _0x4200e3;})});}_0x1fca1d=_['merge']({},_0x1fca1d,_0x10b9b8[_0x4cc2('0x38')]);return _0x341cdc[_0x4cc2('0x49')](_0x1fca1d);}})[_0x4cc2('0x1f')](function(_0x3a88c8){if(_0x3a88c8){_0x353862=_0x3a88c8[_0x4cc2('0x31')];if(!_0x10b9b8[_0x4cc2('0x2b')][_0x4cc2('0x47')](_0x4cc2('0x48'))){_0x1fca1d[_0x4cc2('0x19')]=qs['limit'](_0x10b9b8[_0x4cc2('0x2b')]['limit']);_0x1fca1d[_0x4cc2('0x17')]=qs[_0x4cc2('0x17')](_0x10b9b8['query'][_0x4cc2('0x17')]);}return _0x341cdc[_0x4cc2('0x49')](_0x1fca1d);}})[_0x4cc2('0x1f')](function(_0x226318){if(_0x226318){return _0x226318?{'count':_0x353862,'rows':_0x226318}:null;}})[_0x4cc2('0x1f')](respondWithResult(_0x25e232,null))[_0x4cc2('0x3d')](handleError(_0x25e232,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index ea29482..4b01a76 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 _0x4c78=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0x4c78,0x108));var _0x84c7=function(_0x29cd7d,_0x44dc88){_0x29cd7d=_0x29cd7d-0x0;var _0xe1094=_0x4c78[_0x29cd7d];return _0xe1094;};'use strict';var _=require(_0x84c7('0x0'));var util=require(_0x84c7('0x1'));var logger=require(_0x84c7('0x2'))(_0x84c7('0x3'));var moment=require(_0x84c7('0x4'));var BPromise=require(_0x84c7('0x5'));var rp=require(_0x84c7('0x6'));var fs=require('fs');var path=require(_0x84c7('0x7'));var rimraf=require(_0x84c7('0x8'));var config=require(_0x84c7('0x9'));var attributes=require(_0x84c7('0xa'));module['exports']=function(_0x1b397c,_0xaf2f7e){return _0x1b397c[_0x84c7('0xb')](_0x84c7('0xc'),attributes,{'tableName':_0x84c7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f2a=['../../config/environment','exports','define','int_freshsales_configurations','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3fb84f,_0x526d87){var _0x48975c=function(_0x21bcfa){while(--_0x21bcfa){_0x3fb84f['push'](_0x3fb84f['shift']());}};_0x48975c(++_0x526d87);}(_0x0f2a,0x1ab));var _0xa0f2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0f2a[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xa0f2('0x0'));var logger=require(_0xa0f2('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa0f2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0f2('0x3'));var rimraf=require(_0xa0f2('0x4'));var config=require(_0xa0f2('0x5'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xa0f2('0x6')]=function(_0x1e5800,_0x8f69c7){return _0x1e5800[_0xa0f2('0x7')]('FreshsalesConfiguration',attributes,{'tableName':_0xa0f2('0x8'),'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 f5f16d8..3fec17b 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 _0x0935=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x0935,0x1ad));var _0x5093=function(_0x66f5b2,_0x29dbe9){_0x66f5b2=_0x66f5b2-0x0;var _0xf9c0b5=_0x0935[_0x66f5b2];return _0xf9c0b5;};'use strict';var _=require(_0x5093('0x0'));var util=require(_0x5093('0x1'));var moment=require(_0x5093('0x2'));var BPromise=require(_0x5093('0x3'));var rs=require(_0x5093('0x4'));var fs=require('fs');var Redis=require(_0x5093('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5093('0x6'));var logger=require(_0x5093('0x7'))(_0x5093('0x8'));var config=require(_0x5093('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5246fd,_0x4b2cd1,_0x76d8ab){return new BPromise(function(_0x2112f7,_0xb709fe){return client[_0x5093('0xa')](_0x5246fd,_0x76d8ab)[_0x5093('0xb')](function(_0x4972b1){logger[_0x5093('0xc')](_0x5093('0xd'),_0x4b2cd1,_0x5093('0xe'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x4b2cd1,_0x5093('0xe'),JSON['stringify'](_0x4972b1));if(_0x4972b1[_0x5093('0xf')]){if(_0x4972b1['error'][_0x5093('0x10')]===0x1f4){logger[_0x5093('0xf')](_0x5093('0xd'),_0x4b2cd1,_0x4972b1[_0x5093('0xf')][_0x5093('0x11')]);return _0xb709fe(_0x4972b1['error'][_0x5093('0x11')]);}logger[_0x5093('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b2cd1,_0x4972b1[_0x5093('0xf')][_0x5093('0x11')]);return _0x2112f7(_0x4972b1[_0x5093('0xf')][_0x5093('0x11')]);}else{logger[_0x5093('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b2cd1,_0x5093('0xe'));_0x2112f7(_0x4972b1[_0x5093('0x12')][_0x5093('0x11')]);}})[_0x5093('0x13')](function(_0x352f54){logger[_0x5093('0xf')](_0x5093('0xd'),_0x4b2cd1,_0x352f54);_0xb709fe(_0x352f54);});});} \ No newline at end of file +var _0xa941=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x720b96,_0x38ec97){var _0x4f54dc=function(_0x4f64e5){while(--_0x4f64e5){_0x720b96['push'](_0x720b96['shift']());}};_0x4f54dc(++_0x38ec97);}(_0xa941,0xf8));var _0x1a94=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa941[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x1a94('0x0'));var util=require(_0x1a94('0x1'));var moment=require('moment');var BPromise=require(_0x1a94('0x2'));var rs=require(_0x1a94('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a94('0x4'))['db'];var utils=require(_0x1a94('0x5'));var logger=require(_0x1a94('0x6'))(_0x1a94('0x7'));var config=require(_0x1a94('0x8'));var jayson=require(_0x1a94('0x9'));var client=jayson[_0x1a94('0xa')][_0x1a94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1474b4,_0x508528,_0x255c99){return new BPromise(function(_0x5076a4,_0x31149a){return client[_0x1a94('0xc')](_0x1474b4,_0x255c99)[_0x1a94('0xd')](function(_0x190122){logger[_0x1a94('0xe')](_0x1a94('0xf'),_0x508528,_0x1a94('0x10'));logger['debug'](_0x1a94('0x11'),_0x508528,_0x1a94('0x10'),JSON[_0x1a94('0x12')](_0x190122));if(_0x190122[_0x1a94('0x13')]){if(_0x190122[_0x1a94('0x13')][_0x1a94('0x14')]===0x1f4){logger[_0x1a94('0x13')](_0x1a94('0xf'),_0x508528,_0x190122[_0x1a94('0x13')][_0x1a94('0x15')]);return _0x31149a(_0x190122[_0x1a94('0x13')]['message']);}logger['error'](_0x1a94('0xf'),_0x508528,_0x190122[_0x1a94('0x13')][_0x1a94('0x15')]);return _0x5076a4(_0x190122[_0x1a94('0x13')][_0x1a94('0x15')]);}else{logger['info'](_0x1a94('0xf'),_0x508528,_0x1a94('0x10'));_0x5076a4(_0x190122[_0x1a94('0x16')][_0x1a94('0x15')]);}})['catch'](function(_0x1e98ff){logger[_0x1a94('0x13')](_0x1a94('0xf'),_0x508528,_0x1e98ff);_0x31149a(_0x1e98ff);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e302ce9..5b46a38 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 _0xe79f=['isAuthenticated','show','create','update','delete','exports','multer','path','express','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','index','get'];(function(_0x37b934,_0xdb73ca){var _0x33a07c=function(_0x304294){while(--_0x304294){_0x37b934['push'](_0x37b934['shift']());}};_0x33a07c(++_0xdb73ca);}(_0xe79f,0x13a));var _0xfe79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe79f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfe79('0x0'));var util=require('util');var path=require(_0xfe79('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe79('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe79('0x3'));var config=require(_0xfe79('0x4'));var controller=require(_0xfe79('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfe79('0x6')]);router[_0xfe79('0x7')]('/:id',auth[_0xfe79('0x8')](),controller[_0xfe79('0x9')]);router['post']('/',auth[_0xfe79('0x8')](),controller[_0xfe79('0xa')]);router['put']('/:id',auth[_0xfe79('0x8')](),controller[_0xfe79('0xb')]);router[_0xfe79('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfe79('0xd')]=router; \ No newline at end of file +var _0x4fdc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x446e61,_0x27e680){var _0x4160a8=function(_0x1c9171){while(--_0x1c9171){_0x446e61['push'](_0x446e61['shift']());}};_0x4160a8(++_0x27e680);}(_0x4fdc,0x84));var _0xc4fd=function(_0x12a681,_0x155de3){_0x12a681=_0x12a681-0x0;var _0x2ad4ff=_0x4fdc[_0x12a681];return _0x2ad4ff;};'use strict';var multer=require('multer');var util=require(_0xc4fd('0x0'));var path=require('path');var timeout=require(_0xc4fd('0x1'));var express=require(_0xc4fd('0x2'));var router=express[_0xc4fd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc4fd('0x4'));var interaction=require(_0xc4fd('0x5'));var config=require(_0xc4fd('0x6'));var controller=require(_0xc4fd('0x7'));router[_0xc4fd('0x8')]('/',auth[_0xc4fd('0x9')](),controller[_0xc4fd('0xa')]);router['get'](_0xc4fd('0xb'),auth[_0xc4fd('0x9')](),controller['show']);router[_0xc4fd('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc4fd('0xd')](_0xc4fd('0xb'),auth[_0xc4fd('0x9')](),controller[_0xc4fd('0xe')]);router[_0xc4fd('0xf')](_0xc4fd('0xb'),auth[_0xc4fd('0x9')](),controller[_0xc4fd('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index d46e11c..2309e56 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 _0x9fd0=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','string','variable','keyValue'];(function(_0x4e70c4,_0x19b705){var _0xfa6b7f=function(_0x2e5b9a){while(--_0x2e5b9a){_0x4e70c4['push'](_0x4e70c4['shift']());}};_0xfa6b7f(++_0x19b705);}(_0x9fd0,0xd3));var _0x09fd=function(_0x5e979f,_0x463339){_0x5e979f=_0x5e979f-0x0;var _0x5cf830=_0x9fd0[_0x5e979f];return _0x5cf830;};'use strict';var Sequelize=require(_0x09fd('0x0'));module[_0x09fd('0x1')]={'type':{'type':Sequelize['ENUM'](_0x09fd('0x2'),_0x09fd('0x3'),'customVariable',_0x09fd('0x4'),_0x09fd('0x5')),'defaultValue':_0x09fd('0x2')},'content':{'type':Sequelize[_0x09fd('0x6')]},'key':{'type':Sequelize[_0x09fd('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x09fd('0x2'),_0x09fd('0x3'),_0x09fd('0x7'))},'keyContent':{'type':Sequelize[_0x09fd('0x6')]},'idField':{'type':Sequelize[_0x09fd('0x6')]},'nameField':{'type':Sequelize[_0x09fd('0x6')]},'customField':{'type':Sequelize[_0x09fd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x128a=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x3c4895,_0x48b94e){var _0x314112=function(_0x25dc73){while(--_0x25dc73){_0x3c4895['push'](_0x3c4895['shift']());}};_0x314112(++_0x48b94e);}(_0x128a,0x10d));var _0xa128=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x128a[_0x466bc5];return _0x138952;};'use strict';var Sequelize=require(_0xa128('0x0'));module[_0xa128('0x1')]={'type':{'type':Sequelize[_0xa128('0x2')](_0xa128('0x3'),_0xa128('0x4'),_0xa128('0x5'),_0xa128('0x6'),_0xa128('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa128('0x8')]},'keyType':{'type':Sequelize[_0xa128('0x2')](_0xa128('0x3'),_0xa128('0x4'),_0xa128('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa128('0x8')]},'nameField':{'type':Sequelize[_0xa128('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa128('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 93b8ca3..61ac2dc 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 _0xd275=['hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x2dbe0c,_0x425419){var _0x149fbb=function(_0x1dc486){while(--_0x1dc486){_0x2dbe0c['push'](_0x2dbe0c['shift']());}};_0x149fbb(++_0x425419);}(_0xd275,0xfa));var _0x5d27=function(_0x20016c,_0x12ed1d){_0x20016c=_0x20016c-0x0;var _0x223af7=_0xd275[_0x20016c];return _0x223af7;};'use strict';var emlformat=require(_0x5d27('0x0'));var rimraf=require(_0x5d27('0x1'));var zipdir=require(_0x5d27('0x2'));var jsonpatch=require(_0x5d27('0x3'));var rp=require(_0x5d27('0x4'));var moment=require('moment');var BPromise=require(_0x5d27('0x5'));var Mustache=require(_0x5d27('0x6'));var util=require(_0x5d27('0x7'));var path=require(_0x5d27('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5d27('0x9'));var fs=require('fs');var fs_extra=require(_0x5d27('0xa'));var _=require(_0x5d27('0xb'));var squel=require(_0x5d27('0xc'));var crypto=require(_0x5d27('0xd'));var jsforce=require(_0x5d27('0xe'));var deskjs=require(_0x5d27('0xf'));var toCsv=require(_0x5d27('0x10'));var querystring=require(_0x5d27('0x11'));var Papa=require(_0x5d27('0x12'));var Redis=require(_0x5d27('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5d27('0x14'));var as=require(_0x5d27('0x15'));var hardwareService=require(_0x5d27('0x16'));var logger=require('../../config/logger')(_0x5d27('0x17'));var utils=require(_0x5d27('0x18'));var config=require(_0x5d27('0x19'));var licenseUtil=require(_0x5d27('0x1a'));var db=require(_0x5d27('0x1b'))['db'];function respondWithStatusCode(_0x5be6cb,_0x3ec667){_0x3ec667=_0x3ec667||0xcc;return function(_0x59883d){if(_0x59883d){return _0x5be6cb[_0x5d27('0x1c')](_0x3ec667);}return _0x5be6cb[_0x5d27('0x1d')](_0x3ec667)[_0x5d27('0x1e')]();};}function respondWithResult(_0x3450bc,_0x3249d6){_0x3249d6=_0x3249d6||0xc8;return function(_0x1acd9d){if(_0x1acd9d){return _0x3450bc[_0x5d27('0x1d')](_0x3249d6)[_0x5d27('0x1f')](_0x1acd9d);}};}function respondWithFilteredResult(_0x300e8e,_0x3a54d1){return function(_0x1ff75b){if(_0x1ff75b){var _0x331d4c=typeof _0x3a54d1['offset']===_0x5d27('0x20')&&typeof _0x3a54d1[_0x5d27('0x21')]===_0x5d27('0x20');var _0x2904f4=_0x1ff75b[_0x5d27('0x22')];var _0x2b8105=_0x331d4c?0x0:_0x3a54d1[_0x5d27('0x23')];var _0x209e65=_0x331d4c?_0x1ff75b['count']:_0x3a54d1[_0x5d27('0x23')]+_0x3a54d1['limit'];var _0x380a7f;if(_0x209e65>=_0x2904f4){_0x209e65=_0x2904f4;_0x380a7f=0xc8;}else{_0x380a7f=0xce;}_0x300e8e['status'](_0x380a7f);return _0x300e8e[_0x5d27('0x24')]('Content-Range',_0x2b8105+'-'+_0x209e65+'/'+_0x2904f4)['json'](_0x1ff75b);}return null;};}function patchUpdates(_0x2d9e86){return function(_0x30c058){try{jsonpatch[_0x5d27('0x25')](_0x30c058,_0x2d9e86,!![]);}catch(_0x1c810f){return BPromise[_0x5d27('0x26')](_0x1c810f);}return _0x30c058[_0x5d27('0x27')]();};}function saveUpdates(_0x4a6075,_0x321413){return function(_0xaad7b4){if(_0xaad7b4){return _0xaad7b4[_0x5d27('0x28')](_0x4a6075)[_0x5d27('0x29')](function(_0x3f3fc7){return _0x3f3fc7;});}return null;};}function removeEntity(_0x516aa3,_0x5b795c){return function(_0x3591df){if(_0x3591df){return _0x3591df['destroy']()[_0x5d27('0x29')](function(){_0x516aa3['status'](0xcc)[_0x5d27('0x1e')]();});}};}function handleEntityNotFound(_0x2db998,_0x452132){return function(_0x514c2b){if(!_0x514c2b){_0x2db998['sendStatus'](0x194);}return _0x514c2b;};}function handleError(_0x937a16,_0xb6a915){_0xb6a915=_0xb6a915||0x1f4;return function(_0x3d3775){logger['error'](_0x3d3775[_0x5d27('0x2a')]);if(_0x3d3775[_0x5d27('0x2b')]){delete _0x3d3775['name'];}_0x937a16[_0x5d27('0x1d')](_0xb6a915)[_0x5d27('0x2c')](_0x3d3775);};}exports[_0x5d27('0x2d')]=function(_0x2bfe4e,_0x39eaa9){var _0x412aee={},_0x575962={},_0x4d078d={'count':0x0,'rows':[]};var _0x5e0ac6=_['map'](db[_0x5d27('0x2e')][_0x5d27('0x2f')],function(_0x2c93b0){return{'name':_0x2c93b0[_0x5d27('0x30')],'type':_0x2c93b0[_0x5d27('0x31')][_0x5d27('0x32')]};});_0x575962[_0x5d27('0x33')]=_['map'](_0x5e0ac6,_0x5d27('0x2b'));_0x575962[_0x5d27('0x34')]=_[_0x5d27('0x35')](_0x2bfe4e[_0x5d27('0x34')]);_0x575962[_0x5d27('0x36')]=_[_0x5d27('0x37')](_0x575962['model'],_0x575962[_0x5d27('0x34')]);_0x412aee['attributes']=_[_0x5d27('0x37')](_0x575962[_0x5d27('0x33')],qs[_0x5d27('0x38')](_0x2bfe4e[_0x5d27('0x34')]['fields']));_0x412aee['attributes']=_0x412aee[_0x5d27('0x39')]['length']?_0x412aee['attributes']:_0x575962['model'];if(!_0x2bfe4e[_0x5d27('0x34')][_0x5d27('0x3a')]('nolimit')){_0x412aee['limit']=qs[_0x5d27('0x21')](_0x2bfe4e[_0x5d27('0x34')][_0x5d27('0x21')]);_0x412aee[_0x5d27('0x23')]=qs['offset'](_0x2bfe4e[_0x5d27('0x34')][_0x5d27('0x23')]);}_0x412aee['order']=qs[_0x5d27('0x3b')](_0x2bfe4e[_0x5d27('0x34')][_0x5d27('0x3b')]);_0x412aee[_0x5d27('0x3c')]=qs[_0x5d27('0x36')](_[_0x5d27('0x3d')](_0x2bfe4e['query'],_0x575962[_0x5d27('0x36')]),_0x5e0ac6);if(_0x2bfe4e[_0x5d27('0x34')][_0x5d27('0x3e')]){_0x412aee['where']=_['merge'](_0x412aee[_0x5d27('0x3c')],{'$or':_['map'](_0x5e0ac6,function(_0x542362){if(_0x542362[_0x5d27('0x31')]!==_0x5d27('0x3f')){var _0x4580a0={};_0x4580a0[_0x542362[_0x5d27('0x2b')]]={'$like':'%'+_0x2bfe4e[_0x5d27('0x34')][_0x5d27('0x3e')]+'%'};return _0x4580a0;}})});}_0x412aee=_[_0x5d27('0x40')]({},_0x412aee,_0x2bfe4e[_0x5d27('0x41')]);var _0x116d61={'where':_0x412aee[_0x5d27('0x3c')]};return db[_0x5d27('0x2e')][_0x5d27('0x22')](_0x116d61)[_0x5d27('0x29')](function(_0x5f16fb){_0x4d078d[_0x5d27('0x22')]=_0x5f16fb;if(_0x2bfe4e[_0x5d27('0x34')]['includeAll']){_0x412aee[_0x5d27('0x42')]=[{'all':!![]}];}return db[_0x5d27('0x2e')][_0x5d27('0x43')](_0x412aee);})[_0x5d27('0x29')](function(_0x980d5c){_0x4d078d[_0x5d27('0x44')]=_0x980d5c;return _0x4d078d;})[_0x5d27('0x29')](respondWithFilteredResult(_0x39eaa9,_0x412aee))[_0x5d27('0x45')](handleError(_0x39eaa9,null));};exports[_0x5d27('0x46')]=function(_0x45d2cf,_0x7bd8de){var _0x3eee70={'raw':!![],'where':{'id':_0x45d2cf[_0x5d27('0x47')]['id']}},_0x164e32={};_0x164e32[_0x5d27('0x33')]=_['keys'](db[_0x5d27('0x2e')][_0x5d27('0x2f')]);_0x164e32['query']=_['keys'](_0x45d2cf[_0x5d27('0x34')]);_0x164e32['filters']=_['intersection'](_0x164e32['model'],_0x164e32[_0x5d27('0x34')]);_0x3eee70['attributes']=_[_0x5d27('0x37')](_0x164e32[_0x5d27('0x33')],qs[_0x5d27('0x38')](_0x45d2cf[_0x5d27('0x34')][_0x5d27('0x38')]));_0x3eee70[_0x5d27('0x39')]=_0x3eee70[_0x5d27('0x39')][_0x5d27('0x48')]?_0x3eee70['attributes']:_0x164e32[_0x5d27('0x33')];if(_0x45d2cf[_0x5d27('0x34')][_0x5d27('0x49')]){_0x3eee70[_0x5d27('0x42')]=[{'all':!![]}];}_0x3eee70=_[_0x5d27('0x40')]({},_0x3eee70,_0x45d2cf['options']);return db[_0x5d27('0x2e')][_0x5d27('0x4a')](_0x3eee70)['then'](handleEntityNotFound(_0x7bd8de,null))[_0x5d27('0x29')](respondWithResult(_0x7bd8de,null))[_0x5d27('0x45')](handleError(_0x7bd8de,null));};exports['create']=function(_0x1af77a,_0xfd809){return db[_0x5d27('0x2e')][_0x5d27('0x4b')](_0x1af77a['body'],{})[_0x5d27('0x29')](respondWithResult(_0xfd809,0xc9))[_0x5d27('0x45')](handleError(_0xfd809,null));};exports[_0x5d27('0x28')]=function(_0x4643ee,_0x3970ea){if(_0x4643ee['body']['id']){delete _0x4643ee[_0x5d27('0x4c')]['id'];}return db[_0x5d27('0x2e')]['find']({'where':{'id':_0x4643ee['params']['id']}})[_0x5d27('0x29')](handleEntityNotFound(_0x3970ea,null))[_0x5d27('0x29')](saveUpdates(_0x4643ee[_0x5d27('0x4c')],null))[_0x5d27('0x29')](respondWithResult(_0x3970ea,null))[_0x5d27('0x45')](handleError(_0x3970ea,null));};exports['destroy']=function(_0x2d48ab,_0x2a703a){return db[_0x5d27('0x2e')]['find']({'where':{'id':_0x2d48ab['params']['id']}})[_0x5d27('0x29')](handleEntityNotFound(_0x2a703a,null))[_0x5d27('0x29')](removeEntity(_0x2a703a,null))[_0x5d27('0x45')](handleError(_0x2a703a,null));}; \ No newline at end of file +var _0x7244=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','options','findAll','rows','catch','show','params','includeAll','include','create','body'];(function(_0x2b5ed4,_0x3ad3bf){var _0x1bcd06=function(_0x47bcd8){while(--_0x47bcd8){_0x2b5ed4['push'](_0x2b5ed4['shift']());}};_0x1bcd06(++_0x3ad3bf);}(_0x7244,0x187));var _0x4724=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x7244[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0x4724('0x0'));var rimraf=require(_0x4724('0x1'));var zipdir=require(_0x4724('0x2'));var jsonpatch=require(_0x4724('0x3'));var rp=require(_0x4724('0x4'));var moment=require(_0x4724('0x5'));var BPromise=require(_0x4724('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4724('0x7'));var sox=require(_0x4724('0x8'));var csv=require(_0x4724('0x9'));var ejs=require(_0x4724('0xa'));var fs=require('fs');var fs_extra=require(_0x4724('0xb'));var _=require(_0x4724('0xc'));var squel=require('squel');var crypto=require(_0x4724('0xd'));var jsforce=require(_0x4724('0xe'));var deskjs=require(_0x4724('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4724('0x10'));var Papa=require(_0x4724('0x11'));var Redis=require(_0x4724('0x12'));var authService=require(_0x4724('0x13'));var qs=require(_0x4724('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4724('0x15'));var logger=require(_0x4724('0x16'))(_0x4724('0x17'));var utils=require('../../config/utils');var config=require(_0x4724('0x18'));var licenseUtil=require(_0x4724('0x19'));var db=require(_0x4724('0x1a'))['db'];function respondWithStatusCode(_0x2e23ae,_0x1f8048){_0x1f8048=_0x1f8048||0xcc;return function(_0x35fc6f){if(_0x35fc6f){return _0x2e23ae[_0x4724('0x1b')](_0x1f8048);}return _0x2e23ae['status'](_0x1f8048)[_0x4724('0x1c')]();};}function respondWithResult(_0x22d88b,_0x725882){_0x725882=_0x725882||0xc8;return function(_0x38253e){if(_0x38253e){return _0x22d88b['status'](_0x725882)['json'](_0x38253e);}};}function respondWithFilteredResult(_0x57436a,_0x39c089){return function(_0x526927){if(_0x526927){var _0x64254f=typeof _0x39c089[_0x4724('0x1d')]==='undefined'&&typeof _0x39c089[_0x4724('0x1e')]===_0x4724('0x1f');var _0x1f41b1=_0x526927[_0x4724('0x20')];var _0x346854=_0x64254f?0x0:_0x39c089['offset'];var _0x2ecf77=_0x64254f?_0x526927[_0x4724('0x20')]:_0x39c089['offset']+_0x39c089[_0x4724('0x1e')];var _0x3d80be;if(_0x2ecf77>=_0x1f41b1){_0x2ecf77=_0x1f41b1;_0x3d80be=0xc8;}else{_0x3d80be=0xce;}_0x57436a[_0x4724('0x21')](_0x3d80be);return _0x57436a[_0x4724('0x22')](_0x4724('0x23'),_0x346854+'-'+_0x2ecf77+'/'+_0x1f41b1)[_0x4724('0x24')](_0x526927);}return null;};}function patchUpdates(_0x174954){return function(_0x39633f){try{jsonpatch['apply'](_0x39633f,_0x174954,!![]);}catch(_0x509747){return BPromise[_0x4724('0x25')](_0x509747);}return _0x39633f[_0x4724('0x26')]();};}function saveUpdates(_0x2a65ec,_0x5ce0f1){return function(_0x296688){if(_0x296688){return _0x296688[_0x4724('0x27')](_0x2a65ec)[_0x4724('0x28')](function(_0x5ae6d7){return _0x5ae6d7;});}return null;};}function removeEntity(_0x2396a8,_0x2f3f1d){return function(_0x48f5f4){if(_0x48f5f4){return _0x48f5f4[_0x4724('0x29')]()[_0x4724('0x28')](function(){_0x2396a8[_0x4724('0x21')](0xcc)[_0x4724('0x1c')]();});}};}function handleEntityNotFound(_0x112c63,_0x5e9411){return function(_0x1afb5d){if(!_0x1afb5d){_0x112c63[_0x4724('0x1b')](0x194);}return _0x1afb5d;};}function handleError(_0x1dfb45,_0x24e631){_0x24e631=_0x24e631||0x1f4;return function(_0x42767f){logger[_0x4724('0x2a')](_0x42767f[_0x4724('0x2b')]);if(_0x42767f[_0x4724('0x2c')]){delete _0x42767f['name'];}_0x1dfb45[_0x4724('0x21')](_0x24e631)[_0x4724('0x2d')](_0x42767f);};}exports[_0x4724('0x2e')]=function(_0x2a04e5,_0x9d1b12){var _0x2d71d9={},_0x345adb={},_0x368a52={'count':0x0,'rows':[]};var _0x19fad1=_[_0x4724('0x2f')](db[_0x4724('0x30')][_0x4724('0x31')],function(_0x21158d){return{'name':_0x21158d[_0x4724('0x32')],'type':_0x21158d[_0x4724('0x33')][_0x4724('0x34')]};});_0x345adb[_0x4724('0x35')]=_[_0x4724('0x2f')](_0x19fad1,_0x4724('0x2c'));_0x345adb[_0x4724('0x36')]=_[_0x4724('0x37')](_0x2a04e5[_0x4724('0x36')]);_0x345adb['filters']=_[_0x4724('0x38')](_0x345adb[_0x4724('0x35')],_0x345adb[_0x4724('0x36')]);_0x2d71d9[_0x4724('0x39')]=_[_0x4724('0x38')](_0x345adb['model'],qs[_0x4724('0x3a')](_0x2a04e5['query'][_0x4724('0x3a')]));_0x2d71d9[_0x4724('0x39')]=_0x2d71d9[_0x4724('0x39')][_0x4724('0x3b')]?_0x2d71d9[_0x4724('0x39')]:_0x345adb[_0x4724('0x35')];if(!_0x2a04e5[_0x4724('0x36')][_0x4724('0x3c')](_0x4724('0x3d'))){_0x2d71d9[_0x4724('0x1e')]=qs[_0x4724('0x1e')](_0x2a04e5[_0x4724('0x36')][_0x4724('0x1e')]);_0x2d71d9[_0x4724('0x1d')]=qs[_0x4724('0x1d')](_0x2a04e5[_0x4724('0x36')]['offset']);}_0x2d71d9['order']=qs[_0x4724('0x3e')](_0x2a04e5[_0x4724('0x36')][_0x4724('0x3e')]);_0x2d71d9['where']=qs['filters'](_[_0x4724('0x3f')](_0x2a04e5[_0x4724('0x36')],_0x345adb[_0x4724('0x40')]),_0x19fad1);if(_0x2a04e5[_0x4724('0x36')][_0x4724('0x41')]){_0x2d71d9['where']=_['merge'](_0x2d71d9[_0x4724('0x42')],{'$or':_['map'](_0x19fad1,function(_0x2f194b){if(_0x2f194b[_0x4724('0x33')]!=='VIRTUAL'){var _0x3857b3={};_0x3857b3[_0x2f194b[_0x4724('0x2c')]]={'$like':'%'+_0x2a04e5[_0x4724('0x36')]['filter']+'%'};return _0x3857b3;}})});}_0x2d71d9=_['merge']({},_0x2d71d9,_0x2a04e5[_0x4724('0x43')]);var _0xe0e16c={'where':_0x2d71d9[_0x4724('0x42')]};return db[_0x4724('0x30')][_0x4724('0x20')](_0xe0e16c)[_0x4724('0x28')](function(_0x419bf3){_0x368a52['count']=_0x419bf3;if(_0x2a04e5[_0x4724('0x36')]['includeAll']){_0x2d71d9['include']=[{'all':!![]}];}return db[_0x4724('0x30')][_0x4724('0x44')](_0x2d71d9);})['then'](function(_0x8b18de){_0x368a52[_0x4724('0x45')]=_0x8b18de;return _0x368a52;})[_0x4724('0x28')](respondWithFilteredResult(_0x9d1b12,_0x2d71d9))[_0x4724('0x46')](handleError(_0x9d1b12,null));};exports[_0x4724('0x47')]=function(_0xa2131c,_0x2685b4){var _0x21d7af={'raw':!![],'where':{'id':_0xa2131c[_0x4724('0x48')]['id']}},_0x2a75ac={};_0x2a75ac['model']=_['keys'](db['FreshsalesField'][_0x4724('0x31')]);_0x2a75ac[_0x4724('0x36')]=_[_0x4724('0x37')](_0xa2131c[_0x4724('0x36')]);_0x2a75ac['filters']=_[_0x4724('0x38')](_0x2a75ac[_0x4724('0x35')],_0x2a75ac[_0x4724('0x36')]);_0x21d7af[_0x4724('0x39')]=_[_0x4724('0x38')](_0x2a75ac[_0x4724('0x35')],qs['fields'](_0xa2131c[_0x4724('0x36')][_0x4724('0x3a')]));_0x21d7af['attributes']=_0x21d7af['attributes']['length']?_0x21d7af[_0x4724('0x39')]:_0x2a75ac['model'];if(_0xa2131c['query'][_0x4724('0x49')]){_0x21d7af[_0x4724('0x4a')]=[{'all':!![]}];}_0x21d7af=_['merge']({},_0x21d7af,_0xa2131c['options']);return db[_0x4724('0x30')]['find'](_0x21d7af)['then'](handleEntityNotFound(_0x2685b4,null))[_0x4724('0x28')](respondWithResult(_0x2685b4,null))[_0x4724('0x46')](handleError(_0x2685b4,null));};exports[_0x4724('0x4b')]=function(_0x24e95d,_0x470c67){return db[_0x4724('0x30')][_0x4724('0x4b')](_0x24e95d[_0x4724('0x4c')],{})[_0x4724('0x28')](respondWithResult(_0x470c67,0xc9))[_0x4724('0x46')](handleError(_0x470c67,null));};exports['update']=function(_0x1985db,_0x5cac87){if(_0x1985db['body']['id']){delete _0x1985db['body']['id'];}return db[_0x4724('0x30')][_0x4724('0x4d')]({'where':{'id':_0x1985db['params']['id']}})[_0x4724('0x28')](handleEntityNotFound(_0x5cac87,null))['then'](saveUpdates(_0x1985db['body'],null))[_0x4724('0x28')](respondWithResult(_0x5cac87,null))[_0x4724('0x46')](handleError(_0x5cac87,null));};exports[_0x4724('0x29')]=function(_0x4c39dc,_0x359df2){return db['FreshsalesField'][_0x4724('0x4d')]({'where':{'id':_0x4c39dc['params']['id']}})[_0x4724('0x28')](handleEntityNotFound(_0x359df2,null))[_0x4724('0x28')](removeEntity(_0x359df2,null))['catch'](handleError(_0x359df2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index b80f310..a476e07 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 _0x38b2=['./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x1c758d,_0x14c05c){var _0x432d62=function(_0x5d479e){while(--_0x5d479e){_0x1c758d['push'](_0x1c758d['shift']());}};_0x432d62(++_0x14c05c);}(_0x38b2,0xf6));var _0x238b=function(_0x2f39f7,_0x4a8bec){_0x2f39f7=_0x2f39f7-0x0;var _0x586ba4=_0x38b2[_0x2f39f7];return _0x586ba4;};'use strict';var _=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var logger=require(_0x238b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x238b('0x3'));var rp=require(_0x238b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x238b('0x5'));var config=require('../../config/environment');var attributes=require(_0x238b('0x6'));module[_0x238b('0x7')]=function(_0x2fb980,_0xb6f089){return _0x2fb980['define'](_0x238b('0x8'),attributes,{'tableName':_0x238b('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x238b('0xa'),_0x238b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0cfa=['freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields'];(function(_0xd5ccb5,_0x4eb236){var _0x5d09ba=function(_0xe8692b){while(--_0xe8692b){_0xd5ccb5['push'](_0xd5ccb5['shift']());}};_0x5d09ba(++_0x4eb236);}(_0x0cfa,0x73));var _0xa0cf=function(_0x467f87,_0x2476bf){_0x467f87=_0x467f87-0x0;var _0x4a542f=_0x0cfa[_0x467f87];return _0x4a542f;};'use strict';var _=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var logger=require(_0xa0cf('0x2'))(_0xa0cf('0x3'));var moment=require(_0xa0cf('0x4'));var BPromise=require(_0xa0cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0cf('0x6'));var rimraf=require('rimraf');var config=require(_0xa0cf('0x7'));var attributes=require(_0xa0cf('0x8'));module[_0xa0cf('0x9')]=function(_0x265c33,_0x848d37){return _0x265c33[_0xa0cf('0xa')](_0xa0cf('0xb'),attributes,{'tableName':_0xa0cf('0xc'),'paranoid':![],'indexes':[{'name':_0xa0cf('0xd'),'fields':[_0xa0cf('0xe'),_0xa0cf('0xf')],'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 86c8620..614cbf4 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 _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x1d003d,_0x1899e1){var _0x193712=function(_0x4e1395){while(--_0x4e1395){_0x1d003d['push'](_0x1d003d['shift']());}};_0x193712(++_0x1899e1);}(_0x187d,0x93));var _0xd187=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x187d[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +var _0x9536=['request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesField,\x20%s,\x20%s'];(function(_0x22d7c7,_0x361517){var _0x5ac42f=function(_0x37976f){while(--_0x37976f){_0x22d7c7['push'](_0x22d7c7['shift']());}};_0x5ac42f(++_0x361517);}(_0x9536,0x179));var _0x6953=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x9536[_0x5c5c52];return _0x4229ff;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a914cd8..3477427 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1533b0,_0x4dbe30){var _0x951fdc=function(_0x3a8a4d){while(--_0x3a8a4d){_0x1533b0['push'](_0x1533b0['shift']());}};_0x951fdc(++_0x4dbe30);}(_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('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x471168,_0xd34f6e){var _0x19e788=function(_0x3a16ed){while(--_0x3a16ed){_0x471168['push'](_0x471168['shift']());}};_0x19e788(++_0xd34f6e);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 8822c3d..9f7c0fb 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 _0x803f=['exports','STRING','username','ENUM','newTab','integrationTab'];(function(_0x1cae60,_0xdc95d9){var _0x523af0=function(_0x288723){while(--_0x288723){_0x1cae60['push'](_0x1cae60['shift']());}};_0x523af0(++_0xdc95d9);}(_0x803f,0x144));var _0xf803=function(_0x3782f7,_0x34dfe6){_0x3782f7=_0x3782f7-0x0;var _0x54aee2=_0x803f[_0x3782f7];return _0x54aee2;};'use strict';var Sequelize=require('sequelize');module[_0xf803('0x0')]={'name':{'type':Sequelize[_0xf803('0x1')]},'description':{'type':Sequelize[_0xf803('0x1')]},'username':{'type':Sequelize[_0xf803('0x1')],'unique':_0xf803('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf803('0x1')]},'clientId':{'type':Sequelize[_0xf803('0x1')]},'clientSecret':{'type':Sequelize[_0xf803('0x1')]},'securityToken':{'type':Sequelize[_0xf803('0x1')]},'serverUrl':{'type':Sequelize[_0xf803('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf803('0x3')]('integrationTab',_0xf803('0x4')),'defaultValue':_0xf803('0x5')}}; \ No newline at end of file +var _0xbe51=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x29a29f,_0x155ce7){var _0x443ea3=function(_0xe0dd24){while(--_0xe0dd24){_0x29a29f['push'](_0x29a29f['shift']());}};_0x443ea3(++_0x155ce7);}(_0xbe51,0x1e2));var _0x1be5=function(_0x573ac1,_0x5a2469){_0x573ac1=_0x573ac1-0x0;var _0x2f47ef=_0xbe51[_0x573ac1];return _0x2f47ef;};'use strict';var Sequelize=require(_0x1be5('0x0'));module[_0x1be5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1be5('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1be5('0x3')},'remoteUri':{'type':Sequelize[_0x1be5('0x2')]},'password':{'type':Sequelize[_0x1be5('0x2')]},'clientId':{'type':Sequelize[_0x1be5('0x2')]},'clientSecret':{'type':Sequelize[_0x1be5('0x2')]},'securityToken':{'type':Sequelize[_0x1be5('0x2')]},'serverUrl':{'type':Sequelize[_0x1be5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1be5('0x4')](_0x1be5('0x5'),_0x1be5('0x6')),'defaultValue':_0x1be5('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 7f9ace2..c20eeb2 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 _0xe0e7=['True','true','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','apply','reject','save','update','sendStatus','name','send','index','map','SalesforceAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','addConfiguration','AccountId','channel','Descriptions','SalesforceConfiguration','SalesforceField','Subjects','getFields','remoteUri','clientId','username','securityToken','slice','substring','lastIndexOf','Connection','clientSecret','password','concat','isNil','ticketType','describe','ActivityDate','IsRecurrence','Description','string','int','picklist','boolean','phone','remove','includes','label','custom','picklistValues'];(function(_0x736eb,_0x345088){var _0x30ea13=function(_0xbdab7c){while(--_0xbdab7c){_0x736eb['push'](_0x736eb['shift']());}};_0x30ea13(++_0x345088);}(_0xe0e7,0x80));var _0x7e0e=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0xe0e7[_0xa60623];return _0x4a6487;};'use strict';var emlformat=require(_0x7e0e('0x0'));var rimraf=require(_0x7e0e('0x1'));var zipdir=require(_0x7e0e('0x2'));var jsonpatch=require(_0x7e0e('0x3'));var rp=require(_0x7e0e('0x4'));var moment=require(_0x7e0e('0x5'));var BPromise=require(_0x7e0e('0x6'));var Mustache=require(_0x7e0e('0x7'));var util=require(_0x7e0e('0x8'));var path=require('path');var sox=require(_0x7e0e('0x9'));var csv=require('to-csv');var ejs=require(_0x7e0e('0xa'));var fs=require('fs');var fs_extra=require(_0x7e0e('0xb'));var _=require(_0x7e0e('0xc'));var squel=require(_0x7e0e('0xd'));var crypto=require(_0x7e0e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7e0e('0xf'));var toCsv=require(_0x7e0e('0x10'));var querystring=require(_0x7e0e('0x11'));var Papa=require(_0x7e0e('0x12'));var Redis=require(_0x7e0e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7e0e('0x14'));var as=require(_0x7e0e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e0e('0x16'))('api');var utils=require(_0x7e0e('0x17'));var config=require(_0x7e0e('0x18'));var licenseUtil=require(_0x7e0e('0x19'));var db=require(_0x7e0e('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x18dfb1,_0xb58641){_0xb58641=_0xb58641||0xcc;return function(_0x4d68a3){if(_0x4d68a3){return _0x18dfb1['sendStatus'](_0xb58641);}return _0x18dfb1[_0x7e0e('0x1b')](_0xb58641)['end']();};}function respondWithResult(_0x370325,_0x5d6ec7){_0x5d6ec7=_0x5d6ec7||0xc8;return function(_0x53a670){if(_0x53a670){return _0x370325[_0x7e0e('0x1b')](_0x5d6ec7)[_0x7e0e('0x1c')](_0x53a670);}};}function respondWithFilteredResult(_0x43b499,_0x9c6cda){return function(_0x2103e0){if(_0x2103e0){var _0x52f496=typeof _0x9c6cda[_0x7e0e('0x1d')]==='undefined'&&typeof _0x9c6cda[_0x7e0e('0x1e')]===_0x7e0e('0x1f');var _0x165076=_0x2103e0[_0x7e0e('0x20')];var _0x18a53b=_0x52f496?0x0:_0x9c6cda['offset'];var _0x493b3d=_0x52f496?_0x2103e0['count']:_0x9c6cda[_0x7e0e('0x1d')]+_0x9c6cda[_0x7e0e('0x1e')];var _0x5798a8;if(_0x493b3d>=_0x165076){_0x493b3d=_0x165076;_0x5798a8=0xc8;}else{_0x5798a8=0xce;}_0x43b499['status'](_0x5798a8);return _0x43b499[_0x7e0e('0x21')]('Content-Range',_0x18a53b+'-'+_0x493b3d+'/'+_0x165076)[_0x7e0e('0x1c')](_0x2103e0);}return null;};}function patchUpdates(_0xa131ea){return function(_0x5b388e){try{jsonpatch[_0x7e0e('0x22')](_0x5b388e,_0xa131ea,!![]);}catch(_0x522a1b){return BPromise[_0x7e0e('0x23')](_0x522a1b);}return _0x5b388e[_0x7e0e('0x24')]();};}function saveUpdates(_0x2e89a7,_0x4ac68f){return function(_0x15920c){if(_0x15920c){return _0x15920c[_0x7e0e('0x25')](_0x2e89a7)['then'](function(_0x539589){return _0x539589;});}return null;};}function removeEntity(_0x2de9ad,_0x2c7c8e){return function(_0x21de3f){if(_0x21de3f){return _0x21de3f['destroy']()['then'](function(){_0x2de9ad[_0x7e0e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50a388,_0x3097fc){return function(_0x35a090){if(!_0x35a090){_0x50a388[_0x7e0e('0x26')](0x194);}return _0x35a090;};}function handleError(_0xad15ee,_0x3f57ab){_0x3f57ab=_0x3f57ab||0x1f4;return function(_0x39c524){logger['error'](_0x39c524['stack']);if(_0x39c524[_0x7e0e('0x27')]){delete _0x39c524[_0x7e0e('0x27')];}_0xad15ee['status'](_0x3f57ab)[_0x7e0e('0x28')](_0x39c524);};}exports[_0x7e0e('0x29')]=function(_0x4fdb9b,_0x56d874){var _0x12b542={},_0x421be0={},_0x571d25={'count':0x0,'rows':[]};var _0x25ce68=_[_0x7e0e('0x2a')](db[_0x7e0e('0x2b')]['rawAttributes'],function(_0x290153){return{'name':_0x290153[_0x7e0e('0x2c')],'type':_0x290153[_0x7e0e('0x2d')][_0x7e0e('0x2e')]};});_0x421be0[_0x7e0e('0x2f')]=_[_0x7e0e('0x2a')](_0x25ce68,_0x7e0e('0x27'));_0x421be0[_0x7e0e('0x30')]=_[_0x7e0e('0x31')](_0x4fdb9b['query']);_0x421be0[_0x7e0e('0x32')]=_[_0x7e0e('0x33')](_0x421be0[_0x7e0e('0x2f')],_0x421be0[_0x7e0e('0x30')]);_0x12b542[_0x7e0e('0x34')]=_[_0x7e0e('0x33')](_0x421be0['model'],qs['fields'](_0x4fdb9b[_0x7e0e('0x30')][_0x7e0e('0x35')]));_0x12b542['attributes']=_0x12b542['attributes'][_0x7e0e('0x36')]?_0x12b542[_0x7e0e('0x34')]:_0x421be0['model'];if(!_0x4fdb9b[_0x7e0e('0x30')][_0x7e0e('0x37')]('nolimit')){_0x12b542[_0x7e0e('0x1e')]=qs[_0x7e0e('0x1e')](_0x4fdb9b[_0x7e0e('0x30')][_0x7e0e('0x1e')]);_0x12b542[_0x7e0e('0x1d')]=qs[_0x7e0e('0x1d')](_0x4fdb9b['query'][_0x7e0e('0x1d')]);}_0x12b542[_0x7e0e('0x38')]=qs[_0x7e0e('0x39')](_0x4fdb9b[_0x7e0e('0x30')][_0x7e0e('0x39')]);_0x12b542[_0x7e0e('0x3a')]=qs[_0x7e0e('0x32')](_[_0x7e0e('0x3b')](_0x4fdb9b[_0x7e0e('0x30')],_0x421be0[_0x7e0e('0x32')]),_0x25ce68);if(_0x4fdb9b['query']['filter']){_0x12b542[_0x7e0e('0x3a')]=_[_0x7e0e('0x3c')](_0x12b542['where'],{'$or':_[_0x7e0e('0x2a')](_0x25ce68,function(_0x5a3f8b){if(_0x5a3f8b['type']!==_0x7e0e('0x3d')){var _0x379399={};_0x379399[_0x5a3f8b[_0x7e0e('0x27')]]={'$like':'%'+_0x4fdb9b[_0x7e0e('0x30')][_0x7e0e('0x3e')]+'%'};return _0x379399;}})});}_0x12b542=_[_0x7e0e('0x3c')]({},_0x12b542,_0x4fdb9b[_0x7e0e('0x3f')]);var _0x1e7978={'where':_0x12b542['where']};return db[_0x7e0e('0x2b')]['count'](_0x1e7978)[_0x7e0e('0x40')](function(_0x538167){_0x571d25[_0x7e0e('0x20')]=_0x538167;if(_0x4fdb9b[_0x7e0e('0x30')][_0x7e0e('0x41')]){_0x12b542[_0x7e0e('0x42')]=[{'all':!![]}];}return db[_0x7e0e('0x2b')][_0x7e0e('0x43')](_0x12b542);})[_0x7e0e('0x40')](function(_0x321ec1){_0x571d25[_0x7e0e('0x44')]=_0x321ec1;return _0x571d25;})[_0x7e0e('0x40')](respondWithFilteredResult(_0x56d874,_0x12b542))[_0x7e0e('0x45')](handleError(_0x56d874,null));};exports[_0x7e0e('0x46')]=function(_0x1c8536,_0xe3ac09){var _0x404640={'raw':![],'where':{'id':_0x1c8536[_0x7e0e('0x47')]['id']}},_0x28c209={};_0x28c209['model']=_['keys'](db['SalesforceAccount'][_0x7e0e('0x48')]);_0x28c209[_0x7e0e('0x30')]=_[_0x7e0e('0x31')](_0x1c8536[_0x7e0e('0x30')]);_0x28c209[_0x7e0e('0x32')]=_[_0x7e0e('0x33')](_0x28c209[_0x7e0e('0x2f')],_0x28c209[_0x7e0e('0x30')]);_0x404640[_0x7e0e('0x34')]=_['intersection'](_0x28c209[_0x7e0e('0x2f')],qs[_0x7e0e('0x35')](_0x1c8536[_0x7e0e('0x30')][_0x7e0e('0x35')]));_0x404640[_0x7e0e('0x34')]=_0x404640[_0x7e0e('0x34')][_0x7e0e('0x36')]?_0x404640[_0x7e0e('0x34')]:_0x28c209['model'];if(_0x1c8536[_0x7e0e('0x30')][_0x7e0e('0x41')]){_0x404640[_0x7e0e('0x42')]=[{'all':!![]}];}_0x404640=_[_0x7e0e('0x3c')]({},_0x404640,_0x1c8536[_0x7e0e('0x3f')]);return db[_0x7e0e('0x2b')][_0x7e0e('0x49')](_0x404640)[_0x7e0e('0x40')](handleEntityNotFound(_0xe3ac09,null))[_0x7e0e('0x40')](respondWithResult(_0xe3ac09,null))[_0x7e0e('0x45')](handleError(_0xe3ac09,null));};exports[_0x7e0e('0x4a')]=function(_0x4707fd,_0x215cd0){return db[_0x7e0e('0x2b')][_0x7e0e('0x4a')](_0x4707fd['body'],{})['then'](respondWithResult(_0x215cd0,0xc9))['catch'](handleError(_0x215cd0,null));};exports[_0x7e0e('0x25')]=function(_0x2a5d3c,_0x5afd99){if(_0x2a5d3c[_0x7e0e('0x4b')]['id']){delete _0x2a5d3c[_0x7e0e('0x4b')]['id'];}return db[_0x7e0e('0x2b')]['find']({'where':{'id':_0x2a5d3c[_0x7e0e('0x47')]['id']}})[_0x7e0e('0x40')](handleEntityNotFound(_0x5afd99,null))[_0x7e0e('0x40')](saveUpdates(_0x2a5d3c['body'],null))[_0x7e0e('0x40')](respondWithResult(_0x5afd99,null))[_0x7e0e('0x45')](handleError(_0x5afd99,null));};exports[_0x7e0e('0x4c')]=function(_0x360c8e,_0x53045c){return db[_0x7e0e('0x2b')][_0x7e0e('0x49')]({'where':{'id':_0x360c8e['params']['id']}})[_0x7e0e('0x40')](handleEntityNotFound(_0x53045c,null))[_0x7e0e('0x40')](removeEntity(_0x53045c,null))[_0x7e0e('0x45')](handleError(_0x53045c,null));};exports[_0x7e0e('0x4d')]=function(_0x45a8a5,_0xd87278,_0x51c57c){var _0xcb16a1={};var _0x2f07e1={};var _0x3bb255;var _0x39fa8c;return db['SalesforceAccount'][_0x7e0e('0x4e')]({'where':{'id':_0x45a8a5[_0x7e0e('0x47')]['id']}})[_0x7e0e('0x40')](handleEntityNotFound(_0xd87278,null))['then'](function(_0x55dc0a){if(_0x55dc0a){_0x3bb255=_0x55dc0a;_0x2f07e1['model']=_['keys'](db['SalesforceConfiguration'][_0x7e0e('0x48')]);_0x2f07e1[_0x7e0e('0x30')]=_[_0x7e0e('0x31')](_0x45a8a5[_0x7e0e('0x30')]);_0x2f07e1['filters']=_['intersection'](_0x2f07e1[_0x7e0e('0x2f')],_0x2f07e1[_0x7e0e('0x30')]);_0xcb16a1[_0x7e0e('0x34')]=_[_0x7e0e('0x33')](_0x2f07e1[_0x7e0e('0x2f')],qs[_0x7e0e('0x35')](_0x45a8a5['query'][_0x7e0e('0x35')]));_0xcb16a1[_0x7e0e('0x34')]=_0xcb16a1['attributes']['length']?_0xcb16a1[_0x7e0e('0x34')]:_0x2f07e1[_0x7e0e('0x2f')];_0xcb16a1['order']=qs[_0x7e0e('0x39')](_0x45a8a5[_0x7e0e('0x30')]['sort']);_0xcb16a1[_0x7e0e('0x3a')]=qs[_0x7e0e('0x32')](_[_0x7e0e('0x3b')](_0x45a8a5[_0x7e0e('0x30')],_0x2f07e1['filters']));if(_0x45a8a5[_0x7e0e('0x30')][_0x7e0e('0x3e')]){_0xcb16a1[_0x7e0e('0x3a')]=_['merge'](_0xcb16a1[_0x7e0e('0x3a')],{'$or':_[_0x7e0e('0x2a')](_0xcb16a1[_0x7e0e('0x34')],function(_0x41d1bf){var _0x3360ea={};_0x3360ea[_0x41d1bf]={'$like':'%'+_0x45a8a5['query'][_0x7e0e('0x3e')]+'%'};return _0x3360ea;})});}_0xcb16a1=_['merge']({},_0xcb16a1,_0x45a8a5['options']);return _0x3bb255[_0x7e0e('0x4d')](_0xcb16a1);}})[_0x7e0e('0x40')](function(_0x33135d){if(_0x33135d){_0x39fa8c=_0x33135d['length'];if(!_0x45a8a5[_0x7e0e('0x30')][_0x7e0e('0x37')]('nolimit')){_0xcb16a1[_0x7e0e('0x1e')]=qs[_0x7e0e('0x1e')](_0x45a8a5[_0x7e0e('0x30')]['limit']);_0xcb16a1[_0x7e0e('0x1d')]=qs[_0x7e0e('0x1d')](_0x45a8a5[_0x7e0e('0x30')][_0x7e0e('0x1d')]);}return _0x3bb255[_0x7e0e('0x4d')](_0xcb16a1);}})[_0x7e0e('0x40')](function(_0x5c042d){if(_0x5c042d){return _0x5c042d?{'count':_0x39fa8c,'rows':_0x5c042d}:null;}})['then'](respondWithResult(_0xd87278,null))['catch'](handleError(_0xd87278,null));};exports[_0x7e0e('0x4f')]=function(_0x591569,_0x41169d,_0x242e8d){if(_0x591569[_0x7e0e('0x4b')]['id']){delete _0x591569[_0x7e0e('0x4b')]['id'];}return db[_0x7e0e('0x2b')]['findOne']({'where':{'id':_0x591569['params']['id']}})[_0x7e0e('0x40')](handleEntityNotFound(_0x41169d,null))[_0x7e0e('0x40')](function(_0x37f403){if(_0x37f403){_0x591569[_0x7e0e('0x4b')][_0x7e0e('0x50')]=_0x37f403['id'];_0x591569[_0x7e0e('0x4b')]['Subjects']=integrations['getSubjects'](_0x591569[_0x7e0e('0x4b')][_0x7e0e('0x51')],_0x591569[_0x7e0e('0x4b')][_0x7e0e('0x2d')]);_0x591569[_0x7e0e('0x4b')][_0x7e0e('0x52')]=integrations['getDescriptions'](_0x591569['body'][_0x7e0e('0x51')],_0x591569[_0x7e0e('0x4b')][_0x7e0e('0x2d')]);return db[_0x7e0e('0x53')][_0x7e0e('0x4a')](_0x591569[_0x7e0e('0x4b')],{'include':[{'model':db[_0x7e0e('0x54')],'as':_0x7e0e('0x55')},{'model':db[_0x7e0e('0x54')],'as':_0x7e0e('0x52')}]});}return null;})['then'](respondWithResult(_0x41169d,null))[_0x7e0e('0x45')](handleError(_0x41169d,null));};exports[_0x7e0e('0x56')]=function(_0x4bb2a9,_0x4d1e2f,_0x288bd5){var _0x53e2ae;var _0x1bb3b1='';var _0x312b9e='Task';return db['SalesforceAccount'][_0x7e0e('0x4e')]({'where':{'id':_0x4bb2a9[_0x7e0e('0x47')]['id']},'attributes':['id',_0x7e0e('0x57'),_0x7e0e('0x58'),'clientSecret',_0x7e0e('0x59'),'password',_0x7e0e('0x5a')]})[_0x7e0e('0x40')](handleEntityNotFound(_0x4d1e2f,null))[_0x7e0e('0x40')](function(_0x554e33){if(_0x554e33){_0x1bb3b1=_0x554e33[_0x7e0e('0x57')];var _0x3d6da0=_0x1bb3b1[_0x7e0e('0x5b')](-0x1);if(_0x3d6da0==='/'){_0x1bb3b1=_0x1bb3b1[_0x7e0e('0x5c')](0x0,_0x1bb3b1[_0x7e0e('0x5d')](_0x3d6da0));}_0x53e2ae=new jsforce[(_0x7e0e('0x5e'))]({'oauth2':{'loginUrl':_0x1bb3b1,'clientId':_0x554e33['clientId'],'clientSecret':_0x554e33[_0x7e0e('0x5f')]}});return _0x53e2ae['login'](_0x554e33[_0x7e0e('0x59')],_0x554e33[_0x7e0e('0x60')][_0x7e0e('0x61')](_0x554e33[_0x7e0e('0x5a')]));}})['then'](function(_0x117957){if(_0x117957){if(!_[_0x7e0e('0x62')](_0x4bb2a9['query']['ticketType'])){_0x312b9e=_0x4bb2a9['query'][_0x7e0e('0x63')];}return _0x53e2ae['sobject'](_0x312b9e)[_0x7e0e('0x64')]();}})[_0x7e0e('0x40')](function(_0x425713){var _0xf496c4=['OwnerId',_0x7e0e('0x65'),'IsReminderSet',_0x7e0e('0x66'),'Subject',_0x7e0e('0x67')];var _0xe9a086=[_0x7e0e('0x68'),_0x7e0e('0x69'),_0x7e0e('0x6a'),_0x7e0e('0x6b'),'email','textarea',_0x7e0e('0x6c')];if(_0x425713){_[_0x7e0e('0x6d')](_0x425713[_0x7e0e('0x35')],function(_0x59d07c){return _0xf496c4[_0x7e0e('0x6e')](_0x59d07c['name'])||!_0xe9a086['includes'](_0x59d07c[_0x7e0e('0x2d')]);});return{'count':_0x425713[_0x7e0e('0x35')][_0x7e0e('0x36')],'rows':_['map'](_0x425713['fields'],function(_0x4baaaf){return{'id':_0x4baaaf[_0x7e0e('0x27')],'name':_0x4baaaf[_0x7e0e('0x6f')],'custom':_0x4baaaf[_0x7e0e('0x70')],'options':_0x4baaaf[_0x7e0e('0x71')]['length']>0x0?_['map'](_0x4baaaf[_0x7e0e('0x71')],function(_0x38a1c5){return{'name':_0x38a1c5[_0x7e0e('0x6f')],'value':_0x38a1c5['value']};}):_0x4baaaf[_0x7e0e('0x2d')]==_0x7e0e('0x6b')?[{'name':_0x7e0e('0x72'),'value':_0x7e0e('0x73')},{'name':'False','value':'false'}]:[]};})};}})[_0x7e0e('0x40')](respondWithResult(_0x4d1e2f,null))['catch'](function(_0x1daf70){var _0x270528=_0x4bb2a9['query'][_0x7e0e('0x74')]?0x1f4:_0x1daf70[_0x7e0e('0x75')]||0x1f4;logger[_0x7e0e('0x76')]('getFields,\x20%s,\x20%s,\x20%s',_0x7e0e('0x56'),_0x270528,JSON[_0x7e0e('0x77')](_0x1daf70));delete _0x1daf70[_0x7e0e('0x27')];if(_0x270528===0x191){_0x270528=0x190;}_0x4d1e2f[_0x7e0e('0x1b')](_0x270528)[_0x7e0e('0x28')](_0x4bb2a9[_0x7e0e('0x30')]['test']?{'message':_0x7e0e('0x78'),'statusCode':_0x1daf70['statusCode']}:_0x1daf70);});}; \ No newline at end of file +var _0xb556=['true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','SalesforceAccount','fieldName','type','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','remoteUri','clientId','username','password','securityToken','clientSecret','login','concat','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Subject','int','picklist','boolean','phone','remove','includes','label','custom','picklistValues','value','True'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb556,0x167));var _0x6b55=function(_0x5dc8ba,_0x59de70){_0x5dc8ba=_0x5dc8ba-0x0;var _0x5291e0=_0xb556[_0x5dc8ba];return _0x5291e0;};'use strict';var emlformat=require(_0x6b55('0x0'));var rimraf=require(_0x6b55('0x1'));var zipdir=require(_0x6b55('0x2'));var jsonpatch=require(_0x6b55('0x3'));var rp=require('request-promise');var moment=require(_0x6b55('0x4'));var BPromise=require(_0x6b55('0x5'));var Mustache=require('mustache');var util=require(_0x6b55('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6b55('0x7'));var ejs=require(_0x6b55('0x8'));var fs=require('fs');var fs_extra=require(_0x6b55('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b55('0xa'));var jsforce=require(_0x6b55('0xb'));var deskjs=require(_0x6b55('0xc'));var toCsv=require(_0x6b55('0x7'));var querystring=require(_0x6b55('0xd'));var Papa=require(_0x6b55('0xe'));var Redis=require(_0x6b55('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6b55('0x10'));var as=require(_0x6b55('0x11'));var hardwareService=require(_0x6b55('0x12'));var logger=require(_0x6b55('0x13'))(_0x6b55('0x14'));var utils=require(_0x6b55('0x15'));var config=require(_0x6b55('0x16'));var licenseUtil=require(_0x6b55('0x17'));var db=require(_0x6b55('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3d3987,_0x5d3572){_0x5d3572=_0x5d3572||0xcc;return function(_0x315c7e){if(_0x315c7e){return _0x3d3987[_0x6b55('0x19')](_0x5d3572);}return _0x3d3987[_0x6b55('0x1a')](_0x5d3572)[_0x6b55('0x1b')]();};}function respondWithResult(_0x3b106f,_0x488b49){_0x488b49=_0x488b49||0xc8;return function(_0x2f418f){if(_0x2f418f){return _0x3b106f['status'](_0x488b49)[_0x6b55('0x1c')](_0x2f418f);}};}function respondWithFilteredResult(_0x5c723d,_0x4fbdec){return function(_0x56e7b0){if(_0x56e7b0){var _0x4a0a1b=typeof _0x4fbdec[_0x6b55('0x1d')]===_0x6b55('0x1e')&&typeof _0x4fbdec[_0x6b55('0x1f')]==='undefined';var _0x106c8d=_0x56e7b0['count'];var _0x1c7caa=_0x4a0a1b?0x0:_0x4fbdec[_0x6b55('0x1d')];var _0x16b9da=_0x4a0a1b?_0x56e7b0[_0x6b55('0x20')]:_0x4fbdec[_0x6b55('0x1d')]+_0x4fbdec[_0x6b55('0x1f')];var _0x3bdfad;if(_0x16b9da>=_0x106c8d){_0x16b9da=_0x106c8d;_0x3bdfad=0xc8;}else{_0x3bdfad=0xce;}_0x5c723d['status'](_0x3bdfad);return _0x5c723d[_0x6b55('0x21')](_0x6b55('0x22'),_0x1c7caa+'-'+_0x16b9da+'/'+_0x106c8d)['json'](_0x56e7b0);}return null;};}function patchUpdates(_0x3a7127){return function(_0xdeaf88){try{jsonpatch['apply'](_0xdeaf88,_0x3a7127,!![]);}catch(_0x344201){return BPromise[_0x6b55('0x23')](_0x344201);}return _0xdeaf88[_0x6b55('0x24')]();};}function saveUpdates(_0x2c8d0b,_0x12deec){return function(_0x706155){if(_0x706155){return _0x706155[_0x6b55('0x25')](_0x2c8d0b)[_0x6b55('0x26')](function(_0x2517ec){return _0x2517ec;});}return null;};}function removeEntity(_0x1773d8,_0x1a63f1){return function(_0x3a4b6b){if(_0x3a4b6b){return _0x3a4b6b[_0x6b55('0x27')]()[_0x6b55('0x26')](function(){_0x1773d8['status'](0xcc)[_0x6b55('0x1b')]();});}};}function handleEntityNotFound(_0x2bd024,_0x18c160){return function(_0x2f4356){if(!_0x2f4356){_0x2bd024[_0x6b55('0x19')](0x194);}return _0x2f4356;};}function handleError(_0x869a92,_0x1fcb7f){_0x1fcb7f=_0x1fcb7f||0x1f4;return function(_0x3a52db){logger[_0x6b55('0x28')](_0x3a52db[_0x6b55('0x29')]);if(_0x3a52db[_0x6b55('0x2a')]){delete _0x3a52db['name'];}_0x869a92[_0x6b55('0x1a')](_0x1fcb7f)[_0x6b55('0x2b')](_0x3a52db);};}exports['index']=function(_0x46621f,_0x1e630e){var _0x517f05={},_0x42f7ef={},_0x46562e={'count':0x0,'rows':[]};var _0x2249c9=_[_0x6b55('0x2c')](db[_0x6b55('0x2d')]['rawAttributes'],function(_0x4d2312){return{'name':_0x4d2312[_0x6b55('0x2e')],'type':_0x4d2312[_0x6b55('0x2f')]['key']};});_0x42f7ef['model']=_[_0x6b55('0x2c')](_0x2249c9,_0x6b55('0x2a'));_0x42f7ef['query']=_[_0x6b55('0x30')](_0x46621f[_0x6b55('0x31')]);_0x42f7ef['filters']=_[_0x6b55('0x32')](_0x42f7ef[_0x6b55('0x33')],_0x42f7ef[_0x6b55('0x31')]);_0x517f05[_0x6b55('0x34')]=_['intersection'](_0x42f7ef[_0x6b55('0x33')],qs[_0x6b55('0x35')](_0x46621f[_0x6b55('0x31')][_0x6b55('0x35')]));_0x517f05[_0x6b55('0x34')]=_0x517f05[_0x6b55('0x34')][_0x6b55('0x36')]?_0x517f05[_0x6b55('0x34')]:_0x42f7ef[_0x6b55('0x33')];if(!_0x46621f[_0x6b55('0x31')]['hasOwnProperty'](_0x6b55('0x37'))){_0x517f05[_0x6b55('0x1f')]=qs[_0x6b55('0x1f')](_0x46621f['query'][_0x6b55('0x1f')]);_0x517f05[_0x6b55('0x1d')]=qs[_0x6b55('0x1d')](_0x46621f['query']['offset']);}_0x517f05[_0x6b55('0x38')]=qs[_0x6b55('0x39')](_0x46621f[_0x6b55('0x31')][_0x6b55('0x39')]);_0x517f05[_0x6b55('0x3a')]=qs[_0x6b55('0x3b')](_['pick'](_0x46621f[_0x6b55('0x31')],_0x42f7ef['filters']),_0x2249c9);if(_0x46621f[_0x6b55('0x31')]['filter']){_0x517f05[_0x6b55('0x3a')]=_['merge'](_0x517f05[_0x6b55('0x3a')],{'$or':_[_0x6b55('0x2c')](_0x2249c9,function(_0xa0a88){if(_0xa0a88[_0x6b55('0x2f')]!=='VIRTUAL'){var _0x2ece5e={};_0x2ece5e[_0xa0a88[_0x6b55('0x2a')]]={'$like':'%'+_0x46621f['query'][_0x6b55('0x3c')]+'%'};return _0x2ece5e;}})});}_0x517f05=_[_0x6b55('0x3d')]({},_0x517f05,_0x46621f[_0x6b55('0x3e')]);var _0x3d8db7={'where':_0x517f05[_0x6b55('0x3a')]};return db[_0x6b55('0x2d')][_0x6b55('0x20')](_0x3d8db7)[_0x6b55('0x26')](function(_0x470edb){_0x46562e[_0x6b55('0x20')]=_0x470edb;if(_0x46621f[_0x6b55('0x31')][_0x6b55('0x3f')]){_0x517f05[_0x6b55('0x40')]=[{'all':!![]}];}return db[_0x6b55('0x2d')][_0x6b55('0x41')](_0x517f05);})[_0x6b55('0x26')](function(_0x4423aa){_0x46562e['rows']=_0x4423aa;return _0x46562e;})[_0x6b55('0x26')](respondWithFilteredResult(_0x1e630e,_0x517f05))[_0x6b55('0x42')](handleError(_0x1e630e,null));};exports[_0x6b55('0x43')]=function(_0xf16b83,_0x55fb10){var _0x4840fe={'raw':![],'where':{'id':_0xf16b83[_0x6b55('0x44')]['id']}},_0x5bcd51={};_0x5bcd51[_0x6b55('0x33')]=_[_0x6b55('0x30')](db[_0x6b55('0x2d')][_0x6b55('0x45')]);_0x5bcd51[_0x6b55('0x31')]=_[_0x6b55('0x30')](_0xf16b83[_0x6b55('0x31')]);_0x5bcd51['filters']=_[_0x6b55('0x32')](_0x5bcd51['model'],_0x5bcd51['query']);_0x4840fe[_0x6b55('0x34')]=_[_0x6b55('0x32')](_0x5bcd51['model'],qs[_0x6b55('0x35')](_0xf16b83[_0x6b55('0x31')][_0x6b55('0x35')]));_0x4840fe[_0x6b55('0x34')]=_0x4840fe[_0x6b55('0x34')][_0x6b55('0x36')]?_0x4840fe[_0x6b55('0x34')]:_0x5bcd51[_0x6b55('0x33')];if(_0xf16b83[_0x6b55('0x31')][_0x6b55('0x3f')]){_0x4840fe[_0x6b55('0x40')]=[{'all':!![]}];}_0x4840fe=_[_0x6b55('0x3d')]({},_0x4840fe,_0xf16b83[_0x6b55('0x3e')]);return db[_0x6b55('0x2d')]['find'](_0x4840fe)['then'](handleEntityNotFound(_0x55fb10,null))['then'](respondWithResult(_0x55fb10,null))['catch'](handleError(_0x55fb10,null));};exports[_0x6b55('0x46')]=function(_0x13073e,_0xa3363a){return db['SalesforceAccount']['create'](_0x13073e['body'],{})[_0x6b55('0x26')](respondWithResult(_0xa3363a,0xc9))['catch'](handleError(_0xa3363a,null));};exports[_0x6b55('0x25')]=function(_0x48f34c,_0x33947f){if(_0x48f34c['body']['id']){delete _0x48f34c[_0x6b55('0x47')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x48f34c[_0x6b55('0x44')]['id']}})['then'](handleEntityNotFound(_0x33947f,null))[_0x6b55('0x26')](saveUpdates(_0x48f34c[_0x6b55('0x47')],null))[_0x6b55('0x26')](respondWithResult(_0x33947f,null))[_0x6b55('0x42')](handleError(_0x33947f,null));};exports['destroy']=function(_0x468aee,_0x40e785){return db[_0x6b55('0x2d')][_0x6b55('0x48')]({'where':{'id':_0x468aee[_0x6b55('0x44')]['id']}})[_0x6b55('0x26')](handleEntityNotFound(_0x40e785,null))[_0x6b55('0x26')](removeEntity(_0x40e785,null))[_0x6b55('0x42')](handleError(_0x40e785,null));};exports[_0x6b55('0x49')]=function(_0x80e55a,_0x1b4257,_0x4a6624){var _0x5705e4={};var _0x594329={};var _0x45c34c;var _0x2465f9;return db[_0x6b55('0x2d')][_0x6b55('0x4a')]({'where':{'id':_0x80e55a[_0x6b55('0x44')]['id']}})[_0x6b55('0x26')](handleEntityNotFound(_0x1b4257,null))['then'](function(_0x364690){if(_0x364690){_0x45c34c=_0x364690;_0x594329[_0x6b55('0x33')]=_[_0x6b55('0x30')](db['SalesforceConfiguration'][_0x6b55('0x45')]);_0x594329[_0x6b55('0x31')]=_[_0x6b55('0x30')](_0x80e55a['query']);_0x594329[_0x6b55('0x3b')]=_[_0x6b55('0x32')](_0x594329[_0x6b55('0x33')],_0x594329[_0x6b55('0x31')]);_0x5705e4[_0x6b55('0x34')]=_[_0x6b55('0x32')](_0x594329[_0x6b55('0x33')],qs[_0x6b55('0x35')](_0x80e55a[_0x6b55('0x31')]['fields']));_0x5705e4[_0x6b55('0x34')]=_0x5705e4[_0x6b55('0x34')]['length']?_0x5705e4[_0x6b55('0x34')]:_0x594329[_0x6b55('0x33')];_0x5705e4['order']=qs['sort'](_0x80e55a[_0x6b55('0x31')][_0x6b55('0x39')]);_0x5705e4[_0x6b55('0x3a')]=qs['filters'](_['pick'](_0x80e55a[_0x6b55('0x31')],_0x594329[_0x6b55('0x3b')]));if(_0x80e55a[_0x6b55('0x31')][_0x6b55('0x3c')]){_0x5705e4['where']=_[_0x6b55('0x3d')](_0x5705e4[_0x6b55('0x3a')],{'$or':_['map'](_0x5705e4[_0x6b55('0x34')],function(_0x2588ef){var _0x270634={};_0x270634[_0x2588ef]={'$like':'%'+_0x80e55a[_0x6b55('0x31')][_0x6b55('0x3c')]+'%'};return _0x270634;})});}_0x5705e4=_[_0x6b55('0x3d')]({},_0x5705e4,_0x80e55a[_0x6b55('0x3e')]);return _0x45c34c[_0x6b55('0x49')](_0x5705e4);}})[_0x6b55('0x26')](function(_0x126c03){if(_0x126c03){_0x2465f9=_0x126c03[_0x6b55('0x36')];if(!_0x80e55a['query'][_0x6b55('0x4b')]('nolimit')){_0x5705e4[_0x6b55('0x1f')]=qs[_0x6b55('0x1f')](_0x80e55a[_0x6b55('0x31')][_0x6b55('0x1f')]);_0x5705e4[_0x6b55('0x1d')]=qs[_0x6b55('0x1d')](_0x80e55a['query'][_0x6b55('0x1d')]);}return _0x45c34c[_0x6b55('0x49')](_0x5705e4);}})[_0x6b55('0x26')](function(_0x505803){if(_0x505803){return _0x505803?{'count':_0x2465f9,'rows':_0x505803}:null;}})[_0x6b55('0x26')](respondWithResult(_0x1b4257,null))[_0x6b55('0x42')](handleError(_0x1b4257,null));};exports[_0x6b55('0x4c')]=function(_0x810a02,_0x37618d,_0x11edab){if(_0x810a02[_0x6b55('0x47')]['id']){delete _0x810a02['body']['id'];}return db[_0x6b55('0x2d')][_0x6b55('0x4a')]({'where':{'id':_0x810a02[_0x6b55('0x44')]['id']}})[_0x6b55('0x26')](handleEntityNotFound(_0x37618d,null))[_0x6b55('0x26')](function(_0x3a82cc){if(_0x3a82cc){_0x810a02[_0x6b55('0x47')]['AccountId']=_0x3a82cc['id'];_0x810a02[_0x6b55('0x47')][_0x6b55('0x4d')]=integrations[_0x6b55('0x4e')](_0x810a02[_0x6b55('0x47')][_0x6b55('0x4f')],_0x810a02['body']['type']);_0x810a02[_0x6b55('0x47')][_0x6b55('0x50')]=integrations[_0x6b55('0x51')](_0x810a02[_0x6b55('0x47')]['channel'],_0x810a02['body'][_0x6b55('0x2f')]);return db[_0x6b55('0x52')][_0x6b55('0x46')](_0x810a02[_0x6b55('0x47')],{'include':[{'model':db[_0x6b55('0x53')],'as':_0x6b55('0x4d')},{'model':db[_0x6b55('0x53')],'as':_0x6b55('0x50')}]});}return null;})[_0x6b55('0x26')](respondWithResult(_0x37618d,null))[_0x6b55('0x42')](handleError(_0x37618d,null));};exports['getFields']=function(_0x359b22,_0x482a9e,_0x59718c){var _0x40a77d;var _0x3aa6e9='';var _0x19ad6d='Task';return db['SalesforceAccount'][_0x6b55('0x4a')]({'where':{'id':_0x359b22[_0x6b55('0x44')]['id']},'attributes':['id',_0x6b55('0x54'),_0x6b55('0x55'),'clientSecret',_0x6b55('0x56'),_0x6b55('0x57'),_0x6b55('0x58')]})['then'](handleEntityNotFound(_0x482a9e,null))[_0x6b55('0x26')](function(_0x2aee68){if(_0x2aee68){_0x3aa6e9=_0x2aee68['remoteUri'];var _0x4c0c1d=_0x3aa6e9['slice'](-0x1);if(_0x4c0c1d==='/'){_0x3aa6e9=_0x3aa6e9['substring'](0x0,_0x3aa6e9['lastIndexOf'](_0x4c0c1d));}_0x40a77d=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3aa6e9,'clientId':_0x2aee68[_0x6b55('0x55')],'clientSecret':_0x2aee68[_0x6b55('0x59')]}});return _0x40a77d[_0x6b55('0x5a')](_0x2aee68[_0x6b55('0x56')],_0x2aee68[_0x6b55('0x57')][_0x6b55('0x5b')](_0x2aee68[_0x6b55('0x58')]));}})['then'](function(_0xa6ebad){if(_0xa6ebad){if(!_['isNil'](_0x359b22[_0x6b55('0x31')]['ticketType'])){_0x19ad6d=_0x359b22[_0x6b55('0x31')]['ticketType'];}return _0x40a77d[_0x6b55('0x5c')](_0x19ad6d)[_0x6b55('0x5d')]();}})[_0x6b55('0x26')](function(_0x5e624b){var _0x4dd0fd=[_0x6b55('0x5e'),_0x6b55('0x5f'),'IsReminderSet',_0x6b55('0x60'),_0x6b55('0x61'),'Description'];var _0x57408b=['string',_0x6b55('0x62'),_0x6b55('0x63'),_0x6b55('0x64'),'email','textarea',_0x6b55('0x65')];if(_0x5e624b){_[_0x6b55('0x66')](_0x5e624b[_0x6b55('0x35')],function(_0x3bc7ae){return _0x4dd0fd[_0x6b55('0x67')](_0x3bc7ae[_0x6b55('0x2a')])||!_0x57408b[_0x6b55('0x67')](_0x3bc7ae[_0x6b55('0x2f')]);});return{'count':_0x5e624b['fields'][_0x6b55('0x36')],'rows':_[_0x6b55('0x2c')](_0x5e624b[_0x6b55('0x35')],function(_0x18f94a){return{'id':_0x18f94a['name'],'name':_0x18f94a[_0x6b55('0x68')],'custom':_0x18f94a[_0x6b55('0x69')],'options':_0x18f94a[_0x6b55('0x6a')]['length']>0x0?_['map'](_0x18f94a[_0x6b55('0x6a')],function(_0x1e0386){return{'name':_0x1e0386[_0x6b55('0x68')],'value':_0x1e0386[_0x6b55('0x6b')]};}):_0x18f94a[_0x6b55('0x2f')]==_0x6b55('0x64')?[{'name':_0x6b55('0x6c'),'value':_0x6b55('0x6d')},{'name':_0x6b55('0x6e'),'value':_0x6b55('0x6f')}]:[]};})};}})['then'](respondWithResult(_0x482a9e,null))[_0x6b55('0x42')](function(_0x2986fe){var _0x27ec88=_0x359b22['query'][_0x6b55('0x70')]?0x1f4:_0x2986fe[_0x6b55('0x71')]||0x1f4;logger['error'](_0x6b55('0x72'),_0x6b55('0x73'),_0x27ec88,JSON['stringify'](_0x2986fe));delete _0x2986fe['name'];if(_0x27ec88===0x191){_0x27ec88=0x190;}_0x482a9e[_0x6b55('0x1a')](_0x27ec88)[_0x6b55('0x2b')](_0x359b22[_0x6b55('0x31')][_0x6b55('0x70')]?{'message':_0x6b55('0x74'),'statusCode':_0x2986fe[_0x6b55('0x71')]}:_0x2986fe);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index a7b0daa..1a95ac0 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 _0x7111=['exports','define','SalesforceAccount','lodash','util','api','moment','bluebird','request-promise','rimraf','./intSalesforceAccount.attributes'];(function(_0x1e5755,_0x5e0d48){var _0x38975b=function(_0x1ec4a2){while(--_0x1ec4a2){_0x1e5755['push'](_0x1e5755['shift']());}};_0x38975b(++_0x5e0d48);}(_0x7111,0x19a));var _0x1711=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x7111[_0x35007a];return _0x574f68;};'use strict';var _=require(_0x1711('0x0'));var util=require(_0x1711('0x1'));var logger=require('../../config/logger')(_0x1711('0x2'));var moment=require(_0x1711('0x3'));var BPromise=require(_0x1711('0x4'));var rp=require(_0x1711('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1711('0x6'));var config=require('../../config/environment');var attributes=require(_0x1711('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x1711('0x8')]=function(_0x8bef69,_0x33d31e){return _0x8bef69[_0x1711('0x9')](_0x1711('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d89=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5d89,0x1e8));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x95d8('0x0'));var util=require(_0x95d8('0x1'));var logger=require(_0x95d8('0x2'))('api');var moment=require(_0x95d8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x95d8('0x4'));var rimraf=require(_0x95d8('0x5'));var config=require(_0x95d8('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x95d8('0x7'));module[_0x95d8('0x8')]=function(_0x2fa412,_0x544c76){return _0x2fa412[_0x95d8('0x9')](_0x95d8('0xa'),attributes,{'tableName':_0x95d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index d87eac8..871bf8c 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 _0x64bc=['error','code','message','catch','GetSalesforceAccount','findAll','options','raw','where','include','map','model','attributes','SalesforceAccount','ShowSalesforceAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5013f2,_0x3d896b){var _0x166b9f=function(_0x56886e){while(--_0x56886e){_0x5013f2['push'](_0x5013f2['shift']());}};_0x166b9f(++_0x3d896b);}(_0x64bc,0x16f));var _0xc64b=function(_0x49dea3,_0x3543e0){_0x49dea3=_0x49dea3-0x0;var _0x10ca3d=_0x64bc[_0x49dea3];return _0x10ca3d;};'use strict';var _=require(_0xc64b('0x0'));var util=require(_0xc64b('0x1'));var moment=require('moment');var BPromise=require(_0xc64b('0x2'));var rs=require(_0xc64b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc64b('0x4'))['db'];var utils=require(_0xc64b('0x5'));var logger=require(_0xc64b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc64b('0x7'));var client=jayson[_0xc64b('0x8')][_0xc64b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cf0ae,_0x147fb3,_0x57e9a4){return new BPromise(function(_0x4a6f74,_0x505e6d){return client[_0xc64b('0xa')](_0x4cf0ae,_0x57e9a4)[_0xc64b('0xb')](function(_0x301b7f){logger[_0xc64b('0xc')](_0xc64b('0xd'),_0x147fb3,_0xc64b('0xe'));logger[_0xc64b('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x147fb3,'request\x20sent',JSON[_0xc64b('0x10')](_0x301b7f));if(_0x301b7f[_0xc64b('0x11')]){if(_0x301b7f[_0xc64b('0x11')][_0xc64b('0x12')]===0x1f4){logger[_0xc64b('0x11')](_0xc64b('0xd'),_0x147fb3,_0x301b7f[_0xc64b('0x11')][_0xc64b('0x13')]);return _0x505e6d(_0x301b7f[_0xc64b('0x11')]['message']);}logger[_0xc64b('0x11')](_0xc64b('0xd'),_0x147fb3,_0x301b7f['error'][_0xc64b('0x13')]);return _0x4a6f74(_0x301b7f[_0xc64b('0x11')][_0xc64b('0x13')]);}else{logger[_0xc64b('0xc')](_0xc64b('0xd'),_0x147fb3,_0xc64b('0xe'));_0x4a6f74(_0x301b7f['result'][_0xc64b('0x13')]);}})[_0xc64b('0x14')](function(_0x48391a){logger['error'](_0xc64b('0xd'),_0x147fb3,_0x48391a);_0x505e6d(_0x48391a);});});}exports[_0xc64b('0x15')]=function(_0x505a9a){var _0x34b021=this;return new Promise(function(_0x16bcb8,_0x2fbdcd){return db['SalesforceAccount'][_0xc64b('0x16')]({'raw':_0x505a9a['options']?_0x505a9a[_0xc64b('0x17')][_0xc64b('0x18')]===undefined?!![]:![]:!![],'where':_0x505a9a[_0xc64b('0x17')]?_0x505a9a[_0xc64b('0x17')][_0xc64b('0x19')]||null:null,'attributes':_0x505a9a['options']?_0x505a9a[_0xc64b('0x17')]['attributes']||null:null,'limit':_0x505a9a['options']?_0x505a9a['options']['limit']||null:null,'include':_0x505a9a[_0xc64b('0x17')]?_0x505a9a[_0xc64b('0x17')][_0xc64b('0x1a')]?_[_0xc64b('0x1b')](_0x505a9a[_0xc64b('0x17')][_0xc64b('0x1a')],function(_0x28ef5d){return{'model':db[_0x28ef5d[_0xc64b('0x1c')]],'as':_0x28ef5d['as'],'attributes':_0x28ef5d[_0xc64b('0x1d')],'include':_0x28ef5d[_0xc64b('0x1a')]?_['map'](_0x28ef5d[_0xc64b('0x1a')],function(_0x430975){return{'model':db[_0x430975['model']],'as':_0x430975['as'],'attributes':_0x430975[_0xc64b('0x1d')],'include':_0x430975[_0xc64b('0x1a')]?_['map'](_0x430975[_0xc64b('0x1a')],function(_0x1d059b){return{'model':db[_0x1d059b[_0xc64b('0x1c')]],'as':_0x1d059b['as'],'attributes':_0x1d059b[_0xc64b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a1088){logger[_0xc64b('0xc')](_0xc64b('0x15'),_0x505a9a);logger[_0xc64b('0xf')]('GetSalesforceAccount',_0x505a9a,JSON[_0xc64b('0x10')](_0x1a1088));_0x16bcb8(_0x1a1088);})[_0xc64b('0x14')](function(_0x288034){logger[_0xc64b('0x11')](_0xc64b('0x15'),_0x288034[_0xc64b('0x13')],_0x505a9a);_0x2fbdcd(_0x34b021[_0xc64b('0x11')](0x1f4,_0x288034[_0xc64b('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x5ead31){var _0x10141e=this;return new Promise(function(_0x51a5a6,_0xf528bc){return db[_0xc64b('0x1e')]['find']({'raw':_0x5ead31[_0xc64b('0x17')]?_0x5ead31['options'][_0xc64b('0x18')]===undefined?!![]:![]:!![],'where':_0x5ead31[_0xc64b('0x17')]?_0x5ead31['options'][_0xc64b('0x19')]||null:null,'attributes':_0x5ead31[_0xc64b('0x17')]?_0x5ead31['options']['attributes']||null:null,'include':_0x5ead31[_0xc64b('0x17')]?_0x5ead31[_0xc64b('0x17')][_0xc64b('0x1a')]?_['map'](_0x5ead31['options'][_0xc64b('0x1a')],function(_0x15df5d){return{'model':db[_0x15df5d[_0xc64b('0x1c')]],'as':_0x15df5d['as'],'attributes':_0x15df5d[_0xc64b('0x1d')],'include':_0x15df5d['include']?_[_0xc64b('0x1b')](_0x15df5d['include'],function(_0x147c48){return{'model':db[_0x147c48['model']],'as':_0x147c48['as'],'attributes':_0x147c48[_0xc64b('0x1d')],'include':_0x147c48[_0xc64b('0x1a')]?_[_0xc64b('0x1b')](_0x147c48[_0xc64b('0x1a')],function(_0x204362){return{'model':db[_0x204362[_0xc64b('0x1c')]],'as':_0x204362['as'],'attributes':_0x204362[_0xc64b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc64b('0xb')](function(_0x48b94e){logger[_0xc64b('0xc')]('ShowSalesforceAccount',_0x5ead31);logger['debug'](_0xc64b('0x1f'),_0x5ead31,JSON[_0xc64b('0x10')](_0x48b94e));_0x51a5a6(_0x48b94e);})[_0xc64b('0x14')](function(_0x5cde32){logger[_0xc64b('0x11')]('ShowSalesforceAccount',_0x5cde32[_0xc64b('0x13')],_0x5ead31);_0xf528bc(_0x10141e[_0xc64b('0x11')](0x1f4,_0x5cde32[_0xc64b('0x13')]));});});}; \ No newline at end of file +var _0x67bc=['message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','raw','options','where','attributes','limit','map','include','model','ShowSalesforceAccount','find','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x596df2,_0x205d9d){var _0xf73e7d=function(_0x1c8636){while(--_0x1c8636){_0x596df2['push'](_0x596df2['shift']());}};_0xf73e7d(++_0x205d9d);}(_0x67bc,0x179));var _0xc67b=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0x67bc[_0xeff2c3];return _0x2cade6;};'use strict';var _=require('lodash');var util=require(_0xc67b('0x0'));var moment=require(_0xc67b('0x1'));var BPromise=require('bluebird');var rs=require(_0xc67b('0x2'));var fs=require('fs');var Redis=require(_0xc67b('0x3'));var db=require(_0xc67b('0x4'))['db'];var utils=require(_0xc67b('0x5'));var logger=require(_0xc67b('0x6'))(_0xc67b('0x7'));var config=require(_0xc67b('0x8'));var jayson=require(_0xc67b('0x9'));var client=jayson[_0xc67b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ee900,_0x2b8012,_0x3d1b32){return new BPromise(function(_0x2e82c5,_0x157989){return client[_0xc67b('0xb')](_0x4ee900,_0x3d1b32)[_0xc67b('0xc')](function(_0x55bf5e){logger[_0xc67b('0xd')](_0xc67b('0xe'),_0x2b8012,'request\x20sent');logger['debug'](_0xc67b('0xf'),_0x2b8012,_0xc67b('0x10'),JSON[_0xc67b('0x11')](_0x55bf5e));if(_0x55bf5e[_0xc67b('0x12')]){if(_0x55bf5e[_0xc67b('0x12')]['code']===0x1f4){logger[_0xc67b('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x2b8012,_0x55bf5e['error']['message']);return _0x157989(_0x55bf5e[_0xc67b('0x12')]['message']);}logger[_0xc67b('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x2b8012,_0x55bf5e[_0xc67b('0x12')][_0xc67b('0x13')]);return _0x2e82c5(_0x55bf5e['error'][_0xc67b('0x13')]);}else{logger[_0xc67b('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x2b8012,_0xc67b('0x10'));_0x2e82c5(_0x55bf5e[_0xc67b('0x14')][_0xc67b('0x13')]);}})[_0xc67b('0x15')](function(_0x4f6c05){logger[_0xc67b('0x12')](_0xc67b('0xe'),_0x2b8012,_0x4f6c05);_0x157989(_0x4f6c05);});});}exports[_0xc67b('0x16')]=function(_0x40e0d7){var _0x4effc3=this;return new Promise(function(_0x3e93c4,_0x1d8ed4){return db[_0xc67b('0x17')][_0xc67b('0x18')]({'raw':_0x40e0d7['options']?_0x40e0d7['options'][_0xc67b('0x19')]===undefined?!![]:![]:!![],'where':_0x40e0d7[_0xc67b('0x1a')]?_0x40e0d7[_0xc67b('0x1a')][_0xc67b('0x1b')]||null:null,'attributes':_0x40e0d7['options']?_0x40e0d7['options'][_0xc67b('0x1c')]||null:null,'limit':_0x40e0d7['options']?_0x40e0d7[_0xc67b('0x1a')][_0xc67b('0x1d')]||null:null,'include':_0x40e0d7[_0xc67b('0x1a')]?_0x40e0d7['options']['include']?_[_0xc67b('0x1e')](_0x40e0d7[_0xc67b('0x1a')][_0xc67b('0x1f')],function(_0x343b84){return{'model':db[_0x343b84[_0xc67b('0x20')]],'as':_0x343b84['as'],'attributes':_0x343b84[_0xc67b('0x1c')],'include':_0x343b84[_0xc67b('0x1f')]?_[_0xc67b('0x1e')](_0x343b84[_0xc67b('0x1f')],function(_0x1ec5f7){return{'model':db[_0x1ec5f7[_0xc67b('0x20')]],'as':_0x1ec5f7['as'],'attributes':_0x1ec5f7['attributes'],'include':_0x1ec5f7['include']?_[_0xc67b('0x1e')](_0x1ec5f7[_0xc67b('0x1f')],function(_0x334351){return{'model':db[_0x334351[_0xc67b('0x20')]],'as':_0x334351['as'],'attributes':_0x334351[_0xc67b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc67b('0xc')](function(_0x3168b0){logger[_0xc67b('0xd')](_0xc67b('0x16'),_0x40e0d7);logger['debug']('GetSalesforceAccount',_0x40e0d7,JSON[_0xc67b('0x11')](_0x3168b0));_0x3e93c4(_0x3168b0);})[_0xc67b('0x15')](function(_0x8ea782){logger[_0xc67b('0x12')](_0xc67b('0x16'),_0x8ea782['message'],_0x40e0d7);_0x1d8ed4(_0x4effc3[_0xc67b('0x12')](0x1f4,_0x8ea782[_0xc67b('0x13')]));});});};exports[_0xc67b('0x21')]=function(_0xbce8e2){var _0x2a2cf3=this;return new Promise(function(_0x2bb8bb,_0x3d6e16){return db[_0xc67b('0x17')][_0xc67b('0x22')]({'raw':_0xbce8e2[_0xc67b('0x1a')]?_0xbce8e2[_0xc67b('0x1a')][_0xc67b('0x19')]===undefined?!![]:![]:!![],'where':_0xbce8e2['options']?_0xbce8e2[_0xc67b('0x1a')]['where']||null:null,'attributes':_0xbce8e2['options']?_0xbce8e2[_0xc67b('0x1a')]['attributes']||null:null,'include':_0xbce8e2['options']?_0xbce8e2[_0xc67b('0x1a')][_0xc67b('0x1f')]?_[_0xc67b('0x1e')](_0xbce8e2['options'][_0xc67b('0x1f')],function(_0xf52587){return{'model':db[_0xf52587['model']],'as':_0xf52587['as'],'attributes':_0xf52587[_0xc67b('0x1c')],'include':_0xf52587[_0xc67b('0x1f')]?_[_0xc67b('0x1e')](_0xf52587[_0xc67b('0x1f')],function(_0x24612f){return{'model':db[_0x24612f[_0xc67b('0x20')]],'as':_0x24612f['as'],'attributes':_0x24612f[_0xc67b('0x1c')],'include':_0x24612f[_0xc67b('0x1f')]?_[_0xc67b('0x1e')](_0x24612f[_0xc67b('0x1f')],function(_0x2a0b0b){return{'model':db[_0x2a0b0b[_0xc67b('0x20')]],'as':_0x2a0b0b['as'],'attributes':_0x2a0b0b[_0xc67b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc67b('0xc')](function(_0x1250b8){logger[_0xc67b('0xd')](_0xc67b('0x21'),_0xbce8e2);logger[_0xc67b('0x23')](_0xc67b('0x21'),_0xbce8e2,JSON['stringify'](_0x1250b8));_0x2bb8bb(_0x1250b8);})[_0xc67b('0x15')](function(_0x11805a){logger[_0xc67b('0x12')](_0xc67b('0x21'),_0x11805a[_0xc67b('0x13')],_0xbce8e2);_0x3d6e16(_0x2a2cf3[_0xc67b('0x12')](0x1f4,_0x11805a['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index a9211f1..bc75bb4 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(_0x2fffbe,_0x51bab9){var _0x346b0f=function(_0x45c4e2){while(--_0x45c4e2){_0x2fffbe['push'](_0x2fffbe['shift']());}};_0x346b0f(++_0x51bab9);}(_0x2ef3,0xba));var _0x32ef=function(_0x40e8cc,_0x5c179d){_0x40e8cc=_0x40e8cc-0x0;var _0x483abc=_0x2ef3[_0x40e8cc];return _0x483abc;};'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 _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(_0x2cd5db,_0x10728b){var _0x2c7089=function(_0x5682dd){while(--_0x5682dd){_0x2cd5db['push'](_0x2cd5db['shift']());}};_0x2c7089(++_0x10728b);}(_0x2ef3,0xba));var _0x32ef=function(_0xc79d13,_0x3e10de){_0xc79d13=_0xc79d13-0x0;var _0x44811d=_0x2ef3[_0xc79d13];return _0x44811d;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index bab1319..2454f7b 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 _0x0f3e=['nothing','contact','sequelize','STRING','Task','Case','ENUM','contact_lead','lead','account_contact_lead','account'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0f3e,0x1e6));var _0xe0f3=function(_0x4dde11,_0x341645){_0x4dde11=_0x4dde11-0x0;var _0x1384f0=_0x0f3e[_0x4dde11];return _0x1384f0;};'use strict';var Sequelize=require(_0xe0f3('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0f3('0x1')]},'description':{'type':Sequelize[_0xe0f3('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xe0f3('0x2'),_0xe0f3('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xe0f3('0x4')](_0xe0f3('0x5'),'contact',_0xe0f3('0x6'),_0xe0f3('0x7'),_0xe0f3('0x8')),'defaultValue':_0xe0f3('0x5')},'moduleCreate':{'type':Sequelize[_0xe0f3('0x4')](_0xe0f3('0x9'),_0xe0f3('0xa'),_0xe0f3('0x6'),_0xe0f3('0x8')),'defaultValue':_0xe0f3('0x6')},'leadId':{'type':Sequelize[_0xe0f3('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xe0f3('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xe0f3('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xe0f3('0x1')]}}; \ No newline at end of file +var _0x6299=['STRING','ENUM','Task','Case','contact_lead','nothing','lead','sequelize'];(function(_0xaa3810,_0x22afc3){var _0x349475=function(_0x4872eb){while(--_0x4872eb){_0xaa3810['push'](_0xaa3810['shift']());}};_0x349475(++_0x22afc3);}(_0x6299,0x1af));var _0x9629=function(_0x14ce34,_0x433db1){_0x14ce34=_0x14ce34-0x0;var _0x46240f=_0x6299[_0x14ce34];return _0x46240f;};'use strict';var Sequelize=require(_0x9629('0x0'));module['exports']={'name':{'type':Sequelize[_0x9629('0x1')]},'description':{'type':Sequelize[_0x9629('0x1')]},'ticketType':{'type':Sequelize[_0x9629('0x2')](_0x9629('0x3'),_0x9629('0x4')),'defaultValue':_0x9629('0x3')},'moduleSearch':{'type':Sequelize[_0x9629('0x2')](_0x9629('0x5'),'contact','lead','account_contact_lead','account'),'defaultValue':_0x9629('0x5')},'moduleCreate':{'type':Sequelize[_0x9629('0x2')](_0x9629('0x6'),'contact','lead','account'),'defaultValue':_0x9629('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x9629('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x9629('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index fd66003..63fc653 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 _0x56e7=['then','destroy','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','keys','length','create','body','find','getFields','findOne','SalesforceField','order','options','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x585936,_0x4bfddb){var _0x283a46=function(_0x244bb7){while(--_0x244bb7){_0x585936['push'](_0x585936['shift']());}};_0x283a46(++_0x4bfddb);}(_0x56e7,0x7b));var _0x756e=function(_0x4b3892,_0xe717e6){_0x4b3892=_0x4b3892-0x0;var _0x3ae6fc=_0x56e7[_0x4b3892];return _0x3ae6fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x756e('0x0'));var zipdir=require(_0x756e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x756e('0x2'));var moment=require(_0x756e('0x3'));var BPromise=require(_0x756e('0x4'));var Mustache=require(_0x756e('0x5'));var util=require(_0x756e('0x6'));var path=require(_0x756e('0x7'));var sox=require(_0x756e('0x8'));var csv=require('to-csv');var ejs=require(_0x756e('0x9'));var fs=require('fs');var fs_extra=require(_0x756e('0xa'));var _=require(_0x756e('0xb'));var squel=require(_0x756e('0xc'));var crypto=require('crypto');var jsforce=require(_0x756e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x756e('0xe'));var querystring=require(_0x756e('0xf'));var Papa=require(_0x756e('0x10'));var Redis=require(_0x756e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x756e('0x12'));var hardwareService=require(_0x756e('0x13'));var logger=require(_0x756e('0x14'))('api');var utils=require(_0x756e('0x15'));var config=require(_0x756e('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b68ef,_0x569e8f){_0x569e8f=_0x569e8f||0xcc;return function(_0x459237){if(_0x459237){return _0x1b68ef[_0x756e('0x17')](_0x569e8f);}return _0x1b68ef[_0x756e('0x18')](_0x569e8f)[_0x756e('0x19')]();};}function respondWithResult(_0x252333,_0x4ae32a){_0x4ae32a=_0x4ae32a||0xc8;return function(_0x4b3660){if(_0x4b3660){return _0x252333[_0x756e('0x18')](_0x4ae32a)[_0x756e('0x1a')](_0x4b3660);}};}function respondWithFilteredResult(_0xccccd4,_0x59956f){return function(_0x530e36){if(_0x530e36){var _0x1f7161=typeof _0x59956f[_0x756e('0x1b')]===_0x756e('0x1c')&&typeof _0x59956f[_0x756e('0x1d')]===_0x756e('0x1c');var _0x285290=_0x530e36[_0x756e('0x1e')];var _0x1a8614=_0x1f7161?0x0:_0x59956f[_0x756e('0x1b')];var _0x4da91f=_0x1f7161?_0x530e36[_0x756e('0x1e')]:_0x59956f['offset']+_0x59956f['limit'];var _0x157be3;if(_0x4da91f>=_0x285290){_0x4da91f=_0x285290;_0x157be3=0xc8;}else{_0x157be3=0xce;}_0xccccd4[_0x756e('0x18')](_0x157be3);return _0xccccd4[_0x756e('0x1f')](_0x756e('0x20'),_0x1a8614+'-'+_0x4da91f+'/'+_0x285290)[_0x756e('0x1a')](_0x530e36);}return null;};}function patchUpdates(_0x4e99a2){return function(_0xb00195){try{jsonpatch[_0x756e('0x21')](_0xb00195,_0x4e99a2,!![]);}catch(_0x88787d){return BPromise[_0x756e('0x22')](_0x88787d);}return _0xb00195[_0x756e('0x23')]();};}function saveUpdates(_0x83cdb5,_0x42173f){return function(_0x24d4ad){if(_0x24d4ad){return _0x24d4ad[_0x756e('0x24')](_0x83cdb5)[_0x756e('0x25')](function(_0x4b3230){return _0x4b3230;});}return null;};}function removeEntity(_0x335523,_0x4b38b4){return function(_0x256dc1){if(_0x256dc1){return _0x256dc1[_0x756e('0x26')]()[_0x756e('0x25')](function(){_0x335523[_0x756e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ef5ef,_0x4cbd7){return function(_0x2f4db8){if(!_0x2f4db8){_0x3ef5ef['sendStatus'](0x194);}return _0x2f4db8;};}function handleError(_0x32815d,_0x44f8f9){_0x44f8f9=_0x44f8f9||0x1f4;return function(_0x29dffb){logger['error'](_0x29dffb[_0x756e('0x27')]);if(_0x29dffb[_0x756e('0x28')]){delete _0x29dffb['name'];}_0x32815d[_0x756e('0x18')](_0x44f8f9)[_0x756e('0x29')](_0x29dffb);};}exports[_0x756e('0x2a')]=function(_0x5a1cf0,_0x3c332e){var _0x308153={},_0x5c6949={},_0x20543c={'count':0x0,'rows':[]};var _0x2a7fdb=_['map'](db[_0x756e('0x2b')][_0x756e('0x2c')],function(_0x39acd7){return{'name':_0x39acd7[_0x756e('0x2d')],'type':_0x39acd7[_0x756e('0x2e')]['key']};});_0x5c6949[_0x756e('0x2f')]=_['map'](_0x2a7fdb,'name');_0x5c6949[_0x756e('0x30')]=_['keys'](_0x5a1cf0[_0x756e('0x30')]);_0x5c6949[_0x756e('0x31')]=_[_0x756e('0x32')](_0x5c6949[_0x756e('0x2f')],_0x5c6949[_0x756e('0x30')]);_0x308153[_0x756e('0x33')]=_[_0x756e('0x32')](_0x5c6949[_0x756e('0x2f')],qs[_0x756e('0x34')](_0x5a1cf0[_0x756e('0x30')][_0x756e('0x34')]));_0x308153[_0x756e('0x33')]=_0x308153['attributes']['length']?_0x308153[_0x756e('0x33')]:_0x5c6949[_0x756e('0x2f')];if(!_0x5a1cf0[_0x756e('0x30')][_0x756e('0x35')](_0x756e('0x36'))){_0x308153[_0x756e('0x1d')]=qs[_0x756e('0x1d')](_0x5a1cf0['query']['limit']);_0x308153['offset']=qs[_0x756e('0x1b')](_0x5a1cf0[_0x756e('0x30')][_0x756e('0x1b')]);}_0x308153['order']=qs[_0x756e('0x37')](_0x5a1cf0[_0x756e('0x30')]['sort']);_0x308153[_0x756e('0x38')]=qs[_0x756e('0x31')](_[_0x756e('0x39')](_0x5a1cf0[_0x756e('0x30')],_0x5c6949[_0x756e('0x31')]),_0x2a7fdb);if(_0x5a1cf0[_0x756e('0x30')][_0x756e('0x3a')]){_0x308153[_0x756e('0x38')]=_['merge'](_0x308153[_0x756e('0x38')],{'$or':_[_0x756e('0x3b')](_0x2a7fdb,function(_0x20f979){if(_0x20f979[_0x756e('0x2e')]!==_0x756e('0x3c')){var _0x3a66fe={};_0x3a66fe[_0x20f979[_0x756e('0x28')]]={'$like':'%'+_0x5a1cf0[_0x756e('0x30')][_0x756e('0x3a')]+'%'};return _0x3a66fe;}})});}_0x308153=_[_0x756e('0x3d')]({},_0x308153,_0x5a1cf0['options']);var _0x41a100={'where':_0x308153[_0x756e('0x38')]};return db['SalesforceConfiguration'][_0x756e('0x1e')](_0x41a100)[_0x756e('0x25')](function(_0x2b4fc3){_0x20543c['count']=_0x2b4fc3;if(_0x5a1cf0[_0x756e('0x30')][_0x756e('0x3e')]){_0x308153[_0x756e('0x3f')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x756e('0x40')](_0x308153);})[_0x756e('0x25')](function(_0x5856f){_0x20543c[_0x756e('0x41')]=_0x5856f;return _0x20543c;})[_0x756e('0x25')](respondWithFilteredResult(_0x3c332e,_0x308153))[_0x756e('0x42')](handleError(_0x3c332e,null));};exports['show']=function(_0x9bedd3,_0x2b593d){var _0x5c471e={'raw':![],'where':{'id':_0x9bedd3[_0x756e('0x43')]['id']}},_0xa031fb={};_0xa031fb[_0x756e('0x2f')]=_[_0x756e('0x44')](db[_0x756e('0x2b')][_0x756e('0x2c')]);_0xa031fb[_0x756e('0x30')]=_[_0x756e('0x44')](_0x9bedd3[_0x756e('0x30')]);_0xa031fb['filters']=_[_0x756e('0x32')](_0xa031fb['model'],_0xa031fb[_0x756e('0x30')]);_0x5c471e[_0x756e('0x33')]=_[_0x756e('0x32')](_0xa031fb['model'],qs[_0x756e('0x34')](_0x9bedd3[_0x756e('0x30')][_0x756e('0x34')]));_0x5c471e['attributes']=_0x5c471e['attributes'][_0x756e('0x45')]?_0x5c471e[_0x756e('0x33')]:_0xa031fb['model'];if(_0x9bedd3['query'][_0x756e('0x3e')]){_0x5c471e[_0x756e('0x3f')]=[{'all':!![]}];}_0x5c471e=_[_0x756e('0x3d')]({},_0x5c471e,_0x9bedd3['options']);return db[_0x756e('0x2b')]['find'](_0x5c471e)[_0x756e('0x25')](handleEntityNotFound(_0x2b593d,null))[_0x756e('0x25')](respondWithResult(_0x2b593d,null))[_0x756e('0x42')](handleError(_0x2b593d,null));};exports['create']=function(_0x31d076,_0x5224f2){return db['SalesforceConfiguration'][_0x756e('0x46')](_0x31d076['body'],{})[_0x756e('0x25')](respondWithResult(_0x5224f2,0xc9))[_0x756e('0x42')](handleError(_0x5224f2,null));};exports[_0x756e('0x24')]=function(_0x2512d3,_0x95061c){if(_0x2512d3[_0x756e('0x47')]['id']){delete _0x2512d3['body']['id'];}return db[_0x756e('0x2b')]['find']({'where':{'id':_0x2512d3[_0x756e('0x43')]['id']}})['then'](handleEntityNotFound(_0x95061c,null))[_0x756e('0x25')](saveUpdates(_0x2512d3['body'],null))[_0x756e('0x25')](respondWithResult(_0x95061c,null))['catch'](handleError(_0x95061c,null));};exports[_0x756e('0x26')]=function(_0x37ddd0,_0x27a201){return db['SalesforceConfiguration'][_0x756e('0x48')]({'where':{'id':_0x37ddd0[_0x756e('0x43')]['id']}})['then'](handleEntityNotFound(_0x27a201,null))['then'](removeEntity(_0x27a201,null))[_0x756e('0x42')](handleError(_0x27a201,null));};exports[_0x756e('0x49')]=function(_0x34a556,_0x2ef29e,_0x3d78a8){var _0x2197ec={};var _0x435729={};var _0x9e8559;var _0x33f923;return db['SalesforceConfiguration'][_0x756e('0x4a')]({'where':{'id':_0x34a556[_0x756e('0x43')]['id']}})[_0x756e('0x25')](handleEntityNotFound(_0x2ef29e,null))[_0x756e('0x25')](function(_0x3b0c61){if(_0x3b0c61){_0x9e8559=_0x3b0c61;_0x435729[_0x756e('0x2f')]=_[_0x756e('0x44')](db[_0x756e('0x4b')]['rawAttributes']);_0x435729[_0x756e('0x30')]=_[_0x756e('0x44')](_0x34a556['query']);_0x435729[_0x756e('0x31')]=_['intersection'](_0x435729[_0x756e('0x2f')],_0x435729[_0x756e('0x30')]);_0x2197ec[_0x756e('0x33')]=_['intersection'](_0x435729[_0x756e('0x2f')],qs[_0x756e('0x34')](_0x34a556[_0x756e('0x30')]['fields']));_0x2197ec[_0x756e('0x33')]=_0x2197ec['attributes'][_0x756e('0x45')]?_0x2197ec[_0x756e('0x33')]:_0x435729[_0x756e('0x2f')];_0x2197ec[_0x756e('0x4c')]=qs[_0x756e('0x37')](_0x34a556[_0x756e('0x30')][_0x756e('0x37')]);_0x2197ec[_0x756e('0x38')]=qs['filters'](_[_0x756e('0x39')](_0x34a556[_0x756e('0x30')],_0x435729[_0x756e('0x31')]));if(_0x34a556[_0x756e('0x30')][_0x756e('0x3a')]){_0x2197ec[_0x756e('0x38')]=_[_0x756e('0x3d')](_0x2197ec[_0x756e('0x38')],{'$or':_[_0x756e('0x3b')](_0x2197ec[_0x756e('0x33')],function(_0x237a29){var _0x176d84={};_0x176d84[_0x237a29]={'$like':'%'+_0x34a556[_0x756e('0x30')][_0x756e('0x3a')]+'%'};return _0x176d84;})});}_0x2197ec=_['merge']({},_0x2197ec,_0x34a556[_0x756e('0x4d')]);return _0x9e8559[_0x756e('0x49')](_0x2197ec);}})[_0x756e('0x25')](function(_0x22b8f3){if(_0x22b8f3){_0x33f923=_0x22b8f3[_0x756e('0x45')];if(!_0x34a556[_0x756e('0x30')]['hasOwnProperty'](_0x756e('0x36'))){_0x2197ec[_0x756e('0x1d')]=qs[_0x756e('0x1d')](_0x34a556[_0x756e('0x30')]['limit']);_0x2197ec['offset']=qs[_0x756e('0x1b')](_0x34a556[_0x756e('0x30')][_0x756e('0x1b')]);}return _0x9e8559[_0x756e('0x49')](_0x2197ec);}})['then'](function(_0x227f8e){if(_0x227f8e){return _0x227f8e?{'count':_0x33f923,'rows':_0x227f8e}:null;}})[_0x756e('0x25')](respondWithResult(_0x2ef29e,null))[_0x756e('0x42')](handleError(_0x2ef29e,null));};exports[_0x756e('0x4e')]=function(_0x4de856,_0x5c580b,_0x207228){var _0x2eefd8={};var _0x3feff8={};var _0xdbd179;var _0x21863a;return db[_0x756e('0x2b')][_0x756e('0x4a')]({'where':{'id':_0x4de856[_0x756e('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c580b,null))['then'](function(_0x465886){if(_0x465886){_0xdbd179=_0x465886;_0x3feff8[_0x756e('0x2f')]=_[_0x756e('0x44')](db[_0x756e('0x4b')][_0x756e('0x2c')]);_0x3feff8[_0x756e('0x30')]=_[_0x756e('0x44')](_0x4de856['query']);_0x3feff8[_0x756e('0x31')]=_['intersection'](_0x3feff8[_0x756e('0x2f')],_0x3feff8['query']);_0x2eefd8[_0x756e('0x33')]=_[_0x756e('0x32')](_0x3feff8[_0x756e('0x2f')],qs['fields'](_0x4de856[_0x756e('0x30')][_0x756e('0x34')]));_0x2eefd8[_0x756e('0x33')]=_0x2eefd8[_0x756e('0x33')][_0x756e('0x45')]?_0x2eefd8[_0x756e('0x33')]:_0x3feff8[_0x756e('0x2f')];_0x2eefd8['order']=qs['sort'](_0x4de856[_0x756e('0x30')][_0x756e('0x37')]);_0x2eefd8[_0x756e('0x38')]=qs[_0x756e('0x31')](_[_0x756e('0x39')](_0x4de856[_0x756e('0x30')],_0x3feff8['filters']));if(_0x4de856[_0x756e('0x30')][_0x756e('0x3a')]){_0x2eefd8[_0x756e('0x38')]=_[_0x756e('0x3d')](_0x2eefd8[_0x756e('0x38')],{'$or':_[_0x756e('0x3b')](_0x2eefd8[_0x756e('0x33')],function(_0x3041da){var _0x5bf8c9={};_0x5bf8c9[_0x3041da]={'$like':'%'+_0x4de856[_0x756e('0x30')][_0x756e('0x3a')]+'%'};return _0x5bf8c9;})});}_0x2eefd8=_[_0x756e('0x3d')]({},_0x2eefd8,_0x4de856[_0x756e('0x4d')]);return _0xdbd179[_0x756e('0x4e')](_0x2eefd8);}})['then'](function(_0x4b1148){if(_0x4b1148){_0x21863a=_0x4b1148[_0x756e('0x45')];if(!_0x4de856['query'][_0x756e('0x35')]('nolimit')){_0x2eefd8[_0x756e('0x1d')]=qs['limit'](_0x4de856[_0x756e('0x30')][_0x756e('0x1d')]);_0x2eefd8[_0x756e('0x1b')]=qs['offset'](_0x4de856[_0x756e('0x30')]['offset']);}return _0xdbd179[_0x756e('0x4e')](_0x2eefd8);}})[_0x756e('0x25')](function(_0x23a872){if(_0x23a872){return _0x23a872?{'count':_0x21863a,'rows':_0x23a872}:null;}})[_0x756e('0x25')](respondWithResult(_0x5c580b,null))[_0x756e('0x42')](handleError(_0x5c580b,null));};exports[_0x756e('0x4f')]=function(_0x38c0c7,_0x5b087a,_0xe3e3b6){var _0x1a07c6={};var _0x5d690a={};var _0x2c5ab3;var _0x5334ab;return db['SalesforceConfiguration'][_0x756e('0x4a')]({'where':{'id':_0x38c0c7['params']['id']}})[_0x756e('0x25')](handleEntityNotFound(_0x5b087a,null))['then'](function(_0x270808){if(_0x270808){_0x2c5ab3=_0x270808;_0x5d690a['model']=_[_0x756e('0x44')](db[_0x756e('0x4b')][_0x756e('0x2c')]);_0x5d690a[_0x756e('0x30')]=_[_0x756e('0x44')](_0x38c0c7[_0x756e('0x30')]);_0x5d690a[_0x756e('0x31')]=_[_0x756e('0x32')](_0x5d690a[_0x756e('0x2f')],_0x5d690a[_0x756e('0x30')]);_0x1a07c6[_0x756e('0x33')]=_[_0x756e('0x32')](_0x5d690a[_0x756e('0x2f')],qs['fields'](_0x38c0c7['query'][_0x756e('0x34')]));_0x1a07c6[_0x756e('0x33')]=_0x1a07c6[_0x756e('0x33')][_0x756e('0x45')]?_0x1a07c6[_0x756e('0x33')]:_0x5d690a[_0x756e('0x2f')];_0x1a07c6[_0x756e('0x4c')]=qs['sort'](_0x38c0c7[_0x756e('0x30')][_0x756e('0x37')]);_0x1a07c6[_0x756e('0x38')]=qs[_0x756e('0x31')](_[_0x756e('0x39')](_0x38c0c7['query'],_0x5d690a[_0x756e('0x31')]));if(_0x38c0c7['query']['filter']){_0x1a07c6[_0x756e('0x38')]=_['merge'](_0x1a07c6[_0x756e('0x38')],{'$or':_[_0x756e('0x3b')](_0x1a07c6['attributes'],function(_0x4130e3){var _0x2d3950={};_0x2d3950[_0x4130e3]={'$like':'%'+_0x38c0c7[_0x756e('0x30')][_0x756e('0x3a')]+'%'};return _0x2d3950;})});}_0x1a07c6=_[_0x756e('0x3d')]({},_0x1a07c6,_0x38c0c7['options']);return _0x2c5ab3[_0x756e('0x4f')](_0x1a07c6);}})[_0x756e('0x25')](function(_0x33e506){if(_0x33e506){_0x5334ab=_0x33e506[_0x756e('0x45')];if(!_0x38c0c7[_0x756e('0x30')]['hasOwnProperty']('nolimit')){_0x1a07c6['limit']=qs[_0x756e('0x1d')](_0x38c0c7['query'][_0x756e('0x1d')]);_0x1a07c6[_0x756e('0x1b')]=qs[_0x756e('0x1b')](_0x38c0c7['query'][_0x756e('0x1b')]);}return _0x2c5ab3['getDescriptions'](_0x1a07c6);}})[_0x756e('0x25')](function(_0x59cdd4){if(_0x59cdd4){return _0x59cdd4?{'count':_0x5334ab,'rows':_0x59cdd4}:null;}})[_0x756e('0x25')](respondWithResult(_0x5b087a,null))[_0x756e('0x42')](handleError(_0x5b087a,null));}; \ No newline at end of file +var _0x968b=['sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','SalesforceConfiguration','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','SalesforceField','order','options','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x277079,_0x511204){var _0x205a0b=function(_0x4f7df8){while(--_0x4f7df8){_0x277079['push'](_0x277079['shift']());}};_0x205a0b(++_0x511204);}(_0x968b,0x8f));var _0xb968=function(_0x2912b9,_0x55e6e1){_0x2912b9=_0x2912b9-0x0;var _0x154da8=_0x968b[_0x2912b9];return _0x154da8;};'use strict';var emlformat=require(_0xb968('0x0'));var rimraf=require(_0xb968('0x1'));var zipdir=require(_0xb968('0x2'));var jsonpatch=require(_0xb968('0x3'));var rp=require('request-promise');var moment=require(_0xb968('0x4'));var BPromise=require(_0xb968('0x5'));var Mustache=require(_0xb968('0x6'));var util=require(_0xb968('0x7'));var path=require(_0xb968('0x8'));var sox=require(_0xb968('0x9'));var csv=require(_0xb968('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb968('0xb'));var squel=require(_0xb968('0xc'));var crypto=require(_0xb968('0xd'));var jsforce=require(_0xb968('0xe'));var deskjs=require(_0xb968('0xf'));var toCsv=require(_0xb968('0xa'));var querystring=require(_0xb968('0x10'));var Papa=require(_0xb968('0x11'));var Redis=require(_0xb968('0x12'));var authService=require(_0xb968('0x13'));var qs=require(_0xb968('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb968('0x15'))(_0xb968('0x16'));var utils=require(_0xb968('0x17'));var config=require(_0xb968('0x18'));var licenseUtil=require(_0xb968('0x19'));var db=require(_0xb968('0x1a'))['db'];function respondWithStatusCode(_0x5d4011,_0xbf7ec9){_0xbf7ec9=_0xbf7ec9||0xcc;return function(_0x522435){if(_0x522435){return _0x5d4011[_0xb968('0x1b')](_0xbf7ec9);}return _0x5d4011[_0xb968('0x1c')](_0xbf7ec9)['end']();};}function respondWithResult(_0x1acb5d,_0x3e2883){_0x3e2883=_0x3e2883||0xc8;return function(_0x3de6c4){if(_0x3de6c4){return _0x1acb5d[_0xb968('0x1c')](_0x3e2883)['json'](_0x3de6c4);}};}function respondWithFilteredResult(_0x16ea39,_0x38b264){return function(_0x5f246b){if(_0x5f246b){var _0x23aed8=typeof _0x38b264[_0xb968('0x1d')]===_0xb968('0x1e')&&typeof _0x38b264[_0xb968('0x1f')]===_0xb968('0x1e');var _0x8d7421=_0x5f246b[_0xb968('0x20')];var _0x3a249c=_0x23aed8?0x0:_0x38b264[_0xb968('0x1d')];var _0x3cfe4e=_0x23aed8?_0x5f246b[_0xb968('0x20')]:_0x38b264[_0xb968('0x1d')]+_0x38b264[_0xb968('0x1f')];var _0x10da7c;if(_0x3cfe4e>=_0x8d7421){_0x3cfe4e=_0x8d7421;_0x10da7c=0xc8;}else{_0x10da7c=0xce;}_0x16ea39[_0xb968('0x1c')](_0x10da7c);return _0x16ea39[_0xb968('0x21')](_0xb968('0x22'),_0x3a249c+'-'+_0x3cfe4e+'/'+_0x8d7421)[_0xb968('0x23')](_0x5f246b);}return null;};}function patchUpdates(_0x25318e){return function(_0x141ba0){try{jsonpatch[_0xb968('0x24')](_0x141ba0,_0x25318e,!![]);}catch(_0x2e8c20){return BPromise[_0xb968('0x25')](_0x2e8c20);}return _0x141ba0[_0xb968('0x26')]();};}function saveUpdates(_0x4f3f8d,_0x541a81){return function(_0x5b229d){if(_0x5b229d){return _0x5b229d[_0xb968('0x27')](_0x4f3f8d)['then'](function(_0xb1844){return _0xb1844;});}return null;};}function removeEntity(_0x56e93f,_0x15106d){return function(_0x47a955){if(_0x47a955){return _0x47a955[_0xb968('0x28')]()[_0xb968('0x29')](function(){_0x56e93f[_0xb968('0x1c')](0xcc)[_0xb968('0x2a')]();});}};}function handleEntityNotFound(_0x516b8f,_0x6a473c){return function(_0x5299a3){if(!_0x5299a3){_0x516b8f[_0xb968('0x1b')](0x194);}return _0x5299a3;};}function handleError(_0x406c9f,_0x5eeddc){_0x5eeddc=_0x5eeddc||0x1f4;return function(_0x2d8b88){logger[_0xb968('0x2b')](_0x2d8b88[_0xb968('0x2c')]);if(_0x2d8b88[_0xb968('0x2d')]){delete _0x2d8b88[_0xb968('0x2d')];}_0x406c9f[_0xb968('0x1c')](_0x5eeddc)[_0xb968('0x2e')](_0x2d8b88);};}exports['index']=function(_0x9386bc,_0x3e03ba){var _0x5152b1={},_0x450e74={},_0x64259f={'count':0x0,'rows':[]};var _0x47fe03=_['map'](db['SalesforceConfiguration'][_0xb968('0x2f')],function(_0x7f2997){return{'name':_0x7f2997[_0xb968('0x30')],'type':_0x7f2997[_0xb968('0x31')][_0xb968('0x32')]};});_0x450e74[_0xb968('0x33')]=_[_0xb968('0x34')](_0x47fe03,_0xb968('0x2d'));_0x450e74[_0xb968('0x35')]=_[_0xb968('0x36')](_0x9386bc['query']);_0x450e74[_0xb968('0x37')]=_[_0xb968('0x38')](_0x450e74['model'],_0x450e74[_0xb968('0x35')]);_0x5152b1[_0xb968('0x39')]=_[_0xb968('0x38')](_0x450e74[_0xb968('0x33')],qs[_0xb968('0x3a')](_0x9386bc[_0xb968('0x35')][_0xb968('0x3a')]));_0x5152b1[_0xb968('0x39')]=_0x5152b1[_0xb968('0x39')][_0xb968('0x3b')]?_0x5152b1['attributes']:_0x450e74[_0xb968('0x33')];if(!_0x9386bc[_0xb968('0x35')][_0xb968('0x3c')]('nolimit')){_0x5152b1['limit']=qs['limit'](_0x9386bc[_0xb968('0x35')]['limit']);_0x5152b1[_0xb968('0x1d')]=qs[_0xb968('0x1d')](_0x9386bc[_0xb968('0x35')][_0xb968('0x1d')]);}_0x5152b1['order']=qs[_0xb968('0x3d')](_0x9386bc[_0xb968('0x35')][_0xb968('0x3d')]);_0x5152b1[_0xb968('0x3e')]=qs['filters'](_[_0xb968('0x3f')](_0x9386bc['query'],_0x450e74[_0xb968('0x37')]),_0x47fe03);if(_0x9386bc[_0xb968('0x35')][_0xb968('0x40')]){_0x5152b1[_0xb968('0x3e')]=_[_0xb968('0x41')](_0x5152b1[_0xb968('0x3e')],{'$or':_['map'](_0x47fe03,function(_0x4a2657){if(_0x4a2657['type']!==_0xb968('0x42')){var _0x2b0e80={};_0x2b0e80[_0x4a2657[_0xb968('0x2d')]]={'$like':'%'+_0x9386bc[_0xb968('0x35')][_0xb968('0x40')]+'%'};return _0x2b0e80;}})});}_0x5152b1=_[_0xb968('0x41')]({},_0x5152b1,_0x9386bc['options']);var _0x5eba3b={'where':_0x5152b1[_0xb968('0x3e')]};return db[_0xb968('0x43')][_0xb968('0x20')](_0x5eba3b)['then'](function(_0x405858){_0x64259f[_0xb968('0x20')]=_0x405858;if(_0x9386bc[_0xb968('0x35')][_0xb968('0x44')]){_0x5152b1[_0xb968('0x45')]=[{'all':!![]}];}return db[_0xb968('0x43')][_0xb968('0x46')](_0x5152b1);})[_0xb968('0x29')](function(_0x14663b){_0x64259f[_0xb968('0x47')]=_0x14663b;return _0x64259f;})['then'](respondWithFilteredResult(_0x3e03ba,_0x5152b1))[_0xb968('0x48')](handleError(_0x3e03ba,null));};exports['show']=function(_0x138e2b,_0x4cbcc0){var _0x498ab5={'raw':![],'where':{'id':_0x138e2b[_0xb968('0x49')]['id']}},_0x3f11e2={};_0x3f11e2[_0xb968('0x33')]=_['keys'](db[_0xb968('0x43')][_0xb968('0x2f')]);_0x3f11e2[_0xb968('0x35')]=_[_0xb968('0x36')](_0x138e2b[_0xb968('0x35')]);_0x3f11e2[_0xb968('0x37')]=_[_0xb968('0x38')](_0x3f11e2[_0xb968('0x33')],_0x3f11e2[_0xb968('0x35')]);_0x498ab5[_0xb968('0x39')]=_[_0xb968('0x38')](_0x3f11e2[_0xb968('0x33')],qs['fields'](_0x138e2b['query'][_0xb968('0x3a')]));_0x498ab5[_0xb968('0x39')]=_0x498ab5['attributes'][_0xb968('0x3b')]?_0x498ab5[_0xb968('0x39')]:_0x3f11e2[_0xb968('0x33')];if(_0x138e2b[_0xb968('0x35')][_0xb968('0x44')]){_0x498ab5[_0xb968('0x45')]=[{'all':!![]}];}_0x498ab5=_[_0xb968('0x41')]({},_0x498ab5,_0x138e2b['options']);return db['SalesforceConfiguration'][_0xb968('0x4a')](_0x498ab5)[_0xb968('0x29')](handleEntityNotFound(_0x4cbcc0,null))[_0xb968('0x29')](respondWithResult(_0x4cbcc0,null))[_0xb968('0x48')](handleError(_0x4cbcc0,null));};exports['create']=function(_0x47d181,_0x1181f2){return db[_0xb968('0x43')][_0xb968('0x4b')](_0x47d181[_0xb968('0x4c')],{})[_0xb968('0x29')](respondWithResult(_0x1181f2,0xc9))[_0xb968('0x48')](handleError(_0x1181f2,null));};exports[_0xb968('0x27')]=function(_0x3dbd38,_0xe5c967){if(_0x3dbd38[_0xb968('0x4c')]['id']){delete _0x3dbd38['body']['id'];}return db[_0xb968('0x43')]['find']({'where':{'id':_0x3dbd38[_0xb968('0x49')]['id']}})['then'](handleEntityNotFound(_0xe5c967,null))['then'](saveUpdates(_0x3dbd38[_0xb968('0x4c')],null))[_0xb968('0x29')](respondWithResult(_0xe5c967,null))[_0xb968('0x48')](handleError(_0xe5c967,null));};exports['destroy']=function(_0x5015e3,_0x2337a5){return db[_0xb968('0x43')]['find']({'where':{'id':_0x5015e3[_0xb968('0x49')]['id']}})['then'](handleEntityNotFound(_0x2337a5,null))[_0xb968('0x29')](removeEntity(_0x2337a5,null))[_0xb968('0x48')](handleError(_0x2337a5,null));};exports[_0xb968('0x4d')]=function(_0x39b19b,_0x3e6f7d,_0x582800){var _0x5d7bad={};var _0x116352={};var _0x4520e8;var _0x16d22a;return db[_0xb968('0x43')][_0xb968('0x4e')]({'where':{'id':_0x39b19b[_0xb968('0x49')]['id']}})[_0xb968('0x29')](handleEntityNotFound(_0x3e6f7d,null))[_0xb968('0x29')](function(_0x504227){if(_0x504227){_0x4520e8=_0x504227;_0x116352[_0xb968('0x33')]=_[_0xb968('0x36')](db[_0xb968('0x4f')][_0xb968('0x2f')]);_0x116352['query']=_[_0xb968('0x36')](_0x39b19b[_0xb968('0x35')]);_0x116352[_0xb968('0x37')]=_[_0xb968('0x38')](_0x116352[_0xb968('0x33')],_0x116352[_0xb968('0x35')]);_0x5d7bad[_0xb968('0x39')]=_[_0xb968('0x38')](_0x116352[_0xb968('0x33')],qs[_0xb968('0x3a')](_0x39b19b[_0xb968('0x35')]['fields']));_0x5d7bad['attributes']=_0x5d7bad[_0xb968('0x39')][_0xb968('0x3b')]?_0x5d7bad['attributes']:_0x116352[_0xb968('0x33')];_0x5d7bad[_0xb968('0x50')]=qs['sort'](_0x39b19b[_0xb968('0x35')]['sort']);_0x5d7bad['where']=qs[_0xb968('0x37')](_[_0xb968('0x3f')](_0x39b19b[_0xb968('0x35')],_0x116352[_0xb968('0x37')]));if(_0x39b19b[_0xb968('0x35')][_0xb968('0x40')]){_0x5d7bad[_0xb968('0x3e')]=_[_0xb968('0x41')](_0x5d7bad[_0xb968('0x3e')],{'$or':_['map'](_0x5d7bad[_0xb968('0x39')],function(_0x2a1e66){var _0x1dc372={};_0x1dc372[_0x2a1e66]={'$like':'%'+_0x39b19b[_0xb968('0x35')]['filter']+'%'};return _0x1dc372;})});}_0x5d7bad=_[_0xb968('0x41')]({},_0x5d7bad,_0x39b19b[_0xb968('0x51')]);return _0x4520e8[_0xb968('0x4d')](_0x5d7bad);}})[_0xb968('0x29')](function(_0x3c066e){if(_0x3c066e){_0x16d22a=_0x3c066e[_0xb968('0x3b')];if(!_0x39b19b['query'][_0xb968('0x3c')](_0xb968('0x52'))){_0x5d7bad[_0xb968('0x1f')]=qs['limit'](_0x39b19b[_0xb968('0x35')][_0xb968('0x1f')]);_0x5d7bad['offset']=qs[_0xb968('0x1d')](_0x39b19b[_0xb968('0x35')][_0xb968('0x1d')]);}return _0x4520e8[_0xb968('0x4d')](_0x5d7bad);}})['then'](function(_0x2db7b1){if(_0x2db7b1){return _0x2db7b1?{'count':_0x16d22a,'rows':_0x2db7b1}:null;}})[_0xb968('0x29')](respondWithResult(_0x3e6f7d,null))[_0xb968('0x48')](handleError(_0x3e6f7d,null));};exports[_0xb968('0x53')]=function(_0xec7d51,_0x3d6fbb,_0x24f3dc){var _0x56e6d7={};var _0x2f2b2c={};var _0x218648;var _0x1c589e;return db[_0xb968('0x43')]['findOne']({'where':{'id':_0xec7d51[_0xb968('0x49')]['id']}})[_0xb968('0x29')](handleEntityNotFound(_0x3d6fbb,null))[_0xb968('0x29')](function(_0x4da050){if(_0x4da050){_0x218648=_0x4da050;_0x2f2b2c[_0xb968('0x33')]=_[_0xb968('0x36')](db[_0xb968('0x4f')][_0xb968('0x2f')]);_0x2f2b2c[_0xb968('0x35')]=_[_0xb968('0x36')](_0xec7d51[_0xb968('0x35')]);_0x2f2b2c[_0xb968('0x37')]=_[_0xb968('0x38')](_0x2f2b2c['model'],_0x2f2b2c[_0xb968('0x35')]);_0x56e6d7[_0xb968('0x39')]=_[_0xb968('0x38')](_0x2f2b2c[_0xb968('0x33')],qs[_0xb968('0x3a')](_0xec7d51[_0xb968('0x35')][_0xb968('0x3a')]));_0x56e6d7[_0xb968('0x39')]=_0x56e6d7[_0xb968('0x39')][_0xb968('0x3b')]?_0x56e6d7[_0xb968('0x39')]:_0x2f2b2c[_0xb968('0x33')];_0x56e6d7[_0xb968('0x50')]=qs[_0xb968('0x3d')](_0xec7d51[_0xb968('0x35')][_0xb968('0x3d')]);_0x56e6d7[_0xb968('0x3e')]=qs[_0xb968('0x37')](_[_0xb968('0x3f')](_0xec7d51[_0xb968('0x35')],_0x2f2b2c[_0xb968('0x37')]));if(_0xec7d51[_0xb968('0x35')][_0xb968('0x40')]){_0x56e6d7['where']=_[_0xb968('0x41')](_0x56e6d7['where'],{'$or':_[_0xb968('0x34')](_0x56e6d7['attributes'],function(_0x273ac2){var _0x2b41ee={};_0x2b41ee[_0x273ac2]={'$like':'%'+_0xec7d51['query'][_0xb968('0x40')]+'%'};return _0x2b41ee;})});}_0x56e6d7=_['merge']({},_0x56e6d7,_0xec7d51[_0xb968('0x51')]);return _0x218648[_0xb968('0x53')](_0x56e6d7);}})[_0xb968('0x29')](function(_0x5059ed){if(_0x5059ed){_0x1c589e=_0x5059ed[_0xb968('0x3b')];if(!_0xec7d51['query'][_0xb968('0x3c')]('nolimit')){_0x56e6d7[_0xb968('0x1f')]=qs[_0xb968('0x1f')](_0xec7d51[_0xb968('0x35')][_0xb968('0x1f')]);_0x56e6d7['offset']=qs['offset'](_0xec7d51['query']['offset']);}return _0x218648[_0xb968('0x53')](_0x56e6d7);}})[_0xb968('0x29')](function(_0x19c716){if(_0x19c716){return _0x19c716?{'count':_0x1c589e,'rows':_0x19c716}:null;}})[_0xb968('0x29')](respondWithResult(_0x3d6fbb,null))[_0xb968('0x48')](handleError(_0x3d6fbb,null));};exports[_0xb968('0x54')]=function(_0x401995,_0xdcc761,_0x5983d7){var _0x4f554a={};var _0x3aef79={};var _0x4777e3;var _0x410bff;return db['SalesforceConfiguration'][_0xb968('0x4e')]({'where':{'id':_0x401995[_0xb968('0x49')]['id']}})[_0xb968('0x29')](handleEntityNotFound(_0xdcc761,null))[_0xb968('0x29')](function(_0x35a7c9){if(_0x35a7c9){_0x4777e3=_0x35a7c9;_0x3aef79[_0xb968('0x33')]=_[_0xb968('0x36')](db[_0xb968('0x4f')]['rawAttributes']);_0x3aef79[_0xb968('0x35')]=_[_0xb968('0x36')](_0x401995[_0xb968('0x35')]);_0x3aef79[_0xb968('0x37')]=_[_0xb968('0x38')](_0x3aef79['model'],_0x3aef79[_0xb968('0x35')]);_0x4f554a['attributes']=_[_0xb968('0x38')](_0x3aef79[_0xb968('0x33')],qs['fields'](_0x401995[_0xb968('0x35')]['fields']));_0x4f554a[_0xb968('0x39')]=_0x4f554a[_0xb968('0x39')][_0xb968('0x3b')]?_0x4f554a[_0xb968('0x39')]:_0x3aef79[_0xb968('0x33')];_0x4f554a[_0xb968('0x50')]=qs[_0xb968('0x3d')](_0x401995['query'][_0xb968('0x3d')]);_0x4f554a[_0xb968('0x3e')]=qs[_0xb968('0x37')](_[_0xb968('0x3f')](_0x401995[_0xb968('0x35')],_0x3aef79[_0xb968('0x37')]));if(_0x401995[_0xb968('0x35')][_0xb968('0x40')]){_0x4f554a['where']=_[_0xb968('0x41')](_0x4f554a['where'],{'$or':_['map'](_0x4f554a[_0xb968('0x39')],function(_0x521b27){var _0x51f4f3={};_0x51f4f3[_0x521b27]={'$like':'%'+_0x401995['query'][_0xb968('0x40')]+'%'};return _0x51f4f3;})});}_0x4f554a=_['merge']({},_0x4f554a,_0x401995[_0xb968('0x51')]);return _0x4777e3[_0xb968('0x54')](_0x4f554a);}})['then'](function(_0x59603e){if(_0x59603e){_0x410bff=_0x59603e[_0xb968('0x3b')];if(!_0x401995[_0xb968('0x35')][_0xb968('0x3c')](_0xb968('0x52'))){_0x4f554a[_0xb968('0x1f')]=qs[_0xb968('0x1f')](_0x401995[_0xb968('0x35')][_0xb968('0x1f')]);_0x4f554a[_0xb968('0x1d')]=qs['offset'](_0x401995[_0xb968('0x35')]['offset']);}return _0x4777e3[_0xb968('0x54')](_0x4f554a);}})[_0xb968('0x29')](function(_0x10641c){if(_0x10641c){return _0x10641c?{'count':_0x410bff,'rows':_0x10641c}:null;}})['then'](respondWithResult(_0xdcc761,null))[_0xb968('0x48')](handleError(_0xdcc761,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 8ea4f7e..a430599 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 _0xf8ee=['rimraf','./intSalesforceConfiguration.attributes','SalesforceConfiguration','../../config/logger','api','bluebird','request-promise','path'];(function(_0x575708,_0x2d46e3){var _0x1a8358=function(_0x8b60a3){while(--_0x8b60a3){_0x575708['push'](_0x575708['shift']());}};_0x1a8358(++_0x2d46e3);}(_0xf8ee,0x1ab));var _0xef8e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf8ee[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xef8e('0x0'))(_0xef8e('0x1'));var moment=require('moment');var BPromise=require(_0xef8e('0x2'));var rp=require(_0xef8e('0x3'));var fs=require('fs');var path=require(_0xef8e('0x4'));var rimraf=require(_0xef8e('0x5'));var config=require('../../config/environment');var attributes=require(_0xef8e('0x6'));module['exports']=function(_0x464547,_0x5d958b){return _0x464547['define'](_0xef8e('0x7'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5575=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x5575,0xf4));var _0x5557=function(_0x36f465,_0x5b5713){_0x36f465=_0x36f465-0x0;var _0x4a7425=_0x5575[_0x36f465];return _0x4a7425;};'use strict';var _=require(_0x5557('0x0'));var util=require(_0x5557('0x1'));var logger=require(_0x5557('0x2'))(_0x5557('0x3'));var moment=require(_0x5557('0x4'));var BPromise=require(_0x5557('0x5'));var rp=require(_0x5557('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5557('0x7'));var config=require(_0x5557('0x8'));var attributes=require(_0x5557('0x9'));module['exports']=function(_0xaac868,_0x457747){return _0xaac868[_0x5557('0xa')](_0x5557('0xb'),attributes,{'tableName':_0x5557('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 3c5063e..675f86b 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 _0x8ba7=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x8ba7,0x15e));var _0x78ba=function(_0x5be01c,_0x5222b3){_0x5be01c=_0x5be01c-0x0;var _0x1f4d15=_0x8ba7[_0x5be01c];return _0x1f4d15;};'use strict';var _=require('lodash');var util=require(_0x78ba('0x0'));var moment=require(_0x78ba('0x1'));var BPromise=require(_0x78ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78ba('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x78ba('0x4'));var logger=require(_0x78ba('0x5'))('rpc');var config=require(_0x78ba('0x6'));var jayson=require(_0x78ba('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b00b9,_0x2fed64,_0x30fd6c){return new BPromise(function(_0x45573a,_0x55aa2b){return client[_0x78ba('0x8')](_0x5b00b9,_0x30fd6c)[_0x78ba('0x9')](function(_0x5b74cd){logger[_0x78ba('0xa')](_0x78ba('0xb'),_0x2fed64,_0x78ba('0xc'));logger[_0x78ba('0xd')](_0x78ba('0xe'),_0x2fed64,_0x78ba('0xc'),JSON['stringify'](_0x5b74cd));if(_0x5b74cd[_0x78ba('0xf')]){if(_0x5b74cd['error'][_0x78ba('0x10')]===0x1f4){logger[_0x78ba('0xf')](_0x78ba('0xb'),_0x2fed64,_0x5b74cd[_0x78ba('0xf')]['message']);return _0x55aa2b(_0x5b74cd[_0x78ba('0xf')][_0x78ba('0x11')]);}logger[_0x78ba('0xf')](_0x78ba('0xb'),_0x2fed64,_0x5b74cd[_0x78ba('0xf')][_0x78ba('0x11')]);return _0x45573a(_0x5b74cd[_0x78ba('0xf')][_0x78ba('0x11')]);}else{logger[_0x78ba('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2fed64,_0x78ba('0xc'));_0x45573a(_0x5b74cd[_0x78ba('0x12')][_0x78ba('0x11')]);}})['catch'](function(_0x16e364){logger['error'](_0x78ba('0xb'),_0x2fed64,_0x16e364);_0x55aa2b(_0x16e364);});});} \ No newline at end of file +var _0x2c0b=['bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','util','moment'];(function(_0x2ec123,_0x2a9870){var _0x2213f8=function(_0x46f360){while(--_0x46f360){_0x2ec123['push'](_0x2ec123['shift']());}};_0x2213f8(++_0x2a9870);}(_0x2c0b,0x102));var _0xb2c0=function(_0x560a83,_0x467361){_0x560a83=_0x560a83-0x0;var _0x37c742=_0x2c0b[_0x560a83];return _0x37c742;};'use strict';var _=require('lodash');var util=require(_0xb2c0('0x0'));var moment=require(_0xb2c0('0x1'));var BPromise=require(_0xb2c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2c0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2c0('0x4'))(_0xb2c0('0x5'));var config=require(_0xb2c0('0x6'));var jayson=require(_0xb2c0('0x7'));var client=jayson[_0xb2c0('0x8')][_0xb2c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x158112,_0x4c37ae,_0x3d7560){return new BPromise(function(_0x596ea2,_0x33b6a3){return client['request'](_0x158112,_0x3d7560)[_0xb2c0('0xa')](function(_0xa0920){logger[_0xb2c0('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4c37ae,_0xb2c0('0xc'));logger[_0xb2c0('0xd')](_0xb2c0('0xe'),_0x4c37ae,_0xb2c0('0xc'),JSON['stringify'](_0xa0920));if(_0xa0920[_0xb2c0('0xf')]){if(_0xa0920[_0xb2c0('0xf')][_0xb2c0('0x10')]===0x1f4){logger[_0xb2c0('0xf')](_0xb2c0('0x11'),_0x4c37ae,_0xa0920[_0xb2c0('0xf')][_0xb2c0('0x12')]);return _0x33b6a3(_0xa0920[_0xb2c0('0xf')][_0xb2c0('0x12')]);}logger[_0xb2c0('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4c37ae,_0xa0920[_0xb2c0('0xf')][_0xb2c0('0x12')]);return _0x596ea2(_0xa0920[_0xb2c0('0xf')]['message']);}else{logger[_0xb2c0('0xb')](_0xb2c0('0x11'),_0x4c37ae,_0xb2c0('0xc'));_0x596ea2(_0xa0920[_0xb2c0('0x13')][_0xb2c0('0x12')]);}})['catch'](function(_0x4b276c){logger['error'](_0xb2c0('0x11'),_0x4c37ae,_0x4b276c);_0x33b6a3(_0x4b276c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 868a813..eb58a53 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 _0x675f=['isAuthenticated','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x354024,_0x70e656){var _0x5320b0=function(_0x11f0a3){while(--_0x11f0a3){_0x354024['push'](_0x354024['shift']());}};_0x5320b0(++_0x70e656);}(_0x675f,0x171));var _0xf675=function(_0xf9a442,_0x17008b){_0xf9a442=_0xf9a442-0x0;var _0xec3599=_0x675f[_0xf9a442];return _0xec3599;};'use strict';var multer=require(_0xf675('0x0'));var util=require('util');var path=require(_0xf675('0x1'));var timeout=require(_0xf675('0x2'));var express=require(_0xf675('0x3'));var router=express[_0xf675('0x4')]();var fs_extra=require(_0xf675('0x5'));var auth=require(_0xf675('0x6'));var interaction=require(_0xf675('0x7'));var config=require(_0xf675('0x8'));var controller=require('./intSalesforceField.controller');router[_0xf675('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf675('0xa'),auth[_0xf675('0xb')](),controller[_0xf675('0xc')]);router[_0xf675('0xd')]('/',auth[_0xf675('0xb')](),controller[_0xf675('0xe')]);router[_0xf675('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf675('0x10')]);router[_0xf675('0x11')](_0xf675('0xa'),auth['isAuthenticated'](),controller[_0xf675('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0118=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x1c4d5b,_0x29d840){var _0xfec1f2=function(_0xf063e){while(--_0xf063e){_0x1c4d5b['push'](_0x1c4d5b['shift']());}};_0xfec1f2(++_0x29d840);}(_0x0118,0xa5));var _0x8011=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0118[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8011('0x0'));var util=require('util');var path=require(_0x8011('0x1'));var timeout=require(_0x8011('0x2'));var express=require(_0x8011('0x3'));var router=express[_0x8011('0x4')]();var fs_extra=require(_0x8011('0x5'));var auth=require(_0x8011('0x6'));var interaction=require(_0x8011('0x7'));var config=require(_0x8011('0x8'));var controller=require(_0x8011('0x9'));router[_0x8011('0xa')]('/',auth['isAuthenticated'](),controller[_0x8011('0xb')]);router[_0x8011('0xa')](_0x8011('0xc'),auth[_0x8011('0xd')](),controller[_0x8011('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8011('0xc'),auth['isAuthenticated'](),controller[_0x8011('0xf')]);router[_0x8011('0x10')](_0x8011('0xc'),auth[_0x8011('0xd')](),controller[_0x8011('0x11')]);module[_0x8011('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c3111bf..2bd8198 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 _0x845b=['exports','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x202295,_0x307455){var _0xf2db7f=function(_0x3873d6){while(--_0x3873d6){_0x202295['push'](_0x202295['shift']());}};_0xf2db7f(++_0x307455);}(_0x845b,0x1c7));var _0xb845=function(_0x206487,_0x28eec1){_0x206487=_0x206487-0x0;var _0x2714c7=_0x845b[_0x206487];return _0x2714c7;};'use strict';var Sequelize=require(_0xb845('0x0'));module[_0xb845('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb845('0x2'),_0xb845('0x3'),_0xb845('0x4'),_0xb845('0x5'),_0xb845('0x6')),'defaultValue':_0xb845('0x2')},'content':{'type':Sequelize[_0xb845('0x7')]},'key':{'type':Sequelize[_0xb845('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xb845('0x2'),_0xb845('0x3'),_0xb845('0x4'))},'keyContent':{'type':Sequelize[_0xb845('0x7')]},'idField':{'type':Sequelize[_0xb845('0x7')]},'variableName':{'type':Sequelize[_0xb845('0x7')]}}; \ No newline at end of file +var _0x504c=['STRING','variable','sequelize','exports','ENUM','customVariable','keyValue','picklist'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x504c,0x112));var _0xc504=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0x504c[_0x427217];return _0x5b28fb;};'use strict';var Sequelize=require(_0xc504('0x0'));module[_0xc504('0x1')]={'type':{'type':Sequelize[_0xc504('0x2')]('string','variable',_0xc504('0x3'),_0xc504('0x4'),_0xc504('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc504('0x6')]},'key':{'type':Sequelize[_0xc504('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xc504('0x7'),_0xc504('0x3'))},'keyContent':{'type':Sequelize[_0xc504('0x6')]},'idField':{'type':Sequelize[_0xc504('0x6')]},'variableName':{'type':Sequelize[_0xc504('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index bee1ad6..7b31439 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 _0x0d77=['status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','include','catch','show','params','keys','includeAll','find','create','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus'];(function(_0xc7d00e,_0x53faef){var _0x39bf39=function(_0x19cbec){while(--_0x19cbec){_0xc7d00e['push'](_0xc7d00e['shift']());}};_0x39bf39(++_0x53faef);}(_0x0d77,0xb9));var _0x70d7=function(_0x9b022c,_0x27a341){_0x9b022c=_0x9b022c-0x0;var _0x3ac831=_0x0d77[_0x9b022c];return _0x3ac831;};'use strict';var emlformat=require(_0x70d7('0x0'));var rimraf=require(_0x70d7('0x1'));var zipdir=require(_0x70d7('0x2'));var jsonpatch=require(_0x70d7('0x3'));var rp=require(_0x70d7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x70d7('0x5'));var util=require(_0x70d7('0x6'));var path=require(_0x70d7('0x7'));var sox=require(_0x70d7('0x8'));var csv=require(_0x70d7('0x9'));var ejs=require(_0x70d7('0xa'));var fs=require('fs');var fs_extra=require(_0x70d7('0xb'));var _=require(_0x70d7('0xc'));var squel=require('squel');var crypto=require(_0x70d7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x70d7('0xe'));var toCsv=require(_0x70d7('0x9'));var querystring=require(_0x70d7('0xf'));var Papa=require(_0x70d7('0x10'));var Redis=require(_0x70d7('0x11'));var authService=require(_0x70d7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x70d7('0x13'));var hardwareService=require(_0x70d7('0x14'));var logger=require(_0x70d7('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x70d7('0x16'));var licenseUtil=require(_0x70d7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8227fe,_0x135df0){_0x135df0=_0x135df0||0xcc;return function(_0x1de199){if(_0x1de199){return _0x8227fe[_0x70d7('0x18')](_0x135df0);}return _0x8227fe[_0x70d7('0x19')](_0x135df0)[_0x70d7('0x1a')]();};}function respondWithResult(_0x4256c5,_0x116cd8){_0x116cd8=_0x116cd8||0xc8;return function(_0x57a977){if(_0x57a977){return _0x4256c5[_0x70d7('0x19')](_0x116cd8)[_0x70d7('0x1b')](_0x57a977);}};}function respondWithFilteredResult(_0x338351,_0x33c088){return function(_0x474d47){if(_0x474d47){var _0x110481=typeof _0x33c088[_0x70d7('0x1c')]==='undefined'&&typeof _0x33c088[_0x70d7('0x1d')]===_0x70d7('0x1e');var _0x1bd0b4=_0x474d47[_0x70d7('0x1f')];var _0x230f8f=_0x110481?0x0:_0x33c088[_0x70d7('0x1c')];var _0xe8d3a0=_0x110481?_0x474d47[_0x70d7('0x1f')]:_0x33c088[_0x70d7('0x1c')]+_0x33c088['limit'];var _0x5dd973;if(_0xe8d3a0>=_0x1bd0b4){_0xe8d3a0=_0x1bd0b4;_0x5dd973=0xc8;}else{_0x5dd973=0xce;}_0x338351[_0x70d7('0x19')](_0x5dd973);return _0x338351[_0x70d7('0x20')]('Content-Range',_0x230f8f+'-'+_0xe8d3a0+'/'+_0x1bd0b4)[_0x70d7('0x1b')](_0x474d47);}return null;};}function patchUpdates(_0x2aeeb3){return function(_0x59cd01){try{jsonpatch[_0x70d7('0x21')](_0x59cd01,_0x2aeeb3,!![]);}catch(_0x35a682){return BPromise['reject'](_0x35a682);}return _0x59cd01[_0x70d7('0x22')]();};}function saveUpdates(_0x23e5af,_0x312079){return function(_0x46f2ae){if(_0x46f2ae){return _0x46f2ae[_0x70d7('0x23')](_0x23e5af)[_0x70d7('0x24')](function(_0x3d674b){return _0x3d674b;});}return null;};}function removeEntity(_0x4af3ae,_0x26e20e){return function(_0x5d4941){if(_0x5d4941){return _0x5d4941['destroy']()[_0x70d7('0x24')](function(){_0x4af3ae[_0x70d7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaf1606,_0x11126b){return function(_0x363f60){if(!_0x363f60){_0xaf1606[_0x70d7('0x18')](0x194);}return _0x363f60;};}function handleError(_0x11e068,_0x3f5d2e){_0x3f5d2e=_0x3f5d2e||0x1f4;return function(_0x508a4a){logger['error'](_0x508a4a[_0x70d7('0x25')]);if(_0x508a4a[_0x70d7('0x26')]){delete _0x508a4a[_0x70d7('0x26')];}_0x11e068['status'](_0x3f5d2e)[_0x70d7('0x27')](_0x508a4a);};}exports[_0x70d7('0x28')]=function(_0x3d443b,_0x2b37b0){var _0x356e2b={},_0x1387e8={},_0x2acaf1={'count':0x0,'rows':[]};var _0x4f6e86=_[_0x70d7('0x29')](db[_0x70d7('0x2a')][_0x70d7('0x2b')],function(_0x448ab3){return{'name':_0x448ab3[_0x70d7('0x2c')],'type':_0x448ab3['type']['key']};});_0x1387e8[_0x70d7('0x2d')]=_[_0x70d7('0x29')](_0x4f6e86,_0x70d7('0x26'));_0x1387e8[_0x70d7('0x2e')]=_['keys'](_0x3d443b[_0x70d7('0x2e')]);_0x1387e8[_0x70d7('0x2f')]=_[_0x70d7('0x30')](_0x1387e8[_0x70d7('0x2d')],_0x1387e8[_0x70d7('0x2e')]);_0x356e2b[_0x70d7('0x31')]=_['intersection'](_0x1387e8[_0x70d7('0x2d')],qs['fields'](_0x3d443b[_0x70d7('0x2e')][_0x70d7('0x32')]));_0x356e2b[_0x70d7('0x31')]=_0x356e2b[_0x70d7('0x31')][_0x70d7('0x33')]?_0x356e2b[_0x70d7('0x31')]:_0x1387e8[_0x70d7('0x2d')];if(!_0x3d443b[_0x70d7('0x2e')]['hasOwnProperty'](_0x70d7('0x34'))){_0x356e2b[_0x70d7('0x1d')]=qs['limit'](_0x3d443b['query'][_0x70d7('0x1d')]);_0x356e2b['offset']=qs['offset'](_0x3d443b[_0x70d7('0x2e')][_0x70d7('0x1c')]);}_0x356e2b[_0x70d7('0x35')]=qs[_0x70d7('0x36')](_0x3d443b['query'][_0x70d7('0x36')]);_0x356e2b[_0x70d7('0x37')]=qs['filters'](_[_0x70d7('0x38')](_0x3d443b[_0x70d7('0x2e')],_0x1387e8[_0x70d7('0x2f')]),_0x4f6e86);if(_0x3d443b[_0x70d7('0x2e')][_0x70d7('0x39')]){_0x356e2b[_0x70d7('0x37')]=_['merge'](_0x356e2b[_0x70d7('0x37')],{'$or':_[_0x70d7('0x29')](_0x4f6e86,function(_0x4db12e){if(_0x4db12e[_0x70d7('0x3a')]!==_0x70d7('0x3b')){var _0x5a83fc={};_0x5a83fc[_0x4db12e[_0x70d7('0x26')]]={'$like':'%'+_0x3d443b[_0x70d7('0x2e')]['filter']+'%'};return _0x5a83fc;}})});}_0x356e2b=_['merge']({},_0x356e2b,_0x3d443b[_0x70d7('0x3c')]);var _0x20f93a={'where':_0x356e2b['where']};return db['SalesforceField'][_0x70d7('0x1f')](_0x20f93a)[_0x70d7('0x24')](function(_0x1fab48){_0x2acaf1[_0x70d7('0x1f')]=_0x1fab48;if(_0x3d443b[_0x70d7('0x2e')]['includeAll']){_0x356e2b[_0x70d7('0x3d')]=[{'all':!![]}];}return db[_0x70d7('0x2a')]['findAll'](_0x356e2b);})['then'](function(_0x12f8fc){_0x2acaf1['rows']=_0x12f8fc;return _0x2acaf1;})[_0x70d7('0x24')](respondWithFilteredResult(_0x2b37b0,_0x356e2b))[_0x70d7('0x3e')](handleError(_0x2b37b0,null));};exports[_0x70d7('0x3f')]=function(_0x12a546,_0x12db8e){var _0x4dd5d5={'raw':!![],'where':{'id':_0x12a546[_0x70d7('0x40')]['id']}},_0x65aef5={};_0x65aef5[_0x70d7('0x2d')]=_[_0x70d7('0x41')](db[_0x70d7('0x2a')]['rawAttributes']);_0x65aef5[_0x70d7('0x2e')]=_[_0x70d7('0x41')](_0x12a546['query']);_0x65aef5['filters']=_[_0x70d7('0x30')](_0x65aef5[_0x70d7('0x2d')],_0x65aef5[_0x70d7('0x2e')]);_0x4dd5d5[_0x70d7('0x31')]=_[_0x70d7('0x30')](_0x65aef5['model'],qs[_0x70d7('0x32')](_0x12a546[_0x70d7('0x2e')]['fields']));_0x4dd5d5[_0x70d7('0x31')]=_0x4dd5d5['attributes']['length']?_0x4dd5d5['attributes']:_0x65aef5[_0x70d7('0x2d')];if(_0x12a546[_0x70d7('0x2e')][_0x70d7('0x42')]){_0x4dd5d5[_0x70d7('0x3d')]=[{'all':!![]}];}_0x4dd5d5=_['merge']({},_0x4dd5d5,_0x12a546[_0x70d7('0x3c')]);return db[_0x70d7('0x2a')][_0x70d7('0x43')](_0x4dd5d5)[_0x70d7('0x24')](handleEntityNotFound(_0x12db8e,null))['then'](respondWithResult(_0x12db8e,null))[_0x70d7('0x3e')](handleError(_0x12db8e,null));};exports[_0x70d7('0x44')]=function(_0x4e66be,_0x5da1e2){return db[_0x70d7('0x2a')][_0x70d7('0x44')](_0x4e66be['body'],{})[_0x70d7('0x24')](respondWithResult(_0x5da1e2,0xc9))[_0x70d7('0x3e')](handleError(_0x5da1e2,null));};exports[_0x70d7('0x23')]=function(_0x4dc6e3,_0x41267a){if(_0x4dc6e3['body']['id']){delete _0x4dc6e3['body']['id'];}return db[_0x70d7('0x2a')][_0x70d7('0x43')]({'where':{'id':_0x4dc6e3[_0x70d7('0x40')]['id']}})[_0x70d7('0x24')](handleEntityNotFound(_0x41267a,null))[_0x70d7('0x24')](saveUpdates(_0x4dc6e3['body'],null))[_0x70d7('0x24')](respondWithResult(_0x41267a,null))[_0x70d7('0x3e')](handleError(_0x41267a,null));};exports[_0x70d7('0x45')]=function(_0x8f86db,_0x34270c){return db[_0x70d7('0x2a')][_0x70d7('0x43')]({'where':{'id':_0x8f86db[_0x70d7('0x40')]['id']}})[_0x70d7('0x24')](handleEntityNotFound(_0x34270c,null))[_0x70d7('0x24')](removeEntity(_0x34270c,null))['catch'](handleError(_0x34270c,null));}; \ No newline at end of file +var _0xc833=['index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SalesforceField','includeAll','include','rows','params','length','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','send'];(function(_0x4fcdc7,_0xf18181){var _0x5001a6=function(_0x57fd8a){while(--_0x57fd8a){_0x4fcdc7['push'](_0x4fcdc7['shift']());}};_0x5001a6(++_0xf18181);}(_0xc833,0xfd));var _0x3c83=function(_0x2a18f9,_0x294ef9){_0x2a18f9=_0x2a18f9-0x0;var _0x387ab9=_0xc833[_0x2a18f9];return _0x387ab9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c83('0x0'));var zipdir=require(_0x3c83('0x1'));var jsonpatch=require(_0x3c83('0x2'));var rp=require(_0x3c83('0x3'));var moment=require(_0x3c83('0x4'));var BPromise=require(_0x3c83('0x5'));var Mustache=require('mustache');var util=require(_0x3c83('0x6'));var path=require('path');var sox=require(_0x3c83('0x7'));var csv=require('to-csv');var ejs=require(_0x3c83('0x8'));var fs=require('fs');var fs_extra=require(_0x3c83('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3c83('0xa'));var jsforce=require(_0x3c83('0xb'));var deskjs=require(_0x3c83('0xc'));var toCsv=require(_0x3c83('0xd'));var querystring=require(_0x3c83('0xe'));var Papa=require(_0x3c83('0xf'));var Redis=require(_0x3c83('0x10'));var authService=require(_0x3c83('0x11'));var qs=require(_0x3c83('0x12'));var as=require(_0x3c83('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c83('0x14'))(_0x3c83('0x15'));var utils=require(_0x3c83('0x16'));var config=require(_0x3c83('0x17'));var licenseUtil=require(_0x3c83('0x18'));var db=require(_0x3c83('0x19'))['db'];function respondWithStatusCode(_0x521055,_0x323569){_0x323569=_0x323569||0xcc;return function(_0x48b645){if(_0x48b645){return _0x521055['sendStatus'](_0x323569);}return _0x521055[_0x3c83('0x1a')](_0x323569)[_0x3c83('0x1b')]();};}function respondWithResult(_0x1de23c,_0xbfdaf5){_0xbfdaf5=_0xbfdaf5||0xc8;return function(_0x2b4ebd){if(_0x2b4ebd){return _0x1de23c[_0x3c83('0x1a')](_0xbfdaf5)[_0x3c83('0x1c')](_0x2b4ebd);}};}function respondWithFilteredResult(_0x8cf1,_0x16e08b){return function(_0x540cdd){if(_0x540cdd){var _0x4cd4f2=typeof _0x16e08b[_0x3c83('0x1d')]===_0x3c83('0x1e')&&typeof _0x16e08b[_0x3c83('0x1f')]===_0x3c83('0x1e');var _0x51722b=_0x540cdd[_0x3c83('0x20')];var _0x5f3d0a=_0x4cd4f2?0x0:_0x16e08b['offset'];var _0x30804a=_0x4cd4f2?_0x540cdd[_0x3c83('0x20')]:_0x16e08b[_0x3c83('0x1d')]+_0x16e08b[_0x3c83('0x1f')];var _0xa38ef8;if(_0x30804a>=_0x51722b){_0x30804a=_0x51722b;_0xa38ef8=0xc8;}else{_0xa38ef8=0xce;}_0x8cf1[_0x3c83('0x1a')](_0xa38ef8);return _0x8cf1['set'](_0x3c83('0x21'),_0x5f3d0a+'-'+_0x30804a+'/'+_0x51722b)['json'](_0x540cdd);}return null;};}function patchUpdates(_0x5eb498){return function(_0x5d37f8){try{jsonpatch['apply'](_0x5d37f8,_0x5eb498,!![]);}catch(_0x291c41){return BPromise[_0x3c83('0x22')](_0x291c41);}return _0x5d37f8[_0x3c83('0x23')]();};}function saveUpdates(_0x1284c2,_0x3379f1){return function(_0x7b7163){if(_0x7b7163){return _0x7b7163[_0x3c83('0x24')](_0x1284c2)['then'](function(_0x311562){return _0x311562;});}return null;};}function removeEntity(_0x31a938,_0x5e2eeb){return function(_0x4448f2){if(_0x4448f2){return _0x4448f2[_0x3c83('0x25')]()[_0x3c83('0x26')](function(){_0x31a938[_0x3c83('0x1a')](0xcc)[_0x3c83('0x1b')]();});}};}function handleEntityNotFound(_0x2bee89,_0xed9592){return function(_0x424004){if(!_0x424004){_0x2bee89['sendStatus'](0x194);}return _0x424004;};}function handleError(_0x30b17c,_0x2c74af){_0x2c74af=_0x2c74af||0x1f4;return function(_0x2ef7de){logger[_0x3c83('0x27')](_0x2ef7de[_0x3c83('0x28')]);if(_0x2ef7de[_0x3c83('0x29')]){delete _0x2ef7de['name'];}_0x30b17c[_0x3c83('0x1a')](_0x2c74af)[_0x3c83('0x2a')](_0x2ef7de);};}exports[_0x3c83('0x2b')]=function(_0x20316d,_0x57a4da){var _0x3d6e14={},_0x3f6c02={},_0x21e286={'count':0x0,'rows':[]};var _0x21ad93=_[_0x3c83('0x2c')](db['SalesforceField'][_0x3c83('0x2d')],function(_0x5de483){return{'name':_0x5de483[_0x3c83('0x2e')],'type':_0x5de483[_0x3c83('0x2f')]['key']};});_0x3f6c02[_0x3c83('0x30')]=_['map'](_0x21ad93,_0x3c83('0x29'));_0x3f6c02[_0x3c83('0x31')]=_[_0x3c83('0x32')](_0x20316d[_0x3c83('0x31')]);_0x3f6c02['filters']=_[_0x3c83('0x33')](_0x3f6c02[_0x3c83('0x30')],_0x3f6c02[_0x3c83('0x31')]);_0x3d6e14[_0x3c83('0x34')]=_['intersection'](_0x3f6c02['model'],qs[_0x3c83('0x35')](_0x20316d[_0x3c83('0x31')][_0x3c83('0x35')]));_0x3d6e14[_0x3c83('0x34')]=_0x3d6e14['attributes']['length']?_0x3d6e14[_0x3c83('0x34')]:_0x3f6c02[_0x3c83('0x30')];if(!_0x20316d[_0x3c83('0x31')][_0x3c83('0x36')](_0x3c83('0x37'))){_0x3d6e14['limit']=qs[_0x3c83('0x1f')](_0x20316d[_0x3c83('0x31')][_0x3c83('0x1f')]);_0x3d6e14[_0x3c83('0x1d')]=qs[_0x3c83('0x1d')](_0x20316d[_0x3c83('0x31')][_0x3c83('0x1d')]);}_0x3d6e14['order']=qs[_0x3c83('0x38')](_0x20316d[_0x3c83('0x31')][_0x3c83('0x38')]);_0x3d6e14[_0x3c83('0x39')]=qs[_0x3c83('0x3a')](_[_0x3c83('0x3b')](_0x20316d[_0x3c83('0x31')],_0x3f6c02[_0x3c83('0x3a')]),_0x21ad93);if(_0x20316d['query'][_0x3c83('0x3c')]){_0x3d6e14[_0x3c83('0x39')]=_[_0x3c83('0x3d')](_0x3d6e14[_0x3c83('0x39')],{'$or':_['map'](_0x21ad93,function(_0x54c91d){if(_0x54c91d[_0x3c83('0x2f')]!==_0x3c83('0x3e')){var _0x3a8468={};_0x3a8468[_0x54c91d[_0x3c83('0x29')]]={'$like':'%'+_0x20316d[_0x3c83('0x31')][_0x3c83('0x3c')]+'%'};return _0x3a8468;}})});}_0x3d6e14=_[_0x3c83('0x3d')]({},_0x3d6e14,_0x20316d[_0x3c83('0x3f')]);var _0x389fb1={'where':_0x3d6e14[_0x3c83('0x39')]};return db[_0x3c83('0x40')][_0x3c83('0x20')](_0x389fb1)[_0x3c83('0x26')](function(_0xb44bb2){_0x21e286[_0x3c83('0x20')]=_0xb44bb2;if(_0x20316d[_0x3c83('0x31')][_0x3c83('0x41')]){_0x3d6e14[_0x3c83('0x42')]=[{'all':!![]}];}return db[_0x3c83('0x40')]['findAll'](_0x3d6e14);})[_0x3c83('0x26')](function(_0x14dc95){_0x21e286[_0x3c83('0x43')]=_0x14dc95;return _0x21e286;})[_0x3c83('0x26')](respondWithFilteredResult(_0x57a4da,_0x3d6e14))['catch'](handleError(_0x57a4da,null));};exports['show']=function(_0x1769bd,_0x281b0a){var _0x4089f7={'raw':!![],'where':{'id':_0x1769bd[_0x3c83('0x44')]['id']}},_0x2b8b5c={};_0x2b8b5c[_0x3c83('0x30')]=_['keys'](db[_0x3c83('0x40')][_0x3c83('0x2d')]);_0x2b8b5c[_0x3c83('0x31')]=_[_0x3c83('0x32')](_0x1769bd[_0x3c83('0x31')]);_0x2b8b5c[_0x3c83('0x3a')]=_[_0x3c83('0x33')](_0x2b8b5c[_0x3c83('0x30')],_0x2b8b5c[_0x3c83('0x31')]);_0x4089f7[_0x3c83('0x34')]=_['intersection'](_0x2b8b5c[_0x3c83('0x30')],qs['fields'](_0x1769bd[_0x3c83('0x31')][_0x3c83('0x35')]));_0x4089f7[_0x3c83('0x34')]=_0x4089f7[_0x3c83('0x34')][_0x3c83('0x45')]?_0x4089f7['attributes']:_0x2b8b5c[_0x3c83('0x30')];if(_0x1769bd[_0x3c83('0x31')][_0x3c83('0x41')]){_0x4089f7[_0x3c83('0x42')]=[{'all':!![]}];}_0x4089f7=_[_0x3c83('0x3d')]({},_0x4089f7,_0x1769bd['options']);return db[_0x3c83('0x40')][_0x3c83('0x46')](_0x4089f7)[_0x3c83('0x26')](handleEntityNotFound(_0x281b0a,null))['then'](respondWithResult(_0x281b0a,null))[_0x3c83('0x47')](handleError(_0x281b0a,null));};exports[_0x3c83('0x48')]=function(_0x1e825c,_0x4d582f){return db[_0x3c83('0x40')][_0x3c83('0x48')](_0x1e825c[_0x3c83('0x49')],{})[_0x3c83('0x26')](respondWithResult(_0x4d582f,0xc9))[_0x3c83('0x47')](handleError(_0x4d582f,null));};exports[_0x3c83('0x24')]=function(_0x2d266b,_0x1c428d){if(_0x2d266b['body']['id']){delete _0x2d266b[_0x3c83('0x49')]['id'];}return db['SalesforceField'][_0x3c83('0x46')]({'where':{'id':_0x2d266b[_0x3c83('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c428d,null))[_0x3c83('0x26')](saveUpdates(_0x2d266b[_0x3c83('0x49')],null))[_0x3c83('0x26')](respondWithResult(_0x1c428d,null))[_0x3c83('0x47')](handleError(_0x1c428d,null));};exports[_0x3c83('0x25')]=function(_0x1c4a03,_0x4a1f69){return db[_0x3c83('0x40')][_0x3c83('0x46')]({'where':{'id':_0x1c4a03['params']['id']}})[_0x3c83('0x26')](handleEntityNotFound(_0x4a1f69,null))[_0x3c83('0x26')](removeEntity(_0x4a1f69,null))[_0x3c83('0x47')](handleError(_0x4a1f69,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 29ab7e9..afa9ec0 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 _0x2bdd=['./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x438c0e,_0x275ab1){var _0x21c813=function(_0x1756ba){while(--_0x1756ba){_0x438c0e['push'](_0x438c0e['shift']());}};_0x21c813(++_0x275ab1);}(_0x2bdd,0x102));var _0xd2bd=function(_0x2b2c53,_0x4bcf9b){_0x2b2c53=_0x2b2c53-0x0;var _0x311ec2=_0x2bdd[_0x2b2c53];return _0x311ec2;};'use strict';var _=require(_0xd2bd('0x0'));var util=require(_0xd2bd('0x1'));var logger=require('../../config/logger')(_0xd2bd('0x2'));var moment=require(_0xd2bd('0x3'));var BPromise=require('bluebird');var rp=require(_0xd2bd('0x4'));var fs=require('fs');var path=require(_0xd2bd('0x5'));var rimraf=require(_0xd2bd('0x6'));var config=require(_0xd2bd('0x7'));var attributes=require(_0xd2bd('0x8'));module[_0xd2bd('0x9')]=function(_0x1f05fa,_0x45fcd2){return _0x1f05fa['define'](_0xd2bd('0xa'),attributes,{'tableName':_0xd2bd('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xd2bd('0xc'),_0xd2bd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc5c=['moment','request-promise','path','../../config/environment','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','api'];(function(_0xfa16d3,_0x596052){var _0x111674=function(_0x4782e4){while(--_0x4782e4){_0xfa16d3['push'](_0xfa16d3['shift']());}};_0x111674(++_0x596052);}(_0xbc5c,0x8d));var _0xcbc5=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xbc5c[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xcbc5('0x0'));var util=require(_0xcbc5('0x1'));var logger=require('../../config/logger')(_0xcbc5('0x2'));var moment=require(_0xcbc5('0x3'));var BPromise=require('bluebird');var rp=require(_0xcbc5('0x4'));var fs=require('fs');var path=require(_0xcbc5('0x5'));var rimraf=require('rimraf');var config=require(_0xcbc5('0x6'));var attributes=require(_0xcbc5('0x7'));module['exports']=function(_0x3b64e1,_0x15b6ef){return _0x3b64e1['define'](_0xcbc5('0x8'),attributes,{'tableName':_0xcbc5('0x9'),'paranoid':![],'indexes':[{'name':_0xcbc5('0xa'),'fields':['idField',_0xcbc5('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index d0b7ea9..0049ba3 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 _0x6f76=['http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client'];(function(_0x53592d,_0x2e7863){var _0x2dd262=function(_0x4409d1){while(--_0x4409d1){_0x53592d['push'](_0x53592d['shift']());}};_0x2dd262(++_0x2e7863);}(_0x6f76,0x171));var _0x66f7=function(_0x19785c,_0x2b22a5){_0x19785c=_0x19785c-0x0;var _0x2691d5=_0x6f76[_0x19785c];return _0x2691d5;};'use strict';var _=require(_0x66f7('0x0'));var util=require('util');var moment=require(_0x66f7('0x1'));var BPromise=require(_0x66f7('0x2'));var rs=require(_0x66f7('0x3'));var fs=require('fs');var Redis=require(_0x66f7('0x4'));var db=require(_0x66f7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x66f7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66f7('0x7'));var client=jayson[_0x66f7('0x8')][_0x66f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd18c93,_0x30c5c1,_0x18565b){return new BPromise(function(_0x50717b,_0x16b949){return client[_0x66f7('0xa')](_0xd18c93,_0x18565b)[_0x66f7('0xb')](function(_0x3f01e4){logger[_0x66f7('0xc')](_0x66f7('0xd'),_0x30c5c1,_0x66f7('0xe'));logger[_0x66f7('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x30c5c1,_0x66f7('0xe'),JSON[_0x66f7('0x10')](_0x3f01e4));if(_0x3f01e4['error']){if(_0x3f01e4[_0x66f7('0x11')]['code']===0x1f4){logger[_0x66f7('0x11')](_0x66f7('0xd'),_0x30c5c1,_0x3f01e4[_0x66f7('0x11')]['message']);return _0x16b949(_0x3f01e4[_0x66f7('0x11')][_0x66f7('0x12')]);}logger[_0x66f7('0x11')]('SalesforceField,\x20%s,\x20%s',_0x30c5c1,_0x3f01e4['error'][_0x66f7('0x12')]);return _0x50717b(_0x3f01e4[_0x66f7('0x11')][_0x66f7('0x12')]);}else{logger[_0x66f7('0xc')](_0x66f7('0xd'),_0x30c5c1,_0x66f7('0xe'));_0x50717b(_0x3f01e4[_0x66f7('0x13')][_0x66f7('0x12')]);}})[_0x66f7('0x14')](function(_0x1e5132){logger[_0x66f7('0x11')](_0x66f7('0xd'),_0x30c5c1,_0x1e5132);_0x16b949(_0x1e5132);});});} \ No newline at end of file +var _0xfeeb=['../../config/logger','rpc','client','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xfeeb,0xf6));var _0xbfee=function(_0x589f62,_0x43f389){_0x589f62=_0x589f62-0x0;var _0x2c9f4b=_0xfeeb[_0x589f62];return _0x2c9f4b;};'use strict';var _=require('lodash');var util=require(_0xbfee('0x0'));var moment=require(_0xbfee('0x1'));var BPromise=require(_0xbfee('0x2'));var rs=require(_0xbfee('0x3'));var fs=require('fs');var Redis=require(_0xbfee('0x4'));var db=require(_0xbfee('0x5'))['db'];var utils=require(_0xbfee('0x6'));var logger=require(_0xbfee('0x7'))(_0xbfee('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfee('0x9')][_0xbfee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eb539,_0x5025fa,_0x4ea090){return new BPromise(function(_0x15145f,_0x325985){return client[_0xbfee('0xb')](_0x4eb539,_0x4ea090)['then'](function(_0x54301c){logger[_0xbfee('0xc')](_0xbfee('0xd'),_0x5025fa,_0xbfee('0xe'));logger[_0xbfee('0xf')](_0xbfee('0x10'),_0x5025fa,_0xbfee('0xe'),JSON[_0xbfee('0x11')](_0x54301c));if(_0x54301c['error']){if(_0x54301c[_0xbfee('0x12')][_0xbfee('0x13')]===0x1f4){logger[_0xbfee('0x12')](_0xbfee('0xd'),_0x5025fa,_0x54301c[_0xbfee('0x12')]['message']);return _0x325985(_0x54301c[_0xbfee('0x12')][_0xbfee('0x14')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x5025fa,_0x54301c[_0xbfee('0x12')][_0xbfee('0x14')]);return _0x15145f(_0x54301c[_0xbfee('0x12')][_0xbfee('0x14')]);}else{logger['info'](_0xbfee('0xd'),_0x5025fa,'request\x20sent');_0x15145f(_0x54301c[_0xbfee('0x15')]['message']);}})[_0xbfee('0x16')](function(_0x169d9b){logger[_0xbfee('0x12')]('SalesforceField,\x20%s,\x20%s',_0x5025fa,_0x169d9b);_0x325985(_0x169d9b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ec8b913..3767f9d 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 _0x98e1=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated'];(function(_0x433b93,_0x40db4f){var _0x116edd=function(_0x62fb77){while(--_0x62fb77){_0x433b93['push'](_0x433b93['shift']());}};_0x116edd(++_0x40db4f);}(_0x98e1,0x160));var _0x198e=function(_0x2e0b20,_0x1ec5ae){_0x2e0b20=_0x2e0b20-0x0;var _0x396b58=_0x98e1[_0x2e0b20];return _0x396b58;};'use strict';var multer=require('multer');var util=require(_0x198e('0x0'));var path=require(_0x198e('0x1'));var timeout=require(_0x198e('0x2'));var express=require(_0x198e('0x3'));var router=express['Router']();var fs_extra=require(_0x198e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x198e('0x5'));var controller=require(_0x198e('0x6'));router[_0x198e('0x7')]('/',auth[_0x198e('0x8')](),controller['index']);router['get'](_0x198e('0x9'),auth['isAuthenticated'](),controller[_0x198e('0xa')]);router['get'](_0x198e('0xb'),auth[_0x198e('0x8')](),controller[_0x198e('0xc')]);router[_0x198e('0x7')](_0x198e('0xd'),auth[_0x198e('0x8')](),controller[_0x198e('0xe')]);router[_0x198e('0xf')]('/',auth[_0x198e('0x8')](),controller['create']);router[_0x198e('0xf')](_0x198e('0xb'),auth['isAuthenticated'](),controller[_0x198e('0x10')]);router['put'](_0x198e('0x9'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x198e('0x8')](),controller[_0x198e('0x11')]);module[_0x198e('0x12')]=router; \ No newline at end of file +var _0x02a4=['path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/configurations','/:id/fields','create','post','addConfiguration','put','destroy','exports','multer','util'];(function(_0x23bb5c,_0x371369){var _0xa7825c=function(_0x4cfe3e){while(--_0x4cfe3e){_0x23bb5c['push'](_0x23bb5c['shift']());}};_0xa7825c(++_0x371369);}(_0x02a4,0x1c0));var _0x402a=function(_0x20e6c1,_0x104d95){_0x20e6c1=_0x20e6c1-0x0;var _0x170fff=_0x02a4[_0x20e6c1];return _0x170fff;};'use strict';var multer=require(_0x402a('0x0'));var util=require(_0x402a('0x1'));var path=require(_0x402a('0x2'));var timeout=require('connect-timeout');var express=require(_0x402a('0x3'));var router=express['Router']();var fs_extra=require(_0x402a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x402a('0x5'));var config=require(_0x402a('0x6'));var controller=require('./intServicenowAccount.controller');router[_0x402a('0x7')]('/',auth[_0x402a('0x8')](),controller['index']);router[_0x402a('0x7')](_0x402a('0x9'),auth[_0x402a('0x8')](),controller['show']);router[_0x402a('0x7')](_0x402a('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x402a('0xb'),auth[_0x402a('0x8')](),controller['getFields']);router['post']('/',auth[_0x402a('0x8')](),controller[_0x402a('0xc')]);router[_0x402a('0xd')](_0x402a('0xa'),auth['isAuthenticated'](),controller[_0x402a('0xe')]);router[_0x402a('0xf')]('/:id',auth[_0x402a('0x8')](),controller['update']);router['delete']('/:id',auth[_0x402a('0x8')](),controller[_0x402a('0x10')]);module[_0x402a('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 0219d14..7baf1bb 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 _0x25a1=['STRING','remoteUri','sequelize'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0x25a1,0x158));var _0x125a=function(_0x1191fb,_0x694c22){_0x1191fb=_0x1191fb-0x0;var _0x5ab4cc=_0x25a1[_0x1191fb];return _0x5ab4cc;};'use strict';var Sequelize=require(_0x125a('0x0'));module['exports']={'name':{'type':Sequelize[_0x125a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x125a('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x125a('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x125a('0x2')},'serverUrl':{'type':Sequelize[_0x125a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xa799=['exports','STRING','remoteUri','sequelize'];(function(_0x244862,_0x3da79e){var _0x2bce23=function(_0x235ae5){while(--_0x235ae5){_0x244862['push'](_0x244862['shift']());}};_0x2bce23(++_0x3da79e);}(_0xa799,0xbb));var _0x9a79=function(_0x428b0c,_0x23a0e3){_0x428b0c=_0x428b0c-0x0;var _0x53407b=_0xa799[_0x428b0c];return _0x53407b;};'use strict';var Sequelize=require(_0x9a79('0x0'));module[_0x9a79('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9a79('0x2')]},'username':{'type':Sequelize[_0x9a79('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x9a79('0x2')]},'email':{'type':Sequelize[_0x9a79('0x2')]},'remoteUri':{'type':Sequelize[_0x9a79('0x2')],'unique':_0x9a79('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 6bc3552..83746f5 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 _0xfe68=['category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','work_end','reopened_time','resolved_at','caller_id','subcategory','work_notes','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','internalType','push','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','label','value','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','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','ServicenowAccount','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','findOne','getConfigurations','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','Subjects','getFields','made_sla','knowledge','close_code','notify','incident_state','severity'];(function(_0x229778,_0x519e26){var _0xeb842c=function(_0x3cebf2){while(--_0x3cebf2){_0x229778['push'](_0x229778['shift']());}};_0xeb842c(++_0x519e26);}(_0xfe68,0x129));var _0x8fe6=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xfe68[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0x8fe6('0x0'));var rimraf=require(_0x8fe6('0x1'));var zipdir=require(_0x8fe6('0x2'));var jsonpatch=require(_0x8fe6('0x3'));var rp=require(_0x8fe6('0x4'));var moment=require('moment');var BPromise=require(_0x8fe6('0x5'));var Mustache=require(_0x8fe6('0x6'));var util=require(_0x8fe6('0x7'));var path=require(_0x8fe6('0x8'));var sox=require(_0x8fe6('0x9'));var csv=require('to-csv');var ejs=require(_0x8fe6('0xa'));var fs=require('fs');var fs_extra=require(_0x8fe6('0xb'));var _=require(_0x8fe6('0xc'));var squel=require(_0x8fe6('0xd'));var crypto=require(_0x8fe6('0xe'));var jsforce=require(_0x8fe6('0xf'));var deskjs=require(_0x8fe6('0x10'));var toCsv=require(_0x8fe6('0x11'));var querystring=require(_0x8fe6('0x12'));var Papa=require(_0x8fe6('0x13'));var Redis=require(_0x8fe6('0x14'));var authService=require(_0x8fe6('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fe6('0x16'));var logger=require(_0x8fe6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x8fe6('0x18'));var licenseUtil=require(_0x8fe6('0x19'));var db=require(_0x8fe6('0x1a'))['db'];var integrations=require(_0x8fe6('0x1b'));function respondWithStatusCode(_0x4ef5a2,_0x37da5e){_0x37da5e=_0x37da5e||0xcc;return function(_0x19e272){if(_0x19e272){return _0x4ef5a2[_0x8fe6('0x1c')](_0x37da5e);}return _0x4ef5a2[_0x8fe6('0x1d')](_0x37da5e)[_0x8fe6('0x1e')]();};}function respondWithResult(_0x191a01,_0x5e3c2c){_0x5e3c2c=_0x5e3c2c||0xc8;return function(_0x617b72){if(_0x617b72){return _0x191a01[_0x8fe6('0x1d')](_0x5e3c2c)[_0x8fe6('0x1f')](_0x617b72);}};}function respondWithFilteredResult(_0x17dddc,_0x306ce4){return function(_0xad2b68){if(_0xad2b68){var _0xe389d6=typeof _0x306ce4[_0x8fe6('0x20')]===_0x8fe6('0x21')&&typeof _0x306ce4[_0x8fe6('0x22')]==='undefined';var _0x49f5fa=_0xad2b68[_0x8fe6('0x23')];var _0x588e18=_0xe389d6?0x0:_0x306ce4['offset'];var _0x473b4e=_0xe389d6?_0xad2b68[_0x8fe6('0x23')]:_0x306ce4[_0x8fe6('0x20')]+_0x306ce4[_0x8fe6('0x22')];var _0x235a92;if(_0x473b4e>=_0x49f5fa){_0x473b4e=_0x49f5fa;_0x235a92=0xc8;}else{_0x235a92=0xce;}_0x17dddc[_0x8fe6('0x1d')](_0x235a92);return _0x17dddc[_0x8fe6('0x24')](_0x8fe6('0x25'),_0x588e18+'-'+_0x473b4e+'/'+_0x49f5fa)[_0x8fe6('0x1f')](_0xad2b68);}return null;};}function patchUpdates(_0x207219){return function(_0x484d30){try{jsonpatch[_0x8fe6('0x26')](_0x484d30,_0x207219,!![]);}catch(_0x2b6d93){return BPromise[_0x8fe6('0x27')](_0x2b6d93);}return _0x484d30[_0x8fe6('0x28')]();};}function saveUpdates(_0x421416,_0xe105e4){return function(_0x4dde63){if(_0x4dde63){return _0x4dde63[_0x8fe6('0x29')](_0x421416)[_0x8fe6('0x2a')](function(_0x13cad7){return _0x13cad7;});}return null;};}function removeEntity(_0x1d0ce1,_0x25f11b){return function(_0x322867){if(_0x322867){return _0x322867[_0x8fe6('0x2b')]()[_0x8fe6('0x2a')](function(){_0x1d0ce1['status'](0xcc)[_0x8fe6('0x1e')]();});}};}function handleEntityNotFound(_0x1804ce,_0x3fadff){return function(_0x175f6b){if(!_0x175f6b){_0x1804ce[_0x8fe6('0x1c')](0x194);}return _0x175f6b;};}function handleError(_0x4f6f53,_0x2c4c1d){_0x2c4c1d=_0x2c4c1d||0x1f4;return function(_0x26446f){logger[_0x8fe6('0x2c')](_0x26446f['stack']);if(_0x26446f[_0x8fe6('0x2d')]){delete _0x26446f[_0x8fe6('0x2d')];}_0x4f6f53[_0x8fe6('0x1d')](_0x2c4c1d)[_0x8fe6('0x2e')](_0x26446f);};}exports[_0x8fe6('0x2f')]=function(_0x3ee124,_0x1b4e0b){var _0xa1b518={},_0x1f444f={},_0x8125d4={'count':0x0,'rows':[]};var _0x2d8dac=_[_0x8fe6('0x30')](db['ServicenowAccount'][_0x8fe6('0x31')],function(_0x144d00){return{'name':_0x144d00['fieldName'],'type':_0x144d00['type']['key']};});_0x1f444f['model']=_[_0x8fe6('0x30')](_0x2d8dac,_0x8fe6('0x2d'));_0x1f444f[_0x8fe6('0x32')]=_['keys'](_0x3ee124[_0x8fe6('0x32')]);_0x1f444f[_0x8fe6('0x33')]=_[_0x8fe6('0x34')](_0x1f444f[_0x8fe6('0x35')],_0x1f444f[_0x8fe6('0x32')]);_0xa1b518[_0x8fe6('0x36')]=_['intersection'](_0x1f444f[_0x8fe6('0x35')],qs[_0x8fe6('0x37')](_0x3ee124[_0x8fe6('0x32')][_0x8fe6('0x37')]));_0xa1b518[_0x8fe6('0x36')]=_0xa1b518[_0x8fe6('0x36')][_0x8fe6('0x38')]?_0xa1b518[_0x8fe6('0x36')]:_0x1f444f[_0x8fe6('0x35')];if(!_0x3ee124[_0x8fe6('0x32')][_0x8fe6('0x39')](_0x8fe6('0x3a'))){_0xa1b518[_0x8fe6('0x22')]=qs[_0x8fe6('0x22')](_0x3ee124[_0x8fe6('0x32')]['limit']);_0xa1b518[_0x8fe6('0x20')]=qs[_0x8fe6('0x20')](_0x3ee124[_0x8fe6('0x32')][_0x8fe6('0x20')]);}_0xa1b518[_0x8fe6('0x3b')]=qs[_0x8fe6('0x3c')](_0x3ee124['query'][_0x8fe6('0x3c')]);_0xa1b518[_0x8fe6('0x3d')]=qs[_0x8fe6('0x33')](_[_0x8fe6('0x3e')](_0x3ee124['query'],_0x1f444f[_0x8fe6('0x33')]),_0x2d8dac);if(_0x3ee124[_0x8fe6('0x32')]['filter']){_0xa1b518['where']=_['merge'](_0xa1b518[_0x8fe6('0x3d')],{'$or':_[_0x8fe6('0x30')](_0x2d8dac,function(_0x55ab17){if(_0x55ab17[_0x8fe6('0x3f')]!==_0x8fe6('0x40')){var _0x953e5={};_0x953e5[_0x55ab17['name']]={'$like':'%'+_0x3ee124[_0x8fe6('0x32')][_0x8fe6('0x41')]+'%'};return _0x953e5;}})});}_0xa1b518=_[_0x8fe6('0x42')]({},_0xa1b518,_0x3ee124[_0x8fe6('0x43')]);var _0x2d7b83={'where':_0xa1b518[_0x8fe6('0x3d')]};return db[_0x8fe6('0x44')][_0x8fe6('0x23')](_0x2d7b83)[_0x8fe6('0x2a')](function(_0x25377a){_0x8125d4[_0x8fe6('0x23')]=_0x25377a;if(_0x3ee124[_0x8fe6('0x32')][_0x8fe6('0x45')]){_0xa1b518['include']=[{'all':!![]}];}return db[_0x8fe6('0x44')][_0x8fe6('0x46')](_0xa1b518);})['then'](function(_0xcedc1){_0x8125d4[_0x8fe6('0x47')]=_0xcedc1;return _0x8125d4;})[_0x8fe6('0x2a')](respondWithFilteredResult(_0x1b4e0b,_0xa1b518))[_0x8fe6('0x48')](handleError(_0x1b4e0b,null));};exports[_0x8fe6('0x49')]=function(_0x31a82f,_0x3c0788){var _0x5554fa={'raw':![],'where':{'id':_0x31a82f[_0x8fe6('0x4a')]['id']}},_0x40c52a={};_0x40c52a['model']=_[_0x8fe6('0x4b')](db[_0x8fe6('0x44')][_0x8fe6('0x31')]);_0x40c52a[_0x8fe6('0x32')]=_['keys'](_0x31a82f['query']);_0x40c52a[_0x8fe6('0x33')]=_[_0x8fe6('0x34')](_0x40c52a[_0x8fe6('0x35')],_0x40c52a[_0x8fe6('0x32')]);_0x5554fa[_0x8fe6('0x36')]=_['intersection'](_0x40c52a[_0x8fe6('0x35')],qs[_0x8fe6('0x37')](_0x31a82f[_0x8fe6('0x32')][_0x8fe6('0x37')]));_0x5554fa['attributes']=_0x5554fa[_0x8fe6('0x36')][_0x8fe6('0x38')]?_0x5554fa[_0x8fe6('0x36')]:_0x40c52a[_0x8fe6('0x35')];if(_0x31a82f[_0x8fe6('0x32')][_0x8fe6('0x45')]){_0x5554fa[_0x8fe6('0x4c')]=[{'all':!![]}];}_0x5554fa=_[_0x8fe6('0x42')]({},_0x5554fa,_0x31a82f['options']);return db[_0x8fe6('0x44')]['find'](_0x5554fa)[_0x8fe6('0x2a')](handleEntityNotFound(_0x3c0788,null))[_0x8fe6('0x2a')](respondWithResult(_0x3c0788,null))[_0x8fe6('0x48')](handleError(_0x3c0788,null));};exports[_0x8fe6('0x4d')]=function(_0x1e5db4,_0x1a869e){return db[_0x8fe6('0x44')]['create'](_0x1e5db4[_0x8fe6('0x4e')],{})[_0x8fe6('0x2a')](respondWithResult(_0x1a869e,0xc9))[_0x8fe6('0x48')](handleError(_0x1a869e,null));};exports[_0x8fe6('0x29')]=function(_0x39fbcf,_0x28dfa4){if(_0x39fbcf[_0x8fe6('0x4e')]['id']){delete _0x39fbcf['body']['id'];}return db['ServicenowAccount'][_0x8fe6('0x4f')]({'where':{'id':_0x39fbcf[_0x8fe6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x28dfa4,null))['then'](saveUpdates(_0x39fbcf['body'],null))[_0x8fe6('0x2a')](respondWithResult(_0x28dfa4,null))[_0x8fe6('0x48')](handleError(_0x28dfa4,null));};exports[_0x8fe6('0x2b')]=function(_0x2a322c,_0x3f3fd3){return db[_0x8fe6('0x44')][_0x8fe6('0x4f')]({'where':{'id':_0x2a322c[_0x8fe6('0x4a')]['id']}})[_0x8fe6('0x2a')](handleEntityNotFound(_0x3f3fd3,null))[_0x8fe6('0x2a')](removeEntity(_0x3f3fd3,null))[_0x8fe6('0x48')](handleError(_0x3f3fd3,null));};exports['getConfigurations']=function(_0x92a36c,_0x88e0d9,_0x34b85f){var _0x10c760={};var _0x255245={};var _0x2b916d;var _0x2f6f62;return db[_0x8fe6('0x44')][_0x8fe6('0x50')]({'where':{'id':_0x92a36c[_0x8fe6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x88e0d9,null))[_0x8fe6('0x2a')](function(_0x5efbf4){if(_0x5efbf4){_0x2b916d=_0x5efbf4;_0x255245['model']=_[_0x8fe6('0x4b')](db['ServicenowConfiguration'][_0x8fe6('0x31')]);_0x255245[_0x8fe6('0x32')]=_[_0x8fe6('0x4b')](_0x92a36c[_0x8fe6('0x32')]);_0x255245[_0x8fe6('0x33')]=_[_0x8fe6('0x34')](_0x255245[_0x8fe6('0x35')],_0x255245['query']);_0x10c760[_0x8fe6('0x36')]=_[_0x8fe6('0x34')](_0x255245['model'],qs[_0x8fe6('0x37')](_0x92a36c[_0x8fe6('0x32')]['fields']));_0x10c760[_0x8fe6('0x36')]=_0x10c760['attributes'][_0x8fe6('0x38')]?_0x10c760[_0x8fe6('0x36')]:_0x255245['model'];_0x10c760[_0x8fe6('0x3b')]=qs[_0x8fe6('0x3c')](_0x92a36c[_0x8fe6('0x32')][_0x8fe6('0x3c')]);_0x10c760['where']=qs[_0x8fe6('0x33')](_['pick'](_0x92a36c[_0x8fe6('0x32')],_0x255245['filters']));if(_0x92a36c['query'][_0x8fe6('0x41')]){_0x10c760[_0x8fe6('0x3d')]=_[_0x8fe6('0x42')](_0x10c760['where'],{'$or':_['map'](_0x10c760[_0x8fe6('0x36')],function(_0x27e5bc){var _0x30d876={};_0x30d876[_0x27e5bc]={'$like':'%'+_0x92a36c['query'][_0x8fe6('0x41')]+'%'};return _0x30d876;})});}_0x10c760=_[_0x8fe6('0x42')]({},_0x10c760,_0x92a36c[_0x8fe6('0x43')]);return _0x2b916d[_0x8fe6('0x51')](_0x10c760);}})['then'](function(_0x4a6725){if(_0x4a6725){_0x2f6f62=_0x4a6725['length'];if(!_0x92a36c['query']['hasOwnProperty'](_0x8fe6('0x3a'))){_0x10c760[_0x8fe6('0x22')]=qs[_0x8fe6('0x22')](_0x92a36c[_0x8fe6('0x32')][_0x8fe6('0x22')]);_0x10c760['offset']=qs['offset'](_0x92a36c[_0x8fe6('0x32')][_0x8fe6('0x20')]);}return _0x2b916d[_0x8fe6('0x51')](_0x10c760);}})[_0x8fe6('0x2a')](function(_0x542193){if(_0x542193){return _0x542193?{'count':_0x2f6f62,'rows':_0x542193}:null;}})[_0x8fe6('0x2a')](respondWithResult(_0x88e0d9,null))[_0x8fe6('0x48')](handleError(_0x88e0d9,null));};exports[_0x8fe6('0x52')]=function(_0x41e0ec,_0x15f40a,_0x132801){if(_0x41e0ec['body']['id']){delete _0x41e0ec[_0x8fe6('0x4e')]['id'];}return db['ServicenowAccount'][_0x8fe6('0x50')]({'where':{'id':_0x41e0ec[_0x8fe6('0x4a')]['id']}})[_0x8fe6('0x2a')](handleEntityNotFound(_0x15f40a,null))[_0x8fe6('0x2a')](function(_0x5df40d){if(_0x5df40d){_0x41e0ec[_0x8fe6('0x4e')][_0x8fe6('0x53')]=_0x5df40d['id'];_0x41e0ec[_0x8fe6('0x4e')]['Subjects']=integrations['getSubjects'](_0x41e0ec[_0x8fe6('0x4e')][_0x8fe6('0x54')],_0x41e0ec['body'][_0x8fe6('0x3f')]);_0x41e0ec[_0x8fe6('0x4e')][_0x8fe6('0x55')]=integrations[_0x8fe6('0x56')](_0x41e0ec['body'][_0x8fe6('0x54')],_0x41e0ec['body'][_0x8fe6('0x3f')]);return db[_0x8fe6('0x57')][_0x8fe6('0x4d')](_0x41e0ec[_0x8fe6('0x4e')],{'include':[{'model':db[_0x8fe6('0x58')],'as':_0x8fe6('0x59')},{'model':db[_0x8fe6('0x58')],'as':_0x8fe6('0x55')}]});}return null;})[_0x8fe6('0x2a')](respondWithResult(_0x15f40a,null))['catch'](handleError(_0x15f40a,null));};exports[_0x8fe6('0x5a')]=function(_0xee4683,_0x34e17c,_0x2d6aa2){var _0x59e95e=[_0x8fe6('0x5b'),'hold_reason',_0x8fe6('0x5c'),'subcategory',_0x8fe6('0x5d'),_0x8fe6('0x5e'),_0x8fe6('0x5f'),_0x8fe6('0x60'),_0x8fe6('0x61')];var _0x25ce94=[_0x8fe6('0x62'),_0x8fe6('0x5b'),_0x8fe6('0x63'),_0x8fe6('0x64'),_0x8fe6('0x65'),_0x8fe6('0x66'),_0x8fe6('0x67'),_0x8fe6('0x68'),_0x8fe6('0x69'),_0x8fe6('0x6a'),_0x8fe6('0x6b'),_0x8fe6('0x6c'),_0x8fe6('0x6d'),_0x8fe6('0x6e'),_0x8fe6('0x6f'),_0x8fe6('0x70'),_0x8fe6('0x71'),_0x8fe6('0x72'),_0x8fe6('0x5c'),'order','calendar_stc',_0x8fe6('0x73'),_0x8fe6('0x74'),_0x8fe6('0x75'),_0x8fe6('0x76'),_0x8fe6('0x77'),_0x8fe6('0x78'),_0x8fe6('0x79'),'priority',_0x8fe6('0x7a'),_0x8fe6('0x7b'),_0x8fe6('0x7c'),_0x8fe6('0x7d'),'opened_at','business_duration','group_list',_0x8fe6('0x7e'),_0x8fe6('0x7f'),_0x8fe6('0x80'),_0x8fe6('0x81'),'approval_set',_0x8fe6('0x82'),_0x8fe6('0x83'),'short_description',_0x8fe6('0x5d'),_0x8fe6('0x84'),_0x8fe6('0x85'),_0x8fe6('0x86'),_0x8fe6('0x87'),'business_stc',_0x8fe6('0x88'),_0x8fe6('0x89'),_0x8fe6('0x8a'),_0x8fe6('0x5e'),_0x8fe6('0x8b'),_0x8fe6('0x8c'),_0x8fe6('0x8d'),_0x8fe6('0x8e'),_0x8fe6('0x8f'),_0x8fe6('0x90'),_0x8fe6('0x91'),_0x8fe6('0x92'),_0x8fe6('0x5f'),_0x8fe6('0x93'),'problem_id',_0x8fe6('0x94'),'reassignment_count','activity_due',_0x8fe6('0x95'),_0x8fe6('0x60'),_0x8fe6('0x96'),_0x8fe6('0x97'),_0x8fe6('0x98'),_0x8fe6('0x99'),_0x8fe6('0x9a'),_0x8fe6('0x9b'),_0x8fe6('0x9c'),_0x8fe6('0x9d'),'escalation',_0x8fe6('0x9e'),_0x8fe6('0x9f'),_0x8fe6('0xa0'),_0x8fe6('0x61')];var _0x1c622d='';var _0x2bbe76='';var _0x3969e7=[];var _0x249341='';var _0x5e33f8='';var _0x10d011=[];var _0x20952a='';var _0x29f34e='';var _0x4712aa={};var _0x1af645='';return db[_0x8fe6('0x44')][_0x8fe6('0x50')]({'where':{'id':_0xee4683[_0x8fe6('0x4a')]['id']},'attributes':['id',_0x8fe6('0xa1'),_0x8fe6('0xa2'),_0x8fe6('0xa3'),_0x8fe6('0xa4'),_0x8fe6('0xa5')]})['then'](handleEntityNotFound(_0x34e17c,null))[_0x8fe6('0x2a')](function(_0x34cc94){if(_0x34cc94){_0x1af645=_0x34cc94['remoteUri'];var _0x53ce40=_0x1af645[_0x8fe6('0xa6')](-0x1);if(_0x53ce40==='/'){_0x1af645=_0x1af645[_0x8fe6('0xa7')](0x0,_0x1af645[_0x8fe6('0xa8')](_0x53ce40));}_0x29f34e=util[_0x8fe6('0xa9')](_0x8fe6('0xaa'),_0x1af645);_0x20952a=util['format']('%s/api/now/table/',_0x1af645);_0x4712aa={'user':_0x34cc94[_0x8fe6('0xa1')],'pass':_0x34cc94[_0x8fe6('0xa2')]};var _0x517b0f={'method':_0x8fe6('0xab'),'uri':_0x29f34e+_0x8fe6('0xac'),'auth':_0x4712aa,'json':!![]};return rp(_0x517b0f);}})[_0x8fe6('0x2a')](function(_0x5cd375){if(_0x5cd375[_0x8fe6('0xad')][_0x8fe6('0x38')]>0x0){_0x1c622d=_0x5cd375[_0x8fe6('0xad')];}console[_0x8fe6('0xae')](_0x8fe6('0xaf'),_0x1c622d);_0x10d011=[];_0x2bbe76=Object[_0x8fe6('0xb0')]([],_0x1c622d);_['remove'](_0x2bbe76,function(_0x64d1d6){return!_0x59e95e[_0x8fe6('0xb1')](_0x64d1d6[_0x8fe6('0x2d')]);});_0x2bbe76['forEach'](function(_0x3a96a2){var _0x9bac61=createFieldObject(_0x20952a,_0x4712aa,_0x3a96a2[_0x8fe6('0xb2')],_0x3a96a2['name'],_0x3a96a2['label'],![]);_0x10d011[_0x8fe6('0xb3')](_0x9bac61);});return Promise['all'](_0x10d011);})[_0x8fe6('0x2a')](function(_0x5a6956){_0x3969e7=_0x5a6956;_0x249341=Object[_0x8fe6('0xb0')]([],_0x1c622d);console['log'](_0x8fe6('0xb4'),_0x1c622d);_[_0x8fe6('0xb5')](_0x249341,function(_0xee082a){return _0x25ce94[_0x8fe6('0xb1')](_0xee082a[_0x8fe6('0x2d')]);});console[_0x8fe6('0xae')](_0x8fe6('0xb6'),_0x249341);_0x10d011=[];_0x249341[_0x8fe6('0xb7')](function(_0x3aa311){var _0x13759f=createFieldObject(_0x20952a,_0x4712aa,_0x3aa311[_0x8fe6('0xb2')],_0x3aa311[_0x8fe6('0x2d')],_0x3aa311['label'],!![]);_0x10d011[_0x8fe6('0xb3')](_0x13759f);});return Promise['all'](_0x10d011);})[_0x8fe6('0x2a')](function(_0x3c6aa7){_0x5e33f8=_0x3c6aa7;var _0xa259de=_0x3969e7['concat'](_0x5e33f8);return{'count':_0xa259de[_0x8fe6('0x38')],'rows':_0xa259de};})[_0x8fe6('0x2a')](respondWithResult(_0x34e17c,null))[_0x8fe6('0x48')](function(_0x5d20d4){console[_0x8fe6('0xae')](_0x8fe6('0xb8')+_0x5d20d4);var _0x32b5a5=_0xee4683['query'][_0x8fe6('0xb9')]?0x1f4:_0x5d20d4['statusCode']||0x1f4;logger[_0x8fe6('0x2c')](_0x5d20d4['stack']);delete _0x5d20d4[_0x8fe6('0x2d')];if(_0x32b5a5===0x191){_0x32b5a5=0x190;}_0x34e17c[_0x8fe6('0x1d')](_0x32b5a5)['send'](_0xee4683[_0x8fe6('0x32')][_0x8fe6('0xb9')]?{'message':_0x8fe6('0xba'),'statusCode':_0x5d20d4[_0x8fe6('0xbb')]}:_0x5d20d4);});};function createFieldObject(_0x3b76c0,_0x574e83,_0x396fb6,_0x466015,_0x2718c9,_0xc698d3){return new Promise(function(_0x3cc0f6,_0x191451){var _0x5c2a9d={'id':_0x466015,'name':_0x2718c9,'custom':_0xc698d3};if(_0x396fb6===_0x8fe6('0xbc')){_0x5c2a9d[_0x8fe6('0x43')]=[{'name':_0x8fe6('0xbd'),'value':_0x8fe6('0xbe')},{'name':_0x8fe6('0xbf'),'value':'false'}];_0x3cc0f6(_0x5c2a9d);}else{var _0x4ebaef={'method':_0x8fe6('0xab'),'uri':_0x3b76c0+_0x8fe6('0xc0')+_0x466015,'auth':_0x574e83,'json':!![]};return rp(_0x4ebaef)[_0x8fe6('0x2a')](function(_0x6c5301){var _0x296160=[];if(_0x6c5301[_0x8fe6('0xad')][_0x8fe6('0x38')]>0x0){_0x6c5301['result'][_0x8fe6('0xb7')](function(_0x9889e){if(_0x9889e[_0x8fe6('0xc1')]===_0x8fe6('0xc2')){var _0x10373d={'name':_0x9889e[_0x8fe6('0xc3')],'value':_0x9889e[_0x8fe6('0xc4')]};_0x296160[_0x8fe6('0xb3')](_0x10373d);}});}_0x5c2a9d['options']=_0x296160;if(_0x5c2a9d[_0x8fe6('0x43')][_0x8fe6('0x38')]>0x0){_0x3cc0f6(_0x5c2a9d);}else{if(_0xc698d3==![]){_0x3cc0f6();}else{_0x3cc0f6(_0x5c2a9d);}}});}});} \ No newline at end of file +var _0x6a9e=['follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','reassignment_count','activity_due','assigned_to','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','location','email','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','password','GET','incident?sysparm_display_value=all','result','log','assign','includes','forEach','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','push','all','concat','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','then','error','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','subcategory','close_code','severity','category','parent','watch_list','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','notify','sys_class_name','close_notes','closed_by'];(function(_0x18d665,_0x2f65ab){var _0x4abe5c=function(_0x199e11){while(--_0x199e11){_0x18d665['push'](_0x18d665['shift']());}};_0x4abe5c(++_0x2f65ab);}(_0x6a9e,0x1a3));var _0xe6a9=function(_0x41f351,_0x147277){_0x41f351=_0x41f351-0x0;var _0xe7ee8f=_0x6a9e[_0x41f351];return _0xe7ee8f;};'use strict';var emlformat=require(_0xe6a9('0x0'));var rimraf=require(_0xe6a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe6a9('0x2'));var rp=require(_0xe6a9('0x3'));var moment=require(_0xe6a9('0x4'));var BPromise=require(_0xe6a9('0x5'));var Mustache=require(_0xe6a9('0x6'));var util=require(_0xe6a9('0x7'));var path=require(_0xe6a9('0x8'));var sox=require(_0xe6a9('0x9'));var csv=require(_0xe6a9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6a9('0xb'));var _=require(_0xe6a9('0xc'));var squel=require(_0xe6a9('0xd'));var crypto=require(_0xe6a9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe6a9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe6a9('0x10'));var Papa=require(_0xe6a9('0x11'));var Redis=require(_0xe6a9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe6a9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6a9('0x14'));var logger=require(_0xe6a9('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xe6a9('0x16'));var licenseUtil=require(_0xe6a9('0x17'));var db=require(_0xe6a9('0x18'))['db'];var integrations=require(_0xe6a9('0x19'));function respondWithStatusCode(_0x3ef41f,_0x274719){_0x274719=_0x274719||0xcc;return function(_0x3b7131){if(_0x3b7131){return _0x3ef41f[_0xe6a9('0x1a')](_0x274719);}return _0x3ef41f[_0xe6a9('0x1b')](_0x274719)[_0xe6a9('0x1c')]();};}function respondWithResult(_0x4e5a32,_0x473997){_0x473997=_0x473997||0xc8;return function(_0x2133e5){if(_0x2133e5){return _0x4e5a32[_0xe6a9('0x1b')](_0x473997)[_0xe6a9('0x1d')](_0x2133e5);}};}function respondWithFilteredResult(_0x341500,_0x265168){return function(_0x15a9a1){if(_0x15a9a1){var _0x4c10cc=typeof _0x265168[_0xe6a9('0x1e')]==='undefined'&&typeof _0x265168['limit']==='undefined';var _0x2b08de=_0x15a9a1[_0xe6a9('0x1f')];var _0x159eb2=_0x4c10cc?0x0:_0x265168[_0xe6a9('0x1e')];var _0x496192=_0x4c10cc?_0x15a9a1['count']:_0x265168[_0xe6a9('0x1e')]+_0x265168[_0xe6a9('0x20')];var _0x16063c;if(_0x496192>=_0x2b08de){_0x496192=_0x2b08de;_0x16063c=0xc8;}else{_0x16063c=0xce;}_0x341500[_0xe6a9('0x1b')](_0x16063c);return _0x341500[_0xe6a9('0x21')](_0xe6a9('0x22'),_0x159eb2+'-'+_0x496192+'/'+_0x2b08de)[_0xe6a9('0x1d')](_0x15a9a1);}return null;};}function patchUpdates(_0x4dc9e6){return function(_0x29ccbf){try{jsonpatch[_0xe6a9('0x23')](_0x29ccbf,_0x4dc9e6,!![]);}catch(_0x23b0d8){return BPromise[_0xe6a9('0x24')](_0x23b0d8);}return _0x29ccbf['save']();};}function saveUpdates(_0x1d6578,_0x12aa3c){return function(_0x151cb9){if(_0x151cb9){return _0x151cb9['update'](_0x1d6578)[_0xe6a9('0x25')](function(_0x108e2a){return _0x108e2a;});}return null;};}function removeEntity(_0x3448f6,_0x48343c){return function(_0x140538){if(_0x140538){return _0x140538['destroy']()[_0xe6a9('0x25')](function(){_0x3448f6[_0xe6a9('0x1b')](0xcc)[_0xe6a9('0x1c')]();});}};}function handleEntityNotFound(_0x154a11,_0x441b2a){return function(_0x5f545e){if(!_0x5f545e){_0x154a11['sendStatus'](0x194);}return _0x5f545e;};}function handleError(_0x50db68,_0x4f8221){_0x4f8221=_0x4f8221||0x1f4;return function(_0x4e2be0){logger[_0xe6a9('0x26')](_0x4e2be0['stack']);if(_0x4e2be0[_0xe6a9('0x27')]){delete _0x4e2be0[_0xe6a9('0x27')];}_0x50db68[_0xe6a9('0x1b')](_0x4f8221)[_0xe6a9('0x28')](_0x4e2be0);};}exports[_0xe6a9('0x29')]=function(_0x5a2c0f,_0x496af4){var _0x2a9400={},_0x17cf31={},_0xcc482a={'count':0x0,'rows':[]};var _0x5917c7=_['map'](db[_0xe6a9('0x2a')][_0xe6a9('0x2b')],function(_0x37f830){return{'name':_0x37f830[_0xe6a9('0x2c')],'type':_0x37f830[_0xe6a9('0x2d')][_0xe6a9('0x2e')]};});_0x17cf31[_0xe6a9('0x2f')]=_[_0xe6a9('0x30')](_0x5917c7,_0xe6a9('0x27'));_0x17cf31[_0xe6a9('0x31')]=_[_0xe6a9('0x32')](_0x5a2c0f[_0xe6a9('0x31')]);_0x17cf31[_0xe6a9('0x33')]=_[_0xe6a9('0x34')](_0x17cf31[_0xe6a9('0x2f')],_0x17cf31['query']);_0x2a9400[_0xe6a9('0x35')]=_[_0xe6a9('0x34')](_0x17cf31[_0xe6a9('0x2f')],qs['fields'](_0x5a2c0f['query'][_0xe6a9('0x36')]));_0x2a9400['attributes']=_0x2a9400[_0xe6a9('0x35')][_0xe6a9('0x37')]?_0x2a9400['attributes']:_0x17cf31[_0xe6a9('0x2f')];if(!_0x5a2c0f[_0xe6a9('0x31')][_0xe6a9('0x38')](_0xe6a9('0x39'))){_0x2a9400['limit']=qs['limit'](_0x5a2c0f[_0xe6a9('0x31')][_0xe6a9('0x20')]);_0x2a9400[_0xe6a9('0x1e')]=qs[_0xe6a9('0x1e')](_0x5a2c0f[_0xe6a9('0x31')][_0xe6a9('0x1e')]);}_0x2a9400['order']=qs[_0xe6a9('0x3a')](_0x5a2c0f[_0xe6a9('0x31')]['sort']);_0x2a9400[_0xe6a9('0x3b')]=qs[_0xe6a9('0x33')](_[_0xe6a9('0x3c')](_0x5a2c0f['query'],_0x17cf31[_0xe6a9('0x33')]),_0x5917c7);if(_0x5a2c0f[_0xe6a9('0x31')][_0xe6a9('0x3d')]){_0x2a9400[_0xe6a9('0x3b')]=_[_0xe6a9('0x3e')](_0x2a9400[_0xe6a9('0x3b')],{'$or':_[_0xe6a9('0x30')](_0x5917c7,function(_0x4f3fa9){if(_0x4f3fa9['type']!==_0xe6a9('0x3f')){var _0x1c9a59={};_0x1c9a59[_0x4f3fa9[_0xe6a9('0x27')]]={'$like':'%'+_0x5a2c0f[_0xe6a9('0x31')]['filter']+'%'};return _0x1c9a59;}})});}_0x2a9400=_['merge']({},_0x2a9400,_0x5a2c0f[_0xe6a9('0x40')]);var _0x54ccfb={'where':_0x2a9400[_0xe6a9('0x3b')]};return db[_0xe6a9('0x2a')]['count'](_0x54ccfb)[_0xe6a9('0x25')](function(_0x2e9a4e){_0xcc482a[_0xe6a9('0x1f')]=_0x2e9a4e;if(_0x5a2c0f[_0xe6a9('0x31')]['includeAll']){_0x2a9400[_0xe6a9('0x41')]=[{'all':!![]}];}return db[_0xe6a9('0x2a')][_0xe6a9('0x42')](_0x2a9400);})[_0xe6a9('0x25')](function(_0x17356d){_0xcc482a[_0xe6a9('0x43')]=_0x17356d;return _0xcc482a;})[_0xe6a9('0x25')](respondWithFilteredResult(_0x496af4,_0x2a9400))[_0xe6a9('0x44')](handleError(_0x496af4,null));};exports[_0xe6a9('0x45')]=function(_0x57a08b,_0x44de37){var _0xc2811a={'raw':![],'where':{'id':_0x57a08b[_0xe6a9('0x46')]['id']}},_0x452772={};_0x452772['model']=_[_0xe6a9('0x32')](db[_0xe6a9('0x2a')]['rawAttributes']);_0x452772[_0xe6a9('0x31')]=_[_0xe6a9('0x32')](_0x57a08b[_0xe6a9('0x31')]);_0x452772[_0xe6a9('0x33')]=_[_0xe6a9('0x34')](_0x452772['model'],_0x452772[_0xe6a9('0x31')]);_0xc2811a[_0xe6a9('0x35')]=_['intersection'](_0x452772[_0xe6a9('0x2f')],qs[_0xe6a9('0x36')](_0x57a08b[_0xe6a9('0x31')]['fields']));_0xc2811a[_0xe6a9('0x35')]=_0xc2811a['attributes']['length']?_0xc2811a[_0xe6a9('0x35')]:_0x452772[_0xe6a9('0x2f')];if(_0x57a08b['query']['includeAll']){_0xc2811a[_0xe6a9('0x41')]=[{'all':!![]}];}_0xc2811a=_[_0xe6a9('0x3e')]({},_0xc2811a,_0x57a08b['options']);return db[_0xe6a9('0x2a')][_0xe6a9('0x47')](_0xc2811a)[_0xe6a9('0x25')](handleEntityNotFound(_0x44de37,null))[_0xe6a9('0x25')](respondWithResult(_0x44de37,null))[_0xe6a9('0x44')](handleError(_0x44de37,null));};exports[_0xe6a9('0x48')]=function(_0x169569,_0x5d0345){return db[_0xe6a9('0x2a')][_0xe6a9('0x48')](_0x169569[_0xe6a9('0x49')],{})[_0xe6a9('0x25')](respondWithResult(_0x5d0345,0xc9))[_0xe6a9('0x44')](handleError(_0x5d0345,null));};exports['update']=function(_0x181945,_0x43db11){if(_0x181945[_0xe6a9('0x49')]['id']){delete _0x181945[_0xe6a9('0x49')]['id'];}return db[_0xe6a9('0x2a')][_0xe6a9('0x47')]({'where':{'id':_0x181945[_0xe6a9('0x46')]['id']}})[_0xe6a9('0x25')](handleEntityNotFound(_0x43db11,null))['then'](saveUpdates(_0x181945[_0xe6a9('0x49')],null))[_0xe6a9('0x25')](respondWithResult(_0x43db11,null))[_0xe6a9('0x44')](handleError(_0x43db11,null));};exports[_0xe6a9('0x4a')]=function(_0x5a60d3,_0x495d43){return db[_0xe6a9('0x2a')]['find']({'where':{'id':_0x5a60d3['params']['id']}})[_0xe6a9('0x25')](handleEntityNotFound(_0x495d43,null))[_0xe6a9('0x25')](removeEntity(_0x495d43,null))['catch'](handleError(_0x495d43,null));};exports[_0xe6a9('0x4b')]=function(_0x137d54,_0x445055,_0x5063b7){var _0x50cbcf={};var _0x32c82a={};var _0x1fc472;var _0xc9e62;return db[_0xe6a9('0x2a')][_0xe6a9('0x4c')]({'where':{'id':_0x137d54['params']['id']}})[_0xe6a9('0x25')](handleEntityNotFound(_0x445055,null))[_0xe6a9('0x25')](function(_0x271230){if(_0x271230){_0x1fc472=_0x271230;_0x32c82a[_0xe6a9('0x2f')]=_[_0xe6a9('0x32')](db[_0xe6a9('0x4d')][_0xe6a9('0x2b')]);_0x32c82a[_0xe6a9('0x31')]=_[_0xe6a9('0x32')](_0x137d54['query']);_0x32c82a[_0xe6a9('0x33')]=_['intersection'](_0x32c82a[_0xe6a9('0x2f')],_0x32c82a[_0xe6a9('0x31')]);_0x50cbcf[_0xe6a9('0x35')]=_[_0xe6a9('0x34')](_0x32c82a[_0xe6a9('0x2f')],qs[_0xe6a9('0x36')](_0x137d54[_0xe6a9('0x31')][_0xe6a9('0x36')]));_0x50cbcf[_0xe6a9('0x35')]=_0x50cbcf[_0xe6a9('0x35')][_0xe6a9('0x37')]?_0x50cbcf[_0xe6a9('0x35')]:_0x32c82a[_0xe6a9('0x2f')];_0x50cbcf[_0xe6a9('0x4e')]=qs[_0xe6a9('0x3a')](_0x137d54[_0xe6a9('0x31')][_0xe6a9('0x3a')]);_0x50cbcf[_0xe6a9('0x3b')]=qs[_0xe6a9('0x33')](_['pick'](_0x137d54['query'],_0x32c82a[_0xe6a9('0x33')]));if(_0x137d54[_0xe6a9('0x31')][_0xe6a9('0x3d')]){_0x50cbcf['where']=_['merge'](_0x50cbcf['where'],{'$or':_[_0xe6a9('0x30')](_0x50cbcf['attributes'],function(_0x45c07c){var _0x186f48={};_0x186f48[_0x45c07c]={'$like':'%'+_0x137d54['query'][_0xe6a9('0x3d')]+'%'};return _0x186f48;})});}_0x50cbcf=_['merge']({},_0x50cbcf,_0x137d54[_0xe6a9('0x40')]);return _0x1fc472['getConfigurations'](_0x50cbcf);}})['then'](function(_0x2ddc7b){if(_0x2ddc7b){_0xc9e62=_0x2ddc7b[_0xe6a9('0x37')];if(!_0x137d54[_0xe6a9('0x31')][_0xe6a9('0x38')](_0xe6a9('0x39'))){_0x50cbcf[_0xe6a9('0x20')]=qs[_0xe6a9('0x20')](_0x137d54[_0xe6a9('0x31')][_0xe6a9('0x20')]);_0x50cbcf[_0xe6a9('0x1e')]=qs[_0xe6a9('0x1e')](_0x137d54[_0xe6a9('0x31')][_0xe6a9('0x1e')]);}return _0x1fc472[_0xe6a9('0x4b')](_0x50cbcf);}})[_0xe6a9('0x25')](function(_0x3f0d66){if(_0x3f0d66){return _0x3f0d66?{'count':_0xc9e62,'rows':_0x3f0d66}:null;}})['then'](respondWithResult(_0x445055,null))[_0xe6a9('0x44')](handleError(_0x445055,null));};exports[_0xe6a9('0x4f')]=function(_0x51c423,_0x582eee,_0x4eed7e){if(_0x51c423['body']['id']){delete _0x51c423[_0xe6a9('0x49')]['id'];}return db['ServicenowAccount'][_0xe6a9('0x4c')]({'where':{'id':_0x51c423[_0xe6a9('0x46')]['id']}})[_0xe6a9('0x25')](handleEntityNotFound(_0x582eee,null))['then'](function(_0xa52668){if(_0xa52668){_0x51c423[_0xe6a9('0x49')]['AccountId']=_0xa52668['id'];_0x51c423[_0xe6a9('0x49')]['Subjects']=integrations[_0xe6a9('0x50')](_0x51c423[_0xe6a9('0x49')][_0xe6a9('0x51')],_0x51c423[_0xe6a9('0x49')][_0xe6a9('0x2d')]);_0x51c423[_0xe6a9('0x49')][_0xe6a9('0x52')]=integrations[_0xe6a9('0x53')](_0x51c423[_0xe6a9('0x49')]['channel'],_0x51c423[_0xe6a9('0x49')][_0xe6a9('0x2d')]);return db['ServicenowConfiguration']['create'](_0x51c423[_0xe6a9('0x49')],{'include':[{'model':db[_0xe6a9('0x54')],'as':_0xe6a9('0x55')},{'model':db[_0xe6a9('0x54')],'as':_0xe6a9('0x52')}]});}return null;})['then'](respondWithResult(_0x582eee,null))[_0xe6a9('0x44')](handleError(_0x582eee,null));};exports[_0xe6a9('0x56')]=function(_0x2c16e5,_0x578a51,_0x5243f5){var _0x145217=[_0xe6a9('0x57'),_0xe6a9('0x58'),'knowledge',_0xe6a9('0x59'),_0xe6a9('0x5a'),'notify','incident_state',_0xe6a9('0x5b'),_0xe6a9('0x5c')];var _0x5e32ce=[_0xe6a9('0x5d'),_0xe6a9('0x57'),'caused_by',_0xe6a9('0x5e'),'upon_reject','sys_updated_on',_0xe6a9('0x5f'),_0xe6a9('0x58'),_0xe6a9('0x60'),_0xe6a9('0x61'),_0xe6a9('0x62'),_0xe6a9('0x63'),'opened_by',_0xe6a9('0x64'),_0xe6a9('0x65'),_0xe6a9('0x66'),'state',_0xe6a9('0x67'),_0xe6a9('0x68'),'order',_0xe6a9('0x69'),_0xe6a9('0x6a'),_0xe6a9('0x6b'),_0xe6a9('0x6c'),_0xe6a9('0x6d'),_0xe6a9('0x6e'),_0xe6a9('0x6f'),_0xe6a9('0x70'),_0xe6a9('0x71'),_0xe6a9('0x72'),_0xe6a9('0x73'),_0xe6a9('0x74'),_0xe6a9('0x75'),'opened_at',_0xe6a9('0x76'),'group_list',_0xe6a9('0x77'),'reopened_time',_0xe6a9('0x78'),_0xe6a9('0x79'),_0xe6a9('0x7a'),_0xe6a9('0x59'),_0xe6a9('0x7b'),_0xe6a9('0x7c'),_0xe6a9('0x5a'),_0xe6a9('0x7d'),_0xe6a9('0x7e'),_0xe6a9('0x7f'),_0xe6a9('0x80'),_0xe6a9('0x81'),_0xe6a9('0x82'),_0xe6a9('0x83'),'calendar_duration',_0xe6a9('0x84'),_0xe6a9('0x85'),_0xe6a9('0x86'),_0xe6a9('0x87'),_0xe6a9('0x88'),_0xe6a9('0x89'),_0xe6a9('0x8a'),_0xe6a9('0x8b'),_0xe6a9('0x8c'),_0xe6a9('0x8d'),_0xe6a9('0x8e'),_0xe6a9('0x8f'),'company',_0xe6a9('0x90'),_0xe6a9('0x91'),_0xe6a9('0x92'),'severity','comments','sla_due','approval','comments_and_work_notes',_0xe6a9('0x93'),_0xe6a9('0x94'),'reopen_count',_0xe6a9('0x95'),'escalation',_0xe6a9('0x96'),_0xe6a9('0x97'),_0xe6a9('0x98'),'category'];var _0x23860f='';var _0x257a69='';var _0x190608=[];var _0x4b17e4='';var _0x1d2187='';var _0x686ee0=[];var _0x409f62='';var _0x2a8500='';var _0x1bb639={};var _0x45f7e8='';return db[_0xe6a9('0x2a')]['findOne']({'where':{'id':_0x2c16e5[_0xe6a9('0x46')]['id']},'attributes':['id','username','password',_0xe6a9('0x99'),_0xe6a9('0x9a'),'serverUrl']})[_0xe6a9('0x25')](handleEntityNotFound(_0x578a51,null))['then'](function(_0x53cd98){if(_0x53cd98){_0x45f7e8=_0x53cd98[_0xe6a9('0x9a')];var _0x2370c2=_0x45f7e8[_0xe6a9('0x9b')](-0x1);if(_0x2370c2==='/'){_0x45f7e8=_0x45f7e8['substring'](0x0,_0x45f7e8[_0xe6a9('0x9c')](_0x2370c2));}_0x2a8500=util[_0xe6a9('0x9d')](_0xe6a9('0x9e'),_0x45f7e8);_0x409f62=util['format'](_0xe6a9('0x9f'),_0x45f7e8);_0x1bb639={'user':_0x53cd98[_0xe6a9('0xa0')],'pass':_0x53cd98[_0xe6a9('0xa1')]};var _0x4f729f={'method':_0xe6a9('0xa2'),'uri':_0x2a8500+_0xe6a9('0xa3'),'auth':_0x1bb639,'json':!![]};return rp(_0x4f729f);}})['then'](function(_0xc2d2eb){if(_0xc2d2eb[_0xe6a9('0xa4')][_0xe6a9('0x37')]>0x0){_0x23860f=_0xc2d2eb[_0xe6a9('0xa4')];}console[_0xe6a9('0xa5')]('incident\x20table\x20objects',_0x23860f);_0x686ee0=[];_0x257a69=Object[_0xe6a9('0xa6')]([],_0x23860f);_['remove'](_0x257a69,function(_0x586f5a){return!_0x145217[_0xe6a9('0xa7')](_0x586f5a[_0xe6a9('0x27')]);});_0x257a69[_0xe6a9('0xa8')](function(_0x1e4708){var _0x57de37=createFieldObject(_0x409f62,_0x1bb639,_0x1e4708['internalType'],_0x1e4708[_0xe6a9('0x27')],_0x1e4708['label'],![]);_0x686ee0['push'](_0x57de37);});return Promise['all'](_0x686ee0);})[_0xe6a9('0x25')](function(_0xdc30a){_0x190608=_0xdc30a;_0x4b17e4=Object[_0xe6a9('0xa6')]([],_0x23860f);console[_0xe6a9('0xa5')]('TCL:\x20_object',_0x23860f);_[_0xe6a9('0xa9')](_0x4b17e4,function(_0x365eda){return _0x5e32ce[_0xe6a9('0xa7')](_0x365eda[_0xe6a9('0x27')]);});console[_0xe6a9('0xa5')](_0xe6a9('0xaa'),_0x4b17e4);_0x686ee0=[];_0x4b17e4[_0xe6a9('0xa8')](function(_0x5c80b9){var _0x5b0b41=createFieldObject(_0x409f62,_0x1bb639,_0x5c80b9['internalType'],_0x5c80b9[_0xe6a9('0x27')],_0x5c80b9[_0xe6a9('0xab')],!![]);_0x686ee0[_0xe6a9('0xac')](_0x5b0b41);});return Promise[_0xe6a9('0xad')](_0x686ee0);})['then'](function(_0x4453e5){_0x1d2187=_0x4453e5;var _0x11b890=_0x190608[_0xe6a9('0xae')](_0x1d2187);return{'count':_0x11b890[_0xe6a9('0x37')],'rows':_0x11b890};})[_0xe6a9('0x25')](respondWithResult(_0x578a51,null))['catch'](function(_0x1e27c5){console[_0xe6a9('0xa5')](_0xe6a9('0xaf')+_0x1e27c5);var _0x1d5955=_0x2c16e5[_0xe6a9('0x31')][_0xe6a9('0xb0')]?0x1f4:_0x1e27c5[_0xe6a9('0xb1')]||0x1f4;logger[_0xe6a9('0x26')](_0x1e27c5[_0xe6a9('0xb2')]);delete _0x1e27c5['name'];if(_0x1d5955===0x191){_0x1d5955=0x190;}_0x578a51[_0xe6a9('0x1b')](_0x1d5955)[_0xe6a9('0x28')](_0x2c16e5[_0xe6a9('0x31')]['test']?{'message':_0xe6a9('0xb3'),'statusCode':_0x1e27c5[_0xe6a9('0xb1')]}:_0x1e27c5);});};function createFieldObject(_0x5f4f56,_0x2a931e,_0x4f241b,_0x14e674,_0x4956f8,_0x2878c6){return new Promise(function(_0xf057a2,_0x2f672b){var _0x1b0469={'id':_0x14e674,'name':_0x4956f8,'custom':_0x2878c6};if(_0x4f241b==='boolean'){_0x1b0469[_0xe6a9('0x40')]=[{'name':_0xe6a9('0xb4'),'value':_0xe6a9('0xb5')},{'name':_0xe6a9('0xb6'),'value':_0xe6a9('0xb7')}];_0xf057a2(_0x1b0469);}else{var _0x361619={'method':'GET','uri':_0x5f4f56+_0xe6a9('0xb8')+_0x14e674,'auth':_0x2a931e,'json':!![]};return rp(_0x361619)[_0xe6a9('0x25')](function(_0x31cf78){var _0x190fce=[];if(_0x31cf78['result'][_0xe6a9('0x37')]>0x0){_0x31cf78[_0xe6a9('0xa4')][_0xe6a9('0xa8')](function(_0x1ccff3){if(_0x1ccff3['inactive']===_0xe6a9('0xb7')){var _0x1fa516={'name':_0x1ccff3[_0xe6a9('0xab')],'value':_0x1ccff3['value']};_0x190fce[_0xe6a9('0xac')](_0x1fa516);}});}_0x1b0469[_0xe6a9('0x40')]=_0x190fce;if(_0x1b0469[_0xe6a9('0x40')][_0xe6a9('0x37')]>0x0){_0xf057a2(_0x1b0469);}else{if(_0x2878c6==![]){_0xf057a2();}else{_0xf057a2(_0x1b0469);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 00f0599..49fdfb6 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 _0x46ed=['bluebird','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment'];(function(_0x159d43,_0x340c49){var _0x2472dc=function(_0x19cc7f){while(--_0x19cc7f){_0x159d43['push'](_0x159d43['shift']());}};_0x2472dc(++_0x340c49);}(_0x46ed,0x168));var _0xd46e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x46ed[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));var integrations=require(_0xd46e('0x8'));module[_0xd46e('0x9')]=function(_0x25cf78,_0x45e680){return _0x25cf78[_0xd46e('0xa')](_0xd46e('0xb'),attributes,{'tableName':_0xd46e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f47=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','int_servicenow_accounts','util'];(function(_0x487524,_0x292ba6){var _0x3f3543=function(_0xaba548){while(--_0xaba548){_0x487524['push'](_0x487524['shift']());}};_0x3f3543(++_0x292ba6);}(_0x6f47,0xc7));var _0x76f4=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x6f47[_0x9df060];return _0x338dfe;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));var integrations=require(_0x76f4('0x7'));module['exports']=function(_0x35602f,_0xfc2405){return _0x35602f[_0x76f4('0x8')]('ServicenowAccount',attributes,{'tableName':_0x76f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index f35250c..3b8a3f9 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 _0x1b50=['ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','model','map','ShowServicenowAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x87c8a9,_0x259794){var _0x3797a8=function(_0x213924){while(--_0x213924){_0x87c8a9['push'](_0x87c8a9['shift']());}};_0x3797a8(++_0x259794);}(_0x1b50,0xee));var _0x01b5=function(_0x4f8ed0,_0x4ee043){_0x4f8ed0=_0x4f8ed0-0x0;var _0x483e61=_0x1b50[_0x4f8ed0];return _0x483e61;};'use strict';var _=require(_0x01b5('0x0'));var util=require(_0x01b5('0x1'));var moment=require('moment');var BPromise=require(_0x01b5('0x2'));var rs=require(_0x01b5('0x3'));var fs=require('fs');var Redis=require(_0x01b5('0x4'));var db=require(_0x01b5('0x5'))['db'];var utils=require(_0x01b5('0x6'));var logger=require(_0x01b5('0x7'))(_0x01b5('0x8'));var config=require(_0x01b5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x01b5('0xa')][_0x01b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f0ce3,_0x1c9b25,_0x536832){return new BPromise(function(_0x977c3d,_0x3948c7){return client[_0x01b5('0xc')](_0x3f0ce3,_0x536832)[_0x01b5('0xd')](function(_0x4dbe15){logger[_0x01b5('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x1c9b25,_0x01b5('0xf'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1c9b25,_0x01b5('0xf'),JSON[_0x01b5('0x10')](_0x4dbe15));if(_0x4dbe15[_0x01b5('0x11')]){if(_0x4dbe15[_0x01b5('0x11')]['code']===0x1f4){logger[_0x01b5('0x11')](_0x01b5('0x12'),_0x1c9b25,_0x4dbe15[_0x01b5('0x11')]['message']);return _0x3948c7(_0x4dbe15[_0x01b5('0x11')][_0x01b5('0x13')]);}logger[_0x01b5('0x11')](_0x01b5('0x12'),_0x1c9b25,_0x4dbe15[_0x01b5('0x11')]['message']);return _0x977c3d(_0x4dbe15[_0x01b5('0x11')]['message']);}else{logger[_0x01b5('0xe')](_0x01b5('0x12'),_0x1c9b25,'request\x20sent');_0x977c3d(_0x4dbe15['result']['message']);}})[_0x01b5('0x14')](function(_0x5bb5f1){logger[_0x01b5('0x11')](_0x01b5('0x12'),_0x1c9b25,_0x5bb5f1);_0x3948c7(_0x5bb5f1);});});}exports[_0x01b5('0x15')]=function(_0x1a70db){var _0x7aab07=this;return new Promise(function(_0x19951e,_0x429c61){return db[_0x01b5('0x16')]['findAll']({'raw':_0x1a70db[_0x01b5('0x17')]?_0x1a70db[_0x01b5('0x17')][_0x01b5('0x18')]===undefined?!![]:![]:!![],'where':_0x1a70db[_0x01b5('0x17')]?_0x1a70db[_0x01b5('0x17')][_0x01b5('0x19')]||null:null,'attributes':_0x1a70db[_0x01b5('0x17')]?_0x1a70db[_0x01b5('0x17')][_0x01b5('0x1a')]||null:null,'limit':_0x1a70db[_0x01b5('0x17')]?_0x1a70db[_0x01b5('0x17')][_0x01b5('0x1b')]||null:null,'include':_0x1a70db[_0x01b5('0x17')]?_0x1a70db[_0x01b5('0x17')][_0x01b5('0x1c')]?_['map'](_0x1a70db[_0x01b5('0x17')][_0x01b5('0x1c')],function(_0x42627e){return{'model':db[_0x42627e[_0x01b5('0x1d')]],'as':_0x42627e['as'],'attributes':_0x42627e[_0x01b5('0x1a')],'include':_0x42627e[_0x01b5('0x1c')]?_[_0x01b5('0x1e')](_0x42627e[_0x01b5('0x1c')],function(_0x556b26){return{'model':db[_0x556b26[_0x01b5('0x1d')]],'as':_0x556b26['as'],'attributes':_0x556b26[_0x01b5('0x1a')],'include':_0x556b26[_0x01b5('0x1c')]?_[_0x01b5('0x1e')](_0x556b26['include'],function(_0x5544bb){return{'model':db[_0x5544bb[_0x01b5('0x1d')]],'as':_0x5544bb['as'],'attributes':_0x5544bb[_0x01b5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x01b5('0xd')](function(_0x5dadfb){logger[_0x01b5('0xe')](_0x01b5('0x15'),_0x1a70db);logger['debug'](_0x01b5('0x15'),_0x1a70db,JSON[_0x01b5('0x10')](_0x5dadfb));_0x19951e(_0x5dadfb);})[_0x01b5('0x14')](function(_0x3a83b9){logger[_0x01b5('0x11')](_0x01b5('0x15'),_0x3a83b9[_0x01b5('0x13')],_0x1a70db);_0x429c61(_0x7aab07[_0x01b5('0x11')](0x1f4,_0x3a83b9[_0x01b5('0x13')]));});});};exports[_0x01b5('0x1f')]=function(_0x3c26ba){var _0x3eca08=this;return new Promise(function(_0x40903e,_0x22ab82){return db['ServicenowAccount']['find']({'raw':_0x3c26ba[_0x01b5('0x17')]?_0x3c26ba[_0x01b5('0x17')][_0x01b5('0x18')]===undefined?!![]:![]:!![],'where':_0x3c26ba[_0x01b5('0x17')]?_0x3c26ba[_0x01b5('0x17')]['where']||null:null,'attributes':_0x3c26ba[_0x01b5('0x17')]?_0x3c26ba['options'][_0x01b5('0x1a')]||null:null,'include':_0x3c26ba[_0x01b5('0x17')]?_0x3c26ba[_0x01b5('0x17')][_0x01b5('0x1c')]?_[_0x01b5('0x1e')](_0x3c26ba[_0x01b5('0x17')]['include'],function(_0x38e53f){return{'model':db[_0x38e53f[_0x01b5('0x1d')]],'as':_0x38e53f['as'],'attributes':_0x38e53f[_0x01b5('0x1a')],'include':_0x38e53f[_0x01b5('0x1c')]?_[_0x01b5('0x1e')](_0x38e53f[_0x01b5('0x1c')],function(_0x5186c4){return{'model':db[_0x5186c4[_0x01b5('0x1d')]],'as':_0x5186c4['as'],'attributes':_0x5186c4['attributes'],'include':_0x5186c4[_0x01b5('0x1c')]?_[_0x01b5('0x1e')](_0x5186c4[_0x01b5('0x1c')],function(_0x3a107c){return{'model':db[_0x3a107c[_0x01b5('0x1d')]],'as':_0x3a107c['as'],'attributes':_0x3a107c[_0x01b5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x01b5('0xd')](function(_0x2fa521){logger[_0x01b5('0xe')](_0x01b5('0x1f'),_0x3c26ba);logger['debug'](_0x01b5('0x1f'),_0x3c26ba,JSON[_0x01b5('0x10')](_0x2fa521));_0x40903e(_0x2fa521);})[_0x01b5('0x14')](function(_0x5bcbf8){logger[_0x01b5('0x11')](_0x01b5('0x1f'),_0x5bcbf8['message'],_0x3c26ba);_0x22ab82(_0x3eca08[_0x01b5('0x11')](0x1f4,_0x5bcbf8[_0x01b5('0x13')]));});});}; \ No newline at end of file +var _0x7e52=['options','raw','where','attributes','include','map','model','GetServicenowAccount','ShowServicenowAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ServicenowAccount'];(function(_0x247f3f,_0x5f298e){var _0x1381e6=function(_0x1e8355){while(--_0x1e8355){_0x247f3f['push'](_0x247f3f['shift']());}};_0x1381e6(++_0x5f298e);}(_0x7e52,0x13b));var _0x27e5=function(_0x8d1605,_0x5da527){_0x8d1605=_0x8d1605-0x0;var _0x8d2c93=_0x7e52[_0x8d1605];return _0x8d2c93;};'use strict';var _=require(_0x27e5('0x0'));var util=require(_0x27e5('0x1'));var moment=require(_0x27e5('0x2'));var BPromise=require('bluebird');var rs=require(_0x27e5('0x3'));var fs=require('fs');var Redis=require(_0x27e5('0x4'));var db=require(_0x27e5('0x5'))['db'];var utils=require(_0x27e5('0x6'));var logger=require(_0x27e5('0x7'))(_0x27e5('0x8'));var config=require(_0x27e5('0x9'));var jayson=require(_0x27e5('0xa'));var client=jayson[_0x27e5('0xb')][_0x27e5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d4db3,_0x1226af,_0x4e162f){return new BPromise(function(_0x5ef70b,_0x1d5b07){return client['request'](_0x3d4db3,_0x4e162f)[_0x27e5('0xd')](function(_0x122365){logger[_0x27e5('0xe')](_0x27e5('0xf'),_0x1226af,'request\x20sent');logger[_0x27e5('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1226af,_0x27e5('0x11'),JSON[_0x27e5('0x12')](_0x122365));if(_0x122365[_0x27e5('0x13')]){if(_0x122365[_0x27e5('0x13')][_0x27e5('0x14')]===0x1f4){logger['error'](_0x27e5('0xf'),_0x1226af,_0x122365[_0x27e5('0x13')]['message']);return _0x1d5b07(_0x122365[_0x27e5('0x13')][_0x27e5('0x15')]);}logger[_0x27e5('0x13')](_0x27e5('0xf'),_0x1226af,_0x122365[_0x27e5('0x13')][_0x27e5('0x15')]);return _0x5ef70b(_0x122365['error'][_0x27e5('0x15')]);}else{logger[_0x27e5('0xe')](_0x27e5('0xf'),_0x1226af,_0x27e5('0x11'));_0x5ef70b(_0x122365[_0x27e5('0x16')][_0x27e5('0x15')]);}})[_0x27e5('0x17')](function(_0x122e54){logger['error'](_0x27e5('0xf'),_0x1226af,_0x122e54);_0x1d5b07(_0x122e54);});});}exports['GetServicenowAccount']=function(_0x2ca427){var _0x3f2dbc=this;return new Promise(function(_0x115282,_0x11e142){return db[_0x27e5('0x18')]['findAll']({'raw':_0x2ca427[_0x27e5('0x19')]?_0x2ca427[_0x27e5('0x19')][_0x27e5('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ca427[_0x27e5('0x19')]?_0x2ca427['options'][_0x27e5('0x1b')]||null:null,'attributes':_0x2ca427[_0x27e5('0x19')]?_0x2ca427[_0x27e5('0x19')][_0x27e5('0x1c')]||null:null,'limit':_0x2ca427[_0x27e5('0x19')]?_0x2ca427['options']['limit']||null:null,'include':_0x2ca427[_0x27e5('0x19')]?_0x2ca427[_0x27e5('0x19')][_0x27e5('0x1d')]?_[_0x27e5('0x1e')](_0x2ca427['options'][_0x27e5('0x1d')],function(_0x31f858){return{'model':db[_0x31f858[_0x27e5('0x1f')]],'as':_0x31f858['as'],'attributes':_0x31f858[_0x27e5('0x1c')],'include':_0x31f858['include']?_['map'](_0x31f858[_0x27e5('0x1d')],function(_0x2d4ff2){return{'model':db[_0x2d4ff2[_0x27e5('0x1f')]],'as':_0x2d4ff2['as'],'attributes':_0x2d4ff2[_0x27e5('0x1c')],'include':_0x2d4ff2[_0x27e5('0x1d')]?_['map'](_0x2d4ff2[_0x27e5('0x1d')],function(_0x29a45f){return{'model':db[_0x29a45f['model']],'as':_0x29a45f['as'],'attributes':_0x29a45f[_0x27e5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x27e5('0xd')](function(_0x44513b){logger[_0x27e5('0xe')](_0x27e5('0x20'),_0x2ca427);logger[_0x27e5('0x10')](_0x27e5('0x20'),_0x2ca427,JSON[_0x27e5('0x12')](_0x44513b));_0x115282(_0x44513b);})[_0x27e5('0x17')](function(_0x17ba55){logger[_0x27e5('0x13')]('GetServicenowAccount',_0x17ba55[_0x27e5('0x15')],_0x2ca427);_0x11e142(_0x3f2dbc['error'](0x1f4,_0x17ba55['message']));});});};exports[_0x27e5('0x21')]=function(_0x35df24){var _0x21808b=this;return new Promise(function(_0x51aaa7,_0x292c65){return db[_0x27e5('0x18')]['find']({'raw':_0x35df24[_0x27e5('0x19')]?_0x35df24['options']['raw']===undefined?!![]:![]:!![],'where':_0x35df24[_0x27e5('0x19')]?_0x35df24[_0x27e5('0x19')][_0x27e5('0x1b')]||null:null,'attributes':_0x35df24['options']?_0x35df24[_0x27e5('0x19')]['attributes']||null:null,'include':_0x35df24[_0x27e5('0x19')]?_0x35df24[_0x27e5('0x19')][_0x27e5('0x1d')]?_[_0x27e5('0x1e')](_0x35df24['options'][_0x27e5('0x1d')],function(_0x102239){return{'model':db[_0x102239[_0x27e5('0x1f')]],'as':_0x102239['as'],'attributes':_0x102239['attributes'],'include':_0x102239[_0x27e5('0x1d')]?_[_0x27e5('0x1e')](_0x102239[_0x27e5('0x1d')],function(_0x381965){return{'model':db[_0x381965[_0x27e5('0x1f')]],'as':_0x381965['as'],'attributes':_0x381965[_0x27e5('0x1c')],'include':_0x381965[_0x27e5('0x1d')]?_[_0x27e5('0x1e')](_0x381965[_0x27e5('0x1d')],function(_0x5c3468){return{'model':db[_0x5c3468[_0x27e5('0x1f')]],'as':_0x5c3468['as'],'attributes':_0x5c3468[_0x27e5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x27e5('0xd')](function(_0x17fedb){logger['info'](_0x27e5('0x21'),_0x35df24);logger['debug']('ShowServicenowAccount',_0x35df24,JSON[_0x27e5('0x12')](_0x17fedb));_0x51aaa7(_0x17fedb);})[_0x27e5('0x17')](function(_0x2854c9){logger[_0x27e5('0x13')](_0x27e5('0x21'),_0x2854c9['message'],_0x35df24);_0x292c65(_0x21808b[_0x27e5('0x13')](0x1f4,_0x2854c9[_0x27e5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ce15b42..7aa682c 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 _0xa605=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','getFields'];(function(_0x17db14,_0x23bbf3){var _0x573e10=function(_0x1f34e8){while(--_0x1f34e8){_0x17db14['push'](_0x17db14['shift']());}};_0x573e10(++_0x23bbf3);}(_0xa605,0x6b));var _0x5a60=function(_0x15be47,_0x37f0ce){_0x15be47=_0x15be47-0x0;var _0x3afbb7=_0xa605[_0x15be47];return _0x3afbb7;};'use strict';var multer=require(_0x5a60('0x0'));var util=require(_0x5a60('0x1'));var path=require(_0x5a60('0x2'));var timeout=require('connect-timeout');var express=require(_0x5a60('0x3'));var router=express[_0x5a60('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5a60('0x5'));var interaction=require(_0x5a60('0x6'));var config=require(_0x5a60('0x7'));var controller=require(_0x5a60('0x8'));router['get']('/',auth[_0x5a60('0x9')](),controller[_0x5a60('0xa')]);router[_0x5a60('0xb')]('/:id',auth[_0x5a60('0x9')](),controller['show']);router[_0x5a60('0xb')]('/:id/fields',auth[_0x5a60('0x9')](),controller[_0x5a60('0xc')]);router[_0x5a60('0xb')](_0x5a60('0xd'),auth[_0x5a60('0x9')](),controller[_0x5a60('0xe')]);router[_0x5a60('0xb')](_0x5a60('0xf'),auth[_0x5a60('0x9')](),controller[_0x5a60('0x10')]);router[_0x5a60('0x11')]('/',auth[_0x5a60('0x9')](),controller['create']);router[_0x5a60('0x12')](_0x5a60('0x13'),auth[_0x5a60('0x9')](),controller[_0x5a60('0x14')]);router[_0x5a60('0x15')](_0x5a60('0x13'),auth[_0x5a60('0x9')](),controller[_0x5a60('0x16')]);module[_0x5a60('0x17')]=router; \ No newline at end of file +var _0xc3a3=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','destroy','multer'];(function(_0x1dbaf6,_0x12e972){var _0x473388=function(_0x43e3f2){while(--_0x43e3f2){_0x1dbaf6['push'](_0x1dbaf6['shift']());}};_0x473388(++_0x12e972);}(_0xc3a3,0xf1));var _0x3c3a=function(_0x5147e4,_0x19c576){_0x5147e4=_0x5147e4-0x0;var _0x1ea9e4=_0xc3a3[_0x5147e4];return _0x1ea9e4;};'use strict';var multer=require(_0x3c3a('0x0'));var util=require(_0x3c3a('0x1'));var path=require(_0x3c3a('0x2'));var timeout=require(_0x3c3a('0x3'));var express=require(_0x3c3a('0x4'));var router=express[_0x3c3a('0x5')]();var fs_extra=require(_0x3c3a('0x6'));var auth=require(_0x3c3a('0x7'));var interaction=require(_0x3c3a('0x8'));var config=require(_0x3c3a('0x9'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0x3c3a('0xa')](),controller[_0x3c3a('0xb')]);router[_0x3c3a('0xc')](_0x3c3a('0xd'),auth[_0x3c3a('0xa')](),controller['show']);router[_0x3c3a('0xc')](_0x3c3a('0xe'),auth[_0x3c3a('0xa')](),controller[_0x3c3a('0xf')]);router[_0x3c3a('0xc')](_0x3c3a('0x10'),auth[_0x3c3a('0xa')](),controller[_0x3c3a('0x11')]);router[_0x3c3a('0xc')](_0x3c3a('0x12'),auth[_0x3c3a('0xa')](),controller['getDescriptions']);router[_0x3c3a('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3c3a('0x14')](_0x3c3a('0xd'),auth[_0x3c3a('0xa')](),controller['update']);router['delete'](_0x3c3a('0xd'),auth[_0x3c3a('0xa')](),controller[_0x3c3a('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 55a47a0..91273b7 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 _0xd161=['STRING','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd161,0x109));var _0x1d16=function(_0x2534bd,_0x540bbd){_0x2534bd=_0x2534bd-0x0;var _0x3aa88a=_0xd161[_0x2534bd];return _0x3aa88a;};'use strict';var Sequelize=require(_0x1d16('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d16('0x1')]},'description':{'type':Sequelize[_0x1d16('0x1')]}}; \ No newline at end of file +var _0xb2d9=['sequelize','exports','STRING'];(function(_0x275293,_0x31bf61){var _0x539b28=function(_0x36e11c){while(--_0x36e11c){_0x275293['push'](_0x275293['shift']());}};_0x539b28(++_0x31bf61);}(_0xb2d9,0x1bf));var _0x9b2d=function(_0x2166a3,_0x237c50){_0x2166a3=_0x2166a3-0x0;var _0x260035=_0xb2d9[_0x2166a3];return _0x260035;};'use strict';var Sequelize=require(_0x9b2d('0x0'));module[_0x9b2d('0x1')]={'name':{'type':Sequelize[_0x9b2d('0x2')]},'description':{'type':Sequelize[_0x9b2d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 55d54a2..c8584d4 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 _0x25e4=['../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','index','map','ServicenowConfiguration','type','key','query','keys','filters','intersection','model','fields','attributes','length','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','create','body','find','params','findOne','ServicenowField','rawAttributes','order','hasOwnProperty','nolimit','getFields','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils'];(function(_0x1ea0a8,_0x4b3c5d){var _0x2018de=function(_0x22131a){while(--_0x22131a){_0x1ea0a8['push'](_0x1ea0a8['shift']());}};_0x2018de(++_0x4b3c5d);}(_0x25e4,0x172));var _0x425e=function(_0x415e4d,_0x1ffbd9){_0x415e4d=_0x415e4d-0x0;var _0x120789=_0x25e4[_0x415e4d];return _0x120789;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x425e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x425e('0x1'));var rp=require(_0x425e('0x2'));var moment=require(_0x425e('0x3'));var BPromise=require(_0x425e('0x4'));var Mustache=require(_0x425e('0x5'));var util=require(_0x425e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x425e('0x7'));var ejs=require(_0x425e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x425e('0x9'));var squel=require(_0x425e('0xa'));var crypto=require(_0x425e('0xb'));var jsforce=require(_0x425e('0xc'));var deskjs=require(_0x425e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x425e('0xe'));var Papa=require(_0x425e('0xf'));var Redis=require(_0x425e('0x10'));var authService=require(_0x425e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x425e('0x12'));var utils=require(_0x425e('0x13'));var config=require(_0x425e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x425e('0x15'))['db'];function respondWithStatusCode(_0x38dee0,_0x5c30d8){_0x5c30d8=_0x5c30d8||0xcc;return function(_0x782407){if(_0x782407){return _0x38dee0[_0x425e('0x16')](_0x5c30d8);}return _0x38dee0[_0x425e('0x17')](_0x5c30d8)[_0x425e('0x18')]();};}function respondWithResult(_0xb033f4,_0x52a3f3){_0x52a3f3=_0x52a3f3||0xc8;return function(_0x37eceb){if(_0x37eceb){return _0xb033f4[_0x425e('0x17')](_0x52a3f3)['json'](_0x37eceb);}};}function respondWithFilteredResult(_0x2a602c,_0x2d91e8){return function(_0x3bdec8){if(_0x3bdec8){var _0x23a019=typeof _0x2d91e8[_0x425e('0x19')]===_0x425e('0x1a')&&typeof _0x2d91e8['limit']===_0x425e('0x1a');var _0x4af6d6=_0x3bdec8[_0x425e('0x1b')];var _0x11cb4a=_0x23a019?0x0:_0x2d91e8['offset'];var _0x3ef674=_0x23a019?_0x3bdec8['count']:_0x2d91e8[_0x425e('0x19')]+_0x2d91e8['limit'];var _0x1254cf;if(_0x3ef674>=_0x4af6d6){_0x3ef674=_0x4af6d6;_0x1254cf=0xc8;}else{_0x1254cf=0xce;}_0x2a602c['status'](_0x1254cf);return _0x2a602c[_0x425e('0x1c')](_0x425e('0x1d'),_0x11cb4a+'-'+_0x3ef674+'/'+_0x4af6d6)[_0x425e('0x1e')](_0x3bdec8);}return null;};}function patchUpdates(_0x18050c){return function(_0x38c514){try{jsonpatch[_0x425e('0x1f')](_0x38c514,_0x18050c,!![]);}catch(_0x3ddc19){return BPromise['reject'](_0x3ddc19);}return _0x38c514[_0x425e('0x20')]();};}function saveUpdates(_0x14c662,_0x3b8f25){return function(_0x33a8e9){if(_0x33a8e9){return _0x33a8e9[_0x425e('0x21')](_0x14c662)[_0x425e('0x22')](function(_0x2ec24b){return _0x2ec24b;});}return null;};}function removeEntity(_0x155a9c,_0x3c84cc){return function(_0x20d75d){if(_0x20d75d){return _0x20d75d[_0x425e('0x23')]()['then'](function(){_0x155a9c[_0x425e('0x17')](0xcc)[_0x425e('0x18')]();});}};}function handleEntityNotFound(_0x37dff8,_0x5122d4){return function(_0x1adcab){if(!_0x1adcab){_0x37dff8[_0x425e('0x16')](0x194);}return _0x1adcab;};}function handleError(_0x52e5b7,_0x26896e){_0x26896e=_0x26896e||0x1f4;return function(_0x6704b3){logger[_0x425e('0x24')](_0x6704b3['stack']);if(_0x6704b3[_0x425e('0x25')]){delete _0x6704b3[_0x425e('0x25')];}_0x52e5b7[_0x425e('0x17')](_0x26896e)[_0x425e('0x26')](_0x6704b3);};}exports[_0x425e('0x27')]=function(_0x2978c9,_0xbd9f5d){var _0x553719={},_0x207f7d={},_0x1b46d3={'count':0x0,'rows':[]};var _0x607a65=_[_0x425e('0x28')](db[_0x425e('0x29')]['rawAttributes'],function(_0x3b6b51){return{'name':_0x3b6b51['fieldName'],'type':_0x3b6b51[_0x425e('0x2a')][_0x425e('0x2b')]};});_0x207f7d['model']=_[_0x425e('0x28')](_0x607a65,_0x425e('0x25'));_0x207f7d[_0x425e('0x2c')]=_[_0x425e('0x2d')](_0x2978c9[_0x425e('0x2c')]);_0x207f7d[_0x425e('0x2e')]=_[_0x425e('0x2f')](_0x207f7d[_0x425e('0x30')],_0x207f7d[_0x425e('0x2c')]);_0x553719['attributes']=_[_0x425e('0x2f')](_0x207f7d[_0x425e('0x30')],qs[_0x425e('0x31')](_0x2978c9['query']['fields']));_0x553719[_0x425e('0x32')]=_0x553719[_0x425e('0x32')][_0x425e('0x33')]?_0x553719[_0x425e('0x32')]:_0x207f7d[_0x425e('0x30')];if(!_0x2978c9[_0x425e('0x2c')]['hasOwnProperty']('nolimit')){_0x553719[_0x425e('0x34')]=qs[_0x425e('0x34')](_0x2978c9[_0x425e('0x2c')][_0x425e('0x34')]);_0x553719[_0x425e('0x19')]=qs[_0x425e('0x19')](_0x2978c9[_0x425e('0x2c')][_0x425e('0x19')]);}_0x553719['order']=qs[_0x425e('0x35')](_0x2978c9[_0x425e('0x2c')][_0x425e('0x35')]);_0x553719[_0x425e('0x36')]=qs[_0x425e('0x2e')](_[_0x425e('0x37')](_0x2978c9[_0x425e('0x2c')],_0x207f7d[_0x425e('0x2e')]),_0x607a65);if(_0x2978c9['query'][_0x425e('0x38')]){_0x553719[_0x425e('0x36')]=_[_0x425e('0x39')](_0x553719[_0x425e('0x36')],{'$or':_[_0x425e('0x28')](_0x607a65,function(_0x1986f7){if(_0x1986f7['type']!==_0x425e('0x3a')){var _0x1aa2d4={};_0x1aa2d4[_0x1986f7['name']]={'$like':'%'+_0x2978c9[_0x425e('0x2c')]['filter']+'%'};return _0x1aa2d4;}})});}_0x553719=_[_0x425e('0x39')]({},_0x553719,_0x2978c9[_0x425e('0x3b')]);var _0xeb4130={'where':_0x553719[_0x425e('0x36')]};return db[_0x425e('0x29')]['count'](_0xeb4130)[_0x425e('0x22')](function(_0x4a8b45){_0x1b46d3[_0x425e('0x1b')]=_0x4a8b45;if(_0x2978c9[_0x425e('0x2c')][_0x425e('0x3c')]){_0x553719[_0x425e('0x3d')]=[{'all':!![]}];}return db[_0x425e('0x29')][_0x425e('0x3e')](_0x553719);})[_0x425e('0x22')](function(_0x105046){_0x1b46d3['rows']=_0x105046;return _0x1b46d3;})[_0x425e('0x22')](respondWithFilteredResult(_0xbd9f5d,_0x553719))[_0x425e('0x3f')](handleError(_0xbd9f5d,null));};exports[_0x425e('0x40')]=function(_0x589b03,_0x3293c3){var _0x5d6f26={'raw':![],'where':{'id':_0x589b03['params']['id']}},_0x1e1eef={};_0x1e1eef['model']=_[_0x425e('0x2d')](db[_0x425e('0x29')]['rawAttributes']);_0x1e1eef[_0x425e('0x2c')]=_[_0x425e('0x2d')](_0x589b03[_0x425e('0x2c')]);_0x1e1eef[_0x425e('0x2e')]=_[_0x425e('0x2f')](_0x1e1eef[_0x425e('0x30')],_0x1e1eef[_0x425e('0x2c')]);_0x5d6f26[_0x425e('0x32')]=_[_0x425e('0x2f')](_0x1e1eef['model'],qs[_0x425e('0x31')](_0x589b03[_0x425e('0x2c')][_0x425e('0x31')]));_0x5d6f26[_0x425e('0x32')]=_0x5d6f26['attributes']['length']?_0x5d6f26[_0x425e('0x32')]:_0x1e1eef[_0x425e('0x30')];if(_0x589b03[_0x425e('0x2c')][_0x425e('0x3c')]){_0x5d6f26[_0x425e('0x3d')]=[{'all':!![]}];}_0x5d6f26=_[_0x425e('0x39')]({},_0x5d6f26,_0x589b03['options']);return db[_0x425e('0x29')]['find'](_0x5d6f26)['then'](handleEntityNotFound(_0x3293c3,null))['then'](respondWithResult(_0x3293c3,null))[_0x425e('0x3f')](handleError(_0x3293c3,null));};exports[_0x425e('0x41')]=function(_0x5ade67,_0x3a4b2b){return db[_0x425e('0x29')][_0x425e('0x41')](_0x5ade67['body'],{})[_0x425e('0x22')](respondWithResult(_0x3a4b2b,0xc9))[_0x425e('0x3f')](handleError(_0x3a4b2b,null));};exports[_0x425e('0x21')]=function(_0x3463c8,_0x52898b){if(_0x3463c8[_0x425e('0x42')]['id']){delete _0x3463c8[_0x425e('0x42')]['id'];}return db[_0x425e('0x29')][_0x425e('0x43')]({'where':{'id':_0x3463c8[_0x425e('0x44')]['id']}})[_0x425e('0x22')](handleEntityNotFound(_0x52898b,null))[_0x425e('0x22')](saveUpdates(_0x3463c8[_0x425e('0x42')],null))[_0x425e('0x22')](respondWithResult(_0x52898b,null))['catch'](handleError(_0x52898b,null));};exports['destroy']=function(_0x20d329,_0x472c33){return db[_0x425e('0x29')][_0x425e('0x43')]({'where':{'id':_0x20d329['params']['id']}})[_0x425e('0x22')](handleEntityNotFound(_0x472c33,null))['then'](removeEntity(_0x472c33,null))[_0x425e('0x3f')](handleError(_0x472c33,null));};exports['getFields']=function(_0x2d5a16,_0x46db89,_0x335000){var _0x1e201d={};var _0x516392={};var _0x4207ca;var _0x4bd6b5;return db[_0x425e('0x29')][_0x425e('0x45')]({'where':{'id':_0x2d5a16[_0x425e('0x44')]['id']}})[_0x425e('0x22')](handleEntityNotFound(_0x46db89,null))[_0x425e('0x22')](function(_0xc21779){if(_0xc21779){_0x4207ca=_0xc21779;_0x516392[_0x425e('0x30')]=_[_0x425e('0x2d')](db[_0x425e('0x46')][_0x425e('0x47')]);_0x516392[_0x425e('0x2c')]=_['keys'](_0x2d5a16[_0x425e('0x2c')]);_0x516392[_0x425e('0x2e')]=_[_0x425e('0x2f')](_0x516392[_0x425e('0x30')],_0x516392[_0x425e('0x2c')]);_0x1e201d[_0x425e('0x32')]=_[_0x425e('0x2f')](_0x516392[_0x425e('0x30')],qs['fields'](_0x2d5a16[_0x425e('0x2c')][_0x425e('0x31')]));_0x1e201d[_0x425e('0x32')]=_0x1e201d[_0x425e('0x32')][_0x425e('0x33')]?_0x1e201d['attributes']:_0x516392[_0x425e('0x30')];_0x1e201d[_0x425e('0x48')]=qs[_0x425e('0x35')](_0x2d5a16[_0x425e('0x2c')][_0x425e('0x35')]);_0x1e201d['where']=qs[_0x425e('0x2e')](_[_0x425e('0x37')](_0x2d5a16[_0x425e('0x2c')],_0x516392[_0x425e('0x2e')]));if(_0x2d5a16['query'][_0x425e('0x38')]){_0x1e201d[_0x425e('0x36')]=_[_0x425e('0x39')](_0x1e201d['where'],{'$or':_[_0x425e('0x28')](_0x1e201d[_0x425e('0x32')],function(_0x2b863e){var _0xcb0d08={};_0xcb0d08[_0x2b863e]={'$like':'%'+_0x2d5a16[_0x425e('0x2c')][_0x425e('0x38')]+'%'};return _0xcb0d08;})});}_0x1e201d=_[_0x425e('0x39')]({},_0x1e201d,_0x2d5a16[_0x425e('0x3b')]);return _0x4207ca['getFields'](_0x1e201d);}})[_0x425e('0x22')](function(_0x13c097){if(_0x13c097){_0x4bd6b5=_0x13c097[_0x425e('0x33')];if(!_0x2d5a16[_0x425e('0x2c')][_0x425e('0x49')](_0x425e('0x4a'))){_0x1e201d['limit']=qs[_0x425e('0x34')](_0x2d5a16['query'][_0x425e('0x34')]);_0x1e201d[_0x425e('0x19')]=qs[_0x425e('0x19')](_0x2d5a16[_0x425e('0x2c')][_0x425e('0x19')]);}return _0x4207ca[_0x425e('0x4b')](_0x1e201d);}})[_0x425e('0x22')](function(_0x322dbc){if(_0x322dbc){return _0x322dbc?{'count':_0x4bd6b5,'rows':_0x322dbc}:null;}})[_0x425e('0x22')](respondWithResult(_0x46db89,null))[_0x425e('0x3f')](handleError(_0x46db89,null));};exports[_0x425e('0x4c')]=function(_0x45861a,_0x131c40,_0x4e0e98){var _0x3ae5da={};var _0x1fa255={};var _0x84be3d;var _0x35ab1a;return db[_0x425e('0x29')][_0x425e('0x45')]({'where':{'id':_0x45861a['params']['id']}})[_0x425e('0x22')](handleEntityNotFound(_0x131c40,null))[_0x425e('0x22')](function(_0x3d6b80){if(_0x3d6b80){_0x84be3d=_0x3d6b80;_0x1fa255[_0x425e('0x30')]=_[_0x425e('0x2d')](db[_0x425e('0x46')][_0x425e('0x47')]);_0x1fa255[_0x425e('0x2c')]=_[_0x425e('0x2d')](_0x45861a[_0x425e('0x2c')]);_0x1fa255[_0x425e('0x2e')]=_['intersection'](_0x1fa255[_0x425e('0x30')],_0x1fa255['query']);_0x3ae5da[_0x425e('0x32')]=_[_0x425e('0x2f')](_0x1fa255['model'],qs[_0x425e('0x31')](_0x45861a['query'][_0x425e('0x31')]));_0x3ae5da[_0x425e('0x32')]=_0x3ae5da[_0x425e('0x32')]['length']?_0x3ae5da[_0x425e('0x32')]:_0x1fa255[_0x425e('0x30')];_0x3ae5da[_0x425e('0x48')]=qs[_0x425e('0x35')](_0x45861a[_0x425e('0x2c')][_0x425e('0x35')]);_0x3ae5da[_0x425e('0x36')]=qs[_0x425e('0x2e')](_[_0x425e('0x37')](_0x45861a['query'],_0x1fa255[_0x425e('0x2e')]));if(_0x45861a[_0x425e('0x2c')][_0x425e('0x38')]){_0x3ae5da[_0x425e('0x36')]=_[_0x425e('0x39')](_0x3ae5da[_0x425e('0x36')],{'$or':_['map'](_0x3ae5da[_0x425e('0x32')],function(_0x3a25f2){var _0x1a83d2={};_0x1a83d2[_0x3a25f2]={'$like':'%'+_0x45861a[_0x425e('0x2c')]['filter']+'%'};return _0x1a83d2;})});}_0x3ae5da=_[_0x425e('0x39')]({},_0x3ae5da,_0x45861a['options']);return _0x84be3d[_0x425e('0x4c')](_0x3ae5da);}})[_0x425e('0x22')](function(_0xcdb3b1){if(_0xcdb3b1){_0x35ab1a=_0xcdb3b1[_0x425e('0x33')];if(!_0x45861a[_0x425e('0x2c')][_0x425e('0x49')](_0x425e('0x4a'))){_0x3ae5da[_0x425e('0x34')]=qs[_0x425e('0x34')](_0x45861a[_0x425e('0x2c')]['limit']);_0x3ae5da['offset']=qs[_0x425e('0x19')](_0x45861a[_0x425e('0x2c')][_0x425e('0x19')]);}return _0x84be3d[_0x425e('0x4c')](_0x3ae5da);}})[_0x425e('0x22')](function(_0x3f42d7){if(_0x3f42d7){return _0x3f42d7?{'count':_0x35ab1a,'rows':_0x3f42d7}:null;}})[_0x425e('0x22')](respondWithResult(_0x131c40,null))['catch'](handleError(_0x131c40,null));};exports[_0x425e('0x4d')]=function(_0x12514a,_0x42194a,_0x19d634){var _0x3fef1e={};var _0x4e6db4={};var _0x86c20f;var _0x31b872;return db['ServicenowConfiguration'][_0x425e('0x45')]({'where':{'id':_0x12514a[_0x425e('0x44')]['id']}})[_0x425e('0x22')](handleEntityNotFound(_0x42194a,null))[_0x425e('0x22')](function(_0x3e13a8){if(_0x3e13a8){_0x86c20f=_0x3e13a8;_0x4e6db4['model']=_[_0x425e('0x2d')](db['ServicenowField'][_0x425e('0x47')]);_0x4e6db4['query']=_['keys'](_0x12514a[_0x425e('0x2c')]);_0x4e6db4['filters']=_[_0x425e('0x2f')](_0x4e6db4[_0x425e('0x30')],_0x4e6db4[_0x425e('0x2c')]);_0x3fef1e['attributes']=_['intersection'](_0x4e6db4[_0x425e('0x30')],qs['fields'](_0x12514a[_0x425e('0x2c')][_0x425e('0x31')]));_0x3fef1e['attributes']=_0x3fef1e['attributes'][_0x425e('0x33')]?_0x3fef1e[_0x425e('0x32')]:_0x4e6db4['model'];_0x3fef1e['order']=qs[_0x425e('0x35')](_0x12514a[_0x425e('0x2c')]['sort']);_0x3fef1e[_0x425e('0x36')]=qs[_0x425e('0x2e')](_[_0x425e('0x37')](_0x12514a[_0x425e('0x2c')],_0x4e6db4[_0x425e('0x2e')]));if(_0x12514a[_0x425e('0x2c')]['filter']){_0x3fef1e[_0x425e('0x36')]=_['merge'](_0x3fef1e['where'],{'$or':_[_0x425e('0x28')](_0x3fef1e[_0x425e('0x32')],function(_0x22a19a){var _0x56ef74={};_0x56ef74[_0x22a19a]={'$like':'%'+_0x12514a[_0x425e('0x2c')][_0x425e('0x38')]+'%'};return _0x56ef74;})});}_0x3fef1e=_[_0x425e('0x39')]({},_0x3fef1e,_0x12514a[_0x425e('0x3b')]);return _0x86c20f[_0x425e('0x4d')](_0x3fef1e);}})[_0x425e('0x22')](function(_0x3fc4a0){if(_0x3fc4a0){_0x31b872=_0x3fc4a0[_0x425e('0x33')];if(!_0x12514a[_0x425e('0x2c')][_0x425e('0x49')](_0x425e('0x4a'))){_0x3fef1e[_0x425e('0x34')]=qs['limit'](_0x12514a[_0x425e('0x2c')]['limit']);_0x3fef1e[_0x425e('0x19')]=qs[_0x425e('0x19')](_0x12514a[_0x425e('0x2c')][_0x425e('0x19')]);}return _0x86c20f[_0x425e('0x4d')](_0x3fef1e);}})[_0x425e('0x22')](function(_0x48b9d9){if(_0x48b9d9){return _0x48b9d9?{'count':_0x31b872,'rows':_0x48b9d9}:null;}})[_0x425e('0x22')](respondWithResult(_0x42194a,null))[_0x425e('0x3f')](handleError(_0x42194a,null));}; \ No newline at end of file +var _0x4816=['ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','ServicenowConfiguration','rawAttributes','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','include','findAll','rows','catch','params','keys','fields','merge','create','body','find','ServicenowField','options','getFields','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x567af1,_0x570605){var _0xecfefb=function(_0x3352a0){while(--_0x3352a0){_0x567af1['push'](_0x567af1['shift']());}};_0xecfefb(++_0x570605);}(_0x4816,0x95));var _0x6481=function(_0x2399ec,_0x22b88c){_0x2399ec=_0x2399ec-0x0;var _0x5159a2=_0x4816[_0x2399ec];return _0x5159a2;};'use strict';var emlformat=require(_0x6481('0x0'));var rimraf=require(_0x6481('0x1'));var zipdir=require(_0x6481('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6481('0x3'));var moment=require(_0x6481('0x4'));var BPromise=require(_0x6481('0x5'));var Mustache=require(_0x6481('0x6'));var util=require(_0x6481('0x7'));var path=require(_0x6481('0x8'));var sox=require(_0x6481('0x9'));var csv=require(_0x6481('0xa'));var ejs=require(_0x6481('0xb'));var fs=require('fs');var fs_extra=require(_0x6481('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6481('0xd'));var jsforce=require(_0x6481('0xe'));var deskjs=require(_0x6481('0xf'));var toCsv=require(_0x6481('0xa'));var querystring=require(_0x6481('0x10'));var Papa=require(_0x6481('0x11'));var Redis=require(_0x6481('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6481('0x13'));var as=require(_0x6481('0x14'));var hardwareService=require(_0x6481('0x15'));var logger=require(_0x6481('0x16'))(_0x6481('0x17'));var utils=require(_0x6481('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6481('0x19'))['db'];function respondWithStatusCode(_0x37119a,_0x5a20ce){_0x5a20ce=_0x5a20ce||0xcc;return function(_0x3e553d){if(_0x3e553d){return _0x37119a[_0x6481('0x1a')](_0x5a20ce);}return _0x37119a[_0x6481('0x1b')](_0x5a20ce)[_0x6481('0x1c')]();};}function respondWithResult(_0x43b388,_0x358211){_0x358211=_0x358211||0xc8;return function(_0x386766){if(_0x386766){return _0x43b388[_0x6481('0x1b')](_0x358211)[_0x6481('0x1d')](_0x386766);}};}function respondWithFilteredResult(_0x3ef26c,_0x341098){return function(_0x10d236){if(_0x10d236){var _0x5361be=typeof _0x341098[_0x6481('0x1e')]===_0x6481('0x1f')&&typeof _0x341098[_0x6481('0x20')]===_0x6481('0x1f');var _0x20eafa=_0x10d236[_0x6481('0x21')];var _0x1e559a=_0x5361be?0x0:_0x341098[_0x6481('0x1e')];var _0x395e73=_0x5361be?_0x10d236[_0x6481('0x21')]:_0x341098[_0x6481('0x1e')]+_0x341098[_0x6481('0x20')];var _0x2affbe;if(_0x395e73>=_0x20eafa){_0x395e73=_0x20eafa;_0x2affbe=0xc8;}else{_0x2affbe=0xce;}_0x3ef26c['status'](_0x2affbe);return _0x3ef26c[_0x6481('0x22')](_0x6481('0x23'),_0x1e559a+'-'+_0x395e73+'/'+_0x20eafa)[_0x6481('0x1d')](_0x10d236);}return null;};}function patchUpdates(_0x5bd858){return function(_0x57ebb9){try{jsonpatch[_0x6481('0x24')](_0x57ebb9,_0x5bd858,!![]);}catch(_0x52f425){return BPromise[_0x6481('0x25')](_0x52f425);}return _0x57ebb9['save']();};}function saveUpdates(_0x140b30,_0x5ae405){return function(_0x597c10){if(_0x597c10){return _0x597c10[_0x6481('0x26')](_0x140b30)[_0x6481('0x27')](function(_0x2ea0bf){return _0x2ea0bf;});}return null;};}function removeEntity(_0x2f2735,_0x2bbcd3){return function(_0x37b532){if(_0x37b532){return _0x37b532[_0x6481('0x28')]()[_0x6481('0x27')](function(){_0x2f2735[_0x6481('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3debcb,_0xfa07ad){return function(_0x271b65){if(!_0x271b65){_0x3debcb[_0x6481('0x1a')](0x194);}return _0x271b65;};}function handleError(_0x347e3f,_0x253906){_0x253906=_0x253906||0x1f4;return function(_0x44386f){logger['error'](_0x44386f['stack']);if(_0x44386f['name']){delete _0x44386f[_0x6481('0x29')];}_0x347e3f[_0x6481('0x1b')](_0x253906)[_0x6481('0x2a')](_0x44386f);};}exports[_0x6481('0x2b')]=function(_0x2d60e3,_0x5c2adb){var _0x25b90e={},_0xb5dfbf={},_0x2b0d4a={'count':0x0,'rows':[]};var _0x214f05=_['map'](db[_0x6481('0x2c')][_0x6481('0x2d')],function(_0x4df16d){return{'name':_0x4df16d['fieldName'],'type':_0x4df16d['type'][_0x6481('0x2e')]};});_0xb5dfbf[_0x6481('0x2f')]=_[_0x6481('0x30')](_0x214f05,_0x6481('0x29'));_0xb5dfbf[_0x6481('0x31')]=_['keys'](_0x2d60e3[_0x6481('0x31')]);_0xb5dfbf[_0x6481('0x32')]=_[_0x6481('0x33')](_0xb5dfbf[_0x6481('0x2f')],_0xb5dfbf[_0x6481('0x31')]);_0x25b90e[_0x6481('0x34')]=_[_0x6481('0x33')](_0xb5dfbf[_0x6481('0x2f')],qs['fields'](_0x2d60e3['query']['fields']));_0x25b90e[_0x6481('0x34')]=_0x25b90e[_0x6481('0x34')][_0x6481('0x35')]?_0x25b90e[_0x6481('0x34')]:_0xb5dfbf['model'];if(!_0x2d60e3[_0x6481('0x31')][_0x6481('0x36')](_0x6481('0x37'))){_0x25b90e[_0x6481('0x20')]=qs[_0x6481('0x20')](_0x2d60e3['query']['limit']);_0x25b90e[_0x6481('0x1e')]=qs[_0x6481('0x1e')](_0x2d60e3['query']['offset']);}_0x25b90e[_0x6481('0x38')]=qs[_0x6481('0x39')](_0x2d60e3[_0x6481('0x31')][_0x6481('0x39')]);_0x25b90e['where']=qs[_0x6481('0x32')](_[_0x6481('0x3a')](_0x2d60e3['query'],_0xb5dfbf[_0x6481('0x32')]),_0x214f05);if(_0x2d60e3['query'][_0x6481('0x3b')]){_0x25b90e[_0x6481('0x3c')]=_['merge'](_0x25b90e[_0x6481('0x3c')],{'$or':_[_0x6481('0x30')](_0x214f05,function(_0x198a85){if(_0x198a85[_0x6481('0x3d')]!==_0x6481('0x3e')){var _0xe6be11={};_0xe6be11[_0x198a85[_0x6481('0x29')]]={'$like':'%'+_0x2d60e3[_0x6481('0x31')][_0x6481('0x3b')]+'%'};return _0xe6be11;}})});}_0x25b90e=_['merge']({},_0x25b90e,_0x2d60e3['options']);var _0x310585={'where':_0x25b90e[_0x6481('0x3c')]};return db[_0x6481('0x2c')][_0x6481('0x21')](_0x310585)[_0x6481('0x27')](function(_0x501990){_0x2b0d4a['count']=_0x501990;if(_0x2d60e3[_0x6481('0x31')]['includeAll']){_0x25b90e[_0x6481('0x3f')]=[{'all':!![]}];}return db[_0x6481('0x2c')][_0x6481('0x40')](_0x25b90e);})[_0x6481('0x27')](function(_0x5b1ea0){_0x2b0d4a[_0x6481('0x41')]=_0x5b1ea0;return _0x2b0d4a;})[_0x6481('0x27')](respondWithFilteredResult(_0x5c2adb,_0x25b90e))[_0x6481('0x42')](handleError(_0x5c2adb,null));};exports['show']=function(_0x5cc4d3,_0x1f31aa){var _0x224915={'raw':![],'where':{'id':_0x5cc4d3[_0x6481('0x43')]['id']}},_0x2e4f89={};_0x2e4f89['model']=_[_0x6481('0x44')](db[_0x6481('0x2c')][_0x6481('0x2d')]);_0x2e4f89['query']=_['keys'](_0x5cc4d3[_0x6481('0x31')]);_0x2e4f89[_0x6481('0x32')]=_[_0x6481('0x33')](_0x2e4f89['model'],_0x2e4f89['query']);_0x224915['attributes']=_[_0x6481('0x33')](_0x2e4f89[_0x6481('0x2f')],qs['fields'](_0x5cc4d3['query'][_0x6481('0x45')]));_0x224915[_0x6481('0x34')]=_0x224915[_0x6481('0x34')]['length']?_0x224915[_0x6481('0x34')]:_0x2e4f89[_0x6481('0x2f')];if(_0x5cc4d3['query']['includeAll']){_0x224915[_0x6481('0x3f')]=[{'all':!![]}];}_0x224915=_[_0x6481('0x46')]({},_0x224915,_0x5cc4d3['options']);return db['ServicenowConfiguration']['find'](_0x224915)[_0x6481('0x27')](handleEntityNotFound(_0x1f31aa,null))[_0x6481('0x27')](respondWithResult(_0x1f31aa,null))[_0x6481('0x42')](handleError(_0x1f31aa,null));};exports['create']=function(_0x4cd406,_0x243e5d){return db[_0x6481('0x2c')][_0x6481('0x47')](_0x4cd406['body'],{})[_0x6481('0x27')](respondWithResult(_0x243e5d,0xc9))['catch'](handleError(_0x243e5d,null));};exports['update']=function(_0x411cab,_0x4b5821){if(_0x411cab['body']['id']){delete _0x411cab[_0x6481('0x48')]['id'];}return db[_0x6481('0x2c')][_0x6481('0x49')]({'where':{'id':_0x411cab[_0x6481('0x43')]['id']}})[_0x6481('0x27')](handleEntityNotFound(_0x4b5821,null))[_0x6481('0x27')](saveUpdates(_0x411cab['body'],null))[_0x6481('0x27')](respondWithResult(_0x4b5821,null))['catch'](handleError(_0x4b5821,null));};exports[_0x6481('0x28')]=function(_0x5a16fe,_0x4392d2){return db[_0x6481('0x2c')]['find']({'where':{'id':_0x5a16fe[_0x6481('0x43')]['id']}})[_0x6481('0x27')](handleEntityNotFound(_0x4392d2,null))[_0x6481('0x27')](removeEntity(_0x4392d2,null))[_0x6481('0x42')](handleError(_0x4392d2,null));};exports['getFields']=function(_0x36b9d1,_0x5d07e5,_0x8d7916){var _0x316055={};var _0x47aa91={};var _0x4cedfd;var _0x40cace;return db[_0x6481('0x2c')]['findOne']({'where':{'id':_0x36b9d1[_0x6481('0x43')]['id']}})[_0x6481('0x27')](handleEntityNotFound(_0x5d07e5,null))['then'](function(_0x2b0a88){if(_0x2b0a88){_0x4cedfd=_0x2b0a88;_0x47aa91[_0x6481('0x2f')]=_[_0x6481('0x44')](db[_0x6481('0x4a')][_0x6481('0x2d')]);_0x47aa91[_0x6481('0x31')]=_[_0x6481('0x44')](_0x36b9d1['query']);_0x47aa91[_0x6481('0x32')]=_[_0x6481('0x33')](_0x47aa91['model'],_0x47aa91[_0x6481('0x31')]);_0x316055[_0x6481('0x34')]=_[_0x6481('0x33')](_0x47aa91[_0x6481('0x2f')],qs[_0x6481('0x45')](_0x36b9d1['query']['fields']));_0x316055[_0x6481('0x34')]=_0x316055[_0x6481('0x34')]['length']?_0x316055[_0x6481('0x34')]:_0x47aa91[_0x6481('0x2f')];_0x316055['order']=qs['sort'](_0x36b9d1[_0x6481('0x31')]['sort']);_0x316055['where']=qs[_0x6481('0x32')](_['pick'](_0x36b9d1[_0x6481('0x31')],_0x47aa91['filters']));if(_0x36b9d1[_0x6481('0x31')][_0x6481('0x3b')]){_0x316055[_0x6481('0x3c')]=_[_0x6481('0x46')](_0x316055['where'],{'$or':_[_0x6481('0x30')](_0x316055[_0x6481('0x34')],function(_0x23121a){var _0x182dc8={};_0x182dc8[_0x23121a]={'$like':'%'+_0x36b9d1[_0x6481('0x31')][_0x6481('0x3b')]+'%'};return _0x182dc8;})});}_0x316055=_['merge']({},_0x316055,_0x36b9d1[_0x6481('0x4b')]);return _0x4cedfd[_0x6481('0x4c')](_0x316055);}})[_0x6481('0x27')](function(_0x79697){if(_0x79697){_0x40cace=_0x79697[_0x6481('0x35')];if(!_0x36b9d1[_0x6481('0x31')][_0x6481('0x36')](_0x6481('0x37'))){_0x316055[_0x6481('0x20')]=qs[_0x6481('0x20')](_0x36b9d1[_0x6481('0x31')][_0x6481('0x20')]);_0x316055[_0x6481('0x1e')]=qs[_0x6481('0x1e')](_0x36b9d1[_0x6481('0x31')][_0x6481('0x1e')]);}return _0x4cedfd[_0x6481('0x4c')](_0x316055);}})['then'](function(_0x1abdb6){if(_0x1abdb6){return _0x1abdb6?{'count':_0x40cace,'rows':_0x1abdb6}:null;}})[_0x6481('0x27')](respondWithResult(_0x5d07e5,null))[_0x6481('0x42')](handleError(_0x5d07e5,null));};exports['getSubjects']=function(_0x315669,_0x471300,_0x37cb87){var _0xd78697={};var _0x84e1e4={};var _0x2723e1;var _0xec943a;return db['ServicenowConfiguration'][_0x6481('0x4d')]({'where':{'id':_0x315669['params']['id']}})[_0x6481('0x27')](handleEntityNotFound(_0x471300,null))[_0x6481('0x27')](function(_0x175f7c){if(_0x175f7c){_0x2723e1=_0x175f7c;_0x84e1e4[_0x6481('0x2f')]=_[_0x6481('0x44')](db[_0x6481('0x4a')][_0x6481('0x2d')]);_0x84e1e4[_0x6481('0x31')]=_['keys'](_0x315669[_0x6481('0x31')]);_0x84e1e4[_0x6481('0x32')]=_[_0x6481('0x33')](_0x84e1e4[_0x6481('0x2f')],_0x84e1e4['query']);_0xd78697[_0x6481('0x34')]=_[_0x6481('0x33')](_0x84e1e4[_0x6481('0x2f')],qs[_0x6481('0x45')](_0x315669[_0x6481('0x31')][_0x6481('0x45')]));_0xd78697[_0x6481('0x34')]=_0xd78697[_0x6481('0x34')][_0x6481('0x35')]?_0xd78697['attributes']:_0x84e1e4[_0x6481('0x2f')];_0xd78697[_0x6481('0x38')]=qs['sort'](_0x315669[_0x6481('0x31')][_0x6481('0x39')]);_0xd78697[_0x6481('0x3c')]=qs['filters'](_[_0x6481('0x3a')](_0x315669[_0x6481('0x31')],_0x84e1e4[_0x6481('0x32')]));if(_0x315669[_0x6481('0x31')][_0x6481('0x3b')]){_0xd78697[_0x6481('0x3c')]=_[_0x6481('0x46')](_0xd78697['where'],{'$or':_[_0x6481('0x30')](_0xd78697[_0x6481('0x34')],function(_0x4474a8){var _0x48dff4={};_0x48dff4[_0x4474a8]={'$like':'%'+_0x315669[_0x6481('0x31')]['filter']+'%'};return _0x48dff4;})});}_0xd78697=_['merge']({},_0xd78697,_0x315669['options']);return _0x2723e1['getSubjects'](_0xd78697);}})['then'](function(_0x3d33f6){if(_0x3d33f6){_0xec943a=_0x3d33f6[_0x6481('0x35')];if(!_0x315669[_0x6481('0x31')][_0x6481('0x36')](_0x6481('0x37'))){_0xd78697[_0x6481('0x20')]=qs['limit'](_0x315669[_0x6481('0x31')]['limit']);_0xd78697['offset']=qs['offset'](_0x315669[_0x6481('0x31')][_0x6481('0x1e')]);}return _0x2723e1[_0x6481('0x4e')](_0xd78697);}})['then'](function(_0x192646){if(_0x192646){return _0x192646?{'count':_0xec943a,'rows':_0x192646}:null;}})['then'](respondWithResult(_0x471300,null))['catch'](handleError(_0x471300,null));};exports[_0x6481('0x4f')]=function(_0x330f11,_0x2f3787,_0x509999){var _0x1dff31={};var _0x51cf96={};var _0x3dcd1d;var _0x57b197;return db[_0x6481('0x2c')][_0x6481('0x4d')]({'where':{'id':_0x330f11['params']['id']}})[_0x6481('0x27')](handleEntityNotFound(_0x2f3787,null))[_0x6481('0x27')](function(_0x376db6){if(_0x376db6){_0x3dcd1d=_0x376db6;_0x51cf96[_0x6481('0x2f')]=_['keys'](db[_0x6481('0x4a')][_0x6481('0x2d')]);_0x51cf96['query']=_[_0x6481('0x44')](_0x330f11['query']);_0x51cf96[_0x6481('0x32')]=_[_0x6481('0x33')](_0x51cf96[_0x6481('0x2f')],_0x51cf96[_0x6481('0x31')]);_0x1dff31[_0x6481('0x34')]=_['intersection'](_0x51cf96[_0x6481('0x2f')],qs['fields'](_0x330f11[_0x6481('0x31')][_0x6481('0x45')]));_0x1dff31[_0x6481('0x34')]=_0x1dff31['attributes'][_0x6481('0x35')]?_0x1dff31[_0x6481('0x34')]:_0x51cf96['model'];_0x1dff31['order']=qs[_0x6481('0x39')](_0x330f11[_0x6481('0x31')][_0x6481('0x39')]);_0x1dff31['where']=qs[_0x6481('0x32')](_[_0x6481('0x3a')](_0x330f11[_0x6481('0x31')],_0x51cf96['filters']));if(_0x330f11[_0x6481('0x31')][_0x6481('0x3b')]){_0x1dff31[_0x6481('0x3c')]=_[_0x6481('0x46')](_0x1dff31[_0x6481('0x3c')],{'$or':_[_0x6481('0x30')](_0x1dff31[_0x6481('0x34')],function(_0x299e1e){var _0x30bc89={};_0x30bc89[_0x299e1e]={'$like':'%'+_0x330f11[_0x6481('0x31')][_0x6481('0x3b')]+'%'};return _0x30bc89;})});}_0x1dff31=_[_0x6481('0x46')]({},_0x1dff31,_0x330f11[_0x6481('0x4b')]);return _0x3dcd1d['getDescriptions'](_0x1dff31);}})[_0x6481('0x27')](function(_0x542a20){if(_0x542a20){_0x57b197=_0x542a20['length'];if(!_0x330f11['query'][_0x6481('0x36')](_0x6481('0x37'))){_0x1dff31['limit']=qs[_0x6481('0x20')](_0x330f11['query']['limit']);_0x1dff31[_0x6481('0x1e')]=qs[_0x6481('0x1e')](_0x330f11[_0x6481('0x31')][_0x6481('0x1e')]);}return _0x3dcd1d[_0x6481('0x4f')](_0x1dff31);}})['then'](function(_0x5c2aea){if(_0x5c2aea){return _0x5c2aea?{'count':_0x57b197,'rows':_0x5c2aea}:null;}})[_0x6481('0x27')](respondWithResult(_0x2f3787,null))[_0x6481('0x42')](handleError(_0x2f3787,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 99cba69..b4a9124 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 _0x8603=['util','../../config/logger','api','request-promise','path','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x249b69,_0x31ff67){var _0x3476a=function(_0x60184){while(--_0x60184){_0x249b69['push'](_0x249b69['shift']());}};_0x3476a(++_0x31ff67);}(_0x8603,0x190));var _0x3860=function(_0x145912,_0x2a7df5){_0x145912=_0x145912-0x0;var _0x5c8d6b=_0x8603[_0x145912];return _0x5c8d6b;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var fs=require('fs');var path=require(_0x3860('0x4'));var rimraf=require(_0x3860('0x5'));var config=require('../../config/environment');var attributes=require(_0x3860('0x6'));module['exports']=function(_0xb0fc24,_0x40739b){return _0xb0fc24[_0x3860('0x7')](_0x3860('0x8'),attributes,{'tableName':_0x3860('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa49b=['moment','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util','../../config/logger','api'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa49b,0x126));var _0xba49=function(_0x98a39e,_0x4ad8b4){_0x98a39e=_0x98a39e-0x0;var _0x28c926=_0xa49b[_0x98a39e];return _0x28c926;};'use strict';var _=require('lodash');var util=require(_0xba49('0x0'));var logger=require(_0xba49('0x1'))(_0xba49('0x2'));var moment=require(_0xba49('0x3'));var BPromise=require('bluebird');var rp=require(_0xba49('0x4'));var fs=require('fs');var path=require(_0xba49('0x5'));var rimraf=require(_0xba49('0x6'));var config=require('../../config/environment');var attributes=require(_0xba49('0x7'));module[_0xba49('0x8')]=function(_0x3315bc,_0x525dfd){return _0x3315bc[_0xba49('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0xba49('0xa'),'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 afc0c2e..8522553 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 _0xc191=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x4caca2,_0x4126e9){var _0x396283=function(_0x442743){while(--_0x442743){_0x4caca2['push'](_0x4caca2['shift']());}};_0x396283(++_0x4126e9);}(_0xc191,0xa0));var _0x1c19=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xc191[_0x648163];return _0x199d4d;};'use strict';var _=require(_0x1c19('0x0'));var util=require(_0x1c19('0x1'));var moment=require(_0x1c19('0x2'));var BPromise=require(_0x1c19('0x3'));var rs=require(_0x1c19('0x4'));var fs=require('fs');var Redis=require(_0x1c19('0x5'));var db=require(_0x1c19('0x6'))['db'];var utils=require(_0x1c19('0x7'));var logger=require(_0x1c19('0x8'))(_0x1c19('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff016,_0x2ca04a,_0x2eba75){return new BPromise(function(_0x3e5251,_0xca71cc){return client[_0x1c19('0xa')](_0x4ff016,_0x2eba75)['then'](function(_0x260518){logger['info'](_0x1c19('0xb'),_0x2ca04a,_0x1c19('0xc'));logger[_0x1c19('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x2ca04a,_0x1c19('0xc'),JSON[_0x1c19('0xe')](_0x260518));if(_0x260518['error']){if(_0x260518[_0x1c19('0xf')][_0x1c19('0x10')]===0x1f4){logger[_0x1c19('0xf')](_0x1c19('0xb'),_0x2ca04a,_0x260518[_0x1c19('0xf')]['message']);return _0xca71cc(_0x260518[_0x1c19('0xf')][_0x1c19('0x11')]);}logger[_0x1c19('0xf')](_0x1c19('0xb'),_0x2ca04a,_0x260518['error'][_0x1c19('0x11')]);return _0x3e5251(_0x260518['error'][_0x1c19('0x11')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x2ca04a,'request\x20sent');_0x3e5251(_0x260518[_0x1c19('0x12')][_0x1c19('0x11')]);}})[_0x1c19('0x13')](function(_0x148c00){logger[_0x1c19('0xf')](_0x1c19('0xb'),_0x2ca04a,_0x148c00);_0xca71cc(_0x148c00);});});} \ No newline at end of file +var _0x9983=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2ff780,_0x175c67){var _0x265448=function(_0x31ba30){while(--_0x31ba30){_0x2ff780['push'](_0x2ff780['shift']());}};_0x265448(++_0x175c67);}(_0x9983,0x159));var _0x3998=function(_0x593728,_0x3c0052){_0x593728=_0x593728-0x0;var _0x104436=_0x9983[_0x593728];return _0x104436;};'use strict';var _=require(_0x3998('0x0'));var util=require('util');var moment=require(_0x3998('0x1'));var BPromise=require(_0x3998('0x2'));var rs=require(_0x3998('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3998('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3998('0x5'))(_0x3998('0x6'));var config=require(_0x3998('0x7'));var jayson=require(_0x3998('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ac4b9,_0x132b27,_0x96029a){return new BPromise(function(_0x54d16f,_0x2e4d1e){return client['request'](_0x4ac4b9,_0x96029a)['then'](function(_0x3aff90){logger['info'](_0x3998('0x9'),_0x132b27,'request\x20sent');logger[_0x3998('0xa')](_0x3998('0xb'),_0x132b27,_0x3998('0xc'),JSON[_0x3998('0xd')](_0x3aff90));if(_0x3aff90[_0x3998('0xe')]){if(_0x3aff90[_0x3998('0xe')]['code']===0x1f4){logger[_0x3998('0xe')](_0x3998('0x9'),_0x132b27,_0x3aff90['error'][_0x3998('0xf')]);return _0x2e4d1e(_0x3aff90['error'][_0x3998('0xf')]);}logger['error'](_0x3998('0x9'),_0x132b27,_0x3aff90[_0x3998('0xe')]['message']);return _0x54d16f(_0x3aff90[_0x3998('0xe')][_0x3998('0xf')]);}else{logger['info'](_0x3998('0x9'),_0x132b27,'request\x20sent');_0x54d16f(_0x3aff90[_0x3998('0x10')][_0x3998('0xf')]);}})[_0x3998('0x11')](function(_0x271e65){logger[_0x3998('0xe')](_0x3998('0x9'),_0x132b27,_0x271e65);_0x2e4d1e(_0x271e65);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 7bc3b66..9ead6d6 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 _0x45e6=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','../../components/auth/service'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0x45e6,0xf8));var _0x645e=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0x45e6[_0x3b5049];return _0x12454e;};'use strict';var multer=require(_0x645e('0x0'));var util=require(_0x645e('0x1'));var path=require(_0x645e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x645e('0x3'));var interaction=require(_0x645e('0x4'));var config=require(_0x645e('0x5'));var controller=require(_0x645e('0x6'));router['get']('/',auth[_0x645e('0x7')](),controller[_0x645e('0x8')]);router[_0x645e('0x9')]('/:id',auth[_0x645e('0x7')](),controller[_0x645e('0xa')]);router[_0x645e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x645e('0xc')](_0x645e('0xd'),auth['isAuthenticated'](),controller[_0x645e('0xe')]);router[_0x645e('0xf')](_0x645e('0xd'),auth['isAuthenticated'](),controller[_0x645e('0x10')]);module[_0x645e('0x11')]=router; \ No newline at end of file +var _0x03dd=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x596c43,_0x28647a){var _0x4e1315=function(_0x58e910){while(--_0x58e910){_0x596c43['push'](_0x596c43['shift']());}};_0x4e1315(++_0x28647a);}(_0x03dd,0x1cb));var _0xd03d=function(_0x312abc,_0x17f25c){_0x312abc=_0x312abc-0x0;var _0x314298=_0x03dd[_0x312abc];return _0x314298;};'use strict';var multer=require(_0xd03d('0x0'));var util=require(_0xd03d('0x1'));var path=require(_0xd03d('0x2'));var timeout=require(_0xd03d('0x3'));var express=require(_0xd03d('0x4'));var router=express[_0xd03d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd03d('0x6'));var interaction=require(_0xd03d('0x7'));var config=require(_0xd03d('0x8'));var controller=require(_0xd03d('0x9'));router[_0xd03d('0xa')]('/',auth['isAuthenticated'](),controller[_0xd03d('0xb')]);router[_0xd03d('0xa')](_0xd03d('0xc'),auth[_0xd03d('0xd')](),controller[_0xd03d('0xe')]);router[_0xd03d('0xf')]('/',auth[_0xd03d('0xd')](),controller[_0xd03d('0x10')]);router[_0xd03d('0x11')]('/:id',auth[_0xd03d('0xd')](),controller[_0xd03d('0x12')]);router[_0xd03d('0x13')](_0xd03d('0xc'),auth['isAuthenticated'](),controller[_0xd03d('0x14')]);module[_0xd03d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 1ad04e5..25098a2 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 _0x5ada=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x9a1c74,_0x51560b){var _0x26f9ad=function(_0x50f88f){while(--_0x50f88f){_0x9a1c74['push'](_0x9a1c74['shift']());}};_0x26f9ad(++_0x51560b);}(_0x5ada,0x160));var _0xa5ad=function(_0x5a2601,_0x5c6aba){_0x5a2601=_0x5a2601-0x0;var _0x267c47=_0x5ada[_0x5a2601];return _0x267c47;};'use strict';var Sequelize=require(_0xa5ad('0x0'));module[_0xa5ad('0x1')]={'type':{'type':Sequelize[_0xa5ad('0x2')](_0xa5ad('0x3'),_0xa5ad('0x4'),_0xa5ad('0x5'),'keyValue',_0xa5ad('0x6')),'defaultValue':_0xa5ad('0x3')},'content':{'type':Sequelize[_0xa5ad('0x7')]},'key':{'type':Sequelize[_0xa5ad('0x7')]},'keyType':{'type':Sequelize[_0xa5ad('0x2')](_0xa5ad('0x3'),_0xa5ad('0x4'),_0xa5ad('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa5ad('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa5ad('0x7')]}}; \ No newline at end of file +var _0x29bc=['variable','customVariable','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x22eb5d,_0x2e519d){var _0x4a39ad=function(_0x4a1206){while(--_0x4a1206){_0x22eb5d['push'](_0x22eb5d['shift']());}};_0x4a39ad(++_0x2e519d);}(_0x29bc,0xbd));var _0xc29b=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x29bc[_0x1a7550];return _0x426e22;};'use strict';var Sequelize=require('sequelize');module[_0xc29b('0x0')]={'type':{'type':Sequelize[_0xc29b('0x1')](_0xc29b('0x2'),_0xc29b('0x3'),_0xc29b('0x4'),'keyValue',_0xc29b('0x5')),'defaultValue':_0xc29b('0x2')},'content':{'type':Sequelize[_0xc29b('0x6')]},'key':{'type':Sequelize[_0xc29b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc29b('0x2'),_0xc29b('0x3'),_0xc29b('0x4'))},'keyContent':{'type':Sequelize[_0xc29b('0x6')]},'idField':{'type':Sequelize[_0xc29b('0x6')]},'nameField':{'type':Sequelize[_0xc29b('0x6')]},'customField':{'type':Sequelize[_0xc29b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc29b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 7015824..49240b2 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 _0xbf32=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','findAll','catch','show','params','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xbf32,0x134));var _0x2bf3=function(_0x57d4e2,_0x3ca167){_0x57d4e2=_0x57d4e2-0x0;var _0x1fe578=_0xbf32[_0x57d4e2];return _0x1fe578;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2bf3('0x0'));var zipdir=require(_0x2bf3('0x1'));var jsonpatch=require(_0x2bf3('0x2'));var rp=require(_0x2bf3('0x3'));var moment=require(_0x2bf3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2bf3('0x5'));var util=require(_0x2bf3('0x6'));var path=require(_0x2bf3('0x7'));var sox=require(_0x2bf3('0x8'));var csv=require(_0x2bf3('0x9'));var ejs=require(_0x2bf3('0xa'));var fs=require('fs');var fs_extra=require(_0x2bf3('0xb'));var _=require(_0x2bf3('0xc'));var squel=require(_0x2bf3('0xd'));var crypto=require(_0x2bf3('0xe'));var jsforce=require(_0x2bf3('0xf'));var deskjs=require(_0x2bf3('0x10'));var toCsv=require(_0x2bf3('0x9'));var querystring=require(_0x2bf3('0x11'));var Papa=require(_0x2bf3('0x12'));var Redis=require(_0x2bf3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2bf3('0x14'));var as=require(_0x2bf3('0x15'));var hardwareService=require(_0x2bf3('0x16'));var logger=require(_0x2bf3('0x17'))('api');var utils=require(_0x2bf3('0x18'));var config=require(_0x2bf3('0x19'));var licenseUtil=require(_0x2bf3('0x1a'));var db=require(_0x2bf3('0x1b'))['db'];function respondWithStatusCode(_0x5e01fa,_0x2a1131){_0x2a1131=_0x2a1131||0xcc;return function(_0x3141da){if(_0x3141da){return _0x5e01fa[_0x2bf3('0x1c')](_0x2a1131);}return _0x5e01fa[_0x2bf3('0x1d')](_0x2a1131)[_0x2bf3('0x1e')]();};}function respondWithResult(_0x4614fb,_0x54f8e5){_0x54f8e5=_0x54f8e5||0xc8;return function(_0x2f61c0){if(_0x2f61c0){return _0x4614fb['status'](_0x54f8e5)[_0x2bf3('0x1f')](_0x2f61c0);}};}function respondWithFilteredResult(_0x56927f,_0x431453){return function(_0x5f4129){if(_0x5f4129){var _0x16e559=typeof _0x431453[_0x2bf3('0x20')]===_0x2bf3('0x21')&&typeof _0x431453[_0x2bf3('0x22')]===_0x2bf3('0x21');var _0x2b322a=_0x5f4129[_0x2bf3('0x23')];var _0x165a9e=_0x16e559?0x0:_0x431453[_0x2bf3('0x20')];var _0x2bf88e=_0x16e559?_0x5f4129[_0x2bf3('0x23')]:_0x431453['offset']+_0x431453[_0x2bf3('0x22')];var _0x4ae4a8;if(_0x2bf88e>=_0x2b322a){_0x2bf88e=_0x2b322a;_0x4ae4a8=0xc8;}else{_0x4ae4a8=0xce;}_0x56927f['status'](_0x4ae4a8);return _0x56927f[_0x2bf3('0x24')](_0x2bf3('0x25'),_0x165a9e+'-'+_0x2bf88e+'/'+_0x2b322a)[_0x2bf3('0x1f')](_0x5f4129);}return null;};}function patchUpdates(_0x4ee805){return function(_0x147b11){try{jsonpatch[_0x2bf3('0x26')](_0x147b11,_0x4ee805,!![]);}catch(_0x44aaac){return BPromise[_0x2bf3('0x27')](_0x44aaac);}return _0x147b11[_0x2bf3('0x28')]();};}function saveUpdates(_0x47eb82,_0x1b7fcb){return function(_0x5a2b98){if(_0x5a2b98){return _0x5a2b98[_0x2bf3('0x29')](_0x47eb82)['then'](function(_0x267f63){return _0x267f63;});}return null;};}function removeEntity(_0x59d9bf,_0x21e41f){return function(_0x1f6dbf){if(_0x1f6dbf){return _0x1f6dbf[_0x2bf3('0x2a')]()['then'](function(){_0x59d9bf[_0x2bf3('0x1d')](0xcc)[_0x2bf3('0x1e')]();});}};}function handleEntityNotFound(_0x3d095d,_0x276785){return function(_0x18a335){if(!_0x18a335){_0x3d095d['sendStatus'](0x194);}return _0x18a335;};}function handleError(_0x46946e,_0x113c7f){_0x113c7f=_0x113c7f||0x1f4;return function(_0x816744){logger[_0x2bf3('0x2b')](_0x816744[_0x2bf3('0x2c')]);if(_0x816744[_0x2bf3('0x2d')]){delete _0x816744[_0x2bf3('0x2d')];}_0x46946e[_0x2bf3('0x1d')](_0x113c7f)[_0x2bf3('0x2e')](_0x816744);};}exports[_0x2bf3('0x2f')]=function(_0x4af9fe,_0x30f8e5){var _0x2d2199={},_0x5c1900={},_0x1465ab={'count':0x0,'rows':[]};var _0x162cd7=_[_0x2bf3('0x30')](db[_0x2bf3('0x31')][_0x2bf3('0x32')],function(_0x373954){return{'name':_0x373954[_0x2bf3('0x33')],'type':_0x373954['type'][_0x2bf3('0x34')]};});_0x5c1900[_0x2bf3('0x35')]=_[_0x2bf3('0x30')](_0x162cd7,_0x2bf3('0x2d'));_0x5c1900[_0x2bf3('0x36')]=_[_0x2bf3('0x37')](_0x4af9fe[_0x2bf3('0x36')]);_0x5c1900[_0x2bf3('0x38')]=_['intersection'](_0x5c1900[_0x2bf3('0x35')],_0x5c1900[_0x2bf3('0x36')]);_0x2d2199[_0x2bf3('0x39')]=_[_0x2bf3('0x3a')](_0x5c1900[_0x2bf3('0x35')],qs['fields'](_0x4af9fe['query'][_0x2bf3('0x3b')]));_0x2d2199[_0x2bf3('0x39')]=_0x2d2199[_0x2bf3('0x39')][_0x2bf3('0x3c')]?_0x2d2199[_0x2bf3('0x39')]:_0x5c1900['model'];if(!_0x4af9fe[_0x2bf3('0x36')]['hasOwnProperty'](_0x2bf3('0x3d'))){_0x2d2199['limit']=qs[_0x2bf3('0x22')](_0x4af9fe[_0x2bf3('0x36')]['limit']);_0x2d2199[_0x2bf3('0x20')]=qs[_0x2bf3('0x20')](_0x4af9fe[_0x2bf3('0x36')][_0x2bf3('0x20')]);}_0x2d2199[_0x2bf3('0x3e')]=qs[_0x2bf3('0x3f')](_0x4af9fe[_0x2bf3('0x36')][_0x2bf3('0x3f')]);_0x2d2199[_0x2bf3('0x40')]=qs[_0x2bf3('0x38')](_[_0x2bf3('0x41')](_0x4af9fe[_0x2bf3('0x36')],_0x5c1900[_0x2bf3('0x38')]),_0x162cd7);if(_0x4af9fe[_0x2bf3('0x36')][_0x2bf3('0x42')]){_0x2d2199[_0x2bf3('0x40')]=_[_0x2bf3('0x43')](_0x2d2199['where'],{'$or':_[_0x2bf3('0x30')](_0x162cd7,function(_0x3b4dec){if(_0x3b4dec[_0x2bf3('0x44')]!==_0x2bf3('0x45')){var _0x1e101e={};_0x1e101e[_0x3b4dec[_0x2bf3('0x2d')]]={'$like':'%'+_0x4af9fe[_0x2bf3('0x36')][_0x2bf3('0x42')]+'%'};return _0x1e101e;}})});}_0x2d2199=_[_0x2bf3('0x43')]({},_0x2d2199,_0x4af9fe[_0x2bf3('0x46')]);var _0x116675={'where':_0x2d2199[_0x2bf3('0x40')]};return db[_0x2bf3('0x31')][_0x2bf3('0x23')](_0x116675)[_0x2bf3('0x47')](function(_0x5a5668){_0x1465ab[_0x2bf3('0x23')]=_0x5a5668;if(_0x4af9fe['query'][_0x2bf3('0x48')]){_0x2d2199['include']=[{'all':!![]}];}return db[_0x2bf3('0x31')][_0x2bf3('0x49')](_0x2d2199);})['then'](function(_0x4e7e42){_0x1465ab['rows']=_0x4e7e42;return _0x1465ab;})['then'](respondWithFilteredResult(_0x30f8e5,_0x2d2199))[_0x2bf3('0x4a')](handleError(_0x30f8e5,null));};exports[_0x2bf3('0x4b')]=function(_0x222864,_0x31c3de){var _0x523021={'raw':!![],'where':{'id':_0x222864[_0x2bf3('0x4c')]['id']}},_0x3fe009={};_0x3fe009[_0x2bf3('0x35')]=_[_0x2bf3('0x37')](db['ServicenowField'][_0x2bf3('0x32')]);_0x3fe009[_0x2bf3('0x36')]=_[_0x2bf3('0x37')](_0x222864[_0x2bf3('0x36')]);_0x3fe009['filters']=_[_0x2bf3('0x3a')](_0x3fe009[_0x2bf3('0x35')],_0x3fe009['query']);_0x523021['attributes']=_[_0x2bf3('0x3a')](_0x3fe009[_0x2bf3('0x35')],qs[_0x2bf3('0x3b')](_0x222864['query'][_0x2bf3('0x3b')]));_0x523021[_0x2bf3('0x39')]=_0x523021[_0x2bf3('0x39')][_0x2bf3('0x3c')]?_0x523021[_0x2bf3('0x39')]:_0x3fe009[_0x2bf3('0x35')];if(_0x222864[_0x2bf3('0x36')][_0x2bf3('0x48')]){_0x523021[_0x2bf3('0x4d')]=[{'all':!![]}];}_0x523021=_['merge']({},_0x523021,_0x222864[_0x2bf3('0x46')]);return db['ServicenowField'][_0x2bf3('0x4e')](_0x523021)[_0x2bf3('0x47')](handleEntityNotFound(_0x31c3de,null))[_0x2bf3('0x47')](respondWithResult(_0x31c3de,null))[_0x2bf3('0x4a')](handleError(_0x31c3de,null));};exports['create']=function(_0x5668f9,_0x3c51f2){return db[_0x2bf3('0x31')][_0x2bf3('0x4f')](_0x5668f9[_0x2bf3('0x50')],{})['then'](respondWithResult(_0x3c51f2,0xc9))['catch'](handleError(_0x3c51f2,null));};exports['update']=function(_0x406985,_0x2cbb6b){if(_0x406985['body']['id']){delete _0x406985[_0x2bf3('0x50')]['id'];}return db['ServicenowField'][_0x2bf3('0x4e')]({'where':{'id':_0x406985[_0x2bf3('0x4c')]['id']}})[_0x2bf3('0x47')](handleEntityNotFound(_0x2cbb6b,null))[_0x2bf3('0x47')](saveUpdates(_0x406985[_0x2bf3('0x50')],null))['then'](respondWithResult(_0x2cbb6b,null))[_0x2bf3('0x4a')](handleError(_0x2cbb6b,null));};exports['destroy']=function(_0x1b6b98,_0x5abaeb){return db[_0x2bf3('0x31')][_0x2bf3('0x4e')]({'where':{'id':_0x1b6b98[_0x2bf3('0x4c')]['id']}})[_0x2bf3('0x47')](handleEntityNotFound(_0x5abaeb,null))[_0x2bf3('0x47')](removeEntity(_0x5abaeb,null))[_0x2bf3('0x4a')](handleError(_0x5abaeb,null));}; \ No newline at end of file +var _0x4cc9=['pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','destroy','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4cc9,0xa8));var _0x94cc=function(_0x3ac2e1,_0x42468d){_0x3ac2e1=_0x3ac2e1-0x0;var _0x5453de=_0x4cc9[_0x3ac2e1];return _0x5453de;};'use strict';var emlformat=require(_0x94cc('0x0'));var rimraf=require(_0x94cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x94cc('0x2'));var BPromise=require(_0x94cc('0x3'));var Mustache=require(_0x94cc('0x4'));var util=require(_0x94cc('0x5'));var path=require(_0x94cc('0x6'));var sox=require(_0x94cc('0x7'));var csv=require(_0x94cc('0x8'));var ejs=require(_0x94cc('0x9'));var fs=require('fs');var fs_extra=require(_0x94cc('0xa'));var _=require(_0x94cc('0xb'));var squel=require('squel');var crypto=require(_0x94cc('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x94cc('0x8'));var querystring=require(_0x94cc('0xd'));var Papa=require(_0x94cc('0xe'));var Redis=require(_0x94cc('0xf'));var authService=require(_0x94cc('0x10'));var qs=require(_0x94cc('0x11'));var as=require(_0x94cc('0x12'));var hardwareService=require(_0x94cc('0x13'));var logger=require(_0x94cc('0x14'))(_0x94cc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x94cc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bbf87,_0x105fb8){_0x105fb8=_0x105fb8||0xcc;return function(_0x4cfb75){if(_0x4cfb75){return _0x2bbf87['sendStatus'](_0x105fb8);}return _0x2bbf87[_0x94cc('0x17')](_0x105fb8)[_0x94cc('0x18')]();};}function respondWithResult(_0x5343cc,_0xe279b0){_0xe279b0=_0xe279b0||0xc8;return function(_0x4ff4e1){if(_0x4ff4e1){return _0x5343cc['status'](_0xe279b0)[_0x94cc('0x19')](_0x4ff4e1);}};}function respondWithFilteredResult(_0x2db822,_0x44e3a1){return function(_0x5a070f){if(_0x5a070f){var _0x56a981=typeof _0x44e3a1[_0x94cc('0x1a')]===_0x94cc('0x1b')&&typeof _0x44e3a1[_0x94cc('0x1c')]===_0x94cc('0x1b');var _0x1c9bd8=_0x5a070f['count'];var _0x22cb55=_0x56a981?0x0:_0x44e3a1[_0x94cc('0x1a')];var _0x2a8a64=_0x56a981?_0x5a070f[_0x94cc('0x1d')]:_0x44e3a1[_0x94cc('0x1a')]+_0x44e3a1[_0x94cc('0x1c')];var _0x373783;if(_0x2a8a64>=_0x1c9bd8){_0x2a8a64=_0x1c9bd8;_0x373783=0xc8;}else{_0x373783=0xce;}_0x2db822[_0x94cc('0x17')](_0x373783);return _0x2db822[_0x94cc('0x1e')]('Content-Range',_0x22cb55+'-'+_0x2a8a64+'/'+_0x1c9bd8)['json'](_0x5a070f);}return null;};}function patchUpdates(_0x16dc47){return function(_0x89e2ae){try{jsonpatch[_0x94cc('0x1f')](_0x89e2ae,_0x16dc47,!![]);}catch(_0x125644){return BPromise[_0x94cc('0x20')](_0x125644);}return _0x89e2ae[_0x94cc('0x21')]();};}function saveUpdates(_0x3879d7,_0xa65e78){return function(_0x125c04){if(_0x125c04){return _0x125c04[_0x94cc('0x22')](_0x3879d7)['then'](function(_0x3f9425){return _0x3f9425;});}return null;};}function removeEntity(_0x541c46,_0x53d3a4){return function(_0x10cbfb){if(_0x10cbfb){return _0x10cbfb['destroy']()[_0x94cc('0x23')](function(){_0x541c46[_0x94cc('0x17')](0xcc)[_0x94cc('0x18')]();});}};}function handleEntityNotFound(_0x3d9dfb,_0x3e6802){return function(_0x4c2453){if(!_0x4c2453){_0x3d9dfb[_0x94cc('0x24')](0x194);}return _0x4c2453;};}function handleError(_0x4f4df5,_0xfc1bd1){_0xfc1bd1=_0xfc1bd1||0x1f4;return function(_0x55e355){logger[_0x94cc('0x25')](_0x55e355[_0x94cc('0x26')]);if(_0x55e355[_0x94cc('0x27')]){delete _0x55e355[_0x94cc('0x27')];}_0x4f4df5[_0x94cc('0x17')](_0xfc1bd1)[_0x94cc('0x28')](_0x55e355);};}exports[_0x94cc('0x29')]=function(_0x156d30,_0x345c15){var _0x5c231e={},_0x1ca30b={},_0x40b87d={'count':0x0,'rows':[]};var _0x5eaa74=_[_0x94cc('0x2a')](db[_0x94cc('0x2b')][_0x94cc('0x2c')],function(_0x360092){return{'name':_0x360092[_0x94cc('0x2d')],'type':_0x360092[_0x94cc('0x2e')][_0x94cc('0x2f')]};});_0x1ca30b['model']=_[_0x94cc('0x2a')](_0x5eaa74,_0x94cc('0x27'));_0x1ca30b[_0x94cc('0x30')]=_[_0x94cc('0x31')](_0x156d30[_0x94cc('0x30')]);_0x1ca30b[_0x94cc('0x32')]=_[_0x94cc('0x33')](_0x1ca30b[_0x94cc('0x34')],_0x1ca30b[_0x94cc('0x30')]);_0x5c231e[_0x94cc('0x35')]=_['intersection'](_0x1ca30b[_0x94cc('0x34')],qs[_0x94cc('0x36')](_0x156d30[_0x94cc('0x30')]['fields']));_0x5c231e[_0x94cc('0x35')]=_0x5c231e[_0x94cc('0x35')][_0x94cc('0x37')]?_0x5c231e[_0x94cc('0x35')]:_0x1ca30b[_0x94cc('0x34')];if(!_0x156d30[_0x94cc('0x30')][_0x94cc('0x38')](_0x94cc('0x39'))){_0x5c231e[_0x94cc('0x1c')]=qs[_0x94cc('0x1c')](_0x156d30['query'][_0x94cc('0x1c')]);_0x5c231e['offset']=qs[_0x94cc('0x1a')](_0x156d30[_0x94cc('0x30')][_0x94cc('0x1a')]);}_0x5c231e[_0x94cc('0x3a')]=qs[_0x94cc('0x3b')](_0x156d30[_0x94cc('0x30')][_0x94cc('0x3b')]);_0x5c231e['where']=qs[_0x94cc('0x32')](_[_0x94cc('0x3c')](_0x156d30[_0x94cc('0x30')],_0x1ca30b[_0x94cc('0x32')]),_0x5eaa74);if(_0x156d30[_0x94cc('0x30')][_0x94cc('0x3d')]){_0x5c231e['where']=_[_0x94cc('0x3e')](_0x5c231e[_0x94cc('0x3f')],{'$or':_[_0x94cc('0x2a')](_0x5eaa74,function(_0x22dc45){if(_0x22dc45[_0x94cc('0x2e')]!==_0x94cc('0x40')){var _0xeabfe6={};_0xeabfe6[_0x22dc45['name']]={'$like':'%'+_0x156d30['query']['filter']+'%'};return _0xeabfe6;}})});}_0x5c231e=_[_0x94cc('0x3e')]({},_0x5c231e,_0x156d30[_0x94cc('0x41')]);var _0x9b170c={'where':_0x5c231e[_0x94cc('0x3f')]};return db['ServicenowField'][_0x94cc('0x1d')](_0x9b170c)['then'](function(_0x383535){_0x40b87d[_0x94cc('0x1d')]=_0x383535;if(_0x156d30[_0x94cc('0x30')]['includeAll']){_0x5c231e[_0x94cc('0x42')]=[{'all':!![]}];}return db[_0x94cc('0x2b')][_0x94cc('0x43')](_0x5c231e);})[_0x94cc('0x23')](function(_0x18f13d){_0x40b87d[_0x94cc('0x44')]=_0x18f13d;return _0x40b87d;})[_0x94cc('0x23')](respondWithFilteredResult(_0x345c15,_0x5c231e))[_0x94cc('0x45')](handleError(_0x345c15,null));};exports['show']=function(_0x262b42,_0x253f1e){var _0x3b381c={'raw':!![],'where':{'id':_0x262b42[_0x94cc('0x46')]['id']}},_0x37b4da={};_0x37b4da[_0x94cc('0x34')]=_[_0x94cc('0x31')](db['ServicenowField'][_0x94cc('0x2c')]);_0x37b4da[_0x94cc('0x30')]=_['keys'](_0x262b42[_0x94cc('0x30')]);_0x37b4da[_0x94cc('0x32')]=_[_0x94cc('0x33')](_0x37b4da[_0x94cc('0x34')],_0x37b4da[_0x94cc('0x30')]);_0x3b381c[_0x94cc('0x35')]=_['intersection'](_0x37b4da[_0x94cc('0x34')],qs[_0x94cc('0x36')](_0x262b42['query'][_0x94cc('0x36')]));_0x3b381c['attributes']=_0x3b381c[_0x94cc('0x35')][_0x94cc('0x37')]?_0x3b381c['attributes']:_0x37b4da[_0x94cc('0x34')];if(_0x262b42[_0x94cc('0x30')][_0x94cc('0x47')]){_0x3b381c[_0x94cc('0x42')]=[{'all':!![]}];}_0x3b381c=_[_0x94cc('0x3e')]({},_0x3b381c,_0x262b42[_0x94cc('0x41')]);return db[_0x94cc('0x2b')][_0x94cc('0x48')](_0x3b381c)['then'](handleEntityNotFound(_0x253f1e,null))[_0x94cc('0x23')](respondWithResult(_0x253f1e,null))[_0x94cc('0x45')](handleError(_0x253f1e,null));};exports[_0x94cc('0x49')]=function(_0x361c1e,_0x100b04){return db[_0x94cc('0x2b')][_0x94cc('0x49')](_0x361c1e['body'],{})[_0x94cc('0x23')](respondWithResult(_0x100b04,0xc9))['catch'](handleError(_0x100b04,null));};exports['update']=function(_0x42e55d,_0x27ccab){if(_0x42e55d[_0x94cc('0x4a')]['id']){delete _0x42e55d[_0x94cc('0x4a')]['id'];}return db[_0x94cc('0x2b')][_0x94cc('0x48')]({'where':{'id':_0x42e55d[_0x94cc('0x46')]['id']}})[_0x94cc('0x23')](handleEntityNotFound(_0x27ccab,null))[_0x94cc('0x23')](saveUpdates(_0x42e55d[_0x94cc('0x4a')],null))[_0x94cc('0x23')](respondWithResult(_0x27ccab,null))[_0x94cc('0x45')](handleError(_0x27ccab,null));};exports[_0x94cc('0x4b')]=function(_0x21941c,_0x53d3d4){return db[_0x94cc('0x2b')][_0x94cc('0x48')]({'where':{'id':_0x21941c[_0x94cc('0x46')]['id']}})['then'](handleEntityNotFound(_0x53d3d4,null))[_0x94cc('0x23')](removeEntity(_0x53d3d4,null))[_0x94cc('0x45')](handleError(_0x53d3d4,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index f78160b..7b274af 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 _0x74c8=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','ServicenowField','servicenow_unique_index','idField','FieldId','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x74c8,0xb5));var _0x874c=function(_0x4981b8,_0x2eac0f){_0x4981b8=_0x4981b8-0x0;var _0x4e149e=_0x74c8[_0x4981b8];return _0x4e149e;};'use strict';var _=require(_0x874c('0x0'));var util=require(_0x874c('0x1'));var logger=require(_0x874c('0x2'))('api');var moment=require(_0x874c('0x3'));var BPromise=require(_0x874c('0x4'));var rp=require(_0x874c('0x5'));var fs=require('fs');var path=require(_0x874c('0x6'));var rimraf=require(_0x874c('0x7'));var config=require(_0x874c('0x8'));var attributes=require(_0x874c('0x9'));module['exports']=function(_0x20b9eb,_0x392ad0){return _0x20b9eb['define'](_0x874c('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x874c('0xb'),'fields':[_0x874c('0xc'),_0x874c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d6f=['api','bluebird','path','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x0d6f,0xb1));var _0xf0d6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0d6f[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xf0d6('0x0'));var util=require(_0xf0d6('0x1'));var logger=require(_0xf0d6('0x2'))(_0xf0d6('0x3'));var moment=require('moment');var BPromise=require(_0xf0d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0d6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0xf0d6('0x6')]=function(_0x5ef764,_0x1060d2){return _0x5ef764[_0xf0d6('0x7')]('ServicenowField',attributes,{'tableName':_0xf0d6('0x8'),'paranoid':![],'indexes':[{'name':_0xf0d6('0x9'),'fields':[_0xf0d6('0xa'),_0xf0d6('0xb')],'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 7de1c3a..deeecb7 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x500128,_0x76e7b){var _0x3ac321=function(_0x4b01e7){while(--_0x4b01e7){_0x500128['push'](_0x500128['shift']());}};_0x3ac321(++_0x76e7b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x42f19e,_0x42abd2){_0x42f19e=_0x42f19e-0x0;var _0x33f465=_0xb43b[_0x42f19e];return _0x33f465;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x3ee5df,_0x583073){var _0x446d24=function(_0x12e54e){while(--_0x12e54e){_0x3ee5df['push'](_0x3ee5df['shift']());}};_0x446d24(++_0x583073);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 7184e7e..2d04533 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5af099,_0x2b2d5a){var _0x398227=function(_0x2ecbc8){while(--_0x2ecbc8){_0x5af099['push'](_0x5af099['shift']());}};_0x398227(++_0x2b2d5a);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x1e9b24,_0x4c0afd){var _0x36dc68=function(_0x57ff26){while(--_0x57ff26){_0x1e9b24['push'](_0x1e9b24['shift']());}};_0x36dc68(++_0x4c0afd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index bf943dd..96c82e8 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(_0x2d8e05,_0x4b30d1){var _0x4bf26d=function(_0x228642){while(--_0x228642){_0x2d8e05['push'](_0x2d8e05['shift']());}};_0x4bf26d(++_0x4b30d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0xf9993b,_0x4b2be7){var _0x9ccc64=function(_0x16bd96){while(--_0x16bd96){_0xf9993b['push'](_0xf9993b['shift']());}};_0x9ccc64(++_0x4b2be7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 c4377fc..b17842b 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 _0x4f6f=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','sendStatus','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','SugarcrmAccount','rows','catch','show','params','find','create','body','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','description','duration_hours','duration_minutes','parent_type','parent_name','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','module_fields','remove','label','endsWith','values','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x4f6f,0x1d7));var _0xf4f6=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0x4f6f[_0x4f0e62];return _0x117ab8;};'use strict';var emlformat=require(_0xf4f6('0x0'));var rimraf=require(_0xf4f6('0x1'));var zipdir=require(_0xf4f6('0x2'));var jsonpatch=require(_0xf4f6('0x3'));var rp=require(_0xf4f6('0x4'));var moment=require('moment');var BPromise=require(_0xf4f6('0x5'));var Mustache=require('mustache');var util=require(_0xf4f6('0x6'));var path=require(_0xf4f6('0x7'));var sox=require(_0xf4f6('0x8'));var csv=require(_0xf4f6('0x9'));var ejs=require(_0xf4f6('0xa'));var fs=require('fs');var fs_extra=require(_0xf4f6('0xb'));var _=require(_0xf4f6('0xc'));var squel=require(_0xf4f6('0xd'));var crypto=require(_0xf4f6('0xe'));var jsforce=require(_0xf4f6('0xf'));var deskjs=require(_0xf4f6('0x10'));var toCsv=require(_0xf4f6('0x9'));var querystring=require(_0xf4f6('0x11'));var Papa=require(_0xf4f6('0x12'));var Redis=require(_0xf4f6('0x13'));var authService=require(_0xf4f6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xf4f6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4f6('0x16'))(_0xf4f6('0x17'));var utils=require(_0xf4f6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf4f6('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf4f6('0x1a'));function respondWithStatusCode(_0x174b2a,_0x21d76f){_0x21d76f=_0x21d76f||0xcc;return function(_0x107c5a){if(_0x107c5a){return _0x174b2a['sendStatus'](_0x21d76f);}return _0x174b2a[_0xf4f6('0x1b')](_0x21d76f)['end']();};}function respondWithResult(_0x413525,_0xa666f9){_0xa666f9=_0xa666f9||0xc8;return function(_0x15e1e6){if(_0x15e1e6){return _0x413525['status'](_0xa666f9)[_0xf4f6('0x1c')](_0x15e1e6);}};}function respondWithFilteredResult(_0x42f824,_0x474fd2){return function(_0x3d0271){if(_0x3d0271){var _0x2f97d6=typeof _0x474fd2[_0xf4f6('0x1d')]===_0xf4f6('0x1e')&&typeof _0x474fd2[_0xf4f6('0x1f')]===_0xf4f6('0x1e');var _0x2e6503=_0x3d0271[_0xf4f6('0x20')];var _0x1daa16=_0x2f97d6?0x0:_0x474fd2['offset'];var _0x3453e0=_0x2f97d6?_0x3d0271[_0xf4f6('0x20')]:_0x474fd2[_0xf4f6('0x1d')]+_0x474fd2[_0xf4f6('0x1f')];var _0x152320;if(_0x3453e0>=_0x2e6503){_0x3453e0=_0x2e6503;_0x152320=0xc8;}else{_0x152320=0xce;}_0x42f824['status'](_0x152320);return _0x42f824[_0xf4f6('0x21')]('Content-Range',_0x1daa16+'-'+_0x3453e0+'/'+_0x2e6503)[_0xf4f6('0x1c')](_0x3d0271);}return null;};}function patchUpdates(_0x2b9ba9){return function(_0x3954c4){try{jsonpatch[_0xf4f6('0x22')](_0x3954c4,_0x2b9ba9,!![]);}catch(_0x134e25){return BPromise[_0xf4f6('0x23')](_0x134e25);}return _0x3954c4[_0xf4f6('0x24')]();};}function saveUpdates(_0xf58082,_0x2bbc96){return function(_0x1af4ba){if(_0x1af4ba){return _0x1af4ba[_0xf4f6('0x25')](_0xf58082)[_0xf4f6('0x26')](function(_0x33b2d8){return _0x33b2d8;});}return null;};}function removeEntity(_0x94398b,_0x50996d){return function(_0x349071){if(_0x349071){return _0x349071[_0xf4f6('0x27')]()[_0xf4f6('0x26')](function(){_0x94398b[_0xf4f6('0x1b')](0xcc)[_0xf4f6('0x28')]();});}};}function handleEntityNotFound(_0x2e0cd5,_0x1e4eb5){return function(_0xb944e4){if(!_0xb944e4){_0x2e0cd5[_0xf4f6('0x29')](0x194);}return _0xb944e4;};}function handleError(_0x406725,_0x7adb36){_0x7adb36=_0x7adb36||0x1f4;return function(_0x2e178f){logger['error'](_0x2e178f['stack']);if(_0x2e178f[_0xf4f6('0x2a')]){delete _0x2e178f[_0xf4f6('0x2a')];}_0x406725[_0xf4f6('0x1b')](_0x7adb36)[_0xf4f6('0x2b')](_0x2e178f);};}exports['index']=function(_0x1bbdf8,_0x1301da){var _0x5efe57={},_0xd0c104={},_0x37f103={'count':0x0,'rows':[]};var _0xdec5bc=_[_0xf4f6('0x2c')](db['SugarcrmAccount'][_0xf4f6('0x2d')],function(_0x3d5d2b){return{'name':_0x3d5d2b[_0xf4f6('0x2e')],'type':_0x3d5d2b[_0xf4f6('0x2f')][_0xf4f6('0x30')]};});_0xd0c104['model']=_[_0xf4f6('0x2c')](_0xdec5bc,_0xf4f6('0x2a'));_0xd0c104[_0xf4f6('0x31')]=_[_0xf4f6('0x32')](_0x1bbdf8[_0xf4f6('0x31')]);_0xd0c104['filters']=_[_0xf4f6('0x33')](_0xd0c104[_0xf4f6('0x34')],_0xd0c104['query']);_0x5efe57[_0xf4f6('0x35')]=_[_0xf4f6('0x33')](_0xd0c104[_0xf4f6('0x34')],qs[_0xf4f6('0x36')](_0x1bbdf8[_0xf4f6('0x31')][_0xf4f6('0x36')]));_0x5efe57[_0xf4f6('0x35')]=_0x5efe57['attributes'][_0xf4f6('0x37')]?_0x5efe57[_0xf4f6('0x35')]:_0xd0c104[_0xf4f6('0x34')];if(!_0x1bbdf8['query'][_0xf4f6('0x38')](_0xf4f6('0x39'))){_0x5efe57[_0xf4f6('0x1f')]=qs[_0xf4f6('0x1f')](_0x1bbdf8['query'][_0xf4f6('0x1f')]);_0x5efe57[_0xf4f6('0x1d')]=qs['offset'](_0x1bbdf8[_0xf4f6('0x31')][_0xf4f6('0x1d')]);}_0x5efe57[_0xf4f6('0x3a')]=qs[_0xf4f6('0x3b')](_0x1bbdf8[_0xf4f6('0x31')][_0xf4f6('0x3b')]);_0x5efe57[_0xf4f6('0x3c')]=qs[_0xf4f6('0x3d')](_[_0xf4f6('0x3e')](_0x1bbdf8[_0xf4f6('0x31')],_0xd0c104['filters']),_0xdec5bc);if(_0x1bbdf8[_0xf4f6('0x31')][_0xf4f6('0x3f')]){_0x5efe57[_0xf4f6('0x3c')]=_[_0xf4f6('0x40')](_0x5efe57['where'],{'$or':_['map'](_0xdec5bc,function(_0x197b4d){if(_0x197b4d[_0xf4f6('0x2f')]!=='VIRTUAL'){var _0x16b851={};_0x16b851[_0x197b4d[_0xf4f6('0x2a')]]={'$like':'%'+_0x1bbdf8['query'][_0xf4f6('0x3f')]+'%'};return _0x16b851;}})});}_0x5efe57=_[_0xf4f6('0x40')]({},_0x5efe57,_0x1bbdf8[_0xf4f6('0x41')]);var _0x1ba6a6={'where':_0x5efe57[_0xf4f6('0x3c')]};return db['SugarcrmAccount'][_0xf4f6('0x20')](_0x1ba6a6)['then'](function(_0x13090c){_0x37f103['count']=_0x13090c;if(_0x1bbdf8['query'][_0xf4f6('0x42')]){_0x5efe57[_0xf4f6('0x43')]=[{'all':!![]}];}return db[_0xf4f6('0x44')]['findAll'](_0x5efe57);})[_0xf4f6('0x26')](function(_0xb1e8f6){_0x37f103[_0xf4f6('0x45')]=_0xb1e8f6;return _0x37f103;})[_0xf4f6('0x26')](respondWithFilteredResult(_0x1301da,_0x5efe57))[_0xf4f6('0x46')](handleError(_0x1301da,null));};exports[_0xf4f6('0x47')]=function(_0x5958e9,_0x8d5bb){var _0x2602d8={'raw':![],'where':{'id':_0x5958e9[_0xf4f6('0x48')]['id']}},_0x2d78a8={};_0x2d78a8['model']=_[_0xf4f6('0x32')](db['SugarcrmAccount'][_0xf4f6('0x2d')]);_0x2d78a8[_0xf4f6('0x31')]=_[_0xf4f6('0x32')](_0x5958e9['query']);_0x2d78a8[_0xf4f6('0x3d')]=_[_0xf4f6('0x33')](_0x2d78a8[_0xf4f6('0x34')],_0x2d78a8[_0xf4f6('0x31')]);_0x2602d8[_0xf4f6('0x35')]=_[_0xf4f6('0x33')](_0x2d78a8[_0xf4f6('0x34')],qs[_0xf4f6('0x36')](_0x5958e9['query'][_0xf4f6('0x36')]));_0x2602d8[_0xf4f6('0x35')]=_0x2602d8[_0xf4f6('0x35')][_0xf4f6('0x37')]?_0x2602d8[_0xf4f6('0x35')]:_0x2d78a8[_0xf4f6('0x34')];if(_0x5958e9['query'][_0xf4f6('0x42')]){_0x2602d8[_0xf4f6('0x43')]=[{'all':!![]}];}_0x2602d8=_[_0xf4f6('0x40')]({},_0x2602d8,_0x5958e9[_0xf4f6('0x41')]);return db[_0xf4f6('0x44')][_0xf4f6('0x49')](_0x2602d8)[_0xf4f6('0x26')](handleEntityNotFound(_0x8d5bb,null))['then'](respondWithResult(_0x8d5bb,null))['catch'](handleError(_0x8d5bb,null));};exports[_0xf4f6('0x4a')]=function(_0x5a35ff,_0x18f7ea){return db[_0xf4f6('0x44')][_0xf4f6('0x4a')](_0x5a35ff[_0xf4f6('0x4b')],{})[_0xf4f6('0x26')](respondWithResult(_0x18f7ea,0xc9))[_0xf4f6('0x46')](handleError(_0x18f7ea,null));};exports[_0xf4f6('0x25')]=function(_0x3f14bb,_0x4db822){if(_0x3f14bb[_0xf4f6('0x4b')]['id']){delete _0x3f14bb[_0xf4f6('0x4b')]['id'];}return db['SugarcrmAccount'][_0xf4f6('0x49')]({'where':{'id':_0x3f14bb[_0xf4f6('0x48')]['id']}})['then'](handleEntityNotFound(_0x4db822,null))[_0xf4f6('0x26')](saveUpdates(_0x3f14bb[_0xf4f6('0x4b')],null))[_0xf4f6('0x26')](respondWithResult(_0x4db822,null))[_0xf4f6('0x46')](handleError(_0x4db822,null));};exports[_0xf4f6('0x27')]=function(_0x205de2,_0x4f2634){return db[_0xf4f6('0x44')][_0xf4f6('0x49')]({'where':{'id':_0x205de2[_0xf4f6('0x48')]['id']}})[_0xf4f6('0x26')](handleEntityNotFound(_0x4f2634,null))['then'](removeEntity(_0x4f2634,null))[_0xf4f6('0x46')](handleError(_0x4f2634,null));};exports['getConfigurations']=function(_0x4d56aa,_0x40b911,_0x1f27ab){var _0x22fc5a={};var _0x208e2c={};var _0x51914e;var _0x3b6493;return db['SugarcrmAccount'][_0xf4f6('0x4c')]({'where':{'id':_0x4d56aa[_0xf4f6('0x48')]['id']}})[_0xf4f6('0x26')](handleEntityNotFound(_0x40b911,null))['then'](function(_0x4af3b8){if(_0x4af3b8){_0x51914e=_0x4af3b8;_0x208e2c[_0xf4f6('0x34')]=_[_0xf4f6('0x32')](db[_0xf4f6('0x4d')][_0xf4f6('0x2d')]);_0x208e2c[_0xf4f6('0x31')]=_[_0xf4f6('0x32')](_0x4d56aa[_0xf4f6('0x31')]);_0x208e2c['filters']=_[_0xf4f6('0x33')](_0x208e2c[_0xf4f6('0x34')],_0x208e2c[_0xf4f6('0x31')]);_0x22fc5a['attributes']=_[_0xf4f6('0x33')](_0x208e2c[_0xf4f6('0x34')],qs[_0xf4f6('0x36')](_0x4d56aa[_0xf4f6('0x31')][_0xf4f6('0x36')]));_0x22fc5a[_0xf4f6('0x35')]=_0x22fc5a[_0xf4f6('0x35')]['length']?_0x22fc5a[_0xf4f6('0x35')]:_0x208e2c[_0xf4f6('0x34')];_0x22fc5a[_0xf4f6('0x3a')]=qs[_0xf4f6('0x3b')](_0x4d56aa['query'][_0xf4f6('0x3b')]);_0x22fc5a[_0xf4f6('0x3c')]=qs[_0xf4f6('0x3d')](_[_0xf4f6('0x3e')](_0x4d56aa[_0xf4f6('0x31')],_0x208e2c[_0xf4f6('0x3d')]));if(_0x4d56aa[_0xf4f6('0x31')][_0xf4f6('0x3f')]){_0x22fc5a['where']=_['merge'](_0x22fc5a['where'],{'$or':_[_0xf4f6('0x2c')](_0x22fc5a[_0xf4f6('0x35')],function(_0x4c3816){var _0x33745e={};_0x33745e[_0x4c3816]={'$like':'%'+_0x4d56aa[_0xf4f6('0x31')][_0xf4f6('0x3f')]+'%'};return _0x33745e;})});}_0x22fc5a=_[_0xf4f6('0x40')]({},_0x22fc5a,_0x4d56aa[_0xf4f6('0x41')]);return _0x51914e['getConfigurations'](_0x22fc5a);}})[_0xf4f6('0x26')](function(_0x472abf){if(_0x472abf){_0x3b6493=_0x472abf[_0xf4f6('0x37')];if(!_0x4d56aa[_0xf4f6('0x31')]['hasOwnProperty'](_0xf4f6('0x39'))){_0x22fc5a['limit']=qs[_0xf4f6('0x1f')](_0x4d56aa['query'][_0xf4f6('0x1f')]);_0x22fc5a[_0xf4f6('0x1d')]=qs['offset'](_0x4d56aa[_0xf4f6('0x31')]['offset']);}return _0x51914e[_0xf4f6('0x4e')](_0x22fc5a);}})['then'](function(_0x49a8b7){if(_0x49a8b7){return _0x49a8b7?{'count':_0x3b6493,'rows':_0x49a8b7}:null;}})[_0xf4f6('0x26')](respondWithResult(_0x40b911,null))[_0xf4f6('0x46')](handleError(_0x40b911,null));};exports[_0xf4f6('0x4f')]=function(_0x159745,_0x5c4c2b,_0x421fbe){if(_0x159745['body']['id']){delete _0x159745[_0xf4f6('0x4b')]['id'];}return db[_0xf4f6('0x44')][_0xf4f6('0x4c')]({'where':{'id':_0x159745[_0xf4f6('0x48')]['id']}})[_0xf4f6('0x26')](handleEntityNotFound(_0x5c4c2b,null))['then'](function(_0x4255fa){if(_0x4255fa){_0x159745[_0xf4f6('0x4b')][_0xf4f6('0x50')]=_0x4255fa['id'];_0x159745[_0xf4f6('0x4b')]['Subjects']=integrations[_0xf4f6('0x51')](_0x159745[_0xf4f6('0x4b')][_0xf4f6('0x52')],_0x159745['body'][_0xf4f6('0x2f')]);_0x159745[_0xf4f6('0x4b')][_0xf4f6('0x53')]=integrations[_0xf4f6('0x54')](_0x159745[_0xf4f6('0x4b')][_0xf4f6('0x52')],_0x159745['body'][_0xf4f6('0x2f')]);return db[_0xf4f6('0x4d')][_0xf4f6('0x4a')](_0x159745[_0xf4f6('0x4b')],{'include':[{'model':db[_0xf4f6('0x55')],'as':_0xf4f6('0x56')},{'model':db[_0xf4f6('0x55')],'as':'Descriptions'}]});}return null;})[_0xf4f6('0x26')](respondWithResult(_0x5c4c2b,null))[_0xf4f6('0x46')](handleError(_0x5c4c2b,null));};exports[_0xf4f6('0x57')]=function(_0x1ec574,_0x44e310,_0x1073cb){var _0x38333d='';var _0x51bfa8=['id','name',_0xf4f6('0x58'),'created_by',_0xf4f6('0x59'),'date_start',_0xf4f6('0x5a'),_0xf4f6('0x5b'),'parent_id',_0xf4f6('0x5c'),_0xf4f6('0x5d'),'direction'];return db[_0xf4f6('0x44')][_0xf4f6('0x4c')]({'where':{'id':_0x1ec574[_0xf4f6('0x48')]['id']},'attributes':['id',_0xf4f6('0x5e'),_0xf4f6('0x5f'),_0xf4f6('0x60')]})[_0xf4f6('0x26')](handleEntityNotFound(_0x44e310,null))[_0xf4f6('0x26')](function(_0x11b954){if(_0x11b954){_0x38333d=_0x11b954[_0xf4f6('0x60')];var _0x58faa9=_0x38333d[_0xf4f6('0x61')](-0x1);if(_0x58faa9==='/'){_0x38333d=_0x38333d['substring'](0x0,_0x38333d[_0xf4f6('0x62')](_0x58faa9));}return rp({'method':_0xf4f6('0x63'),'uri':util[_0xf4f6('0x64')](_0xf4f6('0x65'),_0x38333d,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xf4f6('0x66'),'input_type':_0xf4f6('0x67'),'response_type':'JSON','rest_data':JSON[_0xf4f6('0x68')]({'user_auth':{'user_name':_0x11b954[_0xf4f6('0x5e')],'password':_0x11b954[_0xf4f6('0x5f')],'encryption':'PLAIN'},'application':_0xf4f6('0x69')})}});}})[_0xf4f6('0x26')](function(_0x4d33dc){if(_0x4d33dc&&_0x4d33dc['name']!==_0xf4f6('0x6a')&&_0x4d33dc[_0xf4f6('0x2a')]!==_0xf4f6('0x6b')){return rp({'method':_0xf4f6('0x63'),'uri':util[_0xf4f6('0x64')](_0xf4f6('0x65'),_0x38333d,_0xf4f6('0x6c')),'json':!![],'form':{'method':_0xf4f6('0x6d'),'input_type':_0xf4f6('0x67'),'response_type':_0xf4f6('0x67'),'rest_data':JSON['stringify']({'session':_0x4d33dc['id'],'module_name':'Calls'})}})['then'](function(_0x2857af){if(_0x2857af){var _0x47d821=_['values'](_0x2857af[_0xf4f6('0x6e')]);_[_0xf4f6('0x6f')](_0x47d821,function(_0xe03f4d){return _0x51bfa8['includes'](_0xe03f4d[_0xf4f6('0x2a')]);});return{'count':_0x47d821[_0xf4f6('0x37')],'rows':_[_0xf4f6('0x2c')](_0x47d821,function(_0x3c6577){return{'id':_0x3c6577['name'],'name':_0x3c6577[_0xf4f6('0x70')],'custom':_[_0xf4f6('0x71')](_0x3c6577[_0xf4f6('0x2a')],'_c')?!![]:![],'options':_0x3c6577['options']?_[_0xf4f6('0x2c')](_[_0xf4f6('0x72')](_0x3c6577[_0xf4f6('0x41')]),function(_0x472ad6){return{'name':_0x472ad6['value'],'value':_0x472ad6[_0xf4f6('0x2a')]};}):[]};})};}})[_0xf4f6('0x26')](respondWithResult(_0x44e310,null))[_0xf4f6('0x46')](function(_0x559c2e){var _0x3dc28b=_0x1ec574['query'][_0xf4f6('0x73')]?0x1f4:_0x559c2e[_0xf4f6('0x74')]||0x1f4;logger[_0xf4f6('0x75')](_0xf4f6('0x76'),_0xf4f6('0x57'),_0x3dc28b,JSON[_0xf4f6('0x68')](_0x559c2e));delete _0x559c2e[_0xf4f6('0x2a')];if(_0x3dc28b===0x191){_0x3dc28b=0x190;}_0x44e310[_0xf4f6('0x1b')](_0x3dc28b)[_0xf4f6('0x2b')](_0x1ec574[_0xf4f6('0x31')][_0xf4f6('0x73')]?{'message':_0xf4f6('0x77'),'statusCode':_0x559c2e[_0xf4f6('0x74')]}:_0x559c2e);});}else{var _0x568ffc=0x1f4;_0x44e310[_0xf4f6('0x1b')](_0x568ffc)[_0xf4f6('0x2b')]({'message':_0xf4f6('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x30a1=['apply','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmAccount','include','findAll','catch','show','params','find','create','body','destroy','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','created_by','description','date_start','duration_hours','parent_id','parent_name','username','remoteUri','slice','lastIndexOf','format','%s%s','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','includes','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x28bc73,_0x5f29c1){var _0x593d7c=function(_0x1e0896){while(--_0x1e0896){_0x28bc73['push'](_0x28bc73['shift']());}};_0x593d7c(++_0x5f29c1);}(_0x30a1,0x1c2));var _0x130a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x30a1[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x130a('0x0'));var zipdir=require(_0x130a('0x1'));var jsonpatch=require(_0x130a('0x2'));var rp=require(_0x130a('0x3'));var moment=require(_0x130a('0x4'));var BPromise=require(_0x130a('0x5'));var Mustache=require(_0x130a('0x6'));var util=require(_0x130a('0x7'));var path=require(_0x130a('0x8'));var sox=require(_0x130a('0x9'));var csv=require(_0x130a('0xa'));var ejs=require(_0x130a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x130a('0xc'));var squel=require(_0x130a('0xd'));var crypto=require(_0x130a('0xe'));var jsforce=require(_0x130a('0xf'));var deskjs=require(_0x130a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x130a('0x11'));var Papa=require(_0x130a('0x12'));var Redis=require(_0x130a('0x13'));var authService=require(_0x130a('0x14'));var qs=require(_0x130a('0x15'));var as=require(_0x130a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x130a('0x17'))(_0x130a('0x18'));var utils=require('../../config/utils');var config=require(_0x130a('0x19'));var licenseUtil=require(_0x130a('0x1a'));var db=require(_0x130a('0x1b'))['db'];var integrations=require(_0x130a('0x1c'));function respondWithStatusCode(_0x403439,_0x11cfab){_0x11cfab=_0x11cfab||0xcc;return function(_0x28acf1){if(_0x28acf1){return _0x403439[_0x130a('0x1d')](_0x11cfab);}return _0x403439['status'](_0x11cfab)['end']();};}function respondWithResult(_0x57c39c,_0x39715d){_0x39715d=_0x39715d||0xc8;return function(_0x181d5e){if(_0x181d5e){return _0x57c39c[_0x130a('0x1e')](_0x39715d)['json'](_0x181d5e);}};}function respondWithFilteredResult(_0xcfea05,_0xc9588){return function(_0x575650){if(_0x575650){var _0x4f36e1=typeof _0xc9588[_0x130a('0x1f')]===_0x130a('0x20')&&typeof _0xc9588[_0x130a('0x21')]===_0x130a('0x20');var _0x6e84a8=_0x575650['count'];var _0x3fdcd0=_0x4f36e1?0x0:_0xc9588[_0x130a('0x1f')];var _0x193a71=_0x4f36e1?_0x575650[_0x130a('0x22')]:_0xc9588['offset']+_0xc9588[_0x130a('0x21')];var _0x549d85;if(_0x193a71>=_0x6e84a8){_0x193a71=_0x6e84a8;_0x549d85=0xc8;}else{_0x549d85=0xce;}_0xcfea05['status'](_0x549d85);return _0xcfea05[_0x130a('0x23')](_0x130a('0x24'),_0x3fdcd0+'-'+_0x193a71+'/'+_0x6e84a8)[_0x130a('0x25')](_0x575650);}return null;};}function patchUpdates(_0x26ba9f){return function(_0x4b774e){try{jsonpatch[_0x130a('0x26')](_0x4b774e,_0x26ba9f,!![]);}catch(_0x296108){return BPromise['reject'](_0x296108);}return _0x4b774e[_0x130a('0x27')]();};}function saveUpdates(_0x4f80b4,_0x3b3b7a){return function(_0x306654){if(_0x306654){return _0x306654[_0x130a('0x28')](_0x4f80b4)[_0x130a('0x29')](function(_0x2c2c9f){return _0x2c2c9f;});}return null;};}function removeEntity(_0x230b86,_0x1c60de){return function(_0x2d89a5){if(_0x2d89a5){return _0x2d89a5['destroy']()[_0x130a('0x29')](function(){_0x230b86[_0x130a('0x1e')](0xcc)[_0x130a('0x2a')]();});}};}function handleEntityNotFound(_0x5e0d8a,_0x3abb86){return function(_0x298ddc){if(!_0x298ddc){_0x5e0d8a[_0x130a('0x1d')](0x194);}return _0x298ddc;};}function handleError(_0x40f2b1,_0x5ed284){_0x5ed284=_0x5ed284||0x1f4;return function(_0x48318c){logger[_0x130a('0x2b')](_0x48318c[_0x130a('0x2c')]);if(_0x48318c['name']){delete _0x48318c[_0x130a('0x2d')];}_0x40f2b1[_0x130a('0x1e')](_0x5ed284)[_0x130a('0x2e')](_0x48318c);};}exports[_0x130a('0x2f')]=function(_0xbb7be2,_0x54661a){var _0x5b9c4f={},_0x265514={},_0x5e4a7a={'count':0x0,'rows':[]};var _0xdfbee1=_[_0x130a('0x30')](db['SugarcrmAccount'][_0x130a('0x31')],function(_0x3c47fd){return{'name':_0x3c47fd[_0x130a('0x32')],'type':_0x3c47fd[_0x130a('0x33')][_0x130a('0x34')]};});_0x265514['model']=_['map'](_0xdfbee1,_0x130a('0x2d'));_0x265514['query']=_[_0x130a('0x35')](_0xbb7be2[_0x130a('0x36')]);_0x265514[_0x130a('0x37')]=_[_0x130a('0x38')](_0x265514[_0x130a('0x39')],_0x265514['query']);_0x5b9c4f[_0x130a('0x3a')]=_[_0x130a('0x38')](_0x265514[_0x130a('0x39')],qs[_0x130a('0x3b')](_0xbb7be2['query'][_0x130a('0x3b')]));_0x5b9c4f['attributes']=_0x5b9c4f[_0x130a('0x3a')][_0x130a('0x3c')]?_0x5b9c4f['attributes']:_0x265514['model'];if(!_0xbb7be2['query'][_0x130a('0x3d')](_0x130a('0x3e'))){_0x5b9c4f[_0x130a('0x21')]=qs[_0x130a('0x21')](_0xbb7be2[_0x130a('0x36')][_0x130a('0x21')]);_0x5b9c4f[_0x130a('0x1f')]=qs['offset'](_0xbb7be2[_0x130a('0x36')][_0x130a('0x1f')]);}_0x5b9c4f['order']=qs[_0x130a('0x3f')](_0xbb7be2['query']['sort']);_0x5b9c4f[_0x130a('0x40')]=qs[_0x130a('0x37')](_[_0x130a('0x41')](_0xbb7be2[_0x130a('0x36')],_0x265514[_0x130a('0x37')]),_0xdfbee1);if(_0xbb7be2[_0x130a('0x36')][_0x130a('0x42')]){_0x5b9c4f[_0x130a('0x40')]=_[_0x130a('0x43')](_0x5b9c4f[_0x130a('0x40')],{'$or':_[_0x130a('0x30')](_0xdfbee1,function(_0x1b1393){if(_0x1b1393[_0x130a('0x33')]!==_0x130a('0x44')){var _0x2ccbc3={};_0x2ccbc3[_0x1b1393[_0x130a('0x2d')]]={'$like':'%'+_0xbb7be2[_0x130a('0x36')]['filter']+'%'};return _0x2ccbc3;}})});}_0x5b9c4f=_[_0x130a('0x43')]({},_0x5b9c4f,_0xbb7be2[_0x130a('0x45')]);var _0x27ffd2={'where':_0x5b9c4f[_0x130a('0x40')]};return db[_0x130a('0x46')][_0x130a('0x22')](_0x27ffd2)[_0x130a('0x29')](function(_0x40b628){_0x5e4a7a[_0x130a('0x22')]=_0x40b628;if(_0xbb7be2['query']['includeAll']){_0x5b9c4f[_0x130a('0x47')]=[{'all':!![]}];}return db[_0x130a('0x46')][_0x130a('0x48')](_0x5b9c4f);})[_0x130a('0x29')](function(_0x2fb5e5){_0x5e4a7a['rows']=_0x2fb5e5;return _0x5e4a7a;})[_0x130a('0x29')](respondWithFilteredResult(_0x54661a,_0x5b9c4f))[_0x130a('0x49')](handleError(_0x54661a,null));};exports[_0x130a('0x4a')]=function(_0x5dd6e8,_0x5a6508){var _0x3bd9d6={'raw':![],'where':{'id':_0x5dd6e8[_0x130a('0x4b')]['id']}},_0x1e4a34={};_0x1e4a34['model']=_[_0x130a('0x35')](db[_0x130a('0x46')]['rawAttributes']);_0x1e4a34['query']=_[_0x130a('0x35')](_0x5dd6e8[_0x130a('0x36')]);_0x1e4a34[_0x130a('0x37')]=_[_0x130a('0x38')](_0x1e4a34['model'],_0x1e4a34[_0x130a('0x36')]);_0x3bd9d6[_0x130a('0x3a')]=_['intersection'](_0x1e4a34[_0x130a('0x39')],qs[_0x130a('0x3b')](_0x5dd6e8['query'][_0x130a('0x3b')]));_0x3bd9d6[_0x130a('0x3a')]=_0x3bd9d6['attributes'][_0x130a('0x3c')]?_0x3bd9d6['attributes']:_0x1e4a34[_0x130a('0x39')];if(_0x5dd6e8[_0x130a('0x36')]['includeAll']){_0x3bd9d6[_0x130a('0x47')]=[{'all':!![]}];}_0x3bd9d6=_[_0x130a('0x43')]({},_0x3bd9d6,_0x5dd6e8[_0x130a('0x45')]);return db[_0x130a('0x46')][_0x130a('0x4c')](_0x3bd9d6)[_0x130a('0x29')](handleEntityNotFound(_0x5a6508,null))[_0x130a('0x29')](respondWithResult(_0x5a6508,null))[_0x130a('0x49')](handleError(_0x5a6508,null));};exports[_0x130a('0x4d')]=function(_0x37df3e,_0x4546ee){return db[_0x130a('0x46')][_0x130a('0x4d')](_0x37df3e[_0x130a('0x4e')],{})[_0x130a('0x29')](respondWithResult(_0x4546ee,0xc9))[_0x130a('0x49')](handleError(_0x4546ee,null));};exports['update']=function(_0x31776f,_0xb3cecb){if(_0x31776f[_0x130a('0x4e')]['id']){delete _0x31776f[_0x130a('0x4e')]['id'];}return db[_0x130a('0x46')][_0x130a('0x4c')]({'where':{'id':_0x31776f[_0x130a('0x4b')]['id']}})[_0x130a('0x29')](handleEntityNotFound(_0xb3cecb,null))[_0x130a('0x29')](saveUpdates(_0x31776f[_0x130a('0x4e')],null))['then'](respondWithResult(_0xb3cecb,null))[_0x130a('0x49')](handleError(_0xb3cecb,null));};exports[_0x130a('0x4f')]=function(_0x10b732,_0x6baf0c){return db[_0x130a('0x46')][_0x130a('0x4c')]({'where':{'id':_0x10b732[_0x130a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6baf0c,null))[_0x130a('0x29')](removeEntity(_0x6baf0c,null))[_0x130a('0x49')](handleError(_0x6baf0c,null));};exports['getConfigurations']=function(_0x5a43c3,_0x21c3c1,_0x38caa4){var _0x279d49={};var _0x26a6e2={};var _0x54ac3a;var _0x41523b;return db['SugarcrmAccount'][_0x130a('0x50')]({'where':{'id':_0x5a43c3[_0x130a('0x4b')]['id']}})[_0x130a('0x29')](handleEntityNotFound(_0x21c3c1,null))['then'](function(_0x3a744f){if(_0x3a744f){_0x54ac3a=_0x3a744f;_0x26a6e2[_0x130a('0x39')]=_[_0x130a('0x35')](db[_0x130a('0x51')]['rawAttributes']);_0x26a6e2['query']=_['keys'](_0x5a43c3[_0x130a('0x36')]);_0x26a6e2[_0x130a('0x37')]=_[_0x130a('0x38')](_0x26a6e2[_0x130a('0x39')],_0x26a6e2['query']);_0x279d49[_0x130a('0x3a')]=_['intersection'](_0x26a6e2[_0x130a('0x39')],qs[_0x130a('0x3b')](_0x5a43c3['query'][_0x130a('0x3b')]));_0x279d49[_0x130a('0x3a')]=_0x279d49['attributes'][_0x130a('0x3c')]?_0x279d49['attributes']:_0x26a6e2[_0x130a('0x39')];_0x279d49['order']=qs['sort'](_0x5a43c3['query']['sort']);_0x279d49[_0x130a('0x40')]=qs['filters'](_['pick'](_0x5a43c3[_0x130a('0x36')],_0x26a6e2[_0x130a('0x37')]));if(_0x5a43c3[_0x130a('0x36')][_0x130a('0x42')]){_0x279d49[_0x130a('0x40')]=_[_0x130a('0x43')](_0x279d49[_0x130a('0x40')],{'$or':_['map'](_0x279d49[_0x130a('0x3a')],function(_0x55f6d3){var _0x19b851={};_0x19b851[_0x55f6d3]={'$like':'%'+_0x5a43c3[_0x130a('0x36')][_0x130a('0x42')]+'%'};return _0x19b851;})});}_0x279d49=_[_0x130a('0x43')]({},_0x279d49,_0x5a43c3[_0x130a('0x45')]);return _0x54ac3a[_0x130a('0x52')](_0x279d49);}})[_0x130a('0x29')](function(_0x5d7eea){if(_0x5d7eea){_0x41523b=_0x5d7eea['length'];if(!_0x5a43c3[_0x130a('0x36')][_0x130a('0x3d')](_0x130a('0x3e'))){_0x279d49[_0x130a('0x21')]=qs[_0x130a('0x21')](_0x5a43c3['query'][_0x130a('0x21')]);_0x279d49['offset']=qs['offset'](_0x5a43c3[_0x130a('0x36')][_0x130a('0x1f')]);}return _0x54ac3a[_0x130a('0x52')](_0x279d49);}})[_0x130a('0x29')](function(_0x1366b3){if(_0x1366b3){return _0x1366b3?{'count':_0x41523b,'rows':_0x1366b3}:null;}})[_0x130a('0x29')](respondWithResult(_0x21c3c1,null))['catch'](handleError(_0x21c3c1,null));};exports[_0x130a('0x53')]=function(_0x39aa81,_0x7251e4,_0x220c27){if(_0x39aa81[_0x130a('0x4e')]['id']){delete _0x39aa81[_0x130a('0x4e')]['id'];}return db[_0x130a('0x46')][_0x130a('0x50')]({'where':{'id':_0x39aa81[_0x130a('0x4b')]['id']}})[_0x130a('0x29')](handleEntityNotFound(_0x7251e4,null))[_0x130a('0x29')](function(_0x597a04){if(_0x597a04){_0x39aa81[_0x130a('0x4e')][_0x130a('0x54')]=_0x597a04['id'];_0x39aa81['body'][_0x130a('0x55')]=integrations[_0x130a('0x56')](_0x39aa81[_0x130a('0x4e')]['channel'],_0x39aa81['body'][_0x130a('0x33')]);_0x39aa81[_0x130a('0x4e')][_0x130a('0x57')]=integrations[_0x130a('0x58')](_0x39aa81[_0x130a('0x4e')][_0x130a('0x59')],_0x39aa81[_0x130a('0x4e')][_0x130a('0x33')]);return db[_0x130a('0x51')][_0x130a('0x4d')](_0x39aa81[_0x130a('0x4e')],{'include':[{'model':db[_0x130a('0x5a')],'as':_0x130a('0x55')},{'model':db[_0x130a('0x5a')],'as':_0x130a('0x57')}]});}return null;})[_0x130a('0x29')](respondWithResult(_0x7251e4,null))[_0x130a('0x49')](handleError(_0x7251e4,null));};exports['getFields']=function(_0x549ecd,_0x22d13b,_0x5d9633){var _0x296356='';var _0x3be87a=['id','name','assigned_user_id',_0x130a('0x5b'),_0x130a('0x5c'),_0x130a('0x5d'),_0x130a('0x5e'),'duration_minutes',_0x130a('0x5f'),'parent_type',_0x130a('0x60'),'direction'];return db[_0x130a('0x46')][_0x130a('0x50')]({'where':{'id':_0x549ecd[_0x130a('0x4b')]['id']},'attributes':['id',_0x130a('0x61'),'password',_0x130a('0x62')]})[_0x130a('0x29')](handleEntityNotFound(_0x22d13b,null))[_0x130a('0x29')](function(_0x308ee3){if(_0x308ee3){_0x296356=_0x308ee3[_0x130a('0x62')];var _0x14343c=_0x296356[_0x130a('0x63')](-0x1);if(_0x14343c==='/'){_0x296356=_0x296356['substring'](0x0,_0x296356[_0x130a('0x64')](_0x14343c));}return rp({'method':'POST','uri':util[_0x130a('0x65')](_0x130a('0x66'),_0x296356,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x130a('0x67'),'response_type':'JSON','rest_data':JSON[_0x130a('0x68')]({'user_auth':{'user_name':_0x308ee3[_0x130a('0x61')],'password':_0x308ee3[_0x130a('0x69')],'encryption':_0x130a('0x6a')},'application':_0x130a('0x6b')})}});}})['then'](function(_0x962129){if(_0x962129&&_0x962129[_0x130a('0x2d')]!==_0x130a('0x6c')&&_0x962129[_0x130a('0x2d')]!==_0x130a('0x6d')){return rp({'method':'POST','uri':util[_0x130a('0x65')](_0x130a('0x66'),_0x296356,_0x130a('0x6e')),'json':!![],'form':{'method':_0x130a('0x6f'),'input_type':_0x130a('0x67'),'response_type':'JSON','rest_data':JSON[_0x130a('0x68')]({'session':_0x962129['id'],'module_name':_0x130a('0x70')})}})[_0x130a('0x29')](function(_0x1a39a4){if(_0x1a39a4){var _0x293260=_['values'](_0x1a39a4['module_fields']);_['remove'](_0x293260,function(_0x55c765){return _0x3be87a[_0x130a('0x71')](_0x55c765[_0x130a('0x2d')]);});return{'count':_0x293260['length'],'rows':_['map'](_0x293260,function(_0x20170a){return{'id':_0x20170a[_0x130a('0x2d')],'name':_0x20170a['label'],'custom':_[_0x130a('0x72')](_0x20170a[_0x130a('0x2d')],'_c')?!![]:![],'options':_0x20170a['options']?_[_0x130a('0x30')](_[_0x130a('0x73')](_0x20170a[_0x130a('0x45')]),function(_0x2b499a){return{'name':_0x2b499a[_0x130a('0x74')],'value':_0x2b499a[_0x130a('0x2d')]};}):[]};})};}})['then'](respondWithResult(_0x22d13b,null))[_0x130a('0x49')](function(_0x35ae54){var _0x1d20fa=_0x549ecd[_0x130a('0x36')][_0x130a('0x75')]?0x1f4:_0x35ae54[_0x130a('0x76')]||0x1f4;logger[_0x130a('0x2b')](_0x130a('0x77'),_0x130a('0x78'),_0x1d20fa,JSON[_0x130a('0x68')](_0x35ae54));delete _0x35ae54[_0x130a('0x2d')];if(_0x1d20fa===0x191){_0x1d20fa=0x190;}_0x22d13b[_0x130a('0x1e')](_0x1d20fa)[_0x130a('0x2e')](_0x549ecd[_0x130a('0x36')][_0x130a('0x75')]?{'message':_0x130a('0x79'),'statusCode':_0x35ae54[_0x130a('0x76')]}:_0x35ae54);});}else{var _0x1aa4a3=0x1f4;_0x22d13b['status'](_0x1aa4a3)[_0x130a('0x2e')]({'message':_0x130a('0x79'),'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 aa178e1..099089b 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 _0x6bd1=['../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x32e926,_0x5357c9){var _0x53db3c=function(_0x221b97){while(--_0x221b97){_0x32e926['push'](_0x32e926['shift']());}};_0x53db3c(++_0x5357c9);}(_0x6bd1,0xe8));var _0x16bd=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6bd1[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x16bd('0x0'));var util=require(_0x16bd('0x1'));var logger=require(_0x16bd('0x2'))(_0x16bd('0x3'));var moment=require(_0x16bd('0x4'));var BPromise=require(_0x16bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x16bd('0x6'));var rimraf=require(_0x16bd('0x7'));var config=require(_0x16bd('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x16bd('0x9'));module[_0x16bd('0xa')]=function(_0x58a6fe,_0x5d4305){return _0x58a6fe['define'](_0x16bd('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x749c=['int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define'];(function(_0x2680e3,_0x243387){var _0x3e789f=function(_0x487950){while(--_0x487950){_0x2680e3['push'](_0x2680e3['shift']());}};_0x3e789f(++_0x243387);}(_0x749c,0x17a));var _0xc749=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0x749c[_0x261b8a];return _0x3455e8;};'use strict';var _=require(_0xc749('0x0'));var util=require(_0xc749('0x1'));var logger=require(_0xc749('0x2'))(_0xc749('0x3'));var moment=require('moment');var BPromise=require(_0xc749('0x4'));var rp=require(_0xc749('0x5'));var fs=require('fs');var path=require(_0xc749('0x6'));var rimraf=require(_0xc749('0x7'));var config=require(_0xc749('0x8'));var attributes=require(_0xc749('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xc749('0xa')]=function(_0x4adb3e,_0xc3d477){return _0x4adb3e[_0xc749('0xb')]('SugarcrmAccount',attributes,{'tableName':_0xc749('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 065ec3c..aeb41de 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 _0x6cc9=['catch','SugarcrmAccount','find','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','limit','include','map','model','attributes','GetSugarcrmAccount'];(function(_0x4823fd,_0x35ea05){var _0x221af7=function(_0x34e175){while(--_0x34e175){_0x4823fd['push'](_0x4823fd['shift']());}};_0x221af7(++_0x35ea05);}(_0x6cc9,0x1c0));var _0x96cc=function(_0x207d66,_0x3afc91){_0x207d66=_0x207d66-0x0;var _0x430402=_0x6cc9[_0x207d66];return _0x430402;};'use strict';var _=require(_0x96cc('0x0'));var util=require(_0x96cc('0x1'));var moment=require(_0x96cc('0x2'));var BPromise=require(_0x96cc('0x3'));var rs=require(_0x96cc('0x4'));var fs=require('fs');var Redis=require(_0x96cc('0x5'));var db=require(_0x96cc('0x6'))['db'];var utils=require(_0x96cc('0x7'));var logger=require('../../config/logger')(_0x96cc('0x8'));var config=require(_0x96cc('0x9'));var jayson=require(_0x96cc('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x148918,_0x39a6aa,_0x1760e0){return new BPromise(function(_0x1ec42a,_0x27aac6){return client[_0x96cc('0xb')](_0x148918,_0x1760e0)[_0x96cc('0xc')](function(_0x39d80b){logger[_0x96cc('0xd')](_0x96cc('0xe'),_0x39a6aa,_0x96cc('0xf'));logger[_0x96cc('0x10')](_0x96cc('0x11'),_0x39a6aa,_0x96cc('0xf'),JSON[_0x96cc('0x12')](_0x39d80b));if(_0x39d80b[_0x96cc('0x13')]){if(_0x39d80b[_0x96cc('0x13')][_0x96cc('0x14')]===0x1f4){logger[_0x96cc('0x13')](_0x96cc('0xe'),_0x39a6aa,_0x39d80b[_0x96cc('0x13')][_0x96cc('0x15')]);return _0x27aac6(_0x39d80b[_0x96cc('0x13')][_0x96cc('0x15')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x39a6aa,_0x39d80b[_0x96cc('0x13')][_0x96cc('0x15')]);return _0x1ec42a(_0x39d80b['error'][_0x96cc('0x15')]);}else{logger[_0x96cc('0xd')](_0x96cc('0xe'),_0x39a6aa,'request\x20sent');_0x1ec42a(_0x39d80b[_0x96cc('0x16')][_0x96cc('0x15')]);}})['catch'](function(_0x2fca84){logger['error'](_0x96cc('0xe'),_0x39a6aa,_0x2fca84);_0x27aac6(_0x2fca84);});});}exports['GetSugarcrmAccount']=function(_0x59edb7){var _0x4ba870=this;return new Promise(function(_0x394d34,_0x2c8c9e){return db['SugarcrmAccount'][_0x96cc('0x17')]({'raw':_0x59edb7[_0x96cc('0x18')]?_0x59edb7[_0x96cc('0x18')][_0x96cc('0x19')]===undefined?!![]:![]:!![],'where':_0x59edb7[_0x96cc('0x18')]?_0x59edb7['options'][_0x96cc('0x1a')]||null:null,'attributes':_0x59edb7['options']?_0x59edb7[_0x96cc('0x18')]['attributes']||null:null,'limit':_0x59edb7[_0x96cc('0x18')]?_0x59edb7[_0x96cc('0x18')][_0x96cc('0x1b')]||null:null,'include':_0x59edb7[_0x96cc('0x18')]?_0x59edb7[_0x96cc('0x18')][_0x96cc('0x1c')]?_[_0x96cc('0x1d')](_0x59edb7[_0x96cc('0x18')][_0x96cc('0x1c')],function(_0x11183e){return{'model':db[_0x11183e['model']],'as':_0x11183e['as'],'attributes':_0x11183e['attributes'],'include':_0x11183e[_0x96cc('0x1c')]?_[_0x96cc('0x1d')](_0x11183e['include'],function(_0x13e478){return{'model':db[_0x13e478[_0x96cc('0x1e')]],'as':_0x13e478['as'],'attributes':_0x13e478[_0x96cc('0x1f')],'include':_0x13e478['include']?_[_0x96cc('0x1d')](_0x13e478[_0x96cc('0x1c')],function(_0x540c4f){return{'model':db[_0x540c4f['model']],'as':_0x540c4f['as'],'attributes':_0x540c4f[_0x96cc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x96cc('0xc')](function(_0x38d47b){logger['info']('GetSugarcrmAccount',_0x59edb7);logger[_0x96cc('0x10')](_0x96cc('0x20'),_0x59edb7,JSON[_0x96cc('0x12')](_0x38d47b));_0x394d34(_0x38d47b);})[_0x96cc('0x21')](function(_0x458526){logger['error']('GetSugarcrmAccount',_0x458526[_0x96cc('0x15')],_0x59edb7);_0x2c8c9e(_0x4ba870[_0x96cc('0x13')](0x1f4,_0x458526['message']));});});};exports['ShowSugarcrmAccount']=function(_0x5dde05){var _0x804ad1=this;return new Promise(function(_0x3e7944,_0x5df4e4){return db[_0x96cc('0x22')][_0x96cc('0x23')]({'raw':_0x5dde05['options']?_0x5dde05[_0x96cc('0x18')][_0x96cc('0x19')]===undefined?!![]:![]:!![],'where':_0x5dde05[_0x96cc('0x18')]?_0x5dde05[_0x96cc('0x18')][_0x96cc('0x1a')]||null:null,'attributes':_0x5dde05[_0x96cc('0x18')]?_0x5dde05[_0x96cc('0x18')][_0x96cc('0x1f')]||null:null,'include':_0x5dde05[_0x96cc('0x18')]?_0x5dde05[_0x96cc('0x18')][_0x96cc('0x1c')]?_[_0x96cc('0x1d')](_0x5dde05[_0x96cc('0x18')][_0x96cc('0x1c')],function(_0x3789bc){return{'model':db[_0x3789bc[_0x96cc('0x1e')]],'as':_0x3789bc['as'],'attributes':_0x3789bc[_0x96cc('0x1f')],'include':_0x3789bc[_0x96cc('0x1c')]?_['map'](_0x3789bc[_0x96cc('0x1c')],function(_0x2860e0){return{'model':db[_0x2860e0[_0x96cc('0x1e')]],'as':_0x2860e0['as'],'attributes':_0x2860e0[_0x96cc('0x1f')],'include':_0x2860e0[_0x96cc('0x1c')]?_[_0x96cc('0x1d')](_0x2860e0[_0x96cc('0x1c')],function(_0x52e092){return{'model':db[_0x52e092[_0x96cc('0x1e')]],'as':_0x52e092['as'],'attributes':_0x52e092[_0x96cc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x96cc('0xc')](function(_0x1cca08){logger[_0x96cc('0xd')](_0x96cc('0x24'),_0x5dde05);logger[_0x96cc('0x10')]('ShowSugarcrmAccount',_0x5dde05,JSON[_0x96cc('0x12')](_0x1cca08));_0x3e7944(_0x1cca08);})[_0x96cc('0x21')](function(_0x480803){logger[_0x96cc('0x13')]('ShowSugarcrmAccount',_0x480803['message'],_0x5dde05);_0x5df4e4(_0x804ad1[_0x96cc('0x13')](0x1f4,_0x480803[_0x96cc('0x15')]));});});}; \ No newline at end of file +var _0x7670=['rpc','../../config/environment','client','http','request','then','request\x20sent','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','map','include','model','catch','ShowSugarcrmAccount','find','debug','lodash','util','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x7670,0xc6));var _0x0767=function(_0x1dca05,_0x1b0cbb){_0x1dca05=_0x1dca05-0x0;var _0x5e7c30=_0x7670[_0x1dca05];return _0x5e7c30;};'use strict';var _=require(_0x0767('0x0'));var util=require(_0x0767('0x1'));var moment=require('moment');var BPromise=require(_0x0767('0x2'));var rs=require(_0x0767('0x3'));var fs=require('fs');var Redis=require(_0x0767('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0767('0x5'))(_0x0767('0x6'));var config=require(_0x0767('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0767('0x8')][_0x0767('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x490521,_0x55879e,_0x5e83c3){return new BPromise(function(_0x1b1dae,_0x45ff9c){return client[_0x0767('0xa')](_0x490521,_0x5e83c3)[_0x0767('0xb')](function(_0x92b15c){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x55879e,_0x0767('0xc'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x55879e,_0x0767('0xc'),JSON[_0x0767('0xd')](_0x92b15c));if(_0x92b15c['error']){if(_0x92b15c[_0x0767('0xe')][_0x0767('0xf')]===0x1f4){logger[_0x0767('0xe')](_0x0767('0x10'),_0x55879e,_0x92b15c['error']['message']);return _0x45ff9c(_0x92b15c[_0x0767('0xe')][_0x0767('0x11')]);}logger[_0x0767('0xe')](_0x0767('0x10'),_0x55879e,_0x92b15c['error'][_0x0767('0x11')]);return _0x1b1dae(_0x92b15c['error'][_0x0767('0x11')]);}else{logger[_0x0767('0x12')](_0x0767('0x10'),_0x55879e,_0x0767('0xc'));_0x1b1dae(_0x92b15c[_0x0767('0x13')][_0x0767('0x11')]);}})['catch'](function(_0x231896){logger[_0x0767('0xe')](_0x0767('0x10'),_0x55879e,_0x231896);_0x45ff9c(_0x231896);});});}exports[_0x0767('0x14')]=function(_0x205398){var _0x26cc4e=this;return new Promise(function(_0x2657cb,_0x6e6fc8){return db[_0x0767('0x15')][_0x0767('0x16')]({'raw':_0x205398['options']?_0x205398[_0x0767('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x205398[_0x0767('0x17')]?_0x205398[_0x0767('0x17')][_0x0767('0x18')]||null:null,'attributes':_0x205398[_0x0767('0x17')]?_0x205398[_0x0767('0x17')][_0x0767('0x19')]||null:null,'limit':_0x205398[_0x0767('0x17')]?_0x205398[_0x0767('0x17')][_0x0767('0x1a')]||null:null,'include':_0x205398[_0x0767('0x17')]?_0x205398['options']['include']?_[_0x0767('0x1b')](_0x205398[_0x0767('0x17')][_0x0767('0x1c')],function(_0x48073f){return{'model':db[_0x48073f['model']],'as':_0x48073f['as'],'attributes':_0x48073f['attributes'],'include':_0x48073f[_0x0767('0x1c')]?_[_0x0767('0x1b')](_0x48073f[_0x0767('0x1c')],function(_0x1ce10c){return{'model':db[_0x1ce10c[_0x0767('0x1d')]],'as':_0x1ce10c['as'],'attributes':_0x1ce10c['attributes'],'include':_0x1ce10c[_0x0767('0x1c')]?_[_0x0767('0x1b')](_0x1ce10c[_0x0767('0x1c')],function(_0x30e364){return{'model':db[_0x30e364['model']],'as':_0x30e364['as'],'attributes':_0x30e364['attributes']};}):[]};}):[]};}):[]:[]})[_0x0767('0xb')](function(_0x6f4035){logger[_0x0767('0x12')](_0x0767('0x14'),_0x205398);logger['debug'](_0x0767('0x14'),_0x205398,JSON[_0x0767('0xd')](_0x6f4035));_0x2657cb(_0x6f4035);})[_0x0767('0x1e')](function(_0x378798){logger[_0x0767('0xe')](_0x0767('0x14'),_0x378798[_0x0767('0x11')],_0x205398);_0x6e6fc8(_0x26cc4e[_0x0767('0xe')](0x1f4,_0x378798[_0x0767('0x11')]));});});};exports[_0x0767('0x1f')]=function(_0x191bea){var _0x9fbaa7=this;return new Promise(function(_0x3d3fe5,_0x570e56){return db[_0x0767('0x15')][_0x0767('0x20')]({'raw':_0x191bea[_0x0767('0x17')]?_0x191bea[_0x0767('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x191bea[_0x0767('0x17')]?_0x191bea['options'][_0x0767('0x18')]||null:null,'attributes':_0x191bea[_0x0767('0x17')]?_0x191bea[_0x0767('0x17')][_0x0767('0x19')]||null:null,'include':_0x191bea[_0x0767('0x17')]?_0x191bea[_0x0767('0x17')][_0x0767('0x1c')]?_['map'](_0x191bea[_0x0767('0x17')][_0x0767('0x1c')],function(_0x5640fe){return{'model':db[_0x5640fe[_0x0767('0x1d')]],'as':_0x5640fe['as'],'attributes':_0x5640fe[_0x0767('0x19')],'include':_0x5640fe[_0x0767('0x1c')]?_[_0x0767('0x1b')](_0x5640fe['include'],function(_0x5099f8){return{'model':db[_0x5099f8[_0x0767('0x1d')]],'as':_0x5099f8['as'],'attributes':_0x5099f8[_0x0767('0x19')],'include':_0x5099f8[_0x0767('0x1c')]?_['map'](_0x5099f8[_0x0767('0x1c')],function(_0x1fa01c){return{'model':db[_0x1fa01c['model']],'as':_0x1fa01c['as'],'attributes':_0x1fa01c[_0x0767('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0767('0xb')](function(_0x2ad9f6){logger[_0x0767('0x12')]('ShowSugarcrmAccount',_0x191bea);logger[_0x0767('0x21')]('ShowSugarcrmAccount',_0x191bea,JSON[_0x0767('0xd')](_0x2ad9f6));_0x3d3fe5(_0x2ad9f6);})[_0x0767('0x1e')](function(_0x4f1447){logger['error']('ShowSugarcrmAccount',_0x4f1447['message'],_0x191bea);_0x570e56(_0x9fbaa7[_0x0767('0xe')](0x1f4,_0x4f1447[_0x0767('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 5bf227f..8ef84ab 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 _0x0c18=['getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','getFields','/:id/subjects'];(function(_0x4ea145,_0x25fefc){var _0xbbd394=function(_0x26eafb){while(--_0x26eafb){_0x4ea145['push'](_0x4ea145['shift']());}};_0xbbd394(++_0x25fefc);}(_0x0c18,0x111));var _0x80c1=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x0c18[_0x166742];return _0xb7814a;};'use strict';var multer=require(_0x80c1('0x0'));var util=require(_0x80c1('0x1'));var path=require(_0x80c1('0x2'));var timeout=require(_0x80c1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x80c1('0x4'));var interaction=require(_0x80c1('0x5'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x80c1('0x6')]);router[_0x80c1('0x7')](_0x80c1('0x8'),auth[_0x80c1('0x9')](),controller[_0x80c1('0xa')]);router[_0x80c1('0x7')]('/:id/fields',auth[_0x80c1('0x9')](),controller[_0x80c1('0xb')]);router['get'](_0x80c1('0xc'),auth[_0x80c1('0x9')](),controller[_0x80c1('0xd')]);router[_0x80c1('0x7')](_0x80c1('0xe'),auth['isAuthenticated'](),controller[_0x80c1('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x80c1('0x10')]);router[_0x80c1('0x11')](_0x80c1('0x8'),auth[_0x80c1('0x9')](),controller[_0x80c1('0x12')]);router[_0x80c1('0x13')]('/:id',auth[_0x80c1('0x9')](),controller[_0x80c1('0x14')]);module[_0x80c1('0x15')]=router; \ No newline at end of file +var _0x5e41=['/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x19157c,_0x30f3b1){var _0x4f042f=function(_0x47df69){while(--_0x47df69){_0x19157c['push'](_0x19157c['shift']());}};_0x4f042f(++_0x30f3b1);}(_0x5e41,0x11d));var _0x15e4=function(_0x31a437,_0xf91821){_0x31a437=_0x31a437-0x0;var _0x50eedf=_0x5e41[_0x31a437];return _0x50eedf;};'use strict';var multer=require(_0x15e4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x15e4('0x1'));var express=require(_0x15e4('0x2'));var router=express[_0x15e4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x15e4('0x4'));var interaction=require(_0x15e4('0x5'));var config=require('../../config/environment');var controller=require(_0x15e4('0x6'));router[_0x15e4('0x7')]('/',auth[_0x15e4('0x8')](),controller[_0x15e4('0x9')]);router[_0x15e4('0x7')](_0x15e4('0xa'),auth['isAuthenticated'](),controller[_0x15e4('0xb')]);router[_0x15e4('0x7')](_0x15e4('0xc'),auth[_0x15e4('0x8')](),controller[_0x15e4('0xd')]);router[_0x15e4('0x7')](_0x15e4('0xe'),auth[_0x15e4('0x8')](),controller[_0x15e4('0xf')]);router[_0x15e4('0x7')]('/:id/descriptions',auth[_0x15e4('0x8')](),controller[_0x15e4('0x10')]);router[_0x15e4('0x11')]('/',auth[_0x15e4('0x8')](),controller['create']);router[_0x15e4('0x12')](_0x15e4('0xa'),auth['isAuthenticated'](),controller[_0x15e4('0x13')]);router[_0x15e4('0x14')](_0x15e4('0xa'),auth[_0x15e4('0x8')](),controller[_0x15e4('0x15')]);module[_0x15e4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 3b51f87..d2a3b0f 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 _0x68a6=['STRING','sequelize','exports'];(function(_0x293ed8,_0x1e180a){var _0x3b26be=function(_0x3561e4){while(--_0x3561e4){_0x293ed8['push'](_0x293ed8['shift']());}};_0x3b26be(++_0x1e180a);}(_0x68a6,0x1ed));var _0x668a=function(_0x3d9b75,_0x404537){_0x3d9b75=_0x3d9b75-0x0;var _0x14e2b1=_0x68a6[_0x3d9b75];return _0x14e2b1;};'use strict';var Sequelize=require(_0x668a('0x0'));module[_0x668a('0x1')]={'name':{'type':Sequelize[_0x668a('0x2')]},'description':{'type':Sequelize[_0x668a('0x2')]}}; \ No newline at end of file +var _0x3cbd=['STRING','sequelize'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x3cbd,0x19d));var _0xd3cb=function(_0x9f2af9,_0x55141a){_0x9f2af9=_0x9f2af9-0x0;var _0x24aa62=_0x3cbd[_0x9f2af9];return _0x24aa62;};'use strict';var Sequelize=require(_0xd3cb('0x0'));module['exports']={'name':{'type':Sequelize[_0xd3cb('0x1')]},'description':{'type':Sequelize[_0xd3cb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 7952eaf..85ba18a 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 _0xa941=['then','sendStatus','error','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','length','options','catch','create','body','find','destroy','findOne','SugarcrmField','getFields','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save'];(function(_0x156988,_0x43327e){var _0x5f740b=function(_0x4f588b){while(--_0x4f588b){_0x156988['push'](_0x156988['shift']());}};_0x5f740b(++_0x43327e);}(_0xa941,0xce));var _0x1a94=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa941[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x1a94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a94('0x1'));var jsonpatch=require(_0x1a94('0x2'));var rp=require('request-promise');var moment=require(_0x1a94('0x3'));var BPromise=require(_0x1a94('0x4'));var Mustache=require(_0x1a94('0x5'));var util=require(_0x1a94('0x6'));var path=require(_0x1a94('0x7'));var sox=require(_0x1a94('0x8'));var csv=require(_0x1a94('0x9'));var ejs=require(_0x1a94('0xa'));var fs=require('fs');var fs_extra=require(_0x1a94('0xb'));var _=require(_0x1a94('0xc'));var squel=require(_0x1a94('0xd'));var crypto=require('crypto');var jsforce=require(_0x1a94('0xe'));var deskjs=require(_0x1a94('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1a94('0x10'));var Papa=require(_0x1a94('0x11'));var Redis=require('ioredis');var authService=require(_0x1a94('0x12'));var qs=require(_0x1a94('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a94('0x14'));var logger=require(_0x1a94('0x15'))(_0x1a94('0x16'));var utils=require('../../config/utils');var config=require(_0x1a94('0x17'));var licenseUtil=require(_0x1a94('0x18'));var db=require(_0x1a94('0x19'))['db'];function respondWithStatusCode(_0x5eaf45,_0x36b6f9){_0x36b6f9=_0x36b6f9||0xcc;return function(_0x39ca28){if(_0x39ca28){return _0x5eaf45['sendStatus'](_0x36b6f9);}return _0x5eaf45[_0x1a94('0x1a')](_0x36b6f9)[_0x1a94('0x1b')]();};}function respondWithResult(_0x1eb0bb,_0x12455e){_0x12455e=_0x12455e||0xc8;return function(_0x5ca8e9){if(_0x5ca8e9){return _0x1eb0bb[_0x1a94('0x1a')](_0x12455e)[_0x1a94('0x1c')](_0x5ca8e9);}};}function respondWithFilteredResult(_0x5e75d4,_0x2b0da9){return function(_0x2fb21f){if(_0x2fb21f){var _0x500e9f=typeof _0x2b0da9[_0x1a94('0x1d')]===_0x1a94('0x1e')&&typeof _0x2b0da9[_0x1a94('0x1f')]===_0x1a94('0x1e');var _0x1b65c5=_0x2fb21f[_0x1a94('0x20')];var _0x53569c=_0x500e9f?0x0:_0x2b0da9['offset'];var _0x57dea4=_0x500e9f?_0x2fb21f[_0x1a94('0x20')]:_0x2b0da9['offset']+_0x2b0da9[_0x1a94('0x1f')];var _0x1f2767;if(_0x57dea4>=_0x1b65c5){_0x57dea4=_0x1b65c5;_0x1f2767=0xc8;}else{_0x1f2767=0xce;}_0x5e75d4['status'](_0x1f2767);return _0x5e75d4[_0x1a94('0x21')](_0x1a94('0x22'),_0x53569c+'-'+_0x57dea4+'/'+_0x1b65c5)[_0x1a94('0x1c')](_0x2fb21f);}return null;};}function patchUpdates(_0x3423c4){return function(_0x2e6fa4){try{jsonpatch['apply'](_0x2e6fa4,_0x3423c4,!![]);}catch(_0x11da38){return BPromise[_0x1a94('0x23')](_0x11da38);}return _0x2e6fa4[_0x1a94('0x24')]();};}function saveUpdates(_0xf3b82b,_0x3a9fea){return function(_0x55ccea){if(_0x55ccea){return _0x55ccea['update'](_0xf3b82b)[_0x1a94('0x25')](function(_0x5752e9){return _0x5752e9;});}return null;};}function removeEntity(_0x14d048,_0x1d6440){return function(_0x8fb723){if(_0x8fb723){return _0x8fb723['destroy']()[_0x1a94('0x25')](function(){_0x14d048[_0x1a94('0x1a')](0xcc)[_0x1a94('0x1b')]();});}};}function handleEntityNotFound(_0x2e3212,_0x3f3fd1){return function(_0x4de3fa){if(!_0x4de3fa){_0x2e3212[_0x1a94('0x26')](0x194);}return _0x4de3fa;};}function handleError(_0x2866fc,_0x414a51){_0x414a51=_0x414a51||0x1f4;return function(_0x3c5377){logger[_0x1a94('0x27')](_0x3c5377['stack']);if(_0x3c5377[_0x1a94('0x28')]){delete _0x3c5377[_0x1a94('0x28')];}_0x2866fc['status'](_0x414a51)['send'](_0x3c5377);};}exports[_0x1a94('0x29')]=function(_0x30207d,_0x316c2c){var _0x3885d1={},_0x1a20c7={},_0x2ace1b={'count':0x0,'rows':[]};var _0x564498=_[_0x1a94('0x2a')](db[_0x1a94('0x2b')][_0x1a94('0x2c')],function(_0x401450){return{'name':_0x401450[_0x1a94('0x2d')],'type':_0x401450[_0x1a94('0x2e')]['key']};});_0x1a20c7[_0x1a94('0x2f')]=_[_0x1a94('0x2a')](_0x564498,'name');_0x1a20c7[_0x1a94('0x30')]=_[_0x1a94('0x31')](_0x30207d[_0x1a94('0x30')]);_0x1a20c7[_0x1a94('0x32')]=_[_0x1a94('0x33')](_0x1a20c7[_0x1a94('0x2f')],_0x1a20c7[_0x1a94('0x30')]);_0x3885d1[_0x1a94('0x34')]=_['intersection'](_0x1a20c7[_0x1a94('0x2f')],qs[_0x1a94('0x35')](_0x30207d[_0x1a94('0x30')][_0x1a94('0x35')]));_0x3885d1[_0x1a94('0x34')]=_0x3885d1['attributes']['length']?_0x3885d1[_0x1a94('0x34')]:_0x1a20c7['model'];if(!_0x30207d[_0x1a94('0x30')][_0x1a94('0x36')]('nolimit')){_0x3885d1['limit']=qs['limit'](_0x30207d[_0x1a94('0x30')][_0x1a94('0x1f')]);_0x3885d1[_0x1a94('0x1d')]=qs[_0x1a94('0x1d')](_0x30207d[_0x1a94('0x30')][_0x1a94('0x1d')]);}_0x3885d1[_0x1a94('0x37')]=qs[_0x1a94('0x38')](_0x30207d[_0x1a94('0x30')][_0x1a94('0x38')]);_0x3885d1[_0x1a94('0x39')]=qs['filters'](_[_0x1a94('0x3a')](_0x30207d[_0x1a94('0x30')],_0x1a20c7[_0x1a94('0x32')]),_0x564498);if(_0x30207d['query'][_0x1a94('0x3b')]){_0x3885d1[_0x1a94('0x39')]=_['merge'](_0x3885d1[_0x1a94('0x39')],{'$or':_[_0x1a94('0x2a')](_0x564498,function(_0x4db7e0){if(_0x4db7e0[_0x1a94('0x2e')]!==_0x1a94('0x3c')){var _0x123297={};_0x123297[_0x4db7e0[_0x1a94('0x28')]]={'$like':'%'+_0x30207d[_0x1a94('0x30')]['filter']+'%'};return _0x123297;}})});}_0x3885d1=_[_0x1a94('0x3d')]({},_0x3885d1,_0x30207d['options']);var _0x539c9c={'where':_0x3885d1[_0x1a94('0x39')]};return db[_0x1a94('0x2b')][_0x1a94('0x20')](_0x539c9c)['then'](function(_0x7e6c3f){_0x2ace1b['count']=_0x7e6c3f;if(_0x30207d[_0x1a94('0x30')][_0x1a94('0x3e')]){_0x3885d1[_0x1a94('0x3f')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x1a94('0x40')](_0x3885d1);})['then'](function(_0x3aeaa9){_0x2ace1b[_0x1a94('0x41')]=_0x3aeaa9;return _0x2ace1b;})['then'](respondWithFilteredResult(_0x316c2c,_0x3885d1))['catch'](handleError(_0x316c2c,null));};exports[_0x1a94('0x42')]=function(_0x4195f5,_0x32faec){var _0x2a6581={'raw':![],'where':{'id':_0x4195f5[_0x1a94('0x43')]['id']}},_0x4d2a71={};_0x4d2a71[_0x1a94('0x2f')]=_['keys'](db[_0x1a94('0x2b')][_0x1a94('0x2c')]);_0x4d2a71[_0x1a94('0x30')]=_[_0x1a94('0x31')](_0x4195f5['query']);_0x4d2a71['filters']=_[_0x1a94('0x33')](_0x4d2a71[_0x1a94('0x2f')],_0x4d2a71[_0x1a94('0x30')]);_0x2a6581[_0x1a94('0x34')]=_['intersection'](_0x4d2a71['model'],qs[_0x1a94('0x35')](_0x4195f5['query'][_0x1a94('0x35')]));_0x2a6581[_0x1a94('0x34')]=_0x2a6581[_0x1a94('0x34')][_0x1a94('0x44')]?_0x2a6581[_0x1a94('0x34')]:_0x4d2a71[_0x1a94('0x2f')];if(_0x4195f5[_0x1a94('0x30')][_0x1a94('0x3e')]){_0x2a6581[_0x1a94('0x3f')]=[{'all':!![]}];}_0x2a6581=_[_0x1a94('0x3d')]({},_0x2a6581,_0x4195f5[_0x1a94('0x45')]);return db[_0x1a94('0x2b')]['find'](_0x2a6581)[_0x1a94('0x25')](handleEntityNotFound(_0x32faec,null))[_0x1a94('0x25')](respondWithResult(_0x32faec,null))[_0x1a94('0x46')](handleError(_0x32faec,null));};exports[_0x1a94('0x47')]=function(_0x11616e,_0x3a268d){return db[_0x1a94('0x2b')][_0x1a94('0x47')](_0x11616e[_0x1a94('0x48')],{})[_0x1a94('0x25')](respondWithResult(_0x3a268d,0xc9))[_0x1a94('0x46')](handleError(_0x3a268d,null));};exports['update']=function(_0x2938de,_0x97df35){if(_0x2938de[_0x1a94('0x48')]['id']){delete _0x2938de[_0x1a94('0x48')]['id'];}return db[_0x1a94('0x2b')][_0x1a94('0x49')]({'where':{'id':_0x2938de[_0x1a94('0x43')]['id']}})[_0x1a94('0x25')](handleEntityNotFound(_0x97df35,null))[_0x1a94('0x25')](saveUpdates(_0x2938de[_0x1a94('0x48')],null))[_0x1a94('0x25')](respondWithResult(_0x97df35,null))[_0x1a94('0x46')](handleError(_0x97df35,null));};exports[_0x1a94('0x4a')]=function(_0x5141ce,_0x55bcdb){return db[_0x1a94('0x2b')][_0x1a94('0x49')]({'where':{'id':_0x5141ce[_0x1a94('0x43')]['id']}})['then'](handleEntityNotFound(_0x55bcdb,null))['then'](removeEntity(_0x55bcdb,null))[_0x1a94('0x46')](handleError(_0x55bcdb,null));};exports['getFields']=function(_0x376a68,_0x4efa0a,_0x1887be){var _0x36b593={};var _0x137c1a={};var _0x205f81;var _0x56aa41;return db[_0x1a94('0x2b')][_0x1a94('0x4b')]({'where':{'id':_0x376a68[_0x1a94('0x43')]['id']}})[_0x1a94('0x25')](handleEntityNotFound(_0x4efa0a,null))[_0x1a94('0x25')](function(_0x33a477){if(_0x33a477){_0x205f81=_0x33a477;_0x137c1a['model']=_[_0x1a94('0x31')](db[_0x1a94('0x4c')][_0x1a94('0x2c')]);_0x137c1a[_0x1a94('0x30')]=_['keys'](_0x376a68[_0x1a94('0x30')]);_0x137c1a['filters']=_[_0x1a94('0x33')](_0x137c1a['model'],_0x137c1a[_0x1a94('0x30')]);_0x36b593['attributes']=_['intersection'](_0x137c1a['model'],qs[_0x1a94('0x35')](_0x376a68[_0x1a94('0x30')][_0x1a94('0x35')]));_0x36b593[_0x1a94('0x34')]=_0x36b593[_0x1a94('0x34')]['length']?_0x36b593[_0x1a94('0x34')]:_0x137c1a['model'];_0x36b593['order']=qs[_0x1a94('0x38')](_0x376a68[_0x1a94('0x30')][_0x1a94('0x38')]);_0x36b593[_0x1a94('0x39')]=qs[_0x1a94('0x32')](_[_0x1a94('0x3a')](_0x376a68['query'],_0x137c1a[_0x1a94('0x32')]));if(_0x376a68[_0x1a94('0x30')][_0x1a94('0x3b')]){_0x36b593['where']=_[_0x1a94('0x3d')](_0x36b593[_0x1a94('0x39')],{'$or':_[_0x1a94('0x2a')](_0x36b593[_0x1a94('0x34')],function(_0x2e4aa3){var _0x58957a={};_0x58957a[_0x2e4aa3]={'$like':'%'+_0x376a68[_0x1a94('0x30')]['filter']+'%'};return _0x58957a;})});}_0x36b593=_[_0x1a94('0x3d')]({},_0x36b593,_0x376a68[_0x1a94('0x45')]);return _0x205f81[_0x1a94('0x4d')](_0x36b593);}})[_0x1a94('0x25')](function(_0x52753f){if(_0x52753f){_0x56aa41=_0x52753f[_0x1a94('0x44')];if(!_0x376a68[_0x1a94('0x30')][_0x1a94('0x36')](_0x1a94('0x4e'))){_0x36b593[_0x1a94('0x1f')]=qs['limit'](_0x376a68[_0x1a94('0x30')][_0x1a94('0x1f')]);_0x36b593[_0x1a94('0x1d')]=qs[_0x1a94('0x1d')](_0x376a68['query'][_0x1a94('0x1d')]);}return _0x205f81[_0x1a94('0x4d')](_0x36b593);}})[_0x1a94('0x25')](function(_0x343132){if(_0x343132){return _0x343132?{'count':_0x56aa41,'rows':_0x343132}:null;}})[_0x1a94('0x25')](respondWithResult(_0x4efa0a,null))[_0x1a94('0x46')](handleError(_0x4efa0a,null));};exports[_0x1a94('0x4f')]=function(_0x23f365,_0x54716d,_0x260690){var _0x53c029={};var _0x442a3f={};var _0x460569;var _0x598550;return db[_0x1a94('0x2b')][_0x1a94('0x4b')]({'where':{'id':_0x23f365[_0x1a94('0x43')]['id']}})['then'](handleEntityNotFound(_0x54716d,null))['then'](function(_0x331947){if(_0x331947){_0x460569=_0x331947;_0x442a3f[_0x1a94('0x2f')]=_[_0x1a94('0x31')](db[_0x1a94('0x4c')][_0x1a94('0x2c')]);_0x442a3f[_0x1a94('0x30')]=_[_0x1a94('0x31')](_0x23f365[_0x1a94('0x30')]);_0x442a3f['filters']=_[_0x1a94('0x33')](_0x442a3f[_0x1a94('0x2f')],_0x442a3f['query']);_0x53c029['attributes']=_[_0x1a94('0x33')](_0x442a3f[_0x1a94('0x2f')],qs[_0x1a94('0x35')](_0x23f365[_0x1a94('0x30')][_0x1a94('0x35')]));_0x53c029['attributes']=_0x53c029['attributes']['length']?_0x53c029[_0x1a94('0x34')]:_0x442a3f['model'];_0x53c029[_0x1a94('0x37')]=qs[_0x1a94('0x38')](_0x23f365[_0x1a94('0x30')]['sort']);_0x53c029['where']=qs[_0x1a94('0x32')](_[_0x1a94('0x3a')](_0x23f365[_0x1a94('0x30')],_0x442a3f['filters']));if(_0x23f365[_0x1a94('0x30')]['filter']){_0x53c029[_0x1a94('0x39')]=_[_0x1a94('0x3d')](_0x53c029[_0x1a94('0x39')],{'$or':_[_0x1a94('0x2a')](_0x53c029[_0x1a94('0x34')],function(_0x8b0e5c){var _0x77711f={};_0x77711f[_0x8b0e5c]={'$like':'%'+_0x23f365[_0x1a94('0x30')]['filter']+'%'};return _0x77711f;})});}_0x53c029=_[_0x1a94('0x3d')]({},_0x53c029,_0x23f365['options']);return _0x460569[_0x1a94('0x4f')](_0x53c029);}})[_0x1a94('0x25')](function(_0x42c353){if(_0x42c353){_0x598550=_0x42c353[_0x1a94('0x44')];if(!_0x23f365['query'][_0x1a94('0x36')](_0x1a94('0x4e'))){_0x53c029[_0x1a94('0x1f')]=qs[_0x1a94('0x1f')](_0x23f365[_0x1a94('0x30')][_0x1a94('0x1f')]);_0x53c029['offset']=qs['offset'](_0x23f365['query'][_0x1a94('0x1d')]);}return _0x460569[_0x1a94('0x4f')](_0x53c029);}})[_0x1a94('0x25')](function(_0x7ba3bf){if(_0x7ba3bf){return _0x7ba3bf?{'count':_0x598550,'rows':_0x7ba3bf}:null;}})[_0x1a94('0x25')](respondWithResult(_0x54716d,null))[_0x1a94('0x46')](handleError(_0x54716d,null));};exports[_0x1a94('0x50')]=function(_0x2fa882,_0x39217c,_0xfbda35){var _0x3342a4={};var _0x3965ce={};var _0x5d2e9a;var _0x5a4e8b;return db[_0x1a94('0x2b')][_0x1a94('0x4b')]({'where':{'id':_0x2fa882[_0x1a94('0x43')]['id']}})['then'](handleEntityNotFound(_0x39217c,null))[_0x1a94('0x25')](function(_0x280b15){if(_0x280b15){_0x5d2e9a=_0x280b15;_0x3965ce[_0x1a94('0x2f')]=_[_0x1a94('0x31')](db[_0x1a94('0x4c')][_0x1a94('0x2c')]);_0x3965ce[_0x1a94('0x30')]=_[_0x1a94('0x31')](_0x2fa882[_0x1a94('0x30')]);_0x3965ce[_0x1a94('0x32')]=_[_0x1a94('0x33')](_0x3965ce[_0x1a94('0x2f')],_0x3965ce['query']);_0x3342a4[_0x1a94('0x34')]=_[_0x1a94('0x33')](_0x3965ce[_0x1a94('0x2f')],qs[_0x1a94('0x35')](_0x2fa882[_0x1a94('0x30')][_0x1a94('0x35')]));_0x3342a4[_0x1a94('0x34')]=_0x3342a4[_0x1a94('0x34')][_0x1a94('0x44')]?_0x3342a4[_0x1a94('0x34')]:_0x3965ce['model'];_0x3342a4[_0x1a94('0x37')]=qs[_0x1a94('0x38')](_0x2fa882[_0x1a94('0x30')][_0x1a94('0x38')]);_0x3342a4['where']=qs[_0x1a94('0x32')](_[_0x1a94('0x3a')](_0x2fa882['query'],_0x3965ce['filters']));if(_0x2fa882['query']['filter']){_0x3342a4[_0x1a94('0x39')]=_[_0x1a94('0x3d')](_0x3342a4[_0x1a94('0x39')],{'$or':_[_0x1a94('0x2a')](_0x3342a4[_0x1a94('0x34')],function(_0x19be03){var _0x5c8fe4={};_0x5c8fe4[_0x19be03]={'$like':'%'+_0x2fa882['query'][_0x1a94('0x3b')]+'%'};return _0x5c8fe4;})});}_0x3342a4=_[_0x1a94('0x3d')]({},_0x3342a4,_0x2fa882[_0x1a94('0x45')]);return _0x5d2e9a[_0x1a94('0x50')](_0x3342a4);}})[_0x1a94('0x25')](function(_0x882716){if(_0x882716){_0x5a4e8b=_0x882716[_0x1a94('0x44')];if(!_0x2fa882[_0x1a94('0x30')][_0x1a94('0x36')](_0x1a94('0x4e'))){_0x3342a4[_0x1a94('0x1f')]=qs[_0x1a94('0x1f')](_0x2fa882['query'][_0x1a94('0x1f')]);_0x3342a4[_0x1a94('0x1d')]=qs['offset'](_0x2fa882['query'][_0x1a94('0x1d')]);}return _0x5d2e9a[_0x1a94('0x50')](_0x3342a4);}})['then'](function(_0x524162){if(_0x524162){return _0x524162?{'count':_0x5a4e8b,'rows':_0x524162}:null;}})['then'](respondWithResult(_0x39217c,null))[_0x1a94('0x46')](handleError(_0x39217c,null));}; \ No newline at end of file +var _0xe3c1=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','SugarcrmConfiguration','include','findAll','rows','catch','show','params','fields','length','includeAll','options','create','body','find','findOne','getFields','nolimit','getSubjects','SugarcrmField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x1a15c4,_0x33967b){var _0xe9900b=function(_0x2fcd0e){while(--_0x2fcd0e){_0x1a15c4['push'](_0x1a15c4['shift']());}};_0xe9900b(++_0x33967b);}(_0xe3c1,0x135));var _0x1e3c=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0xe3c1[_0x3aaf0a];return _0x33e6bc;};'use strict';var emlformat=require(_0x1e3c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e3c('0x1'));var jsonpatch=require(_0x1e3c('0x2'));var rp=require(_0x1e3c('0x3'));var moment=require(_0x1e3c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1e3c('0x5'));var util=require(_0x1e3c('0x6'));var path=require(_0x1e3c('0x7'));var sox=require(_0x1e3c('0x8'));var csv=require(_0x1e3c('0x9'));var ejs=require(_0x1e3c('0xa'));var fs=require('fs');var fs_extra=require(_0x1e3c('0xb'));var _=require(_0x1e3c('0xc'));var squel=require('squel');var crypto=require(_0x1e3c('0xd'));var jsforce=require(_0x1e3c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1e3c('0x9'));var querystring=require('querystring');var Papa=require(_0x1e3c('0xf'));var Redis=require(_0x1e3c('0x10'));var authService=require(_0x1e3c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1e3c('0x12'));var hardwareService=require(_0x1e3c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1e3c('0x14'));var config=require(_0x1e3c('0x15'));var licenseUtil=require(_0x1e3c('0x16'));var db=require(_0x1e3c('0x17'))['db'];function respondWithStatusCode(_0x2d0801,_0x186c18){_0x186c18=_0x186c18||0xcc;return function(_0x2a2471){if(_0x2a2471){return _0x2d0801[_0x1e3c('0x18')](_0x186c18);}return _0x2d0801[_0x1e3c('0x19')](_0x186c18)['end']();};}function respondWithResult(_0xb44701,_0x15ad8d){_0x15ad8d=_0x15ad8d||0xc8;return function(_0x560429){if(_0x560429){return _0xb44701[_0x1e3c('0x19')](_0x15ad8d)['json'](_0x560429);}};}function respondWithFilteredResult(_0x4e01b2,_0x332afa){return function(_0x5059c2){if(_0x5059c2){var _0x5f510f=typeof _0x332afa[_0x1e3c('0x1a')]==='undefined'&&typeof _0x332afa['limit']===_0x1e3c('0x1b');var _0x50b4c1=_0x5059c2[_0x1e3c('0x1c')];var _0x3edf59=_0x5f510f?0x0:_0x332afa[_0x1e3c('0x1a')];var _0x4351a0=_0x5f510f?_0x5059c2[_0x1e3c('0x1c')]:_0x332afa['offset']+_0x332afa[_0x1e3c('0x1d')];var _0x3524dd;if(_0x4351a0>=_0x50b4c1){_0x4351a0=_0x50b4c1;_0x3524dd=0xc8;}else{_0x3524dd=0xce;}_0x4e01b2[_0x1e3c('0x19')](_0x3524dd);return _0x4e01b2[_0x1e3c('0x1e')](_0x1e3c('0x1f'),_0x3edf59+'-'+_0x4351a0+'/'+_0x50b4c1)[_0x1e3c('0x20')](_0x5059c2);}return null;};}function patchUpdates(_0x489889){return function(_0x1c4ed0){try{jsonpatch[_0x1e3c('0x21')](_0x1c4ed0,_0x489889,!![]);}catch(_0x3161b9){return BPromise[_0x1e3c('0x22')](_0x3161b9);}return _0x1c4ed0['save']();};}function saveUpdates(_0x523579,_0x8bf9dc){return function(_0x46db76){if(_0x46db76){return _0x46db76[_0x1e3c('0x23')](_0x523579)[_0x1e3c('0x24')](function(_0x124660){return _0x124660;});}return null;};}function removeEntity(_0x27fffe,_0x1173aa){return function(_0x346140){if(_0x346140){return _0x346140[_0x1e3c('0x25')]()['then'](function(){_0x27fffe[_0x1e3c('0x19')](0xcc)[_0x1e3c('0x26')]();});}};}function handleEntityNotFound(_0x5712f7,_0x5a330c){return function(_0x5b5952){if(!_0x5b5952){_0x5712f7[_0x1e3c('0x18')](0x194);}return _0x5b5952;};}function handleError(_0x409874,_0x2a33f4){_0x2a33f4=_0x2a33f4||0x1f4;return function(_0x462a27){logger[_0x1e3c('0x27')](_0x462a27[_0x1e3c('0x28')]);if(_0x462a27[_0x1e3c('0x29')]){delete _0x462a27[_0x1e3c('0x29')];}_0x409874[_0x1e3c('0x19')](_0x2a33f4)['send'](_0x462a27);};}exports['index']=function(_0x544e0c,_0x359a61){var _0x6137c1={},_0x2de416={},_0xc06b0e={'count':0x0,'rows':[]};var _0x560ca9=_[_0x1e3c('0x2a')](db['SugarcrmConfiguration'][_0x1e3c('0x2b')],function(_0x4b4a98){return{'name':_0x4b4a98[_0x1e3c('0x2c')],'type':_0x4b4a98['type'][_0x1e3c('0x2d')]};});_0x2de416[_0x1e3c('0x2e')]=_[_0x1e3c('0x2a')](_0x560ca9,_0x1e3c('0x29'));_0x2de416[_0x1e3c('0x2f')]=_[_0x1e3c('0x30')](_0x544e0c[_0x1e3c('0x2f')]);_0x2de416[_0x1e3c('0x31')]=_[_0x1e3c('0x32')](_0x2de416[_0x1e3c('0x2e')],_0x2de416['query']);_0x6137c1[_0x1e3c('0x33')]=_[_0x1e3c('0x32')](_0x2de416[_0x1e3c('0x2e')],qs['fields'](_0x544e0c[_0x1e3c('0x2f')]['fields']));_0x6137c1['attributes']=_0x6137c1['attributes']['length']?_0x6137c1[_0x1e3c('0x33')]:_0x2de416[_0x1e3c('0x2e')];if(!_0x544e0c[_0x1e3c('0x2f')][_0x1e3c('0x34')]('nolimit')){_0x6137c1[_0x1e3c('0x1d')]=qs[_0x1e3c('0x1d')](_0x544e0c[_0x1e3c('0x2f')]['limit']);_0x6137c1[_0x1e3c('0x1a')]=qs[_0x1e3c('0x1a')](_0x544e0c['query'][_0x1e3c('0x1a')]);}_0x6137c1[_0x1e3c('0x35')]=qs['sort'](_0x544e0c[_0x1e3c('0x2f')][_0x1e3c('0x36')]);_0x6137c1[_0x1e3c('0x37')]=qs[_0x1e3c('0x31')](_[_0x1e3c('0x38')](_0x544e0c[_0x1e3c('0x2f')],_0x2de416[_0x1e3c('0x31')]),_0x560ca9);if(_0x544e0c[_0x1e3c('0x2f')][_0x1e3c('0x39')]){_0x6137c1[_0x1e3c('0x37')]=_['merge'](_0x6137c1['where'],{'$or':_[_0x1e3c('0x2a')](_0x560ca9,function(_0x401d1e){if(_0x401d1e[_0x1e3c('0x3a')]!==_0x1e3c('0x3b')){var _0x1124c1={};_0x1124c1[_0x401d1e['name']]={'$like':'%'+_0x544e0c[_0x1e3c('0x2f')][_0x1e3c('0x39')]+'%'};return _0x1124c1;}})});}_0x6137c1=_[_0x1e3c('0x3c')]({},_0x6137c1,_0x544e0c['options']);var _0x2d68a2={'where':_0x6137c1['where']};return db[_0x1e3c('0x3d')][_0x1e3c('0x1c')](_0x2d68a2)['then'](function(_0xaccac0){_0xc06b0e[_0x1e3c('0x1c')]=_0xaccac0;if(_0x544e0c[_0x1e3c('0x2f')]['includeAll']){_0x6137c1[_0x1e3c('0x3e')]=[{'all':!![]}];}return db[_0x1e3c('0x3d')][_0x1e3c('0x3f')](_0x6137c1);})['then'](function(_0x53a6b8){_0xc06b0e[_0x1e3c('0x40')]=_0x53a6b8;return _0xc06b0e;})['then'](respondWithFilteredResult(_0x359a61,_0x6137c1))[_0x1e3c('0x41')](handleError(_0x359a61,null));};exports[_0x1e3c('0x42')]=function(_0x519f14,_0xe39768){var _0x4a12d1={'raw':![],'where':{'id':_0x519f14[_0x1e3c('0x43')]['id']}},_0x3bc16f={};_0x3bc16f[_0x1e3c('0x2e')]=_['keys'](db[_0x1e3c('0x3d')]['rawAttributes']);_0x3bc16f[_0x1e3c('0x2f')]=_[_0x1e3c('0x30')](_0x519f14[_0x1e3c('0x2f')]);_0x3bc16f[_0x1e3c('0x31')]=_[_0x1e3c('0x32')](_0x3bc16f[_0x1e3c('0x2e')],_0x3bc16f['query']);_0x4a12d1[_0x1e3c('0x33')]=_['intersection'](_0x3bc16f['model'],qs[_0x1e3c('0x44')](_0x519f14[_0x1e3c('0x2f')][_0x1e3c('0x44')]));_0x4a12d1[_0x1e3c('0x33')]=_0x4a12d1[_0x1e3c('0x33')][_0x1e3c('0x45')]?_0x4a12d1[_0x1e3c('0x33')]:_0x3bc16f[_0x1e3c('0x2e')];if(_0x519f14[_0x1e3c('0x2f')][_0x1e3c('0x46')]){_0x4a12d1[_0x1e3c('0x3e')]=[{'all':!![]}];}_0x4a12d1=_[_0x1e3c('0x3c')]({},_0x4a12d1,_0x519f14[_0x1e3c('0x47')]);return db['SugarcrmConfiguration']['find'](_0x4a12d1)['then'](handleEntityNotFound(_0xe39768,null))[_0x1e3c('0x24')](respondWithResult(_0xe39768,null))[_0x1e3c('0x41')](handleError(_0xe39768,null));};exports[_0x1e3c('0x48')]=function(_0x35ca3b,_0x30eb08){return db[_0x1e3c('0x3d')][_0x1e3c('0x48')](_0x35ca3b['body'],{})[_0x1e3c('0x24')](respondWithResult(_0x30eb08,0xc9))[_0x1e3c('0x41')](handleError(_0x30eb08,null));};exports[_0x1e3c('0x23')]=function(_0x56df8f,_0x5ed88d){if(_0x56df8f['body']['id']){delete _0x56df8f[_0x1e3c('0x49')]['id'];}return db[_0x1e3c('0x3d')][_0x1e3c('0x4a')]({'where':{'id':_0x56df8f[_0x1e3c('0x43')]['id']}})[_0x1e3c('0x24')](handleEntityNotFound(_0x5ed88d,null))['then'](saveUpdates(_0x56df8f[_0x1e3c('0x49')],null))[_0x1e3c('0x24')](respondWithResult(_0x5ed88d,null))[_0x1e3c('0x41')](handleError(_0x5ed88d,null));};exports[_0x1e3c('0x25')]=function(_0x480f49,_0xf45725){return db['SugarcrmConfiguration'][_0x1e3c('0x4a')]({'where':{'id':_0x480f49[_0x1e3c('0x43')]['id']}})[_0x1e3c('0x24')](handleEntityNotFound(_0xf45725,null))['then'](removeEntity(_0xf45725,null))[_0x1e3c('0x41')](handleError(_0xf45725,null));};exports['getFields']=function(_0x54b21b,_0x314fa8,_0x515ff3){var _0x276d6a={};var _0x273dde={};var _0x505aab;var _0x51f76c;return db[_0x1e3c('0x3d')][_0x1e3c('0x4b')]({'where':{'id':_0x54b21b['params']['id']}})[_0x1e3c('0x24')](handleEntityNotFound(_0x314fa8,null))['then'](function(_0xa8ce47){if(_0xa8ce47){_0x505aab=_0xa8ce47;_0x273dde[_0x1e3c('0x2e')]=_[_0x1e3c('0x30')](db['SugarcrmField']['rawAttributes']);_0x273dde[_0x1e3c('0x2f')]=_[_0x1e3c('0x30')](_0x54b21b[_0x1e3c('0x2f')]);_0x273dde['filters']=_[_0x1e3c('0x32')](_0x273dde[_0x1e3c('0x2e')],_0x273dde[_0x1e3c('0x2f')]);_0x276d6a[_0x1e3c('0x33')]=_[_0x1e3c('0x32')](_0x273dde['model'],qs[_0x1e3c('0x44')](_0x54b21b['query'][_0x1e3c('0x44')]));_0x276d6a[_0x1e3c('0x33')]=_0x276d6a[_0x1e3c('0x33')][_0x1e3c('0x45')]?_0x276d6a[_0x1e3c('0x33')]:_0x273dde[_0x1e3c('0x2e')];_0x276d6a['order']=qs[_0x1e3c('0x36')](_0x54b21b[_0x1e3c('0x2f')][_0x1e3c('0x36')]);_0x276d6a[_0x1e3c('0x37')]=qs[_0x1e3c('0x31')](_[_0x1e3c('0x38')](_0x54b21b[_0x1e3c('0x2f')],_0x273dde[_0x1e3c('0x31')]));if(_0x54b21b[_0x1e3c('0x2f')]['filter']){_0x276d6a[_0x1e3c('0x37')]=_['merge'](_0x276d6a[_0x1e3c('0x37')],{'$or':_[_0x1e3c('0x2a')](_0x276d6a[_0x1e3c('0x33')],function(_0x2e48f7){var _0x34cb27={};_0x34cb27[_0x2e48f7]={'$like':'%'+_0x54b21b['query']['filter']+'%'};return _0x34cb27;})});}_0x276d6a=_[_0x1e3c('0x3c')]({},_0x276d6a,_0x54b21b[_0x1e3c('0x47')]);return _0x505aab[_0x1e3c('0x4c')](_0x276d6a);}})[_0x1e3c('0x24')](function(_0x3f227b){if(_0x3f227b){_0x51f76c=_0x3f227b[_0x1e3c('0x45')];if(!_0x54b21b[_0x1e3c('0x2f')][_0x1e3c('0x34')](_0x1e3c('0x4d'))){_0x276d6a['limit']=qs[_0x1e3c('0x1d')](_0x54b21b['query'][_0x1e3c('0x1d')]);_0x276d6a[_0x1e3c('0x1a')]=qs['offset'](_0x54b21b[_0x1e3c('0x2f')][_0x1e3c('0x1a')]);}return _0x505aab[_0x1e3c('0x4c')](_0x276d6a);}})[_0x1e3c('0x24')](function(_0x565a22){if(_0x565a22){return _0x565a22?{'count':_0x51f76c,'rows':_0x565a22}:null;}})[_0x1e3c('0x24')](respondWithResult(_0x314fa8,null))[_0x1e3c('0x41')](handleError(_0x314fa8,null));};exports[_0x1e3c('0x4e')]=function(_0x17f599,_0x433a52,_0x1304fa){var _0x446cf7={};var _0x36d8a1={};var _0x529883;var _0x5e2818;return db[_0x1e3c('0x3d')][_0x1e3c('0x4b')]({'where':{'id':_0x17f599[_0x1e3c('0x43')]['id']}})[_0x1e3c('0x24')](handleEntityNotFound(_0x433a52,null))[_0x1e3c('0x24')](function(_0x37a600){if(_0x37a600){_0x529883=_0x37a600;_0x36d8a1['model']=_[_0x1e3c('0x30')](db[_0x1e3c('0x4f')][_0x1e3c('0x2b')]);_0x36d8a1['query']=_[_0x1e3c('0x30')](_0x17f599[_0x1e3c('0x2f')]);_0x36d8a1['filters']=_[_0x1e3c('0x32')](_0x36d8a1[_0x1e3c('0x2e')],_0x36d8a1[_0x1e3c('0x2f')]);_0x446cf7[_0x1e3c('0x33')]=_['intersection'](_0x36d8a1[_0x1e3c('0x2e')],qs[_0x1e3c('0x44')](_0x17f599[_0x1e3c('0x2f')]['fields']));_0x446cf7[_0x1e3c('0x33')]=_0x446cf7[_0x1e3c('0x33')][_0x1e3c('0x45')]?_0x446cf7['attributes']:_0x36d8a1[_0x1e3c('0x2e')];_0x446cf7['order']=qs['sort'](_0x17f599[_0x1e3c('0x2f')][_0x1e3c('0x36')]);_0x446cf7[_0x1e3c('0x37')]=qs[_0x1e3c('0x31')](_[_0x1e3c('0x38')](_0x17f599[_0x1e3c('0x2f')],_0x36d8a1['filters']));if(_0x17f599['query'][_0x1e3c('0x39')]){_0x446cf7['where']=_[_0x1e3c('0x3c')](_0x446cf7[_0x1e3c('0x37')],{'$or':_[_0x1e3c('0x2a')](_0x446cf7['attributes'],function(_0x4f01e5){var _0x3bafe0={};_0x3bafe0[_0x4f01e5]={'$like':'%'+_0x17f599[_0x1e3c('0x2f')][_0x1e3c('0x39')]+'%'};return _0x3bafe0;})});}_0x446cf7=_[_0x1e3c('0x3c')]({},_0x446cf7,_0x17f599[_0x1e3c('0x47')]);return _0x529883[_0x1e3c('0x4e')](_0x446cf7);}})[_0x1e3c('0x24')](function(_0x52ac8c){if(_0x52ac8c){_0x5e2818=_0x52ac8c[_0x1e3c('0x45')];if(!_0x17f599[_0x1e3c('0x2f')][_0x1e3c('0x34')](_0x1e3c('0x4d'))){_0x446cf7[_0x1e3c('0x1d')]=qs[_0x1e3c('0x1d')](_0x17f599[_0x1e3c('0x2f')][_0x1e3c('0x1d')]);_0x446cf7['offset']=qs['offset'](_0x17f599[_0x1e3c('0x2f')][_0x1e3c('0x1a')]);}return _0x529883[_0x1e3c('0x4e')](_0x446cf7);}})[_0x1e3c('0x24')](function(_0x156a83){if(_0x156a83){return _0x156a83?{'count':_0x5e2818,'rows':_0x156a83}:null;}})[_0x1e3c('0x24')](respondWithResult(_0x433a52,null))[_0x1e3c('0x41')](handleError(_0x433a52,null));};exports[_0x1e3c('0x50')]=function(_0x50d1e4,_0x1076cd,_0x4fe955){var _0x1b56d8={};var _0x3e7360={};var _0x21bd8e;var _0x54d84d;return db['SugarcrmConfiguration'][_0x1e3c('0x4b')]({'where':{'id':_0x50d1e4[_0x1e3c('0x43')]['id']}})[_0x1e3c('0x24')](handleEntityNotFound(_0x1076cd,null))[_0x1e3c('0x24')](function(_0x2b8598){if(_0x2b8598){_0x21bd8e=_0x2b8598;_0x3e7360[_0x1e3c('0x2e')]=_['keys'](db[_0x1e3c('0x4f')]['rawAttributes']);_0x3e7360['query']=_[_0x1e3c('0x30')](_0x50d1e4['query']);_0x3e7360[_0x1e3c('0x31')]=_[_0x1e3c('0x32')](_0x3e7360['model'],_0x3e7360[_0x1e3c('0x2f')]);_0x1b56d8[_0x1e3c('0x33')]=_[_0x1e3c('0x32')](_0x3e7360[_0x1e3c('0x2e')],qs[_0x1e3c('0x44')](_0x50d1e4['query'][_0x1e3c('0x44')]));_0x1b56d8[_0x1e3c('0x33')]=_0x1b56d8[_0x1e3c('0x33')][_0x1e3c('0x45')]?_0x1b56d8[_0x1e3c('0x33')]:_0x3e7360[_0x1e3c('0x2e')];_0x1b56d8[_0x1e3c('0x35')]=qs[_0x1e3c('0x36')](_0x50d1e4[_0x1e3c('0x2f')][_0x1e3c('0x36')]);_0x1b56d8[_0x1e3c('0x37')]=qs['filters'](_[_0x1e3c('0x38')](_0x50d1e4[_0x1e3c('0x2f')],_0x3e7360[_0x1e3c('0x31')]));if(_0x50d1e4[_0x1e3c('0x2f')][_0x1e3c('0x39')]){_0x1b56d8[_0x1e3c('0x37')]=_[_0x1e3c('0x3c')](_0x1b56d8['where'],{'$or':_[_0x1e3c('0x2a')](_0x1b56d8[_0x1e3c('0x33')],function(_0x4e4029){var _0x3c473d={};_0x3c473d[_0x4e4029]={'$like':'%'+_0x50d1e4[_0x1e3c('0x2f')][_0x1e3c('0x39')]+'%'};return _0x3c473d;})});}_0x1b56d8=_[_0x1e3c('0x3c')]({},_0x1b56d8,_0x50d1e4[_0x1e3c('0x47')]);return _0x21bd8e[_0x1e3c('0x50')](_0x1b56d8);}})[_0x1e3c('0x24')](function(_0x557b4f){if(_0x557b4f){_0x54d84d=_0x557b4f['length'];if(!_0x50d1e4['query'][_0x1e3c('0x34')]('nolimit')){_0x1b56d8[_0x1e3c('0x1d')]=qs[_0x1e3c('0x1d')](_0x50d1e4[_0x1e3c('0x2f')]['limit']);_0x1b56d8[_0x1e3c('0x1a')]=qs[_0x1e3c('0x1a')](_0x50d1e4[_0x1e3c('0x2f')]['offset']);}return _0x21bd8e[_0x1e3c('0x50')](_0x1b56d8);}})[_0x1e3c('0x24')](function(_0x3e4691){if(_0x3e4691){return _0x3e4691?{'count':_0x54d84d,'rows':_0x3e4691}:null;}})[_0x1e3c('0x24')](respondWithResult(_0x1076cd,null))[_0x1e3c('0x41')](handleError(_0x1076cd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ad842c3..687adda 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 _0xbb82=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0xbb82,0xa7));var _0x2bb8=function(_0x134bfc,_0x144d5f){_0x134bfc=_0x134bfc-0x0;var _0x2f4dcc=_0xbb82[_0x134bfc];return _0x2f4dcc;};'use strict';var _=require(_0x2bb8('0x0'));var util=require(_0x2bb8('0x1'));var logger=require('../../config/logger')(_0x2bb8('0x2'));var moment=require(_0x2bb8('0x3'));var BPromise=require(_0x2bb8('0x4'));var rp=require(_0x2bb8('0x5'));var fs=require('fs');var path=require(_0x2bb8('0x6'));var rimraf=require(_0x2bb8('0x7'));var config=require(_0x2bb8('0x8'));var attributes=require(_0x2bb8('0x9'));module[_0x2bb8('0xa')]=function(_0x52865d,_0x2c6a84){return _0x52865d[_0x2bb8('0xb')](_0x2bb8('0xc'),attributes,{'tableName':_0x2bb8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafb8=['exports','define','int_sugarcrm_configurations','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x22ce34,_0x1b4bd2){var _0x22ae05=function(_0x2cf76d){while(--_0x2cf76d){_0x22ce34['push'](_0x22ce34['shift']());}};_0x22ae05(++_0x1b4bd2);}(_0xafb8,0x14d));var _0x8afb=function(_0x137d41,_0x169c2c){_0x137d41=_0x137d41-0x0;var _0x469ec7=_0xafb8[_0x137d41];return _0x469ec7;};'use strict';var _=require(_0x8afb('0x0'));var util=require(_0x8afb('0x1'));var logger=require('../../config/logger')(_0x8afb('0x2'));var moment=require(_0x8afb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8afb('0x4'));var rimraf=require(_0x8afb('0x5'));var config=require(_0x8afb('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x8afb('0x7')]=function(_0x20f388,_0x4caa79){return _0x20f388[_0x8afb('0x8')]('SugarcrmConfiguration',attributes,{'tableName':_0x8afb('0x9'),'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 1bcc998..6202008 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 _0x8491=['jayson/promise','client','http','request','then','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','SugarcrmConfiguration,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x2f5603,_0x328e83){var _0x5a8e09=function(_0x2f5ed4){while(--_0x2f5ed4){_0x2f5603['push'](_0x2f5603['shift']());}};_0x5a8e09(++_0x328e83);}(_0x8491,0x66));var _0x1849=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x8491[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x1849('0x0'));var util=require(_0x1849('0x1'));var moment=require(_0x1849('0x2'));var BPromise=require(_0x1849('0x3'));var rs=require(_0x1849('0x4'));var fs=require('fs');var Redis=require(_0x1849('0x5'));var db=require(_0x1849('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1849('0x7'));var config=require('../../config/environment');var jayson=require(_0x1849('0x8'));var client=jayson[_0x1849('0x9')][_0x1849('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58e1c6,_0x300a63,_0x56db7e){return new BPromise(function(_0x4b9538,_0x47cb66){return client[_0x1849('0xb')](_0x58e1c6,_0x56db7e)[_0x1849('0xc')](function(_0x8c599){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x300a63,_0x1849('0xd'));logger[_0x1849('0xe')](_0x1849('0xf'),_0x300a63,_0x1849('0xd'),JSON['stringify'](_0x8c599));if(_0x8c599[_0x1849('0x10')]){if(_0x8c599['error']['code']===0x1f4){logger[_0x1849('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x300a63,_0x8c599[_0x1849('0x10')][_0x1849('0x11')]);return _0x47cb66(_0x8c599[_0x1849('0x10')][_0x1849('0x11')]);}logger['error'](_0x1849('0x12'),_0x300a63,_0x8c599[_0x1849('0x10')][_0x1849('0x11')]);return _0x4b9538(_0x8c599[_0x1849('0x10')][_0x1849('0x11')]);}else{logger[_0x1849('0x13')](_0x1849('0x12'),_0x300a63,'request\x20sent');_0x4b9538(_0x8c599[_0x1849('0x14')][_0x1849('0x11')]);}})[_0x1849('0x15')](function(_0x311ba0){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x300a63,_0x311ba0);_0x47cb66(_0x311ba0);});});} \ No newline at end of file +var _0x4f3b=['SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','info','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x4f3b,0x76));var _0xb4f3=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0x4f3b[_0x540133];return _0x26b6e9;};'use strict';var _=require(_0xb4f3('0x0'));var util=require(_0xb4f3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb4f3('0x2'));var fs=require('fs');var Redis=require(_0xb4f3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4f3('0x4'));var logger=require(_0xb4f3('0x5'))(_0xb4f3('0x6'));var config=require(_0xb4f3('0x7'));var jayson=require(_0xb4f3('0x8'));var client=jayson[_0xb4f3('0x9')][_0xb4f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x265b97,_0x35b2ee,_0x53b2d2){return new BPromise(function(_0x2ced0e,_0x516ff5){return client['request'](_0x265b97,_0x53b2d2)[_0xb4f3('0xb')](function(_0x57e8d8){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x35b2ee,_0xb4f3('0xc'));logger[_0xb4f3('0xd')](_0xb4f3('0xe'),_0x35b2ee,'request\x20sent',JSON[_0xb4f3('0xf')](_0x57e8d8));if(_0x57e8d8[_0xb4f3('0x10')]){if(_0x57e8d8[_0xb4f3('0x10')][_0xb4f3('0x11')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x35b2ee,_0x57e8d8[_0xb4f3('0x10')][_0xb4f3('0x12')]);return _0x516ff5(_0x57e8d8[_0xb4f3('0x10')][_0xb4f3('0x12')]);}logger[_0xb4f3('0x10')](_0xb4f3('0x13'),_0x35b2ee,_0x57e8d8[_0xb4f3('0x10')][_0xb4f3('0x12')]);return _0x2ced0e(_0x57e8d8[_0xb4f3('0x10')][_0xb4f3('0x12')]);}else{logger[_0xb4f3('0x14')](_0xb4f3('0x13'),_0x35b2ee,_0xb4f3('0xc'));_0x2ced0e(_0x57e8d8[_0xb4f3('0x15')][_0xb4f3('0x12')]);}})['catch'](function(_0x2e3ed1){logger['error'](_0xb4f3('0x13'),_0x35b2ee,_0x2e3ed1);_0x516ff5(_0x2e3ed1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 2b23161..ff37681 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 _0x1275=['./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x66df1,_0x502980){var _0x40d39b=function(_0x42f14f){while(--_0x42f14f){_0x66df1['push'](_0x66df1['shift']());}};_0x40d39b(++_0x502980);}(_0x1275,0xf4));var _0x5127=function(_0x13b3db,_0x34a89e){_0x13b3db=_0x13b3db-0x0;var _0x228e4c=_0x1275[_0x13b3db];return _0x228e4c;};'use strict';var multer=require(_0x5127('0x0'));var util=require(_0x5127('0x1'));var path=require('path');var timeout=require(_0x5127('0x2'));var express=require(_0x5127('0x3'));var router=express[_0x5127('0x4')]();var fs_extra=require(_0x5127('0x5'));var auth=require(_0x5127('0x6'));var interaction=require(_0x5127('0x7'));var config=require('../../config/environment');var controller=require(_0x5127('0x8'));router[_0x5127('0x9')]('/',auth[_0x5127('0xa')](),controller[_0x5127('0xb')]);router['get'](_0x5127('0xc'),auth[_0x5127('0xa')](),controller[_0x5127('0xd')]);router[_0x5127('0xe')]('/',auth['isAuthenticated'](),controller[_0x5127('0xf')]);router[_0x5127('0x10')](_0x5127('0xc'),auth[_0x5127('0xa')](),controller[_0x5127('0x11')]);router[_0x5127('0x12')](_0x5127('0xc'),auth[_0x5127('0xa')](),controller[_0x5127('0x13')]);module[_0x5127('0x14')]=router; \ No newline at end of file +var _0xaf5e=['express','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','multer','util','connect-timeout'];(function(_0x224d74,_0x529656){var _0x507f63=function(_0x51d023){while(--_0x51d023){_0x224d74['push'](_0x224d74['shift']());}};_0x507f63(++_0x529656);}(_0xaf5e,0x1ad));var _0xeaf5=function(_0x29943d,_0x20654b){_0x29943d=_0x29943d-0x0;var _0x2443a7=_0xaf5e[_0x29943d];return _0x2443a7;};'use strict';var multer=require(_0xeaf5('0x0'));var util=require(_0xeaf5('0x1'));var path=require('path');var timeout=require(_0xeaf5('0x2'));var express=require(_0xeaf5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xeaf5('0x4'));var config=require(_0xeaf5('0x5'));var controller=require(_0xeaf5('0x6'));router[_0xeaf5('0x7')]('/',auth[_0xeaf5('0x8')](),controller[_0xeaf5('0x9')]);router['get'](_0xeaf5('0xa'),auth[_0xeaf5('0x8')](),controller[_0xeaf5('0xb')]);router[_0xeaf5('0xc')]('/',auth[_0xeaf5('0x8')](),controller[_0xeaf5('0xd')]);router['put'](_0xeaf5('0xa'),auth[_0xeaf5('0x8')](),controller['update']);router[_0xeaf5('0xe')](_0xeaf5('0xa'),auth['isAuthenticated'](),controller[_0xeaf5('0xf')]);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 2e27db4..5b1bfe3 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 _0xf789=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf789,0x78));var _0x9f78=function(_0x11ac3c,_0x20d8ee){_0x11ac3c=_0x11ac3c-0x0;var _0x261dd3=_0xf789[_0x11ac3c];return _0x261dd3;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x9f78('0x0')](_0x9f78('0x1'),_0x9f78('0x2'),_0x9f78('0x3'),_0x9f78('0x4'),_0x9f78('0x5')),'defaultValue':_0x9f78('0x1')},'content':{'type':Sequelize[_0x9f78('0x6')]},'key':{'type':Sequelize[_0x9f78('0x6')]},'keyType':{'type':Sequelize[_0x9f78('0x0')](_0x9f78('0x1'),_0x9f78('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x9f78('0x6')]},'idField':{'type':Sequelize[_0x9f78('0x6')]},'nameField':{'type':Sequelize[_0x9f78('0x6')]},'customField':{'type':Sequelize[_0x9f78('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9f78('0x6')]}}; \ No newline at end of file +var _0xabb1=['sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x90b84f,_0x38dbd9){var _0x53c32f=function(_0x48856e){while(--_0x48856e){_0x90b84f['push'](_0x90b84f['shift']());}};_0x53c32f(++_0x38dbd9);}(_0xabb1,0x15f));var _0x1abb=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xabb1[_0x17406a];return _0x1501ff;};'use strict';var Sequelize=require(_0x1abb('0x0'));module[_0x1abb('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x1abb('0x2'),_0x1abb('0x3'),_0x1abb('0x4'),_0x1abb('0x5')),'defaultValue':_0x1abb('0x6')},'content':{'type':Sequelize[_0x1abb('0x7')]},'key':{'type':Sequelize[_0x1abb('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x1abb('0x6'),_0x1abb('0x2'),_0x1abb('0x3'))},'keyContent':{'type':Sequelize[_0x1abb('0x7')]},'idField':{'type':Sequelize[_0x1abb('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1abb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1abb('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 23422d6..7faede4 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 _0xacd1=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','update','then','error','stack','name','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','SugarcrmField','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x3edcc1,_0x1a7570){var _0x1d1e1d=function(_0x468f8b){while(--_0x468f8b){_0x3edcc1['push'](_0x3edcc1['shift']());}};_0x1d1e1d(++_0x1a7570);}(_0xacd1,0x80));var _0x1acd=function(_0x361337,_0x2a0f78){_0x361337=_0x361337-0x0;var _0x55470f=_0xacd1[_0x361337];return _0x55470f;};'use strict';var emlformat=require(_0x1acd('0x0'));var rimraf=require(_0x1acd('0x1'));var zipdir=require(_0x1acd('0x2'));var jsonpatch=require(_0x1acd('0x3'));var rp=require(_0x1acd('0x4'));var moment=require(_0x1acd('0x5'));var BPromise=require(_0x1acd('0x6'));var Mustache=require(_0x1acd('0x7'));var util=require(_0x1acd('0x8'));var path=require(_0x1acd('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1acd('0xa'));var _=require('lodash');var squel=require(_0x1acd('0xb'));var crypto=require(_0x1acd('0xc'));var jsforce=require(_0x1acd('0xd'));var deskjs=require(_0x1acd('0xe'));var toCsv=require(_0x1acd('0xf'));var querystring=require('querystring');var Papa=require(_0x1acd('0x10'));var Redis=require(_0x1acd('0x11'));var authService=require(_0x1acd('0x12'));var qs=require(_0x1acd('0x13'));var as=require(_0x1acd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1acd('0x15'))(_0x1acd('0x16'));var utils=require(_0x1acd('0x17'));var config=require(_0x1acd('0x18'));var licenseUtil=require(_0x1acd('0x19'));var db=require(_0x1acd('0x1a'))['db'];function respondWithStatusCode(_0x8a61c8,_0x5f507a){_0x5f507a=_0x5f507a||0xcc;return function(_0x46bfb1){if(_0x46bfb1){return _0x8a61c8[_0x1acd('0x1b')](_0x5f507a);}return _0x8a61c8[_0x1acd('0x1c')](_0x5f507a)[_0x1acd('0x1d')]();};}function respondWithResult(_0xa50ffe,_0x5b6d4e){_0x5b6d4e=_0x5b6d4e||0xc8;return function(_0x24acef){if(_0x24acef){return _0xa50ffe[_0x1acd('0x1c')](_0x5b6d4e)[_0x1acd('0x1e')](_0x24acef);}};}function respondWithFilteredResult(_0x1217dd,_0x581d7b){return function(_0x5b2675){if(_0x5b2675){var _0x4a5b91=typeof _0x581d7b[_0x1acd('0x1f')]===_0x1acd('0x20')&&typeof _0x581d7b[_0x1acd('0x21')]===_0x1acd('0x20');var _0x51eef5=_0x5b2675['count'];var _0x36d32c=_0x4a5b91?0x0:_0x581d7b[_0x1acd('0x1f')];var _0x4d31c4=_0x4a5b91?_0x5b2675['count']:_0x581d7b[_0x1acd('0x1f')]+_0x581d7b[_0x1acd('0x21')];var _0xa537d0;if(_0x4d31c4>=_0x51eef5){_0x4d31c4=_0x51eef5;_0xa537d0=0xc8;}else{_0xa537d0=0xce;}_0x1217dd[_0x1acd('0x1c')](_0xa537d0);return _0x1217dd['set']('Content-Range',_0x36d32c+'-'+_0x4d31c4+'/'+_0x51eef5)[_0x1acd('0x1e')](_0x5b2675);}return null;};}function patchUpdates(_0x32ff2c){return function(_0x378d4b){try{jsonpatch[_0x1acd('0x22')](_0x378d4b,_0x32ff2c,!![]);}catch(_0x1f4763){return BPromise[_0x1acd('0x23')](_0x1f4763);}return _0x378d4b[_0x1acd('0x24')]();};}function saveUpdates(_0x1d7507,_0x139302){return function(_0x59fe78){if(_0x59fe78){return _0x59fe78[_0x1acd('0x25')](_0x1d7507)['then'](function(_0x3a5451){return _0x3a5451;});}return null;};}function removeEntity(_0x12f073,_0x4229f7){return function(_0x3e7ed7){if(_0x3e7ed7){return _0x3e7ed7['destroy']()[_0x1acd('0x26')](function(){_0x12f073['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46bc62,_0x41fba9){return function(_0x557644){if(!_0x557644){_0x46bc62[_0x1acd('0x1b')](0x194);}return _0x557644;};}function handleError(_0x3483cc,_0x3fa042){_0x3fa042=_0x3fa042||0x1f4;return function(_0x126318){logger[_0x1acd('0x27')](_0x126318[_0x1acd('0x28')]);if(_0x126318['name']){delete _0x126318[_0x1acd('0x29')];}_0x3483cc['status'](_0x3fa042)['send'](_0x126318);};}exports[_0x1acd('0x2a')]=function(_0xe08236,_0x511afa){var _0x256bcf={},_0x46ddd5={},_0x52d590={'count':0x0,'rows':[]};var _0x5e6ac0=_[_0x1acd('0x2b')](db['SugarcrmField']['rawAttributes'],function(_0x2c7473){return{'name':_0x2c7473['fieldName'],'type':_0x2c7473[_0x1acd('0x2c')][_0x1acd('0x2d')]};});_0x46ddd5[_0x1acd('0x2e')]=_[_0x1acd('0x2b')](_0x5e6ac0,_0x1acd('0x29'));_0x46ddd5[_0x1acd('0x2f')]=_[_0x1acd('0x30')](_0xe08236[_0x1acd('0x2f')]);_0x46ddd5[_0x1acd('0x31')]=_[_0x1acd('0x32')](_0x46ddd5[_0x1acd('0x2e')],_0x46ddd5[_0x1acd('0x2f')]);_0x256bcf[_0x1acd('0x33')]=_[_0x1acd('0x32')](_0x46ddd5[_0x1acd('0x2e')],qs['fields'](_0xe08236['query'][_0x1acd('0x34')]));_0x256bcf[_0x1acd('0x33')]=_0x256bcf['attributes'][_0x1acd('0x35')]?_0x256bcf[_0x1acd('0x33')]:_0x46ddd5[_0x1acd('0x2e')];if(!_0xe08236[_0x1acd('0x2f')][_0x1acd('0x36')]('nolimit')){_0x256bcf['limit']=qs['limit'](_0xe08236[_0x1acd('0x2f')][_0x1acd('0x21')]);_0x256bcf[_0x1acd('0x1f')]=qs[_0x1acd('0x1f')](_0xe08236[_0x1acd('0x2f')][_0x1acd('0x1f')]);}_0x256bcf[_0x1acd('0x37')]=qs[_0x1acd('0x38')](_0xe08236['query'][_0x1acd('0x38')]);_0x256bcf[_0x1acd('0x39')]=qs['filters'](_[_0x1acd('0x3a')](_0xe08236['query'],_0x46ddd5[_0x1acd('0x31')]),_0x5e6ac0);if(_0xe08236['query']['filter']){_0x256bcf[_0x1acd('0x39')]=_['merge'](_0x256bcf[_0x1acd('0x39')],{'$or':_[_0x1acd('0x2b')](_0x5e6ac0,function(_0x3bba9e){if(_0x3bba9e[_0x1acd('0x2c')]!==_0x1acd('0x3b')){var _0x382a55={};_0x382a55[_0x3bba9e[_0x1acd('0x29')]]={'$like':'%'+_0xe08236[_0x1acd('0x2f')]['filter']+'%'};return _0x382a55;}})});}_0x256bcf=_[_0x1acd('0x3c')]({},_0x256bcf,_0xe08236[_0x1acd('0x3d')]);var _0x1652cb={'where':_0x256bcf[_0x1acd('0x39')]};return db[_0x1acd('0x3e')][_0x1acd('0x3f')](_0x1652cb)['then'](function(_0x216106){_0x52d590[_0x1acd('0x3f')]=_0x216106;if(_0xe08236[_0x1acd('0x2f')][_0x1acd('0x40')]){_0x256bcf[_0x1acd('0x41')]=[{'all':!![]}];}return db[_0x1acd('0x3e')][_0x1acd('0x42')](_0x256bcf);})['then'](function(_0x25035b){_0x52d590[_0x1acd('0x43')]=_0x25035b;return _0x52d590;})[_0x1acd('0x26')](respondWithFilteredResult(_0x511afa,_0x256bcf))[_0x1acd('0x44')](handleError(_0x511afa,null));};exports[_0x1acd('0x45')]=function(_0x3c74d1,_0x44b374){var _0x18169a={'raw':!![],'where':{'id':_0x3c74d1[_0x1acd('0x46')]['id']}},_0x38d3d1={};_0x38d3d1['model']=_['keys'](db[_0x1acd('0x3e')][_0x1acd('0x47')]);_0x38d3d1['query']=_[_0x1acd('0x30')](_0x3c74d1['query']);_0x38d3d1[_0x1acd('0x31')]=_[_0x1acd('0x32')](_0x38d3d1[_0x1acd('0x2e')],_0x38d3d1['query']);_0x18169a[_0x1acd('0x33')]=_[_0x1acd('0x32')](_0x38d3d1[_0x1acd('0x2e')],qs[_0x1acd('0x34')](_0x3c74d1[_0x1acd('0x2f')][_0x1acd('0x34')]));_0x18169a[_0x1acd('0x33')]=_0x18169a[_0x1acd('0x33')]['length']?_0x18169a[_0x1acd('0x33')]:_0x38d3d1[_0x1acd('0x2e')];if(_0x3c74d1[_0x1acd('0x2f')]['includeAll']){_0x18169a[_0x1acd('0x41')]=[{'all':!![]}];}_0x18169a=_[_0x1acd('0x3c')]({},_0x18169a,_0x3c74d1[_0x1acd('0x3d')]);return db['SugarcrmField'][_0x1acd('0x48')](_0x18169a)[_0x1acd('0x26')](handleEntityNotFound(_0x44b374,null))[_0x1acd('0x26')](respondWithResult(_0x44b374,null))[_0x1acd('0x44')](handleError(_0x44b374,null));};exports['create']=function(_0x2567e3,_0x4306ae){return db['SugarcrmField'][_0x1acd('0x49')](_0x2567e3[_0x1acd('0x4a')],{})[_0x1acd('0x26')](respondWithResult(_0x4306ae,0xc9))[_0x1acd('0x44')](handleError(_0x4306ae,null));};exports[_0x1acd('0x25')]=function(_0x320e55,_0xdf3cd2){if(_0x320e55[_0x1acd('0x4a')]['id']){delete _0x320e55[_0x1acd('0x4a')]['id'];}return db[_0x1acd('0x3e')]['find']({'where':{'id':_0x320e55[_0x1acd('0x46')]['id']}})['then'](handleEntityNotFound(_0xdf3cd2,null))[_0x1acd('0x26')](saveUpdates(_0x320e55[_0x1acd('0x4a')],null))[_0x1acd('0x26')](respondWithResult(_0xdf3cd2,null))[_0x1acd('0x44')](handleError(_0xdf3cd2,null));};exports[_0x1acd('0x4b')]=function(_0x56f7e6,_0x1c8d53){return db['SugarcrmField'][_0x1acd('0x48')]({'where':{'id':_0x56f7e6[_0x1acd('0x46')]['id']}})[_0x1acd('0x26')](handleEntityNotFound(_0x1c8d53,null))[_0x1acd('0x26')](removeEntity(_0x1c8d53,null))[_0x1acd('0x44')](handleError(_0x1c8d53,null));}; \ No newline at end of file +var _0x39f5=['name','send','index','map','SugarcrmField','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../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','save','then','error','stack'];(function(_0xe3f0b0,_0x43edc9){var _0x3a839e=function(_0x45e9cf){while(--_0x45e9cf){_0xe3f0b0['push'](_0xe3f0b0['shift']());}};_0x3a839e(++_0x43edc9);}(_0x39f5,0xc4));var _0x539f=function(_0x1612c4,_0x479cc5){_0x1612c4=_0x1612c4-0x0;var _0x110f88=_0x39f5[_0x1612c4];return _0x110f88;};'use strict';var emlformat=require(_0x539f('0x0'));var rimraf=require(_0x539f('0x1'));var zipdir=require(_0x539f('0x2'));var jsonpatch=require(_0x539f('0x3'));var rp=require(_0x539f('0x4'));var moment=require(_0x539f('0x5'));var BPromise=require(_0x539f('0x6'));var Mustache=require(_0x539f('0x7'));var util=require('util');var path=require(_0x539f('0x8'));var sox=require(_0x539f('0x9'));var csv=require(_0x539f('0xa'));var ejs=require(_0x539f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x539f('0xc'));var squel=require(_0x539f('0xd'));var crypto=require(_0x539f('0xe'));var jsforce=require(_0x539f('0xf'));var deskjs=require(_0x539f('0x10'));var toCsv=require(_0x539f('0xa'));var querystring=require(_0x539f('0x11'));var Papa=require(_0x539f('0x12'));var Redis=require('ioredis');var authService=require(_0x539f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x539f('0x14'));var logger=require(_0x539f('0x15'))(_0x539f('0x16'));var utils=require(_0x539f('0x17'));var config=require(_0x539f('0x18'));var licenseUtil=require(_0x539f('0x19'));var db=require(_0x539f('0x1a'))['db'];function respondWithStatusCode(_0xa22889,_0x401b03){_0x401b03=_0x401b03||0xcc;return function(_0x27f84a){if(_0x27f84a){return _0xa22889[_0x539f('0x1b')](_0x401b03);}return _0xa22889['status'](_0x401b03)[_0x539f('0x1c')]();};}function respondWithResult(_0x445737,_0x500093){_0x500093=_0x500093||0xc8;return function(_0x4a3d18){if(_0x4a3d18){return _0x445737[_0x539f('0x1d')](_0x500093)[_0x539f('0x1e')](_0x4a3d18);}};}function respondWithFilteredResult(_0x4d216b,_0x5df17c){return function(_0x5cb669){if(_0x5cb669){var _0x4ff278=typeof _0x5df17c[_0x539f('0x1f')]==='undefined'&&typeof _0x5df17c[_0x539f('0x20')]===_0x539f('0x21');var _0x3e171b=_0x5cb669[_0x539f('0x22')];var _0xbaf04e=_0x4ff278?0x0:_0x5df17c['offset'];var _0x1ed9db=_0x4ff278?_0x5cb669[_0x539f('0x22')]:_0x5df17c[_0x539f('0x1f')]+_0x5df17c[_0x539f('0x20')];var _0x25c716;if(_0x1ed9db>=_0x3e171b){_0x1ed9db=_0x3e171b;_0x25c716=0xc8;}else{_0x25c716=0xce;}_0x4d216b[_0x539f('0x1d')](_0x25c716);return _0x4d216b[_0x539f('0x23')](_0x539f('0x24'),_0xbaf04e+'-'+_0x1ed9db+'/'+_0x3e171b)['json'](_0x5cb669);}return null;};}function patchUpdates(_0x58a7b5){return function(_0x2a1abb){try{jsonpatch['apply'](_0x2a1abb,_0x58a7b5,!![]);}catch(_0x257b49){return BPromise['reject'](_0x257b49);}return _0x2a1abb[_0x539f('0x25')]();};}function saveUpdates(_0x1b7aea,_0x279a27){return function(_0x53c89d){if(_0x53c89d){return _0x53c89d['update'](_0x1b7aea)[_0x539f('0x26')](function(_0x395613){return _0x395613;});}return null;};}function removeEntity(_0x5f3929,_0x3a19e8){return function(_0x4d212a){if(_0x4d212a){return _0x4d212a['destroy']()[_0x539f('0x26')](function(){_0x5f3929[_0x539f('0x1d')](0xcc)[_0x539f('0x1c')]();});}};}function handleEntityNotFound(_0x4e4e8a,_0x25e2ed){return function(_0x27f8d1){if(!_0x27f8d1){_0x4e4e8a[_0x539f('0x1b')](0x194);}return _0x27f8d1;};}function handleError(_0x26583f,_0x2c1e40){_0x2c1e40=_0x2c1e40||0x1f4;return function(_0x34b52d){logger[_0x539f('0x27')](_0x34b52d[_0x539f('0x28')]);if(_0x34b52d[_0x539f('0x29')]){delete _0x34b52d['name'];}_0x26583f[_0x539f('0x1d')](_0x2c1e40)[_0x539f('0x2a')](_0x34b52d);};}exports[_0x539f('0x2b')]=function(_0x4048cf,_0x54dc8d){var _0x3e62cb={},_0x243816={},_0x31bd32={'count':0x0,'rows':[]};var _0x20eda4=_[_0x539f('0x2c')](db[_0x539f('0x2d')][_0x539f('0x2e')],function(_0x3bd6f0){return{'name':_0x3bd6f0['fieldName'],'type':_0x3bd6f0[_0x539f('0x2f')][_0x539f('0x30')]};});_0x243816[_0x539f('0x31')]=_[_0x539f('0x2c')](_0x20eda4,_0x539f('0x29'));_0x243816['query']=_[_0x539f('0x32')](_0x4048cf['query']);_0x243816[_0x539f('0x33')]=_[_0x539f('0x34')](_0x243816[_0x539f('0x31')],_0x243816[_0x539f('0x35')]);_0x3e62cb[_0x539f('0x36')]=_['intersection'](_0x243816[_0x539f('0x31')],qs[_0x539f('0x37')](_0x4048cf[_0x539f('0x35')][_0x539f('0x37')]));_0x3e62cb[_0x539f('0x36')]=_0x3e62cb[_0x539f('0x36')][_0x539f('0x38')]?_0x3e62cb[_0x539f('0x36')]:_0x243816[_0x539f('0x31')];if(!_0x4048cf[_0x539f('0x35')][_0x539f('0x39')](_0x539f('0x3a'))){_0x3e62cb[_0x539f('0x20')]=qs[_0x539f('0x20')](_0x4048cf[_0x539f('0x35')][_0x539f('0x20')]);_0x3e62cb[_0x539f('0x1f')]=qs[_0x539f('0x1f')](_0x4048cf[_0x539f('0x35')][_0x539f('0x1f')]);}_0x3e62cb[_0x539f('0x3b')]=qs[_0x539f('0x3c')](_0x4048cf['query']['sort']);_0x3e62cb['where']=qs[_0x539f('0x33')](_[_0x539f('0x3d')](_0x4048cf[_0x539f('0x35')],_0x243816[_0x539f('0x33')]),_0x20eda4);if(_0x4048cf['query'][_0x539f('0x3e')]){_0x3e62cb['where']=_['merge'](_0x3e62cb[_0x539f('0x3f')],{'$or':_[_0x539f('0x2c')](_0x20eda4,function(_0x5854aa){if(_0x5854aa['type']!==_0x539f('0x40')){var _0x1fa789={};_0x1fa789[_0x5854aa[_0x539f('0x29')]]={'$like':'%'+_0x4048cf[_0x539f('0x35')][_0x539f('0x3e')]+'%'};return _0x1fa789;}})});}_0x3e62cb=_['merge']({},_0x3e62cb,_0x4048cf[_0x539f('0x41')]);var _0x4e7b3c={'where':_0x3e62cb['where']};return db['SugarcrmField'][_0x539f('0x22')](_0x4e7b3c)[_0x539f('0x26')](function(_0x17025e){_0x31bd32[_0x539f('0x22')]=_0x17025e;if(_0x4048cf['query'][_0x539f('0x42')]){_0x3e62cb[_0x539f('0x43')]=[{'all':!![]}];}return db[_0x539f('0x2d')][_0x539f('0x44')](_0x3e62cb);})[_0x539f('0x26')](function(_0x2fe716){_0x31bd32[_0x539f('0x45')]=_0x2fe716;return _0x31bd32;})[_0x539f('0x26')](respondWithFilteredResult(_0x54dc8d,_0x3e62cb))[_0x539f('0x46')](handleError(_0x54dc8d,null));};exports[_0x539f('0x47')]=function(_0x205578,_0x3ae34b){var _0x49f733={'raw':!![],'where':{'id':_0x205578['params']['id']}},_0xd056a8={};_0xd056a8[_0x539f('0x31')]=_[_0x539f('0x32')](db[_0x539f('0x2d')][_0x539f('0x2e')]);_0xd056a8[_0x539f('0x35')]=_[_0x539f('0x32')](_0x205578[_0x539f('0x35')]);_0xd056a8[_0x539f('0x33')]=_[_0x539f('0x34')](_0xd056a8[_0x539f('0x31')],_0xd056a8[_0x539f('0x35')]);_0x49f733[_0x539f('0x36')]=_[_0x539f('0x34')](_0xd056a8[_0x539f('0x31')],qs['fields'](_0x205578[_0x539f('0x35')]['fields']));_0x49f733[_0x539f('0x36')]=_0x49f733['attributes']['length']?_0x49f733['attributes']:_0xd056a8[_0x539f('0x31')];if(_0x205578['query'][_0x539f('0x42')]){_0x49f733[_0x539f('0x43')]=[{'all':!![]}];}_0x49f733=_[_0x539f('0x48')]({},_0x49f733,_0x205578[_0x539f('0x41')]);return db[_0x539f('0x2d')][_0x539f('0x49')](_0x49f733)[_0x539f('0x26')](handleEntityNotFound(_0x3ae34b,null))['then'](respondWithResult(_0x3ae34b,null))['catch'](handleError(_0x3ae34b,null));};exports[_0x539f('0x4a')]=function(_0x5dd382,_0x3e6c36){return db['SugarcrmField'][_0x539f('0x4a')](_0x5dd382[_0x539f('0x4b')],{})[_0x539f('0x26')](respondWithResult(_0x3e6c36,0xc9))[_0x539f('0x46')](handleError(_0x3e6c36,null));};exports[_0x539f('0x4c')]=function(_0x51c4bb,_0x5713b8){if(_0x51c4bb[_0x539f('0x4b')]['id']){delete _0x51c4bb[_0x539f('0x4b')]['id'];}return db[_0x539f('0x2d')]['find']({'where':{'id':_0x51c4bb[_0x539f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5713b8,null))['then'](saveUpdates(_0x51c4bb[_0x539f('0x4b')],null))['then'](respondWithResult(_0x5713b8,null))[_0x539f('0x46')](handleError(_0x5713b8,null));};exports[_0x539f('0x4e')]=function(_0x288af6,_0x49188b){return db[_0x539f('0x2d')]['find']({'where':{'id':_0x288af6[_0x539f('0x4d')]['id']}})[_0x539f('0x26')](handleEntityNotFound(_0x49188b,null))[_0x539f('0x26')](removeEntity(_0x49188b,null))['catch'](handleError(_0x49188b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index f2d68ca..0352178 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 _0x6568=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','idField'];(function(_0x49bdc4,_0x1e2507){var _0x1f7437=function(_0x25a9f9){while(--_0x25a9f9){_0x49bdc4['push'](_0x49bdc4['shift']());}};_0x1f7437(++_0x1e2507);}(_0x6568,0x152));var _0x8656=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x6568[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x8656('0x0'));var util=require('util');var logger=require(_0x8656('0x1'))(_0x8656('0x2'));var moment=require(_0x8656('0x3'));var BPromise=require(_0x8656('0x4'));var rp=require(_0x8656('0x5'));var fs=require('fs');var path=require(_0x8656('0x6'));var rimraf=require(_0x8656('0x7'));var config=require('../../config/environment');var attributes=require(_0x8656('0x8'));module[_0x8656('0x9')]=function(_0x100687,_0x3304ed){return _0x100687[_0x8656('0xa')]('SugarcrmField',attributes,{'tableName':_0x8656('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x8656('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe50a=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','SugarcrmField'];(function(_0x151973,_0x13e42b){var _0x2424c7=function(_0x3845ca){while(--_0x3845ca){_0x151973['push'](_0x151973['shift']());}};_0x2424c7(++_0x13e42b);}(_0xe50a,0x1e0));var _0xae50=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xe50a[_0x515afd];return _0x536d53;};'use strict';var _=require(_0xae50('0x0'));var util=require(_0xae50('0x1'));var logger=require(_0xae50('0x2'))(_0xae50('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xae50('0x4'));var fs=require('fs');var path=require(_0xae50('0x5'));var rimraf=require('rimraf');var config=require(_0xae50('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0xae50('0x7')]=function(_0x435d22,_0xf85d21){return _0x435d22[_0xae50('0x8')](_0xae50('0x9'),attributes,{'tableName':_0xae50('0xa'),'paranoid':![],'indexes':[{'name':_0xae50('0xb'),'fields':[_0xae50('0xc'),_0xae50('0xd')],'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 b5b9f06..49350b6 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 _0x5ea3=['client','request','then','request\x20sent','debug','code','error','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0x5ea3,0x187));var _0x35ea=function(_0x13f612,_0x45a928){_0x13f612=_0x13f612-0x0;var _0xf4ce1e=_0x5ea3[_0x13f612];return _0xf4ce1e;};'use strict';var _=require(_0x35ea('0x0'));var util=require(_0x35ea('0x1'));var moment=require(_0x35ea('0x2'));var BPromise=require(_0x35ea('0x3'));var rs=require(_0x35ea('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x35ea('0x6'));var jayson=require(_0x35ea('0x7'));var client=jayson[_0x35ea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23e8ed,_0x58e017,_0x309495){return new BPromise(function(_0x3e3ef7,_0x16017e){return client[_0x35ea('0x9')](_0x23e8ed,_0x309495)[_0x35ea('0xa')](function(_0x4fd00b){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x58e017,_0x35ea('0xb'));logger[_0x35ea('0xc')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x58e017,_0x35ea('0xb'),JSON['stringify'](_0x4fd00b));if(_0x4fd00b['error']){if(_0x4fd00b['error'][_0x35ea('0xd')]===0x1f4){logger[_0x35ea('0xe')](_0x35ea('0xf'),_0x58e017,_0x4fd00b[_0x35ea('0xe')][_0x35ea('0x10')]);return _0x16017e(_0x4fd00b['error'][_0x35ea('0x10')]);}logger[_0x35ea('0xe')](_0x35ea('0xf'),_0x58e017,_0x4fd00b[_0x35ea('0xe')][_0x35ea('0x10')]);return _0x3e3ef7(_0x4fd00b[_0x35ea('0xe')][_0x35ea('0x10')]);}else{logger['info'](_0x35ea('0xf'),_0x58e017,'request\x20sent');_0x3e3ef7(_0x4fd00b[_0x35ea('0x11')][_0x35ea('0x10')]);}})[_0x35ea('0x12')](function(_0x3f7168){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x58e017,_0x3f7168);_0x16017e(_0x3f7168);});});} \ No newline at end of file +var _0xe65e=['ioredis','../../mysqldb','rpc','jayson/promise','request','then','info','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2913e7,_0x495c58){var _0x4c6b5d=function(_0x2f4122){while(--_0x2f4122){_0x2913e7['push'](_0x2913e7['shift']());}};_0x4c6b5d(++_0x495c58);}(_0xe65e,0x114));var _0xee65=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xe65e[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xee65('0x0'));var util=require(_0xee65('0x1'));var moment=require(_0xee65('0x2'));var BPromise=require(_0xee65('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee65('0x4'));var db=require(_0xee65('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee65('0x6'));var config=require('../../config/environment');var jayson=require(_0xee65('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11766e,_0xa5708f,_0x350356){return new BPromise(function(_0x22c579,_0xb4c8b4){return client[_0xee65('0x8')](_0x11766e,_0x350356)[_0xee65('0x9')](function(_0x175a41){logger[_0xee65('0xa')]('SugarcrmField,\x20%s,\x20%s',_0xa5708f,_0xee65('0xb'));logger['debug'](_0xee65('0xc'),_0xa5708f,_0xee65('0xb'),JSON[_0xee65('0xd')](_0x175a41));if(_0x175a41['error']){if(_0x175a41['error'][_0xee65('0xe')]===0x1f4){logger[_0xee65('0xf')](_0xee65('0x10'),_0xa5708f,_0x175a41[_0xee65('0xf')][_0xee65('0x11')]);return _0xb4c8b4(_0x175a41[_0xee65('0xf')]['message']);}logger['error'](_0xee65('0x10'),_0xa5708f,_0x175a41[_0xee65('0xf')]['message']);return _0x22c579(_0x175a41[_0xee65('0xf')][_0xee65('0x11')]);}else{logger[_0xee65('0xa')]('SugarcrmField,\x20%s,\x20%s',_0xa5708f,_0xee65('0xb'));_0x22c579(_0x175a41[_0xee65('0x12')][_0xee65('0x11')]);}})[_0xee65('0x13')](function(_0x4b5cd){logger[_0xee65('0xf')]('SugarcrmField,\x20%s,\x20%s',_0xa5708f,_0x4b5cd);_0xb4c8b4(_0x4b5cd);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 9b3363a..b77b9ef 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 _0x2a31=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x13d1d2,_0x23510a){var _0x4ad542=function(_0x49a05e){while(--_0x49a05e){_0x13d1d2['push'](_0x13d1d2['shift']());}};_0x4ad542(++_0x23510a);}(_0x2a31,0xe4));var _0x12a3=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x2a31[_0x2dea24];return _0x309d58;};'use strict';var multer=require(_0x12a3('0x0'));var util=require(_0x12a3('0x1'));var path=require(_0x12a3('0x2'));var timeout=require(_0x12a3('0x3'));var express=require(_0x12a3('0x4'));var router=express[_0x12a3('0x5')]();var fs_extra=require(_0x12a3('0x6'));var auth=require(_0x12a3('0x7'));var interaction=require(_0x12a3('0x8'));var config=require(_0x12a3('0x9'));var controller=require(_0x12a3('0xa'));router[_0x12a3('0xb')]('/',auth[_0x12a3('0xc')](),controller[_0x12a3('0xd')]);router['get'](_0x12a3('0xe'),auth['isAuthenticated'](),controller[_0x12a3('0xf')]);router['get'](_0x12a3('0x10'),auth['isAuthenticated'](),controller[_0x12a3('0x11')]);router['get'](_0x12a3('0x12'),auth[_0x12a3('0xc')](),controller[_0x12a3('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x12a3('0x14')]);router[_0x12a3('0x15')](_0x12a3('0x10'),auth[_0x12a3('0xc')](),controller['addConfiguration']);router['put'](_0x12a3('0xe'),auth['isAuthenticated'](),controller[_0x12a3('0x16')]);router[_0x12a3('0x17')]('/:id',auth[_0x12a3('0xc')](),controller[_0x12a3('0x18')]);module['exports']=router; \ No newline at end of file +var _0x6113=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','show','getFields','create','post','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','express'];(function(_0x819b7d,_0x21e501){var _0x2e2ccc=function(_0x18d177){while(--_0x18d177){_0x819b7d['push'](_0x819b7d['shift']());}};_0x2e2ccc(++_0x21e501);}(_0x6113,0x1c8));var _0x3611=function(_0x424d84,_0x1ae7b3){_0x424d84=_0x424d84-0x0;var _0x470900=_0x6113[_0x424d84];return _0x470900;};'use strict';var multer=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var path=require(_0x3611('0x2'));var timeout=require('connect-timeout');var express=require(_0x3611('0x3'));var router=express[_0x3611('0x4')]();var fs_extra=require(_0x3611('0x5'));var auth=require(_0x3611('0x6'));var interaction=require(_0x3611('0x7'));var config=require(_0x3611('0x8'));var controller=require(_0x3611('0x9'));router['get']('/',auth[_0x3611('0xa')](),controller[_0x3611('0xb')]);router[_0x3611('0xc')]('/:id',auth[_0x3611('0xa')](),controller[_0x3611('0xd')]);router[_0x3611('0xc')]('/:id/configurations',auth[_0x3611('0xa')](),controller['getConfigurations']);router[_0x3611('0xc')]('/:id/fields',auth[_0x3611('0xa')](),controller[_0x3611('0xe')]);router['post']('/',auth[_0x3611('0xa')](),controller[_0x3611('0xf')]);router[_0x3611('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x3611('0x11')]);router[_0x3611('0x12')](_0x3611('0x13'),auth[_0x3611('0xa')](),controller[_0x3611('0x14')]);router[_0x3611('0x15')](_0x3611('0x13'),auth[_0x3611('0xa')](),controller[_0x3611('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 2e27b32..d887a3f 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 _0x51d5=['sequelize','STRING','HelpDesk'];(function(_0x2d41bd,_0x4d661d){var _0x32d849=function(_0x214019){while(--_0x214019){_0x2d41bd['push'](_0x2d41bd['shift']());}};_0x32d849(++_0x4d661d);}(_0x51d5,0xd5));var _0x551d=function(_0x51e5ae,_0xf6e238){_0x51e5ae=_0x51e5ae-0x0;var _0x3325d2=_0x51d5[_0x51e5ae];return _0x3325d2;};'use strict';var Sequelize=require(_0x551d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x551d('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x551d('0x1')],'allowNull':![],'defaultValue':_0x551d('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x551d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x65d5=['STRING','HelpDesk','sequelize','exports'];(function(_0x4071cc,_0x2ba75f){var _0x2f2f8c=function(_0x5bd564){while(--_0x5bd564){_0x4071cc['push'](_0x4071cc['shift']());}};_0x2f2f8c(++_0x2ba75f);}(_0x65d5,0xea));var _0x565d=function(_0xa95bc2,_0x21db2f){_0xa95bc2=_0xa95bc2-0x0;var _0xf570ae=_0x65d5[_0xa95bc2];return _0xf570ae;};'use strict';var Sequelize=require(_0x565d('0x0'));module[_0x565d('0x1')]={'name':{'type':Sequelize[_0x565d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x565d('0x2')]},'username':{'type':Sequelize[_0x565d('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x565d('0x2')],'allowNull':![],'defaultValue':_0x565d('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x565d('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x565d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 8c2c4c7..5aea98b 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 _0x0eed=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','json','reject','update','then','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','destroy','getConfigurations','findOne','VtigerConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','sessionName','reference','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x45313f,_0x46caf4){var _0x402910=function(_0x4883d8){while(--_0x4883d8){_0x45313f['push'](_0x45313f['shift']());}};_0x402910(++_0x46caf4);}(_0x0eed,0xd9));var _0xd0ee=function(_0x3b90aa,_0x2fadb8){_0x3b90aa=_0x3b90aa-0x0;var _0x2ef327=_0x0eed[_0x3b90aa];return _0x2ef327;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0ee('0x0'));var zipdir=require(_0xd0ee('0x1'));var jsonpatch=require(_0xd0ee('0x2'));var rp=require(_0xd0ee('0x3'));var moment=require(_0xd0ee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd0ee('0x5'));var util=require(_0xd0ee('0x6'));var path=require(_0xd0ee('0x7'));var sox=require(_0xd0ee('0x8'));var csv=require(_0xd0ee('0x9'));var ejs=require(_0xd0ee('0xa'));var fs=require('fs');var fs_extra=require(_0xd0ee('0xb'));var _=require('lodash');var squel=require(_0xd0ee('0xc'));var crypto=require(_0xd0ee('0xd'));var jsforce=require(_0xd0ee('0xe'));var deskjs=require(_0xd0ee('0xf'));var toCsv=require(_0xd0ee('0x9'));var querystring=require(_0xd0ee('0x10'));var Papa=require(_0xd0ee('0x11'));var Redis=require(_0xd0ee('0x12'));var authService=require(_0xd0ee('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd0ee('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0ee('0x15'))('api');var utils=require(_0xd0ee('0x16'));var config=require(_0xd0ee('0x17'));var licenseUtil=require(_0xd0ee('0x18'));var db=require(_0xd0ee('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x453461,_0x3d20c2){_0x3d20c2=_0x3d20c2||0xcc;return function(_0x703308){if(_0x703308){return _0x453461[_0xd0ee('0x1a')](_0x3d20c2);}return _0x453461['status'](_0x3d20c2)[_0xd0ee('0x1b')]();};}function respondWithResult(_0x2365c4,_0x1f671d){_0x1f671d=_0x1f671d||0xc8;return function(_0x4a879c){if(_0x4a879c){return _0x2365c4[_0xd0ee('0x1c')](_0x1f671d)['json'](_0x4a879c);}};}function respondWithFilteredResult(_0x141074,_0x274e35){return function(_0x381440){if(_0x381440){var _0x1c54ba=typeof _0x274e35[_0xd0ee('0x1d')]===_0xd0ee('0x1e')&&typeof _0x274e35['limit']==='undefined';var _0x4340e0=_0x381440[_0xd0ee('0x1f')];var _0x380d1b=_0x1c54ba?0x0:_0x274e35[_0xd0ee('0x1d')];var _0x3bad15=_0x1c54ba?_0x381440['count']:_0x274e35[_0xd0ee('0x1d')]+_0x274e35[_0xd0ee('0x20')];var _0x1c0156;if(_0x3bad15>=_0x4340e0){_0x3bad15=_0x4340e0;_0x1c0156=0xc8;}else{_0x1c0156=0xce;}_0x141074[_0xd0ee('0x1c')](_0x1c0156);return _0x141074[_0xd0ee('0x21')]('Content-Range',_0x380d1b+'-'+_0x3bad15+'/'+_0x4340e0)[_0xd0ee('0x22')](_0x381440);}return null;};}function patchUpdates(_0x56fff1){return function(_0x376fc9){try{jsonpatch['apply'](_0x376fc9,_0x56fff1,!![]);}catch(_0x10684f){return BPromise[_0xd0ee('0x23')](_0x10684f);}return _0x376fc9['save']();};}function saveUpdates(_0x430f3b,_0x24e0dc){return function(_0x48eac5){if(_0x48eac5){return _0x48eac5[_0xd0ee('0x24')](_0x430f3b)[_0xd0ee('0x25')](function(_0x572073){return _0x572073;});}return null;};}function removeEntity(_0x20928a,_0x240b30){return function(_0x5b1a23){if(_0x5b1a23){return _0x5b1a23['destroy']()[_0xd0ee('0x25')](function(){_0x20928a[_0xd0ee('0x1c')](0xcc)[_0xd0ee('0x1b')]();});}};}function handleEntityNotFound(_0x36ae95,_0x3ac73f){return function(_0x249774){if(!_0x249774){_0x36ae95[_0xd0ee('0x1a')](0x194);}return _0x249774;};}function handleError(_0x24ca3c,_0x4231c7){_0x4231c7=_0x4231c7||0x1f4;return function(_0x5d0ff4){logger['error'](_0x5d0ff4[_0xd0ee('0x26')]);if(_0x5d0ff4[_0xd0ee('0x27')]){delete _0x5d0ff4[_0xd0ee('0x27')];}_0x24ca3c[_0xd0ee('0x1c')](_0x4231c7)[_0xd0ee('0x28')](_0x5d0ff4);};}exports['index']=function(_0x59767a,_0x3c6c25){var _0x5a5d33={},_0x57c28b={},_0x35b2f1={'count':0x0,'rows':[]};var _0x3996e6=_[_0xd0ee('0x29')](db[_0xd0ee('0x2a')][_0xd0ee('0x2b')],function(_0xe3c47d){return{'name':_0xe3c47d[_0xd0ee('0x2c')],'type':_0xe3c47d['type'][_0xd0ee('0x2d')]};});_0x57c28b['model']=_[_0xd0ee('0x29')](_0x3996e6,_0xd0ee('0x27'));_0x57c28b[_0xd0ee('0x2e')]=_['keys'](_0x59767a[_0xd0ee('0x2e')]);_0x57c28b[_0xd0ee('0x2f')]=_[_0xd0ee('0x30')](_0x57c28b[_0xd0ee('0x31')],_0x57c28b[_0xd0ee('0x2e')]);_0x5a5d33[_0xd0ee('0x32')]=_[_0xd0ee('0x30')](_0x57c28b[_0xd0ee('0x31')],qs[_0xd0ee('0x33')](_0x59767a[_0xd0ee('0x2e')]['fields']));_0x5a5d33['attributes']=_0x5a5d33[_0xd0ee('0x32')][_0xd0ee('0x34')]?_0x5a5d33[_0xd0ee('0x32')]:_0x57c28b[_0xd0ee('0x31')];if(!_0x59767a[_0xd0ee('0x2e')][_0xd0ee('0x35')](_0xd0ee('0x36'))){_0x5a5d33['limit']=qs['limit'](_0x59767a[_0xd0ee('0x2e')][_0xd0ee('0x20')]);_0x5a5d33[_0xd0ee('0x1d')]=qs[_0xd0ee('0x1d')](_0x59767a['query']['offset']);}_0x5a5d33[_0xd0ee('0x37')]=qs[_0xd0ee('0x38')](_0x59767a['query']['sort']);_0x5a5d33[_0xd0ee('0x39')]=qs['filters'](_[_0xd0ee('0x3a')](_0x59767a[_0xd0ee('0x2e')],_0x57c28b[_0xd0ee('0x2f')]),_0x3996e6);if(_0x59767a[_0xd0ee('0x2e')][_0xd0ee('0x3b')]){_0x5a5d33[_0xd0ee('0x39')]=_['merge'](_0x5a5d33[_0xd0ee('0x39')],{'$or':_[_0xd0ee('0x29')](_0x3996e6,function(_0x586e19){if(_0x586e19[_0xd0ee('0x3c')]!=='VIRTUAL'){var _0x326b17={};_0x326b17[_0x586e19[_0xd0ee('0x27')]]={'$like':'%'+_0x59767a[_0xd0ee('0x2e')][_0xd0ee('0x3b')]+'%'};return _0x326b17;}})});}_0x5a5d33=_[_0xd0ee('0x3d')]({},_0x5a5d33,_0x59767a[_0xd0ee('0x3e')]);var _0x33ec3f={'where':_0x5a5d33[_0xd0ee('0x39')]};return db[_0xd0ee('0x2a')][_0xd0ee('0x1f')](_0x33ec3f)[_0xd0ee('0x25')](function(_0x593e6e){_0x35b2f1[_0xd0ee('0x1f')]=_0x593e6e;if(_0x59767a[_0xd0ee('0x2e')][_0xd0ee('0x3f')]){_0x5a5d33[_0xd0ee('0x40')]=[{'all':!![]}];}return db[_0xd0ee('0x2a')][_0xd0ee('0x41')](_0x5a5d33);})[_0xd0ee('0x25')](function(_0x76797){_0x35b2f1['rows']=_0x76797;return _0x35b2f1;})['then'](respondWithFilteredResult(_0x3c6c25,_0x5a5d33))['catch'](handleError(_0x3c6c25,null));};exports[_0xd0ee('0x42')]=function(_0x1d66ab,_0x21c276){var _0x59f9f6={'raw':![],'where':{'id':_0x1d66ab[_0xd0ee('0x43')]['id']}},_0x1924f1={};_0x1924f1[_0xd0ee('0x31')]=_[_0xd0ee('0x44')](db['VtigerAccount']['rawAttributes']);_0x1924f1['query']=_['keys'](_0x1d66ab[_0xd0ee('0x2e')]);_0x1924f1['filters']=_['intersection'](_0x1924f1[_0xd0ee('0x31')],_0x1924f1[_0xd0ee('0x2e')]);_0x59f9f6[_0xd0ee('0x32')]=_['intersection'](_0x1924f1['model'],qs[_0xd0ee('0x33')](_0x1d66ab[_0xd0ee('0x2e')]['fields']));_0x59f9f6['attributes']=_0x59f9f6[_0xd0ee('0x32')][_0xd0ee('0x34')]?_0x59f9f6[_0xd0ee('0x32')]:_0x1924f1[_0xd0ee('0x31')];if(_0x1d66ab['query'][_0xd0ee('0x3f')]){_0x59f9f6[_0xd0ee('0x40')]=[{'all':!![]}];}_0x59f9f6=_[_0xd0ee('0x3d')]({},_0x59f9f6,_0x1d66ab[_0xd0ee('0x3e')]);return db[_0xd0ee('0x2a')][_0xd0ee('0x45')](_0x59f9f6)[_0xd0ee('0x25')](handleEntityNotFound(_0x21c276,null))[_0xd0ee('0x25')](respondWithResult(_0x21c276,null))[_0xd0ee('0x46')](handleError(_0x21c276,null));};exports[_0xd0ee('0x47')]=function(_0x9ac170,_0x41ace4){return db[_0xd0ee('0x2a')]['create'](_0x9ac170[_0xd0ee('0x48')],{})[_0xd0ee('0x25')](respondWithResult(_0x41ace4,0xc9))[_0xd0ee('0x46')](handleError(_0x41ace4,null));};exports[_0xd0ee('0x24')]=function(_0x2e0564,_0x59ab56){if(_0x2e0564['body']['id']){delete _0x2e0564[_0xd0ee('0x48')]['id'];}return db[_0xd0ee('0x2a')]['find']({'where':{'id':_0x2e0564['params']['id']}})['then'](handleEntityNotFound(_0x59ab56,null))[_0xd0ee('0x25')](saveUpdates(_0x2e0564['body'],null))[_0xd0ee('0x25')](respondWithResult(_0x59ab56,null))['catch'](handleError(_0x59ab56,null));};exports[_0xd0ee('0x49')]=function(_0x52abc3,_0x4170d0){return db[_0xd0ee('0x2a')][_0xd0ee('0x45')]({'where':{'id':_0x52abc3['params']['id']}})[_0xd0ee('0x25')](handleEntityNotFound(_0x4170d0,null))[_0xd0ee('0x25')](removeEntity(_0x4170d0,null))[_0xd0ee('0x46')](handleError(_0x4170d0,null));};exports[_0xd0ee('0x4a')]=function(_0x122db8,_0x399725,_0x1cc1a8){var _0x7d82b3={};var _0x524a24={};var _0x9035f4;var _0x32631d;return db[_0xd0ee('0x2a')][_0xd0ee('0x4b')]({'where':{'id':_0x122db8['params']['id']}})['then'](handleEntityNotFound(_0x399725,null))[_0xd0ee('0x25')](function(_0x2d3c29){if(_0x2d3c29){_0x9035f4=_0x2d3c29;_0x524a24['model']=_['keys'](db[_0xd0ee('0x4c')][_0xd0ee('0x2b')]);_0x524a24[_0xd0ee('0x2e')]=_[_0xd0ee('0x44')](_0x122db8[_0xd0ee('0x2e')]);_0x524a24[_0xd0ee('0x2f')]=_['intersection'](_0x524a24[_0xd0ee('0x31')],_0x524a24[_0xd0ee('0x2e')]);_0x7d82b3[_0xd0ee('0x32')]=_[_0xd0ee('0x30')](_0x524a24[_0xd0ee('0x31')],qs[_0xd0ee('0x33')](_0x122db8['query']['fields']));_0x7d82b3[_0xd0ee('0x32')]=_0x7d82b3[_0xd0ee('0x32')]['length']?_0x7d82b3[_0xd0ee('0x32')]:_0x524a24[_0xd0ee('0x31')];_0x7d82b3['order']=qs['sort'](_0x122db8[_0xd0ee('0x2e')]['sort']);_0x7d82b3[_0xd0ee('0x39')]=qs['filters'](_['pick'](_0x122db8[_0xd0ee('0x2e')],_0x524a24[_0xd0ee('0x2f')]));if(_0x122db8[_0xd0ee('0x2e')][_0xd0ee('0x3b')]){_0x7d82b3[_0xd0ee('0x39')]=_['merge'](_0x7d82b3[_0xd0ee('0x39')],{'$or':_[_0xd0ee('0x29')](_0x7d82b3['attributes'],function(_0x16becd){var _0x54224c={};_0x54224c[_0x16becd]={'$like':'%'+_0x122db8[_0xd0ee('0x2e')][_0xd0ee('0x3b')]+'%'};return _0x54224c;})});}_0x7d82b3=_[_0xd0ee('0x3d')]({},_0x7d82b3,_0x122db8[_0xd0ee('0x3e')]);return _0x9035f4[_0xd0ee('0x4a')](_0x7d82b3);}})[_0xd0ee('0x25')](function(_0x17d505){if(_0x17d505){_0x32631d=_0x17d505['length'];if(!_0x122db8[_0xd0ee('0x2e')][_0xd0ee('0x35')](_0xd0ee('0x36'))){_0x7d82b3[_0xd0ee('0x20')]=qs[_0xd0ee('0x20')](_0x122db8[_0xd0ee('0x2e')][_0xd0ee('0x20')]);_0x7d82b3[_0xd0ee('0x1d')]=qs[_0xd0ee('0x1d')](_0x122db8['query']['offset']);}return _0x9035f4[_0xd0ee('0x4a')](_0x7d82b3);}})['then'](function(_0x1072a3){if(_0x1072a3){return _0x1072a3?{'count':_0x32631d,'rows':_0x1072a3}:null;}})[_0xd0ee('0x25')](respondWithResult(_0x399725,null))['catch'](handleError(_0x399725,null));};exports['addConfiguration']=function(_0x34109e,_0x4096b6,_0xcebb54){if(_0x34109e[_0xd0ee('0x48')]['id']){delete _0x34109e['body']['id'];}return db[_0xd0ee('0x2a')][_0xd0ee('0x4b')]({'where':{'id':_0x34109e[_0xd0ee('0x43')]['id']}})[_0xd0ee('0x25')](handleEntityNotFound(_0x4096b6,null))[_0xd0ee('0x25')](function(_0x2ca777){if(_0x2ca777){_0x34109e['body']['AccountId']=_0x2ca777['id'];_0x34109e[_0xd0ee('0x48')][_0xd0ee('0x4d')]=integrations[_0xd0ee('0x4e')](_0x34109e[_0xd0ee('0x48')]['channel'],_0x34109e['body'][_0xd0ee('0x3c')]);_0x34109e[_0xd0ee('0x48')][_0xd0ee('0x4f')]=integrations[_0xd0ee('0x50')](_0x34109e[_0xd0ee('0x48')]['channel'],_0x34109e[_0xd0ee('0x48')][_0xd0ee('0x3c')]);return db[_0xd0ee('0x4c')]['create'](_0x34109e[_0xd0ee('0x48')],{'include':[{'model':db[_0xd0ee('0x51')],'as':_0xd0ee('0x4d')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0xd0ee('0x25')](respondWithResult(_0x4096b6,null))[_0xd0ee('0x46')](handleError(_0x4096b6,null));};var md5=require('md5');exports[_0xd0ee('0x52')]=function(_0x356a48,_0x2c9d8c,_0x28b459){var _0x28b8dc=null;var _0xd8e461=null;var _0x479e0a=null;var _0x2ee794=null;var _0x598015='';return db[_0xd0ee('0x2a')][_0xd0ee('0x4b')]({'where':{'id':_0x356a48['params']['id']},'attributes':['id',_0xd0ee('0x27'),_0xd0ee('0x53'),_0xd0ee('0x54'),_0xd0ee('0x55'),'remoteUri','serverUrl',_0xd0ee('0x56')]})[_0xd0ee('0x25')](handleEntityNotFound(_0x2c9d8c,null))[_0xd0ee('0x25')](function(_0x26bc73){if(_0x26bc73){_0x28b8dc=_0x26bc73[_0xd0ee('0x53')];_0xd8e461=_0x26bc73[_0xd0ee('0x56')];_0x479e0a=_0x26bc73[_0xd0ee('0x55')];_0x598015=_0x26bc73[_0xd0ee('0x57')];var _0x2736f3=_0x598015[_0xd0ee('0x58')](-0x1);if(_0x2736f3==='/'){_0x598015=_0x598015[_0xd0ee('0x59')](0x0,_0x598015[_0xd0ee('0x5a')](_0x2736f3));}_0x2ee794=util[_0xd0ee('0x5b')](_0xd0ee('0x5c'),_0x598015);var _0x245410={'method':_0xd0ee('0x5d'),'uri':_0x2ee794,'qs':{'operation':_0xd0ee('0x5e'),'username':_0x26bc73['username']},'json':!![]};return rp(_0x245410);}})[_0xd0ee('0x25')](function(_0x31a49c){if(_0x31a49c[_0xd0ee('0x5f')]){var _0x573dde={'method':_0xd0ee('0x60'),'uri':_0x2ee794,'form':{'operation':_0xd0ee('0x61'),'username':_0x28b8dc,'accessKey':md5(_0x31a49c[_0xd0ee('0x62')]['token']+_0xd8e461)},'json':!![]};return rp(_0x573dde);}})['then'](function(_0x527b6b){if(_0x527b6b[_0xd0ee('0x5f')]){var _0x506b80={'method':_0xd0ee('0x5d'),'uri':_0x2ee794,'qs':{'operation':'describe','username':_0x28b8dc,'sessionName':_0x527b6b[_0xd0ee('0x62')][_0xd0ee('0x63')],'elementType':_0x479e0a},'json':!![]};return rp(_0x506b80);}})['then'](function(_0x4618bb){if(_0x4618bb[_0xd0ee('0x5f')]){var _0xb4fedf=['autogenerated',_0xd0ee('0x64'),_0xd0ee('0x65')];_[_0xd0ee('0x66')](_0x4618bb['result'][_0xd0ee('0x33')],function(_0x5c0e66){return _0xb4fedf['includes'](_0x5c0e66[_0xd0ee('0x3c')][_0xd0ee('0x27')]);});_[_0xd0ee('0x66')](_0x4618bb[_0xd0ee('0x62')][_0xd0ee('0x33')],function(_0x192226){return _0x192226[_0xd0ee('0x67')]===_0xd0ee('0x68');});return{'count':_0x4618bb[_0xd0ee('0x62')]['fields'][_0xd0ee('0x34')],'rows':_[_0xd0ee('0x29')](_0x4618bb[_0xd0ee('0x62')][_0xd0ee('0x33')],function(_0x586f06){return{'id':_0x586f06[_0xd0ee('0x27')],'name':_0x586f06[_0xd0ee('0x69')],'custom':_[_0xd0ee('0x6a')](_0x586f06[_0xd0ee('0x27')],_0xd0ee('0x6b'))?!![]:![],'options':_0x586f06[_0xd0ee('0x3c')][_0xd0ee('0x27')]===_0xd0ee('0x6c')&&_0x586f06[_0xd0ee('0x3c')][_0xd0ee('0x6d')][_0xd0ee('0x34')]>0x0?_[_0xd0ee('0x29')](_0x586f06['type'][_0xd0ee('0x6d')],function(_0x22c015){return{'name':_0x22c015[_0xd0ee('0x69')],'value':_0x22c015[_0xd0ee('0x6e')]};}):[]};})};}})[_0xd0ee('0x25')](respondWithResult(_0x2c9d8c,null))[_0xd0ee('0x46')](function(_0x5b0cec){console['log'](_0xd0ee('0x6f')+_0x5b0cec);var _0x50991d=_0x356a48[_0xd0ee('0x2e')][_0xd0ee('0x70')]?0x1f4:_0x5b0cec[_0xd0ee('0x71')]||0x1f4;logger[_0xd0ee('0x72')](_0xd0ee('0x73'),_0xd0ee('0x52'),_0x50991d,JSON[_0xd0ee('0x74')](_0x5b0cec));delete _0x5b0cec[_0xd0ee('0x27')];if(_0x50991d===0x191){_0x50991d=0x190;}_0x2c9d8c['status'](_0x50991d)[_0xd0ee('0x28')](_0x356a48[_0xd0ee('0x2e')][_0xd0ee('0x70')]?{'message':_0xd0ee('0x75'),'statusCode':_0x5b0cec['statusCode']}:_0x5b0cec);});}; \ No newline at end of file +var _0x63a7=['util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','then','includeAll','VtigerAccount','findAll','rows','catch','show','include','find','create','body','params','destroy','getConfigurations','VtigerConfiguration','options','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','slice','substring','format','GET','getchallenge','success','POST','result','describe','autogenerated','reference','owner','includes','remove','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','stringify','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x3577aa,_0x401630){var _0x1bff51=function(_0x524cfa){while(--_0x524cfa){_0x3577aa['push'](_0x3577aa['shift']());}};_0x1bff51(++_0x401630);}(_0x63a7,0xe4));var _0x763a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x63a7[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x763a('0x0'));var rimraf=require(_0x763a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x763a('0x2'));var moment=require(_0x763a('0x3'));var BPromise=require(_0x763a('0x4'));var Mustache=require(_0x763a('0x5'));var util=require(_0x763a('0x6'));var path=require(_0x763a('0x7'));var sox=require(_0x763a('0x8'));var csv=require(_0x763a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x763a('0xa'));var squel=require(_0x763a('0xb'));var crypto=require(_0x763a('0xc'));var jsforce=require(_0x763a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x763a('0x9'));var querystring=require(_0x763a('0xe'));var Papa=require(_0x763a('0xf'));var Redis=require('ioredis');var authService=require(_0x763a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x763a('0x11'));var hardwareService=require(_0x763a('0x12'));var logger=require(_0x763a('0x13'))('api');var utils=require(_0x763a('0x14'));var config=require(_0x763a('0x15'));var licenseUtil=require(_0x763a('0x16'));var db=require(_0x763a('0x17'))['db'];var integrations=require(_0x763a('0x18'));function respondWithStatusCode(_0x4bae90,_0x2fcc34){_0x2fcc34=_0x2fcc34||0xcc;return function(_0xd13a2a){if(_0xd13a2a){return _0x4bae90['sendStatus'](_0x2fcc34);}return _0x4bae90[_0x763a('0x19')](_0x2fcc34)[_0x763a('0x1a')]();};}function respondWithResult(_0x48510b,_0x3ae157){_0x3ae157=_0x3ae157||0xc8;return function(_0x19f130){if(_0x19f130){return _0x48510b[_0x763a('0x19')](_0x3ae157)[_0x763a('0x1b')](_0x19f130);}};}function respondWithFilteredResult(_0x228e41,_0x1144c4){return function(_0x221099){if(_0x221099){var _0x532efa=typeof _0x1144c4[_0x763a('0x1c')]===_0x763a('0x1d')&&typeof _0x1144c4[_0x763a('0x1e')]===_0x763a('0x1d');var _0x3d6d63=_0x221099[_0x763a('0x1f')];var _0x3a79cd=_0x532efa?0x0:_0x1144c4[_0x763a('0x1c')];var _0x172337=_0x532efa?_0x221099[_0x763a('0x1f')]:_0x1144c4[_0x763a('0x1c')]+_0x1144c4['limit'];var _0x5e8647;if(_0x172337>=_0x3d6d63){_0x172337=_0x3d6d63;_0x5e8647=0xc8;}else{_0x5e8647=0xce;}_0x228e41['status'](_0x5e8647);return _0x228e41[_0x763a('0x20')](_0x763a('0x21'),_0x3a79cd+'-'+_0x172337+'/'+_0x3d6d63)[_0x763a('0x1b')](_0x221099);}return null;};}function patchUpdates(_0x34b0e8){return function(_0x329f38){try{jsonpatch[_0x763a('0x22')](_0x329f38,_0x34b0e8,!![]);}catch(_0x4daea8){return BPromise[_0x763a('0x23')](_0x4daea8);}return _0x329f38[_0x763a('0x24')]();};}function saveUpdates(_0x35b9a0,_0x5a51c3){return function(_0x22aaf5){if(_0x22aaf5){return _0x22aaf5[_0x763a('0x25')](_0x35b9a0)['then'](function(_0xd9542b){return _0xd9542b;});}return null;};}function removeEntity(_0x4b610c,_0x24d5c9){return function(_0xf74bca){if(_0xf74bca){return _0xf74bca['destroy']()['then'](function(){_0x4b610c[_0x763a('0x19')](0xcc)[_0x763a('0x1a')]();});}};}function handleEntityNotFound(_0xd32f20,_0x104af6){return function(_0x205a03){if(!_0x205a03){_0xd32f20['sendStatus'](0x194);}return _0x205a03;};}function handleError(_0xc995f3,_0x5cba24){_0x5cba24=_0x5cba24||0x1f4;return function(_0x42723a){logger[_0x763a('0x26')](_0x42723a[_0x763a('0x27')]);if(_0x42723a[_0x763a('0x28')]){delete _0x42723a['name'];}_0xc995f3['status'](_0x5cba24)[_0x763a('0x29')](_0x42723a);};}exports[_0x763a('0x2a')]=function(_0x5a7b49,_0x158357){var _0x73a97a={},_0x1bb232={},_0x14ec86={'count':0x0,'rows':[]};var _0x1ba4bb=_['map'](db['VtigerAccount'][_0x763a('0x2b')],function(_0x5742f8){return{'name':_0x5742f8['fieldName'],'type':_0x5742f8[_0x763a('0x2c')][_0x763a('0x2d')]};});_0x1bb232[_0x763a('0x2e')]=_['map'](_0x1ba4bb,_0x763a('0x28'));_0x1bb232[_0x763a('0x2f')]=_[_0x763a('0x30')](_0x5a7b49[_0x763a('0x2f')]);_0x1bb232[_0x763a('0x31')]=_['intersection'](_0x1bb232[_0x763a('0x2e')],_0x1bb232[_0x763a('0x2f')]);_0x73a97a['attributes']=_[_0x763a('0x32')](_0x1bb232[_0x763a('0x2e')],qs['fields'](_0x5a7b49[_0x763a('0x2f')][_0x763a('0x33')]));_0x73a97a[_0x763a('0x34')]=_0x73a97a[_0x763a('0x34')][_0x763a('0x35')]?_0x73a97a['attributes']:_0x1bb232[_0x763a('0x2e')];if(!_0x5a7b49[_0x763a('0x2f')][_0x763a('0x36')](_0x763a('0x37'))){_0x73a97a[_0x763a('0x1e')]=qs['limit'](_0x5a7b49[_0x763a('0x2f')][_0x763a('0x1e')]);_0x73a97a[_0x763a('0x1c')]=qs[_0x763a('0x1c')](_0x5a7b49['query']['offset']);}_0x73a97a[_0x763a('0x38')]=qs[_0x763a('0x39')](_0x5a7b49[_0x763a('0x2f')][_0x763a('0x39')]);_0x73a97a['where']=qs[_0x763a('0x31')](_[_0x763a('0x3a')](_0x5a7b49[_0x763a('0x2f')],_0x1bb232[_0x763a('0x31')]),_0x1ba4bb);if(_0x5a7b49[_0x763a('0x2f')][_0x763a('0x3b')]){_0x73a97a[_0x763a('0x3c')]=_[_0x763a('0x3d')](_0x73a97a[_0x763a('0x3c')],{'$or':_[_0x763a('0x3e')](_0x1ba4bb,function(_0x228a7c){if(_0x228a7c[_0x763a('0x2c')]!=='VIRTUAL'){var _0x3e47a1={};_0x3e47a1[_0x228a7c[_0x763a('0x28')]]={'$like':'%'+_0x5a7b49['query'][_0x763a('0x3b')]+'%'};return _0x3e47a1;}})});}_0x73a97a=_[_0x763a('0x3d')]({},_0x73a97a,_0x5a7b49['options']);var _0x1029e3={'where':_0x73a97a[_0x763a('0x3c')]};return db['VtigerAccount'][_0x763a('0x1f')](_0x1029e3)[_0x763a('0x3f')](function(_0xae805c){_0x14ec86['count']=_0xae805c;if(_0x5a7b49[_0x763a('0x2f')][_0x763a('0x40')]){_0x73a97a['include']=[{'all':!![]}];}return db[_0x763a('0x41')][_0x763a('0x42')](_0x73a97a);})[_0x763a('0x3f')](function(_0x707f4c){_0x14ec86[_0x763a('0x43')]=_0x707f4c;return _0x14ec86;})[_0x763a('0x3f')](respondWithFilteredResult(_0x158357,_0x73a97a))[_0x763a('0x44')](handleError(_0x158357,null));};exports[_0x763a('0x45')]=function(_0x5b3a62,_0x367b1d){var _0x245fba={'raw':![],'where':{'id':_0x5b3a62['params']['id']}},_0x570e93={};_0x570e93['model']=_['keys'](db[_0x763a('0x41')][_0x763a('0x2b')]);_0x570e93[_0x763a('0x2f')]=_['keys'](_0x5b3a62['query']);_0x570e93['filters']=_['intersection'](_0x570e93[_0x763a('0x2e')],_0x570e93[_0x763a('0x2f')]);_0x245fba[_0x763a('0x34')]=_['intersection'](_0x570e93[_0x763a('0x2e')],qs[_0x763a('0x33')](_0x5b3a62[_0x763a('0x2f')][_0x763a('0x33')]));_0x245fba[_0x763a('0x34')]=_0x245fba[_0x763a('0x34')][_0x763a('0x35')]?_0x245fba[_0x763a('0x34')]:_0x570e93['model'];if(_0x5b3a62[_0x763a('0x2f')][_0x763a('0x40')]){_0x245fba[_0x763a('0x46')]=[{'all':!![]}];}_0x245fba=_['merge']({},_0x245fba,_0x5b3a62['options']);return db[_0x763a('0x41')][_0x763a('0x47')](_0x245fba)[_0x763a('0x3f')](handleEntityNotFound(_0x367b1d,null))[_0x763a('0x3f')](respondWithResult(_0x367b1d,null))[_0x763a('0x44')](handleError(_0x367b1d,null));};exports['create']=function(_0x4cc15c,_0x1562fd){return db[_0x763a('0x41')][_0x763a('0x48')](_0x4cc15c[_0x763a('0x49')],{})['then'](respondWithResult(_0x1562fd,0xc9))[_0x763a('0x44')](handleError(_0x1562fd,null));};exports[_0x763a('0x25')]=function(_0x8e6d84,_0x41e877){if(_0x8e6d84[_0x763a('0x49')]['id']){delete _0x8e6d84['body']['id'];}return db[_0x763a('0x41')]['find']({'where':{'id':_0x8e6d84[_0x763a('0x4a')]['id']}})[_0x763a('0x3f')](handleEntityNotFound(_0x41e877,null))['then'](saveUpdates(_0x8e6d84[_0x763a('0x49')],null))['then'](respondWithResult(_0x41e877,null))[_0x763a('0x44')](handleError(_0x41e877,null));};exports[_0x763a('0x4b')]=function(_0x5223a7,_0x4e070d){return db[_0x763a('0x41')][_0x763a('0x47')]({'where':{'id':_0x5223a7['params']['id']}})[_0x763a('0x3f')](handleEntityNotFound(_0x4e070d,null))[_0x763a('0x3f')](removeEntity(_0x4e070d,null))[_0x763a('0x44')](handleError(_0x4e070d,null));};exports[_0x763a('0x4c')]=function(_0x24d41e,_0x3cde95,_0xfa9786){var _0x25c068={};var _0x3b7fcc={};var _0x39f165;var _0x1fb95a;return db[_0x763a('0x41')]['findOne']({'where':{'id':_0x24d41e[_0x763a('0x4a')]['id']}})[_0x763a('0x3f')](handleEntityNotFound(_0x3cde95,null))[_0x763a('0x3f')](function(_0x2fbd41){if(_0x2fbd41){_0x39f165=_0x2fbd41;_0x3b7fcc[_0x763a('0x2e')]=_['keys'](db[_0x763a('0x4d')][_0x763a('0x2b')]);_0x3b7fcc['query']=_[_0x763a('0x30')](_0x24d41e[_0x763a('0x2f')]);_0x3b7fcc['filters']=_['intersection'](_0x3b7fcc[_0x763a('0x2e')],_0x3b7fcc[_0x763a('0x2f')]);_0x25c068['attributes']=_[_0x763a('0x32')](_0x3b7fcc[_0x763a('0x2e')],qs[_0x763a('0x33')](_0x24d41e['query'][_0x763a('0x33')]));_0x25c068['attributes']=_0x25c068[_0x763a('0x34')]['length']?_0x25c068[_0x763a('0x34')]:_0x3b7fcc[_0x763a('0x2e')];_0x25c068['order']=qs[_0x763a('0x39')](_0x24d41e[_0x763a('0x2f')][_0x763a('0x39')]);_0x25c068[_0x763a('0x3c')]=qs[_0x763a('0x31')](_[_0x763a('0x3a')](_0x24d41e[_0x763a('0x2f')],_0x3b7fcc[_0x763a('0x31')]));if(_0x24d41e['query'][_0x763a('0x3b')]){_0x25c068['where']=_[_0x763a('0x3d')](_0x25c068[_0x763a('0x3c')],{'$or':_['map'](_0x25c068[_0x763a('0x34')],function(_0x5b1048){var _0xbcedd1={};_0xbcedd1[_0x5b1048]={'$like':'%'+_0x24d41e[_0x763a('0x2f')][_0x763a('0x3b')]+'%'};return _0xbcedd1;})});}_0x25c068=_['merge']({},_0x25c068,_0x24d41e[_0x763a('0x4e')]);return _0x39f165[_0x763a('0x4c')](_0x25c068);}})[_0x763a('0x3f')](function(_0x24c67c){if(_0x24c67c){_0x1fb95a=_0x24c67c[_0x763a('0x35')];if(!_0x24d41e[_0x763a('0x2f')]['hasOwnProperty'](_0x763a('0x37'))){_0x25c068[_0x763a('0x1e')]=qs['limit'](_0x24d41e[_0x763a('0x2f')][_0x763a('0x1e')]);_0x25c068[_0x763a('0x1c')]=qs[_0x763a('0x1c')](_0x24d41e[_0x763a('0x2f')][_0x763a('0x1c')]);}return _0x39f165[_0x763a('0x4c')](_0x25c068);}})[_0x763a('0x3f')](function(_0x50761e){if(_0x50761e){return _0x50761e?{'count':_0x1fb95a,'rows':_0x50761e}:null;}})[_0x763a('0x3f')](respondWithResult(_0x3cde95,null))[_0x763a('0x44')](handleError(_0x3cde95,null));};exports['addConfiguration']=function(_0x56c506,_0x169f46,_0x590026){if(_0x56c506[_0x763a('0x49')]['id']){delete _0x56c506['body']['id'];}return db[_0x763a('0x41')]['findOne']({'where':{'id':_0x56c506[_0x763a('0x4a')]['id']}})[_0x763a('0x3f')](handleEntityNotFound(_0x169f46,null))[_0x763a('0x3f')](function(_0x28c935){if(_0x28c935){_0x56c506['body'][_0x763a('0x4f')]=_0x28c935['id'];_0x56c506[_0x763a('0x49')][_0x763a('0x50')]=integrations[_0x763a('0x51')](_0x56c506[_0x763a('0x49')][_0x763a('0x52')],_0x56c506['body'][_0x763a('0x2c')]);_0x56c506[_0x763a('0x49')]['Descriptions']=integrations[_0x763a('0x53')](_0x56c506[_0x763a('0x49')][_0x763a('0x52')],_0x56c506[_0x763a('0x49')][_0x763a('0x2c')]);return db['VtigerConfiguration'][_0x763a('0x48')](_0x56c506[_0x763a('0x49')],{'include':[{'model':db[_0x763a('0x54')],'as':_0x763a('0x50')},{'model':db[_0x763a('0x54')],'as':'Descriptions'}]});}return null;})[_0x763a('0x3f')](respondWithResult(_0x169f46,null))['catch'](handleError(_0x169f46,null));};var md5=require(_0x763a('0x55'));exports[_0x763a('0x56')]=function(_0x5983b8,_0x12632f,_0x287feb){var _0x58aa08=null;var _0x3fdb45=null;var _0x10d771=null;var _0xde86f2=null;var _0x1adbbb='';return db[_0x763a('0x41')]['findOne']({'where':{'id':_0x5983b8[_0x763a('0x4a')]['id']},'attributes':['id',_0x763a('0x28'),_0x763a('0x57'),_0x763a('0x58'),_0x763a('0x59'),'remoteUri',_0x763a('0x5a'),_0x763a('0x5b')]})[_0x763a('0x3f')](handleEntityNotFound(_0x12632f,null))['then'](function(_0x4b1fa6){if(_0x4b1fa6){_0x58aa08=_0x4b1fa6['username'];_0x3fdb45=_0x4b1fa6[_0x763a('0x5b')];_0x10d771=_0x4b1fa6[_0x763a('0x59')];_0x1adbbb=_0x4b1fa6['remoteUri'];var _0x19d6b2=_0x1adbbb[_0x763a('0x5c')](-0x1);if(_0x19d6b2==='/'){_0x1adbbb=_0x1adbbb[_0x763a('0x5d')](0x0,_0x1adbbb['lastIndexOf'](_0x19d6b2));}_0xde86f2=util[_0x763a('0x5e')]('%s/webservice.php',_0x1adbbb);var _0x1750aa={'method':_0x763a('0x5f'),'uri':_0xde86f2,'qs':{'operation':_0x763a('0x60'),'username':_0x4b1fa6[_0x763a('0x57')]},'json':!![]};return rp(_0x1750aa);}})[_0x763a('0x3f')](function(_0x1fad05){if(_0x1fad05[_0x763a('0x61')]){var _0x4c996b={'method':_0x763a('0x62'),'uri':_0xde86f2,'form':{'operation':'login','username':_0x58aa08,'accessKey':md5(_0x1fad05[_0x763a('0x63')]['token']+_0x3fdb45)},'json':!![]};return rp(_0x4c996b);}})[_0x763a('0x3f')](function(_0x540483){if(_0x540483['success']){var _0x186177={'method':_0x763a('0x5f'),'uri':_0xde86f2,'qs':{'operation':_0x763a('0x64'),'username':_0x58aa08,'sessionName':_0x540483[_0x763a('0x63')]['sessionName'],'elementType':_0x10d771},'json':!![]};return rp(_0x186177);}})[_0x763a('0x3f')](function(_0xd42813){if(_0xd42813[_0x763a('0x61')]){var _0x98da9d=[_0x763a('0x65'),_0x763a('0x66'),_0x763a('0x67')];_['remove'](_0xd42813[_0x763a('0x63')][_0x763a('0x33')],function(_0x5c07eb){return _0x98da9d[_0x763a('0x68')](_0x5c07eb[_0x763a('0x2c')][_0x763a('0x28')]);});_[_0x763a('0x69')](_0xd42813[_0x763a('0x63')]['fields'],function(_0x5e0f76){return _0x5e0f76['editable']==='false';});return{'count':_0xd42813[_0x763a('0x63')][_0x763a('0x33')][_0x763a('0x35')],'rows':_[_0x763a('0x3e')](_0xd42813[_0x763a('0x63')][_0x763a('0x33')],function(_0x39fd77){return{'id':_0x39fd77['name'],'name':_0x39fd77['label'],'custom':_[_0x763a('0x6a')](_0x39fd77[_0x763a('0x28')],_0x763a('0x6b'))?!![]:![],'options':_0x39fd77[_0x763a('0x2c')][_0x763a('0x28')]===_0x763a('0x6c')&&_0x39fd77[_0x763a('0x2c')][_0x763a('0x6d')][_0x763a('0x35')]>0x0?_[_0x763a('0x3e')](_0x39fd77[_0x763a('0x2c')][_0x763a('0x6d')],function(_0x1e38ff){return{'name':_0x1e38ff[_0x763a('0x6e')],'value':_0x1e38ff[_0x763a('0x6f')]};}):[]};})};}})[_0x763a('0x3f')](respondWithResult(_0x12632f,null))[_0x763a('0x44')](function(_0x57f9e2){console[_0x763a('0x70')](_0x763a('0x71')+_0x57f9e2);var _0x50bd9e=_0x5983b8['query'][_0x763a('0x72')]?0x1f4:_0x57f9e2[_0x763a('0x73')]||0x1f4;logger[_0x763a('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x763a('0x56'),_0x50bd9e,JSON[_0x763a('0x74')](_0x57f9e2));delete _0x57f9e2[_0x763a('0x28')];if(_0x50bd9e===0x191){_0x50bd9e=0x190;}_0x12632f['status'](_0x50bd9e)[_0x763a('0x29')](_0x5983b8[_0x763a('0x2f')][_0x763a('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x57f9e2[_0x763a('0x73')]}:_0x57f9e2);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index a324212..5a8ad09 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 _0x2abe=['rimraf','../../config/environment','../../components/integrations/configuration','exports','VtigerAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x450943,_0x7640ee){var _0x31aa7d=function(_0x53d0fa){while(--_0x53d0fa){_0x450943['push'](_0x450943['shift']());}};_0x31aa7d(++_0x7640ee);}(_0x2abe,0x1e5));var _0xe2ab=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x2abe[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xe2ab('0x0'));var util=require(_0xe2ab('0x1'));var logger=require(_0xe2ab('0x2'))('api');var moment=require(_0xe2ab('0x3'));var BPromise=require(_0xe2ab('0x4'));var rp=require(_0xe2ab('0x5'));var fs=require('fs');var path=require(_0xe2ab('0x6'));var rimraf=require(_0xe2ab('0x7'));var config=require(_0xe2ab('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xe2ab('0x9'));module[_0xe2ab('0xa')]=function(_0x357b7b,_0x2a5eb1){return _0x357b7b['define'](_0xe2ab('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3417=['VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2a38e9,_0x316543){var _0x4f09d3=function(_0x457767){while(--_0x457767){_0x2a38e9['push'](_0x2a38e9['shift']());}};_0x4f09d3(++_0x316543);}(_0x3417,0x16e));var _0x7341=function(_0x4707f5,_0x333489){_0x4707f5=_0x4707f5-0x0;var _0x1e7b3b=_0x3417[_0x4707f5];return _0x1e7b3b;};'use strict';var _=require(_0x7341('0x0'));var util=require(_0x7341('0x1'));var logger=require(_0x7341('0x2'))(_0x7341('0x3'));var moment=require('moment');var BPromise=require(_0x7341('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7341('0x5'));var rimraf=require(_0x7341('0x6'));var config=require(_0x7341('0x7'));var attributes=require(_0x7341('0x8'));var integrations=require(_0x7341('0x9'));module[_0x7341('0xa')]=function(_0x26af02,_0x47fa6d){return _0x26af02['define'](_0x7341('0xb'),attributes,{'tableName':_0x7341('0xc'),'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 6037800..ec4ed97 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 _0x153f=['GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x38a0c1,_0x2912d2){var _0x35f05a=function(_0x14afe0){while(--_0x14afe0){_0x38a0c1['push'](_0x38a0c1['shift']());}};_0x35f05a(++_0x2912d2);}(_0x153f,0x15b));var _0xf153=function(_0x3a2fc4,_0x2883b9){_0x3a2fc4=_0x3a2fc4-0x0;var _0x46018d=_0x153f[_0x3a2fc4];return _0x46018d;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});}exports[_0xf153('0x17')]=function(_0x138dbe){var _0x44272e=this;return new Promise(function(_0x4e790d,_0x357d57){return db[_0xf153('0x18')][_0xf153('0x19')]({'raw':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1b')]===undefined?!![]:![]:!![],'where':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1c')]||null:null,'attributes':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1d')]||null:null,'limit':_0x138dbe['options']?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1e')]||null:null,'include':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1f')]?_[_0xf153('0x20')](_0x138dbe[_0xf153('0x1a')][_0xf153('0x1f')],function(_0xf67cde){return{'model':db[_0xf67cde[_0xf153('0x21')]],'as':_0xf67cde['as'],'attributes':_0xf67cde[_0xf153('0x1d')],'include':_0xf67cde[_0xf153('0x1f')]?_[_0xf153('0x20')](_0xf67cde[_0xf153('0x1f')],function(_0xe490f8){return{'model':db[_0xe490f8[_0xf153('0x21')]],'as':_0xe490f8['as'],'attributes':_0xe490f8[_0xf153('0x1d')],'include':_0xe490f8[_0xf153('0x1f')]?_[_0xf153('0x20')](_0xe490f8[_0xf153('0x1f')],function(_0x48ebdc){return{'model':db[_0x48ebdc[_0xf153('0x21')]],'as':_0x48ebdc['as'],'attributes':_0x48ebdc[_0xf153('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16cdcd){logger[_0xf153('0xe')]('GetVtigerAccount',_0x138dbe);logger[_0xf153('0x11')](_0xf153('0x17'),_0x138dbe,JSON[_0xf153('0x12')](_0x16cdcd));_0x4e790d(_0x16cdcd);})[_0xf153('0x22')](function(_0x339e96){logger[_0xf153('0x13')](_0xf153('0x17'),_0x339e96[_0xf153('0x15')],_0x138dbe);_0x357d57(_0x44272e[_0xf153('0x13')](0x1f4,_0x339e96[_0xf153('0x15')]));});});};exports[_0xf153('0x23')]=function(_0x415a5f){var _0x5b5237=this;return new Promise(function(_0x258fb0,_0xbb3619){return db[_0xf153('0x18')][_0xf153('0x24')]({'raw':_0x415a5f['options']?_0x415a5f['options'][_0xf153('0x1b')]===undefined?!![]:![]:!![],'where':_0x415a5f['options']?_0x415a5f['options'][_0xf153('0x1c')]||null:null,'attributes':_0x415a5f['options']?_0x415a5f[_0xf153('0x1a')]['attributes']||null:null,'include':_0x415a5f[_0xf153('0x1a')]?_0x415a5f[_0xf153('0x1a')]['include']?_[_0xf153('0x20')](_0x415a5f[_0xf153('0x1a')][_0xf153('0x1f')],function(_0x40be52){return{'model':db[_0x40be52[_0xf153('0x21')]],'as':_0x40be52['as'],'attributes':_0x40be52[_0xf153('0x1d')],'include':_0x40be52['include']?_[_0xf153('0x20')](_0x40be52['include'],function(_0x40834b){return{'model':db[_0x40834b[_0xf153('0x21')]],'as':_0x40834b['as'],'attributes':_0x40834b[_0xf153('0x1d')],'include':_0x40834b[_0xf153('0x1f')]?_[_0xf153('0x20')](_0x40834b[_0xf153('0x1f')],function(_0x4becf3){return{'model':db[_0x4becf3[_0xf153('0x21')]],'as':_0x4becf3['as'],'attributes':_0x4becf3[_0xf153('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf153('0xd')](function(_0x4e0634){logger[_0xf153('0xe')](_0xf153('0x23'),_0x415a5f);logger[_0xf153('0x11')](_0xf153('0x23'),_0x415a5f,JSON[_0xf153('0x12')](_0x4e0634));_0x258fb0(_0x4e0634);})[_0xf153('0x22')](function(_0x4cc481){logger[_0xf153('0x13')](_0xf153('0x23'),_0x4cc481['message'],_0x415a5f);_0xbb3619(_0x5b5237[_0xf153('0x13')](0x1f4,_0x4cc481[_0xf153('0x15')]));});});}; \ No newline at end of file +var _0x750a=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','options','raw','attributes','limit','model','include','map','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','where'];(function(_0x247cf3,_0x11353f){var _0x50a7b7=function(_0xee3411){while(--_0xee3411){_0x247cf3['push'](_0x247cf3['shift']());}};_0x50a7b7(++_0x11353f);}(_0x750a,0x140));var _0xa750=function(_0xf7764,_0x5af08e){_0xf7764=_0xf7764-0x0;var _0x44faa8=_0x750a[_0xf7764];return _0x44faa8;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});}exports['GetVtigerAccount']=function(_0x433dbd){var _0x1bde87=this;return new Promise(function(_0x4f1faa,_0x36dcca){return db['VtigerAccount']['findAll']({'raw':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['where']||null:null,'attributes':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x17')]||null:null,'limit':_0x433dbd['options']?_0x433dbd['options'][_0xa750('0x18')]||null:null,'include':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['include']?_['map'](_0x433dbd['options']['include'],function(_0x15d72f){return{'model':db[_0x15d72f[_0xa750('0x19')]],'as':_0x15d72f['as'],'attributes':_0x15d72f[_0xa750('0x17')],'include':_0x15d72f[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x15d72f[_0xa750('0x1a')],function(_0x3001bc){return{'model':db[_0x3001bc[_0xa750('0x19')]],'as':_0x3001bc['as'],'attributes':_0x3001bc[_0xa750('0x17')],'include':_0x3001bc[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x3001bc[_0xa750('0x1a')],function(_0x31ea63){return{'model':db[_0x31ea63[_0xa750('0x19')]],'as':_0x31ea63['as'],'attributes':_0x31ea63[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d3923){logger[_0xa750('0xc')](_0xa750('0x1c'),_0x433dbd);logger['debug'](_0xa750('0x1c'),_0x433dbd,JSON[_0xa750('0xf')](_0x3d3923));_0x4f1faa(_0x3d3923);})[_0xa750('0x14')](function(_0x1223d2){logger['error'](_0xa750('0x1c'),_0x1223d2[_0xa750('0x13')],_0x433dbd);_0x36dcca(_0x1bde87[_0xa750('0x10')](0x1f4,_0x1223d2[_0xa750('0x13')]));});});};exports[_0xa750('0x1d')]=function(_0x59ab33){var _0x46cc11=this;return new Promise(function(_0x4c2c9e,_0x2d0e93){return db[_0xa750('0x1e')]['find']({'raw':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')][_0xa750('0x1f')]||null:null,'attributes':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')]['attributes']||null:null,'include':_0x59ab33[_0xa750('0x15')]?_0x59ab33['options'][_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x59ab33[_0xa750('0x15')][_0xa750('0x1a')],function(_0x556fde){return{'model':db[_0x556fde[_0xa750('0x19')]],'as':_0x556fde['as'],'attributes':_0x556fde[_0xa750('0x17')],'include':_0x556fde['include']?_[_0xa750('0x1b')](_0x556fde[_0xa750('0x1a')],function(_0x280b87){return{'model':db[_0x280b87[_0xa750('0x19')]],'as':_0x280b87['as'],'attributes':_0x280b87['attributes'],'include':_0x280b87[_0xa750('0x1a')]?_['map'](_0x280b87['include'],function(_0x4e59f3){return{'model':db[_0x4e59f3[_0xa750('0x19')]],'as':_0x4e59f3['as'],'attributes':_0x4e59f3[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x470089){logger[_0xa750('0xc')](_0xa750('0x1d'),_0x59ab33);logger['debug'](_0xa750('0x1d'),_0x59ab33,JSON[_0xa750('0xf')](_0x470089));_0x4c2c9e(_0x470089);})[_0xa750('0x14')](function(_0x5d402a){logger[_0xa750('0x10')](_0xa750('0x1d'),_0x5d402a[_0xa750('0x13')],_0x59ab33);_0x2d0e93(_0x46cc11['error'](0x1f4,_0x5d402a[_0xa750('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a8bf890..d01fe0b 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 _0x7818=['get','isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7818,0x178));var _0x8781=function(_0x298ed7,_0x52fa33){_0x298ed7=_0x298ed7-0x0;var _0x322f24=_0x7818[_0x298ed7];return _0x322f24;};'use strict';var multer=require('multer');var util=require(_0x8781('0x0'));var path=require(_0x8781('0x1'));var timeout=require(_0x8781('0x2'));var express=require(_0x8781('0x3'));var router=express[_0x8781('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8781('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8781('0x6'));var controller=require(_0x8781('0x7'));router[_0x8781('0x8')]('/',auth[_0x8781('0x9')](),controller[_0x8781('0xa')]);router[_0x8781('0x8')](_0x8781('0xb'),auth[_0x8781('0x9')](),controller['show']);router['get']('/:id/fields',auth[_0x8781('0x9')](),controller[_0x8781('0xc')]);router[_0x8781('0x8')](_0x8781('0xd'),auth[_0x8781('0x9')](),controller[_0x8781('0xe')]);router[_0x8781('0x8')](_0x8781('0xf'),auth[_0x8781('0x9')](),controller[_0x8781('0x10')]);router[_0x8781('0x11')]('/',auth['isAuthenticated'](),controller[_0x8781('0x12')]);router[_0x8781('0x13')](_0x8781('0xb'),auth[_0x8781('0x9')](),controller[_0x8781('0x14')]);router[_0x8781('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8781('0x16')]);module[_0x8781('0x17')]=router; \ No newline at end of file +var _0x857a=['/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0x857a,0x136));var _0xa857=function(_0x32c8c2,_0x5e0ab0){_0x32c8c2=_0x32c8c2-0x0;var _0x16ed42=_0x857a[_0x32c8c2];return _0x16ed42;};'use strict';var multer=require(_0xa857('0x0'));var util=require(_0xa857('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa857('0x2')]();var fs_extra=require(_0xa857('0x3'));var auth=require(_0xa857('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa857('0x5'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0xa857('0x6')](),controller[_0xa857('0x7')]);router[_0xa857('0x8')](_0xa857('0x9'),auth[_0xa857('0x6')](),controller['show']);router[_0xa857('0x8')](_0xa857('0xa'),auth[_0xa857('0x6')](),controller[_0xa857('0xb')]);router[_0xa857('0x8')]('/:id/subjects',auth[_0xa857('0x6')](),controller[_0xa857('0xc')]);router[_0xa857('0x8')](_0xa857('0xd'),auth[_0xa857('0x6')](),controller[_0xa857('0xe')]);router[_0xa857('0xf')]('/',auth['isAuthenticated'](),controller[_0xa857('0x10')]);router[_0xa857('0x11')](_0xa857('0x9'),auth[_0xa857('0x6')](),controller[_0xa857('0x12')]);router['delete']('/:id',auth[_0xa857('0x6')](),controller[_0xa857('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 8b15a0e..7e0d730 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 _0xb7c6=['exports','STRING'];(function(_0x53619e,_0x53f9f7){var _0x1e8609=function(_0x12d7af){while(--_0x12d7af){_0x53619e['push'](_0x53619e['shift']());}};_0x1e8609(++_0x53f9f7);}(_0xb7c6,0x144));var _0x6b7c=function(_0x588a01,_0x279698){_0x588a01=_0x588a01-0x0;var _0x4e6094=_0xb7c6[_0x588a01];return _0x4e6094;};'use strict';var Sequelize=require('sequelize');module[_0x6b7c('0x0')]={'name':{'type':Sequelize[_0x6b7c('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9711=['sequelize','exports','STRING'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0x9711,0xae));var _0x1971=function(_0x4f784f,_0x33c48e){_0x4f784f=_0x4f784f-0x0;var _0x4921cc=_0x9711[_0x4f784f];return _0x4921cc;};'use strict';var Sequelize=require(_0x1971('0x0'));module[_0x1971('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1971('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 067ca13..04b3fe6 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 _0xba97=['findAll','catch','params','find','body','getFields','findOne','VtigerField','order','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','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','undefined','limit','count','offset','Content-Range','save','update','then','destroy','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x306907,_0x47f89f){var _0x24eaf6=function(_0x1ab5de){while(--_0x1ab5de){_0x306907['push'](_0x306907['shift']());}};_0x24eaf6(++_0x47f89f);}(_0xba97,0x1e0));var _0x7ba9=function(_0x247f67,_0x42552b){_0x247f67=_0x247f67-0x0;var _0x156806=_0xba97[_0x247f67];return _0x156806;};'use strict';var emlformat=require(_0x7ba9('0x0'));var rimraf=require(_0x7ba9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ba9('0x2'));var rp=require(_0x7ba9('0x3'));var moment=require(_0x7ba9('0x4'));var BPromise=require(_0x7ba9('0x5'));var Mustache=require(_0x7ba9('0x6'));var util=require('util');var path=require(_0x7ba9('0x7'));var sox=require(_0x7ba9('0x8'));var csv=require(_0x7ba9('0x9'));var ejs=require(_0x7ba9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ba9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ba9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7ba9('0x9'));var querystring=require(_0x7ba9('0xd'));var Papa=require('papaparse');var Redis=require(_0x7ba9('0xe'));var authService=require(_0x7ba9('0xf'));var qs=require(_0x7ba9('0x10'));var as=require(_0x7ba9('0x11'));var hardwareService=require(_0x7ba9('0x12'));var logger=require(_0x7ba9('0x13'))(_0x7ba9('0x14'));var utils=require(_0x7ba9('0x15'));var config=require(_0x7ba9('0x16'));var licenseUtil=require(_0x7ba9('0x17'));var db=require(_0x7ba9('0x18'))['db'];function respondWithStatusCode(_0x1c1432,_0x401807){_0x401807=_0x401807||0xcc;return function(_0x32e46e){if(_0x32e46e){return _0x1c1432[_0x7ba9('0x19')](_0x401807);}return _0x1c1432[_0x7ba9('0x1a')](_0x401807)[_0x7ba9('0x1b')]();};}function respondWithResult(_0x3edc61,_0x388614){_0x388614=_0x388614||0xc8;return function(_0x490df4){if(_0x490df4){return _0x3edc61[_0x7ba9('0x1a')](_0x388614)[_0x7ba9('0x1c')](_0x490df4);}};}function respondWithFilteredResult(_0x3109ec,_0x158131){return function(_0x4c73ea){if(_0x4c73ea){var _0x992abe=typeof _0x158131['offset']===_0x7ba9('0x1d')&&typeof _0x158131[_0x7ba9('0x1e')]==='undefined';var _0x392e22=_0x4c73ea[_0x7ba9('0x1f')];var _0x16e14a=_0x992abe?0x0:_0x158131[_0x7ba9('0x20')];var _0x5083af=_0x992abe?_0x4c73ea['count']:_0x158131[_0x7ba9('0x20')]+_0x158131[_0x7ba9('0x1e')];var _0x43d0c5;if(_0x5083af>=_0x392e22){_0x5083af=_0x392e22;_0x43d0c5=0xc8;}else{_0x43d0c5=0xce;}_0x3109ec['status'](_0x43d0c5);return _0x3109ec['set'](_0x7ba9('0x21'),_0x16e14a+'-'+_0x5083af+'/'+_0x392e22)[_0x7ba9('0x1c')](_0x4c73ea);}return null;};}function patchUpdates(_0xbb5c90){return function(_0x687f04){try{jsonpatch['apply'](_0x687f04,_0xbb5c90,!![]);}catch(_0x1047d8){return BPromise['reject'](_0x1047d8);}return _0x687f04[_0x7ba9('0x22')]();};}function saveUpdates(_0x290867,_0x505968){return function(_0x46fa27){if(_0x46fa27){return _0x46fa27[_0x7ba9('0x23')](_0x290867)[_0x7ba9('0x24')](function(_0x336602){return _0x336602;});}return null;};}function removeEntity(_0x4787d1,_0xb58f59){return function(_0xc6fd6e){if(_0xc6fd6e){return _0xc6fd6e[_0x7ba9('0x25')]()['then'](function(){_0x4787d1[_0x7ba9('0x1a')](0xcc)[_0x7ba9('0x1b')]();});}};}function handleEntityNotFound(_0x838655,_0x5ae0c7){return function(_0x445918){if(!_0x445918){_0x838655[_0x7ba9('0x19')](0x194);}return _0x445918;};}function handleError(_0x974b06,_0x535701){_0x535701=_0x535701||0x1f4;return function(_0x42e110){logger['error'](_0x42e110[_0x7ba9('0x26')]);if(_0x42e110[_0x7ba9('0x27')]){delete _0x42e110[_0x7ba9('0x27')];}_0x974b06[_0x7ba9('0x1a')](_0x535701)[_0x7ba9('0x28')](_0x42e110);};}exports[_0x7ba9('0x29')]=function(_0x42b713,_0x4c6339){var _0x3ec8a6={},_0x3d03f7={},_0x29cd42={'count':0x0,'rows':[]};var _0x2cd0bb=_['map'](db[_0x7ba9('0x2a')][_0x7ba9('0x2b')],function(_0x5c43e2){return{'name':_0x5c43e2[_0x7ba9('0x2c')],'type':_0x5c43e2[_0x7ba9('0x2d')][_0x7ba9('0x2e')]};});_0x3d03f7[_0x7ba9('0x2f')]=_[_0x7ba9('0x30')](_0x2cd0bb,_0x7ba9('0x27'));_0x3d03f7[_0x7ba9('0x31')]=_[_0x7ba9('0x32')](_0x42b713['query']);_0x3d03f7[_0x7ba9('0x33')]=_[_0x7ba9('0x34')](_0x3d03f7[_0x7ba9('0x2f')],_0x3d03f7[_0x7ba9('0x31')]);_0x3ec8a6[_0x7ba9('0x35')]=_[_0x7ba9('0x34')](_0x3d03f7['model'],qs[_0x7ba9('0x36')](_0x42b713[_0x7ba9('0x31')][_0x7ba9('0x36')]));_0x3ec8a6[_0x7ba9('0x35')]=_0x3ec8a6[_0x7ba9('0x35')][_0x7ba9('0x37')]?_0x3ec8a6[_0x7ba9('0x35')]:_0x3d03f7[_0x7ba9('0x2f')];if(!_0x42b713[_0x7ba9('0x31')][_0x7ba9('0x38')](_0x7ba9('0x39'))){_0x3ec8a6['limit']=qs['limit'](_0x42b713['query'][_0x7ba9('0x1e')]);_0x3ec8a6[_0x7ba9('0x20')]=qs[_0x7ba9('0x20')](_0x42b713[_0x7ba9('0x31')][_0x7ba9('0x20')]);}_0x3ec8a6['order']=qs['sort'](_0x42b713[_0x7ba9('0x31')][_0x7ba9('0x3a')]);_0x3ec8a6[_0x7ba9('0x3b')]=qs[_0x7ba9('0x33')](_['pick'](_0x42b713[_0x7ba9('0x31')],_0x3d03f7['filters']),_0x2cd0bb);if(_0x42b713[_0x7ba9('0x31')][_0x7ba9('0x3c')]){_0x3ec8a6['where']=_[_0x7ba9('0x3d')](_0x3ec8a6[_0x7ba9('0x3b')],{'$or':_[_0x7ba9('0x30')](_0x2cd0bb,function(_0x4e7491){if(_0x4e7491['type']!==_0x7ba9('0x3e')){var _0x4087b1={};_0x4087b1[_0x4e7491[_0x7ba9('0x27')]]={'$like':'%'+_0x42b713[_0x7ba9('0x31')][_0x7ba9('0x3c')]+'%'};return _0x4087b1;}})});}_0x3ec8a6=_['merge']({},_0x3ec8a6,_0x42b713[_0x7ba9('0x3f')]);var _0x22be6b={'where':_0x3ec8a6[_0x7ba9('0x3b')]};return db[_0x7ba9('0x2a')][_0x7ba9('0x1f')](_0x22be6b)[_0x7ba9('0x24')](function(_0xd9dd0e){_0x29cd42[_0x7ba9('0x1f')]=_0xd9dd0e;if(_0x42b713[_0x7ba9('0x31')][_0x7ba9('0x40')]){_0x3ec8a6[_0x7ba9('0x41')]=[{'all':!![]}];}return db[_0x7ba9('0x2a')][_0x7ba9('0x42')](_0x3ec8a6);})[_0x7ba9('0x24')](function(_0x46b25c){_0x29cd42['rows']=_0x46b25c;return _0x29cd42;})['then'](respondWithFilteredResult(_0x4c6339,_0x3ec8a6))[_0x7ba9('0x43')](handleError(_0x4c6339,null));};exports['show']=function(_0xf967f4,_0x2831a9){var _0x8ed9cd={'raw':![],'where':{'id':_0xf967f4[_0x7ba9('0x44')]['id']}},_0x457ac3={};_0x457ac3['model']=_[_0x7ba9('0x32')](db[_0x7ba9('0x2a')][_0x7ba9('0x2b')]);_0x457ac3[_0x7ba9('0x31')]=_[_0x7ba9('0x32')](_0xf967f4[_0x7ba9('0x31')]);_0x457ac3['filters']=_[_0x7ba9('0x34')](_0x457ac3[_0x7ba9('0x2f')],_0x457ac3[_0x7ba9('0x31')]);_0x8ed9cd[_0x7ba9('0x35')]=_[_0x7ba9('0x34')](_0x457ac3[_0x7ba9('0x2f')],qs[_0x7ba9('0x36')](_0xf967f4[_0x7ba9('0x31')][_0x7ba9('0x36')]));_0x8ed9cd['attributes']=_0x8ed9cd[_0x7ba9('0x35')][_0x7ba9('0x37')]?_0x8ed9cd[_0x7ba9('0x35')]:_0x457ac3[_0x7ba9('0x2f')];if(_0xf967f4[_0x7ba9('0x31')][_0x7ba9('0x40')]){_0x8ed9cd['include']=[{'all':!![]}];}_0x8ed9cd=_[_0x7ba9('0x3d')]({},_0x8ed9cd,_0xf967f4['options']);return db['VtigerConfiguration'][_0x7ba9('0x45')](_0x8ed9cd)[_0x7ba9('0x24')](handleEntityNotFound(_0x2831a9,null))['then'](respondWithResult(_0x2831a9,null))[_0x7ba9('0x43')](handleError(_0x2831a9,null));};exports['create']=function(_0x1dc411,_0x422073){return db[_0x7ba9('0x2a')]['create'](_0x1dc411[_0x7ba9('0x46')],{})['then'](respondWithResult(_0x422073,0xc9))[_0x7ba9('0x43')](handleError(_0x422073,null));};exports[_0x7ba9('0x23')]=function(_0x48825e,_0x1fb95b){if(_0x48825e[_0x7ba9('0x46')]['id']){delete _0x48825e[_0x7ba9('0x46')]['id'];}return db[_0x7ba9('0x2a')]['find']({'where':{'id':_0x48825e['params']['id']}})[_0x7ba9('0x24')](handleEntityNotFound(_0x1fb95b,null))[_0x7ba9('0x24')](saveUpdates(_0x48825e[_0x7ba9('0x46')],null))[_0x7ba9('0x24')](respondWithResult(_0x1fb95b,null))[_0x7ba9('0x43')](handleError(_0x1fb95b,null));};exports[_0x7ba9('0x25')]=function(_0x285f7a,_0x59a3ff){return db[_0x7ba9('0x2a')]['find']({'where':{'id':_0x285f7a[_0x7ba9('0x44')]['id']}})[_0x7ba9('0x24')](handleEntityNotFound(_0x59a3ff,null))[_0x7ba9('0x24')](removeEntity(_0x59a3ff,null))[_0x7ba9('0x43')](handleError(_0x59a3ff,null));};exports[_0x7ba9('0x47')]=function(_0x68d570,_0x54764b,_0x30b21b){var _0x79892b={};var _0x127ef3={};var _0x5e3ebf;var _0x595903;return db[_0x7ba9('0x2a')][_0x7ba9('0x48')]({'where':{'id':_0x68d570['params']['id']}})['then'](handleEntityNotFound(_0x54764b,null))[_0x7ba9('0x24')](function(_0x4c606e){if(_0x4c606e){_0x5e3ebf=_0x4c606e;_0x127ef3['model']=_[_0x7ba9('0x32')](db[_0x7ba9('0x49')][_0x7ba9('0x2b')]);_0x127ef3[_0x7ba9('0x31')]=_[_0x7ba9('0x32')](_0x68d570[_0x7ba9('0x31')]);_0x127ef3['filters']=_[_0x7ba9('0x34')](_0x127ef3[_0x7ba9('0x2f')],_0x127ef3[_0x7ba9('0x31')]);_0x79892b[_0x7ba9('0x35')]=_['intersection'](_0x127ef3[_0x7ba9('0x2f')],qs[_0x7ba9('0x36')](_0x68d570[_0x7ba9('0x31')][_0x7ba9('0x36')]));_0x79892b[_0x7ba9('0x35')]=_0x79892b[_0x7ba9('0x35')][_0x7ba9('0x37')]?_0x79892b[_0x7ba9('0x35')]:_0x127ef3['model'];_0x79892b[_0x7ba9('0x4a')]=qs['sort'](_0x68d570[_0x7ba9('0x31')][_0x7ba9('0x3a')]);_0x79892b[_0x7ba9('0x3b')]=qs['filters'](_[_0x7ba9('0x4b')](_0x68d570[_0x7ba9('0x31')],_0x127ef3[_0x7ba9('0x33')]));if(_0x68d570[_0x7ba9('0x31')]['filter']){_0x79892b[_0x7ba9('0x3b')]=_[_0x7ba9('0x3d')](_0x79892b[_0x7ba9('0x3b')],{'$or':_[_0x7ba9('0x30')](_0x79892b['attributes'],function(_0x2b473d){var _0x1d89e5={};_0x1d89e5[_0x2b473d]={'$like':'%'+_0x68d570[_0x7ba9('0x31')][_0x7ba9('0x3c')]+'%'};return _0x1d89e5;})});}_0x79892b=_['merge']({},_0x79892b,_0x68d570[_0x7ba9('0x3f')]);return _0x5e3ebf[_0x7ba9('0x47')](_0x79892b);}})[_0x7ba9('0x24')](function(_0x5eca6f){if(_0x5eca6f){_0x595903=_0x5eca6f[_0x7ba9('0x37')];if(!_0x68d570[_0x7ba9('0x31')][_0x7ba9('0x38')](_0x7ba9('0x39'))){_0x79892b[_0x7ba9('0x1e')]=qs[_0x7ba9('0x1e')](_0x68d570[_0x7ba9('0x31')][_0x7ba9('0x1e')]);_0x79892b['offset']=qs['offset'](_0x68d570[_0x7ba9('0x31')]['offset']);}return _0x5e3ebf[_0x7ba9('0x47')](_0x79892b);}})[_0x7ba9('0x24')](function(_0x42a845){if(_0x42a845){return _0x42a845?{'count':_0x595903,'rows':_0x42a845}:null;}})[_0x7ba9('0x24')](respondWithResult(_0x54764b,null))[_0x7ba9('0x43')](handleError(_0x54764b,null));};exports[_0x7ba9('0x4c')]=function(_0x41b79a,_0x5c0df2,_0x21f94a){var _0x532e43={};var _0x25bb1b={};var _0x3ca5f9;var _0x3a943d;return db[_0x7ba9('0x2a')][_0x7ba9('0x48')]({'where':{'id':_0x41b79a[_0x7ba9('0x44')]['id']}})[_0x7ba9('0x24')](handleEntityNotFound(_0x5c0df2,null))['then'](function(_0xd9838b){if(_0xd9838b){_0x3ca5f9=_0xd9838b;_0x25bb1b['model']=_['keys'](db[_0x7ba9('0x49')]['rawAttributes']);_0x25bb1b['query']=_['keys'](_0x41b79a[_0x7ba9('0x31')]);_0x25bb1b[_0x7ba9('0x33')]=_['intersection'](_0x25bb1b[_0x7ba9('0x2f')],_0x25bb1b[_0x7ba9('0x31')]);_0x532e43[_0x7ba9('0x35')]=_['intersection'](_0x25bb1b[_0x7ba9('0x2f')],qs['fields'](_0x41b79a[_0x7ba9('0x31')][_0x7ba9('0x36')]));_0x532e43[_0x7ba9('0x35')]=_0x532e43[_0x7ba9('0x35')][_0x7ba9('0x37')]?_0x532e43[_0x7ba9('0x35')]:_0x25bb1b[_0x7ba9('0x2f')];_0x532e43[_0x7ba9('0x4a')]=qs[_0x7ba9('0x3a')](_0x41b79a[_0x7ba9('0x31')][_0x7ba9('0x3a')]);_0x532e43[_0x7ba9('0x3b')]=qs[_0x7ba9('0x33')](_[_0x7ba9('0x4b')](_0x41b79a[_0x7ba9('0x31')],_0x25bb1b['filters']));if(_0x41b79a[_0x7ba9('0x31')][_0x7ba9('0x3c')]){_0x532e43[_0x7ba9('0x3b')]=_[_0x7ba9('0x3d')](_0x532e43[_0x7ba9('0x3b')],{'$or':_[_0x7ba9('0x30')](_0x532e43[_0x7ba9('0x35')],function(_0x40a7b4){var _0x308961={};_0x308961[_0x40a7b4]={'$like':'%'+_0x41b79a[_0x7ba9('0x31')]['filter']+'%'};return _0x308961;})});}_0x532e43=_[_0x7ba9('0x3d')]({},_0x532e43,_0x41b79a[_0x7ba9('0x3f')]);return _0x3ca5f9[_0x7ba9('0x4c')](_0x532e43);}})[_0x7ba9('0x24')](function(_0x3ad56d){if(_0x3ad56d){_0x3a943d=_0x3ad56d[_0x7ba9('0x37')];if(!_0x41b79a[_0x7ba9('0x31')][_0x7ba9('0x38')]('nolimit')){_0x532e43['limit']=qs[_0x7ba9('0x1e')](_0x41b79a['query'][_0x7ba9('0x1e')]);_0x532e43[_0x7ba9('0x20')]=qs['offset'](_0x41b79a[_0x7ba9('0x31')][_0x7ba9('0x20')]);}return _0x3ca5f9['getSubjects'](_0x532e43);}})[_0x7ba9('0x24')](function(_0x1b6fe6){if(_0x1b6fe6){return _0x1b6fe6?{'count':_0x3a943d,'rows':_0x1b6fe6}:null;}})[_0x7ba9('0x24')](respondWithResult(_0x5c0df2,null))[_0x7ba9('0x43')](handleError(_0x5c0df2,null));};exports[_0x7ba9('0x4d')]=function(_0x2846fc,_0x3c8e6b,_0x20ae76){var _0x1a8e5f={};var _0x6f84b3={};var _0x23aab5;var _0x502f9c;return db[_0x7ba9('0x2a')][_0x7ba9('0x48')]({'where':{'id':_0x2846fc['params']['id']}})['then'](handleEntityNotFound(_0x3c8e6b,null))['then'](function(_0x375986){if(_0x375986){_0x23aab5=_0x375986;_0x6f84b3[_0x7ba9('0x2f')]=_[_0x7ba9('0x32')](db[_0x7ba9('0x49')]['rawAttributes']);_0x6f84b3[_0x7ba9('0x31')]=_['keys'](_0x2846fc[_0x7ba9('0x31')]);_0x6f84b3['filters']=_[_0x7ba9('0x34')](_0x6f84b3[_0x7ba9('0x2f')],_0x6f84b3[_0x7ba9('0x31')]);_0x1a8e5f[_0x7ba9('0x35')]=_[_0x7ba9('0x34')](_0x6f84b3['model'],qs[_0x7ba9('0x36')](_0x2846fc['query']['fields']));_0x1a8e5f['attributes']=_0x1a8e5f[_0x7ba9('0x35')][_0x7ba9('0x37')]?_0x1a8e5f['attributes']:_0x6f84b3[_0x7ba9('0x2f')];_0x1a8e5f[_0x7ba9('0x4a')]=qs[_0x7ba9('0x3a')](_0x2846fc[_0x7ba9('0x31')][_0x7ba9('0x3a')]);_0x1a8e5f[_0x7ba9('0x3b')]=qs['filters'](_[_0x7ba9('0x4b')](_0x2846fc[_0x7ba9('0x31')],_0x6f84b3[_0x7ba9('0x33')]));if(_0x2846fc['query'][_0x7ba9('0x3c')]){_0x1a8e5f['where']=_['merge'](_0x1a8e5f['where'],{'$or':_[_0x7ba9('0x30')](_0x1a8e5f[_0x7ba9('0x35')],function(_0x5e1933){var _0x246c1f={};_0x246c1f[_0x5e1933]={'$like':'%'+_0x2846fc[_0x7ba9('0x31')][_0x7ba9('0x3c')]+'%'};return _0x246c1f;})});}_0x1a8e5f=_['merge']({},_0x1a8e5f,_0x2846fc[_0x7ba9('0x3f')]);return _0x23aab5['getDescriptions'](_0x1a8e5f);}})[_0x7ba9('0x24')](function(_0x2a0422){if(_0x2a0422){_0x502f9c=_0x2a0422[_0x7ba9('0x37')];if(!_0x2846fc['query'][_0x7ba9('0x38')](_0x7ba9('0x39'))){_0x1a8e5f[_0x7ba9('0x1e')]=qs[_0x7ba9('0x1e')](_0x2846fc[_0x7ba9('0x31')][_0x7ba9('0x1e')]);_0x1a8e5f[_0x7ba9('0x20')]=qs[_0x7ba9('0x20')](_0x2846fc[_0x7ba9('0x31')][_0x7ba9('0x20')]);}return _0x23aab5['getDescriptions'](_0x1a8e5f);}})['then'](function(_0x4c1372){if(_0x4c1372){return _0x4c1372?{'count':_0x502f9c,'rows':_0x4c1372}:null;}})[_0x7ba9('0x24')](respondWithResult(_0x3c8e6b,null))['catch'](handleError(_0x3c8e6b,null));}; \ No newline at end of file +var _0x9277=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','merge','create','body','find','getFields','findOne','VtigerField','length','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x106b58,_0xdfef96){var _0x390cac=function(_0x3795ad){while(--_0x3795ad){_0x106b58['push'](_0x106b58['shift']());}};_0x390cac(++_0xdfef96);}(_0x9277,0x195));var _0x7927=function(_0x5b3aca,_0x3d0d08){_0x5b3aca=_0x5b3aca-0x0;var _0x3c93b1=_0x9277[_0x5b3aca];return _0x3c93b1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7927('0x0'));var jsonpatch=require(_0x7927('0x1'));var rp=require(_0x7927('0x2'));var moment=require(_0x7927('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7927('0x4'));var path=require(_0x7927('0x5'));var sox=require(_0x7927('0x6'));var csv=require('to-csv');var ejs=require(_0x7927('0x7'));var fs=require('fs');var fs_extra=require(_0x7927('0x8'));var _=require(_0x7927('0x9'));var squel=require(_0x7927('0xa'));var crypto=require('crypto');var jsforce=require(_0x7927('0xb'));var deskjs=require(_0x7927('0xc'));var toCsv=require(_0x7927('0xd'));var querystring=require(_0x7927('0xe'));var Papa=require(_0x7927('0xf'));var Redis=require(_0x7927('0x10'));var authService=require(_0x7927('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7927('0x12'));var hardwareService=require(_0x7927('0x13'));var logger=require(_0x7927('0x14'))(_0x7927('0x15'));var utils=require(_0x7927('0x16'));var config=require(_0x7927('0x17'));var licenseUtil=require(_0x7927('0x18'));var db=require(_0x7927('0x19'))['db'];function respondWithStatusCode(_0x526cbe,_0x46d796){_0x46d796=_0x46d796||0xcc;return function(_0x5ac794){if(_0x5ac794){return _0x526cbe[_0x7927('0x1a')](_0x46d796);}return _0x526cbe[_0x7927('0x1b')](_0x46d796)[_0x7927('0x1c')]();};}function respondWithResult(_0x4a1859,_0x454da0){_0x454da0=_0x454da0||0xc8;return function(_0x2091b7){if(_0x2091b7){return _0x4a1859[_0x7927('0x1b')](_0x454da0)[_0x7927('0x1d')](_0x2091b7);}};}function respondWithFilteredResult(_0x3fd4ce,_0x336164){return function(_0x2eb2a2){if(_0x2eb2a2){var _0x199f14=typeof _0x336164[_0x7927('0x1e')]===_0x7927('0x1f')&&typeof _0x336164[_0x7927('0x20')]===_0x7927('0x1f');var _0x8b0aaa=_0x2eb2a2[_0x7927('0x21')];var _0x2b0c9a=_0x199f14?0x0:_0x336164[_0x7927('0x1e')];var _0x3f4de9=_0x199f14?_0x2eb2a2['count']:_0x336164['offset']+_0x336164[_0x7927('0x20')];var _0x1b9ca2;if(_0x3f4de9>=_0x8b0aaa){_0x3f4de9=_0x8b0aaa;_0x1b9ca2=0xc8;}else{_0x1b9ca2=0xce;}_0x3fd4ce[_0x7927('0x1b')](_0x1b9ca2);return _0x3fd4ce[_0x7927('0x22')](_0x7927('0x23'),_0x2b0c9a+'-'+_0x3f4de9+'/'+_0x8b0aaa)[_0x7927('0x1d')](_0x2eb2a2);}return null;};}function patchUpdates(_0x3d095d){return function(_0x2a176e){try{jsonpatch[_0x7927('0x24')](_0x2a176e,_0x3d095d,!![]);}catch(_0x167bbc){return BPromise[_0x7927('0x25')](_0x167bbc);}return _0x2a176e[_0x7927('0x26')]();};}function saveUpdates(_0x131d57,_0x28071d){return function(_0x2be819){if(_0x2be819){return _0x2be819[_0x7927('0x27')](_0x131d57)[_0x7927('0x28')](function(_0x37cc14){return _0x37cc14;});}return null;};}function removeEntity(_0x1333f2,_0xe499dc){return function(_0x96a0c9){if(_0x96a0c9){return _0x96a0c9[_0x7927('0x29')]()[_0x7927('0x28')](function(){_0x1333f2[_0x7927('0x1b')](0xcc)[_0x7927('0x1c')]();});}};}function handleEntityNotFound(_0x105727,_0x5858e3){return function(_0x9dba05){if(!_0x9dba05){_0x105727['sendStatus'](0x194);}return _0x9dba05;};}function handleError(_0x2b4f75,_0x3e59a6){_0x3e59a6=_0x3e59a6||0x1f4;return function(_0x2750ce){logger[_0x7927('0x2a')](_0x2750ce[_0x7927('0x2b')]);if(_0x2750ce['name']){delete _0x2750ce[_0x7927('0x2c')];}_0x2b4f75[_0x7927('0x1b')](_0x3e59a6)[_0x7927('0x2d')](_0x2750ce);};}exports[_0x7927('0x2e')]=function(_0x42ac15,_0x578d9c){var _0x26bd40={},_0x3917b5={},_0x392eaf={'count':0x0,'rows':[]};var _0x2910a9=_[_0x7927('0x2f')](db[_0x7927('0x30')][_0x7927('0x31')],function(_0x499a9f){return{'name':_0x499a9f['fieldName'],'type':_0x499a9f[_0x7927('0x32')][_0x7927('0x33')]};});_0x3917b5[_0x7927('0x34')]=_[_0x7927('0x2f')](_0x2910a9,'name');_0x3917b5['query']=_[_0x7927('0x35')](_0x42ac15['query']);_0x3917b5[_0x7927('0x36')]=_[_0x7927('0x37')](_0x3917b5[_0x7927('0x34')],_0x3917b5[_0x7927('0x38')]);_0x26bd40[_0x7927('0x39')]=_['intersection'](_0x3917b5[_0x7927('0x34')],qs['fields'](_0x42ac15[_0x7927('0x38')]['fields']));_0x26bd40[_0x7927('0x39')]=_0x26bd40[_0x7927('0x39')]['length']?_0x26bd40[_0x7927('0x39')]:_0x3917b5[_0x7927('0x34')];if(!_0x42ac15['query'][_0x7927('0x3a')](_0x7927('0x3b'))){_0x26bd40[_0x7927('0x20')]=qs['limit'](_0x42ac15[_0x7927('0x38')][_0x7927('0x20')]);_0x26bd40[_0x7927('0x1e')]=qs[_0x7927('0x1e')](_0x42ac15[_0x7927('0x38')][_0x7927('0x1e')]);}_0x26bd40[_0x7927('0x3c')]=qs[_0x7927('0x3d')](_0x42ac15['query'][_0x7927('0x3d')]);_0x26bd40[_0x7927('0x3e')]=qs[_0x7927('0x36')](_[_0x7927('0x3f')](_0x42ac15[_0x7927('0x38')],_0x3917b5[_0x7927('0x36')]),_0x2910a9);if(_0x42ac15[_0x7927('0x38')][_0x7927('0x40')]){_0x26bd40['where']=_['merge'](_0x26bd40['where'],{'$or':_[_0x7927('0x2f')](_0x2910a9,function(_0x46f991){if(_0x46f991[_0x7927('0x32')]!==_0x7927('0x41')){var _0x12017c={};_0x12017c[_0x46f991[_0x7927('0x2c')]]={'$like':'%'+_0x42ac15[_0x7927('0x38')][_0x7927('0x40')]+'%'};return _0x12017c;}})});}_0x26bd40=_['merge']({},_0x26bd40,_0x42ac15[_0x7927('0x42')]);var _0x481c02={'where':_0x26bd40[_0x7927('0x3e')]};return db[_0x7927('0x30')][_0x7927('0x21')](_0x481c02)[_0x7927('0x28')](function(_0x1efa1b){_0x392eaf[_0x7927('0x21')]=_0x1efa1b;if(_0x42ac15[_0x7927('0x38')][_0x7927('0x43')]){_0x26bd40[_0x7927('0x44')]=[{'all':!![]}];}return db[_0x7927('0x30')][_0x7927('0x45')](_0x26bd40);})['then'](function(_0xfcf73d){_0x392eaf[_0x7927('0x46')]=_0xfcf73d;return _0x392eaf;})['then'](respondWithFilteredResult(_0x578d9c,_0x26bd40))[_0x7927('0x47')](handleError(_0x578d9c,null));};exports[_0x7927('0x48')]=function(_0x2412e8,_0x5d5058){var _0x51e937={'raw':![],'where':{'id':_0x2412e8[_0x7927('0x49')]['id']}},_0x5f1076={};_0x5f1076['model']=_[_0x7927('0x35')](db[_0x7927('0x30')][_0x7927('0x31')]);_0x5f1076[_0x7927('0x38')]=_[_0x7927('0x35')](_0x2412e8[_0x7927('0x38')]);_0x5f1076['filters']=_[_0x7927('0x37')](_0x5f1076[_0x7927('0x34')],_0x5f1076[_0x7927('0x38')]);_0x51e937[_0x7927('0x39')]=_['intersection'](_0x5f1076[_0x7927('0x34')],qs[_0x7927('0x4a')](_0x2412e8['query'][_0x7927('0x4a')]));_0x51e937[_0x7927('0x39')]=_0x51e937['attributes']['length']?_0x51e937[_0x7927('0x39')]:_0x5f1076[_0x7927('0x34')];if(_0x2412e8['query'][_0x7927('0x43')]){_0x51e937[_0x7927('0x44')]=[{'all':!![]}];}_0x51e937=_[_0x7927('0x4b')]({},_0x51e937,_0x2412e8[_0x7927('0x42')]);return db[_0x7927('0x30')]['find'](_0x51e937)[_0x7927('0x28')](handleEntityNotFound(_0x5d5058,null))[_0x7927('0x28')](respondWithResult(_0x5d5058,null))[_0x7927('0x47')](handleError(_0x5d5058,null));};exports['create']=function(_0x3d7942,_0x559ba9){return db['VtigerConfiguration'][_0x7927('0x4c')](_0x3d7942['body'],{})[_0x7927('0x28')](respondWithResult(_0x559ba9,0xc9))[_0x7927('0x47')](handleError(_0x559ba9,null));};exports[_0x7927('0x27')]=function(_0x4e7f36,_0x3f5f6e){if(_0x4e7f36[_0x7927('0x4d')]['id']){delete _0x4e7f36[_0x7927('0x4d')]['id'];}return db[_0x7927('0x30')][_0x7927('0x4e')]({'where':{'id':_0x4e7f36[_0x7927('0x49')]['id']}})[_0x7927('0x28')](handleEntityNotFound(_0x3f5f6e,null))[_0x7927('0x28')](saveUpdates(_0x4e7f36[_0x7927('0x4d')],null))[_0x7927('0x28')](respondWithResult(_0x3f5f6e,null))[_0x7927('0x47')](handleError(_0x3f5f6e,null));};exports[_0x7927('0x29')]=function(_0x1cf65d,_0x3e7638){return db[_0x7927('0x30')][_0x7927('0x4e')]({'where':{'id':_0x1cf65d[_0x7927('0x49')]['id']}})[_0x7927('0x28')](handleEntityNotFound(_0x3e7638,null))[_0x7927('0x28')](removeEntity(_0x3e7638,null))[_0x7927('0x47')](handleError(_0x3e7638,null));};exports[_0x7927('0x4f')]=function(_0x3822d1,_0x11acd7,_0x3cfc5a){var _0x459c35={};var _0x3c7f1c={};var _0x24841e;var _0x32cf67;return db['VtigerConfiguration'][_0x7927('0x50')]({'where':{'id':_0x3822d1[_0x7927('0x49')]['id']}})[_0x7927('0x28')](handleEntityNotFound(_0x11acd7,null))[_0x7927('0x28')](function(_0x40fb31){if(_0x40fb31){_0x24841e=_0x40fb31;_0x3c7f1c[_0x7927('0x34')]=_['keys'](db[_0x7927('0x51')][_0x7927('0x31')]);_0x3c7f1c['query']=_[_0x7927('0x35')](_0x3822d1[_0x7927('0x38')]);_0x3c7f1c[_0x7927('0x36')]=_[_0x7927('0x37')](_0x3c7f1c['model'],_0x3c7f1c[_0x7927('0x38')]);_0x459c35[_0x7927('0x39')]=_['intersection'](_0x3c7f1c[_0x7927('0x34')],qs[_0x7927('0x4a')](_0x3822d1['query'][_0x7927('0x4a')]));_0x459c35['attributes']=_0x459c35[_0x7927('0x39')][_0x7927('0x52')]?_0x459c35[_0x7927('0x39')]:_0x3c7f1c[_0x7927('0x34')];_0x459c35[_0x7927('0x3c')]=qs[_0x7927('0x3d')](_0x3822d1[_0x7927('0x38')][_0x7927('0x3d')]);_0x459c35[_0x7927('0x3e')]=qs[_0x7927('0x36')](_['pick'](_0x3822d1[_0x7927('0x38')],_0x3c7f1c[_0x7927('0x36')]));if(_0x3822d1['query'][_0x7927('0x40')]){_0x459c35[_0x7927('0x3e')]=_[_0x7927('0x4b')](_0x459c35[_0x7927('0x3e')],{'$or':_[_0x7927('0x2f')](_0x459c35[_0x7927('0x39')],function(_0x202b4e){var _0x3cfe20={};_0x3cfe20[_0x202b4e]={'$like':'%'+_0x3822d1[_0x7927('0x38')][_0x7927('0x40')]+'%'};return _0x3cfe20;})});}_0x459c35=_[_0x7927('0x4b')]({},_0x459c35,_0x3822d1[_0x7927('0x42')]);return _0x24841e[_0x7927('0x4f')](_0x459c35);}})[_0x7927('0x28')](function(_0x3b04da){if(_0x3b04da){_0x32cf67=_0x3b04da[_0x7927('0x52')];if(!_0x3822d1[_0x7927('0x38')]['hasOwnProperty'](_0x7927('0x3b'))){_0x459c35['limit']=qs[_0x7927('0x20')](_0x3822d1[_0x7927('0x38')][_0x7927('0x20')]);_0x459c35['offset']=qs[_0x7927('0x1e')](_0x3822d1[_0x7927('0x38')]['offset']);}return _0x24841e['getFields'](_0x459c35);}})['then'](function(_0x398b1f){if(_0x398b1f){return _0x398b1f?{'count':_0x32cf67,'rows':_0x398b1f}:null;}})[_0x7927('0x28')](respondWithResult(_0x11acd7,null))[_0x7927('0x47')](handleError(_0x11acd7,null));};exports[_0x7927('0x53')]=function(_0x3cf0cb,_0x1d5c31,_0x5ae646){var _0x2221c1={};var _0x47fc1f={};var _0x2fb03d;var _0x37fe27;return db[_0x7927('0x30')][_0x7927('0x50')]({'where':{'id':_0x3cf0cb[_0x7927('0x49')]['id']}})[_0x7927('0x28')](handleEntityNotFound(_0x1d5c31,null))['then'](function(_0x877333){if(_0x877333){_0x2fb03d=_0x877333;_0x47fc1f[_0x7927('0x34')]=_['keys'](db['VtigerField'][_0x7927('0x31')]);_0x47fc1f[_0x7927('0x38')]=_['keys'](_0x3cf0cb[_0x7927('0x38')]);_0x47fc1f[_0x7927('0x36')]=_[_0x7927('0x37')](_0x47fc1f[_0x7927('0x34')],_0x47fc1f[_0x7927('0x38')]);_0x2221c1[_0x7927('0x39')]=_[_0x7927('0x37')](_0x47fc1f[_0x7927('0x34')],qs['fields'](_0x3cf0cb[_0x7927('0x38')][_0x7927('0x4a')]));_0x2221c1['attributes']=_0x2221c1[_0x7927('0x39')][_0x7927('0x52')]?_0x2221c1[_0x7927('0x39')]:_0x47fc1f[_0x7927('0x34')];_0x2221c1[_0x7927('0x3c')]=qs[_0x7927('0x3d')](_0x3cf0cb[_0x7927('0x38')]['sort']);_0x2221c1['where']=qs[_0x7927('0x36')](_[_0x7927('0x3f')](_0x3cf0cb['query'],_0x47fc1f[_0x7927('0x36')]));if(_0x3cf0cb[_0x7927('0x38')][_0x7927('0x40')]){_0x2221c1['where']=_[_0x7927('0x4b')](_0x2221c1['where'],{'$or':_[_0x7927('0x2f')](_0x2221c1[_0x7927('0x39')],function(_0x41f8cf){var _0x3d9177={};_0x3d9177[_0x41f8cf]={'$like':'%'+_0x3cf0cb[_0x7927('0x38')][_0x7927('0x40')]+'%'};return _0x3d9177;})});}_0x2221c1=_[_0x7927('0x4b')]({},_0x2221c1,_0x3cf0cb[_0x7927('0x42')]);return _0x2fb03d['getSubjects'](_0x2221c1);}})[_0x7927('0x28')](function(_0x31834c){if(_0x31834c){_0x37fe27=_0x31834c[_0x7927('0x52')];if(!_0x3cf0cb[_0x7927('0x38')][_0x7927('0x3a')](_0x7927('0x3b'))){_0x2221c1['limit']=qs[_0x7927('0x20')](_0x3cf0cb[_0x7927('0x38')]['limit']);_0x2221c1[_0x7927('0x1e')]=qs[_0x7927('0x1e')](_0x3cf0cb[_0x7927('0x38')][_0x7927('0x1e')]);}return _0x2fb03d['getSubjects'](_0x2221c1);}})['then'](function(_0x27f249){if(_0x27f249){return _0x27f249?{'count':_0x37fe27,'rows':_0x27f249}:null;}})[_0x7927('0x28')](respondWithResult(_0x1d5c31,null))[_0x7927('0x47')](handleError(_0x1d5c31,null));};exports[_0x7927('0x54')]=function(_0x25e8af,_0x3a2394,_0x28648d){var _0x49b18d={};var _0x596d54={};var _0x3c282f;var _0x1c0a02;return db['VtigerConfiguration'][_0x7927('0x50')]({'where':{'id':_0x25e8af[_0x7927('0x49')]['id']}})[_0x7927('0x28')](handleEntityNotFound(_0x3a2394,null))[_0x7927('0x28')](function(_0x109374){if(_0x109374){_0x3c282f=_0x109374;_0x596d54[_0x7927('0x34')]=_[_0x7927('0x35')](db['VtigerField']['rawAttributes']);_0x596d54[_0x7927('0x38')]=_[_0x7927('0x35')](_0x25e8af['query']);_0x596d54[_0x7927('0x36')]=_[_0x7927('0x37')](_0x596d54['model'],_0x596d54['query']);_0x49b18d[_0x7927('0x39')]=_[_0x7927('0x37')](_0x596d54[_0x7927('0x34')],qs[_0x7927('0x4a')](_0x25e8af[_0x7927('0x38')][_0x7927('0x4a')]));_0x49b18d[_0x7927('0x39')]=_0x49b18d[_0x7927('0x39')]['length']?_0x49b18d[_0x7927('0x39')]:_0x596d54[_0x7927('0x34')];_0x49b18d[_0x7927('0x3c')]=qs['sort'](_0x25e8af[_0x7927('0x38')]['sort']);_0x49b18d[_0x7927('0x3e')]=qs[_0x7927('0x36')](_[_0x7927('0x3f')](_0x25e8af[_0x7927('0x38')],_0x596d54[_0x7927('0x36')]));if(_0x25e8af[_0x7927('0x38')]['filter']){_0x49b18d[_0x7927('0x3e')]=_[_0x7927('0x4b')](_0x49b18d['where'],{'$or':_[_0x7927('0x2f')](_0x49b18d[_0x7927('0x39')],function(_0x36cde3){var _0x1bd17a={};_0x1bd17a[_0x36cde3]={'$like':'%'+_0x25e8af[_0x7927('0x38')][_0x7927('0x40')]+'%'};return _0x1bd17a;})});}_0x49b18d=_[_0x7927('0x4b')]({},_0x49b18d,_0x25e8af['options']);return _0x3c282f[_0x7927('0x54')](_0x49b18d);}})[_0x7927('0x28')](function(_0x180baf){if(_0x180baf){_0x1c0a02=_0x180baf[_0x7927('0x52')];if(!_0x25e8af[_0x7927('0x38')]['hasOwnProperty']('nolimit')){_0x49b18d[_0x7927('0x20')]=qs['limit'](_0x25e8af[_0x7927('0x38')][_0x7927('0x20')]);_0x49b18d[_0x7927('0x1e')]=qs[_0x7927('0x1e')](_0x25e8af[_0x7927('0x38')][_0x7927('0x1e')]);}return _0x3c282f[_0x7927('0x54')](_0x49b18d);}})[_0x7927('0x28')](function(_0x588b19){if(_0x588b19){return _0x588b19?{'count':_0x1c0a02,'rows':_0x588b19}:null;}})[_0x7927('0x28')](respondWithResult(_0x3a2394,null))[_0x7927('0x47')](handleError(_0x3a2394,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index dd4af57..7b640bf 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 _0x0f68=['VtigerConfiguration','int_vtiger_configurations','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x7ec370,_0x3d1551){var _0x2fbf28=function(_0x4045e0){while(--_0x4045e0){_0x7ec370['push'](_0x7ec370['shift']());}};_0x2fbf28(++_0x3d1551);}(_0x0f68,0x86));var _0x80f6=function(_0x52bb7b,_0x23d911){_0x52bb7b=_0x52bb7b-0x0;var _0x22b807=_0x0f68[_0x52bb7b];return _0x22b807;};'use strict';var _=require('lodash');var util=require(_0x80f6('0x0'));var logger=require('../../config/logger')(_0x80f6('0x1'));var moment=require(_0x80f6('0x2'));var BPromise=require(_0x80f6('0x3'));var rp=require(_0x80f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80f6('0x5'));var config=require(_0x80f6('0x6'));var attributes=require(_0x80f6('0x7'));module[_0x80f6('0x8')]=function(_0x159a47,_0x2b77a5){return _0x159a47[_0x80f6('0x9')](_0x80f6('0xa'),attributes,{'tableName':_0x80f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf774=['exports','define','int_vtiger_configurations','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x1a7536,_0x30c791){var _0x4660d9=function(_0x1db222){while(--_0x1db222){_0x1a7536['push'](_0x1a7536['shift']());}};_0x4660d9(++_0x30c791);}(_0xf774,0x163));var _0x4f77=function(_0x3847ec,_0x4a7c4c){_0x3847ec=_0x3847ec-0x0;var _0x1d38ee=_0xf774[_0x3847ec];return _0x1d38ee;};'use strict';var _=require(_0x4f77('0x0'));var util=require(_0x4f77('0x1'));var logger=require(_0x4f77('0x2'))(_0x4f77('0x3'));var moment=require('moment');var BPromise=require(_0x4f77('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f77('0x5'));var rimraf=require(_0x4f77('0x6'));var config=require(_0x4f77('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x4f77('0x8')]=function(_0x290c65,_0xb5db8){return _0x290c65[_0x4f77('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x4f77('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 2406433..80091a2 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 _0xfdf4=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent'];(function(_0x470f77,_0x5cec73){var _0x24b33b=function(_0x1969e8){while(--_0x1969e8){_0x470f77['push'](_0x470f77['shift']());}};_0x24b33b(++_0x5cec73);}(_0xfdf4,0x167));var _0x4fdf=function(_0x1a4a49,_0xf73c87){_0x1a4a49=_0x1a4a49-0x0;var _0x3be8cd=_0xfdf4[_0x1a4a49];return _0x3be8cd;};'use strict';var _=require(_0x4fdf('0x0'));var util=require(_0x4fdf('0x1'));var moment=require(_0x4fdf('0x2'));var BPromise=require(_0x4fdf('0x3'));var rs=require(_0x4fdf('0x4'));var fs=require('fs');var Redis=require(_0x4fdf('0x5'));var db=require(_0x4fdf('0x6'))['db'];var utils=require(_0x4fdf('0x7'));var logger=require(_0x4fdf('0x8'))(_0x4fdf('0x9'));var config=require(_0x4fdf('0xa'));var jayson=require(_0x4fdf('0xb'));var client=jayson['client'][_0x4fdf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x549716,_0x2c8d7c,_0x497410){return new BPromise(function(_0x1431da,_0x473ecb){return client[_0x4fdf('0xd')](_0x549716,_0x497410)['then'](function(_0x13f1ed){logger[_0x4fdf('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x2c8d7c,_0x4fdf('0xf'));logger[_0x4fdf('0x10')](_0x4fdf('0x11'),_0x2c8d7c,_0x4fdf('0xf'),JSON[_0x4fdf('0x12')](_0x13f1ed));if(_0x13f1ed[_0x4fdf('0x13')]){if(_0x13f1ed['error'][_0x4fdf('0x14')]===0x1f4){logger[_0x4fdf('0x13')](_0x4fdf('0x15'),_0x2c8d7c,_0x13f1ed[_0x4fdf('0x13')]['message']);return _0x473ecb(_0x13f1ed[_0x4fdf('0x13')][_0x4fdf('0x16')]);}logger[_0x4fdf('0x13')](_0x4fdf('0x15'),_0x2c8d7c,_0x13f1ed['error'][_0x4fdf('0x16')]);return _0x1431da(_0x13f1ed[_0x4fdf('0x13')]['message']);}else{logger[_0x4fdf('0xe')](_0x4fdf('0x15'),_0x2c8d7c,'request\x20sent');_0x1431da(_0x13f1ed[_0x4fdf('0x17')]['message']);}})[_0x4fdf('0x18')](function(_0x5b6152){logger[_0x4fdf('0x13')](_0x4fdf('0x15'),_0x2c8d7c,_0x5b6152);_0x473ecb(_0x5b6152);});});} \ No newline at end of file +var _0x55a6=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x55a6,0xaf));var _0x655a=function(_0xe22499,_0x48d801){_0xe22499=_0xe22499-0x0;var _0x5278e3=_0x55a6[_0xe22499];return _0x5278e3;};'use strict';var _=require(_0x655a('0x0'));var util=require(_0x655a('0x1'));var moment=require(_0x655a('0x2'));var BPromise=require(_0x655a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x655a('0x4'));var db=require(_0x655a('0x5'))['db'];var utils=require(_0x655a('0x6'));var logger=require(_0x655a('0x7'))(_0x655a('0x8'));var config=require(_0x655a('0x9'));var jayson=require(_0x655a('0xa'));var client=jayson['client'][_0x655a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eb226,_0x138205,_0x1196a3){return new BPromise(function(_0x447846,_0x5b5025){return client[_0x655a('0xc')](_0x3eb226,_0x1196a3)[_0x655a('0xd')](function(_0x16b81f){logger[_0x655a('0xe')](_0x655a('0xf'),_0x138205,'request\x20sent');logger[_0x655a('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x138205,_0x655a('0x11'),JSON[_0x655a('0x12')](_0x16b81f));if(_0x16b81f[_0x655a('0x13')]){if(_0x16b81f['error']['code']===0x1f4){logger[_0x655a('0x13')](_0x655a('0xf'),_0x138205,_0x16b81f['error'][_0x655a('0x14')]);return _0x5b5025(_0x16b81f[_0x655a('0x13')]['message']);}logger[_0x655a('0x13')](_0x655a('0xf'),_0x138205,_0x16b81f['error'][_0x655a('0x14')]);return _0x447846(_0x16b81f[_0x655a('0x13')][_0x655a('0x14')]);}else{logger[_0x655a('0xe')](_0x655a('0xf'),_0x138205,_0x655a('0x11'));_0x447846(_0x16b81f[_0x655a('0x15')][_0x655a('0x14')]);}})['catch'](function(_0x427e89){logger[_0x655a('0x13')](_0x655a('0xf'),_0x138205,_0x427e89);_0x5b5025(_0x427e89);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index f2ee229..059d5a1 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 _0x242a=['/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./intVtigerField.controller','isAuthenticated','index','show','post','create','put'];(function(_0x4f75b5,_0x4db76d){var _0x5c263b=function(_0x31e622){while(--_0x31e622){_0x4f75b5['push'](_0x4f75b5['shift']());}};_0x5c263b(++_0x4db76d);}(_0x242a,0x1b5));var _0xa242=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x242a[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require(_0xa242('0x0'));var path=require(_0xa242('0x1'));var timeout=require(_0xa242('0x2'));var express=require(_0xa242('0x3'));var router=express['Router']();var fs_extra=require(_0xa242('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa242('0x5'));var controller=require(_0xa242('0x6'));router['get']('/',auth[_0xa242('0x7')](),controller[_0xa242('0x8')]);router['get']('/:id',auth[_0xa242('0x7')](),controller[_0xa242('0x9')]);router[_0xa242('0xa')]('/',auth[_0xa242('0x7')](),controller[_0xa242('0xb')]);router[_0xa242('0xc')](_0xa242('0xd'),auth['isAuthenticated'](),controller[_0xa242('0xe')]);router[_0xa242('0xf')](_0xa242('0xd'),auth[_0xa242('0x7')](),controller[_0xa242('0x10')]);module[_0xa242('0x11')]=router; \ No newline at end of file +var _0x3579=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','multer','path'];(function(_0x5f4f4d,_0x9b349e){var _0x468b06=function(_0x2369b7){while(--_0x2369b7){_0x5f4f4d['push'](_0x5f4f4d['shift']());}};_0x468b06(++_0x9b349e);}(_0x3579,0xf5));var _0x9357=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x3579[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0x9357('0x0'));var util=require('util');var path=require(_0x9357('0x1'));var timeout=require(_0x9357('0x2'));var express=require(_0x9357('0x3'));var router=express['Router']();var fs_extra=require(_0x9357('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9357('0x5'));var config=require(_0x9357('0x6'));var controller=require(_0x9357('0x7'));router[_0x9357('0x8')]('/',auth[_0x9357('0x9')](),controller[_0x9357('0xa')]);router[_0x9357('0x8')]('/:id',auth[_0x9357('0x9')](),controller[_0x9357('0xb')]);router[_0x9357('0xc')]('/',auth[_0x9357('0x9')](),controller[_0x9357('0xd')]);router['put'](_0x9357('0xe'),auth[_0x9357('0x9')](),controller[_0x9357('0xf')]);router[_0x9357('0x10')](_0x9357('0xe'),auth[_0x9357('0x9')](),controller[_0x9357('0x11')]);module[_0x9357('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3b91aba..dd7f9fa 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 _0x4d73=['picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','variable','keyValue'];(function(_0x38ef55,_0x305ddf){var _0x4e1935=function(_0x13441d){while(--_0x13441d){_0x38ef55['push'](_0x38ef55['shift']());}};_0x4e1935(++_0x305ddf);}(_0x4d73,0x1e2));var _0x34d7=function(_0xd4c6a6,_0x5ce042){_0xd4c6a6=_0xd4c6a6-0x0;var _0x3f9046=_0x4d73[_0xd4c6a6];return _0x3f9046;};'use strict';var Sequelize=require(_0x34d7('0x0'));module[_0x34d7('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x34d7('0x2'),'customVariable',_0x34d7('0x3'),_0x34d7('0x4')),'defaultValue':_0x34d7('0x5')},'content':{'type':Sequelize[_0x34d7('0x6')]},'key':{'type':Sequelize[_0x34d7('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x34d7('0x2'),_0x34d7('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x34d7('0x6')]},'customField':{'type':Sequelize[_0x34d7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5e2a=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x1c5036,_0x238f92){var _0x43d093=function(_0x2d870f){while(--_0x2d870f){_0x1c5036['push'](_0x1c5036['shift']());}};_0x43d093(++_0x238f92);}(_0x5e2a,0x17a));var _0xa5e2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e2a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa5e2('0x0'));module[_0xa5e2('0x1')]={'type':{'type':Sequelize[_0xa5e2('0x2')](_0xa5e2('0x3'),_0xa5e2('0x4'),_0xa5e2('0x5'),'keyValue',_0xa5e2('0x6')),'defaultValue':_0xa5e2('0x3')},'content':{'type':Sequelize[_0xa5e2('0x7')]},'key':{'type':Sequelize[_0xa5e2('0x7')]},'keyType':{'type':Sequelize[_0xa5e2('0x2')](_0xa5e2('0x3'),'variable',_0xa5e2('0x5'))},'keyContent':{'type':Sequelize[_0xa5e2('0x7')]},'idField':{'type':Sequelize[_0xa5e2('0x7')]},'nameField':{'type':Sequelize[_0xa5e2('0x7')]},'customField':{'type':Sequelize[_0xa5e2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa5e2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 830f20f..8345a96 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 _0x5127=['fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','merge','includeAll','include','rows','show','params','rawAttributes','length','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','count','limit','set','apply','reject','update','then','destroy','error','stack','name','send','map','VtigerField'];(function(_0x4a58c1,_0x113d2b){var _0x56e6ff=function(_0x4ffb87){while(--_0x4ffb87){_0x4a58c1['push'](_0x4a58c1['shift']());}};_0x56e6ff(++_0x113d2b);}(_0x5127,0x64));var _0x7512=function(_0x422994,_0x99047b){_0x422994=_0x422994-0x0;var _0x43ad8f=_0x5127[_0x422994];return _0x43ad8f;};'use strict';var emlformat=require(_0x7512('0x0'));var rimraf=require(_0x7512('0x1'));var zipdir=require(_0x7512('0x2'));var jsonpatch=require(_0x7512('0x3'));var rp=require('request-promise');var moment=require(_0x7512('0x4'));var BPromise=require(_0x7512('0x5'));var Mustache=require(_0x7512('0x6'));var util=require('util');var path=require(_0x7512('0x7'));var sox=require(_0x7512('0x8'));var csv=require(_0x7512('0x9'));var ejs=require(_0x7512('0xa'));var fs=require('fs');var fs_extra=require(_0x7512('0xb'));var _=require('lodash');var squel=require(_0x7512('0xc'));var crypto=require(_0x7512('0xd'));var jsforce=require(_0x7512('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7512('0x9'));var querystring=require(_0x7512('0xf'));var Papa=require(_0x7512('0x10'));var Redis=require('ioredis');var authService=require(_0x7512('0x11'));var qs=require(_0x7512('0x12'));var as=require(_0x7512('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7512('0x14'));var utils=require(_0x7512('0x15'));var config=require(_0x7512('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7512('0x17'))['db'];function respondWithStatusCode(_0x4a7dbe,_0x13b5e3){_0x13b5e3=_0x13b5e3||0xcc;return function(_0x4ce2cb){if(_0x4ce2cb){return _0x4a7dbe[_0x7512('0x18')](_0x13b5e3);}return _0x4a7dbe[_0x7512('0x19')](_0x13b5e3)[_0x7512('0x1a')]();};}function respondWithResult(_0x291ff5,_0x1848c3){_0x1848c3=_0x1848c3||0xc8;return function(_0x1aa6fc){if(_0x1aa6fc){return _0x291ff5[_0x7512('0x19')](_0x1848c3)['json'](_0x1aa6fc);}};}function respondWithFilteredResult(_0x30f8d1,_0x119ae5){return function(_0x3eb7d2){if(_0x3eb7d2){var _0x12e918=typeof _0x119ae5[_0x7512('0x1b')]==='undefined'&&typeof _0x119ae5['limit']==='undefined';var _0x757ac1=_0x3eb7d2[_0x7512('0x1c')];var _0x110e45=_0x12e918?0x0:_0x119ae5['offset'];var _0x1bd0a5=_0x12e918?_0x3eb7d2[_0x7512('0x1c')]:_0x119ae5['offset']+_0x119ae5[_0x7512('0x1d')];var _0x40c6da;if(_0x1bd0a5>=_0x757ac1){_0x1bd0a5=_0x757ac1;_0x40c6da=0xc8;}else{_0x40c6da=0xce;}_0x30f8d1['status'](_0x40c6da);return _0x30f8d1[_0x7512('0x1e')]('Content-Range',_0x110e45+'-'+_0x1bd0a5+'/'+_0x757ac1)['json'](_0x3eb7d2);}return null;};}function patchUpdates(_0x14138d){return function(_0x91661b){try{jsonpatch[_0x7512('0x1f')](_0x91661b,_0x14138d,!![]);}catch(_0xae4bc9){return BPromise[_0x7512('0x20')](_0xae4bc9);}return _0x91661b['save']();};}function saveUpdates(_0x3207ba,_0x5c0cae){return function(_0x3939ce){if(_0x3939ce){return _0x3939ce[_0x7512('0x21')](_0x3207ba)[_0x7512('0x22')](function(_0x2ce9d6){return _0x2ce9d6;});}return null;};}function removeEntity(_0x275b31,_0x39aec4){return function(_0x688f02){if(_0x688f02){return _0x688f02[_0x7512('0x23')]()[_0x7512('0x22')](function(){_0x275b31[_0x7512('0x19')](0xcc)[_0x7512('0x1a')]();});}};}function handleEntityNotFound(_0x23a03d,_0x191826){return function(_0x2b1c47){if(!_0x2b1c47){_0x23a03d[_0x7512('0x18')](0x194);}return _0x2b1c47;};}function handleError(_0x256bc8,_0x18bb32){_0x18bb32=_0x18bb32||0x1f4;return function(_0x58834c){logger[_0x7512('0x24')](_0x58834c[_0x7512('0x25')]);if(_0x58834c[_0x7512('0x26')]){delete _0x58834c[_0x7512('0x26')];}_0x256bc8[_0x7512('0x19')](_0x18bb32)[_0x7512('0x27')](_0x58834c);};}exports['index']=function(_0x19c68b,_0x51651d){var _0x2f242f={},_0x2e13ab={},_0x38ed85={'count':0x0,'rows':[]};var _0x1d3436=_[_0x7512('0x28')](db[_0x7512('0x29')]['rawAttributes'],function(_0x46762d){return{'name':_0x46762d[_0x7512('0x2a')],'type':_0x46762d[_0x7512('0x2b')][_0x7512('0x2c')]};});_0x2e13ab['model']=_[_0x7512('0x28')](_0x1d3436,_0x7512('0x26'));_0x2e13ab[_0x7512('0x2d')]=_[_0x7512('0x2e')](_0x19c68b[_0x7512('0x2d')]);_0x2e13ab['filters']=_[_0x7512('0x2f')](_0x2e13ab[_0x7512('0x30')],_0x2e13ab[_0x7512('0x2d')]);_0x2f242f[_0x7512('0x31')]=_['intersection'](_0x2e13ab[_0x7512('0x30')],qs[_0x7512('0x32')](_0x19c68b['query'][_0x7512('0x32')]));_0x2f242f[_0x7512('0x31')]=_0x2f242f[_0x7512('0x31')]['length']?_0x2f242f[_0x7512('0x31')]:_0x2e13ab['model'];if(!_0x19c68b[_0x7512('0x2d')][_0x7512('0x33')]('nolimit')){_0x2f242f[_0x7512('0x1d')]=qs['limit'](_0x19c68b[_0x7512('0x2d')][_0x7512('0x1d')]);_0x2f242f['offset']=qs[_0x7512('0x1b')](_0x19c68b[_0x7512('0x2d')][_0x7512('0x1b')]);}_0x2f242f[_0x7512('0x34')]=qs[_0x7512('0x35')](_0x19c68b[_0x7512('0x2d')][_0x7512('0x35')]);_0x2f242f[_0x7512('0x36')]=qs[_0x7512('0x37')](_[_0x7512('0x38')](_0x19c68b['query'],_0x2e13ab[_0x7512('0x37')]),_0x1d3436);if(_0x19c68b[_0x7512('0x2d')]['filter']){_0x2f242f[_0x7512('0x36')]=_['merge'](_0x2f242f[_0x7512('0x36')],{'$or':_[_0x7512('0x28')](_0x1d3436,function(_0x442e6e){if(_0x442e6e['type']!==_0x7512('0x39')){var _0x19b9b5={};_0x19b9b5[_0x442e6e[_0x7512('0x26')]]={'$like':'%'+_0x19c68b['query']['filter']+'%'};return _0x19b9b5;}})});}_0x2f242f=_[_0x7512('0x3a')]({},_0x2f242f,_0x19c68b['options']);var _0x1ef181={'where':_0x2f242f[_0x7512('0x36')]};return db[_0x7512('0x29')][_0x7512('0x1c')](_0x1ef181)[_0x7512('0x22')](function(_0x2fff95){_0x38ed85['count']=_0x2fff95;if(_0x19c68b[_0x7512('0x2d')][_0x7512('0x3b')]){_0x2f242f[_0x7512('0x3c')]=[{'all':!![]}];}return db[_0x7512('0x29')]['findAll'](_0x2f242f);})[_0x7512('0x22')](function(_0x1d5f24){_0x38ed85[_0x7512('0x3d')]=_0x1d5f24;return _0x38ed85;})['then'](respondWithFilteredResult(_0x51651d,_0x2f242f))['catch'](handleError(_0x51651d,null));};exports[_0x7512('0x3e')]=function(_0xdaeb5b,_0x4dbade){var _0x3f34f3={'raw':!![],'where':{'id':_0xdaeb5b[_0x7512('0x3f')]['id']}},_0x4120bf={};_0x4120bf[_0x7512('0x30')]=_[_0x7512('0x2e')](db[_0x7512('0x29')][_0x7512('0x40')]);_0x4120bf['query']=_[_0x7512('0x2e')](_0xdaeb5b[_0x7512('0x2d')]);_0x4120bf[_0x7512('0x37')]=_['intersection'](_0x4120bf['model'],_0x4120bf[_0x7512('0x2d')]);_0x3f34f3['attributes']=_[_0x7512('0x2f')](_0x4120bf[_0x7512('0x30')],qs[_0x7512('0x32')](_0xdaeb5b[_0x7512('0x2d')][_0x7512('0x32')]));_0x3f34f3[_0x7512('0x31')]=_0x3f34f3[_0x7512('0x31')][_0x7512('0x41')]?_0x3f34f3['attributes']:_0x4120bf[_0x7512('0x30')];if(_0xdaeb5b['query']['includeAll']){_0x3f34f3[_0x7512('0x3c')]=[{'all':!![]}];}_0x3f34f3=_[_0x7512('0x3a')]({},_0x3f34f3,_0xdaeb5b[_0x7512('0x42')]);return db['VtigerField'][_0x7512('0x43')](_0x3f34f3)['then'](handleEntityNotFound(_0x4dbade,null))[_0x7512('0x22')](respondWithResult(_0x4dbade,null))[_0x7512('0x44')](handleError(_0x4dbade,null));};exports[_0x7512('0x45')]=function(_0x5d41e7,_0x549fba){return db[_0x7512('0x29')][_0x7512('0x45')](_0x5d41e7[_0x7512('0x46')],{})[_0x7512('0x22')](respondWithResult(_0x549fba,0xc9))[_0x7512('0x44')](handleError(_0x549fba,null));};exports[_0x7512('0x21')]=function(_0x47da27,_0x7be253){if(_0x47da27[_0x7512('0x46')]['id']){delete _0x47da27[_0x7512('0x46')]['id'];}return db[_0x7512('0x29')][_0x7512('0x43')]({'where':{'id':_0x47da27['params']['id']}})[_0x7512('0x22')](handleEntityNotFound(_0x7be253,null))['then'](saveUpdates(_0x47da27[_0x7512('0x46')],null))[_0x7512('0x22')](respondWithResult(_0x7be253,null))[_0x7512('0x44')](handleError(_0x7be253,null));};exports['destroy']=function(_0x58796c,_0x2f5fc3){return db[_0x7512('0x29')]['find']({'where':{'id':_0x58796c[_0x7512('0x3f')]['id']}})[_0x7512('0x22')](handleEntityNotFound(_0x2f5fc3,null))[_0x7512('0x22')](removeEntity(_0x2f5fc3,null))[_0x7512('0x44')](handleError(_0x2f5fc3,null));}; \ No newline at end of file +var _0xa540=['nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','show','params','keys','filters','find','create','catch','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','index','VtigerField','rawAttributes','fieldName','map','query','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa540,0x186));var _0x0a54=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0xa540[_0x51fe5f];return _0x4abce9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0a54('0x0'));var jsonpatch=require(_0x0a54('0x1'));var rp=require(_0x0a54('0x2'));var moment=require(_0x0a54('0x3'));var BPromise=require(_0x0a54('0x4'));var Mustache=require('mustache');var util=require(_0x0a54('0x5'));var path=require(_0x0a54('0x6'));var sox=require(_0x0a54('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a54('0x8'));var _=require(_0x0a54('0x9'));var squel=require(_0x0a54('0xa'));var crypto=require(_0x0a54('0xb'));var jsforce=require(_0x0a54('0xc'));var deskjs=require(_0x0a54('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0a54('0xe'));var Papa=require('papaparse');var Redis=require(_0x0a54('0xf'));var authService=require(_0x0a54('0x10'));var qs=require(_0x0a54('0x11'));var as=require(_0x0a54('0x12'));var hardwareService=require(_0x0a54('0x13'));var logger=require(_0x0a54('0x14'))(_0x0a54('0x15'));var utils=require(_0x0a54('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0a54('0x17'));var db=require(_0x0a54('0x18'))['db'];function respondWithStatusCode(_0x386779,_0x46aec8){_0x46aec8=_0x46aec8||0xcc;return function(_0x21fe6b){if(_0x21fe6b){return _0x386779[_0x0a54('0x19')](_0x46aec8);}return _0x386779[_0x0a54('0x1a')](_0x46aec8)[_0x0a54('0x1b')]();};}function respondWithResult(_0x11287b,_0x35a976){_0x35a976=_0x35a976||0xc8;return function(_0x269978){if(_0x269978){return _0x11287b[_0x0a54('0x1a')](_0x35a976)['json'](_0x269978);}};}function respondWithFilteredResult(_0x4437bf,_0x299e15){return function(_0x227e5c){if(_0x227e5c){var _0x3771a7=typeof _0x299e15[_0x0a54('0x1c')]==='undefined'&&typeof _0x299e15[_0x0a54('0x1d')]===_0x0a54('0x1e');var _0xf74569=_0x227e5c[_0x0a54('0x1f')];var _0x3e9cbf=_0x3771a7?0x0:_0x299e15[_0x0a54('0x1c')];var _0x2ce98e=_0x3771a7?_0x227e5c['count']:_0x299e15['offset']+_0x299e15[_0x0a54('0x1d')];var _0x562472;if(_0x2ce98e>=_0xf74569){_0x2ce98e=_0xf74569;_0x562472=0xc8;}else{_0x562472=0xce;}_0x4437bf[_0x0a54('0x1a')](_0x562472);return _0x4437bf[_0x0a54('0x20')](_0x0a54('0x21'),_0x3e9cbf+'-'+_0x2ce98e+'/'+_0xf74569)[_0x0a54('0x22')](_0x227e5c);}return null;};}function patchUpdates(_0x41277a){return function(_0x1b9f4e){try{jsonpatch['apply'](_0x1b9f4e,_0x41277a,!![]);}catch(_0x2abdb9){return BPromise[_0x0a54('0x23')](_0x2abdb9);}return _0x1b9f4e[_0x0a54('0x24')]();};}function saveUpdates(_0x14e1cd,_0x35bfd3){return function(_0x125185){if(_0x125185){return _0x125185[_0x0a54('0x25')](_0x14e1cd)[_0x0a54('0x26')](function(_0x3e3597){return _0x3e3597;});}return null;};}function removeEntity(_0x31d767,_0x1eda47){return function(_0x5935dd){if(_0x5935dd){return _0x5935dd[_0x0a54('0x27')]()['then'](function(){_0x31d767[_0x0a54('0x1a')](0xcc)[_0x0a54('0x1b')]();});}};}function handleEntityNotFound(_0x204082,_0x2a4045){return function(_0x5c0c5c){if(!_0x5c0c5c){_0x204082[_0x0a54('0x19')](0x194);}return _0x5c0c5c;};}function handleError(_0x4721cc,_0x2a4cd3){_0x2a4cd3=_0x2a4cd3||0x1f4;return function(_0x163ee2){logger['error'](_0x163ee2[_0x0a54('0x28')]);if(_0x163ee2[_0x0a54('0x29')]){delete _0x163ee2[_0x0a54('0x29')];}_0x4721cc[_0x0a54('0x1a')](_0x2a4cd3)['send'](_0x163ee2);};}exports[_0x0a54('0x2a')]=function(_0x53976d,_0x359b63){var _0xc9dc4e={},_0x2c8d9b={},_0x1e1dff={'count':0x0,'rows':[]};var _0x4d8026=_['map'](db[_0x0a54('0x2b')][_0x0a54('0x2c')],function(_0x3d57f1){return{'name':_0x3d57f1[_0x0a54('0x2d')],'type':_0x3d57f1['type']['key']};});_0x2c8d9b['model']=_[_0x0a54('0x2e')](_0x4d8026,_0x0a54('0x29'));_0x2c8d9b['query']=_['keys'](_0x53976d[_0x0a54('0x2f')]);_0x2c8d9b['filters']=_[_0x0a54('0x30')](_0x2c8d9b[_0x0a54('0x31')],_0x2c8d9b[_0x0a54('0x2f')]);_0xc9dc4e['attributes']=_[_0x0a54('0x30')](_0x2c8d9b[_0x0a54('0x31')],qs[_0x0a54('0x32')](_0x53976d[_0x0a54('0x2f')][_0x0a54('0x32')]));_0xc9dc4e[_0x0a54('0x33')]=_0xc9dc4e[_0x0a54('0x33')][_0x0a54('0x34')]?_0xc9dc4e['attributes']:_0x2c8d9b['model'];if(!_0x53976d[_0x0a54('0x2f')][_0x0a54('0x35')](_0x0a54('0x36'))){_0xc9dc4e['limit']=qs[_0x0a54('0x1d')](_0x53976d[_0x0a54('0x2f')][_0x0a54('0x1d')]);_0xc9dc4e[_0x0a54('0x1c')]=qs[_0x0a54('0x1c')](_0x53976d['query'][_0x0a54('0x1c')]);}_0xc9dc4e[_0x0a54('0x37')]=qs[_0x0a54('0x38')](_0x53976d[_0x0a54('0x2f')]['sort']);_0xc9dc4e[_0x0a54('0x39')]=qs['filters'](_[_0x0a54('0x3a')](_0x53976d[_0x0a54('0x2f')],_0x2c8d9b['filters']),_0x4d8026);if(_0x53976d[_0x0a54('0x2f')][_0x0a54('0x3b')]){_0xc9dc4e[_0x0a54('0x39')]=_[_0x0a54('0x3c')](_0xc9dc4e[_0x0a54('0x39')],{'$or':_[_0x0a54('0x2e')](_0x4d8026,function(_0xe6f53f){if(_0xe6f53f[_0x0a54('0x3d')]!=='VIRTUAL'){var _0x4fe99a={};_0x4fe99a[_0xe6f53f[_0x0a54('0x29')]]={'$like':'%'+_0x53976d[_0x0a54('0x2f')][_0x0a54('0x3b')]+'%'};return _0x4fe99a;}})});}_0xc9dc4e=_[_0x0a54('0x3c')]({},_0xc9dc4e,_0x53976d[_0x0a54('0x3e')]);var _0x57600d={'where':_0xc9dc4e[_0x0a54('0x39')]};return db['VtigerField']['count'](_0x57600d)[_0x0a54('0x26')](function(_0x56cf90){_0x1e1dff['count']=_0x56cf90;if(_0x53976d['query'][_0x0a54('0x3f')]){_0xc9dc4e[_0x0a54('0x40')]=[{'all':!![]}];}return db[_0x0a54('0x2b')][_0x0a54('0x41')](_0xc9dc4e);})[_0x0a54('0x26')](function(_0x48e004){_0x1e1dff['rows']=_0x48e004;return _0x1e1dff;})[_0x0a54('0x26')](respondWithFilteredResult(_0x359b63,_0xc9dc4e))['catch'](handleError(_0x359b63,null));};exports[_0x0a54('0x42')]=function(_0x2a7c7f,_0x180b4b){var _0x495fd3={'raw':!![],'where':{'id':_0x2a7c7f[_0x0a54('0x43')]['id']}},_0x3ec4c6={};_0x3ec4c6['model']=_[_0x0a54('0x44')](db[_0x0a54('0x2b')][_0x0a54('0x2c')]);_0x3ec4c6[_0x0a54('0x2f')]=_[_0x0a54('0x44')](_0x2a7c7f[_0x0a54('0x2f')]);_0x3ec4c6[_0x0a54('0x45')]=_['intersection'](_0x3ec4c6['model'],_0x3ec4c6[_0x0a54('0x2f')]);_0x495fd3['attributes']=_[_0x0a54('0x30')](_0x3ec4c6['model'],qs[_0x0a54('0x32')](_0x2a7c7f[_0x0a54('0x2f')][_0x0a54('0x32')]));_0x495fd3[_0x0a54('0x33')]=_0x495fd3['attributes'][_0x0a54('0x34')]?_0x495fd3[_0x0a54('0x33')]:_0x3ec4c6[_0x0a54('0x31')];if(_0x2a7c7f[_0x0a54('0x2f')]['includeAll']){_0x495fd3['include']=[{'all':!![]}];}_0x495fd3=_[_0x0a54('0x3c')]({},_0x495fd3,_0x2a7c7f[_0x0a54('0x3e')]);return db[_0x0a54('0x2b')][_0x0a54('0x46')](_0x495fd3)[_0x0a54('0x26')](handleEntityNotFound(_0x180b4b,null))[_0x0a54('0x26')](respondWithResult(_0x180b4b,null))['catch'](handleError(_0x180b4b,null));};exports[_0x0a54('0x47')]=function(_0x5b7504,_0x46f205){return db[_0x0a54('0x2b')]['create'](_0x5b7504['body'],{})['then'](respondWithResult(_0x46f205,0xc9))[_0x0a54('0x48')](handleError(_0x46f205,null));};exports[_0x0a54('0x25')]=function(_0x1aa084,_0x52d9ef){if(_0x1aa084[_0x0a54('0x49')]['id']){delete _0x1aa084[_0x0a54('0x49')]['id'];}return db[_0x0a54('0x2b')][_0x0a54('0x46')]({'where':{'id':_0x1aa084[_0x0a54('0x43')]['id']}})['then'](handleEntityNotFound(_0x52d9ef,null))[_0x0a54('0x26')](saveUpdates(_0x1aa084[_0x0a54('0x49')],null))[_0x0a54('0x26')](respondWithResult(_0x52d9ef,null))[_0x0a54('0x48')](handleError(_0x52d9ef,null));};exports[_0x0a54('0x27')]=function(_0x3d5842,_0x487891){return db[_0x0a54('0x2b')][_0x0a54('0x46')]({'where':{'id':_0x3d5842[_0x0a54('0x43')]['id']}})['then'](handleEntityNotFound(_0x487891,null))['then'](removeEntity(_0x487891,null))[_0x0a54('0x48')](handleError(_0x487891,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 4109ffd..d666f99 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 _0x214a=['moment','bluebird','path','../../config/environment','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x4b1663,_0x1dfbbc){var _0x21a3ab=function(_0x831087){while(--_0x831087){_0x4b1663['push'](_0x4b1663['shift']());}};_0x21a3ab(++_0x1dfbbc);}(_0x214a,0x196));var _0xa214=function(_0x166cd9,_0x2110d0){_0x166cd9=_0x166cd9-0x0;var _0x5cf79e=_0x214a[_0x166cd9];return _0x5cf79e;};'use strict';var _=require(_0xa214('0x0'));var util=require(_0xa214('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa214('0x2'));var BPromise=require(_0xa214('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa214('0x4'));var rimraf=require('rimraf');var config=require(_0xa214('0x5'));var attributes=require('./intVtigerField.attributes');module[_0xa214('0x6')]=function(_0x5cf77b,_0x305818){return _0x5cf77b['define'](_0xa214('0x7'),attributes,{'tableName':_0xa214('0x8'),'paranoid':![],'indexes':[{'name':_0xa214('0x9'),'fields':[_0xa214('0xa'),_0xa214('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38ce=['./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xcaa39d,_0x17283a){var _0x24f237=function(_0x31c4cd){while(--_0x31c4cd){_0xcaa39d['push'](_0xcaa39d['shift']());}};_0x24f237(++_0x17283a);}(_0x38ce,0x115));var _0xe38c=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x38ce[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0xe38c('0x0'));var util=require(_0xe38c('0x1'));var logger=require(_0xe38c('0x2'))(_0xe38c('0x3'));var moment=require(_0xe38c('0x4'));var BPromise=require(_0xe38c('0x5'));var rp=require(_0xe38c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe38c('0x7'));var config=require('../../config/environment');var attributes=require(_0xe38c('0x8'));module[_0xe38c('0x9')]=function(_0x26798f,_0x56a455){return _0x26798f['define'](_0xe38c('0xa'),attributes,{'tableName':_0xe38c('0xb'),'paranoid':![],'indexes':[{'name':_0xe38c('0xc'),'fields':[_0xe38c('0xd'),_0xe38c('0xe')],'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 26588d5..65f019d 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 _0x0306=['message','request\x20sent','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x37d225,_0x2ed664){var _0x26834b=function(_0x32260c){while(--_0x32260c){_0x37d225['push'](_0x37d225['shift']());}};_0x26834b(++_0x2ed664);}(_0x0306,0x13e));var _0x6030=function(_0x4028e7,_0x3fc237){_0x4028e7=_0x4028e7-0x0;var _0x2784bc=_0x0306[_0x4028e7];return _0x2784bc;};'use strict';var _=require(_0x6030('0x0'));var util=require(_0x6030('0x1'));var moment=require(_0x6030('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6030('0x3'))['db'];var utils=require(_0x6030('0x4'));var logger=require(_0x6030('0x5'))(_0x6030('0x6'));var config=require(_0x6030('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6030('0x8')][_0x6030('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5596c8,_0x57ff02,_0x43a46c){return new BPromise(function(_0x20df28,_0x266ebe){return client[_0x6030('0xa')](_0x5596c8,_0x43a46c)['then'](function(_0x149f97){logger[_0x6030('0xb')](_0x6030('0xc'),_0x57ff02,'request\x20sent');logger[_0x6030('0xd')](_0x6030('0xe'),_0x57ff02,'request\x20sent',JSON[_0x6030('0xf')](_0x149f97));if(_0x149f97['error']){if(_0x149f97['error'][_0x6030('0x10')]===0x1f4){logger[_0x6030('0x11')](_0x6030('0xc'),_0x57ff02,_0x149f97[_0x6030('0x11')]['message']);return _0x266ebe(_0x149f97[_0x6030('0x11')][_0x6030('0x12')]);}logger[_0x6030('0x11')](_0x6030('0xc'),_0x57ff02,_0x149f97['error'][_0x6030('0x12')]);return _0x20df28(_0x149f97[_0x6030('0x11')][_0x6030('0x12')]);}else{logger[_0x6030('0xb')](_0x6030('0xc'),_0x57ff02,_0x6030('0x13'));_0x20df28(_0x149f97['result'][_0x6030('0x12')]);}})[_0x6030('0x14')](function(_0x5e9db6){logger['error'](_0x6030('0xc'),_0x57ff02,_0x5e9db6);_0x266ebe(_0x5e9db6);});});} \ No newline at end of file +var _0xf0f1=['info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x44b3f6,_0x2f0b79){var _0x4a6207=function(_0x5835fb){while(--_0x5835fb){_0x44b3f6['push'](_0x44b3f6['shift']());}};_0x4a6207(++_0x2f0b79);}(_0xf0f1,0x77));var _0x1f0f=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xf0f1[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0x1f0f('0x0'));var util=require(_0x1f0f('0x1'));var moment=require(_0x1f0f('0x2'));var BPromise=require(_0x1f0f('0x3'));var rs=require(_0x1f0f('0x4'));var fs=require('fs');var Redis=require(_0x1f0f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f0f('0x6'));var logger=require('../../config/logger')(_0x1f0f('0x7'));var config=require(_0x1f0f('0x8'));var jayson=require(_0x1f0f('0x9'));var client=jayson[_0x1f0f('0xa')][_0x1f0f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x596649,_0xa3f74b,_0x31ba14){return new BPromise(function(_0x105c44,_0x5ed554){return client['request'](_0x596649,_0x31ba14)[_0x1f0f('0xc')](function(_0x1cba61){logger[_0x1f0f('0xd')](_0x1f0f('0xe'),_0xa3f74b,_0x1f0f('0xf'));logger[_0x1f0f('0x10')](_0x1f0f('0x11'),_0xa3f74b,_0x1f0f('0xf'),JSON['stringify'](_0x1cba61));if(_0x1cba61[_0x1f0f('0x12')]){if(_0x1cba61['error']['code']===0x1f4){logger[_0x1f0f('0x12')](_0x1f0f('0xe'),_0xa3f74b,_0x1cba61[_0x1f0f('0x12')][_0x1f0f('0x13')]);return _0x5ed554(_0x1cba61[_0x1f0f('0x12')][_0x1f0f('0x13')]);}logger['error'](_0x1f0f('0xe'),_0xa3f74b,_0x1cba61[_0x1f0f('0x12')][_0x1f0f('0x13')]);return _0x105c44(_0x1cba61[_0x1f0f('0x12')][_0x1f0f('0x13')]);}else{logger[_0x1f0f('0xd')](_0x1f0f('0xe'),_0xa3f74b,_0x1f0f('0xf'));_0x105c44(_0x1cba61[_0x1f0f('0x14')]['message']);}})[_0x1f0f('0x15')](function(_0x2d71c5){logger['error'](_0x1f0f('0xe'),_0xa3f74b,_0x2d71c5);_0x5ed554(_0x2d71c5);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index a14430f..9d5234e 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 _0xc0e1=['./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x246d47,_0x402b0b){var _0x1f9368=function(_0x3e3d68){while(--_0x3e3d68){_0x246d47['push'](_0x246d47['shift']());}};_0x1f9368(++_0x402b0b);}(_0xc0e1,0x147));var _0x1c0e=function(_0x473ee7,_0x4dd754){_0x473ee7=_0x473ee7-0x0;var _0x30f0d4=_0xc0e1[_0x473ee7];return _0x30f0d4;};'use strict';var multer=require(_0x1c0e('0x0'));var util=require(_0x1c0e('0x1'));var path=require(_0x1c0e('0x2'));var timeout=require('connect-timeout');var express=require(_0x1c0e('0x3'));var router=express[_0x1c0e('0x4')]();var fs_extra=require(_0x1c0e('0x5'));var auth=require(_0x1c0e('0x6'));var interaction=require(_0x1c0e('0x7'));var config=require(_0x1c0e('0x8'));var controller=require(_0x1c0e('0x9'));router[_0x1c0e('0xa')]('/',auth[_0x1c0e('0xb')](),controller[_0x1c0e('0xc')]);router[_0x1c0e('0xa')](_0x1c0e('0xd'),auth[_0x1c0e('0xb')](),controller[_0x1c0e('0xe')]);router['get'](_0x1c0e('0xf'),auth[_0x1c0e('0xb')](),controller['getConfigurations']);router['get'](_0x1c0e('0x10'),auth[_0x1c0e('0xb')](),controller[_0x1c0e('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1c0e('0x12')]);router[_0x1c0e('0x13')](_0x1c0e('0xf'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0x1c0e('0xb')](),controller[_0x1c0e('0x14')]);router[_0x1c0e('0x15')](_0x1c0e('0xd'),auth[_0x1c0e('0xb')](),controller[_0x1c0e('0x16')]);module[_0x1c0e('0x17')]=router; \ No newline at end of file +var _0x2a07=['./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x269022,_0x6ca507){var _0x2deec3=function(_0x3e8a24){while(--_0x3e8a24){_0x269022['push'](_0x269022['shift']());}};_0x2deec3(++_0x6ca507);}(_0x2a07,0x74));var _0x72a0=function(_0x36f5cb,_0x2a720f){_0x36f5cb=_0x36f5cb-0x0;var _0x58d6ce=_0x2a07[_0x36f5cb];return _0x58d6ce;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['get'](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller['getFields']);router[_0x72a0('0x12')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0x13')]);router[_0x72a0('0x12')](_0x72a0('0xf'),auth['isAuthenticated'](),controller[_0x72a0('0x14')]);router[_0x72a0('0x15')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x16')]);router[_0x72a0('0x17')](_0x72a0('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x72a0('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 522faa5..ea06d06 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 _0x1203=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','newTab','integrationTab'];(function(_0x36b8b4,_0x2c2fc8){var _0x16dda2=function(_0x326542){while(--_0x326542){_0x36b8b4['push'](_0x36b8b4['shift']());}};_0x16dda2(++_0x2c2fc8);}(_0x1203,0x8c));var _0x3120=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1203[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x3120('0x0'));module[_0x3120('0x1')]={'name':{'type':Sequelize[_0x3120('0x2')]},'description':{'type':Sequelize[_0x3120('0x2')]},'username':{'type':Sequelize[_0x3120('0x2')],'unique':_0x3120('0x3')},'password':{'type':Sequelize[_0x3120('0x2')]},'token':{'type':Sequelize[_0x3120('0x2')]},'remoteUri':{'type':Sequelize[_0x3120('0x2')],'unique':_0x3120('0x4')},'authType':{'type':Sequelize[_0x3120('0x5')](_0x3120('0x6'),_0x3120('0x7')),'defaultValue':_0x3120('0x6')},'serverUrl':{'type':Sequelize[_0x3120('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3120('0x5')]('integrationTab',_0x3120('0x8')),'defaultValue':_0x3120('0x9')}}; \ No newline at end of file +var _0x9e69=['exports','STRING','remoteUri','ENUM','password','newTab','integrationTab'];(function(_0x30ebcc,_0x307cf4){var _0x19b3d8=function(_0x315965){while(--_0x315965){_0x30ebcc['push'](_0x30ebcc['shift']());}};_0x19b3d8(++_0x307cf4);}(_0x9e69,0x150));var _0x99e6=function(_0x29e256,_0xbc2b49){_0x29e256=_0x29e256-0x0;var _0x44d83b=_0x9e69[_0x29e256];return _0x44d83b;};'use strict';var Sequelize=require('sequelize');module[_0x99e6('0x0')]={'name':{'type':Sequelize[_0x99e6('0x1')]},'description':{'type':Sequelize[_0x99e6('0x1')]},'username':{'type':Sequelize[_0x99e6('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x99e6('0x1')]},'token':{'type':Sequelize[_0x99e6('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x99e6('0x2')},'authType':{'type':Sequelize[_0x99e6('0x3')](_0x99e6('0x4'),'token'),'defaultValue':_0x99e6('0x4')},'serverUrl':{'type':Sequelize[_0x99e6('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x99e6('0x3')]('integrationTab',_0x99e6('0x5')),'defaultValue':_0x99e6('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 58b9286..fb1dc9f 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 _0x16d2=['where','VIRTUAL','options','includeAll','findAll','rows','show','include','find','create','catch','body','params','ZendeskConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','password','authType','remoteUri','slice','substring','GET','%s/%s','ticket_fields','headers','format','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','username','Sequelize','subject','description','assignee','remove','position','title','system_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x16d2,0x123));var _0x216d=function(_0x5bcc1c,_0x55e799){_0x5bcc1c=_0x5bcc1c-0x0;var _0x1848b8=_0x16d2[_0x5bcc1c];return _0x1848b8;};'use strict';var emlformat=require(_0x216d('0x0'));var rimraf=require(_0x216d('0x1'));var zipdir=require(_0x216d('0x2'));var jsonpatch=require(_0x216d('0x3'));var rp=require(_0x216d('0x4'));var moment=require(_0x216d('0x5'));var BPromise=require(_0x216d('0x6'));var Mustache=require(_0x216d('0x7'));var util=require(_0x216d('0x8'));var path=require('path');var sox=require(_0x216d('0x9'));var csv=require(_0x216d('0xa'));var ejs=require(_0x216d('0xb'));var fs=require('fs');var fs_extra=require(_0x216d('0xc'));var _=require(_0x216d('0xd'));var squel=require(_0x216d('0xe'));var crypto=require(_0x216d('0xf'));var jsforce=require(_0x216d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x216d('0xa'));var querystring=require(_0x216d('0x11'));var Papa=require(_0x216d('0x12'));var Redis=require(_0x216d('0x13'));var authService=require(_0x216d('0x14'));var qs=require(_0x216d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x216d('0x16'));var logger=require('../../config/logger')(_0x216d('0x17'));var utils=require(_0x216d('0x18'));var config=require(_0x216d('0x19'));var licenseUtil=require(_0x216d('0x1a'));var db=require(_0x216d('0x1b'))['db'];var integrations=require(_0x216d('0x1c'));function respondWithStatusCode(_0x4c92d9,_0xb36a43){_0xb36a43=_0xb36a43||0xcc;return function(_0x4c07d0){if(_0x4c07d0){return _0x4c92d9[_0x216d('0x1d')](_0xb36a43);}return _0x4c92d9[_0x216d('0x1e')](_0xb36a43)['end']();};}function respondWithResult(_0x165c19,_0x322e4b){_0x322e4b=_0x322e4b||0xc8;return function(_0x54a816){if(_0x54a816){return _0x165c19[_0x216d('0x1e')](_0x322e4b)['json'](_0x54a816);}};}function respondWithFilteredResult(_0x448c0d,_0xf571a4){return function(_0x4631b0){if(_0x4631b0){var _0x23ff86=typeof _0xf571a4[_0x216d('0x1f')]===_0x216d('0x20')&&typeof _0xf571a4[_0x216d('0x21')]===_0x216d('0x20');var _0x19fdac=_0x4631b0['count'];var _0x3b60dd=_0x23ff86?0x0:_0xf571a4['offset'];var _0x4ddc51=_0x23ff86?_0x4631b0[_0x216d('0x22')]:_0xf571a4[_0x216d('0x1f')]+_0xf571a4['limit'];var _0x3f32e0;if(_0x4ddc51>=_0x19fdac){_0x4ddc51=_0x19fdac;_0x3f32e0=0xc8;}else{_0x3f32e0=0xce;}_0x448c0d[_0x216d('0x1e')](_0x3f32e0);return _0x448c0d['set'](_0x216d('0x23'),_0x3b60dd+'-'+_0x4ddc51+'/'+_0x19fdac)[_0x216d('0x24')](_0x4631b0);}return null;};}function patchUpdates(_0x430e81){return function(_0x3e9818){try{jsonpatch['apply'](_0x3e9818,_0x430e81,!![]);}catch(_0x20ee7c){return BPromise[_0x216d('0x25')](_0x20ee7c);}return _0x3e9818[_0x216d('0x26')]();};}function saveUpdates(_0x438981,_0x206782){return function(_0x57cfbd){if(_0x57cfbd){return _0x57cfbd[_0x216d('0x27')](_0x438981)[_0x216d('0x28')](function(_0x188494){return _0x188494;});}return null;};}function removeEntity(_0x2880c6,_0x6fa4b3){return function(_0x54d96f){if(_0x54d96f){return _0x54d96f[_0x216d('0x29')]()[_0x216d('0x28')](function(){_0x2880c6[_0x216d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ec8a7,_0x56460f){return function(_0x4c792e){if(!_0x4c792e){_0x4ec8a7['sendStatus'](0x194);}return _0x4c792e;};}function handleError(_0x32f240,_0x470d8a){_0x470d8a=_0x470d8a||0x1f4;return function(_0x189413){logger[_0x216d('0x2a')](_0x189413[_0x216d('0x2b')]);if(_0x189413['name']){delete _0x189413['name'];}_0x32f240[_0x216d('0x1e')](_0x470d8a)['send'](_0x189413);};}exports[_0x216d('0x2c')]=function(_0x42abbe,_0x10f7c6){var _0x20bc16={},_0x307f2b={},_0x12bcab={'count':0x0,'rows':[]};var _0x28fcc2=_[_0x216d('0x2d')](db[_0x216d('0x2e')][_0x216d('0x2f')],function(_0x11be90){return{'name':_0x11be90[_0x216d('0x30')],'type':_0x11be90[_0x216d('0x31')]['key']};});_0x307f2b[_0x216d('0x32')]=_[_0x216d('0x2d')](_0x28fcc2,_0x216d('0x33'));_0x307f2b['query']=_[_0x216d('0x34')](_0x42abbe[_0x216d('0x35')]);_0x307f2b[_0x216d('0x36')]=_[_0x216d('0x37')](_0x307f2b['model'],_0x307f2b[_0x216d('0x35')]);_0x20bc16[_0x216d('0x38')]=_[_0x216d('0x37')](_0x307f2b[_0x216d('0x32')],qs[_0x216d('0x39')](_0x42abbe[_0x216d('0x35')][_0x216d('0x39')]));_0x20bc16[_0x216d('0x38')]=_0x20bc16[_0x216d('0x38')][_0x216d('0x3a')]?_0x20bc16[_0x216d('0x38')]:_0x307f2b['model'];if(!_0x42abbe[_0x216d('0x35')][_0x216d('0x3b')](_0x216d('0x3c'))){_0x20bc16['limit']=qs[_0x216d('0x21')](_0x42abbe[_0x216d('0x35')]['limit']);_0x20bc16[_0x216d('0x1f')]=qs['offset'](_0x42abbe['query'][_0x216d('0x1f')]);}_0x20bc16[_0x216d('0x3d')]=qs[_0x216d('0x3e')](_0x42abbe[_0x216d('0x35')]['sort']);_0x20bc16['where']=qs['filters'](_[_0x216d('0x3f')](_0x42abbe[_0x216d('0x35')],_0x307f2b['filters']),_0x28fcc2);if(_0x42abbe[_0x216d('0x35')][_0x216d('0x40')]){_0x20bc16['where']=_[_0x216d('0x41')](_0x20bc16[_0x216d('0x42')],{'$or':_[_0x216d('0x2d')](_0x28fcc2,function(_0x474fab){if(_0x474fab[_0x216d('0x31')]!==_0x216d('0x43')){var _0x35cb6e={};_0x35cb6e[_0x474fab[_0x216d('0x33')]]={'$like':'%'+_0x42abbe['query']['filter']+'%'};return _0x35cb6e;}})});}_0x20bc16=_[_0x216d('0x41')]({},_0x20bc16,_0x42abbe[_0x216d('0x44')]);var _0x504a34={'where':_0x20bc16[_0x216d('0x42')]};return db[_0x216d('0x2e')][_0x216d('0x22')](_0x504a34)['then'](function(_0x2c3e44){_0x12bcab[_0x216d('0x22')]=_0x2c3e44;if(_0x42abbe[_0x216d('0x35')][_0x216d('0x45')]){_0x20bc16['include']=[{'all':!![]}];}return db[_0x216d('0x2e')][_0x216d('0x46')](_0x20bc16);})['then'](function(_0x37bf4a){_0x12bcab[_0x216d('0x47')]=_0x37bf4a;return _0x12bcab;})['then'](respondWithFilteredResult(_0x10f7c6,_0x20bc16))['catch'](handleError(_0x10f7c6,null));};exports[_0x216d('0x48')]=function(_0x440bc9,_0x3c491e){var _0x498efe={'raw':![],'where':{'id':_0x440bc9['params']['id']}},_0x3e361a={};_0x3e361a['model']=_[_0x216d('0x34')](db[_0x216d('0x2e')][_0x216d('0x2f')]);_0x3e361a['query']=_[_0x216d('0x34')](_0x440bc9['query']);_0x3e361a[_0x216d('0x36')]=_[_0x216d('0x37')](_0x3e361a[_0x216d('0x32')],_0x3e361a['query']);_0x498efe[_0x216d('0x38')]=_[_0x216d('0x37')](_0x3e361a[_0x216d('0x32')],qs[_0x216d('0x39')](_0x440bc9['query']['fields']));_0x498efe['attributes']=_0x498efe[_0x216d('0x38')][_0x216d('0x3a')]?_0x498efe[_0x216d('0x38')]:_0x3e361a[_0x216d('0x32')];if(_0x440bc9[_0x216d('0x35')][_0x216d('0x45')]){_0x498efe[_0x216d('0x49')]=[{'all':!![]}];}_0x498efe=_[_0x216d('0x41')]({},_0x498efe,_0x440bc9['options']);return db[_0x216d('0x2e')][_0x216d('0x4a')](_0x498efe)[_0x216d('0x28')](handleEntityNotFound(_0x3c491e,null))[_0x216d('0x28')](respondWithResult(_0x3c491e,null))['catch'](handleError(_0x3c491e,null));};exports[_0x216d('0x4b')]=function(_0x542e1b,_0x1f2fa5){return db[_0x216d('0x2e')][_0x216d('0x4b')](_0x542e1b['body'],{})['then'](respondWithResult(_0x1f2fa5,0xc9))[_0x216d('0x4c')](handleError(_0x1f2fa5,null));};exports[_0x216d('0x27')]=function(_0x3932a3,_0x1340fe){if(_0x3932a3[_0x216d('0x4d')]['id']){delete _0x3932a3[_0x216d('0x4d')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x3932a3[_0x216d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1340fe,null))[_0x216d('0x28')](saveUpdates(_0x3932a3[_0x216d('0x4d')],null))['then'](respondWithResult(_0x1340fe,null))['catch'](handleError(_0x1340fe,null));};exports['destroy']=function(_0x4bac14,_0x1ae9b7){return db[_0x216d('0x2e')][_0x216d('0x4a')]({'where':{'id':_0x4bac14[_0x216d('0x4e')]['id']}})[_0x216d('0x28')](handleEntityNotFound(_0x1ae9b7,null))[_0x216d('0x28')](removeEntity(_0x1ae9b7,null))[_0x216d('0x4c')](handleError(_0x1ae9b7,null));};exports['getConfigurations']=function(_0x3f70c9,_0x34cdb9,_0x119b12){var _0x54dd49={};var _0x1e1caf={};var _0x10fe2e;var _0x2c7c67;return db[_0x216d('0x2e')]['findOne']({'where':{'id':_0x3f70c9[_0x216d('0x4e')]['id']}})[_0x216d('0x28')](handleEntityNotFound(_0x34cdb9,null))[_0x216d('0x28')](function(_0x1a4761){if(_0x1a4761){_0x10fe2e=_0x1a4761;_0x1e1caf['model']=_[_0x216d('0x34')](db[_0x216d('0x4f')]['rawAttributes']);_0x1e1caf[_0x216d('0x35')]=_['keys'](_0x3f70c9[_0x216d('0x35')]);_0x1e1caf[_0x216d('0x36')]=_[_0x216d('0x37')](_0x1e1caf[_0x216d('0x32')],_0x1e1caf[_0x216d('0x35')]);_0x54dd49[_0x216d('0x38')]=_[_0x216d('0x37')](_0x1e1caf[_0x216d('0x32')],qs[_0x216d('0x39')](_0x3f70c9['query'][_0x216d('0x39')]));_0x54dd49[_0x216d('0x38')]=_0x54dd49['attributes'][_0x216d('0x3a')]?_0x54dd49[_0x216d('0x38')]:_0x1e1caf['model'];_0x54dd49['order']=qs[_0x216d('0x3e')](_0x3f70c9['query'][_0x216d('0x3e')]);_0x54dd49[_0x216d('0x42')]=qs[_0x216d('0x36')](_['pick'](_0x3f70c9[_0x216d('0x35')],_0x1e1caf['filters']));if(_0x3f70c9['query'][_0x216d('0x40')]){_0x54dd49[_0x216d('0x42')]=_['merge'](_0x54dd49[_0x216d('0x42')],{'$or':_[_0x216d('0x2d')](_0x54dd49[_0x216d('0x38')],function(_0x3f9097){var _0x2ae667={};_0x2ae667[_0x3f9097]={'$like':'%'+_0x3f70c9[_0x216d('0x35')]['filter']+'%'};return _0x2ae667;})});}_0x54dd49=_['merge']({},_0x54dd49,_0x3f70c9[_0x216d('0x44')]);return _0x10fe2e[_0x216d('0x50')](_0x54dd49);}})[_0x216d('0x28')](function(_0x1551b6){if(_0x1551b6){_0x2c7c67=_0x1551b6[_0x216d('0x3a')];if(!_0x3f70c9[_0x216d('0x35')][_0x216d('0x3b')](_0x216d('0x3c'))){_0x54dd49[_0x216d('0x21')]=qs[_0x216d('0x21')](_0x3f70c9[_0x216d('0x35')][_0x216d('0x21')]);_0x54dd49['offset']=qs['offset'](_0x3f70c9[_0x216d('0x35')][_0x216d('0x1f')]);}return _0x10fe2e['getConfigurations'](_0x54dd49);}})[_0x216d('0x28')](function(_0x5eb684){if(_0x5eb684){return _0x5eb684?{'count':_0x2c7c67,'rows':_0x5eb684}:null;}})['then'](respondWithResult(_0x34cdb9,null))[_0x216d('0x4c')](handleError(_0x34cdb9,null));};exports[_0x216d('0x51')]=function(_0x20806e,_0x17ce26,_0x1d404c){if(_0x20806e[_0x216d('0x4d')]['id']){delete _0x20806e[_0x216d('0x4d')]['id'];}return db[_0x216d('0x2e')][_0x216d('0x52')]({'where':{'id':_0x20806e[_0x216d('0x4e')]['id']}})[_0x216d('0x28')](handleEntityNotFound(_0x17ce26,null))[_0x216d('0x28')](function(_0x19c7cf){if(_0x19c7cf){_0x20806e[_0x216d('0x4d')][_0x216d('0x53')]=_0x19c7cf['id'];_0x20806e[_0x216d('0x4d')][_0x216d('0x54')]=integrations[_0x216d('0x55')](_0x20806e[_0x216d('0x4d')][_0x216d('0x56')],_0x20806e[_0x216d('0x4d')][_0x216d('0x31')]);_0x20806e['body'][_0x216d('0x57')]=integrations['getDescriptions'](_0x20806e[_0x216d('0x4d')]['channel'],_0x20806e[_0x216d('0x4d')][_0x216d('0x31')]);return db['ZendeskConfiguration'][_0x216d('0x4b')](_0x20806e[_0x216d('0x4d')],{'include':[{'model':db[_0x216d('0x58')],'as':_0x216d('0x54')},{'model':db[_0x216d('0x58')],'as':_0x216d('0x57')}]});}return null;})[_0x216d('0x28')](respondWithResult(_0x17ce26,null))[_0x216d('0x4c')](handleError(_0x17ce26,null));};exports[_0x216d('0x59')]=function(_0x5acc44,_0x120f8a,_0x299cc7){var _0x16cf09='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x5acc44['params']['id']},'attributes':['id','username',_0x216d('0x5a'),'token',_0x216d('0x5b'),_0x216d('0x5c')]})[_0x216d('0x28')](handleEntityNotFound(_0x120f8a,null))[_0x216d('0x28')](function(_0x431014){if(_0x431014){_0x16cf09=_0x431014[_0x216d('0x5c')];var _0x3a2e7c=_0x16cf09[_0x216d('0x5d')](-0x1);if(_0x3a2e7c==='/'){_0x16cf09=_0x16cf09[_0x216d('0x5e')](0x0,_0x16cf09['lastIndexOf'](_0x3a2e7c));}var _0x4e4e1a={'method':_0x216d('0x5f'),'uri':util['format'](_0x216d('0x60'),_0x16cf09,_0x216d('0x61')),'json':!![]};switch(_0x431014[_0x216d('0x5b')]){case _0x216d('0x5a'):_0x4e4e1a[_0x216d('0x62')]={'Authorization':util[_0x216d('0x63')]('Basic\x20%s',new Buffer(util['format'](_0x216d('0x64'),_0x431014['username'],_0x431014[_0x216d('0x5a')]))[_0x216d('0x65')](_0x216d('0x66')))};break;case'token':_0x4e4e1a['headers']={'Authorization':util['format'](_0x216d('0x67'),new Buffer(util[_0x216d('0x63')](_0x216d('0x68'),_0x431014[_0x216d('0x69')],_0x431014['token']))[_0x216d('0x65')](_0x216d('0x66')))};break;default:throw new db[(_0x216d('0x6a'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x4e4e1a);}})[_0x216d('0x28')](function(_0x87511b){if(_0x87511b){var _0x273d11=[_0x216d('0x6b'),_0x216d('0x6c'),'group',_0x216d('0x6d')];_[_0x216d('0x6e')](_0x87511b[_0x216d('0x61')],function(_0x325bd8){return _0x273d11['includes'](_0x325bd8[_0x216d('0x31')]);});return{'count':_0x87511b['ticket_fields'][_0x216d('0x3a')],'rows':_['map'](_0x87511b[_0x216d('0x61')],function(_0x3ae6df){return{'id':_0x3ae6df['id'],'name':_0x3ae6df[_0x216d('0x6f')]>0x7?_0x3ae6df[_0x216d('0x70')]:_0x3ae6df[_0x216d('0x31')],'custom':_0x3ae6df['position']>0x7?!![]:![],'options':_0x3ae6df[_0x216d('0x71')]?_0x3ae6df['system_field_options']:_0x3ae6df['custom_field_options']?_0x3ae6df['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x120f8a,null))[_0x216d('0x4c')](function(_0x38e7d7){var _0xa1594b=_0x5acc44['query']['test']?0x1f4:_0x38e7d7[_0x216d('0x72')]||0x1f4;logger[_0x216d('0x2a')](_0x216d('0x73'),_0x216d('0x59'),_0xa1594b,JSON[_0x216d('0x74')](_0x38e7d7));delete _0x38e7d7['name'];if(_0xa1594b===0x191){_0xa1594b=0x190;}_0x120f8a['status'](_0xa1594b)[_0x216d('0x75')](_0x5acc44['query'][_0x216d('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x38e7d7[_0x216d('0x72')]}:_0x38e7d7);});}; \ No newline at end of file +var _0xbc9d=['merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','update','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','channel','ZendeskField','Subjects','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','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','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick'];(function(_0x4d3924,_0x327b56){var _0x844555=function(_0x387a6d){while(--_0x387a6d){_0x4d3924['push'](_0x4d3924['shift']());}};_0x844555(++_0x327b56);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x11565f,_0x192858){_0x11565f=_0x11565f-0x0;var _0x15e37c=_0xbc9d[_0x11565f];return _0x15e37c;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];var integrations=require(_0xdbc9('0x19'));function respondWithStatusCode(_0x48bc83,_0x567e71){_0x567e71=_0x567e71||0xcc;return function(_0x3d0fdd){if(_0x3d0fdd){return _0x48bc83[_0xdbc9('0x1a')](_0x567e71);}return _0x48bc83[_0xdbc9('0x1b')](_0x567e71)[_0xdbc9('0x1c')]();};}function respondWithResult(_0x53495d,_0x4a9dcb){_0x4a9dcb=_0x4a9dcb||0xc8;return function(_0x2b7bd){if(_0x2b7bd){return _0x53495d[_0xdbc9('0x1b')](_0x4a9dcb)[_0xdbc9('0x1d')](_0x2b7bd);}};}function respondWithFilteredResult(_0x4c7b4f,_0x1b4616){return function(_0x1abee8){if(_0x1abee8){var _0x4fdb81=typeof _0x1b4616[_0xdbc9('0x1e')]===_0xdbc9('0x1f')&&typeof _0x1b4616[_0xdbc9('0x20')]===_0xdbc9('0x1f');var _0x1f22f4=_0x1abee8[_0xdbc9('0x21')];var _0x9f343d=_0x4fdb81?0x0:_0x1b4616[_0xdbc9('0x1e')];var _0x2ad952=_0x4fdb81?_0x1abee8[_0xdbc9('0x21')]:_0x1b4616['offset']+_0x1b4616[_0xdbc9('0x20')];var _0x497be2;if(_0x2ad952>=_0x1f22f4){_0x2ad952=_0x1f22f4;_0x497be2=0xc8;}else{_0x497be2=0xce;}_0x4c7b4f[_0xdbc9('0x1b')](_0x497be2);return _0x4c7b4f[_0xdbc9('0x22')]('Content-Range',_0x9f343d+'-'+_0x2ad952+'/'+_0x1f22f4)[_0xdbc9('0x1d')](_0x1abee8);}return null;};}function patchUpdates(_0x5367dc){return function(_0x569f32){try{jsonpatch['apply'](_0x569f32,_0x5367dc,!![]);}catch(_0x4f3b5d){return BPromise[_0xdbc9('0x23')](_0x4f3b5d);}return _0x569f32[_0xdbc9('0x24')]();};}function saveUpdates(_0x570ad9,_0x16dcf7){return function(_0x20563e){if(_0x20563e){return _0x20563e['update'](_0x570ad9)[_0xdbc9('0x25')](function(_0x6b788){return _0x6b788;});}return null;};}function removeEntity(_0x1b1c0d,_0x119230){return function(_0x3400e7){if(_0x3400e7){return _0x3400e7[_0xdbc9('0x26')]()[_0xdbc9('0x25')](function(){_0x1b1c0d[_0xdbc9('0x1b')](0xcc)[_0xdbc9('0x1c')]();});}};}function handleEntityNotFound(_0x4a868b,_0x550bef){return function(_0xe309ae){if(!_0xe309ae){_0x4a868b[_0xdbc9('0x1a')](0x194);}return _0xe309ae;};}function handleError(_0x1053ca,_0x24fdec){_0x24fdec=_0x24fdec||0x1f4;return function(_0x50c3ee){logger[_0xdbc9('0x27')](_0x50c3ee[_0xdbc9('0x28')]);if(_0x50c3ee['name']){delete _0x50c3ee['name'];}_0x1053ca[_0xdbc9('0x1b')](_0x24fdec)[_0xdbc9('0x29')](_0x50c3ee);};}exports[_0xdbc9('0x2a')]=function(_0x59bfd2,_0x13a432){var _0x539e57={},_0x561f8e={},_0x210a40={'count':0x0,'rows':[]};var _0x49da36=_['map'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')],function(_0x1cb557){return{'name':_0x1cb557['fieldName'],'type':_0x1cb557[_0xdbc9('0x2d')][_0xdbc9('0x2e')]};});_0x561f8e['model']=_['map'](_0x49da36,_0xdbc9('0x2f'));_0x561f8e[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x59bfd2[_0xdbc9('0x30')]);_0x561f8e[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],_0x561f8e['query']);_0x539e57[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],qs[_0xdbc9('0x36')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x539e57['attributes']=_0x539e57[_0xdbc9('0x35')]['length']?_0x539e57['attributes']:_0x561f8e['model'];if(!_0x59bfd2['query']['hasOwnProperty'](_0xdbc9('0x37'))){_0x539e57[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x59bfd2['query'][_0xdbc9('0x20')]);_0x539e57[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x1e')]);}_0x539e57[_0xdbc9('0x38')]=qs['sort'](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x39')]);_0x539e57[_0xdbc9('0x3a')]=qs['filters'](_[_0xdbc9('0x3b')](_0x59bfd2[_0xdbc9('0x30')],_0x561f8e[_0xdbc9('0x32')]),_0x49da36);if(_0x59bfd2[_0xdbc9('0x30')]['filter']){_0x539e57['where']=_[_0xdbc9('0x3c')](_0x539e57[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x49da36,function(_0x1ef970){if(_0x1ef970['type']!==_0xdbc9('0x3e')){var _0x3827be={};_0x3827be[_0x1ef970[_0xdbc9('0x2f')]]={'$like':'%'+_0x59bfd2['query'][_0xdbc9('0x3f')]+'%'};return _0x3827be;}})});}_0x539e57=_[_0xdbc9('0x3c')]({},_0x539e57,_0x59bfd2[_0xdbc9('0x40')]);var _0x523c79={'where':_0x539e57[_0xdbc9('0x3a')]};return db[_0xdbc9('0x2b')]['count'](_0x523c79)['then'](function(_0xfc34d5){_0x210a40[_0xdbc9('0x21')]=_0xfc34d5;if(_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x41')]){_0x539e57['include']=[{'all':!![]}];}return db[_0xdbc9('0x2b')][_0xdbc9('0x42')](_0x539e57);})['then'](function(_0x8445b8){_0x210a40[_0xdbc9('0x43')]=_0x8445b8;return _0x210a40;})['then'](respondWithFilteredResult(_0x13a432,_0x539e57))[_0xdbc9('0x44')](handleError(_0x13a432,null));};exports[_0xdbc9('0x45')]=function(_0x2adb23,_0x3415c3){var _0x3ed4de={'raw':![],'where':{'id':_0x2adb23[_0xdbc9('0x46')]['id']}},_0x1cd538={};_0x1cd538['model']=_['keys'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')]);_0x1cd538[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x2adb23[_0xdbc9('0x30')]);_0x1cd538[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x1cd538[_0xdbc9('0x34')],_0x1cd538[_0xdbc9('0x30')]);_0x3ed4de[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x1cd538['model'],qs['fields'](_0x2adb23[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x3ed4de[_0xdbc9('0x35')]=_0x3ed4de[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x3ed4de[_0xdbc9('0x35')]:_0x1cd538[_0xdbc9('0x34')];if(_0x2adb23[_0xdbc9('0x30')]['includeAll']){_0x3ed4de['include']=[{'all':!![]}];}_0x3ed4de=_[_0xdbc9('0x3c')]({},_0x3ed4de,_0x2adb23[_0xdbc9('0x40')]);return db[_0xdbc9('0x2b')][_0xdbc9('0x48')](_0x3ed4de)[_0xdbc9('0x25')](handleEntityNotFound(_0x3415c3,null))[_0xdbc9('0x25')](respondWithResult(_0x3415c3,null))[_0xdbc9('0x44')](handleError(_0x3415c3,null));};exports[_0xdbc9('0x49')]=function(_0x43e3ec,_0x589557){return db[_0xdbc9('0x2b')][_0xdbc9('0x49')](_0x43e3ec['body'],{})['then'](respondWithResult(_0x589557,0xc9))[_0xdbc9('0x44')](handleError(_0x589557,null));};exports[_0xdbc9('0x4a')]=function(_0x133a13,_0x49a55c){if(_0x133a13[_0xdbc9('0x4b')]['id']){delete _0x133a13[_0xdbc9('0x4b')]['id'];}return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x133a13['params']['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x49a55c,null))[_0xdbc9('0x25')](saveUpdates(_0x133a13[_0xdbc9('0x4b')],null))[_0xdbc9('0x25')](respondWithResult(_0x49a55c,null))['catch'](handleError(_0x49a55c,null));};exports[_0xdbc9('0x26')]=function(_0x36c70e,_0x3f49b7){return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x36c70e[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3f49b7,null))[_0xdbc9('0x25')](removeEntity(_0x3f49b7,null))['catch'](handleError(_0x3f49b7,null));};exports[_0xdbc9('0x4c')]=function(_0x4d09e1,_0x3f493e,_0x4279bc){var _0x53771a={};var _0x561737={};var _0xc7335d;var _0x4b55df;return db[_0xdbc9('0x2b')][_0xdbc9('0x4d')]({'where':{'id':_0x4d09e1[_0xdbc9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f493e,null))[_0xdbc9('0x25')](function(_0x1c52e6){if(_0x1c52e6){_0xc7335d=_0x1c52e6;_0x561737[_0xdbc9('0x34')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x4e')][_0xdbc9('0x2c')]);_0x561737[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x4d09e1['query']);_0x561737['filters']=_['intersection'](_0x561737[_0xdbc9('0x34')],_0x561737[_0xdbc9('0x30')]);_0x53771a[_0xdbc9('0x35')]=_['intersection'](_0x561737['model'],qs[_0xdbc9('0x36')](_0x4d09e1[_0xdbc9('0x30')]['fields']));_0x53771a['attributes']=_0x53771a[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x53771a[_0xdbc9('0x35')]:_0x561737[_0xdbc9('0x34')];_0x53771a[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x4d09e1['query'][_0xdbc9('0x39')]);_0x53771a[_0xdbc9('0x3a')]=qs[_0xdbc9('0x32')](_['pick'](_0x4d09e1[_0xdbc9('0x30')],_0x561737[_0xdbc9('0x32')]));if(_0x4d09e1[_0xdbc9('0x30')]['filter']){_0x53771a[_0xdbc9('0x3a')]=_['merge'](_0x53771a[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x53771a[_0xdbc9('0x35')],function(_0x26ed1c){var _0x148061={};_0x148061[_0x26ed1c]={'$like':'%'+_0x4d09e1[_0xdbc9('0x30')]['filter']+'%'};return _0x148061;})});}_0x53771a=_[_0xdbc9('0x3c')]({},_0x53771a,_0x4d09e1['options']);return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})[_0xdbc9('0x25')](function(_0x53fcd6){if(_0x53fcd6){_0x4b55df=_0x53fcd6[_0xdbc9('0x47')];if(!_0x4d09e1[_0xdbc9('0x30')]['hasOwnProperty']('nolimit')){_0x53771a[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x4d09e1[_0xdbc9('0x30')]['limit']);_0x53771a[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x4d09e1['query'][_0xdbc9('0x1e')]);}return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})['then'](function(_0x4876f9){if(_0x4876f9){return _0x4876f9?{'count':_0x4b55df,'rows':_0x4876f9}:null;}})[_0xdbc9('0x25')](respondWithResult(_0x3f493e,null))[_0xdbc9('0x44')](handleError(_0x3f493e,null));};exports[_0xdbc9('0x4f')]=function(_0xa8b4d9,_0x3e93d3,_0x14cbf4){if(_0xa8b4d9[_0xdbc9('0x4b')]['id']){delete _0xa8b4d9[_0xdbc9('0x4b')]['id'];}return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0xa8b4d9[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3e93d3,null))[_0xdbc9('0x25')](function(_0x38f7da){if(_0x38f7da){_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x50')]=_0x38f7da['id'];_0xa8b4d9[_0xdbc9('0x4b')]['Subjects']=integrations[_0xdbc9('0x51')](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9['body'][_0xdbc9('0x2d')]);_0xa8b4d9[_0xdbc9('0x4b')]['Descriptions']=integrations['getDescriptions'](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x2d')]);return db['ZendeskConfiguration'][_0xdbc9('0x49')](_0xa8b4d9[_0xdbc9('0x4b')],{'include':[{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x54')},{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x55')}]});}return null;})[_0xdbc9('0x25')](respondWithResult(_0x3e93d3,null))[_0xdbc9('0x44')](handleError(_0x3e93d3,null));};exports[_0xdbc9('0x56')]=function(_0x5e6522,_0x2787d9,_0x2c3223){var _0x511778='';return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0x5e6522[_0xdbc9('0x46')]['id']},'attributes':['id',_0xdbc9('0x57'),_0xdbc9('0x58'),_0xdbc9('0x59'),_0xdbc9('0x5a'),_0xdbc9('0x5b')]})['then'](handleEntityNotFound(_0x2787d9,null))[_0xdbc9('0x25')](function(_0x19af46){if(_0x19af46){_0x511778=_0x19af46[_0xdbc9('0x5b')];var _0x4a412e=_0x511778[_0xdbc9('0x5c')](-0x1);if(_0x4a412e==='/'){_0x511778=_0x511778[_0xdbc9('0x5d')](0x0,_0x511778[_0xdbc9('0x5e')](_0x4a412e));}var _0x2b4905={'method':_0xdbc9('0x5f'),'uri':util[_0xdbc9('0x60')](_0xdbc9('0x61'),_0x511778,_0xdbc9('0x62')),'json':!![]};switch(_0x19af46[_0xdbc9('0x5a')]){case _0xdbc9('0x58'):_0x2b4905[_0xdbc9('0x63')]={'Authorization':util[_0xdbc9('0x60')]('Basic\x20%s',new Buffer(util['format'](_0xdbc9('0x64'),_0x19af46['username'],_0x19af46['password']))[_0xdbc9('0x65')](_0xdbc9('0x66')))};break;case _0xdbc9('0x59'):_0x2b4905['headers']={'Authorization':util[_0xdbc9('0x60')](_0xdbc9('0x67'),new Buffer(util[_0xdbc9('0x60')]('%s/token:%s',_0x19af46[_0xdbc9('0x57')],_0x19af46[_0xdbc9('0x59')]))['toString'](_0xdbc9('0x66')))};break;default:throw new db[(_0xdbc9('0x68'))][(_0xdbc9('0x69'))](_0xdbc9('0x6a'));}return rp(_0x2b4905);}})[_0xdbc9('0x25')](function(_0x501754){if(_0x501754){var _0x4f984b=[_0xdbc9('0x6b'),_0xdbc9('0x6c'),'group',_0xdbc9('0x6d')];_[_0xdbc9('0x6e')](_0x501754[_0xdbc9('0x62')],function(_0x5802fc){return _0x4f984b[_0xdbc9('0x6f')](_0x5802fc[_0xdbc9('0x2d')]);});return{'count':_0x501754[_0xdbc9('0x62')][_0xdbc9('0x47')],'rows':_[_0xdbc9('0x3d')](_0x501754[_0xdbc9('0x62')],function(_0x1b053a){return{'id':_0x1b053a['id'],'name':_0x1b053a[_0xdbc9('0x70')]>0x7?_0x1b053a['title']:_0x1b053a[_0xdbc9('0x2d')],'custom':_0x1b053a[_0xdbc9('0x70')]>0x7?!![]:![],'options':_0x1b053a[_0xdbc9('0x71')]?_0x1b053a[_0xdbc9('0x71')]:_0x1b053a['custom_field_options']?_0x1b053a[_0xdbc9('0x72')]:[]};})};}})['then'](respondWithResult(_0x2787d9,null))['catch'](function(_0x34ebeb){var _0x3400d0=_0x5e6522['query'][_0xdbc9('0x73')]?0x1f4:_0x34ebeb[_0xdbc9('0x74')]||0x1f4;logger[_0xdbc9('0x27')](_0xdbc9('0x75'),_0xdbc9('0x56'),_0x3400d0,JSON[_0xdbc9('0x76')](_0x34ebeb));delete _0x34ebeb[_0xdbc9('0x2f')];if(_0x3400d0===0x191){_0x3400d0=0x190;}_0x2787d9['status'](_0x3400d0)['send'](_0x5e6522[_0xdbc9('0x30')][_0xdbc9('0x73')]?{'message':_0xdbc9('0x77'),'statusCode':_0x34ebeb['statusCode']}:_0x34ebeb);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 4787cad..1ee1cfe 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 _0x4e57=['../../config/environment','exports','ZendeskAccount','util','api','moment','path','rimraf'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x4e57,0x83));var _0x74e5=function(_0x5223b2,_0x3eff98){_0x5223b2=_0x5223b2-0x0;var _0x27ce44=_0x4e57[_0x5223b2];return _0x27ce44;};'use strict';var _=require('lodash');var util=require(_0x74e5('0x0'));var logger=require('../../config/logger')(_0x74e5('0x1'));var moment=require(_0x74e5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x74e5('0x3'));var rimraf=require(_0x74e5('0x4'));var config=require(_0x74e5('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x74e5('0x6')]=function(_0x2d661e,_0x300bc6){return _0x2d661e['define'](_0x74e5('0x7'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0010=['ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x59c233,_0xe0627e){var _0x26e0ef=function(_0x553d84){while(--_0x553d84){_0x59c233['push'](_0x59c233['shift']());}};_0x26e0ef(++_0xe0627e);}(_0x0010,0x14c));var _0x0001=function(_0x573325,_0x2f2fa5){_0x573325=_0x573325-0x0;var _0x1987bb=_0x0010[_0x573325];return _0x1987bb;};'use strict';var _=require(_0x0001('0x0'));var util=require(_0x0001('0x1'));var logger=require(_0x0001('0x2'))(_0x0001('0x3'));var moment=require(_0x0001('0x4'));var BPromise=require(_0x0001('0x5'));var rp=require(_0x0001('0x6'));var fs=require('fs');var path=require(_0x0001('0x7'));var rimraf=require(_0x0001('0x8'));var config=require('../../config/environment');var attributes=require(_0x0001('0x9'));var integrations=require(_0x0001('0xa'));module[_0x0001('0xb')]=function(_0x3a1d27,_0x3cbfa4){return _0x3a1d27[_0x0001('0xc')](_0x0001('0xd'),attributes,{'tableName':_0x0001('0xe'),'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 843fa6d..fa41cc8 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 _0x3afa=['GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','include','map','model','then','ShowZendeskAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xb4f377,_0xf9cd56){var _0x37d6b1=function(_0x579286){while(--_0x579286){_0xb4f377['push'](_0xb4f377['shift']());}};_0x37d6b1(++_0xf9cd56);}(_0x3afa,0xc6));var _0xa3af=function(_0x395bfe,_0x4db521){_0x395bfe=_0x395bfe-0x0;var _0x35c81c=_0x3afa[_0x395bfe];return _0x35c81c;};'use strict';var _=require(_0xa3af('0x0'));var util=require(_0xa3af('0x1'));var moment=require(_0xa3af('0x2'));var BPromise=require(_0xa3af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3af('0x4'));var db=require(_0xa3af('0x5'))['db'];var utils=require(_0xa3af('0x6'));var logger=require(_0xa3af('0x7'))(_0xa3af('0x8'));var config=require('../../config/environment');var jayson=require(_0xa3af('0x9'));var client=jayson[_0xa3af('0xa')][_0xa3af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf543fe,_0x54b51e,_0x15d40b){return new BPromise(function(_0x445275,_0x4e8ae9){return client[_0xa3af('0xc')](_0xf543fe,_0x15d40b)['then'](function(_0x1f0263){logger[_0xa3af('0xd')](_0xa3af('0xe'),_0x54b51e,_0xa3af('0xf'));logger[_0xa3af('0x10')](_0xa3af('0x11'),_0x54b51e,_0xa3af('0xf'),JSON[_0xa3af('0x12')](_0x1f0263));if(_0x1f0263[_0xa3af('0x13')]){if(_0x1f0263[_0xa3af('0x13')][_0xa3af('0x14')]===0x1f4){logger[_0xa3af('0x13')](_0xa3af('0xe'),_0x54b51e,_0x1f0263[_0xa3af('0x13')][_0xa3af('0x15')]);return _0x4e8ae9(_0x1f0263[_0xa3af('0x13')]['message']);}logger['error'](_0xa3af('0xe'),_0x54b51e,_0x1f0263[_0xa3af('0x13')][_0xa3af('0x15')]);return _0x445275(_0x1f0263[_0xa3af('0x13')]['message']);}else{logger[_0xa3af('0xd')](_0xa3af('0xe'),_0x54b51e,_0xa3af('0xf'));_0x445275(_0x1f0263[_0xa3af('0x16')][_0xa3af('0x15')]);}})[_0xa3af('0x17')](function(_0x1bff60){logger[_0xa3af('0x13')](_0xa3af('0xe'),_0x54b51e,_0x1bff60);_0x4e8ae9(_0x1bff60);});});}exports[_0xa3af('0x18')]=function(_0x7f9c75){var _0x5a88f1=this;return new Promise(function(_0x174b43,_0x596597){return db[_0xa3af('0x19')]['findAll']({'raw':_0x7f9c75['options']?_0x7f9c75[_0xa3af('0x1a')][_0xa3af('0x1b')]===undefined?!![]:![]:!![],'where':_0x7f9c75[_0xa3af('0x1a')]?_0x7f9c75[_0xa3af('0x1a')][_0xa3af('0x1c')]||null:null,'attributes':_0x7f9c75[_0xa3af('0x1a')]?_0x7f9c75[_0xa3af('0x1a')][_0xa3af('0x1d')]||null:null,'limit':_0x7f9c75[_0xa3af('0x1a')]?_0x7f9c75['options'][_0xa3af('0x1e')]||null:null,'include':_0x7f9c75[_0xa3af('0x1a')]?_0x7f9c75[_0xa3af('0x1a')][_0xa3af('0x1f')]?_[_0xa3af('0x20')](_0x7f9c75[_0xa3af('0x1a')][_0xa3af('0x1f')],function(_0x4d3a79){return{'model':db[_0x4d3a79[_0xa3af('0x21')]],'as':_0x4d3a79['as'],'attributes':_0x4d3a79[_0xa3af('0x1d')],'include':_0x4d3a79[_0xa3af('0x1f')]?_['map'](_0x4d3a79['include'],function(_0x29dc11){return{'model':db[_0x29dc11[_0xa3af('0x21')]],'as':_0x29dc11['as'],'attributes':_0x29dc11[_0xa3af('0x1d')],'include':_0x29dc11['include']?_['map'](_0x29dc11[_0xa3af('0x1f')],function(_0x1a76a3){return{'model':db[_0x1a76a3[_0xa3af('0x21')]],'as':_0x1a76a3['as'],'attributes':_0x1a76a3[_0xa3af('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa3af('0x22')](function(_0x126022){logger[_0xa3af('0xd')](_0xa3af('0x18'),_0x7f9c75);logger[_0xa3af('0x10')](_0xa3af('0x18'),_0x7f9c75,JSON[_0xa3af('0x12')](_0x126022));_0x174b43(_0x126022);})[_0xa3af('0x17')](function(_0x1c1d61){logger[_0xa3af('0x13')](_0xa3af('0x18'),_0x1c1d61[_0xa3af('0x15')],_0x7f9c75);_0x596597(_0x5a88f1[_0xa3af('0x13')](0x1f4,_0x1c1d61[_0xa3af('0x15')]));});});};exports[_0xa3af('0x23')]=function(_0x2b7595){var _0x397839=this;return new Promise(function(_0x31516c,_0xfba755){return db[_0xa3af('0x19')][_0xa3af('0x24')]({'raw':_0x2b7595[_0xa3af('0x1a')]?_0x2b7595['options'][_0xa3af('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b7595['options']?_0x2b7595[_0xa3af('0x1a')][_0xa3af('0x1c')]||null:null,'attributes':_0x2b7595['options']?_0x2b7595['options']['attributes']||null:null,'include':_0x2b7595[_0xa3af('0x1a')]?_0x2b7595[_0xa3af('0x1a')][_0xa3af('0x1f')]?_[_0xa3af('0x20')](_0x2b7595[_0xa3af('0x1a')][_0xa3af('0x1f')],function(_0x286abf){return{'model':db[_0x286abf[_0xa3af('0x21')]],'as':_0x286abf['as'],'attributes':_0x286abf['attributes'],'include':_0x286abf[_0xa3af('0x1f')]?_['map'](_0x286abf[_0xa3af('0x1f')],function(_0x15ab70){return{'model':db[_0x15ab70['model']],'as':_0x15ab70['as'],'attributes':_0x15ab70[_0xa3af('0x1d')],'include':_0x15ab70[_0xa3af('0x1f')]?_['map'](_0x15ab70[_0xa3af('0x1f')],function(_0x28e010){return{'model':db[_0x28e010[_0xa3af('0x21')]],'as':_0x28e010['as'],'attributes':_0x28e010[_0xa3af('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49e48b){logger[_0xa3af('0xd')](_0xa3af('0x23'),_0x2b7595);logger[_0xa3af('0x10')](_0xa3af('0x23'),_0x2b7595,JSON[_0xa3af('0x12')](_0x49e48b));_0x31516c(_0x49e48b);})[_0xa3af('0x17')](function(_0x155539){logger[_0xa3af('0x13')](_0xa3af('0x23'),_0x155539[_0xa3af('0x15')],_0x2b7595);_0xfba755(_0x397839[_0xa3af('0x13')](0x1f4,_0x155539[_0xa3af('0x15')]));});});}; \ No newline at end of file +var _0xa0ac=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','debug','ShowZendeskAccount','ZendeskAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xa0ac,0xd1));var _0xca0a=function(_0x44786c,_0x23e0a0){_0x44786c=_0x44786c-0x0;var _0x295777=_0xa0ac[_0x44786c];return _0x295777;};'use strict';var _=require(_0xca0a('0x0'));var util=require(_0xca0a('0x1'));var moment=require(_0xca0a('0x2'));var BPromise=require(_0xca0a('0x3'));var rs=require(_0xca0a('0x4'));var fs=require('fs');var Redis=require(_0xca0a('0x5'));var db=require(_0xca0a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xca0a('0x7'))(_0xca0a('0x8'));var config=require(_0xca0a('0x9'));var jayson=require(_0xca0a('0xa'));var client=jayson[_0xca0a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x351113,_0x12bb2a,_0x4dcdeb){return new BPromise(function(_0x2d90ed,_0x33a713){return client['request'](_0x351113,_0x4dcdeb)[_0xca0a('0xc')](function(_0x27ea9f){logger[_0xca0a('0xd')](_0xca0a('0xe'),_0x12bb2a,_0xca0a('0xf'));logger['debug'](_0xca0a('0x10'),_0x12bb2a,'request\x20sent',JSON[_0xca0a('0x11')](_0x27ea9f));if(_0x27ea9f['error']){if(_0x27ea9f[_0xca0a('0x12')][_0xca0a('0x13')]===0x1f4){logger[_0xca0a('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x12bb2a,_0x27ea9f[_0xca0a('0x12')][_0xca0a('0x14')]);return _0x33a713(_0x27ea9f['error'][_0xca0a('0x14')]);}logger[_0xca0a('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x12bb2a,_0x27ea9f[_0xca0a('0x12')][_0xca0a('0x14')]);return _0x2d90ed(_0x27ea9f[_0xca0a('0x12')][_0xca0a('0x14')]);}else{logger[_0xca0a('0xd')](_0xca0a('0xe'),_0x12bb2a,_0xca0a('0xf'));_0x2d90ed(_0x27ea9f[_0xca0a('0x15')]['message']);}})[_0xca0a('0x16')](function(_0x2d823a){logger['error'](_0xca0a('0xe'),_0x12bb2a,_0x2d823a);_0x33a713(_0x2d823a);});});}exports[_0xca0a('0x17')]=function(_0x5ca14f){var _0x157c4e=this;return new Promise(function(_0x56844d,_0x20dd07){return db['ZendeskAccount'][_0xca0a('0x18')]({'raw':_0x5ca14f[_0xca0a('0x19')]?_0x5ca14f[_0xca0a('0x19')][_0xca0a('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ca14f[_0xca0a('0x19')]?_0x5ca14f[_0xca0a('0x19')]['where']||null:null,'attributes':_0x5ca14f[_0xca0a('0x19')]?_0x5ca14f[_0xca0a('0x19')][_0xca0a('0x1b')]||null:null,'limit':_0x5ca14f[_0xca0a('0x19')]?_0x5ca14f['options'][_0xca0a('0x1c')]||null:null,'include':_0x5ca14f[_0xca0a('0x19')]?_0x5ca14f[_0xca0a('0x19')][_0xca0a('0x1d')]?_[_0xca0a('0x1e')](_0x5ca14f[_0xca0a('0x19')][_0xca0a('0x1d')],function(_0x3d4ecb){return{'model':db[_0x3d4ecb[_0xca0a('0x1f')]],'as':_0x3d4ecb['as'],'attributes':_0x3d4ecb[_0xca0a('0x1b')],'include':_0x3d4ecb[_0xca0a('0x1d')]?_[_0xca0a('0x1e')](_0x3d4ecb[_0xca0a('0x1d')],function(_0x5c0267){return{'model':db[_0x5c0267['model']],'as':_0x5c0267['as'],'attributes':_0x5c0267['attributes'],'include':_0x5c0267['include']?_[_0xca0a('0x1e')](_0x5c0267[_0xca0a('0x1d')],function(_0x1ab022){return{'model':db[_0x1ab022[_0xca0a('0x1f')]],'as':_0x1ab022['as'],'attributes':_0x1ab022['attributes']};}):[]};}):[]};}):[]:[]})[_0xca0a('0xc')](function(_0x16dcd2){logger[_0xca0a('0xd')](_0xca0a('0x17'),_0x5ca14f);logger[_0xca0a('0x20')]('GetZendeskAccount',_0x5ca14f,JSON[_0xca0a('0x11')](_0x16dcd2));_0x56844d(_0x16dcd2);})[_0xca0a('0x16')](function(_0x1c3134){logger['error']('GetZendeskAccount',_0x1c3134[_0xca0a('0x14')],_0x5ca14f);_0x20dd07(_0x157c4e['error'](0x1f4,_0x1c3134[_0xca0a('0x14')]));});});};exports[_0xca0a('0x21')]=function(_0x5902b8){var _0x3caafe=this;return new Promise(function(_0x5a7ff8,_0x48d1b8){return db[_0xca0a('0x22')]['find']({'raw':_0x5902b8[_0xca0a('0x19')]?_0x5902b8[_0xca0a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5902b8[_0xca0a('0x19')]?_0x5902b8[_0xca0a('0x19')][_0xca0a('0x23')]||null:null,'attributes':_0x5902b8[_0xca0a('0x19')]?_0x5902b8[_0xca0a('0x19')][_0xca0a('0x1b')]||null:null,'include':_0x5902b8[_0xca0a('0x19')]?_0x5902b8['options'][_0xca0a('0x1d')]?_['map'](_0x5902b8[_0xca0a('0x19')][_0xca0a('0x1d')],function(_0x290a56){return{'model':db[_0x290a56[_0xca0a('0x1f')]],'as':_0x290a56['as'],'attributes':_0x290a56[_0xca0a('0x1b')],'include':_0x290a56['include']?_[_0xca0a('0x1e')](_0x290a56['include'],function(_0x4007e3){return{'model':db[_0x4007e3[_0xca0a('0x1f')]],'as':_0x4007e3['as'],'attributes':_0x4007e3[_0xca0a('0x1b')],'include':_0x4007e3[_0xca0a('0x1d')]?_[_0xca0a('0x1e')](_0x4007e3[_0xca0a('0x1d')],function(_0x23cae9){return{'model':db[_0x23cae9[_0xca0a('0x1f')]],'as':_0x23cae9['as'],'attributes':_0x23cae9['attributes']};}):[]};}):[]};}):[]:[]})[_0xca0a('0xc')](function(_0x24cdd0){logger[_0xca0a('0xd')](_0xca0a('0x21'),_0x5902b8);logger[_0xca0a('0x20')](_0xca0a('0x21'),_0x5902b8,JSON[_0xca0a('0x11')](_0x24cdd0));_0x5a7ff8(_0x24cdd0);})[_0xca0a('0x16')](function(_0x1f1339){logger[_0xca0a('0x12')]('ShowZendeskAccount',_0x1f1339[_0xca0a('0x14')],_0x5902b8);_0x48d1b8(_0x3caafe[_0xca0a('0x12')](0x1f4,_0x1f1339[_0xca0a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index c01f3bc..52d97b0 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 _0x4483=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x2262f5,_0x5a409f){var _0x25fc8c=function(_0x48c10a){while(--_0x48c10a){_0x2262f5['push'](_0x2262f5['shift']());}};_0x25fc8c(++_0x5a409f);}(_0x4483,0x1a3));var _0x3448=function(_0x3343d3,_0x4c40da){_0x3343d3=_0x3343d3-0x0;var _0xe4de4f=_0x4483[_0x3343d3];return _0xe4de4f;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/fields',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3448('0x13')]);router[_0x3448('0x14')]('/',auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x14')](_0x3448('0x16'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);router[_0x3448('0x18')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x19')]);router[_0x3448('0x1a')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x1b')]);module[_0x3448('0x1c')]=router; \ No newline at end of file +var _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x42aca0,_0x35c4fb){var _0x14a952=function(_0x5bde7d){while(--_0x5bde7d){_0x42aca0['push'](_0x42aca0['shift']());}};_0x14a952(++_0x35c4fb);}(_0x757a,0xde));var _0xa757=function(_0x26f39f,_0x3b5d08){_0x26f39f=_0x26f39f-0x0;var _0x3f59c7=_0x757a[_0x26f39f];return _0x3f59c7;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 3ac57bb..3a0138f 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 _0xc280=['STRING','exports'];(function(_0x54b211,_0x12e6ed){var _0xd65f7=function(_0x341227){while(--_0x341227){_0x54b211['push'](_0x54b211['shift']());}};_0xd65f7(++_0x12e6ed);}(_0xc280,0x157));var _0x0c28=function(_0x172432,_0x4a43f0){_0x172432=_0x172432-0x0;var _0x4e6087=_0xc280[_0x172432];return _0x4e6087;};'use strict';var Sequelize=require('sequelize');module[_0x0c28('0x0')]={'name':{'type':Sequelize[_0x0c28('0x1')]},'description':{'type':Sequelize[_0x0c28('0x1')]}}; \ No newline at end of file +var _0x588d=['sequelize','exports'];(function(_0x3b115c,_0x385399){var _0xf93154=function(_0x6e17d5){while(--_0x6e17d5){_0x3b115c['push'](_0x3b115c['shift']());}};_0xf93154(++_0x385399);}(_0x588d,0x190));var _0xd588=function(_0x22a769,_0x11015f){_0x22a769=_0x22a769-0x0;var _0x4079e4=_0x588d[_0x22a769];return _0x4079e4;};'use strict';var Sequelize=require(_0xd588('0x0'));module[_0xd588('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 32c4be2..3ef216f 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 _0x24b4=['options','includeAll','include','findAll','catch','show','params','find','create','body','getFields','findOne','ZendeskField','intersection','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','apply','reject','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x4563d0,_0x4f2cb0){var _0x27ea6b=function(_0x1e88c7){while(--_0x1e88c7){_0x4563d0['push'](_0x4563d0['shift']());}};_0x27ea6b(++_0x4f2cb0);}(_0x24b4,0x1a9));var _0x424b=function(_0x1ba54a,_0x500f2f){_0x1ba54a=_0x1ba54a-0x0;var _0x291a97=_0x24b4[_0x1ba54a];return _0x291a97;};'use strict';var emlformat=require(_0x424b('0x0'));var rimraf=require(_0x424b('0x1'));var zipdir=require(_0x424b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x424b('0x3'));var BPromise=require(_0x424b('0x4'));var Mustache=require('mustache');var util=require(_0x424b('0x5'));var path=require('path');var sox=require(_0x424b('0x6'));var csv=require(_0x424b('0x7'));var ejs=require(_0x424b('0x8'));var fs=require('fs');var fs_extra=require(_0x424b('0x9'));var _=require(_0x424b('0xa'));var squel=require(_0x424b('0xb'));var crypto=require(_0x424b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x424b('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x424b('0xd'));var authService=require(_0x424b('0xe'));var qs=require(_0x424b('0xf'));var as=require(_0x424b('0x10'));var hardwareService=require(_0x424b('0x11'));var logger=require(_0x424b('0x12'))(_0x424b('0x13'));var utils=require(_0x424b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x424b('0x15'));var db=require(_0x424b('0x16'))['db'];function respondWithStatusCode(_0x567caf,_0x5c7c20){_0x5c7c20=_0x5c7c20||0xcc;return function(_0x26a57c){if(_0x26a57c){return _0x567caf['sendStatus'](_0x5c7c20);}return _0x567caf[_0x424b('0x17')](_0x5c7c20)['end']();};}function respondWithResult(_0x318ace,_0x3587f7){_0x3587f7=_0x3587f7||0xc8;return function(_0x52fbc4){if(_0x52fbc4){return _0x318ace[_0x424b('0x17')](_0x3587f7)[_0x424b('0x18')](_0x52fbc4);}};}function respondWithFilteredResult(_0x213c0a,_0x4fa64b){return function(_0x2fb67a){if(_0x2fb67a){var _0x36df6e=typeof _0x4fa64b['offset']===_0x424b('0x19')&&typeof _0x4fa64b[_0x424b('0x1a')]===_0x424b('0x19');var _0x5835e6=_0x2fb67a['count'];var _0x13eac2=_0x36df6e?0x0:_0x4fa64b['offset'];var _0x39d108=_0x36df6e?_0x2fb67a[_0x424b('0x1b')]:_0x4fa64b[_0x424b('0x1c')]+_0x4fa64b[_0x424b('0x1a')];var _0x556f08;if(_0x39d108>=_0x5835e6){_0x39d108=_0x5835e6;_0x556f08=0xc8;}else{_0x556f08=0xce;}_0x213c0a[_0x424b('0x17')](_0x556f08);return _0x213c0a['set']('Content-Range',_0x13eac2+'-'+_0x39d108+'/'+_0x5835e6)[_0x424b('0x18')](_0x2fb67a);}return null;};}function patchUpdates(_0x5c1525){return function(_0x24c7fc){try{jsonpatch[_0x424b('0x1d')](_0x24c7fc,_0x5c1525,!![]);}catch(_0x56a707){return BPromise[_0x424b('0x1e')](_0x56a707);}return _0x24c7fc['save']();};}function saveUpdates(_0xc2541b,_0x2de3b5){return function(_0x413741){if(_0x413741){return _0x413741[_0x424b('0x1f')](_0xc2541b)['then'](function(_0x2fdc57){return _0x2fdc57;});}return null;};}function removeEntity(_0x5079de,_0x36787e){return function(_0xc96033){if(_0xc96033){return _0xc96033[_0x424b('0x20')]()[_0x424b('0x21')](function(){_0x5079de['status'](0xcc)[_0x424b('0x22')]();});}};}function handleEntityNotFound(_0x541bd9,_0x1e54c0){return function(_0x5d76b6){if(!_0x5d76b6){_0x541bd9[_0x424b('0x23')](0x194);}return _0x5d76b6;};}function handleError(_0x4758a4,_0x4e4910){_0x4e4910=_0x4e4910||0x1f4;return function(_0x371a69){logger[_0x424b('0x24')](_0x371a69[_0x424b('0x25')]);if(_0x371a69[_0x424b('0x26')]){delete _0x371a69[_0x424b('0x26')];}_0x4758a4['status'](_0x4e4910)[_0x424b('0x27')](_0x371a69);};}exports[_0x424b('0x28')]=function(_0x48ff9b,_0xc4e142){var _0x1acfd4={},_0x4e6b27={},_0x267693={'count':0x0,'rows':[]};var _0x4bfa63=_[_0x424b('0x29')](db[_0x424b('0x2a')][_0x424b('0x2b')],function(_0x1249c0){return{'name':_0x1249c0[_0x424b('0x2c')],'type':_0x1249c0['type'][_0x424b('0x2d')]};});_0x4e6b27[_0x424b('0x2e')]=_['map'](_0x4bfa63,_0x424b('0x26'));_0x4e6b27[_0x424b('0x2f')]=_[_0x424b('0x30')](_0x48ff9b['query']);_0x4e6b27['filters']=_['intersection'](_0x4e6b27['model'],_0x4e6b27[_0x424b('0x2f')]);_0x1acfd4[_0x424b('0x31')]=_['intersection'](_0x4e6b27[_0x424b('0x2e')],qs[_0x424b('0x32')](_0x48ff9b[_0x424b('0x2f')][_0x424b('0x32')]));_0x1acfd4[_0x424b('0x31')]=_0x1acfd4[_0x424b('0x31')][_0x424b('0x33')]?_0x1acfd4[_0x424b('0x31')]:_0x4e6b27[_0x424b('0x2e')];if(!_0x48ff9b[_0x424b('0x2f')][_0x424b('0x34')]('nolimit')){_0x1acfd4[_0x424b('0x1a')]=qs[_0x424b('0x1a')](_0x48ff9b['query'][_0x424b('0x1a')]);_0x1acfd4['offset']=qs['offset'](_0x48ff9b[_0x424b('0x2f')][_0x424b('0x1c')]);}_0x1acfd4[_0x424b('0x35')]=qs[_0x424b('0x36')](_0x48ff9b[_0x424b('0x2f')]['sort']);_0x1acfd4[_0x424b('0x37')]=qs[_0x424b('0x38')](_[_0x424b('0x39')](_0x48ff9b[_0x424b('0x2f')],_0x4e6b27['filters']),_0x4bfa63);if(_0x48ff9b['query'][_0x424b('0x3a')]){_0x1acfd4[_0x424b('0x37')]=_[_0x424b('0x3b')](_0x1acfd4['where'],{'$or':_['map'](_0x4bfa63,function(_0x1e2d33){if(_0x1e2d33['type']!==_0x424b('0x3c')){var _0x55b87a={};_0x55b87a[_0x1e2d33[_0x424b('0x26')]]={'$like':'%'+_0x48ff9b['query']['filter']+'%'};return _0x55b87a;}})});}_0x1acfd4=_[_0x424b('0x3b')]({},_0x1acfd4,_0x48ff9b[_0x424b('0x3d')]);var _0x308e13={'where':_0x1acfd4['where']};return db['ZendeskConfiguration']['count'](_0x308e13)['then'](function(_0x38c457){_0x267693[_0x424b('0x1b')]=_0x38c457;if(_0x48ff9b['query'][_0x424b('0x3e')]){_0x1acfd4[_0x424b('0x3f')]=[{'all':!![]}];}return db[_0x424b('0x2a')][_0x424b('0x40')](_0x1acfd4);})[_0x424b('0x21')](function(_0x51ceff){_0x267693['rows']=_0x51ceff;return _0x267693;})['then'](respondWithFilteredResult(_0xc4e142,_0x1acfd4))[_0x424b('0x41')](handleError(_0xc4e142,null));};exports[_0x424b('0x42')]=function(_0xa10d65,_0x43c033){var _0x116399={'raw':![],'where':{'id':_0xa10d65[_0x424b('0x43')]['id']}},_0x5d3346={};_0x5d3346[_0x424b('0x2e')]=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x5d3346['query']=_[_0x424b('0x30')](_0xa10d65[_0x424b('0x2f')]);_0x5d3346[_0x424b('0x38')]=_['intersection'](_0x5d3346['model'],_0x5d3346[_0x424b('0x2f')]);_0x116399[_0x424b('0x31')]=_['intersection'](_0x5d3346[_0x424b('0x2e')],qs[_0x424b('0x32')](_0xa10d65['query']['fields']));_0x116399[_0x424b('0x31')]=_0x116399[_0x424b('0x31')][_0x424b('0x33')]?_0x116399['attributes']:_0x5d3346[_0x424b('0x2e')];if(_0xa10d65[_0x424b('0x2f')][_0x424b('0x3e')]){_0x116399[_0x424b('0x3f')]=[{'all':!![]}];}_0x116399=_[_0x424b('0x3b')]({},_0x116399,_0xa10d65[_0x424b('0x3d')]);return db[_0x424b('0x2a')][_0x424b('0x44')](_0x116399)['then'](handleEntityNotFound(_0x43c033,null))[_0x424b('0x21')](respondWithResult(_0x43c033,null))[_0x424b('0x41')](handleError(_0x43c033,null));};exports[_0x424b('0x45')]=function(_0x17e703,_0x4d85a1){return db['ZendeskConfiguration']['create'](_0x17e703[_0x424b('0x46')],{})[_0x424b('0x21')](respondWithResult(_0x4d85a1,0xc9))[_0x424b('0x41')](handleError(_0x4d85a1,null));};exports[_0x424b('0x1f')]=function(_0x634652,_0x5a41b6){if(_0x634652['body']['id']){delete _0x634652['body']['id'];}return db['ZendeskConfiguration'][_0x424b('0x44')]({'where':{'id':_0x634652[_0x424b('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a41b6,null))[_0x424b('0x21')](saveUpdates(_0x634652['body'],null))[_0x424b('0x21')](respondWithResult(_0x5a41b6,null))[_0x424b('0x41')](handleError(_0x5a41b6,null));};exports['destroy']=function(_0x4f30c0,_0x19610c){return db[_0x424b('0x2a')][_0x424b('0x44')]({'where':{'id':_0x4f30c0[_0x424b('0x43')]['id']}})[_0x424b('0x21')](handleEntityNotFound(_0x19610c,null))['then'](removeEntity(_0x19610c,null))['catch'](handleError(_0x19610c,null));};exports[_0x424b('0x47')]=function(_0x2730d7,_0xa3195a,_0x141ab1){var _0x43df15={};var _0x595f58={};var _0x2c375f;var _0x391002;return db['ZendeskConfiguration'][_0x424b('0x48')]({'where':{'id':_0x2730d7[_0x424b('0x43')]['id']}})[_0x424b('0x21')](handleEntityNotFound(_0xa3195a,null))[_0x424b('0x21')](function(_0x39eab8){if(_0x39eab8){_0x2c375f=_0x39eab8;_0x595f58['model']=_[_0x424b('0x30')](db[_0x424b('0x49')][_0x424b('0x2b')]);_0x595f58['query']=_[_0x424b('0x30')](_0x2730d7[_0x424b('0x2f')]);_0x595f58[_0x424b('0x38')]=_[_0x424b('0x4a')](_0x595f58[_0x424b('0x2e')],_0x595f58[_0x424b('0x2f')]);_0x43df15['attributes']=_[_0x424b('0x4a')](_0x595f58[_0x424b('0x2e')],qs[_0x424b('0x32')](_0x2730d7[_0x424b('0x2f')][_0x424b('0x32')]));_0x43df15[_0x424b('0x31')]=_0x43df15[_0x424b('0x31')]['length']?_0x43df15['attributes']:_0x595f58['model'];_0x43df15['order']=qs[_0x424b('0x36')](_0x2730d7[_0x424b('0x2f')]['sort']);_0x43df15['where']=qs[_0x424b('0x38')](_[_0x424b('0x39')](_0x2730d7[_0x424b('0x2f')],_0x595f58[_0x424b('0x38')]));if(_0x2730d7['query'][_0x424b('0x3a')]){_0x43df15[_0x424b('0x37')]=_[_0x424b('0x3b')](_0x43df15['where'],{'$or':_[_0x424b('0x29')](_0x43df15[_0x424b('0x31')],function(_0x3a161d){var _0x282f85={};_0x282f85[_0x3a161d]={'$like':'%'+_0x2730d7['query'][_0x424b('0x3a')]+'%'};return _0x282f85;})});}_0x43df15=_[_0x424b('0x3b')]({},_0x43df15,_0x2730d7[_0x424b('0x3d')]);return _0x2c375f[_0x424b('0x47')](_0x43df15);}})['then'](function(_0x42905b){if(_0x42905b){_0x391002=_0x42905b['length'];if(!_0x2730d7[_0x424b('0x2f')]['hasOwnProperty'](_0x424b('0x4b'))){_0x43df15[_0x424b('0x1a')]=qs[_0x424b('0x1a')](_0x2730d7[_0x424b('0x2f')][_0x424b('0x1a')]);_0x43df15[_0x424b('0x1c')]=qs[_0x424b('0x1c')](_0x2730d7['query'][_0x424b('0x1c')]);}return _0x2c375f[_0x424b('0x47')](_0x43df15);}})[_0x424b('0x21')](function(_0x2c641b){if(_0x2c641b){return _0x2c641b?{'count':_0x391002,'rows':_0x2c641b}:null;}})[_0x424b('0x21')](respondWithResult(_0xa3195a,null))[_0x424b('0x41')](handleError(_0xa3195a,null));};exports['getSubjects']=function(_0x1ffee4,_0x2e1619,_0x424f20){var _0x2dcfbb={};var _0x6ddd0a={};var _0x1593a3;var _0x3c27e6;return db[_0x424b('0x2a')][_0x424b('0x48')]({'where':{'id':_0x1ffee4[_0x424b('0x43')]['id']}})[_0x424b('0x21')](handleEntityNotFound(_0x2e1619,null))['then'](function(_0xaf33cc){if(_0xaf33cc){_0x1593a3=_0xaf33cc;_0x6ddd0a[_0x424b('0x2e')]=_[_0x424b('0x30')](db[_0x424b('0x49')]['rawAttributes']);_0x6ddd0a['query']=_[_0x424b('0x30')](_0x1ffee4['query']);_0x6ddd0a['filters']=_[_0x424b('0x4a')](_0x6ddd0a[_0x424b('0x2e')],_0x6ddd0a[_0x424b('0x2f')]);_0x2dcfbb[_0x424b('0x31')]=_[_0x424b('0x4a')](_0x6ddd0a[_0x424b('0x2e')],qs['fields'](_0x1ffee4[_0x424b('0x2f')]['fields']));_0x2dcfbb[_0x424b('0x31')]=_0x2dcfbb[_0x424b('0x31')][_0x424b('0x33')]?_0x2dcfbb[_0x424b('0x31')]:_0x6ddd0a[_0x424b('0x2e')];_0x2dcfbb[_0x424b('0x35')]=qs[_0x424b('0x36')](_0x1ffee4['query']['sort']);_0x2dcfbb[_0x424b('0x37')]=qs[_0x424b('0x38')](_['pick'](_0x1ffee4[_0x424b('0x2f')],_0x6ddd0a['filters']));if(_0x1ffee4[_0x424b('0x2f')]['filter']){_0x2dcfbb[_0x424b('0x37')]=_[_0x424b('0x3b')](_0x2dcfbb[_0x424b('0x37')],{'$or':_[_0x424b('0x29')](_0x2dcfbb[_0x424b('0x31')],function(_0x30b376){var _0xd58f1a={};_0xd58f1a[_0x30b376]={'$like':'%'+_0x1ffee4[_0x424b('0x2f')][_0x424b('0x3a')]+'%'};return _0xd58f1a;})});}_0x2dcfbb=_[_0x424b('0x3b')]({},_0x2dcfbb,_0x1ffee4[_0x424b('0x3d')]);return _0x1593a3[_0x424b('0x4c')](_0x2dcfbb);}})[_0x424b('0x21')](function(_0x5b628d){if(_0x5b628d){_0x3c27e6=_0x5b628d[_0x424b('0x33')];if(!_0x1ffee4[_0x424b('0x2f')][_0x424b('0x34')](_0x424b('0x4b'))){_0x2dcfbb[_0x424b('0x1a')]=qs['limit'](_0x1ffee4[_0x424b('0x2f')]['limit']);_0x2dcfbb[_0x424b('0x1c')]=qs[_0x424b('0x1c')](_0x1ffee4[_0x424b('0x2f')][_0x424b('0x1c')]);}return _0x1593a3[_0x424b('0x4c')](_0x2dcfbb);}})[_0x424b('0x21')](function(_0x32acc9){if(_0x32acc9){return _0x32acc9?{'count':_0x3c27e6,'rows':_0x32acc9}:null;}})[_0x424b('0x21')](respondWithResult(_0x2e1619,null))[_0x424b('0x41')](handleError(_0x2e1619,null));};exports['getDescriptions']=function(_0x318496,_0x5ec1c0,_0x31e3d4){var _0x4756ce={};var _0x420886={};var _0x1f8148;var _0x2919fc;return db[_0x424b('0x2a')][_0x424b('0x48')]({'where':{'id':_0x318496['params']['id']}})[_0x424b('0x21')](handleEntityNotFound(_0x5ec1c0,null))[_0x424b('0x21')](function(_0x24782d){if(_0x24782d){_0x1f8148=_0x24782d;_0x420886[_0x424b('0x2e')]=_['keys'](db[_0x424b('0x49')][_0x424b('0x2b')]);_0x420886[_0x424b('0x2f')]=_[_0x424b('0x30')](_0x318496[_0x424b('0x2f')]);_0x420886[_0x424b('0x38')]=_[_0x424b('0x4a')](_0x420886['model'],_0x420886[_0x424b('0x2f')]);_0x4756ce['attributes']=_[_0x424b('0x4a')](_0x420886[_0x424b('0x2e')],qs[_0x424b('0x32')](_0x318496['query']['fields']));_0x4756ce[_0x424b('0x31')]=_0x4756ce[_0x424b('0x31')][_0x424b('0x33')]?_0x4756ce[_0x424b('0x31')]:_0x420886[_0x424b('0x2e')];_0x4756ce[_0x424b('0x35')]=qs[_0x424b('0x36')](_0x318496[_0x424b('0x2f')][_0x424b('0x36')]);_0x4756ce[_0x424b('0x37')]=qs[_0x424b('0x38')](_[_0x424b('0x39')](_0x318496[_0x424b('0x2f')],_0x420886['filters']));if(_0x318496[_0x424b('0x2f')]['filter']){_0x4756ce[_0x424b('0x37')]=_['merge'](_0x4756ce[_0x424b('0x37')],{'$or':_[_0x424b('0x29')](_0x4756ce[_0x424b('0x31')],function(_0x122367){var _0x7bff2c={};_0x7bff2c[_0x122367]={'$like':'%'+_0x318496[_0x424b('0x2f')][_0x424b('0x3a')]+'%'};return _0x7bff2c;})});}_0x4756ce=_['merge']({},_0x4756ce,_0x318496[_0x424b('0x3d')]);return _0x1f8148['getDescriptions'](_0x4756ce);}})[_0x424b('0x21')](function(_0x4b7730){if(_0x4b7730){_0x2919fc=_0x4b7730[_0x424b('0x33')];if(!_0x318496[_0x424b('0x2f')][_0x424b('0x34')]('nolimit')){_0x4756ce[_0x424b('0x1a')]=qs[_0x424b('0x1a')](_0x318496[_0x424b('0x2f')][_0x424b('0x1a')]);_0x4756ce[_0x424b('0x1c')]=qs[_0x424b('0x1c')](_0x318496[_0x424b('0x2f')][_0x424b('0x1c')]);}return _0x1f8148[_0x424b('0x4d')](_0x4756ce);}})[_0x424b('0x21')](function(_0xacae53){if(_0xacae53){return _0xacae53?{'count':_0x2919fc,'rows':_0xacae53}:null;}})['then'](respondWithResult(_0x5ec1c0,null))[_0x424b('0x41')](handleError(_0x5ec1c0,null));};exports[_0x424b('0x4e')]=function(_0x598f2b,_0x5fc099,_0x198047){var _0x5c5666={};var _0x1183b5={};var _0x13877e;var _0x83fa59;return db['ZendeskConfiguration'][_0x424b('0x48')]({'where':{'id':_0x598f2b[_0x424b('0x43')]['id']}})[_0x424b('0x21')](handleEntityNotFound(_0x5fc099,null))[_0x424b('0x21')](function(_0x40103b){if(_0x40103b){_0x13877e=_0x40103b;_0x1183b5[_0x424b('0x2e')]=_[_0x424b('0x30')](db['Tag']['rawAttributes']);_0x1183b5['query']=_['keys'](_0x598f2b[_0x424b('0x2f')]);_0x1183b5['filters']=_[_0x424b('0x4a')](_0x1183b5[_0x424b('0x2e')],_0x1183b5[_0x424b('0x2f')]);_0x5c5666[_0x424b('0x31')]=_[_0x424b('0x4a')](_0x1183b5['model'],qs[_0x424b('0x32')](_0x598f2b['query']['fields']));_0x5c5666[_0x424b('0x31')]=_0x5c5666[_0x424b('0x31')][_0x424b('0x33')]?_0x5c5666[_0x424b('0x31')]:_0x1183b5[_0x424b('0x2e')];_0x5c5666[_0x424b('0x35')]=qs[_0x424b('0x36')](_0x598f2b['query']['sort']);_0x5c5666[_0x424b('0x37')]=qs[_0x424b('0x38')](_[_0x424b('0x39')](_0x598f2b[_0x424b('0x2f')],_0x1183b5['filters']));if(_0x598f2b[_0x424b('0x2f')]['filter']){_0x5c5666[_0x424b('0x37')]=_[_0x424b('0x3b')](_0x5c5666[_0x424b('0x37')],{'$or':_[_0x424b('0x29')](_0x5c5666['attributes'],function(_0x4da1b3){var _0x2c5f71={};_0x2c5f71[_0x4da1b3]={'$like':'%'+_0x598f2b['query']['filter']+'%'};return _0x2c5f71;})});}_0x5c5666=_['merge']({},_0x5c5666,_0x598f2b[_0x424b('0x3d')]);return _0x13877e['getTags'](_0x5c5666);}})[_0x424b('0x21')](function(_0x511a78){if(_0x511a78){_0x83fa59=_0x511a78[_0x424b('0x33')];if(!_0x598f2b[_0x424b('0x2f')][_0x424b('0x34')](_0x424b('0x4b'))){_0x5c5666[_0x424b('0x1a')]=qs['limit'](_0x598f2b['query'][_0x424b('0x1a')]);_0x5c5666[_0x424b('0x1c')]=qs['offset'](_0x598f2b['query']['offset']);}return _0x13877e[_0x424b('0x4e')](_0x5c5666);}})[_0x424b('0x21')](function(_0x24aee4){if(_0x24aee4){return _0x24aee4?{'count':_0x83fa59,'rows':_0x24aee4}:null;}})[_0x424b('0x21')](respondWithResult(_0x5fc099,null))[_0x424b('0x41')](handleError(_0x5fc099,null));};exports[_0x424b('0x4f')]=function(_0x254a2c,_0x19e9a4,_0x325277){if(_0x254a2c[_0x424b('0x46')]['id']){delete _0x254a2c[_0x424b('0x46')]['id'];}return db[_0x424b('0x2a')]['findOne']({'where':{'id':_0x254a2c[_0x424b('0x43')]['id']}})[_0x424b('0x21')](handleEntityNotFound(_0x19e9a4,null))[_0x424b('0x21')](function(_0x404f94){if(_0x404f94){return _0x404f94[_0x424b('0x4f')](_0x254a2c['body'][_0x424b('0x50')]||[]);}return null;})[_0x424b('0x21')](respondWithResult(_0x19e9a4,null))['catch'](handleError(_0x19e9a4,null));}; \ No newline at end of file +var _0x2e75=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','offset','limit','count','json','save','update','then','destroy','sendStatus','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x2e75,0x13f));var _0x52e7=function(_0xd9d196,_0x232395){_0xd9d196=_0xd9d196-0x0;var _0x5eba3f=_0x2e75[_0xd9d196];return _0x5eba3f;};'use strict';var emlformat=require(_0x52e7('0x0'));var rimraf=require(_0x52e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x52e7('0x2'));var Mustache=require(_0x52e7('0x3'));var util=require(_0x52e7('0x4'));var path=require('path');var sox=require(_0x52e7('0x5'));var csv=require(_0x52e7('0x6'));var ejs=require(_0x52e7('0x7'));var fs=require('fs');var fs_extra=require(_0x52e7('0x8'));var _=require('lodash');var squel=require(_0x52e7('0x9'));var crypto=require(_0x52e7('0xa'));var jsforce=require(_0x52e7('0xb'));var deskjs=require(_0x52e7('0xc'));var toCsv=require(_0x52e7('0x6'));var querystring=require(_0x52e7('0xd'));var Papa=require('papaparse');var Redis=require(_0x52e7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x52e7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52e7('0x10'));var logger=require(_0x52e7('0x11'))(_0x52e7('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x52e7('0x13'));var db=require(_0x52e7('0x14'))['db'];function respondWithStatusCode(_0x5de9ed,_0x58f70f){_0x58f70f=_0x58f70f||0xcc;return function(_0x14d10d){if(_0x14d10d){return _0x5de9ed['sendStatus'](_0x58f70f);}return _0x5de9ed['status'](_0x58f70f)['end']();};}function respondWithResult(_0x43fc7a,_0x48c6ab){_0x48c6ab=_0x48c6ab||0xc8;return function(_0x535431){if(_0x535431){return _0x43fc7a[_0x52e7('0x15')](_0x48c6ab)['json'](_0x535431);}};}function respondWithFilteredResult(_0x2d08bf,_0x438a15){return function(_0x40fb3a){if(_0x40fb3a){var _0x27a68c=typeof _0x438a15[_0x52e7('0x16')]==='undefined'&&typeof _0x438a15[_0x52e7('0x17')]==='undefined';var _0x12225d=_0x40fb3a[_0x52e7('0x18')];var _0x5526a3=_0x27a68c?0x0:_0x438a15[_0x52e7('0x16')];var _0x2bb940=_0x27a68c?_0x40fb3a['count']:_0x438a15[_0x52e7('0x16')]+_0x438a15[_0x52e7('0x17')];var _0x253b42;if(_0x2bb940>=_0x12225d){_0x2bb940=_0x12225d;_0x253b42=0xc8;}else{_0x253b42=0xce;}_0x2d08bf[_0x52e7('0x15')](_0x253b42);return _0x2d08bf['set']('Content-Range',_0x5526a3+'-'+_0x2bb940+'/'+_0x12225d)[_0x52e7('0x19')](_0x40fb3a);}return null;};}function patchUpdates(_0x2191aa){return function(_0x2cde86){try{jsonpatch['apply'](_0x2cde86,_0x2191aa,!![]);}catch(_0x2e523a){return BPromise['reject'](_0x2e523a);}return _0x2cde86[_0x52e7('0x1a')]();};}function saveUpdates(_0x4935ee,_0x559d1c){return function(_0x56dbdc){if(_0x56dbdc){return _0x56dbdc[_0x52e7('0x1b')](_0x4935ee)[_0x52e7('0x1c')](function(_0x389eea){return _0x389eea;});}return null;};}function removeEntity(_0x4f232c,_0x5cc530){return function(_0x15faa8){if(_0x15faa8){return _0x15faa8[_0x52e7('0x1d')]()[_0x52e7('0x1c')](function(){_0x4f232c[_0x52e7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x251c28,_0x41365f){return function(_0x5ca2c4){if(!_0x5ca2c4){_0x251c28[_0x52e7('0x1e')](0x194);}return _0x5ca2c4;};}function handleError(_0x125402,_0x5b10a5){_0x5b10a5=_0x5b10a5||0x1f4;return function(_0x3ebe54){logger['error'](_0x3ebe54[_0x52e7('0x1f')]);if(_0x3ebe54[_0x52e7('0x20')]){delete _0x3ebe54[_0x52e7('0x20')];}_0x125402[_0x52e7('0x15')](_0x5b10a5)[_0x52e7('0x21')](_0x3ebe54);};}exports[_0x52e7('0x22')]=function(_0x5efac0,_0x447c6b){var _0x1aa681={},_0x3628bc={},_0x487a32={'count':0x0,'rows':[]};var _0x1e41f3=_[_0x52e7('0x23')](db[_0x52e7('0x24')][_0x52e7('0x25')],function(_0x5b39e3){return{'name':_0x5b39e3['fieldName'],'type':_0x5b39e3[_0x52e7('0x26')][_0x52e7('0x27')]};});_0x3628bc[_0x52e7('0x28')]=_['map'](_0x1e41f3,_0x52e7('0x20'));_0x3628bc[_0x52e7('0x29')]=_[_0x52e7('0x2a')](_0x5efac0['query']);_0x3628bc[_0x52e7('0x2b')]=_[_0x52e7('0x2c')](_0x3628bc['model'],_0x3628bc[_0x52e7('0x29')]);_0x1aa681[_0x52e7('0x2d')]=_[_0x52e7('0x2c')](_0x3628bc['model'],qs['fields'](_0x5efac0['query'][_0x52e7('0x2e')]));_0x1aa681[_0x52e7('0x2d')]=_0x1aa681[_0x52e7('0x2d')][_0x52e7('0x2f')]?_0x1aa681[_0x52e7('0x2d')]:_0x3628bc[_0x52e7('0x28')];if(!_0x5efac0[_0x52e7('0x29')][_0x52e7('0x30')](_0x52e7('0x31'))){_0x1aa681['limit']=qs[_0x52e7('0x17')](_0x5efac0['query'][_0x52e7('0x17')]);_0x1aa681[_0x52e7('0x16')]=qs[_0x52e7('0x16')](_0x5efac0[_0x52e7('0x29')][_0x52e7('0x16')]);}_0x1aa681[_0x52e7('0x32')]=qs[_0x52e7('0x33')](_0x5efac0[_0x52e7('0x29')]['sort']);_0x1aa681[_0x52e7('0x34')]=qs[_0x52e7('0x2b')](_[_0x52e7('0x35')](_0x5efac0[_0x52e7('0x29')],_0x3628bc['filters']),_0x1e41f3);if(_0x5efac0[_0x52e7('0x29')][_0x52e7('0x36')]){_0x1aa681['where']=_[_0x52e7('0x37')](_0x1aa681[_0x52e7('0x34')],{'$or':_[_0x52e7('0x23')](_0x1e41f3,function(_0x1115d2){if(_0x1115d2['type']!=='VIRTUAL'){var _0x256f35={};_0x256f35[_0x1115d2[_0x52e7('0x20')]]={'$like':'%'+_0x5efac0[_0x52e7('0x29')][_0x52e7('0x36')]+'%'};return _0x256f35;}})});}_0x1aa681=_[_0x52e7('0x37')]({},_0x1aa681,_0x5efac0[_0x52e7('0x38')]);var _0x2fa56f={'where':_0x1aa681[_0x52e7('0x34')]};return db[_0x52e7('0x24')][_0x52e7('0x18')](_0x2fa56f)[_0x52e7('0x1c')](function(_0x40afe4){_0x487a32[_0x52e7('0x18')]=_0x40afe4;if(_0x5efac0[_0x52e7('0x29')][_0x52e7('0x39')]){_0x1aa681[_0x52e7('0x3a')]=[{'all':!![]}];}return db[_0x52e7('0x24')][_0x52e7('0x3b')](_0x1aa681);})[_0x52e7('0x1c')](function(_0x1344af){_0x487a32['rows']=_0x1344af;return _0x487a32;})['then'](respondWithFilteredResult(_0x447c6b,_0x1aa681))[_0x52e7('0x3c')](handleError(_0x447c6b,null));};exports['show']=function(_0x24acb6,_0x39ac17){var _0x564316={'raw':![],'where':{'id':_0x24acb6[_0x52e7('0x3d')]['id']}},_0x3cbcb1={};_0x3cbcb1[_0x52e7('0x28')]=_[_0x52e7('0x2a')](db[_0x52e7('0x24')][_0x52e7('0x25')]);_0x3cbcb1[_0x52e7('0x29')]=_[_0x52e7('0x2a')](_0x24acb6[_0x52e7('0x29')]);_0x3cbcb1[_0x52e7('0x2b')]=_[_0x52e7('0x2c')](_0x3cbcb1[_0x52e7('0x28')],_0x3cbcb1[_0x52e7('0x29')]);_0x564316['attributes']=_[_0x52e7('0x2c')](_0x3cbcb1['model'],qs[_0x52e7('0x2e')](_0x24acb6['query'][_0x52e7('0x2e')]));_0x564316[_0x52e7('0x2d')]=_0x564316['attributes'][_0x52e7('0x2f')]?_0x564316['attributes']:_0x3cbcb1[_0x52e7('0x28')];if(_0x24acb6[_0x52e7('0x29')]['includeAll']){_0x564316[_0x52e7('0x3a')]=[{'all':!![]}];}_0x564316=_[_0x52e7('0x37')]({},_0x564316,_0x24acb6[_0x52e7('0x38')]);return db[_0x52e7('0x24')][_0x52e7('0x3e')](_0x564316)[_0x52e7('0x1c')](handleEntityNotFound(_0x39ac17,null))[_0x52e7('0x1c')](respondWithResult(_0x39ac17,null))[_0x52e7('0x3c')](handleError(_0x39ac17,null));};exports[_0x52e7('0x3f')]=function(_0x4d30f8,_0x458450){return db[_0x52e7('0x24')][_0x52e7('0x3f')](_0x4d30f8[_0x52e7('0x40')],{})['then'](respondWithResult(_0x458450,0xc9))[_0x52e7('0x3c')](handleError(_0x458450,null));};exports[_0x52e7('0x1b')]=function(_0x3e9ea8,_0x25fef4){if(_0x3e9ea8[_0x52e7('0x40')]['id']){delete _0x3e9ea8[_0x52e7('0x40')]['id'];}return db['ZendeskConfiguration'][_0x52e7('0x3e')]({'where':{'id':_0x3e9ea8[_0x52e7('0x3d')]['id']}})[_0x52e7('0x1c')](handleEntityNotFound(_0x25fef4,null))[_0x52e7('0x1c')](saveUpdates(_0x3e9ea8[_0x52e7('0x40')],null))['then'](respondWithResult(_0x25fef4,null))[_0x52e7('0x3c')](handleError(_0x25fef4,null));};exports[_0x52e7('0x1d')]=function(_0x309d01,_0x1b9987){return db[_0x52e7('0x24')][_0x52e7('0x3e')]({'where':{'id':_0x309d01['params']['id']}})[_0x52e7('0x1c')](handleEntityNotFound(_0x1b9987,null))['then'](removeEntity(_0x1b9987,null))[_0x52e7('0x3c')](handleError(_0x1b9987,null));};exports[_0x52e7('0x41')]=function(_0x335cd3,_0x4709d7,_0x2a02da){var _0x5a84ff={};var _0x11e239={};var _0x4b2447;var _0x4eccba;return db[_0x52e7('0x24')][_0x52e7('0x42')]({'where':{'id':_0x335cd3[_0x52e7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4709d7,null))['then'](function(_0x24b5db){if(_0x24b5db){_0x4b2447=_0x24b5db;_0x11e239[_0x52e7('0x28')]=_['keys'](db[_0x52e7('0x43')][_0x52e7('0x25')]);_0x11e239[_0x52e7('0x29')]=_[_0x52e7('0x2a')](_0x335cd3[_0x52e7('0x29')]);_0x11e239['filters']=_[_0x52e7('0x2c')](_0x11e239[_0x52e7('0x28')],_0x11e239['query']);_0x5a84ff[_0x52e7('0x2d')]=_['intersection'](_0x11e239['model'],qs['fields'](_0x335cd3[_0x52e7('0x29')][_0x52e7('0x2e')]));_0x5a84ff[_0x52e7('0x2d')]=_0x5a84ff[_0x52e7('0x2d')][_0x52e7('0x2f')]?_0x5a84ff['attributes']:_0x11e239[_0x52e7('0x28')];_0x5a84ff[_0x52e7('0x32')]=qs[_0x52e7('0x33')](_0x335cd3[_0x52e7('0x29')][_0x52e7('0x33')]);_0x5a84ff['where']=qs['filters'](_[_0x52e7('0x35')](_0x335cd3[_0x52e7('0x29')],_0x11e239[_0x52e7('0x2b')]));if(_0x335cd3[_0x52e7('0x29')]['filter']){_0x5a84ff['where']=_['merge'](_0x5a84ff[_0x52e7('0x34')],{'$or':_[_0x52e7('0x23')](_0x5a84ff[_0x52e7('0x2d')],function(_0x52f3e2){var _0x55bc7b={};_0x55bc7b[_0x52f3e2]={'$like':'%'+_0x335cd3[_0x52e7('0x29')][_0x52e7('0x36')]+'%'};return _0x55bc7b;})});}_0x5a84ff=_[_0x52e7('0x37')]({},_0x5a84ff,_0x335cd3[_0x52e7('0x38')]);return _0x4b2447[_0x52e7('0x41')](_0x5a84ff);}})[_0x52e7('0x1c')](function(_0x49387d){if(_0x49387d){_0x4eccba=_0x49387d['length'];if(!_0x335cd3[_0x52e7('0x29')]['hasOwnProperty'](_0x52e7('0x31'))){_0x5a84ff[_0x52e7('0x17')]=qs[_0x52e7('0x17')](_0x335cd3['query'][_0x52e7('0x17')]);_0x5a84ff[_0x52e7('0x16')]=qs[_0x52e7('0x16')](_0x335cd3[_0x52e7('0x29')]['offset']);}return _0x4b2447['getFields'](_0x5a84ff);}})[_0x52e7('0x1c')](function(_0x246633){if(_0x246633){return _0x246633?{'count':_0x4eccba,'rows':_0x246633}:null;}})[_0x52e7('0x1c')](respondWithResult(_0x4709d7,null))[_0x52e7('0x3c')](handleError(_0x4709d7,null));};exports[_0x52e7('0x44')]=function(_0x200fad,_0x2ba90e,_0xab6af7){var _0x15ac39={};var _0x1ba5b3={};var _0x1270dc;var _0x1eafc3;return db[_0x52e7('0x24')]['findOne']({'where':{'id':_0x200fad['params']['id']}})[_0x52e7('0x1c')](handleEntityNotFound(_0x2ba90e,null))[_0x52e7('0x1c')](function(_0x27660c){if(_0x27660c){_0x1270dc=_0x27660c;_0x1ba5b3['model']=_[_0x52e7('0x2a')](db[_0x52e7('0x43')][_0x52e7('0x25')]);_0x1ba5b3[_0x52e7('0x29')]=_[_0x52e7('0x2a')](_0x200fad[_0x52e7('0x29')]);_0x1ba5b3[_0x52e7('0x2b')]=_[_0x52e7('0x2c')](_0x1ba5b3[_0x52e7('0x28')],_0x1ba5b3['query']);_0x15ac39[_0x52e7('0x2d')]=_[_0x52e7('0x2c')](_0x1ba5b3[_0x52e7('0x28')],qs['fields'](_0x200fad['query'][_0x52e7('0x2e')]));_0x15ac39[_0x52e7('0x2d')]=_0x15ac39[_0x52e7('0x2d')]['length']?_0x15ac39[_0x52e7('0x2d')]:_0x1ba5b3['model'];_0x15ac39['order']=qs['sort'](_0x200fad[_0x52e7('0x29')]['sort']);_0x15ac39[_0x52e7('0x34')]=qs[_0x52e7('0x2b')](_[_0x52e7('0x35')](_0x200fad['query'],_0x1ba5b3[_0x52e7('0x2b')]));if(_0x200fad['query'][_0x52e7('0x36')]){_0x15ac39[_0x52e7('0x34')]=_[_0x52e7('0x37')](_0x15ac39[_0x52e7('0x34')],{'$or':_[_0x52e7('0x23')](_0x15ac39[_0x52e7('0x2d')],function(_0xa914d0){var _0x54f45a={};_0x54f45a[_0xa914d0]={'$like':'%'+_0x200fad[_0x52e7('0x29')][_0x52e7('0x36')]+'%'};return _0x54f45a;})});}_0x15ac39=_[_0x52e7('0x37')]({},_0x15ac39,_0x200fad[_0x52e7('0x38')]);return _0x1270dc[_0x52e7('0x44')](_0x15ac39);}})[_0x52e7('0x1c')](function(_0xa732d8){if(_0xa732d8){_0x1eafc3=_0xa732d8[_0x52e7('0x2f')];if(!_0x200fad[_0x52e7('0x29')][_0x52e7('0x30')](_0x52e7('0x31'))){_0x15ac39[_0x52e7('0x17')]=qs[_0x52e7('0x17')](_0x200fad['query'][_0x52e7('0x17')]);_0x15ac39[_0x52e7('0x16')]=qs[_0x52e7('0x16')](_0x200fad[_0x52e7('0x29')][_0x52e7('0x16')]);}return _0x1270dc[_0x52e7('0x44')](_0x15ac39);}})[_0x52e7('0x1c')](function(_0x1a558d){if(_0x1a558d){return _0x1a558d?{'count':_0x1eafc3,'rows':_0x1a558d}:null;}})[_0x52e7('0x1c')](respondWithResult(_0x2ba90e,null))['catch'](handleError(_0x2ba90e,null));};exports[_0x52e7('0x45')]=function(_0x555428,_0x1ee987,_0xa9d968){var _0x247412={};var _0x5b463e={};var _0x37af8d;var _0x15d5de;return db[_0x52e7('0x24')][_0x52e7('0x42')]({'where':{'id':_0x555428[_0x52e7('0x3d')]['id']}})[_0x52e7('0x1c')](handleEntityNotFound(_0x1ee987,null))[_0x52e7('0x1c')](function(_0x4d064d){if(_0x4d064d){_0x37af8d=_0x4d064d;_0x5b463e[_0x52e7('0x28')]=_[_0x52e7('0x2a')](db[_0x52e7('0x43')][_0x52e7('0x25')]);_0x5b463e[_0x52e7('0x29')]=_[_0x52e7('0x2a')](_0x555428['query']);_0x5b463e[_0x52e7('0x2b')]=_[_0x52e7('0x2c')](_0x5b463e[_0x52e7('0x28')],_0x5b463e[_0x52e7('0x29')]);_0x247412['attributes']=_[_0x52e7('0x2c')](_0x5b463e[_0x52e7('0x28')],qs[_0x52e7('0x2e')](_0x555428[_0x52e7('0x29')][_0x52e7('0x2e')]));_0x247412[_0x52e7('0x2d')]=_0x247412[_0x52e7('0x2d')][_0x52e7('0x2f')]?_0x247412['attributes']:_0x5b463e['model'];_0x247412[_0x52e7('0x32')]=qs['sort'](_0x555428[_0x52e7('0x29')]['sort']);_0x247412['where']=qs['filters'](_[_0x52e7('0x35')](_0x555428[_0x52e7('0x29')],_0x5b463e['filters']));if(_0x555428[_0x52e7('0x29')][_0x52e7('0x36')]){_0x247412['where']=_['merge'](_0x247412[_0x52e7('0x34')],{'$or':_['map'](_0x247412[_0x52e7('0x2d')],function(_0x1f8b56){var _0x3930ca={};_0x3930ca[_0x1f8b56]={'$like':'%'+_0x555428['query'][_0x52e7('0x36')]+'%'};return _0x3930ca;})});}_0x247412=_[_0x52e7('0x37')]({},_0x247412,_0x555428[_0x52e7('0x38')]);return _0x37af8d[_0x52e7('0x45')](_0x247412);}})[_0x52e7('0x1c')](function(_0x5e2ddb){if(_0x5e2ddb){_0x15d5de=_0x5e2ddb[_0x52e7('0x2f')];if(!_0x555428['query'][_0x52e7('0x30')]('nolimit')){_0x247412[_0x52e7('0x17')]=qs[_0x52e7('0x17')](_0x555428[_0x52e7('0x29')][_0x52e7('0x17')]);_0x247412[_0x52e7('0x16')]=qs[_0x52e7('0x16')](_0x555428[_0x52e7('0x29')][_0x52e7('0x16')]);}return _0x37af8d['getDescriptions'](_0x247412);}})[_0x52e7('0x1c')](function(_0x56e133){if(_0x56e133){return _0x56e133?{'count':_0x15d5de,'rows':_0x56e133}:null;}})[_0x52e7('0x1c')](respondWithResult(_0x1ee987,null))[_0x52e7('0x3c')](handleError(_0x1ee987,null));};exports[_0x52e7('0x46')]=function(_0x3ce2b8,_0x39fc20,_0x65d45b){var _0x2883c9={};var _0x268934={};var _0x3a2c7d;var _0x4b18fd;return db[_0x52e7('0x24')]['findOne']({'where':{'id':_0x3ce2b8[_0x52e7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x39fc20,null))['then'](function(_0x466293){if(_0x466293){_0x3a2c7d=_0x466293;_0x268934[_0x52e7('0x28')]=_['keys'](db[_0x52e7('0x47')][_0x52e7('0x25')]);_0x268934[_0x52e7('0x29')]=_[_0x52e7('0x2a')](_0x3ce2b8[_0x52e7('0x29')]);_0x268934[_0x52e7('0x2b')]=_[_0x52e7('0x2c')](_0x268934['model'],_0x268934[_0x52e7('0x29')]);_0x2883c9[_0x52e7('0x2d')]=_['intersection'](_0x268934[_0x52e7('0x28')],qs[_0x52e7('0x2e')](_0x3ce2b8[_0x52e7('0x29')][_0x52e7('0x2e')]));_0x2883c9[_0x52e7('0x2d')]=_0x2883c9[_0x52e7('0x2d')][_0x52e7('0x2f')]?_0x2883c9[_0x52e7('0x2d')]:_0x268934[_0x52e7('0x28')];_0x2883c9[_0x52e7('0x32')]=qs['sort'](_0x3ce2b8[_0x52e7('0x29')][_0x52e7('0x33')]);_0x2883c9['where']=qs[_0x52e7('0x2b')](_[_0x52e7('0x35')](_0x3ce2b8[_0x52e7('0x29')],_0x268934['filters']));if(_0x3ce2b8[_0x52e7('0x29')][_0x52e7('0x36')]){_0x2883c9[_0x52e7('0x34')]=_['merge'](_0x2883c9[_0x52e7('0x34')],{'$or':_[_0x52e7('0x23')](_0x2883c9[_0x52e7('0x2d')],function(_0x5b5ff2){var _0x3e09b2={};_0x3e09b2[_0x5b5ff2]={'$like':'%'+_0x3ce2b8[_0x52e7('0x29')][_0x52e7('0x36')]+'%'};return _0x3e09b2;})});}_0x2883c9=_['merge']({},_0x2883c9,_0x3ce2b8['options']);return _0x3a2c7d[_0x52e7('0x46')](_0x2883c9);}})[_0x52e7('0x1c')](function(_0x8f509c){if(_0x8f509c){_0x4b18fd=_0x8f509c[_0x52e7('0x2f')];if(!_0x3ce2b8[_0x52e7('0x29')][_0x52e7('0x30')](_0x52e7('0x31'))){_0x2883c9[_0x52e7('0x17')]=qs[_0x52e7('0x17')](_0x3ce2b8[_0x52e7('0x29')][_0x52e7('0x17')]);_0x2883c9[_0x52e7('0x16')]=qs[_0x52e7('0x16')](_0x3ce2b8[_0x52e7('0x29')][_0x52e7('0x16')]);}return _0x3a2c7d[_0x52e7('0x46')](_0x2883c9);}})[_0x52e7('0x1c')](function(_0x453015){if(_0x453015){return _0x453015?{'count':_0x4b18fd,'rows':_0x453015}:null;}})['then'](respondWithResult(_0x39fc20,null))[_0x52e7('0x3c')](handleError(_0x39fc20,null));};exports['setTags']=function(_0x5ca4bc,_0x53b80b,_0x36d866){if(_0x5ca4bc['body']['id']){delete _0x5ca4bc[_0x52e7('0x40')]['id'];}return db['ZendeskConfiguration'][_0x52e7('0x42')]({'where':{'id':_0x5ca4bc['params']['id']}})[_0x52e7('0x1c')](handleEntityNotFound(_0x53b80b,null))[_0x52e7('0x1c')](function(_0x42cd5c){if(_0x42cd5c){return _0x42cd5c['setTags'](_0x5ca4bc[_0x52e7('0x40')][_0x52e7('0x48')]||[]);}return null;})[_0x52e7('0x1c')](respondWithResult(_0x53b80b,null))[_0x52e7('0x3c')](handleError(_0x53b80b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 319e1c4..089ccf1 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 _0x5423=['request-promise','path','rimraf','../../config/environment','exports','define','ZendeskConfiguration','lodash','util','api','moment'];(function(_0x111db0,_0x1f568d){var _0x2e1421=function(_0x36bb2f){while(--_0x36bb2f){_0x111db0['push'](_0x111db0['shift']());}};_0x2e1421(++_0x1f568d);}(_0x5423,0xe3));var _0x3542=function(_0x3fa358,_0xa789f5){_0x3fa358=_0x3fa358-0x0;var _0x1cff6d=_0x5423[_0x3fa358];return _0x1cff6d;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefda=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','api','moment','request-promise','path','rimraf'];(function(_0x2161f9,_0x5a1c4f){var _0x5f3b14=function(_0x26e22c){while(--_0x26e22c){_0x2161f9['push'](_0x2161f9['shift']());}};_0x5f3b14(++_0x5a1c4f);}(_0xefda,0x96));var _0xaefd=function(_0x6a3e3a,_0x5da8f4){_0x6a3e3a=_0x6a3e3a-0x0;var _0xccaf49=_0xefda[_0x6a3e3a];return _0xccaf49;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 0ae7613..8395c22 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 _0xb07f=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','result','lodash','util'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xb07f,0xa9));var _0xfb07=function(_0x8ef64c,_0x4ca3f5){_0x8ef64c=_0x8ef64c-0x0;var _0x391fbe=_0xb07f[_0x8ef64c];return _0x391fbe;};'use strict';var _=require(_0xfb07('0x0'));var util=require(_0xfb07('0x1'));var moment=require('moment');var BPromise=require(_0xfb07('0x2'));var rs=require(_0xfb07('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfb07('0x4'));var logger=require(_0xfb07('0x5'))(_0xfb07('0x6'));var config=require(_0xfb07('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfb07('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c5636,_0x38430e,_0x3c2537){return new BPromise(function(_0x48699f,_0x21a39d){return client[_0xfb07('0x9')](_0x2c5636,_0x3c2537)['then'](function(_0x5f3b4b){logger[_0xfb07('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x38430e,_0xfb07('0xb'));logger['debug'](_0xfb07('0xc'),_0x38430e,_0xfb07('0xb'),JSON[_0xfb07('0xd')](_0x5f3b4b));if(_0x5f3b4b['error']){if(_0x5f3b4b[_0xfb07('0xe')][_0xfb07('0xf')]===0x1f4){logger[_0xfb07('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x38430e,_0x5f3b4b[_0xfb07('0xe')][_0xfb07('0x10')]);return _0x21a39d(_0x5f3b4b[_0xfb07('0xe')][_0xfb07('0x10')]);}logger[_0xfb07('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x38430e,_0x5f3b4b['error'][_0xfb07('0x10')]);return _0x48699f(_0x5f3b4b['error']['message']);}else{logger[_0xfb07('0xa')](_0xfb07('0x11'),_0x38430e,_0xfb07('0xb'));_0x48699f(_0x5f3b4b[_0xfb07('0x12')]['message']);}})['catch'](function(_0x1e3815){logger[_0xfb07('0xe')](_0xfb07('0x11'),_0x38430e,_0x1e3815);_0x21a39d(_0x1e3815);});});} \ No newline at end of file +var _0x934b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util'];(function(_0x30f63d,_0xf0902b){var _0x4f59f4=function(_0x4479d7){while(--_0x4479d7){_0x30f63d['push'](_0x30f63d['shift']());}};_0x4f59f4(++_0xf0902b);}(_0x934b,0x103));var _0xb934=function(_0x5df2ff,_0x48300e){_0x5df2ff=_0x5df2ff-0x0;var _0x594f25=_0x934b[_0x5df2ff];return _0x594f25;};'use strict';var _=require('lodash');var util=require(_0xb934('0x0'));var moment=require(_0xb934('0x1'));var BPromise=require(_0xb934('0x2'));var rs=require(_0xb934('0x3'));var fs=require('fs');var Redis=require(_0xb934('0x4'));var db=require(_0xb934('0x5'))['db'];var utils=require(_0xb934('0x6'));var logger=require(_0xb934('0x7'))(_0xb934('0x8'));var config=require(_0xb934('0x9'));var jayson=require(_0xb934('0xa'));var client=jayson[_0xb934('0xb')][_0xb934('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x571f49,_0x1c4715,_0x3dd9bb){return new BPromise(function(_0x32e2ac,_0x2893ee){return client[_0xb934('0xd')](_0x571f49,_0x3dd9bb)[_0xb934('0xe')](function(_0x3fb368){logger['info'](_0xb934('0xf'),_0x1c4715,'request\x20sent');logger[_0xb934('0x10')](_0xb934('0x11'),_0x1c4715,_0xb934('0x12'),JSON[_0xb934('0x13')](_0x3fb368));if(_0x3fb368[_0xb934('0x14')]){if(_0x3fb368[_0xb934('0x14')][_0xb934('0x15')]===0x1f4){logger[_0xb934('0x14')](_0xb934('0xf'),_0x1c4715,_0x3fb368[_0xb934('0x14')]['message']);return _0x2893ee(_0x3fb368[_0xb934('0x14')][_0xb934('0x16')]);}logger['error'](_0xb934('0xf'),_0x1c4715,_0x3fb368[_0xb934('0x14')][_0xb934('0x16')]);return _0x32e2ac(_0x3fb368[_0xb934('0x14')][_0xb934('0x16')]);}else{logger[_0xb934('0x17')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1c4715,_0xb934('0x12'));_0x32e2ac(_0x3fb368[_0xb934('0x18')][_0xb934('0x16')]);}})[_0xb934('0x19')](function(_0xc0570e){logger[_0xb934('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1c4715,_0xc0570e);_0x2893ee(_0xc0570e);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 53642fa..83de451 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 _0x175c=['get','isAuthenticated','index','show','create','/:id','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller'];(function(_0x45a3f8,_0x300f40){var _0x1a0c49=function(_0x471549){while(--_0x471549){_0x45a3f8['push'](_0x45a3f8['shift']());}};_0x1a0c49(++_0x300f40);}(_0x175c,0xe8));var _0xc175=function(_0x5be2fa,_0x42bccc){_0x5be2fa=_0x5be2fa-0x0;var _0x11f111=_0x175c[_0x5be2fa];return _0x11f111;};'use strict';var multer=require(_0xc175('0x0'));var util=require('util');var path=require(_0xc175('0x1'));var timeout=require('connect-timeout');var express=require(_0xc175('0x2'));var router=express[_0xc175('0x3')]();var fs_extra=require(_0xc175('0x4'));var auth=require(_0xc175('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc175('0x6'));var controller=require(_0xc175('0x7'));router[_0xc175('0x8')]('/',auth[_0xc175('0x9')](),controller[_0xc175('0xa')]);router[_0xc175('0x8')]('/:id',auth[_0xc175('0x9')](),controller[_0xc175('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc175('0xc')]);router['put'](_0xc175('0xd'),auth[_0xc175('0x9')](),controller[_0xc175('0xe')]);router['delete'](_0xc175('0xd'),auth[_0xc175('0x9')](),controller['destroy']);module[_0xc175('0xf')]=router; \ No newline at end of file +var _0xb019=['update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put'];(function(_0x42613c,_0x50688f){var _0x5275cf=function(_0x16339b){while(--_0x16339b){_0x42613c['push'](_0x42613c['shift']());}};_0x5275cf(++_0x50688f);}(_0xb019,0x8b));var _0x9b01=function(_0x21fea0,_0x489f9f){_0x21fea0=_0x21fea0-0x0;var _0x50a50f=_0xb019[_0x21fea0];return _0x50a50f;};'use strict';var multer=require('multer');var util=require(_0x9b01('0x0'));var path=require(_0x9b01('0x1'));var timeout=require(_0x9b01('0x2'));var express=require(_0x9b01('0x3'));var router=express[_0x9b01('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9b01('0x5'));var interaction=require(_0x9b01('0x6'));var config=require(_0x9b01('0x7'));var controller=require('./intZendeskField.controller');router[_0x9b01('0x8')]('/',auth[_0x9b01('0x9')](),controller['index']);router['get'](_0x9b01('0xa'),auth[_0x9b01('0x9')](),controller[_0x9b01('0xb')]);router[_0x9b01('0xc')]('/',auth[_0x9b01('0x9')](),controller['create']);router[_0x9b01('0xd')]('/:id',auth[_0x9b01('0x9')](),controller[_0x9b01('0xe')]);router['delete'](_0x9b01('0xa'),auth[_0x9b01('0x9')](),controller[_0x9b01('0xf')]);module[_0x9b01('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 50f6341..f2e6061 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 _0xd8e5=['variable','customVariable','keyValue','picklist','STRING','ENUM','exports','string'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd8e5,0xbe));var _0x5d8e=function(_0x263e5e,_0x5e81ee){_0x263e5e=_0x263e5e-0x0;var _0x2c7e50=_0xd8e5[_0x263e5e];return _0x2c7e50;};'use strict';var Sequelize=require('sequelize');module[_0x5d8e('0x0')]={'type':{'type':Sequelize['ENUM'](_0x5d8e('0x1'),_0x5d8e('0x2'),_0x5d8e('0x3'),_0x5d8e('0x4'),_0x5d8e('0x5')),'defaultValue':_0x5d8e('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5d8e('0x6')]},'keyType':{'type':Sequelize[_0x5d8e('0x7')](_0x5d8e('0x1'),_0x5d8e('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5d8e('0x6')]},'nameField':{'type':Sequelize[_0x5d8e('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5d8e('0x6')]}}; \ No newline at end of file +var _0x4331=['ENUM','keyValue','string','STRING','customVariable','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4331,0x12c));var _0x1433=function(_0x5bcadb,_0x35270a){_0x5bcadb=_0x5bcadb-0x0;var _0x501049=_0x4331[_0x5bcadb];return _0x501049;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1433('0x0')]('string','variable','customVariable',_0x1433('0x1'),'picklist'),'defaultValue':_0x1433('0x2')},'content':{'type':Sequelize[_0x1433('0x3')]},'key':{'type':Sequelize[_0x1433('0x3')]},'keyType':{'type':Sequelize[_0x1433('0x0')](_0x1433('0x2'),'variable',_0x1433('0x4'))},'keyContent':{'type':Sequelize[_0x1433('0x3')]},'idField':{'type':Sequelize[_0x1433('0x3')]},'nameField':{'type':Sequelize[_0x1433('0x3')]},'customField':{'type':Sequelize[_0x1433('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1433('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 5d8421d..498d5a7 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 _0x2035=['rawAttributes','fieldName','type','model','keys','query','filters','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','then','includeAll','include','rows','catch','show','params','intersection','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','apply','save','update','sendStatus','stack','name','send','index','map','ZendeskField'];(function(_0x2f09fd,_0x185cac){var _0x1ad3b8=function(_0x5d8051){while(--_0x5d8051){_0x2f09fd['push'](_0x2f09fd['shift']());}};_0x1ad3b8(++_0x185cac);}(_0x2035,0xb2));var _0x5203=function(_0x4f1ad2,_0x3c5907){_0x4f1ad2=_0x4f1ad2-0x0;var _0x1dc3a7=_0x2035[_0x4f1ad2];return _0x1dc3a7;};'use strict';var emlformat=require(_0x5203('0x0'));var rimraf=require(_0x5203('0x1'));var zipdir=require(_0x5203('0x2'));var jsonpatch=require(_0x5203('0x3'));var rp=require(_0x5203('0x4'));var moment=require(_0x5203('0x5'));var BPromise=require(_0x5203('0x6'));var Mustache=require(_0x5203('0x7'));var util=require(_0x5203('0x8'));var path=require(_0x5203('0x9'));var sox=require(_0x5203('0xa'));var csv=require(_0x5203('0xb'));var ejs=require(_0x5203('0xc'));var fs=require('fs');var fs_extra=require(_0x5203('0xd'));var _=require(_0x5203('0xe'));var squel=require(_0x5203('0xf'));var crypto=require('crypto');var jsforce=require(_0x5203('0x10'));var deskjs=require(_0x5203('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5203('0x12'));var Papa=require('papaparse');var Redis=require(_0x5203('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5203('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5203('0x15'));var logger=require(_0x5203('0x16'))(_0x5203('0x17'));var utils=require(_0x5203('0x18'));var config=require(_0x5203('0x19'));var licenseUtil=require(_0x5203('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53098f,_0xca317c){_0xca317c=_0xca317c||0xcc;return function(_0x27c4fe){if(_0x27c4fe){return _0x53098f['sendStatus'](_0xca317c);}return _0x53098f[_0x5203('0x1b')](_0xca317c)[_0x5203('0x1c')]();};}function respondWithResult(_0x4cdab9,_0x597fbf){_0x597fbf=_0x597fbf||0xc8;return function(_0x4750b4){if(_0x4750b4){return _0x4cdab9[_0x5203('0x1b')](_0x597fbf)[_0x5203('0x1d')](_0x4750b4);}};}function respondWithFilteredResult(_0x67c01c,_0x4252bd){return function(_0x1385f8){if(_0x1385f8){var _0x5bf181=typeof _0x4252bd[_0x5203('0x1e')]==='undefined'&&typeof _0x4252bd['limit']===_0x5203('0x1f');var _0x15610c=_0x1385f8['count'];var _0x43f505=_0x5bf181?0x0:_0x4252bd[_0x5203('0x1e')];var _0x39c3b7=_0x5bf181?_0x1385f8[_0x5203('0x20')]:_0x4252bd[_0x5203('0x1e')]+_0x4252bd[_0x5203('0x21')];var _0x47a840;if(_0x39c3b7>=_0x15610c){_0x39c3b7=_0x15610c;_0x47a840=0xc8;}else{_0x47a840=0xce;}_0x67c01c[_0x5203('0x1b')](_0x47a840);return _0x67c01c['set']('Content-Range',_0x43f505+'-'+_0x39c3b7+'/'+_0x15610c)[_0x5203('0x1d')](_0x1385f8);}return null;};}function patchUpdates(_0x542416){return function(_0x59db90){try{jsonpatch[_0x5203('0x22')](_0x59db90,_0x542416,!![]);}catch(_0x2a3834){return BPromise['reject'](_0x2a3834);}return _0x59db90[_0x5203('0x23')]();};}function saveUpdates(_0x450d75,_0x372945){return function(_0x2b1b4c){if(_0x2b1b4c){return _0x2b1b4c[_0x5203('0x24')](_0x450d75)['then'](function(_0x394e7f){return _0x394e7f;});}return null;};}function removeEntity(_0x57b252,_0x9d77e9){return function(_0x333d17){if(_0x333d17){return _0x333d17['destroy']()['then'](function(){_0x57b252[_0x5203('0x1b')](0xcc)[_0x5203('0x1c')]();});}};}function handleEntityNotFound(_0x21850b,_0x525854){return function(_0x165f69){if(!_0x165f69){_0x21850b[_0x5203('0x25')](0x194);}return _0x165f69;};}function handleError(_0x2129fe,_0x3cbe98){_0x3cbe98=_0x3cbe98||0x1f4;return function(_0x528012){logger['error'](_0x528012[_0x5203('0x26')]);if(_0x528012[_0x5203('0x27')]){delete _0x528012[_0x5203('0x27')];}_0x2129fe[_0x5203('0x1b')](_0x3cbe98)[_0x5203('0x28')](_0x528012);};}exports[_0x5203('0x29')]=function(_0x295a20,_0x53367a){var _0x5b9381={},_0x738f87={},_0x53c911={'count':0x0,'rows':[]};var _0x281e8d=_[_0x5203('0x2a')](db[_0x5203('0x2b')][_0x5203('0x2c')],function(_0x1e4434){return{'name':_0x1e4434[_0x5203('0x2d')],'type':_0x1e4434[_0x5203('0x2e')]['key']};});_0x738f87[_0x5203('0x2f')]=_['map'](_0x281e8d,_0x5203('0x27'));_0x738f87['query']=_[_0x5203('0x30')](_0x295a20[_0x5203('0x31')]);_0x738f87[_0x5203('0x32')]=_['intersection'](_0x738f87[_0x5203('0x2f')],_0x738f87[_0x5203('0x31')]);_0x5b9381['attributes']=_['intersection'](_0x738f87['model'],qs[_0x5203('0x33')](_0x295a20[_0x5203('0x31')][_0x5203('0x33')]));_0x5b9381['attributes']=_0x5b9381['attributes'][_0x5203('0x34')]?_0x5b9381[_0x5203('0x35')]:_0x738f87[_0x5203('0x2f')];if(!_0x295a20[_0x5203('0x31')][_0x5203('0x36')](_0x5203('0x37'))){_0x5b9381[_0x5203('0x21')]=qs['limit'](_0x295a20[_0x5203('0x31')][_0x5203('0x21')]);_0x5b9381[_0x5203('0x1e')]=qs[_0x5203('0x1e')](_0x295a20[_0x5203('0x31')][_0x5203('0x1e')]);}_0x5b9381['order']=qs[_0x5203('0x38')](_0x295a20[_0x5203('0x31')]['sort']);_0x5b9381[_0x5203('0x39')]=qs['filters'](_['pick'](_0x295a20[_0x5203('0x31')],_0x738f87[_0x5203('0x32')]),_0x281e8d);if(_0x295a20[_0x5203('0x31')][_0x5203('0x3a')]){_0x5b9381[_0x5203('0x39')]=_[_0x5203('0x3b')](_0x5b9381[_0x5203('0x39')],{'$or':_[_0x5203('0x2a')](_0x281e8d,function(_0x4e6200){if(_0x4e6200[_0x5203('0x2e')]!==_0x5203('0x3c')){var _0x4b0886={};_0x4b0886[_0x4e6200['name']]={'$like':'%'+_0x295a20[_0x5203('0x31')]['filter']+'%'};return _0x4b0886;}})});}_0x5b9381=_[_0x5203('0x3b')]({},_0x5b9381,_0x295a20['options']);var _0x541efe={'where':_0x5b9381[_0x5203('0x39')]};return db[_0x5203('0x2b')][_0x5203('0x20')](_0x541efe)[_0x5203('0x3d')](function(_0x3bf0c8){_0x53c911[_0x5203('0x20')]=_0x3bf0c8;if(_0x295a20[_0x5203('0x31')][_0x5203('0x3e')]){_0x5b9381[_0x5203('0x3f')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x5b9381);})['then'](function(_0x54ba95){_0x53c911[_0x5203('0x40')]=_0x54ba95;return _0x53c911;})[_0x5203('0x3d')](respondWithFilteredResult(_0x53367a,_0x5b9381))[_0x5203('0x41')](handleError(_0x53367a,null));};exports[_0x5203('0x42')]=function(_0x2b89c7,_0x3c3ce0){var _0x5d2907={'raw':!![],'where':{'id':_0x2b89c7[_0x5203('0x43')]['id']}},_0x123b40={};_0x123b40[_0x5203('0x2f')]=_['keys'](db['ZendeskField'][_0x5203('0x2c')]);_0x123b40['query']=_[_0x5203('0x30')](_0x2b89c7['query']);_0x123b40[_0x5203('0x32')]=_[_0x5203('0x44')](_0x123b40['model'],_0x123b40['query']);_0x5d2907[_0x5203('0x35')]=_['intersection'](_0x123b40[_0x5203('0x2f')],qs[_0x5203('0x33')](_0x2b89c7[_0x5203('0x31')][_0x5203('0x33')]));_0x5d2907['attributes']=_0x5d2907[_0x5203('0x35')][_0x5203('0x34')]?_0x5d2907[_0x5203('0x35')]:_0x123b40[_0x5203('0x2f')];if(_0x2b89c7[_0x5203('0x31')][_0x5203('0x3e')]){_0x5d2907[_0x5203('0x3f')]=[{'all':!![]}];}_0x5d2907=_['merge']({},_0x5d2907,_0x2b89c7[_0x5203('0x45')]);return db[_0x5203('0x2b')][_0x5203('0x46')](_0x5d2907)[_0x5203('0x3d')](handleEntityNotFound(_0x3c3ce0,null))['then'](respondWithResult(_0x3c3ce0,null))['catch'](handleError(_0x3c3ce0,null));};exports['create']=function(_0x3c2e09,_0x1682c0){return db[_0x5203('0x2b')][_0x5203('0x47')](_0x3c2e09[_0x5203('0x48')],{})['then'](respondWithResult(_0x1682c0,0xc9))[_0x5203('0x41')](handleError(_0x1682c0,null));};exports[_0x5203('0x24')]=function(_0x465048,_0x12bd15){if(_0x465048['body']['id']){delete _0x465048[_0x5203('0x48')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x465048['params']['id']}})[_0x5203('0x3d')](handleEntityNotFound(_0x12bd15,null))[_0x5203('0x3d')](saveUpdates(_0x465048['body'],null))['then'](respondWithResult(_0x12bd15,null))[_0x5203('0x41')](handleError(_0x12bd15,null));};exports[_0x5203('0x49')]=function(_0x28fff9,_0xb200cc){return db['ZendeskField'][_0x5203('0x46')]({'where':{'id':_0x28fff9[_0x5203('0x43')]['id']}})[_0x5203('0x3d')](handleEntityNotFound(_0xb200cc,null))[_0x5203('0x3d')](removeEntity(_0xb200cc,null))['catch'](handleError(_0xb200cc,null));}; \ No newline at end of file +var _0x9e25=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','ZendeskField','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','desk.js'];(function(_0x4594b4,_0x3eeced){var _0x1d7e66=function(_0x263490){while(--_0x263490){_0x4594b4['push'](_0x4594b4['shift']());}};_0x1d7e66(++_0x3eeced);}(_0x9e25,0x82));var _0x59e2=function(_0x3efd11,_0x50289f){_0x3efd11=_0x3efd11-0x0;var _0x1e4f79=_0x9e25[_0x3efd11];return _0x1e4f79;};'use strict';var emlformat=require(_0x59e2('0x0'));var rimraf=require(_0x59e2('0x1'));var zipdir=require(_0x59e2('0x2'));var jsonpatch=require(_0x59e2('0x3'));var rp=require(_0x59e2('0x4'));var moment=require(_0x59e2('0x5'));var BPromise=require(_0x59e2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x59e2('0x7'));var sox=require(_0x59e2('0x8'));var csv=require('to-csv');var ejs=require(_0x59e2('0x9'));var fs=require('fs');var fs_extra=require(_0x59e2('0xa'));var _=require('lodash');var squel=require(_0x59e2('0xb'));var crypto=require(_0x59e2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x59e2('0xd'));var toCsv=require(_0x59e2('0xe'));var querystring=require(_0x59e2('0xf'));var Papa=require(_0x59e2('0x10'));var Redis=require('ioredis');var authService=require(_0x59e2('0x11'));var qs=require(_0x59e2('0x12'));var as=require(_0x59e2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x59e2('0x14'));var utils=require('../../config/utils');var config=require(_0x59e2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x59e2('0x16'))['db'];function respondWithStatusCode(_0x28835f,_0x4f4785){_0x4f4785=_0x4f4785||0xcc;return function(_0x1efd7a){if(_0x1efd7a){return _0x28835f[_0x59e2('0x17')](_0x4f4785);}return _0x28835f[_0x59e2('0x18')](_0x4f4785)['end']();};}function respondWithResult(_0x1d3440,_0x4a3c1d){_0x4a3c1d=_0x4a3c1d||0xc8;return function(_0x1d20c6){if(_0x1d20c6){return _0x1d3440['status'](_0x4a3c1d)['json'](_0x1d20c6);}};}function respondWithFilteredResult(_0x586ae6,_0x484b3d){return function(_0x37ff56){if(_0x37ff56){var _0x3014fd=typeof _0x484b3d[_0x59e2('0x19')]==='undefined'&&typeof _0x484b3d[_0x59e2('0x1a')]===_0x59e2('0x1b');var _0x5b9269=_0x37ff56[_0x59e2('0x1c')];var _0x42ab3f=_0x3014fd?0x0:_0x484b3d['offset'];var _0x6a00f1=_0x3014fd?_0x37ff56[_0x59e2('0x1c')]:_0x484b3d[_0x59e2('0x19')]+_0x484b3d[_0x59e2('0x1a')];var _0x41bf0e;if(_0x6a00f1>=_0x5b9269){_0x6a00f1=_0x5b9269;_0x41bf0e=0xc8;}else{_0x41bf0e=0xce;}_0x586ae6[_0x59e2('0x18')](_0x41bf0e);return _0x586ae6[_0x59e2('0x1d')](_0x59e2('0x1e'),_0x42ab3f+'-'+_0x6a00f1+'/'+_0x5b9269)['json'](_0x37ff56);}return null;};}function patchUpdates(_0x49e962){return function(_0x3d4619){try{jsonpatch[_0x59e2('0x1f')](_0x3d4619,_0x49e962,!![]);}catch(_0x3a9208){return BPromise[_0x59e2('0x20')](_0x3a9208);}return _0x3d4619[_0x59e2('0x21')]();};}function saveUpdates(_0x193542,_0x2bc1a3){return function(_0x4d0fe3){if(_0x4d0fe3){return _0x4d0fe3[_0x59e2('0x22')](_0x193542)[_0x59e2('0x23')](function(_0xe4bbb4){return _0xe4bbb4;});}return null;};}function removeEntity(_0x513a01,_0x54f6b8){return function(_0x4a6a8f){if(_0x4a6a8f){return _0x4a6a8f[_0x59e2('0x24')]()[_0x59e2('0x23')](function(){_0x513a01[_0x59e2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19476e,_0x431464){return function(_0x572214){if(!_0x572214){_0x19476e[_0x59e2('0x17')](0x194);}return _0x572214;};}function handleError(_0x2f6a36,_0x16d3b5){_0x16d3b5=_0x16d3b5||0x1f4;return function(_0x3d86e5){logger[_0x59e2('0x25')](_0x3d86e5[_0x59e2('0x26')]);if(_0x3d86e5['name']){delete _0x3d86e5['name'];}_0x2f6a36[_0x59e2('0x18')](_0x16d3b5)[_0x59e2('0x27')](_0x3d86e5);};}exports['index']=function(_0xe7c543,_0xe535d){var _0x8543ea={},_0x135e30={},_0x6a931={'count':0x0,'rows':[]};var _0x504aec=_[_0x59e2('0x28')](db[_0x59e2('0x29')][_0x59e2('0x2a')],function(_0x22ae42){return{'name':_0x22ae42[_0x59e2('0x2b')],'type':_0x22ae42['type'][_0x59e2('0x2c')]};});_0x135e30[_0x59e2('0x2d')]=_[_0x59e2('0x28')](_0x504aec,_0x59e2('0x2e'));_0x135e30[_0x59e2('0x2f')]=_['keys'](_0xe7c543[_0x59e2('0x2f')]);_0x135e30[_0x59e2('0x30')]=_[_0x59e2('0x31')](_0x135e30[_0x59e2('0x2d')],_0x135e30[_0x59e2('0x2f')]);_0x8543ea[_0x59e2('0x32')]=_['intersection'](_0x135e30[_0x59e2('0x2d')],qs[_0x59e2('0x33')](_0xe7c543[_0x59e2('0x2f')][_0x59e2('0x33')]));_0x8543ea[_0x59e2('0x32')]=_0x8543ea[_0x59e2('0x32')][_0x59e2('0x34')]?_0x8543ea['attributes']:_0x135e30[_0x59e2('0x2d')];if(!_0xe7c543[_0x59e2('0x2f')][_0x59e2('0x35')]('nolimit')){_0x8543ea[_0x59e2('0x1a')]=qs[_0x59e2('0x1a')](_0xe7c543[_0x59e2('0x2f')][_0x59e2('0x1a')]);_0x8543ea[_0x59e2('0x19')]=qs[_0x59e2('0x19')](_0xe7c543['query'][_0x59e2('0x19')]);}_0x8543ea['order']=qs[_0x59e2('0x36')](_0xe7c543[_0x59e2('0x2f')][_0x59e2('0x36')]);_0x8543ea[_0x59e2('0x37')]=qs['filters'](_[_0x59e2('0x38')](_0xe7c543[_0x59e2('0x2f')],_0x135e30[_0x59e2('0x30')]),_0x504aec);if(_0xe7c543['query'][_0x59e2('0x39')]){_0x8543ea[_0x59e2('0x37')]=_[_0x59e2('0x3a')](_0x8543ea[_0x59e2('0x37')],{'$or':_['map'](_0x504aec,function(_0x353965){if(_0x353965[_0x59e2('0x3b')]!==_0x59e2('0x3c')){var _0x3b931a={};_0x3b931a[_0x353965['name']]={'$like':'%'+_0xe7c543[_0x59e2('0x2f')][_0x59e2('0x39')]+'%'};return _0x3b931a;}})});}_0x8543ea=_['merge']({},_0x8543ea,_0xe7c543[_0x59e2('0x3d')]);var _0x314b1f={'where':_0x8543ea[_0x59e2('0x37')]};return db[_0x59e2('0x29')]['count'](_0x314b1f)[_0x59e2('0x23')](function(_0x398589){_0x6a931[_0x59e2('0x1c')]=_0x398589;if(_0xe7c543[_0x59e2('0x2f')][_0x59e2('0x3e')]){_0x8543ea[_0x59e2('0x3f')]=[{'all':!![]}];}return db['ZendeskField'][_0x59e2('0x40')](_0x8543ea);})[_0x59e2('0x23')](function(_0x2bed6c){_0x6a931[_0x59e2('0x41')]=_0x2bed6c;return _0x6a931;})['then'](respondWithFilteredResult(_0xe535d,_0x8543ea))[_0x59e2('0x42')](handleError(_0xe535d,null));};exports[_0x59e2('0x43')]=function(_0x48e64c,_0x57e7b4){var _0x23e32a={'raw':!![],'where':{'id':_0x48e64c[_0x59e2('0x44')]['id']}},_0x1b3d5c={};_0x1b3d5c[_0x59e2('0x2d')]=_['keys'](db[_0x59e2('0x29')][_0x59e2('0x2a')]);_0x1b3d5c[_0x59e2('0x2f')]=_['keys'](_0x48e64c[_0x59e2('0x2f')]);_0x1b3d5c[_0x59e2('0x30')]=_[_0x59e2('0x31')](_0x1b3d5c[_0x59e2('0x2d')],_0x1b3d5c[_0x59e2('0x2f')]);_0x23e32a[_0x59e2('0x32')]=_[_0x59e2('0x31')](_0x1b3d5c['model'],qs[_0x59e2('0x33')](_0x48e64c[_0x59e2('0x2f')][_0x59e2('0x33')]));_0x23e32a[_0x59e2('0x32')]=_0x23e32a[_0x59e2('0x32')][_0x59e2('0x34')]?_0x23e32a[_0x59e2('0x32')]:_0x1b3d5c[_0x59e2('0x2d')];if(_0x48e64c[_0x59e2('0x2f')][_0x59e2('0x3e')]){_0x23e32a[_0x59e2('0x3f')]=[{'all':!![]}];}_0x23e32a=_[_0x59e2('0x3a')]({},_0x23e32a,_0x48e64c[_0x59e2('0x3d')]);return db[_0x59e2('0x29')][_0x59e2('0x45')](_0x23e32a)[_0x59e2('0x23')](handleEntityNotFound(_0x57e7b4,null))[_0x59e2('0x23')](respondWithResult(_0x57e7b4,null))[_0x59e2('0x42')](handleError(_0x57e7b4,null));};exports[_0x59e2('0x46')]=function(_0x495cc7,_0x5c01ca){return db[_0x59e2('0x29')][_0x59e2('0x46')](_0x495cc7[_0x59e2('0x47')],{})[_0x59e2('0x23')](respondWithResult(_0x5c01ca,0xc9))[_0x59e2('0x42')](handleError(_0x5c01ca,null));};exports[_0x59e2('0x22')]=function(_0x2c1b95,_0x4912c9){if(_0x2c1b95['body']['id']){delete _0x2c1b95[_0x59e2('0x47')]['id'];}return db[_0x59e2('0x29')]['find']({'where':{'id':_0x2c1b95['params']['id']}})['then'](handleEntityNotFound(_0x4912c9,null))[_0x59e2('0x23')](saveUpdates(_0x2c1b95[_0x59e2('0x47')],null))['then'](respondWithResult(_0x4912c9,null))['catch'](handleError(_0x4912c9,null));};exports[_0x59e2('0x24')]=function(_0x542acb,_0x9cc464){return db[_0x59e2('0x29')][_0x59e2('0x45')]({'where':{'id':_0x542acb['params']['id']}})[_0x59e2('0x23')](handleEntityNotFound(_0x9cc464,null))[_0x59e2('0x23')](removeEntity(_0x9cc464,null))[_0x59e2('0x42')](handleError(_0x9cc464,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 5029561..2b32375 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 _0xf92c=['../../config/environment','./intZendeskField.attributes','define','int_zendesk_fields','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x251ec9,_0xe93a7f){var _0x51ed85=function(_0x48a3b2){while(--_0x48a3b2){_0x251ec9['push'](_0x251ec9['shift']());}};_0x51ed85(++_0xe93a7f);}(_0xf92c,0x68));var _0xcf92=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xf92c[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xcf92('0x0'));var util=require('util');var logger=require(_0xcf92('0x1'))(_0xcf92('0x2'));var moment=require('moment');var BPromise=require(_0xcf92('0x3'));var rp=require(_0xcf92('0x4'));var fs=require('fs');var path=require(_0xcf92('0x5'));var rimraf=require('rimraf');var config=require(_0xcf92('0x6'));var attributes=require(_0xcf92('0x7'));module['exports']=function(_0x1c4a6d,_0x487ce1){return _0x1c4a6d[_0xcf92('0x8')]('ZendeskField',attributes,{'tableName':_0xcf92('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xcf92('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa712=['ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intZendeskField.attributes','exports','define'];(function(_0x10b0b6,_0xac7d7c){var _0x27f630=function(_0x57ed9e){while(--_0x57ed9e){_0x10b0b6['push'](_0x10b0b6['shift']());}};_0x27f630(++_0xac7d7c);}(_0xa712,0x113));var _0x2a71=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0xa712[_0x2e3dfc];return _0x4b1245;};'use strict';var _=require(_0x2a71('0x0'));var util=require('util');var logger=require(_0x2a71('0x1'))(_0x2a71('0x2'));var moment=require(_0x2a71('0x3'));var BPromise=require(_0x2a71('0x4'));var rp=require(_0x2a71('0x5'));var fs=require('fs');var path=require(_0x2a71('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2a71('0x7'));module[_0x2a71('0x8')]=function(_0x377810,_0x41e5a8){return _0x377810[_0x2a71('0x9')](_0x2a71('0xa'),attributes,{'tableName':_0x2a71('0xb'),'paranoid':![],'indexes':[{'name':_0x2a71('0xc'),'fields':[_0x2a71('0xd'),_0x2a71('0xe')],'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 3ce0ea6..a8a3548 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 _0x4f9a=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x3cbc6d,_0xff2325){var _0x340b4e=function(_0x3efaad){while(--_0x3efaad){_0x3cbc6d['push'](_0x3cbc6d['shift']());}};_0x340b4e(++_0xff2325);}(_0x4f9a,0x11e));var _0xa4f9=function(_0x492a9f,_0x28752e){_0x492a9f=_0x492a9f-0x0;var _0xa72548=_0x4f9a[_0x492a9f];return _0xa72548;};'use strict';var _=require(_0xa4f9('0x0'));var util=require(_0xa4f9('0x1'));var moment=require('moment');var BPromise=require(_0xa4f9('0x2'));var rs=require(_0xa4f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4f9('0x4'))['db'];var utils=require(_0xa4f9('0x5'));var logger=require(_0xa4f9('0x6'))(_0xa4f9('0x7'));var config=require(_0xa4f9('0x8'));var jayson=require(_0xa4f9('0x9'));var client=jayson[_0xa4f9('0xa')][_0xa4f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x524117,_0x530393,_0x1eb03d){return new BPromise(function(_0x5c2076,_0xf84733){return client[_0xa4f9('0xc')](_0x524117,_0x1eb03d)['then'](function(_0x2e3260){logger['info'](_0xa4f9('0xd'),_0x530393,_0xa4f9('0xe'));logger[_0xa4f9('0xf')](_0xa4f9('0x10'),_0x530393,'request\x20sent',JSON[_0xa4f9('0x11')](_0x2e3260));if(_0x2e3260[_0xa4f9('0x12')]){if(_0x2e3260['error'][_0xa4f9('0x13')]===0x1f4){logger[_0xa4f9('0x12')](_0xa4f9('0xd'),_0x530393,_0x2e3260[_0xa4f9('0x12')][_0xa4f9('0x14')]);return _0xf84733(_0x2e3260[_0xa4f9('0x12')]['message']);}logger[_0xa4f9('0x12')](_0xa4f9('0xd'),_0x530393,_0x2e3260['error'][_0xa4f9('0x14')]);return _0x5c2076(_0x2e3260[_0xa4f9('0x12')][_0xa4f9('0x14')]);}else{logger[_0xa4f9('0x15')](_0xa4f9('0xd'),_0x530393,_0xa4f9('0xe'));_0x5c2076(_0x2e3260[_0xa4f9('0x16')][_0xa4f9('0x14')]);}})[_0xa4f9('0x17')](function(_0x332e4a){logger[_0xa4f9('0x12')](_0xa4f9('0xd'),_0x530393,_0x332e4a);_0xf84733(_0x332e4a);});});} \ No newline at end of file +var _0xc1a0=['request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x6e51f1,_0x11371a){var _0x141b4c=function(_0x2e85e7){while(--_0x2e85e7){_0x6e51f1['push'](_0x6e51f1['shift']());}};_0x141b4c(++_0x11371a);}(_0xc1a0,0x8f));var _0x0c1a=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xc1a0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0c1a('0x0'));var util=require(_0x0c1a('0x1'));var moment=require(_0x0c1a('0x2'));var BPromise=require(_0x0c1a('0x3'));var rs=require(_0x0c1a('0x4'));var fs=require('fs');var Redis=require(_0x0c1a('0x5'));var db=require(_0x0c1a('0x6'))['db'];var utils=require(_0x0c1a('0x7'));var logger=require('../../config/logger')(_0x0c1a('0x8'));var config=require(_0x0c1a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0c1a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x95b799,_0x122e0e,_0x435fee){return new BPromise(function(_0x137099,_0x1da700){return client[_0x0c1a('0xb')](_0x95b799,_0x435fee)['then'](function(_0x3cf025){logger[_0x0c1a('0xc')](_0x0c1a('0xd'),_0x122e0e,_0x0c1a('0xe'));logger[_0x0c1a('0xf')](_0x0c1a('0x10'),_0x122e0e,_0x0c1a('0xe'),JSON[_0x0c1a('0x11')](_0x3cf025));if(_0x3cf025[_0x0c1a('0x12')]){if(_0x3cf025[_0x0c1a('0x12')][_0x0c1a('0x13')]===0x1f4){logger[_0x0c1a('0x12')](_0x0c1a('0xd'),_0x122e0e,_0x3cf025[_0x0c1a('0x12')][_0x0c1a('0x14')]);return _0x1da700(_0x3cf025[_0x0c1a('0x12')][_0x0c1a('0x14')]);}logger[_0x0c1a('0x12')](_0x0c1a('0xd'),_0x122e0e,_0x3cf025[_0x0c1a('0x12')][_0x0c1a('0x14')]);return _0x137099(_0x3cf025[_0x0c1a('0x12')]['message']);}else{logger[_0x0c1a('0xc')]('ZendeskField,\x20%s,\x20%s',_0x122e0e,'request\x20sent');_0x137099(_0x3cf025[_0x0c1a('0x15')][_0x0c1a('0x14')]);}})['catch'](function(_0x21349f){logger[_0x0c1a('0x12')](_0x0c1a('0xd'),_0x122e0e,_0x21349f);_0x1da700(_0x21349f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 50b9f25..8d61f48 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 _0x7730=['addConfiguration','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post'];(function(_0x152215,_0x263ce){var _0x38e93a=function(_0x42c092){while(--_0x42c092){_0x152215['push'](_0x152215['shift']());}};_0x38e93a(++_0x263ce);}(_0x7730,0x17e));var _0x0773=function(_0x1138c4,_0x841d33){_0x1138c4=_0x1138c4-0x0;var _0x200cc1=_0x7730[_0x1138c4];return _0x200cc1;};'use strict';var multer=require(_0x0773('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0773('0x1'));var express=require(_0x0773('0x2'));var router=express[_0x0773('0x3')]();var fs_extra=require(_0x0773('0x4'));var auth=require(_0x0773('0x5'));var interaction=require(_0x0773('0x6'));var config=require(_0x0773('0x7'));var controller=require('./intZohoAccount.controller');router[_0x0773('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0773('0x8')](_0x0773('0x9'),auth['isAuthenticated'](),controller[_0x0773('0xa')]);router[_0x0773('0x8')](_0x0773('0xb'),auth[_0x0773('0xc')](),controller[_0x0773('0xd')]);router['get'](_0x0773('0xe'),auth[_0x0773('0xc')](),controller[_0x0773('0xf')]);router[_0x0773('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0773('0x10')](_0x0773('0xb'),auth['isAuthenticated'](),controller[_0x0773('0x11')]);router['put'](_0x0773('0x9'),auth['isAuthenticated'](),controller[_0x0773('0x12')]);router[_0x0773('0x13')](_0x0773('0x9'),auth[_0x0773('0xc')](),controller[_0x0773('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa3eb=['/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xa3eb,0x93));var _0xba3e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa3eb[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var path=require(_0xba3e('0x2'));var timeout=require(_0xba3e('0x3'));var express=require('express');var router=express[_0xba3e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xba3e('0x5'));var config=require(_0xba3e('0x6'));var controller=require(_0xba3e('0x7'));router[_0xba3e('0x8')]('/',auth[_0xba3e('0x9')](),controller[_0xba3e('0xa')]);router['get'](_0xba3e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xba3e('0x8')](_0xba3e('0xc'),auth[_0xba3e('0x9')](),controller[_0xba3e('0xd')]);router['get'](_0xba3e('0xe'),auth[_0xba3e('0x9')](),controller[_0xba3e('0xf')]);router[_0xba3e('0x10')]('/',auth[_0xba3e('0x9')](),controller[_0xba3e('0x11')]);router['post'](_0xba3e('0xc'),auth['isAuthenticated'](),controller[_0xba3e('0x12')]);router[_0xba3e('0x13')]('/:id',auth[_0xba3e('0x9')](),controller[_0xba3e('0x14')]);router['delete']('/:id',auth[_0xba3e('0x9')](),controller[_0xba3e('0x15')]);module[_0xba3e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 79363f0..7d633ed 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 _0x9a19=['sequelize','exports','STRING'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x9a19,0x114));var _0x99a1=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x9a19[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'name':{'type':Sequelize[_0x99a1('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x99a1('0x2')]},'zone':{'type':Sequelize[_0x99a1('0x2')]},'clientId':{'type':Sequelize[_0x99a1('0x2')]},'clientSecret':{'type':Sequelize[_0x99a1('0x2')]},'serverUrl':{'type':Sequelize[_0x99a1('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x99a1('0x2')]},'refreshToken':{'type':Sequelize[_0x99a1('0x2')]}}; \ No newline at end of file +var _0x750a=['exports','STRING'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x750a,0x140));var _0xa750=function(_0x1d62a2,_0x19bb37){_0x1d62a2=_0x1d62a2-0x0;var _0x2f32fb=_0x750a[_0x1d62a2];return _0x2f32fb;};'use strict';var Sequelize=require('sequelize');module[_0xa750('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa750('0x1')]},'zone':{'type':Sequelize[_0xa750('0x1')]},'clientId':{'type':Sequelize[_0xa750('0x1')]},'clientSecret':{'type':Sequelize[_0xa750('0x1')]},'serverUrl':{'type':Sequelize[_0xa750('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xa750('0x1')]},'refreshToken':{'type':Sequelize[_0xa750('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 6af0c66..c540b19 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 _0xbc90=['name','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','type','filter','options','ZohoAccount','includeAll','include','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','ZohoConfiguration','order','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','com','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack'];(function(_0x33be9d,_0x41618e){var _0x4a9267=function(_0x4f0e70){while(--_0x4f0e70){_0x33be9d['push'](_0x33be9d['shift']());}};_0x4a9267(++_0x41618e);}(_0xbc90,0x1e5));var _0x0bc9=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xbc90[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bc9('0x0'));var zipdir=require(_0x0bc9('0x1'));var jsonpatch=require(_0x0bc9('0x2'));var rp=require('request-promise');var moment=require(_0x0bc9('0x3'));var BPromise=require(_0x0bc9('0x4'));var Mustache=require(_0x0bc9('0x5'));var util=require(_0x0bc9('0x6'));var path=require(_0x0bc9('0x7'));var sox=require(_0x0bc9('0x8'));var csv=require(_0x0bc9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0bc9('0xa'));var squel=require(_0x0bc9('0xb'));var crypto=require('crypto');var jsforce=require(_0x0bc9('0xc'));var deskjs=require(_0x0bc9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0bc9('0xe'));var Papa=require(_0x0bc9('0xf'));var Redis=require(_0x0bc9('0x10'));var authService=require(_0x0bc9('0x11'));var qs=require(_0x0bc9('0x12'));var as=require(_0x0bc9('0x13'));var hardwareService=require(_0x0bc9('0x14'));var logger=require(_0x0bc9('0x15'))(_0x0bc9('0x16'));var utils=require('../../config/utils');var config=require(_0x0bc9('0x17'));var licenseUtil=require(_0x0bc9('0x18'));var db=require(_0x0bc9('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3d45e3,_0x17475b){_0x17475b=_0x17475b||0xcc;return function(_0x201a9e){if(_0x201a9e){return _0x3d45e3['sendStatus'](_0x17475b);}return _0x3d45e3[_0x0bc9('0x1a')](_0x17475b)[_0x0bc9('0x1b')]();};}function respondWithResult(_0x55fbd8,_0x18a6f7){_0x18a6f7=_0x18a6f7||0xc8;return function(_0x546b61){if(_0x546b61){return _0x55fbd8[_0x0bc9('0x1a')](_0x18a6f7)['json'](_0x546b61);}};}function respondWithFilteredResult(_0x10fabc,_0x508240){return function(_0x18c028){if(_0x18c028){var _0x20a886=typeof _0x508240['offset']==='undefined'&&typeof _0x508240[_0x0bc9('0x1c')]===_0x0bc9('0x1d');var _0x16966a=_0x18c028[_0x0bc9('0x1e')];var _0x4f413a=_0x20a886?0x0:_0x508240[_0x0bc9('0x1f')];var _0x355ed0=_0x20a886?_0x18c028[_0x0bc9('0x1e')]:_0x508240['offset']+_0x508240[_0x0bc9('0x1c')];var _0x1ed411;if(_0x355ed0>=_0x16966a){_0x355ed0=_0x16966a;_0x1ed411=0xc8;}else{_0x1ed411=0xce;}_0x10fabc[_0x0bc9('0x1a')](_0x1ed411);return _0x10fabc[_0x0bc9('0x20')](_0x0bc9('0x21'),_0x4f413a+'-'+_0x355ed0+'/'+_0x16966a)[_0x0bc9('0x22')](_0x18c028);}return null;};}function patchUpdates(_0x45c84d){return function(_0x13e00b){try{jsonpatch[_0x0bc9('0x23')](_0x13e00b,_0x45c84d,!![]);}catch(_0xd2eae1){return BPromise[_0x0bc9('0x24')](_0xd2eae1);}return _0x13e00b['save']();};}function saveUpdates(_0x143e4e,_0x20a037){return function(_0x324415){if(_0x324415){return _0x324415[_0x0bc9('0x25')](_0x143e4e)[_0x0bc9('0x26')](function(_0x20c2e7){return _0x20c2e7;});}return null;};}function removeEntity(_0x168252,_0x2909dc){return function(_0x535d5c){if(_0x535d5c){return _0x535d5c[_0x0bc9('0x27')]()['then'](function(){_0x168252[_0x0bc9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208fa4,_0x27bc7a){return function(_0x296815){if(!_0x296815){_0x208fa4[_0x0bc9('0x28')](0x194);}return _0x296815;};}function handleError(_0x1f4b6,_0x2763c4){_0x2763c4=_0x2763c4||0x1f4;return function(_0x6ab6da){logger[_0x0bc9('0x29')](_0x6ab6da[_0x0bc9('0x2a')]);if(_0x6ab6da[_0x0bc9('0x2b')]){delete _0x6ab6da[_0x0bc9('0x2b')];}_0x1f4b6[_0x0bc9('0x1a')](_0x2763c4)['send'](_0x6ab6da);};}exports[_0x0bc9('0x2c')]=function(_0x46d00a,_0x49bb9c){var _0x569f4a={},_0x13d885={},_0x4b8ab5={'count':0x0,'rows':[]};var _0x5eb1f2=_[_0x0bc9('0x2d')](db['ZohoAccount'][_0x0bc9('0x2e')],function(_0x572099){return{'name':_0x572099[_0x0bc9('0x2f')],'type':_0x572099['type'][_0x0bc9('0x30')]};});_0x13d885['model']=_[_0x0bc9('0x2d')](_0x5eb1f2,_0x0bc9('0x2b'));_0x13d885[_0x0bc9('0x31')]=_['keys'](_0x46d00a[_0x0bc9('0x31')]);_0x13d885[_0x0bc9('0x32')]=_[_0x0bc9('0x33')](_0x13d885[_0x0bc9('0x34')],_0x13d885[_0x0bc9('0x31')]);_0x569f4a[_0x0bc9('0x35')]=_['intersection'](_0x13d885[_0x0bc9('0x34')],qs[_0x0bc9('0x36')](_0x46d00a[_0x0bc9('0x31')][_0x0bc9('0x36')]));_0x569f4a[_0x0bc9('0x35')]=_0x569f4a['attributes'][_0x0bc9('0x37')]?_0x569f4a[_0x0bc9('0x35')]:_0x13d885[_0x0bc9('0x34')];if(!_0x46d00a[_0x0bc9('0x31')][_0x0bc9('0x38')]('nolimit')){_0x569f4a[_0x0bc9('0x1c')]=qs[_0x0bc9('0x1c')](_0x46d00a[_0x0bc9('0x31')][_0x0bc9('0x1c')]);_0x569f4a[_0x0bc9('0x1f')]=qs[_0x0bc9('0x1f')](_0x46d00a['query'][_0x0bc9('0x1f')]);}_0x569f4a['order']=qs['sort'](_0x46d00a[_0x0bc9('0x31')][_0x0bc9('0x39')]);_0x569f4a[_0x0bc9('0x3a')]=qs['filters'](_[_0x0bc9('0x3b')](_0x46d00a[_0x0bc9('0x31')],_0x13d885[_0x0bc9('0x32')]),_0x5eb1f2);if(_0x46d00a[_0x0bc9('0x31')]['filter']){_0x569f4a['where']=_[_0x0bc9('0x3c')](_0x569f4a[_0x0bc9('0x3a')],{'$or':_[_0x0bc9('0x2d')](_0x5eb1f2,function(_0x41264c){if(_0x41264c[_0x0bc9('0x3d')]!=='VIRTUAL'){var _0x33f44d={};_0x33f44d[_0x41264c[_0x0bc9('0x2b')]]={'$like':'%'+_0x46d00a['query'][_0x0bc9('0x3e')]+'%'};return _0x33f44d;}})});}_0x569f4a=_['merge']({},_0x569f4a,_0x46d00a[_0x0bc9('0x3f')]);var _0x154afb={'where':_0x569f4a['where']};return db[_0x0bc9('0x40')][_0x0bc9('0x1e')](_0x154afb)[_0x0bc9('0x26')](function(_0x2b3cab){_0x4b8ab5['count']=_0x2b3cab;if(_0x46d00a[_0x0bc9('0x31')][_0x0bc9('0x41')]){_0x569f4a[_0x0bc9('0x42')]=[{'all':!![]}];}return db[_0x0bc9('0x40')]['findAll'](_0x569f4a);})[_0x0bc9('0x26')](function(_0x479ada){_0x4b8ab5[_0x0bc9('0x43')]=_0x479ada;return _0x4b8ab5;})[_0x0bc9('0x26')](respondWithFilteredResult(_0x49bb9c,_0x569f4a))[_0x0bc9('0x44')](handleError(_0x49bb9c,null));};exports[_0x0bc9('0x45')]=function(_0x2c5e5a,_0x30b345){var _0x35084c={'raw':![],'where':{'id':_0x2c5e5a[_0x0bc9('0x46')]['id']}},_0x5a77ef={};_0x5a77ef[_0x0bc9('0x34')]=_[_0x0bc9('0x47')](db['ZohoAccount']['rawAttributes']);_0x5a77ef['query']=_[_0x0bc9('0x47')](_0x2c5e5a['query']);_0x5a77ef[_0x0bc9('0x32')]=_[_0x0bc9('0x33')](_0x5a77ef[_0x0bc9('0x34')],_0x5a77ef['query']);_0x35084c[_0x0bc9('0x35')]=_[_0x0bc9('0x33')](_0x5a77ef[_0x0bc9('0x34')],qs['fields'](_0x2c5e5a[_0x0bc9('0x31')][_0x0bc9('0x36')]));_0x35084c['attributes']=_0x35084c[_0x0bc9('0x35')][_0x0bc9('0x37')]?_0x35084c['attributes']:_0x5a77ef[_0x0bc9('0x34')];if(_0x2c5e5a[_0x0bc9('0x31')][_0x0bc9('0x41')]){_0x35084c[_0x0bc9('0x42')]=[{'all':!![]}];}_0x35084c=_[_0x0bc9('0x3c')]({},_0x35084c,_0x2c5e5a[_0x0bc9('0x3f')]);return db[_0x0bc9('0x40')][_0x0bc9('0x48')](_0x35084c)[_0x0bc9('0x26')](handleEntityNotFound(_0x30b345,null))[_0x0bc9('0x26')](respondWithResult(_0x30b345,null))[_0x0bc9('0x44')](handleError(_0x30b345,null));};exports[_0x0bc9('0x49')]=function(_0x7b9caa,_0x13439d){return db[_0x0bc9('0x40')]['create'](_0x7b9caa[_0x0bc9('0x4a')],{})['then'](respondWithResult(_0x13439d,0xc9))['catch'](handleError(_0x13439d,null));};exports[_0x0bc9('0x25')]=function(_0x3bf14d,_0x49a7d4){if(_0x3bf14d[_0x0bc9('0x4a')]['id']){delete _0x3bf14d['body']['id'];}return db['ZohoAccount'][_0x0bc9('0x48')]({'where':{'id':_0x3bf14d['params']['id']}})[_0x0bc9('0x26')](handleEntityNotFound(_0x49a7d4,null))['then'](saveUpdates(_0x3bf14d['body'],null))['then'](respondWithResult(_0x49a7d4,null))['catch'](handleError(_0x49a7d4,null));};exports[_0x0bc9('0x27')]=function(_0x1ca08c,_0x3f85f7){return db[_0x0bc9('0x40')][_0x0bc9('0x48')]({'where':{'id':_0x1ca08c[_0x0bc9('0x46')]['id']}})[_0x0bc9('0x26')](handleEntityNotFound(_0x3f85f7,null))['then'](removeEntity(_0x3f85f7,null))[_0x0bc9('0x44')](handleError(_0x3f85f7,null));};exports[_0x0bc9('0x4b')]=function(_0x243d67,_0x2dcc74,_0x3bf47b){var _0x12e1b6={};var _0xaac578={};var _0x6b6be1;var _0x2aacbe;return db['ZohoAccount'][_0x0bc9('0x4c')]({'where':{'id':_0x243d67[_0x0bc9('0x46')]['id']}})[_0x0bc9('0x26')](handleEntityNotFound(_0x2dcc74,null))[_0x0bc9('0x26')](function(_0x54e2c3){if(_0x54e2c3){_0x6b6be1=_0x54e2c3;_0xaac578[_0x0bc9('0x34')]=_[_0x0bc9('0x47')](db[_0x0bc9('0x4d')][_0x0bc9('0x2e')]);_0xaac578[_0x0bc9('0x31')]=_[_0x0bc9('0x47')](_0x243d67[_0x0bc9('0x31')]);_0xaac578[_0x0bc9('0x32')]=_[_0x0bc9('0x33')](_0xaac578[_0x0bc9('0x34')],_0xaac578[_0x0bc9('0x31')]);_0x12e1b6[_0x0bc9('0x35')]=_[_0x0bc9('0x33')](_0xaac578['model'],qs['fields'](_0x243d67[_0x0bc9('0x31')][_0x0bc9('0x36')]));_0x12e1b6[_0x0bc9('0x35')]=_0x12e1b6[_0x0bc9('0x35')]['length']?_0x12e1b6[_0x0bc9('0x35')]:_0xaac578[_0x0bc9('0x34')];_0x12e1b6[_0x0bc9('0x4e')]=qs[_0x0bc9('0x39')](_0x243d67[_0x0bc9('0x31')]['sort']);_0x12e1b6[_0x0bc9('0x3a')]=qs[_0x0bc9('0x32')](_[_0x0bc9('0x3b')](_0x243d67[_0x0bc9('0x31')],_0xaac578[_0x0bc9('0x32')]));if(_0x243d67[_0x0bc9('0x31')][_0x0bc9('0x3e')]){_0x12e1b6[_0x0bc9('0x3a')]=_[_0x0bc9('0x3c')](_0x12e1b6[_0x0bc9('0x3a')],{'$or':_[_0x0bc9('0x2d')](_0x12e1b6[_0x0bc9('0x35')],function(_0x5edba9){var _0x5b40f5={};_0x5b40f5[_0x5edba9]={'$like':'%'+_0x243d67['query']['filter']+'%'};return _0x5b40f5;})});}_0x12e1b6=_[_0x0bc9('0x3c')]({},_0x12e1b6,_0x243d67[_0x0bc9('0x3f')]);return _0x6b6be1[_0x0bc9('0x4b')](_0x12e1b6);}})[_0x0bc9('0x26')](function(_0x269ec8){if(_0x269ec8){_0x2aacbe=_0x269ec8['length'];if(!_0x243d67[_0x0bc9('0x31')][_0x0bc9('0x38')](_0x0bc9('0x4f'))){_0x12e1b6['limit']=qs[_0x0bc9('0x1c')](_0x243d67[_0x0bc9('0x31')][_0x0bc9('0x1c')]);_0x12e1b6[_0x0bc9('0x1f')]=qs[_0x0bc9('0x1f')](_0x243d67[_0x0bc9('0x31')]['offset']);}return _0x6b6be1[_0x0bc9('0x4b')](_0x12e1b6);}})[_0x0bc9('0x26')](function(_0x250b21){if(_0x250b21){return _0x250b21?{'count':_0x2aacbe,'rows':_0x250b21}:null;}})['then'](respondWithResult(_0x2dcc74,null))[_0x0bc9('0x44')](handleError(_0x2dcc74,null));};exports['addConfiguration']=function(_0x15085a,_0x59ed02,_0x405ee9){if(_0x15085a['body']['id']){delete _0x15085a[_0x0bc9('0x4a')]['id'];}return db[_0x0bc9('0x40')][_0x0bc9('0x4c')]({'where':{'id':_0x15085a[_0x0bc9('0x46')]['id']}})[_0x0bc9('0x26')](handleEntityNotFound(_0x59ed02,null))[_0x0bc9('0x26')](function(_0x4f6c03){if(_0x4f6c03){_0x15085a[_0x0bc9('0x4a')][_0x0bc9('0x50')]=_0x4f6c03['id'];_0x15085a[_0x0bc9('0x4a')][_0x0bc9('0x51')]=integrations[_0x0bc9('0x52')](_0x15085a[_0x0bc9('0x4a')][_0x0bc9('0x53')],_0x15085a[_0x0bc9('0x4a')][_0x0bc9('0x3d')]);_0x15085a[_0x0bc9('0x4a')][_0x0bc9('0x54')]=integrations['getDescriptions'](_0x15085a[_0x0bc9('0x4a')][_0x0bc9('0x53')],_0x15085a[_0x0bc9('0x4a')][_0x0bc9('0x3d')]);return db[_0x0bc9('0x4d')][_0x0bc9('0x49')](_0x15085a['body'],{'include':[{'model':db[_0x0bc9('0x55')],'as':_0x0bc9('0x51')},{'model':db[_0x0bc9('0x55')],'as':'Descriptions'}]});}return null;})[_0x0bc9('0x26')](respondWithResult(_0x59ed02,null))['catch'](handleError(_0x59ed02,null));};function getAccessToken(_0x2a09cc){return new Promise(function(_0x4e5f64,_0x35917b){var _0x402211;switch(_0x2a09cc[_0x0bc9('0x56')]){case'US':_0x402211=_0x0bc9('0x57');break;case'AU':_0x402211=_0x0bc9('0x58');break;case'EU':_0x402211=_0x0bc9('0x59');break;case'IN':_0x402211='https://accounts.zoho.in';break;case'CN':_0x402211=_0x0bc9('0x5a');break;default:_0x402211=_0x0bc9('0x59');break;}var _0xece9f5={'method':_0x0bc9('0x5b'),'uri':_0x402211+_0x0bc9('0x5c'),'qs':{'refresh_token':_0x2a09cc[_0x0bc9('0x5d')],'client_id':_0x2a09cc[_0x0bc9('0x5e')],'client_secret':_0x2a09cc[_0x0bc9('0x5f')],'grant_type':_0x0bc9('0x60')},'json':!![]};return rp(_0xece9f5)[_0x0bc9('0x26')](function(_0x16453c){if(_0x16453c[_0x0bc9('0x61')]){_0x4e5f64(_0x16453c[_0x0bc9('0x61')]);}else{_0x35917b(_0x0bc9('0x62'));}})[_0x0bc9('0x44')](function(_0x4c44a8){_0x35917b(_0x4c44a8);});});}exports[_0x0bc9('0x63')]=function(_0x27f097,_0x11fef1,_0x1389af){var _0x45229b,_0x3932e0,_0x39c164,_0x4648aa,_0x4397ea;return db[_0x0bc9('0x40')][_0x0bc9('0x4c')]({'where':{'id':_0x27f097['params']['id']},'attributes':['id',_0x0bc9('0x64'),_0x0bc9('0x56'),_0x0bc9('0x5e'),_0x0bc9('0x5f'),_0x0bc9('0x65'),_0x0bc9('0x66'),_0x0bc9('0x5d')]})[_0x0bc9('0x26')](handleEntityNotFound(_0x11fef1,null))[_0x0bc9('0x26')](function(_0x17b2a3){_0x4397ea=_0x17b2a3;_0x45229b=_0x4397ea[_0x0bc9('0x64')];_0x3932e0=_0x45229b==='zoho.eu'?'eu':_0x0bc9('0x67');_0x39c164=_0x4397ea['serverUrl'];var _0x5a1d43=_0x39c164[_0x0bc9('0x68')](-0x1);if(_0x5a1d43==='/'||_0x5a1d43==='\x5c'||_0x5a1d43===':'){_0x39c164=_0x39c164['substring'](0x0,_0x39c164['lastIndexOf'](_0x5a1d43));}if(!_0x4397ea[_0x0bc9('0x5d')]){throw new Error(_0x0bc9('0x69'));}return getAccessToken(_0x4397ea);})[_0x0bc9('0x26')](function(_0x4f85d8){if(_0x4f85d8){return rp({'method':_0x0bc9('0x6a'),'uri':util[_0x0bc9('0x6b')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3932e0),'qs':{'module':_0x0bc9('0x6c')},'headers':{'Authorization':_0x0bc9('0x6d')+_0x4f85d8},'json':!![]});}})['then'](function(_0x4a7d9d){if(_0x4a7d9d){if(_0x4a7d9d['response']&&_0x4a7d9d[_0x0bc9('0x6e')]['error']){throw new Error(_0x4a7d9d[_0x0bc9('0x6e')][_0x0bc9('0x29')][_0x0bc9('0x6f')]);}var _0x46c862=[];var _0x2c9379=[];var _0x2d08a7=[_0x0bc9('0x70'),_0x0bc9('0x71'),_0x0bc9('0x72'),'WhoId',_0x0bc9('0x73'),_0x0bc9('0x74'),'Call_Start_Time',_0x0bc9('0x75')];_0x2c9379=_[_0x0bc9('0x76')](_0x4a7d9d[_0x0bc9('0x36')],function(_0x3fecd1){return _0x2d08a7[_0x0bc9('0x77')](_0x3fecd1[_0x0bc9('0x78')]);});for(var _0x491da1=0x0;_0x491da1<_0x2c9379[_0x0bc9('0x37')];_0x491da1++){if(_0x2c9379[_0x491da1][_0x0bc9('0x79')]===![]){_0x46c862[_0x0bc9('0x7a')]({'id':_0x2c9379[_0x491da1]['id'],'name':_0x2c9379[_0x491da1][_0x0bc9('0x7b')],'custom':_0x2c9379[_0x491da1]['custom_field'],'options':_0x2c9379[_0x491da1][_0x0bc9('0x7c')]===_0x0bc9('0x7d')&&_0x2c9379[_0x491da1][_0x0bc9('0x7e')][_0x0bc9('0x37')]>-0x1?_[_0x0bc9('0x2d')](_0x2c9379[_0x491da1]['pick_list_values'],function(_0x5459f6){return{'name':_0x5459f6,'value':_0x5459f6};}):[]});}}return{'count':_0x46c862[_0x0bc9('0x37')],'rows':_0x46c862};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x11fef1,null))[_0x0bc9('0x44')](function(_0x4d2504){var _0x579ad6=_0x27f097[_0x0bc9('0x31')][_0x0bc9('0x7f')]?0x1f4:_0x4d2504[_0x0bc9('0x80')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x0bc9('0x63'),_0x579ad6,JSON[_0x0bc9('0x81')](_0x4d2504));delete _0x4d2504[_0x0bc9('0x2b')];if(_0x579ad6===0x191){_0x579ad6=0x190;}_0x11fef1[_0x0bc9('0x1a')](_0x579ad6)[_0x0bc9('0x82')](_0x27f097[_0x0bc9('0x31')][_0x0bc9('0x7f')]?{'message':_0x0bc9('0x83'),'statusCode':_0x4d2504['statusCode']}:_0x4d2504);});}; \ No newline at end of file +var _0xea0b=['eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','map','ZohoAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','keys','length','find','create','body','params','getConfigurations','findOne','order','pick','addConfiguration','getSubjects','channel','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','zoho.eu','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials'];(function(_0x216de3,_0x493488){var _0x726050=function(_0x491472){while(--_0x491472){_0x216de3['push'](_0x216de3['shift']());}};_0x726050(++_0x493488);}(_0xea0b,0xfa));var _0xbea0=function(_0x1f8f6e,_0x16f2fc){_0x1f8f6e=_0x1f8f6e-0x0;var _0x5329a9=_0xea0b[_0x1f8f6e];return _0x5329a9;};'use strict';var emlformat=require(_0xbea0('0x0'));var rimraf=require(_0xbea0('0x1'));var zipdir=require(_0xbea0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbea0('0x3'));var moment=require(_0xbea0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbea0('0x5'));var util=require(_0xbea0('0x6'));var path=require(_0xbea0('0x7'));var sox=require(_0xbea0('0x8'));var csv=require(_0xbea0('0x9'));var ejs=require(_0xbea0('0xa'));var fs=require('fs');var fs_extra=require(_0xbea0('0xb'));var _=require(_0xbea0('0xc'));var squel=require(_0xbea0('0xd'));var crypto=require(_0xbea0('0xe'));var jsforce=require(_0xbea0('0xf'));var deskjs=require(_0xbea0('0x10'));var toCsv=require(_0xbea0('0x9'));var querystring=require(_0xbea0('0x11'));var Papa=require(_0xbea0('0x12'));var Redis=require(_0xbea0('0x13'));var authService=require(_0xbea0('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbea0('0x15'));var hardwareService=require(_0xbea0('0x16'));var logger=require('../../config/logger')(_0xbea0('0x17'));var utils=require(_0xbea0('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbea0('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x27d7ad,_0x2cd6b2){_0x2cd6b2=_0x2cd6b2||0xcc;return function(_0x15db00){if(_0x15db00){return _0x27d7ad[_0xbea0('0x1a')](_0x2cd6b2);}return _0x27d7ad[_0xbea0('0x1b')](_0x2cd6b2)[_0xbea0('0x1c')]();};}function respondWithResult(_0x47ae6e,_0x5a064e){_0x5a064e=_0x5a064e||0xc8;return function(_0x506f60){if(_0x506f60){return _0x47ae6e['status'](_0x5a064e)[_0xbea0('0x1d')](_0x506f60);}};}function respondWithFilteredResult(_0x3e0fd4,_0x537a1f){return function(_0x11543e){if(_0x11543e){var _0x3cc563=typeof _0x537a1f[_0xbea0('0x1e')]===_0xbea0('0x1f')&&typeof _0x537a1f[_0xbea0('0x20')]===_0xbea0('0x1f');var _0x5cc8a9=_0x11543e[_0xbea0('0x21')];var _0x1bc4e3=_0x3cc563?0x0:_0x537a1f['offset'];var _0x372771=_0x3cc563?_0x11543e['count']:_0x537a1f[_0xbea0('0x1e')]+_0x537a1f[_0xbea0('0x20')];var _0xa963a6;if(_0x372771>=_0x5cc8a9){_0x372771=_0x5cc8a9;_0xa963a6=0xc8;}else{_0xa963a6=0xce;}_0x3e0fd4[_0xbea0('0x1b')](_0xa963a6);return _0x3e0fd4[_0xbea0('0x22')](_0xbea0('0x23'),_0x1bc4e3+'-'+_0x372771+'/'+_0x5cc8a9)[_0xbea0('0x1d')](_0x11543e);}return null;};}function patchUpdates(_0x4a1372){return function(_0x109ef4){try{jsonpatch[_0xbea0('0x24')](_0x109ef4,_0x4a1372,!![]);}catch(_0x2a6a21){return BPromise['reject'](_0x2a6a21);}return _0x109ef4['save']();};}function saveUpdates(_0x128a90,_0x38937f){return function(_0x6bf15){if(_0x6bf15){return _0x6bf15[_0xbea0('0x25')](_0x128a90)[_0xbea0('0x26')](function(_0x3daf8c){return _0x3daf8c;});}return null;};}function removeEntity(_0x28e4b9,_0xe9401){return function(_0x4bde09){if(_0x4bde09){return _0x4bde09[_0xbea0('0x27')]()['then'](function(){_0x28e4b9['status'](0xcc)[_0xbea0('0x1c')]();});}};}function handleEntityNotFound(_0x34101e,_0x37b0bf){return function(_0x500abb){if(!_0x500abb){_0x34101e[_0xbea0('0x1a')](0x194);}return _0x500abb;};}function handleError(_0x2975e3,_0x353bd9){_0x353bd9=_0x353bd9||0x1f4;return function(_0x1e8981){logger[_0xbea0('0x28')](_0x1e8981[_0xbea0('0x29')]);if(_0x1e8981[_0xbea0('0x2a')]){delete _0x1e8981[_0xbea0('0x2a')];}_0x2975e3[_0xbea0('0x1b')](_0x353bd9)[_0xbea0('0x2b')](_0x1e8981);};}exports['index']=function(_0x2317cc,_0x560f6a){var _0x20947b={},_0x384386={},_0x2811bc={'count':0x0,'rows':[]};var _0x2d7e61=_[_0xbea0('0x2c')](db[_0xbea0('0x2d')][_0xbea0('0x2e')],function(_0x54fb3b){return{'name':_0x54fb3b['fieldName'],'type':_0x54fb3b[_0xbea0('0x2f')][_0xbea0('0x30')]};});_0x384386[_0xbea0('0x31')]=_[_0xbea0('0x2c')](_0x2d7e61,_0xbea0('0x2a'));_0x384386[_0xbea0('0x32')]=_['keys'](_0x2317cc[_0xbea0('0x32')]);_0x384386['filters']=_[_0xbea0('0x33')](_0x384386[_0xbea0('0x31')],_0x384386[_0xbea0('0x32')]);_0x20947b[_0xbea0('0x34')]=_[_0xbea0('0x33')](_0x384386[_0xbea0('0x31')],qs['fields'](_0x2317cc[_0xbea0('0x32')][_0xbea0('0x35')]));_0x20947b[_0xbea0('0x34')]=_0x20947b[_0xbea0('0x34')]['length']?_0x20947b[_0xbea0('0x34')]:_0x384386[_0xbea0('0x31')];if(!_0x2317cc[_0xbea0('0x32')][_0xbea0('0x36')](_0xbea0('0x37'))){_0x20947b[_0xbea0('0x20')]=qs[_0xbea0('0x20')](_0x2317cc[_0xbea0('0x32')]['limit']);_0x20947b[_0xbea0('0x1e')]=qs[_0xbea0('0x1e')](_0x2317cc[_0xbea0('0x32')][_0xbea0('0x1e')]);}_0x20947b['order']=qs['sort'](_0x2317cc[_0xbea0('0x32')][_0xbea0('0x38')]);_0x20947b[_0xbea0('0x39')]=qs[_0xbea0('0x3a')](_['pick'](_0x2317cc['query'],_0x384386[_0xbea0('0x3a')]),_0x2d7e61);if(_0x2317cc[_0xbea0('0x32')]['filter']){_0x20947b[_0xbea0('0x39')]=_[_0xbea0('0x3b')](_0x20947b[_0xbea0('0x39')],{'$or':_[_0xbea0('0x2c')](_0x2d7e61,function(_0x50e591){if(_0x50e591[_0xbea0('0x2f')]!==_0xbea0('0x3c')){var _0x2f1049={};_0x2f1049[_0x50e591['name']]={'$like':'%'+_0x2317cc[_0xbea0('0x32')][_0xbea0('0x3d')]+'%'};return _0x2f1049;}})});}_0x20947b=_[_0xbea0('0x3b')]({},_0x20947b,_0x2317cc[_0xbea0('0x3e')]);var _0x5d2bae={'where':_0x20947b[_0xbea0('0x39')]};return db[_0xbea0('0x2d')][_0xbea0('0x21')](_0x5d2bae)['then'](function(_0x58428f){_0x2811bc[_0xbea0('0x21')]=_0x58428f;if(_0x2317cc[_0xbea0('0x32')][_0xbea0('0x3f')]){_0x20947b[_0xbea0('0x40')]=[{'all':!![]}];}return db[_0xbea0('0x2d')]['findAll'](_0x20947b);})[_0xbea0('0x26')](function(_0x2aa861){_0x2811bc[_0xbea0('0x41')]=_0x2aa861;return _0x2811bc;})[_0xbea0('0x26')](respondWithFilteredResult(_0x560f6a,_0x20947b))[_0xbea0('0x42')](handleError(_0x560f6a,null));};exports['show']=function(_0x3a6e73,_0x3a9e1c){var _0x56754a={'raw':![],'where':{'id':_0x3a6e73['params']['id']}},_0x1aad91={};_0x1aad91[_0xbea0('0x31')]=_[_0xbea0('0x43')](db['ZohoAccount'][_0xbea0('0x2e')]);_0x1aad91[_0xbea0('0x32')]=_[_0xbea0('0x43')](_0x3a6e73['query']);_0x1aad91[_0xbea0('0x3a')]=_['intersection'](_0x1aad91['model'],_0x1aad91[_0xbea0('0x32')]);_0x56754a[_0xbea0('0x34')]=_['intersection'](_0x1aad91[_0xbea0('0x31')],qs['fields'](_0x3a6e73['query'][_0xbea0('0x35')]));_0x56754a[_0xbea0('0x34')]=_0x56754a[_0xbea0('0x34')][_0xbea0('0x44')]?_0x56754a[_0xbea0('0x34')]:_0x1aad91[_0xbea0('0x31')];if(_0x3a6e73[_0xbea0('0x32')]['includeAll']){_0x56754a[_0xbea0('0x40')]=[{'all':!![]}];}_0x56754a=_[_0xbea0('0x3b')]({},_0x56754a,_0x3a6e73[_0xbea0('0x3e')]);return db[_0xbea0('0x2d')][_0xbea0('0x45')](_0x56754a)[_0xbea0('0x26')](handleEntityNotFound(_0x3a9e1c,null))[_0xbea0('0x26')](respondWithResult(_0x3a9e1c,null))[_0xbea0('0x42')](handleError(_0x3a9e1c,null));};exports[_0xbea0('0x46')]=function(_0x392970,_0x40739e){return db[_0xbea0('0x2d')][_0xbea0('0x46')](_0x392970[_0xbea0('0x47')],{})[_0xbea0('0x26')](respondWithResult(_0x40739e,0xc9))['catch'](handleError(_0x40739e,null));};exports['update']=function(_0xca479a,_0x3c0d19){if(_0xca479a[_0xbea0('0x47')]['id']){delete _0xca479a[_0xbea0('0x47')]['id'];}return db[_0xbea0('0x2d')]['find']({'where':{'id':_0xca479a['params']['id']}})[_0xbea0('0x26')](handleEntityNotFound(_0x3c0d19,null))[_0xbea0('0x26')](saveUpdates(_0xca479a[_0xbea0('0x47')],null))[_0xbea0('0x26')](respondWithResult(_0x3c0d19,null))[_0xbea0('0x42')](handleError(_0x3c0d19,null));};exports['destroy']=function(_0x43dc5e,_0xab4194){return db[_0xbea0('0x2d')]['find']({'where':{'id':_0x43dc5e[_0xbea0('0x48')]['id']}})[_0xbea0('0x26')](handleEntityNotFound(_0xab4194,null))[_0xbea0('0x26')](removeEntity(_0xab4194,null))[_0xbea0('0x42')](handleError(_0xab4194,null));};exports[_0xbea0('0x49')]=function(_0x264470,_0x37e8e1,_0x40c5c4){var _0x374235={};var _0x4b72ec={};var _0x24312f;var _0x116c6c;return db[_0xbea0('0x2d')][_0xbea0('0x4a')]({'where':{'id':_0x264470['params']['id']}})[_0xbea0('0x26')](handleEntityNotFound(_0x37e8e1,null))['then'](function(_0x49c7d2){if(_0x49c7d2){_0x24312f=_0x49c7d2;_0x4b72ec[_0xbea0('0x31')]=_[_0xbea0('0x43')](db['ZohoConfiguration'][_0xbea0('0x2e')]);_0x4b72ec[_0xbea0('0x32')]=_[_0xbea0('0x43')](_0x264470['query']);_0x4b72ec[_0xbea0('0x3a')]=_[_0xbea0('0x33')](_0x4b72ec['model'],_0x4b72ec['query']);_0x374235[_0xbea0('0x34')]=_[_0xbea0('0x33')](_0x4b72ec[_0xbea0('0x31')],qs[_0xbea0('0x35')](_0x264470[_0xbea0('0x32')][_0xbea0('0x35')]));_0x374235[_0xbea0('0x34')]=_0x374235[_0xbea0('0x34')][_0xbea0('0x44')]?_0x374235['attributes']:_0x4b72ec[_0xbea0('0x31')];_0x374235[_0xbea0('0x4b')]=qs['sort'](_0x264470[_0xbea0('0x32')][_0xbea0('0x38')]);_0x374235[_0xbea0('0x39')]=qs[_0xbea0('0x3a')](_[_0xbea0('0x4c')](_0x264470[_0xbea0('0x32')],_0x4b72ec[_0xbea0('0x3a')]));if(_0x264470[_0xbea0('0x32')]['filter']){_0x374235[_0xbea0('0x39')]=_[_0xbea0('0x3b')](_0x374235[_0xbea0('0x39')],{'$or':_[_0xbea0('0x2c')](_0x374235[_0xbea0('0x34')],function(_0x28622f){var _0x165ac0={};_0x165ac0[_0x28622f]={'$like':'%'+_0x264470[_0xbea0('0x32')][_0xbea0('0x3d')]+'%'};return _0x165ac0;})});}_0x374235=_[_0xbea0('0x3b')]({},_0x374235,_0x264470[_0xbea0('0x3e')]);return _0x24312f[_0xbea0('0x49')](_0x374235);}})['then'](function(_0x4c17a1){if(_0x4c17a1){_0x116c6c=_0x4c17a1[_0xbea0('0x44')];if(!_0x264470['query'][_0xbea0('0x36')](_0xbea0('0x37'))){_0x374235[_0xbea0('0x20')]=qs[_0xbea0('0x20')](_0x264470['query'][_0xbea0('0x20')]);_0x374235[_0xbea0('0x1e')]=qs[_0xbea0('0x1e')](_0x264470[_0xbea0('0x32')][_0xbea0('0x1e')]);}return _0x24312f[_0xbea0('0x49')](_0x374235);}})[_0xbea0('0x26')](function(_0x26ff0a){if(_0x26ff0a){return _0x26ff0a?{'count':_0x116c6c,'rows':_0x26ff0a}:null;}})[_0xbea0('0x26')](respondWithResult(_0x37e8e1,null))['catch'](handleError(_0x37e8e1,null));};exports[_0xbea0('0x4d')]=function(_0x121301,_0x1abfc8,_0xe7729c){if(_0x121301[_0xbea0('0x47')]['id']){delete _0x121301[_0xbea0('0x47')]['id'];}return db[_0xbea0('0x2d')]['findOne']({'where':{'id':_0x121301[_0xbea0('0x48')]['id']}})[_0xbea0('0x26')](handleEntityNotFound(_0x1abfc8,null))['then'](function(_0x5c8cce){if(_0x5c8cce){_0x121301[_0xbea0('0x47')]['AccountId']=_0x5c8cce['id'];_0x121301['body']['Subjects']=integrations[_0xbea0('0x4e')](_0x121301[_0xbea0('0x47')][_0xbea0('0x4f')],_0x121301[_0xbea0('0x47')][_0xbea0('0x2f')]);_0x121301[_0xbea0('0x47')]['Descriptions']=integrations[_0xbea0('0x50')](_0x121301[_0xbea0('0x47')][_0xbea0('0x4f')],_0x121301[_0xbea0('0x47')][_0xbea0('0x2f')]);return db['ZohoConfiguration'][_0xbea0('0x46')](_0x121301[_0xbea0('0x47')],{'include':[{'model':db[_0xbea0('0x51')],'as':_0xbea0('0x52')},{'model':db[_0xbea0('0x51')],'as':'Descriptions'}]});}return null;})[_0xbea0('0x26')](respondWithResult(_0x1abfc8,null))[_0xbea0('0x42')](handleError(_0x1abfc8,null));};function getAccessToken(_0xcf40a4){return new Promise(function(_0x524748,_0x454e90){var _0xb9142;switch(_0xcf40a4[_0xbea0('0x53')]){case'US':_0xb9142='https://accounts.zoho.com';break;case'AU':_0xb9142=_0xbea0('0x54');break;case'EU':_0xb9142=_0xbea0('0x55');break;case'IN':_0xb9142=_0xbea0('0x56');break;case'CN':_0xb9142=_0xbea0('0x57');break;default:_0xb9142=_0xbea0('0x55');break;}var _0x41ba0c={'method':_0xbea0('0x58'),'uri':_0xb9142+_0xbea0('0x59'),'qs':{'refresh_token':_0xcf40a4[_0xbea0('0x5a')],'client_id':_0xcf40a4[_0xbea0('0x5b')],'client_secret':_0xcf40a4[_0xbea0('0x5c')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x41ba0c)[_0xbea0('0x26')](function(_0xc927f0){if(_0xc927f0[_0xbea0('0x5d')]){_0x524748(_0xc927f0[_0xbea0('0x5d')]);}else{_0x454e90(_0xbea0('0x5e'));}})[_0xbea0('0x42')](function(_0xaaa4a5){_0x454e90(_0xaaa4a5);});});}exports[_0xbea0('0x5f')]=function(_0x1d6403,_0x1a2fc6,_0x361111){var _0x29cff0,_0xa3eae6,_0xc15705,_0x633ca5,_0x2b06e6;return db[_0xbea0('0x2d')][_0xbea0('0x4a')]({'where':{'id':_0x1d6403[_0xbea0('0x48')]['id']},'attributes':['id','host',_0xbea0('0x53'),_0xbea0('0x5b'),'clientSecret',_0xbea0('0x60'),_0xbea0('0x61'),_0xbea0('0x5a')]})[_0xbea0('0x26')](handleEntityNotFound(_0x1a2fc6,null))['then'](function(_0x40febc){_0x2b06e6=_0x40febc;_0x29cff0=_0x2b06e6['host'];_0xa3eae6=_0x29cff0===_0xbea0('0x62')?'eu':'com';_0xc15705=_0x2b06e6[_0xbea0('0x60')];var _0x1b26e9=_0xc15705[_0xbea0('0x63')](-0x1);if(_0x1b26e9==='/'||_0x1b26e9==='\x5c'||_0x1b26e9===':'){_0xc15705=_0xc15705['substring'](0x0,_0xc15705[_0xbea0('0x64')](_0x1b26e9));}if(!_0x2b06e6[_0xbea0('0x5a')]){throw new Error(_0xbea0('0x65'));}return getAccessToken(_0x2b06e6);})[_0xbea0('0x26')](function(_0x1e1827){if(_0x1e1827){return rp({'method':'GET','uri':util[_0xbea0('0x66')](_0xbea0('0x67'),_0xa3eae6),'qs':{'module':_0xbea0('0x68')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1e1827},'json':!![]});}})[_0xbea0('0x26')](function(_0x4f8600){if(_0x4f8600){if(_0x4f8600[_0xbea0('0x69')]&&_0x4f8600[_0xbea0('0x69')]['error']){throw new Error(_0x4f8600[_0xbea0('0x69')]['error'][_0xbea0('0x6a')]);}var _0x1dc9d5=[];var _0x2535af=[];var _0x47dcd0=['Owner',_0xbea0('0x6b'),_0xbea0('0x6c'),_0xbea0('0x6d'),_0xbea0('0x6e'),_0xbea0('0x6f'),_0xbea0('0x70'),_0xbea0('0x71')];_0x2535af=_[_0xbea0('0x72')](_0x4f8600[_0xbea0('0x35')],function(_0x37dc62){return _0x47dcd0[_0xbea0('0x73')](_0x37dc62['api_name']);});for(var _0x32ef36=0x0;_0x32ef36<_0x2535af[_0xbea0('0x44')];_0x32ef36++){if(_0x2535af[_0x32ef36][_0xbea0('0x74')]===![]){_0x1dc9d5[_0xbea0('0x75')]({'id':_0x2535af[_0x32ef36]['id'],'name':_0x2535af[_0x32ef36][_0xbea0('0x76')],'custom':_0x2535af[_0x32ef36]['custom_field'],'options':_0x2535af[_0x32ef36][_0xbea0('0x77')]==='picklist'&&_0x2535af[_0x32ef36]['pick_list_values'][_0xbea0('0x44')]>-0x1?_['map'](_0x2535af[_0x32ef36][_0xbea0('0x78')],function(_0x3e3f36){return{'name':_0x3e3f36,'value':_0x3e3f36};}):[]});}}return{'count':_0x1dc9d5[_0xbea0('0x44')],'rows':_0x1dc9d5};}else{return{'count':0x0,'rows':[]};}})[_0xbea0('0x26')](respondWithResult(_0x1a2fc6,null))[_0xbea0('0x42')](function(_0x182533){var _0x3b943c=_0x1d6403[_0xbea0('0x32')][_0xbea0('0x79')]?0x1f4:_0x182533[_0xbea0('0x7a')]||0x1f4;logger[_0xbea0('0x28')](_0xbea0('0x7b'),_0xbea0('0x5f'),_0x3b943c,JSON['stringify'](_0x182533));delete _0x182533[_0xbea0('0x2a')];if(_0x3b943c===0x191){_0x3b943c=0x190;}_0x1a2fc6['status'](_0x3b943c)[_0xbea0('0x2b')](_0x1d6403[_0xbea0('0x32')][_0xbea0('0x79')]?{'message':_0xbea0('0x7c'),'statusCode':_0x182533[_0xbea0('0x7a')]}:_0x182533);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 4f2c24f..fe34ae0 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 _0xa807=['substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','https://accounts.zoho.com.cn','POST','error','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','int_zoho_accounts','changed','zone','clientId','code','host','serverUrl','slice'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xa807,0x92));var _0x7a80=function(_0x54000a,_0x21471d){_0x54000a=_0x54000a-0x0;var _0x369a59=_0xa807[_0x54000a];return _0x369a59;};'use strict';var _=require('lodash');var util=require(_0x7a80('0x0'));var logger=require(_0x7a80('0x1'))(_0x7a80('0x2'));var moment=require('moment');var BPromise=require(_0x7a80('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a80('0x4'));var rimraf=require(_0x7a80('0x5'));var config=require(_0x7a80('0x6'));var attributes=require(_0x7a80('0x7'));var integrations=require(_0x7a80('0x8'));module[_0x7a80('0x9')]=function(_0x32a8cf,_0x89d0de){return _0x32a8cf['define']('ZohoAccount',attributes,{'tableName':_0x7a80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2f9282,_0x4a1032,_0x5b8bfb){if(_0x2f9282[_0x7a80('0xb')](_0x7a80('0xc'))||_0x2f9282[_0x7a80('0xb')]('serverUrl')||_0x2f9282['changed'](_0x7a80('0xd'))||_0x2f9282[_0x7a80('0xb')]('clientSecret')||_0x2f9282[_0x7a80('0xb')](_0x7a80('0xe'))||_0x2f9282[_0x7a80('0xb')](_0x7a80('0xf'))){var _0x3f35e5,_0x3c9ce8;_0x3f35e5=_0x2f9282[_0x7a80('0x10')];var _0x2dfeb5=_0x3f35e5[_0x7a80('0x11')](-0x1);if(_0x2dfeb5==='/'||_0x2dfeb5==='\x5c'||_0x2dfeb5===':'){_0x3f35e5=_0x3f35e5[_0x7a80('0x12')](0x0,_0x3f35e5[_0x7a80('0x13')](_0x2dfeb5));}switch(_0x2f9282['zone']){case'US':_0x3c9ce8=_0x7a80('0x14');break;case'AU':_0x3c9ce8=_0x7a80('0x15');break;case'IN':_0x3c9ce8=_0x7a80('0x16');break;case'CN':_0x3c9ce8='https://accounts.zoho.com.cn';break;default:_0x3c9ce8=_0x7a80('0x17');break;}var _0x34f36a={'method':'POST','uri':_0x3c9ce8+_0x7a80('0x18'),'form':{'grant_type':_0x7a80('0x19'),'client_id':_0x2f9282[_0x7a80('0xd')],'client_secret':_0x2f9282[_0x7a80('0x1a')],'redirect_uri':_0x2f9282[_0x7a80('0x10')],'code':_0x2f9282[_0x7a80('0xe')]},'headers':{'Content-Type':_0x7a80('0x1b')}};return rp(_0x34f36a)[_0x7a80('0x1c')](function(_0x3eb652){var _0x15f33c=JSON[_0x7a80('0x1d')](_0x3eb652);if(_0x15f33c[_0x7a80('0x1e')]){_0x2f9282[_0x7a80('0x1f')]=_0x15f33c[_0x7a80('0x1e')];logger['info'](util[_0x7a80('0x20')](_0x7a80('0x21'),_0x2f9282['name'],_0x2f9282['id']));}else{logger['error'](util['format'](_0x7a80('0x22'),_0x2f9282[_0x7a80('0x23')],_0x2f9282['id']),util[_0x7a80('0x24')](_0x15f33c,{'showHidden':![],'depth':null}));}return _0x5b8bfb(null,_0x4a1032);})[_0x7a80('0x25')](function(_0x303cae){logger['error'](util[_0x7a80('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2f9282[_0x7a80('0x23')],_0x2f9282['id']),util[_0x7a80('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5b8bfb(_0x303cae);});}else{return _0x5b8bfb(null,_0x4a1032);}},'beforeUpdate':function(_0x2c4196,_0x18c7df,_0x359dc4){if(_0x2c4196[_0x7a80('0xb')](_0x7a80('0xc'))||_0x2c4196[_0x7a80('0xb')](_0x7a80('0x10'))||_0x2c4196[_0x7a80('0xb')](_0x7a80('0xd'))||_0x2c4196['changed']('clientSecret')||_0x2c4196[_0x7a80('0xb')](_0x7a80('0xe'))||_0x2c4196[_0x7a80('0xb')](_0x7a80('0xf'))){var _0x132d23,_0x23ed55;_0x132d23=_0x2c4196[_0x7a80('0x10')];var _0x275f62=_0x132d23['slice'](-0x1);if(_0x275f62==='/'||_0x275f62==='\x5c'||_0x275f62===':'){_0x132d23=_0x132d23[_0x7a80('0x12')](0x0,_0x132d23[_0x7a80('0x13')](_0x275f62));}switch(_0x2c4196['zone']){case'US':_0x23ed55=_0x7a80('0x14');break;case'AU':_0x23ed55=_0x7a80('0x15');break;case'IN':_0x23ed55='https://accounts.zoho.in';break;case'CN':_0x23ed55=_0x7a80('0x26');break;default:_0x23ed55=_0x7a80('0x17');break;}var _0x31c825={'method':_0x7a80('0x27'),'uri':_0x23ed55+_0x7a80('0x18'),'form':{'grant_type':_0x7a80('0x19'),'client_id':_0x2c4196[_0x7a80('0xd')],'client_secret':_0x2c4196[_0x7a80('0x1a')],'redirect_uri':_0x2c4196['serverUrl'],'code':_0x2c4196[_0x7a80('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x31c825)['then'](function(_0x26932a){var _0x4f1737=JSON['parse'](_0x26932a);if(_0x4f1737[_0x7a80('0x1e')]){_0x2c4196['refreshToken']=_0x4f1737['refresh_token'];logger['info'](util[_0x7a80('0x20')](_0x7a80('0x21'),_0x2c4196[_0x7a80('0x23')],_0x2c4196['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2c4196['name'],_0x2c4196['id']),util[_0x7a80('0x24')](_0x4f1737,{'showHidden':![],'depth':null}));}return _0x359dc4(null,_0x18c7df);})['catch'](function(_0x51c2eb){logger[_0x7a80('0x28')](util['format'](_0x7a80('0x22'),_0x2c4196['name'],_0x2c4196['id']),util[_0x7a80('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x359dc4(_0x51c2eb);});}else{return _0x359dc4(null,_0x18c7df);}}}});}; \ No newline at end of file +var _0x358e=['substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','info','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','catch','https://accounts.zoho.com','https://accounts.zoho.in','refresh_token','refreshToken','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','clientId','clientSecret','code','host','serverUrl','slice'];(function(_0x4cfec2,_0x3749a9){var _0x437d79=function(_0x44ec40){while(--_0x44ec40){_0x4cfec2['push'](_0x4cfec2['shift']());}};_0x437d79(++_0x3749a9);}(_0x358e,0x17f));var _0xe358=function(_0x94dd49,_0x2661bc){_0x94dd49=_0x94dd49-0x0;var _0x44571f=_0x358e[_0x94dd49];return _0x44571f;};'use strict';var _=require(_0xe358('0x0'));var util=require(_0xe358('0x1'));var logger=require(_0xe358('0x2'))('api');var moment=require(_0xe358('0x3'));var BPromise=require(_0xe358('0x4'));var rp=require(_0xe358('0x5'));var fs=require('fs');var path=require(_0xe358('0x6'));var rimraf=require(_0xe358('0x7'));var config=require(_0xe358('0x8'));var attributes=require(_0xe358('0x9'));var integrations=require(_0xe358('0xa'));module[_0xe358('0xb')]=function(_0x2232fe,_0x57f2d4){return _0x2232fe[_0xe358('0xc')](_0xe358('0xd'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5c9615,_0x1e8fd9,_0x96ea9a){if(_0x5c9615[_0xe358('0xe')](_0xe358('0xf'))||_0x5c9615['changed']('serverUrl')||_0x5c9615['changed'](_0xe358('0x10'))||_0x5c9615[_0xe358('0xe')](_0xe358('0x11'))||_0x5c9615['changed'](_0xe358('0x12'))||_0x5c9615[_0xe358('0xe')](_0xe358('0x13'))){var _0x395938,_0x8ae0bd;_0x395938=_0x5c9615[_0xe358('0x14')];var _0x5c5eef=_0x395938[_0xe358('0x15')](-0x1);if(_0x5c5eef==='/'||_0x5c5eef==='\x5c'||_0x5c5eef===':'){_0x395938=_0x395938[_0xe358('0x16')](0x0,_0x395938[_0xe358('0x17')](_0x5c5eef));}switch(_0x5c9615[_0xe358('0xf')]){case'US':_0x8ae0bd='https://accounts.zoho.com';break;case'AU':_0x8ae0bd=_0xe358('0x18');break;case'IN':_0x8ae0bd='https://accounts.zoho.in';break;case'CN':_0x8ae0bd=_0xe358('0x19');break;default:_0x8ae0bd=_0xe358('0x1a');break;}var _0x3b0b3c={'method':_0xe358('0x1b'),'uri':_0x8ae0bd+_0xe358('0x1c'),'form':{'grant_type':_0xe358('0x1d'),'client_id':_0x5c9615[_0xe358('0x10')],'client_secret':_0x5c9615[_0xe358('0x11')],'redirect_uri':_0x5c9615['serverUrl'],'code':_0x5c9615[_0xe358('0x12')]},'headers':{'Content-Type':_0xe358('0x1e')}};return rp(_0x3b0b3c)[_0xe358('0x1f')](function(_0x76828){var _0x527585=JSON[_0xe358('0x20')](_0x76828);if(_0x527585['refresh_token']){_0x5c9615['refreshToken']=_0x527585['refresh_token'];logger[_0xe358('0x21')](util[_0xe358('0x22')](_0xe358('0x23'),_0x5c9615[_0xe358('0x24')],_0x5c9615['id']));}else{logger[_0xe358('0x25')](util['format'](_0xe358('0x26'),_0x5c9615['name'],_0x5c9615['id']),util[_0xe358('0x27')](_0x527585,{'showHidden':![],'depth':null}));}return _0x96ea9a(null,_0x1e8fd9);})[_0xe358('0x28')](function(_0x35ce41){logger[_0xe358('0x25')](util[_0xe358('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5c9615[_0xe358('0x24')],_0x5c9615['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x96ea9a(_0x35ce41);});}else{return _0x96ea9a(null,_0x1e8fd9);}},'beforeUpdate':function(_0x785b62,_0x2f95db,_0x4ec2bf){if(_0x785b62[_0xe358('0xe')](_0xe358('0xf'))||_0x785b62[_0xe358('0xe')](_0xe358('0x14'))||_0x785b62[_0xe358('0xe')](_0xe358('0x10'))||_0x785b62[_0xe358('0xe')](_0xe358('0x11'))||_0x785b62[_0xe358('0xe')](_0xe358('0x12'))||_0x785b62[_0xe358('0xe')]('host')){var _0x4dba15,_0x13f1eb;_0x4dba15=_0x785b62[_0xe358('0x14')];var _0x5c2f5d=_0x4dba15[_0xe358('0x15')](-0x1);if(_0x5c2f5d==='/'||_0x5c2f5d==='\x5c'||_0x5c2f5d===':'){_0x4dba15=_0x4dba15['substring'](0x0,_0x4dba15[_0xe358('0x17')](_0x5c2f5d));}switch(_0x785b62[_0xe358('0xf')]){case'US':_0x13f1eb=_0xe358('0x29');break;case'AU':_0x13f1eb=_0xe358('0x18');break;case'IN':_0x13f1eb=_0xe358('0x2a');break;case'CN':_0x13f1eb=_0xe358('0x19');break;default:_0x13f1eb='https://accounts.zoho.eu';break;}var _0x322911={'method':'POST','uri':_0x13f1eb+_0xe358('0x1c'),'form':{'grant_type':_0xe358('0x1d'),'client_id':_0x785b62[_0xe358('0x10')],'client_secret':_0x785b62[_0xe358('0x11')],'redirect_uri':_0x785b62[_0xe358('0x14')],'code':_0x785b62[_0xe358('0x12')]},'headers':{'Content-Type':_0xe358('0x1e')}};return rp(_0x322911)['then'](function(_0xb5979b){var _0x3ff216=JSON[_0xe358('0x20')](_0xb5979b);if(_0x3ff216[_0xe358('0x2b')]){_0x785b62[_0xe358('0x2c')]=_0x3ff216['refresh_token'];logger['info'](util[_0xe358('0x22')](_0xe358('0x23'),_0x785b62[_0xe358('0x24')],_0x785b62['id']));}else{logger[_0xe358('0x25')](util[_0xe358('0x22')](_0xe358('0x26'),_0x785b62[_0xe358('0x24')],_0x785b62['id']),util[_0xe358('0x27')](_0x3ff216,{'showHidden':![],'depth':null}));}return _0x4ec2bf(null,_0x2f95db);})[_0xe358('0x28')](function(_0x2f0589){logger['error'](util[_0xe358('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x785b62[_0xe358('0x24')],_0x785b62['id']),util[_0xe358('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x4ec2bf(_0x2f0589);});}else{return _0x4ec2bf(null,_0x2f95db);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 853aad8..219e70f 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 _0x65c9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowZohoAccount','lodash','util','bluebird','randomstring'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0x65c9,0x182));var _0x965c=function(_0x2396a2,_0x1c5c3f){_0x2396a2=_0x2396a2-0x0;var _0x313616=_0x65c9[_0x2396a2];return _0x313616;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var moment=require('moment');var BPromise=require(_0x965c('0x2'));var rs=require(_0x965c('0x3'));var fs=require('fs');var Redis=require(_0x965c('0x4'));var db=require(_0x965c('0x5'))['db'];var utils=require(_0x965c('0x6'));var logger=require(_0x965c('0x7'))(_0x965c('0x8'));var config=require(_0x965c('0x9'));var jayson=require(_0x965c('0xa'));var client=jayson[_0x965c('0xb')][_0x965c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x849260,_0x5ec702,_0xd19e57){return new BPromise(function(_0x263652,_0x41d248){return client[_0x965c('0xd')](_0x849260,_0xd19e57)[_0x965c('0xe')](function(_0x26d859){logger[_0x965c('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x5ec702,_0x965c('0x10'));logger[_0x965c('0x11')](_0x965c('0x12'),_0x5ec702,_0x965c('0x10'),JSON[_0x965c('0x13')](_0x26d859));if(_0x26d859[_0x965c('0x14')]){if(_0x26d859[_0x965c('0x14')][_0x965c('0x15')]===0x1f4){logger[_0x965c('0x14')](_0x965c('0x16'),_0x5ec702,_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);return _0x41d248(_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);}logger['error'](_0x965c('0x16'),_0x5ec702,_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);return _0x263652(_0x26d859['error'][_0x965c('0x17')]);}else{logger[_0x965c('0xf')](_0x965c('0x16'),_0x5ec702,'request\x20sent');_0x263652(_0x26d859[_0x965c('0x18')]['message']);}})['catch'](function(_0x542499){logger[_0x965c('0x14')](_0x965c('0x16'),_0x5ec702,_0x542499);_0x41d248(_0x542499);});});}exports[_0x965c('0x19')]=function(_0x14e990){var _0x4e3719=this;return new Promise(function(_0x590c6a,_0x4935e6){return db[_0x965c('0x1a')][_0x965c('0x1b')]({'raw':_0x14e990[_0x965c('0x1c')]?_0x14e990[_0x965c('0x1c')][_0x965c('0x1d')]===undefined?!![]:![]:!![],'where':_0x14e990[_0x965c('0x1c')]?_0x14e990[_0x965c('0x1c')][_0x965c('0x1e')]||null:null,'attributes':_0x14e990[_0x965c('0x1c')]?_0x14e990[_0x965c('0x1c')][_0x965c('0x1f')]||null:null,'limit':_0x14e990['options']?_0x14e990[_0x965c('0x1c')][_0x965c('0x20')]||null:null,'include':_0x14e990['options']?_0x14e990[_0x965c('0x1c')][_0x965c('0x21')]?_['map'](_0x14e990[_0x965c('0x1c')][_0x965c('0x21')],function(_0x3dcfa2){return{'model':db[_0x3dcfa2['model']],'as':_0x3dcfa2['as'],'attributes':_0x3dcfa2[_0x965c('0x1f')],'include':_0x3dcfa2[_0x965c('0x21')]?_[_0x965c('0x22')](_0x3dcfa2[_0x965c('0x21')],function(_0x5ddefa){return{'model':db[_0x5ddefa[_0x965c('0x23')]],'as':_0x5ddefa['as'],'attributes':_0x5ddefa['attributes'],'include':_0x5ddefa['include']?_['map'](_0x5ddefa[_0x965c('0x21')],function(_0x327aa6){return{'model':db[_0x327aa6[_0x965c('0x23')]],'as':_0x327aa6['as'],'attributes':_0x327aa6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5574e2){logger['info'](_0x965c('0x19'),_0x14e990);logger['debug'](_0x965c('0x19'),_0x14e990,JSON[_0x965c('0x13')](_0x5574e2));_0x590c6a(_0x5574e2);})[_0x965c('0x24')](function(_0x8f9853){logger[_0x965c('0x14')](_0x965c('0x19'),_0x8f9853[_0x965c('0x17')],_0x14e990);_0x4935e6(_0x4e3719[_0x965c('0x14')](0x1f4,_0x8f9853[_0x965c('0x17')]));});});};exports['ShowZohoAccount']=function(_0x2a1b9d){var _0x1d465c=this;return new Promise(function(_0x1b01ec,_0x32b5f5){return db[_0x965c('0x1a')][_0x965c('0x25')]({'raw':_0x2a1b9d[_0x965c('0x1c')]?_0x2a1b9d[_0x965c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2a1b9d[_0x965c('0x1c')]?_0x2a1b9d['options']['where']||null:null,'attributes':_0x2a1b9d[_0x965c('0x1c')]?_0x2a1b9d[_0x965c('0x1c')][_0x965c('0x1f')]||null:null,'include':_0x2a1b9d['options']?_0x2a1b9d[_0x965c('0x1c')][_0x965c('0x21')]?_[_0x965c('0x22')](_0x2a1b9d['options'][_0x965c('0x21')],function(_0x19b020){return{'model':db[_0x19b020[_0x965c('0x23')]],'as':_0x19b020['as'],'attributes':_0x19b020['attributes'],'include':_0x19b020[_0x965c('0x21')]?_[_0x965c('0x22')](_0x19b020[_0x965c('0x21')],function(_0x93c737){return{'model':db[_0x93c737[_0x965c('0x23')]],'as':_0x93c737['as'],'attributes':_0x93c737[_0x965c('0x1f')],'include':_0x93c737['include']?_[_0x965c('0x22')](_0x93c737[_0x965c('0x21')],function(_0xd66556){return{'model':db[_0xd66556[_0x965c('0x23')]],'as':_0xd66556['as'],'attributes':_0xd66556[_0x965c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x965c('0xe')](function(_0x349b3d){logger[_0x965c('0xf')]('ShowZohoAccount',_0x2a1b9d);logger[_0x965c('0x11')](_0x965c('0x26'),_0x2a1b9d,JSON[_0x965c('0x13')](_0x349b3d));_0x1b01ec(_0x349b3d);})[_0x965c('0x24')](function(_0x4845d0){logger[_0x965c('0x14')](_0x965c('0x26'),_0x4845d0[_0x965c('0x17')],_0x2a1b9d);_0x32b5f5(_0x1d465c[_0x965c('0x14')](0x1f4,_0x4845d0['message']));});});}; \ No newline at end of file +var _0xa880=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','then','ShowZohoAccount','raw','model','lodash','util','moment','bluebird'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0xa880,0x106));var _0x0a88=function(_0x22ca53,_0x30e1a9){_0x22ca53=_0x22ca53-0x0;var _0x80aacf=_0xa880[_0x22ca53];return _0x80aacf;};'use strict';var _=require(_0x0a88('0x0'));var util=require(_0x0a88('0x1'));var moment=require(_0x0a88('0x2'));var BPromise=require(_0x0a88('0x3'));var rs=require(_0x0a88('0x4'));var fs=require('fs');var Redis=require(_0x0a88('0x5'));var db=require(_0x0a88('0x6'))['db'];var utils=require(_0x0a88('0x7'));var logger=require(_0x0a88('0x8'))(_0x0a88('0x9'));var config=require(_0x0a88('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0a88('0xb')][_0x0a88('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a576d,_0x3f9463,_0x509f9e){return new BPromise(function(_0x129c9f,_0x62b055){return client[_0x0a88('0xd')](_0x3a576d,_0x509f9e)['then'](function(_0x512810){logger['info'](_0x0a88('0xe'),_0x3f9463,_0x0a88('0xf'));logger[_0x0a88('0x10')](_0x0a88('0x11'),_0x3f9463,_0x0a88('0xf'),JSON[_0x0a88('0x12')](_0x512810));if(_0x512810[_0x0a88('0x13')]){if(_0x512810[_0x0a88('0x13')][_0x0a88('0x14')]===0x1f4){logger[_0x0a88('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x3f9463,_0x512810[_0x0a88('0x13')][_0x0a88('0x15')]);return _0x62b055(_0x512810[_0x0a88('0x13')][_0x0a88('0x15')]);}logger['error'](_0x0a88('0xe'),_0x3f9463,_0x512810[_0x0a88('0x13')][_0x0a88('0x15')]);return _0x129c9f(_0x512810['error'][_0x0a88('0x15')]);}else{logger[_0x0a88('0x16')](_0x0a88('0xe'),_0x3f9463,_0x0a88('0xf'));_0x129c9f(_0x512810[_0x0a88('0x17')]['message']);}})[_0x0a88('0x18')](function(_0xe8c4c4){logger[_0x0a88('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x3f9463,_0xe8c4c4);_0x62b055(_0xe8c4c4);});});}exports[_0x0a88('0x19')]=function(_0x3da111){var _0x22e3fe=this;return new Promise(function(_0x5ce88e,_0xce5d6e){return db[_0x0a88('0x1a')][_0x0a88('0x1b')]({'raw':_0x3da111[_0x0a88('0x1c')]?_0x3da111[_0x0a88('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3da111[_0x0a88('0x1c')]?_0x3da111[_0x0a88('0x1c')][_0x0a88('0x1d')]||null:null,'attributes':_0x3da111[_0x0a88('0x1c')]?_0x3da111[_0x0a88('0x1c')][_0x0a88('0x1e')]||null:null,'limit':_0x3da111[_0x0a88('0x1c')]?_0x3da111[_0x0a88('0x1c')][_0x0a88('0x1f')]||null:null,'include':_0x3da111[_0x0a88('0x1c')]?_0x3da111[_0x0a88('0x1c')][_0x0a88('0x20')]?_[_0x0a88('0x21')](_0x3da111['options'][_0x0a88('0x20')],function(_0x3a296f){return{'model':db[_0x3a296f['model']],'as':_0x3a296f['as'],'attributes':_0x3a296f[_0x0a88('0x1e')],'include':_0x3a296f[_0x0a88('0x20')]?_[_0x0a88('0x21')](_0x3a296f[_0x0a88('0x20')],function(_0x2cd66d){return{'model':db[_0x2cd66d['model']],'as':_0x2cd66d['as'],'attributes':_0x2cd66d['attributes'],'include':_0x2cd66d[_0x0a88('0x20')]?_['map'](_0x2cd66d['include'],function(_0x51e8ff){return{'model':db[_0x51e8ff['model']],'as':_0x51e8ff['as'],'attributes':_0x51e8ff['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a88('0x22')](function(_0x330ed7){logger['info'](_0x0a88('0x19'),_0x3da111);logger[_0x0a88('0x10')]('GetZohoAccount',_0x3da111,JSON[_0x0a88('0x12')](_0x330ed7));_0x5ce88e(_0x330ed7);})['catch'](function(_0x4d8044){logger[_0x0a88('0x13')]('GetZohoAccount',_0x4d8044[_0x0a88('0x15')],_0x3da111);_0xce5d6e(_0x22e3fe['error'](0x1f4,_0x4d8044['message']));});});};exports[_0x0a88('0x23')]=function(_0x28a8f3){var _0x51dc3f=this;return new Promise(function(_0x6cdf8,_0x310844){return db[_0x0a88('0x1a')]['find']({'raw':_0x28a8f3['options']?_0x28a8f3[_0x0a88('0x1c')][_0x0a88('0x24')]===undefined?!![]:![]:!![],'where':_0x28a8f3[_0x0a88('0x1c')]?_0x28a8f3[_0x0a88('0x1c')][_0x0a88('0x1d')]||null:null,'attributes':_0x28a8f3[_0x0a88('0x1c')]?_0x28a8f3[_0x0a88('0x1c')][_0x0a88('0x1e')]||null:null,'include':_0x28a8f3[_0x0a88('0x1c')]?_0x28a8f3[_0x0a88('0x1c')][_0x0a88('0x20')]?_['map'](_0x28a8f3[_0x0a88('0x1c')]['include'],function(_0x1a24bc){return{'model':db[_0x1a24bc[_0x0a88('0x25')]],'as':_0x1a24bc['as'],'attributes':_0x1a24bc[_0x0a88('0x1e')],'include':_0x1a24bc[_0x0a88('0x20')]?_[_0x0a88('0x21')](_0x1a24bc[_0x0a88('0x20')],function(_0x3c35d3){return{'model':db[_0x3c35d3[_0x0a88('0x25')]],'as':_0x3c35d3['as'],'attributes':_0x3c35d3[_0x0a88('0x1e')],'include':_0x3c35d3[_0x0a88('0x20')]?_['map'](_0x3c35d3[_0x0a88('0x20')],function(_0xe5c29c){return{'model':db[_0xe5c29c[_0x0a88('0x25')]],'as':_0xe5c29c['as'],'attributes':_0xe5c29c[_0x0a88('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a88('0x22')](function(_0x58cdd0){logger[_0x0a88('0x16')](_0x0a88('0x23'),_0x28a8f3);logger['debug'](_0x0a88('0x23'),_0x28a8f3,JSON['stringify'](_0x58cdd0));_0x6cdf8(_0x58cdd0);})[_0x0a88('0x18')](function(_0x148faa){logger[_0x0a88('0x13')](_0x0a88('0x23'),_0x148faa[_0x0a88('0x15')],_0x28a8f3);_0x310844(_0x51dc3f[_0x0a88('0x13')](0x1f4,_0x148faa[_0x0a88('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index a9057a9..83e2a85 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 _0x4439=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update'];(function(_0x1d8b10,_0x9603a6){var _0x123f31=function(_0x675fd8){while(--_0x675fd8){_0x1d8b10['push'](_0x1d8b10['shift']());}};_0x123f31(++_0x9603a6);}(_0x4439,0x148));var _0x9443=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x4439[_0x316c42];return _0x2b38f7;};'use strict';var multer=require(_0x9443('0x0'));var util=require(_0x9443('0x1'));var path=require(_0x9443('0x2'));var timeout=require(_0x9443('0x3'));var express=require('express');var router=express[_0x9443('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9443('0x5'));var interaction=require(_0x9443('0x6'));var config=require(_0x9443('0x7'));var controller=require(_0x9443('0x8'));router[_0x9443('0x9')]('/',auth[_0x9443('0xa')](),controller[_0x9443('0xb')]);router[_0x9443('0x9')](_0x9443('0xc'),auth[_0x9443('0xa')](),controller[_0x9443('0xd')]);router[_0x9443('0x9')](_0x9443('0xe'),auth[_0x9443('0xa')](),controller[_0x9443('0xf')]);router[_0x9443('0x9')](_0x9443('0x10'),auth[_0x9443('0xa')](),controller[_0x9443('0x11')]);router[_0x9443('0x9')](_0x9443('0x12'),auth[_0x9443('0xa')](),controller[_0x9443('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9443('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x9443('0x15')]);router[_0x9443('0x16')]('/:id',auth[_0x9443('0xa')](),controller[_0x9443('0x17')]);module[_0x9443('0x18')]=router; \ No newline at end of file +var _0x42fa=['index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x25ea34,_0x12c37e){var _0x5c1b04=function(_0x3c18ea){while(--_0x3c18ea){_0x25ea34['push'](_0x25ea34['shift']());}};_0x5c1b04(++_0x12c37e);}(_0x42fa,0x15d));var _0xa42f=function(_0x12ec6b,_0x2574d6){_0x12ec6b=_0x12ec6b-0x0;var _0x4dce3d=_0x42fa[_0x12ec6b];return _0x4dce3d;};'use strict';var multer=require(_0xa42f('0x0'));var util=require('util');var path=require(_0xa42f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa42f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa42f('0x3'));var interaction=require(_0xa42f('0x4'));var config=require(_0xa42f('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0xa42f('0x6')]('/',auth[_0xa42f('0x7')](),controller[_0xa42f('0x8')]);router[_0xa42f('0x6')](_0xa42f('0x9'),auth[_0xa42f('0x7')](),controller[_0xa42f('0xa')]);router[_0xa42f('0x6')](_0xa42f('0xb'),auth[_0xa42f('0x7')](),controller[_0xa42f('0xc')]);router['get']('/:id/subjects',auth[_0xa42f('0x7')](),controller[_0xa42f('0xd')]);router[_0xa42f('0x6')](_0xa42f('0xe'),auth[_0xa42f('0x7')](),controller[_0xa42f('0xf')]);router[_0xa42f('0x10')]('/',auth[_0xa42f('0x7')](),controller[_0xa42f('0x11')]);router['put'](_0xa42f('0x9'),auth[_0xa42f('0x7')](),controller[_0xa42f('0x12')]);router[_0xa42f('0x13')](_0xa42f('0x9'),auth[_0xa42f('0x7')](),controller[_0xa42f('0x14')]);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 06147dd..d9b1a26 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 _0x937c=['contact','nothing','contact_lead','sequelize','exports','STRING','lead'];(function(_0x5c6951,_0x507abb){var _0x5ee145=function(_0x4f8b75){while(--_0x4f8b75){_0x5c6951['push'](_0x5c6951['shift']());}};_0x5ee145(++_0x507abb);}(_0x937c,0x6c));var _0xc937=function(_0x3592ab,_0x4f669a){_0x3592ab=_0x3592ab-0x0;var _0x13298a=_0x937c[_0x3592ab];return _0x13298a;};'use strict';var Sequelize=require(_0xc937('0x0'));module[_0xc937('0x1')]={'name':{'type':Sequelize[_0xc937('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xc937('0x3'),_0xc937('0x4'),_0xc937('0x5')),'defaultValue':_0xc937('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xc937('0x6'),_0xc937('0x4'),_0xc937('0x3')),'defaultValue':_0xc937('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa7f5=['contact_lead','sequelize','STRING','ENUM','lead','contact','nothing'];(function(_0x28c249,_0x380399){var _0x38b10f=function(_0x4e7610){while(--_0x4e7610){_0x28c249['push'](_0x28c249['shift']());}};_0x38b10f(++_0x380399);}(_0xa7f5,0x12e));var _0x5a7f=function(_0x2eaa09,_0x6b5121){_0x2eaa09=_0x2eaa09-0x0;var _0x3cc635=_0xa7f5[_0x2eaa09];return _0x3cc635;};'use strict';var Sequelize=require(_0x5a7f('0x0'));module['exports']={'name':{'type':Sequelize[_0x5a7f('0x1')]},'moduleCreate':{'type':Sequelize[_0x5a7f('0x2')](_0x5a7f('0x3'),_0x5a7f('0x4'),_0x5a7f('0x5')),'defaultValue':_0x5a7f('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x5a7f('0x6'),_0x5a7f('0x4'),'lead'),'defaultValue':_0x5a7f('0x6')},'description':{'type':Sequelize[_0x5a7f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index df59b1d..1935fea 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 _0xce50=['offset','undefined','limit','count','Content-Range','reject','then','destroy','end','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show','params','options','catch','create','body','update','find','ZohoField','getFields','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x81657b,_0x17822e){var _0x389359=function(_0x16ffe4){while(--_0x16ffe4){_0x81657b['push'](_0x81657b['shift']());}};_0x389359(++_0x17822e);}(_0xce50,0x162));var _0x0ce5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xce50[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x0ce5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ce5('0x1'));var jsonpatch=require(_0x0ce5('0x2'));var rp=require(_0x0ce5('0x3'));var moment=require('moment');var BPromise=require(_0x0ce5('0x4'));var Mustache=require(_0x0ce5('0x5'));var util=require('util');var path=require(_0x0ce5('0x6'));var sox=require(_0x0ce5('0x7'));var csv=require(_0x0ce5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ce5('0x9'));var squel=require('squel');var crypto=require(_0x0ce5('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0ce5('0x8'));var querystring=require(_0x0ce5('0xb'));var Papa=require(_0x0ce5('0xc'));var Redis=require(_0x0ce5('0xd'));var authService=require(_0x0ce5('0xe'));var qs=require(_0x0ce5('0xf'));var as=require(_0x0ce5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ce5('0x11'))(_0x0ce5('0x12'));var utils=require(_0x0ce5('0x13'));var config=require(_0x0ce5('0x14'));var licenseUtil=require(_0x0ce5('0x15'));var db=require(_0x0ce5('0x16'))['db'];function respondWithStatusCode(_0x8a312b,_0x3e921f){_0x3e921f=_0x3e921f||0xcc;return function(_0x579d07){if(_0x579d07){return _0x8a312b[_0x0ce5('0x17')](_0x3e921f);}return _0x8a312b[_0x0ce5('0x18')](_0x3e921f)['end']();};}function respondWithResult(_0x8dfd6b,_0x9a712b){_0x9a712b=_0x9a712b||0xc8;return function(_0x36c1b2){if(_0x36c1b2){return _0x8dfd6b[_0x0ce5('0x18')](_0x9a712b)[_0x0ce5('0x19')](_0x36c1b2);}};}function respondWithFilteredResult(_0x582a77,_0xabcf9b){return function(_0x4d17a9){if(_0x4d17a9){var _0xa4f31c=typeof _0xabcf9b[_0x0ce5('0x1a')]===_0x0ce5('0x1b')&&typeof _0xabcf9b[_0x0ce5('0x1c')]===_0x0ce5('0x1b');var _0x1d48c7=_0x4d17a9[_0x0ce5('0x1d')];var _0x374faf=_0xa4f31c?0x0:_0xabcf9b['offset'];var _0x1c02a1=_0xa4f31c?_0x4d17a9[_0x0ce5('0x1d')]:_0xabcf9b['offset']+_0xabcf9b[_0x0ce5('0x1c')];var _0x15013e;if(_0x1c02a1>=_0x1d48c7){_0x1c02a1=_0x1d48c7;_0x15013e=0xc8;}else{_0x15013e=0xce;}_0x582a77[_0x0ce5('0x18')](_0x15013e);return _0x582a77['set'](_0x0ce5('0x1e'),_0x374faf+'-'+_0x1c02a1+'/'+_0x1d48c7)[_0x0ce5('0x19')](_0x4d17a9);}return null;};}function patchUpdates(_0x14ae6f){return function(_0x1729c4){try{jsonpatch['apply'](_0x1729c4,_0x14ae6f,!![]);}catch(_0x19c244){return BPromise[_0x0ce5('0x1f')](_0x19c244);}return _0x1729c4['save']();};}function saveUpdates(_0x377042,_0x2de6c1){return function(_0x1d5d9f){if(_0x1d5d9f){return _0x1d5d9f['update'](_0x377042)[_0x0ce5('0x20')](function(_0x588ca1){return _0x588ca1;});}return null;};}function removeEntity(_0x4189e0,_0x58f0bd){return function(_0x1134d3){if(_0x1134d3){return _0x1134d3[_0x0ce5('0x21')]()['then'](function(){_0x4189e0[_0x0ce5('0x18')](0xcc)[_0x0ce5('0x22')]();});}};}function handleEntityNotFound(_0xa42b0,_0x492f5e){return function(_0x1622f0){if(!_0x1622f0){_0xa42b0[_0x0ce5('0x17')](0x194);}return _0x1622f0;};}function handleError(_0x327893,_0x1f235b){_0x1f235b=_0x1f235b||0x1f4;return function(_0x38eb98){logger['error'](_0x38eb98[_0x0ce5('0x23')]);if(_0x38eb98[_0x0ce5('0x24')]){delete _0x38eb98['name'];}_0x327893[_0x0ce5('0x18')](_0x1f235b)[_0x0ce5('0x25')](_0x38eb98);};}exports[_0x0ce5('0x26')]=function(_0x56edf9,_0x414c39){var _0x55b7c2={},_0x57766a={},_0x1a2e1e={'count':0x0,'rows':[]};var _0x5cf3e5=_[_0x0ce5('0x27')](db[_0x0ce5('0x28')][_0x0ce5('0x29')],function(_0x3bdbf0){return{'name':_0x3bdbf0['fieldName'],'type':_0x3bdbf0[_0x0ce5('0x2a')][_0x0ce5('0x2b')]};});_0x57766a[_0x0ce5('0x2c')]=_[_0x0ce5('0x27')](_0x5cf3e5,_0x0ce5('0x24'));_0x57766a['query']=_[_0x0ce5('0x2d')](_0x56edf9[_0x0ce5('0x2e')]);_0x57766a[_0x0ce5('0x2f')]=_['intersection'](_0x57766a[_0x0ce5('0x2c')],_0x57766a['query']);_0x55b7c2['attributes']=_[_0x0ce5('0x30')](_0x57766a[_0x0ce5('0x2c')],qs[_0x0ce5('0x31')](_0x56edf9[_0x0ce5('0x2e')][_0x0ce5('0x31')]));_0x55b7c2[_0x0ce5('0x32')]=_0x55b7c2[_0x0ce5('0x32')][_0x0ce5('0x33')]?_0x55b7c2[_0x0ce5('0x32')]:_0x57766a[_0x0ce5('0x2c')];if(!_0x56edf9['query'][_0x0ce5('0x34')](_0x0ce5('0x35'))){_0x55b7c2['limit']=qs[_0x0ce5('0x1c')](_0x56edf9[_0x0ce5('0x2e')][_0x0ce5('0x1c')]);_0x55b7c2[_0x0ce5('0x1a')]=qs['offset'](_0x56edf9[_0x0ce5('0x2e')][_0x0ce5('0x1a')]);}_0x55b7c2[_0x0ce5('0x36')]=qs[_0x0ce5('0x37')](_0x56edf9['query']['sort']);_0x55b7c2[_0x0ce5('0x38')]=qs['filters'](_[_0x0ce5('0x39')](_0x56edf9[_0x0ce5('0x2e')],_0x57766a['filters']),_0x5cf3e5);if(_0x56edf9[_0x0ce5('0x2e')][_0x0ce5('0x3a')]){_0x55b7c2[_0x0ce5('0x38')]=_[_0x0ce5('0x3b')](_0x55b7c2[_0x0ce5('0x38')],{'$or':_[_0x0ce5('0x27')](_0x5cf3e5,function(_0x32b960){if(_0x32b960[_0x0ce5('0x2a')]!==_0x0ce5('0x3c')){var _0x1589cd={};_0x1589cd[_0x32b960['name']]={'$like':'%'+_0x56edf9[_0x0ce5('0x2e')][_0x0ce5('0x3a')]+'%'};return _0x1589cd;}})});}_0x55b7c2=_['merge']({},_0x55b7c2,_0x56edf9['options']);var _0x47784f={'where':_0x55b7c2[_0x0ce5('0x38')]};return db[_0x0ce5('0x28')][_0x0ce5('0x1d')](_0x47784f)[_0x0ce5('0x20')](function(_0x273188){_0x1a2e1e['count']=_0x273188;if(_0x56edf9[_0x0ce5('0x2e')][_0x0ce5('0x3d')]){_0x55b7c2[_0x0ce5('0x3e')]=[{'all':!![]}];}return db[_0x0ce5('0x28')]['findAll'](_0x55b7c2);})[_0x0ce5('0x20')](function(_0x1a124f){_0x1a2e1e['rows']=_0x1a124f;return _0x1a2e1e;})[_0x0ce5('0x20')](respondWithFilteredResult(_0x414c39,_0x55b7c2))['catch'](handleError(_0x414c39,null));};exports[_0x0ce5('0x3f')]=function(_0x226373,_0x133d93){var _0x1c925a={'raw':![],'where':{'id':_0x226373[_0x0ce5('0x40')]['id']}},_0x394a81={};_0x394a81[_0x0ce5('0x2c')]=_[_0x0ce5('0x2d')](db['ZohoConfiguration']['rawAttributes']);_0x394a81[_0x0ce5('0x2e')]=_['keys'](_0x226373['query']);_0x394a81['filters']=_[_0x0ce5('0x30')](_0x394a81[_0x0ce5('0x2c')],_0x394a81['query']);_0x1c925a[_0x0ce5('0x32')]=_[_0x0ce5('0x30')](_0x394a81[_0x0ce5('0x2c')],qs['fields'](_0x226373['query'][_0x0ce5('0x31')]));_0x1c925a[_0x0ce5('0x32')]=_0x1c925a[_0x0ce5('0x32')]['length']?_0x1c925a[_0x0ce5('0x32')]:_0x394a81['model'];if(_0x226373['query']['includeAll']){_0x1c925a[_0x0ce5('0x3e')]=[{'all':!![]}];}_0x1c925a=_['merge']({},_0x1c925a,_0x226373[_0x0ce5('0x41')]);return db['ZohoConfiguration']['find'](_0x1c925a)[_0x0ce5('0x20')](handleEntityNotFound(_0x133d93,null))['then'](respondWithResult(_0x133d93,null))[_0x0ce5('0x42')](handleError(_0x133d93,null));};exports[_0x0ce5('0x43')]=function(_0x2d0e83,_0x31610f){return db[_0x0ce5('0x28')][_0x0ce5('0x43')](_0x2d0e83[_0x0ce5('0x44')],{})['then'](respondWithResult(_0x31610f,0xc9))[_0x0ce5('0x42')](handleError(_0x31610f,null));};exports[_0x0ce5('0x45')]=function(_0x1f9a0b,_0x5ab8fd){if(_0x1f9a0b[_0x0ce5('0x44')]['id']){delete _0x1f9a0b[_0x0ce5('0x44')]['id'];}return db['ZohoConfiguration'][_0x0ce5('0x46')]({'where':{'id':_0x1f9a0b[_0x0ce5('0x40')]['id']}})[_0x0ce5('0x20')](handleEntityNotFound(_0x5ab8fd,null))[_0x0ce5('0x20')](saveUpdates(_0x1f9a0b[_0x0ce5('0x44')],null))[_0x0ce5('0x20')](respondWithResult(_0x5ab8fd,null))[_0x0ce5('0x42')](handleError(_0x5ab8fd,null));};exports[_0x0ce5('0x21')]=function(_0xca4fe0,_0x1992fb){return db[_0x0ce5('0x28')][_0x0ce5('0x46')]({'where':{'id':_0xca4fe0[_0x0ce5('0x40')]['id']}})['then'](handleEntityNotFound(_0x1992fb,null))[_0x0ce5('0x20')](removeEntity(_0x1992fb,null))[_0x0ce5('0x42')](handleError(_0x1992fb,null));};exports['getFields']=function(_0x4fd99a,_0x5b620d,_0x28a11d){var _0x113f45={};var _0x90e560={};var _0x456ad8;var _0x24db83;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x4fd99a['params']['id']}})[_0x0ce5('0x20')](handleEntityNotFound(_0x5b620d,null))[_0x0ce5('0x20')](function(_0x1077aa){if(_0x1077aa){_0x456ad8=_0x1077aa;_0x90e560[_0x0ce5('0x2c')]=_[_0x0ce5('0x2d')](db[_0x0ce5('0x47')]['rawAttributes']);_0x90e560[_0x0ce5('0x2e')]=_['keys'](_0x4fd99a['query']);_0x90e560['filters']=_[_0x0ce5('0x30')](_0x90e560['model'],_0x90e560[_0x0ce5('0x2e')]);_0x113f45[_0x0ce5('0x32')]=_[_0x0ce5('0x30')](_0x90e560[_0x0ce5('0x2c')],qs[_0x0ce5('0x31')](_0x4fd99a[_0x0ce5('0x2e')]['fields']));_0x113f45[_0x0ce5('0x32')]=_0x113f45[_0x0ce5('0x32')][_0x0ce5('0x33')]?_0x113f45['attributes']:_0x90e560[_0x0ce5('0x2c')];_0x113f45[_0x0ce5('0x36')]=qs[_0x0ce5('0x37')](_0x4fd99a[_0x0ce5('0x2e')][_0x0ce5('0x37')]);_0x113f45[_0x0ce5('0x38')]=qs[_0x0ce5('0x2f')](_['pick'](_0x4fd99a[_0x0ce5('0x2e')],_0x90e560['filters']));if(_0x4fd99a[_0x0ce5('0x2e')][_0x0ce5('0x3a')]){_0x113f45[_0x0ce5('0x38')]=_[_0x0ce5('0x3b')](_0x113f45['where'],{'$or':_['map'](_0x113f45['attributes'],function(_0x569f34){var _0x4398de={};_0x4398de[_0x569f34]={'$like':'%'+_0x4fd99a[_0x0ce5('0x2e')][_0x0ce5('0x3a')]+'%'};return _0x4398de;})});}_0x113f45=_[_0x0ce5('0x3b')]({},_0x113f45,_0x4fd99a[_0x0ce5('0x41')]);return _0x456ad8['getFields'](_0x113f45);}})['then'](function(_0x585ec6){if(_0x585ec6){_0x24db83=_0x585ec6['length'];if(!_0x4fd99a[_0x0ce5('0x2e')][_0x0ce5('0x34')](_0x0ce5('0x35'))){_0x113f45['limit']=qs['limit'](_0x4fd99a[_0x0ce5('0x2e')][_0x0ce5('0x1c')]);_0x113f45[_0x0ce5('0x1a')]=qs[_0x0ce5('0x1a')](_0x4fd99a[_0x0ce5('0x2e')][_0x0ce5('0x1a')]);}return _0x456ad8[_0x0ce5('0x48')](_0x113f45);}})[_0x0ce5('0x20')](function(_0xa9a81c){if(_0xa9a81c){return _0xa9a81c?{'count':_0x24db83,'rows':_0xa9a81c}:null;}})[_0x0ce5('0x20')](respondWithResult(_0x5b620d,null))[_0x0ce5('0x42')](handleError(_0x5b620d,null));};exports[_0x0ce5('0x49')]=function(_0x4d8b6a,_0x505e24,_0x271991){var _0x51ca41={};var _0x80325b={};var _0x698099;var _0x5dffb6;return db[_0x0ce5('0x28')][_0x0ce5('0x4a')]({'where':{'id':_0x4d8b6a['params']['id']}})[_0x0ce5('0x20')](handleEntityNotFound(_0x505e24,null))[_0x0ce5('0x20')](function(_0x3c3302){if(_0x3c3302){_0x698099=_0x3c3302;_0x80325b[_0x0ce5('0x2c')]=_[_0x0ce5('0x2d')](db[_0x0ce5('0x47')][_0x0ce5('0x29')]);_0x80325b[_0x0ce5('0x2e')]=_['keys'](_0x4d8b6a[_0x0ce5('0x2e')]);_0x80325b['filters']=_['intersection'](_0x80325b[_0x0ce5('0x2c')],_0x80325b[_0x0ce5('0x2e')]);_0x51ca41['attributes']=_[_0x0ce5('0x30')](_0x80325b['model'],qs[_0x0ce5('0x31')](_0x4d8b6a[_0x0ce5('0x2e')]['fields']));_0x51ca41[_0x0ce5('0x32')]=_0x51ca41[_0x0ce5('0x32')][_0x0ce5('0x33')]?_0x51ca41[_0x0ce5('0x32')]:_0x80325b[_0x0ce5('0x2c')];_0x51ca41[_0x0ce5('0x36')]=qs[_0x0ce5('0x37')](_0x4d8b6a['query'][_0x0ce5('0x37')]);_0x51ca41[_0x0ce5('0x38')]=qs[_0x0ce5('0x2f')](_[_0x0ce5('0x39')](_0x4d8b6a['query'],_0x80325b[_0x0ce5('0x2f')]));if(_0x4d8b6a[_0x0ce5('0x2e')]['filter']){_0x51ca41['where']=_[_0x0ce5('0x3b')](_0x51ca41[_0x0ce5('0x38')],{'$or':_[_0x0ce5('0x27')](_0x51ca41[_0x0ce5('0x32')],function(_0x4c5de1){var _0x2fb23f={};_0x2fb23f[_0x4c5de1]={'$like':'%'+_0x4d8b6a[_0x0ce5('0x2e')][_0x0ce5('0x3a')]+'%'};return _0x2fb23f;})});}_0x51ca41=_[_0x0ce5('0x3b')]({},_0x51ca41,_0x4d8b6a['options']);return _0x698099[_0x0ce5('0x49')](_0x51ca41);}})[_0x0ce5('0x20')](function(_0x4e9ba9){if(_0x4e9ba9){_0x5dffb6=_0x4e9ba9[_0x0ce5('0x33')];if(!_0x4d8b6a[_0x0ce5('0x2e')]['hasOwnProperty'](_0x0ce5('0x35'))){_0x51ca41[_0x0ce5('0x1c')]=qs[_0x0ce5('0x1c')](_0x4d8b6a['query']['limit']);_0x51ca41['offset']=qs[_0x0ce5('0x1a')](_0x4d8b6a[_0x0ce5('0x2e')][_0x0ce5('0x1a')]);}return _0x698099['getSubjects'](_0x51ca41);}})[_0x0ce5('0x20')](function(_0x267a0a){if(_0x267a0a){return _0x267a0a?{'count':_0x5dffb6,'rows':_0x267a0a}:null;}})[_0x0ce5('0x20')](respondWithResult(_0x505e24,null))[_0x0ce5('0x42')](handleError(_0x505e24,null));};exports[_0x0ce5('0x4b')]=function(_0x3146d8,_0x2d47c7,_0x3837a5){var _0x29b838={};var _0x3cb3de={};var _0x2d2ef6;var _0x45a309;return db[_0x0ce5('0x28')][_0x0ce5('0x4a')]({'where':{'id':_0x3146d8['params']['id']}})[_0x0ce5('0x20')](handleEntityNotFound(_0x2d47c7,null))[_0x0ce5('0x20')](function(_0x266562){if(_0x266562){_0x2d2ef6=_0x266562;_0x3cb3de[_0x0ce5('0x2c')]=_[_0x0ce5('0x2d')](db['ZohoField']['rawAttributes']);_0x3cb3de[_0x0ce5('0x2e')]=_[_0x0ce5('0x2d')](_0x3146d8[_0x0ce5('0x2e')]);_0x3cb3de['filters']=_[_0x0ce5('0x30')](_0x3cb3de[_0x0ce5('0x2c')],_0x3cb3de['query']);_0x29b838[_0x0ce5('0x32')]=_[_0x0ce5('0x30')](_0x3cb3de['model'],qs[_0x0ce5('0x31')](_0x3146d8[_0x0ce5('0x2e')][_0x0ce5('0x31')]));_0x29b838[_0x0ce5('0x32')]=_0x29b838[_0x0ce5('0x32')][_0x0ce5('0x33')]?_0x29b838['attributes']:_0x3cb3de['model'];_0x29b838[_0x0ce5('0x36')]=qs[_0x0ce5('0x37')](_0x3146d8['query'][_0x0ce5('0x37')]);_0x29b838[_0x0ce5('0x38')]=qs[_0x0ce5('0x2f')](_['pick'](_0x3146d8[_0x0ce5('0x2e')],_0x3cb3de[_0x0ce5('0x2f')]));if(_0x3146d8['query'][_0x0ce5('0x3a')]){_0x29b838['where']=_[_0x0ce5('0x3b')](_0x29b838[_0x0ce5('0x38')],{'$or':_['map'](_0x29b838[_0x0ce5('0x32')],function(_0x299f33){var _0x5badf8={};_0x5badf8[_0x299f33]={'$like':'%'+_0x3146d8[_0x0ce5('0x2e')][_0x0ce5('0x3a')]+'%'};return _0x5badf8;})});}_0x29b838=_[_0x0ce5('0x3b')]({},_0x29b838,_0x3146d8[_0x0ce5('0x41')]);return _0x2d2ef6['getDescriptions'](_0x29b838);}})[_0x0ce5('0x20')](function(_0x5d4784){if(_0x5d4784){_0x45a309=_0x5d4784[_0x0ce5('0x33')];if(!_0x3146d8[_0x0ce5('0x2e')][_0x0ce5('0x34')](_0x0ce5('0x35'))){_0x29b838[_0x0ce5('0x1c')]=qs['limit'](_0x3146d8[_0x0ce5('0x2e')][_0x0ce5('0x1c')]);_0x29b838[_0x0ce5('0x1a')]=qs['offset'](_0x3146d8[_0x0ce5('0x2e')][_0x0ce5('0x1a')]);}return _0x2d2ef6[_0x0ce5('0x4b')](_0x29b838);}})[_0x0ce5('0x20')](function(_0x2e1699){if(_0x2e1699){return _0x2e1699?{'count':_0x45a309,'rows':_0x2e1699}:null;}})['then'](respondWithResult(_0x2d47c7,null))[_0x0ce5('0x42')](handleError(_0x2d47c7,null));}; \ No newline at end of file +var _0x507f=['../../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','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','length','include','create','body','find','params','destroy','getFields','ZohoField','pick','findOne','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x122fe6,_0x4ac758){var _0x36b7d2=function(_0x12fca2){while(--_0x12fca2){_0x122fe6['push'](_0x122fe6['shift']());}};_0x36b7d2(++_0x4ac758);}(_0x507f,0x138));var _0xf507=function(_0x422311,_0x54125c){_0x422311=_0x422311-0x0;var _0x356858=_0x507f[_0x422311];return _0x356858;};'use strict';var emlformat=require(_0xf507('0x0'));var rimraf=require(_0xf507('0x1'));var zipdir=require(_0xf507('0x2'));var jsonpatch=require(_0xf507('0x3'));var rp=require('request-promise');var moment=require(_0xf507('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf507('0x5'));var path=require(_0xf507('0x6'));var sox=require('sox');var csv=require(_0xf507('0x7'));var ejs=require(_0xf507('0x8'));var fs=require('fs');var fs_extra=require(_0xf507('0x9'));var _=require(_0xf507('0xa'));var squel=require('squel');var crypto=require(_0xf507('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf507('0xc'));var toCsv=require(_0xf507('0x7'));var querystring=require(_0xf507('0xd'));var Papa=require(_0xf507('0xe'));var Redis=require(_0xf507('0xf'));var authService=require(_0xf507('0x10'));var qs=require(_0xf507('0x11'));var as=require(_0xf507('0x12'));var hardwareService=require(_0xf507('0x13'));var logger=require(_0xf507('0x14'))(_0xf507('0x15'));var utils=require('../../config/utils');var config=require(_0xf507('0x16'));var licenseUtil=require(_0xf507('0x17'));var db=require(_0xf507('0x18'))['db'];function respondWithStatusCode(_0x2f5e46,_0x35502e){_0x35502e=_0x35502e||0xcc;return function(_0x4d424b){if(_0x4d424b){return _0x2f5e46[_0xf507('0x19')](_0x35502e);}return _0x2f5e46[_0xf507('0x1a')](_0x35502e)[_0xf507('0x1b')]();};}function respondWithResult(_0x56f5f0,_0x483b2e){_0x483b2e=_0x483b2e||0xc8;return function(_0xa6718c){if(_0xa6718c){return _0x56f5f0[_0xf507('0x1a')](_0x483b2e)['json'](_0xa6718c);}};}function respondWithFilteredResult(_0x277754,_0x1a6b2f){return function(_0x2d8aab){if(_0x2d8aab){var _0x5abe83=typeof _0x1a6b2f[_0xf507('0x1c')]===_0xf507('0x1d')&&typeof _0x1a6b2f['limit']==='undefined';var _0xd2715a=_0x2d8aab[_0xf507('0x1e')];var _0x584373=_0x5abe83?0x0:_0x1a6b2f['offset'];var _0x17a65b=_0x5abe83?_0x2d8aab['count']:_0x1a6b2f[_0xf507('0x1c')]+_0x1a6b2f[_0xf507('0x1f')];var _0x12fc38;if(_0x17a65b>=_0xd2715a){_0x17a65b=_0xd2715a;_0x12fc38=0xc8;}else{_0x12fc38=0xce;}_0x277754[_0xf507('0x1a')](_0x12fc38);return _0x277754[_0xf507('0x20')](_0xf507('0x21'),_0x584373+'-'+_0x17a65b+'/'+_0xd2715a)['json'](_0x2d8aab);}return null;};}function patchUpdates(_0x7d9b31){return function(_0x232704){try{jsonpatch[_0xf507('0x22')](_0x232704,_0x7d9b31,!![]);}catch(_0xdac67d){return BPromise[_0xf507('0x23')](_0xdac67d);}return _0x232704[_0xf507('0x24')]();};}function saveUpdates(_0x119042,_0x276100){return function(_0x25a896){if(_0x25a896){return _0x25a896[_0xf507('0x25')](_0x119042)[_0xf507('0x26')](function(_0x104862){return _0x104862;});}return null;};}function removeEntity(_0x4d6bfb,_0x3f7498){return function(_0x49418c){if(_0x49418c){return _0x49418c['destroy']()[_0xf507('0x26')](function(){_0x4d6bfb[_0xf507('0x1a')](0xcc)[_0xf507('0x1b')]();});}};}function handleEntityNotFound(_0x2a87ae,_0x47d5fd){return function(_0x3f2012){if(!_0x3f2012){_0x2a87ae['sendStatus'](0x194);}return _0x3f2012;};}function handleError(_0x37dd91,_0x160ce2){_0x160ce2=_0x160ce2||0x1f4;return function(_0x292ad8){logger['error'](_0x292ad8[_0xf507('0x27')]);if(_0x292ad8[_0xf507('0x28')]){delete _0x292ad8[_0xf507('0x28')];}_0x37dd91[_0xf507('0x1a')](_0x160ce2)[_0xf507('0x29')](_0x292ad8);};}exports[_0xf507('0x2a')]=function(_0x1c8ae6,_0x394ad0){var _0x402b86={},_0x840fe={},_0x2b103e={'count':0x0,'rows':[]};var _0x367491=_[_0xf507('0x2b')](db[_0xf507('0x2c')][_0xf507('0x2d')],function(_0x298e72){return{'name':_0x298e72['fieldName'],'type':_0x298e72[_0xf507('0x2e')][_0xf507('0x2f')]};});_0x840fe['model']=_[_0xf507('0x2b')](_0x367491,_0xf507('0x28'));_0x840fe[_0xf507('0x30')]=_[_0xf507('0x31')](_0x1c8ae6[_0xf507('0x30')]);_0x840fe[_0xf507('0x32')]=_['intersection'](_0x840fe[_0xf507('0x33')],_0x840fe[_0xf507('0x30')]);_0x402b86[_0xf507('0x34')]=_[_0xf507('0x35')](_0x840fe[_0xf507('0x33')],qs[_0xf507('0x36')](_0x1c8ae6[_0xf507('0x30')][_0xf507('0x36')]));_0x402b86[_0xf507('0x34')]=_0x402b86[_0xf507('0x34')]['length']?_0x402b86['attributes']:_0x840fe[_0xf507('0x33')];if(!_0x1c8ae6['query'][_0xf507('0x37')](_0xf507('0x38'))){_0x402b86[_0xf507('0x1f')]=qs[_0xf507('0x1f')](_0x1c8ae6['query'][_0xf507('0x1f')]);_0x402b86['offset']=qs['offset'](_0x1c8ae6[_0xf507('0x30')][_0xf507('0x1c')]);}_0x402b86[_0xf507('0x39')]=qs[_0xf507('0x3a')](_0x1c8ae6[_0xf507('0x30')]['sort']);_0x402b86[_0xf507('0x3b')]=qs['filters'](_['pick'](_0x1c8ae6[_0xf507('0x30')],_0x840fe['filters']),_0x367491);if(_0x1c8ae6['query'][_0xf507('0x3c')]){_0x402b86[_0xf507('0x3b')]=_[_0xf507('0x3d')](_0x402b86[_0xf507('0x3b')],{'$or':_['map'](_0x367491,function(_0x2043dd){if(_0x2043dd['type']!==_0xf507('0x3e')){var _0x15c0de={};_0x15c0de[_0x2043dd['name']]={'$like':'%'+_0x1c8ae6[_0xf507('0x30')][_0xf507('0x3c')]+'%'};return _0x15c0de;}})});}_0x402b86=_[_0xf507('0x3d')]({},_0x402b86,_0x1c8ae6['options']);var _0x25e7cc={'where':_0x402b86['where']};return db[_0xf507('0x2c')][_0xf507('0x1e')](_0x25e7cc)[_0xf507('0x26')](function(_0x4e736b){_0x2b103e[_0xf507('0x1e')]=_0x4e736b;if(_0x1c8ae6[_0xf507('0x30')][_0xf507('0x3f')]){_0x402b86['include']=[{'all':!![]}];}return db[_0xf507('0x2c')][_0xf507('0x40')](_0x402b86);})[_0xf507('0x26')](function(_0x1da45f){_0x2b103e[_0xf507('0x41')]=_0x1da45f;return _0x2b103e;})['then'](respondWithFilteredResult(_0x394ad0,_0x402b86))[_0xf507('0x42')](handleError(_0x394ad0,null));};exports[_0xf507('0x43')]=function(_0x55b3c1,_0x7d62ea){var _0x5df627={'raw':![],'where':{'id':_0x55b3c1['params']['id']}},_0x5d8852={};_0x5d8852[_0xf507('0x33')]=_['keys'](db['ZohoConfiguration'][_0xf507('0x2d')]);_0x5d8852[_0xf507('0x30')]=_[_0xf507('0x31')](_0x55b3c1['query']);_0x5d8852[_0xf507('0x32')]=_[_0xf507('0x35')](_0x5d8852[_0xf507('0x33')],_0x5d8852[_0xf507('0x30')]);_0x5df627['attributes']=_['intersection'](_0x5d8852[_0xf507('0x33')],qs[_0xf507('0x36')](_0x55b3c1['query'][_0xf507('0x36')]));_0x5df627['attributes']=_0x5df627[_0xf507('0x34')][_0xf507('0x44')]?_0x5df627[_0xf507('0x34')]:_0x5d8852[_0xf507('0x33')];if(_0x55b3c1[_0xf507('0x30')][_0xf507('0x3f')]){_0x5df627[_0xf507('0x45')]=[{'all':!![]}];}_0x5df627=_[_0xf507('0x3d')]({},_0x5df627,_0x55b3c1['options']);return db['ZohoConfiguration']['find'](_0x5df627)[_0xf507('0x26')](handleEntityNotFound(_0x7d62ea,null))['then'](respondWithResult(_0x7d62ea,null))['catch'](handleError(_0x7d62ea,null));};exports['create']=function(_0x2b697f,_0x5368a1){return db['ZohoConfiguration'][_0xf507('0x46')](_0x2b697f['body'],{})[_0xf507('0x26')](respondWithResult(_0x5368a1,0xc9))[_0xf507('0x42')](handleError(_0x5368a1,null));};exports[_0xf507('0x25')]=function(_0x4534b7,_0x12e1c8){if(_0x4534b7[_0xf507('0x47')]['id']){delete _0x4534b7[_0xf507('0x47')]['id'];}return db[_0xf507('0x2c')][_0xf507('0x48')]({'where':{'id':_0x4534b7[_0xf507('0x49')]['id']}})[_0xf507('0x26')](handleEntityNotFound(_0x12e1c8,null))[_0xf507('0x26')](saveUpdates(_0x4534b7[_0xf507('0x47')],null))[_0xf507('0x26')](respondWithResult(_0x12e1c8,null))[_0xf507('0x42')](handleError(_0x12e1c8,null));};exports[_0xf507('0x4a')]=function(_0x4ab6ae,_0x45196e){return db[_0xf507('0x2c')][_0xf507('0x48')]({'where':{'id':_0x4ab6ae['params']['id']}})[_0xf507('0x26')](handleEntityNotFound(_0x45196e,null))['then'](removeEntity(_0x45196e,null))[_0xf507('0x42')](handleError(_0x45196e,null));};exports[_0xf507('0x4b')]=function(_0x5c7fd9,_0x312b1d,_0x11e2a5){var _0x25c778={};var _0xb8cd6a={};var _0x4dc0f7;var _0xd93fe2;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x5c7fd9['params']['id']}})[_0xf507('0x26')](handleEntityNotFound(_0x312b1d,null))[_0xf507('0x26')](function(_0x4a0daf){if(_0x4a0daf){_0x4dc0f7=_0x4a0daf;_0xb8cd6a[_0xf507('0x33')]=_[_0xf507('0x31')](db[_0xf507('0x4c')][_0xf507('0x2d')]);_0xb8cd6a[_0xf507('0x30')]=_[_0xf507('0x31')](_0x5c7fd9[_0xf507('0x30')]);_0xb8cd6a[_0xf507('0x32')]=_['intersection'](_0xb8cd6a[_0xf507('0x33')],_0xb8cd6a[_0xf507('0x30')]);_0x25c778[_0xf507('0x34')]=_[_0xf507('0x35')](_0xb8cd6a['model'],qs[_0xf507('0x36')](_0x5c7fd9[_0xf507('0x30')][_0xf507('0x36')]));_0x25c778['attributes']=_0x25c778['attributes'][_0xf507('0x44')]?_0x25c778[_0xf507('0x34')]:_0xb8cd6a[_0xf507('0x33')];_0x25c778['order']=qs['sort'](_0x5c7fd9['query'][_0xf507('0x3a')]);_0x25c778[_0xf507('0x3b')]=qs[_0xf507('0x32')](_[_0xf507('0x4d')](_0x5c7fd9[_0xf507('0x30')],_0xb8cd6a[_0xf507('0x32')]));if(_0x5c7fd9[_0xf507('0x30')][_0xf507('0x3c')]){_0x25c778[_0xf507('0x3b')]=_[_0xf507('0x3d')](_0x25c778['where'],{'$or':_[_0xf507('0x2b')](_0x25c778[_0xf507('0x34')],function(_0x29c95f){var _0x5d2c30={};_0x5d2c30[_0x29c95f]={'$like':'%'+_0x5c7fd9[_0xf507('0x30')][_0xf507('0x3c')]+'%'};return _0x5d2c30;})});}_0x25c778=_[_0xf507('0x3d')]({},_0x25c778,_0x5c7fd9['options']);return _0x4dc0f7[_0xf507('0x4b')](_0x25c778);}})[_0xf507('0x26')](function(_0x400d03){if(_0x400d03){_0xd93fe2=_0x400d03[_0xf507('0x44')];if(!_0x5c7fd9['query'][_0xf507('0x37')](_0xf507('0x38'))){_0x25c778[_0xf507('0x1f')]=qs['limit'](_0x5c7fd9[_0xf507('0x30')][_0xf507('0x1f')]);_0x25c778[_0xf507('0x1c')]=qs[_0xf507('0x1c')](_0x5c7fd9[_0xf507('0x30')][_0xf507('0x1c')]);}return _0x4dc0f7[_0xf507('0x4b')](_0x25c778);}})[_0xf507('0x26')](function(_0x1fc341){if(_0x1fc341){return _0x1fc341?{'count':_0xd93fe2,'rows':_0x1fc341}:null;}})[_0xf507('0x26')](respondWithResult(_0x312b1d,null))['catch'](handleError(_0x312b1d,null));};exports['getSubjects']=function(_0x4289eb,_0x4d3d12,_0xa3c8c6){var _0x19dc9e={};var _0x2cf686={};var _0xfd0d9f;var _0x5ecfb6;return db[_0xf507('0x2c')][_0xf507('0x4e')]({'where':{'id':_0x4289eb[_0xf507('0x49')]['id']}})['then'](handleEntityNotFound(_0x4d3d12,null))[_0xf507('0x26')](function(_0x266329){if(_0x266329){_0xfd0d9f=_0x266329;_0x2cf686[_0xf507('0x33')]=_[_0xf507('0x31')](db[_0xf507('0x4c')][_0xf507('0x2d')]);_0x2cf686[_0xf507('0x30')]=_[_0xf507('0x31')](_0x4289eb[_0xf507('0x30')]);_0x2cf686[_0xf507('0x32')]=_[_0xf507('0x35')](_0x2cf686[_0xf507('0x33')],_0x2cf686[_0xf507('0x30')]);_0x19dc9e[_0xf507('0x34')]=_[_0xf507('0x35')](_0x2cf686[_0xf507('0x33')],qs[_0xf507('0x36')](_0x4289eb[_0xf507('0x30')][_0xf507('0x36')]));_0x19dc9e['attributes']=_0x19dc9e['attributes']['length']?_0x19dc9e[_0xf507('0x34')]:_0x2cf686[_0xf507('0x33')];_0x19dc9e[_0xf507('0x39')]=qs[_0xf507('0x3a')](_0x4289eb[_0xf507('0x30')][_0xf507('0x3a')]);_0x19dc9e['where']=qs[_0xf507('0x32')](_[_0xf507('0x4d')](_0x4289eb[_0xf507('0x30')],_0x2cf686['filters']));if(_0x4289eb[_0xf507('0x30')][_0xf507('0x3c')]){_0x19dc9e[_0xf507('0x3b')]=_['merge'](_0x19dc9e[_0xf507('0x3b')],{'$or':_[_0xf507('0x2b')](_0x19dc9e[_0xf507('0x34')],function(_0x46e360){var _0x325bdc={};_0x325bdc[_0x46e360]={'$like':'%'+_0x4289eb[_0xf507('0x30')][_0xf507('0x3c')]+'%'};return _0x325bdc;})});}_0x19dc9e=_[_0xf507('0x3d')]({},_0x19dc9e,_0x4289eb[_0xf507('0x4f')]);return _0xfd0d9f[_0xf507('0x50')](_0x19dc9e);}})[_0xf507('0x26')](function(_0x15641b){if(_0x15641b){_0x5ecfb6=_0x15641b[_0xf507('0x44')];if(!_0x4289eb['query'][_0xf507('0x37')](_0xf507('0x38'))){_0x19dc9e[_0xf507('0x1f')]=qs['limit'](_0x4289eb[_0xf507('0x30')]['limit']);_0x19dc9e[_0xf507('0x1c')]=qs[_0xf507('0x1c')](_0x4289eb[_0xf507('0x30')][_0xf507('0x1c')]);}return _0xfd0d9f[_0xf507('0x50')](_0x19dc9e);}})['then'](function(_0x368b8e){if(_0x368b8e){return _0x368b8e?{'count':_0x5ecfb6,'rows':_0x368b8e}:null;}})['then'](respondWithResult(_0x4d3d12,null))[_0xf507('0x42')](handleError(_0x4d3d12,null));};exports[_0xf507('0x51')]=function(_0x4da5ea,_0x477041,_0x3c28b0){var _0x1c797f={};var _0x292189={};var _0x43141b;var _0x279e72;return db[_0xf507('0x2c')][_0xf507('0x4e')]({'where':{'id':_0x4da5ea['params']['id']}})[_0xf507('0x26')](handleEntityNotFound(_0x477041,null))[_0xf507('0x26')](function(_0x329dd9){if(_0x329dd9){_0x43141b=_0x329dd9;_0x292189[_0xf507('0x33')]=_[_0xf507('0x31')](db[_0xf507('0x4c')][_0xf507('0x2d')]);_0x292189[_0xf507('0x30')]=_[_0xf507('0x31')](_0x4da5ea[_0xf507('0x30')]);_0x292189['filters']=_['intersection'](_0x292189['model'],_0x292189[_0xf507('0x30')]);_0x1c797f[_0xf507('0x34')]=_[_0xf507('0x35')](_0x292189[_0xf507('0x33')],qs['fields'](_0x4da5ea['query'][_0xf507('0x36')]));_0x1c797f[_0xf507('0x34')]=_0x1c797f[_0xf507('0x34')][_0xf507('0x44')]?_0x1c797f[_0xf507('0x34')]:_0x292189[_0xf507('0x33')];_0x1c797f[_0xf507('0x39')]=qs['sort'](_0x4da5ea[_0xf507('0x30')][_0xf507('0x3a')]);_0x1c797f[_0xf507('0x3b')]=qs['filters'](_[_0xf507('0x4d')](_0x4da5ea[_0xf507('0x30')],_0x292189[_0xf507('0x32')]));if(_0x4da5ea[_0xf507('0x30')][_0xf507('0x3c')]){_0x1c797f[_0xf507('0x3b')]=_[_0xf507('0x3d')](_0x1c797f[_0xf507('0x3b')],{'$or':_[_0xf507('0x2b')](_0x1c797f['attributes'],function(_0x2b7e4c){var _0x1fa852={};_0x1fa852[_0x2b7e4c]={'$like':'%'+_0x4da5ea[_0xf507('0x30')][_0xf507('0x3c')]+'%'};return _0x1fa852;})});}_0x1c797f=_[_0xf507('0x3d')]({},_0x1c797f,_0x4da5ea[_0xf507('0x4f')]);return _0x43141b['getDescriptions'](_0x1c797f);}})[_0xf507('0x26')](function(_0x2e6295){if(_0x2e6295){_0x279e72=_0x2e6295[_0xf507('0x44')];if(!_0x4da5ea[_0xf507('0x30')][_0xf507('0x37')]('nolimit')){_0x1c797f[_0xf507('0x1f')]=qs[_0xf507('0x1f')](_0x4da5ea[_0xf507('0x30')][_0xf507('0x1f')]);_0x1c797f[_0xf507('0x1c')]=qs['offset'](_0x4da5ea[_0xf507('0x30')][_0xf507('0x1c')]);}return _0x43141b['getDescriptions'](_0x1c797f);}})[_0xf507('0x26')](function(_0x44b55f){if(_0x44b55f){return _0x44b55f?{'count':_0x279e72,'rows':_0x44b55f}:null;}})[_0xf507('0x26')](respondWithResult(_0x477041,null))[_0xf507('0x42')](handleError(_0x477041,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 39df29f..a1843ca 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 _0xfe94=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','path','./intZohoConfiguration.attributes','exports'];(function(_0x37b577,_0x157cf5){var _0x4ff100=function(_0x1bf26f){while(--_0x1bf26f){_0x37b577['push'](_0x37b577['shift']());}};_0x4ff100(++_0x157cf5);}(_0xfe94,0x135));var _0x4fe9=function(_0x2bed5b,_0x252c28){_0x2bed5b=_0x2bed5b-0x0;var _0xb4ab2d=_0xfe94[_0x2bed5b];return _0xb4ab2d;};'use strict';var _=require(_0x4fe9('0x0'));var util=require(_0x4fe9('0x1'));var logger=require(_0x4fe9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fe9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4fe9('0x4'));module[_0x4fe9('0x5')]=function(_0x1568db,_0x1b5ccf){return _0x1568db[_0x4fe9('0x6')](_0x4fe9('0x7'),attributes,{'tableName':_0x4fe9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d1b=['int_zoho_configurations','lodash','util','../../config/logger','api','moment','rimraf','exports','define','ZohoConfiguration'];(function(_0x51e881,_0x2962a0){var _0x24d8ca=function(_0x2ce6c9){while(--_0x2ce6c9){_0x51e881['push'](_0x51e881['shift']());}};_0x24d8ca(++_0x2962a0);}(_0x8d1b,0xfb));var _0xb8d1=function(_0x5cebc1,_0x587c7e){_0x5cebc1=_0x5cebc1-0x0;var _0x18caad=_0x8d1b[_0x5cebc1];return _0x18caad;};'use strict';var _=require(_0xb8d1('0x0'));var util=require(_0xb8d1('0x1'));var logger=require(_0xb8d1('0x2'))(_0xb8d1('0x3'));var moment=require(_0xb8d1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb8d1('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xb8d1('0x6')]=function(_0x539199,_0x1c4592){return _0x539199[_0xb8d1('0x7')](_0xb8d1('0x8'),attributes,{'tableName':_0xb8d1('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 c6ac44e..78aac63 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 _0x6600=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x19c5dd,_0x2a35f5){var _0x40218d=function(_0x1a07ad){while(--_0x1a07ad){_0x19c5dd['push'](_0x19c5dd['shift']());}};_0x40218d(++_0x2a35f5);}(_0x6600,0x88));var _0x0660=function(_0x4f3dee,_0x4664bf){_0x4f3dee=_0x4f3dee-0x0;var _0x4373f7=_0x6600[_0x4f3dee];return _0x4373f7;};'use strict';var _=require('lodash');var util=require(_0x0660('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0660('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0660('0x2'));var logger=require(_0x0660('0x3'))('rpc');var config=require(_0x0660('0x4'));var jayson=require(_0x0660('0x5'));var client=jayson[_0x0660('0x6')][_0x0660('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x162ab2,_0x1f8fe2,_0xee57b3){return new BPromise(function(_0x47ae39,_0x1b98e3){return client[_0x0660('0x8')](_0x162ab2,_0xee57b3)[_0x0660('0x9')](function(_0x2e79f9){logger[_0x0660('0xa')](_0x0660('0xb'),_0x1f8fe2,_0x0660('0xc'));logger[_0x0660('0xd')](_0x0660('0xe'),_0x1f8fe2,_0x0660('0xc'),JSON[_0x0660('0xf')](_0x2e79f9));if(_0x2e79f9[_0x0660('0x10')]){if(_0x2e79f9['error'][_0x0660('0x11')]===0x1f4){logger[_0x0660('0x10')](_0x0660('0xb'),_0x1f8fe2,_0x2e79f9['error'][_0x0660('0x12')]);return _0x1b98e3(_0x2e79f9[_0x0660('0x10')]['message']);}logger[_0x0660('0x10')](_0x0660('0xb'),_0x1f8fe2,_0x2e79f9['error'][_0x0660('0x12')]);return _0x47ae39(_0x2e79f9[_0x0660('0x10')][_0x0660('0x12')]);}else{logger[_0x0660('0xa')](_0x0660('0xb'),_0x1f8fe2,_0x0660('0xc'));_0x47ae39(_0x2e79f9[_0x0660('0x13')][_0x0660('0x12')]);}})[_0x0660('0x14')](function(_0x598822){logger[_0x0660('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x1f8fe2,_0x598822);_0x1b98e3(_0x598822);});});} \ No newline at end of file +var _0xe5cf=['request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x52740f,_0x343961){var _0x1cbe11=function(_0x376976){while(--_0x376976){_0x52740f['push'](_0x52740f['shift']());}};_0x1cbe11(++_0x343961);}(_0xe5cf,0xe8));var _0xfe5c=function(_0x2c26ad,_0x3dc14a){_0x2c26ad=_0x2c26ad-0x0;var _0x451628=_0xe5cf[_0x2c26ad];return _0x451628;};'use strict';var _=require('lodash');var util=require(_0xfe5c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfe5c('0x1'));var fs=require('fs');var Redis=require(_0xfe5c('0x2'));var db=require(_0xfe5c('0x3'))['db'];var utils=require(_0xfe5c('0x4'));var logger=require('../../config/logger')(_0xfe5c('0x5'));var config=require(_0xfe5c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfe5c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x512091,_0x2701e7,_0x4a9888){return new BPromise(function(_0x39cc19,_0x22487e){return client[_0xfe5c('0x8')](_0x512091,_0x4a9888)['then'](function(_0x597ee6){logger[_0xfe5c('0x9')](_0xfe5c('0xa'),_0x2701e7,_0xfe5c('0xb'));logger[_0xfe5c('0xc')](_0xfe5c('0xd'),_0x2701e7,_0xfe5c('0xb'),JSON[_0xfe5c('0xe')](_0x597ee6));if(_0x597ee6[_0xfe5c('0xf')]){if(_0x597ee6[_0xfe5c('0xf')][_0xfe5c('0x10')]===0x1f4){logger[_0xfe5c('0xf')](_0xfe5c('0xa'),_0x2701e7,_0x597ee6[_0xfe5c('0xf')]['message']);return _0x22487e(_0x597ee6[_0xfe5c('0xf')]['message']);}logger[_0xfe5c('0xf')](_0xfe5c('0xa'),_0x2701e7,_0x597ee6['error'][_0xfe5c('0x11')]);return _0x39cc19(_0x597ee6[_0xfe5c('0xf')]['message']);}else{logger[_0xfe5c('0x9')](_0xfe5c('0xa'),_0x2701e7,_0xfe5c('0xb'));_0x39cc19(_0x597ee6[_0xfe5c('0x12')][_0xfe5c('0x11')]);}})[_0xfe5c('0x13')](function(_0x3f670d){logger[_0xfe5c('0xf')](_0xfe5c('0xa'),_0x2701e7,_0x3f670d);_0x22487e(_0x3f670d);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 6d4aec1..2d50b72 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 _0xe16f=['multer','util','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','show','post','create','/:id','destroy','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe16f,0xd2));var _0xfe16=function(_0x48a4f2,_0x53a14b){_0x48a4f2=_0x48a4f2-0x0;var _0x4d9bfd=_0xe16f[_0x48a4f2];return _0x4d9bfd;};'use strict';var multer=require(_0xfe16('0x0'));var util=require(_0xfe16('0x1'));var path=require('path');var timeout=require(_0xfe16('0x2'));var express=require(_0xfe16('0x3'));var router=express[_0xfe16('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe16('0x5'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0xfe16('0x6')]('/',auth[_0xfe16('0x7')](),controller[_0xfe16('0x8')]);router[_0xfe16('0x6')]('/:id',auth[_0xfe16('0x7')](),controller[_0xfe16('0x9')]);router[_0xfe16('0xa')]('/',auth[_0xfe16('0x7')](),controller[_0xfe16('0xb')]);router['put'](_0xfe16('0xc'),auth[_0xfe16('0x7')](),controller['update']);router['delete'](_0xfe16('0xc'),auth[_0xfe16('0x7')](),controller[_0xfe16('0xd')]);module[_0xfe16('0xe')]=router; \ No newline at end of file +var _0x88f6=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','/:id','post','isAuthenticated','create','put','delete','exports','multer','path','connect-timeout'];(function(_0x27650c,_0x27ad8a){var _0x1a0059=function(_0x40312e){while(--_0x40312e){_0x27650c['push'](_0x27650c['shift']());}};_0x1a0059(++_0x27ad8a);}(_0x88f6,0x13d));var _0x688f=function(_0x4f22f9,_0x3c9fac){_0x4f22f9=_0x4f22f9-0x0;var _0x40fae0=_0x88f6[_0x4f22f9];return _0x40fae0;};'use strict';var multer=require(_0x688f('0x0'));var util=require('util');var path=require(_0x688f('0x1'));var timeout=require(_0x688f('0x2'));var express=require(_0x688f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x688f('0x4'));var interaction=require(_0x688f('0x5'));var config=require(_0x688f('0x6'));var controller=require(_0x688f('0x7'));router[_0x688f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x688f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x688f('0xa')]('/',auth[_0x688f('0xb')](),controller[_0x688f('0xc')]);router[_0x688f('0xd')](_0x688f('0x9'),auth[_0x688f('0xb')](),controller['update']);router[_0x688f('0xe')]('/:id',auth[_0x688f('0xb')](),controller['destroy']);module[_0x688f('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 915c9cd..a2bbe7a 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 _0x2ba7=['BOOLEAN','sequelize','exports','variable','customVariable','picklist','string','STRING','ENUM'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2ba7,0x160));var _0x72ba=function(_0x3d1a27,_0x3e9a2d){_0x3d1a27=_0x3d1a27-0x0;var _0x3b72fe=_0x2ba7[_0x3d1a27];return _0x3b72fe;};'use strict';var Sequelize=require(_0x72ba('0x0'));module[_0x72ba('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x72ba('0x2'),_0x72ba('0x3'),'keyValue',_0x72ba('0x4')),'defaultValue':_0x72ba('0x5')},'content':{'type':Sequelize[_0x72ba('0x6')]},'key':{'type':Sequelize[_0x72ba('0x6')]},'keyType':{'type':Sequelize[_0x72ba('0x7')](_0x72ba('0x5'),_0x72ba('0x2'),_0x72ba('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x72ba('0x6')]},'nameField':{'type':Sequelize[_0x72ba('0x6')]},'customField':{'type':Sequelize[_0x72ba('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x72ba('0x6')]}}; \ No newline at end of file +var _0x3502=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x15de11,_0x3cd20d){var _0x4f1c07=function(_0xf74624){while(--_0xf74624){_0x15de11['push'](_0x15de11['shift']());}};_0x4f1c07(++_0x3cd20d);}(_0x3502,0xd0));var _0x2350=function(_0x5f2f1f,_0x34fac2){_0x5f2f1f=_0x5f2f1f-0x0;var _0x26c1db=_0x3502[_0x5f2f1f];return _0x26c1db;};'use strict';var Sequelize=require(_0x2350('0x0'));module[_0x2350('0x1')]={'type':{'type':Sequelize[_0x2350('0x2')](_0x2350('0x3'),_0x2350('0x4'),_0x2350('0x5'),_0x2350('0x6'),'picklist'),'defaultValue':_0x2350('0x3')},'content':{'type':Sequelize[_0x2350('0x7')]},'key':{'type':Sequelize[_0x2350('0x7')]},'keyType':{'type':Sequelize[_0x2350('0x2')](_0x2350('0x3'),_0x2350('0x4'),_0x2350('0x5'))},'keyContent':{'type':Sequelize[_0x2350('0x7')]},'idField':{'type':Sequelize[_0x2350('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2350('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2350('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 768d95c..6214b9a 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 _0xbef1=['Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset'];(function(_0x772b80,_0x39b2be){var _0x30b292=function(_0x599382){while(--_0x599382){_0x772b80['push'](_0x772b80['shift']());}};_0x30b292(++_0x39b2be);}(_0xbef1,0x78));var _0x1bef=function(_0x416985,_0xc58f20){_0x416985=_0x416985-0x0;var _0x17649b=_0xbef1[_0x416985];return _0x17649b;};'use strict';var emlformat=require(_0x1bef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bef('0x1'));var jsonpatch=require(_0x1bef('0x2'));var rp=require(_0x1bef('0x3'));var moment=require(_0x1bef('0x4'));var BPromise=require(_0x1bef('0x5'));var Mustache=require(_0x1bef('0x6'));var util=require(_0x1bef('0x7'));var path=require(_0x1bef('0x8'));var sox=require(_0x1bef('0x9'));var csv=require(_0x1bef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1bef('0xb'));var squel=require('squel');var crypto=require(_0x1bef('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1bef('0xd'));var toCsv=require(_0x1bef('0xa'));var querystring=require(_0x1bef('0xe'));var Papa=require(_0x1bef('0xf'));var Redis=require(_0x1bef('0x10'));var authService=require(_0x1bef('0x11'));var qs=require(_0x1bef('0x12'));var as=require(_0x1bef('0x13'));var hardwareService=require(_0x1bef('0x14'));var logger=require('../../config/logger')(_0x1bef('0x15'));var utils=require(_0x1bef('0x16'));var config=require(_0x1bef('0x17'));var licenseUtil=require(_0x1bef('0x18'));var db=require(_0x1bef('0x19'))['db'];function respondWithStatusCode(_0x513f8b,_0x5758fa){_0x5758fa=_0x5758fa||0xcc;return function(_0x5d3755){if(_0x5d3755){return _0x513f8b[_0x1bef('0x1a')](_0x5758fa);}return _0x513f8b['status'](_0x5758fa)[_0x1bef('0x1b')]();};}function respondWithResult(_0x159d30,_0x50c0d2){_0x50c0d2=_0x50c0d2||0xc8;return function(_0x457ded){if(_0x457ded){return _0x159d30[_0x1bef('0x1c')](_0x50c0d2)[_0x1bef('0x1d')](_0x457ded);}};}function respondWithFilteredResult(_0x1a5cfc,_0x15de9e){return function(_0xdb976){if(_0xdb976){var _0x58099f=typeof _0x15de9e['offset']==='undefined'&&typeof _0x15de9e[_0x1bef('0x1e')]===_0x1bef('0x1f');var _0x3e031e=_0xdb976[_0x1bef('0x20')];var _0x185585=_0x58099f?0x0:_0x15de9e[_0x1bef('0x21')];var _0x3fde6c=_0x58099f?_0xdb976['count']:_0x15de9e[_0x1bef('0x21')]+_0x15de9e[_0x1bef('0x1e')];var _0x5c5a90;if(_0x3fde6c>=_0x3e031e){_0x3fde6c=_0x3e031e;_0x5c5a90=0xc8;}else{_0x5c5a90=0xce;}_0x1a5cfc['status'](_0x5c5a90);return _0x1a5cfc['set'](_0x1bef('0x22'),_0x185585+'-'+_0x3fde6c+'/'+_0x3e031e)[_0x1bef('0x1d')](_0xdb976);}return null;};}function patchUpdates(_0x32da77){return function(_0x493a19){try{jsonpatch['apply'](_0x493a19,_0x32da77,!![]);}catch(_0x145bac){return BPromise[_0x1bef('0x23')](_0x145bac);}return _0x493a19[_0x1bef('0x24')]();};}function saveUpdates(_0x52e935,_0x2ca50b){return function(_0x5960fb){if(_0x5960fb){return _0x5960fb[_0x1bef('0x25')](_0x52e935)[_0x1bef('0x26')](function(_0x10fa2c){return _0x10fa2c;});}return null;};}function removeEntity(_0x1c0bef,_0x14d6a6){return function(_0x34cd26){if(_0x34cd26){return _0x34cd26[_0x1bef('0x27')]()[_0x1bef('0x26')](function(){_0x1c0bef['status'](0xcc)[_0x1bef('0x1b')]();});}};}function handleEntityNotFound(_0x45815e,_0x15745b){return function(_0x30a342){if(!_0x30a342){_0x45815e[_0x1bef('0x1a')](0x194);}return _0x30a342;};}function handleError(_0x30bc60,_0x1eb61d){_0x1eb61d=_0x1eb61d||0x1f4;return function(_0x160294){logger[_0x1bef('0x28')](_0x160294[_0x1bef('0x29')]);if(_0x160294[_0x1bef('0x2a')]){delete _0x160294['name'];}_0x30bc60['status'](_0x1eb61d)[_0x1bef('0x2b')](_0x160294);};}exports['index']=function(_0x47d995,_0x6bebd9){var _0x4d7212={},_0xff99ac={},_0x5beb38={'count':0x0,'rows':[]};var _0x358db4=_[_0x1bef('0x2c')](db[_0x1bef('0x2d')][_0x1bef('0x2e')],function(_0x217645){return{'name':_0x217645[_0x1bef('0x2f')],'type':_0x217645[_0x1bef('0x30')][_0x1bef('0x31')]};});_0xff99ac[_0x1bef('0x32')]=_[_0x1bef('0x2c')](_0x358db4,_0x1bef('0x2a'));_0xff99ac[_0x1bef('0x33')]=_[_0x1bef('0x34')](_0x47d995[_0x1bef('0x33')]);_0xff99ac['filters']=_[_0x1bef('0x35')](_0xff99ac[_0x1bef('0x32')],_0xff99ac['query']);_0x4d7212[_0x1bef('0x36')]=_['intersection'](_0xff99ac[_0x1bef('0x32')],qs[_0x1bef('0x37')](_0x47d995['query'][_0x1bef('0x37')]));_0x4d7212[_0x1bef('0x36')]=_0x4d7212[_0x1bef('0x36')][_0x1bef('0x38')]?_0x4d7212[_0x1bef('0x36')]:_0xff99ac[_0x1bef('0x32')];if(!_0x47d995['query'][_0x1bef('0x39')](_0x1bef('0x3a'))){_0x4d7212[_0x1bef('0x1e')]=qs[_0x1bef('0x1e')](_0x47d995[_0x1bef('0x33')][_0x1bef('0x1e')]);_0x4d7212[_0x1bef('0x21')]=qs['offset'](_0x47d995[_0x1bef('0x33')][_0x1bef('0x21')]);}_0x4d7212[_0x1bef('0x3b')]=qs[_0x1bef('0x3c')](_0x47d995[_0x1bef('0x33')][_0x1bef('0x3c')]);_0x4d7212[_0x1bef('0x3d')]=qs[_0x1bef('0x3e')](_[_0x1bef('0x3f')](_0x47d995['query'],_0xff99ac[_0x1bef('0x3e')]),_0x358db4);if(_0x47d995[_0x1bef('0x33')]['filter']){_0x4d7212[_0x1bef('0x3d')]=_[_0x1bef('0x40')](_0x4d7212[_0x1bef('0x3d')],{'$or':_[_0x1bef('0x2c')](_0x358db4,function(_0x527164){if(_0x527164[_0x1bef('0x30')]!==_0x1bef('0x41')){var _0x3c2eb5={};_0x3c2eb5[_0x527164[_0x1bef('0x2a')]]={'$like':'%'+_0x47d995[_0x1bef('0x33')][_0x1bef('0x42')]+'%'};return _0x3c2eb5;}})});}_0x4d7212=_['merge']({},_0x4d7212,_0x47d995[_0x1bef('0x43')]);var _0x4a51d6={'where':_0x4d7212[_0x1bef('0x3d')]};return db[_0x1bef('0x2d')][_0x1bef('0x20')](_0x4a51d6)[_0x1bef('0x26')](function(_0x4b4ba7){_0x5beb38['count']=_0x4b4ba7;if(_0x47d995['query'][_0x1bef('0x44')]){_0x4d7212[_0x1bef('0x45')]=[{'all':!![]}];}return db['ZohoField'][_0x1bef('0x46')](_0x4d7212);})['then'](function(_0x4619fa){_0x5beb38[_0x1bef('0x47')]=_0x4619fa;return _0x5beb38;})[_0x1bef('0x26')](respondWithFilteredResult(_0x6bebd9,_0x4d7212))[_0x1bef('0x48')](handleError(_0x6bebd9,null));};exports['show']=function(_0x46efe4,_0x3b50bd){var _0x666a61={'raw':!![],'where':{'id':_0x46efe4[_0x1bef('0x49')]['id']}},_0x4c240d={};_0x4c240d[_0x1bef('0x32')]=_[_0x1bef('0x34')](db[_0x1bef('0x2d')]['rawAttributes']);_0x4c240d[_0x1bef('0x33')]=_[_0x1bef('0x34')](_0x46efe4[_0x1bef('0x33')]);_0x4c240d[_0x1bef('0x3e')]=_['intersection'](_0x4c240d[_0x1bef('0x32')],_0x4c240d[_0x1bef('0x33')]);_0x666a61[_0x1bef('0x36')]=_['intersection'](_0x4c240d[_0x1bef('0x32')],qs[_0x1bef('0x37')](_0x46efe4[_0x1bef('0x33')][_0x1bef('0x37')]));_0x666a61[_0x1bef('0x36')]=_0x666a61[_0x1bef('0x36')]['length']?_0x666a61['attributes']:_0x4c240d['model'];if(_0x46efe4['query'][_0x1bef('0x44')]){_0x666a61['include']=[{'all':!![]}];}_0x666a61=_[_0x1bef('0x40')]({},_0x666a61,_0x46efe4['options']);return db[_0x1bef('0x2d')]['find'](_0x666a61)['then'](handleEntityNotFound(_0x3b50bd,null))[_0x1bef('0x26')](respondWithResult(_0x3b50bd,null))['catch'](handleError(_0x3b50bd,null));};exports[_0x1bef('0x4a')]=function(_0x28b8ea,_0x2c2a5){return db[_0x1bef('0x2d')][_0x1bef('0x4a')](_0x28b8ea[_0x1bef('0x4b')],{})['then'](respondWithResult(_0x2c2a5,0xc9))['catch'](handleError(_0x2c2a5,null));};exports[_0x1bef('0x25')]=function(_0x1780c0,_0xf7abc4){if(_0x1780c0[_0x1bef('0x4b')]['id']){delete _0x1780c0['body']['id'];}return db[_0x1bef('0x2d')][_0x1bef('0x4c')]({'where':{'id':_0x1780c0[_0x1bef('0x49')]['id']}})[_0x1bef('0x26')](handleEntityNotFound(_0xf7abc4,null))[_0x1bef('0x26')](saveUpdates(_0x1780c0[_0x1bef('0x4b')],null))[_0x1bef('0x26')](respondWithResult(_0xf7abc4,null))[_0x1bef('0x48')](handleError(_0xf7abc4,null));};exports[_0x1bef('0x27')]=function(_0x1d39dd,_0x5d2be7){return db[_0x1bef('0x2d')][_0x1bef('0x4c')]({'where':{'id':_0x1d39dd[_0x1bef('0x49')]['id']}})[_0x1bef('0x26')](handleEntityNotFound(_0x5d2be7,null))[_0x1bef('0x26')](removeEntity(_0x5d2be7,null))[_0x1bef('0x48')](handleError(_0x5d2be7,null));}; \ No newline at end of file +var _0xf750=['status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','include','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x563243,_0x2cb541){var _0x203554=function(_0xeda4ba){while(--_0xeda4ba){_0x563243['push'](_0x563243['shift']());}};_0x203554(++_0x2cb541);}(_0xf750,0x117));var _0x0f75=function(_0x5a5dce,_0x1d8cdf){_0x5a5dce=_0x5a5dce-0x0;var _0xb98def=_0xf750[_0x5a5dce];return _0xb98def;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f75('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f75('0x1'));var rp=require(_0x0f75('0x2'));var moment=require(_0x0f75('0x3'));var BPromise=require(_0x0f75('0x4'));var Mustache=require('mustache');var util=require(_0x0f75('0x5'));var path=require(_0x0f75('0x6'));var sox=require('sox');var csv=require(_0x0f75('0x7'));var ejs=require(_0x0f75('0x8'));var fs=require('fs');var fs_extra=require(_0x0f75('0x9'));var _=require('lodash');var squel=require(_0x0f75('0xa'));var crypto=require(_0x0f75('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0f75('0xc'));var toCsv=require(_0x0f75('0x7'));var querystring=require(_0x0f75('0xd'));var Papa=require(_0x0f75('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0f75('0xf'));var as=require(_0x0f75('0x10'));var hardwareService=require(_0x0f75('0x11'));var logger=require(_0x0f75('0x12'))(_0x0f75('0x13'));var utils=require(_0x0f75('0x14'));var config=require(_0x0f75('0x15'));var licenseUtil=require(_0x0f75('0x16'));var db=require(_0x0f75('0x17'))['db'];function respondWithStatusCode(_0x4cea22,_0x45796d){_0x45796d=_0x45796d||0xcc;return function(_0x33ba92){if(_0x33ba92){return _0x4cea22[_0x0f75('0x18')](_0x45796d);}return _0x4cea22[_0x0f75('0x19')](_0x45796d)[_0x0f75('0x1a')]();};}function respondWithResult(_0x14563f,_0xde9b24){_0xde9b24=_0xde9b24||0xc8;return function(_0x136454){if(_0x136454){return _0x14563f[_0x0f75('0x19')](_0xde9b24)[_0x0f75('0x1b')](_0x136454);}};}function respondWithFilteredResult(_0x15be55,_0x310bed){return function(_0x31eb60){if(_0x31eb60){var _0x13c523=typeof _0x310bed[_0x0f75('0x1c')]===_0x0f75('0x1d')&&typeof _0x310bed['limit']===_0x0f75('0x1d');var _0x21e104=_0x31eb60['count'];var _0x279764=_0x13c523?0x0:_0x310bed['offset'];var _0x46875a=_0x13c523?_0x31eb60[_0x0f75('0x1e')]:_0x310bed['offset']+_0x310bed['limit'];var _0x51e4ee;if(_0x46875a>=_0x21e104){_0x46875a=_0x21e104;_0x51e4ee=0xc8;}else{_0x51e4ee=0xce;}_0x15be55[_0x0f75('0x19')](_0x51e4ee);return _0x15be55[_0x0f75('0x1f')](_0x0f75('0x20'),_0x279764+'-'+_0x46875a+'/'+_0x21e104)[_0x0f75('0x1b')](_0x31eb60);}return null;};}function patchUpdates(_0x4faeda){return function(_0x2712e5){try{jsonpatch[_0x0f75('0x21')](_0x2712e5,_0x4faeda,!![]);}catch(_0x2194b2){return BPromise[_0x0f75('0x22')](_0x2194b2);}return _0x2712e5[_0x0f75('0x23')]();};}function saveUpdates(_0xab4fa1,_0x44a148){return function(_0x45ff66){if(_0x45ff66){return _0x45ff66[_0x0f75('0x24')](_0xab4fa1)[_0x0f75('0x25')](function(_0x1a6ab4){return _0x1a6ab4;});}return null;};}function removeEntity(_0x124d34,_0x38ef3c){return function(_0x308975){if(_0x308975){return _0x308975[_0x0f75('0x26')]()[_0x0f75('0x25')](function(){_0x124d34[_0x0f75('0x19')](0xcc)[_0x0f75('0x1a')]();});}};}function handleEntityNotFound(_0x1646cc,_0x24510e){return function(_0x2e0a13){if(!_0x2e0a13){_0x1646cc['sendStatus'](0x194);}return _0x2e0a13;};}function handleError(_0x3d6c97,_0x3e72ff){_0x3e72ff=_0x3e72ff||0x1f4;return function(_0x518318){logger[_0x0f75('0x27')](_0x518318[_0x0f75('0x28')]);if(_0x518318[_0x0f75('0x29')]){delete _0x518318['name'];}_0x3d6c97[_0x0f75('0x19')](_0x3e72ff)['send'](_0x518318);};}exports[_0x0f75('0x2a')]=function(_0x1308fe,_0x512ee2){var _0x1cf250={},_0x3813f0={},_0x4964be={'count':0x0,'rows':[]};var _0x271daf=_[_0x0f75('0x2b')](db[_0x0f75('0x2c')][_0x0f75('0x2d')],function(_0x87cd69){return{'name':_0x87cd69[_0x0f75('0x2e')],'type':_0x87cd69[_0x0f75('0x2f')][_0x0f75('0x30')]};});_0x3813f0[_0x0f75('0x31')]=_[_0x0f75('0x2b')](_0x271daf,_0x0f75('0x29'));_0x3813f0[_0x0f75('0x32')]=_[_0x0f75('0x33')](_0x1308fe[_0x0f75('0x32')]);_0x3813f0['filters']=_[_0x0f75('0x34')](_0x3813f0[_0x0f75('0x31')],_0x3813f0[_0x0f75('0x32')]);_0x1cf250[_0x0f75('0x35')]=_['intersection'](_0x3813f0[_0x0f75('0x31')],qs['fields'](_0x1308fe['query'][_0x0f75('0x36')]));_0x1cf250[_0x0f75('0x35')]=_0x1cf250[_0x0f75('0x35')]['length']?_0x1cf250[_0x0f75('0x35')]:_0x3813f0[_0x0f75('0x31')];if(!_0x1308fe['query'][_0x0f75('0x37')](_0x0f75('0x38'))){_0x1cf250[_0x0f75('0x39')]=qs[_0x0f75('0x39')](_0x1308fe['query'][_0x0f75('0x39')]);_0x1cf250['offset']=qs[_0x0f75('0x1c')](_0x1308fe['query']['offset']);}_0x1cf250[_0x0f75('0x3a')]=qs[_0x0f75('0x3b')](_0x1308fe['query'][_0x0f75('0x3b')]);_0x1cf250[_0x0f75('0x3c')]=qs[_0x0f75('0x3d')](_[_0x0f75('0x3e')](_0x1308fe['query'],_0x3813f0[_0x0f75('0x3d')]),_0x271daf);if(_0x1308fe['query'][_0x0f75('0x3f')]){_0x1cf250[_0x0f75('0x3c')]=_[_0x0f75('0x40')](_0x1cf250[_0x0f75('0x3c')],{'$or':_[_0x0f75('0x2b')](_0x271daf,function(_0x5846c6){if(_0x5846c6[_0x0f75('0x2f')]!==_0x0f75('0x41')){var _0x2f5bcd={};_0x2f5bcd[_0x5846c6[_0x0f75('0x29')]]={'$like':'%'+_0x1308fe[_0x0f75('0x32')][_0x0f75('0x3f')]+'%'};return _0x2f5bcd;}})});}_0x1cf250=_[_0x0f75('0x40')]({},_0x1cf250,_0x1308fe[_0x0f75('0x42')]);var _0x14dbe9={'where':_0x1cf250['where']};return db[_0x0f75('0x2c')][_0x0f75('0x1e')](_0x14dbe9)['then'](function(_0x4ff32b){_0x4964be[_0x0f75('0x1e')]=_0x4ff32b;if(_0x1308fe[_0x0f75('0x32')]['includeAll']){_0x1cf250['include']=[{'all':!![]}];}return db['ZohoField'][_0x0f75('0x43')](_0x1cf250);})[_0x0f75('0x25')](function(_0xb9c75){_0x4964be[_0x0f75('0x44')]=_0xb9c75;return _0x4964be;})['then'](respondWithFilteredResult(_0x512ee2,_0x1cf250))[_0x0f75('0x45')](handleError(_0x512ee2,null));};exports[_0x0f75('0x46')]=function(_0x5216d3,_0x1fc956){var _0x473444={'raw':!![],'where':{'id':_0x5216d3[_0x0f75('0x47')]['id']}},_0x1d6034={};_0x1d6034[_0x0f75('0x31')]=_['keys'](db['ZohoField']['rawAttributes']);_0x1d6034[_0x0f75('0x32')]=_['keys'](_0x5216d3[_0x0f75('0x32')]);_0x1d6034[_0x0f75('0x3d')]=_[_0x0f75('0x34')](_0x1d6034[_0x0f75('0x31')],_0x1d6034['query']);_0x473444[_0x0f75('0x35')]=_['intersection'](_0x1d6034[_0x0f75('0x31')],qs['fields'](_0x5216d3[_0x0f75('0x32')][_0x0f75('0x36')]));_0x473444[_0x0f75('0x35')]=_0x473444[_0x0f75('0x35')]['length']?_0x473444[_0x0f75('0x35')]:_0x1d6034[_0x0f75('0x31')];if(_0x5216d3['query']['includeAll']){_0x473444[_0x0f75('0x48')]=[{'all':!![]}];}_0x473444=_[_0x0f75('0x40')]({},_0x473444,_0x5216d3[_0x0f75('0x42')]);return db[_0x0f75('0x2c')][_0x0f75('0x49')](_0x473444)[_0x0f75('0x25')](handleEntityNotFound(_0x1fc956,null))[_0x0f75('0x25')](respondWithResult(_0x1fc956,null))[_0x0f75('0x45')](handleError(_0x1fc956,null));};exports[_0x0f75('0x4a')]=function(_0x5346a6,_0x2e25ca){return db[_0x0f75('0x2c')][_0x0f75('0x4a')](_0x5346a6[_0x0f75('0x4b')],{})['then'](respondWithResult(_0x2e25ca,0xc9))['catch'](handleError(_0x2e25ca,null));};exports[_0x0f75('0x24')]=function(_0x52f882,_0x1d8802){if(_0x52f882[_0x0f75('0x4b')]['id']){delete _0x52f882[_0x0f75('0x4b')]['id'];}return db[_0x0f75('0x2c')][_0x0f75('0x49')]({'where':{'id':_0x52f882[_0x0f75('0x47')]['id']}})[_0x0f75('0x25')](handleEntityNotFound(_0x1d8802,null))['then'](saveUpdates(_0x52f882[_0x0f75('0x4b')],null))[_0x0f75('0x25')](respondWithResult(_0x1d8802,null))[_0x0f75('0x45')](handleError(_0x1d8802,null));};exports[_0x0f75('0x26')]=function(_0x5059ae,_0xe9cce3){return db[_0x0f75('0x2c')][_0x0f75('0x49')]({'where':{'id':_0x5059ae['params']['id']}})[_0x0f75('0x25')](handleEntityNotFound(_0xe9cce3,null))['then'](removeEntity(_0xe9cce3,null))[_0x0f75('0x45')](handleError(_0xe9cce3,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 4fcbee1..c753418 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 _0xadb5=['ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xadb5,0xad));var _0x5adb=function(_0x22ac79,_0x51b544){_0x22ac79=_0x22ac79-0x0;var _0x3dcabc=_0xadb5[_0x22ac79];return _0x3dcabc;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./intZohoField.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[{'name':_0x5adb('0xb'),'fields':[_0x5adb('0xc'),_0x5adb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a85=['rimraf','../../config/environment','exports','ZohoField','int_zoho_fields','idField','../../config/logger','api','moment','path'];(function(_0x2186b6,_0x197d9f){var _0x1c5e7e=function(_0x379d1b){while(--_0x379d1b){_0x2186b6['push'](_0x2186b6['shift']());}};_0x1c5e7e(++_0x197d9f);}(_0x1a85,0x178));var _0x51a8=function(_0x3edf96,_0x11e492){_0x3edf96=_0x3edf96-0x0;var _0x128e0e=_0x1a85[_0x3edf96];return _0x128e0e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./intZohoField.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x51a8('0x9'),'FieldId'],'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 5e7995b..1ac1dfe 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 _0xb4ef=['client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x48fe9a,_0xc4cbb4){var _0x163e35=function(_0x1f67d1){while(--_0x1f67d1){_0x48fe9a['push'](_0x48fe9a['shift']());}};_0x163e35(++_0xc4cbb4);}(_0xb4ef,0x1ef));var _0xfb4e=function(_0x182a14,_0x41511f){_0x182a14=_0x182a14-0x0;var _0x4a1cc7=_0xb4ef[_0x182a14];return _0x4a1cc7;};'use strict';var _=require(_0xfb4e('0x0'));var util=require(_0xfb4e('0x1'));var moment=require(_0xfb4e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb4e('0x3'));var db=require(_0xfb4e('0x4'))['db'];var utils=require(_0xfb4e('0x5'));var logger=require(_0xfb4e('0x6'))(_0xfb4e('0x7'));var config=require('../../config/environment');var jayson=require(_0xfb4e('0x8'));var client=jayson[_0xfb4e('0x9')][_0xfb4e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x788595,_0x2a1556,_0x5cec1f){return new BPromise(function(_0x234302,_0x3e8175){return client[_0xfb4e('0xb')](_0x788595,_0x5cec1f)[_0xfb4e('0xc')](function(_0x1687f2){logger['info'](_0xfb4e('0xd'),_0x2a1556,_0xfb4e('0xe'));logger[_0xfb4e('0xf')](_0xfb4e('0x10'),_0x2a1556,_0xfb4e('0xe'),JSON['stringify'](_0x1687f2));if(_0x1687f2[_0xfb4e('0x11')]){if(_0x1687f2[_0xfb4e('0x11')][_0xfb4e('0x12')]===0x1f4){logger[_0xfb4e('0x11')](_0xfb4e('0xd'),_0x2a1556,_0x1687f2[_0xfb4e('0x11')]['message']);return _0x3e8175(_0x1687f2['error'][_0xfb4e('0x13')]);}logger[_0xfb4e('0x11')]('ZohoField,\x20%s,\x20%s',_0x2a1556,_0x1687f2[_0xfb4e('0x11')][_0xfb4e('0x13')]);return _0x234302(_0x1687f2[_0xfb4e('0x11')][_0xfb4e('0x13')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x2a1556,_0xfb4e('0xe'));_0x234302(_0x1687f2['result'][_0xfb4e('0x13')]);}})[_0xfb4e('0x14')](function(_0x52614d){logger['error'](_0xfb4e('0xd'),_0x2a1556,_0x52614d);_0x3e8175(_0x52614d);});});} \ No newline at end of file +var _0x049f=['jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1fdd7a,_0x3f4086){var _0xac852=function(_0x5ec1a3){while(--_0x5ec1a3){_0x1fdd7a['push'](_0x1fdd7a['shift']());}};_0xac852(++_0x3f4086);}(_0x049f,0x1da));var _0xf049=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x049f[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xf049('0x0'));var util=require(_0xf049('0x1'));var moment=require(_0xf049('0x2'));var BPromise=require(_0xf049('0x3'));var rs=require(_0xf049('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf049('0x5'))['db'];var utils=require(_0xf049('0x6'));var logger=require(_0xf049('0x7'))('rpc');var config=require(_0xf049('0x8'));var jayson=require(_0xf049('0x9'));var client=jayson[_0xf049('0xa')][_0xf049('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x253f85,_0x25a4b8,_0x2900fa){return new BPromise(function(_0x1bf8c7,_0x27de05){return client[_0xf049('0xc')](_0x253f85,_0x2900fa)['then'](function(_0x47aec2){logger[_0xf049('0xd')](_0xf049('0xe'),_0x25a4b8,_0xf049('0xf'));logger[_0xf049('0x10')](_0xf049('0x11'),_0x25a4b8,_0xf049('0xf'),JSON['stringify'](_0x47aec2));if(_0x47aec2[_0xf049('0x12')]){if(_0x47aec2['error']['code']===0x1f4){logger[_0xf049('0x12')](_0xf049('0xe'),_0x25a4b8,_0x47aec2[_0xf049('0x12')]['message']);return _0x27de05(_0x47aec2[_0xf049('0x12')][_0xf049('0x13')]);}logger[_0xf049('0x12')](_0xf049('0xe'),_0x25a4b8,_0x47aec2[_0xf049('0x12')][_0xf049('0x13')]);return _0x1bf8c7(_0x47aec2['error']['message']);}else{logger[_0xf049('0xd')](_0xf049('0xe'),_0x25a4b8,_0xf049('0xf'));_0x1bf8c7(_0x47aec2[_0xf049('0x14')][_0xf049('0x13')]);}})['catch'](function(_0x285e3e){logger[_0xf049('0x12')]('ZohoField,\x20%s,\x20%s',_0x25a4b8,_0x285e3e);_0x27de05(_0x285e3e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index fddd5cc..8977528 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x368bfc,_0x21f10f){var _0x1b8ed2=function(_0x452bca){while(--_0x452bca){_0x368bfc['push'](_0x368bfc['shift']());}};_0x1b8ed2(++_0x21f10f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xcb91[_0x1064bc];return _0x5edc45;};'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(_0x4b4215,_0xe43457){var _0x12ca29=function(_0x410140){while(--_0x410140){_0x4b4215['push'](_0x4b4215['shift']());}};_0x12ca29(++_0xe43457);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa28b1a,_0x384f4b){_0xa28b1a=_0xa28b1a-0x0;var _0x4c9b78=_0xcb91[_0xa28b1a];return _0x4c9b78;};'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 0d71651..1b7edff 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 _0xae88=['BOOLEAN','sequelize','exports','STRING','unique_name_and_version'];(function(_0x13f5ef,_0x4052ed){var _0x28f324=function(_0x26772b){while(--_0x26772b){_0x13f5ef['push'](_0x13f5ef['shift']());}};_0x28f324(++_0x4052ed);}(_0xae88,0xa1));var _0x8ae8=function(_0x3d504d,_0x221070){_0x3d504d=_0x3d504d-0x0;var _0x485412=_0xae88[_0x3d504d];return _0x485412;};'use strict';var Sequelize=require(_0x8ae8('0x0'));module[_0x8ae8('0x1')]={'name':{'type':Sequelize[_0x8ae8('0x2')],'allowNull':![],'unique':_0x8ae8('0x3')},'version':{'type':Sequelize[_0x8ae8('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x8ae8('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x8ae8('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8ae8('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x8ae8('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x8ae8('0x2')]},'state':{'type':Sequelize[_0x8ae8('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x8ae8('0x2')]},'title':{'type':Sequelize[_0x8ae8('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x8ae8('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xcd54=['sequelize','exports','STRING','BOOLEAN','state'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0xcd54,0xaf));var _0x4cd5=function(_0x38b032,_0x505783){_0x38b032=_0x38b032-0x0;var _0x12fe0a=_0xcd54[_0x38b032];return _0x12fe0a;};'use strict';var Sequelize=require(_0x4cd5('0x0'));module[_0x4cd5('0x1')]={'name':{'type':Sequelize[_0x4cd5('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x4cd5('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x4cd5('0x2')]},'path':{'type':Sequelize[_0x4cd5('0x2')]},'type':{'type':Sequelize[_0x4cd5('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x4cd5('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x4cd5('0x2')]},'logo':{'type':Sequelize[_0x4cd5('0x2')]},'state':{'type':Sequelize[_0x4cd5('0x2')],'unique':_0x4cd5('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x4cd5('0x2')]},'remoteUri':{'type':Sequelize[_0x4cd5('0x2')]},'link':{'type':Sequelize[_0x4cd5('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 7c00055..253a9a4 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 _0xfcf0=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','keys','query','filters'];(function(_0x2f39dd,_0xc5d588){var _0xfc85d2=function(_0x310f02){while(--_0x310f02){_0x2f39dd['push'](_0x2f39dd['shift']());}};_0xfc85d2(++_0xc5d588);}(_0xfcf0,0x138));var _0x0fcf=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0xfcf0[_0x124f88];return _0xed0e3b;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));}; \ No newline at end of file +var _0x6343=['hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','Integration','then','rows','catch','show','params','keys','includeAll','include','create','body','find','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length'];(function(_0x3f876e,_0x14e0a9){var _0x498574=function(_0x32c2f6){while(--_0x32c2f6){_0x3f876e['push'](_0x3f876e['shift']());}};_0x498574(++_0x14e0a9);}(_0x6343,0x168));var _0x3634=function(_0x5f2f1f,_0xe84199){_0x5f2f1f=_0x5f2f1f-0x0;var _0x4d4eba=_0x6343[_0x5f2f1f];return _0x4d4eba;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['Integration'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 41176a3..0a5fbf8 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 _0xf491=['bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','api','moment'];(function(_0xcd698c,_0x25ea0d){var _0x4e155e=function(_0x3bb9b5){while(--_0x3bb9b5){_0xcd698c['push'](_0xcd698c['shift']());}};_0x4e155e(++_0x25ea0d);}(_0xf491,0x18f));var _0x1f49=function(_0x37c8ea,_0x4836d2){_0x37c8ea=_0x37c8ea-0x0;var _0x541409=_0xf491[_0x37c8ea];return _0x541409;};'use strict';var _=require(_0x1f49('0x0'));var util=require(_0x1f49('0x1'));var logger=require('../../config/logger')(_0x1f49('0x2'));var moment=require(_0x1f49('0x3'));var BPromise=require(_0x1f49('0x4'));var rp=require(_0x1f49('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f49('0x6'));var config=require(_0x1f49('0x7'));var attributes=require(_0x1f49('0x8'));module[_0x1f49('0x9')]=function(_0x26cd2a,_0x19bcee){return _0x26cd2a[_0x1f49('0xa')](_0x1f49('0xb'),attributes,{'tableName':_0x1f49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd202=['integrations','lodash','util','api','moment','request-promise','path','../../config/environment','./integration.attributes','exports','define'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd202,0x6f));var _0x2d20=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd202[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x2d20('0x0'));var util=require(_0x2d20('0x1'));var logger=require('../../config/logger')(_0x2d20('0x2'));var moment=require(_0x2d20('0x3'));var BPromise=require('bluebird');var rp=require(_0x2d20('0x4'));var fs=require('fs');var path=require(_0x2d20('0x5'));var rimraf=require('rimraf');var config=require(_0x2d20('0x6'));var attributes=require(_0x2d20('0x7'));module[_0x2d20('0x8')]=function(_0x26e863,_0x1783f4){return _0x26e863[_0x2d20('0x9')]('Integration',attributes,{'tableName':_0x2d20('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 0116b2e..2fab90b 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(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x4975,0x86));var _0x5497=function(_0x371647,_0x220454){_0x371647=_0x371647-0x0;var _0x2f4fa3=_0x4975[_0x371647];return _0x2f4fa3;};'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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index f5aad69..01c3b26 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 _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','destroy','exports','util'];(function(_0x5177a0,_0x2a6452){var _0x2f9853=function(_0x4008fa){while(--_0x4008fa){_0x5177a0['push'](_0x5177a0['shift']());}};_0x2f9853(++_0x2a6452);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xb'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file +var _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x305d3b,_0xa3cab3){var _0x3b1bfc=function(_0x303fc2){while(--_0x303fc2){_0x305d3b['push'](_0x305d3b['shift']());}};_0x3b1bfc(++_0xa3cab3);}(_0x955f,0x1eb));var _0xf955=function(_0x8ea83e,_0x2a044a){_0x8ea83e=_0x8ea83e-0x0;var _0x29c7e8=_0x955f[_0x8ea83e];return _0x29c7e8;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 7f77821..35583fa 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 _0x053d=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x2e7dc7,_0x2570f6){var _0x5bcf7c=function(_0x9a3564){while(--_0x9a3564){_0x2e7dc7['push'](_0x2e7dc7['shift']());}};_0x5bcf7c(++_0x2570f6);}(_0x053d,0x110));var _0xd053=function(_0x5eb13e,_0xfc91c1){_0x5eb13e=_0x5eb13e-0x0;var _0x2235e6=_0x053d[_0x5eb13e];return _0x2235e6;};'use strict';var Sequelize=require(_0xd053('0x0'));module[_0xd053('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xd053('0x2')]},'exitStatus':{'type':Sequelize[_0xd053('0x2')]},'ticketId':{'type':Sequelize[_0xd053('0x2')]},'integrationId':{'type':Sequelize[_0xd053('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd053('0x2')]},'calleridname':{'type':Sequelize[_0xd053('0x2')]},'queue':{'type':Sequelize[_0xd053('0x2')]},'interface':{'type':Sequelize[_0xd053('0x2')]},'membername':{'type':Sequelize[_0xd053('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd053('0x4')]},'agentconnectAt':{'type':Sequelize[_0xd053('0x4')]},'holdtime':{'type':Sequelize[_0xd053('0x3')]},'agentcomplete':{'type':Sequelize[_0xd053('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd053('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xd053('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd053('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd053('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xd053('0x4')]},'lastevent':{'type':Sequelize[_0xd053('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd053('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd053('0x2')]},'connectedlinename':{'type':Sequelize[_0xd053('0x2')]},'language':{'type':Sequelize[_0xd053('0x2')]},'accountcode':{'type':Sequelize[_0xd053('0x2')]},'context':{'type':Sequelize[_0xd053('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd053('0x2')]},'destchannel':{'type':Sequelize[_0xd053('0x2')]},'destchannelstate':{'type':Sequelize[_0xd053('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd053('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd053('0x2')]},'destcalleridname':{'type':Sequelize[_0xd053('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd053('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd053('0x2')]},'destlanguage':{'type':Sequelize[_0xd053('0x2')]},'destaccountcode':{'type':Sequelize[_0xd053('0x2')]},'destcontext':{'type':Sequelize[_0xd053('0x2')]},'destexten':{'type':Sequelize[_0xd053('0x2')]},'destpriority':{'type':Sequelize[_0xd053('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xd053('0x2')]},'inReplyTo':{'type':Sequelize[_0xd053('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xd053('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xd053('0x6')]},'html':{'type':Sequelize[_0xd053('0x6')]},'text':{'type':Sequelize[_0xd053('0x6')]},'status':{'type':Sequelize[_0xd053('0x7')]('SENT',_0xd053('0x8'),_0xd053('0x9'),_0xd053('0xa'))},'url':{'type':Sequelize[_0xd053('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xd053('0x2')]},'projectId':{'type':Sequelize[_0xd053('0x3')]}}; \ No newline at end of file +var _0xca3c=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x4376b7,_0x5e6d9d){var _0x745eb7=function(_0xd515ff){while(--_0xd515ff){_0x4376b7['push'](_0x4376b7['shift']());}};_0x745eb7(++_0x5e6d9d);}(_0xca3c,0xde));var _0xcca3=function(_0x10f165,_0x4f50a7){_0x10f165=_0x10f165-0x0;var _0xb03aba=_0xca3c[_0x10f165];return _0xb03aba;};'use strict';var Sequelize=require(_0xcca3('0x0'));module[_0xcca3('0x1')]={'integration':{'type':Sequelize[_0xcca3('0x2')]},'eventChannel':{'type':Sequelize[_0xcca3('0x2')]},'exitStatus':{'type':Sequelize[_0xcca3('0x2')]},'ticketId':{'type':Sequelize[_0xcca3('0x2')]},'integrationId':{'type':Sequelize[_0xcca3('0x3')]},'contacts':{'type':Sequelize[_0xcca3('0x2')]},'uniqueid':{'type':Sequelize[_0xcca3('0x2')]},'calleridnum':{'type':Sequelize[_0xcca3('0x2')]},'calleridname':{'type':Sequelize[_0xcca3('0x2')]},'queue':{'type':Sequelize[_0xcca3('0x2')]},'interface':{'type':Sequelize[_0xcca3('0x2')]},'membername':{'type':Sequelize[_0xcca3('0x2')]},'agentcalledAt':{'type':Sequelize[_0xcca3('0x4')]},'agentconnectAt':{'type':Sequelize[_0xcca3('0x4')]},'holdtime':{'type':Sequelize[_0xcca3('0x3')]},'agentcomplete':{'type':Sequelize[_0xcca3('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xcca3('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xcca3('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xcca3('0x3')]},'reason':{'type':Sequelize[_0xcca3('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xcca3('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xcca3('0x4')]},'agentdump':{'type':Sequelize[_0xcca3('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xcca3('0x4')]},'lastevent':{'type':Sequelize[_0xcca3('0x2')]},'channel':{'type':Sequelize[_0xcca3('0x2')]},'channelstate':{'type':Sequelize[_0xcca3('0x3')]},'channelstatedesc':{'type':Sequelize[_0xcca3('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xcca3('0x2')]},'language':{'type':Sequelize[_0xcca3('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xcca3('0x2')]},'exten':{'type':Sequelize[_0xcca3('0x2')]},'priority':{'type':Sequelize[_0xcca3('0x2')]},'destchannel':{'type':Sequelize[_0xcca3('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xcca3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xcca3('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xcca3('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xcca3('0x2')]},'destexten':{'type':Sequelize[_0xcca3('0x2')]},'destpriority':{'type':Sequelize[_0xcca3('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xcca3('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xcca3('0x2')]},'to':{'type':Sequelize[_0xcca3('0x2')]},'cc':{'type':Sequelize[_0xcca3('0x2')]},'attachment':{'type':Sequelize[_0xcca3('0x6')]},'html':{'type':Sequelize[_0xcca3('0x6')]},'text':{'type':Sequelize[_0xcca3('0x6')]},'status':{'type':Sequelize[_0xcca3('0x7')](_0xcca3('0x8'),'SENDING',_0xcca3('0x9'),_0xcca3('0xa'))},'url':{'type':Sequelize[_0xcca3('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xcca3('0x2')]},'projectId':{'type':Sequelize[_0xcca3('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 1f045a2..905fd65 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 _0x4bed=['IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','index','map'];(function(_0x595e19,_0x53b559){var _0x27ceae=function(_0x58d146){while(--_0x58d146){_0x595e19['push'](_0x595e19['shift']());}};_0x27ceae(++_0x53b559);}(_0x4bed,0x158));var _0xd4be=function(_0x1d1150,_0x341b10){_0x1d1150=_0x1d1150-0x0;var _0x59c5f8=_0x4bed[_0x1d1150];return _0x59c5f8;};'use strict';var emlformat=require(_0xd4be('0x0'));var rimraf=require(_0xd4be('0x1'));var zipdir=require(_0xd4be('0x2'));var jsonpatch=require(_0xd4be('0x3'));var rp=require(_0xd4be('0x4'));var moment=require(_0xd4be('0x5'));var BPromise=require(_0xd4be('0x6'));var Mustache=require(_0xd4be('0x7'));var util=require('util');var path=require(_0xd4be('0x8'));var sox=require(_0xd4be('0x9'));var csv=require(_0xd4be('0xa'));var ejs=require(_0xd4be('0xb'));var fs=require('fs');var fs_extra=require(_0xd4be('0xc'));var _=require(_0xd4be('0xd'));var squel=require(_0xd4be('0xe'));var crypto=require(_0xd4be('0xf'));var jsforce=require(_0xd4be('0x10'));var deskjs=require(_0xd4be('0x11'));var toCsv=require(_0xd4be('0xa'));var querystring=require(_0xd4be('0x12'));var Papa=require('papaparse');var Redis=require(_0xd4be('0x13'));var authService=require(_0xd4be('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd4be('0x15'));var hardwareService=require(_0xd4be('0x16'));var logger=require(_0xd4be('0x17'))('api');var utils=require(_0xd4be('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd4be('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x608faf,_0xf42617){_0xf42617=_0xf42617||0xcc;return function(_0x413d81){if(_0x413d81){return _0x608faf[_0xd4be('0x1a')](_0xf42617);}return _0x608faf['status'](_0xf42617)[_0xd4be('0x1b')]();};}function respondWithResult(_0x3cdbaa,_0x22a630){_0x22a630=_0x22a630||0xc8;return function(_0xf5545f){if(_0xf5545f){return _0x3cdbaa['status'](_0x22a630)[_0xd4be('0x1c')](_0xf5545f);}};}function respondWithFilteredResult(_0x291703,_0xea8572){return function(_0x2121d0){if(_0x2121d0){var _0x3cd30e=typeof _0xea8572['offset']===_0xd4be('0x1d')&&typeof _0xea8572[_0xd4be('0x1e')]===_0xd4be('0x1d');var _0x557a7c=_0x2121d0[_0xd4be('0x1f')];var _0x5f3279=_0x3cd30e?0x0:_0xea8572[_0xd4be('0x20')];var _0x50bc3d=_0x3cd30e?_0x2121d0[_0xd4be('0x1f')]:_0xea8572[_0xd4be('0x20')]+_0xea8572[_0xd4be('0x1e')];var _0x2cf7f7;if(_0x50bc3d>=_0x557a7c){_0x50bc3d=_0x557a7c;_0x2cf7f7=0xc8;}else{_0x2cf7f7=0xce;}_0x291703['status'](_0x2cf7f7);return _0x291703['set'](_0xd4be('0x21'),_0x5f3279+'-'+_0x50bc3d+'/'+_0x557a7c)[_0xd4be('0x1c')](_0x2121d0);}return null;};}function patchUpdates(_0x37dba9){return function(_0x488e24){try{jsonpatch[_0xd4be('0x22')](_0x488e24,_0x37dba9,!![]);}catch(_0x52728f){return BPromise[_0xd4be('0x23')](_0x52728f);}return _0x488e24[_0xd4be('0x24')]();};}function saveUpdates(_0x20851e,_0x2cb159){return function(_0x246a6e){if(_0x246a6e){return _0x246a6e[_0xd4be('0x25')](_0x20851e)[_0xd4be('0x26')](function(_0x46aef3){return _0x46aef3;});}return null;};}function removeEntity(_0xfaf752,_0x1c0ce4){return function(_0x4c26e1){if(_0x4c26e1){return _0x4c26e1[_0xd4be('0x27')]()[_0xd4be('0x26')](function(){_0xfaf752[_0xd4be('0x28')](0xcc)[_0xd4be('0x1b')]();});}};}function handleEntityNotFound(_0x1c52aa,_0x380792){return function(_0xcae1db){if(!_0xcae1db){_0x1c52aa[_0xd4be('0x1a')](0x194);}return _0xcae1db;};}function handleError(_0x4dcf26,_0xa953d1){_0xa953d1=_0xa953d1||0x1f4;return function(_0x2ab173){logger[_0xd4be('0x29')](_0x2ab173[_0xd4be('0x2a')]);if(_0x2ab173[_0xd4be('0x2b')]){delete _0x2ab173[_0xd4be('0x2b')];}_0x4dcf26[_0xd4be('0x28')](_0xa953d1)['send'](_0x2ab173);};}exports[_0xd4be('0x2c')]=function(_0x172687,_0x493fbf){var _0x317537={},_0x350582={},_0x4c9373={'count':0x0,'rows':[]};var _0x4a0a20=_[_0xd4be('0x2d')](db[_0xd4be('0x2e')][_0xd4be('0x2f')],function(_0x595075){return{'name':_0x595075[_0xd4be('0x30')],'type':_0x595075[_0xd4be('0x31')][_0xd4be('0x32')]};});_0x350582[_0xd4be('0x33')]=_['map'](_0x4a0a20,'name');_0x350582[_0xd4be('0x34')]=_[_0xd4be('0x35')](_0x172687['query']);_0x350582[_0xd4be('0x36')]=_[_0xd4be('0x37')](_0x350582[_0xd4be('0x33')],_0x350582['query']);_0x317537['attributes']=_[_0xd4be('0x37')](_0x350582[_0xd4be('0x33')],qs[_0xd4be('0x38')](_0x172687[_0xd4be('0x34')][_0xd4be('0x38')]));_0x317537['attributes']=_0x317537[_0xd4be('0x39')][_0xd4be('0x3a')]?_0x317537['attributes']:_0x350582[_0xd4be('0x33')];if(!_0x172687[_0xd4be('0x34')]['hasOwnProperty'](_0xd4be('0x3b'))){_0x317537[_0xd4be('0x1e')]=qs[_0xd4be('0x1e')](_0x172687[_0xd4be('0x34')]['limit']);_0x317537['offset']=qs[_0xd4be('0x20')](_0x172687[_0xd4be('0x34')][_0xd4be('0x20')]);}_0x317537[_0xd4be('0x3c')]=qs['sort'](_0x172687[_0xd4be('0x34')][_0xd4be('0x3d')]);_0x317537[_0xd4be('0x3e')]=qs['filters'](_[_0xd4be('0x3f')](_0x172687[_0xd4be('0x34')],_0x350582[_0xd4be('0x36')]),_0x4a0a20);if(_0x172687[_0xd4be('0x34')][_0xd4be('0x40')]){_0x317537[_0xd4be('0x3e')]=_[_0xd4be('0x41')](_0x317537[_0xd4be('0x3e')],{'$or':_['map'](_0x4a0a20,function(_0x38f71f){if(_0x38f71f[_0xd4be('0x31')]!==_0xd4be('0x42')){var _0xcb5b8c={};_0xcb5b8c[_0x38f71f[_0xd4be('0x2b')]]={'$like':'%'+_0x172687['query'][_0xd4be('0x40')]+'%'};return _0xcb5b8c;}})});}_0x317537=_['merge']({},_0x317537,_0x172687['options']);var _0x1f6edb={'where':_0x317537['where']};return db['IntegrationReport'][_0xd4be('0x1f')](_0x1f6edb)[_0xd4be('0x26')](function(_0x19dfaa){_0x4c9373['count']=_0x19dfaa;if(_0x172687['query'][_0xd4be('0x43')]){_0x317537[_0xd4be('0x44')]=[{'all':!![]}];}return db[_0xd4be('0x2e')][_0xd4be('0x45')](_0x317537);})[_0xd4be('0x26')](function(_0x196f2a){_0x4c9373[_0xd4be('0x46')]=_0x196f2a;return _0x4c9373;})[_0xd4be('0x26')](respondWithFilteredResult(_0x493fbf,_0x317537))[_0xd4be('0x47')](handleError(_0x493fbf,null));};exports[_0xd4be('0x48')]=function(_0x29c38e,_0x154fce){var _0x2d2e99={'raw':![],'where':{'id':_0x29c38e[_0xd4be('0x49')]['id']}},_0x4025c1={};_0x4025c1['model']=_[_0xd4be('0x35')](db[_0xd4be('0x2e')]['rawAttributes']);_0x4025c1[_0xd4be('0x34')]=_[_0xd4be('0x35')](_0x29c38e['query']);_0x4025c1[_0xd4be('0x36')]=_['intersection'](_0x4025c1[_0xd4be('0x33')],_0x4025c1[_0xd4be('0x34')]);_0x2d2e99['attributes']=_['intersection'](_0x4025c1[_0xd4be('0x33')],qs['fields'](_0x29c38e['query'][_0xd4be('0x38')]));_0x2d2e99[_0xd4be('0x39')]=_0x2d2e99['attributes'][_0xd4be('0x3a')]?_0x2d2e99[_0xd4be('0x39')]:_0x4025c1[_0xd4be('0x33')];if(_0x29c38e[_0xd4be('0x34')][_0xd4be('0x43')]){_0x2d2e99[_0xd4be('0x44')]=[{'all':!![]}];}_0x2d2e99=_[_0xd4be('0x41')]({},_0x2d2e99,_0x29c38e['options']);return db['IntegrationReport'][_0xd4be('0x4a')](_0x2d2e99)[_0xd4be('0x26')](handleEntityNotFound(_0x154fce,null))[_0xd4be('0x26')](respondWithResult(_0x154fce,null))[_0xd4be('0x47')](handleError(_0x154fce,null));};exports[_0xd4be('0x4b')]=function(_0x4549f4,_0x179ef0){return db[_0xd4be('0x2e')][_0xd4be('0x4b')](_0x4549f4[_0xd4be('0x4c')],{})[_0xd4be('0x26')](respondWithResult(_0x179ef0,0xc9))[_0xd4be('0x47')](handleError(_0x179ef0,null));};exports[_0xd4be('0x25')]=function(_0x503160,_0x30041d){if(_0x503160[_0xd4be('0x4c')]['id']){delete _0x503160[_0xd4be('0x4c')]['id'];}return db[_0xd4be('0x2e')]['find']({'where':{'id':_0x503160[_0xd4be('0x49')]['id']}})[_0xd4be('0x26')](handleEntityNotFound(_0x30041d,null))[_0xd4be('0x26')](saveUpdates(_0x503160[_0xd4be('0x4c')],null))[_0xd4be('0x26')](respondWithResult(_0x30041d,null))[_0xd4be('0x47')](handleError(_0x30041d,null));};exports[_0xd4be('0x27')]=function(_0x1d9f86,_0x3c94e3){return db[_0xd4be('0x2e')][_0xd4be('0x4a')]({'where':{'id':_0x1d9f86[_0xd4be('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c94e3,null))['then'](removeEntity(_0x3c94e3,null))[_0xd4be('0x47')](handleError(_0x3c94e3,null));};exports[_0xd4be('0x4d')]=function(_0x15c212,_0x53e443){return db['IntegrationReport'][_0xd4be('0x4d')]()[_0xd4be('0x26')](respondWithResult(_0x53e443,null))[_0xd4be('0x47')](handleError(_0x53e443,null));}; \ No newline at end of file +var _0x09a8=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','error','stack','name','index','IntegrationReport','rawAttributes','fieldName','model','map','keys','query','fields','attributes','hasOwnProperty','nolimit','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','filters','intersection','length','create','body','update','find','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis'];(function(_0x1644e5,_0x31ac5f){var _0x5bc914=function(_0x2302a1){while(--_0x2302a1){_0x1644e5['push'](_0x1644e5['shift']());}};_0x5bc914(++_0x31ac5f);}(_0x09a8,0x7e));var _0x809a=function(_0x494f74,_0x428d14){_0x494f74=_0x494f74-0x0;var _0x1f752e=_0x09a8[_0x494f74];return _0x1f752e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x809a('0x0'));var zipdir=require(_0x809a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x809a('0x2'));var moment=require(_0x809a('0x3'));var BPromise=require(_0x809a('0x4'));var Mustache=require(_0x809a('0x5'));var util=require(_0x809a('0x6'));var path=require(_0x809a('0x7'));var sox=require(_0x809a('0x8'));var csv=require('to-csv');var ejs=require(_0x809a('0x9'));var fs=require('fs');var fs_extra=require(_0x809a('0xa'));var _=require(_0x809a('0xb'));var squel=require('squel');var crypto=require(_0x809a('0xc'));var jsforce=require(_0x809a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x809a('0xe'));var querystring=require(_0x809a('0xf'));var Papa=require(_0x809a('0x10'));var Redis=require(_0x809a('0x11'));var authService=require(_0x809a('0x12'));var qs=require(_0x809a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x809a('0x14'));var logger=require('../../config/logger')(_0x809a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x809a('0x16'))['db'];function respondWithStatusCode(_0x56c451,_0x204490){_0x204490=_0x204490||0xcc;return function(_0x5c15f1){if(_0x5c15f1){return _0x56c451[_0x809a('0x17')](_0x204490);}return _0x56c451[_0x809a('0x18')](_0x204490)[_0x809a('0x19')]();};}function respondWithResult(_0x47a8c0,_0x92e6d){_0x92e6d=_0x92e6d||0xc8;return function(_0x50a556){if(_0x50a556){return _0x47a8c0['status'](_0x92e6d)['json'](_0x50a556);}};}function respondWithFilteredResult(_0x3d54b7,_0x1e5bac){return function(_0x59f29f){if(_0x59f29f){var _0x38ec78=typeof _0x1e5bac[_0x809a('0x1a')]===_0x809a('0x1b')&&typeof _0x1e5bac[_0x809a('0x1c')]==='undefined';var _0x461978=_0x59f29f['count'];var _0x18ac10=_0x38ec78?0x0:_0x1e5bac['offset'];var _0x11ee10=_0x38ec78?_0x59f29f[_0x809a('0x1d')]:_0x1e5bac['offset']+_0x1e5bac[_0x809a('0x1c')];var _0xa378df;if(_0x11ee10>=_0x461978){_0x11ee10=_0x461978;_0xa378df=0xc8;}else{_0xa378df=0xce;}_0x3d54b7['status'](_0xa378df);return _0x3d54b7[_0x809a('0x1e')](_0x809a('0x1f'),_0x18ac10+'-'+_0x11ee10+'/'+_0x461978)[_0x809a('0x20')](_0x59f29f);}return null;};}function patchUpdates(_0x2b2862){return function(_0x90f77e){try{jsonpatch['apply'](_0x90f77e,_0x2b2862,!![]);}catch(_0x20b148){return BPromise['reject'](_0x20b148);}return _0x90f77e[_0x809a('0x21')]();};}function saveUpdates(_0x57b851,_0x3f1f8b){return function(_0x35e225){if(_0x35e225){return _0x35e225['update'](_0x57b851)[_0x809a('0x22')](function(_0x3d7853){return _0x3d7853;});}return null;};}function removeEntity(_0x446c81,_0x3597ca){return function(_0x3f3557){if(_0x3f3557){return _0x3f3557[_0x809a('0x23')]()[_0x809a('0x22')](function(){_0x446c81[_0x809a('0x18')](0xcc)[_0x809a('0x19')]();});}};}function handleEntityNotFound(_0x58f9c8,_0x864b62){return function(_0x4df2be){if(!_0x4df2be){_0x58f9c8[_0x809a('0x17')](0x194);}return _0x4df2be;};}function handleError(_0x46edeb,_0x4ca0c5){_0x4ca0c5=_0x4ca0c5||0x1f4;return function(_0x1c092a){logger[_0x809a('0x24')](_0x1c092a[_0x809a('0x25')]);if(_0x1c092a[_0x809a('0x26')]){delete _0x1c092a['name'];}_0x46edeb['status'](_0x4ca0c5)['send'](_0x1c092a);};}exports[_0x809a('0x27')]=function(_0x2ee3e2,_0x4d9479){var _0x33d804={},_0x9e212c={},_0x49448c={'count':0x0,'rows':[]};var _0x2146b1=_['map'](db[_0x809a('0x28')][_0x809a('0x29')],function(_0xec440c){return{'name':_0xec440c[_0x809a('0x2a')],'type':_0xec440c['type']['key']};});_0x9e212c[_0x809a('0x2b')]=_[_0x809a('0x2c')](_0x2146b1,_0x809a('0x26'));_0x9e212c['query']=_[_0x809a('0x2d')](_0x2ee3e2[_0x809a('0x2e')]);_0x9e212c['filters']=_['intersection'](_0x9e212c['model'],_0x9e212c['query']);_0x33d804['attributes']=_['intersection'](_0x9e212c['model'],qs[_0x809a('0x2f')](_0x2ee3e2[_0x809a('0x2e')][_0x809a('0x2f')]));_0x33d804[_0x809a('0x30')]=_0x33d804[_0x809a('0x30')]['length']?_0x33d804[_0x809a('0x30')]:_0x9e212c['model'];if(!_0x2ee3e2['query'][_0x809a('0x31')](_0x809a('0x32'))){_0x33d804['limit']=qs[_0x809a('0x1c')](_0x2ee3e2[_0x809a('0x2e')][_0x809a('0x1c')]);_0x33d804['offset']=qs['offset'](_0x2ee3e2[_0x809a('0x2e')]['offset']);}_0x33d804['order']=qs['sort'](_0x2ee3e2['query']['sort']);_0x33d804[_0x809a('0x33')]=qs['filters'](_[_0x809a('0x34')](_0x2ee3e2[_0x809a('0x2e')],_0x9e212c['filters']),_0x2146b1);if(_0x2ee3e2[_0x809a('0x2e')][_0x809a('0x35')]){_0x33d804[_0x809a('0x33')]=_['merge'](_0x33d804[_0x809a('0x33')],{'$or':_[_0x809a('0x2c')](_0x2146b1,function(_0x5fd68c){if(_0x5fd68c[_0x809a('0x36')]!=='VIRTUAL'){var _0x358606={};_0x358606[_0x5fd68c[_0x809a('0x26')]]={'$like':'%'+_0x2ee3e2[_0x809a('0x2e')][_0x809a('0x35')]+'%'};return _0x358606;}})});}_0x33d804=_[_0x809a('0x37')]({},_0x33d804,_0x2ee3e2[_0x809a('0x38')]);var _0x2b0dfc={'where':_0x33d804[_0x809a('0x33')]};return db['IntegrationReport'][_0x809a('0x1d')](_0x2b0dfc)[_0x809a('0x22')](function(_0x1e0d54){_0x49448c[_0x809a('0x1d')]=_0x1e0d54;if(_0x2ee3e2[_0x809a('0x2e')][_0x809a('0x39')]){_0x33d804[_0x809a('0x3a')]=[{'all':!![]}];}return db[_0x809a('0x28')][_0x809a('0x3b')](_0x33d804);})[_0x809a('0x22')](function(_0x1ecc1e){_0x49448c[_0x809a('0x3c')]=_0x1ecc1e;return _0x49448c;})[_0x809a('0x22')](respondWithFilteredResult(_0x4d9479,_0x33d804))[_0x809a('0x3d')](handleError(_0x4d9479,null));};exports[_0x809a('0x3e')]=function(_0x1bec14,_0xa72c5d){var _0x3e71d1={'raw':![],'where':{'id':_0x1bec14[_0x809a('0x3f')]['id']}},_0x33bf6a={};_0x33bf6a[_0x809a('0x2b')]=_['keys'](db[_0x809a('0x28')]['rawAttributes']);_0x33bf6a[_0x809a('0x2e')]=_[_0x809a('0x2d')](_0x1bec14['query']);_0x33bf6a[_0x809a('0x40')]=_[_0x809a('0x41')](_0x33bf6a['model'],_0x33bf6a[_0x809a('0x2e')]);_0x3e71d1['attributes']=_[_0x809a('0x41')](_0x33bf6a[_0x809a('0x2b')],qs[_0x809a('0x2f')](_0x1bec14[_0x809a('0x2e')][_0x809a('0x2f')]));_0x3e71d1[_0x809a('0x30')]=_0x3e71d1[_0x809a('0x30')][_0x809a('0x42')]?_0x3e71d1[_0x809a('0x30')]:_0x33bf6a[_0x809a('0x2b')];if(_0x1bec14[_0x809a('0x2e')][_0x809a('0x39')]){_0x3e71d1[_0x809a('0x3a')]=[{'all':!![]}];}_0x3e71d1=_[_0x809a('0x37')]({},_0x3e71d1,_0x1bec14[_0x809a('0x38')]);return db[_0x809a('0x28')]['find'](_0x3e71d1)[_0x809a('0x22')](handleEntityNotFound(_0xa72c5d,null))[_0x809a('0x22')](respondWithResult(_0xa72c5d,null))['catch'](handleError(_0xa72c5d,null));};exports[_0x809a('0x43')]=function(_0xe4db6f,_0x1e10d4){return db['IntegrationReport'][_0x809a('0x43')](_0xe4db6f[_0x809a('0x44')],{})[_0x809a('0x22')](respondWithResult(_0x1e10d4,0xc9))[_0x809a('0x3d')](handleError(_0x1e10d4,null));};exports[_0x809a('0x45')]=function(_0xa5eb61,_0x33e0d9){if(_0xa5eb61[_0x809a('0x44')]['id']){delete _0xa5eb61[_0x809a('0x44')]['id'];}return db[_0x809a('0x28')][_0x809a('0x46')]({'where':{'id':_0xa5eb61['params']['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x33e0d9,null))[_0x809a('0x22')](saveUpdates(_0xa5eb61['body'],null))[_0x809a('0x22')](respondWithResult(_0x33e0d9,null))[_0x809a('0x3d')](handleError(_0x33e0d9,null));};exports[_0x809a('0x23')]=function(_0x3d15b0,_0x21356f){return db['IntegrationReport'][_0x809a('0x46')]({'where':{'id':_0x3d15b0[_0x809a('0x3f')]['id']}})[_0x809a('0x22')](handleEntityNotFound(_0x21356f,null))[_0x809a('0x22')](removeEntity(_0x21356f,null))[_0x809a('0x3d')](handleError(_0x21356f,null));};exports[_0x809a('0x47')]=function(_0x40cf1a,_0x4c6c98){return db['IntegrationReport']['describe']()[_0x809a('0x22')](respondWithResult(_0x4c6c98,null))[_0x809a('0x3d')](handleError(_0x4c6c98,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 52d5cc3..59ebef3 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 _0x9923=['define','IntegrationReport','report_integration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x9923,0x6f));var _0x3992=function(_0x45977c,_0x7eaed0){_0x45977c=_0x45977c-0x0;var _0x399413=_0x9923[_0x45977c];return _0x399413;};'use strict';var _=require('lodash');var util=require(_0x3992('0x0'));var logger=require(_0x3992('0x1'))(_0x3992('0x2'));var moment=require(_0x3992('0x3'));var BPromise=require(_0x3992('0x4'));var rp=require(_0x3992('0x5'));var fs=require('fs');var path=require(_0x3992('0x6'));var rimraf=require(_0x3992('0x7'));var config=require(_0x3992('0x8'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x37b81a,_0x464a0b){return _0x37b81a[_0x3992('0x9')](_0x3992('0xa'),attributes,{'tableName':_0x3992('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa32=['IntegrationReport','report_integration','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0xfa32,0xdf));var _0x2fa3=function(_0x5e9e3d,_0x2298d3){_0x5e9e3d=_0x5e9e3d-0x0;var _0x9ac37c=_0xfa32[_0x5e9e3d];return _0x9ac37c;};'use strict';var _=require(_0x2fa3('0x0'));var util=require(_0x2fa3('0x1'));var logger=require(_0x2fa3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2fa3('0x3'));var rp=require(_0x2fa3('0x4'));var fs=require('fs');var path=require(_0x2fa3('0x5'));var rimraf=require(_0x2fa3('0x6'));var config=require(_0x2fa3('0x7'));var attributes=require(_0x2fa3('0x8'));module[_0x2fa3('0x9')]=function(_0x39e553,_0x528720){return _0x39e553[_0x2fa3('0xa')](_0x2fa3('0xb'),attributes,{'tableName':_0x2fa3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 9c76b1b..41f3d2a 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 _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\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(_0x31e06f,_0x2a5564){var _0x3b0a3b=function(_0x59ae4f){while(--_0x59ae4f){_0x31e06f['push'](_0x31e06f['shift']());}};_0x3b0a3b(++_0x2a5564);}(_0x1261,0x144));var _0x1126=function(_0x31d98a,_0x292465){_0x31d98a=_0x31d98a-0x0;var _0x56e10e=_0x1261[_0x31d98a];return _0x56e10e;};'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')]('IntegrationReport,\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 +var _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x58d701,_0x3ed66c){var _0x4c580b=function(_0x347b07){while(--_0x347b07){_0x58d701['push'](_0x58d701['shift']());}};_0x4c580b(++_0x3ed66c);}(_0x57ca,0x108));var _0xa57c=function(_0x276ce9,_0x3d194a){_0x276ce9=_0x276ce9-0x0;var _0x430d30=_0x57ca[_0x276ce9];return _0x430d30;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 9e95576..03926c9 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 _0x0683=['put','/:id','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x0683,0xe1));var _0x3068=function(_0x195ba6,_0x5103c7){_0x195ba6=_0x195ba6-0x0;var _0x4d6b68=_0x0683[_0x195ba6];return _0x4d6b68;};'use strict';var multer=require('multer');var util=require(_0x3068('0x0'));var path=require('path');var timeout=require(_0x3068('0x1'));var express=require(_0x3068('0x2'));var router=express['Router']();var fs_extra=require(_0x3068('0x3'));var auth=require(_0x3068('0x4'));var interaction=require(_0x3068('0x5'));var config=require(_0x3068('0x6'));var controller=require(_0x3068('0x7'));router[_0x3068('0x8')]('/',auth['isAuthenticated'](),controller[_0x3068('0x9')]);router[_0x3068('0x8')]('/:id',auth[_0x3068('0xa')](),controller[_0x3068('0xb')]);router[_0x3068('0x8')](_0x3068('0xc'),auth[_0x3068('0xa')](),controller[_0x3068('0xd')]);router[_0x3068('0xe')]('/',auth[_0x3068('0xa')](),controller['create']);router[_0x3068('0xe')](_0x3068('0xc'),auth[_0x3068('0xa')](),controller[_0x3068('0xf')]);router[_0x3068('0xe')](_0x3068('0x10'),auth[_0x3068('0xa')](),controller['addIntervals']);router[_0x3068('0x11')](_0x3068('0x12'),auth[_0x3068('0xa')](),controller[_0x3068('0x13')]);router[_0x3068('0x14')]('/:id',auth[_0x3068('0xa')](),controller['destroy']);module[_0x3068('0x15')]=router; \ No newline at end of file +var _0xbff5=['addInterval','/:id/sub_intervals/create_many','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','create'];(function(_0x26973e,_0x4d1d08){var _0x26893c=function(_0x55b60d){while(--_0x55b60d){_0x26973e['push'](_0x26973e['shift']());}};_0x26893c(++_0x4d1d08);}(_0xbff5,0x1bc));var _0x5bff=function(_0x404607,_0x358587){_0x404607=_0x404607-0x0;var _0x1734ba=_0xbff5[_0x404607];return _0x1734ba;};'use strict';var multer=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var path=require(_0x5bff('0x2'));var timeout=require(_0x5bff('0x3'));var express=require(_0x5bff('0x4'));var router=express[_0x5bff('0x5')]();var fs_extra=require(_0x5bff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5bff('0x7'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x5bff('0x8')]('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xa')]);router[_0x5bff('0x8')](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller[_0x5bff('0xc')]);router[_0x5bff('0x8')](_0x5bff('0xd'),auth['isAuthenticated'](),controller[_0x5bff('0xe')]);router['post']('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xf')]);router['post'](_0x5bff('0xd'),auth['isAuthenticated'](),controller[_0x5bff('0x10')]);router['post'](_0x5bff('0x11'),auth[_0x5bff('0x9')](),controller['addIntervals']);router[_0x5bff('0x12')]('/:id',auth[_0x5bff('0x9')](),controller[_0x5bff('0x13')]);router['delete'](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 5efe099..fb89405 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 _0xa52c=['sequelize','exports','STRING'];(function(_0x1505e5,_0x5cc291){var _0x5b1dcd=function(_0x18bfe5){while(--_0x18bfe5){_0x1505e5['push'](_0x1505e5['shift']());}};_0x5b1dcd(++_0x5cc291);}(_0xa52c,0x17a));var _0xca52=function(_0x5bc106,_0xaf1ce2){_0x5bc106=_0x5bc106-0x0;var _0x33e35a=_0xa52c[_0x5bc106];return _0x33e35a;};'use strict';var Sequelize=require(_0xca52('0x0'));module[_0xca52('0x1')]={'name':{'type':Sequelize[_0xca52('0x2')]},'description':{'type':Sequelize[_0xca52('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xf551=['STRING','sequelize','exports'];(function(_0x352bab,_0x402a49){var _0x4f6d31=function(_0x579553){while(--_0x579553){_0x352bab['push'](_0x352bab['shift']());}};_0x4f6d31(++_0x402a49);}(_0xf551,0x18a));var _0x1f55=function(_0x1cf30d,_0x59af9b){_0x1cf30d=_0x1cf30d-0x0;var _0x9d08c3=_0xf551[_0x1cf30d];return _0x9d08c3;};'use strict';var Sequelize=require(_0x1f55('0x0'));module[_0x1f55('0x1')]={'name':{'type':Sequelize[_0x1f55('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 76b3e60..ab6f3ae 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 _0xdf53=['pick','merge','where','filter','options','includeAll','include','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','getIntervals','length','sort','findOne','transaction','bulkCreate','findAll','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','end','error','stack','name','send','map','Interval','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x9d1180,_0x2f71fb){var _0x155274=function(_0x1867c1){while(--_0x1867c1){_0x9d1180['push'](_0x9d1180['shift']());}};_0x155274(++_0x2f71fb);}(_0xdf53,0x174));var _0x3df5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdf53[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x3df5('0x0'));var rimraf=require(_0x3df5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3df5('0x2'));var moment=require(_0x3df5('0x3'));var BPromise=require(_0x3df5('0x4'));var Mustache=require(_0x3df5('0x5'));var util=require(_0x3df5('0x6'));var path=require(_0x3df5('0x7'));var sox=require(_0x3df5('0x8'));var csv=require(_0x3df5('0x9'));var ejs=require(_0x3df5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3df5('0xb'));var jsforce=require(_0x3df5('0xc'));var deskjs=require(_0x3df5('0xd'));var toCsv=require(_0x3df5('0x9'));var querystring=require(_0x3df5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3df5('0xf'));var as=require(_0x3df5('0x10'));var hardwareService=require(_0x3df5('0x11'));var logger=require('../../config/logger')(_0x3df5('0x12'));var utils=require('../../config/utils');var config=require(_0x3df5('0x13'));var licenseUtil=require(_0x3df5('0x14'));var db=require('../../mysqldb')['db'];var extensions=require(_0x3df5('0x15'));function respondWithStatusCode(_0x3ea68a,_0x6e0ec9){_0x6e0ec9=_0x6e0ec9||0xcc;return function(_0x5875f8){if(_0x5875f8){return _0x3ea68a[_0x3df5('0x16')](_0x6e0ec9);}return _0x3ea68a[_0x3df5('0x17')](_0x6e0ec9)['end']();};}function respondWithResult(_0x279801,_0x4ded0b){_0x4ded0b=_0x4ded0b||0xc8;return function(_0x349675){if(_0x349675){return _0x279801[_0x3df5('0x17')](_0x4ded0b)['json'](_0x349675);}};}function respondWithFilteredResult(_0x30fe7c,_0x362201){return function(_0x5e4c19){if(_0x5e4c19){var _0x305657=typeof _0x362201[_0x3df5('0x18')]===_0x3df5('0x19')&&typeof _0x362201[_0x3df5('0x1a')]===_0x3df5('0x19');var _0x419fa5=_0x5e4c19['count'];var _0x1b0502=_0x305657?0x0:_0x362201[_0x3df5('0x18')];var _0x22ca78=_0x305657?_0x5e4c19[_0x3df5('0x1b')]:_0x362201[_0x3df5('0x18')]+_0x362201[_0x3df5('0x1a')];var _0x19ef30;if(_0x22ca78>=_0x419fa5){_0x22ca78=_0x419fa5;_0x19ef30=0xc8;}else{_0x19ef30=0xce;}_0x30fe7c[_0x3df5('0x17')](_0x19ef30);return _0x30fe7c[_0x3df5('0x1c')]('Content-Range',_0x1b0502+'-'+_0x22ca78+'/'+_0x419fa5)['json'](_0x5e4c19);}return null;};}function patchUpdates(_0x4355ca){return function(_0xda0142){try{jsonpatch[_0x3df5('0x1d')](_0xda0142,_0x4355ca,!![]);}catch(_0xb0fff0){return BPromise[_0x3df5('0x1e')](_0xb0fff0);}return _0xda0142[_0x3df5('0x1f')]();};}function saveUpdates(_0x28158d,_0x12f93a){return function(_0x2c6219){if(_0x2c6219){return _0x2c6219[_0x3df5('0x20')](_0x28158d)['then'](function(_0x2832db){return _0x2832db;});}return null;};}function removeEntity(_0x506cbf,_0xdc5343){return function(_0x100cf1){if(_0x100cf1){return _0x100cf1['destroy']()[_0x3df5('0x21')](function(){var _0x26e7f4=_0x100cf1[_0x3df5('0x22')]({'plain':!![]});var _0x284248=_0x3df5('0x23');return db[_0x3df5('0x24')][_0x3df5('0x25')]({'where':{'type':_0x284248,'resourceId':_0x26e7f4['id']}})[_0x3df5('0x21')](function(){return _0x100cf1;});})[_0x3df5('0x21')](function(){_0x506cbf['status'](0xcc)[_0x3df5('0x26')]();});}};}function handleEntityNotFound(_0x32db3d,_0x50e9ee){return function(_0x92782f){if(!_0x92782f){_0x32db3d[_0x3df5('0x16')](0x194);}return _0x92782f;};}function handleError(_0x32d2a1,_0x53dabf){_0x53dabf=_0x53dabf||0x1f4;return function(_0x27d329){logger[_0x3df5('0x27')](_0x27d329[_0x3df5('0x28')]);if(_0x27d329[_0x3df5('0x29')]){delete _0x27d329[_0x3df5('0x29')];}_0x32d2a1[_0x3df5('0x17')](_0x53dabf)[_0x3df5('0x2a')](_0x27d329);};}exports['index']=function(_0x463e3f,_0x2ac19c){var _0x44be68={},_0x3d3e79={},_0x1f1fcb={'count':0x0,'rows':[]};var _0x5209b1=_[_0x3df5('0x2b')](db[_0x3df5('0x2c')]['rawAttributes'],function(_0x5be5aa){return{'name':_0x5be5aa[_0x3df5('0x2d')],'type':_0x5be5aa[_0x3df5('0x2e')][_0x3df5('0x2f')]};});_0x3d3e79[_0x3df5('0x30')]=_[_0x3df5('0x2b')](_0x5209b1,_0x3df5('0x29'));_0x3d3e79[_0x3df5('0x31')]=_[_0x3df5('0x32')](_0x463e3f[_0x3df5('0x31')]);_0x3d3e79[_0x3df5('0x33')]=_[_0x3df5('0x34')](_0x3d3e79[_0x3df5('0x30')],_0x3d3e79[_0x3df5('0x31')]);_0x44be68[_0x3df5('0x35')]=_[_0x3df5('0x34')](_0x3d3e79[_0x3df5('0x30')],qs[_0x3df5('0x36')](_0x463e3f[_0x3df5('0x31')][_0x3df5('0x36')]));_0x44be68[_0x3df5('0x35')]=_0x44be68[_0x3df5('0x35')]['length']?_0x44be68[_0x3df5('0x35')]:_0x3d3e79[_0x3df5('0x30')];if(!_0x463e3f[_0x3df5('0x31')][_0x3df5('0x37')](_0x3df5('0x38'))){_0x44be68[_0x3df5('0x1a')]=qs[_0x3df5('0x1a')](_0x463e3f[_0x3df5('0x31')][_0x3df5('0x1a')]);_0x44be68[_0x3df5('0x18')]=qs[_0x3df5('0x18')](_0x463e3f['query'][_0x3df5('0x18')]);}_0x44be68[_0x3df5('0x39')]=qs['sort'](_0x463e3f['query']['sort']);_0x44be68['where']=qs[_0x3df5('0x33')](_[_0x3df5('0x3a')](_0x463e3f[_0x3df5('0x31')],_0x3d3e79[_0x3df5('0x33')]),_0x5209b1);if(_0x463e3f[_0x3df5('0x31')]['filter']){_0x44be68['where']=_[_0x3df5('0x3b')](_0x44be68[_0x3df5('0x3c')],{'$or':_[_0x3df5('0x2b')](_0x5209b1,function(_0x804fb2){if(_0x804fb2['type']!=='VIRTUAL'){var _0x498b3e={};_0x498b3e[_0x804fb2[_0x3df5('0x29')]]={'$like':'%'+_0x463e3f[_0x3df5('0x31')][_0x3df5('0x3d')]+'%'};return _0x498b3e;}})});}_0x44be68=_[_0x3df5('0x3b')]({},_0x44be68,_0x463e3f[_0x3df5('0x3e')]);var _0x446a48={'where':_0x44be68[_0x3df5('0x3c')]};return db[_0x3df5('0x2c')][_0x3df5('0x1b')](_0x446a48)[_0x3df5('0x21')](function(_0x158dd6){_0x1f1fcb[_0x3df5('0x1b')]=_0x158dd6;if(_0x463e3f[_0x3df5('0x31')][_0x3df5('0x3f')]){_0x44be68[_0x3df5('0x40')]=[{'all':!![]}];}return db[_0x3df5('0x2c')]['findAll'](_0x44be68);})[_0x3df5('0x21')](function(_0x51915f){_0x1f1fcb[_0x3df5('0x41')]=_0x51915f;return _0x1f1fcb;})['then'](respondWithFilteredResult(_0x2ac19c,_0x44be68))[_0x3df5('0x42')](handleError(_0x2ac19c,null));};exports[_0x3df5('0x43')]=function(_0x46abe1,_0x384031){var _0x4c0bf0={'raw':!![],'where':{'id':_0x46abe1[_0x3df5('0x44')]['id']}},_0x4a3193={};_0x4a3193[_0x3df5('0x30')]=_[_0x3df5('0x32')](db[_0x3df5('0x2c')]['rawAttributes']);_0x4a3193['query']=_[_0x3df5('0x32')](_0x46abe1[_0x3df5('0x31')]);_0x4a3193[_0x3df5('0x33')]=_[_0x3df5('0x34')](_0x4a3193['model'],_0x4a3193[_0x3df5('0x31')]);_0x4c0bf0[_0x3df5('0x35')]=_[_0x3df5('0x34')](_0x4a3193[_0x3df5('0x30')],qs[_0x3df5('0x36')](_0x46abe1[_0x3df5('0x31')][_0x3df5('0x36')]));_0x4c0bf0['attributes']=_0x4c0bf0[_0x3df5('0x35')]['length']?_0x4c0bf0[_0x3df5('0x35')]:_0x4a3193[_0x3df5('0x30')];if(_0x46abe1[_0x3df5('0x31')][_0x3df5('0x3f')]){_0x4c0bf0[_0x3df5('0x40')]=[{'all':!![]}];}_0x4c0bf0=_[_0x3df5('0x3b')]({},_0x4c0bf0,_0x46abe1[_0x3df5('0x3e')]);return db[_0x3df5('0x2c')][_0x3df5('0x45')](_0x4c0bf0)['then'](handleEntityNotFound(_0x384031,null))['then'](respondWithResult(_0x384031,null))[_0x3df5('0x42')](handleError(_0x384031,null));};exports[_0x3df5('0x46')]=function(_0xa0ebc6,_0x2f93ea){return db['Interval'][_0x3df5('0x46')](_0xa0ebc6['body'],{})['then'](function(_0x320275){var _0x5d8f7c=_0xa0ebc6['user'][_0x3df5('0x22')]({'plain':!![]});if(!_0x5d8f7c)throw new Error(_0x3df5('0x47'));if(_0x5d8f7c['role']===_0x3df5('0x48')){var _0x342ccd=_0x320275[_0x3df5('0x22')]({'plain':!![]});var _0x5a1329=_0x3df5('0x23');return db[_0x3df5('0x49')][_0x3df5('0x45')]({'where':{'name':_0x5a1329,'userProfileId':_0x5d8f7c[_0x3df5('0x4a')]},'raw':!![]})[_0x3df5('0x21')](function(_0x4ac203){if(_0x4ac203&&_0x4ac203[_0x3df5('0x4b')]===0x0){return db[_0x3df5('0x24')]['create']({'name':_0x342ccd['name'],'resourceId':_0x342ccd['id'],'type':_0x4ac203[_0x3df5('0x29')],'sectionId':_0x4ac203['id']},{})[_0x3df5('0x21')](function(){return _0x320275;});}else{return _0x320275;}})[_0x3df5('0x42')](function(_0x414c2f){logger['error'](_0x3df5('0x4c'),_0x414c2f);throw _0x414c2f;});}return _0x320275;})[_0x3df5('0x21')](respondWithResult(_0x2f93ea,0xc9))['catch'](handleError(_0x2f93ea,null));};exports[_0x3df5('0x20')]=function(_0x3a6169,_0x3b034b){if(_0x3a6169['body']['id']){delete _0x3a6169['body']['id'];}return db['Interval'][_0x3df5('0x45')]({'where':{'id':_0x3a6169[_0x3df5('0x44')]['id']}})[_0x3df5('0x21')](handleEntityNotFound(_0x3b034b,null))[_0x3df5('0x21')](saveUpdates(_0x3a6169[_0x3df5('0x4d')],null))[_0x3df5('0x21')](respondWithResult(_0x3b034b,null))[_0x3df5('0x42')](handleError(_0x3b034b,null));};exports['destroy']=function(_0x33940d,_0x96ddb1){return db[_0x3df5('0x2c')][_0x3df5('0x45')]({'where':{'id':_0x33940d[_0x3df5('0x44')]['id']}})['then'](handleEntityNotFound(_0x96ddb1,null))['then'](removeEntity(_0x96ddb1,null))[_0x3df5('0x42')](handleError(_0x96ddb1,null));};exports[_0x3df5('0x4e')]=function(_0x55d84f,_0x316b77,_0x142c9c){if(_0x55d84f['body']['id']){delete _0x55d84f[_0x3df5('0x4d')]['id'];}return db[_0x3df5('0x2c')][_0x3df5('0x45')]({'where':{'id':_0x55d84f['params']['id']}})[_0x3df5('0x21')](handleEntityNotFound(_0x316b77,null))[_0x3df5('0x21')](function(_0x75cd13){if(_0x75cd13){_0x55d84f['body']['IntervalId']=_0x75cd13['id'];return db['Interval'][_0x3df5('0x46')](_0x55d84f['body']);}})['then'](respondWithResult(_0x316b77,null))[_0x3df5('0x42')](handleError(_0x316b77,null));};exports[_0x3df5('0x4f')]=function(_0x22e35c,_0xb0f2c,_0x5826c4){var _0x1567dc={};var _0x4d1cce={};var _0x2da5ab;var _0x1167b9;return db['Interval']['findOne']({'where':{'id':_0x22e35c[_0x3df5('0x44')]['id']}})[_0x3df5('0x21')](handleEntityNotFound(_0xb0f2c,null))[_0x3df5('0x21')](function(_0x2dd922){if(_0x2dd922){_0x2da5ab=_0x2dd922;_0x4d1cce[_0x3df5('0x30')]=_[_0x3df5('0x32')](db[_0x3df5('0x2c')]['rawAttributes']);_0x4d1cce[_0x3df5('0x31')]=_[_0x3df5('0x32')](_0x22e35c[_0x3df5('0x31')]);_0x4d1cce[_0x3df5('0x33')]=_['intersection'](_0x4d1cce[_0x3df5('0x30')],_0x4d1cce['query']);_0x1567dc[_0x3df5('0x35')]=_[_0x3df5('0x34')](_0x4d1cce[_0x3df5('0x30')],qs[_0x3df5('0x36')](_0x22e35c['query'][_0x3df5('0x36')]));_0x1567dc['attributes']=_0x1567dc[_0x3df5('0x35')][_0x3df5('0x50')]?_0x1567dc['attributes']:_0x4d1cce[_0x3df5('0x30')];_0x1567dc['order']=qs[_0x3df5('0x51')](_0x22e35c['query'][_0x3df5('0x51')]);_0x1567dc[_0x3df5('0x3c')]=qs[_0x3df5('0x33')](_[_0x3df5('0x3a')](_0x22e35c[_0x3df5('0x31')],_0x4d1cce[_0x3df5('0x33')]));if(_0x22e35c[_0x3df5('0x31')][_0x3df5('0x3d')]){_0x1567dc['where']=_['merge'](_0x1567dc[_0x3df5('0x3c')],{'$or':_[_0x3df5('0x2b')](_0x1567dc['attributes'],function(_0x141a57){var _0x3527fc={};_0x3527fc[_0x141a57]={'$like':'%'+_0x22e35c[_0x3df5('0x31')][_0x3df5('0x3d')]+'%'};return _0x3527fc;})});}_0x1567dc=_[_0x3df5('0x3b')]({},_0x1567dc,_0x22e35c[_0x3df5('0x3e')]);return _0x2da5ab[_0x3df5('0x4f')](_0x1567dc);}})[_0x3df5('0x21')](function(_0x3f691a){if(_0x3f691a){_0x1167b9=_0x3f691a[_0x3df5('0x50')];if(!_0x22e35c[_0x3df5('0x31')]['hasOwnProperty'](_0x3df5('0x38'))){_0x1567dc[_0x3df5('0x1a')]=qs[_0x3df5('0x1a')](_0x22e35c[_0x3df5('0x31')][_0x3df5('0x1a')]);_0x1567dc[_0x3df5('0x18')]=qs[_0x3df5('0x18')](_0x22e35c[_0x3df5('0x31')][_0x3df5('0x18')]);}return _0x2da5ab[_0x3df5('0x4f')](_0x1567dc);}})[_0x3df5('0x21')](function(_0x4df418){if(_0x4df418){return _0x4df418?{'count':_0x1167b9,'rows':_0x4df418}:null;}})[_0x3df5('0x21')](respondWithResult(_0xb0f2c,null))[_0x3df5('0x42')](handleError(_0xb0f2c,null));};exports['addIntervals']=function(_0xb9a31a,_0x2e881f,_0x34c00d){return db['Interval'][_0x3df5('0x52')]({'where':{'id':_0xb9a31a[_0x3df5('0x44')]['id']}})[_0x3df5('0x21')](handleEntityNotFound(_0x2e881f,null))[_0x3df5('0x21')](function(_0x45fd58){if(_0x45fd58){return db['sequelize'][_0x3df5('0x53')](function(_0x11610e){return db[_0x3df5('0x2c')][_0x3df5('0x25')]({'where':{'IntervalId':_0xb9a31a[_0x3df5('0x44')]['id']},'transaction':_0x11610e})['then'](function(_0x3affaf){var _0x395809=_[_0x3df5('0x2b')](_0xb9a31a[_0x3df5('0x4d')],function(_0x541359){delete _0x541359['id'];_0x541359['IntervalId']=_0xb9a31a[_0x3df5('0x44')]['id'];return _0x541359;});return db[_0x3df5('0x2c')][_0x3df5('0x54')](_0x395809,{'transaction':_0x11610e});});})['then'](function(){return db[_0x3df5('0x2c')][_0x3df5('0x55')]({'where':{'IntervalId':_0xb9a31a['params']['id']}});});}})[_0x3df5('0x21')](respondWithResult(_0x2e881f,null))[_0x3df5('0x42')](handleError(_0x2e881f,null));}; \ No newline at end of file +var _0x03c2=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','Interval','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','findOne','pick','getIntervals','nolimit','addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','zip-dir','request-promise'];(function(_0x5f3659,_0x1e5194){var _0x16b612=function(_0x2ba2c8){while(--_0x2ba2c8){_0x5f3659['push'](_0x5f3659['shift']());}};_0x16b612(++_0x1e5194);}(_0x03c2,0x16d));var _0x203c=function(_0x4e82af,_0x2dadc1){_0x4e82af=_0x4e82af-0x0;var _0x5183b3=_0x03c2[_0x4e82af];return _0x5183b3;};'use strict';var emlformat=require(_0x203c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x203c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x203c('0x2'));var moment=require(_0x203c('0x3'));var BPromise=require(_0x203c('0x4'));var Mustache=require(_0x203c('0x5'));var util=require(_0x203c('0x6'));var path=require(_0x203c('0x7'));var sox=require(_0x203c('0x8'));var csv=require(_0x203c('0x9'));var ejs=require(_0x203c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x203c('0xb'));var squel=require('squel');var crypto=require(_0x203c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x203c('0xd'));var toCsv=require(_0x203c('0x9'));var querystring=require(_0x203c('0xe'));var Papa=require(_0x203c('0xf'));var Redis=require(_0x203c('0x10'));var authService=require(_0x203c('0x11'));var qs=require(_0x203c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x203c('0x13'));var logger=require(_0x203c('0x14'))('api');var utils=require(_0x203c('0x15'));var config=require(_0x203c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x203c('0x17'));function respondWithStatusCode(_0xc824d3,_0x5563ed){_0x5563ed=_0x5563ed||0xcc;return function(_0x11ae19){if(_0x11ae19){return _0xc824d3['sendStatus'](_0x5563ed);}return _0xc824d3[_0x203c('0x18')](_0x5563ed)[_0x203c('0x19')]();};}function respondWithResult(_0x4439b6,_0x3fd65b){_0x3fd65b=_0x3fd65b||0xc8;return function(_0x280f27){if(_0x280f27){return _0x4439b6[_0x203c('0x18')](_0x3fd65b)[_0x203c('0x1a')](_0x280f27);}};}function respondWithFilteredResult(_0x41a066,_0x95b276){return function(_0x14cef0){if(_0x14cef0){var _0x376bdf=typeof _0x95b276[_0x203c('0x1b')]===_0x203c('0x1c')&&typeof _0x95b276[_0x203c('0x1d')]==='undefined';var _0x941bcf=_0x14cef0[_0x203c('0x1e')];var _0x206e32=_0x376bdf?0x0:_0x95b276[_0x203c('0x1b')];var _0x561461=_0x376bdf?_0x14cef0[_0x203c('0x1e')]:_0x95b276[_0x203c('0x1b')]+_0x95b276[_0x203c('0x1d')];var _0x2d752b;if(_0x561461>=_0x941bcf){_0x561461=_0x941bcf;_0x2d752b=0xc8;}else{_0x2d752b=0xce;}_0x41a066[_0x203c('0x18')](_0x2d752b);return _0x41a066[_0x203c('0x1f')](_0x203c('0x20'),_0x206e32+'-'+_0x561461+'/'+_0x941bcf)['json'](_0x14cef0);}return null;};}function patchUpdates(_0x593652){return function(_0x489d33){try{jsonpatch[_0x203c('0x21')](_0x489d33,_0x593652,!![]);}catch(_0x1a5b49){return BPromise['reject'](_0x1a5b49);}return _0x489d33[_0x203c('0x22')]();};}function saveUpdates(_0x58af87,_0x7f122b){return function(_0x311ed7){if(_0x311ed7){return _0x311ed7[_0x203c('0x23')](_0x58af87)['then'](function(_0x675fd7){return _0x675fd7;});}return null;};}function removeEntity(_0x4a4358,_0xcd424c){return function(_0x3f3afe){if(_0x3f3afe){return _0x3f3afe[_0x203c('0x24')]()[_0x203c('0x25')](function(){var _0x2850ba=_0x3f3afe[_0x203c('0x26')]({'plain':!![]});var _0x4eb402='Intervals';return db[_0x203c('0x27')][_0x203c('0x24')]({'where':{'type':_0x4eb402,'resourceId':_0x2850ba['id']}})[_0x203c('0x25')](function(){return _0x3f3afe;});})[_0x203c('0x25')](function(){_0x4a4358[_0x203c('0x18')](0xcc)[_0x203c('0x19')]();});}};}function handleEntityNotFound(_0x517945,_0x483298){return function(_0x2e064d){if(!_0x2e064d){_0x517945['sendStatus'](0x194);}return _0x2e064d;};}function handleError(_0xc6f965,_0x4c8c56){_0x4c8c56=_0x4c8c56||0x1f4;return function(_0x2da01a){logger[_0x203c('0x28')](_0x2da01a[_0x203c('0x29')]);if(_0x2da01a[_0x203c('0x2a')]){delete _0x2da01a[_0x203c('0x2a')];}_0xc6f965['status'](_0x4c8c56)[_0x203c('0x2b')](_0x2da01a);};}exports['index']=function(_0x10abf4,_0x401207){var _0x5a45a1={},_0x29debe={},_0x420a88={'count':0x0,'rows':[]};var _0x35d6fd=_['map'](db[_0x203c('0x2c')][_0x203c('0x2d')],function(_0x5c685d){return{'name':_0x5c685d[_0x203c('0x2e')],'type':_0x5c685d['type'][_0x203c('0x2f')]};});_0x29debe[_0x203c('0x30')]=_[_0x203c('0x31')](_0x35d6fd,_0x203c('0x2a'));_0x29debe[_0x203c('0x32')]=_[_0x203c('0x33')](_0x10abf4[_0x203c('0x32')]);_0x29debe[_0x203c('0x34')]=_[_0x203c('0x35')](_0x29debe['model'],_0x29debe[_0x203c('0x32')]);_0x5a45a1[_0x203c('0x36')]=_['intersection'](_0x29debe['model'],qs[_0x203c('0x37')](_0x10abf4[_0x203c('0x32')][_0x203c('0x37')]));_0x5a45a1[_0x203c('0x36')]=_0x5a45a1[_0x203c('0x36')][_0x203c('0x38')]?_0x5a45a1[_0x203c('0x36')]:_0x29debe[_0x203c('0x30')];if(!_0x10abf4[_0x203c('0x32')][_0x203c('0x39')]('nolimit')){_0x5a45a1[_0x203c('0x1d')]=qs[_0x203c('0x1d')](_0x10abf4[_0x203c('0x32')]['limit']);_0x5a45a1[_0x203c('0x1b')]=qs[_0x203c('0x1b')](_0x10abf4[_0x203c('0x32')]['offset']);}_0x5a45a1[_0x203c('0x3a')]=qs[_0x203c('0x3b')](_0x10abf4[_0x203c('0x32')][_0x203c('0x3b')]);_0x5a45a1[_0x203c('0x3c')]=qs[_0x203c('0x34')](_['pick'](_0x10abf4['query'],_0x29debe['filters']),_0x35d6fd);if(_0x10abf4[_0x203c('0x32')][_0x203c('0x3d')]){_0x5a45a1[_0x203c('0x3c')]=_[_0x203c('0x3e')](_0x5a45a1[_0x203c('0x3c')],{'$or':_['map'](_0x35d6fd,function(_0x53e205){if(_0x53e205[_0x203c('0x3f')]!==_0x203c('0x40')){var _0x39faee={};_0x39faee[_0x53e205[_0x203c('0x2a')]]={'$like':'%'+_0x10abf4['query'][_0x203c('0x3d')]+'%'};return _0x39faee;}})});}_0x5a45a1=_[_0x203c('0x3e')]({},_0x5a45a1,_0x10abf4[_0x203c('0x41')]);var _0x46d88d={'where':_0x5a45a1[_0x203c('0x3c')]};return db[_0x203c('0x2c')][_0x203c('0x1e')](_0x46d88d)['then'](function(_0x14c963){_0x420a88[_0x203c('0x1e')]=_0x14c963;if(_0x10abf4[_0x203c('0x32')][_0x203c('0x42')]){_0x5a45a1[_0x203c('0x43')]=[{'all':!![]}];}return db['Interval'][_0x203c('0x44')](_0x5a45a1);})[_0x203c('0x25')](function(_0xdc17cd){_0x420a88[_0x203c('0x45')]=_0xdc17cd;return _0x420a88;})[_0x203c('0x25')](respondWithFilteredResult(_0x401207,_0x5a45a1))[_0x203c('0x46')](handleError(_0x401207,null));};exports[_0x203c('0x47')]=function(_0x32a859,_0x5386b0){var _0x26940f={'raw':!![],'where':{'id':_0x32a859[_0x203c('0x48')]['id']}},_0x3eb920={};_0x3eb920['model']=_[_0x203c('0x33')](db[_0x203c('0x2c')][_0x203c('0x2d')]);_0x3eb920[_0x203c('0x32')]=_[_0x203c('0x33')](_0x32a859[_0x203c('0x32')]);_0x3eb920['filters']=_[_0x203c('0x35')](_0x3eb920['model'],_0x3eb920['query']);_0x26940f[_0x203c('0x36')]=_[_0x203c('0x35')](_0x3eb920['model'],qs[_0x203c('0x37')](_0x32a859['query'][_0x203c('0x37')]));_0x26940f[_0x203c('0x36')]=_0x26940f[_0x203c('0x36')][_0x203c('0x38')]?_0x26940f[_0x203c('0x36')]:_0x3eb920['model'];if(_0x32a859[_0x203c('0x32')]['includeAll']){_0x26940f['include']=[{'all':!![]}];}_0x26940f=_[_0x203c('0x3e')]({},_0x26940f,_0x32a859['options']);return db['Interval'][_0x203c('0x49')](_0x26940f)[_0x203c('0x25')](handleEntityNotFound(_0x5386b0,null))[_0x203c('0x25')](respondWithResult(_0x5386b0,null))[_0x203c('0x46')](handleError(_0x5386b0,null));};exports[_0x203c('0x4a')]=function(_0x52c577,_0x56e764){return db[_0x203c('0x2c')][_0x203c('0x4a')](_0x52c577[_0x203c('0x4b')],{})[_0x203c('0x25')](function(_0x15a5f0){var _0x4d6fac=_0x52c577[_0x203c('0x4c')][_0x203c('0x26')]({'plain':!![]});if(!_0x4d6fac)throw new Error(_0x203c('0x4d'));if(_0x4d6fac[_0x203c('0x4e')]===_0x203c('0x4c')){var _0xd8209b=_0x15a5f0[_0x203c('0x26')]({'plain':!![]});var _0x5692f2=_0x203c('0x4f');return db['UserProfileSection'][_0x203c('0x49')]({'where':{'name':_0x5692f2,'userProfileId':_0x4d6fac['userProfileId']},'raw':!![]})[_0x203c('0x25')](function(_0x5d9727){if(_0x5d9727&&_0x5d9727[_0x203c('0x50')]===0x0){return db[_0x203c('0x27')]['create']({'name':_0xd8209b[_0x203c('0x2a')],'resourceId':_0xd8209b['id'],'type':_0x5d9727[_0x203c('0x2a')],'sectionId':_0x5d9727['id']},{})['then'](function(){return _0x15a5f0;});}else{return _0x15a5f0;}})[_0x203c('0x46')](function(_0x2114c8){logger['error'](_0x203c('0x51'),_0x2114c8);throw _0x2114c8;});}return _0x15a5f0;})[_0x203c('0x25')](respondWithResult(_0x56e764,0xc9))[_0x203c('0x46')](handleError(_0x56e764,null));};exports['update']=function(_0x57596e,_0x99fd8){if(_0x57596e[_0x203c('0x4b')]['id']){delete _0x57596e[_0x203c('0x4b')]['id'];}return db[_0x203c('0x2c')]['find']({'where':{'id':_0x57596e['params']['id']}})['then'](handleEntityNotFound(_0x99fd8,null))[_0x203c('0x25')](saveUpdates(_0x57596e[_0x203c('0x4b')],null))[_0x203c('0x25')](respondWithResult(_0x99fd8,null))[_0x203c('0x46')](handleError(_0x99fd8,null));};exports[_0x203c('0x24')]=function(_0xd7a212,_0x70e056){return db[_0x203c('0x2c')][_0x203c('0x49')]({'where':{'id':_0xd7a212[_0x203c('0x48')]['id']}})[_0x203c('0x25')](handleEntityNotFound(_0x70e056,null))[_0x203c('0x25')](removeEntity(_0x70e056,null))[_0x203c('0x46')](handleError(_0x70e056,null));};exports[_0x203c('0x52')]=function(_0x5480e5,_0x3ee96c,_0x43b4cd){if(_0x5480e5['body']['id']){delete _0x5480e5[_0x203c('0x4b')]['id'];}return db[_0x203c('0x2c')]['find']({'where':{'id':_0x5480e5[_0x203c('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ee96c,null))[_0x203c('0x25')](function(_0x5b6977){if(_0x5b6977){_0x5480e5[_0x203c('0x4b')]['IntervalId']=_0x5b6977['id'];return db[_0x203c('0x2c')][_0x203c('0x4a')](_0x5480e5['body']);}})['then'](respondWithResult(_0x3ee96c,null))[_0x203c('0x46')](handleError(_0x3ee96c,null));};exports['getIntervals']=function(_0x3caaa0,_0x2487fd,_0x152e62){var _0x18667f={};var _0x4ac4bd={};var _0xa66b07;var _0x2a930f;return db[_0x203c('0x2c')][_0x203c('0x53')]({'where':{'id':_0x3caaa0[_0x203c('0x48')]['id']}})['then'](handleEntityNotFound(_0x2487fd,null))[_0x203c('0x25')](function(_0x2d2cd9){if(_0x2d2cd9){_0xa66b07=_0x2d2cd9;_0x4ac4bd[_0x203c('0x30')]=_[_0x203c('0x33')](db['Interval']['rawAttributes']);_0x4ac4bd[_0x203c('0x32')]=_[_0x203c('0x33')](_0x3caaa0['query']);_0x4ac4bd[_0x203c('0x34')]=_[_0x203c('0x35')](_0x4ac4bd[_0x203c('0x30')],_0x4ac4bd[_0x203c('0x32')]);_0x18667f[_0x203c('0x36')]=_[_0x203c('0x35')](_0x4ac4bd[_0x203c('0x30')],qs[_0x203c('0x37')](_0x3caaa0['query']['fields']));_0x18667f[_0x203c('0x36')]=_0x18667f[_0x203c('0x36')][_0x203c('0x38')]?_0x18667f[_0x203c('0x36')]:_0x4ac4bd[_0x203c('0x30')];_0x18667f['order']=qs[_0x203c('0x3b')](_0x3caaa0[_0x203c('0x32')][_0x203c('0x3b')]);_0x18667f[_0x203c('0x3c')]=qs[_0x203c('0x34')](_[_0x203c('0x54')](_0x3caaa0['query'],_0x4ac4bd[_0x203c('0x34')]));if(_0x3caaa0[_0x203c('0x32')][_0x203c('0x3d')]){_0x18667f[_0x203c('0x3c')]=_['merge'](_0x18667f[_0x203c('0x3c')],{'$or':_[_0x203c('0x31')](_0x18667f[_0x203c('0x36')],function(_0x4c36df){var _0x3a1090={};_0x3a1090[_0x4c36df]={'$like':'%'+_0x3caaa0['query']['filter']+'%'};return _0x3a1090;})});}_0x18667f=_[_0x203c('0x3e')]({},_0x18667f,_0x3caaa0[_0x203c('0x41')]);return _0xa66b07[_0x203c('0x55')](_0x18667f);}})[_0x203c('0x25')](function(_0x37871a){if(_0x37871a){_0x2a930f=_0x37871a[_0x203c('0x38')];if(!_0x3caaa0[_0x203c('0x32')][_0x203c('0x39')](_0x203c('0x56'))){_0x18667f[_0x203c('0x1d')]=qs[_0x203c('0x1d')](_0x3caaa0[_0x203c('0x32')]['limit']);_0x18667f[_0x203c('0x1b')]=qs['offset'](_0x3caaa0[_0x203c('0x32')][_0x203c('0x1b')]);}return _0xa66b07[_0x203c('0x55')](_0x18667f);}})['then'](function(_0x86699f){if(_0x86699f){return _0x86699f?{'count':_0x2a930f,'rows':_0x86699f}:null;}})[_0x203c('0x25')](respondWithResult(_0x2487fd,null))[_0x203c('0x46')](handleError(_0x2487fd,null));};exports[_0x203c('0x57')]=function(_0x4998d7,_0xefd08f,_0x515306){return db['Interval'][_0x203c('0x53')]({'where':{'id':_0x4998d7[_0x203c('0x48')]['id']}})[_0x203c('0x25')](handleEntityNotFound(_0xefd08f,null))[_0x203c('0x25')](function(_0x23b440){if(_0x23b440){return db[_0x203c('0x58')][_0x203c('0x59')](function(_0x48a556){return db[_0x203c('0x2c')][_0x203c('0x24')]({'where':{'IntervalId':_0x4998d7[_0x203c('0x48')]['id']},'transaction':_0x48a556})[_0x203c('0x25')](function(_0x527f85){var _0x410a55=_[_0x203c('0x31')](_0x4998d7['body'],function(_0x38d2cd){delete _0x38d2cd['id'];_0x38d2cd[_0x203c('0x5a')]=_0x4998d7[_0x203c('0x48')]['id'];return _0x38d2cd;});return db[_0x203c('0x2c')][_0x203c('0x5b')](_0x410a55,{'transaction':_0x48a556});});})[_0x203c('0x25')](function(){return db[_0x203c('0x2c')][_0x203c('0x44')]({'where':{'IntervalId':_0x4998d7[_0x203c('0x48')]['id']}});});}})[_0x203c('0x25')](respondWithResult(_0xefd08f,null))[_0x203c('0x46')](handleError(_0xefd08f,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 9fb12ed..e870736 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 _0x926b=['exports','define','Interval','rewrite','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/extensions/rewrite'];(function(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_0x926b,0x178));var _0xb926=function(_0x3b76c7,_0x5b8a9e){_0x3b76c7=_0x3b76c7-0x0;var _0x2cbc4a=_0x926b[_0x3b76c7];return _0x2cbc4a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb926('0x0'))(_0xb926('0x1'));var moment=require(_0xb926('0x2'));var BPromise=require(_0xb926('0x3'));var rp=require(_0xb926('0x4'));var fs=require('fs');var path=require(_0xb926('0x5'));var rimraf=require('rimraf');var config=require(_0xb926('0x6'));var attributes=require('./interval.attributes');var extensions=require(_0xb926('0x7'));module[_0xb926('0x8')]=function(_0x1fae92,_0x2c7c55){return _0x1fae92[_0xb926('0x9')](_0xb926('0xa'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2635e9,_0x322d4d){extensions[_0xb926('0xb')](_0x1fae92,_0x2635e9);},'afterBulkCreate':function(_0x1463e6,_0x508b91,_0x58e170){_0x58e170();extensions['rewrite'](_0x1fae92,_0x1463e6[0x0]);},'afterUpdate':function(_0x4b75ec,_0x419215){extensions[_0xb926('0xb')](_0x1fae92,_0x4b75ec);},'afterDestroy':function(_0x18c145,_0x3b3808){extensions['rewrite'](_0x1fae92,_0x18c145);}}});}; \ No newline at end of file +var _0x745d=['moment','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api'];(function(_0x30c7e2,_0x183dca){var _0x250028=function(_0x538ea7){while(--_0x538ea7){_0x30c7e2['push'](_0x30c7e2['shift']());}};_0x250028(++_0x183dca);}(_0x745d,0xec));var _0xd745=function(_0x26ea1f,_0x47ac11){_0x26ea1f=_0x26ea1f-0x0;var _0x57d6ba=_0x745d[_0x26ea1f];return _0x57d6ba;};'use strict';var _=require(_0xd745('0x0'));var util=require(_0xd745('0x1'));var logger=require(_0xd745('0x2'))(_0xd745('0x3'));var moment=require(_0xd745('0x4'));var BPromise=require('bluebird');var rp=require(_0xd745('0x5'));var fs=require('fs');var path=require(_0xd745('0x6'));var rimraf=require(_0xd745('0x7'));var config=require(_0xd745('0x8'));var attributes=require(_0xd745('0x9'));var extensions=require(_0xd745('0xa'));module[_0xd745('0xb')]=function(_0x55ba33,_0x61e829){return _0x55ba33[_0xd745('0xc')](_0xd745('0xd'),attributes,{'tableName':_0xd745('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x9fb850,_0x42572e){extensions[_0xd745('0xf')](_0x55ba33,_0x9fb850);},'afterBulkCreate':function(_0x4b25c5,_0x53a742,_0xfb2c96){_0xfb2c96();extensions[_0xd745('0xf')](_0x55ba33,_0x4b25c5[0x0]);},'afterUpdate':function(_0x8bf2d,_0x2f8f6f){extensions[_0xd745('0xf')](_0x55ba33,_0x8bf2d);},'afterDestroy':function(_0x15b6c4,_0x8dc4bf){extensions[_0xd745('0xf')](_0x55ba33,_0x15b6c4);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index d6908dd..ac64a34 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_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);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e2f10ec..7d27a81 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x95757e,_0x4b4b7e){var _0xb40b34=function(_0x2b37c9){while(--_0x2b37c9){_0x95757e['push'](_0x95757e['shift']());}};_0xb40b34(++_0x4b4b7e);}(_0xadb5,0xad));var _0x5adb=function(_0x2c8dc3,_0x12953e){_0x2c8dc3=_0x2c8dc3-0x0;var _0x46e371=_0xadb5[_0x2c8dc3];return _0x46e371;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x1c1834,_0x47ebff){var _0x4cc4f8=function(_0x3cdd0d){while(--_0x3cdd0d){_0x1c1834['push'](_0x1c1834['shift']());}};_0x4cc4f8(++_0x47ebff);}(_0x2ef3,0xba));var _0x32ef=function(_0xa0927a,_0x371967){_0xa0927a=_0xa0927a-0x0;var _0x6fc5da=_0x2ef3[_0xa0927a];return _0x6fc5da;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 6255965..b1c27c0 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 _0x2d79=['customfield_11502','newToken','customfield_11503','name','reason','/rest/api/2/issue','application/json','Basic\x20','setEncoding','data','end','status','statusCode','json','parse','error','api.jira','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','summary','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x2d79,0x69));var _0x92d7=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2d79[_0x59ee6f];return _0x4c0979;};'use strict';var BPromise=require(_0x92d7('0x0'));var https=require(_0x92d7('0x1'));var logger=require(_0x92d7('0x2'))(_0x92d7('0x3'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x207087,_0x206ff9){var _0x2aa27c={'fields':{'project':{'key':_0x207087['key']||'MOTGUI'},'summary':(_0x207087[_0x92d7('0x4')]||_0x92d7('0x5'))+_0x92d7('0x6')+_0x207087['ip'],'description':_0x207087[_0x92d7('0x7')]||JSON[_0x92d7('0x8')](_0x207087),'issuetype':{'name':_0x207087[_0x92d7('0x9')]||'Bug'}}};_0x2aa27c[_0x92d7('0xa')][_0x92d7('0xb')]=_0x207087[_0x92d7('0xc')];_0x2aa27c['fields'][_0x92d7('0xd')]=_0x207087[_0x92d7('0xe')];_0x2aa27c[_0x92d7('0xa')][_0x92d7('0xf')]=_0x207087[_0x92d7('0x10')];_0x2aa27c['fields'][_0x92d7('0x11')]=_0x207087[_0x92d7('0x12')];_0x2aa27c[_0x92d7('0xa')]['customfield_11504']=_0x207087[_0x92d7('0x13')];_0x2aa27c['fields']['customfield_10102']=_0x207087['ip'];var _0x15e9f1={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x92d7('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x92d7('0x15'),'Authorization':_0x92d7('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x504712=JSON['stringify'](_0x2aa27c);var _0x35e656=https['request'](_0x15e9f1,function(_0xac82cd){_0xac82cd[_0x92d7('0x17')]('utf8');var _0x41d57e='';_0xac82cd['on'](_0x92d7('0x18'),function(_0xe0ee2d){_0x41d57e+=_0xe0ee2d;});_0xac82cd['on'](_0x92d7('0x19'),function(){if(_0x206ff9){return _0x206ff9[_0x92d7('0x1a')](_0xac82cd[_0x92d7('0x1b')])[_0x92d7('0x1c')](JSON[_0x92d7('0x1d')](_0x41d57e));}});});_0x35e656['on'](_0x92d7('0x1e'),function(_0x21aa8f){if(_0x206ff9){return _0x206ff9['status'](0x1f4)[_0x92d7('0x1c')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x92d7('0x1f')}]});}});_0x35e656['write'](_0x504712);_0x35e656[_0x92d7('0x19')]();}exports[_0x92d7('0x20')]=openIssue;exports[_0x92d7('0x21')]=function(_0x37a255,_0x442178){_0x37a255[_0x92d7('0x22')]['ip']=_0x37a255[_0x92d7('0x23')][_0x92d7('0x24')]||_0x37a255[_0x92d7('0x25')][_0x92d7('0x26')]||_0x37a255[_0x92d7('0x27')][_0x92d7('0x26')]||_0x37a255[_0x92d7('0x25')][_0x92d7('0x27')][_0x92d7('0x26')];return openIssue(_0x37a255[_0x92d7('0x22')],_0x442178);}; \ No newline at end of file +var _0x5aea=['body','x-forwarded-for','connection','socket','remoteAddress','bluebird','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','name','reason','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','json','error','api.jira','write','openIssue','send'];(function(_0x4f9275,_0x166e6b){var _0x59d5ca=function(_0x42e3bf){while(--_0x42e3bf){_0x4f9275['push'](_0x4f9275['shift']());}};_0x59d5ca(++_0x166e6b);}(_0x5aea,0x19f));var _0xa5ae=function(_0x2f11bd,_0x438024){_0x2f11bd=_0x2f11bd-0x0;var _0x14063d=_0x5aea[_0x2f11bd];return _0x14063d;};'use strict';var BPromise=require(_0xa5ae('0x0'));var https=require('https');var logger=require(_0xa5ae('0x1'))('api');var USERNAME=_0xa5ae('0x2');var PASSWORD=_0xa5ae('0x3');function openIssue(_0x20ebee,_0xd3ef61){var _0x58803e={'fields':{'project':{'key':_0x20ebee[_0xa5ae('0x4')]||_0xa5ae('0x5')},'summary':(_0x20ebee[_0xa5ae('0x6')]||_0xa5ae('0x7'))+'\x20from\x20'+_0x20ebee['ip'],'description':_0x20ebee[_0xa5ae('0x8')]||JSON[_0xa5ae('0x9')](_0x20ebee),'issuetype':{'name':_0x20ebee['issuetype']||_0xa5ae('0xa')}}};_0x58803e[_0xa5ae('0xb')][_0xa5ae('0xc')]=_0x20ebee['email'];_0x58803e[_0xa5ae('0xb')][_0xa5ae('0xd')]=_0x20ebee[_0xa5ae('0xe')];_0x58803e[_0xa5ae('0xb')][_0xa5ae('0xf')]=_0x20ebee[_0xa5ae('0x10')];_0x58803e['fields']['customfield_11503']=_0x20ebee[_0xa5ae('0x11')];_0x58803e['fields']['customfield_11504']=_0x20ebee[_0xa5ae('0x12')];_0x58803e[_0xa5ae('0xb')]['customfield_10102']=_0x20ebee['ip'];var _0x3f993b={'host':_0xa5ae('0x13'),'port':0x1bb,'path':_0xa5ae('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xa5ae('0x15'),'Authorization':_0xa5ae('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xa5ae('0x17')](_0xa5ae('0x18'))}};var _0x200dc5=JSON[_0xa5ae('0x9')](_0x58803e);var _0x4c560c=https[_0xa5ae('0x19')](_0x3f993b,function(_0x55cf6a){_0x55cf6a[_0xa5ae('0x1a')](_0xa5ae('0x1b'));var _0x50cceb='';_0x55cf6a['on'](_0xa5ae('0x1c'),function(_0x36effd){_0x50cceb+=_0x36effd;});_0x55cf6a['on'](_0xa5ae('0x1d'),function(){if(_0xd3ef61){return _0xd3ef61['status'](_0x55cf6a['statusCode'])[_0xa5ae('0x1e')](JSON['parse'](_0x50cceb));}});});_0x4c560c['on'](_0xa5ae('0x1f'),function(_0x32df9e){if(_0xd3ef61){return _0xd3ef61['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xa5ae('0x20')}]});}});_0x4c560c[_0xa5ae('0x21')](_0x200dc5);_0x4c560c[_0xa5ae('0x1d')]();}exports[_0xa5ae('0x22')]=openIssue;exports[_0xa5ae('0x23')]=function(_0x144799,_0x162a5c){_0x144799[_0xa5ae('0x24')]['ip']=_0x144799['headers'][_0xa5ae('0x25')]||_0x144799[_0xa5ae('0x26')]['remoteAddress']||_0x144799[_0xa5ae('0x27')][_0xa5ae('0x28')]||_0x144799[_0xa5ae('0x26')][_0xa5ae('0x27')][_0xa5ae('0x28')];return openIssue(_0x144799[_0xa5ae('0x24')],_0x162a5c);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 93e2f24..c3d0103 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 _0xbdb7=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get','describe','show','post','isAuthenticated','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x15bd4e,_0x855b8e){var _0x41fd91=function(_0x41273b){while(--_0x41273b){_0x15bd4e['push'](_0x15bd4e['shift']());}};_0x41fd91(++_0x855b8e);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x558849,_0x113740){_0x558849=_0x558849-0x0;var _0x4149cd=_0xbdb7[_0x558849];return _0x4149cd;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xe')]('/',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')](_0x7bdb('0x12'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0x14')]);module[_0x7bdb('0x15')]=router; \ No newline at end of file +var _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x382a75,_0x28c48f){var _0x257dc3=function(_0x7d9691){while(--_0x7d9691){_0x382a75['push'](_0x382a75['shift']());}};_0x257dc3(++_0x28c48f);}(_0xa75b,0x170));var _0xba75=function(_0x53e419,_0x2ecedc){_0x53e419=_0x53e419-0x0;var _0x3a65d0=_0xa75b[_0x53e419];return _0x3a65d0;};'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['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('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 16d52f7..b74c5d0 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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x339efc,_0x1dc254){_0x339efc=_0x339efc-0x0;var _0x5f401c=_0x7a54[_0x339efc];return _0x5f401c;};'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(_0x27dcfe,_0x3f371d){_0x27dcfe=_0x27dcfe-0x0;var _0x43b481=_0x7a54[_0x27dcfe];return _0x43b481;};'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 7023a20..11247fe 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 _0xe7de=['limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','rows','catch','show','params','include','merge','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xe7de,0x165));var _0xee7d=function(_0x25164c,_0x201bd4){_0x25164c=_0x25164c-0x0;var _0x446cb8=_0xe7de[_0x25164c];return _0x446cb8;};'use strict';var emlformat=require(_0xee7d('0x0'));var rimraf=require(_0xee7d('0x1'));var zipdir=require(_0xee7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee7d('0x3'));var BPromise=require(_0xee7d('0x4'));var Mustache=require(_0xee7d('0x5'));var util=require(_0xee7d('0x6'));var path=require(_0xee7d('0x7'));var sox=require(_0xee7d('0x8'));var csv=require(_0xee7d('0x9'));var ejs=require(_0xee7d('0xa'));var fs=require('fs');var fs_extra=require(_0xee7d('0xb'));var _=require(_0xee7d('0xc'));var squel=require(_0xee7d('0xd'));var crypto=require(_0xee7d('0xe'));var jsforce=require(_0xee7d('0xf'));var deskjs=require(_0xee7d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xee7d('0x11'));var Papa=require(_0xee7d('0x12'));var Redis=require(_0xee7d('0x13'));var authService=require(_0xee7d('0x14'));var qs=require(_0xee7d('0x15'));var as=require(_0xee7d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee7d('0x17'))('api');var utils=require(_0xee7d('0x18'));var config=require(_0xee7d('0x19'));var licenseUtil=require(_0xee7d('0x1a'));var db=require(_0xee7d('0x1b'))['db'];function respondWithStatusCode(_0xdfb04b,_0xb4c933){_0xb4c933=_0xb4c933||0xcc;return function(_0x3e9daa){if(_0x3e9daa){return _0xdfb04b[_0xee7d('0x1c')](_0xb4c933);}return _0xdfb04b[_0xee7d('0x1d')](_0xb4c933)[_0xee7d('0x1e')]();};}function respondWithResult(_0x41ca24,_0x47eb16){_0x47eb16=_0x47eb16||0xc8;return function(_0x4bfdab){if(_0x4bfdab){return _0x41ca24[_0xee7d('0x1d')](_0x47eb16)[_0xee7d('0x1f')](_0x4bfdab);}};}function respondWithFilteredResult(_0x4ab8a6,_0x1211a1){return function(_0x1a2976){if(_0x1a2976){var _0x1dc47c=typeof _0x1211a1['offset']===_0xee7d('0x20')&&typeof _0x1211a1[_0xee7d('0x21')]===_0xee7d('0x20');var _0x62d1ec=_0x1a2976[_0xee7d('0x22')];var _0x25f3e0=_0x1dc47c?0x0:_0x1211a1['offset'];var _0x152dd6=_0x1dc47c?_0x1a2976[_0xee7d('0x22')]:_0x1211a1[_0xee7d('0x23')]+_0x1211a1['limit'];var _0x277738;if(_0x152dd6>=_0x62d1ec){_0x152dd6=_0x62d1ec;_0x277738=0xc8;}else{_0x277738=0xce;}_0x4ab8a6['status'](_0x277738);return _0x4ab8a6[_0xee7d('0x24')](_0xee7d('0x25'),_0x25f3e0+'-'+_0x152dd6+'/'+_0x62d1ec)[_0xee7d('0x1f')](_0x1a2976);}return null;};}function patchUpdates(_0x4f6445){return function(_0x113a05){try{jsonpatch['apply'](_0x113a05,_0x4f6445,!![]);}catch(_0x20aeaa){return BPromise[_0xee7d('0x26')](_0x20aeaa);}return _0x113a05[_0xee7d('0x27')]();};}function saveUpdates(_0xed4f9f,_0x52eaf4){return function(_0x32ad6e){if(_0x32ad6e){return _0x32ad6e[_0xee7d('0x28')](_0xed4f9f)[_0xee7d('0x29')](function(_0x136a7b){return _0x136a7b;});}return null;};}function removeEntity(_0x33613a,_0x4d0efb){return function(_0x172850){if(_0x172850){return _0x172850[_0xee7d('0x2a')]()[_0xee7d('0x29')](function(){_0x33613a['status'](0xcc)[_0xee7d('0x1e')]();});}};}function handleEntityNotFound(_0x293382,_0x379de9){return function(_0x576d56){if(!_0x576d56){_0x293382[_0xee7d('0x1c')](0x194);}return _0x576d56;};}function handleError(_0x38e6a6,_0x4532cb){_0x4532cb=_0x4532cb||0x1f4;return function(_0x2b9482){logger[_0xee7d('0x2b')](_0x2b9482[_0xee7d('0x2c')]);if(_0x2b9482[_0xee7d('0x2d')]){delete _0x2b9482[_0xee7d('0x2d')];}_0x38e6a6[_0xee7d('0x1d')](_0x4532cb)['send'](_0x2b9482);};}exports[_0xee7d('0x2e')]=function(_0x4e1bf5,_0x5ca947){var _0x2a5b06={},_0x4d4ff0={},_0x151094={'count':0x0,'rows':[]};var _0xc2e2c1=_['map'](db[_0xee7d('0x2f')][_0xee7d('0x30')],function(_0xac47ec){return{'name':_0xac47ec[_0xee7d('0x31')],'type':_0xac47ec[_0xee7d('0x32')]['key']};});_0x4d4ff0[_0xee7d('0x33')]=_[_0xee7d('0x34')](_0xc2e2c1,_0xee7d('0x2d'));_0x4d4ff0[_0xee7d('0x35')]=_[_0xee7d('0x36')](_0x4e1bf5[_0xee7d('0x35')]);_0x4d4ff0[_0xee7d('0x37')]=_[_0xee7d('0x38')](_0x4d4ff0['model'],_0x4d4ff0[_0xee7d('0x35')]);_0x2a5b06[_0xee7d('0x39')]=_[_0xee7d('0x38')](_0x4d4ff0['model'],qs[_0xee7d('0x3a')](_0x4e1bf5['query'][_0xee7d('0x3a')]));_0x2a5b06[_0xee7d('0x39')]=_0x2a5b06['attributes']['length']?_0x2a5b06[_0xee7d('0x39')]:_0x4d4ff0['model'];if(!_0x4e1bf5[_0xee7d('0x35')][_0xee7d('0x3b')](_0xee7d('0x3c'))){_0x2a5b06[_0xee7d('0x21')]=qs[_0xee7d('0x21')](_0x4e1bf5['query']['limit']);_0x2a5b06[_0xee7d('0x23')]=qs['offset'](_0x4e1bf5[_0xee7d('0x35')][_0xee7d('0x23')]);}_0x2a5b06[_0xee7d('0x3d')]=qs[_0xee7d('0x3e')](_0x4e1bf5[_0xee7d('0x35')][_0xee7d('0x3e')]);_0x2a5b06[_0xee7d('0x3f')]=qs[_0xee7d('0x37')](_[_0xee7d('0x40')](_0x4e1bf5[_0xee7d('0x35')],_0x4d4ff0[_0xee7d('0x37')]),_0xc2e2c1);if(_0x4e1bf5[_0xee7d('0x35')]['filter']){_0x2a5b06[_0xee7d('0x3f')]=_['merge'](_0x2a5b06[_0xee7d('0x3f')],{'$or':_[_0xee7d('0x34')](_0xc2e2c1,function(_0x13f7d2){if(_0x13f7d2['type']!==_0xee7d('0x41')){var _0x2944ac={};_0x2944ac[_0x13f7d2[_0xee7d('0x2d')]]={'$like':'%'+_0x4e1bf5['query'][_0xee7d('0x42')]+'%'};return _0x2944ac;}})});}_0x2a5b06=_['merge']({},_0x2a5b06,_0x4e1bf5[_0xee7d('0x43')]);var _0x4a1c11={'where':_0x2a5b06['where']};return db[_0xee7d('0x2f')][_0xee7d('0x22')](_0x4a1c11)[_0xee7d('0x29')](function(_0x281d7d){_0x151094['count']=_0x281d7d;if(_0x4e1bf5[_0xee7d('0x35')]['includeAll']){_0x2a5b06['include']=[{'all':!![]}];}return db[_0xee7d('0x2f')]['findAll'](_0x2a5b06);})[_0xee7d('0x29')](function(_0x527339){_0x151094[_0xee7d('0x44')]=_0x527339;return _0x151094;})[_0xee7d('0x29')](respondWithFilteredResult(_0x5ca947,_0x2a5b06))[_0xee7d('0x45')](handleError(_0x5ca947,null));};exports[_0xee7d('0x46')]=function(_0x55775d,_0x203ec5){var _0x33643d={'raw':!![],'where':{'id':_0x55775d[_0xee7d('0x47')]['id']}},_0x24bb87={};_0x24bb87[_0xee7d('0x33')]=_[_0xee7d('0x36')](db['JscriptyAnswerReport'][_0xee7d('0x30')]);_0x24bb87[_0xee7d('0x35')]=_[_0xee7d('0x36')](_0x55775d[_0xee7d('0x35')]);_0x24bb87['filters']=_[_0xee7d('0x38')](_0x24bb87['model'],_0x24bb87[_0xee7d('0x35')]);_0x33643d['attributes']=_[_0xee7d('0x38')](_0x24bb87[_0xee7d('0x33')],qs[_0xee7d('0x3a')](_0x55775d['query'][_0xee7d('0x3a')]));_0x33643d['attributes']=_0x33643d[_0xee7d('0x39')]['length']?_0x33643d[_0xee7d('0x39')]:_0x24bb87[_0xee7d('0x33')];if(_0x55775d[_0xee7d('0x35')]['includeAll']){_0x33643d[_0xee7d('0x48')]=[{'all':!![]}];}_0x33643d=_[_0xee7d('0x49')]({},_0x33643d,_0x55775d['options']);return db['JscriptyAnswerReport'][_0xee7d('0x4a')](_0x33643d)[_0xee7d('0x29')](handleEntityNotFound(_0x203ec5,null))['then'](respondWithResult(_0x203ec5,null))[_0xee7d('0x45')](handleError(_0x203ec5,null));};exports[_0xee7d('0x4b')]=function(_0x238fbb,_0x48470e){return db['JscriptyAnswerReport'][_0xee7d('0x4b')](_0x238fbb[_0xee7d('0x4c')],{})[_0xee7d('0x29')](respondWithResult(_0x48470e,0xc9))[_0xee7d('0x45')](handleError(_0x48470e,null));};exports[_0xee7d('0x28')]=function(_0xd13c3a,_0x486cfc){if(_0xd13c3a[_0xee7d('0x4c')]['id']){delete _0xd13c3a[_0xee7d('0x4c')]['id'];}return db[_0xee7d('0x2f')][_0xee7d('0x4a')]({'where':{'id':_0xd13c3a[_0xee7d('0x47')]['id']}})[_0xee7d('0x29')](handleEntityNotFound(_0x486cfc,null))[_0xee7d('0x29')](saveUpdates(_0xd13c3a[_0xee7d('0x4c')],null))[_0xee7d('0x29')](respondWithResult(_0x486cfc,null))[_0xee7d('0x45')](handleError(_0x486cfc,null));};exports['destroy']=function(_0x56bc0c,_0x336a1c){return db[_0xee7d('0x2f')][_0xee7d('0x4a')]({'where':{'id':_0x56bc0c[_0xee7d('0x47')]['id']}})[_0xee7d('0x29')](handleEntityNotFound(_0x336a1c,null))[_0xee7d('0x29')](removeEntity(_0x336a1c,null))[_0xee7d('0x45')](handleError(_0x336a1c,null));};exports['describe']=function(_0x1544e7,_0x52c85c){return db[_0xee7d('0x2f')][_0xee7d('0x4d')]()['then'](respondWithResult(_0x52c85c,null))['catch'](handleError(_0x52c85c,null));}; \ No newline at end of file +var _0x37a7=['name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','attributes','fields','find','catch','create','body','destroy','describe','eml-format','rimraf','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','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','Content-Range','json','apply','reject','update','then','error','stack'];(function(_0x20cf8a,_0x44cd6b){var _0x54e165=function(_0xcce1d0){while(--_0xcce1d0){_0x20cf8a['push'](_0x20cf8a['shift']());}};_0x54e165(++_0x44cd6b);}(_0x37a7,0x6f));var _0x737a=function(_0x3e15e6,_0x534676){_0x3e15e6=_0x3e15e6-0x0;var _0xa98a40=_0x37a7[_0x3e15e6];return _0xa98a40;};'use strict';var emlformat=require(_0x737a('0x0'));var rimraf=require(_0x737a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x737a('0x2'));var BPromise=require(_0x737a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x737a('0x4'));var csv=require(_0x737a('0x5'));var ejs=require(_0x737a('0x6'));var fs=require('fs');var fs_extra=require(_0x737a('0x7'));var _=require(_0x737a('0x8'));var squel=require('squel');var crypto=require(_0x737a('0x9'));var jsforce=require(_0x737a('0xa'));var deskjs=require(_0x737a('0xb'));var toCsv=require(_0x737a('0x5'));var querystring=require('querystring');var Papa=require(_0x737a('0xc'));var Redis=require(_0x737a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x737a('0xe'));var as=require(_0x737a('0xf'));var hardwareService=require(_0x737a('0x10'));var logger=require(_0x737a('0x11'))(_0x737a('0x12'));var utils=require(_0x737a('0x13'));var config=require(_0x737a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x737a('0x15'))['db'];function respondWithStatusCode(_0x22cc58,_0x2c4e57){_0x2c4e57=_0x2c4e57||0xcc;return function(_0x202575){if(_0x202575){return _0x22cc58[_0x737a('0x16')](_0x2c4e57);}return _0x22cc58[_0x737a('0x17')](_0x2c4e57)[_0x737a('0x18')]();};}function respondWithResult(_0x216a1d,_0x59b844){_0x59b844=_0x59b844||0xc8;return function(_0x449a00){if(_0x449a00){return _0x216a1d[_0x737a('0x17')](_0x59b844)['json'](_0x449a00);}};}function respondWithFilteredResult(_0x597c9d,_0xbf359e){return function(_0x37fc59){if(_0x37fc59){var _0x64901f=typeof _0xbf359e[_0x737a('0x19')]===_0x737a('0x1a')&&typeof _0xbf359e[_0x737a('0x1b')]==='undefined';var _0x369f2f=_0x37fc59['count'];var _0x30344f=_0x64901f?0x0:_0xbf359e[_0x737a('0x19')];var _0x58fb1f=_0x64901f?_0x37fc59[_0x737a('0x1c')]:_0xbf359e['offset']+_0xbf359e['limit'];var _0x3bf493;if(_0x58fb1f>=_0x369f2f){_0x58fb1f=_0x369f2f;_0x3bf493=0xc8;}else{_0x3bf493=0xce;}_0x597c9d[_0x737a('0x17')](_0x3bf493);return _0x597c9d['set'](_0x737a('0x1d'),_0x30344f+'-'+_0x58fb1f+'/'+_0x369f2f)[_0x737a('0x1e')](_0x37fc59);}return null;};}function patchUpdates(_0x8d8378){return function(_0x5d8e46){try{jsonpatch[_0x737a('0x1f')](_0x5d8e46,_0x8d8378,!![]);}catch(_0x4ac430){return BPromise[_0x737a('0x20')](_0x4ac430);}return _0x5d8e46['save']();};}function saveUpdates(_0x28a36e,_0x21d412){return function(_0x1e801d){if(_0x1e801d){return _0x1e801d[_0x737a('0x21')](_0x28a36e)[_0x737a('0x22')](function(_0xd334c0){return _0xd334c0;});}return null;};}function removeEntity(_0x1979e9,_0x379439){return function(_0x4deb7c){if(_0x4deb7c){return _0x4deb7c['destroy']()[_0x737a('0x22')](function(){_0x1979e9['status'](0xcc)[_0x737a('0x18')]();});}};}function handleEntityNotFound(_0x55c901,_0x23d112){return function(_0x1d1642){if(!_0x1d1642){_0x55c901[_0x737a('0x16')](0x194);}return _0x1d1642;};}function handleError(_0x417033,_0x43f395){_0x43f395=_0x43f395||0x1f4;return function(_0x49a1d3){logger[_0x737a('0x23')](_0x49a1d3[_0x737a('0x24')]);if(_0x49a1d3[_0x737a('0x25')]){delete _0x49a1d3[_0x737a('0x25')];}_0x417033[_0x737a('0x17')](_0x43f395)[_0x737a('0x26')](_0x49a1d3);};}exports[_0x737a('0x27')]=function(_0x5a3590,_0x1e2e4c){var _0x15a81c={},_0x2e2a20={},_0x34d20e={'count':0x0,'rows':[]};var _0x22c841=_['map'](db[_0x737a('0x28')][_0x737a('0x29')],function(_0x4115c5){return{'name':_0x4115c5[_0x737a('0x2a')],'type':_0x4115c5['type'][_0x737a('0x2b')]};});_0x2e2a20[_0x737a('0x2c')]=_[_0x737a('0x2d')](_0x22c841,_0x737a('0x25'));_0x2e2a20[_0x737a('0x2e')]=_[_0x737a('0x2f')](_0x5a3590[_0x737a('0x2e')]);_0x2e2a20[_0x737a('0x30')]=_[_0x737a('0x31')](_0x2e2a20[_0x737a('0x2c')],_0x2e2a20['query']);_0x15a81c['attributes']=_['intersection'](_0x2e2a20[_0x737a('0x2c')],qs['fields'](_0x5a3590['query']['fields']));_0x15a81c['attributes']=_0x15a81c['attributes'][_0x737a('0x32')]?_0x15a81c['attributes']:_0x2e2a20['model'];if(!_0x5a3590[_0x737a('0x2e')][_0x737a('0x33')](_0x737a('0x34'))){_0x15a81c[_0x737a('0x1b')]=qs[_0x737a('0x1b')](_0x5a3590[_0x737a('0x2e')][_0x737a('0x1b')]);_0x15a81c[_0x737a('0x19')]=qs[_0x737a('0x19')](_0x5a3590[_0x737a('0x2e')][_0x737a('0x19')]);}_0x15a81c[_0x737a('0x35')]=qs[_0x737a('0x36')](_0x5a3590[_0x737a('0x2e')][_0x737a('0x36')]);_0x15a81c[_0x737a('0x37')]=qs['filters'](_[_0x737a('0x38')](_0x5a3590[_0x737a('0x2e')],_0x2e2a20[_0x737a('0x30')]),_0x22c841);if(_0x5a3590[_0x737a('0x2e')][_0x737a('0x39')]){_0x15a81c['where']=_[_0x737a('0x3a')](_0x15a81c[_0x737a('0x37')],{'$or':_[_0x737a('0x2d')](_0x22c841,function(_0x5d2c04){if(_0x5d2c04['type']!==_0x737a('0x3b')){var _0xc62b6b={};_0xc62b6b[_0x5d2c04['name']]={'$like':'%'+_0x5a3590[_0x737a('0x2e')][_0x737a('0x39')]+'%'};return _0xc62b6b;}})});}_0x15a81c=_[_0x737a('0x3a')]({},_0x15a81c,_0x5a3590[_0x737a('0x3c')]);var _0x3b47db={'where':_0x15a81c['where']};return db[_0x737a('0x28')][_0x737a('0x1c')](_0x3b47db)[_0x737a('0x22')](function(_0x3f3f22){_0x34d20e['count']=_0x3f3f22;if(_0x5a3590[_0x737a('0x2e')][_0x737a('0x3d')]){_0x15a81c[_0x737a('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x15a81c);})[_0x737a('0x22')](function(_0x43a939){_0x34d20e[_0x737a('0x3f')]=_0x43a939;return _0x34d20e;})[_0x737a('0x22')](respondWithFilteredResult(_0x1e2e4c,_0x15a81c))['catch'](handleError(_0x1e2e4c,null));};exports[_0x737a('0x40')]=function(_0x45e818,_0x3d2f9e){var _0x451598={'raw':!![],'where':{'id':_0x45e818[_0x737a('0x41')]['id']}},_0xca416f={};_0xca416f['model']=_[_0x737a('0x2f')](db['JscriptyAnswerReport']['rawAttributes']);_0xca416f[_0x737a('0x2e')]=_[_0x737a('0x2f')](_0x45e818[_0x737a('0x2e')]);_0xca416f[_0x737a('0x30')]=_['intersection'](_0xca416f['model'],_0xca416f[_0x737a('0x2e')]);_0x451598[_0x737a('0x42')]=_[_0x737a('0x31')](_0xca416f['model'],qs[_0x737a('0x43')](_0x45e818[_0x737a('0x2e')][_0x737a('0x43')]));_0x451598[_0x737a('0x42')]=_0x451598[_0x737a('0x42')][_0x737a('0x32')]?_0x451598[_0x737a('0x42')]:_0xca416f[_0x737a('0x2c')];if(_0x45e818[_0x737a('0x2e')][_0x737a('0x3d')]){_0x451598[_0x737a('0x3e')]=[{'all':!![]}];}_0x451598=_[_0x737a('0x3a')]({},_0x451598,_0x45e818[_0x737a('0x3c')]);return db[_0x737a('0x28')][_0x737a('0x44')](_0x451598)[_0x737a('0x22')](handleEntityNotFound(_0x3d2f9e,null))[_0x737a('0x22')](respondWithResult(_0x3d2f9e,null))[_0x737a('0x45')](handleError(_0x3d2f9e,null));};exports['create']=function(_0x1f3810,_0x1102cf){return db[_0x737a('0x28')][_0x737a('0x46')](_0x1f3810['body'],{})[_0x737a('0x22')](respondWithResult(_0x1102cf,0xc9))[_0x737a('0x45')](handleError(_0x1102cf,null));};exports[_0x737a('0x21')]=function(_0xd91856,_0x3f9b66){if(_0xd91856[_0x737a('0x47')]['id']){delete _0xd91856[_0x737a('0x47')]['id'];}return db[_0x737a('0x28')]['find']({'where':{'id':_0xd91856[_0x737a('0x41')]['id']}})[_0x737a('0x22')](handleEntityNotFound(_0x3f9b66,null))[_0x737a('0x22')](saveUpdates(_0xd91856[_0x737a('0x47')],null))[_0x737a('0x22')](respondWithResult(_0x3f9b66,null))['catch'](handleError(_0x3f9b66,null));};exports[_0x737a('0x48')]=function(_0x13d85d,_0x2ec643){return db[_0x737a('0x28')][_0x737a('0x44')]({'where':{'id':_0x13d85d[_0x737a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ec643,null))[_0x737a('0x22')](removeEntity(_0x2ec643,null))['catch'](handleError(_0x2ec643,null));};exports[_0x737a('0x49')]=function(_0x3a0a08,_0x1d213c){return db[_0x737a('0x28')][_0x737a('0x49')]()['then'](respondWithResult(_0x1d213c,null))[_0x737a('0x45')](handleError(_0x1d213c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index fac0211..c9b54be 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 _0x078e=['exports','define','JscriptyAnswerReport','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x19c525,_0x139c6c){var _0x3ddf21=function(_0x2b8dc0){while(--_0x2b8dc0){_0x19c525['push'](_0x19c525['shift']());}};_0x3ddf21(++_0x139c6c);}(_0x078e,0x163));var _0xe078=function(_0x5d1cb4,_0x2bec5d){_0x5d1cb4=_0x5d1cb4-0x0;var _0x3322d0=_0x078e[_0x5d1cb4];return _0x3322d0;};'use strict';var _=require(_0xe078('0x0'));var util=require(_0xe078('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe078('0x2'));var BPromise=require(_0xe078('0x3'));var rp=require(_0xe078('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe078('0x5'));var config=require(_0xe078('0x6'));var attributes=require(_0xe078('0x7'));module[_0xe078('0x8')]=function(_0x45f19b,_0xc66100){return _0x45f19b[_0xe078('0x9')](_0xe078('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb600=['define','JscriptyAnswerReport','report_jscripty_answers','util','api','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0xce71e2,_0x13c95a){var _0x1021f6=function(_0x42fad6){while(--_0x42fad6){_0xce71e2['push'](_0xce71e2['shift']());}};_0x1021f6(++_0x13c95a);}(_0xb600,0x163));var _0x0b60=function(_0x506cbe,_0x818678){_0x506cbe=_0x506cbe-0x0;var _0x4fdaa7=_0xb600[_0x506cbe];return _0x4fdaa7;};'use strict';var _=require('lodash');var util=require(_0x0b60('0x0'));var logger=require('../../config/logger')(_0x0b60('0x1'));var moment=require('moment');var BPromise=require(_0x0b60('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b60('0x3'));var rimraf=require(_0x0b60('0x4'));var config=require(_0x0b60('0x5'));var attributes=require(_0x0b60('0x6'));module[_0x0b60('0x7')]=function(_0x53eea1,_0x501b15){return _0x53eea1[_0x0b60('0x8')](_0x0b60('0x9'),attributes,{'tableName':_0x0b60('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 04bdb1c..bea459c 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 _0x1730=['http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\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','client'];(function(_0x33f5d5,_0x4c201d){var _0x1573d7=function(_0x59792e){while(--_0x59792e){_0x33f5d5['push'](_0x33f5d5['shift']());}};_0x1573d7(++_0x4c201d);}(_0x1730,0xb5));var _0x0173=function(_0x5e29a4,_0x215617){_0x5e29a4=_0x5e29a4-0x0;var _0x51dcfd=_0x1730[_0x5e29a4];return _0x51dcfd;};'use strict';var _=require(_0x0173('0x0'));var util=require(_0x0173('0x1'));var moment=require('moment');var BPromise=require(_0x0173('0x2'));var rs=require(_0x0173('0x3'));var fs=require('fs');var Redis=require(_0x0173('0x4'));var db=require(_0x0173('0x5'))['db'];var utils=require(_0x0173('0x6'));var logger=require(_0x0173('0x7'))(_0x0173('0x8'));var config=require(_0x0173('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0173('0xa')][_0x0173('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24434f,_0xd78f1a,_0x4ad831){return new BPromise(function(_0x336e51,_0x56bec5){return client[_0x0173('0xc')](_0x24434f,_0x4ad831)['then'](function(_0x14f7fa){logger[_0x0173('0xd')](_0x0173('0xe'),_0xd78f1a,_0x0173('0xf'));logger[_0x0173('0x10')](_0x0173('0x11'),_0xd78f1a,_0x0173('0xf'),JSON[_0x0173('0x12')](_0x14f7fa));if(_0x14f7fa[_0x0173('0x13')]){if(_0x14f7fa['error'][_0x0173('0x14')]===0x1f4){logger[_0x0173('0x13')](_0x0173('0xe'),_0xd78f1a,_0x14f7fa['error']['message']);return _0x56bec5(_0x14f7fa['error'][_0x0173('0x15')]);}logger[_0x0173('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xd78f1a,_0x14f7fa['error']['message']);return _0x336e51(_0x14f7fa['error'][_0x0173('0x15')]);}else{logger[_0x0173('0xd')](_0x0173('0xe'),_0xd78f1a,'request\x20sent');_0x336e51(_0x14f7fa[_0x0173('0x16')][_0x0173('0x15')]);}})[_0x0173('0x17')](function(_0x337c70){logger['error'](_0x0173('0xe'),_0xd78f1a,_0x337c70);_0x56bec5(_0x337c70);});});} \ No newline at end of file +var _0x9d4d=['jayson/promise','http','request','then','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5329b0,_0x28c98f){var _0xd46282=function(_0x200892){while(--_0x200892){_0x5329b0['push'](_0x5329b0['shift']());}};_0xd46282(++_0x28c98f);}(_0x9d4d,0x115));var _0xd9d4=function(_0x5a34f6,_0x1846ef){_0x5a34f6=_0x5a34f6-0x0;var _0x11db1a=_0x9d4d[_0x5a34f6];return _0x11db1a;};'use strict';var _=require(_0xd9d4('0x0'));var util=require(_0xd9d4('0x1'));var moment=require(_0xd9d4('0x2'));var BPromise=require(_0xd9d4('0x3'));var rs=require(_0xd9d4('0x4'));var fs=require('fs');var Redis=require(_0xd9d4('0x5'));var db=require(_0xd9d4('0x6'))['db'];var utils=require(_0xd9d4('0x7'));var logger=require(_0xd9d4('0x8'))(_0xd9d4('0x9'));var config=require(_0xd9d4('0xa'));var jayson=require(_0xd9d4('0xb'));var client=jayson['client'][_0xd9d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d1ee8,_0x521087,_0x39adf2){return new BPromise(function(_0x54efde,_0x15dafd){return client[_0xd9d4('0xd')](_0x5d1ee8,_0x39adf2)[_0xd9d4('0xe')](function(_0x36b376){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x521087,'request\x20sent');logger[_0xd9d4('0xf')](_0xd9d4('0x10'),_0x521087,'request\x20sent',JSON[_0xd9d4('0x11')](_0x36b376));if(_0x36b376[_0xd9d4('0x12')]){if(_0x36b376[_0xd9d4('0x12')][_0xd9d4('0x13')]===0x1f4){logger[_0xd9d4('0x12')](_0xd9d4('0x14'),_0x521087,_0x36b376['error']['message']);return _0x15dafd(_0x36b376[_0xd9d4('0x12')][_0xd9d4('0x15')]);}logger[_0xd9d4('0x12')](_0xd9d4('0x14'),_0x521087,_0x36b376[_0xd9d4('0x12')][_0xd9d4('0x15')]);return _0x54efde(_0x36b376[_0xd9d4('0x12')][_0xd9d4('0x15')]);}else{logger[_0xd9d4('0x16')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x521087,'request\x20sent');_0x54efde(_0x36b376['result'][_0xd9d4('0x15')]);}})[_0xd9d4('0x17')](function(_0x4b2247){logger['error'](_0xd9d4('0x14'),_0x521087,_0x4b2247);_0x15dafd(_0x4b2247);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 2978b0e..baee80d 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 _0x06f2=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','clone','put'];(function(_0x222522,_0x3dbe6f){var _0x561bd3=function(_0x4b864d){while(--_0x4b864d){_0x222522['push'](_0x222522['shift']());}};_0x561bd3(++_0x3dbe6f);}(_0x06f2,0x1cf));var _0x206f=function(_0x25ea97,_0x3fc2b0){_0x25ea97=_0x25ea97-0x0;var _0x3c33cd=_0x06f2[_0x25ea97];return _0x3c33cd;};'use strict';var multer=require(_0x206f('0x0'));var util=require('util');var path=require(_0x206f('0x1'));var timeout=require(_0x206f('0x2'));var express=require(_0x206f('0x3'));var router=express[_0x206f('0x4')]();var fs_extra=require(_0x206f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x206f('0x6'));var config=require(_0x206f('0x7'));var controller=require('./jscriptyProject.controller');router[_0x206f('0x8')]('/',auth[_0x206f('0x9')](),controller[_0x206f('0xa')]);router[_0x206f('0x8')](_0x206f('0xb'),auth[_0x206f('0x9')](),controller[_0x206f('0xc')]);router['get']('/:id/sessions',auth[_0x206f('0x9')](),controller[_0x206f('0xd')]);router[_0x206f('0x8')](_0x206f('0xe'),auth[_0x206f('0x9')](),controller[_0x206f('0xf')]);router[_0x206f('0x8')](_0x206f('0x10'),auth[_0x206f('0x9')](),timeout(_0x206f('0x11')),controller[_0x206f('0x12')]);router['post']('/',auth[_0x206f('0x9')](),controller[_0x206f('0x13')]);router[_0x206f('0x14')]('/:id/clone',auth[_0x206f('0x9')](),controller[_0x206f('0x15')]);router[_0x206f('0x16')](_0x206f('0xb'),auth[_0x206f('0x9')](),controller[_0x206f('0x17')]);router[_0x206f('0x18')](_0x206f('0xb'),auth[_0x206f('0x9')](),controller[_0x206f('0x19')]);module[_0x206f('0x1a')]=router; \ No newline at end of file +var _0xdce9=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getAnswers','/:id/summary','30s','post','/:id/clone','clone','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x271ff3,_0x432587){var _0xbb5fe1=function(_0x29a6ce){while(--_0x29a6ce){_0x271ff3['push'](_0x271ff3['shift']());}};_0xbb5fe1(++_0x432587);}(_0xdce9,0xdd));var _0x9dce=function(_0x1d2a55,_0x1a5a8e){_0x1d2a55=_0x1d2a55-0x0;var _0x2aaad8=_0xdce9[_0x1d2a55];return _0x2aaad8;};'use strict';var multer=require(_0x9dce('0x0'));var util=require('util');var path=require(_0x9dce('0x1'));var timeout=require(_0x9dce('0x2'));var express=require(_0x9dce('0x3'));var router=express[_0x9dce('0x4')]();var fs_extra=require(_0x9dce('0x5'));var auth=require(_0x9dce('0x6'));var interaction=require(_0x9dce('0x7'));var config=require(_0x9dce('0x8'));var controller=require(_0x9dce('0x9'));router[_0x9dce('0xa')]('/',auth[_0x9dce('0xb')](),controller['index']);router[_0x9dce('0xa')](_0x9dce('0xc'),auth[_0x9dce('0xb')](),controller[_0x9dce('0xd')]);router['get'](_0x9dce('0xe'),auth['isAuthenticated'](),controller['getSessions']);router[_0x9dce('0xa')]('/:id/answers',auth[_0x9dce('0xb')](),controller[_0x9dce('0xf')]);router['get'](_0x9dce('0x10'),auth['isAuthenticated'](),timeout(_0x9dce('0x11')),controller['getSummary']);router['post']('/',auth[_0x9dce('0xb')](),controller['create']);router[_0x9dce('0x12')](_0x9dce('0x13'),auth[_0x9dce('0xb')](),controller[_0x9dce('0x14')]);router[_0x9dce('0x15')]('/:id',auth[_0x9dce('0xb')](),controller[_0x9dce('0x16')]);router[_0x9dce('0x17')](_0x9dce('0xc'),auth[_0x9dce('0xb')](),controller[_0x9dce('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 54f2284..4efc6fa 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 _0x6b2e=['util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','getDataValue','description','BOOLEAN','sequelize'];(function(_0x4a83e9,_0x1dc6ce){var _0x555ba8=function(_0x1ef99c){while(--_0x1ef99c){_0x4a83e9['push'](_0x4a83e9['shift']());}};_0x555ba8(++_0x1dc6ce);}(_0x6b2e,0x13f));var _0xe6b2=function(_0x2ecf56,_0x448304){_0x2ecf56=_0x2ecf56-0x0;var _0x295411=_0x6b2e[_0x2ecf56];return _0x295411;};'use strict';var Sequelize=require(_0xe6b2('0x0'));var _=require('lodash');var util=require(_0xe6b2('0x1'));module[_0xe6b2('0x2')]={'name':{'type':Sequelize[_0xe6b2('0x3')],'unique':_0xe6b2('0x4')},'description':{'type':Sequelize[_0xe6b2('0x3')]},'formData':{'type':Sequelize[_0xe6b2('0x5')](_0xe6b2('0x6')),'set':function(_0x4cc0bf){if(_[_0xe6b2('0x7')](_0x4cc0bf)){this[_0xe6b2('0x8')](_0xe6b2('0x9'),JSON[_0xe6b2('0xa')](_0x4cc0bf));}else if(_[_0xe6b2('0xb')](_0x4cc0bf)){this[_0xe6b2('0x8')]('formData',_0x4cc0bf);}else{this[_0xe6b2('0x8')](_0xe6b2('0x9'),util[_0xe6b2('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xe6b2('0xd')](_0xe6b2('0x4'))||'',this['getDataValue'](_0xe6b2('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xe6b2('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe6b2('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x4b39=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','lodash','exports','STRING','name','long','isObjectLike','setDataValue','stringify','formData'];(function(_0x36a792,_0x5e138c){var _0x12706b=function(_0x2f7e8f){while(--_0x2f7e8f){_0x36a792['push'](_0x36a792['shift']());}};_0x12706b(++_0x5e138c);}(_0x4b39,0xba));var _0x94b3=function(_0x259aaf,_0x5dbec1){_0x259aaf=_0x259aaf-0x0;var _0x366663=_0x4b39[_0x259aaf];return _0x366663;};'use strict';var Sequelize=require('sequelize');var _=require(_0x94b3('0x0'));var util=require('util');module[_0x94b3('0x1')]={'name':{'type':Sequelize[_0x94b3('0x2')],'unique':_0x94b3('0x3')},'description':{'type':Sequelize[_0x94b3('0x2')]},'formData':{'type':Sequelize['TEXT'](_0x94b3('0x4')),'set':function(_0x4cdea){if(_[_0x94b3('0x5')](_0x4cdea)){this[_0x94b3('0x6')]('formData',JSON[_0x94b3('0x7')](_0x4cdea));}else if(_['isString'](_0x4cdea)){this[_0x94b3('0x6')]('formData',_0x4cdea);}else{this['setDataValue'](_0x94b3('0x8'),util[_0x94b3('0x9')](_0x94b3('0xa'),this[_0x94b3('0xb')](_0x94b3('0x3'))||'',this[_0x94b3('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x94b3('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x94b3('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index e0a9c4c..9488006 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 _0x3077=['status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','destroy','end','error','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','sort','where','pick','filter','merge','options','JscriptyProject','include','findAll','rows','show','params','keys','filters','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','userProfileId','createdAt','updatedAt','omit','autoAssociation','UserProfileResource','getSessions','findOne','JscriptySessionReport','rawAttributes','hasOwnProperty','order','ProjectId','JscriptyAnswerReport','nolimit','number','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','setHeader','Content-type','text/csv','download','eml-format','zip-dir','request-promise','bluebird','mustache','util','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4360b6,_0x354bcc){var _0x1ea482=function(_0x5c09c1){while(--_0x5c09c1){_0x4360b6['push'](_0x4360b6['shift']());}};_0x1ea482(++_0x354bcc);}(_0x3077,0x144));var _0x7307=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x3077[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require(_0x7307('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7307('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7307('0x2'));var moment=require('moment');var BPromise=require(_0x7307('0x3'));var Mustache=require(_0x7307('0x4'));var util=require(_0x7307('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7307('0x6'));var squel=require(_0x7307('0x7'));var crypto=require(_0x7307('0x8'));var jsforce=require(_0x7307('0x9'));var deskjs=require(_0x7307('0xa'));var toCsv=require(_0x7307('0xb'));var querystring=require(_0x7307('0xc'));var Papa=require(_0x7307('0xd'));var Redis=require(_0x7307('0xe'));var authService=require(_0x7307('0xf'));var qs=require(_0x7307('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7307('0x11'))(_0x7307('0x12'));var utils=require(_0x7307('0x13'));var config=require(_0x7307('0x14'));var licenseUtil=require(_0x7307('0x15'));var db=require(_0x7307('0x16'))['db'];function respondWithStatusCode(_0x2ef5b5,_0x337903){_0x337903=_0x337903||0xcc;return function(_0x18268c){if(_0x18268c){return _0x2ef5b5[_0x7307('0x17')](_0x337903);}return _0x2ef5b5[_0x7307('0x18')](_0x337903)['end']();};}function respondWithResult(_0x588727,_0x235dd7){_0x235dd7=_0x235dd7||0xc8;return function(_0x486b19){if(_0x486b19){return _0x588727[_0x7307('0x18')](_0x235dd7)[_0x7307('0x19')](_0x486b19);}};}function respondWithFilteredResult(_0x573a6f,_0x2e9794){return function(_0x5badd9){if(_0x5badd9){var _0x754da0=typeof _0x2e9794[_0x7307('0x1a')]===_0x7307('0x1b')&&typeof _0x2e9794[_0x7307('0x1c')]===_0x7307('0x1b');var _0x528472=_0x5badd9[_0x7307('0x1d')];var _0x554997=_0x754da0?0x0:_0x2e9794['offset'];var _0x5e04c9=_0x754da0?_0x5badd9[_0x7307('0x1d')]:_0x2e9794[_0x7307('0x1a')]+_0x2e9794[_0x7307('0x1c')];var _0x55750a;if(_0x5e04c9>=_0x528472){_0x5e04c9=_0x528472;_0x55750a=0xc8;}else{_0x55750a=0xce;}_0x573a6f[_0x7307('0x18')](_0x55750a);return _0x573a6f[_0x7307('0x1e')](_0x7307('0x1f'),_0x554997+'-'+_0x5e04c9+'/'+_0x528472)[_0x7307('0x19')](_0x5badd9);}return null;};}function patchUpdates(_0x589e4f){return function(_0x42740e){try{jsonpatch['apply'](_0x42740e,_0x589e4f,!![]);}catch(_0x643fef){return BPromise[_0x7307('0x20')](_0x643fef);}return _0x42740e[_0x7307('0x21')]();};}function saveUpdates(_0x23624e,_0x353c4a){return function(_0x9dc4d){if(_0x9dc4d){return _0x9dc4d[_0x7307('0x22')](_0x23624e)[_0x7307('0x23')](function(_0x550e5f){return _0x550e5f;});}return null;};}function removeEntity(_0xb31856,_0xb61a0){return function(_0x206532){if(_0x206532){return _0x206532['destroy']()['then'](function(){var _0x16ffb0=_0x206532[_0x7307('0x24')]({'plain':!![]});var _0x1f1c86='Projects';return db['UserProfileResource'][_0x7307('0x25')]({'where':{'type':_0x1f1c86,'resourceId':_0x16ffb0['id']}})[_0x7307('0x23')](function(){return _0x206532;});})['then'](function(){_0xb31856[_0x7307('0x18')](0xcc)[_0x7307('0x26')]();});}};}function handleEntityNotFound(_0xca10ee,_0x10d6c9){return function(_0x3e2a78){if(!_0x3e2a78){_0xca10ee[_0x7307('0x17')](0x194);}return _0x3e2a78;};}function handleError(_0x1ecb0d,_0x5eefea){_0x5eefea=_0x5eefea||0x1f4;return function(_0x102078){logger[_0x7307('0x27')](_0x102078['stack']);if(_0x102078[_0x7307('0x28')]){delete _0x102078['name'];}_0x1ecb0d['status'](_0x5eefea)[_0x7307('0x29')](_0x102078);};}exports[_0x7307('0x2a')]=function(_0x232b96,_0x2f768d){var _0x276943={},_0x1ce495={},_0x55954b={'count':0x0,'rows':[]};var _0x243cc6=_[_0x7307('0x2b')](db['JscriptyProject']['rawAttributes'],function(_0x475c06){return{'name':_0x475c06[_0x7307('0x2c')],'type':_0x475c06[_0x7307('0x2d')][_0x7307('0x2e')]};});_0x1ce495[_0x7307('0x2f')]=_[_0x7307('0x2b')](_0x243cc6,_0x7307('0x28'));_0x1ce495[_0x7307('0x30')]=_['keys'](_0x232b96[_0x7307('0x30')]);_0x1ce495['filters']=_[_0x7307('0x31')](_0x1ce495['model'],_0x1ce495['query']);_0x276943[_0x7307('0x32')]=_[_0x7307('0x31')](_0x1ce495['model'],qs[_0x7307('0x33')](_0x232b96[_0x7307('0x30')][_0x7307('0x33')]));_0x276943[_0x7307('0x32')]=_0x276943[_0x7307('0x32')]['length']?_0x276943[_0x7307('0x32')]:_0x1ce495[_0x7307('0x2f')];if(!_0x232b96[_0x7307('0x30')]['hasOwnProperty']('nolimit')){_0x276943[_0x7307('0x1c')]=qs['limit'](_0x232b96[_0x7307('0x30')][_0x7307('0x1c')]);_0x276943['offset']=qs[_0x7307('0x1a')](_0x232b96[_0x7307('0x30')][_0x7307('0x1a')]);}_0x276943['order']=qs[_0x7307('0x34')](_0x232b96[_0x7307('0x30')][_0x7307('0x34')]);_0x276943[_0x7307('0x35')]=qs['filters'](_[_0x7307('0x36')](_0x232b96[_0x7307('0x30')],_0x1ce495['filters']),_0x243cc6);if(_0x232b96[_0x7307('0x30')][_0x7307('0x37')]){_0x276943['where']=_[_0x7307('0x38')](_0x276943['where'],{'$or':_[_0x7307('0x2b')](_0x243cc6,function(_0x232ced){if(_0x232ced['type']!=='VIRTUAL'){var _0x389bc9={};_0x389bc9[_0x232ced[_0x7307('0x28')]]={'$like':'%'+_0x232b96['query'][_0x7307('0x37')]+'%'};return _0x389bc9;}})});}_0x276943=_[_0x7307('0x38')]({},_0x276943,_0x232b96[_0x7307('0x39')]);var _0x2fe32f={'where':_0x276943[_0x7307('0x35')]};return db[_0x7307('0x3a')][_0x7307('0x1d')](_0x2fe32f)[_0x7307('0x23')](function(_0x494e25){_0x55954b['count']=_0x494e25;if(_0x232b96[_0x7307('0x30')]['includeAll']){_0x276943[_0x7307('0x3b')]=[{'all':!![]}];}return db[_0x7307('0x3a')][_0x7307('0x3c')](_0x276943);})[_0x7307('0x23')](function(_0x2edacf){_0x55954b[_0x7307('0x3d')]=_0x2edacf;return _0x55954b;})[_0x7307('0x23')](respondWithFilteredResult(_0x2f768d,_0x276943))['catch'](handleError(_0x2f768d,null));};exports[_0x7307('0x3e')]=function(_0x45517a,_0x52ed35){var _0x1cdc28={'raw':![],'where':{'id':_0x45517a[_0x7307('0x3f')]['id']}},_0x53581d={};_0x53581d[_0x7307('0x2f')]=_['keys'](db[_0x7307('0x3a')]['rawAttributes']);_0x53581d['query']=_[_0x7307('0x40')](_0x45517a['query']);_0x53581d[_0x7307('0x41')]=_[_0x7307('0x31')](_0x53581d[_0x7307('0x2f')],_0x53581d[_0x7307('0x30')]);_0x1cdc28[_0x7307('0x32')]=_[_0x7307('0x31')](_0x53581d[_0x7307('0x2f')],qs[_0x7307('0x33')](_0x45517a['query'][_0x7307('0x33')]));_0x1cdc28['attributes']=_0x1cdc28[_0x7307('0x32')][_0x7307('0x42')]?_0x1cdc28['attributes']:_0x53581d[_0x7307('0x2f')];if(_0x45517a[_0x7307('0x30')][_0x7307('0x43')]){_0x1cdc28[_0x7307('0x3b')]=[{'all':!![]}];}_0x1cdc28=_[_0x7307('0x38')]({},_0x1cdc28,_0x45517a[_0x7307('0x39')]);return db[_0x7307('0x3a')][_0x7307('0x44')](_0x1cdc28)[_0x7307('0x23')](handleEntityNotFound(_0x52ed35,null))[_0x7307('0x23')](respondWithResult(_0x52ed35,null))[_0x7307('0x45')](handleError(_0x52ed35,null));};exports[_0x7307('0x46')]=function(_0x9e861e,_0x581e1b){return db[_0x7307('0x3a')]['create'](_0x9e861e[_0x7307('0x47')],{})[_0x7307('0x23')](function(_0x104198){var _0x38b4d9=_0x9e861e[_0x7307('0x48')][_0x7307('0x24')]({'plain':!![]});if(!_0x38b4d9)throw new Error(_0x7307('0x49'));if(_0x38b4d9[_0x7307('0x4a')]==='user'){var _0x8a65b3=_0x104198['get']({'plain':!![]});var _0x5562ed=_0x7307('0x4b');return db[_0x7307('0x4c')][_0x7307('0x44')]({'where':{'name':_0x5562ed,'userProfileId':_0x38b4d9[_0x7307('0x4d')]},'raw':!![]})[_0x7307('0x23')](function(_0x5009fc){if(_0x5009fc&&_0x5009fc['autoAssociation']===0x0){return db['UserProfileResource'][_0x7307('0x46')]({'name':_0x8a65b3[_0x7307('0x28')],'resourceId':_0x8a65b3['id'],'type':_0x5009fc[_0x7307('0x28')],'sectionId':_0x5009fc['id']},{})[_0x7307('0x23')](function(){return _0x104198;});}else{return _0x104198;}})[_0x7307('0x45')](function(_0x548f49){logger[_0x7307('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x548f49);throw _0x548f49;});}return _0x104198;})[_0x7307('0x23')](respondWithResult(_0x581e1b,0xc9))[_0x7307('0x45')](handleError(_0x581e1b,null));};exports['clone']=function(_0x1acd2d,_0x407c40){var _0x17030a={'where':{'id':_0x1acd2d[_0x7307('0x3f')]['id']}},_0x4b2bf3={};_0x4b2bf3[_0x7307('0x2f')]=_[_0x7307('0x40')](db[_0x7307('0x3a')]['rawAttributes']);_0x17030a['attributes']=_[_0x7307('0x31')](_0x4b2bf3['model'],qs['fields'](_0x1acd2d[_0x7307('0x30')]['fields']));_0x17030a[_0x7307('0x32')]=_0x17030a[_0x7307('0x32')][_0x7307('0x42')]?_0x17030a[_0x7307('0x32')]:_0x4b2bf3[_0x7307('0x2f')];if(_0x1acd2d[_0x7307('0x30')][_0x7307('0x43')]){_0x17030a[_0x7307('0x3b')]=[{'all':!![]}];}_0x17030a=_[_0x7307('0x38')]({},_0x17030a,_0x1acd2d[_0x7307('0x39')]);return db[_0x7307('0x3a')][_0x7307('0x44')](_0x17030a)[_0x7307('0x23')](handleEntityNotFound(_0x407c40,null))[_0x7307('0x23')](function(_0x6cce90){if(_0x6cce90){var _0x5f0965=_0x6cce90['get']({'plain':!![]});_0x5f0965=qs['omit'](_0x5f0965,['id',_0x7307('0x4e'),_0x7307('0x4f')]);_0x1acd2d['body']=_[_0x7307('0x50')](_0x1acd2d[_0x7307('0x47')],['id',_0x7307('0x4e'),_0x7307('0x4f')]);return db[_0x7307('0x3a')][_0x7307('0x46')](_[_0x7307('0x38')](_0x5f0965,_0x1acd2d[_0x7307('0x47')]),{'include':_0x1acd2d[_0x7307('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0x7307('0x23')](function(_0x28c301){var _0x333c9c=_0x1acd2d[_0x7307('0x48')][_0x7307('0x24')]({'plain':!![]});if(!_0x333c9c)throw new Error(_0x7307('0x49'));if(_0x333c9c[_0x7307('0x4a')]===_0x7307('0x48')){var _0x2412c2=_0x28c301['get']({'plain':!![]});var _0x4cfadc=_0x7307('0x4b');return db[_0x7307('0x4c')]['find']({'where':{'name':_0x4cfadc,'userProfileId':_0x333c9c[_0x7307('0x4d')]},'raw':!![]})['then'](function(_0x184842){if(_0x184842&&_0x184842[_0x7307('0x51')]===0x0){return db[_0x7307('0x52')][_0x7307('0x46')]({'name':_0x2412c2[_0x7307('0x28')],'resourceId':_0x2412c2['id'],'type':_0x184842['name'],'sectionId':_0x184842['id']},{})[_0x7307('0x23')](function(){return _0x28c301;});}else{return _0x28c301;}})[_0x7307('0x45')](function(_0x339df5){logger[_0x7307('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x339df5);throw _0x339df5;});}return _0x28c301;});}})[_0x7307('0x23')](respondWithResult(_0x407c40,0xc9))[_0x7307('0x45')](handleError(_0x407c40,null));};exports['update']=function(_0x2caed7,_0x5d22fc){if(_0x2caed7['body']['id']){delete _0x2caed7['body']['id'];}return db['JscriptyProject'][_0x7307('0x44')]({'where':{'id':_0x2caed7['params']['id']}})['then'](handleEntityNotFound(_0x5d22fc,null))[_0x7307('0x23')](saveUpdates(_0x2caed7[_0x7307('0x47')],null))[_0x7307('0x23')](respondWithResult(_0x5d22fc,null))[_0x7307('0x45')](handleError(_0x5d22fc,null));};exports[_0x7307('0x25')]=function(_0x4fd8e6,_0x1c5934){return db[_0x7307('0x3a')][_0x7307('0x44')]({'where':{'id':_0x4fd8e6['params']['id']}})[_0x7307('0x23')](handleEntityNotFound(_0x1c5934,null))[_0x7307('0x23')](removeEntity(_0x1c5934,null))['catch'](handleError(_0x1c5934,null));};exports[_0x7307('0x53')]=function(_0x54c255,_0x47e04c,_0x1a4cee){var _0x3be4c0={'raw':!![],'where':{}};var _0x79d26c={};var _0x30bdf4={'count':0x0,'rows':[]};return db[_0x7307('0x3a')][_0x7307('0x54')]({'where':{'id':_0x54c255[_0x7307('0x3f')]['id']}})[_0x7307('0x23')](handleEntityNotFound(_0x47e04c,null))[_0x7307('0x23')](function(_0x3cb697){if(_0x3cb697){_0x79d26c[_0x7307('0x2f')]=_[_0x7307('0x40')](db[_0x7307('0x55')][_0x7307('0x56')]);_0x79d26c['query']=_[_0x7307('0x40')](_0x54c255[_0x7307('0x30')]);_0x79d26c[_0x7307('0x41')]=_[_0x7307('0x31')](_0x79d26c[_0x7307('0x2f')],_0x79d26c[_0x7307('0x30')]);_0x3be4c0['attributes']=_[_0x7307('0x31')](_0x79d26c[_0x7307('0x2f')],qs[_0x7307('0x33')](_0x54c255[_0x7307('0x30')][_0x7307('0x33')]));_0x3be4c0['attributes']=_0x3be4c0[_0x7307('0x32')]['length']?_0x3be4c0['attributes']:_0x79d26c['model'];if(!_0x54c255['query'][_0x7307('0x57')]('nolimit')){_0x3be4c0[_0x7307('0x1c')]=qs['limit'](_0x54c255[_0x7307('0x30')]['limit']);_0x3be4c0['offset']=qs[_0x7307('0x1a')](_0x54c255['query'][_0x7307('0x1a')]);}_0x3be4c0[_0x7307('0x58')]=qs[_0x7307('0x34')](_0x54c255['query']['sort']);_0x3be4c0[_0x7307('0x35')]=qs[_0x7307('0x41')](_[_0x7307('0x36')](_0x54c255[_0x7307('0x30')],_0x79d26c[_0x7307('0x41')]));_0x3be4c0['where'][_0x7307('0x59')]=_0x3cb697['id'];if(_0x54c255['query'][_0x7307('0x37')]){_0x3be4c0['where']=_[_0x7307('0x38')](_0x3be4c0[_0x7307('0x35')],{'$or':_[_0x7307('0x2b')](_0x3be4c0[_0x7307('0x32')],function(_0x4f7dc3){var _0x4218fb={};_0x4218fb[_0x4f7dc3]={'$like':'%'+_0x54c255[_0x7307('0x30')]['filter']+'%'};return _0x4218fb;})});}_0x3be4c0=_['merge']({},_0x3be4c0,_0x54c255[_0x7307('0x39')]);return db[_0x7307('0x55')][_0x7307('0x1d')]({'where':_0x3be4c0['where']})[_0x7307('0x23')](function(_0x14c3c8){_0x30bdf4[_0x7307('0x1d')]=_0x14c3c8;if(_0x54c255[_0x7307('0x30')][_0x7307('0x43')]){_0x3be4c0[_0x7307('0x3b')]=[{'all':!![]}];}return db[_0x7307('0x55')][_0x7307('0x3c')](_0x3be4c0);})[_0x7307('0x23')](function(_0x1d2ef1){_0x30bdf4['rows']=_0x1d2ef1;return _0x30bdf4;});}})[_0x7307('0x23')](respondWithFilteredResult(_0x47e04c,_0x3be4c0))['catch'](handleError(_0x47e04c,null));};exports['getAnswers']=function(_0x5070f5,_0x293f68,_0x358452){var _0xa04be4={'raw':!![],'where':{}};var _0x1239b9={};var _0x7f1837={'count':0x0,'rows':[]};return db[_0x7307('0x3a')]['findOne']({'where':{'id':_0x5070f5[_0x7307('0x3f')]['id']}})[_0x7307('0x23')](handleEntityNotFound(_0x293f68,null))[_0x7307('0x23')](function(_0xadbf77){if(_0xadbf77){_0x1239b9[_0x7307('0x2f')]=_[_0x7307('0x40')](db[_0x7307('0x5a')][_0x7307('0x56')]);_0x1239b9['query']=_[_0x7307('0x40')](_0x5070f5[_0x7307('0x30')]);_0x1239b9[_0x7307('0x41')]=_[_0x7307('0x31')](_0x1239b9[_0x7307('0x2f')],_0x1239b9[_0x7307('0x30')]);_0xa04be4[_0x7307('0x32')]=_[_0x7307('0x31')](_0x1239b9[_0x7307('0x2f')],qs[_0x7307('0x33')](_0x5070f5[_0x7307('0x30')][_0x7307('0x33')]));_0xa04be4[_0x7307('0x32')]=_0xa04be4[_0x7307('0x32')][_0x7307('0x42')]?_0xa04be4[_0x7307('0x32')]:_0x1239b9[_0x7307('0x2f')];if(!_0x5070f5[_0x7307('0x30')][_0x7307('0x57')](_0x7307('0x5b'))){_0xa04be4['limit']=qs[_0x7307('0x1c')](_0x5070f5[_0x7307('0x30')]['limit']);_0xa04be4[_0x7307('0x1a')]=qs['offset'](_0x5070f5[_0x7307('0x30')]['offset']);}_0xa04be4['order']=qs[_0x7307('0x34')](_0x5070f5['query'][_0x7307('0x34')]);_0xa04be4['where']=qs[_0x7307('0x41')](_['pick'](_0x5070f5['query'],_0x1239b9['filters']));_0xa04be4['where']['ProjectId']=_0xadbf77['id'];if(_0x5070f5['query'][_0x7307('0x37')]){_0xa04be4[_0x7307('0x35')]=_[_0x7307('0x38')](_0xa04be4[_0x7307('0x35')],{'$or':_['map'](_0xa04be4[_0x7307('0x32')],function(_0x448716){var _0x5c7875={};_0x5c7875[_0x448716]={'$like':'%'+_0x5070f5[_0x7307('0x30')][_0x7307('0x37')]+'%'};return _0x5c7875;})});}_0xa04be4=_['merge']({},_0xa04be4,_0x5070f5[_0x7307('0x39')]);return db[_0x7307('0x5a')]['count']({'where':_0xa04be4[_0x7307('0x35')]})['then'](function(_0x49ad6e){_0x7f1837[_0x7307('0x1d')]=_0x49ad6e;if(_0x5070f5['query'][_0x7307('0x43')]){_0xa04be4['include']=[{'all':!![]}];}return db[_0x7307('0x5a')]['findAll'](_0xa04be4);})[_0x7307('0x23')](function(_0x1d262f){_0x7f1837[_0x7307('0x3d')]=_0x1d262f;return _0x7f1837;});}})[_0x7307('0x23')](respondWithFilteredResult(_0x293f68,_0xa04be4))['catch'](handleError(_0x293f68,null));};function char(_0x53ddb2){return _0x7307('0x5c')===typeof _0x53ddb2?String['fromCharCode'][_0x7307('0x5d')](null,arguments):_0x53ddb2;}function needsEncapsulation(_0x6c627e){return!!_0x6c627e&&(_0x6c627e['toString']()['indexOf'](char(0xd))>=0x0||_0x6c627e['toString']()['indexOf'](char(0xa))>=0x0||_0x6c627e[_0x7307('0x5e')]()[_0x7307('0x5f')](char(0x2c))>=0x0||_0x6c627e[_0x7307('0x5e')]()[_0x7307('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x1f695d){var _0xa50ede=char(0x22),_0x5b5fcc='\x5c'+char(0x22),_0x1260c9=_0x1f695d[_0x7307('0x5e')]()[_0x7307('0x60')](new RegExp(_0xa50ede,'g'),_0x5b5fcc);return _0xa50ede+_0x1260c9+_0xa50ede;}exports[_0x7307('0x61')]=function(_0x4c74d6,_0x582703,_0x2b560a){var _0x432937,_0x452895;var _0x4d94d7={'where':{'ProjectId':_0x4c74d6['params']['id']}};if(_0x4c74d6[_0x7307('0x30')][_0x7307('0x62')]){_0x4d94d7[_0x7307('0x35')][_0x7307('0x63')]=JSON[_0x7307('0x64')](_0x4c74d6[_0x7307('0x30')][_0x7307('0x62')]);}return db[_0x7307('0x55')]['findAll'](_0x4d94d7)[_0x7307('0x23')](handleEntityNotFound(_0x582703,null))[_0x7307('0x23')](function(_0x22dc47){if(_0x22dc47){_0x432937=_0x22dc47;return db[_0x7307('0x65')][_0x7307('0x3c')]({'where':{'SessionId':{'$in':_[_0x7307('0x2b')](_0x432937,'id')},'ProjectId':_0x4c74d6['params']['id']},'order':_0x7307('0x66')});}})[_0x7307('0x23')](handleEntityNotFound(_0x582703,null))[_0x7307('0x23')](function(_0xa3a1b7){if(_0xa3a1b7){_0x452895=_0xa3a1b7;var _0x69890b={};for(var _0x46f25b=0x0,_0x430bcd=_0x452895[_0x7307('0x42')];_0x46f25b<_0x430bcd;_0x46f25b++){if(!_0x69890b[_0x7307('0x57')](_0x452895[_0x46f25b][_0x7307('0x67')])){_0x69890b[_0x452895[_0x46f25b][_0x7307('0x67')]]=needsEncapsulation(_0x452895[_0x46f25b][_0x7307('0x68')])?encapsulate(_0x452895[_0x46f25b]['question']):_0x452895[_0x46f25b][_0x7307('0x68')];}}var _0x28c5f1=[],_0x2488d5={};for(var _0x4e45de=0x0,_0x11f282=_0x432937[_0x7307('0x42')];_0x4e45de<_0x11f282;_0x4e45de++){_0x2488d5={'ProjectId':_0x4c74d6[_0x7307('0x3f')]['id'],'SessionId':_0x432937[_0x4e45de]['id'],'StartTime':moment(_0x432937[_0x4e45de]['starttime'])[_0x7307('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5281fe=0x0,_0x555f1d=_0x452895[_0x7307('0x42')];_0x5281fe<_0x555f1d;_0x5281fe++){if(_0x452895[_0x5281fe][_0x7307('0x6a')]==_0x432937[_0x4e45de]['id']&&_0x69890b[_0x7307('0x57')](_0x452895[_0x5281fe][_0x7307('0x67')])){_0x2488d5[_0x69890b[_0x452895[_0x5281fe][_0x7307('0x67')]]]=_0x452895[_0x5281fe][_0x7307('0x6b')];}}for(var _0x4b8ed2 in _0x69890b){if(!_0x2488d5['hasOwnProperty'](_0x69890b[_0x4b8ed2])){_0x2488d5[_0x69890b[_0x4b8ed2]]=null;}}_0x28c5f1['push'](_0x2488d5);}return _0x28c5f1;}})['then'](function(_0x14c7ef){if(!_['isEmpty'](_0x14c7ef)){var _0x5306fa=toCsv(_0x14c7ef);var _0x53e37e=Date[_0x7307('0x6c')]();fs[_0x7307('0x6d')](util[_0x7307('0x69')](_0x7307('0x6e'),_0x4c74d6[_0x7307('0x3f')]['id'],_0x53e37e),_0x5306fa);_0x582703['setHeader']('Content-disposition',_0x7307('0x6f')+util[_0x7307('0x69')]('Jscripty_Project_%d_Summary_%s.csv',_0x4c74d6[_0x7307('0x3f')]['id'],_0x53e37e));_0x582703[_0x7307('0x70')](_0x7307('0x71'),_0x7307('0x72'));return _0x582703[_0x7307('0x73')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4c74d6[_0x7307('0x3f')]['id'],_0x53e37e));}else{return _0x582703[_0x7307('0x17')](0xcc);}})[_0x7307('0x45')](handleError(_0x582703,null));}; \ No newline at end of file +var _0xd679=['status','json','offset','undefined','count','set','Content-Range','save','update','then','get','Projects','destroy','end','error','name','send','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','VIRTUAL','options','JscriptyProject','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','body','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4055e4,_0x574122){var _0x13bf24=function(_0x3af535){while(--_0x3af535){_0x4055e4['push'](_0x4055e4['shift']());}};_0x13bf24(++_0x574122);}(_0xd679,0xcc));var _0x9d67=function(_0x212c07,_0x45a793){_0x212c07=_0x212c07-0x0;var _0x9b3777=_0xd679[_0x212c07];return _0x9b3777;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d67('0x0'));var zipdir=require(_0x9d67('0x1'));var jsonpatch=require(_0x9d67('0x2'));var rp=require(_0x9d67('0x3'));var moment=require(_0x9d67('0x4'));var BPromise=require(_0x9d67('0x5'));var Mustache=require(_0x9d67('0x6'));var util=require(_0x9d67('0x7'));var path=require(_0x9d67('0x8'));var sox=require(_0x9d67('0x9'));var csv=require(_0x9d67('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d67('0xb'));var _=require('lodash');var squel=require(_0x9d67('0xc'));var crypto=require(_0x9d67('0xd'));var jsforce=require(_0x9d67('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9d67('0xa'));var querystring=require(_0x9d67('0xf'));var Papa=require(_0x9d67('0x10'));var Redis=require(_0x9d67('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d67('0x12'));var logger=require(_0x9d67('0x13'))(_0x9d67('0x14'));var utils=require(_0x9d67('0x15'));var config=require(_0x9d67('0x16'));var licenseUtil=require(_0x9d67('0x17'));var db=require(_0x9d67('0x18'))['db'];function respondWithStatusCode(_0x1230ed,_0x52a3aa){_0x52a3aa=_0x52a3aa||0xcc;return function(_0x26b002){if(_0x26b002){return _0x1230ed[_0x9d67('0x19')](_0x52a3aa);}return _0x1230ed[_0x9d67('0x1a')](_0x52a3aa)['end']();};}function respondWithResult(_0x1d500d,_0x2abfcd){_0x2abfcd=_0x2abfcd||0xc8;return function(_0x4e20a6){if(_0x4e20a6){return _0x1d500d[_0x9d67('0x1a')](_0x2abfcd)[_0x9d67('0x1b')](_0x4e20a6);}};}function respondWithFilteredResult(_0x31226e,_0x1e6ec0){return function(_0x4e6d75){if(_0x4e6d75){var _0x4d383a=typeof _0x1e6ec0[_0x9d67('0x1c')]==='undefined'&&typeof _0x1e6ec0['limit']===_0x9d67('0x1d');var _0x450c19=_0x4e6d75['count'];var _0x4fb837=_0x4d383a?0x0:_0x1e6ec0[_0x9d67('0x1c')];var _0x239379=_0x4d383a?_0x4e6d75[_0x9d67('0x1e')]:_0x1e6ec0['offset']+_0x1e6ec0['limit'];var _0x3c4b74;if(_0x239379>=_0x450c19){_0x239379=_0x450c19;_0x3c4b74=0xc8;}else{_0x3c4b74=0xce;}_0x31226e[_0x9d67('0x1a')](_0x3c4b74);return _0x31226e[_0x9d67('0x1f')](_0x9d67('0x20'),_0x4fb837+'-'+_0x239379+'/'+_0x450c19)[_0x9d67('0x1b')](_0x4e6d75);}return null;};}function patchUpdates(_0x4f469f){return function(_0x1f24e1){try{jsonpatch['apply'](_0x1f24e1,_0x4f469f,!![]);}catch(_0x4977cd){return BPromise['reject'](_0x4977cd);}return _0x1f24e1[_0x9d67('0x21')]();};}function saveUpdates(_0x127e20,_0x3fb040){return function(_0x53e670){if(_0x53e670){return _0x53e670[_0x9d67('0x22')](_0x127e20)[_0x9d67('0x23')](function(_0xf9d483){return _0xf9d483;});}return null;};}function removeEntity(_0x204450,_0x26a57f){return function(_0x2f3029){if(_0x2f3029){return _0x2f3029['destroy']()[_0x9d67('0x23')](function(){var _0x4ffd80=_0x2f3029[_0x9d67('0x24')]({'plain':!![]});var _0x1f53db=_0x9d67('0x25');return db['UserProfileResource'][_0x9d67('0x26')]({'where':{'type':_0x1f53db,'resourceId':_0x4ffd80['id']}})[_0x9d67('0x23')](function(){return _0x2f3029;});})[_0x9d67('0x23')](function(){_0x204450[_0x9d67('0x1a')](0xcc)[_0x9d67('0x27')]();});}};}function handleEntityNotFound(_0x4a808f,_0x340bdb){return function(_0x43fba5){if(!_0x43fba5){_0x4a808f[_0x9d67('0x19')](0x194);}return _0x43fba5;};}function handleError(_0x5f3f0c,_0x831bae){_0x831bae=_0x831bae||0x1f4;return function(_0x5bcfe7){logger[_0x9d67('0x28')](_0x5bcfe7['stack']);if(_0x5bcfe7[_0x9d67('0x29')]){delete _0x5bcfe7[_0x9d67('0x29')];}_0x5f3f0c[_0x9d67('0x1a')](_0x831bae)[_0x9d67('0x2a')](_0x5bcfe7);};}exports['index']=function(_0x4824f9,_0x359348){var _0x336360={},_0x185df4={},_0x208460={'count':0x0,'rows':[]};var _0x45fbc9=_[_0x9d67('0x2b')](db['JscriptyProject'][_0x9d67('0x2c')],function(_0x4e4e78){return{'name':_0x4e4e78['fieldName'],'type':_0x4e4e78[_0x9d67('0x2d')][_0x9d67('0x2e')]};});_0x185df4[_0x9d67('0x2f')]=_[_0x9d67('0x2b')](_0x45fbc9,_0x9d67('0x29'));_0x185df4[_0x9d67('0x30')]=_['keys'](_0x4824f9[_0x9d67('0x30')]);_0x185df4['filters']=_[_0x9d67('0x31')](_0x185df4['model'],_0x185df4['query']);_0x336360[_0x9d67('0x32')]=_[_0x9d67('0x31')](_0x185df4[_0x9d67('0x2f')],qs[_0x9d67('0x33')](_0x4824f9[_0x9d67('0x30')][_0x9d67('0x33')]));_0x336360['attributes']=_0x336360[_0x9d67('0x32')][_0x9d67('0x34')]?_0x336360[_0x9d67('0x32')]:_0x185df4[_0x9d67('0x2f')];if(!_0x4824f9['query'][_0x9d67('0x35')](_0x9d67('0x36'))){_0x336360[_0x9d67('0x37')]=qs[_0x9d67('0x37')](_0x4824f9['query'][_0x9d67('0x37')]);_0x336360['offset']=qs[_0x9d67('0x1c')](_0x4824f9['query'][_0x9d67('0x1c')]);}_0x336360[_0x9d67('0x38')]=qs[_0x9d67('0x39')](_0x4824f9[_0x9d67('0x30')][_0x9d67('0x39')]);_0x336360['where']=qs[_0x9d67('0x3a')](_[_0x9d67('0x3b')](_0x4824f9[_0x9d67('0x30')],_0x185df4[_0x9d67('0x3a')]),_0x45fbc9);if(_0x4824f9['query'][_0x9d67('0x3c')]){_0x336360['where']=_['merge'](_0x336360[_0x9d67('0x3d')],{'$or':_[_0x9d67('0x2b')](_0x45fbc9,function(_0x31f11b){if(_0x31f11b[_0x9d67('0x2d')]!==_0x9d67('0x3e')){var _0x35f7b3={};_0x35f7b3[_0x31f11b[_0x9d67('0x29')]]={'$like':'%'+_0x4824f9[_0x9d67('0x30')][_0x9d67('0x3c')]+'%'};return _0x35f7b3;}})});}_0x336360=_['merge']({},_0x336360,_0x4824f9[_0x9d67('0x3f')]);var _0x8dbd9c={'where':_0x336360[_0x9d67('0x3d')]};return db[_0x9d67('0x40')][_0x9d67('0x1e')](_0x8dbd9c)[_0x9d67('0x23')](function(_0x931a7b){_0x208460['count']=_0x931a7b;if(_0x4824f9[_0x9d67('0x30')][_0x9d67('0x41')]){_0x336360[_0x9d67('0x42')]=[{'all':!![]}];}return db[_0x9d67('0x40')][_0x9d67('0x43')](_0x336360);})[_0x9d67('0x23')](function(_0x33fb2e){_0x208460[_0x9d67('0x44')]=_0x33fb2e;return _0x208460;})[_0x9d67('0x23')](respondWithFilteredResult(_0x359348,_0x336360))[_0x9d67('0x45')](handleError(_0x359348,null));};exports[_0x9d67('0x46')]=function(_0x295e93,_0x568534){var _0x5c4655={'raw':![],'where':{'id':_0x295e93[_0x9d67('0x47')]['id']}},_0x140dcc={};_0x140dcc['model']=_['keys'](db[_0x9d67('0x40')][_0x9d67('0x2c')]);_0x140dcc['query']=_[_0x9d67('0x48')](_0x295e93['query']);_0x140dcc['filters']=_[_0x9d67('0x31')](_0x140dcc[_0x9d67('0x2f')],_0x140dcc['query']);_0x5c4655['attributes']=_[_0x9d67('0x31')](_0x140dcc[_0x9d67('0x2f')],qs[_0x9d67('0x33')](_0x295e93['query'][_0x9d67('0x33')]));_0x5c4655[_0x9d67('0x32')]=_0x5c4655[_0x9d67('0x32')]['length']?_0x5c4655[_0x9d67('0x32')]:_0x140dcc[_0x9d67('0x2f')];if(_0x295e93[_0x9d67('0x30')][_0x9d67('0x41')]){_0x5c4655[_0x9d67('0x42')]=[{'all':!![]}];}_0x5c4655=_[_0x9d67('0x49')]({},_0x5c4655,_0x295e93[_0x9d67('0x3f')]);return db['JscriptyProject'][_0x9d67('0x4a')](_0x5c4655)['then'](handleEntityNotFound(_0x568534,null))[_0x9d67('0x23')](respondWithResult(_0x568534,null))['catch'](handleError(_0x568534,null));};exports[_0x9d67('0x4b')]=function(_0x3929ec,_0x27c4a8){return db[_0x9d67('0x40')][_0x9d67('0x4b')](_0x3929ec[_0x9d67('0x4c')],{})[_0x9d67('0x23')](function(_0x3fd728){var _0x2fa869=_0x3929ec[_0x9d67('0x4d')][_0x9d67('0x24')]({'plain':!![]});if(!_0x2fa869)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fa869['role']===_0x9d67('0x4d')){var _0x19448f=_0x3fd728[_0x9d67('0x24')]({'plain':!![]});var _0x192a96='Projects';return db['UserProfileSection'][_0x9d67('0x4a')]({'where':{'name':_0x192a96,'userProfileId':_0x2fa869[_0x9d67('0x4e')]},'raw':!![]})[_0x9d67('0x23')](function(_0x52b853){if(_0x52b853&&_0x52b853[_0x9d67('0x4f')]===0x0){return db[_0x9d67('0x50')][_0x9d67('0x4b')]({'name':_0x19448f[_0x9d67('0x29')],'resourceId':_0x19448f['id'],'type':_0x52b853[_0x9d67('0x29')],'sectionId':_0x52b853['id']},{})['then'](function(){return _0x3fd728;});}else{return _0x3fd728;}})[_0x9d67('0x45')](function(_0x259dde){logger['error'](_0x9d67('0x51'),_0x259dde);throw _0x259dde;});}return _0x3fd728;})[_0x9d67('0x23')](respondWithResult(_0x27c4a8,0xc9))[_0x9d67('0x45')](handleError(_0x27c4a8,null));};exports[_0x9d67('0x52')]=function(_0x4d769e,_0x14d052){var _0x1a7b24={'where':{'id':_0x4d769e[_0x9d67('0x47')]['id']}},_0x5f1ae9={};_0x5f1ae9['model']=_[_0x9d67('0x48')](db['JscriptyProject'][_0x9d67('0x2c')]);_0x1a7b24[_0x9d67('0x32')]=_[_0x9d67('0x31')](_0x5f1ae9['model'],qs[_0x9d67('0x33')](_0x4d769e[_0x9d67('0x30')][_0x9d67('0x33')]));_0x1a7b24[_0x9d67('0x32')]=_0x1a7b24[_0x9d67('0x32')][_0x9d67('0x34')]?_0x1a7b24[_0x9d67('0x32')]:_0x5f1ae9[_0x9d67('0x2f')];if(_0x4d769e['query'][_0x9d67('0x41')]){_0x1a7b24[_0x9d67('0x42')]=[{'all':!![]}];}_0x1a7b24=_[_0x9d67('0x49')]({},_0x1a7b24,_0x4d769e['options']);return db[_0x9d67('0x40')][_0x9d67('0x4a')](_0x1a7b24)[_0x9d67('0x23')](handleEntityNotFound(_0x14d052,null))[_0x9d67('0x23')](function(_0x2ce83e){if(_0x2ce83e){var _0x4a3f94=_0x2ce83e[_0x9d67('0x24')]({'plain':!![]});_0x4a3f94=qs[_0x9d67('0x53')](_0x4a3f94,['id',_0x9d67('0x54'),_0x9d67('0x55')]);_0x4d769e['body']=_[_0x9d67('0x53')](_0x4d769e[_0x9d67('0x4c')],['id',_0x9d67('0x54'),_0x9d67('0x55')]);return db['JscriptyProject'][_0x9d67('0x4b')](_[_0x9d67('0x49')](_0x4a3f94,_0x4d769e['body']),{'include':_0x4d769e['query'][_0x9d67('0x41')]?[{'all':!![]}]:undefined})[_0x9d67('0x23')](function(_0x463b8b){var _0x48219f=_0x4d769e[_0x9d67('0x4d')][_0x9d67('0x24')]({'plain':!![]});if(!_0x48219f)throw new Error(_0x9d67('0x56'));if(_0x48219f['role']===_0x9d67('0x4d')){var _0x19da96=_0x463b8b[_0x9d67('0x24')]({'plain':!![]});var _0x3ee770='Projects';return db['UserProfileSection'][_0x9d67('0x4a')]({'where':{'name':_0x3ee770,'userProfileId':_0x48219f[_0x9d67('0x4e')]},'raw':!![]})[_0x9d67('0x23')](function(_0x46f4bb){if(_0x46f4bb&&_0x46f4bb['autoAssociation']===0x0){return db[_0x9d67('0x50')][_0x9d67('0x4b')]({'name':_0x19da96[_0x9d67('0x29')],'resourceId':_0x19da96['id'],'type':_0x46f4bb[_0x9d67('0x29')],'sectionId':_0x46f4bb['id']},{})[_0x9d67('0x23')](function(){return _0x463b8b;});}else{return _0x463b8b;}})['catch'](function(_0x45ed14){logger[_0x9d67('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45ed14);throw _0x45ed14;});}return _0x463b8b;});}})[_0x9d67('0x23')](respondWithResult(_0x14d052,0xc9))[_0x9d67('0x45')](handleError(_0x14d052,null));};exports[_0x9d67('0x22')]=function(_0x2f049b,_0xe34546){if(_0x2f049b[_0x9d67('0x4c')]['id']){delete _0x2f049b[_0x9d67('0x4c')]['id'];}return db['JscriptyProject'][_0x9d67('0x4a')]({'where':{'id':_0x2f049b[_0x9d67('0x47')]['id']}})['then'](handleEntityNotFound(_0xe34546,null))[_0x9d67('0x23')](saveUpdates(_0x2f049b['body'],null))['then'](respondWithResult(_0xe34546,null))[_0x9d67('0x45')](handleError(_0xe34546,null));};exports[_0x9d67('0x26')]=function(_0x33204f,_0x1113a5){return db['JscriptyProject'][_0x9d67('0x4a')]({'where':{'id':_0x33204f[_0x9d67('0x47')]['id']}})[_0x9d67('0x23')](handleEntityNotFound(_0x1113a5,null))[_0x9d67('0x23')](removeEntity(_0x1113a5,null))[_0x9d67('0x45')](handleError(_0x1113a5,null));};exports['getSessions']=function(_0x24b36e,_0x58c243,_0x55eb6b){var _0xeaa858={'raw':!![],'where':{}};var _0x1a0cc4={};var _0x9415ba={'count':0x0,'rows':[]};return db[_0x9d67('0x40')][_0x9d67('0x57')]({'where':{'id':_0x24b36e[_0x9d67('0x47')]['id']}})[_0x9d67('0x23')](handleEntityNotFound(_0x58c243,null))[_0x9d67('0x23')](function(_0x28b377){if(_0x28b377){_0x1a0cc4[_0x9d67('0x2f')]=_[_0x9d67('0x48')](db[_0x9d67('0x58')]['rawAttributes']);_0x1a0cc4['query']=_[_0x9d67('0x48')](_0x24b36e[_0x9d67('0x30')]);_0x1a0cc4[_0x9d67('0x3a')]=_[_0x9d67('0x31')](_0x1a0cc4[_0x9d67('0x2f')],_0x1a0cc4[_0x9d67('0x30')]);_0xeaa858[_0x9d67('0x32')]=_[_0x9d67('0x31')](_0x1a0cc4[_0x9d67('0x2f')],qs[_0x9d67('0x33')](_0x24b36e[_0x9d67('0x30')][_0x9d67('0x33')]));_0xeaa858[_0x9d67('0x32')]=_0xeaa858[_0x9d67('0x32')]['length']?_0xeaa858[_0x9d67('0x32')]:_0x1a0cc4['model'];if(!_0x24b36e[_0x9d67('0x30')]['hasOwnProperty'](_0x9d67('0x36'))){_0xeaa858[_0x9d67('0x37')]=qs[_0x9d67('0x37')](_0x24b36e[_0x9d67('0x30')][_0x9d67('0x37')]);_0xeaa858['offset']=qs[_0x9d67('0x1c')](_0x24b36e['query']['offset']);}_0xeaa858[_0x9d67('0x38')]=qs[_0x9d67('0x39')](_0x24b36e[_0x9d67('0x30')][_0x9d67('0x39')]);_0xeaa858[_0x9d67('0x3d')]=qs[_0x9d67('0x3a')](_['pick'](_0x24b36e[_0x9d67('0x30')],_0x1a0cc4[_0x9d67('0x3a')]));_0xeaa858[_0x9d67('0x3d')][_0x9d67('0x59')]=_0x28b377['id'];if(_0x24b36e[_0x9d67('0x30')][_0x9d67('0x3c')]){_0xeaa858[_0x9d67('0x3d')]=_[_0x9d67('0x49')](_0xeaa858[_0x9d67('0x3d')],{'$or':_[_0x9d67('0x2b')](_0xeaa858[_0x9d67('0x32')],function(_0x3d57e1){var _0x4eb86b={};_0x4eb86b[_0x3d57e1]={'$like':'%'+_0x24b36e[_0x9d67('0x30')][_0x9d67('0x3c')]+'%'};return _0x4eb86b;})});}_0xeaa858=_[_0x9d67('0x49')]({},_0xeaa858,_0x24b36e[_0x9d67('0x3f')]);return db[_0x9d67('0x58')][_0x9d67('0x1e')]({'where':_0xeaa858['where']})['then'](function(_0x3de9a0){_0x9415ba[_0x9d67('0x1e')]=_0x3de9a0;if(_0x24b36e['query'][_0x9d67('0x41')]){_0xeaa858[_0x9d67('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x9d67('0x43')](_0xeaa858);})[_0x9d67('0x23')](function(_0x5c07ec){_0x9415ba[_0x9d67('0x44')]=_0x5c07ec;return _0x9415ba;});}})['then'](respondWithFilteredResult(_0x58c243,_0xeaa858))[_0x9d67('0x45')](handleError(_0x58c243,null));};exports[_0x9d67('0x5a')]=function(_0x18fd96,_0x44daa3,_0x1eaaa7){var _0x2c7af5={'raw':!![],'where':{}};var _0x2d53b7={};var _0x5eb6ce={'count':0x0,'rows':[]};return db[_0x9d67('0x40')][_0x9d67('0x57')]({'where':{'id':_0x18fd96['params']['id']}})[_0x9d67('0x23')](handleEntityNotFound(_0x44daa3,null))[_0x9d67('0x23')](function(_0x280737){if(_0x280737){_0x2d53b7['model']=_[_0x9d67('0x48')](db['JscriptyAnswerReport'][_0x9d67('0x2c')]);_0x2d53b7['query']=_[_0x9d67('0x48')](_0x18fd96[_0x9d67('0x30')]);_0x2d53b7[_0x9d67('0x3a')]=_[_0x9d67('0x31')](_0x2d53b7['model'],_0x2d53b7[_0x9d67('0x30')]);_0x2c7af5[_0x9d67('0x32')]=_[_0x9d67('0x31')](_0x2d53b7[_0x9d67('0x2f')],qs[_0x9d67('0x33')](_0x18fd96[_0x9d67('0x30')][_0x9d67('0x33')]));_0x2c7af5[_0x9d67('0x32')]=_0x2c7af5[_0x9d67('0x32')][_0x9d67('0x34')]?_0x2c7af5[_0x9d67('0x32')]:_0x2d53b7[_0x9d67('0x2f')];if(!_0x18fd96[_0x9d67('0x30')][_0x9d67('0x35')]('nolimit')){_0x2c7af5[_0x9d67('0x37')]=qs[_0x9d67('0x37')](_0x18fd96[_0x9d67('0x30')][_0x9d67('0x37')]);_0x2c7af5[_0x9d67('0x1c')]=qs[_0x9d67('0x1c')](_0x18fd96[_0x9d67('0x30')][_0x9d67('0x1c')]);}_0x2c7af5[_0x9d67('0x38')]=qs[_0x9d67('0x39')](_0x18fd96[_0x9d67('0x30')][_0x9d67('0x39')]);_0x2c7af5['where']=qs[_0x9d67('0x3a')](_[_0x9d67('0x3b')](_0x18fd96['query'],_0x2d53b7[_0x9d67('0x3a')]));_0x2c7af5[_0x9d67('0x3d')][_0x9d67('0x59')]=_0x280737['id'];if(_0x18fd96[_0x9d67('0x30')]['filter']){_0x2c7af5[_0x9d67('0x3d')]=_[_0x9d67('0x49')](_0x2c7af5[_0x9d67('0x3d')],{'$or':_[_0x9d67('0x2b')](_0x2c7af5[_0x9d67('0x32')],function(_0xa48ae6){var _0x18dd69={};_0x18dd69[_0xa48ae6]={'$like':'%'+_0x18fd96[_0x9d67('0x30')]['filter']+'%'};return _0x18dd69;})});}_0x2c7af5=_[_0x9d67('0x49')]({},_0x2c7af5,_0x18fd96[_0x9d67('0x3f')]);return db[_0x9d67('0x5b')][_0x9d67('0x1e')]({'where':_0x2c7af5[_0x9d67('0x3d')]})[_0x9d67('0x23')](function(_0x523840){_0x5eb6ce['count']=_0x523840;if(_0x18fd96['query'][_0x9d67('0x41')]){_0x2c7af5[_0x9d67('0x42')]=[{'all':!![]}];}return db[_0x9d67('0x5b')][_0x9d67('0x43')](_0x2c7af5);})[_0x9d67('0x23')](function(_0x9b48b7){_0x5eb6ce[_0x9d67('0x44')]=_0x9b48b7;return _0x5eb6ce;});}})['then'](respondWithFilteredResult(_0x44daa3,_0x2c7af5))[_0x9d67('0x45')](handleError(_0x44daa3,null));};function char(_0x5e9cb6){return'number'===typeof _0x5e9cb6?String[_0x9d67('0x5c')][_0x9d67('0x5d')](null,arguments):_0x5e9cb6;}function needsEncapsulation(_0x1409d7){return!!_0x1409d7&&(_0x1409d7[_0x9d67('0x5e')]()[_0x9d67('0x5f')](char(0xd))>=0x0||_0x1409d7[_0x9d67('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x1409d7[_0x9d67('0x5e')]()[_0x9d67('0x5f')](char(0x2c))>=0x0||_0x1409d7['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x5820bd){var _0x19ec7f=char(0x22),_0x15db7b='\x5c'+char(0x22),_0x129303=_0x5820bd['toString']()[_0x9d67('0x60')](new RegExp(_0x19ec7f,'g'),_0x15db7b);return _0x19ec7f+_0x129303+_0x19ec7f;}exports[_0x9d67('0x61')]=function(_0x4c0c28,_0xa2efd1,_0x575145){var _0x4d86c1,_0x58c3df;var _0x30b1e2={'where':{'ProjectId':_0x4c0c28['params']['id']}};if(_0x4c0c28['query'][_0x9d67('0x62')]){_0x30b1e2['where'][_0x9d67('0x63')]=JSON['parse'](_0x4c0c28['query'][_0x9d67('0x62')]);}return db['JscriptySessionReport'][_0x9d67('0x43')](_0x30b1e2)[_0x9d67('0x23')](handleEntityNotFound(_0xa2efd1,null))[_0x9d67('0x23')](function(_0x592ee7){if(_0x592ee7){_0x4d86c1=_0x592ee7;return db['JscriptyQuestionReport'][_0x9d67('0x43')]({'where':{'SessionId':{'$in':_[_0x9d67('0x2b')](_0x4d86c1,'id')},'ProjectId':_0x4c0c28[_0x9d67('0x47')]['id']},'order':_0x9d67('0x64')});}})[_0x9d67('0x23')](handleEntityNotFound(_0xa2efd1,null))[_0x9d67('0x23')](function(_0x13b64a){if(_0x13b64a){_0x58c3df=_0x13b64a;var _0x570b06={};for(var _0x5eecdc=0x0,_0x22601d=_0x58c3df[_0x9d67('0x34')];_0x5eecdc<_0x22601d;_0x5eecdc++){if(!_0x570b06[_0x9d67('0x35')](_0x58c3df[_0x5eecdc][_0x9d67('0x65')])){_0x570b06[_0x58c3df[_0x5eecdc]['questionId']]=needsEncapsulation(_0x58c3df[_0x5eecdc][_0x9d67('0x66')])?encapsulate(_0x58c3df[_0x5eecdc][_0x9d67('0x66')]):_0x58c3df[_0x5eecdc][_0x9d67('0x66')];}}var _0x42a9cf=[],_0x5cb782={};for(var _0x272fad=0x0,_0x5b1b41=_0x4d86c1[_0x9d67('0x34')];_0x272fad<_0x5b1b41;_0x272fad++){_0x5cb782={'ProjectId':_0x4c0c28['params']['id'],'SessionId':_0x4d86c1[_0x272fad]['id'],'StartTime':moment(_0x4d86c1[_0x272fad][_0x9d67('0x63')])[_0x9d67('0x67')](_0x9d67('0x68'))};for(var _0x1ad59f=0x0,_0x3075de=_0x58c3df[_0x9d67('0x34')];_0x1ad59f<_0x3075de;_0x1ad59f++){if(_0x58c3df[_0x1ad59f][_0x9d67('0x69')]==_0x4d86c1[_0x272fad]['id']&&_0x570b06[_0x9d67('0x35')](_0x58c3df[_0x1ad59f][_0x9d67('0x65')])){_0x5cb782[_0x570b06[_0x58c3df[_0x1ad59f][_0x9d67('0x65')]]]=_0x58c3df[_0x1ad59f]['answer'];}}for(var _0x4bca4a in _0x570b06){if(!_0x5cb782[_0x9d67('0x35')](_0x570b06[_0x4bca4a])){_0x5cb782[_0x570b06[_0x4bca4a]]=null;}}_0x42a9cf[_0x9d67('0x6a')](_0x5cb782);}return _0x42a9cf;}})['then'](function(_0xc5c4ef){if(!_[_0x9d67('0x6b')](_0xc5c4ef)){var _0x282fdc=toCsv(_0xc5c4ef);var _0x7bb905=Date[_0x9d67('0x6c')]();fs['writeFileSync'](util['format'](_0x9d67('0x6d'),_0x4c0c28[_0x9d67('0x47')]['id'],_0x7bb905),_0x282fdc);_0xa2efd1[_0x9d67('0x6e')](_0x9d67('0x6f'),'attachment;\x20filename='+util[_0x9d67('0x67')](_0x9d67('0x70'),_0x4c0c28[_0x9d67('0x47')]['id'],_0x7bb905));_0xa2efd1[_0x9d67('0x6e')](_0x9d67('0x71'),'text/csv');return _0xa2efd1[_0x9d67('0x72')](util[_0x9d67('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4c0c28[_0x9d67('0x47')]['id'],_0x7bb905));}else{return _0xa2efd1['sendStatus'](0xcc);}})['catch'](handleError(_0xa2efd1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 0edfdde..537b5da 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 _0x142c=['./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x3c4024,_0x1fb7c9){var _0x20f126=function(_0x572d54){while(--_0x572d54){_0x3c4024['push'](_0x3c4024['shift']());}};_0x20f126(++_0x1fb7c9);}(_0x142c,0x86));var _0xc142=function(_0xad5599,_0x2d489a){_0xad5599=_0xad5599-0x0;var _0x259907=_0x142c[_0xad5599];return _0x259907;};'use strict';var _=require(_0xc142('0x0'));var util=require('util');var logger=require(_0xc142('0x1'))(_0xc142('0x2'));var moment=require(_0xc142('0x3'));var BPromise=require('bluebird');var rp=require(_0xc142('0x4'));var fs=require('fs');var path=require(_0xc142('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc142('0x6'));module['exports']=function(_0x4033e9,_0x53b32f){return _0x4033e9[_0xc142('0x7')](_0xc142('0x8'),attributes,{'tableName':_0xc142('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6334=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x35b251,_0xe4bd2c){var _0x4e1c49=function(_0x506204){while(--_0x506204){_0x35b251['push'](_0x35b251['shift']());}};_0x4e1c49(++_0xe4bd2c);}(_0x6334,0x119));var _0x4633=function(_0x743701,_0x3e67bb){_0x743701=_0x743701-0x0;var _0x5a141d=_0x6334[_0x743701];return _0x5a141d;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var logger=require(_0x4633('0x2'))(_0x4633('0x3'));var moment=require(_0x4633('0x4'));var BPromise=require(_0x4633('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4633('0x6'));var rimraf=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var attributes=require(_0x4633('0x9'));module[_0x4633('0xa')]=function(_0x6493dc,_0x175e14){return _0x6493dc['define'](_0x4633('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 142bf6f..2e1a8da 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x467b39,_0x5297fa){var _0x5a461d=function(_0x20bad9){while(--_0x20bad9){_0x467b39['push'](_0x467b39['shift']());}};_0x5a461d(++_0x5297fa);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x59710f,_0x44c7f0){_0x59710f=_0x59710f-0x0;var _0xaae66a=_0xcb91[_0x59710f];return _0xaae66a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x1200e9,_0x1a23a4){var _0x2c1ac4=function(_0x1e87e4){while(--_0x1e87e4){_0x1200e9['push'](_0x1200e9['shift']());}};_0x2c1ac4(++_0x1a23a4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 197d21b..3ba173c 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 _0xecb9=['put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','create'];(function(_0x5ee0ef,_0x34f2b1){var _0x144aab=function(_0x39f698){while(--_0x39f698){_0x5ee0ef['push'](_0x5ee0ef['shift']());}};_0x144aab(++_0x34f2b1);}(_0xecb9,0x148));var _0x9ecb=function(_0x2c78df,_0x20abba){_0x2c78df=_0x2c78df-0x0;var _0x50912=_0xecb9[_0x2c78df];return _0x50912;};'use strict';var multer=require('multer');var util=require(_0x9ecb('0x0'));var path=require(_0x9ecb('0x1'));var timeout=require(_0x9ecb('0x2'));var express=require(_0x9ecb('0x3'));var router=express[_0x9ecb('0x4')]();var fs_extra=require(_0x9ecb('0x5'));var auth=require(_0x9ecb('0x6'));var interaction=require(_0x9ecb('0x7'));var config=require(_0x9ecb('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x9ecb('0x9')]('/',auth[_0x9ecb('0xa')](),controller['index']);router[_0x9ecb('0x9')](_0x9ecb('0xb'),auth[_0x9ecb('0xa')](),controller[_0x9ecb('0xc')]);router[_0x9ecb('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9ecb('0xa')](),controller[_0x9ecb('0xd')]);router[_0x9ecb('0xe')](_0x9ecb('0xf'),auth[_0x9ecb('0xa')](),controller['update']);router[_0x9ecb('0x10')](_0x9ecb('0xf'),auth['isAuthenticated'](),controller[_0x9ecb('0x11')]);module[_0x9ecb('0x12')]=router; \ No newline at end of file +var _0x0747=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','get','describe','/:id','post','create','put','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x272cd3,_0x4b9a03){var _0x356a60=function(_0x4a1aa6){while(--_0x4a1aa6){_0x272cd3['push'](_0x272cd3['shift']());}};_0x356a60(++_0x4b9a03);}(_0x0747,0x13f));var _0x7074=function(_0x24b988,_0x450e08){_0x24b988=_0x24b988-0x0;var _0x595e06=_0x0747[_0x24b988];return _0x595e06;};'use strict';var multer=require(_0x7074('0x0'));var util=require('util');var path=require(_0x7074('0x1'));var timeout=require('connect-timeout');var express=require(_0x7074('0x2'));var router=express[_0x7074('0x3')]();var fs_extra=require(_0x7074('0x4'));var auth=require(_0x7074('0x5'));var interaction=require(_0x7074('0x6'));var config=require(_0x7074('0x7'));var controller=require(_0x7074('0x8'));router['get']('/',auth[_0x7074('0x9')](),controller['index']);router[_0x7074('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x7074('0xb')]);router[_0x7074('0xa')](_0x7074('0xc'),auth[_0x7074('0x9')](),controller['show']);router[_0x7074('0xd')]('/',auth['isAuthenticated'](),controller[_0x7074('0xe')]);router[_0x7074('0xf')]('/:id',auth[_0x7074('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7074('0x9')](),controller[_0x7074('0x10')]);module[_0x7074('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 471ff16..8799580 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(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0x46c9c6,_0x2c3844){_0x46c9c6=_0x46c9c6-0x0;var _0x36db2f=_0x7a54[_0x46c9c6];return _0x36db2f;};'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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x3f2140,_0xe73a46){_0x3f2140=_0x3f2140-0x0;var _0x4d0de4=_0x7a54[_0x3f2140];return _0x4d0de4;};'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 7b0fb08..9741de7 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 _0x6ced=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x3f1dd3,_0x44683e){var _0x15a415=function(_0x1a7b15){while(--_0x1a7b15){_0x3f1dd3['push'](_0x3f1dd3['shift']());}};_0x15a415(++_0x44683e);}(_0x6ced,0x17d));var _0xd6ce=function(_0x998af6,_0x18882d){_0x998af6=_0x998af6-0x0;var _0x59c22f=_0x6ced[_0x998af6];return _0x59c22f;};'use strict';var emlformat=require(_0xd6ce('0x0'));var rimraf=require(_0xd6ce('0x1'));var zipdir=require(_0xd6ce('0x2'));var jsonpatch=require(_0xd6ce('0x3'));var rp=require(_0xd6ce('0x4'));var moment=require(_0xd6ce('0x5'));var BPromise=require(_0xd6ce('0x6'));var Mustache=require(_0xd6ce('0x7'));var util=require(_0xd6ce('0x8'));var path=require(_0xd6ce('0x9'));var sox=require(_0xd6ce('0xa'));var csv=require(_0xd6ce('0xb'));var ejs=require(_0xd6ce('0xc'));var fs=require('fs');var fs_extra=require(_0xd6ce('0xd'));var _=require(_0xd6ce('0xe'));var squel=require(_0xd6ce('0xf'));var crypto=require(_0xd6ce('0x10'));var jsforce=require(_0xd6ce('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6ce('0x12'));var Papa=require(_0xd6ce('0x13'));var Redis=require('ioredis');var authService=require(_0xd6ce('0x14'));var qs=require(_0xd6ce('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6ce('0x16'));var logger=require(_0xd6ce('0x17'))(_0xd6ce('0x18'));var utils=require(_0xd6ce('0x19'));var config=require(_0xd6ce('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f0f03,_0x43f7b2){_0x43f7b2=_0x43f7b2||0xcc;return function(_0xfe5694){if(_0xfe5694){return _0x4f0f03[_0xd6ce('0x1b')](_0x43f7b2);}return _0x4f0f03[_0xd6ce('0x1c')](_0x43f7b2)[_0xd6ce('0x1d')]();};}function respondWithResult(_0x5991bb,_0x3330f3){_0x3330f3=_0x3330f3||0xc8;return function(_0x4f4f30){if(_0x4f4f30){return _0x5991bb[_0xd6ce('0x1c')](_0x3330f3)['json'](_0x4f4f30);}};}function respondWithFilteredResult(_0x212036,_0x336a6c){return function(_0x2bfa06){if(_0x2bfa06){var _0x2b0dda=typeof _0x336a6c[_0xd6ce('0x1e')]===_0xd6ce('0x1f')&&typeof _0x336a6c[_0xd6ce('0x20')]===_0xd6ce('0x1f');var _0x114e3d=_0x2bfa06[_0xd6ce('0x21')];var _0x2b463f=_0x2b0dda?0x0:_0x336a6c[_0xd6ce('0x1e')];var _0x31fcb6=_0x2b0dda?_0x2bfa06[_0xd6ce('0x21')]:_0x336a6c['offset']+_0x336a6c['limit'];var _0xe80709;if(_0x31fcb6>=_0x114e3d){_0x31fcb6=_0x114e3d;_0xe80709=0xc8;}else{_0xe80709=0xce;}_0x212036[_0xd6ce('0x1c')](_0xe80709);return _0x212036[_0xd6ce('0x22')](_0xd6ce('0x23'),_0x2b463f+'-'+_0x31fcb6+'/'+_0x114e3d)[_0xd6ce('0x24')](_0x2bfa06);}return null;};}function patchUpdates(_0x2e9248){return function(_0x49f011){try{jsonpatch['apply'](_0x49f011,_0x2e9248,!![]);}catch(_0x59b507){return BPromise['reject'](_0x59b507);}return _0x49f011[_0xd6ce('0x25')]();};}function saveUpdates(_0x46e114,_0x38e060){return function(_0x3e4409){if(_0x3e4409){return _0x3e4409[_0xd6ce('0x26')](_0x46e114)[_0xd6ce('0x27')](function(_0x30e2f1){return _0x30e2f1;});}return null;};}function removeEntity(_0x4b13ab,_0x5dd5be){return function(_0x316ab3){if(_0x316ab3){return _0x316ab3[_0xd6ce('0x28')]()[_0xd6ce('0x27')](function(){_0x4b13ab[_0xd6ce('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33030c,_0x327976){return function(_0x143aea){if(!_0x143aea){_0x33030c[_0xd6ce('0x1b')](0x194);}return _0x143aea;};}function handleError(_0x4973ad,_0x5aa154){_0x5aa154=_0x5aa154||0x1f4;return function(_0x16560f){logger[_0xd6ce('0x29')](_0x16560f[_0xd6ce('0x2a')]);if(_0x16560f[_0xd6ce('0x2b')]){delete _0x16560f[_0xd6ce('0x2b')];}_0x4973ad[_0xd6ce('0x1c')](_0x5aa154)[_0xd6ce('0x2c')](_0x16560f);};}exports[_0xd6ce('0x2d')]=function(_0x40cf75,_0x159bd0){var _0x3baa1e={},_0x4214e6={},_0x3409ac={'count':0x0,'rows':[]};var _0x44e094=_[_0xd6ce('0x2e')](db[_0xd6ce('0x2f')][_0xd6ce('0x30')],function(_0x5c6b86){return{'name':_0x5c6b86['fieldName'],'type':_0x5c6b86['type'][_0xd6ce('0x31')]};});_0x4214e6[_0xd6ce('0x32')]=_[_0xd6ce('0x2e')](_0x44e094,_0xd6ce('0x2b'));_0x4214e6[_0xd6ce('0x33')]=_[_0xd6ce('0x34')](_0x40cf75['query']);_0x4214e6[_0xd6ce('0x35')]=_[_0xd6ce('0x36')](_0x4214e6[_0xd6ce('0x32')],_0x4214e6['query']);_0x3baa1e['attributes']=_[_0xd6ce('0x36')](_0x4214e6['model'],qs['fields'](_0x40cf75[_0xd6ce('0x33')][_0xd6ce('0x37')]));_0x3baa1e[_0xd6ce('0x38')]=_0x3baa1e[_0xd6ce('0x38')][_0xd6ce('0x39')]?_0x3baa1e[_0xd6ce('0x38')]:_0x4214e6[_0xd6ce('0x32')];if(!_0x40cf75[_0xd6ce('0x33')][_0xd6ce('0x3a')](_0xd6ce('0x3b'))){_0x3baa1e[_0xd6ce('0x20')]=qs[_0xd6ce('0x20')](_0x40cf75[_0xd6ce('0x33')][_0xd6ce('0x20')]);_0x3baa1e[_0xd6ce('0x1e')]=qs[_0xd6ce('0x1e')](_0x40cf75['query'][_0xd6ce('0x1e')]);}_0x3baa1e[_0xd6ce('0x3c')]=qs[_0xd6ce('0x3d')](_0x40cf75[_0xd6ce('0x33')][_0xd6ce('0x3d')]);_0x3baa1e['where']=qs[_0xd6ce('0x35')](_['pick'](_0x40cf75['query'],_0x4214e6['filters']),_0x44e094);if(_0x40cf75[_0xd6ce('0x33')][_0xd6ce('0x3e')]){_0x3baa1e['where']=_[_0xd6ce('0x3f')](_0x3baa1e[_0xd6ce('0x40')],{'$or':_[_0xd6ce('0x2e')](_0x44e094,function(_0x4b843d){if(_0x4b843d[_0xd6ce('0x41')]!==_0xd6ce('0x42')){var _0x2194a7={};_0x2194a7[_0x4b843d[_0xd6ce('0x2b')]]={'$like':'%'+_0x40cf75[_0xd6ce('0x33')][_0xd6ce('0x3e')]+'%'};return _0x2194a7;}})});}_0x3baa1e=_[_0xd6ce('0x3f')]({},_0x3baa1e,_0x40cf75[_0xd6ce('0x43')]);var _0x1b2c10={'where':_0x3baa1e[_0xd6ce('0x40')]};return db['JscriptyQuestionReport'][_0xd6ce('0x21')](_0x1b2c10)['then'](function(_0x9cd3a0){_0x3409ac[_0xd6ce('0x21')]=_0x9cd3a0;if(_0x40cf75[_0xd6ce('0x33')]['includeAll']){_0x3baa1e[_0xd6ce('0x44')]=[{'all':!![]}];}return db[_0xd6ce('0x2f')][_0xd6ce('0x45')](_0x3baa1e);})[_0xd6ce('0x27')](function(_0x32d441){_0x3409ac[_0xd6ce('0x46')]=_0x32d441;return _0x3409ac;})[_0xd6ce('0x27')](respondWithFilteredResult(_0x159bd0,_0x3baa1e))[_0xd6ce('0x47')](handleError(_0x159bd0,null));};exports[_0xd6ce('0x48')]=function(_0xe9361a,_0x51b6f9){var _0x46a769={'raw':!![],'where':{'id':_0xe9361a[_0xd6ce('0x49')]['id']}},_0x18ae4a={};_0x18ae4a[_0xd6ce('0x32')]=_[_0xd6ce('0x34')](db['JscriptyQuestionReport']['rawAttributes']);_0x18ae4a[_0xd6ce('0x33')]=_[_0xd6ce('0x34')](_0xe9361a[_0xd6ce('0x33')]);_0x18ae4a[_0xd6ce('0x35')]=_[_0xd6ce('0x36')](_0x18ae4a['model'],_0x18ae4a[_0xd6ce('0x33')]);_0x46a769[_0xd6ce('0x38')]=_[_0xd6ce('0x36')](_0x18ae4a['model'],qs['fields'](_0xe9361a['query'][_0xd6ce('0x37')]));_0x46a769['attributes']=_0x46a769[_0xd6ce('0x38')]['length']?_0x46a769[_0xd6ce('0x38')]:_0x18ae4a[_0xd6ce('0x32')];if(_0xe9361a['query']['includeAll']){_0x46a769[_0xd6ce('0x44')]=[{'all':!![]}];}_0x46a769=_[_0xd6ce('0x3f')]({},_0x46a769,_0xe9361a[_0xd6ce('0x43')]);return db[_0xd6ce('0x2f')][_0xd6ce('0x4a')](_0x46a769)[_0xd6ce('0x27')](handleEntityNotFound(_0x51b6f9,null))[_0xd6ce('0x27')](respondWithResult(_0x51b6f9,null))[_0xd6ce('0x47')](handleError(_0x51b6f9,null));};exports[_0xd6ce('0x4b')]=function(_0x2d6420,_0x42a7d0){return db['JscriptyQuestionReport']['create'](_0x2d6420[_0xd6ce('0x4c')],{})[_0xd6ce('0x27')](respondWithResult(_0x42a7d0,0xc9))['catch'](handleError(_0x42a7d0,null));};exports[_0xd6ce('0x26')]=function(_0xb68380,_0x4effaf){if(_0xb68380[_0xd6ce('0x4c')]['id']){delete _0xb68380['body']['id'];}return db[_0xd6ce('0x2f')]['find']({'where':{'id':_0xb68380[_0xd6ce('0x49')]['id']}})['then'](handleEntityNotFound(_0x4effaf,null))[_0xd6ce('0x27')](saveUpdates(_0xb68380[_0xd6ce('0x4c')],null))['then'](respondWithResult(_0x4effaf,null))['catch'](handleError(_0x4effaf,null));};exports[_0xd6ce('0x28')]=function(_0x45b0fc,_0x53b1c5){return db[_0xd6ce('0x2f')][_0xd6ce('0x4a')]({'where':{'id':_0x45b0fc[_0xd6ce('0x49')]['id']}})[_0xd6ce('0x27')](handleEntityNotFound(_0x53b1c5,null))[_0xd6ce('0x27')](removeEntity(_0x53b1c5,null))[_0xd6ce('0x47')](handleError(_0x53b1c5,null));};exports[_0xd6ce('0x4d')]=function(_0x37ac99,_0x564440){return db[_0xd6ce('0x2f')][_0xd6ce('0x4d')]()[_0xd6ce('0x27')](respondWithResult(_0x564440,null))[_0xd6ce('0x47')](handleError(_0x564440,null));}; \ No newline at end of file +var _0x13eb=['rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','include','find','create','body','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','send','index','map','JscriptyQuestionReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13eb,0x16a));var _0xb13e=function(_0x251fa4,_0x3d5860){_0x251fa4=_0x251fa4-0x0;var _0x453047=_0x13eb[_0x251fa4];return _0x453047;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb13e('0x0'));var zipdir=require(_0xb13e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb13e('0x2'));var BPromise=require(_0xb13e('0x3'));var Mustache=require(_0xb13e('0x4'));var util=require(_0xb13e('0x5'));var path=require('path');var sox=require(_0xb13e('0x6'));var csv=require(_0xb13e('0x7'));var ejs=require(_0xb13e('0x8'));var fs=require('fs');var fs_extra=require(_0xb13e('0x9'));var _=require(_0xb13e('0xa'));var squel=require(_0xb13e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb13e('0xc'));var Papa=require(_0xb13e('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb13e('0xe'));var logger=require('../../config/logger')(_0xb13e('0xf'));var utils=require(_0xb13e('0x10'));var config=require(_0xb13e('0x11'));var licenseUtil=require(_0xb13e('0x12'));var db=require(_0xb13e('0x13'))['db'];function respondWithStatusCode(_0x1ed753,_0x1aec3a){_0x1aec3a=_0x1aec3a||0xcc;return function(_0x4741a3){if(_0x4741a3){return _0x1ed753['sendStatus'](_0x1aec3a);}return _0x1ed753[_0xb13e('0x14')](_0x1aec3a)[_0xb13e('0x15')]();};}function respondWithResult(_0xa8d700,_0x3716c2){_0x3716c2=_0x3716c2||0xc8;return function(_0x3ef639){if(_0x3ef639){return _0xa8d700[_0xb13e('0x14')](_0x3716c2)['json'](_0x3ef639);}};}function respondWithFilteredResult(_0x4d2320,_0x520670){return function(_0x3d851c){if(_0x3d851c){var _0x8c8dab=typeof _0x520670[_0xb13e('0x16')]===_0xb13e('0x17')&&typeof _0x520670[_0xb13e('0x18')]===_0xb13e('0x17');var _0x31c123=_0x3d851c['count'];var _0x382fef=_0x8c8dab?0x0:_0x520670[_0xb13e('0x16')];var _0xec49b2=_0x8c8dab?_0x3d851c[_0xb13e('0x19')]:_0x520670[_0xb13e('0x16')]+_0x520670[_0xb13e('0x18')];var _0x259869;if(_0xec49b2>=_0x31c123){_0xec49b2=_0x31c123;_0x259869=0xc8;}else{_0x259869=0xce;}_0x4d2320[_0xb13e('0x14')](_0x259869);return _0x4d2320[_0xb13e('0x1a')](_0xb13e('0x1b'),_0x382fef+'-'+_0xec49b2+'/'+_0x31c123)[_0xb13e('0x1c')](_0x3d851c);}return null;};}function patchUpdates(_0x3418bd){return function(_0x47538f){try{jsonpatch[_0xb13e('0x1d')](_0x47538f,_0x3418bd,!![]);}catch(_0x165724){return BPromise[_0xb13e('0x1e')](_0x165724);}return _0x47538f['save']();};}function saveUpdates(_0x574909,_0xa56dd3){return function(_0x4e9d1f){if(_0x4e9d1f){return _0x4e9d1f[_0xb13e('0x1f')](_0x574909)[_0xb13e('0x20')](function(_0x47bfef){return _0x47bfef;});}return null;};}function removeEntity(_0x2857ac,_0x331480){return function(_0x3943e7){if(_0x3943e7){return _0x3943e7[_0xb13e('0x21')]()[_0xb13e('0x20')](function(){_0x2857ac['status'](0xcc)[_0xb13e('0x15')]();});}};}function handleEntityNotFound(_0x54eb0f,_0x40dcf8){return function(_0x3c7e53){if(!_0x3c7e53){_0x54eb0f['sendStatus'](0x194);}return _0x3c7e53;};}function handleError(_0x2d1122,_0x40102b){_0x40102b=_0x40102b||0x1f4;return function(_0x21cc5a){logger[_0xb13e('0x22')](_0x21cc5a[_0xb13e('0x23')]);if(_0x21cc5a['name']){delete _0x21cc5a['name'];}_0x2d1122['status'](_0x40102b)[_0xb13e('0x24')](_0x21cc5a);};}exports[_0xb13e('0x25')]=function(_0x1b8f4a,_0xa137f1){var _0x48973a={},_0x10fc01={},_0x4827d9={'count':0x0,'rows':[]};var _0xde24d1=_[_0xb13e('0x26')](db[_0xb13e('0x27')][_0xb13e('0x28')],function(_0x530d76){return{'name':_0x530d76[_0xb13e('0x29')],'type':_0x530d76[_0xb13e('0x2a')]['key']};});_0x10fc01[_0xb13e('0x2b')]=_[_0xb13e('0x26')](_0xde24d1,_0xb13e('0x2c'));_0x10fc01['query']=_[_0xb13e('0x2d')](_0x1b8f4a[_0xb13e('0x2e')]);_0x10fc01[_0xb13e('0x2f')]=_[_0xb13e('0x30')](_0x10fc01['model'],_0x10fc01['query']);_0x48973a[_0xb13e('0x31')]=_['intersection'](_0x10fc01[_0xb13e('0x2b')],qs['fields'](_0x1b8f4a[_0xb13e('0x2e')][_0xb13e('0x32')]));_0x48973a[_0xb13e('0x31')]=_0x48973a[_0xb13e('0x31')][_0xb13e('0x33')]?_0x48973a['attributes']:_0x10fc01[_0xb13e('0x2b')];if(!_0x1b8f4a['query']['hasOwnProperty']('nolimit')){_0x48973a['limit']=qs[_0xb13e('0x18')](_0x1b8f4a[_0xb13e('0x2e')][_0xb13e('0x18')]);_0x48973a[_0xb13e('0x16')]=qs[_0xb13e('0x16')](_0x1b8f4a[_0xb13e('0x2e')]['offset']);}_0x48973a[_0xb13e('0x34')]=qs['sort'](_0x1b8f4a['query']['sort']);_0x48973a[_0xb13e('0x35')]=qs['filters'](_[_0xb13e('0x36')](_0x1b8f4a[_0xb13e('0x2e')],_0x10fc01['filters']),_0xde24d1);if(_0x1b8f4a[_0xb13e('0x2e')][_0xb13e('0x37')]){_0x48973a[_0xb13e('0x35')]=_[_0xb13e('0x38')](_0x48973a[_0xb13e('0x35')],{'$or':_[_0xb13e('0x26')](_0xde24d1,function(_0x2cd43d){if(_0x2cd43d['type']!==_0xb13e('0x39')){var _0x508079={};_0x508079[_0x2cd43d[_0xb13e('0x2c')]]={'$like':'%'+_0x1b8f4a[_0xb13e('0x2e')][_0xb13e('0x37')]+'%'};return _0x508079;}})});}_0x48973a=_[_0xb13e('0x38')]({},_0x48973a,_0x1b8f4a[_0xb13e('0x3a')]);var _0xda96b9={'where':_0x48973a[_0xb13e('0x35')]};return db[_0xb13e('0x27')][_0xb13e('0x19')](_0xda96b9)['then'](function(_0x1bef59){_0x4827d9[_0xb13e('0x19')]=_0x1bef59;if(_0x1b8f4a[_0xb13e('0x2e')]['includeAll']){_0x48973a['include']=[{'all':!![]}];}return db[_0xb13e('0x27')][_0xb13e('0x3b')](_0x48973a);})['then'](function(_0x2400f9){_0x4827d9['rows']=_0x2400f9;return _0x4827d9;})[_0xb13e('0x20')](respondWithFilteredResult(_0xa137f1,_0x48973a))[_0xb13e('0x3c')](handleError(_0xa137f1,null));};exports[_0xb13e('0x3d')]=function(_0x49e159,_0x2a69d4){var _0x391a66={'raw':!![],'where':{'id':_0x49e159[_0xb13e('0x3e')]['id']}},_0xf4a34={};_0xf4a34[_0xb13e('0x2b')]=_[_0xb13e('0x2d')](db[_0xb13e('0x27')][_0xb13e('0x28')]);_0xf4a34[_0xb13e('0x2e')]=_['keys'](_0x49e159['query']);_0xf4a34[_0xb13e('0x2f')]=_[_0xb13e('0x30')](_0xf4a34[_0xb13e('0x2b')],_0xf4a34[_0xb13e('0x2e')]);_0x391a66[_0xb13e('0x31')]=_[_0xb13e('0x30')](_0xf4a34['model'],qs[_0xb13e('0x32')](_0x49e159[_0xb13e('0x2e')][_0xb13e('0x32')]));_0x391a66[_0xb13e('0x31')]=_0x391a66['attributes'][_0xb13e('0x33')]?_0x391a66['attributes']:_0xf4a34[_0xb13e('0x2b')];if(_0x49e159[_0xb13e('0x2e')]['includeAll']){_0x391a66[_0xb13e('0x3f')]=[{'all':!![]}];}_0x391a66=_[_0xb13e('0x38')]({},_0x391a66,_0x49e159[_0xb13e('0x3a')]);return db['JscriptyQuestionReport'][_0xb13e('0x40')](_0x391a66)[_0xb13e('0x20')](handleEntityNotFound(_0x2a69d4,null))['then'](respondWithResult(_0x2a69d4,null))['catch'](handleError(_0x2a69d4,null));};exports[_0xb13e('0x41')]=function(_0x1044f6,_0x21c57e){return db[_0xb13e('0x27')][_0xb13e('0x41')](_0x1044f6[_0xb13e('0x42')],{})['then'](respondWithResult(_0x21c57e,0xc9))['catch'](handleError(_0x21c57e,null));};exports[_0xb13e('0x1f')]=function(_0x4a7e02,_0x2ba58e){if(_0x4a7e02[_0xb13e('0x42')]['id']){delete _0x4a7e02[_0xb13e('0x42')]['id'];}return db[_0xb13e('0x27')]['find']({'where':{'id':_0x4a7e02['params']['id']}})[_0xb13e('0x20')](handleEntityNotFound(_0x2ba58e,null))[_0xb13e('0x20')](saveUpdates(_0x4a7e02[_0xb13e('0x42')],null))['then'](respondWithResult(_0x2ba58e,null))[_0xb13e('0x3c')](handleError(_0x2ba58e,null));};exports['destroy']=function(_0x2c5260,_0x562d88){return db[_0xb13e('0x27')][_0xb13e('0x40')]({'where':{'id':_0x2c5260['params']['id']}})[_0xb13e('0x20')](handleEntityNotFound(_0x562d88,null))[_0xb13e('0x20')](removeEntity(_0x562d88,null))[_0xb13e('0x3c')](handleError(_0x562d88,null));};exports['describe']=function(_0x3f9260,_0x3d82ac){return db[_0xb13e('0x27')]['describe']()[_0xb13e('0x20')](respondWithResult(_0x3d82ac,null))[_0xb13e('0x3c')](handleError(_0x3d82ac,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7063729..ea89e5c 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 _0x2305=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','report_jscripty_questions','util','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2305,0x85));var _0x5230=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x2305[_0x35007a];return _0x574f68;};'use strict';var _=require('lodash');var util=require(_0x5230('0x0'));var logger=require('../../config/logger')(_0x5230('0x1'));var moment=require('moment');var BPromise=require(_0x5230('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5230('0x3'));var config=require(_0x5230('0x4'));var attributes=require(_0x5230('0x5'));module['exports']=function(_0x12c688,_0x5429e3){return _0x12c688[_0x5230('0x6')]('JscriptyQuestionReport',attributes,{'tableName':_0x5230('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fd6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x39908f,_0x4cc30b){var _0x21eb27=function(_0x35bb4f){while(--_0x35bb4f){_0x39908f['push'](_0x39908f['shift']());}};_0x21eb27(++_0x4cc30b);}(_0x7fd6,0xb6));var _0x67fd=function(_0x26388a,_0x619848){_0x26388a=_0x26388a-0x0;var _0x5f98c3=_0x7fd6[_0x26388a];return _0x5f98c3;};'use strict';var _=require(_0x67fd('0x0'));var util=require(_0x67fd('0x1'));var logger=require(_0x67fd('0x2'))(_0x67fd('0x3'));var moment=require(_0x67fd('0x4'));var BPromise=require(_0x67fd('0x5'));var rp=require(_0x67fd('0x6'));var fs=require('fs');var path=require(_0x67fd('0x7'));var rimraf=require(_0x67fd('0x8'));var config=require(_0x67fd('0x9'));var attributes=require(_0x67fd('0xa'));module['exports']=function(_0x33c9cc,_0x43db20){return _0x33c9cc['define'](_0x67fd('0xb'),attributes,{'tableName':_0x67fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 0ada764..2f818bb 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 _0x8daf=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x5b2096,_0x213141){var _0x198357=function(_0x5afe77){while(--_0x5afe77){_0x5b2096['push'](_0x5b2096['shift']());}};_0x198357(++_0x213141);}(_0x8daf,0xab));var _0xf8da=function(_0x5b67cc,_0x59aafd){_0x5b67cc=_0x5b67cc-0x0;var _0x11ed5a=_0x8daf[_0x5b67cc];return _0x11ed5a;};'use strict';var _=require(_0xf8da('0x0'));var util=require(_0xf8da('0x1'));var moment=require(_0xf8da('0x2'));var BPromise=require(_0xf8da('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8da('0x4'))['db'];var utils=require(_0xf8da('0x5'));var logger=require(_0xf8da('0x6'))(_0xf8da('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8da('0x8'));var client=jayson[_0xf8da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7e32a5,_0x2e21e4,_0x42a54b){return new BPromise(function(_0x2d04ed,_0x406850){return client[_0xf8da('0xa')](_0x7e32a5,_0x42a54b)[_0xf8da('0xb')](function(_0x52f53c){logger[_0xf8da('0xc')](_0xf8da('0xd'),_0x2e21e4,_0xf8da('0xe'));logger[_0xf8da('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x2e21e4,_0xf8da('0xe'),JSON[_0xf8da('0x10')](_0x52f53c));if(_0x52f53c[_0xf8da('0x11')]){if(_0x52f53c[_0xf8da('0x11')][_0xf8da('0x12')]===0x1f4){logger[_0xf8da('0x11')](_0xf8da('0xd'),_0x2e21e4,_0x52f53c[_0xf8da('0x11')][_0xf8da('0x13')]);return _0x406850(_0x52f53c[_0xf8da('0x11')][_0xf8da('0x13')]);}logger[_0xf8da('0x11')](_0xf8da('0xd'),_0x2e21e4,_0x52f53c[_0xf8da('0x11')]['message']);return _0x2d04ed(_0x52f53c[_0xf8da('0x11')][_0xf8da('0x13')]);}else{logger[_0xf8da('0xc')](_0xf8da('0xd'),_0x2e21e4,'request\x20sent');_0x2d04ed(_0x52f53c[_0xf8da('0x14')]['message']);}})[_0xf8da('0x15')](function(_0x298210){logger[_0xf8da('0x11')](_0xf8da('0xd'),_0x2e21e4,_0x298210);_0x406850(_0x298210);});});} \ No newline at end of file +var _0xcba7=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5ac280,_0x46dfe7){var _0x390ebb=function(_0x4e66d8){while(--_0x4e66d8){_0x5ac280['push'](_0x5ac280['shift']());}};_0x390ebb(++_0x46dfe7);}(_0xcba7,0x170));var _0x7cba=function(_0x405ac9,_0x2c795c){_0x405ac9=_0x405ac9-0x0;var _0x2d200f=_0xcba7[_0x405ac9];return _0x2d200f;};'use strict';var _=require(_0x7cba('0x0'));var util=require(_0x7cba('0x1'));var moment=require(_0x7cba('0x2'));var BPromise=require(_0x7cba('0x3'));var rs=require(_0x7cba('0x4'));var fs=require('fs');var Redis=require(_0x7cba('0x5'));var db=require(_0x7cba('0x6'))['db'];var utils=require(_0x7cba('0x7'));var logger=require(_0x7cba('0x8'))(_0x7cba('0x9'));var config=require(_0x7cba('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7cba('0xb')][_0x7cba('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x16c52a,_0x574a6b,_0x35ffaa){return new BPromise(function(_0x269c71,_0x1c1641){return client[_0x7cba('0xd')](_0x16c52a,_0x35ffaa)[_0x7cba('0xe')](function(_0x216d02){logger[_0x7cba('0xf')](_0x7cba('0x10'),_0x574a6b,_0x7cba('0x11'));logger[_0x7cba('0x12')](_0x7cba('0x13'),_0x574a6b,_0x7cba('0x11'),JSON[_0x7cba('0x14')](_0x216d02));if(_0x216d02[_0x7cba('0x15')]){if(_0x216d02['error'][_0x7cba('0x16')]===0x1f4){logger['error'](_0x7cba('0x10'),_0x574a6b,_0x216d02[_0x7cba('0x15')]['message']);return _0x1c1641(_0x216d02[_0x7cba('0x15')]['message']);}logger[_0x7cba('0x15')](_0x7cba('0x10'),_0x574a6b,_0x216d02[_0x7cba('0x15')][_0x7cba('0x17')]);return _0x269c71(_0x216d02['error'][_0x7cba('0x17')]);}else{logger[_0x7cba('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x574a6b,'request\x20sent');_0x269c71(_0x216d02[_0x7cba('0x18')][_0x7cba('0x17')]);}})[_0x7cba('0x19')](function(_0x426551){logger[_0x7cba('0x15')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x574a6b,_0x426551);_0x1c1641(_0x426551);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 483aaa7..621e64f 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 _0x4621=['describe','/:id','show','/:id/questions','getQuestions','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index'];(function(_0x237aab,_0x523604){var _0x55b525=function(_0x2336f1){while(--_0x2336f1){_0x237aab['push'](_0x237aab['shift']());}};_0x55b525(++_0x523604);}(_0x4621,0x73));var _0x1462=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4621[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x1462('0x0'));var util=require(_0x1462('0x1'));var path=require(_0x1462('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1462('0x3')]();var fs_extra=require(_0x1462('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1462('0x5'));var config=require(_0x1462('0x6'));var controller=require(_0x1462('0x7'));router[_0x1462('0x8')]('/',auth[_0x1462('0x9')](),controller[_0x1462('0xa')]);router[_0x1462('0x8')]('/describe',auth[_0x1462('0x9')](),controller[_0x1462('0xb')]);router[_0x1462('0x8')](_0x1462('0xc'),auth['isAuthenticated'](),controller[_0x1462('0xd')]);router[_0x1462('0x8')](_0x1462('0xe'),auth[_0x1462('0x9')](),controller[_0x1462('0xf')]);router['post']('/',auth[_0x1462('0x9')](),controller[_0x1462('0x10')]);router[_0x1462('0x11')](_0x1462('0xc'),auth[_0x1462('0x9')](),controller['update']);router[_0x1462('0x12')](_0x1462('0xc'),auth[_0x1462('0x9')](),controller[_0x1462('0x13')]);module[_0x1462('0x14')]=router; \ No newline at end of file +var _0x3648=['../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/questions','post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4101d6,_0x4906a2){var _0x48c5d6=function(_0x7936d2){while(--_0x7936d2){_0x4101d6['push'](_0x4101d6['shift']());}};_0x48c5d6(++_0x4906a2);}(_0x3648,0x16f));var _0x8364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3648[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x8364('0x0'));var path=require('path');var timeout=require(_0x8364('0x1'));var express=require(_0x8364('0x2'));var router=express[_0x8364('0x3')]();var fs_extra=require(_0x8364('0x4'));var auth=require(_0x8364('0x5'));var interaction=require(_0x8364('0x6'));var config=require(_0x8364('0x7'));var controller=require(_0x8364('0x8'));router[_0x8364('0x9')]('/',auth[_0x8364('0xa')](),controller[_0x8364('0xb')]);router[_0x8364('0x9')](_0x8364('0xc'),auth[_0x8364('0xa')](),controller[_0x8364('0xd')]);router[_0x8364('0x9')](_0x8364('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x8364('0x9')](_0x8364('0xf'),auth[_0x8364('0xa')](),controller['getQuestions']);router[_0x8364('0x10')]('/',auth['isAuthenticated'](),controller[_0x8364('0x11')]);router[_0x8364('0x12')](_0x8364('0xe'),auth[_0x8364('0xa')](),controller['update']);router[_0x8364('0x13')](_0x8364('0xe'),auth[_0x8364('0xa')](),controller[_0x8364('0x14')]);module[_0x8364('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 08e79a5..1d1692e 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 _0xbff5=['STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x34b2a2,_0xa487b9){var _0x484614=function(_0x490ab7){while(--_0x490ab7){_0x34b2a2['push'](_0x34b2a2['shift']());}};_0x484614(++_0xa487b9);}(_0xbff5,0x86));var _0x5bff=function(_0xd4955,_0x5b6fc3){_0xd4955=_0xd4955-0x0;var _0x22622a=_0xbff5[_0xd4955];return _0x22622a;};'use strict';var moment=require(_0x5bff('0x0'));var Sequelize=require(_0x5bff('0x1'));module[_0x5bff('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x3753f1){this[_0x5bff('0x3')](_0x5bff('0x4'),_0x3753f1);this['setDataValue'](_0x5bff('0x5'),moment()[_0x5bff('0x6')](_0x5bff('0x7')));}},'endtime':{'type':Sequelize[_0x5bff('0x8')]},'membername':{'type':Sequelize[_0x5bff('0x9')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x5bff('0x9')]},'uniqueid':{'type':Sequelize[_0x5bff('0x9')]},'calleridname':{'type':Sequelize[_0x5bff('0x9')]},'calleridnum':{'type':Sequelize[_0x5bff('0x9')]},'completed':{'type':Sequelize[_0x5bff('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0xb3f8=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0xb3f8,0xab));var _0x8b3f=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0xb3f8[_0x5ce15c];return _0x36e4f5;};'use strict';var moment=require(_0x8b3f('0x0'));var Sequelize=require(_0x8b3f('0x1'));module[_0x8b3f('0x2')]={'starttime':{'type':Sequelize[_0x8b3f('0x3')],'set':function(_0xdffdf9){this[_0x8b3f('0x4')](_0x8b3f('0x5'),_0xdffdf9);this[_0x8b3f('0x4')](_0x8b3f('0x6'),moment()[_0x8b3f('0x7')](_0x8b3f('0x8')));}},'endtime':{'type':Sequelize[_0x8b3f('0x3')]},'membername':{'type':Sequelize[_0x8b3f('0x9')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8b3f('0x9')]},'uniqueid':{'type':Sequelize[_0x8b3f('0x9')]},'calleridname':{'type':Sequelize[_0x8b3f('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x8b3f('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index e2d828a..615fb5c 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 _0x2583=['sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','findOne','JscriptyQuestionReport','nolimit','SessionId','eml-format','zip-dir','moment','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length'];(function(_0x5cf004,_0x50a6dc){var _0x42df03=function(_0x5a98ce){while(--_0x5a98ce){_0x5cf004['push'](_0x5cf004['shift']());}};_0x42df03(++_0x50a6dc);}(_0x2583,0x142));var _0x3258=function(_0x4f7735,_0x4dd787){_0x4f7735=_0x4f7735-0x0;var _0x2f9bb3=_0x2583[_0x4f7735];return _0x2f9bb3;};'use strict';var emlformat=require(_0x3258('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3258('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3258('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3258('0x3'));var util=require('util');var path=require(_0x3258('0x4'));var sox=require('sox');var csv=require(_0x3258('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3258('0x6'));var _=require(_0x3258('0x7'));var squel=require(_0x3258('0x8'));var crypto=require('crypto');var jsforce=require(_0x3258('0x9'));var deskjs=require(_0x3258('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3258('0xb'));var Redis=require(_0x3258('0xc'));var authService=require(_0x3258('0xd'));var qs=require(_0x3258('0xe'));var as=require(_0x3258('0xf'));var hardwareService=require(_0x3258('0x10'));var logger=require(_0x3258('0x11'))(_0x3258('0x12'));var utils=require(_0x3258('0x13'));var config=require(_0x3258('0x14'));var licenseUtil=require(_0x3258('0x15'));var db=require(_0x3258('0x16'))['db'];function respondWithStatusCode(_0x416c47,_0x5cd7c9){_0x5cd7c9=_0x5cd7c9||0xcc;return function(_0x20c966){if(_0x20c966){return _0x416c47[_0x3258('0x17')](_0x5cd7c9);}return _0x416c47[_0x3258('0x18')](_0x5cd7c9)[_0x3258('0x19')]();};}function respondWithResult(_0x3b701b,_0x4db7d1){_0x4db7d1=_0x4db7d1||0xc8;return function(_0x4e6df6){if(_0x4e6df6){return _0x3b701b['status'](_0x4db7d1)[_0x3258('0x1a')](_0x4e6df6);}};}function respondWithFilteredResult(_0x23a647,_0x403a53){return function(_0x4a6d99){if(_0x4a6d99){var _0x152ae3=typeof _0x403a53['offset']==='undefined'&&typeof _0x403a53[_0x3258('0x1b')]==='undefined';var _0x55ec8e=_0x4a6d99['count'];var _0x1caef3=_0x152ae3?0x0:_0x403a53[_0x3258('0x1c')];var _0x331dcf=_0x152ae3?_0x4a6d99[_0x3258('0x1d')]:_0x403a53[_0x3258('0x1c')]+_0x403a53[_0x3258('0x1b')];var _0xf5be28;if(_0x331dcf>=_0x55ec8e){_0x331dcf=_0x55ec8e;_0xf5be28=0xc8;}else{_0xf5be28=0xce;}_0x23a647[_0x3258('0x18')](_0xf5be28);return _0x23a647['set']('Content-Range',_0x1caef3+'-'+_0x331dcf+'/'+_0x55ec8e)[_0x3258('0x1a')](_0x4a6d99);}return null;};}function patchUpdates(_0x2ae1af){return function(_0x285a18){try{jsonpatch[_0x3258('0x1e')](_0x285a18,_0x2ae1af,!![]);}catch(_0x4993a5){return BPromise[_0x3258('0x1f')](_0x4993a5);}return _0x285a18[_0x3258('0x20')]();};}function saveUpdates(_0x335ec7,_0x1e203f){return function(_0x1229fa){if(_0x1229fa){return _0x1229fa[_0x3258('0x21')](_0x335ec7)[_0x3258('0x22')](function(_0x5d07f1){return _0x5d07f1;});}return null;};}function removeEntity(_0x5e4f7d,_0x4176ec){return function(_0x5dcd12){if(_0x5dcd12){return _0x5dcd12[_0x3258('0x23')]()[_0x3258('0x22')](function(){_0x5e4f7d[_0x3258('0x18')](0xcc)[_0x3258('0x19')]();});}};}function handleEntityNotFound(_0x5e4cb5,_0x47cd0f){return function(_0x1b55f9){if(!_0x1b55f9){_0x5e4cb5['sendStatus'](0x194);}return _0x1b55f9;};}function handleError(_0x35e141,_0x295f65){_0x295f65=_0x295f65||0x1f4;return function(_0x13bff2){logger[_0x3258('0x24')](_0x13bff2['stack']);if(_0x13bff2[_0x3258('0x25')]){delete _0x13bff2[_0x3258('0x25')];}_0x35e141['status'](_0x295f65)[_0x3258('0x26')](_0x13bff2);};}exports[_0x3258('0x27')]=function(_0x124ba,_0x4c3d43){var _0x37561={},_0x4a6e64={},_0x5a1307={'count':0x0,'rows':[]};var _0x3a3fb2=_[_0x3258('0x28')](db[_0x3258('0x29')][_0x3258('0x2a')],function(_0x17042){return{'name':_0x17042[_0x3258('0x2b')],'type':_0x17042[_0x3258('0x2c')][_0x3258('0x2d')]};});_0x4a6e64[_0x3258('0x2e')]=_[_0x3258('0x28')](_0x3a3fb2,_0x3258('0x25'));_0x4a6e64[_0x3258('0x2f')]=_[_0x3258('0x30')](_0x124ba[_0x3258('0x2f')]);_0x4a6e64['filters']=_['intersection'](_0x4a6e64[_0x3258('0x2e')],_0x4a6e64[_0x3258('0x2f')]);_0x37561['attributes']=_[_0x3258('0x31')](_0x4a6e64['model'],qs[_0x3258('0x32')](_0x124ba[_0x3258('0x2f')]['fields']));_0x37561['attributes']=_0x37561[_0x3258('0x33')][_0x3258('0x34')]?_0x37561[_0x3258('0x33')]:_0x4a6e64[_0x3258('0x2e')];if(!_0x124ba[_0x3258('0x2f')]['hasOwnProperty']('nolimit')){_0x37561[_0x3258('0x1b')]=qs[_0x3258('0x1b')](_0x124ba[_0x3258('0x2f')][_0x3258('0x1b')]);_0x37561[_0x3258('0x1c')]=qs[_0x3258('0x1c')](_0x124ba[_0x3258('0x2f')][_0x3258('0x1c')]);}_0x37561['order']=qs[_0x3258('0x35')](_0x124ba['query'][_0x3258('0x35')]);_0x37561[_0x3258('0x36')]=qs[_0x3258('0x37')](_[_0x3258('0x38')](_0x124ba['query'],_0x4a6e64[_0x3258('0x37')]),_0x3a3fb2);if(_0x124ba['query'][_0x3258('0x39')]){_0x37561[_0x3258('0x36')]=_['merge'](_0x37561[_0x3258('0x36')],{'$or':_[_0x3258('0x28')](_0x3a3fb2,function(_0x2753a5){if(_0x2753a5[_0x3258('0x2c')]!=='VIRTUAL'){var _0x2678e4={};_0x2678e4[_0x2753a5[_0x3258('0x25')]]={'$like':'%'+_0x124ba[_0x3258('0x2f')][_0x3258('0x39')]+'%'};return _0x2678e4;}})});}_0x37561=_[_0x3258('0x3a')]({},_0x37561,_0x124ba[_0x3258('0x3b')]);var _0x52da5c={'where':_0x37561[_0x3258('0x36')]};return db[_0x3258('0x29')][_0x3258('0x1d')](_0x52da5c)['then'](function(_0x4574f6){_0x5a1307[_0x3258('0x1d')]=_0x4574f6;if(_0x124ba[_0x3258('0x2f')]['includeAll']){_0x37561[_0x3258('0x3c')]=[{'all':!![]}];}return db[_0x3258('0x29')][_0x3258('0x3d')](_0x37561);})['then'](function(_0x22da79){_0x5a1307[_0x3258('0x3e')]=_0x22da79;return _0x5a1307;})[_0x3258('0x22')](respondWithFilteredResult(_0x4c3d43,_0x37561))[_0x3258('0x3f')](handleError(_0x4c3d43,null));};exports[_0x3258('0x40')]=function(_0x54d6ac,_0xc4ec10){var _0x5153d5={'raw':!![],'where':{'id':_0x54d6ac['params']['id']}},_0x304a25={};_0x304a25[_0x3258('0x2e')]=_[_0x3258('0x30')](db[_0x3258('0x29')][_0x3258('0x2a')]);_0x304a25['query']=_[_0x3258('0x30')](_0x54d6ac['query']);_0x304a25[_0x3258('0x37')]=_[_0x3258('0x31')](_0x304a25[_0x3258('0x2e')],_0x304a25['query']);_0x5153d5[_0x3258('0x33')]=_['intersection'](_0x304a25[_0x3258('0x2e')],qs[_0x3258('0x32')](_0x54d6ac[_0x3258('0x2f')][_0x3258('0x32')]));_0x5153d5[_0x3258('0x33')]=_0x5153d5[_0x3258('0x33')][_0x3258('0x34')]?_0x5153d5[_0x3258('0x33')]:_0x304a25[_0x3258('0x2e')];if(_0x54d6ac['query'][_0x3258('0x41')]){_0x5153d5['include']=[{'all':!![]}];}_0x5153d5=_[_0x3258('0x3a')]({},_0x5153d5,_0x54d6ac[_0x3258('0x3b')]);return db[_0x3258('0x29')][_0x3258('0x42')](_0x5153d5)[_0x3258('0x22')](handleEntityNotFound(_0xc4ec10,null))[_0x3258('0x22')](respondWithResult(_0xc4ec10,null))[_0x3258('0x3f')](handleError(_0xc4ec10,null));};exports['create']=function(_0x2a3422,_0x45b10f){return db[_0x3258('0x29')][_0x3258('0x43')](_0x2a3422[_0x3258('0x44')],{})[_0x3258('0x22')](respondWithResult(_0x45b10f,0xc9))['catch'](handleError(_0x45b10f,null));};exports[_0x3258('0x21')]=function(_0x4b40f1,_0x4a2318){if(_0x4b40f1[_0x3258('0x44')]['id']){delete _0x4b40f1['body']['id'];}return db[_0x3258('0x29')][_0x3258('0x42')]({'where':{'id':_0x4b40f1[_0x3258('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a2318,null))[_0x3258('0x22')](saveUpdates(_0x4b40f1[_0x3258('0x44')],null))[_0x3258('0x22')](respondWithResult(_0x4a2318,null))[_0x3258('0x3f')](handleError(_0x4a2318,null));};exports[_0x3258('0x23')]=function(_0x5aa9be,_0xeb0525){return db[_0x3258('0x29')][_0x3258('0x42')]({'where':{'id':_0x5aa9be['params']['id']}})[_0x3258('0x22')](handleEntityNotFound(_0xeb0525,null))['then'](removeEntity(_0xeb0525,null))[_0x3258('0x3f')](handleError(_0xeb0525,null));};exports[_0x3258('0x46')]=function(_0x5d0d29,_0x790936){return db[_0x3258('0x29')][_0x3258('0x46')]()[_0x3258('0x22')](respondWithResult(_0x790936,null))[_0x3258('0x3f')](handleError(_0x790936,null));};exports['getQuestions']=function(_0x51f543,_0x5b3da6,_0x16bf11){var _0x487225={'raw':!![],'where':{}};var _0x57bb3f={};var _0x389152={'count':0x0,'rows':[]};return db[_0x3258('0x29')][_0x3258('0x47')]({'where':{'id':_0x51f543['params']['id']}})[_0x3258('0x22')](handleEntityNotFound(_0x5b3da6,null))[_0x3258('0x22')](function(_0x5de7dd){if(_0x5de7dd){_0x57bb3f[_0x3258('0x2e')]=_[_0x3258('0x30')](db[_0x3258('0x48')][_0x3258('0x2a')]);_0x57bb3f[_0x3258('0x2f')]=_['keys'](_0x51f543[_0x3258('0x2f')]);_0x57bb3f[_0x3258('0x37')]=_[_0x3258('0x31')](_0x57bb3f[_0x3258('0x2e')],_0x57bb3f['query']);_0x487225[_0x3258('0x33')]=_[_0x3258('0x31')](_0x57bb3f[_0x3258('0x2e')],qs[_0x3258('0x32')](_0x51f543[_0x3258('0x2f')]['fields']));_0x487225['attributes']=_0x487225[_0x3258('0x33')][_0x3258('0x34')]?_0x487225[_0x3258('0x33')]:_0x57bb3f[_0x3258('0x2e')];if(!_0x51f543['query']['hasOwnProperty'](_0x3258('0x49'))){_0x487225['limit']=qs[_0x3258('0x1b')](_0x51f543[_0x3258('0x2f')][_0x3258('0x1b')]);_0x487225[_0x3258('0x1c')]=qs[_0x3258('0x1c')](_0x51f543['query'][_0x3258('0x1c')]);}_0x487225['order']=qs[_0x3258('0x35')](_0x51f543[_0x3258('0x2f')][_0x3258('0x35')]);_0x487225[_0x3258('0x36')]=qs[_0x3258('0x37')](_[_0x3258('0x38')](_0x51f543['query'],_0x57bb3f['filters']));_0x487225[_0x3258('0x36')][_0x3258('0x4a')]=_0x5de7dd['id'];if(_0x51f543[_0x3258('0x2f')][_0x3258('0x39')]){_0x487225['where']=_[_0x3258('0x3a')](_0x487225[_0x3258('0x36')],{'$or':_[_0x3258('0x28')](_0x487225[_0x3258('0x33')],function(_0x60825f){var _0x174d8d={};_0x174d8d[_0x60825f]={'$like':'%'+_0x51f543[_0x3258('0x2f')][_0x3258('0x39')]+'%'};return _0x174d8d;})});}_0x487225=_[_0x3258('0x3a')]({},_0x487225,_0x51f543[_0x3258('0x3b')]);return db['JscriptyQuestionReport'][_0x3258('0x1d')]({'where':_0x487225[_0x3258('0x36')]})[_0x3258('0x22')](function(_0x263e00){_0x389152['count']=_0x263e00;if(_0x51f543[_0x3258('0x2f')][_0x3258('0x41')]){_0x487225[_0x3258('0x3c')]=[{'all':!![]}];}return db[_0x3258('0x48')][_0x3258('0x3d')](_0x487225);})['then'](function(_0x4d6f1e){_0x389152[_0x3258('0x3e')]=_0x4d6f1e;return _0x389152;});}})[_0x3258('0x22')](respondWithFilteredResult(_0x5b3da6,_0x487225))[_0x3258('0x3f')](handleError(_0x5b3da6,null));}; \ No newline at end of file +var _0x7f4d=['mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','save','update','then','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','describe','getQuestions','findOne','nolimit','pick','filter','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x7f4d,0x9c));var _0xd7f4=function(_0x33890d,_0x4bd354){_0x33890d=_0x33890d-0x0;var _0x283352=_0x7f4d[_0x33890d];return _0x283352;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd7f4('0x0'));var zipdir=require(_0xd7f4('0x1'));var jsonpatch=require(_0xd7f4('0x2'));var rp=require(_0xd7f4('0x3'));var moment=require(_0xd7f4('0x4'));var BPromise=require(_0xd7f4('0x5'));var Mustache=require(_0xd7f4('0x6'));var util=require(_0xd7f4('0x7'));var path=require('path');var sox=require(_0xd7f4('0x8'));var csv=require('to-csv');var ejs=require(_0xd7f4('0x9'));var fs=require('fs');var fs_extra=require(_0xd7f4('0xa'));var _=require(_0xd7f4('0xb'));var squel=require(_0xd7f4('0xc'));var crypto=require(_0xd7f4('0xd'));var jsforce=require(_0xd7f4('0xe'));var deskjs=require(_0xd7f4('0xf'));var toCsv=require(_0xd7f4('0x10'));var querystring=require(_0xd7f4('0x11'));var Papa=require(_0xd7f4('0x12'));var Redis=require(_0xd7f4('0x13'));var authService=require(_0xd7f4('0x14'));var qs=require(_0xd7f4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7f4('0x16'))(_0xd7f4('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd7f4('0x18'))['db'];function respondWithStatusCode(_0x444c12,_0x583d28){_0x583d28=_0x583d28||0xcc;return function(_0x1aaed7){if(_0x1aaed7){return _0x444c12[_0xd7f4('0x19')](_0x583d28);}return _0x444c12['status'](_0x583d28)[_0xd7f4('0x1a')]();};}function respondWithResult(_0x26b8fe,_0x572bc7){_0x572bc7=_0x572bc7||0xc8;return function(_0x18a788){if(_0x18a788){return _0x26b8fe['status'](_0x572bc7)[_0xd7f4('0x1b')](_0x18a788);}};}function respondWithFilteredResult(_0x595179,_0x1e2530){return function(_0x2b0cca){if(_0x2b0cca){var _0x2679f4=typeof _0x1e2530[_0xd7f4('0x1c')]==='undefined'&&typeof _0x1e2530['limit']===_0xd7f4('0x1d');var _0x5f0b76=_0x2b0cca['count'];var _0x53346f=_0x2679f4?0x0:_0x1e2530[_0xd7f4('0x1c')];var _0x472d08=_0x2679f4?_0x2b0cca[_0xd7f4('0x1e')]:_0x1e2530[_0xd7f4('0x1c')]+_0x1e2530[_0xd7f4('0x1f')];var _0x50496e;if(_0x472d08>=_0x5f0b76){_0x472d08=_0x5f0b76;_0x50496e=0xc8;}else{_0x50496e=0xce;}_0x595179[_0xd7f4('0x20')](_0x50496e);return _0x595179[_0xd7f4('0x21')](_0xd7f4('0x22'),_0x53346f+'-'+_0x472d08+'/'+_0x5f0b76)[_0xd7f4('0x1b')](_0x2b0cca);}return null;};}function patchUpdates(_0x4af4d2){return function(_0xb14952){try{jsonpatch[_0xd7f4('0x23')](_0xb14952,_0x4af4d2,!![]);}catch(_0x154012){return BPromise['reject'](_0x154012);}return _0xb14952[_0xd7f4('0x24')]();};}function saveUpdates(_0x20075e,_0x173b95){return function(_0x51b4ba){if(_0x51b4ba){return _0x51b4ba[_0xd7f4('0x25')](_0x20075e)[_0xd7f4('0x26')](function(_0x3b8659){return _0x3b8659;});}return null;};}function removeEntity(_0x3b3f06,_0x324c46){return function(_0x298700){if(_0x298700){return _0x298700['destroy']()[_0xd7f4('0x26')](function(){_0x3b3f06[_0xd7f4('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x324f45,_0x347440){return function(_0x6fe6c){if(!_0x6fe6c){_0x324f45['sendStatus'](0x194);}return _0x6fe6c;};}function handleError(_0x53d334,_0x50d5ce){_0x50d5ce=_0x50d5ce||0x1f4;return function(_0x56bf90){logger[_0xd7f4('0x27')](_0x56bf90[_0xd7f4('0x28')]);if(_0x56bf90[_0xd7f4('0x29')]){delete _0x56bf90['name'];}_0x53d334[_0xd7f4('0x20')](_0x50d5ce)[_0xd7f4('0x2a')](_0x56bf90);};}exports[_0xd7f4('0x2b')]=function(_0x13c9ce,_0x8d1ba5){var _0x2665da={},_0x32c653={},_0x4e24ae={'count':0x0,'rows':[]};var _0x4e504e=_['map'](db[_0xd7f4('0x2c')][_0xd7f4('0x2d')],function(_0x3e62c2){return{'name':_0x3e62c2[_0xd7f4('0x2e')],'type':_0x3e62c2[_0xd7f4('0x2f')]['key']};});_0x32c653[_0xd7f4('0x30')]=_[_0xd7f4('0x31')](_0x4e504e,'name');_0x32c653[_0xd7f4('0x32')]=_[_0xd7f4('0x33')](_0x13c9ce[_0xd7f4('0x32')]);_0x32c653[_0xd7f4('0x34')]=_[_0xd7f4('0x35')](_0x32c653[_0xd7f4('0x30')],_0x32c653[_0xd7f4('0x32')]);_0x2665da[_0xd7f4('0x36')]=_[_0xd7f4('0x35')](_0x32c653['model'],qs[_0xd7f4('0x37')](_0x13c9ce[_0xd7f4('0x32')][_0xd7f4('0x37')]));_0x2665da[_0xd7f4('0x36')]=_0x2665da['attributes'][_0xd7f4('0x38')]?_0x2665da['attributes']:_0x32c653['model'];if(!_0x13c9ce['query']['hasOwnProperty']('nolimit')){_0x2665da[_0xd7f4('0x1f')]=qs['limit'](_0x13c9ce['query'][_0xd7f4('0x1f')]);_0x2665da['offset']=qs[_0xd7f4('0x1c')](_0x13c9ce['query']['offset']);}_0x2665da[_0xd7f4('0x39')]=qs[_0xd7f4('0x3a')](_0x13c9ce['query']['sort']);_0x2665da['where']=qs[_0xd7f4('0x34')](_['pick'](_0x13c9ce[_0xd7f4('0x32')],_0x32c653[_0xd7f4('0x34')]),_0x4e504e);if(_0x13c9ce[_0xd7f4('0x32')]['filter']){_0x2665da[_0xd7f4('0x3b')]=_[_0xd7f4('0x3c')](_0x2665da[_0xd7f4('0x3b')],{'$or':_[_0xd7f4('0x31')](_0x4e504e,function(_0xd2fe20){if(_0xd2fe20['type']!==_0xd7f4('0x3d')){var _0x141232={};_0x141232[_0xd2fe20[_0xd7f4('0x29')]]={'$like':'%'+_0x13c9ce[_0xd7f4('0x32')]['filter']+'%'};return _0x141232;}})});}_0x2665da=_[_0xd7f4('0x3c')]({},_0x2665da,_0x13c9ce[_0xd7f4('0x3e')]);var _0x46f9fb={'where':_0x2665da[_0xd7f4('0x3b')]};return db[_0xd7f4('0x2c')][_0xd7f4('0x1e')](_0x46f9fb)[_0xd7f4('0x26')](function(_0x217cf8){_0x4e24ae['count']=_0x217cf8;if(_0x13c9ce[_0xd7f4('0x32')]['includeAll']){_0x2665da[_0xd7f4('0x3f')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xd7f4('0x40')](_0x2665da);})[_0xd7f4('0x26')](function(_0x163091){_0x4e24ae[_0xd7f4('0x41')]=_0x163091;return _0x4e24ae;})[_0xd7f4('0x26')](respondWithFilteredResult(_0x8d1ba5,_0x2665da))['catch'](handleError(_0x8d1ba5,null));};exports[_0xd7f4('0x42')]=function(_0x2b90a1,_0x4de99c){var _0x332a01={'raw':!![],'where':{'id':_0x2b90a1[_0xd7f4('0x43')]['id']}},_0x40230b={};_0x40230b[_0xd7f4('0x30')]=_[_0xd7f4('0x33')](db[_0xd7f4('0x2c')]['rawAttributes']);_0x40230b[_0xd7f4('0x32')]=_[_0xd7f4('0x33')](_0x2b90a1['query']);_0x40230b[_0xd7f4('0x34')]=_['intersection'](_0x40230b[_0xd7f4('0x30')],_0x40230b[_0xd7f4('0x32')]);_0x332a01[_0xd7f4('0x36')]=_[_0xd7f4('0x35')](_0x40230b[_0xd7f4('0x30')],qs['fields'](_0x2b90a1['query'][_0xd7f4('0x37')]));_0x332a01[_0xd7f4('0x36')]=_0x332a01[_0xd7f4('0x36')]['length']?_0x332a01[_0xd7f4('0x36')]:_0x40230b[_0xd7f4('0x30')];if(_0x2b90a1[_0xd7f4('0x32')][_0xd7f4('0x44')]){_0x332a01['include']=[{'all':!![]}];}_0x332a01=_[_0xd7f4('0x3c')]({},_0x332a01,_0x2b90a1[_0xd7f4('0x3e')]);return db[_0xd7f4('0x2c')][_0xd7f4('0x45')](_0x332a01)[_0xd7f4('0x26')](handleEntityNotFound(_0x4de99c,null))[_0xd7f4('0x26')](respondWithResult(_0x4de99c,null))[_0xd7f4('0x46')](handleError(_0x4de99c,null));};exports['create']=function(_0x2ecd81,_0x2738ae){return db[_0xd7f4('0x2c')][_0xd7f4('0x47')](_0x2ecd81[_0xd7f4('0x48')],{})['then'](respondWithResult(_0x2738ae,0xc9))[_0xd7f4('0x46')](handleError(_0x2738ae,null));};exports[_0xd7f4('0x25')]=function(_0x498347,_0x3f9900){if(_0x498347['body']['id']){delete _0x498347['body']['id'];}return db[_0xd7f4('0x2c')][_0xd7f4('0x45')]({'where':{'id':_0x498347[_0xd7f4('0x43')]['id']}})[_0xd7f4('0x26')](handleEntityNotFound(_0x3f9900,null))[_0xd7f4('0x26')](saveUpdates(_0x498347[_0xd7f4('0x48')],null))[_0xd7f4('0x26')](respondWithResult(_0x3f9900,null))[_0xd7f4('0x46')](handleError(_0x3f9900,null));};exports[_0xd7f4('0x49')]=function(_0x45b293,_0x47f5f5){return db[_0xd7f4('0x2c')][_0xd7f4('0x45')]({'where':{'id':_0x45b293[_0xd7f4('0x43')]['id']}})[_0xd7f4('0x26')](handleEntityNotFound(_0x47f5f5,null))[_0xd7f4('0x26')](removeEntity(_0x47f5f5,null))[_0xd7f4('0x46')](handleError(_0x47f5f5,null));};exports[_0xd7f4('0x4a')]=function(_0x2ca5d5,_0x414f28){return db[_0xd7f4('0x2c')][_0xd7f4('0x4a')]()[_0xd7f4('0x26')](respondWithResult(_0x414f28,null))[_0xd7f4('0x46')](handleError(_0x414f28,null));};exports[_0xd7f4('0x4b')]=function(_0x4422ab,_0x62569e,_0x4844f3){var _0x6197ab={'raw':!![],'where':{}};var _0x2b2818={};var _0x144e50={'count':0x0,'rows':[]};return db[_0xd7f4('0x2c')][_0xd7f4('0x4c')]({'where':{'id':_0x4422ab[_0xd7f4('0x43')]['id']}})[_0xd7f4('0x26')](handleEntityNotFound(_0x62569e,null))[_0xd7f4('0x26')](function(_0x58f320){if(_0x58f320){_0x2b2818[_0xd7f4('0x30')]=_[_0xd7f4('0x33')](db['JscriptyQuestionReport'][_0xd7f4('0x2d')]);_0x2b2818[_0xd7f4('0x32')]=_[_0xd7f4('0x33')](_0x4422ab[_0xd7f4('0x32')]);_0x2b2818[_0xd7f4('0x34')]=_['intersection'](_0x2b2818['model'],_0x2b2818[_0xd7f4('0x32')]);_0x6197ab['attributes']=_[_0xd7f4('0x35')](_0x2b2818[_0xd7f4('0x30')],qs['fields'](_0x4422ab['query']['fields']));_0x6197ab[_0xd7f4('0x36')]=_0x6197ab[_0xd7f4('0x36')]['length']?_0x6197ab[_0xd7f4('0x36')]:_0x2b2818[_0xd7f4('0x30')];if(!_0x4422ab['query']['hasOwnProperty'](_0xd7f4('0x4d'))){_0x6197ab[_0xd7f4('0x1f')]=qs[_0xd7f4('0x1f')](_0x4422ab[_0xd7f4('0x32')]['limit']);_0x6197ab[_0xd7f4('0x1c')]=qs['offset'](_0x4422ab[_0xd7f4('0x32')]['offset']);}_0x6197ab[_0xd7f4('0x39')]=qs[_0xd7f4('0x3a')](_0x4422ab[_0xd7f4('0x32')][_0xd7f4('0x3a')]);_0x6197ab[_0xd7f4('0x3b')]=qs[_0xd7f4('0x34')](_[_0xd7f4('0x4e')](_0x4422ab[_0xd7f4('0x32')],_0x2b2818['filters']));_0x6197ab['where']['SessionId']=_0x58f320['id'];if(_0x4422ab[_0xd7f4('0x32')][_0xd7f4('0x4f')]){_0x6197ab[_0xd7f4('0x3b')]=_[_0xd7f4('0x3c')](_0x6197ab['where'],{'$or':_['map'](_0x6197ab[_0xd7f4('0x36')],function(_0x1f385e){var _0x114556={};_0x114556[_0x1f385e]={'$like':'%'+_0x4422ab['query'][_0xd7f4('0x4f')]+'%'};return _0x114556;})});}_0x6197ab=_[_0xd7f4('0x3c')]({},_0x6197ab,_0x4422ab['options']);return db[_0xd7f4('0x50')][_0xd7f4('0x1e')]({'where':_0x6197ab['where']})['then'](function(_0x3b236e){_0x144e50[_0xd7f4('0x1e')]=_0x3b236e;if(_0x4422ab['query'][_0xd7f4('0x44')]){_0x6197ab[_0xd7f4('0x3f')]=[{'all':!![]}];}return db[_0xd7f4('0x50')][_0xd7f4('0x40')](_0x6197ab);})[_0xd7f4('0x26')](function(_0x1d3464){_0x144e50[_0xd7f4('0x41')]=_0x1d3464;return _0x144e50;});}})[_0xd7f4('0x26')](respondWithFilteredResult(_0x62569e,_0x6197ab))[_0xd7f4('0x46')](handleError(_0x62569e,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index be27fa5..2aa0c11 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 _0xafc4=['path','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xafc4,0x69));var _0x4afc=function(_0x56bdcb,_0x293ec8){_0x56bdcb=_0x56bdcb-0x0;var _0x1286da=_0xafc4[_0x56bdcb];return _0x1286da;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x181a86,_0x2a04e2){var _0x5a7b71=function(_0x5cfd33){while(--_0x5cfd33){_0x181a86['push'](_0x181a86['shift']());}};_0x5a7b71(++_0x2a04e2);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));module[_0xd7df('0xb')]=function(_0x36cf0f,_0x39ce98){return _0x36cf0f[_0xd7df('0xc')](_0xd7df('0xd'),attributes,{'tableName':_0xd7df('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index a09caf3..274cb63 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 _0x9536=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x4c236a,_0x8d01a6){var _0x3a7065=function(_0x1d30ab){while(--_0x1d30ab){_0x4c236a['push'](_0x4c236a['shift']());}};_0x3a7065(++_0x8d01a6);}(_0x9536,0x179));var _0x6953=function(_0x2c1aa8,_0x3e0609){_0x2c1aa8=_0x2c1aa8-0x0;var _0x4019f5=_0x9536[_0x2c1aa8];return _0x4019f5;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file +var _0x1967=['then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x1967,0x173));var _0x7196=function(_0x758f7f,_0x3eecd5){_0x758f7f=_0x758f7f-0x0;var _0x3ecb4a=_0x1967[_0x758f7f];return _0x3ecb4a;};'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);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index ef7d126..e10d472 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 _0x0618=['/:id','isAuthenticated','update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put'];(function(_0x28d231,_0x55888a){var _0x3814c5=function(_0x55a0a1){while(--_0x55a0a1){_0x28d231['push'](_0x28d231['shift']());}};_0x3814c5(++_0x55888a);}(_0x0618,0x1c6));var _0x8061=function(_0x1bc9a2,_0x3ddf39){_0x1bc9a2=_0x1bc9a2-0x0;var _0x3f16e7=_0x0618[_0x1bc9a2];return _0x3f16e7;};'use strict';var multer=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var path=require('path');var timeout=require(_0x8061('0x2'));var express=require(_0x8061('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8061('0x4'));var interaction=require(_0x8061('0x5'));var config=require(_0x8061('0x6'));var controller=require(_0x8061('0x7'));router[_0x8061('0x8')]('/',controller[_0x8061('0x9')]);router[_0x8061('0xa')](_0x8061('0xb'),auth[_0x8061('0xc')](),controller[_0x8061('0xd')]);module[_0x8061('0xe')]=router; \ No newline at end of file +var _0xcb99=['../../config/environment','./license.controller','index','/:id','isAuthenticated','update','exports','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb99,0x8b));var _0x9cb9=function(_0x139c3e,_0x584ed6){_0x139c3e=_0x139c3e-0x0;var _0x1fe091=_0xcb99[_0x139c3e];return _0x1fe091;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',controller[_0x9cb9('0x7')]);router['put'](_0x9cb9('0x8'),auth[_0x9cb9('0x9')](),controller[_0x9cb9('0xa')]);module[_0x9cb9('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 4f40ff1..c73beec 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 _0x44ae=['sequelize','TEXT','STRING','INTEGER'];(function(_0xd7937f,_0x4400fe){var _0x3727b4=function(_0x2dd9f2){while(--_0x2dd9f2){_0xd7937f['push'](_0xd7937f['shift']());}};_0x3727b4(++_0x4400fe);}(_0x44ae,0xc4));var _0xe44a=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x44ae[_0x1a9e78];return _0x113e06;};'use strict';var Sequelize=require(_0xe44a('0x0'));module['exports']={'license':{'type':Sequelize[_0xe44a('0x1')]},'data1':{'type':Sequelize[_0xe44a('0x2')]},'data2':{'type':Sequelize[_0xe44a('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xe44a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7820=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x569396,_0x3805cc){var _0x436f50=function(_0x42bb96){while(--_0x42bb96){_0x569396['push'](_0x569396['shift']());}};_0x436f50(++_0x3805cc);}(_0x7820,0xdf));var _0x0782=function(_0x555481,_0x4e1bf3){_0x555481=_0x555481-0x0;var _0x4b4a4f=_0x7820[_0x555481];return _0x4b4a4f;};'use strict';var Sequelize=require(_0x0782('0x0'));module[_0x0782('0x1')]={'license':{'type':Sequelize[_0x0782('0x2')]},'data1':{'type':Sequelize[_0x0782('0x3')]},'data2':{'type':Sequelize[_0x0782('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x0782('0x4')],'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 32314bf..f6076ce 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 _0x4975=['name','index','model','query','keys','intersection','fields','attributes','length','options','getLicense','catch','body','License','find','params','get','key','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack'];(function(_0x1c310e,_0x16d900){var _0x15ae55=function(_0x291cd7){while(--_0x291cd7){_0x1c310e['push'](_0x1c310e['shift']());}};_0x15ae55(++_0x16d900);}(_0x4975,0x86));var _0x5497=function(_0xc2e0cf,_0x43a390){_0xc2e0cf=_0xc2e0cf-0x0;var _0x431547=_0x4975[_0xc2e0cf];return _0x431547;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}var utilLicense=require('../../config/license/util');exports[_0x5497('0x29')]=function(_0x48d146,_0x5e9356){var _0xc3465={'raw':!![],'where':{'id':0x1}},_0xb14593={};_0xb14593[_0x5497('0x2a')]=_['keys'](db['License']['rawAttributes']);_0xb14593[_0x5497('0x2b')]=_[_0x5497('0x2c')](_0x48d146[_0x5497('0x2b')]);_0xb14593['filters']=_['intersection'](_0xb14593['model'],_0xb14593[_0x5497('0x2b')]);_0xc3465['attributes']=_[_0x5497('0x2d')](_0xb14593[_0x5497('0x2a')],qs[_0x5497('0x2e')](_0x48d146['query'][_0x5497('0x2e')]));_0xc3465[_0x5497('0x2f')]=_0xc3465['attributes'][_0x5497('0x30')]?_0xc3465[_0x5497('0x2f')]:_0xb14593[_0x5497('0x2a')];_0xc3465=_['merge']({},_0xc3465,_0x48d146[_0x5497('0x31')]);return utilLicense[_0x5497('0x32')](_0xc3465)[_0x5497('0x24')](respondWithResult(_0x5e9356,null))[_0x5497('0x33')](handleError(_0x5e9356,null));};exports[_0x5497('0x23')]=function(_0x4a6459,_0x386845){if(_0x4a6459[_0x5497('0x34')]['id']){delete _0x4a6459['body']['id'];}return db[_0x5497('0x35')][_0x5497('0x36')]({'where':{'id':_0x4a6459[_0x5497('0x37')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x386845,null))[_0x5497('0x24')](function(_0x37011c){var _0x580e86=_0x37011c[_0x5497('0x38')]({'plain':!![]});return utilLicense['checkLicense'](_0x580e86,_0x4a6459[_0x5497('0x34')][_0x5497('0x39')]);})[_0x5497('0x24')](function(_0x5ab18c){if(!_0x5ab18c['demo']){return saveUpdates(_0x4a6459[_0x5497('0x34')],null);}return _0x5ab18c;})[_0x5497('0x24')](respondWithResult(_0x386845,null))[_0x5497('0x33')](handleError(_0x386845,null));}; \ No newline at end of file +var _0x5fab=['checkLicense','key','demo','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','merge','then','catch','body','find','params'];(function(_0x53570d,_0x5f161b){var _0x4de954=function(_0x27b7a8){while(--_0x27b7a8){_0x53570d['push'](_0x53570d['shift']());}};_0x4de954(++_0x5f161b);}(_0x5fab,0x177));var _0xb5fa=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x5fab[_0x31a371];return _0x2a5bd6;};'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);};}var utilLicense=require(_0xb5fa('0x18'));exports[_0xb5fa('0x2b')]=function(_0x3506a4,_0x358549){var _0x353314={'raw':!![],'where':{'id':0x1}},_0x409af9={};_0x409af9[_0xb5fa('0x2c')]=_[_0xb5fa('0x2d')](db[_0xb5fa('0x2e')][_0xb5fa('0x2f')]);_0x409af9[_0xb5fa('0x30')]=_[_0xb5fa('0x2d')](_0x3506a4[_0xb5fa('0x30')]);_0x409af9[_0xb5fa('0x31')]=_[_0xb5fa('0x32')](_0x409af9[_0xb5fa('0x2c')],_0x409af9[_0xb5fa('0x30')]);_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x32')](_0x409af9[_0xb5fa('0x2c')],qs[_0xb5fa('0x34')](_0x3506a4['query'][_0xb5fa('0x34')]));_0x353314['attributes']=_0x353314['attributes']['length']?_0x353314[_0xb5fa('0x33')]:_0x409af9['model'];_0x353314=_[_0xb5fa('0x35')]({},_0x353314,_0x3506a4['options']);return utilLicense['getLicense'](_0x353314)[_0xb5fa('0x36')](respondWithResult(_0x358549,null))[_0xb5fa('0x37')](handleError(_0x358549,null));};exports['update']=function(_0x59f41d,_0x3d73c2){if(_0x59f41d[_0xb5fa('0x38')]['id']){delete _0x59f41d[_0xb5fa('0x38')]['id'];}return db['License'][_0xb5fa('0x39')]({'where':{'id':_0x59f41d[_0xb5fa('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3d73c2,null))[_0xb5fa('0x36')](function(_0x2056de){var _0x204d6b=_0x2056de['get']({'plain':!![]});return utilLicense[_0xb5fa('0x3b')](_0x204d6b,_0x59f41d[_0xb5fa('0x38')][_0xb5fa('0x3c')]);})['then'](function(_0x117694){if(!_0x117694[_0xb5fa('0x3d')]){return saveUpdates(_0x59f41d[_0xb5fa('0x38')],null);}return _0x117694;})[_0xb5fa('0x36')](respondWithResult(_0x3d73c2,null))['catch'](handleError(_0x3d73c2,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index b0d8627..6d0e23c 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 _0xdd15=['api','moment','bluebird','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0xdd15,0x1ea));var _0x5dd1=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0xdd15[_0x34df4a];return _0x145c69;};'use strict';var _=require(_0x5dd1('0x0'));var util=require(_0x5dd1('0x1'));var logger=require('../../config/logger')(_0x5dd1('0x2'));var moment=require(_0x5dd1('0x3'));var BPromise=require(_0x5dd1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5dd1('0x5'));var config=require(_0x5dd1('0x6'));var attributes=require(_0x5dd1('0x7'));module[_0x5dd1('0x8')]=function(_0x4ff66a,_0x3f729e){return _0x4ff66a[_0x5dd1('0x9')](_0x5dd1('0xa'),attributes,{'tableName':_0x5dd1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd8c=['./license.attributes','define','License','lodash','util','../../config/logger','api','rimraf'];(function(_0x1d181f,_0x475fe2){var _0x5a0286=function(_0x4bbb0e){while(--_0x4bbb0e){_0x1d181f['push'](_0x1d181f['shift']());}};_0x5a0286(++_0x475fe2);}(_0xdd8c,0x1f3));var _0xcdd8=function(_0x10e7be,_0x3e17c7){_0x10e7be=_0x10e7be-0x0;var _0xb30ad7=_0xdd8c[_0x10e7be];return _0xb30ad7;};'use strict';var _=require(_0xcdd8('0x0'));var util=require(_0xcdd8('0x1'));var logger=require(_0xcdd8('0x2'))(_0xcdd8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcdd8('0x4'));var config=require('../../config/environment');var attributes=require(_0xcdd8('0x5'));module['exports']=function(_0x13ce99,_0x5d778e){return _0x13ce99[_0xcdd8('0x6')](_0xcdd8('0x7'),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 516bb75..818d528 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 _0xedab=['message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x57a4d0,_0xa6e6b){var _0xaaadee=function(_0x544da2){while(--_0x544da2){_0x57a4d0['push'](_0x57a4d0['shift']());}};_0xaaadee(++_0xa6e6b);}(_0xedab,0x1d1));var _0xbeda=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xedab[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0xbeda('0x0'));var util=require('util');var moment=require(_0xbeda('0x1'));var BPromise=require(_0xbeda('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbeda('0x3'));var db=require(_0xbeda('0x4'))['db'];var utils=require(_0xbeda('0x5'));var logger=require(_0xbeda('0x6'))(_0xbeda('0x7'));var config=require(_0xbeda('0x8'));var jayson=require(_0xbeda('0x9'));var client=jayson[_0xbeda('0xa')][_0xbeda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x747e19,_0x5195be,_0x2e05ee){return new BPromise(function(_0x3ce0ca,_0x6a4c77){return client['request'](_0x747e19,_0x2e05ee)[_0xbeda('0xc')](function(_0x305c90){logger['info'](_0xbeda('0xd'),_0x5195be,_0xbeda('0xe'));logger['debug'](_0xbeda('0xf'),_0x5195be,_0xbeda('0xe'),JSON[_0xbeda('0x10')](_0x305c90));if(_0x305c90[_0xbeda('0x11')]){if(_0x305c90[_0xbeda('0x11')][_0xbeda('0x12')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x5195be,_0x305c90[_0xbeda('0x11')][_0xbeda('0x13')]);return _0x6a4c77(_0x305c90['error'][_0xbeda('0x13')]);}logger[_0xbeda('0x11')](_0xbeda('0xd'),_0x5195be,_0x305c90['error'][_0xbeda('0x13')]);return _0x3ce0ca(_0x305c90[_0xbeda('0x11')][_0xbeda('0x13')]);}else{logger[_0xbeda('0x14')](_0xbeda('0xd'),_0x5195be,_0xbeda('0xe'));_0x3ce0ca(_0x305c90['result']['message']);}})[_0xbeda('0x15')](function(_0x3f1b5e){logger[_0xbeda('0x11')](_0xbeda('0xd'),_0x5195be,_0x3f1b5e);_0x6a4c77(_0x3f1b5e);});});} \ No newline at end of file +var _0x3383=['message','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x58835f,_0x567ed8){var _0x3ce682=function(_0x4d6366){while(--_0x4d6366){_0x58835f['push'](_0x58835f['shift']());}};_0x3ce682(++_0x567ed8);}(_0x3383,0x1cf));var _0x3338=function(_0x2b1b16,_0x3d09b5){_0x2b1b16=_0x2b1b16-0x0;var _0x20179c=_0x3383[_0x2b1b16];return _0x20179c;};'use strict';var _=require('lodash');var util=require(_0x3338('0x0'));var moment=require(_0x3338('0x1'));var BPromise=require(_0x3338('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3338('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3338('0x4'))(_0x3338('0x5'));var config=require(_0x3338('0x6'));var jayson=require(_0x3338('0x7'));var client=jayson[_0x3338('0x8')][_0x3338('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x150f66,_0x2fc9dc,_0x20ac98){return new BPromise(function(_0x47c551,_0x51213f){return client[_0x3338('0xa')](_0x150f66,_0x20ac98)[_0x3338('0xb')](function(_0x1ed30d){logger[_0x3338('0xc')](_0x3338('0xd'),_0x2fc9dc,_0x3338('0xe'));logger[_0x3338('0xf')](_0x3338('0x10'),_0x2fc9dc,_0x3338('0xe'),JSON[_0x3338('0x11')](_0x1ed30d));if(_0x1ed30d[_0x3338('0x12')]){if(_0x1ed30d['error'][_0x3338('0x13')]===0x1f4){logger[_0x3338('0x12')](_0x3338('0xd'),_0x2fc9dc,_0x1ed30d['error'][_0x3338('0x14')]);return _0x51213f(_0x1ed30d[_0x3338('0x12')]['message']);}logger[_0x3338('0x12')](_0x3338('0xd'),_0x2fc9dc,_0x1ed30d['error']['message']);return _0x47c551(_0x1ed30d[_0x3338('0x12')]['message']);}else{logger['info'](_0x3338('0xd'),_0x2fc9dc,'request\x20sent');_0x47c551(_0x1ed30d[_0x3338('0x15')][_0x3338('0x14')]);}})[_0x3338('0x16')](function(_0x26d83b){logger[_0x3338('0x12')](_0x3338('0xd'),_0x2fc9dc,_0x26d83b);_0x51213f(_0x26d83b);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6e5d4c9..38ad278 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 _0x3469=['index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','post','addDisposition','addAnswer','/:id/in_servers','addImap','addSmtp','addApplications','/:id/send','send','addAgents','put','delete','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1e5678,_0x3f3d0a){var _0x317913=function(_0x4a39a2){while(--_0x4a39a2){_0x1e5678['push'](_0x1e5678['shift']());}};_0x317913(++_0x3f3d0a);}(_0x3469,0x7b));var _0x9346=function(_0x365105,_0x56aead){_0x365105=_0x365105-0x0;var _0x3e2310=_0x3469[_0x365105];return _0x3e2310;};'use strict';var multer=require(_0x9346('0x0'));var util=require(_0x9346('0x1'));var path=require('path');var timeout=require(_0x9346('0x2'));var express=require(_0x9346('0x3'));var router=express[_0x9346('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9346('0x5'));var config=require(_0x9346('0x6'));var controller=require('./mailAccount.controller');router[_0x9346('0x7')]('/',auth[_0x9346('0x8')](),controller[_0x9346('0x9')]);router['get'](_0x9346('0xa'),auth[_0x9346('0x8')](),controller[_0x9346('0xb')]);router['get'](_0x9346('0xc'),auth[_0x9346('0x8')](),controller['show']);router[_0x9346('0x7')](_0x9346('0xd'),auth[_0x9346('0x8')](),controller[_0x9346('0xe')]);router['get'](_0x9346('0xf'),auth[_0x9346('0x8')](),controller[_0x9346('0x10')]);router[_0x9346('0x7')]('/:id/in_servers',auth[_0x9346('0x8')](),controller['getImap']);router[_0x9346('0x7')](_0x9346('0x11'),auth[_0x9346('0x8')](),controller[_0x9346('0x12')]);router[_0x9346('0x7')](_0x9346('0x13'),auth[_0x9346('0x8')](),controller[_0x9346('0x14')]);router[_0x9346('0x7')](_0x9346('0x15'),auth[_0x9346('0x8')](),controller[_0x9346('0x16')]);router[_0x9346('0x7')](_0x9346('0x17'),auth[_0x9346('0x8')](),controller[_0x9346('0x18')]);router[_0x9346('0x7')]('/:id/verify',auth[_0x9346('0x8')](),controller[_0x9346('0x19')]);router[_0x9346('0x7')](_0x9346('0x1a'),auth[_0x9346('0x8')](),controller['getAgents']);router[_0x9346('0x1b')]('/:id/dispositions',auth[_0x9346('0x8')](),controller[_0x9346('0x1c')]);router[_0x9346('0x1b')](_0x9346('0xf'),auth[_0x9346('0x8')](),controller[_0x9346('0x1d')]);router[_0x9346('0x1b')]('/',auth[_0x9346('0x8')](),controller['create']);router['post'](_0x9346('0x1e'),auth[_0x9346('0x8')](),controller[_0x9346('0x1f')]);router[_0x9346('0x1b')](_0x9346('0x11'),auth[_0x9346('0x8')](),controller[_0x9346('0x20')]);router[_0x9346('0x1b')](_0x9346('0x13'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x9346('0x1b')](_0x9346('0x15'),auth[_0x9346('0x8')](),controller[_0x9346('0x21')]);router[_0x9346('0x1b')](_0x9346('0x22'),auth[_0x9346('0x8')](),controller[_0x9346('0x23')]);router[_0x9346('0x1b')](_0x9346('0x1a'),auth[_0x9346('0x8')](),controller[_0x9346('0x24')]);router[_0x9346('0x25')](_0x9346('0xc'),auth[_0x9346('0x8')](),controller['update']);router['delete'](_0x9346('0xd'),auth[_0x9346('0x8')](),controller['removeDispositions']);router[_0x9346('0x26')](_0x9346('0xf'),auth[_0x9346('0x8')](),controller[_0x9346('0x27')]);router['delete'](_0x9346('0x1e'),auth[_0x9346('0x8')](),controller['removeImap']);router[_0x9346('0x26')](_0x9346('0x11'),auth[_0x9346('0x8')](),controller[_0x9346('0x28')]);router[_0x9346('0x26')](_0x9346('0xc'),auth[_0x9346('0x8')](),controller[_0x9346('0x29')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x9346('0x2a')]);module[_0x9346('0x2b')]=router; \ No newline at end of file +var _0xcf52=['../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','getAgents','addDisposition','post','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x28d4bf,_0x1978fd){var _0xfb109d=function(_0x75bb58){while(--_0x75bb58){_0x28d4bf['push'](_0x28d4bf['shift']());}};_0xfb109d(++_0x1978fd);}(_0xcf52,0x8d));var _0x2cf5=function(_0x3b97e6,_0x20dcbd){_0x3b97e6=_0x3b97e6-0x0;var _0x322505=_0xcf52[_0x3b97e6];return _0x322505;};'use strict';var multer=require(_0x2cf5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2cf5('0x1'));var express=require(_0x2cf5('0x2'));var router=express[_0x2cf5('0x3')]();var fs_extra=require(_0x2cf5('0x4'));var auth=require(_0x2cf5('0x5'));var interaction=require(_0x2cf5('0x6'));var config=require(_0x2cf5('0x7'));var controller=require(_0x2cf5('0x8'));router['get']('/',auth[_0x2cf5('0x9')](),controller[_0x2cf5('0xa')]);router[_0x2cf5('0xb')](_0x2cf5('0xc'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0xd')]);router[_0x2cf5('0xb')](_0x2cf5('0xe'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0xf')]);router['get'](_0x2cf5('0x10'),auth[_0x2cf5('0x9')](),controller['getDispositions']);router[_0x2cf5('0xb')](_0x2cf5('0x11'),auth['isAuthenticated'](),controller[_0x2cf5('0x12')]);router[_0x2cf5('0xb')](_0x2cf5('0x13'),auth[_0x2cf5('0x9')](),controller['getImap']);router[_0x2cf5('0xb')]('/:id/out_servers',auth[_0x2cf5('0x9')](),controller['getSmtp']);router['get'](_0x2cf5('0x14'),auth['isAuthenticated'](),controller[_0x2cf5('0x15')]);router[_0x2cf5('0xb')](_0x2cf5('0x16'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x17')]);router[_0x2cf5('0xb')](_0x2cf5('0x18'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x2cf5('0x19'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x1a')]);router[_0x2cf5('0xb')]('/:id/users',auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x1b')]);router['post'](_0x2cf5('0x10'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x1c')]);router[_0x2cf5('0x1d')](_0x2cf5('0x11'),auth['isAuthenticated'](),controller[_0x2cf5('0x1e')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2cf5('0x1f')]);router[_0x2cf5('0x1d')](_0x2cf5('0x13'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x20')]);router['post'](_0x2cf5('0x21'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x22')]);router[_0x2cf5('0x1d')](_0x2cf5('0x14'),auth['isAuthenticated'](),controller[_0x2cf5('0x23')]);router[_0x2cf5('0x1d')](_0x2cf5('0x16'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x24')]);router[_0x2cf5('0x1d')](_0x2cf5('0x25'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x26')]);router['post'](_0x2cf5('0x27'),auth[_0x2cf5('0x9')](),controller['addAgents']);router[_0x2cf5('0x28')](_0x2cf5('0xe'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x29')]);router[_0x2cf5('0x2a')](_0x2cf5('0x10'),auth['isAuthenticated'](),controller[_0x2cf5('0x2b')]);router['delete'](_0x2cf5('0x11'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x2c')]);router[_0x2cf5('0x2a')](_0x2cf5('0x13'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x2d')]);router['delete'](_0x2cf5('0x21'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x2e')]);router[_0x2cf5('0x2a')](_0x2cf5('0xe'),auth[_0x2cf5('0x9')](),controller[_0x2cf5('0x2f')]);router[_0x2cf5('0x2a')](_0x2cf5('0x27'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x2cf5('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 0fd928a..4175713 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 _0x6658=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x6658,0x198));var _0x8665=function(_0x3fe9f5,_0x2c302b){_0x3fe9f5=_0x3fe9f5-0x0;var _0x5acbb4=_0x6658[_0x3fe9f5];return _0x5acbb4;};'use strict';var Sequelize=require(_0x8665('0x0'));module[_0x8665('0x1')]={'description':{'type':Sequelize[_0x8665('0x2')]},'name':{'type':Sequelize[_0x8665('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x8665('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x8665('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x8665('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x8665('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x8665('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8665('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x8665('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8665('0x5')],'defaultValue':function(){return _0x8665('0x6');}},'notificationSound':{'type':Sequelize[_0x8665('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8665('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8665('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8665('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8665('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8665('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8665('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x8665('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x8665('0x3')],'defaultValue':![],'comment':_0x8665('0x9'),'set':function(_0x46eab7){if(!_0x46eab7)this[_0x8665('0xa')](_0x8665('0xb'),null);this[_0x8665('0xa')](_0x8665('0xc'),_0x46eab7);}}}; \ No newline at end of file +var _0xca8d=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xca8d,0x172));var _0xdca8=function(_0x3b2a34,_0x55027c){_0x3b2a34=_0x3b2a34-0x0;var _0x3304cd=_0xca8d[_0x3b2a34];return _0x3304cd;};'use strict';var Sequelize=require(_0xdca8('0x0'));module[_0xdca8('0x1')]={'description':{'type':Sequelize[_0xdca8('0x2')]},'name':{'type':Sequelize[_0xdca8('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xdca8('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xdca8('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xdca8('0x4')]},'markAsUnread':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xdca8('0x2')],'allowNull':![],'defaultValue':_0xdca8('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xdca8('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xdca8('0x4')],'defaultValue':function(){return _0xdca8('0x7');}},'notificationSound':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdca8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdca8('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xdca8('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':![],'comment':_0xdca8('0xa'),'set':function(_0x6580b5){if(!_0x6580b5)this[_0xdca8('0xb')](_0xdca8('0xc'),null);this[_0xdca8('0xb')](_0xdca8('0xd'),_0x6580b5);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 80d40db..d0b8fc7 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 _0x6577=['mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','html-to-text','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','undefined','count','set','json','update','destroy','get','UserProfileResource','sendStatus','stack','name','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','pick','where','filter','merge','options','includeAll','include','findAll','rows','show','params','Imap','Pause','body','Smtp','describe','find','create','findOne','Disposition','order','MailAccountId','addAnswer','getAnswers','CannedAnswer','removeAnswers','key','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','addInteraction','MailInteraction','ids','getInteractions','CmContact','Contact','User','Owner','internal','Tags','color','tag','addApplications','sequelize','MailApplication','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','MailMessage','inlineCss','true','CmList','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','auth','secure','SendMail','sendMail','List\x20not\x20found','List','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','bluebird'];(function(_0x1822c2,_0x1e7368){var _0x21f87c=function(_0x8e674c){while(--_0x8e674c){_0x1822c2['push'](_0x1822c2['shift']());}};_0x21f87c(++_0x1e7368);}(_0x6577,0xb6));var _0x7657=function(_0x1a0925,_0x1865b2){_0x1a0925=_0x1a0925-0x0;var _0x22747c=_0x6577[_0x1a0925];return _0x22747c;};'use strict';var emlformat=require(_0x7657('0x0'));var rimraf=require(_0x7657('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7657('0x2'));var Mustache=require(_0x7657('0x3'));var util=require(_0x7657('0x4'));var path=require('path');var sox=require(_0x7657('0x5'));var csv=require(_0x7657('0x6'));var ejs=require(_0x7657('0x7'));var fs=require('fs');var fs_extra=require(_0x7657('0x8'));var _=require('lodash');var squel=require(_0x7657('0x9'));var crypto=require(_0x7657('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7657('0xb'));var toCsv=require(_0x7657('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0x7657('0xc'));var juice=require('juice');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7657('0xd'));var as=require(_0x7657('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7657('0xf'))('api');var utils=require(_0x7657('0x10'));var config=require(_0x7657('0x11'));var licenseUtil=require(_0x7657('0x12'));var db=require('../../mysqldb')['db'];config[_0x7657('0x13')]=_[_0x7657('0x14')](config['redis'],{'host':_0x7657('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7657('0x13')]));require('./mailAccount.socket')[_0x7657('0x16')](socket);var jayson=require(_0x7657('0x17'));var client=jayson['client'][_0x7657('0x18')]({'port':0x232b});function respondWithRpcPromise(_0x84e23f,_0x3037d0,_0x3a4ad2,_0x34c581){return new BPromise(function(_0x529339,_0x1a1318){var _0x35916e=_0x34c581||client;return _0x35916e[_0x7657('0x19')](_0x84e23f,_0x3a4ad2)[_0x7657('0x1a')](function(_0x2c6069){logger[_0x7657('0x1b')](_0x7657('0x1c'),_0x3037d0,_0x7657('0x1d'));logger[_0x7657('0x1e')](_0x7657('0x1f'),_0x3037d0,_0x7657('0x1d'),JSON[_0x7657('0x20')](_0x2c6069));if(_0x2c6069[_0x7657('0x21')]){if(_0x2c6069['error'][_0x7657('0x22')]===0x1f4){logger[_0x7657('0x21')]('MailAccount,\x20%s,\x20%s',_0x3037d0,_0x2c6069[_0x7657('0x21')][_0x7657('0x23')]);return _0x1a1318(_0x2c6069[_0x7657('0x21')][_0x7657('0x23')]);}logger[_0x7657('0x21')](_0x7657('0x1c'),_0x3037d0,_0x2c6069['error'][_0x7657('0x23')]);return _0x529339(_0x2c6069[_0x7657('0x21')][_0x7657('0x23')]);}else{logger[_0x7657('0x1b')](_0x7657('0x1c'),_0x3037d0,_0x7657('0x1d'));_0x529339(_0x2c6069[_0x7657('0x24')][_0x7657('0x23')]);}})[_0x7657('0x25')](function(_0x542773){logger['error'](_0x7657('0x1c'),_0x3037d0,_0x542773);_0x1a1318(_0x542773);});});}function respondWithStatusCode(_0x5070f6,_0x1129cf){_0x1129cf=_0x1129cf||0xcc;return function(_0x24e673){if(_0x24e673){return _0x5070f6['sendStatus'](_0x1129cf);}return _0x5070f6[_0x7657('0x26')](_0x1129cf)['end']();};}function respondWithResult(_0x2e5144,_0x55d6f1){_0x55d6f1=_0x55d6f1||0xc8;return function(_0x3b27dc){if(_0x3b27dc){return _0x2e5144[_0x7657('0x26')](_0x55d6f1)['json'](_0x3b27dc);}};}function respondWithFilteredResult(_0x58b3e6,_0x12ecbb){return function(_0x435d96){if(_0x435d96){var _0x525094=typeof _0x12ecbb[_0x7657('0x27')]==='undefined'&&typeof _0x12ecbb[_0x7657('0x28')]===_0x7657('0x29');var _0x53a580=_0x435d96['count'];var _0x115966=_0x525094?0x0:_0x12ecbb['offset'];var _0xc70a48=_0x525094?_0x435d96[_0x7657('0x2a')]:_0x12ecbb[_0x7657('0x27')]+_0x12ecbb[_0x7657('0x28')];var _0x4b5455;if(_0xc70a48>=_0x53a580){_0xc70a48=_0x53a580;_0x4b5455=0xc8;}else{_0x4b5455=0xce;}_0x58b3e6[_0x7657('0x26')](_0x4b5455);return _0x58b3e6[_0x7657('0x2b')]('Content-Range',_0x115966+'-'+_0xc70a48+'/'+_0x53a580)[_0x7657('0x2c')](_0x435d96);}return null;};}function patchUpdates(_0x985047){return function(_0x4290f4){try{jsonpatch['apply'](_0x4290f4,_0x985047,!![]);}catch(_0x570304){return BPromise['reject'](_0x570304);}return _0x4290f4['save']();};}function saveUpdates(_0x28491e,_0x31f4ed){return function(_0x3bf41c){if(_0x3bf41c){return _0x3bf41c[_0x7657('0x2d')](_0x28491e)[_0x7657('0x1a')](function(_0x1a0d63){return _0x1a0d63;});}return null;};}function removeEntity(_0x54331a,_0x51da2e){return function(_0x57786a){if(_0x57786a){return _0x57786a[_0x7657('0x2e')]()['then'](function(){var _0x361913=_0x57786a[_0x7657('0x2f')]({'plain':!![]});var _0x27a663='MailAccounts';return db[_0x7657('0x30')][_0x7657('0x2e')]({'where':{'type':_0x27a663,'resourceId':_0x361913['id']}})[_0x7657('0x1a')](function(){return _0x57786a;});})[_0x7657('0x1a')](function(){_0x54331a[_0x7657('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd7bbd3,_0x539396){return function(_0xaadcc8){if(!_0xaadcc8){_0xd7bbd3[_0x7657('0x31')](0x194);}return _0xaadcc8;};}function handleError(_0x168160,_0x49a89f){_0x49a89f=_0x49a89f||0x1f4;return function(_0x1fb777){logger[_0x7657('0x21')](_0x1fb777[_0x7657('0x32')]);if(_0x1fb777[_0x7657('0x33')]){delete _0x1fb777['name'];}_0x168160[_0x7657('0x26')](_0x49a89f)['send'](_0x1fb777);};}exports[_0x7657('0x34')]=function(_0x22799,_0x206a1b){var _0x5c7d69={'include':[{'model':db[_0x7657('0x35')],'as':'Imap'},{'model':db[_0x7657('0x36')],'as':'Smtp'},{'model':db['Pause'],'as':_0x7657('0x37')}]},_0x50215c={},_0x1cc333={'count':0x0,'rows':[]};var _0x36a5b8=_[_0x7657('0x38')](db[_0x7657('0x39')][_0x7657('0x3a')],function(_0x50fc3e){return{'name':_0x50fc3e['fieldName'],'type':_0x50fc3e['type']['key']};});_0x50215c['model']=_['map'](_0x36a5b8,_0x7657('0x33'));_0x50215c[_0x7657('0x3b')]=_[_0x7657('0x3c')](_0x22799[_0x7657('0x3b')]);_0x50215c[_0x7657('0x3d')]=_['intersection'](_0x50215c['model'],_0x50215c['query']);_0x5c7d69[_0x7657('0x3e')]=_[_0x7657('0x3f')](_0x50215c[_0x7657('0x40')],qs['fields'](_0x22799[_0x7657('0x3b')][_0x7657('0x41')]));_0x5c7d69[_0x7657('0x3e')]=_0x5c7d69['attributes'][_0x7657('0x42')]?_0x5c7d69[_0x7657('0x3e')]:_0x50215c[_0x7657('0x40')];if(!_0x22799[_0x7657('0x3b')][_0x7657('0x43')](_0x7657('0x44'))){_0x5c7d69[_0x7657('0x28')]=qs[_0x7657('0x28')](_0x22799[_0x7657('0x3b')]['limit']);_0x5c7d69[_0x7657('0x27')]=qs['offset'](_0x22799[_0x7657('0x3b')][_0x7657('0x27')]);}_0x5c7d69['order']=qs[_0x7657('0x45')](_0x22799[_0x7657('0x3b')][_0x7657('0x45')]);_0x5c7d69['where']=qs[_0x7657('0x3d')](_[_0x7657('0x46')](_0x22799[_0x7657('0x3b')],_0x50215c[_0x7657('0x3d')]),_0x36a5b8);if(_0x22799['query']['filter']){_0x5c7d69[_0x7657('0x47')]=_['merge'](_0x5c7d69[_0x7657('0x47')],{'$or':_['map'](_0x36a5b8,function(_0xa07ae8){if(_0xa07ae8['type']!=='VIRTUAL'){var _0x53f205={};_0x53f205[_0xa07ae8[_0x7657('0x33')]]={'$like':'%'+_0x22799['query'][_0x7657('0x48')]+'%'};return _0x53f205;}})});}_0x5c7d69=_[_0x7657('0x49')]({},_0x5c7d69,_0x22799[_0x7657('0x4a')]);var _0x20a2ac={'where':_0x5c7d69['where']};return db[_0x7657('0x39')][_0x7657('0x2a')](_0x20a2ac)[_0x7657('0x1a')](function(_0x32937e){_0x1cc333['count']=_0x32937e;if(_0x22799[_0x7657('0x3b')][_0x7657('0x4b')]){_0x5c7d69[_0x7657('0x4c')]=[{'all':!![]}];}return db[_0x7657('0x39')][_0x7657('0x4d')](_0x5c7d69);})[_0x7657('0x1a')](function(_0x25f21e){_0x1cc333[_0x7657('0x4e')]=_0x25f21e;return _0x1cc333;})['then'](respondWithFilteredResult(_0x206a1b,_0x5c7d69))[_0x7657('0x25')](handleError(_0x206a1b,null));};exports[_0x7657('0x4f')]=function(_0x3e0d3c,_0x1e6b5f){var _0x3d624b={'raw':![],'where':{'id':_0x3e0d3c[_0x7657('0x50')]['id']},'include':[{'model':db[_0x7657('0x35')],'as':_0x7657('0x51')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x7657('0x52')],'as':_0x7657('0x37')}]},_0x14e232={};_0x14e232['model']=_[_0x7657('0x3c')](db[_0x7657('0x39')]['rawAttributes']);_0x14e232[_0x7657('0x3b')]=_['keys'](_0x3e0d3c[_0x7657('0x3b')]);_0x14e232['filters']=_[_0x7657('0x3f')](_0x14e232['model'],_0x14e232[_0x7657('0x3b')]);_0x3d624b[_0x7657('0x3e')]=_[_0x7657('0x3f')](_0x14e232[_0x7657('0x40')],qs[_0x7657('0x41')](_0x3e0d3c[_0x7657('0x3b')][_0x7657('0x41')]));_0x3d624b[_0x7657('0x3e')]=_0x3d624b[_0x7657('0x3e')][_0x7657('0x42')]?_0x3d624b[_0x7657('0x3e')]:_0x14e232[_0x7657('0x40')];if(_0x3e0d3c[_0x7657('0x3b')]['includeAll']){_0x3d624b[_0x7657('0x4c')]=[{'all':!![]}];}_0x3d624b=_[_0x7657('0x49')]({},_0x3d624b,_0x3e0d3c[_0x7657('0x4a')]);return db[_0x7657('0x39')]['find'](_0x3d624b)['then'](handleEntityNotFound(_0x1e6b5f,null))[_0x7657('0x1a')](respondWithResult(_0x1e6b5f,null))[_0x7657('0x25')](handleError(_0x1e6b5f,null));};exports[_0x7657('0x2d')]=function(_0x15a30f,_0x150199){if(_0x15a30f[_0x7657('0x53')]['id']){delete _0x15a30f['body']['id'];}return db[_0x7657('0x39')]['find']({'where':{'id':_0x15a30f[_0x7657('0x50')]['id']},'include':[{'model':db[_0x7657('0x35')],'as':_0x7657('0x51')},{'model':db[_0x7657('0x36')],'as':'Smtp'},{'model':db['Pause'],'as':_0x7657('0x37')}]})[_0x7657('0x1a')](handleEntityNotFound(_0x150199,null))[_0x7657('0x1a')](saveUpdates(_0x15a30f[_0x7657('0x53')],null))[_0x7657('0x1a')](function(_0x1ea25f){if(_0x1ea25f&&_0x15a30f[_0x7657('0x53')][_0x7657('0x51')]){return db[_0x7657('0x35')][_0x7657('0x2d')](_0x15a30f['body'][_0x7657('0x51')],{'where':{'MailAccountId':_0x1ea25f['id']}})[_0x7657('0x1a')](function(){return _0x1ea25f;});}return _0x1ea25f;})[_0x7657('0x1a')](function(_0x28e73c){if(_0x28e73c&&_0x15a30f[_0x7657('0x53')][_0x7657('0x54')]){return db['MailServerOut']['update'](_0x15a30f['body'][_0x7657('0x54')],{'where':{'MailAccountId':_0x28e73c['id']}})['then'](function(){return _0x28e73c;});}return _0x28e73c;})[_0x7657('0x1a')](respondWithResult(_0x150199,null))[_0x7657('0x25')](handleError(_0x150199,null));};exports[_0x7657('0x55')]=function(_0x53f9b2,_0xf16ce){return db[_0x7657('0x39')][_0x7657('0x55')]()[_0x7657('0x1a')](respondWithResult(_0xf16ce,null))[_0x7657('0x25')](handleError(_0xf16ce,null));};exports['addDisposition']=function(_0x22a405,_0x1c35a0,_0x31d7f8){if(_0x22a405[_0x7657('0x53')]['id']){delete _0x22a405[_0x7657('0x53')]['id'];}return db[_0x7657('0x39')][_0x7657('0x56')]({'where':{'id':_0x22a405[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x1c35a0,null))[_0x7657('0x1a')](function(_0x1ac8ce){if(_0x1ac8ce){_0x22a405[_0x7657('0x53')]['MailAccountId']=_0x1ac8ce['id'];return db['Disposition'][_0x7657('0x57')](_0x22a405['body']);}})[_0x7657('0x1a')](respondWithResult(_0x1c35a0,null))[_0x7657('0x25')](handleError(_0x1c35a0,null));};exports['getDispositions']=function(_0x1ee0dc,_0x57a35c,_0x31c725){var _0x250f30={'raw':![],'where':{}};var _0x3a5533={};var _0x249ae4={'count':0x0,'rows':[]};return db['MailAccount'][_0x7657('0x58')]({'where':{'id':_0x1ee0dc[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x57a35c,null))[_0x7657('0x1a')](function(_0x2d64d3){if(_0x2d64d3){_0x3a5533[_0x7657('0x40')]=_['keys'](db[_0x7657('0x59')]['rawAttributes']);_0x3a5533[_0x7657('0x3b')]=_[_0x7657('0x3c')](_0x1ee0dc['query']);_0x3a5533['filters']=_[_0x7657('0x3f')](_0x3a5533['model'],_0x3a5533[_0x7657('0x3b')]);_0x250f30[_0x7657('0x3e')]=_[_0x7657('0x3f')](_0x3a5533[_0x7657('0x40')],qs['fields'](_0x1ee0dc[_0x7657('0x3b')][_0x7657('0x41')]));_0x250f30[_0x7657('0x3e')]=_0x250f30[_0x7657('0x3e')]['length']?_0x250f30[_0x7657('0x3e')]:_0x3a5533[_0x7657('0x40')];if(!_0x1ee0dc[_0x7657('0x3b')]['hasOwnProperty']('nolimit')){_0x250f30[_0x7657('0x28')]=qs[_0x7657('0x28')](_0x1ee0dc[_0x7657('0x3b')][_0x7657('0x28')]);_0x250f30[_0x7657('0x27')]=qs[_0x7657('0x27')](_0x1ee0dc['query'][_0x7657('0x27')]);}_0x250f30[_0x7657('0x5a')]=qs[_0x7657('0x45')](_0x1ee0dc[_0x7657('0x3b')][_0x7657('0x45')]);_0x250f30[_0x7657('0x47')]=qs[_0x7657('0x3d')](_['pick'](_0x1ee0dc[_0x7657('0x3b')],_0x3a5533['filters']));_0x250f30[_0x7657('0x47')][_0x7657('0x5b')]=_0x2d64d3['id'];if(_0x1ee0dc['query'][_0x7657('0x48')]){_0x250f30[_0x7657('0x47')]=_[_0x7657('0x49')](_0x250f30[_0x7657('0x47')],{'$or':_[_0x7657('0x38')](_0x250f30['attributes'],function(_0xfce40){var _0x1271b3={};_0x1271b3[_0xfce40]={'$like':'%'+_0x1ee0dc[_0x7657('0x3b')]['filter']+'%'};return _0x1271b3;})});}_0x250f30=_[_0x7657('0x49')]({},_0x250f30,_0x1ee0dc[_0x7657('0x4a')]);return db[_0x7657('0x59')][_0x7657('0x2a')]({'where':_0x250f30[_0x7657('0x47')]})[_0x7657('0x1a')](function(_0x128573){_0x249ae4[_0x7657('0x2a')]=_0x128573;if(_0x1ee0dc['query'][_0x7657('0x4b')]){_0x250f30[_0x7657('0x4c')]=[{'all':!![]}];}return db[_0x7657('0x59')]['findAll'](_0x250f30);})[_0x7657('0x1a')](function(_0x591935){_0x249ae4[_0x7657('0x4e')]=_0x591935;return _0x249ae4;});}})[_0x7657('0x1a')](respondWithFilteredResult(_0x57a35c,_0x250f30))['catch'](handleError(_0x57a35c,null));};exports['removeDispositions']=function(_0xe28514,_0x86b8d5,_0x257d16){return db['MailAccount'][_0x7657('0x56')]({'where':{'id':_0xe28514[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x86b8d5,null))[_0x7657('0x1a')](function(_0x12164c){if(_0x12164c){return _0x12164c['removeDispositions'](_0xe28514['query']['ids']);}})[_0x7657('0x1a')](respondWithStatusCode(_0x86b8d5,null))[_0x7657('0x25')](handleError(_0x86b8d5,null));};exports[_0x7657('0x5c')]=function(_0x20bba1,_0x1016d5,_0x526848){if(_0x20bba1[_0x7657('0x53')]['id']){delete _0x20bba1[_0x7657('0x53')]['id'];}return db[_0x7657('0x39')]['find']({'where':{'id':_0x20bba1[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x1016d5,null))[_0x7657('0x1a')](function(_0x334f0b){if(_0x334f0b){_0x20bba1[_0x7657('0x53')][_0x7657('0x5b')]=_0x334f0b['id'];return db['CannedAnswer'][_0x7657('0x57')](_0x20bba1[_0x7657('0x53')]);}})[_0x7657('0x1a')](respondWithResult(_0x1016d5,null))[_0x7657('0x25')](handleError(_0x1016d5,null));};exports[_0x7657('0x5d')]=function(_0x253c6b,_0x4db3a1,_0x1c8256){var _0x170348={'raw':![],'where':{}};var _0x5a29f4={};var _0x1be985={'count':0x0,'rows':[]};return db['MailAccount'][_0x7657('0x58')]({'where':{'id':_0x253c6b[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x4db3a1,null))['then'](function(_0x5dcc45){if(_0x5dcc45){_0x5a29f4[_0x7657('0x40')]=_['keys'](db[_0x7657('0x5e')][_0x7657('0x3a')]);_0x5a29f4[_0x7657('0x3b')]=_[_0x7657('0x3c')](_0x253c6b[_0x7657('0x3b')]);_0x5a29f4[_0x7657('0x3d')]=_['intersection'](_0x5a29f4[_0x7657('0x40')],_0x5a29f4[_0x7657('0x3b')]);_0x170348[_0x7657('0x3e')]=_[_0x7657('0x3f')](_0x5a29f4[_0x7657('0x40')],qs['fields'](_0x253c6b[_0x7657('0x3b')][_0x7657('0x41')]));_0x170348[_0x7657('0x3e')]=_0x170348[_0x7657('0x3e')][_0x7657('0x42')]?_0x170348[_0x7657('0x3e')]:_0x5a29f4['model'];if(!_0x253c6b[_0x7657('0x3b')][_0x7657('0x43')](_0x7657('0x44'))){_0x170348[_0x7657('0x28')]=qs[_0x7657('0x28')](_0x253c6b[_0x7657('0x3b')][_0x7657('0x28')]);_0x170348['offset']=qs[_0x7657('0x27')](_0x253c6b[_0x7657('0x3b')][_0x7657('0x27')]);}_0x170348[_0x7657('0x5a')]=qs[_0x7657('0x45')](_0x253c6b[_0x7657('0x3b')][_0x7657('0x45')]);_0x170348[_0x7657('0x47')]=qs[_0x7657('0x3d')](_[_0x7657('0x46')](_0x253c6b['query'],_0x5a29f4[_0x7657('0x3d')]));_0x170348[_0x7657('0x47')][_0x7657('0x5b')]=_0x5dcc45['id'];if(_0x253c6b['query'][_0x7657('0x48')]){_0x170348['where']=_[_0x7657('0x49')](_0x170348['where'],{'$or':_['map'](_0x170348[_0x7657('0x3e')],function(_0x56c803){var _0x34fbb9={};_0x34fbb9[_0x56c803]={'$like':'%'+_0x253c6b[_0x7657('0x3b')][_0x7657('0x48')]+'%'};return _0x34fbb9;})});}_0x170348=_[_0x7657('0x49')]({},_0x170348,_0x253c6b[_0x7657('0x4a')]);return db[_0x7657('0x5e')][_0x7657('0x2a')]({'where':_0x170348[_0x7657('0x47')]})[_0x7657('0x1a')](function(_0x294ff8){_0x1be985[_0x7657('0x2a')]=_0x294ff8;if(_0x253c6b[_0x7657('0x3b')][_0x7657('0x4b')]){_0x170348[_0x7657('0x4c')]=[{'all':!![]}];}return db[_0x7657('0x5e')][_0x7657('0x4d')](_0x170348);})['then'](function(_0x23e5c7){_0x1be985[_0x7657('0x4e')]=_0x23e5c7;return _0x1be985;});}})['then'](respondWithFilteredResult(_0x4db3a1,_0x170348))[_0x7657('0x25')](handleError(_0x4db3a1,null));};exports[_0x7657('0x5f')]=function(_0xe776b2,_0x6a9344,_0x3dde94){return db['MailAccount'][_0x7657('0x56')]({'where':{'id':_0xe776b2[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x6a9344,null))[_0x7657('0x1a')](function(_0x339866){if(_0x339866){return _0x339866[_0x7657('0x5f')](_0xe776b2[_0x7657('0x3b')]['ids']);}})[_0x7657('0x1a')](respondWithStatusCode(_0x6a9344,null))[_0x7657('0x25')](handleError(_0x6a9344,null));};exports[_0x7657('0x57')]=function(_0x30758b,_0x15624a){var _0x105221={'name':_0x30758b[_0x7657('0x53')][_0x7657('0x33')],'key':_0x30758b[_0x7657('0x53')][_0x7657('0x60')],'email':_0x30758b[_0x7657('0x53')][_0x7657('0x61')],'ListId':_0x30758b['body'][_0x7657('0x62')],'active':!_[_0x7657('0x63')](_0x30758b[_0x7657('0x53')][_0x7657('0x64')])?_0x30758b[_0x7657('0x53')][_0x7657('0x64')]:!![],'description':_0x30758b['body'][_0x7657('0x65')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x30758b[_0x7657('0x53')][_0x7657('0x66')])){if(_0x30758b[_0x7657('0x53')][_0x7657('0x67')]){_0x105221[_0x7657('0x51')]['user']=_0x105221['Smtp'][_0x7657('0x68')]=_0x30758b[_0x7657('0x53')][_0x7657('0x69')];_0x105221[_0x7657('0x51')][_0x7657('0x6a')]=_0x105221['Smtp']['pass']=_0x30758b[_0x7657('0x53')][_0x7657('0x6b')];}else{_0x105221[_0x7657('0x51')][_0x7657('0x6c')]=_0x105221[_0x7657('0x54')][_0x7657('0x6c')]=![];}_0x105221[_0x7657('0x51')][_0x7657('0x6d')]=_0x30758b['body']['Imap'][_0x7657('0x6d')];_0x105221[_0x7657('0x51')][_0x7657('0x6e')]=_0x30758b['body'][_0x7657('0x51')]['port'];_0x105221['Smtp']['host']=_0x30758b[_0x7657('0x53')]['Smtp'][_0x7657('0x6d')];_0x105221[_0x7657('0x54')][_0x7657('0x6e')]=_0x30758b['body'][_0x7657('0x54')][_0x7657('0x6e')];}else{_0x105221[_0x7657('0x51')]['service']=_0x105221[_0x7657('0x54')][_0x7657('0x6f')]=_0x30758b[_0x7657('0x53')][_0x7657('0x66')];_0x105221[_0x7657('0x51')][_0x7657('0x68')]=_0x105221[_0x7657('0x54')][_0x7657('0x68')]=_0x30758b[_0x7657('0x53')][_0x7657('0x69')];_0x105221[_0x7657('0x51')][_0x7657('0x6a')]=_0x105221[_0x7657('0x54')][_0x7657('0x70')]=_0x30758b[_0x7657('0x53')]['cpassword'];}return db[_0x7657('0x39')][_0x7657('0x57')](_0x105221,{'include':[{'model':db[_0x7657('0x36')],'as':_0x7657('0x54')},{'model':db['MailServerIn'],'as':_0x7657('0x51')}]})[_0x7657('0x1a')](function(_0x3d7a06){var _0x2b5ba4=_0x30758b[_0x7657('0x68')]['get']({'plain':!![]});if(!_0x2b5ba4)throw new Error(_0x7657('0x71'));if(_0x2b5ba4['role']===_0x7657('0x68')){var _0x4d904d=_0x3d7a06[_0x7657('0x2f')]({'plain':!![]});return db[_0x7657('0x72')][_0x7657('0x56')]({'where':{'name':_0x7657('0x73'),'userProfileId':_0x2b5ba4[_0x7657('0x74')]},'raw':!![]})[_0x7657('0x1a')](function(_0x2d6358){if(_0x2d6358&&_0x2d6358[_0x7657('0x75')]===0x0){return db[_0x7657('0x30')]['create']({'name':_0x4d904d['name'],'resourceId':_0x4d904d['id'],'type':_0x2d6358['name'],'sectionId':_0x2d6358['id']},{})[_0x7657('0x1a')](function(){return _0x3d7a06;});}else{return _0x3d7a06;}})[_0x7657('0x25')](function(_0x5a6f92){logger[_0x7657('0x21')](_0x7657('0x76'),_0x5a6f92);throw _0x5a6f92;});}return _0x3d7a06;})[_0x7657('0x1a')](respondWithResult(_0x15624a,0xc9))[_0x7657('0x25')](handleError(_0x15624a,null));};exports['getImap']=function(_0x320845,_0x405271,_0x263f4a){return db[_0x7657('0x39')][_0x7657('0x58')]({'where':{'id':_0x320845['params']['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x405271,null))['then'](function(_0x5f42c8){if(_0x5f42c8){return _0x5f42c8[_0x7657('0x77')]();}return null;})[_0x7657('0x1a')](respondWithResult(_0x405271,null))[_0x7657('0x25')](handleError(_0x405271,null));};exports[_0x7657('0x78')]=function(_0x5b697c,_0x4409a6,_0x48e06e){if(_0x5b697c[_0x7657('0x53')]['id']){delete _0x5b697c[_0x7657('0x53')]['id'];}return db['MailAccount'][_0x7657('0x56')]({'where':{'id':_0x5b697c[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x4409a6,null))[_0x7657('0x1a')](function(_0x4d88d0){if(_0x4d88d0){_0x5b697c[_0x7657('0x53')][_0x7657('0x5b')]=_0x4d88d0['id'];return db[_0x7657('0x35')][_0x7657('0x57')](_0x5b697c['body']);}})['then'](respondWithResult(_0x4409a6,null))[_0x7657('0x25')](handleError(_0x4409a6,null));};exports[_0x7657('0x79')]=function(_0xf82f96,_0x17d8e7,_0x2e20fa){return db[_0x7657('0x39')][_0x7657('0x58')]({'where':{'id':_0xf82f96[_0x7657('0x50')]['id']}})['then'](handleEntityNotFound(_0x17d8e7,null))[_0x7657('0x1a')](function(_0x34e26c){if(_0x34e26c){return _0x34e26c[_0x7657('0x7a')](null);}return null;})[_0x7657('0x1a')](respondWithStatusCode(_0x17d8e7,null))[_0x7657('0x25')](handleError(_0x17d8e7,null));};exports['getSmtp']=function(_0x9e8c8d,_0x5cc1ec,_0x21a9bd){return db[_0x7657('0x39')][_0x7657('0x58')]({'where':{'id':_0x9e8c8d[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x5cc1ec,null))[_0x7657('0x1a')](function(_0x142185){if(_0x142185){return _0x142185[_0x7657('0x7b')]();}return null;})[_0x7657('0x1a')](respondWithResult(_0x5cc1ec,null))[_0x7657('0x25')](handleError(_0x5cc1ec,null));};exports[_0x7657('0x7c')]=function(_0x4b2b75,_0x1b4307,_0x3e1b32){if(_0x4b2b75['body']['id']){delete _0x4b2b75['body']['id'];}return db[_0x7657('0x39')]['find']({'where':{'id':_0x4b2b75[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x1b4307,null))[_0x7657('0x1a')](function(_0x268651){if(_0x268651){_0x4b2b75[_0x7657('0x53')][_0x7657('0x5b')]=_0x268651['id'];return db[_0x7657('0x36')][_0x7657('0x57')](_0x4b2b75[_0x7657('0x53')]);}})['then'](respondWithResult(_0x1b4307,null))[_0x7657('0x25')](handleError(_0x1b4307,null));};exports['removeSmtp']=function(_0x8bc44e,_0x25c1f9,_0x40ea22){return db[_0x7657('0x39')][_0x7657('0x58')]({'where':{'id':_0x8bc44e[_0x7657('0x50')]['id']}})['then'](handleEntityNotFound(_0x25c1f9,null))[_0x7657('0x1a')](function(_0x1ae02c){if(_0x1ae02c){return _0x1ae02c['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x25c1f9,null))[_0x7657('0x25')](handleError(_0x25c1f9,null));};exports[_0x7657('0x7d')]=function(_0xa78781,_0x548bdc,_0xa17aca){return db[_0x7657('0x7e')][_0x7657('0x56')]({'where':{'id':_0xa78781['params']['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x548bdc,null))[_0x7657('0x1a')](function(_0x4a7c7b){if(_0x4a7c7b){return _0x4a7c7b[_0x7657('0x7d')](_0xa78781[_0x7657('0x53')][_0x7657('0x7f')],_['omit'](_0xa78781[_0x7657('0x53')],[_0x7657('0x7f'),'id'])||{});}})[_0x7657('0x1a')](respondWithResult(_0x548bdc,null))[_0x7657('0x25')](handleError(_0x548bdc,null));};exports[_0x7657('0x80')]=function(_0x16b02b,_0x5f0c91,_0x13e2f1){var _0x4bed56={'raw':![],'where':{}};var _0x1cea59={};var _0x5ad8af={'count':0x0,'rows':[]};return db[_0x7657('0x39')][_0x7657('0x58')]({'where':{'id':_0x16b02b[_0x7657('0x50')]['id']}})['then'](handleEntityNotFound(_0x5f0c91,null))[_0x7657('0x1a')](function(_0xb093b5){if(_0xb093b5){_0x1cea59[_0x7657('0x40')]=_[_0x7657('0x3c')](db['MailInteraction'][_0x7657('0x3a')]);_0x1cea59[_0x7657('0x3b')]=_[_0x7657('0x3c')](_0x16b02b['query']);_0x1cea59[_0x7657('0x3d')]=_['intersection'](_0x1cea59[_0x7657('0x40')],_0x1cea59[_0x7657('0x3b')]);_0x4bed56['attributes']=_['intersection'](_0x1cea59[_0x7657('0x40')],qs[_0x7657('0x41')](_0x16b02b[_0x7657('0x3b')][_0x7657('0x41')]));_0x4bed56[_0x7657('0x3e')]=_0x4bed56[_0x7657('0x3e')]['length']?_0x4bed56['attributes']:_0x1cea59[_0x7657('0x40')];if(!_0x16b02b[_0x7657('0x3b')]['hasOwnProperty'](_0x7657('0x44'))){_0x4bed56[_0x7657('0x28')]=qs[_0x7657('0x28')](_0x16b02b[_0x7657('0x3b')][_0x7657('0x28')]);_0x4bed56['offset']=qs['offset'](_0x16b02b[_0x7657('0x3b')][_0x7657('0x27')]);}_0x4bed56[_0x7657('0x5a')]=qs[_0x7657('0x45')](_0x16b02b[_0x7657('0x3b')][_0x7657('0x45')]);_0x4bed56['where']=qs[_0x7657('0x3d')](_['pick'](_0x16b02b[_0x7657('0x3b')],_0x1cea59[_0x7657('0x3d')]));_0x4bed56[_0x7657('0x47')][_0x7657('0x5b')]=_0xb093b5['id'];if(_0x16b02b['query'][_0x7657('0x48')]){_0x4bed56[_0x7657('0x47')]=_['merge'](_0x4bed56[_0x7657('0x47')],{'$or':_[_0x7657('0x38')](_0x4bed56[_0x7657('0x3e')],function(_0x343266){var _0x15d042={};_0x15d042[_0x343266]={'$like':'%'+_0x16b02b['query']['filter']+'%'};return _0x15d042;})});}_0x4bed56=_['merge']({},_0x4bed56,_0x16b02b[_0x7657('0x4a')]);return db[_0x7657('0x7e')][_0x7657('0x2a')]({'where':_0x4bed56[_0x7657('0x47')]})[_0x7657('0x1a')](function(_0x19da25){_0x5ad8af[_0x7657('0x2a')]=_0x19da25;if(_0x16b02b[_0x7657('0x3b')][_0x7657('0x4b')]){_0x4bed56[_0x7657('0x4c')]=[{'model':db[_0x7657('0x81')],'as':_0x7657('0x82'),'required':![]},{'model':db[_0x7657('0x83')],'as':_0x7657('0x84'),'attributes':[_0x7657('0x33'),'fullname',_0x7657('0x85')],'required':![]},{'model':db['Tag'],'as':_0x7657('0x86'),'attributes':['id',_0x7657('0x33'),_0x7657('0x87')],'where':_0x16b02b['query'][_0x7657('0x88')]?{'id':_0x16b02b['query']['tag']}:undefined,'required':_0x16b02b['query'][_0x7657('0x88')]?!![]:![]}];}return db[_0x7657('0x7e')]['findAll'](_0x4bed56);})['then'](function(_0x24f657){_0x5ad8af[_0x7657('0x4e')]=_0x24f657;return _0x5ad8af;});}})[_0x7657('0x1a')](respondWithFilteredResult(_0x5f0c91,_0x4bed56))[_0x7657('0x25')](handleError(_0x5f0c91,null));};exports[_0x7657('0x89')]=function(_0x4ff3dd,_0x51c758,_0x35954c){return db[_0x7657('0x39')][_0x7657('0x58')]({'where':{'id':_0x4ff3dd[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x51c758,null))[_0x7657('0x1a')](function(_0xa61baa){if(_0xa61baa){return db[_0x7657('0x8a')]['transaction'](function(_0x3eb293){return db[_0x7657('0x8b')]['destroy']({'where':{'MailAccountId':_0x4ff3dd['params']['id']},'transaction':_0x3eb293})['then'](function(_0x5560e5){var _0x35126c=_[_0x7657('0x38')](_0x4ff3dd[_0x7657('0x53')],function(_0x47f1c8){_0x47f1c8[_0x7657('0x5b')]=_0x4ff3dd['params']['id'];return _0x47f1c8;});return db[_0x7657('0x8b')]['bulkCreate'](_0x35126c,{'transaction':_0x3eb293});});})['then'](function(){return db[_0x7657('0x8b')][_0x7657('0x8c')]({'where':{'MailAccountId':_0x4ff3dd[_0x7657('0x50')]['id']},'order':_0x7657('0x8d')});});}})[_0x7657('0x1a')](respondWithResult(_0x51c758,null))[_0x7657('0x25')](handleError(_0x51c758,null));};exports[_0x7657('0x8e')]=function(_0x3fe81f,_0x5cfefa,_0x38009f){var _0x3480be={};var _0x1da853={};var _0x1f8984;var _0x213e25;return db['MailAccount']['findOne']({'where':{'id':_0x3fe81f[_0x7657('0x50')]['id']}})['then'](handleEntityNotFound(_0x5cfefa,null))['then'](function(_0x5ae798){if(_0x5ae798){_0x1f8984=_0x5ae798;_0x1da853[_0x7657('0x40')]=_[_0x7657('0x3c')](db['MailApplication'][_0x7657('0x3a')]);_0x1da853[_0x7657('0x3b')]=_[_0x7657('0x3c')](_0x3fe81f[_0x7657('0x3b')]);_0x1da853['filters']=_['intersection'](_0x1da853[_0x7657('0x40')],_0x1da853['query']);_0x3480be[_0x7657('0x3e')]=_[_0x7657('0x3f')](_0x1da853[_0x7657('0x40')],qs[_0x7657('0x41')](_0x3fe81f[_0x7657('0x3b')][_0x7657('0x41')]));_0x3480be[_0x7657('0x3e')]=_0x3480be[_0x7657('0x3e')][_0x7657('0x42')]?_0x3480be[_0x7657('0x3e')]:_0x1da853[_0x7657('0x40')];_0x3480be[_0x7657('0x5a')]=qs[_0x7657('0x45')](_0x3fe81f[_0x7657('0x3b')]['sort']);_0x3480be['where']=qs[_0x7657('0x3d')](_[_0x7657('0x46')](_0x3fe81f[_0x7657('0x3b')],_0x1da853['filters']));if(_0x3fe81f[_0x7657('0x3b')][_0x7657('0x48')]){_0x3480be['where']=_['merge'](_0x3480be[_0x7657('0x47')],{'$or':_['map'](_0x3480be[_0x7657('0x3e')],function(_0x9d33e5){var _0x2edd36={};_0x2edd36[_0x9d33e5]={'$like':'%'+_0x3fe81f[_0x7657('0x3b')][_0x7657('0x48')]+'%'};return _0x2edd36;})});}_0x3480be=_['merge']({},_0x3480be,_0x3fe81f[_0x7657('0x4a')]);return _0x1f8984[_0x7657('0x8e')](_0x3480be);}})['then'](function(_0x4f8f30){if(_0x4f8f30){_0x213e25=_0x4f8f30[_0x7657('0x42')];if(!_0x3fe81f[_0x7657('0x3b')]['hasOwnProperty'](_0x7657('0x44'))){_0x3480be['limit']=qs[_0x7657('0x28')](_0x3fe81f[_0x7657('0x3b')][_0x7657('0x28')]);_0x3480be[_0x7657('0x27')]=qs[_0x7657('0x27')](_0x3fe81f['query'][_0x7657('0x27')]);}return _0x1f8984[_0x7657('0x8e')](_0x3480be);}})['then'](function(_0x4409d5){if(_0x4409d5){return _0x4409d5?{'count':_0x213e25,'rows':_0x4409d5}:null;}})['then'](respondWithResult(_0x5cfefa,null))[_0x7657('0x25')](handleError(_0x5cfefa,null));};exports[_0x7657('0x8f')]=function(_0xce814c,_0x4c33c3,_0x1b5e7c){var _0x2794ad={'raw':!![],'where':{}};var _0x3e4112={};var _0x4f6441={'count':0x0,'rows':[]};return db['MailAccount'][_0x7657('0x58')]({'where':{'id':_0xce814c[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x4c33c3,null))[_0x7657('0x1a')](function(_0x19168d){if(_0x19168d){_0x3e4112[_0x7657('0x40')]=_['keys'](db['MailMessage']['rawAttributes']);_0x3e4112[_0x7657('0x3b')]=_[_0x7657('0x3c')](_0xce814c[_0x7657('0x3b')]);_0x3e4112[_0x7657('0x3d')]=_[_0x7657('0x3f')](_0x3e4112[_0x7657('0x40')],_0x3e4112[_0x7657('0x3b')]);_0x2794ad['attributes']=_[_0x7657('0x3f')](_0x3e4112[_0x7657('0x40')],qs[_0x7657('0x41')](_0xce814c['query'][_0x7657('0x41')]));_0x2794ad[_0x7657('0x3e')]=_0x2794ad[_0x7657('0x3e')][_0x7657('0x42')]?_0x2794ad[_0x7657('0x3e')]:_0x3e4112[_0x7657('0x40')];if(!_0xce814c[_0x7657('0x3b')][_0x7657('0x43')]('nolimit')){_0x2794ad['limit']=qs[_0x7657('0x28')](_0xce814c['query'][_0x7657('0x28')]);_0x2794ad[_0x7657('0x27')]=qs[_0x7657('0x27')](_0xce814c[_0x7657('0x3b')][_0x7657('0x27')]);}_0x2794ad['order']=qs[_0x7657('0x45')](_0xce814c[_0x7657('0x3b')]['sort']);_0x2794ad['where']=qs[_0x7657('0x3d')](_[_0x7657('0x46')](_0xce814c[_0x7657('0x3b')],_0x3e4112[_0x7657('0x3d')]));_0x2794ad[_0x7657('0x47')][_0x7657('0x5b')]=_0x19168d['id'];if(_0xce814c[_0x7657('0x3b')][_0x7657('0x48')]){_0x2794ad['where']=_['merge'](_0x2794ad[_0x7657('0x47')],{'$or':_[_0x7657('0x38')](_0x2794ad[_0x7657('0x3e')],function(_0x5a2cff){var _0x1a6984={};_0x1a6984[_0x5a2cff]={'$like':'%'+_0xce814c[_0x7657('0x3b')][_0x7657('0x48')]+'%'};return _0x1a6984;})});}if(_0xce814c[_0x7657('0x3b')][_0x7657('0x90')]){var _0xf8dc2a=_0xce814c[_0x7657('0x3b')][_0x7657('0x90')][_0x7657('0x91')](',');var _0x16054a={};_0x16054a[_0xf8dc2a[0x0]]={'$gte':moment(_0xf8dc2a[0x1])[_0x7657('0x92')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2794ad[_0x7657('0x47')]=_['merge'](_0x2794ad['where'],_0x16054a);}_0x2794ad=_[_0x7657('0x49')]({},_0x2794ad,_0xce814c[_0x7657('0x4a')]);return db['MailMessage'][_0x7657('0x2a')]({'where':_0x2794ad[_0x7657('0x47')]})[_0x7657('0x1a')](function(_0x3db900){_0x4f6441[_0x7657('0x2a')]=_0x3db900;if(_0xce814c[_0x7657('0x3b')][_0x7657('0x4b')]){_0x2794ad['include']=[{'all':!![]}];}return db[_0x7657('0x93')]['findAll'](_0x2794ad);})[_0x7657('0x1a')](function(_0x4d1978){if(_0xce814c['query'][_0x7657('0x94')]===_0x7657('0x95')){for(var _0x5a226f=0x0;_0x5a226f<_0x4d1978[_0x7657('0x42')];_0x5a226f++){_0x4d1978[_0x5a226f][_0x7657('0x53')]=juice(_0x4d1978[_0x5a226f][_0x7657('0x53')]);}}_0x4f6441[_0x7657('0x4e')]=_0x4d1978;return _0x4f6441;});}})['then'](respondWithFilteredResult(_0x4c33c3,_0x2794ad))[_0x7657('0x25')](handleError(_0x4c33c3,null));};exports['send']=function(_0x44aa60,_0x25cc22,_0x32fcb6){var _0x37d7b3,_0x19022d={},_0x3fd917;if(_0x44aa60[_0x7657('0x53')]['to']){_0x3fd917=_0x44aa60[_0x7657('0x53')]['to'][_0x7657('0x91')](',')[0x0];}return db[_0x7657('0x39')][_0x7657('0x56')]({'where':{'id':_0x44aa60['params']['id']},'include':[{'model':db[_0x7657('0x96')],'as':'List','include':[{'model':db[_0x7657('0x81')],'as':_0x7657('0x97'),'where':{'email':_0x3fd917},'limit':0x1,'order':[[_0x7657('0x98'),_0x7657('0x99')]]}]},{'model':db[_0x7657('0x36')],'as':_0x7657('0x54'),'raw':!![]}]})[_0x7657('0x1a')](handleEntityNotFound(_0x25cc22,null))[_0x7657('0x1a')](function(_0x35ed37){if(_0x35ed37){_0x37d7b3=_0x35ed37;if(_0x35ed37[_0x7657('0x54')]){if(_[_0x7657('0x63')](_0x44aa60[_0x7657('0x53')][_0x7657('0x9a')])){_0x44aa60[_0x7657('0x53')]['from']=util[_0x7657('0x92')](_0x7657('0x9b'),_0x35ed37[_0x7657('0x33')],_0x35ed37[_0x7657('0x61')]||_0x35ed37['Smtp']['user']);}if(_0x44aa60['body']['attachments']&&_0x44aa60[_0x7657('0x53')]['attachments']['length']){for(var _0x1bb469=0x0;_0x1bb469<_0x44aa60[_0x7657('0x53')]['attachments'][_0x7657('0x42')];_0x1bb469+=0x1){_0x44aa60[_0x7657('0x53')][_0x7657('0x9c')][_0x1bb469]={'filename':_0x44aa60[_0x7657('0x53')]['attachments'][_0x1bb469][_0x7657('0x33')],'path':path[_0x7657('0x9d')](config[_0x7657('0x9e')],'server/files/attachments',_0x44aa60[_0x7657('0x53')][_0x7657('0x9c')][_0x1bb469]['basename'])};}}var _0x3de667={'tls':{'rejectUnauthorized':![]}};if(_[_0x7657('0x63')](_0x35ed37['Smtp'][_0x7657('0x6f')])){if(_0x35ed37[_0x7657('0x54')][_0x7657('0x6c')]){_0x3de667[_0x7657('0x9f')]={'user':_0x35ed37['Smtp'][_0x7657('0x68')],'pass':_0x35ed37[_0x7657('0x54')][_0x7657('0x70')]};}_0x3de667[_0x7657('0x6d')]=_0x35ed37[_0x7657('0x54')][_0x7657('0x6d')];_0x3de667[_0x7657('0x6e')]=_0x35ed37[_0x7657('0x54')][_0x7657('0x6e')];_0x3de667['secure']=_0x35ed37[_0x7657('0x54')][_0x7657('0xa0')];}else{_0x3de667[_0x7657('0x6f')]=_0x35ed37[_0x7657('0x54')][_0x7657('0x6f')];_0x3de667[_0x7657('0x9f')]={'user':_0x35ed37['Smtp'][_0x7657('0x68')],'pass':_0x35ed37[_0x7657('0x54')][_0x7657('0x70')]};}return respondWithRpcPromise(_0x7657('0xa1'),_0x7657('0xa2'),{'account':_0x3de667,'message':_0x44aa60[_0x7657('0x53')]});}else{throw new Error(_0x7657('0xa3'));}}})['then'](function(_0x51374a){if(_0x51374a){_0x19022d=_0x51374a;if(_0x37d7b3[_0x7657('0xa4')]){if(_0x37d7b3[_0x7657('0xa4')][_0x7657('0x97')][_0x7657('0x42')]){return _0x37d7b3[_0x7657('0xa4')][_0x7657('0x97')][0x0];}else{return db[_0x7657('0x81')][_0x7657('0x57')](_[_0x7657('0x14')](_0x44aa60[_0x7657('0x53')],{'firstName':_0x44aa60[_0x7657('0x53')]['to'],'email':_0x44aa60[_0x7657('0x53')]['to'],'phone':_0x44aa60['body']['to'],'ListId':_0x37d7b3['ListId']}));}}else{throw new Error(_0x7657('0xa3'));}}})['then'](function(_0x464988){if(_0x464988){var _0x3b0be0={'UserId':_0x44aa60['user']['id'],'ContactId':_0x464988['id'],'MailAccountId':_0x37d7b3['id'],'inReplyTo':_0x19022d[_0x7657('0xa5')],'to':_0x44aa60['body']['from'],'cc':_0x44aa60[_0x7657('0x53')]['cc'],'subject':_0x44aa60[_0x7657('0x53')][_0x7657('0xa6')],'attach':_0x44aa60['body'][_0x7657('0xa7')],'firstMsgDirection':_0x7657('0xa8'),'lastMsgAt':moment()[_0x7657('0x92')](_0x7657('0xa9')),'lastMsgDirection':_0x7657('0xa8'),'Messages':[_[_0x7657('0x49')](_0x44aa60['body'],{'messageId':_0x19022d['messageId'],'sentAt':moment()[_0x7657('0x92')](_0x7657('0xa9')),'read':!![],'MailAccountId':_0x37d7b3['id'],'UserId':_0x44aa60[_0x7657('0x68')]['id'],'ContactId':_0x464988['id']})]};if(_0x44aa60[_0x7657('0x53')][_0x7657('0xaa')]){_0x3b0be0=_[_0x7657('0x49')](_0x3b0be0,_0x44aa60[_0x7657('0x53')][_0x7657('0xaa')]);}return db['MailInteraction'][_0x7657('0x57')](_0x3b0be0,{'include':[{'model':db['MailMessage'],'as':_0x7657('0xab')}]});}})[_0x7657('0x1a')](respondWithResult(_0x25cc22,null))[_0x7657('0x25')](handleError(_0x25cc22,null));};exports[_0x7657('0xac')]=function(_0x14302f,_0x53dda9,_0x1c209e){return db['MailAccount'][_0x7657('0x56')]({'where':{'id':_0x14302f[_0x7657('0x50')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x7657('0x54'),'raw':!![]}]})[_0x7657('0x1a')](handleEntityNotFound(_0x53dda9,null))[_0x7657('0x1a')](function(_0x20e2d7){if(_0x20e2d7&&_0x20e2d7[_0x7657('0x54')]){var _0x2fc025={'id':_0x20e2d7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x20e2d7['Smtp'][_0x7657('0x6f')]){_0x2fc025[_0x7657('0x6f')]=_0x20e2d7[_0x7657('0x54')][_0x7657('0x6f')];}else{_0x2fc025[_0x7657('0x6d')]=_0x20e2d7['Smtp'][_0x7657('0x6d')];_0x2fc025[_0x7657('0x6e')]=_0x20e2d7[_0x7657('0x54')]['port'];_0x2fc025[_0x7657('0xa0')]=_0x20e2d7[_0x7657('0x54')]['secure'];}if(_0x20e2d7[_0x7657('0x54')][_0x7657('0x6c')]){_0x2fc025['auth']={'user':_0x20e2d7[_0x7657('0x54')][_0x7657('0x68')],'pass':_0x20e2d7[_0x7657('0x54')][_0x7657('0x70')]};}return respondWithRpcPromise(_0x7657('0xad'),_0x7657('0xac'),{'account':_0x2fc025});}})[_0x7657('0x1a')](respondWithResult(_0x53dda9,null))[_0x7657('0x25')](handleError(_0x53dda9,null));};exports[_0x7657('0x2e')]=function(_0x132a1b,_0x28a98f){return db[_0x7657('0x39')][_0x7657('0x56')]({'where':{'id':_0x132a1b[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x28a98f,null))[_0x7657('0x1a')](function(_0x45bb74){if(_0x45bb74&&_0x45bb74[_0x7657('0x6f')]){throw new db[(_0x7657('0xae'))][(_0x7657('0xaf'))](_0x7657('0xb0'));}return _0x45bb74;})[_0x7657('0x1a')](removeEntity(_0x28a98f,null))['catch'](handleError(_0x28a98f,null));};exports[_0x7657('0xb1')]=function(_0x51f2b1,_0x13f3b9,_0x461800){return db[_0x7657('0x39')][_0x7657('0x56')]({'where':{'id':_0x51f2b1[_0x7657('0x50')]['id']}})['then'](handleEntityNotFound(_0x13f3b9,null))[_0x7657('0x1a')](function(_0x5b9d36){if(_0x5b9d36){return _0x5b9d36[_0x7657('0xb1')](_0x51f2b1['body'][_0x7657('0x7f')],_[_0x7657('0xb2')](_0x51f2b1['body'],[_0x7657('0x7f'),'id'])||{})['spread'](function(_0x441993){for(var _0x2d0232=0x0;_0x2d0232<_0x51f2b1[_0x7657('0x53')][_0x7657('0x7f')][_0x7657('0x42')];_0x2d0232+=0x1){socket[_0x7657('0xb3')](_0x7657('0xb4'),{'UserId':Number(_0x51f2b1['body'][_0x7657('0x7f')][_0x2d0232]),'MailAccountId':Number(_0x51f2b1['params']['id'])});}return _0x441993;});}})[_0x7657('0x1a')](respondWithResult(_0x13f3b9,null))[_0x7657('0x25')](handleError(_0x13f3b9,null));};exports[_0x7657('0xb5')]=function(_0x245574,_0x2a326a,_0x47b97b){return db['MailAccount'][_0x7657('0x56')]({'where':{'id':_0x245574[_0x7657('0x50')]['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0x2a326a,null))[_0x7657('0x1a')](function(_0x4fed4c){if(_0x4fed4c){return _0x4fed4c['removeAgents'](_0x245574[_0x7657('0x3b')][_0x7657('0x7f')])[_0x7657('0x1a')](function(){if(_[_0x7657('0xb6')](_0x245574[_0x7657('0x3b')][_0x7657('0x7f')])){for(var _0x380698=0x0;_0x380698<_0x245574[_0x7657('0x3b')][_0x7657('0x7f')][_0x7657('0x42')];_0x380698+=0x1){socket['emit'](_0x7657('0xb7'),{'UserId':Number(_0x245574['query']['ids'][_0x380698]),'MailAccountId':Number(_0x245574[_0x7657('0x50')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x245574['query'][_0x7657('0x7f')]),'MailAccountId':Number(_0x245574['params']['id'])});}});}})[_0x7657('0x1a')](respondWithStatusCode(_0x2a326a,null))[_0x7657('0x25')](handleError(_0x2a326a,null));};exports[_0x7657('0xb8')]=function(_0x3b0059,_0xb419c8,_0x22ae03){var _0x54ab7d={};var _0x2ed231={};var _0xc5b36d;var _0x31e09d;return db[_0x7657('0x39')][_0x7657('0x58')]({'where':{'id':_0x3b0059['params']['id']}})[_0x7657('0x1a')](handleEntityNotFound(_0xb419c8,null))[_0x7657('0x1a')](function(_0x315e22){if(_0x315e22){_0xc5b36d=_0x315e22;_0x2ed231['model']=_[_0x7657('0x3c')](db['User'][_0x7657('0x3a')]);_0x2ed231[_0x7657('0x3b')]=_['keys'](_0x3b0059[_0x7657('0x3b')]);_0x2ed231['filters']=_[_0x7657('0x3f')](_0x2ed231[_0x7657('0x40')],_0x2ed231['query']);_0x54ab7d[_0x7657('0x3e')]=_['intersection'](_0x2ed231[_0x7657('0x40')],qs[_0x7657('0x41')](_0x3b0059[_0x7657('0x3b')][_0x7657('0x41')]));_0x54ab7d[_0x7657('0x3e')]=_0x54ab7d['attributes']['length']?_0x54ab7d['attributes']:_0x2ed231[_0x7657('0x40')];_0x54ab7d['order']=qs[_0x7657('0x45')](_0x3b0059['query']['sort']);_0x54ab7d[_0x7657('0x47')]=qs[_0x7657('0x3d')](_[_0x7657('0x46')](_0x3b0059[_0x7657('0x3b')],_0x2ed231[_0x7657('0x3d')]));if(_0x3b0059[_0x7657('0x3b')][_0x7657('0x48')]){_0x54ab7d['where']=_[_0x7657('0x49')](_0x54ab7d[_0x7657('0x47')],{'$or':_[_0x7657('0x38')](_0x54ab7d['attributes'],function(_0x46428c){var _0x39c2bf={};_0x39c2bf[_0x46428c]={'$like':'%'+_0x3b0059['query'][_0x7657('0x48')]+'%'};return _0x39c2bf;})});}_0x54ab7d=_[_0x7657('0x49')]({},_0x54ab7d,_0x3b0059[_0x7657('0x4a')]);return _0xc5b36d[_0x7657('0xb8')](_0x54ab7d);}})[_0x7657('0x1a')](function(_0x4db42e){if(_0x4db42e){_0x31e09d=_0x4db42e[_0x7657('0x42')];if(!_0x3b0059['query']['hasOwnProperty']('nolimit')){_0x54ab7d[_0x7657('0x28')]=qs[_0x7657('0x28')](_0x3b0059[_0x7657('0x3b')][_0x7657('0x28')]);_0x54ab7d[_0x7657('0x27')]=qs['offset'](_0x3b0059['query'][_0x7657('0x27')]);}return _0xc5b36d[_0x7657('0xb8')](_0x54ab7d);}})['then'](function(_0x5a1aa9){if(_0x5a1aa9){return _0x5a1aa9?{'count':_0x31e09d,'rows':_0x5a1aa9}:null;}})['then'](respondWithResult(_0xb419c8,null))[_0x7657('0x25')](handleError(_0xb419c8,null));}; \ No newline at end of file +var _0x73b6=['password','cpassword','authentication','host','port','pass','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','sequelize','transaction','MailApplication','findAndCountAll','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','service','auth','secure','SendMail','sendMail','List\x20not\x20found','attach','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','undefined','count','Content-Range','reject','save','MailAccounts','UserProfileResource','destroy','name','send','index','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','Smtp','keys','length','options','find','update','body','describe','addDisposition','MailAccountId','Disposition','create','findOne','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser'];(function(_0x47ed8d,_0x23abd5){var _0x2434c6=function(_0xbd9cb6){while(--_0xbd9cb6){_0x47ed8d['push'](_0x47ed8d['shift']());}};_0x2434c6(++_0x23abd5);}(_0x73b6,0x10c));var _0x673b=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x73b6[_0x42f009];return _0x22a1e0;};'use strict';var emlformat=require(_0x673b('0x0'));var rimraf=require(_0x673b('0x1'));var zipdir=require(_0x673b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x673b('0x3'));var BPromise=require(_0x673b('0x4'));var Mustache=require(_0x673b('0x5'));var util=require(_0x673b('0x6'));var path=require('path');var sox=require(_0x673b('0x7'));var csv=require(_0x673b('0x8'));var ejs=require(_0x673b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x673b('0xa'));var squel=require(_0x673b('0xb'));var crypto=require(_0x673b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x673b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x673b('0xe'));var Papa=require(_0x673b('0xf'));var htmlToText=require(_0x673b('0x10'));var juice=require(_0x673b('0x11'));var Redis=require(_0x673b('0x12'));var authService=require(_0x673b('0x13'));var qs=require(_0x673b('0x14'));var as=require(_0x673b('0x15'));var hardwareService=require(_0x673b('0x16'));var logger=require(_0x673b('0x17'))(_0x673b('0x18'));var utils=require(_0x673b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x673b('0x1a'));var db=require(_0x673b('0x1b'))['db'];config[_0x673b('0x1c')]=_[_0x673b('0x1d')](config[_0x673b('0x1c')],{'host':_0x673b('0x1e'),'port':0x18eb});var socket=require(_0x673b('0x1f'))(new Redis(config['redis']));require(_0x673b('0x20'))[_0x673b('0x21')](socket);var jayson=require(_0x673b('0x22'));var client=jayson['client'][_0x673b('0x23')]({'port':0x232b});function respondWithRpcPromise(_0x5031a4,_0x52889d,_0x2cc23f,_0x4c133c){return new BPromise(function(_0x4786d1,_0x208f59){var _0x2c129f=_0x4c133c||client;return _0x2c129f[_0x673b('0x24')](_0x5031a4,_0x2cc23f)[_0x673b('0x25')](function(_0x502c06){logger[_0x673b('0x26')](_0x673b('0x27'),_0x52889d,'request\x20sent');logger[_0x673b('0x28')](_0x673b('0x29'),_0x52889d,_0x673b('0x2a'),JSON[_0x673b('0x2b')](_0x502c06));if(_0x502c06[_0x673b('0x2c')]){if(_0x502c06['error'][_0x673b('0x2d')]===0x1f4){logger[_0x673b('0x2c')](_0x673b('0x27'),_0x52889d,_0x502c06[_0x673b('0x2c')][_0x673b('0x2e')]);return _0x208f59(_0x502c06[_0x673b('0x2c')][_0x673b('0x2e')]);}logger[_0x673b('0x2c')]('MailAccount,\x20%s,\x20%s',_0x52889d,_0x502c06[_0x673b('0x2c')][_0x673b('0x2e')]);return _0x4786d1(_0x502c06[_0x673b('0x2c')]['message']);}else{logger['info'](_0x673b('0x27'),_0x52889d,_0x673b('0x2a'));_0x4786d1(_0x502c06['result'][_0x673b('0x2e')]);}})[_0x673b('0x2f')](function(_0x2c98f6){logger[_0x673b('0x2c')](_0x673b('0x27'),_0x52889d,_0x2c98f6);_0x208f59(_0x2c98f6);});});}function respondWithStatusCode(_0xea6973,_0x4f5d17){_0x4f5d17=_0x4f5d17||0xcc;return function(_0x1bd1f8){if(_0x1bd1f8){return _0xea6973[_0x673b('0x30')](_0x4f5d17);}return _0xea6973[_0x673b('0x31')](_0x4f5d17)[_0x673b('0x32')]();};}function respondWithResult(_0x2617bf,_0x29fa35){_0x29fa35=_0x29fa35||0xc8;return function(_0x2ad434){if(_0x2ad434){return _0x2617bf[_0x673b('0x31')](_0x29fa35)['json'](_0x2ad434);}};}function respondWithFilteredResult(_0x78c7d2,_0xc92bf9){return function(_0x3fb0c8){if(_0x3fb0c8){var _0x54a7fb=typeof _0xc92bf9[_0x673b('0x33')]==='undefined'&&typeof _0xc92bf9[_0x673b('0x34')]===_0x673b('0x35');var _0x97fd0b=_0x3fb0c8[_0x673b('0x36')];var _0x3a8802=_0x54a7fb?0x0:_0xc92bf9[_0x673b('0x33')];var _0x1e396f=_0x54a7fb?_0x3fb0c8[_0x673b('0x36')]:_0xc92bf9['offset']+_0xc92bf9['limit'];var _0x2d3643;if(_0x1e396f>=_0x97fd0b){_0x1e396f=_0x97fd0b;_0x2d3643=0xc8;}else{_0x2d3643=0xce;}_0x78c7d2[_0x673b('0x31')](_0x2d3643);return _0x78c7d2['set'](_0x673b('0x37'),_0x3a8802+'-'+_0x1e396f+'/'+_0x97fd0b)['json'](_0x3fb0c8);}return null;};}function patchUpdates(_0x161f42){return function(_0x4dbdf0){try{jsonpatch['apply'](_0x4dbdf0,_0x161f42,!![]);}catch(_0x83f4d1){return BPromise[_0x673b('0x38')](_0x83f4d1);}return _0x4dbdf0[_0x673b('0x39')]();};}function saveUpdates(_0x183040,_0x5e02e4){return function(_0x16506a){if(_0x16506a){return _0x16506a['update'](_0x183040)[_0x673b('0x25')](function(_0x1071d3){return _0x1071d3;});}return null;};}function removeEntity(_0x16f6a1,_0x5f01da){return function(_0x57fe9e){if(_0x57fe9e){return _0x57fe9e['destroy']()[_0x673b('0x25')](function(){var _0x1ee1f2=_0x57fe9e['get']({'plain':!![]});var _0x43b4b4=_0x673b('0x3a');return db[_0x673b('0x3b')][_0x673b('0x3c')]({'where':{'type':_0x43b4b4,'resourceId':_0x1ee1f2['id']}})['then'](function(){return _0x57fe9e;});})[_0x673b('0x25')](function(){_0x16f6a1[_0x673b('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ef9bc,_0x5ee185){return function(_0x3e48b7){if(!_0x3e48b7){_0x2ef9bc[_0x673b('0x30')](0x194);}return _0x3e48b7;};}function handleError(_0x1d8504,_0x1628a0){_0x1628a0=_0x1628a0||0x1f4;return function(_0x31491d){logger[_0x673b('0x2c')](_0x31491d['stack']);if(_0x31491d[_0x673b('0x3d')]){delete _0x31491d[_0x673b('0x3d')];}_0x1d8504[_0x673b('0x31')](_0x1628a0)[_0x673b('0x3e')](_0x31491d);};}exports[_0x673b('0x3f')]=function(_0xab3dee,_0x180902){var _0x559ffc={'include':[{'model':db[_0x673b('0x40')],'as':_0x673b('0x41')},{'model':db[_0x673b('0x42')],'as':'Smtp'},{'model':db[_0x673b('0x43')],'as':_0x673b('0x44')}]},_0x58d5d0={},_0x171326={'count':0x0,'rows':[]};var _0x1892ee=_[_0x673b('0x45')](db[_0x673b('0x46')][_0x673b('0x47')],function(_0x249be8){return{'name':_0x249be8[_0x673b('0x48')],'type':_0x249be8[_0x673b('0x49')][_0x673b('0x4a')]};});_0x58d5d0[_0x673b('0x4b')]=_[_0x673b('0x45')](_0x1892ee,'name');_0x58d5d0[_0x673b('0x4c')]=_['keys'](_0xab3dee[_0x673b('0x4c')]);_0x58d5d0[_0x673b('0x4d')]=_['intersection'](_0x58d5d0[_0x673b('0x4b')],_0x58d5d0[_0x673b('0x4c')]);_0x559ffc['attributes']=_[_0x673b('0x4e')](_0x58d5d0['model'],qs[_0x673b('0x4f')](_0xab3dee[_0x673b('0x4c')]['fields']));_0x559ffc[_0x673b('0x50')]=_0x559ffc[_0x673b('0x50')]['length']?_0x559ffc['attributes']:_0x58d5d0[_0x673b('0x4b')];if(!_0xab3dee[_0x673b('0x4c')][_0x673b('0x51')](_0x673b('0x52'))){_0x559ffc[_0x673b('0x34')]=qs['limit'](_0xab3dee[_0x673b('0x4c')]['limit']);_0x559ffc[_0x673b('0x33')]=qs[_0x673b('0x33')](_0xab3dee[_0x673b('0x4c')][_0x673b('0x33')]);}_0x559ffc[_0x673b('0x53')]=qs[_0x673b('0x54')](_0xab3dee[_0x673b('0x4c')][_0x673b('0x54')]);_0x559ffc[_0x673b('0x55')]=qs[_0x673b('0x4d')](_[_0x673b('0x56')](_0xab3dee[_0x673b('0x4c')],_0x58d5d0['filters']),_0x1892ee);if(_0xab3dee['query'][_0x673b('0x57')]){_0x559ffc[_0x673b('0x55')]=_[_0x673b('0x58')](_0x559ffc[_0x673b('0x55')],{'$or':_['map'](_0x1892ee,function(_0x1b7721){if(_0x1b7721['type']!==_0x673b('0x59')){var _0x54f20d={};_0x54f20d[_0x1b7721[_0x673b('0x3d')]]={'$like':'%'+_0xab3dee[_0x673b('0x4c')]['filter']+'%'};return _0x54f20d;}})});}_0x559ffc=_[_0x673b('0x58')]({},_0x559ffc,_0xab3dee['options']);var _0x256743={'where':_0x559ffc[_0x673b('0x55')]};return db[_0x673b('0x46')][_0x673b('0x36')](_0x256743)[_0x673b('0x25')](function(_0x58e8cf){_0x171326[_0x673b('0x36')]=_0x58e8cf;if(_0xab3dee['query'][_0x673b('0x5a')]){_0x559ffc[_0x673b('0x5b')]=[{'all':!![]}];}return db['MailAccount'][_0x673b('0x5c')](_0x559ffc);})[_0x673b('0x25')](function(_0x3b9b6c){_0x171326[_0x673b('0x5d')]=_0x3b9b6c;return _0x171326;})[_0x673b('0x25')](respondWithFilteredResult(_0x180902,_0x559ffc))['catch'](handleError(_0x180902,null));};exports['show']=function(_0x571e02,_0x465dc1){var _0x36b1b1={'raw':![],'where':{'id':_0x571e02[_0x673b('0x5e')]['id']},'include':[{'model':db[_0x673b('0x40')],'as':_0x673b('0x41')},{'model':db[_0x673b('0x42')],'as':_0x673b('0x5f')},{'model':db['Pause'],'as':_0x673b('0x44')}]},_0x327915={};_0x327915[_0x673b('0x4b')]=_[_0x673b('0x60')](db[_0x673b('0x46')][_0x673b('0x47')]);_0x327915[_0x673b('0x4c')]=_[_0x673b('0x60')](_0x571e02[_0x673b('0x4c')]);_0x327915['filters']=_['intersection'](_0x327915[_0x673b('0x4b')],_0x327915[_0x673b('0x4c')]);_0x36b1b1[_0x673b('0x50')]=_['intersection'](_0x327915['model'],qs[_0x673b('0x4f')](_0x571e02[_0x673b('0x4c')][_0x673b('0x4f')]));_0x36b1b1[_0x673b('0x50')]=_0x36b1b1[_0x673b('0x50')][_0x673b('0x61')]?_0x36b1b1['attributes']:_0x327915['model'];if(_0x571e02['query'][_0x673b('0x5a')]){_0x36b1b1[_0x673b('0x5b')]=[{'all':!![]}];}_0x36b1b1=_[_0x673b('0x58')]({},_0x36b1b1,_0x571e02[_0x673b('0x62')]);return db['MailAccount'][_0x673b('0x63')](_0x36b1b1)[_0x673b('0x25')](handleEntityNotFound(_0x465dc1,null))[_0x673b('0x25')](respondWithResult(_0x465dc1,null))[_0x673b('0x2f')](handleError(_0x465dc1,null));};exports[_0x673b('0x64')]=function(_0x2afddc,_0x58bec8){if(_0x2afddc['body']['id']){delete _0x2afddc[_0x673b('0x65')]['id'];}return db['MailAccount'][_0x673b('0x63')]({'where':{'id':_0x2afddc['params']['id']},'include':[{'model':db[_0x673b('0x40')],'as':'Imap'},{'model':db[_0x673b('0x42')],'as':_0x673b('0x5f')},{'model':db['Pause'],'as':_0x673b('0x44')}]})[_0x673b('0x25')](handleEntityNotFound(_0x58bec8,null))[_0x673b('0x25')](saveUpdates(_0x2afddc[_0x673b('0x65')],null))[_0x673b('0x25')](function(_0x248037){if(_0x248037&&_0x2afddc['body'][_0x673b('0x41')]){return db['MailServerIn'][_0x673b('0x64')](_0x2afddc[_0x673b('0x65')][_0x673b('0x41')],{'where':{'MailAccountId':_0x248037['id']}})[_0x673b('0x25')](function(){return _0x248037;});}return _0x248037;})['then'](function(_0x242b27){if(_0x242b27&&_0x2afddc[_0x673b('0x65')][_0x673b('0x5f')]){return db[_0x673b('0x42')]['update'](_0x2afddc[_0x673b('0x65')][_0x673b('0x5f')],{'where':{'MailAccountId':_0x242b27['id']}})[_0x673b('0x25')](function(){return _0x242b27;});}return _0x242b27;})[_0x673b('0x25')](respondWithResult(_0x58bec8,null))[_0x673b('0x2f')](handleError(_0x58bec8,null));};exports[_0x673b('0x66')]=function(_0x49c063,_0x32bafb){return db[_0x673b('0x46')][_0x673b('0x66')]()['then'](respondWithResult(_0x32bafb,null))[_0x673b('0x2f')](handleError(_0x32bafb,null));};exports[_0x673b('0x67')]=function(_0x1e81b4,_0x7c5e77,_0x131225){if(_0x1e81b4[_0x673b('0x65')]['id']){delete _0x1e81b4[_0x673b('0x65')]['id'];}return db[_0x673b('0x46')]['find']({'where':{'id':_0x1e81b4[_0x673b('0x5e')]['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x7c5e77,null))['then'](function(_0x2eea4a){if(_0x2eea4a){_0x1e81b4[_0x673b('0x65')][_0x673b('0x68')]=_0x2eea4a['id'];return db[_0x673b('0x69')][_0x673b('0x6a')](_0x1e81b4[_0x673b('0x65')]);}})[_0x673b('0x25')](respondWithResult(_0x7c5e77,null))[_0x673b('0x2f')](handleError(_0x7c5e77,null));};exports['getDispositions']=function(_0x5578d6,_0x1c37de,_0x32c63f){var _0x18b998={'raw':![],'where':{}};var _0x3b9956={};var _0x2a9604={'count':0x0,'rows':[]};return db['MailAccount'][_0x673b('0x6b')]({'where':{'id':_0x5578d6[_0x673b('0x5e')]['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x1c37de,null))[_0x673b('0x25')](function(_0x2d34c5){if(_0x2d34c5){_0x3b9956[_0x673b('0x4b')]=_[_0x673b('0x60')](db[_0x673b('0x69')]['rawAttributes']);_0x3b9956['query']=_['keys'](_0x5578d6[_0x673b('0x4c')]);_0x3b9956[_0x673b('0x4d')]=_[_0x673b('0x4e')](_0x3b9956[_0x673b('0x4b')],_0x3b9956[_0x673b('0x4c')]);_0x18b998[_0x673b('0x50')]=_[_0x673b('0x4e')](_0x3b9956[_0x673b('0x4b')],qs[_0x673b('0x4f')](_0x5578d6[_0x673b('0x4c')][_0x673b('0x4f')]));_0x18b998[_0x673b('0x50')]=_0x18b998[_0x673b('0x50')][_0x673b('0x61')]?_0x18b998[_0x673b('0x50')]:_0x3b9956[_0x673b('0x4b')];if(!_0x5578d6[_0x673b('0x4c')][_0x673b('0x51')](_0x673b('0x52'))){_0x18b998[_0x673b('0x34')]=qs[_0x673b('0x34')](_0x5578d6[_0x673b('0x4c')][_0x673b('0x34')]);_0x18b998[_0x673b('0x33')]=qs['offset'](_0x5578d6[_0x673b('0x4c')][_0x673b('0x33')]);}_0x18b998['order']=qs[_0x673b('0x54')](_0x5578d6[_0x673b('0x4c')][_0x673b('0x54')]);_0x18b998[_0x673b('0x55')]=qs[_0x673b('0x4d')](_[_0x673b('0x56')](_0x5578d6[_0x673b('0x4c')],_0x3b9956['filters']));_0x18b998[_0x673b('0x55')]['MailAccountId']=_0x2d34c5['id'];if(_0x5578d6['query']['filter']){_0x18b998[_0x673b('0x55')]=_[_0x673b('0x58')](_0x18b998[_0x673b('0x55')],{'$or':_[_0x673b('0x45')](_0x18b998[_0x673b('0x50')],function(_0x3f668e){var _0x461e36={};_0x461e36[_0x3f668e]={'$like':'%'+_0x5578d6[_0x673b('0x4c')][_0x673b('0x57')]+'%'};return _0x461e36;})});}_0x18b998=_[_0x673b('0x58')]({},_0x18b998,_0x5578d6['options']);return db[_0x673b('0x69')]['count']({'where':_0x18b998[_0x673b('0x55')]})[_0x673b('0x25')](function(_0x79c338){_0x2a9604[_0x673b('0x36')]=_0x79c338;if(_0x5578d6['query'][_0x673b('0x5a')]){_0x18b998[_0x673b('0x5b')]=[{'all':!![]}];}return db[_0x673b('0x69')][_0x673b('0x5c')](_0x18b998);})[_0x673b('0x25')](function(_0xbb36fd){_0x2a9604['rows']=_0xbb36fd;return _0x2a9604;});}})['then'](respondWithFilteredResult(_0x1c37de,_0x18b998))[_0x673b('0x2f')](handleError(_0x1c37de,null));};exports['removeDispositions']=function(_0x55ae51,_0x270df0,_0x4da899){return db[_0x673b('0x46')][_0x673b('0x63')]({'where':{'id':_0x55ae51[_0x673b('0x5e')]['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x270df0,null))[_0x673b('0x25')](function(_0x58c281){if(_0x58c281){return _0x58c281['removeDispositions'](_0x55ae51[_0x673b('0x4c')][_0x673b('0x6c')]);}})['then'](respondWithStatusCode(_0x270df0,null))[_0x673b('0x2f')](handleError(_0x270df0,null));};exports[_0x673b('0x6d')]=function(_0x22ebbf,_0x2b59ba,_0x59cdfb){if(_0x22ebbf['body']['id']){delete _0x22ebbf[_0x673b('0x65')]['id'];}return db['MailAccount'][_0x673b('0x63')]({'where':{'id':_0x22ebbf[_0x673b('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2b59ba,null))['then'](function(_0x71cb40){if(_0x71cb40){_0x22ebbf[_0x673b('0x65')][_0x673b('0x68')]=_0x71cb40['id'];return db[_0x673b('0x6e')]['create'](_0x22ebbf[_0x673b('0x65')]);}})[_0x673b('0x25')](respondWithResult(_0x2b59ba,null))[_0x673b('0x2f')](handleError(_0x2b59ba,null));};exports[_0x673b('0x6f')]=function(_0x478a65,_0x4b8e05,_0x1bd0b4){var _0x3b6635={'raw':![],'where':{}};var _0x484f83={};var _0x2bb9ff={'count':0x0,'rows':[]};return db[_0x673b('0x46')][_0x673b('0x6b')]({'where':{'id':_0x478a65[_0x673b('0x5e')]['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x4b8e05,null))['then'](function(_0x25d09c){if(_0x25d09c){_0x484f83['model']=_[_0x673b('0x60')](db[_0x673b('0x6e')]['rawAttributes']);_0x484f83[_0x673b('0x4c')]=_[_0x673b('0x60')](_0x478a65[_0x673b('0x4c')]);_0x484f83[_0x673b('0x4d')]=_[_0x673b('0x4e')](_0x484f83[_0x673b('0x4b')],_0x484f83[_0x673b('0x4c')]);_0x3b6635[_0x673b('0x50')]=_[_0x673b('0x4e')](_0x484f83[_0x673b('0x4b')],qs[_0x673b('0x4f')](_0x478a65[_0x673b('0x4c')][_0x673b('0x4f')]));_0x3b6635[_0x673b('0x50')]=_0x3b6635[_0x673b('0x50')][_0x673b('0x61')]?_0x3b6635['attributes']:_0x484f83['model'];if(!_0x478a65[_0x673b('0x4c')][_0x673b('0x51')](_0x673b('0x52'))){_0x3b6635[_0x673b('0x34')]=qs[_0x673b('0x34')](_0x478a65[_0x673b('0x4c')]['limit']);_0x3b6635[_0x673b('0x33')]=qs[_0x673b('0x33')](_0x478a65['query'][_0x673b('0x33')]);}_0x3b6635[_0x673b('0x53')]=qs[_0x673b('0x54')](_0x478a65[_0x673b('0x4c')][_0x673b('0x54')]);_0x3b6635['where']=qs[_0x673b('0x4d')](_[_0x673b('0x56')](_0x478a65[_0x673b('0x4c')],_0x484f83[_0x673b('0x4d')]));_0x3b6635[_0x673b('0x55')]['MailAccountId']=_0x25d09c['id'];if(_0x478a65['query'][_0x673b('0x57')]){_0x3b6635['where']=_['merge'](_0x3b6635['where'],{'$or':_['map'](_0x3b6635[_0x673b('0x50')],function(_0x93c0c){var _0x5b5619={};_0x5b5619[_0x93c0c]={'$like':'%'+_0x478a65[_0x673b('0x4c')][_0x673b('0x57')]+'%'};return _0x5b5619;})});}_0x3b6635=_[_0x673b('0x58')]({},_0x3b6635,_0x478a65['options']);return db[_0x673b('0x6e')]['count']({'where':_0x3b6635[_0x673b('0x55')]})[_0x673b('0x25')](function(_0x5817f8){_0x2bb9ff[_0x673b('0x36')]=_0x5817f8;if(_0x478a65[_0x673b('0x4c')][_0x673b('0x5a')]){_0x3b6635[_0x673b('0x5b')]=[{'all':!![]}];}return db[_0x673b('0x6e')][_0x673b('0x5c')](_0x3b6635);})['then'](function(_0x5e78ee){_0x2bb9ff[_0x673b('0x5d')]=_0x5e78ee;return _0x2bb9ff;});}})[_0x673b('0x25')](respondWithFilteredResult(_0x4b8e05,_0x3b6635))[_0x673b('0x2f')](handleError(_0x4b8e05,null));};exports[_0x673b('0x70')]=function(_0x149f27,_0x33ace4,_0x45f193){return db[_0x673b('0x46')][_0x673b('0x63')]({'where':{'id':_0x149f27[_0x673b('0x5e')]['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x33ace4,null))[_0x673b('0x25')](function(_0x140af0){if(_0x140af0){return _0x140af0[_0x673b('0x70')](_0x149f27[_0x673b('0x4c')][_0x673b('0x6c')]);}})[_0x673b('0x25')](respondWithStatusCode(_0x33ace4,null))['catch'](handleError(_0x33ace4,null));};exports[_0x673b('0x6a')]=function(_0x281dd7,_0x269c08){var _0x3f9bae={'name':_0x281dd7[_0x673b('0x65')][_0x673b('0x3d')],'key':_0x281dd7[_0x673b('0x65')][_0x673b('0x4a')],'email':_0x281dd7[_0x673b('0x65')][_0x673b('0x71')],'ListId':_0x281dd7['body'][_0x673b('0x72')],'active':!_[_0x673b('0x73')](_0x281dd7[_0x673b('0x65')][_0x673b('0x74')])?_0x281dd7[_0x673b('0x65')]['active']:!![],'description':_0x281dd7[_0x673b('0x65')][_0x673b('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0x673b('0x73')](_0x281dd7['body'][_0x673b('0x76')])){if(_0x281dd7[_0x673b('0x65')][_0x673b('0x77')]){_0x3f9bae[_0x673b('0x41')][_0x673b('0x78')]=_0x3f9bae[_0x673b('0x5f')][_0x673b('0x78')]=_0x281dd7[_0x673b('0x65')][_0x673b('0x79')];_0x3f9bae[_0x673b('0x41')][_0x673b('0x7a')]=_0x3f9bae[_0x673b('0x5f')]['pass']=_0x281dd7[_0x673b('0x65')][_0x673b('0x7b')];}else{_0x3f9bae[_0x673b('0x41')][_0x673b('0x7c')]=_0x3f9bae[_0x673b('0x5f')]['authentication']=![];}_0x3f9bae[_0x673b('0x41')][_0x673b('0x7d')]=_0x281dd7[_0x673b('0x65')]['Imap'][_0x673b('0x7d')];_0x3f9bae[_0x673b('0x41')][_0x673b('0x7e')]=_0x281dd7[_0x673b('0x65')]['Imap'][_0x673b('0x7e')];_0x3f9bae['Smtp'][_0x673b('0x7d')]=_0x281dd7['body'][_0x673b('0x5f')][_0x673b('0x7d')];_0x3f9bae[_0x673b('0x5f')][_0x673b('0x7e')]=_0x281dd7['body'][_0x673b('0x5f')]['port'];}else{_0x3f9bae['Imap']['service']=_0x3f9bae[_0x673b('0x5f')]['service']=_0x281dd7[_0x673b('0x65')]['cservice'];_0x3f9bae[_0x673b('0x41')][_0x673b('0x78')]=_0x3f9bae[_0x673b('0x5f')]['user']=_0x281dd7['body'][_0x673b('0x79')];_0x3f9bae[_0x673b('0x41')][_0x673b('0x7a')]=_0x3f9bae['Smtp'][_0x673b('0x7f')]=_0x281dd7[_0x673b('0x65')][_0x673b('0x7b')];}return db[_0x673b('0x46')][_0x673b('0x6a')](_0x3f9bae,{'include':[{'model':db[_0x673b('0x42')],'as':_0x673b('0x5f')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x673b('0x25')](function(_0x339a11){var _0x9475bc=_0x281dd7[_0x673b('0x78')][_0x673b('0x80')]({'plain':!![]});if(!_0x9475bc)throw new Error(_0x673b('0x81'));if(_0x9475bc[_0x673b('0x82')]===_0x673b('0x78')){var _0x166723=_0x339a11['get']({'plain':!![]});return db[_0x673b('0x83')][_0x673b('0x63')]({'where':{'name':_0x673b('0x3a'),'userProfileId':_0x9475bc[_0x673b('0x84')]},'raw':!![]})[_0x673b('0x25')](function(_0x1873f4){if(_0x1873f4&&_0x1873f4[_0x673b('0x85')]===0x0){return db['UserProfileResource'][_0x673b('0x6a')]({'name':_0x166723[_0x673b('0x3d')],'resourceId':_0x166723['id'],'type':_0x1873f4[_0x673b('0x3d')],'sectionId':_0x1873f4['id']},{})[_0x673b('0x25')](function(){return _0x339a11;});}else{return _0x339a11;}})['catch'](function(_0x4fb87b){logger[_0x673b('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fb87b);throw _0x4fb87b;});}return _0x339a11;})[_0x673b('0x25')](respondWithResult(_0x269c08,0xc9))[_0x673b('0x2f')](handleError(_0x269c08,null));};exports['getImap']=function(_0x3862ed,_0x2370d7,_0x49819f){return db[_0x673b('0x46')][_0x673b('0x6b')]({'where':{'id':_0x3862ed['params']['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x2370d7,null))[_0x673b('0x25')](function(_0x263e64){if(_0x263e64){return _0x263e64[_0x673b('0x86')]();}return null;})[_0x673b('0x25')](respondWithResult(_0x2370d7,null))['catch'](handleError(_0x2370d7,null));};exports['addImap']=function(_0x2981f0,_0x508b8f,_0x10be56){if(_0x2981f0['body']['id']){delete _0x2981f0['body']['id'];}return db['MailAccount'][_0x673b('0x63')]({'where':{'id':_0x2981f0[_0x673b('0x5e')]['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x508b8f,null))[_0x673b('0x25')](function(_0xdc15f1){if(_0xdc15f1){_0x2981f0[_0x673b('0x65')][_0x673b('0x68')]=_0xdc15f1['id'];return db[_0x673b('0x40')][_0x673b('0x6a')](_0x2981f0[_0x673b('0x65')]);}})[_0x673b('0x25')](respondWithResult(_0x508b8f,null))['catch'](handleError(_0x508b8f,null));};exports[_0x673b('0x87')]=function(_0x91cd70,_0x1590b1,_0x341c15){return db[_0x673b('0x46')][_0x673b('0x6b')]({'where':{'id':_0x91cd70['params']['id']}})['then'](handleEntityNotFound(_0x1590b1,null))[_0x673b('0x25')](function(_0x491bd9){if(_0x491bd9){return _0x491bd9['setImap'](null);}return null;})[_0x673b('0x25')](respondWithStatusCode(_0x1590b1,null))[_0x673b('0x2f')](handleError(_0x1590b1,null));};exports[_0x673b('0x88')]=function(_0x3722c3,_0x38f07b,_0x488092){return db[_0x673b('0x46')][_0x673b('0x6b')]({'where':{'id':_0x3722c3[_0x673b('0x5e')]['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x38f07b,null))['then'](function(_0x62fc4){if(_0x62fc4){return _0x62fc4[_0x673b('0x88')]();}return null;})[_0x673b('0x25')](respondWithResult(_0x38f07b,null))[_0x673b('0x2f')](handleError(_0x38f07b,null));};exports[_0x673b('0x89')]=function(_0x44ca0d,_0x205280,_0x87d100){if(_0x44ca0d[_0x673b('0x65')]['id']){delete _0x44ca0d[_0x673b('0x65')]['id'];}return db[_0x673b('0x46')]['find']({'where':{'id':_0x44ca0d[_0x673b('0x5e')]['id']}})['then'](handleEntityNotFound(_0x205280,null))[_0x673b('0x25')](function(_0x190dbe){if(_0x190dbe){_0x44ca0d[_0x673b('0x65')]['MailAccountId']=_0x190dbe['id'];return db['MailServerOut'][_0x673b('0x6a')](_0x44ca0d[_0x673b('0x65')]);}})[_0x673b('0x25')](respondWithResult(_0x205280,null))[_0x673b('0x2f')](handleError(_0x205280,null));};exports[_0x673b('0x8a')]=function(_0x5c269b,_0x14997d,_0x508bc3){return db[_0x673b('0x46')][_0x673b('0x6b')]({'where':{'id':_0x5c269b['params']['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x14997d,null))['then'](function(_0x374220){if(_0x374220){return _0x374220[_0x673b('0x8b')](null);}return null;})[_0x673b('0x25')](respondWithStatusCode(_0x14997d,null))[_0x673b('0x2f')](handleError(_0x14997d,null));};exports[_0x673b('0x8c')]=function(_0x37e75d,_0x27eb32,_0x5acae5){return db[_0x673b('0x8d')][_0x673b('0x63')]({'where':{'id':_0x37e75d[_0x673b('0x5e')]['id']}})['then'](handleEntityNotFound(_0x27eb32,null))[_0x673b('0x25')](function(_0x5100be){if(_0x5100be){return _0x5100be['addInteraction'](_0x37e75d[_0x673b('0x65')]['ids'],_[_0x673b('0x8e')](_0x37e75d['body'],[_0x673b('0x6c'),'id'])||{});}})[_0x673b('0x25')](respondWithResult(_0x27eb32,null))[_0x673b('0x2f')](handleError(_0x27eb32,null));};exports[_0x673b('0x8f')]=function(_0x55e164,_0x54fc95,_0x417646){var _0x48d8e3={'raw':![],'where':{}};var _0x228d5b={};var _0x439d8c={'count':0x0,'rows':[]};return db[_0x673b('0x46')][_0x673b('0x6b')]({'where':{'id':_0x55e164[_0x673b('0x5e')]['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x54fc95,null))['then'](function(_0x5cdc46){if(_0x5cdc46){_0x228d5b[_0x673b('0x4b')]=_[_0x673b('0x60')](db[_0x673b('0x8d')]['rawAttributes']);_0x228d5b[_0x673b('0x4c')]=_['keys'](_0x55e164[_0x673b('0x4c')]);_0x228d5b[_0x673b('0x4d')]=_[_0x673b('0x4e')](_0x228d5b['model'],_0x228d5b[_0x673b('0x4c')]);_0x48d8e3[_0x673b('0x50')]=_[_0x673b('0x4e')](_0x228d5b[_0x673b('0x4b')],qs[_0x673b('0x4f')](_0x55e164[_0x673b('0x4c')][_0x673b('0x4f')]));_0x48d8e3[_0x673b('0x50')]=_0x48d8e3[_0x673b('0x50')][_0x673b('0x61')]?_0x48d8e3[_0x673b('0x50')]:_0x228d5b['model'];if(!_0x55e164[_0x673b('0x4c')]['hasOwnProperty'](_0x673b('0x52'))){_0x48d8e3[_0x673b('0x34')]=qs[_0x673b('0x34')](_0x55e164[_0x673b('0x4c')][_0x673b('0x34')]);_0x48d8e3[_0x673b('0x33')]=qs[_0x673b('0x33')](_0x55e164[_0x673b('0x4c')][_0x673b('0x33')]);}_0x48d8e3[_0x673b('0x53')]=qs[_0x673b('0x54')](_0x55e164[_0x673b('0x4c')][_0x673b('0x54')]);_0x48d8e3['where']=qs[_0x673b('0x4d')](_[_0x673b('0x56')](_0x55e164[_0x673b('0x4c')],_0x228d5b[_0x673b('0x4d')]));_0x48d8e3[_0x673b('0x55')][_0x673b('0x68')]=_0x5cdc46['id'];if(_0x55e164[_0x673b('0x4c')]['filter']){_0x48d8e3['where']=_[_0x673b('0x58')](_0x48d8e3[_0x673b('0x55')],{'$or':_[_0x673b('0x45')](_0x48d8e3[_0x673b('0x50')],function(_0xa3cc95){var _0x457b46={};_0x457b46[_0xa3cc95]={'$like':'%'+_0x55e164['query'][_0x673b('0x57')]+'%'};return _0x457b46;})});}_0x48d8e3=_[_0x673b('0x58')]({},_0x48d8e3,_0x55e164['options']);return db['MailInteraction']['count']({'where':_0x48d8e3[_0x673b('0x55')]})[_0x673b('0x25')](function(_0x226c61){_0x439d8c['count']=_0x226c61;if(_0x55e164[_0x673b('0x4c')]['includeAll']){_0x48d8e3[_0x673b('0x5b')]=[{'model':db['CmContact'],'as':_0x673b('0x90'),'required':![]},{'model':db['User'],'as':_0x673b('0x91'),'attributes':[_0x673b('0x3d'),_0x673b('0x92'),_0x673b('0x93')],'required':![]},{'model':db['Tag'],'as':_0x673b('0x94'),'attributes':['id','name',_0x673b('0x95')],'where':_0x55e164[_0x673b('0x4c')][_0x673b('0x96')]?{'id':_0x55e164[_0x673b('0x4c')]['tag']}:undefined,'required':_0x55e164[_0x673b('0x4c')][_0x673b('0x96')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x48d8e3);})['then'](function(_0x1bf211){_0x439d8c['rows']=_0x1bf211;return _0x439d8c;});}})[_0x673b('0x25')](respondWithFilteredResult(_0x54fc95,_0x48d8e3))[_0x673b('0x2f')](handleError(_0x54fc95,null));};exports['addApplications']=function(_0x442bb2,_0x2cfcb1,_0x2c794d){return db[_0x673b('0x46')][_0x673b('0x6b')]({'where':{'id':_0x442bb2[_0x673b('0x5e')]['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x2cfcb1,null))[_0x673b('0x25')](function(_0x340325){if(_0x340325){return db[_0x673b('0x97')][_0x673b('0x98')](function(_0x4d59ed){return db[_0x673b('0x99')][_0x673b('0x3c')]({'where':{'MailAccountId':_0x442bb2[_0x673b('0x5e')]['id']},'transaction':_0x4d59ed})[_0x673b('0x25')](function(_0x44ac0e){var _0x3ddd33=_[_0x673b('0x45')](_0x442bb2[_0x673b('0x65')],function(_0x249b68){_0x249b68[_0x673b('0x68')]=_0x442bb2[_0x673b('0x5e')]['id'];return _0x249b68;});return db[_0x673b('0x99')]['bulkCreate'](_0x3ddd33,{'transaction':_0x4d59ed});});})[_0x673b('0x25')](function(){return db[_0x673b('0x99')][_0x673b('0x9a')]({'where':{'MailAccountId':_0x442bb2[_0x673b('0x5e')]['id']},'order':'priority'});});}})[_0x673b('0x25')](respondWithResult(_0x2cfcb1,null))['catch'](handleError(_0x2cfcb1,null));};exports['getApplications']=function(_0x128338,_0x38a77b,_0x4a8746){var _0x312889={};var _0x1f7c4a={};var _0x41e5ec;var _0x215577;return db['MailAccount'][_0x673b('0x6b')]({'where':{'id':_0x128338[_0x673b('0x5e')]['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x38a77b,null))[_0x673b('0x25')](function(_0x23ac74){if(_0x23ac74){_0x41e5ec=_0x23ac74;_0x1f7c4a['model']=_[_0x673b('0x60')](db[_0x673b('0x99')][_0x673b('0x47')]);_0x1f7c4a[_0x673b('0x4c')]=_['keys'](_0x128338['query']);_0x1f7c4a[_0x673b('0x4d')]=_[_0x673b('0x4e')](_0x1f7c4a[_0x673b('0x4b')],_0x1f7c4a['query']);_0x312889[_0x673b('0x50')]=_['intersection'](_0x1f7c4a[_0x673b('0x4b')],qs[_0x673b('0x4f')](_0x128338['query'][_0x673b('0x4f')]));_0x312889['attributes']=_0x312889[_0x673b('0x50')][_0x673b('0x61')]?_0x312889['attributes']:_0x1f7c4a['model'];_0x312889[_0x673b('0x53')]=qs[_0x673b('0x54')](_0x128338['query'][_0x673b('0x54')]);_0x312889[_0x673b('0x55')]=qs[_0x673b('0x4d')](_[_0x673b('0x56')](_0x128338[_0x673b('0x4c')],_0x1f7c4a[_0x673b('0x4d')]));if(_0x128338[_0x673b('0x4c')][_0x673b('0x57')]){_0x312889[_0x673b('0x55')]=_[_0x673b('0x58')](_0x312889[_0x673b('0x55')],{'$or':_[_0x673b('0x45')](_0x312889[_0x673b('0x50')],function(_0x2e1d8e){var _0x613ade={};_0x613ade[_0x2e1d8e]={'$like':'%'+_0x128338['query'][_0x673b('0x57')]+'%'};return _0x613ade;})});}_0x312889=_[_0x673b('0x58')]({},_0x312889,_0x128338['options']);return _0x41e5ec['getApplications'](_0x312889);}})[_0x673b('0x25')](function(_0x3479ba){if(_0x3479ba){_0x215577=_0x3479ba[_0x673b('0x61')];if(!_0x128338[_0x673b('0x4c')]['hasOwnProperty'](_0x673b('0x52'))){_0x312889['limit']=qs[_0x673b('0x34')](_0x128338[_0x673b('0x4c')][_0x673b('0x34')]);_0x312889[_0x673b('0x33')]=qs[_0x673b('0x33')](_0x128338[_0x673b('0x4c')][_0x673b('0x33')]);}return _0x41e5ec['getApplications'](_0x312889);}})[_0x673b('0x25')](function(_0x329e51){if(_0x329e51){return _0x329e51?{'count':_0x215577,'rows':_0x329e51}:null;}})['then'](respondWithResult(_0x38a77b,null))[_0x673b('0x2f')](handleError(_0x38a77b,null));};exports['getMessages']=function(_0x3c13eb,_0x45506d,_0xd3d6d7){var _0x31780a={'raw':!![],'where':{}};var _0x48c8a8={};var _0x4b271d={'count':0x0,'rows':[]};return db[_0x673b('0x46')]['findOne']({'where':{'id':_0x3c13eb['params']['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x45506d,null))[_0x673b('0x25')](function(_0x567ef3){if(_0x567ef3){_0x48c8a8[_0x673b('0x4b')]=_[_0x673b('0x60')](db[_0x673b('0x9b')][_0x673b('0x47')]);_0x48c8a8[_0x673b('0x4c')]=_[_0x673b('0x60')](_0x3c13eb['query']);_0x48c8a8[_0x673b('0x4d')]=_[_0x673b('0x4e')](_0x48c8a8[_0x673b('0x4b')],_0x48c8a8[_0x673b('0x4c')]);_0x31780a['attributes']=_[_0x673b('0x4e')](_0x48c8a8['model'],qs[_0x673b('0x4f')](_0x3c13eb['query'][_0x673b('0x4f')]));_0x31780a[_0x673b('0x50')]=_0x31780a['attributes'][_0x673b('0x61')]?_0x31780a['attributes']:_0x48c8a8['model'];if(!_0x3c13eb[_0x673b('0x4c')][_0x673b('0x51')]('nolimit')){_0x31780a[_0x673b('0x34')]=qs[_0x673b('0x34')](_0x3c13eb[_0x673b('0x4c')]['limit']);_0x31780a[_0x673b('0x33')]=qs[_0x673b('0x33')](_0x3c13eb['query']['offset']);}_0x31780a[_0x673b('0x53')]=qs['sort'](_0x3c13eb[_0x673b('0x4c')][_0x673b('0x54')]);_0x31780a[_0x673b('0x55')]=qs[_0x673b('0x4d')](_[_0x673b('0x56')](_0x3c13eb[_0x673b('0x4c')],_0x48c8a8[_0x673b('0x4d')]));_0x31780a[_0x673b('0x55')][_0x673b('0x68')]=_0x567ef3['id'];if(_0x3c13eb[_0x673b('0x4c')][_0x673b('0x57')]){_0x31780a[_0x673b('0x55')]=_['merge'](_0x31780a[_0x673b('0x55')],{'$or':_[_0x673b('0x45')](_0x31780a[_0x673b('0x50')],function(_0x2ac1b0){var _0x2a3efa={};_0x2a3efa[_0x2ac1b0]={'$like':'%'+_0x3c13eb['query'][_0x673b('0x57')]+'%'};return _0x2a3efa;})});}if(_0x3c13eb[_0x673b('0x4c')]['$gte']){var _0x14f48f=_0x3c13eb[_0x673b('0x4c')]['$gte'][_0x673b('0x9c')](',');var _0x24f35a={};_0x24f35a[_0x14f48f[0x0]]={'$gte':moment(_0x14f48f[0x1])[_0x673b('0x9d')](_0x673b('0x9e'))};_0x31780a[_0x673b('0x55')]=_['merge'](_0x31780a[_0x673b('0x55')],_0x24f35a);}_0x31780a=_[_0x673b('0x58')]({},_0x31780a,_0x3c13eb[_0x673b('0x62')]);return db[_0x673b('0x9b')][_0x673b('0x36')]({'where':_0x31780a[_0x673b('0x55')]})['then'](function(_0x1902d6){_0x4b271d[_0x673b('0x36')]=_0x1902d6;if(_0x3c13eb[_0x673b('0x4c')][_0x673b('0x5a')]){_0x31780a[_0x673b('0x5b')]=[{'all':!![]}];}return db[_0x673b('0x9b')][_0x673b('0x5c')](_0x31780a);})['then'](function(_0x46a513){if(_0x3c13eb[_0x673b('0x4c')][_0x673b('0x9f')]===_0x673b('0xa0')){for(var _0x3640d1=0x0;_0x3640d1<_0x46a513[_0x673b('0x61')];_0x3640d1++){_0x46a513[_0x3640d1][_0x673b('0x65')]=juice(_0x46a513[_0x3640d1][_0x673b('0x65')]);}}_0x4b271d[_0x673b('0x5d')]=_0x46a513;return _0x4b271d;});}})[_0x673b('0x25')](respondWithFilteredResult(_0x45506d,_0x31780a))[_0x673b('0x2f')](handleError(_0x45506d,null));};exports[_0x673b('0x3e')]=function(_0x1460dc,_0x4462cf,_0x12b9ad){var _0xe7c8e0,_0x3dc322={},_0x1a1738;if(_0x1460dc[_0x673b('0x65')]['to']){_0x1a1738=_0x1460dc[_0x673b('0x65')]['to'][_0x673b('0x9c')](',')[0x0];}return db[_0x673b('0x46')][_0x673b('0x63')]({'where':{'id':_0x1460dc[_0x673b('0x5e')]['id']},'include':[{'model':db[_0x673b('0xa1')],'as':_0x673b('0xa2'),'include':[{'model':db['CmContact'],'as':_0x673b('0xa3'),'where':{'email':_0x1a1738},'limit':0x1,'order':[['updatedAt',_0x673b('0xa4')]]}]},{'model':db[_0x673b('0x42')],'as':_0x673b('0x5f'),'raw':!![]}]})['then'](handleEntityNotFound(_0x4462cf,null))['then'](function(_0x126255){if(_0x126255){_0xe7c8e0=_0x126255;if(_0x126255[_0x673b('0x5f')]){if(_[_0x673b('0x73')](_0x1460dc['body'][_0x673b('0xa5')])){_0x1460dc[_0x673b('0x65')][_0x673b('0xa5')]=util[_0x673b('0x9d')](_0x673b('0xa6'),_0x126255[_0x673b('0x3d')],_0x126255[_0x673b('0x71')]||_0x126255['Smtp']['user']);}if(_0x1460dc['body'][_0x673b('0xa7')]&&_0x1460dc[_0x673b('0x65')][_0x673b('0xa7')][_0x673b('0x61')]){for(var _0x227e72=0x0;_0x227e72<_0x1460dc[_0x673b('0x65')][_0x673b('0xa7')][_0x673b('0x61')];_0x227e72+=0x1){_0x1460dc[_0x673b('0x65')][_0x673b('0xa7')][_0x227e72]={'filename':_0x1460dc['body'][_0x673b('0xa7')][_0x227e72][_0x673b('0x3d')],'path':path['join'](config[_0x673b('0xa8')],_0x673b('0xa9'),_0x1460dc[_0x673b('0x65')]['attachments'][_0x227e72][_0x673b('0xaa')])};}}var _0x2daf16={'tls':{'rejectUnauthorized':![]}};if(_[_0x673b('0x73')](_0x126255[_0x673b('0x5f')][_0x673b('0xab')])){if(_0x126255['Smtp'][_0x673b('0x7c')]){_0x2daf16[_0x673b('0xac')]={'user':_0x126255[_0x673b('0x5f')][_0x673b('0x78')],'pass':_0x126255[_0x673b('0x5f')]['pass']};}_0x2daf16[_0x673b('0x7d')]=_0x126255[_0x673b('0x5f')][_0x673b('0x7d')];_0x2daf16[_0x673b('0x7e')]=_0x126255[_0x673b('0x5f')]['port'];_0x2daf16['secure']=_0x126255[_0x673b('0x5f')][_0x673b('0xad')];}else{_0x2daf16[_0x673b('0xab')]=_0x126255['Smtp'][_0x673b('0xab')];_0x2daf16[_0x673b('0xac')]={'user':_0x126255[_0x673b('0x5f')]['user'],'pass':_0x126255[_0x673b('0x5f')]['pass']};}return respondWithRpcPromise(_0x673b('0xae'),_0x673b('0xaf'),{'account':_0x2daf16,'message':_0x1460dc['body']});}else{throw new Error(_0x673b('0xb0'));}}})['then'](function(_0x1e7250){if(_0x1e7250){_0x3dc322=_0x1e7250;if(_0xe7c8e0['List']){if(_0xe7c8e0[_0x673b('0xa2')]['Contacts'][_0x673b('0x61')]){return _0xe7c8e0[_0x673b('0xa2')]['Contacts'][0x0];}else{return db['CmContact'][_0x673b('0x6a')](_['defaults'](_0x1460dc[_0x673b('0x65')],{'firstName':_0x1460dc[_0x673b('0x65')]['to'],'email':_0x1460dc[_0x673b('0x65')]['to'],'phone':_0x1460dc[_0x673b('0x65')]['to'],'ListId':_0xe7c8e0[_0x673b('0x72')]}));}}else{throw new Error(_0x673b('0xb0'));}}})[_0x673b('0x25')](function(_0x4ae63b){if(_0x4ae63b){var _0x4b5d82={'UserId':_0x1460dc[_0x673b('0x78')]['id'],'ContactId':_0x4ae63b['id'],'MailAccountId':_0xe7c8e0['id'],'inReplyTo':_0x3dc322['messageId'],'to':_0x1460dc[_0x673b('0x65')][_0x673b('0xa5')],'cc':_0x1460dc['body']['cc'],'subject':_0x1460dc[_0x673b('0x65')]['subject'],'attach':_0x1460dc[_0x673b('0x65')][_0x673b('0xb1')],'firstMsgDirection':_0x673b('0xb2'),'lastMsgAt':moment()[_0x673b('0x9d')](_0x673b('0x9e')),'lastMsgDirection':_0x673b('0xb2'),'Messages':[_['merge'](_0x1460dc[_0x673b('0x65')],{'messageId':_0x3dc322[_0x673b('0xb3')],'sentAt':moment()[_0x673b('0x9d')](_0x673b('0x9e')),'read':!![],'MailAccountId':_0xe7c8e0['id'],'UserId':_0x1460dc[_0x673b('0x78')]['id'],'ContactId':_0x4ae63b['id']})]};if(_0x1460dc[_0x673b('0x65')][_0x673b('0xb4')]){_0x4b5d82=_['merge'](_0x4b5d82,_0x1460dc[_0x673b('0x65')][_0x673b('0xb4')]);}return db['MailInteraction']['create'](_0x4b5d82,{'include':[{'model':db[_0x673b('0x9b')],'as':_0x673b('0xb5')}]});}})['then'](respondWithResult(_0x4462cf,null))[_0x673b('0x2f')](handleError(_0x4462cf,null));};exports[_0x673b('0xb6')]=function(_0x570889,_0xea68b1,_0x48deb7){return db[_0x673b('0x46')][_0x673b('0x63')]({'where':{'id':_0x570889[_0x673b('0x5e')]['id']},'include':[{'model':db[_0x673b('0x42')],'as':_0x673b('0x5f'),'raw':!![]}]})[_0x673b('0x25')](handleEntityNotFound(_0xea68b1,null))['then'](function(_0x108a11){if(_0x108a11&&_0x108a11[_0x673b('0x5f')]){var _0x45992e={'id':_0x108a11['id'],'tls':{'rejectUnauthorized':![]}};if(_0x108a11[_0x673b('0x5f')][_0x673b('0xab')]){_0x45992e[_0x673b('0xab')]=_0x108a11['Smtp']['service'];}else{_0x45992e[_0x673b('0x7d')]=_0x108a11[_0x673b('0x5f')]['host'];_0x45992e['port']=_0x108a11[_0x673b('0x5f')][_0x673b('0x7e')];_0x45992e[_0x673b('0xad')]=_0x108a11['Smtp'][_0x673b('0xad')];}if(_0x108a11[_0x673b('0x5f')][_0x673b('0x7c')]){_0x45992e['auth']={'user':_0x108a11['Smtp'][_0x673b('0x78')],'pass':_0x108a11[_0x673b('0x5f')]['pass']};}return respondWithRpcPromise(_0x673b('0xb7'),'verifySmtp',{'account':_0x45992e});}})[_0x673b('0x25')](respondWithResult(_0xea68b1,null))['catch'](handleError(_0xea68b1,null));};exports[_0x673b('0x3c')]=function(_0x193ece,_0x545f21){return db[_0x673b('0x46')][_0x673b('0x63')]({'where':{'id':_0x193ece['params']['id']}})['then'](handleEntityNotFound(_0x545f21,null))[_0x673b('0x25')](function(_0x52b41a){if(_0x52b41a&&_0x52b41a['service']){throw new db['Sequelize'][(_0x673b('0xb8'))](_0x673b('0xb9'));}return _0x52b41a;})[_0x673b('0x25')](removeEntity(_0x545f21,null))[_0x673b('0x2f')](handleError(_0x545f21,null));};exports[_0x673b('0xba')]=function(_0x23279e,_0x1672d5,_0x1894ac){return db[_0x673b('0x46')]['find']({'where':{'id':_0x23279e[_0x673b('0x5e')]['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x1672d5,null))[_0x673b('0x25')](function(_0x326221){if(_0x326221){return _0x326221[_0x673b('0xba')](_0x23279e[_0x673b('0x65')]['ids'],_[_0x673b('0x8e')](_0x23279e[_0x673b('0x65')],[_0x673b('0x6c'),'id'])||{})[_0x673b('0xbb')](function(_0x3b1fc1){for(var _0x2bf0d3=0x0;_0x2bf0d3<_0x23279e[_0x673b('0x65')]['ids'][_0x673b('0x61')];_0x2bf0d3+=0x1){socket[_0x673b('0xbc')](_0x673b('0xbd'),{'UserId':Number(_0x23279e[_0x673b('0x65')][_0x673b('0x6c')][_0x2bf0d3]),'MailAccountId':Number(_0x23279e['params']['id'])});}return _0x3b1fc1;});}})[_0x673b('0x25')](respondWithResult(_0x1672d5,null))[_0x673b('0x2f')](handleError(_0x1672d5,null));};exports[_0x673b('0xbe')]=function(_0x7e3da1,_0x4019bf,_0x442563){return db[_0x673b('0x46')]['find']({'where':{'id':_0x7e3da1['params']['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x4019bf,null))['then'](function(_0x297db5){if(_0x297db5){return _0x297db5['removeAgents'](_0x7e3da1[_0x673b('0x4c')]['ids'])['then'](function(){if(_[_0x673b('0xbf')](_0x7e3da1[_0x673b('0x4c')][_0x673b('0x6c')])){for(var _0x37e323=0x0;_0x37e323<_0x7e3da1[_0x673b('0x4c')][_0x673b('0x6c')][_0x673b('0x61')];_0x37e323+=0x1){socket[_0x673b('0xbc')](_0x673b('0xc0'),{'UserId':Number(_0x7e3da1[_0x673b('0x4c')][_0x673b('0x6c')][_0x37e323]),'MailAccountId':Number(_0x7e3da1['params']['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x7e3da1[_0x673b('0x4c')]['ids']),'MailAccountId':Number(_0x7e3da1['params']['id'])});}});}})[_0x673b('0x25')](respondWithStatusCode(_0x4019bf,null))[_0x673b('0x2f')](handleError(_0x4019bf,null));};exports['getAgents']=function(_0x10caa9,_0x113838,_0x14ccb1){var _0x92f0eb={};var _0x195d89={};var _0x5dd414;var _0x980062;return db[_0x673b('0x46')]['findOne']({'where':{'id':_0x10caa9['params']['id']}})[_0x673b('0x25')](handleEntityNotFound(_0x113838,null))[_0x673b('0x25')](function(_0xb919b9){if(_0xb919b9){_0x5dd414=_0xb919b9;_0x195d89[_0x673b('0x4b')]=_[_0x673b('0x60')](db[_0x673b('0xc1')][_0x673b('0x47')]);_0x195d89[_0x673b('0x4c')]=_[_0x673b('0x60')](_0x10caa9[_0x673b('0x4c')]);_0x195d89['filters']=_[_0x673b('0x4e')](_0x195d89[_0x673b('0x4b')],_0x195d89['query']);_0x92f0eb[_0x673b('0x50')]=_['intersection'](_0x195d89['model'],qs[_0x673b('0x4f')](_0x10caa9[_0x673b('0x4c')][_0x673b('0x4f')]));_0x92f0eb[_0x673b('0x50')]=_0x92f0eb[_0x673b('0x50')][_0x673b('0x61')]?_0x92f0eb[_0x673b('0x50')]:_0x195d89[_0x673b('0x4b')];_0x92f0eb['order']=qs[_0x673b('0x54')](_0x10caa9['query'][_0x673b('0x54')]);_0x92f0eb[_0x673b('0x55')]=qs[_0x673b('0x4d')](_[_0x673b('0x56')](_0x10caa9[_0x673b('0x4c')],_0x195d89[_0x673b('0x4d')]));if(_0x10caa9[_0x673b('0x4c')][_0x673b('0x57')]){_0x92f0eb['where']=_['merge'](_0x92f0eb[_0x673b('0x55')],{'$or':_[_0x673b('0x45')](_0x92f0eb[_0x673b('0x50')],function(_0xa7a2a1){var _0x3dc5d4={};_0x3dc5d4[_0xa7a2a1]={'$like':'%'+_0x10caa9['query'][_0x673b('0x57')]+'%'};return _0x3dc5d4;})});}_0x92f0eb=_[_0x673b('0x58')]({},_0x92f0eb,_0x10caa9[_0x673b('0x62')]);return _0x5dd414['getAgents'](_0x92f0eb);}})[_0x673b('0x25')](function(_0x2fcf83){if(_0x2fcf83){_0x980062=_0x2fcf83[_0x673b('0x61')];if(!_0x10caa9[_0x673b('0x4c')][_0x673b('0x51')]('nolimit')){_0x92f0eb[_0x673b('0x34')]=qs[_0x673b('0x34')](_0x10caa9['query'][_0x673b('0x34')]);_0x92f0eb[_0x673b('0x33')]=qs['offset'](_0x10caa9[_0x673b('0x4c')]['offset']);}return _0x5dd414[_0x673b('0xc2')](_0x92f0eb);}})['then'](function(_0x5ea4a4){if(_0x5ea4a4){return _0x5ea4a4?{'count':_0x980062,'rows':_0x5ea4a4}:null;}})[_0x673b('0x25')](respondWithResult(_0x113838,null))[_0x673b('0x2f')](handleError(_0x113838,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 1df34f7..00959da 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 _0x0427=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3c47df,_0x15535c){var _0x50c128=function(_0x615d2e){while(--_0x615d2e){_0x3c47df['push'](_0x3c47df['shift']());}};_0x50c128(++_0x15535c);}(_0x0427,0x6c));var _0x7042=function(_0x214385,_0x16211a){_0x214385=_0x214385-0x0;var _0x3d5445=_0x0427[_0x214385];return _0x3d5445;};'use strict';var EventEmitter=require(_0x7042('0x0'));var MailAccount=require(_0x7042('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7042('0x2')](0x0);var events={'afterCreate':_0x7042('0x3'),'afterUpdate':_0x7042('0x4'),'afterDestroy':_0x7042('0x5')};function emitEvent(_0x5f9c9b){return function(_0x5e33c5,_0x1ab30e,_0x1c9b6f){MailAccountEvents[_0x7042('0x6')](_0x5f9c9b+':'+_0x5e33c5['id'],_0x5e33c5);MailAccountEvents[_0x7042('0x6')](_0x5f9c9b,_0x5e33c5);_0x1c9b6f(null);};}for(var e in events){if(events[_0x7042('0x7')](e)){var event=events[e];MailAccount[_0x7042('0x8')](e,emitEvent(event));}}module[_0x7042('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x3595=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x1b0cad,_0x46078b){var _0x2105a4=function(_0x2399f4){while(--_0x2399f4){_0x1b0cad['push'](_0x1b0cad['shift']());}};_0x2105a4(++_0x46078b);}(_0x3595,0x147));var _0x5359=function(_0x475e31,_0x5c2e15){_0x475e31=_0x475e31-0x0;var _0x498f1b=_0x3595[_0x475e31];return _0x498f1b;};'use strict';var EventEmitter=require(_0x5359('0x0'));var MailAccount=require(_0x5359('0x1'))['db'][_0x5359('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5359('0x3'),'afterUpdate':_0x5359('0x4'),'afterDestroy':_0x5359('0x5')};function emitEvent(_0x3fd018){return function(_0x1fa814,_0x125c76,_0x4e42e0){MailAccountEvents['emit'](_0x3fd018+':'+_0x1fa814['id'],_0x1fa814);MailAccountEvents[_0x5359('0x6')](_0x3fd018,_0x1fa814);_0x4e42e0(null);};}for(var e in events){if(events[_0x5359('0x7')](e)){var event=events[e];MailAccount[_0x5359('0x8')](e,emitEvent(event));}}module[_0x5359('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index a856c37..6b008af 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 _0xf603=['mail_accounts','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailAccount.attributes','define','MailAccount'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0xf603,0x90));var _0x3f60=function(_0x3270f8,_0x3fc664){_0x3270f8=_0x3270f8-0x0;var _0x4b484a=_0xf603[_0x3270f8];return _0x4b484a;};'use strict';var _=require(_0x3f60('0x0'));var util=require('util');var logger=require(_0x3f60('0x1'))(_0x3f60('0x2'));var moment=require('moment');var BPromise=require(_0x3f60('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f60('0x4'));var rimraf=require(_0x3f60('0x5'));var config=require(_0x3f60('0x6'));var attributes=require(_0x3f60('0x7'));module['exports']=function(_0x1f1b48,_0x2c52d1){return _0x1f1b48[_0x3f60('0x8')](_0x3f60('0x9'),attributes,{'tableName':_0x3f60('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb8d=['path','rimraf','../../config/environment','./mailAccount.attributes','exports','MailAccount','mail_accounts','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x181f22,_0x2a983d){var _0x5ea458=function(_0x4bf579){while(--_0x4bf579){_0x181f22['push'](_0x181f22['shift']());}};_0x5ea458(++_0x2a983d);}(_0xeb8d,0x7f));var _0xdeb8=function(_0x56033d,_0x210f70){_0x56033d=_0x56033d-0x0;var _0x36c8fd=_0xeb8d[_0x56033d];return _0x36c8fd;};'use strict';var _=require('lodash');var util=require(_0xdeb8('0x0'));var logger=require(_0xdeb8('0x1'))('api');var moment=require(_0xdeb8('0x2'));var BPromise=require(_0xdeb8('0x3'));var rp=require(_0xdeb8('0x4'));var fs=require('fs');var path=require(_0xdeb8('0x5'));var rimraf=require(_0xdeb8('0x6'));var config=require(_0xdeb8('0x7'));var attributes=require(_0xdeb8('0x8'));module[_0xdeb8('0x9')]=function(_0xbb6d46,_0x5b0fc1){return _0xbb6d46['define'](_0xdeb8('0xa'),attributes,{'tableName':_0xdeb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 30cd6a0..528ee3e 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 _0x9673=['CompanyId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','Contacts','updatedAt','DESC','Applications','MailServerOut','Smtp','List','get','omit','list','orderBy','applications','push','length','close','autoclose','*,*,*,*','defaults','ListId','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','Contact\x20not\x20found','update','created','MailMessage','subject','attachments','originTo','ChatWebsiteId','ChatOfflineMessageId','Attachment','UserId','User','name','interaction','unshift','agent','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','findAll','options','raw','where','attributes','map','include','model','GetMailAccount','ShowMailAccount','MailAccount','find','catch','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt'];(function(_0x10625e,_0x2888cd){var _0x173208=function(_0x2cf092){while(--_0x2cf092){_0x10625e['push'](_0x10625e['shift']());}};_0x173208(++_0x2888cd);}(_0x9673,0x1d8));var _0x3967=function(_0x3e49ef,_0x3739cd){_0x3e49ef=_0x3e49ef-0x0;var _0x31d6f9=_0x9673[_0x3e49ef];return _0x31d6f9;};'use strict';var _=require(_0x3967('0x0'));var util=require(_0x3967('0x1'));var moment=require(_0x3967('0x2'));var BPromise=require(_0x3967('0x3'));var rs=require(_0x3967('0x4'));var fs=require('fs');var Redis=require(_0x3967('0x5'));var db=require(_0x3967('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3967('0x7'))(_0x3967('0x8'));var config=require(_0x3967('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3967('0xa')][_0x3967('0xb')]({'port':0x232c});config[_0x3967('0xc')]=_['defaults'](config[_0x3967('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3967('0xd'))(new Redis(config[_0x3967('0xc')]));require(_0x3967('0xe'))[_0x3967('0xf')](socket);function respondWithRpcPromise(_0x166f9b,_0x43c482,_0x2fae7e){return new BPromise(function(_0x362abd,_0x1c872e){return client[_0x3967('0x10')](_0x166f9b,_0x2fae7e)[_0x3967('0x11')](function(_0x5dbb9c){logger['info'](_0x3967('0x12'),_0x43c482,_0x3967('0x13'));logger[_0x3967('0x14')](_0x3967('0x15'),_0x43c482,_0x3967('0x13'),JSON[_0x3967('0x16')](_0x5dbb9c));if(_0x5dbb9c[_0x3967('0x17')]){if(_0x5dbb9c[_0x3967('0x17')][_0x3967('0x18')]===0x1f4){logger[_0x3967('0x17')]('MailAccount,\x20%s,\x20%s',_0x43c482,_0x5dbb9c[_0x3967('0x17')][_0x3967('0x19')]);return _0x1c872e(_0x5dbb9c[_0x3967('0x17')][_0x3967('0x19')]);}logger[_0x3967('0x17')](_0x3967('0x12'),_0x43c482,_0x5dbb9c[_0x3967('0x17')][_0x3967('0x19')]);return _0x362abd(_0x5dbb9c[_0x3967('0x17')][_0x3967('0x19')]);}else{logger[_0x3967('0x1a')](_0x3967('0x12'),_0x43c482,_0x3967('0x13'));_0x362abd(_0x5dbb9c['result'][_0x3967('0x19')]);}})['catch'](function(_0x36f1c1){logger[_0x3967('0x17')](_0x3967('0x12'),_0x43c482,_0x36f1c1);_0x1c872e(_0x36f1c1);});});}exports['GetMailAccount']=function(_0xdd7ac){var _0x6d0bff=this;return new Promise(function(_0x8ffa74,_0x3de58d){return db['MailAccount'][_0x3967('0x1b')]({'raw':_0xdd7ac[_0x3967('0x1c')]?_0xdd7ac[_0x3967('0x1c')][_0x3967('0x1d')]===undefined?!![]:![]:!![],'where':_0xdd7ac[_0x3967('0x1c')]?_0xdd7ac[_0x3967('0x1c')][_0x3967('0x1e')]||null:null,'attributes':_0xdd7ac[_0x3967('0x1c')]?_0xdd7ac[_0x3967('0x1c')][_0x3967('0x1f')]||null:null,'limit':_0xdd7ac[_0x3967('0x1c')]?_0xdd7ac[_0x3967('0x1c')]['limit']||null:null,'include':_0xdd7ac[_0x3967('0x1c')]?_0xdd7ac['options']['include']?_[_0x3967('0x20')](_0xdd7ac[_0x3967('0x1c')][_0x3967('0x21')],function(_0x47789e){return{'model':db[_0x47789e[_0x3967('0x22')]],'as':_0x47789e['as'],'attributes':_0x47789e[_0x3967('0x1f')],'include':_0x47789e[_0x3967('0x21')]?_[_0x3967('0x20')](_0x47789e[_0x3967('0x21')],function(_0x276ab1){return{'model':db[_0x276ab1['model']],'as':_0x276ab1['as'],'attributes':_0x276ab1[_0x3967('0x1f')],'include':_0x276ab1[_0x3967('0x21')]?_[_0x3967('0x20')](_0x276ab1['include'],function(_0x51ccf4){return{'model':db[_0x51ccf4['model']],'as':_0x51ccf4['as'],'attributes':_0x51ccf4['attributes']};}):[]};}):[]};}):[]:[]})[_0x3967('0x11')](function(_0x34b995){logger[_0x3967('0x1a')]('GetMailAccount',_0xdd7ac);logger['debug'](_0x3967('0x23'),_0xdd7ac,JSON['stringify'](_0x34b995));_0x8ffa74(_0x34b995);})['catch'](function(_0x2728c6){logger['error']('GetMailAccount',_0x2728c6[_0x3967('0x19')],_0xdd7ac);_0x3de58d(_0x6d0bff[_0x3967('0x17')](0x1f4,_0x2728c6[_0x3967('0x19')]));});});};exports[_0x3967('0x24')]=function(_0xd2e94b){var _0x830093=this;return new Promise(function(_0x44acd8,_0x2dee04){return db[_0x3967('0x25')][_0x3967('0x26')]({'raw':_0xd2e94b[_0x3967('0x1c')]?_0xd2e94b[_0x3967('0x1c')][_0x3967('0x1d')]===undefined?!![]:![]:!![],'where':_0xd2e94b[_0x3967('0x1c')]?_0xd2e94b[_0x3967('0x1c')][_0x3967('0x1e')]||null:null,'attributes':_0xd2e94b[_0x3967('0x1c')]?_0xd2e94b['options'][_0x3967('0x1f')]||null:null,'include':_0xd2e94b['options']?_0xd2e94b[_0x3967('0x1c')]['include']?_['map'](_0xd2e94b[_0x3967('0x1c')][_0x3967('0x21')],function(_0x2d5020){return{'model':db[_0x2d5020[_0x3967('0x22')]],'as':_0x2d5020['as'],'attributes':_0x2d5020[_0x3967('0x1f')],'include':_0x2d5020['include']?_[_0x3967('0x20')](_0x2d5020['include'],function(_0x29f63a){return{'model':db[_0x29f63a['model']],'as':_0x29f63a['as'],'attributes':_0x29f63a[_0x3967('0x1f')],'include':_0x29f63a[_0x3967('0x21')]?_[_0x3967('0x20')](_0x29f63a[_0x3967('0x21')],function(_0x44a0c2){return{'model':db[_0x44a0c2['model']],'as':_0x44a0c2['as'],'attributes':_0x44a0c2[_0x3967('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3967('0x11')](function(_0x310a37){logger['info'](_0x3967('0x24'),_0xd2e94b);logger['debug'](_0x3967('0x24'),_0xd2e94b,JSON[_0x3967('0x16')](_0x310a37));_0x44acd8(_0x310a37);})[_0x3967('0x27')](function(_0x35a2b6){logger[_0x3967('0x17')](_0x3967('0x24'),_0x35a2b6[_0x3967('0x19')],_0xd2e94b);_0x2dee04(_0x830093[_0x3967('0x17')](0x1f4,_0x35a2b6[_0x3967('0x19')]));});});};exports[_0x3967('0x28')]=function(_0x8e6701){var _0x12a434=this;return new Promise(function(_0xcbf0ae,_0x327142){var _0x1902f2={'body':_0x8e6701[_0x3967('0x29')],'channel':_0x3967('0x2a')};var _0x315c1e=_[_0x3967('0x2b')](_[_0x3967('0x2c')](db[_0x3967('0x2d')][_0x3967('0x2e')]),[_0x3967('0x2f'),'updatedAt',_0x3967('0x30'),'ListId']);var _0x1ca365=![];if(_0x8e6701['body']['id']){delete _0x8e6701[_0x3967('0x29')]['id'];}if(_[_0x3967('0x31')](_0x8e6701[_0x3967('0x29')][_0x3967('0x32')])){return _0x327142(_0x12a434['error'](0x1f4,_0x3967('0x33')));}if(_[_0x3967('0x31')](_0x8e6701[_0x3967('0x29')][_0x3967('0x29')])||_0x8e6701['body'][_0x3967('0x29')]===''){return _0x327142(_0x12a434[_0x3967('0x17')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x3967('0x31')](_0x8e6701[_0x3967('0x29')][_0x3967('0x34')])){return _0x327142(_0x12a434[_0x3967('0x17')](0x1f4,_0x3967('0x35')+_0x315c1e));}if(!_[_0x3967('0x36')](_0x315c1e,_0x8e6701[_0x3967('0x29')][_0x3967('0x34')])){return _0x327142(_0x12a434['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x315c1e));}var _0x5edfec={};_0x5edfec[_0x8e6701['body']['mapKey']]=_0x8e6701[_0x3967('0x29')][_0x3967('0x32')];return db[_0x3967('0x25')][_0x3967('0x26')]({'where':{'id':_0x8e6701[_0x3967('0x37')]['id']},'include':[{'model':db[_0x3967('0x38')],'as':'List','include':[{'model':db[_0x3967('0x2d')],'as':_0x3967('0x39'),'where':_0x5edfec,'limit':0x1,'order':[[_0x3967('0x3a'),_0x3967('0x3b')]]}]},{'model':db['MailApplication'],'as':_0x3967('0x3c')},{'model':db[_0x3967('0x3d')],'as':_0x3967('0x3e')}]})[_0x3967('0x11')](function(_0x1960b0){if(_0x1960b0&&_0x1960b0[_0x3967('0x3f')]){var _0x3f6d4f=_0x1960b0[_0x3967('0x40')]({'plain':!![]});_0x1902f2[_0x3967('0x37')]=_[_0x3967('0x41')](_0x3f6d4f,[_0x3967('0x3c'),_0x3967('0x3f')]);_0x1902f2['applications']=_0x3f6d4f[_0x3967('0x3c')];_0x1902f2[_0x3967('0x42')]=_0x3f6d4f[_0x3967('0x3f')];_0x1902f2['applications']=_[_0x3967('0x43')](_0x1902f2[_0x3967('0x44')],['priority'],['asc']);if(_0x1902f2['account']&&_0x1902f2[_0x3967('0x37')]['autoclose']){_0x1902f2[_0x3967('0x44')][_0x3967('0x45')]({'id':0x0,'priority':_0x1902f2['applications'][_0x3967('0x46')]+0x1,'app':_0x3967('0x47'),'appdata':_0x3967('0x48'),'interval':_0x3967('0x49')});}if(_0x1902f2[_0x3967('0x37')]['Applications']){delete _0x1902f2['account'][_0x3967('0x3c')];}if(_0x1902f2[_0x3967('0x37')]['List']){delete _0x1902f2['account'][_0x3967('0x3f')];}if(_0x3f6d4f['List'][_0x3967('0x39')][_0x3967('0x46')]){return _0x3f6d4f[_0x3967('0x3f')][_0x3967('0x39')][0x0];}var _0x252433=_[_0x3967('0x4a')](_0x8e6701[_0x3967('0x29')],{'firstName':_0x8e6701[_0x3967('0x29')][_0x3967('0x32')],'ListId':_0x3f6d4f[_0x3967('0x4b')]});_0x252433[_0x8e6701[_0x3967('0x29')][_0x3967('0x34')]]=_0x8e6701[_0x3967('0x29')][_0x3967('0x32')];return db['CmContact'][_0x3967('0x4c')](_0x252433);}else{throw new Error(_0x3967('0x4d'));}})['then'](function(_0x40eadd){_0x1902f2[_0x3967('0x4e')]=_0x40eadd;if(_0x40eadd){if(!_0x8e6701[_0x3967('0x29')][_0x3967('0x19')][_0x3967('0x4f')]){_0x8e6701['body']['message'][_0x3967('0x4f')]=rs[_0x3967('0x50')]()+'\x20'+_0x8e6701[_0x3967('0x29')][_0x3967('0x19')][_0x3967('0x32')];}var _0x3a300a={'ContactId':_0x40eadd['id'],'MailAccountId':_0x8e6701[_0x3967('0x37')]['id'],'inReplyTo':_0x8e6701[_0x3967('0x29')]['message']['messageId'],'to':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')][_0x3967('0x32')],'cc':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')]['cc'],'subject':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')]['subject'],'attach':_0x8e6701['body'][_0x3967('0x19')][_0x3967('0x51')],'lastMsgAt':moment()[_0x3967('0x52')](_0x3967('0x53')),'lastMsgDirection':'in'};return db[_0x3967('0x54')][_0x3967('0x26')]({'where':{'closed':![],'MailAccountId':_0x8e6701[_0x3967('0x37')]['id']},'include':[{'model':db['MailMessage'],'as':_0x3967('0x55'),'attributes':[_0x3967('0x4f')],'where':{'messageId':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')]['inReplyTo']}}]})[_0x3967('0x11')](function(_0x1b8023){if(_0x1b8023){return[_0x1b8023,![]];}return db[_0x3967('0x54')][_0x3967('0x4c')](_0x3a300a)[_0x3967('0x11')](function(_0x1d1fba){return[_0x1d1fba,!![]];});});}else{throw new Error(_0x3967('0x56'));}})['spread'](function(_0x2217db,_0x533e5a){if(_0x2217db){_0x1ca365=_0x533e5a;if(!_0x533e5a){return _0x2217db[_0x3967('0x57')]({'inReplyTo':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')]['messageId'],'to':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')]['from'],'cc':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')]['cc'],'subject':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')]['subject'],'attach':_0x2217db[_0x3967('0x51')]?_0x2217db['attach']:_0x8e6701['body']['message']['attach'],'substatus':null,'substatusAt':moment()[_0x3967('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x3967('0x52')](_0x3967('0x53')),'lastMsgDirection':'in'});}else{return _0x2217db;}}})[_0x3967('0x11')](function(_0x52051c){_0x1902f2['interaction']=_0x52051c[_0x3967('0x40')]({'plain':!![]});_0x1902f2['interaction'][_0x3967('0x58')]=_0x1ca365;return db[_0x3967('0x59')][_0x3967('0x4c')]({'body':_0x8e6701['body'][_0x3967('0x29')],'MailAccountId':_0x8e6701[_0x3967('0x37')]['id'],'MailInteractionId':_0x52051c['id'],'direction':'in','ContactId':_0x1902f2['contact']['id'],'messageId':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')][_0x3967('0x4f')],'from':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')][_0x3967('0x32')],'to':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')]['to'],'cc':_0x8e6701['body']['message']['cc'],'subject':_0x8e6701['body'][_0x3967('0x19')][_0x3967('0x5a')],'attach':_0x8e6701[_0x3967('0x29')]['message'][_0x3967('0x51')],'Attachments':_0x8e6701['body'][_0x3967('0x19')][_0x3967('0x5b')],'originTo':_0x8e6701[_0x3967('0x29')]['message'][_0x3967('0x5c')],'originCc':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')]['originCc'],'bcc':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')]['bcc'],'ChatWebsiteId':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')][_0x3967('0x5d')]||null,'originChannel':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')]['originChannel']||'Email','ChatOfflineMessageId':_0x8e6701[_0x3967('0x29')][_0x3967('0x19')][_0x3967('0x5e')]||null},{'include':[{'model':db[_0x3967('0x5f')],'as':'Attachments'}]});})['then'](function(_0x10f017){_0x1902f2[_0x3967('0x19')]=_0x10f017;if(_0x1902f2['interaction'][_0x3967('0x60')]){return db[_0x3967('0x61')][_0x3967('0x26')]({'attributes':['id',_0x3967('0x62')],'where':{'id':_0x1902f2[_0x3967('0x63')][_0x3967('0x60')]}})[_0x3967('0x11')](function(_0x26f17d){if(_0x26f17d){_0x1902f2[_0x3967('0x44')][_0x3967('0x64')]({'id':0x0,'priority':0x0,'app':_0x3967('0x65'),'appdata':_0x26f17d['name']+','+(_0x1902f2[_0x3967('0x37')][_0x3967('0x66')]||0xa),'interval':_0x3967('0x49')});}return respondWithRpcPromise(_0x3967('0x67'),'startRouting',_0x1902f2);});}return respondWithRpcPromise('Start','startRouting',_0x1902f2);})[_0x3967('0x11')](function(_0x1d377e){_0xcbf0ae(_0x1d377e);})[_0x3967('0x27')](function(_0x39ade6){_0x327142(_0x12a434[_0x3967('0x17')](0x1f4,_0x39ade6['message']));});});}; \ No newline at end of file +var _0x1bd5=['DESC','Applications','Smtp','List','get','omit','applications','orderBy','priority','asc','autoclose','push','close','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','interaction','created','attachments','originTo','bcc','originChannel','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','Start','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','model','map','debug','stringify','ShowMailAccount','find','NotifyMailAccount','body','difference','CmContact','rawAttributes','createdAt','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','Contacts','updatedAt'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x1bd5,0x151));var _0x51bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1bd5[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x51bd('0x0'));var util=require(_0x51bd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x51bd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51bd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x51bd('0x4'))(_0x51bd('0x5'));var config=require('../../config/environment');var jayson=require(_0x51bd('0x6'));var client=jayson[_0x51bd('0x7')][_0x51bd('0x8')]({'port':0x232c});config[_0x51bd('0x9')]=_[_0x51bd('0xa')](config[_0x51bd('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51bd('0xb'))(new Redis(config[_0x51bd('0x9')]));require(_0x51bd('0xc'))['register'](socket);function respondWithRpcPromise(_0x303195,_0x1da64e,_0x468f33){return new BPromise(function(_0xd43a71,_0xf80074){return client[_0x51bd('0xd')](_0x303195,_0x468f33)[_0x51bd('0xe')](function(_0x23bb20){logger[_0x51bd('0xf')](_0x51bd('0x10'),_0x1da64e,_0x51bd('0x11'));logger['debug'](_0x51bd('0x12'),_0x1da64e,_0x51bd('0x11'),JSON['stringify'](_0x23bb20));if(_0x23bb20[_0x51bd('0x13')]){if(_0x23bb20[_0x51bd('0x13')][_0x51bd('0x14')]===0x1f4){logger[_0x51bd('0x13')](_0x51bd('0x10'),_0x1da64e,_0x23bb20[_0x51bd('0x13')][_0x51bd('0x15')]);return _0xf80074(_0x23bb20[_0x51bd('0x13')][_0x51bd('0x15')]);}logger['error'](_0x51bd('0x10'),_0x1da64e,_0x23bb20[_0x51bd('0x13')][_0x51bd('0x15')]);return _0xd43a71(_0x23bb20[_0x51bd('0x13')][_0x51bd('0x15')]);}else{logger[_0x51bd('0xf')]('MailAccount,\x20%s,\x20%s',_0x1da64e,'request\x20sent');_0xd43a71(_0x23bb20[_0x51bd('0x16')][_0x51bd('0x15')]);}})[_0x51bd('0x17')](function(_0x3ad889){logger[_0x51bd('0x13')]('MailAccount,\x20%s,\x20%s',_0x1da64e,_0x3ad889);_0xf80074(_0x3ad889);});});}exports[_0x51bd('0x18')]=function(_0x1ffb91){var _0xdd9355=this;return new Promise(function(_0x4c5ba7,_0x5c290d){return db[_0x51bd('0x19')]['findAll']({'raw':_0x1ffb91[_0x51bd('0x1a')]?_0x1ffb91[_0x51bd('0x1a')][_0x51bd('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ffb91[_0x51bd('0x1a')]?_0x1ffb91[_0x51bd('0x1a')][_0x51bd('0x1c')]||null:null,'attributes':_0x1ffb91[_0x51bd('0x1a')]?_0x1ffb91[_0x51bd('0x1a')][_0x51bd('0x1d')]||null:null,'limit':_0x1ffb91[_0x51bd('0x1a')]?_0x1ffb91[_0x51bd('0x1a')][_0x51bd('0x1e')]||null:null,'include':_0x1ffb91[_0x51bd('0x1a')]?_0x1ffb91[_0x51bd('0x1a')][_0x51bd('0x1f')]?_['map'](_0x1ffb91['options']['include'],function(_0x14ff5e){return{'model':db[_0x14ff5e[_0x51bd('0x20')]],'as':_0x14ff5e['as'],'attributes':_0x14ff5e[_0x51bd('0x1d')],'include':_0x14ff5e[_0x51bd('0x1f')]?_[_0x51bd('0x21')](_0x14ff5e[_0x51bd('0x1f')],function(_0x596bdd){return{'model':db[_0x596bdd[_0x51bd('0x20')]],'as':_0x596bdd['as'],'attributes':_0x596bdd['attributes'],'include':_0x596bdd[_0x51bd('0x1f')]?_[_0x51bd('0x21')](_0x596bdd['include'],function(_0xbf58ef){return{'model':db[_0xbf58ef['model']],'as':_0xbf58ef['as'],'attributes':_0xbf58ef[_0x51bd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x51bd('0xe')](function(_0x31fa78){logger[_0x51bd('0xf')](_0x51bd('0x18'),_0x1ffb91);logger[_0x51bd('0x22')](_0x51bd('0x18'),_0x1ffb91,JSON[_0x51bd('0x23')](_0x31fa78));_0x4c5ba7(_0x31fa78);})[_0x51bd('0x17')](function(_0x3f5c17){logger[_0x51bd('0x13')](_0x51bd('0x18'),_0x3f5c17[_0x51bd('0x15')],_0x1ffb91);_0x5c290d(_0xdd9355[_0x51bd('0x13')](0x1f4,_0x3f5c17['message']));});});};exports[_0x51bd('0x24')]=function(_0x552a22){var _0x1cb212=this;return new Promise(function(_0x19d6b0,_0x382f5c){return db['MailAccount'][_0x51bd('0x25')]({'raw':_0x552a22['options']?_0x552a22[_0x51bd('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x552a22[_0x51bd('0x1a')]?_0x552a22[_0x51bd('0x1a')][_0x51bd('0x1c')]||null:null,'attributes':_0x552a22[_0x51bd('0x1a')]?_0x552a22[_0x51bd('0x1a')][_0x51bd('0x1d')]||null:null,'include':_0x552a22[_0x51bd('0x1a')]?_0x552a22[_0x51bd('0x1a')][_0x51bd('0x1f')]?_[_0x51bd('0x21')](_0x552a22[_0x51bd('0x1a')][_0x51bd('0x1f')],function(_0x450f3d){return{'model':db[_0x450f3d['model']],'as':_0x450f3d['as'],'attributes':_0x450f3d['attributes'],'include':_0x450f3d['include']?_[_0x51bd('0x21')](_0x450f3d['include'],function(_0x48fc82){return{'model':db[_0x48fc82['model']],'as':_0x48fc82['as'],'attributes':_0x48fc82[_0x51bd('0x1d')],'include':_0x48fc82[_0x51bd('0x1f')]?_['map'](_0x48fc82[_0x51bd('0x1f')],function(_0x4d9c59){return{'model':db[_0x4d9c59['model']],'as':_0x4d9c59['as'],'attributes':_0x4d9c59[_0x51bd('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x371587){logger[_0x51bd('0xf')]('ShowMailAccount',_0x552a22);logger[_0x51bd('0x22')](_0x51bd('0x24'),_0x552a22,JSON['stringify'](_0x371587));_0x19d6b0(_0x371587);})[_0x51bd('0x17')](function(_0x32a66c){logger[_0x51bd('0x13')]('ShowMailAccount',_0x32a66c[_0x51bd('0x15')],_0x552a22);_0x382f5c(_0x1cb212['error'](0x1f4,_0x32a66c[_0x51bd('0x15')]));});});};exports[_0x51bd('0x26')]=function(_0x5b494c){var _0x391494=this;return new Promise(function(_0x555385,_0x3327f2){var _0x379d4c={'body':_0x5b494c[_0x51bd('0x27')],'channel':'mail'};var _0x458b96=_[_0x51bd('0x28')](_['keys'](db[_0x51bd('0x29')][_0x51bd('0x2a')]),[_0x51bd('0x2b'),'updatedAt','CompanyId',_0x51bd('0x2c')]);var _0x5b586c=![];if(_0x5b494c[_0x51bd('0x27')]['id']){delete _0x5b494c[_0x51bd('0x27')]['id'];}if(_[_0x51bd('0x2d')](_0x5b494c['body']['from'])){return _0x3327f2(_0x391494[_0x51bd('0x13')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x51bd('0x2d')](_0x5b494c['body']['body'])||_0x5b494c[_0x51bd('0x27')]['body']===''){return _0x3327f2(_0x391494['error'](0x1f4,_0x51bd('0x2e')));}if(_[_0x51bd('0x2d')](_0x5b494c[_0x51bd('0x27')]['mapKey'])){return _0x3327f2(_0x391494[_0x51bd('0x13')](0x1f4,_0x51bd('0x2f')+_0x458b96));}if(!_['includes'](_0x458b96,_0x5b494c[_0x51bd('0x27')][_0x51bd('0x30')])){return _0x3327f2(_0x391494[_0x51bd('0x13')](0x1f4,_0x51bd('0x31')+_0x458b96));}var _0x48eee8={};_0x48eee8[_0x5b494c[_0x51bd('0x27')][_0x51bd('0x30')]]=_0x5b494c[_0x51bd('0x27')][_0x51bd('0x32')];return db['MailAccount'][_0x51bd('0x25')]({'where':{'id':_0x5b494c[_0x51bd('0x33')]['id']},'include':[{'model':db[_0x51bd('0x34')],'as':'List','include':[{'model':db['CmContact'],'as':_0x51bd('0x35'),'where':_0x48eee8,'limit':0x1,'order':[[_0x51bd('0x36'),_0x51bd('0x37')]]}]},{'model':db['MailApplication'],'as':_0x51bd('0x38')},{'model':db['MailServerOut'],'as':_0x51bd('0x39')}]})[_0x51bd('0xe')](function(_0x507db6){if(_0x507db6&&_0x507db6[_0x51bd('0x3a')]){var _0x13a85e=_0x507db6[_0x51bd('0x3b')]({'plain':!![]});_0x379d4c['account']=_[_0x51bd('0x3c')](_0x13a85e,[_0x51bd('0x38'),_0x51bd('0x3a')]);_0x379d4c[_0x51bd('0x3d')]=_0x13a85e['Applications'];_0x379d4c['list']=_0x13a85e['List'];_0x379d4c[_0x51bd('0x3d')]=_[_0x51bd('0x3e')](_0x379d4c[_0x51bd('0x3d')],[_0x51bd('0x3f')],[_0x51bd('0x40')]);if(_0x379d4c[_0x51bd('0x33')]&&_0x379d4c['account'][_0x51bd('0x41')]){_0x379d4c[_0x51bd('0x3d')][_0x51bd('0x42')]({'id':0x0,'priority':_0x379d4c['applications']['length']+0x1,'app':_0x51bd('0x43'),'appdata':_0x51bd('0x41'),'interval':_0x51bd('0x44')});}if(_0x379d4c[_0x51bd('0x33')][_0x51bd('0x38')]){delete _0x379d4c[_0x51bd('0x33')]['Applications'];}if(_0x379d4c[_0x51bd('0x33')][_0x51bd('0x3a')]){delete _0x379d4c['account'][_0x51bd('0x3a')];}if(_0x13a85e[_0x51bd('0x3a')]['Contacts'][_0x51bd('0x45')]){return _0x13a85e[_0x51bd('0x3a')][_0x51bd('0x35')][0x0];}var _0x55ffdc=_[_0x51bd('0xa')](_0x5b494c[_0x51bd('0x27')],{'firstName':_0x5b494c[_0x51bd('0x27')]['from'],'ListId':_0x13a85e[_0x51bd('0x2c')]});_0x55ffdc[_0x5b494c[_0x51bd('0x27')][_0x51bd('0x30')]]=_0x5b494c[_0x51bd('0x27')][_0x51bd('0x32')];return db[_0x51bd('0x29')][_0x51bd('0x46')](_0x55ffdc);}else{throw new Error(_0x51bd('0x47'));}})[_0x51bd('0xe')](function(_0x498674){_0x379d4c[_0x51bd('0x48')]=_0x498674;if(_0x498674){if(!_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')][_0x51bd('0x49')]){_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')][_0x51bd('0x49')]=rs[_0x51bd('0x4a')]()+'\x20'+_0x5b494c['body'][_0x51bd('0x15')][_0x51bd('0x32')];}var _0x4d2d54={'ContactId':_0x498674['id'],'MailAccountId':_0x5b494c[_0x51bd('0x33')]['id'],'inReplyTo':_0x5b494c[_0x51bd('0x27')]['message']['messageId'],'to':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')][_0x51bd('0x32')],'cc':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')]['cc'],'subject':_0x5b494c['body']['message'][_0x51bd('0x4b')],'attach':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')][_0x51bd('0x4c')],'lastMsgAt':moment()[_0x51bd('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x51bd('0x25')]({'where':{'closed':![],'MailAccountId':_0x5b494c[_0x51bd('0x33')]['id']},'include':[{'model':db[_0x51bd('0x4e')],'as':_0x51bd('0x4f'),'attributes':[_0x51bd('0x49')],'where':{'messageId':_0x5b494c['body'][_0x51bd('0x15')][_0x51bd('0x50')]}}]})[_0x51bd('0xe')](function(_0x9fbd97){if(_0x9fbd97){return[_0x9fbd97,![]];}return db[_0x51bd('0x51')][_0x51bd('0x46')](_0x4d2d54)['then'](function(_0x1f17be){return[_0x1f17be,!![]];});});}else{throw new Error(_0x51bd('0x52'));}})[_0x51bd('0x53')](function(_0x34615b,_0x675441){if(_0x34615b){_0x5b586c=_0x675441;if(!_0x675441){return _0x34615b[_0x51bd('0x54')]({'inReplyTo':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')][_0x51bd('0x49')],'to':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')]['from'],'cc':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')]['cc'],'subject':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')]['subject'],'attach':_0x34615b[_0x51bd('0x4c')]?_0x34615b['attach']:_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')][_0x51bd('0x4c')],'substatus':null,'substatusAt':moment()[_0x51bd('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x51bd('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x34615b;}}})[_0x51bd('0xe')](function(_0x20f9cc){_0x379d4c[_0x51bd('0x55')]=_0x20f9cc[_0x51bd('0x3b')]({'plain':!![]});_0x379d4c[_0x51bd('0x55')][_0x51bd('0x56')]=_0x5b586c;return db[_0x51bd('0x4e')][_0x51bd('0x46')]({'body':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x27')],'MailAccountId':_0x5b494c[_0x51bd('0x33')]['id'],'MailInteractionId':_0x20f9cc['id'],'direction':'in','ContactId':_0x379d4c[_0x51bd('0x48')]['id'],'messageId':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')][_0x51bd('0x49')],'from':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')][_0x51bd('0x32')],'to':_0x5b494c[_0x51bd('0x27')]['message']['to'],'cc':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')]['cc'],'subject':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')]['subject'],'attach':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')][_0x51bd('0x4c')],'Attachments':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')][_0x51bd('0x57')],'originTo':_0x5b494c[_0x51bd('0x27')]['message'][_0x51bd('0x58')],'originCc':_0x5b494c['body'][_0x51bd('0x15')]['originCc'],'bcc':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')][_0x51bd('0x59')],'ChatWebsiteId':_0x5b494c[_0x51bd('0x27')][_0x51bd('0x15')]['ChatWebsiteId']||null,'originChannel':_0x5b494c['body'][_0x51bd('0x15')][_0x51bd('0x5a')]||'Email','ChatOfflineMessageId':_0x5b494c['body'][_0x51bd('0x15')][_0x51bd('0x5b')]||null},{'include':[{'model':db[_0x51bd('0x5c')],'as':'Attachments'}]});})['then'](function(_0x3ac957){_0x379d4c[_0x51bd('0x15')]=_0x3ac957;if(_0x379d4c[_0x51bd('0x55')][_0x51bd('0x5d')]){return db[_0x51bd('0x5e')][_0x51bd('0x25')]({'attributes':['id',_0x51bd('0x5f')],'where':{'id':_0x379d4c['interaction']['UserId']}})[_0x51bd('0xe')](function(_0x152eda){if(_0x152eda){_0x379d4c[_0x51bd('0x3d')][_0x51bd('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x152eda[_0x51bd('0x5f')]+','+(_0x379d4c['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x51bd('0x61'),'startRouting',_0x379d4c);});}return respondWithRpcPromise(_0x51bd('0x61'),'startRouting',_0x379d4c);})[_0x51bd('0xe')](function(_0x3a6c31){_0x555385(_0x3a6c31);})[_0x51bd('0x17')](function(_0x258c66){_0x3327f2(_0x391494[_0x51bd('0x13')](0x1f4,_0x258c66['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index bbdbcf9..452a4ea 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 _0x6c9c=['removeListener','register','length','mailAccount:','./mailAccount.events','save','update'];(function(_0x2148dd,_0x15fe87){var _0x3df732=function(_0x3827e9){while(--_0x3827e9){_0x2148dd['push'](_0x2148dd['shift']());}};_0x3df732(++_0x15fe87);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x5b412a,_0xa67f22){_0x5b412a=_0x5b412a-0x0;var _0x3330a6=_0x6c9c[_0x5b412a];return _0x3330a6;};'use strict';var MailAccountEvents=require(_0xc6c9('0x0'));var events=[_0xc6c9('0x1'),'remove',_0xc6c9('0x2')];function createListener(_0x332be5,_0x282692){return function(_0x2505c5){_0x282692['emit'](_0x332be5,_0x2505c5);};}function removeListener(_0x3257fa,_0x459e90){return function(){MailAccountEvents[_0xc6c9('0x3')](_0x3257fa,_0x459e90);};}exports[_0xc6c9('0x4')]=function(_0x422195){for(var _0x84b96e=0x0,_0xf9e43e=events[_0xc6c9('0x5')];_0x84b96e<_0xf9e43e;_0x84b96e++){var _0x30db53=events[_0x84b96e];var _0x15cf6e=createListener(_0xc6c9('0x6')+_0x30db53,_0x422195);MailAccountEvents['on'](_0x30db53,_0x15cf6e);}}; \ No newline at end of file +var _0xbff1=['update','removeListener','register','./mailAccount.events','remove'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbff1,0x8a));var _0x1bff=function(_0x2ac686,_0x54fb04){_0x2ac686=_0x2ac686-0x0;var _0xbc434f=_0xbff1[_0x2ac686];return _0xbc434f;};'use strict';var MailAccountEvents=require(_0x1bff('0x0'));var events=['save',_0x1bff('0x1'),_0x1bff('0x2')];function createListener(_0xcdaab6,_0x56c2a){return function(_0x1f2039){_0x56c2a['emit'](_0xcdaab6,_0x1f2039);};}function removeListener(_0x341103,_0x317b29){return function(){MailAccountEvents[_0x1bff('0x3')](_0x341103,_0x317b29);};}exports[_0x1bff('0x4')]=function(_0x569c02){for(var _0x54cafa=0x0,_0x3cf208=events['length'];_0x54cafa<_0x3cf208;_0x54cafa++){var _0x225b02=events[_0x54cafa];var _0x56af82=createListener('mailAccount:'+_0x225b02,_0x569c02);MailAccountEvents['on'](_0x225b02,_0x56af82);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index a4e41e4..5549baf 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 _0xe4ab=['../../components/interaction/service','get','isAuthenticated','put','update','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe4ab,0xe7));var _0xbe4a=function(_0x2a7925,_0x113219){_0x2a7925=_0x2a7925-0x0;var _0x57f2ae=_0xe4ab[_0x2a7925];return _0x57f2ae;};'use strict';var multer=require(_0xbe4a('0x0'));var util=require(_0xbe4a('0x1'));var path=require('path');var timeout=require(_0xbe4a('0x2'));var express=require(_0xbe4a('0x3'));var router=express[_0xbe4a('0x4')]();var fs_extra=require(_0xbe4a('0x5'));var auth=require(_0xbe4a('0x6'));var interaction=require(_0xbe4a('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0xbe4a('0x8')]('/:id',auth[_0xbe4a('0x9')](),controller['show']);router[_0xbe4a('0xa')]('/:id',auth[_0xbe4a('0x9')](),controller[_0xbe4a('0xb')]);router['delete'](_0xbe4a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xbe4a('0xd')]=router; \ No newline at end of file +var _0x2988=['get','/:id','show','put','update','delete','isAuthenticated','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0x2988,0x1ac));var _0x8298=function(_0x31d605,_0x5924e0){_0x31d605=_0x31d605-0x0;var _0xb43c65=_0x2988[_0x31d605];return _0xb43c65;};'use strict';var multer=require(_0x8298('0x0'));var util=require(_0x8298('0x1'));var path=require(_0x8298('0x2'));var timeout=require(_0x8298('0x3'));var express=require(_0x8298('0x4'));var router=express[_0x8298('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8298('0x6'));var controller=require('./mailApplication.controller');router[_0x8298('0x7')](_0x8298('0x8'),auth['isAuthenticated'](),controller[_0x8298('0x9')]);router[_0x8298('0xa')](_0x8298('0x8'),auth['isAuthenticated'](),controller[_0x8298('0xb')]);router[_0x8298('0xc')]('/:id',auth[_0x8298('0xd')](),controller[_0x8298('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index d76d62e..cfbdaf6 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 _0xdd4e=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3a8af0,_0xa738ca){var _0x4fa12a=function(_0x4c2fe2){while(--_0x4c2fe2){_0x3a8af0['push'](_0x3a8af0['shift']());}};_0x4fa12a(++_0xa738ca);}(_0xdd4e,0x1af));var _0xedd4=function(_0x4e0026,_0x2b52b6){_0x4e0026=_0x4e0026-0x0;var _0x3f8ee7=_0xdd4e[_0x4e0026];return _0x3f8ee7;};'use strict';var Sequelize=require(_0xedd4('0x0'));module[_0xedd4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xedd4('0x2')],'allowNull':![],'defaultValue':_0xedd4('0x3')},'appdata':{'type':Sequelize[_0xedd4('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xedd4('0x2')],'defaultValue':_0xedd4('0x5')}}; \ No newline at end of file +var _0x7c2b=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x1c0913,_0x46a37a){var _0xc013e3=function(_0x5c93d6){while(--_0x5c93d6){_0x1c0913['push'](_0x1c0913['shift']());}};_0xc013e3(++_0x46a37a);}(_0x7c2b,0x1f4));var _0xb7c2=function(_0x4cdea9,_0x3d6201){_0x4cdea9=_0x4cdea9-0x0;var _0x39a396=_0x7c2b[_0x4cdea9];return _0x39a396;};'use strict';var Sequelize=require(_0xb7c2('0x0'));module[_0xb7c2('0x1')]={'priority':{'type':Sequelize[_0xb7c2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb7c2('0x3')],'allowNull':![],'defaultValue':_0xb7c2('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb7c2('0x3')]},'interval':{'type':Sequelize[_0xb7c2('0x3')],'defaultValue':_0xb7c2('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index bc0eec5..7690470 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x592d77,_0x5267ed){var _0x4b905d=function(_0x297480){while(--_0x297480){_0x592d77['push'](_0x592d77['shift']());}};_0x4b905d(++_0x5267ed);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x21e17c,_0x5744e0){var _0x16846f=function(_0x41d3d2){while(--_0x41d3d2){_0x21e17c['push'](_0x21e17c['shift']());}};_0x16846f(++_0x5744e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 0e08d0f..043a08d 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 _0x1249=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1249,0x1a3));var _0x9124=function(_0x3bb846,_0x4157e3){_0x3bb846=_0x3bb846-0x0;var _0x58d9b3=_0x1249[_0x3bb846];return _0x58d9b3;};'use strict';var _=require(_0x9124('0x0'));var util=require(_0x9124('0x1'));var logger=require('../../config/logger')(_0x9124('0x2'));var moment=require(_0x9124('0x3'));var BPromise=require(_0x9124('0x4'));var rp=require(_0x9124('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9124('0x6'));var config=require(_0x9124('0x7'));var attributes=require(_0x9124('0x8'));module[_0x9124('0x9')]=function(_0x18de10,_0xcadd69){return _0x18de10[_0x9124('0xa')](_0x9124('0xb'),attributes,{'tableName':_0x9124('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9124('0xd'),'collate':_0x9124('0xe')});}; \ No newline at end of file +var _0xdd9b=['rimraf','../../config/environment','./mailApplication.attributes','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdd9b,0x8a));var _0xbdd9=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xdd9b[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0xbdd9('0x0'));var util=require(_0xbdd9('0x1'));var logger=require(_0xbdd9('0x2'))(_0xbdd9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbdd9('0x4'));var fs=require('fs');var path=require(_0xbdd9('0x5'));var rimraf=require(_0xbdd9('0x6'));var config=require(_0xbdd9('0x7'));var attributes=require(_0xbdd9('0x8'));module['exports']=function(_0x56d19c,_0x6378ef){return _0x56d19c['define'](_0xbdd9('0x9'),attributes,{'tableName':_0xbdd9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbdd9('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3487fc8..c5f241e 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 _0xc61b=['MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1db07a,_0x42153f){var _0x198e23=function(_0x44dc74){while(--_0x44dc74){_0x1db07a['push'](_0x1db07a['shift']());}};_0x198e23(++_0x42153f);}(_0xc61b,0x17b));var _0xbc61=function(_0x2cf4b8,_0x35151d){_0x2cf4b8=_0x2cf4b8-0x0;var _0xf5eb1f=_0xc61b[_0x2cf4b8];return _0xf5eb1f;};'use strict';var _=require(_0xbc61('0x0'));var util=require(_0xbc61('0x1'));var moment=require(_0xbc61('0x2'));var BPromise=require(_0xbc61('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc61('0x4'));var db=require(_0xbc61('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc61('0x6'))(_0xbc61('0x7'));var config=require('../../config/environment');var jayson=require(_0xbc61('0x8'));var client=jayson[_0xbc61('0x9')][_0xbc61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5587de,_0x4aa012,_0x2dd977){return new BPromise(function(_0x4591e2,_0x1115bf){return client[_0xbc61('0xb')](_0x5587de,_0x2dd977)[_0xbc61('0xc')](function(_0x1a5cf9){logger[_0xbc61('0xd')](_0xbc61('0xe'),_0x4aa012,_0xbc61('0xf'));logger[_0xbc61('0x10')](_0xbc61('0x11'),_0x4aa012,_0xbc61('0xf'),JSON[_0xbc61('0x12')](_0x1a5cf9));if(_0x1a5cf9[_0xbc61('0x13')]){if(_0x1a5cf9['error'][_0xbc61('0x14')]===0x1f4){logger[_0xbc61('0x13')](_0xbc61('0xe'),_0x4aa012,_0x1a5cf9[_0xbc61('0x13')][_0xbc61('0x15')]);return _0x1115bf(_0x1a5cf9[_0xbc61('0x13')][_0xbc61('0x15')]);}logger[_0xbc61('0x13')]('MailApplication,\x20%s,\x20%s',_0x4aa012,_0x1a5cf9[_0xbc61('0x13')][_0xbc61('0x15')]);return _0x4591e2(_0x1a5cf9[_0xbc61('0x13')][_0xbc61('0x15')]);}else{logger['info'](_0xbc61('0xe'),_0x4aa012,_0xbc61('0xf'));_0x4591e2(_0x1a5cf9[_0xbc61('0x16')][_0xbc61('0x15')]);}})[_0xbc61('0x17')](function(_0x1aebf5){logger[_0xbc61('0x13')](_0xbc61('0xe'),_0x4aa012,_0x1aebf5);_0x1115bf(_0x1aebf5);});});}exports['UpdateMailApplication']=function(_0x5986b4){var _0x4d3a70=this;return new Promise(function(_0x4565cb,_0x52ec14){return db[_0xbc61('0x18')][_0xbc61('0x19')](_0x5986b4[_0xbc61('0x1a')],{'raw':_0x5986b4['options']?_0x5986b4[_0xbc61('0x1b')][_0xbc61('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5986b4[_0xbc61('0x1b')]?_0x5986b4[_0xbc61('0x1b')][_0xbc61('0x1d')]||null:null,'attributes':_0x5986b4[_0xbc61('0x1b')]?_0x5986b4[_0xbc61('0x1b')][_0xbc61('0x1e')]||null:null,'limit':_0x5986b4[_0xbc61('0x1b')]?_0x5986b4[_0xbc61('0x1b')][_0xbc61('0x1f')]||null:null})[_0xbc61('0xc')](function(_0x1b17cd){logger[_0xbc61('0xd')](_0xbc61('0x20'),_0x5986b4);logger[_0xbc61('0x10')]('UpdateMailApplication',_0x5986b4,JSON[_0xbc61('0x12')](_0x1b17cd));_0x4565cb(_0x1b17cd);})['catch'](function(_0x11056c){logger[_0xbc61('0x13')](_0xbc61('0x20'),_0x11056c[_0xbc61('0x15')],_0x5986b4);_0x52ec14(_0x4d3a70[_0xbc61('0x13')](0x1f4,_0x11056c[_0xbc61('0x15')]));});});}; \ No newline at end of file +var _0x4628=['rpc','client','http','request','then','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','error','code','MailApplication,\x20%s,\x20%s','message','info','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','debug','stringify','util','randomstring','../../mysqldb','../../config/logger'];(function(_0x47c292,_0x1b96de){var _0x483fe2=function(_0x263140){while(--_0x263140){_0x47c292['push'](_0x47c292['shift']());}};_0x483fe2(++_0x1b96de);}(_0x4628,0x70));var _0x8462=function(_0x4eea87,_0x54366a){_0x4eea87=_0x4eea87-0x0;var _0x54aff6=_0x4628[_0x4eea87];return _0x54aff6;};'use strict';var _=require('lodash');var util=require(_0x8462('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8462('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8462('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8462('0x3'))(_0x8462('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8462('0x5')][_0x8462('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xc4c73a,_0x36a09d,_0x470457){return new BPromise(function(_0x578718,_0x1d4de9){return client[_0x8462('0x7')](_0xc4c73a,_0x470457)[_0x8462('0x8')](function(_0x4bc1b0){logger['info']('MailApplication,\x20%s,\x20%s',_0x36a09d,_0x8462('0x9'));logger['debug'](_0x8462('0xa'),_0x36a09d,'request\x20sent',JSON['stringify'](_0x4bc1b0));if(_0x4bc1b0[_0x8462('0xb')]){if(_0x4bc1b0['error'][_0x8462('0xc')]===0x1f4){logger[_0x8462('0xb')](_0x8462('0xd'),_0x36a09d,_0x4bc1b0[_0x8462('0xb')][_0x8462('0xe')]);return _0x1d4de9(_0x4bc1b0[_0x8462('0xb')][_0x8462('0xe')]);}logger[_0x8462('0xb')](_0x8462('0xd'),_0x36a09d,_0x4bc1b0[_0x8462('0xb')]['message']);return _0x578718(_0x4bc1b0[_0x8462('0xb')][_0x8462('0xe')]);}else{logger[_0x8462('0xf')](_0x8462('0xd'),_0x36a09d,_0x8462('0x9'));_0x578718(_0x4bc1b0[_0x8462('0x10')]['message']);}})[_0x8462('0x11')](function(_0x6e2118){logger['error'](_0x8462('0xd'),_0x36a09d,_0x6e2118);_0x1d4de9(_0x6e2118);});});}exports[_0x8462('0x12')]=function(_0x2ec4d3){var _0x121c50=this;return new Promise(function(_0x179261,_0x8f8e7e){return db[_0x8462('0x13')][_0x8462('0x14')](_0x2ec4d3[_0x8462('0x15')],{'raw':_0x2ec4d3['options']?_0x2ec4d3[_0x8462('0x16')][_0x8462('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ec4d3[_0x8462('0x16')]?_0x2ec4d3[_0x8462('0x16')][_0x8462('0x18')]||null:null,'attributes':_0x2ec4d3[_0x8462('0x16')]?_0x2ec4d3[_0x8462('0x16')][_0x8462('0x19')]||null:null,'limit':_0x2ec4d3[_0x8462('0x16')]?_0x2ec4d3[_0x8462('0x16')][_0x8462('0x1a')]||null:null})[_0x8462('0x8')](function(_0x1313d9){logger[_0x8462('0xf')](_0x8462('0x12'),_0x2ec4d3);logger[_0x8462('0x1b')]('UpdateMailApplication',_0x2ec4d3,JSON[_0x8462('0x1c')](_0x1313d9));_0x179261(_0x1313d9);})[_0x8462('0x11')](function(_0x39c0bc){logger['error']('UpdateMailApplication',_0x39c0bc[_0x8462('0xe')],_0x2ec4d3);_0x8f8e7e(_0x121c50[_0x8462('0xb')](0x1f4,_0x39c0bc[_0x8462('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 646f36d..dcc3374 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 _0x47ad=['mailinteraction:addtags','put','mailinteraction:update','delete','mailinteraction:destroy','removeTags','express','../../components/auth/service','isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x47ad,0x1e9));var _0xd47a=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0x47ad[_0x3b5049];return _0x12454e;};'use strict';var express=require(_0xd47a('0x0'));var router=express['Router']();var auth=require(_0xd47a('0x1'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router['get']('/',auth[_0xd47a('0x2')](),controller[_0xd47a('0x3')]);router[_0xd47a('0x4')]('/describe',auth[_0xd47a('0x2')](),controller['describe']);router[_0xd47a('0x4')](_0xd47a('0x5'),auth[_0xd47a('0x2')](),controller[_0xd47a('0x6')]);router[_0xd47a('0x4')](_0xd47a('0x7'),auth[_0xd47a('0x2')](),controller[_0xd47a('0x8')]);router[_0xd47a('0x4')](_0xd47a('0x9'),auth[_0xd47a('0x2')](),controller[_0xd47a('0xa')]);router[_0xd47a('0xb')]('/',auth[_0xd47a('0x2')](),controller[_0xd47a('0xc')]);router[_0xd47a('0xb')](_0xd47a('0x7'),auth[_0xd47a('0x2')](),controller[_0xd47a('0xd')]);router['post'](_0xd47a('0xe'),auth[_0xd47a('0x2')](),interaction[_0xd47a('0xf')](_0xd47a('0x10'),_0xd47a('0x11')),controller['addTags']);router[_0xd47a('0x12')](_0xd47a('0x5'),auth[_0xd47a('0x2')](),interaction[_0xd47a('0xf')]('mail',_0xd47a('0x13')),controller['update']);router[_0xd47a('0x14')]('/:id',auth[_0xd47a('0x2')](),interaction[_0xd47a('0xf')](_0xd47a('0x10'),_0xd47a('0x15')),controller['destroy']);router[_0xd47a('0x14')](_0xd47a('0xe'),auth[_0xd47a('0x2')](),controller[_0xd47a('0x16')]);module['exports']=router; \ No newline at end of file +var _0xfb0c=['./mailInteraction.controller','get','isAuthenticated','/describe','describe','show','getMessages','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','mailinteraction:addtags','/:id','mail','mailinteraction:destroy','delete','removeTags','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xfb0c,0x8c));var _0xcfb0=function(_0x198be1,_0x331cc6){_0x198be1=_0x198be1-0x0;var _0xbeaf80=_0xfb0c[_0x198be1];return _0xbeaf80;};'use strict';var express=require(_0xcfb0('0x0'));var router=express[_0xcfb0('0x1')]();var auth=require(_0xcfb0('0x2'));var interaction=require(_0xcfb0('0x3'));var controller=require(_0xcfb0('0x4'));router[_0xcfb0('0x5')]('/',auth[_0xcfb0('0x6')](),controller['index']);router[_0xcfb0('0x5')](_0xcfb0('0x7'),auth[_0xcfb0('0x6')](),controller[_0xcfb0('0x8')]);router[_0xcfb0('0x5')]('/:id',auth[_0xcfb0('0x6')](),controller[_0xcfb0('0x9')]);router[_0xcfb0('0x5')]('/:id/messages',auth[_0xcfb0('0x6')](),controller[_0xcfb0('0xa')]);router[_0xcfb0('0x5')]('/:id/download',auth[_0xcfb0('0x6')](),controller[_0xcfb0('0xb')]);router['post']('/',auth[_0xcfb0('0x6')](),controller[_0xcfb0('0xc')]);router[_0xcfb0('0xd')](_0xcfb0('0xe'),auth[_0xcfb0('0x6')](),controller[_0xcfb0('0xf')]);router[_0xcfb0('0xd')](_0xcfb0('0x10'),auth['isAuthenticated'](),interaction[_0xcfb0('0x11')]('mail',_0xcfb0('0x12')),controller['addTags']);router['put'](_0xcfb0('0x13'),auth['isAuthenticated'](),interaction[_0xcfb0('0x11')](_0xcfb0('0x14'),'mailinteraction:update'),controller['update']);router['delete'](_0xcfb0('0x13'),auth[_0xcfb0('0x6')](),interaction[_0xcfb0('0x11')](_0xcfb0('0x14'),_0xcfb0('0x15')),controller['destroy']);router[_0xcfb0('0x16')](_0xcfb0('0x10'),auth['isAuthenticated'](),controller[_0xcfb0('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 97262cf..137e4e8 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 _0x27c5=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x706860,_0x54f43e){var _0x4b66ae=function(_0x40ec84){while(--_0x40ec84){_0x706860['push'](_0x706860['shift']());}};_0x4b66ae(++_0x54f43e);}(_0x27c5,0xa0));var _0x527c=function(_0x103c4c,_0x285348){_0x103c4c=_0x103c4c-0x0;var _0x3fc15e=_0x27c5[_0x103c4c];return _0x3fc15e;};'use strict';var Sequelize=require(_0x527c('0x0'));var iconv=require('iconv');module[_0x527c('0x1')]={'closed':{'type':Sequelize[_0x527c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x527c('0x3')]},'secondDisposition':{'type':Sequelize[_0x527c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x527c('0x3')]},'inReplyTo':{'type':Sequelize[_0x527c('0x3')](0x1fe)},'to':{'type':Sequelize[_0x527c('0x3')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x527c('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x527c('0x4')]},'substatus':{'type':Sequelize[_0x527c('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x527c('0x5')]('in',_0x527c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x527c('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x527c('0x5')]('in',_0x527c('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x527c('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1d07=['DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN'];(function(_0x23fd0d,_0x432f71){var _0x408b8c=function(_0x18f2c7){while(--_0x18f2c7){_0x23fd0d['push'](_0x23fd0d['shift']());}};_0x408b8c(++_0x432f71);}(_0x1d07,0x1e6));var _0x71d0=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x1d07[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require(_0x71d0('0x0'));var iconv=require(_0x71d0('0x1'));module[_0x71d0('0x2')]={'closed':{'type':Sequelize[_0x71d0('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x71d0('0x4')]},'disposition':{'type':Sequelize[_0x71d0('0x5')]},'secondDisposition':{'type':Sequelize[_0x71d0('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x71d0('0x5')](0x1fe)},'to':{'type':Sequelize[_0x71d0('0x5')]},'cc':{'type':Sequelize[_0x71d0('0x6')](_0x71d0('0x7'))},'subject':{'type':Sequelize[_0x71d0('0x6')]()},'attach':{'type':Sequelize[_0x71d0('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x71d0('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x71d0('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x71d0('0x8')]('in',_0x71d0('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x71d0('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x71d0('0x8')]('in',_0x71d0('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x71d0('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index cc4d0ff..e5324cd 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 _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xb10b,0x12a));var _0xbb10=function(_0x170310,_0x31acf9){_0x170310=_0x170310-0x0;var _0x1b6006=_0xb10b[_0x170310];return _0x1b6006;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file +var _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xb10b,0x12a));var _0xbb10=function(_0x362733,_0x46e9fa){_0x362733=_0x362733-0x0;var _0x4fccca=_0xb10b[_0x362733];return _0x4fccca;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 6b363c4..d758c43 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 _0x3348=['MailInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3348,0x178));var _0x8334=function(_0x3d7fbb,_0x247b1b){_0x3d7fbb=_0x3d7fbb-0x0;var _0x2c0906=_0x3348[_0x3d7fbb];return _0x2c0906;};'use strict';var EventEmitter=require(_0x8334('0x0'));var MailInteraction=require(_0x8334('0x1'))['db'][_0x8334('0x2')];var MailMessage=require(_0x8334('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x8334('0x3')](0x0);var events={'afterCreate':_0x8334('0x4'),'afterUpdate':_0x8334('0x5'),'afterDestroy':_0x8334('0x6')};function emitEvent(_0x160bc7){return function(_0x49049f,_0x3e4523,_0xa3645d){_0x49049f[_0x8334('0x7')]({'attributes':['id'],'raw':!![]})[_0x8334('0x8')](function(_0x5b8a61){_0x49049f[_0x8334('0x9')](_0x8334('0xa'),_0x5b8a61[_0x8334('0xb')](function(_0x55200c){return{'id':_0x55200c['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x49049f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8334('0x8')](function(_0x10331f){_0x49049f[_0x8334('0x9')]('unreadMessages',_0x10331f[_0x8334('0xc')]);MailInteractionEvents[_0x8334('0xd')](_0x160bc7+':'+_0x49049f['id'],_0x49049f);MailInteractionEvents[_0x8334('0xd')](_0x160bc7,_0x49049f);_0xa3645d(null);})[_0x8334('0xe')](_0xa3645d(null));};}for(var e in events){if(events[_0x8334('0xf')](e)){var event=events[e];MailInteraction[_0x8334('0x10')](e,emitEvent(event));}}module[_0x8334('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x04bb=['exports','events','../../mysqldb','MailInteraction','save','update','remove','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0xfee3b9,_0x528ec5){var _0x5794ef=function(_0x2f776c){while(--_0x2f776c){_0xfee3b9['push'](_0xfee3b9['shift']());}};_0x5794ef(++_0x528ec5);}(_0x04bb,0x122));var _0xb04b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x04bb[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0xb04b('0x0'));var MailInteraction=require(_0xb04b('0x1'))['db'][_0xb04b('0x2')];var MailMessage=require(_0xb04b('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb04b('0x3'),'afterUpdate':_0xb04b('0x4'),'afterDestroy':_0xb04b('0x5')};function emitEvent(_0x43dfae){return function(_0x14e4f2,_0x1108f5,_0x1a1ca0){_0x14e4f2['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x700791){_0x14e4f2[_0xb04b('0x6')](_0xb04b('0x7'),_0x700791[_0xb04b('0x8')](function(_0xfbd810){return{'id':_0xfbd810['id']};}));return MailMessage[_0xb04b('0x9')]({'where':{'MailInteractionId':_0x14e4f2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4ba954){_0x14e4f2[_0xb04b('0x6')](_0xb04b('0xa'),_0x4ba954[_0xb04b('0xb')]);MailInteractionEvents[_0xb04b('0xc')](_0x43dfae+':'+_0x14e4f2['id'],_0x14e4f2);MailInteractionEvents['emit'](_0x43dfae,_0x14e4f2);_0x1a1ca0(null);})[_0xb04b('0xd')](_0x1a1ca0(null));};}for(var e in events){if(events[_0xb04b('0xe')](e)){var event=events[e];MailInteraction[_0xb04b('0xf')](e,emitEvent(event));}}module[_0xb04b('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d593bd9..7534bd7 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 _0x3796=['update','catch','lodash','../../config/logger','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','substatus','closed','models','get','MailMessage'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x3796,0x152));var _0x6379=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x3796[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x6379('0x0'));var util=require('util');var logger=require(_0x6379('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6379('0x2'));var fs=require('fs');var path=require(_0x6379('0x3'));var rimraf=require(_0x6379('0x4'));var config=require('../../config/environment');var attributes=require(_0x6379('0x5'));module[_0x6379('0x6')]=function(_0x461231,_0x54a922){return _0x461231[_0x6379('0x7')](_0x6379('0x8'),attributes,{'tableName':_0x6379('0x9'),'paranoid':![],'indexes':[{'name':_0x6379('0xa'),'fields':['subject','to'],'type':_0x6379('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x316cb2,_0x4f0144,_0x4c5206){if(_0x316cb2['substatus']){_0x316cb2[_0x6379('0xc')]=moment()[_0x6379('0xd')](_0x6379('0xe'));}if(_0x316cb2['closed']){_0x316cb2[_0x6379('0xf')]=moment()[_0x6379('0xd')](_0x6379('0xe'));}_0x4c5206(null,_0x4f0144);},'beforeUpdate':function(_0x47fda0,_0x1f8f68,_0x14e1c1){if(_0x47fda0[_0x6379('0x10')](_0x6379('0x11'))){_0x47fda0['substatusAt']=_0x47fda0[_0x6379('0x11')]?moment()[_0x6379('0xd')](_0x6379('0xe')):null;}if(_0x47fda0['changed'](_0x6379('0x12'))){_0x47fda0[_0x6379('0xf')]=moment()[_0x6379('0xd')](_0x6379('0xe'));_0x47fda0[_0x6379('0x11')]=null;_0x47fda0[_0x6379('0xc')]=null;}_0x14e1c1(null,_0x47fda0);},'afterUpdate':function(_0x5b4188,_0x36fecf,_0x3c65af){var _0x136c9e=_0x461231[_0x6379('0x13')];var _0x3a5c2d=_0x5b4188[_0x6379('0x14')]({'plain':!![]});if(_0x3a5c2d[_0x6379('0x12')]){return _0x136c9e[_0x6379('0x15')][_0x6379('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x3a5c2d['id']}})['then'](function(){_0x3c65af();})[_0x6379('0x17')](function(_0x2543cd){_0x3c65af(_0x2543cd);});}else{_0x3c65af();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xaa41=['substatus','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','substatusAt','closed','models','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject'];(function(_0x366e99,_0x15d82d){var _0x180bbe=function(_0x282498){while(--_0x282498){_0x366e99['push'](_0x366e99['shift']());}};_0x180bbe(++_0x15d82d);}(_0xaa41,0x1c6));var _0x1aa4=function(_0x41c910,_0x2ae471){_0x41c910=_0x41c910-0x0;var _0x2c3d6c=_0xaa41[_0x41c910];return _0x2c3d6c;};'use strict';var _=require(_0x1aa4('0x0'));var util=require(_0x1aa4('0x1'));var logger=require(_0x1aa4('0x2'))(_0x1aa4('0x3'));var moment=require(_0x1aa4('0x4'));var BPromise=require('bluebird');var rp=require(_0x1aa4('0x5'));var fs=require('fs');var path=require(_0x1aa4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1aa4('0x7'));module[_0x1aa4('0x8')]=function(_0x44ade2,_0x2b7a0a){return _0x44ade2[_0x1aa4('0x9')](_0x1aa4('0xa'),attributes,{'tableName':_0x1aa4('0xb'),'paranoid':![],'indexes':[{'name':_0x1aa4('0xc'),'fields':[_0x1aa4('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x34b997,_0x84dd15,_0x1607b0){if(_0x34b997[_0x1aa4('0xe')]){_0x34b997['substatusAt']=moment()['format'](_0x1aa4('0xf'));}if(_0x34b997['closed']){_0x34b997[_0x1aa4('0x10')]=moment()[_0x1aa4('0x11')](_0x1aa4('0xf'));}_0x1607b0(null,_0x84dd15);},'beforeUpdate':function(_0x55a9fa,_0x4aee64,_0x3b3b28){if(_0x55a9fa[_0x1aa4('0x12')](_0x1aa4('0xe'))){_0x55a9fa[_0x1aa4('0x13')]=_0x55a9fa[_0x1aa4('0xe')]?moment()[_0x1aa4('0x11')](_0x1aa4('0xf')):null;}if(_0x55a9fa[_0x1aa4('0x12')](_0x1aa4('0x14'))){_0x55a9fa[_0x1aa4('0x10')]=moment()[_0x1aa4('0x11')](_0x1aa4('0xf'));_0x55a9fa[_0x1aa4('0xe')]=null;_0x55a9fa[_0x1aa4('0x13')]=null;}_0x3b3b28(null,_0x55a9fa);},'afterUpdate':function(_0x583fb5,_0x506cc8,_0x439a7a){var _0x25f204=_0x44ade2[_0x1aa4('0x15')];var _0x3f1e0b=_0x583fb5['get']({'plain':!![]});if(_0x3f1e0b['closed']){return _0x25f204[_0x1aa4('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x3f1e0b['id']}})[_0x1aa4('0x17')](function(){_0x439a7a();})['catch'](function(_0x5d988b){_0x439a7a(_0x5d988b);});}else{_0x439a7a();}}},'charset':_0x1aa4('0x18'),'collate':_0x1aa4('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b113937..dc94cd8 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 _0xee7c=['redis','localhost','socket.io-emitter','register','then','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','update','body','options','raw','attributes','limit','info','AddTagsToMailInteraction','MailInteraction','find','where','addTags','ids','spread','AddTags','debug','util','moment','bluebird','../../mysqldb','../../config/logger','client','http','defaults'];(function(_0x5b937f,_0x44ffcb){var _0x661c89=function(_0x407ff9){while(--_0x407ff9){_0x5b937f['push'](_0x5b937f['shift']());}};_0x661c89(++_0x44ffcb);}(_0xee7c,0x14e));var _0xcee7=function(_0x35b138,_0x5c0ed1){_0x35b138=_0x35b138-0x0;var _0x3ab7b0=_0xee7c[_0x35b138];return _0x3ab7b0;};'use strict';var _=require('lodash');var util=require(_0xcee7('0x0'));var moment=require(_0xcee7('0x1'));var BPromise=require(_0xcee7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcee7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcee7('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcee7('0x5')][_0xcee7('0x6')]({'port':0x232a});config['redis']=_[_0xcee7('0x7')](config[_0xcee7('0x8')],{'host':_0xcee7('0x9'),'port':0x18eb});var socket=require(_0xcee7('0xa'))(new Redis(config[_0xcee7('0x8')]));require('./mailInteraction.socket')[_0xcee7('0xb')](socket);function respondWithRpcPromise(_0x5227cb,_0xa43dc1,_0x132348){return new BPromise(function(_0x2bec80,_0x39e31c){return client['request'](_0x5227cb,_0x132348)[_0xcee7('0xc')](function(_0x566875){logger['info'](_0xcee7('0xd'),_0xa43dc1,_0xcee7('0xe'));logger['debug'](_0xcee7('0xf'),_0xa43dc1,_0xcee7('0xe'),JSON[_0xcee7('0x10')](_0x566875));if(_0x566875[_0xcee7('0x11')]){if(_0x566875[_0xcee7('0x11')][_0xcee7('0x12')]===0x1f4){logger[_0xcee7('0x11')]('MailInteraction,\x20%s,\x20%s',_0xa43dc1,_0x566875['error'][_0xcee7('0x13')]);return _0x39e31c(_0x566875[_0xcee7('0x11')][_0xcee7('0x13')]);}logger[_0xcee7('0x11')](_0xcee7('0xd'),_0xa43dc1,_0x566875[_0xcee7('0x11')]['message']);return _0x2bec80(_0x566875[_0xcee7('0x11')]['message']);}else{logger['info'](_0xcee7('0xd'),_0xa43dc1,_0xcee7('0xe'));_0x2bec80(_0x566875['result']['message']);}})[_0xcee7('0x14')](function(_0x14aac6){logger['error'](_0xcee7('0xd'),_0xa43dc1,_0x14aac6);_0x39e31c(_0x14aac6);});});}exports[_0xcee7('0x15')]=function(_0x2c8a67){var _0x5a668e=this;return new Promise(function(_0x4b07ce,_0x13200d){return db['MailInteraction'][_0xcee7('0x16')](_0x2c8a67[_0xcee7('0x17')],{'raw':_0x2c8a67[_0xcee7('0x18')]?_0x2c8a67[_0xcee7('0x18')][_0xcee7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c8a67[_0xcee7('0x18')]?_0x2c8a67[_0xcee7('0x18')]['where']||null:null,'attributes':_0x2c8a67[_0xcee7('0x18')]?_0x2c8a67[_0xcee7('0x18')][_0xcee7('0x1a')]||null:null,'limit':_0x2c8a67[_0xcee7('0x18')]?_0x2c8a67[_0xcee7('0x18')][_0xcee7('0x1b')]||null:null})[_0xcee7('0xc')](function(_0x17f98f){logger[_0xcee7('0x1c')]('UpdateMailInteraction',_0x2c8a67);logger['debug']('UpdateMailInteraction',_0x2c8a67,JSON['stringify'](_0x17f98f));_0x4b07ce(_0x17f98f);})['catch'](function(_0x343725){logger[_0xcee7('0x11')](_0xcee7('0x15'),_0x343725[_0xcee7('0x13')],_0x2c8a67);_0x13200d(_0x5a668e[_0xcee7('0x11')](0x1f4,_0x343725[_0xcee7('0x13')]));});});};exports[_0xcee7('0x1d')]=function(_0x4fd4bb){return new Promise(function(_0x2912de,_0x7e4de7){return db[_0xcee7('0x1e')][_0xcee7('0x1f')]({'where':_0x4fd4bb[_0xcee7('0x18')]?_0x4fd4bb[_0xcee7('0x18')][_0xcee7('0x20')]||null:null})['then'](function(_0x35dee7){if(_0x35dee7){return _0x35dee7[_0xcee7('0x21')](_0x4fd4bb[_0xcee7('0x17')]['ids'],_['omit'](_0x4fd4bb[_0xcee7('0x17')],[_0xcee7('0x22'),'id'])||{});}})[_0xcee7('0x23')](function(_0x30c241){logger[_0xcee7('0x1c')](_0xcee7('0x24'),_0x4fd4bb);logger[_0xcee7('0x25')](_0xcee7('0x24'),_0x4fd4bb,JSON[_0xcee7('0x10')](_0x30c241));_0x2912de(_0x30c241);})[_0xcee7('0x14')](function(_0xb255ff){logger[_0xcee7('0x11')](_0xcee7('0x24'),_0xb255ff[_0xcee7('0x13')],_0x4fd4bb);_0x7e4de7(_this[_0xcee7('0x11')](0x1f4,_0xb255ff[_0xcee7('0x13')]));});});}; \ No newline at end of file +var _0x064e=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','update','body','options','raw','where','limit','find','ids','omit','spread','AddTags'];(function(_0xd0afa5,_0x5084a0){var _0x1beeac=function(_0x4435e3){while(--_0x4435e3){_0xd0afa5['push'](_0xd0afa5['shift']());}};_0x1beeac(++_0x5084a0);}(_0x064e,0xd2));var _0xe064=function(_0xb3e8c8,_0x5cf80e){_0xb3e8c8=_0xb3e8c8-0x0;var _0x5b20ef=_0x064e[_0xb3e8c8];return _0x5b20ef;};'use strict';var _=require(_0xe064('0x0'));var util=require(_0xe064('0x1'));var moment=require(_0xe064('0x2'));var BPromise=require(_0xe064('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe064('0x4'));var db=require(_0xe064('0x5'))['db'];var utils=require(_0xe064('0x6'));var logger=require('../../config/logger')(_0xe064('0x7'));var config=require(_0xe064('0x8'));var jayson=require(_0xe064('0x9'));var client=jayson['client'][_0xe064('0xa')]({'port':0x232a});config[_0xe064('0xb')]=_[_0xe064('0xc')](config['redis'],{'host':_0xe064('0xd'),'port':0x18eb});var socket=require(_0xe064('0xe'))(new Redis(config[_0xe064('0xb')]));require(_0xe064('0xf'))[_0xe064('0x10')](socket);function respondWithRpcPromise(_0x4a5e45,_0x5e600a,_0x2b6f30){return new BPromise(function(_0x3459d2,_0x375501){return client[_0xe064('0x11')](_0x4a5e45,_0x2b6f30)[_0xe064('0x12')](function(_0x301a3d){logger[_0xe064('0x13')](_0xe064('0x14'),_0x5e600a,_0xe064('0x15'));logger[_0xe064('0x16')](_0xe064('0x17'),_0x5e600a,_0xe064('0x15'),JSON[_0xe064('0x18')](_0x301a3d));if(_0x301a3d[_0xe064('0x19')]){if(_0x301a3d['error'][_0xe064('0x1a')]===0x1f4){logger[_0xe064('0x19')](_0xe064('0x14'),_0x5e600a,_0x301a3d['error'][_0xe064('0x1b')]);return _0x375501(_0x301a3d[_0xe064('0x19')]['message']);}logger['error'](_0xe064('0x14'),_0x5e600a,_0x301a3d[_0xe064('0x19')][_0xe064('0x1b')]);return _0x3459d2(_0x301a3d[_0xe064('0x19')][_0xe064('0x1b')]);}else{logger[_0xe064('0x13')](_0xe064('0x14'),_0x5e600a,'request\x20sent');_0x3459d2(_0x301a3d[_0xe064('0x1c')][_0xe064('0x1b')]);}})[_0xe064('0x1d')](function(_0x1f6e78){logger[_0xe064('0x19')](_0xe064('0x14'),_0x5e600a,_0x1f6e78);_0x375501(_0x1f6e78);});});}exports[_0xe064('0x1e')]=function(_0x4839b7){var _0x354145=this;return new Promise(function(_0x457e89,_0x680c29){return db['MailInteraction'][_0xe064('0x1f')](_0x4839b7[_0xe064('0x20')],{'raw':_0x4839b7[_0xe064('0x21')]?_0x4839b7[_0xe064('0x21')][_0xe064('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4839b7[_0xe064('0x21')]?_0x4839b7['options'][_0xe064('0x23')]||null:null,'attributes':_0x4839b7[_0xe064('0x21')]?_0x4839b7[_0xe064('0x21')]['attributes']||null:null,'limit':_0x4839b7[_0xe064('0x21')]?_0x4839b7[_0xe064('0x21')][_0xe064('0x24')]||null:null})[_0xe064('0x12')](function(_0x5de5e2){logger['info']('UpdateMailInteraction',_0x4839b7);logger['debug'](_0xe064('0x1e'),_0x4839b7,JSON[_0xe064('0x18')](_0x5de5e2));_0x457e89(_0x5de5e2);})[_0xe064('0x1d')](function(_0x4a8427){logger[_0xe064('0x19')]('UpdateMailInteraction',_0x4a8427[_0xe064('0x1b')],_0x4839b7);_0x680c29(_0x354145[_0xe064('0x19')](0x1f4,_0x4a8427[_0xe064('0x1b')]));});});};exports['AddTagsToMailInteraction']=function(_0x5ac41d){return new Promise(function(_0x129cce,_0x2657db){return db['MailInteraction'][_0xe064('0x25')]({'where':_0x5ac41d[_0xe064('0x21')]?_0x5ac41d[_0xe064('0x21')][_0xe064('0x23')]||null:null})[_0xe064('0x12')](function(_0x1bd151){if(_0x1bd151){return _0x1bd151['addTags'](_0x5ac41d[_0xe064('0x20')][_0xe064('0x26')],_[_0xe064('0x27')](_0x5ac41d[_0xe064('0x20')],[_0xe064('0x26'),'id'])||{});}})[_0xe064('0x28')](function(_0x1f3018){logger[_0xe064('0x13')](_0xe064('0x29'),_0x5ac41d);logger[_0xe064('0x16')](_0xe064('0x29'),_0x5ac41d,JSON['stringify'](_0x1f3018));_0x129cce(_0x1f3018);})['catch'](function(_0x1beb13){logger[_0xe064('0x19')](_0xe064('0x29'),_0x1beb13['message'],_0x5ac41d);_0x2657db(_this['error'](0x1f4,_0x1beb13['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index f00139c..f36b6d2 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 _0x3397=['removeListener','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0x2d8f06,_0x3629bf){var _0x554413=function(_0x52977a){while(--_0x52977a){_0x2d8f06['push'](_0x2d8f06['shift']());}};_0x554413(++_0x3629bf);}(_0x3397,0x1e3));var _0x7339=function(_0x16bf05,_0x4f70da){_0x16bf05=_0x16bf05-0x0;var _0xbcf546=_0x3397[_0x16bf05];return _0xbcf546;};'use strict';var MailInteractionEvents=require(_0x7339('0x0'));var events=[_0x7339('0x1'),_0x7339('0x2'),_0x7339('0x3')];function createListener(_0x59cb06,_0x42e693){return function(_0x59c106){_0x42e693[_0x7339('0x4')](_0x59cb06,_0x59c106);};}function removeListener(_0x43331f,_0x4f8ecb){return function(){MailInteractionEvents[_0x7339('0x5')](_0x43331f,_0x4f8ecb);};}exports['register']=function(_0x35f64d){for(var _0x596049=0x0,_0x6f4b0c=events[_0x7339('0x6')];_0x596049<_0x6f4b0c;_0x596049++){var _0x45ec3b=events[_0x596049];var _0x4f24a4=createListener(_0x7339('0x7')+_0x45ec3b,_0x35f64d);MailInteractionEvents['on'](_0x45ec3b,_0x4f24a4);}}; \ No newline at end of file +var _0x8c5d=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x2f0a77,_0x437771){var _0x426cdf=function(_0x14e843){while(--_0x14e843){_0x2f0a77['push'](_0x2f0a77['shift']());}};_0x426cdf(++_0x437771);}(_0x8c5d,0x14a));var _0xd8c5=function(_0x45153c,_0x1935ae){_0x45153c=_0x45153c-0x0;var _0x5a7976=_0x8c5d[_0x45153c];return _0x5a7976;};'use strict';var MailInteractionEvents=require(_0xd8c5('0x0'));var events=[_0xd8c5('0x1'),_0xd8c5('0x2'),_0xd8c5('0x3')];function createListener(_0x36405e,_0x4e6535){return function(_0x39dcd3){_0x4e6535[_0xd8c5('0x4')](_0x36405e,_0x39dcd3);};}function removeListener(_0x30631d,_0x2ba997){return function(){MailInteractionEvents[_0xd8c5('0x5')](_0x30631d,_0x2ba997);};}exports[_0xd8c5('0x6')]=function(_0x542d11){for(var _0x5ee2e4=0x0,_0x57f770=events[_0xd8c5('0x7')];_0x5ee2e4<_0x57f770;_0x5ee2e4++){var _0x1f4ce0=events[_0x5ee2e4];var _0x5ab3fc=createListener(_0xd8c5('0x8')+_0x1f4ce0,_0x542d11);MailInteractionEvents['on'](_0x1f4ce0,_0x5ab3fc);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 9c08a57..a7e6d78 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 _0x870d=['put','update','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','./mailMessage.controller','get','index','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','mail','mailmessage:create','create'];(function(_0x4b547a,_0xbc178e){var _0x34b313=function(_0x37a117){while(--_0x37a117){_0x4b547a['push'](_0x4b547a['shift']());}};_0x34b313(++_0xbc178e);}(_0x870d,0x124));var _0xd870=function(_0x423c73,_0x223a2c){_0x423c73=_0x423c73-0x0;var _0xba2cc3=_0x870d[_0x423c73];return _0xba2cc3;};'use strict';var multer=require(_0xd870('0x0'));var util=require(_0xd870('0x1'));var path=require(_0xd870('0x2'));var timeout=require(_0xd870('0x3'));var express=require('express');var router=express[_0xd870('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd870('0x5'));var config=require('../../config/environment');var controller=require(_0xd870('0x6'));router[_0xd870('0x7')]('/',auth['isAuthenticated'](),controller[_0xd870('0x8')]);router[_0xd870('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd870('0x9')]);router[_0xd870('0x7')](_0xd870('0xa'),auth[_0xd870('0xb')](),controller[_0xd870('0xc')]);router[_0xd870('0x7')](_0xd870('0xd'),auth['isAuthenticated'](),controller[_0xd870('0xe')]);router[_0xd870('0xf')]('/',auth[_0xd870('0xb')](),interaction[_0xd870('0x10')](_0xd870('0x11'),_0xd870('0x12')),controller[_0xd870('0x13')]);router[_0xd870('0x14')](_0xd870('0xa'),auth[_0xd870('0xb')](),controller[_0xd870('0x15')]);router['put']('/:id/accept',auth[_0xd870('0xb')](),controller['accept']);router['put'](_0xd870('0x16'),auth[_0xd870('0xb')](),controller[_0xd870('0x17')]);router[_0xd870('0x18')](_0xd870('0xa'),auth[_0xd870('0xb')](),controller[_0xd870('0x19')]);module['exports']=router; \ No newline at end of file +var _0x6170=['describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','create','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','index','/describe','isAuthenticated'];(function(_0xd35f1f,_0x5b2ce7){var _0x16e7db=function(_0x45ac8a){while(--_0x45ac8a){_0xd35f1f['push'](_0xd35f1f['shift']());}};_0x16e7db(++_0x5b2ce7);}(_0x6170,0x17d));var _0x0617=function(_0xf5c8eb,_0x424f64){_0xf5c8eb=_0xf5c8eb-0x0;var _0x48103d=_0x6170[_0xf5c8eb];return _0x48103d;};'use strict';var multer=require(_0x0617('0x0'));var util=require(_0x0617('0x1'));var path=require(_0x0617('0x2'));var timeout=require(_0x0617('0x3'));var express=require('express');var router=express[_0x0617('0x4')]();var fs_extra=require(_0x0617('0x5'));var auth=require(_0x0617('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0x0617('0x7')]('/',auth['isAuthenticated'](),controller[_0x0617('0x8')]);router[_0x0617('0x7')](_0x0617('0x9'),auth[_0x0617('0xa')](),controller[_0x0617('0xb')]);router[_0x0617('0x7')](_0x0617('0xc'),auth[_0x0617('0xa')](),controller[_0x0617('0xd')]);router[_0x0617('0x7')](_0x0617('0xe'),auth['isAuthenticated'](),controller[_0x0617('0xf')]);router[_0x0617('0x10')]('/',auth[_0x0617('0xa')](),interaction['tracked'](_0x0617('0x11'),_0x0617('0x12')),controller[_0x0617('0x13')]);router['put'](_0x0617('0xc'),auth[_0x0617('0xa')](),controller[_0x0617('0x14')]);router[_0x0617('0x15')](_0x0617('0x16'),auth[_0x0617('0xa')](),controller[_0x0617('0x17')]);router['put'](_0x0617('0x18'),auth['isAuthenticated'](),controller['reject']);router[_0x0617('0x19')](_0x0617('0xc'),auth[_0x0617('0xa')](),controller[_0x0617('0x1a')]);module[_0x0617('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index d61ec9a..aac7c95 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 _0x3e30=['ENUM','Chat','Email','sequelize','lodash','exports','long','TEXT','medium','BOOLEAN','out','STRING','DATE'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x3e30,0x12e));var _0x03e3=function(_0x492221,_0x9e2521){_0x492221=_0x492221-0x0;var _0x398bf9=_0x3e30[_0x492221];return _0x398bf9;};'use strict';var Sequelize=require(_0x03e3('0x0'));var _=require(_0x03e3('0x1'));module[_0x03e3('0x2')]={'body':{'type':Sequelize['TEXT'](_0x03e3('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x03e3('0x4')](_0x03e3('0x5'))},'read':{'type':Sequelize[_0x03e3('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x03e3('0x7')),'defaultValue':_0x03e3('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x03e3('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x03e3('0x4')](_0x03e3('0x3'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x03e3('0x4')](_0x03e3('0x3'))},'subject':{'type':Sequelize[_0x03e3('0x4')]},'sentAt':{'type':Sequelize[_0x03e3('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x03e3('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x03e3('0x9')]},'originTo':{'type':Sequelize[_0x03e3('0x4')](_0x03e3('0x3'))},'originCc':{'type':Sequelize[_0x03e3('0x4')](_0x03e3('0x3'))},'originChannel':{'type':Sequelize[_0x03e3('0xa')]('Email',_0x03e3('0xb')),'defaultValue':_0x03e3('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x58b6=['BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','sequelize','lodash','exports','TEXT','long'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x58b6,0x103));var _0x658b=function(_0x35dc41,_0x3024b6){_0x35dc41=_0x35dc41-0x0;var _0xe35658=_0x58b6[_0x35dc41];return _0xe35658;};'use strict';var Sequelize=require(_0x658b('0x0'));var _=require(_0x658b('0x1'));module[_0x658b('0x2')]={'body':{'type':Sequelize[_0x658b('0x3')](_0x658b('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x658b('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x658b('0x6')]('in',_0x658b('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x658b('0x8')](0x1fe)},'from':{'type':Sequelize[_0x658b('0x8')]},'to':{'type':Sequelize[_0x658b('0x3')](_0x658b('0x4'))},'cc':{'type':Sequelize[_0x658b('0x3')](_0x658b('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x658b('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x658b('0x9')]},'attach':{'type':Sequelize[_0x658b('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x658b('0x9')]},'originTo':{'type':Sequelize[_0x658b('0x3')](_0x658b('0x4'))},'originCc':{'type':Sequelize[_0x658b('0x3')](_0x658b('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x658b('0xb'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index d2cb33c..12a3df4 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 _0x85e9=['stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','show','params','filters','include','find','body','destroy','describe','create','direction','secret','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','pass','attachments','join','root','server/files/attachments','CmContact','defaults','ListId','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','read1stAt','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','manual','interface','channel','event','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','User','SIP/%s','reject','fromString','rejectmessage','unix','server','tmp','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','headers','Bcc','basename','existsSync','push','readFileSync','writeFileSync','download','eml-format','moment','bluebird','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','json','offset','limit','count','status','set','Content-Range','update','end','sendStatus'];(function(_0x49cfcb,_0x52bd77){var _0x3d3a09=function(_0x39a176){while(--_0x39a176){_0x49cfcb['push'](_0x49cfcb['shift']());}};_0x3d3a09(++_0x52bd77);}(_0x85e9,0x120));var _0x985e=function(_0x4dc3f0,_0x4ffac6){_0x4dc3f0=_0x4dc3f0-0x0;var _0xda64ac=_0x85e9[_0x4dc3f0];return _0xda64ac;};'use strict';var emlformat=require(_0x985e('0x0'));var moment=require(_0x985e('0x1'));var BPromise=require(_0x985e('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x985e('0x3'));var Redis=require(_0x985e('0x4'));var htmlToText=require(_0x985e('0x5'));var qs=require(_0x985e('0x6'));var logger=require(_0x985e('0x7'))(_0x985e('0x8'));var interaction_log=require(_0x985e('0x7'))(_0x985e('0x9'));var config=require(_0x985e('0xa'));var db=require(_0x985e('0xb'))['db'];config[_0x985e('0xc')]=_['defaults'](config[_0x985e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x985e('0xd'))(new Redis(config[_0x985e('0xc')]));require('./mailMessage.socket')[_0x985e('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x985e('0xf')][_0x985e('0x10')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41ecff,_0x3ae9c7,_0x55fcd9,_0x30ff2d){return new BPromise(function(_0x501eb3,_0x451997){var _0x24eb8c=_0x30ff2d||client;return _0x24eb8c[_0x985e('0x11')](_0x41ecff,_0x55fcd9)[_0x985e('0x12')](function(_0x550009){logger['info'](_0x985e('0x13'),_0x3ae9c7,_0x985e('0x14'));logger[_0x985e('0x15')](_0x985e('0x16'),_0x3ae9c7,_0x985e('0x14'),JSON[_0x985e('0x17')](_0x550009));if(_0x550009[_0x985e('0x18')]){if(_0x550009['error'][_0x985e('0x19')]===0x1f4){logger[_0x985e('0x18')](_0x985e('0x13'),_0x3ae9c7,_0x550009[_0x985e('0x18')][_0x985e('0x1a')]);return _0x451997(_0x550009['error'][_0x985e('0x1a')]);}logger['error'](_0x985e('0x13'),_0x3ae9c7,_0x550009['error'][_0x985e('0x1a')]);return _0x501eb3(_0x550009['error']['message']);}else{logger[_0x985e('0x1b')](_0x985e('0x13'),_0x3ae9c7,_0x985e('0x14'));_0x501eb3(_0x550009[_0x985e('0x1c')][_0x985e('0x1a')]);}})[_0x985e('0x1d')](function(_0x592245){logger[_0x985e('0x18')](_0x985e('0x13'),_0x3ae9c7,_0x592245);_0x451997(_0x592245);});});}function respondWithResult(_0x1747bd,_0x145488){_0x145488=_0x145488||0xc8;return function(_0x5c481c){if(_0x5c481c){return _0x1747bd['status'](_0x145488)[_0x985e('0x1e')](_0x5c481c);}};}function respondWithFilteredResult(_0x3cfdab,_0x179b70){return function(_0x6d5436){if(_0x6d5436){var _0x38c382=typeof _0x179b70[_0x985e('0x1f')]==='undefined'&&typeof _0x179b70[_0x985e('0x20')]==='undefined';var _0x5f10b9=_0x6d5436[_0x985e('0x21')];var _0xc6571c=_0x38c382?0x0:_0x179b70[_0x985e('0x1f')];var _0xacce4e=_0x38c382?_0x6d5436[_0x985e('0x21')]:_0x179b70[_0x985e('0x1f')]+_0x179b70['limit'];var _0x2697ea;if(_0xacce4e>=_0x5f10b9){_0xacce4e=_0x5f10b9;_0x2697ea=0xc8;}else{_0x2697ea=0xce;}_0x3cfdab[_0x985e('0x22')](_0x2697ea);return _0x3cfdab[_0x985e('0x23')](_0x985e('0x24'),_0xc6571c+'-'+_0xacce4e+'/'+_0x5f10b9)[_0x985e('0x1e')](_0x6d5436);}return null;};}function saveUpdates(_0x314307){return function(_0x4c908c){if(_0x4c908c){return _0x4c908c[_0x985e('0x25')](_0x314307)['then'](function(_0x4c05b3){return _0x4c05b3;});}return null;};}function removeEntity(_0x25a098){return function(_0x12abca){if(_0x12abca){return _0x12abca['destroy']()[_0x985e('0x12')](function(){_0x25a098[_0x985e('0x22')](0xcc)[_0x985e('0x26')]();});}};}function handleEntityNotFound(_0x5d2c41){return function(_0xacd309){if(!_0xacd309){_0x5d2c41[_0x985e('0x27')](0x194);}return _0xacd309;};}function handleError(_0x3fd6f4,_0x12dbf4){_0x12dbf4=_0x12dbf4||0x1f4;return function(_0x1fccec){logger[_0x985e('0x18')](_0x1fccec[_0x985e('0x28')]);if(_0x1fccec[_0x985e('0x29')]){delete _0x1fccec[_0x985e('0x29')];}_0x3fd6f4['status'](_0x12dbf4)['send'](_0x1fccec);};}exports[_0x985e('0x2a')]=function(_0x470530,_0x30fd3d){var _0xbb853d={},_0x126176={},_0x1dbad0={'count':0x0,'rows':[]};var _0x142eb3=_[_0x985e('0x2b')](db[_0x985e('0x2c')][_0x985e('0x2d')],function(_0xffe38e){return{'name':_0xffe38e[_0x985e('0x2e')],'type':_0xffe38e[_0x985e('0x2f')][_0x985e('0x30')]};});_0x126176[_0x985e('0x31')]=_[_0x985e('0x2b')](_0x142eb3,_0x985e('0x29'));_0x126176[_0x985e('0x32')]=_[_0x985e('0x33')](_0x470530[_0x985e('0x32')]);_0x126176['filters']=_['intersection'](_0x126176[_0x985e('0x31')],_0x126176[_0x985e('0x32')]);_0xbb853d[_0x985e('0x34')]=_[_0x985e('0x35')](_0x126176['model'],qs[_0x985e('0x36')](_0x470530[_0x985e('0x32')]['fields']));_0xbb853d[_0x985e('0x34')]=_0xbb853d[_0x985e('0x34')][_0x985e('0x37')]?_0xbb853d['attributes']:_0x126176[_0x985e('0x31')];if(!_0x470530['query'][_0x985e('0x38')](_0x985e('0x39'))){_0xbb853d[_0x985e('0x20')]=qs[_0x985e('0x20')](_0x470530[_0x985e('0x32')][_0x985e('0x20')]);_0xbb853d[_0x985e('0x1f')]=qs[_0x985e('0x1f')](_0x470530[_0x985e('0x32')][_0x985e('0x1f')]);}_0xbb853d['order']=qs[_0x985e('0x3a')](_0x470530[_0x985e('0x32')][_0x985e('0x3a')]);_0xbb853d[_0x985e('0x3b')]=qs['filters'](_[_0x985e('0x3c')](_0x470530[_0x985e('0x32')],_0x126176['filters']),_0x142eb3);if(_0x470530['query'][_0x985e('0x3d')]){_0xbb853d[_0x985e('0x3b')]=_[_0x985e('0x3e')](_0xbb853d[_0x985e('0x3b')],{'$or':_[_0x985e('0x2b')](_0x142eb3,function(_0x4fd268){if(_0x4fd268['type']!==_0x985e('0x3f')){var _0x359e43={};_0x359e43[_0x4fd268[_0x985e('0x29')]]={'$like':'%'+_0x470530['query'][_0x985e('0x3d')]+'%'};return _0x359e43;}})});}_0xbb853d=_['merge']({},_0xbb853d,_0x470530[_0x985e('0x40')]);var _0x6e53c0={'where':_0xbb853d[_0x985e('0x3b')]};return db['MailMessage'][_0x985e('0x21')](_0x6e53c0)[_0x985e('0x12')](function(_0x27172c){_0x1dbad0[_0x985e('0x21')]=_0x27172c;if(_0x470530[_0x985e('0x32')][_0x985e('0x41')]){_0xbb853d['include']=[{'all':!![]}];}return db[_0x985e('0x2c')]['findAll'](_0xbb853d);})[_0x985e('0x12')](function(_0xe87c0d){_0x1dbad0['rows']=_0xe87c0d;return _0x1dbad0;})[_0x985e('0x12')](respondWithFilteredResult(_0x30fd3d,_0xbb853d))[_0x985e('0x1d')](handleError(_0x30fd3d,null));};exports[_0x985e('0x42')]=function(_0x3be399,_0x15c541){var _0xefe083={'raw':!![],'where':{'id':_0x3be399[_0x985e('0x43')]['id']}},_0x1180d9={};_0x1180d9[_0x985e('0x31')]=_[_0x985e('0x33')](db[_0x985e('0x2c')]['rawAttributes']);_0x1180d9[_0x985e('0x32')]=_[_0x985e('0x33')](_0x3be399[_0x985e('0x32')]);_0x1180d9[_0x985e('0x44')]=_[_0x985e('0x35')](_0x1180d9[_0x985e('0x31')],_0x1180d9[_0x985e('0x32')]);_0xefe083['attributes']=_['intersection'](_0x1180d9['model'],qs['fields'](_0x3be399['query']['fields']));_0xefe083[_0x985e('0x34')]=_0xefe083[_0x985e('0x34')][_0x985e('0x37')]?_0xefe083['attributes']:_0x1180d9[_0x985e('0x31')];if(_0x3be399['query'][_0x985e('0x41')]){_0xefe083[_0x985e('0x45')]=[{'all':!![]}];}_0xefe083=_[_0x985e('0x3e')]({},_0xefe083,_0x3be399['options']);return db[_0x985e('0x2c')][_0x985e('0x46')](_0xefe083)[_0x985e('0x12')](handleEntityNotFound(_0x15c541,null))[_0x985e('0x12')](respondWithResult(_0x15c541,null))[_0x985e('0x1d')](handleError(_0x15c541,null));};exports[_0x985e('0x25')]=function(_0x543213,_0x1fcbe2){if(_0x543213['body']['id']){delete _0x543213[_0x985e('0x47')]['id'];}return db[_0x985e('0x2c')][_0x985e('0x46')]({'where':{'id':_0x543213['params']['id']}})[_0x985e('0x12')](handleEntityNotFound(_0x1fcbe2,null))[_0x985e('0x12')](saveUpdates(_0x543213[_0x985e('0x47')],null))[_0x985e('0x12')](respondWithResult(_0x1fcbe2,null))[_0x985e('0x1d')](handleError(_0x1fcbe2,null));};exports[_0x985e('0x48')]=function(_0xb5871c,_0x2f1312){return db[_0x985e('0x2c')][_0x985e('0x46')]({'where':{'id':_0xb5871c[_0x985e('0x43')]['id']}})[_0x985e('0x12')](handleEntityNotFound(_0x2f1312,null))[_0x985e('0x12')](removeEntity(_0x2f1312,null))[_0x985e('0x1d')](handleError(_0x2f1312,null));};exports[_0x985e('0x49')]=function(_0x434f4f,_0x13c057){return db['MailMessage']['describe']()[_0x985e('0x12')](respondWithResult(_0x13c057,null))[_0x985e('0x1d')](handleError(_0x13c057,null));};exports['create']=function(_0x42fd05,_0x43bd16){return db[_0x985e('0x2c')][_0x985e('0x4a')](_0x42fd05[_0x985e('0x47')])[_0x985e('0x12')](function(_0x3ce056){if(_0x3ce056){if(_0x3ce056[_0x985e('0x4b')]==='out'&&!_0x3ce056[_0x985e('0x4c')]){var _0x2a54e1,_0x1d805b,_0x15c695;if(_0x42fd05[_0x985e('0x47')]['to']){_0x1d805b=_0x42fd05[_0x985e('0x47')]['to']['split'](',')[0x0];}return db[_0x985e('0x4d')][_0x985e('0x4e')]({'where':{'id':_0x3ce056[_0x985e('0x4f')]},'include':[{'model':db[_0x985e('0x50')],'as':_0x985e('0x51'),'include':[{'model':db['CmContact'],'as':_0x985e('0x52'),'where':{'email':_0x1d805b},'limit':0x1,'order':[[_0x985e('0x53'),'DESC']]}]},{'model':db[_0x985e('0x54')],'as':_0x985e('0x55'),'raw':!![]}]})[_0x985e('0x12')](function(_0x1d9991){_0x2a54e1=_0x1d9991;if(_0x2a54e1&&_0x2a54e1[_0x985e('0x55')]){var _0x1706af={'tls':{'rejectUnauthorized':![]}};if(_[_0x985e('0x56')](_0x2a54e1[_0x985e('0x55')][_0x985e('0x57')])){_0x1706af[_0x985e('0x58')]=_0x2a54e1[_0x985e('0x55')][_0x985e('0x58')];_0x1706af[_0x985e('0x59')]=_0x2a54e1[_0x985e('0x55')][_0x985e('0x59')];_0x1706af[_0x985e('0x5a')]=_0x2a54e1[_0x985e('0x55')][_0x985e('0x5a')];if(_0x2a54e1[_0x985e('0x55')][_0x985e('0x5b')]){_0x1706af[_0x985e('0x5c')]={'user':_0x2a54e1['Smtp']['user'],'pass':_0x2a54e1[_0x985e('0x55')][_0x985e('0x5d')]};}}else{_0x1706af['service']=_0x2a54e1[_0x985e('0x55')][_0x985e('0x57')];_0x1706af[_0x985e('0x5c')]={'user':_0x2a54e1[_0x985e('0x55')]['user'],'pass':_0x2a54e1[_0x985e('0x55')][_0x985e('0x5d')]};_0x1706af[_0x985e('0x5a')]=_0x2a54e1[_0x985e('0x55')]['secure'];}if(_0x42fd05['body']['attachments']&&_0x42fd05[_0x985e('0x47')][_0x985e('0x5e')][_0x985e('0x37')]){for(var _0x1617f9=0x0;_0x1617f9<_0x42fd05[_0x985e('0x47')][_0x985e('0x5e')]['length'];_0x1617f9+=0x1){_0x42fd05[_0x985e('0x47')][_0x985e('0x5e')][_0x1617f9]={'filename':_0x42fd05[_0x985e('0x47')]['attachments'][_0x1617f9]['name'],'path':path[_0x985e('0x5f')](config[_0x985e('0x60')],_0x985e('0x61'),_0x42fd05['body'][_0x985e('0x5e')][_0x1617f9]['basename'])};}}_0x15c695={'account':_0x1706af,'message':_0x42fd05[_0x985e('0x47')]};return;}})[_0x985e('0x12')](function(){if(_0x2a54e1[_0x985e('0x51')]){if(_0x2a54e1[_0x985e('0x51')][_0x985e('0x52')][_0x985e('0x37')]){return _0x2a54e1[_0x985e('0x51')][_0x985e('0x52')][0x0];}else{return db[_0x985e('0x62')][_0x985e('0x4a')](_[_0x985e('0x63')](_0x42fd05[_0x985e('0x47')],{'firstName':_0x42fd05['body']['to'],'email':_0x42fd05['body']['to'],'phone':_0x42fd05[_0x985e('0x47')]['to'],'ListId':_0x2a54e1[_0x985e('0x64')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x15c695){return respondWithRpcPromise(_0x985e('0x65'),_0x985e('0x66'),_0x15c695,client9003)[_0x985e('0x12')](function(_0xb35203){return _0x3ce056['update']({'read':!![],'messageId':_0xb35203['messageId'],'sentAt':moment()['format'](_0x985e('0x67'))});})[_0x985e('0x1d')](function(_0x4409d0){logger[_0x985e('0x18')]('%s',JSON[_0x985e('0x17')](_0x4409d0));return _0x3ce056;});}return _0x3ce056;});}return _0x3ce056;}})[_0x985e('0x12')](respondWithResult(_0x43bd16,0xc9))[_0x985e('0x1d')](handleError(_0x43bd16,null));};exports[_0x985e('0x68')]=function(_0x8a0386,_0x372e85){var _0x280c92={'agent':{},'channel':_0x985e('0x69')};if(_0x8a0386[_0x985e('0x47')]['id']){delete _0x8a0386['body']['id'];}_0x8a0386[_0x985e('0x47')][_0x985e('0x6a')]=!![];_0x8a0386[_0x985e('0x47')][_0x985e('0x6b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x8a0386['body']['UserId']=_0x8a0386[_0x985e('0x47')][_0x985e('0x6c')]||_0x8a0386[_0x985e('0x6d')]['id'];_0x280c92[_0x985e('0x6e')]['id']=_0x8a0386[_0x985e('0x47')][_0x985e('0x6c')];return db['MailMessage'][_0x985e('0x46')]({'where':{'id':_0x8a0386['params']['id'],'UserId':null}})[_0x985e('0x12')](handleEntityNotFound(_0x372e85,null))[_0x985e('0x12')](saveUpdates(_0x8a0386[_0x985e('0x47')],null))[_0x985e('0x12')](function(_0x201e45){if(_0x201e45){_0x280c92['message']=_0x201e45[_0x985e('0x6f')]({'plain':!![]});return db[_0x985e('0x70')][_0x985e('0x46')]({'where':{'id':_0x201e45[_0x985e('0x71')]}});}return null;})[_0x985e('0x12')](handleEntityNotFound(_0x372e85,null))[_0x985e('0x12')](function(_0x105cb7){if(_0x105cb7){return _0x105cb7[_0x985e('0x25')]({'UserId':_0x8a0386[_0x985e('0x47')]['UserId'],'read1stAt':_[_0x985e('0x56')](_0x105cb7[_0x985e('0x72')])?moment()[_0x985e('0x73')](_0x985e('0x67')):undefined});}return null;})[_0x985e('0x12')](function(_0x19b8f4){if(_0x19b8f4){_0x280c92[_0x985e('0x74')]=_0x19b8f4['get']({'plain':!![]});interaction_log['info'](_0x985e('0x75'),_0x8a0386[_0x985e('0x6d')]['id'],_0x8a0386['user'][_0x985e('0x29')],_0x8a0386['user'][_0x985e('0x76')],_0x280c92[_0x985e('0x74')]['id'],_0x8a0386[_0x985e('0x47')]?JSON[_0x985e('0x17')](_0x8a0386[_0x985e('0x47')]):_0x985e('0x77'));return respondWithRpcPromise(_0x985e('0x78'),'acceptMessage',_0x280c92);}return null;})['then'](function(_0x46d319){var _0x38c00c=_0x985e('0x79')+_0x46d319['message'][_0x985e('0x7a')];return db[_0x985e('0x7b')][_0x985e('0x32')](_0x38c00c,{'type':db[_0x985e('0x7c')][_0x985e('0x7d')]['SELECT'],'raw':!![]})[_0x985e('0x12')](function(_0x5d33cf){return _0x5d33cf;});})[_0x985e('0x12')](function(_0x347322){if(_0x347322){_0x280c92['message'][_0x985e('0x7e')]=_0x347322[0x0];if(!_0x8a0386['body'][_0x985e('0x6c')])return;return db['User'][_0x985e('0x46')]({'where':{'id':_0x8a0386[_0x985e('0x47')][_0x985e('0x6c')],'role':_0x985e('0x6e')},'attributes':['id',_0x985e('0x29'),_0x985e('0x7f'),_0x985e('0x80'),_0x985e('0x81')],'raw':!![]});}return null;})[_0x985e('0x12')](function(_0x655a47){if(!_0x655a47)return null;_0x280c92[_0x985e('0x1a')][_0x985e('0x6e')]=_0x655a47;return _0x280c92;})[_0x985e('0x12')](function(_0x180a21){if(_0x180a21){if(_0x8a0386[_0x985e('0x47')][_0x985e('0x82')]){_0x280c92[_0x985e('0x1a')][_0x985e('0x83')]=util[_0x985e('0x73')]('SIP/%s',_0x8a0386[_0x985e('0x6d')][_0x985e('0x29')]);_0x280c92[_0x985e('0x1a')][_0x985e('0x84')]=_0x280c92[_0x985e('0x84')];_0x280c92[_0x985e('0x1a')]['motionChannel']=_0x280c92[_0x985e('0x84')];_0x280c92[_0x985e('0x1a')][_0x985e('0x85')]=_0x985e('0x68');_0x280c92['message'][_0x985e('0x47')]=htmlToText['fromString'](_0x280c92[_0x985e('0x1a')]['body']);return respondWithRpcPromise('EventManager',_0x985e('0x86'),{'event':_0x985e('0x87'),'message':_0x280c92[_0x985e('0x1a')]},client9002)[_0x985e('0x12')](function(){return _0x280c92;});}return _0x280c92;}return null;})[_0x985e('0x12')](respondWithResult(_0x372e85,null))['catch'](handleError(_0x372e85,null));};exports['reject']=function(_0x498040,_0x40a0e3){var _0x19bae0={'agent':{},'channel':_0x985e('0x69')};if(_0x498040['body']['id']){delete _0x498040[_0x985e('0x47')]['id'];}_0x498040[_0x985e('0x47')][_0x985e('0x6c')]=_0x498040['body'][_0x985e('0x6c')]||_0x498040[_0x985e('0x6d')]['id'];_0x19bae0['agent']['id']=_0x498040[_0x985e('0x47')][_0x985e('0x6c')];return db[_0x985e('0x2c')]['find']({'where':{'id':_0x498040[_0x985e('0x43')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x40a0e3,null))[_0x985e('0x12')](function(_0x4c2ed6){if(_0x4c2ed6){_0x19bae0[_0x985e('0x1a')]=_0x4c2ed6[_0x985e('0x6f')]({'plain':!![]});return db[_0x985e('0x70')][_0x985e('0x46')]({'where':{'id':_0x4c2ed6[_0x985e('0x71')]}});}return null;})['then'](handleEntityNotFound(_0x40a0e3,null))[_0x985e('0x12')](function(_0x205c99){if(_0x205c99){_0x19bae0[_0x985e('0x74')]=_0x205c99[_0x985e('0x6f')]({'plain':!![]});interaction_log['info'](_0x985e('0x88'),_0x498040[_0x985e('0x6d')]['id'],_0x498040[_0x985e('0x6d')][_0x985e('0x29')],_0x498040['user'][_0x985e('0x76')],_0x19bae0[_0x985e('0x74')]['id'],_0x498040[_0x985e('0x47')]?JSON[_0x985e('0x17')](_0x498040[_0x985e('0x47')]):_0x985e('0x77'));return respondWithRpcPromise(_0x985e('0x89'),_0x985e('0x8a'),_0x19bae0);}return null;})[_0x985e('0x12')](function(_0x8b361e){var _0x26c3a6=_0x985e('0x79')+_0x8b361e['message'][_0x985e('0x7a')];return db['sequelize'][_0x985e('0x32')](_0x26c3a6,{'type':db[_0x985e('0x7c')][_0x985e('0x7d')][_0x985e('0x8b')],'raw':!![]})['then'](function(_0x968674){return _0x968674;});})['then'](function(_0x1671b8){if(_0x1671b8){_0x19bae0['message'][_0x985e('0x7e')]=_0x1671b8[0x0];if(!_0x498040[_0x985e('0x47')][_0x985e('0x6c')])return;return db[_0x985e('0x8c')][_0x985e('0x46')]({'where':{'id':_0x498040[_0x985e('0x47')][_0x985e('0x6c')],'role':_0x985e('0x6e')},'attributes':['id',_0x985e('0x29'),_0x985e('0x7f'),_0x985e('0x80'),'internal'],'raw':!![]});}return null;})[_0x985e('0x12')](function(_0x30ec23){if(!_0x30ec23)return null;_0x19bae0['message']['agent']=_0x30ec23;return _0x19bae0;})[_0x985e('0x12')](function(_0x36f689){if(_0x36f689){_0x36f689[_0x985e('0x1a')]['interface']=util['format'](_0x985e('0x8d'),_0x498040['user'][_0x985e('0x29')]);_0x36f689[_0x985e('0x1a')][_0x985e('0x84')]=_0x19bae0[_0x985e('0x84')];_0x36f689[_0x985e('0x1a')]['motionChannel']=_0x19bae0['channel'];_0x36f689[_0x985e('0x1a')][_0x985e('0x85')]=_0x985e('0x8e');_0x36f689[_0x985e('0x1a')][_0x985e('0x47')]=htmlToText[_0x985e('0x8f')](_0x19bae0[_0x985e('0x1a')][_0x985e('0x47')]);respondWithRpcPromise('EventManager',_0x985e('0x86'),{'event':_0x985e('0x90'),'message':_0x36f689[_0x985e('0x1a')]},client9002);return _0x19bae0;}return null;})[_0x985e('0x12')](respondWithResult(_0x40a0e3,null))[_0x985e('0x1d')](handleError(_0x40a0e3,null));};exports['download']=function(_0xb8502d,_0x1a4eaf){var _0x4c0d0b=moment()[_0x985e('0x91')]()['toString']();var _0x151ef2=path['join'](config['root'],_0x985e('0x92'),'files',_0x985e('0x93'));var _0x15f5ad=path[_0x985e('0x5f')](config[_0x985e('0x60')],'server',_0x985e('0x94'),'attachments');var _0x4e8c90=util[_0x985e('0x73')](_0x985e('0x95'),_0x4c0d0b);return db[_0x985e('0x2c')][_0x985e('0x46')]({'where':{'id':_0xb8502d[_0x985e('0x43')]['id']},'attributes':['id',_0x985e('0x47'),_0x985e('0x96'),'to','cc',_0x985e('0x97'),_0x985e('0x98'),_0x985e('0x99')],'include':_0xb8502d[_0x985e('0x32')][_0x985e('0x5e')]?[{'model':db[_0x985e('0x9a')],'as':_0x985e('0x9b')}]:undefined})['then'](handleEntityNotFound(_0x1a4eaf,null))[_0x985e('0x12')](function(_0x358aca){if(_0x358aca){var _0x198b11=_0x358aca;var _0x5ec428={'from':_0x198b11['from'],'to':_0x198b11['to'],'subject':_0x198b11['subject'],'html':_0x198b11[_0x985e('0x47')],'headers':{'Date':moment(_0x198b11[_0x985e('0x99')])[_0x985e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x358aca['cc']){_0x5ec428[_0x985e('0x9c')]['Cc']=_0x358aca['cc'];}if(_0x358aca[_0x985e('0x97')]){_0x5ec428[_0x985e('0x9c')][_0x985e('0x9d')]=_0x358aca[_0x985e('0x97')];}return new BPromise(function(_0x5dd691,_0x544013){if(_0x358aca[_0x985e('0x9b')]){for(var _0xff29f0=0x0;_0xff29f0<_0x358aca[_0x985e('0x9b')]['length'];_0xff29f0++){var _0x5e16d5=_0x358aca[_0x985e('0x9b')][_0xff29f0];var _0x45e390=path[_0x985e('0x5f')](_0x15f5ad,_0x5e16d5[_0x985e('0x9e')]);if(fs[_0x985e('0x9f')](_0x45e390)){_0x5ec428[_0x985e('0x5e')][_0x985e('0xa0')]({'name':_0x5e16d5['name'],'contentType':_0x5e16d5[_0x985e('0x2f')],'data':fs[_0x985e('0xa1')](_0x45e390)});}}}emlformat['build'](_0x5ec428,function(_0x3f0ab1,_0x268c8b){if(_0x3f0ab1)return _0x544013(_0x3f0ab1);fs[_0x985e('0xa2')](path[_0x985e('0x5f')](_0x151ef2,_0x4e8c90),_0x268c8b);return _0x5dd691(_0x268c8b);});});}})[_0x985e('0x12')](function(_0x36f32c){if(_0x36f32c){return _0x1a4eaf[_0x985e('0xa3')](path[_0x985e('0x5f')](_0x151ef2,_0x4e8c90),_0x4e8c90,function(_0x4bd017){if(!_0x4bd017)fs['unlinkSync'](path[_0x985e('0x5f')](_0x151ef2,_0x4e8c90));});}})[_0x985e('0x1d')](handleError(_0x1a4eaf,null));}; \ No newline at end of file +var _0x0402=['read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','sequelize','QueryTypes','contact','reject','unix','toString','files','tmp','server','from','bcc','subject','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','push','readFileSync','unlinkSync','eml-format','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','limit','undefined','count','offset','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','merge','options','includeAll','rows','params','include','find','body','describe','create','direction','out','findOne','MailAccountId','CmList','List','CmContact','Contacts','DESC','MailServerOut','isNil','Smtp','service','host','port','secure','user','pass','auth','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','format','UserId','agent','get','MailInteraction'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0402,0x176));var _0x2040=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0402[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x2040('0x0'));var moment=require('moment');var BPromise=require(_0x2040('0x1'));var util=require('util');var path=require(_0x2040('0x2'));var fs=require('fs');var _=require(_0x2040('0x3'));var Redis=require(_0x2040('0x4'));var htmlToText=require(_0x2040('0x5'));var qs=require(_0x2040('0x6'));var logger=require(_0x2040('0x7'))(_0x2040('0x8'));var interaction_log=require(_0x2040('0x7'))(_0x2040('0x9'));var config=require(_0x2040('0xa'));var db=require(_0x2040('0xb'))['db'];config[_0x2040('0xc')]=_[_0x2040('0xd')](config[_0x2040('0xc')],{'host':_0x2040('0xe'),'port':0x18eb});var socket=require(_0x2040('0xf'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x2040('0x10')](socket);var jayson=require(_0x2040('0x11'));var client=jayson[_0x2040('0x12')]['http']({'port':0x232c});var client9003=jayson['client'][_0x2040('0x13')]({'port':0x232b});var client9002=jayson[_0x2040('0x12')][_0x2040('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x13d22a,_0x306831,_0x1b15a8,_0x55f24a){return new BPromise(function(_0x14f3a4,_0x475b9c){var _0x27d2c1=_0x55f24a||client;return _0x27d2c1[_0x2040('0x14')](_0x13d22a,_0x1b15a8)[_0x2040('0x15')](function(_0x28bc97){logger[_0x2040('0x16')](_0x2040('0x17'),_0x306831,_0x2040('0x18'));logger['debug'](_0x2040('0x19'),_0x306831,'request\x20sent',JSON['stringify'](_0x28bc97));if(_0x28bc97['error']){if(_0x28bc97[_0x2040('0x1a')][_0x2040('0x1b')]===0x1f4){logger[_0x2040('0x1a')]('MailMessage,\x20%s,\x20%s',_0x306831,_0x28bc97[_0x2040('0x1a')][_0x2040('0x1c')]);return _0x475b9c(_0x28bc97[_0x2040('0x1a')][_0x2040('0x1c')]);}logger[_0x2040('0x1a')](_0x2040('0x17'),_0x306831,_0x28bc97['error'][_0x2040('0x1c')]);return _0x14f3a4(_0x28bc97[_0x2040('0x1a')]['message']);}else{logger[_0x2040('0x16')](_0x2040('0x17'),_0x306831,_0x2040('0x18'));_0x14f3a4(_0x28bc97[_0x2040('0x1d')][_0x2040('0x1c')]);}})[_0x2040('0x1e')](function(_0x3ea391){logger[_0x2040('0x1a')](_0x2040('0x17'),_0x306831,_0x3ea391);_0x475b9c(_0x3ea391);});});}function respondWithResult(_0x46b3b8,_0x32b50d){_0x32b50d=_0x32b50d||0xc8;return function(_0x136e24){if(_0x136e24){return _0x46b3b8['status'](_0x32b50d)[_0x2040('0x1f')](_0x136e24);}};}function respondWithFilteredResult(_0xc1a96e,_0x74a922){return function(_0x4b0d4c){if(_0x4b0d4c){var _0x5dff15=typeof _0x74a922['offset']==='undefined'&&typeof _0x74a922[_0x2040('0x20')]===_0x2040('0x21');var _0x1ed9e1=_0x4b0d4c[_0x2040('0x22')];var _0x3c1856=_0x5dff15?0x0:_0x74a922[_0x2040('0x23')];var _0x2af1f6=_0x5dff15?_0x4b0d4c[_0x2040('0x22')]:_0x74a922[_0x2040('0x23')]+_0x74a922['limit'];var _0x40279d;if(_0x2af1f6>=_0x1ed9e1){_0x2af1f6=_0x1ed9e1;_0x40279d=0xc8;}else{_0x40279d=0xce;}_0xc1a96e[_0x2040('0x24')](_0x40279d);return _0xc1a96e[_0x2040('0x25')](_0x2040('0x26'),_0x3c1856+'-'+_0x2af1f6+'/'+_0x1ed9e1)[_0x2040('0x1f')](_0x4b0d4c);}return null;};}function saveUpdates(_0x5ec56a){return function(_0x2fed3c){if(_0x2fed3c){return _0x2fed3c[_0x2040('0x27')](_0x5ec56a)[_0x2040('0x15')](function(_0x256d25){return _0x256d25;});}return null;};}function removeEntity(_0x7273c){return function(_0x26e42e){if(_0x26e42e){return _0x26e42e[_0x2040('0x28')]()['then'](function(){_0x7273c['status'](0xcc)[_0x2040('0x29')]();});}};}function handleEntityNotFound(_0x3dcfb7){return function(_0x40edcf){if(!_0x40edcf){_0x3dcfb7[_0x2040('0x2a')](0x194);}return _0x40edcf;};}function handleError(_0x814b92,_0x4cc592){_0x4cc592=_0x4cc592||0x1f4;return function(_0x2212f8){logger[_0x2040('0x1a')](_0x2212f8[_0x2040('0x2b')]);if(_0x2212f8['name']){delete _0x2212f8[_0x2040('0x2c')];}_0x814b92[_0x2040('0x24')](_0x4cc592)[_0x2040('0x2d')](_0x2212f8);};}exports[_0x2040('0x2e')]=function(_0x1b1a8c,_0x36c74d){var _0x2a33ba={},_0x5c9707={},_0x254fa7={'count':0x0,'rows':[]};var _0x450b55=_[_0x2040('0x2f')](db[_0x2040('0x30')]['rawAttributes'],function(_0x4ca103){return{'name':_0x4ca103[_0x2040('0x31')],'type':_0x4ca103['type'][_0x2040('0x32')]};});_0x5c9707['model']=_[_0x2040('0x2f')](_0x450b55,_0x2040('0x2c'));_0x5c9707[_0x2040('0x33')]=_[_0x2040('0x34')](_0x1b1a8c[_0x2040('0x33')]);_0x5c9707[_0x2040('0x35')]=_[_0x2040('0x36')](_0x5c9707[_0x2040('0x37')],_0x5c9707[_0x2040('0x33')]);_0x2a33ba[_0x2040('0x38')]=_['intersection'](_0x5c9707[_0x2040('0x37')],qs[_0x2040('0x39')](_0x1b1a8c[_0x2040('0x33')][_0x2040('0x39')]));_0x2a33ba['attributes']=_0x2a33ba[_0x2040('0x38')][_0x2040('0x3a')]?_0x2a33ba[_0x2040('0x38')]:_0x5c9707[_0x2040('0x37')];if(!_0x1b1a8c['query'][_0x2040('0x3b')](_0x2040('0x3c'))){_0x2a33ba[_0x2040('0x20')]=qs[_0x2040('0x20')](_0x1b1a8c['query']['limit']);_0x2a33ba[_0x2040('0x23')]=qs[_0x2040('0x23')](_0x1b1a8c['query']['offset']);}_0x2a33ba[_0x2040('0x3d')]=qs[_0x2040('0x3e')](_0x1b1a8c[_0x2040('0x33')]['sort']);_0x2a33ba['where']=qs[_0x2040('0x35')](_[_0x2040('0x3f')](_0x1b1a8c['query'],_0x5c9707['filters']),_0x450b55);if(_0x1b1a8c[_0x2040('0x33')][_0x2040('0x40')]){_0x2a33ba[_0x2040('0x41')]=_['merge'](_0x2a33ba[_0x2040('0x41')],{'$or':_[_0x2040('0x2f')](_0x450b55,function(_0x2f6474){if(_0x2f6474[_0x2040('0x42')]!=='VIRTUAL'){var _0x984dc={};_0x984dc[_0x2f6474[_0x2040('0x2c')]]={'$like':'%'+_0x1b1a8c[_0x2040('0x33')][_0x2040('0x40')]+'%'};return _0x984dc;}})});}_0x2a33ba=_[_0x2040('0x43')]({},_0x2a33ba,_0x1b1a8c[_0x2040('0x44')]);var _0x4a6431={'where':_0x2a33ba[_0x2040('0x41')]};return db['MailMessage']['count'](_0x4a6431)[_0x2040('0x15')](function(_0xb5357c){_0x254fa7[_0x2040('0x22')]=_0xb5357c;if(_0x1b1a8c['query'][_0x2040('0x45')]){_0x2a33ba['include']=[{'all':!![]}];}return db[_0x2040('0x30')]['findAll'](_0x2a33ba);})[_0x2040('0x15')](function(_0x4ca13d){_0x254fa7[_0x2040('0x46')]=_0x4ca13d;return _0x254fa7;})[_0x2040('0x15')](respondWithFilteredResult(_0x36c74d,_0x2a33ba))[_0x2040('0x1e')](handleError(_0x36c74d,null));};exports['show']=function(_0x45aa6c,_0x39634b){var _0xcd1afb={'raw':!![],'where':{'id':_0x45aa6c[_0x2040('0x47')]['id']}},_0x3a6652={};_0x3a6652[_0x2040('0x37')]=_['keys'](db[_0x2040('0x30')]['rawAttributes']);_0x3a6652[_0x2040('0x33')]=_[_0x2040('0x34')](_0x45aa6c[_0x2040('0x33')]);_0x3a6652['filters']=_[_0x2040('0x36')](_0x3a6652[_0x2040('0x37')],_0x3a6652[_0x2040('0x33')]);_0xcd1afb['attributes']=_[_0x2040('0x36')](_0x3a6652[_0x2040('0x37')],qs[_0x2040('0x39')](_0x45aa6c[_0x2040('0x33')][_0x2040('0x39')]));_0xcd1afb[_0x2040('0x38')]=_0xcd1afb[_0x2040('0x38')][_0x2040('0x3a')]?_0xcd1afb[_0x2040('0x38')]:_0x3a6652['model'];if(_0x45aa6c[_0x2040('0x33')][_0x2040('0x45')]){_0xcd1afb[_0x2040('0x48')]=[{'all':!![]}];}_0xcd1afb=_['merge']({},_0xcd1afb,_0x45aa6c[_0x2040('0x44')]);return db[_0x2040('0x30')][_0x2040('0x49')](_0xcd1afb)[_0x2040('0x15')](handleEntityNotFound(_0x39634b,null))['then'](respondWithResult(_0x39634b,null))[_0x2040('0x1e')](handleError(_0x39634b,null));};exports[_0x2040('0x27')]=function(_0x3c0fe2,_0x21034b){if(_0x3c0fe2[_0x2040('0x4a')]['id']){delete _0x3c0fe2[_0x2040('0x4a')]['id'];}return db[_0x2040('0x30')]['find']({'where':{'id':_0x3c0fe2[_0x2040('0x47')]['id']}})['then'](handleEntityNotFound(_0x21034b,null))[_0x2040('0x15')](saveUpdates(_0x3c0fe2['body'],null))[_0x2040('0x15')](respondWithResult(_0x21034b,null))[_0x2040('0x1e')](handleError(_0x21034b,null));};exports['destroy']=function(_0x348f66,_0x39a7f2){return db[_0x2040('0x30')][_0x2040('0x49')]({'where':{'id':_0x348f66['params']['id']}})['then'](handleEntityNotFound(_0x39a7f2,null))[_0x2040('0x15')](removeEntity(_0x39a7f2,null))[_0x2040('0x1e')](handleError(_0x39a7f2,null));};exports[_0x2040('0x4b')]=function(_0x3ba805,_0xb523d7){return db['MailMessage'][_0x2040('0x4b')]()[_0x2040('0x15')](respondWithResult(_0xb523d7,null))[_0x2040('0x1e')](handleError(_0xb523d7,null));};exports['create']=function(_0x5b5585,_0x53388f){return db['MailMessage'][_0x2040('0x4c')](_0x5b5585[_0x2040('0x4a')])[_0x2040('0x15')](function(_0x3a761b){if(_0x3a761b){if(_0x3a761b[_0x2040('0x4d')]===_0x2040('0x4e')&&!_0x3a761b['secret']){var _0x113654,_0x40eaae,_0x2a24dd;if(_0x5b5585['body']['to']){_0x40eaae=_0x5b5585[_0x2040('0x4a')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x2040('0x4f')]({'where':{'id':_0x3a761b[_0x2040('0x50')]},'include':[{'model':db[_0x2040('0x51')],'as':_0x2040('0x52'),'include':[{'model':db[_0x2040('0x53')],'as':_0x2040('0x54'),'where':{'email':_0x40eaae},'limit':0x1,'order':[['updatedAt',_0x2040('0x55')]]}]},{'model':db[_0x2040('0x56')],'as':'Smtp','raw':!![]}]})['then'](function(_0x6b74ba){_0x113654=_0x6b74ba;if(_0x113654&&_0x113654['Smtp']){var _0x1d9af1={'tls':{'rejectUnauthorized':![]}};if(_[_0x2040('0x57')](_0x113654[_0x2040('0x58')][_0x2040('0x59')])){_0x1d9af1['host']=_0x113654[_0x2040('0x58')][_0x2040('0x5a')];_0x1d9af1[_0x2040('0x5b')]=_0x113654[_0x2040('0x58')][_0x2040('0x5b')];_0x1d9af1[_0x2040('0x5c')]=_0x113654[_0x2040('0x58')][_0x2040('0x5c')];if(_0x113654[_0x2040('0x58')]['authentication']){_0x1d9af1['auth']={'user':_0x113654[_0x2040('0x58')][_0x2040('0x5d')],'pass':_0x113654[_0x2040('0x58')][_0x2040('0x5e')]};}}else{_0x1d9af1['service']=_0x113654['Smtp'][_0x2040('0x59')];_0x1d9af1[_0x2040('0x5f')]={'user':_0x113654['Smtp'][_0x2040('0x5d')],'pass':_0x113654[_0x2040('0x58')][_0x2040('0x5e')]};_0x1d9af1[_0x2040('0x5c')]=_0x113654[_0x2040('0x58')][_0x2040('0x5c')];}if(_0x5b5585[_0x2040('0x4a')][_0x2040('0x60')]&&_0x5b5585[_0x2040('0x4a')][_0x2040('0x60')]['length']){for(var _0x19f29c=0x0;_0x19f29c<_0x5b5585[_0x2040('0x4a')][_0x2040('0x60')][_0x2040('0x3a')];_0x19f29c+=0x1){_0x5b5585[_0x2040('0x4a')]['attachments'][_0x19f29c]={'filename':_0x5b5585[_0x2040('0x4a')][_0x2040('0x60')][_0x19f29c][_0x2040('0x2c')],'path':path[_0x2040('0x61')](config[_0x2040('0x62')],_0x2040('0x63'),_0x5b5585[_0x2040('0x4a')][_0x2040('0x60')][_0x19f29c][_0x2040('0x64')])};}}_0x2a24dd={'account':_0x1d9af1,'message':_0x5b5585[_0x2040('0x4a')]};return;}})['then'](function(){if(_0x113654[_0x2040('0x52')]){if(_0x113654[_0x2040('0x52')]['Contacts'][_0x2040('0x3a')]){return _0x113654[_0x2040('0x52')][_0x2040('0x54')][0x0];}else{return db['CmContact'][_0x2040('0x4c')](_[_0x2040('0xd')](_0x5b5585[_0x2040('0x4a')],{'firstName':_0x5b5585[_0x2040('0x4a')]['to'],'email':_0x5b5585['body']['to'],'phone':_0x5b5585['body']['to'],'ListId':_0x113654[_0x2040('0x65')]}));}}else{throw new Error(_0x2040('0x66'));}})[_0x2040('0x15')](function(){if(_0x2a24dd){return respondWithRpcPromise(_0x2040('0x67'),_0x2040('0x68'),_0x2a24dd,client9003)[_0x2040('0x15')](function(_0x2b5039){return _0x3a761b[_0x2040('0x27')]({'read':!![],'messageId':_0x2b5039[_0x2040('0x69')],'sentAt':moment()['format'](_0x2040('0x6a'))});})[_0x2040('0x1e')](function(_0x5003a6){logger[_0x2040('0x1a')]('%s',JSON['stringify'](_0x5003a6));return _0x3a761b;});}return _0x3a761b;});}return _0x3a761b;}})['then'](respondWithResult(_0x53388f,0xc9))[_0x2040('0x1e')](handleError(_0x53388f,null));};exports[_0x2040('0x6b')]=function(_0x90e387,_0x14c5a0){var _0x49e4db={'agent':{},'channel':_0x2040('0x6c')};if(_0x90e387['body']['id']){delete _0x90e387[_0x2040('0x4a')]['id'];}_0x90e387['body']['read']=!![];_0x90e387[_0x2040('0x4a')][_0x2040('0x6d')]=moment()[_0x2040('0x6e')](_0x2040('0x6a'));_0x90e387['body'][_0x2040('0x6f')]=_0x90e387[_0x2040('0x4a')][_0x2040('0x6f')]||_0x90e387[_0x2040('0x5d')]['id'];_0x49e4db[_0x2040('0x70')]['id']=_0x90e387[_0x2040('0x4a')][_0x2040('0x6f')];return db[_0x2040('0x30')][_0x2040('0x49')]({'where':{'id':_0x90e387[_0x2040('0x47')]['id'],'UserId':null}})[_0x2040('0x15')](handleEntityNotFound(_0x14c5a0,null))['then'](saveUpdates(_0x90e387[_0x2040('0x4a')],null))[_0x2040('0x15')](function(_0xcfa3a8){if(_0xcfa3a8){_0x49e4db[_0x2040('0x1c')]=_0xcfa3a8[_0x2040('0x71')]({'plain':!![]});return db[_0x2040('0x72')][_0x2040('0x49')]({'where':{'id':_0xcfa3a8['MailInteractionId']}});}return null;})[_0x2040('0x15')](handleEntityNotFound(_0x14c5a0,null))[_0x2040('0x15')](function(_0x1243d5){if(_0x1243d5){return _0x1243d5[_0x2040('0x27')]({'UserId':_0x90e387[_0x2040('0x4a')][_0x2040('0x6f')],'read1stAt':_[_0x2040('0x57')](_0x1243d5[_0x2040('0x73')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2040('0x15')](function(_0x189183){if(_0x189183){_0x49e4db['interaction']=_0x189183[_0x2040('0x71')]({'plain':!![]});interaction_log[_0x2040('0x16')](_0x2040('0x74'),_0x90e387['user']['id'],_0x90e387[_0x2040('0x5d')][_0x2040('0x2c')],_0x90e387['user'][_0x2040('0x75')],_0x49e4db[_0x2040('0x76')]['id'],_0x90e387[_0x2040('0x4a')]?JSON['stringify'](_0x90e387[_0x2040('0x4a')]):_0x2040('0x77'));return respondWithRpcPromise(_0x2040('0x78'),_0x2040('0x79'),_0x49e4db);}return null;})['then'](function(_0xaae705){var _0x587799=_0x2040('0x7a')+_0xaae705[_0x2040('0x1c')][_0x2040('0x7b')];return db['sequelize'][_0x2040('0x33')](_0x587799,{'type':db[_0x2040('0x7c')]['QueryTypes'][_0x2040('0x7d')],'raw':!![]})[_0x2040('0x15')](function(_0x5b6e8f){return _0x5b6e8f;});})[_0x2040('0x15')](function(_0x10ac29){if(_0x10ac29){_0x49e4db[_0x2040('0x1c')]['contact']=_0x10ac29[0x0];if(!_0x90e387[_0x2040('0x4a')][_0x2040('0x6f')])return;return db[_0x2040('0x7e')][_0x2040('0x49')]({'where':{'id':_0x90e387[_0x2040('0x4a')][_0x2040('0x6f')],'role':_0x2040('0x70')},'attributes':['id','name',_0x2040('0x7f'),_0x2040('0x80'),_0x2040('0x81')],'raw':!![]});}return null;})[_0x2040('0x15')](function(_0x2e3d4b){if(!_0x2e3d4b)return null;_0x49e4db[_0x2040('0x1c')][_0x2040('0x70')]=_0x2e3d4b;return _0x49e4db;})[_0x2040('0x15')](function(_0xa55955){if(_0xa55955){if(_0x90e387['body']['manual']){_0x49e4db[_0x2040('0x1c')]['interface']=util[_0x2040('0x6e')](_0x2040('0x82'),_0x90e387[_0x2040('0x5d')][_0x2040('0x2c')]);_0x49e4db['message'][_0x2040('0x83')]=_0x49e4db[_0x2040('0x83')];_0x49e4db['message'][_0x2040('0x84')]=_0x49e4db[_0x2040('0x83')];_0x49e4db[_0x2040('0x1c')][_0x2040('0x85')]=_0x2040('0x6b');_0x49e4db['message']['body']=htmlToText[_0x2040('0x86')](_0x49e4db[_0x2040('0x1c')][_0x2040('0x4a')]);return respondWithRpcPromise(_0x2040('0x87'),'EventManager',{'event':_0x2040('0x88'),'message':_0x49e4db[_0x2040('0x1c')]},client9002)[_0x2040('0x15')](function(){return _0x49e4db;});}return _0x49e4db;}return null;})[_0x2040('0x15')](respondWithResult(_0x14c5a0,null))['catch'](handleError(_0x14c5a0,null));};exports['reject']=function(_0x177563,_0x41f8a7){var _0x2e3d52={'agent':{},'channel':_0x2040('0x6c')};if(_0x177563[_0x2040('0x4a')]['id']){delete _0x177563[_0x2040('0x4a')]['id'];}_0x177563[_0x2040('0x4a')][_0x2040('0x6f')]=_0x177563[_0x2040('0x4a')][_0x2040('0x6f')]||_0x177563[_0x2040('0x5d')]['id'];_0x2e3d52['agent']['id']=_0x177563[_0x2040('0x4a')]['UserId'];return db[_0x2040('0x30')][_0x2040('0x49')]({'where':{'id':_0x177563[_0x2040('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x41f8a7,null))[_0x2040('0x15')](function(_0x454a9d){if(_0x454a9d){_0x2e3d52[_0x2040('0x1c')]=_0x454a9d['get']({'plain':!![]});return db[_0x2040('0x72')][_0x2040('0x49')]({'where':{'id':_0x454a9d[_0x2040('0x89')]}});}return null;})['then'](handleEntityNotFound(_0x41f8a7,null))[_0x2040('0x15')](function(_0x101e77){if(_0x101e77){_0x2e3d52[_0x2040('0x76')]=_0x101e77[_0x2040('0x71')]({'plain':!![]});interaction_log[_0x2040('0x16')](_0x2040('0x8a'),_0x177563[_0x2040('0x5d')]['id'],_0x177563[_0x2040('0x5d')][_0x2040('0x2c')],_0x177563[_0x2040('0x5d')]['role'],_0x2e3d52[_0x2040('0x76')]['id'],_0x177563[_0x2040('0x4a')]?JSON[_0x2040('0x8b')](_0x177563[_0x2040('0x4a')]):_0x2040('0x77'));return respondWithRpcPromise(_0x2040('0x8c'),_0x2040('0x8d'),_0x2e3d52);}return null;})[_0x2040('0x15')](function(_0x140661){var _0x4b0f31=_0x2040('0x7a')+_0x140661[_0x2040('0x1c')][_0x2040('0x7b')];return db[_0x2040('0x8e')][_0x2040('0x33')](_0x4b0f31,{'type':db[_0x2040('0x7c')][_0x2040('0x8f')][_0x2040('0x7d')],'raw':!![]})[_0x2040('0x15')](function(_0x2ef29f){return _0x2ef29f;});})['then'](function(_0xa2973d){if(_0xa2973d){_0x2e3d52[_0x2040('0x1c')][_0x2040('0x90')]=_0xa2973d[0x0];if(!_0x177563[_0x2040('0x4a')]['UserId'])return;return db[_0x2040('0x7e')]['find']({'where':{'id':_0x177563['body'][_0x2040('0x6f')],'role':_0x2040('0x70')},'attributes':['id',_0x2040('0x2c'),'fullname',_0x2040('0x80'),_0x2040('0x81')],'raw':!![]});}return null;})[_0x2040('0x15')](function(_0x1aeac4){if(!_0x1aeac4)return null;_0x2e3d52['message'][_0x2040('0x70')]=_0x1aeac4;return _0x2e3d52;})['then'](function(_0x286459){if(_0x286459){_0x286459['message']['interface']=util[_0x2040('0x6e')](_0x2040('0x82'),_0x177563[_0x2040('0x5d')][_0x2040('0x2c')]);_0x286459[_0x2040('0x1c')][_0x2040('0x83')]=_0x2e3d52[_0x2040('0x83')];_0x286459[_0x2040('0x1c')][_0x2040('0x84')]=_0x2e3d52[_0x2040('0x83')];_0x286459[_0x2040('0x1c')][_0x2040('0x85')]=_0x2040('0x91');_0x286459[_0x2040('0x1c')]['body']=htmlToText[_0x2040('0x86')](_0x2e3d52[_0x2040('0x1c')]['body']);respondWithRpcPromise(_0x2040('0x87'),'EventManager',{'event':'rejectmessage','message':_0x286459[_0x2040('0x1c')]},client9002);return _0x2e3d52;}return null;})[_0x2040('0x15')](respondWithResult(_0x41f8a7,null))[_0x2040('0x1e')](handleError(_0x41f8a7,null));};exports['download']=function(_0xcac9a5,_0x55a05a){var _0x17287e=moment()[_0x2040('0x92')]()[_0x2040('0x93')]();var _0x1c7239=path[_0x2040('0x61')](config[_0x2040('0x62')],'server',_0x2040('0x94'),_0x2040('0x95'));var _0x5f3e95=path[_0x2040('0x61')](config[_0x2040('0x62')],_0x2040('0x96'),_0x2040('0x94'),_0x2040('0x60'));var _0x4e2418=util['format']('message-%s.eml',_0x17287e);return db[_0x2040('0x30')][_0x2040('0x49')]({'where':{'id':_0xcac9a5['params']['id']},'attributes':['id',_0x2040('0x4a'),_0x2040('0x97'),'to','cc',_0x2040('0x98'),_0x2040('0x99'),_0x2040('0x9a')],'include':_0xcac9a5[_0x2040('0x33')][_0x2040('0x60')]?[{'model':db[_0x2040('0x9b')],'as':'Attachments'}]:undefined})[_0x2040('0x15')](handleEntityNotFound(_0x55a05a,null))[_0x2040('0x15')](function(_0x191bfa){if(_0x191bfa){var _0x431149=_0x191bfa;var _0x3f5320={'from':_0x431149[_0x2040('0x97')],'to':_0x431149['to'],'subject':_0x431149['subject'],'html':_0x431149[_0x2040('0x4a')],'headers':{'Date':moment(_0x431149[_0x2040('0x9a')])[_0x2040('0x6e')](_0x2040('0x9c'))},'attachments':[]};if(_0x191bfa['cc']){_0x3f5320['headers']['Cc']=_0x191bfa['cc'];}if(_0x191bfa['bcc']){_0x3f5320[_0x2040('0x9d')][_0x2040('0x9e')]=_0x191bfa['bcc'];}return new BPromise(function(_0x49849b,_0x77faa8){if(_0x191bfa['Attachments']){for(var _0x3a2cbb=0x0;_0x3a2cbb<_0x191bfa[_0x2040('0x9f')][_0x2040('0x3a')];_0x3a2cbb++){var _0x3037da=_0x191bfa['Attachments'][_0x3a2cbb];var _0x5107be=path[_0x2040('0x61')](_0x5f3e95,_0x3037da[_0x2040('0x64')]);if(fs['existsSync'](_0x5107be)){_0x3f5320['attachments'][_0x2040('0xa0')]({'name':_0x3037da[_0x2040('0x2c')],'contentType':_0x3037da['type'],'data':fs[_0x2040('0xa1')](_0x5107be)});}}}emlformat['build'](_0x3f5320,function(_0x4d43e9,_0x403dd7){if(_0x4d43e9)return _0x77faa8(_0x4d43e9);fs['writeFileSync'](path[_0x2040('0x61')](_0x1c7239,_0x4e2418),_0x403dd7);return _0x49849b(_0x403dd7);});});}})['then'](function(_0x1f0f74){if(_0x1f0f74){return _0x55a05a['download'](path[_0x2040('0x61')](_0x1c7239,_0x4e2418),_0x4e2418,function(_0x25860e){if(!_0x25860e)fs[_0x2040('0xa2')](path[_0x2040('0x61')](_0x1c7239,_0x4e2418));});}})['catch'](handleError(_0x55a05a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 82c910d..b207450 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 _0xb56b=['update','remove','emit','hasOwnProperty','hook','exports','MailMessage','setMaxListeners','save'];(function(_0x2fb68e,_0x179697){var _0x4b33ef=function(_0x421103){while(--_0x421103){_0x2fb68e['push'](_0x2fb68e['shift']());}};_0x4b33ef(++_0x179697);}(_0xb56b,0x1b6));var _0xbb56=function(_0x1a5ad1,_0x357407){_0x1a5ad1=_0x1a5ad1-0x0;var _0x7b8b22=_0xb56b[_0x1a5ad1];return _0x7b8b22;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0xbb56('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xbb56('0x1')](0x0);var events={'afterCreate':_0xbb56('0x2'),'afterUpdate':_0xbb56('0x3'),'afterDestroy':_0xbb56('0x4')};function emitEvent(_0x1da894){return function(_0x37fa67,_0x3b884f,_0x1693d9){MailMessageEvents[_0xbb56('0x5')](_0x1da894+':'+_0x37fa67['id'],_0x37fa67);MailMessageEvents[_0xbb56('0x5')](_0x1da894,_0x37fa67);_0x1693d9(null);};}for(var e in events){if(events[_0xbb56('0x6')](e)){var event=events[e];MailMessage[_0xbb56('0x7')](e,emitEvent(event));}}module[_0xbb56('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x6193=['../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0xa1be4f,_0x10a675){var _0x25bcce=function(_0x2523da){while(--_0x2523da){_0xa1be4f['push'](_0xa1be4f['shift']());}};_0x25bcce(++_0x10a675);}(_0x6193,0x143));var _0x3619=function(_0x6ecd04,_0x5c9e1a){_0x6ecd04=_0x6ecd04-0x0;var _0x5574d7=_0x6193[_0x6ecd04];return _0x5574d7;};'use strict';var EventEmitter=require(_0x3619('0x0'));var MailMessage=require(_0x3619('0x1'))['db'][_0x3619('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x3619('0x3')](0x0);var events={'afterCreate':_0x3619('0x4'),'afterUpdate':'update','afterDestroy':_0x3619('0x5')};function emitEvent(_0x2e8b93){return function(_0x2c217f,_0x25a53b,_0x4fce37){MailMessageEvents[_0x3619('0x6')](_0x2e8b93+':'+_0x2c217f['id'],_0x2c217f);MailMessageEvents['emit'](_0x2e8b93,_0x2c217f);_0x4fce37(null);};}for(var e in events){if(events[_0x3619('0x7')](e)){var event=events[e];MailMessage[_0x3619('0x8')](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 b6aec82..0e14b28 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 _0x346b=['exports','define','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes'];(function(_0x58ea0,_0x5222aa){var _0x165136=function(_0x49148f){while(--_0x49148f){_0x58ea0['push'](_0x58ea0['shift']());}};_0x165136(++_0x5222aa);}(_0x346b,0x1c9));var _0xb346=function(_0x3f8d80,_0x3837e2){_0x3f8d80=_0x3f8d80-0x0;var _0x15e982=_0x346b[_0x3f8d80];return _0x15e982;};'use strict';var _=require(_0xb346('0x0'));var util=require(_0xb346('0x1'));var logger=require(_0xb346('0x2'))(_0xb346('0x3'));var moment=require('moment');var BPromise=require(_0xb346('0x4'));var rp=require(_0xb346('0x5'));var htmlToText=require(_0xb346('0x6'));var fs=require('fs');var path=require(_0xb346('0x7'));var rimraf=require(_0xb346('0x8'));var config=require(_0xb346('0x9'));var attributes=require(_0xb346('0xa'));module[_0xb346('0xb')]=function(_0x4853be,_0x53d72a){return _0x4853be[_0xb346('0xc')]('MailMessage',attributes,{'tableName':_0xb346('0xd'),'paranoid':![],'indexes':[{'name':_0xb346('0xe'),'fields':[_0xb346('0xe')]},{'name':_0xb346('0xf'),'fields':['plainBody',_0xb346('0x10')],'type':_0xb346('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1c1664,_0x87950a,_0xe3a495){if(_0x1c1664[_0xb346('0x12')]){_0x1c1664[_0xb346('0x13')]=htmlToText[_0xb346('0x14')](_0x1c1664[_0xb346('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xe3a495(null,_0x87950a);},'afterCreate':function(_0x38d916,_0x478032,_0x2c182a){var _0x504b94=_0x4853be[_0xb346('0x15')];var _0x37d4c1=_0x38d916[_0xb346('0x16')]({'plain':!![]});if(_0x37d4c1[_0xb346('0x17')][_0xb346('0x18')]()==='in'||_0x37d4c1[_0xb346('0x17')][_0xb346('0x18')]()===_0xb346('0x19')&&!_0x37d4c1[_0xb346('0x1a')]&&!_[_0xb346('0x1b')](_0x37d4c1[_0xb346('0x1c')])){_0x504b94['MailInteraction'][_0xb346('0x1d')]({'where':{'id':_0x37d4c1[_0xb346('0x1e')]}})[_0xb346('0x1f')](function(_0x528a2d){if(_0x528a2d){_0x528a2d[_0xb346('0x20')]({'lastMsgAt':_0x37d4c1[_0xb346('0x21')],'lastMsgDirection':_0x37d4c1[_0xb346('0x17')]['toLowerCase']()});}})['catch'](function(_0x3c9201){console[_0xb346('0x22')](_0x3c9201);});}_0x2c182a();}},'charset':_0xb346('0x23'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc3ca=['rimraf','../../config/environment','./mailMessage.attributes','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x7629e,_0x40c972){var _0x19569b=function(_0xa62841){while(--_0xa62841){_0x7629e['push'](_0x7629e['shift']());}};_0x19569b(++_0x40c972);}(_0xc3ca,0xee));var _0xac3c=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc3ca[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xac3c('0x0'));var util=require(_0xac3c('0x1'));var logger=require('../../config/logger')(_0xac3c('0x2'));var moment=require(_0xac3c('0x3'));var BPromise=require(_0xac3c('0x4'));var rp=require(_0xac3c('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xac3c('0x6'));var rimraf=require(_0xac3c('0x7'));var config=require(_0xac3c('0x8'));var attributes=require(_0xac3c('0x9'));module['exports']=function(_0x233763,_0x569260){return _0x233763['define'](_0xac3c('0xa'),attributes,{'tableName':_0xac3c('0xb'),'paranoid':![],'indexes':[{'name':_0xac3c('0xc'),'fields':[_0xac3c('0xc')]},{'name':_0xac3c('0xd'),'fields':[_0xac3c('0xe'),_0xac3c('0xf')],'type':_0xac3c('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f5c7b,_0x2fe3a0,_0xae249d){if(_0x4f5c7b[_0xac3c('0x11')]){_0x4f5c7b[_0xac3c('0xe')]=htmlToText['fromString'](_0x4f5c7b[_0xac3c('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xae249d(null,_0x2fe3a0);},'afterCreate':function(_0x2f21e0,_0x5f0518,_0x8a8fe4){var _0x29fa92=_0x233763[_0xac3c('0x12')];var _0x58698b=_0x2f21e0[_0xac3c('0x13')]({'plain':!![]});if(_0x58698b[_0xac3c('0x14')][_0xac3c('0x15')]()==='in'||_0x58698b[_0xac3c('0x14')][_0xac3c('0x15')]()===_0xac3c('0x16')&&!_0x58698b[_0xac3c('0x17')]&&!_[_0xac3c('0x18')](_0x58698b[_0xac3c('0x19')])){_0x29fa92[_0xac3c('0x1a')][_0xac3c('0x1b')]({'where':{'id':_0x58698b[_0xac3c('0x1c')]}})[_0xac3c('0x1d')](function(_0x3b51ff){if(_0x3b51ff){_0x3b51ff[_0xac3c('0x1e')]({'lastMsgAt':_0x58698b[_0xac3c('0x1f')],'lastMsgDirection':_0x58698b[_0xac3c('0x14')][_0xac3c('0x15')]()});}})[_0xac3c('0x20')](function(_0x1f649c){console[_0xac3c('0x21')](_0x1f649c);});}_0x8a8fe4();}},'charset':'utf8mb4','collate':_0xac3c('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 9a0d519..37b4398 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 _0x8f59=['redis','localhost','socket.io-emitter','register','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','catch','create','body','options','raw','then','CreateMailMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x410d6b,_0x16e343){var _0x48ee53=function(_0x2dbee6){while(--_0x2dbee6){_0x410d6b['push'](_0x410d6b['shift']());}};_0x48ee53(++_0x16e343);}(_0x8f59,0x11d));var _0x98f5=function(_0x47698e,_0x4224d6){_0x47698e=_0x47698e-0x0;var _0x4600dd=_0x8f59[_0x47698e];return _0x4600dd;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});config[_0x98f5('0xc')]=_['defaults'](config['redis'],{'host':_0x98f5('0xd'),'port':0x18eb});var socket=require(_0x98f5('0xe'))(new Redis(config[_0x98f5('0xc')]));require('./mailMessage.socket')[_0x98f5('0xf')](socket);function respondWithRpcPromise(_0x31b669,_0x227cf3,_0x39e85d){return new BPromise(function(_0x4c4abc,_0x26a0fc){return client['request'](_0x31b669,_0x39e85d)['then'](function(_0x3cf4b2){logger[_0x98f5('0x10')]('MailMessage,\x20%s,\x20%s',_0x227cf3,_0x98f5('0x11'));logger[_0x98f5('0x12')](_0x98f5('0x13'),_0x227cf3,_0x98f5('0x11'),JSON[_0x98f5('0x14')](_0x3cf4b2));if(_0x3cf4b2[_0x98f5('0x15')]){if(_0x3cf4b2['error'][_0x98f5('0x16')]===0x1f4){logger[_0x98f5('0x15')]('MailMessage,\x20%s,\x20%s',_0x227cf3,_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);return _0x26a0fc(_0x3cf4b2[_0x98f5('0x15')]['message']);}logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x3cf4b2[_0x98f5('0x15')]['message']);return _0x4c4abc(_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);}else{logger['info'](_0x98f5('0x18'),_0x227cf3,'request\x20sent');_0x4c4abc(_0x3cf4b2[_0x98f5('0x19')][_0x98f5('0x17')]);}})[_0x98f5('0x1a')](function(_0x11b6d4){logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x11b6d4);_0x26a0fc(_0x11b6d4);});});}exports['CreateMailMessage']=function(_0xf88f34){var _0x5500a2=this;return new Promise(function(_0xd1209d,_0x191f23){return db['MailMessage'][_0x98f5('0x1b')](_0xf88f34[_0x98f5('0x1c')],{'raw':_0xf88f34[_0x98f5('0x1d')]?_0xf88f34[_0x98f5('0x1d')][_0x98f5('0x1e')]===undefined?!![]:![]:!![]})[_0x98f5('0x1f')](function(_0x38b46d){logger['info'](_0x98f5('0x20'),_0xf88f34);logger['debug'](_0x98f5('0x20'),_0xf88f34,JSON['stringify'](_0x38b46d));_0xd1209d(_0x38b46d);})[_0x98f5('0x1a')](function(_0x40c69b){logger[_0x98f5('0x15')](_0x98f5('0x20'),_0x40c69b[_0x98f5('0x17')],_0xf88f34);_0x191f23(_0x5500a2[_0x98f5('0x15')](0x1f4,_0x40c69b[_0x98f5('0x17')]));});});}; \ No newline at end of file +var _0x160f=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf160('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf160('0xd'))[_0xf160('0xe')](socket);function respondWithRpcPromise(_0x393f70,_0x2736b8,_0x5e09c6){return new BPromise(function(_0x4a0639,_0xf8ec3d){return client[_0xf160('0xf')](_0x393f70,_0x5e09c6)[_0xf160('0x10')](function(_0x56072f){logger[_0xf160('0x11')](_0xf160('0x12'),_0x2736b8,_0xf160('0x13'));logger[_0xf160('0x14')](_0xf160('0x15'),_0x2736b8,'request\x20sent',JSON[_0xf160('0x16')](_0x56072f));if(_0x56072f['error']){if(_0x56072f[_0xf160('0x17')][_0xf160('0x18')]===0x1f4){logger[_0xf160('0x17')](_0xf160('0x12'),_0x2736b8,_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);return _0xf8ec3d(_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);}logger[_0xf160('0x17')]('MailMessage,\x20%s,\x20%s',_0x2736b8,_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);return _0x4a0639(_0x56072f[_0xf160('0x17')][_0xf160('0x19')]);}else{logger['info'](_0xf160('0x12'),_0x2736b8,'request\x20sent');_0x4a0639(_0x56072f[_0xf160('0x1a')][_0xf160('0x19')]);}})[_0xf160('0x1b')](function(_0x1e09f3){logger[_0xf160('0x17')](_0xf160('0x12'),_0x2736b8,_0x1e09f3);_0xf8ec3d(_0x1e09f3);});});}exports[_0xf160('0x1c')]=function(_0x2a8cb4){var _0x1fdb38=this;return new Promise(function(_0x4a58d9,_0x40ccf0){return db[_0xf160('0x1d')][_0xf160('0x1e')](_0x2a8cb4['body'],{'raw':_0x2a8cb4[_0xf160('0x1f')]?_0x2a8cb4[_0xf160('0x1f')][_0xf160('0x20')]===undefined?!![]:![]:!![]})[_0xf160('0x10')](function(_0x2e03c8){logger[_0xf160('0x11')](_0xf160('0x1c'),_0x2a8cb4);logger['debug'](_0xf160('0x1c'),_0x2a8cb4,JSON[_0xf160('0x16')](_0x2e03c8));_0x4a58d9(_0x2e03c8);})[_0xf160('0x1b')](function(_0x49bb5c){logger['error'](_0xf160('0x1c'),_0x49bb5c[_0xf160('0x19')],_0x2a8cb4);_0x40ccf0(_0x1fdb38['error'](0x1f4,_0x49bb5c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7a8689c..f2a1b45 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 _0x1f39=['remove','update','mailMessage:','./mailMessage.events'];(function(_0x453fc7,_0x2724db){var _0x33e613=function(_0x4019d5){while(--_0x4019d5){_0x453fc7['push'](_0x453fc7['shift']());}};_0x33e613(++_0x2724db);}(_0x1f39,0x1bf));var _0x91f3=function(_0x19796e,_0x3fdd9b){_0x19796e=_0x19796e-0x0;var _0x18932d=_0x1f39[_0x19796e];return _0x18932d;};'use strict';var MailMessageEvents=require(_0x91f3('0x0'));var events=['save',_0x91f3('0x1'),_0x91f3('0x2')];function createListener(_0x249eb3,_0x2cb506){return function(_0x11716f){_0x2cb506['emit'](_0x249eb3,_0x11716f);};}function removeListener(_0x1f1969,_0x7e7141){return function(){MailMessageEvents['removeListener'](_0x1f1969,_0x7e7141);};}exports['register']=function(_0x58d4f6){for(var _0x2af5f4=0x0,_0x94ff60=events['length'];_0x2af5f4<_0x94ff60;_0x2af5f4++){var _0x2b9e64=events[_0x2af5f4];var _0x1e2eae=createListener(_0x91f3('0x3')+_0x2b9e64,_0x58d4f6);MailMessageEvents['on'](_0x2b9e64,_0x1e2eae);}}; \ No newline at end of file +var _0x851d=['./mailMessage.events','remove','update','emit','removeListener','length','mailMessage:'];(function(_0x2fd257,_0x26f8c0){var _0x5f3480=function(_0x16bf5c){while(--_0x16bf5c){_0x2fd257['push'](_0x2fd257['shift']());}};_0x5f3480(++_0x26f8c0);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require(_0xd851('0x0'));var events=['save',_0xd851('0x1'),_0xd851('0x2')];function createListener(_0x4c3a8c,_0x384e44){return function(_0x16201e){_0x384e44[_0xd851('0x3')](_0x4c3a8c,_0x16201e);};}function removeListener(_0x265b0e,_0x36eb20){return function(){MailMessageEvents[_0xd851('0x4')](_0x265b0e,_0x36eb20);};}exports['register']=function(_0x578809){for(var _0x1fff93=0x0,_0x2b63e4=events[_0xd851('0x5')];_0x1fff93<_0x2b63e4;_0x1fff93++){var _0x2f9540=events[_0x1fff93];var _0x60bef0=createListener(_0xd851('0x6')+_0x2f9540,_0x578809);MailMessageEvents['on'](_0x2f9540,_0x60bef0);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 6cbafec..d0c3309 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 _0x0631=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x11a3f0,_0x3a6e5a){var _0x15555b=function(_0x3c620c){while(--_0x3c620c){_0x11a3f0['push'](_0x11a3f0['shift']());}};_0x15555b(++_0x3a6e5a);}(_0x0631,0x196));var _0x1063=function(_0x54cd98,_0x3029e6){_0x54cd98=_0x54cd98-0x0;var _0x4abd09=_0x0631[_0x54cd98];return _0x4abd09;};'use strict';var multer=require(_0x1063('0x0'));var util=require('util');var path=require(_0x1063('0x1'));var timeout=require(_0x1063('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1063('0x3'));var auth=require(_0x1063('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1063('0x5'));var controller=require(_0x1063('0x6'));router[_0x1063('0x7')]('/',auth['isAuthenticated'](),controller[_0x1063('0x8')]);router['get'](_0x1063('0x9'),auth[_0x1063('0xa')](),controller[_0x1063('0xb')]);router[_0x1063('0x7')](_0x1063('0xc'),auth[_0x1063('0xa')](),controller[_0x1063('0xd')]);router['get'](_0x1063('0xe'),auth['isAuthenticated'](),controller[_0x1063('0xf')]);router['get'](_0x1063('0x10'),auth[_0x1063('0xa')](),controller[_0x1063('0x11')]);router['get'](_0x1063('0x12'),auth[_0x1063('0xa')](),controller[_0x1063('0x13')]);router[_0x1063('0x14')]('/',auth['isAuthenticated'](),controller[_0x1063('0x15')]);router['post'](_0x1063('0x10'),auth[_0x1063('0xa')](),controller[_0x1063('0x16')]);router[_0x1063('0x14')](_0x1063('0x12'),auth[_0x1063('0xa')](),controller['addAgents']);router['put'](_0x1063('0xc'),auth[_0x1063('0xa')](),controller[_0x1063('0x17')]);router[_0x1063('0x18')](_0x1063('0xc'),auth[_0x1063('0xa')](),controller[_0x1063('0x19')]);router[_0x1063('0x18')](_0x1063('0x10'),auth[_0x1063('0xa')](),controller[_0x1063('0x1a')]);router[_0x1063('0x18')]('/:id/users',auth[_0x1063('0xa')](),controller[_0x1063('0x1b')]);module[_0x1063('0x1c')]=router; \ No newline at end of file +var _0x9427=['/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x47ac36,_0xd03b1e){var _0x250b59=function(_0xc88d90){while(--_0xc88d90){_0x47ac36['push'](_0x47ac36['shift']());}};_0x250b59(++_0xd03b1e);}(_0x9427,0x1cb));var _0x7942=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9427[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0x7942('0x0'));var path=require('path');var timeout=require(_0x7942('0x1'));var express=require('express');var router=express[_0x7942('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7942('0x3'));var interaction=require(_0x7942('0x4'));var config=require(_0x7942('0x5'));var controller=require(_0x7942('0x6'));router[_0x7942('0x7')]('/',auth[_0x7942('0x8')](),controller[_0x7942('0x9')]);router[_0x7942('0x7')](_0x7942('0xa'),auth[_0x7942('0x8')](),controller[_0x7942('0xb')]);router[_0x7942('0x7')](_0x7942('0xc'),auth['isAuthenticated'](),controller[_0x7942('0xd')]);router[_0x7942('0x7')](_0x7942('0xe'),auth[_0x7942('0x8')](),controller[_0x7942('0xf')]);router[_0x7942('0x7')](_0x7942('0x10'),auth[_0x7942('0x8')](),controller['getTeams']);router[_0x7942('0x7')](_0x7942('0x11'),auth[_0x7942('0x8')](),controller[_0x7942('0x12')]);router[_0x7942('0x13')]('/',auth[_0x7942('0x8')](),controller['create']);router[_0x7942('0x13')](_0x7942('0x10'),auth[_0x7942('0x8')](),controller['addTeams']);router['post'](_0x7942('0x11'),auth[_0x7942('0x8')](),controller[_0x7942('0x14')]);router[_0x7942('0x15')](_0x7942('0xc'),auth[_0x7942('0x8')](),controller[_0x7942('0x16')]);router[_0x7942('0x17')]('/:id',auth[_0x7942('0x8')](),controller[_0x7942('0x18')]);router[_0x7942('0x17')]('/:id/teams',auth[_0x7942('0x8')](),controller[_0x7942('0x19')]);router[_0x7942('0x17')](_0x7942('0x11'),auth[_0x7942('0x8')](),controller[_0x7942('0x1a')]);module[_0x7942('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 0275a7f..c84ba83 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 _0x3144=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3144,0xfc));var _0x4314=function(_0xe10467,_0x153021){_0xe10467=_0xe10467-0x0;var _0x8eeab9=_0x3144[_0xe10467];return _0x8eeab9;};'use strict';var Sequelize=require(_0x4314('0x0'));module[_0x4314('0x1')]={'name':{'type':Sequelize[_0x4314('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4314('0x2')]},'timeout':{'type':Sequelize[_0x4314('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4314('0x4')](_0x4314('0x5'),'beepall',_0x4314('0x6'))}}; \ No newline at end of file +var _0x52d9=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x249e96,_0x3ea39d){var _0x17444c=function(_0x1221d0){while(--_0x1221d0){_0x249e96['push'](_0x249e96['shift']());}};_0x17444c(++_0x3ea39d);}(_0x52d9,0x1b8));var _0x952d=function(_0x5945d3,_0x42c4a1){_0x5945d3=_0x5945d3-0x0;var _0xe3819a=_0x52d9[_0x5945d3];return _0xe3819a;};'use strict';var Sequelize=require('sequelize');module[_0x952d('0x0')]={'name':{'type':Sequelize[_0x952d('0x1')],'unique':_0x952d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x952d('0x1')]},'timeout':{'type':Sequelize[_0x952d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x952d('0x4')](_0x952d('0x5'),_0x952d('0x6'),_0x952d('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 087c4ce..7444f78 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 _0x1be9=['to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','MailQueue','includeAll','catch','show','params','length','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','MailQueues','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserMailQueue','order','MailQueueId','findAll','UserId','mailPause','updatedAt','%s/%s','SIP','Team','getTeams','ids','User','Agents','interface','sequelize','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js'];(function(_0xee3051,_0xbe4f18){var _0x139e81=function(_0xac81c3){while(--_0xac81c3){_0xee3051['push'](_0xee3051['shift']());}};_0x139e81(++_0xbe4f18);}(_0x1be9,0x77));var _0x91be=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x1be9[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0x91be('0x0'));var rimraf=require(_0x91be('0x1'));var zipdir=require(_0x91be('0x2'));var jsonpatch=require(_0x91be('0x3'));var rp=require('request-promise');var moment=require(_0x91be('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91be('0x5'));var util=require(_0x91be('0x6'));var path=require(_0x91be('0x7'));var sox=require(_0x91be('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91be('0x9'));var _=require(_0x91be('0xa'));var squel=require(_0x91be('0xb'));var crypto=require(_0x91be('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x91be('0xd'));var toCsv=require(_0x91be('0xe'));var querystring=require(_0x91be('0xf'));var Papa=require('papaparse');var Redis=require(_0x91be('0x10'));var authService=require(_0x91be('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91be('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x91be('0x13'));var config=require(_0x91be('0x14'));var licenseUtil=require(_0x91be('0x15'));var db=require(_0x91be('0x16'))['db'];config[_0x91be('0x17')]=_[_0x91be('0x18')](config[_0x91be('0x17')],{'host':_0x91be('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91be('0x17')]));require(_0x91be('0x1a'))[_0x91be('0x1b')](socket);function respondWithStatusCode(_0x27186d,_0x36a103){_0x36a103=_0x36a103||0xcc;return function(_0xb7849e){if(_0xb7849e){return _0x27186d[_0x91be('0x1c')](_0x36a103);}return _0x27186d[_0x91be('0x1d')](_0x36a103)[_0x91be('0x1e')]();};}function respondWithResult(_0x2af163,_0x40a37b){_0x40a37b=_0x40a37b||0xc8;return function(_0x55c517){if(_0x55c517){return _0x2af163['status'](_0x40a37b)['json'](_0x55c517);}};}function respondWithFilteredResult(_0x5ec52c,_0x3012c5){return function(_0x3230a2){if(_0x3230a2){var _0x4b47c5=typeof _0x3012c5[_0x91be('0x1f')]===_0x91be('0x20')&&typeof _0x3012c5[_0x91be('0x21')]==='undefined';var _0x16cc8f=_0x3230a2[_0x91be('0x22')];var _0x1a3592=_0x4b47c5?0x0:_0x3012c5[_0x91be('0x1f')];var _0x3f107a=_0x4b47c5?_0x3230a2[_0x91be('0x22')]:_0x3012c5[_0x91be('0x1f')]+_0x3012c5[_0x91be('0x21')];var _0x595c1b;if(_0x3f107a>=_0x16cc8f){_0x3f107a=_0x16cc8f;_0x595c1b=0xc8;}else{_0x595c1b=0xce;}_0x5ec52c[_0x91be('0x1d')](_0x595c1b);return _0x5ec52c[_0x91be('0x23')]('Content-Range',_0x1a3592+'-'+_0x3f107a+'/'+_0x16cc8f)[_0x91be('0x24')](_0x3230a2);}return null;};}function patchUpdates(_0x5a2d07){return function(_0x1fc15a){try{jsonpatch['apply'](_0x1fc15a,_0x5a2d07,!![]);}catch(_0x509d09){return BPromise['reject'](_0x509d09);}return _0x1fc15a[_0x91be('0x25')]();};}function saveUpdates(_0x7dbfd0,_0x1cca98){return function(_0x2b8e7b){if(_0x2b8e7b){return _0x2b8e7b[_0x91be('0x26')](_0x7dbfd0)[_0x91be('0x27')](function(_0x11c2c0){return _0x11c2c0;});}return null;};}function removeEntity(_0x49b4a1,_0x546bd5){return function(_0x531b8d){if(_0x531b8d){return _0x531b8d[_0x91be('0x28')]()[_0x91be('0x27')](function(){var _0x497c29=_0x531b8d['get']({'plain':!![]});var _0x251774='MailQueues';return db[_0x91be('0x29')][_0x91be('0x28')]({'where':{'type':_0x251774,'resourceId':_0x497c29['id']}})[_0x91be('0x27')](function(){return _0x531b8d;});})[_0x91be('0x27')](function(){_0x49b4a1[_0x91be('0x1d')](0xcc)[_0x91be('0x1e')]();});}};}function handleEntityNotFound(_0x44f091,_0x2a3b12){return function(_0x497a46){if(!_0x497a46){_0x44f091['sendStatus'](0x194);}return _0x497a46;};}function handleError(_0x2b806f,_0x5cd768){_0x5cd768=_0x5cd768||0x1f4;return function(_0x4ad7b1){logger[_0x91be('0x2a')](_0x4ad7b1[_0x91be('0x2b')]);if(_0x4ad7b1[_0x91be('0x2c')]){delete _0x4ad7b1[_0x91be('0x2c')];}_0x2b806f[_0x91be('0x1d')](_0x5cd768)[_0x91be('0x2d')](_0x4ad7b1);};}exports[_0x91be('0x2e')]=function(_0x235ae8,_0x3b1677){var _0x57b6f9={},_0x2ffe05={},_0x21ef6f={'count':0x0,'rows':[]};var _0x76ce4d=_[_0x91be('0x2f')](db['MailQueue'][_0x91be('0x30')],function(_0x45f2bc){return{'name':_0x45f2bc[_0x91be('0x31')],'type':_0x45f2bc[_0x91be('0x32')][_0x91be('0x33')]};});_0x2ffe05[_0x91be('0x34')]=_[_0x91be('0x2f')](_0x76ce4d,_0x91be('0x2c'));_0x2ffe05['query']=_[_0x91be('0x35')](_0x235ae8['query']);_0x2ffe05['filters']=_[_0x91be('0x36')](_0x2ffe05['model'],_0x2ffe05[_0x91be('0x37')]);_0x57b6f9[_0x91be('0x38')]=_[_0x91be('0x36')](_0x2ffe05['model'],qs[_0x91be('0x39')](_0x235ae8['query'][_0x91be('0x39')]));_0x57b6f9[_0x91be('0x38')]=_0x57b6f9['attributes']['length']?_0x57b6f9[_0x91be('0x38')]:_0x2ffe05[_0x91be('0x34')];if(!_0x235ae8[_0x91be('0x37')][_0x91be('0x3a')](_0x91be('0x3b'))){_0x57b6f9[_0x91be('0x21')]=qs['limit'](_0x235ae8[_0x91be('0x37')][_0x91be('0x21')]);_0x57b6f9[_0x91be('0x1f')]=qs[_0x91be('0x1f')](_0x235ae8['query'][_0x91be('0x1f')]);}_0x57b6f9['order']=qs[_0x91be('0x3c')](_0x235ae8[_0x91be('0x37')][_0x91be('0x3c')]);_0x57b6f9['where']=qs[_0x91be('0x3d')](_[_0x91be('0x3e')](_0x235ae8[_0x91be('0x37')],_0x2ffe05[_0x91be('0x3d')]),_0x76ce4d);if(_0x235ae8[_0x91be('0x37')][_0x91be('0x3f')]){_0x57b6f9['where']=_[_0x91be('0x40')](_0x57b6f9[_0x91be('0x41')],{'$or':_['map'](_0x76ce4d,function(_0x4af435){if(_0x4af435['type']!==_0x91be('0x42')){var _0x28f825={};_0x28f825[_0x4af435[_0x91be('0x2c')]]={'$like':'%'+_0x235ae8[_0x91be('0x37')][_0x91be('0x3f')]+'%'};return _0x28f825;}})});}_0x57b6f9=_['merge']({},_0x57b6f9,_0x235ae8[_0x91be('0x43')]);var _0x217899={'where':_0x57b6f9[_0x91be('0x41')]};return db[_0x91be('0x44')][_0x91be('0x22')](_0x217899)[_0x91be('0x27')](function(_0x4b8bca){_0x21ef6f[_0x91be('0x22')]=_0x4b8bca;if(_0x235ae8[_0x91be('0x37')][_0x91be('0x45')]){_0x57b6f9['include']=[{'all':!![]}];}return db[_0x91be('0x44')]['findAll'](_0x57b6f9);})[_0x91be('0x27')](function(_0x3d6033){_0x21ef6f['rows']=_0x3d6033;return _0x21ef6f;})[_0x91be('0x27')](respondWithFilteredResult(_0x3b1677,_0x57b6f9))[_0x91be('0x46')](handleError(_0x3b1677,null));};exports[_0x91be('0x47')]=function(_0x2b8f6f,_0x117245){var _0x2cb05b={'raw':!![],'where':{'id':_0x2b8f6f[_0x91be('0x48')]['id']}},_0xb59730={};_0xb59730[_0x91be('0x34')]=_['keys'](db[_0x91be('0x44')][_0x91be('0x30')]);_0xb59730['query']=_[_0x91be('0x35')](_0x2b8f6f[_0x91be('0x37')]);_0xb59730[_0x91be('0x3d')]=_[_0x91be('0x36')](_0xb59730[_0x91be('0x34')],_0xb59730[_0x91be('0x37')]);_0x2cb05b[_0x91be('0x38')]=_[_0x91be('0x36')](_0xb59730[_0x91be('0x34')],qs[_0x91be('0x39')](_0x2b8f6f[_0x91be('0x37')][_0x91be('0x39')]));_0x2cb05b['attributes']=_0x2cb05b[_0x91be('0x38')][_0x91be('0x49')]?_0x2cb05b[_0x91be('0x38')]:_0xb59730[_0x91be('0x34')];if(_0x2b8f6f['query']['includeAll']){_0x2cb05b[_0x91be('0x4a')]=[{'all':!![]}];}_0x2cb05b=_[_0x91be('0x40')]({},_0x2cb05b,_0x2b8f6f['options']);return db[_0x91be('0x44')]['find'](_0x2cb05b)[_0x91be('0x27')](handleEntityNotFound(_0x117245,null))[_0x91be('0x27')](respondWithResult(_0x117245,null))[_0x91be('0x46')](handleError(_0x117245,null));};exports['create']=function(_0x5b0294,_0x4449d8){return db['MailQueue'][_0x91be('0x4b')](_0x5b0294['body'],{})[_0x91be('0x27')](function(_0x1a3517){var _0x156db0=_0x5b0294['user']['get']({'plain':!![]});if(!_0x156db0)throw new Error(_0x91be('0x4c'));if(_0x156db0['role']===_0x91be('0x4d')){var _0x44ac7f=_0x1a3517[_0x91be('0x4e')]({'plain':!![]});var _0x976646=_0x91be('0x4f');return db['UserProfileSection'][_0x91be('0x50')]({'where':{'name':_0x976646,'userProfileId':_0x156db0['userProfileId']},'raw':!![]})[_0x91be('0x27')](function(_0x298f94){if(_0x298f94&&_0x298f94['autoAssociation']===0x0){return db[_0x91be('0x29')]['create']({'name':_0x44ac7f[_0x91be('0x2c')],'resourceId':_0x44ac7f['id'],'type':_0x298f94[_0x91be('0x2c')],'sectionId':_0x298f94['id']},{})['then'](function(){return _0x1a3517;});}else{return _0x1a3517;}})['catch'](function(_0x14317b){logger[_0x91be('0x2a')](_0x91be('0x51'),_0x14317b);throw _0x14317b;});}return _0x1a3517;})['then'](respondWithResult(_0x4449d8,0xc9))['catch'](handleError(_0x4449d8,null));};exports[_0x91be('0x26')]=function(_0x2b37c7,_0x357729){if(_0x2b37c7[_0x91be('0x52')]['id']){delete _0x2b37c7[_0x91be('0x52')]['id'];}return db['MailQueue'][_0x91be('0x50')]({'where':{'id':_0x2b37c7[_0x91be('0x48')]['id']}})[_0x91be('0x27')](handleEntityNotFound(_0x357729,null))[_0x91be('0x27')](saveUpdates(_0x2b37c7[_0x91be('0x52')],null))[_0x91be('0x27')](respondWithResult(_0x357729,null))['catch'](handleError(_0x357729,null));};exports[_0x91be('0x28')]=function(_0x53b92c,_0x22dc91){return db[_0x91be('0x44')][_0x91be('0x50')]({'where':{'id':_0x53b92c[_0x91be('0x48')]['id']}})['then'](handleEntityNotFound(_0x22dc91,null))[_0x91be('0x27')](removeEntity(_0x22dc91,null))[_0x91be('0x46')](handleError(_0x22dc91,null));};exports['describe']=function(_0x46861c,_0x5ae784){return db[_0x91be('0x44')][_0x91be('0x53')]()['then'](respondWithResult(_0x5ae784,null))[_0x91be('0x46')](handleError(_0x5ae784,null));};exports['getMembers']=function(_0xe3de72,_0x590598,_0x11ab34){var _0x1f0bec={'raw':!![],'where':{}},_0xff3328={},_0x14ced5;return db[_0x91be('0x44')][_0x91be('0x54')]({'where':{'id':_0xe3de72[_0x91be('0x48')]['id']}})['then'](handleEntityNotFound(_0x590598,null))['then'](function(_0x3af7db){if(_0x3af7db){_0x14ced5=_0x3af7db[_0x91be('0x4e')]({'plain':!![]});_0xff3328[_0x91be('0x34')]=_[_0x91be('0x35')](db[_0x91be('0x55')][_0x91be('0x30')]);_0xff3328[_0x91be('0x37')]=_[_0x91be('0x35')](_0xe3de72[_0x91be('0x37')]);_0xff3328['filters']=_[_0x91be('0x36')](_0xff3328[_0x91be('0x34')],_0xff3328['query']);_0x1f0bec[_0x91be('0x38')]=_['intersection'](_0xff3328[_0x91be('0x34')],qs['fields'](_0xe3de72[_0x91be('0x37')][_0x91be('0x39')]));_0x1f0bec[_0x91be('0x38')]=_0x1f0bec[_0x91be('0x38')][_0x91be('0x49')]?_0x1f0bec[_0x91be('0x38')]:_0xff3328[_0x91be('0x34')];if(!_0xe3de72['query']['hasOwnProperty'](_0x91be('0x3b'))){_0x1f0bec[_0x91be('0x21')]=qs[_0x91be('0x21')](_0xe3de72[_0x91be('0x37')]['limit']);_0x1f0bec['offset']=qs['offset'](_0xe3de72[_0x91be('0x37')][_0x91be('0x1f')]);}_0x1f0bec[_0x91be('0x56')]=qs[_0x91be('0x3c')](_0xe3de72[_0x91be('0x37')]['sort']);_0x1f0bec[_0x91be('0x41')]=qs[_0x91be('0x3d')](_[_0x91be('0x3e')](_0xe3de72[_0x91be('0x37')],_0xff3328[_0x91be('0x3d')]));_0x1f0bec[_0x91be('0x41')][_0x91be('0x57')]=_0x3af7db['id'];if(_0xe3de72['query'][_0x91be('0x3f')]){_0x1f0bec[_0x91be('0x41')]=_[_0x91be('0x40')](_0x1f0bec[_0x91be('0x41')],{'$or':_[_0x91be('0x2f')](_0x1f0bec[_0x91be('0x38')],function(_0x317d8f){var _0x16a9dd={};_0x16a9dd[_0x317d8f]={'$like':'%'+_0xe3de72[_0x91be('0x37')][_0x91be('0x3f')]+'%'};return _0x16a9dd;})});}_0x1f0bec=_[_0x91be('0x40')]({},_0x1f0bec,_0xe3de72['options']);return db['UserMailQueue'][_0x91be('0x58')](_0x1f0bec);}})['then'](function(_0x2f549d){if(_0x2f549d){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x2f549d,_0x91be('0x59')),'role':'agent'},'attributes':['id','name',_0x91be('0x5a'),_0x91be('0x5b'),'createdAt']});}})[_0x91be('0x27')](function(_0x5f5de7){if(_0x5f5de7){return{'count':_0x5f5de7[_0x91be('0x22')],'rows':_['map'](_0x5f5de7['rows'],function(_0x3dbdc7){return{'membername':_0x3dbdc7[_0x91be('0x2c')],'UserId':_0x3dbdc7['id'],'queue_name':_0x14ced5[_0x91be('0x2c')],'MailQueueId':_0x14ced5['id'],'interface':util['format'](_0x91be('0x5c'),_0x91be('0x5d'),_0x3dbdc7[_0x91be('0x2c')]),'penalty':0x0,'paused':_0x3dbdc7['mailPause'],'createdAt':_0x3dbdc7['createdAt'],'updatedAt':_0x3dbdc7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x590598,_0x1f0bec))['catch'](handleError(_0x590598,null));};exports['getTeams']=function(_0x5300de,_0x4f9feb,_0x1ddf26){var _0x568f22={};var _0x5865ea={};var _0x5c95d5;var _0xf485df;return db[_0x91be('0x44')][_0x91be('0x54')]({'where':{'id':_0x5300de['params']['id']}})[_0x91be('0x27')](handleEntityNotFound(_0x4f9feb,null))[_0x91be('0x27')](function(_0x74bf7c){if(_0x74bf7c){_0x5c95d5=_0x74bf7c;_0x5865ea[_0x91be('0x34')]=_[_0x91be('0x35')](db[_0x91be('0x5e')][_0x91be('0x30')]);_0x5865ea[_0x91be('0x37')]=_[_0x91be('0x35')](_0x5300de[_0x91be('0x37')]);_0x5865ea['filters']=_[_0x91be('0x36')](_0x5865ea[_0x91be('0x34')],_0x5865ea['query']);_0x568f22[_0x91be('0x38')]=_['intersection'](_0x5865ea['model'],qs[_0x91be('0x39')](_0x5300de[_0x91be('0x37')][_0x91be('0x39')]));_0x568f22[_0x91be('0x38')]=_0x568f22[_0x91be('0x38')]['length']?_0x568f22[_0x91be('0x38')]:_0x5865ea[_0x91be('0x34')];_0x568f22[_0x91be('0x56')]=qs[_0x91be('0x3c')](_0x5300de[_0x91be('0x37')]['sort']);_0x568f22[_0x91be('0x41')]=qs[_0x91be('0x3d')](_[_0x91be('0x3e')](_0x5300de['query'],_0x5865ea['filters']));if(_0x5300de[_0x91be('0x37')][_0x91be('0x3f')]){_0x568f22[_0x91be('0x41')]=_[_0x91be('0x40')](_0x568f22[_0x91be('0x41')],{'$or':_['map'](_0x568f22[_0x91be('0x38')],function(_0x3357ef){var _0x593fdc={};_0x593fdc[_0x3357ef]={'$like':'%'+_0x5300de[_0x91be('0x37')]['filter']+'%'};return _0x593fdc;})});}_0x568f22=_[_0x91be('0x40')]({},_0x568f22,_0x5300de[_0x91be('0x43')]);return _0x5c95d5['getTeams'](_0x568f22);}})[_0x91be('0x27')](function(_0x56f7b7){if(_0x56f7b7){_0xf485df=_0x56f7b7['length'];if(!_0x5300de['query'][_0x91be('0x3a')](_0x91be('0x3b'))){_0x568f22[_0x91be('0x21')]=qs[_0x91be('0x21')](_0x5300de[_0x91be('0x37')]['limit']);_0x568f22['offset']=qs[_0x91be('0x1f')](_0x5300de[_0x91be('0x37')][_0x91be('0x1f')]);}return _0x5c95d5[_0x91be('0x5f')](_0x568f22);}})[_0x91be('0x27')](function(_0x2422d0){if(_0x2422d0){return _0x2422d0?{'count':_0xf485df,'rows':_0x2422d0}:null;}})[_0x91be('0x27')](respondWithResult(_0x4f9feb,null))[_0x91be('0x46')](handleError(_0x4f9feb,null));};exports['addTeams']=function(_0x90ba66,_0x556e33,_0x4fe9f0){var _0x3518fd=_0x90ba66[_0x91be('0x52')][_0x91be('0x60')];return db[_0x91be('0x5e')][_0x91be('0x58')]({'where':{'id':_0x3518fd},'attributes':['id'],'include':[{'model':db[_0x91be('0x61')],'as':_0x91be('0x62'),'attributes':['id',_0x91be('0x2c'),'online','voicePause',_0x91be('0x63')],'raw':!![]}]})[_0x91be('0x27')](function(_0x464613){if(_0x464613){var _0x5afda5=_['flatMap'](_0x464613,function(_0x4434d9){var _0x3d90df=_0x4434d9[_0x91be('0x4e')]({'plain':!![]});return _0x3d90df[_0x91be('0x62')];});return db[_0x91be('0x44')]['find']({'where':{'id':_0x90ba66[_0x91be('0x48')]['id']}})[_0x91be('0x27')](function(_0x32b543){return db[_0x91be('0x64')]['transaction'](function(_0x45a464){return _0x32b543[_0x91be('0x65')](_0x3518fd,{'transaction':_0x45a464})['then'](function(){return BPromise[_0x91be('0x66')](_0x5afda5,function(_0x14b8b3){return db[_0x91be('0x55')][_0x91be('0x67')]({'where':{'UserId':_0x14b8b3['id'],'MailQueueId':_0x90ba66[_0x91be('0x48')]['id']},'transaction':_0x45a464});});})[_0x91be('0x27')](function(){_0x5afda5[_0x91be('0x68')](function(_0xf3743c){socket[_0x91be('0x69')](_0x91be('0x6a'),{'UserId':_0xf3743c['id'],'MailQueueId':_0x32b543['id']});});});});});}})[_0x91be('0x27')](respondWithStatusCode(_0x556e33,null))[_0x91be('0x46')](handleError(_0x556e33,null));};exports['removeTeams']=function(_0x75b30c,_0x4be595,_0x1fdde9){return db[_0x91be('0x5e')]['findAll']({'where':{'id':_0x75b30c[_0x91be('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4be595,null))[_0x91be('0x27')](function(_0x5b6c19){var _0x3b3e5b=_[_0x91be('0x2f')](_0x5b6c19,'id');var _0x50cc1e=[];var _0x17f601=[];var _0x2127cb=squel['select']();_0x2127cb[_0x91be('0x6b')](_0x91be('0x6c'))[_0x91be('0x6d')](_0x91be('0x6e'),'tq')[_0x91be('0x6f')](_0x91be('0x70'),'ut',_0x91be('0x71'))[_0x91be('0x41')](_0x91be('0x72'),_0x75b30c['params']['id']);for(var _0x254ca4=0x0;_0x254ca4<_0x5b6c19['length'];_0x254ca4+=0x1){let _0x41c9cf=_0x5b6c19[_0x254ca4];for(var _0x7e39c8=0x0;_0x7e39c8<_0x41c9cf[_0x91be('0x62')][_0x91be('0x49')];_0x7e39c8+=0x1){let _0x2d5f3a=_0x41c9cf[_0x91be('0x62')][_0x7e39c8];var _0x2239c1=_0x2127cb[_0x91be('0x73')]();_0x2239c1[_0x91be('0x41')](_0x91be('0x74'),_0x2d5f3a['id']);_0x17f601['push'](db[_0x91be('0x64')][_0x91be('0x37')](_0x2239c1[_0x91be('0x75')](),{'type':db[_0x91be('0x64')]['QueryTypes'][_0x91be('0x76')]})['then'](function(_0x19df8a){if(_0x19df8a['length']===0x1){return _0x2d5f3a['id'];}else{var _0x2f193a=_[_0x91be('0x77')](_[_0x91be('0x2f')](_0x19df8a,_0x91be('0x78')),function(_0x45eb6c){return _[_0x91be('0x79')](_0x3b3e5b,_0x45eb6c);});if(_0x2f193a){return _0x2d5f3a['id'];}}}));}}return BPromise[_0x91be('0x7a')](_0x17f601)['then'](function(_0x4a346f){_0x50cc1e=_(_0x50cc1e)[_0x91be('0x7b')](_0x4a346f)['compact']()[_0x91be('0x7c')]();return db[_0x91be('0x44')][_0x91be('0x50')]({'where':{'id':_0x75b30c[_0x91be('0x48')]['id']}})['then'](function(_0x319b01){return db['sequelize']['transaction'](function(_0x58ca8a){return _0x319b01['removeTeams'](_0x75b30c[_0x91be('0x37')][_0x91be('0x60')],{'transaction':_0x58ca8a})[_0x91be('0x27')](function(){if(!_[_0x91be('0x7d')](_0x50cc1e)){return _0x319b01[_0x91be('0x7e')](_0x50cc1e,{'transaction':_0x58ca8a});}})[_0x91be('0x27')](function(){_0x50cc1e[_0x91be('0x68')](function(_0xa3bbfa){socket['emit'](_0x91be('0x7f'),{'UserId':_0xa3bbfa,'MailQueueId':_0x319b01['id']});});});});});});})[_0x91be('0x27')](respondWithStatusCode(_0x4be595,null))['catch'](handleError(_0x4be595,null));};exports[_0x91be('0x80')]=function(_0x49d6b4,_0x97d8f6,_0x259970){return db['MailQueue']['find']({'where':{'id':_0x49d6b4[_0x91be('0x48')]['id']}})['then'](handleEntityNotFound(_0x97d8f6,null))['then'](function(_0x1def2b){if(_0x1def2b){return _0x1def2b[_0x91be('0x80')](_0x49d6b4['body'][_0x91be('0x60')],_[_0x91be('0x81')](_0x49d6b4[_0x91be('0x52')],['ids','id'])||{})[_0x91be('0x82')](function(_0x41e907){for(var _0x40834f=0x0;_0x40834f<_0x49d6b4[_0x91be('0x52')][_0x91be('0x60')][_0x91be('0x49')];_0x40834f+=0x1){socket['emit'](_0x91be('0x6a'),{'UserId':Number(_0x49d6b4[_0x91be('0x52')][_0x91be('0x60')][_0x40834f]),'MailQueueId':Number(_0x49d6b4[_0x91be('0x48')]['id'])});}return _0x41e907;});}})[_0x91be('0x27')](respondWithResult(_0x97d8f6,null))[_0x91be('0x46')](handleError(_0x97d8f6,null));};exports[_0x91be('0x7e')]=function(_0x4072be,_0xbac4fb,_0x260a2d){return db[_0x91be('0x44')][_0x91be('0x50')]({'where':{'id':_0x4072be[_0x91be('0x48')]['id']}})[_0x91be('0x27')](handleEntityNotFound(_0xbac4fb,null))[_0x91be('0x27')](function(_0x44dfc3){if(_0x44dfc3){return _0x44dfc3['removeAgents'](_0x4072be['query']['ids'])[_0x91be('0x27')](function(){if(_[_0x91be('0x83')](_0x4072be[_0x91be('0x37')][_0x91be('0x60')])){for(var _0x4a4f79=0x0;_0x4a4f79<_0x4072be[_0x91be('0x37')][_0x91be('0x60')][_0x91be('0x49')];_0x4a4f79+=0x1){socket['emit'](_0x91be('0x7f'),{'UserId':Number(_0x4072be['query']['ids'][_0x4a4f79]),'MailQueueId':Number(_0x4072be[_0x91be('0x48')]['id'])});}}else{socket[_0x91be('0x69')]('userMailQueue:remove',{'UserId':Number(_0x4072be['query']['ids']),'MailQueueId':Number(_0x4072be[_0x91be('0x48')]['id'])});}});}})[_0x91be('0x27')](respondWithStatusCode(_0xbac4fb,null))[_0x91be('0x46')](handleError(_0xbac4fb,null));};exports['getAgents']=function(_0x496834,_0x3daafd,_0x4f05ea){var _0x339123={};var _0x519172={};var _0x3f22b4;var _0x3215ff;return db[_0x91be('0x44')]['findOne']({'where':{'id':_0x496834['params']['id']}})[_0x91be('0x27')](handleEntityNotFound(_0x3daafd,null))[_0x91be('0x27')](function(_0x1162d2){if(_0x1162d2){_0x3f22b4=_0x1162d2;_0x519172[_0x91be('0x34')]=_['keys'](db[_0x91be('0x61')][_0x91be('0x30')]);_0x519172[_0x91be('0x37')]=_[_0x91be('0x35')](_0x496834['query']);_0x519172['filters']=_['intersection'](_0x519172[_0x91be('0x34')],_0x519172[_0x91be('0x37')]);_0x339123[_0x91be('0x38')]=_[_0x91be('0x36')](_0x519172[_0x91be('0x34')],qs['fields'](_0x496834[_0x91be('0x37')]['fields']));_0x339123[_0x91be('0x38')]=_0x339123[_0x91be('0x38')][_0x91be('0x49')]?_0x339123[_0x91be('0x38')]:_0x519172[_0x91be('0x34')];_0x339123['order']=qs[_0x91be('0x3c')](_0x496834[_0x91be('0x37')][_0x91be('0x3c')]);_0x339123[_0x91be('0x41')]=qs['filters'](_[_0x91be('0x3e')](_0x496834[_0x91be('0x37')],_0x519172[_0x91be('0x3d')]));if(_0x496834[_0x91be('0x37')]['filter']){_0x339123[_0x91be('0x41')]=_[_0x91be('0x40')](_0x339123[_0x91be('0x41')],{'$or':_[_0x91be('0x2f')](_0x339123[_0x91be('0x38')],function(_0x1ac563){var _0x2ff8a0={};_0x2ff8a0[_0x1ac563]={'$like':'%'+_0x496834[_0x91be('0x37')][_0x91be('0x3f')]+'%'};return _0x2ff8a0;})});}_0x339123=_[_0x91be('0x40')]({},_0x339123,_0x496834['options']);return _0x3f22b4[_0x91be('0x84')](_0x339123);}})[_0x91be('0x27')](function(_0x5cbc20){if(_0x5cbc20){_0x3215ff=_0x5cbc20['length'];if(!_0x496834[_0x91be('0x37')][_0x91be('0x3a')](_0x91be('0x3b'))){_0x339123[_0x91be('0x21')]=qs[_0x91be('0x21')](_0x496834[_0x91be('0x37')][_0x91be('0x21')]);_0x339123[_0x91be('0x1f')]=qs[_0x91be('0x1f')](_0x496834[_0x91be('0x37')]['offset']);}return _0x3f22b4['getAgents'](_0x339123);}})[_0x91be('0x27')](function(_0x4a9826){if(_0x4a9826){return _0x4a9826?{'count':_0x3215ff,'rows':_0x4a9826}:null;}})[_0x91be('0x27')](respondWithResult(_0x3daafd,null))[_0x91be('0x46')](handleError(_0x3daafd,null));}; \ No newline at end of file +var _0x0c87=['User','findAndCountAll','UserId','agent','mailPause','createdAt','%s/%s','SIP','updatedAt','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','team_has_mail_queues','MailQueueId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailQueues','UserProfileSection','userProfileId','autoAssociation','update','UserMailQueue','hasOwnProperty','pick','MailQueueId'];(function(_0x4b3500,_0x5b64ba){var _0x299194=function(_0x2e67a6){while(--_0x2e67a6){_0x4b3500['push'](_0x4b3500['shift']());}};_0x299194(++_0x5b64ba);}(_0x0c87,0x1d5));var _0x70c8=function(_0x31c02d,_0x33e1bb){_0x31c02d=_0x31c02d-0x0;var _0x41be38=_0x0c87[_0x31c02d];return _0x41be38;};'use strict';var emlformat=require(_0x70c8('0x0'));var rimraf=require(_0x70c8('0x1'));var zipdir=require(_0x70c8('0x2'));var jsonpatch=require(_0x70c8('0x3'));var rp=require(_0x70c8('0x4'));var moment=require(_0x70c8('0x5'));var BPromise=require(_0x70c8('0x6'));var Mustache=require(_0x70c8('0x7'));var util=require(_0x70c8('0x8'));var path=require('path');var sox=require(_0x70c8('0x9'));var csv=require(_0x70c8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70c8('0xb'));var _=require(_0x70c8('0xc'));var squel=require(_0x70c8('0xd'));var crypto=require(_0x70c8('0xe'));var jsforce=require(_0x70c8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x70c8('0xa'));var querystring=require(_0x70c8('0x10'));var Papa=require(_0x70c8('0x11'));var Redis=require(_0x70c8('0x12'));var authService=require(_0x70c8('0x13'));var qs=require(_0x70c8('0x14'));var as=require(_0x70c8('0x15'));var hardwareService=require(_0x70c8('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x70c8('0x17'));var config=require(_0x70c8('0x18'));var licenseUtil=require(_0x70c8('0x19'));var db=require(_0x70c8('0x1a'))['db'];config[_0x70c8('0x1b')]=_[_0x70c8('0x1c')](config[_0x70c8('0x1b')],{'host':_0x70c8('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70c8('0x1b')]));require(_0x70c8('0x1e'))[_0x70c8('0x1f')](socket);function respondWithStatusCode(_0xf4bd1a,_0x35f5b8){_0x35f5b8=_0x35f5b8||0xcc;return function(_0x571342){if(_0x571342){return _0xf4bd1a[_0x70c8('0x20')](_0x35f5b8);}return _0xf4bd1a[_0x70c8('0x21')](_0x35f5b8)[_0x70c8('0x22')]();};}function respondWithResult(_0x3d7a12,_0xdf3598){_0xdf3598=_0xdf3598||0xc8;return function(_0x4c785d){if(_0x4c785d){return _0x3d7a12[_0x70c8('0x21')](_0xdf3598)[_0x70c8('0x23')](_0x4c785d);}};}function respondWithFilteredResult(_0x11b298,_0x2bde98){return function(_0x3db296){if(_0x3db296){var _0x206e43=typeof _0x2bde98[_0x70c8('0x24')]===_0x70c8('0x25')&&typeof _0x2bde98[_0x70c8('0x26')]==='undefined';var _0x4c0f58=_0x3db296[_0x70c8('0x27')];var _0x2c318f=_0x206e43?0x0:_0x2bde98[_0x70c8('0x24')];var _0x186e0e=_0x206e43?_0x3db296[_0x70c8('0x27')]:_0x2bde98[_0x70c8('0x24')]+_0x2bde98[_0x70c8('0x26')];var _0xcb599f;if(_0x186e0e>=_0x4c0f58){_0x186e0e=_0x4c0f58;_0xcb599f=0xc8;}else{_0xcb599f=0xce;}_0x11b298[_0x70c8('0x21')](_0xcb599f);return _0x11b298['set'](_0x70c8('0x28'),_0x2c318f+'-'+_0x186e0e+'/'+_0x4c0f58)[_0x70c8('0x23')](_0x3db296);}return null;};}function patchUpdates(_0x1e8d8d){return function(_0x5aa35a){try{jsonpatch[_0x70c8('0x29')](_0x5aa35a,_0x1e8d8d,!![]);}catch(_0x16b110){return BPromise[_0x70c8('0x2a')](_0x16b110);}return _0x5aa35a[_0x70c8('0x2b')]();};}function saveUpdates(_0x118f0d,_0x110d4e){return function(_0x54274d){if(_0x54274d){return _0x54274d['update'](_0x118f0d)[_0x70c8('0x2c')](function(_0x550009){return _0x550009;});}return null;};}function removeEntity(_0x41a168,_0xd0da8b){return function(_0x1fb991){if(_0x1fb991){return _0x1fb991[_0x70c8('0x2d')]()[_0x70c8('0x2c')](function(){var _0x502cc7=_0x1fb991[_0x70c8('0x2e')]({'plain':!![]});var _0x371e6f='MailQueues';return db[_0x70c8('0x2f')][_0x70c8('0x2d')]({'where':{'type':_0x371e6f,'resourceId':_0x502cc7['id']}})['then'](function(){return _0x1fb991;});})[_0x70c8('0x2c')](function(){_0x41a168[_0x70c8('0x21')](0xcc)[_0x70c8('0x22')]();});}};}function handleEntityNotFound(_0x124f35,_0x4d0cb5){return function(_0x595a83){if(!_0x595a83){_0x124f35['sendStatus'](0x194);}return _0x595a83;};}function handleError(_0x106781,_0x54859f){_0x54859f=_0x54859f||0x1f4;return function(_0x2ad9e9){logger[_0x70c8('0x30')](_0x2ad9e9[_0x70c8('0x31')]);if(_0x2ad9e9[_0x70c8('0x32')]){delete _0x2ad9e9[_0x70c8('0x32')];}_0x106781[_0x70c8('0x21')](_0x54859f)[_0x70c8('0x33')](_0x2ad9e9);};}exports[_0x70c8('0x34')]=function(_0x2a187f,_0x5eff0c){var _0xd6625={},_0x133b5f={},_0x439a80={'count':0x0,'rows':[]};var _0x11834=_[_0x70c8('0x35')](db[_0x70c8('0x36')][_0x70c8('0x37')],function(_0x31e955){return{'name':_0x31e955[_0x70c8('0x38')],'type':_0x31e955['type'][_0x70c8('0x39')]};});_0x133b5f[_0x70c8('0x3a')]=_[_0x70c8('0x35')](_0x11834,_0x70c8('0x32'));_0x133b5f[_0x70c8('0x3b')]=_[_0x70c8('0x3c')](_0x2a187f[_0x70c8('0x3b')]);_0x133b5f[_0x70c8('0x3d')]=_['intersection'](_0x133b5f['model'],_0x133b5f[_0x70c8('0x3b')]);_0xd6625[_0x70c8('0x3e')]=_[_0x70c8('0x3f')](_0x133b5f['model'],qs['fields'](_0x2a187f['query'][_0x70c8('0x40')]));_0xd6625['attributes']=_0xd6625[_0x70c8('0x3e')][_0x70c8('0x41')]?_0xd6625[_0x70c8('0x3e')]:_0x133b5f[_0x70c8('0x3a')];if(!_0x2a187f['query']['hasOwnProperty'](_0x70c8('0x42'))){_0xd6625[_0x70c8('0x26')]=qs['limit'](_0x2a187f[_0x70c8('0x3b')][_0x70c8('0x26')]);_0xd6625[_0x70c8('0x24')]=qs['offset'](_0x2a187f[_0x70c8('0x3b')]['offset']);}_0xd6625[_0x70c8('0x43')]=qs[_0x70c8('0x44')](_0x2a187f[_0x70c8('0x3b')]['sort']);_0xd6625[_0x70c8('0x45')]=qs[_0x70c8('0x3d')](_['pick'](_0x2a187f['query'],_0x133b5f[_0x70c8('0x3d')]),_0x11834);if(_0x2a187f[_0x70c8('0x3b')][_0x70c8('0x46')]){_0xd6625['where']=_[_0x70c8('0x47')](_0xd6625[_0x70c8('0x45')],{'$or':_[_0x70c8('0x35')](_0x11834,function(_0x17b40b){if(_0x17b40b['type']!==_0x70c8('0x48')){var _0x303803={};_0x303803[_0x17b40b[_0x70c8('0x32')]]={'$like':'%'+_0x2a187f[_0x70c8('0x3b')][_0x70c8('0x46')]+'%'};return _0x303803;}})});}_0xd6625=_['merge']({},_0xd6625,_0x2a187f[_0x70c8('0x49')]);var _0x4a58f6={'where':_0xd6625[_0x70c8('0x45')]};return db[_0x70c8('0x36')][_0x70c8('0x27')](_0x4a58f6)['then'](function(_0x1ab1b0){_0x439a80[_0x70c8('0x27')]=_0x1ab1b0;if(_0x2a187f[_0x70c8('0x3b')][_0x70c8('0x4a')]){_0xd6625['include']=[{'all':!![]}];}return db[_0x70c8('0x36')][_0x70c8('0x4b')](_0xd6625);})[_0x70c8('0x2c')](function(_0x30c80f){_0x439a80[_0x70c8('0x4c')]=_0x30c80f;return _0x439a80;})[_0x70c8('0x2c')](respondWithFilteredResult(_0x5eff0c,_0xd6625))[_0x70c8('0x4d')](handleError(_0x5eff0c,null));};exports[_0x70c8('0x4e')]=function(_0x1df915,_0xe6eea8){var _0x49d3f9={'raw':!![],'where':{'id':_0x1df915[_0x70c8('0x4f')]['id']}},_0x3f9035={};_0x3f9035[_0x70c8('0x3a')]=_['keys'](db[_0x70c8('0x36')][_0x70c8('0x37')]);_0x3f9035[_0x70c8('0x3b')]=_[_0x70c8('0x3c')](_0x1df915[_0x70c8('0x3b')]);_0x3f9035[_0x70c8('0x3d')]=_[_0x70c8('0x3f')](_0x3f9035[_0x70c8('0x3a')],_0x3f9035['query']);_0x49d3f9[_0x70c8('0x3e')]=_[_0x70c8('0x3f')](_0x3f9035[_0x70c8('0x3a')],qs[_0x70c8('0x40')](_0x1df915[_0x70c8('0x3b')]['fields']));_0x49d3f9[_0x70c8('0x3e')]=_0x49d3f9[_0x70c8('0x3e')][_0x70c8('0x41')]?_0x49d3f9[_0x70c8('0x3e')]:_0x3f9035['model'];if(_0x1df915[_0x70c8('0x3b')][_0x70c8('0x4a')]){_0x49d3f9[_0x70c8('0x50')]=[{'all':!![]}];}_0x49d3f9=_[_0x70c8('0x47')]({},_0x49d3f9,_0x1df915[_0x70c8('0x49')]);return db[_0x70c8('0x36')][_0x70c8('0x51')](_0x49d3f9)[_0x70c8('0x2c')](handleEntityNotFound(_0xe6eea8,null))[_0x70c8('0x2c')](respondWithResult(_0xe6eea8,null))[_0x70c8('0x4d')](handleError(_0xe6eea8,null));};exports[_0x70c8('0x52')]=function(_0x5a293a,_0x25d24d){return db[_0x70c8('0x36')][_0x70c8('0x52')](_0x5a293a[_0x70c8('0x53')],{})['then'](function(_0x3baa7d){var _0x219cde=_0x5a293a[_0x70c8('0x54')][_0x70c8('0x2e')]({'plain':!![]});if(!_0x219cde)throw new Error(_0x70c8('0x55'));if(_0x219cde['role']===_0x70c8('0x54')){var _0x2f5dae=_0x3baa7d[_0x70c8('0x2e')]({'plain':!![]});var _0x4590c8=_0x70c8('0x56');return db[_0x70c8('0x57')][_0x70c8('0x51')]({'where':{'name':_0x4590c8,'userProfileId':_0x219cde[_0x70c8('0x58')]},'raw':!![]})[_0x70c8('0x2c')](function(_0x448056){if(_0x448056&&_0x448056[_0x70c8('0x59')]===0x0){return db[_0x70c8('0x2f')][_0x70c8('0x52')]({'name':_0x2f5dae[_0x70c8('0x32')],'resourceId':_0x2f5dae['id'],'type':_0x448056[_0x70c8('0x32')],'sectionId':_0x448056['id']},{})[_0x70c8('0x2c')](function(){return _0x3baa7d;});}else{return _0x3baa7d;}})[_0x70c8('0x4d')](function(_0x5b1e70){logger[_0x70c8('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b1e70);throw _0x5b1e70;});}return _0x3baa7d;})[_0x70c8('0x2c')](respondWithResult(_0x25d24d,0xc9))[_0x70c8('0x4d')](handleError(_0x25d24d,null));};exports[_0x70c8('0x5a')]=function(_0x3f39be,_0x343e72){if(_0x3f39be[_0x70c8('0x53')]['id']){delete _0x3f39be[_0x70c8('0x53')]['id'];}return db[_0x70c8('0x36')][_0x70c8('0x51')]({'where':{'id':_0x3f39be[_0x70c8('0x4f')]['id']}})[_0x70c8('0x2c')](handleEntityNotFound(_0x343e72,null))[_0x70c8('0x2c')](saveUpdates(_0x3f39be[_0x70c8('0x53')],null))[_0x70c8('0x2c')](respondWithResult(_0x343e72,null))['catch'](handleError(_0x343e72,null));};exports['destroy']=function(_0x31cded,_0x547436){return db[_0x70c8('0x36')][_0x70c8('0x51')]({'where':{'id':_0x31cded[_0x70c8('0x4f')]['id']}})[_0x70c8('0x2c')](handleEntityNotFound(_0x547436,null))[_0x70c8('0x2c')](removeEntity(_0x547436,null))['catch'](handleError(_0x547436,null));};exports['describe']=function(_0x11d316,_0x4bf63b){return db[_0x70c8('0x36')]['describe']()['then'](respondWithResult(_0x4bf63b,null))['catch'](handleError(_0x4bf63b,null));};exports['getMembers']=function(_0x1fb9ff,_0xf1676,_0x389b40){var _0x18e6b8={'raw':!![],'where':{}},_0x201912={},_0x2fae86;return db[_0x70c8('0x36')]['findOne']({'where':{'id':_0x1fb9ff['params']['id']}})[_0x70c8('0x2c')](handleEntityNotFound(_0xf1676,null))[_0x70c8('0x2c')](function(_0x4ea65f){if(_0x4ea65f){_0x2fae86=_0x4ea65f[_0x70c8('0x2e')]({'plain':!![]});_0x201912[_0x70c8('0x3a')]=_['keys'](db[_0x70c8('0x5b')][_0x70c8('0x37')]);_0x201912[_0x70c8('0x3b')]=_[_0x70c8('0x3c')](_0x1fb9ff[_0x70c8('0x3b')]);_0x201912['filters']=_[_0x70c8('0x3f')](_0x201912[_0x70c8('0x3a')],_0x201912[_0x70c8('0x3b')]);_0x18e6b8[_0x70c8('0x3e')]=_[_0x70c8('0x3f')](_0x201912[_0x70c8('0x3a')],qs[_0x70c8('0x40')](_0x1fb9ff[_0x70c8('0x3b')][_0x70c8('0x40')]));_0x18e6b8['attributes']=_0x18e6b8[_0x70c8('0x3e')][_0x70c8('0x41')]?_0x18e6b8[_0x70c8('0x3e')]:_0x201912[_0x70c8('0x3a')];if(!_0x1fb9ff['query'][_0x70c8('0x5c')](_0x70c8('0x42'))){_0x18e6b8[_0x70c8('0x26')]=qs['limit'](_0x1fb9ff[_0x70c8('0x3b')][_0x70c8('0x26')]);_0x18e6b8[_0x70c8('0x24')]=qs[_0x70c8('0x24')](_0x1fb9ff[_0x70c8('0x3b')]['offset']);}_0x18e6b8[_0x70c8('0x43')]=qs['sort'](_0x1fb9ff[_0x70c8('0x3b')][_0x70c8('0x44')]);_0x18e6b8[_0x70c8('0x45')]=qs[_0x70c8('0x3d')](_[_0x70c8('0x5d')](_0x1fb9ff[_0x70c8('0x3b')],_0x201912[_0x70c8('0x3d')]));_0x18e6b8['where'][_0x70c8('0x5e')]=_0x4ea65f['id'];if(_0x1fb9ff['query'][_0x70c8('0x46')]){_0x18e6b8[_0x70c8('0x45')]=_[_0x70c8('0x47')](_0x18e6b8[_0x70c8('0x45')],{'$or':_['map'](_0x18e6b8['attributes'],function(_0x3d8791){var _0x406dcd={};_0x406dcd[_0x3d8791]={'$like':'%'+_0x1fb9ff[_0x70c8('0x3b')][_0x70c8('0x46')]+'%'};return _0x406dcd;})});}_0x18e6b8=_[_0x70c8('0x47')]({},_0x18e6b8,_0x1fb9ff[_0x70c8('0x49')]);return db['UserMailQueue'][_0x70c8('0x4b')](_0x18e6b8);}})[_0x70c8('0x2c')](function(_0x1eb1d1){if(_0x1eb1d1){return db[_0x70c8('0x5f')][_0x70c8('0x60')]({'where':{'id':_[_0x70c8('0x35')](_0x1eb1d1,_0x70c8('0x61')),'role':_0x70c8('0x62')},'attributes':['id',_0x70c8('0x32'),_0x70c8('0x63'),'updatedAt',_0x70c8('0x64')]});}})['then'](function(_0x1689c2){if(_0x1689c2){return{'count':_0x1689c2[_0x70c8('0x27')],'rows':_[_0x70c8('0x35')](_0x1689c2['rows'],function(_0x1866b1){return{'membername':_0x1866b1[_0x70c8('0x32')],'UserId':_0x1866b1['id'],'queue_name':_0x2fae86[_0x70c8('0x32')],'MailQueueId':_0x2fae86['id'],'interface':util['format'](_0x70c8('0x65'),_0x70c8('0x66'),_0x1866b1[_0x70c8('0x32')]),'penalty':0x0,'paused':_0x1866b1[_0x70c8('0x63')],'createdAt':_0x1866b1[_0x70c8('0x64')],'updatedAt':_0x1866b1[_0x70c8('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x70c8('0x2c')](respondWithFilteredResult(_0xf1676,_0x18e6b8))[_0x70c8('0x4d')](handleError(_0xf1676,null));};exports['getTeams']=function(_0xb0ffda,_0x41204c,_0xc0f01f){var _0x488b84={};var _0x3c8355={};var _0x1fad1c;var _0x4fd563;return db[_0x70c8('0x36')][_0x70c8('0x68')]({'where':{'id':_0xb0ffda[_0x70c8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x41204c,null))['then'](function(_0x1e2c64){if(_0x1e2c64){_0x1fad1c=_0x1e2c64;_0x3c8355[_0x70c8('0x3a')]=_['keys'](db[_0x70c8('0x69')][_0x70c8('0x37')]);_0x3c8355[_0x70c8('0x3b')]=_[_0x70c8('0x3c')](_0xb0ffda[_0x70c8('0x3b')]);_0x3c8355[_0x70c8('0x3d')]=_[_0x70c8('0x3f')](_0x3c8355['model'],_0x3c8355[_0x70c8('0x3b')]);_0x488b84[_0x70c8('0x3e')]=_[_0x70c8('0x3f')](_0x3c8355[_0x70c8('0x3a')],qs[_0x70c8('0x40')](_0xb0ffda['query'][_0x70c8('0x40')]));_0x488b84['attributes']=_0x488b84['attributes'][_0x70c8('0x41')]?_0x488b84[_0x70c8('0x3e')]:_0x3c8355['model'];_0x488b84['order']=qs[_0x70c8('0x44')](_0xb0ffda['query'][_0x70c8('0x44')]);_0x488b84[_0x70c8('0x45')]=qs[_0x70c8('0x3d')](_[_0x70c8('0x5d')](_0xb0ffda[_0x70c8('0x3b')],_0x3c8355['filters']));if(_0xb0ffda[_0x70c8('0x3b')][_0x70c8('0x46')]){_0x488b84['where']=_[_0x70c8('0x47')](_0x488b84[_0x70c8('0x45')],{'$or':_[_0x70c8('0x35')](_0x488b84['attributes'],function(_0x10bbec){var _0x575e88={};_0x575e88[_0x10bbec]={'$like':'%'+_0xb0ffda[_0x70c8('0x3b')][_0x70c8('0x46')]+'%'};return _0x575e88;})});}_0x488b84=_['merge']({},_0x488b84,_0xb0ffda[_0x70c8('0x49')]);return _0x1fad1c[_0x70c8('0x6a')](_0x488b84);}})[_0x70c8('0x2c')](function(_0x315242){if(_0x315242){_0x4fd563=_0x315242[_0x70c8('0x41')];if(!_0xb0ffda[_0x70c8('0x3b')][_0x70c8('0x5c')]('nolimit')){_0x488b84[_0x70c8('0x26')]=qs['limit'](_0xb0ffda['query'][_0x70c8('0x26')]);_0x488b84[_0x70c8('0x24')]=qs[_0x70c8('0x24')](_0xb0ffda[_0x70c8('0x3b')][_0x70c8('0x24')]);}return _0x1fad1c[_0x70c8('0x6a')](_0x488b84);}})[_0x70c8('0x2c')](function(_0x15e7ce){if(_0x15e7ce){return _0x15e7ce?{'count':_0x4fd563,'rows':_0x15e7ce}:null;}})[_0x70c8('0x2c')](respondWithResult(_0x41204c,null))[_0x70c8('0x4d')](handleError(_0x41204c,null));};exports[_0x70c8('0x6b')]=function(_0x581da0,_0x4cb982,_0x4a0c75){var _0x1ddcf1=_0x581da0[_0x70c8('0x53')][_0x70c8('0x6c')];return db[_0x70c8('0x69')][_0x70c8('0x4b')]({'where':{'id':_0x1ddcf1},'attributes':['id'],'include':[{'model':db[_0x70c8('0x5f')],'as':_0x70c8('0x6d'),'attributes':['id',_0x70c8('0x32'),_0x70c8('0x6e'),_0x70c8('0x6f'),_0x70c8('0x70')],'raw':!![]}]})[_0x70c8('0x2c')](function(_0x4c88d4){if(_0x4c88d4){var _0xec378c=_[_0x70c8('0x71')](_0x4c88d4,function(_0xe1a07a){var _0x3805c0=_0xe1a07a['get']({'plain':!![]});return _0x3805c0[_0x70c8('0x6d')];});return db[_0x70c8('0x36')]['find']({'where':{'id':_0x581da0[_0x70c8('0x4f')]['id']}})[_0x70c8('0x2c')](function(_0x1f4e72){return db[_0x70c8('0x72')]['transaction'](function(_0x4047da){return _0x1f4e72[_0x70c8('0x6b')](_0x1ddcf1,{'transaction':_0x4047da})[_0x70c8('0x2c')](function(){return BPromise[_0x70c8('0x73')](_0xec378c,function(_0x344396){return db['UserMailQueue'][_0x70c8('0x74')]({'where':{'UserId':_0x344396['id'],'MailQueueId':_0x581da0[_0x70c8('0x4f')]['id']},'transaction':_0x4047da});});})[_0x70c8('0x2c')](function(){_0xec378c[_0x70c8('0x75')](function(_0x3821d5){socket[_0x70c8('0x76')](_0x70c8('0x77'),{'UserId':_0x3821d5['id'],'MailQueueId':_0x1f4e72['id']});});});});});}})[_0x70c8('0x2c')](respondWithStatusCode(_0x4cb982,null))[_0x70c8('0x4d')](handleError(_0x4cb982,null));};exports[_0x70c8('0x78')]=function(_0x189b45,_0x4cc2a5,_0x54ddba){return db[_0x70c8('0x69')]['findAll']({'where':{'id':_0x189b45[_0x70c8('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x70c8('0x2c')](handleEntityNotFound(_0x4cc2a5,null))[_0x70c8('0x2c')](function(_0x23de72){var _0x57be53=_[_0x70c8('0x35')](_0x23de72,'id');var _0x3ba263=[];var _0x55643c=[];var _0x31d5a4=squel[_0x70c8('0x79')]();_0x31d5a4['field']('tq.TeamId')['from'](_0x70c8('0x7a'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x70c8('0x45')](_0x70c8('0x7b'),_0x189b45[_0x70c8('0x4f')]['id']);for(var _0x3ad165=0x0;_0x3ad165<_0x23de72['length'];_0x3ad165+=0x1){let _0xe2dde8=_0x23de72[_0x3ad165];for(var _0x44d380=0x0;_0x44d380<_0xe2dde8[_0x70c8('0x6d')][_0x70c8('0x41')];_0x44d380+=0x1){let _0x4ed5ef=_0xe2dde8['Agents'][_0x44d380];var _0x2a2db7=_0x31d5a4['clone']();_0x2a2db7['where']('ut.UserId\x20=\x20?',_0x4ed5ef['id']);_0x55643c[_0x70c8('0x7c')](db['sequelize'][_0x70c8('0x3b')](_0x2a2db7['toString'](),{'type':db[_0x70c8('0x72')][_0x70c8('0x7d')]['SELECT']})[_0x70c8('0x2c')](function(_0xa35055){if(_0xa35055['length']===0x1){return _0x4ed5ef['id'];}else{var _0x254133=_['every'](_[_0x70c8('0x35')](_0xa35055,_0x70c8('0x7e')),function(_0x53f318){return _[_0x70c8('0x7f')](_0x57be53,_0x53f318);});if(_0x254133){return _0x4ed5ef['id'];}}}));}}return BPromise[_0x70c8('0x80')](_0x55643c)[_0x70c8('0x2c')](function(_0x398700){_0x3ba263=_(_0x3ba263)[_0x70c8('0x81')](_0x398700)[_0x70c8('0x82')]()[_0x70c8('0x83')]();return db[_0x70c8('0x36')]['find']({'where':{'id':_0x189b45[_0x70c8('0x4f')]['id']}})[_0x70c8('0x2c')](function(_0x564023){return db['sequelize'][_0x70c8('0x84')](function(_0x1300f8){return _0x564023[_0x70c8('0x78')](_0x189b45[_0x70c8('0x3b')][_0x70c8('0x6c')],{'transaction':_0x1300f8})[_0x70c8('0x2c')](function(){if(!_[_0x70c8('0x85')](_0x3ba263)){return _0x564023[_0x70c8('0x86')](_0x3ba263,{'transaction':_0x1300f8});}})[_0x70c8('0x2c')](function(){_0x3ba263[_0x70c8('0x75')](function(_0x49d094){socket['emit']('userMailQueue:remove',{'UserId':_0x49d094,'MailQueueId':_0x564023['id']});});});});});});})['then'](respondWithStatusCode(_0x4cc2a5,null))['catch'](handleError(_0x4cc2a5,null));};exports[_0x70c8('0x87')]=function(_0x4df238,_0x305221,_0x556922){return db[_0x70c8('0x36')]['find']({'where':{'id':_0x4df238[_0x70c8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x305221,null))[_0x70c8('0x2c')](function(_0x3439da){if(_0x3439da){return _0x3439da[_0x70c8('0x87')](_0x4df238[_0x70c8('0x53')][_0x70c8('0x6c')],_[_0x70c8('0x88')](_0x4df238[_0x70c8('0x53')],['ids','id'])||{})[_0x70c8('0x89')](function(_0x342db){for(var _0xfc0c48=0x0;_0xfc0c48<_0x4df238[_0x70c8('0x53')][_0x70c8('0x6c')][_0x70c8('0x41')];_0xfc0c48+=0x1){socket[_0x70c8('0x76')](_0x70c8('0x77'),{'UserId':Number(_0x4df238[_0x70c8('0x53')][_0x70c8('0x6c')][_0xfc0c48]),'MailQueueId':Number(_0x4df238['params']['id'])});}return _0x342db;});}})[_0x70c8('0x2c')](respondWithResult(_0x305221,null))[_0x70c8('0x4d')](handleError(_0x305221,null));};exports[_0x70c8('0x86')]=function(_0x16bfda,_0x11e276,_0x65aa55){return db[_0x70c8('0x36')][_0x70c8('0x51')]({'where':{'id':_0x16bfda['params']['id']}})[_0x70c8('0x2c')](handleEntityNotFound(_0x11e276,null))[_0x70c8('0x2c')](function(_0x855024){if(_0x855024){return _0x855024['removeAgents'](_0x16bfda[_0x70c8('0x3b')][_0x70c8('0x6c')])[_0x70c8('0x2c')](function(){if(_[_0x70c8('0x8a')](_0x16bfda[_0x70c8('0x3b')][_0x70c8('0x6c')])){for(var _0x9796dc=0x0;_0x9796dc<_0x16bfda[_0x70c8('0x3b')][_0x70c8('0x6c')][_0x70c8('0x41')];_0x9796dc+=0x1){socket[_0x70c8('0x76')](_0x70c8('0x8b'),{'UserId':Number(_0x16bfda[_0x70c8('0x3b')]['ids'][_0x9796dc]),'MailQueueId':Number(_0x16bfda[_0x70c8('0x4f')]['id'])});}}else{socket[_0x70c8('0x76')]('userMailQueue:remove',{'UserId':Number(_0x16bfda[_0x70c8('0x3b')][_0x70c8('0x6c')]),'MailQueueId':Number(_0x16bfda[_0x70c8('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x11e276,null))[_0x70c8('0x4d')](handleError(_0x11e276,null));};exports[_0x70c8('0x8c')]=function(_0x427cd9,_0x417799,_0x18ee02){var _0x36637b={};var _0x18e096={};var _0x1744a7;var _0x1ccf4c;return db[_0x70c8('0x36')]['findOne']({'where':{'id':_0x427cd9[_0x70c8('0x4f')]['id']}})[_0x70c8('0x2c')](handleEntityNotFound(_0x417799,null))['then'](function(_0x4929b4){if(_0x4929b4){_0x1744a7=_0x4929b4;_0x18e096[_0x70c8('0x3a')]=_[_0x70c8('0x3c')](db[_0x70c8('0x5f')][_0x70c8('0x37')]);_0x18e096[_0x70c8('0x3b')]=_['keys'](_0x427cd9[_0x70c8('0x3b')]);_0x18e096['filters']=_['intersection'](_0x18e096[_0x70c8('0x3a')],_0x18e096[_0x70c8('0x3b')]);_0x36637b[_0x70c8('0x3e')]=_['intersection'](_0x18e096['model'],qs[_0x70c8('0x40')](_0x427cd9[_0x70c8('0x3b')][_0x70c8('0x40')]));_0x36637b[_0x70c8('0x3e')]=_0x36637b[_0x70c8('0x3e')][_0x70c8('0x41')]?_0x36637b[_0x70c8('0x3e')]:_0x18e096[_0x70c8('0x3a')];_0x36637b[_0x70c8('0x43')]=qs[_0x70c8('0x44')](_0x427cd9[_0x70c8('0x3b')][_0x70c8('0x44')]);_0x36637b[_0x70c8('0x45')]=qs[_0x70c8('0x3d')](_[_0x70c8('0x5d')](_0x427cd9[_0x70c8('0x3b')],_0x18e096[_0x70c8('0x3d')]));if(_0x427cd9['query'][_0x70c8('0x46')]){_0x36637b[_0x70c8('0x45')]=_[_0x70c8('0x47')](_0x36637b[_0x70c8('0x45')],{'$or':_['map'](_0x36637b[_0x70c8('0x3e')],function(_0x2a0e06){var _0x24fd7b={};_0x24fd7b[_0x2a0e06]={'$like':'%'+_0x427cd9[_0x70c8('0x3b')][_0x70c8('0x46')]+'%'};return _0x24fd7b;})});}_0x36637b=_[_0x70c8('0x47')]({},_0x36637b,_0x427cd9[_0x70c8('0x49')]);return _0x1744a7[_0x70c8('0x8c')](_0x36637b);}})[_0x70c8('0x2c')](function(_0x27a46c){if(_0x27a46c){_0x1ccf4c=_0x27a46c[_0x70c8('0x41')];if(!_0x427cd9[_0x70c8('0x3b')][_0x70c8('0x5c')](_0x70c8('0x42'))){_0x36637b[_0x70c8('0x26')]=qs['limit'](_0x427cd9[_0x70c8('0x3b')][_0x70c8('0x26')]);_0x36637b[_0x70c8('0x24')]=qs['offset'](_0x427cd9[_0x70c8('0x3b')][_0x70c8('0x24')]);}return _0x1744a7[_0x70c8('0x8c')](_0x36637b);}})[_0x70c8('0x2c')](function(_0x291618){if(_0x291618){return _0x291618?{'count':_0x1ccf4c,'rows':_0x291618}:null;}})['then'](respondWithResult(_0x417799,null))[_0x70c8('0x4d')](handleError(_0x417799,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index bbda3d4..e4fa0bb 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 _0x4d0d=['emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','save','remove'];(function(_0x3d928a,_0x1d6bdc){var _0x2e673c=function(_0x4e38e2){while(--_0x4e38e2){_0x3d928a['push'](_0x3d928a['shift']());}};_0x2e673c(++_0x1d6bdc);}(_0x4d0d,0x1bb));var _0xd4d0=function(_0x414eb8,_0x136356){_0x414eb8=_0x414eb8-0x0;var _0x1d1e13=_0x4d0d[_0x414eb8];return _0x1d1e13;};'use strict';var EventEmitter=require(_0xd4d0('0x0'));var MailQueue=require(_0xd4d0('0x1'))['db'][_0xd4d0('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd4d0('0x3'),'afterUpdate':'update','afterDestroy':_0xd4d0('0x4')};function emitEvent(_0x1efab4){return function(_0x17f416,_0x1f3d59,_0x279e20){MailQueueEvents[_0xd4d0('0x5')](_0x1efab4+':'+_0x17f416['id'],_0x17f416);MailQueueEvents[_0xd4d0('0x5')](_0x1efab4,_0x17f416);_0x279e20(null);};}for(var e in events){if(events[_0xd4d0('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xd4d0('0x7')]=MailQueueEvents; \ No newline at end of file +var _0xd36b=['../../mysqldb','MailQueue','setMaxListeners','save','update','remove','hook','exports','events'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xd36b,0x1af));var _0xbd36=function(_0x516de3,_0x32c587){_0x516de3=_0x516de3-0x0;var _0x38544b=_0xd36b[_0x516de3];return _0x38544b;};'use strict';var EventEmitter=require(_0xbd36('0x0'));var MailQueue=require(_0xbd36('0x1'))['db'][_0xbd36('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xbd36('0x3')](0x0);var events={'afterCreate':_0xbd36('0x4'),'afterUpdate':_0xbd36('0x5'),'afterDestroy':_0xbd36('0x6')};function emitEvent(_0x48f8c5){return function(_0x255a02,_0x481847,_0x1c7699){MailQueueEvents['emit'](_0x48f8c5+':'+_0x255a02['id'],_0x255a02);MailQueueEvents['emit'](_0x48f8c5,_0x255a02);_0x1c7699(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xbd36('0x7')](e,emitEvent(event));}}module[_0xbd36('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 57c92d2..f5df55e 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 _0xfdc5=['lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfdc5,0x82));var _0x5fdc=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0xfdc5[_0x2a7b8e];return _0x29b5c8;};'use strict';var _=require(_0x5fdc('0x0'));var util=require(_0x5fdc('0x1'));var logger=require(_0x5fdc('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5fdc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5fdc('0x4'));var config=require(_0x5fdc('0x5'));var attributes=require(_0x5fdc('0x6'));module['exports']=function(_0x133002,_0x3aa062){return _0x133002[_0x5fdc('0x7')](_0x5fdc('0x8'),attributes,{'tableName':_0x5fdc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd841=['rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','../../config/logger','moment','bluebird'];(function(_0x1e86b5,_0x1ad50b){var _0x807222=function(_0x4a845f){while(--_0x4a845f){_0x1e86b5['push'](_0x1e86b5['shift']());}};_0x807222(++_0x1ad50b);}(_0xd841,0x150));var _0x1d84=function(_0x1d5a58,_0x37aca4){_0x1d5a58=_0x1d5a58-0x0;var _0x2c1311=_0xd841[_0x1d5a58];return _0x2c1311;};'use strict';var _=require(_0x1d84('0x0'));var util=require('util');var logger=require(_0x1d84('0x1'))('api');var moment=require(_0x1d84('0x2'));var BPromise=require(_0x1d84('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1d84('0x4'));var config=require(_0x1d84('0x5'));var attributes=require(_0x1d84('0x6'));module[_0x1d84('0x7')]=function(_0xa2054b,_0x251b5d){return _0xa2054b['define'](_0x1d84('0x8'),attributes,{'tableName':_0x1d84('0x9'),'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 eb92e5c..fff537d 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 _0xe2b4=['model','attributes','GetMailQueue','ShowMailQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','MailQueue','findAll','options','raw','where','limit','include','map'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0xe2b4,0x1d3));var _0x4e2b=function(_0x3cf707,_0x54c984){_0x3cf707=_0x3cf707-0x0;var _0x2bfaf0=_0xe2b4[_0x3cf707];return _0x2bfaf0;};'use strict';var _=require(_0x4e2b('0x0'));var util=require('util');var moment=require(_0x4e2b('0x1'));var BPromise=require(_0x4e2b('0x2'));var rs=require(_0x4e2b('0x3'));var fs=require('fs');var Redis=require(_0x4e2b('0x4'));var db=require(_0x4e2b('0x5'))['db'];var utils=require(_0x4e2b('0x6'));var logger=require(_0x4e2b('0x7'))(_0x4e2b('0x8'));var config=require('../../config/environment');var jayson=require(_0x4e2b('0x9'));var client=jayson[_0x4e2b('0xa')][_0x4e2b('0xb')]({'port':0x232a});config[_0x4e2b('0xc')]=_[_0x4e2b('0xd')](config[_0x4e2b('0xc')],{'host':_0x4e2b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0x4e2b('0xf')](socket);function respondWithRpcPromise(_0x1cf3f7,_0x414f50,_0x266ebf){return new BPromise(function(_0x264bbd,_0x3fa239){return client[_0x4e2b('0x10')](_0x1cf3f7,_0x266ebf)[_0x4e2b('0x11')](function(_0x4df451){logger[_0x4e2b('0x12')](_0x4e2b('0x13'),_0x414f50,'request\x20sent');logger[_0x4e2b('0x14')](_0x4e2b('0x15'),_0x414f50,'request\x20sent',JSON[_0x4e2b('0x16')](_0x4df451));if(_0x4df451['error']){if(_0x4df451[_0x4e2b('0x17')][_0x4e2b('0x18')]===0x1f4){logger[_0x4e2b('0x17')](_0x4e2b('0x13'),_0x414f50,_0x4df451[_0x4e2b('0x17')][_0x4e2b('0x19')]);return _0x3fa239(_0x4df451[_0x4e2b('0x17')][_0x4e2b('0x19')]);}logger[_0x4e2b('0x17')](_0x4e2b('0x13'),_0x414f50,_0x4df451['error'][_0x4e2b('0x19')]);return _0x264bbd(_0x4df451['error']['message']);}else{logger['info'](_0x4e2b('0x13'),_0x414f50,_0x4e2b('0x1a'));_0x264bbd(_0x4df451[_0x4e2b('0x1b')][_0x4e2b('0x19')]);}})[_0x4e2b('0x1c')](function(_0x2fc6f1){logger[_0x4e2b('0x17')](_0x4e2b('0x13'),_0x414f50,_0x2fc6f1);_0x3fa239(_0x2fc6f1);});});}exports['GetMailQueue']=function(_0x3e821c){var _0x3ed05f=this;return new Promise(function(_0xa0ae2,_0x3d9ff3){return db[_0x4e2b('0x1d')][_0x4e2b('0x1e')]({'raw':_0x3e821c[_0x4e2b('0x1f')]?_0x3e821c['options'][_0x4e2b('0x20')]===undefined?!![]:![]:!![],'where':_0x3e821c[_0x4e2b('0x1f')]?_0x3e821c[_0x4e2b('0x1f')][_0x4e2b('0x21')]||null:null,'attributes':_0x3e821c[_0x4e2b('0x1f')]?_0x3e821c['options']['attributes']||null:null,'limit':_0x3e821c[_0x4e2b('0x1f')]?_0x3e821c[_0x4e2b('0x1f')][_0x4e2b('0x22')]||null:null,'include':_0x3e821c[_0x4e2b('0x1f')]?_0x3e821c[_0x4e2b('0x1f')][_0x4e2b('0x23')]?_[_0x4e2b('0x24')](_0x3e821c[_0x4e2b('0x1f')]['include'],function(_0x4421c9){return{'model':db[_0x4421c9[_0x4e2b('0x25')]],'as':_0x4421c9['as'],'attributes':_0x4421c9['attributes'],'include':_0x4421c9['include']?_[_0x4e2b('0x24')](_0x4421c9['include'],function(_0x5af0ed){return{'model':db[_0x5af0ed[_0x4e2b('0x25')]],'as':_0x5af0ed['as'],'attributes':_0x5af0ed[_0x4e2b('0x26')],'include':_0x5af0ed[_0x4e2b('0x23')]?_['map'](_0x5af0ed[_0x4e2b('0x23')],function(_0x2f15ca){return{'model':db[_0x2f15ca[_0x4e2b('0x25')]],'as':_0x2f15ca['as'],'attributes':_0x2f15ca['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e2b('0x11')](function(_0x4ecfd9){logger['info']('GetMailQueue',_0x3e821c);logger[_0x4e2b('0x14')](_0x4e2b('0x27'),_0x3e821c,JSON[_0x4e2b('0x16')](_0x4ecfd9));_0xa0ae2(_0x4ecfd9);})[_0x4e2b('0x1c')](function(_0x56fc42){logger[_0x4e2b('0x17')]('GetMailQueue',_0x56fc42[_0x4e2b('0x19')],_0x3e821c);_0x3d9ff3(_0x3ed05f['error'](0x1f4,_0x56fc42[_0x4e2b('0x19')]));});});};exports[_0x4e2b('0x28')]=function(_0x17295a){var _0x5cc6ce=this;return new Promise(function(_0xf44d9f,_0x3c85d2){return db[_0x4e2b('0x1d')][_0x4e2b('0x29')]({'raw':_0x17295a['options']?_0x17295a[_0x4e2b('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x17295a[_0x4e2b('0x1f')]?_0x17295a[_0x4e2b('0x1f')]['where']||null:null,'attributes':_0x17295a[_0x4e2b('0x1f')]?_0x17295a[_0x4e2b('0x1f')][_0x4e2b('0x26')]||null:null,'include':_0x17295a[_0x4e2b('0x1f')]?_0x17295a[_0x4e2b('0x1f')][_0x4e2b('0x23')]?_[_0x4e2b('0x24')](_0x17295a[_0x4e2b('0x1f')]['include'],function(_0x21f070){return{'model':db[_0x21f070[_0x4e2b('0x25')]],'as':_0x21f070['as'],'attributes':_0x21f070[_0x4e2b('0x26')],'include':_0x21f070['include']?_['map'](_0x21f070['include'],function(_0x5f013d){return{'model':db[_0x5f013d['model']],'as':_0x5f013d['as'],'attributes':_0x5f013d[_0x4e2b('0x26')],'include':_0x5f013d[_0x4e2b('0x23')]?_[_0x4e2b('0x24')](_0x5f013d['include'],function(_0x4bf21f){return{'model':db[_0x4bf21f['model']],'as':_0x4bf21f['as'],'attributes':_0x4bf21f[_0x4e2b('0x26')]};}):[]};}):[]};}):[]:[]})[_0x4e2b('0x11')](function(_0x551775){logger[_0x4e2b('0x12')](_0x4e2b('0x28'),_0x17295a);logger[_0x4e2b('0x14')](_0x4e2b('0x28'),_0x17295a,JSON[_0x4e2b('0x16')](_0x551775));_0xf44d9f(_0x551775);})['catch'](function(_0x57f14f){logger[_0x4e2b('0x17')](_0x4e2b('0x28'),_0x57f14f[_0x4e2b('0x19')],_0x17295a);_0x3c85d2(_0x5cc6ce[_0x4e2b('0x17')](0x1f4,_0x57f14f[_0x4e2b('0x19')]));});});}; \ No newline at end of file +var _0xa641=['info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','MailQueue','findAll','options','raw','include','map','attributes','model','GetMailQueue','stringify','find','where','then','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa641,0x188));var _0x1a64=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xa641[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x1a64('0x0'));var util=require(_0x1a64('0x1'));var moment=require(_0x1a64('0x2'));var BPromise=require(_0x1a64('0x3'));var rs=require(_0x1a64('0x4'));var fs=require('fs');var Redis=require(_0x1a64('0x5'));var db=require(_0x1a64('0x6'))['db'];var utils=require(_0x1a64('0x7'));var logger=require(_0x1a64('0x8'))(_0x1a64('0x9'));var config=require(_0x1a64('0xa'));var jayson=require(_0x1a64('0xb'));var client=jayson[_0x1a64('0xc')][_0x1a64('0xd')]({'port':0x232a});config[_0x1a64('0xe')]=_['defaults'](config['redis'],{'host':_0x1a64('0xf'),'port':0x18eb});var socket=require(_0x1a64('0x10'))(new Redis(config['redis']));require(_0x1a64('0x11'))['register'](socket);function respondWithRpcPromise(_0x19fb26,_0xb98c76,_0x329460){return new BPromise(function(_0x40de3f,_0x4e0133){return client['request'](_0x19fb26,_0x329460)['then'](function(_0x53044b){logger[_0x1a64('0x12')](_0x1a64('0x13'),_0xb98c76,_0x1a64('0x14'));logger[_0x1a64('0x15')](_0x1a64('0x16'),_0xb98c76,_0x1a64('0x14'),JSON['stringify'](_0x53044b));if(_0x53044b['error']){if(_0x53044b[_0x1a64('0x17')][_0x1a64('0x18')]===0x1f4){logger[_0x1a64('0x17')](_0x1a64('0x13'),_0xb98c76,_0x53044b[_0x1a64('0x17')]['message']);return _0x4e0133(_0x53044b[_0x1a64('0x17')][_0x1a64('0x19')]);}logger[_0x1a64('0x17')](_0x1a64('0x13'),_0xb98c76,_0x53044b['error'][_0x1a64('0x19')]);return _0x40de3f(_0x53044b[_0x1a64('0x17')][_0x1a64('0x19')]);}else{logger[_0x1a64('0x12')](_0x1a64('0x13'),_0xb98c76,_0x1a64('0x14'));_0x40de3f(_0x53044b['result'][_0x1a64('0x19')]);}})[_0x1a64('0x1a')](function(_0x5bd869){logger[_0x1a64('0x17')](_0x1a64('0x13'),_0xb98c76,_0x5bd869);_0x4e0133(_0x5bd869);});});}exports['GetMailQueue']=function(_0x17214b){var _0x30b4a8=this;return new Promise(function(_0x86f3c5,_0x1a030d){return db[_0x1a64('0x1b')][_0x1a64('0x1c')]({'raw':_0x17214b[_0x1a64('0x1d')]?_0x17214b[_0x1a64('0x1d')][_0x1a64('0x1e')]===undefined?!![]:![]:!![],'where':_0x17214b[_0x1a64('0x1d')]?_0x17214b['options']['where']||null:null,'attributes':_0x17214b[_0x1a64('0x1d')]?_0x17214b[_0x1a64('0x1d')]['attributes']||null:null,'limit':_0x17214b[_0x1a64('0x1d')]?_0x17214b[_0x1a64('0x1d')]['limit']||null:null,'include':_0x17214b[_0x1a64('0x1d')]?_0x17214b[_0x1a64('0x1d')][_0x1a64('0x1f')]?_[_0x1a64('0x20')](_0x17214b[_0x1a64('0x1d')][_0x1a64('0x1f')],function(_0x55026b){return{'model':db[_0x55026b['model']],'as':_0x55026b['as'],'attributes':_0x55026b[_0x1a64('0x21')],'include':_0x55026b['include']?_[_0x1a64('0x20')](_0x55026b[_0x1a64('0x1f')],function(_0x16d9c3){return{'model':db[_0x16d9c3[_0x1a64('0x22')]],'as':_0x16d9c3['as'],'attributes':_0x16d9c3[_0x1a64('0x21')],'include':_0x16d9c3[_0x1a64('0x1f')]?_[_0x1a64('0x20')](_0x16d9c3[_0x1a64('0x1f')],function(_0x5382ef){return{'model':db[_0x5382ef[_0x1a64('0x22')]],'as':_0x5382ef['as'],'attributes':_0x5382ef['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a1ef1){logger[_0x1a64('0x12')](_0x1a64('0x23'),_0x17214b);logger[_0x1a64('0x15')](_0x1a64('0x23'),_0x17214b,JSON[_0x1a64('0x24')](_0x4a1ef1));_0x86f3c5(_0x4a1ef1);})['catch'](function(_0x5f4ab9){logger[_0x1a64('0x17')]('GetMailQueue',_0x5f4ab9[_0x1a64('0x19')],_0x17214b);_0x1a030d(_0x30b4a8['error'](0x1f4,_0x5f4ab9['message']));});});};exports['ShowMailQueue']=function(_0x3b2758){var _0x4ebc44=this;return new Promise(function(_0x48c5f9,_0x871e87){return db[_0x1a64('0x1b')][_0x1a64('0x25')]({'raw':_0x3b2758[_0x1a64('0x1d')]?_0x3b2758[_0x1a64('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3b2758[_0x1a64('0x1d')]?_0x3b2758[_0x1a64('0x1d')][_0x1a64('0x26')]||null:null,'attributes':_0x3b2758[_0x1a64('0x1d')]?_0x3b2758[_0x1a64('0x1d')]['attributes']||null:null,'include':_0x3b2758['options']?_0x3b2758[_0x1a64('0x1d')][_0x1a64('0x1f')]?_[_0x1a64('0x20')](_0x3b2758[_0x1a64('0x1d')][_0x1a64('0x1f')],function(_0x488cea){return{'model':db[_0x488cea[_0x1a64('0x22')]],'as':_0x488cea['as'],'attributes':_0x488cea[_0x1a64('0x21')],'include':_0x488cea[_0x1a64('0x1f')]?_[_0x1a64('0x20')](_0x488cea['include'],function(_0x3c8b0e){return{'model':db[_0x3c8b0e[_0x1a64('0x22')]],'as':_0x3c8b0e['as'],'attributes':_0x3c8b0e[_0x1a64('0x21')],'include':_0x3c8b0e[_0x1a64('0x1f')]?_[_0x1a64('0x20')](_0x3c8b0e['include'],function(_0x48b0eb){return{'model':db[_0x48b0eb[_0x1a64('0x22')]],'as':_0x48b0eb['as'],'attributes':_0x48b0eb[_0x1a64('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1a64('0x27')](function(_0x54f4bd){logger['info']('ShowMailQueue',_0x3b2758);logger[_0x1a64('0x15')](_0x1a64('0x28'),_0x3b2758,JSON[_0x1a64('0x24')](_0x54f4bd));_0x48c5f9(_0x54f4bd);})[_0x1a64('0x1a')](function(_0x30a448){logger['error'](_0x1a64('0x28'),_0x30a448[_0x1a64('0x19')],_0x3b2758);_0x871e87(_0x4ebc44[_0x1a64('0x17')](0x1f4,_0x30a448[_0x1a64('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index eb6f6b8..91e1d40 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 _0x4552=['save','remove','emit','register','mailQueue:','./mailQueue.events'];(function(_0x2f9d83,_0xfbc7e7){var _0x112d5f=function(_0x513735){while(--_0x513735){_0x2f9d83['push'](_0x2f9d83['shift']());}};_0x112d5f(++_0xfbc7e7);}(_0x4552,0x1eb));var _0x2455=function(_0x567a5d,_0x41b551){_0x567a5d=_0x567a5d-0x0;var _0x2d3bfe=_0x4552[_0x567a5d];return _0x2d3bfe;};'use strict';var MailQueueEvents=require(_0x2455('0x0'));var events=[_0x2455('0x1'),_0x2455('0x2'),'update'];function createListener(_0x187f94,_0x1bd3dd){return function(_0x5835dc){_0x1bd3dd[_0x2455('0x3')](_0x187f94,_0x5835dc);};}function removeListener(_0x41c145,_0x17a083){return function(){MailQueueEvents['removeListener'](_0x41c145,_0x17a083);};}exports[_0x2455('0x4')]=function(_0x436101){for(var _0x2d6b84=0x0,_0x233df6=events['length'];_0x2d6b84<_0x233df6;_0x2d6b84++){var _0x516157=events[_0x2d6b84];var _0x581e0d=createListener(_0x2455('0x5')+_0x516157,_0x436101);MailQueueEvents['on'](_0x516157,_0x581e0d);}}; \ No newline at end of file +var _0xd1eb=['register','length','mailQueue:','./mailQueue.events','save','remove','emit','removeListener'];(function(_0x541a7d,_0xbfbb8d){var _0x3c7f70=function(_0x3a887b){while(--_0x3a887b){_0x541a7d['push'](_0x541a7d['shift']());}};_0x3c7f70(++_0xbfbb8d);}(_0xd1eb,0xc3));var _0xbd1e=function(_0x1fb86b,_0x144efb){_0x1fb86b=_0x1fb86b-0x0;var _0x1a9f72=_0xd1eb[_0x1fb86b];return _0x1a9f72;};'use strict';var MailQueueEvents=require(_0xbd1e('0x0'));var events=[_0xbd1e('0x1'),_0xbd1e('0x2'),'update'];function createListener(_0x3fa5ac,_0x5ddcfe){return function(_0x5c4562){_0x5ddcfe[_0xbd1e('0x3')](_0x3fa5ac,_0x5c4562);};}function removeListener(_0x64ce01,_0xbed538){return function(){MailQueueEvents[_0xbd1e('0x4')](_0x64ce01,_0xbed538);};}exports[_0xbd1e('0x5')]=function(_0x3d5105){for(var _0x47a483=0x0,_0x4a5e0b=events[_0xbd1e('0x6')];_0x47a483<_0x4a5e0b;_0x47a483++){var _0x3934dc=events[_0x47a483];var _0x36776c=createListener(_0xbd1e('0x7')+_0x3934dc,_0x3d5105);MailQueueEvents['on'](_0x3934dc,_0x36776c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 5916532..8a300d6 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 _0xd76e=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x7ef52,_0x276d61){var _0x539884=function(_0x513e6d){while(--_0x513e6d){_0x7ef52['push'](_0x7ef52['shift']());}};_0x539884(++_0x276d61);}(_0xd76e,0x108));var _0xed76=function(_0x4a6421,_0x4ea396){_0x4a6421=_0x4a6421-0x0;var _0x57a5e8=_0xd76e[_0x4a6421];return _0x57a5e8;};'use strict';var multer=require(_0xed76('0x0'));var util=require('util');var path=require(_0xed76('0x1'));var timeout=require(_0xed76('0x2'));var express=require(_0xed76('0x3'));var router=express['Router']();var fs_extra=require(_0xed76('0x4'));var auth=require(_0xed76('0x5'));var interaction=require(_0xed76('0x6'));var config=require(_0xed76('0x7'));var controller=require(_0xed76('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xed76('0x9')]);router[_0xed76('0xa')](_0xed76('0xb'),auth[_0xed76('0xc')](),controller[_0xed76('0xd')]);router['get'](_0xed76('0xe'),auth[_0xed76('0xc')](),controller[_0xed76('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xed76('0x10')]);router[_0xed76('0x11')](_0xed76('0xe'),auth[_0xed76('0xc')](),controller[_0xed76('0x12')]);router[_0xed76('0x13')](_0xed76('0xe'),auth['isAuthenticated'](),controller[_0xed76('0x14')]);module[_0xed76('0x15')]=router; \ No newline at end of file +var _0x0c5b=['isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4d3bf5,_0x3389f3){var _0x393ef0=function(_0x2ba9eb){while(--_0x2ba9eb){_0x4d3bf5['push'](_0x4d3bf5['shift']());}};_0x393ef0(++_0x3389f3);}(_0x0c5b,0x6f));var _0xb0c5=function(_0x3b4ac3,_0x2a0e41){_0x3b4ac3=_0x3b4ac3-0x0;var _0x1a6ee1=_0x0c5b[_0x3b4ac3];return _0x1a6ee1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb0c5('0x0'));var timeout=require(_0xb0c5('0x1'));var express=require(_0xb0c5('0x2'));var router=express[_0xb0c5('0x3')]();var fs_extra=require(_0xb0c5('0x4'));var auth=require(_0xb0c5('0x5'));var interaction=require(_0xb0c5('0x6'));var config=require(_0xb0c5('0x7'));var controller=require('./mailQueueReport.controller');router[_0xb0c5('0x8')]('/',auth[_0xb0c5('0x9')](),controller['index']);router['get'](_0xb0c5('0xa'),auth[_0xb0c5('0x9')](),controller['describe']);router['get'](_0xb0c5('0xb'),auth[_0xb0c5('0x9')](),controller[_0xb0c5('0xc')]);router[_0xb0c5('0xd')]('/',auth['isAuthenticated'](),controller[_0xb0c5('0xe')]);router[_0xb0c5('0xf')](_0xb0c5('0xb'),auth[_0xb0c5('0x9')](),controller[_0xb0c5('0x10')]);router[_0xb0c5('0x11')](_0xb0c5('0xb'),auth[_0xb0c5('0x9')](),controller[_0xb0c5('0x12')]);module[_0xb0c5('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a277cd0..2f7bbff 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 _0xb23c=['STRING','DATE','moment'];(function(_0x552f5b,_0x1e97a8){var _0x3c2cd2=function(_0x2229da){while(--_0x2229da){_0x552f5b['push'](_0x552f5b['shift']());}};_0x3c2cd2(++_0x1e97a8);}(_0xb23c,0x80));var _0xcb23=function(_0x10825c,_0x41e74b){_0x10825c=_0x10825c-0x0;var _0xfb968f=_0xb23c[_0x10825c];return _0xfb968f;};'use strict';var moment=require(_0xcb23('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xcb23('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xcb23('0x1')]},'joinAt':{'type':Sequelize[_0xcb23('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xcb23('0x2')]},'exitAt':{'type':Sequelize[_0xcb23('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xce5f=['STRING','DATE','moment','sequelize'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0xce5f,0x152));var _0xfce5=function(_0x18b2b6,_0x339e5a){_0x18b2b6=_0x18b2b6-0x0;var _0x5d94ca=_0xce5f[_0x18b2b6];return _0x5d94ca;};'use strict';var moment=require(_0xfce5('0x0'));var Sequelize=require(_0xfce5('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xfce5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfce5('0x3')]},'leaveAt':{'type':Sequelize[_0xfce5('0x3')]},'acceptAt':{'type':Sequelize[_0xfce5('0x3')]},'exitAt':{'type':Sequelize[_0xfce5('0x3')]},'reason':{'type':Sequelize[_0xfce5('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 72bc50b..c2c79f7 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 _0x6d38=['findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0xb5fc3e,_0x234703){var _0x2efc3c=function(_0x4e4e44){while(--_0x4e4e44){_0xb5fc3e['push'](_0xb5fc3e['shift']());}};_0x2efc3c(++_0x234703);}(_0x6d38,0x1ef));var _0x86d3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6d38[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['MailQueueReport'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':!![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));};exports['describe']=function(_0x5bedc6,_0x159253){return db[_0x86d3('0x26')][_0x86d3('0x44')]()[_0x86d3('0x20')](respondWithResult(_0x159253,null))[_0x86d3('0x40')](handleError(_0x159253,null));}; \ No newline at end of file +var _0xd943=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','MailQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto'];(function(_0x5b36ee,_0x1c9acc){var _0x272bda=function(_0x2c8e2e){while(--_0x2c8e2e){_0x5b36ee['push'](_0x5b36ee['shift']());}};_0x272bda(++_0x1c9acc);}(_0xd943,0x15d));var _0x3d94=function(_0xb5899f,_0x543fd0){_0xb5899f=_0xb5899f-0x0;var _0x4a0d00=_0xd943[_0xb5899f];return _0x4a0d00;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':!![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));};exports[_0x3d94('0x47')]=function(_0x4af4c2,_0x255630){return db['MailQueueReport']['describe']()[_0x3d94('0x22')](respondWithResult(_0x255630,null))['catch'](handleError(_0x255630,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 4be2ae0..f6469fc 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 _0xf742=['define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','exports'];(function(_0x595324,_0x5c25fc){var _0x506510=function(_0x52bc6f){while(--_0x52bc6f){_0x595324['push'](_0x595324['shift']());}};_0x506510(++_0x5c25fc);}(_0xf742,0x18a));var _0x2f74=function(_0x3505d3,_0x58291b){_0x3505d3=_0x3505d3-0x0;var _0x9b9830=_0xf742[_0x3505d3];return _0x9b9830;};'use strict';var _=require(_0x2f74('0x0'));var util=require(_0x2f74('0x1'));var logger=require(_0x2f74('0x2'))(_0x2f74('0x3'));var moment=require(_0x2f74('0x4'));var BPromise=require(_0x2f74('0x5'));var rp=require(_0x2f74('0x6'));var fs=require('fs');var path=require(_0x2f74('0x7'));var rimraf=require(_0x2f74('0x8'));var config=require('../../config/environment');var attributes=require(_0x2f74('0x9'));module[_0x2f74('0xa')]=function(_0xe1433d,_0x4e5c7e){return _0xe1433d[_0x2f74('0xb')](_0x2f74('0xc'),attributes,{'tableName':_0x2f74('0xd'),'paranoid':![],'indexes':[{'name':_0x2f74('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x763a=['define','uniqueid','util','api','moment','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x31b0d6,_0x4b0b45){var _0x52505a=function(_0x1d0356){while(--_0x1d0356){_0x31b0d6['push'](_0x31b0d6['shift']());}};_0x52505a(++_0x4b0b45);}(_0x763a,0x158));var _0xa763=function(_0x3e2215,_0x4768e3){_0x3e2215=_0x3e2215-0x0;var _0x8bb702=_0x763a[_0x3e2215];return _0x8bb702;};'use strict';var _=require('lodash');var util=require(_0xa763('0x0'));var logger=require('../../config/logger')(_0xa763('0x1'));var moment=require(_0xa763('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa763('0x3'));var rimraf=require(_0xa763('0x4'));var config=require(_0xa763('0x5'));var attributes=require(_0xa763('0x6'));module['exports']=function(_0x43c522,_0x454d20){return _0x43c522[_0xa763('0x7')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa763('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a72039d..695d947 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x1d196d,_0xc065a){var _0xce8436=function(_0x237a51){while(--_0x237a51){_0x1d196d['push'](_0x1d196d['shift']());}};_0xce8436(++_0xc065a);}(_0x7a54,0x106));var _0x47a5=function(_0x60a2bd,_0x46e73a){_0x60a2bd=_0x60a2bd-0x0;var _0x53b1e2=_0x7a54[_0x60a2bd];return _0x53b1e2;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=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')]('CreateMailQueueReport',_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')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +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(_0x152e2d,_0x3b870a){var _0x3c08bf=function(_0x4eb67a){while(--_0x4eb67a){_0x152e2d['push'](_0x152e2d['shift']());}};_0x3c08bf(++_0x3b870a);}(_0x1261,0x144));var _0x1126=function(_0xae1364,_0x44863f){_0xae1364=_0xae1364-0x0;var _0x55104f=_0x1261[_0xae1364];return _0x55104f;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 42bc347..da61e09 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1fb4ff,_0x172d25){var _0x3f2d20=function(_0x358d44){while(--_0x358d44){_0x1fb4ff['push'](_0x1fb4ff['shift']());}};_0x3f2d20(++_0x172d25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x4b5946,_0x56bfed){var _0x1117ab=function(_0x7507ab){while(--_0x7507ab){_0x4b5946['push'](_0x4b5946['shift']());}};_0x1117ab(++_0x56bfed);}(_0xe706,0xa3));var _0x6e70=function(_0x57172c,_0x1df512){_0x57172c=_0x57172c-0x0;var _0x38e8a4=_0xe706[_0x57172c];return _0x38e8a4;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 4ea72e8..cd4c2d0 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 _0x0db9=['STRING','INTEGER','INBOX','sequelize','BOOLEAN'];(function(_0x485201,_0x3c533a){var _0x9ca98a=function(_0x418ef0){while(--_0x418ef0){_0x485201['push'](_0x485201['shift']());}};_0x9ca98a(++_0x3c533a);}(_0x0db9,0xa3));var _0x90db=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x0db9[_0x5a3cf0];return _0x5a64ee;};'use strict';var Sequelize=require(_0x90db('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x90db('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x90db('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x90db('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x90db('0x2')],'defaultValue':_0x90db('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x90db('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x90db('0x2')]}}; \ No newline at end of file +var _0x6cb4=['BOOLEAN','INTEGER','INBOX','sequelize','exports','STRING'];(function(_0x4b06d7,_0x401757){var _0xb0fab7=function(_0x697341){while(--_0x697341){_0x4b06d7['push'](_0x4b06d7['shift']());}};_0xb0fab7(++_0x401757);}(_0x6cb4,0xff));var _0x46cb=function(_0x552f5e,_0x4810f9){_0x552f5e=_0x552f5e-0x0;var _0x249584=_0x6cb4[_0x552f5e];return _0x249584;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'description':{'type':Sequelize[_0x46cb('0x2')]},'host':{'type':Sequelize[_0x46cb('0x2')]},'authentication':{'type':Sequelize[_0x46cb('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x46cb('0x2')]},'password':{'type':Sequelize[_0x46cb('0x2')]},'port':{'type':Sequelize[_0x46cb('0x4')]},'tls':{'type':Sequelize[_0x46cb('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x46cb('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 9509387..314c64c 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 _0xbea4=['MailServerIn','mail_servers_in','lodash','../../config/logger','moment','bluebird','request-promise','path','./mailServerIn.attributes','exports','define'];(function(_0x75135b,_0x5d5b27){var _0x9df99d=function(_0xf5bd05){while(--_0xf5bd05){_0x75135b['push'](_0x75135b['shift']());}};_0x9df99d(++_0x5d5b27);}(_0xbea4,0x16d));var _0x4bea=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xbea4[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x4bea('0x0'));var util=require('util');var logger=require(_0x4bea('0x1'))('api');var moment=require(_0x4bea('0x2'));var BPromise=require(_0x4bea('0x3'));var rp=require(_0x4bea('0x4'));var fs=require('fs');var path=require(_0x4bea('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4bea('0x6'));module[_0x4bea('0x7')]=function(_0x203086,_0x1f8575){return _0x203086[_0x4bea('0x8')](_0x4bea('0x9'),attributes,{'tableName':_0x4bea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73ec=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc48607,_0x404775){var _0x5f2fc1=function(_0x345f4e){while(--_0x345f4e){_0xc48607['push'](_0xc48607['shift']());}};_0x5f2fc1(++_0x404775);}(_0x73ec,0xae));var _0xc73e=function(_0x3ffb94,_0x47d648){_0x3ffb94=_0x3ffb94-0x0;var _0x4f10f0=_0x73ec[_0x3ffb94];return _0x4f10f0;};'use strict';var _=require('lodash');var util=require(_0xc73e('0x0'));var logger=require(_0xc73e('0x1'))(_0xc73e('0x2'));var moment=require(_0xc73e('0x3'));var BPromise=require(_0xc73e('0x4'));var rp=require(_0xc73e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc73e('0x6'));var config=require(_0xc73e('0x7'));var attributes=require(_0xc73e('0x8'));module[_0xc73e('0x9')]=function(_0x341423,_0x2eb24a){return _0x341423[_0xc73e('0xa')](_0xc73e('0xb'),attributes,{'tableName':'mail_servers_in','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 544bbe3..44e34a6 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 _0x61ea=['MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailServerIn','findAll','options','where','attributes','limit','include','map','model','then','GetMailServerIn','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','info'];(function(_0x331ccd,_0x538e12){var _0x5b5ad6=function(_0x266483){while(--_0x266483){_0x331ccd['push'](_0x331ccd['shift']());}};_0x5b5ad6(++_0x538e12);}(_0x61ea,0x1d5));var _0xa61e=function(_0xfaa89d,_0x430937){_0xfaa89d=_0xfaa89d-0x0;var _0x2082a3=_0x61ea[_0xfaa89d];return _0x2082a3;};'use strict';var _=require(_0xa61e('0x0'));var util=require(_0xa61e('0x1'));var moment=require(_0xa61e('0x2'));var BPromise=require(_0xa61e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa61e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa61e('0x5'))('rpc');var config=require(_0xa61e('0x6'));var jayson=require(_0xa61e('0x7'));var client=jayson[_0xa61e('0x8')][_0xa61e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x300494,_0x1776c0,_0x6b0d76){return new BPromise(function(_0x178086,_0x1b5d56){return client['request'](_0x300494,_0x6b0d76)['then'](function(_0x54d595){logger[_0xa61e('0xa')](_0xa61e('0xb'),_0x1776c0,_0xa61e('0xc'));logger[_0xa61e('0xd')](_0xa61e('0xe'),_0x1776c0,_0xa61e('0xc'),JSON[_0xa61e('0xf')](_0x54d595));if(_0x54d595['error']){if(_0x54d595[_0xa61e('0x10')][_0xa61e('0x11')]===0x1f4){logger[_0xa61e('0x10')]('MailServerIn,\x20%s,\x20%s',_0x1776c0,_0x54d595[_0xa61e('0x10')]['message']);return _0x1b5d56(_0x54d595['error'][_0xa61e('0x12')]);}logger[_0xa61e('0x10')](_0xa61e('0xb'),_0x1776c0,_0x54d595[_0xa61e('0x10')][_0xa61e('0x12')]);return _0x178086(_0x54d595['error'][_0xa61e('0x12')]);}else{logger[_0xa61e('0xa')]('MailServerIn,\x20%s,\x20%s',_0x1776c0,_0xa61e('0xc'));_0x178086(_0x54d595[_0xa61e('0x13')][_0xa61e('0x12')]);}})[_0xa61e('0x14')](function(_0x2c13d7){logger[_0xa61e('0x10')](_0xa61e('0xb'),_0x1776c0,_0x2c13d7);_0x1b5d56(_0x2c13d7);});});}exports['GetMailServerIn']=function(_0x46886c){var _0x4c58b4=this;return new Promise(function(_0x17bea4,_0x190dce){return db[_0xa61e('0x15')][_0xa61e('0x16')]({'raw':_0x46886c['options']?_0x46886c[_0xa61e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x46886c[_0xa61e('0x17')]?_0x46886c['options'][_0xa61e('0x18')]||null:null,'attributes':_0x46886c[_0xa61e('0x17')]?_0x46886c['options'][_0xa61e('0x19')]||null:null,'limit':_0x46886c[_0xa61e('0x17')]?_0x46886c[_0xa61e('0x17')][_0xa61e('0x1a')]||null:null,'include':_0x46886c[_0xa61e('0x17')]?_0x46886c[_0xa61e('0x17')][_0xa61e('0x1b')]?_[_0xa61e('0x1c')](_0x46886c['options']['include'],function(_0x20703a){return{'model':db[_0x20703a[_0xa61e('0x1d')]],'as':_0x20703a['as'],'attributes':_0x20703a['attributes'],'include':_0x20703a[_0xa61e('0x1b')]?_['map'](_0x20703a[_0xa61e('0x1b')],function(_0x4bd699){return{'model':db[_0x4bd699[_0xa61e('0x1d')]],'as':_0x4bd699['as'],'attributes':_0x4bd699['attributes'],'include':_0x4bd699['include']?_[_0xa61e('0x1c')](_0x4bd699[_0xa61e('0x1b')],function(_0x23a042){return{'model':db[_0x23a042[_0xa61e('0x1d')]],'as':_0x23a042['as'],'attributes':_0x23a042[_0xa61e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa61e('0x1e')](function(_0x4a37cf){logger[_0xa61e('0xa')](_0xa61e('0x1f'),_0x46886c);logger['debug'](_0xa61e('0x1f'),_0x46886c,JSON[_0xa61e('0xf')](_0x4a37cf));_0x17bea4(_0x4a37cf);})[_0xa61e('0x14')](function(_0x209223){logger[_0xa61e('0x10')](_0xa61e('0x1f'),_0x209223[_0xa61e('0x12')],_0x46886c);_0x190dce(_0x4c58b4['error'](0x1f4,_0x209223[_0xa61e('0x12')]));});});}; \ No newline at end of file +var _0x56ce=['../../config/utils','../../config/logger','rpc','client','request','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','MailServerIn','findAll','options','raw','where','include','attributes','model','map','GetMailServerIn','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x56ce,0x1e9));var _0xe56c=function(_0x58d006,_0x4ae558){_0x58d006=_0x58d006-0x0;var _0x445d94=_0x56ce[_0x58d006];return _0x445d94;};'use strict';var _=require(_0xe56c('0x0'));var util=require('util');var moment=require(_0xe56c('0x1'));var BPromise=require(_0xe56c('0x2'));var rs=require(_0xe56c('0x3'));var fs=require('fs');var Redis=require(_0xe56c('0x4'));var db=require(_0xe56c('0x5'))['db'];var utils=require(_0xe56c('0x6'));var logger=require(_0xe56c('0x7'))(_0xe56c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe56c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12dac0,_0xb90391,_0x375508){return new BPromise(function(_0x29fc69,_0x3cfb95){return client[_0xe56c('0xa')](_0x12dac0,_0x375508)[_0xe56c('0xb')](function(_0x263812){logger[_0xe56c('0xc')]('MailServerIn,\x20%s,\x20%s',_0xb90391,'request\x20sent');logger[_0xe56c('0xd')](_0xe56c('0xe'),_0xb90391,_0xe56c('0xf'),JSON[_0xe56c('0x10')](_0x263812));if(_0x263812[_0xe56c('0x11')]){if(_0x263812[_0xe56c('0x11')][_0xe56c('0x12')]===0x1f4){logger[_0xe56c('0x11')](_0xe56c('0x13'),_0xb90391,_0x263812[_0xe56c('0x11')][_0xe56c('0x14')]);return _0x3cfb95(_0x263812[_0xe56c('0x11')][_0xe56c('0x14')]);}logger[_0xe56c('0x11')]('MailServerIn,\x20%s,\x20%s',_0xb90391,_0x263812['error'][_0xe56c('0x14')]);return _0x29fc69(_0x263812[_0xe56c('0x11')][_0xe56c('0x14')]);}else{logger[_0xe56c('0xc')]('MailServerIn,\x20%s,\x20%s',_0xb90391,'request\x20sent');_0x29fc69(_0x263812[_0xe56c('0x15')]['message']);}})[_0xe56c('0x16')](function(_0x499f8a){logger['error'](_0xe56c('0x13'),_0xb90391,_0x499f8a);_0x3cfb95(_0x499f8a);});});}exports['GetMailServerIn']=function(_0x3d80bb){var _0x32db0f=this;return new Promise(function(_0x462431,_0x1fb35d){return db[_0xe56c('0x17')][_0xe56c('0x18')]({'raw':_0x3d80bb[_0xe56c('0x19')]?_0x3d80bb[_0xe56c('0x19')][_0xe56c('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d80bb['options']?_0x3d80bb[_0xe56c('0x19')][_0xe56c('0x1b')]||null:null,'attributes':_0x3d80bb[_0xe56c('0x19')]?_0x3d80bb[_0xe56c('0x19')]['attributes']||null:null,'limit':_0x3d80bb[_0xe56c('0x19')]?_0x3d80bb[_0xe56c('0x19')]['limit']||null:null,'include':_0x3d80bb[_0xe56c('0x19')]?_0x3d80bb[_0xe56c('0x19')][_0xe56c('0x1c')]?_['map'](_0x3d80bb[_0xe56c('0x19')]['include'],function(_0x188c49){return{'model':db[_0x188c49['model']],'as':_0x188c49['as'],'attributes':_0x188c49[_0xe56c('0x1d')],'include':_0x188c49[_0xe56c('0x1c')]?_['map'](_0x188c49[_0xe56c('0x1c')],function(_0xd96297){return{'model':db[_0xd96297[_0xe56c('0x1e')]],'as':_0xd96297['as'],'attributes':_0xd96297[_0xe56c('0x1d')],'include':_0xd96297[_0xe56c('0x1c')]?_[_0xe56c('0x1f')](_0xd96297[_0xe56c('0x1c')],function(_0x33fc5d){return{'model':db[_0x33fc5d['model']],'as':_0x33fc5d['as'],'attributes':_0x33fc5d[_0xe56c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe56c('0xb')](function(_0x5473d5){logger[_0xe56c('0xc')](_0xe56c('0x20'),_0x3d80bb);logger[_0xe56c('0xd')](_0xe56c('0x20'),_0x3d80bb,JSON[_0xe56c('0x10')](_0x5473d5));_0x462431(_0x5473d5);})[_0xe56c('0x16')](function(_0x6336a){logger['error']('GetMailServerIn',_0x6336a['message'],_0x3d80bb);_0x1fb35d(_0x32db0f[_0xe56c('0x11')](0x1f4,_0x6336a[_0xe56c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 1b1662d..04655cc 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 6f140d7..6cb7eeb 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 _0x23f9=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x23f9,0x150));var _0x923f=function(_0x39ad5d,_0x4fc635){_0x39ad5d=_0x39ad5d-0x0;var _0x3e0b07=_0x23f9[_0x39ad5d];return _0x3e0b07;};'use strict';var Sequelize=require(_0x923f('0x0'));module[_0x923f('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x923f('0x2')]},'pass':{'type':Sequelize[_0x923f('0x2')]},'port':{'type':Sequelize[_0x923f('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x923f('0x2')]},'authentication':{'type':Sequelize[_0x923f('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0415=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x11520d,_0x1adbdc){var _0x197fbf=function(_0x5cb3fd){while(--_0x5cb3fd){_0x11520d['push'](_0x11520d['shift']());}};_0x197fbf(++_0x1adbdc);}(_0x0415,0x12d));var _0x5041=function(_0x3ebe1e,_0x305156){_0x3ebe1e=_0x3ebe1e-0x0;var _0x43b079=_0x0415[_0x3ebe1e];return _0x43b079;};'use strict';var Sequelize=require(_0x5041('0x0'));module[_0x5041('0x1')]={'description':{'type':Sequelize[_0x5041('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x5041('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x5041('0x3')]},'secure':{'type':Sequelize[_0x5041('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x5041('0x2')]},'authentication':{'type':Sequelize[_0x5041('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 0505c51..2c9fa2e 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 _0xee9c=['key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','params','options','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','error','name','index','map','MailServerOut','rawAttributes','fieldName','type'];(function(_0x37c5af,_0x523e57){var _0x3246ad=function(_0x472d69){while(--_0x472d69){_0x37c5af['push'](_0x37c5af['shift']());}};_0x3246ad(++_0x523e57);}(_0xee9c,0x183));var _0xcee9=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xee9c[_0x1399d6];return _0x4a9db4;};'use strict';var emlformat=require(_0xcee9('0x0'));var rimraf=require(_0xcee9('0x1'));var zipdir=require(_0xcee9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcee9('0x3'));var moment=require(_0xcee9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcee9('0x5'));var util=require(_0xcee9('0x6'));var path=require(_0xcee9('0x7'));var sox=require(_0xcee9('0x8'));var csv=require(_0xcee9('0x9'));var ejs=require(_0xcee9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcee9('0xb'));var squel=require(_0xcee9('0xc'));var crypto=require(_0xcee9('0xd'));var jsforce=require(_0xcee9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcee9('0x9'));var querystring=require('querystring');var Papa=require(_0xcee9('0xf'));var Redis=require(_0xcee9('0x10'));var authService=require(_0xcee9('0x11'));var qs=require(_0xcee9('0x12'));var as=require(_0xcee9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcee9('0x14'));var utils=require(_0xcee9('0x15'));var config=require(_0xcee9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcee9('0x17'))['db'];function respondWithStatusCode(_0x1e2f25,_0x3c5fae){_0x3c5fae=_0x3c5fae||0xcc;return function(_0x31ce8e){if(_0x31ce8e){return _0x1e2f25['sendStatus'](_0x3c5fae);}return _0x1e2f25[_0xcee9('0x18')](_0x3c5fae)['end']();};}function respondWithResult(_0x4352d1,_0x1386c5){_0x1386c5=_0x1386c5||0xc8;return function(_0x548d46){if(_0x548d46){return _0x4352d1['status'](_0x1386c5)[_0xcee9('0x19')](_0x548d46);}};}function respondWithFilteredResult(_0x3ac9e6,_0x32c87a){return function(_0x292ec2){if(_0x292ec2){var _0x3cc1a3=typeof _0x32c87a[_0xcee9('0x1a')]===_0xcee9('0x1b')&&typeof _0x32c87a[_0xcee9('0x1c')]===_0xcee9('0x1b');var _0x5a7ca3=_0x292ec2[_0xcee9('0x1d')];var _0x4c6785=_0x3cc1a3?0x0:_0x32c87a[_0xcee9('0x1a')];var _0x594815=_0x3cc1a3?_0x292ec2['count']:_0x32c87a[_0xcee9('0x1a')]+_0x32c87a['limit'];var _0x3c10b7;if(_0x594815>=_0x5a7ca3){_0x594815=_0x5a7ca3;_0x3c10b7=0xc8;}else{_0x3c10b7=0xce;}_0x3ac9e6[_0xcee9('0x18')](_0x3c10b7);return _0x3ac9e6[_0xcee9('0x1e')](_0xcee9('0x1f'),_0x4c6785+'-'+_0x594815+'/'+_0x5a7ca3)[_0xcee9('0x19')](_0x292ec2);}return null;};}function patchUpdates(_0xb56979){return function(_0x313a8d){try{jsonpatch[_0xcee9('0x20')](_0x313a8d,_0xb56979,!![]);}catch(_0x3fe02c){return BPromise[_0xcee9('0x21')](_0x3fe02c);}return _0x313a8d['save']();};}function saveUpdates(_0x233ddf,_0x3e0bd8){return function(_0x4ea7a0){if(_0x4ea7a0){return _0x4ea7a0['update'](_0x233ddf)[_0xcee9('0x22')](function(_0x2e5943){return _0x2e5943;});}return null;};}function removeEntity(_0x1c4734,_0x1b9abd){return function(_0x49c861){if(_0x49c861){return _0x49c861[_0xcee9('0x23')]()[_0xcee9('0x22')](function(){_0x1c4734[_0xcee9('0x18')](0xcc)[_0xcee9('0x24')]();});}};}function handleEntityNotFound(_0x606712,_0x3a4326){return function(_0x5e49e9){if(!_0x5e49e9){_0x606712['sendStatus'](0x194);}return _0x5e49e9;};}function handleError(_0x196c97,_0x177f12){_0x177f12=_0x177f12||0x1f4;return function(_0x1aadca){logger[_0xcee9('0x25')](_0x1aadca['stack']);if(_0x1aadca['name']){delete _0x1aadca[_0xcee9('0x26')];}_0x196c97[_0xcee9('0x18')](_0x177f12)['send'](_0x1aadca);};}exports[_0xcee9('0x27')]=function(_0x198221,_0x251ae8){var _0x4dd38d={},_0x2d78c0={},_0x383509={'count':0x0,'rows':[]};var _0x488075=_[_0xcee9('0x28')](db[_0xcee9('0x29')][_0xcee9('0x2a')],function(_0x12071b){return{'name':_0x12071b[_0xcee9('0x2b')],'type':_0x12071b[_0xcee9('0x2c')][_0xcee9('0x2d')]};});_0x2d78c0['model']=_[_0xcee9('0x28')](_0x488075,'name');_0x2d78c0[_0xcee9('0x2e')]=_[_0xcee9('0x2f')](_0x198221[_0xcee9('0x2e')]);_0x2d78c0[_0xcee9('0x30')]=_[_0xcee9('0x31')](_0x2d78c0['model'],_0x2d78c0[_0xcee9('0x2e')]);_0x4dd38d[_0xcee9('0x32')]=_[_0xcee9('0x31')](_0x2d78c0[_0xcee9('0x33')],qs['fields'](_0x198221[_0xcee9('0x2e')][_0xcee9('0x34')]));_0x4dd38d[_0xcee9('0x32')]=_0x4dd38d[_0xcee9('0x32')][_0xcee9('0x35')]?_0x4dd38d[_0xcee9('0x32')]:_0x2d78c0[_0xcee9('0x33')];if(!_0x198221['query'][_0xcee9('0x36')](_0xcee9('0x37'))){_0x4dd38d[_0xcee9('0x1c')]=qs[_0xcee9('0x1c')](_0x198221[_0xcee9('0x2e')]['limit']);_0x4dd38d[_0xcee9('0x1a')]=qs[_0xcee9('0x1a')](_0x198221[_0xcee9('0x2e')][_0xcee9('0x1a')]);}_0x4dd38d['order']=qs[_0xcee9('0x38')](_0x198221[_0xcee9('0x2e')][_0xcee9('0x38')]);_0x4dd38d['where']=qs[_0xcee9('0x30')](_[_0xcee9('0x39')](_0x198221['query'],_0x2d78c0[_0xcee9('0x30')]),_0x488075);if(_0x198221[_0xcee9('0x2e')][_0xcee9('0x3a')]){_0x4dd38d[_0xcee9('0x3b')]=_[_0xcee9('0x3c')](_0x4dd38d[_0xcee9('0x3b')],{'$or':_[_0xcee9('0x28')](_0x488075,function(_0x54ee77){if(_0x54ee77[_0xcee9('0x2c')]!==_0xcee9('0x3d')){var _0x2cbcd5={};_0x2cbcd5[_0x54ee77['name']]={'$like':'%'+_0x198221[_0xcee9('0x2e')][_0xcee9('0x3a')]+'%'};return _0x2cbcd5;}})});}_0x4dd38d=_[_0xcee9('0x3c')]({},_0x4dd38d,_0x198221['options']);var _0x318d24={'where':_0x4dd38d[_0xcee9('0x3b')]};return db[_0xcee9('0x29')][_0xcee9('0x1d')](_0x318d24)[_0xcee9('0x22')](function(_0x22694d){_0x383509[_0xcee9('0x1d')]=_0x22694d;if(_0x198221[_0xcee9('0x2e')]['includeAll']){_0x4dd38d[_0xcee9('0x3e')]=[{'all':!![]}];}return db[_0xcee9('0x29')][_0xcee9('0x3f')](_0x4dd38d);})[_0xcee9('0x22')](function(_0x15bf94){_0x383509[_0xcee9('0x40')]=_0x15bf94;return _0x383509;})[_0xcee9('0x22')](respondWithFilteredResult(_0x251ae8,_0x4dd38d))[_0xcee9('0x41')](handleError(_0x251ae8,null));};exports['show']=function(_0x4e5716,_0x5bbc23){var _0x409829={'raw':!![],'where':{'id':_0x4e5716[_0xcee9('0x42')]['id']}},_0x1dfef3={};_0x1dfef3[_0xcee9('0x33')]=_[_0xcee9('0x2f')](db[_0xcee9('0x29')][_0xcee9('0x2a')]);_0x1dfef3['query']=_[_0xcee9('0x2f')](_0x4e5716[_0xcee9('0x2e')]);_0x1dfef3[_0xcee9('0x30')]=_['intersection'](_0x1dfef3[_0xcee9('0x33')],_0x1dfef3[_0xcee9('0x2e')]);_0x409829['attributes']=_[_0xcee9('0x31')](_0x1dfef3[_0xcee9('0x33')],qs[_0xcee9('0x34')](_0x4e5716[_0xcee9('0x2e')]['fields']));_0x409829[_0xcee9('0x32')]=_0x409829[_0xcee9('0x32')][_0xcee9('0x35')]?_0x409829[_0xcee9('0x32')]:_0x1dfef3[_0xcee9('0x33')];if(_0x4e5716[_0xcee9('0x2e')]['includeAll']){_0x409829[_0xcee9('0x3e')]=[{'all':!![]}];}_0x409829=_[_0xcee9('0x3c')]({},_0x409829,_0x4e5716[_0xcee9('0x43')]);return db[_0xcee9('0x29')][_0xcee9('0x44')](_0x409829)[_0xcee9('0x22')](handleEntityNotFound(_0x5bbc23,null))[_0xcee9('0x22')](respondWithResult(_0x5bbc23,null))[_0xcee9('0x41')](handleError(_0x5bbc23,null));};exports[_0xcee9('0x45')]=function(_0x90ad5,_0x1bd3b7){return db['MailServerOut'][_0xcee9('0x45')](_0x90ad5[_0xcee9('0x46')],{})[_0xcee9('0x22')](respondWithResult(_0x1bd3b7,0xc9))['catch'](handleError(_0x1bd3b7,null));};exports[_0xcee9('0x47')]=function(_0x22944f,_0x414c76){if(_0x22944f[_0xcee9('0x46')]['id']){delete _0x22944f[_0xcee9('0x46')]['id'];}return db[_0xcee9('0x29')][_0xcee9('0x44')]({'where':{'id':_0x22944f[_0xcee9('0x42')]['id']}})[_0xcee9('0x22')](handleEntityNotFound(_0x414c76,null))['then'](saveUpdates(_0x22944f[_0xcee9('0x46')],null))[_0xcee9('0x22')](respondWithResult(_0x414c76,null))['catch'](handleError(_0x414c76,null));};exports['destroy']=function(_0x21afb9,_0x23569c){return db[_0xcee9('0x29')]['find']({'where':{'id':_0x21afb9[_0xcee9('0x42')]['id']}})[_0xcee9('0x22')](handleEntityNotFound(_0x23569c,null))[_0xcee9('0x22')](removeEntity(_0x23569c,null))[_0xcee9('0x41')](handleError(_0x23569c,null));}; \ No newline at end of file +var _0x400b=['length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x440d4c,_0x5ea9e1){var _0x21fba9=function(_0x13d8ce){while(--_0x13d8ce){_0x440d4c['push'](_0x440d4c['shift']());}};_0x21fba9(++_0x5ea9e1);}(_0x400b,0x133));var _0xb400=function(_0x22add5,_0x346816){_0x22add5=_0x22add5-0x0;var _0x39c293=_0x400b[_0x22add5];return _0x39c293;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb400('0x0'));var jsonpatch=require(_0xb400('0x1'));var rp=require(_0xb400('0x2'));var moment=require(_0xb400('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb400('0x4'));var sox=require('sox');var csv=require(_0xb400('0x5'));var ejs=require(_0xb400('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb400('0x7'));var squel=require(_0xb400('0x8'));var crypto=require('crypto');var jsforce=require(_0xb400('0x9'));var deskjs=require(_0xb400('0xa'));var toCsv=require(_0xb400('0x5'));var querystring=require(_0xb400('0xb'));var Papa=require(_0xb400('0xc'));var Redis=require(_0xb400('0xd'));var authService=require(_0xb400('0xe'));var qs=require(_0xb400('0xf'));var as=require(_0xb400('0x10'));var hardwareService=require(_0xb400('0x11'));var logger=require('../../config/logger')(_0xb400('0x12'));var utils=require(_0xb400('0x13'));var config=require(_0xb400('0x14'));var licenseUtil=require(_0xb400('0x15'));var db=require(_0xb400('0x16'))['db'];function respondWithStatusCode(_0x47fd3f,_0x3736e7){_0x3736e7=_0x3736e7||0xcc;return function(_0x18917f){if(_0x18917f){return _0x47fd3f[_0xb400('0x17')](_0x3736e7);}return _0x47fd3f[_0xb400('0x18')](_0x3736e7)[_0xb400('0x19')]();};}function respondWithResult(_0x3e94fc,_0x146f24){_0x146f24=_0x146f24||0xc8;return function(_0x1d6b5d){if(_0x1d6b5d){return _0x3e94fc[_0xb400('0x18')](_0x146f24)[_0xb400('0x1a')](_0x1d6b5d);}};}function respondWithFilteredResult(_0x489b9a,_0x208be1){return function(_0x27660a){if(_0x27660a){var _0x301ef6=typeof _0x208be1[_0xb400('0x1b')]===_0xb400('0x1c')&&typeof _0x208be1[_0xb400('0x1d')]==='undefined';var _0x2da8eb=_0x27660a[_0xb400('0x1e')];var _0x45c03d=_0x301ef6?0x0:_0x208be1[_0xb400('0x1b')];var _0x1d6cdd=_0x301ef6?_0x27660a['count']:_0x208be1[_0xb400('0x1b')]+_0x208be1['limit'];var _0x4c8c3e;if(_0x1d6cdd>=_0x2da8eb){_0x1d6cdd=_0x2da8eb;_0x4c8c3e=0xc8;}else{_0x4c8c3e=0xce;}_0x489b9a[_0xb400('0x18')](_0x4c8c3e);return _0x489b9a['set'](_0xb400('0x1f'),_0x45c03d+'-'+_0x1d6cdd+'/'+_0x2da8eb)[_0xb400('0x1a')](_0x27660a);}return null;};}function patchUpdates(_0x2c7563){return function(_0x2d9f28){try{jsonpatch[_0xb400('0x20')](_0x2d9f28,_0x2c7563,!![]);}catch(_0x5d85f1){return BPromise['reject'](_0x5d85f1);}return _0x2d9f28['save']();};}function saveUpdates(_0x14dc79,_0xe00a5d){return function(_0x48b65f){if(_0x48b65f){return _0x48b65f[_0xb400('0x21')](_0x14dc79)['then'](function(_0x18a00b){return _0x18a00b;});}return null;};}function removeEntity(_0x3b1949,_0x71542a){return function(_0x13db24){if(_0x13db24){return _0x13db24[_0xb400('0x22')]()[_0xb400('0x23')](function(){_0x3b1949[_0xb400('0x18')](0xcc)[_0xb400('0x19')]();});}};}function handleEntityNotFound(_0x435f52,_0x5dea5d){return function(_0x1cf631){if(!_0x1cf631){_0x435f52['sendStatus'](0x194);}return _0x1cf631;};}function handleError(_0x2be5d8,_0xe07c9b){_0xe07c9b=_0xe07c9b||0x1f4;return function(_0x2be949){logger[_0xb400('0x24')](_0x2be949[_0xb400('0x25')]);if(_0x2be949[_0xb400('0x26')]){delete _0x2be949[_0xb400('0x26')];}_0x2be5d8[_0xb400('0x18')](_0xe07c9b)[_0xb400('0x27')](_0x2be949);};}exports[_0xb400('0x28')]=function(_0x59192f,_0x1eb255){var _0x65e3be={},_0x352aea={},_0x41132d={'count':0x0,'rows':[]};var _0x4d8108=_[_0xb400('0x29')](db[_0xb400('0x2a')][_0xb400('0x2b')],function(_0x350e36){return{'name':_0x350e36['fieldName'],'type':_0x350e36[_0xb400('0x2c')][_0xb400('0x2d')]};});_0x352aea[_0xb400('0x2e')]=_[_0xb400('0x29')](_0x4d8108,_0xb400('0x26'));_0x352aea[_0xb400('0x2f')]=_[_0xb400('0x30')](_0x59192f['query']);_0x352aea[_0xb400('0x31')]=_[_0xb400('0x32')](_0x352aea[_0xb400('0x2e')],_0x352aea[_0xb400('0x2f')]);_0x65e3be[_0xb400('0x33')]=_[_0xb400('0x32')](_0x352aea['model'],qs['fields'](_0x59192f[_0xb400('0x2f')][_0xb400('0x34')]));_0x65e3be['attributes']=_0x65e3be[_0xb400('0x33')][_0xb400('0x35')]?_0x65e3be[_0xb400('0x33')]:_0x352aea[_0xb400('0x2e')];if(!_0x59192f[_0xb400('0x2f')]['hasOwnProperty'](_0xb400('0x36'))){_0x65e3be[_0xb400('0x1d')]=qs[_0xb400('0x1d')](_0x59192f['query']['limit']);_0x65e3be['offset']=qs[_0xb400('0x1b')](_0x59192f[_0xb400('0x2f')][_0xb400('0x1b')]);}_0x65e3be[_0xb400('0x37')]=qs[_0xb400('0x38')](_0x59192f[_0xb400('0x2f')]['sort']);_0x65e3be[_0xb400('0x39')]=qs['filters'](_[_0xb400('0x3a')](_0x59192f[_0xb400('0x2f')],_0x352aea[_0xb400('0x31')]),_0x4d8108);if(_0x59192f[_0xb400('0x2f')][_0xb400('0x3b')]){_0x65e3be[_0xb400('0x39')]=_['merge'](_0x65e3be[_0xb400('0x39')],{'$or':_[_0xb400('0x29')](_0x4d8108,function(_0x5d3c4f){if(_0x5d3c4f['type']!==_0xb400('0x3c')){var _0x37cac1={};_0x37cac1[_0x5d3c4f[_0xb400('0x26')]]={'$like':'%'+_0x59192f[_0xb400('0x2f')][_0xb400('0x3b')]+'%'};return _0x37cac1;}})});}_0x65e3be=_[_0xb400('0x3d')]({},_0x65e3be,_0x59192f[_0xb400('0x3e')]);var _0x299532={'where':_0x65e3be[_0xb400('0x39')]};return db[_0xb400('0x2a')][_0xb400('0x1e')](_0x299532)[_0xb400('0x23')](function(_0x5b35d6){_0x41132d['count']=_0x5b35d6;if(_0x59192f[_0xb400('0x2f')][_0xb400('0x3f')]){_0x65e3be[_0xb400('0x40')]=[{'all':!![]}];}return db[_0xb400('0x2a')][_0xb400('0x41')](_0x65e3be);})[_0xb400('0x23')](function(_0x3cd816){_0x41132d['rows']=_0x3cd816;return _0x41132d;})[_0xb400('0x23')](respondWithFilteredResult(_0x1eb255,_0x65e3be))['catch'](handleError(_0x1eb255,null));};exports[_0xb400('0x42')]=function(_0x44d58f,_0x5228f4){var _0x5f2a5a={'raw':!![],'where':{'id':_0x44d58f[_0xb400('0x43')]['id']}},_0x1f58b4={};_0x1f58b4[_0xb400('0x2e')]=_[_0xb400('0x30')](db[_0xb400('0x2a')][_0xb400('0x2b')]);_0x1f58b4[_0xb400('0x2f')]=_[_0xb400('0x30')](_0x44d58f['query']);_0x1f58b4['filters']=_['intersection'](_0x1f58b4[_0xb400('0x2e')],_0x1f58b4['query']);_0x5f2a5a[_0xb400('0x33')]=_[_0xb400('0x32')](_0x1f58b4[_0xb400('0x2e')],qs[_0xb400('0x34')](_0x44d58f[_0xb400('0x2f')]['fields']));_0x5f2a5a[_0xb400('0x33')]=_0x5f2a5a['attributes']['length']?_0x5f2a5a[_0xb400('0x33')]:_0x1f58b4[_0xb400('0x2e')];if(_0x44d58f[_0xb400('0x2f')][_0xb400('0x3f')]){_0x5f2a5a['include']=[{'all':!![]}];}_0x5f2a5a=_[_0xb400('0x3d')]({},_0x5f2a5a,_0x44d58f[_0xb400('0x3e')]);return db[_0xb400('0x2a')][_0xb400('0x44')](_0x5f2a5a)[_0xb400('0x23')](handleEntityNotFound(_0x5228f4,null))[_0xb400('0x23')](respondWithResult(_0x5228f4,null))[_0xb400('0x45')](handleError(_0x5228f4,null));};exports[_0xb400('0x46')]=function(_0x1bf218,_0x3b6b7e){return db[_0xb400('0x2a')][_0xb400('0x46')](_0x1bf218[_0xb400('0x47')],{})[_0xb400('0x23')](respondWithResult(_0x3b6b7e,0xc9))[_0xb400('0x45')](handleError(_0x3b6b7e,null));};exports[_0xb400('0x21')]=function(_0xa0ff79,_0x59c135){if(_0xa0ff79[_0xb400('0x47')]['id']){delete _0xa0ff79['body']['id'];}return db[_0xb400('0x2a')][_0xb400('0x44')]({'where':{'id':_0xa0ff79[_0xb400('0x43')]['id']}})[_0xb400('0x23')](handleEntityNotFound(_0x59c135,null))[_0xb400('0x23')](saveUpdates(_0xa0ff79[_0xb400('0x47')],null))['then'](respondWithResult(_0x59c135,null))[_0xb400('0x45')](handleError(_0x59c135,null));};exports['destroy']=function(_0x8a91d0,_0x4e3890){return db[_0xb400('0x2a')][_0xb400('0x44')]({'where':{'id':_0x8a91d0['params']['id']}})[_0xb400('0x23')](handleEntityNotFound(_0x4e3890,null))[_0xb400('0x23')](removeEntity(_0x4e3890,null))[_0xb400('0x45')](handleError(_0x4e3890,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index b85b7ef..f299cd0 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 _0x4554=['define','MailServerOut','mail_servers_out','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x1c4865,_0x163598){var _0x2a3640=function(_0x16e8d8){while(--_0x16e8d8){_0x1c4865['push'](_0x1c4865['shift']());}};_0x2a3640(++_0x163598);}(_0x4554,0x17c));var _0x4455=function(_0x5d54a3,_0x314203){_0x5d54a3=_0x5d54a3-0x0;var _0x381e1f=_0x4554[_0x5d54a3];return _0x381e1f;};'use strict';var _=require(_0x4455('0x0'));var util=require(_0x4455('0x1'));var logger=require('../../config/logger')(_0x4455('0x2'));var moment=require(_0x4455('0x3'));var BPromise=require('bluebird');var rp=require(_0x4455('0x4'));var fs=require('fs');var path=require(_0x4455('0x5'));var rimraf=require(_0x4455('0x6'));var config=require(_0x4455('0x7'));var attributes=require(_0x4455('0x8'));module[_0x4455('0x9')]=function(_0x4390ac,_0x38ccef){return _0x4390ac[_0x4455('0xa')](_0x4455('0xb'),attributes,{'tableName':_0x4455('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ad6=['lodash','util','api','moment','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut'];(function(_0x364b65,_0x18484b){var _0x4e1ae4=function(_0x36cc19){while(--_0x36cc19){_0x364b65['push'](_0x364b65['shift']());}};_0x4e1ae4(++_0x18484b);}(_0x7ad6,0x87));var _0x67ad=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7ad6[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x67ad('0x0'));var util=require(_0x67ad('0x1'));var logger=require('../../config/logger')(_0x67ad('0x2'));var moment=require(_0x67ad('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x67ad('0x4'));var config=require(_0x67ad('0x5'));var attributes=require(_0x67ad('0x6'));module[_0x67ad('0x7')]=function(_0x368080,_0x224ac8){return _0x368080['define'](_0x67ad('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 80e2ee5..b261ad6 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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x52688b,_0x501803){_0x52688b=_0x52688b-0x0;var _0x283cb1=_0x7a54[_0x52688b];return _0x283cb1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x138416,_0x227157){var _0x42e513=function(_0xda3f8f){while(--_0xda3f8f){_0x138416['push'](_0x138416['shift']());}};_0x42e513(++_0x227157);}(_0xdb28,0x106));var _0x8db2=function(_0x1675cd,_0x302bc8){_0x1675cd=_0x1675cd-0x0;var _0x4732c1=_0xdb28[_0x1675cd];return _0x4732c1;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f0f5248..3d5ec1e 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 _0xba50=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','delete'];(function(_0x1a174b,_0x1495ae){var _0x140b43=function(_0x52f87f){while(--_0x52f87f){_0x1a174b['push'](_0x1a174b['shift']());}};_0x140b43(++_0x1495ae);}(_0xba50,0xd4));var _0x0ba5=function(_0x5de10b,_0x5af540){_0x5de10b=_0x5de10b-0x0;var _0x477b4a=_0xba50[_0x5de10b];return _0x477b4a;};'use strict';var multer=require(_0x0ba5('0x0'));var util=require(_0x0ba5('0x1'));var path=require(_0x0ba5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ba5('0x3'));var router=express[_0x0ba5('0x4')]();var fs_extra=require(_0x0ba5('0x5'));var auth=require(_0x0ba5('0x6'));var interaction=require(_0x0ba5('0x7'));var config=require(_0x0ba5('0x8'));var controller=require(_0x0ba5('0x9'));router[_0x0ba5('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0ba5('0xa')](_0x0ba5('0xb'),auth[_0x0ba5('0xc')](),controller['describe']);router['get'](_0x0ba5('0xd'),auth['isAuthenticated'](),controller[_0x0ba5('0xe')]);router[_0x0ba5('0xf')]('/',auth[_0x0ba5('0xc')](),controller[_0x0ba5('0x10')]);router[_0x0ba5('0x11')](_0x0ba5('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0ba5('0x12')](_0x0ba5('0xd'),auth['isAuthenticated'](),controller[_0x0ba5('0x13')]);module[_0x0ba5('0x14')]=router; \ No newline at end of file +var _0x079f=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','show','post','create','put','/:id','delete','destroy'];(function(_0x303bd2,_0x1c640c){var _0x24b1d6=function(_0x536d50){while(--_0x536d50){_0x303bd2['push'](_0x303bd2['shift']());}};_0x24b1d6(++_0x1c640c);}(_0x079f,0x198));var _0xf079=function(_0x528b74,_0xb4471b){_0x528b74=_0x528b74-0x0;var _0x13e688=_0x079f[_0x528b74];return _0x13e688;};'use strict';var multer=require(_0xf079('0x0'));var util=require(_0xf079('0x1'));var path=require(_0xf079('0x2'));var timeout=require(_0xf079('0x3'));var express=require(_0xf079('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf079('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf079('0x6'));var controller=require('./mailSubstatus.controller');router[_0xf079('0x7')]('/',auth[_0xf079('0x8')](),controller['index']);router[_0xf079('0x7')](_0xf079('0x9'),auth[_0xf079('0x8')](),controller['describe']);router[_0xf079('0x7')]('/:id',auth[_0xf079('0x8')](),controller[_0xf079('0xa')]);router[_0xf079('0xb')]('/',auth[_0xf079('0x8')](),controller[_0xf079('0xc')]);router[_0xf079('0xd')](_0xf079('0xe'),auth[_0xf079('0x8')](),controller['update']);router[_0xf079('0xf')](_0xf079('0xe'),auth[_0xf079('0x8')](),controller[_0xf079('0x10')]);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 724d106..fa8fa8e 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b65=['sequelize','exports','STRING','name'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1b65,0x1b4));var _0x51b6=function(_0x125ca2,_0x5ac3d0){_0x125ca2=_0x125ca2-0x0;var _0x402039=_0x1b65[_0x125ca2];return _0x402039;};'use strict';var Sequelize=require(_0x51b6('0x0'));module[_0x51b6('0x1')]={'name':{'type':Sequelize[_0x51b6('0x2')],'unique':_0x51b6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 70ad343..e584990 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 _0x6a3b=['offset','undefined','count','set','Content-Range','apply','update','then','error','name','send','map','MailSubstatus','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x5cee9f,_0x24a8af){var _0x59da29=function(_0x1bcb21){while(--_0x1bcb21){_0x5cee9f['push'](_0x5cee9f['shift']());}};_0x59da29(++_0x24a8af);}(_0x6a3b,0x1a9));var _0xb6a3=function(_0x282d52,_0x123a56){_0x282d52=_0x282d52-0x0;var _0x869137=_0x6a3b[_0x282d52];return _0x869137;};'use strict';var emlformat=require(_0xb6a3('0x0'));var rimraf=require(_0xb6a3('0x1'));var zipdir=require(_0xb6a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6a3('0x3'));var moment=require(_0xb6a3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb6a3('0x5'));var util=require(_0xb6a3('0x6'));var path=require(_0xb6a3('0x7'));var sox=require(_0xb6a3('0x8'));var csv=require(_0xb6a3('0x9'));var ejs=require(_0xb6a3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb6a3('0xb'));var squel=require(_0xb6a3('0xc'));var crypto=require('crypto');var jsforce=require(_0xb6a3('0xd'));var deskjs=require(_0xb6a3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb6a3('0xf'));var Papa=require(_0xb6a3('0x10'));var Redis=require(_0xb6a3('0x11'));var authService=require(_0xb6a3('0x12'));var qs=require(_0xb6a3('0x13'));var as=require(_0xb6a3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6a3('0x15'))(_0xb6a3('0x16'));var utils=require(_0xb6a3('0x17'));var config=require(_0xb6a3('0x18'));var licenseUtil=require(_0xb6a3('0x19'));var db=require(_0xb6a3('0x1a'))['db'];function respondWithStatusCode(_0x5331dd,_0x4eb9db){_0x4eb9db=_0x4eb9db||0xcc;return function(_0x1e132f){if(_0x1e132f){return _0x5331dd[_0xb6a3('0x1b')](_0x4eb9db);}return _0x5331dd[_0xb6a3('0x1c')](_0x4eb9db)[_0xb6a3('0x1d')]();};}function respondWithResult(_0x185555,_0x149c45){_0x149c45=_0x149c45||0xc8;return function(_0x20e29c){if(_0x20e29c){return _0x185555[_0xb6a3('0x1c')](_0x149c45)[_0xb6a3('0x1e')](_0x20e29c);}};}function respondWithFilteredResult(_0x1b99ca,_0x2fff74){return function(_0x41125b){if(_0x41125b){var _0x24d3ff=typeof _0x2fff74[_0xb6a3('0x1f')]===_0xb6a3('0x20')&&typeof _0x2fff74['limit']==='undefined';var _0x464e68=_0x41125b[_0xb6a3('0x21')];var _0x5052ae=_0x24d3ff?0x0:_0x2fff74[_0xb6a3('0x1f')];var _0xce020f=_0x24d3ff?_0x41125b[_0xb6a3('0x21')]:_0x2fff74[_0xb6a3('0x1f')]+_0x2fff74['limit'];var _0x10905e;if(_0xce020f>=_0x464e68){_0xce020f=_0x464e68;_0x10905e=0xc8;}else{_0x10905e=0xce;}_0x1b99ca[_0xb6a3('0x1c')](_0x10905e);return _0x1b99ca[_0xb6a3('0x22')](_0xb6a3('0x23'),_0x5052ae+'-'+_0xce020f+'/'+_0x464e68)['json'](_0x41125b);}return null;};}function patchUpdates(_0x569269){return function(_0x10bff1){try{jsonpatch[_0xb6a3('0x24')](_0x10bff1,_0x569269,!![]);}catch(_0x24f9bb){return BPromise['reject'](_0x24f9bb);}return _0x10bff1['save']();};}function saveUpdates(_0x250e5c,_0x1ba813){return function(_0x38cbde){if(_0x38cbde){return _0x38cbde[_0xb6a3('0x25')](_0x250e5c)[_0xb6a3('0x26')](function(_0x31b802){return _0x31b802;});}return null;};}function removeEntity(_0x5926e1,_0x1d1da4){return function(_0x2254b0){if(_0x2254b0){return _0x2254b0['destroy']()[_0xb6a3('0x26')](function(){_0x5926e1[_0xb6a3('0x1c')](0xcc)[_0xb6a3('0x1d')]();});}};}function handleEntityNotFound(_0x3d2923,_0x1b790d){return function(_0x5b2582){if(!_0x5b2582){_0x3d2923[_0xb6a3('0x1b')](0x194);}return _0x5b2582;};}function handleError(_0x169626,_0x5a3a30){_0x5a3a30=_0x5a3a30||0x1f4;return function(_0x31b8a){logger[_0xb6a3('0x27')](_0x31b8a['stack']);if(_0x31b8a[_0xb6a3('0x28')]){delete _0x31b8a[_0xb6a3('0x28')];}_0x169626[_0xb6a3('0x1c')](_0x5a3a30)[_0xb6a3('0x29')](_0x31b8a);};}exports['index']=function(_0x4a7eee,_0x25bc17){var _0x16d1f0={},_0x161f23={},_0x496e0f={'count':0x0,'rows':[]};var _0x2f7d15=_[_0xb6a3('0x2a')](db[_0xb6a3('0x2b')][_0xb6a3('0x2c')],function(_0x399f06){return{'name':_0x399f06[_0xb6a3('0x2d')],'type':_0x399f06[_0xb6a3('0x2e')][_0xb6a3('0x2f')]};});_0x161f23['model']=_[_0xb6a3('0x2a')](_0x2f7d15,'name');_0x161f23[_0xb6a3('0x30')]=_['keys'](_0x4a7eee[_0xb6a3('0x30')]);_0x161f23['filters']=_[_0xb6a3('0x31')](_0x161f23['model'],_0x161f23[_0xb6a3('0x30')]);_0x16d1f0[_0xb6a3('0x32')]=_['intersection'](_0x161f23[_0xb6a3('0x33')],qs[_0xb6a3('0x34')](_0x4a7eee[_0xb6a3('0x30')][_0xb6a3('0x34')]));_0x16d1f0['attributes']=_0x16d1f0['attributes']['length']?_0x16d1f0[_0xb6a3('0x32')]:_0x161f23[_0xb6a3('0x33')];if(!_0x4a7eee[_0xb6a3('0x30')][_0xb6a3('0x35')]('nolimit')){_0x16d1f0[_0xb6a3('0x36')]=qs[_0xb6a3('0x36')](_0x4a7eee[_0xb6a3('0x30')][_0xb6a3('0x36')]);_0x16d1f0[_0xb6a3('0x1f')]=qs[_0xb6a3('0x1f')](_0x4a7eee[_0xb6a3('0x30')]['offset']);}_0x16d1f0[_0xb6a3('0x37')]=qs[_0xb6a3('0x38')](_0x4a7eee['query'][_0xb6a3('0x38')]);_0x16d1f0[_0xb6a3('0x39')]=qs[_0xb6a3('0x3a')](_[_0xb6a3('0x3b')](_0x4a7eee[_0xb6a3('0x30')],_0x161f23[_0xb6a3('0x3a')]),_0x2f7d15);if(_0x4a7eee['query']['filter']){_0x16d1f0[_0xb6a3('0x39')]=_[_0xb6a3('0x3c')](_0x16d1f0[_0xb6a3('0x39')],{'$or':_[_0xb6a3('0x2a')](_0x2f7d15,function(_0x1abfbc){if(_0x1abfbc['type']!==_0xb6a3('0x3d')){var _0x4114b6={};_0x4114b6[_0x1abfbc['name']]={'$like':'%'+_0x4a7eee[_0xb6a3('0x30')][_0xb6a3('0x3e')]+'%'};return _0x4114b6;}})});}_0x16d1f0=_['merge']({},_0x16d1f0,_0x4a7eee['options']);var _0x362a4d={'where':_0x16d1f0[_0xb6a3('0x39')]};return db[_0xb6a3('0x2b')][_0xb6a3('0x21')](_0x362a4d)[_0xb6a3('0x26')](function(_0x3bbd91){_0x496e0f[_0xb6a3('0x21')]=_0x3bbd91;if(_0x4a7eee[_0xb6a3('0x30')][_0xb6a3('0x3f')]){_0x16d1f0[_0xb6a3('0x40')]=[{'all':!![]}];}return db[_0xb6a3('0x2b')][_0xb6a3('0x41')](_0x16d1f0);})[_0xb6a3('0x26')](function(_0x3966cc){_0x496e0f[_0xb6a3('0x42')]=_0x3966cc;return _0x496e0f;})[_0xb6a3('0x26')](respondWithFilteredResult(_0x25bc17,_0x16d1f0))[_0xb6a3('0x43')](handleError(_0x25bc17,null));};exports[_0xb6a3('0x44')]=function(_0x56d537,_0x2b2857){var _0x28d3db={'raw':!![],'where':{'id':_0x56d537[_0xb6a3('0x45')]['id']}},_0x4143f7={};_0x4143f7[_0xb6a3('0x33')]=_['keys'](db[_0xb6a3('0x2b')][_0xb6a3('0x2c')]);_0x4143f7[_0xb6a3('0x30')]=_[_0xb6a3('0x46')](_0x56d537[_0xb6a3('0x30')]);_0x4143f7['filters']=_[_0xb6a3('0x31')](_0x4143f7[_0xb6a3('0x33')],_0x4143f7[_0xb6a3('0x30')]);_0x28d3db['attributes']=_[_0xb6a3('0x31')](_0x4143f7[_0xb6a3('0x33')],qs[_0xb6a3('0x34')](_0x56d537['query']['fields']));_0x28d3db[_0xb6a3('0x32')]=_0x28d3db[_0xb6a3('0x32')]['length']?_0x28d3db[_0xb6a3('0x32')]:_0x4143f7[_0xb6a3('0x33')];if(_0x56d537[_0xb6a3('0x30')][_0xb6a3('0x3f')]){_0x28d3db['include']=[{'all':!![]}];}_0x28d3db=_['merge']({},_0x28d3db,_0x56d537[_0xb6a3('0x47')]);return db[_0xb6a3('0x2b')][_0xb6a3('0x48')](_0x28d3db)[_0xb6a3('0x26')](handleEntityNotFound(_0x2b2857,null))[_0xb6a3('0x26')](respondWithResult(_0x2b2857,null))[_0xb6a3('0x43')](handleError(_0x2b2857,null));};exports[_0xb6a3('0x49')]=function(_0x21074b,_0x1183ee){return db[_0xb6a3('0x2b')][_0xb6a3('0x49')](_0x21074b[_0xb6a3('0x4a')],{})['then'](respondWithResult(_0x1183ee,0xc9))['catch'](handleError(_0x1183ee,null));};exports[_0xb6a3('0x25')]=function(_0x194aaf,_0x573ed6){if(_0x194aaf['body']['id']){delete _0x194aaf[_0xb6a3('0x4a')]['id'];}return db[_0xb6a3('0x2b')][_0xb6a3('0x48')]({'where':{'id':_0x194aaf[_0xb6a3('0x45')]['id']}})['then'](handleEntityNotFound(_0x573ed6,null))['then'](saveUpdates(_0x194aaf[_0xb6a3('0x4a')],null))[_0xb6a3('0x26')](respondWithResult(_0x573ed6,null))[_0xb6a3('0x43')](handleError(_0x573ed6,null));};exports['destroy']=function(_0x23ad60,_0x29a0b7){return db[_0xb6a3('0x2b')]['find']({'where':{'id':_0x23ad60[_0xb6a3('0x45')]['id']}})['then'](handleEntityNotFound(_0x29a0b7,null))[_0xb6a3('0x26')](removeEntity(_0x29a0b7,null))[_0xb6a3('0x43')](handleError(_0x29a0b7,null));};exports[_0xb6a3('0x4b')]=function(_0x2806f6,_0x58643d){return db[_0xb6a3('0x2b')]['describe']()[_0xb6a3('0x26')](respondWithResult(_0x58643d,null))[_0xb6a3('0x43')](handleError(_0x58643d,null));}; \ No newline at end of file +var _0x1fbd=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','create','body','find','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring'];(function(_0x3862ec,_0x34051f){var _0x1d22b0=function(_0x20f7a9){while(--_0x20f7a9){_0x3862ec['push'](_0x3862ec['shift']());}};_0x1d22b0(++_0x34051f);}(_0x1fbd,0x85));var _0xd1fb=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x1fbd[_0x1b6186];return _0x186121;};'use strict';var emlformat=require(_0xd1fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1fb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd1fb('0x2'));var moment=require(_0xd1fb('0x3'));var BPromise=require(_0xd1fb('0x4'));var Mustache=require('mustache');var util=require(_0xd1fb('0x5'));var path=require(_0xd1fb('0x6'));var sox=require(_0xd1fb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1fb('0x8'));var _=require(_0xd1fb('0x9'));var squel=require(_0xd1fb('0xa'));var crypto=require(_0xd1fb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd1fb('0xc'));var toCsv=require(_0xd1fb('0xd'));var querystring=require(_0xd1fb('0xe'));var Papa=require(_0xd1fb('0xf'));var Redis=require(_0xd1fb('0x10'));var authService=require(_0xd1fb('0x11'));var qs=require(_0xd1fb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1fb('0x13'));var logger=require(_0xd1fb('0x14'))(_0xd1fb('0x15'));var utils=require(_0xd1fb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd1fb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f25f9,_0x42261e){_0x42261e=_0x42261e||0xcc;return function(_0x3a3298){if(_0x3a3298){return _0x4f25f9[_0xd1fb('0x18')](_0x42261e);}return _0x4f25f9[_0xd1fb('0x19')](_0x42261e)[_0xd1fb('0x1a')]();};}function respondWithResult(_0x4b231e,_0x28e7ca){_0x28e7ca=_0x28e7ca||0xc8;return function(_0x648bc1){if(_0x648bc1){return _0x4b231e[_0xd1fb('0x19')](_0x28e7ca)[_0xd1fb('0x1b')](_0x648bc1);}};}function respondWithFilteredResult(_0x441cd1,_0x1387c3){return function(_0x46eb8d){if(_0x46eb8d){var _0x62b0f7=typeof _0x1387c3['offset']===_0xd1fb('0x1c')&&typeof _0x1387c3[_0xd1fb('0x1d')]==='undefined';var _0x1846c0=_0x46eb8d[_0xd1fb('0x1e')];var _0x56db26=_0x62b0f7?0x0:_0x1387c3[_0xd1fb('0x1f')];var _0x515ee5=_0x62b0f7?_0x46eb8d[_0xd1fb('0x1e')]:_0x1387c3[_0xd1fb('0x1f')]+_0x1387c3[_0xd1fb('0x1d')];var _0x1bdfa0;if(_0x515ee5>=_0x1846c0){_0x515ee5=_0x1846c0;_0x1bdfa0=0xc8;}else{_0x1bdfa0=0xce;}_0x441cd1[_0xd1fb('0x19')](_0x1bdfa0);return _0x441cd1[_0xd1fb('0x20')]('Content-Range',_0x56db26+'-'+_0x515ee5+'/'+_0x1846c0)[_0xd1fb('0x1b')](_0x46eb8d);}return null;};}function patchUpdates(_0x5164a3){return function(_0x57cf48){try{jsonpatch['apply'](_0x57cf48,_0x5164a3,!![]);}catch(_0x3aec5d){return BPromise[_0xd1fb('0x21')](_0x3aec5d);}return _0x57cf48[_0xd1fb('0x22')]();};}function saveUpdates(_0x539756,_0x37a47f){return function(_0x2a02a9){if(_0x2a02a9){return _0x2a02a9[_0xd1fb('0x23')](_0x539756)[_0xd1fb('0x24')](function(_0x3d7bdb){return _0x3d7bdb;});}return null;};}function removeEntity(_0x320e12,_0x2e951a){return function(_0x2175fe){if(_0x2175fe){return _0x2175fe[_0xd1fb('0x25')]()[_0xd1fb('0x24')](function(){_0x320e12[_0xd1fb('0x19')](0xcc)[_0xd1fb('0x1a')]();});}};}function handleEntityNotFound(_0x2cce89,_0x9e0f8f){return function(_0x53525f){if(!_0x53525f){_0x2cce89[_0xd1fb('0x18')](0x194);}return _0x53525f;};}function handleError(_0x454908,_0xf44db1){_0xf44db1=_0xf44db1||0x1f4;return function(_0x6069f1){logger[_0xd1fb('0x26')](_0x6069f1[_0xd1fb('0x27')]);if(_0x6069f1['name']){delete _0x6069f1[_0xd1fb('0x28')];}_0x454908[_0xd1fb('0x19')](_0xf44db1)[_0xd1fb('0x29')](_0x6069f1);};}exports[_0xd1fb('0x2a')]=function(_0x12f727,_0x11d910){var _0x3086f7={},_0x3f7815={},_0x253292={'count':0x0,'rows':[]};var _0x1d45a4=_[_0xd1fb('0x2b')](db[_0xd1fb('0x2c')]['rawAttributes'],function(_0x3d4e79){return{'name':_0x3d4e79[_0xd1fb('0x2d')],'type':_0x3d4e79[_0xd1fb('0x2e')][_0xd1fb('0x2f')]};});_0x3f7815[_0xd1fb('0x30')]=_[_0xd1fb('0x2b')](_0x1d45a4,_0xd1fb('0x28'));_0x3f7815[_0xd1fb('0x31')]=_[_0xd1fb('0x32')](_0x12f727[_0xd1fb('0x31')]);_0x3f7815[_0xd1fb('0x33')]=_[_0xd1fb('0x34')](_0x3f7815['model'],_0x3f7815[_0xd1fb('0x31')]);_0x3086f7[_0xd1fb('0x35')]=_[_0xd1fb('0x34')](_0x3f7815[_0xd1fb('0x30')],qs['fields'](_0x12f727[_0xd1fb('0x31')]['fields']));_0x3086f7[_0xd1fb('0x35')]=_0x3086f7[_0xd1fb('0x35')]['length']?_0x3086f7['attributes']:_0x3f7815['model'];if(!_0x12f727[_0xd1fb('0x31')][_0xd1fb('0x36')](_0xd1fb('0x37'))){_0x3086f7['limit']=qs['limit'](_0x12f727[_0xd1fb('0x31')][_0xd1fb('0x1d')]);_0x3086f7[_0xd1fb('0x1f')]=qs[_0xd1fb('0x1f')](_0x12f727[_0xd1fb('0x31')][_0xd1fb('0x1f')]);}_0x3086f7['order']=qs[_0xd1fb('0x38')](_0x12f727[_0xd1fb('0x31')]['sort']);_0x3086f7[_0xd1fb('0x39')]=qs['filters'](_[_0xd1fb('0x3a')](_0x12f727[_0xd1fb('0x31')],_0x3f7815['filters']),_0x1d45a4);if(_0x12f727['query'][_0xd1fb('0x3b')]){_0x3086f7[_0xd1fb('0x39')]=_[_0xd1fb('0x3c')](_0x3086f7[_0xd1fb('0x39')],{'$or':_[_0xd1fb('0x2b')](_0x1d45a4,function(_0x3aa08c){if(_0x3aa08c[_0xd1fb('0x2e')]!==_0xd1fb('0x3d')){var _0x36ca61={};_0x36ca61[_0x3aa08c[_0xd1fb('0x28')]]={'$like':'%'+_0x12f727[_0xd1fb('0x31')][_0xd1fb('0x3b')]+'%'};return _0x36ca61;}})});}_0x3086f7=_[_0xd1fb('0x3c')]({},_0x3086f7,_0x12f727[_0xd1fb('0x3e')]);var _0x17898f={'where':_0x3086f7['where']};return db['MailSubstatus'][_0xd1fb('0x1e')](_0x17898f)['then'](function(_0x1531ef){_0x253292[_0xd1fb('0x1e')]=_0x1531ef;if(_0x12f727[_0xd1fb('0x31')][_0xd1fb('0x3f')]){_0x3086f7[_0xd1fb('0x40')]=[{'all':!![]}];}return db[_0xd1fb('0x2c')][_0xd1fb('0x41')](_0x3086f7);})[_0xd1fb('0x24')](function(_0x8ab6d7){_0x253292[_0xd1fb('0x42')]=_0x8ab6d7;return _0x253292;})[_0xd1fb('0x24')](respondWithFilteredResult(_0x11d910,_0x3086f7))[_0xd1fb('0x43')](handleError(_0x11d910,null));};exports['show']=function(_0x3506cb,_0x21f106){var _0x225869={'raw':!![],'where':{'id':_0x3506cb['params']['id']}},_0x5b2e9c={};_0x5b2e9c[_0xd1fb('0x30')]=_['keys'](db[_0xd1fb('0x2c')][_0xd1fb('0x44')]);_0x5b2e9c[_0xd1fb('0x31')]=_[_0xd1fb('0x32')](_0x3506cb[_0xd1fb('0x31')]);_0x5b2e9c['filters']=_[_0xd1fb('0x34')](_0x5b2e9c[_0xd1fb('0x30')],_0x5b2e9c[_0xd1fb('0x31')]);_0x225869[_0xd1fb('0x35')]=_[_0xd1fb('0x34')](_0x5b2e9c['model'],qs['fields'](_0x3506cb['query']['fields']));_0x225869[_0xd1fb('0x35')]=_0x225869[_0xd1fb('0x35')]['length']?_0x225869['attributes']:_0x5b2e9c['model'];if(_0x3506cb['query'][_0xd1fb('0x3f')]){_0x225869['include']=[{'all':!![]}];}_0x225869=_[_0xd1fb('0x3c')]({},_0x225869,_0x3506cb[_0xd1fb('0x3e')]);return db['MailSubstatus']['find'](_0x225869)['then'](handleEntityNotFound(_0x21f106,null))['then'](respondWithResult(_0x21f106,null))['catch'](handleError(_0x21f106,null));};exports[_0xd1fb('0x45')]=function(_0xc989fe,_0x490e1e){return db['MailSubstatus']['create'](_0xc989fe['body'],{})['then'](respondWithResult(_0x490e1e,0xc9))['catch'](handleError(_0x490e1e,null));};exports[_0xd1fb('0x23')]=function(_0x5efdf8,_0x6e702){if(_0x5efdf8[_0xd1fb('0x46')]['id']){delete _0x5efdf8[_0xd1fb('0x46')]['id'];}return db[_0xd1fb('0x2c')]['find']({'where':{'id':_0x5efdf8['params']['id']}})[_0xd1fb('0x24')](handleEntityNotFound(_0x6e702,null))[_0xd1fb('0x24')](saveUpdates(_0x5efdf8[_0xd1fb('0x46')],null))[_0xd1fb('0x24')](respondWithResult(_0x6e702,null))['catch'](handleError(_0x6e702,null));};exports[_0xd1fb('0x25')]=function(_0x34cb28,_0x5008f6){return db[_0xd1fb('0x2c')][_0xd1fb('0x47')]({'where':{'id':_0x34cb28[_0xd1fb('0x48')]['id']}})['then'](handleEntityNotFound(_0x5008f6,null))['then'](removeEntity(_0x5008f6,null))['catch'](handleError(_0x5008f6,null));};exports[_0xd1fb('0x49')]=function(_0x2b552e,_0x4d9fc5){return db[_0xd1fb('0x2c')][_0xd1fb('0x49')]()[_0xd1fb('0x24')](respondWithResult(_0x4d9fc5,null))['catch'](handleError(_0x4d9fc5,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 41d9df3..0becfb3 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 _0x868c=['api','moment','bluebird','path','rimraf','../../config/environment','define','MailSubstatus','mail_substatuses','util','../../config/logger'];(function(_0x407a52,_0x159b30){var _0x25d084=function(_0x5cf1a8){while(--_0x5cf1a8){_0x407a52['push'](_0x407a52['shift']());}};_0x25d084(++_0x159b30);}(_0x868c,0xcf));var _0xc868=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x868c[_0xe73080];return _0x12cbc4;};'use strict';var _=require('lodash');var util=require(_0xc868('0x0'));var logger=require(_0xc868('0x1'))(_0xc868('0x2'));var moment=require(_0xc868('0x3'));var BPromise=require(_0xc868('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc868('0x5'));var rimraf=require(_0xc868('0x6'));var config=require(_0xc868('0x7'));var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x56ad0a,_0x48e876){return _0x56ad0a[_0xc868('0x8')](_0xc868('0x9'),attributes,{'tableName':_0xc868('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ca7=['define','MailSubstatus','mail_substatuses','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x1e39bd,_0xf419ec){var _0x430170=function(_0x429881){while(--_0x429881){_0x1e39bd['push'](_0x1e39bd['shift']());}};_0x430170(++_0xf419ec);}(_0x7ca7,0xcf));var _0x77ca=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0x7ca7[_0x28578d];return _0x524826;};'use strict';var _=require(_0x77ca('0x0'));var util=require('util');var logger=require(_0x77ca('0x1'))(_0x77ca('0x2'));var moment=require(_0x77ca('0x3'));var BPromise=require(_0x77ca('0x4'));var rp=require(_0x77ca('0x5'));var fs=require('fs');var path=require(_0x77ca('0x6'));var rimraf=require('rimraf');var config=require(_0x77ca('0x7'));var attributes=require('./mailSubstatus.attributes');module[_0x77ca('0x8')]=function(_0x52f3ea,_0x57e944){return _0x52f3ea[_0x77ca('0x9')](_0x77ca('0xa'),attributes,{'tableName':_0x77ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d0b0e09..a23bef0 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 _0xf4e6=['stringify','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','rpc','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x262323,_0x4a81f1){var _0xa963c3=function(_0x5c715e){while(--_0x5c715e){_0x262323['push'](_0x262323['shift']());}};_0xa963c3(++_0x4a81f1);}(_0xf4e6,0x9d));var _0x6f4e=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0xf4e6[_0x29a29f];return _0x443ea3;};'use strict';var _=require(_0x6f4e('0x0'));var util=require(_0x6f4e('0x1'));var moment=require('moment');var BPromise=require(_0x6f4e('0x2'));var rs=require(_0x6f4e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f4e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6f4e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6f4e('0x6')][_0x6f4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x104d6b,_0x15f222,_0x3732bf){return new BPromise(function(_0x329516,_0xeefa10){return client[_0x6f4e('0x8')](_0x104d6b,_0x3732bf)[_0x6f4e('0x9')](function(_0x5361aa){logger[_0x6f4e('0xa')](_0x6f4e('0xb'),_0x15f222,'request\x20sent');logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x15f222,_0x6f4e('0xc'),JSON[_0x6f4e('0xd')](_0x5361aa));if(_0x5361aa[_0x6f4e('0xe')]){if(_0x5361aa['error']['code']===0x1f4){logger['error'](_0x6f4e('0xb'),_0x15f222,_0x5361aa['error'][_0x6f4e('0xf')]);return _0xeefa10(_0x5361aa['error'][_0x6f4e('0xf')]);}logger[_0x6f4e('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x15f222,_0x5361aa[_0x6f4e('0xe')][_0x6f4e('0xf')]);return _0x329516(_0x5361aa[_0x6f4e('0xe')][_0x6f4e('0xf')]);}else{logger[_0x6f4e('0xa')](_0x6f4e('0xb'),_0x15f222,_0x6f4e('0xc'));_0x329516(_0x5361aa['result']['message']);}})[_0x6f4e('0x10')](function(_0x518f40){logger[_0x6f4e('0xe')](_0x6f4e('0xb'),_0x15f222,_0x518f40);_0xeefa10(_0x518f40);});});} \ No newline at end of file +var _0x8d17=['moment','bluebird','../../config/utils','rpc','../../config/environment','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x176cfe,_0x16357a){var _0x390a08=function(_0x33a3c3){while(--_0x33a3c3){_0x176cfe['push'](_0x176cfe['shift']());}};_0x390a08(++_0x16357a);}(_0x8d17,0x10d));var _0x78d1=function(_0x105d99,_0x42608a){_0x105d99=_0x105d99-0x0;var _0x15a32b=_0x8d17[_0x105d99];return _0x15a32b;};'use strict';var _=require(_0x78d1('0x0'));var util=require('util');var moment=require(_0x78d1('0x1'));var BPromise=require(_0x78d1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x78d1('0x3'));var logger=require('../../config/logger')(_0x78d1('0x4'));var config=require(_0x78d1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x78d1('0x6')][_0x78d1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a750b,_0x1d0ded,_0x10496d){return new BPromise(function(_0x41b775,_0x57c264){return client['request'](_0x3a750b,_0x10496d)[_0x78d1('0x8')](function(_0x28eb65){logger[_0x78d1('0x9')](_0x78d1('0xa'),_0x1d0ded,_0x78d1('0xb'));logger[_0x78d1('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1d0ded,'request\x20sent',JSON[_0x78d1('0xd')](_0x28eb65));if(_0x28eb65['error']){if(_0x28eb65[_0x78d1('0xe')][_0x78d1('0xf')]===0x1f4){logger[_0x78d1('0xe')](_0x78d1('0xa'),_0x1d0ded,_0x28eb65[_0x78d1('0xe')][_0x78d1('0x10')]);return _0x57c264(_0x28eb65[_0x78d1('0xe')][_0x78d1('0x10')]);}logger[_0x78d1('0xe')](_0x78d1('0xa'),_0x1d0ded,_0x28eb65[_0x78d1('0xe')][_0x78d1('0x10')]);return _0x41b775(_0x28eb65[_0x78d1('0xe')]['message']);}else{logger['info'](_0x78d1('0xa'),_0x1d0ded,_0x78d1('0xb'));_0x41b775(_0x28eb65['result']['message']);}})[_0x78d1('0x11')](function(_0x13cc58){logger[_0x78d1('0xe')](_0x78d1('0xa'),_0x1d0ded,_0x13cc58);_0x57c264(_0x13cc58);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 0f361e5..6f654ce 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 _0xa899=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports'];(function(_0xa22014,_0x4ae811){var _0x1ee0a7=function(_0x1d7f5e){while(--_0x1d7f5e){_0xa22014['push'](_0xa22014['shift']());}};_0x1ee0a7(++_0x4ae811);}(_0xa899,0xf7));var _0x9a89=function(_0x20118a,_0x3dbdf3){_0x20118a=_0x20118a-0x0;var _0x538b5f=_0xa899[_0x20118a];return _0x538b5f;};'use strict';var multer=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var path=require(_0x9a89('0x2'));var timeout=require(_0x9a89('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9a89('0x4'));var auth=require(_0x9a89('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9a89('0x6'));var controller=require(_0x9a89('0x7'));router[_0x9a89('0x8')]('/',auth[_0x9a89('0x9')](),controller['index']);router[_0x9a89('0x8')]('/describe',auth[_0x9a89('0x9')](),controller[_0x9a89('0xa')]);router[_0x9a89('0x8')](_0x9a89('0xb'),auth[_0x9a89('0x9')](),controller[_0x9a89('0xc')]);router[_0x9a89('0xd')]('/',auth['isAuthenticated'](),controller[_0x9a89('0xe')]);router[_0x9a89('0xf')](_0x9a89('0xb'),auth[_0x9a89('0x9')](),controller['update']);router[_0x9a89('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9a89('0x11')]);module[_0x9a89('0x12')]=router; \ No newline at end of file +var _0x76cc=['create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post'];(function(_0x4cea57,_0x509db6){var _0x5b2f58=function(_0x6c8245){while(--_0x6c8245){_0x4cea57['push'](_0x4cea57['shift']());}};_0x5b2f58(++_0x509db6);}(_0x76cc,0x131));var _0xc76c=function(_0x2fb98c,_0x106e68){_0x2fb98c=_0x2fb98c-0x0;var _0x551e9f=_0x76cc[_0x2fb98c];return _0x551e9f;};'use strict';var multer=require('multer');var util=require(_0xc76c('0x0'));var path=require(_0xc76c('0x1'));var timeout=require(_0xc76c('0x2'));var express=require(_0xc76c('0x3'));var router=express['Router']();var fs_extra=require(_0xc76c('0x4'));var auth=require(_0xc76c('0x5'));var interaction=require(_0xc76c('0x6'));var config=require('../../config/environment');var controller=require(_0xc76c('0x7'));router[_0xc76c('0x8')]('/',auth['isAuthenticated'](),controller[_0xc76c('0x9')]);router[_0xc76c('0x8')](_0xc76c('0xa'),auth[_0xc76c('0xb')](),controller[_0xc76c('0xc')]);router[_0xc76c('0x8')](_0xc76c('0xd'),auth[_0xc76c('0xb')](),controller['show']);router[_0xc76c('0xe')]('/',auth['isAuthenticated'](),controller[_0xc76c('0xf')]);router[_0xc76c('0x10')](_0xc76c('0xd'),auth[_0xc76c('0xb')](),controller[_0xc76c('0x11')]);router[_0xc76c('0x12')](_0xc76c('0xd'),auth[_0xc76c('0xb')](),controller['destroy']);module[_0xc76c('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 34d487d..8e081cd 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x5b0702,_0x5a8ce5){var _0xe2f306=function(_0x2c6d32){while(--_0x2c6d32){_0x5b0702['push'](_0x5b0702['shift']());}};_0xe2f306(++_0x5a8ce5);}(_0x70e0,0x17b));var _0x070e=function(_0xc28806,_0x27ccd5){_0xc28806=_0xc28806-0x0;var _0x174adf=_0x70e0[_0xc28806];return _0x174adf;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x24f08d,_0x19ae14){var _0x1233ed=function(_0xefafd9){while(--_0xefafd9){_0x24f08d['push'](_0x24f08d['shift']());}};_0x1233ed(++_0x19ae14);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index d57695b..1750aba 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 _0x4ce1=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','save','destroy','then','name','send','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x318f6d,_0x429997){var _0xbd6b1b=function(_0x1adc41){while(--_0x1adc41){_0x318f6d['push'](_0x318f6d['shift']());}};_0xbd6b1b(++_0x429997);}(_0x4ce1,0x1ea));var _0x14ce=function(_0x28238c,_0x4af750){_0x28238c=_0x28238c-0x0;var _0x911e5e=_0x4ce1[_0x28238c];return _0x911e5e;};'use strict';var emlformat=require(_0x14ce('0x0'));var rimraf=require(_0x14ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14ce('0x2'));var rp=require(_0x14ce('0x3'));var moment=require(_0x14ce('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x14ce('0x5'));var util=require(_0x14ce('0x6'));var path=require(_0x14ce('0x7'));var sox=require('sox');var csv=require(_0x14ce('0x8'));var ejs=require(_0x14ce('0x9'));var fs=require('fs');var fs_extra=require(_0x14ce('0xa'));var _=require(_0x14ce('0xb'));var squel=require(_0x14ce('0xc'));var crypto=require('crypto');var jsforce=require(_0x14ce('0xd'));var deskjs=require(_0x14ce('0xe'));var toCsv=require(_0x14ce('0x8'));var querystring=require(_0x14ce('0xf'));var Papa=require('papaparse');var Redis=require(_0x14ce('0x10'));var authService=require(_0x14ce('0x11'));var qs=require(_0x14ce('0x12'));var as=require(_0x14ce('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x14ce('0x14'))(_0x14ce('0x15'));var utils=require(_0x14ce('0x16'));var config=require(_0x14ce('0x17'));var licenseUtil=require(_0x14ce('0x18'));var db=require(_0x14ce('0x19'))['db'];function respondWithStatusCode(_0x57f385,_0x5ed546){_0x5ed546=_0x5ed546||0xcc;return function(_0x38947d){if(_0x38947d){return _0x57f385['sendStatus'](_0x5ed546);}return _0x57f385['status'](_0x5ed546)[_0x14ce('0x1a')]();};}function respondWithResult(_0x46c321,_0x51a290){_0x51a290=_0x51a290||0xc8;return function(_0x1c7967){if(_0x1c7967){return _0x46c321[_0x14ce('0x1b')](_0x51a290)[_0x14ce('0x1c')](_0x1c7967);}};}function respondWithFilteredResult(_0x18f58d,_0x2e899f){return function(_0x4ef8a3){if(_0x4ef8a3){var _0x35f23c=typeof _0x2e899f[_0x14ce('0x1d')]===_0x14ce('0x1e')&&typeof _0x2e899f[_0x14ce('0x1f')]===_0x14ce('0x1e');var _0xefb14c=_0x4ef8a3['count'];var _0x30dcca=_0x35f23c?0x0:_0x2e899f[_0x14ce('0x1d')];var _0x2efb98=_0x35f23c?_0x4ef8a3[_0x14ce('0x20')]:_0x2e899f[_0x14ce('0x1d')]+_0x2e899f[_0x14ce('0x1f')];var _0x12bc1e;if(_0x2efb98>=_0xefb14c){_0x2efb98=_0xefb14c;_0x12bc1e=0xc8;}else{_0x12bc1e=0xce;}_0x18f58d['status'](_0x12bc1e);return _0x18f58d['set'](_0x14ce('0x21'),_0x30dcca+'-'+_0x2efb98+'/'+_0xefb14c)['json'](_0x4ef8a3);}return null;};}function patchUpdates(_0x4b67ff){return function(_0x3f349d){try{jsonpatch['apply'](_0x3f349d,_0x4b67ff,!![]);}catch(_0xa57e9){return BPromise['reject'](_0xa57e9);}return _0x3f349d[_0x14ce('0x22')]();};}function saveUpdates(_0x1d291c,_0x3ec627){return function(_0x32a80c){if(_0x32a80c){return _0x32a80c['update'](_0x1d291c)['then'](function(_0x35996c){return _0x35996c;});}return null;};}function removeEntity(_0x3237f4,_0x434f21){return function(_0x3f1940){if(_0x3f1940){return _0x3f1940[_0x14ce('0x23')]()[_0x14ce('0x24')](function(){_0x3237f4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5fce47,_0x2ac4f1){return function(_0x425b84){if(!_0x425b84){_0x5fce47['sendStatus'](0x194);}return _0x425b84;};}function handleError(_0x3e81b9,_0x39426f){_0x39426f=_0x39426f||0x1f4;return function(_0x4fec2e){logger['error'](_0x4fec2e['stack']);if(_0x4fec2e[_0x14ce('0x25')]){delete _0x4fec2e['name'];}_0x3e81b9[_0x14ce('0x1b')](_0x39426f)[_0x14ce('0x26')](_0x4fec2e);};}exports['index']=function(_0x2db1c8,_0x1c67b0){var _0x3c78cb={},_0x5933ec={},_0x33780b={'count':0x0,'rows':[]};var _0x2bbd05=_['map'](db[_0x14ce('0x27')][_0x14ce('0x28')],function(_0x273aac){return{'name':_0x273aac[_0x14ce('0x29')],'type':_0x273aac[_0x14ce('0x2a')][_0x14ce('0x2b')]};});_0x5933ec[_0x14ce('0x2c')]=_[_0x14ce('0x2d')](_0x2bbd05,_0x14ce('0x25'));_0x5933ec[_0x14ce('0x2e')]=_[_0x14ce('0x2f')](_0x2db1c8[_0x14ce('0x2e')]);_0x5933ec[_0x14ce('0x30')]=_[_0x14ce('0x31')](_0x5933ec[_0x14ce('0x2c')],_0x5933ec[_0x14ce('0x2e')]);_0x3c78cb[_0x14ce('0x32')]=_[_0x14ce('0x31')](_0x5933ec[_0x14ce('0x2c')],qs[_0x14ce('0x33')](_0x2db1c8[_0x14ce('0x2e')][_0x14ce('0x33')]));_0x3c78cb[_0x14ce('0x32')]=_0x3c78cb[_0x14ce('0x32')][_0x14ce('0x34')]?_0x3c78cb['attributes']:_0x5933ec[_0x14ce('0x2c')];if(!_0x2db1c8[_0x14ce('0x2e')][_0x14ce('0x35')](_0x14ce('0x36'))){_0x3c78cb['limit']=qs[_0x14ce('0x1f')](_0x2db1c8[_0x14ce('0x2e')][_0x14ce('0x1f')]);_0x3c78cb[_0x14ce('0x1d')]=qs[_0x14ce('0x1d')](_0x2db1c8['query']['offset']);}_0x3c78cb[_0x14ce('0x37')]=qs['sort'](_0x2db1c8[_0x14ce('0x2e')][_0x14ce('0x38')]);_0x3c78cb[_0x14ce('0x39')]=qs[_0x14ce('0x30')](_['pick'](_0x2db1c8[_0x14ce('0x2e')],_0x5933ec[_0x14ce('0x30')]),_0x2bbd05);if(_0x2db1c8[_0x14ce('0x2e')][_0x14ce('0x3a')]){_0x3c78cb[_0x14ce('0x39')]=_[_0x14ce('0x3b')](_0x3c78cb[_0x14ce('0x39')],{'$or':_[_0x14ce('0x2d')](_0x2bbd05,function(_0x5c2100){if(_0x5c2100[_0x14ce('0x2a')]!==_0x14ce('0x3c')){var _0x3c355b={};_0x3c355b[_0x5c2100[_0x14ce('0x25')]]={'$like':'%'+_0x2db1c8['query'][_0x14ce('0x3a')]+'%'};return _0x3c355b;}})});}_0x3c78cb=_[_0x14ce('0x3b')]({},_0x3c78cb,_0x2db1c8[_0x14ce('0x3d')]);var _0x3777ef={'where':_0x3c78cb['where']};return db['MailTransferReport']['count'](_0x3777ef)[_0x14ce('0x24')](function(_0x369f1e){_0x33780b['count']=_0x369f1e;if(_0x2db1c8[_0x14ce('0x2e')]['includeAll']){_0x3c78cb[_0x14ce('0x3e')]=[{'all':!![]}];}return db['MailTransferReport'][_0x14ce('0x3f')](_0x3c78cb);})[_0x14ce('0x24')](function(_0x423383){_0x33780b[_0x14ce('0x40')]=_0x423383;return _0x33780b;})[_0x14ce('0x24')](respondWithFilteredResult(_0x1c67b0,_0x3c78cb))[_0x14ce('0x41')](handleError(_0x1c67b0,null));};exports[_0x14ce('0x42')]=function(_0x1b0dfe,_0x51b51b){var _0x2024cf={'raw':!![],'where':{'id':_0x1b0dfe[_0x14ce('0x43')]['id']}},_0xdc77e2={};_0xdc77e2[_0x14ce('0x2c')]=_['keys'](db['MailTransferReport'][_0x14ce('0x28')]);_0xdc77e2['query']=_[_0x14ce('0x2f')](_0x1b0dfe[_0x14ce('0x2e')]);_0xdc77e2[_0x14ce('0x30')]=_[_0x14ce('0x31')](_0xdc77e2[_0x14ce('0x2c')],_0xdc77e2[_0x14ce('0x2e')]);_0x2024cf[_0x14ce('0x32')]=_[_0x14ce('0x31')](_0xdc77e2['model'],qs[_0x14ce('0x33')](_0x1b0dfe[_0x14ce('0x2e')][_0x14ce('0x33')]));_0x2024cf['attributes']=_0x2024cf[_0x14ce('0x32')][_0x14ce('0x34')]?_0x2024cf[_0x14ce('0x32')]:_0xdc77e2[_0x14ce('0x2c')];if(_0x1b0dfe[_0x14ce('0x2e')][_0x14ce('0x44')]){_0x2024cf[_0x14ce('0x3e')]=[{'all':!![]}];}_0x2024cf=_[_0x14ce('0x3b')]({},_0x2024cf,_0x1b0dfe[_0x14ce('0x3d')]);return db[_0x14ce('0x27')]['find'](_0x2024cf)[_0x14ce('0x24')](handleEntityNotFound(_0x51b51b,null))['then'](respondWithResult(_0x51b51b,null))[_0x14ce('0x41')](handleError(_0x51b51b,null));};exports[_0x14ce('0x45')]=function(_0x75404b,_0x3ef7e8){return db[_0x14ce('0x27')][_0x14ce('0x45')](_0x75404b['body'],{})[_0x14ce('0x24')](respondWithResult(_0x3ef7e8,0xc9))[_0x14ce('0x41')](handleError(_0x3ef7e8,null));};exports['update']=function(_0x55235b,_0xa8ba3d){if(_0x55235b['body']['id']){delete _0x55235b['body']['id'];}return db[_0x14ce('0x27')][_0x14ce('0x46')]({'where':{'id':_0x55235b[_0x14ce('0x43')]['id']}})[_0x14ce('0x24')](handleEntityNotFound(_0xa8ba3d,null))[_0x14ce('0x24')](saveUpdates(_0x55235b[_0x14ce('0x47')],null))[_0x14ce('0x24')](respondWithResult(_0xa8ba3d,null))[_0x14ce('0x41')](handleError(_0xa8ba3d,null));};exports['destroy']=function(_0x1a4142,_0x1e1cf7){return db[_0x14ce('0x27')][_0x14ce('0x46')]({'where':{'id':_0x1a4142[_0x14ce('0x43')]['id']}})[_0x14ce('0x24')](handleEntityNotFound(_0x1e1cf7,null))[_0x14ce('0x24')](removeEntity(_0x1e1cf7,null))[_0x14ce('0x41')](handleError(_0x1e1cf7,null));};exports[_0x14ce('0x48')]=function(_0x44d579,_0x169a3c){return db[_0x14ce('0x27')][_0x14ce('0x48')]()[_0x14ce('0x24')](respondWithResult(_0x169a3c,null))[_0x14ce('0x41')](handleError(_0x169a3c,null));}; \ No newline at end of file +var _0xea28=['stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','then','catch','show','params','intersection','create','body','find','destroy','describe','eml-format','zip-dir','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','update','error'];(function(_0x5bdf9e,_0x260aba){var _0x3553d8=function(_0x2607f0){while(--_0x2607f0){_0x5bdf9e['push'](_0x5bdf9e['shift']());}};_0x3553d8(++_0x260aba);}(_0xea28,0x102));var _0x8ea2=function(_0x4c18c4,_0x198d4f){_0x4c18c4=_0x4c18c4-0x0;var _0x1faa42=_0xea28[_0x4c18c4];return _0x1faa42;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ea2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ea2('0x2'));var moment=require('moment');var BPromise=require(_0x8ea2('0x3'));var Mustache=require(_0x8ea2('0x4'));var util=require(_0x8ea2('0x5'));var path=require(_0x8ea2('0x6'));var sox=require(_0x8ea2('0x7'));var csv=require(_0x8ea2('0x8'));var ejs=require(_0x8ea2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ea2('0xa'));var squel=require(_0x8ea2('0xb'));var crypto=require(_0x8ea2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8ea2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8ea2('0xe'));var authService=require(_0x8ea2('0xf'));var qs=require(_0x8ea2('0x10'));var as=require(_0x8ea2('0x11'));var hardwareService=require(_0x8ea2('0x12'));var logger=require(_0x8ea2('0x13'))(_0x8ea2('0x14'));var utils=require(_0x8ea2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x16'));var db=require(_0x8ea2('0x17'))['db'];function respondWithStatusCode(_0x287761,_0x47bf9e){_0x47bf9e=_0x47bf9e||0xcc;return function(_0xc2ec6){if(_0xc2ec6){return _0x287761[_0x8ea2('0x18')](_0x47bf9e);}return _0x287761[_0x8ea2('0x19')](_0x47bf9e)[_0x8ea2('0x1a')]();};}function respondWithResult(_0x4babe7,_0x4ef5b4){_0x4ef5b4=_0x4ef5b4||0xc8;return function(_0x50a9cc){if(_0x50a9cc){return _0x4babe7[_0x8ea2('0x19')](_0x4ef5b4)[_0x8ea2('0x1b')](_0x50a9cc);}};}function respondWithFilteredResult(_0x38759b,_0x5d9455){return function(_0x2f5cfc){if(_0x2f5cfc){var _0xdbeef=typeof _0x5d9455[_0x8ea2('0x1c')]===_0x8ea2('0x1d')&&typeof _0x5d9455[_0x8ea2('0x1e')]==='undefined';var _0x5bba61=_0x2f5cfc['count'];var _0x1c3018=_0xdbeef?0x0:_0x5d9455[_0x8ea2('0x1c')];var _0x1320d3=_0xdbeef?_0x2f5cfc[_0x8ea2('0x1f')]:_0x5d9455[_0x8ea2('0x1c')]+_0x5d9455[_0x8ea2('0x1e')];var _0x2d3b2e;if(_0x1320d3>=_0x5bba61){_0x1320d3=_0x5bba61;_0x2d3b2e=0xc8;}else{_0x2d3b2e=0xce;}_0x38759b['status'](_0x2d3b2e);return _0x38759b['set']('Content-Range',_0x1c3018+'-'+_0x1320d3+'/'+_0x5bba61)[_0x8ea2('0x1b')](_0x2f5cfc);}return null;};}function patchUpdates(_0x1a5ffe){return function(_0x31350c){try{jsonpatch['apply'](_0x31350c,_0x1a5ffe,!![]);}catch(_0x5ccd6d){return BPromise['reject'](_0x5ccd6d);}return _0x31350c['save']();};}function saveUpdates(_0x3fab8d,_0x3e673f){return function(_0x5cf58b){if(_0x5cf58b){return _0x5cf58b[_0x8ea2('0x20')](_0x3fab8d)['then'](function(_0x563fb8){return _0x563fb8;});}return null;};}function removeEntity(_0x568cf5,_0x3e22ba){return function(_0x5d9edf){if(_0x5d9edf){return _0x5d9edf['destroy']()['then'](function(){_0x568cf5[_0x8ea2('0x19')](0xcc)[_0x8ea2('0x1a')]();});}};}function handleEntityNotFound(_0x4cea8b,_0x2eaa19){return function(_0x51c420){if(!_0x51c420){_0x4cea8b[_0x8ea2('0x18')](0x194);}return _0x51c420;};}function handleError(_0x4acc29,_0x1c8fc0){_0x1c8fc0=_0x1c8fc0||0x1f4;return function(_0x52770e){logger[_0x8ea2('0x21')](_0x52770e[_0x8ea2('0x22')]);if(_0x52770e[_0x8ea2('0x23')]){delete _0x52770e[_0x8ea2('0x23')];}_0x4acc29['status'](_0x1c8fc0)[_0x8ea2('0x24')](_0x52770e);};}exports[_0x8ea2('0x25')]=function(_0x4b0dcc,_0xb09e17){var _0x5d072b={},_0x4d6402={},_0x424ec1={'count':0x0,'rows':[]};var _0x9c5ce0=_[_0x8ea2('0x26')](db[_0x8ea2('0x27')][_0x8ea2('0x28')],function(_0xb9c19c){return{'name':_0xb9c19c[_0x8ea2('0x29')],'type':_0xb9c19c[_0x8ea2('0x2a')]['key']};});_0x4d6402[_0x8ea2('0x2b')]=_[_0x8ea2('0x26')](_0x9c5ce0,'name');_0x4d6402[_0x8ea2('0x2c')]=_[_0x8ea2('0x2d')](_0x4b0dcc[_0x8ea2('0x2c')]);_0x4d6402[_0x8ea2('0x2e')]=_['intersection'](_0x4d6402[_0x8ea2('0x2b')],_0x4d6402[_0x8ea2('0x2c')]);_0x5d072b[_0x8ea2('0x2f')]=_['intersection'](_0x4d6402[_0x8ea2('0x2b')],qs[_0x8ea2('0x30')](_0x4b0dcc[_0x8ea2('0x2c')][_0x8ea2('0x30')]));_0x5d072b['attributes']=_0x5d072b['attributes'][_0x8ea2('0x31')]?_0x5d072b['attributes']:_0x4d6402['model'];if(!_0x4b0dcc[_0x8ea2('0x2c')][_0x8ea2('0x32')](_0x8ea2('0x33'))){_0x5d072b[_0x8ea2('0x1e')]=qs[_0x8ea2('0x1e')](_0x4b0dcc['query'][_0x8ea2('0x1e')]);_0x5d072b[_0x8ea2('0x1c')]=qs['offset'](_0x4b0dcc[_0x8ea2('0x2c')][_0x8ea2('0x1c')]);}_0x5d072b[_0x8ea2('0x34')]=qs[_0x8ea2('0x35')](_0x4b0dcc[_0x8ea2('0x2c')][_0x8ea2('0x35')]);_0x5d072b[_0x8ea2('0x36')]=qs[_0x8ea2('0x2e')](_[_0x8ea2('0x37')](_0x4b0dcc['query'],_0x4d6402[_0x8ea2('0x2e')]),_0x9c5ce0);if(_0x4b0dcc[_0x8ea2('0x2c')][_0x8ea2('0x38')]){_0x5d072b[_0x8ea2('0x36')]=_['merge'](_0x5d072b['where'],{'$or':_[_0x8ea2('0x26')](_0x9c5ce0,function(_0x2c32d4){if(_0x2c32d4['type']!=='VIRTUAL'){var _0x743509={};_0x743509[_0x2c32d4[_0x8ea2('0x23')]]={'$like':'%'+_0x4b0dcc[_0x8ea2('0x2c')]['filter']+'%'};return _0x743509;}})});}_0x5d072b=_[_0x8ea2('0x39')]({},_0x5d072b,_0x4b0dcc[_0x8ea2('0x3a')]);var _0x3f057b={'where':_0x5d072b[_0x8ea2('0x36')]};return db[_0x8ea2('0x27')][_0x8ea2('0x1f')](_0x3f057b)['then'](function(_0x588a47){_0x424ec1[_0x8ea2('0x1f')]=_0x588a47;if(_0x4b0dcc['query'][_0x8ea2('0x3b')]){_0x5d072b[_0x8ea2('0x3c')]=[{'all':!![]}];}return db[_0x8ea2('0x27')][_0x8ea2('0x3d')](_0x5d072b);})['then'](function(_0x3f21b5){_0x424ec1[_0x8ea2('0x3e')]=_0x3f21b5;return _0x424ec1;})[_0x8ea2('0x3f')](respondWithFilteredResult(_0xb09e17,_0x5d072b))[_0x8ea2('0x40')](handleError(_0xb09e17,null));};exports[_0x8ea2('0x41')]=function(_0x35ff9a,_0x368aaa){var _0x2c9562={'raw':!![],'where':{'id':_0x35ff9a[_0x8ea2('0x42')]['id']}},_0xee8644={};_0xee8644[_0x8ea2('0x2b')]=_[_0x8ea2('0x2d')](db[_0x8ea2('0x27')][_0x8ea2('0x28')]);_0xee8644['query']=_[_0x8ea2('0x2d')](_0x35ff9a[_0x8ea2('0x2c')]);_0xee8644['filters']=_[_0x8ea2('0x43')](_0xee8644['model'],_0xee8644[_0x8ea2('0x2c')]);_0x2c9562[_0x8ea2('0x2f')]=_[_0x8ea2('0x43')](_0xee8644[_0x8ea2('0x2b')],qs['fields'](_0x35ff9a['query']['fields']));_0x2c9562[_0x8ea2('0x2f')]=_0x2c9562[_0x8ea2('0x2f')][_0x8ea2('0x31')]?_0x2c9562[_0x8ea2('0x2f')]:_0xee8644[_0x8ea2('0x2b')];if(_0x35ff9a[_0x8ea2('0x2c')][_0x8ea2('0x3b')]){_0x2c9562[_0x8ea2('0x3c')]=[{'all':!![]}];}_0x2c9562=_[_0x8ea2('0x39')]({},_0x2c9562,_0x35ff9a[_0x8ea2('0x3a')]);return db[_0x8ea2('0x27')]['find'](_0x2c9562)[_0x8ea2('0x3f')](handleEntityNotFound(_0x368aaa,null))[_0x8ea2('0x3f')](respondWithResult(_0x368aaa,null))[_0x8ea2('0x40')](handleError(_0x368aaa,null));};exports[_0x8ea2('0x44')]=function(_0x497c35,_0x265022){return db[_0x8ea2('0x27')]['create'](_0x497c35[_0x8ea2('0x45')],{})['then'](respondWithResult(_0x265022,0xc9))['catch'](handleError(_0x265022,null));};exports[_0x8ea2('0x20')]=function(_0x19afa6,_0xd9605a){if(_0x19afa6['body']['id']){delete _0x19afa6['body']['id'];}return db['MailTransferReport'][_0x8ea2('0x46')]({'where':{'id':_0x19afa6['params']['id']}})['then'](handleEntityNotFound(_0xd9605a,null))[_0x8ea2('0x3f')](saveUpdates(_0x19afa6[_0x8ea2('0x45')],null))[_0x8ea2('0x3f')](respondWithResult(_0xd9605a,null))[_0x8ea2('0x40')](handleError(_0xd9605a,null));};exports[_0x8ea2('0x47')]=function(_0x5e4708,_0x2162bf){return db[_0x8ea2('0x27')][_0x8ea2('0x46')]({'where':{'id':_0x5e4708[_0x8ea2('0x42')]['id']}})[_0x8ea2('0x3f')](handleEntityNotFound(_0x2162bf,null))[_0x8ea2('0x3f')](removeEntity(_0x2162bf,null))['catch'](handleError(_0x2162bf,null));};exports[_0x8ea2('0x48')]=function(_0x2f0bd7,_0x53127f){return db['MailTransferReport'][_0x8ea2('0x48')]()['then'](respondWithResult(_0x53127f,null))[_0x8ea2('0x40')](handleError(_0x53127f,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 0ac75a7..c60adbf 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 _0x12c9=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x12c9,0x1c9));var _0x912c=function(_0xc803e8,_0x450f61){_0xc803e8=_0xc803e8-0x0;var _0x51363a=_0x12c9[_0xc803e8];return _0x51363a;};'use strict';var _=require(_0x912c('0x0'));var util=require(_0x912c('0x1'));var logger=require(_0x912c('0x2'))(_0x912c('0x3'));var moment=require(_0x912c('0x4'));var BPromise=require('bluebird');var rp=require(_0x912c('0x5'));var fs=require('fs');var path=require(_0x912c('0x6'));var rimraf=require(_0x912c('0x7'));var config=require(_0x912c('0x8'));var attributes=require(_0x912c('0x9'));module['exports']=function(_0x584a27,_0xe29019){return _0x584a27[_0x912c('0xa')](_0x912c('0xb'),attributes,{'tableName':_0x912c('0xc'),'paranoid':![],'indexes':[{'name':_0x912c('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5900=['../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x5900,0xd2));var _0x0590=function(_0x1f1731,_0x4b77eb){_0x1f1731=_0x1f1731-0x0;var _0x1f7625=_0x5900[_0x1f1731];return _0x1f7625;};'use strict';var _=require('lodash');var util=require(_0x0590('0x0'));var logger=require(_0x0590('0x1'))('api');var moment=require(_0x0590('0x2'));var BPromise=require(_0x0590('0x3'));var rp=require(_0x0590('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0590('0x5'));var config=require(_0x0590('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0x0590('0x7')]=function(_0x1d9927,_0x494b17){return _0x1d9927[_0x0590('0x8')](_0x0590('0x9'),attributes,{'tableName':_0x0590('0xa'),'paranoid':![],'indexes':[{'name':_0x0590('0xb'),'fields':[_0x0590('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index e2e0196..c9cafe0 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 _0xb31f=['stringify','error','MailTransferReport,\x20%s,\x20%s','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then','request\x20sent','debug'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xb31f,0x16e));var _0xfb31=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0xb31f[_0x3fb9dd];return _0x20136a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfb31('0x0'));var BPromise=require(_0xfb31('0x1'));var rs=require(_0xfb31('0x2'));var fs=require('fs');var Redis=require(_0xfb31('0x3'));var db=require(_0xfb31('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb31('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfb31('0x6'));var client=jayson[_0xfb31('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42c2f3,_0x2467dc,_0x14a7a6){return new BPromise(function(_0x57a7d2,_0x2e2cc7){return client[_0xfb31('0x8')](_0x42c2f3,_0x14a7a6)[_0xfb31('0x9')](function(_0x176971){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x2467dc,_0xfb31('0xa'));logger[_0xfb31('0xb')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x2467dc,_0xfb31('0xa'),JSON[_0xfb31('0xc')](_0x176971));if(_0x176971[_0xfb31('0xd')]){if(_0x176971[_0xfb31('0xd')]['code']===0x1f4){logger[_0xfb31('0xd')](_0xfb31('0xe'),_0x2467dc,_0x176971[_0xfb31('0xd')][_0xfb31('0xf')]);return _0x2e2cc7(_0x176971[_0xfb31('0xd')][_0xfb31('0xf')]);}logger[_0xfb31('0xd')](_0xfb31('0xe'),_0x2467dc,_0x176971[_0xfb31('0xd')]['message']);return _0x57a7d2(_0x176971['error']['message']);}else{logger[_0xfb31('0x10')](_0xfb31('0xe'),_0x2467dc,_0xfb31('0xa'));_0x57a7d2(_0x176971['result'][_0xfb31('0xf')]);}})[_0xfb31('0x11')](function(_0x38bd37){logger[_0xfb31('0xd')](_0xfb31('0xe'),_0x2467dc,_0x38bd37);_0x2e2cc7(_0x38bd37);});});} \ No newline at end of file +var _0xf380=['http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0xf380,0x1d8));var _0x0f38=function(_0x17f55f,_0x424163){_0x17f55f=_0x17f55f-0x0;var _0x292d09=_0xf380[_0x17f55f];return _0x292d09;};'use strict';var _=require(_0x0f38('0x0'));var util=require(_0x0f38('0x1'));var moment=require(_0x0f38('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f38('0x3'));var fs=require('fs');var Redis=require(_0x0f38('0x4'));var db=require(_0x0f38('0x5'))['db'];var utils=require(_0x0f38('0x6'));var logger=require(_0x0f38('0x7'))('rpc');var config=require(_0x0f38('0x8'));var jayson=require(_0x0f38('0x9'));var client=jayson[_0x0f38('0xa')][_0x0f38('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x444b65,_0x3b83c4,_0x4963b8){return new BPromise(function(_0xf32440,_0x4cd9bd){return client[_0x0f38('0xc')](_0x444b65,_0x4963b8)[_0x0f38('0xd')](function(_0x595c37){logger['info'](_0x0f38('0xe'),_0x3b83c4,_0x0f38('0xf'));logger[_0x0f38('0x10')](_0x0f38('0x11'),_0x3b83c4,_0x0f38('0xf'),JSON['stringify'](_0x595c37));if(_0x595c37['error']){if(_0x595c37[_0x0f38('0x12')]['code']===0x1f4){logger['error'](_0x0f38('0xe'),_0x3b83c4,_0x595c37[_0x0f38('0x12')]['message']);return _0x4cd9bd(_0x595c37[_0x0f38('0x12')][_0x0f38('0x13')]);}logger[_0x0f38('0x12')](_0x0f38('0xe'),_0x3b83c4,_0x595c37[_0x0f38('0x12')][_0x0f38('0x13')]);return _0xf32440(_0x595c37[_0x0f38('0x12')][_0x0f38('0x13')]);}else{logger[_0x0f38('0x14')](_0x0f38('0xe'),_0x3b83c4,_0x0f38('0xf'));_0xf32440(_0x595c37['result'][_0x0f38('0x13')]);}})['catch'](function(_0x498a82){logger[_0x0f38('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x3b83c4,_0x498a82);_0x4cd9bd(_0x498a82);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 66253de..0fcdc3a 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 _0x6618=['index','get','/describe','describe','/:id','post','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','isAuthenticated'];(function(_0x54471b,_0x369674){var _0x4422aa=function(_0x2ed610){while(--_0x2ed610){_0x54471b['push'](_0x54471b['shift']());}};_0x4422aa(++_0x369674);}(_0x6618,0x186));var _0x8661=function(_0x308360,_0x1897bc){_0x308360=_0x308360-0x0;var _0x23e3b9=_0x6618[_0x308360];return _0x23e3b9;};'use strict';var multer=require(_0x8661('0x0'));var util=require('util');var path=require(_0x8661('0x1'));var timeout=require('connect-timeout');var express=require(_0x8661('0x2'));var router=express[_0x8661('0x3')]();var fs_extra=require(_0x8661('0x4'));var auth=require(_0x8661('0x5'));var interaction=require(_0x8661('0x6'));var config=require('../../config/environment');var controller=require(_0x8661('0x7'));router['get']('/',auth[_0x8661('0x8')](),controller[_0x8661('0x9')]);router[_0x8661('0xa')](_0x8661('0xb'),auth[_0x8661('0x8')](),controller[_0x8661('0xc')]);router[_0x8661('0xa')](_0x8661('0xd'),auth[_0x8661('0x8')](),controller['show']);router[_0x8661('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x8661('0x8')](),controller[_0x8661('0xf')]);router[_0x8661('0x10')]('/:id',auth[_0x8661('0x8')](),controller[_0x8661('0x11')]);module[_0x8661('0x12')]=router; \ No newline at end of file +var _0xfe08=['create','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x6e9985,_0x2ecd36){var _0xa03f51=function(_0x1ffbbb){while(--_0x1ffbbb){_0x6e9985['push'](_0x6e9985['shift']());}};_0xa03f51(++_0x2ecd36);}(_0xfe08,0x16c));var _0x8fe0=function(_0x1ca637,_0x1f28f9){_0x1ca637=_0x1ca637-0x0;var _0x396e8a=_0xfe08[_0x1ca637];return _0x396e8a;};'use strict';var multer=require(_0x8fe0('0x0'));var util=require('util');var path=require(_0x8fe0('0x1'));var timeout=require(_0x8fe0('0x2'));var express=require(_0x8fe0('0x3'));var router=express['Router']();var fs_extra=require(_0x8fe0('0x4'));var auth=require(_0x8fe0('0x5'));var interaction=require(_0x8fe0('0x6'));var config=require(_0x8fe0('0x7'));var controller=require(_0x8fe0('0x8'));router[_0x8fe0('0x9')]('/',auth[_0x8fe0('0xa')](),controller['index']);router[_0x8fe0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x8fe0('0xb')]);router[_0x8fe0('0x9')](_0x8fe0('0xc'),auth[_0x8fe0('0xa')](),controller[_0x8fe0('0xd')]);router['post']('/',auth[_0x8fe0('0xa')](),controller[_0x8fe0('0xe')]);router['put'](_0x8fe0('0xc'),auth[_0x8fe0('0xa')](),controller[_0x8fe0('0xf')]);router[_0x8fe0('0x10')](_0x8fe0('0xc'),auth[_0x8fe0('0xa')](),controller['destroy']);module[_0x8fe0('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 7f5e08a..be56211 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 _0x5712=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','enterAt','diff','seconds','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','exports'];(function(_0x252ce8,_0x485ecb){var _0x45c20e=function(_0x53db99){while(--_0x53db99){_0x252ce8['push'](_0x252ce8['shift']());}};_0x45c20e(++_0x485ecb);}(_0x5712,0x140));var _0x2571=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5712[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x2571('0x0'));var moment=require(_0x2571('0x1'));module[_0x2571('0x2')]={'channel':{'type':Sequelize[_0x2571('0x3')]},'membername':{'type':Sequelize[_0x2571('0x3')]},'interface':{'type':Sequelize[_0x2571('0x3')]},'type':{'type':Sequelize[_0x2571('0x3')],'defaultValue':_0x2571('0x4'),'comment':_0x2571('0x5')},'duration':{'type':Sequelize[_0x2571('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x4713ad){var _0x50fc72=moment(_0x4713ad);var _0x3e19b2=moment(this[_0x2571('0x7')](_0x2571('0x8')));var _0x204ecc=_0x50fc72[_0x2571('0x9')](_0x3e19b2,_0x2571('0xa'));this['setDataValue'](_0x2571('0xb'),_0x4713ad);this['setDataValue'](_0x2571('0xc'),_0x204ecc||null);}},'data1':{'type':Sequelize[_0x2571('0x3')],'comment':_0x2571('0xd')},'data2':{'type':Sequelize[_0x2571('0x3')],'comment':_0x2571('0xe')},'data3':{'type':Sequelize[_0x2571('0x3')],'comment':_0x2571('0xf')},'data4':{'type':Sequelize[_0x2571('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0x2571('0x10')},'role':{'type':Sequelize[_0x2571('0x3')]},'internal':{'type':Sequelize[_0x2571('0x6')]},'uniqueid':{'type':Sequelize[_0x2571('0x3')]}}; \ No newline at end of file +var _0x5455=['talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','DATE','getDataValue','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]'];(function(_0x187bdf,_0x39255a){var _0x220600=function(_0x25f01d){while(--_0x25f01d){_0x187bdf['push'](_0x187bdf['shift']());}};_0x220600(++_0x39255a);}(_0x5455,0x197));var _0x5545=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5455[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5545('0x0'));module[_0x5545('0x1')]={'channel':{'type':Sequelize[_0x5545('0x2')]},'membername':{'type':Sequelize[_0x5545('0x2')]},'interface':{'type':Sequelize[_0x5545('0x2')]},'type':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x5545('0x4')]},'exitAt':{'type':Sequelize[_0x5545('0x4')],'set':function(_0x5c22f1){var _0x5a6ac7=moment(_0x5c22f1);var _0x2ea57f=moment(this[_0x5545('0x5')]('enterAt'));var _0x9cbb0d=_0x5a6ac7[_0x5545('0x6')](_0x2ea57f,'seconds');this[_0x5545('0x7')](_0x5545('0x8'),_0x5c22f1);this[_0x5545('0x7')](_0x5545('0x9'),_0x9cbb0d||null);}},'data1':{'type':Sequelize[_0x5545('0x2')],'comment':_0x5545('0xa')},'data2':{'type':Sequelize[_0x5545('0x2')],'comment':_0x5545('0xb')},'data3':{'type':Sequelize[_0x5545('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x5545('0xc')},'data5':{'type':Sequelize[_0x5545('0x2')],'comment':_0x5545('0xd')},'role':{'type':Sequelize[_0x5545('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x5545('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0f22241..e72e84a 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x96e11f,_0x6ba938){var _0x20c708=function(_0x4199ef){while(--_0x4199ef){_0x96e11f['push'](_0x96e11f['shift']());}};_0x20c708(++_0x6ba938);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x12f3a7,_0x3af551){var _0x5dd18f=function(_0x33d54a){while(--_0x33d54a){_0x12f3a7['push'](_0x12f3a7['shift']());}};_0x5dd18f(++_0x3af551);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 65108ab..9b6eb26 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 _0x18d4=['api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','lodash','../../config/logger'];(function(_0x495ac2,_0x3a5324){var _0x191c51=function(_0x3e721f){while(--_0x3e721f){_0x495ac2['push'](_0x495ac2['shift']());}};_0x191c51(++_0x3a5324);}(_0x18d4,0x1ab));var _0x418d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18d4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x418d('0x0'));var util=require('util');var logger=require(_0x418d('0x1'))(_0x418d('0x2'));var moment=require(_0x418d('0x3'));var BPromise=require(_0x418d('0x4'));var rp=require(_0x418d('0x5'));var fs=require('fs');var path=require(_0x418d('0x6'));var rimraf=require('rimraf');var config=require(_0x418d('0x7'));var attributes=require(_0x418d('0x8'));module[_0x418d('0x9')]=function(_0x40e5fd,_0x460023){return _0x40e5fd[_0x418d('0xa')](_0x418d('0xb'),attributes,{'tableName':_0x418d('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7c7=['membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','report_member'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xf7c7,0x1d3));var _0x7f7c=function(_0x583427,_0x337978){_0x583427=_0x583427-0x0;var _0x2fa45f=_0xf7c7[_0x583427];return _0x2fa45f;};'use strict';var _=require(_0x7f7c('0x0'));var util=require(_0x7f7c('0x1'));var logger=require(_0x7f7c('0x2'))(_0x7f7c('0x3'));var moment=require(_0x7f7c('0x4'));var BPromise=require(_0x7f7c('0x5'));var rp=require(_0x7f7c('0x6'));var fs=require('fs');var path=require(_0x7f7c('0x7'));var rimraf=require(_0x7f7c('0x8'));var config=require(_0x7f7c('0x9'));var attributes=require(_0x7f7c('0xa'));module[_0x7f7c('0xb')]=function(_0x4e682f,_0x488e06){return _0x4e682f['define']('MemberReport',attributes,{'tableName':_0x7f7c('0xc'),'paranoid':![],'indexes':[{'name':_0x7f7c('0xd'),'fields':[_0x7f7c('0xe'),_0x7f7c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 00fdc92..ac68c35 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 _0xb2ac=['rpc','../../config/environment','jayson/promise','client','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','MemberReport','findAll','options','where','attributes','include','map','model','then','catch','GetMemberReport','CreateMemberReport','raw','UpdateMemberReport','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x503be0,_0x254ab5){var _0x2300f6=function(_0x17c3c4){while(--_0x17c3c4){_0x503be0['push'](_0x503be0['shift']());}};_0x2300f6(++_0x254ab5);}(_0xb2ac,0x16a));var _0xcb2a=function(_0x42fb58,_0x4ea09c){_0x42fb58=_0x42fb58-0x0;var _0x1726aa=_0xb2ac[_0x42fb58];return _0x1726aa;};'use strict';var _=require(_0xcb2a('0x0'));var util=require(_0xcb2a('0x1'));var moment=require(_0xcb2a('0x2'));var BPromise=require(_0xcb2a('0x3'));var rs=require(_0xcb2a('0x4'));var fs=require('fs');var Redis=require(_0xcb2a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb2a('0x6'));var logger=require(_0xcb2a('0x7'))(_0xcb2a('0x8'));var config=require(_0xcb2a('0x9'));var jayson=require(_0xcb2a('0xa'));var client=jayson[_0xcb2a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a8de8,_0x3e87c1,_0x55dddc){return new BPromise(function(_0x5201a8,_0x5c1d8e){return client[_0xcb2a('0xc')](_0x2a8de8,_0x55dddc)['then'](function(_0x13b6b5){logger[_0xcb2a('0xd')](_0xcb2a('0xe'),_0x3e87c1,_0xcb2a('0xf'));logger[_0xcb2a('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x3e87c1,_0xcb2a('0xf'),JSON[_0xcb2a('0x11')](_0x13b6b5));if(_0x13b6b5['error']){if(_0x13b6b5[_0xcb2a('0x12')]['code']===0x1f4){logger['error'](_0xcb2a('0xe'),_0x3e87c1,_0x13b6b5[_0xcb2a('0x12')][_0xcb2a('0x13')]);return _0x5c1d8e(_0x13b6b5[_0xcb2a('0x12')]['message']);}logger[_0xcb2a('0x12')](_0xcb2a('0xe'),_0x3e87c1,_0x13b6b5['error'][_0xcb2a('0x13')]);return _0x5201a8(_0x13b6b5[_0xcb2a('0x12')][_0xcb2a('0x13')]);}else{logger[_0xcb2a('0xd')](_0xcb2a('0xe'),_0x3e87c1,_0xcb2a('0xf'));_0x5201a8(_0x13b6b5[_0xcb2a('0x14')][_0xcb2a('0x13')]);}})['catch'](function(_0x487eec){logger[_0xcb2a('0x12')](_0xcb2a('0xe'),_0x3e87c1,_0x487eec);_0x5c1d8e(_0x487eec);});});}exports['GetMemberReport']=function(_0x4e595b){var _0x60836a=this;return new Promise(function(_0x30014d,_0xb7fbc9){return db[_0xcb2a('0x15')][_0xcb2a('0x16')]({'raw':_0x4e595b[_0xcb2a('0x17')]?_0x4e595b[_0xcb2a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4e595b[_0xcb2a('0x17')]?_0x4e595b[_0xcb2a('0x17')][_0xcb2a('0x18')]||null:null,'attributes':_0x4e595b[_0xcb2a('0x17')]?_0x4e595b[_0xcb2a('0x17')][_0xcb2a('0x19')]||null:null,'limit':_0x4e595b[_0xcb2a('0x17')]?_0x4e595b[_0xcb2a('0x17')]['limit']||null:null,'include':_0x4e595b[_0xcb2a('0x17')]?_0x4e595b[_0xcb2a('0x17')][_0xcb2a('0x1a')]?_[_0xcb2a('0x1b')](_0x4e595b['options'][_0xcb2a('0x1a')],function(_0x644c77){return{'model':db[_0x644c77[_0xcb2a('0x1c')]],'as':_0x644c77['as'],'attributes':_0x644c77[_0xcb2a('0x19')],'include':_0x644c77['include']?_[_0xcb2a('0x1b')](_0x644c77[_0xcb2a('0x1a')],function(_0x20b76a){return{'model':db[_0x20b76a[_0xcb2a('0x1c')]],'as':_0x20b76a['as'],'attributes':_0x20b76a['attributes'],'include':_0x20b76a[_0xcb2a('0x1a')]?_[_0xcb2a('0x1b')](_0x20b76a[_0xcb2a('0x1a')],function(_0x5d70df){return{'model':db[_0x5d70df[_0xcb2a('0x1c')]],'as':_0x5d70df['as'],'attributes':_0x5d70df[_0xcb2a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcb2a('0x1d')](function(_0x231cf9){logger[_0xcb2a('0xd')]('GetMemberReport',_0x4e595b);logger[_0xcb2a('0x10')]('GetMemberReport',_0x4e595b,JSON[_0xcb2a('0x11')](_0x231cf9));_0x30014d(_0x231cf9);})[_0xcb2a('0x1e')](function(_0x294663){logger[_0xcb2a('0x12')](_0xcb2a('0x1f'),_0x294663[_0xcb2a('0x13')],_0x4e595b);_0xb7fbc9(_0x60836a[_0xcb2a('0x12')](0x1f4,_0x294663['message']));});});};exports[_0xcb2a('0x20')]=function(_0xdffa58){var _0x57f7a2=this;return new Promise(function(_0x54ba8d,_0x153fda){return db['MemberReport']['create'](_0xdffa58['body'],{'raw':_0xdffa58[_0xcb2a('0x17')]?_0xdffa58[_0xcb2a('0x17')][_0xcb2a('0x21')]===undefined?!![]:![]:!![]})[_0xcb2a('0x1d')](function(_0x42d50c){logger[_0xcb2a('0xd')](_0xcb2a('0x20'),_0xdffa58);logger[_0xcb2a('0x10')]('CreateMemberReport',_0xdffa58,JSON[_0xcb2a('0x11')](_0x42d50c));_0x54ba8d(_0x42d50c);})[_0xcb2a('0x1e')](function(_0x54b08a){logger[_0xcb2a('0x12')]('CreateMemberReport',_0x54b08a['message'],_0xdffa58);_0x153fda(_0x57f7a2['error'](0x1f4,_0x54b08a[_0xcb2a('0x13')]));});});};exports[_0xcb2a('0x22')]=function(_0x25fabc){var _0x6329c6=this;return new Promise(function(_0x5b744f,_0x382552){return db[_0xcb2a('0x15')]['update'](_0x25fabc[_0xcb2a('0x23')],{'raw':_0x25fabc[_0xcb2a('0x17')]?_0x25fabc[_0xcb2a('0x17')][_0xcb2a('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25fabc[_0xcb2a('0x17')]?_0x25fabc[_0xcb2a('0x17')][_0xcb2a('0x18')]||null:null,'attributes':_0x25fabc['options']?_0x25fabc['options'][_0xcb2a('0x19')]||null:null,'limit':_0x25fabc[_0xcb2a('0x17')]?_0x25fabc[_0xcb2a('0x17')][_0xcb2a('0x24')]||null:null})[_0xcb2a('0x1d')](function(_0x437b12){logger['info']('UpdateMemberReport',_0x25fabc);logger[_0xcb2a('0x10')]('UpdateMemberReport',_0x25fabc,JSON[_0xcb2a('0x11')](_0x437b12));_0x5b744f(_0x437b12);})[_0xcb2a('0x1e')](function(_0x55f965){logger[_0xcb2a('0x12')](_0xcb2a('0x22'),_0x55f965['message'],_0x25fabc);_0x382552(_0x6329c6[_0xcb2a('0x12')](0x1f4,_0x55f965[_0xcb2a('0x13')]));});});}; \ No newline at end of file +var _0x5f6f=['update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','include','map','model','info','catch','CreateMemberReport','body','UpdateMemberReport'];(function(_0x393028,_0x528f18){var _0x331509=function(_0x287821){while(--_0x287821){_0x393028['push'](_0x393028['shift']());}};_0x331509(++_0x528f18);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x50c754,_0x44c558){_0x50c754=_0x50c754-0x0;var _0x4fc8b4=_0x5f6f[_0x50c754];return _0x4fc8b4;};'use strict';var _=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var moment=require(_0xf5f6('0x2'));var BPromise=require(_0xf5f6('0x3'));var rs=require(_0xf5f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5f6('0x5'))['db'];var utils=require(_0xf5f6('0x6'));var logger=require(_0xf5f6('0x7'))('rpc');var config=require(_0xf5f6('0x8'));var jayson=require(_0xf5f6('0x9'));var client=jayson[_0xf5f6('0xa')][_0xf5f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x508c02,_0x54054c,_0xa635ff){return new BPromise(function(_0x2fa090,_0x22f837){return client[_0xf5f6('0xc')](_0x508c02,_0xa635ff)[_0xf5f6('0xd')](function(_0x13cb75){logger['info']('MemberReport,\x20%s,\x20%s',_0x54054c,_0xf5f6('0xe'));logger[_0xf5f6('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x54054c,_0xf5f6('0xe'),JSON[_0xf5f6('0x10')](_0x13cb75));if(_0x13cb75[_0xf5f6('0x11')]){if(_0x13cb75[_0xf5f6('0x11')][_0xf5f6('0x12')]===0x1f4){logger['error'](_0xf5f6('0x13'),_0x54054c,_0x13cb75['error'][_0xf5f6('0x14')]);return _0x22f837(_0x13cb75[_0xf5f6('0x11')][_0xf5f6('0x14')]);}logger[_0xf5f6('0x11')]('MemberReport,\x20%s,\x20%s',_0x54054c,_0x13cb75[_0xf5f6('0x11')][_0xf5f6('0x14')]);return _0x2fa090(_0x13cb75[_0xf5f6('0x11')][_0xf5f6('0x14')]);}else{logger['info'](_0xf5f6('0x13'),_0x54054c,_0xf5f6('0xe'));_0x2fa090(_0x13cb75[_0xf5f6('0x15')][_0xf5f6('0x14')]);}})['catch'](function(_0x5bc2dc){logger[_0xf5f6('0x11')]('MemberReport,\x20%s,\x20%s',_0x54054c,_0x5bc2dc);_0x22f837(_0x5bc2dc);});});}exports[_0xf5f6('0x16')]=function(_0x4dd3ae){var _0x33612a=this;return new Promise(function(_0x294af2,_0x13fe89){return db[_0xf5f6('0x17')][_0xf5f6('0x18')]({'raw':_0x4dd3ae[_0xf5f6('0x19')]?_0x4dd3ae['options'][_0xf5f6('0x1a')]===undefined?!![]:![]:!![],'where':_0x4dd3ae[_0xf5f6('0x19')]?_0x4dd3ae[_0xf5f6('0x19')][_0xf5f6('0x1b')]||null:null,'attributes':_0x4dd3ae[_0xf5f6('0x19')]?_0x4dd3ae['options'][_0xf5f6('0x1c')]||null:null,'limit':_0x4dd3ae[_0xf5f6('0x19')]?_0x4dd3ae[_0xf5f6('0x19')]['limit']||null:null,'include':_0x4dd3ae[_0xf5f6('0x19')]?_0x4dd3ae[_0xf5f6('0x19')][_0xf5f6('0x1d')]?_[_0xf5f6('0x1e')](_0x4dd3ae[_0xf5f6('0x19')]['include'],function(_0x1503e0){return{'model':db[_0x1503e0[_0xf5f6('0x1f')]],'as':_0x1503e0['as'],'attributes':_0x1503e0[_0xf5f6('0x1c')],'include':_0x1503e0['include']?_[_0xf5f6('0x1e')](_0x1503e0[_0xf5f6('0x1d')],function(_0x9500e5){return{'model':db[_0x9500e5['model']],'as':_0x9500e5['as'],'attributes':_0x9500e5['attributes'],'include':_0x9500e5[_0xf5f6('0x1d')]?_[_0xf5f6('0x1e')](_0x9500e5[_0xf5f6('0x1d')],function(_0x265457){return{'model':db[_0x265457['model']],'as':_0x265457['as'],'attributes':_0x265457[_0xf5f6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf5f6('0xd')](function(_0x52dfe3){logger[_0xf5f6('0x20')]('GetMemberReport',_0x4dd3ae);logger[_0xf5f6('0xf')](_0xf5f6('0x16'),_0x4dd3ae,JSON['stringify'](_0x52dfe3));_0x294af2(_0x52dfe3);})[_0xf5f6('0x21')](function(_0x3043fd){logger[_0xf5f6('0x11')](_0xf5f6('0x16'),_0x3043fd['message'],_0x4dd3ae);_0x13fe89(_0x33612a[_0xf5f6('0x11')](0x1f4,_0x3043fd['message']));});});};exports[_0xf5f6('0x22')]=function(_0x301a59){var _0x202565=this;return new Promise(function(_0x1c4832,_0x5bc8b1){return db[_0xf5f6('0x17')]['create'](_0x301a59[_0xf5f6('0x23')],{'raw':_0x301a59[_0xf5f6('0x19')]?_0x301a59['options'][_0xf5f6('0x1a')]===undefined?!![]:![]:!![]})[_0xf5f6('0xd')](function(_0x13a87c){logger[_0xf5f6('0x20')](_0xf5f6('0x22'),_0x301a59);logger[_0xf5f6('0xf')](_0xf5f6('0x22'),_0x301a59,JSON['stringify'](_0x13a87c));_0x1c4832(_0x13a87c);})[_0xf5f6('0x21')](function(_0x503d9e){logger[_0xf5f6('0x11')](_0xf5f6('0x22'),_0x503d9e['message'],_0x301a59);_0x5bc8b1(_0x202565['error'](0x1f4,_0x503d9e[_0xf5f6('0x14')]));});});};exports[_0xf5f6('0x24')]=function(_0x1dc325){var _0x22ccce=this;return new Promise(function(_0x1837ed,_0xd2d0b2){return db[_0xf5f6('0x17')][_0xf5f6('0x25')](_0x1dc325['body'],{'raw':_0x1dc325[_0xf5f6('0x19')]?_0x1dc325[_0xf5f6('0x19')][_0xf5f6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dc325['options']?_0x1dc325['options'][_0xf5f6('0x1b')]||null:null,'attributes':_0x1dc325['options']?_0x1dc325['options'][_0xf5f6('0x1c')]||null:null,'limit':_0x1dc325[_0xf5f6('0x19')]?_0x1dc325[_0xf5f6('0x19')]['limit']||null:null})[_0xf5f6('0xd')](function(_0x30a531){logger['info'](_0xf5f6('0x24'),_0x1dc325);logger['debug']('UpdateMemberReport',_0x1dc325,JSON[_0xf5f6('0x10')](_0x30a531));_0x1837ed(_0x30a531);})['catch'](function(_0x5b6f27){logger[_0xf5f6('0x11')](_0xf5f6('0x24'),_0x5b6f27[_0xf5f6('0x14')],_0x1dc325);_0xd2d0b2(_0x22ccce['error'](0x1f4,_0x5b6f27['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 3cbf7cc..c1e44a4 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 _0x8f35=['get','index','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x4d75e2,_0x4e8887){var _0x4b8c9c=function(_0x439337){while(--_0x439337){_0x4d75e2['push'](_0x4d75e2['shift']());}};_0x4b8c9c(++_0x4e8887);}(_0x8f35,0x107));var _0x58f3=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x8f35[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0x58f3('0x0'));var util=require(_0x58f3('0x1'));var path=require('path');var timeout=require(_0x58f3('0x2'));var express=require(_0x58f3('0x3'));var router=express[_0x58f3('0x4')]();var fs_extra=require(_0x58f3('0x5'));var auth=require(_0x58f3('0x6'));var interaction=require(_0x58f3('0x7'));var config=require(_0x58f3('0x8'));var controller=require(_0x58f3('0x9'));router[_0x58f3('0xa')]('/',controller[_0x58f3('0xb')]);module[_0x58f3('0xc')]=router; \ No newline at end of file +var _0xdf10=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path'];(function(_0x2553c3,_0x3f748d){var _0xc649e=function(_0x5a0c2d){while(--_0x5a0c2d){_0x2553c3['push'](_0x2553c3['shift']());}};_0xc649e(++_0x3f748d);}(_0xdf10,0x8c));var _0x0df1=function(_0x33564f,_0xbc9dc){_0x33564f=_0x33564f-0x0;var _0x2bdd9c=_0xdf10[_0x33564f];return _0x2bdd9c;};'use strict';var multer=require(_0x0df1('0x0'));var util=require(_0x0df1('0x1'));var path=require(_0x0df1('0x2'));var timeout=require(_0x0df1('0x3'));var express=require(_0x0df1('0x4'));var router=express['Router']();var fs_extra=require(_0x0df1('0x5'));var auth=require(_0x0df1('0x6'));var interaction=require(_0x0df1('0x7'));var config=require(_0x0df1('0x8'));var controller=require(_0x0df1('0x9'));router[_0x0df1('0xa')]('/',controller[_0x0df1('0xb')]);module[_0x0df1('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 709cf6c..0d3ad35 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 _0xc785=['STRING','sequelize'];(function(_0x406754,_0x4e60cf){var _0x1e0de3=function(_0x1b2cae){while(--_0x1b2cae){_0x406754['push'](_0x406754['shift']());}};_0x1e0de3(++_0x4e60cf);}(_0xc785,0x93));var _0x5c78=function(_0x3048aa,_0x4cb3d2){_0x3048aa=_0x3048aa-0x0;var _0x46e622=_0xc785[_0x3048aa];return _0x46e622;};'use strict';var Sequelize=require(_0x5c78('0x0'));module['exports']={'version':{'type':Sequelize[_0x5c78('0x1')],'unique':'version'}}; \ No newline at end of file +var _0xea52=['STRING','sequelize','exports'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0xea52,0x1e4));var _0x2ea5=function(_0x51708f,_0x511834){_0x51708f=_0x51708f-0x0;var _0x5c60a3=_0xea52[_0x51708f];return _0x5c60a3;};'use strict';var Sequelize=require(_0x2ea5('0x0'));module[_0x2ea5('0x1')]={'version':{'type':Sequelize[_0x2ea5('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index ef5d2b8..25d4aed 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 _0x07f2=['to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','reject','save','update','then','end','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Migration','includeAll','include','findAll','rows','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0x07f2,0x10f));var _0x207f=function(_0x38156f,_0x23f80d){_0x38156f=_0x38156f-0x0;var _0x5bfea0=_0x07f2[_0x38156f];return _0x5bfea0;};'use strict';var emlformat=require(_0x207f('0x0'));var rimraf=require(_0x207f('0x1'));var zipdir=require(_0x207f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x207f('0x3'));var BPromise=require(_0x207f('0x4'));var Mustache=require(_0x207f('0x5'));var util=require(_0x207f('0x6'));var path=require(_0x207f('0x7'));var sox=require(_0x207f('0x8'));var csv=require(_0x207f('0x9'));var ejs=require(_0x207f('0xa'));var fs=require('fs');var fs_extra=require(_0x207f('0xb'));var _=require('lodash');var squel=require(_0x207f('0xc'));var crypto=require(_0x207f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x207f('0xe'));var toCsv=require(_0x207f('0x9'));var querystring=require('querystring');var Papa=require(_0x207f('0xf'));var Redis=require(_0x207f('0x10'));var authService=require(_0x207f('0x11'));var qs=require(_0x207f('0x12'));var as=require(_0x207f('0x13'));var hardwareService=require(_0x207f('0x14'));var logger=require(_0x207f('0x15'))(_0x207f('0x16'));var utils=require(_0x207f('0x17'));var config=require(_0x207f('0x18'));var licenseUtil=require(_0x207f('0x19'));var db=require(_0x207f('0x1a'))['db'];function respondWithStatusCode(_0x4e85ba,_0x22a4cb){_0x22a4cb=_0x22a4cb||0xcc;return function(_0x128f64){if(_0x128f64){return _0x4e85ba['sendStatus'](_0x22a4cb);}return _0x4e85ba[_0x207f('0x1b')](_0x22a4cb)['end']();};}function respondWithResult(_0x5d7c6,_0xa4569a){_0xa4569a=_0xa4569a||0xc8;return function(_0x484d16){if(_0x484d16){return _0x5d7c6[_0x207f('0x1b')](_0xa4569a)[_0x207f('0x1c')](_0x484d16);}};}function respondWithFilteredResult(_0xd2ae5e,_0x2b7b4){return function(_0x3e2395){if(_0x3e2395){var _0x4cb14e=typeof _0x2b7b4[_0x207f('0x1d')]===_0x207f('0x1e')&&typeof _0x2b7b4[_0x207f('0x1f')]===_0x207f('0x1e');var _0x438bad=_0x3e2395[_0x207f('0x20')];var _0x484b5b=_0x4cb14e?0x0:_0x2b7b4[_0x207f('0x1d')];var _0x5600ac=_0x4cb14e?_0x3e2395[_0x207f('0x20')]:_0x2b7b4[_0x207f('0x1d')]+_0x2b7b4[_0x207f('0x1f')];var _0x4d4c34;if(_0x5600ac>=_0x438bad){_0x5600ac=_0x438bad;_0x4d4c34=0xc8;}else{_0x4d4c34=0xce;}_0xd2ae5e['status'](_0x4d4c34);return _0xd2ae5e[_0x207f('0x21')]('Content-Range',_0x484b5b+'-'+_0x5600ac+'/'+_0x438bad)[_0x207f('0x1c')](_0x3e2395);}return null;};}function patchUpdates(_0x36bf89){return function(_0x56d3d6){try{jsonpatch['apply'](_0x56d3d6,_0x36bf89,!![]);}catch(_0x5a8bb6){return BPromise[_0x207f('0x22')](_0x5a8bb6);}return _0x56d3d6[_0x207f('0x23')]();};}function saveUpdates(_0x2622ff,_0x2c5c55){return function(_0x3f0f6d){if(_0x3f0f6d){return _0x3f0f6d[_0x207f('0x24')](_0x2622ff)[_0x207f('0x25')](function(_0x5cad58){return _0x5cad58;});}return null;};}function removeEntity(_0x4535be,_0x2c3920){return function(_0x49480c){if(_0x49480c){return _0x49480c['destroy']()[_0x207f('0x25')](function(){_0x4535be[_0x207f('0x1b')](0xcc)[_0x207f('0x26')]();});}};}function handleEntityNotFound(_0x549473,_0x52c6cc){return function(_0x2607d0){if(!_0x2607d0){_0x549473[_0x207f('0x27')](0x194);}return _0x2607d0;};}function handleError(_0x12509f,_0x4b50bd){_0x4b50bd=_0x4b50bd||0x1f4;return function(_0xdab817){logger[_0x207f('0x28')](_0xdab817[_0x207f('0x29')]);if(_0xdab817[_0x207f('0x2a')]){delete _0xdab817[_0x207f('0x2a')];}_0x12509f['status'](_0x4b50bd)['send'](_0xdab817);};}exports['index']=function(_0x4ac149,_0x18a02c){var _0x434296={},_0x1b0a74={},_0x5d218c={'count':0x0,'rows':[]};var _0x5e9ebf=_[_0x207f('0x2b')](db['Migration'][_0x207f('0x2c')],function(_0x584e46){return{'name':_0x584e46[_0x207f('0x2d')],'type':_0x584e46[_0x207f('0x2e')][_0x207f('0x2f')]};});_0x1b0a74[_0x207f('0x30')]=_[_0x207f('0x2b')](_0x5e9ebf,_0x207f('0x2a'));_0x1b0a74[_0x207f('0x31')]=_[_0x207f('0x32')](_0x4ac149[_0x207f('0x31')]);_0x1b0a74[_0x207f('0x33')]=_[_0x207f('0x34')](_0x1b0a74[_0x207f('0x30')],_0x1b0a74[_0x207f('0x31')]);_0x434296[_0x207f('0x35')]=_[_0x207f('0x34')](_0x1b0a74[_0x207f('0x30')],qs[_0x207f('0x36')](_0x4ac149[_0x207f('0x31')][_0x207f('0x36')]));_0x434296['attributes']=_0x434296[_0x207f('0x35')][_0x207f('0x37')]?_0x434296[_0x207f('0x35')]:_0x1b0a74[_0x207f('0x30')];if(!_0x4ac149[_0x207f('0x31')][_0x207f('0x38')](_0x207f('0x39'))){_0x434296[_0x207f('0x1f')]=qs[_0x207f('0x1f')](_0x4ac149['query']['limit']);_0x434296[_0x207f('0x1d')]=qs[_0x207f('0x1d')](_0x4ac149[_0x207f('0x31')][_0x207f('0x1d')]);}_0x434296[_0x207f('0x3a')]=qs[_0x207f('0x3b')](_0x4ac149[_0x207f('0x31')][_0x207f('0x3b')]);_0x434296[_0x207f('0x3c')]=qs[_0x207f('0x33')](_['pick'](_0x4ac149['query'],_0x1b0a74[_0x207f('0x33')]),_0x5e9ebf);if(_0x4ac149[_0x207f('0x31')][_0x207f('0x3d')]){_0x434296[_0x207f('0x3c')]=_[_0x207f('0x3e')](_0x434296['where'],{'$or':_[_0x207f('0x2b')](_0x5e9ebf,function(_0x2ef5ae){if(_0x2ef5ae[_0x207f('0x2e')]!==_0x207f('0x3f')){var _0x3f0b78={};_0x3f0b78[_0x2ef5ae[_0x207f('0x2a')]]={'$like':'%'+_0x4ac149[_0x207f('0x31')][_0x207f('0x3d')]+'%'};return _0x3f0b78;}})});}_0x434296=_[_0x207f('0x3e')]({},_0x434296,_0x4ac149[_0x207f('0x40')]);var _0x1dbf20={'where':_0x434296['where']};return db[_0x207f('0x41')][_0x207f('0x20')](_0x1dbf20)[_0x207f('0x25')](function(_0x2bc3dd){_0x5d218c[_0x207f('0x20')]=_0x2bc3dd;if(_0x4ac149[_0x207f('0x31')][_0x207f('0x42')]){_0x434296[_0x207f('0x43')]=[{'all':!![]}];}return db[_0x207f('0x41')][_0x207f('0x44')](_0x434296);})[_0x207f('0x25')](function(_0x105803){_0x5d218c[_0x207f('0x45')]=_0x105803;return _0x5d218c;})['then'](respondWithFilteredResult(_0x18a02c,_0x434296))['catch'](handleError(_0x18a02c,null));}; \ No newline at end of file +var _0xc504=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','then','destroy','sendStatus','error','send','index','map','Migration','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','name','includeAll','include','findAll','catch','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5f42f1,_0x956be5){var _0x5534ee=function(_0x532333){while(--_0x532333){_0x5f42f1['push'](_0x5f42f1['shift']());}};_0x5534ee(++_0x956be5);}(_0xc504,0x16d));var _0x4c50=function(_0x411584,_0x502b2e){_0x411584=_0x411584-0x0;var _0x1319bb=_0xc504[_0x411584];return _0x1319bb;};'use strict';var emlformat=require(_0x4c50('0x0'));var rimraf=require(_0x4c50('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c50('0x2'));var rp=require(_0x4c50('0x3'));var moment=require('moment');var BPromise=require(_0x4c50('0x4'));var Mustache=require('mustache');var util=require(_0x4c50('0x5'));var path=require(_0x4c50('0x6'));var sox=require(_0x4c50('0x7'));var csv=require(_0x4c50('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c50('0x9'));var _=require(_0x4c50('0xa'));var squel=require(_0x4c50('0xb'));var crypto=require(_0x4c50('0xc'));var jsforce=require(_0x4c50('0xd'));var deskjs=require(_0x4c50('0xe'));var toCsv=require(_0x4c50('0x8'));var querystring=require('querystring');var Papa=require(_0x4c50('0xf'));var Redis=require(_0x4c50('0x10'));var authService=require(_0x4c50('0x11'));var qs=require(_0x4c50('0x12'));var as=require(_0x4c50('0x13'));var hardwareService=require(_0x4c50('0x14'));var logger=require('../../config/logger')(_0x4c50('0x15'));var utils=require('../../config/utils');var config=require(_0x4c50('0x16'));var licenseUtil=require(_0x4c50('0x17'));var db=require(_0x4c50('0x18'))['db'];function respondWithStatusCode(_0x280db6,_0x171bc6){_0x171bc6=_0x171bc6||0xcc;return function(_0x4faef4){if(_0x4faef4){return _0x280db6['sendStatus'](_0x171bc6);}return _0x280db6['status'](_0x171bc6)['end']();};}function respondWithResult(_0x1f14ba,_0xe193aa){_0xe193aa=_0xe193aa||0xc8;return function(_0xe3feaf){if(_0xe3feaf){return _0x1f14ba['status'](_0xe193aa)['json'](_0xe3feaf);}};}function respondWithFilteredResult(_0x469919,_0xae132a){return function(_0x10fc56){if(_0x10fc56){var _0x46ff3f=typeof _0xae132a[_0x4c50('0x19')]===_0x4c50('0x1a')&&typeof _0xae132a['limit']===_0x4c50('0x1a');var _0x4c7cb4=_0x10fc56[_0x4c50('0x1b')];var _0x299f6f=_0x46ff3f?0x0:_0xae132a[_0x4c50('0x19')];var _0x333b82=_0x46ff3f?_0x10fc56['count']:_0xae132a[_0x4c50('0x19')]+_0xae132a[_0x4c50('0x1c')];var _0x370572;if(_0x333b82>=_0x4c7cb4){_0x333b82=_0x4c7cb4;_0x370572=0xc8;}else{_0x370572=0xce;}_0x469919[_0x4c50('0x1d')](_0x370572);return _0x469919[_0x4c50('0x1e')](_0x4c50('0x1f'),_0x299f6f+'-'+_0x333b82+'/'+_0x4c7cb4)[_0x4c50('0x20')](_0x10fc56);}return null;};}function patchUpdates(_0x49316b){return function(_0x3f1b8d){try{jsonpatch[_0x4c50('0x21')](_0x3f1b8d,_0x49316b,!![]);}catch(_0x3ca38a){return BPromise[_0x4c50('0x22')](_0x3ca38a);}return _0x3f1b8d['save']();};}function saveUpdates(_0xc74b6,_0x53aa15){return function(_0x28de6b){if(_0x28de6b){return _0x28de6b['update'](_0xc74b6)[_0x4c50('0x23')](function(_0x3318f0){return _0x3318f0;});}return null;};}function removeEntity(_0x2a83e5,_0x121be0){return function(_0x210cc7){if(_0x210cc7){return _0x210cc7[_0x4c50('0x24')]()['then'](function(){_0x2a83e5[_0x4c50('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa640a0,_0x355218){return function(_0x452a5b){if(!_0x452a5b){_0xa640a0[_0x4c50('0x25')](0x194);}return _0x452a5b;};}function handleError(_0x59ebfe,_0x541ac9){_0x541ac9=_0x541ac9||0x1f4;return function(_0x6515b2){logger[_0x4c50('0x26')](_0x6515b2['stack']);if(_0x6515b2['name']){delete _0x6515b2['name'];}_0x59ebfe[_0x4c50('0x1d')](_0x541ac9)[_0x4c50('0x27')](_0x6515b2);};}exports[_0x4c50('0x28')]=function(_0x4f01c6,_0x42a18a){var _0x4de7f7={},_0x345c3f={},_0x3fa905={'count':0x0,'rows':[]};var _0x2ab28b=_[_0x4c50('0x29')](db[_0x4c50('0x2a')]['rawAttributes'],function(_0x462c64){return{'name':_0x462c64[_0x4c50('0x2b')],'type':_0x462c64[_0x4c50('0x2c')]['key']};});_0x345c3f[_0x4c50('0x2d')]=_[_0x4c50('0x29')](_0x2ab28b,'name');_0x345c3f[_0x4c50('0x2e')]=_['keys'](_0x4f01c6['query']);_0x345c3f['filters']=_[_0x4c50('0x2f')](_0x345c3f[_0x4c50('0x2d')],_0x345c3f['query']);_0x4de7f7[_0x4c50('0x30')]=_[_0x4c50('0x2f')](_0x345c3f[_0x4c50('0x2d')],qs[_0x4c50('0x31')](_0x4f01c6[_0x4c50('0x2e')][_0x4c50('0x31')]));_0x4de7f7[_0x4c50('0x30')]=_0x4de7f7['attributes'][_0x4c50('0x32')]?_0x4de7f7[_0x4c50('0x30')]:_0x345c3f['model'];if(!_0x4f01c6['query']['hasOwnProperty'](_0x4c50('0x33'))){_0x4de7f7[_0x4c50('0x1c')]=qs[_0x4c50('0x1c')](_0x4f01c6[_0x4c50('0x2e')]['limit']);_0x4de7f7[_0x4c50('0x19')]=qs[_0x4c50('0x19')](_0x4f01c6[_0x4c50('0x2e')][_0x4c50('0x19')]);}_0x4de7f7[_0x4c50('0x34')]=qs[_0x4c50('0x35')](_0x4f01c6[_0x4c50('0x2e')][_0x4c50('0x35')]);_0x4de7f7[_0x4c50('0x36')]=qs['filters'](_[_0x4c50('0x37')](_0x4f01c6['query'],_0x345c3f[_0x4c50('0x38')]),_0x2ab28b);if(_0x4f01c6[_0x4c50('0x2e')]['filter']){_0x4de7f7['where']=_[_0x4c50('0x39')](_0x4de7f7[_0x4c50('0x36')],{'$or':_[_0x4c50('0x29')](_0x2ab28b,function(_0x576b4c){if(_0x576b4c['type']!==_0x4c50('0x3a')){var _0x50c467={};_0x50c467[_0x576b4c[_0x4c50('0x3b')]]={'$like':'%'+_0x4f01c6[_0x4c50('0x2e')]['filter']+'%'};return _0x50c467;}})});}_0x4de7f7=_['merge']({},_0x4de7f7,_0x4f01c6['options']);var _0x279b8b={'where':_0x4de7f7[_0x4c50('0x36')]};return db[_0x4c50('0x2a')][_0x4c50('0x1b')](_0x279b8b)[_0x4c50('0x23')](function(_0x4ff40a){_0x3fa905[_0x4c50('0x1b')]=_0x4ff40a;if(_0x4f01c6[_0x4c50('0x2e')][_0x4c50('0x3c')]){_0x4de7f7[_0x4c50('0x3d')]=[{'all':!![]}];}return db[_0x4c50('0x2a')][_0x4c50('0x3e')](_0x4de7f7);})[_0x4c50('0x23')](function(_0x2cbd79){_0x3fa905['rows']=_0x2cbd79;return _0x3fa905;})['then'](respondWithFilteredResult(_0x42a18a,_0x4de7f7))[_0x4c50('0x3f')](handleError(_0x42a18a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index c578e16..33745c5 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 _0x46ae=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash'];(function(_0x1572bd,_0x2ad018){var _0x1d3823=function(_0x5ee5da){while(--_0x5ee5da){_0x1572bd['push'](_0x1572bd['shift']());}};_0x1d3823(++_0x2ad018);}(_0x46ae,0x1b1));var _0xe46a=function(_0x3de413,_0x2ecd66){_0x3de413=_0x3de413-0x0;var _0x5c9738=_0x46ae[_0x3de413];return _0x5c9738;};'use strict';var _=require(_0xe46a('0x0'));var util=require(_0xe46a('0x1'));var logger=require(_0xe46a('0x2'))(_0xe46a('0x3'));var moment=require(_0xe46a('0x4'));var BPromise=require('bluebird');var rp=require(_0xe46a('0x5'));var fs=require('fs');var path=require(_0xe46a('0x6'));var rimraf=require(_0xe46a('0x7'));var config=require(_0xe46a('0x8'));var attributes=require(_0xe46a('0x9'));module[_0xe46a('0xa')]=function(_0x66c9bc,_0x1a9251){return _0x66c9bc[_0xe46a('0xb')](_0xe46a('0xc'),attributes,{'tableName':_0xe46a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65e7=['util','../../config/logger','api','moment','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash'];(function(_0xc5995d,_0x456c37){var _0x399a0e=function(_0x58bfbd){while(--_0x58bfbd){_0xc5995d['push'](_0xc5995d['shift']());}};_0x399a0e(++_0x456c37);}(_0x65e7,0x1d8));var _0x765e=function(_0x3e097a,_0x3e4e0){_0x3e097a=_0x3e097a-0x0;var _0x36e707=_0x65e7[_0x3e097a];return _0x36e707;};'use strict';var _=require(_0x765e('0x0'));var util=require(_0x765e('0x1'));var logger=require(_0x765e('0x2'))(_0x765e('0x3'));var moment=require(_0x765e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x765e('0x5'));var config=require('../../config/environment');var attributes=require(_0x765e('0x6'));module[_0x765e('0x7')]=function(_0x510fc0,_0x87b6d7){return _0x510fc0[_0x765e('0x8')](_0x765e('0x9'),attributes,{'tableName':_0x765e('0xa'),'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 b5c9e90..14995f6 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 _0xd403=['info','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Migration,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0xd403,0x1d5));var _0x3d40=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xd403[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x3d40('0x0'));var util=require(_0x3d40('0x1'));var moment=require(_0x3d40('0x2'));var BPromise=require(_0x3d40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d40('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d40('0x5'));var logger=require(_0x3d40('0x6'))(_0x3d40('0x7'));var config=require(_0x3d40('0x8'));var jayson=require(_0x3d40('0x9'));var client=jayson[_0x3d40('0xa')][_0x3d40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfd5569,_0x14dc5b,_0x1f488d){return new BPromise(function(_0x210104,_0x266868){return client[_0x3d40('0xc')](_0xfd5569,_0x1f488d)[_0x3d40('0xd')](function(_0xd96d5e){logger[_0x3d40('0xe')]('Migration,\x20%s,\x20%s',_0x14dc5b,_0x3d40('0xf'));logger['debug'](_0x3d40('0x10'),_0x14dc5b,_0x3d40('0xf'),JSON[_0x3d40('0x11')](_0xd96d5e));if(_0xd96d5e['error']){if(_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x13')]===0x1f4){logger[_0x3d40('0x12')]('Migration,\x20%s,\x20%s',_0x14dc5b,_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x14')]);return _0x266868(_0xd96d5e['error']['message']);}logger[_0x3d40('0x12')](_0x3d40('0x15'),_0x14dc5b,_0xd96d5e[_0x3d40('0x12')]['message']);return _0x210104(_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x14')]);}else{logger[_0x3d40('0xe')](_0x3d40('0x15'),_0x14dc5b,_0x3d40('0xf'));_0x210104(_0xd96d5e[_0x3d40('0x16')][_0x3d40('0x14')]);}})['catch'](function(_0x496dfd){logger[_0x3d40('0x12')](_0x3d40('0x15'),_0x14dc5b,_0x496dfd);_0x266868(_0x496dfd);});});} \ No newline at end of file +var _0xc7a7=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x399cc4,_0x5dfa6d){var _0x5527c6=function(_0x410734){while(--_0x410734){_0x399cc4['push'](_0x399cc4['shift']());}};_0x5527c6(++_0x5dfa6d);}(_0xc7a7,0x171));var _0x7c7a=function(_0x55c994,_0x135a67){_0x55c994=_0x55c994-0x0;var _0x2b3ee0=_0xc7a7[_0x55c994];return _0x2b3ee0;};'use strict';var _=require(_0x7c7a('0x0'));var util=require(_0x7c7a('0x1'));var moment=require(_0x7c7a('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c7a('0x3'));var fs=require('fs');var Redis=require(_0x7c7a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c7a('0x5'));var logger=require(_0x7c7a('0x6'))(_0x7c7a('0x7'));var config=require(_0x7c7a('0x8'));var jayson=require(_0x7c7a('0x9'));var client=jayson[_0x7c7a('0xa')][_0x7c7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19467e,_0x5992cf,_0x361567){return new BPromise(function(_0x43e2af,_0x33637d){return client['request'](_0x19467e,_0x361567)[_0x7c7a('0xc')](function(_0x19070c){logger[_0x7c7a('0xd')](_0x7c7a('0xe'),_0x5992cf,_0x7c7a('0xf'));logger[_0x7c7a('0x10')](_0x7c7a('0x11'),_0x5992cf,_0x7c7a('0xf'),JSON['stringify'](_0x19070c));if(_0x19070c[_0x7c7a('0x12')]){if(_0x19070c[_0x7c7a('0x12')][_0x7c7a('0x13')]===0x1f4){logger[_0x7c7a('0x12')](_0x7c7a('0xe'),_0x5992cf,_0x19070c[_0x7c7a('0x12')][_0x7c7a('0x14')]);return _0x33637d(_0x19070c['error'][_0x7c7a('0x14')]);}logger[_0x7c7a('0x12')](_0x7c7a('0xe'),_0x5992cf,_0x19070c[_0x7c7a('0x12')][_0x7c7a('0x14')]);return _0x43e2af(_0x19070c['error'][_0x7c7a('0x14')]);}else{logger['info'](_0x7c7a('0xe'),_0x5992cf,_0x7c7a('0xf'));_0x43e2af(_0x19070c[_0x7c7a('0x15')][_0x7c7a('0x14')]);}})[_0x7c7a('0x16')](function(_0x4687f2){logger[_0x7c7a('0x12')](_0x7c7a('0xe'),_0x5992cf,_0x4687f2);_0x33637d(_0x4687f2);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 0919335..5a628fd 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 _0x67d5=['delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','show','post','update'];(function(_0x516693,_0x3fabbe){var _0x15ae84=function(_0x1d93ec){while(--_0x1d93ec){_0x516693['push'](_0x516693['shift']());}};_0x15ae84(++_0x3fabbe);}(_0x67d5,0x18a));var _0x567d=function(_0x1dc6d0,_0x7ee167){_0x1dc6d0=_0x1dc6d0-0x0;var _0x234fe3=_0x67d5[_0x1dc6d0];return _0x234fe3;};'use strict';var multer=require('multer');var util=require(_0x567d('0x0'));var path=require(_0x567d('0x1'));var timeout=require('connect-timeout');var express=require(_0x567d('0x2'));var router=express['Router']();var fs_extra=require(_0x567d('0x3'));var auth=require(_0x567d('0x4'));var interaction=require(_0x567d('0x5'));var config=require(_0x567d('0x6'));var controller=require(_0x567d('0x7'));router[_0x567d('0x8')]('/',auth[_0x567d('0x9')](),controller['index']);router[_0x567d('0x8')](_0x567d('0xa'),auth[_0x567d('0x9')](),controller[_0x567d('0xb')]);router[_0x567d('0xc')]('/',auth[_0x567d('0x9')](),controller['create']);router['put'](_0x567d('0xa'),auth[_0x567d('0x9')](),controller[_0x567d('0xd')]);router[_0x567d('0xe')](_0x567d('0xa'),auth[_0x567d('0x9')](),controller[_0x567d('0xf')]);module[_0x567d('0x10')]=router; \ No newline at end of file +var _0x3cb7=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','path','express'];(function(_0x347e64,_0xf9492f){var _0x2b588b=function(_0x580870){while(--_0x580870){_0x347e64['push'](_0x347e64['shift']());}};_0x2b588b(++_0xf9492f);}(_0x3cb7,0xcf));var _0x73cb=function(_0x57fc2a,_0x14bbe5){_0x57fc2a=_0x57fc2a-0x0;var _0xa839b=_0x3cb7[_0x57fc2a];return _0xa839b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x73cb('0x0'));var timeout=require('connect-timeout');var express=require(_0x73cb('0x1'));var router=express[_0x73cb('0x2')]();var fs_extra=require(_0x73cb('0x3'));var auth=require(_0x73cb('0x4'));var interaction=require(_0x73cb('0x5'));var config=require(_0x73cb('0x6'));var controller=require(_0x73cb('0x7'));router[_0x73cb('0x8')]('/',auth['isAuthenticated'](),controller[_0x73cb('0x9')]);router[_0x73cb('0x8')](_0x73cb('0xa'),auth[_0x73cb('0xb')](),controller[_0x73cb('0xc')]);router['post']('/',auth[_0x73cb('0xb')](),controller[_0x73cb('0xd')]);router[_0x73cb('0xe')](_0x73cb('0xa'),auth[_0x73cb('0xb')](),controller[_0x73cb('0xf')]);router[_0x73cb('0x10')]('/:id',auth[_0x73cb('0xb')](),controller[_0x73cb('0x11')]);module[_0x73cb('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index ebe19d4..d25a90d 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 _0xb7b3=['STRING','sequelize','ENUM','localnet','externip','stun','turn'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xb7b3,0x120));var _0x3b7b=function(_0x160248,_0x2a57e6){_0x160248=_0x160248-0x0;var _0x4e589d=_0xb7b3[_0x160248];return _0x4e589d;};'use strict';var Sequelize=require(_0x3b7b('0x0'));module['exports']={'type':{'type':Sequelize[_0x3b7b('0x1')](_0x3b7b('0x2'),_0x3b7b('0x3'),_0x3b7b('0x4'),_0x3b7b('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3b7b('0x6')]},'password':{'type':Sequelize[_0x3b7b('0x6')]}}; \ No newline at end of file +var _0xcd6d=['sequelize','ENUM','externip','stun','STRING'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xcd6d,0xe6));var _0xdcd6=function(_0x59f5fe,_0x4524ed){_0x59f5fe=_0x59f5fe-0x0;var _0x398bd2=_0xcd6d[_0x59f5fe];return _0x398bd2;};'use strict';var Sequelize=require(_0xdcd6('0x0'));module['exports']={'type':{'type':Sequelize[_0xdcd6('0x1')]('localnet',_0xdcd6('0x2'),_0xdcd6('0x3'),'turn')},'value':{'type':Sequelize[_0xdcd6('0x4')]},'username':{'type':Sequelize[_0xdcd6('0x4')]},'password':{'type':Sequelize[_0xdcd6('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index ba02a88..2928154 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 _0x4ac0=['name','index','map','Network','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','sequelize','body','toUpperCase','STUN','readFileSync','render','writeFileSync','Reload','res_stun_monitor.so','TURN','join','root','server/files/templates/turn_multiple.ejs','utf8','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','transaction','server/files/templates/stun_multiple.ejs','/etc/asterisk/turn_xcally.conf','toLowerCase','/etc/asterisk/stun_xcally.conf','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','then','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','Network,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','count','set','Content-Range','save','update','destroy','sendStatus','stack'];(function(_0x26ddfb,_0x2694bd){var _0x49adec=function(_0x4c5eea){while(--_0x4c5eea){_0x26ddfb['push'](_0x26ddfb['shift']());}};_0x49adec(++_0x2694bd);}(_0x4ac0,0xa0));var _0x04ac=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4ac0[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x04ac('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x04ac('0x1'));var moment=require(_0x04ac('0x2'));var BPromise=require(_0x04ac('0x3'));var Mustache=require(_0x04ac('0x4'));var util=require(_0x04ac('0x5'));var path=require(_0x04ac('0x6'));var sox=require('sox');var csv=require(_0x04ac('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x04ac('0x8'));var _=require('lodash');var squel=require(_0x04ac('0x9'));var crypto=require(_0x04ac('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x04ac('0xb'));var toCsv=require(_0x04ac('0x7'));var querystring=require(_0x04ac('0xc'));var Papa=require(_0x04ac('0xd'));var Redis=require(_0x04ac('0xe'));var authService=require(_0x04ac('0xf'));var qs=require(_0x04ac('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04ac('0x11'));var logger=require('../../config/logger')(_0x04ac('0x12'));var utils=require(_0x04ac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x04ac('0x14'));var db=require(_0x04ac('0x15'))['db'];var jayson=require(_0x04ac('0x16'));var client=jayson['client'][_0x04ac('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x196da4,_0x2abd97,_0x32c952,_0x503075){return new BPromise(function(_0x289a9d,_0x182ae0){var _0x30e766=_0x503075||client;return _0x30e766['request'](_0x196da4,_0x32c952)[_0x04ac('0x18')](function(_0x3cb98e){logger['info']('Network,\x20%s,\x20%s',_0x2abd97,_0x04ac('0x19'));logger['debug'](_0x04ac('0x1a'),_0x2abd97,_0x04ac('0x19'),JSON[_0x04ac('0x1b')](_0x3cb98e));if(_0x3cb98e[_0x04ac('0x1c')]){if(_0x3cb98e[_0x04ac('0x1c')]['code']===0x1f4){logger[_0x04ac('0x1c')](_0x04ac('0x1d'),_0x2abd97,_0x3cb98e[_0x04ac('0x1c')]['message']);return _0x182ae0(_0x3cb98e[_0x04ac('0x1c')]['message']);}logger[_0x04ac('0x1c')](_0x04ac('0x1d'),_0x2abd97,_0x3cb98e[_0x04ac('0x1c')][_0x04ac('0x1e')]);return _0x289a9d(_0x3cb98e['error'][_0x04ac('0x1e')]);}else{logger['info'](_0x04ac('0x1d'),_0x2abd97,_0x04ac('0x19'));_0x289a9d(_0x3cb98e[_0x04ac('0x1f')]['message']);}})[_0x04ac('0x20')](function(_0xcf9b5f){logger[_0x04ac('0x1c')]('Network,\x20%s,\x20%s',_0x2abd97,_0xcf9b5f);_0x182ae0(_0xcf9b5f);});});}function respondWithStatusCode(_0x378251,_0x19594d){_0x19594d=_0x19594d||0xcc;return function(_0x2a88f9){if(_0x2a88f9){return _0x378251['sendStatus'](_0x19594d);}return _0x378251[_0x04ac('0x21')](_0x19594d)[_0x04ac('0x22')]();};}function respondWithResult(_0x213030,_0x22c18c){_0x22c18c=_0x22c18c||0xc8;return function(_0x589429){if(_0x589429){return _0x213030['status'](_0x22c18c)[_0x04ac('0x23')](_0x589429);}};}function respondWithFilteredResult(_0x4f0ff7,_0x27888e){return function(_0x27bafa){if(_0x27bafa){var _0x17c87e=typeof _0x27888e[_0x04ac('0x24')]===_0x04ac('0x25')&&typeof _0x27888e['limit']==='undefined';var _0x5bd2ed=_0x27bafa[_0x04ac('0x26')];var _0x23ae7b=_0x17c87e?0x0:_0x27888e[_0x04ac('0x24')];var _0xb5e387=_0x17c87e?_0x27bafa['count']:_0x27888e[_0x04ac('0x24')]+_0x27888e['limit'];var _0x13a9c1;if(_0xb5e387>=_0x5bd2ed){_0xb5e387=_0x5bd2ed;_0x13a9c1=0xc8;}else{_0x13a9c1=0xce;}_0x4f0ff7[_0x04ac('0x21')](_0x13a9c1);return _0x4f0ff7[_0x04ac('0x27')](_0x04ac('0x28'),_0x23ae7b+'-'+_0xb5e387+'/'+_0x5bd2ed)[_0x04ac('0x23')](_0x27bafa);}return null;};}function patchUpdates(_0x3df8ed){return function(_0x1b467e){try{jsonpatch['apply'](_0x1b467e,_0x3df8ed,!![]);}catch(_0x1af860){return BPromise['reject'](_0x1af860);}return _0x1b467e[_0x04ac('0x29')]();};}function saveUpdates(_0x41bdcb,_0x197a86){return function(_0x38516f){if(_0x38516f){return _0x38516f[_0x04ac('0x2a')](_0x41bdcb)['then'](function(_0x5d0aac){return _0x5d0aac;});}return null;};}function removeEntity(_0x5c2045,_0x685f12){return function(_0x210ae2){if(_0x210ae2){return _0x210ae2[_0x04ac('0x2b')]()[_0x04ac('0x18')](function(){_0x5c2045[_0x04ac('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d2853,_0x628909){return function(_0x546f49){if(!_0x546f49){_0x4d2853[_0x04ac('0x2c')](0x194);}return _0x546f49;};}function handleError(_0x55d9a1,_0x3ee755){_0x3ee755=_0x3ee755||0x1f4;return function(_0x2d914c){logger[_0x04ac('0x1c')](_0x2d914c[_0x04ac('0x2d')]);if(_0x2d914c[_0x04ac('0x2e')]){delete _0x2d914c['name'];}_0x55d9a1[_0x04ac('0x21')](_0x3ee755)['send'](_0x2d914c);};}exports[_0x04ac('0x2f')]=function(_0x11d35e,_0x39e693){var _0x3a0c23={},_0x3c84b9={},_0x4f03cc={'count':0x0,'rows':[]};var _0xa80766=_[_0x04ac('0x30')](db[_0x04ac('0x31')][_0x04ac('0x32')],function(_0x4b1a5a){return{'name':_0x4b1a5a[_0x04ac('0x33')],'type':_0x4b1a5a[_0x04ac('0x34')]['key']};});_0x3c84b9[_0x04ac('0x35')]=_[_0x04ac('0x30')](_0xa80766,_0x04ac('0x2e'));_0x3c84b9[_0x04ac('0x36')]=_[_0x04ac('0x37')](_0x11d35e['query']);_0x3c84b9['filters']=_[_0x04ac('0x38')](_0x3c84b9['model'],_0x3c84b9[_0x04ac('0x36')]);_0x3a0c23[_0x04ac('0x39')]=_[_0x04ac('0x38')](_0x3c84b9[_0x04ac('0x35')],qs[_0x04ac('0x3a')](_0x11d35e[_0x04ac('0x36')]['fields']));_0x3a0c23[_0x04ac('0x39')]=_0x3a0c23[_0x04ac('0x39')][_0x04ac('0x3b')]?_0x3a0c23[_0x04ac('0x39')]:_0x3c84b9[_0x04ac('0x35')];if(!_0x11d35e['query'][_0x04ac('0x3c')](_0x04ac('0x3d'))){_0x3a0c23[_0x04ac('0x3e')]=qs['limit'](_0x11d35e['query'][_0x04ac('0x3e')]);_0x3a0c23[_0x04ac('0x24')]=qs[_0x04ac('0x24')](_0x11d35e['query']['offset']);}_0x3a0c23[_0x04ac('0x3f')]=qs[_0x04ac('0x40')](_0x11d35e['query'][_0x04ac('0x40')]);_0x3a0c23[_0x04ac('0x41')]=qs[_0x04ac('0x42')](_[_0x04ac('0x43')](_0x11d35e[_0x04ac('0x36')],_0x3c84b9[_0x04ac('0x42')]),_0xa80766);if(_0x11d35e[_0x04ac('0x36')][_0x04ac('0x44')]){_0x3a0c23[_0x04ac('0x41')]=_[_0x04ac('0x45')](_0x3a0c23[_0x04ac('0x41')],{'$or':_[_0x04ac('0x30')](_0xa80766,function(_0x5e3f60){if(_0x5e3f60[_0x04ac('0x34')]!==_0x04ac('0x46')){var _0x2293e7={};_0x2293e7[_0x5e3f60[_0x04ac('0x2e')]]={'$like':'%'+_0x11d35e[_0x04ac('0x36')][_0x04ac('0x44')]+'%'};return _0x2293e7;}})});}_0x3a0c23=_[_0x04ac('0x45')]({},_0x3a0c23,_0x11d35e[_0x04ac('0x47')]);var _0x335025={'where':_0x3a0c23['where']};return db['Network'][_0x04ac('0x26')](_0x335025)[_0x04ac('0x18')](function(_0x4119bb){_0x4f03cc[_0x04ac('0x26')]=_0x4119bb;if(_0x11d35e[_0x04ac('0x36')][_0x04ac('0x48')]){_0x3a0c23['include']=[{'all':!![]}];}return db[_0x04ac('0x31')][_0x04ac('0x49')](_0x3a0c23);})[_0x04ac('0x18')](function(_0x41b44f){_0x4f03cc[_0x04ac('0x4a')]=_0x41b44f;return _0x4f03cc;})[_0x04ac('0x18')](respondWithFilteredResult(_0x39e693,_0x3a0c23))[_0x04ac('0x20')](handleError(_0x39e693,null));};exports[_0x04ac('0x4b')]=function(_0x2488ce,_0x1da7bb){var _0x53dbed={'raw':!![],'where':{'id':_0x2488ce[_0x04ac('0x4c')]['id']}},_0x1fc81d={};_0x1fc81d['model']=_[_0x04ac('0x37')](db[_0x04ac('0x31')][_0x04ac('0x32')]);_0x1fc81d[_0x04ac('0x36')]=_[_0x04ac('0x37')](_0x2488ce[_0x04ac('0x36')]);_0x1fc81d[_0x04ac('0x42')]=_[_0x04ac('0x38')](_0x1fc81d[_0x04ac('0x35')],_0x1fc81d[_0x04ac('0x36')]);_0x53dbed['attributes']=_[_0x04ac('0x38')](_0x1fc81d[_0x04ac('0x35')],qs[_0x04ac('0x3a')](_0x2488ce['query'][_0x04ac('0x3a')]));_0x53dbed[_0x04ac('0x39')]=_0x53dbed[_0x04ac('0x39')][_0x04ac('0x3b')]?_0x53dbed[_0x04ac('0x39')]:_0x1fc81d[_0x04ac('0x35')];if(_0x2488ce[_0x04ac('0x36')][_0x04ac('0x48')]){_0x53dbed[_0x04ac('0x4d')]=[{'all':!![]}];}_0x53dbed=_['merge']({},_0x53dbed,_0x2488ce[_0x04ac('0x47')]);return db[_0x04ac('0x31')][_0x04ac('0x4e')](_0x53dbed)['then'](handleEntityNotFound(_0x1da7bb,null))['then'](respondWithResult(_0x1da7bb,null))[_0x04ac('0x20')](handleError(_0x1da7bb,null));};exports[_0x04ac('0x4f')]=function(_0x1e757d,_0x3f3d2d,_0x12dd8b){var _0x19fbc4;return db[_0x04ac('0x50')]['transaction'](function(_0x51bb7b){return db[_0x04ac('0x31')][_0x04ac('0x4f')](_0x1e757d[_0x04ac('0x51')],{'raw':!![]})[_0x04ac('0x18')](function(_0x1154ca){_0x19fbc4=_0x1154ca;return db[_0x04ac('0x31')]['findAll']({'where':{'type':_0x1e757d[_0x04ac('0x51')]['type']},'raw':!![]});})[_0x04ac('0x18')](function(_0x5dc4e9){if(_0x19fbc4[_0x04ac('0x34')][_0x04ac('0x52')]()==_0x04ac('0x53')){var _0x5414aa=fs[_0x04ac('0x54')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x148b1c=ejs[_0x04ac('0x55')](_0x5414aa,{'networks':_0x5dc4e9||[]});fs[_0x04ac('0x56')]('/etc/asterisk/stun_xcally.conf',_0x148b1c);return respondWithRpcPromise(_0x04ac('0x57'),_0x04ac('0x4f'),{'module':_0x04ac('0x58')});}else if(_0x19fbc4[_0x04ac('0x34')][_0x04ac('0x52')]()==_0x04ac('0x59')){var _0x276701=fs[_0x04ac('0x54')](path[_0x04ac('0x5a')](config[_0x04ac('0x5b')],_0x04ac('0x5c')),_0x04ac('0x5d'));var _0x14e0f7=ejs[_0x04ac('0x55')](_0x276701,{'networks':_0x5dc4e9||[]});fs[_0x04ac('0x56')]('/etc/asterisk/turn_xcally.conf',_0x14e0f7);return respondWithRpcPromise(_0x04ac('0x57'),_0x04ac('0x4f'),{'module':_0x04ac('0x58')});}else{var _0x2a126d=fs[_0x04ac('0x54')](path[_0x04ac('0x5a')](config[_0x04ac('0x5b')],_0x04ac('0x5e')),_0x04ac('0x5d'));var _0x448485=ejs[_0x04ac('0x55')](_0x2a126d,{'networks':_0x5dc4e9||[]});fs['writeFileSync'](util[_0x04ac('0x5f')](_0x04ac('0x60'),_0x1e757d['body'][_0x04ac('0x34')]['toLowerCase']()),_0x448485);return respondWithRpcPromise(_0x04ac('0x57'),_0x04ac('0x4f'),{'module':_0x04ac('0x61')});}return null;})['then'](function(){return _0x19fbc4;});})[_0x04ac('0x18')](respondWithResult(_0x3f3d2d,0xc9))[_0x04ac('0x20')](handleError(_0x3f3d2d,null));};exports[_0x04ac('0x2a')]=function(_0x3ff7e7,_0x5ce8a8,_0x3031a5){var _0x2497f5;return db[_0x04ac('0x50')][_0x04ac('0x62')](function(_0x3711ea){return db['Network'][_0x04ac('0x4e')]({'where':{'id':_0x3ff7e7[_0x04ac('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ce8a8,null))[_0x04ac('0x18')](saveUpdates(_0x3ff7e7[_0x04ac('0x51')],null))['then'](function(_0x2be722){if(_0x2be722){_0x2497f5=_0x2be722;return db[_0x04ac('0x31')][_0x04ac('0x49')]({'where':{'type':_0x2497f5[_0x04ac('0x34')]},'raw':!![]});}return null;})[_0x04ac('0x18')](function(_0x364181){if(_0x2497f5[_0x04ac('0x34')]['toUpperCase']()==_0x04ac('0x53')){var _0x3a3d50=fs['readFileSync'](path[_0x04ac('0x5a')](config[_0x04ac('0x5b')],_0x04ac('0x63')),_0x04ac('0x5d'));var _0x42e16d=ejs[_0x04ac('0x55')](_0x3a3d50,{'networks':_0x364181||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x42e16d);return respondWithRpcPromise(_0x04ac('0x57'),_0x04ac('0x2a'),{'module':_0x04ac('0x58')});}else if(_0x2497f5[_0x04ac('0x34')][_0x04ac('0x52')]()==_0x04ac('0x59')){var _0x5a067c=fs[_0x04ac('0x54')](path[_0x04ac('0x5a')](config[_0x04ac('0x5b')],_0x04ac('0x5c')),_0x04ac('0x5d'));var _0x27b41a=ejs[_0x04ac('0x55')](_0x5a067c,{'networks':_0x364181||[]});fs[_0x04ac('0x56')](_0x04ac('0x64'),_0x27b41a);return respondWithRpcPromise(_0x04ac('0x57'),_0x04ac('0x2a'),{'module':'res_stun_monitor.so'});}else{var _0x39c790=fs['readFileSync'](path[_0x04ac('0x5a')](config[_0x04ac('0x5b')],'server/files/templates/network.ejs'),'utf8');var _0x14bd4a=ejs[_0x04ac('0x55')](_0x39c790,{'networks':_0x364181||[]});fs[_0x04ac('0x56')](util[_0x04ac('0x5f')]('/etc/asterisk/sip_xcally_%s.conf',_0x3ff7e7[_0x04ac('0x51')][_0x04ac('0x34')][_0x04ac('0x65')]()),_0x14bd4a);return respondWithRpcPromise('Reload',_0x04ac('0x2a'),{'module':_0x04ac('0x61')});}return null;})[_0x04ac('0x18')](function(_0x205af1){if(_0x205af1){return _0x2497f5;}return null;});})['then'](respondWithResult(_0x5ce8a8,null))[_0x04ac('0x20')](handleError(_0x5ce8a8,null));};exports[_0x04ac('0x2b')]=function(_0x5c729b,_0x3bf36b,_0x4459bc){var _0x5b41d8;return db['Network']['find']({'where':{'id':_0x5c729b[_0x04ac('0x4c')]['id']}})[_0x04ac('0x18')](function(_0xd1f187){_0x5b41d8=_0xd1f187;return _0xd1f187;})[_0x04ac('0x18')](handleEntityNotFound(_0x3bf36b,null))[_0x04ac('0x18')](removeEntity(_0x3bf36b,null))[_0x04ac('0x18')](function(){if(_0x5b41d8){return db['Network'][_0x04ac('0x49')]({'where':{'type':_0x5b41d8[_0x04ac('0x34')]},'raw':!![]});}})[_0x04ac('0x18')](function(_0x1dde68){if(_0x5b41d8[_0x04ac('0x34')][_0x04ac('0x52')]()==_0x04ac('0x53')){var _0x267852=fs[_0x04ac('0x54')](path[_0x04ac('0x5a')](config[_0x04ac('0x5b')],_0x04ac('0x63')),'utf8');var _0x56bd9a=ejs[_0x04ac('0x55')](_0x267852,{'networks':_0x1dde68||[]});fs['writeFileSync'](_0x04ac('0x66'),_0x56bd9a);return respondWithRpcPromise(_0x04ac('0x57'),_0x04ac('0x2b'),{'module':_0x04ac('0x58')});}else if(_0x5b41d8[_0x04ac('0x34')][_0x04ac('0x52')]()==_0x04ac('0x59')){var _0x2edd76=fs[_0x04ac('0x54')](path[_0x04ac('0x5a')](config[_0x04ac('0x5b')],_0x04ac('0x5c')),_0x04ac('0x5d'));var _0x23a89b=ejs[_0x04ac('0x55')](_0x2edd76,{'networks':_0x1dde68||[]});fs['writeFileSync'](_0x04ac('0x64'),_0x23a89b);return respondWithRpcPromise(_0x04ac('0x57'),_0x04ac('0x2b'),{'module':_0x04ac('0x58')});}else{var _0x3c6bab=fs[_0x04ac('0x54')](path[_0x04ac('0x5a')](config[_0x04ac('0x5b')],_0x04ac('0x5e')),_0x04ac('0x5d'));var _0x5883b5=ejs[_0x04ac('0x55')](_0x3c6bab,{'networks':_0x1dde68||[]});fs[_0x04ac('0x56')](util['format'](_0x04ac('0x60'),_0x5c729b['body'][_0x04ac('0x34')][_0x04ac('0x65')]()),_0x5883b5);return respondWithRpcPromise(_0x04ac('0x57'),_0x04ac('0x2b'),{'module':_0x04ac('0x61')});}return null;})[_0x04ac('0x20')](handleError(_0x3bf36b,null));}; \ No newline at end of file +var _0xd73d=['chan_sip.so','sequelize','find','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','sendStatus','stack','name','send','index','map','Network','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase'];(function(_0x1081b4,_0x14821e){var _0x2a25fb=function(_0xf1e0fa){while(--_0xf1e0fa){_0x1081b4['push'](_0x1081b4['shift']());}};_0x2a25fb(++_0x14821e);}(_0xd73d,0x1a5));var _0xdd73=function(_0x284bb4,_0x598e6c){_0x284bb4=_0x284bb4-0x0;var _0x574d5b=_0xd73d[_0x284bb4];return _0x574d5b;};'use strict';var emlformat=require(_0xdd73('0x0'));var rimraf=require(_0xdd73('0x1'));var zipdir=require(_0xdd73('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd73('0x3'));var moment=require('moment');var BPromise=require(_0xdd73('0x4'));var Mustache=require('mustache');var util=require(_0xdd73('0x5'));var path=require(_0xdd73('0x6'));var sox=require('sox');var csv=require(_0xdd73('0x7'));var ejs=require(_0xdd73('0x8'));var fs=require('fs');var fs_extra=require(_0xdd73('0x9'));var _=require('lodash');var squel=require(_0xdd73('0xa'));var crypto=require(_0xdd73('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdd73('0xc'));var toCsv=require(_0xdd73('0x7'));var querystring=require('querystring');var Papa=require(_0xdd73('0xd'));var Redis=require('ioredis');var authService=require(_0xdd73('0xe'));var qs=require(_0xdd73('0xf'));var as=require(_0xdd73('0x10'));var hardwareService=require(_0xdd73('0x11'));var logger=require(_0xdd73('0x12'))(_0xdd73('0x13'));var utils=require('../../config/utils');var config=require(_0xdd73('0x14'));var licenseUtil=require(_0xdd73('0x15'));var db=require(_0xdd73('0x16'))['db'];var jayson=require(_0xdd73('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1be2e3,_0x60f1c7,_0x282da0,_0x43d152){return new BPromise(function(_0x2d1c39,_0x33f4bc){var _0xc62818=_0x43d152||client;return _0xc62818[_0xdd73('0x18')](_0x1be2e3,_0x282da0)['then'](function(_0x336fb8){logger[_0xdd73('0x19')](_0xdd73('0x1a'),_0x60f1c7,_0xdd73('0x1b'));logger[_0xdd73('0x1c')]('Network,\x20%s,\x20%s,\x20%s',_0x60f1c7,_0xdd73('0x1b'),JSON['stringify'](_0x336fb8));if(_0x336fb8[_0xdd73('0x1d')]){if(_0x336fb8[_0xdd73('0x1d')][_0xdd73('0x1e')]===0x1f4){logger[_0xdd73('0x1d')]('Network,\x20%s,\x20%s',_0x60f1c7,_0x336fb8[_0xdd73('0x1d')][_0xdd73('0x1f')]);return _0x33f4bc(_0x336fb8[_0xdd73('0x1d')]['message']);}logger['error'](_0xdd73('0x1a'),_0x60f1c7,_0x336fb8[_0xdd73('0x1d')][_0xdd73('0x1f')]);return _0x2d1c39(_0x336fb8['error'][_0xdd73('0x1f')]);}else{logger[_0xdd73('0x19')](_0xdd73('0x1a'),_0x60f1c7,'request\x20sent');_0x2d1c39(_0x336fb8[_0xdd73('0x20')][_0xdd73('0x1f')]);}})['catch'](function(_0x415b7d){logger['error'](_0xdd73('0x1a'),_0x60f1c7,_0x415b7d);_0x33f4bc(_0x415b7d);});});}function respondWithStatusCode(_0x175758,_0x5b6b1a){_0x5b6b1a=_0x5b6b1a||0xcc;return function(_0x467e99){if(_0x467e99){return _0x175758['sendStatus'](_0x5b6b1a);}return _0x175758[_0xdd73('0x21')](_0x5b6b1a)[_0xdd73('0x22')]();};}function respondWithResult(_0x4d3370,_0x597780){_0x597780=_0x597780||0xc8;return function(_0x4dc208){if(_0x4dc208){return _0x4d3370['status'](_0x597780)[_0xdd73('0x23')](_0x4dc208);}};}function respondWithFilteredResult(_0x58b2b4,_0x339af6){return function(_0x19fc4e){if(_0x19fc4e){var _0x257a01=typeof _0x339af6[_0xdd73('0x24')]===_0xdd73('0x25')&&typeof _0x339af6[_0xdd73('0x26')]===_0xdd73('0x25');var _0x3d4384=_0x19fc4e[_0xdd73('0x27')];var _0x53e16f=_0x257a01?0x0:_0x339af6[_0xdd73('0x24')];var _0x1b44b7=_0x257a01?_0x19fc4e[_0xdd73('0x27')]:_0x339af6[_0xdd73('0x24')]+_0x339af6[_0xdd73('0x26')];var _0xd89577;if(_0x1b44b7>=_0x3d4384){_0x1b44b7=_0x3d4384;_0xd89577=0xc8;}else{_0xd89577=0xce;}_0x58b2b4[_0xdd73('0x21')](_0xd89577);return _0x58b2b4[_0xdd73('0x28')](_0xdd73('0x29'),_0x53e16f+'-'+_0x1b44b7+'/'+_0x3d4384)['json'](_0x19fc4e);}return null;};}function patchUpdates(_0x5a611d){return function(_0x59819f){try{jsonpatch['apply'](_0x59819f,_0x5a611d,!![]);}catch(_0x575ad0){return BPromise[_0xdd73('0x2a')](_0x575ad0);}return _0x59819f['save']();};}function saveUpdates(_0x2011af,_0x16fd63){return function(_0x39d3eb){if(_0x39d3eb){return _0x39d3eb[_0xdd73('0x2b')](_0x2011af)[_0xdd73('0x2c')](function(_0x29ab53){return _0x29ab53;});}return null;};}function removeEntity(_0x581770,_0x28f6df){return function(_0x2dde82){if(_0x2dde82){return _0x2dde82[_0xdd73('0x2d')]()[_0xdd73('0x2c')](function(){_0x581770[_0xdd73('0x21')](0xcc)[_0xdd73('0x22')]();});}};}function handleEntityNotFound(_0x1afea7,_0x4803b7){return function(_0x378e62){if(!_0x378e62){_0x1afea7[_0xdd73('0x2e')](0x194);}return _0x378e62;};}function handleError(_0x431144,_0x10c830){_0x10c830=_0x10c830||0x1f4;return function(_0x1cec56){logger[_0xdd73('0x1d')](_0x1cec56[_0xdd73('0x2f')]);if(_0x1cec56[_0xdd73('0x30')]){delete _0x1cec56['name'];}_0x431144[_0xdd73('0x21')](_0x10c830)[_0xdd73('0x31')](_0x1cec56);};}exports[_0xdd73('0x32')]=function(_0x56ecd9,_0x5ea01d){var _0x5b7761={},_0x2c3d9b={},_0x51cb86={'count':0x0,'rows':[]};var _0x431711=_[_0xdd73('0x33')](db[_0xdd73('0x34')]['rawAttributes'],function(_0x262aed){return{'name':_0x262aed[_0xdd73('0x35')],'type':_0x262aed[_0xdd73('0x36')]['key']};});_0x2c3d9b[_0xdd73('0x37')]=_['map'](_0x431711,_0xdd73('0x30'));_0x2c3d9b[_0xdd73('0x38')]=_[_0xdd73('0x39')](_0x56ecd9[_0xdd73('0x38')]);_0x2c3d9b[_0xdd73('0x3a')]=_['intersection'](_0x2c3d9b[_0xdd73('0x37')],_0x2c3d9b['query']);_0x5b7761[_0xdd73('0x3b')]=_[_0xdd73('0x3c')](_0x2c3d9b[_0xdd73('0x37')],qs[_0xdd73('0x3d')](_0x56ecd9[_0xdd73('0x38')][_0xdd73('0x3d')]));_0x5b7761[_0xdd73('0x3b')]=_0x5b7761['attributes'][_0xdd73('0x3e')]?_0x5b7761['attributes']:_0x2c3d9b[_0xdd73('0x37')];if(!_0x56ecd9[_0xdd73('0x38')][_0xdd73('0x3f')](_0xdd73('0x40'))){_0x5b7761[_0xdd73('0x26')]=qs[_0xdd73('0x26')](_0x56ecd9['query'][_0xdd73('0x26')]);_0x5b7761[_0xdd73('0x24')]=qs['offset'](_0x56ecd9[_0xdd73('0x38')]['offset']);}_0x5b7761[_0xdd73('0x41')]=qs['sort'](_0x56ecd9[_0xdd73('0x38')][_0xdd73('0x42')]);_0x5b7761['where']=qs[_0xdd73('0x3a')](_[_0xdd73('0x43')](_0x56ecd9[_0xdd73('0x38')],_0x2c3d9b[_0xdd73('0x3a')]),_0x431711);if(_0x56ecd9[_0xdd73('0x38')][_0xdd73('0x44')]){_0x5b7761[_0xdd73('0x45')]=_[_0xdd73('0x46')](_0x5b7761[_0xdd73('0x45')],{'$or':_['map'](_0x431711,function(_0x51f85e){if(_0x51f85e['type']!==_0xdd73('0x47')){var _0x18ad3e={};_0x18ad3e[_0x51f85e['name']]={'$like':'%'+_0x56ecd9['query']['filter']+'%'};return _0x18ad3e;}})});}_0x5b7761=_[_0xdd73('0x46')]({},_0x5b7761,_0x56ecd9[_0xdd73('0x48')]);var _0x1a080d={'where':_0x5b7761['where']};return db[_0xdd73('0x34')][_0xdd73('0x27')](_0x1a080d)['then'](function(_0x5b9dc4){_0x51cb86[_0xdd73('0x27')]=_0x5b9dc4;if(_0x56ecd9['query'][_0xdd73('0x49')]){_0x5b7761[_0xdd73('0x4a')]=[{'all':!![]}];}return db[_0xdd73('0x34')][_0xdd73('0x4b')](_0x5b7761);})['then'](function(_0x5be3d2){_0x51cb86[_0xdd73('0x4c')]=_0x5be3d2;return _0x51cb86;})[_0xdd73('0x2c')](respondWithFilteredResult(_0x5ea01d,_0x5b7761))[_0xdd73('0x4d')](handleError(_0x5ea01d,null));};exports['show']=function(_0x5dea02,_0x24881a){var _0x397b01={'raw':!![],'where':{'id':_0x5dea02[_0xdd73('0x4e')]['id']}},_0x416b88={};_0x416b88[_0xdd73('0x37')]=_[_0xdd73('0x39')](db[_0xdd73('0x34')][_0xdd73('0x4f')]);_0x416b88[_0xdd73('0x38')]=_['keys'](_0x5dea02[_0xdd73('0x38')]);_0x416b88[_0xdd73('0x3a')]=_[_0xdd73('0x3c')](_0x416b88[_0xdd73('0x37')],_0x416b88[_0xdd73('0x38')]);_0x397b01[_0xdd73('0x3b')]=_[_0xdd73('0x3c')](_0x416b88[_0xdd73('0x37')],qs[_0xdd73('0x3d')](_0x5dea02[_0xdd73('0x38')][_0xdd73('0x3d')]));_0x397b01['attributes']=_0x397b01[_0xdd73('0x3b')][_0xdd73('0x3e')]?_0x397b01[_0xdd73('0x3b')]:_0x416b88[_0xdd73('0x37')];if(_0x5dea02[_0xdd73('0x38')]['includeAll']){_0x397b01[_0xdd73('0x4a')]=[{'all':!![]}];}_0x397b01=_['merge']({},_0x397b01,_0x5dea02['options']);return db['Network']['find'](_0x397b01)['then'](handleEntityNotFound(_0x24881a,null))['then'](respondWithResult(_0x24881a,null))[_0xdd73('0x4d')](handleError(_0x24881a,null));};exports[_0xdd73('0x50')]=function(_0x248e98,_0x519fad,_0x5df930){var _0x3b92be;return db['sequelize']['transaction'](function(_0x543161){return db['Network'][_0xdd73('0x50')](_0x248e98['body'],{'raw':!![]})[_0xdd73('0x2c')](function(_0xf7b0e5){_0x3b92be=_0xf7b0e5;return db['Network'][_0xdd73('0x4b')]({'where':{'type':_0x248e98[_0xdd73('0x51')][_0xdd73('0x36')]},'raw':!![]});})['then'](function(_0x342e7b){if(_0x3b92be[_0xdd73('0x36')]['toUpperCase']()==_0xdd73('0x52')){var _0x12ef27=fs[_0xdd73('0x53')](path[_0xdd73('0x54')](config[_0xdd73('0x55')],_0xdd73('0x56')),_0xdd73('0x57'));var _0x44c0be=ejs[_0xdd73('0x58')](_0x12ef27,{'networks':_0x342e7b||[]});fs[_0xdd73('0x59')](_0xdd73('0x5a'),_0x44c0be);return respondWithRpcPromise(_0xdd73('0x5b'),_0xdd73('0x50'),{'module':_0xdd73('0x5c')});}else if(_0x3b92be[_0xdd73('0x36')][_0xdd73('0x5d')]()==_0xdd73('0x5e')){var _0x4094a8=fs[_0xdd73('0x53')](path['join'](config[_0xdd73('0x55')],'server/files/templates/turn_multiple.ejs'),_0xdd73('0x57'));var _0x4bad93=ejs[_0xdd73('0x58')](_0x4094a8,{'networks':_0x342e7b||[]});fs[_0xdd73('0x59')]('/etc/asterisk/turn_xcally.conf',_0x4bad93);return respondWithRpcPromise(_0xdd73('0x5b'),'create',{'module':_0xdd73('0x5c')});}else{var _0x23ea94=fs[_0xdd73('0x53')](path[_0xdd73('0x54')](config[_0xdd73('0x55')],_0xdd73('0x5f')),_0xdd73('0x57'));var _0xa262da=ejs[_0xdd73('0x58')](_0x23ea94,{'networks':_0x342e7b||[]});fs[_0xdd73('0x59')](util[_0xdd73('0x60')](_0xdd73('0x61'),_0x248e98[_0xdd73('0x51')][_0xdd73('0x36')][_0xdd73('0x62')]()),_0xa262da);return respondWithRpcPromise(_0xdd73('0x5b'),_0xdd73('0x50'),{'module':_0xdd73('0x63')});}return null;})[_0xdd73('0x2c')](function(){return _0x3b92be;});})[_0xdd73('0x2c')](respondWithResult(_0x519fad,0xc9))['catch'](handleError(_0x519fad,null));};exports[_0xdd73('0x2b')]=function(_0x41ef7a,_0x5cfa06,_0x1f1ee2){var _0x4a2d44;return db[_0xdd73('0x64')]['transaction'](function(_0x1f4e20){return db[_0xdd73('0x34')][_0xdd73('0x65')]({'where':{'id':_0x41ef7a[_0xdd73('0x4e')]['id']}})[_0xdd73('0x2c')](handleEntityNotFound(_0x5cfa06,null))[_0xdd73('0x2c')](saveUpdates(_0x41ef7a[_0xdd73('0x51')],null))[_0xdd73('0x2c')](function(_0x2fc1b6){if(_0x2fc1b6){_0x4a2d44=_0x2fc1b6;return db['Network'][_0xdd73('0x4b')]({'where':{'type':_0x4a2d44[_0xdd73('0x36')]},'raw':!![]});}return null;})['then'](function(_0x5bbc2f){if(_0x4a2d44[_0xdd73('0x36')][_0xdd73('0x5d')]()==_0xdd73('0x52')){var _0x41f13f=fs[_0xdd73('0x53')](path['join'](config[_0xdd73('0x55')],_0xdd73('0x56')),'utf8');var _0x569fcc=ejs[_0xdd73('0x58')](_0x41f13f,{'networks':_0x5bbc2f||[]});fs[_0xdd73('0x59')](_0xdd73('0x5a'),_0x569fcc);return respondWithRpcPromise(_0xdd73('0x5b'),_0xdd73('0x2b'),{'module':_0xdd73('0x5c')});}else if(_0x4a2d44[_0xdd73('0x36')]['toUpperCase']()=='TURN'){var _0x1f07f7=fs[_0xdd73('0x53')](path[_0xdd73('0x54')](config[_0xdd73('0x55')],_0xdd73('0x66')),'utf8');var _0xd1afda=ejs[_0xdd73('0x58')](_0x1f07f7,{'networks':_0x5bbc2f||[]});fs['writeFileSync'](_0xdd73('0x67'),_0xd1afda);return respondWithRpcPromise(_0xdd73('0x5b'),_0xdd73('0x2b'),{'module':_0xdd73('0x5c')});}else{var _0x7ebca2=fs['readFileSync'](path[_0xdd73('0x54')](config[_0xdd73('0x55')],_0xdd73('0x5f')),_0xdd73('0x57'));var _0x5f566f=ejs[_0xdd73('0x58')](_0x7ebca2,{'networks':_0x5bbc2f||[]});fs[_0xdd73('0x59')](util[_0xdd73('0x60')](_0xdd73('0x61'),_0x41ef7a['body'][_0xdd73('0x36')][_0xdd73('0x62')]()),_0x5f566f);return respondWithRpcPromise(_0xdd73('0x5b'),_0xdd73('0x2b'),{'module':_0xdd73('0x63')});}return null;})[_0xdd73('0x2c')](function(_0x6c0cb2){if(_0x6c0cb2){return _0x4a2d44;}return null;});})[_0xdd73('0x2c')](respondWithResult(_0x5cfa06,null))[_0xdd73('0x4d')](handleError(_0x5cfa06,null));};exports[_0xdd73('0x2d')]=function(_0x3b3c15,_0x20eda3,_0x3d2051){var _0x16305c;return db['Network'][_0xdd73('0x65')]({'where':{'id':_0x3b3c15[_0xdd73('0x4e')]['id']}})['then'](function(_0x2a1994){_0x16305c=_0x2a1994;return _0x2a1994;})[_0xdd73('0x2c')](handleEntityNotFound(_0x20eda3,null))[_0xdd73('0x2c')](removeEntity(_0x20eda3,null))[_0xdd73('0x2c')](function(){if(_0x16305c){return db[_0xdd73('0x34')][_0xdd73('0x4b')]({'where':{'type':_0x16305c['type']},'raw':!![]});}})[_0xdd73('0x2c')](function(_0x5b06ce){if(_0x16305c['type']['toUpperCase']()==_0xdd73('0x52')){var _0x5de1f1=fs[_0xdd73('0x53')](path[_0xdd73('0x54')](config[_0xdd73('0x55')],_0xdd73('0x56')),_0xdd73('0x57'));var _0x1c5c0c=ejs[_0xdd73('0x58')](_0x5de1f1,{'networks':_0x5b06ce||[]});fs[_0xdd73('0x59')](_0xdd73('0x5a'),_0x1c5c0c);return respondWithRpcPromise('Reload','destroy',{'module':_0xdd73('0x5c')});}else if(_0x16305c['type'][_0xdd73('0x5d')]()==_0xdd73('0x5e')){var _0x8d724d=fs[_0xdd73('0x53')](path['join'](config[_0xdd73('0x55')],_0xdd73('0x66')),_0xdd73('0x57'));var _0x5dbe9f=ejs[_0xdd73('0x58')](_0x8d724d,{'networks':_0x5b06ce||[]});fs[_0xdd73('0x59')](_0xdd73('0x67'),_0x5dbe9f);return respondWithRpcPromise(_0xdd73('0x5b'),_0xdd73('0x2d'),{'module':_0xdd73('0x5c')});}else{var _0x484b27=fs[_0xdd73('0x53')](path[_0xdd73('0x54')](config[_0xdd73('0x55')],_0xdd73('0x5f')),'utf8');var _0x478cd1=ejs[_0xdd73('0x58')](_0x484b27,{'networks':_0x5b06ce||[]});fs[_0xdd73('0x59')](util['format'](_0xdd73('0x61'),_0x3b3c15[_0xdd73('0x51')][_0xdd73('0x36')][_0xdd73('0x62')]()),_0x478cd1);return respondWithRpcPromise('Reload',_0xdd73('0x2d'),{'module':_0xdd73('0x63')});}return null;})[_0xdd73('0x4d')](handleError(_0x20eda3,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index cd13d00..2af5d69 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 _0x6f7a=['Network','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x541449,_0x1b4d4d){_0x541449=_0x541449-0x0;var _0x70b108=_0x6f7a[_0x541449];return _0x70b108;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var moment=require('moment');var BPromise=require(_0xa6f7('0x4'));var rp=require(_0xa6f7('0x5'));var fs=require('fs');var path=require(_0xa6f7('0x6'));var rimraf=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var attributes=require(_0xa6f7('0x9'));module[_0xa6f7('0xa')]=function(_0x20cccd,_0x1fdd5f){return _0x20cccd[_0xa6f7('0xb')](_0xa6f7('0xc'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x073e=['rimraf','../../config/environment','define','Network','network','lodash','util','../../config/logger','api','path'];(function(_0x42f4f1,_0x54d0ba){var _0x538c62=function(_0x522a40){while(--_0x522a40){_0x42f4f1['push'](_0x42f4f1['shift']());}};_0x538c62(++_0x54d0ba);}(_0x073e,0x181));var _0xe073=function(_0x5a943b,_0x5ae491){_0x5a943b=_0x5a943b-0x0;var _0x5523ad=_0x073e[_0x5a943b];return _0x5523ad;};'use strict';var _=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var logger=require(_0xe073('0x2'))(_0xe073('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe073('0x4'));var rimraf=require(_0xe073('0x5'));var config=require(_0xe073('0x6'));var attributes=require('./network.attributes');module['exports']=function(_0x4bc6b3,_0x45995e){return _0x4bc6b3[_0xe073('0x7')](_0xe073('0x8'),attributes,{'tableName':_0xe073('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index ffb5920..ed9aadc 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x5d9a6a,_0x545808){_0x5d9a6a=_0x5d9a6a-0x0;var _0x49811e=_0x7a54[_0x5d9a6a];return _0x49811e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x5e3d79,_0x3772a3){_0x5e3d79=_0x5e3d79-0x0;var _0x2dae34=_0x7a54[_0x5e3d79];return _0x2dae34;};'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 3f26686..32db2a6 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 _0x0ea0=['../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','/:id/notify','notify','/:id/applications','addApplications','/:id/users','/:id/send','send','put','update','delete','destroy','/:id/dispositions','removeAnswers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0xb3763d,_0x48258f){var _0x1cc6eb=function(_0x4dc068){while(--_0x4dc068){_0xb3763d['push'](_0xb3763d['shift']());}};_0x1cc6eb(++_0x48258f);}(_0x0ea0,0xb8));var _0x00ea=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x0ea0[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0x00ea('0x0'));var util=require(_0x00ea('0x1'));var path=require(_0x00ea('0x2'));var timeout=require(_0x00ea('0x3'));var express=require('express');var router=express[_0x00ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x00ea('0x5'));var interaction=require(_0x00ea('0x6'));var config=require('../../config/environment');var controller=require(_0x00ea('0x7'));router[_0x00ea('0x8')]('/',auth[_0x00ea('0x9')](),controller[_0x00ea('0xa')]);router[_0x00ea('0x8')](_0x00ea('0xb'),auth[_0x00ea('0x9')](),controller[_0x00ea('0xc')]);router[_0x00ea('0x8')](_0x00ea('0xd'),auth[_0x00ea('0x9')](),controller[_0x00ea('0xe')]);router['get']('/:id/dispositions',auth[_0x00ea('0x9')](),controller[_0x00ea('0xf')]);router[_0x00ea('0x8')](_0x00ea('0x10'),auth[_0x00ea('0x9')](),controller[_0x00ea('0x11')]);router[_0x00ea('0x8')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x00ea('0x12'),auth[_0x00ea('0x9')](),controller[_0x00ea('0x13')]);router[_0x00ea('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x00ea('0x14')]);router[_0x00ea('0x15')]('/',auth['isAuthenticated'](),controller[_0x00ea('0x16')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x00ea('0x17')]);router[_0x00ea('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x00ea('0x15')](_0x00ea('0x18'),controller[_0x00ea('0x19')]);router[_0x00ea('0x15')](_0x00ea('0x1a'),auth[_0x00ea('0x9')](),controller[_0x00ea('0x1b')]);router[_0x00ea('0x15')](_0x00ea('0x1c'),auth[_0x00ea('0x9')](),controller['addAgents']);router[_0x00ea('0x15')](_0x00ea('0x1d'),auth['isAuthenticated'](),controller[_0x00ea('0x1e')]);router[_0x00ea('0x1f')](_0x00ea('0xd'),auth[_0x00ea('0x9')](),controller[_0x00ea('0x20')]);router[_0x00ea('0x21')](_0x00ea('0xd'),auth['isAuthenticated'](),controller[_0x00ea('0x22')]);router[_0x00ea('0x21')](_0x00ea('0x23'),auth[_0x00ea('0x9')](),controller['removeDispositions']);router[_0x00ea('0x21')](_0x00ea('0x10'),auth[_0x00ea('0x9')](),controller[_0x00ea('0x24')]);router['delete'](_0x00ea('0x1c'),auth[_0x00ea('0x9')](),controller['removeAgents']);module[_0x00ea('0x25')]=router; \ No newline at end of file +var _0xd02b=['describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','addApplications','addAgents','send','put','update','/:id','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe'];(function(_0x883d31,_0x50f7d0){var _0x4201bb=function(_0x3afc7e){while(--_0x3afc7e){_0x883d31['push'](_0x883d31['shift']());}};_0x4201bb(++_0x50f7d0);}(_0xd02b,0x152));var _0xbd02=function(_0x4bcb74,_0x12955c){_0x4bcb74=_0x4bcb74-0x0;var _0xab63e3=_0xd02b[_0x4bcb74];return _0xab63e3;};'use strict';var multer=require(_0xbd02('0x0'));var util=require(_0xbd02('0x1'));var path=require(_0xbd02('0x2'));var timeout=require(_0xbd02('0x3'));var express=require(_0xbd02('0x4'));var router=express[_0xbd02('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbd02('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbd02('0x7'));var controller=require(_0xbd02('0x8'));router[_0xbd02('0x9')]('/',auth[_0xbd02('0xa')](),controller[_0xbd02('0xb')]);router[_0xbd02('0x9')](_0xbd02('0xc'),auth[_0xbd02('0xa')](),controller[_0xbd02('0xd')]);router['get']('/:id',auth[_0xbd02('0xa')](),controller[_0xbd02('0xe')]);router[_0xbd02('0x9')](_0xbd02('0xf'),auth['isAuthenticated'](),controller[_0xbd02('0x10')]);router['get'](_0xbd02('0x11'),auth[_0xbd02('0xa')](),controller['getAnswers']);router[_0xbd02('0x9')](_0xbd02('0x12'),auth[_0xbd02('0xa')](),controller['getApplications']);router[_0xbd02('0x9')]('/:id/interactions',auth[_0xbd02('0xa')](),controller[_0xbd02('0x13')]);router['get'](_0xbd02('0x14'),auth[_0xbd02('0xa')](),controller[_0xbd02('0x15')]);router[_0xbd02('0x16')]('/',auth[_0xbd02('0xa')](),controller[_0xbd02('0x17')]);router[_0xbd02('0x16')]('/:id/dispositions',auth[_0xbd02('0xa')](),controller[_0xbd02('0x18')]);router[_0xbd02('0x16')]('/:id/canned_answers',auth[_0xbd02('0xa')](),controller[_0xbd02('0x19')]);router[_0xbd02('0x16')](_0xbd02('0x1a'),controller['notify']);router[_0xbd02('0x16')](_0xbd02('0x12'),auth['isAuthenticated'](),controller[_0xbd02('0x1b')]);router['post'](_0xbd02('0x14'),auth[_0xbd02('0xa')](),controller[_0xbd02('0x1c')]);router[_0xbd02('0x16')]('/:id/send',auth[_0xbd02('0xa')](),controller[_0xbd02('0x1d')]);router[_0xbd02('0x1e')]('/:id',auth[_0xbd02('0xa')](),controller[_0xbd02('0x1f')]);router['delete'](_0xbd02('0x20'),auth[_0xbd02('0xa')](),controller[_0xbd02('0x21')]);router[_0xbd02('0x22')](_0xbd02('0xf'),auth[_0xbd02('0xa')](),controller[_0xbd02('0x23')]);router[_0xbd02('0x22')](_0xbd02('0x11'),auth[_0xbd02('0xa')](),controller[_0xbd02('0x24')]);router['delete'](_0xbd02('0x14'),auth[_0xbd02('0xa')](),controller[_0xbd02('0x25')]);module[_0xbd02('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index e2ea5be..5fdd10a 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 _0x8bc5=['sequelize','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0x8bc5,0x1ba));var _0x58bc=function(_0x4cd827,_0x400240){_0x4cd827=_0x4cd827-0x0;var _0x10b9d6=_0x8bc5[_0x4cd827];return _0x10b9d6;};'use strict';var Sequelize=require(_0x58bc('0x0'));var rs=require(_0x58bc('0x1'));module[_0x58bc('0x2')]={'name':{'type':Sequelize[_0x58bc('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x58bc('0x4')]();}},'replyUri':{'type':Sequelize[_0x58bc('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x58bc('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x58bc('0x5')],'defaultValue':function(){return _0x58bc('0x6');}},'notificationSound':{'type':Sequelize[_0x58bc('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x58bc('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x58bc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x58bc('0x3')]},'queueTransfer':{'type':Sequelize[_0x58bc('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x58bc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x58bc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x58bc('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x58bc('0x9'),'set':function(_0x5d22b5){if(!_0x5d22b5)this[_0x58bc('0xa')](_0x58bc('0xb'),null);this['setDataValue'](_0x58bc('0xc'),_0x5d22b5);}}}; \ No newline at end of file +var _0xb3f8=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x38de33,_0x4361bb){var _0x40f16d=function(_0x25975c){while(--_0x25975c){_0x38de33['push'](_0x38de33['shift']());}};_0x40f16d(++_0x4361bb);}(_0xb3f8,0xf1));var _0x8b3f=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0xb3f8[_0x28f32c];return _0x355402;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8b3f('0x0'));module[_0x8b3f('0x1')]={'name':{'type':Sequelize[_0x8b3f('0x2')],'unique':_0x8b3f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x8b3f('0x2')]},'token':{'type':Sequelize[_0x8b3f('0x2')],'defaultValue':function(){return rs[_0x8b3f('0x4')]();}},'replyUri':{'type':Sequelize[_0x8b3f('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x8b3f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8b3f('0x5')],'defaultValue':function(){return _0x8b3f('0x6');}},'notificationSound':{'type':Sequelize[_0x8b3f('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8b3f('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8b3f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8b3f('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8b3f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8b3f('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8b3f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x8b3f('0x7')],'defaultValue':![],'comment':_0x8b3f('0xa'),'set':function(_0xfe70a9){if(!_0xfe70a9)this[_0x8b3f('0xb')](_0x8b3f('0xc'),null);this[_0x8b3f('0xb')](_0x8b3f('0xd'),_0xfe70a9);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 09ed1bc..7fe2cda 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 _0x0740=['Content-Range','json','reject','save','destroy','get','OpenchannelAccounts','end','stack','name','send','index','Pause','map','OpenchannelAccount','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','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','mandatoryDispositionPause','describe','addDisposition','Disposition','getDispositions','findOne','removeDispositions','ids','OpenchannelAccountId','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','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','DESC','OpenchannelApplication','account','applications','list','orderBy','priority','asc','Applications','Contacts','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','update','interaction','created','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','getApplications','getInteractions','Contact','Owner','fullname','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','http','client','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','sendStatus','status','offset','limit','undefined','count','set'];(function(_0xac72f7,_0x237a87){var _0x5b1c13=function(_0x465d93){while(--_0x465d93){_0xac72f7['push'](_0xac72f7['shift']());}};_0x5b1c13(++_0x237a87);}(_0x0740,0x90));var _0x0074=function(_0x584da1,_0x4e0247){_0x584da1=_0x584da1-0x0;var _0x2670b3=_0x0740[_0x584da1];return _0x2670b3;};'use strict';var emlformat=require(_0x0074('0x0'));var rimraf=require(_0x0074('0x1'));var zipdir=require(_0x0074('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0074('0x3'));var moment=require('moment');var BPromise=require(_0x0074('0x4'));var Mustache=require(_0x0074('0x5'));var util=require(_0x0074('0x6'));var path=require(_0x0074('0x7'));var sox=require(_0x0074('0x8'));var csv=require(_0x0074('0x9'));var ejs=require(_0x0074('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0074('0xb'));var squel=require(_0x0074('0xc'));var crypto=require('crypto');var jsforce=require(_0x0074('0xd'));var deskjs=require(_0x0074('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0074('0xf'));var Papa=require(_0x0074('0x10'));var Redis=require(_0x0074('0x11'));var authService=require(_0x0074('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0074('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0074('0x14'));var utils=require(_0x0074('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0074('0x16'));var db=require('../../mysqldb')['db'];config[_0x0074('0x17')]=_[_0x0074('0x18')](config[_0x0074('0x17')],{'host':_0x0074('0x19'),'port':0x18eb});var socket=require(_0x0074('0x1a'))(new Redis(config[_0x0074('0x17')]));require('./openchannelAccount.socket')[_0x0074('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x0074('0x1c')]({'port':0x232c});var client9002=jayson[_0x0074('0x1d')][_0x0074('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x15f5ea,_0x3db29d,_0xa7c633,_0x37199e){return new BPromise(function(_0x1eb70b,_0x49a636){var _0x5ed8a5=_0x37199e||client;return _0x5ed8a5[_0x0074('0x1e')](_0x15f5ea,_0xa7c633)[_0x0074('0x1f')](function(_0x5e37cd){logger['info'](_0x0074('0x20'),_0x3db29d,_0x0074('0x21'));logger[_0x0074('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3db29d,_0x0074('0x21'),JSON[_0x0074('0x23')](_0x5e37cd));if(_0x5e37cd[_0x0074('0x24')]){if(_0x5e37cd[_0x0074('0x24')][_0x0074('0x25')]===0x1f4){logger['error'](_0x0074('0x20'),_0x3db29d,_0x5e37cd[_0x0074('0x24')][_0x0074('0x26')]);return _0x49a636(_0x5e37cd['error'][_0x0074('0x26')]);}logger[_0x0074('0x24')](_0x0074('0x20'),_0x3db29d,_0x5e37cd[_0x0074('0x24')][_0x0074('0x26')]);return _0x1eb70b(_0x5e37cd['error'][_0x0074('0x26')]);}else{logger[_0x0074('0x27')](_0x0074('0x20'),_0x3db29d,_0x0074('0x21'));_0x1eb70b(_0x5e37cd[_0x0074('0x28')][_0x0074('0x26')]);}})['catch'](function(_0x339246){logger[_0x0074('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x3db29d,_0x339246);_0x49a636(_0x339246);});});}function respondWithStatusCode(_0x402224,_0xa5c781){_0xa5c781=_0xa5c781||0xcc;return function(_0x131cf0){if(_0x131cf0){return _0x402224[_0x0074('0x29')](_0xa5c781);}return _0x402224[_0x0074('0x2a')](_0xa5c781)['end']();};}function respondWithResult(_0x164385,_0x380c54){_0x380c54=_0x380c54||0xc8;return function(_0x5b2b1a){if(_0x5b2b1a){return _0x164385['status'](_0x380c54)['json'](_0x5b2b1a);}};}function respondWithFilteredResult(_0x40cac8,_0x3ea911){return function(_0x40f059){if(_0x40f059){var _0x320611=typeof _0x3ea911[_0x0074('0x2b')]==='undefined'&&typeof _0x3ea911[_0x0074('0x2c')]===_0x0074('0x2d');var _0x1b4e1f=_0x40f059[_0x0074('0x2e')];var _0x522cdc=_0x320611?0x0:_0x3ea911['offset'];var _0x3c69eb=_0x320611?_0x40f059[_0x0074('0x2e')]:_0x3ea911[_0x0074('0x2b')]+_0x3ea911[_0x0074('0x2c')];var _0x40274f;if(_0x3c69eb>=_0x1b4e1f){_0x3c69eb=_0x1b4e1f;_0x40274f=0xc8;}else{_0x40274f=0xce;}_0x40cac8[_0x0074('0x2a')](_0x40274f);return _0x40cac8[_0x0074('0x2f')](_0x0074('0x30'),_0x522cdc+'-'+_0x3c69eb+'/'+_0x1b4e1f)[_0x0074('0x31')](_0x40f059);}return null;};}function patchUpdates(_0x40e0b4){return function(_0x5f27c9){try{jsonpatch['apply'](_0x5f27c9,_0x40e0b4,!![]);}catch(_0x45f73e){return BPromise[_0x0074('0x32')](_0x45f73e);}return _0x5f27c9[_0x0074('0x33')]();};}function saveUpdates(_0x111bb2,_0x53df62){return function(_0x20b229){if(_0x20b229){return _0x20b229['update'](_0x111bb2)[_0x0074('0x1f')](function(_0x46151e){return _0x46151e;});}return null;};}function removeEntity(_0x48be1b,_0x109c5d){return function(_0x468a9f){if(_0x468a9f){return _0x468a9f[_0x0074('0x34')]()[_0x0074('0x1f')](function(){var _0x2f1878=_0x468a9f[_0x0074('0x35')]({'plain':!![]});var _0x34e13a=_0x0074('0x36');return db['UserProfileResource'][_0x0074('0x34')]({'where':{'type':_0x34e13a,'resourceId':_0x2f1878['id']}})[_0x0074('0x1f')](function(){return _0x468a9f;});})[_0x0074('0x1f')](function(){_0x48be1b[_0x0074('0x2a')](0xcc)[_0x0074('0x37')]();});}};}function handleEntityNotFound(_0x533082,_0x5d1b2e){return function(_0x217ac3){if(!_0x217ac3){_0x533082['sendStatus'](0x194);}return _0x217ac3;};}function handleError(_0x233496,_0xd69286){_0xd69286=_0xd69286||0x1f4;return function(_0x302e93){logger[_0x0074('0x24')](_0x302e93[_0x0074('0x38')]);if(_0x302e93[_0x0074('0x39')]){delete _0x302e93[_0x0074('0x39')];}_0x233496['status'](_0xd69286)[_0x0074('0x3a')](_0x302e93);};}exports[_0x0074('0x3b')]=function(_0x489150,_0x7e360d){var _0x4932c6={'include':[{'model':db[_0x0074('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4dc417={},_0x3ad747={'count':0x0,'rows':[]};var _0x4d3590=_[_0x0074('0x3d')](db[_0x0074('0x3e')]['rawAttributes'],function(_0x3b3831){return{'name':_0x3b3831[_0x0074('0x3f')],'type':_0x3b3831[_0x0074('0x40')][_0x0074('0x41')]};});_0x4dc417['model']=_[_0x0074('0x3d')](_0x4d3590,'name');_0x4dc417[_0x0074('0x42')]=_[_0x0074('0x43')](_0x489150[_0x0074('0x42')]);_0x4dc417[_0x0074('0x44')]=_[_0x0074('0x45')](_0x4dc417['model'],_0x4dc417[_0x0074('0x42')]);_0x4932c6[_0x0074('0x46')]=_[_0x0074('0x45')](_0x4dc417['model'],qs[_0x0074('0x47')](_0x489150[_0x0074('0x42')][_0x0074('0x47')]));_0x4932c6[_0x0074('0x46')]=_0x4932c6[_0x0074('0x46')][_0x0074('0x48')]?_0x4932c6[_0x0074('0x46')]:_0x4dc417[_0x0074('0x49')];if(!_0x489150[_0x0074('0x42')][_0x0074('0x4a')](_0x0074('0x4b'))){_0x4932c6['limit']=qs['limit'](_0x489150[_0x0074('0x42')][_0x0074('0x2c')]);_0x4932c6[_0x0074('0x2b')]=qs[_0x0074('0x2b')](_0x489150['query'][_0x0074('0x2b')]);}_0x4932c6[_0x0074('0x4c')]=qs[_0x0074('0x4d')](_0x489150['query']['sort']);_0x4932c6['where']=qs[_0x0074('0x44')](_[_0x0074('0x4e')](_0x489150[_0x0074('0x42')],_0x4dc417['filters']),_0x4d3590);if(_0x489150[_0x0074('0x42')][_0x0074('0x4f')]){_0x4932c6[_0x0074('0x50')]=_[_0x0074('0x51')](_0x4932c6['where'],{'$or':_['map'](_0x4d3590,function(_0x5ee418){if(_0x5ee418[_0x0074('0x40')]!==_0x0074('0x52')){var _0x4ab037={};_0x4ab037[_0x5ee418[_0x0074('0x39')]]={'$like':'%'+_0x489150[_0x0074('0x42')][_0x0074('0x4f')]+'%'};return _0x4ab037;}})});}_0x4932c6=_[_0x0074('0x51')]({},_0x4932c6,_0x489150['options']);var _0x4d0e7a={'where':_0x4932c6[_0x0074('0x50')]};return db[_0x0074('0x3e')]['count'](_0x4d0e7a)['then'](function(_0x3c9d10){_0x3ad747[_0x0074('0x2e')]=_0x3c9d10;if(_0x489150[_0x0074('0x42')][_0x0074('0x53')]){_0x4932c6[_0x0074('0x54')]=[{'all':!![]}];}return db[_0x0074('0x3e')][_0x0074('0x55')](_0x4932c6);})['then'](function(_0x1632d2){_0x3ad747[_0x0074('0x56')]=_0x1632d2;return _0x3ad747;})['then'](respondWithFilteredResult(_0x7e360d,_0x4932c6))['catch'](handleError(_0x7e360d,null));};exports[_0x0074('0x57')]=function(_0x14294d,_0xa4044e){var _0x1b11ad={'raw':![],'where':{'id':_0x14294d[_0x0074('0x58')]['id']},'include':[{'model':db[_0x0074('0x3c')],'as':'mandatoryDispositionPause'}]},_0x44662a={};_0x44662a[_0x0074('0x49')]=_['keys'](db[_0x0074('0x3e')][_0x0074('0x59')]);_0x44662a[_0x0074('0x42')]=_[_0x0074('0x43')](_0x14294d['query']);_0x44662a[_0x0074('0x44')]=_[_0x0074('0x45')](_0x44662a[_0x0074('0x49')],_0x44662a[_0x0074('0x42')]);_0x1b11ad[_0x0074('0x46')]=_[_0x0074('0x45')](_0x44662a[_0x0074('0x49')],qs[_0x0074('0x47')](_0x14294d[_0x0074('0x42')]['fields']));_0x1b11ad[_0x0074('0x46')]=_0x1b11ad[_0x0074('0x46')]['length']?_0x1b11ad[_0x0074('0x46')]:_0x44662a[_0x0074('0x49')];if(_0x14294d[_0x0074('0x42')][_0x0074('0x53')]){_0x1b11ad[_0x0074('0x54')]=[{'all':!![]}];}_0x1b11ad=_['merge']({},_0x1b11ad,_0x14294d[_0x0074('0x5a')]);return db['OpenchannelAccount'][_0x0074('0x5b')](_0x1b11ad)['then'](handleEntityNotFound(_0xa4044e,null))['then'](respondWithResult(_0xa4044e,null))[_0x0074('0x5c')](handleError(_0xa4044e,null));};exports[_0x0074('0x5d')]=function(_0x3d4cf6,_0xcfef70){return db[_0x0074('0x3e')][_0x0074('0x5d')](_0x3d4cf6[_0x0074('0x5e')],{})[_0x0074('0x1f')](function(_0x377aaa){var _0x5624ed=_0x3d4cf6[_0x0074('0x5f')][_0x0074('0x35')]({'plain':!![]});if(!_0x5624ed)throw new Error(_0x0074('0x60'));if(_0x5624ed[_0x0074('0x61')]===_0x0074('0x5f')){var _0x1ac0b5=_0x377aaa[_0x0074('0x35')]({'plain':!![]});var _0x4960d0=_0x0074('0x36');return db[_0x0074('0x62')]['find']({'where':{'name':_0x4960d0,'userProfileId':_0x5624ed[_0x0074('0x63')]},'raw':!![]})[_0x0074('0x1f')](function(_0x3000e1){if(_0x3000e1&&_0x3000e1[_0x0074('0x64')]===0x0){return db[_0x0074('0x65')][_0x0074('0x5d')]({'name':_0x1ac0b5['name'],'resourceId':_0x1ac0b5['id'],'type':_0x3000e1['name'],'sectionId':_0x3000e1['id']},{})[_0x0074('0x1f')](function(){return _0x377aaa;});}else{return _0x377aaa;}})[_0x0074('0x5c')](function(_0x3ab87b){logger[_0x0074('0x24')](_0x0074('0x66'),_0x3ab87b);throw _0x3ab87b;});}return _0x377aaa;})[_0x0074('0x1f')](respondWithResult(_0xcfef70,0xc9))[_0x0074('0x5c')](handleError(_0xcfef70,null));};exports['update']=function(_0xc34c85,_0x2ee8df){if(_0xc34c85[_0x0074('0x5e')]['id']){delete _0xc34c85['body']['id'];}return db['OpenchannelAccount'][_0x0074('0x5b')]({'where':{'id':_0xc34c85[_0x0074('0x58')]['id']},'include':[{'model':db[_0x0074('0x3c')],'as':_0x0074('0x67')}]})[_0x0074('0x1f')](handleEntityNotFound(_0x2ee8df,null))['then'](saveUpdates(_0xc34c85['body'],null))[_0x0074('0x1f')](respondWithResult(_0x2ee8df,null))[_0x0074('0x5c')](handleError(_0x2ee8df,null));};exports[_0x0074('0x34')]=function(_0x5be1da,_0x18fde9){return db[_0x0074('0x3e')][_0x0074('0x5b')]({'where':{'id':_0x5be1da[_0x0074('0x58')]['id']}})['then'](handleEntityNotFound(_0x18fde9,null))[_0x0074('0x1f')](removeEntity(_0x18fde9,null))[_0x0074('0x5c')](handleError(_0x18fde9,null));};exports[_0x0074('0x68')]=function(_0x64e634,_0x232bd0){return db[_0x0074('0x3e')]['describe']()[_0x0074('0x1f')](respondWithResult(_0x232bd0,null))[_0x0074('0x5c')](handleError(_0x232bd0,null));};exports[_0x0074('0x69')]=function(_0x57823f,_0x382d67,_0x2f28cd){if(_0x57823f['body']['id']){delete _0x57823f[_0x0074('0x5e')]['id'];}return db[_0x0074('0x3e')][_0x0074('0x5b')]({'where':{'id':_0x57823f[_0x0074('0x58')]['id']}})[_0x0074('0x1f')](handleEntityNotFound(_0x382d67,null))[_0x0074('0x1f')](function(_0x30fc79){if(_0x30fc79){_0x57823f[_0x0074('0x5e')]['OpenchannelAccountId']=_0x30fc79['id'];return db[_0x0074('0x6a')][_0x0074('0x5d')](_0x57823f['body']);}})[_0x0074('0x1f')](respondWithResult(_0x382d67,null))[_0x0074('0x5c')](handleError(_0x382d67,null));};exports[_0x0074('0x6b')]=function(_0x2d36cb,_0x5587d2,_0x5ef5d5){var _0x5d70a2={'raw':![],'where':{}};var _0x572ff0={};var _0x541960={'count':0x0,'rows':[]};return db[_0x0074('0x3e')][_0x0074('0x6c')]({'where':{'id':_0x2d36cb[_0x0074('0x58')]['id']}})[_0x0074('0x1f')](handleEntityNotFound(_0x5587d2,null))[_0x0074('0x1f')](function(_0x4c7d06){if(_0x4c7d06){_0x572ff0['model']=_[_0x0074('0x43')](db[_0x0074('0x6a')]['rawAttributes']);_0x572ff0['query']=_[_0x0074('0x43')](_0x2d36cb[_0x0074('0x42')]);_0x572ff0[_0x0074('0x44')]=_[_0x0074('0x45')](_0x572ff0[_0x0074('0x49')],_0x572ff0[_0x0074('0x42')]);_0x5d70a2[_0x0074('0x46')]=_[_0x0074('0x45')](_0x572ff0[_0x0074('0x49')],qs[_0x0074('0x47')](_0x2d36cb[_0x0074('0x42')]['fields']));_0x5d70a2[_0x0074('0x46')]=_0x5d70a2[_0x0074('0x46')][_0x0074('0x48')]?_0x5d70a2[_0x0074('0x46')]:_0x572ff0[_0x0074('0x49')];if(!_0x2d36cb[_0x0074('0x42')]['hasOwnProperty'](_0x0074('0x4b'))){_0x5d70a2[_0x0074('0x2c')]=qs['limit'](_0x2d36cb[_0x0074('0x42')][_0x0074('0x2c')]);_0x5d70a2[_0x0074('0x2b')]=qs['offset'](_0x2d36cb[_0x0074('0x42')][_0x0074('0x2b')]);}_0x5d70a2[_0x0074('0x4c')]=qs['sort'](_0x2d36cb[_0x0074('0x42')][_0x0074('0x4d')]);_0x5d70a2[_0x0074('0x50')]=qs[_0x0074('0x44')](_['pick'](_0x2d36cb[_0x0074('0x42')],_0x572ff0[_0x0074('0x44')]));_0x5d70a2[_0x0074('0x50')]['OpenchannelAccountId']=_0x4c7d06['id'];if(_0x2d36cb[_0x0074('0x42')]['filter']){_0x5d70a2[_0x0074('0x50')]=_['merge'](_0x5d70a2[_0x0074('0x50')],{'$or':_[_0x0074('0x3d')](_0x5d70a2[_0x0074('0x46')],function(_0x945b47){var _0x17aaab={};_0x17aaab[_0x945b47]={'$like':'%'+_0x2d36cb[_0x0074('0x42')][_0x0074('0x4f')]+'%'};return _0x17aaab;})});}_0x5d70a2=_[_0x0074('0x51')]({},_0x5d70a2,_0x2d36cb['options']);return db[_0x0074('0x6a')][_0x0074('0x2e')]({'where':_0x5d70a2[_0x0074('0x50')]})[_0x0074('0x1f')](function(_0x33cdd7){_0x541960['count']=_0x33cdd7;if(_0x2d36cb['query'][_0x0074('0x53')]){_0x5d70a2['include']=[{'all':!![]}];}return db[_0x0074('0x6a')][_0x0074('0x55')](_0x5d70a2);})[_0x0074('0x1f')](function(_0x7540b){_0x541960[_0x0074('0x56')]=_0x7540b;return _0x541960;});}})[_0x0074('0x1f')](respondWithFilteredResult(_0x5587d2,_0x5d70a2))[_0x0074('0x5c')](handleError(_0x5587d2,null));};exports[_0x0074('0x6d')]=function(_0x5da2b4,_0x14a44f,_0x4077fa){return db[_0x0074('0x3e')][_0x0074('0x5b')]({'where':{'id':_0x5da2b4[_0x0074('0x58')]['id']}})[_0x0074('0x1f')](handleEntityNotFound(_0x14a44f,null))[_0x0074('0x1f')](function(_0x3c7fc9){if(_0x3c7fc9){return _0x3c7fc9['removeDispositions'](_0x5da2b4[_0x0074('0x42')][_0x0074('0x6e')]);}})[_0x0074('0x1f')](respondWithStatusCode(_0x14a44f,null))[_0x0074('0x5c')](handleError(_0x14a44f,null));};exports['addAnswer']=function(_0x3c76ca,_0x48c961,_0x9efbf5){if(_0x3c76ca[_0x0074('0x5e')]['id']){delete _0x3c76ca[_0x0074('0x5e')]['id'];}return db[_0x0074('0x3e')]['find']({'where':{'id':_0x3c76ca[_0x0074('0x58')]['id']}})['then'](handleEntityNotFound(_0x48c961,null))[_0x0074('0x1f')](function(_0x1a2bd1){if(_0x1a2bd1){_0x3c76ca[_0x0074('0x5e')][_0x0074('0x6f')]=_0x1a2bd1['id'];return db[_0x0074('0x70')]['create'](_0x3c76ca[_0x0074('0x5e')]);}})[_0x0074('0x1f')](respondWithResult(_0x48c961,null))[_0x0074('0x5c')](handleError(_0x48c961,null));};exports['getAnswers']=function(_0x4982c4,_0x382c85,_0x51e642){var _0x4d3756={'raw':![],'where':{}};var _0x562bdf={};var _0x23ac88={'count':0x0,'rows':[]};return db[_0x0074('0x3e')][_0x0074('0x6c')]({'where':{'id':_0x4982c4[_0x0074('0x58')]['id']}})[_0x0074('0x1f')](handleEntityNotFound(_0x382c85,null))['then'](function(_0x3d4182){if(_0x3d4182){_0x562bdf[_0x0074('0x49')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x562bdf[_0x0074('0x42')]=_['keys'](_0x4982c4[_0x0074('0x42')]);_0x562bdf['filters']=_[_0x0074('0x45')](_0x562bdf['model'],_0x562bdf[_0x0074('0x42')]);_0x4d3756['attributes']=_['intersection'](_0x562bdf[_0x0074('0x49')],qs[_0x0074('0x47')](_0x4982c4['query'][_0x0074('0x47')]));_0x4d3756['attributes']=_0x4d3756['attributes']['length']?_0x4d3756['attributes']:_0x562bdf[_0x0074('0x49')];if(!_0x4982c4[_0x0074('0x42')][_0x0074('0x4a')](_0x0074('0x4b'))){_0x4d3756[_0x0074('0x2c')]=qs[_0x0074('0x2c')](_0x4982c4[_0x0074('0x42')]['limit']);_0x4d3756['offset']=qs['offset'](_0x4982c4['query'][_0x0074('0x2b')]);}_0x4d3756[_0x0074('0x4c')]=qs[_0x0074('0x4d')](_0x4982c4[_0x0074('0x42')]['sort']);_0x4d3756[_0x0074('0x50')]=qs[_0x0074('0x44')](_[_0x0074('0x4e')](_0x4982c4[_0x0074('0x42')],_0x562bdf[_0x0074('0x44')]));_0x4d3756[_0x0074('0x50')]['OpenchannelAccountId']=_0x3d4182['id'];if(_0x4982c4[_0x0074('0x42')][_0x0074('0x4f')]){_0x4d3756[_0x0074('0x50')]=_[_0x0074('0x51')](_0x4d3756[_0x0074('0x50')],{'$or':_[_0x0074('0x3d')](_0x4d3756[_0x0074('0x46')],function(_0x328db4){var _0x3a4ae1={};_0x3a4ae1[_0x328db4]={'$like':'%'+_0x4982c4[_0x0074('0x42')][_0x0074('0x4f')]+'%'};return _0x3a4ae1;})});}_0x4d3756=_[_0x0074('0x51')]({},_0x4d3756,_0x4982c4[_0x0074('0x5a')]);return db['CannedAnswer'][_0x0074('0x2e')]({'where':_0x4d3756[_0x0074('0x50')]})[_0x0074('0x1f')](function(_0x160248){_0x23ac88[_0x0074('0x2e')]=_0x160248;if(_0x4982c4[_0x0074('0x42')][_0x0074('0x53')]){_0x4d3756[_0x0074('0x54')]=[{'all':!![]}];}return db[_0x0074('0x70')][_0x0074('0x55')](_0x4d3756);})[_0x0074('0x1f')](function(_0xf6d8ac){_0x23ac88['rows']=_0xf6d8ac;return _0x23ac88;});}})[_0x0074('0x1f')](respondWithFilteredResult(_0x382c85,_0x4d3756))['catch'](handleError(_0x382c85,null));};exports[_0x0074('0x71')]=function(_0x3f823d,_0x263608,_0x818710){return db[_0x0074('0x3e')][_0x0074('0x5b')]({'where':{'id':_0x3f823d[_0x0074('0x58')]['id']}})[_0x0074('0x1f')](handleEntityNotFound(_0x263608,null))['then'](function(_0x33cdd2){if(_0x33cdd2){return _0x33cdd2[_0x0074('0x71')](_0x3f823d['query'][_0x0074('0x6e')]);}})[_0x0074('0x1f')](respondWithStatusCode(_0x263608,null))[_0x0074('0x5c')](handleError(_0x263608,null));};exports[_0x0074('0x72')]=function(_0x228d5b,_0x48d3c9,_0x4cbcdb){var _0xb2f26e={'body':_0x228d5b[_0x0074('0x5e')],'channel':_0x0074('0x73')};var _0x312800=[];var _0xeefda4=[];var _0xa22c38={};var _0x2826ac=![];return db[_0x0074('0x74')][_0x0074('0x68')]()[_0x0074('0x1f')](function(_0x59394a){if(!_0x59394a){throw new db[(_0x0074('0x75'))][(_0x0074('0x76'))](_0x0074('0x77'));}_0x312800=_['difference'](_[_0x0074('0x43')](_0x59394a),[_0x0074('0x78'),_0x0074('0x79')]);_0xeefda4=_[_0x0074('0x7a')](_['keys'](_0x59394a),['createdAt',_0x0074('0x79'),_0x0074('0x7b'),_0x0074('0x7c')]);if(_0x228d5b[_0x0074('0x5e')]['id']){delete _0x228d5b['body']['id'];}if(_[_0x0074('0x7d')](_0x228d5b[_0x0074('0x5e')][_0x0074('0x7e')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x0074('0x7d')](_0x228d5b[_0x0074('0x5e')][_0x0074('0x5e')])||_0x228d5b[_0x0074('0x5e')][_0x0074('0x5e')]===''){throw new db[(_0x0074('0x75'))][(_0x0074('0x76'))](_0x0074('0x7f'));}if(_[_0x0074('0x7d')](_0x228d5b[_0x0074('0x5e')][_0x0074('0x80')])){throw new db[(_0x0074('0x75'))][(_0x0074('0x76'))](_0x0074('0x81')+_0xeefda4);}if(!_[_0x0074('0x82')](_0xeefda4,_0x228d5b[_0x0074('0x5e')][_0x0074('0x80')])){throw new db[(_0x0074('0x75'))]['ValidationError'](_0x0074('0x83')+_0xeefda4);}_0xa22c38[_0x228d5b[_0x0074('0x5e')][_0x0074('0x80')]]=_0x228d5b['body'][_0x0074('0x7e')];})[_0x0074('0x1f')](function(){return db[_0x0074('0x3e')][_0x0074('0x5b')]({'where':{'id':_0x228d5b[_0x0074('0x58')]['id']},'include':[{'model':db[_0x0074('0x84')],'as':_0x0074('0x85'),'include':[{'model':db[_0x0074('0x74')],'as':'Contacts','where':_0xa22c38,'limit':0x1,'order':[['updatedAt',_0x0074('0x86')]]}]},{'model':db[_0x0074('0x87')],'as':'Applications'}]});})[_0x0074('0x1f')](handleEntityNotFound(_0x48d3c9,null))[_0x0074('0x1f')](function(_0x440017){if(_0x440017&&_0x440017['List']){_0xb2f26e[_0x0074('0x88')]=_0x440017;_0xb2f26e[_0x0074('0x89')]=_0x440017['Applications'];_0xb2f26e[_0x0074('0x8a')]=_0x440017[_0x0074('0x85')];_0xb2f26e[_0x0074('0x89')]=_[_0x0074('0x8b')](_0xb2f26e[_0x0074('0x89')],[_0x0074('0x8c')],[_0x0074('0x8d')]);if(_0xb2f26e[_0x0074('0x88')][_0x0074('0x8e')]){delete _0xb2f26e['account']['Applications'];}if(_0xb2f26e['account'][_0x0074('0x85')]&&_0xb2f26e['account'][_0x0074('0x85')][_0x0074('0x8f')][_0x0074('0x48')]){return _0xb2f26e[_0x0074('0x88')][_0x0074('0x85')][_0x0074('0x8f')][0x0];}var _0x4f30b2=_[_0x0074('0x18')](_0x228d5b[_0x0074('0x5e')],{'firstName':_0x228d5b[_0x0074('0x5e')]['from'],'ListId':_0x440017['ListId']});_0x4f30b2[_0x228d5b[_0x0074('0x5e')][_0x0074('0x80')]]=_0x228d5b[_0x0074('0x5e')][_0x0074('0x7e')];return db['CmContact'][_0x0074('0x5d')](_0x4f30b2,{'fields':_0x312800,'raw':!![]});}})['then'](handleEntityNotFound(_0x48d3c9,null))['then'](function(_0x535eed){_0xb2f26e[_0x0074('0x90')]=_0x535eed;if(_0x535eed){var _0x33ddb5={'ContactId':_0x535eed['id'],'OpenchannelAccountId':_0x228d5b[_0x0074('0x58')]['id'],'from':(_0x535eed[_0x0074('0x91')]||'')+'\x20'+(_0x535eed['lastName']||'')};var _0x392005={'OpenchannelAccountId':_0x228d5b['params']['id'],'closed':![]};if(_0x228d5b['body'][_0x0074('0x92')]){_0x392005[_0x0074('0x92')]=_0x228d5b[_0x0074('0x5e')][_0x0074('0x92')];return db[_0x0074('0x93')][_0x0074('0x5b')]({'where':_0x392005})[_0x0074('0x1f')](function(_0x53c00e){if(_0x53c00e){return[_0x53c00e,![]];}_0x33ddb5[_0x0074('0x92')]=_0x228d5b[_0x0074('0x5e')][_0x0074('0x92')];_0x33ddb5[_0x0074('0x94')]=_0x228d5b['body'][_0x0074('0x94')];return db[_0x0074('0x93')][_0x0074('0x5d')](_0x33ddb5)['then'](function(_0x1e23a5){return[_0x1e23a5,!![]];});});}else{_0x392005[_0x0074('0x92')]=null;}_0x392005[_0x0074('0x95')]=_0x535eed['id'];return db[_0x0074('0x93')][_0x0074('0x5b')]({'where':_0x392005})['then'](function(_0xcc9e3f){if(_0xcc9e3f){return[_0xcc9e3f,![]];}return db['OpenchannelInteraction'][_0x0074('0x5d')](_0x33ddb5)['then'](function(_0x39e97c){return[_0x39e97c,!![]];});});}})[_0x0074('0x96')](function(_0x496362,_0xe4222e){if(_0x496362){_0x2826ac=_0xe4222e;if(!_0xe4222e){var _0xd5595a={'from':(_0xb2f26e['contact']['firstName']||'')+'\x20'+(_0xb2f26e['contact'][_0x0074('0x97')]||'')};if(_0x228d5b[_0x0074('0x5e')][_0x0074('0x92')]&&_0x228d5b[_0x0074('0x5e')][_0x0074('0x98')]&&_0x228d5b['body'][_0x0074('0x92')]!=_0x228d5b[_0x0074('0x5e')][_0x0074('0x98')]){_0xd5595a[_0x0074('0x92')]=_0x228d5b['body']['messageId'];}return _0x496362[_0x0074('0x99')](_0xd5595a);}else{return _0x496362;}}})[_0x0074('0x1f')](function(_0x513fd3){_0xb2f26e[_0x0074('0x9a')]=_0x513fd3[_0x0074('0x35')]({'plain':!![]});_0xb2f26e['interaction']['created']=_0x2826ac;if(_0xb2f26e[_0x0074('0x9a')][_0x0074('0x9b')]){if(_0xb2f26e['account']['autoclose']){_0xb2f26e['applications'][_0x0074('0x9c')]({'id':0x0,'priority':_0xb2f26e[_0x0074('0x89')][_0x0074('0x48')]+0x1,'app':'close','appdata':_0x0074('0x9d'),'interval':_0x0074('0x9e')});}}return db[_0x0074('0x9f')]['create']({'body':_0x228d5b[_0x0074('0x5e')][_0x0074('0x5e')],'OpenchannelAccountId':_0x228d5b['params']['id'],'OpenchannelInteractionId':_0x513fd3['id'],'direction':'in','ContactId':_0xb2f26e[_0x0074('0x90')]['id'],'AttachmentId':_0x228d5b[_0x0074('0x5e')][_0x0074('0xa0')]});})[_0x0074('0x1f')](function(_0xfa57e1){_0xb2f26e['message']=_0xfa57e1;if(_0xb2f26e[_0x0074('0x9a')][_0x0074('0xa1')]){return db[_0x0074('0xa2')]['find']({'attributes':['id',_0x0074('0x39')],'where':{'id':_0xb2f26e[_0x0074('0x9a')]['UserId']}})[_0x0074('0x1f')](function(_0x4ee07b){if(_0x4ee07b){_0xb2f26e[_0x0074('0x89')][_0x0074('0xa3')]({'id':0x0,'priority':0x0,'app':_0x0074('0xa4'),'appdata':_0x4ee07b[_0x0074('0x39')]+','+(_0xb2f26e[_0x0074('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0x0074('0x9e')});_0xb2f26e[_0x0074('0xa5')]=![];}return respondWithRpcPromise(_0x0074('0xa6'),_0x0074('0xa7'),_0xb2f26e);});}return respondWithRpcPromise(_0x0074('0xa6'),_0x0074('0xa7'),_0xb2f26e);})['then'](function(_0x4cafb7){respondWithRpcPromise('EventManager',_0x0074('0xa8'),{'event':_0x0074('0x72'),'message':_0x4cafb7},client9002);return _0x4cafb7;})[_0x0074('0x1f')](respondWithResult(_0x48d3c9,null))[_0x0074('0x5c')](handleError(_0x48d3c9,null));};exports[_0x0074('0xa9')]=function(_0x165631,_0x5d1d76,_0x205ce0){return db[_0x0074('0x3e')][_0x0074('0x6c')]({'where':{'id':_0x165631['params']['id']}})['then'](handleEntityNotFound(_0x5d1d76,null))[_0x0074('0x1f')](function(_0x6926b5){if(_0x6926b5){return db[_0x0074('0xaa')][_0x0074('0xab')](function(_0x3f02e6){return db['OpenchannelApplication'][_0x0074('0x34')]({'where':{'OpenchannelAccountId':_0x165631['params']['id']},'transaction':_0x3f02e6})[_0x0074('0x1f')](function(_0x386b6f){var _0x3232a8=_['map'](_0x165631['body'],function(_0x1e988a){_0x1e988a['OpenchannelAccountId']=_0x165631[_0x0074('0x58')]['id'];return _0x1e988a;});return db[_0x0074('0x87')][_0x0074('0xac')](_0x3232a8,{'transaction':_0x3f02e6});});})['then'](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x165631[_0x0074('0x58')]['id']},'order':_0x0074('0x8c')});});}})[_0x0074('0x1f')](respondWithResult(_0x5d1d76,null))[_0x0074('0x5c')](handleError(_0x5d1d76,null));};exports[_0x0074('0xad')]=function(_0x21bfbd,_0x50db7d,_0x536a42){var _0x3ef67c={};var _0x298b02={};var _0x455711;var _0x1460c6;return db[_0x0074('0x3e')]['findOne']({'where':{'id':_0x21bfbd['params']['id']}})[_0x0074('0x1f')](handleEntityNotFound(_0x50db7d,null))[_0x0074('0x1f')](function(_0x1ce7e2){if(_0x1ce7e2){_0x455711=_0x1ce7e2;_0x298b02['model']=_[_0x0074('0x43')](db[_0x0074('0x87')][_0x0074('0x59')]);_0x298b02[_0x0074('0x42')]=_[_0x0074('0x43')](_0x21bfbd[_0x0074('0x42')]);_0x298b02[_0x0074('0x44')]=_[_0x0074('0x45')](_0x298b02['model'],_0x298b02[_0x0074('0x42')]);_0x3ef67c[_0x0074('0x46')]=_[_0x0074('0x45')](_0x298b02['model'],qs[_0x0074('0x47')](_0x21bfbd[_0x0074('0x42')][_0x0074('0x47')]));_0x3ef67c[_0x0074('0x46')]=_0x3ef67c[_0x0074('0x46')][_0x0074('0x48')]?_0x3ef67c[_0x0074('0x46')]:_0x298b02['model'];_0x3ef67c['order']=qs['sort'](_0x21bfbd['query'][_0x0074('0x4d')]);_0x3ef67c['where']=qs['filters'](_[_0x0074('0x4e')](_0x21bfbd[_0x0074('0x42')],_0x298b02['filters']));if(_0x21bfbd[_0x0074('0x42')][_0x0074('0x4f')]){_0x3ef67c['where']=_['merge'](_0x3ef67c[_0x0074('0x50')],{'$or':_['map'](_0x3ef67c['attributes'],function(_0x1576b7){var _0x89fda1={};_0x89fda1[_0x1576b7]={'$like':'%'+_0x21bfbd[_0x0074('0x42')][_0x0074('0x4f')]+'%'};return _0x89fda1;})});}_0x3ef67c=_['merge']({},_0x3ef67c,_0x21bfbd['options']);return _0x455711['getApplications'](_0x3ef67c);}})[_0x0074('0x1f')](function(_0xe1007a){if(_0xe1007a){_0x1460c6=_0xe1007a[_0x0074('0x48')];if(!_0x21bfbd[_0x0074('0x42')][_0x0074('0x4a')](_0x0074('0x4b'))){_0x3ef67c[_0x0074('0x2c')]=qs['limit'](_0x21bfbd[_0x0074('0x42')][_0x0074('0x2c')]);_0x3ef67c['offset']=qs[_0x0074('0x2b')](_0x21bfbd[_0x0074('0x42')]['offset']);}return _0x455711[_0x0074('0xad')](_0x3ef67c);}})[_0x0074('0x1f')](function(_0x336294){if(_0x336294){return _0x336294?{'count':_0x1460c6,'rows':_0x336294}:null;}})[_0x0074('0x1f')](respondWithResult(_0x50db7d,null))[_0x0074('0x5c')](handleError(_0x50db7d,null));};exports[_0x0074('0xae')]=function(_0x564bc0,_0x4ca146,_0x35d38a){var _0x12a261={'raw':![],'where':{}};var _0x4425a5={};var _0x2b7cf0={'count':0x0,'rows':[]};return db[_0x0074('0x3e')][_0x0074('0x6c')]({'where':{'id':_0x564bc0['params']['id']}})[_0x0074('0x1f')](handleEntityNotFound(_0x4ca146,null))[_0x0074('0x1f')](function(_0x3dc1a0){if(_0x3dc1a0){_0x4425a5[_0x0074('0x49')]=_[_0x0074('0x43')](db[_0x0074('0x93')]['rawAttributes']);_0x4425a5['query']=_[_0x0074('0x43')](_0x564bc0['query']);_0x4425a5[_0x0074('0x44')]=_[_0x0074('0x45')](_0x4425a5[_0x0074('0x49')],_0x4425a5[_0x0074('0x42')]);_0x12a261[_0x0074('0x46')]=_['intersection'](_0x4425a5[_0x0074('0x49')],qs[_0x0074('0x47')](_0x564bc0['query']['fields']));_0x12a261[_0x0074('0x46')]=_0x12a261['attributes'][_0x0074('0x48')]?_0x12a261[_0x0074('0x46')]:_0x4425a5[_0x0074('0x49')];if(!_0x564bc0[_0x0074('0x42')][_0x0074('0x4a')](_0x0074('0x4b'))){_0x12a261['limit']=qs[_0x0074('0x2c')](_0x564bc0[_0x0074('0x42')][_0x0074('0x2c')]);_0x12a261[_0x0074('0x2b')]=qs[_0x0074('0x2b')](_0x564bc0[_0x0074('0x42')]['offset']);}_0x12a261[_0x0074('0x4c')]=qs[_0x0074('0x4d')](_0x564bc0[_0x0074('0x42')][_0x0074('0x4d')]);_0x12a261[_0x0074('0x50')]=qs[_0x0074('0x44')](_['pick'](_0x564bc0['query'],_0x4425a5[_0x0074('0x44')]));_0x12a261[_0x0074('0x50')][_0x0074('0x6f')]=_0x3dc1a0['id'];if(_0x564bc0[_0x0074('0x42')]['filter']){_0x12a261['where']=_['merge'](_0x12a261[_0x0074('0x50')],{'$or':_[_0x0074('0x3d')](_0x12a261['attributes'],function(_0x199d8f){var _0x2fde47={};_0x2fde47[_0x199d8f]={'$like':'%'+_0x564bc0[_0x0074('0x42')]['filter']+'%'};return _0x2fde47;})});}_0x12a261=_['merge']({},_0x12a261,_0x564bc0[_0x0074('0x5a')]);return db['OpenchannelInteraction'][_0x0074('0x2e')]({'where':_0x12a261[_0x0074('0x50')]})[_0x0074('0x1f')](function(_0x394639){_0x2b7cf0[_0x0074('0x2e')]=_0x394639;if(_0x564bc0[_0x0074('0x42')][_0x0074('0x53')]){_0x12a261[_0x0074('0x54')]=[{'model':db[_0x0074('0x74')],'as':_0x0074('0xaf'),'required':![]},{'model':db[_0x0074('0xa2')],'as':_0x0074('0xb0'),'attributes':[_0x0074('0x39'),_0x0074('0xb1'),'internal'],'required':![]},{'model':db[_0x0074('0xb2')],'as':'Tags','attributes':['id',_0x0074('0x39'),_0x0074('0xb3')],'where':_0x564bc0[_0x0074('0x42')][_0x0074('0xb4')]?{'id':_0x564bc0[_0x0074('0x42')]['tag']}:undefined,'required':_0x564bc0[_0x0074('0x42')][_0x0074('0xb4')]?!![]:![]}];}return db[_0x0074('0x93')][_0x0074('0x55')](_0x12a261);})[_0x0074('0x1f')](function(_0x5b47b2){_0x2b7cf0['rows']=_0x5b47b2;return _0x2b7cf0;});}})[_0x0074('0x1f')](respondWithFilteredResult(_0x4ca146,_0x12a261))[_0x0074('0x5c')](handleError(_0x4ca146,null));};exports[_0x0074('0xb5')]=function(_0x1ba1ba,_0x37c25a,_0x5cceb8){return db[_0x0074('0x3e')]['find']({'where':{'id':_0x1ba1ba['params']['id']}})[_0x0074('0x1f')](handleEntityNotFound(_0x37c25a,null))[_0x0074('0x1f')](function(_0x45ec23){if(_0x45ec23){return _0x45ec23[_0x0074('0xb5')](_0x1ba1ba[_0x0074('0x5e')][_0x0074('0x6e')],_[_0x0074('0xb6')](_0x1ba1ba[_0x0074('0x5e')],['ids','id'])||{})[_0x0074('0x96')](function(_0x3d387a){for(var _0x32b6d3=0x0;_0x32b6d3<_0x1ba1ba['body']['ids'][_0x0074('0x48')];_0x32b6d3+=0x1){socket[_0x0074('0xb7')](_0x0074('0xb8'),{'UserId':Number(_0x1ba1ba[_0x0074('0x5e')][_0x0074('0x6e')][_0x32b6d3]),'OpenchannelAccountId':Number(_0x1ba1ba['params']['id'])});}return _0x3d387a;});}})[_0x0074('0x1f')](respondWithResult(_0x37c25a,null))[_0x0074('0x5c')](handleError(_0x37c25a,null));};exports[_0x0074('0xb9')]=function(_0x12b402,_0x3db98f,_0x3f35e0){return db[_0x0074('0x3e')]['find']({'where':{'id':_0x12b402[_0x0074('0x58')]['id']}})[_0x0074('0x1f')](handleEntityNotFound(_0x3db98f,null))[_0x0074('0x1f')](function(_0x48a92d){if(_0x48a92d){return _0x48a92d[_0x0074('0xb9')](_0x12b402['query']['ids'])['then'](function(){if(_[_0x0074('0xba')](_0x12b402[_0x0074('0x42')][_0x0074('0x6e')])){for(var _0x419511=0x0;_0x419511<_0x12b402[_0x0074('0x42')][_0x0074('0x6e')][_0x0074('0x48')];_0x419511+=0x1){socket['emit'](_0x0074('0xbb'),{'UserId':Number(_0x12b402[_0x0074('0x42')]['ids'][_0x419511]),'OpenchannelAccountId':Number(_0x12b402[_0x0074('0x58')]['id'])});}}else{socket[_0x0074('0xb7')](_0x0074('0xbb'),{'UserId':Number(_0x12b402[_0x0074('0x42')][_0x0074('0x6e')]),'OpenchannelAccountId':Number(_0x12b402[_0x0074('0x58')]['id'])});}});}})[_0x0074('0x1f')](respondWithStatusCode(_0x3db98f,null))[_0x0074('0x5c')](handleError(_0x3db98f,null));};exports[_0x0074('0xbc')]=function(_0x384506,_0x4f45c6,_0xb92d90){var _0x36eb06={};var _0x14b717={};var _0x2cfbd6;var _0x1b27e1;return db['OpenchannelAccount'][_0x0074('0x6c')]({'where':{'id':_0x384506[_0x0074('0x58')]['id']}})[_0x0074('0x1f')](handleEntityNotFound(_0x4f45c6,null))['then'](function(_0x4b866f){if(_0x4b866f){_0x2cfbd6=_0x4b866f;_0x14b717[_0x0074('0x49')]=_[_0x0074('0x43')](db[_0x0074('0xa2')]['rawAttributes']);_0x14b717[_0x0074('0x42')]=_[_0x0074('0x43')](_0x384506[_0x0074('0x42')]);_0x14b717[_0x0074('0x44')]=_['intersection'](_0x14b717[_0x0074('0x49')],_0x14b717['query']);_0x36eb06[_0x0074('0x46')]=_[_0x0074('0x45')](_0x14b717['model'],qs[_0x0074('0x47')](_0x384506[_0x0074('0x42')]['fields']));_0x36eb06[_0x0074('0x46')]=_0x36eb06['attributes']['length']?_0x36eb06[_0x0074('0x46')]:_0x14b717[_0x0074('0x49')];_0x36eb06[_0x0074('0x4c')]=qs[_0x0074('0x4d')](_0x384506[_0x0074('0x42')]['sort']);_0x36eb06[_0x0074('0x50')]=qs[_0x0074('0x44')](_[_0x0074('0x4e')](_0x384506[_0x0074('0x42')],_0x14b717['filters']));if(_0x384506[_0x0074('0x42')][_0x0074('0x4f')]){_0x36eb06['where']=_[_0x0074('0x51')](_0x36eb06[_0x0074('0x50')],{'$or':_[_0x0074('0x3d')](_0x36eb06[_0x0074('0x46')],function(_0x7d4243){var _0x364b7e={};_0x364b7e[_0x7d4243]={'$like':'%'+_0x384506[_0x0074('0x42')][_0x0074('0x4f')]+'%'};return _0x364b7e;})});}_0x36eb06=_['merge']({},_0x36eb06,_0x384506[_0x0074('0x5a')]);return _0x2cfbd6[_0x0074('0xbc')](_0x36eb06);}})[_0x0074('0x1f')](function(_0x4c4f14){if(_0x4c4f14){_0x1b27e1=_0x4c4f14[_0x0074('0x48')];if(!_0x384506[_0x0074('0x42')][_0x0074('0x4a')]('nolimit')){_0x36eb06['limit']=qs[_0x0074('0x2c')](_0x384506[_0x0074('0x42')][_0x0074('0x2c')]);_0x36eb06['offset']=qs[_0x0074('0x2b')](_0x384506[_0x0074('0x42')][_0x0074('0x2b')]);}return _0x2cfbd6[_0x0074('0xbc')](_0x36eb06);}})[_0x0074('0x1f')](function(_0x26305f){if(_0x26305f){return _0x26305f?{'count':_0x1b27e1,'rows':_0x26305f}:null;}})[_0x0074('0x1f')](respondWithResult(_0x4f45c6,null))[_0x0074('0x5c')](handleError(_0x4f45c6,null));};exports[_0x0074('0x3a')]=function(_0x19666f,_0x35241,_0x54de1c){var _0x2916fc,_0x3ccffe,_0x1db605;if(_[_0x0074('0x7d')](_0x19666f[_0x0074('0x5e')][_0x0074('0x5e')])||_0x19666f[_0x0074('0x5e')][_0x0074('0x5e')]===''){throw new db[(_0x0074('0x75'))][(_0x0074('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0074('0x7d')](_0x19666f[_0x0074('0x5e')]['to'])){}_0x2916fc=_0x19666f[_0x0074('0x5e')]['to'];return db[_0x0074('0x3e')]['findOne']({'where':{'id':_0x19666f[_0x0074('0x58')]['id']}})[_0x0074('0x1f')](handleEntityNotFound(_0x35241,null))['then'](function(_0x3de866){if(_0x3de866){return db['OpenchannelAccount'][_0x0074('0x5b')]({'where':{'id':_0x3de866['id']},'include':[{'model':db[_0x0074('0x84')],'as':_0x0074('0x85'),'include':[{'model':db[_0x0074('0x74')],'as':_0x0074('0x8f'),'where':{[_0x3de866[_0x0074('0x80')]]:_0x2916fc},'limit':0x1,'order':[['updatedAt',_0x0074('0x86')]]}]}]})['then'](handleEntityNotFound(_0x35241,null))[_0x0074('0x1f')](function(_0x2036de){if(_0x2036de&&_0x2036de[_0x0074('0x85')]){_0x3ccffe=_0x2036de[_0x0074('0x35')]({'plain':!![]});if(_0x3ccffe['List']&&_0x3ccffe[_0x0074('0x85')][_0x0074('0x8f')][_0x0074('0x48')]){return _0x3ccffe[_0x0074('0x85')]['Contacts'][0x0];}return db[_0x0074('0x74')][_0x0074('0x5d')](_['defaults'](_0x19666f[_0x0074('0x5e')],{'firstName':_0x2916fc,[_0x2036de[_0x0074('0x80')]]:_0x2916fc,'phone':_0x2916fc,'ListId':_0x3ccffe[_0x0074('0x7c')]}));}})[_0x0074('0x1f')](handleEntityNotFound(_0x35241,null))[_0x0074('0x1f')](function(_0xc6fb28){if(_0xc6fb28){_0x1db605=_0xc6fb28;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x1db605['id'],'closed':![],'OpenchannelAccountId':_0x3ccffe['id']}})[_0x0074('0x1f')](function(_0x3f5e39){if(_0x3f5e39){return[_0x3f5e39,![]];}return db['OpenchannelInteraction'][_0x0074('0x5d')]({'UserId':_0x19666f[_0x0074('0x5f')]['id'],'ContactId':_0x1db605['id'],'OpenchannelAccountId':_0x3ccffe['id'],'lastMsgDirection':_0x0074('0xbd'),'Messages':[_[_0x0074('0x51')](_0x19666f[_0x0074('0x5e')],{'read':![],'body':_0x19666f[_0x0074('0x5e')]['body'],'OpenchannelAccountId':_0x3ccffe['id'],'UserId':_0x19666f[_0x0074('0x5f')]['id'],'ContactId':_0x1db605['id']})]},{'include':[{'model':db[_0x0074('0x9f')],'as':_0x0074('0xbe')}]})[_0x0074('0x1f')](function(_0x2b985f){return[_0x2b985f,!![]];});});}})[_0x0074('0x96')](function(_0x339fae,_0x3caf16){if(_0x3caf16){return _0x339fae;}return db[_0x0074('0x9f')][_0x0074('0x5d')](_[_0x0074('0x51')](_0x19666f['body'],{'read':![],'body':_0x19666f[_0x0074('0x5e')][_0x0074('0x5e')],'OpenchannelAccountId':_0x3ccffe['id'],'OpenchannelInteractionId':_0x339fae['id'],'UserId':_0x19666f['user']['id'],'ContactId':_0x1db605['id']}))[_0x0074('0x1f')](function(_0x1345c3){_0x339fae[_0x0074('0xbf')][_0x0074('0xbe')]=[];_0x339fae['dataValues'][_0x0074('0xbe')]['push'](_0x1345c3[_0x0074('0xbf')]);return _0x339fae;});});}})[_0x0074('0x1f')](respondWithResult(_0x35241,null))[_0x0074('0x5c')](handleError(_0x35241,null));}; \ No newline at end of file +var _0xebb1=['Contact','fullname','internal','Tags','color','tag','addAgents','removeAgents','emit','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','spread','dataValues','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','sendStatus','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','merge','type','filter','options','includeAll','include','findAll','rows','mandatoryDispositionPause','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','pick','removeDispositions','CannedAnswer','getAnswers','findOne','hasOwnProperty','removeAnswers','ids','notify','openchannel','CmContact','difference','createdAt','updatedAt','CompanyId','isNil','Sequelize','ValidationError','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','from','CmList','OpenchannelApplication','Applications','List','applications','list','orderBy','asc','account','Contacts','ListId','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','sequelize','transaction','priority','getApplications','getInteractions'];(function(_0x272d97,_0x3cb745){var _0x40fc01=function(_0x1ad071){while(--_0x1ad071){_0x272d97['push'](_0x272d97['shift']());}};_0x40fc01(++_0x3cb745);}(_0xebb1,0x180));var _0x1ebb=function(_0xcc4b68,_0x56c4bb){_0xcc4b68=_0xcc4b68-0x0;var _0x53191e=_0xebb1[_0xcc4b68];return _0x53191e;};'use strict';var emlformat=require(_0x1ebb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ebb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ebb('0x2'));var moment=require(_0x1ebb('0x3'));var BPromise=require(_0x1ebb('0x4'));var Mustache=require(_0x1ebb('0x5'));var util=require('util');var path=require(_0x1ebb('0x6'));var sox=require(_0x1ebb('0x7'));var csv=require(_0x1ebb('0x8'));var ejs=require(_0x1ebb('0x9'));var fs=require('fs');var fs_extra=require(_0x1ebb('0xa'));var _=require(_0x1ebb('0xb'));var squel=require(_0x1ebb('0xc'));var crypto=require(_0x1ebb('0xd'));var jsforce=require(_0x1ebb('0xe'));var deskjs=require(_0x1ebb('0xf'));var toCsv=require(_0x1ebb('0x8'));var querystring=require(_0x1ebb('0x10'));var Papa=require('papaparse');var Redis=require(_0x1ebb('0x11'));var authService=require(_0x1ebb('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ebb('0x13'));var logger=require(_0x1ebb('0x14'))('api');var utils=require(_0x1ebb('0x15'));var config=require(_0x1ebb('0x16'));var licenseUtil=require(_0x1ebb('0x17'));var db=require(_0x1ebb('0x18'))['db'];config[_0x1ebb('0x19')]=_[_0x1ebb('0x1a')](config[_0x1ebb('0x19')],{'host':_0x1ebb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ebb('0x19')]));require(_0x1ebb('0x1c'))[_0x1ebb('0x1d')](socket);var jayson=require(_0x1ebb('0x1e'));var client=jayson['client'][_0x1ebb('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x1ebb('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x52e4d3,_0x3d0cfd,_0x4cd106,_0x4852f4){return new BPromise(function(_0x449348,_0x177602){var _0x3ba949=_0x4852f4||client;return _0x3ba949[_0x1ebb('0x20')](_0x52e4d3,_0x4cd106)[_0x1ebb('0x21')](function(_0xc4d1cd){logger['info'](_0x1ebb('0x22'),_0x3d0cfd,_0x1ebb('0x23'));logger[_0x1ebb('0x24')](_0x1ebb('0x25'),_0x3d0cfd,_0x1ebb('0x23'),JSON['stringify'](_0xc4d1cd));if(_0xc4d1cd[_0x1ebb('0x26')]){if(_0xc4d1cd['error']['code']===0x1f4){logger[_0x1ebb('0x26')](_0x1ebb('0x22'),_0x3d0cfd,_0xc4d1cd[_0x1ebb('0x26')]['message']);return _0x177602(_0xc4d1cd[_0x1ebb('0x26')][_0x1ebb('0x27')]);}logger[_0x1ebb('0x26')](_0x1ebb('0x22'),_0x3d0cfd,_0xc4d1cd[_0x1ebb('0x26')][_0x1ebb('0x27')]);return _0x449348(_0xc4d1cd[_0x1ebb('0x26')][_0x1ebb('0x27')]);}else{logger[_0x1ebb('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x3d0cfd,_0x1ebb('0x23'));_0x449348(_0xc4d1cd[_0x1ebb('0x29')][_0x1ebb('0x27')]);}})[_0x1ebb('0x2a')](function(_0x2729a2){logger[_0x1ebb('0x26')](_0x1ebb('0x22'),_0x3d0cfd,_0x2729a2);_0x177602(_0x2729a2);});});}function respondWithStatusCode(_0x45bf63,_0x16543c){_0x16543c=_0x16543c||0xcc;return function(_0x3419fc){if(_0x3419fc){return _0x45bf63['sendStatus'](_0x16543c);}return _0x45bf63['status'](_0x16543c)[_0x1ebb('0x2b')]();};}function respondWithResult(_0x5c9623,_0xe2194){_0xe2194=_0xe2194||0xc8;return function(_0x52e6c4){if(_0x52e6c4){return _0x5c9623[_0x1ebb('0x2c')](_0xe2194)[_0x1ebb('0x2d')](_0x52e6c4);}};}function respondWithFilteredResult(_0x419ffb,_0x690519){return function(_0x3826b1){if(_0x3826b1){var _0xbd7ed9=typeof _0x690519[_0x1ebb('0x2e')]==='undefined'&&typeof _0x690519[_0x1ebb('0x2f')]===_0x1ebb('0x30');var _0x6b78a=_0x3826b1['count'];var _0x4f2a20=_0xbd7ed9?0x0:_0x690519[_0x1ebb('0x2e')];var _0x20edcd=_0xbd7ed9?_0x3826b1[_0x1ebb('0x31')]:_0x690519['offset']+_0x690519[_0x1ebb('0x2f')];var _0x7aa2c4;if(_0x20edcd>=_0x6b78a){_0x20edcd=_0x6b78a;_0x7aa2c4=0xc8;}else{_0x7aa2c4=0xce;}_0x419ffb[_0x1ebb('0x2c')](_0x7aa2c4);return _0x419ffb[_0x1ebb('0x32')](_0x1ebb('0x33'),_0x4f2a20+'-'+_0x20edcd+'/'+_0x6b78a)['json'](_0x3826b1);}return null;};}function patchUpdates(_0x5e43f1){return function(_0x3fd792){try{jsonpatch[_0x1ebb('0x34')](_0x3fd792,_0x5e43f1,!![]);}catch(_0x186e78){return BPromise[_0x1ebb('0x35')](_0x186e78);}return _0x3fd792[_0x1ebb('0x36')]();};}function saveUpdates(_0x30dac5,_0x157a26){return function(_0x483754){if(_0x483754){return _0x483754[_0x1ebb('0x37')](_0x30dac5)[_0x1ebb('0x21')](function(_0x3bb937){return _0x3bb937;});}return null;};}function removeEntity(_0x14f6ce,_0x507f7f){return function(_0x35fe47){if(_0x35fe47){return _0x35fe47[_0x1ebb('0x38')]()[_0x1ebb('0x21')](function(){var _0x21b17e=_0x35fe47[_0x1ebb('0x39')]({'plain':!![]});var _0x545ddd=_0x1ebb('0x3a');return db['UserProfileResource'][_0x1ebb('0x38')]({'where':{'type':_0x545ddd,'resourceId':_0x21b17e['id']}})[_0x1ebb('0x21')](function(){return _0x35fe47;});})['then'](function(){_0x14f6ce[_0x1ebb('0x2c')](0xcc)[_0x1ebb('0x2b')]();});}};}function handleEntityNotFound(_0x4ff52a,_0x126a1e){return function(_0x5b03d1){if(!_0x5b03d1){_0x4ff52a[_0x1ebb('0x3b')](0x194);}return _0x5b03d1;};}function handleError(_0x374d1c,_0x561a12){_0x561a12=_0x561a12||0x1f4;return function(_0x4eac53){logger[_0x1ebb('0x26')](_0x4eac53['stack']);if(_0x4eac53[_0x1ebb('0x3c')]){delete _0x4eac53[_0x1ebb('0x3c')];}_0x374d1c[_0x1ebb('0x2c')](_0x561a12)[_0x1ebb('0x3d')](_0x4eac53);};}exports[_0x1ebb('0x3e')]=function(_0x20ca42,_0x3adfff){var _0x42bec0={'include':[{'model':db[_0x1ebb('0x3f')],'as':'mandatoryDispositionPause'}]},_0x3a97d3={},_0x2297e7={'count':0x0,'rows':[]};var _0x3784b4=_[_0x1ebb('0x40')](db[_0x1ebb('0x41')][_0x1ebb('0x42')],function(_0x3f4052){return{'name':_0x3f4052['fieldName'],'type':_0x3f4052['type'][_0x1ebb('0x43')]};});_0x3a97d3[_0x1ebb('0x44')]=_[_0x1ebb('0x40')](_0x3784b4,_0x1ebb('0x3c'));_0x3a97d3['query']=_[_0x1ebb('0x45')](_0x20ca42[_0x1ebb('0x46')]);_0x3a97d3['filters']=_[_0x1ebb('0x47')](_0x3a97d3[_0x1ebb('0x44')],_0x3a97d3[_0x1ebb('0x46')]);_0x42bec0[_0x1ebb('0x48')]=_[_0x1ebb('0x47')](_0x3a97d3[_0x1ebb('0x44')],qs[_0x1ebb('0x49')](_0x20ca42[_0x1ebb('0x46')][_0x1ebb('0x49')]));_0x42bec0[_0x1ebb('0x48')]=_0x42bec0['attributes'][_0x1ebb('0x4a')]?_0x42bec0[_0x1ebb('0x48')]:_0x3a97d3[_0x1ebb('0x44')];if(!_0x20ca42[_0x1ebb('0x46')]['hasOwnProperty'](_0x1ebb('0x4b'))){_0x42bec0['limit']=qs[_0x1ebb('0x2f')](_0x20ca42[_0x1ebb('0x46')]['limit']);_0x42bec0[_0x1ebb('0x2e')]=qs[_0x1ebb('0x2e')](_0x20ca42[_0x1ebb('0x46')][_0x1ebb('0x2e')]);}_0x42bec0[_0x1ebb('0x4c')]=qs['sort'](_0x20ca42[_0x1ebb('0x46')][_0x1ebb('0x4d')]);_0x42bec0['where']=qs['filters'](_['pick'](_0x20ca42[_0x1ebb('0x46')],_0x3a97d3['filters']),_0x3784b4);if(_0x20ca42[_0x1ebb('0x46')]['filter']){_0x42bec0[_0x1ebb('0x4e')]=_[_0x1ebb('0x4f')](_0x42bec0[_0x1ebb('0x4e')],{'$or':_[_0x1ebb('0x40')](_0x3784b4,function(_0x285af2){if(_0x285af2[_0x1ebb('0x50')]!=='VIRTUAL'){var _0x229090={};_0x229090[_0x285af2[_0x1ebb('0x3c')]]={'$like':'%'+_0x20ca42[_0x1ebb('0x46')][_0x1ebb('0x51')]+'%'};return _0x229090;}})});}_0x42bec0=_[_0x1ebb('0x4f')]({},_0x42bec0,_0x20ca42[_0x1ebb('0x52')]);var _0x1af44b={'where':_0x42bec0[_0x1ebb('0x4e')]};return db[_0x1ebb('0x41')][_0x1ebb('0x31')](_0x1af44b)[_0x1ebb('0x21')](function(_0x546b6b){_0x2297e7['count']=_0x546b6b;if(_0x20ca42[_0x1ebb('0x46')][_0x1ebb('0x53')]){_0x42bec0[_0x1ebb('0x54')]=[{'all':!![]}];}return db[_0x1ebb('0x41')][_0x1ebb('0x55')](_0x42bec0);})['then'](function(_0x3ab756){_0x2297e7[_0x1ebb('0x56')]=_0x3ab756;return _0x2297e7;})[_0x1ebb('0x21')](respondWithFilteredResult(_0x3adfff,_0x42bec0))[_0x1ebb('0x2a')](handleError(_0x3adfff,null));};exports['show']=function(_0x1db3d1,_0x1bccbc){var _0x553f8d={'raw':![],'where':{'id':_0x1db3d1['params']['id']},'include':[{'model':db[_0x1ebb('0x3f')],'as':_0x1ebb('0x57')}]},_0x2787f7={};_0x2787f7['model']=_[_0x1ebb('0x45')](db['OpenchannelAccount']['rawAttributes']);_0x2787f7['query']=_[_0x1ebb('0x45')](_0x1db3d1[_0x1ebb('0x46')]);_0x2787f7[_0x1ebb('0x58')]=_[_0x1ebb('0x47')](_0x2787f7[_0x1ebb('0x44')],_0x2787f7[_0x1ebb('0x46')]);_0x553f8d[_0x1ebb('0x48')]=_[_0x1ebb('0x47')](_0x2787f7[_0x1ebb('0x44')],qs[_0x1ebb('0x49')](_0x1db3d1[_0x1ebb('0x46')][_0x1ebb('0x49')]));_0x553f8d['attributes']=_0x553f8d[_0x1ebb('0x48')][_0x1ebb('0x4a')]?_0x553f8d[_0x1ebb('0x48')]:_0x2787f7[_0x1ebb('0x44')];if(_0x1db3d1['query'][_0x1ebb('0x53')]){_0x553f8d[_0x1ebb('0x54')]=[{'all':!![]}];}_0x553f8d=_[_0x1ebb('0x4f')]({},_0x553f8d,_0x1db3d1[_0x1ebb('0x52')]);return db[_0x1ebb('0x41')][_0x1ebb('0x59')](_0x553f8d)[_0x1ebb('0x21')](handleEntityNotFound(_0x1bccbc,null))[_0x1ebb('0x21')](respondWithResult(_0x1bccbc,null))[_0x1ebb('0x2a')](handleError(_0x1bccbc,null));};exports['create']=function(_0x5a12af,_0x40b5a6){return db[_0x1ebb('0x41')][_0x1ebb('0x5a')](_0x5a12af[_0x1ebb('0x5b')],{})[_0x1ebb('0x21')](function(_0x28ed90){var _0xd5d209=_0x5a12af[_0x1ebb('0x5c')][_0x1ebb('0x39')]({'plain':!![]});if(!_0xd5d209)throw new Error(_0x1ebb('0x5d'));if(_0xd5d209['role']===_0x1ebb('0x5c')){var _0x3ba60e=_0x28ed90[_0x1ebb('0x39')]({'plain':!![]});var _0x3d68b6='OpenchannelAccounts';return db[_0x1ebb('0x5e')][_0x1ebb('0x59')]({'where':{'name':_0x3d68b6,'userProfileId':_0xd5d209[_0x1ebb('0x5f')]},'raw':!![]})[_0x1ebb('0x21')](function(_0x5d78ff){if(_0x5d78ff&&_0x5d78ff['autoAssociation']===0x0){return db[_0x1ebb('0x60')]['create']({'name':_0x3ba60e[_0x1ebb('0x3c')],'resourceId':_0x3ba60e['id'],'type':_0x5d78ff[_0x1ebb('0x3c')],'sectionId':_0x5d78ff['id']},{})[_0x1ebb('0x21')](function(){return _0x28ed90;});}else{return _0x28ed90;}})['catch'](function(_0x1aa2d3){logger[_0x1ebb('0x26')](_0x1ebb('0x61'),_0x1aa2d3);throw _0x1aa2d3;});}return _0x28ed90;})['then'](respondWithResult(_0x40b5a6,0xc9))[_0x1ebb('0x2a')](handleError(_0x40b5a6,null));};exports[_0x1ebb('0x37')]=function(_0x5db90a,_0x3efad5){if(_0x5db90a[_0x1ebb('0x5b')]['id']){delete _0x5db90a[_0x1ebb('0x5b')]['id'];}return db[_0x1ebb('0x41')][_0x1ebb('0x59')]({'where':{'id':_0x5db90a[_0x1ebb('0x62')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3efad5,null))[_0x1ebb('0x21')](saveUpdates(_0x5db90a[_0x1ebb('0x5b')],null))[_0x1ebb('0x21')](respondWithResult(_0x3efad5,null))[_0x1ebb('0x2a')](handleError(_0x3efad5,null));};exports['destroy']=function(_0x3d5280,_0x4be08d){return db['OpenchannelAccount']['find']({'where':{'id':_0x3d5280[_0x1ebb('0x62')]['id']}})['then'](handleEntityNotFound(_0x4be08d,null))[_0x1ebb('0x21')](removeEntity(_0x4be08d,null))[_0x1ebb('0x2a')](handleError(_0x4be08d,null));};exports[_0x1ebb('0x63')]=function(_0x314efa,_0x3de97d){return db[_0x1ebb('0x41')][_0x1ebb('0x63')]()[_0x1ebb('0x21')](respondWithResult(_0x3de97d,null))['catch'](handleError(_0x3de97d,null));};exports[_0x1ebb('0x64')]=function(_0x2d5371,_0x1b1f46,_0x399b5f){if(_0x2d5371[_0x1ebb('0x5b')]['id']){delete _0x2d5371[_0x1ebb('0x5b')]['id'];}return db[_0x1ebb('0x41')][_0x1ebb('0x59')]({'where':{'id':_0x2d5371[_0x1ebb('0x62')]['id']}})[_0x1ebb('0x21')](handleEntityNotFound(_0x1b1f46,null))[_0x1ebb('0x21')](function(_0x493b61){if(_0x493b61){_0x2d5371[_0x1ebb('0x5b')][_0x1ebb('0x65')]=_0x493b61['id'];return db[_0x1ebb('0x66')][_0x1ebb('0x5a')](_0x2d5371[_0x1ebb('0x5b')]);}})[_0x1ebb('0x21')](respondWithResult(_0x1b1f46,null))[_0x1ebb('0x2a')](handleError(_0x1b1f46,null));};exports[_0x1ebb('0x67')]=function(_0x163763,_0x3b7181,_0x597669){var _0x5dce55={'raw':![],'where':{}};var _0x273232={};var _0x24e7dd={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x163763[_0x1ebb('0x62')]['id']}})[_0x1ebb('0x21')](handleEntityNotFound(_0x3b7181,null))['then'](function(_0x30588b){if(_0x30588b){_0x273232[_0x1ebb('0x44')]=_[_0x1ebb('0x45')](db[_0x1ebb('0x66')][_0x1ebb('0x42')]);_0x273232[_0x1ebb('0x46')]=_['keys'](_0x163763[_0x1ebb('0x46')]);_0x273232[_0x1ebb('0x58')]=_[_0x1ebb('0x47')](_0x273232['model'],_0x273232['query']);_0x5dce55[_0x1ebb('0x48')]=_[_0x1ebb('0x47')](_0x273232[_0x1ebb('0x44')],qs[_0x1ebb('0x49')](_0x163763[_0x1ebb('0x46')][_0x1ebb('0x49')]));_0x5dce55['attributes']=_0x5dce55[_0x1ebb('0x48')][_0x1ebb('0x4a')]?_0x5dce55['attributes']:_0x273232[_0x1ebb('0x44')];if(!_0x163763[_0x1ebb('0x46')]['hasOwnProperty'](_0x1ebb('0x4b'))){_0x5dce55['limit']=qs[_0x1ebb('0x2f')](_0x163763[_0x1ebb('0x46')][_0x1ebb('0x2f')]);_0x5dce55[_0x1ebb('0x2e')]=qs[_0x1ebb('0x2e')](_0x163763['query'][_0x1ebb('0x2e')]);}_0x5dce55[_0x1ebb('0x4c')]=qs[_0x1ebb('0x4d')](_0x163763['query'][_0x1ebb('0x4d')]);_0x5dce55[_0x1ebb('0x4e')]=qs['filters'](_[_0x1ebb('0x68')](_0x163763[_0x1ebb('0x46')],_0x273232[_0x1ebb('0x58')]));_0x5dce55[_0x1ebb('0x4e')][_0x1ebb('0x65')]=_0x30588b['id'];if(_0x163763['query'][_0x1ebb('0x51')]){_0x5dce55[_0x1ebb('0x4e')]=_[_0x1ebb('0x4f')](_0x5dce55[_0x1ebb('0x4e')],{'$or':_[_0x1ebb('0x40')](_0x5dce55[_0x1ebb('0x48')],function(_0x3e0caa){var _0x4c657c={};_0x4c657c[_0x3e0caa]={'$like':'%'+_0x163763['query'][_0x1ebb('0x51')]+'%'};return _0x4c657c;})});}_0x5dce55=_[_0x1ebb('0x4f')]({},_0x5dce55,_0x163763[_0x1ebb('0x52')]);return db[_0x1ebb('0x66')][_0x1ebb('0x31')]({'where':_0x5dce55[_0x1ebb('0x4e')]})['then'](function(_0x272bf5){_0x24e7dd[_0x1ebb('0x31')]=_0x272bf5;if(_0x163763[_0x1ebb('0x46')][_0x1ebb('0x53')]){_0x5dce55[_0x1ebb('0x54')]=[{'all':!![]}];}return db[_0x1ebb('0x66')][_0x1ebb('0x55')](_0x5dce55);})[_0x1ebb('0x21')](function(_0x2dfc42){_0x24e7dd[_0x1ebb('0x56')]=_0x2dfc42;return _0x24e7dd;});}})[_0x1ebb('0x21')](respondWithFilteredResult(_0x3b7181,_0x5dce55))[_0x1ebb('0x2a')](handleError(_0x3b7181,null));};exports[_0x1ebb('0x69')]=function(_0x351478,_0x3f507f,_0x23a27c){return db[_0x1ebb('0x41')][_0x1ebb('0x59')]({'where':{'id':_0x351478[_0x1ebb('0x62')]['id']}})[_0x1ebb('0x21')](handleEntityNotFound(_0x3f507f,null))[_0x1ebb('0x21')](function(_0x50982b){if(_0x50982b){return _0x50982b['removeDispositions'](_0x351478['query']['ids']);}})[_0x1ebb('0x21')](respondWithStatusCode(_0x3f507f,null))[_0x1ebb('0x2a')](handleError(_0x3f507f,null));};exports['addAnswer']=function(_0x21a573,_0x9b2e9f,_0x56b003){if(_0x21a573[_0x1ebb('0x5b')]['id']){delete _0x21a573[_0x1ebb('0x5b')]['id'];}return db['OpenchannelAccount'][_0x1ebb('0x59')]({'where':{'id':_0x21a573[_0x1ebb('0x62')]['id']}})['then'](handleEntityNotFound(_0x9b2e9f,null))[_0x1ebb('0x21')](function(_0x488134){if(_0x488134){_0x21a573[_0x1ebb('0x5b')]['OpenchannelAccountId']=_0x488134['id'];return db[_0x1ebb('0x6a')][_0x1ebb('0x5a')](_0x21a573[_0x1ebb('0x5b')]);}})['then'](respondWithResult(_0x9b2e9f,null))[_0x1ebb('0x2a')](handleError(_0x9b2e9f,null));};exports[_0x1ebb('0x6b')]=function(_0x4c6982,_0x321317,_0x9936b2){var _0x4e11b3={'raw':![],'where':{}};var _0x26036b={};var _0x223b23={'count':0x0,'rows':[]};return db[_0x1ebb('0x41')][_0x1ebb('0x6c')]({'where':{'id':_0x4c6982[_0x1ebb('0x62')]['id']}})[_0x1ebb('0x21')](handleEntityNotFound(_0x321317,null))[_0x1ebb('0x21')](function(_0x50e45d){if(_0x50e45d){_0x26036b[_0x1ebb('0x44')]=_[_0x1ebb('0x45')](db[_0x1ebb('0x6a')][_0x1ebb('0x42')]);_0x26036b[_0x1ebb('0x46')]=_[_0x1ebb('0x45')](_0x4c6982['query']);_0x26036b[_0x1ebb('0x58')]=_[_0x1ebb('0x47')](_0x26036b[_0x1ebb('0x44')],_0x26036b['query']);_0x4e11b3['attributes']=_[_0x1ebb('0x47')](_0x26036b[_0x1ebb('0x44')],qs[_0x1ebb('0x49')](_0x4c6982[_0x1ebb('0x46')][_0x1ebb('0x49')]));_0x4e11b3['attributes']=_0x4e11b3[_0x1ebb('0x48')][_0x1ebb('0x4a')]?_0x4e11b3['attributes']:_0x26036b[_0x1ebb('0x44')];if(!_0x4c6982['query'][_0x1ebb('0x6d')](_0x1ebb('0x4b'))){_0x4e11b3[_0x1ebb('0x2f')]=qs['limit'](_0x4c6982['query'][_0x1ebb('0x2f')]);_0x4e11b3[_0x1ebb('0x2e')]=qs['offset'](_0x4c6982[_0x1ebb('0x46')][_0x1ebb('0x2e')]);}_0x4e11b3['order']=qs[_0x1ebb('0x4d')](_0x4c6982[_0x1ebb('0x46')][_0x1ebb('0x4d')]);_0x4e11b3[_0x1ebb('0x4e')]=qs[_0x1ebb('0x58')](_[_0x1ebb('0x68')](_0x4c6982['query'],_0x26036b[_0x1ebb('0x58')]));_0x4e11b3[_0x1ebb('0x4e')]['OpenchannelAccountId']=_0x50e45d['id'];if(_0x4c6982['query']['filter']){_0x4e11b3[_0x1ebb('0x4e')]=_[_0x1ebb('0x4f')](_0x4e11b3[_0x1ebb('0x4e')],{'$or':_[_0x1ebb('0x40')](_0x4e11b3[_0x1ebb('0x48')],function(_0x2b0f51){var _0x1f52ef={};_0x1f52ef[_0x2b0f51]={'$like':'%'+_0x4c6982['query'][_0x1ebb('0x51')]+'%'};return _0x1f52ef;})});}_0x4e11b3=_[_0x1ebb('0x4f')]({},_0x4e11b3,_0x4c6982[_0x1ebb('0x52')]);return db[_0x1ebb('0x6a')]['count']({'where':_0x4e11b3[_0x1ebb('0x4e')]})[_0x1ebb('0x21')](function(_0x284275){_0x223b23[_0x1ebb('0x31')]=_0x284275;if(_0x4c6982['query'][_0x1ebb('0x53')]){_0x4e11b3[_0x1ebb('0x54')]=[{'all':!![]}];}return db[_0x1ebb('0x6a')]['findAll'](_0x4e11b3);})['then'](function(_0x21dae0){_0x223b23['rows']=_0x21dae0;return _0x223b23;});}})[_0x1ebb('0x21')](respondWithFilteredResult(_0x321317,_0x4e11b3))[_0x1ebb('0x2a')](handleError(_0x321317,null));};exports[_0x1ebb('0x6e')]=function(_0x2e9a94,_0x17b663,_0x3d5c00){return db[_0x1ebb('0x41')]['find']({'where':{'id':_0x2e9a94['params']['id']}})[_0x1ebb('0x21')](handleEntityNotFound(_0x17b663,null))[_0x1ebb('0x21')](function(_0x54b132){if(_0x54b132){return _0x54b132[_0x1ebb('0x6e')](_0x2e9a94[_0x1ebb('0x46')][_0x1ebb('0x6f')]);}})[_0x1ebb('0x21')](respondWithStatusCode(_0x17b663,null))[_0x1ebb('0x2a')](handleError(_0x17b663,null));};exports[_0x1ebb('0x70')]=function(_0x1ee4c8,_0x432e03,_0x22be5c){var _0x3cbe08={'body':_0x1ee4c8[_0x1ebb('0x5b')],'channel':_0x1ebb('0x71')};var _0x477af8=[];var _0xdc56b3=[];var _0x2c7b3a={};var _0x3a4abf=![];return db[_0x1ebb('0x72')][_0x1ebb('0x63')]()[_0x1ebb('0x21')](function(_0x44f2fc){if(!_0x44f2fc){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x477af8=_[_0x1ebb('0x73')](_[_0x1ebb('0x45')](_0x44f2fc),[_0x1ebb('0x74'),_0x1ebb('0x75')]);_0xdc56b3=_['difference'](_[_0x1ebb('0x45')](_0x44f2fc),['createdAt',_0x1ebb('0x75'),_0x1ebb('0x76'),'ListId']);if(_0x1ee4c8[_0x1ebb('0x5b')]['id']){delete _0x1ee4c8[_0x1ebb('0x5b')]['id'];}if(_[_0x1ebb('0x77')](_0x1ee4c8[_0x1ebb('0x5b')]['from'])){throw new db[(_0x1ebb('0x78'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x1ebb('0x77')](_0x1ee4c8['body'][_0x1ebb('0x5b')])||_0x1ee4c8[_0x1ebb('0x5b')][_0x1ebb('0x5b')]===''){throw new db['Sequelize'][(_0x1ebb('0x79'))](_0x1ebb('0x7a'));}if(_[_0x1ebb('0x77')](_0x1ee4c8[_0x1ebb('0x5b')][_0x1ebb('0x7b')])){throw new db[(_0x1ebb('0x78'))][(_0x1ebb('0x79'))](_0x1ebb('0x7c')+_0xdc56b3);}if(!_[_0x1ebb('0x7d')](_0xdc56b3,_0x1ee4c8[_0x1ebb('0x5b')]['mapKey'])){throw new db['Sequelize'][(_0x1ebb('0x79'))](_0x1ebb('0x7e')+_0xdc56b3);}_0x2c7b3a[_0x1ee4c8[_0x1ebb('0x5b')][_0x1ebb('0x7b')]]=_0x1ee4c8[_0x1ebb('0x5b')][_0x1ebb('0x7f')];})[_0x1ebb('0x21')](function(){return db[_0x1ebb('0x41')][_0x1ebb('0x59')]({'where':{'id':_0x1ee4c8[_0x1ebb('0x62')]['id']},'include':[{'model':db[_0x1ebb('0x80')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2c7b3a,'limit':0x1,'order':[[_0x1ebb('0x75'),'DESC']]}]},{'model':db[_0x1ebb('0x81')],'as':_0x1ebb('0x82')}]});})[_0x1ebb('0x21')](handleEntityNotFound(_0x432e03,null))['then'](function(_0x575b60){if(_0x575b60&&_0x575b60[_0x1ebb('0x83')]){_0x3cbe08['account']=_0x575b60;_0x3cbe08[_0x1ebb('0x84')]=_0x575b60[_0x1ebb('0x82')];_0x3cbe08[_0x1ebb('0x85')]=_0x575b60[_0x1ebb('0x83')];_0x3cbe08['applications']=_[_0x1ebb('0x86')](_0x3cbe08[_0x1ebb('0x84')],['priority'],[_0x1ebb('0x87')]);if(_0x3cbe08['account'][_0x1ebb('0x82')]){delete _0x3cbe08['account'][_0x1ebb('0x82')];}if(_0x3cbe08['account'][_0x1ebb('0x83')]&&_0x3cbe08[_0x1ebb('0x88')][_0x1ebb('0x83')]['Contacts'][_0x1ebb('0x4a')]){return _0x3cbe08['account'][_0x1ebb('0x83')][_0x1ebb('0x89')][0x0];}var _0x2dca41=_['defaults'](_0x1ee4c8[_0x1ebb('0x5b')],{'firstName':_0x1ee4c8[_0x1ebb('0x5b')][_0x1ebb('0x7f')],'ListId':_0x575b60[_0x1ebb('0x8a')]});_0x2dca41[_0x1ee4c8['body'][_0x1ebb('0x7b')]]=_0x1ee4c8[_0x1ebb('0x5b')][_0x1ebb('0x7f')];return db[_0x1ebb('0x72')][_0x1ebb('0x5a')](_0x2dca41,{'fields':_0x477af8,'raw':!![]});}})[_0x1ebb('0x21')](handleEntityNotFound(_0x432e03,null))['then'](function(_0x2a4d2d){_0x3cbe08['contact']=_0x2a4d2d;if(_0x2a4d2d){var _0x76d8fc={'ContactId':_0x2a4d2d['id'],'OpenchannelAccountId':_0x1ee4c8[_0x1ebb('0x62')]['id'],'from':(_0x2a4d2d[_0x1ebb('0x8b')]||'')+'\x20'+(_0x2a4d2d[_0x1ebb('0x8c')]||'')};var _0x67c0b={'OpenchannelAccountId':_0x1ee4c8[_0x1ebb('0x62')]['id'],'closed':![]};if(_0x1ee4c8[_0x1ebb('0x5b')][_0x1ebb('0x8d')]){_0x67c0b[_0x1ebb('0x8d')]=_0x1ee4c8[_0x1ebb('0x5b')]['threadId'];return db[_0x1ebb('0x8e')]['find']({'where':_0x67c0b})[_0x1ebb('0x21')](function(_0x2c167d){if(_0x2c167d){return[_0x2c167d,![]];}_0x76d8fc[_0x1ebb('0x8d')]=_0x1ee4c8[_0x1ebb('0x5b')][_0x1ebb('0x8d')];_0x76d8fc[_0x1ebb('0x8f')]=_0x1ee4c8[_0x1ebb('0x5b')][_0x1ebb('0x8f')];return db[_0x1ebb('0x8e')][_0x1ebb('0x5a')](_0x76d8fc)[_0x1ebb('0x21')](function(_0x4d181b){return[_0x4d181b,!![]];});});}else{_0x67c0b[_0x1ebb('0x8d')]=null;}_0x67c0b[_0x1ebb('0x90')]=_0x2a4d2d['id'];return db[_0x1ebb('0x8e')][_0x1ebb('0x59')]({'where':_0x67c0b})[_0x1ebb('0x21')](function(_0x44f33f){if(_0x44f33f){return[_0x44f33f,![]];}return db['OpenchannelInteraction']['create'](_0x76d8fc)[_0x1ebb('0x21')](function(_0x21ca44){return[_0x21ca44,!![]];});});}})['spread'](function(_0x5551b5,_0x5e45da){if(_0x5551b5){_0x3a4abf=_0x5e45da;if(!_0x5e45da){var _0x8a5786={'from':(_0x3cbe08[_0x1ebb('0x91')][_0x1ebb('0x8b')]||'')+'\x20'+(_0x3cbe08[_0x1ebb('0x91')][_0x1ebb('0x8c')]||'')};if(_0x1ee4c8['body'][_0x1ebb('0x8d')]&&_0x1ee4c8['body'][_0x1ebb('0x92')]&&_0x1ee4c8[_0x1ebb('0x5b')][_0x1ebb('0x8d')]!=_0x1ee4c8[_0x1ebb('0x5b')][_0x1ebb('0x92')]){_0x8a5786[_0x1ebb('0x8d')]=_0x1ee4c8[_0x1ebb('0x5b')][_0x1ebb('0x92')];}return _0x5551b5[_0x1ebb('0x37')](_0x8a5786);}else{return _0x5551b5;}}})[_0x1ebb('0x21')](function(_0x4fac51){_0x3cbe08['interaction']=_0x4fac51[_0x1ebb('0x39')]({'plain':!![]});_0x3cbe08[_0x1ebb('0x93')][_0x1ebb('0x94')]=_0x3a4abf;if(_0x3cbe08[_0x1ebb('0x93')][_0x1ebb('0x94')]){if(_0x3cbe08[_0x1ebb('0x88')][_0x1ebb('0x95')]){_0x3cbe08[_0x1ebb('0x84')][_0x1ebb('0x96')]({'id':0x0,'priority':_0x3cbe08['applications']['length']+0x1,'app':_0x1ebb('0x97'),'appdata':_0x1ebb('0x98'),'interval':_0x1ebb('0x99')});}}return db[_0x1ebb('0x9a')][_0x1ebb('0x5a')]({'body':_0x1ee4c8['body'][_0x1ebb('0x5b')],'OpenchannelAccountId':_0x1ee4c8[_0x1ebb('0x62')]['id'],'OpenchannelInteractionId':_0x4fac51['id'],'direction':'in','ContactId':_0x3cbe08[_0x1ebb('0x91')]['id'],'AttachmentId':_0x1ee4c8['body'][_0x1ebb('0x9b')]});})[_0x1ebb('0x21')](function(_0x2ca20c){_0x3cbe08[_0x1ebb('0x27')]=_0x2ca20c;if(_0x3cbe08[_0x1ebb('0x93')]['UserId']){return db[_0x1ebb('0x9c')][_0x1ebb('0x59')]({'attributes':['id',_0x1ebb('0x3c')],'where':{'id':_0x3cbe08['interaction'][_0x1ebb('0x9d')]}})['then'](function(_0x353da8){if(_0x353da8){_0x3cbe08[_0x1ebb('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1ebb('0x9e'),'appdata':_0x353da8[_0x1ebb('0x3c')]+','+(_0x3cbe08['account'][_0x1ebb('0x9f')]||0xa),'interval':'*,*,*,*'});_0x3cbe08['forcedOwnership']=![];}return respondWithRpcPromise(_0x1ebb('0xa0'),_0x1ebb('0xa1'),_0x3cbe08);});}return respondWithRpcPromise(_0x1ebb('0xa0'),_0x1ebb('0xa1'),_0x3cbe08);})['then'](function(_0xcc16dd){respondWithRpcPromise('EventManager',_0x1ebb('0xa2'),{'event':'notify','message':_0xcc16dd},client9002);return _0xcc16dd;})['then'](respondWithResult(_0x432e03,null))[_0x1ebb('0x2a')](handleError(_0x432e03,null));};exports['addApplications']=function(_0x148e29,_0x5d06a3,_0x59469a){return db[_0x1ebb('0x41')][_0x1ebb('0x6c')]({'where':{'id':_0x148e29[_0x1ebb('0x62')]['id']}})[_0x1ebb('0x21')](handleEntityNotFound(_0x5d06a3,null))[_0x1ebb('0x21')](function(_0x47e0b8){if(_0x47e0b8){return db[_0x1ebb('0xa3')][_0x1ebb('0xa4')](function(_0x47b4b9){return db[_0x1ebb('0x81')][_0x1ebb('0x38')]({'where':{'OpenchannelAccountId':_0x148e29['params']['id']},'transaction':_0x47b4b9})['then'](function(_0x2efcc2){var _0xbdcb26=_['map'](_0x148e29[_0x1ebb('0x5b')],function(_0x36201e){_0x36201e[_0x1ebb('0x65')]=_0x148e29['params']['id'];return _0x36201e;});return db['OpenchannelApplication']['bulkCreate'](_0xbdcb26,{'transaction':_0x47b4b9});});})['then'](function(){return db[_0x1ebb('0x81')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x148e29['params']['id']},'order':_0x1ebb('0xa5')});});}})['then'](respondWithResult(_0x5d06a3,null))[_0x1ebb('0x2a')](handleError(_0x5d06a3,null));};exports['getApplications']=function(_0x189cb6,_0x5f5aa6,_0x56d592){var _0x2a9280={};var _0x542673={};var _0x59f1e3;var _0x2ff9da;return db['OpenchannelAccount'][_0x1ebb('0x6c')]({'where':{'id':_0x189cb6[_0x1ebb('0x62')]['id']}})[_0x1ebb('0x21')](handleEntityNotFound(_0x5f5aa6,null))[_0x1ebb('0x21')](function(_0x23b460){if(_0x23b460){_0x59f1e3=_0x23b460;_0x542673[_0x1ebb('0x44')]=_['keys'](db[_0x1ebb('0x81')][_0x1ebb('0x42')]);_0x542673[_0x1ebb('0x46')]=_[_0x1ebb('0x45')](_0x189cb6['query']);_0x542673[_0x1ebb('0x58')]=_[_0x1ebb('0x47')](_0x542673[_0x1ebb('0x44')],_0x542673['query']);_0x2a9280[_0x1ebb('0x48')]=_['intersection'](_0x542673['model'],qs[_0x1ebb('0x49')](_0x189cb6['query']['fields']));_0x2a9280[_0x1ebb('0x48')]=_0x2a9280[_0x1ebb('0x48')][_0x1ebb('0x4a')]?_0x2a9280[_0x1ebb('0x48')]:_0x542673[_0x1ebb('0x44')];_0x2a9280[_0x1ebb('0x4c')]=qs[_0x1ebb('0x4d')](_0x189cb6[_0x1ebb('0x46')][_0x1ebb('0x4d')]);_0x2a9280[_0x1ebb('0x4e')]=qs[_0x1ebb('0x58')](_[_0x1ebb('0x68')](_0x189cb6['query'],_0x542673[_0x1ebb('0x58')]));if(_0x189cb6['query'][_0x1ebb('0x51')]){_0x2a9280[_0x1ebb('0x4e')]=_[_0x1ebb('0x4f')](_0x2a9280['where'],{'$or':_[_0x1ebb('0x40')](_0x2a9280[_0x1ebb('0x48')],function(_0x3836b9){var _0x5979c1={};_0x5979c1[_0x3836b9]={'$like':'%'+_0x189cb6[_0x1ebb('0x46')][_0x1ebb('0x51')]+'%'};return _0x5979c1;})});}_0x2a9280=_[_0x1ebb('0x4f')]({},_0x2a9280,_0x189cb6[_0x1ebb('0x52')]);return _0x59f1e3[_0x1ebb('0xa6')](_0x2a9280);}})['then'](function(_0x2383cb){if(_0x2383cb){_0x2ff9da=_0x2383cb[_0x1ebb('0x4a')];if(!_0x189cb6['query'][_0x1ebb('0x6d')](_0x1ebb('0x4b'))){_0x2a9280[_0x1ebb('0x2f')]=qs[_0x1ebb('0x2f')](_0x189cb6[_0x1ebb('0x46')]['limit']);_0x2a9280[_0x1ebb('0x2e')]=qs['offset'](_0x189cb6[_0x1ebb('0x46')]['offset']);}return _0x59f1e3[_0x1ebb('0xa6')](_0x2a9280);}})['then'](function(_0x3c27c2){if(_0x3c27c2){return _0x3c27c2?{'count':_0x2ff9da,'rows':_0x3c27c2}:null;}})[_0x1ebb('0x21')](respondWithResult(_0x5f5aa6,null))[_0x1ebb('0x2a')](handleError(_0x5f5aa6,null));};exports[_0x1ebb('0xa7')]=function(_0x4f0469,_0x4efa6b,_0x1993e8){var _0x8fbd42={'raw':![],'where':{}};var _0xa4166={};var _0x42c194={'count':0x0,'rows':[]};return db[_0x1ebb('0x41')][_0x1ebb('0x6c')]({'where':{'id':_0x4f0469[_0x1ebb('0x62')]['id']}})[_0x1ebb('0x21')](handleEntityNotFound(_0x4efa6b,null))['then'](function(_0xc1c0df){if(_0xc1c0df){_0xa4166[_0x1ebb('0x44')]=_['keys'](db['OpenchannelInteraction'][_0x1ebb('0x42')]);_0xa4166[_0x1ebb('0x46')]=_[_0x1ebb('0x45')](_0x4f0469[_0x1ebb('0x46')]);_0xa4166[_0x1ebb('0x58')]=_[_0x1ebb('0x47')](_0xa4166[_0x1ebb('0x44')],_0xa4166[_0x1ebb('0x46')]);_0x8fbd42[_0x1ebb('0x48')]=_[_0x1ebb('0x47')](_0xa4166[_0x1ebb('0x44')],qs[_0x1ebb('0x49')](_0x4f0469[_0x1ebb('0x46')][_0x1ebb('0x49')]));_0x8fbd42[_0x1ebb('0x48')]=_0x8fbd42[_0x1ebb('0x48')][_0x1ebb('0x4a')]?_0x8fbd42[_0x1ebb('0x48')]:_0xa4166[_0x1ebb('0x44')];if(!_0x4f0469['query'][_0x1ebb('0x6d')](_0x1ebb('0x4b'))){_0x8fbd42[_0x1ebb('0x2f')]=qs['limit'](_0x4f0469[_0x1ebb('0x46')][_0x1ebb('0x2f')]);_0x8fbd42[_0x1ebb('0x2e')]=qs[_0x1ebb('0x2e')](_0x4f0469['query']['offset']);}_0x8fbd42[_0x1ebb('0x4c')]=qs[_0x1ebb('0x4d')](_0x4f0469[_0x1ebb('0x46')][_0x1ebb('0x4d')]);_0x8fbd42['where']=qs['filters'](_[_0x1ebb('0x68')](_0x4f0469[_0x1ebb('0x46')],_0xa4166['filters']));_0x8fbd42[_0x1ebb('0x4e')][_0x1ebb('0x65')]=_0xc1c0df['id'];if(_0x4f0469['query'][_0x1ebb('0x51')]){_0x8fbd42['where']=_['merge'](_0x8fbd42[_0x1ebb('0x4e')],{'$or':_['map'](_0x8fbd42[_0x1ebb('0x48')],function(_0x5760fe){var _0x30a059={};_0x30a059[_0x5760fe]={'$like':'%'+_0x4f0469[_0x1ebb('0x46')][_0x1ebb('0x51')]+'%'};return _0x30a059;})});}_0x8fbd42=_[_0x1ebb('0x4f')]({},_0x8fbd42,_0x4f0469[_0x1ebb('0x52')]);return db[_0x1ebb('0x8e')][_0x1ebb('0x31')]({'where':_0x8fbd42[_0x1ebb('0x4e')]})[_0x1ebb('0x21')](function(_0x4de5f3){_0x42c194[_0x1ebb('0x31')]=_0x4de5f3;if(_0x4f0469[_0x1ebb('0x46')]['includeAll']){_0x8fbd42['include']=[{'model':db['CmContact'],'as':_0x1ebb('0xa8'),'required':![]},{'model':db[_0x1ebb('0x9c')],'as':'Owner','attributes':[_0x1ebb('0x3c'),_0x1ebb('0xa9'),_0x1ebb('0xaa')],'required':![]},{'model':db['Tag'],'as':_0x1ebb('0xab'),'attributes':['id',_0x1ebb('0x3c'),_0x1ebb('0xac')],'where':_0x4f0469[_0x1ebb('0x46')]['tag']?{'id':_0x4f0469[_0x1ebb('0x46')][_0x1ebb('0xad')]}:undefined,'required':_0x4f0469[_0x1ebb('0x46')]['tag']?!![]:![]}];}return db[_0x1ebb('0x8e')][_0x1ebb('0x55')](_0x8fbd42);})['then'](function(_0x2d279d){_0x42c194[_0x1ebb('0x56')]=_0x2d279d;return _0x42c194;});}})[_0x1ebb('0x21')](respondWithFilteredResult(_0x4efa6b,_0x8fbd42))['catch'](handleError(_0x4efa6b,null));};exports[_0x1ebb('0xae')]=function(_0x2e4911,_0x5684f9,_0x2cbad4){return db[_0x1ebb('0x41')]['find']({'where':{'id':_0x2e4911[_0x1ebb('0x62')]['id']}})[_0x1ebb('0x21')](handleEntityNotFound(_0x5684f9,null))[_0x1ebb('0x21')](function(_0x504e91){if(_0x504e91){return _0x504e91[_0x1ebb('0xae')](_0x2e4911[_0x1ebb('0x5b')][_0x1ebb('0x6f')],_['omit'](_0x2e4911[_0x1ebb('0x5b')],[_0x1ebb('0x6f'),'id'])||{})['spread'](function(_0x3e6083){for(var _0x561d6f=0x0;_0x561d6f<_0x2e4911[_0x1ebb('0x5b')][_0x1ebb('0x6f')][_0x1ebb('0x4a')];_0x561d6f+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x2e4911[_0x1ebb('0x5b')]['ids'][_0x561d6f]),'OpenchannelAccountId':Number(_0x2e4911[_0x1ebb('0x62')]['id'])});}return _0x3e6083;});}})[_0x1ebb('0x21')](respondWithResult(_0x5684f9,null))[_0x1ebb('0x2a')](handleError(_0x5684f9,null));};exports[_0x1ebb('0xaf')]=function(_0x561f4b,_0x3c5c6e,_0x33a607){return db['OpenchannelAccount']['find']({'where':{'id':_0x561f4b[_0x1ebb('0x62')]['id']}})['then'](handleEntityNotFound(_0x3c5c6e,null))[_0x1ebb('0x21')](function(_0x3e4c3f){if(_0x3e4c3f){return _0x3e4c3f[_0x1ebb('0xaf')](_0x561f4b[_0x1ebb('0x46')][_0x1ebb('0x6f')])['then'](function(){if(_['isArray'](_0x561f4b['query'][_0x1ebb('0x6f')])){for(var _0xfedaf0=0x0;_0xfedaf0<_0x561f4b[_0x1ebb('0x46')]['ids'][_0x1ebb('0x4a')];_0xfedaf0+=0x1){socket[_0x1ebb('0xb0')]('userOpenchannelAccount:remove',{'UserId':Number(_0x561f4b[_0x1ebb('0x46')]['ids'][_0xfedaf0]),'OpenchannelAccountId':Number(_0x561f4b[_0x1ebb('0x62')]['id'])});}}else{socket[_0x1ebb('0xb0')](_0x1ebb('0xb1'),{'UserId':Number(_0x561f4b[_0x1ebb('0x46')][_0x1ebb('0x6f')]),'OpenchannelAccountId':Number(_0x561f4b[_0x1ebb('0x62')]['id'])});}});}})[_0x1ebb('0x21')](respondWithStatusCode(_0x3c5c6e,null))[_0x1ebb('0x2a')](handleError(_0x3c5c6e,null));};exports['getAgents']=function(_0x7e9528,_0xba8a1a,_0x3f32ea){var _0x3a97ba={};var _0xb1bbb={};var _0x3c413c;var _0x4c4fe6;return db[_0x1ebb('0x41')]['findOne']({'where':{'id':_0x7e9528[_0x1ebb('0x62')]['id']}})['then'](handleEntityNotFound(_0xba8a1a,null))[_0x1ebb('0x21')](function(_0x59a6b5){if(_0x59a6b5){_0x3c413c=_0x59a6b5;_0xb1bbb[_0x1ebb('0x44')]=_[_0x1ebb('0x45')](db['User'][_0x1ebb('0x42')]);_0xb1bbb[_0x1ebb('0x46')]=_[_0x1ebb('0x45')](_0x7e9528[_0x1ebb('0x46')]);_0xb1bbb[_0x1ebb('0x58')]=_['intersection'](_0xb1bbb[_0x1ebb('0x44')],_0xb1bbb[_0x1ebb('0x46')]);_0x3a97ba[_0x1ebb('0x48')]=_[_0x1ebb('0x47')](_0xb1bbb['model'],qs[_0x1ebb('0x49')](_0x7e9528[_0x1ebb('0x46')][_0x1ebb('0x49')]));_0x3a97ba[_0x1ebb('0x48')]=_0x3a97ba['attributes'][_0x1ebb('0x4a')]?_0x3a97ba[_0x1ebb('0x48')]:_0xb1bbb[_0x1ebb('0x44')];_0x3a97ba[_0x1ebb('0x4c')]=qs[_0x1ebb('0x4d')](_0x7e9528['query'][_0x1ebb('0x4d')]);_0x3a97ba[_0x1ebb('0x4e')]=qs[_0x1ebb('0x58')](_[_0x1ebb('0x68')](_0x7e9528[_0x1ebb('0x46')],_0xb1bbb[_0x1ebb('0x58')]));if(_0x7e9528[_0x1ebb('0x46')][_0x1ebb('0x51')]){_0x3a97ba[_0x1ebb('0x4e')]=_[_0x1ebb('0x4f')](_0x3a97ba[_0x1ebb('0x4e')],{'$or':_['map'](_0x3a97ba[_0x1ebb('0x48')],function(_0x85ab33){var _0x2ab5ee={};_0x2ab5ee[_0x85ab33]={'$like':'%'+_0x7e9528[_0x1ebb('0x46')]['filter']+'%'};return _0x2ab5ee;})});}_0x3a97ba=_[_0x1ebb('0x4f')]({},_0x3a97ba,_0x7e9528[_0x1ebb('0x52')]);return _0x3c413c[_0x1ebb('0xb2')](_0x3a97ba);}})[_0x1ebb('0x21')](function(_0x3fe141){if(_0x3fe141){_0x4c4fe6=_0x3fe141[_0x1ebb('0x4a')];if(!_0x7e9528[_0x1ebb('0x46')][_0x1ebb('0x6d')](_0x1ebb('0x4b'))){_0x3a97ba[_0x1ebb('0x2f')]=qs[_0x1ebb('0x2f')](_0x7e9528['query'][_0x1ebb('0x2f')]);_0x3a97ba[_0x1ebb('0x2e')]=qs[_0x1ebb('0x2e')](_0x7e9528[_0x1ebb('0x46')][_0x1ebb('0x2e')]);}return _0x3c413c[_0x1ebb('0xb2')](_0x3a97ba);}})[_0x1ebb('0x21')](function(_0xd439c){if(_0xd439c){return _0xd439c?{'count':_0x4c4fe6,'rows':_0xd439c}:null;}})['then'](respondWithResult(_0xba8a1a,null))['catch'](handleError(_0xba8a1a,null));};exports[_0x1ebb('0x3d')]=function(_0x51fedd,_0x36a9f0,_0x2459d0){var _0x5a2f0d,_0x435ccb,_0x29558a;if(_[_0x1ebb('0x77')](_0x51fedd[_0x1ebb('0x5b')][_0x1ebb('0x5b')])||_0x51fedd[_0x1ebb('0x5b')][_0x1ebb('0x5b')]===''){throw new db['Sequelize'][(_0x1ebb('0x79'))](_0x1ebb('0x7a'));}if(_['isNil'](_0x51fedd[_0x1ebb('0x5b')]['to'])){}_0x5a2f0d=_0x51fedd[_0x1ebb('0x5b')]['to'];return db[_0x1ebb('0x41')][_0x1ebb('0x6c')]({'where':{'id':_0x51fedd[_0x1ebb('0x62')]['id']}})[_0x1ebb('0x21')](handleEntityNotFound(_0x36a9f0,null))[_0x1ebb('0x21')](function(_0x530f73){if(_0x530f73){return db[_0x1ebb('0x41')][_0x1ebb('0x59')]({'where':{'id':_0x530f73['id']},'include':[{'model':db['CmList'],'as':_0x1ebb('0x83'),'include':[{'model':db[_0x1ebb('0x72')],'as':_0x1ebb('0x89'),'where':{[_0x530f73[_0x1ebb('0x7b')]]:_0x5a2f0d},'limit':0x1,'order':[['updatedAt',_0x1ebb('0xb3')]]}]}]})[_0x1ebb('0x21')](handleEntityNotFound(_0x36a9f0,null))[_0x1ebb('0x21')](function(_0x2ff5b4){if(_0x2ff5b4&&_0x2ff5b4[_0x1ebb('0x83')]){_0x435ccb=_0x2ff5b4[_0x1ebb('0x39')]({'plain':!![]});if(_0x435ccb[_0x1ebb('0x83')]&&_0x435ccb[_0x1ebb('0x83')][_0x1ebb('0x89')][_0x1ebb('0x4a')]){return _0x435ccb[_0x1ebb('0x83')]['Contacts'][0x0];}return db[_0x1ebb('0x72')][_0x1ebb('0x5a')](_['defaults'](_0x51fedd[_0x1ebb('0x5b')],{'firstName':_0x5a2f0d,[_0x2ff5b4['mapKey']]:_0x5a2f0d,'phone':_0x5a2f0d,'ListId':_0x435ccb[_0x1ebb('0x8a')]}));}})[_0x1ebb('0x21')](handleEntityNotFound(_0x36a9f0,null))[_0x1ebb('0x21')](function(_0x11c697){if(_0x11c697){_0x29558a=_0x11c697;return db[_0x1ebb('0x8e')][_0x1ebb('0x59')]({'where':{'ContactId':_0x29558a['id'],'closed':![],'OpenchannelAccountId':_0x435ccb['id']}})[_0x1ebb('0x21')](function(_0x1df0d3){if(_0x1df0d3){return[_0x1df0d3,![]];}return db['OpenchannelInteraction'][_0x1ebb('0x5a')]({'UserId':_0x51fedd['user']['id'],'ContactId':_0x29558a['id'],'OpenchannelAccountId':_0x435ccb['id'],'lastMsgDirection':_0x1ebb('0xb4'),'Messages':[_['merge'](_0x51fedd[_0x1ebb('0x5b')],{'read':![],'body':_0x51fedd['body']['body'],'OpenchannelAccountId':_0x435ccb['id'],'UserId':_0x51fedd['user']['id'],'ContactId':_0x29558a['id']})]},{'include':[{'model':db[_0x1ebb('0x9a')],'as':_0x1ebb('0xb5')}]})[_0x1ebb('0x21')](function(_0x5d1f1f){return[_0x5d1f1f,!![]];});});}})[_0x1ebb('0xb6')](function(_0x116b07,_0xfa9934){if(_0xfa9934){return _0x116b07;}return db[_0x1ebb('0x9a')]['create'](_[_0x1ebb('0x4f')](_0x51fedd[_0x1ebb('0x5b')],{'read':![],'body':_0x51fedd['body'][_0x1ebb('0x5b')],'OpenchannelAccountId':_0x435ccb['id'],'OpenchannelInteractionId':_0x116b07['id'],'UserId':_0x51fedd[_0x1ebb('0x5c')]['id'],'ContactId':_0x29558a['id']}))[_0x1ebb('0x21')](function(_0x573b06){_0x116b07[_0x1ebb('0xb7')][_0x1ebb('0xb5')]=[];_0x116b07[_0x1ebb('0xb7')][_0x1ebb('0xb5')][_0x1ebb('0x96')](_0x573b06[_0x1ebb('0xb7')]);return _0x116b07;});});}})[_0x1ebb('0x21')](respondWithResult(_0x36a9f0,null))['catch'](handleError(_0x36a9f0,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ba1f1b5..1b5561b 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 _0xcb91=['save','update','emit','hasOwnProperty','hook','OpenchannelAccount','setMaxListeners'];(function(_0x58fdad,_0x46aa40){var _0x22f08d=function(_0x215220){while(--_0x215220){_0x58fdad['push'](_0x58fdad['shift']());}};_0x22f08d(++_0x46aa40);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0xcb91[_0x3f3f40];return _0x403b7a;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x1cb9('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){OpenchannelAccountEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);OpenchannelAccountEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];OpenchannelAccount[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xb903=['setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelAccount'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xb903,0x185));var _0x3b90=function(_0x3baa2f,_0xd85dd4){_0x3baa2f=_0x3baa2f-0x0;var _0x31c093=_0xb903[_0x3baa2f];return _0x31c093;};'use strict';var EventEmitter=require(_0x3b90('0x0'));var OpenchannelAccount=require(_0x3b90('0x1'))['db'][_0x3b90('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3b90('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b90('0x4'),'afterDestroy':_0x3b90('0x5')};function emitEvent(_0x3b024a){return function(_0x1cd5d8,_0x30d8db,_0x40f726){OpenchannelAccountEvents[_0x3b90('0x6')](_0x3b024a+':'+_0x1cd5d8['id'],_0x1cd5d8);OpenchannelAccountEvents['emit'](_0x3b024a,_0x1cd5d8);_0x40f726(null);};}for(var e in events){if(events[_0x3b90('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 5fcc13b..b04518d 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(_0x3d1a87,_0x1f3316){var _0x5eccc3=function(_0x18a68a){while(--_0x18a68a){_0x3d1a87['push'](_0x3d1a87['shift']());}};_0x5eccc3(++_0x1f3316);}(_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 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(_0x293ce8,_0x1f81c9){var _0x5c38ed=function(_0xab0a86){while(--_0xab0a86){_0x293ce8['push'](_0x293ce8['shift']());}};_0x5c38ed(++_0x1f81c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 faac8dd..93d41be 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 _0xaa5e=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xaa5e,0xa5));var _0xeaa5=function(_0xdf6c5,_0x351255){_0xdf6c5=_0xdf6c5-0x0;var _0x17209c=_0xaa5e[_0xdf6c5];return _0x17209c;};'use strict';var _=require(_0xeaa5('0x0'));var util=require(_0xeaa5('0x1'));var moment=require('moment');var BPromise=require(_0xeaa5('0x2'));var rs=require(_0xeaa5('0x3'));var fs=require('fs');var Redis=require(_0xeaa5('0x4'));var db=require(_0xeaa5('0x5'))['db'];var utils=require(_0xeaa5('0x6'));var logger=require('../../config/logger')(_0xeaa5('0x7'));var config=require(_0xeaa5('0x8'));var jayson=require(_0xeaa5('0x9'));var client=jayson[_0xeaa5('0xa')]['http']({'port':0x232a});config['redis']=_[_0xeaa5('0xb')](config[_0xeaa5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xeaa5('0xd'))(new Redis(config[_0xeaa5('0xc')]));require('./openchannelAccount.socket')[_0xeaa5('0xe')](socket);function respondWithRpcPromise(_0x49682b,_0x2f5750,_0x3552ac){return new BPromise(function(_0x503237,_0x3e1c2e){return client[_0xeaa5('0xf')](_0x49682b,_0x3552ac)[_0xeaa5('0x10')](function(_0x46806d){logger[_0xeaa5('0x11')](_0xeaa5('0x12'),_0x2f5750,_0xeaa5('0x13'));logger[_0xeaa5('0x14')](_0xeaa5('0x15'),_0x2f5750,'request\x20sent',JSON[_0xeaa5('0x16')](_0x46806d));if(_0x46806d[_0xeaa5('0x17')]){if(_0x46806d[_0xeaa5('0x17')][_0xeaa5('0x18')]===0x1f4){logger[_0xeaa5('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x2f5750,_0x46806d[_0xeaa5('0x17')]['message']);return _0x3e1c2e(_0x46806d[_0xeaa5('0x17')][_0xeaa5('0x19')]);}logger[_0xeaa5('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x2f5750,_0x46806d[_0xeaa5('0x17')]['message']);return _0x503237(_0x46806d[_0xeaa5('0x17')][_0xeaa5('0x19')]);}else{logger[_0xeaa5('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x2f5750,_0xeaa5('0x13'));_0x503237(_0x46806d['result'][_0xeaa5('0x19')]);}})[_0xeaa5('0x1a')](function(_0x22f4d3){logger[_0xeaa5('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x2f5750,_0x22f4d3);_0x3e1c2e(_0x22f4d3);});});} \ No newline at end of file +var _0xf4eb=['then','info','OpenchannelAccount,\x20%s,\x20%s','debug','stringify','error','code','message','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./openchannelAccount.socket','register'];(function(_0x36fc1f,_0x27c1c8){var _0x371281=function(_0x2764fc){while(--_0x2764fc){_0x36fc1f['push'](_0x36fc1f['shift']());}};_0x371281(++_0x27c1c8);}(_0xf4eb,0xec));var _0xbf4e=function(_0xc34b4d,_0x4b13ce){_0xc34b4d=_0xc34b4d-0x0;var _0x5eed9e=_0xf4eb[_0xc34b4d];return _0x5eed9e;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});config[_0xbf4e('0x8')]=_['defaults'](config[_0xbf4e('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf4e('0x8')]));require(_0xbf4e('0x9'))[_0xbf4e('0xa')](socket);function respondWithRpcPromise(_0xc86f04,_0x5da823,_0x22668b){return new BPromise(function(_0x177342,_0x580a26){return client['request'](_0xc86f04,_0x22668b)[_0xbf4e('0xb')](function(_0x5a8397){logger[_0xbf4e('0xc')](_0xbf4e('0xd'),_0x5da823,'request\x20sent');logger[_0xbf4e('0xe')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5da823,'request\x20sent',JSON[_0xbf4e('0xf')](_0x5a8397));if(_0x5a8397[_0xbf4e('0x10')]){if(_0x5a8397[_0xbf4e('0x10')][_0xbf4e('0x11')]===0x1f4){logger[_0xbf4e('0x10')](_0xbf4e('0xd'),_0x5da823,_0x5a8397['error']['message']);return _0x580a26(_0x5a8397[_0xbf4e('0x10')][_0xbf4e('0x12')]);}logger[_0xbf4e('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x5da823,_0x5a8397[_0xbf4e('0x10')][_0xbf4e('0x12')]);return _0x177342(_0x5a8397[_0xbf4e('0x10')][_0xbf4e('0x12')]);}else{logger['info'](_0xbf4e('0xd'),_0x5da823,'request\x20sent');_0x177342(_0x5a8397['result']['message']);}})['catch'](function(_0x35992b){logger[_0xbf4e('0x10')](_0xbf4e('0xd'),_0x5da823,_0x35992b);_0x580a26(_0x35992b);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 9b7ede7..75455ea 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 _0x823c=['length','./openchannelAccount.events','remove','update','emit','removeListener','register'];(function(_0x14369c,_0x1ec5c5){var _0x4ee027=function(_0x3bd54a){while(--_0x3bd54a){_0x14369c['push'](_0x14369c['shift']());}};_0x4ee027(++_0x1ec5c5);}(_0x823c,0x143));var _0xc823=function(_0x24835b,_0x33e60b){_0x24835b=_0x24835b-0x0;var _0xf83cfe=_0x823c[_0x24835b];return _0xf83cfe;};'use strict';var OpenchannelAccountEvents=require(_0xc823('0x0'));var events=['save',_0xc823('0x1'),_0xc823('0x2')];function createListener(_0x28a645,_0x448609){return function(_0x306879){_0x448609[_0xc823('0x3')](_0x28a645,_0x306879);};}function removeListener(_0x49f2d2,_0x3309cc){return function(){OpenchannelAccountEvents[_0xc823('0x4')](_0x49f2d2,_0x3309cc);};}exports[_0xc823('0x5')]=function(_0x42e0c0){for(var _0x380607=0x0,_0x49e861=events[_0xc823('0x6')];_0x380607<_0x49e861;_0x380607++){var _0x472007=events[_0x380607];var _0x5daab9=createListener('openchannelAccount:'+_0x472007,_0x42e0c0);OpenchannelAccountEvents['on'](_0x472007,_0x5daab9);}}; \ No newline at end of file +var _0xe644=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener'];(function(_0x1cc718,_0x4fb19c){var _0x1bf177=function(_0x170f3f){while(--_0x170f3f){_0x1cc718['push'](_0x1cc718['shift']());}};_0x1bf177(++_0x4fb19c);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0x4e64('0x0'));var events=[_0x4e64('0x1'),_0x4e64('0x2'),_0x4e64('0x3')];function createListener(_0x18e17a,_0x1c5c75){return function(_0x5e2d61){_0x1c5c75[_0x4e64('0x4')](_0x18e17a,_0x5e2d61);};}function removeListener(_0x7b06ee,_0x2f5ef0){return function(){OpenchannelAccountEvents[_0x4e64('0x5')](_0x7b06ee,_0x2f5ef0);};}exports[_0x4e64('0x6')]=function(_0x13fa90){for(var _0x55c23b=0x0,_0x66faf=events[_0x4e64('0x7')];_0x55c23b<_0x66faf;_0x55c23b++){var _0x5cce6e=events[_0x55c23b];var _0x4d5aa6=createListener(_0x4e64('0x8')+_0x5cce6e,_0x13fa90);OpenchannelAccountEvents['on'](_0x5cce6e,_0x4d5aa6);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 8b6eeb9..ef84fdd 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 _0xd831=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy'];(function(_0x40ab41,_0x5d535e){var _0x36962d=function(_0x3300e7){while(--_0x3300e7){_0x40ab41['push'](_0x40ab41['shift']());}};_0x36962d(++_0x5d535e);}(_0xd831,0x65));var _0x1d83=function(_0x3e7767,_0x136b45){_0x3e7767=_0x3e7767-0x0;var _0xe49f86=_0xd831[_0x3e7767];return _0xe49f86;};'use strict';var multer=require('multer');var util=require(_0x1d83('0x0'));var path=require(_0x1d83('0x1'));var timeout=require(_0x1d83('0x2'));var express=require(_0x1d83('0x3'));var router=express[_0x1d83('0x4')]();var fs_extra=require(_0x1d83('0x5'));var auth=require(_0x1d83('0x6'));var interaction=require(_0x1d83('0x7'));var config=require(_0x1d83('0x8'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x1d83('0x9')](),controller[_0x1d83('0xa')]);router[_0x1d83('0xb')]('/:id',auth[_0x1d83('0x9')](),controller['show']);router[_0x1d83('0xc')]('/',auth[_0x1d83('0x9')](),controller[_0x1d83('0xd')]);router[_0x1d83('0xe')](_0x1d83('0xf'),auth[_0x1d83('0x9')](),controller[_0x1d83('0x10')]);router[_0x1d83('0x11')](_0x1d83('0xf'),auth[_0x1d83('0x9')](),controller[_0x1d83('0x12')]);module[_0x1d83('0x13')]=router; \ No newline at end of file +var _0x28fb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x4478b3,_0x3fb886){var _0x58d699=function(_0x48769f){while(--_0x48769f){_0x4478b3['push'](_0x4478b3['shift']());}};_0x58d699(++_0x3fb886);}(_0x28fb,0x1d8));var _0xb28f=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x28fb[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0xb28f('0x0'));var util=require(_0xb28f('0x1'));var path=require(_0xb28f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb28f('0x3'));var auth=require(_0xb28f('0x4'));var interaction=require(_0xb28f('0x5'));var config=require(_0xb28f('0x6'));var controller=require(_0xb28f('0x7'));router[_0xb28f('0x8')]('/',auth[_0xb28f('0x9')](),controller[_0xb28f('0xa')]);router[_0xb28f('0x8')](_0xb28f('0xb'),auth[_0xb28f('0x9')](),controller[_0xb28f('0xc')]);router[_0xb28f('0xd')]('/',auth[_0xb28f('0x9')](),controller[_0xb28f('0xe')]);router['put'](_0xb28f('0xb'),auth[_0xb28f('0x9')](),controller[_0xb28f('0xf')]);router[_0xb28f('0x10')]('/:id',auth[_0xb28f('0x9')](),controller[_0xb28f('0x11')]);module[_0xb28f('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 4898337..6d4746a 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 _0x327b=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x564f7c,_0x37274a){var _0x4ca9f7=function(_0x128cd3){while(--_0x128cd3){_0x564f7c['push'](_0x564f7c['shift']());}};_0x4ca9f7(++_0x37274a);}(_0x327b,0xfb));var _0xb327=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x327b[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0xb327('0x0'));module[_0xb327('0x1')]={'priority':{'type':Sequelize[_0xb327('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb327('0x3')},'appdata':{'type':Sequelize[_0xb327('0x4')]()},'description':{'type':Sequelize[_0xb327('0x5')]},'interval':{'type':Sequelize[_0xb327('0x5')],'defaultValue':_0xb327('0x6')}}; \ No newline at end of file +var _0xb152=['INTEGER','STRING','noop'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0xb152,0x19e));var _0x2b15=function(_0x5e8295,_0x4fcee0){_0x5e8295=_0x5e8295-0x0;var _0x2b08aa=_0xb152[_0x5e8295];return _0x2b08aa;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x2b15('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x2b15('0x1')],'allowNull':![],'defaultValue':_0x2b15('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2b15('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 81797ec..c89c709 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 _0x0433=['create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelApplication','includeAll','include','findAll','catch','keys','rawAttributes','find'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0433,0xe7));var _0x3043=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x0433[_0x3ff085];return _0x2b68c3;};'use strict';var emlformat=require(_0x3043('0x0'));var rimraf=require(_0x3043('0x1'));var zipdir=require(_0x3043('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3043('0x3'));var moment=require(_0x3043('0x4'));var BPromise=require(_0x3043('0x5'));var Mustache=require(_0x3043('0x6'));var util=require(_0x3043('0x7'));var path=require('path');var sox=require(_0x3043('0x8'));var csv=require(_0x3043('0x9'));var ejs=require(_0x3043('0xa'));var fs=require('fs');var fs_extra=require(_0x3043('0xb'));var _=require(_0x3043('0xc'));var squel=require(_0x3043('0xd'));var crypto=require(_0x3043('0xe'));var jsforce=require(_0x3043('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3043('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3043('0x10'));var qs=require(_0x3043('0x11'));var as=require(_0x3043('0x12'));var hardwareService=require(_0x3043('0x13'));var logger=require(_0x3043('0x14'))(_0x3043('0x15'));var utils=require(_0x3043('0x16'));var config=require(_0x3043('0x17'));var licenseUtil=require(_0x3043('0x18'));var db=require(_0x3043('0x19'))['db'];function respondWithStatusCode(_0x211f66,_0x19a63d){_0x19a63d=_0x19a63d||0xcc;return function(_0x32f4d8){if(_0x32f4d8){return _0x211f66[_0x3043('0x1a')](_0x19a63d);}return _0x211f66[_0x3043('0x1b')](_0x19a63d)['end']();};}function respondWithResult(_0x173b13,_0x421d31){_0x421d31=_0x421d31||0xc8;return function(_0x30c10c){if(_0x30c10c){return _0x173b13[_0x3043('0x1b')](_0x421d31)[_0x3043('0x1c')](_0x30c10c);}};}function respondWithFilteredResult(_0x284535,_0x20b6c7){return function(_0x38c640){if(_0x38c640){var _0x9890e0=typeof _0x20b6c7[_0x3043('0x1d')]===_0x3043('0x1e')&&typeof _0x20b6c7[_0x3043('0x1f')]===_0x3043('0x1e');var _0x1630c8=_0x38c640[_0x3043('0x20')];var _0x5b9378=_0x9890e0?0x0:_0x20b6c7[_0x3043('0x1d')];var _0x285acc=_0x9890e0?_0x38c640[_0x3043('0x20')]:_0x20b6c7['offset']+_0x20b6c7[_0x3043('0x1f')];var _0x4d3f52;if(_0x285acc>=_0x1630c8){_0x285acc=_0x1630c8;_0x4d3f52=0xc8;}else{_0x4d3f52=0xce;}_0x284535['status'](_0x4d3f52);return _0x284535[_0x3043('0x21')]('Content-Range',_0x5b9378+'-'+_0x285acc+'/'+_0x1630c8)[_0x3043('0x1c')](_0x38c640);}return null;};}function patchUpdates(_0x52fefe){return function(_0xb545b3){try{jsonpatch[_0x3043('0x22')](_0xb545b3,_0x52fefe,!![]);}catch(_0x4f5b57){return BPromise[_0x3043('0x23')](_0x4f5b57);}return _0xb545b3[_0x3043('0x24')]();};}function saveUpdates(_0x2a28d6,_0xa10c23){return function(_0x50bceb){if(_0x50bceb){return _0x50bceb[_0x3043('0x25')](_0x2a28d6)['then'](function(_0x58935a){return _0x58935a;});}return null;};}function removeEntity(_0x415ffb,_0x9c60ee){return function(_0x51c9a3){if(_0x51c9a3){return _0x51c9a3['destroy']()[_0x3043('0x26')](function(){_0x415ffb[_0x3043('0x1b')](0xcc)[_0x3043('0x27')]();});}};}function handleEntityNotFound(_0x15d784,_0x502456){return function(_0x3182ce){if(!_0x3182ce){_0x15d784[_0x3043('0x1a')](0x194);}return _0x3182ce;};}function handleError(_0x48f438,_0x25a8c3){_0x25a8c3=_0x25a8c3||0x1f4;return function(_0x16e6de){logger[_0x3043('0x28')](_0x16e6de[_0x3043('0x29')]);if(_0x16e6de[_0x3043('0x2a')]){delete _0x16e6de[_0x3043('0x2a')];}_0x48f438[_0x3043('0x1b')](_0x25a8c3)[_0x3043('0x2b')](_0x16e6de);};}exports[_0x3043('0x2c')]=function(_0x188ab9,_0x198500){var _0x5603d2={},_0x1781fd={},_0x36839c={'count':0x0,'rows':[]};var _0x3fabe2=_['map'](db['OpenchannelApplication']['rawAttributes'],function(_0x393669){return{'name':_0x393669[_0x3043('0x2d')],'type':_0x393669[_0x3043('0x2e')][_0x3043('0x2f')]};});_0x1781fd[_0x3043('0x30')]=_[_0x3043('0x31')](_0x3fabe2,'name');_0x1781fd['query']=_['keys'](_0x188ab9[_0x3043('0x32')]);_0x1781fd[_0x3043('0x33')]=_[_0x3043('0x34')](_0x1781fd[_0x3043('0x30')],_0x1781fd['query']);_0x5603d2[_0x3043('0x35')]=_[_0x3043('0x34')](_0x1781fd[_0x3043('0x30')],qs[_0x3043('0x36')](_0x188ab9[_0x3043('0x32')][_0x3043('0x36')]));_0x5603d2[_0x3043('0x35')]=_0x5603d2[_0x3043('0x35')][_0x3043('0x37')]?_0x5603d2[_0x3043('0x35')]:_0x1781fd['model'];if(!_0x188ab9['query'][_0x3043('0x38')](_0x3043('0x39'))){_0x5603d2[_0x3043('0x1f')]=qs[_0x3043('0x1f')](_0x188ab9[_0x3043('0x32')]['limit']);_0x5603d2['offset']=qs[_0x3043('0x1d')](_0x188ab9['query']['offset']);}_0x5603d2[_0x3043('0x3a')]=qs['sort'](_0x188ab9[_0x3043('0x32')][_0x3043('0x3b')]);_0x5603d2[_0x3043('0x3c')]=qs['filters'](_[_0x3043('0x3d')](_0x188ab9['query'],_0x1781fd[_0x3043('0x33')]),_0x3fabe2);if(_0x188ab9['query'][_0x3043('0x3e')]){_0x5603d2['where']=_[_0x3043('0x3f')](_0x5603d2[_0x3043('0x3c')],{'$or':_[_0x3043('0x31')](_0x3fabe2,function(_0x46d3ed){if(_0x46d3ed[_0x3043('0x2e')]!=='VIRTUAL'){var _0x4d900e={};_0x4d900e[_0x46d3ed[_0x3043('0x2a')]]={'$like':'%'+_0x188ab9[_0x3043('0x32')][_0x3043('0x3e')]+'%'};return _0x4d900e;}})});}_0x5603d2=_[_0x3043('0x3f')]({},_0x5603d2,_0x188ab9[_0x3043('0x40')]);var _0x11f689={'where':_0x5603d2[_0x3043('0x3c')]};return db[_0x3043('0x41')]['count'](_0x11f689)[_0x3043('0x26')](function(_0x34ea84){_0x36839c[_0x3043('0x20')]=_0x34ea84;if(_0x188ab9[_0x3043('0x32')][_0x3043('0x42')]){_0x5603d2[_0x3043('0x43')]=[{'all':!![]}];}return db[_0x3043('0x41')][_0x3043('0x44')](_0x5603d2);})['then'](function(_0x41d605){_0x36839c['rows']=_0x41d605;return _0x36839c;})[_0x3043('0x26')](respondWithFilteredResult(_0x198500,_0x5603d2))[_0x3043('0x45')](handleError(_0x198500,null));};exports['show']=function(_0x4df1ff,_0x3a1739){var _0x3516a1={'raw':!![],'where':{'id':_0x4df1ff['params']['id']}},_0x5baf6b={};_0x5baf6b[_0x3043('0x30')]=_[_0x3043('0x46')](db[_0x3043('0x41')][_0x3043('0x47')]);_0x5baf6b[_0x3043('0x32')]=_['keys'](_0x4df1ff['query']);_0x5baf6b[_0x3043('0x33')]=_[_0x3043('0x34')](_0x5baf6b['model'],_0x5baf6b[_0x3043('0x32')]);_0x3516a1[_0x3043('0x35')]=_['intersection'](_0x5baf6b[_0x3043('0x30')],qs[_0x3043('0x36')](_0x4df1ff[_0x3043('0x32')][_0x3043('0x36')]));_0x3516a1[_0x3043('0x35')]=_0x3516a1[_0x3043('0x35')]['length']?_0x3516a1[_0x3043('0x35')]:_0x5baf6b[_0x3043('0x30')];if(_0x4df1ff[_0x3043('0x32')][_0x3043('0x42')]){_0x3516a1[_0x3043('0x43')]=[{'all':!![]}];}_0x3516a1=_['merge']({},_0x3516a1,_0x4df1ff[_0x3043('0x40')]);return db['OpenchannelApplication'][_0x3043('0x48')](_0x3516a1)[_0x3043('0x26')](handleEntityNotFound(_0x3a1739,null))[_0x3043('0x26')](respondWithResult(_0x3a1739,null))['catch'](handleError(_0x3a1739,null));};exports[_0x3043('0x49')]=function(_0x34b8ef,_0x2af786){return db['OpenchannelApplication']['create'](_0x34b8ef[_0x3043('0x4a')],{})['then'](respondWithResult(_0x2af786,0xc9))[_0x3043('0x45')](handleError(_0x2af786,null));};exports[_0x3043('0x25')]=function(_0x126588,_0xd9cd76){if(_0x126588[_0x3043('0x4a')]['id']){delete _0x126588['body']['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x126588[_0x3043('0x4b')]['id']}})[_0x3043('0x26')](handleEntityNotFound(_0xd9cd76,null))[_0x3043('0x26')](saveUpdates(_0x126588[_0x3043('0x4a')],null))[_0x3043('0x26')](respondWithResult(_0xd9cd76,null))[_0x3043('0x45')](handleError(_0xd9cd76,null));};exports['destroy']=function(_0x551aa4,_0x5a9fe8){return db[_0x3043('0x41')][_0x3043('0x48')]({'where':{'id':_0x551aa4['params']['id']}})[_0x3043('0x26')](handleEntityNotFound(_0x5a9fe8,null))[_0x3043('0x26')](removeEntity(_0x5a9fe8,null))[_0x3043('0x45')](handleError(_0x5a9fe8,null));}; \ No newline at end of file +var _0x1da9=['where','pick','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','intersection','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../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','name','send','index','map','OpenchannelApplication','fieldName','type','key','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0x1da9,0x143));var _0x91da=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1da9[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x91da('0x0'));var rimraf=require(_0x91da('0x1'));var zipdir=require(_0x91da('0x2'));var jsonpatch=require(_0x91da('0x3'));var rp=require(_0x91da('0x4'));var moment=require(_0x91da('0x5'));var BPromise=require(_0x91da('0x6'));var Mustache=require(_0x91da('0x7'));var util=require('util');var path=require(_0x91da('0x8'));var sox=require(_0x91da('0x9'));var csv=require(_0x91da('0xa'));var ejs=require(_0x91da('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91da('0xc'));var squel=require('squel');var crypto=require(_0x91da('0xd'));var jsforce=require(_0x91da('0xe'));var deskjs=require(_0x91da('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x91da('0x10'));var Redis=require('ioredis');var authService=require(_0x91da('0x11'));var qs=require(_0x91da('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x91da('0x13'))(_0x91da('0x14'));var utils=require(_0x91da('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x91da('0x16'));var db=require(_0x91da('0x17'))['db'];function respondWithStatusCode(_0x330d71,_0xabb7eb){_0xabb7eb=_0xabb7eb||0xcc;return function(_0x25c9f8){if(_0x25c9f8){return _0x330d71[_0x91da('0x18')](_0xabb7eb);}return _0x330d71[_0x91da('0x19')](_0xabb7eb)[_0x91da('0x1a')]();};}function respondWithResult(_0x3851de,_0x185a08){_0x185a08=_0x185a08||0xc8;return function(_0x375351){if(_0x375351){return _0x3851de[_0x91da('0x19')](_0x185a08)[_0x91da('0x1b')](_0x375351);}};}function respondWithFilteredResult(_0x12613f,_0x35d4c8){return function(_0x1f2b29){if(_0x1f2b29){var _0x90c86f=typeof _0x35d4c8[_0x91da('0x1c')]===_0x91da('0x1d')&&typeof _0x35d4c8[_0x91da('0x1e')]===_0x91da('0x1d');var _0x4f352b=_0x1f2b29[_0x91da('0x1f')];var _0x19476f=_0x90c86f?0x0:_0x35d4c8[_0x91da('0x1c')];var _0x782e9d=_0x90c86f?_0x1f2b29[_0x91da('0x1f')]:_0x35d4c8[_0x91da('0x1c')]+_0x35d4c8[_0x91da('0x1e')];var _0x281489;if(_0x782e9d>=_0x4f352b){_0x782e9d=_0x4f352b;_0x281489=0xc8;}else{_0x281489=0xce;}_0x12613f[_0x91da('0x19')](_0x281489);return _0x12613f[_0x91da('0x20')](_0x91da('0x21'),_0x19476f+'-'+_0x782e9d+'/'+_0x4f352b)[_0x91da('0x1b')](_0x1f2b29);}return null;};}function patchUpdates(_0x10532d){return function(_0x4e16a3){try{jsonpatch[_0x91da('0x22')](_0x4e16a3,_0x10532d,!![]);}catch(_0x2b2040){return BPromise[_0x91da('0x23')](_0x2b2040);}return _0x4e16a3[_0x91da('0x24')]();};}function saveUpdates(_0x4df28b,_0x35d6f5){return function(_0x3f0e1d){if(_0x3f0e1d){return _0x3f0e1d[_0x91da('0x25')](_0x4df28b)[_0x91da('0x26')](function(_0x4cd891){return _0x4cd891;});}return null;};}function removeEntity(_0x1d9e45,_0x2e16c2){return function(_0x4ca2ae){if(_0x4ca2ae){return _0x4ca2ae['destroy']()[_0x91da('0x26')](function(){_0x1d9e45['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3470a5,_0x208d66){return function(_0x1ef2bf){if(!_0x1ef2bf){_0x3470a5[_0x91da('0x18')](0x194);}return _0x1ef2bf;};}function handleError(_0x1a5915,_0x15314c){_0x15314c=_0x15314c||0x1f4;return function(_0x12b6fa){logger[_0x91da('0x27')](_0x12b6fa['stack']);if(_0x12b6fa[_0x91da('0x28')]){delete _0x12b6fa[_0x91da('0x28')];}_0x1a5915[_0x91da('0x19')](_0x15314c)[_0x91da('0x29')](_0x12b6fa);};}exports[_0x91da('0x2a')]=function(_0x52a315,_0x683b12){var _0x504b75={},_0x33afe1={},_0x59ced0={'count':0x0,'rows':[]};var _0x36cd70=_[_0x91da('0x2b')](db[_0x91da('0x2c')]['rawAttributes'],function(_0xf64fd6){return{'name':_0xf64fd6[_0x91da('0x2d')],'type':_0xf64fd6[_0x91da('0x2e')][_0x91da('0x2f')]};});_0x33afe1['model']=_['map'](_0x36cd70,'name');_0x33afe1[_0x91da('0x30')]=_['keys'](_0x52a315[_0x91da('0x30')]);_0x33afe1[_0x91da('0x31')]=_['intersection'](_0x33afe1[_0x91da('0x32')],_0x33afe1['query']);_0x504b75[_0x91da('0x33')]=_['intersection'](_0x33afe1[_0x91da('0x32')],qs['fields'](_0x52a315[_0x91da('0x30')][_0x91da('0x34')]));_0x504b75[_0x91da('0x33')]=_0x504b75[_0x91da('0x33')]['length']?_0x504b75[_0x91da('0x33')]:_0x33afe1[_0x91da('0x32')];if(!_0x52a315[_0x91da('0x30')][_0x91da('0x35')](_0x91da('0x36'))){_0x504b75[_0x91da('0x1e')]=qs[_0x91da('0x1e')](_0x52a315[_0x91da('0x30')][_0x91da('0x1e')]);_0x504b75[_0x91da('0x1c')]=qs['offset'](_0x52a315['query'][_0x91da('0x1c')]);}_0x504b75[_0x91da('0x37')]=qs['sort'](_0x52a315[_0x91da('0x30')][_0x91da('0x38')]);_0x504b75[_0x91da('0x39')]=qs[_0x91da('0x31')](_[_0x91da('0x3a')](_0x52a315[_0x91da('0x30')],_0x33afe1['filters']),_0x36cd70);if(_0x52a315[_0x91da('0x30')]['filter']){_0x504b75['where']=_['merge'](_0x504b75[_0x91da('0x39')],{'$or':_['map'](_0x36cd70,function(_0x3f2286){if(_0x3f2286[_0x91da('0x2e')]!==_0x91da('0x3b')){var _0x405f71={};_0x405f71[_0x3f2286[_0x91da('0x28')]]={'$like':'%'+_0x52a315['query']['filter']+'%'};return _0x405f71;}})});}_0x504b75=_[_0x91da('0x3c')]({},_0x504b75,_0x52a315[_0x91da('0x3d')]);var _0x31e582={'where':_0x504b75[_0x91da('0x39')]};return db['OpenchannelApplication'][_0x91da('0x1f')](_0x31e582)[_0x91da('0x26')](function(_0x4c979b){_0x59ced0[_0x91da('0x1f')]=_0x4c979b;if(_0x52a315['query'][_0x91da('0x3e')]){_0x504b75[_0x91da('0x3f')]=[{'all':!![]}];}return db[_0x91da('0x2c')][_0x91da('0x40')](_0x504b75);})[_0x91da('0x26')](function(_0x120f46){_0x59ced0['rows']=_0x120f46;return _0x59ced0;})[_0x91da('0x26')](respondWithFilteredResult(_0x683b12,_0x504b75))[_0x91da('0x41')](handleError(_0x683b12,null));};exports[_0x91da('0x42')]=function(_0x659a39,_0x402550){var _0x2c4b70={'raw':!![],'where':{'id':_0x659a39[_0x91da('0x43')]['id']}},_0x9af6={};_0x9af6[_0x91da('0x32')]=_[_0x91da('0x44')](db['OpenchannelApplication'][_0x91da('0x45')]);_0x9af6[_0x91da('0x30')]=_['keys'](_0x659a39[_0x91da('0x30')]);_0x9af6[_0x91da('0x31')]=_[_0x91da('0x46')](_0x9af6[_0x91da('0x32')],_0x9af6[_0x91da('0x30')]);_0x2c4b70[_0x91da('0x33')]=_[_0x91da('0x46')](_0x9af6[_0x91da('0x32')],qs[_0x91da('0x34')](_0x659a39[_0x91da('0x30')][_0x91da('0x34')]));_0x2c4b70[_0x91da('0x33')]=_0x2c4b70[_0x91da('0x33')][_0x91da('0x47')]?_0x2c4b70[_0x91da('0x33')]:_0x9af6['model'];if(_0x659a39[_0x91da('0x30')][_0x91da('0x3e')]){_0x2c4b70[_0x91da('0x3f')]=[{'all':!![]}];}_0x2c4b70=_[_0x91da('0x3c')]({},_0x2c4b70,_0x659a39[_0x91da('0x3d')]);return db[_0x91da('0x2c')][_0x91da('0x48')](_0x2c4b70)['then'](handleEntityNotFound(_0x402550,null))[_0x91da('0x26')](respondWithResult(_0x402550,null))[_0x91da('0x41')](handleError(_0x402550,null));};exports[_0x91da('0x49')]=function(_0x291d84,_0x514de7){return db[_0x91da('0x2c')][_0x91da('0x49')](_0x291d84[_0x91da('0x4a')],{})[_0x91da('0x26')](respondWithResult(_0x514de7,0xc9))[_0x91da('0x41')](handleError(_0x514de7,null));};exports[_0x91da('0x25')]=function(_0x2522db,_0x1e9f9a){if(_0x2522db[_0x91da('0x4a')]['id']){delete _0x2522db[_0x91da('0x4a')]['id'];}return db[_0x91da('0x2c')][_0x91da('0x48')]({'where':{'id':_0x2522db[_0x91da('0x43')]['id']}})[_0x91da('0x26')](handleEntityNotFound(_0x1e9f9a,null))[_0x91da('0x26')](saveUpdates(_0x2522db[_0x91da('0x4a')],null))[_0x91da('0x26')](respondWithResult(_0x1e9f9a,null))[_0x91da('0x41')](handleError(_0x1e9f9a,null));};exports[_0x91da('0x4b')]=function(_0x1e4a8e,_0x420a2f){return db['OpenchannelApplication']['find']({'where':{'id':_0x1e4a8e[_0x91da('0x43')]['id']}})['then'](handleEntityNotFound(_0x420a2f,null))['then'](removeEntity(_0x420a2f,null))[_0x91da('0x41')](handleError(_0x420a2f,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b73db26..e159aef 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 _0x6389=['exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','../../config/logger','api','moment','bluebird','./openchannelApplication.attributes'];(function(_0x4055d5,_0x37a693){var _0x190242=function(_0x16776a){while(--_0x16776a){_0x4055d5['push'](_0x4055d5['shift']());}};_0x190242(++_0x37a693);}(_0x6389,0x1d1));var _0x9638=function(_0x338fe0,_0x18c7d8){_0x338fe0=_0x338fe0-0x0;var _0x19272d=_0x6389[_0x338fe0];return _0x19272d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9638('0x0'))(_0x9638('0x1'));var moment=require(_0x9638('0x2'));var BPromise=require(_0x9638('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9638('0x4'));module[_0x9638('0x5')]=function(_0x3e9fd4,_0xa5cc47){return _0x3e9fd4[_0x9638('0x6')](_0x9638('0x7'),attributes,{'tableName':_0x9638('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9638('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1715=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication'];(function(_0x44e46a,_0x416e06){var _0x2d7195=function(_0x2d3b5f){while(--_0x2d3b5f){_0x44e46a['push'](_0x44e46a['shift']());}};_0x2d7195(++_0x416e06);}(_0x1715,0x137));var _0x5171=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1715[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x5171('0x0'));var logger=require(_0x5171('0x1'))(_0x5171('0x2'));var moment=require(_0x5171('0x3'));var BPromise=require(_0x5171('0x4'));var rp=require(_0x5171('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5171('0x6'));var config=require(_0x5171('0x7'));var attributes=require(_0x5171('0x8'));module[_0x5171('0x9')]=function(_0x1b0fd4,_0x3324a9){return _0x1b0fd4['define'](_0x5171('0xa'),attributes,{'tableName':_0x5171('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5171('0xc'),'collate':_0x5171('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 9551ef1..ce14a53 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 _0xc2e6=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','update','body','options','attributes','limit','moment'];(function(_0x427d6c,_0x4c4ccd){var _0x59cae7=function(_0x3c40f7){while(--_0x3c40f7){_0x427d6c['push'](_0x427d6c['shift']());}};_0x59cae7(++_0x4c4ccd);}(_0xc2e6,0x179));var _0x6c2e=function(_0x33545e,_0x11068c){_0x33545e=_0x33545e-0x0;var _0x3c50ee=_0xc2e6[_0x33545e];return _0x3c50ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6c2e('0x0'));var BPromise=require(_0x6c2e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c2e('0x2'))['db'];var utils=require(_0x6c2e('0x3'));var logger=require(_0x6c2e('0x4'))(_0x6c2e('0x5'));var config=require(_0x6c2e('0x6'));var jayson=require(_0x6c2e('0x7'));var client=jayson[_0x6c2e('0x8')][_0x6c2e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e7da2,_0x5cda99,_0x97533b){return new BPromise(function(_0x334d15,_0x393cf8){return client[_0x6c2e('0xa')](_0x2e7da2,_0x97533b)[_0x6c2e('0xb')](function(_0x310c38){logger[_0x6c2e('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x5cda99,'request\x20sent');logger[_0x6c2e('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x5cda99,_0x6c2e('0xe'),JSON[_0x6c2e('0xf')](_0x310c38));if(_0x310c38[_0x6c2e('0x10')]){if(_0x310c38[_0x6c2e('0x10')]['code']===0x1f4){logger[_0x6c2e('0x10')](_0x6c2e('0x11'),_0x5cda99,_0x310c38[_0x6c2e('0x10')][_0x6c2e('0x12')]);return _0x393cf8(_0x310c38[_0x6c2e('0x10')][_0x6c2e('0x12')]);}logger['error'](_0x6c2e('0x11'),_0x5cda99,_0x310c38[_0x6c2e('0x10')][_0x6c2e('0x12')]);return _0x334d15(_0x310c38[_0x6c2e('0x10')][_0x6c2e('0x12')]);}else{logger[_0x6c2e('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x5cda99,_0x6c2e('0xe'));_0x334d15(_0x310c38[_0x6c2e('0x13')][_0x6c2e('0x12')]);}})[_0x6c2e('0x14')](function(_0x16a4ec){logger['error'](_0x6c2e('0x11'),_0x5cda99,_0x16a4ec);_0x393cf8(_0x16a4ec);});});}exports[_0x6c2e('0x15')]=function(_0x562861){var _0x43271f=this;return new Promise(function(_0x439d1f,_0x14354c){return db['OpenchannelApplication'][_0x6c2e('0x16')](_0x562861[_0x6c2e('0x17')],{'raw':_0x562861[_0x6c2e('0x18')]?_0x562861['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x562861[_0x6c2e('0x18')]?_0x562861[_0x6c2e('0x18')]['where']||null:null,'attributes':_0x562861['options']?_0x562861['options'][_0x6c2e('0x19')]||null:null,'limit':_0x562861[_0x6c2e('0x18')]?_0x562861[_0x6c2e('0x18')][_0x6c2e('0x1a')]||null:null})[_0x6c2e('0xb')](function(_0x229174){logger[_0x6c2e('0xc')]('UpdateOpenchannelApplication',_0x562861);logger[_0x6c2e('0xd')](_0x6c2e('0x15'),_0x562861,JSON[_0x6c2e('0xf')](_0x229174));_0x439d1f(_0x229174);})[_0x6c2e('0x14')](function(_0x2437ae){logger['error'](_0x6c2e('0x15'),_0x2437ae[_0x6c2e('0x12')],_0x562861);_0x14354c(_0x43271f['error'](0x1f4,_0x2437ae[_0x6c2e('0x12')]));});});}; \ No newline at end of file +var _0x285f=['OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','then','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x56eb43,_0x26f724){var _0x299bab=function(_0x13121d){while(--_0x13121d){_0x56eb43['push'](_0x56eb43['shift']());}};_0x299bab(++_0x26f724);}(_0x285f,0x1e1));var _0xf285=function(_0x141bf8,_0x49d292){_0x141bf8=_0x141bf8-0x0;var _0xf3e925=_0x285f[_0x141bf8];return _0xf3e925;};'use strict';var _=require(_0xf285('0x0'));var util=require('util');var moment=require(_0xf285('0x1'));var BPromise=require('bluebird');var rs=require(_0xf285('0x2'));var fs=require('fs');var Redis=require(_0xf285('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf285('0x4'))(_0xf285('0x5'));var config=require(_0xf285('0x6'));var jayson=require(_0xf285('0x7'));var client=jayson[_0xf285('0x8')][_0xf285('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a50c6,_0x52b09a,_0x4bf2ab){return new BPromise(function(_0x4addfb,_0xbd5f3b){return client[_0xf285('0xa')](_0x4a50c6,_0x4bf2ab)['then'](function(_0xafb574){logger[_0xf285('0xb')](_0xf285('0xc'),_0x52b09a,_0xf285('0xd'));logger[_0xf285('0xe')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x52b09a,'request\x20sent',JSON[_0xf285('0xf')](_0xafb574));if(_0xafb574[_0xf285('0x10')]){if(_0xafb574['error'][_0xf285('0x11')]===0x1f4){logger[_0xf285('0x10')](_0xf285('0xc'),_0x52b09a,_0xafb574[_0xf285('0x10')][_0xf285('0x12')]);return _0xbd5f3b(_0xafb574['error'][_0xf285('0x12')]);}logger[_0xf285('0x10')](_0xf285('0xc'),_0x52b09a,_0xafb574[_0xf285('0x10')][_0xf285('0x12')]);return _0x4addfb(_0xafb574[_0xf285('0x10')][_0xf285('0x12')]);}else{logger[_0xf285('0xb')](_0xf285('0xc'),_0x52b09a,_0xf285('0xd'));_0x4addfb(_0xafb574[_0xf285('0x13')][_0xf285('0x12')]);}})['catch'](function(_0x674de9){logger['error'](_0xf285('0xc'),_0x52b09a,_0x674de9);_0xbd5f3b(_0x674de9);});});}exports[_0xf285('0x14')]=function(_0x57f026){var _0x5f5591=this;return new Promise(function(_0x1dd73a,_0x31bbc6){return db[_0xf285('0x15')][_0xf285('0x16')](_0x57f026[_0xf285('0x17')],{'raw':_0x57f026[_0xf285('0x18')]?_0x57f026[_0xf285('0x18')][_0xf285('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57f026['options']?_0x57f026[_0xf285('0x18')][_0xf285('0x1a')]||null:null,'attributes':_0x57f026[_0xf285('0x18')]?_0x57f026[_0xf285('0x18')][_0xf285('0x1b')]||null:null,'limit':_0x57f026[_0xf285('0x18')]?_0x57f026[_0xf285('0x18')]['limit']||null:null})[_0xf285('0x1c')](function(_0x1906f0){logger['info'](_0xf285('0x14'),_0x57f026);logger['debug']('UpdateOpenchannelApplication',_0x57f026,JSON['stringify'](_0x1906f0));_0x1dd73a(_0x1906f0);})['catch'](function(_0x3eed0e){logger[_0xf285('0x10')](_0xf285('0x14'),_0x3eed0e[_0xf285('0x12')],_0x57f026);_0x31bbc6(_0x5f5591[_0xf285('0x10')](0x1f4,_0x3eed0e[_0xf285('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index df4bd39..680bf31 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 _0x6548=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','post','create','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','destroy','removeTags','exports','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6548,0x12a));var _0x8654=function(_0x553c13,_0x4ed634){_0x553c13=_0x553c13-0x0;var _0x4fab8a=_0x6548[_0x553c13];return _0x4fab8a;};'use strict';var multer=require(_0x8654('0x0'));var util=require(_0x8654('0x1'));var path=require(_0x8654('0x2'));var timeout=require(_0x8654('0x3'));var express=require(_0x8654('0x4'));var router=express['Router']();var fs_extra=require(_0x8654('0x5'));var auth=require(_0x8654('0x6'));var interaction=require(_0x8654('0x7'));var config=require(_0x8654('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x8654('0x9')]('/',auth[_0x8654('0xa')](),controller[_0x8654('0xb')]);router[_0x8654('0x9')](_0x8654('0xc'),auth[_0x8654('0xa')](),controller[_0x8654('0xd')]);router[_0x8654('0x9')](_0x8654('0xe'),auth[_0x8654('0xa')](),controller[_0x8654('0xf')]);router['get'](_0x8654('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0x8654('0x9')](_0x8654('0x11'),auth['isAuthenticated'](),controller['download']);router[_0x8654('0x12')]('/',auth[_0x8654('0xa')](),controller[_0x8654('0x13')]);router[_0x8654('0x12')](_0x8654('0x10'),auth[_0x8654('0xa')](),controller['addMessage']);router['post'](_0x8654('0x14'),auth[_0x8654('0xa')](),interaction['tracked'](_0x8654('0x15'),_0x8654('0x16')),controller[_0x8654('0x17')]);router[_0x8654('0x18')](_0x8654('0xe'),auth[_0x8654('0xa')](),interaction['tracked'](_0x8654('0x15'),_0x8654('0x19')),controller['update']);router[_0x8654('0x1a')]('/:id',auth[_0x8654('0xa')](),interaction['tracked'](_0x8654('0x15'),'openchannelinteraction:destroy'),controller[_0x8654('0x1b')]);router[_0x8654('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8654('0x1c')]);module[_0x8654('0x1d')]=router; \ No newline at end of file +var _0xa424=['update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','describe','isAuthenticated','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update'];(function(_0x1647af,_0x47251c){var _0x18fe5c=function(_0x18adbe){while(--_0x18adbe){_0x1647af['push'](_0x1647af['shift']());}};_0x18fe5c(++_0x47251c);}(_0xa424,0x17a));var _0x4a42=function(_0x13b7c7,_0x575314){_0x13b7c7=_0x13b7c7-0x0;var _0x239e10=_0xa424[_0x13b7c7];return _0x239e10;};'use strict';var multer=require(_0x4a42('0x0'));var util=require(_0x4a42('0x1'));var path=require('path');var timeout=require(_0x4a42('0x2'));var express=require(_0x4a42('0x3'));var router=express['Router']();var fs_extra=require(_0x4a42('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4a42('0x5'));var config=require(_0x4a42('0x6'));var controller=require(_0x4a42('0x7'));router[_0x4a42('0x8')]('/',auth['isAuthenticated'](),controller[_0x4a42('0x9')]);router[_0x4a42('0x8')](_0x4a42('0xa'),auth['isAuthenticated'](),controller[_0x4a42('0xb')]);router[_0x4a42('0x8')]('/:id',auth[_0x4a42('0xc')](),controller['show']);router[_0x4a42('0x8')](_0x4a42('0xd'),auth[_0x4a42('0xc')](),controller[_0x4a42('0xe')]);router[_0x4a42('0x8')](_0x4a42('0xf'),auth[_0x4a42('0xc')](),controller['download']);router[_0x4a42('0x10')]('/',auth[_0x4a42('0xc')](),controller['create']);router[_0x4a42('0x10')](_0x4a42('0xd'),auth['isAuthenticated'](),controller[_0x4a42('0x11')]);router[_0x4a42('0x10')](_0x4a42('0x12'),auth[_0x4a42('0xc')](),interaction[_0x4a42('0x13')](_0x4a42('0x14'),_0x4a42('0x15')),controller[_0x4a42('0x16')]);router[_0x4a42('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0x4a42('0x13')]('openchannel',_0x4a42('0x18')),controller[_0x4a42('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x4a42('0x13')]('openchannel',_0x4a42('0x1a')),controller[_0x4a42('0x1b')]);router[_0x4a42('0x1c')](_0x4a42('0x12'),auth['isAuthenticated'](),controller[_0x4a42('0x1d')]);module[_0x4a42('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 6a2ac92..56daab6 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 _0x0f9a=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x57e672,_0x5a86b3){var _0x553e81=function(_0x39e805){while(--_0x39e805){_0x57e672['push'](_0x57e672['shift']());}};_0x553e81(++_0x5a86b3);}(_0x0f9a,0x174));var _0xa0f9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0f9a[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xa0f9('0x0'));module[_0xa0f9('0x1')]={'closed':{'type':Sequelize[_0xa0f9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa0f9('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa0f9('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa0f9('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xa0f9('0x4')]},'lastMsgAt':{'type':Sequelize[_0xa0f9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa0f9('0x5')]('in',_0xa0f9('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xa0f9('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xa0f9('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x367c=['ENUM','exports','BOOLEAN','DATE','STRING'];(function(_0x5ca02a,_0x3fd05c){var _0x2240c4=function(_0x483f93){while(--_0x483f93){_0x5ca02a['push'](_0x5ca02a['shift']());}};_0x2240c4(++_0x3fd05c);}(_0x367c,0x1b4));var _0xc367=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x367c[_0x2bc3f4];return _0x14ac53;};'use strict';var Sequelize=require('sequelize');module[_0xc367('0x0')]={'closed':{'type':Sequelize[_0xc367('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc367('0x2')]},'disposition':{'type':Sequelize[_0xc367('0x3')]},'secondDisposition':{'type':Sequelize[_0xc367('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc367('0x3')]},'note':{'type':Sequelize[_0xc367('0x3')]},'read1stAt':{'type':Sequelize[_0xc367('0x2')]},'threadId':{'type':Sequelize[_0xc367('0x3')]},'externalUrl':{'type':Sequelize[_0xc367('0x3')]},'lastMsgAt':{'type':Sequelize[_0xc367('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc367('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xc367('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 9b3095e..9abe1aa 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 _0x3dfb=['server','files','tmp','root','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Account','Owner','Openchannel','N.A.','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','save','then','destroy','stack','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','OpenchannelInteraction','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','field','color','from','select','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','text','start','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','role','toString','sequelize','keyBy','merge','Account.key','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','catch','show','params','intersection','includeAll','options','create','body','update','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','sort','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','Tag','emit','openchannelInteractionTags:save','download','unix','join'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3dfb,0x10a));var _0xb3df=function(_0x64525a,_0x314126){_0x64525a=_0x64525a-0x0;var _0x513c41=_0x3dfb[_0x64525a];return _0x513c41;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb3df('0x0'));var rp=require('request-promise');var moment=require(_0xb3df('0x1'));var BPromise=require(_0xb3df('0x2'));var Mustache=require(_0xb3df('0x3'));var util=require('util');var path=require(_0xb3df('0x4'));var sox=require(_0xb3df('0x5'));var csv=require(_0xb3df('0x6'));var ejs=require(_0xb3df('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb3df('0x8'));var crypto=require(_0xb3df('0x9'));var jsforce=require(_0xb3df('0xa'));var deskjs=require(_0xb3df('0xb'));var toCsv=require(_0xb3df('0x6'));var querystring=require(_0xb3df('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb3df('0xd'));var qs=require(_0xb3df('0xe'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xb3df('0xf'));var hardwareService=require(_0xb3df('0x10'));var logger=require(_0xb3df('0x11'))(_0xb3df('0x12'));var utils=require(_0xb3df('0x13'));var config=require(_0xb3df('0x14'));var licenseUtil=require(_0xb3df('0x15'));var db=require('../../mysqldb')['db'];config[_0xb3df('0x16')]=_['defaults'](config['redis'],{'host':_0xb3df('0x17'),'port':0x18eb});var socket=require(_0xb3df('0x18'))(new Redis(config[_0xb3df('0x16')]));require('./openchannelInteraction.socket')[_0xb3df('0x19')](socket);function respondWithStatusCode(_0x147d63,_0x345b31){_0x345b31=_0x345b31||0xcc;return function(_0x2ba1e4){if(_0x2ba1e4){return _0x147d63[_0xb3df('0x1a')](_0x345b31);}return _0x147d63[_0xb3df('0x1b')](_0x345b31)[_0xb3df('0x1c')]();};}function respondWithResult(_0x59c000,_0x31d7a9){_0x31d7a9=_0x31d7a9||0xc8;return function(_0x449d8c){if(_0x449d8c){return _0x59c000['status'](_0x31d7a9)[_0xb3df('0x1d')](_0x449d8c);}};}function respondWithFilteredResult(_0x554e64,_0x2e400f){return function(_0x1215c4){if(_0x1215c4){var _0x396c00=typeof _0x2e400f['offset']==='undefined'&&typeof _0x2e400f[_0xb3df('0x1e')]===_0xb3df('0x1f');var _0x46525b=_0x1215c4[_0xb3df('0x20')];var _0x3a629a=_0x396c00?0x0:_0x2e400f[_0xb3df('0x21')];var _0x3d6154=_0x396c00?_0x1215c4[_0xb3df('0x20')]:_0x2e400f[_0xb3df('0x21')]+_0x2e400f[_0xb3df('0x1e')];var _0x1ce76e;if(_0x3d6154>=_0x46525b){_0x3d6154=_0x46525b;_0x1ce76e=0xc8;}else{_0x1ce76e=0xce;}_0x554e64[_0xb3df('0x1b')](_0x1ce76e);return _0x554e64[_0xb3df('0x22')](_0xb3df('0x23'),_0x3a629a+'-'+_0x3d6154+'/'+_0x46525b)[_0xb3df('0x1d')](_0x1215c4);}return null;};}function patchUpdates(_0x3d6c05){return function(_0xe6e5f8){try{jsonpatch['apply'](_0xe6e5f8,_0x3d6c05,!![]);}catch(_0x351c1c){return BPromise['reject'](_0x351c1c);}return _0xe6e5f8[_0xb3df('0x24')]();};}function saveUpdates(_0xf6b0b6,_0x499a8c){return function(_0x375e85){if(_0x375e85){return _0x375e85['update'](_0xf6b0b6)[_0xb3df('0x25')](function(_0x1a51ef){return _0x1a51ef;});}return null;};}function removeEntity(_0x473987,_0x4190f1){return function(_0x194b97){if(_0x194b97){return _0x194b97[_0xb3df('0x26')]()[_0xb3df('0x25')](function(){_0x473987[_0xb3df('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x280756,_0x79556b){return function(_0x2eae7d){if(!_0x2eae7d){_0x280756[_0xb3df('0x1a')](0x194);}return _0x2eae7d;};}function handleError(_0xa3c350,_0x43c361){_0x43c361=_0x43c361||0x1f4;return function(_0x574a03){logger['error'](_0x574a03[_0xb3df('0x27')]);if(_0x574a03['name']){delete _0x574a03['name'];}_0xa3c350['status'](_0x43c361)[_0xb3df('0x28')](_0x574a03);};}function getInteractionUsers(_0x56ef26,_0x1b8e32){return new BPromise(function(_0x464236,_0xb0f9de){try{if(_0x1b8e32[_0x56ef26['id']]){_0x56ef26[_0xb3df('0x29')]=_[_0xb3df('0x2a')](_0x1b8e32[_0x56ef26['id']],function(_0x258f85){return{'id':_0x258f85['id'],'fullname':_0x258f85[_0xb3df('0x2b')]};});}}catch(_0x283b64){_0xb0f9de(_0x283b64);}_0x464236(_0x56ef26);});}function getInteractionTags(_0x1647a8,_0x23b918){return new BPromise(function(_0x472190,_0x1d08f5){try{if(_0x1647a8[_0xb3df('0x2c')]){_0x1647a8[_0xb3df('0x2d')]=[];_0x1647a8[_0xb3df('0x2c')][_0xb3df('0x2e')](',')[_0xb3df('0x2f')](function(_0x501cc3){_0x1647a8[_0xb3df('0x2d')][_0xb3df('0x30')](_0x23b918[_0x501cc3]);});}delete _0x1647a8[_0xb3df('0x2c')];}catch(_0x5c6ba3){_0x1d08f5(_0x5c6ba3);}_0x472190(_0x1647a8);});}function updateOpenchannelInteraction(_0x2a3b42,_0x2a9865,_0xb578e3){return new BPromise(function(_0x510b44,_0x2769d7){return getInteractionUsers(_0x2a3b42,_0xb578e3)[_0xb3df('0x25')](function(_0x1a6914){return getInteractionTags(_0x1a6914,_0x2a9865);})[_0xb3df('0x25')](function(_0x3e7436){_0x510b44(_0x3e7436);})['catch'](function(_0x40da7c){_0x2769d7(_0x40da7c);});});}exports[_0xb3df('0x31')]=function(_0x4b336e,_0x2b96d4){var _0x166ce7={},_0x1f754={},_0x157d70={'count':0x0,'rows':[]};var _0x478b25=_[_0xb3df('0x2a')](db[_0xb3df('0x32')][_0xb3df('0x33')],function(_0x2bbc22){return{'name':_0x2bbc22[_0xb3df('0x34')],'type':_0x2bbc22[_0xb3df('0x35')]['key']};});_0x1f754[_0xb3df('0x36')]=_[_0xb3df('0x2a')](_0x478b25,_0xb3df('0x37'));_0x1f754[_0xb3df('0x38')]=_[_0xb3df('0x39')](_0x4b336e[_0xb3df('0x38')]);_0x1f754[_0xb3df('0x3a')]=_['intersection'](_0x1f754[_0xb3df('0x36')],_0x1f754['query']);_0x166ce7[_0xb3df('0x3b')]=_['intersection'](_0x1f754[_0xb3df('0x36')],qs[_0xb3df('0x3c')](_0x4b336e[_0xb3df('0x38')]['fields']));_0x166ce7[_0xb3df('0x3b')]=_0x166ce7[_0xb3df('0x3b')][_0xb3df('0x3d')]?_0x166ce7[_0xb3df('0x3b')]:_0x1f754['model'];if(!_0x4b336e[_0xb3df('0x38')][_0xb3df('0x3e')](_0xb3df('0x3f'))){_0x166ce7['limit']=qs[_0xb3df('0x1e')](_0x4b336e[_0xb3df('0x38')][_0xb3df('0x1e')]);_0x166ce7[_0xb3df('0x21')]=qs[_0xb3df('0x21')](_0x4b336e[_0xb3df('0x38')][_0xb3df('0x21')]);}_0x166ce7[_0xb3df('0x40')]=qs['sort'](_0x4b336e[_0xb3df('0x38')]['sort']);_0x166ce7[_0xb3df('0x41')]=qs[_0xb3df('0x3a')](_[_0xb3df('0x42')](_0x4b336e[_0xb3df('0x38')],_0x1f754['filters']),_0x478b25);var _0x261e2c=[];var _0x33d93d=squel['select']()[_0xb3df('0x43')]('id')['field']('name')[_0xb3df('0x43')](_0xb3df('0x44'))[_0xb3df('0x45')]('tools_tags');var _0x18ff50=squel[_0xb3df('0x46')]()['field'](_0xb3df('0x47'))['field'](_0xb3df('0x48'))[_0xb3df('0x43')](_0xb3df('0x49'))[_0xb3df('0x45')]('user_has_openchannel_interactions','ui')[_0xb3df('0x4a')](_0xb3df('0x4b'),'u',_0xb3df('0x4c'));var _0x59901a=squel[_0xb3df('0x46')]()[_0xb3df('0x45')](_0xb3df('0x4d'),'i')['left_join']('cm_contacts','c',_0xb3df('0x4e'))[_0xb3df('0x4a')](_0xb3df('0x4b'),'o',_0xb3df('0x4f'))[_0xb3df('0x4a')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0xb3df('0x4a')](_0xb3df('0x50'),'me',_0xb3df('0x51'))[_0xb3df('0x4a')](_0xb3df('0x52'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xb3df('0x4a')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x2ca7ee=squel[_0xb3df('0x53')]();var _0x49d14e=[];var _0x331367=squel['expr']();var _0x33850c;if(_0x4b336e[_0xb3df('0x38')][_0xb3df('0x54')]){_0x33850c=as[_0xb3df('0x55')](_0x4b336e[_0xb3df('0x38')][_0xb3df('0x54')]);var _0x31e66f=_0x33850c['sqlOperator'];for(var _0x377198=0x0;_0x377198<_0x33850c[_0xb3df('0x56')]['length'];_0x377198++){var _0x179687=_0x33850c[_0xb3df('0x56')][_0x377198];var _0x3b459b='i';var _0x2dc236=_[_0xb3df('0x57')](_0x478b25,[_0xb3df('0x37'),_0x179687[_0xb3df('0x43')]]);if(!_0x2dc236){switch(_0x179687[_0xb3df('0x43')]){case _0xb3df('0x58'):if(_0x179687['value']==0x1){_0x59901a[_0xb3df('0x59')]('`'+_0x179687['field']+'`\x20=\x200');}else{_0x59901a['having']('`'+_0x179687[_0xb3df('0x43')]+_0xb3df('0x5a'));}break;case _0xb3df('0x5b'):if(_0x179687[_0xb3df('0x5c')]===_0xb3df('0x5d')){if(_0x179687['value'][_0xb3df('0x2e')]('\x20')[_0xb3df('0x3d')]>0x1){_0x2ca7ee[_0x31e66f](_0xb3df('0x5e'),qs[_0xb3df('0x5f')](_0x179687['value']),null);}else{var _0x14a928='%'+_0x179687[_0xb3df('0x60')]+'%';_0x2ca7ee[_0x31e66f](_0xb3df('0x61'),_0x14a928,_0x14a928,_0x14a928);}}else{_0x2dc236=_[_0xb3df('0x57')](_0x478b25,[_0xb3df('0x37'),_0xb3df('0x62')]);_0x179687[_0xb3df('0x43')]=_0xb3df('0x62');_0x16c2d1=as[_0xb3df('0x63')](_0x3b459b,_0x2dc236['type'],_0x179687);_0x2ca7ee[_0x31e66f](_0x16c2d1['text'],_0x16c2d1[_0xb3df('0x60')]['start'],_0x16c2d1[_0xb3df('0x60')]['end']);}break;case'Tag':var _0x4e52fc=_0x179687[_0xb3df('0x60')][_0xb3df('0x2e')](',')[_0xb3df('0x2a')](function(_0x4305f3){return Number(_0x4305f3);});_0x4e52fc['forEach'](function(_0x3fd237){_0x331367['or'](_0xb3df('0x64'),'%,'+_0x3fd237+',%');});_0x49d14e=_[_0xb3df('0x65')](_0x49d14e,_0x4e52fc);break;case _0xb3df('0x66'):if(_0x179687[_0xb3df('0x5c')]===_0xb3df('0x5d')){_0x2ca7ee[_0x31e66f]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x179687[_0xb3df('0x60')]+'%',null);}else{_0x2dc236=_[_0xb3df('0x57')](_0x478b25,[_0xb3df('0x37'),'UserId']);_0x179687['field']='UserId';_0x16c2d1=as[_0xb3df('0x63')](_0x3b459b,_0x2dc236[_0xb3df('0x35')],_0x179687);_0x2ca7ee[_0x31e66f](_0x16c2d1[_0xb3df('0x67')],_0x16c2d1[_0xb3df('0x60')][_0xb3df('0x68')],_0x16c2d1[_0xb3df('0x60')][_0xb3df('0x1c')]);}break;case'body':_0x16c2d1=as['buildExpression']('me',null,_0x179687);_0x2ca7ee[_0x31e66f](_0x16c2d1['text'],_0x16c2d1[_0xb3df('0x60')][_0xb3df('0x68')],_0x16c2d1['value'][_0xb3df('0x1c')]);break;}}else{var _0x16c2d1=as[_0xb3df('0x63')](_0x3b459b,_0x2dc236['type'],_0x179687);_0x2ca7ee[_0x31e66f](_0x16c2d1[_0xb3df('0x67')],_0x16c2d1[_0xb3df('0x60')][_0xb3df('0x68')],_0x16c2d1[_0xb3df('0x60')][_0xb3df('0x1c')]);}}}else{var _0x2d7b7b=_(_0x4b336e[_0xb3df('0x38')])[_0xb3df('0x39')]()[_0xb3df('0x2a')](function(_0x12c370){return _['some'](_0x478b25,[_0xb3df('0x37'),_0x12c370])?_0x12c370:undefined;})[_0xb3df('0x69')]()[_0xb3df('0x60')]();if(!_['isEmpty'](_0x2d7b7b)){_0x2d7b7b[_0xb3df('0x2f')](function(_0x1db0c4){if(_0x1db0c4===_0xb3df('0x6a')){_0x59901a[_0xb3df('0x41')](_0xb3df('0x6b'),[][_0xb3df('0x6c')](_0x4b336e[_0xb3df('0x38')][_0x1db0c4]));}else if(_0x1db0c4===_0xb3df('0x6d')){var _0x5d97ca=JSON['parse'](_0x4b336e[_0xb3df('0x38')][_0x1db0c4])[_0xb3df('0x6e')];var _0x57f9e4=JSON['parse'](_0x4b336e['query'][_0x1db0c4])[_0xb3df('0x6f')];_0x59901a[_0xb3df('0x41')](_0xb3df('0x70'),_0x5d97ca,_0x57f9e4);}else{if(_0x4b336e['query'][_0x1db0c4]==='null'){_0x59901a[_0xb3df('0x41')]('i.'+_0x1db0c4+'\x20IS\x20NULL');}else{_0x59901a['where']('i.'+_0x1db0c4+'\x20=\x20?',_0x4b336e['query'][_0x1db0c4]);}}});}if(_0x4b336e[_0xb3df('0x38')][_0xb3df('0x71')]){if(_0x4b336e[_0xb3df('0x38')][_0xb3df('0x71')]==0x1){_0x59901a[_0xb3df('0x59')](_0xb3df('0x72'));}else{_0x59901a[_0xb3df('0x59')]('`unreadMessages`\x20>\x200');}}if(_0x4b336e[_0xb3df('0x38')]['tag']){_0x49d14e=_[_0xb3df('0x73')](_0x4b336e[_0xb3df('0x38')][_0xb3df('0x74')])?_0x4b336e[_0xb3df('0x38')][_0xb3df('0x74')]:new Array(_0x4b336e[_0xb3df('0x38')][_0xb3df('0x74')]);_0x49d14e[_0xb3df('0x2f')](function(_0x3ed9f1){_0x331367['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3ed9f1+',%');});}if(_0x4b336e[_0xb3df('0x38')][_0xb3df('0x75')]){var _0x5df941=_0x4b336e['query']['filter'][_0xb3df('0x76')]('\x5c','\x5c\x5c')[_0xb3df('0x76')](/'/g,'\x27\x27');if(qs[_0xb3df('0x77')](_0x5df941)){_0x2ca7ee['or'](_0xb3df('0x78'),_0x5df941+'%');}else{_0x2ca7ee['or'](_0xb3df('0x79'),qs['getFullTextValue'](_0x5df941))['or'](_0xb3df('0x7a'),_0x5df941+'%')['or'](_0xb3df('0x7b'),_0x5df941+'%');}}}_0x59901a[_0xb3df('0x41')](_0x2ca7ee);_0x59901a['group'](_0xb3df('0x7c'));var _0x4b6791={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x970c67=_0x59901a[_0xb3df('0x7d')]();_0x970c67[_0xb3df('0x43')](_0xb3df('0x7c'));_0x970c67['field'](_0xb3df('0x7e'),_0xb3df('0x58'));if(_0x166ce7[_0xb3df('0x40')]){_0x166ce7[_0xb3df('0x40')][_0xb3df('0x2f')](function(_0x4d1dd0){var _0x176a29=_0x4d1dd0[0x0]===_0xb3df('0x7f')?_0x4d1dd0[0x0]:'i.'+_0x4d1dd0[0x0];_0x59901a[_0xb3df('0x40')](_0x176a29,_0x4d1dd0[0x1]===_0xb3df('0x80')?![]:!![]);});}if(!_[_0xb3df('0x81')](_0x49d14e)){_0x59901a[_0xb3df('0x59')](_0x331367);_0x970c67['where'](_0xb3df('0x82'),_0x49d14e);}BPromise[_0xb3df('0x83')]()[_0xb3df('0x25')](function(){if(!_0x33850c){if(_0x4b336e['query']['OpenchannelAccountId'])return;_0x970c67[_0xb3df('0x41')](_0xb3df('0x84'));_0x59901a[_0xb3df('0x41')](_0xb3df('0x84'));return;}if(_0x4b336e[_0xb3df('0x85')]['role']!==_0xb3df('0x86'))return;return _0x4b336e['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xb3df('0x25')](function(_0x4bcfc1){if(_[_0xb3df('0x81')](_0x4bcfc1)){_0x970c67['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x59901a[_0xb3df('0x41')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x970c67[_0xb3df('0x41')](_0xb3df('0x6b'),_[_0xb3df('0x2a')](_0x4bcfc1,'id'));_0x59901a[_0xb3df('0x41')](_0xb3df('0x6b'),_[_0xb3df('0x2a')](_0x4bcfc1,'id'));}});})[_0xb3df('0x25')](function(){if(_0x4b336e[_0xb3df('0x85')][_0xb3df('0x87')]===_0xb3df('0x86')&&!_0x33850c&&!_0x4b336e[_0xb3df('0x38')][_0xb3df('0x6a')])return[];return db['sequelize'][_0xb3df('0x38')](_0x970c67[_0xb3df('0x88')](),_0x4b6791);})[_0xb3df('0x25')](function(_0x18be11){_0x157d70['count']=_0x18be11['length'];if(_0x157d70['count']===0x0)return[];return db[_0xb3df('0x89')][_0xb3df('0x38')](_0x33d93d[_0xb3df('0x88')](),_0x4b6791)[_0xb3df('0x25')](function(_0xf560d1){_0x261e2c=_[_0xb3df('0x8a')](_0xf560d1,'id');_0x4b6791=_[_0xb3df('0x8b')](_0x4b6791,{'model':db[_0xb3df('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b336e[_0xb3df('0x38')][_0xb3df('0x3c')]){_0x166ce7['attributes'][_0xb3df('0x2f')](function(_0x235d26){_0x59901a[_0xb3df('0x43')]('i.'+_0x235d26);});}else{_0x59901a[_0xb3df('0x43')](_0xb3df('0x7e'),'unreadMessages');_0x59901a['field']('a.key',_0xb3df('0x8c'));_0x59901a[_0xb3df('0x43')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x59901a['field'](_0xb3df('0x8d'),'contactName');_0x59901a[_0xb3df('0x43')]('i.*');_0x59901a['field'](_0xb3df('0x8e'),_0xb3df('0x8f'));_0x59901a['field']('c.lastName',_0xb3df('0x90'));_0x59901a[_0xb3df('0x43')](_0xb3df('0x91'),_0xb3df('0x92'));_0x59901a[_0xb3df('0x43')](_0xb3df('0x93'),_0xb3df('0x94'));_0x59901a[_0xb3df('0x43')](_0xb3df('0x95'),'Contact.mobile');_0x59901a['field'](_0xb3df('0x96'),_0xb3df('0x97'));_0x59901a[_0xb3df('0x43')](_0xb3df('0x98'),_0xb3df('0x99'));_0x59901a[_0xb3df('0x43')](_0xb3df('0x9a'),_0xb3df('0x9b'));_0x59901a[_0xb3df('0x43')](_0xb3df('0x9c'),_0xb3df('0x2c'));}if(_0x166ce7[_0xb3df('0x1e')])_0x59901a[_0xb3df('0x1e')](_0x166ce7['limit']);if(_0x166ce7[_0xb3df('0x21')])_0x59901a['offset'](_0x166ce7[_0xb3df('0x21')]);return db[_0xb3df('0x89')][_0xb3df('0x38')](_0x59901a[_0xb3df('0x88')](),_0x4b6791);})['then'](function(_0xdf58fe){if(_0xdf58fe[_0xb3df('0x3d')]>0x0)_0x18ff50[_0xb3df('0x41')](_0xb3df('0x9d'),_[_0xb3df('0x2a')](_0xdf58fe,'id'));return db[_0xb3df('0x89')][_0xb3df('0x38')](_0x18ff50[_0xb3df('0x88')](),_0x4b6791)[_0xb3df('0x25')](function(_0x59121c){var _0x566dd1=_[_0xb3df('0x9e')](_0x59121c,_0xb3df('0x9f'));var _0x568d3e=[];_0xdf58fe['forEach'](function(_0x2e0dd3){_0x568d3e['push'](updateOpenchannelInteraction(_0x2e0dd3,_0x261e2c,_0x566dd1));});return BPromise['all'](_0x568d3e);});});})[_0xb3df('0x25')](function(_0x4ffabe){_0x157d70[_0xb3df('0xa0')]=_0x4ffabe;return _0x157d70;})['then'](respondWithFilteredResult(_0x2b96d4,_0x166ce7))[_0xb3df('0xa1')](handleError(_0x2b96d4,null));};exports[_0xb3df('0xa2')]=function(_0x3f4576,_0x1024d4){var _0x3a6a59={};if(_0x3f4576[_0xb3df('0x38')][_0xb3df('0x35')]&&_0x3f4576[_0xb3df('0x38')][_0xb3df('0x35')]==='from'){_0x3a6a59['from']=_0x3f4576['params']['id'];}else{_0x3a6a59['id']=_0x3f4576[_0xb3df('0xa3')]['id'];}var _0x57ee72={'raw':![],'where':_0x3a6a59},_0xa59b0f={};_0xa59b0f['model']=_['keys'](db[_0xb3df('0x32')][_0xb3df('0x33')]);_0xa59b0f['query']=_[_0xb3df('0x39')](_0x3f4576['query']);_0xa59b0f[_0xb3df('0x3a')]=_[_0xb3df('0xa4')](_0xa59b0f[_0xb3df('0x36')],_0xa59b0f[_0xb3df('0x38')]);_0x57ee72[_0xb3df('0x3b')]=_[_0xb3df('0xa4')](_0xa59b0f['model'],qs[_0xb3df('0x3c')](_0x3f4576['query'][_0xb3df('0x3c')]));_0x57ee72['attributes']=_0x57ee72['attributes'][_0xb3df('0x3d')]?_0x57ee72[_0xb3df('0x3b')]:_0xa59b0f[_0xb3df('0x36')];if(_0x3f4576[_0xb3df('0x38')][_0xb3df('0xa5')]){_0x57ee72['include']=[{'all':!![]}];}_0x57ee72=_[_0xb3df('0x8b')]({},_0x57ee72,_0x3f4576[_0xb3df('0xa6')]);return db[_0xb3df('0x32')][_0xb3df('0x57')](_0x57ee72)[_0xb3df('0x25')](handleEntityNotFound(_0x1024d4,null))['then'](respondWithResult(_0x1024d4,null))[_0xb3df('0xa1')](handleError(_0x1024d4,null));};exports[_0xb3df('0xa7')]=function(_0x2ba7fd,_0x1acb02){return db[_0xb3df('0x32')][_0xb3df('0xa7')](_0x2ba7fd[_0xb3df('0xa8')],{})[_0xb3df('0x25')](respondWithResult(_0x1acb02,0xc9))[_0xb3df('0xa1')](handleError(_0x1acb02,null));};exports[_0xb3df('0xa9')]=function(_0x230d6d,_0x956a68){if(_0x230d6d['body']['id']){delete _0x230d6d['body']['id'];}return db[_0xb3df('0x32')][_0xb3df('0x57')]({'where':{'id':_0x230d6d[_0xb3df('0xa3')]['id']}})[_0xb3df('0x25')](handleEntityNotFound(_0x956a68,null))[_0xb3df('0x25')](saveUpdates(_0x230d6d['body'],null))['then'](respondWithResult(_0x956a68,null))[_0xb3df('0xa1')](handleError(_0x956a68,null));};exports[_0xb3df('0x26')]=function(_0xe7c26c,_0x2cb3cb){return db['OpenchannelInteraction'][_0xb3df('0x57')]({'where':{'id':_0xe7c26c[_0xb3df('0xa3')]['id']}})[_0xb3df('0x25')](handleEntityNotFound(_0x2cb3cb,null))[_0xb3df('0x25')](removeEntity(_0x2cb3cb,null))[_0xb3df('0xa1')](handleError(_0x2cb3cb,null));};exports[_0xb3df('0xaa')]=function(_0x5850f0,_0x11e55e){return db[_0xb3df('0x32')][_0xb3df('0xaa')]()[_0xb3df('0x25')](respondWithResult(_0x11e55e,null))[_0xb3df('0xa1')](handleError(_0x11e55e,null));};exports[_0xb3df('0xab')]=function(_0x1b9a28,_0x57cb31,_0x152944){return db[_0xb3df('0xac')]['find']({'where':{'id':_0x1b9a28[_0xb3df('0xa3')]['id']}})[_0xb3df('0x25')](handleEntityNotFound(_0x57cb31,null))[_0xb3df('0x25')](function(_0x360438){if(_0x360438){return _0x360438[_0xb3df('0xab')](_0x1b9a28['body'][_0xb3df('0xad')],_[_0xb3df('0xae')](_0x1b9a28[_0xb3df('0xa8')],[_0xb3df('0xad'),'id'])||{});}})[_0xb3df('0x25')](respondWithResult(_0x57cb31,null))[_0xb3df('0xa1')](handleError(_0x57cb31,null));};exports[_0xb3df('0xaf')]=function(_0x27628c,_0xae2bc7,_0x5bfa7b){var _0x3e0e36={'raw':![],'where':{}};var _0x17da6f={};var _0x26b851={'count':0x0,'rows':[]};return db[_0xb3df('0x32')][_0xb3df('0xb0')]({'where':{'id':_0x27628c[_0xb3df('0xa3')]['id']}})[_0xb3df('0x25')](handleEntityNotFound(_0xae2bc7,null))[_0xb3df('0x25')](function(_0x2a4115){if(_0x2a4115){_0x17da6f[_0xb3df('0x36')]=_[_0xb3df('0x39')](db['OpenchannelMessage']['rawAttributes']);_0x17da6f['query']=_['keys'](_0x27628c['query']);_0x17da6f[_0xb3df('0x3a')]=_[_0xb3df('0xa4')](_0x17da6f['model'],_0x17da6f[_0xb3df('0x38')]);_0x3e0e36[_0xb3df('0x3b')]=_['intersection'](_0x17da6f[_0xb3df('0x36')],qs[_0xb3df('0x3c')](_0x27628c[_0xb3df('0x38')]['fields']));_0x3e0e36[_0xb3df('0x3b')]=_0x3e0e36[_0xb3df('0x3b')][_0xb3df('0x3d')]?_0x3e0e36[_0xb3df('0x3b')]:_0x17da6f['model'];if(!_0x27628c['query'][_0xb3df('0x3e')](_0xb3df('0x3f'))){_0x3e0e36[_0xb3df('0x1e')]=qs[_0xb3df('0x1e')](_0x27628c[_0xb3df('0x38')]['limit']);_0x3e0e36[_0xb3df('0x21')]=qs[_0xb3df('0x21')](_0x27628c['query'][_0xb3df('0x21')]);}_0x3e0e36[_0xb3df('0x40')]=qs[_0xb3df('0xb1')](_0x27628c[_0xb3df('0x38')][_0xb3df('0xb1')]);_0x3e0e36[_0xb3df('0x41')]=qs[_0xb3df('0x3a')](_[_0xb3df('0x42')](_0x27628c['query'],_0x17da6f[_0xb3df('0x3a')]));_0x3e0e36[_0xb3df('0x41')]['OpenchannelInteractionId']=_0x2a4115['id'];if(_0x27628c[_0xb3df('0x38')][_0xb3df('0x75')]){_0x3e0e36['where']=_['merge'](_0x3e0e36[_0xb3df('0x41')],{'$or':_[_0xb3df('0x2a')](_0x3e0e36[_0xb3df('0x3b')],function(_0x141598){var _0x3f4d20={};_0x3f4d20[_0x141598]={'$like':'%'+_0x27628c['query']['filter']+'%'};return _0x3f4d20;})});}if(_0x27628c[_0xb3df('0x38')]['$gte']){var _0x5d31a8=_0x27628c[_0xb3df('0x38')][_0xb3df('0x6e')][_0xb3df('0x2e')](',');var _0x51c857={};_0x51c857[_0x5d31a8[0x0]]={'$gte':moment(_0x5d31a8[0x1])[_0xb3df('0xb2')](_0xb3df('0xb3'))};_0x3e0e36[_0xb3df('0x41')]=_[_0xb3df('0x8b')](_0x3e0e36['where'],_0x51c857);}_0x3e0e36=_[_0xb3df('0x8b')]({},_0x3e0e36,_0x27628c[_0xb3df('0xa6')]);return db[_0xb3df('0xac')][_0xb3df('0x20')]({'where':_0x3e0e36[_0xb3df('0x41')]})[_0xb3df('0x25')](function(_0x88fc32){_0x26b851[_0xb3df('0x20')]=_0x88fc32;if(_0x27628c[_0xb3df('0x38')][_0xb3df('0xa5')]){_0x3e0e36[_0xb3df('0xb4')]=[{'all':!![]}];}return db[_0xb3df('0xac')][_0xb3df('0xb5')](_0x3e0e36);})[_0xb3df('0x25')](function(_0x389322){_0x26b851[_0xb3df('0xa0')]=_0x389322;return _0x26b851;});}})[_0xb3df('0x25')](respondWithFilteredResult(_0xae2bc7,_0x3e0e36))['catch'](handleError(_0xae2bc7,null));};exports[_0xb3df('0xb6')]=function(_0x29ecf2,_0x166292,_0x3efa3c){return db[_0xb3df('0x32')]['find']({'where':{'id':_0x29ecf2['params']['id']}})[_0xb3df('0x25')](handleEntityNotFound(_0x166292,null))[_0xb3df('0x25')](function(_0x5d9c07){if(_0x5d9c07){return _0x5d9c07[_0xb3df('0xb7')](_0x29ecf2[_0xb3df('0xa8')][_0xb3df('0xad')],_[_0xb3df('0xae')](_0x29ecf2[_0xb3df('0xa8')],[_0xb3df('0xad'),'id'])||{})['spread'](function(){return db[_0xb3df('0xb8')][_0xb3df('0xb5')]({'attributes':['id',_0xb3df('0x37'),_0xb3df('0x44')],'where':{'id':_0x29ecf2['body'][_0xb3df('0xad')]}});})[_0xb3df('0x25')](function(_0x5eb6f5){socket[_0xb3df('0xb9')](_0xb3df('0xba'),{'id':Number(_0x29ecf2[_0xb3df('0xa3')]['id']),'tags':_0x5eb6f5||[]});return{'id':Number(_0x29ecf2[_0xb3df('0xa3')]['id']),'tags':_0x5eb6f5||[]};});}})[_0xb3df('0x25')](respondWithResult(_0x166292,null))[_0xb3df('0xa1')](handleError(_0x166292,null));};exports['removeTags']=function(_0x3c6e9d,_0x638c3,_0x9c3da2){return db[_0xb3df('0x32')][_0xb3df('0x57')]({'where':{'id':_0x3c6e9d['params']['id']}})[_0xb3df('0x25')](handleEntityNotFound(_0x638c3,null))[_0xb3df('0x25')](function(_0x52e1da){if(_0x52e1da){return _0x52e1da['removeTags'](_0x3c6e9d[_0xb3df('0x38')][_0xb3df('0xad')]);}})[_0xb3df('0x25')](respondWithStatusCode(_0x638c3,null))[_0xb3df('0xa1')](handleError(_0x638c3,null));};exports[_0xb3df('0xbb')]=function(_0xbbabed,_0x575183){var _0xbe1111=moment()[_0xb3df('0xbc')]()[_0xb3df('0x88')]();var _0x5adbfd=path[_0xb3df('0xbd')](config['root'],_0xb3df('0xbe'),_0xb3df('0xbf'),_0xb3df('0xc0'));var _0x1a120f=path[_0xb3df('0xbd')](config[_0xb3df('0xc1')],_0xb3df('0xbe'),_0xb3df('0xbf'),_0xb3df('0xc2'));var _0x2c89cb=path['join'](_0x5adbfd,_0xbe1111);var _0x568fcb=util[_0xb3df('0xb2')](_0xb3df('0xc3'),_0xbbabed[_0xb3df('0xa3')]['id'],_0xbe1111);var _0x223c95=path[_0xb3df('0xbd')](_0x5adbfd,_0x568fcb);var _0x2f1e49=[];_0x2f1e49[_0xb3df('0x30')]({'model':db[_0xb3df('0x66')],'as':'User','attributes':['id',_0xb3df('0x2b')],'raw':!![]});_0x2f1e49[_0xb3df('0x30')]({'model':db[_0xb3df('0xc4')],'as':_0xb3df('0x5b'),'attributes':['id',_0xb3df('0xc5'),_0xb3df('0xc6')],'raw':!![]});if(_0xbbabed[_0xb3df('0x38')][_0xb3df('0xc2')]){_0x2f1e49[_0xb3df('0x30')]({'model':db['Attachment'],'as':_0xb3df('0xc7'),'raw':!![]});}var _0x37452a=[{'model':db[_0xb3df('0xac')],'as':_0xb3df('0xc8'),'attributes':['id','body',_0xb3df('0x6d'),_0xb3df('0xc9'),'secret','read'],'include':_0x2f1e49}];_0x37452a['push']({'model':db[_0xb3df('0xca')],'as':_0xb3df('0xcb'),'attributes':['id',_0xb3df('0x37')]});_0x37452a[_0xb3df('0x30')]({'model':db['User'],'as':_0xb3df('0xcc'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0xb3df('0x57')]({'where':{'id':_0xbbabed['params']['id']},'include':_0x37452a})['then'](handleEntityNotFound(_0x575183,null))[_0xb3df('0x25')](function(_0x5ea520){if(_0x5ea520){var _0x2c6828=_0x5ea520['get']({'plain':!![]});fs['mkdirSync'](_0x2c89cb);var _0x44ddbe={'channel':_0xb3df('0xcd'),'account':_0x2c6828[_0xb3df('0xcb')][_0xb3df('0x37')],'agent':_0x2c6828[_0xb3df('0xcc')]?_0x2c6828[_0xb3df('0xcc')][_0xb3df('0x2b')]:_0xb3df('0xce'),'createdAt':moment(_0x2c6828['createdAt'])[_0xb3df('0xb2')](_0xb3df('0xb3'))[_0xb3df('0x88')](),'closedAt':_0x2c6828[_0xb3df('0xcf')]?moment(_0x2c6828[_0xb3df('0xd0')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x2c6828[_0xb3df('0xd1')],'visibility':_0x2c6828['threadId']?_0xb3df('0xd2'):_0xb3df('0xd3'),'messages':_(_0x2c6828[_0xb3df('0xc8')])[_0xb3df('0x75')]({'secret':![]})[_0xb3df('0x2a')](function(_0x3476c1){if(_0x3476c1[_0xb3df('0xc7')]){var _0x112fdd=path[_0xb3df('0xbd')](_0x1a120f,_0x3476c1[_0xb3df('0xc7')][_0xb3df('0xd4')]);if(fs[_0xb3df('0xd5')](_0x112fdd)){fs[_0xb3df('0xd6')](_0x112fdd)[_0xb3df('0xd7')](fs[_0xb3df('0xd8')](path[_0xb3df('0xbd')](_0x2c89cb,_0x3476c1[_0xb3df('0xc7')][_0xb3df('0xd4')])));}}return{'date':moment(_0x3476c1[_0xb3df('0x6d')])[_0xb3df('0xb2')](_0xb3df('0xb3'))[_0xb3df('0x88')](),'sender':_0x3476c1[_0xb3df('0xc9')]===_0xb3df('0xd9')?_0x3476c1[_0xb3df('0x66')]?_0x3476c1[_0xb3df('0x66')][_0xb3df('0x2b')]:_0xb3df('0xda'):_0x3476c1[_0xb3df('0x5b')]['firstName']+(_0x3476c1[_0xb3df('0x5b')][_0xb3df('0xc6')]?'\x20'+_0x3476c1[_0xb3df('0x5b')][_0xb3df('0xc6')]:''),'body':_0x3476c1[_0xb3df('0xc7')]?_0x3476c1[_0xb3df('0xc7')][_0xb3df('0xd4')]:_0x3476c1['body'],'direction':_0x3476c1[_0xb3df('0xc9')]===_0xb3df('0xd9')?'A':'C','secret':_0x3476c1[_0xb3df('0xdb')],'read':_0x3476c1[_0xb3df('0x71')],'attachment':_0x3476c1[_0xb3df('0xc7')]};})[_0xb3df('0x60')]()};return ejs[_0xb3df('0xdc')](path['join'](config[_0xb3df('0xc1')],_0xb3df('0xbe'),_0xb3df('0xdd'),_0xb3df('0xde')),{'interaction':_0x44ddbe})['then'](function(_0x46d9e1){var _0x2b1fbf=path[_0xb3df('0xbd')](_0x2c89cb,_0xb3df('0xdf')+_0x2c6828['id']+'-'+_0xbe1111+_0xb3df('0xe0'));var _0x3f40df={'path':_0x2b1fbf,'channel':_0xb3df('0xcd'),'interactionId':_0x2c6828['id']};return pdf[_0xb3df('0xe1')](_0x46d9e1,_0x3f40df);})['then'](function(){return new BPromise(function(_0x45430b,_0x5ac723){zipdir(_0x2c89cb,{'saveTo':_0x223c95},function(_0x36a0d2,_0x3e6902){if(_0x36a0d2)return _0x5ac723(_0x36a0d2);return _0x45430b(_0x3e6902);});})[_0xb3df('0x25')](function(){return new BPromise(function(_0x37c36f,_0xc387f8){rimraf(_0x2c89cb,function(_0x56a4e0){if(_0x56a4e0)_0xc387f8(_0x56a4e0);return _0x37c36f();});});})[_0xb3df('0x25')](function(){return _0x575183[_0xb3df('0xbb')](_0x223c95,_0x568fcb,function(_0xaad944){if(_0xaad944){console[_0xb3df('0xe2')](_0xb3df('0xe3'),_0xaad944);}else{fs['unlinkSync'](_0x223c95);}});});});}else{return _0x575183['sendStatus'](0xc8);}})['catch'](handleError(_0x575183,null));}; \ No newline at end of file +var _0xf97c=['format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','views','downloadInteraction.ejs','createPdfFromHTML','log','err','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','filters','pick','select','field','color','from','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','parseSearch','search','conditions','value','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','some','compact','isEmpty','OpenchannelAccountId','concat','parse','$gte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','all','params','includeAll','include','options','create','body','describe','OpenchannelMessage','addMessage','ids','omit','OpenchannelInteractionId'];(function(_0x27a2cd,_0x3b4ec9){var _0x1d2528=function(_0x16a7e1){while(--_0x16a7e1){_0x27a2cd['push'](_0x27a2cd['shift']());}};_0x1d2528(++_0x3b4ec9);}(_0xf97c,0x124));var _0xcf97=function(_0x2f1ab5,_0x2966be){_0x2f1ab5=_0x2f1ab5-0x0;var _0x5c7e72=_0xf97c[_0x2f1ab5];return _0x5c7e72;};'use strict';var emlformat=require(_0xcf97('0x0'));var rimraf=require(_0xcf97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf97('0x2'));var rp=require(_0xcf97('0x3'));var moment=require('moment');var BPromise=require(_0xcf97('0x4'));var Mustache=require(_0xcf97('0x5'));var util=require('util');var path=require(_0xcf97('0x6'));var sox=require(_0xcf97('0x7'));var csv=require(_0xcf97('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf97('0x9'));var _=require('lodash');var squel=require(_0xcf97('0xa'));var crypto=require(_0xcf97('0xb'));var jsforce=require(_0xcf97('0xc'));var deskjs=require(_0xcf97('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcf97('0xe'));var Papa=require('papaparse');var Redis=require(_0xcf97('0xf'));var authService=require(_0xcf97('0x10'));var qs=require(_0xcf97('0x11'));var as=require(_0xcf97('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xcf97('0x13'));var logger=require('../../config/logger')(_0xcf97('0x14'));var utils=require(_0xcf97('0x15'));var config=require(_0xcf97('0x16'));var licenseUtil=require(_0xcf97('0x17'));var db=require(_0xcf97('0x18'))['db'];config[_0xcf97('0x19')]=_[_0xcf97('0x1a')](config[_0xcf97('0x19')],{'host':_0xcf97('0x1b'),'port':0x18eb});var socket=require(_0xcf97('0x1c'))(new Redis(config[_0xcf97('0x19')]));require(_0xcf97('0x1d'))[_0xcf97('0x1e')](socket);function respondWithStatusCode(_0x401ea7,_0x43100c){_0x43100c=_0x43100c||0xcc;return function(_0x5b4919){if(_0x5b4919){return _0x401ea7[_0xcf97('0x1f')](_0x43100c);}return _0x401ea7[_0xcf97('0x20')](_0x43100c)[_0xcf97('0x21')]();};}function respondWithResult(_0x3e57d8,_0x1a3ee1){_0x1a3ee1=_0x1a3ee1||0xc8;return function(_0x274009){if(_0x274009){return _0x3e57d8[_0xcf97('0x20')](_0x1a3ee1)['json'](_0x274009);}};}function respondWithFilteredResult(_0x5235dc,_0x4e8fd8){return function(_0x414db6){if(_0x414db6){var _0x315307=typeof _0x4e8fd8[_0xcf97('0x22')]===_0xcf97('0x23')&&typeof _0x4e8fd8[_0xcf97('0x24')]===_0xcf97('0x23');var _0x591e99=_0x414db6[_0xcf97('0x25')];var _0x82280f=_0x315307?0x0:_0x4e8fd8[_0xcf97('0x22')];var _0x19eb29=_0x315307?_0x414db6[_0xcf97('0x25')]:_0x4e8fd8[_0xcf97('0x22')]+_0x4e8fd8[_0xcf97('0x24')];var _0x4cb570;if(_0x19eb29>=_0x591e99){_0x19eb29=_0x591e99;_0x4cb570=0xc8;}else{_0x4cb570=0xce;}_0x5235dc[_0xcf97('0x20')](_0x4cb570);return _0x5235dc[_0xcf97('0x26')](_0xcf97('0x27'),_0x82280f+'-'+_0x19eb29+'/'+_0x591e99)[_0xcf97('0x28')](_0x414db6);}return null;};}function patchUpdates(_0x159d1b){return function(_0x1c62b9){try{jsonpatch[_0xcf97('0x29')](_0x1c62b9,_0x159d1b,!![]);}catch(_0x2a942c){return BPromise['reject'](_0x2a942c);}return _0x1c62b9[_0xcf97('0x2a')]();};}function saveUpdates(_0x4b3443,_0x3ac284){return function(_0x25d1b3){if(_0x25d1b3){return _0x25d1b3[_0xcf97('0x2b')](_0x4b3443)[_0xcf97('0x2c')](function(_0x306390){return _0x306390;});}return null;};}function removeEntity(_0xf0fb8,_0x40fdd1){return function(_0x5653b7){if(_0x5653b7){return _0x5653b7[_0xcf97('0x2d')]()[_0xcf97('0x2c')](function(){_0xf0fb8['status'](0xcc)[_0xcf97('0x21')]();});}};}function handleEntityNotFound(_0x166caa,_0xdec097){return function(_0x4bd51e){if(!_0x4bd51e){_0x166caa['sendStatus'](0x194);}return _0x4bd51e;};}function handleError(_0x1fe2c5,_0x2469c1){_0x2469c1=_0x2469c1||0x1f4;return function(_0x4ddc66){logger['error'](_0x4ddc66[_0xcf97('0x2e')]);if(_0x4ddc66[_0xcf97('0x2f')]){delete _0x4ddc66['name'];}_0x1fe2c5[_0xcf97('0x20')](_0x2469c1)[_0xcf97('0x30')](_0x4ddc66);};}function getInteractionUsers(_0x28f7de,_0x2f6ff3){return new BPromise(function(_0x322a5e,_0x409cb9){try{if(_0x2f6ff3[_0x28f7de['id']]){_0x28f7de[_0xcf97('0x31')]=_[_0xcf97('0x32')](_0x2f6ff3[_0x28f7de['id']],function(_0x226b88){return{'id':_0x226b88['id'],'fullname':_0x226b88[_0xcf97('0x33')]};});}}catch(_0x3d2daa){_0x409cb9(_0x3d2daa);}_0x322a5e(_0x28f7de);});}function getInteractionTags(_0x402e84,_0x26e535){return new BPromise(function(_0x3ff3cf,_0x273d43){try{if(_0x402e84[_0xcf97('0x34')]){_0x402e84[_0xcf97('0x35')]=[];_0x402e84['TagIds'][_0xcf97('0x36')](',')[_0xcf97('0x37')](function(_0x14dcc5){_0x402e84[_0xcf97('0x35')][_0xcf97('0x38')](_0x26e535[_0x14dcc5]);});}delete _0x402e84[_0xcf97('0x34')];}catch(_0x249966){_0x273d43(_0x249966);}_0x3ff3cf(_0x402e84);});}function updateOpenchannelInteraction(_0x2a462b,_0x2437b9,_0x134be0){return new BPromise(function(_0x5604c1,_0x1f7c2e){return getInteractionUsers(_0x2a462b,_0x134be0)['then'](function(_0x160db1){return getInteractionTags(_0x160db1,_0x2437b9);})['then'](function(_0x2a7cc5){_0x5604c1(_0x2a7cc5);})[_0xcf97('0x39')](function(_0x30ffc2){_0x1f7c2e(_0x30ffc2);});});}exports[_0xcf97('0x3a')]=function(_0x3cc609,_0xf05ace){var _0x3ce337={},_0x59f4d3={},_0x1cd67c={'count':0x0,'rows':[]};var _0x1b57f4=_[_0xcf97('0x32')](db[_0xcf97('0x3b')][_0xcf97('0x3c')],function(_0xf95dcd){return{'name':_0xf95dcd[_0xcf97('0x3d')],'type':_0xf95dcd[_0xcf97('0x3e')][_0xcf97('0x3f')]};});_0x59f4d3[_0xcf97('0x40')]=_[_0xcf97('0x32')](_0x1b57f4,'name');_0x59f4d3['query']=_[_0xcf97('0x41')](_0x3cc609['query']);_0x59f4d3['filters']=_[_0xcf97('0x42')](_0x59f4d3[_0xcf97('0x40')],_0x59f4d3[_0xcf97('0x43')]);_0x3ce337[_0xcf97('0x44')]=_[_0xcf97('0x42')](_0x59f4d3['model'],qs[_0xcf97('0x45')](_0x3cc609[_0xcf97('0x43')]['fields']));_0x3ce337['attributes']=_0x3ce337['attributes'][_0xcf97('0x46')]?_0x3ce337[_0xcf97('0x44')]:_0x59f4d3[_0xcf97('0x40')];if(!_0x3cc609[_0xcf97('0x43')]['hasOwnProperty'](_0xcf97('0x47'))){_0x3ce337[_0xcf97('0x24')]=qs['limit'](_0x3cc609[_0xcf97('0x43')][_0xcf97('0x24')]);_0x3ce337['offset']=qs['offset'](_0x3cc609['query'][_0xcf97('0x22')]);}_0x3ce337[_0xcf97('0x48')]=qs['sort'](_0x3cc609[_0xcf97('0x43')][_0xcf97('0x49')]);_0x3ce337['where']=qs[_0xcf97('0x4a')](_[_0xcf97('0x4b')](_0x3cc609['query'],_0x59f4d3[_0xcf97('0x4a')]),_0x1b57f4);var _0x4f35e8=[];var _0x134f6d=squel[_0xcf97('0x4c')]()[_0xcf97('0x4d')]('id')[_0xcf97('0x4d')](_0xcf97('0x2f'))['field'](_0xcf97('0x4e'))[_0xcf97('0x4f')]('tools_tags');var _0xb0e769=squel[_0xcf97('0x4c')]()['field'](_0xcf97('0x50'))[_0xcf97('0x4d')]('u.fullname')[_0xcf97('0x4d')](_0xcf97('0x51'))[_0xcf97('0x4f')](_0xcf97('0x52'),'ui')[_0xcf97('0x53')]('users','u','u.id\x20=\x20ui.UserId');var _0x5b66fa=squel[_0xcf97('0x4c')]()[_0xcf97('0x4f')](_0xcf97('0x54'),'i')[_0xcf97('0x53')](_0xcf97('0x55'),'c',_0xcf97('0x56'))[_0xcf97('0x53')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xcf97('0x57'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join'](_0xcf97('0x58'),'me',_0xcf97('0x59'))[_0xcf97('0x53')](_0xcf97('0x5a'),'it',_0xcf97('0x5b'))[_0xcf97('0x53')](_0xcf97('0x5c'),'t','t.id\x20=\x20it.TagId');var _0x813500=squel[_0xcf97('0x5d')]();var _0x4108c0=[];var _0x2e046a=squel['expr']();var _0x203d70;if(_0x3cc609[_0xcf97('0x43')]['search']){_0x203d70=as[_0xcf97('0x5e')](_0x3cc609['query'][_0xcf97('0x5f')]);var _0x50ba72=_0x203d70['sqlOperator'];for(var _0x11d03a=0x0;_0x11d03a<_0x203d70[_0xcf97('0x60')]['length'];_0x11d03a++){var _0x13374e=_0x203d70[_0xcf97('0x60')][_0x11d03a];var _0x41f9d7='i';var _0x332747=_['find'](_0x1b57f4,[_0xcf97('0x2f'),_0x13374e['field']]);if(!_0x332747){switch(_0x13374e['field']){case'unreadMessages':if(_0x13374e[_0xcf97('0x61')]==0x1){_0x5b66fa['having']('`'+_0x13374e[_0xcf97('0x4d')]+_0xcf97('0x62'));}else{_0x5b66fa['having']('`'+_0x13374e[_0xcf97('0x4d')]+'`\x20>\x200');}break;case'Contact':if(_0x13374e[_0xcf97('0x63')]===_0xcf97('0x64')){if(_0x13374e[_0xcf97('0x61')][_0xcf97('0x36')]('\x20')[_0xcf97('0x46')]>0x1){_0x813500[_0x50ba72](_0xcf97('0x65'),qs[_0xcf97('0x66')](_0x13374e[_0xcf97('0x61')]),null);}else{var _0x501121='%'+_0x13374e['value']+'%';_0x813500[_0x50ba72](_0xcf97('0x67'),_0x501121,_0x501121,_0x501121);}}else{_0x332747=_[_0xcf97('0x68')](_0x1b57f4,[_0xcf97('0x2f'),_0xcf97('0x69')]);_0x13374e[_0xcf97('0x4d')]='ContactId';_0x572506=as['buildExpression'](_0x41f9d7,_0x332747[_0xcf97('0x3e')],_0x13374e);_0x813500[_0x50ba72](_0x572506['text'],_0x572506[_0xcf97('0x61')][_0xcf97('0x6a')],_0x572506[_0xcf97('0x61')]['end']);}break;case _0xcf97('0x6b'):var _0x4257da=_0x13374e['value']['split'](',')[_0xcf97('0x32')](function(_0x36d515){return Number(_0x36d515);});_0x4257da[_0xcf97('0x37')](function(_0x31723e){_0x2e046a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x31723e+',%');});_0x4108c0=_[_0xcf97('0x6c')](_0x4108c0,_0x4257da);break;case _0xcf97('0x6d'):if(_0x13374e['operator']===_0xcf97('0x64')){_0x813500[_0x50ba72](_0xcf97('0x6e'),'%'+_0x13374e['value']+'%',null);}else{_0x332747=_[_0xcf97('0x68')](_0x1b57f4,[_0xcf97('0x2f'),_0xcf97('0x6f')]);_0x13374e[_0xcf97('0x4d')]=_0xcf97('0x6f');_0x572506=as[_0xcf97('0x70')](_0x41f9d7,_0x332747[_0xcf97('0x3e')],_0x13374e);_0x813500[_0x50ba72](_0x572506['text'],_0x572506[_0xcf97('0x61')][_0xcf97('0x6a')],_0x572506['value'][_0xcf97('0x21')]);}break;case'body':_0x572506=as[_0xcf97('0x70')]('me',null,_0x13374e);_0x813500[_0x50ba72](_0x572506[_0xcf97('0x71')],_0x572506[_0xcf97('0x61')]['start'],_0x572506[_0xcf97('0x61')][_0xcf97('0x21')]);break;}}else{var _0x572506=as[_0xcf97('0x70')](_0x41f9d7,_0x332747['type'],_0x13374e);_0x813500[_0x50ba72](_0x572506[_0xcf97('0x71')],_0x572506[_0xcf97('0x61')][_0xcf97('0x6a')],_0x572506[_0xcf97('0x61')]['end']);}}}else{var _0x107375=_(_0x3cc609[_0xcf97('0x43')])[_0xcf97('0x41')]()[_0xcf97('0x32')](function(_0x54579b){return _[_0xcf97('0x72')](_0x1b57f4,['name',_0x54579b])?_0x54579b:undefined;})[_0xcf97('0x73')]()[_0xcf97('0x61')]();if(!_[_0xcf97('0x74')](_0x107375)){_0x107375['forEach'](function(_0x16647f){if(_0x16647f===_0xcf97('0x75')){_0x5b66fa['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0xcf97('0x76')](_0x3cc609['query'][_0x16647f]));}else if(_0x16647f==='createdAt'){var _0x11c45b=JSON[_0xcf97('0x77')](_0x3cc609[_0xcf97('0x43')][_0x16647f])[_0xcf97('0x78')];var _0x5a3082=JSON[_0xcf97('0x77')](_0x3cc609['query'][_0x16647f])['$lte'];_0x5b66fa[_0xcf97('0x79')](_0xcf97('0x7a'),_0x11c45b,_0x5a3082);}else{if(_0x3cc609[_0xcf97('0x43')][_0x16647f]===_0xcf97('0x7b')){_0x5b66fa[_0xcf97('0x79')]('i.'+_0x16647f+_0xcf97('0x7c'));}else{_0x5b66fa[_0xcf97('0x79')]('i.'+_0x16647f+_0xcf97('0x7d'),_0x3cc609[_0xcf97('0x43')][_0x16647f]);}}});}if(_0x3cc609[_0xcf97('0x43')]['read']){if(_0x3cc609[_0xcf97('0x43')][_0xcf97('0x7e')]==0x1){_0x5b66fa[_0xcf97('0x7f')](_0xcf97('0x80'));}else{_0x5b66fa[_0xcf97('0x7f')]('`unreadMessages`\x20>\x200');}}if(_0x3cc609[_0xcf97('0x43')][_0xcf97('0x81')]){_0x4108c0=_[_0xcf97('0x82')](_0x3cc609[_0xcf97('0x43')][_0xcf97('0x81')])?_0x3cc609[_0xcf97('0x43')]['tag']:new Array(_0x3cc609[_0xcf97('0x43')][_0xcf97('0x81')]);_0x4108c0[_0xcf97('0x37')](function(_0x47cb59){_0x2e046a['or'](_0xcf97('0x83'),'%,'+_0x47cb59+',%');});}if(_0x3cc609[_0xcf97('0x43')][_0xcf97('0x84')]){var _0x237162=_0x3cc609[_0xcf97('0x43')]['filter'][_0xcf97('0x85')]('\x5c','\x5c\x5c')[_0xcf97('0x85')](/'/g,'\x27\x27');if(qs[_0xcf97('0x86')](_0x237162)){_0x813500['or'](_0xcf97('0x87'),_0x237162+'%');}else{_0x813500['or'](_0xcf97('0x88'),qs['getFullTextValue'](_0x237162))['or']('i.from\x20LIKE\x20?',_0x237162+'%')['or'](_0xcf97('0x89'),_0x237162+'%');}}}_0x5b66fa[_0xcf97('0x79')](_0x813500);_0x5b66fa[_0xcf97('0x8a')](_0xcf97('0x8b'));var _0x152273={'type':db['Sequelize'][_0xcf97('0x8c')][_0xcf97('0x8d')],'raw':!![]};var _0x5f3ac7=_0x5b66fa[_0xcf97('0x8e')]();_0x5f3ac7['field'](_0xcf97('0x8b'));_0x5f3ac7['field'](_0xcf97('0x8f'),_0xcf97('0x90'));if(_0x3ce337[_0xcf97('0x48')]){_0x3ce337[_0xcf97('0x48')][_0xcf97('0x37')](function(_0x271a96){var _0x542417=_0x271a96[0x0]===_0xcf97('0x91')?_0x271a96[0x0]:'i.'+_0x271a96[0x0];_0x5b66fa['order'](_0x542417,_0x271a96[0x1]===_0xcf97('0x92')?![]:!![]);});}if(!_[_0xcf97('0x74')](_0x4108c0)){_0x5b66fa[_0xcf97('0x7f')](_0x2e046a);_0x5f3ac7[_0xcf97('0x79')](_0xcf97('0x93'),_0x4108c0);}BPromise[_0xcf97('0x94')]()[_0xcf97('0x2c')](function(){if(!_0x203d70){if(_0x3cc609[_0xcf97('0x43')]['OpenchannelAccountId'])return;_0x5f3ac7['where'](_0xcf97('0x95'));_0x5b66fa[_0xcf97('0x79')](_0xcf97('0x95'));return;}if(_0x3cc609[_0xcf97('0x96')][_0xcf97('0x97')]!=='agent')return;return _0x3cc609['user'][_0xcf97('0x98')]({'attributes':['id'],'raw':!![]})[_0xcf97('0x2c')](function(_0x5c3e37){if(_[_0xcf97('0x74')](_0x5c3e37)){_0x5f3ac7[_0xcf97('0x79')](_0xcf97('0x99'));_0x5b66fa['where'](_0xcf97('0x99'));}else{_0x5f3ac7[_0xcf97('0x79')](_0xcf97('0x9a'),_[_0xcf97('0x32')](_0x5c3e37,'id'));_0x5b66fa[_0xcf97('0x79')](_0xcf97('0x9a'),_[_0xcf97('0x32')](_0x5c3e37,'id'));}});})[_0xcf97('0x2c')](function(){if(_0x3cc609[_0xcf97('0x96')][_0xcf97('0x97')]===_0xcf97('0x9b')&&!_0x203d70&&!_0x3cc609['query'][_0xcf97('0x75')])return[];return db[_0xcf97('0x9c')][_0xcf97('0x43')](_0x5f3ac7[_0xcf97('0x9d')](),_0x152273);})[_0xcf97('0x2c')](function(_0x234fb4){_0x1cd67c[_0xcf97('0x25')]=_0x234fb4[_0xcf97('0x46')];if(_0x1cd67c[_0xcf97('0x25')]===0x0)return[];return db['sequelize'][_0xcf97('0x43')](_0x134f6d[_0xcf97('0x9d')](),_0x152273)[_0xcf97('0x2c')](function(_0x5ad644){_0x4f35e8=_[_0xcf97('0x9e')](_0x5ad644,'id');_0x152273=_[_0xcf97('0x9f')](_0x152273,{'model':db[_0xcf97('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3cc609['query']['fields']){_0x3ce337[_0xcf97('0x44')][_0xcf97('0x37')](function(_0x574b0a){_0x5b66fa[_0xcf97('0x4d')]('i.'+_0x574b0a);});}else{_0x5b66fa[_0xcf97('0x4d')](_0xcf97('0x8f'),_0xcf97('0x90'));_0x5b66fa['field'](_0xcf97('0xa0'),_0xcf97('0xa1'));_0x5b66fa[_0xcf97('0x4d')]('a.mandatoryDisposition',_0xcf97('0xa2'));_0x5b66fa[_0xcf97('0x4d')](_0xcf97('0xa3'),_0xcf97('0x91'));_0x5b66fa[_0xcf97('0x4d')](_0xcf97('0xa4'));_0x5b66fa[_0xcf97('0x4d')](_0xcf97('0xa5'),'Contact.firstName');_0x5b66fa[_0xcf97('0x4d')](_0xcf97('0xa6'),_0xcf97('0xa7'));_0x5b66fa[_0xcf97('0x4d')](_0xcf97('0xa8'),_0xcf97('0xa9'));_0x5b66fa[_0xcf97('0x4d')](_0xcf97('0xaa'),_0xcf97('0xab'));_0x5b66fa['field'](_0xcf97('0xac'),_0xcf97('0xad'));_0x5b66fa['field'](_0xcf97('0xae'),_0xcf97('0xaf'));_0x5b66fa[_0xcf97('0x4d')](_0xcf97('0xb0'),_0xcf97('0xb1'));_0x5b66fa[_0xcf97('0x4d')](_0xcf97('0xb2'),_0xcf97('0xb3'));_0x5b66fa[_0xcf97('0x4d')](_0xcf97('0xb4'),_0xcf97('0x34'));}if(_0x3ce337['limit'])_0x5b66fa[_0xcf97('0x24')](_0x3ce337[_0xcf97('0x24')]);if(_0x3ce337['offset'])_0x5b66fa[_0xcf97('0x22')](_0x3ce337[_0xcf97('0x22')]);return db['sequelize'][_0xcf97('0x43')](_0x5b66fa[_0xcf97('0x9d')](),_0x152273);})['then'](function(_0x170e7c){if(_0x170e7c[_0xcf97('0x46')]>0x0)_0xb0e769['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xcf97('0x32')](_0x170e7c,'id'));return db[_0xcf97('0x9c')][_0xcf97('0x43')](_0xb0e769[_0xcf97('0x9d')](),_0x152273)[_0xcf97('0x2c')](function(_0x2d5675){var _0x53462b=_['groupBy'](_0x2d5675,'OpenchannelInteractionId');var _0x25e8c3=[];_0x170e7c[_0xcf97('0x37')](function(_0x1851ab){_0x25e8c3[_0xcf97('0x38')](updateOpenchannelInteraction(_0x1851ab,_0x4f35e8,_0x53462b));});return BPromise[_0xcf97('0xb5')](_0x25e8c3);});});})[_0xcf97('0x2c')](function(_0x4e6f61){_0x1cd67c['rows']=_0x4e6f61;return _0x1cd67c;})[_0xcf97('0x2c')](respondWithFilteredResult(_0xf05ace,_0x3ce337))['catch'](handleError(_0xf05ace,null));};exports['show']=function(_0x204808,_0x27bf53){var _0xd6af53={};if(_0x204808[_0xcf97('0x43')][_0xcf97('0x3e')]&&_0x204808[_0xcf97('0x43')][_0xcf97('0x3e')]===_0xcf97('0x4f')){_0xd6af53[_0xcf97('0x4f')]=_0x204808['params']['id'];}else{_0xd6af53['id']=_0x204808[_0xcf97('0xb6')]['id'];}var _0x2434e1={'raw':![],'where':_0xd6af53},_0x41cd14={};_0x41cd14[_0xcf97('0x40')]=_['keys'](db[_0xcf97('0x3b')][_0xcf97('0x3c')]);_0x41cd14[_0xcf97('0x43')]=_[_0xcf97('0x41')](_0x204808[_0xcf97('0x43')]);_0x41cd14[_0xcf97('0x4a')]=_[_0xcf97('0x42')](_0x41cd14[_0xcf97('0x40')],_0x41cd14['query']);_0x2434e1[_0xcf97('0x44')]=_[_0xcf97('0x42')](_0x41cd14[_0xcf97('0x40')],qs[_0xcf97('0x45')](_0x204808[_0xcf97('0x43')][_0xcf97('0x45')]));_0x2434e1[_0xcf97('0x44')]=_0x2434e1['attributes'][_0xcf97('0x46')]?_0x2434e1[_0xcf97('0x44')]:_0x41cd14[_0xcf97('0x40')];if(_0x204808[_0xcf97('0x43')][_0xcf97('0xb7')]){_0x2434e1[_0xcf97('0xb8')]=[{'all':!![]}];}_0x2434e1=_[_0xcf97('0x9f')]({},_0x2434e1,_0x204808[_0xcf97('0xb9')]);return db['OpenchannelInteraction'][_0xcf97('0x68')](_0x2434e1)[_0xcf97('0x2c')](handleEntityNotFound(_0x27bf53,null))[_0xcf97('0x2c')](respondWithResult(_0x27bf53,null))[_0xcf97('0x39')](handleError(_0x27bf53,null));};exports['create']=function(_0x4941b2,_0x17c4d2){return db[_0xcf97('0x3b')][_0xcf97('0xba')](_0x4941b2[_0xcf97('0xbb')],{})[_0xcf97('0x2c')](respondWithResult(_0x17c4d2,0xc9))[_0xcf97('0x39')](handleError(_0x17c4d2,null));};exports[_0xcf97('0x2b')]=function(_0x3c6fe7,_0x330f64){if(_0x3c6fe7[_0xcf97('0xbb')]['id']){delete _0x3c6fe7[_0xcf97('0xbb')]['id'];}return db['OpenchannelInteraction'][_0xcf97('0x68')]({'where':{'id':_0x3c6fe7['params']['id']}})[_0xcf97('0x2c')](handleEntityNotFound(_0x330f64,null))[_0xcf97('0x2c')](saveUpdates(_0x3c6fe7['body'],null))[_0xcf97('0x2c')](respondWithResult(_0x330f64,null))[_0xcf97('0x39')](handleError(_0x330f64,null));};exports['destroy']=function(_0x489b70,_0x129fc2){return db['OpenchannelInteraction']['find']({'where':{'id':_0x489b70['params']['id']}})[_0xcf97('0x2c')](handleEntityNotFound(_0x129fc2,null))[_0xcf97('0x2c')](removeEntity(_0x129fc2,null))[_0xcf97('0x39')](handleError(_0x129fc2,null));};exports['describe']=function(_0x36898c,_0x509d53){return db[_0xcf97('0x3b')][_0xcf97('0xbc')]()['then'](respondWithResult(_0x509d53,null))['catch'](handleError(_0x509d53,null));};exports['addMessage']=function(_0x19dc81,_0x13a76b,_0x5ade37){return db[_0xcf97('0xbd')]['find']({'where':{'id':_0x19dc81[_0xcf97('0xb6')]['id']}})[_0xcf97('0x2c')](handleEntityNotFound(_0x13a76b,null))[_0xcf97('0x2c')](function(_0x1a46ac){if(_0x1a46ac){return _0x1a46ac[_0xcf97('0xbe')](_0x19dc81['body'][_0xcf97('0xbf')],_[_0xcf97('0xc0')](_0x19dc81[_0xcf97('0xbb')],[_0xcf97('0xbf'),'id'])||{});}})['then'](respondWithResult(_0x13a76b,null))[_0xcf97('0x39')](handleError(_0x13a76b,null));};exports['getMessages']=function(_0xee3cbe,_0x2d23b9,_0x293b2a){var _0x33f012={'raw':![],'where':{}};var _0x3bd0d5={};var _0x3d0dc3={'count':0x0,'rows':[]};return db[_0xcf97('0x3b')]['findOne']({'where':{'id':_0xee3cbe['params']['id']}})[_0xcf97('0x2c')](handleEntityNotFound(_0x2d23b9,null))[_0xcf97('0x2c')](function(_0x3610d9){if(_0x3610d9){_0x3bd0d5[_0xcf97('0x40')]=_[_0xcf97('0x41')](db[_0xcf97('0xbd')][_0xcf97('0x3c')]);_0x3bd0d5[_0xcf97('0x43')]=_[_0xcf97('0x41')](_0xee3cbe[_0xcf97('0x43')]);_0x3bd0d5['filters']=_[_0xcf97('0x42')](_0x3bd0d5[_0xcf97('0x40')],_0x3bd0d5[_0xcf97('0x43')]);_0x33f012[_0xcf97('0x44')]=_[_0xcf97('0x42')](_0x3bd0d5[_0xcf97('0x40')],qs[_0xcf97('0x45')](_0xee3cbe[_0xcf97('0x43')][_0xcf97('0x45')]));_0x33f012[_0xcf97('0x44')]=_0x33f012[_0xcf97('0x44')]['length']?_0x33f012[_0xcf97('0x44')]:_0x3bd0d5[_0xcf97('0x40')];if(!_0xee3cbe[_0xcf97('0x43')]['hasOwnProperty'](_0xcf97('0x47'))){_0x33f012[_0xcf97('0x24')]=qs['limit'](_0xee3cbe[_0xcf97('0x43')][_0xcf97('0x24')]);_0x33f012[_0xcf97('0x22')]=qs[_0xcf97('0x22')](_0xee3cbe[_0xcf97('0x43')][_0xcf97('0x22')]);}_0x33f012[_0xcf97('0x48')]=qs[_0xcf97('0x49')](_0xee3cbe[_0xcf97('0x43')][_0xcf97('0x49')]);_0x33f012['where']=qs[_0xcf97('0x4a')](_[_0xcf97('0x4b')](_0xee3cbe[_0xcf97('0x43')],_0x3bd0d5[_0xcf97('0x4a')]));_0x33f012[_0xcf97('0x79')][_0xcf97('0xc1')]=_0x3610d9['id'];if(_0xee3cbe[_0xcf97('0x43')][_0xcf97('0x84')]){_0x33f012['where']=_[_0xcf97('0x9f')](_0x33f012[_0xcf97('0x79')],{'$or':_[_0xcf97('0x32')](_0x33f012['attributes'],function(_0x32c4ee){var _0x5b04be={};_0x5b04be[_0x32c4ee]={'$like':'%'+_0xee3cbe[_0xcf97('0x43')][_0xcf97('0x84')]+'%'};return _0x5b04be;})});}if(_0xee3cbe[_0xcf97('0x43')]['$gte']){var _0x4dafd4=_0xee3cbe[_0xcf97('0x43')][_0xcf97('0x78')]['split'](',');var _0x116e01={};_0x116e01[_0x4dafd4[0x0]]={'$gte':moment(_0x4dafd4[0x1])[_0xcf97('0xc2')](_0xcf97('0xc3'))};_0x33f012['where']=_['merge'](_0x33f012['where'],_0x116e01);}_0x33f012=_[_0xcf97('0x9f')]({},_0x33f012,_0xee3cbe[_0xcf97('0xb9')]);return db[_0xcf97('0xbd')][_0xcf97('0x25')]({'where':_0x33f012['where']})['then'](function(_0x1d5122){_0x3d0dc3[_0xcf97('0x25')]=_0x1d5122;if(_0xee3cbe['query'][_0xcf97('0xb7')]){_0x33f012[_0xcf97('0xb8')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xcf97('0xc4')](_0x33f012);})['then'](function(_0x58db59){_0x3d0dc3[_0xcf97('0xc5')]=_0x58db59;return _0x3d0dc3;});}})['then'](respondWithFilteredResult(_0x2d23b9,_0x33f012))[_0xcf97('0x39')](handleError(_0x2d23b9,null));};exports['addTags']=function(_0x469b9f,_0x44287f,_0x54af04){return db[_0xcf97('0x3b')][_0xcf97('0x68')]({'where':{'id':_0x469b9f[_0xcf97('0xb6')]['id']}})[_0xcf97('0x2c')](handleEntityNotFound(_0x44287f,null))[_0xcf97('0x2c')](function(_0x4c2904){if(_0x4c2904){return _0x4c2904[_0xcf97('0xc6')](_0x469b9f[_0xcf97('0xbb')]['ids'],_[_0xcf97('0xc0')](_0x469b9f['body'],['ids','id'])||{})[_0xcf97('0xc7')](function(){return db[_0xcf97('0x6b')]['findAll']({'attributes':['id',_0xcf97('0x2f'),_0xcf97('0x4e')],'where':{'id':_0x469b9f[_0xcf97('0xbb')][_0xcf97('0xbf')]}});})[_0xcf97('0x2c')](function(_0x80cfa8){socket[_0xcf97('0xc8')](_0xcf97('0xc9'),{'id':Number(_0x469b9f['params']['id']),'tags':_0x80cfa8||[]});return{'id':Number(_0x469b9f['params']['id']),'tags':_0x80cfa8||[]};});}})[_0xcf97('0x2c')](respondWithResult(_0x44287f,null))['catch'](handleError(_0x44287f,null));};exports['removeTags']=function(_0x15424b,_0x324560,_0x3bc4c2){return db[_0xcf97('0x3b')][_0xcf97('0x68')]({'where':{'id':_0x15424b[_0xcf97('0xb6')]['id']}})[_0xcf97('0x2c')](handleEntityNotFound(_0x324560,null))[_0xcf97('0x2c')](function(_0x3c8574){if(_0x3c8574){return _0x3c8574[_0xcf97('0xca')](_0x15424b['query'][_0xcf97('0xbf')]);}})[_0xcf97('0x2c')](respondWithStatusCode(_0x324560,null))[_0xcf97('0x39')](handleError(_0x324560,null));};exports[_0xcf97('0xcb')]=function(_0x56615a,_0x50d4dc){var _0x3c9cdd=moment()['unix']()['toString']();var _0x245a31=path[_0xcf97('0xcc')](config[_0xcf97('0xcd')],_0xcf97('0xce'),_0xcf97('0xcf'),_0xcf97('0xd0'));var _0x424007=path[_0xcf97('0xcc')](config[_0xcf97('0xcd')],'server',_0xcf97('0xcf'),_0xcf97('0xd1'));var _0x38c076=path[_0xcf97('0xcc')](_0x245a31,_0x3c9cdd);var _0x45d118=util['format'](_0xcf97('0xd2'),_0x56615a[_0xcf97('0xb6')]['id'],_0x3c9cdd);var _0x2250df=path[_0xcf97('0xcc')](_0x245a31,_0x45d118);var _0x1fa8ee=[];_0x1fa8ee[_0xcf97('0x38')]({'model':db['User'],'as':_0xcf97('0x6d'),'attributes':['id',_0xcf97('0x33')],'raw':!![]});_0x1fa8ee[_0xcf97('0x38')]({'model':db[_0xcf97('0xd3')],'as':_0xcf97('0xd4'),'attributes':['id',_0xcf97('0xd5'),_0xcf97('0xd6')],'raw':!![]});if(_0x56615a[_0xcf97('0x43')][_0xcf97('0xd1')]){_0x1fa8ee[_0xcf97('0x38')]({'model':db[_0xcf97('0xd7')],'as':'Attachment','raw':!![]});}var _0x59a33a=[{'model':db['OpenchannelMessage'],'as':_0xcf97('0xd8'),'attributes':['id',_0xcf97('0xbb'),_0xcf97('0xd9'),_0xcf97('0xda'),_0xcf97('0xdb'),_0xcf97('0x7e')],'include':_0x1fa8ee}];_0x59a33a['push']({'model':db[_0xcf97('0xdc')],'as':_0xcf97('0xdd'),'attributes':['id',_0xcf97('0x2f')]});_0x59a33a[_0xcf97('0x38')]({'model':db[_0xcf97('0x6d')],'as':_0xcf97('0xde'),'attributes':['id','fullname']});return db[_0xcf97('0x3b')][_0xcf97('0x68')]({'where':{'id':_0x56615a[_0xcf97('0xb6')]['id']},'include':_0x59a33a})[_0xcf97('0x2c')](handleEntityNotFound(_0x50d4dc,null))[_0xcf97('0x2c')](function(_0x28db9c){if(_0x28db9c){var _0x2584f0=_0x28db9c[_0xcf97('0xdf')]({'plain':!![]});fs[_0xcf97('0xe0')](_0x38c076);var _0x1d2504={'channel':_0xcf97('0xe1'),'account':_0x2584f0['Account']['name'],'agent':_0x2584f0['Owner']?_0x2584f0[_0xcf97('0xde')][_0xcf97('0x33')]:'N.A.','createdAt':moment(_0x2584f0[_0xcf97('0xd9')])[_0xcf97('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xcf97('0x9d')](),'closedAt':_0x2584f0[_0xcf97('0xe2')]?moment(_0x2584f0[_0xcf97('0xe3')])[_0xcf97('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xcf97('0x9d')]():'','disposition':_0x2584f0[_0xcf97('0xe4')],'visibility':_0x2584f0['threadId']?_0xcf97('0xe5'):_0xcf97('0xe6'),'messages':_(_0x2584f0[_0xcf97('0xd8')])['filter']({'secret':![]})[_0xcf97('0x32')](function(_0x5c8641){if(_0x5c8641[_0xcf97('0xd7')]){var _0x318bac=path[_0xcf97('0xcc')](_0x424007,_0x5c8641[_0xcf97('0xd7')][_0xcf97('0xe7')]);if(fs[_0xcf97('0xe8')](_0x318bac)){fs[_0xcf97('0xe9')](_0x318bac)[_0xcf97('0xea')](fs[_0xcf97('0xeb')](path[_0xcf97('0xcc')](_0x38c076,_0x5c8641[_0xcf97('0xd7')][_0xcf97('0xe7')])));}}return{'date':moment(_0x5c8641[_0xcf97('0xd9')])[_0xcf97('0xc2')](_0xcf97('0xc3'))[_0xcf97('0x9d')](),'sender':_0x5c8641['direction']===_0xcf97('0xec')?_0x5c8641[_0xcf97('0x6d')]?_0x5c8641[_0xcf97('0x6d')]['fullname']:_0xcf97('0xed'):_0x5c8641[_0xcf97('0xd4')][_0xcf97('0xd5')]+(_0x5c8641[_0xcf97('0xd4')][_0xcf97('0xd6')]?'\x20'+_0x5c8641[_0xcf97('0xd4')]['lastName']:''),'body':_0x5c8641[_0xcf97('0xd7')]?_0x5c8641['Attachment'][_0xcf97('0xe7')]:_0x5c8641[_0xcf97('0xbb')],'direction':_0x5c8641['direction']===_0xcf97('0xec')?'A':'C','secret':_0x5c8641[_0xcf97('0xdb')],'read':_0x5c8641[_0xcf97('0x7e')],'attachment':_0x5c8641[_0xcf97('0xd7')]};})[_0xcf97('0x61')]()};return ejs['renderFile'](path[_0xcf97('0xcc')](config[_0xcf97('0xcd')],_0xcf97('0xce'),_0xcf97('0xee'),_0xcf97('0xef')),{'interaction':_0x1d2504})[_0xcf97('0x2c')](function(_0x5c6dc7){var _0x3bddc8=path[_0xcf97('0xcc')](_0x38c076,'transcript-'+_0x2584f0['id']+'-'+_0x3c9cdd+'.pdf');var _0x521b3b={'path':_0x3bddc8,'channel':_0xcf97('0xe1'),'interactionId':_0x2584f0['id']};return pdf[_0xcf97('0xf0')](_0x5c6dc7,_0x521b3b);})[_0xcf97('0x2c')](function(){return new BPromise(function(_0x400762,_0x8b50d){zipdir(_0x38c076,{'saveTo':_0x2250df},function(_0x1011d0,_0x23fb9f){if(_0x1011d0)return _0x8b50d(_0x1011d0);return _0x400762(_0x23fb9f);});})[_0xcf97('0x2c')](function(){return new BPromise(function(_0x5978c1,_0x4306dd){rimraf(_0x38c076,function(_0x45b7f9){if(_0x45b7f9)_0x4306dd(_0x45b7f9);return _0x5978c1();});});})[_0xcf97('0x2c')](function(){return _0x50d4dc['download'](_0x2250df,_0x45d118,function(_0x595aa0){if(_0x595aa0){console[_0xcf97('0xf1')](_0xcf97('0xf2'),_0x595aa0);}else{fs['unlinkSync'](_0x2250df);}});});});}else{return _0x50d4dc[_0xcf97('0x1f')](0xc8);}})[_0xcf97('0x39')](handleError(_0x50d4dc,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 2ee7e2f..1923c60 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 _0x7488=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch'];(function(_0x246a25,_0x2c0c46){var _0x5996f4=function(_0x5ae4bb){while(--_0x5ae4bb){_0x246a25['push'](_0x246a25['shift']());}};_0x5996f4(++_0x2c0c46);}(_0x7488,0xff));var _0x8748=function(_0x1ebda4,_0x26561b){_0x1ebda4=_0x1ebda4-0x0;var _0x3d2515=_0x7488[_0x1ebda4];return _0x3d2515;};'use strict';var EventEmitter=require(_0x8748('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x8748('0x1'))['db'][_0x8748('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8748('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8748('0x4'),'afterDestroy':_0x8748('0x5')};function emitEvent(_0x177942){return function(_0x2f3285,_0x4fbc88,_0x32e9a6){_0x2f3285['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3c7fa4){_0x2f3285[_0x8748('0x6')](_0x8748('0x7'),_0x3c7fa4[_0x8748('0x8')](function(_0x304ba9){return{'id':_0x304ba9['id']};}));return OpenchannelMessage[_0x8748('0x9')]({'where':{'OpenchannelInteractionId':_0x2f3285['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8748('0xa')](function(_0x501332){_0x2f3285[_0x8748('0x6')](_0x8748('0xb'),_0x501332[_0x8748('0xc')]);OpenchannelInteractionEvents[_0x8748('0xd')](_0x177942+':'+_0x2f3285['id'],_0x2f3285);OpenchannelInteractionEvents[_0x8748('0xd')](_0x177942,_0x2f3285);_0x32e9a6(null);})[_0x8748('0xe')](_0x32e9a6(null));};}for(var e in events){if(events[_0x8748('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x8748('0x10')](e,emitEvent(event));}}module[_0x8748('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6d62=['setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','hook','exports','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x43160b,_0x4e067c){var _0x3b09c0=function(_0x18eea9){while(--_0x18eea9){_0x43160b['push'](_0x43160b['shift']());}};_0x3b09c0(++_0x4e067c);}(_0x6d62,0xab));var _0x26d6=function(_0x24a15e,_0x4862ce){_0x24a15e=_0x24a15e-0x0;var _0x10256f=_0x6d62[_0x24a15e];return _0x10256f;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0x26d6('0x0')];var OpenchannelMessage=require(_0x26d6('0x1'))['db'][_0x26d6('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x26d6('0x3')](0x0);var events={'afterCreate':_0x26d6('0x4'),'afterUpdate':_0x26d6('0x5'),'afterDestroy':_0x26d6('0x6')};function emitEvent(_0x41546a){return function(_0x162c20,_0x11c543,_0x2ff18c){_0x162c20[_0x26d6('0x7')]({'attributes':['id'],'raw':!![]})[_0x26d6('0x8')](function(_0x39e24e){_0x162c20[_0x26d6('0x9')](_0x26d6('0xa'),_0x39e24e[_0x26d6('0xb')](function(_0x4c760e){return{'id':_0x4c760e['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x162c20['id'],'direction':'in','read':![]},'raw':!![]});})[_0x26d6('0x8')](function(_0x268ce1){_0x162c20[_0x26d6('0x9')](_0x26d6('0xc'),_0x268ce1['length']);OpenchannelInteractionEvents[_0x26d6('0xd')](_0x41546a+':'+_0x162c20['id'],_0x162c20);OpenchannelInteractionEvents[_0x26d6('0xd')](_0x41546a,_0x162c20);_0x2ff18c(null);})[_0x26d6('0xe')](_0x2ff18c(null));};}for(var e in events){if(events[_0x26d6('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x26d6('0x10')](e,emitEvent(event));}}module[_0x26d6('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index bdc8387..b200994 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 _0x0eee=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x497771,_0x1b00bc){var _0x2b9c8f=function(_0x12449e){while(--_0x12449e){_0x497771['push'](_0x497771['shift']());}};_0x2b9c8f(++_0x1b00bc);}(_0x0eee,0xb3));var _0xe0ee=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x0eee[_0x187ee1];return _0x388160;};'use strict';var _=require(_0xe0ee('0x0'));var util=require(_0xe0ee('0x1'));var logger=require(_0xe0ee('0x2'))('api');var moment=require(_0xe0ee('0x3'));var BPromise=require(_0xe0ee('0x4'));var rp=require(_0xe0ee('0x5'));var fs=require('fs');var path=require(_0xe0ee('0x6'));var rimraf=require(_0xe0ee('0x7'));var config=require(_0xe0ee('0x8'));var attributes=require(_0xe0ee('0x9'));module[_0xe0ee('0xa')]=function(_0x4a23f7,_0x1ca37d){return _0x4a23f7[_0xe0ee('0xb')](_0xe0ee('0xc'),attributes,{'tableName':_0xe0ee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe0ee('0xe'),'hooks':{'beforeUpdate':function(_0x5a0b9d,_0x48daf1,_0xd6ac51){if(_0x5a0b9d[_0xe0ee('0xf')](_0xe0ee('0x10'))){_0x5a0b9d[_0xe0ee('0x11')]=moment()[_0xe0ee('0x12')](_0xe0ee('0x13'));}_0xd6ac51(null,_0x5a0b9d);}}});}; \ No newline at end of file +var _0x561d=['./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x561d,0x1f1));var _0xd561=function(_0x1aaf85,_0x17321d){_0x1aaf85=_0x1aaf85-0x0;var _0x3dc3f6=_0x561d[_0x1aaf85];return _0x3dc3f6;};'use strict';var _=require(_0xd561('0x0'));var util=require(_0xd561('0x1'));var logger=require(_0xd561('0x2'))(_0xd561('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd561('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd561('0x5'));var config=require(_0xd561('0x6'));var attributes=require(_0xd561('0x7'));module[_0xd561('0x8')]=function(_0x429d6f,_0x55ae30){return _0x429d6f[_0xd561('0x9')](_0xd561('0xa'),attributes,{'tableName':_0xd561('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd561('0xc'),'collate':_0xd561('0xd'),'hooks':{'beforeUpdate':function(_0x1d1c2b,_0x3dd43c,_0x313972){if(_0x1d1c2b['changed'](_0xd561('0xe'))){_0x1d1c2b[_0xd561('0xf')]=moment()[_0xd561('0x10')](_0xd561('0x11'));}_0x313972(null,_0x1d1c2b);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 945c9a4..4a619db 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 _0x7a8b=['stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','OpenchannelInteraction','body','options','raw','where','attributes','limit','then','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2abf30,_0x60db85){var _0x35d722=function(_0x1edf74){while(--_0x1edf74){_0x2abf30['push'](_0x2abf30['shift']());}};_0x35d722(++_0x60db85);}(_0x7a8b,0x8d));var _0xb7a8=function(_0x4dda47,_0x3f345d){_0x4dda47=_0x4dda47-0x0;var _0x43a2b7=_0x7a8b[_0x4dda47];return _0x43a2b7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb7a8('0x0'));var BPromise=require(_0xb7a8('0x1'));var rs=require(_0xb7a8('0x2'));var fs=require('fs');var Redis=require(_0xb7a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb7a8('0x4'))(_0xb7a8('0x5'));var config=require(_0xb7a8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb7a8('0x7')][_0xb7a8('0x8')]({'port':0x232a});config['redis']=_[_0xb7a8('0x9')](config[_0xb7a8('0xa')],{'host':_0xb7a8('0xb'),'port':0x18eb});var socket=require(_0xb7a8('0xc'))(new Redis(config['redis']));require(_0xb7a8('0xd'))[_0xb7a8('0xe')](socket);function respondWithRpcPromise(_0x102baf,_0x382215,_0x2732b9){return new BPromise(function(_0x31e184,_0x2568ee){return client['request'](_0x102baf,_0x2732b9)['then'](function(_0x174b71){logger[_0xb7a8('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x382215,'request\x20sent');logger[_0xb7a8('0x10')](_0xb7a8('0x11'),_0x382215,_0xb7a8('0x12'),JSON[_0xb7a8('0x13')](_0x174b71));if(_0x174b71['error']){if(_0x174b71[_0xb7a8('0x14')][_0xb7a8('0x15')]===0x1f4){logger[_0xb7a8('0x14')](_0xb7a8('0x16'),_0x382215,_0x174b71[_0xb7a8('0x14')][_0xb7a8('0x17')]);return _0x2568ee(_0x174b71[_0xb7a8('0x14')][_0xb7a8('0x17')]);}logger[_0xb7a8('0x14')](_0xb7a8('0x16'),_0x382215,_0x174b71['error'][_0xb7a8('0x17')]);return _0x31e184(_0x174b71[_0xb7a8('0x14')][_0xb7a8('0x17')]);}else{logger[_0xb7a8('0xf')](_0xb7a8('0x16'),_0x382215,_0xb7a8('0x12'));_0x31e184(_0x174b71['result'][_0xb7a8('0x17')]);}})['catch'](function(_0x5cf34b){logger[_0xb7a8('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x382215,_0x5cf34b);_0x2568ee(_0x5cf34b);});});}exports['UpdateOpenchannelInteraction']=function(_0x323a43){var _0x264b69=this;return new Promise(function(_0x3f66fb,_0x2cf172){return db[_0xb7a8('0x18')]['update'](_0x323a43[_0xb7a8('0x19')],{'raw':_0x323a43['options']?_0x323a43[_0xb7a8('0x1a')][_0xb7a8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x323a43['options']?_0x323a43[_0xb7a8('0x1a')][_0xb7a8('0x1c')]||null:null,'attributes':_0x323a43[_0xb7a8('0x1a')]?_0x323a43[_0xb7a8('0x1a')][_0xb7a8('0x1d')]||null:null,'limit':_0x323a43[_0xb7a8('0x1a')]?_0x323a43[_0xb7a8('0x1a')][_0xb7a8('0x1e')]||null:null})[_0xb7a8('0x1f')](function(_0x5e7681){logger[_0xb7a8('0xf')]('UpdateOpenchannelInteraction',_0x323a43);logger[_0xb7a8('0x10')](_0xb7a8('0x20'),_0x323a43,JSON[_0xb7a8('0x13')](_0x5e7681));_0x3f66fb(_0x5e7681);})[_0xb7a8('0x21')](function(_0xf027c3){logger[_0xb7a8('0x14')](_0xb7a8('0x20'),_0xf027c3[_0xb7a8('0x17')],_0x323a43);_0x2cf172(_0x264b69[_0xb7a8('0x14')](0x1f4,_0xf027c3[_0xb7a8('0x17')]));});});};exports[_0xb7a8('0x22')]=function(_0x144d24){return new Promise(function(_0x5b0980,_0x24bc74){return db['OpenchannelInteraction']['find']({'where':_0x144d24[_0xb7a8('0x1a')]?_0x144d24[_0xb7a8('0x1a')][_0xb7a8('0x1c')]||null:null})[_0xb7a8('0x1f')](function(_0x4a38f0){if(_0x4a38f0){return _0x4a38f0[_0xb7a8('0x23')](_0x144d24[_0xb7a8('0x19')][_0xb7a8('0x24')],_[_0xb7a8('0x25')](_0x144d24['body'],['ids','id'])||{});}})[_0xb7a8('0x26')](function(_0x5b42d7){logger[_0xb7a8('0xf')](_0xb7a8('0x27'),_0x144d24);logger['debug']('AddTags',_0x144d24,JSON['stringify'](_0x5b42d7));_0x5b0980(_0x5b42d7);})[_0xb7a8('0x21')](function(_0x55c590){logger['error'](_0xb7a8('0x27'),_0x55c590[_0xb7a8('0x17')],_0x144d24);_0x24bc74(_this[_0xb7a8('0x14')](0x1f4,_0x55c590[_0xb7a8('0x17')]));});});}; \ No newline at end of file +var _0x6d15=['defaults','localhost','./openchannelInteraction.socket','register','request','then','request\x20sent','debug','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateOpenchannelInteraction','update','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','body','ids','omit','spread','AddTags','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x10d671,_0x2a96c1){var _0x1eacd7=function(_0x1bfab4){while(--_0x1bfab4){_0x10d671['push'](_0x10d671['shift']());}};_0x1eacd7(++_0x2a96c1);}(_0x6d15,0x70));var _0x56d1=function(_0x47c1e9,_0x5026c9){_0x47c1e9=_0x47c1e9-0x0;var _0x2227c0=_0x6d15[_0x47c1e9];return _0x2227c0;};'use strict';var _=require('lodash');var util=require(_0x56d1('0x0'));var moment=require(_0x56d1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56d1('0x2'));var db=require(_0x56d1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x56d1('0x4'))(_0x56d1('0x5'));var config=require(_0x56d1('0x6'));var jayson=require(_0x56d1('0x7'));var client=jayson[_0x56d1('0x8')][_0x56d1('0x9')]({'port':0x232a});config[_0x56d1('0xa')]=_[_0x56d1('0xb')](config[_0x56d1('0xa')],{'host':_0x56d1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x56d1('0xd'))[_0x56d1('0xe')](socket);function respondWithRpcPromise(_0x5c21b4,_0x3abfeb,_0x50a379){return new BPromise(function(_0x31d156,_0x17c1f9){return client[_0x56d1('0xf')](_0x5c21b4,_0x50a379)[_0x56d1('0x10')](function(_0x62b520){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x3abfeb,_0x56d1('0x11'));logger[_0x56d1('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3abfeb,'request\x20sent',JSON[_0x56d1('0x13')](_0x62b520));if(_0x62b520[_0x56d1('0x14')]){if(_0x62b520[_0x56d1('0x14')][_0x56d1('0x15')]===0x1f4){logger['error'](_0x56d1('0x16'),_0x3abfeb,_0x62b520['error'][_0x56d1('0x17')]);return _0x17c1f9(_0x62b520['error'][_0x56d1('0x17')]);}logger[_0x56d1('0x14')](_0x56d1('0x16'),_0x3abfeb,_0x62b520['error']['message']);return _0x31d156(_0x62b520[_0x56d1('0x14')][_0x56d1('0x17')]);}else{logger[_0x56d1('0x18')](_0x56d1('0x16'),_0x3abfeb,_0x56d1('0x11'));_0x31d156(_0x62b520[_0x56d1('0x19')]['message']);}})[_0x56d1('0x1a')](function(_0x37f191){logger[_0x56d1('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3abfeb,_0x37f191);_0x17c1f9(_0x37f191);});});}exports[_0x56d1('0x1b')]=function(_0x12b419){var _0x1cee6b=this;return new Promise(function(_0x3b12e0,_0x21be51){return db['OpenchannelInteraction'][_0x56d1('0x1c')](_0x12b419['body'],{'raw':_0x12b419[_0x56d1('0x1d')]?_0x12b419[_0x56d1('0x1d')][_0x56d1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12b419['options']?_0x12b419[_0x56d1('0x1d')][_0x56d1('0x1f')]||null:null,'attributes':_0x12b419[_0x56d1('0x1d')]?_0x12b419['options'][_0x56d1('0x20')]||null:null,'limit':_0x12b419[_0x56d1('0x1d')]?_0x12b419[_0x56d1('0x1d')][_0x56d1('0x21')]||null:null})[_0x56d1('0x10')](function(_0x55316c){logger[_0x56d1('0x18')](_0x56d1('0x1b'),_0x12b419);logger[_0x56d1('0x12')](_0x56d1('0x1b'),_0x12b419,JSON[_0x56d1('0x13')](_0x55316c));_0x3b12e0(_0x55316c);})[_0x56d1('0x1a')](function(_0xe0b73a){logger[_0x56d1('0x14')]('UpdateOpenchannelInteraction',_0xe0b73a[_0x56d1('0x17')],_0x12b419);_0x21be51(_0x1cee6b[_0x56d1('0x14')](0x1f4,_0xe0b73a[_0x56d1('0x17')]));});});};exports[_0x56d1('0x22')]=function(_0x27c245){return new Promise(function(_0x279b38,_0x58d929){return db['OpenchannelInteraction'][_0x56d1('0x23')]({'where':_0x27c245['options']?_0x27c245[_0x56d1('0x1d')][_0x56d1('0x1f')]||null:null})[_0x56d1('0x10')](function(_0xf585df){if(_0xf585df){return _0xf585df['addTags'](_0x27c245[_0x56d1('0x24')][_0x56d1('0x25')],_[_0x56d1('0x26')](_0x27c245[_0x56d1('0x24')],['ids','id'])||{});}})[_0x56d1('0x27')](function(_0x32a1c1){logger[_0x56d1('0x18')](_0x56d1('0x28'),_0x27c245);logger[_0x56d1('0x12')](_0x56d1('0x28'),_0x27c245,JSON[_0x56d1('0x13')](_0x32a1c1));_0x279b38(_0x32a1c1);})[_0x56d1('0x1a')](function(_0x339451){logger[_0x56d1('0x14')]('AddTags',_0x339451[_0x56d1('0x17')],_0x27c245);_0x58d929(_this['error'](0x1f4,_0x339451[_0x56d1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 39d7c96..0189975 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 _0x6b2d=['save','emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x23fb37,_0x5a23c1){var _0xfad304=function(_0x2620d6){while(--_0x2620d6){_0x23fb37['push'](_0x23fb37['shift']());}};_0xfad304(++_0x5a23c1);}(_0x6b2d,0x17f));var _0xd6b2=function(_0x129533,_0x2607bd){_0x129533=_0x129533-0x0;var _0x51c647=_0x6b2d[_0x129533];return _0x51c647;};'use strict';var OpenchannelInteractionEvents=require(_0xd6b2('0x0'));var events=[_0xd6b2('0x1'),'remove','update'];function createListener(_0x11bf7c,_0x147aae){return function(_0x10013c){_0x147aae[_0xd6b2('0x2')](_0x11bf7c,_0x10013c);};}function removeListener(_0x4a7c6d,_0x46a09a){return function(){OpenchannelInteractionEvents[_0xd6b2('0x3')](_0x4a7c6d,_0x46a09a);};}exports['register']=function(_0x44c02){for(var _0x5345e7=0x0,_0x8619ae=events[_0xd6b2('0x4')];_0x5345e7<_0x8619ae;_0x5345e7++){var _0x19d2f0=events[_0x5345e7];var _0x403bf9=createListener(_0xd6b2('0x5')+_0x19d2f0,_0x44c02);OpenchannelInteractionEvents['on'](_0x19d2f0,_0x403bf9);}}; \ No newline at end of file +var _0xce8c=['save','remove','update','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0xce8c,0xa7));var _0xcce8=function(_0x466292,_0x34bcc9){_0x466292=_0x466292-0x0;var _0x917dbc=_0xce8c[_0x466292];return _0x917dbc;};'use strict';var OpenchannelInteractionEvents=require(_0xcce8('0x0'));var events=[_0xcce8('0x1'),_0xcce8('0x2'),_0xcce8('0x3')];function createListener(_0x3c5790,_0x3ab2a0){return function(_0x44da03){_0x3ab2a0['emit'](_0x3c5790,_0x44da03);};}function removeListener(_0xa0ddcf,_0x472836){return function(){OpenchannelInteractionEvents[_0xcce8('0x4')](_0xa0ddcf,_0x472836);};}exports[_0xcce8('0x5')]=function(_0x2d45ca){for(var _0xe6cee4=0x0,_0x5ddf93=events[_0xcce8('0x6')];_0xe6cee4<_0x5ddf93;_0xe6cee4++){var _0xa3b8f=events[_0xe6cee4];var _0x3543eb=createListener(_0xcce8('0x7')+_0xa3b8f,_0x2d45ca);OpenchannelInteractionEvents['on'](_0xa3b8f,_0x3543eb);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 275f9cf..ad81612 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(_0x26ac6b,_0x3e0e21){var _0x1972ec=function(_0x1703da){while(--_0x1703da){_0x26ac6b['push'](_0x26ac6b['shift']());}};_0x1972ec(++_0x3e0e21);}(_0xe706,0xa3));var _0x6e70=function(_0x32986,_0x4489c8){_0x32986=_0x32986-0x0;var _0x355ebb=_0xe706[_0x32986];return _0x355ebb;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x1d5555,_0xa75c90){var _0x124721=function(_0x5a0fe0){while(--_0x5a0fe0){_0x1d5555['push'](_0x1d5555['shift']());}};_0x124721(++_0xa75c90);}(_0xedd9,0xfc));var _0x9edd=function(_0xf91dc4,_0x4bf7b1){_0xf91dc4=_0xf91dc4-0x0;var _0x4d4f6e=_0xedd9[_0xf91dc4];return _0x4d4f6e;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 97ff9f2..9a1b013 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 _0x6b20=['STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x299144,_0x461ddc){var _0x2f5bf2=function(_0x11a45f){while(--_0x11a45f){_0x299144['push'](_0x299144['shift']());}};_0x2f5bf2(++_0x461ddc);}(_0x6b20,0xd1));var _0x06b2=function(_0x646c9e,_0x4f23d0){_0x646c9e=_0x646c9e-0x0;var _0x98043c=_0x6b20[_0x646c9e];return _0x98043c;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'body':{'type':Sequelize['TEXT'](_0x06b2('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x06b2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x06b2('0x4')]('in',_0x06b2('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x06b2('0x6')]},'providerName':{'type':Sequelize[_0x06b2('0x7')]},'providerResponse':{'type':Sequelize[_0x06b2('0x8')]}}; \ No newline at end of file +var _0x3609=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0xd7e1eb,_0x5b4445){var _0x51adfe=function(_0x2a824d){while(--_0x2a824d){_0xd7e1eb['push'](_0xd7e1eb['shift']());}};_0x51adfe(++_0x5b4445);}(_0x3609,0x101));var _0x9360=function(_0x44c36,_0x3099fa){_0x44c36=_0x44c36-0x0;var _0x259afc=_0x3609[_0x44c36];return _0x259afc;};'use strict';var Sequelize=require(_0x9360('0x0'));module[_0x9360('0x1')]={'body':{'type':Sequelize[_0x9360('0x2')](_0x9360('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9360('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9360('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9360('0x5')]('in','out'),'defaultValue':_0x9360('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9360('0x7')]},'providerName':{'type':Sequelize[_0x9360('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 4915155..14e3140 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 _0x0496=['agent','fullname','email','manual','SIP/%s','channel','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','internal','interface','motionChannel','event','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','OpenchannelMessage,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','save','destroy','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','rows','show','params','options','create','update','body','find','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User'];(function(_0x47ea23,_0x53791a){var _0x1db219=function(_0x2c7a71){while(--_0x2c7a71){_0x47ea23['push'](_0x47ea23['shift']());}};_0x1db219(++_0x53791a);}(_0x0496,0x199));var _0x6049=function(_0x112c9d,_0x1aba07){_0x112c9d=_0x112c9d-0x0;var _0x5c3ccc=_0x0496[_0x112c9d];return _0x5c3ccc;};'use strict';var emlformat=require(_0x6049('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6049('0x1'));var jsonpatch=require(_0x6049('0x2'));var rp=require(_0x6049('0x3'));var moment=require(_0x6049('0x4'));var BPromise=require(_0x6049('0x5'));var Mustache=require(_0x6049('0x6'));var util=require('util');var path=require(_0x6049('0x7'));var sox=require(_0x6049('0x8'));var csv=require(_0x6049('0x9'));var ejs=require(_0x6049('0xa'));var fs=require('fs');var fs_extra=require(_0x6049('0xb'));var _=require(_0x6049('0xc'));var squel=require(_0x6049('0xd'));var crypto=require(_0x6049('0xe'));var jsforce=require(_0x6049('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6049('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6049('0x10'));var authService=require(_0x6049('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6049('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6049('0x13'))('api');var utils=require(_0x6049('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6049('0x15'))['db'];config[_0x6049('0x16')]=_[_0x6049('0x17')](config['redis'],{'host':_0x6049('0x18'),'port':0x18eb});var socket=require(_0x6049('0x19'))(new Redis(config[_0x6049('0x16')]));require('./openchannelMessage.socket')[_0x6049('0x1a')](socket);var jayson=require(_0x6049('0x1b'));var client=jayson[_0x6049('0x1c')][_0x6049('0x1d')]({'port':0x232c});var client9002=jayson[_0x6049('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1347e9,_0x20d7b1,_0x37fc67,_0x243f03){return new BPromise(function(_0x588177,_0x4347dd){var _0x2a8974=_0x243f03||client;return _0x2a8974[_0x6049('0x1e')](_0x1347e9,_0x37fc67)[_0x6049('0x1f')](function(_0x5653da){logger[_0x6049('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x20d7b1,_0x6049('0x21'));logger['debug'](_0x6049('0x22'),_0x20d7b1,_0x6049('0x21'),JSON['stringify'](_0x5653da));if(_0x5653da['error']){if(_0x5653da['error']['code']===0x1f4){logger[_0x6049('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x20d7b1,_0x5653da[_0x6049('0x23')]['message']);return _0x4347dd(_0x5653da['error'][_0x6049('0x24')]);}logger[_0x6049('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x20d7b1,_0x5653da[_0x6049('0x23')][_0x6049('0x24')]);return _0x588177(_0x5653da[_0x6049('0x23')][_0x6049('0x24')]);}else{logger[_0x6049('0x20')](_0x6049('0x25'),_0x20d7b1,'request\x20sent');_0x588177(_0x5653da['result'][_0x6049('0x24')]);}})[_0x6049('0x26')](function(_0x3a3abd){logger[_0x6049('0x23')](_0x6049('0x25'),_0x20d7b1,_0x3a3abd);_0x4347dd(_0x3a3abd);});});}function respondWithStatusCode(_0x2e7f02,_0x2e97d5){_0x2e97d5=_0x2e97d5||0xcc;return function(_0xe754fd){if(_0xe754fd){return _0x2e7f02[_0x6049('0x27')](_0x2e97d5);}return _0x2e7f02[_0x6049('0x28')](_0x2e97d5)[_0x6049('0x29')]();};}function respondWithResult(_0x2ac422,_0x3ee919){_0x3ee919=_0x3ee919||0xc8;return function(_0x5335fc){if(_0x5335fc){return _0x2ac422['status'](_0x3ee919)[_0x6049('0x2a')](_0x5335fc);}};}function respondWithFilteredResult(_0x3d32b8,_0x27ac99){return function(_0x28f907){if(_0x28f907){var _0x557367=typeof _0x27ac99[_0x6049('0x2b')]===_0x6049('0x2c')&&typeof _0x27ac99[_0x6049('0x2d')]===_0x6049('0x2c');var _0x58a322=_0x28f907['count'];var _0x4e68fc=_0x557367?0x0:_0x27ac99[_0x6049('0x2b')];var _0x11df04=_0x557367?_0x28f907['count']:_0x27ac99[_0x6049('0x2b')]+_0x27ac99[_0x6049('0x2d')];var _0x1c8e02;if(_0x11df04>=_0x58a322){_0x11df04=_0x58a322;_0x1c8e02=0xc8;}else{_0x1c8e02=0xce;}_0x3d32b8[_0x6049('0x28')](_0x1c8e02);return _0x3d32b8['set'](_0x6049('0x2e'),_0x4e68fc+'-'+_0x11df04+'/'+_0x58a322)[_0x6049('0x2a')](_0x28f907);}return null;};}function patchUpdates(_0x3dceaa){return function(_0x54aabe){try{jsonpatch['apply'](_0x54aabe,_0x3dceaa,!![]);}catch(_0x551e59){return BPromise[_0x6049('0x2f')](_0x551e59);}return _0x54aabe[_0x6049('0x30')]();};}function saveUpdates(_0x20d6d9,_0x339d18){return function(_0x131ece){if(_0x131ece){return _0x131ece['update'](_0x20d6d9)[_0x6049('0x1f')](function(_0x577f4e){return _0x577f4e;});}return null;};}function removeEntity(_0x542513,_0x106feb){return function(_0xee37e2){if(_0xee37e2){return _0xee37e2[_0x6049('0x31')]()[_0x6049('0x1f')](function(){_0x542513[_0x6049('0x28')](0xcc)[_0x6049('0x29')]();});}};}function handleEntityNotFound(_0x177932,_0x328361){return function(_0x1c7aa6){if(!_0x1c7aa6){_0x177932[_0x6049('0x27')](0x194);}return _0x1c7aa6;};}function handleError(_0x21699a,_0x5ee557){_0x5ee557=_0x5ee557||0x1f4;return function(_0x3ad911){logger[_0x6049('0x23')](_0x3ad911[_0x6049('0x32')]);if(_0x3ad911[_0x6049('0x33')]){delete _0x3ad911[_0x6049('0x33')];}_0x21699a[_0x6049('0x28')](_0x5ee557)[_0x6049('0x34')](_0x3ad911);};}exports[_0x6049('0x35')]=function(_0x124b3c,_0x17b6a5){var _0x31d8b1={},_0x2b6e3b={},_0x48ebee={'count':0x0,'rows':[]};var _0x592e31=_['map'](db[_0x6049('0x36')][_0x6049('0x37')],function(_0x15a43c){return{'name':_0x15a43c[_0x6049('0x38')],'type':_0x15a43c[_0x6049('0x39')][_0x6049('0x3a')]};});_0x2b6e3b[_0x6049('0x3b')]=_[_0x6049('0x3c')](_0x592e31,'name');_0x2b6e3b[_0x6049('0x3d')]=_[_0x6049('0x3e')](_0x124b3c[_0x6049('0x3d')]);_0x2b6e3b[_0x6049('0x3f')]=_[_0x6049('0x40')](_0x2b6e3b[_0x6049('0x3b')],_0x2b6e3b[_0x6049('0x3d')]);_0x31d8b1[_0x6049('0x41')]=_[_0x6049('0x40')](_0x2b6e3b[_0x6049('0x3b')],qs[_0x6049('0x42')](_0x124b3c[_0x6049('0x3d')][_0x6049('0x42')]));_0x31d8b1[_0x6049('0x41')]=_0x31d8b1[_0x6049('0x41')][_0x6049('0x43')]?_0x31d8b1[_0x6049('0x41')]:_0x2b6e3b[_0x6049('0x3b')];if(!_0x124b3c[_0x6049('0x3d')]['hasOwnProperty'](_0x6049('0x44'))){_0x31d8b1[_0x6049('0x2d')]=qs[_0x6049('0x2d')](_0x124b3c[_0x6049('0x3d')]['limit']);_0x31d8b1['offset']=qs[_0x6049('0x2b')](_0x124b3c[_0x6049('0x3d')][_0x6049('0x2b')]);}_0x31d8b1[_0x6049('0x45')]=qs[_0x6049('0x46')](_0x124b3c[_0x6049('0x3d')]['sort']);_0x31d8b1[_0x6049('0x47')]=qs['filters'](_[_0x6049('0x48')](_0x124b3c[_0x6049('0x3d')],_0x2b6e3b[_0x6049('0x3f')]),_0x592e31);if(_0x124b3c['query'][_0x6049('0x49')]){_0x31d8b1[_0x6049('0x47')]=_['merge'](_0x31d8b1[_0x6049('0x47')],{'$or':_['map'](_0x592e31,function(_0x51f740){if(_0x51f740[_0x6049('0x39')]!==_0x6049('0x4a')){var _0xeea34c={};_0xeea34c[_0x51f740[_0x6049('0x33')]]={'$like':'%'+_0x124b3c[_0x6049('0x3d')][_0x6049('0x49')]+'%'};return _0xeea34c;}})});}_0x31d8b1=_[_0x6049('0x4b')]({},_0x31d8b1,_0x124b3c['options']);var _0x130d60={'where':_0x31d8b1[_0x6049('0x47')]};return db['OpenchannelMessage'][_0x6049('0x4c')](_0x130d60)[_0x6049('0x1f')](function(_0x1fd412){_0x48ebee[_0x6049('0x4c')]=_0x1fd412;if(_0x124b3c['query'][_0x6049('0x4d')]){_0x31d8b1[_0x6049('0x4e')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x31d8b1);})[_0x6049('0x1f')](function(_0x183174){_0x48ebee[_0x6049('0x4f')]=_0x183174;return _0x48ebee;})[_0x6049('0x1f')](respondWithFilteredResult(_0x17b6a5,_0x31d8b1))[_0x6049('0x26')](handleError(_0x17b6a5,null));};exports[_0x6049('0x50')]=function(_0x946b3b,_0x26de9f){var _0x4c333c={'raw':!![],'where':{'id':_0x946b3b[_0x6049('0x51')]['id']}},_0x223dd1={};_0x223dd1[_0x6049('0x3b')]=_[_0x6049('0x3e')](db[_0x6049('0x36')][_0x6049('0x37')]);_0x223dd1[_0x6049('0x3d')]=_['keys'](_0x946b3b[_0x6049('0x3d')]);_0x223dd1[_0x6049('0x3f')]=_['intersection'](_0x223dd1[_0x6049('0x3b')],_0x223dd1[_0x6049('0x3d')]);_0x4c333c[_0x6049('0x41')]=_[_0x6049('0x40')](_0x223dd1[_0x6049('0x3b')],qs[_0x6049('0x42')](_0x946b3b['query'][_0x6049('0x42')]));_0x4c333c[_0x6049('0x41')]=_0x4c333c['attributes'][_0x6049('0x43')]?_0x4c333c[_0x6049('0x41')]:_0x223dd1[_0x6049('0x3b')];if(_0x946b3b[_0x6049('0x3d')][_0x6049('0x4d')]){_0x4c333c[_0x6049('0x4e')]=[{'all':!![]}];}_0x4c333c=_[_0x6049('0x4b')]({},_0x4c333c,_0x946b3b[_0x6049('0x52')]);return db[_0x6049('0x36')]['find'](_0x4c333c)[_0x6049('0x1f')](handleEntityNotFound(_0x26de9f,null))[_0x6049('0x1f')](respondWithResult(_0x26de9f,null))[_0x6049('0x26')](handleError(_0x26de9f,null));};exports[_0x6049('0x53')]=function(_0x430571,_0x575b9c){return db[_0x6049('0x36')]['create'](_0x430571['body'],{})[_0x6049('0x1f')](respondWithResult(_0x575b9c,0xc9))['catch'](handleError(_0x575b9c,null));};exports[_0x6049('0x54')]=function(_0x261b31,_0x56a36e){if(_0x261b31[_0x6049('0x55')]['id']){delete _0x261b31[_0x6049('0x55')]['id'];}return db[_0x6049('0x36')][_0x6049('0x56')]({'where':{'id':_0x261b31[_0x6049('0x51')]['id']}})[_0x6049('0x1f')](handleEntityNotFound(_0x56a36e,null))[_0x6049('0x1f')](saveUpdates(_0x261b31[_0x6049('0x55')],null))['then'](respondWithResult(_0x56a36e,null))[_0x6049('0x26')](handleError(_0x56a36e,null));};exports['destroy']=function(_0x45ccdb,_0x1e2d6e){return db['OpenchannelMessage'][_0x6049('0x56')]({'where':{'id':_0x45ccdb[_0x6049('0x51')]['id']}})[_0x6049('0x1f')](handleEntityNotFound(_0x1e2d6e,null))['then'](removeEntity(_0x1e2d6e,null))['catch'](handleError(_0x1e2d6e,null));};exports[_0x6049('0x57')]=function(_0x181ec4,_0x4182b5){return db[_0x6049('0x36')][_0x6049('0x57')]()[_0x6049('0x1f')](respondWithResult(_0x4182b5,null))[_0x6049('0x26')](handleError(_0x4182b5,null));};var interaction_log=require(_0x6049('0x13'))(_0x6049('0x58'));exports[_0x6049('0x59')]=function(_0x52efaa,_0x46a9e2,_0x3a06f1){var _0x21ccae={'agent':{},'channel':_0x6049('0x5a')};if(_0x52efaa[_0x6049('0x55')]['id']){delete _0x52efaa['body']['id'];}_0x52efaa[_0x6049('0x55')][_0x6049('0x5b')]=!![];_0x52efaa[_0x6049('0x55')][_0x6049('0x5c')]=moment()['format'](_0x6049('0x5d'));_0x52efaa[_0x6049('0x55')]['UserId']=_0x52efaa['body'][_0x6049('0x5e')]||_0x52efaa[_0x6049('0x5f')]['id'];_0x21ccae['agent']['id']=_0x52efaa[_0x6049('0x55')][_0x6049('0x5e')];return db['OpenchannelMessage']['find']({'where':{'id':_0x52efaa[_0x6049('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x46a9e2,null))[_0x6049('0x1f')](saveUpdates(_0x52efaa[_0x6049('0x55')],null))[_0x6049('0x1f')](function(_0x209c24){if(_0x209c24){_0x21ccae[_0x6049('0x24')]=_0x209c24[_0x6049('0x60')]({'plain':!![]});return db[_0x6049('0x61')]['find']({'where':{'id':_0x209c24[_0x6049('0x62')]}});}return null;})[_0x6049('0x1f')](handleEntityNotFound(_0x46a9e2,null))[_0x6049('0x1f')](function(_0x4a5367){if(_0x4a5367){return _0x4a5367['update']({'UserId':_0x52efaa[_0x6049('0x55')][_0x6049('0x5e')],'read1stAt':_[_0x6049('0x63')](_0x4a5367[_0x6049('0x64')])?moment()[_0x6049('0x65')](_0x6049('0x5d')):undefined});}return null;})[_0x6049('0x1f')](function(_0x288d3c){if(_0x288d3c){_0x21ccae['interaction']=_0x288d3c[_0x6049('0x60')]({'plain':!![]});interaction_log['info'](_0x6049('0x66'),_0x52efaa[_0x6049('0x5f')]['id'],_0x52efaa['user'][_0x6049('0x33')],_0x52efaa[_0x6049('0x5f')][_0x6049('0x67')],_0x21ccae[_0x6049('0x68')]['id'],_0x52efaa['body']?JSON[_0x6049('0x69')](_0x52efaa[_0x6049('0x55')]):_0x6049('0x6a'));return respondWithRpcPromise(_0x6049('0x6b'),_0x6049('0x6c'),_0x21ccae);}return null;})['then'](function(_0x181ae4){var _0x5bec7d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x181ae4[_0x6049('0x24')]['ContactId'];return db[_0x6049('0x6d')]['query'](_0x5bec7d,{'type':db[_0x6049('0x6e')][_0x6049('0x6f')][_0x6049('0x70')],'raw':!![]})[_0x6049('0x1f')](function(_0x1b044e){return _0x1b044e;});})[_0x6049('0x1f')](function(_0x66512d){if(_0x66512d){_0x21ccae['message'][_0x6049('0x71')]=_0x66512d[0x0];if(!_0x52efaa[_0x6049('0x55')][_0x6049('0x5e')])return;return db[_0x6049('0x72')][_0x6049('0x56')]({'where':{'id':_0x52efaa[_0x6049('0x55')]['UserId'],'role':_0x6049('0x73')},'attributes':['id',_0x6049('0x33'),_0x6049('0x74'),_0x6049('0x75'),'internal'],'raw':!![]});}return null;})[_0x6049('0x1f')](function(_0x561ae7){if(!_0x561ae7)return null;_0x21ccae[_0x6049('0x24')]['agent']=_0x561ae7;return _0x21ccae;})['then'](function(_0x386157){if(_0x386157){if(_0x52efaa[_0x6049('0x55')][_0x6049('0x76')]){_0x21ccae[_0x6049('0x24')]['interface']=util[_0x6049('0x65')](_0x6049('0x77'),_0x52efaa['user'][_0x6049('0x33')]);_0x21ccae['message'][_0x6049('0x78')]=_0x21ccae[_0x6049('0x78')];_0x21ccae[_0x6049('0x24')]['motionChannel']=_0x21ccae[_0x6049('0x78')];_0x21ccae[_0x6049('0x24')]['event']=_0x6049('0x59');return respondWithRpcPromise(_0x6049('0x79'),_0x6049('0x79'),{'event':'acceptmessage','message':_0x21ccae['message']},client9002)[_0x6049('0x1f')](function(){return _0x21ccae;});}return _0x21ccae;}return null;})['then'](respondWithResult(_0x46a9e2,null))[_0x6049('0x26')](handleError(_0x46a9e2,null));};var interaction_log=require(_0x6049('0x13'))(_0x6049('0x58'));exports[_0x6049('0x2f')]=function(_0x12d5ca,_0x1b6fd2,_0x4fc303){var _0x451cde={'agent':{},'channel':_0x6049('0x5a')};if(_0x12d5ca[_0x6049('0x55')]['id']){delete _0x12d5ca[_0x6049('0x55')]['id'];}_0x12d5ca['body'][_0x6049('0x5e')]=_0x12d5ca['body'][_0x6049('0x5e')]||_0x12d5ca[_0x6049('0x5f')]['id'];_0x451cde['agent']['id']=_0x12d5ca['body'][_0x6049('0x5e')];return db[_0x6049('0x36')]['find']({'where':{'id':_0x12d5ca['params']['id'],'UserId':null}})[_0x6049('0x1f')](handleEntityNotFound(_0x1b6fd2,null))['then'](function(_0xeecfa6){if(_0xeecfa6){_0x451cde[_0x6049('0x24')]=_0xeecfa6['get']({'plain':!![]});return db[_0x6049('0x61')][_0x6049('0x56')]({'where':{'id':_0xeecfa6[_0x6049('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x1b6fd2,null))[_0x6049('0x1f')](function(_0x21e79d){if(_0x21e79d){_0x451cde[_0x6049('0x68')]=_0x21e79d['get']({'plain':!![]});interaction_log[_0x6049('0x20')](_0x6049('0x7a'),_0x12d5ca[_0x6049('0x5f')]['id'],_0x12d5ca[_0x6049('0x5f')][_0x6049('0x33')],_0x12d5ca['user'][_0x6049('0x67')],_0x451cde['interaction']['id'],_0x12d5ca[_0x6049('0x55')]?JSON[_0x6049('0x69')](_0x12d5ca[_0x6049('0x55')]):'null');return respondWithRpcPromise('RejectMessage',_0x6049('0x7b'),_0x451cde);}return null;})['then'](function(_0x5d4a42){var _0x13a2f0=_0x6049('0x7c')+_0x5d4a42[_0x6049('0x24')][_0x6049('0x7d')];return db[_0x6049('0x6d')][_0x6049('0x3d')](_0x13a2f0,{'type':db[_0x6049('0x6e')][_0x6049('0x6f')]['SELECT'],'raw':!![]})[_0x6049('0x1f')](function(_0x2f4b06){return _0x2f4b06;});})[_0x6049('0x1f')](function(_0x55b0a8){if(_0x55b0a8){_0x451cde[_0x6049('0x24')]['contact']=_0x55b0a8[0x0];if(!_0x12d5ca[_0x6049('0x55')][_0x6049('0x5e')])return;return db['User'][_0x6049('0x56')]({'where':{'id':_0x12d5ca['body'][_0x6049('0x5e')],'role':'agent'},'attributes':['id',_0x6049('0x33'),_0x6049('0x74'),_0x6049('0x75'),_0x6049('0x7e')],'raw':!![]});}return null;})['then'](function(_0x776a98){if(!_0x776a98)return null;_0x451cde[_0x6049('0x24')][_0x6049('0x73')]=_0x776a98;return _0x451cde;})[_0x6049('0x1f')](function(_0x5a2b7a){if(_0x5a2b7a){_0x5a2b7a[_0x6049('0x24')][_0x6049('0x7f')]=util[_0x6049('0x65')](_0x6049('0x77'),_0x12d5ca[_0x6049('0x5f')][_0x6049('0x33')]);_0x5a2b7a[_0x6049('0x24')]['channel']=_0x451cde[_0x6049('0x78')];_0x5a2b7a[_0x6049('0x24')][_0x6049('0x80')]=_0x451cde[_0x6049('0x78')];_0x5a2b7a[_0x6049('0x24')][_0x6049('0x81')]=_0x6049('0x2f');respondWithRpcPromise(_0x6049('0x79'),'EventManager',{'event':_0x6049('0x82'),'message':_0x5a2b7a[_0x6049('0x24')]},client9002);return _0x451cde;}return null;})['then'](respondWithResult(_0x1b6fd2,null))[_0x6049('0x26')](handleError(_0x1b6fd2,null));}; \ No newline at end of file +var _0x1e05=['sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','client','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','include','find','create','body','params','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteractionId','rejectMessage','contact','fullname','email','interface','rejectmessage','eml-format','rimraf','request-promise','moment','bluebird','mustache','path'];(function(_0x55c641,_0x346a64){var _0x548a6d=function(_0x2cfd17){while(--_0x2cfd17){_0x55c641['push'](_0x55c641['shift']());}};_0x548a6d(++_0x346a64);}(_0x1e05,0x170));var _0x51e0=function(_0x20c290,_0x47e736){_0x20c290=_0x20c290-0x0;var _0x3d7b3b=_0x1e05[_0x20c290];return _0x3d7b3b;};'use strict';var emlformat=require(_0x51e0('0x0'));var rimraf=require(_0x51e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51e0('0x2'));var moment=require(_0x51e0('0x3'));var BPromise=require(_0x51e0('0x4'));var Mustache=require(_0x51e0('0x5'));var util=require('util');var path=require(_0x51e0('0x6'));var sox=require(_0x51e0('0x7'));var csv=require(_0x51e0('0x8'));var ejs=require(_0x51e0('0x9'));var fs=require('fs');var fs_extra=require(_0x51e0('0xa'));var _=require(_0x51e0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x51e0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x51e0('0xd'));var Papa=require(_0x51e0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x51e0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x51e0('0x10'))('api');var utils=require(_0x51e0('0x11'));var config=require(_0x51e0('0x12'));var licenseUtil=require(_0x51e0('0x13'));var db=require(_0x51e0('0x14'))['db'];config[_0x51e0('0x15')]=_[_0x51e0('0x16')](config['redis'],{'host':_0x51e0('0x17'),'port':0x18eb});var socket=require(_0x51e0('0x18'))(new Redis(config[_0x51e0('0x15')]));require(_0x51e0('0x19'))['register'](socket);var jayson=require(_0x51e0('0x1a'));var client=jayson['client'][_0x51e0('0x1b')]({'port':0x232c});var client9002=jayson[_0x51e0('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40ef54,_0x280aba,_0x5b191d,_0x43ff7a){return new BPromise(function(_0x2f6a39,_0x10f689){var _0x279229=_0x43ff7a||client;return _0x279229[_0x51e0('0x1d')](_0x40ef54,_0x5b191d)['then'](function(_0x3a344d){logger[_0x51e0('0x1e')](_0x51e0('0x1f'),_0x280aba,_0x51e0('0x20'));logger[_0x51e0('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x280aba,_0x51e0('0x20'),JSON[_0x51e0('0x22')](_0x3a344d));if(_0x3a344d[_0x51e0('0x23')]){if(_0x3a344d[_0x51e0('0x23')]['code']===0x1f4){logger[_0x51e0('0x23')](_0x51e0('0x1f'),_0x280aba,_0x3a344d[_0x51e0('0x23')][_0x51e0('0x24')]);return _0x10f689(_0x3a344d[_0x51e0('0x23')][_0x51e0('0x24')]);}logger[_0x51e0('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x280aba,_0x3a344d[_0x51e0('0x23')]['message']);return _0x2f6a39(_0x3a344d[_0x51e0('0x23')][_0x51e0('0x24')]);}else{logger['info'](_0x51e0('0x1f'),_0x280aba,_0x51e0('0x20'));_0x2f6a39(_0x3a344d['result']['message']);}})[_0x51e0('0x25')](function(_0x218e6d){logger['error'](_0x51e0('0x1f'),_0x280aba,_0x218e6d);_0x10f689(_0x218e6d);});});}function respondWithStatusCode(_0x1fa429,_0x55072f){_0x55072f=_0x55072f||0xcc;return function(_0x48e8af){if(_0x48e8af){return _0x1fa429[_0x51e0('0x26')](_0x55072f);}return _0x1fa429[_0x51e0('0x27')](_0x55072f)[_0x51e0('0x28')]();};}function respondWithResult(_0x24790a,_0x2add3f){_0x2add3f=_0x2add3f||0xc8;return function(_0x4601ef){if(_0x4601ef){return _0x24790a[_0x51e0('0x27')](_0x2add3f)['json'](_0x4601ef);}};}function respondWithFilteredResult(_0x4f4ce9,_0x67f663){return function(_0x297b4d){if(_0x297b4d){var _0x345dca=typeof _0x67f663[_0x51e0('0x29')]===_0x51e0('0x2a')&&typeof _0x67f663[_0x51e0('0x2b')]===_0x51e0('0x2a');var _0x1c7e88=_0x297b4d[_0x51e0('0x2c')];var _0x7150b=_0x345dca?0x0:_0x67f663[_0x51e0('0x29')];var _0x579ff3=_0x345dca?_0x297b4d[_0x51e0('0x2c')]:_0x67f663[_0x51e0('0x29')]+_0x67f663['limit'];var _0x2abf2b;if(_0x579ff3>=_0x1c7e88){_0x579ff3=_0x1c7e88;_0x2abf2b=0xc8;}else{_0x2abf2b=0xce;}_0x4f4ce9['status'](_0x2abf2b);return _0x4f4ce9['set'](_0x51e0('0x2d'),_0x7150b+'-'+_0x579ff3+'/'+_0x1c7e88)[_0x51e0('0x2e')](_0x297b4d);}return null;};}function patchUpdates(_0x2ea7ed){return function(_0x3e7a52){try{jsonpatch['apply'](_0x3e7a52,_0x2ea7ed,!![]);}catch(_0x5547cc){return BPromise[_0x51e0('0x2f')](_0x5547cc);}return _0x3e7a52[_0x51e0('0x30')]();};}function saveUpdates(_0x43fa74,_0x39383e){return function(_0x2529cb){if(_0x2529cb){return _0x2529cb[_0x51e0('0x31')](_0x43fa74)[_0x51e0('0x32')](function(_0x450c2a){return _0x450c2a;});}return null;};}function removeEntity(_0xf743a5,_0x1b2d75){return function(_0x5d40fe){if(_0x5d40fe){return _0x5d40fe[_0x51e0('0x33')]()[_0x51e0('0x32')](function(){_0xf743a5['status'](0xcc)[_0x51e0('0x28')]();});}};}function handleEntityNotFound(_0x2c437c,_0x394ad0){return function(_0x542028){if(!_0x542028){_0x2c437c[_0x51e0('0x26')](0x194);}return _0x542028;};}function handleError(_0x39da3b,_0x29d12c){_0x29d12c=_0x29d12c||0x1f4;return function(_0x5f2c55){logger[_0x51e0('0x23')](_0x5f2c55[_0x51e0('0x34')]);if(_0x5f2c55[_0x51e0('0x35')]){delete _0x5f2c55[_0x51e0('0x35')];}_0x39da3b[_0x51e0('0x27')](_0x29d12c)[_0x51e0('0x36')](_0x5f2c55);};}exports[_0x51e0('0x37')]=function(_0x3cfa00,_0x4782f1){var _0x26827c={},_0x33972e={},_0x4b1bc3={'count':0x0,'rows':[]};var _0x152dd3=_[_0x51e0('0x38')](db[_0x51e0('0x39')][_0x51e0('0x3a')],function(_0x1354fc){return{'name':_0x1354fc[_0x51e0('0x3b')],'type':_0x1354fc[_0x51e0('0x3c')][_0x51e0('0x3d')]};});_0x33972e['model']=_['map'](_0x152dd3,_0x51e0('0x35'));_0x33972e['query']=_[_0x51e0('0x3e')](_0x3cfa00[_0x51e0('0x3f')]);_0x33972e[_0x51e0('0x40')]=_['intersection'](_0x33972e[_0x51e0('0x41')],_0x33972e[_0x51e0('0x3f')]);_0x26827c[_0x51e0('0x42')]=_[_0x51e0('0x43')](_0x33972e['model'],qs[_0x51e0('0x44')](_0x3cfa00[_0x51e0('0x3f')][_0x51e0('0x44')]));_0x26827c[_0x51e0('0x42')]=_0x26827c[_0x51e0('0x42')][_0x51e0('0x45')]?_0x26827c[_0x51e0('0x42')]:_0x33972e[_0x51e0('0x41')];if(!_0x3cfa00[_0x51e0('0x3f')][_0x51e0('0x46')](_0x51e0('0x47'))){_0x26827c[_0x51e0('0x2b')]=qs[_0x51e0('0x2b')](_0x3cfa00[_0x51e0('0x3f')]['limit']);_0x26827c[_0x51e0('0x29')]=qs['offset'](_0x3cfa00[_0x51e0('0x3f')][_0x51e0('0x29')]);}_0x26827c[_0x51e0('0x48')]=qs[_0x51e0('0x49')](_0x3cfa00[_0x51e0('0x3f')][_0x51e0('0x49')]);_0x26827c[_0x51e0('0x4a')]=qs[_0x51e0('0x40')](_['pick'](_0x3cfa00[_0x51e0('0x3f')],_0x33972e[_0x51e0('0x40')]),_0x152dd3);if(_0x3cfa00['query']['filter']){_0x26827c[_0x51e0('0x4a')]=_[_0x51e0('0x4b')](_0x26827c[_0x51e0('0x4a')],{'$or':_[_0x51e0('0x38')](_0x152dd3,function(_0x2b21d4){if(_0x2b21d4[_0x51e0('0x3c')]!==_0x51e0('0x4c')){var _0x2d5911={};_0x2d5911[_0x2b21d4[_0x51e0('0x35')]]={'$like':'%'+_0x3cfa00[_0x51e0('0x3f')][_0x51e0('0x4d')]+'%'};return _0x2d5911;}})});}_0x26827c=_[_0x51e0('0x4b')]({},_0x26827c,_0x3cfa00[_0x51e0('0x4e')]);var _0x380f7d={'where':_0x26827c[_0x51e0('0x4a')]};return db['OpenchannelMessage'][_0x51e0('0x2c')](_0x380f7d)[_0x51e0('0x32')](function(_0x51bf56){_0x4b1bc3[_0x51e0('0x2c')]=_0x51bf56;if(_0x3cfa00[_0x51e0('0x3f')][_0x51e0('0x4f')]){_0x26827c['include']=[{'all':!![]}];}return db[_0x51e0('0x39')]['findAll'](_0x26827c);})[_0x51e0('0x32')](function(_0x22717c){_0x4b1bc3[_0x51e0('0x50')]=_0x22717c;return _0x4b1bc3;})[_0x51e0('0x32')](respondWithFilteredResult(_0x4782f1,_0x26827c))[_0x51e0('0x25')](handleError(_0x4782f1,null));};exports['show']=function(_0x1fe630,_0x17cf9f){var _0x525ad6={'raw':!![],'where':{'id':_0x1fe630['params']['id']}},_0x2b0374={};_0x2b0374[_0x51e0('0x41')]=_[_0x51e0('0x3e')](db[_0x51e0('0x39')]['rawAttributes']);_0x2b0374['query']=_['keys'](_0x1fe630[_0x51e0('0x3f')]);_0x2b0374['filters']=_[_0x51e0('0x43')](_0x2b0374[_0x51e0('0x41')],_0x2b0374[_0x51e0('0x3f')]);_0x525ad6['attributes']=_[_0x51e0('0x43')](_0x2b0374['model'],qs['fields'](_0x1fe630[_0x51e0('0x3f')][_0x51e0('0x44')]));_0x525ad6[_0x51e0('0x42')]=_0x525ad6['attributes']['length']?_0x525ad6[_0x51e0('0x42')]:_0x2b0374[_0x51e0('0x41')];if(_0x1fe630[_0x51e0('0x3f')][_0x51e0('0x4f')]){_0x525ad6[_0x51e0('0x51')]=[{'all':!![]}];}_0x525ad6=_[_0x51e0('0x4b')]({},_0x525ad6,_0x1fe630['options']);return db[_0x51e0('0x39')][_0x51e0('0x52')](_0x525ad6)[_0x51e0('0x32')](handleEntityNotFound(_0x17cf9f,null))['then'](respondWithResult(_0x17cf9f,null))[_0x51e0('0x25')](handleError(_0x17cf9f,null));};exports['create']=function(_0x5eca1f,_0x37d1c8){return db[_0x51e0('0x39')][_0x51e0('0x53')](_0x5eca1f[_0x51e0('0x54')],{})[_0x51e0('0x32')](respondWithResult(_0x37d1c8,0xc9))['catch'](handleError(_0x37d1c8,null));};exports[_0x51e0('0x31')]=function(_0x6d90e7,_0x5adfa1){if(_0x6d90e7[_0x51e0('0x54')]['id']){delete _0x6d90e7[_0x51e0('0x54')]['id'];}return db[_0x51e0('0x39')][_0x51e0('0x52')]({'where':{'id':_0x6d90e7[_0x51e0('0x55')]['id']}})['then'](handleEntityNotFound(_0x5adfa1,null))[_0x51e0('0x32')](saveUpdates(_0x6d90e7[_0x51e0('0x54')],null))['then'](respondWithResult(_0x5adfa1,null))['catch'](handleError(_0x5adfa1,null));};exports[_0x51e0('0x33')]=function(_0x220b3c,_0x38a09e){return db[_0x51e0('0x39')][_0x51e0('0x52')]({'where':{'id':_0x220b3c[_0x51e0('0x55')]['id']}})[_0x51e0('0x32')](handleEntityNotFound(_0x38a09e,null))[_0x51e0('0x32')](removeEntity(_0x38a09e,null))[_0x51e0('0x25')](handleError(_0x38a09e,null));};exports[_0x51e0('0x56')]=function(_0xd912c6,_0x28716b){return db[_0x51e0('0x39')][_0x51e0('0x56')]()['then'](respondWithResult(_0x28716b,null))['catch'](handleError(_0x28716b,null));};var interaction_log=require(_0x51e0('0x10'))(_0x51e0('0x57'));exports[_0x51e0('0x58')]=function(_0x3d130f,_0x13b583,_0x392bda){var _0x3fd51d={'agent':{},'channel':_0x51e0('0x59')};if(_0x3d130f[_0x51e0('0x54')]['id']){delete _0x3d130f[_0x51e0('0x54')]['id'];}_0x3d130f[_0x51e0('0x54')]['read']=!![];_0x3d130f[_0x51e0('0x54')][_0x51e0('0x5a')]=moment()[_0x51e0('0x5b')](_0x51e0('0x5c'));_0x3d130f[_0x51e0('0x54')]['UserId']=_0x3d130f[_0x51e0('0x54')]['UserId']||_0x3d130f[_0x51e0('0x5d')]['id'];_0x3fd51d[_0x51e0('0x5e')]['id']=_0x3d130f[_0x51e0('0x54')][_0x51e0('0x5f')];return db[_0x51e0('0x39')][_0x51e0('0x52')]({'where':{'id':_0x3d130f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x13b583,null))[_0x51e0('0x32')](saveUpdates(_0x3d130f[_0x51e0('0x54')],null))[_0x51e0('0x32')](function(_0x3de7fb){if(_0x3de7fb){_0x3fd51d[_0x51e0('0x24')]=_0x3de7fb[_0x51e0('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0x51e0('0x52')]({'where':{'id':_0x3de7fb['OpenchannelInteractionId']}});}return null;})[_0x51e0('0x32')](handleEntityNotFound(_0x13b583,null))[_0x51e0('0x32')](function(_0x5002e6){if(_0x5002e6){return _0x5002e6[_0x51e0('0x31')]({'UserId':_0x3d130f[_0x51e0('0x54')][_0x51e0('0x5f')],'read1stAt':_[_0x51e0('0x61')](_0x5002e6['read1stAt'])?moment()[_0x51e0('0x5b')](_0x51e0('0x5c')):undefined});}return null;})['then'](function(_0x29d50b){if(_0x29d50b){_0x3fd51d[_0x51e0('0x62')]=_0x29d50b[_0x51e0('0x60')]({'plain':!![]});interaction_log['info'](_0x51e0('0x63'),_0x3d130f[_0x51e0('0x5d')]['id'],_0x3d130f[_0x51e0('0x5d')][_0x51e0('0x35')],_0x3d130f[_0x51e0('0x5d')][_0x51e0('0x64')],_0x3fd51d[_0x51e0('0x62')]['id'],_0x3d130f[_0x51e0('0x54')]?JSON[_0x51e0('0x22')](_0x3d130f['body']):'null');return respondWithRpcPromise(_0x51e0('0x65'),_0x51e0('0x66'),_0x3fd51d);}return null;})['then'](function(_0x196351){var _0x472b9f=_0x51e0('0x67')+_0x196351[_0x51e0('0x24')][_0x51e0('0x68')];return db[_0x51e0('0x69')][_0x51e0('0x3f')](_0x472b9f,{'type':db[_0x51e0('0x6a')][_0x51e0('0x6b')][_0x51e0('0x6c')],'raw':!![]})[_0x51e0('0x32')](function(_0x5a21f8){return _0x5a21f8;});})['then'](function(_0x145543){if(_0x145543){_0x3fd51d[_0x51e0('0x24')]['contact']=_0x145543[0x0];if(!_0x3d130f[_0x51e0('0x54')]['UserId'])return;return db[_0x51e0('0x6d')]['find']({'where':{'id':_0x3d130f[_0x51e0('0x54')][_0x51e0('0x5f')],'role':_0x51e0('0x5e')},'attributes':['id',_0x51e0('0x35'),'fullname','email',_0x51e0('0x6e')],'raw':!![]});}return null;})[_0x51e0('0x32')](function(_0x58c497){if(!_0x58c497)return null;_0x3fd51d['message']['agent']=_0x58c497;return _0x3fd51d;})[_0x51e0('0x32')](function(_0x11f8ec){if(_0x11f8ec){if(_0x3d130f[_0x51e0('0x54')][_0x51e0('0x6f')]){_0x3fd51d[_0x51e0('0x24')]['interface']=util[_0x51e0('0x5b')](_0x51e0('0x70'),_0x3d130f[_0x51e0('0x5d')][_0x51e0('0x35')]);_0x3fd51d[_0x51e0('0x24')][_0x51e0('0x71')]=_0x3fd51d['channel'];_0x3fd51d[_0x51e0('0x24')][_0x51e0('0x72')]=_0x3fd51d['channel'];_0x3fd51d['message'][_0x51e0('0x73')]=_0x51e0('0x58');return respondWithRpcPromise('EventManager',_0x51e0('0x74'),{'event':_0x51e0('0x75'),'message':_0x3fd51d['message']},client9002)[_0x51e0('0x32')](function(){return _0x3fd51d;});}return _0x3fd51d;}return null;})[_0x51e0('0x32')](respondWithResult(_0x13b583,null))[_0x51e0('0x25')](handleError(_0x13b583,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['reject']=function(_0x42c57e,_0x497f06,_0x496a6d){var _0x4e5bb2={'agent':{},'channel':'openchannel'};if(_0x42c57e['body']['id']){delete _0x42c57e['body']['id'];}_0x42c57e['body'][_0x51e0('0x5f')]=_0x42c57e[_0x51e0('0x54')][_0x51e0('0x5f')]||_0x42c57e[_0x51e0('0x5d')]['id'];_0x4e5bb2['agent']['id']=_0x42c57e['body'][_0x51e0('0x5f')];return db['OpenchannelMessage'][_0x51e0('0x52')]({'where':{'id':_0x42c57e[_0x51e0('0x55')]['id'],'UserId':null}})[_0x51e0('0x32')](handleEntityNotFound(_0x497f06,null))['then'](function(_0x4d163b){if(_0x4d163b){_0x4e5bb2[_0x51e0('0x24')]=_0x4d163b[_0x51e0('0x60')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x4d163b[_0x51e0('0x76')]}});}return null;})['then'](handleEntityNotFound(_0x497f06,null))['then'](function(_0x306cd9){if(_0x306cd9){_0x4e5bb2['interaction']=_0x306cd9['get']({'plain':!![]});interaction_log[_0x51e0('0x1e')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x42c57e[_0x51e0('0x5d')]['id'],_0x42c57e[_0x51e0('0x5d')][_0x51e0('0x35')],_0x42c57e[_0x51e0('0x5d')][_0x51e0('0x64')],_0x4e5bb2[_0x51e0('0x62')]['id'],_0x42c57e[_0x51e0('0x54')]?JSON[_0x51e0('0x22')](_0x42c57e[_0x51e0('0x54')]):'null');return respondWithRpcPromise('RejectMessage',_0x51e0('0x77'),_0x4e5bb2);}return null;})['then'](function(_0xed9912){var _0x698a61='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xed9912[_0x51e0('0x24')][_0x51e0('0x68')];return db[_0x51e0('0x69')]['query'](_0x698a61,{'type':db[_0x51e0('0x6a')][_0x51e0('0x6b')]['SELECT'],'raw':!![]})['then'](function(_0x4279dd){return _0x4279dd;});})[_0x51e0('0x32')](function(_0x154a8a){if(_0x154a8a){_0x4e5bb2[_0x51e0('0x24')][_0x51e0('0x78')]=_0x154a8a[0x0];if(!_0x42c57e[_0x51e0('0x54')]['UserId'])return;return db[_0x51e0('0x6d')][_0x51e0('0x52')]({'where':{'id':_0x42c57e['body'][_0x51e0('0x5f')],'role':_0x51e0('0x5e')},'attributes':['id',_0x51e0('0x35'),_0x51e0('0x79'),_0x51e0('0x7a'),_0x51e0('0x6e')],'raw':!![]});}return null;})[_0x51e0('0x32')](function(_0x399920){if(!_0x399920)return null;_0x4e5bb2[_0x51e0('0x24')][_0x51e0('0x5e')]=_0x399920;return _0x4e5bb2;})[_0x51e0('0x32')](function(_0x393777){if(_0x393777){_0x393777[_0x51e0('0x24')][_0x51e0('0x7b')]=util[_0x51e0('0x5b')](_0x51e0('0x70'),_0x42c57e[_0x51e0('0x5d')][_0x51e0('0x35')]);_0x393777[_0x51e0('0x24')][_0x51e0('0x71')]=_0x4e5bb2[_0x51e0('0x71')];_0x393777[_0x51e0('0x24')]['motionChannel']=_0x4e5bb2['channel'];_0x393777[_0x51e0('0x24')][_0x51e0('0x73')]=_0x51e0('0x2f');respondWithRpcPromise('EventManager',_0x51e0('0x74'),{'event':_0x51e0('0x7c'),'message':_0x393777['message']},client9002);return _0x4e5bb2;}return null;})[_0x51e0('0x32')](respondWithResult(_0x497f06,null))['catch'](handleError(_0x497f06,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index d4c1706..af1e01d 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 _0x0e0c=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x5bcc2f,_0x13e289){var _0x29c210=function(_0xb08e6f){while(--_0xb08e6f){_0x5bcc2f['push'](_0x5bcc2f['shift']());}};_0x29c210(++_0x13e289);}(_0x0e0c,0x1ae));var _0xc0e0=function(_0x3e2961,_0x4331dc){_0x3e2961=_0x3e2961-0x0;var _0x1188b3=_0x0e0c[_0x3e2961];return _0x1188b3;};'use strict';var EventEmitter=require(_0xc0e0('0x0'));var OpenchannelMessage=require(_0xc0e0('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc0e0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0e0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x26e1fe){return function(_0x34c0b0,_0x409126,_0x4938a4){OpenchannelMessageEvents[_0xc0e0('0x4')](_0x26e1fe+':'+_0x34c0b0['id'],_0x34c0b0);OpenchannelMessageEvents['emit'](_0x26e1fe,_0x34c0b0);_0x4938a4(null);};}for(var e in events){if(events[_0xc0e0('0x5')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xc0e0('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8e85=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x39a3c7,_0x29ed96){var _0x507c74=function(_0x508bd4){while(--_0x508bd4){_0x39a3c7['push'](_0x39a3c7['shift']());}};_0x507c74(++_0x29ed96);}(_0x8e85,0x1b6));var _0x58e8=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x8e85[_0xd1d19a];return _0x52a79d;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x58e8('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x58e8('0x1')](0x0);var events={'afterCreate':_0x58e8('0x2'),'afterUpdate':_0x58e8('0x3'),'afterDestroy':_0x58e8('0x4')};function emitEvent(_0x87d83){return function(_0x493dbe,_0x400c1a,_0x7afc01){OpenchannelMessageEvents[_0x58e8('0x5')](_0x87d83+':'+_0x493dbe['id'],_0x493dbe);OpenchannelMessageEvents['emit'](_0x87d83,_0x493dbe);_0x7afc01(null);};}for(var e in events){if(events[_0x58e8('0x6')](e)){var event=events[e];OpenchannelMessage[_0x58e8('0x7')](e,emitEvent(event));}}module[_0x58e8('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index f0b614d..dc863ff 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 _0xea28=['moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','get','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','Contact','POST','GET','afterCreate','threadId','finally','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x34cf0d,_0x96a0eb){var _0x1d2cb0=function(_0x33f46c){while(--_0x33f46c){_0x34cf0d['push'](_0x34cf0d['shift']());}};_0x1d2cb0(++_0x96a0eb);}(_0xea28,0x13a));var _0x8ea2=function(_0x4457c2,_0x8cf8e8){_0x4457c2=_0x4457c2-0x0;var _0xbc62e4=_0xea28[_0x4457c2];return _0xbc62e4;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'paranoid':![],'indexes':[{'name':_0x8ea2('0xe'),'fields':[_0x8ea2('0xf')],'type':_0x8ea2('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x320750,_0x3de4a1,_0x3000f9){var _0x3d0b35=_0x513a0d[_0x8ea2('0x11')];var _0x500b82=_0x320750['get']({'plain':!![]});if(_0x500b82[_0x8ea2('0x12')][_0x8ea2('0x13')]()==='in'||_0x500b82[_0x8ea2('0x12')]['toLowerCase']()===_0x8ea2('0x14')&&!_0x500b82[_0x8ea2('0x15')]&&!_[_0x8ea2('0x16')](_0x500b82[_0x8ea2('0x17')])){_0x3d0b35[_0x8ea2('0x18')]['findOne']({'where':{'id':_0x500b82[_0x8ea2('0x19')]}})['then'](function(_0x4b2192){if(_0x4b2192){_0x4b2192[_0x8ea2('0x1a')]({'lastMsgAt':_0x500b82[_0x8ea2('0x1b')],'lastMsgDirection':_0x500b82[_0x8ea2('0x12')][_0x8ea2('0x13')]()});}})[_0x8ea2('0x1c')](function(_0xbb9bd1){console[_0x8ea2('0x1d')](_0xbb9bd1);});}if(_0x500b82[_0x8ea2('0x12')]===_0x8ea2('0x14')&&!_0x500b82[_0x8ea2('0x15')]){var _0x2dfa7c;_0x3d0b35[_0x8ea2('0x1e')][_0x8ea2('0x1f')]()[_0x8ea2('0x20')](function(_0x1b64cf){return _0x3d0b35[_0x8ea2('0x21')][_0x8ea2('0x22')]({'where':{'id':_0x500b82[_0x8ea2('0x23')]},'include':[{'model':_0x3d0b35[_0x8ea2('0x18')],'as':_0x8ea2('0x24'),'where':{'id':_0x500b82[_0x8ea2('0x19')]},'limit':0x1,'include':[{'model':_0x3d0b35[_0x8ea2('0x1e')],'as':'Contact','attributes':_['keys'](_0x1b64cf)}]}]});})[_0x8ea2('0x20')](function(_0x248c18){_0x2dfa7c=_0x248c18[_0x8ea2('0x25')]({'plain':!![]});if(_0x2dfa7c&&_0x2dfa7c['replyUri']){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),'afterCreate',util[_0x8ea2('0x28')](_0x8ea2('0x29'),_0x500b82['id'],_0x2dfa7c[_0x8ea2('0x2a')]));if(_0x2dfa7c[_0x8ea2('0x24')]&&_0x2dfa7c[_0x8ea2('0x24')][_0x8ea2('0x2b')]){_0x500b82[_0x8ea2('0x2c')]=_[_0x8ea2('0x2d')](_0x2dfa7c[_0x8ea2('0x24')][0x0],'Contact');_0x500b82[_0x8ea2('0x2e')]=_0x2dfa7c['Interactions'][0x0][_0x8ea2('0x2e')];}var _0x3de4a1={'method':_0x8ea2('0x2f'),'uri':encodeURI(_0x2dfa7c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3de4a1['method']){case _0x8ea2('0x30'):_0x3de4a1['qs']=_0x500b82;break;case'POST':_0x3de4a1[_0x8ea2('0xf')]=_0x500b82;break;}return rp(_0x3de4a1)['then'](function(_0x3be291){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x8ea2('0x31'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x500b82['id'],_0x2dfa7c[_0x8ea2('0x2a')]));if(_0x3be291['body'][_0x8ea2('0x32')]&&_0x3be291[_0x8ea2('0xf')][_0x8ea2('0x32')]!=_0x500b82[_0x8ea2('0x2c')][_0x8ea2('0x32')]){return _0x3d0b35[_0x8ea2('0x18')][_0x8ea2('0x1a')]({'threadId':_0x3be291[_0x8ea2('0xf')][_0x8ea2('0x32')]},{'logging':!![],'where':{'id':_0x500b82[_0x8ea2('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x320750['update']({'read':!![]});})[_0x8ea2('0x1c')](function(_0x188553){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x8ea2('0x31'),util['inspect'](_0x188553,{'showHidden':![],'depth':null}));_0x3000f9();});}else{_0x3000f9();}})[_0x8ea2('0x33')](function(){_0x3000f9();});}else{_0x3000f9();}}},'charset':_0x8ea2('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5eb8=['OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','omit','POST','method','GET','info','body','Interaction','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','then','update','createdAt','catch','error','out','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys'];(function(_0x140adb,_0x162115){var _0x37cf2f=function(_0x318b55){while(--_0x318b55){_0x140adb['push'](_0x140adb['shift']());}};_0x37cf2f(++_0x162115);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3485f8,_0x1b66cf){_0x3485f8=_0x3485f8-0x0;var _0x1fbba7=_0x5eb8[_0x3485f8];return _0x1fbba7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'paranoid':![],'indexes':[{'name':_0x85eb('0xc'),'fields':['body'],'type':_0x85eb('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50ea77,_0x1f0036,_0x40d6b6){var _0x673228=_0x2bf83c[_0x85eb('0xe')];var _0x1dacf2=_0x50ea77[_0x85eb('0xf')]({'plain':!![]});if(_0x1dacf2[_0x85eb('0x10')]['toLowerCase']()==='in'||_0x1dacf2[_0x85eb('0x10')][_0x85eb('0x11')]()==='out'&&!_0x1dacf2[_0x85eb('0x12')]&&!_[_0x85eb('0x13')](_0x1dacf2[_0x85eb('0x14')])){_0x673228[_0x85eb('0x15')]['findOne']({'where':{'id':_0x1dacf2['OpenchannelInteractionId']}})[_0x85eb('0x16')](function(_0x5c760a){if(_0x5c760a){_0x5c760a[_0x85eb('0x17')]({'lastMsgAt':_0x1dacf2[_0x85eb('0x18')],'lastMsgDirection':_0x1dacf2[_0x85eb('0x10')][_0x85eb('0x11')]()});}})[_0x85eb('0x19')](function(_0x49efdf){console[_0x85eb('0x1a')](_0x49efdf);});}if(_0x1dacf2['direction']===_0x85eb('0x1b')&&!_0x1dacf2[_0x85eb('0x12')]){var _0x3e23e8;_0x673228[_0x85eb('0x1c')]['describe']()['then'](function(_0x50d2a8){return _0x673228[_0x85eb('0x1d')][_0x85eb('0x1e')]({'where':{'id':_0x1dacf2[_0x85eb('0x1f')]},'include':[{'model':_0x673228[_0x85eb('0x15')],'as':_0x85eb('0x20'),'where':{'id':_0x1dacf2[_0x85eb('0x21')]},'limit':0x1,'include':[{'model':_0x673228['CmContact'],'as':_0x85eb('0x22'),'attributes':_[_0x85eb('0x23')](_0x50d2a8)}]}]});})[_0x85eb('0x16')](function(_0x4e8041){_0x3e23e8=_0x4e8041['get']({'plain':!![]});if(_0x3e23e8&&_0x3e23e8['replyUri']){logger['info'](_0x85eb('0x24'),_0x85eb('0x25'),util[_0x85eb('0x26')](_0x85eb('0x27'),_0x1dacf2['id'],_0x3e23e8[_0x85eb('0x28')]));if(_0x3e23e8[_0x85eb('0x20')]&&_0x3e23e8['Interactions']['length']){_0x1dacf2['Interaction']=_[_0x85eb('0x29')](_0x3e23e8[_0x85eb('0x20')][0x0],_0x85eb('0x22'));_0x1dacf2[_0x85eb('0x22')]=_0x3e23e8[_0x85eb('0x20')][0x0][_0x85eb('0x22')];}var _0x1f0036={'method':_0x85eb('0x2a'),'uri':encodeURI(_0x3e23e8[_0x85eb('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1f0036[_0x85eb('0x2b')]){case _0x85eb('0x2c'):_0x1f0036['qs']=_0x1dacf2;break;case _0x85eb('0x2a'):_0x1f0036['body']=_0x1dacf2;break;}return rp(_0x1f0036)[_0x85eb('0x16')](function(_0x792d3a){logger[_0x85eb('0x2d')](_0x85eb('0x24'),_0x85eb('0x25'),util[_0x85eb('0x26')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1dacf2['id'],_0x3e23e8['replyUri']));if(_0x792d3a[_0x85eb('0x2e')]['threadId']&&_0x792d3a[_0x85eb('0x2e')]['threadId']!=_0x1dacf2[_0x85eb('0x2f')][_0x85eb('0x30')]){return _0x673228[_0x85eb('0x15')][_0x85eb('0x17')]({'threadId':_0x792d3a[_0x85eb('0x2e')][_0x85eb('0x30')]},{'logging':!![],'where':{'id':_0x1dacf2[_0x85eb('0x2f')]['id']}});}else{return;}})['then'](function(){return _0x50ea77[_0x85eb('0x17')]({'read':!![]});})[_0x85eb('0x19')](function(_0x515ee9){logger[_0x85eb('0x1a')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x85eb('0x31')](_0x515ee9,{'showHidden':![],'depth':null}));_0x40d6b6();});}else{_0x40d6b6();}})[_0x85eb('0x32')](function(){_0x40d6b6();});}else{_0x40d6b6();}}},'charset':_0x85eb('0x33'),'collate':_0x85eb('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 8ae5a7d..728b206 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4f96a4,_0x290028){var _0x4187ea=function(_0x2a2628){while(--_0x2a2628){_0x4f96a4['push'](_0x4f96a4['shift']());}};_0x4187ea(++_0x290028);}(_0x5f2f,0x73));var _0xf5f2=function(_0x385c7c,_0x24f293){_0x385c7c=_0x385c7c-0x0;var _0x3aed6b=_0x5f2f[_0x385c7c];return _0x3aed6b;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x4fed83,_0x3f91a5){var _0x481cef=function(_0x3d2264){while(--_0x3d2264){_0x4fed83['push'](_0x4fed83['shift']());}};_0x481cef(++_0x3f91a5);}(_0x2ef3,0xba));var _0x32ef=function(_0x226119,_0x124a2f){_0x226119=_0x226119-0x0;var _0x112480=_0x2ef3[_0x226119];return _0x112480;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 5a9b192..21a39a5 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 _0xc76e=['emit','removeListener','length','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x70846e,_0x13c8f5){var _0xd1d551=function(_0x1a5505){while(--_0x1a5505){_0x70846e['push'](_0x70846e['shift']());}};_0xd1d551(++_0x13c8f5);}(_0xc76e,0x10c));var _0xec76=function(_0x31f837,_0x256a07){_0x31f837=_0x31f837-0x0;var _0x897761=_0xc76e[_0x31f837];return _0x897761;};'use strict';var OpenchannelMessageEvents=require(_0xec76('0x0'));var events=[_0xec76('0x1'),_0xec76('0x2'),_0xec76('0x3')];function createListener(_0x51a301,_0x53bd14){return function(_0x596047){_0x53bd14[_0xec76('0x4')](_0x51a301,_0x596047);};}function removeListener(_0x1d70c9,_0x539538){return function(){OpenchannelMessageEvents[_0xec76('0x5')](_0x1d70c9,_0x539538);};}exports['register']=function(_0x3656bb){for(var _0x2ee482=0x0,_0x2d74f3=events[_0xec76('0x6')];_0x2ee482<_0x2d74f3;_0x2ee482++){var _0x2a8b9e=events[_0x2ee482];var _0x27533f=createListener(_0xec76('0x7')+_0x2a8b9e,_0x3656bb);OpenchannelMessageEvents['on'](_0x2a8b9e,_0x27533f);}}; \ No newline at end of file +var _0x37c5=['remove','update','emit','removeListener','openchannelMessage:','save'];(function(_0x64ecde,_0xfac530){var _0x32b947=function(_0x215d64){while(--_0x215d64){_0x64ecde['push'](_0x64ecde['shift']());}};_0x32b947(++_0xfac530);}(_0x37c5,0xa7));var _0x537c=function(_0xfe7bf0,_0xb27b42){_0xfe7bf0=_0xfe7bf0-0x0;var _0x1d2d2b=_0x37c5[_0xfe7bf0];return _0x1d2d2b;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x537c('0x0'),_0x537c('0x1'),_0x537c('0x2')];function createListener(_0x11f076,_0x1c5b5f){return function(_0x183b59){_0x1c5b5f[_0x537c('0x3')](_0x11f076,_0x183b59);};}function removeListener(_0x42bd15,_0x2c0854){return function(){OpenchannelMessageEvents[_0x537c('0x4')](_0x42bd15,_0x2c0854);};}exports['register']=function(_0x42c86a){for(var _0x1156f4=0x0,_0x336920=events['length'];_0x1156f4<_0x336920;_0x1156f4++){var _0x36bf4a=events[_0x1156f4];var _0x67f986=createListener(_0x537c('0x5')+_0x36bf4a,_0x42c86a);OpenchannelMessageEvents['on'](_0x36bf4a,_0x67f986);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 8842850..2911e5e 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 _0xa74c=['/:id/users','addAgents','update','delete','destroy','/:id/teams','removeTeams','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','addTeams'];(function(_0x52c439,_0x3fcfd2){var _0x25221a=function(_0x3a747e){while(--_0x3a747e){_0x52c439['push'](_0x52c439['shift']());}};_0x25221a(++_0x3fcfd2);}(_0xa74c,0xd9));var _0xca74=function(_0xb7d422,_0x225839){_0xb7d422=_0xb7d422-0x0;var _0x29f3da=_0xa74c[_0xb7d422];return _0x29f3da;};'use strict';var multer=require(_0xca74('0x0'));var util=require(_0xca74('0x1'));var path=require(_0xca74('0x2'));var timeout=require('connect-timeout');var express=require(_0xca74('0x3'));var router=express[_0xca74('0x4')]();var fs_extra=require(_0xca74('0x5'));var auth=require(_0xca74('0x6'));var interaction=require(_0xca74('0x7'));var config=require(_0xca74('0x8'));var controller=require(_0xca74('0x9'));router[_0xca74('0xa')]('/',auth[_0xca74('0xb')](),controller[_0xca74('0xc')]);router[_0xca74('0xa')](_0xca74('0xd'),auth[_0xca74('0xb')](),controller['describe']);router[_0xca74('0xa')](_0xca74('0xe'),auth['isAuthenticated'](),controller[_0xca74('0xf')]);router[_0xca74('0xa')](_0xca74('0x10'),auth[_0xca74('0xb')](),controller[_0xca74('0x11')]);router['get']('/:id/teams',auth[_0xca74('0xb')](),controller[_0xca74('0x12')]);router['get']('/:id/users',auth[_0xca74('0xb')](),controller[_0xca74('0x13')]);router[_0xca74('0x14')]('/',auth[_0xca74('0xb')](),controller[_0xca74('0x15')]);router[_0xca74('0x14')]('/:id/teams',auth[_0xca74('0xb')](),controller[_0xca74('0x16')]);router['post'](_0xca74('0x17'),auth[_0xca74('0xb')](),controller[_0xca74('0x18')]);router['put'](_0xca74('0xe'),auth[_0xca74('0xb')](),controller[_0xca74('0x19')]);router[_0xca74('0x1a')](_0xca74('0xe'),auth[_0xca74('0xb')](),controller[_0xca74('0x1b')]);router['delete'](_0xca74('0x1c'),auth[_0xca74('0xb')](),controller[_0xca74('0x1d')]);router[_0xca74('0x1a')](_0xca74('0x17'),auth[_0xca74('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xcdb6=['removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','/:id/members','getMembers','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','update','delete'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0xcdb6,0xb8));var _0x6cdb=function(_0x133409,_0x3e032e){_0x133409=_0x133409-0x0;var _0x3bd813=_0xcdb6[_0x133409];return _0x3bd813;};'use strict';var multer=require(_0x6cdb('0x0'));var util=require(_0x6cdb('0x1'));var path=require('path');var timeout=require(_0x6cdb('0x2'));var express=require(_0x6cdb('0x3'));var router=express[_0x6cdb('0x4')]();var fs_extra=require(_0x6cdb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6cdb('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router['get']('/',auth[_0x6cdb('0x7')](),controller[_0x6cdb('0x8')]);router[_0x6cdb('0x9')](_0x6cdb('0xa'),auth['isAuthenticated'](),controller[_0x6cdb('0xb')]);router[_0x6cdb('0x9')](_0x6cdb('0xc'),auth[_0x6cdb('0x7')](),controller['show']);router[_0x6cdb('0x9')](_0x6cdb('0xd'),auth[_0x6cdb('0x7')](),controller[_0x6cdb('0xe')]);router[_0x6cdb('0x9')]('/:id/teams',auth[_0x6cdb('0x7')](),controller['getTeams']);router[_0x6cdb('0x9')]('/:id/users',auth[_0x6cdb('0x7')](),controller[_0x6cdb('0xf')]);router[_0x6cdb('0x10')]('/',auth['isAuthenticated'](),controller[_0x6cdb('0x11')]);router['post'](_0x6cdb('0x12'),auth[_0x6cdb('0x7')](),controller[_0x6cdb('0x13')]);router[_0x6cdb('0x10')](_0x6cdb('0x14'),auth['isAuthenticated'](),controller[_0x6cdb('0x15')]);router['put']('/:id',auth[_0x6cdb('0x7')](),controller[_0x6cdb('0x16')]);router[_0x6cdb('0x17')](_0x6cdb('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x6cdb('0x17')](_0x6cdb('0x12'),auth[_0x6cdb('0x7')](),controller[_0x6cdb('0x18')]);router[_0x6cdb('0x17')]('/:id/users',auth[_0x6cdb('0x7')](),controller[_0x6cdb('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 1576345..3c8d879 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 _0x0210=['STRING','rrmemory','roundrobin','sequelize','exports','name'];(function(_0x36a9fc,_0x3cbb08){var _0x3869b7=function(_0x5acdf0){while(--_0x5acdf0){_0x36a9fc['push'](_0x36a9fc['shift']());}};_0x3869b7(++_0x3cbb08);}(_0x0210,0x1bf));var _0x0021=function(_0xb8e3ae,_0x49478e){_0xb8e3ae=_0xb8e3ae-0x0;var _0x4e6b81=_0x0210[_0xb8e3ae];return _0x4e6b81;};'use strict';var Sequelize=require(_0x0021('0x0'));module[_0x0021('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0021('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0021('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0021('0x4'),'beepall',_0x0021('0x5'))}}; \ No newline at end of file +var _0xaebb=['roundrobin','sequelize','exports','name','STRING','INTEGER','rrmemory','beepall'];(function(_0x3dd630,_0x1e7b6e){var _0x5a4e85=function(_0x4a2e06){while(--_0x4a2e06){_0x3dd630['push'](_0x3dd630['shift']());}};_0x5a4e85(++_0x1e7b6e);}(_0xaebb,0x1b1));var _0xbaeb=function(_0x182891,_0x4716b0){_0x182891=_0x182891-0x0;var _0x166fb5=_0xaebb[_0x182891];return _0x166fb5;};'use strict';var Sequelize=require(_0xbaeb('0x0'));module[_0xbaeb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbaeb('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbaeb('0x3')]},'timeout':{'type':Sequelize[_0xbaeb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xbaeb('0x5'),_0xbaeb('0x6'),_0xbaeb('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 7d72099..97371e1 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 _0x339f=['map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueue','includeAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','hasOwnProperty','order','OpenchannelQueueId','UserOpenchannelQueue','findAll','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','online','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Team','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','includes','all','union','value','isEmpty','removeAgents','addAgents','omit','isArray','userOpenchannelQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','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','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','error','name','send'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x339f,0x188));var _0xf339=function(_0x2229dd,_0x448615){_0x2229dd=_0x2229dd-0x0;var _0x18ce8f=_0x339f[_0x2229dd];return _0x18ce8f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf339('0x0'));var zipdir=require(_0xf339('0x1'));var jsonpatch=require(_0xf339('0x2'));var rp=require(_0xf339('0x3'));var moment=require(_0xf339('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf339('0x5'));var util=require(_0xf339('0x6'));var path=require(_0xf339('0x7'));var sox=require(_0xf339('0x8'));var csv=require(_0xf339('0x9'));var ejs=require(_0xf339('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf339('0xb'));var crypto=require(_0xf339('0xc'));var jsforce=require(_0xf339('0xd'));var deskjs=require(_0xf339('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf339('0xf'));var Papa=require(_0xf339('0x10'));var Redis=require(_0xf339('0x11'));var authService=require(_0xf339('0x12'));var qs=require(_0xf339('0x13'));var as=require(_0xf339('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf339('0x15'))(_0xf339('0x16'));var utils=require(_0xf339('0x17'));var config=require(_0xf339('0x18'));var licenseUtil=require(_0xf339('0x19'));var db=require('../../mysqldb')['db'];config[_0xf339('0x1a')]=_[_0xf339('0x1b')](config[_0xf339('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf339('0x1c'))(new Redis(config[_0xf339('0x1a')]));require(_0xf339('0x1d'))[_0xf339('0x1e')](socket);function respondWithStatusCode(_0x537f8b,_0x2db5bb){_0x2db5bb=_0x2db5bb||0xcc;return function(_0x51298a){if(_0x51298a){return _0x537f8b[_0xf339('0x1f')](_0x2db5bb);}return _0x537f8b['status'](_0x2db5bb)[_0xf339('0x20')]();};}function respondWithResult(_0x4f6f5b,_0x1f70c1){_0x1f70c1=_0x1f70c1||0xc8;return function(_0x3fdbc8){if(_0x3fdbc8){return _0x4f6f5b['status'](_0x1f70c1)[_0xf339('0x21')](_0x3fdbc8);}};}function respondWithFilteredResult(_0x2b03a1,_0xc915e4){return function(_0x38c059){if(_0x38c059){var _0x3339a0=typeof _0xc915e4[_0xf339('0x22')]===_0xf339('0x23')&&typeof _0xc915e4['limit']===_0xf339('0x23');var _0x1c6c35=_0x38c059[_0xf339('0x24')];var _0xb7c14e=_0x3339a0?0x0:_0xc915e4[_0xf339('0x22')];var _0x1e92ca=_0x3339a0?_0x38c059[_0xf339('0x24')]:_0xc915e4['offset']+_0xc915e4[_0xf339('0x25')];var _0x5e551b;if(_0x1e92ca>=_0x1c6c35){_0x1e92ca=_0x1c6c35;_0x5e551b=0xc8;}else{_0x5e551b=0xce;}_0x2b03a1[_0xf339('0x26')](_0x5e551b);return _0x2b03a1[_0xf339('0x27')](_0xf339('0x28'),_0xb7c14e+'-'+_0x1e92ca+'/'+_0x1c6c35)[_0xf339('0x21')](_0x38c059);}return null;};}function patchUpdates(_0x39d1bc){return function(_0x142235){try{jsonpatch[_0xf339('0x29')](_0x142235,_0x39d1bc,!![]);}catch(_0x401be3){return BPromise[_0xf339('0x2a')](_0x401be3);}return _0x142235[_0xf339('0x2b')]();};}function saveUpdates(_0xace47,_0x8f7c24){return function(_0x5b1293){if(_0x5b1293){return _0x5b1293[_0xf339('0x2c')](_0xace47)[_0xf339('0x2d')](function(_0xd23e2f){return _0xd23e2f;});}return null;};}function removeEntity(_0x303aff,_0x18b4f6){return function(_0x593195){if(_0x593195){return _0x593195[_0xf339('0x2e')]()['then'](function(){var _0x4b16d7=_0x593195[_0xf339('0x2f')]({'plain':!![]});var _0x13f052=_0xf339('0x30');return db['UserProfileResource'][_0xf339('0x2e')]({'where':{'type':_0x13f052,'resourceId':_0x4b16d7['id']}})[_0xf339('0x2d')](function(){return _0x593195;});})[_0xf339('0x2d')](function(){_0x303aff[_0xf339('0x26')](0xcc)[_0xf339('0x20')]();});}};}function handleEntityNotFound(_0x3086a0,_0x5b0468){return function(_0x7e8b09){if(!_0x7e8b09){_0x3086a0[_0xf339('0x1f')](0x194);}return _0x7e8b09;};}function handleError(_0x4e0107,_0x2d062f){_0x2d062f=_0x2d062f||0x1f4;return function(_0x1d73f8){logger[_0xf339('0x31')](_0x1d73f8['stack']);if(_0x1d73f8['name']){delete _0x1d73f8[_0xf339('0x32')];}_0x4e0107[_0xf339('0x26')](_0x2d062f)[_0xf339('0x33')](_0x1d73f8);};}exports['index']=function(_0x42bd7d,_0x5d4efd){var _0x369229={},_0x3d1e08={},_0x12ea77={'count':0x0,'rows':[]};var _0x364423=_[_0xf339('0x34')](db['OpenchannelQueue'][_0xf339('0x35')],function(_0x189872){return{'name':_0x189872[_0xf339('0x36')],'type':_0x189872[_0xf339('0x37')][_0xf339('0x38')]};});_0x3d1e08['model']=_[_0xf339('0x34')](_0x364423,_0xf339('0x32'));_0x3d1e08['query']=_[_0xf339('0x39')](_0x42bd7d[_0xf339('0x3a')]);_0x3d1e08[_0xf339('0x3b')]=_[_0xf339('0x3c')](_0x3d1e08[_0xf339('0x3d')],_0x3d1e08[_0xf339('0x3a')]);_0x369229[_0xf339('0x3e')]=_['intersection'](_0x3d1e08[_0xf339('0x3d')],qs[_0xf339('0x3f')](_0x42bd7d[_0xf339('0x3a')][_0xf339('0x3f')]));_0x369229['attributes']=_0x369229[_0xf339('0x3e')][_0xf339('0x40')]?_0x369229['attributes']:_0x3d1e08[_0xf339('0x3d')];if(!_0x42bd7d[_0xf339('0x3a')]['hasOwnProperty'](_0xf339('0x41'))){_0x369229[_0xf339('0x25')]=qs[_0xf339('0x25')](_0x42bd7d['query'][_0xf339('0x25')]);_0x369229[_0xf339('0x22')]=qs['offset'](_0x42bd7d[_0xf339('0x3a')][_0xf339('0x22')]);}_0x369229['order']=qs['sort'](_0x42bd7d['query'][_0xf339('0x42')]);_0x369229[_0xf339('0x43')]=qs[_0xf339('0x3b')](_[_0xf339('0x44')](_0x42bd7d[_0xf339('0x3a')],_0x3d1e08[_0xf339('0x3b')]),_0x364423);if(_0x42bd7d[_0xf339('0x3a')][_0xf339('0x45')]){_0x369229['where']=_[_0xf339('0x46')](_0x369229[_0xf339('0x43')],{'$or':_[_0xf339('0x34')](_0x364423,function(_0x3e0d91){if(_0x3e0d91[_0xf339('0x37')]!==_0xf339('0x47')){var _0x226c04={};_0x226c04[_0x3e0d91[_0xf339('0x32')]]={'$like':'%'+_0x42bd7d[_0xf339('0x3a')][_0xf339('0x45')]+'%'};return _0x226c04;}})});}_0x369229=_[_0xf339('0x46')]({},_0x369229,_0x42bd7d[_0xf339('0x48')]);var _0x47ad86={'where':_0x369229['where']};return db[_0xf339('0x49')][_0xf339('0x24')](_0x47ad86)['then'](function(_0x3e1b7c){_0x12ea77[_0xf339('0x24')]=_0x3e1b7c;if(_0x42bd7d[_0xf339('0x3a')][_0xf339('0x4a')]){_0x369229['include']=[{'all':!![]}];}return db[_0xf339('0x49')]['findAll'](_0x369229);})['then'](function(_0x4513d5){_0x12ea77[_0xf339('0x4b')]=_0x4513d5;return _0x12ea77;})['then'](respondWithFilteredResult(_0x5d4efd,_0x369229))[_0xf339('0x4c')](handleError(_0x5d4efd,null));};exports[_0xf339('0x4d')]=function(_0x6791d7,_0x3c86b2){var _0x480726={'raw':!![],'where':{'id':_0x6791d7['params']['id']}},_0xb78705={};_0xb78705[_0xf339('0x3d')]=_[_0xf339('0x39')](db[_0xf339('0x49')][_0xf339('0x35')]);_0xb78705[_0xf339('0x3a')]=_[_0xf339('0x39')](_0x6791d7[_0xf339('0x3a')]);_0xb78705[_0xf339('0x3b')]=_[_0xf339('0x3c')](_0xb78705['model'],_0xb78705['query']);_0x480726[_0xf339('0x3e')]=_[_0xf339('0x3c')](_0xb78705[_0xf339('0x3d')],qs[_0xf339('0x3f')](_0x6791d7[_0xf339('0x3a')]['fields']));_0x480726[_0xf339('0x3e')]=_0x480726[_0xf339('0x3e')][_0xf339('0x40')]?_0x480726['attributes']:_0xb78705[_0xf339('0x3d')];if(_0x6791d7[_0xf339('0x3a')][_0xf339('0x4a')]){_0x480726[_0xf339('0x4e')]=[{'all':!![]}];}_0x480726=_[_0xf339('0x46')]({},_0x480726,_0x6791d7[_0xf339('0x48')]);return db[_0xf339('0x49')][_0xf339('0x4f')](_0x480726)[_0xf339('0x2d')](handleEntityNotFound(_0x3c86b2,null))[_0xf339('0x2d')](respondWithResult(_0x3c86b2,null))[_0xf339('0x4c')](handleError(_0x3c86b2,null));};exports[_0xf339('0x50')]=function(_0x22370f,_0x202363){return db[_0xf339('0x49')]['create'](_0x22370f[_0xf339('0x51')],{})[_0xf339('0x2d')](function(_0x1b3580){var _0x204663=_0x22370f[_0xf339('0x52')]['get']({'plain':!![]});if(!_0x204663)throw new Error(_0xf339('0x53'));if(_0x204663[_0xf339('0x54')]===_0xf339('0x52')){var _0x1e557d=_0x1b3580['get']({'plain':!![]});var _0x5424f8=_0xf339('0x30');return db[_0xf339('0x55')][_0xf339('0x4f')]({'where':{'name':_0x5424f8,'userProfileId':_0x204663[_0xf339('0x56')]},'raw':!![]})[_0xf339('0x2d')](function(_0x1416b2){if(_0x1416b2&&_0x1416b2['autoAssociation']===0x0){return db[_0xf339('0x57')][_0xf339('0x50')]({'name':_0x1e557d[_0xf339('0x32')],'resourceId':_0x1e557d['id'],'type':_0x1416b2[_0xf339('0x32')],'sectionId':_0x1416b2['id']},{})[_0xf339('0x2d')](function(){return _0x1b3580;});}else{return _0x1b3580;}})[_0xf339('0x4c')](function(_0x1c38f5){logger[_0xf339('0x31')](_0xf339('0x58'),_0x1c38f5);throw _0x1c38f5;});}return _0x1b3580;})[_0xf339('0x2d')](respondWithResult(_0x202363,0xc9))[_0xf339('0x4c')](handleError(_0x202363,null));};exports[_0xf339('0x2c')]=function(_0x90f85e,_0x47b4d0){if(_0x90f85e[_0xf339('0x51')]['id']){delete _0x90f85e['body']['id'];}return db['OpenchannelQueue'][_0xf339('0x4f')]({'where':{'id':_0x90f85e[_0xf339('0x59')]['id']}})[_0xf339('0x2d')](handleEntityNotFound(_0x47b4d0,null))['then'](saveUpdates(_0x90f85e[_0xf339('0x51')],null))[_0xf339('0x2d')](respondWithResult(_0x47b4d0,null))[_0xf339('0x4c')](handleError(_0x47b4d0,null));};exports[_0xf339('0x2e')]=function(_0x3e8aa1,_0x2a95c9){return db[_0xf339('0x49')][_0xf339('0x4f')]({'where':{'id':_0x3e8aa1['params']['id']}})[_0xf339('0x2d')](handleEntityNotFound(_0x2a95c9,null))[_0xf339('0x2d')](removeEntity(_0x2a95c9,null))['catch'](handleError(_0x2a95c9,null));};exports['describe']=function(_0x585b56,_0x1c998d){return db['OpenchannelQueue'][_0xf339('0x5a')]()[_0xf339('0x2d')](respondWithResult(_0x1c998d,null))[_0xf339('0x4c')](handleError(_0x1c998d,null));};exports[_0xf339('0x5b')]=function(_0x45f43d,_0x269c6e,_0x2b179d){var _0x3df7f4={'raw':!![],'where':{}},_0x32e967={},_0xe50018;return db[_0xf339('0x49')][_0xf339('0x5c')]({'where':{'id':_0x45f43d[_0xf339('0x59')]['id']}})[_0xf339('0x2d')](handleEntityNotFound(_0x269c6e,null))[_0xf339('0x2d')](function(_0x435306){if(_0x435306){_0xe50018=_0x435306[_0xf339('0x2f')]({'plain':!![]});_0x32e967[_0xf339('0x3d')]=_[_0xf339('0x39')](db['UserOpenchannelQueue'][_0xf339('0x35')]);_0x32e967['query']=_['keys'](_0x45f43d[_0xf339('0x3a')]);_0x32e967[_0xf339('0x3b')]=_[_0xf339('0x3c')](_0x32e967['model'],_0x32e967[_0xf339('0x3a')]);_0x3df7f4[_0xf339('0x3e')]=_[_0xf339('0x3c')](_0x32e967['model'],qs[_0xf339('0x3f')](_0x45f43d[_0xf339('0x3a')][_0xf339('0x3f')]));_0x3df7f4[_0xf339('0x3e')]=_0x3df7f4['attributes']['length']?_0x3df7f4[_0xf339('0x3e')]:_0x32e967[_0xf339('0x3d')];if(!_0x45f43d['query'][_0xf339('0x5d')]('nolimit')){_0x3df7f4['limit']=qs['limit'](_0x45f43d['query'][_0xf339('0x25')]);_0x3df7f4[_0xf339('0x22')]=qs[_0xf339('0x22')](_0x45f43d['query'][_0xf339('0x22')]);}_0x3df7f4[_0xf339('0x5e')]=qs['sort'](_0x45f43d[_0xf339('0x3a')][_0xf339('0x42')]);_0x3df7f4[_0xf339('0x43')]=qs[_0xf339('0x3b')](_[_0xf339('0x44')](_0x45f43d['query'],_0x32e967[_0xf339('0x3b')]));_0x3df7f4[_0xf339('0x43')][_0xf339('0x5f')]=_0x435306['id'];if(_0x45f43d[_0xf339('0x3a')][_0xf339('0x45')]){_0x3df7f4[_0xf339('0x43')]=_[_0xf339('0x46')](_0x3df7f4[_0xf339('0x43')],{'$or':_[_0xf339('0x34')](_0x3df7f4[_0xf339('0x3e')],function(_0x4e376b){var _0x38e7a0={};_0x38e7a0[_0x4e376b]={'$like':'%'+_0x45f43d[_0xf339('0x3a')][_0xf339('0x45')]+'%'};return _0x38e7a0;})});}_0x3df7f4=_[_0xf339('0x46')]({},_0x3df7f4,_0x45f43d['options']);return db[_0xf339('0x60')][_0xf339('0x61')](_0x3df7f4);}})[_0xf339('0x2d')](function(_0x3450e8){if(_0x3450e8){return db[_0xf339('0x62')]['findAndCountAll']({'where':{'id':_['map'](_0x3450e8,_0xf339('0x63')),'role':_0xf339('0x64')},'attributes':['id',_0xf339('0x32'),_0xf339('0x65'),_0xf339('0x66'),_0xf339('0x67')]});}})['then'](function(_0x18a4a1){if(_0x18a4a1){return{'count':_0x18a4a1[_0xf339('0x24')],'rows':_[_0xf339('0x34')](_0x18a4a1[_0xf339('0x4b')],function(_0x57d9da){return{'membername':_0x57d9da[_0xf339('0x32')],'UserId':_0x57d9da['id'],'queue_name':_0xe50018[_0xf339('0x32')],'OpenchannelQueueId':_0xe50018['id'],'interface':util[_0xf339('0x68')](_0xf339('0x69'),_0xf339('0x6a'),_0x57d9da['name']),'penalty':0x0,'paused':_0x57d9da[_0xf339('0x65')],'createdAt':_0x57d9da[_0xf339('0x67')],'updatedAt':_0x57d9da[_0xf339('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf339('0x2d')](respondWithFilteredResult(_0x269c6e,_0x3df7f4))['catch'](handleError(_0x269c6e,null));};exports[_0xf339('0x6b')]=function(_0xf919da,_0x478ad5,_0x173229){var _0x19d900={};var _0x27cdc7={};var _0x2ae1b7;var _0xe76da7;return db[_0xf339('0x49')][_0xf339('0x5c')]({'where':{'id':_0xf919da[_0xf339('0x59')]['id']}})[_0xf339('0x2d')](handleEntityNotFound(_0x478ad5,null))[_0xf339('0x2d')](function(_0x2c5fd8){if(_0x2c5fd8){_0x2ae1b7=_0x2c5fd8;_0x27cdc7['model']=_[_0xf339('0x39')](db['Team'][_0xf339('0x35')]);_0x27cdc7['query']=_[_0xf339('0x39')](_0xf919da[_0xf339('0x3a')]);_0x27cdc7[_0xf339('0x3b')]=_[_0xf339('0x3c')](_0x27cdc7['model'],_0x27cdc7[_0xf339('0x3a')]);_0x19d900['attributes']=_[_0xf339('0x3c')](_0x27cdc7['model'],qs[_0xf339('0x3f')](_0xf919da[_0xf339('0x3a')][_0xf339('0x3f')]));_0x19d900[_0xf339('0x3e')]=_0x19d900[_0xf339('0x3e')]['length']?_0x19d900[_0xf339('0x3e')]:_0x27cdc7[_0xf339('0x3d')];_0x19d900['order']=qs[_0xf339('0x42')](_0xf919da[_0xf339('0x3a')][_0xf339('0x42')]);_0x19d900['where']=qs[_0xf339('0x3b')](_[_0xf339('0x44')](_0xf919da[_0xf339('0x3a')],_0x27cdc7['filters']));if(_0xf919da[_0xf339('0x3a')][_0xf339('0x45')]){_0x19d900['where']=_[_0xf339('0x46')](_0x19d900['where'],{'$or':_[_0xf339('0x34')](_0x19d900[_0xf339('0x3e')],function(_0x2da60b){var _0x45de89={};_0x45de89[_0x2da60b]={'$like':'%'+_0xf919da[_0xf339('0x3a')][_0xf339('0x45')]+'%'};return _0x45de89;})});}_0x19d900=_[_0xf339('0x46')]({},_0x19d900,_0xf919da[_0xf339('0x48')]);return _0x2ae1b7[_0xf339('0x6b')](_0x19d900);}})[_0xf339('0x2d')](function(_0x2ddb6d){if(_0x2ddb6d){_0xe76da7=_0x2ddb6d[_0xf339('0x40')];if(!_0xf919da[_0xf339('0x3a')][_0xf339('0x5d')](_0xf339('0x41'))){_0x19d900[_0xf339('0x25')]=qs[_0xf339('0x25')](_0xf919da[_0xf339('0x3a')][_0xf339('0x25')]);_0x19d900[_0xf339('0x22')]=qs['offset'](_0xf919da[_0xf339('0x3a')]['offset']);}return _0x2ae1b7['getTeams'](_0x19d900);}})['then'](function(_0x429ca9){if(_0x429ca9){return _0x429ca9?{'count':_0xe76da7,'rows':_0x429ca9}:null;}})[_0xf339('0x2d')](respondWithResult(_0x478ad5,null))[_0xf339('0x4c')](handleError(_0x478ad5,null));};exports[_0xf339('0x6c')]=function(_0x1c34d,_0x9c8ca8,_0x385ce8){var _0x12e830=_0x1c34d[_0xf339('0x51')][_0xf339('0x6d')];return db['Team'][_0xf339('0x61')]({'where':{'id':_0x12e830},'attributes':['id'],'include':[{'model':db[_0xf339('0x62')],'as':'Agents','attributes':['id',_0xf339('0x32'),_0xf339('0x6e'),_0xf339('0x6f'),_0xf339('0x70')],'raw':!![]}]})[_0xf339('0x2d')](function(_0x51662d){if(_0x51662d){var _0x11d4ce=_[_0xf339('0x71')](_0x51662d,function(_0x3df952){var _0x37e387=_0x3df952['get']({'plain':!![]});return _0x37e387[_0xf339('0x72')];});return db[_0xf339('0x49')][_0xf339('0x4f')]({'where':{'id':_0x1c34d[_0xf339('0x59')]['id']}})['then'](function(_0x994173){return db['sequelize'][_0xf339('0x73')](function(_0x313c2e){return _0x994173[_0xf339('0x6c')](_0x12e830,{'transaction':_0x313c2e})['then'](function(){return BPromise[_0xf339('0x74')](_0x11d4ce,function(_0x2b5a07){return db['UserOpenchannelQueue'][_0xf339('0x75')]({'where':{'UserId':_0x2b5a07['id'],'OpenchannelQueueId':_0x1c34d[_0xf339('0x59')]['id']},'transaction':_0x313c2e});});})[_0xf339('0x2d')](function(){_0x11d4ce[_0xf339('0x76')](function(_0x19fb03){socket[_0xf339('0x77')](_0xf339('0x78'),{'UserId':_0x19fb03['id'],'OpenchannelQueueId':_0x994173['id']});});});});});}})['then'](respondWithStatusCode(_0x9c8ca8,null))['catch'](handleError(_0x9c8ca8,null));};exports[_0xf339('0x79')]=function(_0xef4c79,_0x1dac5c,_0x2d244d){return db[_0xf339('0x7a')][_0xf339('0x61')]({'where':{'id':_0xef4c79[_0xf339('0x3a')][_0xf339('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xf339('0x62')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf339('0x2d')](handleEntityNotFound(_0x1dac5c,null))[_0xf339('0x2d')](function(_0x3f2872){var _0xd68fda=_[_0xf339('0x34')](_0x3f2872,'id');var _0x5a7703=[];var _0xb37589=[];var _0x32535b=squel[_0xf339('0x7b')]();_0x32535b['field'](_0xf339('0x7c'))[_0xf339('0x7d')](_0xf339('0x7e'),'tq')[_0xf339('0x7f')](_0xf339('0x80'),'ut',_0xf339('0x81'))[_0xf339('0x43')](_0xf339('0x82'),_0xef4c79[_0xf339('0x59')]['id']);for(var _0x551dbc=0x0;_0x551dbc<_0x3f2872[_0xf339('0x40')];_0x551dbc+=0x1){let _0x25b9f2=_0x3f2872[_0x551dbc];for(var _0x18054d=0x0;_0x18054d<_0x25b9f2[_0xf339('0x72')]['length'];_0x18054d+=0x1){let _0x53f19f=_0x25b9f2[_0xf339('0x72')][_0x18054d];var _0x1f8feb=_0x32535b[_0xf339('0x83')]();_0x1f8feb[_0xf339('0x43')](_0xf339('0x84'),_0x53f19f['id']);_0xb37589[_0xf339('0x85')](db[_0xf339('0x86')][_0xf339('0x3a')](_0x1f8feb[_0xf339('0x87')](),{'type':db['sequelize']['QueryTypes'][_0xf339('0x88')]})['then'](function(_0x1d1a76){if(_0x1d1a76[_0xf339('0x40')]===0x1){return _0x53f19f['id'];}else{var _0x4f08bb=_['every'](_[_0xf339('0x34')](_0x1d1a76,'TeamId'),function(_0x346252){return _[_0xf339('0x89')](_0xd68fda,_0x346252);});if(_0x4f08bb){return _0x53f19f['id'];}}}));}}return BPromise[_0xf339('0x8a')](_0xb37589)[_0xf339('0x2d')](function(_0x5c0096){_0x5a7703=_(_0x5a7703)[_0xf339('0x8b')](_0x5c0096)['compact']()[_0xf339('0x8c')]();return db[_0xf339('0x49')]['find']({'where':{'id':_0xef4c79[_0xf339('0x59')]['id']}})[_0xf339('0x2d')](function(_0x5de514){return db['sequelize'][_0xf339('0x73')](function(_0x143092){return _0x5de514[_0xf339('0x79')](_0xef4c79['query'][_0xf339('0x6d')],{'transaction':_0x143092})[_0xf339('0x2d')](function(){if(!_[_0xf339('0x8d')](_0x5a7703)){return _0x5de514[_0xf339('0x8e')](_0x5a7703,{'transaction':_0x143092});}})[_0xf339('0x2d')](function(){_0x5a7703[_0xf339('0x76')](function(_0x3d5ae0){socket[_0xf339('0x77')]('userOpenchannelQueue:remove',{'UserId':_0x3d5ae0,'OpenchannelQueueId':_0x5de514['id']});});});});});});})['then'](respondWithStatusCode(_0x1dac5c,null))[_0xf339('0x4c')](handleError(_0x1dac5c,null));};exports[_0xf339('0x8f')]=function(_0x4341bd,_0x506db9,_0x54b5a5){return db[_0xf339('0x49')][_0xf339('0x4f')]({'where':{'id':_0x4341bd['params']['id']}})[_0xf339('0x2d')](handleEntityNotFound(_0x506db9,null))[_0xf339('0x2d')](function(_0x5123c9){if(_0x5123c9){return _0x5123c9['addAgents'](_0x4341bd[_0xf339('0x51')][_0xf339('0x6d')],_[_0xf339('0x90')](_0x4341bd[_0xf339('0x51')],[_0xf339('0x6d'),'id'])||{})['spread'](function(_0x4d1dd2){for(var _0x203c6a=0x0;_0x203c6a<_0x4341bd[_0xf339('0x51')][_0xf339('0x6d')][_0xf339('0x40')];_0x203c6a+=0x1){socket[_0xf339('0x77')]('userOpenchannelQueue:save',{'UserId':Number(_0x4341bd[_0xf339('0x51')][_0xf339('0x6d')][_0x203c6a]),'OpenchannelQueueId':Number(_0x4341bd['params']['id'])});}return _0x4d1dd2;});}})[_0xf339('0x2d')](respondWithResult(_0x506db9,null))[_0xf339('0x4c')](handleError(_0x506db9,null));};exports[_0xf339('0x8e')]=function(_0x341fc4,_0x5f361c,_0x2bbf36){return db[_0xf339('0x49')]['find']({'where':{'id':_0x341fc4[_0xf339('0x59')]['id']}})['then'](handleEntityNotFound(_0x5f361c,null))[_0xf339('0x2d')](function(_0x5b3b65){if(_0x5b3b65){return _0x5b3b65[_0xf339('0x8e')](_0x341fc4[_0xf339('0x3a')]['ids'])[_0xf339('0x2d')](function(){if(_[_0xf339('0x91')](_0x341fc4[_0xf339('0x3a')][_0xf339('0x6d')])){for(var _0x37b82f=0x0;_0x37b82f<_0x341fc4['query']['ids'][_0xf339('0x40')];_0x37b82f+=0x1){socket[_0xf339('0x77')]('userOpenchannelQueue:remove',{'UserId':Number(_0x341fc4[_0xf339('0x3a')]['ids'][_0x37b82f]),'OpenchannelQueueId':Number(_0x341fc4['params']['id'])});}}else{socket[_0xf339('0x77')](_0xf339('0x92'),{'UserId':Number(_0x341fc4[_0xf339('0x3a')]['ids']),'OpenchannelQueueId':Number(_0x341fc4[_0xf339('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x5f361c,null))[_0xf339('0x4c')](handleError(_0x5f361c,null));};exports[_0xf339('0x93')]=function(_0xf1ad54,_0x4fb581,_0xe099a9){var _0x25a5e8={};var _0x9d97dc={};var _0x162dc8;var _0x124d61;return db['OpenchannelQueue'][_0xf339('0x5c')]({'where':{'id':_0xf1ad54[_0xf339('0x59')]['id']}})[_0xf339('0x2d')](handleEntityNotFound(_0x4fb581,null))[_0xf339('0x2d')](function(_0x1ace31){if(_0x1ace31){_0x162dc8=_0x1ace31;_0x9d97dc[_0xf339('0x3d')]=_[_0xf339('0x39')](db['User']['rawAttributes']);_0x9d97dc[_0xf339('0x3a')]=_[_0xf339('0x39')](_0xf1ad54[_0xf339('0x3a')]);_0x9d97dc[_0xf339('0x3b')]=_[_0xf339('0x3c')](_0x9d97dc[_0xf339('0x3d')],_0x9d97dc['query']);_0x25a5e8[_0xf339('0x3e')]=_[_0xf339('0x3c')](_0x9d97dc[_0xf339('0x3d')],qs[_0xf339('0x3f')](_0xf1ad54['query']['fields']));_0x25a5e8[_0xf339('0x3e')]=_0x25a5e8[_0xf339('0x3e')][_0xf339('0x40')]?_0x25a5e8[_0xf339('0x3e')]:_0x9d97dc[_0xf339('0x3d')];_0x25a5e8['order']=qs[_0xf339('0x42')](_0xf1ad54['query'][_0xf339('0x42')]);_0x25a5e8['where']=qs[_0xf339('0x3b')](_[_0xf339('0x44')](_0xf1ad54['query'],_0x9d97dc[_0xf339('0x3b')]));if(_0xf1ad54['query'][_0xf339('0x45')]){_0x25a5e8[_0xf339('0x43')]=_['merge'](_0x25a5e8[_0xf339('0x43')],{'$or':_['map'](_0x25a5e8[_0xf339('0x3e')],function(_0x51870a){var _0x2eff7f={};_0x2eff7f[_0x51870a]={'$like':'%'+_0xf1ad54[_0xf339('0x3a')]['filter']+'%'};return _0x2eff7f;})});}_0x25a5e8=_['merge']({},_0x25a5e8,_0xf1ad54[_0xf339('0x48')]);return _0x162dc8[_0xf339('0x93')](_0x25a5e8);}})[_0xf339('0x2d')](function(_0x10d3fa){if(_0x10d3fa){_0x124d61=_0x10d3fa['length'];if(!_0xf1ad54['query'][_0xf339('0x5d')](_0xf339('0x41'))){_0x25a5e8['limit']=qs['limit'](_0xf1ad54['query']['limit']);_0x25a5e8['offset']=qs[_0xf339('0x22')](_0xf1ad54[_0xf339('0x3a')][_0xf339('0x22')]);}return _0x162dc8[_0xf339('0x93')](_0x25a5e8);}})[_0xf339('0x2d')](function(_0x56cfb5){if(_0x56cfb5){return _0x56cfb5?{'count':_0x124d61,'rows':_0x56cfb5}:null;}})[_0xf339('0x2d')](respondWithResult(_0x4fb581,null))[_0xf339('0x4c')](handleError(_0x4fb581,null));}; \ No newline at end of file +var _0x14b9=['bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','index','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','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','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','includes','all','compact','value','transaction','removeAgents','forEach','emit','userOpenchannelQueue:remove','addAgents','omit','getAgents','eml-format','fast-json-patch','request-promise','moment'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0x14b9,0x87));var _0x914b=function(_0x403dbc,_0x2faf60){_0x403dbc=_0x403dbc-0x0;var _0x6241f1=_0x14b9[_0x403dbc];return _0x6241f1;};'use strict';var emlformat=require(_0x914b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x914b('0x1'));var rp=require(_0x914b('0x2'));var moment=require(_0x914b('0x3'));var BPromise=require(_0x914b('0x4'));var Mustache=require(_0x914b('0x5'));var util=require('util');var path=require(_0x914b('0x6'));var sox=require(_0x914b('0x7'));var csv=require(_0x914b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x914b('0x9'));var _=require(_0x914b('0xa'));var squel=require('squel');var crypto=require(_0x914b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x914b('0xc'));var toCsv=require(_0x914b('0x8'));var querystring=require(_0x914b('0xd'));var Papa=require(_0x914b('0xe'));var Redis=require(_0x914b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x914b('0x10'));var as=require(_0x914b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x914b('0x12'));var config=require(_0x914b('0x13'));var licenseUtil=require(_0x914b('0x14'));var db=require(_0x914b('0x15'))['db'];config[_0x914b('0x16')]=_[_0x914b('0x17')](config['redis'],{'host':_0x914b('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x914b('0x16')]));require(_0x914b('0x19'))[_0x914b('0x1a')](socket);function respondWithStatusCode(_0x4b6720,_0x3dee61){_0x3dee61=_0x3dee61||0xcc;return function(_0x3098ca){if(_0x3098ca){return _0x4b6720[_0x914b('0x1b')](_0x3dee61);}return _0x4b6720[_0x914b('0x1c')](_0x3dee61)[_0x914b('0x1d')]();};}function respondWithResult(_0x2dbd2e,_0x13cf72){_0x13cf72=_0x13cf72||0xc8;return function(_0x1db02d){if(_0x1db02d){return _0x2dbd2e[_0x914b('0x1c')](_0x13cf72)[_0x914b('0x1e')](_0x1db02d);}};}function respondWithFilteredResult(_0x5cc1e4,_0x106d83){return function(_0x19c4f2){if(_0x19c4f2){var _0x78976d=typeof _0x106d83['offset']==='undefined'&&typeof _0x106d83[_0x914b('0x1f')]===_0x914b('0x20');var _0x3c5778=_0x19c4f2[_0x914b('0x21')];var _0x542a10=_0x78976d?0x0:_0x106d83[_0x914b('0x22')];var _0x21ff2c=_0x78976d?_0x19c4f2[_0x914b('0x21')]:_0x106d83['offset']+_0x106d83['limit'];var _0x3e5210;if(_0x21ff2c>=_0x3c5778){_0x21ff2c=_0x3c5778;_0x3e5210=0xc8;}else{_0x3e5210=0xce;}_0x5cc1e4[_0x914b('0x1c')](_0x3e5210);return _0x5cc1e4['set']('Content-Range',_0x542a10+'-'+_0x21ff2c+'/'+_0x3c5778)[_0x914b('0x1e')](_0x19c4f2);}return null;};}function patchUpdates(_0x2b16ba){return function(_0x29dd23){try{jsonpatch['apply'](_0x29dd23,_0x2b16ba,!![]);}catch(_0x484301){return BPromise[_0x914b('0x23')](_0x484301);}return _0x29dd23[_0x914b('0x24')]();};}function saveUpdates(_0x2220ba,_0x515c50){return function(_0x138801){if(_0x138801){return _0x138801[_0x914b('0x25')](_0x2220ba)[_0x914b('0x26')](function(_0xb7e7){return _0xb7e7;});}return null;};}function removeEntity(_0x400764,_0x55c6a3){return function(_0x7e90e1){if(_0x7e90e1){return _0x7e90e1[_0x914b('0x27')]()['then'](function(){var _0x25d341=_0x7e90e1[_0x914b('0x28')]({'plain':!![]});var _0x4b4fe3=_0x914b('0x29');return db[_0x914b('0x2a')]['destroy']({'where':{'type':_0x4b4fe3,'resourceId':_0x25d341['id']}})[_0x914b('0x26')](function(){return _0x7e90e1;});})[_0x914b('0x26')](function(){_0x400764['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d7386,_0x3c50e0){return function(_0x2bd75c){if(!_0x2bd75c){_0x1d7386['sendStatus'](0x194);}return _0x2bd75c;};}function handleError(_0x4e340a,_0x8cfafc){_0x8cfafc=_0x8cfafc||0x1f4;return function(_0x28e83d){logger['error'](_0x28e83d[_0x914b('0x2b')]);if(_0x28e83d[_0x914b('0x2c')]){delete _0x28e83d['name'];}_0x4e340a[_0x914b('0x1c')](_0x8cfafc)['send'](_0x28e83d);};}exports[_0x914b('0x2d')]=function(_0x56dd5a,_0x5f395f){var _0x1ecffc={},_0x5d37d3={},_0x18eb6c={'count':0x0,'rows':[]};var _0x623d07=_['map'](db[_0x914b('0x2e')][_0x914b('0x2f')],function(_0x58da7b){return{'name':_0x58da7b[_0x914b('0x30')],'type':_0x58da7b[_0x914b('0x31')][_0x914b('0x32')]};});_0x5d37d3[_0x914b('0x33')]=_[_0x914b('0x34')](_0x623d07,_0x914b('0x2c'));_0x5d37d3[_0x914b('0x35')]=_[_0x914b('0x36')](_0x56dd5a[_0x914b('0x35')]);_0x5d37d3[_0x914b('0x37')]=_[_0x914b('0x38')](_0x5d37d3[_0x914b('0x33')],_0x5d37d3[_0x914b('0x35')]);_0x1ecffc['attributes']=_[_0x914b('0x38')](_0x5d37d3[_0x914b('0x33')],qs[_0x914b('0x39')](_0x56dd5a[_0x914b('0x35')][_0x914b('0x39')]));_0x1ecffc[_0x914b('0x3a')]=_0x1ecffc[_0x914b('0x3a')][_0x914b('0x3b')]?_0x1ecffc[_0x914b('0x3a')]:_0x5d37d3[_0x914b('0x33')];if(!_0x56dd5a[_0x914b('0x35')]['hasOwnProperty']('nolimit')){_0x1ecffc[_0x914b('0x1f')]=qs[_0x914b('0x1f')](_0x56dd5a['query']['limit']);_0x1ecffc[_0x914b('0x22')]=qs[_0x914b('0x22')](_0x56dd5a['query'][_0x914b('0x22')]);}_0x1ecffc[_0x914b('0x3c')]=qs['sort'](_0x56dd5a['query'][_0x914b('0x3d')]);_0x1ecffc[_0x914b('0x3e')]=qs[_0x914b('0x37')](_[_0x914b('0x3f')](_0x56dd5a[_0x914b('0x35')],_0x5d37d3['filters']),_0x623d07);if(_0x56dd5a[_0x914b('0x35')][_0x914b('0x40')]){_0x1ecffc[_0x914b('0x3e')]=_[_0x914b('0x41')](_0x1ecffc[_0x914b('0x3e')],{'$or':_[_0x914b('0x34')](_0x623d07,function(_0x4db152){if(_0x4db152[_0x914b('0x31')]!==_0x914b('0x42')){var _0x577c55={};_0x577c55[_0x4db152[_0x914b('0x2c')]]={'$like':'%'+_0x56dd5a[_0x914b('0x35')]['filter']+'%'};return _0x577c55;}})});}_0x1ecffc=_['merge']({},_0x1ecffc,_0x56dd5a[_0x914b('0x43')]);var _0x5b0899={'where':_0x1ecffc[_0x914b('0x3e')]};return db[_0x914b('0x2e')]['count'](_0x5b0899)[_0x914b('0x26')](function(_0x1e0246){_0x18eb6c[_0x914b('0x21')]=_0x1e0246;if(_0x56dd5a[_0x914b('0x35')]['includeAll']){_0x1ecffc[_0x914b('0x44')]=[{'all':!![]}];}return db[_0x914b('0x2e')][_0x914b('0x45')](_0x1ecffc);})['then'](function(_0x48717f){_0x18eb6c[_0x914b('0x46')]=_0x48717f;return _0x18eb6c;})[_0x914b('0x26')](respondWithFilteredResult(_0x5f395f,_0x1ecffc))[_0x914b('0x47')](handleError(_0x5f395f,null));};exports[_0x914b('0x48')]=function(_0x300eed,_0x4303eb){var _0x2b313={'raw':!![],'where':{'id':_0x300eed[_0x914b('0x49')]['id']}},_0x4696c6={};_0x4696c6['model']=_[_0x914b('0x36')](db['OpenchannelQueue']['rawAttributes']);_0x4696c6[_0x914b('0x35')]=_[_0x914b('0x36')](_0x300eed[_0x914b('0x35')]);_0x4696c6['filters']=_[_0x914b('0x38')](_0x4696c6['model'],_0x4696c6[_0x914b('0x35')]);_0x2b313[_0x914b('0x3a')]=_[_0x914b('0x38')](_0x4696c6[_0x914b('0x33')],qs['fields'](_0x300eed['query']['fields']));_0x2b313[_0x914b('0x3a')]=_0x2b313[_0x914b('0x3a')][_0x914b('0x3b')]?_0x2b313[_0x914b('0x3a')]:_0x4696c6[_0x914b('0x33')];if(_0x300eed['query'][_0x914b('0x4a')]){_0x2b313[_0x914b('0x44')]=[{'all':!![]}];}_0x2b313=_['merge']({},_0x2b313,_0x300eed[_0x914b('0x43')]);return db[_0x914b('0x2e')]['find'](_0x2b313)[_0x914b('0x26')](handleEntityNotFound(_0x4303eb,null))[_0x914b('0x26')](respondWithResult(_0x4303eb,null))[_0x914b('0x47')](handleError(_0x4303eb,null));};exports[_0x914b('0x4b')]=function(_0x87350b,_0x2a1dde){return db[_0x914b('0x2e')][_0x914b('0x4b')](_0x87350b[_0x914b('0x4c')],{})[_0x914b('0x26')](function(_0x7ee998){var _0x17af13=_0x87350b[_0x914b('0x4d')][_0x914b('0x28')]({'plain':!![]});if(!_0x17af13)throw new Error(_0x914b('0x4e'));if(_0x17af13[_0x914b('0x4f')]===_0x914b('0x4d')){var _0x80bec4=_0x7ee998[_0x914b('0x28')]({'plain':!![]});var _0x2dc011=_0x914b('0x29');return db[_0x914b('0x50')][_0x914b('0x51')]({'where':{'name':_0x2dc011,'userProfileId':_0x17af13[_0x914b('0x52')]},'raw':!![]})[_0x914b('0x26')](function(_0x5ace09){if(_0x5ace09&&_0x5ace09[_0x914b('0x53')]===0x0){return db['UserProfileResource'][_0x914b('0x4b')]({'name':_0x80bec4[_0x914b('0x2c')],'resourceId':_0x80bec4['id'],'type':_0x5ace09['name'],'sectionId':_0x5ace09['id']},{})['then'](function(){return _0x7ee998;});}else{return _0x7ee998;}})[_0x914b('0x47')](function(_0x21aaa3){logger[_0x914b('0x54')](_0x914b('0x55'),_0x21aaa3);throw _0x21aaa3;});}return _0x7ee998;})['then'](respondWithResult(_0x2a1dde,0xc9))[_0x914b('0x47')](handleError(_0x2a1dde,null));};exports[_0x914b('0x25')]=function(_0x113e96,_0x1f7e04){if(_0x113e96[_0x914b('0x4c')]['id']){delete _0x113e96[_0x914b('0x4c')]['id'];}return db[_0x914b('0x2e')][_0x914b('0x51')]({'where':{'id':_0x113e96[_0x914b('0x49')]['id']}})[_0x914b('0x26')](handleEntityNotFound(_0x1f7e04,null))[_0x914b('0x26')](saveUpdates(_0x113e96[_0x914b('0x4c')],null))[_0x914b('0x26')](respondWithResult(_0x1f7e04,null))[_0x914b('0x47')](handleError(_0x1f7e04,null));};exports[_0x914b('0x27')]=function(_0x1356bf,_0x26ca85){return db[_0x914b('0x2e')]['find']({'where':{'id':_0x1356bf['params']['id']}})[_0x914b('0x26')](handleEntityNotFound(_0x26ca85,null))[_0x914b('0x26')](removeEntity(_0x26ca85,null))[_0x914b('0x47')](handleError(_0x26ca85,null));};exports[_0x914b('0x56')]=function(_0x5a8be0,_0x3bda1c){return db[_0x914b('0x2e')][_0x914b('0x56')]()[_0x914b('0x26')](respondWithResult(_0x3bda1c,null))[_0x914b('0x47')](handleError(_0x3bda1c,null));};exports[_0x914b('0x57')]=function(_0x54a7f6,_0x1f54ea,_0x4fd75a){var _0x3d852b={'raw':!![],'where':{}},_0x351f5f={},_0x3fd341;return db[_0x914b('0x2e')][_0x914b('0x58')]({'where':{'id':_0x54a7f6['params']['id']}})[_0x914b('0x26')](handleEntityNotFound(_0x1f54ea,null))[_0x914b('0x26')](function(_0x567949){if(_0x567949){_0x3fd341=_0x567949[_0x914b('0x28')]({'plain':!![]});_0x351f5f[_0x914b('0x33')]=_[_0x914b('0x36')](db[_0x914b('0x59')][_0x914b('0x2f')]);_0x351f5f[_0x914b('0x35')]=_[_0x914b('0x36')](_0x54a7f6[_0x914b('0x35')]);_0x351f5f[_0x914b('0x37')]=_['intersection'](_0x351f5f[_0x914b('0x33')],_0x351f5f[_0x914b('0x35')]);_0x3d852b[_0x914b('0x3a')]=_[_0x914b('0x38')](_0x351f5f[_0x914b('0x33')],qs['fields'](_0x54a7f6[_0x914b('0x35')][_0x914b('0x39')]));_0x3d852b[_0x914b('0x3a')]=_0x3d852b['attributes'][_0x914b('0x3b')]?_0x3d852b[_0x914b('0x3a')]:_0x351f5f[_0x914b('0x33')];if(!_0x54a7f6[_0x914b('0x35')][_0x914b('0x5a')](_0x914b('0x5b'))){_0x3d852b[_0x914b('0x1f')]=qs['limit'](_0x54a7f6[_0x914b('0x35')]['limit']);_0x3d852b[_0x914b('0x22')]=qs['offset'](_0x54a7f6[_0x914b('0x35')]['offset']);}_0x3d852b['order']=qs[_0x914b('0x3d')](_0x54a7f6['query'][_0x914b('0x3d')]);_0x3d852b['where']=qs['filters'](_[_0x914b('0x3f')](_0x54a7f6['query'],_0x351f5f[_0x914b('0x37')]));_0x3d852b[_0x914b('0x3e')]['OpenchannelQueueId']=_0x567949['id'];if(_0x54a7f6[_0x914b('0x35')][_0x914b('0x40')]){_0x3d852b[_0x914b('0x3e')]=_[_0x914b('0x41')](_0x3d852b[_0x914b('0x3e')],{'$or':_[_0x914b('0x34')](_0x3d852b[_0x914b('0x3a')],function(_0x307e3e){var _0x516603={};_0x516603[_0x307e3e]={'$like':'%'+_0x54a7f6['query'][_0x914b('0x40')]+'%'};return _0x516603;})});}_0x3d852b=_[_0x914b('0x41')]({},_0x3d852b,_0x54a7f6[_0x914b('0x43')]);return db[_0x914b('0x59')]['findAll'](_0x3d852b);}})[_0x914b('0x26')](function(_0x39f458){if(_0x39f458){return db[_0x914b('0x5c')][_0x914b('0x5d')]({'where':{'id':_[_0x914b('0x34')](_0x39f458,_0x914b('0x5e')),'role':_0x914b('0x5f')},'attributes':['id',_0x914b('0x2c'),_0x914b('0x60'),_0x914b('0x61'),_0x914b('0x62')]});}})[_0x914b('0x26')](function(_0x1e7dc8){if(_0x1e7dc8){return{'count':_0x1e7dc8[_0x914b('0x21')],'rows':_[_0x914b('0x34')](_0x1e7dc8[_0x914b('0x46')],function(_0x560596){return{'membername':_0x560596[_0x914b('0x2c')],'UserId':_0x560596['id'],'queue_name':_0x3fd341[_0x914b('0x2c')],'OpenchannelQueueId':_0x3fd341['id'],'interface':util[_0x914b('0x63')]('%s/%s',_0x914b('0x64'),_0x560596['name']),'penalty':0x0,'paused':_0x560596[_0x914b('0x60')],'createdAt':_0x560596[_0x914b('0x62')],'updatedAt':_0x560596[_0x914b('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x914b('0x26')](respondWithFilteredResult(_0x1f54ea,_0x3d852b))[_0x914b('0x47')](handleError(_0x1f54ea,null));};exports[_0x914b('0x65')]=function(_0x1e784d,_0x7a3a01,_0x2b585b){var _0x243da8={};var _0x5b2128={};var _0x23da67;var _0x1ed018;return db[_0x914b('0x2e')][_0x914b('0x58')]({'where':{'id':_0x1e784d[_0x914b('0x49')]['id']}})[_0x914b('0x26')](handleEntityNotFound(_0x7a3a01,null))[_0x914b('0x26')](function(_0x54f144){if(_0x54f144){_0x23da67=_0x54f144;_0x5b2128[_0x914b('0x33')]=_[_0x914b('0x36')](db[_0x914b('0x66')][_0x914b('0x2f')]);_0x5b2128[_0x914b('0x35')]=_[_0x914b('0x36')](_0x1e784d[_0x914b('0x35')]);_0x5b2128[_0x914b('0x37')]=_[_0x914b('0x38')](_0x5b2128[_0x914b('0x33')],_0x5b2128['query']);_0x243da8[_0x914b('0x3a')]=_[_0x914b('0x38')](_0x5b2128[_0x914b('0x33')],qs[_0x914b('0x39')](_0x1e784d[_0x914b('0x35')]['fields']));_0x243da8[_0x914b('0x3a')]=_0x243da8['attributes'][_0x914b('0x3b')]?_0x243da8[_0x914b('0x3a')]:_0x5b2128[_0x914b('0x33')];_0x243da8['order']=qs[_0x914b('0x3d')](_0x1e784d[_0x914b('0x35')][_0x914b('0x3d')]);_0x243da8[_0x914b('0x3e')]=qs[_0x914b('0x37')](_[_0x914b('0x3f')](_0x1e784d[_0x914b('0x35')],_0x5b2128[_0x914b('0x37')]));if(_0x1e784d[_0x914b('0x35')][_0x914b('0x40')]){_0x243da8[_0x914b('0x3e')]=_[_0x914b('0x41')](_0x243da8[_0x914b('0x3e')],{'$or':_[_0x914b('0x34')](_0x243da8[_0x914b('0x3a')],function(_0x84f1a2){var _0x221c12={};_0x221c12[_0x84f1a2]={'$like':'%'+_0x1e784d[_0x914b('0x35')][_0x914b('0x40')]+'%'};return _0x221c12;})});}_0x243da8=_[_0x914b('0x41')]({},_0x243da8,_0x1e784d[_0x914b('0x43')]);return _0x23da67[_0x914b('0x65')](_0x243da8);}})[_0x914b('0x26')](function(_0x2ffa9f){if(_0x2ffa9f){_0x1ed018=_0x2ffa9f[_0x914b('0x3b')];if(!_0x1e784d[_0x914b('0x35')]['hasOwnProperty'](_0x914b('0x5b'))){_0x243da8['limit']=qs[_0x914b('0x1f')](_0x1e784d[_0x914b('0x35')][_0x914b('0x1f')]);_0x243da8[_0x914b('0x22')]=qs[_0x914b('0x22')](_0x1e784d['query'][_0x914b('0x22')]);}return _0x23da67[_0x914b('0x65')](_0x243da8);}})[_0x914b('0x26')](function(_0x2c54b9){if(_0x2c54b9){return _0x2c54b9?{'count':_0x1ed018,'rows':_0x2c54b9}:null;}})[_0x914b('0x26')](respondWithResult(_0x7a3a01,null))[_0x914b('0x47')](handleError(_0x7a3a01,null));};exports[_0x914b('0x67')]=function(_0x460bca,_0x53a272,_0x705aa6){var _0x3d83dc=_0x460bca[_0x914b('0x4c')]['ids'];return db[_0x914b('0x66')][_0x914b('0x45')]({'where':{'id':_0x3d83dc},'attributes':['id'],'include':[{'model':db[_0x914b('0x5c')],'as':_0x914b('0x68'),'attributes':['id',_0x914b('0x2c'),_0x914b('0x69'),_0x914b('0x6a'),_0x914b('0x6b')],'raw':!![]}]})[_0x914b('0x26')](function(_0x14ee3f){if(_0x14ee3f){var _0x4444cf=_[_0x914b('0x6c')](_0x14ee3f,function(_0x5124f5){var _0xdb004c=_0x5124f5[_0x914b('0x28')]({'plain':!![]});return _0xdb004c[_0x914b('0x68')];});return db['OpenchannelQueue'][_0x914b('0x51')]({'where':{'id':_0x460bca[_0x914b('0x49')]['id']}})[_0x914b('0x26')](function(_0x1032b2){return db[_0x914b('0x6d')]['transaction'](function(_0x1d8c27){return _0x1032b2[_0x914b('0x67')](_0x3d83dc,{'transaction':_0x1d8c27})[_0x914b('0x26')](function(){return BPromise[_0x914b('0x6e')](_0x4444cf,function(_0x299b75){return db[_0x914b('0x59')][_0x914b('0x6f')]({'where':{'UserId':_0x299b75['id'],'OpenchannelQueueId':_0x460bca[_0x914b('0x49')]['id']},'transaction':_0x1d8c27});});})[_0x914b('0x26')](function(){_0x4444cf['forEach'](function(_0x232a9a){socket['emit'](_0x914b('0x70'),{'UserId':_0x232a9a['id'],'OpenchannelQueueId':_0x1032b2['id']});});});});});}})['then'](respondWithStatusCode(_0x53a272,null))['catch'](handleError(_0x53a272,null));};exports[_0x914b('0x71')]=function(_0x141283,_0x4c6d31,_0x11a26c){return db[_0x914b('0x66')][_0x914b('0x45')]({'where':{'id':_0x141283[_0x914b('0x35')][_0x914b('0x72')]},'attributes':['id'],'include':[{'model':db[_0x914b('0x5c')],'as':_0x914b('0x68'),'attributes':['id'],'raw':!![]}]})[_0x914b('0x26')](handleEntityNotFound(_0x4c6d31,null))['then'](function(_0x3f7f9a){var _0x16d3a0=_[_0x914b('0x34')](_0x3f7f9a,'id');var _0x5d850e=[];var _0x4e8b8f=[];var _0x583df1=squel[_0x914b('0x73')]();_0x583df1[_0x914b('0x74')](_0x914b('0x75'))[_0x914b('0x76')]('team_has_openchannel_queues','tq')[_0x914b('0x77')](_0x914b('0x78'),'ut',_0x914b('0x79'))[_0x914b('0x3e')](_0x914b('0x7a'),_0x141283['params']['id']);for(var _0x345897=0x0;_0x345897<_0x3f7f9a[_0x914b('0x3b')];_0x345897+=0x1){let _0x57115f=_0x3f7f9a[_0x345897];for(var _0x512f00=0x0;_0x512f00<_0x57115f[_0x914b('0x68')][_0x914b('0x3b')];_0x512f00+=0x1){let _0x1024fe=_0x57115f[_0x914b('0x68')][_0x512f00];var _0x587649=_0x583df1[_0x914b('0x7b')]();_0x587649[_0x914b('0x3e')]('ut.UserId\x20=\x20?',_0x1024fe['id']);_0x4e8b8f[_0x914b('0x7c')](db[_0x914b('0x6d')][_0x914b('0x35')](_0x587649['toString'](),{'type':db['sequelize'][_0x914b('0x7d')][_0x914b('0x7e')]})[_0x914b('0x26')](function(_0x2fb9f1){if(_0x2fb9f1['length']===0x1){return _0x1024fe['id'];}else{var _0x3660cd=_['every'](_[_0x914b('0x34')](_0x2fb9f1,'TeamId'),function(_0x1ed6a6){return _[_0x914b('0x7f')](_0x16d3a0,_0x1ed6a6);});if(_0x3660cd){return _0x1024fe['id'];}}}));}}return BPromise[_0x914b('0x80')](_0x4e8b8f)['then'](function(_0x10caa4){_0x5d850e=_(_0x5d850e)['union'](_0x10caa4)[_0x914b('0x81')]()[_0x914b('0x82')]();return db[_0x914b('0x2e')][_0x914b('0x51')]({'where':{'id':_0x141283[_0x914b('0x49')]['id']}})[_0x914b('0x26')](function(_0x28af6e){return db[_0x914b('0x6d')][_0x914b('0x83')](function(_0x49af53){return _0x28af6e['removeTeams'](_0x141283['query'][_0x914b('0x72')],{'transaction':_0x49af53})[_0x914b('0x26')](function(){if(!_['isEmpty'](_0x5d850e)){return _0x28af6e[_0x914b('0x84')](_0x5d850e,{'transaction':_0x49af53});}})[_0x914b('0x26')](function(){_0x5d850e[_0x914b('0x85')](function(_0x937ab9){socket[_0x914b('0x86')](_0x914b('0x87'),{'UserId':_0x937ab9,'OpenchannelQueueId':_0x28af6e['id']});});});});});});})[_0x914b('0x26')](respondWithStatusCode(_0x4c6d31,null))['catch'](handleError(_0x4c6d31,null));};exports[_0x914b('0x88')]=function(_0x12f1a8,_0x1bb6bd,_0x595cde){return db[_0x914b('0x2e')]['find']({'where':{'id':_0x12f1a8[_0x914b('0x49')]['id']}})[_0x914b('0x26')](handleEntityNotFound(_0x1bb6bd,null))[_0x914b('0x26')](function(_0x5bb1df){if(_0x5bb1df){return _0x5bb1df[_0x914b('0x88')](_0x12f1a8['body'][_0x914b('0x72')],_[_0x914b('0x89')](_0x12f1a8[_0x914b('0x4c')],[_0x914b('0x72'),'id'])||{})['spread'](function(_0x267114){for(var _0x15eb90=0x0;_0x15eb90<_0x12f1a8[_0x914b('0x4c')][_0x914b('0x72')]['length'];_0x15eb90+=0x1){socket[_0x914b('0x86')]('userOpenchannelQueue:save',{'UserId':Number(_0x12f1a8[_0x914b('0x4c')][_0x914b('0x72')][_0x15eb90]),'OpenchannelQueueId':Number(_0x12f1a8[_0x914b('0x49')]['id'])});}return _0x267114;});}})['then'](respondWithResult(_0x1bb6bd,null))[_0x914b('0x47')](handleError(_0x1bb6bd,null));};exports['removeAgents']=function(_0x32b7b8,_0x52ecb4,_0x52c4e3){return db[_0x914b('0x2e')][_0x914b('0x51')]({'where':{'id':_0x32b7b8[_0x914b('0x49')]['id']}})[_0x914b('0x26')](handleEntityNotFound(_0x52ecb4,null))[_0x914b('0x26')](function(_0x2c3397){if(_0x2c3397){return _0x2c3397['removeAgents'](_0x32b7b8[_0x914b('0x35')]['ids'])[_0x914b('0x26')](function(){if(_['isArray'](_0x32b7b8['query'][_0x914b('0x72')])){for(var _0x2b0ca4=0x0;_0x2b0ca4<_0x32b7b8[_0x914b('0x35')][_0x914b('0x72')][_0x914b('0x3b')];_0x2b0ca4+=0x1){socket[_0x914b('0x86')](_0x914b('0x87'),{'UserId':Number(_0x32b7b8[_0x914b('0x35')][_0x914b('0x72')][_0x2b0ca4]),'OpenchannelQueueId':Number(_0x32b7b8[_0x914b('0x49')]['id'])});}}else{socket[_0x914b('0x86')]('userOpenchannelQueue:remove',{'UserId':Number(_0x32b7b8[_0x914b('0x35')][_0x914b('0x72')]),'OpenchannelQueueId':Number(_0x32b7b8['params']['id'])});}});}})[_0x914b('0x26')](respondWithStatusCode(_0x52ecb4,null))[_0x914b('0x47')](handleError(_0x52ecb4,null));};exports[_0x914b('0x8a')]=function(_0x301b81,_0x13c09a,_0x49ad8d){var _0x262d71={};var _0x219864={};var _0x2316c6;var _0x4bdcd8;return db[_0x914b('0x2e')][_0x914b('0x58')]({'where':{'id':_0x301b81[_0x914b('0x49')]['id']}})[_0x914b('0x26')](handleEntityNotFound(_0x13c09a,null))['then'](function(_0x4d2815){if(_0x4d2815){_0x2316c6=_0x4d2815;_0x219864[_0x914b('0x33')]=_[_0x914b('0x36')](db['User']['rawAttributes']);_0x219864['query']=_[_0x914b('0x36')](_0x301b81[_0x914b('0x35')]);_0x219864[_0x914b('0x37')]=_[_0x914b('0x38')](_0x219864[_0x914b('0x33')],_0x219864[_0x914b('0x35')]);_0x262d71[_0x914b('0x3a')]=_[_0x914b('0x38')](_0x219864[_0x914b('0x33')],qs['fields'](_0x301b81[_0x914b('0x35')][_0x914b('0x39')]));_0x262d71[_0x914b('0x3a')]=_0x262d71[_0x914b('0x3a')][_0x914b('0x3b')]?_0x262d71['attributes']:_0x219864['model'];_0x262d71[_0x914b('0x3c')]=qs[_0x914b('0x3d')](_0x301b81[_0x914b('0x35')][_0x914b('0x3d')]);_0x262d71[_0x914b('0x3e')]=qs['filters'](_[_0x914b('0x3f')](_0x301b81[_0x914b('0x35')],_0x219864['filters']));if(_0x301b81[_0x914b('0x35')]['filter']){_0x262d71[_0x914b('0x3e')]=_[_0x914b('0x41')](_0x262d71[_0x914b('0x3e')],{'$or':_[_0x914b('0x34')](_0x262d71[_0x914b('0x3a')],function(_0x532346){var _0x5ad455={};_0x5ad455[_0x532346]={'$like':'%'+_0x301b81[_0x914b('0x35')][_0x914b('0x40')]+'%'};return _0x5ad455;})});}_0x262d71=_['merge']({},_0x262d71,_0x301b81[_0x914b('0x43')]);return _0x2316c6[_0x914b('0x8a')](_0x262d71);}})[_0x914b('0x26')](function(_0x20151a){if(_0x20151a){_0x4bdcd8=_0x20151a[_0x914b('0x3b')];if(!_0x301b81[_0x914b('0x35')][_0x914b('0x5a')](_0x914b('0x5b'))){_0x262d71['limit']=qs[_0x914b('0x1f')](_0x301b81[_0x914b('0x35')][_0x914b('0x1f')]);_0x262d71[_0x914b('0x22')]=qs[_0x914b('0x22')](_0x301b81[_0x914b('0x35')]['offset']);}return _0x2316c6[_0x914b('0x8a')](_0x262d71);}})[_0x914b('0x26')](function(_0x49e02a){if(_0x49e02a){return _0x49e02a?{'count':_0x4bdcd8,'rows':_0x49e02a}:null;}})[_0x914b('0x26')](respondWithResult(_0x13c09a,null))[_0x914b('0x47')](handleError(_0x13c09a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index cd98ca1..813ae07 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 _0x2cfd=['remove','emit','hasOwnProperty','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x7cd055,_0x563134){var _0x31b752=function(_0x45ac56){while(--_0x45ac56){_0x7cd055['push'](_0x7cd055['shift']());}};_0x31b752(++_0x563134);}(_0x2cfd,0x1f3));var _0xd2cf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2cfd[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xd2cf('0x0'))['db'][_0xd2cf('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd2cf('0x2')](0x0);var events={'afterCreate':_0xd2cf('0x3'),'afterUpdate':_0xd2cf('0x4'),'afterDestroy':_0xd2cf('0x5')};function emitEvent(_0xeda999){return function(_0x4b4079,_0x550b7c,_0x12f323){OpenchannelQueueEvents[_0xd2cf('0x6')](_0xeda999+':'+_0x4b4079['id'],_0x4b4079);OpenchannelQueueEvents['emit'](_0xeda999,_0x4b4079);_0x12f323(null);};}for(var e in events){if(events[_0xd2cf('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xd2cf('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x3c51=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0xbfaa32,_0x5d898c){var _0x139c82=function(_0x19b2c9){while(--_0x19b2c9){_0xbfaa32['push'](_0xbfaa32['shift']());}};_0x139c82(++_0x5d898c);}(_0x3c51,0x1b9));var _0x13c5=function(_0x115238,_0x2ba8d2){_0x115238=_0x115238-0x0;var _0x147eaf=_0x3c51[_0x115238];return _0x147eaf;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x13c5('0x0'))['db'][_0x13c5('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x13c5('0x2')](0x0);var events={'afterCreate':_0x13c5('0x3'),'afterUpdate':'update','afterDestroy':_0x13c5('0x4')};function emitEvent(_0x439383){return function(_0x35a067,_0x51b4e1,_0x51388a){OpenchannelQueueEvents['emit'](_0x439383+':'+_0x35a067['id'],_0x35a067);OpenchannelQueueEvents[_0x13c5('0x5')](_0x439383,_0x35a067);_0x51388a(null);};}for(var e in events){if(events[_0x13c5('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index a49bf8d..4210608 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 _0x6b44=['OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6b44,0x1a6));var _0x46b4=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x6b44[_0x1bb58c];return _0x277586;};'use strict';var _=require(_0x46b4('0x0'));var util=require(_0x46b4('0x1'));var logger=require(_0x46b4('0x2'))(_0x46b4('0x3'));var moment=require('moment');var BPromise=require(_0x46b4('0x4'));var rp=require(_0x46b4('0x5'));var fs=require('fs');var path=require(_0x46b4('0x6'));var rimraf=require(_0x46b4('0x7'));var config=require(_0x46b4('0x8'));var attributes=require(_0x46b4('0x9'));module[_0x46b4('0xa')]=function(_0x4f041c,_0x59c140){return _0x4f041c[_0x46b4('0xb')](_0x46b4('0xc'),attributes,{'tableName':_0x46b4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2fe=['path','./openchannelQueue.attributes','define','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2fe,0x9c));var _0xeb2f=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xb2fe[_0x18b5e8];return _0x25baed;};'use strict';var _=require('lodash');var util=require(_0xeb2f('0x0'));var logger=require(_0xeb2f('0x1'))(_0xeb2f('0x2'));var moment=require(_0xeb2f('0x3'));var BPromise=require(_0xeb2f('0x4'));var rp=require(_0xeb2f('0x5'));var fs=require('fs');var path=require(_0xeb2f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeb2f('0x7'));module['exports']=function(_0x4617bf,_0x2490c4){return _0x4617bf[_0xeb2f('0x8')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','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 f285aa1..ce53451 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 _0xfc34=['request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','limit','include','map','model','attributes','debug','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x1497fa,_0xd82241){var _0x21bafa=function(_0x320291){while(--_0x320291){_0x1497fa['push'](_0x1497fa['shift']());}};_0x21bafa(++_0xd82241);}(_0xfc34,0x11e));var _0x4fc3=function(_0x233a4c,_0x3ef6e1){_0x233a4c=_0x233a4c-0x0;var _0x51d977=_0xfc34[_0x233a4c];return _0x51d977;};'use strict';var _=require(_0x4fc3('0x0'));var util=require(_0x4fc3('0x1'));var moment=require('moment');var BPromise=require(_0x4fc3('0x2'));var rs=require(_0x4fc3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4fc3('0x4'));var logger=require(_0x4fc3('0x5'))('rpc');var config=require(_0x4fc3('0x6'));var jayson=require(_0x4fc3('0x7'));var client=jayson[_0x4fc3('0x8')][_0x4fc3('0x9')]({'port':0x232a});config['redis']=_[_0x4fc3('0xa')](config[_0x4fc3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fc3('0xc'))(new Redis(config[_0x4fc3('0xb')]));require('./openchannelQueue.socket')[_0x4fc3('0xd')](socket);function respondWithRpcPromise(_0x2e8406,_0x4258c8,_0x563662){return new BPromise(function(_0x347e5d,_0x4299cf){return client[_0x4fc3('0xe')](_0x2e8406,_0x563662)[_0x4fc3('0xf')](function(_0x17ba1f){logger[_0x4fc3('0x10')](_0x4fc3('0x11'),_0x4258c8,_0x4fc3('0x12'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4258c8,_0x4fc3('0x12'),JSON[_0x4fc3('0x13')](_0x17ba1f));if(_0x17ba1f['error']){if(_0x17ba1f[_0x4fc3('0x14')][_0x4fc3('0x15')]===0x1f4){logger[_0x4fc3('0x14')](_0x4fc3('0x11'),_0x4258c8,_0x17ba1f[_0x4fc3('0x14')][_0x4fc3('0x16')]);return _0x4299cf(_0x17ba1f[_0x4fc3('0x14')][_0x4fc3('0x16')]);}logger[_0x4fc3('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x4258c8,_0x17ba1f[_0x4fc3('0x14')][_0x4fc3('0x16')]);return _0x347e5d(_0x17ba1f[_0x4fc3('0x14')][_0x4fc3('0x16')]);}else{logger[_0x4fc3('0x10')](_0x4fc3('0x11'),_0x4258c8,_0x4fc3('0x12'));_0x347e5d(_0x17ba1f[_0x4fc3('0x17')][_0x4fc3('0x16')]);}})[_0x4fc3('0x18')](function(_0x39b3a8){logger[_0x4fc3('0x14')](_0x4fc3('0x11'),_0x4258c8,_0x39b3a8);_0x4299cf(_0x39b3a8);});});}exports[_0x4fc3('0x19')]=function(_0x43257b){var _0x3d9e2e=this;return new Promise(function(_0x1596f8,_0x127ad9){return db[_0x4fc3('0x1a')]['findAll']({'raw':_0x43257b[_0x4fc3('0x1b')]?_0x43257b[_0x4fc3('0x1b')][_0x4fc3('0x1c')]===undefined?!![]:![]:!![],'where':_0x43257b[_0x4fc3('0x1b')]?_0x43257b[_0x4fc3('0x1b')][_0x4fc3('0x1d')]||null:null,'attributes':_0x43257b[_0x4fc3('0x1b')]?_0x43257b[_0x4fc3('0x1b')]['attributes']||null:null,'limit':_0x43257b[_0x4fc3('0x1b')]?_0x43257b[_0x4fc3('0x1b')][_0x4fc3('0x1e')]||null:null,'include':_0x43257b[_0x4fc3('0x1b')]?_0x43257b[_0x4fc3('0x1b')][_0x4fc3('0x1f')]?_[_0x4fc3('0x20')](_0x43257b[_0x4fc3('0x1b')][_0x4fc3('0x1f')],function(_0x536b89){return{'model':db[_0x536b89[_0x4fc3('0x21')]],'as':_0x536b89['as'],'attributes':_0x536b89['attributes'],'include':_0x536b89[_0x4fc3('0x1f')]?_[_0x4fc3('0x20')](_0x536b89[_0x4fc3('0x1f')],function(_0x326b96){return{'model':db[_0x326b96[_0x4fc3('0x21')]],'as':_0x326b96['as'],'attributes':_0x326b96[_0x4fc3('0x22')],'include':_0x326b96[_0x4fc3('0x1f')]?_[_0x4fc3('0x20')](_0x326b96[_0x4fc3('0x1f')],function(_0x2e703d){return{'model':db[_0x2e703d[_0x4fc3('0x21')]],'as':_0x2e703d['as'],'attributes':_0x2e703d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x55e46f){logger[_0x4fc3('0x10')](_0x4fc3('0x19'),_0x43257b);logger[_0x4fc3('0x23')](_0x4fc3('0x19'),_0x43257b,JSON['stringify'](_0x55e46f));_0x1596f8(_0x55e46f);})[_0x4fc3('0x18')](function(_0x240bdf){logger[_0x4fc3('0x14')](_0x4fc3('0x19'),_0x240bdf[_0x4fc3('0x16')],_0x43257b);_0x127ad9(_0x3d9e2e['error'](0x1f4,_0x240bdf[_0x4fc3('0x16')]));});});};exports[_0x4fc3('0x24')]=function(_0x8597a5){var _0x3b0acb=this;return new Promise(function(_0x160fa5,_0xd4a608){return db[_0x4fc3('0x1a')][_0x4fc3('0x25')]({'raw':_0x8597a5[_0x4fc3('0x1b')]?_0x8597a5[_0x4fc3('0x1b')][_0x4fc3('0x1c')]===undefined?!![]:![]:!![],'where':_0x8597a5[_0x4fc3('0x1b')]?_0x8597a5[_0x4fc3('0x1b')][_0x4fc3('0x1d')]||null:null,'attributes':_0x8597a5[_0x4fc3('0x1b')]?_0x8597a5[_0x4fc3('0x1b')][_0x4fc3('0x22')]||null:null,'include':_0x8597a5['options']?_0x8597a5[_0x4fc3('0x1b')][_0x4fc3('0x1f')]?_['map'](_0x8597a5[_0x4fc3('0x1b')][_0x4fc3('0x1f')],function(_0x5c9cac){return{'model':db[_0x5c9cac[_0x4fc3('0x21')]],'as':_0x5c9cac['as'],'attributes':_0x5c9cac[_0x4fc3('0x22')],'include':_0x5c9cac[_0x4fc3('0x1f')]?_[_0x4fc3('0x20')](_0x5c9cac[_0x4fc3('0x1f')],function(_0xbbf124){return{'model':db[_0xbbf124[_0x4fc3('0x21')]],'as':_0xbbf124['as'],'attributes':_0xbbf124[_0x4fc3('0x22')],'include':_0xbbf124[_0x4fc3('0x1f')]?_[_0x4fc3('0x20')](_0xbbf124['include'],function(_0x17a0d2){return{'model':db[_0x17a0d2[_0x4fc3('0x21')]],'as':_0x17a0d2['as'],'attributes':_0x17a0d2[_0x4fc3('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4fc3('0xf')](function(_0x363012){logger[_0x4fc3('0x10')](_0x4fc3('0x24'),_0x8597a5);logger[_0x4fc3('0x23')]('ShowOpenchannelQueue',_0x8597a5,JSON['stringify'](_0x363012));_0x160fa5(_0x363012);})['catch'](function(_0x46b401){logger[_0x4fc3('0x14')](_0x4fc3('0x24'),_0x46b401[_0x4fc3('0x16')],_0x8597a5);_0xd4a608(_0x3b0acb['error'](0x1f4,_0x46b401[_0x4fc3('0x16')]));});});}; \ No newline at end of file +var _0x401f=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetOpenchannelQueue','options','raw','where','attributes','include','map','model','then','info','debug','ShowOpenchannelQueue','OpenchannelQueue','find','catch','lodash','randomstring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x401f,0x130));var _0xf401=function(_0x36449b,_0x2a5443){_0x36449b=_0x36449b-0x0;var _0x14c449=_0x401f[_0x36449b];return _0x14c449;};'use strict';var _=require(_0xf401('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf401('0x1'));var fs=require('fs');var Redis=require(_0xf401('0x2'));var db=require(_0xf401('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf401('0x4'));var config=require(_0xf401('0x5'));var jayson=require(_0xf401('0x6'));var client=jayson['client'][_0xf401('0x7')]({'port':0x232a});config['redis']=_[_0xf401('0x8')](config[_0xf401('0x9')],{'host':_0xf401('0xa'),'port':0x18eb});var socket=require(_0xf401('0xb'))(new Redis(config[_0xf401('0x9')]));require(_0xf401('0xc'))['register'](socket);function respondWithRpcPromise(_0x1e484e,_0x154aef,_0x482722){return new BPromise(function(_0x30483d,_0x3b6f90){return client['request'](_0x1e484e,_0x482722)['then'](function(_0x491fb4){logger['info'](_0xf401('0xd'),_0x154aef,_0xf401('0xe'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x154aef,'request\x20sent',JSON[_0xf401('0xf')](_0x491fb4));if(_0x491fb4['error']){if(_0x491fb4[_0xf401('0x10')]['code']===0x1f4){logger[_0xf401('0x10')](_0xf401('0xd'),_0x154aef,_0x491fb4[_0xf401('0x10')][_0xf401('0x11')]);return _0x3b6f90(_0x491fb4[_0xf401('0x10')][_0xf401('0x11')]);}logger[_0xf401('0x10')](_0xf401('0xd'),_0x154aef,_0x491fb4['error'][_0xf401('0x11')]);return _0x30483d(_0x491fb4['error']['message']);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x154aef,_0xf401('0xe'));_0x30483d(_0x491fb4[_0xf401('0x12')][_0xf401('0x11')]);}})['catch'](function(_0x5784ce){logger[_0xf401('0x10')](_0xf401('0xd'),_0x154aef,_0x5784ce);_0x3b6f90(_0x5784ce);});});}exports[_0xf401('0x13')]=function(_0x376ae2){var _0x5f122b=this;return new Promise(function(_0x1d14d4,_0x13054c){return db['OpenchannelQueue']['findAll']({'raw':_0x376ae2[_0xf401('0x14')]?_0x376ae2['options'][_0xf401('0x15')]===undefined?!![]:![]:!![],'where':_0x376ae2['options']?_0x376ae2[_0xf401('0x14')][_0xf401('0x16')]||null:null,'attributes':_0x376ae2[_0xf401('0x14')]?_0x376ae2[_0xf401('0x14')][_0xf401('0x17')]||null:null,'limit':_0x376ae2[_0xf401('0x14')]?_0x376ae2['options']['limit']||null:null,'include':_0x376ae2[_0xf401('0x14')]?_0x376ae2[_0xf401('0x14')][_0xf401('0x18')]?_[_0xf401('0x19')](_0x376ae2[_0xf401('0x14')]['include'],function(_0x4d863a){return{'model':db[_0x4d863a[_0xf401('0x1a')]],'as':_0x4d863a['as'],'attributes':_0x4d863a[_0xf401('0x17')],'include':_0x4d863a[_0xf401('0x18')]?_[_0xf401('0x19')](_0x4d863a[_0xf401('0x18')],function(_0x115003){return{'model':db[_0x115003[_0xf401('0x1a')]],'as':_0x115003['as'],'attributes':_0x115003[_0xf401('0x17')],'include':_0x115003[_0xf401('0x18')]?_[_0xf401('0x19')](_0x115003['include'],function(_0x4d0104){return{'model':db[_0x4d0104[_0xf401('0x1a')]],'as':_0x4d0104['as'],'attributes':_0x4d0104[_0xf401('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf401('0x1b')](function(_0x6041d2){logger[_0xf401('0x1c')](_0xf401('0x13'),_0x376ae2);logger[_0xf401('0x1d')](_0xf401('0x13'),_0x376ae2,JSON[_0xf401('0xf')](_0x6041d2));_0x1d14d4(_0x6041d2);})['catch'](function(_0x50ae7b){logger[_0xf401('0x10')](_0xf401('0x13'),_0x50ae7b['message'],_0x376ae2);_0x13054c(_0x5f122b['error'](0x1f4,_0x50ae7b['message']));});});};exports[_0xf401('0x1e')]=function(_0x590614){var _0xe9dbd9=this;return new Promise(function(_0x2d5848,_0x1d8401){return db[_0xf401('0x1f')][_0xf401('0x20')]({'raw':_0x590614[_0xf401('0x14')]?_0x590614[_0xf401('0x14')][_0xf401('0x15')]===undefined?!![]:![]:!![],'where':_0x590614['options']?_0x590614['options'][_0xf401('0x16')]||null:null,'attributes':_0x590614[_0xf401('0x14')]?_0x590614[_0xf401('0x14')]['attributes']||null:null,'include':_0x590614['options']?_0x590614[_0xf401('0x14')][_0xf401('0x18')]?_['map'](_0x590614['options']['include'],function(_0x44c605){return{'model':db[_0x44c605[_0xf401('0x1a')]],'as':_0x44c605['as'],'attributes':_0x44c605[_0xf401('0x17')],'include':_0x44c605[_0xf401('0x18')]?_[_0xf401('0x19')](_0x44c605[_0xf401('0x18')],function(_0x474769){return{'model':db[_0x474769['model']],'as':_0x474769['as'],'attributes':_0x474769[_0xf401('0x17')],'include':_0x474769[_0xf401('0x18')]?_['map'](_0x474769[_0xf401('0x18')],function(_0x2b4f48){return{'model':db[_0x2b4f48[_0xf401('0x1a')]],'as':_0x2b4f48['as'],'attributes':_0x2b4f48[_0xf401('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1036ab){logger[_0xf401('0x1c')](_0xf401('0x1e'),_0x590614);logger[_0xf401('0x1d')](_0xf401('0x1e'),_0x590614,JSON[_0xf401('0xf')](_0x1036ab));_0x2d5848(_0x1036ab);})[_0xf401('0x21')](function(_0x1edb8c){logger[_0xf401('0x10')](_0xf401('0x1e'),_0x1edb8c[_0xf401('0x11')],_0x590614);_0x1d8401(_0xe9dbd9['error'](0x1f4,_0x1edb8c['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 79541d4..8ca8c91 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 _0x20c3=['save','remove','update','emit','removeListener','length','./openchannelQueue.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x20c3,0x1db));var _0x320c=function(_0x46bbe7,_0x509588){_0x46bbe7=_0x46bbe7-0x0;var _0x1a7b42=_0x20c3[_0x46bbe7];return _0x1a7b42;};'use strict';var OpenchannelQueueEvents=require(_0x320c('0x0'));var events=[_0x320c('0x1'),_0x320c('0x2'),_0x320c('0x3')];function createListener(_0x1f0d90,_0x292135){return function(_0x55d52f){_0x292135[_0x320c('0x4')](_0x1f0d90,_0x55d52f);};}function removeListener(_0x413a09,_0x468c3b){return function(){OpenchannelQueueEvents[_0x320c('0x5')](_0x413a09,_0x468c3b);};}exports['register']=function(_0x13fe2a){for(var _0x2322d5=0x0,_0x4462dd=events[_0x320c('0x6')];_0x2322d5<_0x4462dd;_0x2322d5++){var _0x2e080e=events[_0x2322d5];var _0x36782e=createListener('openchannelQueue:'+_0x2e080e,_0x13fe2a);OpenchannelQueueEvents['on'](_0x2e080e,_0x36782e);}}; \ No newline at end of file +var _0xb797=['remove','update','emit','removeListener','length','save'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xb797,0x15b));var _0x7b79=function(_0x4aaa08,_0x3a65c5){_0x4aaa08=_0x4aaa08-0x0;var _0x5702aa=_0xb797[_0x4aaa08];return _0x5702aa;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x7b79('0x0'),_0x7b79('0x1'),_0x7b79('0x2')];function createListener(_0x5e787c,_0x231c52){return function(_0x4aa145){_0x231c52[_0x7b79('0x3')](_0x5e787c,_0x4aa145);};}function removeListener(_0xdf353f,_0x432443){return function(){OpenchannelQueueEvents[_0x7b79('0x4')](_0xdf353f,_0x432443);};}exports['register']=function(_0x329c8f){for(var _0x3fc4bd=0x0,_0x1300e6=events[_0x7b79('0x5')];_0x3fc4bd<_0x1300e6;_0x3fc4bd++){var _0x3fbf1b=events[_0x3fc4bd];var _0x14a52a=createListener('openchannelQueue:'+_0x3fbf1b,_0x329c8f);OpenchannelQueueEvents['on'](_0x3fbf1b,_0x14a52a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 52d2626..d42eee0 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 _0x6e0c=['./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x110bb7,_0x56c479){var _0x1e6ac2=function(_0x27ca58){while(--_0x27ca58){_0x110bb7['push'](_0x110bb7['shift']());}};_0x1e6ac2(++_0x56c479);}(_0x6e0c,0x184));var _0xc6e0=function(_0x5732d6,_0x2c9500){_0x5732d6=_0x5732d6-0x0;var _0x3a1a0f=_0x6e0c[_0x5732d6];return _0x3a1a0f;};'use strict';var multer=require(_0xc6e0('0x0'));var util=require(_0xc6e0('0x1'));var path=require(_0xc6e0('0x2'));var timeout=require(_0xc6e0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc6e0('0x4'));var auth=require(_0xc6e0('0x5'));var interaction=require(_0xc6e0('0x6'));var config=require(_0xc6e0('0x7'));var controller=require(_0xc6e0('0x8'));router[_0xc6e0('0x9')]('/',auth[_0xc6e0('0xa')](),controller[_0xc6e0('0xb')]);router['get'](_0xc6e0('0xc'),auth[_0xc6e0('0xa')](),controller['describe']);router[_0xc6e0('0x9')](_0xc6e0('0xd'),auth['isAuthenticated'](),controller[_0xc6e0('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc6e0('0xf')]);router['put'](_0xc6e0('0xd'),auth[_0xc6e0('0xa')](),controller['update']);router['delete'](_0xc6e0('0xd'),auth['isAuthenticated'](),controller[_0xc6e0('0x10')]);module[_0xc6e0('0x11')]=router; \ No newline at end of file +var _0xb556=['Router','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','put','update','delete','destroy','exports','multer','path','express'];(function(_0x388134,_0x49904f){var _0x125f71=function(_0x452718){while(--_0x452718){_0x388134['push'](_0x388134['shift']());}};_0x125f71(++_0x49904f);}(_0xb556,0x147));var _0x6b55=function(_0x4cedc8,_0x378a24){_0x4cedc8=_0x4cedc8-0x0;var _0x5ebab5=_0xb556[_0x4cedc8];return _0x5ebab5;};'use strict';var multer=require(_0x6b55('0x0'));var util=require('util');var path=require(_0x6b55('0x1'));var timeout=require('connect-timeout');var express=require(_0x6b55('0x2'));var router=express[_0x6b55('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6b55('0x4'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0x6b55('0x5')]('/',auth[_0x6b55('0x6')](),controller[_0x6b55('0x7')]);router[_0x6b55('0x5')]('/describe',auth[_0x6b55('0x6')](),controller[_0x6b55('0x8')]);router[_0x6b55('0x5')](_0x6b55('0x9'),auth[_0x6b55('0x6')](),controller['show']);router['post']('/',auth[_0x6b55('0x6')](),controller['create']);router[_0x6b55('0xa')]('/:id',auth[_0x6b55('0x6')](),controller[_0x6b55('0xb')]);router[_0x6b55('0xc')]('/:id',auth[_0x6b55('0x6')](),controller[_0x6b55('0xd')]);module[_0x6b55('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 520bafa..cf7d535 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 _0x98df=['sequelize','exports','STRING','DATE'];(function(_0x4494b7,_0x129301){var _0x5c415b=function(_0x20a14e){while(--_0x20a14e){_0x4494b7['push'](_0x4494b7['shift']());}};_0x5c415b(++_0x129301);}(_0x98df,0xc8));var _0xf98d=function(_0x454f02,_0x32ce79){_0x454f02=_0x454f02-0x0;var _0x3369f7=_0x98df[_0x454f02];return _0x3369f7;};'use strict';var moment=require('moment');var Sequelize=require(_0xf98d('0x0'));module[_0xf98d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf98d('0x2')]},'joinAt':{'type':Sequelize[_0xf98d('0x3')]},'leaveAt':{'type':Sequelize[_0xf98d('0x3')]},'acceptAt':{'type':Sequelize[_0xf98d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf98d('0x2')]}}; \ No newline at end of file +var _0xb164=['STRING','DATE','exports'];(function(_0x4c2440,_0x2fb22e){var _0x31471c=function(_0x173a53){while(--_0x173a53){_0x4c2440['push'](_0x4c2440['shift']());}};_0x31471c(++_0x2fb22e);}(_0xb164,0x188));var _0x4b16=function(_0x2a9614,_0x43aecf){_0x2a9614=_0x2a9614-0x0;var _0x1d4ab9=_0xb164[_0x2a9614];return _0x1d4ab9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4b16('0x0')]={'uniqueid':{'type':Sequelize[_0x4b16('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4b16('0x1')]},'joinAt':{'type':Sequelize[_0x4b16('0x2')]},'leaveAt':{'type':Sequelize[_0x4b16('0x2')]},'acceptAt':{'type':Sequelize[_0x4b16('0x2')]},'exitAt':{'type':Sequelize[_0x4b16('0x2')]},'reason':{'type':Sequelize[_0x4b16('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 0f209b1..1375a1b 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 _0x827f=['order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','Content-Range','apply','update','then','destroy','sendStatus','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0x827f,0x12a));var _0xf827=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x827f[_0x59d89e];return _0x554e93;};'use strict';var emlformat=require(_0xf827('0x0'));var rimraf=require(_0xf827('0x1'));var zipdir=require(_0xf827('0x2'));var jsonpatch=require(_0xf827('0x3'));var rp=require('request-promise');var moment=require(_0xf827('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf827('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf827('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf827('0x7'));var squel=require(_0xf827('0x8'));var crypto=require(_0xf827('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf827('0xa'));var toCsv=require(_0xf827('0xb'));var querystring=require(_0xf827('0xc'));var Papa=require(_0xf827('0xd'));var Redis=require(_0xf827('0xe'));var authService=require(_0xf827('0xf'));var qs=require(_0xf827('0x10'));var as=require(_0xf827('0x11'));var hardwareService=require(_0xf827('0x12'));var logger=require(_0xf827('0x13'))('api');var utils=require(_0xf827('0x14'));var config=require(_0xf827('0x15'));var licenseUtil=require(_0xf827('0x16'));var db=require(_0xf827('0x17'))['db'];function respondWithStatusCode(_0x359dcd,_0x5e8c68){_0x5e8c68=_0x5e8c68||0xcc;return function(_0x3e9eba){if(_0x3e9eba){return _0x359dcd['sendStatus'](_0x5e8c68);}return _0x359dcd[_0xf827('0x18')](_0x5e8c68)[_0xf827('0x19')]();};}function respondWithResult(_0x44b84a,_0xcd2aa7){_0xcd2aa7=_0xcd2aa7||0xc8;return function(_0x2b51bd){if(_0x2b51bd){return _0x44b84a[_0xf827('0x18')](_0xcd2aa7)[_0xf827('0x1a')](_0x2b51bd);}};}function respondWithFilteredResult(_0x5298ac,_0x4ffc78){return function(_0x30a302){if(_0x30a302){var _0x7d4fa0=typeof _0x4ffc78[_0xf827('0x1b')]==='undefined'&&typeof _0x4ffc78[_0xf827('0x1c')]==='undefined';var _0x9de631=_0x30a302[_0xf827('0x1d')];var _0xf0c362=_0x7d4fa0?0x0:_0x4ffc78[_0xf827('0x1b')];var _0xa79879=_0x7d4fa0?_0x30a302[_0xf827('0x1d')]:_0x4ffc78[_0xf827('0x1b')]+_0x4ffc78[_0xf827('0x1c')];var _0x5618af;if(_0xa79879>=_0x9de631){_0xa79879=_0x9de631;_0x5618af=0xc8;}else{_0x5618af=0xce;}_0x5298ac[_0xf827('0x18')](_0x5618af);return _0x5298ac['set'](_0xf827('0x1e'),_0xf0c362+'-'+_0xa79879+'/'+_0x9de631)[_0xf827('0x1a')](_0x30a302);}return null;};}function patchUpdates(_0x346a29){return function(_0x1f64ab){try{jsonpatch[_0xf827('0x1f')](_0x1f64ab,_0x346a29,!![]);}catch(_0x5cffb0){return BPromise['reject'](_0x5cffb0);}return _0x1f64ab['save']();};}function saveUpdates(_0x56736f,_0x10f644){return function(_0x464a58){if(_0x464a58){return _0x464a58[_0xf827('0x20')](_0x56736f)[_0xf827('0x21')](function(_0x17f13b){return _0x17f13b;});}return null;};}function removeEntity(_0x401612,_0x300420){return function(_0x5fd387){if(_0x5fd387){return _0x5fd387[_0xf827('0x22')]()[_0xf827('0x21')](function(){_0x401612['status'](0xcc)[_0xf827('0x19')]();});}};}function handleEntityNotFound(_0x4dba2c,_0x105df9){return function(_0x22a6b1){if(!_0x22a6b1){_0x4dba2c[_0xf827('0x23')](0x194);}return _0x22a6b1;};}function handleError(_0x1b0fc0,_0x52d8cc){_0x52d8cc=_0x52d8cc||0x1f4;return function(_0x11cf98){logger['error'](_0x11cf98['stack']);if(_0x11cf98[_0xf827('0x24')]){delete _0x11cf98[_0xf827('0x24')];}_0x1b0fc0[_0xf827('0x18')](_0x52d8cc)['send'](_0x11cf98);};}exports['index']=function(_0x504c6f,_0x25d7fd){var _0x4fc18b={},_0x258fa6={},_0x4c4280={'count':0x0,'rows':[]};var _0xc624c5=_[_0xf827('0x25')](db[_0xf827('0x26')][_0xf827('0x27')],function(_0x1b6542){return{'name':_0x1b6542[_0xf827('0x28')],'type':_0x1b6542[_0xf827('0x29')][_0xf827('0x2a')]};});_0x258fa6[_0xf827('0x2b')]=_[_0xf827('0x25')](_0xc624c5,_0xf827('0x24'));_0x258fa6[_0xf827('0x2c')]=_[_0xf827('0x2d')](_0x504c6f[_0xf827('0x2c')]);_0x258fa6[_0xf827('0x2e')]=_[_0xf827('0x2f')](_0x258fa6['model'],_0x258fa6['query']);_0x4fc18b[_0xf827('0x30')]=_['intersection'](_0x258fa6[_0xf827('0x2b')],qs[_0xf827('0x31')](_0x504c6f['query']['fields']));_0x4fc18b[_0xf827('0x30')]=_0x4fc18b[_0xf827('0x30')][_0xf827('0x32')]?_0x4fc18b[_0xf827('0x30')]:_0x258fa6[_0xf827('0x2b')];if(!_0x504c6f[_0xf827('0x2c')][_0xf827('0x33')]('nolimit')){_0x4fc18b['limit']=qs[_0xf827('0x1c')](_0x504c6f[_0xf827('0x2c')][_0xf827('0x1c')]);_0x4fc18b['offset']=qs[_0xf827('0x1b')](_0x504c6f[_0xf827('0x2c')][_0xf827('0x1b')]);}_0x4fc18b[_0xf827('0x34')]=qs[_0xf827('0x35')](_0x504c6f[_0xf827('0x2c')][_0xf827('0x35')]);_0x4fc18b['where']=qs[_0xf827('0x2e')](_[_0xf827('0x36')](_0x504c6f[_0xf827('0x2c')],_0x258fa6[_0xf827('0x2e')]),_0xc624c5);if(_0x504c6f[_0xf827('0x2c')][_0xf827('0x37')]){_0x4fc18b[_0xf827('0x38')]=_['merge'](_0x4fc18b['where'],{'$or':_['map'](_0xc624c5,function(_0x3797bf){if(_0x3797bf[_0xf827('0x29')]!==_0xf827('0x39')){var _0x30d197={};_0x30d197[_0x3797bf[_0xf827('0x24')]]={'$like':'%'+_0x504c6f[_0xf827('0x2c')][_0xf827('0x37')]+'%'};return _0x30d197;}})});}_0x4fc18b=_['merge']({},_0x4fc18b,_0x504c6f[_0xf827('0x3a')]);var _0x402e30={'where':_0x4fc18b['where']};return db[_0xf827('0x26')][_0xf827('0x1d')](_0x402e30)[_0xf827('0x21')](function(_0x4551ad){_0x4c4280[_0xf827('0x1d')]=_0x4551ad;if(_0x504c6f[_0xf827('0x2c')][_0xf827('0x3b')]){_0x4fc18b[_0xf827('0x3c')]=[{'all':!![]}];}return db[_0xf827('0x26')][_0xf827('0x3d')](_0x4fc18b);})[_0xf827('0x21')](function(_0x3545c9){_0x4c4280[_0xf827('0x3e')]=_0x3545c9;return _0x4c4280;})['then'](respondWithFilteredResult(_0x25d7fd,_0x4fc18b))[_0xf827('0x3f')](handleError(_0x25d7fd,null));};exports[_0xf827('0x40')]=function(_0x363f30,_0x3d6209){var _0x3f27ef={'raw':!![],'where':{'id':_0x363f30[_0xf827('0x41')]['id']}},_0x8d3af5={};_0x8d3af5[_0xf827('0x2b')]=_[_0xf827('0x2d')](db[_0xf827('0x26')][_0xf827('0x27')]);_0x8d3af5[_0xf827('0x2c')]=_[_0xf827('0x2d')](_0x363f30['query']);_0x8d3af5[_0xf827('0x2e')]=_[_0xf827('0x2f')](_0x8d3af5[_0xf827('0x2b')],_0x8d3af5['query']);_0x3f27ef['attributes']=_[_0xf827('0x2f')](_0x8d3af5['model'],qs[_0xf827('0x31')](_0x363f30['query']['fields']));_0x3f27ef[_0xf827('0x30')]=_0x3f27ef[_0xf827('0x30')]['length']?_0x3f27ef[_0xf827('0x30')]:_0x8d3af5['model'];if(_0x363f30[_0xf827('0x2c')][_0xf827('0x3b')]){_0x3f27ef[_0xf827('0x3c')]=[{'all':!![]}];}_0x3f27ef=_[_0xf827('0x42')]({},_0x3f27ef,_0x363f30[_0xf827('0x3a')]);return db['OpenchannelQueueReport'][_0xf827('0x43')](_0x3f27ef)[_0xf827('0x21')](handleEntityNotFound(_0x3d6209,null))[_0xf827('0x21')](respondWithResult(_0x3d6209,null))[_0xf827('0x3f')](handleError(_0x3d6209,null));};exports[_0xf827('0x44')]=function(_0x132076,_0x3ec1c9){return db[_0xf827('0x26')][_0xf827('0x44')](_0x132076[_0xf827('0x45')],{})[_0xf827('0x21')](respondWithResult(_0x3ec1c9,0xc9))[_0xf827('0x3f')](handleError(_0x3ec1c9,null));};exports[_0xf827('0x20')]=function(_0x43e17f,_0x4e2299){if(_0x43e17f[_0xf827('0x45')]['id']){delete _0x43e17f['body']['id'];}return db[_0xf827('0x26')][_0xf827('0x43')]({'where':{'id':_0x43e17f[_0xf827('0x41')]['id']}})[_0xf827('0x21')](handleEntityNotFound(_0x4e2299,null))[_0xf827('0x21')](saveUpdates(_0x43e17f['body'],null))['then'](respondWithResult(_0x4e2299,null))[_0xf827('0x3f')](handleError(_0x4e2299,null));};exports[_0xf827('0x22')]=function(_0x4c5cdf,_0x35bad4){return db['OpenchannelQueueReport'][_0xf827('0x43')]({'where':{'id':_0x4c5cdf['params']['id']}})[_0xf827('0x21')](handleEntityNotFound(_0x35bad4,null))[_0xf827('0x21')](removeEntity(_0x35bad4,null))[_0xf827('0x3f')](handleError(_0x35bad4,null));};exports['describe']=function(_0x51a0d8,_0x2ca5a5){return db[_0xf827('0x26')]['describe']()[_0xf827('0x21')](respondWithResult(_0x2ca5a5,null))[_0xf827('0x3f')](handleError(_0x2ca5a5,null));}; \ No newline at end of file +var _0x3afe=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','catch','merge','options','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','OpenchannelQueueReport','fieldName','type','model','query','keys','filters','intersection'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x3afe,0x1d2));var _0xe3af=function(_0x3d6626,_0x447998){_0x3d6626=_0x3d6626-0x0;var _0x3f08b3=_0x3afe[_0x3d6626];return _0x3f08b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3af('0x0'));var zipdir=require(_0xe3af('0x1'));var jsonpatch=require(_0xe3af('0x2'));var rp=require(_0xe3af('0x3'));var moment=require(_0xe3af('0x4'));var BPromise=require(_0xe3af('0x5'));var Mustache=require(_0xe3af('0x6'));var util=require(_0xe3af('0x7'));var path=require('path');var sox=require(_0xe3af('0x8'));var csv=require(_0xe3af('0x9'));var ejs=require(_0xe3af('0xa'));var fs=require('fs');var fs_extra=require(_0xe3af('0xb'));var _=require(_0xe3af('0xc'));var squel=require(_0xe3af('0xd'));var crypto=require(_0xe3af('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe3af('0x9'));var querystring=require('querystring');var Papa=require(_0xe3af('0xf'));var Redis=require(_0xe3af('0x10'));var authService=require(_0xe3af('0x11'));var qs=require(_0xe3af('0x12'));var as=require(_0xe3af('0x13'));var hardwareService=require(_0xe3af('0x14'));var logger=require(_0xe3af('0x15'))('api');var utils=require(_0xe3af('0x16'));var config=require(_0xe3af('0x17'));var licenseUtil=require(_0xe3af('0x18'));var db=require(_0xe3af('0x19'))['db'];function respondWithStatusCode(_0x158c41,_0xd99feb){_0xd99feb=_0xd99feb||0xcc;return function(_0x2db365){if(_0x2db365){return _0x158c41['sendStatus'](_0xd99feb);}return _0x158c41[_0xe3af('0x1a')](_0xd99feb)[_0xe3af('0x1b')]();};}function respondWithResult(_0x54ebb9,_0x59f45e){_0x59f45e=_0x59f45e||0xc8;return function(_0x4dba0a){if(_0x4dba0a){return _0x54ebb9[_0xe3af('0x1a')](_0x59f45e)[_0xe3af('0x1c')](_0x4dba0a);}};}function respondWithFilteredResult(_0xf11efd,_0x2d91da){return function(_0x47f7ec){if(_0x47f7ec){var _0xf63073=typeof _0x2d91da['offset']==='undefined'&&typeof _0x2d91da[_0xe3af('0x1d')]==='undefined';var _0xe4158f=_0x47f7ec[_0xe3af('0x1e')];var _0x1d343d=_0xf63073?0x0:_0x2d91da[_0xe3af('0x1f')];var _0x304ec5=_0xf63073?_0x47f7ec[_0xe3af('0x1e')]:_0x2d91da[_0xe3af('0x1f')]+_0x2d91da[_0xe3af('0x1d')];var _0x438a71;if(_0x304ec5>=_0xe4158f){_0x304ec5=_0xe4158f;_0x438a71=0xc8;}else{_0x438a71=0xce;}_0xf11efd['status'](_0x438a71);return _0xf11efd['set']('Content-Range',_0x1d343d+'-'+_0x304ec5+'/'+_0xe4158f)[_0xe3af('0x1c')](_0x47f7ec);}return null;};}function patchUpdates(_0x4fecca){return function(_0x3e14a6){try{jsonpatch[_0xe3af('0x20')](_0x3e14a6,_0x4fecca,!![]);}catch(_0x4d081a){return BPromise[_0xe3af('0x21')](_0x4d081a);}return _0x3e14a6[_0xe3af('0x22')]();};}function saveUpdates(_0x1dc107,_0x3a2c73){return function(_0x540d97){if(_0x540d97){return _0x540d97[_0xe3af('0x23')](_0x1dc107)[_0xe3af('0x24')](function(_0x429531){return _0x429531;});}return null;};}function removeEntity(_0x586d47,_0x5c2556){return function(_0x3ef14f){if(_0x3ef14f){return _0x3ef14f[_0xe3af('0x25')]()[_0xe3af('0x24')](function(){_0x586d47[_0xe3af('0x1a')](0xcc)[_0xe3af('0x1b')]();});}};}function handleEntityNotFound(_0x4d54ad,_0xd1016f){return function(_0x1ab806){if(!_0x1ab806){_0x4d54ad[_0xe3af('0x26')](0x194);}return _0x1ab806;};}function handleError(_0x5adb46,_0x6323f4){_0x6323f4=_0x6323f4||0x1f4;return function(_0x3677fd){logger[_0xe3af('0x27')](_0x3677fd[_0xe3af('0x28')]);if(_0x3677fd[_0xe3af('0x29')]){delete _0x3677fd[_0xe3af('0x29')];}_0x5adb46[_0xe3af('0x1a')](_0x6323f4)['send'](_0x3677fd);};}exports[_0xe3af('0x2a')]=function(_0x3322d4,_0x329635){var _0x5e7c1b={},_0xe42c8c={},_0x4885f3={'count':0x0,'rows':[]};var _0x1b1575=_[_0xe3af('0x2b')](db[_0xe3af('0x2c')]['rawAttributes'],function(_0x322fc7){return{'name':_0x322fc7[_0xe3af('0x2d')],'type':_0x322fc7[_0xe3af('0x2e')]['key']};});_0xe42c8c[_0xe3af('0x2f')]=_[_0xe3af('0x2b')](_0x1b1575,_0xe3af('0x29'));_0xe42c8c[_0xe3af('0x30')]=_[_0xe3af('0x31')](_0x3322d4['query']);_0xe42c8c[_0xe3af('0x32')]=_[_0xe3af('0x33')](_0xe42c8c['model'],_0xe42c8c[_0xe3af('0x30')]);_0x5e7c1b['attributes']=_[_0xe3af('0x33')](_0xe42c8c['model'],qs[_0xe3af('0x34')](_0x3322d4[_0xe3af('0x30')][_0xe3af('0x34')]));_0x5e7c1b[_0xe3af('0x35')]=_0x5e7c1b['attributes'][_0xe3af('0x36')]?_0x5e7c1b['attributes']:_0xe42c8c[_0xe3af('0x2f')];if(!_0x3322d4[_0xe3af('0x30')][_0xe3af('0x37')](_0xe3af('0x38'))){_0x5e7c1b['limit']=qs[_0xe3af('0x1d')](_0x3322d4[_0xe3af('0x30')][_0xe3af('0x1d')]);_0x5e7c1b[_0xe3af('0x1f')]=qs[_0xe3af('0x1f')](_0x3322d4[_0xe3af('0x30')]['offset']);}_0x5e7c1b[_0xe3af('0x39')]=qs[_0xe3af('0x3a')](_0x3322d4[_0xe3af('0x30')]['sort']);_0x5e7c1b[_0xe3af('0x3b')]=qs[_0xe3af('0x32')](_['pick'](_0x3322d4[_0xe3af('0x30')],_0xe42c8c[_0xe3af('0x32')]),_0x1b1575);if(_0x3322d4[_0xe3af('0x30')][_0xe3af('0x3c')]){_0x5e7c1b[_0xe3af('0x3b')]=_['merge'](_0x5e7c1b[_0xe3af('0x3b')],{'$or':_[_0xe3af('0x2b')](_0x1b1575,function(_0x19877c){if(_0x19877c['type']!==_0xe3af('0x3d')){var _0x5df91e={};_0x5df91e[_0x19877c[_0xe3af('0x29')]]={'$like':'%'+_0x3322d4[_0xe3af('0x30')][_0xe3af('0x3c')]+'%'};return _0x5df91e;}})});}_0x5e7c1b=_['merge']({},_0x5e7c1b,_0x3322d4['options']);var _0x384dbb={'where':_0x5e7c1b[_0xe3af('0x3b')]};return db[_0xe3af('0x2c')][_0xe3af('0x1e')](_0x384dbb)[_0xe3af('0x24')](function(_0x18c0e6){_0x4885f3['count']=_0x18c0e6;if(_0x3322d4[_0xe3af('0x30')][_0xe3af('0x3e')]){_0x5e7c1b[_0xe3af('0x3f')]=[{'all':!![]}];}return db[_0xe3af('0x2c')][_0xe3af('0x40')](_0x5e7c1b);})[_0xe3af('0x24')](function(_0x25f956){_0x4885f3[_0xe3af('0x41')]=_0x25f956;return _0x4885f3;})['then'](respondWithFilteredResult(_0x329635,_0x5e7c1b))[_0xe3af('0x42')](handleError(_0x329635,null));};exports['show']=function(_0x2dc60d,_0x5b9e62){var _0x50d85d={'raw':!![],'where':{'id':_0x2dc60d['params']['id']}},_0xe95c8e={};_0xe95c8e[_0xe3af('0x2f')]=_[_0xe3af('0x31')](db[_0xe3af('0x2c')]['rawAttributes']);_0xe95c8e[_0xe3af('0x30')]=_[_0xe3af('0x31')](_0x2dc60d[_0xe3af('0x30')]);_0xe95c8e[_0xe3af('0x32')]=_[_0xe3af('0x33')](_0xe95c8e[_0xe3af('0x2f')],_0xe95c8e[_0xe3af('0x30')]);_0x50d85d[_0xe3af('0x35')]=_[_0xe3af('0x33')](_0xe95c8e[_0xe3af('0x2f')],qs[_0xe3af('0x34')](_0x2dc60d['query'][_0xe3af('0x34')]));_0x50d85d[_0xe3af('0x35')]=_0x50d85d[_0xe3af('0x35')][_0xe3af('0x36')]?_0x50d85d[_0xe3af('0x35')]:_0xe95c8e[_0xe3af('0x2f')];if(_0x2dc60d[_0xe3af('0x30')][_0xe3af('0x3e')]){_0x50d85d[_0xe3af('0x3f')]=[{'all':!![]}];}_0x50d85d=_[_0xe3af('0x43')]({},_0x50d85d,_0x2dc60d[_0xe3af('0x44')]);return db[_0xe3af('0x2c')][_0xe3af('0x45')](_0x50d85d)[_0xe3af('0x24')](handleEntityNotFound(_0x5b9e62,null))['then'](respondWithResult(_0x5b9e62,null))[_0xe3af('0x42')](handleError(_0x5b9e62,null));};exports[_0xe3af('0x46')]=function(_0x4d7d65,_0x5c485a){return db[_0xe3af('0x2c')][_0xe3af('0x46')](_0x4d7d65[_0xe3af('0x47')],{})[_0xe3af('0x24')](respondWithResult(_0x5c485a,0xc9))['catch'](handleError(_0x5c485a,null));};exports[_0xe3af('0x23')]=function(_0x59f376,_0xf22d53){if(_0x59f376[_0xe3af('0x47')]['id']){delete _0x59f376[_0xe3af('0x47')]['id'];}return db[_0xe3af('0x2c')]['find']({'where':{'id':_0x59f376[_0xe3af('0x48')]['id']}})[_0xe3af('0x24')](handleEntityNotFound(_0xf22d53,null))[_0xe3af('0x24')](saveUpdates(_0x59f376['body'],null))['then'](respondWithResult(_0xf22d53,null))[_0xe3af('0x42')](handleError(_0xf22d53,null));};exports[_0xe3af('0x25')]=function(_0x35c651,_0x36c4c7){return db[_0xe3af('0x2c')]['find']({'where':{'id':_0x35c651['params']['id']}})[_0xe3af('0x24')](handleEntityNotFound(_0x36c4c7,null))[_0xe3af('0x24')](removeEntity(_0x36c4c7,null))['catch'](handleError(_0x36c4c7,null));};exports['describe']=function(_0x1afcc1,_0x5120d1){return db[_0xe3af('0x2c')][_0xe3af('0x49')]()[_0xe3af('0x24')](respondWithResult(_0x5120d1,null))['catch'](handleError(_0x5120d1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 60b7cf3..b5c4cfb 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x1429a3,_0x3595cb){var _0x278106=function(_0x5c5be8){while(--_0x5c5be8){_0x1429a3['push'](_0x1429a3['shift']());}};_0x278106(++_0x3595cb);}(_0x7a54,0x106));var _0x47a5=function(_0x1e8b9f,_0x1f5f1c){_0x1e8b9f=_0x1e8b9f-0x0;var _0x40f9c5=_0x7a54[_0x1e8b9f];return _0x40f9c5;};'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 +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x47d8de,_0x188fec){var _0x3774f7=function(_0x1cba91){while(--_0x1cba91){_0x47d8de['push'](_0x47d8de['shift']());}};_0x3774f7(++_0x188fec);}(_0x1261,0x144));var _0x1126=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0x1261[_0x2a3c4d];return _0x55c390;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 33293ac..013618a 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 _0xc900=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x444fc7,_0xc9872d){var _0x486aa3=function(_0xaa1ca0){while(--_0xaa1ca0){_0x444fc7['push'](_0x444fc7['shift']());}};_0x486aa3(++_0xc9872d);}(_0xc900,0xb3));var _0x0c90=function(_0x3456a9,_0x671934){_0x3456a9=_0x3456a9-0x0;var _0x4aca2e=_0xc900[_0x3456a9];return _0x4aca2e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302ab1,_0x5b1a5c,_0x24e5be){return new BPromise(function(_0x1c1996,_0x23daed){return client[_0x0c90('0xa')](_0x302ab1,_0x24e5be)[_0x0c90('0xb')](function(_0x3d0f49){logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,_0x0c90('0xe'));logger[_0x0c90('0xf')](_0x0c90('0x10'),_0x5b1a5c,_0x0c90('0xe'),JSON[_0x0c90('0x11')](_0x3d0f49));if(_0x3d0f49['error']){if(_0x3d0f49[_0x0c90('0x12')]['code']===0x1f4){logger[_0x0c90('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x23daed(_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);}logger[_0x0c90('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x1c1996(_0x3d0f49['error'][_0x0c90('0x13')]);}else{logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,'request\x20sent');_0x1c1996(_0x3d0f49['result'][_0x0c90('0x13')]);}})[_0x0c90('0x14')](function(_0x2b8135){logger[_0x0c90('0x12')](_0x0c90('0xd'),_0x5b1a5c,_0x2b8135);_0x23daed(_0x2b8135);});});}exports[_0x0c90('0x15')]=function(_0x42321a){var _0x57b9a6=this;return new Promise(function(_0xc3bb47,_0x38becc){return db[_0x0c90('0x16')][_0x0c90('0x17')](_0x42321a['body'],{'raw':_0x42321a[_0x0c90('0x18')]?_0x42321a[_0x0c90('0x18')][_0x0c90('0x19')]===undefined?!![]:![]:!![]})[_0x0c90('0xb')](function(_0x315932){logger[_0x0c90('0xc')]('CreateOpenchannelQueueReport',_0x42321a);logger[_0x0c90('0xf')]('CreateOpenchannelQueueReport',_0x42321a,JSON[_0x0c90('0x11')](_0x315932));_0xc3bb47(_0x315932);})[_0x0c90('0x14')](function(_0x47b13c){logger[_0x0c90('0x12')](_0x0c90('0x15'),_0x47b13c[_0x0c90('0x13')],_0x42321a);_0x38becc(_0x57b9a6[_0x0c90('0x12')](0x1f4,_0x47b13c[_0x0c90('0x13')]));});});};exports[_0x0c90('0x1a')]=function(_0x4dfbc3){var _0x26f0a3=this;return new Promise(function(_0x12f22c,_0x5695a2){return db['OpenchannelQueueReport'][_0x0c90('0x1b')](_0x4dfbc3[_0x0c90('0x1c')],{'raw':_0x4dfbc3[_0x0c90('0x18')]?_0x4dfbc3[_0x0c90('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dfbc3[_0x0c90('0x18')]?_0x4dfbc3[_0x0c90('0x18')][_0x0c90('0x1d')]||null:null,'attributes':_0x4dfbc3[_0x0c90('0x18')]?_0x4dfbc3[_0x0c90('0x18')][_0x0c90('0x1e')]||null:null,'limit':_0x4dfbc3['options']?_0x4dfbc3[_0x0c90('0x18')][_0x0c90('0x1f')]||null:null})[_0x0c90('0xb')](function(_0x13b377){logger['info']('UpdateOpenchannelQueueReport',_0x4dfbc3);logger[_0x0c90('0xf')](_0x0c90('0x1a'),_0x4dfbc3,JSON[_0x0c90('0x11')](_0x13b377));_0x12f22c(_0x13b377);})[_0x0c90('0x14')](function(_0x119e09){logger['error'](_0x0c90('0x1a'),_0x119e09[_0x0c90('0x13')],_0x4dfbc3);_0x5695a2(_0x26f0a3[_0x0c90('0x12')](0x1f4,_0x119e09['message']));});});}; \ No newline at end of file +var _0x693f=['rpc','../../config/environment','jayson/promise','http','then','debug','request\x20sent','stringify','error','code','message','info','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','update','where','limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2e748c,_0x55ec8e){var _0x37e219=function(_0x38c784){while(--_0x38c784){_0x2e748c['push'](_0x2e748c['shift']());}};_0x37e219(++_0x55ec8e);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var moment=require(_0xf693('0x2'));var BPromise=require(_0xf693('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf693('0x4'));var db=require(_0xf693('0x5'))['db'];var utils=require(_0xf693('0x6'));var logger=require(_0xf693('0x7'))(_0xf693('0x8'));var config=require(_0xf693('0x9'));var jayson=require(_0xf693('0xa'));var client=jayson['client'][_0xf693('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33305c,_0x5b91c5,_0x22f362){return new BPromise(function(_0x594505,_0x38e78a){return client['request'](_0x33305c,_0x22f362)[_0xf693('0xc')](function(_0x17075d){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x5b91c5,'request\x20sent');logger[_0xf693('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5b91c5,_0xf693('0xe'),JSON[_0xf693('0xf')](_0x17075d));if(_0x17075d[_0xf693('0x10')]){if(_0x17075d[_0xf693('0x10')][_0xf693('0x11')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x5b91c5,_0x17075d[_0xf693('0x10')][_0xf693('0x12')]);return _0x38e78a(_0x17075d['error'][_0xf693('0x12')]);}logger[_0xf693('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5b91c5,_0x17075d['error'][_0xf693('0x12')]);return _0x594505(_0x17075d[_0xf693('0x10')][_0xf693('0x12')]);}else{logger[_0xf693('0x13')](_0xf693('0x14'),_0x5b91c5,'request\x20sent');_0x594505(_0x17075d[_0xf693('0x15')][_0xf693('0x12')]);}})[_0xf693('0x16')](function(_0x2a5e1b){logger[_0xf693('0x10')](_0xf693('0x14'),_0x5b91c5,_0x2a5e1b);_0x38e78a(_0x2a5e1b);});});}exports['CreateOpenchannelQueueReport']=function(_0x5e02e0){var _0x4a5964=this;return new Promise(function(_0x2474d4,_0xf4d20e){return db[_0xf693('0x17')][_0xf693('0x18')](_0x5e02e0[_0xf693('0x19')],{'raw':_0x5e02e0['options']?_0x5e02e0[_0xf693('0x1a')][_0xf693('0x1b')]===undefined?!![]:![]:!![]})[_0xf693('0xc')](function(_0x31b887){logger[_0xf693('0x13')](_0xf693('0x1c'),_0x5e02e0);logger[_0xf693('0xd')](_0xf693('0x1c'),_0x5e02e0,JSON['stringify'](_0x31b887));_0x2474d4(_0x31b887);})[_0xf693('0x16')](function(_0x1188c6){logger[_0xf693('0x10')](_0xf693('0x1c'),_0x1188c6[_0xf693('0x12')],_0x5e02e0);_0xf4d20e(_0x4a5964[_0xf693('0x10')](0x1f4,_0x1188c6[_0xf693('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x179e25){var _0x11ff68=this;return new Promise(function(_0xc5c088,_0x414a3f){return db['OpenchannelQueueReport'][_0xf693('0x1d')](_0x179e25[_0xf693('0x19')],{'raw':_0x179e25[_0xf693('0x1a')]?_0x179e25[_0xf693('0x1a')][_0xf693('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x179e25[_0xf693('0x1a')]?_0x179e25[_0xf693('0x1a')][_0xf693('0x1e')]||null:null,'attributes':_0x179e25[_0xf693('0x1a')]?_0x179e25[_0xf693('0x1a')]['attributes']||null:null,'limit':_0x179e25[_0xf693('0x1a')]?_0x179e25[_0xf693('0x1a')][_0xf693('0x1f')]||null:null})[_0xf693('0xc')](function(_0x83cd35){logger[_0xf693('0x13')](_0xf693('0x20'),_0x179e25);logger[_0xf693('0xd')]('UpdateOpenchannelQueueReport',_0x179e25,JSON[_0xf693('0xf')](_0x83cd35));_0xc5c088(_0x83cd35);})[_0xf693('0x16')](function(_0x3580c5){logger[_0xf693('0x10')]('UpdateOpenchannelQueueReport',_0x3580c5['message'],_0x179e25);_0x414a3f(_0x11ff68[_0xf693('0x10')](0x1f4,_0x3580c5[_0xf693('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8cf9eec..c800227 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 _0x6905=['fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','path','connect-timeout','Router'];(function(_0xeb31d6,_0x36dda8){var _0x2f7189=function(_0x5dd436){while(--_0x5dd436){_0xeb31d6['push'](_0xeb31d6['shift']());}};_0x2f7189(++_0x36dda8);}(_0x6905,0x1f1));var _0x5690=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0x6905[_0x8af54b];return _0x27d8f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5690('0x0'));var timeout=require(_0x5690('0x1'));var express=require('express');var router=express[_0x5690('0x2')]();var fs_extra=require(_0x5690('0x3'));var auth=require(_0x5690('0x4'));var interaction=require(_0x5690('0x5'));var config=require('../../config/environment');var controller=require(_0x5690('0x6'));router[_0x5690('0x7')]('/',auth[_0x5690('0x8')](),controller[_0x5690('0x9')]);router['get'](_0x5690('0xa'),auth[_0x5690('0x8')](),controller[_0x5690('0xb')]);router[_0x5690('0x7')](_0x5690('0xc'),auth['isAuthenticated'](),controller[_0x5690('0xd')]);router[_0x5690('0xe')]('/',auth[_0x5690('0x8')](),controller['create']);router[_0x5690('0xf')](_0x5690('0xc'),auth[_0x5690('0x8')](),controller[_0x5690('0x10')]);router[_0x5690('0x11')]('/:id',auth[_0x5690('0x8')](),controller[_0x5690('0x12')]);module[_0x5690('0x13')]=router; \ No newline at end of file +var _0x6387=['fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x6387,0x8d));var _0x7638=function(_0xdaf36c,_0x49e21a){_0xdaf36c=_0xdaf36c-0x0;var _0x4f3572=_0x6387[_0xdaf36c];return _0x4f3572;};'use strict';var multer=require(_0x7638('0x0'));var util=require(_0x7638('0x1'));var path=require(_0x7638('0x2'));var timeout=require(_0x7638('0x3'));var express=require(_0x7638('0x4'));var router=express[_0x7638('0x5')]();var fs_extra=require(_0x7638('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7638('0x7'));var config=require(_0x7638('0x8'));var controller=require(_0x7638('0x9'));router[_0x7638('0xa')]('/',auth[_0x7638('0xb')](),controller[_0x7638('0xc')]);router[_0x7638('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x7638('0xd')]);router['get']('/:id',auth[_0x7638('0xb')](),controller['show']);router[_0x7638('0xe')]('/',auth[_0x7638('0xb')](),controller[_0x7638('0xf')]);router[_0x7638('0x10')](_0x7638('0x11'),auth['isAuthenticated'](),controller[_0x7638('0x12')]);router[_0x7638('0x13')](_0x7638('0x11'),auth[_0x7638('0xb')](),controller[_0x7638('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index f852c20..539f62b 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(_0x1b0e96,_0x5b3f0a){var _0x2b63de=function(_0x16ec07){while(--_0x16ec07){_0x1b0e96['push'](_0x1b0e96['shift']());}};_0x2b63de(++_0x5b3f0a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x109de7,_0x6d4c52){_0x109de7=_0x109de7-0x0;var _0x5d0bc4=_0xf4eb[_0x109de7];return _0x5d0bc4;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x2f1ac4,_0x236a72){var _0x18e1a5=function(_0x18f34b){while(--_0x18f34b){_0x2f1ac4['push'](_0x2f1ac4['shift']());}};_0x18e1a5(++_0x236a72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 99b76ae..8bafc7e 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 _0x09c0=['name','send','index','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then'];(function(_0x50dbdf,_0x31e6d5){var _0x58a1b8=function(_0xde361a){while(--_0xde361a){_0x50dbdf['push'](_0x50dbdf['shift']());}};_0x58a1b8(++_0x31e6d5);}(_0x09c0,0x10b));var _0x009c=function(_0x25fdc1,_0x24d110){_0x25fdc1=_0x25fdc1-0x0;var _0x412ef8=_0x09c0[_0x25fdc1];return _0x412ef8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x009c('0x0'));var zipdir=require(_0x009c('0x1'));var jsonpatch=require(_0x009c('0x2'));var rp=require(_0x009c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x009c('0x4'));var util=require('util');var path=require(_0x009c('0x5'));var sox=require(_0x009c('0x6'));var csv=require(_0x009c('0x7'));var ejs=require(_0x009c('0x8'));var fs=require('fs');var fs_extra=require(_0x009c('0x9'));var _=require(_0x009c('0xa'));var squel=require('squel');var crypto=require(_0x009c('0xb'));var jsforce=require(_0x009c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x009c('0x7'));var querystring=require(_0x009c('0xd'));var Papa=require(_0x009c('0xe'));var Redis=require(_0x009c('0xf'));var authService=require(_0x009c('0x10'));var qs=require(_0x009c('0x11'));var as=require(_0x009c('0x12'));var hardwareService=require(_0x009c('0x13'));var logger=require(_0x009c('0x14'))(_0x009c('0x15'));var utils=require(_0x009c('0x16'));var config=require(_0x009c('0x17'));var licenseUtil=require(_0x009c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cdf01,_0x4f1b82){_0x4f1b82=_0x4f1b82||0xcc;return function(_0xf43478){if(_0xf43478){return _0x4cdf01[_0x009c('0x19')](_0x4f1b82);}return _0x4cdf01['status'](_0x4f1b82)[_0x009c('0x1a')]();};}function respondWithResult(_0x5e8649,_0x3e9ce6){_0x3e9ce6=_0x3e9ce6||0xc8;return function(_0x15005c){if(_0x15005c){return _0x5e8649[_0x009c('0x1b')](_0x3e9ce6)['json'](_0x15005c);}};}function respondWithFilteredResult(_0x2fea9b,_0x1d6e38){return function(_0xe022dc){if(_0xe022dc){var _0x44e9d4=typeof _0x1d6e38[_0x009c('0x1c')]===_0x009c('0x1d')&&typeof _0x1d6e38[_0x009c('0x1e')]===_0x009c('0x1d');var _0x25c89b=_0xe022dc[_0x009c('0x1f')];var _0x27bec6=_0x44e9d4?0x0:_0x1d6e38[_0x009c('0x1c')];var _0x59b563=_0x44e9d4?_0xe022dc[_0x009c('0x1f')]:_0x1d6e38[_0x009c('0x1c')]+_0x1d6e38[_0x009c('0x1e')];var _0x5249e1;if(_0x59b563>=_0x25c89b){_0x59b563=_0x25c89b;_0x5249e1=0xc8;}else{_0x5249e1=0xce;}_0x2fea9b[_0x009c('0x1b')](_0x5249e1);return _0x2fea9b[_0x009c('0x20')](_0x009c('0x21'),_0x27bec6+'-'+_0x59b563+'/'+_0x25c89b)[_0x009c('0x22')](_0xe022dc);}return null;};}function patchUpdates(_0xb877ce){return function(_0xfc0339){try{jsonpatch[_0x009c('0x23')](_0xfc0339,_0xb877ce,!![]);}catch(_0x562ffc){return BPromise[_0x009c('0x24')](_0x562ffc);}return _0xfc0339[_0x009c('0x25')]();};}function saveUpdates(_0x22fb25,_0x1022f7){return function(_0x565cdb){if(_0x565cdb){return _0x565cdb[_0x009c('0x26')](_0x22fb25)['then'](function(_0x201408){return _0x201408;});}return null;};}function removeEntity(_0x44f842,_0x11dc1f){return function(_0x913af1){if(_0x913af1){return _0x913af1[_0x009c('0x27')]()[_0x009c('0x28')](function(){_0x44f842[_0x009c('0x1b')](0xcc)[_0x009c('0x1a')]();});}};}function handleEntityNotFound(_0x1830e8,_0x15fecc){return function(_0x48e941){if(!_0x48e941){_0x1830e8[_0x009c('0x19')](0x194);}return _0x48e941;};}function handleError(_0x545cc4,_0x161b55){_0x161b55=_0x161b55||0x1f4;return function(_0x5af920){logger['error'](_0x5af920['stack']);if(_0x5af920[_0x009c('0x29')]){delete _0x5af920[_0x009c('0x29')];}_0x545cc4[_0x009c('0x1b')](_0x161b55)[_0x009c('0x2a')](_0x5af920);};}exports[_0x009c('0x2b')]=function(_0x3ac94,_0x2459ab){var _0x26c94e={},_0x73dafa={},_0x7f9746={'count':0x0,'rows':[]};var _0x249140=_[_0x009c('0x2c')](db[_0x009c('0x2d')]['rawAttributes'],function(_0x2534f6){return{'name':_0x2534f6[_0x009c('0x2e')],'type':_0x2534f6[_0x009c('0x2f')][_0x009c('0x30')]};});_0x73dafa[_0x009c('0x31')]=_['map'](_0x249140,'name');_0x73dafa[_0x009c('0x32')]=_[_0x009c('0x33')](_0x3ac94['query']);_0x73dafa[_0x009c('0x34')]=_[_0x009c('0x35')](_0x73dafa[_0x009c('0x31')],_0x73dafa[_0x009c('0x32')]);_0x26c94e[_0x009c('0x36')]=_[_0x009c('0x35')](_0x73dafa['model'],qs['fields'](_0x3ac94[_0x009c('0x32')][_0x009c('0x37')]));_0x26c94e[_0x009c('0x36')]=_0x26c94e['attributes'][_0x009c('0x38')]?_0x26c94e['attributes']:_0x73dafa[_0x009c('0x31')];if(!_0x3ac94[_0x009c('0x32')]['hasOwnProperty'](_0x009c('0x39'))){_0x26c94e['limit']=qs[_0x009c('0x1e')](_0x3ac94[_0x009c('0x32')][_0x009c('0x1e')]);_0x26c94e[_0x009c('0x1c')]=qs[_0x009c('0x1c')](_0x3ac94[_0x009c('0x32')][_0x009c('0x1c')]);}_0x26c94e[_0x009c('0x3a')]=qs[_0x009c('0x3b')](_0x3ac94[_0x009c('0x32')]['sort']);_0x26c94e[_0x009c('0x3c')]=qs['filters'](_[_0x009c('0x3d')](_0x3ac94[_0x009c('0x32')],_0x73dafa['filters']),_0x249140);if(_0x3ac94[_0x009c('0x32')][_0x009c('0x3e')]){_0x26c94e[_0x009c('0x3c')]=_[_0x009c('0x3f')](_0x26c94e[_0x009c('0x3c')],{'$or':_[_0x009c('0x2c')](_0x249140,function(_0x531c0d){if(_0x531c0d['type']!==_0x009c('0x40')){var _0x11cec9={};_0x11cec9[_0x531c0d['name']]={'$like':'%'+_0x3ac94[_0x009c('0x32')][_0x009c('0x3e')]+'%'};return _0x11cec9;}})});}_0x26c94e=_[_0x009c('0x3f')]({},_0x26c94e,_0x3ac94['options']);var _0x1bb852={'where':_0x26c94e[_0x009c('0x3c')]};return db['OpenchannelTransferReport']['count'](_0x1bb852)[_0x009c('0x28')](function(_0x11a0ab){_0x7f9746[_0x009c('0x1f')]=_0x11a0ab;if(_0x3ac94[_0x009c('0x32')][_0x009c('0x41')]){_0x26c94e['include']=[{'all':!![]}];}return db[_0x009c('0x2d')][_0x009c('0x42')](_0x26c94e);})[_0x009c('0x28')](function(_0x1f363a){_0x7f9746[_0x009c('0x43')]=_0x1f363a;return _0x7f9746;})[_0x009c('0x28')](respondWithFilteredResult(_0x2459ab,_0x26c94e))[_0x009c('0x44')](handleError(_0x2459ab,null));};exports[_0x009c('0x45')]=function(_0x44d826,_0xae067c){var _0x3e2d01={'raw':!![],'where':{'id':_0x44d826[_0x009c('0x46')]['id']}},_0x1413d3={};_0x1413d3[_0x009c('0x31')]=_[_0x009c('0x33')](db['OpenchannelTransferReport'][_0x009c('0x47')]);_0x1413d3[_0x009c('0x32')]=_[_0x009c('0x33')](_0x44d826[_0x009c('0x32')]);_0x1413d3[_0x009c('0x34')]=_[_0x009c('0x35')](_0x1413d3[_0x009c('0x31')],_0x1413d3[_0x009c('0x32')]);_0x3e2d01[_0x009c('0x36')]=_['intersection'](_0x1413d3[_0x009c('0x31')],qs['fields'](_0x44d826[_0x009c('0x32')]['fields']));_0x3e2d01[_0x009c('0x36')]=_0x3e2d01[_0x009c('0x36')][_0x009c('0x38')]?_0x3e2d01[_0x009c('0x36')]:_0x1413d3[_0x009c('0x31')];if(_0x44d826[_0x009c('0x32')]['includeAll']){_0x3e2d01['include']=[{'all':!![]}];}_0x3e2d01=_[_0x009c('0x3f')]({},_0x3e2d01,_0x44d826[_0x009c('0x48')]);return db[_0x009c('0x2d')]['find'](_0x3e2d01)[_0x009c('0x28')](handleEntityNotFound(_0xae067c,null))[_0x009c('0x28')](respondWithResult(_0xae067c,null))[_0x009c('0x44')](handleError(_0xae067c,null));};exports[_0x009c('0x49')]=function(_0x37099a,_0x40fdfc){return db[_0x009c('0x2d')][_0x009c('0x49')](_0x37099a[_0x009c('0x4a')],{})[_0x009c('0x28')](respondWithResult(_0x40fdfc,0xc9))[_0x009c('0x44')](handleError(_0x40fdfc,null));};exports[_0x009c('0x26')]=function(_0x5b4666,_0x1b0a2b){if(_0x5b4666[_0x009c('0x4a')]['id']){delete _0x5b4666[_0x009c('0x4a')]['id'];}return db[_0x009c('0x2d')]['find']({'where':{'id':_0x5b4666[_0x009c('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b0a2b,null))[_0x009c('0x28')](saveUpdates(_0x5b4666[_0x009c('0x4a')],null))[_0x009c('0x28')](respondWithResult(_0x1b0a2b,null))[_0x009c('0x44')](handleError(_0x1b0a2b,null));};exports['destroy']=function(_0x2acbe1,_0x13825b){return db[_0x009c('0x2d')][_0x009c('0x4b')]({'where':{'id':_0x2acbe1[_0x009c('0x46')]['id']}})[_0x009c('0x28')](handleEntityNotFound(_0x13825b,null))[_0x009c('0x28')](removeEntity(_0x13825b,null))[_0x009c('0x44')](handleError(_0x13825b,null));};exports[_0x009c('0x4c')]=function(_0x50f758,_0x2ba7af){return db['OpenchannelTransferReport']['describe']()[_0x009c('0x28')](respondWithResult(_0x2ba7af,null))[_0x009c('0x44')](handleError(_0x2ba7af,null));}; \ No newline at end of file +var _0x4624=['util','path','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','destroy','describe','eml-format','rimraf','moment','bluebird','mustache'];(function(_0x52a2be,_0x4bd252){var _0x246f1d=function(_0x410395){while(--_0x410395){_0x52a2be['push'](_0x52a2be['shift']());}};_0x246f1d(++_0x4bd252);}(_0x4624,0x12f));var _0x4462=function(_0x5b21a8,_0x35701f){_0x5b21a8=_0x5b21a8-0x0;var _0x5f6aaa=_0x4624[_0x5b21a8];return _0x5f6aaa;};'use strict';var emlformat=require(_0x4462('0x0'));var rimraf=require(_0x4462('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4462('0x2'));var BPromise=require(_0x4462('0x3'));var Mustache=require(_0x4462('0x4'));var util=require(_0x4462('0x5'));var path=require(_0x4462('0x6'));var sox=require(_0x4462('0x7'));var csv=require('to-csv');var ejs=require(_0x4462('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4462('0x9'));var squel=require('squel');var crypto=require(_0x4462('0xa'));var jsforce=require(_0x4462('0xb'));var deskjs=require(_0x4462('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4462('0xd'));var Redis=require('ioredis');var authService=require(_0x4462('0xe'));var qs=require(_0x4462('0xf'));var as=require(_0x4462('0x10'));var hardwareService=require(_0x4462('0x11'));var logger=require(_0x4462('0x12'))(_0x4462('0x13'));var utils=require(_0x4462('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4462('0x15'));var db=require(_0x4462('0x16'))['db'];function respondWithStatusCode(_0x23f65f,_0x10c2a5){_0x10c2a5=_0x10c2a5||0xcc;return function(_0x37fd42){if(_0x37fd42){return _0x23f65f[_0x4462('0x17')](_0x10c2a5);}return _0x23f65f[_0x4462('0x18')](_0x10c2a5)[_0x4462('0x19')]();};}function respondWithResult(_0xe08df6,_0x5f5765){_0x5f5765=_0x5f5765||0xc8;return function(_0x2db727){if(_0x2db727){return _0xe08df6[_0x4462('0x18')](_0x5f5765)[_0x4462('0x1a')](_0x2db727);}};}function respondWithFilteredResult(_0x30be75,_0x78cab8){return function(_0x3a0f05){if(_0x3a0f05){var _0xf6f181=typeof _0x78cab8[_0x4462('0x1b')]===_0x4462('0x1c')&&typeof _0x78cab8[_0x4462('0x1d')]==='undefined';var _0x50a2ec=_0x3a0f05['count'];var _0x5ecdf1=_0xf6f181?0x0:_0x78cab8['offset'];var _0xf81fe9=_0xf6f181?_0x3a0f05[_0x4462('0x1e')]:_0x78cab8[_0x4462('0x1b')]+_0x78cab8['limit'];var _0x4a494a;if(_0xf81fe9>=_0x50a2ec){_0xf81fe9=_0x50a2ec;_0x4a494a=0xc8;}else{_0x4a494a=0xce;}_0x30be75[_0x4462('0x18')](_0x4a494a);return _0x30be75[_0x4462('0x1f')](_0x4462('0x20'),_0x5ecdf1+'-'+_0xf81fe9+'/'+_0x50a2ec)[_0x4462('0x1a')](_0x3a0f05);}return null;};}function patchUpdates(_0x82f3a1){return function(_0x810de){try{jsonpatch[_0x4462('0x21')](_0x810de,_0x82f3a1,!![]);}catch(_0x540e8f){return BPromise[_0x4462('0x22')](_0x540e8f);}return _0x810de['save']();};}function saveUpdates(_0x4efcf2,_0x221a0a){return function(_0x58dd83){if(_0x58dd83){return _0x58dd83[_0x4462('0x23')](_0x4efcf2)[_0x4462('0x24')](function(_0x41d586){return _0x41d586;});}return null;};}function removeEntity(_0x2fcb93,_0x6fa2e7){return function(_0x1ed1bf){if(_0x1ed1bf){return _0x1ed1bf['destroy']()[_0x4462('0x24')](function(){_0x2fcb93[_0x4462('0x18')](0xcc)[_0x4462('0x19')]();});}};}function handleEntityNotFound(_0x511746,_0x2fe909){return function(_0x41fbbd){if(!_0x41fbbd){_0x511746['sendStatus'](0x194);}return _0x41fbbd;};}function handleError(_0xcd91bb,_0x3c35b8){_0x3c35b8=_0x3c35b8||0x1f4;return function(_0x26ab3a){logger[_0x4462('0x25')](_0x26ab3a[_0x4462('0x26')]);if(_0x26ab3a[_0x4462('0x27')]){delete _0x26ab3a[_0x4462('0x27')];}_0xcd91bb[_0x4462('0x18')](_0x3c35b8)[_0x4462('0x28')](_0x26ab3a);};}exports[_0x4462('0x29')]=function(_0x2c9e58,_0x520fdd){var _0x3d52db={},_0x18e703={},_0x598869={'count':0x0,'rows':[]};var _0x30ff54=_[_0x4462('0x2a')](db[_0x4462('0x2b')][_0x4462('0x2c')],function(_0x3e284a){return{'name':_0x3e284a[_0x4462('0x2d')],'type':_0x3e284a[_0x4462('0x2e')][_0x4462('0x2f')]};});_0x18e703[_0x4462('0x30')]=_['map'](_0x30ff54,'name');_0x18e703[_0x4462('0x31')]=_['keys'](_0x2c9e58['query']);_0x18e703[_0x4462('0x32')]=_[_0x4462('0x33')](_0x18e703[_0x4462('0x30')],_0x18e703[_0x4462('0x31')]);_0x3d52db[_0x4462('0x34')]=_[_0x4462('0x33')](_0x18e703['model'],qs[_0x4462('0x35')](_0x2c9e58[_0x4462('0x31')]['fields']));_0x3d52db[_0x4462('0x34')]=_0x3d52db[_0x4462('0x34')]['length']?_0x3d52db['attributes']:_0x18e703[_0x4462('0x30')];if(!_0x2c9e58[_0x4462('0x31')][_0x4462('0x36')]('nolimit')){_0x3d52db[_0x4462('0x1d')]=qs['limit'](_0x2c9e58['query'][_0x4462('0x1d')]);_0x3d52db['offset']=qs[_0x4462('0x1b')](_0x2c9e58['query'][_0x4462('0x1b')]);}_0x3d52db[_0x4462('0x37')]=qs[_0x4462('0x38')](_0x2c9e58['query'][_0x4462('0x38')]);_0x3d52db[_0x4462('0x39')]=qs[_0x4462('0x32')](_[_0x4462('0x3a')](_0x2c9e58['query'],_0x18e703[_0x4462('0x32')]),_0x30ff54);if(_0x2c9e58[_0x4462('0x31')]['filter']){_0x3d52db[_0x4462('0x39')]=_[_0x4462('0x3b')](_0x3d52db[_0x4462('0x39')],{'$or':_['map'](_0x30ff54,function(_0x12b7ae){if(_0x12b7ae['type']!==_0x4462('0x3c')){var _0x4a598e={};_0x4a598e[_0x12b7ae[_0x4462('0x27')]]={'$like':'%'+_0x2c9e58[_0x4462('0x31')][_0x4462('0x3d')]+'%'};return _0x4a598e;}})});}_0x3d52db=_['merge']({},_0x3d52db,_0x2c9e58['options']);var _0x35fa70={'where':_0x3d52db[_0x4462('0x39')]};return db['OpenchannelTransferReport'][_0x4462('0x1e')](_0x35fa70)[_0x4462('0x24')](function(_0x2d6a83){_0x598869['count']=_0x2d6a83;if(_0x2c9e58[_0x4462('0x31')][_0x4462('0x3e')]){_0x3d52db[_0x4462('0x3f')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x4462('0x40')](_0x3d52db);})[_0x4462('0x24')](function(_0x46f27c){_0x598869[_0x4462('0x41')]=_0x46f27c;return _0x598869;})[_0x4462('0x24')](respondWithFilteredResult(_0x520fdd,_0x3d52db))[_0x4462('0x42')](handleError(_0x520fdd,null));};exports[_0x4462('0x43')]=function(_0xe9847b,_0x5b2798){var _0x20cc8c={'raw':!![],'where':{'id':_0xe9847b[_0x4462('0x44')]['id']}},_0x3981b9={};_0x3981b9[_0x4462('0x30')]=_[_0x4462('0x45')](db[_0x4462('0x2b')][_0x4462('0x2c')]);_0x3981b9[_0x4462('0x31')]=_[_0x4462('0x45')](_0xe9847b['query']);_0x3981b9[_0x4462('0x32')]=_[_0x4462('0x33')](_0x3981b9[_0x4462('0x30')],_0x3981b9['query']);_0x20cc8c['attributes']=_[_0x4462('0x33')](_0x3981b9[_0x4462('0x30')],qs[_0x4462('0x35')](_0xe9847b[_0x4462('0x31')][_0x4462('0x35')]));_0x20cc8c[_0x4462('0x34')]=_0x20cc8c[_0x4462('0x34')][_0x4462('0x46')]?_0x20cc8c[_0x4462('0x34')]:_0x3981b9['model'];if(_0xe9847b['query'][_0x4462('0x3e')]){_0x20cc8c['include']=[{'all':!![]}];}_0x20cc8c=_['merge']({},_0x20cc8c,_0xe9847b[_0x4462('0x47')]);return db[_0x4462('0x2b')][_0x4462('0x48')](_0x20cc8c)[_0x4462('0x24')](handleEntityNotFound(_0x5b2798,null))[_0x4462('0x24')](respondWithResult(_0x5b2798,null))[_0x4462('0x42')](handleError(_0x5b2798,null));};exports[_0x4462('0x49')]=function(_0x31d005,_0x91901f){return db[_0x4462('0x2b')][_0x4462('0x49')](_0x31d005[_0x4462('0x4a')],{})[_0x4462('0x24')](respondWithResult(_0x91901f,0xc9))[_0x4462('0x42')](handleError(_0x91901f,null));};exports[_0x4462('0x23')]=function(_0x14ac5d,_0xb1ca72){if(_0x14ac5d['body']['id']){delete _0x14ac5d[_0x4462('0x4a')]['id'];}return db['OpenchannelTransferReport'][_0x4462('0x48')]({'where':{'id':_0x14ac5d[_0x4462('0x44')]['id']}})[_0x4462('0x24')](handleEntityNotFound(_0xb1ca72,null))[_0x4462('0x24')](saveUpdates(_0x14ac5d[_0x4462('0x4a')],null))[_0x4462('0x24')](respondWithResult(_0xb1ca72,null))[_0x4462('0x42')](handleError(_0xb1ca72,null));};exports[_0x4462('0x4b')]=function(_0x2ed65a,_0x5a5f6a){return db[_0x4462('0x2b')]['find']({'where':{'id':_0x2ed65a[_0x4462('0x44')]['id']}})[_0x4462('0x24')](handleEntityNotFound(_0x5a5f6a,null))['then'](removeEntity(_0x5a5f6a,null))[_0x4462('0x42')](handleError(_0x5a5f6a,null));};exports[_0x4462('0x4c')]=function(_0xd6c01e,_0x50172b){return db[_0x4462('0x2b')][_0x4462('0x4c')]()[_0x4462('0x24')](respondWithResult(_0x50172b,null))[_0x4462('0x42')](handleError(_0x50172b,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 29cac97..60b4138 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 _0x9c21=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0xca96eb,_0x20808d){var _0x489c98=function(_0x1a9310){while(--_0x1a9310){_0xca96eb['push'](_0xca96eb['shift']());}};_0x489c98(++_0x20808d);}(_0x9c21,0x176));var _0x19c2=function(_0x1aeaff,_0x148099){_0x1aeaff=_0x1aeaff-0x0;var _0x3137ef=_0x9c21[_0x1aeaff];return _0x3137ef;};'use strict';var _=require(_0x19c2('0x0'));var util=require(_0x19c2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x19c2('0x2'));var BPromise=require(_0x19c2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19c2('0x4'));var rimraf=require(_0x19c2('0x5'));var config=require(_0x19c2('0x6'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x2ce15b,_0x50071b){return _0x2ce15b[_0x19c2('0x7')](_0x19c2('0x8'),attributes,{'tableName':_0x19c2('0x9'),'paranoid':![],'indexes':[{'name':_0x19c2('0xa'),'fields':[_0x19c2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x99e6=['./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','api','moment','bluebird','path'];(function(_0xebc80e,_0x49d4d3){var _0x3fe1bc=function(_0x2882b0){while(--_0x2882b0){_0xebc80e['push'](_0xebc80e['shift']());}};_0x3fe1bc(++_0x49d4d3);}(_0x99e6,0x123));var _0x699e=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0x99e6[_0x333fed];return _0x12cac2;};'use strict';var _=require(_0x699e('0x0'));var util=require(_0x699e('0x1'));var logger=require('../../config/logger')(_0x699e('0x2'));var moment=require(_0x699e('0x3'));var BPromise=require(_0x699e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x699e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x699e('0x6'));module[_0x699e('0x7')]=function(_0x30c07d,_0x63e17d){return _0x30c07d[_0x699e('0x8')](_0x699e('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x699e('0xa'),'fields':[_0x699e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index aa134ca..3920978 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 _0x0dee=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x5d13f7,_0x2bf86f){var _0x141508=function(_0x327413){while(--_0x327413){_0x5d13f7['push'](_0x5d13f7['shift']());}};_0x141508(++_0x2bf86f);}(_0x0dee,0xf7));var _0xe0de=function(_0x59dd7b,_0x556b85){_0x59dd7b=_0x59dd7b-0x0;var _0x440d7c=_0x0dee[_0x59dd7b];return _0x440d7c;};'use strict';var _=require(_0xe0de('0x0'));var util=require(_0xe0de('0x1'));var moment=require('moment');var BPromise=require(_0xe0de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0de('0x3'));var db=require(_0xe0de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0de('0x5'))(_0xe0de('0x6'));var config=require(_0xe0de('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe0de('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe1fd9,_0x5e5250,_0x349fd2){return new BPromise(function(_0x5b644c,_0x25818f){return client['request'](_0xfe1fd9,_0x349fd2)[_0xe0de('0x9')](function(_0x4a5ecd){logger[_0xe0de('0xa')](_0xe0de('0xb'),_0x5e5250,_0xe0de('0xc'));logger[_0xe0de('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x5e5250,_0xe0de('0xc'),JSON[_0xe0de('0xe')](_0x4a5ecd));if(_0x4a5ecd[_0xe0de('0xf')]){if(_0x4a5ecd[_0xe0de('0xf')]['code']===0x1f4){logger['error'](_0xe0de('0xb'),_0x5e5250,_0x4a5ecd[_0xe0de('0xf')]['message']);return _0x25818f(_0x4a5ecd['error'][_0xe0de('0x10')]);}logger[_0xe0de('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5e5250,_0x4a5ecd['error']['message']);return _0x5b644c(_0x4a5ecd['error'][_0xe0de('0x10')]);}else{logger[_0xe0de('0xa')](_0xe0de('0xb'),_0x5e5250,_0xe0de('0xc'));_0x5b644c(_0x4a5ecd[_0xe0de('0x11')][_0xe0de('0x10')]);}})[_0xe0de('0x12')](function(_0x2d8c3d){logger[_0xe0de('0xf')](_0xe0de('0xb'),_0x5e5250,_0x2d8c3d);_0x25818f(_0x2d8c3d);});});} \ No newline at end of file +var _0xadf0=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s','result','util','moment','bluebird'];(function(_0x49e8e2,_0x44d58c){var _0x1ee938=function(_0x46107b){while(--_0x46107b){_0x49e8e2['push'](_0x49e8e2['shift']());}};_0x1ee938(++_0x44d58c);}(_0xadf0,0x12d));var _0x0adf=function(_0x756ea7,_0x5f578a){_0x756ea7=_0x756ea7-0x0;var _0x643626=_0xadf0[_0x756ea7];return _0x643626;};'use strict';var _=require('lodash');var util=require(_0x0adf('0x0'));var moment=require(_0x0adf('0x1'));var BPromise=require(_0x0adf('0x2'));var rs=require(_0x0adf('0x3'));var fs=require('fs');var Redis=require(_0x0adf('0x4'));var db=require(_0x0adf('0x5'))['db'];var utils=require(_0x0adf('0x6'));var logger=require('../../config/logger')(_0x0adf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd1de43,_0x2393f1,_0x514e20){return new BPromise(function(_0x58f618,_0x33e906){return client[_0x0adf('0x8')](_0xd1de43,_0x514e20)['then'](function(_0x357c3b){logger[_0x0adf('0x9')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2393f1,_0x0adf('0xa'));logger[_0x0adf('0xb')](_0x0adf('0xc'),_0x2393f1,'request\x20sent',JSON[_0x0adf('0xd')](_0x357c3b));if(_0x357c3b[_0x0adf('0xe')]){if(_0x357c3b[_0x0adf('0xe')][_0x0adf('0xf')]===0x1f4){logger[_0x0adf('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2393f1,_0x357c3b[_0x0adf('0xe')][_0x0adf('0x10')]);return _0x33e906(_0x357c3b['error'][_0x0adf('0x10')]);}logger['error'](_0x0adf('0x11'),_0x2393f1,_0x357c3b['error'][_0x0adf('0x10')]);return _0x58f618(_0x357c3b[_0x0adf('0xe')][_0x0adf('0x10')]);}else{logger[_0x0adf('0x9')](_0x0adf('0x11'),_0x2393f1,_0x0adf('0xa'));_0x58f618(_0x357c3b[_0x0adf('0x12')][_0x0adf('0x10')]);}})['catch'](function(_0x2ee54e){logger[_0x0adf('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2393f1,_0x2ee54e);_0x33e906(_0x2ee54e);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index bb02ac4..aa93b1a 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 _0x83d6=['./pause.controller','get','index','/:id','isAuthenticated','show','create','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x29733c,_0x2da30b){var _0x49e72f=function(_0x405c92){while(--_0x405c92){_0x29733c['push'](_0x29733c['shift']());}};_0x49e72f(++_0x2da30b);}(_0x83d6,0xd8));var _0x683d=function(_0x2c20d1,_0x2b278e){_0x2c20d1=_0x2c20d1-0x0;var _0x5b1eb1=_0x83d6[_0x2c20d1];return _0x5b1eb1;};'use strict';var multer=require(_0x683d('0x0'));var util=require(_0x683d('0x1'));var path=require(_0x683d('0x2'));var timeout=require(_0x683d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x683d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x683d('0x5'));router[_0x683d('0x6')]('/',auth['isAuthenticated'](),controller[_0x683d('0x7')]);router[_0x683d('0x6')](_0x683d('0x8'),auth[_0x683d('0x9')](),controller[_0x683d('0xa')]);router['post']('/',auth[_0x683d('0x9')](),controller[_0x683d('0xb')]);router['put']('/:id',auth[_0x683d('0x9')](),controller['update']);router['delete'](_0x683d('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x683d('0xc')]=router; \ No newline at end of file +var _0xdaf2=['../../components/auth/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','post','create','put','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x3a467a,_0x4cb7f6){var _0x1af0cd=function(_0xe97a5a){while(--_0xe97a5a){_0x3a467a['push'](_0x3a467a['shift']());}};_0x1af0cd(++_0x4cb7f6);}(_0xdaf2,0x1cf));var _0x2daf=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdaf2[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x2daf('0x0'));var path=require(_0x2daf('0x1'));var timeout=require('connect-timeout');var express=require(_0x2daf('0x2'));var router=express[_0x2daf('0x3')]();var fs_extra=require(_0x2daf('0x4'));var auth=require(_0x2daf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2daf('0x6'));var controller=require(_0x2daf('0x7'));router[_0x2daf('0x8')]('/',auth['isAuthenticated'](),controller[_0x2daf('0x9')]);router['get'](_0x2daf('0xa'),auth[_0x2daf('0xb')](),controller[_0x2daf('0xc')]);router[_0x2daf('0xd')]('/',auth[_0x2daf('0xb')](),controller[_0x2daf('0xe')]);router[_0x2daf('0xf')](_0x2daf('0xa'),auth[_0x2daf('0xb')](),controller['update']);router['delete'](_0x2daf('0xa'),auth[_0x2daf('0xb')](),controller[_0x2daf('0x10')]);module[_0x2daf('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 e155f35..31058d0 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 _0xda79=['sequelize','exports','name'];(function(_0x4e3b9c,_0x4d76a3){var _0x358b13=function(_0x2409d6){while(--_0x2409d6){_0x4e3b9c['push'](_0x4e3b9c['shift']());}};_0x358b13(++_0x4d76a3);}(_0xda79,0x8d));var _0x9da7=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xda79[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x9da7('0x0'));module[_0x9da7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9da7('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x50fa=['STRING','name','sequelize','exports'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x50fa,0xde));var _0xa50f=function(_0x141380,_0x4bf55f){_0x141380=_0x141380-0x0;var _0x55b02b=_0x50fa[_0x141380];return _0x55b02b;};'use strict';var Sequelize=require(_0xa50f('0x0'));module[_0xa50f('0x1')]={'name':{'type':Sequelize[_0xa50f('0x2')],'unique':_0xa50f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xa50f('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index b46a764..29655c4 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 _0x8f59=['index','Pause','fieldName','key','model','map','keys','filters','intersection','query','attributes','fields','nolimit','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','Pauses','UserProfileResource','error','stack','name','send'];(function(_0x1adbbe,_0x116f65){var _0x41ebf0=function(_0xf013e7){while(--_0xf013e7){_0x1adbbe['push'](_0x1adbbe['shift']());}};_0x41ebf0(++_0x116f65);}(_0x8f59,0x7a));var _0x98f5=function(_0x42d2af,_0x3961b5){_0x42d2af=_0x42d2af-0x0;var _0x1d6d63=_0x8f59[_0x42d2af];return _0x1d6d63;};'use strict';var emlformat=require(_0x98f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98f5('0x1'));var jsonpatch=require(_0x98f5('0x2'));var rp=require('request-promise');var moment=require(_0x98f5('0x3'));var BPromise=require(_0x98f5('0x4'));var Mustache=require(_0x98f5('0x5'));var util=require(_0x98f5('0x6'));var path=require('path');var sox=require(_0x98f5('0x7'));var csv=require(_0x98f5('0x8'));var ejs=require(_0x98f5('0x9'));var fs=require('fs');var fs_extra=require(_0x98f5('0xa'));var _=require(_0x98f5('0xb'));var squel=require('squel');var crypto=require(_0x98f5('0xc'));var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0x8'));var querystring=require(_0x98f5('0xf'));var Papa=require(_0x98f5('0x10'));var Redis=require('ioredis');var authService=require(_0x98f5('0x11'));var qs=require(_0x98f5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x13'));var logger=require('../../config/logger')(_0x98f5('0x14'));var utils=require(_0x98f5('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x16'))['db'];function respondWithStatusCode(_0x3dc392,_0x2b810c){_0x2b810c=_0x2b810c||0xcc;return function(_0x2e4666){if(_0x2e4666){return _0x3dc392[_0x98f5('0x17')](_0x2b810c);}return _0x3dc392[_0x98f5('0x18')](_0x2b810c)[_0x98f5('0x19')]();};}function respondWithResult(_0xc3a11,_0x9014a9){_0x9014a9=_0x9014a9||0xc8;return function(_0x7fb05c){if(_0x7fb05c){return _0xc3a11['status'](_0x9014a9)[_0x98f5('0x1a')](_0x7fb05c);}};}function respondWithFilteredResult(_0x47dd57,_0x3e0113){return function(_0x2cb13c){if(_0x2cb13c){var _0x11a4b9=typeof _0x3e0113['offset']===_0x98f5('0x1b')&&typeof _0x3e0113[_0x98f5('0x1c')]==='undefined';var _0x471c5c=_0x2cb13c[_0x98f5('0x1d')];var _0x329cde=_0x11a4b9?0x0:_0x3e0113[_0x98f5('0x1e')];var _0x5d954f=_0x11a4b9?_0x2cb13c[_0x98f5('0x1d')]:_0x3e0113[_0x98f5('0x1e')]+_0x3e0113['limit'];var _0x496dea;if(_0x5d954f>=_0x471c5c){_0x5d954f=_0x471c5c;_0x496dea=0xc8;}else{_0x496dea=0xce;}_0x47dd57[_0x98f5('0x18')](_0x496dea);return _0x47dd57['set'](_0x98f5('0x1f'),_0x329cde+'-'+_0x5d954f+'/'+_0x471c5c)[_0x98f5('0x1a')](_0x2cb13c);}return null;};}function patchUpdates(_0x81b2b){return function(_0x3dc08f){try{jsonpatch[_0x98f5('0x20')](_0x3dc08f,_0x81b2b,!![]);}catch(_0x15a11b){return BPromise['reject'](_0x15a11b);}return _0x3dc08f[_0x98f5('0x21')]();};}function saveUpdates(_0x3df7a2,_0x204397){return function(_0x2d1340){if(_0x2d1340){return _0x2d1340[_0x98f5('0x22')](_0x3df7a2)['then'](function(_0x59e2b6){return _0x59e2b6;});}return null;};}function removeEntity(_0x1c6cf6,_0x1ad318){return function(_0x2c01de){if(_0x2c01de){return _0x2c01de['destroy']()[_0x98f5('0x23')](function(){var _0x5bfcde=_0x2c01de['get']({'plain':!![]});var _0x3d072b=_0x98f5('0x24');return db[_0x98f5('0x25')]['destroy']({'where':{'type':_0x3d072b,'resourceId':_0x5bfcde['id']}})[_0x98f5('0x23')](function(){return _0x2c01de;});})['then'](function(){_0x1c6cf6['status'](0xcc)[_0x98f5('0x19')]();});}};}function handleEntityNotFound(_0x627c76,_0x1196ac){return function(_0x454f73){if(!_0x454f73){_0x627c76[_0x98f5('0x17')](0x194);}return _0x454f73;};}function handleError(_0x13c525,_0x18d42a){_0x18d42a=_0x18d42a||0x1f4;return function(_0x48e121){logger[_0x98f5('0x26')](_0x48e121[_0x98f5('0x27')]);if(_0x48e121['name']){delete _0x48e121[_0x98f5('0x28')];}_0x13c525[_0x98f5('0x18')](_0x18d42a)[_0x98f5('0x29')](_0x48e121);};}exports[_0x98f5('0x2a')]=function(_0x349342,_0x3c1caf){var _0x17be43={},_0x15d15c={},_0x4d3dec={'count':0x0,'rows':[]};var _0x54991d=_['map'](db[_0x98f5('0x2b')]['rawAttributes'],function(_0x4a18ef){return{'name':_0x4a18ef[_0x98f5('0x2c')],'type':_0x4a18ef['type'][_0x98f5('0x2d')]};});_0x15d15c[_0x98f5('0x2e')]=_[_0x98f5('0x2f')](_0x54991d,_0x98f5('0x28'));_0x15d15c['query']=_[_0x98f5('0x30')](_0x349342['query']);_0x15d15c[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x15d15c['model'],_0x15d15c[_0x98f5('0x33')]);_0x17be43[_0x98f5('0x34')]=_[_0x98f5('0x32')](_0x15d15c[_0x98f5('0x2e')],qs[_0x98f5('0x35')](_0x349342[_0x98f5('0x33')][_0x98f5('0x35')]));_0x17be43[_0x98f5('0x34')]=_0x17be43[_0x98f5('0x34')]['length']?_0x17be43['attributes']:_0x15d15c[_0x98f5('0x2e')];if(!_0x349342[_0x98f5('0x33')]['hasOwnProperty'](_0x98f5('0x36'))){_0x17be43[_0x98f5('0x1c')]=qs[_0x98f5('0x1c')](_0x349342[_0x98f5('0x33')]['limit']);_0x17be43[_0x98f5('0x1e')]=qs[_0x98f5('0x1e')](_0x349342['query'][_0x98f5('0x1e')]);}_0x17be43['order']=qs['sort'](_0x349342[_0x98f5('0x33')]['sort']);_0x17be43['where']=qs[_0x98f5('0x31')](_[_0x98f5('0x37')](_0x349342[_0x98f5('0x33')],_0x15d15c[_0x98f5('0x31')]),_0x54991d);if(_0x349342[_0x98f5('0x33')]['filter']){_0x17be43[_0x98f5('0x38')]=_[_0x98f5('0x39')](_0x17be43['where'],{'$or':_[_0x98f5('0x2f')](_0x54991d,function(_0xd7f92a){if(_0xd7f92a[_0x98f5('0x3a')]!==_0x98f5('0x3b')){var _0x3c403f={};_0x3c403f[_0xd7f92a[_0x98f5('0x28')]]={'$like':'%'+_0x349342[_0x98f5('0x33')][_0x98f5('0x3c')]+'%'};return _0x3c403f;}})});}_0x17be43=_['merge']({},_0x17be43,_0x349342[_0x98f5('0x3d')]);var _0x2bffe0={'where':_0x17be43[_0x98f5('0x38')]};return db[_0x98f5('0x2b')][_0x98f5('0x1d')](_0x2bffe0)[_0x98f5('0x23')](function(_0x2e4df7){_0x4d3dec['count']=_0x2e4df7;if(_0x349342[_0x98f5('0x33')][_0x98f5('0x3e')]){_0x17be43[_0x98f5('0x3f')]=[{'all':!![]}];}return db[_0x98f5('0x2b')][_0x98f5('0x40')](_0x17be43);})[_0x98f5('0x23')](function(_0x1fe931){_0x4d3dec[_0x98f5('0x41')]=_0x1fe931;return _0x4d3dec;})[_0x98f5('0x23')](respondWithFilteredResult(_0x3c1caf,_0x17be43))[_0x98f5('0x42')](handleError(_0x3c1caf,null));};exports[_0x98f5('0x43')]=function(_0x1d18ab,_0x10da3f){var _0x145811={'raw':!![],'where':{'id':_0x1d18ab[_0x98f5('0x44')]['id']}},_0x279ce5={};_0x279ce5[_0x98f5('0x2e')]=_[_0x98f5('0x30')](db[_0x98f5('0x2b')][_0x98f5('0x45')]);_0x279ce5[_0x98f5('0x33')]=_[_0x98f5('0x30')](_0x1d18ab[_0x98f5('0x33')]);_0x279ce5[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x279ce5[_0x98f5('0x2e')],_0x279ce5[_0x98f5('0x33')]);_0x145811[_0x98f5('0x34')]=_[_0x98f5('0x32')](_0x279ce5[_0x98f5('0x2e')],qs[_0x98f5('0x35')](_0x1d18ab[_0x98f5('0x33')][_0x98f5('0x35')]));_0x145811['attributes']=_0x145811['attributes'][_0x98f5('0x46')]?_0x145811['attributes']:_0x279ce5[_0x98f5('0x2e')];if(_0x1d18ab['query']['includeAll']){_0x145811['include']=[{'all':!![]}];}_0x145811=_['merge']({},_0x145811,_0x1d18ab[_0x98f5('0x3d')]);return db[_0x98f5('0x2b')][_0x98f5('0x47')](_0x145811)['then'](handleEntityNotFound(_0x10da3f,null))['then'](respondWithResult(_0x10da3f,null))['catch'](handleError(_0x10da3f,null));};exports['create']=function(_0x147214,_0x5849f2){return db[_0x98f5('0x2b')][_0x98f5('0x48')](_0x147214[_0x98f5('0x49')],{})[_0x98f5('0x23')](function(_0x460a7a){var _0x456eca=_0x147214[_0x98f5('0x4a')][_0x98f5('0x4b')]({'plain':!![]});if(!_0x456eca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x456eca[_0x98f5('0x4c')]==='user'){var _0x22f16d=_0x460a7a['get']({'plain':!![]});var _0x4a6b92=_0x98f5('0x24');return db[_0x98f5('0x4d')][_0x98f5('0x47')]({'where':{'name':_0x4a6b92,'userProfileId':_0x456eca[_0x98f5('0x4e')]},'raw':!![]})['then'](function(_0x5a2947){if(_0x5a2947&&_0x5a2947[_0x98f5('0x4f')]===0x0){return db[_0x98f5('0x25')]['create']({'name':_0x22f16d['name'],'resourceId':_0x22f16d['id'],'type':_0x5a2947['name'],'sectionId':_0x5a2947['id']},{})[_0x98f5('0x23')](function(){return _0x460a7a;});}else{return _0x460a7a;}})[_0x98f5('0x42')](function(_0x387507){logger[_0x98f5('0x26')](_0x98f5('0x50'),_0x387507);throw _0x387507;});}return _0x460a7a;})[_0x98f5('0x23')](respondWithResult(_0x5849f2,0xc9))[_0x98f5('0x42')](handleError(_0x5849f2,null));};exports[_0x98f5('0x22')]=function(_0x3f2f10,_0x24c8cc){if(_0x3f2f10[_0x98f5('0x49')]['id']){delete _0x3f2f10[_0x98f5('0x49')]['id'];}return db['Pause'][_0x98f5('0x47')]({'where':{'id':_0x3f2f10[_0x98f5('0x44')]['id']}})[_0x98f5('0x23')](handleEntityNotFound(_0x24c8cc,null))[_0x98f5('0x23')](saveUpdates(_0x3f2f10[_0x98f5('0x49')],null))[_0x98f5('0x23')](respondWithResult(_0x24c8cc,null))[_0x98f5('0x42')](handleError(_0x24c8cc,null));};exports[_0x98f5('0x51')]=function(_0x4de4d2,_0x412e0f){return db[_0x98f5('0x2b')][_0x98f5('0x47')]({'where':{'id':_0x4de4d2[_0x98f5('0x44')]['id']}})[_0x98f5('0x23')](handleEntityNotFound(_0x412e0f,null))[_0x98f5('0x23')](removeEntity(_0x412e0f,null))[_0x98f5('0x42')](handleError(_0x412e0f,null));}; \ No newline at end of file +var _0x1946=['intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','Pauses','UserProfileResource','error','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x1fad7b,_0x34bf4d){var _0x196182=function(_0x3cf1ae){while(--_0x3cf1ae){_0x1fad7b['push'](_0x1fad7b['shift']());}};_0x196182(++_0x34bf4d);}(_0x1946,0x126));var _0x6194=function(_0x1a116e,_0x14b063){_0x1a116e=_0x1a116e-0x0;var _0xb4dff8=_0x1946[_0x1a116e];return _0xb4dff8;};'use strict';var emlformat=require(_0x6194('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6194('0x1'));var jsonpatch=require(_0x6194('0x2'));var rp=require(_0x6194('0x3'));var moment=require('moment');var BPromise=require(_0x6194('0x4'));var Mustache=require('mustache');var util=require(_0x6194('0x5'));var path=require(_0x6194('0x6'));var sox=require(_0x6194('0x7'));var csv=require(_0x6194('0x8'));var ejs=require(_0x6194('0x9'));var fs=require('fs');var fs_extra=require(_0x6194('0xa'));var _=require(_0x6194('0xb'));var squel=require('squel');var crypto=require(_0x6194('0xc'));var jsforce=require(_0x6194('0xd'));var deskjs=require(_0x6194('0xe'));var toCsv=require(_0x6194('0x8'));var querystring=require('querystring');var Papa=require(_0x6194('0xf'));var Redis=require(_0x6194('0x10'));var authService=require(_0x6194('0x11'));var qs=require(_0x6194('0x12'));var as=require(_0x6194('0x13'));var hardwareService=require(_0x6194('0x14'));var logger=require(_0x6194('0x15'))(_0x6194('0x16'));var utils=require(_0x6194('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6194('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bbdb3,_0x19f743){_0x19f743=_0x19f743||0xcc;return function(_0x109b59){if(_0x109b59){return _0x1bbdb3[_0x6194('0x19')](_0x19f743);}return _0x1bbdb3['status'](_0x19f743)['end']();};}function respondWithResult(_0x2f2827,_0x4f0a93){_0x4f0a93=_0x4f0a93||0xc8;return function(_0x410c0a){if(_0x410c0a){return _0x2f2827[_0x6194('0x1a')](_0x4f0a93)['json'](_0x410c0a);}};}function respondWithFilteredResult(_0x319391,_0x9798f9){return function(_0x1189e2){if(_0x1189e2){var _0x15a176=typeof _0x9798f9[_0x6194('0x1b')]===_0x6194('0x1c')&&typeof _0x9798f9['limit']==='undefined';var _0x29240b=_0x1189e2[_0x6194('0x1d')];var _0x3072cd=_0x15a176?0x0:_0x9798f9[_0x6194('0x1b')];var _0x3ed85d=_0x15a176?_0x1189e2[_0x6194('0x1d')]:_0x9798f9['offset']+_0x9798f9[_0x6194('0x1e')];var _0x24fac1;if(_0x3ed85d>=_0x29240b){_0x3ed85d=_0x29240b;_0x24fac1=0xc8;}else{_0x24fac1=0xce;}_0x319391['status'](_0x24fac1);return _0x319391[_0x6194('0x1f')](_0x6194('0x20'),_0x3072cd+'-'+_0x3ed85d+'/'+_0x29240b)[_0x6194('0x21')](_0x1189e2);}return null;};}function patchUpdates(_0x3988b8){return function(_0x10ecf1){try{jsonpatch[_0x6194('0x22')](_0x10ecf1,_0x3988b8,!![]);}catch(_0x14c49c){return BPromise[_0x6194('0x23')](_0x14c49c);}return _0x10ecf1[_0x6194('0x24')]();};}function saveUpdates(_0x5edc4f,_0x417c1a){return function(_0x37b3dd){if(_0x37b3dd){return _0x37b3dd['update'](_0x5edc4f)[_0x6194('0x25')](function(_0x2fc6b4){return _0x2fc6b4;});}return null;};}function removeEntity(_0x3c441e,_0x82156b){return function(_0x51553e){if(_0x51553e){return _0x51553e[_0x6194('0x26')]()[_0x6194('0x25')](function(){var _0x589017=_0x51553e['get']({'plain':!![]});var _0x30b328=_0x6194('0x27');return db[_0x6194('0x28')]['destroy']({'where':{'type':_0x30b328,'resourceId':_0x589017['id']}})[_0x6194('0x25')](function(){return _0x51553e;});})['then'](function(){_0x3c441e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bd5f8,_0x935894){return function(_0x4fc7d0){if(!_0x4fc7d0){_0x1bd5f8[_0x6194('0x19')](0x194);}return _0x4fc7d0;};}function handleError(_0x540cbe,_0x17cd1d){_0x17cd1d=_0x17cd1d||0x1f4;return function(_0x3ce763){logger[_0x6194('0x29')](_0x3ce763['stack']);if(_0x3ce763[_0x6194('0x2a')]){delete _0x3ce763[_0x6194('0x2a')];}_0x540cbe[_0x6194('0x1a')](_0x17cd1d)[_0x6194('0x2b')](_0x3ce763);};}exports[_0x6194('0x2c')]=function(_0xfda905,_0x4834cf){var _0x4d46e8={},_0x5ac0d1={},_0xb87bd5={'count':0x0,'rows':[]};var _0x4523cf=_[_0x6194('0x2d')](db[_0x6194('0x2e')][_0x6194('0x2f')],function(_0x4ee027){return{'name':_0x4ee027[_0x6194('0x30')],'type':_0x4ee027[_0x6194('0x31')][_0x6194('0x32')]};});_0x5ac0d1['model']=_['map'](_0x4523cf,_0x6194('0x2a'));_0x5ac0d1[_0x6194('0x33')]=_[_0x6194('0x34')](_0xfda905[_0x6194('0x33')]);_0x5ac0d1[_0x6194('0x35')]=_[_0x6194('0x36')](_0x5ac0d1['model'],_0x5ac0d1[_0x6194('0x33')]);_0x4d46e8[_0x6194('0x37')]=_['intersection'](_0x5ac0d1[_0x6194('0x38')],qs[_0x6194('0x39')](_0xfda905[_0x6194('0x33')][_0x6194('0x39')]));_0x4d46e8[_0x6194('0x37')]=_0x4d46e8[_0x6194('0x37')][_0x6194('0x3a')]?_0x4d46e8[_0x6194('0x37')]:_0x5ac0d1['model'];if(!_0xfda905[_0x6194('0x33')][_0x6194('0x3b')]('nolimit')){_0x4d46e8[_0x6194('0x1e')]=qs['limit'](_0xfda905[_0x6194('0x33')][_0x6194('0x1e')]);_0x4d46e8['offset']=qs[_0x6194('0x1b')](_0xfda905[_0x6194('0x33')]['offset']);}_0x4d46e8[_0x6194('0x3c')]=qs[_0x6194('0x3d')](_0xfda905[_0x6194('0x33')][_0x6194('0x3d')]);_0x4d46e8['where']=qs[_0x6194('0x35')](_[_0x6194('0x3e')](_0xfda905[_0x6194('0x33')],_0x5ac0d1[_0x6194('0x35')]),_0x4523cf);if(_0xfda905[_0x6194('0x33')][_0x6194('0x3f')]){_0x4d46e8[_0x6194('0x40')]=_[_0x6194('0x41')](_0x4d46e8[_0x6194('0x40')],{'$or':_[_0x6194('0x2d')](_0x4523cf,function(_0x3f7008){if(_0x3f7008[_0x6194('0x31')]!==_0x6194('0x42')){var _0x33fa50={};_0x33fa50[_0x3f7008['name']]={'$like':'%'+_0xfda905['query']['filter']+'%'};return _0x33fa50;}})});}_0x4d46e8=_[_0x6194('0x41')]({},_0x4d46e8,_0xfda905[_0x6194('0x43')]);var _0x1fd880={'where':_0x4d46e8[_0x6194('0x40')]};return db['Pause'][_0x6194('0x1d')](_0x1fd880)[_0x6194('0x25')](function(_0x55152a){_0xb87bd5[_0x6194('0x1d')]=_0x55152a;if(_0xfda905[_0x6194('0x33')][_0x6194('0x44')]){_0x4d46e8[_0x6194('0x45')]=[{'all':!![]}];}return db['Pause'][_0x6194('0x46')](_0x4d46e8);})['then'](function(_0x2723a0){_0xb87bd5[_0x6194('0x47')]=_0x2723a0;return _0xb87bd5;})[_0x6194('0x25')](respondWithFilteredResult(_0x4834cf,_0x4d46e8))[_0x6194('0x48')](handleError(_0x4834cf,null));};exports[_0x6194('0x49')]=function(_0x26a0b2,_0x28a3a4){var _0x187058={'raw':!![],'where':{'id':_0x26a0b2[_0x6194('0x4a')]['id']}},_0x1623e5={};_0x1623e5['model']=_[_0x6194('0x34')](db[_0x6194('0x2e')]['rawAttributes']);_0x1623e5[_0x6194('0x33')]=_[_0x6194('0x34')](_0x26a0b2[_0x6194('0x33')]);_0x1623e5[_0x6194('0x35')]=_['intersection'](_0x1623e5[_0x6194('0x38')],_0x1623e5['query']);_0x187058['attributes']=_[_0x6194('0x36')](_0x1623e5[_0x6194('0x38')],qs[_0x6194('0x39')](_0x26a0b2['query'][_0x6194('0x39')]));_0x187058[_0x6194('0x37')]=_0x187058['attributes']['length']?_0x187058[_0x6194('0x37')]:_0x1623e5[_0x6194('0x38')];if(_0x26a0b2[_0x6194('0x33')][_0x6194('0x44')]){_0x187058[_0x6194('0x45')]=[{'all':!![]}];}_0x187058=_[_0x6194('0x41')]({},_0x187058,_0x26a0b2[_0x6194('0x43')]);return db[_0x6194('0x2e')][_0x6194('0x4b')](_0x187058)[_0x6194('0x25')](handleEntityNotFound(_0x28a3a4,null))[_0x6194('0x25')](respondWithResult(_0x28a3a4,null))[_0x6194('0x48')](handleError(_0x28a3a4,null));};exports['create']=function(_0x2a0a0f,_0x439d09){return db[_0x6194('0x2e')]['create'](_0x2a0a0f[_0x6194('0x4c')],{})['then'](function(_0x386ad5){var _0x14d63e=_0x2a0a0f[_0x6194('0x4d')]['get']({'plain':!![]});if(!_0x14d63e)throw new Error(_0x6194('0x4e'));if(_0x14d63e[_0x6194('0x4f')]===_0x6194('0x4d')){var _0x2b387=_0x386ad5[_0x6194('0x50')]({'plain':!![]});var _0x5c869d=_0x6194('0x27');return db[_0x6194('0x51')][_0x6194('0x4b')]({'where':{'name':_0x5c869d,'userProfileId':_0x14d63e[_0x6194('0x52')]},'raw':!![]})[_0x6194('0x25')](function(_0x419554){if(_0x419554&&_0x419554[_0x6194('0x53')]===0x0){return db['UserProfileResource'][_0x6194('0x54')]({'name':_0x2b387[_0x6194('0x2a')],'resourceId':_0x2b387['id'],'type':_0x419554['name'],'sectionId':_0x419554['id']},{})[_0x6194('0x25')](function(){return _0x386ad5;});}else{return _0x386ad5;}})[_0x6194('0x48')](function(_0x1f4dcc){logger[_0x6194('0x29')](_0x6194('0x55'),_0x1f4dcc);throw _0x1f4dcc;});}return _0x386ad5;})[_0x6194('0x25')](respondWithResult(_0x439d09,0xc9))['catch'](handleError(_0x439d09,null));};exports[_0x6194('0x56')]=function(_0x31c88d,_0x34f533){if(_0x31c88d[_0x6194('0x4c')]['id']){delete _0x31c88d[_0x6194('0x4c')]['id'];}return db[_0x6194('0x2e')][_0x6194('0x4b')]({'where':{'id':_0x31c88d[_0x6194('0x4a')]['id']}})['then'](handleEntityNotFound(_0x34f533,null))[_0x6194('0x25')](saveUpdates(_0x31c88d['body'],null))[_0x6194('0x25')](respondWithResult(_0x34f533,null))[_0x6194('0x48')](handleError(_0x34f533,null));};exports[_0x6194('0x26')]=function(_0x2d95ed,_0x17a13b){return db[_0x6194('0x2e')]['find']({'where':{'id':_0x2d95ed['params']['id']}})[_0x6194('0x25')](handleEntityNotFound(_0x17a13b,null))[_0x6194('0x25')](removeEntity(_0x17a13b,null))['catch'](handleError(_0x17a13b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index aac4df1..5fdd6ef 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0xa24c82,_0x2acb83){var _0x319b06=function(_0x3da78a){while(--_0x3da78a){_0xa24c82['push'](_0xa24c82['shift']());}};_0x319b06(++_0x2acb83);}(_0xe14b,0x93));var _0xbe14=function(_0x569c6a,_0x39c658){_0x569c6a=_0x569c6a-0x0;var _0x1883b1=_0xe14b[_0x569c6a];return _0x1883b1;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x137943,_0x3e1a20){var _0xa2bb31=function(_0x41b06a){while(--_0x41b06a){_0x137943['push'](_0x137943['shift']());}};_0xa2bb31(++_0x3e1a20);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1155ab,_0x36b1b4){_0x1155ab=_0x1155ab-0x0;var _0x34488b=_0x1cb9[_0x1155ab];return _0x34488b;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 04571b5..2139471 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(_0x5cc066,_0x462002){var _0x2f3292=function(_0x598b52){while(--_0x598b52){_0x5cc066['push'](_0x5cc066['shift']());}};_0x2f3292(++_0x462002);}(_0x7a54,0x106));var _0x47a5=function(_0x56f4db,_0x32105e){_0x56f4db=_0x56f4db-0x0;var _0x4c0012=_0x7a54[_0x56f4db];return _0x4c0012;};'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 _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x3a75cd,_0x54837f){var _0x24d532=function(_0x3a5d62){while(--_0x3a5d62){_0x3a75cd['push'](_0x3a75cd['shift']());}};_0x24d532(++_0x54837f);}(_0xb10b,0x12a));var _0xbb10=function(_0x196257,_0x256195){_0x196257=_0x196257-0x0;var _0x30d5c7=_0xb10b[_0x196257];return _0x30d5c7;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 3bf16b8..a343b17 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 _0x702d=['/:id/download','download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','post','single','upload','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/webhook','isAuthenticated','show'];(function(_0x193970,_0x4963b3){var _0x224a6f=function(_0x49c24a){while(--_0x49c24a){_0x193970['push'](_0x193970['shift']());}};_0x224a6f(++_0x4963b3);}(_0x702d,0x147));var _0xd702=function(_0x3af6b3,_0x54fd4c){_0x3af6b3=_0x3af6b3-0x0;var _0x17609e=_0x702d[_0x3af6b3];return _0x17609e;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./plugin.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),controller['webhookGet']);router[_0xd702('0x9')]('/:id',auth[_0xd702('0xc')](),controller[_0xd702('0xd')]);router[_0xd702('0x9')](_0xd702('0xe'),auth[_0xd702('0xc')](),controller[_0xd702('0xf')]);var upload=multer({'storage':multer[_0xd702('0x10')]({'destination':function(_0x1988eb,_0x5907cf,_0x15a632){_0x15a632(null,path['join'](config['root'],_0xd702('0x11')));},'filename':function(_0x42e1ad,_0x273577,_0x5c0dad){_0x273577[_0xd702('0x12')]=_0x273577[_0xd702('0x12')][_0xd702('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c0dad(null,util[_0xd702('0x14')](_0xd702('0x15'),path[_0xd702('0x16')](_0x273577['originalname'],path[_0xd702('0x17')](_0x273577[_0xd702('0x12')])),Date['now'](),path[_0xd702('0x17')](_0x273577['originalname'])));}})});router[_0xd702('0x18')]('/',upload[_0xd702('0x19')]('file'),controller[_0xd702('0x1a')]);router[_0xd702('0x18')](_0xd702('0xb'),controller['webhookPost']);router['put'](_0xd702('0x1b'),auth['isAuthenticated'](),controller[_0xd702('0x1c')]);router[_0xd702('0x1d')](_0xd702('0x1b'),auth[_0xd702('0xc')](),controller[_0xd702('0x1d')]);module[_0xd702('0x1e')]=router; \ No newline at end of file +var _0x0e85=['put','update','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','originalname','replace','format','%s-%s%s','extname','post','single','file','upload'];(function(_0x4fef8b,_0x4d1704){var _0x3a8d8b=function(_0x5d3d97){while(--_0x5d3d97){_0x4fef8b['push'](_0x4fef8b['shift']());}};_0x3a8d8b(++_0x4d1704);}(_0x0e85,0x7c));var _0x50e8=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x0e85[_0x19b3f9];return _0x18c3f6;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50e8('0x4'));var config=require('../../config/environment');var controller=require(_0x50e8('0x5'));router[_0x50e8('0x6')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0x8')]);router['get'](_0x50e8('0x9'),controller[_0x50e8('0xa')]);router[_0x50e8('0x6')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xc')]);router['get'](_0x50e8('0xd'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xe')]);var upload=multer({'storage':multer[_0x50e8('0xf')]({'destination':function(_0x154b9e,_0x194a89,_0x45dc6f){_0x45dc6f(null,path[_0x50e8('0x10')](config['root'],'server/files/plugins'));},'filename':function(_0xfc6bb9,_0x24d381,_0x508377){_0x24d381['originalname']=_0x24d381[_0x50e8('0x11')][_0x50e8('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x508377(null,util[_0x50e8('0x13')](_0x50e8('0x14'),path['basename'](_0x24d381[_0x50e8('0x11')],path[_0x50e8('0x15')](_0x24d381[_0x50e8('0x11')])),Date['now'](),path['extname'](_0x24d381[_0x50e8('0x11')])));}})});router[_0x50e8('0x16')]('/',upload[_0x50e8('0x17')](_0x50e8('0x18')),controller[_0x50e8('0x19')]);router[_0x50e8('0x16')]('/webhook',controller['webhookPost']);router[_0x50e8('0x1a')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0x1b')]);router[_0x50e8('0x1c')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller['delete']);module[_0x50e8('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 8d40773..0c17cb4 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 _0x6491=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly'];(function(_0x2170af,_0x4830f9){var _0x2c359c=function(_0x1bba2b){while(--_0x1bba2b){_0x2170af['push'](_0x2170af['shift']());}};_0x2c359c(++_0x4830f9);}(_0x6491,0x19b));var _0x1649=function(_0x55c522,_0x106733){_0x55c522=_0x55c522-0x0;var _0x44646e=_0x6491[_0x55c522];return _0x44646e;};'use strict';var Sequelize=require(_0x1649('0x0'));module['exports']={'name':{'type':Sequelize[_0x1649('0x1')]},'type':{'type':Sequelize[_0x1649('0x2')](_0x1649('0x3'),'script')},'description':{'type':Sequelize[_0x1649('0x4')]},'version':{'type':Sequelize[_0x1649('0x4')]},'path':{'type':Sequelize[_0x1649('0x1')],'comment':_0x1649('0x5')},'active':{'type':Sequelize[_0x1649('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x1649('0x2')](_0x1649('0x7'),_0x1649('0x8'),_0x1649('0x9'),_0x1649('0xa')),'defaultValue':_0x1649('0x9'),'comment':_0x1649('0xb')},'icon':{'type':Sequelize[_0x1649('0x1')]},'adminUrl':{'type':Sequelize[_0x1649('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x1649('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1e65=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','TEXT','STRING','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x1e65,0xed));var _0x51e6=function(_0x1e2e47,_0x3ecf1e){_0x1e2e47=_0x1e2e47-0x0;var _0x209d53=_0x1e65[_0x1e2e47];return _0x209d53;};'use strict';var Sequelize=require(_0x51e6('0x0'));module[_0x51e6('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x51e6('0x2')](_0x51e6('0x3'),_0x51e6('0x4'))},'description':{'type':Sequelize[_0x51e6('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x51e6('0x6')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x51e6('0x7')},'sidebar':{'type':Sequelize[_0x51e6('0x2')](_0x51e6('0x8'),_0x51e6('0x9'),_0x51e6('0xa'),_0x51e6('0xb')),'defaultValue':_0x51e6('0xa'),'comment':_0x51e6('0xc')},'icon':{'type':Sequelize[_0x51e6('0x6')]},'adminUrl':{'type':Sequelize[_0x51e6('0x6')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x51e6('0x6')]},'scriptPath':{'type':Sequelize[_0x51e6('0x6')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 3caf651..47295bc 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 _0x9d13=['code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','webhookGet','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','error','name','send','index','map','Plugin','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','findAll','catch','show','params','keys','rawAttributes','include','download','join','root','format','%s.zip','basename','createWriteStream','warning'];(function(_0x3edd44,_0x1fe4ff){var _0x51583b=function(_0x234db2){while(--_0x234db2){_0x3edd44['push'](_0x3edd44['shift']());}};_0x51583b(++_0x1fe4ff);}(_0x9d13,0xf8));var _0x39d1=function(_0x26a499,_0x3d14a9){_0x26a499=_0x26a499-0x0;var _0x111eff=_0x9d13[_0x26a499];return _0x111eff;};'use strict';var emlformat=require(_0x39d1('0x0'));var rimraf=require(_0x39d1('0x1'));var zipdir=require(_0x39d1('0x2'));var jsonpatch=require(_0x39d1('0x3'));var rp=require(_0x39d1('0x4'));var moment=require(_0x39d1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x39d1('0x6'));var path=require(_0x39d1('0x7'));var sox=require('sox');var csv=require(_0x39d1('0x8'));var ejs=require(_0x39d1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x39d1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x39d1('0xb'));var deskjs=require(_0x39d1('0xc'));var toCsv=require(_0x39d1('0x8'));var querystring=require('querystring');var Papa=require(_0x39d1('0xd'));var extract=require('extract-zip');var rimraf=require(_0x39d1('0x1'));var archiver=require(_0x39d1('0xe'));var Redis=require(_0x39d1('0xf'));var authService=require(_0x39d1('0x10'));var qs=require(_0x39d1('0x11'));var as=require(_0x39d1('0x12'));var hardwareService=require(_0x39d1('0x13'));var logger=require(_0x39d1('0x14'))(_0x39d1('0x15'));var utils=require('../../config/utils');var config=require(_0x39d1('0x16'));var licenseUtil=require(_0x39d1('0x17'));var db=require('../../mysqldb')['db'];config[_0x39d1('0x18')]=_[_0x39d1('0x19')](config[_0x39d1('0x18')],{'host':_0x39d1('0x1a'),'port':0x18eb});var socket=require(_0x39d1('0x1b'))(new Redis(config['redis']));require(_0x39d1('0x1c'))[_0x39d1('0x1d')](socket);function respondWithStatusCode(_0x238879,_0xa88175){_0xa88175=_0xa88175||0xcc;return function(_0x2b1254){if(_0x2b1254){return _0x238879[_0x39d1('0x1e')](_0xa88175);}return _0x238879[_0x39d1('0x1f')](_0xa88175)[_0x39d1('0x20')]();};}function respondWithResult(_0x416eda,_0x58f3be){_0x58f3be=_0x58f3be||0xc8;return function(_0x4916fd){if(_0x4916fd){return _0x416eda[_0x39d1('0x1f')](_0x58f3be)[_0x39d1('0x21')](_0x4916fd);}};}function respondWithFilteredResult(_0x49bf0b,_0x5cdefb){return function(_0x17a475){if(_0x17a475){var _0x539445=typeof _0x5cdefb[_0x39d1('0x22')]===_0x39d1('0x23')&&typeof _0x5cdefb['limit']==='undefined';var _0x42ce84=_0x17a475[_0x39d1('0x24')];var _0x352a27=_0x539445?0x0:_0x5cdefb[_0x39d1('0x22')];var _0x1a882d=_0x539445?_0x17a475[_0x39d1('0x24')]:_0x5cdefb[_0x39d1('0x22')]+_0x5cdefb[_0x39d1('0x25')];var _0x14fd77;if(_0x1a882d>=_0x42ce84){_0x1a882d=_0x42ce84;_0x14fd77=0xc8;}else{_0x14fd77=0xce;}_0x49bf0b[_0x39d1('0x1f')](_0x14fd77);return _0x49bf0b[_0x39d1('0x26')](_0x39d1('0x27'),_0x352a27+'-'+_0x1a882d+'/'+_0x42ce84)[_0x39d1('0x21')](_0x17a475);}return null;};}function patchUpdates(_0x240f4c){return function(_0x184f65){try{jsonpatch[_0x39d1('0x28')](_0x184f65,_0x240f4c,!![]);}catch(_0xd4200e){return BPromise[_0x39d1('0x29')](_0xd4200e);}return _0x184f65[_0x39d1('0x2a')]();};}function saveUpdates(_0x210cde,_0x32cd73){return function(_0x55a3b7){if(_0x55a3b7){return _0x55a3b7['update'](_0x210cde)[_0x39d1('0x2b')](function(_0x5c6e80){return _0x5c6e80;});}return null;};}function removeEntity(_0x52b039,_0x378ae9){return function(_0x5ae918){if(_0x5ae918){return _0x5ae918[_0x39d1('0x2c')]()['then'](function(){var _0x3cb503=_0x5ae918[_0x39d1('0x2d')]({'plain':!![]});var _0x4fd173=_0x39d1('0x2e');return db[_0x39d1('0x2f')][_0x39d1('0x2c')]({'where':{'type':_0x4fd173,'resourceId':_0x3cb503['id']}})['then'](function(){return _0x5ae918;});})[_0x39d1('0x2b')](function(){_0x52b039[_0x39d1('0x1f')](0xcc)[_0x39d1('0x20')]();});}};}function handleEntityNotFound(_0x5ea4d0,_0x45a787){return function(_0x31e971){if(!_0x31e971){_0x5ea4d0[_0x39d1('0x1e')](0x194);}return _0x31e971;};}function handleError(_0x28a7a,_0xe119ab){_0xe119ab=_0xe119ab||0x1f4;return function(_0xd5918f){logger[_0x39d1('0x30')](_0xd5918f['stack']);if(_0xd5918f['name']){delete _0xd5918f[_0x39d1('0x31')];}_0x28a7a[_0x39d1('0x1f')](_0xe119ab)[_0x39d1('0x32')](_0xd5918f);};}exports[_0x39d1('0x33')]=function(_0x5a220c,_0x4ab57e){var _0x78535a={},_0xe9dd8b={},_0x219227={'count':0x0,'rows':[]};var _0x5757b0=_[_0x39d1('0x34')](db[_0x39d1('0x35')]['rawAttributes'],function(_0xbf7d2d){return{'name':_0xbf7d2d[_0x39d1('0x36')],'type':_0xbf7d2d[_0x39d1('0x37')][_0x39d1('0x38')]};});_0xe9dd8b['model']=_[_0x39d1('0x34')](_0x5757b0,_0x39d1('0x31'));_0xe9dd8b[_0x39d1('0x39')]=_['keys'](_0x5a220c['query']);_0xe9dd8b[_0x39d1('0x3a')]=_['intersection'](_0xe9dd8b[_0x39d1('0x3b')],_0xe9dd8b[_0x39d1('0x39')]);_0x78535a['attributes']=_[_0x39d1('0x3c')](_0xe9dd8b['model'],qs[_0x39d1('0x3d')](_0x5a220c[_0x39d1('0x39')][_0x39d1('0x3d')]));_0x78535a['attributes']=_0x78535a[_0x39d1('0x3e')][_0x39d1('0x3f')]?_0x78535a['attributes']:_0xe9dd8b[_0x39d1('0x3b')];if(!_0x5a220c['query'][_0x39d1('0x40')](_0x39d1('0x41'))){_0x78535a[_0x39d1('0x25')]=qs['limit'](_0x5a220c[_0x39d1('0x39')]['limit']);_0x78535a[_0x39d1('0x22')]=qs[_0x39d1('0x22')](_0x5a220c[_0x39d1('0x39')][_0x39d1('0x22')]);}_0x78535a[_0x39d1('0x42')]=qs[_0x39d1('0x43')](_0x5a220c['query'][_0x39d1('0x43')]);_0x78535a['where']=qs[_0x39d1('0x3a')](_['pick'](_0x5a220c[_0x39d1('0x39')],_0xe9dd8b[_0x39d1('0x3a')]),_0x5757b0);if(_0x5a220c[_0x39d1('0x39')][_0x39d1('0x44')]){_0x78535a[_0x39d1('0x45')]=_[_0x39d1('0x46')](_0x78535a['where'],{'$or':_[_0x39d1('0x34')](_0x5757b0,function(_0x6c6eaa){if(_0x6c6eaa[_0x39d1('0x37')]!=='VIRTUAL'){var _0xc2aacf={};_0xc2aacf[_0x6c6eaa[_0x39d1('0x31')]]={'$like':'%'+_0x5a220c['query'][_0x39d1('0x44')]+'%'};return _0xc2aacf;}})});}_0x78535a=_[_0x39d1('0x46')]({},_0x78535a,_0x5a220c[_0x39d1('0x47')]);var _0x5aca47={'where':_0x78535a[_0x39d1('0x45')]};return db[_0x39d1('0x35')][_0x39d1('0x24')](_0x5aca47)[_0x39d1('0x2b')](function(_0x41b63f){_0x219227[_0x39d1('0x24')]=_0x41b63f;if(_0x5a220c[_0x39d1('0x39')][_0x39d1('0x48')]){_0x78535a['include']=[{'all':!![]}];}return db[_0x39d1('0x35')][_0x39d1('0x49')](_0x78535a);})['then'](function(_0xd0e8ef){_0x219227['rows']=_0xd0e8ef;return _0x219227;})['then'](respondWithFilteredResult(_0x4ab57e,_0x78535a))[_0x39d1('0x4a')](handleError(_0x4ab57e,null));};exports[_0x39d1('0x4b')]=function(_0x1676e2,_0x2877d4){var _0x3ea0e6={'raw':!![],'where':{'id':_0x1676e2[_0x39d1('0x4c')]['id']}},_0x57cbe2={};_0x57cbe2[_0x39d1('0x3b')]=_[_0x39d1('0x4d')](db[_0x39d1('0x35')][_0x39d1('0x4e')]);_0x57cbe2['query']=_[_0x39d1('0x4d')](_0x1676e2['query']);_0x57cbe2[_0x39d1('0x3a')]=_[_0x39d1('0x3c')](_0x57cbe2[_0x39d1('0x3b')],_0x57cbe2[_0x39d1('0x39')]);_0x3ea0e6[_0x39d1('0x3e')]=_[_0x39d1('0x3c')](_0x57cbe2[_0x39d1('0x3b')],qs['fields'](_0x1676e2['query'][_0x39d1('0x3d')]));_0x3ea0e6[_0x39d1('0x3e')]=_0x3ea0e6['attributes'][_0x39d1('0x3f')]?_0x3ea0e6[_0x39d1('0x3e')]:_0x57cbe2[_0x39d1('0x3b')];if(_0x1676e2[_0x39d1('0x39')][_0x39d1('0x48')]){_0x3ea0e6[_0x39d1('0x4f')]=[{'all':!![]}];}_0x3ea0e6=_['merge']({},_0x3ea0e6,_0x1676e2[_0x39d1('0x47')]);return db[_0x39d1('0x35')]['find'](_0x3ea0e6)[_0x39d1('0x2b')](handleEntityNotFound(_0x2877d4,null))['then'](respondWithResult(_0x2877d4,null))[_0x39d1('0x4a')](handleError(_0x2877d4,null));};exports[_0x39d1('0x50')]=function(_0x314525,_0x470bd5,_0x112840){return db[_0x39d1('0x35')]['find']({'where':{'id':_0x314525[_0x39d1('0x4c')]['id']},'attributes':[_0x39d1('0x31'),_0x39d1('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x470bd5,null))[_0x39d1('0x2b')](function(_0x295ec4){if(_0x295ec4){var _0x325d16=path[_0x39d1('0x51')](config[_0x39d1('0x52')],'server/files/plugins',util[_0x39d1('0x53')](_0x39d1('0x54'),path[_0x39d1('0x55')](_0x295ec4[_0x39d1('0x7')])));var _0x33ca82=fs[_0x39d1('0x56')](_0x325d16);var _0x45fbca=archiver('zip',{'zlib':{'level':0x9}});_0x45fbca['on'](_0x39d1('0x57'),function(_0x21286f){if(_0x21286f[_0x39d1('0x58')]==='ENOENT'){logger['error'](_0x21286f);}else{throw new db[(_0x39d1('0x59'))][(_0x39d1('0x5a'))](_0x39d1('0x5b'));}});_0x45fbca['on']('error',function(_0x4bad53){throw new db['Sequelize'][(_0x39d1('0x5a'))](_0x39d1('0x5b'));});_0x45fbca[_0x39d1('0x5c')](_0x33ca82);_0x45fbca[_0x39d1('0x5d')](_0x39d1('0x5e'),{'cwd':path['join'](config[_0x39d1('0x52')],_0x39d1('0x5f'),path[_0x39d1('0x60')](_0x295ec4[_0x39d1('0x7')])),'ignore':[path[_0x39d1('0x51')](path[_0x39d1('0x55')](_0x295ec4['path']),_0x39d1('0x61')),path[_0x39d1('0x51')](path['basename'](_0x295ec4[_0x39d1('0x7')]),_0x39d1('0x62'))],'nodir':!![]})['finalize']();_0x33ca82['on']('close',function(){if(!fs[_0x39d1('0x63')](_0x325d16)){throw new db[(_0x39d1('0x59'))]['Error'](_0x39d1('0x64'));}return _0x470bd5[_0x39d1('0x50')](_0x325d16,util['format'](_0x39d1('0x54'),path['basename'](_0x295ec4[_0x39d1('0x7')])),function(_0x298fa4){if(_0x298fa4){throw new db[(_0x39d1('0x59'))][(_0x39d1('0x5a'))](_0x39d1('0x65'));}fs['unlinkSync'](_0x325d16);logger[_0x39d1('0x66')](_0x39d1('0x67'));logger[_0x39d1('0x66')]('Temporary\x20file\x20removed');});});}return null;})[_0x39d1('0x4a')](handleError(_0x470bd5,null));};exports[_0x39d1('0x68')]=function(_0x506a59,_0x12a5eb,_0x256259){var _0x51dc9a=path[_0x39d1('0x55')](_0x506a59[_0x39d1('0x69')][_0x39d1('0x6a')],path[_0x39d1('0x6b')](_0x506a59[_0x39d1('0x69')][_0x39d1('0x6a')]));var _0x5534aa=path['join'](config[_0x39d1('0x52')],'server/files/plugins',_0x506a59[_0x39d1('0x69')][_0x39d1('0x6a')]);var _0x3e81b4=path['join'](config[_0x39d1('0x52')],'server/files/plugins',_0x51dc9a);logger[_0x39d1('0x66')]('Plugin\x20upload\x20filepath:\x20%s',_0x5534aa);logger['info'](_0x39d1('0x6c'),_0x3e81b4);try{fs[_0x39d1('0x6d')](_0x5534aa,parseInt('0777',0x8));extract(_0x5534aa,{'dir':_0x3e81b4},function(_0x1731d6){if(_0x1731d6){logger[_0x39d1('0x30')](_0x1731d6);handleError(_0x1731d6,!![]);};var _0x3cc053=fs[_0x39d1('0x6e')](_0x3e81b4);if(_0x3cc053[_0x39d1('0x3f')]>0x1){removeReferences(_0x5534aa,_0x3e81b4);logger['error'](_0x39d1('0x6f'));return _0x256259(new Error(_0x39d1('0x6f')));}var _0x463976=fs[_0x39d1('0x70')](path[_0x39d1('0x51')](_0x3e81b4,_0x3cc053[0x0]));if(_0x463976[_0x39d1('0x71')]()){removeReferences(_0x5534aa,_0x3e81b4);logger[_0x39d1('0x30')]('Invalid\x20plugin\x20structure');return _0x256259(new Error(_0x39d1('0x6f')));}if(_0x463976[_0x39d1('0x72')]()){var _0x426fbd=fs[_0x39d1('0x6e')](path[_0x39d1('0x51')](_0x3e81b4,_0x3cc053[0x0]));if(_0x426fbd[_0x39d1('0x3f')]===0x0){removeReferences(_0x5534aa,_0x3e81b4);logger['error'](_0x39d1('0x6f'));return _0x256259(new Error(_0x39d1('0x6f')));}var _0x12f28e=_0x426fbd[_0x39d1('0x73')](function(_0x346e53){return _0x346e53===_0x39d1('0x74');});if(!_0x12f28e){return _0x256259(new Error(_0x39d1('0x75')));}var _0x57ee30=fs[_0x39d1('0x76')](path[_0x39d1('0x51')](_0x3e81b4,_0x3cc053[0x0],'manifest.json'));var _0x40fa80=JSON['parse'](_0x57ee30);if(_0x39d1('0x23')==typeof _0x40fa80[_0x39d1('0x31')]){return _0x256259(new Error(_0x39d1('0x77')));}if(_0x39d1('0x23')==typeof _0x40fa80[_0x39d1('0x37')]){return _0x256259(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x39d1('0x23')==typeof _0x40fa80[_0x39d1('0x78')]){return _0x256259(new Error(_0x39d1('0x79')));}if('undefined'==typeof _0x40fa80['parameters']){return _0x256259(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x40fa80[_0x39d1('0x37')]===_0x39d1('0x7a')){if(_0x39d1('0x23')==typeof _0x40fa80['parameters'][_0x39d1('0x7b')]){return _0x256259(new Error(_0x39d1('0x7c')));}if(_0x39d1('0x23')==typeof _0x40fa80[_0x39d1('0x7d')][_0x39d1('0x7b')][_0x39d1('0x7e')]&&_0x39d1('0x23')==typeof _0x40fa80[_0x39d1('0x7d')]['views'][_0x39d1('0x7f')]){return _0x256259(new Error(_0x39d1('0x80')));}}else if(_0x40fa80[_0x39d1('0x37')]===_0x39d1('0x81')){if('undefined'==typeof _0x40fa80[_0x39d1('0x7d')][_0x39d1('0x82')]){return _0x256259(new Error(_0x39d1('0x83')));}if('undefined'==typeof _0x40fa80['parameters'][_0x39d1('0x84')]){return _0x256259(new Error(_0x39d1('0x85')));}}else{return _0x256259(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4edefe=_0x40fa80[_0x39d1('0x31')];var _0xb33c8=_0x40fa80['description'];var _0x16914f=_0x40fa80[_0x39d1('0x37')];var _0xcf924c=_0x40fa80[_0x39d1('0x86')]?_0x40fa80[_0x39d1('0x86')]:'always';var _0x44eb49=_0x40fa80[_0x39d1('0x87')]?_0x40fa80[_0x39d1('0x87')]:_0x39d1('0x88');var _0x430dd8='';var _0x60a1f7='';var _0x3db1ef='';var _0x3ed95c='';var _0x288d0e=_0x40fa80[_0x39d1('0x78')];if(_0x16914f===_0x39d1('0x7a')){if('undefined'!=typeof _0x40fa80['parameters'][_0x39d1('0x7b')][_0x39d1('0x7e')]){var _0x465e12=_0x40fa80['parameters'][_0x39d1('0x7b')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x39d1('0x89')](_0x465e12)){_0x430dd8=path[_0x39d1('0x51')](_0x39d1('0x8a'),_0x51dc9a,_0x3cc053[0x0],_0x465e12);}else{_0x430dd8=_0x465e12;}}else{logger[_0x39d1('0x66')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x39d1('0x23')!=typeof _0x40fa80[_0x39d1('0x7d')][_0x39d1('0x7b')][_0x39d1('0x7f')]){var _0x17869a=_0x40fa80[_0x39d1('0x7d')][_0x39d1('0x7b')][_0x39d1('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x39d1('0x89')](_0x17869a)){_0x60a1f7=path[_0x39d1('0x51')](_0x39d1('0x8a'),_0x51dc9a,_0x3cc053[0x0],_0x17869a);}else{_0x60a1f7=_0x17869a;}}else{logger[_0x39d1('0x66')](_0x39d1('0x8b'));}}else if(_0x16914f==='script'){_0x3db1ef=_0x40fa80[_0x39d1('0x7d')][_0x39d1('0x82')];_0x3ed95c=_0x40fa80[_0x39d1('0x7d')][_0x39d1('0x84')];if('undefined'!=typeof _0x40fa80[_0x39d1('0x7d')][_0x39d1('0x7b')]){if('undefined'!=typeof _0x40fa80['parameters'][_0x39d1('0x7b')][_0x39d1('0x7e')]){var _0x465e12=_0x40fa80['parameters']['views'][_0x39d1('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x39d1('0x89')](_0x465e12)){_0x430dd8=path[_0x39d1('0x51')](_0x39d1('0x8a'),_0x51dc9a,_0x3cc053[0x0],_0x465e12);}else{_0x430dd8=_0x465e12;}}if(_0x39d1('0x23')!=typeof _0x40fa80[_0x39d1('0x7d')][_0x39d1('0x7b')][_0x39d1('0x7f')]){var _0x17869a=_0x40fa80[_0x39d1('0x7d')][_0x39d1('0x7b')][_0x39d1('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x17869a)){_0x60a1f7=path[_0x39d1('0x51')](_0x39d1('0x8a'),_0x51dc9a,_0x3cc053[0x0],_0x17869a);}else{_0x60a1f7=_0x17869a;}}}}var _0x4a9272={'name':_0x4edefe,'description':_0xb33c8,'path':path['join'](_0x51dc9a,_0x3cc053[0x0]),'type':_0x16914f,'sidebar':_0xcf924c,'icon':_0x44eb49,'adminUrl':_0x430dd8,'agentUrl':_0x60a1f7,'scriptName':_0x3db1ef,'scriptPath':_0x3ed95c,'version':_0x288d0e};removeReferences(_0x5534aa,null);return db['Plugin']['create'](_0x4a9272)[_0x39d1('0x2b')](function(_0xc034a0){var _0x5eb4cd={'role':_0x506a59[_0x39d1('0x8c')][_0x39d1('0x8d')],'userProfileId':_0x506a59[_0x39d1('0x8c')]['userProfileId']};if(!_0x5eb4cd)throw new Error(_0x39d1('0x8e'));if(_0x5eb4cd['role']==='user'){var _0x3119ee=_0xc034a0[_0x39d1('0x2d')]({'plain':!![]});return db[_0x39d1('0x8f')][_0x39d1('0x90')]({'where':{'name':'Plugins','userProfileId':_0x5eb4cd[_0x39d1('0x91')]},'raw':!![]})[_0x39d1('0x2b')](function(_0x5be87b){if(_0x5be87b&&_0x5be87b[_0x39d1('0x92')]===0x0){return db['UserProfileResource'][_0x39d1('0x93')]({'name':_0x3119ee['name'],'resourceId':_0x3119ee['id'],'type':_0x5be87b['name'],'sectionId':_0x5be87b['id']},{})[_0x39d1('0x2b')](function(){return _0xc034a0;});}else{return _0xc034a0;}})['catch'](function(_0x333b6f){logger[_0x39d1('0x30')](_0x39d1('0x94'),_0x333b6f);throw _0x333b6f;});}return _0xc034a0;})['then'](respondWithResult(_0x12a5eb,null))[_0x39d1('0x4a')](handleError(_0x12a5eb,null));}});}catch(_0x56b902){_0x12a5eb[_0x39d1('0x1f')](0x1f4)['send'](_0x56b902);}};function removeReferences(_0x12ccf8,_0x180840){try{if(_0x12ccf8){fs[_0x39d1('0x95')](_0x12ccf8);logger[_0x39d1('0x66')](_0x39d1('0x96'));}if(_0x180840){rimraf(_0x180840,function(){});logger[_0x39d1('0x66')](_0x39d1('0x97'));}}catch(_0x4d4d85){logger[_0x39d1('0x30')](_0x4d4d85);}}exports[_0x39d1('0x98')]=function(_0x4852bc,_0x3af0ec,_0x3bcbac){return db[_0x39d1('0x35')]['find']({'where':{'id':_0x4852bc[_0x39d1('0x4c')]['id']}})[_0x39d1('0x2b')](handleEntityNotFound(_0x3af0ec,null))[_0x39d1('0x2b')](saveUpdates(_0x4852bc[_0x39d1('0x8c')],null))[_0x39d1('0x2b')](respondWithResult(_0x3af0ec,null))['catch'](handleError(_0x3af0ec,null));};exports['delete']=function(_0x164bb8,_0x3bbda3,_0x4a5f2d){return db[_0x39d1('0x35')][_0x39d1('0x90')]({'where':{'id':_0x164bb8['params']['id']}})[_0x39d1('0x2b')](function(_0x1bf7d1){if(_0x1bf7d1){return _0x1bf7d1[_0x39d1('0x2c')]();}})[_0x39d1('0x2b')](function(_0x3db037){rimraf(path[_0x39d1('0x51')](config['root'],_0x39d1('0x5f'),path[_0x39d1('0x60')](_0x3db037['path'])),function(){});return _0x3db037;})[_0x39d1('0x2b')](handleEntityNotFound(_0x3bbda3,null))[_0x39d1('0x2b')](respondWithStatusCode(_0x3bbda3,null))[_0x39d1('0x4a')](handleError(_0x3bbda3,null));};exports[_0x39d1('0x99')]=function(_0xbaac14,_0x21f1b6,_0x3fecf1){return BPromise[_0x39d1('0x9a')]()[_0x39d1('0x2b')](function(){if(!_0xbaac14[_0x39d1('0x39')][_0x39d1('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xbaac14['query']['port']){throw new Error(_0x39d1('0x9b'));}var _0xb43161=_0xbaac14[_0x39d1('0x39')][_0x39d1('0x9c')]?_0xbaac14[_0x39d1('0x39')][_0x39d1('0x9c')]+':'+_0xbaac14[_0x39d1('0x39')][_0x39d1('0x9d')]:_0x39d1('0x9e')+_0xbaac14[_0x39d1('0x39')][_0x39d1('0x9d')];var _0x4df6b1=_0xbaac14['query'][_0x39d1('0x21')]?_0xbaac14[_0x39d1('0x39')][_0x39d1('0x21')]:!![];var _0x2878db=_0xbaac14[_0x39d1('0x39')][_0x39d1('0x9f')]?_0xbaac14[_0x39d1('0x39')][_0x39d1('0x9f')]:null;var _0x2c2113={'method':_0xbaac14[_0x39d1('0xa0')],'uri':util[_0x39d1('0x53')]('%s%s',_0xb43161,_0xbaac14[_0x39d1('0x39')][_0x39d1('0x7')]),'json':_0x4df6b1,'resolveWithFullResponse':!![],'encoding':_0x2878db,'qs':_0xbaac14['query']};if(_0xbaac14[_0x39d1('0xa1')]){_0x2c2113['headers']=_0xbaac14['headers'];if(_0x2c2113[_0x39d1('0xa1')][_0x39d1('0xa2')]){delete _0x2c2113['headers'][_0x39d1('0xa2')];}}if(_0x2c2113[_0x39d1('0xa1')][_0x39d1('0xa3')]){delete _0x2c2113[_0x39d1('0xa1')][_0x39d1('0xa3')];}return rp(_0x2c2113);})[_0x39d1('0x2b')](function(_0x2f7b93){if(_0x2f7b93){_0x21f1b6[_0x39d1('0x26')](_0x2f7b93[_0x39d1('0xa1')]);logger[_0x39d1('0x66')](_0x2f7b93['body']);if(_[_0x39d1('0xa4')](_0xbaac14[_0x39d1('0x39')][_0x39d1('0x7')],_0x39d1('0x50'))&&_0x2f7b93[_0x39d1('0xa5')]==0x1f4){return _0x21f1b6[_0x39d1('0x1e')](_0x2f7b93[_0x39d1('0xa5')]);}else{return _0x21f1b6['status'](_0x2f7b93[_0x39d1('0xa5')])[_0x39d1('0x32')](_0x2f7b93['body']);}}else{return _0x21f1b6[_0x39d1('0x1e')](0xc8);}})[_0x39d1('0x4a')](handleError(_0x21f1b6,null));};exports[_0x39d1('0xa6')]=function(_0x2c4465,_0x2f9373,_0x363558){return BPromise[_0x39d1('0x9a')]()[_0x39d1('0x2b')](function(){if(!_0x2c4465[_0x39d1('0x39')][_0x39d1('0x7')]){throw new Error(_0x39d1('0xa7'));}if(!_0x2c4465['query'][_0x39d1('0x9d')]){throw new Error(_0x39d1('0x9b'));}var _0x14af7f=_0x2c4465[_0x39d1('0x39')][_0x39d1('0x9c')]?_0x2c4465[_0x39d1('0x39')][_0x39d1('0x9c')]+':'+_0x2c4465[_0x39d1('0x39')][_0x39d1('0x9d')]:_0x39d1('0x9e')+_0x2c4465['query'][_0x39d1('0x9d')];var _0x38cd5a=_0x2c4465[_0x39d1('0x39')][_0x39d1('0x21')]?_0x2c4465[_0x39d1('0x39')]['json']:!![];var _0x1f3901=_0x2c4465['query']['encoding']?_0x2c4465[_0x39d1('0x39')][_0x39d1('0x9f')]:null;var _0x492454={'method':_0x2c4465[_0x39d1('0xa0')],'uri':util[_0x39d1('0x53')]('%s%s',_0x14af7f,_0x2c4465[_0x39d1('0x39')][_0x39d1('0x7')]),'json':_0x38cd5a,'resolveWithFullResponse':!![],'encoding':_0x1f3901,'body':_0x2c4465[_0x39d1('0x8c')]};if(_0x2c4465['headers']){_0x492454['headers']=_0x2c4465[_0x39d1('0xa1')];if(_0x492454[_0x39d1('0xa1')][_0x39d1('0xa2')]){delete _0x492454[_0x39d1('0xa1')][_0x39d1('0xa2')];}}if(_0x492454['headers'][_0x39d1('0xa3')]){delete _0x492454[_0x39d1('0xa1')]['content-type'];}return rp(_0x492454);})[_0x39d1('0x2b')](function(_0x341a30){if(_0x341a30){_0x2f9373['set'](_0x341a30['headers']);logger[_0x39d1('0x66')](_0x341a30[_0x39d1('0x8c')]);return _0x2f9373['status'](_0x341a30[_0x39d1('0xa5')])['send'](_0x341a30[_0x39d1('0x8c')]);}else{return _0x2f9373['sendStatus'](0xc8);}})[_0x39d1('0x4a')](handleError(_0x2f9373,null));}; \ No newline at end of file +var _0x584e=['scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','version','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','status','json','offset','undefined','limit','set','Content-Range','apply','update','then','destroy','get','Plugins','UserProfileResource','end','sendStatus','error','name','Plugin','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','map','VIRTUAL','merge','options','count','includeAll','include','rows','show','find','catch','params','join','server/files/plugins','format','%s.zip','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','root','dirname','node_modules/**/*','basename','finalize','close','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','isFile','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script'];(function(_0x594fa3,_0x1902eb){var _0x2bb77b=function(_0x30098d){while(--_0x30098d){_0x594fa3['push'](_0x594fa3['shift']());}};_0x2bb77b(++_0x1902eb);}(_0x584e,0xc6));var _0xe584=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x584e[_0x3b1b23];return _0x1efc85;};'use strict';var emlformat=require(_0xe584('0x0'));var rimraf=require(_0xe584('0x1'));var zipdir=require(_0xe584('0x2'));var jsonpatch=require(_0xe584('0x3'));var rp=require(_0xe584('0x4'));var moment=require(_0xe584('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe584('0x6'));var path=require(_0xe584('0x7'));var sox=require(_0xe584('0x8'));var csv=require(_0xe584('0x9'));var ejs=require(_0xe584('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe584('0xb'));var squel=require(_0xe584('0xc'));var crypto=require(_0xe584('0xd'));var jsforce=require(_0xe584('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe584('0x9'));var querystring=require(_0xe584('0xf'));var Papa=require(_0xe584('0x10'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0xe584('0x11'));var Redis=require(_0xe584('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe584('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe584('0x14'));var logger=require(_0xe584('0x15'))(_0xe584('0x16'));var utils=require(_0xe584('0x17'));var config=require(_0xe584('0x18'));var licenseUtil=require(_0xe584('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe584('0x1a')](config[_0xe584('0x1b')],{'host':_0xe584('0x1c'),'port':0x18eb});var socket=require(_0xe584('0x1d'))(new Redis(config[_0xe584('0x1b')]));require(_0xe584('0x1e'))[_0xe584('0x1f')](socket);function respondWithStatusCode(_0x430ac1,_0x23ad7){_0x23ad7=_0x23ad7||0xcc;return function(_0x19c524){if(_0x19c524){return _0x430ac1['sendStatus'](_0x23ad7);}return _0x430ac1[_0xe584('0x20')](_0x23ad7)['end']();};}function respondWithResult(_0x5046ca,_0x271ae5){_0x271ae5=_0x271ae5||0xc8;return function(_0xd4d397){if(_0xd4d397){return _0x5046ca[_0xe584('0x20')](_0x271ae5)[_0xe584('0x21')](_0xd4d397);}};}function respondWithFilteredResult(_0x3ddad0,_0x35b4d6){return function(_0x3ad232){if(_0x3ad232){var _0xa2e8c2=typeof _0x35b4d6[_0xe584('0x22')]===_0xe584('0x23')&&typeof _0x35b4d6[_0xe584('0x24')]===_0xe584('0x23');var _0x6e6a6c=_0x3ad232['count'];var _0x2b68a3=_0xa2e8c2?0x0:_0x35b4d6['offset'];var _0x2fa81b=_0xa2e8c2?_0x3ad232['count']:_0x35b4d6[_0xe584('0x22')]+_0x35b4d6[_0xe584('0x24')];var _0x487b26;if(_0x2fa81b>=_0x6e6a6c){_0x2fa81b=_0x6e6a6c;_0x487b26=0xc8;}else{_0x487b26=0xce;}_0x3ddad0[_0xe584('0x20')](_0x487b26);return _0x3ddad0[_0xe584('0x25')](_0xe584('0x26'),_0x2b68a3+'-'+_0x2fa81b+'/'+_0x6e6a6c)[_0xe584('0x21')](_0x3ad232);}return null;};}function patchUpdates(_0x4ae2b2){return function(_0x52c498){try{jsonpatch[_0xe584('0x27')](_0x52c498,_0x4ae2b2,!![]);}catch(_0x1e5fe6){return BPromise['reject'](_0x1e5fe6);}return _0x52c498['save']();};}function saveUpdates(_0x38fbad,_0x49af44){return function(_0x53763e){if(_0x53763e){return _0x53763e[_0xe584('0x28')](_0x38fbad)[_0xe584('0x29')](function(_0x9a7e8a){return _0x9a7e8a;});}return null;};}function removeEntity(_0x261c21,_0x2ba4ec){return function(_0x2569f3){if(_0x2569f3){return _0x2569f3[_0xe584('0x2a')]()['then'](function(){var _0x44d9ef=_0x2569f3[_0xe584('0x2b')]({'plain':!![]});var _0xc3c1dd=_0xe584('0x2c');return db[_0xe584('0x2d')]['destroy']({'where':{'type':_0xc3c1dd,'resourceId':_0x44d9ef['id']}})[_0xe584('0x29')](function(){return _0x2569f3;});})[_0xe584('0x29')](function(){_0x261c21[_0xe584('0x20')](0xcc)[_0xe584('0x2e')]();});}};}function handleEntityNotFound(_0x3dceae,_0x132fcf){return function(_0x3e7399){if(!_0x3e7399){_0x3dceae[_0xe584('0x2f')](0x194);}return _0x3e7399;};}function handleError(_0x51b96f,_0x2721bb){_0x2721bb=_0x2721bb||0x1f4;return function(_0x45e72f){logger[_0xe584('0x30')](_0x45e72f['stack']);if(_0x45e72f[_0xe584('0x31')]){delete _0x45e72f[_0xe584('0x31')];}_0x51b96f[_0xe584('0x20')](_0x2721bb)['send'](_0x45e72f);};}exports['index']=function(_0x5a5631,_0x286400){var _0x275575={},_0x4d5c75={},_0x103eb4={'count':0x0,'rows':[]};var _0x1fc0a4=_['map'](db[_0xe584('0x32')][_0xe584('0x33')],function(_0x492003){return{'name':_0x492003[_0xe584('0x34')],'type':_0x492003[_0xe584('0x35')][_0xe584('0x36')]};});_0x4d5c75['model']=_['map'](_0x1fc0a4,_0xe584('0x31'));_0x4d5c75[_0xe584('0x37')]=_[_0xe584('0x38')](_0x5a5631[_0xe584('0x37')]);_0x4d5c75[_0xe584('0x39')]=_[_0xe584('0x3a')](_0x4d5c75['model'],_0x4d5c75['query']);_0x275575[_0xe584('0x3b')]=_[_0xe584('0x3a')](_0x4d5c75[_0xe584('0x3c')],qs['fields'](_0x5a5631[_0xe584('0x37')][_0xe584('0x3d')]));_0x275575[_0xe584('0x3b')]=_0x275575['attributes'][_0xe584('0x3e')]?_0x275575[_0xe584('0x3b')]:_0x4d5c75['model'];if(!_0x5a5631[_0xe584('0x37')]['hasOwnProperty'](_0xe584('0x3f'))){_0x275575[_0xe584('0x24')]=qs[_0xe584('0x24')](_0x5a5631['query']['limit']);_0x275575[_0xe584('0x22')]=qs[_0xe584('0x22')](_0x5a5631['query']['offset']);}_0x275575['order']=qs[_0xe584('0x40')](_0x5a5631[_0xe584('0x37')]['sort']);_0x275575[_0xe584('0x41')]=qs['filters'](_[_0xe584('0x42')](_0x5a5631[_0xe584('0x37')],_0x4d5c75[_0xe584('0x39')]),_0x1fc0a4);if(_0x5a5631[_0xe584('0x37')]['filter']){_0x275575[_0xe584('0x41')]=_['merge'](_0x275575[_0xe584('0x41')],{'$or':_[_0xe584('0x43')](_0x1fc0a4,function(_0x21642a){if(_0x21642a[_0xe584('0x35')]!==_0xe584('0x44')){var _0x5a6619={};_0x5a6619[_0x21642a['name']]={'$like':'%'+_0x5a5631[_0xe584('0x37')]['filter']+'%'};return _0x5a6619;}})});}_0x275575=_[_0xe584('0x45')]({},_0x275575,_0x5a5631[_0xe584('0x46')]);var _0x33ac2a={'where':_0x275575['where']};return db['Plugin'][_0xe584('0x47')](_0x33ac2a)[_0xe584('0x29')](function(_0x195a46){_0x103eb4[_0xe584('0x47')]=_0x195a46;if(_0x5a5631[_0xe584('0x37')][_0xe584('0x48')]){_0x275575[_0xe584('0x49')]=[{'all':!![]}];}return db[_0xe584('0x32')]['findAll'](_0x275575);})[_0xe584('0x29')](function(_0x121635){_0x103eb4[_0xe584('0x4a')]=_0x121635;return _0x103eb4;})[_0xe584('0x29')](respondWithFilteredResult(_0x286400,_0x275575))['catch'](handleError(_0x286400,null));};exports[_0xe584('0x4b')]=function(_0x208838,_0x12c62b){var _0x13df2b={'raw':!![],'where':{'id':_0x208838['params']['id']}},_0x4277c9={};_0x4277c9['model']=_[_0xe584('0x38')](db[_0xe584('0x32')][_0xe584('0x33')]);_0x4277c9[_0xe584('0x37')]=_['keys'](_0x208838[_0xe584('0x37')]);_0x4277c9[_0xe584('0x39')]=_['intersection'](_0x4277c9['model'],_0x4277c9[_0xe584('0x37')]);_0x13df2b[_0xe584('0x3b')]=_['intersection'](_0x4277c9[_0xe584('0x3c')],qs['fields'](_0x208838['query']['fields']));_0x13df2b['attributes']=_0x13df2b[_0xe584('0x3b')][_0xe584('0x3e')]?_0x13df2b[_0xe584('0x3b')]:_0x4277c9[_0xe584('0x3c')];if(_0x208838[_0xe584('0x37')][_0xe584('0x48')]){_0x13df2b[_0xe584('0x49')]=[{'all':!![]}];}_0x13df2b=_['merge']({},_0x13df2b,_0x208838['options']);return db['Plugin'][_0xe584('0x4c')](_0x13df2b)['then'](handleEntityNotFound(_0x12c62b,null))[_0xe584('0x29')](respondWithResult(_0x12c62b,null))[_0xe584('0x4d')](handleError(_0x12c62b,null));};exports['download']=function(_0x1a5191,_0x26eb52,_0x1f57b0){return db[_0xe584('0x32')][_0xe584('0x4c')]({'where':{'id':_0x1a5191[_0xe584('0x4e')]['id']},'attributes':[_0xe584('0x31'),_0xe584('0x7')],'raw':!![]})[_0xe584('0x29')](handleEntityNotFound(_0x26eb52,null))[_0xe584('0x29')](function(_0x434839){if(_0x434839){var _0x1e94b5=path[_0xe584('0x4f')](config['root'],_0xe584('0x50'),util[_0xe584('0x51')](_0xe584('0x52'),path['basename'](_0x434839[_0xe584('0x7')])));var _0xcf48f0=fs['createWriteStream'](_0x1e94b5);var _0x5c1abb=archiver(_0xe584('0x53'),{'zlib':{'level':0x9}});_0x5c1abb['on'](_0xe584('0x54'),function(_0x5096a5){if(_0x5096a5[_0xe584('0x55')]===_0xe584('0x56')){logger['error'](_0x5096a5);}else{throw new db[(_0xe584('0x57'))][(_0xe584('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x5c1abb['on'](_0xe584('0x30'),function(_0x4d787b){throw new db['Sequelize'][(_0xe584('0x58'))](_0xe584('0x59'));});_0x5c1abb[_0xe584('0x5a')](_0xcf48f0);_0x5c1abb['glob']('**/*',{'cwd':path[_0xe584('0x4f')](config[_0xe584('0x5b')],_0xe584('0x50'),path[_0xe584('0x5c')](_0x434839[_0xe584('0x7')])),'ignore':[path['join'](path['basename'](_0x434839[_0xe584('0x7')]),_0xe584('0x5d')),path['join'](path[_0xe584('0x5e')](_0x434839['path']),'attachments/**/*')],'nodir':!![]})[_0xe584('0x5f')]();_0xcf48f0['on'](_0xe584('0x60'),function(){if(!fs['existsSync'](_0x1e94b5)){throw new db['Sequelize'][(_0xe584('0x58'))](_0xe584('0x61'));}return _0x26eb52[_0xe584('0x62')](_0x1e94b5,util[_0xe584('0x51')](_0xe584('0x52'),path[_0xe584('0x5e')](_0x434839['path'])),function(_0x2e6a77){if(_0x2e6a77){throw new db[(_0xe584('0x57'))][(_0xe584('0x58'))](_0xe584('0x63'));}fs[_0xe584('0x64')](_0x1e94b5);logger[_0xe584('0x65')](_0xe584('0x66'));logger[_0xe584('0x65')](_0xe584('0x67'));});});}return null;})[_0xe584('0x4d')](handleError(_0x26eb52,null));};exports[_0xe584('0x68')]=function(_0x2f7619,_0x2de1c3,_0x41b78e){var _0x58472e=path[_0xe584('0x5e')](_0x2f7619['file'][_0xe584('0x69')],path[_0xe584('0x6a')](_0x2f7619[_0xe584('0x6b')]['filename']));var _0x22a4af=path[_0xe584('0x4f')](config[_0xe584('0x5b')],'server/files/plugins',_0x2f7619[_0xe584('0x6b')][_0xe584('0x69')]);var _0x49393d=path[_0xe584('0x4f')](config[_0xe584('0x5b')],'server/files/plugins',_0x58472e);logger[_0xe584('0x65')]('Plugin\x20upload\x20filepath:\x20%s',_0x22a4af);logger['info'](_0xe584('0x6c'),_0x49393d);try{fs['chmodSync'](_0x22a4af,parseInt('0777',0x8));extract(_0x22a4af,{'dir':_0x49393d},function(_0x4e99df){if(_0x4e99df){logger[_0xe584('0x30')](_0x4e99df);handleError(_0x4e99df,!![]);};var _0xb0970e=fs[_0xe584('0x6d')](_0x49393d);if(_0xb0970e[_0xe584('0x3e')]>0x1){removeReferences(_0x22a4af,_0x49393d);logger['error'](_0xe584('0x6e'));return _0x41b78e(new Error('Invalid\x20plugin\x20structure'));}var _0x1e321e=fs['lstatSync'](path[_0xe584('0x4f')](_0x49393d,_0xb0970e[0x0]));if(_0x1e321e[_0xe584('0x6f')]()){removeReferences(_0x22a4af,_0x49393d);logger['error']('Invalid\x20plugin\x20structure');return _0x41b78e(new Error(_0xe584('0x6e')));}if(_0x1e321e['isDirectory']()){var _0x438bc3=fs[_0xe584('0x6d')](path[_0xe584('0x4f')](_0x49393d,_0xb0970e[0x0]));if(_0x438bc3['length']===0x0){removeReferences(_0x22a4af,_0x49393d);logger[_0xe584('0x30')](_0xe584('0x6e'));return _0x41b78e(new Error(_0xe584('0x6e')));}var _0x512ede=_0x438bc3['some'](function(_0x108554){return _0x108554===_0xe584('0x70');});if(!_0x512ede){return _0x41b78e(new Error(_0xe584('0x71')));}var _0x29ea28=fs['readFileSync'](path[_0xe584('0x4f')](_0x49393d,_0xb0970e[0x0],_0xe584('0x70')));var _0x68621e=JSON[_0xe584('0x72')](_0x29ea28);if(_0xe584('0x23')==typeof _0x68621e[_0xe584('0x31')]){return _0x41b78e(new Error(_0xe584('0x73')));}if(_0xe584('0x23')==typeof _0x68621e['type']){return _0x41b78e(new Error(_0xe584('0x74')));}if('undefined'==typeof _0x68621e['version']){return _0x41b78e(new Error(_0xe584('0x75')));}if('undefined'==typeof _0x68621e['parameters']){return _0x41b78e(new Error(_0xe584('0x76')));}if(_0x68621e[_0xe584('0x35')]===_0xe584('0x77')){if(_0xe584('0x23')==typeof _0x68621e[_0xe584('0x78')][_0xe584('0x79')]){return _0x41b78e(new Error(_0xe584('0x7a')));}if(_0xe584('0x23')==typeof _0x68621e[_0xe584('0x78')][_0xe584('0x79')][_0xe584('0x7b')]&&_0xe584('0x23')==typeof _0x68621e[_0xe584('0x78')][_0xe584('0x79')]['agent']){return _0x41b78e(new Error(_0xe584('0x7c')));}}else if(_0x68621e[_0xe584('0x35')]===_0xe584('0x7d')){if(_0xe584('0x23')==typeof _0x68621e['parameters'][_0xe584('0x7e')]){return _0x41b78e(new Error(_0xe584('0x7f')));}if(_0xe584('0x23')==typeof _0x68621e[_0xe584('0x78')][_0xe584('0x80')]){return _0x41b78e(new Error(_0xe584('0x81')));}}else{return _0x41b78e(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4827d1=_0x68621e[_0xe584('0x31')];var _0x47c138=_0x68621e[_0xe584('0x82')];var _0x37443c=_0x68621e['type'];var _0x5705dc=_0x68621e[_0xe584('0x83')]?_0x68621e[_0xe584('0x83')]:'always';var _0x3b9d32=_0x68621e[_0xe584('0x84')]?_0x68621e[_0xe584('0x84')]:'icon-apps';var _0x2c93bd='';var _0xd72998='';var _0x4ab559='';var _0x5239b2='';var _0x13b2d4=_0x68621e[_0xe584('0x85')];if(_0x37443c===_0xe584('0x77')){if(_0xe584('0x23')!=typeof _0x68621e[_0xe584('0x78')][_0xe584('0x79')][_0xe584('0x7b')]){var _0xb78d73=_0x68621e[_0xe584('0x78')]['views'][_0xe584('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xe584('0x86')](_0xb78d73)){_0x2c93bd=path[_0xe584('0x4f')]('plugins',_0x58472e,_0xb0970e[0x0],_0xb78d73);}else{_0x2c93bd=_0xb78d73;}}else{logger[_0xe584('0x65')](_0xe584('0x87'));}if(_0xe584('0x23')!=typeof _0x68621e[_0xe584('0x78')][_0xe584('0x79')][_0xe584('0x88')]){var _0x123109=_0x68621e[_0xe584('0x78')][_0xe584('0x79')][_0xe584('0x88')];if(!/^(f|ht)tps?:\/\//i['test'](_0x123109)){_0xd72998=path['join'](_0xe584('0x89'),_0x58472e,_0xb0970e[0x0],_0x123109);}else{_0xd72998=_0x123109;}}else{logger[_0xe584('0x65')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x37443c===_0xe584('0x7d')){_0x4ab559=_0x68621e['parameters'][_0xe584('0x7e')];_0x5239b2=_0x68621e[_0xe584('0x78')][_0xe584('0x80')];if(_0xe584('0x23')!=typeof _0x68621e[_0xe584('0x78')]['views']){if(_0xe584('0x23')!=typeof _0x68621e[_0xe584('0x78')]['views'][_0xe584('0x7b')]){var _0xb78d73=_0x68621e[_0xe584('0x78')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xe584('0x86')](_0xb78d73)){_0x2c93bd=path['join'](_0xe584('0x89'),_0x58472e,_0xb0970e[0x0],_0xb78d73);}else{_0x2c93bd=_0xb78d73;}}if(_0xe584('0x23')!=typeof _0x68621e[_0xe584('0x78')][_0xe584('0x79')][_0xe584('0x88')]){var _0x123109=_0x68621e[_0xe584('0x78')][_0xe584('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x123109)){_0xd72998=path[_0xe584('0x4f')](_0xe584('0x89'),_0x58472e,_0xb0970e[0x0],_0x123109);}else{_0xd72998=_0x123109;}}}}var _0x481d3f={'name':_0x4827d1,'description':_0x47c138,'path':path['join'](_0x58472e,_0xb0970e[0x0]),'type':_0x37443c,'sidebar':_0x5705dc,'icon':_0x3b9d32,'adminUrl':_0x2c93bd,'agentUrl':_0xd72998,'scriptName':_0x4ab559,'scriptPath':_0x5239b2,'version':_0x13b2d4};removeReferences(_0x22a4af,null);return db[_0xe584('0x32')][_0xe584('0x8a')](_0x481d3f)[_0xe584('0x29')](function(_0x1caf98){var _0x239dc1={'role':_0x2f7619['body'][_0xe584('0x8b')],'userProfileId':_0x2f7619[_0xe584('0x8c')][_0xe584('0x8d')]};if(!_0x239dc1)throw new Error(_0xe584('0x8e'));if(_0x239dc1['role']===_0xe584('0x8f')){var _0x2dca47=_0x1caf98[_0xe584('0x2b')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xe584('0x2c'),'userProfileId':_0x239dc1[_0xe584('0x8d')]},'raw':!![]})['then'](function(_0x15ad5a){if(_0x15ad5a&&_0x15ad5a['autoAssociation']===0x0){return db[_0xe584('0x2d')][_0xe584('0x8a')]({'name':_0x2dca47[_0xe584('0x31')],'resourceId':_0x2dca47['id'],'type':_0x15ad5a[_0xe584('0x31')],'sectionId':_0x15ad5a['id']},{})[_0xe584('0x29')](function(){return _0x1caf98;});}else{return _0x1caf98;}})[_0xe584('0x4d')](function(_0xb03c1c){logger[_0xe584('0x30')](_0xe584('0x90'),_0xb03c1c);throw _0xb03c1c;});}return _0x1caf98;})[_0xe584('0x29')](respondWithResult(_0x2de1c3,null))['catch'](handleError(_0x2de1c3,null));}});}catch(_0x42e3a8){_0x2de1c3[_0xe584('0x20')](0x1f4)['send'](_0x42e3a8);}};function removeReferences(_0x4bd0eb,_0x4ca8d1){try{if(_0x4bd0eb){fs[_0xe584('0x64')](_0x4bd0eb);logger[_0xe584('0x65')](_0xe584('0x91'));}if(_0x4ca8d1){rimraf(_0x4ca8d1,function(){});logger[_0xe584('0x65')](_0xe584('0x92'));}}catch(_0x141900){logger['error'](_0x141900);}}exports['update']=function(_0x408613,_0x294fa3,_0x3a0e52){return db['Plugin']['find']({'where':{'id':_0x408613['params']['id']}})[_0xe584('0x29')](handleEntityNotFound(_0x294fa3,null))[_0xe584('0x29')](saveUpdates(_0x408613[_0xe584('0x8c')],null))[_0xe584('0x29')](respondWithResult(_0x294fa3,null))[_0xe584('0x4d')](handleError(_0x294fa3,null));};exports['delete']=function(_0x1c24b4,_0x288f37,_0x3376cb){return db['Plugin'][_0xe584('0x4c')]({'where':{'id':_0x1c24b4['params']['id']}})['then'](function(_0x729db1){if(_0x729db1){return _0x729db1[_0xe584('0x2a')]();}})[_0xe584('0x29')](function(_0x1c116a){rimraf(path[_0xe584('0x4f')](config[_0xe584('0x5b')],'server/files/plugins',path[_0xe584('0x5c')](_0x1c116a[_0xe584('0x7')])),function(){});return _0x1c116a;})[_0xe584('0x29')](handleEntityNotFound(_0x288f37,null))[_0xe584('0x29')](respondWithStatusCode(_0x288f37,null))[_0xe584('0x4d')](handleError(_0x288f37,null));};exports[_0xe584('0x93')]=function(_0x485439,_0x1847a8,_0x272b26){return BPromise['resolve']()[_0xe584('0x29')](function(){if(!_0x485439[_0xe584('0x37')][_0xe584('0x7')]){throw new Error(_0xe584('0x94'));}if(!_0x485439[_0xe584('0x37')][_0xe584('0x95')]){throw new Error(_0xe584('0x96'));}var _0x198256=_0x485439[_0xe584('0x37')][_0xe584('0x97')]?_0x485439['query']['hostname']+':'+_0x485439[_0xe584('0x37')][_0xe584('0x95')]:_0xe584('0x98')+_0x485439[_0xe584('0x37')][_0xe584('0x95')];var _0xfc07eb=_0x485439[_0xe584('0x37')][_0xe584('0x21')]?_0x485439['query'][_0xe584('0x21')]:!![];var _0x42c0c1=_0x485439[_0xe584('0x37')][_0xe584('0x99')]?_0x485439[_0xe584('0x37')]['encoding']:null;var _0x62d389={'method':_0x485439[_0xe584('0x9a')],'uri':util[_0xe584('0x51')](_0xe584('0x9b'),_0x198256,_0x485439[_0xe584('0x37')][_0xe584('0x7')]),'json':_0xfc07eb,'resolveWithFullResponse':!![],'encoding':_0x42c0c1,'qs':_0x485439[_0xe584('0x37')]};if(_0x485439[_0xe584('0x9c')]){_0x62d389[_0xe584('0x9c')]=_0x485439[_0xe584('0x9c')];if(_0x62d389[_0xe584('0x9c')][_0xe584('0x9d')]){delete _0x62d389[_0xe584('0x9c')][_0xe584('0x9d')];}}if(_0x62d389['headers']['content-type']){delete _0x62d389[_0xe584('0x9c')][_0xe584('0x9e')];}return rp(_0x62d389);})[_0xe584('0x29')](function(_0x9afb5f){if(_0x9afb5f){_0x1847a8[_0xe584('0x25')](_0x9afb5f[_0xe584('0x9c')]);logger[_0xe584('0x65')](_0x9afb5f[_0xe584('0x8c')]);if(_[_0xe584('0x9f')](_0x485439[_0xe584('0x37')][_0xe584('0x7')],_0xe584('0x62'))&&_0x9afb5f[_0xe584('0xa0')]==0x1f4){return _0x1847a8[_0xe584('0x2f')](_0x9afb5f[_0xe584('0xa0')]);}else{return _0x1847a8[_0xe584('0x20')](_0x9afb5f['statusCode'])[_0xe584('0xa1')](_0x9afb5f[_0xe584('0x8c')]);}}else{return _0x1847a8[_0xe584('0x2f')](0xc8);}})[_0xe584('0x4d')](handleError(_0x1847a8,null));};exports['webhookPost']=function(_0x1f7864,_0x48d80d,_0x4046fb){return BPromise['resolve']()[_0xe584('0x29')](function(){if(!_0x1f7864['query']['path']){throw new Error(_0xe584('0x94'));}if(!_0x1f7864[_0xe584('0x37')][_0xe584('0x95')]){throw new Error(_0xe584('0x96'));}var _0x4ffaec=_0x1f7864[_0xe584('0x37')][_0xe584('0x97')]?_0x1f7864[_0xe584('0x37')]['hostname']+':'+_0x1f7864[_0xe584('0x37')][_0xe584('0x95')]:_0xe584('0x98')+_0x1f7864[_0xe584('0x37')][_0xe584('0x95')];var _0x5a14ca=_0x1f7864['query']['json']?_0x1f7864[_0xe584('0x37')]['json']:!![];var _0x46f4a9=_0x1f7864[_0xe584('0x37')][_0xe584('0x99')]?_0x1f7864['query'][_0xe584('0x99')]:null;var _0x5603d2={'method':_0x1f7864[_0xe584('0x9a')],'uri':util[_0xe584('0x51')](_0xe584('0x9b'),_0x4ffaec,_0x1f7864[_0xe584('0x37')][_0xe584('0x7')]),'json':_0x5a14ca,'resolveWithFullResponse':!![],'encoding':_0x46f4a9,'body':_0x1f7864[_0xe584('0x8c')]};if(_0x1f7864[_0xe584('0x9c')]){_0x5603d2[_0xe584('0x9c')]=_0x1f7864[_0xe584('0x9c')];if(_0x5603d2['headers'][_0xe584('0x9d')]){delete _0x5603d2['headers'][_0xe584('0x9d')];}}if(_0x5603d2[_0xe584('0x9c')]['content-type']){delete _0x5603d2['headers']['content-type'];}return rp(_0x5603d2);})[_0xe584('0x29')](function(_0x1d7626){if(_0x1d7626){_0x48d80d[_0xe584('0x25')](_0x1d7626[_0xe584('0x9c')]);logger[_0xe584('0x65')](_0x1d7626[_0xe584('0x8c')]);return _0x48d80d['status'](_0x1d7626[_0xe584('0xa0')])[_0xe584('0xa1')](_0x1d7626[_0xe584('0x8c')]);}else{return _0x48d80d[_0xe584('0x2f')](0xc8);}})['catch'](handleError(_0x48d80d,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 246df5b..3c1f30b 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 _0x86f4=['Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x86f4,0x18a));var _0x486f=function(_0x5480ed,_0x111c04){_0x5480ed=_0x5480ed-0x0;var _0x59d47a=_0x86f4[_0x5480ed];return _0x59d47a;};'use strict';var EventEmitter=require(_0x486f('0x0'));var Plugin=require(_0x486f('0x1'))['db'][_0x486f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x486f('0x3')](0x0);var events={'afterCreate':_0x486f('0x4'),'afterUpdate':_0x486f('0x5'),'afterDestroy':_0x486f('0x6')};function emitEvent(_0x53305d){return function(_0xf8d50f,_0x1539b1,_0x583729){PluginEvents[_0x486f('0x7')](_0x53305d+':'+_0xf8d50f['id'],_0xf8d50f);PluginEvents[_0x486f('0x7')](_0x53305d,_0xf8d50f);_0x583729(null);};}for(var e in events){if(events[_0x486f('0x8')](e)){var event=events[e];Plugin[_0x486f('0x9')](e,emitEvent(event));}}module[_0x486f('0xa')]=PluginEvents; \ No newline at end of file +var _0xbedb=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','Plugin'];(function(_0x175258,_0x107b1a){var _0x5eb911=function(_0x2fa44b){while(--_0x2fa44b){_0x175258['push'](_0x175258['shift']());}};_0x5eb911(++_0x107b1a);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xbbed('0x0'));var Plugin=require('../../mysqldb')['db'][_0xbbed('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xbbed('0x2')](0x0);var events={'afterCreate':_0xbbed('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b6c41){return function(_0x1096c8,_0x6b20a4,_0x24d522){PluginEvents[_0xbbed('0x4')](_0x3b6c41+':'+_0x1096c8['id'],_0x1096c8);PluginEvents[_0xbbed('0x4')](_0x3b6c41,_0x1096c8);_0x24d522(null);};}for(var e in events){if(events[_0xbbed('0x5')](e)){var event=events[e];Plugin[_0xbbed('0x6')](e,emitEvent(event));}}module[_0xbbed('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 0094f69..28bb4f8 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 _0x368c=['rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','moment','bluebird','request-promise','path'];(function(_0x57aff3,_0xe60389){var _0x429ee6=function(_0x4432c9){while(--_0x4432c9){_0x57aff3['push'](_0x57aff3['shift']());}};_0x429ee6(++_0xe60389);}(_0x368c,0x1b4));var _0xc368=function(_0x23766f,_0x2f30b5){_0x23766f=_0x23766f-0x0;var _0x2b3137=_0x368c[_0x23766f];return _0x2b3137;};'use strict';var _=require(_0xc368('0x0'));var util=require(_0xc368('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc368('0x2'));var BPromise=require(_0xc368('0x3'));var rp=require(_0xc368('0x4'));var fs=require('fs');var path=require(_0xc368('0x5'));var rimraf=require(_0xc368('0x6'));var config=require(_0xc368('0x7'));var attributes=require(_0xc368('0x8'));module[_0xc368('0x9')]=function(_0x3577ad,_0x54475a){return _0x3577ad[_0xc368('0xa')](_0xc368('0xb'),attributes,{'tableName':_0xc368('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe469=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x2d39d7,_0x29e0b7){var _0x21f7c1=function(_0x4fd038){while(--_0x4fd038){_0x2d39d7['push'](_0x2d39d7['shift']());}};_0x21f7c1(++_0x29e0b7);}(_0xe469,0x1d6));var _0x9e46=function(_0x1fd7c0,_0x1d3c01){_0x1fd7c0=_0x1fd7c0-0x0;var _0x1f27d5=_0xe469[_0x1fd7c0];return _0x1f27d5;};'use strict';var _=require(_0x9e46('0x0'));var util=require(_0x9e46('0x1'));var logger=require(_0x9e46('0x2'))(_0x9e46('0x3'));var moment=require(_0x9e46('0x4'));var BPromise=require(_0x9e46('0x5'));var rp=require(_0x9e46('0x6'));var fs=require('fs');var path=require(_0x9e46('0x7'));var rimraf=require('rimraf');var config=require(_0x9e46('0x8'));var attributes=require('./plugin.attributes');module['exports']=function(_0x577af8,_0x1be16e){return _0x577af8[_0x9e46('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index acf1076..15f352d 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 _0x704f=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreatePlugin','create','body','options','raw','then','debug','lodash'];(function(_0x1035bb,_0x4e3c1f){var _0x38d01a=function(_0x5792b2){while(--_0x5792b2){_0x1035bb['push'](_0x1035bb['shift']());}};_0x38d01a(++_0x4e3c1f);}(_0x704f,0xff));var _0xf704=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x704f[_0x4e1a49];return _0x136aae;};'use strict';var _=require(_0xf704('0x0'));var util=require(_0xf704('0x1'));var moment=require(_0xf704('0x2'));var BPromise=require(_0xf704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf704('0x4'));var db=require(_0xf704('0x5'))['db'];var utils=require(_0xf704('0x6'));var logger=require(_0xf704('0x7'))('rpc');var config=require(_0xf704('0x8'));var jayson=require(_0xf704('0x9'));var client=jayson[_0xf704('0xa')]['http']({'port':0x232a});config[_0xf704('0xb')]=_['defaults'](config[_0xf704('0xb')],{'host':_0xf704('0xc'),'port':0x18eb});var socket=require(_0xf704('0xd'))(new Redis(config[_0xf704('0xb')]));require('./plugin.socket')[_0xf704('0xe')](socket);function respondWithRpcPromise(_0x178193,_0x324753,_0x1ae799){return new BPromise(function(_0x10bcd8,_0x5a6d3a){return client[_0xf704('0xf')](_0x178193,_0x1ae799)['then'](function(_0x43dd17){logger[_0xf704('0x10')](_0xf704('0x11'),_0x324753,_0xf704('0x12'));logger['debug'](_0xf704('0x13'),_0x324753,_0xf704('0x12'),JSON[_0xf704('0x14')](_0x43dd17));if(_0x43dd17['error']){if(_0x43dd17[_0xf704('0x15')]['code']===0x1f4){logger[_0xf704('0x15')](_0xf704('0x11'),_0x324753,_0x43dd17[_0xf704('0x15')]['message']);return _0x5a6d3a(_0x43dd17[_0xf704('0x15')][_0xf704('0x16')]);}logger[_0xf704('0x15')](_0xf704('0x11'),_0x324753,_0x43dd17['error'][_0xf704('0x16')]);return _0x10bcd8(_0x43dd17[_0xf704('0x15')]['message']);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x324753,_0xf704('0x12'));_0x10bcd8(_0x43dd17[_0xf704('0x17')][_0xf704('0x16')]);}})[_0xf704('0x18')](function(_0x5a2d37){logger[_0xf704('0x15')](_0xf704('0x11'),_0x324753,_0x5a2d37);_0x5a6d3a(_0x5a2d37);});});}exports[_0xf704('0x19')]=function(_0x32127d){var _0x1c98bb=this;return new Promise(function(_0x65413,_0x3aeb6c){return db['Plugin'][_0xf704('0x1a')](_0x32127d[_0xf704('0x1b')],{'raw':_0x32127d[_0xf704('0x1c')]?_0x32127d[_0xf704('0x1c')][_0xf704('0x1d')]===undefined?!![]:![]:!![]})[_0xf704('0x1e')](function(_0x171c98){logger[_0xf704('0x10')](_0xf704('0x19'),_0x32127d);logger[_0xf704('0x1f')](_0xf704('0x19'),_0x32127d,JSON[_0xf704('0x14')](_0x171c98));_0x65413(_0x171c98);})[_0xf704('0x18')](function(_0x17ad0f){logger[_0xf704('0x15')]('CreatePlugin',_0x17ad0f[_0xf704('0x16')],_0x32127d);_0x3aeb6c(_0x1c98bb[_0xf704('0x15')](0x1f4,_0x17ad0f[_0xf704('0x16')]));});});}; \ No newline at end of file +var _0x743c=['localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreatePlugin','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults'];(function(_0x471c50,_0x53d351){var _0x49548e=function(_0x564130){while(--_0x564130){_0x471c50['push'](_0x471c50['shift']());}};_0x49548e(++_0x53d351);}(_0x743c,0x148));var _0xc743=function(_0x1f5974,_0x11540c){_0x1f5974=_0x1f5974-0x0;var _0x5cb353=_0x743c[_0x1f5974];return _0x5cb353;};'use strict';var _=require(_0xc743('0x0'));var util=require(_0xc743('0x1'));var moment=require(_0xc743('0x2'));var BPromise=require(_0xc743('0x3'));var rs=require(_0xc743('0x4'));var fs=require('fs');var Redis=require(_0xc743('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc743('0x6'));var logger=require(_0xc743('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc743('0x8'));var client=jayson[_0xc743('0x9')]['http']({'port':0x232a});config[_0xc743('0xa')]=_[_0xc743('0xb')](config[_0xc743('0xa')],{'host':_0xc743('0xc'),'port':0x18eb});var socket=require(_0xc743('0xd'))(new Redis(config[_0xc743('0xa')]));require(_0xc743('0xe'))[_0xc743('0xf')](socket);function respondWithRpcPromise(_0x553c5e,_0x4063c4,_0x400397){return new BPromise(function(_0x20c52f,_0x11fa3a){return client[_0xc743('0x10')](_0x553c5e,_0x400397)[_0xc743('0x11')](function(_0x4f52b1){logger[_0xc743('0x12')](_0xc743('0x13'),_0x4063c4,'request\x20sent');logger[_0xc743('0x14')](_0xc743('0x15'),_0x4063c4,_0xc743('0x16'),JSON[_0xc743('0x17')](_0x4f52b1));if(_0x4f52b1[_0xc743('0x18')]){if(_0x4f52b1[_0xc743('0x18')][_0xc743('0x19')]===0x1f4){logger[_0xc743('0x18')](_0xc743('0x13'),_0x4063c4,_0x4f52b1['error']['message']);return _0x11fa3a(_0x4f52b1[_0xc743('0x18')][_0xc743('0x1a')]);}logger[_0xc743('0x18')]('Plugin,\x20%s,\x20%s',_0x4063c4,_0x4f52b1['error']['message']);return _0x20c52f(_0x4f52b1[_0xc743('0x18')][_0xc743('0x1a')]);}else{logger[_0xc743('0x12')](_0xc743('0x13'),_0x4063c4,_0xc743('0x16'));_0x20c52f(_0x4f52b1[_0xc743('0x1b')][_0xc743('0x1a')]);}})[_0xc743('0x1c')](function(_0x2d584d){logger[_0xc743('0x18')](_0xc743('0x13'),_0x4063c4,_0x2d584d);_0x11fa3a(_0x2d584d);});});}exports[_0xc743('0x1d')]=function(_0x4e30f0){var _0x4be3d7=this;return new Promise(function(_0x16a5b2,_0xbf9d16){return db['Plugin'][_0xc743('0x1e')](_0x4e30f0[_0xc743('0x1f')],{'raw':_0x4e30f0[_0xc743('0x20')]?_0x4e30f0[_0xc743('0x20')][_0xc743('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x3fc0f1){logger[_0xc743('0x12')]('CreatePlugin',_0x4e30f0);logger[_0xc743('0x14')]('CreatePlugin',_0x4e30f0,JSON[_0xc743('0x17')](_0x3fc0f1));_0x16a5b2(_0x3fc0f1);})[_0xc743('0x1c')](function(_0x3bfc9f){logger[_0xc743('0x18')](_0xc743('0x1d'),_0x3bfc9f['message'],_0x4e30f0);_0xbf9d16(_0x4be3d7[_0xc743('0x18')](0x1f4,_0x3bfc9f['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 7a246a4..03f7d78 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 _0xf1b0=['removeListener','register','./plugin.events','save','remove','update'];(function(_0xcb79cd,_0x20b4d4){var _0x13a8d5=function(_0x4ad72b){while(--_0x4ad72b){_0xcb79cd['push'](_0xcb79cd['shift']());}};_0x13a8d5(++_0x20b4d4);}(_0xf1b0,0xbc));var _0x0f1b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xf1b0[_0x2d7f0e];return _0x110b07;};'use strict';var PluginEvents=require(_0x0f1b('0x0'));var events=[_0x0f1b('0x1'),_0x0f1b('0x2'),_0x0f1b('0x3')];function createListener(_0x41cf07,_0x3d0468){return function(_0x3d97a7){_0x3d0468['emit'](_0x41cf07,_0x3d97a7);};}function removeListener(_0x15d256,_0x474908){return function(){PluginEvents[_0x0f1b('0x4')](_0x15d256,_0x474908);};}exports[_0x0f1b('0x5')]=function(_0x4c798e){for(var _0x51cf40=0x0,_0x41cf44=events['length'];_0x51cf40<_0x41cf44;_0x51cf40++){var _0x17c5c0=events[_0x51cf40];var _0x566e6a=createListener('plugin:'+_0x17c5c0,_0x4c798e);PluginEvents['on'](_0x17c5c0,_0x566e6a);}}; \ No newline at end of file +var _0x0bee=['length','plugin:','save','update','removeListener','register'];(function(_0x55bfe5,_0x572fd9){var _0x3932fc=function(_0x1be700){while(--_0x1be700){_0x55bfe5['push'](_0x55bfe5['shift']());}};_0x3932fc(++_0x572fd9);}(_0x0bee,0x9e));var _0xe0be=function(_0x3539bf,_0x22d69c){_0x3539bf=_0x3539bf-0x0;var _0x34a14f=_0x0bee[_0x3539bf];return _0x34a14f;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xe0be('0x0'),'remove',_0xe0be('0x1')];function createListener(_0x429f86,_0x5972b8){return function(_0x53387f){_0x5972b8['emit'](_0x429f86,_0x53387f);};}function removeListener(_0x392747,_0x46e93d){return function(){PluginEvents[_0xe0be('0x2')](_0x392747,_0x46e93d);};}exports[_0xe0be('0x3')]=function(_0x4cec07){for(var _0x594cd8=0x0,_0x3f8c07=events[_0xe0be('0x4')];_0x594cd8<_0x3f8c07;_0x594cd8++){var _0x30c6c7=events[_0x594cd8];var _0x1d9693=createListener(_0xe0be('0x5')+_0x30c6c7,_0x4cec07);PluginEvents['on'](_0x30c6c7,_0x1d9693);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 28900b6..87d6050 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(_0xc2306,_0x7438cf){var _0x4f50dc=function(_0x581ff9){while(--_0x581ff9){_0xc2306['push'](_0xc2306['shift']());}};_0x4f50dc(++_0x7438cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x127a2c,_0x555936){var _0x3199be=function(_0x25b699){while(--_0x25b699){_0x127a2c['push'](_0x127a2c['shift']());}};_0x3199be(++_0x555936);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 f61256b..21ebf75 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 _0x3140=['send','npm\x20install','info','error','index','then','reject','express','length','catch','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','lodash','../../config/pm2','../../config/logger','api','exec','bluebird','sendStatus','status','json','name'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x3140,0xaf));var _0x0314=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0x3140[_0xab9f3d];return _0x5283bf;};'use strict';var _=require(_0x0314('0x0'));var pm2=require(_0x0314('0x1'));var logger=require(_0x0314('0x2'))(_0x0314('0x3'));var path=require('path');var exec=require('child_process')[_0x0314('0x4')];var BPromise=require(_0x0314('0x5'));function handleEntityNotFound(_0x1c0f66,_0x3e4284){return function(_0x254566){if(!_0x254566){_0x1c0f66[_0x0314('0x6')](0x194);;}return _0x254566;};}function respondWithResult(_0x9e308d,_0xf87d26){_0xf87d26=_0xf87d26||0xc8;return function(_0x11ee94){if(_0x11ee94){return _0x9e308d[_0x0314('0x7')](_0xf87d26)[_0x0314('0x8')](_0x11ee94);}return null;};}function handleError(_0x495b27,_0x26031f){_0x26031f=_0x26031f||0x1f4;return function(_0x2d87d2){logger['error'](_0x2d87d2['stack']);if(_0x2d87d2[_0x0314('0x9')]){delete _0x2d87d2['name'];}_0x495b27[_0x0314('0x7')](_0x26031f)[_0x0314('0xa')](_0x2d87d2);};}function execChildProcess(){return new BPromise(function(_0x3a7713,_0x376da9){exec(_0x0314('0xb'),function(_0x3e9964,_0x516448,_0xe78fb9){logger[_0x0314('0xc')](_0x516448);logger[_0x0314('0xc')](_0xe78fb9);if(_0x3e9964){logger[_0x0314('0xd')](_0x3e9964);return _0x376da9(_0x3e9964);}return _0x3a7713(_0x516448);});});}exports[_0x0314('0xe')]=function(_0x4318d6,_0x149b67){return pm2['list']()[_0x0314('0xf')](function(_0xbe0b07){if(_0xbe0b07){var _0x1316a0=_[_0x0314('0x10')](_0xbe0b07,function(_0x40566e){return _0x40566e[_0x0314('0x9')]===_0x0314('0x11')||_0x40566e[_0x0314('0x9')]==='motion2';});return{'rows':_0x1316a0,'count':_0x1316a0[_0x0314('0x12')]};}return null;})[_0x0314('0xf')](respondWithResult(_0x149b67,null))[_0x0314('0x13')](handleError(_0x149b67,null));};exports['show']=function(_0x6c48cb,_0x5f2e82){return pm2['describe'](_0x6c48cb[_0x0314('0x14')]['id'])[_0x0314('0xf')](respondWithResult(_0x5f2e82,null))['then'](handleEntityNotFound(_0x5f2e82,null))[_0x0314('0x13')](handleError(_0x5f2e82,null));};exports[_0x0314('0x15')]=function(_0x583ffa,_0x1a25cf){if(_0x583ffa['body'][_0x0314('0x9')]&&_0x583ffa[_0x0314('0x16')][_0x0314('0x17')]){var _0x77ddfd=path[_0x0314('0x18')](__dirname,_0x0314('0x19'),_0x583ffa['body']['script']);var _0x20305b=process[_0x0314('0x1a')]();process[_0x0314('0x1b')](path[_0x0314('0x1c')](_0x77ddfd));return execChildProcess()[_0x0314('0xf')](function(_0xd7638b){process['chdir'](_0x20305b);return pm2[_0x0314('0x1d')]({'name':_0x583ffa[_0x0314('0x16')]['name'],'script':_0x77ddfd});})[_0x0314('0xf')](function(_0xfc4893){pm2[_0x0314('0x1e')]();return _0xfc4893[0x0];})[_0x0314('0xf')](respondWithResult(_0x1a25cf,0xc9))[_0x0314('0x13')](handleError(_0x1a25cf,null));}else{return _0x1a25cf[_0x0314('0x7')](0x1f4)['send']({'message':_0x0314('0x1f')});}};exports[_0x0314('0x20')]=function(_0x2d636b,_0x47c2d1){if(_0x2d636b[_0x0314('0x16')]['id']){delete _0x2d636b[_0x0314('0x16')]['id'];}var _0x47c102={'online':'restart','stopped':_0x0314('0x21')};if(_0x47c102[_0x0314('0x22')](_0x2d636b['body'][_0x0314('0x7')])){return pm2[_0x47c102[_0x2d636b[_0x0314('0x16')]['status']]](_0x2d636b['params']['id'])[_0x0314('0xf')](respondWithResult(_0x47c2d1,0xc8))[_0x0314('0x13')](handleError(_0x47c2d1,null));}else{return _0x47c2d1['status'](0x1f4)[_0x0314('0xa')]({'message':_0x0314('0x23')});}};exports[_0x0314('0x24')]=function(_0x4da71c,_0x5b82b2){if(_0x4da71c[_0x0314('0x16')]['id']){delete _0x4da71c[_0x0314('0x16')]['id'];}if(_0x4da71c[_0x0314('0x14')]['id']){return pm2['delete'](_0x4da71c[_0x0314('0x14')]['id'])['then'](function(_0x52700f){pm2[_0x0314('0x1e')]();return _0x52700f[0x0];})[_0x0314('0xf')](respondWithResult(_0x5b82b2,null))[_0x0314('0x13')](handleError(_0x5b82b2,null));}else{return _0x5b82b2['status'](0x1f4)[_0x0314('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xc6d8=['Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/logger','path','exec','sendStatus','status','stack','name','send','npm\x20install','info','error','index','list','then','reject','length','show','describe','create','body','join','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','params','catch'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2c0557,_0x4314fd){_0x2c0557=_0x2c0557-0x0;var _0x2878cd=_0xc6d8[_0x2c0557];return _0x2878cd;};'use strict';var _=require(_0x8c6d('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x8c6d('0x1'))('api');var path=require(_0x8c6d('0x2'));var exec=require('child_process')[_0x8c6d('0x3')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5b6b04,_0x352b8c){return function(_0xdff6f){if(!_0xdff6f){_0x5b6b04[_0x8c6d('0x4')](0x194);;}return _0xdff6f;};}function respondWithResult(_0x4f5e8f,_0x3c265c){_0x3c265c=_0x3c265c||0xc8;return function(_0x2dbb52){if(_0x2dbb52){return _0x4f5e8f[_0x8c6d('0x5')](_0x3c265c)['json'](_0x2dbb52);}return null;};}function handleError(_0x1496ba,_0x75c49f){_0x75c49f=_0x75c49f||0x1f4;return function(_0x16d4b2){logger['error'](_0x16d4b2[_0x8c6d('0x6')]);if(_0x16d4b2[_0x8c6d('0x7')]){delete _0x16d4b2[_0x8c6d('0x7')];}_0x1496ba[_0x8c6d('0x5')](_0x75c49f)[_0x8c6d('0x8')](_0x16d4b2);};}function execChildProcess(){return new BPromise(function(_0x43a7ab,_0x60cd5c){exec(_0x8c6d('0x9'),function(_0x50af75,_0x36d6fb,_0x559d17){logger['info'](_0x36d6fb);logger[_0x8c6d('0xa')](_0x559d17);if(_0x50af75){logger[_0x8c6d('0xb')](_0x50af75);return _0x60cd5c(_0x50af75);}return _0x43a7ab(_0x36d6fb);});});}exports[_0x8c6d('0xc')]=function(_0x8ec2d4,_0x30ecfa){return pm2[_0x8c6d('0xd')]()[_0x8c6d('0xe')](function(_0x103699){if(_0x103699){var _0x14c1ee=_[_0x8c6d('0xf')](_0x103699,function(_0x4fb956){return _0x4fb956[_0x8c6d('0x7')]==='express'||_0x4fb956[_0x8c6d('0x7')]==='motion2';});return{'rows':_0x14c1ee,'count':_0x14c1ee[_0x8c6d('0x10')]};}return null;})[_0x8c6d('0xe')](respondWithResult(_0x30ecfa,null))['catch'](handleError(_0x30ecfa,null));};exports[_0x8c6d('0x11')]=function(_0x2b8a26,_0x51a5fa){return pm2[_0x8c6d('0x12')](_0x2b8a26['params']['id'])['then'](respondWithResult(_0x51a5fa,null))[_0x8c6d('0xe')](handleEntityNotFound(_0x51a5fa,null))['catch'](handleError(_0x51a5fa,null));};exports[_0x8c6d('0x13')]=function(_0x174a4f,_0x1d0f0a){if(_0x174a4f[_0x8c6d('0x14')][_0x8c6d('0x7')]&&_0x174a4f['body']['script']){var _0x550079=path[_0x8c6d('0x15')](__dirname,'../../files/plugins',_0x174a4f[_0x8c6d('0x14')]['script']);var _0x4c378b=process[_0x8c6d('0x16')]();process[_0x8c6d('0x17')](path['dirname'](_0x550079));return execChildProcess()['then'](function(_0x51bb08){process['chdir'](_0x4c378b);return pm2[_0x8c6d('0x18')]({'name':_0x174a4f[_0x8c6d('0x14')][_0x8c6d('0x7')],'script':_0x550079});})['then'](function(_0x41c904){pm2['dump']();return _0x41c904[0x0];})[_0x8c6d('0xe')](respondWithResult(_0x1d0f0a,0xc9))['catch'](handleError(_0x1d0f0a,null));}else{return _0x1d0f0a[_0x8c6d('0x5')](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x19')});}};exports[_0x8c6d('0x1a')]=function(_0x1e6755,_0x3e3cd3){if(_0x1e6755[_0x8c6d('0x14')]['id']){delete _0x1e6755[_0x8c6d('0x14')]['id'];}var _0x3eab38={'online':'restart','stopped':'stop'};if(_0x3eab38[_0x8c6d('0x1b')](_0x1e6755[_0x8c6d('0x14')][_0x8c6d('0x5')])){return pm2[_0x3eab38[_0x1e6755[_0x8c6d('0x14')][_0x8c6d('0x5')]]](_0x1e6755[_0x8c6d('0x1c')]['id'])[_0x8c6d('0xe')](respondWithResult(_0x3e3cd3,0xc8))[_0x8c6d('0x1d')](handleError(_0x3e3cd3,null));}else{return _0x3e3cd3[_0x8c6d('0x5')](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x1e')});}};exports[_0x8c6d('0x1f')]=function(_0x4e5203,_0x3af625){if(_0x4e5203[_0x8c6d('0x14')]['id']){delete _0x4e5203[_0x8c6d('0x14')]['id'];}if(_0x4e5203[_0x8c6d('0x1c')]['id']){return pm2[_0x8c6d('0x20')](_0x4e5203[_0x8c6d('0x1c')]['id'])[_0x8c6d('0xe')](function(_0x1857f9){pm2[_0x8c6d('0x21')]();return _0x1857f9[0x0];})['then'](respondWithResult(_0x3af625,null))[_0x8c6d('0x1d')](handleError(_0x3af625,null));}else{return _0x3af625['status'](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 6896ddd..ad58761 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 _0x5eca=['express','Router','../../components/auth/service','./realtime.controller','get','isAuthenticated'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0x5eca,0x10e));var _0xa5ec=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5eca[_0x40a045];return _0x1a687c;};'use strict';var express=require(_0xa5ec('0x0'));var router=express[_0xa5ec('0x1')]();var auth=require(_0xa5ec('0x2'));var controller=require(_0xa5ec('0x3'));router[_0xa5ec('0x4')]('/queues',auth[_0xa5ec('0x5')](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0xfc64=['isAuthenticated','getQueues','exports','express','Router','../../components/auth/service','get','/queues'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfc64,0x1b3));var _0x4fc6=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xfc64[_0x433a86];return _0x23000c;};'use strict';var express=require(_0x4fc6('0x0'));var router=express[_0x4fc6('0x1')]();var auth=require(_0x4fc6('0x2'));var controller=require('./realtime.controller');router[_0x4fc6('0x3')](_0x4fc6('0x4'),auth[_0x4fc6('0x5')](),controller[_0x4fc6('0x6')]);module[_0x4fc6('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 572a06c..68537b6 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 _0x7a54=['push','User','findAll','agent','length','loggedInDb','catch','util','lodash','jayson/promise','../../config/logger','api','client','http','offset','undefined','status','set','Content-Range','json','stack','name','send','getQueues','mail','chat','sms','openchannel','fax','resolve','then','query','channel','includes','toLowerCase','Invalid\x20channel','startCase','Queue','rawAttributes','fieldName','type','getOptions','user','userProfileId','voice','outbound','filter','UserProfile','getResources','findAndCountAll','count','request','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','available','waiting','pTalking','originated','dialMethod','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','map','get','paused','loggedIn','talking','merge','pick','getAgents','online','getMembers','find','UserId'];(function(_0x52980f,_0x47b3b0){var _0x1f52a1=function(_0x51dd63){while(--_0x51dd63){_0x52980f['push'](_0x52980f['shift']());}};_0x1f52a1(++_0x47b3b0);}(_0x7a54,0x106));var _0x47a5=function(_0x32f5a2,_0x421ff4){_0x32f5a2=_0x32f5a2-0x0;var _0xa5670=_0x7a54[_0x32f5a2];return _0xa5670;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var client=jayson[_0x47a5('0x5')][_0x47a5('0x6')]({'port':0x232a});var routingClient=jayson[_0x47a5('0x5')][_0x47a5('0x6')]({'port':0x232c});function respondWithFilteredResult(_0xfdf934,_0x545a97){return function(_0x3d5629){if(_0x3d5629){var _0x59199c=typeof _0x545a97[_0x47a5('0x7')]===_0x47a5('0x8')&&typeof _0x545a97['limit']===_0x47a5('0x8');var _0x5077f3=_0x3d5629['count'];var _0x582352=_0x59199c?0x0:_0x545a97[_0x47a5('0x7')];var _0x2baee7=_0x59199c?_0x3d5629['count']:_0x545a97[_0x47a5('0x7')]+_0x545a97['limit'];var _0x5de6d7;if(_0x2baee7>=_0x5077f3){_0x2baee7=_0x5077f3;_0x5de6d7=0xc8;}else{_0x5de6d7=0xce;}_0xfdf934[_0x47a5('0x9')](_0x5de6d7);return _0xfdf934[_0x47a5('0xa')](_0x47a5('0xb'),_0x582352+'-'+_0x2baee7+'/'+_0x5077f3)[_0x47a5('0xc')](_0x3d5629);}return null;};}function handleError(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0x1f4;return function(_0x1eae59){logger['error'](_0x1eae59[_0x47a5('0xd')]);if(_0x1eae59[_0x47a5('0xe')]){delete _0x1eae59[_0x47a5('0xe')];}_0xd612dd[_0x47a5('0x9')](_0xd308b8)[_0x47a5('0xf')](_0x1eae59);};}exports[_0x47a5('0x10')]=function(_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),'whatsapp','voice'];var _0x138bc0={'count':0x0,'rows':[]},_0x4b966e={},_0x5247fd;Promise[_0x47a5('0x16')]()[_0x47a5('0x17')](function(){if(_0x3c6c46[_0x47a5('0x18')][_0x47a5('0x19')]){if(!_[_0x47a5('0x1a')](_0x4e99a8,_0x3c6c46[_0x47a5('0x18')][_0x47a5('0x19')][_0x47a5('0x1b')]()))throw new Error(_0x47a5('0x1c'));_0x5247fd=_0x3c6c46['query'][_0x47a5('0x19')][_0x47a5('0x1b')]();}var _0x47cf3c=_[_0x47a5('0x1d')](_0x5247fd)+_0x47a5('0x1e');var _0x36874d=_['map'](db[_0x47cf3c][_0x47a5('0x1f')],function(_0x2f142b){return{'name':_0x2f142b[_0x47a5('0x20')],'type':_0x2f142b[_0x47a5('0x21')]['key']};});_0x4b966e=qs[_0x47a5('0x22')](_0x36874d,_0x3c6c46);if(_0x3c6c46[_0x47a5('0x23')]['role']===_0x47a5('0x23')){var _0xc4cd63={'params':{'id':_0x3c6c46[_0x47a5('0x23')][_0x47a5('0x24')]},'query':{'section':_0x5247fd===_0x47a5('0x25')&&_0x3c6c46['query']['type']===_0x47a5('0x26')?'QueueCampaigns':_[_0x47a5('0x1d')](_0x5247fd)+'Queues','type':_0x3c6c46[_0x47a5('0x18')][_0x47a5('0x21')],'nolimit':!![],'sort':_0x47a5('0xe'),'filter':_0x3c6c46[_0x47a5('0x18')][_0x47a5('0x27')]}};return db[_0x47a5('0x28')][_0x47a5('0x29')](_0xc4cd63);}return db[_0x47cf3c][_0x47a5('0x2a')](_0x4b966e);})[_0x47a5('0x17')](function(_0x361bfa){_0x138bc0[_0x47a5('0x2b')]=_0x361bfa[_0x47a5('0x2b')];var _0x3ad507=_0x5247fd==='voice'?client:routingClient;return _0x3ad507[_0x47a5('0x2c')](_['startCase'](_0x5247fd)+_0x47a5('0x2d'),_0x3c6c46)[_0x47a5('0x17')](function(_0x16901f){if(_0x16901f['error'])throw new Error(util[_0x47a5('0x2e')](_0x47a5('0x2f'),_0x5247fd));var _0x39b50b=_0x16901f[_0x47a5('0x30')];var _0x51cc81=['loggedIn',_0x47a5('0x31'),_0x47a5('0x32'),'talking','paused'];if(_0x5247fd===_0x47a5('0x25')&&_0x3c6c46[_0x47a5('0x18')]['type']===_0x47a5('0x26')){_0x51cc81['push'](_0x47a5('0x33'),_0x47a5('0x34'),'message','dialActive',_0x47a5('0x35'),'Trunk',_0x47a5('0x36'),_0x47a5('0x37'),_0x47a5('0x38'),'erlangCallToSecond',_0x47a5('0x39'),'erlangBusyFactor','dialPredictiveInterval',_0x47a5('0x3a'),'dialPredictiveIntervalMinThreshold',_0x47a5('0x3b'),'predictiveIntervalTotalCalls',_0x47a5('0x3c'),_0x47a5('0x3d'),_0x47a5('0x3e'),_0x47a5('0x3f'),_0x47a5('0x40'));}var _0xed6320=_0x361bfa[_0x47a5('0x41')][_0x47a5('0x42')](function(_0x1a0d23){var _0x4caed5=_0x1a0d23[_0x47a5('0x43')]({'plain':!![]});_0x4caed5[_0x47a5('0x44')]=0x0;_0x4caed5['loggedInDb']=0x0;_0x4caed5[_0x47a5('0x45')]=0x0;_0x4caed5[_0x47a5('0x31')]=0x0;_0x4caed5[_0x47a5('0x44')]=0x0;_0x4caed5['waiting']=0x0;if(_0x5247fd===_0x47a5('0x25')){_0x4caed5[_0x47a5('0x46')]=0x0;if(_0x3c6c46['query'][_0x47a5('0x21')]===_0x47a5('0x26')){_0x4caed5['pTalking']=0x0;_0x4caed5['originated']=0x0;}}_0x4caed5['agents']=[];var _0x12d9f2=_['find'](_0x39b50b[_0x47a5('0x41')],['id',_0x4caed5['id']]);if(_0x12d9f2)_[_0x47a5('0x47')](_0x4caed5,_[_0x47a5('0x48')](_0x12d9f2,_0x51cc81));if(_0x5247fd===_0x47a5('0x25')){return _0x1a0d23[_0x47a5('0x49')]({'attributes':['id',_0x47a5('0xe'),_0x47a5('0x4a')],'joinTableAttributes':[],'raw':!![]})[_0x47a5('0x17')](function(_0x3fa2a8){return _0x1a0d23[_0x47a5('0x4b')]({'raw':!![]})[_0x47a5('0x17')](function(_0x1658e8){for(var _0x23d6d8=0x0;_0x23d6d8<_0x3fa2a8['length'];_0x23d6d8++){var _0x1fbece=_[_0x47a5('0x4c')](_0x1658e8,[_0x47a5('0x4d'),_0x3fa2a8[_0x23d6d8]['id']]);var _0x23bd8d={'id':_0x3fa2a8[_0x23d6d8]['id'],'name':_0x3fa2a8[_0x23d6d8]['name'],'online':Boolean(_0x3fa2a8[_0x23d6d8][_0x47a5('0x4a')]),'paused':_0x1fbece?Boolean(_0x1fbece['paused']):![]};if(_0x23bd8d['online'])_0x4caed5['loggedInDb']++;if(_0x23bd8d['paused'])_0x4caed5[_0x47a5('0x44')]++;_0x4caed5['agents'][_0x47a5('0x4e')](_0x23bd8d);}return _0x4caed5;});});}else{var _0x3a740b=_0x47a5('0x4f')+_['startCase'](_0x5247fd)+_0x47a5('0x1e');var _0x20c5bc=_0x5247fd+'Pause';return db[_0x3a740b]['findAll']({'where':{[_[_0x47a5('0x1d')](_0x5247fd)+'QueueId']:_0x1a0d23['id']},'raw':!![]})[_0x47a5('0x17')](function(_0x4703b2){return db[_0x47a5('0x4f')][_0x47a5('0x50')]({'attributes':['id',_0x47a5('0xe'),_0x47a5('0x4a'),_0x20c5bc],'where':{'id':_[_0x47a5('0x42')](_0x4703b2,_0x47a5('0x4d')),'role':_0x47a5('0x51')},'raw':!![]});})[_0x47a5('0x17')](function(_0x24ecb1){for(var _0x3c3ebf=0x0;_0x3c3ebf<_0x24ecb1[_0x47a5('0x52')];_0x3c3ebf++){var _0x3574d4={'id':_0x24ecb1[_0x3c3ebf]['id'],'name':_0x24ecb1[_0x3c3ebf][_0x47a5('0xe')],'online':Boolean(_0x24ecb1[_0x3c3ebf][_0x47a5('0x4a')]),'paused':Boolean(_0x24ecb1[_0x3c3ebf][_0x20c5bc])};if(_0x3574d4['online'])_0x4caed5[_0x47a5('0x53')]++;if(_0x3574d4[_0x47a5('0x44')])_0x4caed5['paused']++;_0x4caed5['agents'][_0x47a5('0x4e')](_0x3574d4);}return _0x4caed5;});}});return Promise['all'](_0xed6320);});})[_0x47a5('0x17')](function(_0xd93e37){_0x138bc0['rows']=_0xd93e37;return _0x138bc0;})['then'](respondWithFilteredResult(_0x190faa,_0x4b966e))[_0x47a5('0x54')](handleError(_0x190faa,null));}; \ No newline at end of file +var _0x7ee1=['whatsapp','voice','then','query','channel','includes','toLowerCase','startCase','Queue','map','rawAttributes','fieldName','type','key','role','user','userProfileId','outbound','QueueCampaigns','Queues','filter','UserProfile','findAndCountAll','request','format','result','loggedIn','available','waiting','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','rows','paused','loggedInDb','pTalking','agents','find','merge','online','length','UserId','push','User','Pause','findAll','QueueId','agent','all','catch','util','../../config/logger','api','../../mysqldb','http','client','undefined','count','limit','status','set','json','error','stack','name','send','getQueues','openchannel','fax'];(function(_0x1c5e90,_0x2c6e6b){var _0x10b313=function(_0x50dad6){while(--_0x50dad6){_0x1c5e90['push'](_0x1c5e90['shift']());}};_0x10b313(++_0x2c6e6b);}(_0x7ee1,0x8d));var _0x17ee=function(_0x20d0f0,_0x54e7b1){_0x20d0f0=_0x20d0f0-0x0;var _0x40dda8=_0x7ee1[_0x20d0f0];return _0x40dda8;};'use strict';var util=require(_0x17ee('0x0'));var _=require('lodash');var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0x17ee('0x1'))(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var client=jayson['client'][_0x17ee('0x4')]({'port':0x232a});var routingClient=jayson[_0x17ee('0x5')][_0x17ee('0x4')]({'port':0x232c});function respondWithFilteredResult(_0x2f9ebc,_0x5c0617){return function(_0x52b1db){if(_0x52b1db){var _0x29b9eb=typeof _0x5c0617['offset']===_0x17ee('0x6')&&typeof _0x5c0617['limit']===_0x17ee('0x6');var _0xfa5096=_0x52b1db[_0x17ee('0x7')];var _0x4af369=_0x29b9eb?0x0:_0x5c0617['offset'];var _0x4d6bb5=_0x29b9eb?_0x52b1db[_0x17ee('0x7')]:_0x5c0617['offset']+_0x5c0617[_0x17ee('0x8')];var _0x378a78;if(_0x4d6bb5>=_0xfa5096){_0x4d6bb5=_0xfa5096;_0x378a78=0xc8;}else{_0x378a78=0xce;}_0x2f9ebc[_0x17ee('0x9')](_0x378a78);return _0x2f9ebc[_0x17ee('0xa')]('Content-Range',_0x4af369+'-'+_0x4d6bb5+'/'+_0xfa5096)[_0x17ee('0xb')](_0x52b1db);}return null;};}function handleError(_0x51b5d9,_0x264b0f){_0x264b0f=_0x264b0f||0x1f4;return function(_0x725806){logger[_0x17ee('0xc')](_0x725806[_0x17ee('0xd')]);if(_0x725806[_0x17ee('0xe')]){delete _0x725806[_0x17ee('0xe')];}_0x51b5d9[_0x17ee('0x9')](_0x264b0f)[_0x17ee('0xf')](_0x725806);};}exports[_0x17ee('0x10')]=function(_0x31c62b,_0x329af2){var _0x52d679=['mail','chat','sms',_0x17ee('0x11'),_0x17ee('0x12'),_0x17ee('0x13'),_0x17ee('0x14')];var _0x443f81={'count':0x0,'rows':[]},_0x236d18={},_0x63d27f;Promise['resolve']()[_0x17ee('0x15')](function(){if(_0x31c62b[_0x17ee('0x16')][_0x17ee('0x17')]){if(!_[_0x17ee('0x18')](_0x52d679,_0x31c62b[_0x17ee('0x16')]['channel'][_0x17ee('0x19')]()))throw new Error('Invalid\x20channel');_0x63d27f=_0x31c62b[_0x17ee('0x16')]['channel'][_0x17ee('0x19')]();}var _0x343f1b=_[_0x17ee('0x1a')](_0x63d27f)+_0x17ee('0x1b');var _0x3e23f8=_[_0x17ee('0x1c')](db[_0x343f1b][_0x17ee('0x1d')],function(_0x14295f){return{'name':_0x14295f[_0x17ee('0x1e')],'type':_0x14295f[_0x17ee('0x1f')][_0x17ee('0x20')]};});_0x236d18=qs['getOptions'](_0x3e23f8,_0x31c62b);if(_0x31c62b['user'][_0x17ee('0x21')]===_0x17ee('0x22')){var _0xcf49aa={'params':{'id':_0x31c62b[_0x17ee('0x22')][_0x17ee('0x23')]},'query':{'section':_0x63d27f===_0x17ee('0x14')&&_0x31c62b[_0x17ee('0x16')][_0x17ee('0x1f')]===_0x17ee('0x24')?_0x17ee('0x25'):_[_0x17ee('0x1a')](_0x63d27f)+_0x17ee('0x26'),'type':_0x31c62b['query'][_0x17ee('0x1f')],'nolimit':!![],'sort':_0x17ee('0xe'),'filter':_0x31c62b[_0x17ee('0x16')][_0x17ee('0x27')]}};return db[_0x17ee('0x28')]['getResources'](_0xcf49aa);}return db[_0x343f1b][_0x17ee('0x29')](_0x236d18);})[_0x17ee('0x15')](function(_0x295186){_0x443f81['count']=_0x295186[_0x17ee('0x7')];var _0x27ab38=_0x63d27f==='voice'?client:routingClient;return _0x27ab38[_0x17ee('0x2a')](_['startCase'](_0x63d27f)+_0x17ee('0x26'),_0x31c62b)['then'](function(_0x141ac9){if(_0x141ac9[_0x17ee('0xc')])throw new Error(util[_0x17ee('0x2b')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x63d27f));var _0x3e513a=_0x141ac9[_0x17ee('0x2c')];var _0x57bfd4=[_0x17ee('0x2d'),_0x17ee('0x2e'),_0x17ee('0x2f'),'talking','paused'];if(_0x63d27f===_0x17ee('0x14')&&_0x31c62b[_0x17ee('0x16')][_0x17ee('0x1f')]===_0x17ee('0x24')){_0x57bfd4['push']('pTalking',_0x17ee('0x30'),_0x17ee('0x31'),_0x17ee('0x32'),_0x17ee('0x33'),_0x17ee('0x34'),_0x17ee('0x35'),_0x17ee('0x36'),'erlangCalls','erlangCallToSecond','erlangAbandonmentRate',_0x17ee('0x37'),'dialPredictiveInterval',_0x17ee('0x38'),_0x17ee('0x39'),_0x17ee('0x3a'),'predictiveIntervalTotalCalls',_0x17ee('0x3b'),_0x17ee('0x3c'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x17ee('0x3d'));}var _0xa6657e=_0x295186[_0x17ee('0x3e')][_0x17ee('0x1c')](function(_0x2273a6){var _0x5a2c08=_0x2273a6['get']({'plain':!![]});_0x5a2c08[_0x17ee('0x3f')]=0x0;_0x5a2c08[_0x17ee('0x40')]=0x0;_0x5a2c08[_0x17ee('0x2d')]=0x0;_0x5a2c08[_0x17ee('0x2e')]=0x0;_0x5a2c08[_0x17ee('0x3f')]=0x0;_0x5a2c08[_0x17ee('0x2f')]=0x0;if(_0x63d27f==='voice'){_0x5a2c08['talking']=0x0;if(_0x31c62b[_0x17ee('0x16')][_0x17ee('0x1f')]===_0x17ee('0x24')){_0x5a2c08[_0x17ee('0x41')]=0x0;_0x5a2c08[_0x17ee('0x30')]=0x0;}}_0x5a2c08[_0x17ee('0x42')]=[];var _0x463f98=_[_0x17ee('0x43')](_0x3e513a[_0x17ee('0x3e')],['id',_0x5a2c08['id']]);if(_0x463f98)_[_0x17ee('0x44')](_0x5a2c08,_['pick'](_0x463f98,_0x57bfd4));if(_0x63d27f==='voice'){return _0x2273a6['getAgents']({'attributes':['id',_0x17ee('0xe'),_0x17ee('0x45')],'joinTableAttributes':[],'raw':!![]})[_0x17ee('0x15')](function(_0x3a1ace){return _0x2273a6['getMembers']({'raw':!![]})[_0x17ee('0x15')](function(_0x10134a){for(var _0xad858b=0x0;_0xad858b<_0x3a1ace[_0x17ee('0x46')];_0xad858b++){var _0x546b5c=_[_0x17ee('0x43')](_0x10134a,[_0x17ee('0x47'),_0x3a1ace[_0xad858b]['id']]);var _0x2b9f50={'id':_0x3a1ace[_0xad858b]['id'],'name':_0x3a1ace[_0xad858b][_0x17ee('0xe')],'online':Boolean(_0x3a1ace[_0xad858b][_0x17ee('0x45')]),'paused':_0x546b5c?Boolean(_0x546b5c[_0x17ee('0x3f')]):![]};if(_0x2b9f50[_0x17ee('0x45')])_0x5a2c08[_0x17ee('0x40')]++;if(_0x2b9f50['paused'])_0x5a2c08[_0x17ee('0x3f')]++;_0x5a2c08[_0x17ee('0x42')][_0x17ee('0x48')](_0x2b9f50);}return _0x5a2c08;});});}else{var _0x3df18b=_0x17ee('0x49')+_[_0x17ee('0x1a')](_0x63d27f)+_0x17ee('0x1b');var _0x376f69=_0x63d27f+_0x17ee('0x4a');return db[_0x3df18b][_0x17ee('0x4b')]({'where':{[_[_0x17ee('0x1a')](_0x63d27f)+_0x17ee('0x4c')]:_0x2273a6['id']},'raw':!![]})['then'](function(_0x333ab5){return db[_0x17ee('0x49')]['findAll']({'attributes':['id','name','online',_0x376f69],'where':{'id':_[_0x17ee('0x1c')](_0x333ab5,_0x17ee('0x47')),'role':_0x17ee('0x4d')},'raw':!![]});})[_0x17ee('0x15')](function(_0x1a14e0){for(var _0x5b394b=0x0;_0x5b394b<_0x1a14e0[_0x17ee('0x46')];_0x5b394b++){var _0x40d95a={'id':_0x1a14e0[_0x5b394b]['id'],'name':_0x1a14e0[_0x5b394b][_0x17ee('0xe')],'online':Boolean(_0x1a14e0[_0x5b394b][_0x17ee('0x45')]),'paused':Boolean(_0x1a14e0[_0x5b394b][_0x376f69])};if(_0x40d95a[_0x17ee('0x45')])_0x5a2c08[_0x17ee('0x40')]++;if(_0x40d95a[_0x17ee('0x3f')])_0x5a2c08[_0x17ee('0x3f')]++;_0x5a2c08[_0x17ee('0x42')][_0x17ee('0x48')](_0x40d95a);}return _0x5a2c08;});}});return Promise[_0x17ee('0x4e')](_0xa6657e);});})[_0x17ee('0x15')](function(_0x4a99bf){_0x443f81['rows']=_0x4a99bf;return _0x443f81;})[_0x17ee('0x15')](respondWithFilteredResult(_0x329af2,_0x236d18))[_0x17ee('0x4f')](handleError(_0x329af2,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 9ff4588..3d1967f 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(_0x366339,_0x33a781){var _0x2bf90b=function(_0x3611ae){while(--_0x3611ae){_0x366339['push'](_0x366339['shift']());}};_0x2bf90b(++_0x33a781);}(_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(_0xf9cb31,_0x3fc19d){var _0x42ad44=function(_0x7c67e1){while(--_0x7c67e1){_0xf9cb31['push'](_0xf9cb31['shift']());}};_0x42ad44(++_0x3fc19d);}(_0xedd9,0xfc));var _0x9edd=function(_0x3401e2,_0x38b736){_0x3401e2=_0x3401e2-0x0;var _0x35eb3d=_0xedd9[_0x3401e2];return _0x35eb3d;};'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 e72f96e..74d2a7e 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 _0xf981=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x387dfd,_0x3e29d0){var _0x2d3176=function(_0x492b97){while(--_0x492b97){_0x387dfd['push'](_0x387dfd['shift']());}};_0x2d3176(++_0x3e29d0);}(_0xf981,0xe6));var _0x1f98=function(_0x59f59c,_0x21a13d){_0x59f59c=_0x59f59c-0x0;var _0x438d95=_0xf981[_0x59f59c];return _0x438d95;};'use strict';var Sequelize=require(_0x1f98('0x0'));module[_0x1f98('0x1')]={'state':{'type':Sequelize[_0x1f98('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1f98('0x3')]},'scheduledat':{'type':Sequelize[_0x1f98('0x4')]},'uniqueid':{'type':Sequelize[_0x1f98('0x3')]},'starttime':{'type':Sequelize[_0x1f98('0x4')]},'responsetime':{'type':Sequelize[_0x1f98('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1f98('0x3')]},'campaigntype':{'type':Sequelize[_0x1f98('0x3')]},'membername':{'type':Sequelize[_0x1f98('0x3')]}}; \ No newline at end of file +var _0xafdd=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xafdd,0x19a));var _0xdafd=function(_0x564240,_0x415973){_0x564240=_0x564240-0x0;var _0x40daa1=_0xafdd[_0x564240];return _0x40daa1;};'use strict';var Sequelize=require(_0xdafd('0x0'));module[_0xdafd('0x1')]={'state':{'type':Sequelize[_0xdafd('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xdafd('0x3')]},'scheduledat':{'type':Sequelize[_0xdafd('0x4')]},'uniqueid':{'type':Sequelize[_0xdafd('0x3')]},'starttime':{'type':Sequelize[_0xdafd('0x4')]},'responsetime':{'type':Sequelize[_0xdafd('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xdafd('0x3')]},'campaigntype':{'type':Sequelize[_0xdafd('0x3')]},'membername':{'type':Sequelize[_0xdafd('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 63bb489..41def45 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 _0x52af=['ReportAgentPreview','report_agent_preview','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define'];(function(_0xff7f2d,_0x46bffc){var _0x4fae82=function(_0xb8bf1f){while(--_0xb8bf1f){_0xff7f2d['push'](_0xff7f2d['shift']());}};_0x4fae82(++_0x46bffc);}(_0x52af,0xc8));var _0xf52a=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x52af[_0x5627e1];return _0x2f013f;};'use strict';var _=require('lodash');var util=require(_0xf52a('0x0'));var logger=require(_0xf52a('0x1'))(_0xf52a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf52a('0x3'));var fs=require('fs');var path=require(_0xf52a('0x4'));var rimraf=require(_0xf52a('0x5'));var config=require(_0xf52a('0x6'));var attributes=require(_0xf52a('0x7'));module['exports']=function(_0x58c5ee,_0x358fcf){return _0x58c5ee[_0xf52a('0x8')](_0xf52a('0x9'),attributes,{'tableName':_0xf52a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d01=['ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x0d01,0x1d0));var _0x10d0=function(_0x97efa4,_0x5dda1e){_0x97efa4=_0x97efa4-0x0;var _0x2ee8ec=_0x0d01[_0x97efa4];return _0x2ee8ec;};'use strict';var _=require(_0x10d0('0x0'));var util=require(_0x10d0('0x1'));var logger=require(_0x10d0('0x2'))(_0x10d0('0x3'));var moment=require('moment');var BPromise=require(_0x10d0('0x4'));var rp=require(_0x10d0('0x5'));var fs=require('fs');var path=require(_0x10d0('0x6'));var rimraf=require(_0x10d0('0x7'));var config=require(_0x10d0('0x8'));var attributes=require(_0x10d0('0x9'));module[_0x10d0('0xa')]=function(_0x2440aa,_0x2cc2a0){return _0x2440aa[_0x10d0('0xb')](_0x10d0('0xc'),attributes,{'tableName':_0x10d0('0xd'),'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 2500c45..6663f0f 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 _0x03de=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','create','body','options','raw','info','util'];(function(_0x48b66e,_0x461edb){var _0x151723=function(_0x1f1421){while(--_0x1f1421){_0x48b66e['push'](_0x48b66e['shift']());}};_0x151723(++_0x461edb);}(_0x03de,0x6b));var _0xe03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03de[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe03d('0x0'));var moment=require(_0xe03d('0x1'));var BPromise=require(_0xe03d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe03d('0x3'));var db=require(_0xe03d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe03d('0x5'))(_0xe03d('0x6'));var config=require(_0xe03d('0x7'));var jayson=require(_0xe03d('0x8'));var client=jayson[_0xe03d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x472fc3,_0x219319,_0x973bf5){return new BPromise(function(_0x491fb7,_0x2a44ba){return client[_0xe03d('0xa')](_0x472fc3,_0x973bf5)['then'](function(_0x3bda43){logger['info'](_0xe03d('0xb'),_0x219319,_0xe03d('0xc'));logger[_0xe03d('0xd')](_0xe03d('0xe'),_0x219319,_0xe03d('0xc'),JSON[_0xe03d('0xf')](_0x3bda43));if(_0x3bda43[_0xe03d('0x10')]){if(_0x3bda43['error'][_0xe03d('0x11')]===0x1f4){logger[_0xe03d('0x10')](_0xe03d('0xb'),_0x219319,_0x3bda43[_0xe03d('0x10')][_0xe03d('0x12')]);return _0x2a44ba(_0x3bda43[_0xe03d('0x10')][_0xe03d('0x12')]);}logger[_0xe03d('0x10')](_0xe03d('0xb'),_0x219319,_0x3bda43['error'][_0xe03d('0x12')]);return _0x491fb7(_0x3bda43[_0xe03d('0x10')][_0xe03d('0x12')]);}else{logger['info'](_0xe03d('0xb'),_0x219319,_0xe03d('0xc'));_0x491fb7(_0x3bda43[_0xe03d('0x13')][_0xe03d('0x12')]);}})[_0xe03d('0x14')](function(_0x3de712){logger[_0xe03d('0x10')](_0xe03d('0xb'),_0x219319,_0x3de712);_0x2a44ba(_0x3de712);});});}exports[_0xe03d('0x15')]=function(_0xd84d80){var _0x15a082=this;return new Promise(function(_0x5bf76c,_0x47564e){return db['ReportAgentPreview'][_0xe03d('0x16')](_0xd84d80[_0xe03d('0x17')],{'raw':_0xd84d80[_0xe03d('0x18')]?_0xd84d80[_0xe03d('0x18')][_0xe03d('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1e9a9f){logger[_0xe03d('0x1a')](_0xe03d('0x15'),_0xd84d80);logger[_0xe03d('0xd')](_0xe03d('0x15'),_0xd84d80,JSON['stringify'](_0x1e9a9f));_0x5bf76c(_0x1e9a9f);})[_0xe03d('0x14')](function(_0x468240){logger[_0xe03d('0x10')](_0xe03d('0x15'),_0x468240['message'],_0xd84d80);_0x47564e(_0x15a082[_0xe03d('0x10')](0x1f4,_0x468240[_0xe03d('0x12')]));});});}; \ No newline at end of file +var _0x8359=['../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4c3b1a,_0x155782){var _0x23bc51=function(_0x3fdd24){while(--_0x3fdd24){_0x4c3b1a['push'](_0x4c3b1a['shift']());}};_0x23bc51(++_0x155782);}(_0x8359,0x154));var _0x9835=function(_0x257896,_0x8de612){_0x257896=_0x257896-0x0;var _0x1ff242=_0x8359[_0x257896];return _0x1ff242;};'use strict';var _=require(_0x9835('0x0'));var util=require(_0x9835('0x1'));var moment=require(_0x9835('0x2'));var BPromise=require(_0x9835('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9835('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9835('0x5'));var logger=require(_0x9835('0x6'))(_0x9835('0x7'));var config=require(_0x9835('0x8'));var jayson=require(_0x9835('0x9'));var client=jayson[_0x9835('0xa')][_0x9835('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cb38e,_0x553f09,_0x42dc40){return new BPromise(function(_0x3e6358,_0x32e600){return client[_0x9835('0xc')](_0x5cb38e,_0x42dc40)[_0x9835('0xd')](function(_0x52f26b){logger['info'](_0x9835('0xe'),_0x553f09,_0x9835('0xf'));logger[_0x9835('0x10')](_0x9835('0x11'),_0x553f09,_0x9835('0xf'),JSON['stringify'](_0x52f26b));if(_0x52f26b[_0x9835('0x12')]){if(_0x52f26b[_0x9835('0x12')][_0x9835('0x13')]===0x1f4){logger[_0x9835('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x553f09,_0x52f26b['error']['message']);return _0x32e600(_0x52f26b[_0x9835('0x12')]['message']);}logger[_0x9835('0x12')](_0x9835('0xe'),_0x553f09,_0x52f26b['error'][_0x9835('0x14')]);return _0x3e6358(_0x52f26b[_0x9835('0x12')][_0x9835('0x14')]);}else{logger[_0x9835('0x15')](_0x9835('0xe'),_0x553f09,_0x9835('0xf'));_0x3e6358(_0x52f26b[_0x9835('0x16')][_0x9835('0x14')]);}})[_0x9835('0x17')](function(_0x4d24ab){logger[_0x9835('0x12')](_0x9835('0xe'),_0x553f09,_0x4d24ab);_0x32e600(_0x4d24ab);});});}exports[_0x9835('0x18')]=function(_0x2e2ba8){var _0x6edfb3=this;return new Promise(function(_0x404ce5,_0x205401){return db['ReportAgentPreview'][_0x9835('0x19')](_0x2e2ba8[_0x9835('0x1a')],{'raw':_0x2e2ba8[_0x9835('0x1b')]?_0x2e2ba8['options'][_0x9835('0x1c')]===undefined?!![]:![]:!![]})[_0x9835('0xd')](function(_0x5122f1){logger['info'](_0x9835('0x18'),_0x2e2ba8);logger[_0x9835('0x10')](_0x9835('0x18'),_0x2e2ba8,JSON['stringify'](_0x5122f1));_0x404ce5(_0x5122f1);})[_0x9835('0x17')](function(_0x47f872){logger[_0x9835('0x12')]('CreateReportAgentPreview',_0x47f872[_0x9835('0x14')],_0x2e2ba8);_0x205401(_0x6edfb3['error'](0x1f4,_0x47f872[_0x9835('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index f54b57c..43fb150 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 _0x62cb=['exports','multer','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','agents','put','/agents/:id/capacity','/telephones','trunks','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify'];(function(_0x329bfa,_0x58fdd0){var _0x4049d7=function(_0x1ba8c4){while(--_0x1ba8c4){_0x329bfa['push'](_0x329bfa['shift']());}};_0x4049d7(++_0x58fdd0);}(_0x62cb,0x15a));var _0xb62c=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x62cb[_0x26f702];return _0x11417d;};'use strict';var multer=require(_0xb62c('0x0'));var util=require('util');var path=require('path');var express=require(_0xb62c('0x1'));var router=express[_0xb62c('0x2')]();var auth=require(_0xb62c('0x3'));var controller=require(_0xb62c('0x4'));router[_0xb62c('0x5')](_0xb62c('0x6'),auth[_0xb62c('0x7')](),controller['voiceChannels']);router[_0xb62c('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0xb62c('0x8')]);router[_0xb62c('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xb62c('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0xb62c('0x5')](_0xb62c('0x9'),auth[_0xb62c('0x7')](),controller[_0xb62c('0xa')]);router['get']('/chat/queues',auth[_0xb62c('0x7')](),controller[_0xb62c('0xb')]);router[_0xb62c('0x5')](_0xb62c('0xc'),auth[_0xb62c('0x7')](),controller[_0xb62c('0xd')]);router['get'](_0xb62c('0xe'),auth[_0xb62c('0x7')](),controller[_0xb62c('0xf')]);router[_0xb62c('0x5')]('/openchannel/queues',auth[_0xb62c('0x7')](),controller[_0xb62c('0x10')]);router['get'](_0xb62c('0x11'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x12')]);router[_0xb62c('0x5')](_0xb62c('0x13'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x14')]);router['get'](_0xb62c('0x15'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x16')]);router[_0xb62c('0x5')](_0xb62c('0x17'),auth[_0xb62c('0x7')](),controller['voiceQueuesPreview']);router['get']('/voice/queues/channels',auth['isAuthenticated'](),controller[_0xb62c('0x18')]);router[_0xb62c('0x5')](_0xb62c('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xb62c('0x5')](_0xb62c('0x1a'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x1b')]);router[_0xb62c('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xb62c('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0xb62c('0x5')](_0xb62c('0x1c'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x1d')]);router['put'](_0xb62c('0x1c'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x1e')]);router[_0xb62c('0x5')]('/outbound',auth['isAuthenticated'](),controller[_0xb62c('0x1f')]);router['get']('/outbound/channels',auth[_0xb62c('0x7')](),controller['outboundChannels']);router[_0xb62c('0x5')]('/agents',auth[_0xb62c('0x7')](),controller[_0xb62c('0x20')]);router[_0xb62c('0x21')](_0xb62c('0x22'),auth[_0xb62c('0x7')](),controller['agentCapacity']);router[_0xb62c('0x5')](_0xb62c('0x23'),auth[_0xb62c('0x7')](),controller['telephones']);router[_0xb62c('0x5')]('/trunks',auth['isAuthenticated'](),controller[_0xb62c('0x24')]);router[_0xb62c('0x5')]('/campaigns',auth[_0xb62c('0x7')](),controller['campaigns']);router['get'](_0xb62c('0x25'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x26')]);router['get'](_0xb62c('0x27'),auth[_0xb62c('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0xb62c('0x5')]('/mail/queues/waitinginteractions',auth[_0xb62c('0x7')](),controller['mailQueuesWaitingInteractions']);router['get'](_0xb62c('0x28'),auth[_0xb62c('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0xb62c('0x5')](_0xb62c('0x29'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x2a')]);router[_0xb62c('0x5')](_0xb62c('0x2b'),auth[_0xb62c('0x7')](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xb62c('0x7')](),controller[_0xb62c('0x2c')]);router[_0xb62c('0x5')](_0xb62c('0x2d'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x2e')]);router[_0xb62c('0x2f')](_0xb62c('0x30'),auth['isAuthenticated'](),controller[_0xb62c('0x31')](_0xb62c('0x32')));router['get']('/mail/queues/:id',auth[_0xb62c('0x7')](),controller[_0xb62c('0x33')]);router[_0xb62c('0x2f')]('/chat/queues/:id/notify',auth[_0xb62c('0x7')](),controller['queueNotify'](_0xb62c('0x34')));router[_0xb62c('0x5')](_0xb62c('0x35'),auth['isAuthenticated'](),controller[_0xb62c('0x36')]);router[_0xb62c('0x2f')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0xb62c('0x31')]('fax'));router['get'](_0xb62c('0x37'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x38')]);router[_0xb62c('0x2f')](_0xb62c('0x39'),auth[_0xb62c('0x7')](),controller['queueNotify'](_0xb62c('0x3a')));router[_0xb62c('0x5')](_0xb62c('0x3b'),auth['isAuthenticated'](),controller[_0xb62c('0x3c')]);router['post'](_0xb62c('0x3d'),auth['isAuthenticated'](),controller['queueNotify'](_0xb62c('0x3e')));router[_0xb62c('0x2f')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0xb62c('0x31')](_0xb62c('0x3f')));router['get']('/sms/queues/:id',auth[_0xb62c('0x7')](),controller['showSmsQueues']);router['get'](_0xb62c('0x40'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x41')]);router[_0xb62c('0x2f')](_0xb62c('0x42'),auth['isAuthenticated'](),controller[_0xb62c('0x43')]);module[_0xb62c('0x44')]=router; \ No newline at end of file +var _0x42dc=['/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','queueNotify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','chatQueues','mailQueues','/mail/accounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/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','voiceQueuesChannelRedirect','/voice/queues/:id','put','/outbound','outbound','outboundChannels','/agents','agents'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x42dc,0xd0));var _0xc42d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x42dc[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xc42d('0x0'));var util=require(_0xc42d('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0xc42d('0x2'));var controller=require(_0xc42d('0x3'));router[_0xc42d('0x4')](_0xc42d('0x5'),auth[_0xc42d('0x6')](),controller['voiceChannels']);router[_0xc42d('0x4')](_0xc42d('0x7'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x8')]);router[_0xc42d('0x4')](_0xc42d('0x9'),auth[_0xc42d('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0xc42d('0x4')](_0xc42d('0xa'),auth[_0xc42d('0x6')](),controller[_0xc42d('0xb')]);router[_0xc42d('0x4')]('/chat/queues',auth['isAuthenticated'](),controller[_0xc42d('0xc')]);router[_0xc42d('0x4')]('/mail/queues',auth[_0xc42d('0x6')](),controller[_0xc42d('0xd')]);router[_0xc42d('0x4')](_0xc42d('0xe'),auth[_0xc42d('0x6')](),controller['mailAccounts']);router['get'](_0xc42d('0xf'),auth[_0xc42d('0x6')](),controller['openchannelQueues']);router[_0xc42d('0x4')](_0xc42d('0x10'),auth['isAuthenticated'](),controller[_0xc42d('0x11')]);router['get'](_0xc42d('0x12'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x13')]);router[_0xc42d('0x4')](_0xc42d('0x14'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x15')]);router[_0xc42d('0x4')](_0xc42d('0x16'),auth[_0xc42d('0x6')](),controller['voiceQueuesPreview']);router[_0xc42d('0x4')](_0xc42d('0x17'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x18')]);router[_0xc42d('0x4')](_0xc42d('0x19'),auth['isAuthenticated'](),controller[_0xc42d('0x1a')]);router[_0xc42d('0x4')](_0xc42d('0x1b'),auth['isAuthenticated'](),controller[_0xc42d('0x1c')]);router[_0xc42d('0x4')](_0xc42d('0x1d'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x1e')]);router[_0xc42d('0x4')](_0xc42d('0x1f'),auth[_0xc42d('0x6')](),controller['showVoiceQueues']);router[_0xc42d('0x20')]('/voice/queues/:id',auth['isAuthenticated'](),controller['updateVoiceQueue']);router['get'](_0xc42d('0x21'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x22')]);router[_0xc42d('0x4')]('/outbound/channels',auth[_0xc42d('0x6')](),controller[_0xc42d('0x23')]);router[_0xc42d('0x4')](_0xc42d('0x24'),auth['isAuthenticated'](),controller[_0xc42d('0x25')]);router[_0xc42d('0x20')](_0xc42d('0x26'),auth['isAuthenticated'](),controller[_0xc42d('0x27')]);router[_0xc42d('0x4')](_0xc42d('0x28'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x29')]);router[_0xc42d('0x4')](_0xc42d('0x2a'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x2b')]);router['get'](_0xc42d('0x2c'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x2d')]);router['get']('/fax/accounts',auth[_0xc42d('0x6')](),controller[_0xc42d('0x2e')]);router['get']('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xc42d('0x2f')]);router[_0xc42d('0x4')](_0xc42d('0x30'),auth[_0xc42d('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0xc42d('0x4')](_0xc42d('0x31'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xc42d('0x4')](_0xc42d('0x32'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x33')]);router[_0xc42d('0x4')](_0xc42d('0x34'),auth['isAuthenticated'](),controller[_0xc42d('0x35')]);router[_0xc42d('0x4')](_0xc42d('0x36'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x37')]);router[_0xc42d('0x4')](_0xc42d('0x38'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x39')]);router['post']('/mail/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xc42d('0x3a')));router[_0xc42d('0x4')](_0xc42d('0x3b'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x3c')]);router[_0xc42d('0x3d')](_0xc42d('0x3e'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x3f')](_0xc42d('0x40')));router[_0xc42d('0x4')]('/chat/queues/:id',auth[_0xc42d('0x6')](),controller[_0xc42d('0x41')]);router[_0xc42d('0x3d')](_0xc42d('0x42'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x3f')](_0xc42d('0x43')));router[_0xc42d('0x4')](_0xc42d('0x44'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x45')]);router['post'](_0xc42d('0x46'),auth['isAuthenticated'](),controller[_0xc42d('0x3f')]('openchannel'));router[_0xc42d('0x4')](_0xc42d('0x47'),auth['isAuthenticated'](),controller[_0xc42d('0x48')]);router[_0xc42d('0x3d')](_0xc42d('0x49'),auth['isAuthenticated'](),controller[_0xc42d('0x3f')]('sms'));router[_0xc42d('0x3d')](_0xc42d('0x4a'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x3f')]('whatsapp'));router['get'](_0xc42d('0x4b'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x4c')]);router[_0xc42d('0x4')](_0xc42d('0x4d'),auth['isAuthenticated'](),controller[_0xc42d('0x4e')]);router[_0xc42d('0x3d')](_0xc42d('0x4f'),auth[_0xc42d('0x6')](),controller[_0xc42d('0x50')]);module[_0xc42d('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e26b497..07491b3 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['name','send','isNil','find','rows','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','INTERACTION','agent','internal','AgentCapacity','telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','queue_id','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','catch','status','sendStatus','stack'];(function(_0x2235f2,_0xa0a033){var _0x228ce4=function(_0x15da22){while(--_0x15da22){_0x2235f2['push'](_0x2235f2['shift']());}};_0x228ce4(++_0xa0a033);}(_0x8ef6,0xf2));var _0x68ef=function(_0x188297,_0xaaee53){_0x188297=_0x188297-0x0;var _0x1711bc=_0x8ef6[_0x188297];return _0x1711bc;};'use strict';var BPromise=require(_0x68ef('0x0'));var moment=require(_0x68ef('0x1'));var _=require(_0x68ef('0x2'));var util=require(_0x68ef('0x3'));var db=require(_0x68ef('0x4'))['db'];var logger=require(_0x68ef('0x5'))(_0x68ef('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x68ef('0x7')][_0x68ef('0x8')]({'port':0x232a});var mailClient=jayson[_0x68ef('0x7')][_0x68ef('0x8')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){var _0x31007e=_0x2de776?_0x2de776:amiClient;return _0x31007e[_0x68ef('0x9')](_0x3c2ff3,_0x4740e8)[_0x68ef('0xa')](function(_0x112b18){if(_0x112b18[_0x68ef('0xb')]){if(_0x112b18[_0x68ef('0xb')][_0x68ef('0xc')]===0x1f4){return _0x228967(_0x112b18[_0x68ef('0xb')][_0x68ef('0xd')]);}return _0x4eb5eb(_0x112b18[_0x68ef('0xb')][_0x68ef('0xd')]);}else{_0x4eb5eb(_0x112b18['result']);}})[_0x68ef('0xe')](function(_0x46356f){_0x228967(_0x46356f);});});}function respondWithResult(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xc8;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0xf')](_0x454ef4)['json'](_0x40f253);}return _0x1e117a[_0x68ef('0x10')](0x194);};}function handleError(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0x1f4;return function(_0x47fbb5){logger[_0x68ef('0xb')](_0x47fbb5[_0x68ef('0x11')]);if(_0x47fbb5[_0x68ef('0x12')]){delete _0x47fbb5['name'];}_0xc50cce[_0x68ef('0xf')](_0x2657c5)[_0x68ef('0x13')](_0x47fbb5);};}function findById(_0x3d1e90){return function(_0x3780a4){if(!_['isNil'](_0x3d1e90)&&!_[_0x68ef('0x14')](_0x3780a4)&&!_['isNil'](_0x3780a4['rows'])){return _[_0x68ef('0x15')](_0x3780a4[_0x68ef('0x16')],function(_0x4ade0d){return _0x4ade0d['id']==_0x3d1e90;});}return null;};}exports['voiceChannels']=function(_0x3c4c1f,_0x2cd92c){return respondWithRpcPromise(_0x68ef('0x17'),_0x3c4c1f['query'])[_0x68ef('0xa')](respondWithResult(_0x2cd92c,null))[_0x68ef('0xe')](handleError(_0x2cd92c,null));};exports[_0x68ef('0x18')]=function(_0x5b246b,_0x3c46d4){return respondWithRpcPromise(_0x68ef('0x19'),_['merge'](_0x5b246b[_0x68ef('0x1a')],_0x5b246b[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x3c46d4,null))['catch'](handleError(_0x3c46d4,null));};exports['voiceChannelStopMixMonitor']=function(_0x59bebc,_0x26018d){return respondWithRpcPromise(_0x68ef('0x1c'),_[_0x68ef('0x1d')](_0x59bebc[_0x68ef('0x1a')],_0x59bebc[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x26018d,null))[_0x68ef('0xe')](handleError(_0x26018d,null));};exports[_0x68ef('0x1e')]=function(_0x65fd09,_0x13280b){return respondWithRpcPromise('VoiceQueues',_0x65fd09[_0x68ef('0x1a')])['then'](respondWithResult(_0x13280b,null))['catch'](handleError(_0x13280b,null));};exports['showVoiceQueues']=function(_0x1a7ce1,_0x268f32){return respondWithRpcPromise(_0x68ef('0x1f'),_0x1a7ce1[_0x68ef('0x1a')])['then'](findById(_0x1a7ce1['params']['id']))[_0x68ef('0xa')](respondWithResult(_0x268f32,null))[_0x68ef('0xe')](handleError(_0x268f32,null));};exports[_0x68ef('0x20')]=function(_0x263b30,_0x22ef25){return respondWithRpcPromise(_0x68ef('0x21'),_[_0x68ef('0x1d')](_0x263b30[_0x68ef('0x22')],_0x263b30['params']))[_0x68ef('0xa')](respondWithResult(_0x22ef25,null))[_0x68ef('0xe')](handleError(_0x22ef25,null));};exports[_0x68ef('0x23')]=function(_0x4c25aa,_0x370a8f){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x68ef('0x1d')](_0x4c25aa[_0x68ef('0x1a')],_0x4c25aa['params']))['then'](respondWithResult(_0x370a8f,null))[_0x68ef('0xe')](handleError(_0x370a8f,null));};exports[_0x68ef('0x24')]=function(_0x4b8fc8,_0xf58fa1){return respondWithRpcPromise(_0x68ef('0x25'),_0x4b8fc8[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0xf58fa1,null))['catch'](handleError(_0xf58fa1,null));};exports[_0x68ef('0x26')]=function(_0x1d69ac,_0x5f137b){return respondWithRpcPromise(_0x68ef('0x27'),_['merge'](_0x1d69ac[_0x68ef('0x1a')],_0x1d69ac[_0x68ef('0x1b')]))['then'](respondWithResult(_0x5f137b,null))[_0x68ef('0xe')](handleError(_0x5f137b,null));};exports['voiceQueuesChannelHangup']=function(_0x38c2f8,_0x575f43){return respondWithRpcPromise(_0x68ef('0x28'),_[_0x68ef('0x1d')](_0x38c2f8[_0x68ef('0x1a')],_0x38c2f8['params']))[_0x68ef('0xa')](respondWithResult(_0x575f43,null))['catch'](handleError(_0x575f43,null));};exports[_0x68ef('0x29')]=function(_0x4c9506,_0x474ffa){return respondWithRpcPromise(_0x68ef('0x2a'),_[_0x68ef('0x1d')](_0x4c9506[_0x68ef('0x1a')],_0x4c9506[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x474ffa,null))['catch'](handleError(_0x474ffa,null));};exports[_0x68ef('0x2b')]=function(_0x15a6ab,_0x32074a){return respondWithRpcPromise('Outbound',_0x15a6ab[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x32074a,null))[_0x68ef('0xe')](handleError(_0x32074a,null));};exports['outboundChannels']=function(_0x49f260,_0x14f0fc){return respondWithRpcPromise(_0x68ef('0x2c'),_0x49f260[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x14f0fc,null))[_0x68ef('0xe')](handleError(_0x14f0fc,null));};exports[_0x68ef('0x2d')]=function(_0x41ffe0,_0x5b1246){var _0xaf7df1;return respondWithRpcPromise(_0x68ef('0x2e'),_0x41ffe0[_0x68ef('0x1a')])[_0x68ef('0xa')](function(_0x492b74){_0xaf7df1=_0x492b74;return respondWithRpcPromise(_0x68ef('0x2e'),_0x41ffe0[_0x68ef('0x1a')],routingClient);})[_0x68ef('0xa')](function(_0x410c10){return _[_0x68ef('0x1d')]({},_0x410c10,_0xaf7df1);})[_0x68ef('0xa')](respondWithResult(_0x5b1246,null))['catch'](handleError(_0x5b1246,null));};exports[_0x68ef('0x2f')]=function(_0x3f7699,_0xf5010c){if(_0x3f7699[_0x68ef('0x22')]&&_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')]&&_0x3f7699[_0x68ef('0x31')]&&_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')]){for(var _0x531096 in _0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')]){if(_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x68ef('0x32')](_0x531096)){db[_0x68ef('0x33')][_0x68ef('0x34')]({'where':{'channel':_0x531096,'membername':_0x3f7699['user'][_0x68ef('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x531096]&&_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x531096]['length']?{'$notIn':_0x3f7699[_0x68ef('0x22')]['interaction'][_0x531096]}:{'$ne':null}}})[_0x68ef('0xa')](function(_0x499423){var _0x227e36=moment()[_0x68ef('0x35')](_0x68ef('0x36'));for(var _0x5c4a66=0x0,_0x59b148=_0x499423[_0x68ef('0x37')];_0x5c4a66<_0x59b148;_0x5c4a66+=0x1){_0x499423[_0x5c4a66][_0x68ef('0x38')]({'exitAt':_0x227e36});}});for(var _0x58d72a=0x0;_0x58d72a<_0x3f7699['body']['interaction'][_0x531096][_0x68ef('0x37')];_0x58d72a+=0x1){db[_0x68ef('0x33')][_0x68ef('0x39')]({'where':{'channel':_0x531096,'membername':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')],'type':'INTERACTION','uniqueid':_0x3f7699['body'][_0x68ef('0x30')][_0x531096][_0x58d72a],'exitAt':null},'defaults':{'channel':_0x531096,'membername':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')],'interface':_[_0x68ef('0x14')](_0x3f7699['user'][_0x68ef('0x3a')])?util[_0x68ef('0x35')](_0x68ef('0x3b'),_0x3f7699[_0x68ef('0x31')]['name']):_0x3f7699['user'][_0x68ef('0x3a')],'type':_0x68ef('0x3c'),'enterAt':moment()['format'](_0x68ef('0x36')),'role':_0x68ef('0x3d'),'internal':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x3e')],'uniqueid':_0x3f7699[_0x68ef('0x22')]['interaction'][_0x531096][_0x58d72a]}});}}}}return respondWithRpcPromise(_0x68ef('0x3f'),{'id':_0x3f7699[_0x68ef('0x1b')]['id'],'capacity':_0x3f7699[_0x68ef('0x22')]['capacity']},routingClient)[_0x68ef('0xa')](respondWithResult(_0xf5010c,null))[_0x68ef('0xe')](handleError(_0xf5010c,null));};exports[_0x68ef('0x40')]=function(_0x50ef1f,_0x7dce90){return respondWithRpcPromise('Telephones',_0x50ef1f['query'])[_0x68ef('0xa')](respondWithResult(_0x7dce90,null))['catch'](handleError(_0x7dce90,null));};exports[_0x68ef('0x41')]=function(_0xb33afd,_0x53ebd){return respondWithRpcPromise(_0x68ef('0x42'),_0xb33afd[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x53ebd,null))[_0x68ef('0xe')](handleError(_0x53ebd,null));};exports[_0x68ef('0x43')]=function(_0x2b35f4,_0x247915){return respondWithRpcPromise('Campaigns',_0x2b35f4['query'])[_0x68ef('0xa')](respondWithResult(_0x247915,null))[_0x68ef('0xe')](handleError(_0x247915,null));};exports[_0x68ef('0x44')]=function(_0xdc83f4,_0x82df12){return respondWithRpcPromise(_0x68ef('0x45'),_0xdc83f4[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x82df12,null))[_0x68ef('0xe')](handleError(_0x82df12,null));};exports['showChatQueues']=function(_0x5685bb,_0x42a4b2){return respondWithRpcPromise('ChatQueues',_0x5685bb[_0x68ef('0x1a')],routingClient)['then'](findById(_0x5685bb[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x42a4b2,null))['catch'](handleError(_0x42a4b2,null));};exports[_0x68ef('0x46')]=function(_0x4e097e,_0x407c6d){return respondWithRpcPromise(_0x68ef('0x47'),_0x4e097e[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x407c6d,null))[_0x68ef('0xe')](handleError(_0x407c6d,null));};exports[_0x68ef('0x48')]=function(_0x5c347c,_0x1cdaef){return respondWithRpcPromise(_0x68ef('0x47'),_0x5c347c[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x5c347c[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x1cdaef,null))['catch'](handleError(_0x1cdaef,null));};exports[_0x68ef('0x49')]=function(_0x42d2a3,_0x4886af){return respondWithRpcPromise(_0x68ef('0x4a'),_0x42d2a3[_0x68ef('0x1a')],mailClient)[_0x68ef('0xa')](respondWithResult(_0x4886af,null))['catch'](handleError(_0x4886af,null));};exports[_0x68ef('0x4b')]=function(_0x49d197,_0x5412ea){return respondWithRpcPromise(_0x68ef('0x4c'),_0x49d197['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x5412ea,null))['catch'](handleError(_0x5412ea,null));};exports[_0x68ef('0x4d')]=function(_0x9e8554,_0x304405){return respondWithRpcPromise(_0x68ef('0x4c'),_0x9e8554[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x9e8554['params']['id']))[_0x68ef('0xa')](respondWithResult(_0x304405,null))['catch'](handleError(_0x304405,null));};exports[_0x68ef('0x4e')]=function(_0x4b0c3e,_0x2f97c5){return respondWithRpcPromise(_0x68ef('0x4f'),_0x4b0c3e[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x2f97c5,null))[_0x68ef('0xe')](handleError(_0x2f97c5,null));};exports[_0x68ef('0x50')]=function(_0x1be626,_0x52d29a){return respondWithRpcPromise(_0x68ef('0x4f'),_0x1be626[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x1be626[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x52d29a,null))['catch'](handleError(_0x52d29a,null));};exports[_0x68ef('0x51')]=function(_0x561e8d,_0x1ed172){return respondWithRpcPromise('WhatsappQueues',_0x561e8d['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x1ed172,null))[_0x68ef('0xe')](handleError(_0x1ed172,null));};exports[_0x68ef('0x52')]=function(_0x21b2ce,_0x51f905){return respondWithRpcPromise(_0x68ef('0x53'),_0x21b2ce['query'],routingClient)[_0x68ef('0xa')](findById(_0x21b2ce[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x51f905,null))['catch'](handleError(_0x51f905,null));};exports['faxQueues']=function(_0x3e74d2,_0x1092f8){return respondWithRpcPromise(_0x68ef('0x54'),_0x3e74d2[_0x68ef('0x1a')],routingClient)['then'](respondWithResult(_0x1092f8,null))[_0x68ef('0xe')](handleError(_0x1092f8,null));};exports[_0x68ef('0x55')]=function(_0x19c20f,_0x21b104){return respondWithRpcPromise('FaxQueues',_0x19c20f[_0x68ef('0x1a')],routingClient)['then'](findById(_0x19c20f[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x21b104,null))[_0x68ef('0xe')](handleError(_0x21b104,null));};exports[_0x68ef('0x56')]=function(_0xed16d1,_0x52cb2a){return respondWithRpcPromise(_0x68ef('0x57'),_0xed16d1[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x52cb2a,null))['catch'](handleError(_0x52cb2a,null));};exports[_0x68ef('0x58')]=function(_0x4de108,_0x69b1c){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4de108['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x69b1c,null))[_0x68ef('0xe')](handleError(_0x69b1c,null));};exports[_0x68ef('0x59')]=function(_0x405971,_0x501004){return respondWithRpcPromise(_0x68ef('0x5a'),_0x405971[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x501004,null))['catch'](handleError(_0x501004,null));};exports[_0x68ef('0x5b')]=function(_0x2db826,_0xea2a81){return respondWithRpcPromise(_0x68ef('0x5c'),_0x2db826[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0xea2a81,null))[_0x68ef('0xe')](handleError(_0xea2a81,null));};exports[_0x68ef('0x5d')]=function(_0x156ce3,_0x11feff){return respondWithRpcPromise(_0x68ef('0x5c'),_0x156ce3[_0x68ef('0x1a')],routingClient)['then'](function(_0x15378c){if(_0x156ce3[_0x68ef('0x1a')]['type']!==undefined){var _0x513c69=_(_0x15378c[_0x68ef('0x16')])['filter']([_0x156ce3[_0x68ef('0x1a')][_0x68ef('0x5e')],_0x156ce3['params']['id']])['map'](_0x68ef('0x5f'))['uniq']()[_0x68ef('0x60')]();return _0x15378c['rows'][_0x68ef('0x61')](function(_0x4f425f){return _0x513c69[_0x68ef('0x62')](_0x4f425f[_0x68ef('0x5f')])>-0x1;});}else{return _0x15378c['rows'][_0x68ef('0x61')](function(_0x357be7){return _0x357be7[_0x68ef('0x5f')]===parseInt(_0x156ce3[_0x68ef('0x1b')]['id']);});}})['then'](respondWithResult(_0x11feff,null))[_0x68ef('0xe')](handleError(_0x11feff,null));};exports[_0x68ef('0x63')]=function(_0x5b2e89,_0x3bb3b6){return respondWithRpcPromise(_0x68ef('0x64'),_0x5b2e89[_0x68ef('0x1a')],routingClient)['then'](respondWithResult(_0x3bb3b6,null))[_0x68ef('0xe')](handleError(_0x3bb3b6,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xe6bf05,_0x36c109){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0xe6bf05['query'],routingClient)['then'](respondWithResult(_0x36c109,null))['catch'](handleError(_0x36c109,null));};exports[_0x68ef('0x65')]=function(_0x28ad22,_0x1217f9){return respondWithRpcPromise(_0x68ef('0x66'),_0x28ad22[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x1217f9,null))[_0x68ef('0xe')](handleError(_0x1217f9,null));};exports[_0x68ef('0x67')]=function(_0x24ba34){return function(_0x3ae3e9,_0x17892c){var _0x108223,_0x717d7b;var _0x4bd5c3=_[_0x68ef('0x68')](_0x24ba34);var _0x556dfc=_0x24ba34===_0x68ef('0x69')?'Website':'Account';return db[_0x4bd5c3+_0x68ef('0x6a')][_0x68ef('0x6b')]({'raw':!![],'where':{'id':_0x3ae3e9[_0x68ef('0x1b')]['id']}})[_0x68ef('0xa')](function(_0x518c9a){if(_['isNil'](_0x518c9a)){throw new Error(_0x4bd5c3+_0x68ef('0x6c'));}_0x108223=_0x518c9a;return db[_0x4bd5c3+_0x68ef('0x6d')][_0x68ef('0x6b')]({'where':{'id':_0x3ae3e9['body'][_0x68ef('0x6e')]},'include':[{'model':db[_0x4bd5c3+_0x68ef('0x6f')],'as':_0x68ef('0x6f')},{'model':db[_0x4bd5c3+_0x556dfc],'as':_0x68ef('0x70')}]});})['then'](function(_0x214e89){if(_[_0x68ef('0x14')](_0x214e89)){throw new Error(_0x4bd5c3+_0x68ef('0x71'));}_0x717d7b=_0x214e89;return _0x214e89[_0x68ef('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x68ef('0xa')](function(){var _0x346049={'uniqueid':_0x24ba34+'.'+_0x717d7b['id']+'.'+_0x717d7b['Interaction']['id'],'FromUserId':_0x3ae3e9[_0x68ef('0x31')]['id'],'type':'queue'};_0x346049[_0x4bd5c3+_0x68ef('0x73')]=_0x717d7b['id'];_0x346049[_0x4bd5c3+_0x68ef('0x74')]=_0x717d7b[_0x68ef('0x6f')]['id'];_0x346049[_0x68ef('0x75')+_0x4bd5c3+_0x556dfc+'Id']=_0x717d7b['Account']['id'];_0x346049['To'+_0x4bd5c3+_0x68ef('0x76')]=_0x108223['id'];return db[_0x4bd5c3+'TransferReport'][_0x68ef('0x77')](_0x346049);})[_0x68ef('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x24ba34,'interaction':_0x717d7b['Interaction'],'message':_0x717d7b,'account':_0x717d7b[_0x68ef('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x108223[_0x68ef('0x12')]+','+(_0x717d7b['Account'][_0x68ef('0x78')]||0x12c),'interval':_0x68ef('0x79')}]},routingClient);})[_0x68ef('0xa')](respondWithResult(_0x17892c,null))[_0x68ef('0xe')](handleError(_0x17892c,null));};};exports[_0x68ef('0x7a')]=function(_0x66a7a8,_0x51b8db){var _0x17d014,_0x463356;if(_[_0x68ef('0x14')](_0x66a7a8[_0x68ef('0x22')][_0x68ef('0x7b')])){throw new Error(_0x68ef('0x7c'));}var _0x303add=_0x66a7a8['body'][_0x68ef('0x7b')];var _0x373ab4=_[_0x68ef('0x68')](_0x303add);var _0x2e20aa=_0x303add===_0x68ef('0x69')?_0x68ef('0x7d'):_0x68ef('0x70');return db[_0x68ef('0x7e')][_0x68ef('0x6b')]({'raw':!![],'where':{'id':_0x66a7a8['params']['id'],'role':_0x68ef('0x3d')}})['then'](function(_0x5f3b79){if(_['isNil'](_0x5f3b79)){throw new Error(_0x68ef('0x7f'));}_0x17d014=_0x5f3b79;return db[_0x373ab4+_0x68ef('0x6d')][_0x68ef('0x6b')]({'where':{'id':_0x66a7a8['body']['messageId']},'include':[{'model':db[_0x373ab4+'Interaction'],'as':_0x68ef('0x6f')},{'model':db[_0x373ab4+_0x2e20aa],'as':_0x68ef('0x70')}]});})[_0x68ef('0xa')](function(_0x40996e){if(_[_0x68ef('0x14')](_0x40996e)){throw new Error(_0x373ab4+_0x68ef('0x71'));}_0x463356=_0x40996e;return _0x40996e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x68ef('0xa')](function(){var _0x2c7f18={'uniqueid':_0x303add+'.'+_0x463356['id']+'.'+_0x463356[_0x68ef('0x6f')]['id'],'FromUserId':_0x66a7a8[_0x68ef('0x31')]['id'],'type':'queue','ToUserId':_0x17d014['id']};_0x2c7f18[_0x373ab4+_0x68ef('0x73')]=_0x463356['id'];_0x2c7f18[_0x373ab4+_0x68ef('0x74')]=_0x463356[_0x68ef('0x6f')]['id'];_0x2c7f18[_0x68ef('0x75')+_0x373ab4+_0x2e20aa+'Id']=_0x463356[_0x68ef('0x70')]['id'];return db[_0x373ab4+_0x68ef('0x80')][_0x68ef('0x77')](_0x2c7f18);})[_0x68ef('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x303add,'interaction':_0x463356[_0x68ef('0x6f')],'message':_0x463356,'account':_0x463356[_0x68ef('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x17d014[_0x68ef('0x12')]+','+(_0x463356[_0x68ef('0x70')][_0x68ef('0x81')]||0x12c),'interval':_0x68ef('0x79')}]},routingClient);})[_0x68ef('0xa')](respondWithResult(_0x51b8db,null))[_0x68ef('0xe')](handleError(_0x51b8db,null));}; \ No newline at end of file +var _0x7dfd=['interface','format','SIP/%s','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','queue_id','uniq','filter','indexOf','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','findOne','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes'];(function(_0x10712d,_0x3b8e83){var _0x37fec4=function(_0x431fb0){while(--_0x431fb0){_0x10712d['push'](_0x10712d['shift']());}};_0x37fec4(++_0x3b8e83);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xd7df('0x0'));var moment=require(_0xd7df('0x1'));var _=require(_0xd7df('0x2'));var util=require(_0xd7df('0x3'));var db=require(_0xd7df('0x4'))['db'];var logger=require(_0xd7df('0x5'))(_0xd7df('0x6'));var jayson=require(_0xd7df('0x7'));var amiClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232a});var mailClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232b});var routingClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){var _0xb3557a=_0x2c48a4?_0x2c48a4:amiClient;return _0xb3557a[_0xd7df('0xa')](_0x354ea7,_0x16e50)[_0xd7df('0xb')](function(_0x5e59c3){if(_0x5e59c3[_0xd7df('0xc')]){if(_0x5e59c3['error'][_0xd7df('0xd')]===0x1f4){return _0xab6742(_0x5e59c3['error'][_0xd7df('0xe')]);}return _0x5c220a(_0x5e59c3[_0xd7df('0xc')][_0xd7df('0xe')]);}else{_0x5c220a(_0x5e59c3[_0xd7df('0xf')]);}})[_0xd7df('0x10')](function(_0x174c88){_0xab6742(_0x174c88);});});}function respondWithResult(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xc8;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x11')](_0x3da618)[_0xd7df('0x12')](_0x7ba3c);}return _0x2e8187[_0xd7df('0x13')](0x194);};}function handleError(_0xe1595f,_0x196632){_0x196632=_0x196632||0x1f4;return function(_0x3b2559){logger[_0xd7df('0xc')](_0x3b2559[_0xd7df('0x14')]);if(_0x3b2559['name']){delete _0x3b2559[_0xd7df('0x15')];}_0xe1595f[_0xd7df('0x11')](_0x196632)['send'](_0x3b2559);};}function findById(_0x18d38f){return function(_0xbe1c5e){if(!_['isNil'](_0x18d38f)&&!_[_0xd7df('0x16')](_0xbe1c5e)&&!_[_0xd7df('0x16')](_0xbe1c5e[_0xd7df('0x17')])){return _['find'](_0xbe1c5e[_0xd7df('0x17')],function(_0x471621){return _0x471621['id']==_0x18d38f;});}return null;};}exports[_0xd7df('0x18')]=function(_0x5ba653,_0x96d86e){return respondWithRpcPromise(_0xd7df('0x19'),_0x5ba653[_0xd7df('0x1a')])['then'](respondWithResult(_0x96d86e,null))[_0xd7df('0x10')](handleError(_0x96d86e,null));};exports['voiceChannelMixMonitor']=function(_0x225e33,_0x5ab737){return respondWithRpcPromise(_0xd7df('0x1b'),_[_0xd7df('0x1c')](_0x225e33[_0xd7df('0x1a')],_0x225e33['params']))[_0xd7df('0xb')](respondWithResult(_0x5ab737,null))['catch'](handleError(_0x5ab737,null));};exports[_0xd7df('0x1d')]=function(_0x379e4a,_0x40e7af){return respondWithRpcPromise(_0xd7df('0x1e'),_[_0xd7df('0x1c')](_0x379e4a[_0xd7df('0x1a')],_0x379e4a[_0xd7df('0x1f')]))['then'](respondWithResult(_0x40e7af,null))['catch'](handleError(_0x40e7af,null));};exports[_0xd7df('0x20')]=function(_0x38db14,_0x26047f){return respondWithRpcPromise(_0xd7df('0x21'),_0x38db14[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x26047f,null))[_0xd7df('0x10')](handleError(_0x26047f,null));};exports[_0xd7df('0x22')]=function(_0x163904,_0x5c4d17){return respondWithRpcPromise(_0xd7df('0x21'),_0x163904[_0xd7df('0x1a')])[_0xd7df('0xb')](findById(_0x163904[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x5c4d17,null))[_0xd7df('0x10')](handleError(_0x5c4d17,null));};exports[_0xd7df('0x23')]=function(_0x36de76,_0x5195cf){return respondWithRpcPromise('UpdateVoiceQueue',_['merge'](_0x36de76['body'],_0x36de76['params']))[_0xd7df('0xb')](respondWithResult(_0x5195cf,null))['catch'](handleError(_0x5195cf,null));};exports[_0xd7df('0x24')]=function(_0x156612,_0x503a90){return respondWithRpcPromise(_0xd7df('0x25'),_[_0xd7df('0x1c')](_0x156612['query'],_0x156612[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x503a90,null))[_0xd7df('0x10')](handleError(_0x503a90,null));};exports[_0xd7df('0x26')]=function(_0x40f965,_0x3304c4){return respondWithRpcPromise('VoiceQueuesChannels',_0x40f965[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x3304c4,null))[_0xd7df('0x10')](handleError(_0x3304c4,null));};exports[_0xd7df('0x27')]=function(_0x363f2d,_0x4cecf2){return respondWithRpcPromise(_0xd7df('0x28'),_[_0xd7df('0x1c')](_0x363f2d[_0xd7df('0x1a')],_0x363f2d[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x4cecf2,null))['catch'](handleError(_0x4cecf2,null));};exports['voiceQueuesChannelHangup']=function(_0x4051fb,_0x564562){return respondWithRpcPromise(_0xd7df('0x29'),_[_0xd7df('0x1c')](_0x4051fb[_0xd7df('0x1a')],_0x4051fb[_0xd7df('0x1f')]))['then'](respondWithResult(_0x564562,null))['catch'](handleError(_0x564562,null));};exports['voiceQueuesChannelRedirect']=function(_0x2a96e3,_0x15e682){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd7df('0x1c')](_0x2a96e3[_0xd7df('0x1a')],_0x2a96e3[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x15e682,null))['catch'](handleError(_0x15e682,null));};exports[_0xd7df('0x2a')]=function(_0x45642c,_0x5f0a6d){return respondWithRpcPromise(_0xd7df('0x2b'),_0x45642c['query'])[_0xd7df('0xb')](respondWithResult(_0x5f0a6d,null))[_0xd7df('0x10')](handleError(_0x5f0a6d,null));};exports[_0xd7df('0x2c')]=function(_0x59c755,_0x138391){return respondWithRpcPromise(_0xd7df('0x2d'),_0x59c755[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x138391,null))['catch'](handleError(_0x138391,null));};exports[_0xd7df('0x2e')]=function(_0x230857,_0x2314e6){var _0x4f6286;return respondWithRpcPromise(_0xd7df('0x2f'),_0x230857[_0xd7df('0x1a')])[_0xd7df('0xb')](function(_0x517824){_0x4f6286=_0x517824;return respondWithRpcPromise(_0xd7df('0x2f'),_0x230857[_0xd7df('0x1a')],routingClient);})['then'](function(_0x4b2561){return _[_0xd7df('0x1c')]({},_0x4b2561,_0x4f6286);})[_0xd7df('0xb')](respondWithResult(_0x2314e6,null))[_0xd7df('0x10')](handleError(_0x2314e6,null));};exports['agentCapacity']=function(_0x5e8cd0,_0x2c149e){if(_0x5e8cd0['body']&&_0x5e8cd0[_0xd7df('0x30')]['interaction']&&_0x5e8cd0['user']&&_0x5e8cd0[_0xd7df('0x31')]['name']){for(var _0x18ef10 in _0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')]){if(_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0xd7df('0x33')](_0x18ef10)){db[_0xd7df('0x34')][_0xd7df('0x35')]({'where':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')]['name'],'type':_0xd7df('0x36'),'exitAt':null,'uniqueid':_0x5e8cd0['body'][_0xd7df('0x32')][_0x18ef10]&&_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10][_0xd7df('0x37')]?{'$notIn':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10]}:{'$ne':null}}})[_0xd7df('0xb')](function(_0x38056b){var _0x3a3c1a=moment()['format'](_0xd7df('0x38'));for(var _0x563f90=0x0,_0x49085b=_0x38056b['length'];_0x563f90<_0x49085b;_0x563f90+=0x1){_0x38056b[_0x563f90][_0xd7df('0x39')]({'exitAt':_0x3a3c1a});}});for(var _0x162900=0x0;_0x162900<_0x5e8cd0[_0xd7df('0x30')]['interaction'][_0x18ef10]['length'];_0x162900+=0x1){db[_0xd7df('0x34')]['findOrCreate']({'where':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x15')],'type':_0xd7df('0x36'),'uniqueid':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10][_0x162900],'exitAt':null},'defaults':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x15')],'interface':_[_0xd7df('0x16')](_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3a')])?util[_0xd7df('0x3b')](_0xd7df('0x3c'),_0x5e8cd0['user'][_0xd7df('0x15')]):_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3a')],'type':_0xd7df('0x36'),'enterAt':moment()[_0xd7df('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd7df('0x3d'),'internal':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3e')],'uniqueid':_0x5e8cd0['body'][_0xd7df('0x32')][_0x18ef10][_0x162900]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x5e8cd0[_0xd7df('0x1f')]['id'],'capacity':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x3f')]},routingClient)[_0xd7df('0xb')](respondWithResult(_0x2c149e,null))[_0xd7df('0x10')](handleError(_0x2c149e,null));};exports['telephones']=function(_0x4abe81,_0x53ec02){return respondWithRpcPromise(_0xd7df('0x40'),_0x4abe81['query'])[_0xd7df('0xb')](respondWithResult(_0x53ec02,null))[_0xd7df('0x10')](handleError(_0x53ec02,null));};exports[_0xd7df('0x41')]=function(_0xdf3046,_0x275af9){return respondWithRpcPromise(_0xd7df('0x42'),_0xdf3046[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x275af9,null))[_0xd7df('0x10')](handleError(_0x275af9,null));};exports[_0xd7df('0x43')]=function(_0x382d11,_0x327365){return respondWithRpcPromise(_0xd7df('0x44'),_0x382d11[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x327365,null))[_0xd7df('0x10')](handleError(_0x327365,null));};exports['chatQueues']=function(_0x332db5,_0x28c9b7){return respondWithRpcPromise('ChatQueues',_0x332db5['query'],routingClient)[_0xd7df('0xb')](respondWithResult(_0x28c9b7,null))['catch'](handleError(_0x28c9b7,null));};exports[_0xd7df('0x45')]=function(_0x4fb55a,_0x1f34c2){return respondWithRpcPromise(_0xd7df('0x46'),_0x4fb55a[_0xd7df('0x1a')],routingClient)['then'](findById(_0x4fb55a['params']['id']))['then'](respondWithResult(_0x1f34c2,null))[_0xd7df('0x10')](handleError(_0x1f34c2,null));};exports[_0xd7df('0x47')]=function(_0x19c387,_0x527b6f){return respondWithRpcPromise(_0xd7df('0x48'),_0x19c387[_0xd7df('0x1a')],routingClient)['then'](respondWithResult(_0x527b6f,null))[_0xd7df('0x10')](handleError(_0x527b6f,null));};exports[_0xd7df('0x49')]=function(_0x35204f,_0x25d187){return respondWithRpcPromise(_0xd7df('0x48'),_0x35204f[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x35204f[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x25d187,null))[_0xd7df('0x10')](handleError(_0x25d187,null));};exports[_0xd7df('0x4a')]=function(_0x398e43,_0x3dba78){return respondWithRpcPromise(_0xd7df('0x4b'),_0x398e43[_0xd7df('0x1a')],mailClient)[_0xd7df('0xb')](respondWithResult(_0x3dba78,null))[_0xd7df('0x10')](handleError(_0x3dba78,null));};exports[_0xd7df('0x4c')]=function(_0x3f2775,_0x1e6277){return respondWithRpcPromise(_0xd7df('0x4d'),_0x3f2775[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x1e6277,null))[_0xd7df('0x10')](handleError(_0x1e6277,null));};exports[_0xd7df('0x4e')]=function(_0x3912d6,_0x51ae2b){return respondWithRpcPromise('OpenchannelQueues',_0x3912d6[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x3912d6[_0xd7df('0x1f')]['id']))['then'](respondWithResult(_0x51ae2b,null))[_0xd7df('0x10')](handleError(_0x51ae2b,null));};exports[_0xd7df('0x4f')]=function(_0x1e87aa,_0x2786a6){return respondWithRpcPromise('SmsQueues',_0x1e87aa[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x2786a6,null))[_0xd7df('0x10')](handleError(_0x2786a6,null));};exports[_0xd7df('0x50')]=function(_0x19a25b,_0x2fbc53){return respondWithRpcPromise(_0xd7df('0x51'),_0x19a25b[_0xd7df('0x1a')],routingClient)['then'](findById(_0x19a25b[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x2fbc53,null))['catch'](handleError(_0x2fbc53,null));};exports['whatsappQueues']=function(_0x481fa5,_0x264c5b){return respondWithRpcPromise(_0xd7df('0x52'),_0x481fa5[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x264c5b,null))['catch'](handleError(_0x264c5b,null));};exports[_0xd7df('0x53')]=function(_0x3d45cf,_0x19df03){return respondWithRpcPromise(_0xd7df('0x52'),_0x3d45cf[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x3d45cf[_0xd7df('0x1f')]['id']))['then'](respondWithResult(_0x19df03,null))['catch'](handleError(_0x19df03,null));};exports[_0xd7df('0x54')]=function(_0x5c1e68,_0x588537){return respondWithRpcPromise(_0xd7df('0x55'),_0x5c1e68[_0xd7df('0x1a')],routingClient)['then'](respondWithResult(_0x588537,null))['catch'](handleError(_0x588537,null));};exports[_0xd7df('0x56')]=function(_0x44d824,_0x49bf7e){return respondWithRpcPromise(_0xd7df('0x55'),_0x44d824[_0xd7df('0x1a')],routingClient)['then'](findById(_0x44d824[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x49bf7e,null))['catch'](handleError(_0x49bf7e,null));};exports[_0xd7df('0x57')]=function(_0x519f72,_0x56f55d){return respondWithRpcPromise(_0xd7df('0x58'),_0x519f72[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x56f55d,null))[_0xd7df('0x10')](handleError(_0x56f55d,null));};exports[_0xd7df('0x59')]=function(_0x40b2a1,_0x5831c1){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x40b2a1[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x5831c1,null))[_0xd7df('0x10')](handleError(_0x5831c1,null));};exports[_0xd7df('0x5a')]=function(_0x19b0e6,_0x31f681){return respondWithRpcPromise(_0xd7df('0x5b'),_0x19b0e6[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x31f681,null))['catch'](handleError(_0x31f681,null));};exports[_0xd7df('0x5c')]=function(_0x1682ca,_0x4e9806){return respondWithRpcPromise(_0xd7df('0x5d'),_0x1682ca[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x4e9806,null))[_0xd7df('0x10')](handleError(_0x4e9806,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4e5363,_0x5628ed){return respondWithRpcPromise(_0xd7df('0x5d'),_0x4e5363['query'],routingClient)[_0xd7df('0xb')](function(_0x2b1b30){if(_0x4e5363[_0xd7df('0x1a')][_0xd7df('0x5e')]!==undefined){var _0x2d8a31=_(_0x2b1b30[_0xd7df('0x17')])['filter']([_0x4e5363[_0xd7df('0x1a')][_0xd7df('0x5e')],_0x4e5363[_0xd7df('0x1f')]['id']])['map'](_0xd7df('0x5f'))[_0xd7df('0x60')]()['value']();return _0x2b1b30[_0xd7df('0x17')][_0xd7df('0x61')](function(_0x157290){return _0x2d8a31[_0xd7df('0x62')](_0x157290[_0xd7df('0x5f')])>-0x1;});}else{return _0x2b1b30[_0xd7df('0x17')][_0xd7df('0x61')](function(_0x5e93cc){return _0x5e93cc[_0xd7df('0x5f')]===parseInt(_0x4e5363[_0xd7df('0x1f')]['id']);});}})[_0xd7df('0xb')](respondWithResult(_0x5628ed,null))[_0xd7df('0x10')](handleError(_0x5628ed,null));};exports['smsQueuesWaitingInteractions']=function(_0x531a07,_0x2e1e96){return respondWithRpcPromise(_0xd7df('0x63'),_0x531a07[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x2e1e96,null))[_0xd7df('0x10')](handleError(_0x2e1e96,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2329ce,_0x4f739b){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2329ce[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x4f739b,null))[_0xd7df('0x10')](handleError(_0x4f739b,null));};exports[_0xd7df('0x64')]=function(_0x30c401,_0x3ece24){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x30c401['query'],routingClient)[_0xd7df('0xb')](respondWithResult(_0x3ece24,null))[_0xd7df('0x10')](handleError(_0x3ece24,null));};exports[_0xd7df('0x65')]=function(_0x175a36){return function(_0x5cb2b0,_0xac3b73){var _0x5df36d,_0x158bd9;var _0x5b73e5=_[_0xd7df('0x66')](_0x175a36);var _0x1ed032=_0x175a36===_0xd7df('0x67')?_0xd7df('0x68'):_0xd7df('0x69');return db[_0x5b73e5+_0xd7df('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x5cb2b0[_0xd7df('0x1f')]['id']}})['then'](function(_0x1e2355){if(_[_0xd7df('0x16')](_0x1e2355)){throw new Error(_0x5b73e5+_0xd7df('0x6b'));}_0x5df36d=_0x1e2355;return db[_0x5b73e5+_0xd7df('0x6c')]['findOne']({'where':{'id':_0x5cb2b0[_0xd7df('0x30')][_0xd7df('0x6d')]},'include':[{'model':db[_0x5b73e5+_0xd7df('0x6e')],'as':_0xd7df('0x6e')},{'model':db[_0x5b73e5+_0x1ed032],'as':_0xd7df('0x69')}]});})[_0xd7df('0xb')](function(_0x40a665){if(_[_0xd7df('0x16')](_0x40a665)){throw new Error(_0x5b73e5+_0xd7df('0x6f'));}_0x158bd9=_0x40a665;return _0x40a665[_0xd7df('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd7df('0xb')](function(){var _0x15bd27={'uniqueid':_0x175a36+'.'+_0x158bd9['id']+'.'+_0x158bd9['Interaction']['id'],'FromUserId':_0x5cb2b0[_0xd7df('0x31')]['id'],'type':_0xd7df('0x71')};_0x15bd27[_0x5b73e5+_0xd7df('0x72')]=_0x158bd9['id'];_0x15bd27[_0x5b73e5+'InteractionId']=_0x158bd9['Interaction']['id'];_0x15bd27[_0xd7df('0x73')+_0x5b73e5+_0x1ed032+'Id']=_0x158bd9[_0xd7df('0x69')]['id'];_0x15bd27['To'+_0x5b73e5+_0xd7df('0x74')]=_0x5df36d['id'];return db[_0x5b73e5+_0xd7df('0x75')][_0xd7df('0x76')](_0x15bd27);})[_0xd7df('0xb')](function(){return respondWithRpcPromise(_0xd7df('0x77'),{'channel':_0x175a36,'interaction':_0x158bd9[_0xd7df('0x6e')],'message':_0x158bd9,'account':_0x158bd9[_0xd7df('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd7df('0x71'),'appdata':_0x5df36d['name']+','+(_0x158bd9[_0xd7df('0x69')][_0xd7df('0x78')]||0x12c),'interval':_0xd7df('0x79')}]},routingClient);})[_0xd7df('0xb')](respondWithResult(_0xac3b73,null))[_0xd7df('0x10')](handleError(_0xac3b73,null));};};exports[_0xd7df('0x7a')]=function(_0x50c5b9,_0x518092){var _0xa3ae43,_0x31b159;if(_[_0xd7df('0x16')](_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x7b')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x1a888c=_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x7b')];var _0x3d9fba=_[_0xd7df('0x66')](_0x1a888c);var _0x2861e3=_0x1a888c===_0xd7df('0x67')?'Website':_0xd7df('0x69');return db['User']['findOne']({'raw':!![],'where':{'id':_0x50c5b9[_0xd7df('0x1f')]['id'],'role':_0xd7df('0x3d')}})[_0xd7df('0xb')](function(_0x5092d2){if(_[_0xd7df('0x16')](_0x5092d2)){throw new Error('Agent\x20not\x20found');}_0xa3ae43=_0x5092d2;return db[_0x3d9fba+'Message'][_0xd7df('0x7c')]({'where':{'id':_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x6d')]},'include':[{'model':db[_0x3d9fba+_0xd7df('0x6e')],'as':_0xd7df('0x6e')},{'model':db[_0x3d9fba+_0x2861e3],'as':'Account'}]});})['then'](function(_0x3f2ecd){if(_[_0xd7df('0x16')](_0x3f2ecd)){throw new Error(_0x3d9fba+_0xd7df('0x6f'));}_0x31b159=_0x3f2ecd;return _0x3f2ecd[_0xd7df('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd7df('0xb')](function(){var _0xc447e8={'uniqueid':_0x1a888c+'.'+_0x31b159['id']+'.'+_0x31b159[_0xd7df('0x6e')]['id'],'FromUserId':_0x50c5b9[_0xd7df('0x31')]['id'],'type':_0xd7df('0x71'),'ToUserId':_0xa3ae43['id']};_0xc447e8[_0x3d9fba+_0xd7df('0x72')]=_0x31b159['id'];_0xc447e8[_0x3d9fba+_0xd7df('0x7d')]=_0x31b159[_0xd7df('0x6e')]['id'];_0xc447e8[_0xd7df('0x73')+_0x3d9fba+_0x2861e3+'Id']=_0x31b159['Account']['id'];return db[_0x3d9fba+_0xd7df('0x75')][_0xd7df('0x76')](_0xc447e8);})[_0xd7df('0xb')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a888c,'interaction':_0x31b159[_0xd7df('0x6e')],'message':_0x31b159,'account':_0x31b159['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd7df('0x3d'),'appdata':_0xa3ae43[_0xd7df('0x15')]+','+(_0x31b159['Account'][_0xd7df('0x7e')]||0x12c),'interval':_0xd7df('0x79')}]},routingClient);})[_0xd7df('0xb')](respondWithResult(_0x518092,null))[_0xd7df('0x10')](handleError(_0x518092,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 68b694a..79a6f22 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 _0x4b42=['post','create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','/:id','show','/:id/run','run'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b42,0x1a9));var _0x24b4=function(_0x5a24b8,_0x3af99a){_0x5a24b8=_0x5a24b8-0x0;var _0x2f3ff9=_0x4b42[_0x5a24b8];return _0x2f3ff9;};'use strict';var multer=require(_0x24b4('0x0'));var util=require(_0x24b4('0x1'));var path=require(_0x24b4('0x2'));var timeout=require('connect-timeout');var express=require(_0x24b4('0x3'));var router=express[_0x24b4('0x4')]();var fs_extra=require(_0x24b4('0x5'));var auth=require(_0x24b4('0x6'));var interaction=require(_0x24b4('0x7'));var config=require(_0x24b4('0x8'));var controller=require(_0x24b4('0x9'));router['get']('/',auth[_0x24b4('0xa')](),controller[_0x24b4('0xb')]);router['get'](_0x24b4('0xc'),auth[_0x24b4('0xa')](),controller[_0x24b4('0xd')]);router['get'](_0x24b4('0xe'),auth[_0x24b4('0xa')](),controller[_0x24b4('0xf')]);router[_0x24b4('0x10')]('/',auth[_0x24b4('0xa')](),controller[_0x24b4('0x11')]);router['put'](_0x24b4('0xc'),auth[_0x24b4('0xa')](),controller[_0x24b4('0x12')]);router[_0x24b4('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x24b4('0x14')]=router; \ No newline at end of file +var _0x7419=['run','post','create','put','update','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show'];(function(_0x2df1db,_0xaacc24){var _0x256780=function(_0x1ad993){while(--_0x1ad993){_0x2df1db['push'](_0x2df1db['shift']());}};_0x256780(++_0xaacc24);}(_0x7419,0x182));var _0x9741=function(_0x17323e,_0x2e185c){_0x17323e=_0x17323e-0x0;var _0x47c1af=_0x7419[_0x17323e];return _0x47c1af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9741('0x0'));var timeout=require(_0x9741('0x1'));var express=require(_0x9741('0x2'));var router=express[_0x9741('0x3')]();var fs_extra=require(_0x9741('0x4'));var auth=require(_0x9741('0x5'));var interaction=require(_0x9741('0x6'));var config=require(_0x9741('0x7'));var controller=require(_0x9741('0x8'));router[_0x9741('0x9')]('/',auth[_0x9741('0xa')](),controller['index']);router[_0x9741('0x9')](_0x9741('0xb'),auth[_0x9741('0xa')](),controller[_0x9741('0xc')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0x9741('0xd')]);router[_0x9741('0xe')]('/',auth[_0x9741('0xa')](),controller[_0x9741('0xf')]);router[_0x9741('0x10')](_0x9741('0xb'),auth[_0x9741('0xa')](),controller[_0x9741('0x11')]);router[_0x9741('0x12')](_0x9741('0xb'),auth['isAuthenticated'](),controller['destroy']);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 24554c3..24566d0 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 _0x3661=['TEXT','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','weeks','hours','minutes','days','pdf','custom','default','BOOLEAN'];(function(_0x4160b2,_0x1f4039){var _0x4f877a=function(_0x418e5b){while(--_0x418e5b){_0x4160b2['push'](_0x4160b2['shift']());}};_0x4f877a(++_0x1f4039);}(_0x3661,0x191));var _0x1366=function(_0x37b660,_0x5aa4c7){_0x37b660=_0x37b660-0x0;var _0x528b2b=_0x3661[_0x37b660];return _0x528b2b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1366('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1366('0x0')],'allowNull':![],'defaultValue':_0x1366('0x1')},'startAt':{'type':Sequelize[_0x1366('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0x1366('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1366('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x1366('0x4')](_0x1366('0x5'),'quarters',_0x1366('0x6'),_0x1366('0x7'),'days',_0x1366('0x8'),_0x1366('0x9')),'allowNull':![],'defaultValue':_0x1366('0xa')},'output':{'type':Sequelize[_0x1366('0x4')]('csv',_0x1366('0xb'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x1366('0x4')](_0x1366('0xc'),_0x1366('0xd')),'allowNull':![],'defaultValue':_0x1366('0xc')},'sendMail':{'type':Sequelize[_0x1366('0xe')],'defaultValue':![]},'email':{'type':Sequelize[_0x1366('0x0')]},'cc':{'type':Sequelize[_0x1366('0xf')]},'bcc':{'type':Sequelize[_0x1366('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x1366('0xe')],'defaultValue':!![]}}; \ No newline at end of file +var _0x18b8=['default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','months','hours','minutes','days','ENUM','xlsx','custom'];(function(_0x1568be,_0x2130c1){var _0xe81d56=function(_0x11dc2b){while(--_0x11dc2b){_0x1568be['push'](_0x1568be['shift']());}};_0xe81d56(++_0x2130c1);}(_0x18b8,0x1ef));var _0x818b=function(_0x414930,_0x3167e2){_0x414930=_0x414930-0x0;var _0x4abd7b=_0x18b8[_0x414930];return _0x4abd7b;};'use strict';var Sequelize=require(_0x818b('0x0'));module[_0x818b('0x1')]={'name':{'type':Sequelize[_0x818b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x818b('0x2')]},'active':{'type':Sequelize[_0x818b('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x818b('0x2')],'allowNull':![],'defaultValue':_0x818b('0x4')},'startAt':{'type':Sequelize[_0x818b('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x818b('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x818b('0x7'),'quarters',_0x818b('0x8'),'weeks','days',_0x818b('0x9'),_0x818b('0xa')),'allowNull':![],'defaultValue':_0x818b('0xb')},'output':{'type':Sequelize[_0x818b('0xc')]('csv','pdf',_0x818b('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x818b('0xe'),_0x818b('0xf')),'allowNull':![],'defaultValue':_0x818b('0xe')},'sendMail':{'type':Sequelize[_0x818b('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x818b('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x818b('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 9bbc16b..7bcc279 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 _0x3622=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','get','Scheduler','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','show','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1e3f46,_0x287d2e){var _0x52a597=function(_0x2320d0){while(--_0x2320d0){_0x1e3f46['push'](_0x1e3f46['shift']());}};_0x52a597(++_0x287d2e);}(_0x3622,0x103));var _0x2362=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x3622[_0x4a3898];return _0x25ceb0;};'use strict';var emlformat=require(_0x2362('0x0'));var rimraf=require(_0x2362('0x1'));var zipdir=require(_0x2362('0x2'));var jsonpatch=require(_0x2362('0x3'));var rp=require(_0x2362('0x4'));var moment=require(_0x2362('0x5'));var BPromise=require(_0x2362('0x6'));var Mustache=require(_0x2362('0x7'));var util=require('util');var path=require(_0x2362('0x8'));var sox=require(_0x2362('0x9'));var csv=require(_0x2362('0xa'));var ejs=require(_0x2362('0xb'));var fs=require('fs');var fs_extra=require(_0x2362('0xc'));var _=require(_0x2362('0xd'));var squel=require('squel');var crypto=require(_0x2362('0xe'));var jsforce=require(_0x2362('0xf'));var deskjs=require(_0x2362('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2362('0x11'));var Redis=require(_0x2362('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2362('0x13'));var hardwareService=require(_0x2362('0x14'));var logger=require('../../config/logger')(_0x2362('0x15'));var utils=require(_0x2362('0x16'));var config=require(_0x2362('0x17'));var licenseUtil=require(_0x2362('0x18'));var db=require(_0x2362('0x19'))['db'];function respondWithStatusCode(_0x5c2e68,_0x566fb5){_0x566fb5=_0x566fb5||0xcc;return function(_0xd85120){if(_0xd85120){return _0x5c2e68[_0x2362('0x1a')](_0x566fb5);}return _0x5c2e68[_0x2362('0x1b')](_0x566fb5)[_0x2362('0x1c')]();};}function respondWithResult(_0x5a9c7e,_0x145674){_0x145674=_0x145674||0xc8;return function(_0xf11175){if(_0xf11175){return _0x5a9c7e[_0x2362('0x1b')](_0x145674)[_0x2362('0x1d')](_0xf11175);}};}function respondWithFilteredResult(_0x306e24,_0xcfabb5){return function(_0x22e927){if(_0x22e927){var _0x2a4e6f=typeof _0xcfabb5[_0x2362('0x1e')]==='undefined'&&typeof _0xcfabb5[_0x2362('0x1f')]===_0x2362('0x20');var _0x379024=_0x22e927[_0x2362('0x21')];var _0x3b0ef4=_0x2a4e6f?0x0:_0xcfabb5['offset'];var _0x51af8f=_0x2a4e6f?_0x22e927['count']:_0xcfabb5[_0x2362('0x1e')]+_0xcfabb5[_0x2362('0x1f')];var _0x1e18fd;if(_0x51af8f>=_0x379024){_0x51af8f=_0x379024;_0x1e18fd=0xc8;}else{_0x1e18fd=0xce;}_0x306e24[_0x2362('0x1b')](_0x1e18fd);return _0x306e24[_0x2362('0x22')](_0x2362('0x23'),_0x3b0ef4+'-'+_0x51af8f+'/'+_0x379024)[_0x2362('0x1d')](_0x22e927);}return null;};}function patchUpdates(_0x579e18){return function(_0x1b799e){try{jsonpatch[_0x2362('0x24')](_0x1b799e,_0x579e18,!![]);}catch(_0x13156a){return BPromise[_0x2362('0x25')](_0x13156a);}return _0x1b799e['save']();};}function saveUpdates(_0xde1059,_0x2a897a){return function(_0x321bf5){if(_0x321bf5){return _0x321bf5[_0x2362('0x26')](_0xde1059)['then'](function(_0x3b3adc){return _0x3b3adc;});}return null;};}function removeEntity(_0x5de07e,_0x325fac){return function(_0x5f53c2){if(_0x5f53c2){return _0x5f53c2[_0x2362('0x27')]()[_0x2362('0x28')](function(){var _0x51d10c=_0x5f53c2[_0x2362('0x29')]({'plain':!![]});var _0x21c6e5=_0x2362('0x2a');return db['UserProfileResource'][_0x2362('0x27')]({'where':{'type':_0x21c6e5,'resourceId':_0x51d10c['id']}})['then'](function(){return _0x5f53c2;});})[_0x2362('0x28')](function(){_0x5de07e['status'](0xcc)[_0x2362('0x1c')]();});}};}function handleEntityNotFound(_0x284533,_0x517a1f){return function(_0x5be11c){if(!_0x5be11c){_0x284533[_0x2362('0x1a')](0x194);}return _0x5be11c;};}function handleError(_0x13b06c,_0x2a2826){_0x2a2826=_0x2a2826||0x1f4;return function(_0x18652d){logger[_0x2362('0x2b')](_0x18652d[_0x2362('0x2c')]);if(_0x18652d[_0x2362('0x2d')]){delete _0x18652d['name'];}_0x13b06c[_0x2362('0x1b')](_0x2a2826)[_0x2362('0x2e')](_0x18652d);};}exports[_0x2362('0x2f')]=function(_0x1558a7,_0x1e9614){var _0x229729={},_0x565372={},_0x2b56c5={'count':0x0,'rows':[]};var _0xb3904c=_[_0x2362('0x30')](db[_0x2362('0x31')][_0x2362('0x32')],function(_0x326b0d){return{'name':_0x326b0d[_0x2362('0x33')],'type':_0x326b0d['type']['key']};});_0x565372[_0x2362('0x34')]=_[_0x2362('0x30')](_0xb3904c,_0x2362('0x2d'));_0x565372[_0x2362('0x35')]=_[_0x2362('0x36')](_0x1558a7[_0x2362('0x35')]);_0x565372['filters']=_[_0x2362('0x37')](_0x565372[_0x2362('0x34')],_0x565372[_0x2362('0x35')]);_0x229729[_0x2362('0x38')]=_['intersection'](_0x565372[_0x2362('0x34')],qs[_0x2362('0x39')](_0x1558a7[_0x2362('0x35')][_0x2362('0x39')]));_0x229729['attributes']=_0x229729['attributes'][_0x2362('0x3a')]?_0x229729[_0x2362('0x38')]:_0x565372[_0x2362('0x34')];if(!_0x1558a7[_0x2362('0x35')][_0x2362('0x3b')]('nolimit')){_0x229729[_0x2362('0x1f')]=qs[_0x2362('0x1f')](_0x1558a7[_0x2362('0x35')][_0x2362('0x1f')]);_0x229729[_0x2362('0x1e')]=qs[_0x2362('0x1e')](_0x1558a7['query'][_0x2362('0x1e')]);}_0x229729[_0x2362('0x3c')]=qs['sort'](_0x1558a7[_0x2362('0x35')][_0x2362('0x3d')]);_0x229729['where']=qs['filters'](_[_0x2362('0x3e')](_0x1558a7[_0x2362('0x35')],_0x565372[_0x2362('0x3f')]),_0xb3904c);if(_0x1558a7['query'][_0x2362('0x40')]){_0x229729[_0x2362('0x41')]=_[_0x2362('0x42')](_0x229729['where'],{'$or':_['map'](_0xb3904c,function(_0x15ee28){if(_0x15ee28[_0x2362('0x43')]!==_0x2362('0x44')){var _0xba1a55={};_0xba1a55[_0x15ee28[_0x2362('0x2d')]]={'$like':'%'+_0x1558a7[_0x2362('0x35')][_0x2362('0x40')]+'%'};return _0xba1a55;}})});}_0x229729=_['merge']({},_0x229729,_0x1558a7[_0x2362('0x45')]);var _0x1c3ef1={'where':_0x229729[_0x2362('0x41')]};return db['Schedule'][_0x2362('0x21')](_0x1c3ef1)[_0x2362('0x28')](function(_0x44f32f){_0x2b56c5['count']=_0x44f32f;if(_0x1558a7[_0x2362('0x35')]['includeAll']){_0x229729[_0x2362('0x46')]=[{'all':!![]}];}return db[_0x2362('0x31')][_0x2362('0x47')](_0x229729);})['then'](function(_0x12b0e2){_0x2b56c5[_0x2362('0x48')]=_0x12b0e2;return _0x2b56c5;})[_0x2362('0x28')](respondWithFilteredResult(_0x1e9614,_0x229729))['catch'](handleError(_0x1e9614,null));};exports[_0x2362('0x49')]=function(_0x2713a4,_0x362f41){var _0x2ad32e={'raw':![],'where':{'id':_0x2713a4[_0x2362('0x4a')]['id']}},_0x32f530={};_0x32f530[_0x2362('0x34')]=_[_0x2362('0x36')](db[_0x2362('0x31')]['rawAttributes']);_0x32f530['query']=_[_0x2362('0x36')](_0x2713a4[_0x2362('0x35')]);_0x32f530['filters']=_[_0x2362('0x37')](_0x32f530[_0x2362('0x34')],_0x32f530['query']);_0x2ad32e[_0x2362('0x38')]=_['intersection'](_0x32f530[_0x2362('0x34')],qs['fields'](_0x2713a4[_0x2362('0x35')][_0x2362('0x39')]));_0x2ad32e[_0x2362('0x38')]=_0x2ad32e[_0x2362('0x38')][_0x2362('0x3a')]?_0x2ad32e[_0x2362('0x38')]:_0x32f530['model'];if(_0x2713a4['query']['includeAll']){_0x2ad32e[_0x2362('0x46')]=[{'all':!![]}];}_0x2ad32e=_[_0x2362('0x42')]({},_0x2ad32e,_0x2713a4[_0x2362('0x45')]);return db[_0x2362('0x31')][_0x2362('0x4b')](_0x2ad32e)[_0x2362('0x28')](handleEntityNotFound(_0x362f41,null))[_0x2362('0x28')](respondWithResult(_0x362f41,null))[_0x2362('0x4c')](handleError(_0x362f41,null));};exports[_0x2362('0x4d')]=function(_0x40452f,_0x2aaca2){return db[_0x2362('0x31')]['create'](_0x40452f['body'],{})[_0x2362('0x28')](function(_0x2fae60){var _0x274084=_0x40452f['user'][_0x2362('0x29')]({'plain':!![]});if(!_0x274084)throw new Error(_0x2362('0x4e'));if(_0x274084[_0x2362('0x4f')]===_0x2362('0x50')){var _0x42ee1a=_0x2fae60[_0x2362('0x29')]({'plain':!![]});var _0x457343=_0x2362('0x2a');return db[_0x2362('0x51')][_0x2362('0x4b')]({'where':{'name':_0x457343,'userProfileId':_0x274084['userProfileId']},'raw':!![]})[_0x2362('0x28')](function(_0x2f609a){if(_0x2f609a&&_0x2f609a[_0x2362('0x52')]===0x0){return db[_0x2362('0x53')][_0x2362('0x4d')]({'name':_0x42ee1a['name'],'resourceId':_0x42ee1a['id'],'type':_0x2f609a[_0x2362('0x2d')],'sectionId':_0x2f609a['id']},{})[_0x2362('0x28')](function(){return _0x2fae60;});}else{return _0x2fae60;}})['catch'](function(_0x9dd556){logger[_0x2362('0x2b')](_0x2362('0x54'),_0x9dd556);throw _0x9dd556;});}return _0x2fae60;})['then'](respondWithResult(_0x2aaca2,0xc9))[_0x2362('0x4c')](handleError(_0x2aaca2,null));};exports[_0x2362('0x26')]=function(_0x58dd2d,_0x2a386f){if(_0x58dd2d[_0x2362('0x55')]['id']){delete _0x58dd2d['body']['id'];}return db['Schedule'][_0x2362('0x4b')]({'where':{'id':_0x58dd2d[_0x2362('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a386f,null))[_0x2362('0x28')](saveUpdates(_0x58dd2d['body'],null))[_0x2362('0x28')](respondWithResult(_0x2a386f,null))[_0x2362('0x4c')](handleError(_0x2a386f,null));};exports[_0x2362('0x27')]=function(_0x1a0b02,_0x576695){return db[_0x2362('0x31')][_0x2362('0x4b')]({'where':{'id':_0x1a0b02[_0x2362('0x4a')]['id']}})[_0x2362('0x28')](handleEntityNotFound(_0x576695,null))['then'](removeEntity(_0x576695,null))[_0x2362('0x4c')](handleError(_0x576695,null));};exports[_0x2362('0x56')]=function(_0x41125e,_0x169c72,_0x54160f){var _0x402a50=require(_0x2362('0x57'));return db[_0x2362('0x31')][_0x2362('0x4b')]({'where':{'id':_0x41125e[_0x2362('0x4a')]['id']},'raw':!![]})[_0x2362('0x28')](handleEntityNotFound(_0x169c72,null))[_0x2362('0x28')](function(){_0x402a50[_0x2362('0x56')](_0x41125e['params']['id']);})[_0x2362('0x28')](respondWithStatusCode(_0x169c72,null))[_0x2362('0x4c')](handleError(_0x169c72,null));}; \ No newline at end of file +var _0x7397=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','Scheduler','UserProfileResource','destroy','then','error','stack','name','send','Schedule','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','find','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3025e0,_0xf2c52d){var _0x4ee7c5=function(_0x166bf0){while(--_0x166bf0){_0x3025e0['push'](_0x3025e0['shift']());}};_0x4ee7c5(++_0xf2c52d);}(_0x7397,0x9c));var _0x7739=function(_0x2c38cf,_0x76d40c){_0x2c38cf=_0x2c38cf-0x0;var _0x5a1e86=_0x7397[_0x2c38cf];return _0x5a1e86;};'use strict';var emlformat=require(_0x7739('0x0'));var rimraf=require(_0x7739('0x1'));var zipdir=require(_0x7739('0x2'));var jsonpatch=require(_0x7739('0x3'));var rp=require(_0x7739('0x4'));var moment=require(_0x7739('0x5'));var BPromise=require(_0x7739('0x6'));var Mustache=require(_0x7739('0x7'));var util=require('util');var path=require(_0x7739('0x8'));var sox=require(_0x7739('0x9'));var csv=require('to-csv');var ejs=require(_0x7739('0xa'));var fs=require('fs');var fs_extra=require(_0x7739('0xb'));var _=require('lodash');var squel=require(_0x7739('0xc'));var crypto=require('crypto');var jsforce=require(_0x7739('0xd'));var deskjs=require(_0x7739('0xe'));var toCsv=require(_0x7739('0xf'));var querystring=require(_0x7739('0x10'));var Papa=require(_0x7739('0x11'));var Redis=require(_0x7739('0x12'));var authService=require(_0x7739('0x13'));var qs=require(_0x7739('0x14'));var as=require(_0x7739('0x15'));var hardwareService=require(_0x7739('0x16'));var logger=require(_0x7739('0x17'))(_0x7739('0x18'));var utils=require(_0x7739('0x19'));var config=require(_0x7739('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x7739('0x1b'))['db'];function respondWithStatusCode(_0x3946ac,_0xde5a71){_0xde5a71=_0xde5a71||0xcc;return function(_0x2ccce){if(_0x2ccce){return _0x3946ac['sendStatus'](_0xde5a71);}return _0x3946ac[_0x7739('0x1c')](_0xde5a71)['end']();};}function respondWithResult(_0x5b1bd4,_0x5a18f){_0x5a18f=_0x5a18f||0xc8;return function(_0x551c54){if(_0x551c54){return _0x5b1bd4['status'](_0x5a18f)['json'](_0x551c54);}};}function respondWithFilteredResult(_0x2b970c,_0x328eab){return function(_0x2b029b){if(_0x2b029b){var _0x36f733=typeof _0x328eab[_0x7739('0x1d')]===_0x7739('0x1e')&&typeof _0x328eab[_0x7739('0x1f')]===_0x7739('0x1e');var _0x4c8d6a=_0x2b029b[_0x7739('0x20')];var _0x2b8a19=_0x36f733?0x0:_0x328eab[_0x7739('0x1d')];var _0x921b69=_0x36f733?_0x2b029b['count']:_0x328eab[_0x7739('0x1d')]+_0x328eab[_0x7739('0x1f')];var _0x166881;if(_0x921b69>=_0x4c8d6a){_0x921b69=_0x4c8d6a;_0x166881=0xc8;}else{_0x166881=0xce;}_0x2b970c[_0x7739('0x1c')](_0x166881);return _0x2b970c[_0x7739('0x21')](_0x7739('0x22'),_0x2b8a19+'-'+_0x921b69+'/'+_0x4c8d6a)[_0x7739('0x23')](_0x2b029b);}return null;};}function patchUpdates(_0x53c4b3){return function(_0x2ef137){try{jsonpatch[_0x7739('0x24')](_0x2ef137,_0x53c4b3,!![]);}catch(_0x305bbc){return BPromise[_0x7739('0x25')](_0x305bbc);}return _0x2ef137[_0x7739('0x26')]();};}function saveUpdates(_0x3d055d,_0x49a374){return function(_0x4d4500){if(_0x4d4500){return _0x4d4500[_0x7739('0x27')](_0x3d055d)['then'](function(_0x3a6454){return _0x3a6454;});}return null;};}function removeEntity(_0x4f63ca,_0x3c6a9b){return function(_0x4b9d7a){if(_0x4b9d7a){return _0x4b9d7a['destroy']()['then'](function(){var _0x40d457=_0x4b9d7a[_0x7739('0x28')]({'plain':!![]});var _0x31499a=_0x7739('0x29');return db[_0x7739('0x2a')][_0x7739('0x2b')]({'where':{'type':_0x31499a,'resourceId':_0x40d457['id']}})['then'](function(){return _0x4b9d7a;});})[_0x7739('0x2c')](function(){_0x4f63ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23bee8,_0x10d97b){return function(_0x30799a){if(!_0x30799a){_0x23bee8['sendStatus'](0x194);}return _0x30799a;};}function handleError(_0x341fda,_0xce4105){_0xce4105=_0xce4105||0x1f4;return function(_0x342c14){logger[_0x7739('0x2d')](_0x342c14[_0x7739('0x2e')]);if(_0x342c14[_0x7739('0x2f')]){delete _0x342c14[_0x7739('0x2f')];}_0x341fda[_0x7739('0x1c')](_0xce4105)[_0x7739('0x30')](_0x342c14);};}exports['index']=function(_0x256680,_0x30cb67){var _0x11edd6={},_0x4d6173={},_0x3c32dd={'count':0x0,'rows':[]};var _0xe4020=_['map'](db[_0x7739('0x31')]['rawAttributes'],function(_0x5605eb){return{'name':_0x5605eb[_0x7739('0x32')],'type':_0x5605eb[_0x7739('0x33')][_0x7739('0x34')]};});_0x4d6173[_0x7739('0x35')]=_[_0x7739('0x36')](_0xe4020,'name');_0x4d6173[_0x7739('0x37')]=_['keys'](_0x256680[_0x7739('0x37')]);_0x4d6173[_0x7739('0x38')]=_[_0x7739('0x39')](_0x4d6173[_0x7739('0x35')],_0x4d6173[_0x7739('0x37')]);_0x11edd6[_0x7739('0x3a')]=_[_0x7739('0x39')](_0x4d6173[_0x7739('0x35')],qs[_0x7739('0x3b')](_0x256680[_0x7739('0x37')]['fields']));_0x11edd6[_0x7739('0x3a')]=_0x11edd6[_0x7739('0x3a')][_0x7739('0x3c')]?_0x11edd6[_0x7739('0x3a')]:_0x4d6173['model'];if(!_0x256680['query'][_0x7739('0x3d')](_0x7739('0x3e'))){_0x11edd6[_0x7739('0x1f')]=qs[_0x7739('0x1f')](_0x256680[_0x7739('0x37')][_0x7739('0x1f')]);_0x11edd6[_0x7739('0x1d')]=qs[_0x7739('0x1d')](_0x256680[_0x7739('0x37')][_0x7739('0x1d')]);}_0x11edd6[_0x7739('0x3f')]=qs[_0x7739('0x40')](_0x256680[_0x7739('0x37')][_0x7739('0x40')]);_0x11edd6['where']=qs['filters'](_[_0x7739('0x41')](_0x256680[_0x7739('0x37')],_0x4d6173[_0x7739('0x38')]),_0xe4020);if(_0x256680[_0x7739('0x37')][_0x7739('0x42')]){_0x11edd6[_0x7739('0x43')]=_['merge'](_0x11edd6[_0x7739('0x43')],{'$or':_[_0x7739('0x36')](_0xe4020,function(_0xda6a1a){if(_0xda6a1a[_0x7739('0x33')]!==_0x7739('0x44')){var _0x45455d={};_0x45455d[_0xda6a1a[_0x7739('0x2f')]]={'$like':'%'+_0x256680[_0x7739('0x37')][_0x7739('0x42')]+'%'};return _0x45455d;}})});}_0x11edd6=_[_0x7739('0x45')]({},_0x11edd6,_0x256680[_0x7739('0x46')]);var _0x50f3f7={'where':_0x11edd6[_0x7739('0x43')]};return db[_0x7739('0x31')][_0x7739('0x20')](_0x50f3f7)['then'](function(_0xc401b2){_0x3c32dd[_0x7739('0x20')]=_0xc401b2;if(_0x256680[_0x7739('0x37')][_0x7739('0x47')]){_0x11edd6[_0x7739('0x48')]=[{'all':!![]}];}return db['Schedule'][_0x7739('0x49')](_0x11edd6);})[_0x7739('0x2c')](function(_0x54068b){_0x3c32dd['rows']=_0x54068b;return _0x3c32dd;})[_0x7739('0x2c')](respondWithFilteredResult(_0x30cb67,_0x11edd6))[_0x7739('0x4a')](handleError(_0x30cb67,null));};exports[_0x7739('0x4b')]=function(_0x5fe22c,_0x155e26){var _0x201902={'raw':![],'where':{'id':_0x5fe22c[_0x7739('0x4c')]['id']}},_0x1672ce={};_0x1672ce[_0x7739('0x35')]=_[_0x7739('0x4d')](db[_0x7739('0x31')]['rawAttributes']);_0x1672ce[_0x7739('0x37')]=_['keys'](_0x5fe22c['query']);_0x1672ce['filters']=_[_0x7739('0x39')](_0x1672ce['model'],_0x1672ce[_0x7739('0x37')]);_0x201902['attributes']=_['intersection'](_0x1672ce[_0x7739('0x35')],qs[_0x7739('0x3b')](_0x5fe22c[_0x7739('0x37')][_0x7739('0x3b')]));_0x201902[_0x7739('0x3a')]=_0x201902[_0x7739('0x3a')]['length']?_0x201902[_0x7739('0x3a')]:_0x1672ce[_0x7739('0x35')];if(_0x5fe22c[_0x7739('0x37')][_0x7739('0x47')]){_0x201902[_0x7739('0x48')]=[{'all':!![]}];}_0x201902=_[_0x7739('0x45')]({},_0x201902,_0x5fe22c[_0x7739('0x46')]);return db[_0x7739('0x31')]['find'](_0x201902)['then'](handleEntityNotFound(_0x155e26,null))['then'](respondWithResult(_0x155e26,null))[_0x7739('0x4a')](handleError(_0x155e26,null));};exports['create']=function(_0x2f1040,_0xa7631a){return db['Schedule'][_0x7739('0x4e')](_0x2f1040['body'],{})[_0x7739('0x2c')](function(_0x78d71c){var _0x37269f=_0x2f1040[_0x7739('0x4f')][_0x7739('0x28')]({'plain':!![]});if(!_0x37269f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37269f[_0x7739('0x50')]==='user'){var _0x2d3311=_0x78d71c[_0x7739('0x28')]({'plain':!![]});var _0x29c8d9=_0x7739('0x29');return db[_0x7739('0x51')]['find']({'where':{'name':_0x29c8d9,'userProfileId':_0x37269f['userProfileId']},'raw':!![]})[_0x7739('0x2c')](function(_0x16d887){if(_0x16d887&&_0x16d887[_0x7739('0x52')]===0x0){return db['UserProfileResource'][_0x7739('0x4e')]({'name':_0x2d3311['name'],'resourceId':_0x2d3311['id'],'type':_0x16d887[_0x7739('0x2f')],'sectionId':_0x16d887['id']},{})[_0x7739('0x2c')](function(){return _0x78d71c;});}else{return _0x78d71c;}})[_0x7739('0x4a')](function(_0x23b340){logger['error'](_0x7739('0x53'),_0x23b340);throw _0x23b340;});}return _0x78d71c;})['then'](respondWithResult(_0xa7631a,0xc9))[_0x7739('0x4a')](handleError(_0xa7631a,null));};exports[_0x7739('0x27')]=function(_0x3664d4,_0x1ba269){if(_0x3664d4['body']['id']){delete _0x3664d4[_0x7739('0x54')]['id'];}return db[_0x7739('0x31')]['find']({'where':{'id':_0x3664d4[_0x7739('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ba269,null))[_0x7739('0x2c')](saveUpdates(_0x3664d4[_0x7739('0x54')],null))[_0x7739('0x2c')](respondWithResult(_0x1ba269,null))[_0x7739('0x4a')](handleError(_0x1ba269,null));};exports['destroy']=function(_0x286779,_0x36593f){return db[_0x7739('0x31')]['find']({'where':{'id':_0x286779[_0x7739('0x4c')]['id']}})['then'](handleEntityNotFound(_0x36593f,null))[_0x7739('0x2c')](removeEntity(_0x36593f,null))['catch'](handleError(_0x36593f,null));};exports['run']=function(_0x115002,_0x189dcc,_0x452a67){var _0x27ed59=require(_0x7739('0x55'));return db[_0x7739('0x31')][_0x7739('0x56')]({'where':{'id':_0x115002[_0x7739('0x4c')]['id']},'raw':!![]})[_0x7739('0x2c')](handleEntityNotFound(_0x189dcc,null))[_0x7739('0x2c')](function(){_0x27ed59[_0x7739('0x57')](_0x115002[_0x7739('0x4c')]['id']);})[_0x7739('0x2c')](respondWithStatusCode(_0x189dcc,null))[_0x7739('0x4a')](handleError(_0x189dcc,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index d30c67e..1ca1887 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 _0x42ce=['define','Schedule','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports'];(function(_0x9ab11,_0x50ff81){var _0x4753ca=function(_0x3eb550){while(--_0x3eb550){_0x9ab11['push'](_0x9ab11['shift']());}};_0x4753ca(++_0x50ff81);}(_0x42ce,0x80));var _0xe42c=function(_0x10acc2,_0x381818){_0x10acc2=_0x10acc2-0x0;var _0x5159f0=_0x42ce[_0x10acc2];return _0x5159f0;};'use strict';var _=require(_0xe42c('0x0'));var util=require(_0xe42c('0x1'));var logger=require(_0xe42c('0x2'))(_0xe42c('0x3'));var moment=require(_0xe42c('0x4'));var BPromise=require(_0xe42c('0x5'));var rp=require(_0xe42c('0x6'));var fs=require('fs');var path=require(_0xe42c('0x7'));var rimraf=require(_0xe42c('0x8'));var config=require(_0xe42c('0x9'));var attributes=require(_0xe42c('0xa'));module[_0xe42c('0xb')]=function(_0x362324,_0x5bf536){return _0x362324[_0xe42c('0xc')](_0xe42c('0xd'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcc0=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','Schedule'];(function(_0x1e5321,_0x8e7345){var _0x3bb432=function(_0x4703ec){while(--_0x4703ec){_0x1e5321['push'](_0x1e5321['shift']());}};_0x3bb432(++_0x8e7345);}(_0xfcc0,0x136));var _0x0fcc=function(_0x478349,_0x4e11b2){_0x478349=_0x478349-0x0;var _0x564ad3=_0xfcc0[_0x478349];return _0x564ad3;};'use strict';var _=require(_0x0fcc('0x0'));var util=require('util');var logger=require(_0x0fcc('0x1'))('api');var moment=require(_0x0fcc('0x2'));var BPromise=require(_0x0fcc('0x3'));var rp=require(_0x0fcc('0x4'));var fs=require('fs');var path=require(_0x0fcc('0x5'));var rimraf=require(_0x0fcc('0x6'));var config=require('../../config/environment');var attributes=require(_0x0fcc('0x7'));module[_0x0fcc('0x8')]=function(_0x2d4c81,_0x5100d6){return _0x2d4c81['define'](_0x0fcc('0x9'),attributes,{'tableName':'tools_schedules','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 aa04fac..42486ec 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 _0x3926=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4ffffa,_0x181456){var _0x44aefb=function(_0x14db4a){while(--_0x14db4a){_0x4ffffa['push'](_0x4ffffa['shift']());}};_0x44aefb(++_0x181456);}(_0x3926,0x9b));var _0x6392=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x3926[_0x543084];return _0x306a57;};'use strict';var _=require(_0x6392('0x0'));var util=require(_0x6392('0x1'));var moment=require(_0x6392('0x2'));var BPromise=require(_0x6392('0x3'));var rs=require(_0x6392('0x4'));var fs=require('fs');var Redis=require(_0x6392('0x5'));var db=require(_0x6392('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6392('0x7'));var client=jayson[_0x6392('0x8')][_0x6392('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7e41e2,_0xdd52a3,_0xbc5ee8){return new BPromise(function(_0x170962,_0x104d6a){return client['request'](_0x7e41e2,_0xbc5ee8)['then'](function(_0x354a3a){logger['info'](_0x6392('0xa'),_0xdd52a3,_0x6392('0xb'));logger[_0x6392('0xc')](_0x6392('0xd'),_0xdd52a3,'request\x20sent',JSON['stringify'](_0x354a3a));if(_0x354a3a[_0x6392('0xe')]){if(_0x354a3a['error'][_0x6392('0xf')]===0x1f4){logger[_0x6392('0xe')](_0x6392('0xa'),_0xdd52a3,_0x354a3a[_0x6392('0xe')]['message']);return _0x104d6a(_0x354a3a[_0x6392('0xe')][_0x6392('0x10')]);}logger[_0x6392('0xe')](_0x6392('0xa'),_0xdd52a3,_0x354a3a['error']['message']);return _0x170962(_0x354a3a[_0x6392('0xe')]['message']);}else{logger[_0x6392('0x11')](_0x6392('0xa'),_0xdd52a3,_0x6392('0xb'));_0x170962(_0x354a3a['result'][_0x6392('0x10')]);}})[_0x6392('0x12')](function(_0x1eaded){logger[_0x6392('0xe')](_0x6392('0xa'),_0xdd52a3,_0x1eaded);_0x104d6a(_0x1eaded);});});} \ No newline at end of file +var _0x2b3f=['util','moment','../../mysqldb','rpc','../../config/environment','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x279c3e,_0x320606){var _0x13cfe2=function(_0x10878a){while(--_0x10878a){_0x279c3e['push'](_0x279c3e['shift']());}};_0x13cfe2(++_0x320606);}(_0x2b3f,0x142));var _0xf2b3=function(_0x4961ae,_0x1173a9){_0x4961ae=_0x4961ae-0x0;var _0x4e4716=_0x2b3f[_0x4961ae];return _0x4e4716;};'use strict';var _=require(_0xf2b3('0x0'));var util=require(_0xf2b3('0x1'));var moment=require(_0xf2b3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2b3('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf2b3('0x4'));var config=require(_0xf2b3('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf2b3('0x6')][_0xf2b3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a6e4c,_0x3ad8a5,_0x1b0815){return new BPromise(function(_0x54d2b8,_0x3cddad){return client['request'](_0x5a6e4c,_0x1b0815)[_0xf2b3('0x8')](function(_0x59b1c7){logger[_0xf2b3('0x9')](_0xf2b3('0xa'),_0x3ad8a5,_0xf2b3('0xb'));logger[_0xf2b3('0xc')](_0xf2b3('0xd'),_0x3ad8a5,_0xf2b3('0xb'),JSON[_0xf2b3('0xe')](_0x59b1c7));if(_0x59b1c7[_0xf2b3('0xf')]){if(_0x59b1c7[_0xf2b3('0xf')]['code']===0x1f4){logger[_0xf2b3('0xf')]('Schedule,\x20%s,\x20%s',_0x3ad8a5,_0x59b1c7[_0xf2b3('0xf')][_0xf2b3('0x10')]);return _0x3cddad(_0x59b1c7[_0xf2b3('0xf')]['message']);}logger[_0xf2b3('0xf')]('Schedule,\x20%s,\x20%s',_0x3ad8a5,_0x59b1c7[_0xf2b3('0xf')][_0xf2b3('0x10')]);return _0x54d2b8(_0x59b1c7[_0xf2b3('0xf')][_0xf2b3('0x10')]);}else{logger[_0xf2b3('0x9')](_0xf2b3('0xa'),_0x3ad8a5,_0xf2b3('0xb'));_0x54d2b8(_0x59b1c7[_0xf2b3('0x11')]['message']);}})[_0xf2b3('0x12')](function(_0x489bd2){logger[_0xf2b3('0xf')]('Schedule,\x20%s,\x20%s',_0x3ad8a5,_0x489bd2);_0x3cddad(_0x489bd2);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 207a28c..c170bed 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 _0x0345=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','describe','/:id','show','/:id/download','download','put','update','delete'];(function(_0x3b4d1b,_0x12517b){var _0x5a2ffd=function(_0x241fe6){while(--_0x241fe6){_0x3b4d1b['push'](_0x3b4d1b['shift']());}};_0x5a2ffd(++_0x12517b);}(_0x0345,0x86));var _0x5034=function(_0x39096f,_0x33eeb3){_0x39096f=_0x39096f-0x0;var _0x1f7951=_0x0345[_0x39096f];return _0x1f7951;};'use strict';var multer=require('multer');var util=require(_0x5034('0x0'));var path=require('path');var timeout=require(_0x5034('0x1'));var express=require(_0x5034('0x2'));var router=express[_0x5034('0x3')]();var fs_extra=require(_0x5034('0x4'));var auth=require(_0x5034('0x5'));var interaction=require(_0x5034('0x6'));var config=require(_0x5034('0x7'));var controller=require(_0x5034('0x8'));router['get']('/',auth[_0x5034('0x9')](),controller[_0x5034('0xa')]);router[_0x5034('0xb')]('/describe',auth[_0x5034('0x9')](),controller[_0x5034('0xc')]);router[_0x5034('0xb')](_0x5034('0xd'),auth[_0x5034('0x9')](),controller[_0x5034('0xe')]);router['get'](_0x5034('0xf'),auth[_0x5034('0x9')](),controller[_0x5034('0x10')]);router['post']('/',auth[_0x5034('0x9')](),controller['create']);router[_0x5034('0x11')](_0x5034('0xd'),auth[_0x5034('0x9')](),controller[_0x5034('0x12')]);router[_0x5034('0x13')](_0x5034('0xd'),auth['isAuthenticated'](),controller[_0x5034('0x14')]);module[_0x5034('0x15')]=router; \ No newline at end of file +var _0x92db=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','/:id','/:id/download','download','post'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0x92db,0x15e));var _0xb92d=function(_0x421777,_0x5ecd68){_0x421777=_0x421777-0x0;var _0x2140db=_0x92db[_0x421777];return _0x2140db;};'use strict';var multer=require(_0xb92d('0x0'));var util=require(_0xb92d('0x1'));var path=require(_0xb92d('0x2'));var timeout=require(_0xb92d('0x3'));var express=require(_0xb92d('0x4'));var router=express[_0xb92d('0x5')]();var fs_extra=require(_0xb92d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb92d('0x7'));var config=require(_0xb92d('0x8'));var controller=require(_0xb92d('0x9'));router[_0xb92d('0xa')]('/',auth['isAuthenticated'](),controller[_0xb92d('0xb')]);router[_0xb92d('0xa')](_0xb92d('0xc'),auth[_0xb92d('0xd')](),controller['describe']);router[_0xb92d('0xa')](_0xb92d('0xe'),auth[_0xb92d('0xd')](),controller['show']);router['get'](_0xb92d('0xf'),auth['isAuthenticated'](),controller[_0xb92d('0x10')]);router[_0xb92d('0x11')]('/',auth[_0xb92d('0xd')](),controller[_0xb92d('0x12')]);router[_0xb92d('0x13')](_0xb92d('0xe'),auth['isAuthenticated'](),controller[_0xb92d('0x14')]);router[_0xb92d('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb92d('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 6ea4065..9968a91 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 _0x1f75=['updatedAt','moment','path','../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','MM-DD-YYYY\x20HH:mm','toString','DATE','format','createdAt'];(function(_0x5082b9,_0x1b2fa4){var _0x232951=function(_0x737743){while(--_0x737743){_0x5082b9['push'](_0x5082b9['shift']());}};_0x232951(++_0x1b2fa4);}(_0x1f75,0x13c));var _0x51f7=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x1f75[_0x23e7c1];return _0x1add43;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x51f7('0x0'));var path=require(_0x51f7('0x1'));var config=require(_0x51f7('0x2'));module[_0x51f7('0x3')]={'format':{'type':Sequelize[_0x51f7('0x4')],'get':function(){return this['getDataValue'](_0x51f7('0x5'))?path[_0x51f7('0x6')](this[_0x51f7('0x7')](_0x51f7('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x51f7('0x8')]},'channel':{'type':Sequelize[_0x51f7('0x8')]},'value':{'type':Sequelize[_0x51f7('0x8')],'set':function(_0xb4e621){var _0x3d2a15=_0xb4e621[_0x51f7('0x9')](/\\/g,'/');this[_0x51f7('0xa')](_0x51f7('0x5'),_0x3d2a15);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x51f7('0xb')],'set':function(_0x450767){this['setDataValue'](_0x51f7('0xc'),moment()[_0x51f7('0xd')](_0x450767,'ms'));this['setDataValue']('closedAt',moment());this[_0x51f7('0xa')](_0x51f7('0xe'),_0x450767);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x51f7('0x7')](_0x51f7('0xc')))['format'](_0x51f7('0xf'))[_0x51f7('0x10')]();}},'closedAt':{'type':Sequelize[_0x51f7('0x11')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x51f7('0x12')](_0x51f7('0xf'))[_0x51f7('0x10')]();}},'createdAt':{'type':Sequelize[_0x51f7('0x11')],'get':function(){return moment(this[_0x51f7('0x7')](_0x51f7('0x13')))['format'](_0x51f7('0xf'))[_0x51f7('0x10')]();}},'updatedAt':{'type':Sequelize[_0x51f7('0x11')],'get':function(){return moment(this[_0x51f7('0x7')](_0x51f7('0x14')))[_0x51f7('0x12')](_0x51f7('0xf'))['toString']();}}}; \ No newline at end of file +var _0x8b0e=['updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','value','getDataValue','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x8b0e,0x166));var _0xe8b0=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0x8b0e[_0x589f71];return _0x5763bd;};'use strict';var Sequelize=require(_0xe8b0('0x0'));var moment=require(_0xe8b0('0x1'));var path=require(_0xe8b0('0x2'));var config=require(_0xe8b0('0x3'));module[_0xe8b0('0x4')]={'format':{'type':Sequelize[_0xe8b0('0x5')],'get':function(){return this['getDataValue'](_0xe8b0('0x6'))?path['extname'](this[_0xe8b0('0x7')](_0xe8b0('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xe8b0('0x8')]},'channel':{'type':Sequelize[_0xe8b0('0x8')]},'value':{'type':Sequelize[_0xe8b0('0x8')],'set':function(_0x35fe3d){var _0x25faf7=_0x35fe3d[_0xe8b0('0x9')](/\\/g,'/');this['setDataValue'](_0xe8b0('0x6'),_0x25faf7);}},'rating':{'type':Sequelize[_0xe8b0('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe8b0('0xa')],'set':function(_0x82589f){this[_0xe8b0('0xb')](_0xe8b0('0xc'),moment()[_0xe8b0('0xd')](_0x82589f,'ms'));this[_0xe8b0('0xb')](_0xe8b0('0xe'),moment());this['setDataValue']('duration',_0x82589f);}},'startedAt':{'type':Sequelize[_0xe8b0('0xf')],'get':function(){return moment(this[_0xe8b0('0x7')](_0xe8b0('0xc')))['format'](_0xe8b0('0x10'))[_0xe8b0('0x11')]();}},'closedAt':{'type':Sequelize[_0xe8b0('0xf')],'get':function(){return moment(this[_0xe8b0('0x7')](_0xe8b0('0xe')))[_0xe8b0('0x12')](_0xe8b0('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0xe8b0('0xf')],'get':function(){return moment(this[_0xe8b0('0x7')](_0xe8b0('0x13')))['format'](_0xe8b0('0x10'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xe8b0('0x14')))[_0xe8b0('0x12')]('MM-DD-YYYY\x20HH:mm')[_0xe8b0('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index f7a21c5..bf69d53 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 _0x84ab=['describe','download','join','existsSync','decryptFile','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','rawAttributes','type','key','model','differenceBy','map','format','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','ScreenRecording','rows','params','keys','intersection','find','catch','body','createdAt','value'];(function(_0x20268d,_0x135d10){var _0x426b01=function(_0x313c8e){while(--_0x313c8e){_0x20268d['push'](_0x20268d['shift']());}};_0x426b01(++_0x135d10);}(_0x84ab,0x12f));var _0xb84a=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x84ab[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x409df0,_0x19bdfa){return function(_0x3258a9){if(!_0x3258a9){_0x409df0[_0xb84a('0x16')](0x194);}return _0x3258a9;};}function handleError(_0x3ff0bc,_0x3b6805){_0x3b6805=_0x3b6805||0x1f4;return function(_0xd468c3){logger[_0xb84a('0x24')](_0xd468c3[_0xb84a('0x25')]);if(_0xd468c3[_0xb84a('0x26')]){delete _0xd468c3[_0xb84a('0x26')];}_0x3ff0bc[_0xb84a('0x17')](_0x3b6805)[_0xb84a('0x27')](_0xd468c3);};}exports['index']=function(_0x582954,_0x4608ce){var _0x2c30b0={},_0x4dab4e={},_0x1f690a={'count':0x0,'rows':[]};var _0x36b4f4=_['map'](db['ScreenRecording'][_0xb84a('0x28')],function(_0x8e9319){return{'name':_0x8e9319['fieldName'],'type':_0x8e9319[_0xb84a('0x29')][_0xb84a('0x2a')]};});_0x4dab4e[_0xb84a('0x2b')]=_[_0xb84a('0x2c')](_[_0xb84a('0x2d')](_0x36b4f4,_0xb84a('0x26')),[_0xb84a('0x2e')]);_0x4dab4e[_0xb84a('0x2f')]=_['keys'](_0x582954[_0xb84a('0x2f')]);_0x4dab4e['filters']=_['intersection'](_0x4dab4e[_0xb84a('0x2b')],_0x4dab4e[_0xb84a('0x2f')]);_0x2c30b0['attributes']=_['intersection'](_0x4dab4e[_0xb84a('0x2b')],qs[_0xb84a('0x30')](_0x582954[_0xb84a('0x2f')][_0xb84a('0x30')]));_0x2c30b0[_0xb84a('0x31')]=_0x2c30b0[_0xb84a('0x31')][_0xb84a('0x32')]?_0x2c30b0[_0xb84a('0x31')]:_0x4dab4e['model'];if(!_0x582954[_0xb84a('0x2f')][_0xb84a('0x33')](_0xb84a('0x34'))){_0x2c30b0[_0xb84a('0x1c')]=qs[_0xb84a('0x1c')](_0x582954[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x2c30b0['offset']=qs[_0xb84a('0x1a')](_0x582954['query'][_0xb84a('0x1a')]);}_0x2c30b0[_0xb84a('0x35')]=qs[_0xb84a('0x36')](_0x582954['query']['sort']);_0x2c30b0[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_[_0xb84a('0x39')](_0x582954[_0xb84a('0x2f')],_0x4dab4e[_0xb84a('0x38')]),_0x36b4f4);if(_0x582954['query'][_0xb84a('0x3a')]){_0x2c30b0[_0xb84a('0x37')]=_['merge'](_0x2c30b0[_0xb84a('0x37')],{'$or':_[_0xb84a('0x2d')](_0x36b4f4,function(_0x19634b){if(_0x19634b[_0xb84a('0x29')]!=='VIRTUAL'){var _0x57a1a8={};_0x57a1a8[_0x19634b['name']]={'$like':'%'+_0x582954[_0xb84a('0x2f')][_0xb84a('0x3a')]+'%'};return _0x57a1a8;}})});}_0x2c30b0=_[_0xb84a('0x3b')]({},_0x2c30b0,_0x582954[_0xb84a('0x3c')]);var _0x55b0b8={'where':_0x2c30b0[_0xb84a('0x37')]};return db['ScreenRecording'][_0xb84a('0x1d')](_0x55b0b8)['then'](function(_0x48db18){_0x1f690a['count']=_0x48db18;if(_0x582954[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x2c30b0[_0xb84a('0x3e')]=[{'all':!![]}];}return db[_0xb84a('0x3f')]['findAll'](_0x2c30b0);})[_0xb84a('0x22')](function(_0x42f0b6){_0x1f690a[_0xb84a('0x40')]=_0x42f0b6;return _0x1f690a;})[_0xb84a('0x22')](respondWithFilteredResult(_0x4608ce,_0x2c30b0))['catch'](handleError(_0x4608ce,null));};exports['show']=function(_0x15a621,_0x1f3e04){var _0x541cc4={'raw':![],'where':{'id':_0x15a621[_0xb84a('0x41')]['id']}},_0x1045ee={};_0x1045ee[_0xb84a('0x2b')]=_[_0xb84a('0x42')](db[_0xb84a('0x3f')][_0xb84a('0x28')]);_0x1045ee[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x15a621[_0xb84a('0x2f')]);_0x1045ee[_0xb84a('0x38')]=_[_0xb84a('0x43')](_0x1045ee[_0xb84a('0x2b')],_0x1045ee[_0xb84a('0x2f')]);_0x541cc4[_0xb84a('0x31')]=_[_0xb84a('0x43')](_0x1045ee['model'],qs[_0xb84a('0x30')](_0x15a621[_0xb84a('0x2f')][_0xb84a('0x30')]));_0x541cc4[_0xb84a('0x31')]=_0x541cc4[_0xb84a('0x31')][_0xb84a('0x32')]?_0x541cc4['attributes']:_0x1045ee[_0xb84a('0x2b')];if(_0x15a621['query'][_0xb84a('0x3d')]){_0x541cc4[_0xb84a('0x3e')]=[{'all':!![]}];}_0x541cc4=_[_0xb84a('0x3b')]({},_0x541cc4,_0x15a621[_0xb84a('0x3c')]);return db['ScreenRecording'][_0xb84a('0x44')](_0x541cc4)[_0xb84a('0x22')](handleEntityNotFound(_0x1f3e04,null))[_0xb84a('0x22')](respondWithResult(_0x1f3e04,null))['catch'](handleError(_0x1f3e04,null));};exports['create']=function(_0x385986,_0x10b0cc){return db[_0xb84a('0x3f')]['create'](_0x385986['body'],{})['then'](respondWithResult(_0x10b0cc,0xc9))[_0xb84a('0x45')](handleError(_0x10b0cc,null));};exports[_0xb84a('0x21')]=function(_0x38f329,_0x4476bc){if(_0x38f329[_0xb84a('0x46')]['id']){delete _0x38f329['body']['id'];}delete _0x38f329['body']['duration'];delete _0x38f329['body'][_0xb84a('0x47')];delete _0x38f329[_0xb84a('0x46')]['closedAt'];delete _0x38f329[_0xb84a('0x46')][_0xb84a('0x48')];return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':{'id':_0x38f329[_0xb84a('0x41')]['id']}})[_0xb84a('0x22')](handleEntityNotFound(_0x4476bc,null))['then'](saveUpdates(_0x38f329['body'],null))[_0xb84a('0x22')](respondWithResult(_0x4476bc,null))['catch'](handleError(_0x4476bc,null));};exports[_0xb84a('0x49')]=function(_0x4d1a29,_0x575908){return db['ScreenRecording'][_0xb84a('0x49')]()[_0xb84a('0x22')](respondWithResult(_0x575908,null))[_0xb84a('0x45')](handleError(_0x575908,null));};exports[_0xb84a('0x4a')]=function(_0x33adfc,_0x46f7eb,_0x37ca26){var _0x29ff35=require('../../components/encryptor');var _0x5afdd0=![];var _0x4c5bdf={};if(_0x33adfc[_0xb84a('0x2f')][_0xb84a('0x29')]&&_0x33adfc['query'][_0xb84a('0x29')]==='uniqueid'){_0x4c5bdf['uniqueid']=_0x33adfc['params']['id'];}else{_0x4c5bdf['id']=_0x33adfc[_0xb84a('0x41')]['id'];}return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':_0x4c5bdf,'attributes':['id','value'],'raw':!![]})[_0xb84a('0x22')](handleEntityNotFound(_0x46f7eb,null))[_0xb84a('0x22')](function(_0x136d61){if(_0x136d61){var _0x505994=path[_0xb84a('0x4b')](config['root'],'server/files/screen_recordings',_0x136d61[_0xb84a('0x48')]);var _0x47a8a2=util[_0xb84a('0x2e')]('%s.cypher',_0x505994);if(fs[_0xb84a('0x4c')](_0x47a8a2)){_0x5afdd0=!![];return _0x29ff35[_0xb84a('0x4d')](_0x47a8a2,_0x505994,config[_0xb84a('0x4e')][_0xb84a('0x4f')])['then'](function(){return _0x136d61;});}return _0x136d61;}})['then'](function(_0x4fc998){if(_0x4fc998){var _0x40b392=path[_0xb84a('0x4b')](config['root'],'server/files/screen_recordings',_0x4fc998[_0xb84a('0x48')]);if(!fs[_0xb84a('0x4c')](_0x40b392)){throw new db[(_0xb84a('0x50'))]['ValidationError'](_0xb84a('0x51'));}if(_0x4fc998[_0xb84a('0x52')]){return _0x46f7eb['download'](_0x40b392,_0x4fc998[_0xb84a('0x52')]+path[_0xb84a('0x53')](_0x40b392),function(){if(_0x5afdd0){fs[_0xb84a('0x54')](_0x40b392);}});}else{return _0x46f7eb[_0xb84a('0x4a')](_0x40b392,function(_0x3bbc69){if(_0x5afdd0){fs[_0xb84a('0x54')](_0x40b392);}});}}})[_0xb84a('0x45')](function(_0x47c27f){if(_0x47c27f[_0xb84a('0x55')]===_0xb84a('0x51')){_0x46f7eb['status'](0x194)[_0xb84a('0x27')](_0xb84a('0x56'));}else{return handleError(_0x46f7eb,null);}});};exports[_0xb84a('0x23')]=function(_0x3e16d8,_0x347998){return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':{'id':_0x3e16d8[_0xb84a('0x41')]['id']}})[_0xb84a('0x22')](function(_0x5dd660){if(_[_0xb84a('0x57')](_0x5dd660)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5dd660;})['then'](function(_0x19d635){var _0x5e11c8=path[_0xb84a('0x4b')](config['root'],_0xb84a('0x58'),_0x19d635[_0xb84a('0x48')]);logger['info'](_0xb84a('0x59'),_0x5e11c8);if(!_[_0xb84a('0x57')](_0x19d635[_0xb84a('0x48')])&&fs[_0xb84a('0x4c')](_0x5e11c8)){logger[_0xb84a('0x5a')](_0xb84a('0x5b')+_0x5e11c8+_0xb84a('0x5c'));fs['unlinkSync'](_0x5e11c8);}_0x5e11c8=_0x5e11c8+_0xb84a('0x5d');if(!_['isNil'](_0x19d635['value'])&&fs[_0xb84a('0x4c')](_0x5e11c8)){logger[_0xb84a('0x5a')](_0xb84a('0x5b')+_0x5e11c8+_0xb84a('0x5c'));fs['unlinkSync'](_0x5e11c8);}return _0x19d635;})['then'](function(_0x43031f){if(!_0x43031f)throw new InternalError();return _0x43031f[_0xb84a('0x23')]();})[_0xb84a('0x22')](function(){_0x347998[_0xb84a('0x17')](0xcc)['end']();})[_0xb84a('0x45')](handleError(_0x347998,null));}; \ No newline at end of file +var _0x5c12=['undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','filter','include','rows','catch','keys','includeAll','options','find','create','body','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit'];(function(_0x5cd96d,_0x283edb){var _0xe23df8=function(_0x1e39bb){while(--_0x1e39bb){_0x5cd96d['push'](_0x5cd96d['shift']());}};_0xe23df8(++_0x283edb);}(_0x5c12,0x188));var _0x25c1=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x5c12[_0x1e172a];return _0x96338b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25c1('0x0'));var zipdir=require(_0x25c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var Mustache=require(_0x25c1('0x5'));var util=require(_0x25c1('0x6'));var path=require(_0x25c1('0x7'));var sox=require(_0x25c1('0x8'));var csv=require('to-csv');var ejs=require(_0x25c1('0x9'));var fs=require('fs');var fs_extra=require(_0x25c1('0xa'));var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0xe'));var querystring=require(_0x25c1('0xf'));var Papa=require(_0x25c1('0x10'));var Redis=require('ioredis');var authService=require(_0x25c1('0x11'));var qs=require(_0x25c1('0x12'));var as=require(_0x25c1('0x13'));var hardwareService=require(_0x25c1('0x14'));var logger=require(_0x25c1('0x15'))('api');var utils=require(_0x25c1('0x16'));var config=require(_0x25c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25c1('0x18'))['db'];function respondWithStatusCode(_0x209af5,_0x323d3c){_0x323d3c=_0x323d3c||0xcc;return function(_0x329ba9){if(_0x329ba9){return _0x209af5['sendStatus'](_0x323d3c);}return _0x209af5['status'](_0x323d3c)['end']();};}function respondWithResult(_0x54f6f4,_0x3ef429){_0x3ef429=_0x3ef429||0xc8;return function(_0x1412ed){if(_0x1412ed){return _0x54f6f4[_0x25c1('0x19')](_0x3ef429)[_0x25c1('0x1a')](_0x1412ed);}};}function respondWithFilteredResult(_0x17a032,_0x4ea926){return function(_0x4638f0){if(_0x4638f0){var _0x55b62d=typeof _0x4ea926['offset']==='undefined'&&typeof _0x4ea926[_0x25c1('0x1b')]===_0x25c1('0x1c');var _0x4dc64b=_0x4638f0['count'];var _0x61a29f=_0x55b62d?0x0:_0x4ea926['offset'];var _0x7175d4=_0x55b62d?_0x4638f0[_0x25c1('0x1d')]:_0x4ea926['offset']+_0x4ea926['limit'];var _0x542768;if(_0x7175d4>=_0x4dc64b){_0x7175d4=_0x4dc64b;_0x542768=0xc8;}else{_0x542768=0xce;}_0x17a032[_0x25c1('0x19')](_0x542768);return _0x17a032[_0x25c1('0x1e')](_0x25c1('0x1f'),_0x61a29f+'-'+_0x7175d4+'/'+_0x4dc64b)[_0x25c1('0x1a')](_0x4638f0);}return null;};}function patchUpdates(_0x481c12){return function(_0x119639){try{jsonpatch[_0x25c1('0x20')](_0x119639,_0x481c12,!![]);}catch(_0x34454a){return BPromise[_0x25c1('0x21')](_0x34454a);}return _0x119639['save']();};}function saveUpdates(_0x4c3259,_0x2a8a84){return function(_0xac3335){if(_0xac3335){return _0xac3335[_0x25c1('0x22')](_0x4c3259)[_0x25c1('0x23')](function(_0x15cf2f){return _0x15cf2f;});}return null;};}function removeEntity(_0x1a4b89,_0x2ba595){return function(_0x324ea9){if(_0x324ea9){return _0x324ea9[_0x25c1('0x24')]()[_0x25c1('0x23')](function(){_0x1a4b89[_0x25c1('0x19')](0xcc)[_0x25c1('0x25')]();});}};}function handleEntityNotFound(_0x399d72,_0x4915cc){return function(_0x2dadae){if(!_0x2dadae){_0x399d72[_0x25c1('0x26')](0x194);}return _0x2dadae;};}function handleError(_0x1b1c96,_0x1fb59f){_0x1fb59f=_0x1fb59f||0x1f4;return function(_0x21fdb8){logger[_0x25c1('0x27')](_0x21fdb8['stack']);if(_0x21fdb8[_0x25c1('0x28')]){delete _0x21fdb8[_0x25c1('0x28')];}_0x1b1c96[_0x25c1('0x19')](_0x1fb59f)[_0x25c1('0x29')](_0x21fdb8);};}exports[_0x25c1('0x2a')]=function(_0x193a68,_0x5c56ab){var _0x1e498={},_0x478f1e={},_0x76b360={'count':0x0,'rows':[]};var _0x31c153=_[_0x25c1('0x2b')](db[_0x25c1('0x2c')][_0x25c1('0x2d')],function(_0x21069c){return{'name':_0x21069c[_0x25c1('0x2e')],'type':_0x21069c[_0x25c1('0x2f')][_0x25c1('0x30')]};});_0x478f1e['model']=_[_0x25c1('0x31')](_['map'](_0x31c153,'name'),[_0x25c1('0x32')]);_0x478f1e[_0x25c1('0x33')]=_['keys'](_0x193a68[_0x25c1('0x33')]);_0x478f1e['filters']=_[_0x25c1('0x34')](_0x478f1e['model'],_0x478f1e[_0x25c1('0x33')]);_0x1e498[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x478f1e[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1e498[_0x25c1('0x35')]=_0x1e498['attributes'][_0x25c1('0x38')]?_0x1e498['attributes']:_0x478f1e[_0x25c1('0x36')];if(!_0x193a68['query'][_0x25c1('0x39')](_0x25c1('0x3a'))){_0x1e498[_0x25c1('0x1b')]=qs[_0x25c1('0x1b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x1b')]);_0x1e498[_0x25c1('0x3b')]=qs[_0x25c1('0x3b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3b')]);}_0x1e498[_0x25c1('0x3c')]=qs[_0x25c1('0x3d')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3d')]);_0x1e498[_0x25c1('0x3e')]=qs[_0x25c1('0x3f')](_[_0x25c1('0x40')](_0x193a68[_0x25c1('0x33')],_0x478f1e[_0x25c1('0x3f')]),_0x31c153);if(_0x193a68[_0x25c1('0x33')]['filter']){_0x1e498[_0x25c1('0x3e')]=_[_0x25c1('0x41')](_0x1e498['where'],{'$or':_[_0x25c1('0x2b')](_0x31c153,function(_0x5eca99){if(_0x5eca99[_0x25c1('0x2f')]!=='VIRTUAL'){var _0x4326fb={};_0x4326fb[_0x5eca99[_0x25c1('0x28')]]={'$like':'%'+_0x193a68[_0x25c1('0x33')][_0x25c1('0x42')]+'%'};return _0x4326fb;}})});}_0x1e498=_[_0x25c1('0x41')]({},_0x1e498,_0x193a68['options']);var _0x1fe6d7={'where':_0x1e498['where']};return db[_0x25c1('0x2c')][_0x25c1('0x1d')](_0x1fe6d7)[_0x25c1('0x23')](function(_0x17fc23){_0x76b360['count']=_0x17fc23;if(_0x193a68['query']['includeAll']){_0x1e498[_0x25c1('0x43')]=[{'all':!![]}];}return db[_0x25c1('0x2c')]['findAll'](_0x1e498);})[_0x25c1('0x23')](function(_0x58792d){_0x76b360[_0x25c1('0x44')]=_0x58792d;return _0x76b360;})[_0x25c1('0x23')](respondWithFilteredResult(_0x5c56ab,_0x1e498))[_0x25c1('0x45')](handleError(_0x5c56ab,null));};exports['show']=function(_0x5502c1,_0x53f87b){var _0x1b1d17={'raw':![],'where':{'id':_0x5502c1['params']['id']}},_0x3cf9c0={};_0x3cf9c0[_0x25c1('0x36')]=_[_0x25c1('0x46')](db[_0x25c1('0x2c')]['rawAttributes']);_0x3cf9c0['query']=_['keys'](_0x5502c1['query']);_0x3cf9c0[_0x25c1('0x3f')]=_[_0x25c1('0x34')](_0x3cf9c0['model'],_0x3cf9c0[_0x25c1('0x33')]);_0x1b1d17[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x3cf9c0[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x5502c1[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1b1d17['attributes']=_0x1b1d17['attributes'][_0x25c1('0x38')]?_0x1b1d17[_0x25c1('0x35')]:_0x3cf9c0[_0x25c1('0x36')];if(_0x5502c1['query'][_0x25c1('0x47')]){_0x1b1d17[_0x25c1('0x43')]=[{'all':!![]}];}_0x1b1d17=_[_0x25c1('0x41')]({},_0x1b1d17,_0x5502c1[_0x25c1('0x48')]);return db['ScreenRecording'][_0x25c1('0x49')](_0x1b1d17)[_0x25c1('0x23')](handleEntityNotFound(_0x53f87b,null))[_0x25c1('0x23')](respondWithResult(_0x53f87b,null))[_0x25c1('0x45')](handleError(_0x53f87b,null));};exports['create']=function(_0x59e96b,_0x13ac06){return db[_0x25c1('0x2c')][_0x25c1('0x4a')](_0x59e96b[_0x25c1('0x4b')],{})['then'](respondWithResult(_0x13ac06,0xc9))[_0x25c1('0x45')](handleError(_0x13ac06,null));};exports[_0x25c1('0x22')]=function(_0x5770dd,_0x102f5){if(_0x5770dd[_0x25c1('0x4b')]['id']){delete _0x5770dd[_0x25c1('0x4b')]['id'];}delete _0x5770dd[_0x25c1('0x4b')]['duration'];delete _0x5770dd['body'][_0x25c1('0x4c')];delete _0x5770dd[_0x25c1('0x4b')][_0x25c1('0x4d')];delete _0x5770dd['body'][_0x25c1('0x4e')];return db[_0x25c1('0x2c')]['find']({'where':{'id':_0x5770dd[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x102f5,null))[_0x25c1('0x23')](saveUpdates(_0x5770dd[_0x25c1('0x4b')],null))[_0x25c1('0x23')](respondWithResult(_0x102f5,null))[_0x25c1('0x45')](handleError(_0x102f5,null));};exports[_0x25c1('0x50')]=function(_0x5102a0,_0x5344da){return db['ScreenRecording'][_0x25c1('0x50')]()['then'](respondWithResult(_0x5344da,null))[_0x25c1('0x45')](handleError(_0x5344da,null));};exports[_0x25c1('0x51')]=function(_0x42fd6e,_0x153603,_0x40fe57){var _0x1b72e5=require('../../components/encryptor');var _0x4a876b=![];var _0x68e295={};if(_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]&&_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]==='uniqueid'){_0x68e295[_0x25c1('0x52')]=_0x42fd6e[_0x25c1('0x4f')]['id'];}else{_0x68e295['id']=_0x42fd6e[_0x25c1('0x4f')]['id'];}return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':_0x68e295,'attributes':['id','value'],'raw':!![]})[_0x25c1('0x23')](handleEntityNotFound(_0x153603,null))[_0x25c1('0x23')](function(_0x49b192){if(_0x49b192){var _0x1341d2=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x49b192[_0x25c1('0x4e')]);var _0x3d051a=util['format'](_0x25c1('0x56'),_0x1341d2);if(fs[_0x25c1('0x57')](_0x3d051a)){_0x4a876b=!![];return _0x1b72e5[_0x25c1('0x58')](_0x3d051a,_0x1341d2,config[_0x25c1('0x59')][_0x25c1('0x5a')])[_0x25c1('0x23')](function(){return _0x49b192;});}return _0x49b192;}})[_0x25c1('0x23')](function(_0x5d54cd){if(_0x5d54cd){var _0x321833=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x5d54cd[_0x25c1('0x4e')]);if(!fs[_0x25c1('0x57')](_0x321833)){throw new db['Sequelize'][(_0x25c1('0x5b'))](_0x25c1('0x5c'));}if(_0x5d54cd[_0x25c1('0x5d')]){return _0x153603[_0x25c1('0x51')](_0x321833,_0x5d54cd[_0x25c1('0x5d')]+path[_0x25c1('0x5e')](_0x321833),function(){if(_0x4a876b){fs[_0x25c1('0x5f')](_0x321833);}});}else{return _0x153603['download'](_0x321833,function(_0x44efc9){if(_0x4a876b){fs['unlink'](_0x321833);}});}}})[_0x25c1('0x45')](function(_0x24568c){if(_0x24568c[_0x25c1('0x60')]===_0x25c1('0x5c')){_0x153603[_0x25c1('0x19')](0x194)[_0x25c1('0x29')](_0x25c1('0x61'));}else{return handleError(_0x153603,null);}});};exports[_0x25c1('0x24')]=function(_0x4c435c,_0x7dbbe1){return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':{'id':_0x4c435c[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](function(_0x338f70){if(_[_0x25c1('0x62')](_0x338f70)){throw new ReferenceError('Entity\x20not\x20found');}return _0x338f70;})[_0x25c1('0x23')](function(_0x51e747){var _0x5e1517=path['join'](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x51e747[_0x25c1('0x4e')]);logger[_0x25c1('0x63')](_0x25c1('0x64'),_0x5e1517);if(!_['isNil'](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}_0x5e1517=_0x5e1517+_0x25c1('0x68');if(!_[_0x25c1('0x62')](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}return _0x51e747;})[_0x25c1('0x23')](function(_0x425f3e){if(!_0x425f3e)throw new InternalError();return _0x425f3e['destroy']();})[_0x25c1('0x23')](function(){_0x7dbbe1['status'](0xcc)[_0x25c1('0x25')]();})['catch'](handleError(_0x7dbbe1,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index d8e0210..76acde3 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 _0xf8b6=['define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','path','../../config/environment'];(function(_0x575705,_0x19b8c5){var _0x123bba=function(_0x25d8ee){while(--_0x25d8ee){_0x575705['push'](_0x575705['shift']());}};_0x123bba(++_0x19b8c5);}(_0xf8b6,0x16c));var _0x6f8b=function(_0x2edc25,_0x110702){_0x2edc25=_0x2edc25-0x0;var _0x5e5562=_0xf8b6[_0x2edc25];return _0x5e5562;};'use strict';var _=require('lodash');var util=require(_0x6f8b('0x0'));var logger=require(_0x6f8b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f8b('0x2'));var rimraf=require('rimraf');var config=require(_0x6f8b('0x3'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x100884,_0x20c3b7){return _0x100884[_0x6f8b('0x4')](_0x6f8b('0x5'),attributes,{'tableName':_0x6f8b('0x6'),'paranoid':![],'indexes':[{'name':_0x6f8b('0x7'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x10e6=['screen_recordings','interactionid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x628a60,_0x587f90){var _0x3f8da4=function(_0x22a534){while(--_0x22a534){_0x628a60['push'](_0x628a60['shift']());}};_0x3f8da4(++_0x587f90);}(_0x10e6,0x160));var _0x610e=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0x10e6[_0x3f2a90];return _0xb46279;};'use strict';var _=require(_0x610e('0x0'));var util=require(_0x610e('0x1'));var logger=require(_0x610e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x610e('0x3'));var rp=require(_0x610e('0x4'));var fs=require('fs');var path=require(_0x610e('0x5'));var rimraf=require(_0x610e('0x6'));var config=require(_0x610e('0x7'));var attributes=require(_0x610e('0x8'));module[_0x610e('0x9')]=function(_0x2ef0e3,_0x251c03){return _0x2ef0e3[_0x610e('0xa')](_0x610e('0xb'),attributes,{'tableName':_0x610e('0xc'),'paranoid':![],'indexes':[{'name':_0x610e('0xd'),'fields':[_0x610e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index ab628a0..8102950 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 _0x716c=['ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info'];(function(_0x597f38,_0x4a093e){var _0x254696=function(_0x284f8a){while(--_0x284f8a){_0x597f38['push'](_0x597f38['shift']());}};_0x254696(++_0x4a093e);}(_0x716c,0x169));var _0xc716=function(_0x118ab2,_0x45f2be){_0x118ab2=_0x118ab2-0x0;var _0x45cf52=_0x716c[_0x118ab2];return _0x45cf52;};'use strict';var _=require(_0xc716('0x0'));var util=require(_0xc716('0x1'));var moment=require(_0xc716('0x2'));var BPromise=require(_0xc716('0x3'));var rs=require(_0xc716('0x4'));var fs=require('fs');var Redis=require(_0xc716('0x5'));var db=require(_0xc716('0x6'))['db'];var utils=require(_0xc716('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc716('0x8'));var jayson=require(_0xc716('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x374ea9,_0x28121a,_0x2b3093){return new BPromise(function(_0x57e053,_0x428954){return client[_0xc716('0xa')](_0x374ea9,_0x2b3093)[_0xc716('0xb')](function(_0x361f5f){logger[_0xc716('0xc')](_0xc716('0xd'),_0x28121a,_0xc716('0xe'));logger['debug'](_0xc716('0xf'),_0x28121a,_0xc716('0xe'),JSON[_0xc716('0x10')](_0x361f5f));if(_0x361f5f[_0xc716('0x11')]){if(_0x361f5f[_0xc716('0x11')][_0xc716('0x12')]===0x1f4){logger['error'](_0xc716('0xd'),_0x28121a,_0x361f5f['error'][_0xc716('0x13')]);return _0x428954(_0x361f5f[_0xc716('0x11')][_0xc716('0x13')]);}logger[_0xc716('0x11')](_0xc716('0xd'),_0x28121a,_0x361f5f[_0xc716('0x11')][_0xc716('0x13')]);return _0x57e053(_0x361f5f[_0xc716('0x11')][_0xc716('0x13')]);}else{logger[_0xc716('0xc')](_0xc716('0xd'),_0x28121a,_0xc716('0xe'));_0x57e053(_0x361f5f[_0xc716('0x14')][_0xc716('0x13')]);}})[_0xc716('0x15')](function(_0x4624ac){logger['error'](_0xc716('0xd'),_0x28121a,_0x4624ac);_0x428954(_0x4624ac);});});} \ No newline at end of file +var _0xd1ad=['client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x450eb1,_0x38e972){var _0x58f6ea=function(_0xa4f727){while(--_0xa4f727){_0x450eb1['push'](_0x450eb1['shift']());}};_0x58f6ea(++_0x38e972);}(_0xd1ad,0xdd));var _0xdd1a=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0xd1ad[_0x1b8b95];return _0x3657ae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdd1a('0x0'));var BPromise=require(_0xdd1a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd1a('0x2'));var db=require(_0xdd1a('0x3'))['db'];var utils=require(_0xdd1a('0x4'));var logger=require(_0xdd1a('0x5'))(_0xdd1a('0x6'));var config=require(_0xdd1a('0x7'));var jayson=require(_0xdd1a('0x8'));var client=jayson[_0xdd1a('0x9')][_0xdd1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55828f,_0x7eaa2,_0x4c35ca){return new BPromise(function(_0x55ba4a,_0x4aecc1){return client[_0xdd1a('0xb')](_0x55828f,_0x4c35ca)[_0xdd1a('0xc')](function(_0x590eee){logger[_0xdd1a('0xd')](_0xdd1a('0xe'),_0x7eaa2,_0xdd1a('0xf'));logger[_0xdd1a('0x10')](_0xdd1a('0x11'),_0x7eaa2,_0xdd1a('0xf'),JSON[_0xdd1a('0x12')](_0x590eee));if(_0x590eee[_0xdd1a('0x13')]){if(_0x590eee[_0xdd1a('0x13')][_0xdd1a('0x14')]===0x1f4){logger[_0xdd1a('0x13')](_0xdd1a('0xe'),_0x7eaa2,_0x590eee[_0xdd1a('0x13')][_0xdd1a('0x15')]);return _0x4aecc1(_0x590eee[_0xdd1a('0x13')]['message']);}logger['error'](_0xdd1a('0xe'),_0x7eaa2,_0x590eee[_0xdd1a('0x13')][_0xdd1a('0x15')]);return _0x55ba4a(_0x590eee[_0xdd1a('0x13')][_0xdd1a('0x15')]);}else{logger[_0xdd1a('0xd')](_0xdd1a('0xe'),_0x7eaa2,_0xdd1a('0xf'));_0x55ba4a(_0x590eee['result'][_0xdd1a('0x15')]);}})[_0xdd1a('0x16')](function(_0x57852a){logger[_0xdd1a('0x13')](_0xdd1a('0xe'),_0x7eaa2,_0x57852a);_0x4aecc1(_0x57852a);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index dfe34cc..ed54431 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 _0xce68=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','show','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','%s%s','logo','extname','originalname','post','/:id/logo','single','file','addLogo','server/files/images/logos/','logologin','addLogoLogin','diskStorage','format','preferred','addPreferred','favicon','put','isAuthenticated','update','exports','multer'];(function(_0x3b5b4a,_0x1b170e){var _0x44eada=function(_0x1216f5){while(--_0x1216f5){_0x3b5b4a['push'](_0x3b5b4a['shift']());}};_0x44eada(++_0x1b170e);}(_0xce68,0x179));var _0x8ce6=function(_0x9d11e7,_0xb1c3e7){_0x9d11e7=_0x9d11e7-0x0;var _0x163a34=_0xce68[_0x9d11e7];return _0x163a34;};'use strict';var multer=require(_0x8ce6('0x0'));var util=require(_0x8ce6('0x1'));var path=require(_0x8ce6('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ce6('0x3'));var router=express[_0x8ce6('0x4')]();var fs_extra=require(_0x8ce6('0x5'));var auth=require(_0x8ce6('0x6'));var interaction=require(_0x8ce6('0x7'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x8ce6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8ce6('0x8')]('/now',controller['getDate']);router[_0x8ce6('0x8')](_0x8ce6('0x9'),controller[_0x8ce6('0xa')]);router[_0x8ce6('0x8')]('/:id/logo',controller['getLogo']);router[_0x8ce6('0x8')](_0x8ce6('0xb'),controller[_0x8ce6('0xc')]);router[_0x8ce6('0x8')](_0x8ce6('0xd'),controller[_0x8ce6('0xe')]);router[_0x8ce6('0x8')](_0x8ce6('0xf'),controller[_0x8ce6('0x10')]);router[_0x8ce6('0x8')](_0x8ce6('0x11'),controller[_0x8ce6('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3a8027,_0x7377ab,_0x312f30){_0x312f30(null,path[_0x8ce6('0x13')](config[_0x8ce6('0x14')],'server/files/images/logos/'));},'filename':function(_0x434032,_0x5c0350,_0x4b294d){_0x4b294d(null,util['format'](_0x8ce6('0x15'),_0x8ce6('0x16'),path[_0x8ce6('0x17')](_0x5c0350[_0x8ce6('0x18')])));}})});router[_0x8ce6('0x19')](_0x8ce6('0x1a'),upload[_0x8ce6('0x1b')](_0x8ce6('0x1c')),controller[_0x8ce6('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x41961d,_0x2b982c,_0x56af35){_0x56af35(null,path[_0x8ce6('0x13')](config[_0x8ce6('0x14')],_0x8ce6('0x1e')));},'filename':function(_0x10658f,_0x3478e2,_0x568de7){_0x568de7(null,util['format'](_0x8ce6('0x15'),_0x8ce6('0x1f'),path[_0x8ce6('0x17')](_0x3478e2[_0x8ce6('0x18')])));}})});router['post'](_0x8ce6('0xb'),upload[_0x8ce6('0x1b')](_0x8ce6('0x1c')),controller[_0x8ce6('0x20')]);var upload=multer({'storage':multer[_0x8ce6('0x21')]({'destination':function(_0x50e6c7,_0x6d9369,_0x3ff11e){_0x3ff11e(null,path['join'](config[_0x8ce6('0x14')],_0x8ce6('0x1e')));},'filename':function(_0xc2a4e9,_0x54f4d9,_0x2bf383){_0x2bf383(null,util[_0x8ce6('0x22')](_0x8ce6('0x15'),_0x8ce6('0x23'),path[_0x8ce6('0x17')](_0x54f4d9['originalname'])));}})});router[_0x8ce6('0x19')](_0x8ce6('0xf'),upload[_0x8ce6('0x1b')](_0x8ce6('0x1c')),controller[_0x8ce6('0x24')]);var upload=multer({'storage':multer[_0x8ce6('0x21')]({'destination':function(_0x3b99a2,_0x28b332,_0x500ce6){_0x500ce6(null,path[_0x8ce6('0x13')](config[_0x8ce6('0x14')],_0x8ce6('0x1e')));},'filename':function(_0x1d1cfa,_0x18cb96,_0x315890){_0x315890(null,util[_0x8ce6('0x22')](_0x8ce6('0x15'),_0x8ce6('0x25'),path['extname'](_0x18cb96['originalname'])));}})});router[_0x8ce6('0x19')](_0x8ce6('0x11'),upload[_0x8ce6('0x1b')](_0x8ce6('0x1c')),controller['addFavicon']);router[_0x8ce6('0x26')](_0x8ce6('0x9'),auth[_0x8ce6('0x27')](),controller[_0x8ce6('0x28')]);module[_0x8ce6('0x29')]=router; \ No newline at end of file +var _0xcaa2=['logologin','originalname','file','addLogoLogin','preferred','/:id/preferred','/:id','isAuthenticated','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','index','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','post','single'];(function(_0x37e302,_0x111e7d){var _0x65369e=function(_0x1b7fef){while(--_0x1b7fef){_0x37e302['push'](_0x37e302['shift']());}};_0x65369e(++_0x111e7d);}(_0xcaa2,0x105));var _0x2caa=function(_0x18076c,_0x23c5b8){_0x18076c=_0x18076c-0x0;var _0x201d10=_0xcaa2[_0x18076c];return _0x201d10;};'use strict';var multer=require('multer');var util=require(_0x2caa('0x0'));var path=require(_0x2caa('0x1'));var timeout=require(_0x2caa('0x2'));var express=require(_0x2caa('0x3'));var router=express[_0x2caa('0x4')]();var fs_extra=require(_0x2caa('0x5'));var auth=require(_0x2caa('0x6'));var interaction=require(_0x2caa('0x7'));var config=require('../../config/environment');var controller=require(_0x2caa('0x8'));router[_0x2caa('0x9')]('/',auth['isAuthenticated'](),controller[_0x2caa('0xa')]);router['get'](_0x2caa('0xb'),controller[_0x2caa('0xc')]);router[_0x2caa('0x9')]('/:id',controller[_0x2caa('0xd')]);router['get'](_0x2caa('0xe'),controller[_0x2caa('0xf')]);router[_0x2caa('0x9')](_0x2caa('0x10'),controller[_0x2caa('0x11')]);router[_0x2caa('0x9')](_0x2caa('0x12'),controller[_0x2caa('0x13')]);router['get']('/:id/preferred',controller[_0x2caa('0x14')]);router[_0x2caa('0x9')](_0x2caa('0x15'),controller[_0x2caa('0x16')]);var upload=multer({'storage':multer[_0x2caa('0x17')]({'destination':function(_0x1da7e2,_0x9034c6,_0x57a156){_0x57a156(null,path[_0x2caa('0x18')](config[_0x2caa('0x19')],_0x2caa('0x1a')));},'filename':function(_0x3a589c,_0x17d187,_0x4a6dae){_0x4a6dae(null,util[_0x2caa('0x1b')](_0x2caa('0x1c'),_0x2caa('0x1d'),path[_0x2caa('0x1e')](_0x17d187['originalname'])));}})});router[_0x2caa('0x1f')](_0x2caa('0xe'),upload[_0x2caa('0x20')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x2caa('0x17')]({'destination':function(_0x3ae309,_0x2ef8ca,_0x37ba74){_0x37ba74(null,path[_0x2caa('0x18')](config[_0x2caa('0x19')],_0x2caa('0x1a')));},'filename':function(_0x492770,_0x43ab6e,_0x1e98dc){_0x1e98dc(null,util['format'](_0x2caa('0x1c'),_0x2caa('0x21'),path[_0x2caa('0x1e')](_0x43ab6e[_0x2caa('0x22')])));}})});router[_0x2caa('0x1f')](_0x2caa('0x10'),upload['single'](_0x2caa('0x23')),controller[_0x2caa('0x24')]);var upload=multer({'storage':multer[_0x2caa('0x17')]({'destination':function(_0x51420e,_0x31b2e3,_0x344c4e){_0x344c4e(null,path[_0x2caa('0x18')](config[_0x2caa('0x19')],_0x2caa('0x1a')));},'filename':function(_0x2050e1,_0x3f9507,_0x49b12a){_0x49b12a(null,util['format'](_0x2caa('0x1c'),_0x2caa('0x25'),path[_0x2caa('0x1e')](_0x3f9507[_0x2caa('0x22')])));}})});router['post'](_0x2caa('0x26'),upload['single'](_0x2caa('0x23')),controller['addPreferred']);var upload=multer({'storage':multer[_0x2caa('0x17')]({'destination':function(_0x33fdb3,_0x340af6,_0xddff20){_0xddff20(null,path[_0x2caa('0x18')](config['root'],'server/files/images/logos/'));},'filename':function(_0x4d7a9f,_0x3b2864,_0x2b1b04){_0x2b1b04(null,util[_0x2caa('0x1b')]('%s%s','favicon',path[_0x2caa('0x1e')](_0x3b2864[_0x2caa('0x22')])));}})});router['post'](_0x2caa('0x15'),upload[_0x2caa('0x20')](_0x2caa('0x23')),controller['addFavicon']);router['put'](_0x2caa('0x27'),auth[_0x2caa('0x28')](),controller[_0x2caa('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 38d4737..1143950 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x5bb837,_0x1f67ff){var _0x212726=function(_0x1a8743){while(--_0x1a8743){_0x5bb837['push'](_0x5bb837['shift']());}};_0x212726(++_0x1f67ff);}(_0x7a54,0x106));var _0x47a5=function(_0x15f01b,_0x101f0d){_0x15f01b=_0x15f01b-0x0;var _0x3fb454=_0x7a54[_0x15f01b];return _0x3fb454;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'min_internal':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':_0x47a5('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x5')},'logo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLogo':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x47a5('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x47a5('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x47a5('0x4')]},'defaultPreferred':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x47a5('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x47a5('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x47a5('0x2')]},'transcribeRegion':{'type':Sequelize[_0x47a5('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x47a5('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x47a5('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xadb5=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0xadb5,0xad));var _0x5adb=function(_0x8a1555,_0x374a41){_0x8a1555=_0x8a1555-0x0;var _0x4d45f1=_0xadb5[_0x8a1555];return _0x4d45f1;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5adb('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5adb('0x2')](0xb),'unique':_0x5adb('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':_0x5adb('0x5')},'logo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5adb('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnusername':{'type':Sequelize[_0x5adb('0x4')]},'turnpassword':{'type':Sequelize[_0x5adb('0x4')]},'pageTitle':{'type':Sequelize[_0x5adb('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5adb('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x5adb('0x7')},'enableEmailPreview':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5adb('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5adb('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5adb('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5adb('0x2')]},'transcribeRegion':{'type':Sequelize[_0x5adb('0x4')]},'sentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5adb('0x2')]},'sentimentRegion':{'type':Sequelize[_0x5adb('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x5adb('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x5adb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index a68eb53..bb366e3 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 _0xfe3f=['logo','loginLogo','getLogo','server/files/images/logos','preferred','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','getLicense','default_preferred.png','default','download','addFavicon','favicon','getFavicon','default_favicon.ico','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','Setting','include','rows','includeAll','options','find','body','params','file','filename'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xfe3f,0x194));var _0xffe3=function(_0x231070,_0x4949f7){_0x231070=_0x231070-0x0;var _0x44bbd9=_0xfe3f[_0x231070];return _0x44bbd9;};'use strict';var emlformat=require(_0xffe3('0x0'));var rimraf=require(_0xffe3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xffe3('0x2'));var BPromise=require(_0xffe3('0x3'));var Mustache=require(_0xffe3('0x4'));var util=require(_0xffe3('0x5'));var path=require(_0xffe3('0x6'));var sox=require(_0xffe3('0x7'));var csv=require(_0xffe3('0x8'));var ejs=require(_0xffe3('0x9'));var fs=require('fs');var fs_extra=require(_0xffe3('0xa'));var _=require(_0xffe3('0xb'));var squel=require(_0xffe3('0xc'));var crypto=require('crypto');var jsforce=require(_0xffe3('0xd'));var deskjs=require(_0xffe3('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xffe3('0xf'));var authService=require(_0xffe3('0x10'));var qs=require(_0xffe3('0x11'));var as=require(_0xffe3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xffe3('0x13'));var utils=require('../../config/utils');var config=require(_0xffe3('0x14'));var licenseUtil=require(_0xffe3('0x15'));var db=require(_0xffe3('0x16'))['db'];var jayson=require(_0xffe3('0x17'));var client=jayson[_0xffe3('0x18')][_0xffe3('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x160867,_0x4833f4,_0x35fa8f,_0x195ac3){return new BPromise(function(_0x3ae305,_0x29c4a8){var _0x6c5d3e=_0x195ac3||client;return _0x6c5d3e[_0xffe3('0x1a')](_0x160867,_0x35fa8f)[_0xffe3('0x1b')](function(_0x1c64f1){logger[_0xffe3('0x1c')](_0xffe3('0x1d'),_0x4833f4,_0xffe3('0x1e'));logger[_0xffe3('0x1f')](_0xffe3('0x20'),_0x4833f4,_0xffe3('0x1e'),JSON[_0xffe3('0x21')](_0x1c64f1));if(_0x1c64f1[_0xffe3('0x22')]){if(_0x1c64f1['error'][_0xffe3('0x23')]===0x1f4){logger[_0xffe3('0x22')](_0xffe3('0x1d'),_0x4833f4,_0x1c64f1[_0xffe3('0x22')][_0xffe3('0x24')]);return _0x29c4a8(_0x1c64f1['error'][_0xffe3('0x24')]);}logger[_0xffe3('0x22')](_0xffe3('0x1d'),_0x4833f4,_0x1c64f1[_0xffe3('0x22')][_0xffe3('0x24')]);return _0x3ae305(_0x1c64f1[_0xffe3('0x22')][_0xffe3('0x24')]);}else{logger[_0xffe3('0x1c')](_0xffe3('0x1d'),_0x4833f4,_0xffe3('0x1e'));_0x3ae305(_0x1c64f1[_0xffe3('0x25')][_0xffe3('0x24')]);}})[_0xffe3('0x26')](function(_0xe0e618){logger[_0xffe3('0x22')](_0xffe3('0x1d'),_0x4833f4,_0xe0e618);_0x29c4a8(_0xe0e618);});});}function respondWithStatusCode(_0x161b1d,_0xf26791){_0xf26791=_0xf26791||0xcc;return function(_0x583429){if(_0x583429){return _0x161b1d[_0xffe3('0x27')](_0xf26791);}return _0x161b1d['status'](_0xf26791)[_0xffe3('0x28')]();};}function respondWithResult(_0x334698,_0x335aa6){_0x335aa6=_0x335aa6||0xc8;return function(_0x2a85af){if(_0x2a85af){return _0x334698[_0xffe3('0x29')](_0x335aa6)[_0xffe3('0x2a')](_0x2a85af);}};}function respondWithFilteredResult(_0x4ea535,_0x519d9e){return function(_0x28bb9b){if(_0x28bb9b){var _0x2c86d6=typeof _0x519d9e[_0xffe3('0x2b')]===_0xffe3('0x2c')&&typeof _0x519d9e[_0xffe3('0x2d')]===_0xffe3('0x2c');var _0x3c9594=_0x28bb9b[_0xffe3('0x2e')];var _0x458d5=_0x2c86d6?0x0:_0x519d9e[_0xffe3('0x2b')];var _0x187f93=_0x2c86d6?_0x28bb9b[_0xffe3('0x2e')]:_0x519d9e['offset']+_0x519d9e[_0xffe3('0x2d')];var _0x1c7886;if(_0x187f93>=_0x3c9594){_0x187f93=_0x3c9594;_0x1c7886=0xc8;}else{_0x1c7886=0xce;}_0x4ea535[_0xffe3('0x29')](_0x1c7886);return _0x4ea535[_0xffe3('0x2f')](_0xffe3('0x30'),_0x458d5+'-'+_0x187f93+'/'+_0x3c9594)[_0xffe3('0x2a')](_0x28bb9b);}return null;};}function patchUpdates(_0x2bd6d5){return function(_0x2c76c7){try{jsonpatch[_0xffe3('0x31')](_0x2c76c7,_0x2bd6d5,!![]);}catch(_0x4be323){return BPromise[_0xffe3('0x32')](_0x4be323);}return _0x2c76c7[_0xffe3('0x33')]();};}function saveUpdates(_0x575c14,_0x3eff77){return function(_0x1ca412){if(_0x1ca412){return _0x1ca412[_0xffe3('0x34')](_0x575c14)[_0xffe3('0x1b')](function(_0x531a7a){return _0x531a7a;});}return null;};}function removeEntity(_0x12c104,_0x4f37ff){return function(_0x4b658e){if(_0x4b658e){return _0x4b658e[_0xffe3('0x35')]()[_0xffe3('0x1b')](function(){_0x12c104[_0xffe3('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc877ba,_0x5972eb){return function(_0x22387e){if(!_0x22387e){_0xc877ba[_0xffe3('0x27')](0x194);}return _0x22387e;};}function handleError(_0x539ccf,_0x5065e4){_0x5065e4=_0x5065e4||0x1f4;return function(_0x5c2cf1){logger[_0xffe3('0x22')](_0x5c2cf1[_0xffe3('0x36')]);if(_0x5c2cf1[_0xffe3('0x37')]){delete _0x5c2cf1[_0xffe3('0x37')];}_0x539ccf['status'](_0x5065e4)[_0xffe3('0x38')](_0x5c2cf1);};}exports[_0xffe3('0x39')]=function(_0x2a381c,_0x3d78c3){var _0x5ac3a6={},_0x3a8f55={},_0x3753cf={'count':0x0,'rows':[]};var _0x1b030a=_[_0xffe3('0x3a')](db['Setting'][_0xffe3('0x3b')],function(_0x46a68c){return{'name':_0x46a68c[_0xffe3('0x3c')],'type':_0x46a68c['type'][_0xffe3('0x3d')]};});_0x3a8f55[_0xffe3('0x3e')]=_[_0xffe3('0x3a')](_0x1b030a,_0xffe3('0x37'));_0x3a8f55[_0xffe3('0x3f')]=_[_0xffe3('0x40')](_0x2a381c[_0xffe3('0x3f')]);_0x3a8f55[_0xffe3('0x41')]=_[_0xffe3('0x42')](_0x3a8f55['model'],_0x3a8f55[_0xffe3('0x3f')]);_0x5ac3a6[_0xffe3('0x43')]=_[_0xffe3('0x42')](_0x3a8f55['model'],qs[_0xffe3('0x44')](_0x2a381c[_0xffe3('0x3f')][_0xffe3('0x44')]));_0x5ac3a6[_0xffe3('0x43')]=_0x5ac3a6[_0xffe3('0x43')][_0xffe3('0x45')]?_0x5ac3a6['attributes']:_0x3a8f55[_0xffe3('0x3e')];if(!_0x2a381c[_0xffe3('0x3f')][_0xffe3('0x46')]('nolimit')){_0x5ac3a6[_0xffe3('0x2d')]=qs[_0xffe3('0x2d')](_0x2a381c[_0xffe3('0x3f')][_0xffe3('0x2d')]);_0x5ac3a6['offset']=qs[_0xffe3('0x2b')](_0x2a381c['query'][_0xffe3('0x2b')]);}_0x5ac3a6[_0xffe3('0x47')]=qs[_0xffe3('0x48')](_0x2a381c[_0xffe3('0x3f')]['sort']);_0x5ac3a6['where']=qs[_0xffe3('0x41')](_[_0xffe3('0x49')](_0x2a381c[_0xffe3('0x3f')],_0x3a8f55[_0xffe3('0x41')]),_0x1b030a);if(_0x2a381c[_0xffe3('0x3f')]['filter']){_0x5ac3a6[_0xffe3('0x4a')]=_[_0xffe3('0x4b')](_0x5ac3a6[_0xffe3('0x4a')],{'$or':_[_0xffe3('0x3a')](_0x1b030a,function(_0x11f767){if(_0x11f767['type']!==_0xffe3('0x4c')){var _0x385860={};_0x385860[_0x11f767['name']]={'$like':'%'+_0x2a381c[_0xffe3('0x3f')][_0xffe3('0x4d')]+'%'};return _0x385860;}})});}_0x5ac3a6=_[_0xffe3('0x4b')]({},_0x5ac3a6,_0x2a381c['options']);var _0x279ac9={'where':_0x5ac3a6['where']};return db[_0xffe3('0x4e')][_0xffe3('0x2e')](_0x279ac9)[_0xffe3('0x1b')](function(_0x3ece1f){_0x3753cf['count']=_0x3ece1f;if(_0x2a381c[_0xffe3('0x3f')]['includeAll']){_0x5ac3a6[_0xffe3('0x4f')]=[{'all':!![]}];}return db[_0xffe3('0x4e')]['findAll'](_0x5ac3a6);})['then'](function(_0x5fa804){_0x3753cf[_0xffe3('0x50')]=_0x5fa804;return _0x3753cf;})['then'](respondWithFilteredResult(_0x3d78c3,_0x5ac3a6))[_0xffe3('0x26')](handleError(_0x3d78c3,null));};exports['show']=function(_0x4c2213,_0x562319){var _0x68d299={'raw':![],'where':{'id':_0x4c2213['params']['id']}},_0x108923={};_0x108923[_0xffe3('0x3e')]=_[_0xffe3('0x40')](db[_0xffe3('0x4e')]['rawAttributes']);_0x108923[_0xffe3('0x3f')]=_[_0xffe3('0x40')](_0x4c2213[_0xffe3('0x3f')]);_0x108923[_0xffe3('0x41')]=_[_0xffe3('0x42')](_0x108923['model'],_0x108923[_0xffe3('0x3f')]);_0x68d299[_0xffe3('0x43')]=_[_0xffe3('0x42')](_0x108923[_0xffe3('0x3e')],qs[_0xffe3('0x44')](_0x4c2213[_0xffe3('0x3f')]['fields']));_0x68d299[_0xffe3('0x43')]=_0x68d299[_0xffe3('0x43')][_0xffe3('0x45')]?_0x68d299[_0xffe3('0x43')]:_0x108923[_0xffe3('0x3e')];if(_0x4c2213['query'][_0xffe3('0x51')]){_0x68d299[_0xffe3('0x4f')]=[{'all':!![]}];}_0x68d299=_[_0xffe3('0x4b')]({},_0x68d299,_0x4c2213[_0xffe3('0x52')]);return db[_0xffe3('0x4e')][_0xffe3('0x53')](_0x68d299)['then'](handleEntityNotFound(_0x562319,null))[_0xffe3('0x1b')](respondWithResult(_0x562319,null))[_0xffe3('0x26')](handleError(_0x562319,null));};exports[_0xffe3('0x34')]=function(_0x18b7a3,_0x4f3bfe){if(_0x18b7a3[_0xffe3('0x54')]['id']){delete _0x18b7a3[_0xffe3('0x54')]['id'];}return db[_0xffe3('0x4e')][_0xffe3('0x53')]({'where':{'id':_0x18b7a3[_0xffe3('0x55')]['id']}})[_0xffe3('0x1b')](handleEntityNotFound(_0x4f3bfe,null))[_0xffe3('0x1b')](saveUpdates(_0x18b7a3['body'],null))[_0xffe3('0x1b')](respondWithResult(_0x4f3bfe,null))['catch'](handleError(_0x4f3bfe,null));};exports['addLogo']=function(_0x413d3a,_0x318f5b,_0x3a1897){if(_0x413d3a['file']&&_0x413d3a[_0xffe3('0x56')][_0xffe3('0x57')]){_0x413d3a[_0xffe3('0x54')][_0xffe3('0x58')]=_0x413d3a[_0xffe3('0x56')][_0xffe3('0x57')];}return db['Setting'][_0xffe3('0x53')]({'where':{'id':_0x413d3a[_0xffe3('0x55')]['id']}})[_0xffe3('0x1b')](handleEntityNotFound(_0x318f5b,null))['then'](saveUpdates(_0x413d3a[_0xffe3('0x54')],null))[_0xffe3('0x1b')](respondWithResult(_0x318f5b,null))[_0xffe3('0x26')](handleError(_0x318f5b,null));};exports['addLogoLogin']=function(_0x1d4884,_0x2f2a9e,_0x2f5de7){if(_0x1d4884[_0xffe3('0x56')]&&_0x1d4884[_0xffe3('0x56')][_0xffe3('0x57')]){_0x1d4884[_0xffe3('0x54')][_0xffe3('0x59')]=_0x1d4884['file'][_0xffe3('0x57')];}return db['Setting'][_0xffe3('0x53')]({'where':{'id':_0x1d4884[_0xffe3('0x55')]['id']}})[_0xffe3('0x1b')](handleEntityNotFound(_0x2f2a9e,null))[_0xffe3('0x1b')](saveUpdates(_0x1d4884[_0xffe3('0x54')],null))[_0xffe3('0x1b')](respondWithResult(_0x2f2a9e,null))[_0xffe3('0x26')](handleError(_0x2f2a9e,null));};var utilLicense=require(_0xffe3('0x15'));exports[_0xffe3('0x5a')]=function(_0x5b79c0,_0x13b9f4,_0x21b788){var _0x54cfa4=_0xffe3('0x5b');var _0x2158e1={'custom':![]};return utilLicense['getLicense']()[_0xffe3('0x1b')](function(_0x35994c){if(_0x35994c){_0x2158e1=_0x35994c;}return db[_0xffe3('0x4e')]['find']({'where':{'id':_0x5b79c0[_0xffe3('0x55')]['id']},'attributes':[_0xffe3('0x58'),_0xffe3('0x59'),_0xffe3('0x5c'),'favicon',_0xffe3('0x5d'),'defaultLoginLogo',_0xffe3('0x5e'),_0xffe3('0x5f')],'raw':!![]});})[_0xffe3('0x1b')](handleEntityNotFound(_0x13b9f4,null))[_0xffe3('0x1b')](function(_0x1c8c33){if(_0x1c8c33){var _0x32fbed=_0x1c8c33[_0xffe3('0x58')]&&fs[_0xffe3('0x60')](path[_0xffe3('0x61')](config[_0xffe3('0x62')],_0x54cfa4,_['toLower'](_0x1c8c33[_0xffe3('0x58')])))?path[_0xffe3('0x61')](config[_0xffe3('0x62')],_0x54cfa4,_[_0xffe3('0x63')](_0x1c8c33[_0xffe3('0x58')])):path['join'](config[_0xffe3('0x62')],_0x54cfa4,_[_0xffe3('0x63')](_0xffe3('0x64')));var _0x1ae330='default'+_[_0xffe3('0x65')](_0xffe3('0x58'));if(_0x1c8c33[_0x1ae330]||!_0x2158e1[_0xffe3('0x66')]){_0x32fbed=path['join'](config[_0xffe3('0x62')],_0x54cfa4,_[_0xffe3('0x63')](_0xffe3('0x64')));}if(!fs[_0xffe3('0x60')](_0x32fbed)){throw new db[(_0xffe3('0x67'))][(_0xffe3('0x68'))](_[_0xffe3('0x65')](_0xffe3('0x58'))+_0xffe3('0x69'));}return _0x13b9f4['download'](_0x32fbed);}})[_0xffe3('0x26')](handleError(_0x13b9f4,null));};var utilLicense=require(_0xffe3('0x15'));exports[_0xffe3('0x6a')]=function(_0x3d2dd9,_0x5897ac,_0x35e0d0){var _0x1aa5b7=_0xffe3('0x5b');var _0x19c1c7={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x5a1fba){if(_0x5a1fba){_0x19c1c7=_0x5a1fba;}return db[_0xffe3('0x4e')]['find']({'where':{'id':_0x3d2dd9[_0xffe3('0x55')]['id']},'attributes':[_0xffe3('0x58'),_0xffe3('0x59'),_0xffe3('0x5c'),'favicon',_0xffe3('0x5d'),_0xffe3('0x6b'),_0xffe3('0x5e'),_0xffe3('0x5f')],'raw':!![]});})[_0xffe3('0x1b')](handleEntityNotFound(_0x5897ac,null))[_0xffe3('0x1b')](function(_0x1fd7d0){if(_0x1fd7d0){var _0x2271ee=_0x1fd7d0['loginLogo']&&fs['existsSync'](path[_0xffe3('0x61')](config[_0xffe3('0x62')],_0x1aa5b7,_['toLower'](_0x1fd7d0[_0xffe3('0x59')])))?path[_0xffe3('0x61')](config[_0xffe3('0x62')],_0x1aa5b7,_[_0xffe3('0x63')](_0x1fd7d0['loginLogo'])):path[_0xffe3('0x61')](config[_0xffe3('0x62')],_0x1aa5b7,_[_0xffe3('0x63')](_0xffe3('0x6c')));var _0x2a422a='default'+_[_0xffe3('0x65')](_0xffe3('0x59'));if(_0x1fd7d0[_0x2a422a]||!_0x19c1c7[_0xffe3('0x66')]){_0x2271ee=path['join'](config[_0xffe3('0x62')],_0x1aa5b7,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xffe3('0x60')](_0x2271ee)){throw new db[(_0xffe3('0x67'))][(_0xffe3('0x68'))](_[_0xffe3('0x65')]('loginLogo')+_0xffe3('0x69'));}return _0x5897ac['download'](_0x2271ee);}})[_0xffe3('0x26')](handleError(_0x5897ac,null));};exports[_0xffe3('0x6d')]=function(_0x49e79e,_0x4c3a55){return db[_0xffe3('0x4e')]['find']({'where':{'id':_0x49e79e['params']['id']},'attributes':[_0xffe3('0x6e')]})[_0xffe3('0x1b')](respondWithResult(_0x4c3a55,null))[_0xffe3('0x26')](handleError(_0x4c3a55,null));};exports[_0xffe3('0x6f')]=function(_0x23da38,_0x43b4ac,_0x427de3){if(_0x23da38[_0xffe3('0x56')]&&_0x23da38[_0xffe3('0x56')][_0xffe3('0x57')]){_0x23da38['body']['preferred']=_0x23da38[_0xffe3('0x56')]['filename'];}return db[_0xffe3('0x4e')][_0xffe3('0x53')]({'where':{'id':_0x23da38['params']['id']}})['then'](handleEntityNotFound(_0x43b4ac,null))[_0xffe3('0x1b')](saveUpdates(_0x23da38['body'],null))[_0xffe3('0x1b')](respondWithResult(_0x43b4ac,null))['catch'](handleError(_0x43b4ac,null));};var utilLicense=require(_0xffe3('0x15'));exports[_0xffe3('0x70')]=function(_0x116f83,_0x441b91,_0x7433b9){var _0x53ffa9='server/files/images/logos';var _0x3d72b3={'custom':![]};return utilLicense[_0xffe3('0x71')]()[_0xffe3('0x1b')](function(_0x3e26e8){if(_0x3e26e8){_0x3d72b3=_0x3e26e8;}return db[_0xffe3('0x4e')][_0xffe3('0x53')]({'where':{'id':_0x116f83[_0xffe3('0x55')]['id']},'attributes':[_0xffe3('0x58'),'loginLogo','preferred','favicon',_0xffe3('0x5d'),_0xffe3('0x6b'),'defaultPreferred',_0xffe3('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x441b91,null))[_0xffe3('0x1b')](function(_0x82461){if(_0x82461){var _0x4ed43a=_0x82461[_0xffe3('0x5c')]&&fs['existsSync'](path[_0xffe3('0x61')](config['root'],_0x53ffa9,_['toLower'](_0x82461[_0xffe3('0x5c')])))?path[_0xffe3('0x61')](config[_0xffe3('0x62')],_0x53ffa9,_['toLower'](_0x82461[_0xffe3('0x5c')])):path['join'](config[_0xffe3('0x62')],_0x53ffa9,_[_0xffe3('0x63')](_0xffe3('0x72')));var _0x31936d=_0xffe3('0x73')+_[_0xffe3('0x65')](_0xffe3('0x5c'));if(_0x82461[_0x31936d]||!_0x3d72b3[_0xffe3('0x66')]||!_0x3d72b3[_0xffe3('0x5c')]){_0x4ed43a=path['join'](config['root'],_0x53ffa9,_[_0xffe3('0x63')](_0xffe3('0x72')));}if(!fs[_0xffe3('0x60')](_0x4ed43a)){throw new db[(_0xffe3('0x67'))]['ValidationError'](_[_0xffe3('0x65')](_0xffe3('0x5c'))+_0xffe3('0x69'));}return _0x441b91[_0xffe3('0x74')](_0x4ed43a);}})['catch'](handleError(_0x441b91,null));};exports[_0xffe3('0x75')]=function(_0x3f4688,_0x760984,_0x4ef7c2){if(_0x3f4688['file']&&_0x3f4688[_0xffe3('0x56')]['filename']){_0x3f4688[_0xffe3('0x54')][_0xffe3('0x76')]=_0x3f4688['file'][_0xffe3('0x57')];}return db[_0xffe3('0x4e')][_0xffe3('0x53')]({'where':{'id':_0x3f4688[_0xffe3('0x55')]['id']}})['then'](handleEntityNotFound(_0x760984,null))[_0xffe3('0x1b')](saveUpdates(_0x3f4688[_0xffe3('0x54')],null))[_0xffe3('0x1b')](respondWithResult(_0x760984,null))[_0xffe3('0x26')](handleError(_0x760984,null));};var utilLicense=require(_0xffe3('0x15'));exports[_0xffe3('0x77')]=function(_0x5bc1b6,_0x1ae958,_0x5c8de0){var _0x19bc41=_0xffe3('0x5b');var _0x360f78={'custom':![]};return utilLicense[_0xffe3('0x71')]()[_0xffe3('0x1b')](function(_0xe0f766){if(_0xe0f766){_0x360f78=_0xe0f766;}return db[_0xffe3('0x4e')][_0xffe3('0x53')]({'where':{'id':_0x5bc1b6[_0xffe3('0x55')]['id']},'attributes':[_0xffe3('0x58'),_0xffe3('0x59'),_0xffe3('0x5c'),_0xffe3('0x76'),'defaultLogo',_0xffe3('0x6b'),_0xffe3('0x5e'),_0xffe3('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x1ae958,null))[_0xffe3('0x1b')](function(_0x255906){if(_0x255906){var _0x36f76e=_0x255906[_0xffe3('0x76')]&&fs['existsSync'](path[_0xffe3('0x61')](config[_0xffe3('0x62')],_0x19bc41,_[_0xffe3('0x63')](_0x255906['favicon'])))?path[_0xffe3('0x61')](config[_0xffe3('0x62')],_0x19bc41,_['toLower'](_0x255906[_0xffe3('0x76')])):path['join'](config[_0xffe3('0x62')],_0x19bc41,_[_0xffe3('0x63')](_0xffe3('0x78')));var _0x37d5ba=_0xffe3('0x73')+_[_0xffe3('0x65')]('favicon');if(_0x255906[_0x37d5ba]||!_0x360f78[_0xffe3('0x66')]){_0x36f76e=path['join'](config[_0xffe3('0x62')],_0x19bc41,_[_0xffe3('0x63')](_0xffe3('0x78')));}if(!fs[_0xffe3('0x60')](_0x36f76e)){throw new db[(_0xffe3('0x67'))][(_0xffe3('0x68'))](_[_0xffe3('0x65')](_0xffe3('0x76'))+_0xffe3('0x69'));}return _0x1ae958[_0xffe3('0x74')](_0x36f76e);}})[_0xffe3('0x26')](handleError(_0x1ae958,null));};exports['getDate']=function(_0x2f56dc,_0x236e3c){var _0x51bec1={'offset':moment()['utcOffset']()};_0x51bec1['now']=moment()[_0xffe3('0x79')](_0x51bec1[_0xffe3('0x2b')])['format'](_0xffe3('0x7a'));return _0x236e3c['status'](0xc8)[_0xffe3('0x38')](_0x51bec1);}; \ No newline at end of file +var _0xd943=['querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','show','params','body','find','addLogo','filename','file','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','ValidationError','download','default_loginLogo.svg','Sequelize','\x20not\x20found','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0xe62b9f,_0x4be658){var _0x33a712=function(_0x2e3292){while(--_0x2e3292){_0xe62b9f['push'](_0xe62b9f['shift']());}};_0x33a712(++_0x4be658);}(_0xd943,0x14a));var _0x3d94=function(_0x759e4c,_0x1fa12a){_0x759e4c=_0x759e4c-0x0;var _0xbccba5=_0xd943[_0x759e4c];return _0xbccba5;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require(_0x3d94('0x4'));var moment=require(_0x3d94('0x5'));var BPromise=require(_0x3d94('0x6'));var Mustache=require(_0x3d94('0x7'));var util=require(_0x3d94('0x8'));var path=require(_0x3d94('0x9'));var sox=require(_0x3d94('0xa'));var csv=require(_0x3d94('0xb'));var ejs=require(_0x3d94('0xc'));var fs=require('fs');var fs_extra=require(_0x3d94('0xd'));var _=require(_0x3d94('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3d94('0xb'));var querystring=require(_0x3d94('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3d94('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x3d94('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1eccd4,_0x128995,_0x19fb29,_0x49cb70){return new BPromise(function(_0x33ba80,_0x56c63c){var _0x476952=_0x49cb70||client;return _0x476952[_0x3d94('0x16')](_0x1eccd4,_0x19fb29)[_0x3d94('0x17')](function(_0x51fd05){logger[_0x3d94('0x18')](_0x3d94('0x19'),_0x128995,_0x3d94('0x1a'));logger[_0x3d94('0x1b')](_0x3d94('0x1c'),_0x128995,'request\x20sent',JSON[_0x3d94('0x1d')](_0x51fd05));if(_0x51fd05[_0x3d94('0x1e')]){if(_0x51fd05[_0x3d94('0x1e')]['code']===0x1f4){logger[_0x3d94('0x1e')](_0x3d94('0x19'),_0x128995,_0x51fd05[_0x3d94('0x1e')]['message']);return _0x56c63c(_0x51fd05[_0x3d94('0x1e')]['message']);}logger[_0x3d94('0x1e')](_0x3d94('0x19'),_0x128995,_0x51fd05['error'][_0x3d94('0x1f')]);return _0x33ba80(_0x51fd05[_0x3d94('0x1e')][_0x3d94('0x1f')]);}else{logger[_0x3d94('0x18')](_0x3d94('0x19'),_0x128995,'request\x20sent');_0x33ba80(_0x51fd05[_0x3d94('0x20')][_0x3d94('0x1f')]);}})[_0x3d94('0x21')](function(_0x4ccb06){logger['error'](_0x3d94('0x19'),_0x128995,_0x4ccb06);_0x56c63c(_0x4ccb06);});});}function respondWithStatusCode(_0xa01bfc,_0xc4ae0d){_0xc4ae0d=_0xc4ae0d||0xcc;return function(_0x338b8c){if(_0x338b8c){return _0xa01bfc['sendStatus'](_0xc4ae0d);}return _0xa01bfc['status'](_0xc4ae0d)['end']();};}function respondWithResult(_0x848ca0,_0x5cc475){_0x5cc475=_0x5cc475||0xc8;return function(_0x4fc16d){if(_0x4fc16d){return _0x848ca0[_0x3d94('0x22')](_0x5cc475)[_0x3d94('0x23')](_0x4fc16d);}};}function respondWithFilteredResult(_0x792786,_0x221574){return function(_0x51e69b){if(_0x51e69b){var _0x1cf820=typeof _0x221574[_0x3d94('0x24')]===_0x3d94('0x25')&&typeof _0x221574[_0x3d94('0x26')]===_0x3d94('0x25');var _0x30b7ad=_0x51e69b['count'];var _0x5101a5=_0x1cf820?0x0:_0x221574[_0x3d94('0x24')];var _0x121e02=_0x1cf820?_0x51e69b[_0x3d94('0x27')]:_0x221574[_0x3d94('0x24')]+_0x221574[_0x3d94('0x26')];var _0x9177bf;if(_0x121e02>=_0x30b7ad){_0x121e02=_0x30b7ad;_0x9177bf=0xc8;}else{_0x9177bf=0xce;}_0x792786[_0x3d94('0x22')](_0x9177bf);return _0x792786[_0x3d94('0x28')](_0x3d94('0x29'),_0x5101a5+'-'+_0x121e02+'/'+_0x30b7ad)['json'](_0x51e69b);}return null;};}function patchUpdates(_0x264f0f){return function(_0x3dd9d0){try{jsonpatch['apply'](_0x3dd9d0,_0x264f0f,!![]);}catch(_0x199eab){return BPromise[_0x3d94('0x2a')](_0x199eab);}return _0x3dd9d0[_0x3d94('0x2b')]();};}function saveUpdates(_0x316764,_0x397c3f){return function(_0x122025){if(_0x122025){return _0x122025[_0x3d94('0x2c')](_0x316764)[_0x3d94('0x17')](function(_0x5a5a70){return _0x5a5a70;});}return null;};}function removeEntity(_0x1a0025,_0x3de5b8){return function(_0x3b1fe0){if(_0x3b1fe0){return _0x3b1fe0[_0x3d94('0x2d')]()[_0x3d94('0x17')](function(){_0x1a0025[_0x3d94('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a8e9c,_0x4c8c12){return function(_0x57080d){if(!_0x57080d){_0x2a8e9c['sendStatus'](0x194);}return _0x57080d;};}function handleError(_0x2dff30,_0x1705f7){_0x1705f7=_0x1705f7||0x1f4;return function(_0x5c678e){logger['error'](_0x5c678e['stack']);if(_0x5c678e['name']){delete _0x5c678e[_0x3d94('0x2e')];}_0x2dff30[_0x3d94('0x22')](_0x1705f7)[_0x3d94('0x2f')](_0x5c678e);};}exports[_0x3d94('0x30')]=function(_0x19ee2a,_0xfb11ae){var _0x2e61e2={},_0x5812d6={},_0x40b440={'count':0x0,'rows':[]};var _0x4d0953=_[_0x3d94('0x31')](db[_0x3d94('0x32')][_0x3d94('0x33')],function(_0x39d738){return{'name':_0x39d738[_0x3d94('0x34')],'type':_0x39d738[_0x3d94('0x35')][_0x3d94('0x36')]};});_0x5812d6[_0x3d94('0x37')]=_[_0x3d94('0x31')](_0x4d0953,_0x3d94('0x2e'));_0x5812d6[_0x3d94('0x38')]=_[_0x3d94('0x39')](_0x19ee2a[_0x3d94('0x38')]);_0x5812d6['filters']=_[_0x3d94('0x3a')](_0x5812d6[_0x3d94('0x37')],_0x5812d6['query']);_0x2e61e2[_0x3d94('0x3b')]=_[_0x3d94('0x3a')](_0x5812d6['model'],qs[_0x3d94('0x3c')](_0x19ee2a[_0x3d94('0x38')][_0x3d94('0x3c')]));_0x2e61e2['attributes']=_0x2e61e2['attributes'][_0x3d94('0x3d')]?_0x2e61e2[_0x3d94('0x3b')]:_0x5812d6[_0x3d94('0x37')];if(!_0x19ee2a[_0x3d94('0x38')][_0x3d94('0x3e')]('nolimit')){_0x2e61e2[_0x3d94('0x26')]=qs[_0x3d94('0x26')](_0x19ee2a[_0x3d94('0x38')][_0x3d94('0x26')]);_0x2e61e2[_0x3d94('0x24')]=qs[_0x3d94('0x24')](_0x19ee2a[_0x3d94('0x38')][_0x3d94('0x24')]);}_0x2e61e2['order']=qs[_0x3d94('0x3f')](_0x19ee2a[_0x3d94('0x38')]['sort']);_0x2e61e2['where']=qs[_0x3d94('0x40')](_[_0x3d94('0x41')](_0x19ee2a[_0x3d94('0x38')],_0x5812d6[_0x3d94('0x40')]),_0x4d0953);if(_0x19ee2a[_0x3d94('0x38')][_0x3d94('0x42')]){_0x2e61e2[_0x3d94('0x43')]=_[_0x3d94('0x44')](_0x2e61e2[_0x3d94('0x43')],{'$or':_[_0x3d94('0x31')](_0x4d0953,function(_0x7e11a6){if(_0x7e11a6[_0x3d94('0x35')]!=='VIRTUAL'){var _0x473820={};_0x473820[_0x7e11a6['name']]={'$like':'%'+_0x19ee2a['query']['filter']+'%'};return _0x473820;}})});}_0x2e61e2=_['merge']({},_0x2e61e2,_0x19ee2a[_0x3d94('0x45')]);var _0x2bf1c1={'where':_0x2e61e2['where']};return db[_0x3d94('0x32')][_0x3d94('0x27')](_0x2bf1c1)[_0x3d94('0x17')](function(_0x30dbc6){_0x40b440['count']=_0x30dbc6;if(_0x19ee2a['query'][_0x3d94('0x46')]){_0x2e61e2[_0x3d94('0x47')]=[{'all':!![]}];}return db[_0x3d94('0x32')]['findAll'](_0x2e61e2);})[_0x3d94('0x17')](function(_0x315b65){_0x40b440[_0x3d94('0x48')]=_0x315b65;return _0x40b440;})[_0x3d94('0x17')](respondWithFilteredResult(_0xfb11ae,_0x2e61e2))['catch'](handleError(_0xfb11ae,null));};exports[_0x3d94('0x49')]=function(_0x3851d9,_0x155fad){var _0x131c52={'raw':![],'where':{'id':_0x3851d9[_0x3d94('0x4a')]['id']}},_0x2dd623={};_0x2dd623[_0x3d94('0x37')]=_[_0x3d94('0x39')](db[_0x3d94('0x32')][_0x3d94('0x33')]);_0x2dd623[_0x3d94('0x38')]=_[_0x3d94('0x39')](_0x3851d9['query']);_0x2dd623[_0x3d94('0x40')]=_['intersection'](_0x2dd623[_0x3d94('0x37')],_0x2dd623[_0x3d94('0x38')]);_0x131c52['attributes']=_['intersection'](_0x2dd623[_0x3d94('0x37')],qs[_0x3d94('0x3c')](_0x3851d9[_0x3d94('0x38')][_0x3d94('0x3c')]));_0x131c52[_0x3d94('0x3b')]=_0x131c52[_0x3d94('0x3b')][_0x3d94('0x3d')]?_0x131c52[_0x3d94('0x3b')]:_0x2dd623[_0x3d94('0x37')];if(_0x3851d9['query'][_0x3d94('0x46')]){_0x131c52[_0x3d94('0x47')]=[{'all':!![]}];}_0x131c52=_[_0x3d94('0x44')]({},_0x131c52,_0x3851d9[_0x3d94('0x45')]);return db['Setting']['find'](_0x131c52)[_0x3d94('0x17')](handleEntityNotFound(_0x155fad,null))[_0x3d94('0x17')](respondWithResult(_0x155fad,null))[_0x3d94('0x21')](handleError(_0x155fad,null));};exports[_0x3d94('0x2c')]=function(_0x2891d2,_0x432ff9){if(_0x2891d2[_0x3d94('0x4b')]['id']){delete _0x2891d2[_0x3d94('0x4b')]['id'];}return db['Setting'][_0x3d94('0x4c')]({'where':{'id':_0x2891d2[_0x3d94('0x4a')]['id']}})[_0x3d94('0x17')](handleEntityNotFound(_0x432ff9,null))['then'](saveUpdates(_0x2891d2['body'],null))[_0x3d94('0x17')](respondWithResult(_0x432ff9,null))[_0x3d94('0x21')](handleError(_0x432ff9,null));};exports[_0x3d94('0x4d')]=function(_0x1609a8,_0x53c7ca,_0x4b81b0){if(_0x1609a8['file']&&_0x1609a8['file'][_0x3d94('0x4e')]){_0x1609a8[_0x3d94('0x4b')]['logo']=_0x1609a8[_0x3d94('0x4f')][_0x3d94('0x4e')];}return db[_0x3d94('0x32')][_0x3d94('0x4c')]({'where':{'id':_0x1609a8[_0x3d94('0x4a')]['id']}})[_0x3d94('0x17')](handleEntityNotFound(_0x53c7ca,null))[_0x3d94('0x17')](saveUpdates(_0x1609a8[_0x3d94('0x4b')],null))['then'](respondWithResult(_0x53c7ca,null))[_0x3d94('0x21')](handleError(_0x53c7ca,null));};exports[_0x3d94('0x50')]=function(_0x388dd4,_0x1fa80a,_0xaf6cf0){if(_0x388dd4['file']&&_0x388dd4[_0x3d94('0x4f')]['filename']){_0x388dd4[_0x3d94('0x4b')][_0x3d94('0x51')]=_0x388dd4[_0x3d94('0x4f')][_0x3d94('0x4e')];}return db['Setting'][_0x3d94('0x4c')]({'where':{'id':_0x388dd4[_0x3d94('0x4a')]['id']}})[_0x3d94('0x17')](handleEntityNotFound(_0x1fa80a,null))[_0x3d94('0x17')](saveUpdates(_0x388dd4[_0x3d94('0x4b')],null))['then'](respondWithResult(_0x1fa80a,null))[_0x3d94('0x21')](handleError(_0x1fa80a,null));};var utilLicense=require('../../config/license/util');exports[_0x3d94('0x52')]=function(_0x1def84,_0x345a6d,_0x518b5f){var _0xc6254b=_0x3d94('0x53');var _0x2f72df={'custom':![]};return utilLicense[_0x3d94('0x54')]()[_0x3d94('0x17')](function(_0x558400){if(_0x558400){_0x2f72df=_0x558400;}return db[_0x3d94('0x32')]['find']({'where':{'id':_0x1def84['params']['id']},'attributes':[_0x3d94('0x55'),'loginLogo',_0x3d94('0x56'),_0x3d94('0x57'),_0x3d94('0x58'),_0x3d94('0x59'),_0x3d94('0x5a'),_0x3d94('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x345a6d,null))['then'](function(_0x42c4b2){if(_0x42c4b2){var _0x28a8c1=_0x42c4b2[_0x3d94('0x55')]&&fs['existsSync'](path[_0x3d94('0x5c')](config[_0x3d94('0x5d')],_0xc6254b,_[_0x3d94('0x5e')](_0x42c4b2[_0x3d94('0x55')])))?path[_0x3d94('0x5c')](config[_0x3d94('0x5d')],_0xc6254b,_[_0x3d94('0x5e')](_0x42c4b2[_0x3d94('0x55')])):path[_0x3d94('0x5c')](config[_0x3d94('0x5d')],_0xc6254b,_['toLower'](_0x3d94('0x5f')));var _0x4c8aea=_0x3d94('0x60')+_[_0x3d94('0x61')]('logo');if(_0x42c4b2[_0x4c8aea]||!_0x2f72df[_0x3d94('0x62')]){_0x28a8c1=path[_0x3d94('0x5c')](config[_0x3d94('0x5d')],_0xc6254b,_[_0x3d94('0x5e')](_0x3d94('0x5f')));}if(!fs[_0x3d94('0x63')](_0x28a8c1)){throw new db['Sequelize'][(_0x3d94('0x64'))](_[_0x3d94('0x61')]('logo')+'\x20not\x20found');}return _0x345a6d[_0x3d94('0x65')](_0x28a8c1);}})[_0x3d94('0x21')](handleError(_0x345a6d,null));};var utilLicense=require(_0x3d94('0x14'));exports['getLogoLogin']=function(_0x15cb8a,_0x110a84,_0x135b53){var _0x5b84e5=_0x3d94('0x53');var _0x4a5196={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x47a5c1){if(_0x47a5c1){_0x4a5196=_0x47a5c1;}return db['Setting'][_0x3d94('0x4c')]({'where':{'id':_0x15cb8a[_0x3d94('0x4a')]['id']},'attributes':[_0x3d94('0x55'),'loginLogo','preferred',_0x3d94('0x57'),_0x3d94('0x58'),_0x3d94('0x59'),_0x3d94('0x5a'),_0x3d94('0x5b')],'raw':!![]});})[_0x3d94('0x17')](handleEntityNotFound(_0x110a84,null))[_0x3d94('0x17')](function(_0x486fa3){if(_0x486fa3){var _0x3f86ff=_0x486fa3[_0x3d94('0x51')]&&fs[_0x3d94('0x63')](path[_0x3d94('0x5c')](config[_0x3d94('0x5d')],_0x5b84e5,_['toLower'](_0x486fa3['loginLogo'])))?path[_0x3d94('0x5c')](config[_0x3d94('0x5d')],_0x5b84e5,_['toLower'](_0x486fa3[_0x3d94('0x51')])):path[_0x3d94('0x5c')](config[_0x3d94('0x5d')],_0x5b84e5,_['toLower'](_0x3d94('0x66')));var _0x1cb42a=_0x3d94('0x60')+_[_0x3d94('0x61')](_0x3d94('0x51'));if(_0x486fa3[_0x1cb42a]||!_0x4a5196[_0x3d94('0x62')]){_0x3f86ff=path['join'](config[_0x3d94('0x5d')],_0x5b84e5,_[_0x3d94('0x5e')](_0x3d94('0x66')));}if(!fs[_0x3d94('0x63')](_0x3f86ff)){throw new db[(_0x3d94('0x67'))][(_0x3d94('0x64'))](_['upperFirst'](_0x3d94('0x51'))+_0x3d94('0x68'));}return _0x110a84[_0x3d94('0x65')](_0x3f86ff);}})['catch'](handleError(_0x110a84,null));};exports[_0x3d94('0x69')]=function(_0x497dce,_0x42d008){return db[_0x3d94('0x32')]['find']({'where':{'id':_0x497dce[_0x3d94('0x4a')]['id']},'attributes':[_0x3d94('0x6a')]})['then'](respondWithResult(_0x42d008,null))[_0x3d94('0x21')](handleError(_0x42d008,null));};exports[_0x3d94('0x6b')]=function(_0x37676e,_0x3082e9,_0x181fcb){if(_0x37676e[_0x3d94('0x4f')]&&_0x37676e[_0x3d94('0x4f')][_0x3d94('0x4e')]){_0x37676e[_0x3d94('0x4b')][_0x3d94('0x56')]=_0x37676e[_0x3d94('0x4f')][_0x3d94('0x4e')];}return db[_0x3d94('0x32')][_0x3d94('0x4c')]({'where':{'id':_0x37676e['params']['id']}})[_0x3d94('0x17')](handleEntityNotFound(_0x3082e9,null))[_0x3d94('0x17')](saveUpdates(_0x37676e['body'],null))[_0x3d94('0x17')](respondWithResult(_0x3082e9,null))[_0x3d94('0x21')](handleError(_0x3082e9,null));};var utilLicense=require(_0x3d94('0x14'));exports['getPreferred']=function(_0xf9275f,_0x514310,_0x28c390){var _0x25465d=_0x3d94('0x53');var _0x5e7cee={'custom':![]};return utilLicense[_0x3d94('0x54')]()[_0x3d94('0x17')](function(_0x1847c6){if(_0x1847c6){_0x5e7cee=_0x1847c6;}return db[_0x3d94('0x32')][_0x3d94('0x4c')]({'where':{'id':_0xf9275f[_0x3d94('0x4a')]['id']},'attributes':[_0x3d94('0x55'),_0x3d94('0x51'),'preferred',_0x3d94('0x57'),_0x3d94('0x58'),_0x3d94('0x59'),_0x3d94('0x5a'),_0x3d94('0x5b')],'raw':!![]});})[_0x3d94('0x17')](handleEntityNotFound(_0x514310,null))[_0x3d94('0x17')](function(_0x206a17){if(_0x206a17){var _0x49ce74=_0x206a17['preferred']&&fs[_0x3d94('0x63')](path['join'](config[_0x3d94('0x5d')],_0x25465d,_[_0x3d94('0x5e')](_0x206a17[_0x3d94('0x56')])))?path[_0x3d94('0x5c')](config[_0x3d94('0x5d')],_0x25465d,_[_0x3d94('0x5e')](_0x206a17['preferred'])):path[_0x3d94('0x5c')](config['root'],_0x25465d,_[_0x3d94('0x5e')](_0x3d94('0x6c')));var _0x3eb5dc='default'+_[_0x3d94('0x61')](_0x3d94('0x56'));if(_0x206a17[_0x3eb5dc]||!_0x5e7cee[_0x3d94('0x62')]||!_0x5e7cee[_0x3d94('0x56')]){_0x49ce74=path[_0x3d94('0x5c')](config[_0x3d94('0x5d')],_0x25465d,_[_0x3d94('0x5e')]('default_preferred.png'));}if(!fs['existsSync'](_0x49ce74)){throw new db[(_0x3d94('0x67'))][(_0x3d94('0x64'))](_['upperFirst'](_0x3d94('0x56'))+'\x20not\x20found');}return _0x514310[_0x3d94('0x65')](_0x49ce74);}})['catch'](handleError(_0x514310,null));};exports[_0x3d94('0x6d')]=function(_0x1c6ef5,_0x25cfae,_0x2d41aa){if(_0x1c6ef5[_0x3d94('0x4f')]&&_0x1c6ef5[_0x3d94('0x4f')]['filename']){_0x1c6ef5[_0x3d94('0x4b')]['favicon']=_0x1c6ef5['file'][_0x3d94('0x4e')];}return db['Setting'][_0x3d94('0x4c')]({'where':{'id':_0x1c6ef5['params']['id']}})[_0x3d94('0x17')](handleEntityNotFound(_0x25cfae,null))[_0x3d94('0x17')](saveUpdates(_0x1c6ef5[_0x3d94('0x4b')],null))[_0x3d94('0x17')](respondWithResult(_0x25cfae,null))[_0x3d94('0x21')](handleError(_0x25cfae,null));};var utilLicense=require(_0x3d94('0x14'));exports[_0x3d94('0x6e')]=function(_0x3a7757,_0x47b6f5,_0xe40780){var _0xf2a57f=_0x3d94('0x53');var _0x28360a={'custom':![]};return utilLicense[_0x3d94('0x54')]()[_0x3d94('0x17')](function(_0x5dae40){if(_0x5dae40){_0x28360a=_0x5dae40;}return db['Setting'][_0x3d94('0x4c')]({'where':{'id':_0x3a7757[_0x3d94('0x4a')]['id']},'attributes':[_0x3d94('0x55'),_0x3d94('0x51'),'preferred',_0x3d94('0x57'),'defaultLogo',_0x3d94('0x59'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x3d94('0x17')](handleEntityNotFound(_0x47b6f5,null))['then'](function(_0x459141){if(_0x459141){var _0xc3958c=_0x459141[_0x3d94('0x57')]&&fs[_0x3d94('0x63')](path['join'](config[_0x3d94('0x5d')],_0xf2a57f,_['toLower'](_0x459141[_0x3d94('0x57')])))?path[_0x3d94('0x5c')](config[_0x3d94('0x5d')],_0xf2a57f,_[_0x3d94('0x5e')](_0x459141[_0x3d94('0x57')])):path[_0x3d94('0x5c')](config[_0x3d94('0x5d')],_0xf2a57f,_[_0x3d94('0x5e')]('default_favicon.ico'));var _0x3553e7='default'+_[_0x3d94('0x61')]('favicon');if(_0x459141[_0x3553e7]||!_0x28360a[_0x3d94('0x62')]){_0xc3958c=path[_0x3d94('0x5c')](config[_0x3d94('0x5d')],_0xf2a57f,_[_0x3d94('0x5e')](_0x3d94('0x6f')));}if(!fs['existsSync'](_0xc3958c)){throw new db[(_0x3d94('0x67'))][(_0x3d94('0x64'))](_['upperFirst'](_0x3d94('0x57'))+_0x3d94('0x68'));}return _0x47b6f5['download'](_0xc3958c);}})['catch'](handleError(_0x47b6f5,null));};exports['getDate']=function(_0x4ae2cf,_0x564fc4){var _0x30d5bd={'offset':moment()[_0x3d94('0x70')]()};_0x30d5bd[_0x3d94('0x71')]=moment()[_0x3d94('0x70')](_0x30d5bd[_0x3d94('0x24')])[_0x3d94('0x72')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x564fc4[_0x3d94('0x22')](0xc8)[_0x3d94('0x2f')](_0x30d5bd);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 99ffbb9..bc4daea 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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x120eb5,_0x1ffa2c){var _0x5d9d33=function(_0x3219b4){while(--_0x3219b4){_0x120eb5['push'](_0x120eb5['shift']());}};_0x5d9d33(++_0x1ffa2c);}(_0xedd9,0xfc));var _0x9edd=function(_0x4cc799,_0x3411e7){_0x4cc799=_0x4cc799-0x0;var _0x2ed8fa=_0xedd9[_0x4cc799];return _0x2ed8fa;};'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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 59bb062..6358d11 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 _0xfd71=['error','code','message','result','catch','Setting','options','where','attributes','include','map','model','ShowSetting','lodash','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x59a2b5,_0x659b19){var _0x3b46b6=function(_0x1e6fce){while(--_0x1e6fce){_0x59a2b5['push'](_0x59a2b5['shift']());}};_0x3b46b6(++_0x659b19);}(_0xfd71,0x1cd));var _0x1fd7=function(_0x406c6b,_0x5128f1){_0x406c6b=_0x406c6b-0x0;var _0x2ba7b4=_0xfd71[_0x406c6b];return _0x2ba7b4;};'use strict';var _=require(_0x1fd7('0x0'));var util=require('util');var moment=require(_0x1fd7('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(_0x1fd7('0x2'));var logger=require(_0x1fd7('0x3'))(_0x1fd7('0x4'));var config=require(_0x1fd7('0x5'));var jayson=require(_0x1fd7('0x6'));var client=jayson[_0x1fd7('0x7')][_0x1fd7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2001ca,_0x379a32,_0x1d6044){return new BPromise(function(_0x3aca65,_0x39e2e0){return client['request'](_0x2001ca,_0x1d6044)[_0x1fd7('0x9')](function(_0x5d22fb){logger[_0x1fd7('0xa')](_0x1fd7('0xb'),_0x379a32,'request\x20sent');logger[_0x1fd7('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x379a32,_0x1fd7('0xd'),JSON[_0x1fd7('0xe')](_0x5d22fb));if(_0x5d22fb[_0x1fd7('0xf')]){if(_0x5d22fb[_0x1fd7('0xf')][_0x1fd7('0x10')]===0x1f4){logger[_0x1fd7('0xf')](_0x1fd7('0xb'),_0x379a32,_0x5d22fb[_0x1fd7('0xf')][_0x1fd7('0x11')]);return _0x39e2e0(_0x5d22fb[_0x1fd7('0xf')][_0x1fd7('0x11')]);}logger[_0x1fd7('0xf')](_0x1fd7('0xb'),_0x379a32,_0x5d22fb[_0x1fd7('0xf')][_0x1fd7('0x11')]);return _0x3aca65(_0x5d22fb['error']['message']);}else{logger['info'](_0x1fd7('0xb'),_0x379a32,_0x1fd7('0xd'));_0x3aca65(_0x5d22fb[_0x1fd7('0x12')]['message']);}})[_0x1fd7('0x13')](function(_0x572bef){logger['error'](_0x1fd7('0xb'),_0x379a32,_0x572bef);_0x39e2e0(_0x572bef);});});}exports['ShowSetting']=function(_0xa3691e){var _0x120ca8=this;return new Promise(function(_0x4d7aaf,_0x3fa25a){return db[_0x1fd7('0x14')]['find']({'raw':_0xa3691e[_0x1fd7('0x15')]?_0xa3691e[_0x1fd7('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xa3691e[_0x1fd7('0x15')]?_0xa3691e['options'][_0x1fd7('0x16')]||null:null,'attributes':_0xa3691e['options']?_0xa3691e[_0x1fd7('0x15')][_0x1fd7('0x17')]||null:null,'include':_0xa3691e[_0x1fd7('0x15')]?_0xa3691e[_0x1fd7('0x15')][_0x1fd7('0x18')]?_[_0x1fd7('0x19')](_0xa3691e[_0x1fd7('0x15')][_0x1fd7('0x18')],function(_0xed8b1f){return{'model':db[_0xed8b1f[_0x1fd7('0x1a')]],'as':_0xed8b1f['as'],'attributes':_0xed8b1f[_0x1fd7('0x17')],'include':_0xed8b1f[_0x1fd7('0x18')]?_[_0x1fd7('0x19')](_0xed8b1f[_0x1fd7('0x18')],function(_0x339ce5){return{'model':db[_0x339ce5[_0x1fd7('0x1a')]],'as':_0x339ce5['as'],'attributes':_0x339ce5[_0x1fd7('0x17')],'include':_0x339ce5['include']?_[_0x1fd7('0x19')](_0x339ce5[_0x1fd7('0x18')],function(_0x394852){return{'model':db[_0x394852[_0x1fd7('0x1a')]],'as':_0x394852['as'],'attributes':_0x394852['attributes']};}):[]};}):[]};}):[]:[]})[_0x1fd7('0x9')](function(_0x2aa106){logger[_0x1fd7('0xa')](_0x1fd7('0x1b'),_0xa3691e);logger['debug'](_0x1fd7('0x1b'),_0xa3691e,JSON['stringify'](_0x2aa106));_0x4d7aaf(_0x2aa106);})[_0x1fd7('0x13')](function(_0x3bb0c3){logger[_0x1fd7('0xf')](_0x1fd7('0x1b'),_0x3bb0c3[_0x1fd7('0x11')],_0xa3691e);_0x3fa25a(_0x120ca8[_0x1fd7('0xf')](0x1f4,_0x3bb0c3['message']));});});}; \ No newline at end of file +var _0xa5a0=['jayson/promise','http','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x566328,_0x78b10b){var _0x1ddeda=function(_0x534648){while(--_0x534648){_0x566328['push'](_0x566328['shift']());}};_0x1ddeda(++_0x78b10b);}(_0xa5a0,0xc7));var _0x0a5a=function(_0x34bdd1,_0x6f0ed0){_0x34bdd1=_0x34bdd1-0x0;var _0x21f058=_0xa5a0[_0x34bdd1];return _0x21f058;};'use strict';var _=require(_0x0a5a('0x0'));var util=require(_0x0a5a('0x1'));var moment=require(_0x0a5a('0x2'));var BPromise=require(_0x0a5a('0x3'));var rs=require(_0x0a5a('0x4'));var fs=require('fs');var Redis=require(_0x0a5a('0x5'));var db=require(_0x0a5a('0x6'))['db'];var utils=require(_0x0a5a('0x7'));var logger=require(_0x0a5a('0x8'))(_0x0a5a('0x9'));var config=require(_0x0a5a('0xa'));var jayson=require(_0x0a5a('0xb'));var client=jayson['client'][_0x0a5a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18d5b3,_0x5a25f1,_0xb064a5){return new BPromise(function(_0x4e313a,_0x26af7f){return client[_0x0a5a('0xd')](_0x18d5b3,_0xb064a5)[_0x0a5a('0xe')](function(_0x2a7c62){logger[_0x0a5a('0xf')]('Setting,\x20%s,\x20%s',_0x5a25f1,_0x0a5a('0x10'));logger['debug'](_0x0a5a('0x11'),_0x5a25f1,_0x0a5a('0x10'),JSON[_0x0a5a('0x12')](_0x2a7c62));if(_0x2a7c62[_0x0a5a('0x13')]){if(_0x2a7c62[_0x0a5a('0x13')]['code']===0x1f4){logger['error'](_0x0a5a('0x14'),_0x5a25f1,_0x2a7c62[_0x0a5a('0x13')][_0x0a5a('0x15')]);return _0x26af7f(_0x2a7c62[_0x0a5a('0x13')][_0x0a5a('0x15')]);}logger['error'](_0x0a5a('0x14'),_0x5a25f1,_0x2a7c62[_0x0a5a('0x13')][_0x0a5a('0x15')]);return _0x4e313a(_0x2a7c62['error'][_0x0a5a('0x15')]);}else{logger['info'](_0x0a5a('0x14'),_0x5a25f1,'request\x20sent');_0x4e313a(_0x2a7c62[_0x0a5a('0x16')][_0x0a5a('0x15')]);}})[_0x0a5a('0x17')](function(_0x977c01){logger[_0x0a5a('0x13')](_0x0a5a('0x14'),_0x5a25f1,_0x977c01);_0x26af7f(_0x977c01);});});}exports[_0x0a5a('0x18')]=function(_0x50cc9f){var _0x30f140=this;return new Promise(function(_0x3ebb50,_0xe23bc6){return db[_0x0a5a('0x19')][_0x0a5a('0x1a')]({'raw':_0x50cc9f[_0x0a5a('0x1b')]?_0x50cc9f[_0x0a5a('0x1b')][_0x0a5a('0x1c')]===undefined?!![]:![]:!![],'where':_0x50cc9f['options']?_0x50cc9f[_0x0a5a('0x1b')][_0x0a5a('0x1d')]||null:null,'attributes':_0x50cc9f[_0x0a5a('0x1b')]?_0x50cc9f[_0x0a5a('0x1b')][_0x0a5a('0x1e')]||null:null,'include':_0x50cc9f[_0x0a5a('0x1b')]?_0x50cc9f['options'][_0x0a5a('0x1f')]?_[_0x0a5a('0x20')](_0x50cc9f['options'][_0x0a5a('0x1f')],function(_0x2aaa89){return{'model':db[_0x2aaa89[_0x0a5a('0x21')]],'as':_0x2aaa89['as'],'attributes':_0x2aaa89[_0x0a5a('0x1e')],'include':_0x2aaa89[_0x0a5a('0x1f')]?_[_0x0a5a('0x20')](_0x2aaa89[_0x0a5a('0x1f')],function(_0x274b73){return{'model':db[_0x274b73[_0x0a5a('0x21')]],'as':_0x274b73['as'],'attributes':_0x274b73[_0x0a5a('0x1e')],'include':_0x274b73[_0x0a5a('0x1f')]?_[_0x0a5a('0x20')](_0x274b73[_0x0a5a('0x1f')],function(_0x545fa9){return{'model':db[_0x545fa9[_0x0a5a('0x21')]],'as':_0x545fa9['as'],'attributes':_0x545fa9['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a5a('0xe')](function(_0x5ddb09){logger[_0x0a5a('0xf')](_0x0a5a('0x18'),_0x50cc9f);logger[_0x0a5a('0x22')](_0x0a5a('0x18'),_0x50cc9f,JSON[_0x0a5a('0x12')](_0x5ddb09));_0x3ebb50(_0x5ddb09);})[_0x0a5a('0x17')](function(_0x422917){logger['error'](_0x0a5a('0x18'),_0x422917['message'],_0x50cc9f);_0xe23bc6(_0x30f140[_0x0a5a('0x13')](0x1f4,_0x422917[_0x0a5a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 931d83f..18e530d 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 _0x5fab=['create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','status','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x5515a7,_0x2c4af1){var _0x43f4bf=function(_0x3d519d){while(--_0x3d519d){_0x5515a7['push'](_0x5515a7['shift']());}};_0x43f4bf(++_0x2c4af1);}(_0x5fab,0x177));var _0xb5fa=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0x5fab[_0x491faa];return _0x414440;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),controller[_0xb5fa('0x17')]);router[_0xb5fa('0xa')](_0xb5fa('0x18'),auth[_0xb5fa('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb5fa('0x1a')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1d'),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x1a')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router[_0xb5fa('0x1a')]('/:id/send',auth[_0xb5fa('0xb')](),controller['send']);router[_0xb5fa('0x1a')]('/:id/status',controller[_0xb5fa('0x20')]);router[_0xb5fa('0x1a')]('/:id/users',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x21')]);router[_0xb5fa('0x22')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x24')]('/:id',auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x24')](_0xb5fa('0x1b'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x25')]);router[_0xb5fa('0x24')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5fa('0x27')]=router; \ No newline at end of file +var _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x13bbf5,_0x3c3cc2){var _0x2d9e20=function(_0x31ff82){while(--_0x31ff82){_0x13bbf5['push'](_0x13bbf5['shift']());}};_0x2d9e20(++_0x3c3cc2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x5fc3[_0x14a0a0];return _0x56b651;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 3721093..610b841 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 _0x7f2a=['exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','randomstring'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x7f2a,0x124));var _0xa7f2=function(_0x2da2a9,_0x3460bb){_0x2da2a9=_0x2da2a9-0x0;var _0x1f06d3=_0x7f2a[_0x2da2a9];return _0x1f06d3;};'use strict';var Sequelize=require(_0xa7f2('0x0'));var rs=require(_0xa7f2('0x1'));module[_0xa7f2('0x2')]={'name':{'type':Sequelize[_0xa7f2('0x3')],'unique':_0xa7f2('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xa7f2('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xa7f2('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa7f2('0x5')]();}},'phone':{'type':Sequelize[_0xa7f2('0x3')]},'type':{'type':Sequelize[_0xa7f2('0x6')](_0xa7f2('0x7'),_0xa7f2('0x8'),_0xa7f2('0x9'),_0xa7f2('0xa'),_0xa7f2('0xb'),'clickatell','bandwidth',_0xa7f2('0xc'),_0xa7f2('0xd'),_0xa7f2('0xe'))},'accountSid':{'type':Sequelize[_0xa7f2('0x3')]},'authId':{'type':Sequelize[_0xa7f2('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xa7f2('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa7f2('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xa7f2('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xa7f2('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xa7f2('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xa7f2('0x10')],'defaultValue':function(){return _0xa7f2('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa7f2('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa7f2('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa7f2('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa7f2('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa7f2('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa7f2('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa7f2('0x12')],'comment':_0xa7f2('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x15a678){if(!_0x15a678)this[_0xa7f2('0x14')]('mandatoryDispositionPauseId',null);this[_0xa7f2('0x14')]('mandatoryDisposition',_0x15a678);}}}; \ No newline at end of file +var _0x3f6e=['clicksend','plivo','clickatell','bandwidth','csc','infobip','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','skebby','connectel'];(function(_0x2e030a,_0x8e4c48){var _0x597df6=function(_0x3da9ce){while(--_0x3da9ce){_0x2e030a['push'](_0x2e030a['shift']());}};_0x597df6(++_0x8e4c48);}(_0x3f6e,0x6b));var _0xe3f6=function(_0x186780,_0x144f34){_0x186780=_0x186780-0x0;var _0x307c3c=_0x3f6e[_0x186780];return _0x307c3c;};'use strict';var Sequelize=require(_0xe3f6('0x0'));var rs=require(_0xe3f6('0x1'));module['exports']={'name':{'type':Sequelize[_0xe3f6('0x2')],'unique':_0xe3f6('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xe3f6('0x2')],'defaultValue':function(){return rs[_0xe3f6('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe3f6('0x5')]('twilio',_0xe3f6('0x6'),_0xe3f6('0x7'),_0xe3f6('0x8'),_0xe3f6('0x9'),_0xe3f6('0xa'),_0xe3f6('0xb'),_0xe3f6('0xc'),_0xe3f6('0xd'),'intelepeer')},'accountSid':{'type':Sequelize[_0xe3f6('0x2')]},'authId':{'type':Sequelize[_0xe3f6('0x2')]},'authToken':{'type':Sequelize[_0xe3f6('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xe3f6('0x2')]},'password':{'type':Sequelize[_0xe3f6('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xe3f6('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xe3f6('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe3f6('0xe')],'defaultValue':function(){return _0xe3f6('0xf');}},'notificationSound':{'type':Sequelize[_0xe3f6('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe3f6('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe3f6('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe3f6('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe3f6('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe3f6('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe3f6('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe3f6('0x11')],'comment':_0xe3f6('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xe3f6('0x10')],'defaultValue':![],'comment':_0xe3f6('0x13'),'set':function(_0x49803b){if(!_0x49803b)this['setDataValue'](_0xe3f6('0x14'),null);this[_0xe3f6('0x15')](_0xe3f6('0x16'),_0x49803b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 9445757..f4f244e 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 _0x73e1=['no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','csc','originatingAddress','replyMessageId','bandwidth','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','SmsInteraction','interaction','created','autoclose','push','close','*,*,*,*','ContactId','UserId','User','agent','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','user','out','SmsMessage','Messages','spread','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','SmsAccount,\x20%s,\x20%s','result','catch','sendStatus','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','status','end','stack','name','send','index','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','mandatoryDispositionPause','options','find','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','Pause','describe','addDisposition','Disposition','create','getDispositions','findOne','hasOwnProperty','SmsAccountId','include','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sms','SmsApplication','account','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x73e1,0x14e));var _0x173e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x73e1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x173e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x173e('0x1'));var BPromise=require(_0x173e('0x2'));var Mustache=require('mustache');var util=require(_0x173e('0x3'));var path=require('path');var sox=require(_0x173e('0x4'));var csv=require(_0x173e('0x5'));var ejs=require(_0x173e('0x6'));var fs=require('fs');var fs_extra=require(_0x173e('0x7'));var _=require(_0x173e('0x8'));var squel=require(_0x173e('0x9'));var crypto=require(_0x173e('0xa'));var jsforce=require(_0x173e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x173e('0xc'));var Papa=require(_0x173e('0xd'));var Redis=require('ioredis');var authService=require(_0x173e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x173e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x173e('0x10'))('api');var utils=require(_0x173e('0x11'));var config=require(_0x173e('0x12'));var licenseUtil=require(_0x173e('0x13'));var db=require(_0x173e('0x14'))['db'];config['redis']=_[_0x173e('0x15')](config[_0x173e('0x16')],{'host':_0x173e('0x17'),'port':0x18eb});var socket=require(_0x173e('0x18'))(new Redis(config[_0x173e('0x16')]));require(_0x173e('0x19'))[_0x173e('0x1a')](socket);var jayson=require(_0x173e('0x1b'));var client=jayson[_0x173e('0x1c')][_0x173e('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x4f7f99,_0x4cc2df,_0x890800,_0x26137){return new BPromise(function(_0x427062,_0x41cf60){var _0xf1dabb=_0x26137||client;return _0xf1dabb[_0x173e('0x1e')](_0x4f7f99,_0x890800)[_0x173e('0x1f')](function(_0xff29cd){logger[_0x173e('0x20')]('SmsAccount,\x20%s,\x20%s',_0x4cc2df,_0x173e('0x21'));logger[_0x173e('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4cc2df,'request\x20sent',JSON[_0x173e('0x23')](_0xff29cd));if(_0xff29cd[_0x173e('0x24')]){if(_0xff29cd[_0x173e('0x24')]['code']===0x1f4){logger[_0x173e('0x24')]('SmsAccount,\x20%s,\x20%s',_0x4cc2df,_0xff29cd[_0x173e('0x24')]['message']);return _0x41cf60(_0xff29cd[_0x173e('0x24')][_0x173e('0x25')]);}logger[_0x173e('0x24')](_0x173e('0x26'),_0x4cc2df,_0xff29cd['error'][_0x173e('0x25')]);return _0x427062(_0xff29cd[_0x173e('0x24')][_0x173e('0x25')]);}else{logger[_0x173e('0x20')](_0x173e('0x26'),_0x4cc2df,_0x173e('0x21'));_0x427062(_0xff29cd[_0x173e('0x27')]['message']);}})[_0x173e('0x28')](function(_0x10e658){logger['error']('SmsAccount,\x20%s,\x20%s',_0x4cc2df,_0x10e658);_0x41cf60(_0x10e658);});});}function respondWithStatusCode(_0x27dbac,_0x12a5a2){_0x12a5a2=_0x12a5a2||0xcc;return function(_0x1b07af){if(_0x1b07af){return _0x27dbac[_0x173e('0x29')](_0x12a5a2);}return _0x27dbac['status'](_0x12a5a2)['end']();};}function respondWithResult(_0x36a2f1,_0x412bd3){_0x412bd3=_0x412bd3||0xc8;return function(_0x105d97){if(_0x105d97){return _0x36a2f1['status'](_0x412bd3)['json'](_0x105d97);}};}function respondWithFilteredResult(_0x499010,_0x145758){return function(_0xd091e2){if(_0xd091e2){var _0x515765=typeof _0x145758[_0x173e('0x2a')]===_0x173e('0x2b')&&typeof _0x145758[_0x173e('0x2c')]===_0x173e('0x2b');var _0x4bdaa4=_0xd091e2[_0x173e('0x2d')];var _0x4846e1=_0x515765?0x0:_0x145758[_0x173e('0x2a')];var _0x3ab257=_0x515765?_0xd091e2[_0x173e('0x2d')]:_0x145758['offset']+_0x145758[_0x173e('0x2c')];var _0x1fb308;if(_0x3ab257>=_0x4bdaa4){_0x3ab257=_0x4bdaa4;_0x1fb308=0xc8;}else{_0x1fb308=0xce;}_0x499010['status'](_0x1fb308);return _0x499010['set'](_0x173e('0x2e'),_0x4846e1+'-'+_0x3ab257+'/'+_0x4bdaa4)[_0x173e('0x2f')](_0xd091e2);}return null;};}function patchUpdates(_0x49832f){return function(_0x52c157){try{jsonpatch[_0x173e('0x30')](_0x52c157,_0x49832f,!![]);}catch(_0x1dddc4){return BPromise[_0x173e('0x31')](_0x1dddc4);}return _0x52c157[_0x173e('0x32')]();};}function saveUpdates(_0x2a102a,_0x42d600){return function(_0x2f6da2){if(_0x2f6da2){return _0x2f6da2[_0x173e('0x33')](_0x2a102a)['then'](function(_0x5055d7){return _0x5055d7;});}return null;};}function removeEntity(_0x860082,_0x25cc0e){return function(_0x201cfb){if(_0x201cfb){return _0x201cfb[_0x173e('0x34')]()[_0x173e('0x1f')](function(){var _0x3a66aa=_0x201cfb[_0x173e('0x35')]({'plain':!![]});var _0x412a95=_0x173e('0x36');return db[_0x173e('0x37')][_0x173e('0x34')]({'where':{'type':_0x412a95,'resourceId':_0x3a66aa['id']}})[_0x173e('0x1f')](function(){return _0x201cfb;});})[_0x173e('0x1f')](function(){_0x860082[_0x173e('0x38')](0xcc)[_0x173e('0x39')]();});}};}function handleEntityNotFound(_0x4b4fa8,_0x6907fa){return function(_0x170364){if(!_0x170364){_0x4b4fa8[_0x173e('0x29')](0x194);}return _0x170364;};}function handleError(_0xf3181c,_0x38513c){_0x38513c=_0x38513c||0x1f4;return function(_0x56aa6e){logger['error'](_0x56aa6e[_0x173e('0x3a')]);if(_0x56aa6e[_0x173e('0x3b')]){delete _0x56aa6e[_0x173e('0x3b')];}_0xf3181c[_0x173e('0x38')](_0x38513c)[_0x173e('0x3c')](_0x56aa6e);};}exports[_0x173e('0x3d')]=function(_0x4f91ff,_0xe43647){var _0x3542d5={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x40d252={},_0x4ce18a={'count':0x0,'rows':[]};var _0x199a0a=_[_0x173e('0x3e')](db[_0x173e('0x3f')][_0x173e('0x40')],function(_0x4e1646){return{'name':_0x4e1646[_0x173e('0x41')],'type':_0x4e1646[_0x173e('0x42')][_0x173e('0x43')]};});_0x40d252[_0x173e('0x44')]=_['map'](_0x199a0a,_0x173e('0x3b'));_0x40d252[_0x173e('0x45')]=_[_0x173e('0x46')](_0x4f91ff[_0x173e('0x45')]);_0x40d252[_0x173e('0x47')]=_[_0x173e('0x48')](_0x40d252['model'],_0x40d252[_0x173e('0x45')]);_0x3542d5[_0x173e('0x49')]=_[_0x173e('0x48')](_0x40d252[_0x173e('0x44')],qs[_0x173e('0x4a')](_0x4f91ff[_0x173e('0x45')][_0x173e('0x4a')]));_0x3542d5[_0x173e('0x49')]=_0x3542d5['attributes'][_0x173e('0x4b')]?_0x3542d5[_0x173e('0x49')]:_0x40d252[_0x173e('0x44')];if(!_0x4f91ff['query']['hasOwnProperty'](_0x173e('0x4c'))){_0x3542d5[_0x173e('0x2c')]=qs[_0x173e('0x2c')](_0x4f91ff[_0x173e('0x45')]['limit']);_0x3542d5[_0x173e('0x2a')]=qs['offset'](_0x4f91ff[_0x173e('0x45')][_0x173e('0x2a')]);}_0x3542d5[_0x173e('0x4d')]=qs['sort'](_0x4f91ff[_0x173e('0x45')][_0x173e('0x4e')]);_0x3542d5[_0x173e('0x4f')]=qs[_0x173e('0x47')](_[_0x173e('0x50')](_0x4f91ff[_0x173e('0x45')],_0x40d252[_0x173e('0x47')]),_0x199a0a);if(_0x4f91ff[_0x173e('0x45')][_0x173e('0x51')]){_0x3542d5[_0x173e('0x4f')]=_[_0x173e('0x52')](_0x3542d5['where'],{'$or':_[_0x173e('0x3e')](_0x199a0a,function(_0x3c84e9){if(_0x3c84e9[_0x173e('0x42')]!==_0x173e('0x53')){var _0x426115={};_0x426115[_0x3c84e9[_0x173e('0x3b')]]={'$like':'%'+_0x4f91ff[_0x173e('0x45')][_0x173e('0x51')]+'%'};return _0x426115;}})});}_0x3542d5=_[_0x173e('0x52')]({},_0x3542d5,_0x4f91ff['options']);var _0x4e5831={'where':_0x3542d5[_0x173e('0x4f')]};return db[_0x173e('0x3f')][_0x173e('0x2d')](_0x4e5831)[_0x173e('0x1f')](function(_0x3b6e6e){_0x4ce18a[_0x173e('0x2d')]=_0x3b6e6e;if(_0x4f91ff[_0x173e('0x45')][_0x173e('0x54')]){_0x3542d5['include']=[{'all':!![]}];}return db[_0x173e('0x3f')][_0x173e('0x55')](_0x3542d5);})[_0x173e('0x1f')](function(_0x370d16){_0x4ce18a[_0x173e('0x56')]=_0x370d16;return _0x4ce18a;})[_0x173e('0x1f')](respondWithFilteredResult(_0xe43647,_0x3542d5))['catch'](handleError(_0xe43647,null));};exports['show']=function(_0x226898,_0x28eba2){var _0x3f6389={'raw':![],'where':{'id':_0x226898['params']['id']},'include':[{'model':db['Pause'],'as':_0x173e('0x57')}]},_0x1d2074={};_0x1d2074[_0x173e('0x44')]=_['keys'](db['SmsAccount'][_0x173e('0x40')]);_0x1d2074['query']=_[_0x173e('0x46')](_0x226898[_0x173e('0x45')]);_0x1d2074['filters']=_['intersection'](_0x1d2074[_0x173e('0x44')],_0x1d2074['query']);_0x3f6389[_0x173e('0x49')]=_['intersection'](_0x1d2074[_0x173e('0x44')],qs['fields'](_0x226898[_0x173e('0x45')][_0x173e('0x4a')]));_0x3f6389[_0x173e('0x49')]=_0x3f6389[_0x173e('0x49')]['length']?_0x3f6389[_0x173e('0x49')]:_0x1d2074[_0x173e('0x44')];if(_0x226898[_0x173e('0x45')][_0x173e('0x54')]){_0x3f6389['include']=[{'all':!![]}];}_0x3f6389=_[_0x173e('0x52')]({},_0x3f6389,_0x226898[_0x173e('0x58')]);return db[_0x173e('0x3f')][_0x173e('0x59')](_0x3f6389)['then'](handleEntityNotFound(_0x28eba2,null))[_0x173e('0x1f')](respondWithResult(_0x28eba2,null))['catch'](handleError(_0x28eba2,null));};exports['create']=function(_0x378eb8,_0x574a44){return db[_0x173e('0x3f')]['create'](_0x378eb8['body'],{})['then'](function(_0xe99b0c){var _0x375bad=_0x378eb8['user'][_0x173e('0x35')]({'plain':!![]});if(!_0x375bad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x375bad[_0x173e('0x5a')]==='user'){var _0x56f57f=_0xe99b0c[_0x173e('0x35')]({'plain':!![]});var _0x239e39=_0x173e('0x36');return db[_0x173e('0x5b')][_0x173e('0x59')]({'where':{'name':_0x239e39,'userProfileId':_0x375bad[_0x173e('0x5c')]},'raw':!![]})[_0x173e('0x1f')](function(_0x380242){if(_0x380242&&_0x380242[_0x173e('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x56f57f['name'],'resourceId':_0x56f57f['id'],'type':_0x380242[_0x173e('0x3b')],'sectionId':_0x380242['id']},{})['then'](function(){return _0xe99b0c;});}else{return _0xe99b0c;}})[_0x173e('0x28')](function(_0x161de9){logger[_0x173e('0x24')](_0x173e('0x5e'),_0x161de9);throw _0x161de9;});}return _0xe99b0c;})[_0x173e('0x1f')](respondWithResult(_0x574a44,0xc9))[_0x173e('0x28')](handleError(_0x574a44,null));};exports['update']=function(_0x424f0d,_0x52f90c){if(_0x424f0d['body']['id']){delete _0x424f0d[_0x173e('0x5f')]['id'];}return db[_0x173e('0x3f')][_0x173e('0x59')]({'where':{'id':_0x424f0d[_0x173e('0x60')]['id']},'include':[{'model':db[_0x173e('0x61')],'as':'mandatoryDispositionPause'}]})[_0x173e('0x1f')](handleEntityNotFound(_0x52f90c,null))[_0x173e('0x1f')](saveUpdates(_0x424f0d[_0x173e('0x5f')],null))[_0x173e('0x1f')](respondWithResult(_0x52f90c,null))[_0x173e('0x28')](handleError(_0x52f90c,null));};exports['destroy']=function(_0x1c6065,_0x35f40d){return db[_0x173e('0x3f')][_0x173e('0x59')]({'where':{'id':_0x1c6065['params']['id']}})['then'](handleEntityNotFound(_0x35f40d,null))['then'](removeEntity(_0x35f40d,null))[_0x173e('0x28')](handleError(_0x35f40d,null));};exports[_0x173e('0x62')]=function(_0x31d729,_0x15c569){return db['SmsAccount']['describe']()[_0x173e('0x1f')](respondWithResult(_0x15c569,null))[_0x173e('0x28')](handleError(_0x15c569,null));};exports[_0x173e('0x63')]=function(_0x25986f,_0x708086,_0x385b70){if(_0x25986f[_0x173e('0x5f')]['id']){delete _0x25986f[_0x173e('0x5f')]['id'];}return db[_0x173e('0x3f')][_0x173e('0x59')]({'where':{'id':_0x25986f['params']['id']}})[_0x173e('0x1f')](handleEntityNotFound(_0x708086,null))[_0x173e('0x1f')](function(_0x35ad2b){if(_0x35ad2b){_0x25986f[_0x173e('0x5f')]['SmsAccountId']=_0x35ad2b['id'];return db[_0x173e('0x64')][_0x173e('0x65')](_0x25986f[_0x173e('0x5f')]);}})[_0x173e('0x1f')](respondWithResult(_0x708086,null))[_0x173e('0x28')](handleError(_0x708086,null));};exports[_0x173e('0x66')]=function(_0x5c1cb1,_0x50852d,_0x303ec2){var _0x53273e={'raw':![],'where':{}};var _0x23b203={};var _0x3e002f={'count':0x0,'rows':[]};return db[_0x173e('0x3f')][_0x173e('0x67')]({'where':{'id':_0x5c1cb1[_0x173e('0x60')]['id']}})[_0x173e('0x1f')](handleEntityNotFound(_0x50852d,null))[_0x173e('0x1f')](function(_0x5cddbc){if(_0x5cddbc){_0x23b203[_0x173e('0x44')]=_[_0x173e('0x46')](db['Disposition'][_0x173e('0x40')]);_0x23b203[_0x173e('0x45')]=_['keys'](_0x5c1cb1['query']);_0x23b203[_0x173e('0x47')]=_[_0x173e('0x48')](_0x23b203[_0x173e('0x44')],_0x23b203['query']);_0x53273e[_0x173e('0x49')]=_[_0x173e('0x48')](_0x23b203[_0x173e('0x44')],qs['fields'](_0x5c1cb1[_0x173e('0x45')][_0x173e('0x4a')]));_0x53273e['attributes']=_0x53273e['attributes']['length']?_0x53273e[_0x173e('0x49')]:_0x23b203[_0x173e('0x44')];if(!_0x5c1cb1[_0x173e('0x45')][_0x173e('0x68')]('nolimit')){_0x53273e[_0x173e('0x2c')]=qs[_0x173e('0x2c')](_0x5c1cb1['query'][_0x173e('0x2c')]);_0x53273e['offset']=qs['offset'](_0x5c1cb1['query'][_0x173e('0x2a')]);}_0x53273e[_0x173e('0x4d')]=qs[_0x173e('0x4e')](_0x5c1cb1[_0x173e('0x45')][_0x173e('0x4e')]);_0x53273e[_0x173e('0x4f')]=qs[_0x173e('0x47')](_[_0x173e('0x50')](_0x5c1cb1['query'],_0x23b203[_0x173e('0x47')]));_0x53273e[_0x173e('0x4f')][_0x173e('0x69')]=_0x5cddbc['id'];if(_0x5c1cb1[_0x173e('0x45')][_0x173e('0x51')]){_0x53273e[_0x173e('0x4f')]=_[_0x173e('0x52')](_0x53273e[_0x173e('0x4f')],{'$or':_[_0x173e('0x3e')](_0x53273e[_0x173e('0x49')],function(_0xd60d1e){var _0x5e1a25={};_0x5e1a25[_0xd60d1e]={'$like':'%'+_0x5c1cb1[_0x173e('0x45')][_0x173e('0x51')]+'%'};return _0x5e1a25;})});}_0x53273e=_[_0x173e('0x52')]({},_0x53273e,_0x5c1cb1[_0x173e('0x58')]);return db['Disposition'][_0x173e('0x2d')]({'where':_0x53273e[_0x173e('0x4f')]})[_0x173e('0x1f')](function(_0x374447){_0x3e002f[_0x173e('0x2d')]=_0x374447;if(_0x5c1cb1[_0x173e('0x45')]['includeAll']){_0x53273e[_0x173e('0x6a')]=[{'all':!![]}];}return db['Disposition'][_0x173e('0x55')](_0x53273e);})['then'](function(_0x2dfd6f){_0x3e002f[_0x173e('0x56')]=_0x2dfd6f;return _0x3e002f;});}})[_0x173e('0x1f')](respondWithFilteredResult(_0x50852d,_0x53273e))[_0x173e('0x28')](handleError(_0x50852d,null));};exports[_0x173e('0x6b')]=function(_0x11d644,_0x90907e,_0x2c2739){return db[_0x173e('0x3f')][_0x173e('0x59')]({'where':{'id':_0x11d644[_0x173e('0x60')]['id']}})[_0x173e('0x1f')](handleEntityNotFound(_0x90907e,null))['then'](function(_0x20e4c0){if(_0x20e4c0){return _0x20e4c0['removeDispositions'](_0x11d644['query'][_0x173e('0x6c')]);}})[_0x173e('0x1f')](respondWithStatusCode(_0x90907e,null))[_0x173e('0x28')](handleError(_0x90907e,null));};exports[_0x173e('0x6d')]=function(_0x4e86ed,_0x4e6daa,_0x49dc1d){if(_0x4e86ed['body']['id']){delete _0x4e86ed[_0x173e('0x5f')]['id'];}return db[_0x173e('0x3f')][_0x173e('0x59')]({'where':{'id':_0x4e86ed[_0x173e('0x60')]['id']}})[_0x173e('0x1f')](handleEntityNotFound(_0x4e6daa,null))[_0x173e('0x1f')](function(_0xaa25de){if(_0xaa25de){_0x4e86ed[_0x173e('0x5f')][_0x173e('0x69')]=_0xaa25de['id'];return db[_0x173e('0x6e')][_0x173e('0x65')](_0x4e86ed[_0x173e('0x5f')]);}})['then'](respondWithResult(_0x4e6daa,null))[_0x173e('0x28')](handleError(_0x4e6daa,null));};exports['getAnswers']=function(_0x585549,_0x1419f6,_0x5a2e27){var _0x5a84d4={'raw':![],'where':{}};var _0xdcbfbf={};var _0x31ad43={'count':0x0,'rows':[]};return db[_0x173e('0x3f')][_0x173e('0x67')]({'where':{'id':_0x585549['params']['id']}})[_0x173e('0x1f')](handleEntityNotFound(_0x1419f6,null))['then'](function(_0x21b8e1){if(_0x21b8e1){_0xdcbfbf[_0x173e('0x44')]=_[_0x173e('0x46')](db['CannedAnswer'][_0x173e('0x40')]);_0xdcbfbf[_0x173e('0x45')]=_[_0x173e('0x46')](_0x585549[_0x173e('0x45')]);_0xdcbfbf['filters']=_[_0x173e('0x48')](_0xdcbfbf[_0x173e('0x44')],_0xdcbfbf[_0x173e('0x45')]);_0x5a84d4['attributes']=_[_0x173e('0x48')](_0xdcbfbf[_0x173e('0x44')],qs[_0x173e('0x4a')](_0x585549['query'][_0x173e('0x4a')]));_0x5a84d4[_0x173e('0x49')]=_0x5a84d4['attributes'][_0x173e('0x4b')]?_0x5a84d4[_0x173e('0x49')]:_0xdcbfbf['model'];if(!_0x585549[_0x173e('0x45')][_0x173e('0x68')](_0x173e('0x4c'))){_0x5a84d4[_0x173e('0x2c')]=qs[_0x173e('0x2c')](_0x585549['query']['limit']);_0x5a84d4['offset']=qs['offset'](_0x585549['query']['offset']);}_0x5a84d4[_0x173e('0x4d')]=qs['sort'](_0x585549[_0x173e('0x45')][_0x173e('0x4e')]);_0x5a84d4[_0x173e('0x4f')]=qs[_0x173e('0x47')](_[_0x173e('0x50')](_0x585549[_0x173e('0x45')],_0xdcbfbf['filters']));_0x5a84d4[_0x173e('0x4f')][_0x173e('0x69')]=_0x21b8e1['id'];if(_0x585549[_0x173e('0x45')][_0x173e('0x51')]){_0x5a84d4[_0x173e('0x4f')]=_[_0x173e('0x52')](_0x5a84d4[_0x173e('0x4f')],{'$or':_[_0x173e('0x3e')](_0x5a84d4[_0x173e('0x49')],function(_0x29d86c){var _0x4e561b={};_0x4e561b[_0x29d86c]={'$like':'%'+_0x585549[_0x173e('0x45')][_0x173e('0x51')]+'%'};return _0x4e561b;})});}_0x5a84d4=_[_0x173e('0x52')]({},_0x5a84d4,_0x585549[_0x173e('0x58')]);return db[_0x173e('0x6e')]['count']({'where':_0x5a84d4[_0x173e('0x4f')]})[_0x173e('0x1f')](function(_0x117de2){_0x31ad43[_0x173e('0x2d')]=_0x117de2;if(_0x585549[_0x173e('0x45')]['includeAll']){_0x5a84d4[_0x173e('0x6a')]=[{'all':!![]}];}return db[_0x173e('0x6e')][_0x173e('0x55')](_0x5a84d4);})[_0x173e('0x1f')](function(_0x176433){_0x31ad43[_0x173e('0x56')]=_0x176433;return _0x31ad43;});}})['then'](respondWithFilteredResult(_0x1419f6,_0x5a84d4))[_0x173e('0x28')](handleError(_0x1419f6,null));};exports[_0x173e('0x6f')]=function(_0x4eab78,_0x2315c6,_0xc9c670){return db[_0x173e('0x3f')][_0x173e('0x59')]({'where':{'id':_0x4eab78[_0x173e('0x60')]['id']}})[_0x173e('0x1f')](handleEntityNotFound(_0x2315c6,null))[_0x173e('0x1f')](function(_0x27d38c){if(_0x27d38c){return _0x27d38c[_0x173e('0x6f')](_0x4eab78[_0x173e('0x45')]['ids']);}})[_0x173e('0x1f')](respondWithStatusCode(_0x2315c6,null))[_0x173e('0x28')](handleError(_0x2315c6,null));};exports['notify']=function(_0x13f7ab,_0x422460,_0x5974ad){var _0x40deff={'channel':_0x173e('0x70')};var _0x51067c=[];var _0x26e5f0=[];var _0x5c7c2d={};return db[_0x173e('0x3f')][_0x173e('0x59')]({'where':{'id':_0x13f7ab['params']['id']},'include':[{'model':db[_0x173e('0x71')],'as':'Applications'}]})[_0x173e('0x1f')](handleEntityNotFound(_0x422460,null))[_0x173e('0x1f')](function(_0x20592b){_0x40deff[_0x173e('0x72')]=_0x20592b;_0x40deff[_0x173e('0x73')]=_[_0x173e('0x74')](_0x20592b[_0x173e('0x75')],['priority'],[_0x173e('0x76')]);if(_0x40deff[_0x173e('0x72')][_0x173e('0x75')]){delete _0x40deff['account'][_0x173e('0x75')];}return db[_0x173e('0x77')][_0x173e('0x62')]();})[_0x173e('0x1f')](function(_0x46a5f3){if(!_0x46a5f3){throw new db[(_0x173e('0x78'))][(_0x173e('0x79'))](_0x173e('0x7a'));}_0x51067c=_[_0x173e('0x7b')](_[_0x173e('0x46')](_0x46a5f3),[_0x173e('0x7c'),'updatedAt']);_0x26e5f0=_[_0x173e('0x7b')](_[_0x173e('0x46')](_0x46a5f3),[_0x173e('0x7c'),_0x173e('0x7d'),_0x173e('0x7e'),_0x173e('0x7f')]);_0x40deff['body']={'mapKey':_0x173e('0x80')};if(_0x40deff[_0x173e('0x72')]['type']){switch(_0x40deff[_0x173e('0x72')][_0x173e('0x42')]){case _0x173e('0x81'):_0x40deff[_0x173e('0x5f')][_0x173e('0x82')]=_0x13f7ab[_0x173e('0x5f')][_0x173e('0x83')];_0x40deff['body'][_0x173e('0x5f')]=_0x13f7ab[_0x173e('0x5f')][_0x173e('0x84')];_0x40deff[_0x173e('0x5f')][_0x173e('0x85')]=_0x13f7ab[_0x173e('0x5f')]['MessageSid'];break;case _0x173e('0x86'):_0x40deff[_0x173e('0x5f')][_0x173e('0x82')]='+'+_0x13f7ab[_0x173e('0x5f')][_0x173e('0x87')];_0x40deff[_0x173e('0x5f')][_0x173e('0x5f')]=_0x13f7ab[_0x173e('0x5f')][_0x173e('0x88')];break;case _0x173e('0x89'):_0x40deff['body']['from']=_0x13f7ab[_0x173e('0x5f')][_0x173e('0x82')];_0x40deff[_0x173e('0x5f')][_0x173e('0x5f')]=_0x13f7ab[_0x173e('0x5f')]['message'];break;case _0x173e('0x8a'):_0x40deff['body']['from']=_0x13f7ab[_0x173e('0x5f')][_0x173e('0x82')];_0x40deff['body']['body']=_0x13f7ab[_0x173e('0x5f')]['body'];_0x40deff[_0x173e('0x5f')][_0x173e('0x85')]=_0x13f7ab[_0x173e('0x5f')][_0x173e('0x8b')];break;case'plivo':_0x40deff[_0x173e('0x5f')][_0x173e('0x82')]=_0x13f7ab[_0x173e('0x5f')][_0x173e('0x83')];_0x40deff[_0x173e('0x5f')][_0x173e('0x5f')]=_0x13f7ab[_0x173e('0x5f')][_0x173e('0x8c')];_0x40deff[_0x173e('0x5f')][_0x173e('0x85')]=_0x13f7ab['body'][_0x173e('0x8d')];break;case _0x173e('0x8e'):_0x40deff[_0x173e('0x5f')][_0x173e('0x82')]='+'+_0x13f7ab['body'][_0x173e('0x8f')][0x0][_0x173e('0x82')];_0x40deff[_0x173e('0x5f')][_0x173e('0x5f')]=_0x13f7ab[_0x173e('0x5f')][_0x173e('0x8f')][0x0][_0x173e('0x88')];_0x40deff[_0x173e('0x5f')][_0x173e('0x85')]=_0x13f7ab[_0x173e('0x5f')]['results'][0x0][_0x173e('0x85')];break;case _0x173e('0x90'):_0x40deff['body'][_0x173e('0x82')]=_0x13f7ab[_0x173e('0x5f')][_0x173e('0x91')];_0x40deff[_0x173e('0x5f')]['body']=_0x13f7ab[_0x173e('0x5f')]['segmentedMessage'][_0x173e('0x25')];break;case'clickatell':_0x40deff[_0x173e('0x5f')][_0x173e('0x82')]=_0x13f7ab[_0x173e('0x5f')]['fromNumber'];_0x40deff['body']['body']=_0x13f7ab[_0x173e('0x5f')]['text'];_0x40deff[_0x173e('0x5f')][_0x173e('0x85')]=_0x13f7ab[_0x173e('0x5f')][_0x173e('0x92')];break;case _0x173e('0x93'):_0x40deff[_0x173e('0x5f')]['messageId']=_0x13f7ab[_0x173e('0x5f')][0x0]['message']['id'];_0x40deff[_0x173e('0x5f')]['from']=_0x13f7ab['body'][0x0]['message']['from'];_0x40deff['body'][_0x173e('0x5f')]=_0x13f7ab[_0x173e('0x5f')][0x0][_0x173e('0x25')]['text'];break;case'intelepeer':_0x40deff[_0x173e('0x5f')]['from']=_0x13f7ab['body'][_0x173e('0x82')];_0x40deff[_0x173e('0x5f')]['body']=_0x13f7ab[_0x173e('0x5f')]['message'];_0x40deff[_0x173e('0x5f')][_0x173e('0x85')]=_0x13f7ab['body'][_0x173e('0x94')];break;}}if(_0x40deff[_0x173e('0x5f')]['id']){delete _0x40deff['body']['id'];}if(_[_0x173e('0x95')](_0x40deff[_0x173e('0x5f')][_0x173e('0x82')])){throw new db[(_0x173e('0x78'))]['ValidationError'](_0x173e('0x96'));}if(_['isNil'](_0x40deff[_0x173e('0x5f')][_0x173e('0x5f')])||_0x40deff[_0x173e('0x5f')][_0x173e('0x5f')]===''){throw new db[(_0x173e('0x78'))][(_0x173e('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x173e('0x95')](_0x40deff['body'][_0x173e('0x97')])){throw new db[(_0x173e('0x78'))][(_0x173e('0x79'))](_0x173e('0x98')+_0x26e5f0);}if(!_[_0x173e('0x99')](_0x26e5f0,_0x40deff['body']['mapKey'])){throw new db['Sequelize'][(_0x173e('0x79'))](_0x173e('0x9a')+_0x26e5f0);}_0x5c7c2d[_0x40deff[_0x173e('0x5f')]['mapKey']]=_0x40deff['body']['from'];return db[_0x173e('0x9b')][_0x173e('0x59')]({'where':{'id':_0x40deff[_0x173e('0x72')][_0x173e('0x7f')]},'include':[{'model':db[_0x173e('0x77')],'as':'Contacts','where':_0x5c7c2d,'limit':0x1,'order':[[_0x173e('0x7d'),_0x173e('0x9c')]]}]});})['then'](handleEntityNotFound(_0x422460,null))[_0x173e('0x1f')](function(_0x257505){if(_0x257505){_0x40deff[_0x173e('0x9d')]=_['omit'](_0x257505,[_0x173e('0x9e')]);if(_0x257505[_0x173e('0x9e')][_0x173e('0x4b')]){return _0x257505[_0x173e('0x9e')][0x0];}var _0x42895e=_['defaults'](_0x40deff[_0x173e('0x5f')],{'firstName':_0x40deff['body'][_0x173e('0x82')],'ListId':_0x257505['id']});_0x42895e[_0x40deff[_0x173e('0x5f')]['mapKey']]=_0x40deff[_0x173e('0x5f')][_0x173e('0x82')];return db['CmContact'][_0x173e('0x65')](_0x42895e,{'fields':_0x51067c,'raw':!![]});}})['then'](handleEntityNotFound(_0x422460,null))['then'](function(_0xe0b9d8){if(_0xe0b9d8){_0x40deff['contact']=_0xe0b9d8;var _0x40e622={'ContactId':_0xe0b9d8['id'],'phone':_0x40deff['body']['from'],'SmsAccountId':_0x13f7ab['params']['id']};var _0x41ab9f={'ContactId':_0xe0b9d8['id'],'SmsAccountId':_0x13f7ab['params']['id'],'closed':![]};return db[_0x173e('0x9f')]['find']({'where':_0x41ab9f})[_0x173e('0x1f')](function(_0x48b8e8){if(_0x48b8e8){return[_0x48b8e8,![]];}return db[_0x173e('0x9f')]['create'](_0x40e622)[_0x173e('0x1f')](function(_0x4322c8){return[_0x4322c8,!![]];});});}})['spread'](function(_0x4445ff,_0x38c310){_0x40deff['interaction']=_0x4445ff[_0x173e('0x35')]({'plain':!![]});_0x40deff[_0x173e('0xa0')][_0x173e('0xa1')]=![];if(_0x38c310){if(_0x40deff[_0x173e('0x72')][_0x173e('0xa2')]){_0x40deff[_0x173e('0x73')][_0x173e('0xa3')]({'id':0x0,'priority':_0x40deff[_0x173e('0x73')][_0x173e('0x4b')]+0x1,'app':_0x173e('0xa4'),'appdata':'unmanaged','interval':_0x173e('0xa5')});}_0x40deff['interaction'][_0x173e('0xa1')]=!![];}return db['SmsMessage'][_0x173e('0x65')]({'phone':_0x40deff['body'][_0x173e('0x82')],'messageId':_0x40deff[_0x173e('0x5f')][_0x173e('0x85')],'body':_0x40deff[_0x173e('0x5f')][_0x173e('0x5f')],'SmsAccountId':_0x13f7ab[_0x173e('0x60')]['id'],'SmsInteractionId':_0x4445ff['id'],'direction':'in','ContactId':_0x4445ff[_0x173e('0xa6')],'AttachmentId':_0x40deff[_0x173e('0x5f')]['AttachmentId']});})['then'](function(_0xfc2af9){_0x40deff[_0x173e('0x25')]=_0xfc2af9;if(_0x40deff[_0x173e('0xa0')][_0x173e('0xa7')]){return db[_0x173e('0xa8')][_0x173e('0x59')]({'attributes':['id',_0x173e('0x3b')],'where':{'id':_0x40deff['interaction'][_0x173e('0xa7')]}})[_0x173e('0x1f')](function(_0x197696){if(_0x197696){_0x40deff[_0x173e('0x73')]['unshift']({'id':0x0,'priority':0x0,'app':_0x173e('0xa9'),'appdata':_0x197696[_0x173e('0x3b')]+','+(_0x40deff[_0x173e('0x72')]['waitForTheAssignedAgent']||0xa),'interval':_0x173e('0xa5')});}return respondWithRpcPromise('Start','startRouting',_0x40deff);});}return respondWithRpcPromise('Start',_0x173e('0xaa'),_0x40deff);})['then'](function(_0x109d88){if(_0x109d88){var _0x58ceb1=0xc8;var _0x28a387=_0x173e('0xab');logger[_0x173e('0x20')](_0x173e('0xac'),_0x28a387,_0x58ceb1,_0x173e('0xad'));logger[_0x173e('0x22')](_0x173e('0xae'),_0x28a387,_0x58ceb1,_0x173e('0xad'),JSON['stringify'](_0x109d88));if(_0x40deff[_0x173e('0x72')][_0x173e('0x42')]==='twilio'){return _0x422460['status'](_0x58ceb1)[_0x173e('0xaf')](_0x173e('0xb0'),_0x173e('0xb1'))['send'](_0x173e('0xb2'));}else{return _0x422460['status'](_0x58ceb1)[_0x173e('0x2f')](_0x109d88);}}})[_0x173e('0x28')](handleError(_0x422460,null));};exports[_0x173e('0xb3')]=function(_0x431c81,_0x35487d,_0x323470){return db['SmsAccount'][_0x173e('0x67')]({'where':{'id':_0x431c81['params']['id']}})[_0x173e('0x1f')](handleEntityNotFound(_0x35487d,null))['then'](function(_0x8bc569){if(_0x8bc569){return db[_0x173e('0xb4')][_0x173e('0xb5')](function(_0x4d4767){return db[_0x173e('0x71')]['destroy']({'where':{'SmsAccountId':_0x431c81['params']['id']},'transaction':_0x4d4767})['then'](function(_0x45e6ea){var _0x45db71=_['map'](_0x431c81['body'],function(_0x3eb250){_0x3eb250[_0x173e('0x69')]=_0x431c81['params']['id'];return _0x3eb250;});return db[_0x173e('0x71')]['bulkCreate'](_0x45db71,{'transaction':_0x4d4767});});})[_0x173e('0x1f')](function(){return db[_0x173e('0x71')][_0x173e('0xb6')]({'where':{'SmsAccountId':_0x431c81[_0x173e('0x60')]['id']},'order':_0x173e('0xb7')});});}})['then'](respondWithResult(_0x35487d,null))[_0x173e('0x28')](handleError(_0x35487d,null));};exports[_0x173e('0xb8')]=function(_0x50ffdd,_0x3bd90d,_0x43a55b){var _0x1a1a19={};var _0x21849e={};var _0x58ba5d;var _0x7557f8;return db['SmsAccount'][_0x173e('0x67')]({'where':{'id':_0x50ffdd[_0x173e('0x60')]['id']}})[_0x173e('0x1f')](handleEntityNotFound(_0x3bd90d,null))['then'](function(_0x48c9c4){if(_0x48c9c4){_0x58ba5d=_0x48c9c4;_0x21849e[_0x173e('0x44')]=_[_0x173e('0x46')](db[_0x173e('0x71')][_0x173e('0x40')]);_0x21849e['query']=_[_0x173e('0x46')](_0x50ffdd[_0x173e('0x45')]);_0x21849e['filters']=_[_0x173e('0x48')](_0x21849e['model'],_0x21849e[_0x173e('0x45')]);_0x1a1a19['attributes']=_[_0x173e('0x48')](_0x21849e[_0x173e('0x44')],qs[_0x173e('0x4a')](_0x50ffdd[_0x173e('0x45')][_0x173e('0x4a')]));_0x1a1a19[_0x173e('0x49')]=_0x1a1a19['attributes'][_0x173e('0x4b')]?_0x1a1a19[_0x173e('0x49')]:_0x21849e['model'];_0x1a1a19[_0x173e('0x4d')]=qs['sort'](_0x50ffdd[_0x173e('0x45')]['sort']);_0x1a1a19[_0x173e('0x4f')]=qs['filters'](_[_0x173e('0x50')](_0x50ffdd[_0x173e('0x45')],_0x21849e[_0x173e('0x47')]));if(_0x50ffdd[_0x173e('0x45')][_0x173e('0x51')]){_0x1a1a19[_0x173e('0x4f')]=_['merge'](_0x1a1a19[_0x173e('0x4f')],{'$or':_['map'](_0x1a1a19[_0x173e('0x49')],function(_0x51c7b4){var _0x34f6ae={};_0x34f6ae[_0x51c7b4]={'$like':'%'+_0x50ffdd[_0x173e('0x45')][_0x173e('0x51')]+'%'};return _0x34f6ae;})});}_0x1a1a19=_[_0x173e('0x52')]({},_0x1a1a19,_0x50ffdd['options']);return _0x58ba5d[_0x173e('0xb8')](_0x1a1a19);}})[_0x173e('0x1f')](function(_0x1c2698){if(_0x1c2698){_0x7557f8=_0x1c2698[_0x173e('0x4b')];if(!_0x50ffdd[_0x173e('0x45')][_0x173e('0x68')](_0x173e('0x4c'))){_0x1a1a19[_0x173e('0x2c')]=qs[_0x173e('0x2c')](_0x50ffdd[_0x173e('0x45')][_0x173e('0x2c')]);_0x1a1a19['offset']=qs['offset'](_0x50ffdd[_0x173e('0x45')]['offset']);}return _0x58ba5d[_0x173e('0xb8')](_0x1a1a19);}})[_0x173e('0x1f')](function(_0x2001b7){if(_0x2001b7){return _0x2001b7?{'count':_0x7557f8,'rows':_0x2001b7}:null;}})[_0x173e('0x1f')](respondWithResult(_0x3bd90d,null))[_0x173e('0x28')](handleError(_0x3bd90d,null));};exports[_0x173e('0xb9')]=function(_0x229212,_0x484fd5,_0x146228){var _0x247445={'raw':![],'where':{}};var _0x5d059a={};var _0x419e67={'count':0x0,'rows':[]};return db[_0x173e('0x3f')][_0x173e('0x67')]({'where':{'id':_0x229212[_0x173e('0x60')]['id']}})[_0x173e('0x1f')](handleEntityNotFound(_0x484fd5,null))[_0x173e('0x1f')](function(_0x5763ce){if(_0x5763ce){_0x5d059a[_0x173e('0x44')]=_['keys'](db['SmsInteraction'][_0x173e('0x40')]);_0x5d059a[_0x173e('0x45')]=_[_0x173e('0x46')](_0x229212[_0x173e('0x45')]);_0x5d059a['filters']=_[_0x173e('0x48')](_0x5d059a[_0x173e('0x44')],_0x5d059a['query']);_0x247445[_0x173e('0x49')]=_[_0x173e('0x48')](_0x5d059a[_0x173e('0x44')],qs[_0x173e('0x4a')](_0x229212['query'][_0x173e('0x4a')]));_0x247445['attributes']=_0x247445['attributes'][_0x173e('0x4b')]?_0x247445[_0x173e('0x49')]:_0x5d059a['model'];if(!_0x229212[_0x173e('0x45')][_0x173e('0x68')]('nolimit')){_0x247445['limit']=qs[_0x173e('0x2c')](_0x229212['query'][_0x173e('0x2c')]);_0x247445[_0x173e('0x2a')]=qs[_0x173e('0x2a')](_0x229212[_0x173e('0x45')][_0x173e('0x2a')]);}_0x247445[_0x173e('0x4d')]=qs[_0x173e('0x4e')](_0x229212[_0x173e('0x45')][_0x173e('0x4e')]);_0x247445[_0x173e('0x4f')]=qs[_0x173e('0x47')](_[_0x173e('0x50')](_0x229212[_0x173e('0x45')],_0x5d059a[_0x173e('0x47')]));_0x247445[_0x173e('0x4f')][_0x173e('0x69')]=_0x5763ce['id'];if(_0x229212[_0x173e('0x45')]['filter']){_0x247445[_0x173e('0x4f')]=_[_0x173e('0x52')](_0x247445[_0x173e('0x4f')],{'$or':_[_0x173e('0x3e')](_0x247445['attributes'],function(_0x414d8c){var _0x10ff0a={};_0x10ff0a[_0x414d8c]={'$like':'%'+_0x229212['query'][_0x173e('0x51')]+'%'};return _0x10ff0a;})});}_0x247445=_[_0x173e('0x52')]({},_0x247445,_0x229212[_0x173e('0x58')]);return db[_0x173e('0x9f')]['count']({'where':_0x247445[_0x173e('0x4f')]})[_0x173e('0x1f')](function(_0x1cbd87){_0x419e67[_0x173e('0x2d')]=_0x1cbd87;if(_0x229212[_0x173e('0x45')][_0x173e('0x54')]){_0x247445[_0x173e('0x6a')]=[{'model':db[_0x173e('0x77')],'as':_0x173e('0xba'),'required':![]},{'model':db[_0x173e('0xa8')],'as':_0x173e('0xbb'),'attributes':[_0x173e('0x3b'),_0x173e('0xbc'),_0x173e('0xbd')],'required':![]},{'model':db[_0x173e('0xbe')],'as':_0x173e('0xbf'),'attributes':['id','name','color'],'where':_0x229212[_0x173e('0x45')][_0x173e('0xc0')]?{'id':_0x229212['query'][_0x173e('0xc0')]}:undefined,'required':_0x229212['query'][_0x173e('0xc0')]?!![]:![]}];}return db[_0x173e('0x9f')][_0x173e('0x55')](_0x247445);})[_0x173e('0x1f')](function(_0x388db6){_0x419e67[_0x173e('0x56')]=_0x388db6;return _0x419e67;});}})[_0x173e('0x1f')](respondWithFilteredResult(_0x484fd5,_0x247445))[_0x173e('0x28')](handleError(_0x484fd5,null));};exports[_0x173e('0x3c')]=function(_0x11d396,_0x300d2a,_0x3274cd){var _0x5a4d87,_0x47371d,_0x2fe79c;if(_[_0x173e('0x95')](_0x11d396['body'][_0x173e('0x5f')])||_0x11d396['body'][_0x173e('0x5f')]===''){throw new db[(_0x173e('0x78'))][(_0x173e('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x11d396[_0x173e('0x5f')]['to'])){throw new db[(_0x173e('0x78'))][(_0x173e('0x79'))](_0x173e('0xc1'));}_0x5a4d87=_0x11d396['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x11d396['params']['id']},'include':[{'model':db[_0x173e('0x9b')],'as':_0x173e('0xc2'),'include':[{'model':db['CmContact'],'as':_0x173e('0x9e'),'where':{'mobile':_0x5a4d87},'limit':0x1,'order':[[_0x173e('0x7d'),'DESC']]}]}]})[_0x173e('0x1f')](handleEntityNotFound(_0x300d2a,null))['then'](function(_0x3b86d1){if(_0x3b86d1&&_0x3b86d1[_0x173e('0xc2')]){_0x47371d=_0x3b86d1[_0x173e('0x35')]({'plain':!![]});if(_0x47371d[_0x173e('0xc2')]&&_0x47371d['List'][_0x173e('0x9e')][_0x173e('0x4b')]){return _0x47371d[_0x173e('0xc2')][_0x173e('0x9e')][0x0];}return db['CmContact'][_0x173e('0x65')](_['defaults'](_0x11d396['body'],{'firstName':_0x5a4d87,'mobile':_0x5a4d87,'phone':_0x5a4d87,'ListId':_0x47371d[_0x173e('0x7f')]}));}})['then'](handleEntityNotFound(_0x300d2a,null))[_0x173e('0x1f')](function(_0x160254){if(_0x160254){_0x2fe79c=_0x160254;return db['SmsInteraction'][_0x173e('0x59')]({'where':{'ContactId':_0x2fe79c['id'],'closed':![],'SmsAccountId':_0x47371d['id']}})[_0x173e('0x1f')](function(_0x2c9e9f){if(_0x2c9e9f){return[_0x2c9e9f,![]];}return db[_0x173e('0x9f')][_0x173e('0x65')]({'UserId':_0x11d396[_0x173e('0xc3')]['id'],'ContactId':_0x2fe79c['id'],'SmsAccountId':_0x47371d['id'],'phone':_0x5a4d87,'firstMsgDirection':_0x173e('0xc4'),'Messages':[_['merge'](_0x11d396[_0x173e('0x5f')],{'read':![],'body':_0x11d396[_0x173e('0x5f')]['body'],'phone':_0x5a4d87,'SmsAccountId':_0x47371d['id'],'UserId':_0x11d396[_0x173e('0xc3')]['id'],'ContactId':_0x2fe79c['id']})]},{'include':[{'model':db[_0x173e('0xc5')],'as':_0x173e('0xc6')}]})['then'](function(_0x2b9bfc){return[_0x2b9bfc,!![]];});});}})[_0x173e('0xc7')](function(_0x40d660,_0x509ecc){if(_0x509ecc){return _0x40d660;}return db[_0x173e('0xc5')][_0x173e('0x65')](_['merge'](_0x11d396[_0x173e('0x5f')],{'read':![],'body':_0x11d396['body'][_0x173e('0x5f')],'phone':_0x5a4d87,'SmsAccountId':_0x47371d['id'],'SmsInteractionId':_0x40d660['id'],'UserId':_0x11d396[_0x173e('0xc3')]['id'],'ContactId':_0x2fe79c['id']}))[_0x173e('0x1f')](function(_0x2097e0){_0x40d660[_0x173e('0xc8')][_0x173e('0xc6')]=[];_0x40d660['dataValues'][_0x173e('0xc6')][_0x173e('0xa3')](_0x2097e0['dataValues']);return _0x40d660;});})['then'](respondWithResult(_0x300d2a,null))[_0x173e('0x28')](handleError(_0x300d2a,null));};exports['status']=function(_0x24e982,_0xb9f2f7,_0xf00f34){if(_0x24e982[_0x173e('0x5f')]['id']){delete _0x24e982[_0x173e('0x5f')]['id'];}var _0x7c3add,_0x3bf08e,_0x588c96;return db['SmsAccount'][_0x173e('0x59')]({'where':{'id':_0x24e982['params']['id']}})['then'](handleEntityNotFound(_0xb9f2f7,null))[_0x173e('0x1f')](function(_0xb9e0b3){if(_0xb9e0b3){_0x588c96=_0xb9e0b3;logger[_0x173e('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0xb9e0b3[_0x173e('0x42')],util[_0x173e('0xc9')](_0x24e982['body'],{'showHidden':![],'depth':null}));switch(_0xb9e0b3[_0x173e('0x42')]){case _0x173e('0x86'):if(_0x24e982[_0x173e('0x5f')][_0x173e('0xca')]&&_0x24e982[_0x173e('0x5f')]['status']){_0x3bf08e=_0x24e982[_0x173e('0x5f')][_0x173e('0x38')];return db[_0x173e('0xc5')][_0x173e('0x59')]({'where':{'messageId':_0x24e982['body'][_0x173e('0xca')]}});}break;case'connectel':if(_0x24e982[_0x173e('0x5f')][_0x173e('0xcb')]&&_0x24e982[_0x173e('0x5f')][_0x173e('0xcc')]){_0x3bf08e=_0x24e982[_0x173e('0x5f')]['statusInt'];return db[_0x173e('0xc5')][_0x173e('0x59')]({'where':{'messageId':_0x24e982[_0x173e('0x5f')][_0x173e('0xcb')]}});}break;case _0x173e('0x8a'):if(_0x24e982[_0x173e('0x5f')][_0x173e('0x8b')]&&_0x24e982[_0x173e('0x5f')][_0x173e('0xcd')]){_0x3bf08e=_0x24e982[_0x173e('0x5f')]['status_code'];return db[_0x173e('0xc5')][_0x173e('0x59')]({'where':{'messageId':_0x24e982['body'][_0x173e('0x8b')]}});}break;case _0x173e('0x8e'):var _0x195370=_0x24e982['body'][_0x173e('0x8f')][0x0];if(_0x195370[_0x173e('0x85')]&&_0x195370[_0x173e('0x38')][_0x173e('0xce')]===_0x173e('0xcf')){_0x3bf08e=_0x195370['status']['groupName'];return db[_0x173e('0xc5')]['find']({'where':{'messageId':_0x195370['messageId']}});}break;case'clickatell':if(_0x24e982[_0x173e('0x5f')][_0x173e('0x85')]&&_0x24e982['body'][_0x173e('0x38')]){_0x3bf08e=_0x24e982['body']['status'];return db[_0x173e('0xc5')]['find']({'where':{'messageId':_0x24e982[_0x173e('0x5f')][_0x173e('0x85')]}});}break;case'bandwidth':if(_0x24e982['body'][0x0][_0x173e('0x25')]['id']){_0x3bf08e=_0x24e982[_0x173e('0x5f')][0x0][_0x173e('0x42')];return db['SmsMessage'][_0x173e('0x59')]({'where':{'messageId':_0x24e982[_0x173e('0x5f')][0x0][_0x173e('0x25')]['id']}});}break;case _0x173e('0xd0'):if(_0x24e982[_0x173e('0x5f')][_0x173e('0xd1')]&&_0x24e982[_0x173e('0x5f')][_0x173e('0x38')]){_0x3bf08e=_0x24e982[_0x173e('0x5f')]['status'];return db[_0x173e('0xc5')][_0x173e('0x59')]({'where':{'messageId':_0x24e982['body'][_0x173e('0xd1')]}});}break;}}})[_0x173e('0x1f')](handleEntityNotFound(_0xb9f2f7,null))['then'](function(_0x6f3cef){if(_0x6f3cef){_0x7c3add=_0x6f3cef;switch(_0x588c96[_0x173e('0x42')]){case _0x173e('0x86'):if(_0x3bf08e===_0x173e('0xcf')){return _0x7c3add[_0x173e('0x33')]({'read':!![]});}else{logger['error'](_0x173e('0xac'),_0x173e('0x38'),_0x173e('0x86'),util[_0x173e('0xc9')](_0x24e982[_0x173e('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x173e('0x89'):if(_0x3bf08e==='1'){return _0x7c3add[_0x173e('0x33')]({'read':!![]});}else{logger[_0x173e('0x24')](_0x173e('0xac'),_0x173e('0x38'),'skebby',util[_0x173e('0xc9')](_0x24e982[_0x173e('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x173e('0x8a'):if(!_0x24e982[_0x173e('0x5f')]['error_code']&&_0x3bf08e>=0xc8&&_0x3bf08e<=0xce){return _0x7c3add[_0x173e('0x33')]({'read':!![]});}else{logger[_0x173e('0x24')](_0x173e('0xac'),_0x173e('0x38'),_0x173e('0x8a'),util[_0x173e('0xc9')](_0x24e982[_0x173e('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2b11eb=_0x24e982[_0x173e('0x5f')]['results'][0x0];if(_0x2b11eb[_0x173e('0x38')][_0x173e('0xce')]===_0x173e('0xcf')){return _0x7c3add[_0x173e('0x33')]({'read':!![]});}else{logger[_0x173e('0x24')](_0x173e('0xac'),_0x173e('0x38'),_0x173e('0x8e'),util[_0x173e('0xc9')](_0x24e982['body'],{'showHidden':![],'depth':null}));}break;case _0x173e('0xd2'):if(_0x3bf08e==_0x173e('0xd3')||_0x3bf08e==_0x173e('0xd4')){return _0x7c3add[_0x173e('0x33')]({'read':!![]});}else{logger['error'](_0x173e('0xac'),_0x173e('0x38'),_0x173e('0xd2'),util['inspect'](_0x24e982['body'],{'showHidden':![],'depth':null}));}break;case _0x173e('0x93'):if(_0x3bf08e==_0x173e('0xd5')){return _0x7c3add[_0x173e('0x33')]({'read':!![]});}else{logger[_0x173e('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x173e('0x38'),_0x173e('0x93'),util[_0x173e('0xc9')](_0x24e982['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3bf08e===_0x173e('0xd6')||_0x3bf08e===_0x173e('0xd7')){return _0x7c3add[_0x173e('0x33')]({'read':!![]});}else{logger[_0x173e('0x24')](_0x173e('0xac'),_0x173e('0x38'),'intelepeer',util[_0x173e('0xc9')](_0x24e982[_0x173e('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x7c3add;}})[_0x173e('0x1f')](respondWithResult(_0xb9f2f7,null))[_0x173e('0x28')](handleError(_0xb9f2f7,null));};exports[_0x173e('0xd8')]=function(_0x331c44,_0x2089c3,_0x47d6d2){var _0x53e691,_0x352d8a,_0x3e9a59;return db['SmsAccount']['find']({'where':{'id':_0x331c44[_0x173e('0x60')]['id']}})[_0x173e('0x1f')](handleEntityNotFound(_0x2089c3,null))[_0x173e('0x1f')](function(_0x4444d6){if(_0x4444d6){_0x3e9a59=_0x4444d6;logger[_0x173e('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x173e('0x38'),_0x173e('0xd9'),_0x4444d6['type'],util['inspect'](_0x331c44[_0x173e('0x45')],{'showHidden':![],'depth':null}));switch(_0x4444d6[_0x173e('0x42')]){case _0x173e('0x90'):if(_0x331c44[_0x173e('0x45')][_0x173e('0xda')]&&_0x331c44[_0x173e('0x45')][_0x173e('0xdb')]){_0x352d8a=_0x331c44['query'][_0x173e('0xdb')];return db[_0x173e('0xc5')][_0x173e('0x59')]({'where':{'messageId':_0x331c44[_0x173e('0x45')][_0x173e('0xda')]}});}break;}}})['then'](handleEntityNotFound(_0x2089c3,null))['then'](function(_0x2f14d1){if(_0x2f14d1){_0x53e691=_0x2f14d1;switch(_0x3e9a59[_0x173e('0x42')]){case _0x173e('0x90'):if(_0x352d8a==='2'||_0x352d8a==='6'){return _0x53e691[_0x173e('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x173e('0x38'),_0x173e('0x90'),util[_0x173e('0xc9')](_0x331c44[_0x173e('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x53e691;}})[_0x173e('0x1f')](respondWithResult(_0x2089c3,null))[_0x173e('0x28')](handleError(_0x2089c3,null));};exports[_0x173e('0xdc')]=function(_0x51a0f7,_0x3b6985,_0x1a35ee){return db['SmsAccount']['find']({'where':{'id':_0x51a0f7[_0x173e('0x60')]['id']}})['then'](handleEntityNotFound(_0x3b6985,null))[_0x173e('0x1f')](function(_0x395704){if(_0x395704){return _0x395704[_0x173e('0xdc')](_0x51a0f7[_0x173e('0x5f')][_0x173e('0x6c')],_[_0x173e('0xdd')](_0x51a0f7[_0x173e('0x5f')],[_0x173e('0x6c'),'id'])||{})[_0x173e('0xc7')](function(_0x83316d){for(var _0x10d4b7=0x0;_0x10d4b7<_0x51a0f7['body'][_0x173e('0x6c')][_0x173e('0x4b')];_0x10d4b7+=0x1){socket['emit'](_0x173e('0xde'),{'UserId':Number(_0x51a0f7[_0x173e('0x5f')][_0x173e('0x6c')][_0x10d4b7]),'SmsAccountId':Number(_0x51a0f7[_0x173e('0x60')]['id'])});}return _0x83316d;});}})['then'](respondWithResult(_0x3b6985,null))[_0x173e('0x28')](handleError(_0x3b6985,null));};exports[_0x173e('0xdf')]=function(_0x4522ea,_0x1e2972,_0x11ff0b){return db[_0x173e('0x3f')][_0x173e('0x59')]({'where':{'id':_0x4522ea['params']['id']}})[_0x173e('0x1f')](handleEntityNotFound(_0x1e2972,null))['then'](function(_0x50f49d){if(_0x50f49d){return _0x50f49d[_0x173e('0xdf')](_0x4522ea['query'][_0x173e('0x6c')])[_0x173e('0x1f')](function(){if(_[_0x173e('0xe0')](_0x4522ea[_0x173e('0x45')][_0x173e('0x6c')])){for(var _0x35d7e2=0x0;_0x35d7e2<_0x4522ea[_0x173e('0x45')][_0x173e('0x6c')]['length'];_0x35d7e2+=0x1){socket[_0x173e('0xe1')](_0x173e('0xe2'),{'UserId':Number(_0x4522ea[_0x173e('0x45')]['ids'][_0x35d7e2]),'SmsAccountId':Number(_0x4522ea['params']['id'])});}}else{socket[_0x173e('0xe1')](_0x173e('0xe2'),{'UserId':Number(_0x4522ea[_0x173e('0x45')]['ids']),'SmsAccountId':Number(_0x4522ea[_0x173e('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x1e2972,null))[_0x173e('0x28')](handleError(_0x1e2972,null));};exports[_0x173e('0xe3')]=function(_0x17ee4b,_0x5222cb,_0x23a6bf){var _0x1fe3e2={};var _0x23f136={};var _0x21c97c;var _0x5a2082;return db[_0x173e('0x3f')][_0x173e('0x67')]({'where':{'id':_0x17ee4b[_0x173e('0x60')]['id']}})[_0x173e('0x1f')](handleEntityNotFound(_0x5222cb,null))['then'](function(_0x3b6fd8){if(_0x3b6fd8){_0x21c97c=_0x3b6fd8;_0x23f136[_0x173e('0x44')]=_['keys'](db[_0x173e('0xa8')][_0x173e('0x40')]);_0x23f136[_0x173e('0x45')]=_['keys'](_0x17ee4b[_0x173e('0x45')]);_0x23f136[_0x173e('0x47')]=_[_0x173e('0x48')](_0x23f136[_0x173e('0x44')],_0x23f136[_0x173e('0x45')]);_0x1fe3e2[_0x173e('0x49')]=_[_0x173e('0x48')](_0x23f136[_0x173e('0x44')],qs[_0x173e('0x4a')](_0x17ee4b[_0x173e('0x45')][_0x173e('0x4a')]));_0x1fe3e2[_0x173e('0x49')]=_0x1fe3e2['attributes']['length']?_0x1fe3e2['attributes']:_0x23f136[_0x173e('0x44')];_0x1fe3e2[_0x173e('0x4d')]=qs['sort'](_0x17ee4b['query'][_0x173e('0x4e')]);_0x1fe3e2[_0x173e('0x4f')]=qs['filters'](_[_0x173e('0x50')](_0x17ee4b[_0x173e('0x45')],_0x23f136['filters']));if(_0x17ee4b[_0x173e('0x45')][_0x173e('0x51')]){_0x1fe3e2['where']=_[_0x173e('0x52')](_0x1fe3e2[_0x173e('0x4f')],{'$or':_['map'](_0x1fe3e2['attributes'],function(_0x539b00){var _0x2b8b6a={};_0x2b8b6a[_0x539b00]={'$like':'%'+_0x17ee4b[_0x173e('0x45')][_0x173e('0x51')]+'%'};return _0x2b8b6a;})});}_0x1fe3e2=_[_0x173e('0x52')]({},_0x1fe3e2,_0x17ee4b[_0x173e('0x58')]);return _0x21c97c[_0x173e('0xe3')](_0x1fe3e2);}})[_0x173e('0x1f')](function(_0x41766d){if(_0x41766d){_0x5a2082=_0x41766d[_0x173e('0x4b')];if(!_0x17ee4b['query'][_0x173e('0x68')](_0x173e('0x4c'))){_0x1fe3e2[_0x173e('0x2c')]=qs['limit'](_0x17ee4b[_0x173e('0x45')][_0x173e('0x2c')]);_0x1fe3e2['offset']=qs[_0x173e('0x2a')](_0x17ee4b[_0x173e('0x45')][_0x173e('0x2a')]);}return _0x21c97c[_0x173e('0xe3')](_0x1fe3e2);}})[_0x173e('0x1f')](function(_0x57caf9){if(_0x57caf9){return _0x57caf9?{'count':_0x5a2082,'rows':_0x57caf9}:null;}})[_0x173e('0x1f')](respondWithResult(_0x5222cb,null))[_0x173e('0x28')](handleError(_0x5222cb,null));}; \ No newline at end of file +var _0x278b=['message-id','addAgents','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy','get','SmsAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','findOne','nolimit','SmsAccountId','findAll','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','Body','messageId','MessageSid','skebby','from','sender','text','connectel','plivo','Text','results','csc','originatingAddress','segmentedMessage','clickatell','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','requestid','statusInt','clicksend','message_id','status_code','infobip','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','state'];(function(_0x2fa538,_0x5b977c){var _0x2f75e9=function(_0x22aed5){while(--_0x22aed5){_0x2fa538['push'](_0x2fa538['shift']());}};_0x2f75e9(++_0x5b977c);}(_0x278b,0xea));var _0xb278=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0x278b[_0x11a962];return _0x55d423;};'use strict';var emlformat=require(_0xb278('0x0'));var rimraf=require(_0xb278('0x1'));var zipdir=require(_0xb278('0x2'));var jsonpatch=require(_0xb278('0x3'));var rp=require(_0xb278('0x4'));var moment=require(_0xb278('0x5'));var BPromise=require(_0xb278('0x6'));var Mustache=require(_0xb278('0x7'));var util=require('util');var path=require(_0xb278('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb278('0x9'));var _=require(_0xb278('0xa'));var squel=require(_0xb278('0xb'));var crypto=require(_0xb278('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb278('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb278('0xe'));var Papa=require(_0xb278('0xf'));var Redis=require(_0xb278('0x10'));var authService=require(_0xb278('0x11'));var qs=require(_0xb278('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb278('0x13'));var logger=require(_0xb278('0x14'))(_0xb278('0x15'));var utils=require(_0xb278('0x16'));var config=require(_0xb278('0x17'));var licenseUtil=require(_0xb278('0x18'));var db=require(_0xb278('0x19'))['db'];config[_0xb278('0x1a')]=_[_0xb278('0x1b')](config['redis'],{'host':_0xb278('0x1c'),'port':0x18eb});var socket=require(_0xb278('0x1d'))(new Redis(config[_0xb278('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0xb278('0x1e'));var client=jayson[_0xb278('0x1f')][_0xb278('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2eb808,_0x1b0810,_0x182863,_0x23e770){return new BPromise(function(_0x25e20f,_0x1c199e){var _0x549d76=_0x23e770||client;return _0x549d76[_0xb278('0x21')](_0x2eb808,_0x182863)['then'](function(_0x5478bb){logger[_0xb278('0x22')]('SmsAccount,\x20%s,\x20%s',_0x1b0810,_0xb278('0x23'));logger[_0xb278('0x24')](_0xb278('0x25'),_0x1b0810,_0xb278('0x23'),JSON[_0xb278('0x26')](_0x5478bb));if(_0x5478bb['error']){if(_0x5478bb[_0xb278('0x27')][_0xb278('0x28')]===0x1f4){logger[_0xb278('0x27')](_0xb278('0x29'),_0x1b0810,_0x5478bb['error']['message']);return _0x1c199e(_0x5478bb[_0xb278('0x27')][_0xb278('0x2a')]);}logger[_0xb278('0x27')](_0xb278('0x29'),_0x1b0810,_0x5478bb[_0xb278('0x27')][_0xb278('0x2a')]);return _0x25e20f(_0x5478bb[_0xb278('0x27')][_0xb278('0x2a')]);}else{logger['info'](_0xb278('0x29'),_0x1b0810,'request\x20sent');_0x25e20f(_0x5478bb[_0xb278('0x2b')][_0xb278('0x2a')]);}})[_0xb278('0x2c')](function(_0x45b83d){logger[_0xb278('0x27')]('SmsAccount,\x20%s,\x20%s',_0x1b0810,_0x45b83d);_0x1c199e(_0x45b83d);});});}function respondWithStatusCode(_0x4062a6,_0x398600){_0x398600=_0x398600||0xcc;return function(_0x5b40f9){if(_0x5b40f9){return _0x4062a6[_0xb278('0x2d')](_0x398600);}return _0x4062a6[_0xb278('0x2e')](_0x398600)[_0xb278('0x2f')]();};}function respondWithResult(_0x24ca08,_0x52e785){_0x52e785=_0x52e785||0xc8;return function(_0x30cce6){if(_0x30cce6){return _0x24ca08['status'](_0x52e785)[_0xb278('0x30')](_0x30cce6);}};}function respondWithFilteredResult(_0xd0e1f8,_0x51dbf2){return function(_0x3588e5){if(_0x3588e5){var _0x4e6039=typeof _0x51dbf2['offset']===_0xb278('0x31')&&typeof _0x51dbf2[_0xb278('0x32')]===_0xb278('0x31');var _0x5077b0=_0x3588e5['count'];var _0x1e35b7=_0x4e6039?0x0:_0x51dbf2[_0xb278('0x33')];var _0x1b7d51=_0x4e6039?_0x3588e5['count']:_0x51dbf2[_0xb278('0x33')]+_0x51dbf2[_0xb278('0x32')];var _0x5bd553;if(_0x1b7d51>=_0x5077b0){_0x1b7d51=_0x5077b0;_0x5bd553=0xc8;}else{_0x5bd553=0xce;}_0xd0e1f8['status'](_0x5bd553);return _0xd0e1f8['set'](_0xb278('0x34'),_0x1e35b7+'-'+_0x1b7d51+'/'+_0x5077b0)['json'](_0x3588e5);}return null;};}function patchUpdates(_0x8dcdbc){return function(_0x4d549a){try{jsonpatch[_0xb278('0x35')](_0x4d549a,_0x8dcdbc,!![]);}catch(_0xa03e7){return BPromise[_0xb278('0x36')](_0xa03e7);}return _0x4d549a[_0xb278('0x37')]();};}function saveUpdates(_0x46f529,_0x133aa6){return function(_0x3c0561){if(_0x3c0561){return _0x3c0561[_0xb278('0x38')](_0x46f529)[_0xb278('0x39')](function(_0x5a1183){return _0x5a1183;});}return null;};}function removeEntity(_0x3a456c,_0x4fcce9){return function(_0x15ad17){if(_0x15ad17){return _0x15ad17[_0xb278('0x3a')]()['then'](function(){var _0x30d39a=_0x15ad17[_0xb278('0x3b')]({'plain':!![]});var _0x3d764c=_0xb278('0x3c');return db[_0xb278('0x3d')][_0xb278('0x3a')]({'where':{'type':_0x3d764c,'resourceId':_0x30d39a['id']}})[_0xb278('0x39')](function(){return _0x15ad17;});})[_0xb278('0x39')](function(){_0x3a456c[_0xb278('0x2e')](0xcc)[_0xb278('0x2f')]();});}};}function handleEntityNotFound(_0x1ac3bf,_0x3970d0){return function(_0x3aae37){if(!_0x3aae37){_0x1ac3bf[_0xb278('0x2d')](0x194);}return _0x3aae37;};}function handleError(_0x321611,_0x36a281){_0x36a281=_0x36a281||0x1f4;return function(_0x1a63bd){logger[_0xb278('0x27')](_0x1a63bd['stack']);if(_0x1a63bd[_0xb278('0x3e')]){delete _0x1a63bd[_0xb278('0x3e')];}_0x321611[_0xb278('0x2e')](_0x36a281)[_0xb278('0x3f')](_0x1a63bd);};}exports[_0xb278('0x40')]=function(_0x522ce3,_0x444cb1){var _0x119db6={'include':[{'model':db[_0xb278('0x41')],'as':_0xb278('0x42')}]},_0x476c6a={},_0x4f26ea={'count':0x0,'rows':[]};var _0xa7ac9c=_[_0xb278('0x43')](db[_0xb278('0x44')][_0xb278('0x45')],function(_0x749de0){return{'name':_0x749de0[_0xb278('0x46')],'type':_0x749de0['type'][_0xb278('0x47')]};});_0x476c6a[_0xb278('0x48')]=_[_0xb278('0x43')](_0xa7ac9c,_0xb278('0x3e'));_0x476c6a[_0xb278('0x49')]=_[_0xb278('0x4a')](_0x522ce3[_0xb278('0x49')]);_0x476c6a[_0xb278('0x4b')]=_[_0xb278('0x4c')](_0x476c6a[_0xb278('0x48')],_0x476c6a['query']);_0x119db6['attributes']=_['intersection'](_0x476c6a[_0xb278('0x48')],qs[_0xb278('0x4d')](_0x522ce3[_0xb278('0x49')]['fields']));_0x119db6['attributes']=_0x119db6['attributes'][_0xb278('0x4e')]?_0x119db6[_0xb278('0x4f')]:_0x476c6a[_0xb278('0x48')];if(!_0x522ce3[_0xb278('0x49')][_0xb278('0x50')]('nolimit')){_0x119db6[_0xb278('0x32')]=qs['limit'](_0x522ce3[_0xb278('0x49')][_0xb278('0x32')]);_0x119db6['offset']=qs[_0xb278('0x33')](_0x522ce3['query'][_0xb278('0x33')]);}_0x119db6[_0xb278('0x51')]=qs[_0xb278('0x52')](_0x522ce3[_0xb278('0x49')][_0xb278('0x52')]);_0x119db6[_0xb278('0x53')]=qs['filters'](_[_0xb278('0x54')](_0x522ce3[_0xb278('0x49')],_0x476c6a[_0xb278('0x4b')]),_0xa7ac9c);if(_0x522ce3[_0xb278('0x49')][_0xb278('0x55')]){_0x119db6[_0xb278('0x53')]=_[_0xb278('0x56')](_0x119db6[_0xb278('0x53')],{'$or':_[_0xb278('0x43')](_0xa7ac9c,function(_0x38a443){if(_0x38a443[_0xb278('0x57')]!==_0xb278('0x58')){var _0xe57b34={};_0xe57b34[_0x38a443[_0xb278('0x3e')]]={'$like':'%'+_0x522ce3['query']['filter']+'%'};return _0xe57b34;}})});}_0x119db6=_[_0xb278('0x56')]({},_0x119db6,_0x522ce3[_0xb278('0x59')]);var _0x197909={'where':_0x119db6[_0xb278('0x53')]};return db[_0xb278('0x44')][_0xb278('0x5a')](_0x197909)[_0xb278('0x39')](function(_0x1f4bdc){_0x4f26ea[_0xb278('0x5a')]=_0x1f4bdc;if(_0x522ce3[_0xb278('0x49')][_0xb278('0x5b')]){_0x119db6[_0xb278('0x5c')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x119db6);})[_0xb278('0x39')](function(_0x44f7f6){_0x4f26ea[_0xb278('0x5d')]=_0x44f7f6;return _0x4f26ea;})[_0xb278('0x39')](respondWithFilteredResult(_0x444cb1,_0x119db6))['catch'](handleError(_0x444cb1,null));};exports[_0xb278('0x5e')]=function(_0x1a614b,_0x32f70f){var _0x1ca6b2={'raw':![],'where':{'id':_0x1a614b['params']['id']},'include':[{'model':db[_0xb278('0x41')],'as':_0xb278('0x42')}]},_0x580e4a={};_0x580e4a[_0xb278('0x48')]=_[_0xb278('0x4a')](db[_0xb278('0x44')][_0xb278('0x45')]);_0x580e4a[_0xb278('0x49')]=_[_0xb278('0x4a')](_0x1a614b['query']);_0x580e4a[_0xb278('0x4b')]=_['intersection'](_0x580e4a[_0xb278('0x48')],_0x580e4a[_0xb278('0x49')]);_0x1ca6b2[_0xb278('0x4f')]=_[_0xb278('0x4c')](_0x580e4a[_0xb278('0x48')],qs[_0xb278('0x4d')](_0x1a614b[_0xb278('0x49')][_0xb278('0x4d')]));_0x1ca6b2[_0xb278('0x4f')]=_0x1ca6b2[_0xb278('0x4f')][_0xb278('0x4e')]?_0x1ca6b2['attributes']:_0x580e4a['model'];if(_0x1a614b[_0xb278('0x49')][_0xb278('0x5b')]){_0x1ca6b2[_0xb278('0x5c')]=[{'all':!![]}];}_0x1ca6b2=_['merge']({},_0x1ca6b2,_0x1a614b[_0xb278('0x59')]);return db['SmsAccount'][_0xb278('0x5f')](_0x1ca6b2)[_0xb278('0x39')](handleEntityNotFound(_0x32f70f,null))[_0xb278('0x39')](respondWithResult(_0x32f70f,null))[_0xb278('0x2c')](handleError(_0x32f70f,null));};exports[_0xb278('0x60')]=function(_0x243aee,_0x8c5a03){return db[_0xb278('0x44')][_0xb278('0x60')](_0x243aee[_0xb278('0x61')],{})[_0xb278('0x39')](function(_0x5a03b7){var _0x33baf8=_0x243aee[_0xb278('0x62')][_0xb278('0x3b')]({'plain':!![]});if(!_0x33baf8)throw new Error(_0xb278('0x63'));if(_0x33baf8['role']===_0xb278('0x62')){var _0x11baff=_0x5a03b7[_0xb278('0x3b')]({'plain':!![]});var _0xe87b78='SmsAccounts';return db[_0xb278('0x64')][_0xb278('0x5f')]({'where':{'name':_0xe87b78,'userProfileId':_0x33baf8[_0xb278('0x65')]},'raw':!![]})[_0xb278('0x39')](function(_0x70944d){if(_0x70944d&&_0x70944d[_0xb278('0x66')]===0x0){return db[_0xb278('0x3d')]['create']({'name':_0x11baff['name'],'resourceId':_0x11baff['id'],'type':_0x70944d[_0xb278('0x3e')],'sectionId':_0x70944d['id']},{})[_0xb278('0x39')](function(){return _0x5a03b7;});}else{return _0x5a03b7;}})['catch'](function(_0x1c5486){logger[_0xb278('0x27')](_0xb278('0x67'),_0x1c5486);throw _0x1c5486;});}return _0x5a03b7;})['then'](respondWithResult(_0x8c5a03,0xc9))[_0xb278('0x2c')](handleError(_0x8c5a03,null));};exports[_0xb278('0x38')]=function(_0x5ec3fa,_0x478190){if(_0x5ec3fa[_0xb278('0x61')]['id']){delete _0x5ec3fa[_0xb278('0x61')]['id'];}return db[_0xb278('0x44')][_0xb278('0x5f')]({'where':{'id':_0x5ec3fa[_0xb278('0x68')]['id']},'include':[{'model':db[_0xb278('0x41')],'as':_0xb278('0x42')}]})[_0xb278('0x39')](handleEntityNotFound(_0x478190,null))[_0xb278('0x39')](saveUpdates(_0x5ec3fa[_0xb278('0x61')],null))['then'](respondWithResult(_0x478190,null))['catch'](handleError(_0x478190,null));};exports['destroy']=function(_0x496bf2,_0x564898){return db[_0xb278('0x44')][_0xb278('0x5f')]({'where':{'id':_0x496bf2[_0xb278('0x68')]['id']}})['then'](handleEntityNotFound(_0x564898,null))['then'](removeEntity(_0x564898,null))['catch'](handleError(_0x564898,null));};exports[_0xb278('0x69')]=function(_0x158c2d,_0x49f1d2){return db['SmsAccount'][_0xb278('0x69')]()['then'](respondWithResult(_0x49f1d2,null))[_0xb278('0x2c')](handleError(_0x49f1d2,null));};exports[_0xb278('0x6a')]=function(_0x4df9c8,_0x4f2dad,_0x5477be){if(_0x4df9c8[_0xb278('0x61')]['id']){delete _0x4df9c8[_0xb278('0x61')]['id'];}return db[_0xb278('0x44')][_0xb278('0x5f')]({'where':{'id':_0x4df9c8[_0xb278('0x68')]['id']}})['then'](handleEntityNotFound(_0x4f2dad,null))['then'](function(_0x5cc392){if(_0x5cc392){_0x4df9c8[_0xb278('0x61')]['SmsAccountId']=_0x5cc392['id'];return db[_0xb278('0x6b')]['create'](_0x4df9c8['body']);}})[_0xb278('0x39')](respondWithResult(_0x4f2dad,null))[_0xb278('0x2c')](handleError(_0x4f2dad,null));};exports['getDispositions']=function(_0x2dc079,_0x31591d,_0xa940e){var _0x23abac={'raw':![],'where':{}};var _0x3609f8={};var _0x1f1355={'count':0x0,'rows':[]};return db[_0xb278('0x44')][_0xb278('0x6c')]({'where':{'id':_0x2dc079['params']['id']}})[_0xb278('0x39')](handleEntityNotFound(_0x31591d,null))['then'](function(_0x2830fc){if(_0x2830fc){_0x3609f8[_0xb278('0x48')]=_[_0xb278('0x4a')](db[_0xb278('0x6b')][_0xb278('0x45')]);_0x3609f8[_0xb278('0x49')]=_[_0xb278('0x4a')](_0x2dc079[_0xb278('0x49')]);_0x3609f8[_0xb278('0x4b')]=_['intersection'](_0x3609f8['model'],_0x3609f8[_0xb278('0x49')]);_0x23abac[_0xb278('0x4f')]=_[_0xb278('0x4c')](_0x3609f8[_0xb278('0x48')],qs['fields'](_0x2dc079[_0xb278('0x49')]['fields']));_0x23abac[_0xb278('0x4f')]=_0x23abac[_0xb278('0x4f')][_0xb278('0x4e')]?_0x23abac[_0xb278('0x4f')]:_0x3609f8['model'];if(!_0x2dc079[_0xb278('0x49')][_0xb278('0x50')](_0xb278('0x6d'))){_0x23abac[_0xb278('0x32')]=qs['limit'](_0x2dc079[_0xb278('0x49')][_0xb278('0x32')]);_0x23abac['offset']=qs['offset'](_0x2dc079[_0xb278('0x49')][_0xb278('0x33')]);}_0x23abac['order']=qs[_0xb278('0x52')](_0x2dc079[_0xb278('0x49')][_0xb278('0x52')]);_0x23abac[_0xb278('0x53')]=qs[_0xb278('0x4b')](_[_0xb278('0x54')](_0x2dc079[_0xb278('0x49')],_0x3609f8[_0xb278('0x4b')]));_0x23abac['where'][_0xb278('0x6e')]=_0x2830fc['id'];if(_0x2dc079[_0xb278('0x49')][_0xb278('0x55')]){_0x23abac[_0xb278('0x53')]=_['merge'](_0x23abac[_0xb278('0x53')],{'$or':_[_0xb278('0x43')](_0x23abac[_0xb278('0x4f')],function(_0x12242f){var _0x461a9c={};_0x461a9c[_0x12242f]={'$like':'%'+_0x2dc079['query'][_0xb278('0x55')]+'%'};return _0x461a9c;})});}_0x23abac=_[_0xb278('0x56')]({},_0x23abac,_0x2dc079[_0xb278('0x59')]);return db[_0xb278('0x6b')][_0xb278('0x5a')]({'where':_0x23abac[_0xb278('0x53')]})['then'](function(_0x37c894){_0x1f1355['count']=_0x37c894;if(_0x2dc079['query'][_0xb278('0x5b')]){_0x23abac[_0xb278('0x5c')]=[{'all':!![]}];}return db[_0xb278('0x6b')][_0xb278('0x6f')](_0x23abac);})[_0xb278('0x39')](function(_0x2bf10c){_0x1f1355[_0xb278('0x5d')]=_0x2bf10c;return _0x1f1355;});}})[_0xb278('0x39')](respondWithFilteredResult(_0x31591d,_0x23abac))[_0xb278('0x2c')](handleError(_0x31591d,null));};exports[_0xb278('0x70')]=function(_0x1bfa22,_0x564e02,_0x28f7da){return db[_0xb278('0x44')][_0xb278('0x5f')]({'where':{'id':_0x1bfa22['params']['id']}})[_0xb278('0x39')](handleEntityNotFound(_0x564e02,null))[_0xb278('0x39')](function(_0x165236){if(_0x165236){return _0x165236[_0xb278('0x70')](_0x1bfa22[_0xb278('0x49')]['ids']);}})['then'](respondWithStatusCode(_0x564e02,null))[_0xb278('0x2c')](handleError(_0x564e02,null));};exports[_0xb278('0x71')]=function(_0x35857a,_0x4bc240,_0x2af147){if(_0x35857a[_0xb278('0x61')]['id']){delete _0x35857a[_0xb278('0x61')]['id'];}return db[_0xb278('0x44')]['find']({'where':{'id':_0x35857a['params']['id']}})[_0xb278('0x39')](handleEntityNotFound(_0x4bc240,null))[_0xb278('0x39')](function(_0x4fa945){if(_0x4fa945){_0x35857a['body'][_0xb278('0x6e')]=_0x4fa945['id'];return db['CannedAnswer'][_0xb278('0x60')](_0x35857a['body']);}})[_0xb278('0x39')](respondWithResult(_0x4bc240,null))[_0xb278('0x2c')](handleError(_0x4bc240,null));};exports[_0xb278('0x72')]=function(_0x1d14d5,_0xf1591e,_0x19738f){var _0x2f308e={'raw':![],'where':{}};var _0x2021a5={};var _0x8bed22={'count':0x0,'rows':[]};return db['SmsAccount'][_0xb278('0x6c')]({'where':{'id':_0x1d14d5['params']['id']}})[_0xb278('0x39')](handleEntityNotFound(_0xf1591e,null))[_0xb278('0x39')](function(_0x4f90e8){if(_0x4f90e8){_0x2021a5[_0xb278('0x48')]=_['keys'](db[_0xb278('0x73')][_0xb278('0x45')]);_0x2021a5[_0xb278('0x49')]=_[_0xb278('0x4a')](_0x1d14d5[_0xb278('0x49')]);_0x2021a5[_0xb278('0x4b')]=_[_0xb278('0x4c')](_0x2021a5['model'],_0x2021a5[_0xb278('0x49')]);_0x2f308e[_0xb278('0x4f')]=_[_0xb278('0x4c')](_0x2021a5[_0xb278('0x48')],qs[_0xb278('0x4d')](_0x1d14d5['query']['fields']));_0x2f308e[_0xb278('0x4f')]=_0x2f308e['attributes'][_0xb278('0x4e')]?_0x2f308e[_0xb278('0x4f')]:_0x2021a5[_0xb278('0x48')];if(!_0x1d14d5[_0xb278('0x49')][_0xb278('0x50')](_0xb278('0x6d'))){_0x2f308e[_0xb278('0x32')]=qs['limit'](_0x1d14d5['query']['limit']);_0x2f308e[_0xb278('0x33')]=qs['offset'](_0x1d14d5[_0xb278('0x49')]['offset']);}_0x2f308e[_0xb278('0x51')]=qs[_0xb278('0x52')](_0x1d14d5[_0xb278('0x49')][_0xb278('0x52')]);_0x2f308e[_0xb278('0x53')]=qs[_0xb278('0x4b')](_['pick'](_0x1d14d5[_0xb278('0x49')],_0x2021a5['filters']));_0x2f308e['where'][_0xb278('0x6e')]=_0x4f90e8['id'];if(_0x1d14d5[_0xb278('0x49')]['filter']){_0x2f308e[_0xb278('0x53')]=_[_0xb278('0x56')](_0x2f308e[_0xb278('0x53')],{'$or':_[_0xb278('0x43')](_0x2f308e['attributes'],function(_0x653ea3){var _0x3b7d24={};_0x3b7d24[_0x653ea3]={'$like':'%'+_0x1d14d5[_0xb278('0x49')]['filter']+'%'};return _0x3b7d24;})});}_0x2f308e=_[_0xb278('0x56')]({},_0x2f308e,_0x1d14d5[_0xb278('0x59')]);return db[_0xb278('0x73')][_0xb278('0x5a')]({'where':_0x2f308e['where']})['then'](function(_0x38f9a9){_0x8bed22[_0xb278('0x5a')]=_0x38f9a9;if(_0x1d14d5[_0xb278('0x49')][_0xb278('0x5b')]){_0x2f308e[_0xb278('0x5c')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2f308e);})[_0xb278('0x39')](function(_0x10fd93){_0x8bed22[_0xb278('0x5d')]=_0x10fd93;return _0x8bed22;});}})[_0xb278('0x39')](respondWithFilteredResult(_0xf1591e,_0x2f308e))['catch'](handleError(_0xf1591e,null));};exports[_0xb278('0x74')]=function(_0x4dbdc9,_0x4888c0,_0x738ad6){return db[_0xb278('0x44')]['find']({'where':{'id':_0x4dbdc9[_0xb278('0x68')]['id']}})[_0xb278('0x39')](handleEntityNotFound(_0x4888c0,null))[_0xb278('0x39')](function(_0x508bb7){if(_0x508bb7){return _0x508bb7[_0xb278('0x74')](_0x4dbdc9['query'][_0xb278('0x75')]);}})['then'](respondWithStatusCode(_0x4888c0,null))[_0xb278('0x2c')](handleError(_0x4888c0,null));};exports[_0xb278('0x76')]=function(_0x491034,_0x29d559,_0x504e67){var _0x4dd05b={'channel':_0xb278('0x77')};var _0x3fcb2e=[];var _0x28d460=[];var _0x4966f8={};return db[_0xb278('0x44')][_0xb278('0x5f')]({'where':{'id':_0x491034[_0xb278('0x68')]['id']},'include':[{'model':db[_0xb278('0x78')],'as':_0xb278('0x79')}]})[_0xb278('0x39')](handleEntityNotFound(_0x29d559,null))[_0xb278('0x39')](function(_0x372e7f){_0x4dd05b[_0xb278('0x7a')]=_0x372e7f;_0x4dd05b[_0xb278('0x7b')]=_[_0xb278('0x7c')](_0x372e7f['Applications'],[_0xb278('0x7d')],[_0xb278('0x7e')]);if(_0x4dd05b['account'][_0xb278('0x79')]){delete _0x4dd05b[_0xb278('0x7a')][_0xb278('0x79')];}return db[_0xb278('0x7f')][_0xb278('0x69')]();})[_0xb278('0x39')](function(_0x246aa8){if(!_0x246aa8){throw new db[(_0xb278('0x80'))]['ValidationError'](_0xb278('0x81'));}_0x3fcb2e=_[_0xb278('0x82')](_[_0xb278('0x4a')](_0x246aa8),[_0xb278('0x83'),_0xb278('0x84')]);_0x28d460=_[_0xb278('0x82')](_[_0xb278('0x4a')](_0x246aa8),[_0xb278('0x83'),'updatedAt',_0xb278('0x85'),_0xb278('0x86')]);_0x4dd05b[_0xb278('0x61')]={'mapKey':_0xb278('0x87')};if(_0x4dd05b[_0xb278('0x7a')][_0xb278('0x57')]){switch(_0x4dd05b[_0xb278('0x7a')][_0xb278('0x57')]){case _0xb278('0x88'):_0x4dd05b[_0xb278('0x61')]['from']=_0x491034['body']['From'];_0x4dd05b[_0xb278('0x61')]['body']=_0x491034['body'][_0xb278('0x89')];_0x4dd05b[_0xb278('0x61')][_0xb278('0x8a')]=_0x491034[_0xb278('0x61')][_0xb278('0x8b')];break;case _0xb278('0x8c'):_0x4dd05b['body'][_0xb278('0x8d')]='+'+_0x491034[_0xb278('0x61')][_0xb278('0x8e')];_0x4dd05b[_0xb278('0x61')][_0xb278('0x61')]=_0x491034[_0xb278('0x61')][_0xb278('0x8f')];break;case _0xb278('0x90'):_0x4dd05b['body'][_0xb278('0x8d')]=_0x491034[_0xb278('0x61')][_0xb278('0x8d')];_0x4dd05b['body'][_0xb278('0x61')]=_0x491034[_0xb278('0x61')]['message'];break;case'clicksend':_0x4dd05b['body'][_0xb278('0x8d')]=_0x491034['body'][_0xb278('0x8d')];_0x4dd05b['body'][_0xb278('0x61')]=_0x491034[_0xb278('0x61')]['body'];_0x4dd05b['body'][_0xb278('0x8a')]=_0x491034[_0xb278('0x61')]['message_id'];break;case _0xb278('0x91'):_0x4dd05b['body'][_0xb278('0x8d')]=_0x491034[_0xb278('0x61')]['From'];_0x4dd05b[_0xb278('0x61')][_0xb278('0x61')]=_0x491034[_0xb278('0x61')][_0xb278('0x92')];_0x4dd05b[_0xb278('0x61')][_0xb278('0x8a')]=_0x491034[_0xb278('0x61')]['MessageUUID'];break;case'infobip':_0x4dd05b[_0xb278('0x61')]['from']='+'+_0x491034[_0xb278('0x61')][_0xb278('0x93')][0x0][_0xb278('0x8d')];_0x4dd05b[_0xb278('0x61')]['body']=_0x491034['body'][_0xb278('0x93')][0x0][_0xb278('0x8f')];_0x4dd05b[_0xb278('0x61')][_0xb278('0x8a')]=_0x491034[_0xb278('0x61')]['results'][0x0][_0xb278('0x8a')];break;case _0xb278('0x94'):_0x4dd05b[_0xb278('0x61')]['from']=_0x491034[_0xb278('0x61')][_0xb278('0x95')];_0x4dd05b[_0xb278('0x61')][_0xb278('0x61')]=_0x491034[_0xb278('0x61')][_0xb278('0x96')][_0xb278('0x2a')];break;case _0xb278('0x97'):_0x4dd05b[_0xb278('0x61')][_0xb278('0x8d')]=_0x491034[_0xb278('0x61')]['fromNumber'];_0x4dd05b[_0xb278('0x61')][_0xb278('0x61')]=_0x491034['body'][_0xb278('0x8f')];_0x4dd05b[_0xb278('0x61')][_0xb278('0x8a')]=_0x491034[_0xb278('0x61')]['replyMessageId'];break;case _0xb278('0x98'):_0x4dd05b[_0xb278('0x61')][_0xb278('0x8a')]=_0x491034[_0xb278('0x61')][0x0][_0xb278('0x2a')]['id'];_0x4dd05b[_0xb278('0x61')][_0xb278('0x8d')]=_0x491034['body'][0x0][_0xb278('0x2a')][_0xb278('0x8d')];_0x4dd05b[_0xb278('0x61')][_0xb278('0x61')]=_0x491034[_0xb278('0x61')][0x0]['message']['text'];break;case _0xb278('0x99'):_0x4dd05b[_0xb278('0x61')][_0xb278('0x8d')]=_0x491034[_0xb278('0x61')][_0xb278('0x8d')];_0x4dd05b[_0xb278('0x61')][_0xb278('0x61')]=_0x491034[_0xb278('0x61')][_0xb278('0x2a')];_0x4dd05b[_0xb278('0x61')][_0xb278('0x8a')]=_0x491034[_0xb278('0x61')]['refid'];break;}}if(_0x4dd05b[_0xb278('0x61')]['id']){delete _0x4dd05b[_0xb278('0x61')]['id'];}if(_[_0xb278('0x9a')](_0x4dd05b[_0xb278('0x61')]['from'])){throw new db[(_0xb278('0x80'))]['ValidationError'](_0xb278('0x9b'));}if(_[_0xb278('0x9a')](_0x4dd05b[_0xb278('0x61')][_0xb278('0x61')])||_0x4dd05b[_0xb278('0x61')][_0xb278('0x61')]===''){throw new db['Sequelize'][(_0xb278('0x9c'))](_0xb278('0x9d'));}if(_[_0xb278('0x9a')](_0x4dd05b['body'][_0xb278('0x9e')])){throw new db[(_0xb278('0x80'))][(_0xb278('0x9c'))](_0xb278('0x9f')+_0x28d460);}if(!_[_0xb278('0xa0')](_0x28d460,_0x4dd05b[_0xb278('0x61')][_0xb278('0x9e')])){throw new db[(_0xb278('0x80'))][(_0xb278('0x9c'))](_0xb278('0xa1')+_0x28d460);}_0x4966f8[_0x4dd05b[_0xb278('0x61')][_0xb278('0x9e')]]=_0x4dd05b[_0xb278('0x61')][_0xb278('0x8d')];return db[_0xb278('0xa2')][_0xb278('0x5f')]({'where':{'id':_0x4dd05b['account'][_0xb278('0x86')]},'include':[{'model':db[_0xb278('0x7f')],'as':_0xb278('0xa3'),'where':_0x4966f8,'limit':0x1,'order':[['updatedAt',_0xb278('0xa4')]]}]});})[_0xb278('0x39')](handleEntityNotFound(_0x29d559,null))[_0xb278('0x39')](function(_0x39905f){if(_0x39905f){_0x4dd05b[_0xb278('0xa5')]=_[_0xb278('0xa6')](_0x39905f,[_0xb278('0xa3')]);if(_0x39905f['Contacts'][_0xb278('0x4e')]){return _0x39905f[_0xb278('0xa3')][0x0];}var _0x2a04b0=_[_0xb278('0x1b')](_0x4dd05b[_0xb278('0x61')],{'firstName':_0x4dd05b['body'][_0xb278('0x8d')],'ListId':_0x39905f['id']});_0x2a04b0[_0x4dd05b[_0xb278('0x61')]['mapKey']]=_0x4dd05b['body']['from'];return db[_0xb278('0x7f')][_0xb278('0x60')](_0x2a04b0,{'fields':_0x3fcb2e,'raw':!![]});}})['then'](handleEntityNotFound(_0x29d559,null))[_0xb278('0x39')](function(_0x34b5e2){if(_0x34b5e2){_0x4dd05b['contact']=_0x34b5e2;var _0x1cdac8={'ContactId':_0x34b5e2['id'],'phone':_0x4dd05b[_0xb278('0x61')][_0xb278('0x8d')],'SmsAccountId':_0x491034[_0xb278('0x68')]['id']};var _0x3a982c={'ContactId':_0x34b5e2['id'],'SmsAccountId':_0x491034['params']['id'],'closed':![]};return db[_0xb278('0xa7')][_0xb278('0x5f')]({'where':_0x3a982c})[_0xb278('0x39')](function(_0x3b3b77){if(_0x3b3b77){return[_0x3b3b77,![]];}return db[_0xb278('0xa7')]['create'](_0x1cdac8)[_0xb278('0x39')](function(_0x277081){return[_0x277081,!![]];});});}})[_0xb278('0xa8')](function(_0x460f61,_0x23e399){_0x4dd05b['interaction']=_0x460f61[_0xb278('0x3b')]({'plain':!![]});_0x4dd05b[_0xb278('0xa9')]['created']=![];if(_0x23e399){if(_0x4dd05b[_0xb278('0x7a')][_0xb278('0xaa')]){_0x4dd05b[_0xb278('0x7b')][_0xb278('0xab')]({'id':0x0,'priority':_0x4dd05b[_0xb278('0x7b')][_0xb278('0x4e')]+0x1,'app':_0xb278('0xac'),'appdata':_0xb278('0xad'),'interval':_0xb278('0xae')});}_0x4dd05b[_0xb278('0xa9')]['created']=!![];}return db[_0xb278('0xaf')][_0xb278('0x60')]({'phone':_0x4dd05b[_0xb278('0x61')][_0xb278('0x8d')],'messageId':_0x4dd05b[_0xb278('0x61')][_0xb278('0x8a')],'body':_0x4dd05b[_0xb278('0x61')][_0xb278('0x61')],'SmsAccountId':_0x491034[_0xb278('0x68')]['id'],'SmsInteractionId':_0x460f61['id'],'direction':'in','ContactId':_0x460f61[_0xb278('0xb0')],'AttachmentId':_0x4dd05b[_0xb278('0x61')]['AttachmentId']});})[_0xb278('0x39')](function(_0xba30a3){_0x4dd05b[_0xb278('0x2a')]=_0xba30a3;if(_0x4dd05b['interaction'][_0xb278('0xb1')]){return db[_0xb278('0xb2')][_0xb278('0x5f')]({'attributes':['id',_0xb278('0x3e')],'where':{'id':_0x4dd05b[_0xb278('0xa9')]['UserId']}})[_0xb278('0x39')](function(_0xcaea40){if(_0xcaea40){_0x4dd05b[_0xb278('0x7b')][_0xb278('0xb3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xcaea40[_0xb278('0x3e')]+','+(_0x4dd05b[_0xb278('0x7a')][_0xb278('0xb4')]||0xa),'interval':_0xb278('0xae')});}return respondWithRpcPromise(_0xb278('0xb5'),_0xb278('0xb6'),_0x4dd05b);});}return respondWithRpcPromise(_0xb278('0xb5'),_0xb278('0xb6'),_0x4dd05b);})[_0xb278('0x39')](function(_0x17300e){if(_0x17300e){var _0x11a2b9=0xc8;var _0x4ce9c6=_0xb278('0xb7');logger[_0xb278('0x22')](_0xb278('0x25'),_0x4ce9c6,_0x11a2b9,_0xb278('0xb8'));logger['debug'](_0xb278('0xb9'),_0x4ce9c6,_0x11a2b9,'entity\x20found',JSON['stringify'](_0x17300e));if(_0x4dd05b['account']['type']===_0xb278('0x88')){return _0x29d559[_0xb278('0x2e')](_0x11a2b9)['set'](_0xb278('0xba'),_0xb278('0xbb'))[_0xb278('0x3f')]('\x0a');}else{return _0x29d559[_0xb278('0x2e')](_0x11a2b9)[_0xb278('0x30')](_0x17300e);}}})[_0xb278('0x2c')](handleError(_0x29d559,null));};exports[_0xb278('0xbc')]=function(_0x341c8c,_0x4d2316,_0x5b5999){return db[_0xb278('0x44')][_0xb278('0x6c')]({'where':{'id':_0x341c8c[_0xb278('0x68')]['id']}})[_0xb278('0x39')](handleEntityNotFound(_0x4d2316,null))[_0xb278('0x39')](function(_0x21b755){if(_0x21b755){return db['sequelize'][_0xb278('0xbd')](function(_0x34a3d4){return db[_0xb278('0x78')]['destroy']({'where':{'SmsAccountId':_0x341c8c[_0xb278('0x68')]['id']},'transaction':_0x34a3d4})[_0xb278('0x39')](function(_0x59075d){var _0xe56d7c=_[_0xb278('0x43')](_0x341c8c[_0xb278('0x61')],function(_0x23ec1a){_0x23ec1a['SmsAccountId']=_0x341c8c[_0xb278('0x68')]['id'];return _0x23ec1a;});return db[_0xb278('0x78')][_0xb278('0xbe')](_0xe56d7c,{'transaction':_0x34a3d4});});})[_0xb278('0x39')](function(){return db[_0xb278('0x78')][_0xb278('0xbf')]({'where':{'SmsAccountId':_0x341c8c[_0xb278('0x68')]['id']},'order':_0xb278('0x7d')});});}})['then'](respondWithResult(_0x4d2316,null))[_0xb278('0x2c')](handleError(_0x4d2316,null));};exports[_0xb278('0xc0')]=function(_0x2ebe8d,_0x273f76,_0x2aff5b){var _0x108001={};var _0x203708={};var _0x1094e9;var _0x14bc7d;return db['SmsAccount'][_0xb278('0x6c')]({'where':{'id':_0x2ebe8d['params']['id']}})['then'](handleEntityNotFound(_0x273f76,null))[_0xb278('0x39')](function(_0x54d729){if(_0x54d729){_0x1094e9=_0x54d729;_0x203708[_0xb278('0x48')]=_[_0xb278('0x4a')](db[_0xb278('0x78')][_0xb278('0x45')]);_0x203708[_0xb278('0x49')]=_['keys'](_0x2ebe8d['query']);_0x203708[_0xb278('0x4b')]=_['intersection'](_0x203708[_0xb278('0x48')],_0x203708['query']);_0x108001[_0xb278('0x4f')]=_[_0xb278('0x4c')](_0x203708[_0xb278('0x48')],qs[_0xb278('0x4d')](_0x2ebe8d[_0xb278('0x49')][_0xb278('0x4d')]));_0x108001['attributes']=_0x108001['attributes'][_0xb278('0x4e')]?_0x108001['attributes']:_0x203708[_0xb278('0x48')];_0x108001['order']=qs['sort'](_0x2ebe8d[_0xb278('0x49')]['sort']);_0x108001[_0xb278('0x53')]=qs[_0xb278('0x4b')](_[_0xb278('0x54')](_0x2ebe8d[_0xb278('0x49')],_0x203708[_0xb278('0x4b')]));if(_0x2ebe8d['query'][_0xb278('0x55')]){_0x108001[_0xb278('0x53')]=_[_0xb278('0x56')](_0x108001['where'],{'$or':_[_0xb278('0x43')](_0x108001[_0xb278('0x4f')],function(_0x1e4853){var _0x32be76={};_0x32be76[_0x1e4853]={'$like':'%'+_0x2ebe8d['query']['filter']+'%'};return _0x32be76;})});}_0x108001=_['merge']({},_0x108001,_0x2ebe8d[_0xb278('0x59')]);return _0x1094e9[_0xb278('0xc0')](_0x108001);}})[_0xb278('0x39')](function(_0x205449){if(_0x205449){_0x14bc7d=_0x205449[_0xb278('0x4e')];if(!_0x2ebe8d[_0xb278('0x49')][_0xb278('0x50')](_0xb278('0x6d'))){_0x108001['limit']=qs[_0xb278('0x32')](_0x2ebe8d[_0xb278('0x49')]['limit']);_0x108001['offset']=qs[_0xb278('0x33')](_0x2ebe8d['query'][_0xb278('0x33')]);}return _0x1094e9['getApplications'](_0x108001);}})[_0xb278('0x39')](function(_0x31d915){if(_0x31d915){return _0x31d915?{'count':_0x14bc7d,'rows':_0x31d915}:null;}})[_0xb278('0x39')](respondWithResult(_0x273f76,null))[_0xb278('0x2c')](handleError(_0x273f76,null));};exports[_0xb278('0xc1')]=function(_0x159e09,_0x43b6f2,_0x2ef19e){var _0x18ee6d={'raw':![],'where':{}};var _0x540709={};var _0x5da613={'count':0x0,'rows':[]};return db[_0xb278('0x44')][_0xb278('0x6c')]({'where':{'id':_0x159e09['params']['id']}})[_0xb278('0x39')](handleEntityNotFound(_0x43b6f2,null))['then'](function(_0xda8705){if(_0xda8705){_0x540709[_0xb278('0x48')]=_[_0xb278('0x4a')](db[_0xb278('0xa7')][_0xb278('0x45')]);_0x540709[_0xb278('0x49')]=_['keys'](_0x159e09['query']);_0x540709[_0xb278('0x4b')]=_[_0xb278('0x4c')](_0x540709[_0xb278('0x48')],_0x540709[_0xb278('0x49')]);_0x18ee6d[_0xb278('0x4f')]=_['intersection'](_0x540709[_0xb278('0x48')],qs['fields'](_0x159e09['query'][_0xb278('0x4d')]));_0x18ee6d['attributes']=_0x18ee6d[_0xb278('0x4f')][_0xb278('0x4e')]?_0x18ee6d[_0xb278('0x4f')]:_0x540709[_0xb278('0x48')];if(!_0x159e09[_0xb278('0x49')][_0xb278('0x50')](_0xb278('0x6d'))){_0x18ee6d[_0xb278('0x32')]=qs[_0xb278('0x32')](_0x159e09['query']['limit']);_0x18ee6d[_0xb278('0x33')]=qs['offset'](_0x159e09['query']['offset']);}_0x18ee6d['order']=qs[_0xb278('0x52')](_0x159e09[_0xb278('0x49')]['sort']);_0x18ee6d[_0xb278('0x53')]=qs['filters'](_[_0xb278('0x54')](_0x159e09[_0xb278('0x49')],_0x540709[_0xb278('0x4b')]));_0x18ee6d['where'][_0xb278('0x6e')]=_0xda8705['id'];if(_0x159e09['query']['filter']){_0x18ee6d[_0xb278('0x53')]=_['merge'](_0x18ee6d['where'],{'$or':_[_0xb278('0x43')](_0x18ee6d[_0xb278('0x4f')],function(_0x7d8642){var _0x37d817={};_0x37d817[_0x7d8642]={'$like':'%'+_0x159e09[_0xb278('0x49')]['filter']+'%'};return _0x37d817;})});}_0x18ee6d=_[_0xb278('0x56')]({},_0x18ee6d,_0x159e09[_0xb278('0x59')]);return db[_0xb278('0xa7')][_0xb278('0x5a')]({'where':_0x18ee6d[_0xb278('0x53')]})[_0xb278('0x39')](function(_0x3b1b26){_0x5da613[_0xb278('0x5a')]=_0x3b1b26;if(_0x159e09['query'][_0xb278('0x5b')]){_0x18ee6d[_0xb278('0x5c')]=[{'model':db['CmContact'],'as':_0xb278('0xc2'),'required':![]},{'model':db[_0xb278('0xb2')],'as':'Owner','attributes':[_0xb278('0x3e'),_0xb278('0xc3'),_0xb278('0xc4')],'required':![]},{'model':db[_0xb278('0xc5')],'as':'Tags','attributes':['id','name',_0xb278('0xc6')],'where':_0x159e09['query'][_0xb278('0xc7')]?{'id':_0x159e09[_0xb278('0x49')][_0xb278('0xc7')]}:undefined,'required':_0x159e09[_0xb278('0x49')][_0xb278('0xc7')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x18ee6d);})[_0xb278('0x39')](function(_0x3320bf){_0x5da613[_0xb278('0x5d')]=_0x3320bf;return _0x5da613;});}})[_0xb278('0x39')](respondWithFilteredResult(_0x43b6f2,_0x18ee6d))[_0xb278('0x2c')](handleError(_0x43b6f2,null));};exports[_0xb278('0x3f')]=function(_0x32eccc,_0xd11219,_0x33c2a0){var _0x48b909,_0x510daa,_0x59d58b;if(_['isNil'](_0x32eccc[_0xb278('0x61')]['body'])||_0x32eccc[_0xb278('0x61')]['body']===''){throw new db[(_0xb278('0x80'))][(_0xb278('0x9c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb278('0x9a')](_0x32eccc[_0xb278('0x61')]['to'])){throw new db[(_0xb278('0x80'))][(_0xb278('0x9c'))](_0xb278('0xc8'));}_0x48b909=_0x32eccc['body']['to'];return db[_0xb278('0x44')][_0xb278('0x5f')]({'where':{'id':_0x32eccc[_0xb278('0x68')]['id']},'include':[{'model':db['CmList'],'as':_0xb278('0xc9'),'include':[{'model':db['CmContact'],'as':_0xb278('0xa3'),'where':{'mobile':_0x48b909},'limit':0x1,'order':[[_0xb278('0x84'),_0xb278('0xa4')]]}]}]})[_0xb278('0x39')](handleEntityNotFound(_0xd11219,null))[_0xb278('0x39')](function(_0x1ed727){if(_0x1ed727&&_0x1ed727['List']){_0x510daa=_0x1ed727[_0xb278('0x3b')]({'plain':!![]});if(_0x510daa[_0xb278('0xc9')]&&_0x510daa['List'][_0xb278('0xa3')]['length']){return _0x510daa[_0xb278('0xc9')][_0xb278('0xa3')][0x0];}return db[_0xb278('0x7f')][_0xb278('0x60')](_[_0xb278('0x1b')](_0x32eccc[_0xb278('0x61')],{'firstName':_0x48b909,'mobile':_0x48b909,'phone':_0x48b909,'ListId':_0x510daa['ListId']}));}})[_0xb278('0x39')](handleEntityNotFound(_0xd11219,null))[_0xb278('0x39')](function(_0x22fc9a){if(_0x22fc9a){_0x59d58b=_0x22fc9a;return db[_0xb278('0xa7')][_0xb278('0x5f')]({'where':{'ContactId':_0x59d58b['id'],'closed':![],'SmsAccountId':_0x510daa['id']}})['then'](function(_0x2b333a){if(_0x2b333a){return[_0x2b333a,![]];}return db[_0xb278('0xa7')]['create']({'UserId':_0x32eccc[_0xb278('0x62')]['id'],'ContactId':_0x59d58b['id'],'SmsAccountId':_0x510daa['id'],'phone':_0x48b909,'firstMsgDirection':_0xb278('0xca'),'Messages':[_[_0xb278('0x56')](_0x32eccc[_0xb278('0x61')],{'read':![],'body':_0x32eccc[_0xb278('0x61')][_0xb278('0x61')],'phone':_0x48b909,'SmsAccountId':_0x510daa['id'],'UserId':_0x32eccc[_0xb278('0x62')]['id'],'ContactId':_0x59d58b['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xb278('0xcb')}]})[_0xb278('0x39')](function(_0x117726){return[_0x117726,!![]];});});}})[_0xb278('0xa8')](function(_0x3048d1,_0x373b47){if(_0x373b47){return _0x3048d1;}return db[_0xb278('0xaf')][_0xb278('0x60')](_[_0xb278('0x56')](_0x32eccc[_0xb278('0x61')],{'read':![],'body':_0x32eccc[_0xb278('0x61')][_0xb278('0x61')],'phone':_0x48b909,'SmsAccountId':_0x510daa['id'],'SmsInteractionId':_0x3048d1['id'],'UserId':_0x32eccc['user']['id'],'ContactId':_0x59d58b['id']}))['then'](function(_0x4af817){_0x3048d1[_0xb278('0xcc')][_0xb278('0xcb')]=[];_0x3048d1[_0xb278('0xcc')][_0xb278('0xcb')][_0xb278('0xab')](_0x4af817['dataValues']);return _0x3048d1;});})[_0xb278('0x39')](respondWithResult(_0xd11219,null))[_0xb278('0x2c')](handleError(_0xd11219,null));};exports[_0xb278('0x2e')]=function(_0x1fa910,_0x50a378,_0x23d748){if(_0x1fa910[_0xb278('0x61')]['id']){delete _0x1fa910['body']['id'];}var _0x2469e3,_0x5dd469,_0x31cf4c;return db[_0xb278('0x44')][_0xb278('0x5f')]({'where':{'id':_0x1fa910[_0xb278('0x68')]['id']}})[_0xb278('0x39')](handleEntityNotFound(_0x50a378,null))[_0xb278('0x39')](function(_0x4e82cd){if(_0x4e82cd){_0x31cf4c=_0x4e82cd;logger[_0xb278('0x24')](_0xb278('0x25'),'status',_0xb278('0xcd'),_0x4e82cd[_0xb278('0x57')],util[_0xb278('0xce')](_0x1fa910[_0xb278('0x61')],{'showHidden':![],'depth':null}));switch(_0x4e82cd[_0xb278('0x57')]){case _0xb278('0x8c'):if(_0x1fa910[_0xb278('0x61')]['skebby_dispatch_id']&&_0x1fa910[_0xb278('0x61')][_0xb278('0x2e')]){_0x5dd469=_0x1fa910[_0xb278('0x61')][_0xb278('0x2e')];return db['SmsMessage']['find']({'where':{'messageId':_0x1fa910[_0xb278('0x61')]['skebby_dispatch_id']}});}break;case _0xb278('0x90'):if(_0x1fa910['body'][_0xb278('0xcf')]&&_0x1fa910[_0xb278('0x61')][_0xb278('0xd0')]){_0x5dd469=_0x1fa910['body']['statusInt'];return db[_0xb278('0xaf')][_0xb278('0x5f')]({'where':{'messageId':_0x1fa910[_0xb278('0x61')]['requestid']}});}break;case _0xb278('0xd1'):if(_0x1fa910['body'][_0xb278('0xd2')]&&_0x1fa910['body'][_0xb278('0xd3')]){_0x5dd469=_0x1fa910['body'][_0xb278('0xd3')];return db[_0xb278('0xaf')]['find']({'where':{'messageId':_0x1fa910[_0xb278('0x61')][_0xb278('0xd2')]}});}break;case _0xb278('0xd4'):var _0x573a94=_0x1fa910[_0xb278('0x61')][_0xb278('0x93')][0x0];if(_0x573a94[_0xb278('0x8a')]&&_0x573a94[_0xb278('0x2e')][_0xb278('0xd5')]===_0xb278('0xd6')){_0x5dd469=_0x573a94[_0xb278('0x2e')][_0xb278('0xd5')];return db[_0xb278('0xaf')][_0xb278('0x5f')]({'where':{'messageId':_0x573a94[_0xb278('0x8a')]}});}break;case'clickatell':if(_0x1fa910[_0xb278('0x61')][_0xb278('0x8a')]&&_0x1fa910[_0xb278('0x61')]['status']){_0x5dd469=_0x1fa910[_0xb278('0x61')][_0xb278('0x2e')];return db[_0xb278('0xaf')][_0xb278('0x5f')]({'where':{'messageId':_0x1fa910[_0xb278('0x61')][_0xb278('0x8a')]}});}break;case _0xb278('0x98'):if(_0x1fa910['body'][0x0][_0xb278('0x2a')]['id']){_0x5dd469=_0x1fa910['body'][0x0][_0xb278('0x57')];return db[_0xb278('0xaf')][_0xb278('0x5f')]({'where':{'messageId':_0x1fa910[_0xb278('0x61')][0x0][_0xb278('0x2a')]['id']}});}break;case'intelepeer':if(_0x1fa910[_0xb278('0x61')][_0xb278('0xd7')]&&_0x1fa910[_0xb278('0x61')][_0xb278('0x2e')]){_0x5dd469=_0x1fa910[_0xb278('0x61')][_0xb278('0x2e')];return db[_0xb278('0xaf')][_0xb278('0x5f')]({'where':{'messageId':_0x1fa910[_0xb278('0x61')][_0xb278('0xd7')]}});}break;}}})[_0xb278('0x39')](handleEntityNotFound(_0x50a378,null))[_0xb278('0x39')](function(_0x5f4ef3){if(_0x5f4ef3){_0x2469e3=_0x5f4ef3;switch(_0x31cf4c[_0xb278('0x57')]){case'skebby':if(_0x5dd469===_0xb278('0xd6')){return _0x2469e3[_0xb278('0x38')]({'read':!![]});}else{logger[_0xb278('0x27')](_0xb278('0x25'),'status',_0xb278('0x8c'),util[_0xb278('0xce')](_0x1fa910['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x5dd469==='1'){return _0x2469e3['update']({'read':!![]});}else{logger[_0xb278('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb278('0x2e'),_0xb278('0x8c'),util[_0xb278('0xce')](_0x1fa910[_0xb278('0x61')],{'showHidden':![],'depth':null}));}break;case _0xb278('0xd1'):if(!_0x1fa910[_0xb278('0x61')]['error_code']&&_0x5dd469>=0xc8&&_0x5dd469<=0xce){return _0x2469e3[_0xb278('0x38')]({'read':!![]});}else{logger[_0xb278('0x27')](_0xb278('0x25'),_0xb278('0x2e'),_0xb278('0xd1'),util[_0xb278('0xce')](_0x1fa910[_0xb278('0x61')],{'showHidden':![],'depth':null}));}break;case _0xb278('0xd4'):var _0x160b23=_0x1fa910['body'][_0xb278('0x93')][0x0];if(_0x160b23[_0xb278('0x2e')][_0xb278('0xd5')]==='DELIVERED'){return _0x2469e3[_0xb278('0x38')]({'read':!![]});}else{logger[_0xb278('0x27')](_0xb278('0x25'),'status',_0xb278('0xd4'),util[_0xb278('0xce')](_0x1fa910[_0xb278('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5dd469==_0xb278('0xd8')||_0x5dd469=='RECEIVED_BY_RECIPIENT'){return _0x2469e3[_0xb278('0x38')]({'read':!![]});}else{logger[_0xb278('0x27')](_0xb278('0x25'),_0xb278('0x2e'),'clickatell',util['inspect'](_0x1fa910[_0xb278('0x61')],{'showHidden':![],'depth':null}));}break;case _0xb278('0x98'):if(_0x5dd469==_0xb278('0xd9')){return _0x2469e3[_0xb278('0x38')]({'read':!![]});}else{logger[_0xb278('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb278('0x2e'),_0xb278('0x98'),util['inspect'](_0x1fa910[_0xb278('0x61')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x5dd469===_0xb278('0xda')||_0x5dd469===_0xb278('0xdb')){return _0x2469e3['update']({'read':!![]});}else{logger[_0xb278('0x27')](_0xb278('0x25'),_0xb278('0x2e'),_0xb278('0x99'),util[_0xb278('0xce')](_0x1fa910[_0xb278('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x2469e3;}})[_0xb278('0x39')](respondWithResult(_0x50a378,null))[_0xb278('0x2c')](handleError(_0x50a378,null));};exports[_0xb278('0xdc')]=function(_0x220564,_0x2c827e,_0x4170bd){var _0x2dd6d4,_0x23c617,_0x11f5ba;return db[_0xb278('0x44')][_0xb278('0x5f')]({'where':{'id':_0x220564['params']['id']}})[_0xb278('0x39')](handleEntityNotFound(_0x2c827e,null))[_0xb278('0x39')](function(_0x4a7feb){if(_0x4a7feb){_0x11f5ba=_0x4a7feb;logger[_0xb278('0x24')](_0xb278('0x25'),_0xb278('0x2e'),_0xb278('0xcd'),_0x4a7feb['type'],util[_0xb278('0xce')](_0x220564['query'],{'showHidden':![],'depth':null}));switch(_0x4a7feb[_0xb278('0x57')]){case _0xb278('0x94'):if(_0x220564['query']['message-id']&&_0x220564[_0xb278('0x49')][_0xb278('0xdd')]){_0x23c617=_0x220564[_0xb278('0x49')][_0xb278('0xdd')];return db[_0xb278('0xaf')][_0xb278('0x5f')]({'where':{'messageId':_0x220564[_0xb278('0x49')][_0xb278('0xde')]}});}break;}}})['then'](handleEntityNotFound(_0x2c827e,null))[_0xb278('0x39')](function(_0x1d87fd){if(_0x1d87fd){_0x2dd6d4=_0x1d87fd;switch(_0x11f5ba[_0xb278('0x57')]){case _0xb278('0x94'):if(_0x23c617==='2'||_0x23c617==='6'){return _0x2dd6d4[_0xb278('0x38')]({'read':!![]});}else{logger[_0xb278('0x27')](_0xb278('0x25'),_0xb278('0x2e'),'csc',util['inspect'](_0x220564['query'],{'showHidden':![],'depth':null}));};break;}return _0x2dd6d4;}})[_0xb278('0x39')](respondWithResult(_0x2c827e,null))['catch'](handleError(_0x2c827e,null));};exports['addAgents']=function(_0x9d19c9,_0x3608f2,_0x1bd063){return db[_0xb278('0x44')][_0xb278('0x5f')]({'where':{'id':_0x9d19c9[_0xb278('0x68')]['id']}})[_0xb278('0x39')](handleEntityNotFound(_0x3608f2,null))[_0xb278('0x39')](function(_0x3866d6){if(_0x3866d6){return _0x3866d6[_0xb278('0xdf')](_0x9d19c9['body']['ids'],_[_0xb278('0xa6')](_0x9d19c9[_0xb278('0x61')],[_0xb278('0x75'),'id'])||{})[_0xb278('0xa8')](function(_0x16875f){for(var _0x3f08f6=0x0;_0x3f08f6<_0x9d19c9['body'][_0xb278('0x75')][_0xb278('0x4e')];_0x3f08f6+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x9d19c9['body'][_0xb278('0x75')][_0x3f08f6]),'SmsAccountId':Number(_0x9d19c9[_0xb278('0x68')]['id'])});}return _0x16875f;});}})[_0xb278('0x39')](respondWithResult(_0x3608f2,null))[_0xb278('0x2c')](handleError(_0x3608f2,null));};exports['removeAgents']=function(_0x33afd8,_0x5b1d36,_0x4aa886){return db['SmsAccount'][_0xb278('0x5f')]({'where':{'id':_0x33afd8[_0xb278('0x68')]['id']}})['then'](handleEntityNotFound(_0x5b1d36,null))['then'](function(_0x95299e){if(_0x95299e){return _0x95299e[_0xb278('0xe0')](_0x33afd8[_0xb278('0x49')][_0xb278('0x75')])[_0xb278('0x39')](function(){if(_[_0xb278('0xe1')](_0x33afd8[_0xb278('0x49')][_0xb278('0x75')])){for(var _0xfb6fba=0x0;_0xfb6fba<_0x33afd8[_0xb278('0x49')][_0xb278('0x75')]['length'];_0xfb6fba+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x33afd8['query'][_0xb278('0x75')][_0xfb6fba]),'SmsAccountId':Number(_0x33afd8['params']['id'])});}}else{socket['emit'](_0xb278('0xe2'),{'UserId':Number(_0x33afd8['query'][_0xb278('0x75')]),'SmsAccountId':Number(_0x33afd8[_0xb278('0x68')]['id'])});}});}})[_0xb278('0x39')](respondWithStatusCode(_0x5b1d36,null))[_0xb278('0x2c')](handleError(_0x5b1d36,null));};exports['getAgents']=function(_0x4bd371,_0x6e6295,_0x301c0b){var _0x358275={};var _0x155356={};var _0x1d1945;var _0xb80f9c;return db['SmsAccount'][_0xb278('0x6c')]({'where':{'id':_0x4bd371[_0xb278('0x68')]['id']}})[_0xb278('0x39')](handleEntityNotFound(_0x6e6295,null))['then'](function(_0x535a45){if(_0x535a45){_0x1d1945=_0x535a45;_0x155356[_0xb278('0x48')]=_[_0xb278('0x4a')](db['User'][_0xb278('0x45')]);_0x155356[_0xb278('0x49')]=_['keys'](_0x4bd371[_0xb278('0x49')]);_0x155356[_0xb278('0x4b')]=_[_0xb278('0x4c')](_0x155356[_0xb278('0x48')],_0x155356[_0xb278('0x49')]);_0x358275[_0xb278('0x4f')]=_[_0xb278('0x4c')](_0x155356[_0xb278('0x48')],qs[_0xb278('0x4d')](_0x4bd371[_0xb278('0x49')][_0xb278('0x4d')]));_0x358275[_0xb278('0x4f')]=_0x358275['attributes']['length']?_0x358275[_0xb278('0x4f')]:_0x155356['model'];_0x358275[_0xb278('0x51')]=qs[_0xb278('0x52')](_0x4bd371['query'][_0xb278('0x52')]);_0x358275[_0xb278('0x53')]=qs[_0xb278('0x4b')](_[_0xb278('0x54')](_0x4bd371[_0xb278('0x49')],_0x155356['filters']));if(_0x4bd371[_0xb278('0x49')][_0xb278('0x55')]){_0x358275[_0xb278('0x53')]=_[_0xb278('0x56')](_0x358275['where'],{'$or':_[_0xb278('0x43')](_0x358275[_0xb278('0x4f')],function(_0x30ed7b){var _0x5e378e={};_0x5e378e[_0x30ed7b]={'$like':'%'+_0x4bd371['query'][_0xb278('0x55')]+'%'};return _0x5e378e;})});}_0x358275=_[_0xb278('0x56')]({},_0x358275,_0x4bd371[_0xb278('0x59')]);return _0x1d1945['getAgents'](_0x358275);}})[_0xb278('0x39')](function(_0x32faa3){if(_0x32faa3){_0xb80f9c=_0x32faa3['length'];if(!_0x4bd371['query'][_0xb278('0x50')]('nolimit')){_0x358275[_0xb278('0x32')]=qs[_0xb278('0x32')](_0x4bd371['query'][_0xb278('0x32')]);_0x358275[_0xb278('0x33')]=qs[_0xb278('0x33')](_0x4bd371[_0xb278('0x49')][_0xb278('0x33')]);}return _0x1d1945[_0xb278('0xe3')](_0x358275);}})[_0xb278('0x39')](function(_0x3bdb8b){if(_0x3bdb8b){return _0x3bdb8b?{'count':_0xb80f9c,'rows':_0x3bdb8b}:null;}})['then'](respondWithResult(_0x6e6295,null))[_0xb278('0x2c')](handleError(_0x6e6295,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 47dfd20..f58eb4e 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 _0x10f1=['setMaxListeners','save','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x10f1,0xa6));var _0x110f=function(_0x5de7d9,_0x5ebc1f){_0x5de7d9=_0x5de7d9-0x0;var _0x562d52=_0x10f1[_0x5de7d9];return _0x562d52;};'use strict';var EventEmitter=require(_0x110f('0x0'));var SmsAccount=require(_0x110f('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x110f('0x2')](0x0);var events={'afterCreate':_0x110f('0x3'),'afterUpdate':'update','afterDestroy':_0x110f('0x4')};function emitEvent(_0x1d63c5){return function(_0x45ea4a,_0x424e11,_0x456616){SmsAccountEvents['emit'](_0x1d63c5+':'+_0x45ea4a['id'],_0x45ea4a);SmsAccountEvents['emit'](_0x1d63c5,_0x45ea4a);_0x456616(null);};}for(var e in events){if(events[_0x110f('0x5')](e)){var event=events[e];SmsAccount[_0x110f('0x6')](e,emitEvent(event));}}module[_0x110f('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0xd2e4=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x251fa4,_0x3d5860){var _0x453047=function(_0x337a6f){while(--_0x337a6f){_0x251fa4['push'](_0x251fa4['shift']());}};_0x453047(++_0x3d5860);}(_0xd2e4,0x153));var _0x4d2e=function(_0x297cb6,_0x2bf84e){_0x297cb6=_0x297cb6-0x0;var _0x5dc0b8=_0xd2e4[_0x297cb6];return _0x5dc0b8;};'use strict';var EventEmitter=require(_0x4d2e('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4d2e('0x1')](0x0);var events={'afterCreate':_0x4d2e('0x2'),'afterUpdate':_0x4d2e('0x3'),'afterDestroy':_0x4d2e('0x4')};function emitEvent(_0x1ceb6d){return function(_0x1fed13,_0x3ddbca,_0x5a862b){SmsAccountEvents['emit'](_0x1ceb6d+':'+_0x1fed13['id'],_0x1fed13);SmsAccountEvents['emit'](_0x1ceb6d,_0x1fed13);_0x5a862b(null);};}for(var e in events){if(events[_0x4d2e('0x5')](e)){var event=events[e];SmsAccount[_0x4d2e('0x6')](e,emitEvent(event));}}module[_0x4d2e('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 b1b7895..967e5f9 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 _0x0c14=['./smsAccount.attributes','define','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5322a8,_0x4633bc){var _0x1e86da=function(_0x16954f){while(--_0x16954f){_0x5322a8['push'](_0x5322a8['shift']());}};_0x1e86da(++_0x4633bc);}(_0x0c14,0x183));var _0x40c1=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x0c14[_0x75f869];return _0x10af8b;};'use strict';var _=require(_0x40c1('0x0'));var util=require(_0x40c1('0x1'));var logger=require(_0x40c1('0x2'))(_0x40c1('0x3'));var moment=require(_0x40c1('0x4'));var BPromise=require(_0x40c1('0x5'));var rp=require(_0x40c1('0x6'));var fs=require('fs');var path=require(_0x40c1('0x7'));var rimraf=require('rimraf');var config=require(_0x40c1('0x8'));var attributes=require(_0x40c1('0x9'));module['exports']=function(_0x55cf37,_0x295026){return _0x55cf37[_0x40c1('0xa')]('SmsAccount',attributes,{'tableName':_0x40c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea26=['moment','bluebird','request-promise','path','rimraf','exports','define','SmsAccount','sms_accounts','lodash','../../config/logger','api'];(function(_0x315011,_0x3dfb3e){var _0x569d4b=function(_0x31dda7){while(--_0x31dda7){_0x315011['push'](_0x315011['shift']());}};_0x569d4b(++_0x3dfb3e);}(_0xea26,0x8d));var _0x6ea2=function(_0x38a4c1,_0x293c9a){_0x38a4c1=_0x38a4c1-0x0;var _0x14a666=_0xea26[_0x38a4c1];return _0x14a666;};'use strict';var _=require(_0x6ea2('0x0'));var util=require('util');var logger=require(_0x6ea2('0x1'))(_0x6ea2('0x2'));var moment=require(_0x6ea2('0x3'));var BPromise=require(_0x6ea2('0x4'));var rp=require(_0x6ea2('0x5'));var fs=require('fs');var path=require(_0x6ea2('0x6'));var rimraf=require(_0x6ea2('0x7'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x6ea2('0x8')]=function(_0x327ecb,_0x17d75b){return _0x327ecb[_0x6ea2('0x9')](_0x6ea2('0xa'),attributes,{'tableName':_0x6ea2('0xb'),'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 833d6dc..b6fe842 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 _0xe298=['model','then','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map'];(function(_0x1f7f94,_0x8a78ee){var _0x2ef7b3=function(_0x5316fd){while(--_0x5316fd){_0x1f7f94['push'](_0x1f7f94['shift']());}};_0x2ef7b3(++_0x8a78ee);}(_0xe298,0xe6));var _0x8e29=function(_0x42a5e4,_0x2ccfb6){_0x42a5e4=_0x42a5e4-0x0;var _0xd56657=_0xe298[_0x42a5e4];return _0xd56657;};'use strict';var _=require(_0x8e29('0x0'));var util=require(_0x8e29('0x1'));var moment=require(_0x8e29('0x2'));var BPromise=require(_0x8e29('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e29('0x4'))['db'];var utils=require(_0x8e29('0x5'));var logger=require(_0x8e29('0x6'))(_0x8e29('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e29('0x8'));var client=jayson[_0x8e29('0x9')][_0x8e29('0xa')]({'port':0x232a});config[_0x8e29('0xb')]=_[_0x8e29('0xc')](config[_0x8e29('0xb')],{'host':_0x8e29('0xd'),'port':0x18eb});var socket=require(_0x8e29('0xe'))(new Redis(config[_0x8e29('0xb')]));require(_0x8e29('0xf'))[_0x8e29('0x10')](socket);function respondWithRpcPromise(_0x23270d,_0x94595b,_0x3fd3ff){return new BPromise(function(_0x5e7777,_0x4d08da){return client[_0x8e29('0x11')](_0x23270d,_0x3fd3ff)['then'](function(_0x7f6c6d){logger[_0x8e29('0x12')](_0x8e29('0x13'),_0x94595b,_0x8e29('0x14'));logger[_0x8e29('0x15')](_0x8e29('0x16'),_0x94595b,'request\x20sent',JSON[_0x8e29('0x17')](_0x7f6c6d));if(_0x7f6c6d[_0x8e29('0x18')]){if(_0x7f6c6d[_0x8e29('0x18')]['code']===0x1f4){logger['error'](_0x8e29('0x13'),_0x94595b,_0x7f6c6d[_0x8e29('0x18')][_0x8e29('0x19')]);return _0x4d08da(_0x7f6c6d[_0x8e29('0x18')][_0x8e29('0x19')]);}logger[_0x8e29('0x18')](_0x8e29('0x13'),_0x94595b,_0x7f6c6d[_0x8e29('0x18')][_0x8e29('0x19')]);return _0x5e7777(_0x7f6c6d[_0x8e29('0x18')]['message']);}else{logger[_0x8e29('0x12')](_0x8e29('0x13'),_0x94595b,'request\x20sent');_0x5e7777(_0x7f6c6d[_0x8e29('0x1a')][_0x8e29('0x19')]);}})[_0x8e29('0x1b')](function(_0x5853ba){logger[_0x8e29('0x18')]('SmsAccount,\x20%s,\x20%s',_0x94595b,_0x5853ba);_0x4d08da(_0x5853ba);});});}exports[_0x8e29('0x1c')]=function(_0x2c5558){var _0x27972c=this;return new Promise(function(_0x4efc58,_0x613852){return db[_0x8e29('0x1d')][_0x8e29('0x1e')]({'raw':_0x2c5558[_0x8e29('0x1f')]?_0x2c5558[_0x8e29('0x1f')][_0x8e29('0x20')]===undefined?!![]:![]:!![],'where':_0x2c5558['options']?_0x2c5558[_0x8e29('0x1f')]['where']||null:null,'attributes':_0x2c5558[_0x8e29('0x1f')]?_0x2c5558[_0x8e29('0x1f')][_0x8e29('0x21')]||null:null,'include':_0x2c5558[_0x8e29('0x1f')]?_0x2c5558[_0x8e29('0x1f')][_0x8e29('0x22')]?_[_0x8e29('0x23')](_0x2c5558[_0x8e29('0x1f')][_0x8e29('0x22')],function(_0x1aef5b){return{'model':db[_0x1aef5b[_0x8e29('0x24')]],'as':_0x1aef5b['as'],'attributes':_0x1aef5b[_0x8e29('0x21')],'include':_0x1aef5b[_0x8e29('0x22')]?_['map'](_0x1aef5b[_0x8e29('0x22')],function(_0x44d3f4){return{'model':db[_0x44d3f4[_0x8e29('0x24')]],'as':_0x44d3f4['as'],'attributes':_0x44d3f4[_0x8e29('0x21')],'include':_0x44d3f4[_0x8e29('0x22')]?_[_0x8e29('0x23')](_0x44d3f4[_0x8e29('0x22')],function(_0x49450d){return{'model':db[_0x49450d[_0x8e29('0x24')]],'as':_0x49450d['as'],'attributes':_0x49450d[_0x8e29('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8e29('0x25')](function(_0x13eeca){logger[_0x8e29('0x12')](_0x8e29('0x1c'),_0x2c5558);logger[_0x8e29('0x15')](_0x8e29('0x1c'),_0x2c5558,JSON[_0x8e29('0x17')](_0x13eeca));_0x4efc58(_0x13eeca);})[_0x8e29('0x1b')](function(_0x99441f){logger['error']('ShowSmsAccount',_0x99441f[_0x8e29('0x19')],_0x2c5558);_0x613852(_0x27972c['error'](0x1f4,_0x99441f[_0x8e29('0x19')]));});});}; \ No newline at end of file +var _0x86f6=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ShowSmsAccount','SmsAccount','options','where','attributes','include','map','model'];(function(_0x3e3c6d,_0x43273c){var _0x1429e2=function(_0x4b9131){while(--_0x4b9131){_0x3e3c6d['push'](_0x3e3c6d['shift']());}};_0x1429e2(++_0x43273c);}(_0x86f6,0x130));var _0x686f=function(_0x148390,_0x292dd1){_0x148390=_0x148390-0x0;var _0x2327d8=_0x86f6[_0x148390];return _0x2327d8;};'use strict';var _=require(_0x686f('0x0'));var util=require(_0x686f('0x1'));var moment=require(_0x686f('0x2'));var BPromise=require(_0x686f('0x3'));var rs=require(_0x686f('0x4'));var fs=require('fs');var Redis=require(_0x686f('0x5'));var db=require(_0x686f('0x6'))['db'];var utils=require(_0x686f('0x7'));var logger=require('../../config/logger')(_0x686f('0x8'));var config=require(_0x686f('0x9'));var jayson=require(_0x686f('0xa'));var client=jayson[_0x686f('0xb')][_0x686f('0xc')]({'port':0x232a});config[_0x686f('0xd')]=_[_0x686f('0xe')](config['redis'],{'host':_0x686f('0xf'),'port':0x18eb});var socket=require(_0x686f('0x10'))(new Redis(config[_0x686f('0xd')]));require('./smsAccount.socket')[_0x686f('0x11')](socket);function respondWithRpcPromise(_0x2228ca,_0x2ce6ea,_0xfc7934){return new BPromise(function(_0xcc0eee,_0x30ca07){return client[_0x686f('0x12')](_0x2228ca,_0xfc7934)[_0x686f('0x13')](function(_0x37865c){logger['info'](_0x686f('0x14'),_0x2ce6ea,_0x686f('0x15'));logger[_0x686f('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2ce6ea,_0x686f('0x15'),JSON[_0x686f('0x17')](_0x37865c));if(_0x37865c['error']){if(_0x37865c[_0x686f('0x18')][_0x686f('0x19')]===0x1f4){logger[_0x686f('0x18')]('SmsAccount,\x20%s,\x20%s',_0x2ce6ea,_0x37865c[_0x686f('0x18')]['message']);return _0x30ca07(_0x37865c[_0x686f('0x18')][_0x686f('0x1a')]);}logger[_0x686f('0x18')](_0x686f('0x14'),_0x2ce6ea,_0x37865c['error'][_0x686f('0x1a')]);return _0xcc0eee(_0x37865c[_0x686f('0x18')]['message']);}else{logger[_0x686f('0x1b')](_0x686f('0x14'),_0x2ce6ea,_0x686f('0x15'));_0xcc0eee(_0x37865c[_0x686f('0x1c')][_0x686f('0x1a')]);}})[_0x686f('0x1d')](function(_0x1d9d4c){logger[_0x686f('0x18')](_0x686f('0x14'),_0x2ce6ea,_0x1d9d4c);_0x30ca07(_0x1d9d4c);});});}exports[_0x686f('0x1e')]=function(_0xd43794){var _0x25387b=this;return new Promise(function(_0x21e2af,_0x55c319){return db[_0x686f('0x1f')]['find']({'raw':_0xd43794[_0x686f('0x20')]?_0xd43794[_0x686f('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0xd43794[_0x686f('0x20')]?_0xd43794[_0x686f('0x20')][_0x686f('0x21')]||null:null,'attributes':_0xd43794['options']?_0xd43794[_0x686f('0x20')][_0x686f('0x22')]||null:null,'include':_0xd43794[_0x686f('0x20')]?_0xd43794['options'][_0x686f('0x23')]?_[_0x686f('0x24')](_0xd43794[_0x686f('0x20')]['include'],function(_0x217fb3){return{'model':db[_0x217fb3['model']],'as':_0x217fb3['as'],'attributes':_0x217fb3[_0x686f('0x22')],'include':_0x217fb3[_0x686f('0x23')]?_['map'](_0x217fb3['include'],function(_0x45c379){return{'model':db[_0x45c379[_0x686f('0x25')]],'as':_0x45c379['as'],'attributes':_0x45c379[_0x686f('0x22')],'include':_0x45c379[_0x686f('0x23')]?_[_0x686f('0x24')](_0x45c379[_0x686f('0x23')],function(_0x52a58e){return{'model':db[_0x52a58e['model']],'as':_0x52a58e['as'],'attributes':_0x52a58e[_0x686f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x686f('0x13')](function(_0x2343c4){logger[_0x686f('0x1b')](_0x686f('0x1e'),_0xd43794);logger[_0x686f('0x16')](_0x686f('0x1e'),_0xd43794,JSON[_0x686f('0x17')](_0x2343c4));_0x21e2af(_0x2343c4);})[_0x686f('0x1d')](function(_0x4a5d80){logger[_0x686f('0x18')](_0x686f('0x1e'),_0x4a5d80['message'],_0xd43794);_0x55c319(_0x25387b[_0x686f('0x18')](0x1f4,_0x4a5d80[_0x686f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 7897b71..2632967 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 d20ec1e..eca642c 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x2b7f9e,_0x18b8e9){var _0x563f90=function(_0x21758b){while(--_0x21758b){_0x2b7f9e['push'](_0x2b7f9e['shift']());}};_0x563f90(++_0x18b8e9);}(_0xe14b,0x93));var _0xbe14=function(_0x2de700,_0x4075ba){_0x2de700=_0x2de700-0x0;var _0x3429f1=_0xe14b[_0x2de700];return _0x3429f1;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x1abfac,_0x45ae54){var _0x2f97e6=function(_0xa0fce4){while(--_0xa0fce4){_0x1abfac['push'](_0x1abfac['shift']());}};_0x2f97e6(++_0x45ae54);}(_0x3e74,0x175));var _0x43e7=function(_0x3d4c2f,_0x2c62b9){_0x3d4c2f=_0x3d4c2f-0x0;var _0x290eb8=_0x3e74[_0x3d4c2f];return _0x290eb8;};'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 1a8fbe3..936af0a 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 _0x933b=['TEXT','sequelize','STRING'];(function(_0x3d189d,_0x49e706){var _0xf1c570=function(_0x5e6fb1){while(--_0x5e6fb1){_0x3d189d['push'](_0x3d189d['shift']());}};_0xf1c570(++_0x49e706);}(_0x933b,0x1ae));var _0xb933=function(_0x16e409,_0x8e683b){_0x16e409=_0x16e409-0x0;var _0x27135b=_0x933b[_0x16e409];return _0x27135b;};'use strict';var Sequelize=require(_0xb933('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb933('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb933('0x2')]()},'description':{'type':Sequelize[_0xb933('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2a5e=['sequelize','exports','STRING','noop','*,*,*,*'];(function(_0x1657c0,_0x2e07e5){var _0x40912a=function(_0x31a217){while(--_0x31a217){_0x1657c0['push'](_0x1657c0['shift']());}};_0x40912a(++_0x2e07e5);}(_0x2a5e,0x118));var _0xe2a5=function(_0xe951ee,_0x163039){_0xe951ee=_0xe951ee-0x0;var _0x42fc51=_0x2a5e[_0xe951ee];return _0x42fc51;};'use strict';var Sequelize=require(_0xe2a5('0x0'));module[_0xe2a5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe2a5('0x2')],'allowNull':![],'defaultValue':_0xe2a5('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe2a5('0x2')]},'interval':{'type':Sequelize[_0xe2a5('0x2')],'defaultValue':_0xe2a5('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index fbdef8c..6bbe558 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 _0x3ba2=['includeAll','include','findAll','catch','show','params','intersection','find','create','body','update','destroy','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','save','then','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','order','sort','where','pick','filter','merge','options'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3ba2,0x147));var _0x23ba=function(_0x528dd7,_0x44e21c){_0x528dd7=_0x528dd7-0x0;var _0x5109ed=_0x3ba2[_0x528dd7];return _0x5109ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23ba('0x0'));var zipdir=require(_0x23ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23ba('0x2'));var moment=require(_0x23ba('0x3'));var BPromise=require(_0x23ba('0x4'));var Mustache=require('mustache');var util=require(_0x23ba('0x5'));var path=require(_0x23ba('0x6'));var sox=require('sox');var csv=require(_0x23ba('0x7'));var ejs=require(_0x23ba('0x8'));var fs=require('fs');var fs_extra=require(_0x23ba('0x9'));var _=require('lodash');var squel=require(_0x23ba('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x23ba('0xb'));var toCsv=require('to-csv');var querystring=require(_0x23ba('0xc'));var Papa=require(_0x23ba('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x23ba('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x23ba('0xf'));var utils=require(_0x23ba('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x23ba('0x11'))['db'];function respondWithStatusCode(_0x4371df,_0x1c7821){_0x1c7821=_0x1c7821||0xcc;return function(_0xd58ba6){if(_0xd58ba6){return _0x4371df[_0x23ba('0x12')](_0x1c7821);}return _0x4371df[_0x23ba('0x13')](_0x1c7821)['end']();};}function respondWithResult(_0x404a7f,_0x497515){_0x497515=_0x497515||0xc8;return function(_0x3eb221){if(_0x3eb221){return _0x404a7f['status'](_0x497515)['json'](_0x3eb221);}};}function respondWithFilteredResult(_0x164b64,_0x4c3bfb){return function(_0x5b44d1){if(_0x5b44d1){var _0x447526=typeof _0x4c3bfb[_0x23ba('0x14')]===_0x23ba('0x15')&&typeof _0x4c3bfb[_0x23ba('0x16')]===_0x23ba('0x15');var _0x3cc567=_0x5b44d1['count'];var _0x4ad629=_0x447526?0x0:_0x4c3bfb[_0x23ba('0x14')];var _0x3776ff=_0x447526?_0x5b44d1['count']:_0x4c3bfb[_0x23ba('0x14')]+_0x4c3bfb[_0x23ba('0x16')];var _0x3049df;if(_0x3776ff>=_0x3cc567){_0x3776ff=_0x3cc567;_0x3049df=0xc8;}else{_0x3049df=0xce;}_0x164b64[_0x23ba('0x13')](_0x3049df);return _0x164b64['set']('Content-Range',_0x4ad629+'-'+_0x3776ff+'/'+_0x3cc567)['json'](_0x5b44d1);}return null;};}function patchUpdates(_0x117ced){return function(_0xc28276){try{jsonpatch['apply'](_0xc28276,_0x117ced,!![]);}catch(_0x48e484){return BPromise['reject'](_0x48e484);}return _0xc28276[_0x23ba('0x17')]();};}function saveUpdates(_0x5e6d45,_0x2e43c7){return function(_0x20fade){if(_0x20fade){return _0x20fade['update'](_0x5e6d45)[_0x23ba('0x18')](function(_0x10aa86){return _0x10aa86;});}return null;};}function removeEntity(_0x2db9dd,_0x412f4f){return function(_0x4cb83e){if(_0x4cb83e){return _0x4cb83e['destroy']()[_0x23ba('0x18')](function(){_0x2db9dd[_0x23ba('0x13')](0xcc)[_0x23ba('0x19')]();});}};}function handleEntityNotFound(_0x2b6d1d,_0x17e058){return function(_0x29784a){if(!_0x29784a){_0x2b6d1d[_0x23ba('0x12')](0x194);}return _0x29784a;};}function handleError(_0x13b055,_0x39904e){_0x39904e=_0x39904e||0x1f4;return function(_0x408f9c){logger[_0x23ba('0x1a')](_0x408f9c[_0x23ba('0x1b')]);if(_0x408f9c['name']){delete _0x408f9c[_0x23ba('0x1c')];}_0x13b055['status'](_0x39904e)[_0x23ba('0x1d')](_0x408f9c);};}exports[_0x23ba('0x1e')]=function(_0x3c1096,_0x56539e){var _0x4aa51e={},_0x1031ca={},_0x49c427={'count':0x0,'rows':[]};var _0x4c710f=_[_0x23ba('0x1f')](db[_0x23ba('0x20')][_0x23ba('0x21')],function(_0x150cc9){return{'name':_0x150cc9[_0x23ba('0x22')],'type':_0x150cc9[_0x23ba('0x23')][_0x23ba('0x24')]};});_0x1031ca[_0x23ba('0x25')]=_[_0x23ba('0x1f')](_0x4c710f,_0x23ba('0x1c'));_0x1031ca[_0x23ba('0x26')]=_[_0x23ba('0x27')](_0x3c1096[_0x23ba('0x26')]);_0x1031ca[_0x23ba('0x28')]=_['intersection'](_0x1031ca[_0x23ba('0x25')],_0x1031ca['query']);_0x4aa51e[_0x23ba('0x29')]=_['intersection'](_0x1031ca[_0x23ba('0x25')],qs[_0x23ba('0x2a')](_0x3c1096['query']['fields']));_0x4aa51e[_0x23ba('0x29')]=_0x4aa51e[_0x23ba('0x29')][_0x23ba('0x2b')]?_0x4aa51e[_0x23ba('0x29')]:_0x1031ca[_0x23ba('0x25')];if(!_0x3c1096[_0x23ba('0x26')]['hasOwnProperty']('nolimit')){_0x4aa51e[_0x23ba('0x16')]=qs[_0x23ba('0x16')](_0x3c1096[_0x23ba('0x26')][_0x23ba('0x16')]);_0x4aa51e[_0x23ba('0x14')]=qs[_0x23ba('0x14')](_0x3c1096[_0x23ba('0x26')][_0x23ba('0x14')]);}_0x4aa51e[_0x23ba('0x2c')]=qs[_0x23ba('0x2d')](_0x3c1096[_0x23ba('0x26')][_0x23ba('0x2d')]);_0x4aa51e[_0x23ba('0x2e')]=qs[_0x23ba('0x28')](_[_0x23ba('0x2f')](_0x3c1096[_0x23ba('0x26')],_0x1031ca[_0x23ba('0x28')]),_0x4c710f);if(_0x3c1096[_0x23ba('0x26')][_0x23ba('0x30')]){_0x4aa51e[_0x23ba('0x2e')]=_[_0x23ba('0x31')](_0x4aa51e[_0x23ba('0x2e')],{'$or':_[_0x23ba('0x1f')](_0x4c710f,function(_0x5d8302){if(_0x5d8302['type']!=='VIRTUAL'){var _0x4d28b8={};_0x4d28b8[_0x5d8302[_0x23ba('0x1c')]]={'$like':'%'+_0x3c1096[_0x23ba('0x26')]['filter']+'%'};return _0x4d28b8;}})});}_0x4aa51e=_[_0x23ba('0x31')]({},_0x4aa51e,_0x3c1096[_0x23ba('0x32')]);var _0x204379={'where':_0x4aa51e[_0x23ba('0x2e')]};return db[_0x23ba('0x20')]['count'](_0x204379)['then'](function(_0x52056c){_0x49c427['count']=_0x52056c;if(_0x3c1096[_0x23ba('0x26')][_0x23ba('0x33')]){_0x4aa51e[_0x23ba('0x34')]=[{'all':!![]}];}return db['SmsApplication'][_0x23ba('0x35')](_0x4aa51e);})[_0x23ba('0x18')](function(_0x46cf85){_0x49c427['rows']=_0x46cf85;return _0x49c427;})['then'](respondWithFilteredResult(_0x56539e,_0x4aa51e))[_0x23ba('0x36')](handleError(_0x56539e,null));};exports[_0x23ba('0x37')]=function(_0x595c7d,_0x239151){var _0x159174={'raw':!![],'where':{'id':_0x595c7d[_0x23ba('0x38')]['id']}},_0x2c8cba={};_0x2c8cba[_0x23ba('0x25')]=_['keys'](db['SmsApplication'][_0x23ba('0x21')]);_0x2c8cba[_0x23ba('0x26')]=_[_0x23ba('0x27')](_0x595c7d[_0x23ba('0x26')]);_0x2c8cba[_0x23ba('0x28')]=_[_0x23ba('0x39')](_0x2c8cba[_0x23ba('0x25')],_0x2c8cba['query']);_0x159174[_0x23ba('0x29')]=_[_0x23ba('0x39')](_0x2c8cba['model'],qs['fields'](_0x595c7d[_0x23ba('0x26')][_0x23ba('0x2a')]));_0x159174['attributes']=_0x159174[_0x23ba('0x29')]['length']?_0x159174[_0x23ba('0x29')]:_0x2c8cba[_0x23ba('0x25')];if(_0x595c7d[_0x23ba('0x26')]['includeAll']){_0x159174[_0x23ba('0x34')]=[{'all':!![]}];}_0x159174=_[_0x23ba('0x31')]({},_0x159174,_0x595c7d[_0x23ba('0x32')]);return db[_0x23ba('0x20')][_0x23ba('0x3a')](_0x159174)[_0x23ba('0x18')](handleEntityNotFound(_0x239151,null))[_0x23ba('0x18')](respondWithResult(_0x239151,null))[_0x23ba('0x36')](handleError(_0x239151,null));};exports[_0x23ba('0x3b')]=function(_0x159aaa,_0x4f7d0f){return db[_0x23ba('0x20')][_0x23ba('0x3b')](_0x159aaa[_0x23ba('0x3c')],{})[_0x23ba('0x18')](respondWithResult(_0x4f7d0f,0xc9))[_0x23ba('0x36')](handleError(_0x4f7d0f,null));};exports[_0x23ba('0x3d')]=function(_0x5173cb,_0x408e83){if(_0x5173cb[_0x23ba('0x3c')]['id']){delete _0x5173cb[_0x23ba('0x3c')]['id'];}return db[_0x23ba('0x20')][_0x23ba('0x3a')]({'where':{'id':_0x5173cb[_0x23ba('0x38')]['id']}})[_0x23ba('0x18')](handleEntityNotFound(_0x408e83,null))[_0x23ba('0x18')](saveUpdates(_0x5173cb[_0x23ba('0x3c')],null))[_0x23ba('0x18')](respondWithResult(_0x408e83,null))[_0x23ba('0x36')](handleError(_0x408e83,null));};exports[_0x23ba('0x3e')]=function(_0x5240be,_0x183db5){return db[_0x23ba('0x20')][_0x23ba('0x3a')]({'where':{'id':_0x5240be['params']['id']}})[_0x23ba('0x18')](handleEntityNotFound(_0x183db5,null))[_0x23ba('0x18')](removeEntity(_0x183db5,null))[_0x23ba('0x36')](handleError(_0x183db5,null));}; \ No newline at end of file +var _0x7e47=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','update','then','destroy','end','error','stack','name','index','map','SmsApplication','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0x7e47,0x128));var _0x77e4=function(_0x42c391,_0x5784d1){_0x42c391=_0x42c391-0x0;var _0x30226a=_0x7e47[_0x42c391];return _0x30226a;};'use strict';var emlformat=require(_0x77e4('0x0'));var rimraf=require(_0x77e4('0x1'));var zipdir=require(_0x77e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77e4('0x3'));var moment=require(_0x77e4('0x4'));var BPromise=require(_0x77e4('0x5'));var Mustache=require(_0x77e4('0x6'));var util=require(_0x77e4('0x7'));var path=require(_0x77e4('0x8'));var sox=require(_0x77e4('0x9'));var csv=require(_0x77e4('0xa'));var ejs=require(_0x77e4('0xb'));var fs=require('fs');var fs_extra=require(_0x77e4('0xc'));var _=require(_0x77e4('0xd'));var squel=require(_0x77e4('0xe'));var crypto=require(_0x77e4('0xf'));var jsforce=require(_0x77e4('0x10'));var deskjs=require(_0x77e4('0x11'));var toCsv=require(_0x77e4('0xa'));var querystring=require(_0x77e4('0x12'));var Papa=require('papaparse');var Redis=require(_0x77e4('0x13'));var authService=require(_0x77e4('0x14'));var qs=require(_0x77e4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77e4('0x16'));var logger=require(_0x77e4('0x17'))(_0x77e4('0x18'));var utils=require(_0x77e4('0x19'));var config=require(_0x77e4('0x1a'));var licenseUtil=require(_0x77e4('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f971c,_0xc52a41){_0xc52a41=_0xc52a41||0xcc;return function(_0x3258b1){if(_0x3258b1){return _0x3f971c[_0x77e4('0x1c')](_0xc52a41);}return _0x3f971c['status'](_0xc52a41)['end']();};}function respondWithResult(_0x366df5,_0xa5e8e6){_0xa5e8e6=_0xa5e8e6||0xc8;return function(_0x3cd6d2){if(_0x3cd6d2){return _0x366df5[_0x77e4('0x1d')](_0xa5e8e6)[_0x77e4('0x1e')](_0x3cd6d2);}};}function respondWithFilteredResult(_0x892811,_0x4c9022){return function(_0x4bd383){if(_0x4bd383){var _0x509715=typeof _0x4c9022['offset']===_0x77e4('0x1f')&&typeof _0x4c9022[_0x77e4('0x20')]===_0x77e4('0x1f');var _0x33447a=_0x4bd383['count'];var _0x3bda0d=_0x509715?0x0:_0x4c9022[_0x77e4('0x21')];var _0x4e761e=_0x509715?_0x4bd383[_0x77e4('0x22')]:_0x4c9022[_0x77e4('0x21')]+_0x4c9022['limit'];var _0x3a51f5;if(_0x4e761e>=_0x33447a){_0x4e761e=_0x33447a;_0x3a51f5=0xc8;}else{_0x3a51f5=0xce;}_0x892811[_0x77e4('0x1d')](_0x3a51f5);return _0x892811[_0x77e4('0x23')](_0x77e4('0x24'),_0x3bda0d+'-'+_0x4e761e+'/'+_0x33447a)[_0x77e4('0x1e')](_0x4bd383);}return null;};}function patchUpdates(_0x45728d){return function(_0x543b06){try{jsonpatch[_0x77e4('0x25')](_0x543b06,_0x45728d,!![]);}catch(_0x573d69){return BPromise['reject'](_0x573d69);}return _0x543b06['save']();};}function saveUpdates(_0x106d2c,_0x1ebc72){return function(_0x2f5898){if(_0x2f5898){return _0x2f5898[_0x77e4('0x26')](_0x106d2c)[_0x77e4('0x27')](function(_0x35ac0d){return _0x35ac0d;});}return null;};}function removeEntity(_0x5a1a63,_0x2cea75){return function(_0x2d8364){if(_0x2d8364){return _0x2d8364[_0x77e4('0x28')]()[_0x77e4('0x27')](function(){_0x5a1a63[_0x77e4('0x1d')](0xcc)[_0x77e4('0x29')]();});}};}function handleEntityNotFound(_0x5c3142,_0x7b1fcd){return function(_0xdcfc0e){if(!_0xdcfc0e){_0x5c3142['sendStatus'](0x194);}return _0xdcfc0e;};}function handleError(_0x479137,_0x51bc28){_0x51bc28=_0x51bc28||0x1f4;return function(_0x12fa39){logger[_0x77e4('0x2a')](_0x12fa39[_0x77e4('0x2b')]);if(_0x12fa39[_0x77e4('0x2c')]){delete _0x12fa39[_0x77e4('0x2c')];}_0x479137[_0x77e4('0x1d')](_0x51bc28)['send'](_0x12fa39);};}exports[_0x77e4('0x2d')]=function(_0xa059b0,_0x24a4d0){var _0xc8dcd0={},_0x14f1b8={},_0x4412d3={'count':0x0,'rows':[]};var _0x3d1628=_[_0x77e4('0x2e')](db[_0x77e4('0x2f')]['rawAttributes'],function(_0x358ae4){return{'name':_0x358ae4['fieldName'],'type':_0x358ae4[_0x77e4('0x30')][_0x77e4('0x31')]};});_0x14f1b8[_0x77e4('0x32')]=_[_0x77e4('0x2e')](_0x3d1628,_0x77e4('0x2c'));_0x14f1b8[_0x77e4('0x33')]=_[_0x77e4('0x34')](_0xa059b0[_0x77e4('0x33')]);_0x14f1b8[_0x77e4('0x35')]=_[_0x77e4('0x36')](_0x14f1b8[_0x77e4('0x32')],_0x14f1b8['query']);_0xc8dcd0[_0x77e4('0x37')]=_[_0x77e4('0x36')](_0x14f1b8[_0x77e4('0x32')],qs[_0x77e4('0x38')](_0xa059b0[_0x77e4('0x33')][_0x77e4('0x38')]));_0xc8dcd0['attributes']=_0xc8dcd0[_0x77e4('0x37')][_0x77e4('0x39')]?_0xc8dcd0[_0x77e4('0x37')]:_0x14f1b8[_0x77e4('0x32')];if(!_0xa059b0['query']['hasOwnProperty']('nolimit')){_0xc8dcd0['limit']=qs[_0x77e4('0x20')](_0xa059b0['query'][_0x77e4('0x20')]);_0xc8dcd0[_0x77e4('0x21')]=qs[_0x77e4('0x21')](_0xa059b0[_0x77e4('0x33')][_0x77e4('0x21')]);}_0xc8dcd0[_0x77e4('0x3a')]=qs[_0x77e4('0x3b')](_0xa059b0['query'][_0x77e4('0x3b')]);_0xc8dcd0['where']=qs[_0x77e4('0x35')](_[_0x77e4('0x3c')](_0xa059b0['query'],_0x14f1b8['filters']),_0x3d1628);if(_0xa059b0['query']['filter']){_0xc8dcd0[_0x77e4('0x3d')]=_[_0x77e4('0x3e')](_0xc8dcd0[_0x77e4('0x3d')],{'$or':_[_0x77e4('0x2e')](_0x3d1628,function(_0x1f3891){if(_0x1f3891[_0x77e4('0x30')]!==_0x77e4('0x3f')){var _0x33e5de={};_0x33e5de[_0x1f3891[_0x77e4('0x2c')]]={'$like':'%'+_0xa059b0['query'][_0x77e4('0x40')]+'%'};return _0x33e5de;}})});}_0xc8dcd0=_[_0x77e4('0x3e')]({},_0xc8dcd0,_0xa059b0['options']);var _0x40838d={'where':_0xc8dcd0[_0x77e4('0x3d')]};return db[_0x77e4('0x2f')][_0x77e4('0x22')](_0x40838d)[_0x77e4('0x27')](function(_0x5482f5){_0x4412d3['count']=_0x5482f5;if(_0xa059b0['query'][_0x77e4('0x41')]){_0xc8dcd0[_0x77e4('0x42')]=[{'all':!![]}];}return db[_0x77e4('0x2f')][_0x77e4('0x43')](_0xc8dcd0);})['then'](function(_0x5234ba){_0x4412d3[_0x77e4('0x44')]=_0x5234ba;return _0x4412d3;})['then'](respondWithFilteredResult(_0x24a4d0,_0xc8dcd0))[_0x77e4('0x45')](handleError(_0x24a4d0,null));};exports[_0x77e4('0x46')]=function(_0x40f686,_0x59328a){var _0x1e4926={'raw':!![],'where':{'id':_0x40f686[_0x77e4('0x47')]['id']}},_0x109a78={};_0x109a78['model']=_[_0x77e4('0x34')](db[_0x77e4('0x2f')][_0x77e4('0x48')]);_0x109a78[_0x77e4('0x33')]=_[_0x77e4('0x34')](_0x40f686[_0x77e4('0x33')]);_0x109a78['filters']=_[_0x77e4('0x36')](_0x109a78[_0x77e4('0x32')],_0x109a78[_0x77e4('0x33')]);_0x1e4926['attributes']=_['intersection'](_0x109a78['model'],qs['fields'](_0x40f686[_0x77e4('0x33')]['fields']));_0x1e4926['attributes']=_0x1e4926[_0x77e4('0x37')][_0x77e4('0x39')]?_0x1e4926[_0x77e4('0x37')]:_0x109a78[_0x77e4('0x32')];if(_0x40f686[_0x77e4('0x33')][_0x77e4('0x41')]){_0x1e4926[_0x77e4('0x42')]=[{'all':!![]}];}_0x1e4926=_[_0x77e4('0x3e')]({},_0x1e4926,_0x40f686[_0x77e4('0x49')]);return db[_0x77e4('0x2f')][_0x77e4('0x4a')](_0x1e4926)[_0x77e4('0x27')](handleEntityNotFound(_0x59328a,null))['then'](respondWithResult(_0x59328a,null))[_0x77e4('0x45')](handleError(_0x59328a,null));};exports[_0x77e4('0x4b')]=function(_0x4e74a9,_0x45ba8d){return db[_0x77e4('0x2f')][_0x77e4('0x4b')](_0x4e74a9[_0x77e4('0x4c')],{})['then'](respondWithResult(_0x45ba8d,0xc9))[_0x77e4('0x45')](handleError(_0x45ba8d,null));};exports[_0x77e4('0x26')]=function(_0xdccbc4,_0x389909){if(_0xdccbc4[_0x77e4('0x4c')]['id']){delete _0xdccbc4[_0x77e4('0x4c')]['id'];}return db[_0x77e4('0x2f')][_0x77e4('0x4a')]({'where':{'id':_0xdccbc4[_0x77e4('0x47')]['id']}})['then'](handleEntityNotFound(_0x389909,null))[_0x77e4('0x27')](saveUpdates(_0xdccbc4[_0x77e4('0x4c')],null))[_0x77e4('0x27')](respondWithResult(_0x389909,null))[_0x77e4('0x45')](handleError(_0x389909,null));};exports['destroy']=function(_0x35359,_0x27816d){return db[_0x77e4('0x2f')][_0x77e4('0x4a')]({'where':{'id':_0x35359['params']['id']}})[_0x77e4('0x27')](handleEntityNotFound(_0x27816d,null))[_0x77e4('0x27')](removeEntity(_0x27816d,null))[_0x77e4('0x45')](handleError(_0x27816d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 6eb40f0..6ab8f39 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 _0xe5e0=['../../config/environment','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x19332d,_0x10cb6a){var _0x357167=function(_0x39315f){while(--_0x39315f){_0x19332d['push'](_0x19332d['shift']());}};_0x357167(++_0x10cb6a);}(_0xe5e0,0x123));var _0x0e5e=function(_0x46e455,_0x2faf93){_0x46e455=_0x46e455-0x0;var _0x5da9f7=_0xe5e0[_0x46e455];return _0x5da9f7;};'use strict';var _=require(_0x0e5e('0x0'));var util=require(_0x0e5e('0x1'));var logger=require(_0x0e5e('0x2'))(_0x0e5e('0x3'));var moment=require(_0x0e5e('0x4'));var BPromise=require(_0x0e5e('0x5'));var rp=require(_0x0e5e('0x6'));var fs=require('fs');var path=require(_0x0e5e('0x7'));var rimraf=require(_0x0e5e('0x8'));var config=require(_0x0e5e('0x9'));var attributes=require('./smsApplication.attributes');module[_0x0e5e('0xa')]=function(_0x39c487,_0x5cc97b){return _0x39c487[_0x0e5e('0xb')]('SmsApplication',attributes,{'tableName':_0x0e5e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0e5e('0xd'),'collate':_0x0e5e('0xe')});}; \ No newline at end of file +var _0x22d0=['moment','bluebird','request-promise','rimraf','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x30d3a8,_0x2b06ae){var _0x4f2ab4=function(_0x55690a){while(--_0x55690a){_0x30d3a8['push'](_0x30d3a8['shift']());}};_0x4f2ab4(++_0x2b06ae);}(_0x22d0,0x106));var _0x022d=function(_0x18f396,_0x174d17){_0x18f396=_0x18f396-0x0;var _0x3ba532=_0x22d0[_0x18f396];return _0x3ba532;};'use strict';var _=require(_0x022d('0x0'));var util=require(_0x022d('0x1'));var logger=require(_0x022d('0x2'))(_0x022d('0x3'));var moment=require(_0x022d('0x4'));var BPromise=require(_0x022d('0x5'));var rp=require(_0x022d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x022d('0x7'));var config=require('../../config/environment');var attributes=require(_0x022d('0x8'));module[_0x022d('0x9')]=function(_0x1f0fe6,_0x32d4c5){return _0x1f0fe6[_0x022d('0xa')]('SmsApplication',attributes,{'tableName':_0x022d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x022d('0xc'),'collate':_0x022d('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c3a2eb3..5f2fa6f 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 _0x4639=['client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x336e40,_0x2b13b5){var _0xa8722c=function(_0x24a8a4){while(--_0x24a8a4){_0x336e40['push'](_0x336e40['shift']());}};_0xa8722c(++_0x2b13b5);}(_0x4639,0x115));var _0x9463=function(_0x433ab5,_0x16e711){_0x433ab5=_0x433ab5-0x0;var _0x315911=_0x4639[_0x433ab5];return _0x315911;};'use strict';var _=require(_0x9463('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9463('0x1'));var rs=require(_0x9463('0x2'));var fs=require('fs');var Redis=require(_0x9463('0x3'));var db=require(_0x9463('0x4'))['db'];var utils=require(_0x9463('0x5'));var logger=require(_0x9463('0x6'))(_0x9463('0x7'));var config=require('../../config/environment');var jayson=require(_0x9463('0x8'));var client=jayson[_0x9463('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494a02,_0x3b5e95,_0x500f5d){return new BPromise(function(_0x58d09c,_0x465758){return client[_0x9463('0xa')](_0x494a02,_0x500f5d)[_0x9463('0xb')](function(_0x49e617){logger[_0x9463('0xc')](_0x9463('0xd'),_0x3b5e95,_0x9463('0xe'));logger[_0x9463('0xf')](_0x9463('0x10'),_0x3b5e95,_0x9463('0xe'),JSON[_0x9463('0x11')](_0x49e617));if(_0x49e617[_0x9463('0x12')]){if(_0x49e617[_0x9463('0x12')][_0x9463('0x13')]===0x1f4){logger[_0x9463('0x12')](_0x9463('0xd'),_0x3b5e95,_0x49e617[_0x9463('0x12')][_0x9463('0x14')]);return _0x465758(_0x49e617[_0x9463('0x12')][_0x9463('0x14')]);}logger[_0x9463('0x12')](_0x9463('0xd'),_0x3b5e95,_0x49e617[_0x9463('0x12')]['message']);return _0x58d09c(_0x49e617[_0x9463('0x12')]['message']);}else{logger[_0x9463('0xc')](_0x9463('0xd'),_0x3b5e95,_0x9463('0xe'));_0x58d09c(_0x49e617[_0x9463('0x15')][_0x9463('0x14')]);}})['catch'](function(_0x3d5a81){logger[_0x9463('0x12')](_0x9463('0xd'),_0x3b5e95,_0x3d5a81);_0x465758(_0x3d5a81);});});} \ No newline at end of file +var _0x7e74=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x5b9200,_0x4fafc4){var _0xdbd4c9=function(_0x3c7fa5){while(--_0x3c7fa5){_0x5b9200['push'](_0x5b9200['shift']());}};_0xdbd4c9(++_0x4fafc4);}(_0x7e74,0xbd));var _0x47e7=function(_0x48a33e,_0x442456){_0x48a33e=_0x48a33e-0x0;var _0x52153d=_0x7e74[_0x48a33e];return _0x52153d;};'use strict';var _=require(_0x47e7('0x0'));var util=require('util');var moment=require(_0x47e7('0x1'));var BPromise=require(_0x47e7('0x2'));var rs=require(_0x47e7('0x3'));var fs=require('fs');var Redis=require(_0x47e7('0x4'));var db=require(_0x47e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47e7('0x6'))(_0x47e7('0x7'));var config=require(_0x47e7('0x8'));var jayson=require(_0x47e7('0x9'));var client=jayson[_0x47e7('0xa')][_0x47e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412d3e,_0x50fc6c,_0x29cd0a){return new BPromise(function(_0x4dc1ee,_0x14fe2f){return client[_0x47e7('0xc')](_0x412d3e,_0x29cd0a)[_0x47e7('0xd')](function(_0x2f66c0){logger[_0x47e7('0xe')](_0x47e7('0xf'),_0x50fc6c,_0x47e7('0x10'));logger[_0x47e7('0x11')](_0x47e7('0x12'),_0x50fc6c,_0x47e7('0x10'),JSON[_0x47e7('0x13')](_0x2f66c0));if(_0x2f66c0[_0x47e7('0x14')]){if(_0x2f66c0[_0x47e7('0x14')]['code']===0x1f4){logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x2f66c0[_0x47e7('0x14')]['message']);return _0x14fe2f(_0x2f66c0[_0x47e7('0x14')][_0x47e7('0x15')]);}logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x2f66c0['error'][_0x47e7('0x15')]);return _0x4dc1ee(_0x2f66c0[_0x47e7('0x14')][_0x47e7('0x15')]);}else{logger[_0x47e7('0xe')](_0x47e7('0xf'),_0x50fc6c,'request\x20sent');_0x4dc1ee(_0x2f66c0[_0x47e7('0x16')]['message']);}})[_0x47e7('0x17')](function(_0x8c320e){logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x8c320e);_0x14fe2f(_0x8c320e);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index dcee356..ab6aee3 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 _0x1eba=['put','/:id','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','download','post','create','/:id/tags','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x4c630b,_0x25f8ef){var _0x181259=function(_0x5d0e58){while(--_0x5d0e58){_0x4c630b['push'](_0x4c630b['shift']());}};_0x181259(++_0x25f8ef);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0x1eba[_0x39e164];return _0x13fa6b;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1eb('0x5'));var interaction=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var controller=require(_0xa1eb('0x8'));router[_0xa1eb('0x9')]('/',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xb')]);router[_0xa1eb('0x9')](_0xa1eb('0xc'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xd')]);router[_0xa1eb('0x9')]('/:id',auth[_0xa1eb('0xa')](),controller['show']);router[_0xa1eb('0x9')]('/:id/messages',auth[_0xa1eb('0xa')](),controller['getMessages']);router[_0xa1eb('0x9')]('/:id/download',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xe')]);router[_0xa1eb('0xf')]('/',auth['isAuthenticated'](),controller[_0xa1eb('0x10')]);router[_0xa1eb('0xf')]('/:id/messages',auth[_0xa1eb('0xa')](),controller['addMessage']);router['post'](_0xa1eb('0x11'),auth['isAuthenticated'](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),_0xa1eb('0x14')),controller[_0xa1eb('0x15')]);router[_0xa1eb('0x16')](_0xa1eb('0x17'),auth[_0xa1eb('0xa')](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),'smsinteraction:update'),controller[_0xa1eb('0x18')]);router['delete'](_0xa1eb('0x17'),auth[_0xa1eb('0xa')](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),'smsinteraction:destroy'),controller[_0xa1eb('0x19')]);router[_0xa1eb('0x1a')](_0xa1eb('0x11'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0x1b')]);module[_0xa1eb('0x1c')]=router; \ No newline at end of file +var _0xb62e=['removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy'];(function(_0x3f3480,_0x2ddb9f){var _0x29e2cc=function(_0x5c5a61){while(--_0x5c5a61){_0x3f3480['push'](_0x3f3480['shift']());}};_0x29e2cc(++_0x2ddb9f);}(_0xb62e,0x1de));var _0xeb62=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb62e[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/describe',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0xc')](_0xeb62('0x11'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x13')]('/',auth[_0xeb62('0xa')](),controller['create']);router[_0xeb62('0x13')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x14')]);router['post'](_0xeb62('0x15'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')]('sms',_0xeb62('0x17')),controller[_0xeb62('0x18')]);router[_0xeb62('0x19')]('/:id',auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1b')),controller[_0xeb62('0x1c')]);router[_0xeb62('0x1d')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1e')),controller[_0xeb62('0x1f')]);router[_0xeb62('0x1d')]('/:id/tags',auth[_0xeb62('0xa')](),controller[_0xeb62('0x20')]);module[_0xeb62('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index e54d8a4..61f13d7 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 _0x15cb=['out','moment','BOOLEAN','STRING','DATE','ENUM'];(function(_0x19a659,_0x543ebc){var _0xf9801=function(_0x5a8546){while(--_0x5a8546){_0x19a659['push'](_0x19a659['shift']());}};_0xf9801(++_0x543ebc);}(_0x15cb,0x16f));var _0xb15c=function(_0x45a470,_0xe0358){_0x45a470=_0x45a470-0x0;var _0x5387e2=_0x15cb[_0x45a470];return _0x5387e2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb15c('0x0'));module['exports']={'closed':{'type':Sequelize[_0xb15c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb15c('0x2')]},'secondDisposition':{'type':Sequelize[_0xb15c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb15c('0x2')]},'note':{'type':Sequelize[_0xb15c('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb15c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb15c('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb15c('0x4')]('in',_0xb15c('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb15c('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x302c=['DATE','STRING','out','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x4b870e,_0x390eca){var _0x234d51=function(_0x22133a){while(--_0x22133a){_0x4b870e['push'](_0x4b870e['shift']());}};_0x234d51(++_0x390eca);}(_0x302c,0x15c));var _0xc302=function(_0x1345fa,_0x11947a){_0x1345fa=_0x1345fa-0x0;var _0xc32585=_0x302c[_0x1345fa];return _0xc32585;};'use strict';var Sequelize=require(_0xc302('0x0'));var moment=require(_0xc302('0x1'));module[_0xc302('0x2')]={'closed':{'type':Sequelize[_0xc302('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc302('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc302('0x5')]},'note':{'type':Sequelize[_0xc302('0x5')]},'phone':{'type':Sequelize[_0xc302('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc302('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc302('0x7')]('in',_0xc302('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc302('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index ef07129..e484738 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 _0x85d4=['show','params','includeAll','include','options','create','body','update','describe','SmsMessage','omit','ids','findOne','keys','pick','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','emit','removeTags','download','unix','root','server','tmp','files','attachments','join','fullname','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','Sms','N.A.','closed','closedAt','disposition','out','System','renderFile','views','downloadInteraction.ejs','transcript-','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','destroy','error','stack','name','send','Users','map','TagIds','Tags','forEach','push','then','catch','index','SmsInteraction','rawAttributes','fieldName','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','users','u.id\x20=\x20ui.UserId','select','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','length','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','rows'];(function(_0x2851f2,_0x3d6113){var _0x4984db=function(_0x5c354f){while(--_0x5c354f){_0x2851f2['push'](_0x2851f2['shift']());}};_0x4984db(++_0x3d6113);}(_0x85d4,0x121));var _0x485d=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x85d4[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require(_0x485d('0x0'));var rimraf=require(_0x485d('0x1'));var zipdir=require(_0x485d('0x2'));var jsonpatch=require(_0x485d('0x3'));var rp=require(_0x485d('0x4'));var moment=require(_0x485d('0x5'));var BPromise=require(_0x485d('0x6'));var Mustache=require(_0x485d('0x7'));var util=require('util');var path=require(_0x485d('0x8'));var sox=require(_0x485d('0x9'));var csv=require(_0x485d('0xa'));var ejs=require(_0x485d('0xb'));var fs=require('fs');var fs_extra=require(_0x485d('0xc'));var _=require(_0x485d('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x485d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x485d('0xa'));var querystring=require(_0x485d('0xf'));var Papa=require('papaparse');var Redis=require(_0x485d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x485d('0x11'));var pdf=require(_0x485d('0x12'));var hardwareService=require(_0x485d('0x13'));var logger=require(_0x485d('0x14'))(_0x485d('0x15'));var utils=require(_0x485d('0x16'));var config=require(_0x485d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x485d('0x18')]=_[_0x485d('0x19')](config[_0x485d('0x18')],{'host':_0x485d('0x1a'),'port':0x18eb});var socket=require(_0x485d('0x1b'))(new Redis(config[_0x485d('0x18')]));require(_0x485d('0x1c'))[_0x485d('0x1d')](socket);function respondWithStatusCode(_0x56ca9d,_0x155bc0){_0x155bc0=_0x155bc0||0xcc;return function(_0x1a31d8){if(_0x1a31d8){return _0x56ca9d[_0x485d('0x1e')](_0x155bc0);}return _0x56ca9d['status'](_0x155bc0)[_0x485d('0x1f')]();};}function respondWithResult(_0x1065e8,_0x3025ec){_0x3025ec=_0x3025ec||0xc8;return function(_0x4a747f){if(_0x4a747f){return _0x1065e8[_0x485d('0x20')](_0x3025ec)['json'](_0x4a747f);}};}function respondWithFilteredResult(_0x535820,_0x11bb1c){return function(_0x5c6008){if(_0x5c6008){var _0x8de5e5=typeof _0x11bb1c['offset']===_0x485d('0x21')&&typeof _0x11bb1c[_0x485d('0x22')]===_0x485d('0x21');var _0xa82377=_0x5c6008[_0x485d('0x23')];var _0x1fcfdb=_0x8de5e5?0x0:_0x11bb1c[_0x485d('0x24')];var _0x45e2bd=_0x8de5e5?_0x5c6008[_0x485d('0x23')]:_0x11bb1c[_0x485d('0x24')]+_0x11bb1c['limit'];var _0x261a57;if(_0x45e2bd>=_0xa82377){_0x45e2bd=_0xa82377;_0x261a57=0xc8;}else{_0x261a57=0xce;}_0x535820[_0x485d('0x20')](_0x261a57);return _0x535820['set'](_0x485d('0x25'),_0x1fcfdb+'-'+_0x45e2bd+'/'+_0xa82377)[_0x485d('0x26')](_0x5c6008);}return null;};}function patchUpdates(_0x44c50a){return function(_0x396a99){try{jsonpatch[_0x485d('0x27')](_0x396a99,_0x44c50a,!![]);}catch(_0x1f3cec){return BPromise[_0x485d('0x28')](_0x1f3cec);}return _0x396a99[_0x485d('0x29')]();};}function saveUpdates(_0x1dc77d,_0x44e604){return function(_0x54f801){if(_0x54f801){return _0x54f801['update'](_0x1dc77d)['then'](function(_0x52c78d){return _0x52c78d;});}return null;};}function removeEntity(_0x25620a,_0x2785d9){return function(_0x154d06){if(_0x154d06){return _0x154d06[_0x485d('0x2a')]()['then'](function(){_0x25620a[_0x485d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x232d68,_0x118fe9){return function(_0x475d78){if(!_0x475d78){_0x232d68[_0x485d('0x1e')](0x194);}return _0x475d78;};}function handleError(_0x410df4,_0x5bb74a){_0x5bb74a=_0x5bb74a||0x1f4;return function(_0x56a07b){logger[_0x485d('0x2b')](_0x56a07b[_0x485d('0x2c')]);if(_0x56a07b[_0x485d('0x2d')]){delete _0x56a07b[_0x485d('0x2d')];}_0x410df4[_0x485d('0x20')](_0x5bb74a)[_0x485d('0x2e')](_0x56a07b);};}function getInteractionUsers(_0xe6884c,_0x5e2ad4){return new BPromise(function(_0x1ef5d7,_0x54041e){try{if(_0x5e2ad4[_0xe6884c['id']]){_0xe6884c[_0x485d('0x2f')]=_[_0x485d('0x30')](_0x5e2ad4[_0xe6884c['id']],function(_0x226b97){return{'id':_0x226b97['id'],'fullname':_0x226b97['fullname']};});}}catch(_0x1801bd){_0x54041e(_0x1801bd);}_0x1ef5d7(_0xe6884c);});}function getInteractionTags(_0x4ba81e,_0x44a646){return new BPromise(function(_0x37d73c,_0x23fa3c){try{if(_0x4ba81e[_0x485d('0x31')]){_0x4ba81e[_0x485d('0x32')]=[];_0x4ba81e['TagIds']['split'](',')[_0x485d('0x33')](function(_0x42f8ba){_0x4ba81e[_0x485d('0x32')][_0x485d('0x34')](_0x44a646[_0x42f8ba]);});}delete _0x4ba81e[_0x485d('0x31')];}catch(_0x32c1b3){_0x23fa3c(_0x32c1b3);}_0x37d73c(_0x4ba81e);});}function updateSmsInteraction(_0x5b2a94,_0x57757b,_0x55b363){return new BPromise(function(_0x168502,_0x5adeed){return getInteractionUsers(_0x5b2a94,_0x55b363)[_0x485d('0x35')](function(_0x38706a){return getInteractionTags(_0x38706a,_0x57757b);})[_0x485d('0x35')](function(_0x3a1384){_0x168502(_0x3a1384);})[_0x485d('0x36')](function(_0x5e0042){_0x5adeed(_0x5e0042);});});}exports[_0x485d('0x37')]=function(_0x4a2d30,_0x547997){var _0x34a73d={},_0x361c71={},_0x966caf={'count':0x0,'rows':[]};var _0x23fc7c=_[_0x485d('0x30')](db[_0x485d('0x38')][_0x485d('0x39')],function(_0x4a2b09){return{'name':_0x4a2b09[_0x485d('0x3a')],'type':_0x4a2b09['type']['key']};});_0x361c71['model']=_[_0x485d('0x30')](_0x23fc7c,_0x485d('0x2d'));_0x361c71[_0x485d('0x3b')]=_['keys'](_0x4a2d30[_0x485d('0x3b')]);_0x361c71[_0x485d('0x3c')]=_['intersection'](_0x361c71[_0x485d('0x3d')],_0x361c71[_0x485d('0x3b')]);_0x34a73d[_0x485d('0x3e')]=_[_0x485d('0x3f')](_0x361c71[_0x485d('0x3d')],qs[_0x485d('0x40')](_0x4a2d30[_0x485d('0x3b')][_0x485d('0x40')]));_0x34a73d[_0x485d('0x3e')]=_0x34a73d[_0x485d('0x3e')]['length']?_0x34a73d[_0x485d('0x3e')]:_0x361c71[_0x485d('0x3d')];if(!_0x4a2d30['query'][_0x485d('0x41')](_0x485d('0x42'))){_0x34a73d[_0x485d('0x22')]=qs[_0x485d('0x22')](_0x4a2d30[_0x485d('0x3b')][_0x485d('0x22')]);_0x34a73d[_0x485d('0x24')]=qs[_0x485d('0x24')](_0x4a2d30[_0x485d('0x3b')]['offset']);}_0x34a73d[_0x485d('0x43')]=qs[_0x485d('0x44')](_0x4a2d30[_0x485d('0x3b')][_0x485d('0x44')]);_0x34a73d[_0x485d('0x45')]=qs[_0x485d('0x3c')](_['pick'](_0x4a2d30[_0x485d('0x3b')],_0x361c71[_0x485d('0x3c')]),_0x23fc7c);var _0xdcba75=[];var _0x4a57ac=squel['select']()['field']('id')[_0x485d('0x46')](_0x485d('0x2d'))[_0x485d('0x46')](_0x485d('0x47'))[_0x485d('0x48')](_0x485d('0x49'));var _0x1aa7a3=squel['select']()[_0x485d('0x46')](_0x485d('0x4a'))[_0x485d('0x46')](_0x485d('0x4b'))[_0x485d('0x46')](_0x485d('0x4c'))[_0x485d('0x48')]('user_has_sms_interactions','ui')[_0x485d('0x4d')](_0x485d('0x4e'),'u',_0x485d('0x4f'));var _0x544fd7=squel[_0x485d('0x50')]()['from'](_0x485d('0x51'),'i')[_0x485d('0x4d')](_0x485d('0x52'),'c',_0x485d('0x53'))[_0x485d('0x4d')](_0x485d('0x4e'),'o',_0x485d('0x54'))[_0x485d('0x4d')](_0x485d('0x55'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x485d('0x56'),'me',_0x485d('0x57'))[_0x485d('0x4d')](_0x485d('0x58'),'it',_0x485d('0x59'))[_0x485d('0x4d')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x308660=squel[_0x485d('0x5a')]();var _0x3d5efc=[];var _0x547bbd=squel[_0x485d('0x5a')]();var _0x316dd4;if(_0x4a2d30[_0x485d('0x3b')][_0x485d('0x5b')]){_0x316dd4=as[_0x485d('0x5c')](_0x4a2d30['query'][_0x485d('0x5b')]);var _0x3a1328=_0x316dd4[_0x485d('0x5d')];for(var _0x47995d=0x0;_0x47995d<_0x316dd4['conditions']['length'];_0x47995d++){var _0x4c50de=_0x316dd4['conditions'][_0x47995d];var _0x3ee22a='i';var _0x240058=_[_0x485d('0x5e')](_0x23fc7c,[_0x485d('0x2d'),_0x4c50de[_0x485d('0x46')]]);if(!_0x240058){switch(_0x4c50de[_0x485d('0x46')]){case _0x485d('0x5f'):if(_0x4c50de[_0x485d('0x60')]==0x1){_0x544fd7[_0x485d('0x61')]('`'+_0x4c50de[_0x485d('0x46')]+_0x485d('0x62'));}else{_0x544fd7[_0x485d('0x61')]('`'+_0x4c50de[_0x485d('0x46')]+_0x485d('0x63'));}break;case _0x485d('0x64'):if(_0x4c50de[_0x485d('0x65')]==='$substring'){if(_0x4c50de[_0x485d('0x60')][_0x485d('0x66')]('\x20')['length']>0x1){_0x308660[_0x3a1328](_0x485d('0x67'),qs['getFullTextValue'](_0x4c50de[_0x485d('0x60')]),null);}else{var _0x492896='%'+_0x4c50de[_0x485d('0x60')]+'%';_0x308660[_0x3a1328](_0x485d('0x68'),_0x492896,_0x492896,_0x492896);}}else{_0x240058=_[_0x485d('0x5e')](_0x23fc7c,[_0x485d('0x2d'),_0x485d('0x69')]);_0x4c50de[_0x485d('0x46')]=_0x485d('0x69');_0x43fb0a=as[_0x485d('0x6a')](_0x3ee22a,_0x240058[_0x485d('0x6b')],_0x4c50de);_0x308660[_0x3a1328](_0x43fb0a[_0x485d('0x6c')],_0x43fb0a[_0x485d('0x60')][_0x485d('0x6d')],_0x43fb0a[_0x485d('0x60')][_0x485d('0x1f')]);}break;case _0x485d('0x6e'):var _0xb7d382=_0x4c50de['value'][_0x485d('0x66')](',')[_0x485d('0x30')](function(_0x4836a3){return Number(_0x4836a3);});_0xb7d382['forEach'](function(_0x422db6){_0x547bbd['or'](_0x485d('0x6f'),'%,'+_0x422db6+',%');});_0x3d5efc=_[_0x485d('0x70')](_0x3d5efc,_0xb7d382);break;case _0x485d('0x71'):if(_0x4c50de[_0x485d('0x65')]===_0x485d('0x72')){_0x308660[_0x3a1328](_0x485d('0x73'),'%'+_0x4c50de['value']+'%',null);}else{_0x240058=_['find'](_0x23fc7c,[_0x485d('0x2d'),'UserId']);_0x4c50de[_0x485d('0x46')]=_0x485d('0x74');_0x43fb0a=as[_0x485d('0x6a')](_0x3ee22a,_0x240058['type'],_0x4c50de);_0x308660[_0x3a1328](_0x43fb0a[_0x485d('0x6c')],_0x43fb0a[_0x485d('0x60')][_0x485d('0x6d')],_0x43fb0a[_0x485d('0x60')][_0x485d('0x1f')]);}break;case'body':_0x43fb0a=as['buildExpression']('me',null,_0x4c50de);_0x308660[_0x3a1328](_0x43fb0a[_0x485d('0x6c')],_0x43fb0a[_0x485d('0x60')][_0x485d('0x6d')],_0x43fb0a['value'][_0x485d('0x1f')]);break;}}else{var _0x43fb0a=as[_0x485d('0x6a')](_0x3ee22a,_0x240058['type'],_0x4c50de);_0x308660[_0x3a1328](_0x43fb0a[_0x485d('0x6c')],_0x43fb0a[_0x485d('0x60')]['start'],_0x43fb0a[_0x485d('0x60')][_0x485d('0x1f')]);}}}else{var _0x520fb1=_(_0x4a2d30[_0x485d('0x3b')])['keys']()['map'](function(_0x36ea02){return _[_0x485d('0x75')](_0x23fc7c,[_0x485d('0x2d'),_0x36ea02])?_0x36ea02:undefined;})[_0x485d('0x76')]()[_0x485d('0x60')]();if(!_[_0x485d('0x77')](_0x520fb1)){_0x520fb1[_0x485d('0x33')](function(_0x105fee){if(_0x105fee===_0x485d('0x78')){_0x544fd7[_0x485d('0x45')](_0x485d('0x79'),[]['concat'](_0x4a2d30[_0x485d('0x3b')][_0x105fee]));}else if(_0x105fee===_0x485d('0x7a')){var _0xb96ab4=JSON[_0x485d('0x7b')](_0x4a2d30[_0x485d('0x3b')][_0x105fee])['$gte'];var _0x2bc7ff=JSON[_0x485d('0x7b')](_0x4a2d30['query'][_0x105fee])[_0x485d('0x7c')];_0x544fd7[_0x485d('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xb96ab4,_0x2bc7ff);}else{if(_0x4a2d30[_0x485d('0x3b')][_0x105fee]===_0x485d('0x7d')){_0x544fd7['where']('i.'+_0x105fee+_0x485d('0x7e'));}else{_0x544fd7[_0x485d('0x45')]('i.'+_0x105fee+_0x485d('0x7f'),_0x4a2d30[_0x485d('0x3b')][_0x105fee]);}}});}if(_0x4a2d30[_0x485d('0x3b')][_0x485d('0x80')]){if(_0x4a2d30['query'][_0x485d('0x80')]==0x1){_0x544fd7[_0x485d('0x61')](_0x485d('0x81'));}else{_0x544fd7['having']('`unreadMessages`\x20>\x200');}}if(_0x4a2d30['query'][_0x485d('0x82')]){_0x3d5efc=_[_0x485d('0x83')](_0x4a2d30[_0x485d('0x3b')][_0x485d('0x82')])?_0x4a2d30[_0x485d('0x3b')]['tag']:new Array(_0x4a2d30['query']['tag']);_0x3d5efc[_0x485d('0x33')](function(_0x330a14){_0x547bbd['or'](_0x485d('0x6f'),'%,'+_0x330a14+',%');});}if(_0x4a2d30[_0x485d('0x3b')][_0x485d('0x84')]){var _0x56630f=_0x4a2d30['query'][_0x485d('0x84')]['replace']('\x5c','\x5c\x5c')[_0x485d('0x85')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x56630f)){_0x308660['or'](_0x485d('0x86'),_0x56630f+'%')['or'](_0x485d('0x87'),_0x56630f+'%');}else{_0x308660['or'](_0x485d('0x88'),qs[_0x485d('0x89')](_0x56630f))['or'](_0x485d('0x8a'),_0x56630f+'%');}}}_0x544fd7[_0x485d('0x45')](_0x308660);_0x544fd7['group']('i.id');var _0x418eb6={'type':db['Sequelize'][_0x485d('0x8b')][_0x485d('0x8c')],'raw':!![]};var _0x46f57a=_0x544fd7[_0x485d('0x8d')]();_0x46f57a[_0x485d('0x46')](_0x485d('0x8e'));_0x46f57a[_0x485d('0x46')](_0x485d('0x8f'),'unreadMessages');if(_0x34a73d[_0x485d('0x43')]){_0x34a73d['order'][_0x485d('0x33')](function(_0x12b501){var _0x1e5ac4=_0x12b501[0x0]===_0x485d('0x90')?_0x12b501[0x0]:'i.'+_0x12b501[0x0];_0x544fd7[_0x485d('0x43')](_0x1e5ac4,_0x12b501[0x1]===_0x485d('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x3d5efc)){_0x544fd7[_0x485d('0x61')](_0x547bbd);_0x46f57a[_0x485d('0x45')](_0x485d('0x92'),_0x3d5efc);}BPromise[_0x485d('0x93')]()[_0x485d('0x35')](function(){if(!_0x316dd4){if(_0x4a2d30[_0x485d('0x3b')][_0x485d('0x78')])return;_0x46f57a[_0x485d('0x45')](_0x485d('0x94'));_0x544fd7['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4a2d30['user']['role']!==_0x485d('0x95'))return;return _0x4a2d30[_0x485d('0x96')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x485d('0x35')](function(_0x13e240){if(_[_0x485d('0x77')](_0x13e240)){_0x46f57a[_0x485d('0x45')](_0x485d('0x97'));_0x544fd7['where'](_0x485d('0x97'));}else{_0x46f57a['where'](_0x485d('0x79'),_[_0x485d('0x30')](_0x13e240,'id'));_0x544fd7[_0x485d('0x45')]('i.SmsAccountId\x20IN\x20?',_[_0x485d('0x30')](_0x13e240,'id'));}});})[_0x485d('0x35')](function(){if(_0x4a2d30[_0x485d('0x96')][_0x485d('0x98')]===_0x485d('0x95')&&!_0x316dd4&&!_0x4a2d30[_0x485d('0x3b')]['SmsAccountId'])return[];return db[_0x485d('0x99')][_0x485d('0x3b')](_0x46f57a[_0x485d('0x9a')](),_0x418eb6);})[_0x485d('0x35')](function(_0x2e575c){_0x966caf[_0x485d('0x23')]=_0x2e575c[_0x485d('0x9b')];if(_0x966caf[_0x485d('0x23')]===0x0)return[];return db[_0x485d('0x99')][_0x485d('0x3b')](_0x4a57ac['toString'](),_0x418eb6)[_0x485d('0x35')](function(_0x33e710){_0xdcba75=_['keyBy'](_0x33e710,'id');_0x418eb6=_[_0x485d('0x9c')](_0x418eb6,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a2d30[_0x485d('0x3b')][_0x485d('0x40')]){_0x34a73d['attributes'][_0x485d('0x33')](function(_0x18018e){_0x544fd7[_0x485d('0x46')]('i.'+_0x18018e);});}else{_0x544fd7['field'](_0x485d('0x8f'),'unreadMessages');_0x544fd7[_0x485d('0x46')](_0x485d('0x9d'),'Account.key');_0x544fd7[_0x485d('0x46')](_0x485d('0x9e'),_0x485d('0x9f'));_0x544fd7['field'](_0x485d('0xa0'),_0x485d('0x90'));_0x544fd7[_0x485d('0x46')](_0x485d('0xa1'));_0x544fd7['field'](_0x485d('0xa2'),_0x485d('0xa3'));_0x544fd7['field'](_0x485d('0xa4'),_0x485d('0xa5'));_0x544fd7['field']('c.email',_0x485d('0xa6'));_0x544fd7[_0x485d('0x46')]('c.phone',_0x485d('0xa7'));_0x544fd7[_0x485d('0x46')](_0x485d('0xa8'),_0x485d('0xa9'));_0x544fd7[_0x485d('0x46')](_0x485d('0xaa'),_0x485d('0xab'));_0x544fd7['field'](_0x485d('0xac'),_0x485d('0xad'));_0x544fd7[_0x485d('0x46')]('o.internal',_0x485d('0xae'));_0x544fd7[_0x485d('0x46')](_0x485d('0xaf'),_0x485d('0x31'));}if(_0x34a73d[_0x485d('0x22')])_0x544fd7[_0x485d('0x22')](_0x34a73d['limit']);if(_0x34a73d['offset'])_0x544fd7[_0x485d('0x24')](_0x34a73d[_0x485d('0x24')]);return db[_0x485d('0x99')][_0x485d('0x3b')](_0x544fd7[_0x485d('0x9a')](),_0x418eb6);})[_0x485d('0x35')](function(_0x3fd51e){if(_0x3fd51e[_0x485d('0x9b')]>0x0)_0x1aa7a3['where'](_0x485d('0xb0'),_[_0x485d('0x30')](_0x3fd51e,'id'));return db[_0x485d('0x99')]['query'](_0x1aa7a3[_0x485d('0x9a')](),_0x418eb6)[_0x485d('0x35')](function(_0x174546){var _0x1dc1b0=_[_0x485d('0xb1')](_0x174546,'SmsInteractionId');var _0x1b9ea6=[];_0x3fd51e[_0x485d('0x33')](function(_0x30fa5b){_0x1b9ea6[_0x485d('0x34')](updateSmsInteraction(_0x30fa5b,_0xdcba75,_0x1dc1b0));});return BPromise['all'](_0x1b9ea6);});});})['then'](function(_0x3c9794){_0x966caf[_0x485d('0xb2')]=_0x3c9794;return _0x966caf;})[_0x485d('0x35')](respondWithFilteredResult(_0x547997,_0x34a73d))[_0x485d('0x36')](handleError(_0x547997,null));};exports[_0x485d('0xb3')]=function(_0x46873e,_0x42c7f0){var _0x57d587={'raw':![],'where':{'id':_0x46873e[_0x485d('0xb4')]['id']}},_0x36ffdd={};_0x36ffdd[_0x485d('0x3d')]=_['keys'](db[_0x485d('0x38')][_0x485d('0x39')]);_0x36ffdd[_0x485d('0x3b')]=_['keys'](_0x46873e[_0x485d('0x3b')]);_0x36ffdd['filters']=_[_0x485d('0x3f')](_0x36ffdd[_0x485d('0x3d')],_0x36ffdd[_0x485d('0x3b')]);_0x57d587['attributes']=_['intersection'](_0x36ffdd['model'],qs[_0x485d('0x40')](_0x46873e[_0x485d('0x3b')]['fields']));_0x57d587[_0x485d('0x3e')]=_0x57d587[_0x485d('0x3e')][_0x485d('0x9b')]?_0x57d587['attributes']:_0x36ffdd[_0x485d('0x3d')];if(_0x46873e[_0x485d('0x3b')][_0x485d('0xb5')]){_0x57d587[_0x485d('0xb6')]=[{'all':!![]}];}_0x57d587=_[_0x485d('0x9c')]({},_0x57d587,_0x46873e[_0x485d('0xb7')]);return db[_0x485d('0x38')][_0x485d('0x5e')](_0x57d587)['then'](handleEntityNotFound(_0x42c7f0,null))['then'](respondWithResult(_0x42c7f0,null))[_0x485d('0x36')](handleError(_0x42c7f0,null));};exports['create']=function(_0x39bad9,_0x3e6cd9){return db[_0x485d('0x38')][_0x485d('0xb8')](_0x39bad9[_0x485d('0xb9')],{})[_0x485d('0x35')](respondWithResult(_0x3e6cd9,0xc9))['catch'](handleError(_0x3e6cd9,null));};exports[_0x485d('0xba')]=function(_0x1e1362,_0x412380){if(_0x1e1362[_0x485d('0xb9')]['id']){delete _0x1e1362[_0x485d('0xb9')]['id'];}return db[_0x485d('0x38')]['find']({'where':{'id':_0x1e1362[_0x485d('0xb4')]['id']}})['then'](handleEntityNotFound(_0x412380,null))[_0x485d('0x35')](saveUpdates(_0x1e1362[_0x485d('0xb9')],null))[_0x485d('0x35')](respondWithResult(_0x412380,null))[_0x485d('0x36')](handleError(_0x412380,null));};exports[_0x485d('0x2a')]=function(_0x1a615c,_0x5ef141){return db[_0x485d('0x38')]['find']({'where':{'id':_0x1a615c[_0x485d('0xb4')]['id']}})['then'](handleEntityNotFound(_0x5ef141,null))[_0x485d('0x35')](removeEntity(_0x5ef141,null))[_0x485d('0x36')](handleError(_0x5ef141,null));};exports[_0x485d('0xbb')]=function(_0x476a04,_0x4d5ef5){return db['SmsInteraction'][_0x485d('0xbb')]()[_0x485d('0x35')](respondWithResult(_0x4d5ef5,null))[_0x485d('0x36')](handleError(_0x4d5ef5,null));};exports['addMessage']=function(_0x47f486,_0x3f6e39,_0x196d96){return db[_0x485d('0xbc')][_0x485d('0x5e')]({'where':{'id':_0x47f486[_0x485d('0xb4')]['id']}})[_0x485d('0x35')](handleEntityNotFound(_0x3f6e39,null))[_0x485d('0x35')](function(_0x12c1eb){if(_0x12c1eb){return _0x12c1eb['addMessage'](_0x47f486[_0x485d('0xb9')]['ids'],_[_0x485d('0xbd')](_0x47f486[_0x485d('0xb9')],[_0x485d('0xbe'),'id'])||{});}})[_0x485d('0x35')](respondWithResult(_0x3f6e39,null))['catch'](handleError(_0x3f6e39,null));};exports['getMessages']=function(_0x38a424,_0x357272,_0x1e455b){var _0xeb1711={'raw':![],'where':{}};var _0x5b55bd={};var _0x32564d={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x485d('0xbf')]({'where':{'id':_0x38a424[_0x485d('0xb4')]['id']}})[_0x485d('0x35')](handleEntityNotFound(_0x357272,null))[_0x485d('0x35')](function(_0x33a519){if(_0x33a519){_0x5b55bd['model']=_[_0x485d('0xc0')](db[_0x485d('0xbc')][_0x485d('0x39')]);_0x5b55bd[_0x485d('0x3b')]=_['keys'](_0x38a424[_0x485d('0x3b')]);_0x5b55bd[_0x485d('0x3c')]=_[_0x485d('0x3f')](_0x5b55bd['model'],_0x5b55bd[_0x485d('0x3b')]);_0xeb1711[_0x485d('0x3e')]=_[_0x485d('0x3f')](_0x5b55bd[_0x485d('0x3d')],qs[_0x485d('0x40')](_0x38a424[_0x485d('0x3b')][_0x485d('0x40')]));_0xeb1711[_0x485d('0x3e')]=_0xeb1711['attributes'][_0x485d('0x9b')]?_0xeb1711[_0x485d('0x3e')]:_0x5b55bd[_0x485d('0x3d')];if(!_0x38a424[_0x485d('0x3b')]['hasOwnProperty'](_0x485d('0x42'))){_0xeb1711[_0x485d('0x22')]=qs[_0x485d('0x22')](_0x38a424[_0x485d('0x3b')][_0x485d('0x22')]);_0xeb1711[_0x485d('0x24')]=qs[_0x485d('0x24')](_0x38a424['query'][_0x485d('0x24')]);}_0xeb1711['order']=qs['sort'](_0x38a424[_0x485d('0x3b')][_0x485d('0x44')]);_0xeb1711['where']=qs['filters'](_[_0x485d('0xc1')](_0x38a424[_0x485d('0x3b')],_0x5b55bd[_0x485d('0x3c')]));_0xeb1711[_0x485d('0x45')][_0x485d('0xc2')]=_0x33a519['id'];if(_0x38a424['query'][_0x485d('0x84')]){_0xeb1711[_0x485d('0x45')]=_['merge'](_0xeb1711[_0x485d('0x45')],{'$or':_[_0x485d('0x30')](_0xeb1711[_0x485d('0x3e')],function(_0x369807){var _0x9df16c={};_0x9df16c[_0x369807]={'$like':'%'+_0x38a424[_0x485d('0x3b')]['filter']+'%'};return _0x9df16c;})});}if(_0x38a424[_0x485d('0x3b')]['$gte']){var _0x1db969=_0x38a424[_0x485d('0x3b')]['$gte'][_0x485d('0x66')](',');var _0x1c2dc9={};_0x1c2dc9[_0x1db969[0x0]]={'$gte':moment(_0x1db969[0x1])[_0x485d('0xc3')](_0x485d('0xc4'))};_0xeb1711[_0x485d('0x45')]=_[_0x485d('0x9c')](_0xeb1711[_0x485d('0x45')],_0x1c2dc9);}_0xeb1711=_['merge']({},_0xeb1711,_0x38a424[_0x485d('0xb7')]);return db[_0x485d('0xbc')]['count']({'where':_0xeb1711[_0x485d('0x45')]})[_0x485d('0x35')](function(_0x3a3b06){_0x32564d[_0x485d('0x23')]=_0x3a3b06;if(_0x38a424[_0x485d('0x3b')][_0x485d('0xb5')]){_0xeb1711[_0x485d('0xb6')]=[{'all':!![]}];}return db[_0x485d('0xbc')][_0x485d('0xc5')](_0xeb1711);})[_0x485d('0x35')](function(_0x45c248){_0x32564d[_0x485d('0xb2')]=_0x45c248;return _0x32564d;});}})[_0x485d('0x35')](respondWithFilteredResult(_0x357272,_0xeb1711))['catch'](handleError(_0x357272,null));};exports[_0x485d('0xc6')]=function(_0x39996d,_0x57fe91,_0x41d770){return db['SmsInteraction'][_0x485d('0x5e')]({'where':{'id':_0x39996d[_0x485d('0xb4')]['id']}})[_0x485d('0x35')](handleEntityNotFound(_0x57fe91,null))[_0x485d('0x35')](function(_0x583012){if(_0x583012){return _0x583012['setTags'](_0x39996d[_0x485d('0xb9')][_0x485d('0xbe')],_[_0x485d('0xbd')](_0x39996d['body'],['ids','id'])||{})['spread'](function(){return db[_0x485d('0x6e')][_0x485d('0xc5')]({'attributes':['id',_0x485d('0x2d'),_0x485d('0x47')],'where':{'id':_0x39996d[_0x485d('0xb9')]['ids']}});})['then'](function(_0xe8c44b){socket[_0x485d('0xc7')]('smsInteractionTags:save',{'id':Number(_0x39996d[_0x485d('0xb4')]['id']),'tags':_0xe8c44b||[]});return{'id':Number(_0x39996d[_0x485d('0xb4')]['id']),'tags':_0xe8c44b||[]};});}})[_0x485d('0x35')](respondWithResult(_0x57fe91,null))[_0x485d('0x36')](handleError(_0x57fe91,null));};exports[_0x485d('0xc8')]=function(_0x3389ca,_0xd2da48,_0x5d913e){return db[_0x485d('0x38')][_0x485d('0x5e')]({'where':{'id':_0x3389ca[_0x485d('0xb4')]['id']}})[_0x485d('0x35')](handleEntityNotFound(_0xd2da48,null))['then'](function(_0x19af27){if(_0x19af27){return _0x19af27[_0x485d('0xc8')](_0x3389ca[_0x485d('0x3b')][_0x485d('0xbe')]);}})[_0x485d('0x35')](respondWithStatusCode(_0xd2da48,null))[_0x485d('0x36')](handleError(_0xd2da48,null));};exports[_0x485d('0xc9')]=function(_0x3d4c7a,_0x51ca3b){var _0x1752e9=moment()[_0x485d('0xca')]()[_0x485d('0x9a')]();var _0x2dc53d=path['join'](config[_0x485d('0xcb')],_0x485d('0xcc'),'files',_0x485d('0xcd'));var _0x5f1cdd=path['join'](config['root'],'server',_0x485d('0xce'),_0x485d('0xcf'));var _0x3d5ba1=path[_0x485d('0xd0')](_0x2dc53d,_0x1752e9);var _0x212a43=util['format']('transcript-%d-%s.zip',_0x3d4c7a[_0x485d('0xb4')]['id'],_0x1752e9);var _0x4655c4=path['join'](_0x2dc53d,_0x212a43);var _0x5a2e53=[];_0x5a2e53['push']({'model':db[_0x485d('0x71')],'as':'User','attributes':['id',_0x485d('0xd1')],'raw':!![]});_0x5a2e53['push']({'model':db[_0x485d('0xd2')],'as':'Contact','attributes':['id',_0x485d('0xd3'),_0x485d('0xd4')],'raw':!![]});var _0x270bac=[{'model':db[_0x485d('0xbc')],'as':_0x485d('0xd5'),'attributes':['id','body',_0x485d('0x7a'),_0x485d('0xd6'),_0x485d('0xd7'),_0x485d('0x80')],'include':_0x5a2e53}];_0x270bac[_0x485d('0x34')]({'model':db[_0x485d('0xd8')],'as':_0x485d('0xd9'),'attributes':['id',_0x485d('0x2d')]});_0x270bac[_0x485d('0x34')]({'model':db['User'],'as':_0x485d('0xda'),'attributes':['id',_0x485d('0xd1')]});return db[_0x485d('0x38')][_0x485d('0x5e')]({'where':{'id':_0x3d4c7a[_0x485d('0xb4')]['id']},'include':_0x270bac})[_0x485d('0x35')](handleEntityNotFound(_0x51ca3b,null))['then'](function(_0x114474){if(_0x114474){var _0x151f4e=_0x114474[_0x485d('0xdb')]({'plain':!![]});fs['mkdirSync'](_0x3d5ba1);var _0xf49aa3={'channel':_0x485d('0xdc'),'account':_0x151f4e[_0x485d('0xd9')][_0x485d('0x2d')],'agent':_0x151f4e[_0x485d('0xda')]?_0x151f4e['Owner'][_0x485d('0xd1')]:_0x485d('0xdd'),'createdAt':moment(_0x151f4e[_0x485d('0x7a')])[_0x485d('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x485d('0x9a')](),'closedAt':_0x151f4e[_0x485d('0xde')]?moment(_0x151f4e[_0x485d('0xdf')])['format'](_0x485d('0xc4'))['toString']():'','disposition':_0x151f4e[_0x485d('0xe0')],'messages':_(_0x151f4e[_0x485d('0xd5')])[_0x485d('0x84')]({'secret':![]})[_0x485d('0x30')](function(_0x3c7f2f){return{'date':moment(_0x3c7f2f[_0x485d('0x7a')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x485d('0x9a')](),'sender':_0x3c7f2f[_0x485d('0xd6')]===_0x485d('0xe1')?_0x3c7f2f[_0x485d('0x71')]?_0x3c7f2f[_0x485d('0x71')][_0x485d('0xd1')]:_0x485d('0xe2'):_0x3c7f2f[_0x485d('0x64')][_0x485d('0xd3')]+(_0x3c7f2f[_0x485d('0x64')][_0x485d('0xd4')]?'\x20'+_0x3c7f2f[_0x485d('0x64')][_0x485d('0xd4')]:''),'body':_0x3c7f2f['body'],'direction':_0x3c7f2f['direction']===_0x485d('0xe1')?'A':'C','secret':_0x3c7f2f[_0x485d('0xd7')],'read':_0x3c7f2f['read']};})[_0x485d('0x60')]()};return ejs[_0x485d('0xe3')](path[_0x485d('0xd0')](config['root'],'server',_0x485d('0xe4'),_0x485d('0xe5')),{'interaction':_0xf49aa3})['then'](function(_0x34b017){var _0x366d5c=path[_0x485d('0xd0')](_0x3d5ba1,_0x485d('0xe6')+_0x151f4e['id']+'-'+_0x1752e9+'.pdf');var _0x9f57da={'path':_0x366d5c,'channel':_0x485d('0xdc'),'interactionId':_0x151f4e['id']};return pdf['createPdfFromHTML'](_0x34b017,_0x9f57da);})[_0x485d('0x35')](function(){return new BPromise(function(_0x26e7ff,_0x304322){zipdir(_0x3d5ba1,{'saveTo':_0x4655c4},function(_0x12fdbc,_0x3722b4){if(_0x12fdbc)return _0x304322(_0x12fdbc);return _0x26e7ff(_0x3722b4);});})[_0x485d('0x35')](function(){return new BPromise(function(_0x399771,_0x53eb40){rimraf(_0x3d5ba1,function(_0x240c82){if(_0x240c82)_0x53eb40(_0x240c82);return _0x399771();});});})[_0x485d('0x35')](function(){return _0x51ca3b[_0x485d('0xc9')](_0x4655c4,_0x212a43,function(_0x25fa39){if(_0x25fa39){console[_0x485d('0xe7')](_0x485d('0xe8'),_0x25fa39);}else{fs[_0x485d('0xe9')](_0x4655c4);}});});});}else{return _0x51ca3b[_0x485d('0x1e')](0xc8);}})[_0x485d('0x36')](handleError(_0x51ca3b,null));}; \ No newline at end of file +var _0x365c=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','index','SmsInteraction','rawAttributes','fieldName','model','name','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body','type','some','compact','isEmpty','SmsAccountId','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','omit','hasOwnProperty','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','emit','smsInteractionTags:save','removeTags','download','unix','root','files','tmp','server','attachments','join','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Messages','direction','secret','Owner','Sms','Account','N.A.','format','closed','closedAt','disposition','System','out','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format'];(function(_0x10bb45,_0xa57a18){var _0x4f1846=function(_0x319b89){while(--_0x319b89){_0x10bb45['push'](_0x10bb45['shift']());}};_0x4f1846(++_0xa57a18);}(_0x365c,0x1d5));var _0xc365=function(_0x10827d,_0x225e28){_0x10827d=_0x10827d-0x0;var _0xb66642=_0x365c[_0x10827d];return _0xb66642;};'use strict';var emlformat=require(_0xc365('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc365('0x1'));var jsonpatch=require(_0xc365('0x2'));var rp=require(_0xc365('0x3'));var moment=require('moment');var BPromise=require(_0xc365('0x4'));var Mustache=require(_0xc365('0x5'));var util=require(_0xc365('0x6'));var path=require(_0xc365('0x7'));var sox=require(_0xc365('0x8'));var csv=require(_0xc365('0x9'));var ejs=require(_0xc365('0xa'));var fs=require('fs');var fs_extra=require(_0xc365('0xb'));var _=require(_0xc365('0xc'));var squel=require(_0xc365('0xd'));var crypto=require(_0xc365('0xe'));var jsforce=require(_0xc365('0xf'));var deskjs=require(_0xc365('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc365('0x11'));var Papa=require('papaparse');var Redis=require(_0xc365('0x12'));var authService=require(_0xc365('0x13'));var qs=require(_0xc365('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0xc365('0x15'));var logger=require(_0xc365('0x16'))(_0xc365('0x17'));var utils=require(_0xc365('0x18'));var config=require(_0xc365('0x19'));var licenseUtil=require(_0xc365('0x1a'));var db=require(_0xc365('0x1b'))['db'];config['redis']=_['defaults'](config[_0xc365('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xc365('0x1d'))(new Redis(config[_0xc365('0x1c')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1541a3,_0x46cd38){_0x46cd38=_0x46cd38||0xcc;return function(_0x401e61){if(_0x401e61){return _0x1541a3['sendStatus'](_0x46cd38);}return _0x1541a3[_0xc365('0x1e')](_0x46cd38)[_0xc365('0x1f')]();};}function respondWithResult(_0x51418d,_0x319118){_0x319118=_0x319118||0xc8;return function(_0x11412d){if(_0x11412d){return _0x51418d[_0xc365('0x1e')](_0x319118)[_0xc365('0x20')](_0x11412d);}};}function respondWithFilteredResult(_0x44d9dd,_0x43e6e7){return function(_0x4c8ad3){if(_0x4c8ad3){var _0x3868ae=typeof _0x43e6e7[_0xc365('0x21')]===_0xc365('0x22')&&typeof _0x43e6e7['limit']===_0xc365('0x22');var _0x508251=_0x4c8ad3[_0xc365('0x23')];var _0x3f24d4=_0x3868ae?0x0:_0x43e6e7[_0xc365('0x21')];var _0x372161=_0x3868ae?_0x4c8ad3[_0xc365('0x23')]:_0x43e6e7['offset']+_0x43e6e7[_0xc365('0x24')];var _0x3f546a;if(_0x372161>=_0x508251){_0x372161=_0x508251;_0x3f546a=0xc8;}else{_0x3f546a=0xce;}_0x44d9dd['status'](_0x3f546a);return _0x44d9dd[_0xc365('0x25')]('Content-Range',_0x3f24d4+'-'+_0x372161+'/'+_0x508251)[_0xc365('0x20')](_0x4c8ad3);}return null;};}function patchUpdates(_0x3216b7){return function(_0x3da8f4){try{jsonpatch[_0xc365('0x26')](_0x3da8f4,_0x3216b7,!![]);}catch(_0x4d1802){return BPromise[_0xc365('0x27')](_0x4d1802);}return _0x3da8f4[_0xc365('0x28')]();};}function saveUpdates(_0x1dc294,_0x835de3){return function(_0x404444){if(_0x404444){return _0x404444[_0xc365('0x29')](_0x1dc294)[_0xc365('0x2a')](function(_0x597d50){return _0x597d50;});}return null;};}function removeEntity(_0x53fa6d,_0x292abb){return function(_0x9a0c3a){if(_0x9a0c3a){return _0x9a0c3a[_0xc365('0x2b')]()[_0xc365('0x2a')](function(){_0x53fa6d[_0xc365('0x1e')](0xcc)[_0xc365('0x1f')]();});}};}function handleEntityNotFound(_0x30390d,_0x5db930){return function(_0x30ba15){if(!_0x30ba15){_0x30390d[_0xc365('0x2c')](0x194);}return _0x30ba15;};}function handleError(_0x4b500e,_0x2136a4){_0x2136a4=_0x2136a4||0x1f4;return function(_0x5f184e){logger[_0xc365('0x2d')](_0x5f184e[_0xc365('0x2e')]);if(_0x5f184e['name']){delete _0x5f184e['name'];}_0x4b500e['status'](_0x2136a4)['send'](_0x5f184e);};}function getInteractionUsers(_0x238f64,_0x139902){return new BPromise(function(_0x426ad4,_0x450e2e){try{if(_0x139902[_0x238f64['id']]){_0x238f64[_0xc365('0x2f')]=_[_0xc365('0x30')](_0x139902[_0x238f64['id']],function(_0x14f140){return{'id':_0x14f140['id'],'fullname':_0x14f140[_0xc365('0x31')]};});}}catch(_0x2e477f){_0x450e2e(_0x2e477f);}_0x426ad4(_0x238f64);});}function getInteractionTags(_0x208842,_0x22bf6d){return new BPromise(function(_0x3a78b6,_0x2be9f0){try{if(_0x208842[_0xc365('0x32')]){_0x208842['Tags']=[];_0x208842[_0xc365('0x32')][_0xc365('0x33')](',')[_0xc365('0x34')](function(_0x52576b){_0x208842[_0xc365('0x35')][_0xc365('0x36')](_0x22bf6d[_0x52576b]);});}delete _0x208842[_0xc365('0x32')];}catch(_0x4d620a){_0x2be9f0(_0x4d620a);}_0x3a78b6(_0x208842);});}function updateSmsInteraction(_0x1db093,_0x497d9f,_0x27a23d){return new BPromise(function(_0x37bbc6,_0x3e03b4){return getInteractionUsers(_0x1db093,_0x27a23d)['then'](function(_0x1d5252){return getInteractionTags(_0x1d5252,_0x497d9f);})[_0xc365('0x2a')](function(_0x411d8d){_0x37bbc6(_0x411d8d);})[_0xc365('0x37')](function(_0x234796){_0x3e03b4(_0x234796);});});}exports[_0xc365('0x38')]=function(_0x2d729d,_0x22c127){var _0x209468={},_0x2ad4ba={},_0x90e004={'count':0x0,'rows':[]};var _0x2466a3=_[_0xc365('0x30')](db[_0xc365('0x39')][_0xc365('0x3a')],function(_0xf360d5){return{'name':_0xf360d5[_0xc365('0x3b')],'type':_0xf360d5['type']['key']};});_0x2ad4ba[_0xc365('0x3c')]=_['map'](_0x2466a3,_0xc365('0x3d'));_0x2ad4ba[_0xc365('0x3e')]=_[_0xc365('0x3f')](_0x2d729d[_0xc365('0x3e')]);_0x2ad4ba[_0xc365('0x40')]=_['intersection'](_0x2ad4ba[_0xc365('0x3c')],_0x2ad4ba[_0xc365('0x3e')]);_0x209468[_0xc365('0x41')]=_[_0xc365('0x42')](_0x2ad4ba[_0xc365('0x3c')],qs[_0xc365('0x43')](_0x2d729d[_0xc365('0x3e')][_0xc365('0x43')]));_0x209468[_0xc365('0x41')]=_0x209468['attributes'][_0xc365('0x44')]?_0x209468[_0xc365('0x41')]:_0x2ad4ba['model'];if(!_0x2d729d[_0xc365('0x3e')]['hasOwnProperty']('nolimit')){_0x209468[_0xc365('0x24')]=qs[_0xc365('0x24')](_0x2d729d[_0xc365('0x3e')][_0xc365('0x24')]);_0x209468[_0xc365('0x21')]=qs['offset'](_0x2d729d['query'][_0xc365('0x21')]);}_0x209468[_0xc365('0x45')]=qs[_0xc365('0x46')](_0x2d729d[_0xc365('0x3e')]['sort']);_0x209468[_0xc365('0x47')]=qs[_0xc365('0x40')](_[_0xc365('0x48')](_0x2d729d[_0xc365('0x3e')],_0x2ad4ba['filters']),_0x2466a3);var _0x1d51b4=[];var _0x2144a8=squel[_0xc365('0x49')]()[_0xc365('0x4a')]('id')[_0xc365('0x4a')](_0xc365('0x3d'))[_0xc365('0x4a')](_0xc365('0x4b'))[_0xc365('0x4c')](_0xc365('0x4d'));var _0x314186=squel[_0xc365('0x49')]()[_0xc365('0x4a')](_0xc365('0x4e'))[_0xc365('0x4a')](_0xc365('0x4f'))['field']('ui.SmsInteractionId')[_0xc365('0x4c')](_0xc365('0x50'),'ui')[_0xc365('0x51')](_0xc365('0x52'),'u',_0xc365('0x53'));var _0x3c786b=squel[_0xc365('0x49')]()['from'](_0xc365('0x54'),'i')[_0xc365('0x51')]('cm_contacts','c',_0xc365('0x55'))[_0xc365('0x51')](_0xc365('0x52'),'o',_0xc365('0x56'))[_0xc365('0x51')]('sms_accounts','a',_0xc365('0x57'))[_0xc365('0x51')]('sms_messages','me',_0xc365('0x58'))[_0xc365('0x51')](_0xc365('0x59'),'it',_0xc365('0x5a'))[_0xc365('0x51')]('tools_tags','t',_0xc365('0x5b'));var _0x26a500=squel[_0xc365('0x5c')]();var _0x1b5759=[];var _0x338b05=squel[_0xc365('0x5c')]();var _0x500ae1;if(_0x2d729d[_0xc365('0x3e')][_0xc365('0x5d')]){_0x500ae1=as['parseSearch'](_0x2d729d['query'][_0xc365('0x5d')]);var _0x45cb46=_0x500ae1[_0xc365('0x5e')];for(var _0x2b1410=0x0;_0x2b1410<_0x500ae1[_0xc365('0x5f')][_0xc365('0x44')];_0x2b1410++){var _0x12c97b=_0x500ae1['conditions'][_0x2b1410];var _0x46dc7a='i';var _0x46f48d=_['find'](_0x2466a3,['name',_0x12c97b[_0xc365('0x4a')]]);if(!_0x46f48d){switch(_0x12c97b[_0xc365('0x4a')]){case _0xc365('0x60'):if(_0x12c97b[_0xc365('0x61')]==0x1){_0x3c786b['having']('`'+_0x12c97b[_0xc365('0x4a')]+'`\x20=\x200');}else{_0x3c786b[_0xc365('0x62')]('`'+_0x12c97b[_0xc365('0x4a')]+_0xc365('0x63'));}break;case'Contact':if(_0x12c97b[_0xc365('0x64')]===_0xc365('0x65')){if(_0x12c97b['value'][_0xc365('0x33')]('\x20')[_0xc365('0x44')]>0x1){_0x26a500[_0x45cb46](_0xc365('0x66'),qs[_0xc365('0x67')](_0x12c97b[_0xc365('0x61')]),null);}else{var _0x30f183='%'+_0x12c97b[_0xc365('0x61')]+'%';_0x26a500[_0x45cb46](_0xc365('0x68'),_0x30f183,_0x30f183,_0x30f183);}}else{_0x46f48d=_[_0xc365('0x69')](_0x2466a3,[_0xc365('0x3d'),_0xc365('0x6a')]);_0x12c97b['field']=_0xc365('0x6a');_0x3d0256=as['buildExpression'](_0x46dc7a,_0x46f48d['type'],_0x12c97b);_0x26a500[_0x45cb46](_0x3d0256['text'],_0x3d0256[_0xc365('0x61')][_0xc365('0x6b')],_0x3d0256[_0xc365('0x61')][_0xc365('0x1f')]);}break;case _0xc365('0x6c'):var _0x81dbba=_0x12c97b[_0xc365('0x61')][_0xc365('0x33')](',')[_0xc365('0x30')](function(_0x34f324){return Number(_0x34f324);});_0x81dbba[_0xc365('0x34')](function(_0x5a8779){_0x338b05['or'](_0xc365('0x6d'),'%,'+_0x5a8779+',%');});_0x1b5759=_[_0xc365('0x6e')](_0x1b5759,_0x81dbba);break;case _0xc365('0x6f'):if(_0x12c97b[_0xc365('0x64')]===_0xc365('0x65')){_0x26a500[_0x45cb46](_0xc365('0x70'),'%'+_0x12c97b[_0xc365('0x61')]+'%',null);}else{_0x46f48d=_[_0xc365('0x69')](_0x2466a3,[_0xc365('0x3d'),_0xc365('0x71')]);_0x12c97b['field']='UserId';_0x3d0256=as[_0xc365('0x72')](_0x46dc7a,_0x46f48d['type'],_0x12c97b);_0x26a500[_0x45cb46](_0x3d0256[_0xc365('0x73')],_0x3d0256[_0xc365('0x61')][_0xc365('0x6b')],_0x3d0256['value'][_0xc365('0x1f')]);}break;case _0xc365('0x74'):_0x3d0256=as[_0xc365('0x72')]('me',null,_0x12c97b);_0x26a500[_0x45cb46](_0x3d0256[_0xc365('0x73')],_0x3d0256['value']['start'],_0x3d0256[_0xc365('0x61')][_0xc365('0x1f')]);break;}}else{var _0x3d0256=as[_0xc365('0x72')](_0x46dc7a,_0x46f48d[_0xc365('0x75')],_0x12c97b);_0x26a500[_0x45cb46](_0x3d0256[_0xc365('0x73')],_0x3d0256['value'][_0xc365('0x6b')],_0x3d0256[_0xc365('0x61')][_0xc365('0x1f')]);}}}else{var _0x8743db=_(_0x2d729d[_0xc365('0x3e')])['keys']()[_0xc365('0x30')](function(_0x63ff5b){return _[_0xc365('0x76')](_0x2466a3,[_0xc365('0x3d'),_0x63ff5b])?_0x63ff5b:undefined;})[_0xc365('0x77')]()[_0xc365('0x61')]();if(!_[_0xc365('0x78')](_0x8743db)){_0x8743db[_0xc365('0x34')](function(_0xfe97e8){if(_0xfe97e8===_0xc365('0x79')){_0x3c786b['where']('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x2d729d['query'][_0xfe97e8]));}else if(_0xfe97e8===_0xc365('0x7a')){var _0x37fb44=JSON[_0xc365('0x7b')](_0x2d729d[_0xc365('0x3e')][_0xfe97e8])['$gte'];var _0xbd027b=JSON[_0xc365('0x7b')](_0x2d729d[_0xc365('0x3e')][_0xfe97e8])[_0xc365('0x7c')];_0x3c786b[_0xc365('0x47')](_0xc365('0x7d'),_0x37fb44,_0xbd027b);}else{if(_0x2d729d['query'][_0xfe97e8]===_0xc365('0x7e')){_0x3c786b[_0xc365('0x47')]('i.'+_0xfe97e8+'\x20IS\x20NULL');}else{_0x3c786b[_0xc365('0x47')]('i.'+_0xfe97e8+'\x20=\x20?',_0x2d729d[_0xc365('0x3e')][_0xfe97e8]);}}});}if(_0x2d729d['query'][_0xc365('0x7f')]){if(_0x2d729d['query']['read']==0x1){_0x3c786b[_0xc365('0x62')](_0xc365('0x80'));}else{_0x3c786b[_0xc365('0x62')](_0xc365('0x81'));}}if(_0x2d729d[_0xc365('0x3e')][_0xc365('0x82')]){_0x1b5759=_[_0xc365('0x83')](_0x2d729d[_0xc365('0x3e')][_0xc365('0x82')])?_0x2d729d[_0xc365('0x3e')][_0xc365('0x82')]:new Array(_0x2d729d[_0xc365('0x3e')][_0xc365('0x82')]);_0x1b5759[_0xc365('0x34')](function(_0x3b1e6e){_0x338b05['or'](_0xc365('0x6d'),'%,'+_0x3b1e6e+',%');});}if(_0x2d729d[_0xc365('0x3e')]['filter']){var _0x54cd0c=_0x2d729d['query'][_0xc365('0x84')][_0xc365('0x85')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc365('0x86')](_0x54cd0c)){_0x26a500['or'](_0xc365('0x87'),_0x54cd0c+'%')['or'](_0xc365('0x88'),_0x54cd0c+'%');}else{_0x26a500['or'](_0xc365('0x89'),qs['getFullTextValue'](_0x54cd0c))['or'](_0xc365('0x8a'),_0x54cd0c+'%');}}}_0x3c786b[_0xc365('0x47')](_0x26a500);_0x3c786b['group'](_0xc365('0x8b'));var _0xce16ff={'type':db[_0xc365('0x8c')][_0xc365('0x8d')]['SELECT'],'raw':!![]};var _0x4b2f0c=_0x3c786b[_0xc365('0x8e')]();_0x4b2f0c[_0xc365('0x4a')](_0xc365('0x8b'));_0x4b2f0c['field'](_0xc365('0x8f'),_0xc365('0x60'));if(_0x209468[_0xc365('0x45')]){_0x209468[_0xc365('0x45')][_0xc365('0x34')](function(_0x1808b2){var _0x42d9b7=_0x1808b2[0x0]===_0xc365('0x90')?_0x1808b2[0x0]:'i.'+_0x1808b2[0x0];_0x3c786b[_0xc365('0x45')](_0x42d9b7,_0x1808b2[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc365('0x78')](_0x1b5759)){_0x3c786b[_0xc365('0x62')](_0x338b05);_0x4b2f0c['where']('t.id\x20IN\x20?',_0x1b5759);}BPromise[_0xc365('0x91')]()[_0xc365('0x2a')](function(){if(!_0x500ae1){if(_0x2d729d[_0xc365('0x3e')]['SmsAccountId'])return;_0x4b2f0c[_0xc365('0x47')](_0xc365('0x92'));_0x3c786b[_0xc365('0x47')](_0xc365('0x92'));return;}if(_0x2d729d['user'][_0xc365('0x93')]!==_0xc365('0x94'))return;return _0x2d729d[_0xc365('0x95')][_0xc365('0x96')]({'attributes':['id'],'raw':!![]})[_0xc365('0x2a')](function(_0xc55ce7){if(_['isEmpty'](_0xc55ce7)){_0x4b2f0c[_0xc365('0x47')](_0xc365('0x97'));_0x3c786b['where'](_0xc365('0x97'));}else{_0x4b2f0c[_0xc365('0x47')](_0xc365('0x98'),_[_0xc365('0x30')](_0xc55ce7,'id'));_0x3c786b[_0xc365('0x47')](_0xc365('0x98'),_[_0xc365('0x30')](_0xc55ce7,'id'));}});})['then'](function(){if(_0x2d729d[_0xc365('0x95')][_0xc365('0x93')]===_0xc365('0x94')&&!_0x500ae1&&!_0x2d729d[_0xc365('0x3e')][_0xc365('0x79')])return[];return db[_0xc365('0x99')][_0xc365('0x3e')](_0x4b2f0c[_0xc365('0x9a')](),_0xce16ff);})[_0xc365('0x2a')](function(_0x35ac88){_0x90e004[_0xc365('0x23')]=_0x35ac88[_0xc365('0x44')];if(_0x90e004[_0xc365('0x23')]===0x0)return[];return db[_0xc365('0x99')][_0xc365('0x3e')](_0x2144a8[_0xc365('0x9a')](),_0xce16ff)[_0xc365('0x2a')](function(_0x1ac017){_0x1d51b4=_[_0xc365('0x9b')](_0x1ac017,'id');_0xce16ff=_[_0xc365('0x9c')](_0xce16ff,{'model':db[_0xc365('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d729d[_0xc365('0x3e')][_0xc365('0x43')]){_0x209468['attributes']['forEach'](function(_0x42233c){_0x3c786b['field']('i.'+_0x42233c);});}else{_0x3c786b[_0xc365('0x4a')](_0xc365('0x8f'),_0xc365('0x60'));_0x3c786b[_0xc365('0x4a')](_0xc365('0x9d'),_0xc365('0x9e'));_0x3c786b['field'](_0xc365('0x9f'),'Account.mandatoryDisposition');_0x3c786b[_0xc365('0x4a')](_0xc365('0xa0'),_0xc365('0x90'));_0x3c786b['field']('i.*');_0x3c786b[_0xc365('0x4a')](_0xc365('0xa1'),_0xc365('0xa2'));_0x3c786b[_0xc365('0x4a')](_0xc365('0xa3'),_0xc365('0xa4'));_0x3c786b['field'](_0xc365('0xa5'),_0xc365('0xa6'));_0x3c786b[_0xc365('0x4a')](_0xc365('0xa7'),_0xc365('0xa8'));_0x3c786b[_0xc365('0x4a')](_0xc365('0xa9'),_0xc365('0xaa'));_0x3c786b[_0xc365('0x4a')](_0xc365('0xab'),'Contact.fax');_0x3c786b[_0xc365('0x4a')](_0xc365('0xac'),_0xc365('0xad'));_0x3c786b[_0xc365('0x4a')](_0xc365('0xae'),_0xc365('0xaf'));_0x3c786b[_0xc365('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc365('0x32'));}if(_0x209468[_0xc365('0x24')])_0x3c786b[_0xc365('0x24')](_0x209468['limit']);if(_0x209468['offset'])_0x3c786b['offset'](_0x209468['offset']);return db[_0xc365('0x99')][_0xc365('0x3e')](_0x3c786b[_0xc365('0x9a')](),_0xce16ff);})[_0xc365('0x2a')](function(_0x406494){if(_0x406494[_0xc365('0x44')]>0x0)_0x314186['where'](_0xc365('0xb0'),_[_0xc365('0x30')](_0x406494,'id'));return db['sequelize'][_0xc365('0x3e')](_0x314186[_0xc365('0x9a')](),_0xce16ff)[_0xc365('0x2a')](function(_0x3cfc84){var _0x93a3c=_[_0xc365('0xb1')](_0x3cfc84,_0xc365('0xb2'));var _0x18be54=[];_0x406494[_0xc365('0x34')](function(_0x2ceb49){_0x18be54['push'](updateSmsInteraction(_0x2ceb49,_0x1d51b4,_0x93a3c));});return BPromise[_0xc365('0xb3')](_0x18be54);});});})[_0xc365('0x2a')](function(_0x4bac14){_0x90e004[_0xc365('0xb4')]=_0x4bac14;return _0x90e004;})[_0xc365('0x2a')](respondWithFilteredResult(_0x22c127,_0x209468))[_0xc365('0x37')](handleError(_0x22c127,null));};exports[_0xc365('0xb5')]=function(_0x4a7de2,_0x465e38){var _0x698ccd={'raw':![],'where':{'id':_0x4a7de2[_0xc365('0xb6')]['id']}},_0x27f56f={};_0x27f56f[_0xc365('0x3c')]=_['keys'](db[_0xc365('0x39')][_0xc365('0x3a')]);_0x27f56f[_0xc365('0x3e')]=_[_0xc365('0x3f')](_0x4a7de2[_0xc365('0x3e')]);_0x27f56f[_0xc365('0x40')]=_[_0xc365('0x42')](_0x27f56f[_0xc365('0x3c')],_0x27f56f['query']);_0x698ccd[_0xc365('0x41')]=_[_0xc365('0x42')](_0x27f56f[_0xc365('0x3c')],qs[_0xc365('0x43')](_0x4a7de2[_0xc365('0x3e')][_0xc365('0x43')]));_0x698ccd[_0xc365('0x41')]=_0x698ccd[_0xc365('0x41')][_0xc365('0x44')]?_0x698ccd[_0xc365('0x41')]:_0x27f56f[_0xc365('0x3c')];if(_0x4a7de2[_0xc365('0x3e')][_0xc365('0xb7')]){_0x698ccd[_0xc365('0xb8')]=[{'all':!![]}];}_0x698ccd=_[_0xc365('0x9c')]({},_0x698ccd,_0x4a7de2[_0xc365('0xb9')]);return db['SmsInteraction'][_0xc365('0x69')](_0x698ccd)[_0xc365('0x2a')](handleEntityNotFound(_0x465e38,null))[_0xc365('0x2a')](respondWithResult(_0x465e38,null))[_0xc365('0x37')](handleError(_0x465e38,null));};exports[_0xc365('0xba')]=function(_0x41bd59,_0x5fb802){return db['SmsInteraction']['create'](_0x41bd59[_0xc365('0x74')],{})[_0xc365('0x2a')](respondWithResult(_0x5fb802,0xc9))[_0xc365('0x37')](handleError(_0x5fb802,null));};exports[_0xc365('0x29')]=function(_0x50a2e8,_0x2681e7){if(_0x50a2e8['body']['id']){delete _0x50a2e8[_0xc365('0x74')]['id'];}return db['SmsInteraction'][_0xc365('0x69')]({'where':{'id':_0x50a2e8[_0xc365('0xb6')]['id']}})[_0xc365('0x2a')](handleEntityNotFound(_0x2681e7,null))[_0xc365('0x2a')](saveUpdates(_0x50a2e8[_0xc365('0x74')],null))[_0xc365('0x2a')](respondWithResult(_0x2681e7,null))['catch'](handleError(_0x2681e7,null));};exports[_0xc365('0x2b')]=function(_0x4b421b,_0x3bb456){return db['SmsInteraction']['find']({'where':{'id':_0x4b421b[_0xc365('0xb6')]['id']}})[_0xc365('0x2a')](handleEntityNotFound(_0x3bb456,null))['then'](removeEntity(_0x3bb456,null))['catch'](handleError(_0x3bb456,null));};exports[_0xc365('0xbb')]=function(_0x47712a,_0x2859a7){return db[_0xc365('0x39')][_0xc365('0xbb')]()[_0xc365('0x2a')](respondWithResult(_0x2859a7,null))[_0xc365('0x37')](handleError(_0x2859a7,null));};exports[_0xc365('0xbc')]=function(_0x43245,_0x583a0c,_0x15dfb0){return db[_0xc365('0xbd')][_0xc365('0x69')]({'where':{'id':_0x43245[_0xc365('0xb6')]['id']}})['then'](handleEntityNotFound(_0x583a0c,null))['then'](function(_0x1a4f8c){if(_0x1a4f8c){return _0x1a4f8c[_0xc365('0xbc')](_0x43245[_0xc365('0x74')][_0xc365('0xbe')],_[_0xc365('0xbf')](_0x43245['body'],[_0xc365('0xbe'),'id'])||{});}})[_0xc365('0x2a')](respondWithResult(_0x583a0c,null))['catch'](handleError(_0x583a0c,null));};exports['getMessages']=function(_0x5f6064,_0x4d71c4,_0x9c4d1){var _0x36fa06={'raw':![],'where':{}};var _0x612f11={};var _0x344ba9={'count':0x0,'rows':[]};return db[_0xc365('0x39')]['findOne']({'where':{'id':_0x5f6064['params']['id']}})[_0xc365('0x2a')](handleEntityNotFound(_0x4d71c4,null))[_0xc365('0x2a')](function(_0x5b41ac){if(_0x5b41ac){_0x612f11[_0xc365('0x3c')]=_[_0xc365('0x3f')](db[_0xc365('0xbd')][_0xc365('0x3a')]);_0x612f11[_0xc365('0x3e')]=_[_0xc365('0x3f')](_0x5f6064['query']);_0x612f11[_0xc365('0x40')]=_[_0xc365('0x42')](_0x612f11['model'],_0x612f11[_0xc365('0x3e')]);_0x36fa06[_0xc365('0x41')]=_[_0xc365('0x42')](_0x612f11[_0xc365('0x3c')],qs[_0xc365('0x43')](_0x5f6064['query']['fields']));_0x36fa06[_0xc365('0x41')]=_0x36fa06[_0xc365('0x41')]['length']?_0x36fa06[_0xc365('0x41')]:_0x612f11['model'];if(!_0x5f6064[_0xc365('0x3e')][_0xc365('0xc0')]('nolimit')){_0x36fa06[_0xc365('0x24')]=qs[_0xc365('0x24')](_0x5f6064[_0xc365('0x3e')][_0xc365('0x24')]);_0x36fa06[_0xc365('0x21')]=qs[_0xc365('0x21')](_0x5f6064['query']['offset']);}_0x36fa06[_0xc365('0x45')]=qs[_0xc365('0x46')](_0x5f6064['query']['sort']);_0x36fa06[_0xc365('0x47')]=qs[_0xc365('0x40')](_[_0xc365('0x48')](_0x5f6064[_0xc365('0x3e')],_0x612f11['filters']));_0x36fa06[_0xc365('0x47')][_0xc365('0xb2')]=_0x5b41ac['id'];if(_0x5f6064[_0xc365('0x3e')]['filter']){_0x36fa06['where']=_['merge'](_0x36fa06[_0xc365('0x47')],{'$or':_[_0xc365('0x30')](_0x36fa06[_0xc365('0x41')],function(_0x30d09c){var _0x4577a0={};_0x4577a0[_0x30d09c]={'$like':'%'+_0x5f6064[_0xc365('0x3e')][_0xc365('0x84')]+'%'};return _0x4577a0;})});}if(_0x5f6064[_0xc365('0x3e')][_0xc365('0xc1')]){var _0x33f2b8=_0x5f6064[_0xc365('0x3e')][_0xc365('0xc1')][_0xc365('0x33')](',');var _0xf7dd4={};_0xf7dd4[_0x33f2b8[0x0]]={'$gte':moment(_0x33f2b8[0x1])['format'](_0xc365('0xc2'))};_0x36fa06[_0xc365('0x47')]=_[_0xc365('0x9c')](_0x36fa06[_0xc365('0x47')],_0xf7dd4);}_0x36fa06=_[_0xc365('0x9c')]({},_0x36fa06,_0x5f6064['options']);return db[_0xc365('0xbd')][_0xc365('0x23')]({'where':_0x36fa06[_0xc365('0x47')]})[_0xc365('0x2a')](function(_0x571225){_0x344ba9[_0xc365('0x23')]=_0x571225;if(_0x5f6064[_0xc365('0x3e')][_0xc365('0xb7')]){_0x36fa06[_0xc365('0xb8')]=[{'all':!![]}];}return db[_0xc365('0xbd')][_0xc365('0xc3')](_0x36fa06);})[_0xc365('0x2a')](function(_0x26f116){_0x344ba9[_0xc365('0xb4')]=_0x26f116;return _0x344ba9;});}})[_0xc365('0x2a')](respondWithFilteredResult(_0x4d71c4,_0x36fa06))['catch'](handleError(_0x4d71c4,null));};exports[_0xc365('0xc4')]=function(_0x2d9e1d,_0x2dae2d,_0x4cf38e){return db[_0xc365('0x39')][_0xc365('0x69')]({'where':{'id':_0x2d9e1d[_0xc365('0xb6')]['id']}})[_0xc365('0x2a')](handleEntityNotFound(_0x2dae2d,null))[_0xc365('0x2a')](function(_0x5ef698){if(_0x5ef698){return _0x5ef698[_0xc365('0xc5')](_0x2d9e1d[_0xc365('0x74')]['ids'],_[_0xc365('0xbf')](_0x2d9e1d[_0xc365('0x74')],[_0xc365('0xbe'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0xc365('0x3d'),_0xc365('0x4b')],'where':{'id':_0x2d9e1d[_0xc365('0x74')]['ids']}});})[_0xc365('0x2a')](function(_0x26a7a2){socket[_0xc365('0xc6')](_0xc365('0xc7'),{'id':Number(_0x2d9e1d[_0xc365('0xb6')]['id']),'tags':_0x26a7a2||[]});return{'id':Number(_0x2d9e1d[_0xc365('0xb6')]['id']),'tags':_0x26a7a2||[]};});}})[_0xc365('0x2a')](respondWithResult(_0x2dae2d,null))[_0xc365('0x37')](handleError(_0x2dae2d,null));};exports[_0xc365('0xc8')]=function(_0x14bf82,_0x5b5048,_0x534a4c){return db[_0xc365('0x39')][_0xc365('0x69')]({'where':{'id':_0x14bf82[_0xc365('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5b5048,null))[_0xc365('0x2a')](function(_0x3aeeb6){if(_0x3aeeb6){return _0x3aeeb6[_0xc365('0xc8')](_0x14bf82[_0xc365('0x3e')][_0xc365('0xbe')]);}})[_0xc365('0x2a')](respondWithStatusCode(_0x5b5048,null))[_0xc365('0x37')](handleError(_0x5b5048,null));};exports[_0xc365('0xc9')]=function(_0x4a70f2,_0xe44aa5){var _0x13d6ae=moment()[_0xc365('0xca')]()[_0xc365('0x9a')]();var _0x89febd=path['join'](config[_0xc365('0xcb')],'server',_0xc365('0xcc'),_0xc365('0xcd'));var _0x57d386=path['join'](config[_0xc365('0xcb')],_0xc365('0xce'),_0xc365('0xcc'),_0xc365('0xcf'));var _0x16133d=path[_0xc365('0xd0')](_0x89febd,_0x13d6ae);var _0x43c006=util['format'](_0xc365('0xd1'),_0x4a70f2[_0xc365('0xb6')]['id'],_0x13d6ae);var _0x557afa=path[_0xc365('0xd0')](_0x89febd,_0x43c006);var _0x27bba8=[];_0x27bba8[_0xc365('0x36')]({'model':db[_0xc365('0x6f')],'as':'User','attributes':['id',_0xc365('0x31')],'raw':!![]});_0x27bba8[_0xc365('0x36')]({'model':db[_0xc365('0xd2')],'as':_0xc365('0xd3'),'attributes':['id',_0xc365('0xd4'),_0xc365('0xd5')],'raw':!![]});var _0x3dcf80=[{'model':db[_0xc365('0xbd')],'as':_0xc365('0xd6'),'attributes':['id','body',_0xc365('0x7a'),_0xc365('0xd7'),_0xc365('0xd8'),_0xc365('0x7f')],'include':_0x27bba8}];_0x3dcf80[_0xc365('0x36')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x3dcf80['push']({'model':db[_0xc365('0x6f')],'as':_0xc365('0xd9'),'attributes':['id',_0xc365('0x31')]});return db[_0xc365('0x39')][_0xc365('0x69')]({'where':{'id':_0x4a70f2['params']['id']},'include':_0x3dcf80})[_0xc365('0x2a')](handleEntityNotFound(_0xe44aa5,null))['then'](function(_0x4d64ff){if(_0x4d64ff){var _0x52e8d9=_0x4d64ff['get']({'plain':!![]});fs['mkdirSync'](_0x16133d);var _0x5943f5={'channel':_0xc365('0xda'),'account':_0x52e8d9[_0xc365('0xdb')]['name'],'agent':_0x52e8d9[_0xc365('0xd9')]?_0x52e8d9['Owner'][_0xc365('0x31')]:_0xc365('0xdc'),'createdAt':moment(_0x52e8d9[_0xc365('0x7a')])[_0xc365('0xdd')](_0xc365('0xc2'))[_0xc365('0x9a')](),'closedAt':_0x52e8d9[_0xc365('0xde')]?moment(_0x52e8d9[_0xc365('0xdf')])[_0xc365('0xdd')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc365('0x9a')]():'','disposition':_0x52e8d9[_0xc365('0xe0')],'messages':_(_0x52e8d9['Messages'])['filter']({'secret':![]})['map'](function(_0x31077c){return{'date':moment(_0x31077c[_0xc365('0x7a')])['format'](_0xc365('0xc2'))[_0xc365('0x9a')](),'sender':_0x31077c[_0xc365('0xd7')]==='out'?_0x31077c[_0xc365('0x6f')]?_0x31077c['User']['fullname']:_0xc365('0xe1'):_0x31077c[_0xc365('0xd3')][_0xc365('0xd4')]+(_0x31077c['Contact'][_0xc365('0xd5')]?'\x20'+_0x31077c['Contact'][_0xc365('0xd5')]:''),'body':_0x31077c[_0xc365('0x74')],'direction':_0x31077c[_0xc365('0xd7')]===_0xc365('0xe2')?'A':'C','secret':_0x31077c[_0xc365('0xd8')],'read':_0x31077c[_0xc365('0x7f')]};})[_0xc365('0x61')]()};return ejs['renderFile'](path['join'](config[_0xc365('0xcb')],'server',_0xc365('0xe3'),_0xc365('0xe4')),{'interaction':_0x5943f5})['then'](function(_0x22b8d6){var _0x3c0696=path[_0xc365('0xd0')](_0x16133d,_0xc365('0xe5')+_0x52e8d9['id']+'-'+_0x13d6ae+_0xc365('0xe6'));var _0x1bfb27={'path':_0x3c0696,'channel':_0xc365('0xda'),'interactionId':_0x52e8d9['id']};return pdf[_0xc365('0xe7')](_0x22b8d6,_0x1bfb27);})[_0xc365('0x2a')](function(){return new BPromise(function(_0x10ec3b,_0x32e9c5){zipdir(_0x16133d,{'saveTo':_0x557afa},function(_0x308823,_0x360f9e){if(_0x308823)return _0x32e9c5(_0x308823);return _0x10ec3b(_0x360f9e);});})[_0xc365('0x2a')](function(){return new BPromise(function(_0x1cd016,_0x171496){rimraf(_0x16133d,function(_0x404f25){if(_0x404f25)_0x171496(_0x404f25);return _0x1cd016();});});})[_0xc365('0x2a')](function(){return _0xe44aa5['download'](_0x557afa,_0x43c006,function(_0x17e887){if(_0x17e887){console[_0xc365('0xe8')](_0xc365('0xe9'),_0x17e887);}else{fs[_0xc365('0xea')](_0x557afa);}});});});}else{return _0xe44aa5[_0xc365('0x2c')](0xc8);}})['catch'](handleError(_0xe44aa5,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index e8f5a43..2c470e8 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 _0x5464=['SmsMessage','save','remove','setDataValue','Users','map','findAll','then','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction'];(function(_0x1f5a03,_0x2ae18e){var _0x493275=function(_0x2a494d){while(--_0x2a494d){_0x1f5a03['push'](_0x1f5a03['shift']());}};_0x493275(++_0x2ae18e);}(_0x5464,0x15d));var _0x4546=function(_0x5d326a,_0x317350){_0x5d326a=_0x5d326a-0x0;var _0x299b86=_0x5464[_0x5d326a];return _0x299b86;};'use strict';var EventEmitter=require(_0x4546('0x0'));var SmsInteraction=require(_0x4546('0x1'))['db'][_0x4546('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x4546('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4546('0x4'),'afterUpdate':'update','afterDestroy':_0x4546('0x5')};function emitEvent(_0x396a1d){return function(_0xcc9def,_0x2b1a9b,_0x54228a){_0xcc9def['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x224c7c){_0xcc9def[_0x4546('0x6')](_0x4546('0x7'),_0x224c7c[_0x4546('0x8')](function(_0x2f0376){return{'id':_0x2f0376['id']};}));return SmsMessage[_0x4546('0x9')]({'where':{'SmsInteractionId':_0xcc9def['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4546('0xa')](function(_0x430b2e){_0xcc9def[_0x4546('0x6')]('unreadMessages',_0x430b2e[_0x4546('0xb')]);SmsInteractionEvents[_0x4546('0xc')](_0x396a1d+':'+_0xcc9def['id'],_0xcc9def);SmsInteractionEvents[_0x4546('0xc')](_0x396a1d,_0xcc9def);_0x54228a(null);})['catch'](_0x54228a(null));};}for(var e in events){if(events[_0x4546('0xd')](e)){var event=events[e];SmsInteraction[_0x4546('0xe')](e,emitEvent(event));}}module[_0x4546('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0xea28=['Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xea28,0x13a));var _0x8ea2=function(_0x482c06,_0x19242c){_0x482c06=_0x482c06-0x0;var _0x380633=_0xea28[_0x482c06];return _0x380633;};'use strict';var EventEmitter=require(_0x8ea2('0x0'));var SmsInteraction=require(_0x8ea2('0x1'))['db'][_0x8ea2('0x2')];var SmsMessage=require(_0x8ea2('0x1'))['db'][_0x8ea2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8ea2('0x4')](0x0);var events={'afterCreate':_0x8ea2('0x5'),'afterUpdate':_0x8ea2('0x6'),'afterDestroy':'remove'};function emitEvent(_0x9b45ab){return function(_0x23aaf1,_0x1ccf12,_0x513a0d){_0x23aaf1[_0x8ea2('0x7')]({'attributes':['id'],'raw':!![]})[_0x8ea2('0x8')](function(_0xb7f278){_0x23aaf1[_0x8ea2('0x9')](_0x8ea2('0xa'),_0xb7f278[_0x8ea2('0xb')](function(_0x19bd6c){return{'id':_0x19bd6c['id']};}));return SmsMessage[_0x8ea2('0xc')]({'where':{'SmsInteractionId':_0x23aaf1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8ea2('0x8')](function(_0x3000f9){_0x23aaf1[_0x8ea2('0x9')](_0x8ea2('0xd'),_0x3000f9['length']);SmsInteractionEvents['emit'](_0x9b45ab+':'+_0x23aaf1['id'],_0x23aaf1);SmsInteractionEvents[_0x8ea2('0xe')](_0x9b45ab,_0x23aaf1);_0x513a0d(null);})[_0x8ea2('0xf')](_0x513a0d(null));};}for(var e in events){if(events[_0x8ea2('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x8ea2('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 0d08282..61df272 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 _0x6370=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','changed'];(function(_0x5f18f5,_0x5afb39){var _0x550c6b=function(_0x33a042){while(--_0x33a042){_0x5f18f5['push'](_0x5f18f5['shift']());}};_0x550c6b(++_0x5afb39);}(_0x6370,0x174));var _0x0637=function(_0x2e5bb6,_0x4a569b){_0x2e5bb6=_0x2e5bb6-0x0;var _0xdae9ed=_0x6370[_0x2e5bb6];return _0xdae9ed;};'use strict';var _=require('lodash');var util=require(_0x0637('0x0'));var logger=require('../../config/logger')(_0x0637('0x1'));var moment=require(_0x0637('0x2'));var BPromise=require(_0x0637('0x3'));var rp=require(_0x0637('0x4'));var fs=require('fs');var path=require(_0x0637('0x5'));var rimraf=require(_0x0637('0x6'));var config=require(_0x0637('0x7'));var attributes=require(_0x0637('0x8'));module[_0x0637('0x9')]=function(_0x43310b,_0x1c7eef){return _0x43310b['define'](_0x0637('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16d2e9,_0x5a9af3,_0x427b54){if(_0x16d2e9[_0x0637('0xb')](_0x0637('0xc'))){_0x16d2e9[_0x0637('0xd')]=moment()[_0x0637('0xe')](_0x0637('0xf'));}_0x427b54(null,_0x16d2e9);}}});}; \ No newline at end of file +var _0xcb5a=['sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction'];(function(_0x42e9df,_0x4140e0){var _0x1f425a=function(_0x3dd725){while(--_0x3dd725){_0x42e9df['push'](_0x42e9df['shift']());}};_0x1f425a(++_0x4140e0);}(_0xcb5a,0x1eb));var _0xacb5=function(_0x96a8e6,_0x428f30){_0x96a8e6=_0x96a8e6-0x0;var _0x3029b0=_0xcb5a[_0x96a8e6];return _0x3029b0;};'use strict';var _=require(_0xacb5('0x0'));var util=require(_0xacb5('0x1'));var logger=require(_0xacb5('0x2'))(_0xacb5('0x3'));var moment=require(_0xacb5('0x4'));var BPromise=require(_0xacb5('0x5'));var rp=require(_0xacb5('0x6'));var fs=require('fs');var path=require(_0xacb5('0x7'));var rimraf=require(_0xacb5('0x8'));var config=require(_0xacb5('0x9'));var attributes=require(_0xacb5('0xa'));module[_0xacb5('0xb')]=function(_0x1be907,_0x580871){return _0x1be907['define'](_0xacb5('0xc'),attributes,{'tableName':_0xacb5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8228ae,_0x42c538,_0x1ab1ae){if(_0x8228ae[_0xacb5('0xe')]('closed')){_0x8228ae[_0xacb5('0xf')]=moment()[_0xacb5('0x10')](_0xacb5('0x11'));}_0x1ab1ae(null,_0x8228ae);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 57f9665..5f88df2 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 _0x5704=['SmsInteraction','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsInteraction.socket','request','info','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','UpdateSmsInteraction','body','options','raw','where','attributes','then','AddTagsToSmsInteraction'];(function(_0x1ca6cd,_0x39cc44){var _0x3ab126=function(_0x23355f){while(--_0x23355f){_0x1ca6cd['push'](_0x1ca6cd['shift']());}};_0x3ab126(++_0x39cc44);}(_0x5704,0x74));var _0x4570=function(_0x47292d,_0x574afd){_0x47292d=_0x47292d-0x0;var _0x1f343d=_0x5704[_0x47292d];return _0x1f343d;};'use strict';var _=require(_0x4570('0x0'));var util=require(_0x4570('0x1'));var moment=require(_0x4570('0x2'));var BPromise=require(_0x4570('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4570('0x4'));var logger=require(_0x4570('0x5'))(_0x4570('0x6'));var config=require('../../config/environment');var jayson=require(_0x4570('0x7'));var client=jayson[_0x4570('0x8')][_0x4570('0x9')]({'port':0x232a});config['redis']=_[_0x4570('0xa')](config[_0x4570('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4570('0xc'))(new Redis(config[_0x4570('0xb')]));require(_0x4570('0xd'))['register'](socket);function respondWithRpcPromise(_0x33eaa6,_0x49853b,_0x1cd57e){return new BPromise(function(_0x4899c5,_0x5520c7){return client[_0x4570('0xe')](_0x33eaa6,_0x1cd57e)['then'](function(_0x28c624){logger[_0x4570('0xf')](_0x4570('0x10'),_0x49853b,'request\x20sent');logger[_0x4570('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x49853b,_0x4570('0x12'),JSON[_0x4570('0x13')](_0x28c624));if(_0x28c624[_0x4570('0x14')]){if(_0x28c624['error'][_0x4570('0x15')]===0x1f4){logger[_0x4570('0x14')](_0x4570('0x10'),_0x49853b,_0x28c624[_0x4570('0x14')][_0x4570('0x16')]);return _0x5520c7(_0x28c624[_0x4570('0x14')][_0x4570('0x16')]);}logger[_0x4570('0x14')](_0x4570('0x10'),_0x49853b,_0x28c624[_0x4570('0x14')][_0x4570('0x16')]);return _0x4899c5(_0x28c624[_0x4570('0x14')]['message']);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x49853b,_0x4570('0x12'));_0x4899c5(_0x28c624['result'][_0x4570('0x16')]);}})[_0x4570('0x17')](function(_0x18d2d3){logger[_0x4570('0x14')](_0x4570('0x10'),_0x49853b,_0x18d2d3);_0x5520c7(_0x18d2d3);});});}exports[_0x4570('0x18')]=function(_0x308de2){var _0x208025=this;return new Promise(function(_0x5d5983,_0x35995d){return db['SmsInteraction']['update'](_0x308de2[_0x4570('0x19')],{'raw':_0x308de2['options']?_0x308de2[_0x4570('0x1a')][_0x4570('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x308de2[_0x4570('0x1a')]?_0x308de2[_0x4570('0x1a')][_0x4570('0x1c')]||null:null,'attributes':_0x308de2[_0x4570('0x1a')]?_0x308de2[_0x4570('0x1a')][_0x4570('0x1d')]||null:null,'limit':_0x308de2['options']?_0x308de2['options']['limit']||null:null})[_0x4570('0x1e')](function(_0x5bb1dd){logger[_0x4570('0xf')](_0x4570('0x18'),_0x308de2);logger[_0x4570('0x11')]('UpdateSmsInteraction',_0x308de2,JSON[_0x4570('0x13')](_0x5bb1dd));_0x5d5983(_0x5bb1dd);})[_0x4570('0x17')](function(_0x50d210){logger[_0x4570('0x14')]('UpdateSmsInteraction',_0x50d210['message'],_0x308de2);_0x35995d(_0x208025[_0x4570('0x14')](0x1f4,_0x50d210[_0x4570('0x16')]));});});};exports[_0x4570('0x1f')]=function(_0x17f59e){return new Promise(function(_0x5dce3d,_0x5a0b4d){return db[_0x4570('0x20')]['find']({'where':_0x17f59e['options']?_0x17f59e[_0x4570('0x1a')][_0x4570('0x1c')]||null:null})[_0x4570('0x1e')](function(_0x3fae4c){if(_0x3fae4c){return _0x3fae4c[_0x4570('0x21')](_0x17f59e[_0x4570('0x19')][_0x4570('0x22')],_['omit'](_0x17f59e[_0x4570('0x19')],[_0x4570('0x22'),'id'])||{});}})[_0x4570('0x23')](function(_0x1c6baa){logger[_0x4570('0xf')](_0x4570('0x24'),_0x17f59e);logger['debug'](_0x4570('0x24'),_0x17f59e,JSON[_0x4570('0x13')](_0x1c6baa));_0x5dce3d(_0x1c6baa);})[_0x4570('0x17')](function(_0x473098){logger[_0x4570('0x14')](_0x4570('0x24'),_0x473098[_0x4570('0x16')],_0x17f59e);_0x5a0b4d(_this[_0x4570('0x14')](0x1f4,_0x473098[_0x4570('0x16')]));});});}; \ No newline at end of file +var _0xcebe=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x369f2a,_0x3d05f4){var _0x2f4e0f=function(_0x4432bc){while(--_0x4432bc){_0x369f2a['push'](_0x369f2a['shift']());}};_0x2f4e0f(++_0x3d05f4);}(_0xcebe,0x153));var _0xeceb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xcebe[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xeceb('0x0'));var util=require('util');var moment=require(_0xeceb('0x1'));var BPromise=require(_0xeceb('0x2'));var rs=require(_0xeceb('0x3'));var fs=require('fs');var Redis=require(_0xeceb('0x4'));var db=require(_0xeceb('0x5'))['db'];var utils=require(_0xeceb('0x6'));var logger=require(_0xeceb('0x7'))(_0xeceb('0x8'));var config=require(_0xeceb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeceb('0xa')][_0xeceb('0xb')]({'port':0x232a});config[_0xeceb('0xc')]=_['defaults'](config[_0xeceb('0xc')],{'host':_0xeceb('0xd'),'port':0x18eb});var socket=require(_0xeceb('0xe'))(new Redis(config[_0xeceb('0xc')]));require('./smsInteraction.socket')[_0xeceb('0xf')](socket);function respondWithRpcPromise(_0x1d327d,_0x2d17a9,_0x2fbd17){return new BPromise(function(_0x3c6891,_0x3aff45){return client[_0xeceb('0x10')](_0x1d327d,_0x2fbd17)[_0xeceb('0x11')](function(_0x237af3){logger[_0xeceb('0x12')](_0xeceb('0x13'),_0x2d17a9,_0xeceb('0x14'));logger[_0xeceb('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2d17a9,'request\x20sent',JSON[_0xeceb('0x16')](_0x237af3));if(_0x237af3[_0xeceb('0x17')]){if(_0x237af3['error'][_0xeceb('0x18')]===0x1f4){logger[_0xeceb('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x2d17a9,_0x237af3[_0xeceb('0x17')][_0xeceb('0x19')]);return _0x3aff45(_0x237af3[_0xeceb('0x17')][_0xeceb('0x19')]);}logger[_0xeceb('0x17')](_0xeceb('0x13'),_0x2d17a9,_0x237af3[_0xeceb('0x17')][_0xeceb('0x19')]);return _0x3c6891(_0x237af3['error']['message']);}else{logger[_0xeceb('0x12')](_0xeceb('0x13'),_0x2d17a9,_0xeceb('0x14'));_0x3c6891(_0x237af3[_0xeceb('0x1a')]['message']);}})[_0xeceb('0x1b')](function(_0x284bc9){logger['error'](_0xeceb('0x13'),_0x2d17a9,_0x284bc9);_0x3aff45(_0x284bc9);});});}exports[_0xeceb('0x1c')]=function(_0x27639c){var _0x237ecb=this;return new Promise(function(_0x4332f7,_0x2cbbe4){return db[_0xeceb('0x1d')][_0xeceb('0x1e')](_0x27639c[_0xeceb('0x1f')],{'raw':_0x27639c[_0xeceb('0x20')]?_0x27639c[_0xeceb('0x20')][_0xeceb('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27639c['options']?_0x27639c[_0xeceb('0x20')][_0xeceb('0x22')]||null:null,'attributes':_0x27639c[_0xeceb('0x20')]?_0x27639c[_0xeceb('0x20')][_0xeceb('0x23')]||null:null,'limit':_0x27639c[_0xeceb('0x20')]?_0x27639c['options']['limit']||null:null})[_0xeceb('0x11')](function(_0x382ce2){logger[_0xeceb('0x12')]('UpdateSmsInteraction',_0x27639c);logger[_0xeceb('0x15')](_0xeceb('0x1c'),_0x27639c,JSON[_0xeceb('0x16')](_0x382ce2));_0x4332f7(_0x382ce2);})['catch'](function(_0x20df57){logger['error'](_0xeceb('0x1c'),_0x20df57['message'],_0x27639c);_0x2cbbe4(_0x237ecb[_0xeceb('0x17')](0x1f4,_0x20df57[_0xeceb('0x19')]));});});};exports[_0xeceb('0x24')]=function(_0x161ffe){return new Promise(function(_0x15a1bd,_0x594435){return db[_0xeceb('0x1d')][_0xeceb('0x25')]({'where':_0x161ffe[_0xeceb('0x20')]?_0x161ffe['options'][_0xeceb('0x22')]||null:null})[_0xeceb('0x11')](function(_0x57bfec){if(_0x57bfec){return _0x57bfec[_0xeceb('0x26')](_0x161ffe[_0xeceb('0x1f')][_0xeceb('0x27')],_[_0xeceb('0x28')](_0x161ffe['body'],['ids','id'])||{});}})[_0xeceb('0x29')](function(_0x2d6404){logger[_0xeceb('0x12')](_0xeceb('0x2a'),_0x161ffe);logger[_0xeceb('0x15')](_0xeceb('0x2a'),_0x161ffe,JSON[_0xeceb('0x16')](_0x2d6404));_0x15a1bd(_0x2d6404);})[_0xeceb('0x1b')](function(_0x30bbfc){logger[_0xeceb('0x17')](_0xeceb('0x2a'),_0x30bbfc[_0xeceb('0x19')],_0x161ffe);_0x594435(_this[_0xeceb('0x17')](0x1f4,_0x30bbfc[_0xeceb('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 799fdcb..ff079a3 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 _0xf68d=['save','remove','update','register','length','smsInteraction:'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf68d,0x16e));var _0xdf68=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xf68d[_0x5608a3];return _0x1ed50a;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xdf68('0x0'),_0xdf68('0x1'),_0xdf68('0x2')];function createListener(_0x26bea9,_0xc4d4ff){return function(_0x4fea90){_0xc4d4ff['emit'](_0x26bea9,_0x4fea90);};}function removeListener(_0x12bed5,_0x47c1d0){return function(){SmsInteractionEvents['removeListener'](_0x12bed5,_0x47c1d0);};}exports[_0xdf68('0x3')]=function(_0x5b6da5){for(var _0xbb5d73=0x0,_0x5923e0=events[_0xdf68('0x4')];_0xbb5d73<_0x5923e0;_0xbb5d73++){var _0x3cf4f4=events[_0xbb5d73];var _0x4cda35=createListener(_0xdf68('0x5')+_0x3cf4f4,_0x5b6da5);SmsInteractionEvents['on'](_0x3cf4f4,_0x4cda35);}}; \ No newline at end of file +var _0x7203=['emit','removeListener','length','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x33d1ea,_0x799ae5){var _0x54a5cf=function(_0x5bc91c){while(--_0x5bc91c){_0x33d1ea['push'](_0x33d1ea['shift']());}};_0x54a5cf(++_0x799ae5);}(_0x7203,0x123));var _0x3720=function(_0x2891c3,_0x4caed3){_0x2891c3=_0x2891c3-0x0;var _0x17690a=_0x7203[_0x2891c3];return _0x17690a;};'use strict';var SmsInteractionEvents=require(_0x3720('0x0'));var events=[_0x3720('0x1'),_0x3720('0x2'),'update'];function createListener(_0x25934d,_0x111051){return function(_0x557036){_0x111051[_0x3720('0x3')](_0x25934d,_0x557036);};}function removeListener(_0x392077,_0x7153af){return function(){SmsInteractionEvents[_0x3720('0x4')](_0x392077,_0x7153af);};}exports['register']=function(_0x5df16b){for(var _0x10a0db=0x0,_0x5b0e68=events[_0x3720('0x5')];_0x10a0db<_0x5b0e68;_0x10a0db++){var _0x1c6e68=events[_0x10a0db];var _0x31dc7b=createListener(_0x3720('0x6')+_0x1c6e68,_0x5df16b);SmsInteractionEvents['on'](_0x1c6e68,_0x31dc7b);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 651636c..08b42aa 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 _0xf894=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path'];(function(_0x523043,_0x46ef36){var _0x591178=function(_0x2f57d4){while(--_0x2f57d4){_0x523043['push'](_0x523043['shift']());}};_0x591178(++_0x46ef36);}(_0xf894,0xfd));var _0x4f89=function(_0x241a7d,_0x4db396){_0x241a7d=_0x241a7d-0x0;var _0x3d95fa=_0xf894[_0x241a7d];return _0x3d95fa;};'use strict';var multer=require(_0x4f89('0x0'));var util=require(_0x4f89('0x1'));var path=require(_0x4f89('0x2'));var timeout=require(_0x4f89('0x3'));var express=require(_0x4f89('0x4'));var router=express[_0x4f89('0x5')]();var fs_extra=require(_0x4f89('0x6'));var auth=require(_0x4f89('0x7'));var interaction=require(_0x4f89('0x8'));var config=require(_0x4f89('0x9'));var controller=require(_0x4f89('0xa'));router[_0x4f89('0xb')]('/',auth[_0x4f89('0xc')](),controller[_0x4f89('0xd')]);router[_0x4f89('0xb')](_0x4f89('0xe'),auth[_0x4f89('0xc')](),controller[_0x4f89('0xf')]);router['get'](_0x4f89('0x10'),auth[_0x4f89('0xc')](),controller[_0x4f89('0x11')]);router[_0x4f89('0x12')]('/',auth[_0x4f89('0xc')](),interaction[_0x4f89('0x13')](_0x4f89('0x14'),'smsmessage:create'),controller['create']);router['post'](_0x4f89('0x15'),controller[_0x4f89('0x16')]);router['put'](_0x4f89('0x10'),auth[_0x4f89('0xc')](),controller[_0x4f89('0x17')]);router[_0x4f89('0x18')](_0x4f89('0x19'),auth[_0x4f89('0xc')](),controller[_0x4f89('0x1a')]);router[_0x4f89('0x18')](_0x4f89('0x1b'),auth['isAuthenticated'](),controller[_0x4f89('0x1c')]);router[_0x4f89('0x1d')](_0x4f89('0x10'),auth[_0x4f89('0xc')](),controller[_0x4f89('0x1e')]);module[_0x4f89('0x1f')]=router; \ No newline at end of file +var _0x3586=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id','update','accept','/:id/reject','reject','delete','exports'];(function(_0x2870b0,_0x3e94e0){var _0xd85b44=function(_0x545c32){while(--_0x545c32){_0x2870b0['push'](_0x2870b0['shift']());}};_0xd85b44(++_0x3e94e0);}(_0x3586,0x82));var _0x6358=function(_0x34799f,_0x3e2a3d){_0x34799f=_0x34799f-0x0;var _0x46b18b=_0x3586[_0x34799f];return _0x46b18b;};'use strict';var multer=require(_0x6358('0x0'));var util=require(_0x6358('0x1'));var path=require(_0x6358('0x2'));var timeout=require(_0x6358('0x3'));var express=require(_0x6358('0x4'));var router=express[_0x6358('0x5')]();var fs_extra=require(_0x6358('0x6'));var auth=require(_0x6358('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x6358('0x8')]('/',auth[_0x6358('0x9')](),controller[_0x6358('0xa')]);router[_0x6358('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x6358('0x9')](),controller[_0x6358('0xb')]);router[_0x6358('0xc')]('/',auth['isAuthenticated'](),interaction[_0x6358('0xd')](_0x6358('0xe'),_0x6358('0xf')),controller['create']);router[_0x6358('0xc')](_0x6358('0x10'),controller[_0x6358('0x11')]);router[_0x6358('0x12')](_0x6358('0x13'),auth[_0x6358('0x9')](),controller[_0x6358('0x14')]);router[_0x6358('0x12')]('/:id/accept',auth[_0x6358('0x9')](),controller[_0x6358('0x15')]);router['put'](_0x6358('0x16'),auth[_0x6358('0x9')](),controller[_0x6358('0x17')]);router[_0x6358('0x18')](_0x6358('0x13'),auth[_0x6358('0x9')](),controller['destroy']);module[_0x6358('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 434576e..dbad90e 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 _0x4e3d=['DATE','STRING','exports','medium','BOOLEAN','ENUM','out'];(function(_0x2b37b4,_0x37e90e){var _0x30f4cb=function(_0x290a01){while(--_0x290a01){_0x2b37b4['push'](_0x2b37b4['shift']());}};_0x30f4cb(++_0x37e90e);}(_0x4e3d,0x14b));var _0xd4e3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4e3d[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xd4e3('0x0')]={'body':{'type':Sequelize['TEXT'](_0xd4e3('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xd4e3('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd4e3('0x3')]('in',_0xd4e3('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xd4e3('0x5')]},'secret':{'type':Sequelize[_0xd4e3('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd4e3('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8bf8=['out','DATE','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x1ef4ac,_0x53dba5){var _0x440528=function(_0x411a15){while(--_0x411a15){_0x1ef4ac['push'](_0x1ef4ac['shift']());}};_0x440528(++_0x53dba5);}(_0x8bf8,0x11a));var _0x88bf=function(_0x4f91d1,_0x1a2451){_0x4f91d1=_0x4f91d1-0x0;var _0x382379=_0x8bf8[_0x4f91d1];return _0x382379;};'use strict';var Sequelize=require('sequelize');module[_0x88bf('0x0')]={'body':{'type':Sequelize[_0x88bf('0x1')](_0x88bf('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x88bf('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x88bf('0x4')]('in',_0x88bf('0x5')),'defaultValue':_0x88bf('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x88bf('0x6')]},'secret':{'type':Sequelize[_0x88bf('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x88bf('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1ccfca2..4b59d0e 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 _0x652a=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','SmsMessage','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','show','keys','rawAttributes','options','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','format','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','fullname','rejectmessage','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x36594d,_0x5aaa06){var _0x1b8802=function(_0x578cc9){while(--_0x578cc9){_0x36594d['push'](_0x36594d['shift']());}};_0x1b8802(++_0x5aaa06);}(_0x652a,0x1ae));var _0xa652=function(_0x1e49ee,_0x3257b6){_0x1e49ee=_0x1e49ee-0x0;var _0x3dcf1e=_0x652a[_0x1e49ee];return _0x3dcf1e;};'use strict';var emlformat=require(_0xa652('0x0'));var rimraf=require(_0xa652('0x1'));var zipdir=require(_0xa652('0x2'));var jsonpatch=require(_0xa652('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa652('0x4'));var Mustache=require(_0xa652('0x5'));var util=require(_0xa652('0x6'));var path=require(_0xa652('0x7'));var sox=require(_0xa652('0x8'));var csv=require('to-csv');var ejs=require(_0xa652('0x9'));var fs=require('fs');var fs_extra=require(_0xa652('0xa'));var _=require(_0xa652('0xb'));var squel=require(_0xa652('0xc'));var crypto=require(_0xa652('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa652('0xe'));var querystring=require(_0xa652('0xf'));var Papa=require(_0xa652('0x10'));var Redis=require(_0xa652('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa652('0x12'));var hardwareService=require(_0xa652('0x13'));var logger=require(_0xa652('0x14'))(_0xa652('0x15'));var utils=require(_0xa652('0x16'));var config=require(_0xa652('0x17'));var licenseUtil=require(_0xa652('0x18'));var db=require(_0xa652('0x19'))['db'];config[_0xa652('0x1a')]=_[_0xa652('0x1b')](config[_0xa652('0x1a')],{'host':_0xa652('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa652('0x1a')]));require('./smsMessage.socket')[_0xa652('0x1d')](socket);var jayson=require(_0xa652('0x1e'));var client=jayson[_0xa652('0x1f')][_0xa652('0x20')]({'port':0x232c});var client9002=jayson[_0xa652('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144b37,_0x1d7c4c,_0x334bc4,_0x46d9b7){return new BPromise(function(_0x15ff72,_0x3a3e16){var _0x212301=_0x46d9b7||client;return _0x212301['request'](_0x144b37,_0x334bc4)[_0xa652('0x21')](function(_0x1bdf34){logger[_0xa652('0x22')](_0xa652('0x23'),_0x1d7c4c,_0xa652('0x24'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1d7c4c,_0xa652('0x24'),JSON[_0xa652('0x25')](_0x1bdf34));if(_0x1bdf34['error']){if(_0x1bdf34[_0xa652('0x26')][_0xa652('0x27')]===0x1f4){logger[_0xa652('0x26')](_0xa652('0x23'),_0x1d7c4c,_0x1bdf34[_0xa652('0x26')][_0xa652('0x28')]);return _0x3a3e16(_0x1bdf34['error'][_0xa652('0x28')]);}logger[_0xa652('0x26')](_0xa652('0x23'),_0x1d7c4c,_0x1bdf34['error'][_0xa652('0x28')]);return _0x15ff72(_0x1bdf34[_0xa652('0x26')][_0xa652('0x28')]);}else{logger[_0xa652('0x22')](_0xa652('0x23'),_0x1d7c4c,_0xa652('0x24'));_0x15ff72(_0x1bdf34['result'][_0xa652('0x28')]);}})[_0xa652('0x29')](function(_0xcdd904){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1d7c4c,_0xcdd904);_0x3a3e16(_0xcdd904);});});}function respondWithStatusCode(_0x593883,_0x505862){_0x505862=_0x505862||0xcc;return function(_0x5071da){if(_0x5071da){return _0x593883['sendStatus'](_0x505862);}return _0x593883[_0xa652('0x2a')](_0x505862)['end']();};}function respondWithResult(_0x1c1b71,_0x13bce6){_0x13bce6=_0x13bce6||0xc8;return function(_0x593f68){if(_0x593f68){return _0x1c1b71[_0xa652('0x2a')](_0x13bce6)[_0xa652('0x2b')](_0x593f68);}};}function respondWithFilteredResult(_0x3af686,_0x21d6e3){return function(_0xe9931){if(_0xe9931){var _0x18e9cf=typeof _0x21d6e3[_0xa652('0x2c')]===_0xa652('0x2d')&&typeof _0x21d6e3[_0xa652('0x2e')]===_0xa652('0x2d');var _0x12890f=_0xe9931['count'];var _0x17a99e=_0x18e9cf?0x0:_0x21d6e3[_0xa652('0x2c')];var _0x1bc2a7=_0x18e9cf?_0xe9931[_0xa652('0x2f')]:_0x21d6e3['offset']+_0x21d6e3[_0xa652('0x2e')];var _0x58e25a;if(_0x1bc2a7>=_0x12890f){_0x1bc2a7=_0x12890f;_0x58e25a=0xc8;}else{_0x58e25a=0xce;}_0x3af686[_0xa652('0x2a')](_0x58e25a);return _0x3af686[_0xa652('0x30')](_0xa652('0x31'),_0x17a99e+'-'+_0x1bc2a7+'/'+_0x12890f)[_0xa652('0x2b')](_0xe9931);}return null;};}function patchUpdates(_0x46d10c){return function(_0x542324){try{jsonpatch[_0xa652('0x32')](_0x542324,_0x46d10c,!![]);}catch(_0x19d57d){return BPromise[_0xa652('0x33')](_0x19d57d);}return _0x542324['save']();};}function saveUpdates(_0x3af70b,_0x210163){return function(_0x50b804){if(_0x50b804){return _0x50b804[_0xa652('0x34')](_0x3af70b)[_0xa652('0x21')](function(_0x21b764){return _0x21b764;});}return null;};}function removeEntity(_0x392ce5,_0x2fd01a){return function(_0x35c6ae){if(_0x35c6ae){return _0x35c6ae[_0xa652('0x35')]()[_0xa652('0x21')](function(){_0x392ce5[_0xa652('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x549681,_0x5928be){return function(_0xf9e832){if(!_0xf9e832){_0x549681[_0xa652('0x36')](0x194);}return _0xf9e832;};}function handleError(_0x268929,_0x143f86){_0x143f86=_0x143f86||0x1f4;return function(_0x24ac29){logger['error'](_0x24ac29[_0xa652('0x37')]);if(_0x24ac29[_0xa652('0x38')]){delete _0x24ac29[_0xa652('0x38')];}_0x268929[_0xa652('0x2a')](_0x143f86)[_0xa652('0x39')](_0x24ac29);};}exports[_0xa652('0x3a')]=function(_0x30ce46,_0x1787e5){var _0x342942={},_0x20aa16={},_0xc83847={'count':0x0,'rows':[]};var _0x48034d=_[_0xa652('0x3b')](db[_0xa652('0x3c')]['rawAttributes'],function(_0x147cdd){return{'name':_0x147cdd[_0xa652('0x3d')],'type':_0x147cdd[_0xa652('0x3e')][_0xa652('0x3f')]};});_0x20aa16['model']=_[_0xa652('0x3b')](_0x48034d,_0xa652('0x38'));_0x20aa16[_0xa652('0x40')]=_['keys'](_0x30ce46[_0xa652('0x40')]);_0x20aa16['filters']=_[_0xa652('0x41')](_0x20aa16[_0xa652('0x42')],_0x20aa16[_0xa652('0x40')]);_0x342942[_0xa652('0x43')]=_['intersection'](_0x20aa16[_0xa652('0x42')],qs['fields'](_0x30ce46[_0xa652('0x40')][_0xa652('0x44')]));_0x342942['attributes']=_0x342942[_0xa652('0x43')][_0xa652('0x45')]?_0x342942[_0xa652('0x43')]:_0x20aa16[_0xa652('0x42')];if(!_0x30ce46[_0xa652('0x40')][_0xa652('0x46')](_0xa652('0x47'))){_0x342942[_0xa652('0x2e')]=qs['limit'](_0x30ce46[_0xa652('0x40')][_0xa652('0x2e')]);_0x342942[_0xa652('0x2c')]=qs[_0xa652('0x2c')](_0x30ce46[_0xa652('0x40')][_0xa652('0x2c')]);}_0x342942[_0xa652('0x48')]=qs['sort'](_0x30ce46[_0xa652('0x40')][_0xa652('0x49')]);_0x342942[_0xa652('0x4a')]=qs[_0xa652('0x4b')](_[_0xa652('0x4c')](_0x30ce46[_0xa652('0x40')],_0x20aa16[_0xa652('0x4b')]),_0x48034d);if(_0x30ce46[_0xa652('0x40')][_0xa652('0x4d')]){_0x342942[_0xa652('0x4a')]=_[_0xa652('0x4e')](_0x342942[_0xa652('0x4a')],{'$or':_[_0xa652('0x3b')](_0x48034d,function(_0x5df0ed){if(_0x5df0ed[_0xa652('0x3e')]!==_0xa652('0x4f')){var _0x51aed6={};_0x51aed6[_0x5df0ed['name']]={'$like':'%'+_0x30ce46[_0xa652('0x40')][_0xa652('0x4d')]+'%'};return _0x51aed6;}})});}_0x342942=_[_0xa652('0x4e')]({},_0x342942,_0x30ce46['options']);var _0x1680e9={'where':_0x342942[_0xa652('0x4a')]};return db[_0xa652('0x3c')][_0xa652('0x2f')](_0x1680e9)[_0xa652('0x21')](function(_0x3626c4){_0xc83847[_0xa652('0x2f')]=_0x3626c4;if(_0x30ce46[_0xa652('0x40')][_0xa652('0x50')]){_0x342942[_0xa652('0x51')]=[{'all':!![]}];}return db[_0xa652('0x3c')]['findAll'](_0x342942);})[_0xa652('0x21')](function(_0x37e82e){_0xc83847['rows']=_0x37e82e;return _0xc83847;})[_0xa652('0x21')](respondWithFilteredResult(_0x1787e5,_0x342942))[_0xa652('0x29')](handleError(_0x1787e5,null));};exports[_0xa652('0x52')]=function(_0x4e13c8,_0x5d5d49){var _0x1d5fca={'raw':!![],'where':{'id':_0x4e13c8['params']['id']}},_0x4118bc={};_0x4118bc[_0xa652('0x42')]=_[_0xa652('0x53')](db[_0xa652('0x3c')][_0xa652('0x54')]);_0x4118bc[_0xa652('0x40')]=_[_0xa652('0x53')](_0x4e13c8[_0xa652('0x40')]);_0x4118bc['filters']=_['intersection'](_0x4118bc[_0xa652('0x42')],_0x4118bc[_0xa652('0x40')]);_0x1d5fca['attributes']=_[_0xa652('0x41')](_0x4118bc[_0xa652('0x42')],qs[_0xa652('0x44')](_0x4e13c8[_0xa652('0x40')]['fields']));_0x1d5fca[_0xa652('0x43')]=_0x1d5fca[_0xa652('0x43')][_0xa652('0x45')]?_0x1d5fca['attributes']:_0x4118bc[_0xa652('0x42')];if(_0x4e13c8[_0xa652('0x40')][_0xa652('0x50')]){_0x1d5fca['include']=[{'all':!![]}];}_0x1d5fca=_[_0xa652('0x4e')]({},_0x1d5fca,_0x4e13c8[_0xa652('0x55')]);return db[_0xa652('0x3c')][_0xa652('0x56')](_0x1d5fca)[_0xa652('0x21')](handleEntityNotFound(_0x5d5d49,null))[_0xa652('0x21')](respondWithResult(_0x5d5d49,null))['catch'](handleError(_0x5d5d49,null));};exports[_0xa652('0x57')]=function(_0x24b697,_0x419754){return db[_0xa652('0x3c')][_0xa652('0x57')](_0x24b697[_0xa652('0x58')],{})[_0xa652('0x21')](respondWithResult(_0x419754,0xc9))[_0xa652('0x29')](handleError(_0x419754,null));};exports[_0xa652('0x34')]=function(_0x2982d9,_0xc3ad00){if(_0x2982d9[_0xa652('0x58')]['id']){delete _0x2982d9[_0xa652('0x58')]['id'];}return db['SmsMessage'][_0xa652('0x56')]({'where':{'id':_0x2982d9[_0xa652('0x59')]['id']}})[_0xa652('0x21')](handleEntityNotFound(_0xc3ad00,null))[_0xa652('0x21')](saveUpdates(_0x2982d9[_0xa652('0x58')],null))[_0xa652('0x21')](respondWithResult(_0xc3ad00,null))[_0xa652('0x29')](handleError(_0xc3ad00,null));};exports[_0xa652('0x35')]=function(_0x303032,_0x109cc0){return db[_0xa652('0x3c')][_0xa652('0x56')]({'where':{'id':_0x303032['params']['id']}})[_0xa652('0x21')](handleEntityNotFound(_0x109cc0,null))['then'](removeEntity(_0x109cc0,null))[_0xa652('0x29')](handleError(_0x109cc0,null));};exports[_0xa652('0x5a')]=function(_0x20ac0c,_0x21c836){return db[_0xa652('0x3c')]['describe']()[_0xa652('0x21')](respondWithResult(_0x21c836,null))[_0xa652('0x29')](handleError(_0x21c836,null));};var interaction_log=require(_0xa652('0x14'))(_0xa652('0x5b'));exports[_0xa652('0x5c')]=function(_0x524aae,_0x1fc2fd,_0x5f5c00){var _0x2ccabc={'agent':{},'channel':_0xa652('0x5d')};if(_0x524aae['body']['id']){delete _0x524aae['body']['id'];}_0x524aae[_0xa652('0x58')][_0xa652('0x5e')]=!![];_0x524aae[_0xa652('0x58')][_0xa652('0x5f')]=moment()[_0xa652('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x524aae[_0xa652('0x58')][_0xa652('0x61')]=_0x524aae[_0xa652('0x58')][_0xa652('0x61')]||_0x524aae[_0xa652('0x62')]['id'];_0x2ccabc[_0xa652('0x63')]['id']=_0x524aae['body']['UserId'];return db[_0xa652('0x3c')][_0xa652('0x56')]({'where':{'id':_0x524aae[_0xa652('0x59')]['id'],'UserId':null}})[_0xa652('0x21')](handleEntityNotFound(_0x1fc2fd,null))['then'](saveUpdates(_0x524aae[_0xa652('0x58')],null))[_0xa652('0x21')](function(_0x51ac53){if(_0x51ac53){_0x2ccabc[_0xa652('0x28')]=_0x51ac53['get']({'plain':!![]});return db[_0xa652('0x64')][_0xa652('0x56')]({'where':{'id':_0x51ac53[_0xa652('0x65')]}});}return null;})[_0xa652('0x21')](handleEntityNotFound(_0x1fc2fd,null))['then'](function(_0x1191b6){if(_0x1191b6){return _0x1191b6['update']({'UserId':_0x524aae[_0xa652('0x58')][_0xa652('0x61')],'read1stAt':_[_0xa652('0x66')](_0x1191b6[_0xa652('0x67')])?moment()[_0xa652('0x60')](_0xa652('0x68')):undefined});}return null;})[_0xa652('0x21')](function(_0x53d2b4){if(_0x53d2b4){_0x2ccabc[_0xa652('0x69')]=_0x53d2b4[_0xa652('0x6a')]({'plain':!![]});interaction_log[_0xa652('0x22')](_0xa652('0x6b'),_0x524aae['user']['id'],_0x524aae[_0xa652('0x62')]['name'],_0x524aae[_0xa652('0x62')][_0xa652('0x6c')],_0x2ccabc[_0xa652('0x69')]['id'],_0x524aae[_0xa652('0x58')]?JSON[_0xa652('0x25')](_0x524aae[_0xa652('0x58')]):_0xa652('0x6d'));return respondWithRpcPromise(_0xa652('0x6e'),_0xa652('0x6f'),_0x2ccabc);}return null;})['then'](function(_0x648c18){var _0x181bf6=_0xa652('0x70')+_0x648c18[_0xa652('0x28')][_0xa652('0x71')];return db[_0xa652('0x72')][_0xa652('0x40')](_0x181bf6,{'type':db[_0xa652('0x73')][_0xa652('0x74')][_0xa652('0x75')],'raw':!![]})[_0xa652('0x21')](function(_0x4e35ca){return _0x4e35ca;});})[_0xa652('0x21')](function(_0x5dae3c){if(_0x5dae3c){_0x2ccabc[_0xa652('0x28')]['contact']=_0x5dae3c[0x0];if(!_0x524aae[_0xa652('0x58')][_0xa652('0x61')])return;return db[_0xa652('0x76')][_0xa652('0x56')]({'where':{'id':_0x524aae['body'][_0xa652('0x61')],'role':'agent'},'attributes':['id',_0xa652('0x38'),'fullname',_0xa652('0x77'),_0xa652('0x78')],'raw':!![]});}return null;})[_0xa652('0x21')](function(_0x56b051){if(!_0x56b051)return null;_0x2ccabc[_0xa652('0x28')][_0xa652('0x63')]=_0x56b051;return _0x2ccabc;})[_0xa652('0x21')](function(_0x1aac8b){if(_0x1aac8b){if(_0x524aae[_0xa652('0x58')]['manual']){_0x2ccabc['message'][_0xa652('0x79')]=util[_0xa652('0x60')](_0xa652('0x7a'),_0x524aae[_0xa652('0x62')][_0xa652('0x38')]);_0x2ccabc['message'][_0xa652('0x7b')]=_0x2ccabc[_0xa652('0x7b')];_0x2ccabc[_0xa652('0x28')][_0xa652('0x7c')]=_0x2ccabc[_0xa652('0x7b')];_0x2ccabc[_0xa652('0x28')]['event']='accept';return respondWithRpcPromise(_0xa652('0x7d'),_0xa652('0x7d'),{'event':_0xa652('0x7e'),'message':_0x2ccabc[_0xa652('0x28')]},client9002)['then'](function(){return _0x2ccabc;});}return _0x2ccabc;}return null;})[_0xa652('0x21')](respondWithResult(_0x1fc2fd,null))[_0xa652('0x29')](handleError(_0x1fc2fd,null));};var interaction_log=require(_0xa652('0x14'))(_0xa652('0x5b'));exports[_0xa652('0x33')]=function(_0x40b397,_0x3c67d6,_0x344d77){var _0x4b158c={'agent':{},'channel':_0xa652('0x5d')};if(_0x40b397[_0xa652('0x58')]['id']){delete _0x40b397[_0xa652('0x58')]['id'];}_0x40b397['body']['UserId']=_0x40b397[_0xa652('0x58')][_0xa652('0x61')]||_0x40b397[_0xa652('0x62')]['id'];_0x4b158c[_0xa652('0x63')]['id']=_0x40b397[_0xa652('0x58')]['UserId'];return db['SmsMessage'][_0xa652('0x56')]({'where':{'id':_0x40b397[_0xa652('0x59')]['id'],'UserId':null}})[_0xa652('0x21')](handleEntityNotFound(_0x3c67d6,null))[_0xa652('0x21')](function(_0x5d772a){if(_0x5d772a){_0x4b158c['message']=_0x5d772a[_0xa652('0x6a')]({'plain':!![]});return db[_0xa652('0x64')][_0xa652('0x56')]({'where':{'id':_0x5d772a[_0xa652('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x3c67d6,null))[_0xa652('0x21')](function(_0x5e9d87){if(_0x5e9d87){_0x4b158c[_0xa652('0x69')]=_0x5e9d87['get']({'plain':!![]});interaction_log['info'](_0xa652('0x7f'),_0x40b397[_0xa652('0x62')]['id'],_0x40b397[_0xa652('0x62')]['name'],_0x40b397[_0xa652('0x62')][_0xa652('0x6c')],_0x4b158c[_0xa652('0x69')]['id'],_0x40b397[_0xa652('0x58')]?JSON['stringify'](_0x40b397[_0xa652('0x58')]):_0xa652('0x6d'));return respondWithRpcPromise(_0xa652('0x80'),_0xa652('0x81'),_0x4b158c);}return null;})[_0xa652('0x21')](function(_0x274686){var _0x50e40c=_0xa652('0x70')+_0x274686['message']['ContactId'];return db['sequelize']['query'](_0x50e40c,{'type':db['Sequelize'][_0xa652('0x74')][_0xa652('0x75')],'raw':!![]})[_0xa652('0x21')](function(_0x45d284){return _0x45d284;});})[_0xa652('0x21')](function(_0x455d7d){if(_0x455d7d){_0x4b158c[_0xa652('0x28')][_0xa652('0x82')]=_0x455d7d[0x0];if(!_0x40b397[_0xa652('0x58')][_0xa652('0x61')])return;return db[_0xa652('0x76')][_0xa652('0x56')]({'where':{'id':_0x40b397['body'][_0xa652('0x61')],'role':_0xa652('0x63')},'attributes':['id',_0xa652('0x38'),_0xa652('0x83'),_0xa652('0x77'),_0xa652('0x78')],'raw':!![]});}return null;})[_0xa652('0x21')](function(_0x291238){if(!_0x291238)return null;_0x4b158c[_0xa652('0x28')]['agent']=_0x291238;return _0x4b158c;})[_0xa652('0x21')](function(_0x6e359f){if(_0x6e359f){_0x6e359f[_0xa652('0x28')][_0xa652('0x79')]=util[_0xa652('0x60')]('SIP/%s',_0x40b397[_0xa652('0x62')][_0xa652('0x38')]);_0x6e359f[_0xa652('0x28')][_0xa652('0x7b')]=_0x4b158c[_0xa652('0x7b')];_0x6e359f['message'][_0xa652('0x7c')]=_0x4b158c['channel'];_0x6e359f[_0xa652('0x28')]['event']=_0xa652('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':_0xa652('0x84'),'message':_0x6e359f[_0xa652('0x28')]},client9002);return _0x4b158c;}return null;})[_0xa652('0x21')](respondWithResult(_0x3c67d6,null))[_0xa652('0x29')](handleError(_0x3c67d6,null));};exports['status']=function(_0x11112d,_0x206b32,_0x178ec0){if(_0x11112d['body']['id']){delete _0x11112d[_0xa652('0x58')]['id'];}var _0x437d83;return db[_0xa652('0x3c')][_0xa652('0x56')]({'where':{'id':_0x11112d[_0xa652('0x59')]['id']}})['then'](handleEntityNotFound(_0x206b32,null))['then'](function(_0x29af28){if(_0x29af28){_0x437d83=_0x29af28;return db[_0xa652('0x85')][_0xa652('0x56')]({'where':{'id':_0x29af28[_0xa652('0x86')]}});}})[_0xa652('0x21')](handleEntityNotFound(_0x206b32,null))[_0xa652('0x21')](function(_0x2b196f){if(_0x2b196f){logger[_0xa652('0x87')](_0xa652('0x88'),_0xa652('0x2a'),'received\x20delivery\x20report\x20from',_0x2b196f['type'],util[_0xa652('0x89')](_0x11112d[_0xa652('0x58')],{'showHidden':![],'depth':null}));switch(_0x2b196f[_0xa652('0x3e')]){case _0xa652('0x8a'):if(_0x11112d[_0xa652('0x58')][_0xa652('0x8b')]&&_0x11112d[_0xa652('0x58')]['MessageSid']===_0x437d83[_0xa652('0x8c')]){return _0x437d83[_0xa652('0x34')]({'read':!![]});}else{logger[_0xa652('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','twilio',util['inspect'](_0x11112d['body'],{'showHidden':![],'depth':null}));}break;case _0xa652('0x8d'):if(_0x11112d[_0xa652('0x58')][_0xa652('0x8e')]&&_0x11112d[_0xa652('0x58')][_0xa652('0x8e')]===_0x437d83[_0xa652('0x8c')]&&_[_0xa652('0x8f')]([_0xa652('0x90'),'delivered'],_0x11112d['body'][_0xa652('0x91')])>=0x0){return _0x437d83[_0xa652('0x34')]({'read':!![]});}else{logger[_0xa652('0x26')](_0xa652('0x92'),'status',_0xa652('0x93'),util[_0xa652('0x89')](_0x11112d[_0xa652('0x58')],{'showHidden':![],'depth':null}));}break;case _0xa652('0x94'):var _0x3836fa=_0x11112d['body']['results'][0x0];if(_0x3836fa[_0xa652('0x2a')][_0xa652('0x95')]===_0xa652('0x96')){return _0x437d83[_0xa652('0x34')]({'read':!![]});}else{logger[_0xa652('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa652('0x2a'),'infobip',util['inspect'](_0x11112d['body'],{'showHidden':![],'depth':null}));}break;}return _0x437d83;}})[_0xa652('0x21')](respondWithResult(_0x206b32,null))[_0xa652('0x29')](handleError(_0x206b32,null));}; \ No newline at end of file +var _0xa486=['nolimit','sort','where','filters','type','filter','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','sequelize','Sequelize','SELECT','User','fullname','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','contact','rejectmessage','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','infobip','groupName','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','sendStatus','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x1fbc6d,_0x59e4af){var _0x1c702e=function(_0x529a3a){while(--_0x529a3a){_0x1fbc6d['push'](_0x1fbc6d['shift']());}};_0x1c702e(++_0x59e4af);}(_0xa486,0x17d));var _0x6a48=function(_0x267d5e,_0x3a4b11){_0x267d5e=_0x267d5e-0x0;var _0x17f5d8=_0xa486[_0x267d5e];return _0x17f5d8;};'use strict';var emlformat=require(_0x6a48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a48('0x2'));var moment=require('moment');var BPromise=require(_0x6a48('0x3'));var Mustache=require(_0x6a48('0x4'));var util=require(_0x6a48('0x5'));var path=require(_0x6a48('0x6'));var sox=require(_0x6a48('0x7'));var csv=require(_0x6a48('0x8'));var ejs=require(_0x6a48('0x9'));var fs=require('fs');var fs_extra=require(_0x6a48('0xa'));var _=require(_0x6a48('0xb'));var squel=require(_0x6a48('0xc'));var crypto=require(_0x6a48('0xd'));var jsforce=require(_0x6a48('0xe'));var deskjs=require(_0x6a48('0xf'));var toCsv=require(_0x6a48('0x8'));var querystring=require(_0x6a48('0x10'));var Papa=require(_0x6a48('0x11'));var Redis=require('ioredis');var authService=require(_0x6a48('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a48('0x13'));var hardwareService=require(_0x6a48('0x14'));var logger=require(_0x6a48('0x15'))(_0x6a48('0x16'));var utils=require(_0x6a48('0x17'));var config=require(_0x6a48('0x18'));var licenseUtil=require(_0x6a48('0x19'));var db=require(_0x6a48('0x1a'))['db'];config[_0x6a48('0x1b')]=_[_0x6a48('0x1c')](config[_0x6a48('0x1b')],{'host':_0x6a48('0x1d'),'port':0x18eb});var socket=require(_0x6a48('0x1e'))(new Redis(config[_0x6a48('0x1b')]));require(_0x6a48('0x1f'))[_0x6a48('0x20')](socket);var jayson=require(_0x6a48('0x21'));var client=jayson[_0x6a48('0x22')][_0x6a48('0x23')]({'port':0x232c});var client9002=jayson[_0x6a48('0x22')][_0x6a48('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x10867e,_0x231930,_0xaf303c,_0xad96d0){return new BPromise(function(_0x2ca540,_0x41218a){var _0x20cab5=_0xad96d0||client;return _0x20cab5['request'](_0x10867e,_0xaf303c)[_0x6a48('0x24')](function(_0x23a1fe){logger[_0x6a48('0x25')](_0x6a48('0x26'),_0x231930,'request\x20sent');logger[_0x6a48('0x27')](_0x6a48('0x28'),_0x231930,_0x6a48('0x29'),JSON['stringify'](_0x23a1fe));if(_0x23a1fe[_0x6a48('0x2a')]){if(_0x23a1fe[_0x6a48('0x2a')][_0x6a48('0x2b')]===0x1f4){logger['error'](_0x6a48('0x26'),_0x231930,_0x23a1fe[_0x6a48('0x2a')][_0x6a48('0x2c')]);return _0x41218a(_0x23a1fe[_0x6a48('0x2a')]['message']);}logger[_0x6a48('0x2a')](_0x6a48('0x26'),_0x231930,_0x23a1fe['error']['message']);return _0x2ca540(_0x23a1fe[_0x6a48('0x2a')][_0x6a48('0x2c')]);}else{logger['info'](_0x6a48('0x26'),_0x231930,'request\x20sent');_0x2ca540(_0x23a1fe['result']['message']);}})['catch'](function(_0x2a14d5){logger['error'](_0x6a48('0x26'),_0x231930,_0x2a14d5);_0x41218a(_0x2a14d5);});});}function respondWithStatusCode(_0x52de7c,_0x5b1331){_0x5b1331=_0x5b1331||0xcc;return function(_0x483278){if(_0x483278){return _0x52de7c['sendStatus'](_0x5b1331);}return _0x52de7c[_0x6a48('0x2d')](_0x5b1331)[_0x6a48('0x2e')]();};}function respondWithResult(_0x2cb60e,_0x20ecb0){_0x20ecb0=_0x20ecb0||0xc8;return function(_0x4c53cc){if(_0x4c53cc){return _0x2cb60e[_0x6a48('0x2d')](_0x20ecb0)[_0x6a48('0x2f')](_0x4c53cc);}};}function respondWithFilteredResult(_0xf450b,_0x13fe57){return function(_0x5188e8){if(_0x5188e8){var _0x57522a=typeof _0x13fe57[_0x6a48('0x30')]===_0x6a48('0x31')&&typeof _0x13fe57[_0x6a48('0x32')]===_0x6a48('0x31');var _0x437622=_0x5188e8['count'];var _0x16982f=_0x57522a?0x0:_0x13fe57['offset'];var _0x50e0e8=_0x57522a?_0x5188e8[_0x6a48('0x33')]:_0x13fe57[_0x6a48('0x30')]+_0x13fe57[_0x6a48('0x32')];var _0xd53693;if(_0x50e0e8>=_0x437622){_0x50e0e8=_0x437622;_0xd53693=0xc8;}else{_0xd53693=0xce;}_0xf450b[_0x6a48('0x2d')](_0xd53693);return _0xf450b[_0x6a48('0x34')](_0x6a48('0x35'),_0x16982f+'-'+_0x50e0e8+'/'+_0x437622)[_0x6a48('0x2f')](_0x5188e8);}return null;};}function patchUpdates(_0x1372ef){return function(_0x27504a){try{jsonpatch[_0x6a48('0x36')](_0x27504a,_0x1372ef,!![]);}catch(_0x28ebfc){return BPromise['reject'](_0x28ebfc);}return _0x27504a[_0x6a48('0x37')]();};}function saveUpdates(_0x32a90b,_0x53e85b){return function(_0x5502bb){if(_0x5502bb){return _0x5502bb[_0x6a48('0x38')](_0x32a90b)['then'](function(_0x13d303){return _0x13d303;});}return null;};}function removeEntity(_0x4ba7f8,_0x42cd76){return function(_0x259cab){if(_0x259cab){return _0x259cab[_0x6a48('0x39')]()['then'](function(){_0x4ba7f8[_0x6a48('0x2d')](0xcc)[_0x6a48('0x2e')]();});}};}function handleEntityNotFound(_0x51703a,_0x53004c){return function(_0x2e6472){if(!_0x2e6472){_0x51703a[_0x6a48('0x3a')](0x194);}return _0x2e6472;};}function handleError(_0x4f3ec1,_0x5bf085){_0x5bf085=_0x5bf085||0x1f4;return function(_0xd33ad9){logger[_0x6a48('0x2a')](_0xd33ad9[_0x6a48('0x3b')]);if(_0xd33ad9[_0x6a48('0x3c')]){delete _0xd33ad9['name'];}_0x4f3ec1[_0x6a48('0x2d')](_0x5bf085)[_0x6a48('0x3d')](_0xd33ad9);};}exports[_0x6a48('0x3e')]=function(_0x2b236b,_0x228297){var _0x434f53={},_0x2e085c={},_0x399e13={'count':0x0,'rows':[]};var _0x2b5773=_[_0x6a48('0x3f')](db[_0x6a48('0x40')][_0x6a48('0x41')],function(_0x19244f){return{'name':_0x19244f[_0x6a48('0x42')],'type':_0x19244f['type'][_0x6a48('0x43')]};});_0x2e085c[_0x6a48('0x44')]=_['map'](_0x2b5773,_0x6a48('0x3c'));_0x2e085c[_0x6a48('0x45')]=_[_0x6a48('0x46')](_0x2b236b[_0x6a48('0x45')]);_0x2e085c['filters']=_[_0x6a48('0x47')](_0x2e085c[_0x6a48('0x44')],_0x2e085c[_0x6a48('0x45')]);_0x434f53[_0x6a48('0x48')]=_[_0x6a48('0x47')](_0x2e085c[_0x6a48('0x44')],qs[_0x6a48('0x49')](_0x2b236b['query']['fields']));_0x434f53[_0x6a48('0x48')]=_0x434f53[_0x6a48('0x48')]['length']?_0x434f53[_0x6a48('0x48')]:_0x2e085c[_0x6a48('0x44')];if(!_0x2b236b['query'][_0x6a48('0x4a')](_0x6a48('0x4b'))){_0x434f53[_0x6a48('0x32')]=qs[_0x6a48('0x32')](_0x2b236b[_0x6a48('0x45')]['limit']);_0x434f53[_0x6a48('0x30')]=qs['offset'](_0x2b236b['query'][_0x6a48('0x30')]);}_0x434f53['order']=qs[_0x6a48('0x4c')](_0x2b236b['query'][_0x6a48('0x4c')]);_0x434f53[_0x6a48('0x4d')]=qs[_0x6a48('0x4e')](_['pick'](_0x2b236b[_0x6a48('0x45')],_0x2e085c['filters']),_0x2b5773);if(_0x2b236b['query']['filter']){_0x434f53[_0x6a48('0x4d')]=_['merge'](_0x434f53[_0x6a48('0x4d')],{'$or':_[_0x6a48('0x3f')](_0x2b5773,function(_0x277950){if(_0x277950[_0x6a48('0x4f')]!=='VIRTUAL'){var _0xa57759={};_0xa57759[_0x277950['name']]={'$like':'%'+_0x2b236b[_0x6a48('0x45')][_0x6a48('0x50')]+'%'};return _0xa57759;}})});}_0x434f53=_['merge']({},_0x434f53,_0x2b236b['options']);var _0x1b942b={'where':_0x434f53[_0x6a48('0x4d')]};return db['SmsMessage'][_0x6a48('0x33')](_0x1b942b)[_0x6a48('0x24')](function(_0x11c34d){_0x399e13[_0x6a48('0x33')]=_0x11c34d;if(_0x2b236b[_0x6a48('0x45')][_0x6a48('0x51')]){_0x434f53[_0x6a48('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x6a48('0x53')](_0x434f53);})[_0x6a48('0x24')](function(_0x4dbbad){_0x399e13[_0x6a48('0x54')]=_0x4dbbad;return _0x399e13;})[_0x6a48('0x24')](respondWithFilteredResult(_0x228297,_0x434f53))[_0x6a48('0x55')](handleError(_0x228297,null));};exports[_0x6a48('0x56')]=function(_0x375358,_0x58b400){var _0xf58971={'raw':!![],'where':{'id':_0x375358[_0x6a48('0x57')]['id']}},_0x1ce605={};_0x1ce605[_0x6a48('0x44')]=_[_0x6a48('0x46')](db['SmsMessage']['rawAttributes']);_0x1ce605[_0x6a48('0x45')]=_[_0x6a48('0x46')](_0x375358[_0x6a48('0x45')]);_0x1ce605['filters']=_[_0x6a48('0x47')](_0x1ce605['model'],_0x1ce605[_0x6a48('0x45')]);_0xf58971[_0x6a48('0x48')]=_['intersection'](_0x1ce605[_0x6a48('0x44')],qs[_0x6a48('0x49')](_0x375358[_0x6a48('0x45')][_0x6a48('0x49')]));_0xf58971[_0x6a48('0x48')]=_0xf58971[_0x6a48('0x48')][_0x6a48('0x58')]?_0xf58971['attributes']:_0x1ce605[_0x6a48('0x44')];if(_0x375358[_0x6a48('0x45')]['includeAll']){_0xf58971['include']=[{'all':!![]}];}_0xf58971=_[_0x6a48('0x59')]({},_0xf58971,_0x375358['options']);return db['SmsMessage'][_0x6a48('0x5a')](_0xf58971)['then'](handleEntityNotFound(_0x58b400,null))[_0x6a48('0x24')](respondWithResult(_0x58b400,null))[_0x6a48('0x55')](handleError(_0x58b400,null));};exports[_0x6a48('0x5b')]=function(_0x564afa,_0x104fc2){return db[_0x6a48('0x40')][_0x6a48('0x5b')](_0x564afa[_0x6a48('0x5c')],{})[_0x6a48('0x24')](respondWithResult(_0x104fc2,0xc9))[_0x6a48('0x55')](handleError(_0x104fc2,null));};exports['update']=function(_0x116359,_0x2d138e){if(_0x116359[_0x6a48('0x5c')]['id']){delete _0x116359['body']['id'];}return db[_0x6a48('0x40')]['find']({'where':{'id':_0x116359['params']['id']}})[_0x6a48('0x24')](handleEntityNotFound(_0x2d138e,null))[_0x6a48('0x24')](saveUpdates(_0x116359[_0x6a48('0x5c')],null))['then'](respondWithResult(_0x2d138e,null))['catch'](handleError(_0x2d138e,null));};exports[_0x6a48('0x39')]=function(_0x1e16e5,_0x133494){return db['SmsMessage'][_0x6a48('0x5a')]({'where':{'id':_0x1e16e5[_0x6a48('0x57')]['id']}})['then'](handleEntityNotFound(_0x133494,null))[_0x6a48('0x24')](removeEntity(_0x133494,null))['catch'](handleError(_0x133494,null));};exports[_0x6a48('0x5d')]=function(_0x70b605,_0x276f1e){return db[_0x6a48('0x40')][_0x6a48('0x5d')]()[_0x6a48('0x24')](respondWithResult(_0x276f1e,null))[_0x6a48('0x55')](handleError(_0x276f1e,null));};var interaction_log=require('../../config/logger')(_0x6a48('0x5e'));exports[_0x6a48('0x5f')]=function(_0x676264,_0x238590,_0x2e9891){var _0x382bb5={'agent':{},'channel':_0x6a48('0x60')};if(_0x676264[_0x6a48('0x5c')]['id']){delete _0x676264[_0x6a48('0x5c')]['id'];}_0x676264[_0x6a48('0x5c')][_0x6a48('0x61')]=!![];_0x676264['body'][_0x6a48('0x62')]=moment()[_0x6a48('0x63')](_0x6a48('0x64'));_0x676264[_0x6a48('0x5c')][_0x6a48('0x65')]=_0x676264[_0x6a48('0x5c')]['UserId']||_0x676264['user']['id'];_0x382bb5['agent']['id']=_0x676264[_0x6a48('0x5c')][_0x6a48('0x65')];return db[_0x6a48('0x40')][_0x6a48('0x5a')]({'where':{'id':_0x676264['params']['id'],'UserId':null}})[_0x6a48('0x24')](handleEntityNotFound(_0x238590,null))['then'](saveUpdates(_0x676264[_0x6a48('0x5c')],null))[_0x6a48('0x24')](function(_0x2edba7){if(_0x2edba7){_0x382bb5[_0x6a48('0x2c')]=_0x2edba7['get']({'plain':!![]});return db[_0x6a48('0x66')][_0x6a48('0x5a')]({'where':{'id':_0x2edba7[_0x6a48('0x67')]}});}return null;})[_0x6a48('0x24')](handleEntityNotFound(_0x238590,null))[_0x6a48('0x24')](function(_0x1635fa){if(_0x1635fa){return _0x1635fa[_0x6a48('0x38')]({'UserId':_0x676264[_0x6a48('0x5c')][_0x6a48('0x65')],'read1stAt':_[_0x6a48('0x68')](_0x1635fa[_0x6a48('0x69')])?moment()[_0x6a48('0x63')](_0x6a48('0x64')):undefined});}return null;})[_0x6a48('0x24')](function(_0xec7a63){if(_0xec7a63){_0x382bb5[_0x6a48('0x6a')]=_0xec7a63[_0x6a48('0x6b')]({'plain':!![]});interaction_log[_0x6a48('0x25')](_0x6a48('0x6c'),_0x676264[_0x6a48('0x6d')]['id'],_0x676264[_0x6a48('0x6d')][_0x6a48('0x3c')],_0x676264[_0x6a48('0x6d')][_0x6a48('0x6e')],_0x382bb5['interaction']['id'],_0x676264[_0x6a48('0x5c')]?JSON['stringify'](_0x676264[_0x6a48('0x5c')]):_0x6a48('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x6a48('0x70'),_0x382bb5);}return null;})[_0x6a48('0x24')](function(_0x5acda6){var _0x2ddc74='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5acda6[_0x6a48('0x2c')]['ContactId'];return db[_0x6a48('0x71')][_0x6a48('0x45')](_0x2ddc74,{'type':db[_0x6a48('0x72')]['QueryTypes'][_0x6a48('0x73')],'raw':!![]})[_0x6a48('0x24')](function(_0x48042a){return _0x48042a;});})['then'](function(_0x27129b){if(_0x27129b){_0x382bb5['message']['contact']=_0x27129b[0x0];if(!_0x676264['body'][_0x6a48('0x65')])return;return db[_0x6a48('0x74')][_0x6a48('0x5a')]({'where':{'id':_0x676264[_0x6a48('0x5c')][_0x6a48('0x65')],'role':'agent'},'attributes':['id',_0x6a48('0x3c'),_0x6a48('0x75'),_0x6a48('0x76'),_0x6a48('0x77')],'raw':!![]});}return null;})[_0x6a48('0x24')](function(_0x3c7fc5){if(!_0x3c7fc5)return null;_0x382bb5[_0x6a48('0x2c')][_0x6a48('0x78')]=_0x3c7fc5;return _0x382bb5;})[_0x6a48('0x24')](function(_0x5454b9){if(_0x5454b9){if(_0x676264[_0x6a48('0x5c')][_0x6a48('0x79')]){_0x382bb5[_0x6a48('0x2c')][_0x6a48('0x7a')]=util['format'](_0x6a48('0x7b'),_0x676264[_0x6a48('0x6d')][_0x6a48('0x3c')]);_0x382bb5[_0x6a48('0x2c')]['channel']=_0x382bb5[_0x6a48('0x7c')];_0x382bb5['message'][_0x6a48('0x7d')]=_0x382bb5[_0x6a48('0x7c')];_0x382bb5['message'][_0x6a48('0x7e')]=_0x6a48('0x5f');return respondWithRpcPromise(_0x6a48('0x7f'),'EventManager',{'event':_0x6a48('0x80'),'message':_0x382bb5[_0x6a48('0x2c')]},client9002)[_0x6a48('0x24')](function(){return _0x382bb5;});}return _0x382bb5;}return null;})[_0x6a48('0x24')](respondWithResult(_0x238590,null))[_0x6a48('0x55')](handleError(_0x238590,null));};var interaction_log=require(_0x6a48('0x15'))(_0x6a48('0x5e'));exports[_0x6a48('0x81')]=function(_0xc3fcfe,_0x4fd0e5,_0x17f9b5){var _0x25ba98={'agent':{},'channel':'sms'};if(_0xc3fcfe[_0x6a48('0x5c')]['id']){delete _0xc3fcfe['body']['id'];}_0xc3fcfe[_0x6a48('0x5c')][_0x6a48('0x65')]=_0xc3fcfe[_0x6a48('0x5c')][_0x6a48('0x65')]||_0xc3fcfe[_0x6a48('0x6d')]['id'];_0x25ba98[_0x6a48('0x78')]['id']=_0xc3fcfe[_0x6a48('0x5c')][_0x6a48('0x65')];return db[_0x6a48('0x40')][_0x6a48('0x5a')]({'where':{'id':_0xc3fcfe['params']['id'],'UserId':null}})[_0x6a48('0x24')](handleEntityNotFound(_0x4fd0e5,null))[_0x6a48('0x24')](function(_0x2b1ad4){if(_0x2b1ad4){_0x25ba98[_0x6a48('0x2c')]=_0x2b1ad4[_0x6a48('0x6b')]({'plain':!![]});return db[_0x6a48('0x66')][_0x6a48('0x5a')]({'where':{'id':_0x2b1ad4['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4fd0e5,null))[_0x6a48('0x24')](function(_0x2695d1){if(_0x2695d1){_0x25ba98['interaction']=_0x2695d1['get']({'plain':!![]});interaction_log[_0x6a48('0x25')](_0x6a48('0x82'),_0xc3fcfe[_0x6a48('0x6d')]['id'],_0xc3fcfe[_0x6a48('0x6d')][_0x6a48('0x3c')],_0xc3fcfe['user'][_0x6a48('0x6e')],_0x25ba98['interaction']['id'],_0xc3fcfe[_0x6a48('0x5c')]?JSON[_0x6a48('0x83')](_0xc3fcfe[_0x6a48('0x5c')]):_0x6a48('0x6f'));return respondWithRpcPromise(_0x6a48('0x84'),_0x6a48('0x85'),_0x25ba98);}return null;})[_0x6a48('0x24')](function(_0x590adc){var _0xbd3fb1=_0x6a48('0x86')+_0x590adc[_0x6a48('0x2c')]['ContactId'];return db[_0x6a48('0x71')][_0x6a48('0x45')](_0xbd3fb1,{'type':db[_0x6a48('0x72')][_0x6a48('0x87')][_0x6a48('0x73')],'raw':!![]})['then'](function(_0x5555d5){return _0x5555d5;});})[_0x6a48('0x24')](function(_0x5ba0db){if(_0x5ba0db){_0x25ba98[_0x6a48('0x2c')][_0x6a48('0x88')]=_0x5ba0db[0x0];if(!_0xc3fcfe[_0x6a48('0x5c')][_0x6a48('0x65')])return;return db[_0x6a48('0x74')]['find']({'where':{'id':_0xc3fcfe['body'][_0x6a48('0x65')],'role':'agent'},'attributes':['id',_0x6a48('0x3c'),'fullname',_0x6a48('0x76'),_0x6a48('0x77')],'raw':!![]});}return null;})[_0x6a48('0x24')](function(_0x208bae){if(!_0x208bae)return null;_0x25ba98['message'][_0x6a48('0x78')]=_0x208bae;return _0x25ba98;})[_0x6a48('0x24')](function(_0x16131a){if(_0x16131a){_0x16131a['message'][_0x6a48('0x7a')]=util[_0x6a48('0x63')]('SIP/%s',_0xc3fcfe['user'][_0x6a48('0x3c')]);_0x16131a[_0x6a48('0x2c')]['channel']=_0x25ba98['channel'];_0x16131a[_0x6a48('0x2c')]['motionChannel']=_0x25ba98[_0x6a48('0x7c')];_0x16131a[_0x6a48('0x2c')][_0x6a48('0x7e')]=_0x6a48('0x81');respondWithRpcPromise(_0x6a48('0x7f'),_0x6a48('0x7f'),{'event':_0x6a48('0x89'),'message':_0x16131a[_0x6a48('0x2c')]},client9002);return _0x25ba98;}return null;})[_0x6a48('0x24')](respondWithResult(_0x4fd0e5,null))['catch'](handleError(_0x4fd0e5,null));};exports['status']=function(_0xa9fdfa,_0x49d4db,_0x3d890d){if(_0xa9fdfa[_0x6a48('0x5c')]['id']){delete _0xa9fdfa[_0x6a48('0x5c')]['id'];}var _0x8fb163;return db[_0x6a48('0x40')][_0x6a48('0x5a')]({'where':{'id':_0xa9fdfa[_0x6a48('0x57')]['id']}})[_0x6a48('0x24')](handleEntityNotFound(_0x49d4db,null))['then'](function(_0x2d181a){if(_0x2d181a){_0x8fb163=_0x2d181a;return db[_0x6a48('0x8a')][_0x6a48('0x5a')]({'where':{'id':_0x2d181a[_0x6a48('0x8b')]}});}})['then'](handleEntityNotFound(_0x49d4db,null))[_0x6a48('0x24')](function(_0x413e4c){if(_0x413e4c){logger[_0x6a48('0x27')](_0x6a48('0x28'),_0x6a48('0x2d'),'received\x20delivery\x20report\x20from',_0x413e4c[_0x6a48('0x4f')],util[_0x6a48('0x8c')](_0xa9fdfa['body'],{'showHidden':![],'depth':null}));switch(_0x413e4c[_0x6a48('0x4f')]){case _0x6a48('0x8d'):if(_0xa9fdfa[_0x6a48('0x5c')][_0x6a48('0x8e')]&&_0xa9fdfa[_0x6a48('0x5c')][_0x6a48('0x8e')]===_0x8fb163[_0x6a48('0x8f')]){return _0x8fb163['update']({'read':!![]});}else{logger[_0x6a48('0x2a')](_0x6a48('0x90'),_0x6a48('0x2d'),_0x6a48('0x8d'),util['inspect'](_0xa9fdfa[_0x6a48('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6a48('0x91'):if(_0xa9fdfa[_0x6a48('0x5c')][_0x6a48('0x92')]&&_0xa9fdfa['body']['MessageUUID']===_0x8fb163[_0x6a48('0x8f')]&&_[_0x6a48('0x93')]([_0x6a48('0x94'),'delivered'],_0xa9fdfa['body'][_0x6a48('0x95')])>=0x0){return _0x8fb163[_0x6a48('0x38')]({'read':!![]});}else{logger[_0x6a48('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6a48('0x2d'),'plivio',util[_0x6a48('0x8c')](_0xa9fdfa[_0x6a48('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6a48('0x96'):var _0x54d72b=_0xa9fdfa[_0x6a48('0x5c')]['results'][0x0];if(_0x54d72b['status'][_0x6a48('0x97')]==='DELIVERED'){return _0x8fb163[_0x6a48('0x38')]({'read':!![]});}else{logger[_0x6a48('0x2a')](_0x6a48('0x90'),_0x6a48('0x2d'),_0x6a48('0x96'),util[_0x6a48('0x8c')](_0xa9fdfa[_0x6a48('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x8fb163;}})[_0x6a48('0x24')](respondWithResult(_0x49d4db,null))['catch'](handleError(_0x49d4db,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d7f332e..f1105d9 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 _0xe822=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','save'];(function(_0x62fd70,_0x6306d1){var _0xaa2c71=function(_0x43a3f4){while(--_0x43a3f4){_0x62fd70['push'](_0x62fd70['shift']());}};_0xaa2c71(++_0x6306d1);}(_0xe822,0x11c));var _0x2e82=function(_0x14a8e9,_0xcd5ffb){_0x14a8e9=_0x14a8e9-0x0;var _0x3f2890=_0xe822[_0x14a8e9];return _0x3f2890;};'use strict';var EventEmitter=require(_0x2e82('0x0'));var SmsMessage=require(_0x2e82('0x1'))['db'][_0x2e82('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2e82('0x3'),'afterUpdate':'update','afterDestroy':_0x2e82('0x4')};function emitEvent(_0x3d1045){return function(_0x2d0050,_0x1f4d99,_0x549e5b){SmsMessageEvents[_0x2e82('0x5')](_0x3d1045+':'+_0x2d0050['id'],_0x2d0050);SmsMessageEvents['emit'](_0x3d1045,_0x2d0050);_0x549e5b(null);};}for(var e in events){if(events[_0x2e82('0x6')](e)){var event=events[e];SmsMessage[_0x2e82('0x7')](e,emitEvent(event));}}module[_0x2e82('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xdf16=['SmsMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x13ac10,_0x46e79e){var _0x28eda2=function(_0x169ef0){while(--_0x169ef0){_0x13ac10['push'](_0x13ac10['shift']());}};_0x28eda2(++_0x46e79e);}(_0xdf16,0x1c0));var _0x6df1=function(_0x561f76,_0x3c0bef){_0x561f76=_0x561f76-0x0;var _0x48b8e4=_0xdf16[_0x561f76];return _0x48b8e4;};'use strict';var EventEmitter=require(_0x6df1('0x0'));var SmsMessage=require(_0x6df1('0x1'))['db'][_0x6df1('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6df1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6df1('0x4'),'afterDestroy':_0x6df1('0x5')};function emitEvent(_0x1f2adc){return function(_0x3db116,_0x549c7e,_0x18e0ba){SmsMessageEvents[_0x6df1('0x6')](_0x1f2adc+':'+_0x3db116['id'],_0x3db116);SmsMessageEvents['emit'](_0x1f2adc,_0x3db116);_0x18e0ba(null);};}for(var e in events){if(events[_0x6df1('0x7')](e)){var event=events[e];SmsMessage[_0x6df1('0x8')](e,emitEvent(event));}}module[_0x6df1('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index a4f14f3..7d0e409 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 _0x0c5d=['direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','&password=','password','GET','sms','user_key','session_key','internal_order_id','deliveryReport','POST','https://smsapi.connectel.se/api/v2/send/','requestid','read','connectel','clicksend','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','length','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','clickatell','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','base64','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','messageId','body','FULLTEXT','models','get'];(function(_0x58d7de,_0x4798b5){var _0x1f94c8=function(_0x59e888){while(--_0x59e888){_0x58d7de['push'](_0x58d7de['shift']());}};_0x1f94c8(++_0x4798b5);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x54c30d,_0x296017){_0x54c30d=_0x54c30d-0x0;var _0x268cd5=_0x0c5d[_0x54c30d];return _0x268cd5;};'use strict';var _=require(_0xd0c5('0x0'));var util=require(_0xd0c5('0x1'));var logger=require('../../config/logger')(_0xd0c5('0x2'));var moment=require('moment');var BPromise=require(_0xd0c5('0x3'));var rp=require(_0xd0c5('0x4'));var fs=require('fs');var path=require(_0xd0c5('0x5'));var rimraf=require(_0xd0c5('0x6'));var config=require(_0xd0c5('0x7'));var attributes=require(_0xd0c5('0x8'));module[_0xd0c5('0x9')]=function(_0x121911,_0x569992){return _0x121911[_0xd0c5('0xa')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xd0c5('0xb'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0xd0c5('0xc')],'type':_0xd0c5('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50ed33,_0x33a77b,_0x3d53ab){var _0x5ae844=_0x121911[_0xd0c5('0xe')];var _0x410037=_0x50ed33[_0xd0c5('0xf')]({'plain':!![]});if(_0x410037[_0xd0c5('0x10')][_0xd0c5('0x11')]()==='in'||_0x410037[_0xd0c5('0x10')][_0xd0c5('0x11')]()===_0xd0c5('0x12')&&!_0x410037[_0xd0c5('0x13')]&&!_[_0xd0c5('0x14')](_0x410037[_0xd0c5('0x15')])){_0x5ae844[_0xd0c5('0x16')]['findOne']({'where':{'id':_0x410037[_0xd0c5('0x17')]}})[_0xd0c5('0x18')](function(_0x1fc98d){if(_0x1fc98d){_0x1fc98d[_0xd0c5('0x19')]({'lastMsgAt':_0x410037['createdAt'],'lastMsgDirection':_0x410037[_0xd0c5('0x10')][_0xd0c5('0x11')]()});}})[_0xd0c5('0x1a')](function(_0x639e72){console['error'](_0x639e72);});}if(_0x410037[_0xd0c5('0x10')]==='out'&&!_0x410037[_0xd0c5('0x13')]){var _0x57c76a;_0x5ae844[_0xd0c5('0x1b')][_0xd0c5('0x1c')]({'where':{'id':_0x410037[_0xd0c5('0x1d')]},'raw':!![]})[_0xd0c5('0x18')](function(_0xfda75c){_0x57c76a=_0xfda75c;if(_0x57c76a&&_0x57c76a[_0xd0c5('0x1e')]){switch(_0x57c76a[_0xd0c5('0x1e')]){case _0xd0c5('0x1f'):var _0x4e302a=require(_0xd0c5('0x1f'));if(_0x57c76a[_0xd0c5('0x20')]&&_0x57c76a['authToken']&&_0x57c76a[_0xd0c5('0x21')]){var _0x30f548=new _0x4e302a(_0x57c76a[_0xd0c5('0x20')],_0x57c76a[_0xd0c5('0x22')]);_0x30f548[_0xd0c5('0x23')][_0xd0c5('0x24')]({'body':_0x410037[_0xd0c5('0xc')],'to':_0x410037['phone'],'from':_0x57c76a['phone'],'statusCallback':_0x57c76a[_0xd0c5('0x25')]+_0xd0c5('0x26')+_0x410037['id']+_0xd0c5('0x27')+_0x57c76a[_0xd0c5('0x28')]})['then'](function(_0x185e33){if(_0x185e33['sid']){return _0x50ed33['update']({'messageId':_0x185e33[_0xd0c5('0x29')]});}})[_0xd0c5('0x1a')](function(_0x364963){logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x1f'),util[_0xd0c5('0x2d')](_0x364963,{'showHidden':![],'depth':null}));});}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x1f'),_0xd0c5('0x2e'));}break;case _0xd0c5('0x2f'):var _0x1df662=_0xd0c5('0x30');if(_0x57c76a[_0xd0c5('0x31')]&&_0x57c76a['password']){var _0x39284e={'recipient':[_0x410037[_0xd0c5('0x21')]],'message':_0x410037[_0xd0c5('0xc')],'message_type':_0x57c76a[_0xd0c5('0x32')]};if(_0x57c76a[_0xd0c5('0x32')]&&_0x57c76a[_0xd0c5('0x32')]!=='SI'){_0x39284e[_0xd0c5('0x33')]=_0x57c76a['phone'];}var _0x246793={'url':_0x1df662+'login?username='+_0x57c76a[_0xd0c5('0x31')]+_0xd0c5('0x34')+_0x57c76a[_0xd0c5('0x35')],'method':_0xd0c5('0x36')};rp(_0x246793)[_0xd0c5('0x18')](function(_0x3144b3){var _0x46f394=_0x3144b3['split'](';');var _0x560853={'user_key':_0x46f394[0x0],'session_key':_0x46f394[0x1]};_0x246793={'url':_0x1df662+_0xd0c5('0x37'),'method':'POST','headers':{'user_key':_0x560853[_0xd0c5('0x38')],'Session_key':_0x560853[_0xd0c5('0x39')]},'json':!![],'body':_0x39284e};return rp(_0x246793);})[_0xd0c5('0x18')](function(_0x211805){if(_0x211805['total_sent']>=0x1){var _0x307504={'messageId':_0x211805[_0xd0c5('0x3a')]};if(_0x57c76a['smsMethod']!=='GP'||!_0x57c76a[_0xd0c5('0x3b')]){_0x307504['read']=!![];}return _0x50ed33[_0xd0c5('0x19')](_0x307504);}else{return logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),'afterCreate',_0xd0c5('0x2f'),util[_0xd0c5('0x2d')](_0x211805,{'showHidden':![],'depth':null}));}})[_0xd0c5('0x1a')](function(_0x3650b8){return logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x2f'),util[_0xd0c5('0x2d')](_0x3650b8,{'showHidden':![],'depth':null}));});}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x2f'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x57c76a[_0xd0c5('0x22')]){var _0x1dd3aa={'recipient':_0x410037[_0xd0c5('0x21')],'message':_0x410037[_0xd0c5('0xc')],'sender':_0x57c76a['senderString']||_0x57c76a[_0xd0c5('0x21')],'authorization':_0x57c76a[_0xd0c5('0x22')]};var _0x33a77b={'method':_0xd0c5('0x3c'),'uri':_0xd0c5('0x3d'),'body':_0x1dd3aa,'json':!![]};rp(_0x33a77b)[_0xd0c5('0x18')](function(_0x444a21){var _0xd7d03a={'messageId':_0x444a21[_0xd0c5('0x3e')]};if(!_0x57c76a[_0xd0c5('0x3b')]){_0xd7d03a[_0xd0c5('0x3f')]=!![];}return _0x50ed33[_0xd0c5('0x19')](_0xd7d03a);})[_0xd0c5('0x1a')](function(_0x8ef77f){logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),'afterCreate',_0xd0c5('0x40'),util[_0xd0c5('0x2d')](_0x8ef77f,{'showHidden':![],'depth':null}));});}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0xd0c5('0x41'):if(_0x57c76a[_0xd0c5('0x31')]&&_0x57c76a[_0xd0c5('0x35')]){var _0x1dd3aa={'messages':[{'source':'xCALLY\x20Motion','to':_0x410037[_0xd0c5('0x21')],'body':_0x410037[_0xd0c5('0xc')],'from':_0x57c76a[_0xd0c5('0x42')]||_0x57c76a[_0xd0c5('0x21')]}]};var _0x464989=util[_0xd0c5('0x43')](_0xd0c5('0x44'),_0x57c76a['username'],_0x57c76a[_0xd0c5('0x35')]);var _0x33a77b={'method':'POST','uri':_0xd0c5('0x45'),'body':_0x1dd3aa,'headers':{'Authorization':util[_0xd0c5('0x43')](_0xd0c5('0x46'),new Buffer(_0x464989)['toString']('base64'))},'json':!![]};rp(_0x33a77b)['then'](function(_0x4a4b14){if(_0x4a4b14[_0xd0c5('0x47')]>=0xc8&&_0x4a4b14['http_code']<=0xce){if(_0x4a4b14[_0xd0c5('0x48')]&&_0x4a4b14['data'][_0xd0c5('0x49')]>0x0){var _0x5a1857=_[_0xd0c5('0x4a')](_0x4a4b14[_0xd0c5('0x48')][_0xd0c5('0x23')]);var _0x2b939e={'messageId':_0x5a1857[_0xd0c5('0x4b')]};if(!_0x57c76a['deliveryReport']){_0x2b939e[_0xd0c5('0x3f')]=!![];}return _0x50ed33[_0xd0c5('0x19')](_0x2b939e);}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x4c'),util['inspect'](_0x4a4b14,{'showHidden':![],'depth':null}));}}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x4c'),util['inspect'](_0x4a4b14,{'showHidden':![],'depth':null}));}})[_0xd0c5('0x1a')](function(_0x1b1b26){logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x4c'),util[_0xd0c5('0x2d')](_0x1b1b26,{'showHidden':![],'depth':null}));});}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x4c'),_0xd0c5('0x4d'));}break;case'plivo':if(_0x57c76a['authId']&&_0x57c76a[_0xd0c5('0x22')]){var _0x1dd3aa={'dst':_0x410037[_0xd0c5('0x21')],'text':_0x410037[_0xd0c5('0xc')],'src':_0x57c76a[_0xd0c5('0x42')]||_0x57c76a[_0xd0c5('0x21')],'url':_0x57c76a['remote']+_0xd0c5('0x26')+_0x410037['id']+_0xd0c5('0x27')+_0x57c76a[_0xd0c5('0x28')]};var _0x464989=util[_0xd0c5('0x43')](_0xd0c5('0x44'),_0x57c76a[_0xd0c5('0x4e')],_0x57c76a[_0xd0c5('0x22')]);var _0x33a77b={'method':_0xd0c5('0x3c'),'uri':util[_0xd0c5('0x43')](_0xd0c5('0x4f'),_0x57c76a[_0xd0c5('0x4e')]),'body':_0x1dd3aa,'headers':{'Authorization':util['format'](_0xd0c5('0x46'),new Buffer(_0x464989)[_0xd0c5('0x50')]('base64'))},'json':!![]};rp(_0x33a77b)[_0xd0c5('0x18')](function(_0x4a9356){var _0x588347={'messageId':_0x4a9356[_0xd0c5('0x51')][0x0]};return _0x50ed33[_0xd0c5('0x19')](_0x588347);})[_0xd0c5('0x1a')](function(_0x1ce80d){logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x52'),util[_0xd0c5('0x2d')](_0x1ce80d,{'showHidden':![],'depth':null}));});}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x52'),_0xd0c5('0x53'));}break;case _0xd0c5('0x54'):if(_0x57c76a[_0xd0c5('0x31')]&&_0x57c76a[_0xd0c5('0x35')]){if(_0x57c76a['baseUrl']){var _0x4bdb47={'method':_0xd0c5('0x3c'),'uri':_0x57c76a[_0xd0c5('0x55')]+'/auth/1/session','body':{'username':_0x57c76a['username'],'password':_0x57c76a[_0xd0c5('0x35')]},'json':!![]};return rp(_0x4bdb47)[_0xd0c5('0x18')](function(_0x3a5bf9){var _0x164646={'method':_0xd0c5('0x3c'),'uri':_0x57c76a[_0xd0c5('0x55')]+_0xd0c5('0x56'),'body':{'messages':[{'from':_0x57c76a[_0xd0c5('0x21')],'destinations':[{'to':_0x410037[_0xd0c5('0x21')]}],'text':_0x410037['body'],'notifyUrl':_0x57c76a[_0xd0c5('0x25')]+_0xd0c5('0x26')+_0x410037['id']+'/status?token='+_0x57c76a[_0xd0c5('0x28')],'notifyContentType':'application/json','callbackData':_0x57c76a[_0xd0c5('0x21')]+';'+_0x410037['body']}]},'headers':{'Authorization':_0xd0c5('0x57')+_0x3a5bf9['token']},'json':!![]};return rp(_0x164646)[_0xd0c5('0x18')](function(_0x339710){if(_0x339710[_0xd0c5('0x23')]){var _0x5655a0={'messageId':_0x339710[_0xd0c5('0x23')][0x0][_0xd0c5('0xb')]};if(!_0x57c76a[_0xd0c5('0x3b')]){_0x5655a0[_0xd0c5('0x3f')]=!![];}return _0x50ed33[_0xd0c5('0x19')](_0x5655a0);}else{return logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),'infobip',util[_0xd0c5('0x2d')](_0x339710,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x2ed9ba){return logger[_0xd0c5('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd0c5('0x2c'),_0xd0c5('0x54'),util[_0xd0c5('0x2d')](_0x2ed9ba,{'showHidden':![],'depth':null}));});}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),'infobip',_0xd0c5('0x58'));}}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),'infobip',_0xd0c5('0x4d'));}break;case _0xd0c5('0x59'):var _0x23783c=require(_0xd0c5('0x5a'));if(_0x57c76a[_0xd0c5('0x5b')]){var _0x376cf0={};_0x376cf0[_0xd0c5('0x5c')]=_0x57c76a[_0xd0c5('0x31')];_0x376cf0[_0xd0c5('0x21')]=_0x410037[_0xd0c5('0x21')];_0x376cf0['sender']=_0x57c76a[_0xd0c5('0x21')];_0x376cf0[_0xd0c5('0x5d')]=_0x410037[_0xd0c5('0xc')];_0x376cf0[_0xd0c5('0x5e')]=+new Date();var _0x383e7c='';var _0xed6cca='';var _0x4ebf38=Object[_0xd0c5('0x5f')](_0x376cf0);_0x4ebf38['sort']();for(var _0x278bcd=0x0;_0x278bcd<_0x4ebf38[_0xd0c5('0x60')];_0x278bcd++){if(_0x383e7c!=''){_0x383e7c+='&';}_0x383e7c+=_0x4ebf38[_0x278bcd]+'='+encodeURIComponent(_0x376cf0[_0x4ebf38[_0x278bcd]]);_0xed6cca+=_0x376cf0[_0x4ebf38[_0x278bcd]];}_0xed6cca+=_0x57c76a[_0xd0c5('0x5b')];_0xed6cca=_0x23783c[_0xd0c5('0x61')](_0xd0c5('0x62'))['update'](_0xed6cca)['digest'](_0xd0c5('0x63'));if(_0x383e7c!==''){_0x383e7c+='&';}_0x383e7c+=_0xd0c5('0x64')+_0xed6cca;var _0x246793={'method':_0xd0c5('0x36'),'uri':_0x57c76a[_0xd0c5('0x55')]+_0xd0c5('0x65')+_0x383e7c,'json':!![]};return rp(_0x246793)[_0xd0c5('0x18')](function(_0x381362){var _0x3d4f41=Object[_0xd0c5('0x5f')](_0x381362);if(_0x381362[_0x3d4f41[0x0]][_0xd0c5('0x2a')]&&parseInt(_0x381362[_0x3d4f41[0x0]][_0xd0c5('0x2a')])===0x0){var _0xc4e75d={'messageId':_0x381362[_0x3d4f41[0x0]][_0xd0c5('0x66')]};if(!_0x57c76a[_0xd0c5('0x3b')]){_0xc4e75d[_0xd0c5('0x3f')]=!![];}return _0x50ed33[_0xd0c5('0x19')](_0xc4e75d);}else{return logger['error'](_0xd0c5('0x2b'),'afterCreate',_0xd0c5('0x59'),util[_0xd0c5('0x2d')](_0x381362['error'],{'showHidden':![],'depth':null}));}})[_0xd0c5('0x1a')](function(_0x3d4785){return logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x59'),util[_0xd0c5('0x2d')](_0x3d4785,{'showHidden':![],'depth':null}));});}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),'afterCreate','csc',_0xd0c5('0x67'));}break;case'clickatell':if(_0x57c76a['apiKey']){var _0x42803f={'method':_0xd0c5('0x3c'),'uri':_0xd0c5('0x68'),'headers':{'Authorization':_0x57c76a[_0xd0c5('0x5b')]},'body':{'content':_0x410037[_0xd0c5('0xc')],'to':[_0x410037['phone']],'from':_0x57c76a['phone'],'binary':![],'clientMessageId':_0xd0c5('0x69'),'charset':_0xd0c5('0x6a')},'json':!![]};rp(_0x42803f)[_0xd0c5('0x18')](function(_0x3afa97){if(!_0x3afa97[_0xd0c5('0x2a')]){var _0x3eecb6={'messageId':_0x3afa97[_0xd0c5('0x23')][0x0]['apiMessageId']};if(!_0x57c76a[_0xd0c5('0x3b')]){_0x3eecb6[_0xd0c5('0x3f')]=!![];}return _0x50ed33[_0xd0c5('0x19')](_0x3eecb6);}else{return logger[_0xd0c5('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd0c5('0x2c'),'clickatell',util[_0xd0c5('0x2d')](_0x3afa97[_0xd0c5('0x2a')],{'showHidden':![],'depth':null}));}})[_0xd0c5('0x1a')](function(_0x3595f3){return logger[_0xd0c5('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd0c5('0x2c'),_0xd0c5('0x6b'),util[_0xd0c5('0x2d')](_0x3595f3,{'showHidden':![],'depth':null}));});}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),'clickatell',_0xd0c5('0x67'));}break;case'bandwidth':if(_0x57c76a[_0xd0c5('0x31')]&&_0x57c76a[_0xd0c5('0x35')]){var _0x464989=util[_0xd0c5('0x43')](_0xd0c5('0x44'),_0x57c76a[_0xd0c5('0x31')],_0x57c76a[_0xd0c5('0x35')]);var _0x33a77b={'method':'POST','uri':_0xd0c5('0x6c')+_0x57c76a['accountId']+_0xd0c5('0x6d'),'body':{'to':[_0x410037[_0xd0c5('0x21')]],'text':_0x410037[_0xd0c5('0xc')],'from':_0x57c76a[_0xd0c5('0x21')],'applicationId':_0x57c76a[_0xd0c5('0x6e')]},'headers':{'Authorization':util[_0xd0c5('0x43')](_0xd0c5('0x46'),new Buffer(_0x464989)[_0xd0c5('0x50')](_0xd0c5('0x6f')))},'json':!![]};rp(_0x33a77b)['then'](function(_0x325458){if(_0x325458['id']){var _0x28ea50={'messageId':_0x325458['id']};return _0x50ed33[_0xd0c5('0x19')](_0x28ea50);}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),'afterCreate',_0xd0c5('0x70'),util[_0xd0c5('0x2d')](_0x325458,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3d66e3){logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x70'),util[_0xd0c5('0x2d')](_0x3d66e3,{'showHidden':![],'depth':null}));});}else{logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x70'),_0xd0c5('0x4d'));}break;case _0xd0c5('0x71'):if(_0x57c76a['apiKey']){var _0xd0c69e={};var _0x246793={'method':_0xd0c5('0x3c'),'uri':_0xd0c5('0x72'),'headers':{'Authorization':_0xd0c5('0x73')+_0x57c76a[_0xd0c5('0x5b')],'Content-Type':_0xd0c5('0x74')},'body':{'from':_0x57c76a[_0xd0c5('0x21')],'to':_0x410037[_0xd0c5('0x21')],'text':_0x410037[_0xd0c5('0xc')]},'json':!![]};return rp(_0x246793)['then'](function(_0x2fdb9c){if(_0x2fdb9c['code']==0xca){_0xd0c69e[_0xd0c5('0x75')]=_0x2fdb9c;var _0x233bde={'method':_0xd0c5('0x3c'),'uri':_0xd0c5('0x76'),'headers':{'Authorization':_0xd0c5('0x73')+_0x57c76a[_0xd0c5('0x5b')],'Content-Type':_0xd0c5('0x74')},'body':{'refid':_0xd0c69e[_0xd0c5('0x75')][_0xd0c5('0x77')]},'json':!![]};return rp(_0x233bde)['then'](function(_0x485662){_0xd0c69e[_0xd0c5('0x78')]=_0x485662;var _0x15f29b={'messageId':_0xd0c69e[_0xd0c5('0x75')][_0xd0c5('0x77')],'read':!![]};return _0x50ed33[_0xd0c5('0x19')](_0x15f29b);});}else{return logger[_0xd0c5('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd0c5('0x2c'),_0xd0c5('0x71'),util['inspect'](_0x2fdb9c,{'showHidden':![],'depth':null}));}})[_0xd0c5('0x1a')](function(_0x2c3ae8){return logger[_0xd0c5('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd0c5('0x2c'),_0xd0c5('0x71'),util[_0xd0c5('0x2d')](_0x2c3ae8,{'showHidden':![],'depth':null}));});}else{return logger[_0xd0c5('0x2a')](_0xd0c5('0x2b'),_0xd0c5('0x2c'),_0xd0c5('0x71'),_0xd0c5('0x79'));}break;}}})[_0xd0c5('0x7a')](function(){_0x3d53ab();});}else{_0x3d53ab();}}},'charset':_0xd0c5('0x7b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7d86=['applicationId','intelepeer','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','create','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','skebby','username','sender','login?username=','&password=','GET','sms','POST','session_key','total_sent','internal_order_id','smsMethod','deliveryReport','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','read','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','password','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','createHash','md5','digest','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages'];(function(_0x2f6d62,_0x435e23){var _0x5f391c=function(_0x549f75){while(--_0x549f75){_0x2f6d62['push'](_0x2f6d62['shift']());}};_0x5f391c(++_0x435e23);}(_0x7d86,0x86));var _0x67d8=function(_0x51c2f1,_0x370451){_0x51c2f1=_0x51c2f1-0x0;var _0x5d55e7=_0x7d86[_0x51c2f1];return _0x5d55e7;};'use strict';var _=require(_0x67d8('0x0'));var util=require('util');var logger=require(_0x67d8('0x1'))(_0x67d8('0x2'));var moment=require(_0x67d8('0x3'));var BPromise=require(_0x67d8('0x4'));var rp=require(_0x67d8('0x5'));var fs=require('fs');var path=require(_0x67d8('0x6'));var rimraf=require(_0x67d8('0x7'));var config=require('../../config/environment');var attributes=require(_0x67d8('0x8'));module[_0x67d8('0x9')]=function(_0x8dd593,_0x2bc414){return _0x8dd593[_0x67d8('0xa')](_0x67d8('0xb'),attributes,{'tableName':_0x67d8('0xc'),'paranoid':![],'indexes':[{'name':_0x67d8('0xd'),'fields':[_0x67d8('0xd')]},{'name':_0x67d8('0xe'),'fields':[_0x67d8('0xf')],'type':_0x67d8('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x243de2,_0x265552,_0x2b1fe6){var _0x47382c=_0x8dd593[_0x67d8('0x11')];var _0x14d7be=_0x243de2[_0x67d8('0x12')]({'plain':!![]});if(_0x14d7be[_0x67d8('0x13')][_0x67d8('0x14')]()==='in'||_0x14d7be['direction'][_0x67d8('0x14')]()===_0x67d8('0x15')&&!_0x14d7be[_0x67d8('0x16')]&&!_['isNil'](_0x14d7be[_0x67d8('0x17')])){_0x47382c[_0x67d8('0x18')][_0x67d8('0x19')]({'where':{'id':_0x14d7be[_0x67d8('0x1a')]}})[_0x67d8('0x1b')](function(_0x2d7851){if(_0x2d7851){_0x2d7851[_0x67d8('0x1c')]({'lastMsgAt':_0x14d7be['createdAt'],'lastMsgDirection':_0x14d7be[_0x67d8('0x13')][_0x67d8('0x14')]()});}})[_0x67d8('0x1d')](function(_0x509998){console[_0x67d8('0x1e')](_0x509998);});}if(_0x14d7be[_0x67d8('0x13')]==='out'&&!_0x14d7be[_0x67d8('0x16')]){var _0xaf5197;_0x47382c[_0x67d8('0x1f')][_0x67d8('0x20')]({'where':{'id':_0x14d7be[_0x67d8('0x21')]},'raw':!![]})[_0x67d8('0x1b')](function(_0x5117d0){_0xaf5197=_0x5117d0;if(_0xaf5197&&_0xaf5197[_0x67d8('0x22')]){switch(_0xaf5197[_0x67d8('0x22')]){case _0x67d8('0x23'):var _0x14a81f=require(_0x67d8('0x23'));if(_0xaf5197['accountSid']&&_0xaf5197[_0x67d8('0x24')]&&_0xaf5197[_0x67d8('0x25')]){var _0x47c40a=new _0x14a81f(_0xaf5197['accountSid'],_0xaf5197[_0x67d8('0x24')]);_0x47c40a['messages'][_0x67d8('0x26')]({'body':_0x14d7be[_0x67d8('0xf')],'to':_0x14d7be[_0x67d8('0x25')],'from':_0xaf5197['phone'],'statusCallback':_0xaf5197['remote']+_0x67d8('0x27')+_0x14d7be['id']+_0x67d8('0x28')+_0xaf5197[_0x67d8('0x29')]})[_0x67d8('0x1b')](function(_0x2072d4){if(_0x2072d4['sid']){return _0x243de2[_0x67d8('0x1c')]({'messageId':_0x2072d4[_0x67d8('0x2a')]});}})['catch'](function(_0x509ee9){logger[_0x67d8('0x1e')](_0x67d8('0x2b'),'afterCreate',_0x67d8('0x23'),util[_0x67d8('0x2c')](_0x509ee9,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x67d8('0x2d'),_0x67d8('0x23'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x67d8('0x2e'):var _0x2d2506='https://api.skebby.it/API/v1.0/REST/';if(_0xaf5197[_0x67d8('0x2f')]&&_0xaf5197['password']){var _0x7232a4={'recipient':[_0x14d7be[_0x67d8('0x25')]],'message':_0x14d7be[_0x67d8('0xf')],'message_type':_0xaf5197['smsMethod']};if(_0xaf5197['smsMethod']&&_0xaf5197['smsMethod']!=='SI'){_0x7232a4[_0x67d8('0x30')]=_0xaf5197['phone'];}var _0x4f9794={'url':_0x2d2506+_0x67d8('0x31')+_0xaf5197[_0x67d8('0x2f')]+_0x67d8('0x32')+_0xaf5197['password'],'method':_0x67d8('0x33')};rp(_0x4f9794)[_0x67d8('0x1b')](function(_0x1620f2){var _0x48e81e=_0x1620f2['split'](';');var _0x49ebf1={'user_key':_0x48e81e[0x0],'session_key':_0x48e81e[0x1]};_0x4f9794={'url':_0x2d2506+_0x67d8('0x34'),'method':_0x67d8('0x35'),'headers':{'user_key':_0x49ebf1['user_key'],'Session_key':_0x49ebf1[_0x67d8('0x36')]},'json':!![],'body':_0x7232a4};return rp(_0x4f9794);})[_0x67d8('0x1b')](function(_0x38942c){if(_0x38942c[_0x67d8('0x37')]>=0x1){var _0x39af56={'messageId':_0x38942c[_0x67d8('0x38')]};if(_0xaf5197[_0x67d8('0x39')]!=='GP'||!_0xaf5197[_0x67d8('0x3a')]){_0x39af56['read']=!![];}return _0x243de2['update'](_0x39af56);}else{return logger[_0x67d8('0x1e')](_0x67d8('0x2b'),'afterCreate',_0x67d8('0x2e'),util[_0x67d8('0x2c')](_0x38942c,{'showHidden':![],'depth':null}));}})[_0x67d8('0x1d')](function(_0x23ced9){return logger[_0x67d8('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x67d8('0x2e'),util[_0x67d8('0x2c')](_0x23ced9,{'showHidden':![],'depth':null}));});}else{logger[_0x67d8('0x1e')](_0x67d8('0x2b'),'afterCreate',_0x67d8('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x67d8('0x3b'):if(_0xaf5197[_0x67d8('0x24')]){var _0x4f07eb={'recipient':_0x14d7be[_0x67d8('0x25')],'message':_0x14d7be[_0x67d8('0xf')],'sender':_0xaf5197[_0x67d8('0x3c')]||_0xaf5197[_0x67d8('0x25')],'authorization':_0xaf5197['authToken']};var _0x265552={'method':_0x67d8('0x35'),'uri':_0x67d8('0x3d'),'body':_0x4f07eb,'json':!![]};rp(_0x265552)['then'](function(_0x5632d5){var _0x1d9ed4={'messageId':_0x5632d5['requestid']};if(!_0xaf5197[_0x67d8('0x3a')]){_0x1d9ed4[_0x67d8('0x3e')]=!![];}return _0x243de2[_0x67d8('0x1c')](_0x1d9ed4);})[_0x67d8('0x1d')](function(_0x5e388e){logger['error'](_0x67d8('0x2b'),_0x67d8('0x2d'),'connectel',util[_0x67d8('0x2c')](_0x5e388e,{'showHidden':![],'depth':null}));});}else{logger[_0x67d8('0x1e')](_0x67d8('0x2b'),_0x67d8('0x2d'),_0x67d8('0x3b'),_0x67d8('0x3f'));}break;case'clicksend':if(_0xaf5197[_0x67d8('0x2f')]&&_0xaf5197['password']){var _0x4f07eb={'messages':[{'source':_0x67d8('0x40'),'to':_0x14d7be[_0x67d8('0x25')],'body':_0x14d7be[_0x67d8('0xf')],'from':_0xaf5197[_0x67d8('0x3c')]||_0xaf5197[_0x67d8('0x25')]}]};var _0x363348=util[_0x67d8('0x41')](_0x67d8('0x42'),_0xaf5197[_0x67d8('0x2f')],_0xaf5197[_0x67d8('0x43')]);var _0x265552={'method':_0x67d8('0x35'),'uri':_0x67d8('0x44'),'body':_0x4f07eb,'headers':{'Authorization':util[_0x67d8('0x41')](_0x67d8('0x45'),new Buffer(_0x363348)[_0x67d8('0x46')](_0x67d8('0x47')))},'json':!![]};rp(_0x265552)[_0x67d8('0x1b')](function(_0x293985){if(_0x293985[_0x67d8('0x48')]>=0xc8&&_0x293985[_0x67d8('0x48')]<=0xce){if(_0x293985[_0x67d8('0x49')]&&_0x293985[_0x67d8('0x49')][_0x67d8('0x4a')]>0x0){var _0x26df5f=_[_0x67d8('0x4b')](_0x293985[_0x67d8('0x49')]['messages']);var _0xca1613={'messageId':_0x26df5f[_0x67d8('0x4c')]};if(!_0xaf5197[_0x67d8('0x3a')]){_0xca1613[_0x67d8('0x3e')]=!![];}return _0x243de2[_0x67d8('0x1c')](_0xca1613);}else{logger[_0x67d8('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x67d8('0x4d'),util['inspect'](_0x293985,{'showHidden':![],'depth':null}));}}else{logger[_0x67d8('0x1e')](_0x67d8('0x2b'),_0x67d8('0x2d'),_0x67d8('0x4d'),util[_0x67d8('0x2c')](_0x293985,{'showHidden':![],'depth':null}));}})[_0x67d8('0x1d')](function(_0x452feb){logger['error'](_0x67d8('0x2b'),_0x67d8('0x2d'),_0x67d8('0x4d'),util[_0x67d8('0x2c')](_0x452feb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x67d8('0x2b'),_0x67d8('0x2d'),'clickSend',_0x67d8('0x4e'));}break;case _0x67d8('0x4f'):if(_0xaf5197[_0x67d8('0x50')]&&_0xaf5197[_0x67d8('0x24')]){var _0x4f07eb={'dst':_0x14d7be['phone'],'text':_0x14d7be[_0x67d8('0xf')],'src':_0xaf5197['senderString']||_0xaf5197[_0x67d8('0x25')],'url':_0xaf5197[_0x67d8('0x51')]+'/api/sms/messages/'+_0x14d7be['id']+_0x67d8('0x28')+_0xaf5197[_0x67d8('0x29')]};var _0x363348=util['format'](_0x67d8('0x42'),_0xaf5197[_0x67d8('0x50')],_0xaf5197[_0x67d8('0x24')]);var _0x265552={'method':_0x67d8('0x35'),'uri':util[_0x67d8('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0xaf5197[_0x67d8('0x50')]),'body':_0x4f07eb,'headers':{'Authorization':util[_0x67d8('0x41')](_0x67d8('0x45'),new Buffer(_0x363348)[_0x67d8('0x46')](_0x67d8('0x47')))},'json':!![]};rp(_0x265552)['then'](function(_0x53197c){var _0x48792f={'messageId':_0x53197c[_0x67d8('0x52')][0x0]};return _0x243de2[_0x67d8('0x1c')](_0x48792f);})[_0x67d8('0x1d')](function(_0x3953df){logger['error'](_0x67d8('0x2b'),'afterCreate','plivo',util[_0x67d8('0x2c')](_0x3953df,{'showHidden':![],'depth':null}));});}else{logger[_0x67d8('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',_0x67d8('0x53'));}break;case _0x67d8('0x54'):if(_0xaf5197[_0x67d8('0x2f')]&&_0xaf5197[_0x67d8('0x43')]){if(_0xaf5197['baseUrl']){var _0x1d0722={'method':'POST','uri':_0xaf5197[_0x67d8('0x55')]+_0x67d8('0x56'),'body':{'username':_0xaf5197['username'],'password':_0xaf5197['password']},'json':!![]};return rp(_0x1d0722)['then'](function(_0x1567c9){var _0x122227={'method':_0x67d8('0x35'),'uri':_0xaf5197[_0x67d8('0x55')]+_0x67d8('0x57'),'body':{'messages':[{'from':_0xaf5197[_0x67d8('0x25')],'destinations':[{'to':_0x14d7be[_0x67d8('0x25')]}],'text':_0x14d7be[_0x67d8('0xf')],'notifyUrl':_0xaf5197[_0x67d8('0x51')]+_0x67d8('0x27')+_0x14d7be['id']+_0x67d8('0x28')+_0xaf5197[_0x67d8('0x29')],'notifyContentType':_0x67d8('0x58'),'callbackData':_0xaf5197[_0x67d8('0x25')]+';'+_0x14d7be[_0x67d8('0xf')]}]},'headers':{'Authorization':_0x67d8('0x59')+_0x1567c9['token']},'json':!![]};return rp(_0x122227)[_0x67d8('0x1b')](function(_0x301c2d){if(_0x301c2d[_0x67d8('0x5a')]){var _0x276d6f={'messageId':_0x301c2d['messages'][0x0][_0x67d8('0xd')]};if(!_0xaf5197[_0x67d8('0x3a')]){_0x276d6f[_0x67d8('0x3e')]=!![];}return _0x243de2['update'](_0x276d6f);}else{return logger[_0x67d8('0x1e')](_0x67d8('0x2b'),_0x67d8('0x2d'),_0x67d8('0x54'),util['inspect'](_0x301c2d,{'showHidden':![],'depth':null}));}});})[_0x67d8('0x1d')](function(_0x4373fb){return logger[_0x67d8('0x1e')](_0x67d8('0x2b'),'afterCreate',_0x67d8('0x54'),util['inspect'](_0x4373fb,{'showHidden':![],'depth':null}));});}else{logger[_0x67d8('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x67d8('0x54'),_0x67d8('0x5b'));}}else{logger[_0x67d8('0x1e')](_0x67d8('0x2b'),_0x67d8('0x2d'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x67d8('0x5c'):var _0x2c8787=require(_0x67d8('0x5d'));if(_0xaf5197[_0x67d8('0x5e')]){var _0x4221bf={};_0x4221bf[_0x67d8('0x5f')]=_0xaf5197[_0x67d8('0x2f')];_0x4221bf[_0x67d8('0x25')]=_0x14d7be[_0x67d8('0x25')];_0x4221bf[_0x67d8('0x30')]=_0xaf5197[_0x67d8('0x25')];_0x4221bf[_0x67d8('0x60')]=_0x14d7be[_0x67d8('0xf')];_0x4221bf[_0x67d8('0x61')]=+new Date();var _0x42e245='';var _0x1f46dd='';var _0x4b27b4=Object[_0x67d8('0x62')](_0x4221bf);_0x4b27b4[_0x67d8('0x63')]();for(var _0x21eb6f=0x0;_0x21eb6f<_0x4b27b4['length'];_0x21eb6f++){if(_0x42e245!=''){_0x42e245+='&';}_0x42e245+=_0x4b27b4[_0x21eb6f]+'='+encodeURIComponent(_0x4221bf[_0x4b27b4[_0x21eb6f]]);_0x1f46dd+=_0x4221bf[_0x4b27b4[_0x21eb6f]];}_0x1f46dd+=_0xaf5197[_0x67d8('0x5e')];_0x1f46dd=_0x2c8787[_0x67d8('0x64')](_0x67d8('0x65'))[_0x67d8('0x1c')](_0x1f46dd)[_0x67d8('0x66')]('hex');if(_0x42e245!==''){_0x42e245+='&';}_0x42e245+='signature='+_0x1f46dd;var _0x4f9794={'method':'GET','uri':_0xaf5197[_0x67d8('0x55')]+'/external/get/send.php?'+_0x42e245,'json':!![]};return rp(_0x4f9794)[_0x67d8('0x1b')](function(_0x2b3c0f){var _0x2015f1=Object[_0x67d8('0x62')](_0x2b3c0f);if(_0x2b3c0f[_0x2015f1[0x0]][_0x67d8('0x1e')]&&parseInt(_0x2b3c0f[_0x2015f1[0x0]][_0x67d8('0x1e')])===0x0){var _0x525772={'messageId':_0x2b3c0f[_0x2015f1[0x0]][_0x67d8('0x67')]};if(!_0xaf5197[_0x67d8('0x3a')]){_0x525772[_0x67d8('0x3e')]=!![];}return _0x243de2[_0x67d8('0x1c')](_0x525772);}else{return logger[_0x67d8('0x1e')](_0x67d8('0x2b'),_0x67d8('0x2d'),_0x67d8('0x5c'),util['inspect'](_0x2b3c0f[_0x67d8('0x1e')],{'showHidden':![],'depth':null}));}})[_0x67d8('0x1d')](function(_0x2c1845){return logger[_0x67d8('0x1e')](_0x67d8('0x2b'),_0x67d8('0x2d'),_0x67d8('0x5c'),util['inspect'](_0x2c1845,{'showHidden':![],'depth':null}));});}else{logger[_0x67d8('0x1e')](_0x67d8('0x2b'),_0x67d8('0x2d'),_0x67d8('0x5c'),_0x67d8('0x68'));}break;case _0x67d8('0x69'):if(_0xaf5197['apiKey']){var _0x52fbd9={'method':_0x67d8('0x35'),'uri':_0x67d8('0x6a'),'headers':{'Authorization':_0xaf5197[_0x67d8('0x5e')]},'body':{'content':_0x14d7be[_0x67d8('0xf')],'to':[_0x14d7be['phone']],'from':_0xaf5197[_0x67d8('0x25')],'binary':![],'clientMessageId':_0x67d8('0x6b'),'charset':_0x67d8('0x6c')},'json':!![]};rp(_0x52fbd9)['then'](function(_0x3c1118){if(!_0x3c1118['error']){var _0x50bcaf={'messageId':_0x3c1118[_0x67d8('0x5a')][0x0][_0x67d8('0x6d')]};if(!_0xaf5197[_0x67d8('0x3a')]){_0x50bcaf[_0x67d8('0x3e')]=!![];}return _0x243de2[_0x67d8('0x1c')](_0x50bcaf);}else{return logger['error'](_0x67d8('0x2b'),_0x67d8('0x2d'),'clickatell',util['inspect'](_0x3c1118[_0x67d8('0x1e')],{'showHidden':![],'depth':null}));}})[_0x67d8('0x1d')](function(_0x59acf0){return logger['error'](_0x67d8('0x2b'),_0x67d8('0x2d'),'clickatell',util[_0x67d8('0x2c')](_0x59acf0,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x67d8('0x2d'),_0x67d8('0x69'),'Missing\x20parameters:\x20apiKey');}break;case _0x67d8('0x6e'):if(_0xaf5197[_0x67d8('0x2f')]&&_0xaf5197['password']){var _0x363348=util[_0x67d8('0x41')](_0x67d8('0x42'),_0xaf5197[_0x67d8('0x2f')],_0xaf5197['password']);var _0x265552={'method':_0x67d8('0x35'),'uri':_0x67d8('0x6f')+_0xaf5197[_0x67d8('0x70')]+_0x67d8('0x71'),'body':{'to':[_0x14d7be[_0x67d8('0x25')]],'text':_0x14d7be[_0x67d8('0xf')],'from':_0xaf5197[_0x67d8('0x25')],'applicationId':_0xaf5197[_0x67d8('0x72')]},'headers':{'Authorization':util[_0x67d8('0x41')](_0x67d8('0x45'),new Buffer(_0x363348)[_0x67d8('0x46')](_0x67d8('0x47')))},'json':!![]};rp(_0x265552)[_0x67d8('0x1b')](function(_0x48a8da){if(_0x48a8da['id']){var _0x576de0={'messageId':_0x48a8da['id']};return _0x243de2[_0x67d8('0x1c')](_0x576de0);}else{logger[_0x67d8('0x1e')](_0x67d8('0x2b'),'afterCreate',_0x67d8('0x6e'),util[_0x67d8('0x2c')](_0x48a8da,{'showHidden':![],'depth':null}));}})[_0x67d8('0x1d')](function(_0x36fbd4){logger[_0x67d8('0x1e')](_0x67d8('0x2b'),'afterCreate','bandwidth',util[_0x67d8('0x2c')](_0x36fbd4,{'showHidden':![],'depth':null}));});}else{logger[_0x67d8('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x67d8('0x6e'),_0x67d8('0x4e'));}break;case _0x67d8('0x73'):if(_0xaf5197[_0x67d8('0x5e')]){var _0x4aa4f3={};var _0x4f9794={'method':_0x67d8('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0xaf5197['apiKey'],'Content-Type':_0x67d8('0x58')},'body':{'from':_0xaf5197[_0x67d8('0x25')],'to':_0x14d7be['phone'],'text':_0x14d7be[_0x67d8('0xf')]},'json':!![]};return rp(_0x4f9794)[_0x67d8('0x1b')](function(_0x550d19){if(_0x550d19[_0x67d8('0x74')]==0xca){_0x4aa4f3[_0x67d8('0x75')]=_0x550d19;var _0x2b6313={'method':_0x67d8('0x35'),'uri':_0x67d8('0x76'),'headers':{'Authorization':_0x67d8('0x77')+_0xaf5197[_0x67d8('0x5e')],'Content-Type':_0x67d8('0x58')},'body':{'refid':_0x4aa4f3[_0x67d8('0x75')][_0x67d8('0x78')]},'json':!![]};return rp(_0x2b6313)[_0x67d8('0x1b')](function(_0x558920){_0x4aa4f3['status']=_0x558920;var _0x5a26a6={'messageId':_0x4aa4f3[_0x67d8('0x75')]['refid'],'read':!![]};return _0x243de2[_0x67d8('0x1c')](_0x5a26a6);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x67d8('0x2d'),_0x67d8('0x73'),util[_0x67d8('0x2c')](_0x550d19,{'showHidden':![],'depth':null}));}})[_0x67d8('0x1d')](function(_0x1fa07f){return logger[_0x67d8('0x1e')](_0x67d8('0x2b'),'afterCreate',_0x67d8('0x73'),util[_0x67d8('0x2c')](_0x1fa07f,{'showHidden':![],'depth':null}));});}else{return logger[_0x67d8('0x1e')](_0x67d8('0x2b'),_0x67d8('0x2d'),_0x67d8('0x73'),'Token\x20not\x20received');}break;}}})[_0x67d8('0x79')](function(){_0x2b1fe6();});}else{_0x2b1fe6();}}},'charset':_0x67d8('0x7a'),'collate':_0x67d8('0x7b')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 2a72cb6..1caaa8c 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 _0x5123=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','util','moment','randomstring'];(function(_0x530ddb,_0x3008f8){var _0x4fa295=function(_0x552364){while(--_0x552364){_0x530ddb['push'](_0x530ddb['shift']());}};_0x4fa295(++_0x3008f8);}(_0x5123,0x1bd));var _0x3512=function(_0x1afeae,_0x58665c){_0x1afeae=_0x1afeae-0x0;var _0x1fcb24=_0x5123[_0x1afeae];return _0x1fcb24;};'use strict';var _=require('lodash');var util=require(_0x3512('0x0'));var moment=require(_0x3512('0x1'));var BPromise=require('bluebird');var rs=require(_0x3512('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3512('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3512('0x4'))(_0x3512('0x5'));var config=require(_0x3512('0x6'));var jayson=require(_0x3512('0x7'));var client=jayson[_0x3512('0x8')][_0x3512('0x9')]({'port':0x232a});config[_0x3512('0xa')]=_[_0x3512('0xb')](config['redis'],{'host':_0x3512('0xc'),'port':0x18eb});var socket=require(_0x3512('0xd'))(new Redis(config[_0x3512('0xa')]));require(_0x3512('0xe'))[_0x3512('0xf')](socket);function respondWithRpcPromise(_0x59741e,_0x1d3386,_0x240b7d){return new BPromise(function(_0x6895b4,_0x563d61){return client[_0x3512('0x10')](_0x59741e,_0x240b7d)['then'](function(_0x48bfc2){logger[_0x3512('0x11')](_0x3512('0x12'),_0x1d3386,'request\x20sent');logger[_0x3512('0x13')](_0x3512('0x14'),_0x1d3386,'request\x20sent',JSON[_0x3512('0x15')](_0x48bfc2));if(_0x48bfc2['error']){if(_0x48bfc2['error']['code']===0x1f4){logger[_0x3512('0x16')](_0x3512('0x12'),_0x1d3386,_0x48bfc2[_0x3512('0x16')][_0x3512('0x17')]);return _0x563d61(_0x48bfc2[_0x3512('0x16')][_0x3512('0x17')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x1d3386,_0x48bfc2['error'][_0x3512('0x17')]);return _0x6895b4(_0x48bfc2[_0x3512('0x16')][_0x3512('0x17')]);}else{logger[_0x3512('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1d3386,_0x3512('0x18'));_0x6895b4(_0x48bfc2[_0x3512('0x19')][_0x3512('0x17')]);}})[_0x3512('0x1a')](function(_0x2c5ae2){logger[_0x3512('0x16')](_0x3512('0x12'),_0x1d3386,_0x2c5ae2);_0x563d61(_0x2c5ae2);});});}exports[_0x3512('0x1b')]=function(_0x87f3cd){var _0x3135b2=this;return new Promise(function(_0x2da890,_0x483508){return db[_0x3512('0x1c')]['create'](_0x87f3cd[_0x3512('0x1d')],{'raw':_0x87f3cd[_0x3512('0x1e')]?_0x87f3cd[_0x3512('0x1e')][_0x3512('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x29fba3){logger[_0x3512('0x11')](_0x3512('0x1b'),_0x87f3cd);logger[_0x3512('0x13')](_0x3512('0x1b'),_0x87f3cd,JSON['stringify'](_0x29fba3));_0x2da890(_0x29fba3);})[_0x3512('0x1a')](function(_0x11c6f0){logger[_0x3512('0x16')](_0x3512('0x1b'),_0x11c6f0[_0x3512('0x17')],_0x87f3cd);_0x483508(_0x3135b2['error'](0x1f4,_0x11c6f0[_0x3512('0x17')]));});});}; \ No newline at end of file +var _0x0070=['error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5e6f73,_0x3f27d8){var _0x432614=function(_0x56e42d){while(--_0x56e42d){_0x5e6f73['push'](_0x5e6f73['shift']());}};_0x432614(++_0x3f27d8);}(_0x0070,0x109));var _0x0007=function(_0x3fbeef,_0x2840b4){_0x3fbeef=_0x3fbeef-0x0;var _0x14ec1f=_0x0070[_0x3fbeef];return _0x14ec1f;};'use strict';var _=require(_0x0007('0x0'));var util=require('util');var moment=require(_0x0007('0x1'));var BPromise=require(_0x0007('0x2'));var rs=require(_0x0007('0x3'));var fs=require('fs');var Redis=require(_0x0007('0x4'));var db=require(_0x0007('0x5'))['db'];var utils=require(_0x0007('0x6'));var logger=require(_0x0007('0x7'))('rpc');var config=require(_0x0007('0x8'));var jayson=require(_0x0007('0x9'));var client=jayson[_0x0007('0xa')][_0x0007('0xb')]({'port':0x232a});config[_0x0007('0xc')]=_[_0x0007('0xd')](config['redis'],{'host':_0x0007('0xe'),'port':0x18eb});var socket=require(_0x0007('0xf'))(new Redis(config[_0x0007('0xc')]));require('./smsMessage.socket')[_0x0007('0x10')](socket);function respondWithRpcPromise(_0x56c18c,_0x33a087,_0x488303){return new BPromise(function(_0x57ef18,_0x26c571){return client[_0x0007('0x11')](_0x56c18c,_0x488303)[_0x0007('0x12')](function(_0x3fb105){logger[_0x0007('0x13')]('SmsMessage,\x20%s,\x20%s',_0x33a087,_0x0007('0x14'));logger['debug'](_0x0007('0x15'),_0x33a087,_0x0007('0x14'),JSON[_0x0007('0x16')](_0x3fb105));if(_0x3fb105['error']){if(_0x3fb105[_0x0007('0x17')][_0x0007('0x18')]===0x1f4){logger[_0x0007('0x17')]('SmsMessage,\x20%s,\x20%s',_0x33a087,_0x3fb105[_0x0007('0x17')][_0x0007('0x19')]);return _0x26c571(_0x3fb105[_0x0007('0x17')][_0x0007('0x19')]);}logger[_0x0007('0x17')](_0x0007('0x1a'),_0x33a087,_0x3fb105[_0x0007('0x17')][_0x0007('0x19')]);return _0x57ef18(_0x3fb105[_0x0007('0x17')][_0x0007('0x19')]);}else{logger[_0x0007('0x13')]('SmsMessage,\x20%s,\x20%s',_0x33a087,_0x0007('0x14'));_0x57ef18(_0x3fb105[_0x0007('0x1b')]['message']);}})[_0x0007('0x1c')](function(_0xb0e91e){logger[_0x0007('0x17')]('SmsMessage,\x20%s,\x20%s',_0x33a087,_0xb0e91e);_0x26c571(_0xb0e91e);});});}exports[_0x0007('0x1d')]=function(_0x4dbef4){var _0x60bcee=this;return new Promise(function(_0x38eabe,_0x3b3aa1){return db[_0x0007('0x1e')][_0x0007('0x1f')](_0x4dbef4[_0x0007('0x20')],{'raw':_0x4dbef4[_0x0007('0x21')]?_0x4dbef4[_0x0007('0x21')][_0x0007('0x22')]===undefined?!![]:![]:!![]})[_0x0007('0x12')](function(_0x496ea4){logger['info'](_0x0007('0x1d'),_0x4dbef4);logger[_0x0007('0x23')]('CreateSmsMessage',_0x4dbef4,JSON[_0x0007('0x16')](_0x496ea4));_0x38eabe(_0x496ea4);})[_0x0007('0x1c')](function(_0x4ccf96){logger[_0x0007('0x17')](_0x0007('0x1d'),_0x4ccf96[_0x0007('0x19')],_0x4dbef4);_0x3b3aa1(_0x60bcee[_0x0007('0x17')](0x1f4,_0x4ccf96['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 42778db..9ba5013 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 _0x46d8=['./smsMessage.events','save','remove','register','smsMessage:'];(function(_0x2cc102,_0x5b60f8){var _0xb8c06c=function(_0x247efb){while(--_0x247efb){_0x2cc102['push'](_0x2cc102['shift']());}};_0xb8c06c(++_0x5b60f8);}(_0x46d8,0x154));var _0x846d=function(_0x4aa2ec,_0x3d552a){_0x4aa2ec=_0x4aa2ec-0x0;var _0x534708=_0x46d8[_0x4aa2ec];return _0x534708;};'use strict';var SmsMessageEvents=require(_0x846d('0x0'));var events=[_0x846d('0x1'),_0x846d('0x2'),'update'];function createListener(_0x24b908,_0x4c007d){return function(_0x202457){_0x4c007d['emit'](_0x24b908,_0x202457);};}function removeListener(_0x574e46,_0x25ef13){return function(){SmsMessageEvents['removeListener'](_0x574e46,_0x25ef13);};}exports[_0x846d('0x3')]=function(_0x37dd5e){for(var _0x40c37e=0x0,_0x223e5c=events['length'];_0x40c37e<_0x223e5c;_0x40c37e++){var _0x559542=events[_0x40c37e];var _0x4a98c6=createListener(_0x846d('0x4')+_0x559542,_0x37dd5e);SmsMessageEvents['on'](_0x559542,_0x4a98c6);}}; \ No newline at end of file +var _0x266e=['save','remove','update','removeListener','length','smsMessage:'];(function(_0x451d15,_0x3d69de){var _0xace919=function(_0xc2b0d8){while(--_0xc2b0d8){_0x451d15['push'](_0x451d15['shift']());}};_0xace919(++_0x3d69de);}(_0x266e,0x126));var _0xe266=function(_0x2a7570,_0x5ab14a){_0x2a7570=_0x2a7570-0x0;var _0x4458fc=_0x266e[_0x2a7570];return _0x4458fc;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xe266('0x0'),_0xe266('0x1'),_0xe266('0x2')];function createListener(_0x252a6e,_0x4d0213){return function(_0x171e97){_0x4d0213['emit'](_0x252a6e,_0x171e97);};}function removeListener(_0x3dc39c,_0x561392){return function(){SmsMessageEvents[_0xe266('0x3')](_0x3dc39c,_0x561392);};}exports['register']=function(_0x145824){for(var _0x5d7101=0x0,_0x25fa70=events[_0xe266('0x4')];_0x5d7101<_0x25fa70;_0x5d7101++){var _0xd78b82=events[_0x5d7101];var _0x268bf9=createListener(_0xe266('0x5')+_0xd78b82,_0x145824);SmsMessageEvents['on'](_0xd78b82,_0x268bf9);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 9d07925..1237cb0 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 _0x81f3=['/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','getMembers'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0x81f3,0x112));var _0x381f=function(_0x45564e,_0x558d51){_0x45564e=_0x45564e-0x0;var _0x18d6a7=_0x81f3[_0x45564e];return _0x18d6a7;};'use strict';var multer=require(_0x381f('0x0'));var util=require('util');var path=require(_0x381f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x381f('0x2'));var interaction=require(_0x381f('0x3'));var config=require('../../config/environment');var controller=require(_0x381f('0x4'));router['get']('/',auth[_0x381f('0x5')](),controller['index']);router[_0x381f('0x6')](_0x381f('0x7'),auth[_0x381f('0x5')](),controller[_0x381f('0x8')]);router[_0x381f('0x6')](_0x381f('0x9'),auth[_0x381f('0x5')](),controller[_0x381f('0xa')]);router[_0x381f('0x6')]('/:id/members',auth[_0x381f('0x5')](),controller[_0x381f('0xb')]);router[_0x381f('0x6')](_0x381f('0xc'),auth[_0x381f('0x5')](),controller[_0x381f('0xd')]);router['get'](_0x381f('0xe'),auth['isAuthenticated'](),controller[_0x381f('0xf')]);router['post']('/',auth[_0x381f('0x5')](),controller[_0x381f('0x10')]);router[_0x381f('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0x381f('0x12')]);router[_0x381f('0x11')](_0x381f('0xe'),auth[_0x381f('0x5')](),controller['addAgents']);router[_0x381f('0x13')](_0x381f('0x9'),auth[_0x381f('0x5')](),controller[_0x381f('0x14')]);router[_0x381f('0x15')](_0x381f('0x9'),auth[_0x381f('0x5')](),controller[_0x381f('0x16')]);router['delete']('/:id/teams',auth[_0x381f('0x5')](),controller[_0x381f('0x17')]);router[_0x381f('0x15')](_0x381f('0xe'),auth[_0x381f('0x5')](),controller[_0x381f('0x18')]);module[_0x381f('0x19')]=router; \ No newline at end of file +var _0x9c50=['update','delete','destroy','removeTeams','removeAgents','exports','multer','express','Router','fs-extra','../../components/interaction/service','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','getTeams','post','create','/:id/users','addAgents','put'];(function(_0x5288b8,_0x59d8a0){var _0x29797d=function(_0x38361e){while(--_0x38361e){_0x5288b8['push'](_0x5288b8['shift']());}};_0x29797d(++_0x59d8a0);}(_0x9c50,0x158));var _0x09c5=function(_0x119a37,_0x30b7ae){_0x119a37=_0x119a37-0x0;var _0xbca54e=_0x9c50[_0x119a37];return _0xbca54e;};'use strict';var multer=require(_0x09c5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c5('0x1'));var router=express[_0x09c5('0x2')]();var fs_extra=require(_0x09c5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x09c5('0x4'));var config=require('../../config/environment');var controller=require(_0x09c5('0x5'));router[_0x09c5('0x6')]('/',auth['isAuthenticated'](),controller[_0x09c5('0x7')]);router[_0x09c5('0x6')](_0x09c5('0x8'),auth[_0x09c5('0x9')](),controller[_0x09c5('0xa')]);router['get'](_0x09c5('0xb'),auth[_0x09c5('0x9')](),controller['show']);router[_0x09c5('0x6')](_0x09c5('0xc'),auth[_0x09c5('0x9')](),controller[_0x09c5('0xd')]);router[_0x09c5('0x6')]('/:id/teams',auth[_0x09c5('0x9')](),controller[_0x09c5('0xe')]);router[_0x09c5('0x6')]('/:id/users',auth[_0x09c5('0x9')](),controller['getAgents']);router[_0x09c5('0xf')]('/',auth[_0x09c5('0x9')](),controller[_0x09c5('0x10')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x09c5('0x11'),auth[_0x09c5('0x9')](),controller[_0x09c5('0x12')]);router[_0x09c5('0x13')]('/:id',auth[_0x09c5('0x9')](),controller[_0x09c5('0x14')]);router[_0x09c5('0x15')](_0x09c5('0xb'),auth[_0x09c5('0x9')](),controller[_0x09c5('0x16')]);router['delete']('/:id/teams',auth[_0x09c5('0x9')](),controller[_0x09c5('0x17')]);router[_0x09c5('0x15')](_0x09c5('0x11'),auth['isAuthenticated'](),controller[_0x09c5('0x18')]);module[_0x09c5('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 c17d1ee..afc42f7 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 _0x015d=['name','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x4840a3,_0x5e3a2c){var _0x4e6008=function(_0x3e10f6){while(--_0x3e10f6){_0x4840a3['push'](_0x4840a3['shift']());}};_0x4e6008(++_0x5e3a2c);}(_0x015d,0x1d9));var _0xd015=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x015d[_0x15c421];return _0x5e5ed5;};'use strict';var Sequelize=require(_0xd015('0x0'));module[_0xd015('0x1')]={'name':{'type':Sequelize[_0xd015('0x2')],'unique':_0xd015('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd015('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd015('0x4')](_0xd015('0x5'),'beepall',_0xd015('0x6'))}}; \ No newline at end of file +var _0xf719=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x3f3fe6,_0x1c9d96){var _0x330d7a=function(_0x1dab91){while(--_0x1dab91){_0x3f3fe6['push'](_0x3f3fe6['shift']());}};_0x330d7a(++_0x1c9d96);}(_0xf719,0x1b3));var _0x9f71=function(_0x20f848,_0x2bb454){_0x20f848=_0x20f848-0x0;var _0x3a5f92=_0xf719[_0x20f848];return _0x3a5f92;};'use strict';var Sequelize=require(_0x9f71('0x0'));module[_0x9f71('0x1')]={'name':{'type':Sequelize[_0x9f71('0x2')],'unique':_0x9f71('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9f71('0x2')]},'timeout':{'type':Sequelize[_0x9f71('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9f71('0x5')](_0x9f71('0x6'),_0x9f71('0x7'),_0x9f71('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f870059..1be65ed 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 _0xb506=['ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','SmsQueue','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','role','SmsQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','Team','nolimit','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','toString','QueryTypes','every','includes','all','union','value','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x3cf937,_0x25796d){var _0x306e91=function(_0x15acce){while(--_0x15acce){_0x3cf937['push'](_0x3cf937['shift']());}};_0x306e91(++_0x25796d);}(_0xb506,0x10c));var _0x6b50=function(_0x1fdf99,_0x57a9d8){_0x1fdf99=_0x1fdf99-0x0;var _0xeed178=_0xb506[_0x1fdf99];return _0xeed178;};'use strict';var emlformat=require(_0x6b50('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6b50('0x1'));var rp=require(_0x6b50('0x2'));var moment=require(_0x6b50('0x3'));var BPromise=require(_0x6b50('0x4'));var Mustache=require(_0x6b50('0x5'));var util=require(_0x6b50('0x6'));var path=require('path');var sox=require(_0x6b50('0x7'));var csv=require('to-csv');var ejs=require(_0x6b50('0x8'));var fs=require('fs');var fs_extra=require(_0x6b50('0x9'));var _=require(_0x6b50('0xa'));var squel=require(_0x6b50('0xb'));var crypto=require('crypto');var jsforce=require(_0x6b50('0xc'));var deskjs=require(_0x6b50('0xd'));var toCsv=require(_0x6b50('0xe'));var querystring=require(_0x6b50('0xf'));var Papa=require('papaparse');var Redis=require(_0x6b50('0x10'));var authService=require(_0x6b50('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6b50('0x12'));var hardwareService=require(_0x6b50('0x13'));var logger=require('../../config/logger')(_0x6b50('0x14'));var utils=require(_0x6b50('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6b50('0x16'));var db=require('../../mysqldb')['db'];config[_0x6b50('0x17')]=_[_0x6b50('0x18')](config[_0x6b50('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b50('0x19'))(new Redis(config[_0x6b50('0x17')]));require(_0x6b50('0x1a'))[_0x6b50('0x1b')](socket);function respondWithStatusCode(_0xcfd3d2,_0x2a265f){_0x2a265f=_0x2a265f||0xcc;return function(_0x56c072){if(_0x56c072){return _0xcfd3d2[_0x6b50('0x1c')](_0x2a265f);}return _0xcfd3d2[_0x6b50('0x1d')](_0x2a265f)['end']();};}function respondWithResult(_0x6d3143,_0x302571){_0x302571=_0x302571||0xc8;return function(_0x2b2815){if(_0x2b2815){return _0x6d3143[_0x6b50('0x1d')](_0x302571)[_0x6b50('0x1e')](_0x2b2815);}};}function respondWithFilteredResult(_0xc7bab0,_0x3c6cfb){return function(_0x367cd8){if(_0x367cd8){var _0x319234=typeof _0x3c6cfb[_0x6b50('0x1f')]===_0x6b50('0x20')&&typeof _0x3c6cfb[_0x6b50('0x21')]===_0x6b50('0x20');var _0x5728dd=_0x367cd8[_0x6b50('0x22')];var _0x19c2d9=_0x319234?0x0:_0x3c6cfb[_0x6b50('0x1f')];var _0x2ada0f=_0x319234?_0x367cd8[_0x6b50('0x22')]:_0x3c6cfb[_0x6b50('0x1f')]+_0x3c6cfb[_0x6b50('0x21')];var _0x16fced;if(_0x2ada0f>=_0x5728dd){_0x2ada0f=_0x5728dd;_0x16fced=0xc8;}else{_0x16fced=0xce;}_0xc7bab0[_0x6b50('0x1d')](_0x16fced);return _0xc7bab0['set']('Content-Range',_0x19c2d9+'-'+_0x2ada0f+'/'+_0x5728dd)['json'](_0x367cd8);}return null;};}function patchUpdates(_0x2cdafd){return function(_0x45c90b){try{jsonpatch[_0x6b50('0x23')](_0x45c90b,_0x2cdafd,!![]);}catch(_0x411b10){return BPromise[_0x6b50('0x24')](_0x411b10);}return _0x45c90b[_0x6b50('0x25')]();};}function saveUpdates(_0x3fc2b6,_0x20bbfa){return function(_0x496471){if(_0x496471){return _0x496471[_0x6b50('0x26')](_0x3fc2b6)[_0x6b50('0x27')](function(_0x58c0c8){return _0x58c0c8;});}return null;};}function removeEntity(_0xf933b4,_0x1f7535){return function(_0x32b861){if(_0x32b861){return _0x32b861[_0x6b50('0x28')]()[_0x6b50('0x27')](function(){var _0xb589dd=_0x32b861[_0x6b50('0x29')]({'plain':!![]});var _0x551e1c='SmsQueues';return db[_0x6b50('0x2a')][_0x6b50('0x28')]({'where':{'type':_0x551e1c,'resourceId':_0xb589dd['id']}})[_0x6b50('0x27')](function(){return _0x32b861;});})['then'](function(){_0xf933b4[_0x6b50('0x1d')](0xcc)[_0x6b50('0x2b')]();});}};}function handleEntityNotFound(_0x16e5b1,_0x4286df){return function(_0x175938){if(!_0x175938){_0x16e5b1[_0x6b50('0x1c')](0x194);}return _0x175938;};}function handleError(_0x1437f6,_0x275632){_0x275632=_0x275632||0x1f4;return function(_0x469cac){logger[_0x6b50('0x2c')](_0x469cac[_0x6b50('0x2d')]);if(_0x469cac[_0x6b50('0x2e')]){delete _0x469cac[_0x6b50('0x2e')];}_0x1437f6[_0x6b50('0x1d')](_0x275632)['send'](_0x469cac);};}exports[_0x6b50('0x2f')]=function(_0x496467,_0x33bcfa){var _0x5494a0={},_0x1c93cb={},_0xaa76a9={'count':0x0,'rows':[]};var _0x4da1cf=_['map'](db[_0x6b50('0x30')][_0x6b50('0x31')],function(_0x2036ca){return{'name':_0x2036ca['fieldName'],'type':_0x2036ca[_0x6b50('0x32')][_0x6b50('0x33')]};});_0x1c93cb['model']=_[_0x6b50('0x34')](_0x4da1cf,'name');_0x1c93cb[_0x6b50('0x35')]=_[_0x6b50('0x36')](_0x496467['query']);_0x1c93cb[_0x6b50('0x37')]=_[_0x6b50('0x38')](_0x1c93cb['model'],_0x1c93cb[_0x6b50('0x35')]);_0x5494a0[_0x6b50('0x39')]=_[_0x6b50('0x38')](_0x1c93cb[_0x6b50('0x3a')],qs[_0x6b50('0x3b')](_0x496467[_0x6b50('0x35')]['fields']));_0x5494a0['attributes']=_0x5494a0[_0x6b50('0x39')]['length']?_0x5494a0[_0x6b50('0x39')]:_0x1c93cb[_0x6b50('0x3a')];if(!_0x496467[_0x6b50('0x35')][_0x6b50('0x3c')]('nolimit')){_0x5494a0[_0x6b50('0x21')]=qs[_0x6b50('0x21')](_0x496467[_0x6b50('0x35')][_0x6b50('0x21')]);_0x5494a0[_0x6b50('0x1f')]=qs[_0x6b50('0x1f')](_0x496467[_0x6b50('0x35')][_0x6b50('0x1f')]);}_0x5494a0['order']=qs[_0x6b50('0x3d')](_0x496467[_0x6b50('0x35')][_0x6b50('0x3d')]);_0x5494a0['where']=qs[_0x6b50('0x37')](_[_0x6b50('0x3e')](_0x496467[_0x6b50('0x35')],_0x1c93cb[_0x6b50('0x37')]),_0x4da1cf);if(_0x496467[_0x6b50('0x35')][_0x6b50('0x3f')]){_0x5494a0[_0x6b50('0x40')]=_['merge'](_0x5494a0[_0x6b50('0x40')],{'$or':_[_0x6b50('0x34')](_0x4da1cf,function(_0x54f364){if(_0x54f364['type']!==_0x6b50('0x41')){var _0x23f8ab={};_0x23f8ab[_0x54f364['name']]={'$like':'%'+_0x496467['query'][_0x6b50('0x3f')]+'%'};return _0x23f8ab;}})});}_0x5494a0=_[_0x6b50('0x42')]({},_0x5494a0,_0x496467[_0x6b50('0x43')]);var _0xbce6a3={'where':_0x5494a0[_0x6b50('0x40')]};return db['SmsQueue'][_0x6b50('0x22')](_0xbce6a3)[_0x6b50('0x27')](function(_0x424012){_0xaa76a9[_0x6b50('0x22')]=_0x424012;if(_0x496467[_0x6b50('0x35')][_0x6b50('0x44')]){_0x5494a0[_0x6b50('0x45')]=[{'all':!![]}];}return db[_0x6b50('0x30')][_0x6b50('0x46')](_0x5494a0);})[_0x6b50('0x27')](function(_0x3d6154){_0xaa76a9[_0x6b50('0x47')]=_0x3d6154;return _0xaa76a9;})[_0x6b50('0x27')](respondWithFilteredResult(_0x33bcfa,_0x5494a0))[_0x6b50('0x48')](handleError(_0x33bcfa,null));};exports['show']=function(_0x2cb3f1,_0x75d10a){var _0x4b55c8={'raw':!![],'where':{'id':_0x2cb3f1[_0x6b50('0x49')]['id']}},_0x595c75={};_0x595c75[_0x6b50('0x3a')]=_[_0x6b50('0x36')](db[_0x6b50('0x30')]['rawAttributes']);_0x595c75[_0x6b50('0x35')]=_[_0x6b50('0x36')](_0x2cb3f1[_0x6b50('0x35')]);_0x595c75['filters']=_[_0x6b50('0x38')](_0x595c75[_0x6b50('0x3a')],_0x595c75[_0x6b50('0x35')]);_0x4b55c8[_0x6b50('0x39')]=_[_0x6b50('0x38')](_0x595c75[_0x6b50('0x3a')],qs[_0x6b50('0x3b')](_0x2cb3f1[_0x6b50('0x35')][_0x6b50('0x3b')]));_0x4b55c8[_0x6b50('0x39')]=_0x4b55c8['attributes'][_0x6b50('0x4a')]?_0x4b55c8[_0x6b50('0x39')]:_0x595c75[_0x6b50('0x3a')];if(_0x2cb3f1[_0x6b50('0x35')][_0x6b50('0x44')]){_0x4b55c8[_0x6b50('0x45')]=[{'all':!![]}];}_0x4b55c8=_[_0x6b50('0x42')]({},_0x4b55c8,_0x2cb3f1[_0x6b50('0x43')]);return db['SmsQueue'][_0x6b50('0x4b')](_0x4b55c8)[_0x6b50('0x27')](handleEntityNotFound(_0x75d10a,null))[_0x6b50('0x27')](respondWithResult(_0x75d10a,null))['catch'](handleError(_0x75d10a,null));};exports[_0x6b50('0x4c')]=function(_0xd55633,_0x192c42){return db['SmsQueue'][_0x6b50('0x4c')](_0xd55633[_0x6b50('0x4d')],{})[_0x6b50('0x27')](function(_0x349637){var _0x754f73=_0xd55633[_0x6b50('0x4e')][_0x6b50('0x29')]({'plain':!![]});if(!_0x754f73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x754f73[_0x6b50('0x4f')]==='user'){var _0xc0d01d=_0x349637[_0x6b50('0x29')]({'plain':!![]});var _0x135e75=_0x6b50('0x50');return db[_0x6b50('0x51')]['find']({'where':{'name':_0x135e75,'userProfileId':_0x754f73[_0x6b50('0x52')]},'raw':!![]})[_0x6b50('0x27')](function(_0x485f40){if(_0x485f40&&_0x485f40['autoAssociation']===0x0){return db[_0x6b50('0x2a')][_0x6b50('0x4c')]({'name':_0xc0d01d[_0x6b50('0x2e')],'resourceId':_0xc0d01d['id'],'type':_0x485f40['name'],'sectionId':_0x485f40['id']},{})[_0x6b50('0x27')](function(){return _0x349637;});}else{return _0x349637;}})[_0x6b50('0x48')](function(_0x47dc8d){logger[_0x6b50('0x2c')](_0x6b50('0x53'),_0x47dc8d);throw _0x47dc8d;});}return _0x349637;})[_0x6b50('0x27')](respondWithResult(_0x192c42,0xc9))[_0x6b50('0x48')](handleError(_0x192c42,null));};exports['update']=function(_0x490428,_0xb98735){if(_0x490428[_0x6b50('0x4d')]['id']){delete _0x490428[_0x6b50('0x4d')]['id'];}return db[_0x6b50('0x30')][_0x6b50('0x4b')]({'where':{'id':_0x490428[_0x6b50('0x49')]['id']}})['then'](handleEntityNotFound(_0xb98735,null))[_0x6b50('0x27')](saveUpdates(_0x490428[_0x6b50('0x4d')],null))[_0x6b50('0x27')](respondWithResult(_0xb98735,null))['catch'](handleError(_0xb98735,null));};exports[_0x6b50('0x28')]=function(_0x101085,_0x5f06e1){return db[_0x6b50('0x30')]['find']({'where':{'id':_0x101085[_0x6b50('0x49')]['id']}})[_0x6b50('0x27')](handleEntityNotFound(_0x5f06e1,null))[_0x6b50('0x27')](removeEntity(_0x5f06e1,null))[_0x6b50('0x48')](handleError(_0x5f06e1,null));};exports[_0x6b50('0x54')]=function(_0x2d9f88,_0xa25ec7){return db[_0x6b50('0x30')][_0x6b50('0x54')]()[_0x6b50('0x27')](respondWithResult(_0xa25ec7,null))[_0x6b50('0x48')](handleError(_0xa25ec7,null));};exports[_0x6b50('0x55')]=function(_0x5c0fd3,_0x1b1843,_0x3b6114){var _0x4c178a={'raw':!![],'where':{}},_0x3dfa3c={},_0x1983ee;return db[_0x6b50('0x30')][_0x6b50('0x56')]({'where':{'id':_0x5c0fd3[_0x6b50('0x49')]['id']}})[_0x6b50('0x27')](handleEntityNotFound(_0x1b1843,null))[_0x6b50('0x27')](function(_0x200a7f){if(_0x200a7f){_0x1983ee=_0x200a7f[_0x6b50('0x29')]({'plain':!![]});_0x3dfa3c['model']=_['keys'](db[_0x6b50('0x57')][_0x6b50('0x31')]);_0x3dfa3c[_0x6b50('0x35')]=_['keys'](_0x5c0fd3['query']);_0x3dfa3c[_0x6b50('0x37')]=_[_0x6b50('0x38')](_0x3dfa3c[_0x6b50('0x3a')],_0x3dfa3c[_0x6b50('0x35')]);_0x4c178a[_0x6b50('0x39')]=_[_0x6b50('0x38')](_0x3dfa3c[_0x6b50('0x3a')],qs[_0x6b50('0x3b')](_0x5c0fd3[_0x6b50('0x35')]['fields']));_0x4c178a[_0x6b50('0x39')]=_0x4c178a['attributes'][_0x6b50('0x4a')]?_0x4c178a[_0x6b50('0x39')]:_0x3dfa3c['model'];if(!_0x5c0fd3[_0x6b50('0x35')]['hasOwnProperty']('nolimit')){_0x4c178a[_0x6b50('0x21')]=qs[_0x6b50('0x21')](_0x5c0fd3[_0x6b50('0x35')][_0x6b50('0x21')]);_0x4c178a['offset']=qs[_0x6b50('0x1f')](_0x5c0fd3['query']['offset']);}_0x4c178a[_0x6b50('0x58')]=qs['sort'](_0x5c0fd3[_0x6b50('0x35')]['sort']);_0x4c178a[_0x6b50('0x40')]=qs[_0x6b50('0x37')](_['pick'](_0x5c0fd3[_0x6b50('0x35')],_0x3dfa3c[_0x6b50('0x37')]));_0x4c178a[_0x6b50('0x40')][_0x6b50('0x59')]=_0x200a7f['id'];if(_0x5c0fd3[_0x6b50('0x35')][_0x6b50('0x3f')]){_0x4c178a[_0x6b50('0x40')]=_[_0x6b50('0x42')](_0x4c178a[_0x6b50('0x40')],{'$or':_['map'](_0x4c178a[_0x6b50('0x39')],function(_0x4dc595){var _0x4dcaca={};_0x4dcaca[_0x4dc595]={'$like':'%'+_0x5c0fd3['query'][_0x6b50('0x3f')]+'%'};return _0x4dcaca;})});}_0x4c178a=_[_0x6b50('0x42')]({},_0x4c178a,_0x5c0fd3[_0x6b50('0x43')]);return db[_0x6b50('0x57')]['findAll'](_0x4c178a);}})[_0x6b50('0x27')](function(_0x67c738){if(_0x67c738){return db[_0x6b50('0x5a')][_0x6b50('0x5b')]({'where':{'id':_['map'](_0x67c738,_0x6b50('0x5c')),'role':_0x6b50('0x5d')},'attributes':['id',_0x6b50('0x2e'),_0x6b50('0x5e'),_0x6b50('0x5f'),_0x6b50('0x60')]});}})[_0x6b50('0x27')](function(_0x4bc9e2){if(_0x4bc9e2){return{'count':_0x4bc9e2[_0x6b50('0x22')],'rows':_[_0x6b50('0x34')](_0x4bc9e2['rows'],function(_0x13a736){return{'membername':_0x13a736[_0x6b50('0x2e')],'UserId':_0x13a736['id'],'queue_name':_0x1983ee[_0x6b50('0x2e')],'SmsQueueId':_0x1983ee['id'],'interface':util[_0x6b50('0x61')]('%s/%s',_0x6b50('0x62'),_0x13a736[_0x6b50('0x2e')]),'penalty':0x0,'paused':_0x13a736['smsPause'],'createdAt':_0x13a736[_0x6b50('0x60')],'updatedAt':_0x13a736[_0x6b50('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6b50('0x27')](respondWithFilteredResult(_0x1b1843,_0x4c178a))[_0x6b50('0x48')](handleError(_0x1b1843,null));};exports[_0x6b50('0x63')]=function(_0xa147e7,_0x119640,_0x3a6338){var _0x5f4f8f={};var _0x31a1b8={};var _0x3fa3d4;var _0x1ec83c;return db[_0x6b50('0x30')]['findOne']({'where':{'id':_0xa147e7[_0x6b50('0x49')]['id']}})[_0x6b50('0x27')](handleEntityNotFound(_0x119640,null))[_0x6b50('0x27')](function(_0x2d7a4c){if(_0x2d7a4c){_0x3fa3d4=_0x2d7a4c;_0x31a1b8[_0x6b50('0x3a')]=_[_0x6b50('0x36')](db[_0x6b50('0x64')][_0x6b50('0x31')]);_0x31a1b8[_0x6b50('0x35')]=_['keys'](_0xa147e7[_0x6b50('0x35')]);_0x31a1b8[_0x6b50('0x37')]=_[_0x6b50('0x38')](_0x31a1b8[_0x6b50('0x3a')],_0x31a1b8[_0x6b50('0x35')]);_0x5f4f8f[_0x6b50('0x39')]=_[_0x6b50('0x38')](_0x31a1b8['model'],qs['fields'](_0xa147e7['query'][_0x6b50('0x3b')]));_0x5f4f8f[_0x6b50('0x39')]=_0x5f4f8f[_0x6b50('0x39')][_0x6b50('0x4a')]?_0x5f4f8f[_0x6b50('0x39')]:_0x31a1b8[_0x6b50('0x3a')];_0x5f4f8f[_0x6b50('0x58')]=qs[_0x6b50('0x3d')](_0xa147e7['query']['sort']);_0x5f4f8f['where']=qs[_0x6b50('0x37')](_[_0x6b50('0x3e')](_0xa147e7['query'],_0x31a1b8[_0x6b50('0x37')]));if(_0xa147e7[_0x6b50('0x35')][_0x6b50('0x3f')]){_0x5f4f8f['where']=_[_0x6b50('0x42')](_0x5f4f8f[_0x6b50('0x40')],{'$or':_[_0x6b50('0x34')](_0x5f4f8f[_0x6b50('0x39')],function(_0x359dce){var _0x1ad09e={};_0x1ad09e[_0x359dce]={'$like':'%'+_0xa147e7[_0x6b50('0x35')][_0x6b50('0x3f')]+'%'};return _0x1ad09e;})});}_0x5f4f8f=_[_0x6b50('0x42')]({},_0x5f4f8f,_0xa147e7[_0x6b50('0x43')]);return _0x3fa3d4[_0x6b50('0x63')](_0x5f4f8f);}})[_0x6b50('0x27')](function(_0x293b0c){if(_0x293b0c){_0x1ec83c=_0x293b0c[_0x6b50('0x4a')];if(!_0xa147e7[_0x6b50('0x35')][_0x6b50('0x3c')](_0x6b50('0x65'))){_0x5f4f8f[_0x6b50('0x21')]=qs[_0x6b50('0x21')](_0xa147e7['query'][_0x6b50('0x21')]);_0x5f4f8f[_0x6b50('0x1f')]=qs[_0x6b50('0x1f')](_0xa147e7[_0x6b50('0x35')][_0x6b50('0x1f')]);}return _0x3fa3d4['getTeams'](_0x5f4f8f);}})[_0x6b50('0x27')](function(_0x3fa0ed){if(_0x3fa0ed){return _0x3fa0ed?{'count':_0x1ec83c,'rows':_0x3fa0ed}:null;}})[_0x6b50('0x27')](respondWithResult(_0x119640,null))[_0x6b50('0x48')](handleError(_0x119640,null));};exports[_0x6b50('0x66')]=function(_0x4b9c54,_0x5ef8e8,_0x3fdc01){var _0xed86d=_0x4b9c54[_0x6b50('0x4d')]['ids'];return db['Team']['findAll']({'where':{'id':_0xed86d},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6b50('0x67'),'attributes':['id',_0x6b50('0x2e'),_0x6b50('0x68'),_0x6b50('0x69'),_0x6b50('0x6a')],'raw':!![]}]})[_0x6b50('0x27')](function(_0x454750){if(_0x454750){var _0xaafb54=_[_0x6b50('0x6b')](_0x454750,function(_0x4c9d46){var _0x389ed2=_0x4c9d46[_0x6b50('0x29')]({'plain':!![]});return _0x389ed2['Agents'];});return db[_0x6b50('0x30')][_0x6b50('0x4b')]({'where':{'id':_0x4b9c54[_0x6b50('0x49')]['id']}})['then'](function(_0x56f28e){return db[_0x6b50('0x6c')][_0x6b50('0x6d')](function(_0x4ad6d5){return _0x56f28e[_0x6b50('0x66')](_0xed86d,{'transaction':_0x4ad6d5})[_0x6b50('0x27')](function(){return BPromise[_0x6b50('0x6e')](_0xaafb54,function(_0x3cb50c){return db[_0x6b50('0x57')][_0x6b50('0x6f')]({'where':{'UserId':_0x3cb50c['id'],'SmsQueueId':_0x4b9c54[_0x6b50('0x49')]['id']},'transaction':_0x4ad6d5});});})[_0x6b50('0x27')](function(){_0xaafb54[_0x6b50('0x70')](function(_0x35dd4f){socket['emit'](_0x6b50('0x71'),{'UserId':_0x35dd4f['id'],'SmsQueueId':_0x56f28e['id']});});});});});}})[_0x6b50('0x27')](respondWithStatusCode(_0x5ef8e8,null))[_0x6b50('0x48')](handleError(_0x5ef8e8,null));};exports[_0x6b50('0x72')]=function(_0x434e90,_0x495641,_0x212125){return db['Team']['findAll']({'where':{'id':_0x434e90['query'][_0x6b50('0x73')]},'attributes':['id'],'include':[{'model':db[_0x6b50('0x5a')],'as':_0x6b50('0x67'),'attributes':['id'],'raw':!![]}]})[_0x6b50('0x27')](handleEntityNotFound(_0x495641,null))[_0x6b50('0x27')](function(_0x13ebca){var _0x3a68fa=_[_0x6b50('0x34')](_0x13ebca,'id');var _0x253410=[];var _0x4eac61=[];var _0x554dfe=squel['select']();_0x554dfe[_0x6b50('0x74')](_0x6b50('0x75'))[_0x6b50('0x76')](_0x6b50('0x77'),'tq')[_0x6b50('0x78')]('user_has_teams','ut',_0x6b50('0x79'))['where'](_0x6b50('0x7a'),_0x434e90[_0x6b50('0x49')]['id']);for(var _0x5c72c6=0x0;_0x5c72c6<_0x13ebca[_0x6b50('0x4a')];_0x5c72c6+=0x1){let _0x52aec8=_0x13ebca[_0x5c72c6];for(var _0x35793c=0x0;_0x35793c<_0x52aec8['Agents'][_0x6b50('0x4a')];_0x35793c+=0x1){let _0x144395=_0x52aec8[_0x6b50('0x67')][_0x35793c];var _0x3f9d3b=_0x554dfe[_0x6b50('0x7b')]();_0x3f9d3b['where']('ut.UserId\x20=\x20?',_0x144395['id']);_0x4eac61['push'](db[_0x6b50('0x6c')][_0x6b50('0x35')](_0x3f9d3b[_0x6b50('0x7c')](),{'type':db[_0x6b50('0x6c')][_0x6b50('0x7d')]['SELECT']})['then'](function(_0x3b59b0){if(_0x3b59b0[_0x6b50('0x4a')]===0x1){return _0x144395['id'];}else{var _0x592269=_[_0x6b50('0x7e')](_['map'](_0x3b59b0,'TeamId'),function(_0x511a93){return _[_0x6b50('0x7f')](_0x3a68fa,_0x511a93);});if(_0x592269){return _0x144395['id'];}}}));}}return BPromise[_0x6b50('0x80')](_0x4eac61)[_0x6b50('0x27')](function(_0xba944c){_0x253410=_(_0x253410)[_0x6b50('0x81')](_0xba944c)['compact']()[_0x6b50('0x82')]();return db[_0x6b50('0x30')][_0x6b50('0x4b')]({'where':{'id':_0x434e90[_0x6b50('0x49')]['id']}})['then'](function(_0x2dd171){return db[_0x6b50('0x6c')][_0x6b50('0x6d')](function(_0x996300){return _0x2dd171[_0x6b50('0x72')](_0x434e90[_0x6b50('0x35')][_0x6b50('0x73')],{'transaction':_0x996300})['then'](function(){if(!_[_0x6b50('0x83')](_0x253410)){return _0x2dd171[_0x6b50('0x84')](_0x253410,{'transaction':_0x996300});}})[_0x6b50('0x27')](function(){_0x253410[_0x6b50('0x70')](function(_0x3cf576){socket[_0x6b50('0x85')](_0x6b50('0x86'),{'UserId':_0x3cf576,'SmsQueueId':_0x2dd171['id']});});});});});});})[_0x6b50('0x27')](respondWithStatusCode(_0x495641,null))[_0x6b50('0x48')](handleError(_0x495641,null));};exports[_0x6b50('0x87')]=function(_0x5635ac,_0x488841,_0x31e7e1){return db[_0x6b50('0x30')][_0x6b50('0x4b')]({'where':{'id':_0x5635ac[_0x6b50('0x49')]['id']}})[_0x6b50('0x27')](handleEntityNotFound(_0x488841,null))[_0x6b50('0x27')](function(_0x5c4379){if(_0x5c4379){return _0x5c4379[_0x6b50('0x87')](_0x5635ac[_0x6b50('0x4d')][_0x6b50('0x73')],_[_0x6b50('0x88')](_0x5635ac[_0x6b50('0x4d')],['ids','id'])||{})['spread'](function(_0x570341){for(var _0x21f699=0x0;_0x21f699<_0x5635ac[_0x6b50('0x4d')][_0x6b50('0x73')]['length'];_0x21f699+=0x1){socket[_0x6b50('0x85')](_0x6b50('0x71'),{'UserId':Number(_0x5635ac[_0x6b50('0x4d')][_0x6b50('0x73')][_0x21f699]),'SmsQueueId':Number(_0x5635ac[_0x6b50('0x49')]['id'])});}return _0x570341;});}})[_0x6b50('0x27')](respondWithResult(_0x488841,null))[_0x6b50('0x48')](handleError(_0x488841,null));};exports['removeAgents']=function(_0x3e342c,_0xa5d119,_0x32a9c0){return db[_0x6b50('0x30')][_0x6b50('0x4b')]({'where':{'id':_0x3e342c[_0x6b50('0x49')]['id']}})['then'](handleEntityNotFound(_0xa5d119,null))['then'](function(_0x1dd6b1){if(_0x1dd6b1){return _0x1dd6b1[_0x6b50('0x84')](_0x3e342c[_0x6b50('0x35')][_0x6b50('0x73')])[_0x6b50('0x27')](function(){if(_['isArray'](_0x3e342c['query'][_0x6b50('0x73')])){for(var _0x1d64da=0x0;_0x1d64da<_0x3e342c[_0x6b50('0x35')][_0x6b50('0x73')][_0x6b50('0x4a')];_0x1d64da+=0x1){socket[_0x6b50('0x85')]('userSmsQueue:remove',{'UserId':Number(_0x3e342c[_0x6b50('0x35')][_0x6b50('0x73')][_0x1d64da]),'SmsQueueId':Number(_0x3e342c[_0x6b50('0x49')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x3e342c[_0x6b50('0x35')][_0x6b50('0x73')]),'SmsQueueId':Number(_0x3e342c['params']['id'])});}});}})[_0x6b50('0x27')](respondWithStatusCode(_0xa5d119,null))[_0x6b50('0x48')](handleError(_0xa5d119,null));};exports[_0x6b50('0x89')]=function(_0x99cb69,_0x37c533,_0x4470a0){var _0x592702={};var _0x168084={};var _0x1495bd;var _0x55774d;return db[_0x6b50('0x30')][_0x6b50('0x56')]({'where':{'id':_0x99cb69['params']['id']}})[_0x6b50('0x27')](handleEntityNotFound(_0x37c533,null))[_0x6b50('0x27')](function(_0x50f732){if(_0x50f732){_0x1495bd=_0x50f732;_0x168084['model']=_[_0x6b50('0x36')](db[_0x6b50('0x5a')][_0x6b50('0x31')]);_0x168084[_0x6b50('0x35')]=_[_0x6b50('0x36')](_0x99cb69[_0x6b50('0x35')]);_0x168084[_0x6b50('0x37')]=_['intersection'](_0x168084[_0x6b50('0x3a')],_0x168084[_0x6b50('0x35')]);_0x592702[_0x6b50('0x39')]=_[_0x6b50('0x38')](_0x168084[_0x6b50('0x3a')],qs['fields'](_0x99cb69[_0x6b50('0x35')][_0x6b50('0x3b')]));_0x592702['attributes']=_0x592702[_0x6b50('0x39')][_0x6b50('0x4a')]?_0x592702[_0x6b50('0x39')]:_0x168084['model'];_0x592702[_0x6b50('0x58')]=qs[_0x6b50('0x3d')](_0x99cb69[_0x6b50('0x35')][_0x6b50('0x3d')]);_0x592702[_0x6b50('0x40')]=qs[_0x6b50('0x37')](_[_0x6b50('0x3e')](_0x99cb69[_0x6b50('0x35')],_0x168084[_0x6b50('0x37')]));if(_0x99cb69['query'][_0x6b50('0x3f')]){_0x592702[_0x6b50('0x40')]=_['merge'](_0x592702[_0x6b50('0x40')],{'$or':_['map'](_0x592702[_0x6b50('0x39')],function(_0x23a44c){var _0x22be58={};_0x22be58[_0x23a44c]={'$like':'%'+_0x99cb69[_0x6b50('0x35')][_0x6b50('0x3f')]+'%'};return _0x22be58;})});}_0x592702=_['merge']({},_0x592702,_0x99cb69['options']);return _0x1495bd['getAgents'](_0x592702);}})[_0x6b50('0x27')](function(_0x446eff){if(_0x446eff){_0x55774d=_0x446eff[_0x6b50('0x4a')];if(!_0x99cb69[_0x6b50('0x35')][_0x6b50('0x3c')]('nolimit')){_0x592702[_0x6b50('0x21')]=qs['limit'](_0x99cb69[_0x6b50('0x35')][_0x6b50('0x21')]);_0x592702[_0x6b50('0x1f')]=qs[_0x6b50('0x1f')](_0x99cb69[_0x6b50('0x35')]['offset']);}return _0x1495bd[_0x6b50('0x89')](_0x592702);}})['then'](function(_0x97b7e9){if(_0x97b7e9){return _0x97b7e9?{'count':_0x55774d,'rows':_0x97b7e9}:null;}})[_0x6b50('0x27')](respondWithResult(_0x37c533,null))[_0x6b50('0x48')](handleError(_0x37c533,null));}; \ No newline at end of file +var _0x4b20=['includes','all','union','removeTeams','isEmpty','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','SmsQueues','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','SmsQueue','findAll','rows','catch','show','params','keys','include','find','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserSmsQueue','length','SmsQueueId','UserId','smsPause','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','select','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT'];(function(_0x14736f,_0x3f249b){var _0x2f68bb=function(_0x42d624){while(--_0x42d624){_0x14736f['push'](_0x14736f['shift']());}};_0x2f68bb(++_0x3f249b);}(_0x4b20,0x116));var _0x04b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b20[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x04b2('0x0'));var rimraf=require(_0x04b2('0x1'));var zipdir=require(_0x04b2('0x2'));var jsonpatch=require(_0x04b2('0x3'));var rp=require(_0x04b2('0x4'));var moment=require(_0x04b2('0x5'));var BPromise=require(_0x04b2('0x6'));var Mustache=require(_0x04b2('0x7'));var util=require(_0x04b2('0x8'));var path=require(_0x04b2('0x9'));var sox=require(_0x04b2('0xa'));var csv=require('to-csv');var ejs=require(_0x04b2('0xb'));var fs=require('fs');var fs_extra=require(_0x04b2('0xc'));var _=require('lodash');var squel=require(_0x04b2('0xd'));var crypto=require(_0x04b2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x04b2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x04b2('0x10'));var Papa=require('papaparse');var Redis=require(_0x04b2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x04b2('0x12'));var as=require(_0x04b2('0x13'));var hardwareService=require(_0x04b2('0x14'));var logger=require(_0x04b2('0x15'))(_0x04b2('0x16'));var utils=require('../../config/utils');var config=require(_0x04b2('0x17'));var licenseUtil=require(_0x04b2('0x18'));var db=require('../../mysqldb')['db'];config[_0x04b2('0x19')]=_['defaults'](config[_0x04b2('0x19')],{'host':_0x04b2('0x1a'),'port':0x18eb});var socket=require(_0x04b2('0x1b'))(new Redis(config[_0x04b2('0x19')]));require('./smsQueue.socket')[_0x04b2('0x1c')](socket);function respondWithStatusCode(_0x382179,_0x4c290e){_0x4c290e=_0x4c290e||0xcc;return function(_0xf23959){if(_0xf23959){return _0x382179[_0x04b2('0x1d')](_0x4c290e);}return _0x382179[_0x04b2('0x1e')](_0x4c290e)['end']();};}function respondWithResult(_0xfdda48,_0x218557){_0x218557=_0x218557||0xc8;return function(_0x43547a){if(_0x43547a){return _0xfdda48[_0x04b2('0x1e')](_0x218557)[_0x04b2('0x1f')](_0x43547a);}};}function respondWithFilteredResult(_0xdcf19c,_0x49d47a){return function(_0x50c7d4){if(_0x50c7d4){var _0x4662d7=typeof _0x49d47a[_0x04b2('0x20')]===_0x04b2('0x21')&&typeof _0x49d47a[_0x04b2('0x22')]===_0x04b2('0x21');var _0x6dc675=_0x50c7d4[_0x04b2('0x23')];var _0x11210c=_0x4662d7?0x0:_0x49d47a[_0x04b2('0x20')];var _0x16a042=_0x4662d7?_0x50c7d4[_0x04b2('0x23')]:_0x49d47a[_0x04b2('0x20')]+_0x49d47a['limit'];var _0x3cbdd8;if(_0x16a042>=_0x6dc675){_0x16a042=_0x6dc675;_0x3cbdd8=0xc8;}else{_0x3cbdd8=0xce;}_0xdcf19c[_0x04b2('0x1e')](_0x3cbdd8);return _0xdcf19c[_0x04b2('0x24')](_0x04b2('0x25'),_0x11210c+'-'+_0x16a042+'/'+_0x6dc675)[_0x04b2('0x1f')](_0x50c7d4);}return null;};}function patchUpdates(_0x4540d9){return function(_0x46aa7b){try{jsonpatch['apply'](_0x46aa7b,_0x4540d9,!![]);}catch(_0x17a70a){return BPromise['reject'](_0x17a70a);}return _0x46aa7b[_0x04b2('0x26')]();};}function saveUpdates(_0x2374b7,_0xe3060f){return function(_0x5f15d3){if(_0x5f15d3){return _0x5f15d3[_0x04b2('0x27')](_0x2374b7)[_0x04b2('0x28')](function(_0x4be996){return _0x4be996;});}return null;};}function removeEntity(_0x40c56f,_0x313477){return function(_0x45ff15){if(_0x45ff15){return _0x45ff15[_0x04b2('0x29')]()[_0x04b2('0x28')](function(){var _0x39a4ab=_0x45ff15['get']({'plain':!![]});var _0x3433ce=_0x04b2('0x2a');return db[_0x04b2('0x2b')]['destroy']({'where':{'type':_0x3433ce,'resourceId':_0x39a4ab['id']}})[_0x04b2('0x28')](function(){return _0x45ff15;});})[_0x04b2('0x28')](function(){_0x40c56f[_0x04b2('0x1e')](0xcc)[_0x04b2('0x2c')]();});}};}function handleEntityNotFound(_0x350f74,_0x1f07c4){return function(_0x532a53){if(!_0x532a53){_0x350f74['sendStatus'](0x194);}return _0x532a53;};}function handleError(_0x49ef0d,_0x5228bf){_0x5228bf=_0x5228bf||0x1f4;return function(_0x250f89){logger[_0x04b2('0x2d')](_0x250f89[_0x04b2('0x2e')]);if(_0x250f89[_0x04b2('0x2f')]){delete _0x250f89[_0x04b2('0x2f')];}_0x49ef0d['status'](_0x5228bf)[_0x04b2('0x30')](_0x250f89);};}exports[_0x04b2('0x31')]=function(_0x383ed1,_0x48b12b){var _0x4cce29={},_0x4aee9b={},_0x130da3={'count':0x0,'rows':[]};var _0x3b0bfb=_['map'](db['SmsQueue'][_0x04b2('0x32')],function(_0x19ce78){return{'name':_0x19ce78[_0x04b2('0x33')],'type':_0x19ce78[_0x04b2('0x34')]['key']};});_0x4aee9b[_0x04b2('0x35')]=_['map'](_0x3b0bfb,'name');_0x4aee9b[_0x04b2('0x36')]=_['keys'](_0x383ed1[_0x04b2('0x36')]);_0x4aee9b[_0x04b2('0x37')]=_[_0x04b2('0x38')](_0x4aee9b['model'],_0x4aee9b[_0x04b2('0x36')]);_0x4cce29['attributes']=_['intersection'](_0x4aee9b['model'],qs[_0x04b2('0x39')](_0x383ed1['query']['fields']));_0x4cce29[_0x04b2('0x3a')]=_0x4cce29[_0x04b2('0x3a')]['length']?_0x4cce29[_0x04b2('0x3a')]:_0x4aee9b[_0x04b2('0x35')];if(!_0x383ed1['query'][_0x04b2('0x3b')](_0x04b2('0x3c'))){_0x4cce29[_0x04b2('0x22')]=qs[_0x04b2('0x22')](_0x383ed1[_0x04b2('0x36')][_0x04b2('0x22')]);_0x4cce29['offset']=qs['offset'](_0x383ed1[_0x04b2('0x36')]['offset']);}_0x4cce29[_0x04b2('0x3d')]=qs['sort'](_0x383ed1['query'][_0x04b2('0x3e')]);_0x4cce29[_0x04b2('0x3f')]=qs[_0x04b2('0x37')](_[_0x04b2('0x40')](_0x383ed1[_0x04b2('0x36')],_0x4aee9b[_0x04b2('0x37')]),_0x3b0bfb);if(_0x383ed1['query'][_0x04b2('0x41')]){_0x4cce29[_0x04b2('0x3f')]=_[_0x04b2('0x42')](_0x4cce29['where'],{'$or':_[_0x04b2('0x43')](_0x3b0bfb,function(_0x5ae9ea){if(_0x5ae9ea[_0x04b2('0x34')]!==_0x04b2('0x44')){var _0x1a7a1c={};_0x1a7a1c[_0x5ae9ea[_0x04b2('0x2f')]]={'$like':'%'+_0x383ed1[_0x04b2('0x36')][_0x04b2('0x41')]+'%'};return _0x1a7a1c;}})});}_0x4cce29=_[_0x04b2('0x42')]({},_0x4cce29,_0x383ed1[_0x04b2('0x45')]);var _0x4821cf={'where':_0x4cce29[_0x04b2('0x3f')]};return db['SmsQueue'][_0x04b2('0x23')](_0x4821cf)[_0x04b2('0x28')](function(_0x3b065a){_0x130da3[_0x04b2('0x23')]=_0x3b065a;if(_0x383ed1[_0x04b2('0x36')][_0x04b2('0x46')]){_0x4cce29['include']=[{'all':!![]}];}return db[_0x04b2('0x47')][_0x04b2('0x48')](_0x4cce29);})[_0x04b2('0x28')](function(_0x169361){_0x130da3[_0x04b2('0x49')]=_0x169361;return _0x130da3;})[_0x04b2('0x28')](respondWithFilteredResult(_0x48b12b,_0x4cce29))[_0x04b2('0x4a')](handleError(_0x48b12b,null));};exports[_0x04b2('0x4b')]=function(_0x1b6a7b,_0x58c67a){var _0x408001={'raw':!![],'where':{'id':_0x1b6a7b[_0x04b2('0x4c')]['id']}},_0x2d096d={};_0x2d096d[_0x04b2('0x35')]=_[_0x04b2('0x4d')](db[_0x04b2('0x47')][_0x04b2('0x32')]);_0x2d096d[_0x04b2('0x36')]=_[_0x04b2('0x4d')](_0x1b6a7b[_0x04b2('0x36')]);_0x2d096d[_0x04b2('0x37')]=_[_0x04b2('0x38')](_0x2d096d[_0x04b2('0x35')],_0x2d096d[_0x04b2('0x36')]);_0x408001[_0x04b2('0x3a')]=_[_0x04b2('0x38')](_0x2d096d[_0x04b2('0x35')],qs[_0x04b2('0x39')](_0x1b6a7b[_0x04b2('0x36')][_0x04b2('0x39')]));_0x408001['attributes']=_0x408001[_0x04b2('0x3a')]['length']?_0x408001[_0x04b2('0x3a')]:_0x2d096d['model'];if(_0x1b6a7b[_0x04b2('0x36')][_0x04b2('0x46')]){_0x408001[_0x04b2('0x4e')]=[{'all':!![]}];}_0x408001=_['merge']({},_0x408001,_0x1b6a7b[_0x04b2('0x45')]);return db[_0x04b2('0x47')][_0x04b2('0x4f')](_0x408001)['then'](handleEntityNotFound(_0x58c67a,null))[_0x04b2('0x28')](respondWithResult(_0x58c67a,null))['catch'](handleError(_0x58c67a,null));};exports['create']=function(_0x4b6d81,_0x2e22b3){return db[_0x04b2('0x47')]['create'](_0x4b6d81['body'],{})[_0x04b2('0x28')](function(_0x22a89){var _0x5cd41d=_0x4b6d81['user'][_0x04b2('0x50')]({'plain':!![]});if(!_0x5cd41d)throw new Error(_0x04b2('0x51'));if(_0x5cd41d[_0x04b2('0x52')]===_0x04b2('0x53')){var _0xe053a0=_0x22a89[_0x04b2('0x50')]({'plain':!![]});var _0xae7eb6=_0x04b2('0x2a');return db['UserProfileSection'][_0x04b2('0x4f')]({'where':{'name':_0xae7eb6,'userProfileId':_0x5cd41d[_0x04b2('0x54')]},'raw':!![]})[_0x04b2('0x28')](function(_0x255069){if(_0x255069&&_0x255069['autoAssociation']===0x0){return db[_0x04b2('0x2b')][_0x04b2('0x55')]({'name':_0xe053a0['name'],'resourceId':_0xe053a0['id'],'type':_0x255069['name'],'sectionId':_0x255069['id']},{})['then'](function(){return _0x22a89;});}else{return _0x22a89;}})[_0x04b2('0x4a')](function(_0x1e347b){logger[_0x04b2('0x2d')](_0x04b2('0x56'),_0x1e347b);throw _0x1e347b;});}return _0x22a89;})[_0x04b2('0x28')](respondWithResult(_0x2e22b3,0xc9))[_0x04b2('0x4a')](handleError(_0x2e22b3,null));};exports[_0x04b2('0x27')]=function(_0x2655ad,_0x67cbe2){if(_0x2655ad[_0x04b2('0x57')]['id']){delete _0x2655ad[_0x04b2('0x57')]['id'];}return db[_0x04b2('0x47')][_0x04b2('0x4f')]({'where':{'id':_0x2655ad['params']['id']}})['then'](handleEntityNotFound(_0x67cbe2,null))[_0x04b2('0x28')](saveUpdates(_0x2655ad[_0x04b2('0x57')],null))[_0x04b2('0x28')](respondWithResult(_0x67cbe2,null))[_0x04b2('0x4a')](handleError(_0x67cbe2,null));};exports[_0x04b2('0x29')]=function(_0x454180,_0x3d3b88){return db[_0x04b2('0x47')][_0x04b2('0x4f')]({'where':{'id':_0x454180['params']['id']}})[_0x04b2('0x28')](handleEntityNotFound(_0x3d3b88,null))[_0x04b2('0x28')](removeEntity(_0x3d3b88,null))[_0x04b2('0x4a')](handleError(_0x3d3b88,null));};exports['describe']=function(_0x7eefb,_0x478b3d){return db['SmsQueue'][_0x04b2('0x58')]()[_0x04b2('0x28')](respondWithResult(_0x478b3d,null))[_0x04b2('0x4a')](handleError(_0x478b3d,null));};exports['getMembers']=function(_0x42ecbb,_0x1230f8,_0x13df31){var _0x27f86c={'raw':!![],'where':{}},_0x4dd7cf={},_0x479520;return db[_0x04b2('0x47')][_0x04b2('0x59')]({'where':{'id':_0x42ecbb[_0x04b2('0x4c')]['id']}})[_0x04b2('0x28')](handleEntityNotFound(_0x1230f8,null))[_0x04b2('0x28')](function(_0xc11d62){if(_0xc11d62){_0x479520=_0xc11d62[_0x04b2('0x50')]({'plain':!![]});_0x4dd7cf[_0x04b2('0x35')]=_[_0x04b2('0x4d')](db[_0x04b2('0x5a')][_0x04b2('0x32')]);_0x4dd7cf[_0x04b2('0x36')]=_[_0x04b2('0x4d')](_0x42ecbb[_0x04b2('0x36')]);_0x4dd7cf[_0x04b2('0x37')]=_[_0x04b2('0x38')](_0x4dd7cf[_0x04b2('0x35')],_0x4dd7cf[_0x04b2('0x36')]);_0x27f86c[_0x04b2('0x3a')]=_['intersection'](_0x4dd7cf[_0x04b2('0x35')],qs[_0x04b2('0x39')](_0x42ecbb[_0x04b2('0x36')][_0x04b2('0x39')]));_0x27f86c[_0x04b2('0x3a')]=_0x27f86c[_0x04b2('0x3a')][_0x04b2('0x5b')]?_0x27f86c[_0x04b2('0x3a')]:_0x4dd7cf[_0x04b2('0x35')];if(!_0x42ecbb[_0x04b2('0x36')][_0x04b2('0x3b')](_0x04b2('0x3c'))){_0x27f86c[_0x04b2('0x22')]=qs[_0x04b2('0x22')](_0x42ecbb[_0x04b2('0x36')][_0x04b2('0x22')]);_0x27f86c[_0x04b2('0x20')]=qs['offset'](_0x42ecbb[_0x04b2('0x36')]['offset']);}_0x27f86c[_0x04b2('0x3d')]=qs['sort'](_0x42ecbb[_0x04b2('0x36')][_0x04b2('0x3e')]);_0x27f86c['where']=qs[_0x04b2('0x37')](_[_0x04b2('0x40')](_0x42ecbb[_0x04b2('0x36')],_0x4dd7cf[_0x04b2('0x37')]));_0x27f86c[_0x04b2('0x3f')][_0x04b2('0x5c')]=_0xc11d62['id'];if(_0x42ecbb['query'][_0x04b2('0x41')]){_0x27f86c['where']=_[_0x04b2('0x42')](_0x27f86c[_0x04b2('0x3f')],{'$or':_[_0x04b2('0x43')](_0x27f86c['attributes'],function(_0x288640){var _0x2b341e={};_0x2b341e[_0x288640]={'$like':'%'+_0x42ecbb['query']['filter']+'%'};return _0x2b341e;})});}_0x27f86c=_[_0x04b2('0x42')]({},_0x27f86c,_0x42ecbb[_0x04b2('0x45')]);return db['UserSmsQueue']['findAll'](_0x27f86c);}})[_0x04b2('0x28')](function(_0x4ff26a){if(_0x4ff26a){return db['User']['findAndCountAll']({'where':{'id':_[_0x04b2('0x43')](_0x4ff26a,_0x04b2('0x5d')),'role':'agent'},'attributes':['id','name',_0x04b2('0x5e'),'updatedAt',_0x04b2('0x5f')]});}})[_0x04b2('0x28')](function(_0x9b6994){if(_0x9b6994){return{'count':_0x9b6994[_0x04b2('0x23')],'rows':_[_0x04b2('0x43')](_0x9b6994[_0x04b2('0x49')],function(_0xad20d){return{'membername':_0xad20d[_0x04b2('0x2f')],'UserId':_0xad20d['id'],'queue_name':_0x479520[_0x04b2('0x2f')],'SmsQueueId':_0x479520['id'],'interface':util[_0x04b2('0x60')](_0x04b2('0x61'),'SIP',_0xad20d['name']),'penalty':0x0,'paused':_0xad20d[_0x04b2('0x5e')],'createdAt':_0xad20d['createdAt'],'updatedAt':_0xad20d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1230f8,_0x27f86c))[_0x04b2('0x4a')](handleError(_0x1230f8,null));};exports[_0x04b2('0x62')]=function(_0x4d02d8,_0x457147,_0x258161){var _0x374a8f={};var _0x3368d9={};var _0x5067da;var _0x1ccf9d;return db[_0x04b2('0x47')][_0x04b2('0x59')]({'where':{'id':_0x4d02d8['params']['id']}})[_0x04b2('0x28')](handleEntityNotFound(_0x457147,null))[_0x04b2('0x28')](function(_0x351344){if(_0x351344){_0x5067da=_0x351344;_0x3368d9[_0x04b2('0x35')]=_[_0x04b2('0x4d')](db[_0x04b2('0x63')][_0x04b2('0x32')]);_0x3368d9['query']=_['keys'](_0x4d02d8['query']);_0x3368d9['filters']=_[_0x04b2('0x38')](_0x3368d9['model'],_0x3368d9[_0x04b2('0x36')]);_0x374a8f[_0x04b2('0x3a')]=_[_0x04b2('0x38')](_0x3368d9[_0x04b2('0x35')],qs[_0x04b2('0x39')](_0x4d02d8[_0x04b2('0x36')][_0x04b2('0x39')]));_0x374a8f['attributes']=_0x374a8f[_0x04b2('0x3a')]['length']?_0x374a8f['attributes']:_0x3368d9['model'];_0x374a8f[_0x04b2('0x3d')]=qs[_0x04b2('0x3e')](_0x4d02d8[_0x04b2('0x36')]['sort']);_0x374a8f['where']=qs[_0x04b2('0x37')](_[_0x04b2('0x40')](_0x4d02d8[_0x04b2('0x36')],_0x3368d9[_0x04b2('0x37')]));if(_0x4d02d8['query'][_0x04b2('0x41')]){_0x374a8f[_0x04b2('0x3f')]=_['merge'](_0x374a8f[_0x04b2('0x3f')],{'$or':_[_0x04b2('0x43')](_0x374a8f[_0x04b2('0x3a')],function(_0x16a0e5){var _0x4cccb4={};_0x4cccb4[_0x16a0e5]={'$like':'%'+_0x4d02d8[_0x04b2('0x36')][_0x04b2('0x41')]+'%'};return _0x4cccb4;})});}_0x374a8f=_[_0x04b2('0x42')]({},_0x374a8f,_0x4d02d8[_0x04b2('0x45')]);return _0x5067da[_0x04b2('0x62')](_0x374a8f);}})[_0x04b2('0x28')](function(_0x161d10){if(_0x161d10){_0x1ccf9d=_0x161d10[_0x04b2('0x5b')];if(!_0x4d02d8[_0x04b2('0x36')][_0x04b2('0x3b')]('nolimit')){_0x374a8f[_0x04b2('0x22')]=qs[_0x04b2('0x22')](_0x4d02d8['query'][_0x04b2('0x22')]);_0x374a8f[_0x04b2('0x20')]=qs[_0x04b2('0x20')](_0x4d02d8[_0x04b2('0x36')][_0x04b2('0x20')]);}return _0x5067da['getTeams'](_0x374a8f);}})[_0x04b2('0x28')](function(_0x2a93bd){if(_0x2a93bd){return _0x2a93bd?{'count':_0x1ccf9d,'rows':_0x2a93bd}:null;}})[_0x04b2('0x28')](respondWithResult(_0x457147,null))[_0x04b2('0x4a')](handleError(_0x457147,null));};exports[_0x04b2('0x64')]=function(_0x3dd526,_0x1cbb05,_0x3493ce){var _0xb41aca=_0x3dd526[_0x04b2('0x57')][_0x04b2('0x65')];return db['Team'][_0x04b2('0x48')]({'where':{'id':_0xb41aca},'attributes':['id'],'include':[{'model':db[_0x04b2('0x66')],'as':_0x04b2('0x67'),'attributes':['id',_0x04b2('0x2f'),_0x04b2('0x68'),'voicePause',_0x04b2('0x69')],'raw':!![]}]})['then'](function(_0x3945d8){if(_0x3945d8){var _0x3251dd=_[_0x04b2('0x6a')](_0x3945d8,function(_0x3c6085){var _0x3f208a=_0x3c6085[_0x04b2('0x50')]({'plain':!![]});return _0x3f208a[_0x04b2('0x67')];});return db['SmsQueue']['find']({'where':{'id':_0x3dd526[_0x04b2('0x4c')]['id']}})[_0x04b2('0x28')](function(_0x23c0fb){return db[_0x04b2('0x6b')][_0x04b2('0x6c')](function(_0x2de0cc){return _0x23c0fb[_0x04b2('0x64')](_0xb41aca,{'transaction':_0x2de0cc})[_0x04b2('0x28')](function(){return BPromise[_0x04b2('0x6d')](_0x3251dd,function(_0xe553d1){return db[_0x04b2('0x5a')][_0x04b2('0x6e')]({'where':{'UserId':_0xe553d1['id'],'SmsQueueId':_0x3dd526['params']['id']},'transaction':_0x2de0cc});});})[_0x04b2('0x28')](function(){_0x3251dd[_0x04b2('0x6f')](function(_0x4b3089){socket[_0x04b2('0x70')](_0x04b2('0x71'),{'UserId':_0x4b3089['id'],'SmsQueueId':_0x23c0fb['id']});});});});});}})[_0x04b2('0x28')](respondWithStatusCode(_0x1cbb05,null))[_0x04b2('0x4a')](handleError(_0x1cbb05,null));};exports['removeTeams']=function(_0x31c83c,_0x194915,_0x598387){return db[_0x04b2('0x63')]['findAll']({'where':{'id':_0x31c83c[_0x04b2('0x36')][_0x04b2('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x04b2('0x67'),'attributes':['id'],'raw':!![]}]})[_0x04b2('0x28')](handleEntityNotFound(_0x194915,null))['then'](function(_0xd73eb5){var _0x37843e=_[_0x04b2('0x43')](_0xd73eb5,'id');var _0x26c98d=[];var _0x2bda4a=[];var _0x322bd0=squel[_0x04b2('0x72')]();_0x322bd0['field'](_0x04b2('0x73'))['from']('team_has_sms_queues','tq')[_0x04b2('0x74')]('user_has_teams','ut',_0x04b2('0x75'))[_0x04b2('0x3f')](_0x04b2('0x76'),_0x31c83c[_0x04b2('0x4c')]['id']);for(var _0x10ff21=0x0;_0x10ff21<_0xd73eb5[_0x04b2('0x5b')];_0x10ff21+=0x1){let _0x7ad315=_0xd73eb5[_0x10ff21];for(var _0x35a6e5=0x0;_0x35a6e5<_0x7ad315[_0x04b2('0x67')][_0x04b2('0x5b')];_0x35a6e5+=0x1){let _0x10adbc=_0x7ad315[_0x04b2('0x67')][_0x35a6e5];var _0x17056c=_0x322bd0[_0x04b2('0x77')]();_0x17056c[_0x04b2('0x3f')]('ut.UserId\x20=\x20?',_0x10adbc['id']);_0x2bda4a[_0x04b2('0x78')](db[_0x04b2('0x6b')][_0x04b2('0x36')](_0x17056c[_0x04b2('0x79')](),{'type':db['sequelize'][_0x04b2('0x7a')][_0x04b2('0x7b')]})[_0x04b2('0x28')](function(_0x450b8f){if(_0x450b8f[_0x04b2('0x5b')]===0x1){return _0x10adbc['id'];}else{var _0x12b41a=_['every'](_[_0x04b2('0x43')](_0x450b8f,'TeamId'),function(_0x1bf4f4){return _[_0x04b2('0x7c')](_0x37843e,_0x1bf4f4);});if(_0x12b41a){return _0x10adbc['id'];}}}));}}return BPromise[_0x04b2('0x7d')](_0x2bda4a)[_0x04b2('0x28')](function(_0x5d6353){_0x26c98d=_(_0x26c98d)[_0x04b2('0x7e')](_0x5d6353)['compact']()['value']();return db[_0x04b2('0x47')][_0x04b2('0x4f')]({'where':{'id':_0x31c83c['params']['id']}})[_0x04b2('0x28')](function(_0x23559f){return db[_0x04b2('0x6b')][_0x04b2('0x6c')](function(_0x4207c2){return _0x23559f[_0x04b2('0x7f')](_0x31c83c[_0x04b2('0x36')][_0x04b2('0x65')],{'transaction':_0x4207c2})[_0x04b2('0x28')](function(){if(!_[_0x04b2('0x80')](_0x26c98d)){return _0x23559f['removeAgents'](_0x26c98d,{'transaction':_0x4207c2});}})[_0x04b2('0x28')](function(){_0x26c98d[_0x04b2('0x6f')](function(_0x462b63){socket['emit'](_0x04b2('0x81'),{'UserId':_0x462b63,'SmsQueueId':_0x23559f['id']});});});});});});})[_0x04b2('0x28')](respondWithStatusCode(_0x194915,null))[_0x04b2('0x4a')](handleError(_0x194915,null));};exports[_0x04b2('0x82')]=function(_0x832bd0,_0xf7c2d0,_0x297ba0){return db[_0x04b2('0x47')][_0x04b2('0x4f')]({'where':{'id':_0x832bd0['params']['id']}})[_0x04b2('0x28')](handleEntityNotFound(_0xf7c2d0,null))[_0x04b2('0x28')](function(_0x3a68be){if(_0x3a68be){return _0x3a68be[_0x04b2('0x82')](_0x832bd0['body']['ids'],_[_0x04b2('0x83')](_0x832bd0[_0x04b2('0x57')],[_0x04b2('0x65'),'id'])||{})['spread'](function(_0x53d564){for(var _0x212c0b=0x0;_0x212c0b<_0x832bd0[_0x04b2('0x57')][_0x04b2('0x65')][_0x04b2('0x5b')];_0x212c0b+=0x1){socket[_0x04b2('0x70')](_0x04b2('0x71'),{'UserId':Number(_0x832bd0[_0x04b2('0x57')]['ids'][_0x212c0b]),'SmsQueueId':Number(_0x832bd0[_0x04b2('0x4c')]['id'])});}return _0x53d564;});}})[_0x04b2('0x28')](respondWithResult(_0xf7c2d0,null))[_0x04b2('0x4a')](handleError(_0xf7c2d0,null));};exports['removeAgents']=function(_0x254aa,_0x221050,_0x5ad32f){return db[_0x04b2('0x47')][_0x04b2('0x4f')]({'where':{'id':_0x254aa[_0x04b2('0x4c')]['id']}})[_0x04b2('0x28')](handleEntityNotFound(_0x221050,null))[_0x04b2('0x28')](function(_0x3da0c3){if(_0x3da0c3){return _0x3da0c3['removeAgents'](_0x254aa[_0x04b2('0x36')][_0x04b2('0x65')])[_0x04b2('0x28')](function(){if(_[_0x04b2('0x84')](_0x254aa[_0x04b2('0x36')][_0x04b2('0x65')])){for(var _0x326ab0=0x0;_0x326ab0<_0x254aa[_0x04b2('0x36')][_0x04b2('0x65')][_0x04b2('0x5b')];_0x326ab0+=0x1){socket[_0x04b2('0x70')](_0x04b2('0x81'),{'UserId':Number(_0x254aa['query']['ids'][_0x326ab0]),'SmsQueueId':Number(_0x254aa[_0x04b2('0x4c')]['id'])});}}else{socket[_0x04b2('0x70')](_0x04b2('0x81'),{'UserId':Number(_0x254aa[_0x04b2('0x36')]['ids']),'SmsQueueId':Number(_0x254aa[_0x04b2('0x4c')]['id'])});}});}})[_0x04b2('0x28')](respondWithStatusCode(_0x221050,null))['catch'](handleError(_0x221050,null));};exports[_0x04b2('0x85')]=function(_0xf05a10,_0x474e66,_0x323115){var _0x71ab6a={};var _0x990a09={};var _0x250aa6;var _0x1d08dc;return db[_0x04b2('0x47')]['findOne']({'where':{'id':_0xf05a10[_0x04b2('0x4c')]['id']}})[_0x04b2('0x28')](handleEntityNotFound(_0x474e66,null))[_0x04b2('0x28')](function(_0x194a5f){if(_0x194a5f){_0x250aa6=_0x194a5f;_0x990a09[_0x04b2('0x35')]=_[_0x04b2('0x4d')](db['User']['rawAttributes']);_0x990a09[_0x04b2('0x36')]=_[_0x04b2('0x4d')](_0xf05a10[_0x04b2('0x36')]);_0x990a09[_0x04b2('0x37')]=_[_0x04b2('0x38')](_0x990a09['model'],_0x990a09[_0x04b2('0x36')]);_0x71ab6a[_0x04b2('0x3a')]=_['intersection'](_0x990a09[_0x04b2('0x35')],qs[_0x04b2('0x39')](_0xf05a10[_0x04b2('0x36')][_0x04b2('0x39')]));_0x71ab6a['attributes']=_0x71ab6a['attributes'][_0x04b2('0x5b')]?_0x71ab6a[_0x04b2('0x3a')]:_0x990a09[_0x04b2('0x35')];_0x71ab6a[_0x04b2('0x3d')]=qs[_0x04b2('0x3e')](_0xf05a10[_0x04b2('0x36')][_0x04b2('0x3e')]);_0x71ab6a['where']=qs[_0x04b2('0x37')](_[_0x04b2('0x40')](_0xf05a10['query'],_0x990a09[_0x04b2('0x37')]));if(_0xf05a10[_0x04b2('0x36')][_0x04b2('0x41')]){_0x71ab6a[_0x04b2('0x3f')]=_[_0x04b2('0x42')](_0x71ab6a[_0x04b2('0x3f')],{'$or':_[_0x04b2('0x43')](_0x71ab6a[_0x04b2('0x3a')],function(_0x6e19a9){var _0x167b94={};_0x167b94[_0x6e19a9]={'$like':'%'+_0xf05a10['query'][_0x04b2('0x41')]+'%'};return _0x167b94;})});}_0x71ab6a=_[_0x04b2('0x42')]({},_0x71ab6a,_0xf05a10[_0x04b2('0x45')]);return _0x250aa6[_0x04b2('0x85')](_0x71ab6a);}})['then'](function(_0x384cfc){if(_0x384cfc){_0x1d08dc=_0x384cfc[_0x04b2('0x5b')];if(!_0xf05a10[_0x04b2('0x36')]['hasOwnProperty'](_0x04b2('0x3c'))){_0x71ab6a[_0x04b2('0x22')]=qs[_0x04b2('0x22')](_0xf05a10[_0x04b2('0x36')][_0x04b2('0x22')]);_0x71ab6a[_0x04b2('0x20')]=qs[_0x04b2('0x20')](_0xf05a10[_0x04b2('0x36')][_0x04b2('0x20')]);}return _0x250aa6[_0x04b2('0x85')](_0x71ab6a);}})[_0x04b2('0x28')](function(_0x36ffb6){if(_0x36ffb6){return _0x36ffb6?{'count':_0x1d08dc,'rows':_0x36ffb6}:null;}})[_0x04b2('0x28')](respondWithResult(_0x474e66,null))[_0x04b2('0x4a')](handleError(_0x474e66,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 33ed8cc..b77e05e 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 _0xad87=['SmsQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xad87,0x8e));var _0x7ad8=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xad87[_0x21aec3];return _0x288bbc;};'use strict';var EventEmitter=require(_0x7ad8('0x0'));var SmsQueue=require(_0x7ad8('0x1'))['db'][_0x7ad8('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x7ad8('0x3')](0x0);var events={'afterCreate':_0x7ad8('0x4'),'afterUpdate':_0x7ad8('0x5'),'afterDestroy':_0x7ad8('0x6')};function emitEvent(_0x47714a){return function(_0x33afae,_0x162351,_0x5608ec){SmsQueueEvents['emit'](_0x47714a+':'+_0x33afae['id'],_0x33afae);SmsQueueEvents['emit'](_0x47714a,_0x33afae);_0x5608ec(null);};}for(var e in events){if(events[_0x7ad8('0x7')](e)){var event=events[e];SmsQueue[_0x7ad8('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x7ca1=['SmsQueue','update','emit','hook','exports','events'];(function(_0x4828f3,_0x5774b6){var _0x8a2a6=function(_0x5d82dd){while(--_0x5d82dd){_0x4828f3['push'](_0x4828f3['shift']());}};_0x8a2a6(++_0x5774b6);}(_0x7ca1,0x179));var _0x17ca=function(_0x3ce37a,_0x24a365){_0x3ce37a=_0x3ce37a-0x0;var _0x52b35b=_0x7ca1[_0x3ce37a];return _0x52b35b;};'use strict';var EventEmitter=require(_0x17ca('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x17ca('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x17ca('0x2'),'afterDestroy':'remove'};function emitEvent(_0x56ae6f){return function(_0xd4f8fc,_0x40d2c7,_0x571d96){SmsQueueEvents[_0x17ca('0x3')](_0x56ae6f+':'+_0xd4f8fc['id'],_0xd4f8fc);SmsQueueEvents[_0x17ca('0x3')](_0x56ae6f,_0xd4f8fc);_0x571d96(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x17ca('0x4')](e,emitEvent(event));}}module[_0x17ca('0x5')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index b125e6d..94ce3db 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 _0xc680=['request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','sms_queues','lodash','../../config/logger','moment','bluebird'];(function(_0x429780,_0x15c4e5){var _0x4d19fb=function(_0x2a89d3){while(--_0x2a89d3){_0x429780['push'](_0x429780['shift']());}};_0x4d19fb(++_0x15c4e5);}(_0xc680,0xcd));var _0x0c68=function(_0xa2b9c9,_0xdc01bc){_0xa2b9c9=_0xa2b9c9-0x0;var _0x37a90d=_0xc680[_0xa2b9c9];return _0x37a90d;};'use strict';var _=require(_0x0c68('0x0'));var util=require('util');var logger=require(_0x0c68('0x1'))('api');var moment=require(_0x0c68('0x2'));var BPromise=require(_0x0c68('0x3'));var rp=require(_0x0c68('0x4'));var fs=require('fs');var path=require(_0x0c68('0x5'));var rimraf=require(_0x0c68('0x6'));var config=require(_0x0c68('0x7'));var attributes=require(_0x0c68('0x8'));module['exports']=function(_0x42dfc0,_0x19830e){return _0x42dfc0[_0x0c68('0x9')]('SmsQueue',attributes,{'tableName':_0x0c68('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd44b=['../../config/logger','api','moment','bluebird','path','../../config/environment','./smsQueue.attributes','exports','define','lodash'];(function(_0x426688,_0x237f6c){var _0x2a7e4f=function(_0x1786ba){while(--_0x1786ba){_0x426688['push'](_0x426688['shift']());}};_0x2a7e4f(++_0x237f6c);}(_0xd44b,0x1a3));var _0xbd44=function(_0x2045c9,_0x3b5b40){_0x2045c9=_0x2045c9-0x0;var _0x8839e9=_0xd44b[_0x2045c9];return _0x8839e9;};'use strict';var _=require(_0xbd44('0x0'));var util=require('util');var logger=require(_0xbd44('0x1'))(_0xbd44('0x2'));var moment=require(_0xbd44('0x3'));var BPromise=require(_0xbd44('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd44('0x5'));var rimraf=require('rimraf');var config=require(_0xbd44('0x6'));var attributes=require(_0xbd44('0x7'));module[_0xbd44('0x8')]=function(_0x325c59,_0x174b5a){return _0x325c59[_0xbd44('0x9')]('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 13bd918..7abebfa 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 _0x3c05=['redis','defaults','localhost','socket.io-emitter','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','findAll','options','raw','limit','include','map','model','attributes','info','GetSmsQueue','ShowSmsQueue','SmsQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http'];(function(_0x3e13a4,_0x40fe56){var _0x19b58b=function(_0x51c647){while(--_0x51c647){_0x3e13a4['push'](_0x3e13a4['shift']());}};_0x19b58b(++_0x40fe56);}(_0x3c05,0xe6));var _0x53c0=function(_0x2cb77a,_0x4b07e0){_0x2cb77a=_0x2cb77a-0x0;var _0x3c10a3=_0x3c05[_0x2cb77a];return _0x3c10a3;};'use strict';var _=require(_0x53c0('0x0'));var util=require(_0x53c0('0x1'));var moment=require(_0x53c0('0x2'));var BPromise=require(_0x53c0('0x3'));var rs=require(_0x53c0('0x4'));var fs=require('fs');var Redis=require(_0x53c0('0x5'));var db=require(_0x53c0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x53c0('0x7'))(_0x53c0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x53c0('0x9')]({'port':0x232a});config[_0x53c0('0xa')]=_[_0x53c0('0xb')](config[_0x53c0('0xa')],{'host':_0x53c0('0xc'),'port':0x18eb});var socket=require(_0x53c0('0xd'))(new Redis(config[_0x53c0('0xa')]));require('./smsQueue.socket')[_0x53c0('0xe')](socket);function respondWithRpcPromise(_0x2dd1b7,_0x298df1,_0x58794d){return new BPromise(function(_0xb711bc,_0x5ca819){return client[_0x53c0('0xf')](_0x2dd1b7,_0x58794d)[_0x53c0('0x10')](function(_0x118c9d){logger['info'](_0x53c0('0x11'),_0x298df1,_0x53c0('0x12'));logger[_0x53c0('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x298df1,'request\x20sent',JSON[_0x53c0('0x14')](_0x118c9d));if(_0x118c9d['error']){if(_0x118c9d['error'][_0x53c0('0x15')]===0x1f4){logger[_0x53c0('0x16')](_0x53c0('0x11'),_0x298df1,_0x118c9d[_0x53c0('0x16')]['message']);return _0x5ca819(_0x118c9d[_0x53c0('0x16')][_0x53c0('0x17')]);}logger[_0x53c0('0x16')](_0x53c0('0x11'),_0x298df1,_0x118c9d['error'][_0x53c0('0x17')]);return _0xb711bc(_0x118c9d[_0x53c0('0x16')][_0x53c0('0x17')]);}else{logger['info'](_0x53c0('0x11'),_0x298df1,'request\x20sent');_0xb711bc(_0x118c9d[_0x53c0('0x18')]['message']);}})[_0x53c0('0x19')](function(_0x127b7b){logger[_0x53c0('0x16')](_0x53c0('0x11'),_0x298df1,_0x127b7b);_0x5ca819(_0x127b7b);});});}exports['GetSmsQueue']=function(_0x2d93d8){var _0x4c7e97=this;return new Promise(function(_0x5d5a40,_0xfc6490){return db['SmsQueue'][_0x53c0('0x1a')]({'raw':_0x2d93d8[_0x53c0('0x1b')]?_0x2d93d8[_0x53c0('0x1b')][_0x53c0('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d93d8['options']?_0x2d93d8['options']['where']||null:null,'attributes':_0x2d93d8[_0x53c0('0x1b')]?_0x2d93d8[_0x53c0('0x1b')]['attributes']||null:null,'limit':_0x2d93d8[_0x53c0('0x1b')]?_0x2d93d8['options'][_0x53c0('0x1d')]||null:null,'include':_0x2d93d8[_0x53c0('0x1b')]?_0x2d93d8[_0x53c0('0x1b')][_0x53c0('0x1e')]?_[_0x53c0('0x1f')](_0x2d93d8['options'][_0x53c0('0x1e')],function(_0x58961c){return{'model':db[_0x58961c[_0x53c0('0x20')]],'as':_0x58961c['as'],'attributes':_0x58961c['attributes'],'include':_0x58961c['include']?_[_0x53c0('0x1f')](_0x58961c['include'],function(_0x3f8a01){return{'model':db[_0x3f8a01[_0x53c0('0x20')]],'as':_0x3f8a01['as'],'attributes':_0x3f8a01['attributes'],'include':_0x3f8a01[_0x53c0('0x1e')]?_['map'](_0x3f8a01[_0x53c0('0x1e')],function(_0x558c23){return{'model':db[_0x558c23['model']],'as':_0x558c23['as'],'attributes':_0x558c23[_0x53c0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x53c0('0x10')](function(_0x58fc54){logger[_0x53c0('0x22')](_0x53c0('0x23'),_0x2d93d8);logger[_0x53c0('0x13')]('GetSmsQueue',_0x2d93d8,JSON['stringify'](_0x58fc54));_0x5d5a40(_0x58fc54);})['catch'](function(_0x4cf215){logger['error'](_0x53c0('0x23'),_0x4cf215[_0x53c0('0x17')],_0x2d93d8);_0xfc6490(_0x4c7e97['error'](0x1f4,_0x4cf215['message']));});});};exports[_0x53c0('0x24')]=function(_0x4b8eda){var _0x266e42=this;return new Promise(function(_0x5c40ff,_0x22a906){return db[_0x53c0('0x25')][_0x53c0('0x26')]({'raw':_0x4b8eda[_0x53c0('0x1b')]?_0x4b8eda[_0x53c0('0x1b')][_0x53c0('0x1c')]===undefined?!![]:![]:!![],'where':_0x4b8eda[_0x53c0('0x1b')]?_0x4b8eda[_0x53c0('0x1b')][_0x53c0('0x27')]||null:null,'attributes':_0x4b8eda[_0x53c0('0x1b')]?_0x4b8eda['options']['attributes']||null:null,'include':_0x4b8eda[_0x53c0('0x1b')]?_0x4b8eda[_0x53c0('0x1b')][_0x53c0('0x1e')]?_[_0x53c0('0x1f')](_0x4b8eda[_0x53c0('0x1b')][_0x53c0('0x1e')],function(_0x97d5e6){return{'model':db[_0x97d5e6['model']],'as':_0x97d5e6['as'],'attributes':_0x97d5e6[_0x53c0('0x21')],'include':_0x97d5e6['include']?_['map'](_0x97d5e6['include'],function(_0x586f9e){return{'model':db[_0x586f9e[_0x53c0('0x20')]],'as':_0x586f9e['as'],'attributes':_0x586f9e['attributes'],'include':_0x586f9e[_0x53c0('0x1e')]?_[_0x53c0('0x1f')](_0x586f9e[_0x53c0('0x1e')],function(_0xdd4dc9){return{'model':db[_0xdd4dc9[_0x53c0('0x20')]],'as':_0xdd4dc9['as'],'attributes':_0xdd4dc9[_0x53c0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x53c0('0x10')](function(_0x3c9cc8){logger[_0x53c0('0x22')](_0x53c0('0x24'),_0x4b8eda);logger[_0x53c0('0x13')](_0x53c0('0x24'),_0x4b8eda,JSON[_0x53c0('0x14')](_0x3c9cc8));_0x5c40ff(_0x3c9cc8);})['catch'](function(_0x13d2f8){logger[_0x53c0('0x16')]('ShowSmsQueue',_0x13d2f8['message'],_0x4b8eda);_0x22a906(_0x266e42['error'](0x1f4,_0x13d2f8[_0x53c0('0x17')]));});});}; \ No newline at end of file +var _0x8539=['include','map','model','GetSmsQueue','ShowSmsQueue','SmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','message','SmsQueue,\x20%s,\x20%s','catch','options','raw','where','attributes','limit'];(function(_0x495883,_0x37be77){var _0xd5067f=function(_0x489248){while(--_0x489248){_0x495883['push'](_0x495883['shift']());}};_0xd5067f(++_0x37be77);}(_0x8539,0x1a1));var _0x9853=function(_0xb1fa2c,_0x3479af){_0xb1fa2c=_0xb1fa2c-0x0;var _0x3a9890=_0x8539[_0xb1fa2c];return _0x3a9890;};'use strict';var _=require(_0x9853('0x0'));var util=require(_0x9853('0x1'));var moment=require(_0x9853('0x2'));var BPromise=require(_0x9853('0x3'));var rs=require(_0x9853('0x4'));var fs=require('fs');var Redis=require(_0x9853('0x5'));var db=require(_0x9853('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9853('0x7'));var config=require(_0x9853('0x8'));var jayson=require(_0x9853('0x9'));var client=jayson[_0x9853('0xa')][_0x9853('0xb')]({'port':0x232a});config[_0x9853('0xc')]=_[_0x9853('0xd')](config[_0x9853('0xc')],{'host':_0x9853('0xe'),'port':0x18eb});var socket=require(_0x9853('0xf'))(new Redis(config[_0x9853('0xc')]));require(_0x9853('0x10'))[_0x9853('0x11')](socket);function respondWithRpcPromise(_0x250cf6,_0x326291,_0x2a88bb){return new BPromise(function(_0x286af3,_0x4522aa){return client[_0x9853('0x12')](_0x250cf6,_0x2a88bb)[_0x9853('0x13')](function(_0x54659c){logger[_0x9853('0x14')]('SmsQueue,\x20%s,\x20%s',_0x326291,_0x9853('0x15'));logger[_0x9853('0x16')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x326291,_0x9853('0x15'),JSON[_0x9853('0x17')](_0x54659c));if(_0x54659c[_0x9853('0x18')]){if(_0x54659c[_0x9853('0x18')][_0x9853('0x19')]===0x1f4){logger[_0x9853('0x18')]('SmsQueue,\x20%s,\x20%s',_0x326291,_0x54659c['error'][_0x9853('0x1a')]);return _0x4522aa(_0x54659c['error'][_0x9853('0x1a')]);}logger[_0x9853('0x18')](_0x9853('0x1b'),_0x326291,_0x54659c[_0x9853('0x18')][_0x9853('0x1a')]);return _0x286af3(_0x54659c[_0x9853('0x18')][_0x9853('0x1a')]);}else{logger[_0x9853('0x14')]('SmsQueue,\x20%s,\x20%s',_0x326291,_0x9853('0x15'));_0x286af3(_0x54659c['result'][_0x9853('0x1a')]);}})[_0x9853('0x1c')](function(_0x4e735c){logger['error'](_0x9853('0x1b'),_0x326291,_0x4e735c);_0x4522aa(_0x4e735c);});});}exports['GetSmsQueue']=function(_0x54fc91){var _0x1ddbd4=this;return new Promise(function(_0x256fe2,_0x490de5){return db['SmsQueue']['findAll']({'raw':_0x54fc91[_0x9853('0x1d')]?_0x54fc91[_0x9853('0x1d')][_0x9853('0x1e')]===undefined?!![]:![]:!![],'where':_0x54fc91[_0x9853('0x1d')]?_0x54fc91[_0x9853('0x1d')][_0x9853('0x1f')]||null:null,'attributes':_0x54fc91[_0x9853('0x1d')]?_0x54fc91[_0x9853('0x1d')][_0x9853('0x20')]||null:null,'limit':_0x54fc91[_0x9853('0x1d')]?_0x54fc91['options'][_0x9853('0x21')]||null:null,'include':_0x54fc91[_0x9853('0x1d')]?_0x54fc91[_0x9853('0x1d')][_0x9853('0x22')]?_[_0x9853('0x23')](_0x54fc91['options'][_0x9853('0x22')],function(_0x5bc738){return{'model':db[_0x5bc738['model']],'as':_0x5bc738['as'],'attributes':_0x5bc738['attributes'],'include':_0x5bc738[_0x9853('0x22')]?_['map'](_0x5bc738[_0x9853('0x22')],function(_0x3683a7){return{'model':db[_0x3683a7[_0x9853('0x24')]],'as':_0x3683a7['as'],'attributes':_0x3683a7[_0x9853('0x20')],'include':_0x3683a7['include']?_['map'](_0x3683a7[_0x9853('0x22')],function(_0xed0b7d){return{'model':db[_0xed0b7d[_0x9853('0x24')]],'as':_0xed0b7d['as'],'attributes':_0xed0b7d[_0x9853('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9853('0x13')](function(_0xfc9d28){logger[_0x9853('0x14')](_0x9853('0x25'),_0x54fc91);logger[_0x9853('0x16')](_0x9853('0x25'),_0x54fc91,JSON['stringify'](_0xfc9d28));_0x256fe2(_0xfc9d28);})[_0x9853('0x1c')](function(_0x275472){logger[_0x9853('0x18')](_0x9853('0x25'),_0x275472[_0x9853('0x1a')],_0x54fc91);_0x490de5(_0x1ddbd4[_0x9853('0x18')](0x1f4,_0x275472[_0x9853('0x1a')]));});});};exports[_0x9853('0x26')]=function(_0x1d85aa){var _0x30d4c5=this;return new Promise(function(_0x572808,_0x104dfb){return db[_0x9853('0x27')][_0x9853('0x28')]({'raw':_0x1d85aa['options']?_0x1d85aa[_0x9853('0x1d')][_0x9853('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d85aa[_0x9853('0x1d')]?_0x1d85aa[_0x9853('0x1d')]['where']||null:null,'attributes':_0x1d85aa[_0x9853('0x1d')]?_0x1d85aa[_0x9853('0x1d')][_0x9853('0x20')]||null:null,'include':_0x1d85aa[_0x9853('0x1d')]?_0x1d85aa[_0x9853('0x1d')][_0x9853('0x22')]?_[_0x9853('0x23')](_0x1d85aa[_0x9853('0x1d')]['include'],function(_0x28422e){return{'model':db[_0x28422e[_0x9853('0x24')]],'as':_0x28422e['as'],'attributes':_0x28422e[_0x9853('0x20')],'include':_0x28422e[_0x9853('0x22')]?_[_0x9853('0x23')](_0x28422e['include'],function(_0x452c88){return{'model':db[_0x452c88[_0x9853('0x24')]],'as':_0x452c88['as'],'attributes':_0x452c88['attributes'],'include':_0x452c88[_0x9853('0x22')]?_[_0x9853('0x23')](_0x452c88[_0x9853('0x22')],function(_0x45a81e){return{'model':db[_0x45a81e[_0x9853('0x24')]],'as':_0x45a81e['as'],'attributes':_0x45a81e[_0x9853('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e7624){logger['info'](_0x9853('0x26'),_0x1d85aa);logger['debug']('ShowSmsQueue',_0x1d85aa,JSON['stringify'](_0x3e7624));_0x572808(_0x3e7624);})[_0x9853('0x1c')](function(_0x38b342){logger[_0x9853('0x18')]('ShowSmsQueue',_0x38b342[_0x9853('0x1a')],_0x1d85aa);_0x104dfb(_0x30d4c5[_0x9853('0x18')](0x1f4,_0x38b342[_0x9853('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 85ee864..51ebd75 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 _0x3e4c=['length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x3e4c,0x183));var _0xc3e4=function(_0x11659b,_0x245a58){_0x11659b=_0x11659b-0x0;var _0xbbb3f1=_0x3e4c[_0x11659b];return _0xbbb3f1;};'use strict';var SmsQueueEvents=require(_0xc3e4('0x0'));var events=[_0xc3e4('0x1'),_0xc3e4('0x2'),_0xc3e4('0x3')];function createListener(_0x466593,_0x4194f6){return function(_0xbec90){_0x4194f6[_0xc3e4('0x4')](_0x466593,_0xbec90);};}function removeListener(_0x36c862,_0x50250c){return function(){SmsQueueEvents['removeListener'](_0x36c862,_0x50250c);};}exports['register']=function(_0x19f25c){for(var _0x391f08=0x0,_0x2cf607=events[_0xc3e4('0x5')];_0x391f08<_0x2cf607;_0x391f08++){var _0x195a89=events[_0x391f08];var _0x8e95e6=createListener(_0xc3e4('0x6')+_0x195a89,_0x19f25c);SmsQueueEvents['on'](_0x195a89,_0x8e95e6);}}; \ No newline at end of file +var _0xb582=['save','remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xb582,0xbc));var _0x2b58=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb582[_0x397e5f];return _0x5302b8;};'use strict';var SmsQueueEvents=require(_0x2b58('0x0'));var events=[_0x2b58('0x1'),_0x2b58('0x2'),_0x2b58('0x3')];function createListener(_0x201533,_0x35216f){return function(_0x3a83ae){_0x35216f[_0x2b58('0x4')](_0x201533,_0x3a83ae);};}function removeListener(_0x3e8f9c,_0xb070d6){return function(){SmsQueueEvents[_0x2b58('0x5')](_0x3e8f9c,_0xb070d6);};}exports[_0x2b58('0x6')]=function(_0x474bda){for(var _0x36c161=0x0,_0x3aa119=events[_0x2b58('0x7')];_0x36c161<_0x3aa119;_0x36c161++){var _0x196bd9=events[_0x36c161];var _0x41313c=createListener(_0x2b58('0x8')+_0x196bd9,_0x474bda);SmsQueueEvents['on'](_0x196bd9,_0x41313c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index aaf5225..323ac7b 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 _0x527b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','isAuthenticated','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x23f9b2,_0x5d461e){var _0x32c31c=function(_0x57f649){while(--_0x57f649){_0x23f9b2['push'](_0x23f9b2['shift']());}};_0x32c31c(++_0x5d461e);}(_0x527b,0xb7));var _0xb527=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0x527b[_0x21de89];return _0x290b7e;};'use strict';var multer=require(_0xb527('0x0'));var util=require(_0xb527('0x1'));var path=require(_0xb527('0x2'));var timeout=require(_0xb527('0x3'));var express=require(_0xb527('0x4'));var router=express[_0xb527('0x5')]();var fs_extra=require(_0xb527('0x6'));var auth=require(_0xb527('0x7'));var interaction=require(_0xb527('0x8'));var config=require(_0xb527('0x9'));var controller=require('./smsQueueReport.controller');router[_0xb527('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb527('0xa')](_0xb527('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xb527('0xa')](_0xb527('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb527('0xd')](),controller[_0xb527('0xe')]);router['put']('/:id',auth[_0xb527('0xd')](),controller[_0xb527('0xf')]);router[_0xb527('0x10')]('/:id',auth[_0xb527('0xd')](),controller[_0xb527('0x11')]);module[_0xb527('0x12')]=router; \ No newline at end of file +var _0x1b63=['describe','post','isAuthenticated','create','update','delete','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x173158,_0x1609cf){var _0x4ad038=function(_0x2922d7){while(--_0x2922d7){_0x173158['push'](_0x173158['shift']());}};_0x4ad038(++_0x1609cf);}(_0x1b63,0x90));var _0x31b6=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x1b63[_0x323d87];return _0x5e8f74;};'use strict';var multer=require('multer');var util=require(_0x31b6('0x0'));var path=require(_0x31b6('0x1'));var timeout=require(_0x31b6('0x2'));var express=require(_0x31b6('0x3'));var router=express[_0x31b6('0x4')]();var fs_extra=require(_0x31b6('0x5'));var auth=require(_0x31b6('0x6'));var interaction=require(_0x31b6('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x31b6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x31b6('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x31b6('0x9')]);router[_0x31b6('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x31b6('0xa')]('/',auth[_0x31b6('0xb')](),controller[_0x31b6('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x31b6('0xd')]);router[_0x31b6('0xe')](_0x31b6('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x31b6('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 359f3f8..ad5e65e 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 _0x16e6=['DATE','exports','STRING'];(function(_0x25cd81,_0x3e1bd7){var _0x473f5a=function(_0x2d633a){while(--_0x2d633a){_0x25cd81['push'](_0x25cd81['shift']());}};_0x473f5a(++_0x3e1bd7);}(_0x16e6,0xe8));var _0x616e=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x16e6[_0x12b8ec];return _0x21af77;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x616e('0x0')]={'uniqueid':{'type':Sequelize[_0x616e('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x616e('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x616e('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x616e('0x2')]},'reason':{'type':Sequelize[_0x616e('0x1')]}}; \ No newline at end of file +var _0x2e02=['moment','sequelize','exports','STRING','DATE'];(function(_0x95be31,_0x410d41){var _0x73f344=function(_0x1130e6){while(--_0x1130e6){_0x95be31['push'](_0x95be31['shift']());}};_0x73f344(++_0x410d41);}(_0x2e02,0x1e0));var _0x22e0=function(_0x205e5b,_0x3d9293){_0x205e5b=_0x205e5b-0x0;var _0x2e60db=_0x2e02[_0x205e5b];return _0x2e60db;};'use strict';var moment=require(_0x22e0('0x0'));var Sequelize=require(_0x22e0('0x1'));module[_0x22e0('0x2')]={'uniqueid':{'type':Sequelize[_0x22e0('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x22e0('0x3')]},'joinAt':{'type':Sequelize[_0x22e0('0x4')]},'leaveAt':{'type':Sequelize[_0x22e0('0x4')]},'acceptAt':{'type':Sequelize[_0x22e0('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x22e0('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 6f7fc04..fb26ec2 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 _0x7bb2=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','catch','params','keys','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length'];(function(_0x4c92c8,_0x3fc3f9){var _0x411ae0=function(_0x4ad9e7){while(--_0x4ad9e7){_0x4c92c8['push'](_0x4c92c8['shift']());}};_0x411ae0(++_0x3fc3f9);}(_0x7bb2,0x148));var _0x27bb=function(_0x554139,_0x35e8d4){_0x554139=_0x554139-0x0;var _0x492b80=_0x7bb2[_0x554139];return _0x492b80;};'use strict';var emlformat=require(_0x27bb('0x0'));var rimraf=require(_0x27bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27bb('0x2'));var rp=require(_0x27bb('0x3'));var moment=require(_0x27bb('0x4'));var BPromise=require(_0x27bb('0x5'));var Mustache=require(_0x27bb('0x6'));var util=require(_0x27bb('0x7'));var path=require('path');var sox=require(_0x27bb('0x8'));var csv=require('to-csv');var ejs=require(_0x27bb('0x9'));var fs=require('fs');var fs_extra=require(_0x27bb('0xa'));var _=require(_0x27bb('0xb'));var squel=require(_0x27bb('0xc'));var crypto=require(_0x27bb('0xd'));var jsforce=require(_0x27bb('0xe'));var deskjs=require(_0x27bb('0xf'));var toCsv=require(_0x27bb('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x27bb('0x11'));var authService=require(_0x27bb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x27bb('0x13'));var hardwareService=require(_0x27bb('0x14'));var logger=require(_0x27bb('0x15'))(_0x27bb('0x16'));var utils=require(_0x27bb('0x17'));var config=require(_0x27bb('0x18'));var licenseUtil=require(_0x27bb('0x19'));var db=require(_0x27bb('0x1a'))['db'];function respondWithStatusCode(_0x18df5a,_0x35f40b){_0x35f40b=_0x35f40b||0xcc;return function(_0x44ffd5){if(_0x44ffd5){return _0x18df5a['sendStatus'](_0x35f40b);}return _0x18df5a[_0x27bb('0x1b')](_0x35f40b)[_0x27bb('0x1c')]();};}function respondWithResult(_0x13104f,_0x12c206){_0x12c206=_0x12c206||0xc8;return function(_0x231df4){if(_0x231df4){return _0x13104f[_0x27bb('0x1b')](_0x12c206)[_0x27bb('0x1d')](_0x231df4);}};}function respondWithFilteredResult(_0x3cdcd9,_0x3dc44a){return function(_0x53ffa7){if(_0x53ffa7){var _0xb5a3ac=typeof _0x3dc44a[_0x27bb('0x1e')]===_0x27bb('0x1f')&&typeof _0x3dc44a[_0x27bb('0x20')]==='undefined';var _0x2a10f6=_0x53ffa7[_0x27bb('0x21')];var _0x428826=_0xb5a3ac?0x0:_0x3dc44a[_0x27bb('0x1e')];var _0xc80b5e=_0xb5a3ac?_0x53ffa7[_0x27bb('0x21')]:_0x3dc44a[_0x27bb('0x1e')]+_0x3dc44a[_0x27bb('0x20')];var _0x167424;if(_0xc80b5e>=_0x2a10f6){_0xc80b5e=_0x2a10f6;_0x167424=0xc8;}else{_0x167424=0xce;}_0x3cdcd9['status'](_0x167424);return _0x3cdcd9[_0x27bb('0x22')](_0x27bb('0x23'),_0x428826+'-'+_0xc80b5e+'/'+_0x2a10f6)[_0x27bb('0x1d')](_0x53ffa7);}return null;};}function patchUpdates(_0x1a8678){return function(_0x5800f2){try{jsonpatch[_0x27bb('0x24')](_0x5800f2,_0x1a8678,!![]);}catch(_0x296224){return BPromise[_0x27bb('0x25')](_0x296224);}return _0x5800f2['save']();};}function saveUpdates(_0x1c6cf9,_0x3f5f66){return function(_0x1172a4){if(_0x1172a4){return _0x1172a4['update'](_0x1c6cf9)[_0x27bb('0x26')](function(_0x1b4fbb){return _0x1b4fbb;});}return null;};}function removeEntity(_0x5e66c9,_0x33a8e7){return function(_0x51c0e2){if(_0x51c0e2){return _0x51c0e2[_0x27bb('0x27')]()['then'](function(){_0x5e66c9[_0x27bb('0x1b')](0xcc)[_0x27bb('0x1c')]();});}};}function handleEntityNotFound(_0x117882,_0x265cc3){return function(_0x9b965){if(!_0x9b965){_0x117882[_0x27bb('0x28')](0x194);}return _0x9b965;};}function handleError(_0x52eaa9,_0x1bb96f){_0x1bb96f=_0x1bb96f||0x1f4;return function(_0x7cf053){logger[_0x27bb('0x29')](_0x7cf053[_0x27bb('0x2a')]);if(_0x7cf053['name']){delete _0x7cf053[_0x27bb('0x2b')];}_0x52eaa9[_0x27bb('0x1b')](_0x1bb96f)[_0x27bb('0x2c')](_0x7cf053);};}exports['index']=function(_0x37cb2a,_0x5e7834){var _0x9ef8ef={},_0xf5341={},_0x5d352e={'count':0x0,'rows':[]};var _0x1989f4=_[_0x27bb('0x2d')](db[_0x27bb('0x2e')][_0x27bb('0x2f')],function(_0x216728){return{'name':_0x216728[_0x27bb('0x30')],'type':_0x216728[_0x27bb('0x31')][_0x27bb('0x32')]};});_0xf5341[_0x27bb('0x33')]=_[_0x27bb('0x2d')](_0x1989f4,'name');_0xf5341[_0x27bb('0x34')]=_['keys'](_0x37cb2a[_0x27bb('0x34')]);_0xf5341['filters']=_[_0x27bb('0x35')](_0xf5341[_0x27bb('0x33')],_0xf5341['query']);_0x9ef8ef['attributes']=_[_0x27bb('0x35')](_0xf5341['model'],qs[_0x27bb('0x36')](_0x37cb2a[_0x27bb('0x34')][_0x27bb('0x36')]));_0x9ef8ef[_0x27bb('0x37')]=_0x9ef8ef[_0x27bb('0x37')][_0x27bb('0x38')]?_0x9ef8ef[_0x27bb('0x37')]:_0xf5341[_0x27bb('0x33')];if(!_0x37cb2a['query'][_0x27bb('0x39')](_0x27bb('0x3a'))){_0x9ef8ef[_0x27bb('0x20')]=qs[_0x27bb('0x20')](_0x37cb2a[_0x27bb('0x34')][_0x27bb('0x20')]);_0x9ef8ef['offset']=qs[_0x27bb('0x1e')](_0x37cb2a['query']['offset']);}_0x9ef8ef[_0x27bb('0x3b')]=qs[_0x27bb('0x3c')](_0x37cb2a[_0x27bb('0x34')]['sort']);_0x9ef8ef[_0x27bb('0x3d')]=qs[_0x27bb('0x3e')](_[_0x27bb('0x3f')](_0x37cb2a[_0x27bb('0x34')],_0xf5341[_0x27bb('0x3e')]),_0x1989f4);if(_0x37cb2a[_0x27bb('0x34')][_0x27bb('0x40')]){_0x9ef8ef[_0x27bb('0x3d')]=_[_0x27bb('0x41')](_0x9ef8ef[_0x27bb('0x3d')],{'$or':_[_0x27bb('0x2d')](_0x1989f4,function(_0x2a9151){if(_0x2a9151[_0x27bb('0x31')]!==_0x27bb('0x42')){var _0x3992fb={};_0x3992fb[_0x2a9151[_0x27bb('0x2b')]]={'$like':'%'+_0x37cb2a[_0x27bb('0x34')][_0x27bb('0x40')]+'%'};return _0x3992fb;}})});}_0x9ef8ef=_[_0x27bb('0x41')]({},_0x9ef8ef,_0x37cb2a[_0x27bb('0x43')]);var _0x3acc15={'where':_0x9ef8ef['where']};return db[_0x27bb('0x2e')][_0x27bb('0x21')](_0x3acc15)[_0x27bb('0x26')](function(_0x128f96){_0x5d352e['count']=_0x128f96;if(_0x37cb2a[_0x27bb('0x34')]['includeAll']){_0x9ef8ef['include']=[{'all':!![]}];}return db[_0x27bb('0x2e')]['findAll'](_0x9ef8ef);})['then'](function(_0x57a29a){_0x5d352e[_0x27bb('0x44')]=_0x57a29a;return _0x5d352e;})[_0x27bb('0x26')](respondWithFilteredResult(_0x5e7834,_0x9ef8ef))[_0x27bb('0x45')](handleError(_0x5e7834,null));};exports['show']=function(_0x13c39f,_0x31ac60){var _0x343e3d={'raw':!![],'where':{'id':_0x13c39f[_0x27bb('0x46')]['id']}},_0x2348d2={};_0x2348d2[_0x27bb('0x33')]=_[_0x27bb('0x47')](db[_0x27bb('0x2e')][_0x27bb('0x2f')]);_0x2348d2[_0x27bb('0x34')]=_['keys'](_0x13c39f[_0x27bb('0x34')]);_0x2348d2['filters']=_[_0x27bb('0x35')](_0x2348d2[_0x27bb('0x33')],_0x2348d2[_0x27bb('0x34')]);_0x343e3d[_0x27bb('0x37')]=_['intersection'](_0x2348d2[_0x27bb('0x33')],qs[_0x27bb('0x36')](_0x13c39f[_0x27bb('0x34')][_0x27bb('0x36')]));_0x343e3d[_0x27bb('0x37')]=_0x343e3d[_0x27bb('0x37')][_0x27bb('0x38')]?_0x343e3d[_0x27bb('0x37')]:_0x2348d2[_0x27bb('0x33')];if(_0x13c39f[_0x27bb('0x34')]['includeAll']){_0x343e3d['include']=[{'all':!![]}];}_0x343e3d=_['merge']({},_0x343e3d,_0x13c39f['options']);return db[_0x27bb('0x2e')][_0x27bb('0x48')](_0x343e3d)['then'](handleEntityNotFound(_0x31ac60,null))[_0x27bb('0x26')](respondWithResult(_0x31ac60,null))['catch'](handleError(_0x31ac60,null));};exports[_0x27bb('0x49')]=function(_0x27dc29,_0x2dfdb7){return db[_0x27bb('0x2e')][_0x27bb('0x49')](_0x27dc29[_0x27bb('0x4a')],{})[_0x27bb('0x26')](respondWithResult(_0x2dfdb7,0xc9))[_0x27bb('0x45')](handleError(_0x2dfdb7,null));};exports[_0x27bb('0x4b')]=function(_0x5c3d09,_0x8b1bb2){if(_0x5c3d09[_0x27bb('0x4a')]['id']){delete _0x5c3d09['body']['id'];}return db[_0x27bb('0x2e')][_0x27bb('0x48')]({'where':{'id':_0x5c3d09['params']['id']}})[_0x27bb('0x26')](handleEntityNotFound(_0x8b1bb2,null))[_0x27bb('0x26')](saveUpdates(_0x5c3d09[_0x27bb('0x4a')],null))[_0x27bb('0x26')](respondWithResult(_0x8b1bb2,null))[_0x27bb('0x45')](handleError(_0x8b1bb2,null));};exports['destroy']=function(_0x209a16,_0x3f2500){return db['SmsQueueReport'][_0x27bb('0x48')]({'where':{'id':_0x209a16[_0x27bb('0x46')]['id']}})[_0x27bb('0x26')](handleEntityNotFound(_0x3f2500,null))[_0x27bb('0x26')](removeEntity(_0x3f2500,null))['catch'](handleError(_0x3f2500,null));};exports[_0x27bb('0x4c')]=function(_0x440931,_0x130566){return db[_0x27bb('0x2e')]['describe']()[_0x27bb('0x26')](respondWithResult(_0x130566,null))[_0x27bb('0x45')](handleError(_0x130566,null));}; \ No newline at end of file +var _0xea98=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','map','SmsQueueReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','rawAttributes','length','includeAll','find','catch','create','body','params','describe'];(function(_0x1e8b06,_0x47eb63){var _0x56f7ec=function(_0x46cd00){while(--_0x46cd00){_0x1e8b06['push'](_0x1e8b06['shift']());}};_0x56f7ec(++_0x47eb63);}(_0xea98,0x134));var _0x8ea9=function(_0x2a9e9f,_0xf513b8){_0x2a9e9f=_0x2a9e9f-0x0;var _0x46b9ba=_0xea98[_0x2a9e9f];return _0x46b9ba;};'use strict';var emlformat=require(_0x8ea9('0x0'));var rimraf=require(_0x8ea9('0x1'));var zipdir=require(_0x8ea9('0x2'));var jsonpatch=require(_0x8ea9('0x3'));var rp=require(_0x8ea9('0x4'));var moment=require(_0x8ea9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8ea9('0x6'));var util=require('util');var path=require(_0x8ea9('0x7'));var sox=require(_0x8ea9('0x8'));var csv=require(_0x8ea9('0x9'));var ejs=require(_0x8ea9('0xa'));var fs=require('fs');var fs_extra=require(_0x8ea9('0xb'));var _=require(_0x8ea9('0xc'));var squel=require(_0x8ea9('0xd'));var crypto=require(_0x8ea9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8ea9('0x9'));var querystring=require('querystring');var Papa=require(_0x8ea9('0xf'));var Redis=require('ioredis');var authService=require(_0x8ea9('0x10'));var qs=require(_0x8ea9('0x11'));var as=require(_0x8ea9('0x12'));var hardwareService=require(_0x8ea9('0x13'));var logger=require(_0x8ea9('0x14'))(_0x8ea9('0x15'));var utils=require(_0x8ea9('0x16'));var config=require(_0x8ea9('0x17'));var licenseUtil=require(_0x8ea9('0x18'));var db=require(_0x8ea9('0x19'))['db'];function respondWithStatusCode(_0x20444f,_0x17a265){_0x17a265=_0x17a265||0xcc;return function(_0x32d62c){if(_0x32d62c){return _0x20444f['sendStatus'](_0x17a265);}return _0x20444f['status'](_0x17a265)['end']();};}function respondWithResult(_0x586672,_0x4142ea){_0x4142ea=_0x4142ea||0xc8;return function(_0x5a2e15){if(_0x5a2e15){return _0x586672[_0x8ea9('0x1a')](_0x4142ea)[_0x8ea9('0x1b')](_0x5a2e15);}};}function respondWithFilteredResult(_0x3d9faf,_0x5047d2){return function(_0xcafcc5){if(_0xcafcc5){var _0x47fe30=typeof _0x5047d2[_0x8ea9('0x1c')]===_0x8ea9('0x1d')&&typeof _0x5047d2[_0x8ea9('0x1e')]===_0x8ea9('0x1d');var _0x2f50d6=_0xcafcc5['count'];var _0x4ba302=_0x47fe30?0x0:_0x5047d2[_0x8ea9('0x1c')];var _0x3091c9=_0x47fe30?_0xcafcc5[_0x8ea9('0x1f')]:_0x5047d2[_0x8ea9('0x1c')]+_0x5047d2[_0x8ea9('0x1e')];var _0x4a4de2;if(_0x3091c9>=_0x2f50d6){_0x3091c9=_0x2f50d6;_0x4a4de2=0xc8;}else{_0x4a4de2=0xce;}_0x3d9faf[_0x8ea9('0x1a')](_0x4a4de2);return _0x3d9faf[_0x8ea9('0x20')](_0x8ea9('0x21'),_0x4ba302+'-'+_0x3091c9+'/'+_0x2f50d6)['json'](_0xcafcc5);}return null;};}function patchUpdates(_0x237fd0){return function(_0x4ba656){try{jsonpatch[_0x8ea9('0x22')](_0x4ba656,_0x237fd0,!![]);}catch(_0x2c425a){return BPromise['reject'](_0x2c425a);}return _0x4ba656[_0x8ea9('0x23')]();};}function saveUpdates(_0x4e30dd,_0x1e4aa4){return function(_0x5f3c42){if(_0x5f3c42){return _0x5f3c42[_0x8ea9('0x24')](_0x4e30dd)[_0x8ea9('0x25')](function(_0x3873b3){return _0x3873b3;});}return null;};}function removeEntity(_0x3e6aea,_0x5e2c77){return function(_0x47a40e){if(_0x47a40e){return _0x47a40e[_0x8ea9('0x26')]()[_0x8ea9('0x25')](function(){_0x3e6aea['status'](0xcc)[_0x8ea9('0x27')]();});}};}function handleEntityNotFound(_0x3d3c51,_0x3008ff){return function(_0xe382dd){if(!_0xe382dd){_0x3d3c51[_0x8ea9('0x28')](0x194);}return _0xe382dd;};}function handleError(_0x24b3e4,_0x2e9b4a){_0x2e9b4a=_0x2e9b4a||0x1f4;return function(_0x3846c7){logger[_0x8ea9('0x29')](_0x3846c7[_0x8ea9('0x2a')]);if(_0x3846c7[_0x8ea9('0x2b')]){delete _0x3846c7[_0x8ea9('0x2b')];}_0x24b3e4[_0x8ea9('0x1a')](_0x2e9b4a)['send'](_0x3846c7);};}exports['index']=function(_0x3fcb41,_0x2e93f3){var _0x21d465={},_0x4895e8={},_0x427989={'count':0x0,'rows':[]};var _0x3b9f43=_[_0x8ea9('0x2c')](db[_0x8ea9('0x2d')]['rawAttributes'],function(_0x4583d0){return{'name':_0x4583d0[_0x8ea9('0x2e')],'type':_0x4583d0[_0x8ea9('0x2f')][_0x8ea9('0x30')]};});_0x4895e8[_0x8ea9('0x31')]=_[_0x8ea9('0x2c')](_0x3b9f43,_0x8ea9('0x2b'));_0x4895e8[_0x8ea9('0x32')]=_[_0x8ea9('0x33')](_0x3fcb41[_0x8ea9('0x32')]);_0x4895e8['filters']=_[_0x8ea9('0x34')](_0x4895e8['model'],_0x4895e8[_0x8ea9('0x32')]);_0x21d465[_0x8ea9('0x35')]=_['intersection'](_0x4895e8[_0x8ea9('0x31')],qs['fields'](_0x3fcb41[_0x8ea9('0x32')][_0x8ea9('0x36')]));_0x21d465[_0x8ea9('0x35')]=_0x21d465[_0x8ea9('0x35')]['length']?_0x21d465[_0x8ea9('0x35')]:_0x4895e8['model'];if(!_0x3fcb41[_0x8ea9('0x32')]['hasOwnProperty'](_0x8ea9('0x37'))){_0x21d465[_0x8ea9('0x1e')]=qs[_0x8ea9('0x1e')](_0x3fcb41[_0x8ea9('0x32')][_0x8ea9('0x1e')]);_0x21d465['offset']=qs[_0x8ea9('0x1c')](_0x3fcb41[_0x8ea9('0x32')][_0x8ea9('0x1c')]);}_0x21d465[_0x8ea9('0x38')]=qs[_0x8ea9('0x39')](_0x3fcb41[_0x8ea9('0x32')][_0x8ea9('0x39')]);_0x21d465[_0x8ea9('0x3a')]=qs[_0x8ea9('0x3b')](_[_0x8ea9('0x3c')](_0x3fcb41[_0x8ea9('0x32')],_0x4895e8['filters']),_0x3b9f43);if(_0x3fcb41[_0x8ea9('0x32')][_0x8ea9('0x3d')]){_0x21d465[_0x8ea9('0x3a')]=_[_0x8ea9('0x3e')](_0x21d465[_0x8ea9('0x3a')],{'$or':_[_0x8ea9('0x2c')](_0x3b9f43,function(_0x2689f2){if(_0x2689f2[_0x8ea9('0x2f')]!==_0x8ea9('0x3f')){var _0x5728fd={};_0x5728fd[_0x2689f2[_0x8ea9('0x2b')]]={'$like':'%'+_0x3fcb41[_0x8ea9('0x32')][_0x8ea9('0x3d')]+'%'};return _0x5728fd;}})});}_0x21d465=_[_0x8ea9('0x3e')]({},_0x21d465,_0x3fcb41[_0x8ea9('0x40')]);var _0x2cdb2d={'where':_0x21d465[_0x8ea9('0x3a')]};return db[_0x8ea9('0x2d')][_0x8ea9('0x1f')](_0x2cdb2d)[_0x8ea9('0x25')](function(_0x1813db){_0x427989['count']=_0x1813db;if(_0x3fcb41['query']['includeAll']){_0x21d465[_0x8ea9('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x8ea9('0x42')](_0x21d465);})['then'](function(_0x12b9c8){_0x427989[_0x8ea9('0x43')]=_0x12b9c8;return _0x427989;})[_0x8ea9('0x25')](respondWithFilteredResult(_0x2e93f3,_0x21d465))['catch'](handleError(_0x2e93f3,null));};exports['show']=function(_0x2de917,_0x49fa5b){var _0x1d6427={'raw':!![],'where':{'id':_0x2de917['params']['id']}},_0x5e6a77={};_0x5e6a77[_0x8ea9('0x31')]=_[_0x8ea9('0x33')](db[_0x8ea9('0x2d')][_0x8ea9('0x44')]);_0x5e6a77[_0x8ea9('0x32')]=_[_0x8ea9('0x33')](_0x2de917[_0x8ea9('0x32')]);_0x5e6a77[_0x8ea9('0x3b')]=_[_0x8ea9('0x34')](_0x5e6a77[_0x8ea9('0x31')],_0x5e6a77['query']);_0x1d6427[_0x8ea9('0x35')]=_[_0x8ea9('0x34')](_0x5e6a77[_0x8ea9('0x31')],qs[_0x8ea9('0x36')](_0x2de917['query'][_0x8ea9('0x36')]));_0x1d6427['attributes']=_0x1d6427[_0x8ea9('0x35')][_0x8ea9('0x45')]?_0x1d6427[_0x8ea9('0x35')]:_0x5e6a77['model'];if(_0x2de917[_0x8ea9('0x32')][_0x8ea9('0x46')]){_0x1d6427[_0x8ea9('0x41')]=[{'all':!![]}];}_0x1d6427=_['merge']({},_0x1d6427,_0x2de917['options']);return db['SmsQueueReport'][_0x8ea9('0x47')](_0x1d6427)[_0x8ea9('0x25')](handleEntityNotFound(_0x49fa5b,null))['then'](respondWithResult(_0x49fa5b,null))[_0x8ea9('0x48')](handleError(_0x49fa5b,null));};exports['create']=function(_0xc2e1d,_0x45fa04){return db['SmsQueueReport'][_0x8ea9('0x49')](_0xc2e1d[_0x8ea9('0x4a')],{})[_0x8ea9('0x25')](respondWithResult(_0x45fa04,0xc9))[_0x8ea9('0x48')](handleError(_0x45fa04,null));};exports['update']=function(_0x344047,_0x12f315){if(_0x344047[_0x8ea9('0x4a')]['id']){delete _0x344047['body']['id'];}return db['SmsQueueReport'][_0x8ea9('0x47')]({'where':{'id':_0x344047[_0x8ea9('0x4b')]['id']}})[_0x8ea9('0x25')](handleEntityNotFound(_0x12f315,null))[_0x8ea9('0x25')](saveUpdates(_0x344047[_0x8ea9('0x4a')],null))[_0x8ea9('0x25')](respondWithResult(_0x12f315,null))[_0x8ea9('0x48')](handleError(_0x12f315,null));};exports[_0x8ea9('0x26')]=function(_0xe50ab7,_0x59061c){return db[_0x8ea9('0x2d')][_0x8ea9('0x47')]({'where':{'id':_0xe50ab7[_0x8ea9('0x4b')]['id']}})[_0x8ea9('0x25')](handleEntityNotFound(_0x59061c,null))[_0x8ea9('0x25')](removeEntity(_0x59061c,null))[_0x8ea9('0x48')](handleError(_0x59061c,null));};exports[_0x8ea9('0x4c')]=function(_0x2297fe,_0x23ffaa){return db[_0x8ea9('0x2d')]['describe']()[_0x8ea9('0x25')](respondWithResult(_0x23ffaa,null))[_0x8ea9('0x48')](handleError(_0x23ffaa,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 222fca8..e0dcac5 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0xc6ea98,_0x1f0fe7){var _0x154999=function(_0x5c0555){while(--_0x5c0555){_0xc6ea98['push'](_0xc6ea98['shift']());}};_0x154999(++_0x1f0fe7);}(_0xe706,0xa3));var _0x6e70=function(_0x25e754,_0x200eba){_0x25e754=_0x25e754-0x0;var _0x1d991e=_0xe706[_0x25e754];return _0x1d991e;};'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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x272202,_0x569e70){var _0xcad2a7=function(_0x3b39b2){while(--_0x3b39b2){_0x272202['push'](_0x272202['shift']());}};_0xcad2a7(++_0x569e70);}(_0xe706,0xa3));var _0x6e70=function(_0x1a5eb0,_0x1f8fbb){_0x1a5eb0=_0x1a5eb0-0x0;var _0x30f9ba=_0xe706[_0x1a5eb0];return _0x30f9ba;};'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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 4473278..fd92395 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 _0xb329=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport','create','body','options','raw','then','UpdateSmsQueueReport','SmsQueueReport','where','limit','stringify'];(function(_0xa537f6,_0x299c1a){var _0x1aad97=function(_0x5835bc){while(--_0x5835bc){_0xa537f6['push'](_0xa537f6['shift']());}};_0x1aad97(++_0x299c1a);}(_0xb329,0x108));var _0x9b32=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0xb329[_0x424357];return _0x29c68e;};'use strict';var _=require('lodash');var util=require(_0x9b32('0x0'));var moment=require(_0x9b32('0x1'));var BPromise=require(_0x9b32('0x2'));var rs=require(_0x9b32('0x3'));var fs=require('fs');var Redis=require(_0x9b32('0x4'));var db=require(_0x9b32('0x5'))['db'];var utils=require(_0x9b32('0x6'));var logger=require(_0x9b32('0x7'))(_0x9b32('0x8'));var config=require(_0x9b32('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9b32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x247d43,_0x549831,_0x5cc2ee){return new BPromise(function(_0xcaf33b,_0x473a31){return client[_0x9b32('0xb')](_0x247d43,_0x5cc2ee)['then'](function(_0x162ad1){logger[_0x9b32('0xc')](_0x9b32('0xd'),_0x549831,_0x9b32('0xe'));logger[_0x9b32('0xf')](_0x9b32('0x10'),_0x549831,'request\x20sent',JSON['stringify'](_0x162ad1));if(_0x162ad1[_0x9b32('0x11')]){if(_0x162ad1[_0x9b32('0x11')][_0x9b32('0x12')]===0x1f4){logger['error'](_0x9b32('0xd'),_0x549831,_0x162ad1['error'][_0x9b32('0x13')]);return _0x473a31(_0x162ad1[_0x9b32('0x11')][_0x9b32('0x13')]);}logger[_0x9b32('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x549831,_0x162ad1[_0x9b32('0x11')][_0x9b32('0x13')]);return _0xcaf33b(_0x162ad1[_0x9b32('0x11')]['message']);}else{logger[_0x9b32('0xc')](_0x9b32('0xd'),_0x549831,_0x9b32('0xe'));_0xcaf33b(_0x162ad1[_0x9b32('0x14')][_0x9b32('0x13')]);}})[_0x9b32('0x15')](function(_0x4a9e93){logger[_0x9b32('0x11')](_0x9b32('0xd'),_0x549831,_0x4a9e93);_0x473a31(_0x4a9e93);});});}exports[_0x9b32('0x16')]=function(_0x484e1b){var _0xaf1719=this;return new Promise(function(_0x195b7b,_0x43595e){return db['SmsQueueReport'][_0x9b32('0x17')](_0x484e1b[_0x9b32('0x18')],{'raw':_0x484e1b[_0x9b32('0x19')]?_0x484e1b[_0x9b32('0x19')][_0x9b32('0x1a')]===undefined?!![]:![]:!![]})[_0x9b32('0x1b')](function(_0x3ad66f){logger[_0x9b32('0xc')](_0x9b32('0x16'),_0x484e1b);logger[_0x9b32('0xf')](_0x9b32('0x16'),_0x484e1b,JSON['stringify'](_0x3ad66f));_0x195b7b(_0x3ad66f);})['catch'](function(_0x3c73ec){logger[_0x9b32('0x11')]('CreateSmsQueueReport',_0x3c73ec[_0x9b32('0x13')],_0x484e1b);_0x43595e(_0xaf1719['error'](0x1f4,_0x3c73ec['message']));});});};exports[_0x9b32('0x1c')]=function(_0x4df581){var _0x289deb=this;return new Promise(function(_0x251c2e,_0x5e4b4d){return db[_0x9b32('0x1d')]['update'](_0x4df581[_0x9b32('0x18')],{'raw':_0x4df581[_0x9b32('0x19')]?_0x4df581[_0x9b32('0x19')][_0x9b32('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4df581[_0x9b32('0x19')]?_0x4df581[_0x9b32('0x19')][_0x9b32('0x1e')]||null:null,'attributes':_0x4df581[_0x9b32('0x19')]?_0x4df581[_0x9b32('0x19')]['attributes']||null:null,'limit':_0x4df581[_0x9b32('0x19')]?_0x4df581[_0x9b32('0x19')][_0x9b32('0x1f')]||null:null})[_0x9b32('0x1b')](function(_0x3ed08e){logger[_0x9b32('0xc')](_0x9b32('0x1c'),_0x4df581);logger[_0x9b32('0xf')](_0x9b32('0x1c'),_0x4df581,JSON[_0x9b32('0x20')](_0x3ed08e));_0x251c2e(_0x3ed08e);})[_0x9b32('0x15')](function(_0x1d778d){logger[_0x9b32('0x11')](_0x9b32('0x1c'),_0x1d778d[_0x9b32('0x13')],_0x4df581);_0x5e4b4d(_0x289deb[_0x9b32('0x11')](0x1f4,_0x1d778d[_0x9b32('0x13')]));});});}; \ No newline at end of file +var _0x87cc=['SmsQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','create','options','raw','CreateSmsQueueReport','debug','stringify','where','attributes','limit','UpdateSmsQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x40fde1,_0x1f65c9){var _0x37bb7d=function(_0x40bf85){while(--_0x40bf85){_0x40fde1['push'](_0x40fde1['shift']());}};_0x37bb7d(++_0x1f65c9);}(_0x87cc,0x15b));var _0xc87c=function(_0x417a78,_0x347a7c){_0x417a78=_0x417a78-0x0;var _0x507b24=_0x87cc[_0x417a78];return _0x507b24;};'use strict';var _=require('lodash');var util=require(_0xc87c('0x0'));var moment=require(_0xc87c('0x1'));var BPromise=require(_0xc87c('0x2'));var rs=require(_0xc87c('0x3'));var fs=require('fs');var Redis=require(_0xc87c('0x4'));var db=require(_0xc87c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc87c('0x6'));var config=require(_0xc87c('0x7'));var jayson=require(_0xc87c('0x8'));var client=jayson['client'][_0xc87c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x88beb9,_0x3163d7,_0x6737e6){return new BPromise(function(_0xce24b,_0x591e54){return client[_0xc87c('0xa')](_0x88beb9,_0x6737e6)[_0xc87c('0xb')](function(_0x21e2dd){logger[_0xc87c('0xc')](_0xc87c('0xd'),_0x3163d7,_0xc87c('0xe'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3163d7,_0xc87c('0xe'),JSON['stringify'](_0x21e2dd));if(_0x21e2dd[_0xc87c('0xf')]){if(_0x21e2dd[_0xc87c('0xf')][_0xc87c('0x10')]===0x1f4){logger[_0xc87c('0xf')](_0xc87c('0xd'),_0x3163d7,_0x21e2dd[_0xc87c('0xf')]['message']);return _0x591e54(_0x21e2dd[_0xc87c('0xf')]['message']);}logger['error'](_0xc87c('0xd'),_0x3163d7,_0x21e2dd[_0xc87c('0xf')][_0xc87c('0x11')]);return _0xce24b(_0x21e2dd[_0xc87c('0xf')][_0xc87c('0x11')]);}else{logger[_0xc87c('0xc')](_0xc87c('0xd'),_0x3163d7,'request\x20sent');_0xce24b(_0x21e2dd[_0xc87c('0x12')][_0xc87c('0x11')]);}})[_0xc87c('0x13')](function(_0x23c74c){logger[_0xc87c('0xf')](_0xc87c('0xd'),_0x3163d7,_0x23c74c);_0x591e54(_0x23c74c);});});}exports['CreateSmsQueueReport']=function(_0x450054){var _0x9a7cb4=this;return new Promise(function(_0x468cbd,_0x35652d){return db['SmsQueueReport'][_0xc87c('0x14')](_0x450054['body'],{'raw':_0x450054[_0xc87c('0x15')]?_0x450054['options'][_0xc87c('0x16')]===undefined?!![]:![]:!![]})[_0xc87c('0xb')](function(_0x4c1ab5){logger[_0xc87c('0xc')](_0xc87c('0x17'),_0x450054);logger[_0xc87c('0x18')](_0xc87c('0x17'),_0x450054,JSON[_0xc87c('0x19')](_0x4c1ab5));_0x468cbd(_0x4c1ab5);})[_0xc87c('0x13')](function(_0x19e0b8){logger[_0xc87c('0xf')]('CreateSmsQueueReport',_0x19e0b8[_0xc87c('0x11')],_0x450054);_0x35652d(_0x9a7cb4['error'](0x1f4,_0x19e0b8[_0xc87c('0x11')]));});});};exports['UpdateSmsQueueReport']=function(_0x1eaacb){var _0x3f0d2a=this;return new Promise(function(_0x4771b8,_0xa454ef){return db['SmsQueueReport']['update'](_0x1eaacb['body'],{'raw':_0x1eaacb[_0xc87c('0x15')]?_0x1eaacb[_0xc87c('0x15')][_0xc87c('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eaacb[_0xc87c('0x15')]?_0x1eaacb[_0xc87c('0x15')][_0xc87c('0x1a')]||null:null,'attributes':_0x1eaacb[_0xc87c('0x15')]?_0x1eaacb[_0xc87c('0x15')][_0xc87c('0x1b')]||null:null,'limit':_0x1eaacb[_0xc87c('0x15')]?_0x1eaacb['options'][_0xc87c('0x1c')]||null:null})[_0xc87c('0xb')](function(_0x368f1f){logger[_0xc87c('0xc')]('UpdateSmsQueueReport',_0x1eaacb);logger[_0xc87c('0x18')](_0xc87c('0x1d'),_0x1eaacb,JSON[_0xc87c('0x19')](_0x368f1f));_0x4771b8(_0x368f1f);})[_0xc87c('0x13')](function(_0xc8209c){logger[_0xc87c('0xf')](_0xc87c('0x1d'),_0xc8209c['message'],_0x1eaacb);_0xa454ef(_0x3f0d2a[_0xc87c('0xf')](0x1f4,_0xc8209c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 44f42cf..690a6b5 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 _0x8c46=['destroy','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x13b70f,_0x5c1116){var _0x51427c=function(_0x54bb0b){while(--_0x54bb0b){_0x13b70f['push'](_0x13b70f['shift']());}};_0x51427c(++_0x5c1116);}(_0x8c46,0x171));var _0x68c4=function(_0x460975,_0x1fc133){_0x460975=_0x460975-0x0;var _0x17102b=_0x8c46[_0x460975];return _0x17102b;};'use strict';var multer=require(_0x68c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x68c4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x68c4('0x2'));var auth=require(_0x68c4('0x3'));var interaction=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var controller=require(_0x68c4('0x6'));router[_0x68c4('0x7')]('/',auth[_0x68c4('0x8')](),controller[_0x68c4('0x9')]);router[_0x68c4('0x7')](_0x68c4('0xa'),auth['isAuthenticated'](),controller[_0x68c4('0xb')]);router[_0x68c4('0x7')](_0x68c4('0xc'),auth['isAuthenticated'](),controller[_0x68c4('0xd')]);router[_0x68c4('0xe')]('/',auth[_0x68c4('0x8')](),controller['create']);router['put'](_0x68c4('0xc'),auth[_0x68c4('0x8')](),controller['update']);router['delete'](_0x68c4('0xc'),auth[_0x68c4('0x8')](),controller[_0x68c4('0xf')]);module['exports']=router; \ No newline at end of file +var _0xac9d=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xac9d,0x14d));var _0xdac9=function(_0x2ae2cd,_0xb42c96){_0x2ae2cd=_0x2ae2cd-0x0;var _0xc52725=_0xac9d[_0x2ae2cd];return _0xc52725;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var fs_extra=require(_0xdac9('0x6'));var auth=require(_0xdac9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdac9('0x8'));var controller=require('./smsTransferReport.controller');router[_0xdac9('0x9')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xb')]);router[_0xdac9('0x9')](_0xdac9('0xc'),auth[_0xdac9('0xa')](),controller['describe']);router[_0xdac9('0x9')]('/:id',auth[_0xdac9('0xa')](),controller[_0xdac9('0xd')]);router[_0xdac9('0xe')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xf')]);router[_0xdac9('0x10')](_0xdac9('0x11'),auth[_0xdac9('0xa')](),controller[_0xdac9('0x12')]);router['delete'](_0xdac9('0x11'),auth[_0xdac9('0xa')](),controller['destroy']);module[_0xdac9('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 67601ec..43d80dd 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1d1b15,_0x5ef518){var _0x1801d3=function(_0x50d56e){while(--_0x50d56e){_0x1d1b15['push'](_0x1d1b15['shift']());}};_0x1801d3(++_0x5ef518);}(_0x54ef,0x112));var _0xf54e=function(_0x526d56,_0x308ff5){_0x526d56=_0x526d56-0x0;var _0x5ea6e9=_0x54ef[_0x526d56];return _0x5ea6e9;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4b0b1d,_0x2e3632){var _0x219bab=function(_0x104054){while(--_0x104054){_0x4b0b1d['push'](_0x4b0b1d['shift']());}};_0x219bab(++_0x2e3632);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0xf3cd[_0x3fa296];return _0x10b19f;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index eea2150..55c9fd2 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 _0x450a=['save','then','destroy','error','name','send','map','SmsTransferReport','rawAttributes','type','model','query','attributes','intersection','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','keys','fields','create','update','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x5169f1,_0x5e93c2){var _0x5e42ad=function(_0x216030){while(--_0x216030){_0x5169f1['push'](_0x5169f1['shift']());}};_0x5e42ad(++_0x5e93c2);}(_0x450a,0x149));var _0xa450=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x450a[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xa450('0x0'));var rimraf=require(_0xa450('0x1'));var zipdir=require(_0xa450('0x2'));var jsonpatch=require(_0xa450('0x3'));var rp=require(_0xa450('0x4'));var moment=require(_0xa450('0x5'));var BPromise=require(_0xa450('0x6'));var Mustache=require(_0xa450('0x7'));var util=require(_0xa450('0x8'));var path=require(_0xa450('0x9'));var sox=require('sox');var csv=require(_0xa450('0xa'));var ejs=require(_0xa450('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa450('0xc'));var crypto=require('crypto');var jsforce=require(_0xa450('0xd'));var deskjs=require(_0xa450('0xe'));var toCsv=require(_0xa450('0xa'));var querystring=require(_0xa450('0xf'));var Papa=require(_0xa450('0x10'));var Redis=require('ioredis');var authService=require(_0xa450('0x11'));var qs=require(_0xa450('0x12'));var as=require(_0xa450('0x13'));var hardwareService=require(_0xa450('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa450('0x15'));var config=require(_0xa450('0x16'));var licenseUtil=require(_0xa450('0x17'));var db=require(_0xa450('0x18'))['db'];function respondWithStatusCode(_0x769a6e,_0x260882){_0x260882=_0x260882||0xcc;return function(_0x49fcc6){if(_0x49fcc6){return _0x769a6e[_0xa450('0x19')](_0x260882);}return _0x769a6e[_0xa450('0x1a')](_0x260882)[_0xa450('0x1b')]();};}function respondWithResult(_0x27277d,_0x5b250d){_0x5b250d=_0x5b250d||0xc8;return function(_0x194e1d){if(_0x194e1d){return _0x27277d[_0xa450('0x1a')](_0x5b250d)['json'](_0x194e1d);}};}function respondWithFilteredResult(_0x3008a1,_0x13d5c3){return function(_0x2a1420){if(_0x2a1420){var _0x29e18e=typeof _0x13d5c3[_0xa450('0x1c')]===_0xa450('0x1d')&&typeof _0x13d5c3[_0xa450('0x1e')]==='undefined';var _0x3457b2=_0x2a1420['count'];var _0x16d22f=_0x29e18e?0x0:_0x13d5c3[_0xa450('0x1c')];var _0x4ceb21=_0x29e18e?_0x2a1420[_0xa450('0x1f')]:_0x13d5c3[_0xa450('0x1c')]+_0x13d5c3['limit'];var _0x3661ff;if(_0x4ceb21>=_0x3457b2){_0x4ceb21=_0x3457b2;_0x3661ff=0xc8;}else{_0x3661ff=0xce;}_0x3008a1['status'](_0x3661ff);return _0x3008a1[_0xa450('0x20')](_0xa450('0x21'),_0x16d22f+'-'+_0x4ceb21+'/'+_0x3457b2)[_0xa450('0x22')](_0x2a1420);}return null;};}function patchUpdates(_0x3579fb){return function(_0x28c26f){try{jsonpatch[_0xa450('0x23')](_0x28c26f,_0x3579fb,!![]);}catch(_0x3c748a){return BPromise['reject'](_0x3c748a);}return _0x28c26f[_0xa450('0x24')]();};}function saveUpdates(_0x3d09f3,_0x3286b0){return function(_0x91b71a){if(_0x91b71a){return _0x91b71a['update'](_0x3d09f3)[_0xa450('0x25')](function(_0xaf8247){return _0xaf8247;});}return null;};}function removeEntity(_0x2d9610,_0x23f13b){return function(_0x5040d8){if(_0x5040d8){return _0x5040d8[_0xa450('0x26')]()[_0xa450('0x25')](function(){_0x2d9610['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x540f9e,_0x490f73){return function(_0x41bdf6){if(!_0x41bdf6){_0x540f9e[_0xa450('0x19')](0x194);}return _0x41bdf6;};}function handleError(_0x8c6e26,_0x20d299){_0x20d299=_0x20d299||0x1f4;return function(_0x3cee54){logger[_0xa450('0x27')](_0x3cee54['stack']);if(_0x3cee54['name']){delete _0x3cee54[_0xa450('0x28')];}_0x8c6e26[_0xa450('0x1a')](_0x20d299)[_0xa450('0x29')](_0x3cee54);};}exports['index']=function(_0x196e88,_0x1ad4b5){var _0x21a8a1={},_0x4cc236={},_0xdaaf12={'count':0x0,'rows':[]};var _0x2b32d4=_[_0xa450('0x2a')](db[_0xa450('0x2b')][_0xa450('0x2c')],function(_0x534b2c){return{'name':_0x534b2c['fieldName'],'type':_0x534b2c[_0xa450('0x2d')]['key']};});_0x4cc236[_0xa450('0x2e')]=_[_0xa450('0x2a')](_0x2b32d4,'name');_0x4cc236['query']=_['keys'](_0x196e88[_0xa450('0x2f')]);_0x4cc236['filters']=_['intersection'](_0x4cc236['model'],_0x4cc236['query']);_0x21a8a1[_0xa450('0x30')]=_[_0xa450('0x31')](_0x4cc236[_0xa450('0x2e')],qs['fields'](_0x196e88[_0xa450('0x2f')]['fields']));_0x21a8a1['attributes']=_0x21a8a1[_0xa450('0x30')][_0xa450('0x32')]?_0x21a8a1[_0xa450('0x30')]:_0x4cc236['model'];if(!_0x196e88[_0xa450('0x2f')][_0xa450('0x33')](_0xa450('0x34'))){_0x21a8a1[_0xa450('0x1e')]=qs[_0xa450('0x1e')](_0x196e88[_0xa450('0x2f')]['limit']);_0x21a8a1['offset']=qs[_0xa450('0x1c')](_0x196e88[_0xa450('0x2f')][_0xa450('0x1c')]);}_0x21a8a1['order']=qs[_0xa450('0x35')](_0x196e88[_0xa450('0x2f')][_0xa450('0x35')]);_0x21a8a1['where']=qs[_0xa450('0x36')](_[_0xa450('0x37')](_0x196e88[_0xa450('0x2f')],_0x4cc236[_0xa450('0x36')]),_0x2b32d4);if(_0x196e88[_0xa450('0x2f')][_0xa450('0x38')]){_0x21a8a1[_0xa450('0x39')]=_[_0xa450('0x3a')](_0x21a8a1[_0xa450('0x39')],{'$or':_[_0xa450('0x2a')](_0x2b32d4,function(_0x51854a){if(_0x51854a[_0xa450('0x2d')]!=='VIRTUAL'){var _0x666aed={};_0x666aed[_0x51854a[_0xa450('0x28')]]={'$like':'%'+_0x196e88[_0xa450('0x2f')][_0xa450('0x38')]+'%'};return _0x666aed;}})});}_0x21a8a1=_[_0xa450('0x3a')]({},_0x21a8a1,_0x196e88['options']);var _0x2ac89a={'where':_0x21a8a1[_0xa450('0x39')]};return db[_0xa450('0x2b')][_0xa450('0x1f')](_0x2ac89a)[_0xa450('0x25')](function(_0x271131){_0xdaaf12[_0xa450('0x1f')]=_0x271131;if(_0x196e88[_0xa450('0x2f')][_0xa450('0x3b')]){_0x21a8a1[_0xa450('0x3c')]=[{'all':!![]}];}return db[_0xa450('0x2b')][_0xa450('0x3d')](_0x21a8a1);})['then'](function(_0x447714){_0xdaaf12[_0xa450('0x3e')]=_0x447714;return _0xdaaf12;})[_0xa450('0x25')](respondWithFilteredResult(_0x1ad4b5,_0x21a8a1))[_0xa450('0x3f')](handleError(_0x1ad4b5,null));};exports[_0xa450('0x40')]=function(_0x111c83,_0x1fac71){var _0x221d46={'raw':!![],'where':{'id':_0x111c83['params']['id']}},_0x16e641={};_0x16e641[_0xa450('0x2e')]=_[_0xa450('0x41')](db[_0xa450('0x2b')][_0xa450('0x2c')]);_0x16e641[_0xa450('0x2f')]=_['keys'](_0x111c83[_0xa450('0x2f')]);_0x16e641[_0xa450('0x36')]=_[_0xa450('0x31')](_0x16e641[_0xa450('0x2e')],_0x16e641[_0xa450('0x2f')]);_0x221d46[_0xa450('0x30')]=_[_0xa450('0x31')](_0x16e641['model'],qs['fields'](_0x111c83[_0xa450('0x2f')][_0xa450('0x42')]));_0x221d46[_0xa450('0x30')]=_0x221d46[_0xa450('0x30')][_0xa450('0x32')]?_0x221d46[_0xa450('0x30')]:_0x16e641['model'];if(_0x111c83[_0xa450('0x2f')][_0xa450('0x3b')]){_0x221d46[_0xa450('0x3c')]=[{'all':!![]}];}_0x221d46=_['merge']({},_0x221d46,_0x111c83['options']);return db[_0xa450('0x2b')]['find'](_0x221d46)[_0xa450('0x25')](handleEntityNotFound(_0x1fac71,null))[_0xa450('0x25')](respondWithResult(_0x1fac71,null))[_0xa450('0x3f')](handleError(_0x1fac71,null));};exports[_0xa450('0x43')]=function(_0x167dd5,_0x2911a6){return db[_0xa450('0x2b')][_0xa450('0x43')](_0x167dd5['body'],{})[_0xa450('0x25')](respondWithResult(_0x2911a6,0xc9))[_0xa450('0x3f')](handleError(_0x2911a6,null));};exports[_0xa450('0x44')]=function(_0x53242d,_0x31149a){if(_0x53242d[_0xa450('0x45')]['id']){delete _0x53242d[_0xa450('0x45')]['id'];}return db['SmsTransferReport'][_0xa450('0x46')]({'where':{'id':_0x53242d[_0xa450('0x47')]['id']}})[_0xa450('0x25')](handleEntityNotFound(_0x31149a,null))['then'](saveUpdates(_0x53242d['body'],null))[_0xa450('0x25')](respondWithResult(_0x31149a,null))['catch'](handleError(_0x31149a,null));};exports[_0xa450('0x26')]=function(_0x1e38ff,_0x36710e){return db['SmsTransferReport'][_0xa450('0x46')]({'where':{'id':_0x1e38ff[_0xa450('0x47')]['id']}})[_0xa450('0x25')](handleEntityNotFound(_0x36710e,null))['then'](removeEntity(_0x36710e,null))[_0xa450('0x3f')](handleError(_0x36710e,null));};exports[_0xa450('0x48')]=function(_0xe600af,_0x26f52f){return db[_0xa450('0x2b')][_0xa450('0x48')]()[_0xa450('0x25')](respondWithResult(_0x26f52f,null))[_0xa450('0x3f')](handleError(_0x26f52f,null));}; \ No newline at end of file +var _0x34bc=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','findAll','rows','catch','show','params','includeAll','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','SmsTransferReport'];(function(_0x353a10,_0x351458){var _0x3c94e2=function(_0x52c0a7){while(--_0x52c0a7){_0x353a10['push'](_0x353a10['shift']());}};_0x3c94e2(++_0x351458);}(_0x34bc,0x10e));var _0xc34b=function(_0x78d045,_0x582a8a){_0x78d045=_0x78d045-0x0;var _0xb8d95=_0x34bc[_0x78d045];return _0xb8d95;};'use strict';var emlformat=require(_0xc34b('0x0'));var rimraf=require(_0xc34b('0x1'));var zipdir=require(_0xc34b('0x2'));var jsonpatch=require(_0xc34b('0x3'));var rp=require('request-promise');var moment=require(_0xc34b('0x4'));var BPromise=require(_0xc34b('0x5'));var Mustache=require(_0xc34b('0x6'));var util=require(_0xc34b('0x7'));var path=require(_0xc34b('0x8'));var sox=require(_0xc34b('0x9'));var csv=require(_0xc34b('0xa'));var ejs=require(_0xc34b('0xb'));var fs=require('fs');var fs_extra=require(_0xc34b('0xc'));var _=require(_0xc34b('0xd'));var squel=require(_0xc34b('0xe'));var crypto=require(_0xc34b('0xf'));var jsforce=require(_0xc34b('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc34b('0x11'));var Papa=require(_0xc34b('0x12'));var Redis=require(_0xc34b('0x13'));var authService=require(_0xc34b('0x14'));var qs=require(_0xc34b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc34b('0x16'));var logger=require(_0xc34b('0x17'))(_0xc34b('0x18'));var utils=require('../../config/utils');var config=require(_0xc34b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc34b('0x1a'))['db'];function respondWithStatusCode(_0x1e5332,_0x189c8f){_0x189c8f=_0x189c8f||0xcc;return function(_0x15b6fb){if(_0x15b6fb){return _0x1e5332[_0xc34b('0x1b')](_0x189c8f);}return _0x1e5332[_0xc34b('0x1c')](_0x189c8f)[_0xc34b('0x1d')]();};}function respondWithResult(_0x2b65b2,_0x7ea987){_0x7ea987=_0x7ea987||0xc8;return function(_0x15ff9a){if(_0x15ff9a){return _0x2b65b2[_0xc34b('0x1c')](_0x7ea987)[_0xc34b('0x1e')](_0x15ff9a);}};}function respondWithFilteredResult(_0x2b9bb0,_0x140f1c){return function(_0x319dc6){if(_0x319dc6){var _0x312bd2=typeof _0x140f1c[_0xc34b('0x1f')]===_0xc34b('0x20')&&typeof _0x140f1c[_0xc34b('0x21')]===_0xc34b('0x20');var _0x5f11cd=_0x319dc6[_0xc34b('0x22')];var _0x3d787c=_0x312bd2?0x0:_0x140f1c['offset'];var _0x15ab6f=_0x312bd2?_0x319dc6['count']:_0x140f1c[_0xc34b('0x1f')]+_0x140f1c[_0xc34b('0x21')];var _0x74d14c;if(_0x15ab6f>=_0x5f11cd){_0x15ab6f=_0x5f11cd;_0x74d14c=0xc8;}else{_0x74d14c=0xce;}_0x2b9bb0[_0xc34b('0x1c')](_0x74d14c);return _0x2b9bb0[_0xc34b('0x23')](_0xc34b('0x24'),_0x3d787c+'-'+_0x15ab6f+'/'+_0x5f11cd)[_0xc34b('0x1e')](_0x319dc6);}return null;};}function patchUpdates(_0x3ac897){return function(_0x57a1f0){try{jsonpatch[_0xc34b('0x25')](_0x57a1f0,_0x3ac897,!![]);}catch(_0x2d7c65){return BPromise[_0xc34b('0x26')](_0x2d7c65);}return _0x57a1f0['save']();};}function saveUpdates(_0x2dd62b,_0xcc2fe){return function(_0x2f2343){if(_0x2f2343){return _0x2f2343['update'](_0x2dd62b)[_0xc34b('0x27')](function(_0x702d4a){return _0x702d4a;});}return null;};}function removeEntity(_0x1a0d59,_0x26430b){return function(_0x376a69){if(_0x376a69){return _0x376a69[_0xc34b('0x28')]()['then'](function(){_0x1a0d59[_0xc34b('0x1c')](0xcc)[_0xc34b('0x1d')]();});}};}function handleEntityNotFound(_0x458690,_0x3e0f50){return function(_0x1bfe58){if(!_0x1bfe58){_0x458690[_0xc34b('0x1b')](0x194);}return _0x1bfe58;};}function handleError(_0x1f8b30,_0x14c8df){_0x14c8df=_0x14c8df||0x1f4;return function(_0x50494c){logger['error'](_0x50494c[_0xc34b('0x29')]);if(_0x50494c['name']){delete _0x50494c[_0xc34b('0x2a')];}_0x1f8b30[_0xc34b('0x1c')](_0x14c8df)[_0xc34b('0x2b')](_0x50494c);};}exports[_0xc34b('0x2c')]=function(_0x1cd6fb,_0x27661c){var _0x411e97={},_0x55f6bc={},_0xfecab5={'count':0x0,'rows':[]};var _0x8a3b9d=_['map'](db[_0xc34b('0x2d')][_0xc34b('0x2e')],function(_0x434a2b){return{'name':_0x434a2b[_0xc34b('0x2f')],'type':_0x434a2b[_0xc34b('0x30')][_0xc34b('0x31')]};});_0x55f6bc[_0xc34b('0x32')]=_['map'](_0x8a3b9d,'name');_0x55f6bc[_0xc34b('0x33')]=_[_0xc34b('0x34')](_0x1cd6fb[_0xc34b('0x33')]);_0x55f6bc[_0xc34b('0x35')]=_[_0xc34b('0x36')](_0x55f6bc[_0xc34b('0x32')],_0x55f6bc[_0xc34b('0x33')]);_0x411e97[_0xc34b('0x37')]=_[_0xc34b('0x36')](_0x55f6bc[_0xc34b('0x32')],qs[_0xc34b('0x38')](_0x1cd6fb[_0xc34b('0x33')][_0xc34b('0x38')]));_0x411e97['attributes']=_0x411e97[_0xc34b('0x37')]['length']?_0x411e97[_0xc34b('0x37')]:_0x55f6bc[_0xc34b('0x32')];if(!_0x1cd6fb[_0xc34b('0x33')][_0xc34b('0x39')](_0xc34b('0x3a'))){_0x411e97['limit']=qs[_0xc34b('0x21')](_0x1cd6fb[_0xc34b('0x33')][_0xc34b('0x21')]);_0x411e97[_0xc34b('0x1f')]=qs['offset'](_0x1cd6fb[_0xc34b('0x33')][_0xc34b('0x1f')]);}_0x411e97[_0xc34b('0x3b')]=qs[_0xc34b('0x3c')](_0x1cd6fb['query'][_0xc34b('0x3c')]);_0x411e97[_0xc34b('0x3d')]=qs['filters'](_[_0xc34b('0x3e')](_0x1cd6fb[_0xc34b('0x33')],_0x55f6bc[_0xc34b('0x35')]),_0x8a3b9d);if(_0x1cd6fb[_0xc34b('0x33')]['filter']){_0x411e97['where']=_['merge'](_0x411e97[_0xc34b('0x3d')],{'$or':_[_0xc34b('0x3f')](_0x8a3b9d,function(_0x52893d){if(_0x52893d[_0xc34b('0x30')]!==_0xc34b('0x40')){var _0x58fb5f={};_0x58fb5f[_0x52893d['name']]={'$like':'%'+_0x1cd6fb[_0xc34b('0x33')][_0xc34b('0x41')]+'%'};return _0x58fb5f;}})});}_0x411e97=_[_0xc34b('0x42')]({},_0x411e97,_0x1cd6fb[_0xc34b('0x43')]);var _0x54dd28={'where':_0x411e97['where']};return db[_0xc34b('0x2d')][_0xc34b('0x22')](_0x54dd28)['then'](function(_0x39ed05){_0xfecab5[_0xc34b('0x22')]=_0x39ed05;if(_0x1cd6fb['query']['includeAll']){_0x411e97['include']=[{'all':!![]}];}return db[_0xc34b('0x2d')][_0xc34b('0x44')](_0x411e97);})[_0xc34b('0x27')](function(_0xe8cae5){_0xfecab5[_0xc34b('0x45')]=_0xe8cae5;return _0xfecab5;})[_0xc34b('0x27')](respondWithFilteredResult(_0x27661c,_0x411e97))[_0xc34b('0x46')](handleError(_0x27661c,null));};exports[_0xc34b('0x47')]=function(_0x3aadd6,_0x552a33){var _0x2028e0={'raw':!![],'where':{'id':_0x3aadd6[_0xc34b('0x48')]['id']}},_0x1a4c5b={};_0x1a4c5b[_0xc34b('0x32')]=_[_0xc34b('0x34')](db['SmsTransferReport'][_0xc34b('0x2e')]);_0x1a4c5b[_0xc34b('0x33')]=_[_0xc34b('0x34')](_0x3aadd6['query']);_0x1a4c5b[_0xc34b('0x35')]=_[_0xc34b('0x36')](_0x1a4c5b[_0xc34b('0x32')],_0x1a4c5b[_0xc34b('0x33')]);_0x2028e0[_0xc34b('0x37')]=_[_0xc34b('0x36')](_0x1a4c5b[_0xc34b('0x32')],qs[_0xc34b('0x38')](_0x3aadd6[_0xc34b('0x33')][_0xc34b('0x38')]));_0x2028e0[_0xc34b('0x37')]=_0x2028e0[_0xc34b('0x37')]['length']?_0x2028e0[_0xc34b('0x37')]:_0x1a4c5b['model'];if(_0x3aadd6[_0xc34b('0x33')][_0xc34b('0x49')]){_0x2028e0['include']=[{'all':!![]}];}_0x2028e0=_[_0xc34b('0x42')]({},_0x2028e0,_0x3aadd6[_0xc34b('0x43')]);return db[_0xc34b('0x2d')][_0xc34b('0x4a')](_0x2028e0)['then'](handleEntityNotFound(_0x552a33,null))[_0xc34b('0x27')](respondWithResult(_0x552a33,null))['catch'](handleError(_0x552a33,null));};exports[_0xc34b('0x4b')]=function(_0x7963a4,_0x4d18e6){return db[_0xc34b('0x2d')]['create'](_0x7963a4[_0xc34b('0x4c')],{})[_0xc34b('0x27')](respondWithResult(_0x4d18e6,0xc9))[_0xc34b('0x46')](handleError(_0x4d18e6,null));};exports[_0xc34b('0x4d')]=function(_0x13b790,_0x1aeec2){if(_0x13b790['body']['id']){delete _0x13b790['body']['id'];}return db[_0xc34b('0x2d')][_0xc34b('0x4a')]({'where':{'id':_0x13b790[_0xc34b('0x48')]['id']}})[_0xc34b('0x27')](handleEntityNotFound(_0x1aeec2,null))[_0xc34b('0x27')](saveUpdates(_0x13b790['body'],null))[_0xc34b('0x27')](respondWithResult(_0x1aeec2,null))[_0xc34b('0x46')](handleError(_0x1aeec2,null));};exports['destroy']=function(_0x26ac0b,_0x51be74){return db[_0xc34b('0x2d')]['find']({'where':{'id':_0x26ac0b['params']['id']}})[_0xc34b('0x27')](handleEntityNotFound(_0x51be74,null))[_0xc34b('0x27')](removeEntity(_0x51be74,null))[_0xc34b('0x46')](handleError(_0x51be74,null));};exports[_0xc34b('0x4e')]=function(_0x538fdc,_0x3231e4){return db[_0xc34b('0x2d')][_0xc34b('0x4e')]()['then'](respondWithResult(_0x3231e4,null))[_0xc34b('0x46')](handleError(_0x3231e4,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index b5af9f9..50661db 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 _0xc02d=['../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xc02d,0x1aa));var _0xdc02=function(_0x2d8d89,_0x31d4e4){_0x2d8d89=_0x2d8d89-0x0;var _0x4c7a64=_0xc02d[_0x2d8d89];return _0x4c7a64;};'use strict';var _=require('lodash');var util=require(_0xdc02('0x0'));var logger=require(_0xdc02('0x1'))(_0xdc02('0x2'));var moment=require(_0xdc02('0x3'));var BPromise=require(_0xdc02('0x4'));var rp=require(_0xdc02('0x5'));var fs=require('fs');var path=require(_0xdc02('0x6'));var rimraf=require(_0xdc02('0x7'));var config=require(_0xdc02('0x8'));var attributes=require(_0xdc02('0x9'));module[_0xdc02('0xa')]=function(_0x592468,_0x27a980){return _0x592468[_0xdc02('0xb')](_0xdc02('0xc'),attributes,{'tableName':_0xdc02('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x782e=['../../config/environment','./smsTransferReport.attributes','exports','report_sms_transfer','uniqueid','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x20ecc2,_0x47914d){var _0x3bc540=function(_0x58de01){while(--_0x58de01){_0x20ecc2['push'](_0x20ecc2['shift']());}};_0x3bc540(++_0x47914d);}(_0x782e,0xb9));var _0xe782=function(_0x14eed8,_0x5236c9){_0x14eed8=_0x14eed8-0x0;var _0x118ca8=_0x782e[_0x14eed8];return _0x118ca8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe782('0x0'))(_0xe782('0x1'));var moment=require('moment');var BPromise=require(_0xe782('0x2'));var rp=require(_0xe782('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe782('0x4'));var config=require(_0xe782('0x5'));var attributes=require(_0xe782('0x6'));module[_0xe782('0x7')]=function(_0x5a75ef,_0x1b934f){return _0x5a75ef['define']('SmsTransferReport',attributes,{'tableName':_0xe782('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe782('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 8995edf..f92cdff 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 _0xf767=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SmsTransferReport,\x20%s,\x20%s'];(function(_0x3aacd1,_0x13b72e){var _0xec5062=function(_0x3ddaad){while(--_0x3ddaad){_0x3aacd1['push'](_0x3aacd1['shift']());}};_0xec5062(++_0x13b72e);}(_0xf767,0x76));var _0x7f76=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0xf767[_0x102f97];return _0xd22058;};'use strict';var _=require('lodash');var util=require(_0x7f76('0x0'));var moment=require(_0x7f76('0x1'));var BPromise=require(_0x7f76('0x2'));var rs=require(_0x7f76('0x3'));var fs=require('fs');var Redis=require(_0x7f76('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f76('0x5'));var logger=require(_0x7f76('0x6'))(_0x7f76('0x7'));var config=require(_0x7f76('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7f76('0x9')][_0x7f76('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45ddcc,_0x1eeb08,_0x1fc46c){return new BPromise(function(_0x5acfee,_0x8b5dce){return client[_0x7f76('0xb')](_0x45ddcc,_0x1fc46c)[_0x7f76('0xc')](function(_0x15dcd9){logger['info'](_0x7f76('0xd'),_0x1eeb08,'request\x20sent');logger[_0x7f76('0xe')](_0x7f76('0xf'),_0x1eeb08,_0x7f76('0x10'),JSON[_0x7f76('0x11')](_0x15dcd9));if(_0x15dcd9[_0x7f76('0x12')]){if(_0x15dcd9[_0x7f76('0x12')]['code']===0x1f4){logger[_0x7f76('0x12')](_0x7f76('0xd'),_0x1eeb08,_0x15dcd9[_0x7f76('0x12')][_0x7f76('0x13')]);return _0x8b5dce(_0x15dcd9[_0x7f76('0x12')]['message']);}logger[_0x7f76('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x1eeb08,_0x15dcd9[_0x7f76('0x12')][_0x7f76('0x13')]);return _0x5acfee(_0x15dcd9['error']['message']);}else{logger['info'](_0x7f76('0xd'),_0x1eeb08,_0x7f76('0x10'));_0x5acfee(_0x15dcd9[_0x7f76('0x14')]['message']);}})[_0x7f76('0x15')](function(_0x522a2c){logger[_0x7f76('0x12')](_0x7f76('0xd'),_0x1eeb08,_0x522a2c);_0x8b5dce(_0x522a2c);});});} \ No newline at end of file +var _0xc4a1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4a1,0x1ef));var _0x1c4a=function(_0x28d58d,_0x8a5664){_0x28d58d=_0x28d58d-0x0;var _0x367d93=_0xc4a1[_0x28d58d];return _0x367d93;};'use strict';var _=require(_0x1c4a('0x0'));var util=require('util');var moment=require(_0x1c4a('0x1'));var BPromise=require(_0x1c4a('0x2'));var rs=require(_0x1c4a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c4a('0x4'))['db'];var utils=require(_0x1c4a('0x5'));var logger=require(_0x1c4a('0x6'))(_0x1c4a('0x7'));var config=require(_0x1c4a('0x8'));var jayson=require(_0x1c4a('0x9'));var client=jayson[_0x1c4a('0xa')][_0x1c4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46e47d,_0x420058,_0x2f84b0){return new BPromise(function(_0xef9b92,_0x456e39){return client['request'](_0x46e47d,_0x2f84b0)[_0x1c4a('0xc')](function(_0x4272ec){logger['info'](_0x1c4a('0xd'),_0x420058,'request\x20sent');logger['debug'](_0x1c4a('0xe'),_0x420058,_0x1c4a('0xf'),JSON['stringify'](_0x4272ec));if(_0x4272ec[_0x1c4a('0x10')]){if(_0x4272ec[_0x1c4a('0x10')]['code']===0x1f4){logger['error'](_0x1c4a('0xd'),_0x420058,_0x4272ec[_0x1c4a('0x10')]['message']);return _0x456e39(_0x4272ec['error'][_0x1c4a('0x11')]);}logger[_0x1c4a('0x10')](_0x1c4a('0xd'),_0x420058,_0x4272ec[_0x1c4a('0x10')][_0x1c4a('0x11')]);return _0xef9b92(_0x4272ec[_0x1c4a('0x10')][_0x1c4a('0x11')]);}else{logger[_0x1c4a('0x12')](_0x1c4a('0xd'),_0x420058,_0x1c4a('0xf'));_0xef9b92(_0x4272ec['result'][_0x1c4a('0x11')]);}})[_0x1c4a('0x13')](function(_0x1b1358){logger[_0x1c4a('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x420058,_0x1b1358);_0x456e39(_0x1b1358);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 6d6cef4..b5e47ff 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 _0xcd90=['isAuthenticated','/:id','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1efa20,_0x4be927){var _0x139cf4=function(_0x1a847f){while(--_0x1a847f){_0x1efa20['push'](_0x1efa20['shift']());}};_0x139cf4(++_0x4be927);}(_0xcd90,0x76));var _0x0cd9=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xcd90[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0cd9('0x0'));var util=require(_0x0cd9('0x1'));var path=require(_0x0cd9('0x2'));var timeout=require(_0x0cd9('0x3'));var express=require(_0x0cd9('0x4'));var router=express[_0x0cd9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0cd9('0x6'));var interaction=require(_0x0cd9('0x7'));var config=require(_0x0cd9('0x8'));var controller=require('./sound.controller');router[_0x0cd9('0x9')]('/',auth[_0x0cd9('0xa')](),controller['index']);router[_0x0cd9('0x9')](_0x0cd9('0xb'),auth[_0x0cd9('0xa')](),controller[_0x0cd9('0xc')]);router[_0x0cd9('0x9')](_0x0cd9('0xd'),auth[_0x0cd9('0xa')](),controller[_0x0cd9('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3d2033,_0x5eb5ff,_0x245a9e){_0x245a9e(null,path[_0x0cd9('0xf')](config[_0x0cd9('0x10')],_0x0cd9('0x11')));},'filename':function(_0x430bcf,_0x8a8f93,_0x1f64c7){_0x8a8f93['originalname']=_0x8a8f93[_0x0cd9('0x12')][_0x0cd9('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1f64c7(null,util[_0x0cd9('0x14')](_0x0cd9('0x15'),path[_0x0cd9('0x16')](_0x8a8f93[_0x0cd9('0x12')],path[_0x0cd9('0x17')](_0x8a8f93[_0x0cd9('0x12')])),Date[_0x0cd9('0x18')](),path[_0x0cd9('0x17')](_0x8a8f93[_0x0cd9('0x12')])));}})});router[_0x0cd9('0x19')]('/',upload[_0x0cd9('0x1a')](_0x0cd9('0x1b')),controller[_0x0cd9('0x1c')]);router['put'](_0x0cd9('0xb'),auth['isAuthenticated'](),controller[_0x0cd9('0x1d')]);router[_0x0cd9('0x1e')](_0x0cd9('0xb'),auth[_0x0cd9('0xa')](),controller[_0x0cd9('0x1e')]);module[_0x0cd9('0x1f')]=router; \ No newline at end of file +var _0x608d=['diskStorage','join','root','server/files/sounds/original/','originalname','format','extname','now','post','file','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','/:id/download'];(function(_0x2f04e0,_0xc0b366){var _0xb6d550=function(_0x21be6b){while(--_0x21be6b){_0x2f04e0['push'](_0x2f04e0['shift']());}};_0xb6d550(++_0xc0b366);}(_0x608d,0x194));var _0xd608=function(_0x1f1667,_0x1fa23b){_0x1f1667=_0x1f1667-0x0;var _0x394264=_0x608d[_0x1f1667];return _0x394264;};'use strict';var multer=require(_0xd608('0x0'));var util=require(_0xd608('0x1'));var path=require(_0xd608('0x2'));var timeout=require(_0xd608('0x3'));var express=require(_0xd608('0x4'));var router=express[_0xd608('0x5')]();var fs_extra=require(_0xd608('0x6'));var auth=require(_0xd608('0x7'));var interaction=require(_0xd608('0x8'));var config=require(_0xd608('0x9'));var controller=require(_0xd608('0xa'));router['get']('/',auth[_0xd608('0xb')](),controller[_0xd608('0xc')]);router[_0xd608('0xd')](_0xd608('0xe'),auth[_0xd608('0xb')](),controller['show']);router[_0xd608('0xd')](_0xd608('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xd608('0x10')]({'destination':function(_0x40e51c,_0x10c80c,_0x37eca9){_0x37eca9(null,path[_0xd608('0x11')](config[_0xd608('0x12')],_0xd608('0x13')));},'filename':function(_0x2daaf6,_0x80f966,_0x5f5c67){_0x80f966[_0xd608('0x14')]=_0x80f966[_0xd608('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5f5c67(null,util[_0xd608('0x15')]('%s-%s%s',path['basename'](_0x80f966[_0xd608('0x14')],path[_0xd608('0x16')](_0x80f966[_0xd608('0x14')])),Date[_0xd608('0x17')](),path['extname'](_0x80f966[_0xd608('0x14')])));}})});router[_0xd608('0x18')]('/',upload['single'](_0xd608('0x19')),controller['create']);router[_0xd608('0x1a')](_0xd608('0xe'),auth[_0xd608('0xb')](),controller[_0xd608('0x1b')]);router[_0xd608('0x1c')](_0xd608('0xe'),auth[_0xd608('0xb')](),controller[_0xd608('0x1c')]);module[_0xd608('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a5e4bee..9a1189f 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 _0x64f2=['BIGINT','INTEGER','sequelize','exports','STRING','name','FLOAT'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x64f2,0x1f3));var _0x264f=function(_0x1e6171,_0x529afb){_0x1e6171=_0x1e6171-0x0;var _0x43bc5e=_0x64f2[_0x1e6171];return _0x43bc5e;};'use strict';var Sequelize=require(_0x264f('0x0'));module[_0x264f('0x1')]={'name':{'type':Sequelize[_0x264f('0x2')],'unique':_0x264f('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x264f('0x2')]},'display_name':{'type':Sequelize[_0x264f('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x264f('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x264f('0x4')]},'original_sampleCount':{'type':Sequelize[_0x264f('0x5')]},'original_channelCount':{'type':Sequelize[_0x264f('0x6')]},'original_bitRate':{'type':Sequelize[_0x264f('0x5')]},'original_sampleRate':{'type':Sequelize[_0x264f('0x6')]},'converted_format':{'type':Sequelize[_0x264f('0x2')]},'converted_duration':{'type':Sequelize[_0x264f('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x264f('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x264f('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbc37=['BIGINT','INTEGER','sequelize','exports','STRING','name','FLOAT'];(function(_0x42fc8e,_0x26620d){var _0x4ad7b5=function(_0x4b217b){while(--_0x4b217b){_0x42fc8e['push'](_0x42fc8e['shift']());}};_0x4ad7b5(++_0x26620d);}(_0xbc37,0xe2));var _0x7bc3=function(_0x48e474,_0x2ecd1e){_0x48e474=_0x48e474-0x0;var _0x37778b=_0xbc37[_0x48e474];return _0x37778b;};'use strict';var Sequelize=require(_0x7bc3('0x0'));module[_0x7bc3('0x1')]={'name':{'type':Sequelize[_0x7bc3('0x2')],'unique':_0x7bc3('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x7bc3('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x7bc3('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x7bc3('0x4')]},'original_sampleCount':{'type':Sequelize[_0x7bc3('0x5')]},'original_channelCount':{'type':Sequelize[_0x7bc3('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x7bc3('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x7bc3('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'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 e9cb085..7950b92 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 _0x6001=['type','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','find','download','save_name','existsSync','join','root','Sequelize','server/files/sounds/converted','%s.%s','converted_format','format','basename','file','originalname','extname','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','server/files/sounds/original','original_format','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','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/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','get','Sounds','UserProfileResource','stack','name','send','index','Sound','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','pick','filter','where'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x6001,0x13f));var _0x1600=function(_0x3f0b15,_0x29a0c6){_0x3f0b15=_0x3f0b15-0x0;var _0x371196=_0x6001[_0x3f0b15];return _0x371196;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1600('0x0'));var zipdir=require(_0x1600('0x1'));var jsonpatch=require(_0x1600('0x2'));var rp=require('request-promise');var moment=require(_0x1600('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1600('0x4'));var path=require(_0x1600('0x5'));var sox=require(_0x1600('0x6'));var csv=require(_0x1600('0x7'));var ejs=require(_0x1600('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1600('0x9'));var crypto=require(_0x1600('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1600('0xb'));var toCsv=require(_0x1600('0x7'));var querystring=require(_0x1600('0xc'));var Papa=require(_0x1600('0xd'));var Redis=require(_0x1600('0xe'));var authService=require(_0x1600('0xf'));var qs=require(_0x1600('0x10'));var as=require(_0x1600('0x11'));var hardwareService=require(_0x1600('0x12'));var logger=require(_0x1600('0x13'))(_0x1600('0x14'));var utils=require(_0x1600('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1600('0x16'));var db=require(_0x1600('0x17'))['db'];function respondWithStatusCode(_0xdf243a,_0x276253){_0x276253=_0x276253||0xcc;return function(_0x188c47){if(_0x188c47){return _0xdf243a[_0x1600('0x18')](_0x276253);}return _0xdf243a['status'](_0x276253)[_0x1600('0x19')]();};}function respondWithResult(_0x15f74c,_0x3f31bb){_0x3f31bb=_0x3f31bb||0xc8;return function(_0x6c123){if(_0x6c123){return _0x15f74c[_0x1600('0x1a')](_0x3f31bb)[_0x1600('0x1b')](_0x6c123);}};}function respondWithFilteredResult(_0x49f975,_0x152a1e){return function(_0x363548){if(_0x363548){var _0x217903=typeof _0x152a1e['offset']===_0x1600('0x1c')&&typeof _0x152a1e[_0x1600('0x1d')]===_0x1600('0x1c');var _0x3453e5=_0x363548[_0x1600('0x1e')];var _0x46416e=_0x217903?0x0:_0x152a1e[_0x1600('0x1f')];var _0x9375a5=_0x217903?_0x363548[_0x1600('0x1e')]:_0x152a1e[_0x1600('0x1f')]+_0x152a1e[_0x1600('0x1d')];var _0x24c30f;if(_0x9375a5>=_0x3453e5){_0x9375a5=_0x3453e5;_0x24c30f=0xc8;}else{_0x24c30f=0xce;}_0x49f975[_0x1600('0x1a')](_0x24c30f);return _0x49f975['set'](_0x1600('0x20'),_0x46416e+'-'+_0x9375a5+'/'+_0x3453e5)[_0x1600('0x1b')](_0x363548);}return null;};}function patchUpdates(_0x52510d){return function(_0x57bd71){try{jsonpatch[_0x1600('0x21')](_0x57bd71,_0x52510d,!![]);}catch(_0x27b51e){return BPromise['reject'](_0x27b51e);}return _0x57bd71[_0x1600('0x22')]();};}function saveUpdates(_0x123fa9,_0x14d8ce){return function(_0x1ee67d){if(_0x1ee67d){return _0x1ee67d[_0x1600('0x23')](_0x123fa9)[_0x1600('0x24')](function(_0x3dfbc3){return _0x3dfbc3;});}return null;};}function removeEntity(_0x27abcc,_0x242eb5){return function(_0x492fff){if(_0x492fff){return _0x492fff[_0x1600('0x25')]()[_0x1600('0x24')](function(){var _0x21d69e=_0x492fff[_0x1600('0x26')]({'plain':!![]});var _0x2ef778=_0x1600('0x27');return db[_0x1600('0x28')][_0x1600('0x25')]({'where':{'type':_0x2ef778,'resourceId':_0x21d69e['id']}})[_0x1600('0x24')](function(){return _0x492fff;});})[_0x1600('0x24')](function(){_0x27abcc[_0x1600('0x1a')](0xcc)[_0x1600('0x19')]();});}};}function handleEntityNotFound(_0xe9c3c7,_0x350141){return function(_0x79fd06){if(!_0x79fd06){_0xe9c3c7[_0x1600('0x18')](0x194);}return _0x79fd06;};}function handleError(_0x53f838,_0x5a18b7){_0x5a18b7=_0x5a18b7||0x1f4;return function(_0x11b8d5){logger['error'](_0x11b8d5[_0x1600('0x29')]);if(_0x11b8d5[_0x1600('0x2a')]){delete _0x11b8d5[_0x1600('0x2a')];}_0x53f838[_0x1600('0x1a')](_0x5a18b7)[_0x1600('0x2b')](_0x11b8d5);};}exports[_0x1600('0x2c')]=function(_0x48be97,_0x41bc14){var _0x3fa606={},_0x184514={},_0x57a177={'count':0x0,'rows':[]};var _0x54fa10=_['map'](db[_0x1600('0x2d')][_0x1600('0x2e')],function(_0x4dd608){return{'name':_0x4dd608[_0x1600('0x2f')],'type':_0x4dd608['type'][_0x1600('0x30')]};});_0x184514[_0x1600('0x31')]=_['map'](_0x54fa10,'name');_0x184514[_0x1600('0x32')]=_[_0x1600('0x33')](_0x48be97['query']);_0x184514[_0x1600('0x34')]=_[_0x1600('0x35')](_0x184514[_0x1600('0x31')],_0x184514['query']);_0x3fa606['attributes']=_[_0x1600('0x35')](_0x184514['model'],qs[_0x1600('0x36')](_0x48be97[_0x1600('0x32')]['fields']));_0x3fa606[_0x1600('0x37')]=_0x3fa606[_0x1600('0x37')][_0x1600('0x38')]?_0x3fa606[_0x1600('0x37')]:_0x184514[_0x1600('0x31')];if(!_0x48be97['query'][_0x1600('0x39')]('nolimit')){_0x3fa606[_0x1600('0x1d')]=qs['limit'](_0x48be97['query'][_0x1600('0x1d')]);_0x3fa606[_0x1600('0x1f')]=qs['offset'](_0x48be97[_0x1600('0x32')][_0x1600('0x1f')]);}_0x3fa606[_0x1600('0x3a')]=qs['sort'](_0x48be97[_0x1600('0x32')]['sort']);_0x3fa606['where']=qs[_0x1600('0x34')](_[_0x1600('0x3b')](_0x48be97[_0x1600('0x32')],_0x184514[_0x1600('0x34')]),_0x54fa10);if(_0x48be97[_0x1600('0x32')][_0x1600('0x3c')]){_0x3fa606[_0x1600('0x3d')]=_['merge'](_0x3fa606['where'],{'$or':_['map'](_0x54fa10,function(_0x22b928){if(_0x22b928[_0x1600('0x3e')]!==_0x1600('0x3f')){var _0xb60027={};_0xb60027[_0x22b928['name']]={'$like':'%'+_0x48be97[_0x1600('0x32')][_0x1600('0x3c')]+'%'};return _0xb60027;}})});}_0x3fa606=_[_0x1600('0x40')]({},_0x3fa606,_0x48be97['options']);var _0xb77969={'where':_0x3fa606[_0x1600('0x3d')]};return db[_0x1600('0x2d')][_0x1600('0x1e')](_0xb77969)[_0x1600('0x24')](function(_0x1eb8e7){_0x57a177[_0x1600('0x1e')]=_0x1eb8e7;if(_0x48be97[_0x1600('0x32')]['includeAll']){_0x3fa606[_0x1600('0x41')]=[{'all':!![]}];}return db[_0x1600('0x2d')][_0x1600('0x42')](_0x3fa606);})[_0x1600('0x24')](function(_0x572ed4){_0x57a177[_0x1600('0x43')]=_0x572ed4;return _0x57a177;})[_0x1600('0x24')](respondWithFilteredResult(_0x41bc14,_0x3fa606))[_0x1600('0x44')](handleError(_0x41bc14,null));};exports[_0x1600('0x45')]=function(_0xb3cf50,_0x44f3e7){var _0x4f3132={'raw':!![],'where':{'id':_0xb3cf50[_0x1600('0x46')]['id']}},_0x12b023={};_0x12b023[_0x1600('0x31')]=_[_0x1600('0x33')](db[_0x1600('0x2d')][_0x1600('0x2e')]);_0x12b023[_0x1600('0x32')]=_['keys'](_0xb3cf50['query']);_0x12b023['filters']=_[_0x1600('0x35')](_0x12b023[_0x1600('0x31')],_0x12b023[_0x1600('0x32')]);_0x4f3132[_0x1600('0x37')]=_[_0x1600('0x35')](_0x12b023['model'],qs[_0x1600('0x36')](_0xb3cf50[_0x1600('0x32')][_0x1600('0x36')]));_0x4f3132[_0x1600('0x37')]=_0x4f3132[_0x1600('0x37')][_0x1600('0x38')]?_0x4f3132[_0x1600('0x37')]:_0x12b023[_0x1600('0x31')];if(_0xb3cf50[_0x1600('0x32')][_0x1600('0x47')]){_0x4f3132[_0x1600('0x41')]=[{'all':!![]}];}_0x4f3132=_[_0x1600('0x40')]({},_0x4f3132,_0xb3cf50['options']);return db[_0x1600('0x2d')][_0x1600('0x48')](_0x4f3132)[_0x1600('0x24')](handleEntityNotFound(_0x44f3e7,null))[_0x1600('0x24')](respondWithResult(_0x44f3e7,null))[_0x1600('0x44')](handleError(_0x44f3e7,null));};exports[_0x1600('0x49')]=function(_0xbe9d4,_0x1d6aa0,_0x38b631){return db[_0x1600('0x2d')][_0x1600('0x48')]({'where':{'id':_0xbe9d4['params']['id']},'attributes':[_0x1600('0x2a'),_0x1600('0x4a'),'converted_format'],'raw':!![]})[_0x1600('0x24')](handleEntityNotFound(_0x1d6aa0,null))['then'](function(_0x4d3013){if(_0x4d3013){if(!fs[_0x1600('0x4b')](path[_0x1600('0x4c')](config[_0x1600('0x4d')],'server/files/sounds/converted',_0x4d3013[_0x1600('0x4a')]+'.'+_0x4d3013['converted_format']))){throw new db[(_0x1600('0x4e'))]['ValidationError']('Sound\x20not\x20found');}return _0x1d6aa0[_0x1600('0x49')](path[_0x1600('0x4c')](config[_0x1600('0x4d')],_0x1600('0x4f'),util['format'](_0x1600('0x50'),_0x4d3013[_0x1600('0x4a')],_0x4d3013[_0x1600('0x51')])),util[_0x1600('0x52')]('%s.%s',_0x4d3013[_0x1600('0x2a')],_0x4d3013[_0x1600('0x51')]));}return null;})[_0x1600('0x44')](handleError(_0x1d6aa0,null));};exports['create']=function(_0x19ce39,_0x1fa292,_0x2b1677){var _0x24861e={'name':path[_0x1600('0x53')](_0x19ce39[_0x1600('0x54')][_0x1600('0x55')],path[_0x1600('0x56')](_0x19ce39[_0x1600('0x54')][_0x1600('0x55')])),'save_name':path[_0x1600('0x53')](_0x19ce39[_0x1600('0x54')][_0x1600('0x57')],path[_0x1600('0x56')](_0x19ce39[_0x1600('0x54')]['filename'])),'original_format':path[_0x1600('0x56')](_0x19ce39[_0x1600('0x54')][_0x1600('0x55')])[_0x1600('0x58')](0x1),'converted_format':_0x1600('0x59')};var _0x276502=path[_0x1600('0x4c')](config['root'],'server/files/sounds/original',_0x19ce39[_0x1600('0x54')][_0x1600('0x57')]);var _0x473c17=path[_0x1600('0x4c')](config[_0x1600('0x4d')],_0x1600('0x4f'),util[_0x1600('0x52')](_0x1600('0x50'),path[_0x1600('0x53')](_0x19ce39[_0x1600('0x54')][_0x1600('0x57')],path[_0x1600('0x56')](_0x19ce39[_0x1600('0x54')][_0x1600('0x57')])),_0x24861e[_0x1600('0x51')]));logger[_0x1600('0x5a')](_0x1600('0x5b'),_0x276502);logger[_0x1600('0x5a')](_0x1600('0x5c'),_0x473c17);try{fs[_0x1600('0x5d')](_0x276502,parseInt(_0x1600('0x5e'),0x8));var _0x32fd0f=sox[_0x1600('0x5f')](_0x276502,_0x473c17,{'sampleRate':0x1f40,'format':_0x1600('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x32fd0f['on']('error',function(_0x926de3){fs['unlinkSync'](_0x276502);_0x1fa292['status'](0x1f4)[_0x1600('0x2b')](_0x926de3);});_0x32fd0f['on'](_0x1600('0x60'),function(_0x52f891){_0x24861e[_0x1600('0x61')]=isNaN(_0x52f891[_0x1600('0x62')])?null:_0x52f891[_0x1600('0x62')]*0x3e8;_0x24861e[_0x1600('0x63')]=isNaN(_0x52f891[_0x1600('0x64')])?null:_0x52f891[_0x1600('0x64')];_0x24861e[_0x1600('0x65')]=isNaN(_0x52f891[_0x1600('0x66')])?null:_0x52f891[_0x1600('0x66')];_0x24861e['original_bitRate']=isNaN(_0x52f891['bitRate'])?null:_0x52f891[_0x1600('0x67')];_0x24861e[_0x1600('0x68')]=isNaN(_0x52f891[_0x1600('0x69')])?null:_0x52f891['sampleRate'];});_0x32fd0f['on'](_0x1600('0x6a'),function(_0x1cbd2c){_0x24861e['converted_duration']=isNaN(_0x1cbd2c[_0x1600('0x62')])?null:_0x1cbd2c[_0x1600('0x62')]*0x3e8;_0x24861e[_0x1600('0x6b')]=isNaN(_0x1cbd2c[_0x1600('0x64')])?null:_0x1cbd2c['sampleCount'];_0x24861e[_0x1600('0x6c')]=isNaN(_0x1cbd2c[_0x1600('0x66')])?null:_0x1cbd2c['channelCount'];_0x24861e[_0x1600('0x6d')]=isNaN(_0x1cbd2c[_0x1600('0x67')])?null:_0x1cbd2c['bitRate'];_0x24861e[_0x1600('0x6e')]=isNaN(_0x1cbd2c[_0x1600('0x69')])?null:_0x1cbd2c[_0x1600('0x69')];});_0x32fd0f['on'](_0x1600('0x19'),function(){fs[_0x1600('0x5d')](_0x473c17,parseInt('0777',0x8));return db['Sound'][_0x1600('0x6f')](_0x24861e)[_0x1600('0x24')](function(_0x3619d1){var _0x1e12dd={'role':_0x19ce39[_0x1600('0x70')][_0x1600('0x71')],'userProfileId':_0x19ce39['body'][_0x1600('0x72')]};if(!_0x1e12dd)throw new Error(_0x1600('0x73'));if(_0x1e12dd[_0x1600('0x71')]===_0x1600('0x74')){var _0x50934a=_0x3619d1[_0x1600('0x26')]({'plain':!![]});return db[_0x1600('0x75')]['find']({'where':{'name':_0x1600('0x27'),'userProfileId':_0x1e12dd[_0x1600('0x72')]},'raw':!![]})[_0x1600('0x24')](function(_0x56c1d8){if(_0x56c1d8&&_0x56c1d8[_0x1600('0x76')]===0x0){return db[_0x1600('0x28')][_0x1600('0x6f')]({'name':_0x50934a[_0x1600('0x2a')],'resourceId':_0x50934a['id'],'type':_0x56c1d8[_0x1600('0x2a')],'sectionId':_0x56c1d8['id']},{})['then'](function(){return _0x3619d1;});}else{return _0x3619d1;}})[_0x1600('0x44')](function(_0x1631d0){logger[_0x1600('0x77')](_0x1600('0x78'),_0x1631d0);throw _0x1631d0;});}return _0x3619d1;})[_0x1600('0x24')](respondWithResult(_0x1fa292,null))[_0x1600('0x44')](handleError(_0x1fa292,null));});_0x32fd0f[_0x1600('0x79')]();}catch(_0x2775dd){_0x1fa292[_0x1600('0x1a')](0x1f4)[_0x1600('0x2b')](_0x2775dd);}};exports[_0x1600('0x23')]=function(_0xccf528,_0x5f4be8,_0x2d527e){return db[_0x1600('0x2d')]['find']({'where':{'id':_0xccf528[_0x1600('0x46')]['id']}})[_0x1600('0x24')](handleEntityNotFound(_0x5f4be8,null))[_0x1600('0x24')](saveUpdates(_[_0x1600('0x3b')](_0xccf528[_0x1600('0x70')],[_0x1600('0x2a'),_0x1600('0x7a')]),null))['then'](respondWithResult(_0x5f4be8,null))[_0x1600('0x44')](handleError(_0x5f4be8,null));};exports[_0x1600('0x7b')]=function(_0x23ee8a,_0x5b0413,_0x559b26){return db['Sound']['find']({'where':{'id':_0x23ee8a[_0x1600('0x46')]['id']}})['then'](function(_0x8f823d){if(_0x8f823d){return _0x8f823d[_0x1600('0x25')]();}})[_0x1600('0x24')](function(_0x222b9b){var _0x1d0d82=path['join'](config[_0x1600('0x4d')],_0x1600('0x7c'),util['format'](_0x1600('0x50'),_0x222b9b[_0x1600('0x4a')],_0x222b9b[_0x1600('0x7d')]));var _0x4c6f59=path[_0x1600('0x4c')](config[_0x1600('0x4d')],_0x1600('0x4f'),util[_0x1600('0x52')](_0x1600('0x50'),_0x222b9b['save_name'],_0x222b9b[_0x1600('0x51')]));fs[_0x1600('0x7e')](_0x1d0d82);fs[_0x1600('0x7e')](_0x4c6f59);return _0x222b9b;})['then'](function(_0x551ac7){if(_0x551ac7){return _0x5b0413[_0x1600('0x1a')](0xcc)[_0x1600('0x19')]();}})[_0x1600('0x24')](handleEntityNotFound(_0x5b0413,null))[_0x1600('0x44')](handleError(_0x5b0413,null));}; \ No newline at end of file +var _0x31c2=['user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','apply','reject','save','update','then','destroy','get','Sounds','error','stack','name','send','map','Sound','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','params','length','options','find','download','converted_format','join','root','server/files/sounds/converted','save_name','ValidationError','Sound\x20not\x20found','format','%s.%s','catch','basename','file','originalname','extname','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','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_bitRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x31c2,0x104));var _0x231c=function(_0x1c36f3,_0x41b7b2){_0x1c36f3=_0x1c36f3-0x0;var _0x506374=_0x31c2[_0x1c36f3];return _0x506374;};'use strict';var emlformat=require(_0x231c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x231c('0x1'));var jsonpatch=require(_0x231c('0x2'));var rp=require(_0x231c('0x3'));var moment=require(_0x231c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x231c('0x5'));var util=require(_0x231c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x231c('0x7'));var ejs=require(_0x231c('0x8'));var fs=require('fs');var fs_extra=require(_0x231c('0x9'));var _=require(_0x231c('0xa'));var squel=require(_0x231c('0xb'));var crypto=require(_0x231c('0xc'));var jsforce=require(_0x231c('0xd'));var deskjs=require(_0x231c('0xe'));var toCsv=require(_0x231c('0x7'));var querystring=require('querystring');var Papa=require(_0x231c('0xf'));var Redis=require(_0x231c('0x10'));var authService=require(_0x231c('0x11'));var qs=require(_0x231c('0x12'));var as=require(_0x231c('0x13'));var hardwareService=require(_0x231c('0x14'));var logger=require(_0x231c('0x15'))(_0x231c('0x16'));var utils=require('../../config/utils');var config=require(_0x231c('0x17'));var licenseUtil=require(_0x231c('0x18'));var db=require(_0x231c('0x19'))['db'];function respondWithStatusCode(_0x40c2ef,_0x4a848f){_0x4a848f=_0x4a848f||0xcc;return function(_0x16ea92){if(_0x16ea92){return _0x40c2ef[_0x231c('0x1a')](_0x4a848f);}return _0x40c2ef[_0x231c('0x1b')](_0x4a848f)[_0x231c('0x1c')]();};}function respondWithResult(_0x395f46,_0x237265){_0x237265=_0x237265||0xc8;return function(_0x35d159){if(_0x35d159){return _0x395f46[_0x231c('0x1b')](_0x237265)[_0x231c('0x1d')](_0x35d159);}};}function respondWithFilteredResult(_0x4946ef,_0x12dded){return function(_0x2fe4cf){if(_0x2fe4cf){var _0x300d37=typeof _0x12dded['offset']===_0x231c('0x1e')&&typeof _0x12dded[_0x231c('0x1f')]===_0x231c('0x1e');var _0x1dd2ae=_0x2fe4cf['count'];var _0x4667e6=_0x300d37?0x0:_0x12dded[_0x231c('0x20')];var _0x1f7dd3=_0x300d37?_0x2fe4cf[_0x231c('0x21')]:_0x12dded[_0x231c('0x20')]+_0x12dded[_0x231c('0x1f')];var _0x2c9289;if(_0x1f7dd3>=_0x1dd2ae){_0x1f7dd3=_0x1dd2ae;_0x2c9289=0xc8;}else{_0x2c9289=0xce;}_0x4946ef['status'](_0x2c9289);return _0x4946ef['set']('Content-Range',_0x4667e6+'-'+_0x1f7dd3+'/'+_0x1dd2ae)[_0x231c('0x1d')](_0x2fe4cf);}return null;};}function patchUpdates(_0x497050){return function(_0x1082b6){try{jsonpatch[_0x231c('0x22')](_0x1082b6,_0x497050,!![]);}catch(_0x1975fa){return BPromise[_0x231c('0x23')](_0x1975fa);}return _0x1082b6[_0x231c('0x24')]();};}function saveUpdates(_0x17eb2a,_0x26b9ff){return function(_0x26ebd5){if(_0x26ebd5){return _0x26ebd5[_0x231c('0x25')](_0x17eb2a)[_0x231c('0x26')](function(_0x45cdd4){return _0x45cdd4;});}return null;};}function removeEntity(_0x499f71,_0x3760a5){return function(_0x5036ff){if(_0x5036ff){return _0x5036ff[_0x231c('0x27')]()['then'](function(){var _0xaf7080=_0x5036ff[_0x231c('0x28')]({'plain':!![]});var _0x5d4dbe=_0x231c('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x5d4dbe,'resourceId':_0xaf7080['id']}})[_0x231c('0x26')](function(){return _0x5036ff;});})[_0x231c('0x26')](function(){_0x499f71[_0x231c('0x1b')](0xcc)[_0x231c('0x1c')]();});}};}function handleEntityNotFound(_0x94e048,_0x31a340){return function(_0x690d87){if(!_0x690d87){_0x94e048[_0x231c('0x1a')](0x194);}return _0x690d87;};}function handleError(_0x1a5e50,_0xd99403){_0xd99403=_0xd99403||0x1f4;return function(_0xfb9ccf){logger[_0x231c('0x2a')](_0xfb9ccf[_0x231c('0x2b')]);if(_0xfb9ccf[_0x231c('0x2c')]){delete _0xfb9ccf[_0x231c('0x2c')];}_0x1a5e50[_0x231c('0x1b')](_0xd99403)[_0x231c('0x2d')](_0xfb9ccf);};}exports['index']=function(_0x18eed9,_0xf15ad7){var _0x271f68={},_0x4ccb99={},_0x42fe75={'count':0x0,'rows':[]};var _0x1b7352=_[_0x231c('0x2e')](db[_0x231c('0x2f')]['rawAttributes'],function(_0x20eeb5){return{'name':_0x20eeb5['fieldName'],'type':_0x20eeb5[_0x231c('0x30')][_0x231c('0x31')]};});_0x4ccb99[_0x231c('0x32')]=_[_0x231c('0x2e')](_0x1b7352,'name');_0x4ccb99[_0x231c('0x33')]=_[_0x231c('0x34')](_0x18eed9[_0x231c('0x33')]);_0x4ccb99[_0x231c('0x35')]=_[_0x231c('0x36')](_0x4ccb99[_0x231c('0x32')],_0x4ccb99[_0x231c('0x33')]);_0x271f68[_0x231c('0x37')]=_[_0x231c('0x36')](_0x4ccb99[_0x231c('0x32')],qs[_0x231c('0x38')](_0x18eed9[_0x231c('0x33')][_0x231c('0x38')]));_0x271f68['attributes']=_0x271f68[_0x231c('0x37')]['length']?_0x271f68[_0x231c('0x37')]:_0x4ccb99[_0x231c('0x32')];if(!_0x18eed9[_0x231c('0x33')][_0x231c('0x39')]('nolimit')){_0x271f68[_0x231c('0x1f')]=qs[_0x231c('0x1f')](_0x18eed9[_0x231c('0x33')][_0x231c('0x1f')]);_0x271f68[_0x231c('0x20')]=qs[_0x231c('0x20')](_0x18eed9[_0x231c('0x33')][_0x231c('0x20')]);}_0x271f68[_0x231c('0x3a')]=qs['sort'](_0x18eed9[_0x231c('0x33')][_0x231c('0x3b')]);_0x271f68[_0x231c('0x3c')]=qs[_0x231c('0x35')](_['pick'](_0x18eed9[_0x231c('0x33')],_0x4ccb99[_0x231c('0x35')]),_0x1b7352);if(_0x18eed9['query']['filter']){_0x271f68[_0x231c('0x3c')]=_['merge'](_0x271f68[_0x231c('0x3c')],{'$or':_['map'](_0x1b7352,function(_0x124dcd){if(_0x124dcd[_0x231c('0x30')]!==_0x231c('0x3d')){var _0x1d495f={};_0x1d495f[_0x124dcd[_0x231c('0x2c')]]={'$like':'%'+_0x18eed9['query'][_0x231c('0x3e')]+'%'};return _0x1d495f;}})});}_0x271f68=_[_0x231c('0x3f')]({},_0x271f68,_0x18eed9['options']);var _0x33f5e6={'where':_0x271f68['where']};return db[_0x231c('0x2f')][_0x231c('0x21')](_0x33f5e6)[_0x231c('0x26')](function(_0x4dafca){_0x42fe75[_0x231c('0x21')]=_0x4dafca;if(_0x18eed9[_0x231c('0x33')][_0x231c('0x40')]){_0x271f68[_0x231c('0x41')]=[{'all':!![]}];}return db[_0x231c('0x2f')][_0x231c('0x42')](_0x271f68);})[_0x231c('0x26')](function(_0x2138b0){_0x42fe75[_0x231c('0x43')]=_0x2138b0;return _0x42fe75;})[_0x231c('0x26')](respondWithFilteredResult(_0xf15ad7,_0x271f68))['catch'](handleError(_0xf15ad7,null));};exports['show']=function(_0x1b130a,_0x556ef5){var _0xd7139={'raw':!![],'where':{'id':_0x1b130a[_0x231c('0x44')]['id']}},_0x2e7875={};_0x2e7875[_0x231c('0x32')]=_['keys'](db['Sound']['rawAttributes']);_0x2e7875[_0x231c('0x33')]=_[_0x231c('0x34')](_0x1b130a[_0x231c('0x33')]);_0x2e7875[_0x231c('0x35')]=_[_0x231c('0x36')](_0x2e7875[_0x231c('0x32')],_0x2e7875[_0x231c('0x33')]);_0xd7139[_0x231c('0x37')]=_[_0x231c('0x36')](_0x2e7875[_0x231c('0x32')],qs[_0x231c('0x38')](_0x1b130a[_0x231c('0x33')][_0x231c('0x38')]));_0xd7139[_0x231c('0x37')]=_0xd7139[_0x231c('0x37')][_0x231c('0x45')]?_0xd7139[_0x231c('0x37')]:_0x2e7875[_0x231c('0x32')];if(_0x1b130a[_0x231c('0x33')][_0x231c('0x40')]){_0xd7139[_0x231c('0x41')]=[{'all':!![]}];}_0xd7139=_['merge']({},_0xd7139,_0x1b130a[_0x231c('0x46')]);return db[_0x231c('0x2f')][_0x231c('0x47')](_0xd7139)['then'](handleEntityNotFound(_0x556ef5,null))[_0x231c('0x26')](respondWithResult(_0x556ef5,null))['catch'](handleError(_0x556ef5,null));};exports[_0x231c('0x48')]=function(_0x2f3b24,_0x54b7cc,_0x1bb577){return db['Sound'][_0x231c('0x47')]({'where':{'id':_0x2f3b24[_0x231c('0x44')]['id']},'attributes':[_0x231c('0x2c'),'save_name',_0x231c('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x54b7cc,null))[_0x231c('0x26')](function(_0x2ae398){if(_0x2ae398){if(!fs['existsSync'](path[_0x231c('0x4a')](config[_0x231c('0x4b')],_0x231c('0x4c'),_0x2ae398[_0x231c('0x4d')]+'.'+_0x2ae398['converted_format']))){throw new db['Sequelize'][(_0x231c('0x4e'))](_0x231c('0x4f'));}return _0x54b7cc[_0x231c('0x48')](path[_0x231c('0x4a')](config[_0x231c('0x4b')],_0x231c('0x4c'),util[_0x231c('0x50')](_0x231c('0x51'),_0x2ae398[_0x231c('0x4d')],_0x2ae398[_0x231c('0x49')])),util['format'](_0x231c('0x51'),_0x2ae398['name'],_0x2ae398['converted_format']));}return null;})[_0x231c('0x52')](handleError(_0x54b7cc,null));};exports['create']=function(_0x5573da,_0x47ab9b,_0x117613){var _0x42a1c0={'name':path[_0x231c('0x53')](_0x5573da[_0x231c('0x54')][_0x231c('0x55')],path[_0x231c('0x56')](_0x5573da[_0x231c('0x54')]['originalname'])),'save_name':path[_0x231c('0x53')](_0x5573da[_0x231c('0x54')][_0x231c('0x57')],path[_0x231c('0x56')](_0x5573da[_0x231c('0x54')][_0x231c('0x57')])),'original_format':path[_0x231c('0x56')](_0x5573da[_0x231c('0x54')][_0x231c('0x55')])[_0x231c('0x58')](0x1),'converted_format':_0x231c('0x59')};var _0x126b96=path['join'](config['root'],_0x231c('0x5a'),_0x5573da[_0x231c('0x54')][_0x231c('0x57')]);var _0x20a32a=path[_0x231c('0x4a')](config['root'],_0x231c('0x4c'),util['format'](_0x231c('0x51'),path['basename'](_0x5573da['file'][_0x231c('0x57')],path[_0x231c('0x56')](_0x5573da[_0x231c('0x54')][_0x231c('0x57')])),_0x42a1c0[_0x231c('0x49')]));logger[_0x231c('0x5b')](_0x231c('0x5c'),_0x126b96);logger[_0x231c('0x5b')](_0x231c('0x5d'),_0x20a32a);try{fs[_0x231c('0x5e')](_0x126b96,parseInt(_0x231c('0x5f'),0x8));var _0x1ee28f=sox[_0x231c('0x60')](_0x126b96,_0x20a32a,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1ee28f['on'](_0x231c('0x2a'),function(_0x109a78){fs[_0x231c('0x61')](_0x126b96);_0x47ab9b['status'](0x1f4)[_0x231c('0x2d')](_0x109a78);});_0x1ee28f['on'](_0x231c('0x62'),function(_0x1cf8a8){_0x42a1c0[_0x231c('0x63')]=isNaN(_0x1cf8a8[_0x231c('0x64')])?null:_0x1cf8a8[_0x231c('0x64')]*0x3e8;_0x42a1c0['original_sampleCount']=isNaN(_0x1cf8a8[_0x231c('0x65')])?null:_0x1cf8a8[_0x231c('0x65')];_0x42a1c0['original_channelCount']=isNaN(_0x1cf8a8[_0x231c('0x66')])?null:_0x1cf8a8[_0x231c('0x66')];_0x42a1c0[_0x231c('0x67')]=isNaN(_0x1cf8a8[_0x231c('0x68')])?null:_0x1cf8a8[_0x231c('0x68')];_0x42a1c0[_0x231c('0x69')]=isNaN(_0x1cf8a8['sampleRate'])?null:_0x1cf8a8[_0x231c('0x6a')];});_0x1ee28f['on'](_0x231c('0x6b'),function(_0x9a0230){_0x42a1c0['converted_duration']=isNaN(_0x9a0230[_0x231c('0x64')])?null:_0x9a0230[_0x231c('0x64')]*0x3e8;_0x42a1c0[_0x231c('0x6c')]=isNaN(_0x9a0230['sampleCount'])?null:_0x9a0230[_0x231c('0x65')];_0x42a1c0['converted_channelCount']=isNaN(_0x9a0230['channelCount'])?null:_0x9a0230['channelCount'];_0x42a1c0[_0x231c('0x6d')]=isNaN(_0x9a0230[_0x231c('0x68')])?null:_0x9a0230[_0x231c('0x68')];_0x42a1c0['converted_sampleRate']=isNaN(_0x9a0230[_0x231c('0x6a')])?null:_0x9a0230[_0x231c('0x6a')];});_0x1ee28f['on'](_0x231c('0x1c'),function(){fs[_0x231c('0x5e')](_0x20a32a,parseInt('0777',0x8));return db[_0x231c('0x2f')][_0x231c('0x6e')](_0x42a1c0)['then'](function(_0x3e4cd7){var _0x3a56b2={'role':_0x5573da[_0x231c('0x6f')][_0x231c('0x70')],'userProfileId':_0x5573da[_0x231c('0x6f')][_0x231c('0x71')]};if(!_0x3a56b2)throw new Error(_0x231c('0x72'));if(_0x3a56b2[_0x231c('0x70')]===_0x231c('0x73')){var _0x2cf433=_0x3e4cd7['get']({'plain':!![]});return db[_0x231c('0x74')]['find']({'where':{'name':_0x231c('0x29'),'userProfileId':_0x3a56b2[_0x231c('0x71')]},'raw':!![]})[_0x231c('0x26')](function(_0x581cc5){if(_0x581cc5&&_0x581cc5[_0x231c('0x75')]===0x0){return db[_0x231c('0x76')]['create']({'name':_0x2cf433[_0x231c('0x2c')],'resourceId':_0x2cf433['id'],'type':_0x581cc5[_0x231c('0x2c')],'sectionId':_0x581cc5['id']},{})[_0x231c('0x26')](function(){return _0x3e4cd7;});}else{return _0x3e4cd7;}})[_0x231c('0x52')](function(_0x1ae803){logger['error'](_0x231c('0x77'),_0x1ae803);throw _0x1ae803;});}return _0x3e4cd7;})[_0x231c('0x26')](respondWithResult(_0x47ab9b,null))[_0x231c('0x52')](handleError(_0x47ab9b,null));});_0x1ee28f[_0x231c('0x78')]();}catch(_0x19e54c){_0x47ab9b[_0x231c('0x1b')](0x1f4)[_0x231c('0x2d')](_0x19e54c);}};exports[_0x231c('0x25')]=function(_0x1d1747,_0x51ee6d,_0x4a5bf7){return db[_0x231c('0x2f')][_0x231c('0x47')]({'where':{'id':_0x1d1747[_0x231c('0x44')]['id']}})[_0x231c('0x26')](handleEntityNotFound(_0x51ee6d,null))[_0x231c('0x26')](saveUpdates(_[_0x231c('0x79')](_0x1d1747[_0x231c('0x6f')],['name',_0x231c('0x7a')]),null))['then'](respondWithResult(_0x51ee6d,null))[_0x231c('0x52')](handleError(_0x51ee6d,null));};exports[_0x231c('0x7b')]=function(_0x196e34,_0x4e9b04,_0x46386b){return db[_0x231c('0x2f')][_0x231c('0x47')]({'where':{'id':_0x196e34[_0x231c('0x44')]['id']}})[_0x231c('0x26')](function(_0x2c29c2){if(_0x2c29c2){return _0x2c29c2[_0x231c('0x27')]();}})[_0x231c('0x26')](function(_0x1219bf){var _0x2a5ace=path['join'](config[_0x231c('0x4b')],_0x231c('0x5a'),util[_0x231c('0x50')](_0x231c('0x51'),_0x1219bf[_0x231c('0x4d')],_0x1219bf[_0x231c('0x7c')]));var _0x5b063f=path[_0x231c('0x4a')](config['root'],_0x231c('0x4c'),util[_0x231c('0x50')](_0x231c('0x51'),_0x1219bf[_0x231c('0x4d')],_0x1219bf[_0x231c('0x49')]));fs['unlinkSync'](_0x2a5ace);fs[_0x231c('0x61')](_0x5b063f);return _0x1219bf;})[_0x231c('0x26')](function(_0x530be0){if(_0x530be0){return _0x4e9b04[_0x231c('0x1b')](0xcc)[_0x231c('0x1c')]();}})[_0x231c('0x26')](handleEntityNotFound(_0x4e9b04,null))[_0x231c('0x52')](handleError(_0x4e9b04,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 6fe0fd3..ce37338 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 _0x1a06=['Sound','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','define'];(function(_0xfc9612,_0x18dd95){var _0x106e9c=function(_0xf8de28){while(--_0xf8de28){_0xfc9612['push'](_0xfc9612['shift']());}};_0x106e9c(++_0x18dd95);}(_0x1a06,0x1a3));var _0x61a0=function(_0x540c52,_0xd36f7d){_0x540c52=_0x540c52-0x0;var _0x2fe5a1=_0x1a06[_0x540c52];return _0x2fe5a1;};'use strict';var _=require(_0x61a0('0x0'));var util=require('util');var logger=require(_0x61a0('0x1'))(_0x61a0('0x2'));var moment=require(_0x61a0('0x3'));var BPromise=require(_0x61a0('0x4'));var rp=require(_0x61a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61a0('0x6'));var config=require(_0x61a0('0x7'));var attributes=require(_0x61a0('0x8'));module['exports']=function(_0x3cbf40,_0xd9877e){return _0x3cbf40[_0x61a0('0x9')](_0x61a0('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57a9=['request-promise','path','rimraf','./sound.attributes','exports','Sound','util','../../config/logger','moment','bluebird'];(function(_0x81f06d,_0x1b35c5){var _0xa6987d=function(_0x333073){while(--_0x333073){_0x81f06d['push'](_0x81f06d['shift']());}};_0xa6987d(++_0x1b35c5);}(_0x57a9,0x9c));var _0x957a=function(_0x166ce5,_0x5c297b){_0x166ce5=_0x166ce5-0x0;var _0x1296fb=_0x57a9[_0x166ce5];return _0x1296fb;};'use strict';var _=require('lodash');var util=require(_0x957a('0x0'));var logger=require(_0x957a('0x1'))('api');var moment=require(_0x957a('0x2'));var BPromise=require(_0x957a('0x3'));var rp=require(_0x957a('0x4'));var fs=require('fs');var path=require(_0x957a('0x5'));var rimraf=require(_0x957a('0x6'));var config=require('../../config/environment');var attributes=require(_0x957a('0x7'));module[_0x957a('0x8')]=function(_0x44aba3,_0x5610e9){return _0x44aba3['define'](_0x957a('0x9'),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 2c6ce9a..1ccd825 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 _0xa995=['http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Sound,\x20%s,\x20%s','result','ShowSound','Sound','find','options','where','include','model','attributes','map','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x117ad0,_0x395fee){var _0x20f1b7=function(_0x4120d3){while(--_0x4120d3){_0x117ad0['push'](_0x117ad0['shift']());}};_0x20f1b7(++_0x395fee);}(_0xa995,0x1d1));var _0x5a99=function(_0xa9a519,_0x33438d){_0xa9a519=_0xa9a519-0x0;var _0x132598=_0xa995[_0xa9a519];return _0x132598;};'use strict';var _=require(_0x5a99('0x0'));var util=require(_0x5a99('0x1'));var moment=require(_0x5a99('0x2'));var BPromise=require(_0x5a99('0x3'));var rs=require(_0x5a99('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a99('0x5'))['db'];var utils=require(_0x5a99('0x6'));var logger=require(_0x5a99('0x7'))(_0x5a99('0x8'));var config=require('../../config/environment');var jayson=require(_0x5a99('0x9'));var client=jayson[_0x5a99('0xa')][_0x5a99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56dd09,_0x33e85d,_0x410fb9){return new BPromise(function(_0x5cec4b,_0x49676d){return client[_0x5a99('0xc')](_0x56dd09,_0x410fb9)[_0x5a99('0xd')](function(_0x533222){logger[_0x5a99('0xe')]('Sound,\x20%s,\x20%s',_0x33e85d,_0x5a99('0xf'));logger[_0x5a99('0x10')](_0x5a99('0x11'),_0x33e85d,_0x5a99('0xf'),JSON[_0x5a99('0x12')](_0x533222));if(_0x533222[_0x5a99('0x13')]){if(_0x533222[_0x5a99('0x13')][_0x5a99('0x14')]===0x1f4){logger[_0x5a99('0x13')]('Sound,\x20%s,\x20%s',_0x33e85d,_0x533222[_0x5a99('0x13')][_0x5a99('0x15')]);return _0x49676d(_0x533222[_0x5a99('0x13')][_0x5a99('0x15')]);}logger[_0x5a99('0x13')](_0x5a99('0x16'),_0x33e85d,_0x533222[_0x5a99('0x13')][_0x5a99('0x15')]);return _0x5cec4b(_0x533222['error'][_0x5a99('0x15')]);}else{logger['info'](_0x5a99('0x16'),_0x33e85d,_0x5a99('0xf'));_0x5cec4b(_0x533222[_0x5a99('0x17')]['message']);}})['catch'](function(_0x1fade9){logger['error']('Sound,\x20%s,\x20%s',_0x33e85d,_0x1fade9);_0x49676d(_0x1fade9);});});}exports[_0x5a99('0x18')]=function(_0xa4c5db){var _0x407256=this;return new Promise(function(_0x48e592,_0x5eb410){return db[_0x5a99('0x19')][_0x5a99('0x1a')]({'raw':_0xa4c5db[_0x5a99('0x1b')]?_0xa4c5db[_0x5a99('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xa4c5db['options']?_0xa4c5db[_0x5a99('0x1b')][_0x5a99('0x1c')]||null:null,'attributes':_0xa4c5db[_0x5a99('0x1b')]?_0xa4c5db['options']['attributes']||null:null,'include':_0xa4c5db[_0x5a99('0x1b')]?_0xa4c5db[_0x5a99('0x1b')]['include']?_['map'](_0xa4c5db[_0x5a99('0x1b')][_0x5a99('0x1d')],function(_0x4d8d2d){return{'model':db[_0x4d8d2d[_0x5a99('0x1e')]],'as':_0x4d8d2d['as'],'attributes':_0x4d8d2d[_0x5a99('0x1f')],'include':_0x4d8d2d['include']?_['map'](_0x4d8d2d[_0x5a99('0x1d')],function(_0x208cce){return{'model':db[_0x208cce['model']],'as':_0x208cce['as'],'attributes':_0x208cce[_0x5a99('0x1f')],'include':_0x208cce[_0x5a99('0x1d')]?_[_0x5a99('0x20')](_0x208cce[_0x5a99('0x1d')],function(_0x2f97bb){return{'model':db[_0x2f97bb[_0x5a99('0x1e')]],'as':_0x2f97bb['as'],'attributes':_0x2f97bb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11c084){logger[_0x5a99('0xe')](_0x5a99('0x18'),_0xa4c5db);logger[_0x5a99('0x10')](_0x5a99('0x18'),_0xa4c5db,JSON[_0x5a99('0x12')](_0x11c084));_0x48e592(_0x11c084);})[_0x5a99('0x21')](function(_0x5b9ca7){logger[_0x5a99('0x13')](_0x5a99('0x18'),_0x5b9ca7['message'],_0xa4c5db);_0x5eb410(_0x407256['error'](0x1f4,_0x5b9ca7['message']));});});}; \ No newline at end of file +var _0x6757=['model','include','debug','catch','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','ShowSound','Sound','find','options','where','attributes','map'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x6757,0x1e4));var _0x7675=function(_0x5a8eb9,_0x2c684d){_0x5a8eb9=_0x5a8eb9-0x0;var _0x1dcef3=_0x6757[_0x5a8eb9];return _0x1dcef3;};'use strict';var _=require(_0x7675('0x0'));var util=require(_0x7675('0x1'));var moment=require(_0x7675('0x2'));var BPromise=require(_0x7675('0x3'));var rs=require(_0x7675('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7675('0x5'));var config=require(_0x7675('0x6'));var jayson=require(_0x7675('0x7'));var client=jayson['client'][_0x7675('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49cbce,_0x353255,_0xbf7e4c){return new BPromise(function(_0x5a3c08,_0x487e7a){return client[_0x7675('0x9')](_0x49cbce,_0xbf7e4c)[_0x7675('0xa')](function(_0x13d71b){logger['info'](_0x7675('0xb'),_0x353255,_0x7675('0xc'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x353255,_0x7675('0xc'),JSON[_0x7675('0xd')](_0x13d71b));if(_0x13d71b[_0x7675('0xe')]){if(_0x13d71b[_0x7675('0xe')][_0x7675('0xf')]===0x1f4){logger[_0x7675('0xe')]('Sound,\x20%s,\x20%s',_0x353255,_0x13d71b[_0x7675('0xe')][_0x7675('0x10')]);return _0x487e7a(_0x13d71b[_0x7675('0xe')][_0x7675('0x10')]);}logger[_0x7675('0xe')]('Sound,\x20%s,\x20%s',_0x353255,_0x13d71b[_0x7675('0xe')][_0x7675('0x10')]);return _0x5a3c08(_0x13d71b[_0x7675('0xe')][_0x7675('0x10')]);}else{logger[_0x7675('0x11')]('Sound,\x20%s,\x20%s',_0x353255,_0x7675('0xc'));_0x5a3c08(_0x13d71b[_0x7675('0x12')][_0x7675('0x10')]);}})['catch'](function(_0x151023){logger['error'](_0x7675('0xb'),_0x353255,_0x151023);_0x487e7a(_0x151023);});});}exports[_0x7675('0x13')]=function(_0x360e27){var _0xd3b47a=this;return new Promise(function(_0x160541,_0x233270){return db[_0x7675('0x14')][_0x7675('0x15')]({'raw':_0x360e27[_0x7675('0x16')]?_0x360e27[_0x7675('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x360e27['options']?_0x360e27[_0x7675('0x16')][_0x7675('0x17')]||null:null,'attributes':_0x360e27['options']?_0x360e27[_0x7675('0x16')][_0x7675('0x18')]||null:null,'include':_0x360e27[_0x7675('0x16')]?_0x360e27[_0x7675('0x16')]['include']?_[_0x7675('0x19')](_0x360e27[_0x7675('0x16')]['include'],function(_0x492bc2){return{'model':db[_0x492bc2[_0x7675('0x1a')]],'as':_0x492bc2['as'],'attributes':_0x492bc2[_0x7675('0x18')],'include':_0x492bc2[_0x7675('0x1b')]?_[_0x7675('0x19')](_0x492bc2['include'],function(_0x3f72ae){return{'model':db[_0x3f72ae['model']],'as':_0x3f72ae['as'],'attributes':_0x3f72ae[_0x7675('0x18')],'include':_0x3f72ae[_0x7675('0x1b')]?_[_0x7675('0x19')](_0x3f72ae[_0x7675('0x1b')],function(_0x3ec1e1){return{'model':db[_0x3ec1e1[_0x7675('0x1a')]],'as':_0x3ec1e1['as'],'attributes':_0x3ec1e1[_0x7675('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7675('0xa')](function(_0x3621fc){logger[_0x7675('0x11')](_0x7675('0x13'),_0x360e27);logger[_0x7675('0x1c')](_0x7675('0x13'),_0x360e27,JSON[_0x7675('0xd')](_0x3621fc));_0x160541(_0x3621fc);})[_0x7675('0x1d')](function(_0x448631){logger[_0x7675('0xe')](_0x7675('0x13'),_0x448631[_0x7675('0x10')],_0x360e27);_0x233270(_0xd3b47a['error'](0x1f4,_0x448631[_0x7675('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index a69bba4..369cc7d 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x2d8434,_0x43d781){var _0x26b9e4=function(_0x54f5b8){while(--_0x54f5b8){_0x2d8434['push'](_0x2d8434['shift']());}};_0x26b9e4(++_0x43d781);}(_0xda3f,0xec));var _0xfda3=function(_0x54c562,_0x2449b6){_0x54c562=_0x54c562-0x0;var _0x2e8acc=_0xda3f[_0x54c562];return _0x2e8acc;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x19bb23,_0x2d028f){var _0x4a2df7=function(_0x187326){while(--_0x187326){_0x19bb23['push'](_0x19bb23['shift']());}};_0x4a2df7(++_0x2d028f);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb7e7[_0xc67528];return _0x38e26d;};'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('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 9032df4..b22d253 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 _0x5740=['sequelize','exports','STRING','medium','ENUM','out','TEXT'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x5740,0x196));var _0x0574=function(_0x273964,_0x367a32){_0x273964=_0x273964-0x0;var _0x41346a=_0x5740[_0x273964];return _0x41346a;};'use strict';var Sequelize=require(_0x0574('0x0'));module[_0x0574('0x1')]={'uniqueid':{'type':Sequelize[_0x0574('0x2')]},'body':{'type':Sequelize['TEXT'](_0x0574('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x0574('0x4')]('in',_0x0574('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x0574('0x2')]},'providerResponse':{'type':Sequelize[_0x0574('0x6')]}}; \ No newline at end of file +var _0x9765=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x58139f,_0x43bca5){var _0x52b78c=function(_0x4e78bf){while(--_0x4e78bf){_0x58139f['push'](_0x58139f['shift']());}};_0x52b78c(++_0x43bca5);}(_0x9765,0x152));var _0x5976=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9765[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x5976('0x0'));module[_0x5976('0x1')]={'uniqueid':{'type':Sequelize[_0x5976('0x2')]},'body':{'type':Sequelize[_0x5976('0x3')](_0x5976('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x5976('0x5')]('in',_0x5976('0x6')),'defaultValue':_0x5976('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x5976('0x2')]},'providerResponse':{'type':Sequelize[_0x5976('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 55c230d..b695d95 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 _0x29c1=['options','includeAll','include','rows','catch','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL'];(function(_0x278ebb,_0x5f0f3f){var _0x333dee=function(_0x558b50){while(--_0x558b50){_0x278ebb['push'](_0x278ebb['shift']());}};_0x333dee(++_0x5f0f3f);}(_0x29c1,0x1c7));var _0x129c=function(_0x1af72a,_0xe3f9f2){_0x1af72a=_0x1af72a-0x0;var _0x107ad9=_0x29c1[_0x1af72a];return _0x107ad9;};'use strict';var emlformat=require(_0x129c('0x0'));var rimraf=require(_0x129c('0x1'));var zipdir=require(_0x129c('0x2'));var jsonpatch=require(_0x129c('0x3'));var rp=require(_0x129c('0x4'));var moment=require(_0x129c('0x5'));var BPromise=require(_0x129c('0x6'));var Mustache=require(_0x129c('0x7'));var util=require(_0x129c('0x8'));var path=require(_0x129c('0x9'));var sox=require(_0x129c('0xa'));var csv=require('to-csv');var ejs=require(_0x129c('0xb'));var fs=require('fs');var fs_extra=require(_0x129c('0xc'));var _=require(_0x129c('0xd'));var squel=require(_0x129c('0xe'));var crypto=require(_0x129c('0xf'));var jsforce=require(_0x129c('0x10'));var deskjs=require(_0x129c('0x11'));var toCsv=require(_0x129c('0x12'));var querystring=require('querystring');var Papa=require(_0x129c('0x13'));var Redis=require(_0x129c('0x14'));var authService=require(_0x129c('0x15'));var qs=require(_0x129c('0x16'));var as=require(_0x129c('0x17'));var hardwareService=require(_0x129c('0x18'));var logger=require(_0x129c('0x19'))(_0x129c('0x1a'));var utils=require('../../config/utils');var config=require(_0x129c('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48f3b3,_0x56a63b){_0x56a63b=_0x56a63b||0xcc;return function(_0x24785a){if(_0x24785a){return _0x48f3b3['sendStatus'](_0x56a63b);}return _0x48f3b3[_0x129c('0x1c')](_0x56a63b)[_0x129c('0x1d')]();};}function respondWithResult(_0x14bd93,_0x51d514){_0x51d514=_0x51d514||0xc8;return function(_0x3d08b2){if(_0x3d08b2){return _0x14bd93[_0x129c('0x1c')](_0x51d514)[_0x129c('0x1e')](_0x3d08b2);}};}function respondWithFilteredResult(_0x326890,_0x400f8c){return function(_0x54f8ce){if(_0x54f8ce){var _0x4c4bce=typeof _0x400f8c['offset']===_0x129c('0x1f')&&typeof _0x400f8c[_0x129c('0x20')]===_0x129c('0x1f');var _0x2b7939=_0x54f8ce[_0x129c('0x21')];var _0x34ee0b=_0x4c4bce?0x0:_0x400f8c[_0x129c('0x22')];var _0x201359=_0x4c4bce?_0x54f8ce[_0x129c('0x21')]:_0x400f8c[_0x129c('0x22')]+_0x400f8c[_0x129c('0x20')];var _0x1309b8;if(_0x201359>=_0x2b7939){_0x201359=_0x2b7939;_0x1309b8=0xc8;}else{_0x1309b8=0xce;}_0x326890['status'](_0x1309b8);return _0x326890['set'](_0x129c('0x23'),_0x34ee0b+'-'+_0x201359+'/'+_0x2b7939)[_0x129c('0x1e')](_0x54f8ce);}return null;};}function patchUpdates(_0x4b1003){return function(_0x3cbffa){try{jsonpatch['apply'](_0x3cbffa,_0x4b1003,!![]);}catch(_0x116381){return BPromise[_0x129c('0x24')](_0x116381);}return _0x3cbffa[_0x129c('0x25')]();};}function saveUpdates(_0x3a7b40,_0x1e363b){return function(_0x3cab81){if(_0x3cab81){return _0x3cab81[_0x129c('0x26')](_0x3a7b40)[_0x129c('0x27')](function(_0xed5304){return _0xed5304;});}return null;};}function removeEntity(_0x5abf95,_0x17ba8c){return function(_0x22c772){if(_0x22c772){return _0x22c772[_0x129c('0x28')]()[_0x129c('0x27')](function(){_0x5abf95[_0x129c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x158bca,_0x5406d2){return function(_0xbf9fac){if(!_0xbf9fac){_0x158bca['sendStatus'](0x194);}return _0xbf9fac;};}function handleError(_0x12c650,_0x1d3b7c){_0x1d3b7c=_0x1d3b7c||0x1f4;return function(_0x1b4d59){logger[_0x129c('0x29')](_0x1b4d59[_0x129c('0x2a')]);if(_0x1b4d59['name']){delete _0x1b4d59[_0x129c('0x2b')];}_0x12c650[_0x129c('0x1c')](_0x1d3b7c)[_0x129c('0x2c')](_0x1b4d59);};}exports['index']=function(_0x383ad1,_0x2462b4){var _0x5259e6={},_0x4e8193={},_0x5d7110={'count':0x0,'rows':[]};var _0x16a0fe=_[_0x129c('0x2d')](db[_0x129c('0x2e')][_0x129c('0x2f')],function(_0xc6ad63){return{'name':_0xc6ad63[_0x129c('0x30')],'type':_0xc6ad63[_0x129c('0x31')][_0x129c('0x32')]};});_0x4e8193[_0x129c('0x33')]=_[_0x129c('0x2d')](_0x16a0fe,_0x129c('0x2b'));_0x4e8193[_0x129c('0x34')]=_['keys'](_0x383ad1['query']);_0x4e8193[_0x129c('0x35')]=_[_0x129c('0x36')](_0x4e8193['model'],_0x4e8193[_0x129c('0x34')]);_0x5259e6[_0x129c('0x37')]=_[_0x129c('0x36')](_0x4e8193[_0x129c('0x33')],qs[_0x129c('0x38')](_0x383ad1[_0x129c('0x34')][_0x129c('0x38')]));_0x5259e6[_0x129c('0x37')]=_0x5259e6[_0x129c('0x37')]['length']?_0x5259e6[_0x129c('0x37')]:_0x4e8193[_0x129c('0x33')];if(!_0x383ad1[_0x129c('0x34')][_0x129c('0x39')]('nolimit')){_0x5259e6[_0x129c('0x20')]=qs[_0x129c('0x20')](_0x383ad1['query'][_0x129c('0x20')]);_0x5259e6[_0x129c('0x22')]=qs['offset'](_0x383ad1[_0x129c('0x34')][_0x129c('0x22')]);}_0x5259e6['order']=qs[_0x129c('0x3a')](_0x383ad1[_0x129c('0x34')][_0x129c('0x3a')]);_0x5259e6[_0x129c('0x3b')]=qs['filters'](_[_0x129c('0x3c')](_0x383ad1[_0x129c('0x34')],_0x4e8193['filters']),_0x16a0fe);if(_0x383ad1[_0x129c('0x34')]['filter']){_0x5259e6[_0x129c('0x3b')]=_[_0x129c('0x3d')](_0x5259e6['where'],{'$or':_[_0x129c('0x2d')](_0x16a0fe,function(_0x3882b5){if(_0x3882b5[_0x129c('0x31')]!==_0x129c('0x3e')){var _0x82d237={};_0x82d237[_0x3882b5[_0x129c('0x2b')]]={'$like':'%'+_0x383ad1['query']['filter']+'%'};return _0x82d237;}})});}_0x5259e6=_[_0x129c('0x3d')]({},_0x5259e6,_0x383ad1[_0x129c('0x3f')]);var _0x59eb15={'where':_0x5259e6[_0x129c('0x3b')]};return db[_0x129c('0x2e')][_0x129c('0x21')](_0x59eb15)[_0x129c('0x27')](function(_0x21b957){_0x5d7110[_0x129c('0x21')]=_0x21b957;if(_0x383ad1[_0x129c('0x34')][_0x129c('0x40')]){_0x5259e6[_0x129c('0x41')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x5259e6);})[_0x129c('0x27')](function(_0x47e4ef){_0x5d7110[_0x129c('0x42')]=_0x47e4ef;return _0x5d7110;})[_0x129c('0x27')](respondWithFilteredResult(_0x2462b4,_0x5259e6))[_0x129c('0x43')](handleError(_0x2462b4,null));};exports['show']=function(_0x3fed51,_0x3e0b62){var _0x2e262a={'raw':!![],'where':{'id':_0x3fed51[_0x129c('0x44')]['id']}},_0x34a84d={};_0x34a84d[_0x129c('0x33')]=_[_0x129c('0x45')](db[_0x129c('0x2e')][_0x129c('0x2f')]);_0x34a84d[_0x129c('0x34')]=_['keys'](_0x3fed51[_0x129c('0x34')]);_0x34a84d[_0x129c('0x35')]=_[_0x129c('0x36')](_0x34a84d[_0x129c('0x33')],_0x34a84d[_0x129c('0x34')]);_0x2e262a[_0x129c('0x37')]=_[_0x129c('0x36')](_0x34a84d[_0x129c('0x33')],qs['fields'](_0x3fed51[_0x129c('0x34')][_0x129c('0x38')]));_0x2e262a[_0x129c('0x37')]=_0x2e262a[_0x129c('0x37')][_0x129c('0x46')]?_0x2e262a[_0x129c('0x37')]:_0x34a84d[_0x129c('0x33')];if(_0x3fed51['query'][_0x129c('0x40')]){_0x2e262a[_0x129c('0x41')]=[{'all':!![]}];}_0x2e262a=_[_0x129c('0x3d')]({},_0x2e262a,_0x3fed51[_0x129c('0x3f')]);return db[_0x129c('0x2e')][_0x129c('0x47')](_0x2e262a)[_0x129c('0x27')](handleEntityNotFound(_0x3e0b62,null))[_0x129c('0x27')](respondWithResult(_0x3e0b62,null))['catch'](handleError(_0x3e0b62,null));};exports[_0x129c('0x48')]=function(_0x5b28a7,_0x306f30){return db[_0x129c('0x2e')]['create'](_0x5b28a7[_0x129c('0x49')],{})['then'](respondWithResult(_0x306f30,0xc9))[_0x129c('0x43')](handleError(_0x306f30,null));};exports[_0x129c('0x26')]=function(_0x18aa0e,_0x4722f5){if(_0x18aa0e['body']['id']){delete _0x18aa0e[_0x129c('0x49')]['id'];}return db['SquareMessage'][_0x129c('0x47')]({'where':{'id':_0x18aa0e[_0x129c('0x44')]['id']}})[_0x129c('0x27')](handleEntityNotFound(_0x4722f5,null))[_0x129c('0x27')](saveUpdates(_0x18aa0e['body'],null))[_0x129c('0x27')](respondWithResult(_0x4722f5,null))[_0x129c('0x43')](handleError(_0x4722f5,null));};exports[_0x129c('0x28')]=function(_0x3bec16,_0x1750b7){return db[_0x129c('0x2e')][_0x129c('0x47')]({'where':{'id':_0x3bec16[_0x129c('0x44')]['id']}})[_0x129c('0x27')](handleEntityNotFound(_0x1750b7,null))[_0x129c('0x27')](removeEntity(_0x1750b7,null))[_0x129c('0x43')](handleError(_0x1750b7,null));}; \ No newline at end of file +var _0x6554=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','merge','map','filter','options','SquareMessage','count','includeAll','findAll','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x115d4f,_0x43a3d7){var _0x1afa8a=function(_0x4ebfc8){while(--_0x4ebfc8){_0x115d4f['push'](_0x115d4f['shift']());}};_0x1afa8a(++_0x43a3d7);}(_0x6554,0x181));var _0x4655=function(_0x539b3b,_0x328b70){_0x539b3b=_0x539b3b-0x0;var _0x2576ca=_0x6554[_0x539b3b];return _0x2576ca;};'use strict';var emlformat=require(_0x4655('0x0'));var rimraf=require(_0x4655('0x1'));var zipdir=require(_0x4655('0x2'));var jsonpatch=require(_0x4655('0x3'));var rp=require(_0x4655('0x4'));var moment=require(_0x4655('0x5'));var BPromise=require(_0x4655('0x6'));var Mustache=require(_0x4655('0x7'));var util=require(_0x4655('0x8'));var path=require(_0x4655('0x9'));var sox=require(_0x4655('0xa'));var csv=require(_0x4655('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4655('0xc'));var _=require(_0x4655('0xd'));var squel=require(_0x4655('0xe'));var crypto=require(_0x4655('0xf'));var jsforce=require(_0x4655('0x10'));var deskjs=require(_0x4655('0x11'));var toCsv=require(_0x4655('0xb'));var querystring=require(_0x4655('0x12'));var Papa=require(_0x4655('0x13'));var Redis=require('ioredis');var authService=require(_0x4655('0x14'));var qs=require(_0x4655('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4655('0x16'));var utils=require(_0x4655('0x17'));var config=require(_0x4655('0x18'));var licenseUtil=require(_0x4655('0x19'));var db=require(_0x4655('0x1a'))['db'];function respondWithStatusCode(_0x17b5ec,_0x593a3d){_0x593a3d=_0x593a3d||0xcc;return function(_0x58254b){if(_0x58254b){return _0x17b5ec[_0x4655('0x1b')](_0x593a3d);}return _0x17b5ec[_0x4655('0x1c')](_0x593a3d)[_0x4655('0x1d')]();};}function respondWithResult(_0x1a0bd3,_0x3414b1){_0x3414b1=_0x3414b1||0xc8;return function(_0x3dc6f4){if(_0x3dc6f4){return _0x1a0bd3[_0x4655('0x1c')](_0x3414b1)[_0x4655('0x1e')](_0x3dc6f4);}};}function respondWithFilteredResult(_0x155345,_0x5bd152){return function(_0x12baa3){if(_0x12baa3){var _0x600fc5=typeof _0x5bd152['offset']===_0x4655('0x1f')&&typeof _0x5bd152[_0x4655('0x20')]==='undefined';var _0x5f50f0=_0x12baa3['count'];var _0x313688=_0x600fc5?0x0:_0x5bd152['offset'];var _0x3dcc5d=_0x600fc5?_0x12baa3['count']:_0x5bd152['offset']+_0x5bd152['limit'];var _0x2c700a;if(_0x3dcc5d>=_0x5f50f0){_0x3dcc5d=_0x5f50f0;_0x2c700a=0xc8;}else{_0x2c700a=0xce;}_0x155345[_0x4655('0x1c')](_0x2c700a);return _0x155345[_0x4655('0x21')](_0x4655('0x22'),_0x313688+'-'+_0x3dcc5d+'/'+_0x5f50f0)['json'](_0x12baa3);}return null;};}function patchUpdates(_0x4013f2){return function(_0x3cd8af){try{jsonpatch[_0x4655('0x23')](_0x3cd8af,_0x4013f2,!![]);}catch(_0x5a2869){return BPromise[_0x4655('0x24')](_0x5a2869);}return _0x3cd8af[_0x4655('0x25')]();};}function saveUpdates(_0x7fdd6e,_0x3ec4b6){return function(_0x27b5ec){if(_0x27b5ec){return _0x27b5ec[_0x4655('0x26')](_0x7fdd6e)[_0x4655('0x27')](function(_0x4af6b6){return _0x4af6b6;});}return null;};}function removeEntity(_0x156ab5,_0x4a8843){return function(_0x49d35e){if(_0x49d35e){return _0x49d35e[_0x4655('0x28')]()[_0x4655('0x27')](function(){_0x156ab5[_0x4655('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38fb70,_0x277512){return function(_0x12b751){if(!_0x12b751){_0x38fb70[_0x4655('0x1b')](0x194);}return _0x12b751;};}function handleError(_0x2f6a83,_0x139b1b){_0x139b1b=_0x139b1b||0x1f4;return function(_0x311fcf){logger[_0x4655('0x29')](_0x311fcf['stack']);if(_0x311fcf[_0x4655('0x2a')]){delete _0x311fcf[_0x4655('0x2a')];}_0x2f6a83[_0x4655('0x1c')](_0x139b1b)[_0x4655('0x2b')](_0x311fcf);};}exports[_0x4655('0x2c')]=function(_0x2bcc5a,_0x216e0a){var _0x143177={},_0x170640={},_0x1612f={'count':0x0,'rows':[]};var _0x1aefda=_['map'](db['SquareMessage'][_0x4655('0x2d')],function(_0x2e6c6b){return{'name':_0x2e6c6b[_0x4655('0x2e')],'type':_0x2e6c6b[_0x4655('0x2f')][_0x4655('0x30')]};});_0x170640[_0x4655('0x31')]=_['map'](_0x1aefda,_0x4655('0x2a'));_0x170640['query']=_[_0x4655('0x32')](_0x2bcc5a[_0x4655('0x33')]);_0x170640[_0x4655('0x34')]=_[_0x4655('0x35')](_0x170640[_0x4655('0x31')],_0x170640[_0x4655('0x33')]);_0x143177[_0x4655('0x36')]=_[_0x4655('0x35')](_0x170640['model'],qs[_0x4655('0x37')](_0x2bcc5a[_0x4655('0x33')][_0x4655('0x37')]));_0x143177[_0x4655('0x36')]=_0x143177[_0x4655('0x36')]['length']?_0x143177[_0x4655('0x36')]:_0x170640[_0x4655('0x31')];if(!_0x2bcc5a[_0x4655('0x33')][_0x4655('0x38')](_0x4655('0x39'))){_0x143177['limit']=qs[_0x4655('0x20')](_0x2bcc5a[_0x4655('0x33')][_0x4655('0x20')]);_0x143177['offset']=qs[_0x4655('0x3a')](_0x2bcc5a[_0x4655('0x33')][_0x4655('0x3a')]);}_0x143177[_0x4655('0x3b')]=qs[_0x4655('0x3c')](_0x2bcc5a[_0x4655('0x33')][_0x4655('0x3c')]);_0x143177[_0x4655('0x3d')]=qs[_0x4655('0x34')](_['pick'](_0x2bcc5a[_0x4655('0x33')],_0x170640[_0x4655('0x34')]),_0x1aefda);if(_0x2bcc5a['query']['filter']){_0x143177[_0x4655('0x3d')]=_[_0x4655('0x3e')](_0x143177[_0x4655('0x3d')],{'$or':_[_0x4655('0x3f')](_0x1aefda,function(_0x5081cb){if(_0x5081cb[_0x4655('0x2f')]!=='VIRTUAL'){var _0x18851a={};_0x18851a[_0x5081cb[_0x4655('0x2a')]]={'$like':'%'+_0x2bcc5a['query'][_0x4655('0x40')]+'%'};return _0x18851a;}})});}_0x143177=_[_0x4655('0x3e')]({},_0x143177,_0x2bcc5a[_0x4655('0x41')]);var _0x559acc={'where':_0x143177[_0x4655('0x3d')]};return db[_0x4655('0x42')][_0x4655('0x43')](_0x559acc)[_0x4655('0x27')](function(_0x3f6da6){_0x1612f['count']=_0x3f6da6;if(_0x2bcc5a[_0x4655('0x33')][_0x4655('0x44')]){_0x143177['include']=[{'all':!![]}];}return db[_0x4655('0x42')][_0x4655('0x45')](_0x143177);})[_0x4655('0x27')](function(_0x2a1be5){_0x1612f['rows']=_0x2a1be5;return _0x1612f;})['then'](respondWithFilteredResult(_0x216e0a,_0x143177))[_0x4655('0x46')](handleError(_0x216e0a,null));};exports[_0x4655('0x47')]=function(_0x51feca,_0x1ee404){var _0x3cfef2={'raw':!![],'where':{'id':_0x51feca[_0x4655('0x48')]['id']}},_0x98c1e1={};_0x98c1e1['model']=_['keys'](db[_0x4655('0x42')]['rawAttributes']);_0x98c1e1['query']=_[_0x4655('0x32')](_0x51feca[_0x4655('0x33')]);_0x98c1e1[_0x4655('0x34')]=_[_0x4655('0x35')](_0x98c1e1[_0x4655('0x31')],_0x98c1e1[_0x4655('0x33')]);_0x3cfef2[_0x4655('0x36')]=_[_0x4655('0x35')](_0x98c1e1[_0x4655('0x31')],qs[_0x4655('0x37')](_0x51feca[_0x4655('0x33')][_0x4655('0x37')]));_0x3cfef2[_0x4655('0x36')]=_0x3cfef2[_0x4655('0x36')][_0x4655('0x49')]?_0x3cfef2['attributes']:_0x98c1e1[_0x4655('0x31')];if(_0x51feca[_0x4655('0x33')][_0x4655('0x44')]){_0x3cfef2[_0x4655('0x4a')]=[{'all':!![]}];}_0x3cfef2=_['merge']({},_0x3cfef2,_0x51feca[_0x4655('0x41')]);return db[_0x4655('0x42')][_0x4655('0x4b')](_0x3cfef2)['then'](handleEntityNotFound(_0x1ee404,null))[_0x4655('0x27')](respondWithResult(_0x1ee404,null))[_0x4655('0x46')](handleError(_0x1ee404,null));};exports[_0x4655('0x4c')]=function(_0x11e9c9,_0x5825eb){return db[_0x4655('0x42')][_0x4655('0x4c')](_0x11e9c9[_0x4655('0x4d')],{})[_0x4655('0x27')](respondWithResult(_0x5825eb,0xc9))[_0x4655('0x46')](handleError(_0x5825eb,null));};exports[_0x4655('0x26')]=function(_0x3d65fb,_0x13057c){if(_0x3d65fb['body']['id']){delete _0x3d65fb[_0x4655('0x4d')]['id'];}return db[_0x4655('0x42')][_0x4655('0x4b')]({'where':{'id':_0x3d65fb[_0x4655('0x48')]['id']}})['then'](handleEntityNotFound(_0x13057c,null))[_0x4655('0x27')](saveUpdates(_0x3d65fb['body'],null))[_0x4655('0x27')](respondWithResult(_0x13057c,null))[_0x4655('0x46')](handleError(_0x13057c,null));};exports['destroy']=function(_0x7c20cc,_0x133d85){return db[_0x4655('0x42')][_0x4655('0x4b')]({'where':{'id':_0x7c20cc[_0x4655('0x48')]['id']}})[_0x4655('0x27')](handleEntityNotFound(_0x133d85,null))['then'](removeEntity(_0x133d85,null))[_0x4655('0x46')](handleError(_0x133d85,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1034943..3ec47bc 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 _0xf573=['api','path','../../config/environment','./squareMessage.attributes','define','SquareMessage','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf573,0xbe));var _0x3f57=function(_0x6cbc2c,_0x262e49){_0x6cbc2c=_0x6cbc2c-0x0;var _0x338acb=_0xf573[_0x6cbc2c];return _0x338acb;};'use strict';var _=require(_0x3f57('0x0'));var util=require(_0x3f57('0x1'));var logger=require('../../config/logger')(_0x3f57('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f57('0x3'));var rimraf=require('rimraf');var config=require(_0x3f57('0x4'));var attributes=require(_0x3f57('0x5'));module['exports']=function(_0x5b3df5,_0x1f604c){return _0x5b3df5[_0x3f57('0x6')](_0x3f57('0x7'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2045=['../../config/environment','./squareMessage.attributes','define','SquareMessage','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2045,0x16c));var _0x5204=function(_0x38a162,_0x4396b2){_0x38a162=_0x38a162-0x0;var _0x1f622b=_0x2045[_0x38a162];return _0x1f622b;};'use strict';var _=require(_0x5204('0x0'));var util=require(_0x5204('0x1'));var logger=require('../../config/logger')(_0x5204('0x2'));var moment=require(_0x5204('0x3'));var BPromise=require(_0x5204('0x4'));var rp=require(_0x5204('0x5'));var fs=require('fs');var path=require(_0x5204('0x6'));var rimraf=require(_0x5204('0x7'));var config=require(_0x5204('0x8'));var attributes=require(_0x5204('0x9'));module['exports']=function(_0x33ccb7,_0x3e56fb){return _0x33ccb7[_0x5204('0xa')](_0x5204('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index a9825e3..1c933a2 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 _0x28ef=['create','body','options','raw','debug','CreateSquareMessage','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareMessage'];(function(_0xe38764,_0x28ce79){var _0x5979cf=function(_0x1fedef){while(--_0x1fedef){_0xe38764['push'](_0xe38764['shift']());}};_0x5979cf(++_0x28ce79);}(_0x28ef,0x18e));var _0xf28e=function(_0x31e7e6,_0x4ed0fc){_0x31e7e6=_0x31e7e6-0x0;var _0x201ea1=_0x28ef[_0x31e7e6];return _0x201ea1;};'use strict';var _=require('lodash');var util=require(_0xf28e('0x0'));var moment=require(_0xf28e('0x1'));var BPromise=require(_0xf28e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf28e('0x3'));var db=require(_0xf28e('0x4'))['db'];var utils=require(_0xf28e('0x5'));var logger=require(_0xf28e('0x6'))(_0xf28e('0x7'));var config=require('../../config/environment');var jayson=require(_0xf28e('0x8'));var client=jayson['client'][_0xf28e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4db2eb,_0x41ccff,_0x2d36e8){return new BPromise(function(_0x2eda4c,_0x5a8c59){return client[_0xf28e('0xa')](_0x4db2eb,_0x2d36e8)[_0xf28e('0xb')](function(_0x37dd52){logger[_0xf28e('0xc')](_0xf28e('0xd'),_0x41ccff,_0xf28e('0xe'));logger['debug'](_0xf28e('0xf'),_0x41ccff,'request\x20sent',JSON[_0xf28e('0x10')](_0x37dd52));if(_0x37dd52[_0xf28e('0x11')]){if(_0x37dd52['error']['code']===0x1f4){logger[_0xf28e('0x11')]('SquareMessage,\x20%s,\x20%s',_0x41ccff,_0x37dd52['error'][_0xf28e('0x12')]);return _0x5a8c59(_0x37dd52[_0xf28e('0x11')][_0xf28e('0x12')]);}logger[_0xf28e('0x11')](_0xf28e('0xd'),_0x41ccff,_0x37dd52[_0xf28e('0x11')]['message']);return _0x2eda4c(_0x37dd52[_0xf28e('0x11')][_0xf28e('0x12')]);}else{logger[_0xf28e('0xc')](_0xf28e('0xd'),_0x41ccff,_0xf28e('0xe'));_0x2eda4c(_0x37dd52[_0xf28e('0x13')][_0xf28e('0x12')]);}})[_0xf28e('0x14')](function(_0x4323b2){logger[_0xf28e('0x11')](_0xf28e('0xd'),_0x41ccff,_0x4323b2);_0x5a8c59(_0x4323b2);});});}exports['CreateSquareMessage']=function(_0xd4d304){var _0x2eee03=this;return new Promise(function(_0x57d749,_0x560247){return db[_0xf28e('0x15')][_0xf28e('0x16')](_0xd4d304[_0xf28e('0x17')],{'raw':_0xd4d304[_0xf28e('0x18')]?_0xd4d304[_0xf28e('0x18')][_0xf28e('0x19')]===undefined?!![]:![]:!![]})[_0xf28e('0xb')](function(_0x2c302a){logger['info']('CreateSquareMessage',_0xd4d304);logger[_0xf28e('0x1a')](_0xf28e('0x1b'),_0xd4d304,JSON[_0xf28e('0x10')](_0x2c302a));_0x57d749(_0x2c302a);})[_0xf28e('0x14')](function(_0x4b3f40){logger[_0xf28e('0x11')]('CreateSquareMessage',_0x4b3f40[_0xf28e('0x12')],_0xd4d304);_0x560247(_0x2eee03[_0xf28e('0x11')](0x1f4,_0x4b3f40[_0xf28e('0x12')]));});});}; \ No newline at end of file +var _0xd1dc=['rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','body','options','then','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x97993b,_0x20cbae){var _0x33bb5d=function(_0x32b021){while(--_0x32b021){_0x97993b['push'](_0x97993b['shift']());}};_0x33bb5d(++_0x20cbae);}(_0xd1dc,0xdc));var _0xcd1d=function(_0x370338,_0x4178ec){_0x370338=_0x370338-0x0;var _0x2e10df=_0xd1dc[_0x370338];return _0x2e10df;};'use strict';var _=require('lodash');var util=require(_0xcd1d('0x0'));var moment=require(_0xcd1d('0x1'));var BPromise=require(_0xcd1d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd1d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd1d('0x4'));var logger=require('../../config/logger')(_0xcd1d('0x5'));var config=require(_0xcd1d('0x6'));var jayson=require(_0xcd1d('0x7'));var client=jayson['client'][_0xcd1d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e94b5,_0x170665,_0x2b76c9){return new BPromise(function(_0x1fd019,_0x31dfd9){return client['request'](_0x1e94b5,_0x2b76c9)['then'](function(_0x476f28){logger[_0xcd1d('0x9')](_0xcd1d('0xa'),_0x170665,_0xcd1d('0xb'));logger[_0xcd1d('0xc')](_0xcd1d('0xd'),_0x170665,_0xcd1d('0xb'),JSON[_0xcd1d('0xe')](_0x476f28));if(_0x476f28[_0xcd1d('0xf')]){if(_0x476f28[_0xcd1d('0xf')][_0xcd1d('0x10')]===0x1f4){logger[_0xcd1d('0xf')](_0xcd1d('0xa'),_0x170665,_0x476f28[_0xcd1d('0xf')]['message']);return _0x31dfd9(_0x476f28[_0xcd1d('0xf')][_0xcd1d('0x11')]);}logger[_0xcd1d('0xf')](_0xcd1d('0xa'),_0x170665,_0x476f28['error'][_0xcd1d('0x11')]);return _0x1fd019(_0x476f28[_0xcd1d('0xf')][_0xcd1d('0x11')]);}else{logger['info'](_0xcd1d('0xa'),_0x170665,'request\x20sent');_0x1fd019(_0x476f28[_0xcd1d('0x12')]['message']);}})[_0xcd1d('0x13')](function(_0x5c0bb6){logger[_0xcd1d('0xf')]('SquareMessage,\x20%s,\x20%s',_0x170665,_0x5c0bb6);_0x31dfd9(_0x5c0bb6);});});}exports[_0xcd1d('0x14')]=function(_0x384a01){var _0x4b0b4a=this;return new Promise(function(_0x51e038,_0x48c28e){return db[_0xcd1d('0x15')]['create'](_0x384a01[_0xcd1d('0x16')],{'raw':_0x384a01[_0xcd1d('0x17')]?_0x384a01[_0xcd1d('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xcd1d('0x18')](function(_0x25736f){logger[_0xcd1d('0x9')](_0xcd1d('0x14'),_0x384a01);logger[_0xcd1d('0xc')](_0xcd1d('0x14'),_0x384a01,JSON[_0xcd1d('0xe')](_0x25736f));_0x51e038(_0x25736f);})[_0xcd1d('0x13')](function(_0x147c06){logger['error'](_0xcd1d('0x14'),_0x147c06[_0xcd1d('0x11')],_0x384a01);_0x48c28e(_0x4b0b4a[_0xcd1d('0xf')](0x1f4,_0x147c06['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index dfbadff..5000b6b 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 _0x28b4=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','test','post','create','put','/:id','destroy','multer'];(function(_0xabe83f,_0x4006f7){var _0x553d89=function(_0x355958){while(--_0x355958){_0xabe83f['push'](_0xabe83f['shift']());}};_0x553d89(++_0x4006f7);}(_0x28b4,0x6b));var _0x428b=function(_0x3ffa1b,_0x4326a0){_0x3ffa1b=_0x3ffa1b-0x0;var _0x4abc3e=_0x28b4[_0x3ffa1b];return _0x4abc3e;};'use strict';var multer=require(_0x428b('0x0'));var util=require(_0x428b('0x1'));var path=require(_0x428b('0x2'));var timeout=require('connect-timeout');var express=require(_0x428b('0x3'));var router=express[_0x428b('0x4')]();var fs_extra=require(_0x428b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x428b('0x6'));var config=require(_0x428b('0x7'));var controller=require('./squareOdbc.controller');router[_0x428b('0x8')]('/',auth[_0x428b('0x9')](),controller[_0x428b('0xa')]);router[_0x428b('0x8')]('/:id',auth[_0x428b('0x9')](),controller[_0x428b('0xb')]);router[_0x428b('0x8')]('/:id/test',auth['isAuthenticated'](),timeout('15s'),controller[_0x428b('0xc')]);router[_0x428b('0xd')]('/',auth[_0x428b('0x9')](),controller[_0x428b('0xe')]);router[_0x428b('0xf')]('/:id',auth[_0x428b('0x9')](),controller['update']);router['delete'](_0x428b('0x10'),auth[_0x428b('0x9')](),controller[_0x428b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xcdd9=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xcdd9,0x1d9));var _0x9cdd=function(_0x591044,_0xcd6fed){_0x591044=_0x591044-0x0;var _0x2c0e72=_0xcdd9[_0x591044];return _0x2c0e72;};'use strict';var multer=require(_0x9cdd('0x0'));var util=require(_0x9cdd('0x1'));var path=require(_0x9cdd('0x2'));var timeout=require(_0x9cdd('0x3'));var express=require(_0x9cdd('0x4'));var router=express[_0x9cdd('0x5')]();var fs_extra=require(_0x9cdd('0x6'));var auth=require(_0x9cdd('0x7'));var interaction=require(_0x9cdd('0x8'));var config=require(_0x9cdd('0x9'));var controller=require(_0x9cdd('0xa'));router[_0x9cdd('0xb')]('/',auth[_0x9cdd('0xc')](),controller[_0x9cdd('0xd')]);router['get'](_0x9cdd('0xe'),auth[_0x9cdd('0xc')](),controller[_0x9cdd('0xf')]);router[_0x9cdd('0xb')](_0x9cdd('0x10'),auth[_0x9cdd('0xc')](),timeout(_0x9cdd('0x11')),controller[_0x9cdd('0x12')]);router[_0x9cdd('0x13')]('/',auth[_0x9cdd('0xc')](),controller[_0x9cdd('0x14')]);router[_0x9cdd('0x15')](_0x9cdd('0xe'),auth[_0x9cdd('0xc')](),controller[_0x9cdd('0x16')]);router[_0x9cdd('0x17')](_0x9cdd('0xe'),auth['isAuthenticated'](),controller[_0x9cdd('0x18')]);module[_0x9cdd('0x19')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 9bef2b1..c8b7609 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 _0xa7bb=['sequelize','exports','STRING','name'];(function(_0x1ca4cc,_0x402c23){var _0x108010=function(_0x4c5082){while(--_0x4c5082){_0x1ca4cc['push'](_0x1ca4cc['shift']());}};_0x108010(++_0x402c23);}(_0xa7bb,0xd4));var _0xba7b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xa7bb[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0xba7b('0x0'));module[_0xba7b('0x1')]={'name':{'type':Sequelize[_0xba7b('0x2')],'unique':_0xba7b('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xba7b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4abe=['name','STRING'];(function(_0x57a781,_0x3511d8){var _0x26d639=function(_0x5c44ab){while(--_0x5c44ab){_0x57a781['push'](_0x57a781['shift']());}};_0x26d639(++_0x3511d8);}(_0x4abe,0x1c9));var _0xe4ab=function(_0x11e014,_0x44f09d){_0x11e014=_0x11e014-0x0;var _0x368049=_0x4abe[_0x11e014];return _0x368049;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe4ab('0x0')],'unique':_0xe4ab('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xe4ab('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0cab1fc..ceeefe0 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 _0x045c=['userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','closeSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0x045c,0x109));var _0xc045=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x045c[_0x376b45];return _0x2341b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc045('0x0'));var jsonpatch=require(_0xc045('0x1'));var rp=require(_0xc045('0x2'));var moment=require(_0xc045('0x3'));var BPromise=require(_0xc045('0x4'));var Mustache=require('mustache');var util=require(_0xc045('0x5'));var path=require(_0xc045('0x6'));var sox=require(_0xc045('0x7'));var csv=require(_0xc045('0x8'));var ejs=require(_0xc045('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc045('0xa'));var squel=require(_0xc045('0xb'));var crypto=require(_0xc045('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc045('0xd'));var toCsv=require(_0xc045('0x8'));var querystring=require(_0xc045('0xe'));var Papa=require(_0xc045('0xf'));var Redis=require(_0xc045('0x10'));var authService=require(_0xc045('0x11'));var qs=require(_0xc045('0x12'));var as=require(_0xc045('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc045('0x14'))('api');var utils=require(_0xc045('0x15'));var config=require(_0xc045('0x16'));var licenseUtil=require(_0xc045('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22a789,_0x521f57){_0x521f57=_0x521f57||0xcc;return function(_0x81fa51){if(_0x81fa51){return _0x22a789[_0xc045('0x18')](_0x521f57);}return _0x22a789[_0xc045('0x19')](_0x521f57)[_0xc045('0x1a')]();};}function respondWithResult(_0x53539d,_0x1605ed){_0x1605ed=_0x1605ed||0xc8;return function(_0x2b1c9d){if(_0x2b1c9d){return _0x53539d[_0xc045('0x19')](_0x1605ed)['json'](_0x2b1c9d);}};}function respondWithFilteredResult(_0x253d51,_0x200285){return function(_0x268087){if(_0x268087){var _0x510a92=typeof _0x200285[_0xc045('0x1b')]===_0xc045('0x1c')&&typeof _0x200285[_0xc045('0x1d')]===_0xc045('0x1c');var _0x18dcee=_0x268087['count'];var _0x44b2ba=_0x510a92?0x0:_0x200285['offset'];var _0x33ca24=_0x510a92?_0x268087['count']:_0x200285[_0xc045('0x1b')]+_0x200285[_0xc045('0x1d')];var _0x43db83;if(_0x33ca24>=_0x18dcee){_0x33ca24=_0x18dcee;_0x43db83=0xc8;}else{_0x43db83=0xce;}_0x253d51[_0xc045('0x19')](_0x43db83);return _0x253d51[_0xc045('0x1e')](_0xc045('0x1f'),_0x44b2ba+'-'+_0x33ca24+'/'+_0x18dcee)['json'](_0x268087);}return null;};}function patchUpdates(_0x183c5d){return function(_0x48d50d){try{jsonpatch[_0xc045('0x20')](_0x48d50d,_0x183c5d,!![]);}catch(_0x2d07f4){return BPromise[_0xc045('0x21')](_0x2d07f4);}return _0x48d50d[_0xc045('0x22')]();};}function saveUpdates(_0x5eed4b,_0x2e9011){return function(_0xbb539){if(_0xbb539){return _0xbb539[_0xc045('0x23')](_0x5eed4b)[_0xc045('0x24')](function(_0x738b7c){return _0x738b7c;});}return null;};}function removeEntity(_0x5af0c1,_0x733396){return function(_0x162723){if(_0x162723){return _0x162723[_0xc045('0x25')]()[_0xc045('0x24')](function(){var _0x5146ff=_0x162723[_0xc045('0x26')]({'plain':!![]});var _0x329c74=_0xc045('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x329c74,'resourceId':_0x5146ff['id']}})[_0xc045('0x24')](function(){return _0x162723;});})[_0xc045('0x24')](function(){_0x5af0c1['status'](0xcc)[_0xc045('0x1a')]();});}};}function handleEntityNotFound(_0x34e0e8,_0x9cd4f2){return function(_0x58107d){if(!_0x58107d){_0x34e0e8[_0xc045('0x18')](0x194);}return _0x58107d;};}function handleError(_0x5ec112,_0x4725ea){_0x4725ea=_0x4725ea||0x1f4;return function(_0x23a41c){logger['error'](_0x23a41c['stack']);if(_0x23a41c[_0xc045('0x28')]){delete _0x23a41c[_0xc045('0x28')];}_0x5ec112['status'](_0x4725ea)[_0xc045('0x29')](_0x23a41c);};}exports[_0xc045('0x2a')]=function(_0x2dd306,_0x4d7347){var _0x497a8c={},_0xcea5a8={},_0x191815={'count':0x0,'rows':[]};var _0x2bd7d6=_[_0xc045('0x2b')](db[_0xc045('0x2c')][_0xc045('0x2d')],function(_0x10e015){return{'name':_0x10e015[_0xc045('0x2e')],'type':_0x10e015[_0xc045('0x2f')][_0xc045('0x30')]};});_0xcea5a8['model']=_[_0xc045('0x2b')](_0x2bd7d6,'name');_0xcea5a8['query']=_[_0xc045('0x31')](_0x2dd306[_0xc045('0x32')]);_0xcea5a8[_0xc045('0x33')]=_[_0xc045('0x34')](_0xcea5a8[_0xc045('0x35')],_0xcea5a8[_0xc045('0x32')]);_0x497a8c['attributes']=_['intersection'](_0xcea5a8[_0xc045('0x35')],qs[_0xc045('0x36')](_0x2dd306[_0xc045('0x32')][_0xc045('0x36')]));_0x497a8c['attributes']=_0x497a8c['attributes']['length']?_0x497a8c[_0xc045('0x37')]:_0xcea5a8[_0xc045('0x35')];if(!_0x2dd306[_0xc045('0x32')][_0xc045('0x38')](_0xc045('0x39'))){_0x497a8c[_0xc045('0x1d')]=qs['limit'](_0x2dd306[_0xc045('0x32')]['limit']);_0x497a8c['offset']=qs[_0xc045('0x1b')](_0x2dd306[_0xc045('0x32')][_0xc045('0x1b')]);}_0x497a8c['order']=qs[_0xc045('0x3a')](_0x2dd306[_0xc045('0x32')][_0xc045('0x3a')]);_0x497a8c[_0xc045('0x3b')]=qs['filters'](_[_0xc045('0x3c')](_0x2dd306[_0xc045('0x32')],_0xcea5a8[_0xc045('0x33')]),_0x2bd7d6);if(_0x2dd306[_0xc045('0x32')]['filter']){_0x497a8c[_0xc045('0x3b')]=_[_0xc045('0x3d')](_0x497a8c[_0xc045('0x3b')],{'$or':_['map'](_0x2bd7d6,function(_0x8d60e0){if(_0x8d60e0[_0xc045('0x2f')]!==_0xc045('0x3e')){var _0x23c91f={};_0x23c91f[_0x8d60e0[_0xc045('0x28')]]={'$like':'%'+_0x2dd306[_0xc045('0x32')][_0xc045('0x3f')]+'%'};return _0x23c91f;}})});}_0x497a8c=_[_0xc045('0x3d')]({},_0x497a8c,_0x2dd306[_0xc045('0x40')]);var _0x5ea545={'where':_0x497a8c[_0xc045('0x3b')]};return db['SquareOdbc']['count'](_0x5ea545)[_0xc045('0x24')](function(_0x920402){_0x191815[_0xc045('0x41')]=_0x920402;if(_0x2dd306['query'][_0xc045('0x42')]){_0x497a8c['include']=[{'all':!![]}];}return db['SquareOdbc'][_0xc045('0x43')](_0x497a8c);})[_0xc045('0x24')](function(_0x463d8b){_0x191815['rows']=_0x463d8b;return _0x191815;})['then'](respondWithFilteredResult(_0x4d7347,_0x497a8c))[_0xc045('0x44')](handleError(_0x4d7347,null));};exports[_0xc045('0x45')]=function(_0x49de71,_0x1046bb){var _0x10e273={'raw':!![],'where':{'id':_0x49de71['params']['id']}},_0x3d687b={};_0x3d687b['model']=_[_0xc045('0x31')](db[_0xc045('0x2c')][_0xc045('0x2d')]);_0x3d687b[_0xc045('0x32')]=_[_0xc045('0x31')](_0x49de71[_0xc045('0x32')]);_0x3d687b[_0xc045('0x33')]=_[_0xc045('0x34')](_0x3d687b['model'],_0x3d687b[_0xc045('0x32')]);_0x10e273[_0xc045('0x37')]=_[_0xc045('0x34')](_0x3d687b['model'],qs[_0xc045('0x36')](_0x49de71[_0xc045('0x32')][_0xc045('0x36')]));_0x10e273[_0xc045('0x37')]=_0x10e273[_0xc045('0x37')]['length']?_0x10e273['attributes']:_0x3d687b[_0xc045('0x35')];if(_0x49de71[_0xc045('0x32')][_0xc045('0x42')]){_0x10e273['include']=[{'all':!![]}];}_0x10e273=_[_0xc045('0x3d')]({},_0x10e273,_0x49de71[_0xc045('0x40')]);return db[_0xc045('0x2c')]['find'](_0x10e273)[_0xc045('0x24')](handleEntityNotFound(_0x1046bb,null))[_0xc045('0x24')](respondWithResult(_0x1046bb,null))['catch'](handleError(_0x1046bb,null));};exports[_0xc045('0x46')]=function(_0x963a4d,_0x1047b2){return db[_0xc045('0x2c')]['create'](_0x963a4d[_0xc045('0x47')],{})[_0xc045('0x24')](function(_0x4acd27){var _0x1f31df=_0x963a4d['user'][_0xc045('0x26')]({'plain':!![]});if(!_0x1f31df)throw new Error(_0xc045('0x48'));if(_0x1f31df['role']==='user'){var _0x10462d=_0x4acd27['get']({'plain':!![]});var _0x1fd2e2=_0xc045('0x27');return db[_0xc045('0x49')][_0xc045('0x4a')]({'where':{'name':_0x1fd2e2,'userProfileId':_0x1f31df[_0xc045('0x4b')]},'raw':!![]})[_0xc045('0x24')](function(_0x521f96){if(_0x521f96&&_0x521f96[_0xc045('0x4c')]===0x0){return db[_0xc045('0x4d')]['create']({'name':_0x10462d[_0xc045('0x28')],'resourceId':_0x10462d['id'],'type':_0x521f96[_0xc045('0x28')],'sectionId':_0x521f96['id']},{})['then'](function(){return _0x4acd27;});}else{return _0x4acd27;}})[_0xc045('0x44')](function(_0x4c173a){logger['error'](_0xc045('0x4e'),_0x4c173a);throw _0x4c173a;});}return _0x4acd27;})['then'](respondWithResult(_0x1047b2,0xc9))[_0xc045('0x44')](handleError(_0x1047b2,null));};exports['update']=function(_0x5a9f2a,_0x3f93dc){if(_0x5a9f2a[_0xc045('0x47')]['id']){delete _0x5a9f2a[_0xc045('0x47')]['id'];}return db['SquareOdbc'][_0xc045('0x4a')]({'where':{'id':_0x5a9f2a[_0xc045('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3f93dc,null))[_0xc045('0x24')](saveUpdates(_0x5a9f2a[_0xc045('0x47')],null))[_0xc045('0x24')](respondWithResult(_0x3f93dc,null))[_0xc045('0x44')](handleError(_0x3f93dc,null));};exports[_0xc045('0x25')]=function(_0x47cb68,_0x5dbc53){return db[_0xc045('0x2c')][_0xc045('0x4a')]({'where':{'id':_0x47cb68[_0xc045('0x4f')]['id']}})[_0xc045('0x24')](handleEntityNotFound(_0x5dbc53,null))['then'](removeEntity(_0x5dbc53,null))[_0xc045('0x44')](handleError(_0x5dbc53,null));};exports[_0xc045('0x50')]=function(_0x2167ae,_0x3d01ee,_0x1fb52f){var _0x1af692;return db[_0xc045('0x2c')][_0xc045('0x4a')]({'where':{'id':_0x2167ae[_0xc045('0x4f')]['id']},'attributes':['id',_0xc045('0x51')]})[_0xc045('0x24')](handleEntityNotFound(_0x3d01ee,null))[_0xc045('0x24')](function(_0x5d2116){if(_0x5d2116){var _0x1922f9=require(_0xc045('0x52'))();_0x1922f9[_0xc045('0x53')](_0x5d2116[_0xc045('0x51')]);_0x1922f9[_0xc045('0x54')]();return _0x5d2116;}})[_0xc045('0x24')](respondWithResult(_0x3d01ee,null))[_0xc045('0x44')](handleError(_0x3d01ee,null));}; \ No newline at end of file +var _0x67c3=['length','include','find','create','body','user','role','get','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','ODBC','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','SquareOdbc','includeAll','rows','catch','show','params','intersection'];(function(_0x3f3125,_0x3f49d2){var _0x28bf12=function(_0xb9d9cb){while(--_0xb9d9cb){_0x3f3125['push'](_0x3f3125['shift']());}};_0x28bf12(++_0x3f49d2);}(_0x67c3,0x1c8));var _0x367c=function(_0x15f455,_0x1ec373){_0x15f455=_0x15f455-0x0;var _0x45f542=_0x67c3[_0x15f455];return _0x45f542;};'use strict';var emlformat=require(_0x367c('0x0'));var rimraf=require(_0x367c('0x1'));var zipdir=require(_0x367c('0x2'));var jsonpatch=require(_0x367c('0x3'));var rp=require(_0x367c('0x4'));var moment=require(_0x367c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x367c('0x6'));var path=require(_0x367c('0x7'));var sox=require(_0x367c('0x8'));var csv=require(_0x367c('0x9'));var ejs=require(_0x367c('0xa'));var fs=require('fs');var fs_extra=require(_0x367c('0xb'));var _=require(_0x367c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x367c('0xd'));var deskjs=require(_0x367c('0xe'));var toCsv=require(_0x367c('0x9'));var querystring=require(_0x367c('0xf'));var Papa=require(_0x367c('0x10'));var Redis=require(_0x367c('0x11'));var authService=require(_0x367c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x367c('0x13'));var logger=require(_0x367c('0x14'))(_0x367c('0x15'));var utils=require(_0x367c('0x16'));var config=require(_0x367c('0x17'));var licenseUtil=require(_0x367c('0x18'));var db=require(_0x367c('0x19'))['db'];function respondWithStatusCode(_0x23e755,_0x25feac){_0x25feac=_0x25feac||0xcc;return function(_0x73d7aa){if(_0x73d7aa){return _0x23e755[_0x367c('0x1a')](_0x25feac);}return _0x23e755['status'](_0x25feac)[_0x367c('0x1b')]();};}function respondWithResult(_0x434d99,_0x5036b0){_0x5036b0=_0x5036b0||0xc8;return function(_0xdf3574){if(_0xdf3574){return _0x434d99[_0x367c('0x1c')](_0x5036b0)['json'](_0xdf3574);}};}function respondWithFilteredResult(_0x28931d,_0x1c7bd6){return function(_0x2d8b99){if(_0x2d8b99){var _0x2167f5=typeof _0x1c7bd6[_0x367c('0x1d')]===_0x367c('0x1e')&&typeof _0x1c7bd6[_0x367c('0x1f')]===_0x367c('0x1e');var _0x55f059=_0x2d8b99[_0x367c('0x20')];var _0x38f59e=_0x2167f5?0x0:_0x1c7bd6[_0x367c('0x1d')];var _0x3dac6e=_0x2167f5?_0x2d8b99[_0x367c('0x20')]:_0x1c7bd6[_0x367c('0x1d')]+_0x1c7bd6[_0x367c('0x1f')];var _0x4ad6a0;if(_0x3dac6e>=_0x55f059){_0x3dac6e=_0x55f059;_0x4ad6a0=0xc8;}else{_0x4ad6a0=0xce;}_0x28931d[_0x367c('0x1c')](_0x4ad6a0);return _0x28931d[_0x367c('0x21')](_0x367c('0x22'),_0x38f59e+'-'+_0x3dac6e+'/'+_0x55f059)['json'](_0x2d8b99);}return null;};}function patchUpdates(_0x342ee2){return function(_0x3201dd){try{jsonpatch['apply'](_0x3201dd,_0x342ee2,!![]);}catch(_0x5938a8){return BPromise['reject'](_0x5938a8);}return _0x3201dd[_0x367c('0x23')]();};}function saveUpdates(_0x4001c9,_0xcf52c2){return function(_0x38e24b){if(_0x38e24b){return _0x38e24b[_0x367c('0x24')](_0x4001c9)[_0x367c('0x25')](function(_0x512fca){return _0x512fca;});}return null;};}function removeEntity(_0x510bb4,_0x295af6){return function(_0x5349d3){if(_0x5349d3){return _0x5349d3[_0x367c('0x26')]()[_0x367c('0x25')](function(){var _0x526f88=_0x5349d3['get']({'plain':!![]});var _0x7c8af=_0x367c('0x27');return db['UserProfileResource'][_0x367c('0x26')]({'where':{'type':_0x7c8af,'resourceId':_0x526f88['id']}})[_0x367c('0x25')](function(){return _0x5349d3;});})[_0x367c('0x25')](function(){_0x510bb4[_0x367c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc92d66,_0x8d6e96){return function(_0x5d1628){if(!_0x5d1628){_0xc92d66['sendStatus'](0x194);}return _0x5d1628;};}function handleError(_0x5b06cc,_0x421ee6){_0x421ee6=_0x421ee6||0x1f4;return function(_0x50f24c){logger[_0x367c('0x28')](_0x50f24c[_0x367c('0x29')]);if(_0x50f24c[_0x367c('0x2a')]){delete _0x50f24c[_0x367c('0x2a')];}_0x5b06cc[_0x367c('0x1c')](_0x421ee6)[_0x367c('0x2b')](_0x50f24c);};}exports[_0x367c('0x2c')]=function(_0x3d6a3f,_0x465936){var _0x142455={},_0x12d621={},_0x21a28a={'count':0x0,'rows':[]};var _0x1bc484=_[_0x367c('0x2d')](db['SquareOdbc'][_0x367c('0x2e')],function(_0x1add02){return{'name':_0x1add02[_0x367c('0x2f')],'type':_0x1add02[_0x367c('0x30')][_0x367c('0x31')]};});_0x12d621[_0x367c('0x32')]=_['map'](_0x1bc484,_0x367c('0x2a'));_0x12d621[_0x367c('0x33')]=_[_0x367c('0x34')](_0x3d6a3f[_0x367c('0x33')]);_0x12d621[_0x367c('0x35')]=_['intersection'](_0x12d621[_0x367c('0x32')],_0x12d621[_0x367c('0x33')]);_0x142455[_0x367c('0x36')]=_['intersection'](_0x12d621[_0x367c('0x32')],qs[_0x367c('0x37')](_0x3d6a3f[_0x367c('0x33')][_0x367c('0x37')]));_0x142455['attributes']=_0x142455[_0x367c('0x36')]['length']?_0x142455[_0x367c('0x36')]:_0x12d621['model'];if(!_0x3d6a3f[_0x367c('0x33')]['hasOwnProperty'](_0x367c('0x38'))){_0x142455[_0x367c('0x1f')]=qs[_0x367c('0x1f')](_0x3d6a3f[_0x367c('0x33')]['limit']);_0x142455[_0x367c('0x1d')]=qs[_0x367c('0x1d')](_0x3d6a3f[_0x367c('0x33')]['offset']);}_0x142455[_0x367c('0x39')]=qs[_0x367c('0x3a')](_0x3d6a3f[_0x367c('0x33')][_0x367c('0x3a')]);_0x142455['where']=qs[_0x367c('0x35')](_[_0x367c('0x3b')](_0x3d6a3f[_0x367c('0x33')],_0x12d621['filters']),_0x1bc484);if(_0x3d6a3f['query'][_0x367c('0x3c')]){_0x142455[_0x367c('0x3d')]=_[_0x367c('0x3e')](_0x142455[_0x367c('0x3d')],{'$or':_[_0x367c('0x2d')](_0x1bc484,function(_0x383ba8){if(_0x383ba8['type']!==_0x367c('0x3f')){var _0xa00c18={};_0xa00c18[_0x383ba8[_0x367c('0x2a')]]={'$like':'%'+_0x3d6a3f['query'][_0x367c('0x3c')]+'%'};return _0xa00c18;}})});}_0x142455=_[_0x367c('0x3e')]({},_0x142455,_0x3d6a3f[_0x367c('0x40')]);var _0x3222e9={'where':_0x142455[_0x367c('0x3d')]};return db[_0x367c('0x41')][_0x367c('0x20')](_0x3222e9)[_0x367c('0x25')](function(_0x1e5597){_0x21a28a[_0x367c('0x20')]=_0x1e5597;if(_0x3d6a3f[_0x367c('0x33')][_0x367c('0x42')]){_0x142455['include']=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x142455);})[_0x367c('0x25')](function(_0x265bf1){_0x21a28a[_0x367c('0x43')]=_0x265bf1;return _0x21a28a;})['then'](respondWithFilteredResult(_0x465936,_0x142455))[_0x367c('0x44')](handleError(_0x465936,null));};exports[_0x367c('0x45')]=function(_0x336008,_0x2a5750){var _0x310f43={'raw':!![],'where':{'id':_0x336008[_0x367c('0x46')]['id']}},_0x3acb77={};_0x3acb77[_0x367c('0x32')]=_[_0x367c('0x34')](db[_0x367c('0x41')]['rawAttributes']);_0x3acb77[_0x367c('0x33')]=_[_0x367c('0x34')](_0x336008[_0x367c('0x33')]);_0x3acb77[_0x367c('0x35')]=_['intersection'](_0x3acb77[_0x367c('0x32')],_0x3acb77[_0x367c('0x33')]);_0x310f43[_0x367c('0x36')]=_[_0x367c('0x47')](_0x3acb77['model'],qs[_0x367c('0x37')](_0x336008[_0x367c('0x33')][_0x367c('0x37')]));_0x310f43[_0x367c('0x36')]=_0x310f43['attributes'][_0x367c('0x48')]?_0x310f43['attributes']:_0x3acb77[_0x367c('0x32')];if(_0x336008['query']['includeAll']){_0x310f43[_0x367c('0x49')]=[{'all':!![]}];}_0x310f43=_[_0x367c('0x3e')]({},_0x310f43,_0x336008[_0x367c('0x40')]);return db[_0x367c('0x41')][_0x367c('0x4a')](_0x310f43)[_0x367c('0x25')](handleEntityNotFound(_0x2a5750,null))[_0x367c('0x25')](respondWithResult(_0x2a5750,null))[_0x367c('0x44')](handleError(_0x2a5750,null));};exports[_0x367c('0x4b')]=function(_0x3cb992,_0x49345f){return db[_0x367c('0x41')]['create'](_0x3cb992[_0x367c('0x4c')],{})[_0x367c('0x25')](function(_0x119767){var _0x6f2d14=_0x3cb992[_0x367c('0x4d')]['get']({'plain':!![]});if(!_0x6f2d14)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6f2d14[_0x367c('0x4e')]===_0x367c('0x4d')){var _0x5d0b1d=_0x119767[_0x367c('0x4f')]({'plain':!![]});var _0x8031b=_0x367c('0x27');return db['UserProfileSection'][_0x367c('0x4a')]({'where':{'name':_0x8031b,'userProfileId':_0x6f2d14['userProfileId']},'raw':!![]})[_0x367c('0x25')](function(_0x33ab20){if(_0x33ab20&&_0x33ab20[_0x367c('0x50')]===0x0){return db[_0x367c('0x51')][_0x367c('0x4b')]({'name':_0x5d0b1d[_0x367c('0x2a')],'resourceId':_0x5d0b1d['id'],'type':_0x33ab20[_0x367c('0x2a')],'sectionId':_0x33ab20['id']},{})['then'](function(){return _0x119767;});}else{return _0x119767;}})['catch'](function(_0x46f6e4){logger[_0x367c('0x28')](_0x367c('0x52'),_0x46f6e4);throw _0x46f6e4;});}return _0x119767;})['then'](respondWithResult(_0x49345f,0xc9))['catch'](handleError(_0x49345f,null));};exports[_0x367c('0x24')]=function(_0x13f42a,_0x358445){if(_0x13f42a[_0x367c('0x4c')]['id']){delete _0x13f42a[_0x367c('0x4c')]['id'];}return db[_0x367c('0x41')][_0x367c('0x4a')]({'where':{'id':_0x13f42a[_0x367c('0x46')]['id']}})[_0x367c('0x25')](handleEntityNotFound(_0x358445,null))[_0x367c('0x25')](saveUpdates(_0x13f42a['body'],null))[_0x367c('0x25')](respondWithResult(_0x358445,null))[_0x367c('0x44')](handleError(_0x358445,null));};exports['destroy']=function(_0x7abba7,_0x6db6bc){return db['SquareOdbc']['find']({'where':{'id':_0x7abba7['params']['id']}})[_0x367c('0x25')](handleEntityNotFound(_0x6db6bc,null))[_0x367c('0x25')](removeEntity(_0x6db6bc,null))['catch'](handleError(_0x6db6bc,null));};exports[_0x367c('0x53')]=function(_0x232196,_0x1ea91d,_0xca2591){var _0x1bf4c2;return db[_0x367c('0x41')][_0x367c('0x4a')]({'where':{'id':_0x232196[_0x367c('0x46')]['id']},'attributes':['id',_0x367c('0x54')]})['then'](handleEntityNotFound(_0x1ea91d,null))['then'](function(_0x3b46e9){if(_0x3b46e9){var _0x46e5c9=require(_0x367c('0x55'))();_0x46e5c9[_0x367c('0x56')](_0x3b46e9[_0x367c('0x54')]);_0x46e5c9[_0x367c('0x57')]();return _0x3b46e9;}})[_0x367c('0x25')](respondWithResult(_0x1ea91d,null))[_0x367c('0x44')](handleError(_0x1ea91d,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index cfb4d39..06bcfd1 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 _0xfb34=['bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','define','square_odbc','lodash','../../config/logger','api','moment'];(function(_0x39367f,_0x5392df){var _0x168407=function(_0x4a46d6){while(--_0x4a46d6){_0x39367f['push'](_0x39367f['shift']());}};_0x168407(++_0x5392df);}(_0xfb34,0x1a0));var _0x4fb3=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xfb34[_0x11ce46];return _0x368a1e;};'use strict';var _=require(_0x4fb3('0x0'));var util=require('util');var logger=require(_0x4fb3('0x1'))(_0x4fb3('0x2'));var moment=require(_0x4fb3('0x3'));var BPromise=require(_0x4fb3('0x4'));var rp=require(_0x4fb3('0x5'));var fs=require('fs');var path=require(_0x4fb3('0x6'));var rimraf=require(_0x4fb3('0x7'));var config=require(_0x4fb3('0x8'));var attributes=require(_0x4fb3('0x9'));module['exports']=function(_0x2cd732,_0x58c9a6){return _0x2cd732[_0x4fb3('0xa')]('SquareOdbc',attributes,{'tableName':_0x4fb3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4cb=['exports','define','SquareOdbc','square_odbc','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x466385,_0x16eaf3){var _0x4689d1=function(_0x106c6b){while(--_0x106c6b){_0x466385['push'](_0x466385['shift']());}};_0x4689d1(++_0x16eaf3);}(_0xa4cb,0x86));var _0xba4c=function(_0x5c9b44,_0x44ea49){_0x5c9b44=_0x5c9b44-0x0;var _0x5b65c3=_0xa4cb[_0x5c9b44];return _0x5b65c3;};'use strict';var _=require('lodash');var util=require(_0xba4c('0x0'));var logger=require(_0xba4c('0x1'))(_0xba4c('0x2'));var moment=require('moment');var BPromise=require(_0xba4c('0x3'));var rp=require(_0xba4c('0x4'));var fs=require('fs');var path=require(_0xba4c('0x5'));var rimraf=require(_0xba4c('0x6'));var config=require(_0xba4c('0x7'));var attributes=require(_0xba4c('0x8'));module[_0xba4c('0x9')]=function(_0x36cd54,_0x47f8b2){return _0x36cd54[_0xba4c('0xa')](_0xba4c('0xb'),attributes,{'tableName':_0xba4c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index e6a14d6..1cc2fe8 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 _0x65e1=['rpc','jayson/promise','client','http','request','info','debug','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','find','options','raw','where','attributes','include','model','map','then','ShowSquareOdbc','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x37df7f,_0x48589a){var _0x3e013b=function(_0x57c9b6){while(--_0x57c9b6){_0x37df7f['push'](_0x37df7f['shift']());}};_0x3e013b(++_0x48589a);}(_0x65e1,0x1ca));var _0x165e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x65e1[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x165e('0x0'));var util=require(_0x165e('0x1'));var moment=require('moment');var BPromise=require(_0x165e('0x2'));var rs=require(_0x165e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x165e('0x4'))['db'];var utils=require(_0x165e('0x5'));var logger=require(_0x165e('0x6'))(_0x165e('0x7'));var config=require('../../config/environment');var jayson=require(_0x165e('0x8'));var client=jayson[_0x165e('0x9')][_0x165e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bf1ee,_0x3043e7,_0x1277b8){return new BPromise(function(_0x422183,_0x591696){return client[_0x165e('0xb')](_0x3bf1ee,_0x1277b8)['then'](function(_0x1832a6){logger[_0x165e('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x3043e7,'request\x20sent');logger[_0x165e('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x3043e7,'request\x20sent',JSON[_0x165e('0xe')](_0x1832a6));if(_0x1832a6[_0x165e('0xf')]){if(_0x1832a6[_0x165e('0xf')][_0x165e('0x10')]===0x1f4){logger['error'](_0x165e('0x11'),_0x3043e7,_0x1832a6[_0x165e('0xf')][_0x165e('0x12')]);return _0x591696(_0x1832a6[_0x165e('0xf')][_0x165e('0x12')]);}logger[_0x165e('0xf')](_0x165e('0x11'),_0x3043e7,_0x1832a6[_0x165e('0xf')][_0x165e('0x12')]);return _0x422183(_0x1832a6[_0x165e('0xf')][_0x165e('0x12')]);}else{logger[_0x165e('0xc')](_0x165e('0x11'),_0x3043e7,'request\x20sent');_0x422183(_0x1832a6[_0x165e('0x13')][_0x165e('0x12')]);}})[_0x165e('0x14')](function(_0x44d613){logger[_0x165e('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x3043e7,_0x44d613);_0x591696(_0x44d613);});});}exports['ShowSquareOdbc']=function(_0x3b69a2){var _0x483f75=this;return new Promise(function(_0x4ec65,_0x35e033){return db['SquareOdbc'][_0x165e('0x15')]({'raw':_0x3b69a2[_0x165e('0x16')]?_0x3b69a2[_0x165e('0x16')][_0x165e('0x17')]===undefined?!![]:![]:!![],'where':_0x3b69a2[_0x165e('0x16')]?_0x3b69a2[_0x165e('0x16')][_0x165e('0x18')]||null:null,'attributes':_0x3b69a2[_0x165e('0x16')]?_0x3b69a2['options'][_0x165e('0x19')]||null:null,'include':_0x3b69a2['options']?_0x3b69a2[_0x165e('0x16')][_0x165e('0x1a')]?_['map'](_0x3b69a2[_0x165e('0x16')][_0x165e('0x1a')],function(_0x1c1a08){return{'model':db[_0x1c1a08[_0x165e('0x1b')]],'as':_0x1c1a08['as'],'attributes':_0x1c1a08[_0x165e('0x19')],'include':_0x1c1a08['include']?_[_0x165e('0x1c')](_0x1c1a08['include'],function(_0x4399fd){return{'model':db[_0x4399fd[_0x165e('0x1b')]],'as':_0x4399fd['as'],'attributes':_0x4399fd[_0x165e('0x19')],'include':_0x4399fd[_0x165e('0x1a')]?_[_0x165e('0x1c')](_0x4399fd[_0x165e('0x1a')],function(_0x26fe40){return{'model':db[_0x26fe40[_0x165e('0x1b')]],'as':_0x26fe40['as'],'attributes':_0x26fe40['attributes']};}):[]};}):[]};}):[]:[]})[_0x165e('0x1d')](function(_0xbe8833){logger[_0x165e('0xc')]('ShowSquareOdbc',_0x3b69a2);logger[_0x165e('0xd')](_0x165e('0x1e'),_0x3b69a2,JSON['stringify'](_0xbe8833));_0x4ec65(_0xbe8833);})[_0x165e('0x14')](function(_0xd5b667){logger['error'](_0x165e('0x1e'),_0xd5b667[_0x165e('0x12')],_0x3b69a2);_0x35e033(_0x483f75[_0x165e('0xf')](0x1f4,_0xd5b667[_0x165e('0x12')]));});});}; \ No newline at end of file +var _0xdb26=['info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x5796bf,_0x2c93ef){var _0x1aba5c=function(_0xefcd2d){while(--_0xefcd2d){_0x5796bf['push'](_0x5796bf['shift']());}};_0x1aba5c(++_0x2c93ef);}(_0xdb26,0x93));var _0x6db2=function(_0x1a379a,_0x2868e0){_0x1a379a=_0x1a379a-0x0;var _0x528c58=_0xdb26[_0x1a379a];return _0x528c58;};'use strict';var _=require(_0x6db2('0x0'));var util=require(_0x6db2('0x1'));var moment=require(_0x6db2('0x2'));var BPromise=require(_0x6db2('0x3'));var rs=require(_0x6db2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6db2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6db2('0x6'))(_0x6db2('0x7'));var config=require(_0x6db2('0x8'));var jayson=require(_0x6db2('0x9'));var client=jayson[_0x6db2('0xa')][_0x6db2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46b4ab,_0x161b44,_0x171268){return new BPromise(function(_0x8767a,_0x24b761){return client['request'](_0x46b4ab,_0x171268)[_0x6db2('0xc')](function(_0x34eefe){logger[_0x6db2('0xd')](_0x6db2('0xe'),_0x161b44,_0x6db2('0xf'));logger['debug'](_0x6db2('0x10'),_0x161b44,_0x6db2('0xf'),JSON[_0x6db2('0x11')](_0x34eefe));if(_0x34eefe[_0x6db2('0x12')]){if(_0x34eefe[_0x6db2('0x12')]['code']===0x1f4){logger[_0x6db2('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x161b44,_0x34eefe[_0x6db2('0x12')][_0x6db2('0x13')]);return _0x24b761(_0x34eefe[_0x6db2('0x12')][_0x6db2('0x13')]);}logger[_0x6db2('0x12')](_0x6db2('0xe'),_0x161b44,_0x34eefe[_0x6db2('0x12')][_0x6db2('0x13')]);return _0x8767a(_0x34eefe[_0x6db2('0x12')][_0x6db2('0x13')]);}else{logger[_0x6db2('0xd')](_0x6db2('0xe'),_0x161b44,_0x6db2('0xf'));_0x8767a(_0x34eefe[_0x6db2('0x14')]['message']);}})[_0x6db2('0x15')](function(_0x43a842){logger[_0x6db2('0x12')](_0x6db2('0xe'),_0x161b44,_0x43a842);_0x24b761(_0x43a842);});});}exports[_0x6db2('0x16')]=function(_0x3662b5){var _0x2102a8=this;return new Promise(function(_0x496397,_0x41911b){return db[_0x6db2('0x17')][_0x6db2('0x18')]({'raw':_0x3662b5[_0x6db2('0x19')]?_0x3662b5[_0x6db2('0x19')][_0x6db2('0x1a')]===undefined?!![]:![]:!![],'where':_0x3662b5[_0x6db2('0x19')]?_0x3662b5[_0x6db2('0x19')]['where']||null:null,'attributes':_0x3662b5['options']?_0x3662b5[_0x6db2('0x19')][_0x6db2('0x1b')]||null:null,'include':_0x3662b5['options']?_0x3662b5['options'][_0x6db2('0x1c')]?_[_0x6db2('0x1d')](_0x3662b5[_0x6db2('0x19')][_0x6db2('0x1c')],function(_0x5b9b8f){return{'model':db[_0x5b9b8f['model']],'as':_0x5b9b8f['as'],'attributes':_0x5b9b8f[_0x6db2('0x1b')],'include':_0x5b9b8f[_0x6db2('0x1c')]?_[_0x6db2('0x1d')](_0x5b9b8f[_0x6db2('0x1c')],function(_0x19607a){return{'model':db[_0x19607a[_0x6db2('0x1e')]],'as':_0x19607a['as'],'attributes':_0x19607a['attributes'],'include':_0x19607a[_0x6db2('0x1c')]?_[_0x6db2('0x1d')](_0x19607a[_0x6db2('0x1c')],function(_0x5a969c){return{'model':db[_0x5a969c['model']],'as':_0x5a969c['as'],'attributes':_0x5a969c[_0x6db2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6db2('0xc')](function(_0x27c4e4){logger[_0x6db2('0xd')]('ShowSquareOdbc',_0x3662b5);logger[_0x6db2('0x1f')]('ShowSquareOdbc',_0x3662b5,JSON['stringify'](_0x27c4e4));_0x496397(_0x27c4e4);})[_0x6db2('0x15')](function(_0x4e9d54){logger[_0x6db2('0x12')](_0x6db2('0x16'),_0x4e9d54[_0x6db2('0x13')],_0x3662b5);_0x41911b(_0x2102a8[_0x6db2('0x12')](0x1f4,_0x4e9d54['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 0340689..4311d9d 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 _0xd2ed=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','getUsers','create','/:id/users','addUsers','put','/:id','update','delete','destroy','removeUsers','exports','multer','util','path'];(function(_0x5f17c5,_0x65d237){var _0x3a2fd0=function(_0x336532){while(--_0x336532){_0x5f17c5['push'](_0x5f17c5['shift']());}};_0x3a2fd0(++_0x65d237);}(_0xd2ed,0x14d));var _0xdd2e=function(_0x843568,_0x300289){_0x843568=_0x843568-0x0;var _0x36e6aa=_0xd2ed[_0x843568];return _0x36e6aa;};'use strict';var multer=require(_0xdd2e('0x0'));var util=require(_0xdd2e('0x1'));var path=require(_0xdd2e('0x2'));var timeout=require(_0xdd2e('0x3'));var express=require(_0xdd2e('0x4'));var router=express[_0xdd2e('0x5')]();var fs_extra=require(_0xdd2e('0x6'));var auth=require(_0xdd2e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdd2e('0x8'));var controller=require('./squareProject.controller');router[_0xdd2e('0x9')]('/',auth[_0xdd2e('0xa')](),controller[_0xdd2e('0xb')]);router[_0xdd2e('0x9')]('/:id',auth[_0xdd2e('0xa')](),controller[_0xdd2e('0xc')]);router[_0xdd2e('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xdd2e('0xd')]);router['post']('/',auth[_0xdd2e('0xa')](),controller[_0xdd2e('0xe')]);router['post'](_0xdd2e('0xf'),auth['isAuthenticated'](),controller[_0xdd2e('0x10')]);router[_0xdd2e('0x11')](_0xdd2e('0x12'),auth['isAuthenticated'](),controller[_0xdd2e('0x13')]);router[_0xdd2e('0x14')](_0xdd2e('0x12'),auth[_0xdd2e('0xa')](),controller[_0xdd2e('0x15')]);router['delete'](_0xdd2e('0xf'),auth[_0xdd2e('0xa')](),controller[_0xdd2e('0x16')]);module[_0xdd2e('0x17')]=router; \ No newline at end of file +var _0xf29d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','addUsers','put','update','destroy','delete','removeUsers','exports','multer','util'];(function(_0x1832a2,_0xd3f339){var _0x2300a8=function(_0x3135be){while(--_0x3135be){_0x1832a2['push'](_0x1832a2['shift']());}};_0x2300a8(++_0xd3f339);}(_0xf29d,0xc4));var _0xdf29=function(_0x639b26,_0x368cb0){_0x639b26=_0x639b26-0x0;var _0x50b4df=_0xf29d[_0x639b26];return _0x50b4df;};'use strict';var multer=require(_0xdf29('0x0'));var util=require(_0xdf29('0x1'));var path=require('path');var timeout=require(_0xdf29('0x2'));var express=require(_0xdf29('0x3'));var router=express[_0xdf29('0x4')]();var fs_extra=require(_0xdf29('0x5'));var auth=require(_0xdf29('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0xdf29('0x7')]('/',auth[_0xdf29('0x8')](),controller[_0xdf29('0x9')]);router['get'](_0xdf29('0xa'),auth[_0xdf29('0x8')](),controller[_0xdf29('0xb')]);router['get'](_0xdf29('0xc'),auth[_0xdf29('0x8')](),controller[_0xdf29('0xd')]);router[_0xdf29('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdf29('0xe')](_0xdf29('0xc'),auth['isAuthenticated'](),controller[_0xdf29('0xf')]);router[_0xdf29('0x10')](_0xdf29('0xa'),auth[_0xdf29('0x8')](),controller[_0xdf29('0x11')]);router['delete'](_0xdf29('0xa'),auth['isAuthenticated'](),controller[_0xdf29('0x12')]);router[_0xdf29('0x13')](_0xdf29('0xc'),auth['isAuthenticated'](),controller[_0xdf29('0x14')]);module[_0xdf29('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 30b8667..f294705 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 _0x225b=['STRING','BLOB','getDataValue','preproduction','toString','utf8','long','production','DATE','sequelize','exports','name'];(function(_0x275548,_0x3ea487){var _0x300f40=function(_0x88c690){while(--_0x88c690){_0x275548['push'](_0x275548['shift']());}};_0x300f40(++_0x3ea487);}(_0x225b,0xb1));var _0xb225=function(_0x5e5a48,_0x16e6f7){_0x5e5a48=_0x5e5a48-0x0;var _0x546f54=_0x225b[_0x5e5a48];return _0x546f54;};'use strict';var Sequelize=require(_0xb225('0x0'));module[_0xb225('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb225('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb225('0x3')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xb225('0x4')]('long'),'get':function(){if(this[_0xb225('0x5')]('preproduction')){return this[_0xb225('0x5')](_0xb225('0x6'))[_0xb225('0x7')](_0xb225('0x8'));}}},'production':{'type':Sequelize[_0xb225('0x4')](_0xb225('0x9')),'get':function(){if(this[_0xb225('0x5')]('production')){return this[_0xb225('0x5')](_0xb225('0xa'))[_0xb225('0x7')](_0xb225('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xb225('0xb')]}}; \ No newline at end of file +var _0xa2e7=['getDataValue','toString','utf8','production','DATE','sequelize','exports','STRING','name','BLOB','long','preproduction'];(function(_0x27141b,_0x336862){var _0x55a310=function(_0x26fea5){while(--_0x26fea5){_0x27141b['push'](_0x27141b['shift']());}};_0x55a310(++_0x336862);}(_0xa2e7,0x95));var _0x7a2e=function(_0x1c49cf,_0x3bbc11){_0x1c49cf=_0x1c49cf-0x0;var _0x53e567=_0xa2e7[_0x1c49cf];return _0x53e567;};'use strict';var Sequelize=require(_0x7a2e('0x0'));module[_0x7a2e('0x1')]={'name':{'type':Sequelize[_0x7a2e('0x2')],'unique':_0x7a2e('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x7a2e('0x4')](_0x7a2e('0x5')),'get':function(){if(this['getDataValue'](_0x7a2e('0x6'))){return this[_0x7a2e('0x7')](_0x7a2e('0x6'))[_0x7a2e('0x8')](_0x7a2e('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x7a2e('0x5')),'get':function(){if(this[_0x7a2e('0x7')](_0x7a2e('0xa'))){return this[_0x7a2e('0x7')](_0x7a2e('0xa'))['toString'](_0x7a2e('0x9'));}}},'savedAt':{'type':Sequelize[_0x7a2e('0xb')]},'publishedAt':{'type':Sequelize[_0x7a2e('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 8d8c63c..026e748 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 _0x3724=['omit','ids','removeUsers','isArray','length','userSquareProject:remove','emit','getUsers','findOne','User','order','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','name','index','map','SquareProject','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers'];(function(_0x4269a3,_0x238abf){var _0x590de3=function(_0xa05c91){while(--_0xa05c91){_0x4269a3['push'](_0x4269a3['shift']());}};_0x590de3(++_0x238abf);}(_0x3724,0xcb));var _0x4372=function(_0x31004c,_0x503c2e){_0x31004c=_0x31004c-0x0;var _0x399a98=_0x3724[_0x31004c];return _0x399a98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4372('0x0'));var zipdir=require(_0x4372('0x1'));var jsonpatch=require(_0x4372('0x2'));var rp=require('request-promise');var moment=require(_0x4372('0x3'));var BPromise=require(_0x4372('0x4'));var Mustache=require(_0x4372('0x5'));var util=require(_0x4372('0x6'));var path=require('path');var sox=require(_0x4372('0x7'));var csv=require(_0x4372('0x8'));var ejs=require(_0x4372('0x9'));var fs=require('fs');var fs_extra=require(_0x4372('0xa'));var _=require(_0x4372('0xb'));var squel=require(_0x4372('0xc'));var crypto=require(_0x4372('0xd'));var jsforce=require(_0x4372('0xe'));var deskjs=require(_0x4372('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4372('0x10'));var authService=require(_0x4372('0x11'));var qs=require(_0x4372('0x12'));var as=require(_0x4372('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4372('0x14'))(_0x4372('0x15'));var utils=require('../../config/utils');var config=require(_0x4372('0x16'));var licenseUtil=require(_0x4372('0x17'));var db=require('../../mysqldb')['db'];config[_0x4372('0x18')]=_[_0x4372('0x19')](config[_0x4372('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x4372('0x1a'))(new Redis(config[_0x4372('0x18')]));require(_0x4372('0x1b'))[_0x4372('0x1c')](socket);function respondWithStatusCode(_0x1b54ff,_0x9aae2a){_0x9aae2a=_0x9aae2a||0xcc;return function(_0x52bbd4){if(_0x52bbd4){return _0x1b54ff[_0x4372('0x1d')](_0x9aae2a);}return _0x1b54ff[_0x4372('0x1e')](_0x9aae2a)[_0x4372('0x1f')]();};}function respondWithResult(_0x2f25cd,_0xef6320){_0xef6320=_0xef6320||0xc8;return function(_0x3eb788){if(_0x3eb788){return _0x2f25cd[_0x4372('0x1e')](_0xef6320)['json'](_0x3eb788);}};}function respondWithFilteredResult(_0x526eba,_0x42c4d6){return function(_0x41c018){if(_0x41c018){var _0x31c9db=typeof _0x42c4d6[_0x4372('0x20')]==='undefined'&&typeof _0x42c4d6[_0x4372('0x21')]===_0x4372('0x22');var _0x44d78b=_0x41c018['count'];var _0xa4c00c=_0x31c9db?0x0:_0x42c4d6[_0x4372('0x20')];var _0x39c6e5=_0x31c9db?_0x41c018[_0x4372('0x23')]:_0x42c4d6['offset']+_0x42c4d6[_0x4372('0x21')];var _0x214962;if(_0x39c6e5>=_0x44d78b){_0x39c6e5=_0x44d78b;_0x214962=0xc8;}else{_0x214962=0xce;}_0x526eba[_0x4372('0x1e')](_0x214962);return _0x526eba['set'](_0x4372('0x24'),_0xa4c00c+'-'+_0x39c6e5+'/'+_0x44d78b)['json'](_0x41c018);}return null;};}function patchUpdates(_0x462910){return function(_0x275f46){try{jsonpatch['apply'](_0x275f46,_0x462910,!![]);}catch(_0x5362ec){return BPromise[_0x4372('0x25')](_0x5362ec);}return _0x275f46[_0x4372('0x26')]();};}function saveUpdates(_0x35a323,_0xf632ab){return function(_0x3a053b){if(_0x3a053b){return _0x3a053b[_0x4372('0x27')](_0x35a323)[_0x4372('0x28')](function(_0xdb9b6a){return _0xdb9b6a;});}return null;};}function removeEntity(_0x4eb019,_0x24dac7){return function(_0x678730){if(_0x678730){return _0x678730[_0x4372('0x29')]()[_0x4372('0x28')](function(){var _0x2f6504=_0x678730[_0x4372('0x2a')]({'plain':!![]});var _0x4b6729=_0x4372('0x2b');return db[_0x4372('0x2c')][_0x4372('0x29')]({'where':{'type':_0x4b6729,'resourceId':_0x2f6504['id']}})[_0x4372('0x28')](function(){return _0x678730;});})[_0x4372('0x28')](function(){_0x4eb019['status'](0xcc)[_0x4372('0x1f')]();});}};}function handleEntityNotFound(_0x196824,_0x3e72a9){return function(_0x1961c3){if(!_0x1961c3){_0x196824[_0x4372('0x1d')](0x194);}return _0x1961c3;};}function handleError(_0x4921f6,_0x2f4d27){_0x2f4d27=_0x2f4d27||0x1f4;return function(_0x3dc53c){logger[_0x4372('0x2d')](_0x3dc53c['stack']);if(_0x3dc53c['name']){delete _0x3dc53c[_0x4372('0x2e')];}_0x4921f6['status'](_0x2f4d27)['send'](_0x3dc53c);};}exports[_0x4372('0x2f')]=function(_0x2cce5b,_0x53a1be){var _0x648ee7={},_0x3da81d={},_0x15a476={'count':0x0,'rows':[]};var _0x3badde=_[_0x4372('0x30')](db[_0x4372('0x31')][_0x4372('0x32')],function(_0x15935b){return{'name':_0x15935b['fieldName'],'type':_0x15935b[_0x4372('0x33')][_0x4372('0x34')]};});_0x3da81d[_0x4372('0x35')]=_[_0x4372('0x30')](_0x3badde,'name');_0x3da81d[_0x4372('0x36')]=_[_0x4372('0x37')](_0x2cce5b[_0x4372('0x36')]);_0x3da81d[_0x4372('0x38')]=_[_0x4372('0x39')](_0x3da81d[_0x4372('0x35')],_0x3da81d[_0x4372('0x36')]);_0x648ee7[_0x4372('0x3a')]=_[_0x4372('0x39')](_0x3da81d[_0x4372('0x35')],qs['fields'](_0x2cce5b[_0x4372('0x36')][_0x4372('0x3b')]));_0x648ee7[_0x4372('0x3a')]=_0x648ee7[_0x4372('0x3a')]['length']?_0x648ee7['attributes']:_0x3da81d[_0x4372('0x35')];if(!_0x2cce5b[_0x4372('0x36')][_0x4372('0x3c')](_0x4372('0x3d'))){_0x648ee7['limit']=qs[_0x4372('0x21')](_0x2cce5b[_0x4372('0x36')]['limit']);_0x648ee7[_0x4372('0x20')]=qs[_0x4372('0x20')](_0x2cce5b[_0x4372('0x36')][_0x4372('0x20')]);}_0x648ee7['order']=qs['sort'](_0x2cce5b[_0x4372('0x36')][_0x4372('0x3e')]);_0x648ee7[_0x4372('0x3f')]=qs[_0x4372('0x38')](_[_0x4372('0x40')](_0x2cce5b[_0x4372('0x36')],_0x3da81d[_0x4372('0x38')]),_0x3badde);if(_0x2cce5b[_0x4372('0x36')][_0x4372('0x41')]){_0x648ee7[_0x4372('0x3f')]=_[_0x4372('0x42')](_0x648ee7[_0x4372('0x3f')],{'$or':_['map'](_0x3badde,function(_0x475023){if(_0x475023['type']!=='VIRTUAL'){var _0x2ac77a={};_0x2ac77a[_0x475023[_0x4372('0x2e')]]={'$like':'%'+_0x2cce5b[_0x4372('0x36')][_0x4372('0x41')]+'%'};return _0x2ac77a;}})});}_0x648ee7=_[_0x4372('0x42')]({},_0x648ee7,_0x2cce5b[_0x4372('0x43')]);var _0x5b65e0={'where':_0x648ee7['where']};return db[_0x4372('0x31')]['count'](_0x5b65e0)[_0x4372('0x28')](function(_0x55ae83){_0x15a476[_0x4372('0x23')]=_0x55ae83;if(_0x2cce5b[_0x4372('0x36')]['includeAll']){_0x648ee7[_0x4372('0x44')]=[{'all':!![]}];}return db[_0x4372('0x31')][_0x4372('0x45')](_0x648ee7);})['then'](function(_0x3dab06){_0x15a476[_0x4372('0x46')]=_0x3dab06;return _0x15a476;})['then'](respondWithFilteredResult(_0x53a1be,_0x648ee7))[_0x4372('0x47')](handleError(_0x53a1be,null));};exports['show']=function(_0x1e69a4,_0x2eb983){var _0x4f839e={'raw':![],'where':{'id':_0x1e69a4[_0x4372('0x48')]['id']}},_0x2010c3={};_0x2010c3[_0x4372('0x35')]=_[_0x4372('0x37')](db['SquareProject'][_0x4372('0x32')]);_0x2010c3[_0x4372('0x36')]=_[_0x4372('0x37')](_0x1e69a4['query']);_0x2010c3['filters']=_['intersection'](_0x2010c3[_0x4372('0x35')],_0x2010c3[_0x4372('0x36')]);_0x4f839e['attributes']=_[_0x4372('0x39')](_0x2010c3['model'],qs[_0x4372('0x3b')](_0x1e69a4[_0x4372('0x36')][_0x4372('0x3b')]));_0x4f839e[_0x4372('0x3a')]=_0x4f839e[_0x4372('0x3a')]['length']?_0x4f839e[_0x4372('0x3a')]:_0x2010c3[_0x4372('0x35')];if(_0x1e69a4[_0x4372('0x36')][_0x4372('0x49')]){_0x4f839e[_0x4372('0x44')]=[{'all':!![]}];}_0x4f839e=_[_0x4372('0x42')]({},_0x4f839e,_0x1e69a4['options']);return db[_0x4372('0x31')][_0x4372('0x4a')](_0x4f839e)[_0x4372('0x28')](handleEntityNotFound(_0x2eb983,null))[_0x4372('0x28')](respondWithResult(_0x2eb983,null))[_0x4372('0x47')](handleError(_0x2eb983,null));};exports[_0x4372('0x4b')]=function(_0x383356,_0x56de09){return db['SquareProject'][_0x4372('0x4b')](_0x383356[_0x4372('0x4c')],{})[_0x4372('0x28')](function(_0x78927d){var _0x595153=_0x383356['user'][_0x4372('0x2a')]({'plain':!![]});if(!_0x595153)throw new Error(_0x4372('0x4d'));if(_0x595153[_0x4372('0x4e')]===_0x4372('0x4f')){var _0x264f71=_0x78927d['get']({'plain':!![]});var _0x376635=_0x4372('0x2b');return db[_0x4372('0x50')][_0x4372('0x4a')]({'where':{'name':_0x376635,'userProfileId':_0x595153[_0x4372('0x51')]},'raw':!![]})[_0x4372('0x28')](function(_0x53fc6a){if(_0x53fc6a&&_0x53fc6a[_0x4372('0x52')]===0x0){return db[_0x4372('0x2c')][_0x4372('0x4b')]({'name':_0x264f71[_0x4372('0x2e')],'resourceId':_0x264f71['id'],'type':_0x53fc6a['name'],'sectionId':_0x53fc6a['id']},{})[_0x4372('0x28')](function(){return _0x78927d;});}else{return _0x78927d;}})[_0x4372('0x47')](function(_0x5909d5){logger[_0x4372('0x2d')](_0x4372('0x53'),_0x5909d5);throw _0x5909d5;});}return _0x78927d;})[_0x4372('0x28')](respondWithResult(_0x56de09,0xc9))[_0x4372('0x47')](handleError(_0x56de09,null));};exports[_0x4372('0x27')]=function(_0x5cf86b,_0x31b81c){if(_0x5cf86b[_0x4372('0x4c')]['id']){delete _0x5cf86b[_0x4372('0x4c')]['id'];}return db[_0x4372('0x31')]['find']({'where':{'id':_0x5cf86b[_0x4372('0x48')]['id']}})[_0x4372('0x28')](handleEntityNotFound(_0x31b81c,null))[_0x4372('0x28')](saveUpdates(_0x5cf86b['body'],null))[_0x4372('0x28')](respondWithResult(_0x31b81c,null))[_0x4372('0x47')](handleError(_0x31b81c,null));};exports[_0x4372('0x29')]=function(_0x3b75ed,_0xac3d5d){return db[_0x4372('0x31')][_0x4372('0x4a')]({'where':{'id':_0x3b75ed[_0x4372('0x48')]['id']}})[_0x4372('0x28')](handleEntityNotFound(_0xac3d5d,null))[_0x4372('0x28')](removeEntity(_0xac3d5d,null))[_0x4372('0x47')](handleError(_0xac3d5d,null));};exports[_0x4372('0x54')]=function(_0x43f8d0,_0x3867a6,_0x3fcc23){return db[_0x4372('0x31')]['find']({'where':{'id':_0x43f8d0[_0x4372('0x48')]['id']}})['then'](handleEntityNotFound(_0x3867a6,null))[_0x4372('0x28')](function(_0x524310){if(_0x524310){return _0x524310[_0x4372('0x54')](_0x43f8d0['body']['ids'],_[_0x4372('0x55')](_0x43f8d0[_0x4372('0x4c')],[_0x4372('0x56'),'id'])||{});}})[_0x4372('0x28')](respondWithResult(_0x3867a6,null))[_0x4372('0x47')](handleError(_0x3867a6,null));};exports[_0x4372('0x57')]=function(_0x364949,_0x385cb7,_0x17762d){return db[_0x4372('0x31')]['find']({'where':{'id':_0x364949[_0x4372('0x48')]['id']}})[_0x4372('0x28')](handleEntityNotFound(_0x385cb7,null))['then'](function(_0x2ba673){if(_0x2ba673){return _0x2ba673[_0x4372('0x57')](_0x364949[_0x4372('0x36')][_0x4372('0x56')])[_0x4372('0x28')](function(){if(_[_0x4372('0x58')](_0x364949[_0x4372('0x36')][_0x4372('0x56')])){for(var _0x3ee69a=0x0;_0x3ee69a<_0x364949[_0x4372('0x36')][_0x4372('0x56')][_0x4372('0x59')];_0x3ee69a+=0x1){socket['emit'](_0x4372('0x5a'),{'UserId':Number(_0x364949['query'][_0x4372('0x56')][_0x3ee69a]),'SquareProjectId':Number(_0x364949['params']['id'])});}}else{socket[_0x4372('0x5b')](_0x4372('0x5a'),{'UserId':Number(_0x364949[_0x4372('0x36')][_0x4372('0x56')]),'SquareProjectId':Number(_0x364949[_0x4372('0x48')]['id'])});}});}})[_0x4372('0x28')](respondWithStatusCode(_0x385cb7,null))[_0x4372('0x47')](handleError(_0x385cb7,null));};exports[_0x4372('0x5c')]=function(_0x2f742a,_0x58205d,_0x2b0aad){var _0x5d9f5e={};var _0x215cc5={};var _0x5bf2d6;var _0x34995a;return db[_0x4372('0x31')][_0x4372('0x5d')]({'where':{'id':_0x2f742a[_0x4372('0x48')]['id']}})[_0x4372('0x28')](handleEntityNotFound(_0x58205d,null))['then'](function(_0x49cfe8){if(_0x49cfe8){_0x5bf2d6=_0x49cfe8;_0x215cc5[_0x4372('0x35')]=_['keys'](db[_0x4372('0x5e')][_0x4372('0x32')]);_0x215cc5[_0x4372('0x36')]=_[_0x4372('0x37')](_0x2f742a[_0x4372('0x36')]);_0x215cc5['filters']=_['intersection'](_0x215cc5[_0x4372('0x35')],_0x215cc5[_0x4372('0x36')]);_0x5d9f5e[_0x4372('0x3a')]=_['intersection'](_0x215cc5[_0x4372('0x35')],qs[_0x4372('0x3b')](_0x2f742a[_0x4372('0x36')]['fields']));_0x5d9f5e[_0x4372('0x3a')]=_0x5d9f5e[_0x4372('0x3a')][_0x4372('0x59')]?_0x5d9f5e['attributes']:_0x215cc5[_0x4372('0x35')];_0x5d9f5e[_0x4372('0x5f')]=qs[_0x4372('0x3e')](_0x2f742a['query'][_0x4372('0x3e')]);_0x5d9f5e[_0x4372('0x3f')]=qs[_0x4372('0x38')](_[_0x4372('0x40')](_0x2f742a[_0x4372('0x36')],_0x215cc5[_0x4372('0x38')]));if(_0x2f742a[_0x4372('0x36')]['filter']){_0x5d9f5e[_0x4372('0x3f')]=_[_0x4372('0x42')](_0x5d9f5e['where'],{'$or':_[_0x4372('0x30')](_0x5d9f5e['attributes'],function(_0x5b22ab){var _0x1b2412={};_0x1b2412[_0x5b22ab]={'$like':'%'+_0x2f742a['query'][_0x4372('0x41')]+'%'};return _0x1b2412;})});}_0x5d9f5e=_['merge']({},_0x5d9f5e,_0x2f742a[_0x4372('0x43')]);return _0x5bf2d6['getUsers'](_0x5d9f5e);}})[_0x4372('0x28')](function(_0x448520){if(_0x448520){_0x34995a=_0x448520[_0x4372('0x59')];if(!_0x2f742a[_0x4372('0x36')][_0x4372('0x3c')](_0x4372('0x3d'))){_0x5d9f5e[_0x4372('0x21')]=qs['limit'](_0x2f742a[_0x4372('0x36')][_0x4372('0x21')]);_0x5d9f5e['offset']=qs[_0x4372('0x20')](_0x2f742a['query'][_0x4372('0x20')]);}return _0x5bf2d6[_0x4372('0x5c')](_0x5d9f5e);}})[_0x4372('0x28')](function(_0x402a63){if(_0x402a63){return _0x402a63?{'count':_0x34995a,'rows':_0x402a63}:null;}})['then'](respondWithResult(_0x58205d,null))[_0x4372('0x47')](handleError(_0x58205d,null));}; \ No newline at end of file +var _0xdd98=['keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','rows','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','update','then','destroy','SquareProjects','UserProfileResource','error','stack','name','send','index','map','SquareProject','rawAttributes','type','query'];(function(_0x3a634e,_0x273db2){var _0x2ecddb=function(_0x3a9d2d){while(--_0x3a9d2d){_0x3a634e['push'](_0x3a634e['shift']());}};_0x2ecddb(++_0x273db2);}(_0xdd98,0x1ed));var _0x8dd9=function(_0x3a8b7c,_0x3e5db2){_0x3a8b7c=_0x3a8b7c-0x0;var _0x40eb80=_0xdd98[_0x3a8b7c];return _0x40eb80;};'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(_0x8dd9('0x0'));var moment=require(_0x8dd9('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8dd9('0x2'));var util=require(_0x8dd9('0x3'));var path=require(_0x8dd9('0x4'));var sox=require('sox');var csv=require(_0x8dd9('0x5'));var ejs=require(_0x8dd9('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8dd9('0x7'));var squel=require(_0x8dd9('0x8'));var crypto=require(_0x8dd9('0x9'));var jsforce=require(_0x8dd9('0xa'));var deskjs=require(_0x8dd9('0xb'));var toCsv=require(_0x8dd9('0x5'));var querystring=require(_0x8dd9('0xc'));var Papa=require(_0x8dd9('0xd'));var Redis=require(_0x8dd9('0xe'));var authService=require(_0x8dd9('0xf'));var qs=require(_0x8dd9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dd9('0x11'));var logger=require('../../config/logger')(_0x8dd9('0x12'));var utils=require(_0x8dd9('0x13'));var config=require(_0x8dd9('0x14'));var licenseUtil=require(_0x8dd9('0x15'));var db=require(_0x8dd9('0x16'))['db'];config[_0x8dd9('0x17')]=_[_0x8dd9('0x18')](config['redis'],{'host':_0x8dd9('0x19'),'port':0x18eb});var socket=require(_0x8dd9('0x1a'))(new Redis(config[_0x8dd9('0x17')]));require(_0x8dd9('0x1b'))[_0x8dd9('0x1c')](socket);function respondWithStatusCode(_0x5a9958,_0x866fd){_0x866fd=_0x866fd||0xcc;return function(_0x301fe9){if(_0x301fe9){return _0x5a9958[_0x8dd9('0x1d')](_0x866fd);}return _0x5a9958[_0x8dd9('0x1e')](_0x866fd)[_0x8dd9('0x1f')]();};}function respondWithResult(_0x4ecbed,_0x58e447){_0x58e447=_0x58e447||0xc8;return function(_0x5f3df0){if(_0x5f3df0){return _0x4ecbed[_0x8dd9('0x1e')](_0x58e447)[_0x8dd9('0x20')](_0x5f3df0);}};}function respondWithFilteredResult(_0x2b0544,_0x3f74c9){return function(_0x1c31f1){if(_0x1c31f1){var _0x395a1f=typeof _0x3f74c9['offset']===_0x8dd9('0x21')&&typeof _0x3f74c9[_0x8dd9('0x22')]===_0x8dd9('0x21');var _0x305c82=_0x1c31f1['count'];var _0x992a27=_0x395a1f?0x0:_0x3f74c9[_0x8dd9('0x23')];var _0x34d69b=_0x395a1f?_0x1c31f1['count']:_0x3f74c9[_0x8dd9('0x23')]+_0x3f74c9[_0x8dd9('0x22')];var _0x591d23;if(_0x34d69b>=_0x305c82){_0x34d69b=_0x305c82;_0x591d23=0xc8;}else{_0x591d23=0xce;}_0x2b0544[_0x8dd9('0x1e')](_0x591d23);return _0x2b0544[_0x8dd9('0x24')](_0x8dd9('0x25'),_0x992a27+'-'+_0x34d69b+'/'+_0x305c82)[_0x8dd9('0x20')](_0x1c31f1);}return null;};}function patchUpdates(_0x4099f0){return function(_0x122052){try{jsonpatch['apply'](_0x122052,_0x4099f0,!![]);}catch(_0x454b7b){return BPromise['reject'](_0x454b7b);}return _0x122052['save']();};}function saveUpdates(_0x1e10cc,_0x3a5a8b){return function(_0x60d73f){if(_0x60d73f){return _0x60d73f[_0x8dd9('0x26')](_0x1e10cc)[_0x8dd9('0x27')](function(_0x42fb7f){return _0x42fb7f;});}return null;};}function removeEntity(_0x50fb72,_0x4480f0){return function(_0x38fb2c){if(_0x38fb2c){return _0x38fb2c[_0x8dd9('0x28')]()[_0x8dd9('0x27')](function(){var _0x165308=_0x38fb2c['get']({'plain':!![]});var _0x54f3b9=_0x8dd9('0x29');return db[_0x8dd9('0x2a')][_0x8dd9('0x28')]({'where':{'type':_0x54f3b9,'resourceId':_0x165308['id']}})[_0x8dd9('0x27')](function(){return _0x38fb2c;});})['then'](function(){_0x50fb72[_0x8dd9('0x1e')](0xcc)[_0x8dd9('0x1f')]();});}};}function handleEntityNotFound(_0x14a7b3,_0x150f10){return function(_0x21010f){if(!_0x21010f){_0x14a7b3['sendStatus'](0x194);}return _0x21010f;};}function handleError(_0x46e8ef,_0x1af07e){_0x1af07e=_0x1af07e||0x1f4;return function(_0x2bbd9f){logger[_0x8dd9('0x2b')](_0x2bbd9f[_0x8dd9('0x2c')]);if(_0x2bbd9f['name']){delete _0x2bbd9f[_0x8dd9('0x2d')];}_0x46e8ef[_0x8dd9('0x1e')](_0x1af07e)[_0x8dd9('0x2e')](_0x2bbd9f);};}exports[_0x8dd9('0x2f')]=function(_0x4a8ca0,_0x49a391){var _0x53e50b={},_0x5ab167={},_0x589b94={'count':0x0,'rows':[]};var _0x524ce7=_[_0x8dd9('0x30')](db[_0x8dd9('0x31')][_0x8dd9('0x32')],function(_0x23bbc9){return{'name':_0x23bbc9['fieldName'],'type':_0x23bbc9[_0x8dd9('0x33')]['key']};});_0x5ab167['model']=_[_0x8dd9('0x30')](_0x524ce7,_0x8dd9('0x2d'));_0x5ab167[_0x8dd9('0x34')]=_[_0x8dd9('0x35')](_0x4a8ca0[_0x8dd9('0x34')]);_0x5ab167['filters']=_['intersection'](_0x5ab167[_0x8dd9('0x36')],_0x5ab167[_0x8dd9('0x34')]);_0x53e50b[_0x8dd9('0x37')]=_[_0x8dd9('0x38')](_0x5ab167[_0x8dd9('0x36')],qs['fields'](_0x4a8ca0[_0x8dd9('0x34')][_0x8dd9('0x39')]));_0x53e50b[_0x8dd9('0x37')]=_0x53e50b[_0x8dd9('0x37')]['length']?_0x53e50b[_0x8dd9('0x37')]:_0x5ab167[_0x8dd9('0x36')];if(!_0x4a8ca0[_0x8dd9('0x34')][_0x8dd9('0x3a')](_0x8dd9('0x3b'))){_0x53e50b[_0x8dd9('0x22')]=qs[_0x8dd9('0x22')](_0x4a8ca0[_0x8dd9('0x34')][_0x8dd9('0x22')]);_0x53e50b[_0x8dd9('0x23')]=qs['offset'](_0x4a8ca0[_0x8dd9('0x34')][_0x8dd9('0x23')]);}_0x53e50b[_0x8dd9('0x3c')]=qs[_0x8dd9('0x3d')](_0x4a8ca0['query'][_0x8dd9('0x3d')]);_0x53e50b[_0x8dd9('0x3e')]=qs[_0x8dd9('0x3f')](_[_0x8dd9('0x40')](_0x4a8ca0[_0x8dd9('0x34')],_0x5ab167[_0x8dd9('0x3f')]),_0x524ce7);if(_0x4a8ca0[_0x8dd9('0x34')][_0x8dd9('0x41')]){_0x53e50b[_0x8dd9('0x3e')]=_[_0x8dd9('0x42')](_0x53e50b['where'],{'$or':_[_0x8dd9('0x30')](_0x524ce7,function(_0x23ad21){if(_0x23ad21['type']!=='VIRTUAL'){var _0x723b74={};_0x723b74[_0x23ad21[_0x8dd9('0x2d')]]={'$like':'%'+_0x4a8ca0[_0x8dd9('0x34')][_0x8dd9('0x41')]+'%'};return _0x723b74;}})});}_0x53e50b=_[_0x8dd9('0x42')]({},_0x53e50b,_0x4a8ca0['options']);var _0x3a214d={'where':_0x53e50b[_0x8dd9('0x3e')]};return db['SquareProject']['count'](_0x3a214d)[_0x8dd9('0x27')](function(_0x3c145b){_0x589b94['count']=_0x3c145b;if(_0x4a8ca0['query'][_0x8dd9('0x43')]){_0x53e50b[_0x8dd9('0x44')]=[{'all':!![]}];}return db[_0x8dd9('0x31')]['findAll'](_0x53e50b);})[_0x8dd9('0x27')](function(_0x2b5b46){_0x589b94[_0x8dd9('0x45')]=_0x2b5b46;return _0x589b94;})['then'](respondWithFilteredResult(_0x49a391,_0x53e50b))['catch'](handleError(_0x49a391,null));};exports['show']=function(_0x43368d,_0x24d371){var _0x3c2a3b={'raw':![],'where':{'id':_0x43368d['params']['id']}},_0x996de9={};_0x996de9[_0x8dd9('0x36')]=_[_0x8dd9('0x35')](db[_0x8dd9('0x31')][_0x8dd9('0x32')]);_0x996de9['query']=_['keys'](_0x43368d[_0x8dd9('0x34')]);_0x996de9['filters']=_[_0x8dd9('0x38')](_0x996de9[_0x8dd9('0x36')],_0x996de9[_0x8dd9('0x34')]);_0x3c2a3b[_0x8dd9('0x37')]=_[_0x8dd9('0x38')](_0x996de9[_0x8dd9('0x36')],qs[_0x8dd9('0x39')](_0x43368d[_0x8dd9('0x34')][_0x8dd9('0x39')]));_0x3c2a3b[_0x8dd9('0x37')]=_0x3c2a3b[_0x8dd9('0x37')][_0x8dd9('0x46')]?_0x3c2a3b[_0x8dd9('0x37')]:_0x996de9[_0x8dd9('0x36')];if(_0x43368d[_0x8dd9('0x34')][_0x8dd9('0x43')]){_0x3c2a3b[_0x8dd9('0x44')]=[{'all':!![]}];}_0x3c2a3b=_['merge']({},_0x3c2a3b,_0x43368d['options']);return db[_0x8dd9('0x31')][_0x8dd9('0x47')](_0x3c2a3b)[_0x8dd9('0x27')](handleEntityNotFound(_0x24d371,null))[_0x8dd9('0x27')](respondWithResult(_0x24d371,null))[_0x8dd9('0x48')](handleError(_0x24d371,null));};exports[_0x8dd9('0x49')]=function(_0x159f4f,_0x5800ed){return db['SquareProject'][_0x8dd9('0x49')](_0x159f4f[_0x8dd9('0x4a')],{})[_0x8dd9('0x27')](function(_0x143995){var _0x1bb1b6=_0x159f4f[_0x8dd9('0x4b')]['get']({'plain':!![]});if(!_0x1bb1b6)throw new Error(_0x8dd9('0x4c'));if(_0x1bb1b6['role']==='user'){var _0x5c3c04=_0x143995[_0x8dd9('0x4d')]({'plain':!![]});var _0x16a9d2='SquareProjects';return db['UserProfileSection'][_0x8dd9('0x47')]({'where':{'name':_0x16a9d2,'userProfileId':_0x1bb1b6[_0x8dd9('0x4e')]},'raw':!![]})['then'](function(_0x13292a){if(_0x13292a&&_0x13292a[_0x8dd9('0x4f')]===0x0){return db[_0x8dd9('0x2a')][_0x8dd9('0x49')]({'name':_0x5c3c04['name'],'resourceId':_0x5c3c04['id'],'type':_0x13292a['name'],'sectionId':_0x13292a['id']},{})[_0x8dd9('0x27')](function(){return _0x143995;});}else{return _0x143995;}})[_0x8dd9('0x48')](function(_0x5a866b){logger[_0x8dd9('0x2b')](_0x8dd9('0x50'),_0x5a866b);throw _0x5a866b;});}return _0x143995;})['then'](respondWithResult(_0x5800ed,0xc9))[_0x8dd9('0x48')](handleError(_0x5800ed,null));};exports[_0x8dd9('0x26')]=function(_0x45d8e6,_0x4b2563){if(_0x45d8e6[_0x8dd9('0x4a')]['id']){delete _0x45d8e6[_0x8dd9('0x4a')]['id'];}return db[_0x8dd9('0x31')][_0x8dd9('0x47')]({'where':{'id':_0x45d8e6['params']['id']}})['then'](handleEntityNotFound(_0x4b2563,null))[_0x8dd9('0x27')](saveUpdates(_0x45d8e6[_0x8dd9('0x4a')],null))['then'](respondWithResult(_0x4b2563,null))[_0x8dd9('0x48')](handleError(_0x4b2563,null));};exports[_0x8dd9('0x28')]=function(_0x268469,_0x411d23){return db[_0x8dd9('0x31')][_0x8dd9('0x47')]({'where':{'id':_0x268469[_0x8dd9('0x51')]['id']}})[_0x8dd9('0x27')](handleEntityNotFound(_0x411d23,null))[_0x8dd9('0x27')](removeEntity(_0x411d23,null))['catch'](handleError(_0x411d23,null));};exports[_0x8dd9('0x52')]=function(_0x36ecf6,_0x374d73,_0x22e213){return db[_0x8dd9('0x31')][_0x8dd9('0x47')]({'where':{'id':_0x36ecf6['params']['id']}})[_0x8dd9('0x27')](handleEntityNotFound(_0x374d73,null))['then'](function(_0x5014ed){if(_0x5014ed){return _0x5014ed['addUsers'](_0x36ecf6[_0x8dd9('0x4a')][_0x8dd9('0x53')],_[_0x8dd9('0x54')](_0x36ecf6['body'],[_0x8dd9('0x53'),'id'])||{});}})[_0x8dd9('0x27')](respondWithResult(_0x374d73,null))[_0x8dd9('0x48')](handleError(_0x374d73,null));};exports[_0x8dd9('0x55')]=function(_0x538e17,_0x45e678,_0x395dd9){return db[_0x8dd9('0x31')][_0x8dd9('0x47')]({'where':{'id':_0x538e17['params']['id']}})[_0x8dd9('0x27')](handleEntityNotFound(_0x45e678,null))[_0x8dd9('0x27')](function(_0x1cdd00){if(_0x1cdd00){return _0x1cdd00[_0x8dd9('0x55')](_0x538e17[_0x8dd9('0x34')][_0x8dd9('0x53')])[_0x8dd9('0x27')](function(){if(_[_0x8dd9('0x56')](_0x538e17[_0x8dd9('0x34')][_0x8dd9('0x53')])){for(var _0x37ea5b=0x0;_0x37ea5b<_0x538e17[_0x8dd9('0x34')]['ids'][_0x8dd9('0x46')];_0x37ea5b+=0x1){socket[_0x8dd9('0x57')](_0x8dd9('0x58'),{'UserId':Number(_0x538e17[_0x8dd9('0x34')][_0x8dd9('0x53')][_0x37ea5b]),'SquareProjectId':Number(_0x538e17[_0x8dd9('0x51')]['id'])});}}else{socket[_0x8dd9('0x57')]('userSquareProject:remove',{'UserId':Number(_0x538e17['query'][_0x8dd9('0x53')]),'SquareProjectId':Number(_0x538e17[_0x8dd9('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x45e678,null))[_0x8dd9('0x48')](handleError(_0x45e678,null));};exports[_0x8dd9('0x59')]=function(_0x5a9524,_0x10496c,_0x35168d){var _0x5a6df4={};var _0x3665a8={};var _0x30b23d;var _0xcbe8e8;return db[_0x8dd9('0x31')][_0x8dd9('0x5a')]({'where':{'id':_0x5a9524[_0x8dd9('0x51')]['id']}})[_0x8dd9('0x27')](handleEntityNotFound(_0x10496c,null))[_0x8dd9('0x27')](function(_0x22f96e){if(_0x22f96e){_0x30b23d=_0x22f96e;_0x3665a8[_0x8dd9('0x36')]=_[_0x8dd9('0x35')](db['User']['rawAttributes']);_0x3665a8['query']=_[_0x8dd9('0x35')](_0x5a9524[_0x8dd9('0x34')]);_0x3665a8[_0x8dd9('0x3f')]=_['intersection'](_0x3665a8[_0x8dd9('0x36')],_0x3665a8[_0x8dd9('0x34')]);_0x5a6df4[_0x8dd9('0x37')]=_['intersection'](_0x3665a8['model'],qs[_0x8dd9('0x39')](_0x5a9524['query'][_0x8dd9('0x39')]));_0x5a6df4[_0x8dd9('0x37')]=_0x5a6df4[_0x8dd9('0x37')][_0x8dd9('0x46')]?_0x5a6df4[_0x8dd9('0x37')]:_0x3665a8[_0x8dd9('0x36')];_0x5a6df4[_0x8dd9('0x3c')]=qs['sort'](_0x5a9524[_0x8dd9('0x34')][_0x8dd9('0x3d')]);_0x5a6df4[_0x8dd9('0x3e')]=qs[_0x8dd9('0x3f')](_[_0x8dd9('0x40')](_0x5a9524[_0x8dd9('0x34')],_0x3665a8[_0x8dd9('0x3f')]));if(_0x5a9524['query'][_0x8dd9('0x41')]){_0x5a6df4[_0x8dd9('0x3e')]=_[_0x8dd9('0x42')](_0x5a6df4['where'],{'$or':_[_0x8dd9('0x30')](_0x5a6df4['attributes'],function(_0x4f20){var _0x267964={};_0x267964[_0x4f20]={'$like':'%'+_0x5a9524[_0x8dd9('0x34')][_0x8dd9('0x41')]+'%'};return _0x267964;})});}_0x5a6df4=_[_0x8dd9('0x42')]({},_0x5a6df4,_0x5a9524['options']);return _0x30b23d['getUsers'](_0x5a6df4);}})['then'](function(_0x5298bf){if(_0x5298bf){_0xcbe8e8=_0x5298bf['length'];if(!_0x5a9524[_0x8dd9('0x34')]['hasOwnProperty'](_0x8dd9('0x3b'))){_0x5a6df4[_0x8dd9('0x22')]=qs[_0x8dd9('0x22')](_0x5a9524[_0x8dd9('0x34')]['limit']);_0x5a6df4['offset']=qs['offset'](_0x5a9524[_0x8dd9('0x34')][_0x8dd9('0x23')]);}return _0x30b23d['getUsers'](_0x5a6df4);}})['then'](function(_0x3b60d9){if(_0x3b60d9){return _0x3b60d9?{'count':_0xcbe8e8,'rows':_0x3b60d9}:null;}})[_0x8dd9('0x27')](respondWithResult(_0x10496c,null))['catch'](handleError(_0x10496c,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 5161beb..a20b841 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 _0xa9e2=['SquareProject','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x1f173e,_0xf7ce7d){var _0x5b2057=function(_0x7870fe){while(--_0x7870fe){_0x1f173e['push'](_0x1f173e['shift']());}};_0x5b2057(++_0xf7ce7d);}(_0xa9e2,0x18f));var _0x2a9e=function(_0x22655c,_0x330275){_0x22655c=_0x22655c-0x0;var _0x3c3388=_0xa9e2[_0x22655c];return _0x3c3388;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x2a9e('0x0'))['db'][_0x2a9e('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2a9e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2a9e('0x3')};function emitEvent(_0x48e0e8){return function(_0x134c39,_0x2cb9c4,_0x11dc2b){SquareProjectEvents[_0x2a9e('0x4')](_0x48e0e8+':'+_0x134c39['id'],_0x134c39);SquareProjectEvents[_0x2a9e('0x4')](_0x48e0e8,_0x134c39);_0x11dc2b(null);};}for(var e in events){if(events[_0x2a9e('0x5')](e)){var event=events[e];SquareProject[_0x2a9e('0x6')](e,emitEvent(event));}}module[_0x2a9e('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x669a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0x669a,0xac));var _0xa669=function(_0x23a33d,_0x3af01a){_0x23a33d=_0x23a33d-0x0;var _0x2636d6=_0x669a[_0x23a33d];return _0x2636d6;};'use strict';var EventEmitter=require(_0xa669('0x0'));var SquareProject=require(_0xa669('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa669('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa669('0x3'),'afterDestroy':_0xa669('0x4')};function emitEvent(_0x52f4d2){return function(_0x341bd2,_0x36e84c,_0x867af0){SquareProjectEvents[_0xa669('0x5')](_0x52f4d2+':'+_0x341bd2['id'],_0x341bd2);SquareProjectEvents['emit'](_0x52f4d2,_0x341bd2);_0x867af0(null);};}for(var e in events){if(events[_0xa669('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xa669('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 29c9e32..3a28635 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 _0x9f3d=['changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects'];(function(_0x420f22,_0x16b6ea){var _0x573bc9=function(_0x2cfcba){while(--_0x2cfcba){_0x420f22['push'](_0x420f22['shift']());}};_0x573bc9(++_0x16b6ea);}(_0x9f3d,0xf4));var _0xd9f3=function(_0x23e562,_0x986950){_0x23e562=_0x23e562-0x0;var _0xe59f01=_0x9f3d[_0x23e562];return _0xe59f01;};'use strict';var _=require('lodash');var util=require(_0xd9f3('0x0'));var logger=require(_0xd9f3('0x1'))(_0xd9f3('0x2'));var moment=require('moment');var BPromise=require(_0xd9f3('0x3'));var rp=require(_0xd9f3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9f3('0x5'));var config=require(_0xd9f3('0x6'));var attributes=require(_0xd9f3('0x7'));module[_0xd9f3('0x8')]=function(_0x553049,_0x53926a){return _0x553049['define'](_0xd9f3('0x9'),attributes,{'tableName':_0xd9f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e263c,_0x50180b,_0x1a267f){if(_0x2e263c[_0xd9f3('0xb')](_0xd9f3('0xc'))){_0x2e263c['savedAt']=moment()[_0xd9f3('0xd')](_0xd9f3('0xe'));}if(_0x2e263c[_0xd9f3('0xb')](_0xd9f3('0xf'))){_0x2e263c[_0xd9f3('0x10')]=moment()[_0xd9f3('0xd')](_0xd9f3('0xe'));}_0x1a267f(null,_0x2e263c);}}});}; \ No newline at end of file +var _0xe630=['changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SquareProject','square_projects'];(function(_0x4ffa77,_0x62a08f){var _0x197747=function(_0x568882){while(--_0x568882){_0x4ffa77['push'](_0x4ffa77['shift']());}};_0x197747(++_0x62a08f);}(_0xe630,0x65));var _0x0e63=function(_0x1de0b9,_0xc6f046){_0x1de0b9=_0x1de0b9-0x0;var _0x18edae=_0xe630[_0x1de0b9];return _0x18edae;};'use strict';var _=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var logger=require(_0x0e63('0x2'))(_0x0e63('0x3'));var moment=require(_0x0e63('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e63('0x5'));var fs=require('fs');var path=require(_0x0e63('0x6'));var rimraf=require(_0x0e63('0x7'));var config=require(_0x0e63('0x8'));var attributes=require('./squareProject.attributes');module[_0x0e63('0x9')]=function(_0x483031,_0x273bef){return _0x483031[_0x0e63('0xa')](_0x0e63('0xb'),attributes,{'tableName':_0x0e63('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33582a,_0x612df5,_0x3fc186){if(_0x33582a[_0x0e63('0xd')](_0x0e63('0xe'))){_0x33582a[_0x0e63('0xf')]=moment()[_0x0e63('0x10')](_0x0e63('0x11'));}if(_0x33582a[_0x0e63('0xd')]('production')){_0x33582a[_0x0e63('0x12')]=moment()[_0x0e63('0x10')](_0x0e63('0x11'));}_0x3fc186(null,_0x33582a);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 58d77a1..26bf790 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 _0x6d9f=['ShowSquareProject','debug','lodash','util','moment','../../mysqldb','../../config/logger','rpc','client','defaults','localhost','redis','./squareProject.socket','register','request','then','info','request\x20sent','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','SquareProject','options','raw','attributes','include','model','map'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x6d9f,0x1c2));var _0xf6d9=function(_0x340cd6,_0x270dc3){_0x340cd6=_0x340cd6-0x0;var _0x4ac807=_0x6d9f[_0x340cd6];return _0x4ac807;};'use strict';var _=require(_0xf6d9('0x0'));var util=require(_0xf6d9('0x1'));var moment=require(_0xf6d9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6d9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6d9('0x4'))(_0xf6d9('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf6d9('0x6')]['http']({'port':0x232a});config['redis']=_[_0xf6d9('0x7')](config['redis'],{'host':_0xf6d9('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6d9('0x9')]));require(_0xf6d9('0xa'))[_0xf6d9('0xb')](socket);function respondWithRpcPromise(_0x16006d,_0x30f5ef,_0x53f785){return new BPromise(function(_0x3b2e3c,_0x15001f){return client[_0xf6d9('0xc')](_0x16006d,_0x53f785)[_0xf6d9('0xd')](function(_0x183c7a){logger[_0xf6d9('0xe')]('SquareProject,\x20%s,\x20%s',_0x30f5ef,_0xf6d9('0xf'));logger['debug']('SquareProject,\x20%s,\x20%s,\x20%s',_0x30f5ef,_0xf6d9('0xf'),JSON[_0xf6d9('0x10')](_0x183c7a));if(_0x183c7a[_0xf6d9('0x11')]){if(_0x183c7a['error'][_0xf6d9('0x12')]===0x1f4){logger[_0xf6d9('0x11')](_0xf6d9('0x13'),_0x30f5ef,_0x183c7a['error']['message']);return _0x15001f(_0x183c7a[_0xf6d9('0x11')][_0xf6d9('0x14')]);}logger[_0xf6d9('0x11')](_0xf6d9('0x13'),_0x30f5ef,_0x183c7a[_0xf6d9('0x11')][_0xf6d9('0x14')]);return _0x3b2e3c(_0x183c7a[_0xf6d9('0x11')][_0xf6d9('0x14')]);}else{logger[_0xf6d9('0xe')](_0xf6d9('0x13'),_0x30f5ef,_0xf6d9('0xf'));_0x3b2e3c(_0x183c7a[_0xf6d9('0x15')][_0xf6d9('0x14')]);}})[_0xf6d9('0x16')](function(_0x16b0fa){logger['error']('SquareProject,\x20%s,\x20%s',_0x30f5ef,_0x16b0fa);_0x15001f(_0x16b0fa);});});}exports['ShowSquareProject']=function(_0x22b913){var _0x2a745f=this;return new Promise(function(_0xa1f631,_0x4de541){return db[_0xf6d9('0x17')]['find']({'raw':_0x22b913[_0xf6d9('0x18')]?_0x22b913[_0xf6d9('0x18')][_0xf6d9('0x19')]===undefined?!![]:![]:!![],'where':_0x22b913[_0xf6d9('0x18')]?_0x22b913[_0xf6d9('0x18')]['where']||null:null,'attributes':_0x22b913[_0xf6d9('0x18')]?_0x22b913[_0xf6d9('0x18')][_0xf6d9('0x1a')]||null:null,'include':_0x22b913[_0xf6d9('0x18')]?_0x22b913['options'][_0xf6d9('0x1b')]?_['map'](_0x22b913[_0xf6d9('0x18')][_0xf6d9('0x1b')],function(_0x235e72){return{'model':db[_0x235e72[_0xf6d9('0x1c')]],'as':_0x235e72['as'],'attributes':_0x235e72[_0xf6d9('0x1a')],'include':_0x235e72['include']?_[_0xf6d9('0x1d')](_0x235e72[_0xf6d9('0x1b')],function(_0x27b615){return{'model':db[_0x27b615[_0xf6d9('0x1c')]],'as':_0x27b615['as'],'attributes':_0x27b615[_0xf6d9('0x1a')],'include':_0x27b615[_0xf6d9('0x1b')]?_[_0xf6d9('0x1d')](_0x27b615[_0xf6d9('0x1b')],function(_0x214d6c){return{'model':db[_0x214d6c['model']],'as':_0x214d6c['as'],'attributes':_0x214d6c['attributes']};}):[]};}):[]};}):[]:[]})[_0xf6d9('0xd')](function(_0x4b7a6a){logger[_0xf6d9('0xe')](_0xf6d9('0x1e'),_0x22b913);logger[_0xf6d9('0x1f')](_0xf6d9('0x1e'),_0x22b913,JSON[_0xf6d9('0x10')](_0x4b7a6a));_0xa1f631(_0x4b7a6a);})['catch'](function(_0x104ef8){logger[_0xf6d9('0x11')](_0xf6d9('0x1e'),_0x104ef8['message'],_0x22b913);_0x4de541(_0x2a745f['error'](0x1f4,_0x104ef8[_0xf6d9('0x14')]));});});}; \ No newline at end of file +var _0xa552=['defaults','socket.io-emitter','./squareProject.socket','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','model','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xa552,0x1c9));var _0x2a55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa552[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2a55('0x0'));var util=require(_0x2a55('0x1'));var moment=require('moment');var BPromise=require(_0x2a55('0x2'));var rs=require(_0x2a55('0x3'));var fs=require('fs');var Redis=require(_0x2a55('0x4'));var db=require(_0x2a55('0x5'))['db'];var utils=require(_0x2a55('0x6'));var logger=require(_0x2a55('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2a55('0x8')][_0x2a55('0x9')]({'port':0x232a});config[_0x2a55('0xa')]=_[_0x2a55('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2a55('0xc'))(new Redis(config[_0x2a55('0xa')]));require(_0x2a55('0xd'))['register'](socket);function respondWithRpcPromise(_0x5a73a3,_0x27ffd1,_0x1f0fa2){return new BPromise(function(_0x1c5471,_0x2718e9){return client[_0x2a55('0xe')](_0x5a73a3,_0x1f0fa2)[_0x2a55('0xf')](function(_0xa64da6){logger[_0x2a55('0x10')](_0x2a55('0x11'),_0x27ffd1,_0x2a55('0x12'));logger[_0x2a55('0x13')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x27ffd1,_0x2a55('0x12'),JSON[_0x2a55('0x14')](_0xa64da6));if(_0xa64da6[_0x2a55('0x15')]){if(_0xa64da6[_0x2a55('0x15')][_0x2a55('0x16')]===0x1f4){logger[_0x2a55('0x15')]('SquareProject,\x20%s,\x20%s',_0x27ffd1,_0xa64da6[_0x2a55('0x15')][_0x2a55('0x17')]);return _0x2718e9(_0xa64da6[_0x2a55('0x15')][_0x2a55('0x17')]);}logger[_0x2a55('0x15')]('SquareProject,\x20%s,\x20%s',_0x27ffd1,_0xa64da6[_0x2a55('0x15')][_0x2a55('0x17')]);return _0x1c5471(_0xa64da6[_0x2a55('0x15')][_0x2a55('0x17')]);}else{logger[_0x2a55('0x10')](_0x2a55('0x11'),_0x27ffd1,_0x2a55('0x12'));_0x1c5471(_0xa64da6[_0x2a55('0x18')]['message']);}})[_0x2a55('0x19')](function(_0x37dffd){logger[_0x2a55('0x15')](_0x2a55('0x11'),_0x27ffd1,_0x37dffd);_0x2718e9(_0x37dffd);});});}exports[_0x2a55('0x1a')]=function(_0x4f64e7){var _0x48a3ad=this;return new Promise(function(_0x55bcff,_0x3f0376){return db[_0x2a55('0x1b')][_0x2a55('0x1c')]({'raw':_0x4f64e7[_0x2a55('0x1d')]?_0x4f64e7[_0x2a55('0x1d')][_0x2a55('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f64e7[_0x2a55('0x1d')]?_0x4f64e7['options'][_0x2a55('0x1f')]||null:null,'attributes':_0x4f64e7[_0x2a55('0x1d')]?_0x4f64e7[_0x2a55('0x1d')][_0x2a55('0x20')]||null:null,'include':_0x4f64e7[_0x2a55('0x1d')]?_0x4f64e7['options'][_0x2a55('0x21')]?_['map'](_0x4f64e7[_0x2a55('0x1d')][_0x2a55('0x21')],function(_0x2c9900){return{'model':db[_0x2c9900[_0x2a55('0x22')]],'as':_0x2c9900['as'],'attributes':_0x2c9900[_0x2a55('0x20')],'include':_0x2c9900[_0x2a55('0x21')]?_['map'](_0x2c9900[_0x2a55('0x21')],function(_0x28d56e){return{'model':db[_0x28d56e['model']],'as':_0x28d56e['as'],'attributes':_0x28d56e[_0x2a55('0x20')],'include':_0x28d56e[_0x2a55('0x21')]?_[_0x2a55('0x23')](_0x28d56e[_0x2a55('0x21')],function(_0x4da554){return{'model':db[_0x4da554[_0x2a55('0x22')]],'as':_0x4da554['as'],'attributes':_0x4da554[_0x2a55('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2a55('0xf')](function(_0x398c1f){logger[_0x2a55('0x10')](_0x2a55('0x1a'),_0x4f64e7);logger[_0x2a55('0x13')]('ShowSquareProject',_0x4f64e7,JSON[_0x2a55('0x14')](_0x398c1f));_0x55bcff(_0x398c1f);})[_0x2a55('0x19')](function(_0x346696){logger[_0x2a55('0x15')]('ShowSquareProject',_0x346696[_0x2a55('0x17')],_0x4f64e7);_0x3f0376(_0x48a3ad[_0x2a55('0x15')](0x1f4,_0x346696[_0x2a55('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 950add7..4d6601e 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 _0xbe75=['register','length','squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xbe75,0x113));var _0x5be7=function(_0x1c5cf5,_0x58ef5d){_0x1c5cf5=_0x1c5cf5-0x0;var _0x3aaf65=_0xbe75[_0x1c5cf5];return _0x3aaf65;};'use strict';var SquareProjectEvents=require(_0x5be7('0x0'));var events=[_0x5be7('0x1'),_0x5be7('0x2'),_0x5be7('0x3')];function createListener(_0x337f80,_0x232592){return function(_0x6fdde7){_0x232592[_0x5be7('0x4')](_0x337f80,_0x6fdde7);};}function removeListener(_0x7bf59a,_0x13c869){return function(){SquareProjectEvents['removeListener'](_0x7bf59a,_0x13c869);};}exports[_0x5be7('0x5')]=function(_0x5a7a9a){for(var _0x15cd0a=0x0,_0x3038e1=events[_0x5be7('0x6')];_0x15cd0a<_0x3038e1;_0x15cd0a++){var _0x38edc9=events[_0x15cd0a];var _0x2a43c5=createListener(_0x5be7('0x7')+_0x38edc9,_0x5a7a9a);SquareProjectEvents['on'](_0x38edc9,_0x2a43c5);}}; \ No newline at end of file +var _0x73b4=['update','emit','removeListener','register','length','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73b4,0x186));var _0x473b=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x73b4[_0x4a6cf8];return _0x22205e;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x473b('0x0'),_0x473b('0x1'),_0x473b('0x2')];function createListener(_0x1249a4,_0x3b53d7){return function(_0x1983cd){_0x3b53d7[_0x473b('0x3')](_0x1249a4,_0x1983cd);};}function removeListener(_0x35a112,_0x177afa){return function(){SquareProjectEvents[_0x473b('0x4')](_0x35a112,_0x177afa);};}exports[_0x473b('0x5')]=function(_0x493aa0){for(var _0x26e878=0x0,_0x1ca9ff=events[_0x473b('0x6')];_0x26e878<_0x1ca9ff;_0x26e878++){var _0x154af8=events[_0x26e878];var _0x844b=createListener('squareProject:'+_0x154af8,_0x493aa0);SquareProjectEvents['on'](_0x154af8,_0x844b);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index c5643ef..e3f0193 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 _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x2d7bc4,_0x167783){var _0x111800=function(_0x1cace4){while(--_0x1cace4){_0x2d7bc4['push'](_0x2d7bc4['shift']());}};_0x111800(++_0x167783);}(_0x814b,0x1a2));var _0xb814=function(_0x430095,_0x122722){_0x430095=_0x430095-0x0;var _0x115f8a=_0x814b[_0x430095];return _0x115f8a;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +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(_0x53f8da,_0x398f73){var _0x55d5a2=function(_0x1c3371){while(--_0x1c3371){_0x53f8da['push'](_0x53f8da['shift']());}};_0x55d5a2(++_0x398f73);}(_0x5fc3,0xa8));var _0x35fc=function(_0x29bf80,_0x4af855){_0x29bf80=_0x29bf80-0x0;var _0x932096=_0x5fc3[_0x29bf80];return _0x932096;};'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 b1a13c1..a817bb6 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 _0xabce=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xabce,0x103));var _0xeabc=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xabce[_0x18cd5b];return _0x5eaa52;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'uniqueid':{'type':Sequelize[_0xeabc('0x2')]},'callerid':{'type':Sequelize[_0xeabc('0x2')]},'calleridname':{'type':Sequelize[_0xeabc('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xeabc('0x2')]},'accountcode':{'type':Sequelize[_0xeabc('0x2')]},'dnid':{'type':Sequelize[_0xeabc('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xeabc('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xeabc('0x3')],'get':function(){var _0x52ede8='';var _0x3bdc29=this[_0xeabc('0x4')](_0xeabc('0x5'));if(_0x3bdc29){_0x52ede8=_0x3bdc29['substring'](_0x3bdc29[_0xeabc('0x6')]('.'));}return _0x52ede8;}}}; \ No newline at end of file +var _0x7dfd=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','savePath'];(function(_0x35d56f,_0x576094){var _0x134daf=function(_0x1ff278){while(--_0x1ff278){_0x35d56f['push'](_0x35d56f['shift']());}};_0x134daf(++_0x576094);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'uniqueid':{'type':Sequelize[_0xd7df('0x2')]},'callerid':{'type':Sequelize[_0xd7df('0x2')]},'calleridname':{'type':Sequelize[_0xd7df('0x2')]},'context':{'type':Sequelize[_0xd7df('0x2')]},'extension':{'type':Sequelize[_0xd7df('0x2')]},'priority':{'type':Sequelize[_0xd7df('0x2')]},'accountcode':{'type':Sequelize[_0xd7df('0x2')]},'dnid':{'type':Sequelize[_0xd7df('0x2')]},'projectName':{'type':Sequelize[_0xd7df('0x2')]},'saveName':{'type':Sequelize[_0xd7df('0x2')]},'filename':{'type':Sequelize[_0xd7df('0x2')]},'savePath':{'type':Sequelize[_0xd7df('0x2')]},'format':{'type':Sequelize[_0xd7df('0x3')],'get':function(){var _0x16e50='';var _0x2c48a4=this['getDataValue'](_0xd7df('0x4'));if(_0x2c48a4){_0x16e50=_0x2c48a4[_0xd7df('0x5')](_0x2c48a4[_0xd7df('0x6')]('.'));}return _0x16e50;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index cad886a..25d78d4 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 _0x0e93=['sort','where','pick','VIRTUAL','filter','merge','then','includeAll','include','catch','show','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','File:\x20\x22','unlinkSync','eml-format','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','update','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0e93,0x19e));var _0x30e9=function(_0x3719a8,_0x315958){_0x3719a8=_0x3719a8-0x0;var _0x15b729=_0x0e93[_0x3719a8];return _0x15b729;};'use strict';var emlformat=require(_0x30e9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x30e9('0x1'));var moment=require(_0x30e9('0x2'));var BPromise=require(_0x30e9('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x30e9('0x4'));var sox=require(_0x30e9('0x5'));var csv=require(_0x30e9('0x6'));var ejs=require(_0x30e9('0x7'));var fs=require('fs');var fs_extra=require(_0x30e9('0x8'));var _=require(_0x30e9('0x9'));var squel=require('squel');var crypto=require(_0x30e9('0xa'));var jsforce=require(_0x30e9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x30e9('0x6'));var querystring=require(_0x30e9('0xc'));var Papa=require(_0x30e9('0xd'));var Redis=require(_0x30e9('0xe'));var authService=require(_0x30e9('0xf'));var qs=require(_0x30e9('0x10'));var as=require(_0x30e9('0x11'));var hardwareService=require(_0x30e9('0x12'));var logger=require(_0x30e9('0x13'))('api');var utils=require(_0x30e9('0x14'));var config=require(_0x30e9('0x15'));var licenseUtil=require(_0x30e9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x434fb7,_0x2d3abc){_0x2d3abc=_0x2d3abc||0xcc;return function(_0x316b84){if(_0x316b84){return _0x434fb7[_0x30e9('0x17')](_0x2d3abc);}return _0x434fb7[_0x30e9('0x18')](_0x2d3abc)[_0x30e9('0x19')]();};}function respondWithResult(_0x339c5d,_0x1240ee){_0x1240ee=_0x1240ee||0xc8;return function(_0x280880){if(_0x280880){return _0x339c5d[_0x30e9('0x18')](_0x1240ee)['json'](_0x280880);}};}function respondWithFilteredResult(_0x58123d,_0x41b195){return function(_0x4b967b){if(_0x4b967b){var _0x52ce9a=typeof _0x41b195[_0x30e9('0x1a')]===_0x30e9('0x1b')&&typeof _0x41b195[_0x30e9('0x1c')]===_0x30e9('0x1b');var _0x11af0d=_0x4b967b[_0x30e9('0x1d')];var _0x1f8b14=_0x52ce9a?0x0:_0x41b195[_0x30e9('0x1a')];var _0x498c95=_0x52ce9a?_0x4b967b['count']:_0x41b195['offset']+_0x41b195['limit'];var _0x511822;if(_0x498c95>=_0x11af0d){_0x498c95=_0x11af0d;_0x511822=0xc8;}else{_0x511822=0xce;}_0x58123d[_0x30e9('0x18')](_0x511822);return _0x58123d['set'](_0x30e9('0x1e'),_0x1f8b14+'-'+_0x498c95+'/'+_0x11af0d)[_0x30e9('0x1f')](_0x4b967b);}return null;};}function patchUpdates(_0x5d1b6e){return function(_0x5b29be){try{jsonpatch['apply'](_0x5b29be,_0x5d1b6e,!![]);}catch(_0xbbf0ce){return BPromise['reject'](_0xbbf0ce);}return _0x5b29be[_0x30e9('0x20')]();};}function saveUpdates(_0x4d0853,_0x3374aa){return function(_0x1e7c83){if(_0x1e7c83){return _0x1e7c83[_0x30e9('0x21')](_0x4d0853)['then'](function(_0x224eb2){return _0x224eb2;});}return null;};}function removeEntity(_0x263b9e,_0x33e157){return function(_0x1bc52d){if(_0x1bc52d){return _0x1bc52d[_0x30e9('0x22')]()['then'](function(){_0x263b9e[_0x30e9('0x18')](0xcc)[_0x30e9('0x19')]();});}};}function handleEntityNotFound(_0x282ba2,_0x1e091a){return function(_0x28eb2e){if(!_0x28eb2e){_0x282ba2[_0x30e9('0x17')](0x194);}return _0x28eb2e;};}function handleError(_0x128949,_0x317da1){_0x317da1=_0x317da1||0x1f4;return function(_0x2de82c){logger[_0x30e9('0x23')](_0x2de82c[_0x30e9('0x24')]);if(_0x2de82c[_0x30e9('0x25')]){delete _0x2de82c[_0x30e9('0x25')];}_0x128949[_0x30e9('0x18')](_0x317da1)[_0x30e9('0x26')](_0x2de82c);};}exports[_0x30e9('0x27')]=function(_0x34cc93,_0x461168){var _0x4b667e={},_0x611fdd={},_0xad84fb={'count':0x0,'rows':[]};var _0x1e9ffe=_[_0x30e9('0x28')](db[_0x30e9('0x29')][_0x30e9('0x2a')],function(_0x3f0d4f){return{'name':_0x3f0d4f[_0x30e9('0x2b')],'type':_0x3f0d4f[_0x30e9('0x2c')]['key']};});_0x611fdd[_0x30e9('0x2d')]=_[_0x30e9('0x28')](_0x1e9ffe,_0x30e9('0x25'));_0x611fdd['query']=_[_0x30e9('0x2e')](_0x34cc93[_0x30e9('0x2f')]);_0x611fdd[_0x30e9('0x30')]=_[_0x30e9('0x31')](_0x611fdd[_0x30e9('0x2d')],_0x611fdd[_0x30e9('0x2f')]);_0x4b667e['attributes']=_['intersection'](_0x611fdd[_0x30e9('0x2d')],qs[_0x30e9('0x32')](_0x34cc93[_0x30e9('0x2f')][_0x30e9('0x32')]));_0x4b667e[_0x30e9('0x33')]=_0x4b667e[_0x30e9('0x33')][_0x30e9('0x34')]?_0x4b667e[_0x30e9('0x33')]:_0x611fdd[_0x30e9('0x2d')];if(!_0x34cc93[_0x30e9('0x2f')][_0x30e9('0x35')](_0x30e9('0x36'))){_0x4b667e[_0x30e9('0x1c')]=qs[_0x30e9('0x1c')](_0x34cc93[_0x30e9('0x2f')][_0x30e9('0x1c')]);_0x4b667e[_0x30e9('0x1a')]=qs['offset'](_0x34cc93['query'][_0x30e9('0x1a')]);}_0x4b667e[_0x30e9('0x37')]=qs[_0x30e9('0x38')](_0x34cc93['query'][_0x30e9('0x38')]);_0x4b667e[_0x30e9('0x39')]=qs['filters'](_[_0x30e9('0x3a')](_0x34cc93[_0x30e9('0x2f')],_0x611fdd[_0x30e9('0x30')]),_0x1e9ffe);if(_0x34cc93['query']['filter']){_0x4b667e[_0x30e9('0x39')]=_['merge'](_0x4b667e[_0x30e9('0x39')],{'$or':_['map'](_0x1e9ffe,function(_0x174362){if(_0x174362[_0x30e9('0x2c')]!==_0x30e9('0x3b')){var _0x59ab07={};_0x59ab07[_0x174362[_0x30e9('0x25')]]={'$like':'%'+_0x34cc93[_0x30e9('0x2f')][_0x30e9('0x3c')]+'%'};return _0x59ab07;}})});}_0x4b667e=_[_0x30e9('0x3d')]({},_0x4b667e,_0x34cc93['options']);var _0x425401={'where':_0x4b667e[_0x30e9('0x39')]};return db[_0x30e9('0x29')][_0x30e9('0x1d')](_0x425401)[_0x30e9('0x3e')](function(_0xb3d5e2){_0xad84fb[_0x30e9('0x1d')]=_0xb3d5e2;if(_0x34cc93[_0x30e9('0x2f')][_0x30e9('0x3f')]){_0x4b667e[_0x30e9('0x40')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x4b667e);})[_0x30e9('0x3e')](function(_0x83d958){_0xad84fb['rows']=_0x83d958;return _0xad84fb;})[_0x30e9('0x3e')](respondWithFilteredResult(_0x461168,_0x4b667e))[_0x30e9('0x41')](handleError(_0x461168,null));};exports[_0x30e9('0x42')]=function(_0xfd82fa,_0x333f1f){var _0x5aad4f={'raw':!![],'where':{'id':_0xfd82fa['params']['id']}},_0x51c38a={};_0x51c38a[_0x30e9('0x2d')]=_[_0x30e9('0x2e')](db[_0x30e9('0x29')][_0x30e9('0x2a')]);_0x51c38a[_0x30e9('0x2f')]=_[_0x30e9('0x2e')](_0xfd82fa[_0x30e9('0x2f')]);_0x51c38a[_0x30e9('0x30')]=_[_0x30e9('0x31')](_0x51c38a[_0x30e9('0x2d')],_0x51c38a[_0x30e9('0x2f')]);_0x5aad4f[_0x30e9('0x33')]=_[_0x30e9('0x31')](_0x51c38a[_0x30e9('0x2d')],qs['fields'](_0xfd82fa[_0x30e9('0x2f')][_0x30e9('0x32')]));_0x5aad4f[_0x30e9('0x33')]=_0x5aad4f[_0x30e9('0x33')][_0x30e9('0x34')]?_0x5aad4f[_0x30e9('0x33')]:_0x51c38a[_0x30e9('0x2d')];if(_0xfd82fa[_0x30e9('0x2f')][_0x30e9('0x3f')]){_0x5aad4f[_0x30e9('0x40')]=[{'all':!![]}];}_0x5aad4f=_[_0x30e9('0x3d')]({},_0x5aad4f,_0xfd82fa['options']);return db[_0x30e9('0x29')][_0x30e9('0x43')](_0x5aad4f)[_0x30e9('0x3e')](handleEntityNotFound(_0x333f1f,null))[_0x30e9('0x3e')](respondWithResult(_0x333f1f,null))[_0x30e9('0x41')](handleError(_0x333f1f,null));};exports[_0x30e9('0x44')]=function(_0x4cfc83,_0x3c10ab){return db['SquareRecording'][_0x30e9('0x44')](_0x4cfc83[_0x30e9('0x45')],{})[_0x30e9('0x3e')](respondWithResult(_0x3c10ab,0xc9))[_0x30e9('0x41')](handleError(_0x3c10ab,null));};exports[_0x30e9('0x21')]=function(_0x57407f,_0x49ab8c){if(_0x57407f[_0x30e9('0x45')]['id']){delete _0x57407f['body']['id'];}return db[_0x30e9('0x29')]['find']({'where':{'id':_0x57407f[_0x30e9('0x46')]['id']}})[_0x30e9('0x3e')](handleEntityNotFound(_0x49ab8c,null))[_0x30e9('0x3e')](saveUpdates(_0x57407f[_0x30e9('0x45')],null))[_0x30e9('0x3e')](respondWithResult(_0x49ab8c,null))[_0x30e9('0x41')](handleError(_0x49ab8c,null));};exports[_0x30e9('0x47')]=function(_0x38190b,_0x5358e9,_0x4f1040){var _0x315093=require(_0x30e9('0x48'));var _0x3d152c=![];var _0x2c2226={};if(_0x38190b[_0x30e9('0x2f')][_0x30e9('0x2c')]&&_0x38190b['query'][_0x30e9('0x2c')]==='uniqueid'){_0x2c2226[_0x30e9('0x49')]=_0x38190b['params']['id'];}else{_0x2c2226['id']=_0x38190b['params']['id'];}return db['SquareRecording'][_0x30e9('0x43')]({'where':_0x2c2226,'attributes':['id',_0x30e9('0x4a'),'filename'],'raw':!![]})[_0x30e9('0x3e')](handleEntityNotFound(_0x5358e9,null))[_0x30e9('0x3e')](function(_0x57f947){if(_0x57f947){var _0x5e0772=_0x57f947['savePath'];var _0x593f28=util[_0x30e9('0x4b')](_0x30e9('0x4c'),_0x5e0772);if(fs[_0x30e9('0x4d')](_0x593f28)){_0x3d152c=!![];return _0x315093[_0x30e9('0x4e')](_0x593f28,_0x5e0772,config[_0x30e9('0x4f')]['recording'])[_0x30e9('0x3e')](function(){return _0x57f947;});}return _0x57f947;}})[_0x30e9('0x3e')](function(_0x1540ad){if(_0x1540ad){var _0x41a702=_0x1540ad[_0x30e9('0x4a')];if(!fs[_0x30e9('0x4d')](_0x41a702)){throw new db[(_0x30e9('0x50'))][(_0x30e9('0x51'))](_0x30e9('0x52'));}if(_0x1540ad[_0x30e9('0x53')]){return _0x5358e9['download'](_0x41a702,_0x1540ad[_0x30e9('0x53')]+path[_0x30e9('0x54')](_0x41a702),function(){if(_0x3d152c){fs[_0x30e9('0x55')](_0x41a702);}});}else{return _0x5358e9[_0x30e9('0x47')](_0x41a702,function(_0x51fe7f){if(_0x3d152c){fs[_0x30e9('0x55')](_0x41a702);}});}}})['catch'](function(_0x5c3e70){if(_0x5c3e70[_0x30e9('0x56')]===_0x30e9('0x52')){_0x5358e9[_0x30e9('0x18')](0x194)[_0x30e9('0x26')](_0x30e9('0x57'));}else{return handleError(_0x5358e9,null);}});};exports[_0x30e9('0x22')]=function(_0x3514bf,_0x95b527){return db[_0x30e9('0x29')][_0x30e9('0x43')]({'where':{'id':_0x3514bf[_0x30e9('0x46')]['id']}})[_0x30e9('0x3e')](function(_0x5262ff){if(_[_0x30e9('0x58')](_0x5262ff)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5262ff;})[_0x30e9('0x3e')](function(_0x403169){var _0x4cb98a=_0x403169[_0x30e9('0x4a')];logger[_0x30e9('0x59')](_0x30e9('0x5a'),_0x4cb98a);if(!_[_0x30e9('0x58')](_0x403169['savePath'])&&fs['existsSync'](_0x4cb98a)){logger[_0x30e9('0x59')]('File:\x20\x22'+_0x4cb98a+_0x30e9('0x5b'));fs['unlinkSync'](_0x4cb98a);}_0x4cb98a=_0x4cb98a+'.cypher';if(!_[_0x30e9('0x58')](_0x403169[_0x30e9('0x4a')])&&fs['existsSync'](_0x4cb98a)){logger['info'](_0x30e9('0x5c')+_0x4cb98a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x30e9('0x5d')](_0x4cb98a);}return _0x403169;})[_0x30e9('0x3e')](function(_0x48f986){if(!_0x48f986)throw new InternalError();return _0x48f986[_0x30e9('0x22')]();})[_0x30e9('0x3e')](function(){_0x95b527[_0x30e9('0x18')](0xcc)[_0x30e9('0x19')]();})['catch'](handleError(_0x95b527,null));}; \ No newline at end of file +var _0xcfd3=['mustache','util','path','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','body','catch','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','fast-json-patch','moment','bluebird'];(function(_0x13f864,_0xfbcb58){var _0x534afc=function(_0x3cdb23){while(--_0x3cdb23){_0x13f864['push'](_0x13f864['shift']());}};_0x534afc(++_0xfbcb58);}(_0xcfd3,0x17c));var _0x3cfd=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xcfd3[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3cfd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3cfd('0x1'));var rp=require('request-promise');var moment=require(_0x3cfd('0x2'));var BPromise=require(_0x3cfd('0x3'));var Mustache=require(_0x3cfd('0x4'));var util=require(_0x3cfd('0x5'));var path=require(_0x3cfd('0x6'));var sox=require(_0x3cfd('0x7'));var csv=require('to-csv');var ejs=require(_0x3cfd('0x8'));var fs=require('fs');var fs_extra=require(_0x3cfd('0x9'));var _=require(_0x3cfd('0xa'));var squel=require('squel');var crypto=require(_0x3cfd('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3cfd('0xc'));var querystring=require(_0x3cfd('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3cfd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3cfd('0xf'));var hardwareService=require(_0x3cfd('0x10'));var logger=require(_0x3cfd('0x11'))(_0x3cfd('0x12'));var utils=require(_0x3cfd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3cfd('0x14'));var db=require(_0x3cfd('0x15'))['db'];function respondWithStatusCode(_0x7b6b8f,_0x205320){_0x205320=_0x205320||0xcc;return function(_0x4fb7ad){if(_0x4fb7ad){return _0x7b6b8f[_0x3cfd('0x16')](_0x205320);}return _0x7b6b8f['status'](_0x205320)[_0x3cfd('0x17')]();};}function respondWithResult(_0x1d4042,_0x365b6b){_0x365b6b=_0x365b6b||0xc8;return function(_0x56ae45){if(_0x56ae45){return _0x1d4042[_0x3cfd('0x18')](_0x365b6b)[_0x3cfd('0x19')](_0x56ae45);}};}function respondWithFilteredResult(_0x225ea6,_0x4fc497){return function(_0xe1e2da){if(_0xe1e2da){var _0x2f628f=typeof _0x4fc497[_0x3cfd('0x1a')]==='undefined'&&typeof _0x4fc497[_0x3cfd('0x1b')]===_0x3cfd('0x1c');var _0x497f00=_0xe1e2da[_0x3cfd('0x1d')];var _0x48c4e5=_0x2f628f?0x0:_0x4fc497['offset'];var _0x3721eb=_0x2f628f?_0xe1e2da[_0x3cfd('0x1d')]:_0x4fc497['offset']+_0x4fc497[_0x3cfd('0x1b')];var _0xfcd19a;if(_0x3721eb>=_0x497f00){_0x3721eb=_0x497f00;_0xfcd19a=0xc8;}else{_0xfcd19a=0xce;}_0x225ea6[_0x3cfd('0x18')](_0xfcd19a);return _0x225ea6[_0x3cfd('0x1e')]('Content-Range',_0x48c4e5+'-'+_0x3721eb+'/'+_0x497f00)[_0x3cfd('0x19')](_0xe1e2da);}return null;};}function patchUpdates(_0xe9a4e){return function(_0x5388f6){try{jsonpatch[_0x3cfd('0x1f')](_0x5388f6,_0xe9a4e,!![]);}catch(_0x3defe3){return BPromise[_0x3cfd('0x20')](_0x3defe3);}return _0x5388f6['save']();};}function saveUpdates(_0x2ad9ed,_0x16e011){return function(_0x45244d){if(_0x45244d){return _0x45244d[_0x3cfd('0x21')](_0x2ad9ed)[_0x3cfd('0x22')](function(_0x19d774){return _0x19d774;});}return null;};}function removeEntity(_0x3aeb74,_0x2c2492){return function(_0xaddd5){if(_0xaddd5){return _0xaddd5[_0x3cfd('0x23')]()[_0x3cfd('0x22')](function(){_0x3aeb74[_0x3cfd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27ce28,_0x58b8a0){return function(_0x4bbc5d){if(!_0x4bbc5d){_0x27ce28[_0x3cfd('0x16')](0x194);}return _0x4bbc5d;};}function handleError(_0x4de477,_0x26a545){_0x26a545=_0x26a545||0x1f4;return function(_0xdb6824){logger[_0x3cfd('0x24')](_0xdb6824[_0x3cfd('0x25')]);if(_0xdb6824[_0x3cfd('0x26')]){delete _0xdb6824[_0x3cfd('0x26')];}_0x4de477[_0x3cfd('0x18')](_0x26a545)[_0x3cfd('0x27')](_0xdb6824);};}exports[_0x3cfd('0x28')]=function(_0x5a18fb,_0x18d4c6){var _0x5656a0={},_0x641733={},_0x1060eb={'count':0x0,'rows':[]};var _0x29929a=_[_0x3cfd('0x29')](db[_0x3cfd('0x2a')][_0x3cfd('0x2b')],function(_0x5091bf){return{'name':_0x5091bf['fieldName'],'type':_0x5091bf[_0x3cfd('0x2c')][_0x3cfd('0x2d')]};});_0x641733[_0x3cfd('0x2e')]=_[_0x3cfd('0x29')](_0x29929a,_0x3cfd('0x26'));_0x641733['query']=_['keys'](_0x5a18fb[_0x3cfd('0x2f')]);_0x641733[_0x3cfd('0x30')]=_[_0x3cfd('0x31')](_0x641733[_0x3cfd('0x2e')],_0x641733['query']);_0x5656a0[_0x3cfd('0x32')]=_[_0x3cfd('0x31')](_0x641733[_0x3cfd('0x2e')],qs[_0x3cfd('0x33')](_0x5a18fb[_0x3cfd('0x2f')][_0x3cfd('0x33')]));_0x5656a0[_0x3cfd('0x32')]=_0x5656a0[_0x3cfd('0x32')][_0x3cfd('0x34')]?_0x5656a0[_0x3cfd('0x32')]:_0x641733[_0x3cfd('0x2e')];if(!_0x5a18fb[_0x3cfd('0x2f')][_0x3cfd('0x35')](_0x3cfd('0x36'))){_0x5656a0['limit']=qs[_0x3cfd('0x1b')](_0x5a18fb[_0x3cfd('0x2f')]['limit']);_0x5656a0['offset']=qs['offset'](_0x5a18fb[_0x3cfd('0x2f')][_0x3cfd('0x1a')]);}_0x5656a0[_0x3cfd('0x37')]=qs[_0x3cfd('0x38')](_0x5a18fb[_0x3cfd('0x2f')][_0x3cfd('0x38')]);_0x5656a0[_0x3cfd('0x39')]=qs[_0x3cfd('0x30')](_[_0x3cfd('0x3a')](_0x5a18fb['query'],_0x641733['filters']),_0x29929a);if(_0x5a18fb[_0x3cfd('0x2f')][_0x3cfd('0x3b')]){_0x5656a0[_0x3cfd('0x39')]=_[_0x3cfd('0x3c')](_0x5656a0[_0x3cfd('0x39')],{'$or':_[_0x3cfd('0x29')](_0x29929a,function(_0x119333){if(_0x119333[_0x3cfd('0x2c')]!==_0x3cfd('0x3d')){var _0x4380ed={};_0x4380ed[_0x119333[_0x3cfd('0x26')]]={'$like':'%'+_0x5a18fb[_0x3cfd('0x2f')]['filter']+'%'};return _0x4380ed;}})});}_0x5656a0=_[_0x3cfd('0x3c')]({},_0x5656a0,_0x5a18fb[_0x3cfd('0x3e')]);var _0x5894c6={'where':_0x5656a0[_0x3cfd('0x39')]};return db[_0x3cfd('0x2a')][_0x3cfd('0x1d')](_0x5894c6)['then'](function(_0x850133){_0x1060eb[_0x3cfd('0x1d')]=_0x850133;if(_0x5a18fb[_0x3cfd('0x2f')][_0x3cfd('0x3f')]){_0x5656a0['include']=[{'all':!![]}];}return db[_0x3cfd('0x2a')][_0x3cfd('0x40')](_0x5656a0);})[_0x3cfd('0x22')](function(_0x54b714){_0x1060eb[_0x3cfd('0x41')]=_0x54b714;return _0x1060eb;})[_0x3cfd('0x22')](respondWithFilteredResult(_0x18d4c6,_0x5656a0))['catch'](handleError(_0x18d4c6,null));};exports[_0x3cfd('0x42')]=function(_0x12ffac,_0x4a686a){var _0x50d4e4={'raw':!![],'where':{'id':_0x12ffac[_0x3cfd('0x43')]['id']}},_0x12cef7={};_0x12cef7['model']=_[_0x3cfd('0x44')](db[_0x3cfd('0x2a')][_0x3cfd('0x2b')]);_0x12cef7['query']=_['keys'](_0x12ffac[_0x3cfd('0x2f')]);_0x12cef7[_0x3cfd('0x30')]=_[_0x3cfd('0x31')](_0x12cef7[_0x3cfd('0x2e')],_0x12cef7['query']);_0x50d4e4[_0x3cfd('0x32')]=_[_0x3cfd('0x31')](_0x12cef7[_0x3cfd('0x2e')],qs[_0x3cfd('0x33')](_0x12ffac[_0x3cfd('0x2f')][_0x3cfd('0x33')]));_0x50d4e4[_0x3cfd('0x32')]=_0x50d4e4[_0x3cfd('0x32')][_0x3cfd('0x34')]?_0x50d4e4[_0x3cfd('0x32')]:_0x12cef7['model'];if(_0x12ffac[_0x3cfd('0x2f')]['includeAll']){_0x50d4e4[_0x3cfd('0x45')]=[{'all':!![]}];}_0x50d4e4=_['merge']({},_0x50d4e4,_0x12ffac[_0x3cfd('0x3e')]);return db[_0x3cfd('0x2a')][_0x3cfd('0x46')](_0x50d4e4)['then'](handleEntityNotFound(_0x4a686a,null))[_0x3cfd('0x22')](respondWithResult(_0x4a686a,null))['catch'](handleError(_0x4a686a,null));};exports['create']=function(_0x57bc1b,_0x3ac7cc){return db[_0x3cfd('0x2a')]['create'](_0x57bc1b[_0x3cfd('0x47')],{})[_0x3cfd('0x22')](respondWithResult(_0x3ac7cc,0xc9))[_0x3cfd('0x48')](handleError(_0x3ac7cc,null));};exports[_0x3cfd('0x21')]=function(_0x37b5da,_0x410e6b){if(_0x37b5da[_0x3cfd('0x47')]['id']){delete _0x37b5da['body']['id'];}return db[_0x3cfd('0x2a')][_0x3cfd('0x46')]({'where':{'id':_0x37b5da['params']['id']}})[_0x3cfd('0x22')](handleEntityNotFound(_0x410e6b,null))[_0x3cfd('0x22')](saveUpdates(_0x37b5da['body'],null))['then'](respondWithResult(_0x410e6b,null))[_0x3cfd('0x48')](handleError(_0x410e6b,null));};exports[_0x3cfd('0x49')]=function(_0x6cd808,_0x2c9fcf,_0x567969){var _0x2406d1=require(_0x3cfd('0x4a'));var _0x518602=![];var _0x483383={};if(_0x6cd808['query'][_0x3cfd('0x2c')]&&_0x6cd808['query']['type']===_0x3cfd('0x4b')){_0x483383[_0x3cfd('0x4b')]=_0x6cd808[_0x3cfd('0x43')]['id'];}else{_0x483383['id']=_0x6cd808[_0x3cfd('0x43')]['id'];}return db[_0x3cfd('0x2a')]['find']({'where':_0x483383,'attributes':['id','savePath','filename'],'raw':!![]})['then'](handleEntityNotFound(_0x2c9fcf,null))['then'](function(_0x1a31d6){if(_0x1a31d6){var _0x3b3cb4=_0x1a31d6[_0x3cfd('0x4c')];var _0x24ec4b=util[_0x3cfd('0x4d')](_0x3cfd('0x4e'),_0x3b3cb4);if(fs[_0x3cfd('0x4f')](_0x24ec4b)){_0x518602=!![];return _0x2406d1[_0x3cfd('0x50')](_0x24ec4b,_0x3b3cb4,config[_0x3cfd('0x51')][_0x3cfd('0x52')])[_0x3cfd('0x22')](function(){return _0x1a31d6;});}return _0x1a31d6;}})[_0x3cfd('0x22')](function(_0x1b243a){if(_0x1b243a){var _0x5f4596=_0x1b243a['savePath'];if(!fs['existsSync'](_0x5f4596)){throw new db[(_0x3cfd('0x53'))]['ValidationError'](_0x3cfd('0x54'));}if(_0x1b243a[_0x3cfd('0x55')]){return _0x2c9fcf['download'](_0x5f4596,_0x1b243a[_0x3cfd('0x55')]+path[_0x3cfd('0x56')](_0x5f4596),function(){if(_0x518602){fs[_0x3cfd('0x57')](_0x5f4596);}});}else{return _0x2c9fcf[_0x3cfd('0x49')](_0x5f4596,function(_0x4d7bcc){if(_0x518602){fs[_0x3cfd('0x57')](_0x5f4596);}});}}})[_0x3cfd('0x48')](function(_0x3fecb2){if(_0x3fecb2['message']===_0x3cfd('0x54')){_0x2c9fcf[_0x3cfd('0x18')](0x194)[_0x3cfd('0x27')](_0x3cfd('0x58'));}else{return handleError(_0x2c9fcf,null);}});};exports[_0x3cfd('0x23')]=function(_0x1467d5,_0x166dbf){return db[_0x3cfd('0x2a')]['find']({'where':{'id':_0x1467d5[_0x3cfd('0x43')]['id']}})['then'](function(_0x270c28){if(_[_0x3cfd('0x59')](_0x270c28)){throw new ReferenceError(_0x3cfd('0x5a'));}return _0x270c28;})[_0x3cfd('0x22')](function(_0x476621){var _0x13ce73=_0x476621[_0x3cfd('0x4c')];logger[_0x3cfd('0x5b')](_0x3cfd('0x5c'),_0x13ce73);if(!_[_0x3cfd('0x59')](_0x476621[_0x3cfd('0x4c')])&&fs[_0x3cfd('0x4f')](_0x13ce73)){logger[_0x3cfd('0x5b')](_0x3cfd('0x5d')+_0x13ce73+_0x3cfd('0x5e'));fs[_0x3cfd('0x5f')](_0x13ce73);}_0x13ce73=_0x13ce73+'.cypher';if(!_[_0x3cfd('0x59')](_0x476621['savePath'])&&fs[_0x3cfd('0x4f')](_0x13ce73)){logger['info']('File:\x20\x22'+_0x13ce73+_0x3cfd('0x5e'));fs[_0x3cfd('0x5f')](_0x13ce73);}return _0x476621;})['then'](function(_0x52fee8){if(!_0x52fee8)throw new InternalError();return _0x52fee8[_0x3cfd('0x23')]();})[_0x3cfd('0x22')](function(){_0x166dbf[_0x3cfd('0x18')](0xcc)[_0x3cfd('0x17')]();})[_0x3cfd('0x48')](handleError(_0x166dbf,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index b1c008a..377aff4 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 _0x7ed1=['api','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','../../config/logger'];(function(_0x3a8114,_0x3d9abc){var _0x2d4fc6=function(_0x5afbea){while(--_0x5afbea){_0x3a8114['push'](_0x3a8114['shift']());}};_0x2d4fc6(++_0x3d9abc);}(_0x7ed1,0xca));var _0x17ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ed1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x17ed('0x0'));var util=require('util');var logger=require(_0x17ed('0x1'))(_0x17ed('0x2'));var moment=require(_0x17ed('0x3'));var BPromise=require(_0x17ed('0x4'));var rp=require(_0x17ed('0x5'));var fs=require('fs');var path=require(_0x17ed('0x6'));var rimraf=require('rimraf');var config=require(_0x17ed('0x7'));var attributes=require(_0x17ed('0x8'));module[_0x17ed('0x9')]=function(_0x15583a,_0x569334){return _0x15583a['define'](_0x17ed('0xa'),attributes,{'tableName':_0x17ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','SquareRecording','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x30662f,_0x4d202e){var _0x40d038=function(_0x10bb41){while(--_0x10bb41){_0x30662f['push'](_0x30662f['shift']());}};_0x40d038(++_0x4d202e);}(_0x524e,0x15e));var _0xe524=function(_0x3d8a8a,_0x22f67d){_0x3d8a8a=_0x3d8a8a-0x0;var _0x574b50=_0x524e[_0x3d8a8a];return _0x574b50;};'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':'square_recordings','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 7bf60e4..3418a25 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 _0x0400=['request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareRecording','SquareRecording','create','body','options','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x0400,0x196));var _0x0040=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0x0400[_0x2389bc];return _0x170548;};'use strict';var _=require(_0x0040('0x0'));var util=require(_0x0040('0x1'));var moment=require('moment');var BPromise=require(_0x0040('0x2'));var rs=require(_0x0040('0x3'));var fs=require('fs');var Redis=require(_0x0040('0x4'));var db=require(_0x0040('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0040('0x6'));var config=require(_0x0040('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0040('0x8')][_0x0040('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x128544,_0x44d670,_0x17a304){return new BPromise(function(_0x30f5ca,_0x47bb99){return client[_0x0040('0xa')](_0x128544,_0x17a304)[_0x0040('0xb')](function(_0x5bf0d9){logger[_0x0040('0xc')](_0x0040('0xd'),_0x44d670,_0x0040('0xe'));logger[_0x0040('0xf')](_0x0040('0x10'),_0x44d670,_0x0040('0xe'),JSON[_0x0040('0x11')](_0x5bf0d9));if(_0x5bf0d9[_0x0040('0x12')]){if(_0x5bf0d9['error'][_0x0040('0x13')]===0x1f4){logger['error'](_0x0040('0xd'),_0x44d670,_0x5bf0d9[_0x0040('0x12')]['message']);return _0x47bb99(_0x5bf0d9[_0x0040('0x12')]['message']);}logger[_0x0040('0x12')](_0x0040('0xd'),_0x44d670,_0x5bf0d9[_0x0040('0x12')][_0x0040('0x14')]);return _0x30f5ca(_0x5bf0d9[_0x0040('0x12')][_0x0040('0x14')]);}else{logger[_0x0040('0xc')]('SquareRecording,\x20%s,\x20%s',_0x44d670,_0x0040('0xe'));_0x30f5ca(_0x5bf0d9['result'][_0x0040('0x14')]);}})['catch'](function(_0x320c79){logger[_0x0040('0x12')](_0x0040('0xd'),_0x44d670,_0x320c79);_0x47bb99(_0x320c79);});});}exports[_0x0040('0x15')]=function(_0x40e8a9){var _0x593ad5=this;return new Promise(function(_0x42bee4,_0x181b5b){return db[_0x0040('0x16')][_0x0040('0x17')](_0x40e8a9[_0x0040('0x18')],{'raw':_0x40e8a9[_0x0040('0x19')]?_0x40e8a9['options'][_0x0040('0x1a')]===undefined?!![]:![]:!![]})[_0x0040('0xb')](function(_0x474db4){logger['info'](_0x0040('0x15'),_0x40e8a9);logger[_0x0040('0xf')](_0x0040('0x15'),_0x40e8a9,JSON[_0x0040('0x11')](_0x474db4));_0x42bee4(_0x474db4);})[_0x0040('0x1b')](function(_0x57c1bc){logger[_0x0040('0x12')]('CreateSquareRecording',_0x57c1bc[_0x0040('0x14')],_0x40e8a9);_0x181b5b(_0x593ad5['error'](0x1f4,_0x57c1bc[_0x0040('0x14')]));});});}; \ No newline at end of file +var _0xbf21=['info','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','CreateSquareRecording','SquareRecording','create','options','then','debug','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3d8eb9,_0x4c1980){var _0x3682a7=function(_0x234596){while(--_0x234596){_0x3d8eb9['push'](_0x3d8eb9['shift']());}};_0x3682a7(++_0x4c1980);}(_0xbf21,0x1e3));var _0x1bf2=function(_0x4e2060,_0x2672fe){_0x4e2060=_0x4e2060-0x0;var _0x400702=_0xbf21[_0x4e2060];return _0x400702;};'use strict';var _=require('lodash');var util=require(_0x1bf2('0x0'));var moment=require('moment');var BPromise=require(_0x1bf2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bf2('0x2'));var db=require(_0x1bf2('0x3'))['db'];var utils=require(_0x1bf2('0x4'));var logger=require(_0x1bf2('0x5'))('rpc');var config=require(_0x1bf2('0x6'));var jayson=require(_0x1bf2('0x7'));var client=jayson[_0x1bf2('0x8')][_0x1bf2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e73e1,_0x2d3457,_0x2ae779){return new BPromise(function(_0x19a39e,_0x4d6e9a){return client[_0x1bf2('0xa')](_0x3e73e1,_0x2ae779)['then'](function(_0x9a4773){logger[_0x1bf2('0xb')]('SquareRecording,\x20%s,\x20%s',_0x2d3457,'request\x20sent');logger['debug'](_0x1bf2('0xc'),_0x2d3457,'request\x20sent',JSON[_0x1bf2('0xd')](_0x9a4773));if(_0x9a4773[_0x1bf2('0xe')]){if(_0x9a4773[_0x1bf2('0xe')][_0x1bf2('0xf')]===0x1f4){logger['error'](_0x1bf2('0x10'),_0x2d3457,_0x9a4773[_0x1bf2('0xe')]['message']);return _0x4d6e9a(_0x9a4773['error'][_0x1bf2('0x11')]);}logger[_0x1bf2('0xe')](_0x1bf2('0x10'),_0x2d3457,_0x9a4773[_0x1bf2('0xe')][_0x1bf2('0x11')]);return _0x19a39e(_0x9a4773[_0x1bf2('0xe')]['message']);}else{logger[_0x1bf2('0xb')]('SquareRecording,\x20%s,\x20%s',_0x2d3457,'request\x20sent');_0x19a39e(_0x9a4773[_0x1bf2('0x12')][_0x1bf2('0x11')]);}})['catch'](function(_0x1c9ba4){logger['error'](_0x1bf2('0x10'),_0x2d3457,_0x1c9ba4);_0x4d6e9a(_0x1c9ba4);});});}exports[_0x1bf2('0x13')]=function(_0x916074){var _0xa55539=this;return new Promise(function(_0x57b508,_0x25198a){return db[_0x1bf2('0x14')][_0x1bf2('0x15')](_0x916074['body'],{'raw':_0x916074[_0x1bf2('0x16')]?_0x916074[_0x1bf2('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x1bf2('0x17')](function(_0x43d91b){logger['info'](_0x1bf2('0x13'),_0x916074);logger[_0x1bf2('0x18')]('CreateSquareRecording',_0x916074,JSON['stringify'](_0x43d91b));_0x57b508(_0x43d91b);})[_0x1bf2('0x19')](function(_0x163d9c){logger[_0x1bf2('0xe')](_0x1bf2('0x13'),_0x163d9c[_0x1bf2('0x11')],_0x916074);_0x25198a(_0xa55539[_0x1bf2('0xe')](0x1f4,_0x163d9c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 61a2a8e..096c8e1 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x9d47a6,_0x4bb5c2){var _0x2c1406=function(_0x3f4e2f){while(--_0x3f4e2f){_0x9d47a6['push'](_0x9d47a6['shift']());}};_0x2c1406(++_0x4bb5c2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x36da8b,_0x349220){var _0xddb798=function(_0x176ba4){while(--_0x176ba4){_0x36da8b['push'](_0x36da8b['shift']());}};_0xddb798(++_0x349220);}(_0xb10b,0x12a));var _0xbb10=function(_0x26ac27,_0x574b86){_0x26ac27=_0x26ac27-0x0;var _0x44a599=_0xb10b[_0x26ac27];return _0x44a599;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 328558f..4fbdd4a 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 _0x8e42=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x5b589,_0x2b654a){var _0x372e46=function(_0x11da95){while(--_0x11da95){_0x5b589['push'](_0x5b589['shift']());}};_0x372e46(++_0x2b654a);}(_0x8e42,0x81));var _0x28e4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x8e42[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x28e4('0x0'));module[_0x28e4('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x28e4('0x2')]},'request':{'type':Sequelize[_0x28e4('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x28e4('0x2')]},'type':{'type':Sequelize[_0x28e4('0x2')]},'uniqueid':{'type':Sequelize[_0x28e4('0x2')]},'version':{'type':Sequelize[_0x28e4('0x2')]},'callerid':{'type':Sequelize[_0x28e4('0x2')]},'calleridname':{'type':Sequelize[_0x28e4('0x2')]},'callingpres':{'type':Sequelize[_0x28e4('0x2')]},'callingani2':{'type':Sequelize[_0x28e4('0x2')]},'callington':{'type':Sequelize[_0x28e4('0x2')]},'callingtns':{'type':Sequelize[_0x28e4('0x2')]},'dnid':{'type':Sequelize[_0x28e4('0x2')]},'rdnis':{'type':Sequelize[_0x28e4('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x28e4('0x2')]},'priority':{'type':Sequelize[_0x28e4('0x2')]},'enhanced':{'type':Sequelize[_0x28e4('0x2')]},'accountcode':{'type':Sequelize[_0x28e4('0x2')]},'threadid':{'type':Sequelize[_0x28e4('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x28e4('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x28e4('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa828=['BOOLEAN','exports','STRING','DATE'];(function(_0x585af9,_0x46d5ad){var _0x1dd60b=function(_0x43ff74){while(--_0x43ff74){_0x585af9['push'](_0x585af9['shift']());}};_0x1dd60b(++_0x46d5ad);}(_0xa828,0xc1));var _0x8a82=function(_0x5964c6,_0x4fe4fd){_0x5964c6=_0x5964c6-0x0;var _0x5f4e4b=_0xa828[_0x5964c6];return _0x5f4e4b;};'use strict';var Sequelize=require('sequelize');module[_0x8a82('0x0')]={'network':{'type':Sequelize[_0x8a82('0x1')]},'network_script':{'type':Sequelize[_0x8a82('0x1')]},'request':{'type':Sequelize[_0x8a82('0x1')]},'channel':{'type':Sequelize[_0x8a82('0x1')]},'language':{'type':Sequelize[_0x8a82('0x1')]},'type':{'type':Sequelize[_0x8a82('0x1')]},'uniqueid':{'type':Sequelize[_0x8a82('0x1')]},'version':{'type':Sequelize[_0x8a82('0x1')]},'callerid':{'type':Sequelize[_0x8a82('0x1')]},'calleridname':{'type':Sequelize[_0x8a82('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x8a82('0x1')]},'rdnis':{'type':Sequelize[_0x8a82('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8a82('0x1')]},'priority':{'type':Sequelize[_0x8a82('0x1')]},'enhanced':{'type':Sequelize[_0x8a82('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x8a82('0x1')]},'project_name':{'type':Sequelize[_0x8a82('0x1')]},'joinAt':{'type':Sequelize[_0x8a82('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x8a82('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 3f72d0d..d12789f 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 _0x6164=['json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','fields','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x588c33,_0xe686f7){var _0x5c639c=function(_0x128ccf){while(--_0x128ccf){_0x588c33['push'](_0x588c33['shift']());}};_0x5c639c(++_0xe686f7);}(_0x6164,0x165));var _0x4616=function(_0x59591b,_0x354045){_0x59591b=_0x59591b-0x0;var _0x576642=_0x6164[_0x59591b];return _0x576642;};'use strict';var emlformat=require(_0x4616('0x0'));var rimraf=require(_0x4616('0x1'));var zipdir=require(_0x4616('0x2'));var jsonpatch=require(_0x4616('0x3'));var rp=require(_0x4616('0x4'));var moment=require(_0x4616('0x5'));var BPromise=require(_0x4616('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4616('0x7'));var sox=require(_0x4616('0x8'));var csv=require(_0x4616('0x9'));var ejs=require(_0x4616('0xa'));var fs=require('fs');var fs_extra=require(_0x4616('0xb'));var _=require(_0x4616('0xc'));var squel=require(_0x4616('0xd'));var crypto=require('crypto');var jsforce=require(_0x4616('0xe'));var deskjs=require(_0x4616('0xf'));var toCsv=require(_0x4616('0x9'));var querystring=require(_0x4616('0x10'));var Papa=require(_0x4616('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4616('0x12'));var as=require(_0x4616('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4616('0x14'))('api');var utils=require(_0x4616('0x15'));var config=require(_0x4616('0x16'));var licenseUtil=require(_0x4616('0x17'));var db=require(_0x4616('0x18'))['db'];function respondWithStatusCode(_0x4c0510,_0x57dacf){_0x57dacf=_0x57dacf||0xcc;return function(_0x310cd4){if(_0x310cd4){return _0x4c0510[_0x4616('0x19')](_0x57dacf);}return _0x4c0510[_0x4616('0x1a')](_0x57dacf)[_0x4616('0x1b')]();};}function respondWithResult(_0x525298,_0x344962){_0x344962=_0x344962||0xc8;return function(_0x5d954c){if(_0x5d954c){return _0x525298[_0x4616('0x1a')](_0x344962)[_0x4616('0x1c')](_0x5d954c);}};}function respondWithFilteredResult(_0x2b87fa,_0x1539b1){return function(_0x11afc2){if(_0x11afc2){var _0x135075=typeof _0x1539b1[_0x4616('0x1d')]==='undefined'&&typeof _0x1539b1[_0x4616('0x1e')]===_0x4616('0x1f');var _0x11f518=_0x11afc2[_0x4616('0x20')];var _0x347c2d=_0x135075?0x0:_0x1539b1[_0x4616('0x1d')];var _0x12a28f=_0x135075?_0x11afc2[_0x4616('0x20')]:_0x1539b1[_0x4616('0x1d')]+_0x1539b1[_0x4616('0x1e')];var _0x732a7e;if(_0x12a28f>=_0x11f518){_0x12a28f=_0x11f518;_0x732a7e=0xc8;}else{_0x732a7e=0xce;}_0x2b87fa[_0x4616('0x1a')](_0x732a7e);return _0x2b87fa['set'](_0x4616('0x21'),_0x347c2d+'-'+_0x12a28f+'/'+_0x11f518)[_0x4616('0x1c')](_0x11afc2);}return null;};}function patchUpdates(_0x441550){return function(_0x5774b9){try{jsonpatch[_0x4616('0x22')](_0x5774b9,_0x441550,!![]);}catch(_0x402b93){return BPromise['reject'](_0x402b93);}return _0x5774b9[_0x4616('0x23')]();};}function saveUpdates(_0x2fbaa4,_0x3a2816){return function(_0x1e3829){if(_0x1e3829){return _0x1e3829[_0x4616('0x24')](_0x2fbaa4)[_0x4616('0x25')](function(_0x459708){return _0x459708;});}return null;};}function removeEntity(_0x14df20,_0x283014){return function(_0x18b551){if(_0x18b551){return _0x18b551[_0x4616('0x26')]()[_0x4616('0x25')](function(){_0x14df20['status'](0xcc)[_0x4616('0x1b')]();});}};}function handleEntityNotFound(_0x12cde9,_0x12aea1){return function(_0x4bae27){if(!_0x4bae27){_0x12cde9[_0x4616('0x19')](0x194);}return _0x4bae27;};}function handleError(_0x70c360,_0x37f601){_0x37f601=_0x37f601||0x1f4;return function(_0x464930){logger[_0x4616('0x27')](_0x464930[_0x4616('0x28')]);if(_0x464930[_0x4616('0x29')]){delete _0x464930[_0x4616('0x29')];}_0x70c360[_0x4616('0x1a')](_0x37f601)['send'](_0x464930);};}exports[_0x4616('0x2a')]=function(_0x578929,_0x56704f){var _0x193f18={},_0x3abc8a={},_0x38d374={'count':0x0,'rows':[]};var _0x2d4bcf=_[_0x4616('0x2b')](db[_0x4616('0x2c')][_0x4616('0x2d')],function(_0x1a0139){return{'name':_0x1a0139[_0x4616('0x2e')],'type':_0x1a0139['type'][_0x4616('0x2f')]};});_0x3abc8a[_0x4616('0x30')]=_['map'](_0x2d4bcf,_0x4616('0x29'));_0x3abc8a[_0x4616('0x31')]=_[_0x4616('0x32')](_0x578929['query']);_0x3abc8a[_0x4616('0x33')]=_[_0x4616('0x34')](_0x3abc8a[_0x4616('0x30')],_0x3abc8a[_0x4616('0x31')]);_0x193f18[_0x4616('0x35')]=_[_0x4616('0x34')](_0x3abc8a['model'],qs['fields'](_0x578929[_0x4616('0x31')]['fields']));_0x193f18[_0x4616('0x35')]=_0x193f18[_0x4616('0x35')][_0x4616('0x36')]?_0x193f18[_0x4616('0x35')]:_0x3abc8a['model'];if(!_0x578929[_0x4616('0x31')][_0x4616('0x37')]('nolimit')){_0x193f18[_0x4616('0x1e')]=qs[_0x4616('0x1e')](_0x578929[_0x4616('0x31')]['limit']);_0x193f18[_0x4616('0x1d')]=qs[_0x4616('0x1d')](_0x578929['query'][_0x4616('0x1d')]);}_0x193f18[_0x4616('0x38')]=qs[_0x4616('0x39')](_0x578929[_0x4616('0x31')]['sort']);_0x193f18[_0x4616('0x3a')]=qs['filters'](_[_0x4616('0x3b')](_0x578929[_0x4616('0x31')],_0x3abc8a[_0x4616('0x33')]),_0x2d4bcf);if(_0x578929[_0x4616('0x31')][_0x4616('0x3c')]){_0x193f18[_0x4616('0x3a')]=_[_0x4616('0x3d')](_0x193f18['where'],{'$or':_['map'](_0x2d4bcf,function(_0x597fc3){if(_0x597fc3[_0x4616('0x3e')]!==_0x4616('0x3f')){var _0x1592f9={};_0x1592f9[_0x597fc3[_0x4616('0x29')]]={'$like':'%'+_0x578929[_0x4616('0x31')]['filter']+'%'};return _0x1592f9;}})});}_0x193f18=_[_0x4616('0x3d')]({},_0x193f18,_0x578929['options']);var _0x20708f={'where':_0x193f18['where']};return db[_0x4616('0x2c')][_0x4616('0x20')](_0x20708f)[_0x4616('0x25')](function(_0x550c2e){_0x38d374[_0x4616('0x20')]=_0x550c2e;if(_0x578929[_0x4616('0x31')][_0x4616('0x40')]){_0x193f18[_0x4616('0x41')]=[{'all':!![]}];}return db[_0x4616('0x2c')][_0x4616('0x42')](_0x193f18);})[_0x4616('0x25')](function(_0x2ac387){_0x38d374[_0x4616('0x43')]=_0x2ac387;return _0x38d374;})['then'](respondWithFilteredResult(_0x56704f,_0x193f18))[_0x4616('0x44')](handleError(_0x56704f,null));};exports[_0x4616('0x45')]=function(_0x3eb320,_0x39cde4){var _0x451831={'raw':!![],'where':{'id':_0x3eb320['params']['id']}},_0x314dbb={};_0x314dbb[_0x4616('0x30')]=_['keys'](db[_0x4616('0x2c')]['rawAttributes']);_0x314dbb[_0x4616('0x31')]=_[_0x4616('0x32')](_0x3eb320[_0x4616('0x31')]);_0x314dbb[_0x4616('0x33')]=_[_0x4616('0x34')](_0x314dbb[_0x4616('0x30')],_0x314dbb[_0x4616('0x31')]);_0x451831[_0x4616('0x35')]=_[_0x4616('0x34')](_0x314dbb['model'],qs[_0x4616('0x46')](_0x3eb320[_0x4616('0x31')][_0x4616('0x46')]));_0x451831[_0x4616('0x35')]=_0x451831[_0x4616('0x35')][_0x4616('0x36')]?_0x451831[_0x4616('0x35')]:_0x314dbb['model'];if(_0x3eb320['query'][_0x4616('0x40')]){_0x451831[_0x4616('0x41')]=[{'all':!![]}];}_0x451831=_['merge']({},_0x451831,_0x3eb320[_0x4616('0x47')]);return db[_0x4616('0x2c')][_0x4616('0x48')](_0x451831)[_0x4616('0x25')](handleEntityNotFound(_0x39cde4,null))[_0x4616('0x25')](respondWithResult(_0x39cde4,null))[_0x4616('0x44')](handleError(_0x39cde4,null));};exports[_0x4616('0x49')]=function(_0x429baa,_0x2b6015){return db['SquareReport']['create'](_0x429baa[_0x4616('0x4a')],{})[_0x4616('0x25')](respondWithResult(_0x2b6015,0xc9))[_0x4616('0x44')](handleError(_0x2b6015,null));};exports[_0x4616('0x24')]=function(_0x39abc0,_0x44985a){if(_0x39abc0[_0x4616('0x4a')]['id']){delete _0x39abc0['body']['id'];}return db[_0x4616('0x2c')][_0x4616('0x48')]({'where':{'id':_0x39abc0['params']['id']}})[_0x4616('0x25')](handleEntityNotFound(_0x44985a,null))[_0x4616('0x25')](saveUpdates(_0x39abc0[_0x4616('0x4a')],null))['then'](respondWithResult(_0x44985a,null))[_0x4616('0x44')](handleError(_0x44985a,null));};exports['destroy']=function(_0x414bcf,_0x417b4e){return db[_0x4616('0x2c')][_0x4616('0x48')]({'where':{'id':_0x414bcf[_0x4616('0x4b')]['id']}})[_0x4616('0x25')](handleEntityNotFound(_0x417b4e,null))[_0x4616('0x25')](removeEntity(_0x417b4e,null))[_0x4616('0x44')](handleError(_0x417b4e,null));};exports[_0x4616('0x4c')]=function(_0x37d038,_0x5d6329){return db[_0x4616('0x2c')][_0x4616('0x4c')]()['then'](respondWithResult(_0x5d6329,null))[_0x4616('0x44')](handleError(_0x5d6329,null));}; \ No newline at end of file +var _0xc0a0=['api','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','SquareReport','rawAttributes','fieldName','type','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','merge','map','options','include','rows','catch','keys','length','includeAll','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x545626,_0x49a9cc){var _0x4d3b2e=function(_0x388fa0){while(--_0x388fa0){_0x545626['push'](_0x545626['shift']());}};_0x4d3b2e(++_0x49a9cc);}(_0xc0a0,0x185));var _0x0c0a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc0a0[_0x5f1391];return _0x50ebe3;};'use strict';var emlformat=require(_0x0c0a('0x0'));var rimraf=require(_0x0c0a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c0a('0x2'));var rp=require(_0x0c0a('0x3'));var moment=require(_0x0c0a('0x4'));var BPromise=require(_0x0c0a('0x5'));var Mustache=require(_0x0c0a('0x6'));var util=require('util');var path=require(_0x0c0a('0x7'));var sox=require(_0x0c0a('0x8'));var csv=require(_0x0c0a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c0a('0xa'));var _=require(_0x0c0a('0xb'));var squel=require(_0x0c0a('0xc'));var crypto=require(_0x0c0a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0c0a('0x9'));var querystring=require(_0x0c0a('0xe'));var Papa=require(_0x0c0a('0xf'));var Redis=require(_0x0c0a('0x10'));var authService=require(_0x0c0a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0c0a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0c0a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c0a('0x14'))['db'];function respondWithStatusCode(_0x1f6d7e,_0x1b256b){_0x1b256b=_0x1b256b||0xcc;return function(_0x53a8f3){if(_0x53a8f3){return _0x1f6d7e['sendStatus'](_0x1b256b);}return _0x1f6d7e['status'](_0x1b256b)[_0x0c0a('0x15')]();};}function respondWithResult(_0x363e39,_0xbdbb45){_0xbdbb45=_0xbdbb45||0xc8;return function(_0x2b28e4){if(_0x2b28e4){return _0x363e39['status'](_0xbdbb45)[_0x0c0a('0x16')](_0x2b28e4);}};}function respondWithFilteredResult(_0x244418,_0xcee943){return function(_0x13286f){if(_0x13286f){var _0xafd3ec=typeof _0xcee943['offset']===_0x0c0a('0x17')&&typeof _0xcee943[_0x0c0a('0x18')]===_0x0c0a('0x17');var _0x530054=_0x13286f['count'];var _0x530327=_0xafd3ec?0x0:_0xcee943[_0x0c0a('0x19')];var _0x1fd13d=_0xafd3ec?_0x13286f[_0x0c0a('0x1a')]:_0xcee943['offset']+_0xcee943[_0x0c0a('0x18')];var _0x1c5816;if(_0x1fd13d>=_0x530054){_0x1fd13d=_0x530054;_0x1c5816=0xc8;}else{_0x1c5816=0xce;}_0x244418[_0x0c0a('0x1b')](_0x1c5816);return _0x244418[_0x0c0a('0x1c')](_0x0c0a('0x1d'),_0x530327+'-'+_0x1fd13d+'/'+_0x530054)['json'](_0x13286f);}return null;};}function patchUpdates(_0x2f4634){return function(_0x3e1c66){try{jsonpatch[_0x0c0a('0x1e')](_0x3e1c66,_0x2f4634,!![]);}catch(_0x4519e4){return BPromise['reject'](_0x4519e4);}return _0x3e1c66[_0x0c0a('0x1f')]();};}function saveUpdates(_0x254b32,_0x5b5aac){return function(_0x36db75){if(_0x36db75){return _0x36db75[_0x0c0a('0x20')](_0x254b32)[_0x0c0a('0x21')](function(_0xb01462){return _0xb01462;});}return null;};}function removeEntity(_0x15e2ad,_0x4c9824){return function(_0x54b873){if(_0x54b873){return _0x54b873[_0x0c0a('0x22')]()[_0x0c0a('0x21')](function(){_0x15e2ad[_0x0c0a('0x1b')](0xcc)[_0x0c0a('0x15')]();});}};}function handleEntityNotFound(_0x18c214,_0x7583da){return function(_0x52233d){if(!_0x52233d){_0x18c214[_0x0c0a('0x23')](0x194);}return _0x52233d;};}function handleError(_0x22f96f,_0x4757ae){_0x4757ae=_0x4757ae||0x1f4;return function(_0x26ad1f){logger['error'](_0x26ad1f['stack']);if(_0x26ad1f[_0x0c0a('0x24')]){delete _0x26ad1f[_0x0c0a('0x24')];}_0x22f96f['status'](_0x4757ae)[_0x0c0a('0x25')](_0x26ad1f);};}exports[_0x0c0a('0x26')]=function(_0x1bc9bf,_0x5af6c5){var _0x4aaa4d={},_0xcff382={},_0x1a8916={'count':0x0,'rows':[]};var _0x4d8f9c=_['map'](db[_0x0c0a('0x27')][_0x0c0a('0x28')],function(_0x15f449){return{'name':_0x15f449[_0x0c0a('0x29')],'type':_0x15f449[_0x0c0a('0x2a')]['key']};});_0xcff382['model']=_['map'](_0x4d8f9c,'name');_0xcff382['query']=_['keys'](_0x1bc9bf['query']);_0xcff382[_0x0c0a('0x2b')]=_[_0x0c0a('0x2c')](_0xcff382[_0x0c0a('0x2d')],_0xcff382[_0x0c0a('0x2e')]);_0x4aaa4d['attributes']=_[_0x0c0a('0x2c')](_0xcff382[_0x0c0a('0x2d')],qs[_0x0c0a('0x2f')](_0x1bc9bf[_0x0c0a('0x2e')][_0x0c0a('0x2f')]));_0x4aaa4d[_0x0c0a('0x30')]=_0x4aaa4d[_0x0c0a('0x30')]['length']?_0x4aaa4d['attributes']:_0xcff382[_0x0c0a('0x2d')];if(!_0x1bc9bf['query'][_0x0c0a('0x31')](_0x0c0a('0x32'))){_0x4aaa4d[_0x0c0a('0x18')]=qs[_0x0c0a('0x18')](_0x1bc9bf[_0x0c0a('0x2e')]['limit']);_0x4aaa4d[_0x0c0a('0x19')]=qs[_0x0c0a('0x19')](_0x1bc9bf[_0x0c0a('0x2e')]['offset']);}_0x4aaa4d['order']=qs[_0x0c0a('0x33')](_0x1bc9bf[_0x0c0a('0x2e')][_0x0c0a('0x33')]);_0x4aaa4d['where']=qs['filters'](_['pick'](_0x1bc9bf[_0x0c0a('0x2e')],_0xcff382[_0x0c0a('0x2b')]),_0x4d8f9c);if(_0x1bc9bf[_0x0c0a('0x2e')][_0x0c0a('0x34')]){_0x4aaa4d[_0x0c0a('0x35')]=_[_0x0c0a('0x36')](_0x4aaa4d[_0x0c0a('0x35')],{'$or':_[_0x0c0a('0x37')](_0x4d8f9c,function(_0x27499b){if(_0x27499b['type']!=='VIRTUAL'){var _0x2df31a={};_0x2df31a[_0x27499b[_0x0c0a('0x24')]]={'$like':'%'+_0x1bc9bf[_0x0c0a('0x2e')][_0x0c0a('0x34')]+'%'};return _0x2df31a;}})});}_0x4aaa4d=_[_0x0c0a('0x36')]({},_0x4aaa4d,_0x1bc9bf[_0x0c0a('0x38')]);var _0x3d7423={'where':_0x4aaa4d['where']};return db['SquareReport'][_0x0c0a('0x1a')](_0x3d7423)[_0x0c0a('0x21')](function(_0x515516){_0x1a8916[_0x0c0a('0x1a')]=_0x515516;if(_0x1bc9bf[_0x0c0a('0x2e')]['includeAll']){_0x4aaa4d[_0x0c0a('0x39')]=[{'all':!![]}];}return db[_0x0c0a('0x27')]['findAll'](_0x4aaa4d);})['then'](function(_0x4c241e){_0x1a8916[_0x0c0a('0x3a')]=_0x4c241e;return _0x1a8916;})[_0x0c0a('0x21')](respondWithFilteredResult(_0x5af6c5,_0x4aaa4d))[_0x0c0a('0x3b')](handleError(_0x5af6c5,null));};exports['show']=function(_0x3036d0,_0x506b9b){var _0x584c1e={'raw':!![],'where':{'id':_0x3036d0['params']['id']}},_0x4410a1={};_0x4410a1[_0x0c0a('0x2d')]=_[_0x0c0a('0x3c')](db[_0x0c0a('0x27')][_0x0c0a('0x28')]);_0x4410a1[_0x0c0a('0x2e')]=_[_0x0c0a('0x3c')](_0x3036d0[_0x0c0a('0x2e')]);_0x4410a1[_0x0c0a('0x2b')]=_[_0x0c0a('0x2c')](_0x4410a1[_0x0c0a('0x2d')],_0x4410a1[_0x0c0a('0x2e')]);_0x584c1e[_0x0c0a('0x30')]=_['intersection'](_0x4410a1[_0x0c0a('0x2d')],qs['fields'](_0x3036d0['query']['fields']));_0x584c1e[_0x0c0a('0x30')]=_0x584c1e[_0x0c0a('0x30')][_0x0c0a('0x3d')]?_0x584c1e[_0x0c0a('0x30')]:_0x4410a1[_0x0c0a('0x2d')];if(_0x3036d0[_0x0c0a('0x2e')][_0x0c0a('0x3e')]){_0x584c1e['include']=[{'all':!![]}];}_0x584c1e=_[_0x0c0a('0x36')]({},_0x584c1e,_0x3036d0[_0x0c0a('0x38')]);return db[_0x0c0a('0x27')][_0x0c0a('0x3f')](_0x584c1e)['then'](handleEntityNotFound(_0x506b9b,null))[_0x0c0a('0x21')](respondWithResult(_0x506b9b,null))[_0x0c0a('0x3b')](handleError(_0x506b9b,null));};exports[_0x0c0a('0x40')]=function(_0x1a86cd,_0x29c44e){return db[_0x0c0a('0x27')][_0x0c0a('0x40')](_0x1a86cd[_0x0c0a('0x41')],{})[_0x0c0a('0x21')](respondWithResult(_0x29c44e,0xc9))['catch'](handleError(_0x29c44e,null));};exports[_0x0c0a('0x20')]=function(_0x26692b,_0xd5d507){if(_0x26692b[_0x0c0a('0x41')]['id']){delete _0x26692b[_0x0c0a('0x41')]['id'];}return db[_0x0c0a('0x27')][_0x0c0a('0x3f')]({'where':{'id':_0x26692b[_0x0c0a('0x42')]['id']}})[_0x0c0a('0x21')](handleEntityNotFound(_0xd5d507,null))[_0x0c0a('0x21')](saveUpdates(_0x26692b[_0x0c0a('0x41')],null))[_0x0c0a('0x21')](respondWithResult(_0xd5d507,null))[_0x0c0a('0x3b')](handleError(_0xd5d507,null));};exports[_0x0c0a('0x22')]=function(_0x42d73e,_0x5986f4){return db[_0x0c0a('0x27')][_0x0c0a('0x3f')]({'where':{'id':_0x42d73e[_0x0c0a('0x42')]['id']}})[_0x0c0a('0x21')](handleEntityNotFound(_0x5986f4,null))[_0x0c0a('0x21')](removeEntity(_0x5986f4,null))['catch'](handleError(_0x5986f4,null));};exports['describe']=function(_0x51d89b,_0x19ce20){return db['SquareReport'][_0x0c0a('0x43')]()[_0x0c0a('0x21')](respondWithResult(_0x19ce20,null))[_0x0c0a('0x3b')](handleError(_0x19ce20,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 78c90c2..e3eb1dd 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 _0x66f9=['../../config/environment','exports','SquareReport','report_square','uid_pname','uniqueid','leaveAt','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x5908a2,_0x590588){var _0x27876e=function(_0x11fc1a){while(--_0x11fc1a){_0x5908a2['push'](_0x5908a2['shift']());}};_0x27876e(++_0x590588);}(_0x66f9,0x85));var _0x966f=function(_0x27afa5,_0x19ff4f){_0x27afa5=_0x27afa5-0x0;var _0x4870ff=_0x66f9[_0x27afa5];return _0x4870ff;};'use strict';var _=require('lodash');var util=require(_0x966f('0x0'));var logger=require(_0x966f('0x1'))(_0x966f('0x2'));var moment=require(_0x966f('0x3'));var BPromise=require('bluebird');var rp=require(_0x966f('0x4'));var fs=require('fs');var path=require(_0x966f('0x5'));var rimraf=require(_0x966f('0x6'));var config=require(_0x966f('0x7'));var attributes=require('./squareReport.attributes');module[_0x966f('0x8')]=function(_0x132c01,_0x17646d){return _0x132c01['define'](_0x966f('0x9'),attributes,{'tableName':_0x966f('0xa'),'paranoid':![],'indexes':[{'name':_0x966f('0xb'),'fields':[_0x966f('0xc'),'project_name']},{'name':'leaveAt','fields':[_0x966f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbdbd=['request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','uid_pname','project_name','leaveAt','lodash','util','moment','bluebird'];(function(_0x3203d9,_0x5dfbda){var _0x3adf40=function(_0x81487a){while(--_0x81487a){_0x3203d9['push'](_0x3203d9['shift']());}};_0x3adf40(++_0x5dfbda);}(_0xbdbd,0x1bc));var _0xdbdb=function(_0x1f365e,_0x2b130d){_0x1f365e=_0x1f365e-0x0;var _0x2c3af0=_0xbdbd[_0x1f365e];return _0x2c3af0;};'use strict';var _=require(_0xdbdb('0x0'));var util=require(_0xdbdb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdbdb('0x2'));var BPromise=require(_0xdbdb('0x3'));var rp=require(_0xdbdb('0x4'));var fs=require('fs');var path=require(_0xdbdb('0x5'));var rimraf=require(_0xdbdb('0x6'));var config=require(_0xdbdb('0x7'));var attributes=require(_0xdbdb('0x8'));module[_0xdbdb('0x9')]=function(_0x9cc105,_0x43f7e6){return _0x9cc105['define'](_0xdbdb('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xdbdb('0xb'),'fields':['uniqueid',_0xdbdb('0xc')]},{'name':_0xdbdb('0xd'),'fields':[_0xdbdb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 2d22a7b..4729fac 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 _0x0740=['request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateSquareReport','create','body','options','raw','debug','catch','UpdateSquareReport','SquareReport','update','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0xf17fbd,_0x5e3f9d){var _0x25a926=function(_0x6209db){while(--_0x6209db){_0xf17fbd['push'](_0xf17fbd['shift']());}};_0x25a926(++_0x5e3f9d);}(_0x0740,0x1a7));var _0x0074=function(_0x32843d,_0x2e370f){_0x32843d=_0x32843d-0x0;var _0x3205f2=_0x0740[_0x32843d];return _0x3205f2;};'use strict';var _=require(_0x0074('0x0'));var util=require(_0x0074('0x1'));var moment=require('moment');var BPromise=require(_0x0074('0x2'));var rs=require(_0x0074('0x3'));var fs=require('fs');var Redis=require(_0x0074('0x4'));var db=require(_0x0074('0x5'))['db'];var utils=require(_0x0074('0x6'));var logger=require('../../config/logger')(_0x0074('0x7'));var config=require(_0x0074('0x8'));var jayson=require(_0x0074('0x9'));var client=jayson['client'][_0x0074('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x545eb8,_0x30049e,_0x13e8e){return new BPromise(function(_0x5a5ce5,_0x16ce8d){return client[_0x0074('0xb')](_0x545eb8,_0x13e8e)[_0x0074('0xc')](function(_0x41e8da){logger[_0x0074('0xd')](_0x0074('0xe'),_0x30049e,_0x0074('0xf'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x30049e,_0x0074('0xf'),JSON[_0x0074('0x10')](_0x41e8da));if(_0x41e8da[_0x0074('0x11')]){if(_0x41e8da[_0x0074('0x11')][_0x0074('0x12')]===0x1f4){logger[_0x0074('0x11')]('SquareReport,\x20%s,\x20%s',_0x30049e,_0x41e8da[_0x0074('0x11')][_0x0074('0x13')]);return _0x16ce8d(_0x41e8da[_0x0074('0x11')][_0x0074('0x13')]);}logger[_0x0074('0x11')](_0x0074('0xe'),_0x30049e,_0x41e8da['error'][_0x0074('0x13')]);return _0x5a5ce5(_0x41e8da[_0x0074('0x11')][_0x0074('0x13')]);}else{logger[_0x0074('0xd')](_0x0074('0xe'),_0x30049e,'request\x20sent');_0x5a5ce5(_0x41e8da['result']['message']);}})['catch'](function(_0x4eb08a){logger[_0x0074('0x11')](_0x0074('0xe'),_0x30049e,_0x4eb08a);_0x16ce8d(_0x4eb08a);});});}exports[_0x0074('0x14')]=function(_0x27186d){var _0x120a07=this;return new Promise(function(_0x39ab5c,_0x337e7c){return db['SquareReport'][_0x0074('0x15')](_0x27186d[_0x0074('0x16')],{'raw':_0x27186d[_0x0074('0x17')]?_0x27186d[_0x0074('0x17')][_0x0074('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x30e728){logger[_0x0074('0xd')](_0x0074('0x14'),_0x27186d);logger[_0x0074('0x19')](_0x0074('0x14'),_0x27186d,JSON[_0x0074('0x10')](_0x30e728));_0x39ab5c(_0x30e728);})[_0x0074('0x1a')](function(_0x24dfa5){logger['error']('CreateSquareReport',_0x24dfa5[_0x0074('0x13')],_0x27186d);_0x337e7c(_0x120a07[_0x0074('0x11')](0x1f4,_0x24dfa5[_0x0074('0x13')]));});});};exports[_0x0074('0x1b')]=function(_0x5c17b6){var _0x553ba1=this;return new Promise(function(_0x10e864,_0x37fdff){return db[_0x0074('0x1c')][_0x0074('0x1d')](_0x5c17b6[_0x0074('0x16')],{'raw':_0x5c17b6[_0x0074('0x17')]?_0x5c17b6[_0x0074('0x17')][_0x0074('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c17b6[_0x0074('0x17')]?_0x5c17b6[_0x0074('0x17')][_0x0074('0x1e')]||null:null,'attributes':_0x5c17b6['options']?_0x5c17b6[_0x0074('0x17')]['attributes']||null:null,'limit':_0x5c17b6['options']?_0x5c17b6[_0x0074('0x17')]['limit']||null:null})['then'](function(_0x5ae57b){logger[_0x0074('0xd')]('UpdateSquareReport',_0x5c17b6);logger[_0x0074('0x19')]('UpdateSquareReport',_0x5c17b6,JSON['stringify'](_0x5ae57b));_0x10e864(_0x5ae57b);})[_0x0074('0x1a')](function(_0x461521){logger['error']('UpdateSquareReport',_0x461521['message'],_0x5c17b6);_0x37fdff(_0x553ba1[_0x0074('0x11')](0x1f4,_0x461521['message']));});});}; \ No newline at end of file +var _0x56a9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','update','where','attributes','limit','UpdateSquareReport','lodash','util','moment'];(function(_0x45bccd,_0x130e52){var _0x561467=function(_0xb653dc){while(--_0xb653dc){_0x45bccd['push'](_0x45bccd['shift']());}};_0x561467(++_0x130e52);}(_0x56a9,0xac));var _0x956a=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x56a9[_0x4450b1];return _0x399b0b;};'use strict';var _=require(_0x956a('0x0'));var util=require(_0x956a('0x1'));var moment=require(_0x956a('0x2'));var BPromise=require(_0x956a('0x3'));var rs=require(_0x956a('0x4'));var fs=require('fs');var Redis=require(_0x956a('0x5'));var db=require(_0x956a('0x6'))['db'];var utils=require(_0x956a('0x7'));var logger=require('../../config/logger')(_0x956a('0x8'));var config=require(_0x956a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x956a('0xa')][_0x956a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ba20b,_0x15c0e6,_0x109717){return new BPromise(function(_0x6c58c6,_0x23b16b){return client['request'](_0x4ba20b,_0x109717)[_0x956a('0xc')](function(_0x1e1b60){logger[_0x956a('0xd')](_0x956a('0xe'),_0x15c0e6,'request\x20sent');logger[_0x956a('0xf')](_0x956a('0x10'),_0x15c0e6,_0x956a('0x11'),JSON[_0x956a('0x12')](_0x1e1b60));if(_0x1e1b60['error']){if(_0x1e1b60[_0x956a('0x13')][_0x956a('0x14')]===0x1f4){logger[_0x956a('0x13')](_0x956a('0xe'),_0x15c0e6,_0x1e1b60['error'][_0x956a('0x15')]);return _0x23b16b(_0x1e1b60['error'][_0x956a('0x15')]);}logger['error'](_0x956a('0xe'),_0x15c0e6,_0x1e1b60[_0x956a('0x13')][_0x956a('0x15')]);return _0x6c58c6(_0x1e1b60[_0x956a('0x13')][_0x956a('0x15')]);}else{logger[_0x956a('0xd')](_0x956a('0xe'),_0x15c0e6,_0x956a('0x11'));_0x6c58c6(_0x1e1b60[_0x956a('0x16')][_0x956a('0x15')]);}})[_0x956a('0x17')](function(_0x2e5aa8){logger[_0x956a('0x13')]('SquareReport,\x20%s,\x20%s',_0x15c0e6,_0x2e5aa8);_0x23b16b(_0x2e5aa8);});});}exports[_0x956a('0x18')]=function(_0x338d1e){var _0xc3bf05=this;return new Promise(function(_0x3a4c2d,_0x48c5fe){return db[_0x956a('0x19')][_0x956a('0x1a')](_0x338d1e[_0x956a('0x1b')],{'raw':_0x338d1e[_0x956a('0x1c')]?_0x338d1e[_0x956a('0x1c')][_0x956a('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x302143){logger['info'](_0x956a('0x18'),_0x338d1e);logger[_0x956a('0xf')]('CreateSquareReport',_0x338d1e,JSON[_0x956a('0x12')](_0x302143));_0x3a4c2d(_0x302143);})[_0x956a('0x17')](function(_0x20e4fb){logger['error'](_0x956a('0x18'),_0x20e4fb[_0x956a('0x15')],_0x338d1e);_0x48c5fe(_0xc3bf05[_0x956a('0x13')](0x1f4,_0x20e4fb[_0x956a('0x15')]));});});};exports['UpdateSquareReport']=function(_0x523275){var _0x41c527=this;return new Promise(function(_0x4db58a,_0x2e93cc){return db['SquareReport'][_0x956a('0x1e')](_0x523275[_0x956a('0x1b')],{'raw':_0x523275[_0x956a('0x1c')]?_0x523275[_0x956a('0x1c')][_0x956a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x523275[_0x956a('0x1c')]?_0x523275[_0x956a('0x1c')][_0x956a('0x1f')]||null:null,'attributes':_0x523275['options']?_0x523275[_0x956a('0x1c')][_0x956a('0x20')]||null:null,'limit':_0x523275[_0x956a('0x1c')]?_0x523275[_0x956a('0x1c')][_0x956a('0x21')]||null:null})[_0x956a('0xc')](function(_0xeb3d27){logger[_0x956a('0xd')](_0x956a('0x22'),_0x523275);logger['debug'](_0x956a('0x22'),_0x523275,JSON[_0x956a('0x12')](_0xeb3d27));_0x4db58a(_0xeb3d27);})[_0x956a('0x17')](function(_0x3a7075){logger[_0x956a('0x13')]('UpdateSquareReport',_0x3a7075['message'],_0x523275);_0x2e93cc(_0x41c527['error'](0x1f4,_0x3a7075['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index f012ded..e456fbc 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 _0xebe5=['fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','/:id','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2408cc,_0x394561){var _0x22174d=function(_0x3c36de){while(--_0x3c36de){_0x2408cc['push'](_0x2408cc['shift']());}};_0x22174d(++_0x394561);}(_0xebe5,0x164));var _0x5ebe=function(_0x4786ee,_0x28166d){_0x4786ee=_0x4786ee-0x0;var _0x2c662e=_0xebe5[_0x4786ee];return _0x2c662e;};'use strict';var multer=require(_0x5ebe('0x0'));var util=require('util');var path=require(_0x5ebe('0x1'));var timeout=require(_0x5ebe('0x2'));var express=require(_0x5ebe('0x3'));var router=express[_0x5ebe('0x4')]();var fs_extra=require(_0x5ebe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5ebe('0x6'));var config=require(_0x5ebe('0x7'));var controller=require(_0x5ebe('0x8'));router[_0x5ebe('0x9')]('/',auth[_0x5ebe('0xa')](),controller['index']);router['get'](_0x5ebe('0xb'),auth['isAuthenticated'](),controller[_0x5ebe('0xc')]);router['get'](_0x5ebe('0xd'),auth[_0x5ebe('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5ebe('0xe')](_0x5ebe('0xd'),auth[_0x5ebe('0xa')](),controller[_0x5ebe('0xf')]);router[_0x5ebe('0x10')](_0x5ebe('0xd'),auth[_0x5ebe('0xa')](),controller[_0x5ebe('0x11')]);module[_0x5ebe('0x12')]=router; \ No newline at end of file +var _0xb8c2=['update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x410c74,_0x1d66f6){var _0x1b8a24=function(_0x2bee26){while(--_0x2bee26){_0x410c74['push'](_0x410c74['shift']());}};_0x1b8a24(++_0x1d66f6);}(_0xb8c2,0x146));var _0x2b8c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb8c2[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x2b8c('0x0'));var path=require(_0x2b8c('0x1'));var timeout=require(_0x2b8c('0x2'));var express=require('express');var router=express[_0x2b8c('0x3')]();var fs_extra=require(_0x2b8c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2b8c('0x5'));var controller=require('./squareReportDetail.controller');router[_0x2b8c('0x6')]('/',auth[_0x2b8c('0x7')](),controller[_0x2b8c('0x8')]);router['get'](_0x2b8c('0x9'),auth[_0x2b8c('0x7')](),controller[_0x2b8c('0xa')]);router[_0x2b8c('0x6')](_0x2b8c('0xb'),auth[_0x2b8c('0x7')](),controller[_0x2b8c('0xc')]);router[_0x2b8c('0xd')]('/',auth[_0x2b8c('0x7')](),controller[_0x2b8c('0xe')]);router[_0x2b8c('0xf')](_0x2b8c('0xb'),auth[_0x2b8c('0x7')](),controller[_0x2b8c('0x10')]);router['delete'](_0x2b8c('0xb'),auth[_0x2b8c('0x7')](),controller[_0x2b8c('0x11')]);module[_0x2b8c('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 912995a..c458454 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 _0xc193=['sequelize','exports','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc193,0x1e0));var _0x3c19=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc193[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x3c19('0x0'));module[_0x3c19('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x3c19('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x3c19('0x2')]},'callerid':{'type':Sequelize[_0x3c19('0x2')]}}; \ No newline at end of file +var _0x2f3d=['STRING','sequelize','exports'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x2f3d,0xd6));var _0xd2f3=function(_0x46adcb,_0x4d0a59){_0x46adcb=_0x46adcb-0x0;var _0x216315=_0x2f3d[_0x46adcb];return _0x216315;};'use strict';var Sequelize=require(_0xd2f3('0x0'));module[_0xd2f3('0x1')]={'uniqueid':{'type':Sequelize[_0xd2f3('0x2')]},'node':{'type':Sequelize[_0xd2f3('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xd2f3('0x2')]},'callerid':{'type':Sequelize[_0xd2f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 04ea194..fb5f9d3 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 _0x2f34=['count','limit','set','reject','then','destroy','sendStatus','stack','name','send','SquareDetailsReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined'];(function(_0x244b53,_0x47a9ad){var _0x5b3a38=function(_0x18710c){while(--_0x18710c){_0x244b53['push'](_0x244b53['shift']());}};_0x5b3a38(++_0x47a9ad);}(_0x2f34,0x158));var _0x42f3=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x2f34[_0x2ec461];return _0x28603d;};'use strict';var emlformat=require(_0x42f3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42f3('0x1'));var rp=require(_0x42f3('0x2'));var moment=require(_0x42f3('0x3'));var BPromise=require(_0x42f3('0x4'));var Mustache=require(_0x42f3('0x5'));var util=require(_0x42f3('0x6'));var path=require(_0x42f3('0x7'));var sox=require(_0x42f3('0x8'));var csv=require(_0x42f3('0x9'));var ejs=require(_0x42f3('0xa'));var fs=require('fs');var fs_extra=require(_0x42f3('0xb'));var _=require(_0x42f3('0xc'));var squel=require(_0x42f3('0xd'));var crypto=require(_0x42f3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x42f3('0xf'));var toCsv=require(_0x42f3('0x9'));var querystring=require(_0x42f3('0x10'));var Papa=require(_0x42f3('0x11'));var Redis=require(_0x42f3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x42f3('0x13'));var as=require(_0x42f3('0x14'));var hardwareService=require(_0x42f3('0x15'));var logger=require('../../config/logger')(_0x42f3('0x16'));var utils=require(_0x42f3('0x17'));var config=require(_0x42f3('0x18'));var licenseUtil=require(_0x42f3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb8ee22,_0x54ef61){_0x54ef61=_0x54ef61||0xcc;return function(_0x329a2a){if(_0x329a2a){return _0xb8ee22['sendStatus'](_0x54ef61);}return _0xb8ee22[_0x42f3('0x1a')](_0x54ef61)[_0x42f3('0x1b')]();};}function respondWithResult(_0x448b0e,_0xdc6e90){_0xdc6e90=_0xdc6e90||0xc8;return function(_0x2e79b8){if(_0x2e79b8){return _0x448b0e[_0x42f3('0x1a')](_0xdc6e90)[_0x42f3('0x1c')](_0x2e79b8);}};}function respondWithFilteredResult(_0x3e5a37,_0x49a67f){return function(_0x1650b1){if(_0x1650b1){var _0x4bff8d=typeof _0x49a67f[_0x42f3('0x1d')]===_0x42f3('0x1e')&&typeof _0x49a67f['limit']===_0x42f3('0x1e');var _0x376800=_0x1650b1['count'];var _0x3f2b88=_0x4bff8d?0x0:_0x49a67f[_0x42f3('0x1d')];var _0x1de077=_0x4bff8d?_0x1650b1[_0x42f3('0x1f')]:_0x49a67f['offset']+_0x49a67f[_0x42f3('0x20')];var _0x9b593d;if(_0x1de077>=_0x376800){_0x1de077=_0x376800;_0x9b593d=0xc8;}else{_0x9b593d=0xce;}_0x3e5a37[_0x42f3('0x1a')](_0x9b593d);return _0x3e5a37[_0x42f3('0x21')]('Content-Range',_0x3f2b88+'-'+_0x1de077+'/'+_0x376800)['json'](_0x1650b1);}return null;};}function patchUpdates(_0x14eb8e){return function(_0x2703d2){try{jsonpatch['apply'](_0x2703d2,_0x14eb8e,!![]);}catch(_0x36ffa9){return BPromise[_0x42f3('0x22')](_0x36ffa9);}return _0x2703d2['save']();};}function saveUpdates(_0x15c8b8,_0x4f3a2d){return function(_0x41fe3f){if(_0x41fe3f){return _0x41fe3f['update'](_0x15c8b8)[_0x42f3('0x23')](function(_0x604e7f){return _0x604e7f;});}return null;};}function removeEntity(_0x452ff4,_0x5ac014){return function(_0x2f7f0c){if(_0x2f7f0c){return _0x2f7f0c[_0x42f3('0x24')]()[_0x42f3('0x23')](function(){_0x452ff4[_0x42f3('0x1a')](0xcc)[_0x42f3('0x1b')]();});}};}function handleEntityNotFound(_0x1bfa05,_0x5bdf6a){return function(_0xd96223){if(!_0xd96223){_0x1bfa05[_0x42f3('0x25')](0x194);}return _0xd96223;};}function handleError(_0xdafc36,_0x37580f){_0x37580f=_0x37580f||0x1f4;return function(_0x507883){logger['error'](_0x507883[_0x42f3('0x26')]);if(_0x507883[_0x42f3('0x27')]){delete _0x507883[_0x42f3('0x27')];}_0xdafc36[_0x42f3('0x1a')](_0x37580f)[_0x42f3('0x28')](_0x507883);};}exports['index']=function(_0xbb14eb,_0x1e4dd0){var _0x1d58b2={},_0x2ceef4={},_0x5deb5d={'count':0x0,'rows':[]};var _0x1916f9=_['map'](db[_0x42f3('0x29')][_0x42f3('0x2a')],function(_0x331b0d){return{'name':_0x331b0d['fieldName'],'type':_0x331b0d[_0x42f3('0x2b')]['key']};});_0x2ceef4[_0x42f3('0x2c')]=_['map'](_0x1916f9,_0x42f3('0x27'));_0x2ceef4['query']=_[_0x42f3('0x2d')](_0xbb14eb[_0x42f3('0x2e')]);_0x2ceef4[_0x42f3('0x2f')]=_[_0x42f3('0x30')](_0x2ceef4[_0x42f3('0x2c')],_0x2ceef4['query']);_0x1d58b2[_0x42f3('0x31')]=_[_0x42f3('0x30')](_0x2ceef4['model'],qs['fields'](_0xbb14eb[_0x42f3('0x2e')][_0x42f3('0x32')]));_0x1d58b2[_0x42f3('0x31')]=_0x1d58b2['attributes'][_0x42f3('0x33')]?_0x1d58b2[_0x42f3('0x31')]:_0x2ceef4[_0x42f3('0x2c')];if(!_0xbb14eb[_0x42f3('0x2e')][_0x42f3('0x34')](_0x42f3('0x35'))){_0x1d58b2[_0x42f3('0x20')]=qs[_0x42f3('0x20')](_0xbb14eb['query']['limit']);_0x1d58b2[_0x42f3('0x1d')]=qs[_0x42f3('0x1d')](_0xbb14eb[_0x42f3('0x2e')][_0x42f3('0x1d')]);}_0x1d58b2[_0x42f3('0x36')]=qs['sort'](_0xbb14eb[_0x42f3('0x2e')][_0x42f3('0x37')]);_0x1d58b2['where']=qs[_0x42f3('0x2f')](_[_0x42f3('0x38')](_0xbb14eb[_0x42f3('0x2e')],_0x2ceef4['filters']),_0x1916f9);if(_0xbb14eb['query'][_0x42f3('0x39')]){_0x1d58b2[_0x42f3('0x3a')]=_[_0x42f3('0x3b')](_0x1d58b2['where'],{'$or':_[_0x42f3('0x3c')](_0x1916f9,function(_0x1af495){if(_0x1af495[_0x42f3('0x2b')]!==_0x42f3('0x3d')){var _0x462e66={};_0x462e66[_0x1af495[_0x42f3('0x27')]]={'$like':'%'+_0xbb14eb[_0x42f3('0x2e')][_0x42f3('0x39')]+'%'};return _0x462e66;}})});}_0x1d58b2=_[_0x42f3('0x3b')]({},_0x1d58b2,_0xbb14eb[_0x42f3('0x3e')]);var _0x456fec={'where':_0x1d58b2[_0x42f3('0x3a')]};return db[_0x42f3('0x29')]['count'](_0x456fec)[_0x42f3('0x23')](function(_0x2e14b){_0x5deb5d['count']=_0x2e14b;if(_0xbb14eb['query']['includeAll']){_0x1d58b2[_0x42f3('0x3f')]=[{'all':!![]}];}return db[_0x42f3('0x29')][_0x42f3('0x40')](_0x1d58b2);})['then'](function(_0x4aac42){_0x5deb5d[_0x42f3('0x41')]=_0x4aac42;return _0x5deb5d;})[_0x42f3('0x23')](respondWithFilteredResult(_0x1e4dd0,_0x1d58b2))[_0x42f3('0x42')](handleError(_0x1e4dd0,null));};exports[_0x42f3('0x43')]=function(_0x2e2b70,_0x175a48){var _0x212a09={'raw':!![],'where':{'id':_0x2e2b70[_0x42f3('0x44')]['id']}},_0x2e37af={};_0x2e37af[_0x42f3('0x2c')]=_[_0x42f3('0x2d')](db[_0x42f3('0x29')][_0x42f3('0x2a')]);_0x2e37af[_0x42f3('0x2e')]=_[_0x42f3('0x2d')](_0x2e2b70[_0x42f3('0x2e')]);_0x2e37af[_0x42f3('0x2f')]=_[_0x42f3('0x30')](_0x2e37af[_0x42f3('0x2c')],_0x2e37af[_0x42f3('0x2e')]);_0x212a09[_0x42f3('0x31')]=_['intersection'](_0x2e37af[_0x42f3('0x2c')],qs[_0x42f3('0x32')](_0x2e2b70[_0x42f3('0x2e')]['fields']));_0x212a09[_0x42f3('0x31')]=_0x212a09['attributes'][_0x42f3('0x33')]?_0x212a09['attributes']:_0x2e37af['model'];if(_0x2e2b70[_0x42f3('0x2e')][_0x42f3('0x45')]){_0x212a09[_0x42f3('0x3f')]=[{'all':!![]}];}_0x212a09=_[_0x42f3('0x3b')]({},_0x212a09,_0x2e2b70[_0x42f3('0x3e')]);return db[_0x42f3('0x29')][_0x42f3('0x46')](_0x212a09)[_0x42f3('0x23')](handleEntityNotFound(_0x175a48,null))[_0x42f3('0x23')](respondWithResult(_0x175a48,null))[_0x42f3('0x42')](handleError(_0x175a48,null));};exports[_0x42f3('0x47')]=function(_0x23827a,_0x595a05){return db['SquareDetailsReport'][_0x42f3('0x47')](_0x23827a[_0x42f3('0x48')],{})[_0x42f3('0x23')](respondWithResult(_0x595a05,0xc9))[_0x42f3('0x42')](handleError(_0x595a05,null));};exports[_0x42f3('0x49')]=function(_0x63c549,_0xb61f32){if(_0x63c549['body']['id']){delete _0x63c549['body']['id'];}return db['SquareDetailsReport'][_0x42f3('0x46')]({'where':{'id':_0x63c549[_0x42f3('0x44')]['id']}})[_0x42f3('0x23')](handleEntityNotFound(_0xb61f32,null))['then'](saveUpdates(_0x63c549['body'],null))['then'](respondWithResult(_0xb61f32,null))[_0x42f3('0x42')](handleError(_0xb61f32,null));};exports[_0x42f3('0x24')]=function(_0x28c366,_0x4f43a8){return db[_0x42f3('0x29')][_0x42f3('0x46')]({'where':{'id':_0x28c366[_0x42f3('0x44')]['id']}})[_0x42f3('0x23')](handleEntityNotFound(_0x4f43a8,null))['then'](removeEntity(_0x4f43a8,null))[_0x42f3('0x42')](handleError(_0x4f43a8,null));};exports[_0x42f3('0x4a')]=function(_0x3a2265,_0x496fbb){return db['SquareDetailsReport'][_0x42f3('0x4a')]()['then'](respondWithResult(_0x496fbb,null))[_0x42f3('0x42')](handleError(_0x496fbb,null));}; \ No newline at end of file +var _0xd068=['filter','merge','options','includeAll','findAll','rows','catch','show','params','fields','include','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd068,0xad));var _0x8d06=function(_0x48825f,_0x3666b2){_0x48825f=_0x48825f-0x0;var _0x41f876=_0xd068[_0x48825f];return _0x41f876;};'use strict';var emlformat=require(_0x8d06('0x0'));var rimraf=require(_0x8d06('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d06('0x2'));var rp=require(_0x8d06('0x3'));var moment=require(_0x8d06('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8d06('0x5'));var util=require(_0x8d06('0x6'));var path=require(_0x8d06('0x7'));var sox=require(_0x8d06('0x8'));var csv=require(_0x8d06('0x9'));var ejs=require(_0x8d06('0xa'));var fs=require('fs');var fs_extra=require(_0x8d06('0xb'));var _=require(_0x8d06('0xc'));var squel=require(_0x8d06('0xd'));var crypto=require(_0x8d06('0xe'));var jsforce=require(_0x8d06('0xf'));var deskjs=require(_0x8d06('0x10'));var toCsv=require(_0x8d06('0x9'));var querystring=require(_0x8d06('0x11'));var Papa=require(_0x8d06('0x12'));var Redis=require('ioredis');var authService=require(_0x8d06('0x13'));var qs=require(_0x8d06('0x14'));var as=require(_0x8d06('0x15'));var hardwareService=require(_0x8d06('0x16'));var logger=require(_0x8d06('0x17'))(_0x8d06('0x18'));var utils=require(_0x8d06('0x19'));var config=require(_0x8d06('0x1a'));var licenseUtil=require(_0x8d06('0x1b'));var db=require(_0x8d06('0x1c'))['db'];function respondWithStatusCode(_0x6d4d69,_0x5f0d0b){_0x5f0d0b=_0x5f0d0b||0xcc;return function(_0x29f936){if(_0x29f936){return _0x6d4d69[_0x8d06('0x1d')](_0x5f0d0b);}return _0x6d4d69[_0x8d06('0x1e')](_0x5f0d0b)[_0x8d06('0x1f')]();};}function respondWithResult(_0x254ac3,_0x2be619){_0x2be619=_0x2be619||0xc8;return function(_0x2b5e22){if(_0x2b5e22){return _0x254ac3[_0x8d06('0x1e')](_0x2be619)['json'](_0x2b5e22);}};}function respondWithFilteredResult(_0x4da834,_0x3312a4){return function(_0x23a579){if(_0x23a579){var _0x43b1d1=typeof _0x3312a4[_0x8d06('0x20')]===_0x8d06('0x21')&&typeof _0x3312a4[_0x8d06('0x22')]===_0x8d06('0x21');var _0x22a2c1=_0x23a579[_0x8d06('0x23')];var _0x32de23=_0x43b1d1?0x0:_0x3312a4[_0x8d06('0x20')];var _0x3c2bc5=_0x43b1d1?_0x23a579[_0x8d06('0x23')]:_0x3312a4['offset']+_0x3312a4['limit'];var _0x56f3d6;if(_0x3c2bc5>=_0x22a2c1){_0x3c2bc5=_0x22a2c1;_0x56f3d6=0xc8;}else{_0x56f3d6=0xce;}_0x4da834[_0x8d06('0x1e')](_0x56f3d6);return _0x4da834[_0x8d06('0x24')]('Content-Range',_0x32de23+'-'+_0x3c2bc5+'/'+_0x22a2c1)[_0x8d06('0x25')](_0x23a579);}return null;};}function patchUpdates(_0x2b07bf){return function(_0x48777e){try{jsonpatch[_0x8d06('0x26')](_0x48777e,_0x2b07bf,!![]);}catch(_0x15147e){return BPromise[_0x8d06('0x27')](_0x15147e);}return _0x48777e[_0x8d06('0x28')]();};}function saveUpdates(_0x2012e1,_0x15368b){return function(_0x324aff){if(_0x324aff){return _0x324aff[_0x8d06('0x29')](_0x2012e1)[_0x8d06('0x2a')](function(_0x31814d){return _0x31814d;});}return null;};}function removeEntity(_0x4e1f85,_0x4bfc08){return function(_0x36a100){if(_0x36a100){return _0x36a100[_0x8d06('0x2b')]()['then'](function(){_0x4e1f85[_0x8d06('0x1e')](0xcc)[_0x8d06('0x1f')]();});}};}function handleEntityNotFound(_0xa085e2,_0x5a9cbc){return function(_0x31df7a){if(!_0x31df7a){_0xa085e2[_0x8d06('0x1d')](0x194);}return _0x31df7a;};}function handleError(_0x173244,_0x138c39){_0x138c39=_0x138c39||0x1f4;return function(_0x3f2707){logger['error'](_0x3f2707[_0x8d06('0x2c')]);if(_0x3f2707[_0x8d06('0x2d')]){delete _0x3f2707[_0x8d06('0x2d')];}_0x173244[_0x8d06('0x1e')](_0x138c39)[_0x8d06('0x2e')](_0x3f2707);};}exports[_0x8d06('0x2f')]=function(_0xb50bd2,_0x46a60d){var _0x21a32d={},_0x2d9635={},_0x2a2def={'count':0x0,'rows':[]};var _0x5a3116=_[_0x8d06('0x30')](db[_0x8d06('0x31')][_0x8d06('0x32')],function(_0x4d6c73){return{'name':_0x4d6c73['fieldName'],'type':_0x4d6c73[_0x8d06('0x33')][_0x8d06('0x34')]};});_0x2d9635[_0x8d06('0x35')]=_[_0x8d06('0x30')](_0x5a3116,_0x8d06('0x2d'));_0x2d9635[_0x8d06('0x36')]=_[_0x8d06('0x37')](_0xb50bd2[_0x8d06('0x36')]);_0x2d9635[_0x8d06('0x38')]=_[_0x8d06('0x39')](_0x2d9635[_0x8d06('0x35')],_0x2d9635['query']);_0x21a32d[_0x8d06('0x3a')]=_[_0x8d06('0x39')](_0x2d9635[_0x8d06('0x35')],qs['fields'](_0xb50bd2[_0x8d06('0x36')]['fields']));_0x21a32d[_0x8d06('0x3a')]=_0x21a32d[_0x8d06('0x3a')][_0x8d06('0x3b')]?_0x21a32d[_0x8d06('0x3a')]:_0x2d9635[_0x8d06('0x35')];if(!_0xb50bd2[_0x8d06('0x36')][_0x8d06('0x3c')](_0x8d06('0x3d'))){_0x21a32d[_0x8d06('0x22')]=qs[_0x8d06('0x22')](_0xb50bd2[_0x8d06('0x36')][_0x8d06('0x22')]);_0x21a32d['offset']=qs[_0x8d06('0x20')](_0xb50bd2[_0x8d06('0x36')][_0x8d06('0x20')]);}_0x21a32d['order']=qs[_0x8d06('0x3e')](_0xb50bd2[_0x8d06('0x36')][_0x8d06('0x3e')]);_0x21a32d[_0x8d06('0x3f')]=qs['filters'](_['pick'](_0xb50bd2[_0x8d06('0x36')],_0x2d9635[_0x8d06('0x38')]),_0x5a3116);if(_0xb50bd2[_0x8d06('0x36')][_0x8d06('0x40')]){_0x21a32d['where']=_[_0x8d06('0x41')](_0x21a32d[_0x8d06('0x3f')],{'$or':_['map'](_0x5a3116,function(_0x41e192){if(_0x41e192[_0x8d06('0x33')]!=='VIRTUAL'){var _0x3561a7={};_0x3561a7[_0x41e192['name']]={'$like':'%'+_0xb50bd2['query'][_0x8d06('0x40')]+'%'};return _0x3561a7;}})});}_0x21a32d=_[_0x8d06('0x41')]({},_0x21a32d,_0xb50bd2[_0x8d06('0x42')]);var _0x3d3c4f={'where':_0x21a32d['where']};return db['SquareDetailsReport']['count'](_0x3d3c4f)[_0x8d06('0x2a')](function(_0x3c555d){_0x2a2def['count']=_0x3c555d;if(_0xb50bd2['query'][_0x8d06('0x43')]){_0x21a32d['include']=[{'all':!![]}];}return db[_0x8d06('0x31')][_0x8d06('0x44')](_0x21a32d);})[_0x8d06('0x2a')](function(_0x52a1e0){_0x2a2def[_0x8d06('0x45')]=_0x52a1e0;return _0x2a2def;})['then'](respondWithFilteredResult(_0x46a60d,_0x21a32d))[_0x8d06('0x46')](handleError(_0x46a60d,null));};exports[_0x8d06('0x47')]=function(_0x461d48,_0x1cedb2){var _0x51f6c4={'raw':!![],'where':{'id':_0x461d48[_0x8d06('0x48')]['id']}},_0x4c8d={};_0x4c8d[_0x8d06('0x35')]=_[_0x8d06('0x37')](db[_0x8d06('0x31')]['rawAttributes']);_0x4c8d['query']=_['keys'](_0x461d48['query']);_0x4c8d['filters']=_[_0x8d06('0x39')](_0x4c8d[_0x8d06('0x35')],_0x4c8d[_0x8d06('0x36')]);_0x51f6c4[_0x8d06('0x3a')]=_[_0x8d06('0x39')](_0x4c8d[_0x8d06('0x35')],qs['fields'](_0x461d48[_0x8d06('0x36')][_0x8d06('0x49')]));_0x51f6c4[_0x8d06('0x3a')]=_0x51f6c4['attributes'][_0x8d06('0x3b')]?_0x51f6c4[_0x8d06('0x3a')]:_0x4c8d['model'];if(_0x461d48[_0x8d06('0x36')][_0x8d06('0x43')]){_0x51f6c4[_0x8d06('0x4a')]=[{'all':!![]}];}_0x51f6c4=_[_0x8d06('0x41')]({},_0x51f6c4,_0x461d48[_0x8d06('0x42')]);return db[_0x8d06('0x31')]['find'](_0x51f6c4)[_0x8d06('0x2a')](handleEntityNotFound(_0x1cedb2,null))['then'](respondWithResult(_0x1cedb2,null))[_0x8d06('0x46')](handleError(_0x1cedb2,null));};exports['create']=function(_0x7345d1,_0x5a78d3){return db['SquareDetailsReport'][_0x8d06('0x4b')](_0x7345d1[_0x8d06('0x4c')],{})[_0x8d06('0x2a')](respondWithResult(_0x5a78d3,0xc9))[_0x8d06('0x46')](handleError(_0x5a78d3,null));};exports[_0x8d06('0x29')]=function(_0xf67a74,_0x4a5b8a){if(_0xf67a74[_0x8d06('0x4c')]['id']){delete _0xf67a74[_0x8d06('0x4c')]['id'];}return db['SquareDetailsReport'][_0x8d06('0x4d')]({'where':{'id':_0xf67a74[_0x8d06('0x48')]['id']}})[_0x8d06('0x2a')](handleEntityNotFound(_0x4a5b8a,null))[_0x8d06('0x2a')](saveUpdates(_0xf67a74[_0x8d06('0x4c')],null))[_0x8d06('0x2a')](respondWithResult(_0x4a5b8a,null))[_0x8d06('0x46')](handleError(_0x4a5b8a,null));};exports['destroy']=function(_0xc2a50f,_0x340ede){return db[_0x8d06('0x31')][_0x8d06('0x4d')]({'where':{'id':_0xc2a50f['params']['id']}})[_0x8d06('0x2a')](handleEntityNotFound(_0x340ede,null))['then'](removeEntity(_0x340ede,null))[_0x8d06('0x46')](handleError(_0x340ede,null));};exports[_0x8d06('0x4e')]=function(_0x143639,_0x3517fd){return db[_0x8d06('0x31')][_0x8d06('0x4e')]()['then'](respondWithResult(_0x3517fd,null))['catch'](handleError(_0x3517fd,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index e12d41d..187d663 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 _0xec4d=['SquareDetailsReport','report_square_details','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0x31bc95,_0x1d3fbb){var _0xacc5bc=function(_0x109326){while(--_0x109326){_0x31bc95['push'](_0x31bc95['shift']());}};_0xacc5bc(++_0x1d3fbb);}(_0xec4d,0x91));var _0xdec4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xec4d[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require(_0xdec4('0x0'));var logger=require(_0xdec4('0x1'))(_0xdec4('0x2'));var moment=require(_0xdec4('0x3'));var BPromise=require(_0xdec4('0x4'));var rp=require(_0xdec4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdec4('0x6'));var config=require(_0xdec4('0x7'));var attributes=require(_0xdec4('0x8'));module[_0xdec4('0x9')]=function(_0x29b0eb,_0x1e14ff){return _0x29b0eb[_0xdec4('0xa')](_0xdec4('0xb'),attributes,{'tableName':_0xdec4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['SquareDetailsReport','report_square_details','lodash','../../config/logger','request-promise','path','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x4ff82e,_0x818abf){var _0x23b2cb=function(_0xa1c010){while(--_0xa1c010){_0x4ff82e['push'](_0x4ff82e['shift']());}};_0x23b2cb(++_0x818abf);}(_0xf494,0x12b));var _0x4f49=function(_0xb59245,_0x24240c){_0xb59245=_0xb59245-0x0;var _0x1aeb2f=_0xf494[_0xb59245];return _0x1aeb2f;};'use strict';var _=require(_0x4f49('0x0'));var util=require('util');var logger=require(_0x4f49('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4f49('0x2'));var fs=require('fs');var path=require(_0x4f49('0x3'));var rimraf=require('rimraf');var config=require(_0x4f49('0x4'));var attributes=require(_0x4f49('0x5'));module[_0x4f49('0x6')]=function(_0x53f630,_0x2964ef){return _0x53f630['define'](_0x4f49('0x7'),attributes,{'tableName':_0x4f49('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index d262db2..8c96f13 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 _0x1775=['code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2c1e66,_0x8f7baf){var _0x1ce73d=function(_0x2a18d6){while(--_0x2a18d6){_0x2c1e66['push'](_0x2c1e66['shift']());}};_0x1ce73d(++_0x8f7baf);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['create'](_0x1b4102[_0x5177('0x1c')],{'raw':_0x1b4102['options']?_0x1b4102[_0x5177('0x1d')][_0x5177('0x1e')]===undefined?!![]:![]:!![]})[_0x5177('0xe')](function(_0x27b732){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON[_0x5177('0x13')](_0x27b732));_0x3e6944(_0x27b732);})[_0x5177('0x19')](function(_0x23dad2){logger[_0x5177('0x14')]('CreateSquareDetailsReport',_0x23dad2[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4['error'](0x1f4,_0x23dad2[_0x5177('0x17')]));});});}; \ No newline at end of file +var _0x7894=['client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x417406,_0x52eacc){var _0x454604=function(_0x5d501b){while(--_0x5d501b){_0x417406['push'](_0x417406['shift']());}};_0x454604(++_0x52eacc);}(_0x7894,0x170));var _0x4789=function(_0x1439ef,_0x16fc55){_0x1439ef=_0x1439ef-0x0;var _0x4413d7=_0x7894[_0x1439ef];return _0x4413d7;};'use strict';var _=require(_0x4789('0x0'));var util=require(_0x4789('0x1'));var moment=require(_0x4789('0x2'));var BPromise=require(_0x4789('0x3'));var rs=require(_0x4789('0x4'));var fs=require('fs');var Redis=require(_0x4789('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4789('0x6'));var logger=require(_0x4789('0x7'))('rpc');var config=require(_0x4789('0x8'));var jayson=require(_0x4789('0x9'));var client=jayson[_0x4789('0xa')][_0x4789('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x114a90,_0x298902,_0x13b7f6){return new BPromise(function(_0x5a45ae,_0x49d256){return client[_0x4789('0xc')](_0x114a90,_0x13b7f6)['then'](function(_0x2e8038){logger[_0x4789('0xd')](_0x4789('0xe'),_0x298902,'request\x20sent');logger[_0x4789('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x298902,_0x4789('0x10'),JSON[_0x4789('0x11')](_0x2e8038));if(_0x2e8038[_0x4789('0x12')]){if(_0x2e8038['error']['code']===0x1f4){logger[_0x4789('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x298902,_0x2e8038[_0x4789('0x12')]['message']);return _0x49d256(_0x2e8038[_0x4789('0x12')][_0x4789('0x13')]);}logger['error'](_0x4789('0xe'),_0x298902,_0x2e8038['error'][_0x4789('0x13')]);return _0x5a45ae(_0x2e8038[_0x4789('0x12')][_0x4789('0x13')]);}else{logger['info'](_0x4789('0xe'),_0x298902,_0x4789('0x10'));_0x5a45ae(_0x2e8038['result'][_0x4789('0x13')]);}})['catch'](function(_0x118f97){logger[_0x4789('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x298902,_0x118f97);_0x49d256(_0x118f97);});});}exports[_0x4789('0x14')]=function(_0x5af7b3){var _0x2f1511=this;return new Promise(function(_0x56d799,_0x19dc59){return db[_0x4789('0x15')]['create'](_0x5af7b3[_0x4789('0x16')],{'raw':_0x5af7b3[_0x4789('0x17')]?_0x5af7b3[_0x4789('0x17')][_0x4789('0x18')]===undefined?!![]:![]:!![]})[_0x4789('0x19')](function(_0x3a707d){logger[_0x4789('0xd')](_0x4789('0x14'),_0x5af7b3);logger[_0x4789('0xf')](_0x4789('0x14'),_0x5af7b3,JSON[_0x4789('0x11')](_0x3a707d));_0x56d799(_0x3a707d);})[_0x4789('0x1a')](function(_0x4f7ceb){logger[_0x4789('0x12')](_0x4789('0x14'),_0x4f7ceb['message'],_0x5af7b3);_0x19dc59(_0x2f1511[_0x4789('0x12')](0x1f4,_0x4f7ceb[_0x4789('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index b9822e3..f100c1d 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 _0x8834=['/process/:pid/kill','killProcess','express','Router','./system.controller','isAuthenticated','index','get'];(function(_0x21ecc8,_0x2bdead){var _0x510c1d=function(_0x3b6862){while(--_0x3b6862){_0x21ecc8['push'](_0x21ecc8['shift']());}};_0x510c1d(++_0x2bdead);}(_0x8834,0xe2));var _0x4883=function(_0x42219d,_0x32e03b){_0x42219d=_0x42219d-0x0;var _0x1578b7=_0x8834[_0x42219d];return _0x1578b7;};'use strict';var express=require(_0x4883('0x0'));var router=express[_0x4883('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x4883('0x2'));router['get']('/',auth[_0x4883('0x3')](),controller[_0x4883('0x4')]);router[_0x4883('0x5')](_0x4883('0x6'),auth[_0x4883('0x3')](),controller[_0x4883('0x7')]);module['exports']=router; \ No newline at end of file +var _0xee72=['express','Router','../../components/auth/service','./system.controller','get','index','/process/:pid/kill','killProcess','exports'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xee72,0x144));var _0x2ee7=function(_0x14a954,_0x3ee555){_0x14a954=_0x14a954-0x0;var _0x4a0f6d=_0xee72[_0x14a954];return _0x4a0f6d;};'use strict';var express=require(_0x2ee7('0x0'));var router=express[_0x2ee7('0x1')]();var auth=require(_0x2ee7('0x2'));var controller=require(_0x2ee7('0x3'));router[_0x2ee7('0x4')]('/',auth['isAuthenticated'](),controller[_0x2ee7('0x5')]);router[_0x2ee7('0x4')](_0x2ee7('0x6'),auth['isAuthenticated'](),controller[_0x2ee7('0x7')]);module[_0x2ee7('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 668ffef..54efa11 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 _0x4184=['status','send','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x3bd895,_0x272f04){var _0x302872=function(_0x139014){while(--_0x139014){_0x3bd895['push'](_0x3bd895['shift']());}};_0x302872(++_0x272f04);}(_0x4184,0xf1));var _0x4418=function(_0x275532,_0x1f3ab3){_0x275532=_0x275532-0x0;var _0x2ef985=_0x4184[_0x275532];return _0x2ef985;};'use strict';var info=require(_0x4418('0x0'));var exec=require(_0x4418('0x1'))[_0x4418('0x2')];var logger=require('../../config/logger')(_0x4418('0x3'));var util=require(_0x4418('0x4'));var BPromise=require(_0x4418('0x5'));var _=require(_0x4418('0x6'));function handleError(_0x2bb51d,_0x25bdf7,_0x5713ec){_0x25bdf7=_0x25bdf7||0x1f4;return function(_0x229a41){logger[_0x4418('0x7')](_0x4418('0x8'),_0x5713ec,_0x25bdf7,util[_0x4418('0x9')](_0x229a41,{'showHidden':![],'depth':null}));delete _0x229a41[_0x4418('0xa')];_0x2bb51d[_0x4418('0xb')](_0x25bdf7)[_0x4418('0xc')](_0x229a41);};}exports['index']=function(_0x3c36e2,_0x48510f){return info[_0x4418('0xd')]()[_0x4418('0xe')](function(_0x4cbd62){return _0x48510f[_0x4418('0xb')](0xc8)[_0x4418('0xf')](_0x4cbd62);})[_0x4418('0x10')](function(_0x15f1cb){return _0x48510f[_0x4418('0xb')](0x1f4)[_0x4418('0xf')](_0x15f1cb);});};exports[_0x4418('0x11')]=function(_0x524598,_0x1cb9d2){var _0x5eb4d0=[_0x4418('0x12')];return new BPromise(function(_0x4437c1,_0x2dec9e){return exec(util[_0x4418('0x13')](_0x4418('0x14'),_0x524598[_0x4418('0x15')]['pid']),function(_0x315502,_0x116416,_0x58566c){if(_0x315502){return _0x2dec9e(_0x315502);}return _0x4437c1(_0x116416);});})[_0x4418('0xe')](function(_0x1a6874){var _0x492ace=![];var _0x5b9dce=_0x1a6874[_0x4418('0x16')](/\n/);for(var _0x2361b2=0x0,_0x26450f=_0x5eb4d0[_0x4418('0x17')];_0x2361b2<_0x26450f,_0x492ace===![];_0x2361b2+=0x1){if(_0x1a6874['indexOf'](_0x5eb4d0[_0x2361b2])>=0x0){_0x492ace=!![];}}if(!_0x492ace){throw new Error(util['format'](_0x4418('0x18'),_0x524598[_0x4418('0x15')]['pid']));}process['kill'](_0x524598[_0x4418('0x15')][_0x4418('0x19')],_0x4418('0x1a'));return _0x1cb9d2[_0x4418('0xb')](0xc8)[_0x4418('0xf')]({'message':util[_0x4418('0x13')](_0x4418('0x1b'),_0x524598[_0x4418('0x15')][_0x4418('0x19')])});})[_0x4418('0x10')](handleError(_0x1cb9d2,null,_0x4418('0x11')));}; \ No newline at end of file +var _0x5483=['getAllData','then','status','json','catch','killProcess','components/import/cm','format','params','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','child_process','exec','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5483,0x73));var _0x3548=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x5483[_0x55c1f0];return _0x1530fa;};'use strict';var info=require('systeminformation');var exec=require(_0x3548('0x0'))[_0x3548('0x1')];var logger=require(_0x3548('0x2'))(_0x3548('0x3'));var util=require(_0x3548('0x4'));var BPromise=require('bluebird');var _=require(_0x3548('0x5'));function handleError(_0x10c43c,_0x5aa4cb,_0x2af3aa){_0x5aa4cb=_0x5aa4cb||0x1f4;return function(_0x258307){logger[_0x3548('0x6')](_0x3548('0x7'),_0x2af3aa,_0x5aa4cb,util[_0x3548('0x8')](_0x258307,{'showHidden':![],'depth':null}));delete _0x258307[_0x3548('0x9')];_0x10c43c['status'](_0x5aa4cb)['send'](_0x258307);};}exports['index']=function(_0x26dd07,_0x459b9b){return info[_0x3548('0xa')]()[_0x3548('0xb')](function(_0x5535cf){return _0x459b9b[_0x3548('0xc')](0xc8)[_0x3548('0xd')](_0x5535cf);})[_0x3548('0xe')](function(_0x5ee17b){return _0x459b9b['status'](0x1f4)['json'](_0x5ee17b);});};exports[_0x3548('0xf')]=function(_0x31e5a5,_0x292c6c){var _0x3821fe=[_0x3548('0x10')];return new BPromise(function(_0x6e2b24,_0x152b47){return exec(util[_0x3548('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x31e5a5[_0x3548('0x12')]['pid']),function(_0x3bd952,_0x2ea5b4,_0x46b5e5){if(_0x3bd952){return _0x152b47(_0x3bd952);}return _0x6e2b24(_0x2ea5b4);});})[_0x3548('0xb')](function(_0x4a4d0b){var _0xfd0219=![];var _0x148d34=_0x4a4d0b['split'](/\n/);for(var _0x506c59=0x0,_0x345493=_0x3821fe[_0x3548('0x13')];_0x506c59<_0x345493,_0xfd0219===![];_0x506c59+=0x1){if(_0x4a4d0b[_0x3548('0x14')](_0x3821fe[_0x506c59])>=0x0){_0xfd0219=!![];}}if(!_0xfd0219){throw new Error(util[_0x3548('0x11')](_0x3548('0x15'),_0x31e5a5[_0x3548('0x12')][_0x3548('0x16')]));}process[_0x3548('0x17')](_0x31e5a5[_0x3548('0x12')][_0x3548('0x16')],_0x3548('0x18'));return _0x292c6c[_0x3548('0xc')](0xc8)[_0x3548('0xd')]({'message':util[_0x3548('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x31e5a5[_0x3548('0x12')]['pid'])});})[_0x3548('0xe')](handleError(_0x292c6c,null,_0x3548('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7043852..4cd789d 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 _0xac39=['/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','index'];(function(_0x1056fb,_0x272e41){var _0x3cd25c=function(_0x3474a1){while(--_0x3474a1){_0x1056fb['push'](_0x1056fb['shift']());}};_0x3cd25c(++_0x272e41);}(_0xac39,0x97));var _0x9ac3=function(_0x11336d,_0x529b37){_0x11336d=_0x11336d-0x0;var _0x47a392=_0xac39[_0x11336d];return _0x47a392;};'use strict';var multer=require('multer');var util=require(_0x9ac3('0x0'));var path=require(_0x9ac3('0x1'));var timeout=require(_0x9ac3('0x2'));var express=require(_0x9ac3('0x3'));var router=express['Router']();var fs_extra=require(_0x9ac3('0x4'));var auth=require(_0x9ac3('0x5'));var interaction=require(_0x9ac3('0x6'));var config=require('../../config/environment');var controller=require(_0x9ac3('0x7'));router[_0x9ac3('0x8')]('/',auth[_0x9ac3('0x9')](),controller[_0x9ac3('0xa')]);router[_0x9ac3('0x8')](_0x9ac3('0xb'),auth[_0x9ac3('0x9')](),controller[_0x9ac3('0xc')]);router[_0x9ac3('0xd')]('/',auth[_0x9ac3('0x9')](),controller[_0x9ac3('0xe')]);router['put'](_0x9ac3('0xb'),auth[_0x9ac3('0x9')](),controller[_0x9ac3('0xf')]);router[_0x9ac3('0x10')](_0x9ac3('0xb'),auth[_0x9ac3('0x9')](),controller[_0x9ac3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2041=['index','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated'];(function(_0x3572cb,_0x4149d3){var _0x33a398=function(_0x163e27){while(--_0x163e27){_0x3572cb['push'](_0x3572cb['shift']());}};_0x33a398(++_0x4149d3);}(_0x2041,0x10d));var _0x1204=function(_0x4349d8,_0x3fe15c){_0x4349d8=_0x4349d8-0x0;var _0xe469dc=_0x2041[_0x4349d8];return _0xe469dc;};'use strict';var multer=require(_0x1204('0x0'));var util=require(_0x1204('0x1'));var path=require('path');var timeout=require(_0x1204('0x2'));var express=require(_0x1204('0x3'));var router=express[_0x1204('0x4')]();var fs_extra=require(_0x1204('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1204('0x6'));var config=require(_0x1204('0x7'));var controller=require(_0x1204('0x8'));router[_0x1204('0x9')]('/',auth[_0x1204('0xa')](),controller[_0x1204('0xb')]);router[_0x1204('0x9')](_0x1204('0xc'),auth[_0x1204('0xa')](),controller['show']);router[_0x1204('0xd')]('/',auth[_0x1204('0xa')](),controller[_0x1204('0xe')]);router[_0x1204('0xf')](_0x1204('0xc'),auth[_0x1204('0xa')](),controller[_0x1204('0x10')]);router[_0x1204('0x11')](_0x1204('0xc'),auth[_0x1204('0xa')](),controller[_0x1204('0x12')]);module[_0x1204('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 e838e1e..b2c9f7d 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 _0x05b6=['sequelize','STRING','name','#0091EA'];(function(_0x159590,_0x4b2055){var _0x55e9cd=function(_0x5db354){while(--_0x5db354){_0x159590['push'](_0x159590['shift']());}};_0x55e9cd(++_0x4b2055);}(_0x05b6,0x74));var _0x605b=function(_0x3bfd29,_0x407cd5){_0x3bfd29=_0x3bfd29-0x0;var _0x2e1a78=_0x05b6[_0x3bfd29];return _0x2e1a78;};'use strict';var Sequelize=require(_0x605b('0x0'));module['exports']={'name':{'type':Sequelize[_0x605b('0x1')],'unique':_0x605b('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x605b('0x1')],'defaultValue':_0x605b('0x3')},'description':{'type':Sequelize[_0x605b('0x1')]}}; \ No newline at end of file +var _0x689b=['#0091EA','sequelize','STRING'];(function(_0x76b9a5,_0x3d3ea8){var _0xf61978=function(_0x52877b){while(--_0x52877b){_0x76b9a5['push'](_0x76b9a5['shift']());}};_0xf61978(++_0x3d3ea8);}(_0x689b,0x142));var _0xb689=function(_0x4364c2,_0x1834c6){_0x4364c2=_0x4364c2-0x0;var _0x165ea0=_0x689b[_0x4364c2];return _0x165ea0;};'use strict';var Sequelize=require(_0xb689('0x0'));module['exports']={'name':{'type':Sequelize[_0xb689('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xb689('0x2')},'description':{'type':Sequelize[_0xb689('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ee6e57a..e9befd3 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 _0xb0b9=['params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','get','Tags','UserProfileResource','end','error','name','send','map','Tag','rawAttributes','fieldName','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','keys','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','find'];(function(_0x5a88ad,_0x35a3eb){var _0x1c0c95=function(_0x58a8fe){while(--_0x58a8fe){_0x5a88ad['push'](_0x5a88ad['shift']());}};_0x1c0c95(++_0x35a3eb);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x323271,_0x6c3ab7){_0x323271=_0x323271-0x0;var _0x8f2374=_0xb0b9[_0x323271];return _0x8f2374;};'use strict';var emlformat=require(_0x9b0b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9b0b('0x1'));var rp=require(_0x9b0b('0x2'));var moment=require(_0x9b0b('0x3'));var BPromise=require(_0x9b0b('0x4'));var Mustache=require(_0x9b0b('0x5'));var util=require(_0x9b0b('0x6'));var path=require(_0x9b0b('0x7'));var sox=require(_0x9b0b('0x8'));var csv=require(_0x9b0b('0x9'));var ejs=require(_0x9b0b('0xa'));var fs=require('fs');var fs_extra=require(_0x9b0b('0xb'));var _=require(_0x9b0b('0xc'));var squel=require(_0x9b0b('0xd'));var crypto=require(_0x9b0b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b0b('0x9'));var querystring=require(_0x9b0b('0xf'));var Papa=require(_0x9b0b('0x10'));var Redis=require(_0x9b0b('0x11'));var authService=require(_0x9b0b('0x12'));var qs=require(_0x9b0b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b0b('0x14'));var logger=require(_0x9b0b('0x15'))(_0x9b0b('0x16'));var utils=require(_0x9b0b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9b0b('0x18'))['db'];function respondWithStatusCode(_0x4b3ed5,_0x283336){_0x283336=_0x283336||0xcc;return function(_0x4e6739){if(_0x4e6739){return _0x4b3ed5[_0x9b0b('0x19')](_0x283336);}return _0x4b3ed5[_0x9b0b('0x1a')](_0x283336)['end']();};}function respondWithResult(_0x5974af,_0x5f0555){_0x5f0555=_0x5f0555||0xc8;return function(_0xe9c112){if(_0xe9c112){return _0x5974af[_0x9b0b('0x1a')](_0x5f0555)['json'](_0xe9c112);}};}function respondWithFilteredResult(_0x248ff9,_0x377736){return function(_0x297b07){if(_0x297b07){var _0x1e92c1=typeof _0x377736[_0x9b0b('0x1b')]===_0x9b0b('0x1c')&&typeof _0x377736[_0x9b0b('0x1d')]===_0x9b0b('0x1c');var _0x1b7673=_0x297b07[_0x9b0b('0x1e')];var _0x264b6d=_0x1e92c1?0x0:_0x377736[_0x9b0b('0x1b')];var _0x3334e5=_0x1e92c1?_0x297b07[_0x9b0b('0x1e')]:_0x377736['offset']+_0x377736[_0x9b0b('0x1d')];var _0xee66f5;if(_0x3334e5>=_0x1b7673){_0x3334e5=_0x1b7673;_0xee66f5=0xc8;}else{_0xee66f5=0xce;}_0x248ff9[_0x9b0b('0x1a')](_0xee66f5);return _0x248ff9['set'](_0x9b0b('0x1f'),_0x264b6d+'-'+_0x3334e5+'/'+_0x1b7673)[_0x9b0b('0x20')](_0x297b07);}return null;};}function patchUpdates(_0x4067d3){return function(_0x565d35){try{jsonpatch[_0x9b0b('0x21')](_0x565d35,_0x4067d3,!![]);}catch(_0x2218d5){return BPromise[_0x9b0b('0x22')](_0x2218d5);}return _0x565d35[_0x9b0b('0x23')]();};}function saveUpdates(_0x4fe0a2,_0x30bfe8){return function(_0x408f70){if(_0x408f70){return _0x408f70['update'](_0x4fe0a2)[_0x9b0b('0x24')](function(_0x1e7789){return _0x1e7789;});}return null;};}function removeEntity(_0x3f433c,_0x16b413){return function(_0xbf0f87){if(_0xbf0f87){return _0xbf0f87[_0x9b0b('0x25')]()[_0x9b0b('0x24')](function(){var _0x322a0b=_0xbf0f87[_0x9b0b('0x26')]({'plain':!![]});var _0x5771fd=_0x9b0b('0x27');return db[_0x9b0b('0x28')][_0x9b0b('0x25')]({'where':{'type':_0x5771fd,'resourceId':_0x322a0b['id']}})[_0x9b0b('0x24')](function(){return _0xbf0f87;});})['then'](function(){_0x3f433c[_0x9b0b('0x1a')](0xcc)[_0x9b0b('0x29')]();});}};}function handleEntityNotFound(_0x5c9ec3,_0x2841fc){return function(_0x1e25fb){if(!_0x1e25fb){_0x5c9ec3[_0x9b0b('0x19')](0x194);}return _0x1e25fb;};}function handleError(_0x47a135,_0x2cfe21){_0x2cfe21=_0x2cfe21||0x1f4;return function(_0xa4f392){logger[_0x9b0b('0x2a')](_0xa4f392['stack']);if(_0xa4f392[_0x9b0b('0x2b')]){delete _0xa4f392[_0x9b0b('0x2b')];}_0x47a135[_0x9b0b('0x1a')](_0x2cfe21)[_0x9b0b('0x2c')](_0xa4f392);};}exports['index']=function(_0x347f76,_0xfa71df){var _0x48d324={},_0x272934={},_0x32cde1={'count':0x0,'rows':[]};var _0x328e82=_[_0x9b0b('0x2d')](db[_0x9b0b('0x2e')][_0x9b0b('0x2f')],function(_0xfd6ce){return{'name':_0xfd6ce[_0x9b0b('0x30')],'type':_0xfd6ce['type']['key']};});_0x272934[_0x9b0b('0x31')]=_['map'](_0x328e82,_0x9b0b('0x2b'));_0x272934['query']=_['keys'](_0x347f76['query']);_0x272934[_0x9b0b('0x32')]=_[_0x9b0b('0x33')](_0x272934[_0x9b0b('0x31')],_0x272934[_0x9b0b('0x34')]);_0x48d324[_0x9b0b('0x35')]=_[_0x9b0b('0x33')](_0x272934[_0x9b0b('0x31')],qs[_0x9b0b('0x36')](_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x36')]));_0x48d324[_0x9b0b('0x35')]=_0x48d324[_0x9b0b('0x35')][_0x9b0b('0x37')]?_0x48d324['attributes']:_0x272934[_0x9b0b('0x31')];if(!_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x38')](_0x9b0b('0x39'))){_0x48d324[_0x9b0b('0x1d')]=qs[_0x9b0b('0x1d')](_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x1d')]);_0x48d324[_0x9b0b('0x1b')]=qs[_0x9b0b('0x1b')](_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x1b')]);}_0x48d324[_0x9b0b('0x3a')]=qs['sort'](_0x347f76['query'][_0x9b0b('0x3b')]);_0x48d324[_0x9b0b('0x3c')]=qs[_0x9b0b('0x32')](_[_0x9b0b('0x3d')](_0x347f76[_0x9b0b('0x34')],_0x272934['filters']),_0x328e82);if(_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x3e')]){_0x48d324[_0x9b0b('0x3c')]=_[_0x9b0b('0x3f')](_0x48d324['where'],{'$or':_['map'](_0x328e82,function(_0x1fffc4){if(_0x1fffc4['type']!==_0x9b0b('0x40')){var _0x316d86={};_0x316d86[_0x1fffc4[_0x9b0b('0x2b')]]={'$like':'%'+_0x347f76[_0x9b0b('0x34')][_0x9b0b('0x3e')]+'%'};return _0x316d86;}})});}_0x48d324=_[_0x9b0b('0x3f')]({},_0x48d324,_0x347f76[_0x9b0b('0x41')]);var _0x24724c={'where':_0x48d324[_0x9b0b('0x3c')]};return db[_0x9b0b('0x2e')][_0x9b0b('0x1e')](_0x24724c)[_0x9b0b('0x24')](function(_0x4049ad){_0x32cde1[_0x9b0b('0x1e')]=_0x4049ad;if(_0x347f76[_0x9b0b('0x34')]['includeAll']){_0x48d324['include']=[{'all':!![]}];}return db['Tag'][_0x9b0b('0x42')](_0x48d324);})[_0x9b0b('0x24')](function(_0x1522a1){_0x32cde1[_0x9b0b('0x43')]=_0x1522a1;return _0x32cde1;})[_0x9b0b('0x24')](respondWithFilteredResult(_0xfa71df,_0x48d324))['catch'](handleError(_0xfa71df,null));};exports['show']=function(_0x20ec55,_0x243063){var _0x8be3d0={'raw':!![],'where':{'id':_0x20ec55['params']['id']}},_0x136a33={};_0x136a33[_0x9b0b('0x31')]=_[_0x9b0b('0x44')](db[_0x9b0b('0x2e')][_0x9b0b('0x2f')]);_0x136a33[_0x9b0b('0x34')]=_['keys'](_0x20ec55[_0x9b0b('0x34')]);_0x136a33[_0x9b0b('0x32')]=_[_0x9b0b('0x33')](_0x136a33[_0x9b0b('0x31')],_0x136a33[_0x9b0b('0x34')]);_0x8be3d0[_0x9b0b('0x35')]=_[_0x9b0b('0x33')](_0x136a33[_0x9b0b('0x31')],qs['fields'](_0x20ec55['query']['fields']));_0x8be3d0[_0x9b0b('0x35')]=_0x8be3d0[_0x9b0b('0x35')][_0x9b0b('0x37')]?_0x8be3d0[_0x9b0b('0x35')]:_0x136a33[_0x9b0b('0x31')];if(_0x20ec55[_0x9b0b('0x34')][_0x9b0b('0x45')]){_0x8be3d0[_0x9b0b('0x46')]=[{'all':!![]}];}_0x8be3d0=_[_0x9b0b('0x3f')]({},_0x8be3d0,_0x20ec55[_0x9b0b('0x41')]);return db[_0x9b0b('0x2e')]['find'](_0x8be3d0)[_0x9b0b('0x24')](handleEntityNotFound(_0x243063,null))[_0x9b0b('0x24')](respondWithResult(_0x243063,null))['catch'](handleError(_0x243063,null));};exports['create']=function(_0xd9410f,_0x990950){return db[_0x9b0b('0x2e')][_0x9b0b('0x47')](_0xd9410f['body'],{})[_0x9b0b('0x24')](function(_0x348444){var _0x3eeb0c=_0xd9410f[_0x9b0b('0x48')][_0x9b0b('0x26')]({'plain':!![]});if(!_0x3eeb0c)throw new Error(_0x9b0b('0x49'));if(_0x3eeb0c[_0x9b0b('0x4a')]===_0x9b0b('0x48')){var _0x146654=_0x348444['get']({'plain':!![]});var _0x1a6cf8='Tags';return db[_0x9b0b('0x4b')]['find']({'where':{'name':_0x1a6cf8,'userProfileId':_0x3eeb0c['userProfileId']},'raw':!![]})[_0x9b0b('0x24')](function(_0x2238d1){if(_0x2238d1&&_0x2238d1[_0x9b0b('0x4c')]===0x0){return db[_0x9b0b('0x28')][_0x9b0b('0x47')]({'name':_0x146654[_0x9b0b('0x2b')],'resourceId':_0x146654['id'],'type':_0x2238d1[_0x9b0b('0x2b')],'sectionId':_0x2238d1['id']},{})['then'](function(){return _0x348444;});}else{return _0x348444;}})['catch'](function(_0x4bba88){logger[_0x9b0b('0x2a')](_0x9b0b('0x4d'),_0x4bba88);throw _0x4bba88;});}return _0x348444;})[_0x9b0b('0x24')](respondWithResult(_0x990950,0xc9))[_0x9b0b('0x4e')](handleError(_0x990950,null));};exports[_0x9b0b('0x4f')]=function(_0x41331d,_0x5a568e){if(_0x41331d[_0x9b0b('0x50')]['id']){delete _0x41331d[_0x9b0b('0x50')]['id'];}return db['Tag']['find']({'where':{'id':_0x41331d['params']['id']}})[_0x9b0b('0x24')](handleEntityNotFound(_0x5a568e,null))[_0x9b0b('0x24')](saveUpdates(_0x41331d['body'],null))['then'](respondWithResult(_0x5a568e,null))['catch'](handleError(_0x5a568e,null));};exports[_0x9b0b('0x25')]=function(_0x2d8637,_0x23225c){return db[_0x9b0b('0x2e')][_0x9b0b('0x51')]({'where':{'id':_0x2d8637[_0x9b0b('0x52')]['id']}})[_0x9b0b('0x24')](handleEntityNotFound(_0x23225c,null))[_0x9b0b('0x24')](removeEntity(_0x23225c,null))[_0x9b0b('0x4e')](handleError(_0x23225c,null));}; \ No newline at end of file +var _0x7980=['Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','sort','where','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','body','user'];(function(_0x52355d,_0x46bbef){var _0x239d6c=function(_0x1328f7){while(--_0x1328f7){_0x52355d['push'](_0x52355d['shift']());}};_0x239d6c(++_0x46bbef);}(_0x7980,0xab));var _0x0798=function(_0x2cb9a4,_0x425f14){_0x2cb9a4=_0x2cb9a4-0x0;var _0x542d75=_0x7980[_0x2cb9a4];return _0x542d75;};'use strict';var emlformat=require(_0x0798('0x0'));var rimraf=require(_0x0798('0x1'));var zipdir=require(_0x0798('0x2'));var jsonpatch=require(_0x0798('0x3'));var rp=require(_0x0798('0x4'));var moment=require('moment');var BPromise=require(_0x0798('0x5'));var Mustache=require(_0x0798('0x6'));var util=require(_0x0798('0x7'));var path=require(_0x0798('0x8'));var sox=require(_0x0798('0x9'));var csv=require('to-csv');var ejs=require(_0x0798('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0798('0xb'));var squel=require(_0x0798('0xc'));var crypto=require(_0x0798('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0798('0xe'));var querystring=require(_0x0798('0xf'));var Papa=require(_0x0798('0x10'));var Redis=require(_0x0798('0x11'));var authService=require(_0x0798('0x12'));var qs=require(_0x0798('0x13'));var as=require(_0x0798('0x14'));var hardwareService=require(_0x0798('0x15'));var logger=require(_0x0798('0x16'))(_0x0798('0x17'));var utils=require('../../config/utils');var config=require(_0x0798('0x18'));var licenseUtil=require(_0x0798('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5323e5,_0x588f9d){_0x588f9d=_0x588f9d||0xcc;return function(_0x376a60){if(_0x376a60){return _0x5323e5[_0x0798('0x1a')](_0x588f9d);}return _0x5323e5[_0x0798('0x1b')](_0x588f9d)[_0x0798('0x1c')]();};}function respondWithResult(_0x39bacd,_0xfd88af){_0xfd88af=_0xfd88af||0xc8;return function(_0x5f1640){if(_0x5f1640){return _0x39bacd['status'](_0xfd88af)[_0x0798('0x1d')](_0x5f1640);}};}function respondWithFilteredResult(_0x112362,_0x47be56){return function(_0x555c45){if(_0x555c45){var _0x21c30b=typeof _0x47be56[_0x0798('0x1e')]===_0x0798('0x1f')&&typeof _0x47be56['limit']==='undefined';var _0x1c6d6f=_0x555c45['count'];var _0x41e217=_0x21c30b?0x0:_0x47be56[_0x0798('0x1e')];var _0x288f41=_0x21c30b?_0x555c45[_0x0798('0x20')]:_0x47be56['offset']+_0x47be56[_0x0798('0x21')];var _0x3039d6;if(_0x288f41>=_0x1c6d6f){_0x288f41=_0x1c6d6f;_0x3039d6=0xc8;}else{_0x3039d6=0xce;}_0x112362['status'](_0x3039d6);return _0x112362[_0x0798('0x22')](_0x0798('0x23'),_0x41e217+'-'+_0x288f41+'/'+_0x1c6d6f)[_0x0798('0x1d')](_0x555c45);}return null;};}function patchUpdates(_0x44ac33){return function(_0xfbb4a5){try{jsonpatch[_0x0798('0x24')](_0xfbb4a5,_0x44ac33,!![]);}catch(_0x3a7f8b){return BPromise[_0x0798('0x25')](_0x3a7f8b);}return _0xfbb4a5[_0x0798('0x26')]();};}function saveUpdates(_0x4a86d5,_0x2aaabf){return function(_0x35c141){if(_0x35c141){return _0x35c141[_0x0798('0x27')](_0x4a86d5)[_0x0798('0x28')](function(_0x20654b){return _0x20654b;});}return null;};}function removeEntity(_0x23f283,_0x52037c){return function(_0x3f66e2){if(_0x3f66e2){return _0x3f66e2[_0x0798('0x29')]()[_0x0798('0x28')](function(){var _0xd5e027=_0x3f66e2[_0x0798('0x2a')]({'plain':!![]});var _0x23d59c='Tags';return db[_0x0798('0x2b')][_0x0798('0x29')]({'where':{'type':_0x23d59c,'resourceId':_0xd5e027['id']}})[_0x0798('0x28')](function(){return _0x3f66e2;});})['then'](function(){_0x23f283[_0x0798('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53a3d7,_0x406030){return function(_0x2dfbff){if(!_0x2dfbff){_0x53a3d7[_0x0798('0x1a')](0x194);}return _0x2dfbff;};}function handleError(_0xaa949b,_0x11b7f4){_0x11b7f4=_0x11b7f4||0x1f4;return function(_0x161244){logger[_0x0798('0x2c')](_0x161244[_0x0798('0x2d')]);if(_0x161244['name']){delete _0x161244[_0x0798('0x2e')];}_0xaa949b['status'](_0x11b7f4)['send'](_0x161244);};}exports[_0x0798('0x2f')]=function(_0x4a7eeb,_0x1dabd5){var _0x4a5fb1={},_0x93c004={},_0xb8d33e={'count':0x0,'rows':[]};var _0x201e4c=_[_0x0798('0x30')](db[_0x0798('0x31')][_0x0798('0x32')],function(_0xa1376e){return{'name':_0xa1376e[_0x0798('0x33')],'type':_0xa1376e[_0x0798('0x34')][_0x0798('0x35')]};});_0x93c004[_0x0798('0x36')]=_[_0x0798('0x30')](_0x201e4c,'name');_0x93c004[_0x0798('0x37')]=_['keys'](_0x4a7eeb['query']);_0x93c004[_0x0798('0x38')]=_[_0x0798('0x39')](_0x93c004['model'],_0x93c004['query']);_0x4a5fb1[_0x0798('0x3a')]=_[_0x0798('0x39')](_0x93c004[_0x0798('0x36')],qs[_0x0798('0x3b')](_0x4a7eeb[_0x0798('0x37')][_0x0798('0x3b')]));_0x4a5fb1['attributes']=_0x4a5fb1['attributes'][_0x0798('0x3c')]?_0x4a5fb1[_0x0798('0x3a')]:_0x93c004[_0x0798('0x36')];if(!_0x4a7eeb['query']['hasOwnProperty']('nolimit')){_0x4a5fb1[_0x0798('0x21')]=qs[_0x0798('0x21')](_0x4a7eeb[_0x0798('0x37')][_0x0798('0x21')]);_0x4a5fb1[_0x0798('0x1e')]=qs[_0x0798('0x1e')](_0x4a7eeb[_0x0798('0x37')][_0x0798('0x1e')]);}_0x4a5fb1['order']=qs[_0x0798('0x3d')](_0x4a7eeb['query'][_0x0798('0x3d')]);_0x4a5fb1[_0x0798('0x3e')]=qs[_0x0798('0x38')](_['pick'](_0x4a7eeb[_0x0798('0x37')],_0x93c004['filters']),_0x201e4c);if(_0x4a7eeb[_0x0798('0x37')][_0x0798('0x3f')]){_0x4a5fb1[_0x0798('0x3e')]=_['merge'](_0x4a5fb1[_0x0798('0x3e')],{'$or':_[_0x0798('0x30')](_0x201e4c,function(_0x4edb16){if(_0x4edb16[_0x0798('0x34')]!=='VIRTUAL'){var _0x4e9d94={};_0x4e9d94[_0x4edb16[_0x0798('0x2e')]]={'$like':'%'+_0x4a7eeb[_0x0798('0x37')]['filter']+'%'};return _0x4e9d94;}})});}_0x4a5fb1=_['merge']({},_0x4a5fb1,_0x4a7eeb[_0x0798('0x40')]);var _0x331218={'where':_0x4a5fb1[_0x0798('0x3e')]};return db[_0x0798('0x31')][_0x0798('0x20')](_0x331218)[_0x0798('0x28')](function(_0x27a671){_0xb8d33e['count']=_0x27a671;if(_0x4a7eeb[_0x0798('0x37')][_0x0798('0x41')]){_0x4a5fb1[_0x0798('0x42')]=[{'all':!![]}];}return db[_0x0798('0x31')][_0x0798('0x43')](_0x4a5fb1);})[_0x0798('0x28')](function(_0x4c2d8a){_0xb8d33e[_0x0798('0x44')]=_0x4c2d8a;return _0xb8d33e;})[_0x0798('0x28')](respondWithFilteredResult(_0x1dabd5,_0x4a5fb1))[_0x0798('0x45')](handleError(_0x1dabd5,null));};exports[_0x0798('0x46')]=function(_0x387450,_0xecc618){var _0x3be652={'raw':!![],'where':{'id':_0x387450[_0x0798('0x47')]['id']}},_0x10a50a={};_0x10a50a[_0x0798('0x36')]=_[_0x0798('0x48')](db[_0x0798('0x31')]['rawAttributes']);_0x10a50a[_0x0798('0x37')]=_[_0x0798('0x48')](_0x387450[_0x0798('0x37')]);_0x10a50a[_0x0798('0x38')]=_['intersection'](_0x10a50a['model'],_0x10a50a[_0x0798('0x37')]);_0x3be652[_0x0798('0x3a')]=_[_0x0798('0x39')](_0x10a50a[_0x0798('0x36')],qs['fields'](_0x387450[_0x0798('0x37')]['fields']));_0x3be652['attributes']=_0x3be652[_0x0798('0x3a')][_0x0798('0x3c')]?_0x3be652[_0x0798('0x3a')]:_0x10a50a[_0x0798('0x36')];if(_0x387450[_0x0798('0x37')][_0x0798('0x41')]){_0x3be652[_0x0798('0x42')]=[{'all':!![]}];}_0x3be652=_[_0x0798('0x49')]({},_0x3be652,_0x387450[_0x0798('0x40')]);return db['Tag'][_0x0798('0x4a')](_0x3be652)['then'](handleEntityNotFound(_0xecc618,null))[_0x0798('0x28')](respondWithResult(_0xecc618,null))[_0x0798('0x45')](handleError(_0xecc618,null));};exports[_0x0798('0x4b')]=function(_0x54634d,_0x9dea1f){return db[_0x0798('0x31')][_0x0798('0x4b')](_0x54634d[_0x0798('0x4c')],{})['then'](function(_0x2695d5){var _0x9e6db6=_0x54634d[_0x0798('0x4d')][_0x0798('0x2a')]({'plain':!![]});if(!_0x9e6db6)throw new Error(_0x0798('0x4e'));if(_0x9e6db6['role']===_0x0798('0x4d')){var _0x3e1c15=_0x2695d5[_0x0798('0x2a')]({'plain':!![]});var _0x10173d=_0x0798('0x4f');return db[_0x0798('0x50')][_0x0798('0x4a')]({'where':{'name':_0x10173d,'userProfileId':_0x9e6db6[_0x0798('0x51')]},'raw':!![]})[_0x0798('0x28')](function(_0x48dc0d){if(_0x48dc0d&&_0x48dc0d['autoAssociation']===0x0){return db[_0x0798('0x2b')][_0x0798('0x4b')]({'name':_0x3e1c15[_0x0798('0x2e')],'resourceId':_0x3e1c15['id'],'type':_0x48dc0d[_0x0798('0x2e')],'sectionId':_0x48dc0d['id']},{})[_0x0798('0x28')](function(){return _0x2695d5;});}else{return _0x2695d5;}})[_0x0798('0x45')](function(_0x3fa571){logger['error'](_0x0798('0x52'),_0x3fa571);throw _0x3fa571;});}return _0x2695d5;})['then'](respondWithResult(_0x9dea1f,0xc9))[_0x0798('0x45')](handleError(_0x9dea1f,null));};exports[_0x0798('0x27')]=function(_0x3a3cc7,_0x48a072){if(_0x3a3cc7['body']['id']){delete _0x3a3cc7['body']['id'];}return db[_0x0798('0x31')]['find']({'where':{'id':_0x3a3cc7['params']['id']}})[_0x0798('0x28')](handleEntityNotFound(_0x48a072,null))[_0x0798('0x28')](saveUpdates(_0x3a3cc7[_0x0798('0x4c')],null))['then'](respondWithResult(_0x48a072,null))[_0x0798('0x45')](handleError(_0x48a072,null));};exports[_0x0798('0x29')]=function(_0x359a4d,_0x743d26){return db['Tag']['find']({'where':{'id':_0x359a4d[_0x0798('0x47')]['id']}})[_0x0798('0x28')](handleEntityNotFound(_0x743d26,null))[_0x0798('0x28')](removeEntity(_0x743d26,null))['catch'](handleError(_0x743d26,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 4d29599..efbf856 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 _0x3d1b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','../../config/logger'];(function(_0x448e1e,_0x1a126b){var _0x15054e=function(_0x30765a){while(--_0x30765a){_0x448e1e['push'](_0x448e1e['shift']());}};_0x15054e(++_0x1a126b);}(_0x3d1b,0x1a2));var _0xb3d1=function(_0x35cabc,_0xc0f89a){_0x35cabc=_0x35cabc-0x0;var _0x2af2b9=_0x3d1b[_0x35cabc];return _0x2af2b9;};'use strict';var _=require(_0xb3d1('0x0'));var util=require('util');var logger=require(_0xb3d1('0x1'))('api');var moment=require(_0xb3d1('0x2'));var BPromise=require(_0xb3d1('0x3'));var rp=require(_0xb3d1('0x4'));var fs=require('fs');var path=require(_0xb3d1('0x5'));var rimraf=require(_0xb3d1('0x6'));var config=require(_0xb3d1('0x7'));var attributes=require(_0xb3d1('0x8'));module['exports']=function(_0x28826f,_0x475dc0){return _0x28826f[_0xb3d1('0x9')](_0xb3d1('0xa'),attributes,{'tableName':_0xb3d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55f1=['bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x1ed757,_0x215ab1){var _0x3af968=function(_0x54260b){while(--_0x54260b){_0x1ed757['push'](_0x1ed757['shift']());}};_0x3af968(++_0x215ab1);}(_0x55f1,0x1d7));var _0x155f=function(_0x1234b9,_0x2d6dfc){_0x1234b9=_0x1234b9-0x0;var _0x411008=_0x55f1[_0x1234b9];return _0x411008;};'use strict';var _=require(_0x155f('0x0'));var util=require(_0x155f('0x1'));var logger=require(_0x155f('0x2'))(_0x155f('0x3'));var moment=require(_0x155f('0x4'));var BPromise=require(_0x155f('0x5'));var rp=require(_0x155f('0x6'));var fs=require('fs');var path=require(_0x155f('0x7'));var rimraf=require(_0x155f('0x8'));var config=require(_0x155f('0x9'));var attributes=require(_0x155f('0xa'));module['exports']=function(_0x42c6d4,_0x4cd45d){return _0x42c6d4[_0x155f('0xb')](_0x155f('0xc'),attributes,{'tableName':_0x155f('0xd'),'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 c6797a6..74e738b 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 _0x0624=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x400fe3,_0x6b60f4){var _0x498e72=function(_0x313fa5){while(--_0x313fa5){_0x400fe3['push'](_0x400fe3['shift']());}};_0x498e72(++_0x6b60f4);}(_0x0624,0x132));var _0x4062=function(_0x14941c,_0x47dbea){_0x14941c=_0x14941c-0x0;var _0x2a7d9e=_0x0624[_0x14941c];return _0x2a7d9e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4062('0x0'));var fs=require('fs');var Redis=require(_0x4062('0x1'));var db=require(_0x4062('0x2'))['db'];var utils=require(_0x4062('0x3'));var logger=require(_0x4062('0x4'))(_0x4062('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4062('0x6')][_0x4062('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f4928,_0xdff88c,_0x27794b){return new BPromise(function(_0x5d19e8,_0x75ce4e){return client['request'](_0x2f4928,_0x27794b)[_0x4062('0x8')](function(_0x35663b){logger[_0x4062('0x9')](_0x4062('0xa'),_0xdff88c,_0x4062('0xb'));logger[_0x4062('0xc')](_0x4062('0xd'),_0xdff88c,'request\x20sent',JSON[_0x4062('0xe')](_0x35663b));if(_0x35663b['error']){if(_0x35663b[_0x4062('0xf')][_0x4062('0x10')]===0x1f4){logger[_0x4062('0xf')](_0x4062('0xa'),_0xdff88c,_0x35663b[_0x4062('0xf')]['message']);return _0x75ce4e(_0x35663b[_0x4062('0xf')][_0x4062('0x11')]);}logger['error'](_0x4062('0xa'),_0xdff88c,_0x35663b[_0x4062('0xf')][_0x4062('0x11')]);return _0x5d19e8(_0x35663b['error']['message']);}else{logger[_0x4062('0x9')](_0x4062('0xa'),_0xdff88c,'request\x20sent');_0x5d19e8(_0x35663b['result']['message']);}})['catch'](function(_0x437432){logger['error'](_0x4062('0xa'),_0xdff88c,_0x437432);_0x75ce4e(_0x437432);});});} \ No newline at end of file +var _0xf2cb=['util','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x2dcb25,_0x281a9d){var _0x1b3e54=function(_0x180f97){while(--_0x180f97){_0x2dcb25['push'](_0x2dcb25['shift']());}};_0x1b3e54(++_0x281a9d);}(_0xf2cb,0x130));var _0xbf2c=function(_0x4e7486,_0x26c203){_0x4e7486=_0x4e7486-0x0;var _0xf5ba8f=_0xf2cb[_0x4e7486];return _0xf5ba8f;};'use strict';var _=require('lodash');var util=require(_0xbf2c('0x0'));var moment=require('moment');var BPromise=require(_0xbf2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf2c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf2c('0x3'));var logger=require(_0xbf2c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbf2c('0x5'));var client=jayson[_0xbf2c('0x6')][_0xbf2c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xaacd25,_0x516715,_0x16cf35){return new BPromise(function(_0x584a08,_0x25d0a6){return client['request'](_0xaacd25,_0x16cf35)['then'](function(_0x1601d5){logger[_0xbf2c('0x8')](_0xbf2c('0x9'),_0x516715,'request\x20sent');logger[_0xbf2c('0xa')](_0xbf2c('0xb'),_0x516715,_0xbf2c('0xc'),JSON[_0xbf2c('0xd')](_0x1601d5));if(_0x1601d5[_0xbf2c('0xe')]){if(_0x1601d5[_0xbf2c('0xe')][_0xbf2c('0xf')]===0x1f4){logger[_0xbf2c('0xe')]('Tag,\x20%s,\x20%s',_0x516715,_0x1601d5[_0xbf2c('0xe')][_0xbf2c('0x10')]);return _0x25d0a6(_0x1601d5[_0xbf2c('0xe')][_0xbf2c('0x10')]);}logger['error'](_0xbf2c('0x9'),_0x516715,_0x1601d5['error']['message']);return _0x584a08(_0x1601d5[_0xbf2c('0xe')]['message']);}else{logger['info'](_0xbf2c('0x9'),_0x516715,_0xbf2c('0xc'));_0x584a08(_0x1601d5[_0xbf2c('0x11')][_0xbf2c('0x10')]);}})[_0xbf2c('0x12')](function(_0x537084){logger[_0xbf2c('0xe')]('Tag,\x20%s,\x20%s',_0x516715,_0x537084);_0x25d0a6(_0x537084);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index a26b75b..8868c5e 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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 dcc7259..945e7d8 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 _0x757a=['exports','STRING'];(function(_0x1307c4,_0x318000){var _0x53605a=function(_0x40f8bc){while(--_0x40f8bc){_0x1307c4['push'](_0x1307c4['shift']());}};_0x53605a(++_0x318000);}(_0x757a,0xde));var _0xa757=function(_0x1318bc,_0x4a8c4b){_0x1318bc=_0x1318bc-0x0;var _0x542320=_0x757a[_0x1318bc];return _0x542320;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x40e264,_0x3f6291){var _0x58cb05=function(_0x1936bb){while(--_0x1936bb){_0x40e264['push'](_0x40e264['shift']());}};_0x58cb05(++_0x3f6291);}(_0xb10b,0x12a));var _0xbb10=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0xb10b[_0x351509];return _0x4e9861;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index dff1542..a0c8da1 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 _0x7168=['options','include','findAll','rows','show','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','findOne','channel','isValidChannel','capitalize','Queue','fields','toLowerCase','Queues','Sequelize','ValidationError','Unknown\x20channel','add','ids','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','through','penalty','QueueId','defaults','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','parse','UserVoicePrefix','spread','transaction','removeAgents','TeamVoicePrefix','VoicePrefixId','getAgents','eml-format','rimraf','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','get','Teams','UserProfileResource','error','stack','name','send','index','map','Team','rawAttributes','type','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x40308d,_0x200df3){var _0x78286e=function(_0x480a5c){while(--_0x480a5c){_0x40308d['push'](_0x40308d['shift']());}};_0x78286e(++_0x200df3);}(_0x7168,0xc7));var _0x8716=function(_0x35d1dc,_0x556397){_0x35d1dc=_0x35d1dc-0x0;var _0x30b376=_0x7168[_0x35d1dc];return _0x30b376;};'use strict';var emlformat=require(_0x8716('0x0'));var rimraf=require(_0x8716('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8716('0x2'));var moment=require('moment');var BPromise=require(_0x8716('0x3'));var Mustache=require('mustache');var util=require(_0x8716('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x8716('0x5'));var ejs=require(_0x8716('0x6'));var fs=require('fs');var fs_extra=require(_0x8716('0x7'));var _=require(_0x8716('0x8'));var squel=require(_0x8716('0x9'));var crypto=require('crypto');var jsforce=require(_0x8716('0xa'));var deskjs=require(_0x8716('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8716('0xc'));var Redis=require(_0x8716('0xd'));var authService=require(_0x8716('0xe'));var qs=require(_0x8716('0xf'));var as=require(_0x8716('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8716('0x11'))(_0x8716('0x12'));var utils=require(_0x8716('0x13'));var config=require(_0x8716('0x14'));var licenseUtil=require(_0x8716('0x15'));var db=require(_0x8716('0x16'))['db'];config['redis']=_['defaults'](config[_0x8716('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x8716('0x18'))(new Redis(config[_0x8716('0x17')]));require(_0x8716('0x19'))[_0x8716('0x1a')](socket);function respondWithStatusCode(_0x6be461,_0x373a34){_0x373a34=_0x373a34||0xcc;return function(_0x4cda31){if(_0x4cda31){return _0x6be461[_0x8716('0x1b')](_0x373a34);}return _0x6be461[_0x8716('0x1c')](_0x373a34)[_0x8716('0x1d')]();};}function respondWithResult(_0x1f1abb,_0x3d7f80){_0x3d7f80=_0x3d7f80||0xc8;return function(_0x1d4d67){if(_0x1d4d67){return _0x1f1abb['status'](_0x3d7f80)[_0x8716('0x1e')](_0x1d4d67);}};}function respondWithFilteredResult(_0x51ec7c,_0x25c543){return function(_0x4dc18f){if(_0x4dc18f){var _0x10912e=typeof _0x25c543[_0x8716('0x1f')]===_0x8716('0x20')&&typeof _0x25c543['limit']===_0x8716('0x20');var _0x173c6b=_0x4dc18f[_0x8716('0x21')];var _0x286712=_0x10912e?0x0:_0x25c543['offset'];var _0x40ad1b=_0x10912e?_0x4dc18f[_0x8716('0x21')]:_0x25c543[_0x8716('0x1f')]+_0x25c543['limit'];var _0x35ce1c;if(_0x40ad1b>=_0x173c6b){_0x40ad1b=_0x173c6b;_0x35ce1c=0xc8;}else{_0x35ce1c=0xce;}_0x51ec7c['status'](_0x35ce1c);return _0x51ec7c[_0x8716('0x22')](_0x8716('0x23'),_0x286712+'-'+_0x40ad1b+'/'+_0x173c6b)[_0x8716('0x1e')](_0x4dc18f);}return null;};}function patchUpdates(_0x50e123){return function(_0x57f354){try{jsonpatch[_0x8716('0x24')](_0x57f354,_0x50e123,!![]);}catch(_0x549f2f){return BPromise['reject'](_0x549f2f);}return _0x57f354['save']();};}function saveUpdates(_0x35a269,_0x1c03f8){return function(_0x3b2fad){if(_0x3b2fad){return _0x3b2fad[_0x8716('0x25')](_0x35a269)[_0x8716('0x26')](function(_0x34a547){return _0x34a547;});}return null;};}function removeEntity(_0x26a40a,_0x1f6aa1){return function(_0x33ebab){if(_0x33ebab){return _0x33ebab[_0x8716('0x27')]()[_0x8716('0x26')](function(){var _0x3e8d4e=_0x33ebab[_0x8716('0x28')]({'plain':!![]});var _0x57e5cf=_0x8716('0x29');return db[_0x8716('0x2a')][_0x8716('0x27')]({'where':{'type':_0x57e5cf,'resourceId':_0x3e8d4e['id']}})[_0x8716('0x26')](function(){return _0x33ebab;});})[_0x8716('0x26')](function(){_0x26a40a[_0x8716('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c7878,_0x569f6e){return function(_0x673999){if(!_0x673999){_0x2c7878['sendStatus'](0x194);}return _0x673999;};}function handleError(_0x1aac64,_0x57481f){_0x57481f=_0x57481f||0x1f4;return function(_0x27df6d){logger[_0x8716('0x2b')](_0x27df6d[_0x8716('0x2c')]);if(_0x27df6d[_0x8716('0x2d')]){delete _0x27df6d[_0x8716('0x2d')];}_0x1aac64[_0x8716('0x1c')](_0x57481f)[_0x8716('0x2e')](_0x27df6d);};}exports[_0x8716('0x2f')]=function(_0x2fa0f0,_0x3776f2){var _0x5c3a78={},_0x536d02={},_0x56b4d6={'count':0x0,'rows':[]};var _0x4b368e=_[_0x8716('0x30')](db[_0x8716('0x31')][_0x8716('0x32')],function(_0x58437b){return{'name':_0x58437b['fieldName'],'type':_0x58437b[_0x8716('0x33')]['key']};});_0x536d02[_0x8716('0x34')]=_[_0x8716('0x30')](_0x4b368e,_0x8716('0x2d'));_0x536d02['query']=_[_0x8716('0x35')](_0x2fa0f0['query']);_0x536d02[_0x8716('0x36')]=_[_0x8716('0x37')](_0x536d02[_0x8716('0x34')],_0x536d02[_0x8716('0x38')]);_0x5c3a78[_0x8716('0x39')]=_[_0x8716('0x37')](_0x536d02[_0x8716('0x34')],qs['fields'](_0x2fa0f0[_0x8716('0x38')]['fields']));_0x5c3a78[_0x8716('0x39')]=_0x5c3a78['attributes'][_0x8716('0x3a')]?_0x5c3a78['attributes']:_0x536d02[_0x8716('0x34')];if(!_0x2fa0f0[_0x8716('0x38')][_0x8716('0x3b')](_0x8716('0x3c'))){_0x5c3a78['limit']=qs[_0x8716('0x3d')](_0x2fa0f0[_0x8716('0x38')][_0x8716('0x3d')]);_0x5c3a78['offset']=qs[_0x8716('0x1f')](_0x2fa0f0['query'][_0x8716('0x1f')]);}_0x5c3a78[_0x8716('0x3e')]=qs[_0x8716('0x3f')](_0x2fa0f0[_0x8716('0x38')]['sort']);_0x5c3a78[_0x8716('0x40')]=qs[_0x8716('0x36')](_[_0x8716('0x41')](_0x2fa0f0[_0x8716('0x38')],_0x536d02[_0x8716('0x36')]),_0x4b368e);if(_0x2fa0f0['query'][_0x8716('0x42')]){_0x5c3a78[_0x8716('0x40')]=_[_0x8716('0x43')](_0x5c3a78[_0x8716('0x40')],{'$or':_[_0x8716('0x30')](_0x4b368e,function(_0x1cb60d){if(_0x1cb60d[_0x8716('0x33')]!==_0x8716('0x44')){var _0x1c838a={};_0x1c838a[_0x1cb60d['name']]={'$like':'%'+_0x2fa0f0['query'][_0x8716('0x42')]+'%'};return _0x1c838a;}})});}_0x5c3a78=_[_0x8716('0x43')]({},_0x5c3a78,_0x2fa0f0[_0x8716('0x45')]);var _0x274359={'where':_0x5c3a78['where']};return db[_0x8716('0x31')][_0x8716('0x21')](_0x274359)[_0x8716('0x26')](function(_0x1f18b1){_0x56b4d6['count']=_0x1f18b1;if(_0x2fa0f0[_0x8716('0x38')]['includeAll']){_0x5c3a78[_0x8716('0x46')]=[{'all':!![]}];}return db[_0x8716('0x31')][_0x8716('0x47')](_0x5c3a78);})[_0x8716('0x26')](function(_0x3d103a){_0x56b4d6[_0x8716('0x48')]=_0x3d103a;return _0x56b4d6;})['then'](respondWithFilteredResult(_0x3776f2,_0x5c3a78))['catch'](handleError(_0x3776f2,null));};exports[_0x8716('0x49')]=function(_0x43acff,_0x5a1a53){var _0x3e23cf={'raw':![],'where':{'id':_0x43acff['params']['id']}},_0x306e45={};_0x306e45['model']=_[_0x8716('0x35')](db[_0x8716('0x31')][_0x8716('0x32')]);_0x306e45[_0x8716('0x38')]=_[_0x8716('0x35')](_0x43acff[_0x8716('0x38')]);_0x306e45['filters']=_[_0x8716('0x37')](_0x306e45[_0x8716('0x34')],_0x306e45[_0x8716('0x38')]);_0x3e23cf[_0x8716('0x39')]=_['intersection'](_0x306e45[_0x8716('0x34')],qs['fields'](_0x43acff[_0x8716('0x38')]['fields']));_0x3e23cf['attributes']=_0x3e23cf['attributes'][_0x8716('0x3a')]?_0x3e23cf[_0x8716('0x39')]:_0x306e45[_0x8716('0x34')];if(_0x43acff[_0x8716('0x38')][_0x8716('0x4a')]){_0x3e23cf[_0x8716('0x46')]=[{'all':!![]}];}_0x3e23cf=_[_0x8716('0x43')]({},_0x3e23cf,_0x43acff[_0x8716('0x45')]);return db['Team'][_0x8716('0x4b')](_0x3e23cf)[_0x8716('0x26')](handleEntityNotFound(_0x5a1a53,null))[_0x8716('0x26')](respondWithResult(_0x5a1a53,null))[_0x8716('0x4c')](handleError(_0x5a1a53,null));};exports[_0x8716('0x4d')]=function(_0x3d0ac5,_0xd4dc7a){return db['Team'][_0x8716('0x4d')](_0x3d0ac5[_0x8716('0x4e')],{})[_0x8716('0x26')](function(_0x1bf4ca){var _0x45d817=_0x3d0ac5[_0x8716('0x4f')]['get']({'plain':!![]});if(!_0x45d817)throw new Error(_0x8716('0x50'));if(_0x45d817['role']===_0x8716('0x4f')){var _0x201528=_0x1bf4ca['get']({'plain':!![]});var _0x4370bc='Teams';return db[_0x8716('0x51')]['find']({'where':{'name':_0x4370bc,'userProfileId':_0x45d817[_0x8716('0x52')]},'raw':!![]})[_0x8716('0x26')](function(_0x5bed8c){if(_0x5bed8c&&_0x5bed8c[_0x8716('0x53')]===0x0){return db[_0x8716('0x2a')][_0x8716('0x4d')]({'name':_0x201528[_0x8716('0x2d')],'resourceId':_0x201528['id'],'type':_0x5bed8c[_0x8716('0x2d')],'sectionId':_0x5bed8c['id']},{})[_0x8716('0x26')](function(){return _0x1bf4ca;});}else{return _0x1bf4ca;}})[_0x8716('0x4c')](function(_0xa8e1c6){logger[_0x8716('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa8e1c6);throw _0xa8e1c6;});}return _0x1bf4ca;})['then'](respondWithResult(_0xd4dc7a,0xc9))['catch'](handleError(_0xd4dc7a,null));};exports[_0x8716('0x25')]=function(_0x17548d,_0x33c994){if(_0x17548d['body']['id']){delete _0x17548d[_0x8716('0x4e')]['id'];}return db[_0x8716('0x31')][_0x8716('0x4b')]({'where':{'id':_0x17548d[_0x8716('0x54')]['id']}})[_0x8716('0x26')](handleEntityNotFound(_0x33c994,null))[_0x8716('0x26')](saveUpdates(_0x17548d[_0x8716('0x4e')],null))['then'](respondWithResult(_0x33c994,null))['catch'](handleError(_0x33c994,null));};exports[_0x8716('0x27')]=function(_0x103658,_0x1ae338){return db[_0x8716('0x31')][_0x8716('0x4b')]({'where':{'id':_0x103658[_0x8716('0x54')]['id']}})[_0x8716('0x26')](handleEntityNotFound(_0x1ae338,null))[_0x8716('0x26')](removeEntity(_0x1ae338,null))[_0x8716('0x4c')](handleError(_0x1ae338,null));};exports['getQueues']=function(_0x38a0d0,_0x1d97e5,_0x4f9354){return db[_0x8716('0x31')][_0x8716('0x55')]({'where':{'id':_0x38a0d0[_0x8716('0x54')]['id']}})[_0x8716('0x26')](handleEntityNotFound(_0x1d97e5,null))[_0x8716('0x26')](function(_0x904350){if(!_0x38a0d0[_0x8716('0x38')][_0x8716('0x56')]||!utils[_0x8716('0x57')](_0x38a0d0[_0x8716('0x38')][_0x8716('0x56')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}var _0x33e6a7={};var _0x10bad1={};_0x10bad1[_0x8716('0x34')]=_[_0x8716('0x35')](db[_[_0x8716('0x58')](_0x38a0d0[_0x8716('0x38')]['channel']['toLowerCase']())+_0x8716('0x59')][_0x8716('0x32')]);_0x10bad1[_0x8716('0x38')]=_[_0x8716('0x35')](_0x38a0d0[_0x8716('0x38')]);_0x10bad1[_0x8716('0x36')]=_[_0x8716('0x37')](_0x10bad1[_0x8716('0x34')],_0x10bad1['query']);_0x33e6a7[_0x8716('0x39')]=_[_0x8716('0x37')](_0x10bad1[_0x8716('0x34')],qs[_0x8716('0x5a')](_0x38a0d0[_0x8716('0x38')][_0x8716('0x5a')]));_0x33e6a7[_0x8716('0x39')]=_0x33e6a7['attributes'][_0x8716('0x3a')]?_0x33e6a7[_0x8716('0x39')]:_0x10bad1[_0x8716('0x34')];_0x33e6a7[_0x8716('0x3d')]=qs[_0x8716('0x3d')](_0x38a0d0[_0x8716('0x38')][_0x8716('0x3d')]);_0x33e6a7[_0x8716('0x1f')]=qs[_0x8716('0x1f')](_0x38a0d0['query'][_0x8716('0x1f')]);_0x33e6a7['order']=qs[_0x8716('0x3f')](_0x38a0d0[_0x8716('0x38')][_0x8716('0x3f')]);_0x33e6a7[_0x8716('0x40')]=qs[_0x8716('0x36')](_[_0x8716('0x41')](_0x38a0d0[_0x8716('0x38')],_0x10bad1['filters']));_0x33e6a7=_['merge']({},_0x33e6a7,_0x38a0d0['options']);return _0x904350[_0x8716('0x28')+_['capitalize'](_0x38a0d0['query'][_0x8716('0x56')][_0x8716('0x5b')]())+_0x8716('0x5c')](_0x33e6a7);})['then'](respondWithResult(_0x1d97e5,null))[_0x8716('0x4c')](handleError(_0x1d97e5,null));};exports['addQueues']=function(_0x30ecb3,_0x1b1dc2,_0x31275a){return db[_0x8716('0x31')][_0x8716('0x55')]({'where':{'id':_0x30ecb3['params']['id']}})[_0x8716('0x26')](function(_0x59155b){if(_0x59155b){if(!_0x30ecb3[_0x8716('0x4e')][_0x8716('0x56')]||!utils[_0x8716('0x57')](_0x30ecb3[_0x8716('0x4e')][_0x8716('0x56')])){throw new db[(_0x8716('0x5d'))][(_0x8716('0x5e'))](_0x8716('0x5f'));}return _0x59155b[_0x8716('0x60')+_[_0x8716('0x58')](_0x30ecb3['body'][_0x8716('0x56')][_0x8716('0x5b')]())+_0x8716('0x5c')](_0x30ecb3[_0x8716('0x4e')][_0x8716('0x61')]);}return null;})[_0x8716('0x26')](handleEntityNotFound(_0x1b1dc2,null))[_0x8716('0x26')](respondWithStatusCode(_0x1b1dc2,null))['catch'](handleError(_0x1b1dc2,null));};exports['removeQueues']=function(_0x8b9de6,_0x533eb1,_0x21d031){return db[_0x8716('0x31')][_0x8716('0x55')]({'where':{'id':_0x8b9de6[_0x8716('0x54')]['id']}})[_0x8716('0x26')](function(_0x4ecc4a){if(_0x4ecc4a){if(!_0x8b9de6[_0x8716('0x38')]['channel']||!utils[_0x8716('0x57')](_0x8b9de6[_0x8716('0x38')][_0x8716('0x56')])){throw new db[(_0x8716('0x5d'))][(_0x8716('0x5e'))](_0x8716('0x5f'));}return _0x4ecc4a[_0x8716('0x62')+_['capitalize'](_0x8b9de6['query'][_0x8716('0x56')]['toLowerCase']())+_0x8716('0x5c')](_0x8b9de6[_0x8716('0x38')][_0x8716('0x61')]);}return null;})[_0x8716('0x26')](handleEntityNotFound(_0x533eb1,null))[_0x8716('0x26')](respondWithStatusCode(_0x533eb1,null))[_0x8716('0x4c')](handleError(_0x533eb1,null));};exports[_0x8716('0x63')]=function(_0x286f2e,_0x9dfeb2){return db[_0x8716('0x31')][_0x8716('0x4b')]({'where':{'id':_0x286f2e[_0x8716('0x54')]['id']}})['then'](handleEntityNotFound(_0x9dfeb2,null))['then'](function(_0x1af95e){if(_0x1af95e){var _0x563eb2=[_0x8716('0x64'),_0x8716('0x65'),_0x8716('0x66'),_0x8716('0x67'),_0x8716('0x68'),_0x8716('0x69'),_0x8716('0x6a')];return db[_0x8716('0x6b')]['transaction'](function(_0x4c379a){var _0x1e7144=_[_0x8716('0x30')](_0x563eb2,function(_0x181e29){var _0x5e7528={'attributes':['id',_0x8716('0x2d')]};if(_0x181e29===_0x8716('0x64')){_0x5e7528[_0x8716('0x6c')]={'attributes':[_0x8716('0x6d')]};}return _0x1af95e[_0x8716('0x28')+_0x181e29+_0x8716('0x5c')](_0x5e7528)[_0x8716('0x26')](function(_0x42274c){var _0x132b27=_[_0x8716('0x30')](_0x42274c,function(_0x151602){var _0x145477=_[_0x8716('0x30')](_0x286f2e[_0x8716('0x4e')]['ids'],function(_0x204d90){var _0x2a136a={'where':{'UserId':_0x204d90,[_0x181e29+_0x8716('0x6e')]:_0x151602['id']},'transaction':_0x4c379a};if(_0x181e29===_0x8716('0x64')){_0x2a136a[_0x8716('0x6f')]={'penalty':_0x151602['TeamVoiceQueue']['penalty']};}return db[_0x8716('0x70')+_0x181e29+_0x8716('0x59')][_0x8716('0x71')](_0x2a136a)[_0x8716('0x26')](function(){socket[_0x8716('0x72')]('user'+_0x181e29+_0x8716('0x73'),{'UserId':_0x204d90,[_0x181e29+_0x8716('0x6e')]:_0x151602['id']});if(_0x181e29!=='Voice')return;return db['User'][_0x8716('0x47')]({'where':{'id':_0x286f2e[_0x8716('0x4e')][_0x8716('0x61')],'online':0x1},'attributes':['id',_0x8716('0x2d'),_0x8716('0x74'),_0x8716('0x75'),_0x8716('0x76')],'raw':!![]})[_0x8716('0x26')](function(_0x179ce4){var _0x12fc4f=_[_0x8716('0x30')](_0x179ce4,function(_0x383897){return db[_0x8716('0x77')][_0x8716('0x78')]({'membername':_0x383897['name'],'UserId':_0x383897['id'],'queue_name':_0x151602[_0x8716('0x2d')],'VoiceQueueId':_0x151602['id'],'interface':_[_0x8716('0x79')](_0x383897[_0x8716('0x76')])?util[_0x8716('0x7a')](_0x8716('0x7b'),_0x383897[_0x8716('0x2d')]):_0x383897[_0x8716('0x76')],'paused':_0x383897[_0x8716('0x75')]||![],'penalty':_0x151602[_0x8716('0x7c')][_0x8716('0x6d')]},{'transaction':_0x4c379a});});return Promise[_0x8716('0x7d')](_0x12fc4f);});});});return Promise[_0x8716('0x7d')](_0x145477);});return Promise[_0x8716('0x7d')](_0x132b27);})[_0x8716('0x26')](function(){var _0x17677a=JSON[_0x8716('0x7e')]('['+_0x286f2e[_0x8716('0x4e')][_0x8716('0x61')]+']');db['TeamVoicePrefix'][_0x8716('0x55')]({'where':{'teamId':_0x286f2e[_0x8716('0x54')]['id']}})['then'](function(_0x4f3dda){if(_0x4f3dda){for(var _0x3313aa=0x0;_0x3313aa<_0x17677a[_0x8716('0x3a')];_0x3313aa++){var _0x284254=_0x17677a[_0x3313aa];db[_0x8716('0x7f')][_0x8716('0x78')]({'UserId':_0x284254,'VoicePrefixId':_0x4f3dda['VoicePrefixId']});}}});});});return Promise[_0x8716('0x7d')](_0x1e7144)[_0x8716('0x26')](function(){return _0x1af95e['addAgents'](_0x286f2e[_0x8716('0x4e')][_0x8716('0x61')],{'transaction':_0x4c379a})[_0x8716('0x80')](function(_0x347d80){return _0x347d80;});});});}})[_0x8716('0x26')](respondWithResult(_0x9dfeb2,null))[_0x8716('0x4c')](handleError(_0x9dfeb2,null));};exports['removeAgents']=function(_0x29e452,_0x5deb02){return db[_0x8716('0x31')][_0x8716('0x4b')]({'where':{'id':_0x29e452[_0x8716('0x54')]['id']}})[_0x8716('0x26')](handleEntityNotFound(_0x5deb02,null))['then'](function(_0x5ec741){if(_0x5ec741){var _0xaea606=[_0x8716('0x64'),_0x8716('0x65'),'Mail',_0x8716('0x67'),_0x8716('0x68'),_0x8716('0x69'),_0x8716('0x6a')];return db[_0x8716('0x6b')][_0x8716('0x81')](function(_0x335360){var _0x4e79b7=_[_0x8716('0x30')](_0xaea606,function(_0x1df05e){var _0x217476={'attributes':['id',_0x8716('0x2d')]};return _0x5ec741[_0x8716('0x28')+_0x1df05e+_0x8716('0x5c')](_0x217476)[_0x8716('0x26')](function(_0x46b927){var _0x9c22d5=_['map'](_0x46b927,function(_0xe78c89){return _0xe78c89[_0x8716('0x82')](_0x29e452['query'][_0x8716('0x61')],{'transaction':_0x335360})[_0x8716('0x26')](function(){var _0x192dae=JSON[_0x8716('0x7e')]('['+_0x29e452[_0x8716('0x38')]['ids']+']');var _0x397f67=_[_0x8716('0x30')](_0x192dae,function(_0x5dec59){socket[_0x8716('0x72')]('user'+_0x1df05e+'Queue:remove',{'UserId':Number(_0x5dec59),[_0x1df05e+_0x8716('0x6e')]:_0xe78c89['id']});if(_0x1df05e!==_0x8716('0x64'))return;return db[_0x8716('0x77')][_0x8716('0x27')]({'where':{'VoiceQueueId':_0xe78c89['id'],'UserId':_0x5dec59},'transaction':_0x335360});});return Promise['all'](_0x397f67);});});return Promise[_0x8716('0x7d')](_0x9c22d5);});});return Promise[_0x8716('0x7d')](_0x4e79b7)[_0x8716('0x26')](function(){return _0x5ec741['removeAgents'](_0x29e452[_0x8716('0x38')]['ids'],{'transaction':_0x335360});})[_0x8716('0x26')](function(){var _0x56aa78=JSON[_0x8716('0x7e')]('['+_0x29e452[_0x8716('0x38')][_0x8716('0x61')]+']');db[_0x8716('0x83')]['findOne']({'where':{'teamId':_0x29e452[_0x8716('0x54')]['id']}})['then'](function(_0x570b72){if(_0x570b72){for(var _0x449949=0x0;_0x449949<_0x56aa78[_0x8716('0x3a')];_0x449949++){var _0x1a96c8=_0x56aa78[_0x449949];db['UserVoicePrefix'][_0x8716('0x27')]({'where':{'UserId':_0x1a96c8,'VoicePrefixId':_0x570b72[_0x8716('0x84')]}});}}});});});}})[_0x8716('0x26')](respondWithStatusCode(_0x5deb02,null))[_0x8716('0x4c')](handleError(_0x5deb02,null));};exports['getAgents']=function(_0x2b6ca2,_0x19178c,_0x28c86c){var _0x5be621={};var _0x104a63={};var _0x1ec2c8;var _0x7ed17b;return db[_0x8716('0x31')]['findOne']({'where':{'id':_0x2b6ca2[_0x8716('0x54')]['id']}})[_0x8716('0x26')](handleEntityNotFound(_0x19178c,null))[_0x8716('0x26')](function(_0x4fb1ab){if(_0x4fb1ab){_0x1ec2c8=_0x4fb1ab;_0x104a63[_0x8716('0x34')]=_['keys'](db[_0x8716('0x70')][_0x8716('0x32')]);_0x104a63[_0x8716('0x38')]=_['keys'](_0x2b6ca2[_0x8716('0x38')]);_0x104a63[_0x8716('0x36')]=_[_0x8716('0x37')](_0x104a63[_0x8716('0x34')],_0x104a63['query']);_0x5be621['attributes']=_['intersection'](_0x104a63[_0x8716('0x34')],qs[_0x8716('0x5a')](_0x2b6ca2['query'][_0x8716('0x5a')]));_0x5be621['attributes']=_0x5be621[_0x8716('0x39')]['length']?_0x5be621[_0x8716('0x39')]:_0x104a63['model'];_0x5be621[_0x8716('0x3e')]=qs[_0x8716('0x3f')](_0x2b6ca2[_0x8716('0x38')][_0x8716('0x3f')]);_0x5be621[_0x8716('0x40')]=qs[_0x8716('0x36')](_['pick'](_0x2b6ca2['query'],_0x104a63[_0x8716('0x36')]));if(_0x2b6ca2[_0x8716('0x38')]['filter']){_0x5be621[_0x8716('0x40')]=_[_0x8716('0x43')](_0x5be621[_0x8716('0x40')],{'$or':_[_0x8716('0x30')](_0x5be621[_0x8716('0x39')],function(_0x3a6fcd){var _0x341d3e={};_0x341d3e[_0x3a6fcd]={'$like':'%'+_0x2b6ca2[_0x8716('0x38')][_0x8716('0x42')]+'%'};return _0x341d3e;})});}_0x5be621=_[_0x8716('0x43')]({},_0x5be621,_0x2b6ca2[_0x8716('0x45')]);return _0x1ec2c8['getAgents'](_0x5be621);}})['then'](function(_0x1897b1){if(_0x1897b1){_0x7ed17b=_0x1897b1['length'];if(!_0x2b6ca2[_0x8716('0x38')]['hasOwnProperty'](_0x8716('0x3c'))){_0x5be621['limit']=qs[_0x8716('0x3d')](_0x2b6ca2[_0x8716('0x38')][_0x8716('0x3d')]);_0x5be621[_0x8716('0x1f')]=qs[_0x8716('0x1f')](_0x2b6ca2[_0x8716('0x38')][_0x8716('0x1f')]);}return _0x1ec2c8[_0x8716('0x85')](_0x5be621);}})['then'](function(_0x443141){if(_0x443141){return _0x443141?{'count':_0x7ed17b,'rows':_0x443141}:null;}})['then'](respondWithResult(_0x19178c,null))[_0x8716('0x4c')](handleError(_0x19178c,null));}; \ No newline at end of file +var _0x4ce3=['bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Teams','UserProfileResource','error','name','index','Team','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','Queue','toLowerCase','Queues','addQueues','findOne','Sequelize','add','removeQueues','remove','capitalize','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','through','penalty','ids','TeamVoiceQueue','Queue:save','QueueId','User','online','voicePause','interface','UserVoiceQueueRt','SIP/%s','all','parse','UserVoicePrefix','spread','removeAgents','emit','Queue:remove','TeamVoicePrefix','getAgents','filter','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x254b22,_0x27159f){var _0x1279db=function(_0x3ca06f){while(--_0x3ca06f){_0x254b22['push'](_0x254b22['shift']());}};_0x1279db(++_0x27159f);}(_0x4ce3,0x112));var _0x34ce=function(_0xc17d60,_0x4d3616){_0xc17d60=_0xc17d60-0x0;var _0x462396=_0x4ce3[_0xc17d60];return _0x462396;};'use strict';var emlformat=require(_0x34ce('0x0'));var rimraf=require(_0x34ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34ce('0x2'));var rp=require(_0x34ce('0x3'));var moment=require('moment');var BPromise=require(_0x34ce('0x4'));var Mustache=require(_0x34ce('0x5'));var util=require(_0x34ce('0x6'));var path=require(_0x34ce('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x34ce('0x8'));var fs=require('fs');var fs_extra=require(_0x34ce('0x9'));var _=require(_0x34ce('0xa'));var squel=require(_0x34ce('0xb'));var crypto=require(_0x34ce('0xc'));var jsforce=require(_0x34ce('0xd'));var deskjs=require(_0x34ce('0xe'));var toCsv=require(_0x34ce('0xf'));var querystring=require(_0x34ce('0x10'));var Papa=require('papaparse');var Redis=require(_0x34ce('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x34ce('0x12'));var as=require(_0x34ce('0x13'));var hardwareService=require(_0x34ce('0x14'));var logger=require(_0x34ce('0x15'))(_0x34ce('0x16'));var utils=require(_0x34ce('0x17'));var config=require(_0x34ce('0x18'));var licenseUtil=require(_0x34ce('0x19'));var db=require(_0x34ce('0x1a'))['db'];config[_0x34ce('0x1b')]=_[_0x34ce('0x1c')](config[_0x34ce('0x1b')],{'host':_0x34ce('0x1d'),'port':0x18eb});var socket=require(_0x34ce('0x1e'))(new Redis(config[_0x34ce('0x1b')]));require(_0x34ce('0x1f'))[_0x34ce('0x20')](socket);function respondWithStatusCode(_0x5eb2f1,_0x21b206){_0x21b206=_0x21b206||0xcc;return function(_0x30a07c){if(_0x30a07c){return _0x5eb2f1[_0x34ce('0x21')](_0x21b206);}return _0x5eb2f1[_0x34ce('0x22')](_0x21b206)[_0x34ce('0x23')]();};}function respondWithResult(_0x1d3e87,_0x518f79){_0x518f79=_0x518f79||0xc8;return function(_0x49706b){if(_0x49706b){return _0x1d3e87[_0x34ce('0x22')](_0x518f79)['json'](_0x49706b);}};}function respondWithFilteredResult(_0x974c00,_0x5d0419){return function(_0x4bda3a){if(_0x4bda3a){var _0x4996e9=typeof _0x5d0419[_0x34ce('0x24')]===_0x34ce('0x25')&&typeof _0x5d0419[_0x34ce('0x26')]==='undefined';var _0x338a4e=_0x4bda3a[_0x34ce('0x27')];var _0x56080a=_0x4996e9?0x0:_0x5d0419[_0x34ce('0x24')];var _0x1950be=_0x4996e9?_0x4bda3a[_0x34ce('0x27')]:_0x5d0419[_0x34ce('0x24')]+_0x5d0419[_0x34ce('0x26')];var _0x53676a;if(_0x1950be>=_0x338a4e){_0x1950be=_0x338a4e;_0x53676a=0xc8;}else{_0x53676a=0xce;}_0x974c00[_0x34ce('0x22')](_0x53676a);return _0x974c00[_0x34ce('0x28')](_0x34ce('0x29'),_0x56080a+'-'+_0x1950be+'/'+_0x338a4e)[_0x34ce('0x2a')](_0x4bda3a);}return null;};}function patchUpdates(_0xa04c41){return function(_0x22a025){try{jsonpatch[_0x34ce('0x2b')](_0x22a025,_0xa04c41,!![]);}catch(_0x39dfe2){return BPromise[_0x34ce('0x2c')](_0x39dfe2);}return _0x22a025['save']();};}function saveUpdates(_0x17fc6d,_0x2691d3){return function(_0x454ce5){if(_0x454ce5){return _0x454ce5[_0x34ce('0x2d')](_0x17fc6d)[_0x34ce('0x2e')](function(_0x27f583){return _0x27f583;});}return null;};}function removeEntity(_0x53ad08,_0x2cfb9c){return function(_0x1e63e8){if(_0x1e63e8){return _0x1e63e8[_0x34ce('0x2f')]()[_0x34ce('0x2e')](function(){var _0x1a7faf=_0x1e63e8[_0x34ce('0x30')]({'plain':!![]});var _0x4aca0e=_0x34ce('0x31');return db[_0x34ce('0x32')]['destroy']({'where':{'type':_0x4aca0e,'resourceId':_0x1a7faf['id']}})['then'](function(){return _0x1e63e8;});})['then'](function(){_0x53ad08['status'](0xcc)[_0x34ce('0x23')]();});}};}function handleEntityNotFound(_0x4b5d2,_0x3ee328){return function(_0x14b546){if(!_0x14b546){_0x4b5d2[_0x34ce('0x21')](0x194);}return _0x14b546;};}function handleError(_0xdaefa,_0x1414f0){_0x1414f0=_0x1414f0||0x1f4;return function(_0x2a2d5f){logger[_0x34ce('0x33')](_0x2a2d5f['stack']);if(_0x2a2d5f[_0x34ce('0x34')]){delete _0x2a2d5f[_0x34ce('0x34')];}_0xdaefa[_0x34ce('0x22')](_0x1414f0)['send'](_0x2a2d5f);};}exports[_0x34ce('0x35')]=function(_0xed0791,_0x253034){var _0x137683={},_0x49ab8c={},_0x482428={'count':0x0,'rows':[]};var _0x55800a=_['map'](db[_0x34ce('0x36')][_0x34ce('0x37')],function(_0x307482){return{'name':_0x307482[_0x34ce('0x38')],'type':_0x307482[_0x34ce('0x39')][_0x34ce('0x3a')]};});_0x49ab8c[_0x34ce('0x3b')]=_[_0x34ce('0x3c')](_0x55800a,_0x34ce('0x34'));_0x49ab8c[_0x34ce('0x3d')]=_[_0x34ce('0x3e')](_0xed0791['query']);_0x49ab8c[_0x34ce('0x3f')]=_[_0x34ce('0x40')](_0x49ab8c[_0x34ce('0x3b')],_0x49ab8c[_0x34ce('0x3d')]);_0x137683[_0x34ce('0x41')]=_[_0x34ce('0x40')](_0x49ab8c['model'],qs[_0x34ce('0x42')](_0xed0791[_0x34ce('0x3d')]['fields']));_0x137683['attributes']=_0x137683[_0x34ce('0x41')][_0x34ce('0x43')]?_0x137683['attributes']:_0x49ab8c['model'];if(!_0xed0791['query']['hasOwnProperty'](_0x34ce('0x44'))){_0x137683[_0x34ce('0x26')]=qs['limit'](_0xed0791[_0x34ce('0x3d')][_0x34ce('0x26')]);_0x137683[_0x34ce('0x24')]=qs[_0x34ce('0x24')](_0xed0791[_0x34ce('0x3d')][_0x34ce('0x24')]);}_0x137683[_0x34ce('0x45')]=qs[_0x34ce('0x46')](_0xed0791['query']['sort']);_0x137683['where']=qs[_0x34ce('0x3f')](_[_0x34ce('0x47')](_0xed0791[_0x34ce('0x3d')],_0x49ab8c[_0x34ce('0x3f')]),_0x55800a);if(_0xed0791[_0x34ce('0x3d')]['filter']){_0x137683[_0x34ce('0x48')]=_['merge'](_0x137683['where'],{'$or':_[_0x34ce('0x3c')](_0x55800a,function(_0xf07a3e){if(_0xf07a3e[_0x34ce('0x39')]!==_0x34ce('0x49')){var _0x19f517={};_0x19f517[_0xf07a3e[_0x34ce('0x34')]]={'$like':'%'+_0xed0791['query']['filter']+'%'};return _0x19f517;}})});}_0x137683=_[_0x34ce('0x4a')]({},_0x137683,_0xed0791[_0x34ce('0x4b')]);var _0x3de91b={'where':_0x137683[_0x34ce('0x48')]};return db[_0x34ce('0x36')][_0x34ce('0x27')](_0x3de91b)['then'](function(_0x588283){_0x482428[_0x34ce('0x27')]=_0x588283;if(_0xed0791[_0x34ce('0x3d')][_0x34ce('0x4c')]){_0x137683[_0x34ce('0x4d')]=[{'all':!![]}];}return db[_0x34ce('0x36')][_0x34ce('0x4e')](_0x137683);})['then'](function(_0x106940){_0x482428[_0x34ce('0x4f')]=_0x106940;return _0x482428;})[_0x34ce('0x2e')](respondWithFilteredResult(_0x253034,_0x137683))[_0x34ce('0x50')](handleError(_0x253034,null));};exports['show']=function(_0x56cc80,_0x32b041){var _0xe7caa8={'raw':![],'where':{'id':_0x56cc80['params']['id']}},_0x267769={};_0x267769[_0x34ce('0x3b')]=_['keys'](db[_0x34ce('0x36')][_0x34ce('0x37')]);_0x267769[_0x34ce('0x3d')]=_[_0x34ce('0x3e')](_0x56cc80[_0x34ce('0x3d')]);_0x267769['filters']=_[_0x34ce('0x40')](_0x267769[_0x34ce('0x3b')],_0x267769['query']);_0xe7caa8[_0x34ce('0x41')]=_[_0x34ce('0x40')](_0x267769[_0x34ce('0x3b')],qs[_0x34ce('0x42')](_0x56cc80['query']['fields']));_0xe7caa8['attributes']=_0xe7caa8['attributes'][_0x34ce('0x43')]?_0xe7caa8['attributes']:_0x267769[_0x34ce('0x3b')];if(_0x56cc80[_0x34ce('0x3d')][_0x34ce('0x4c')]){_0xe7caa8[_0x34ce('0x4d')]=[{'all':!![]}];}_0xe7caa8=_['merge']({},_0xe7caa8,_0x56cc80[_0x34ce('0x4b')]);return db[_0x34ce('0x36')][_0x34ce('0x51')](_0xe7caa8)[_0x34ce('0x2e')](handleEntityNotFound(_0x32b041,null))[_0x34ce('0x2e')](respondWithResult(_0x32b041,null))[_0x34ce('0x50')](handleError(_0x32b041,null));};exports['create']=function(_0x56a781,_0x58e38e){return db[_0x34ce('0x36')][_0x34ce('0x52')](_0x56a781[_0x34ce('0x53')],{})['then'](function(_0x18f424){var _0x193d1c=_0x56a781[_0x34ce('0x54')]['get']({'plain':!![]});if(!_0x193d1c)throw new Error(_0x34ce('0x55'));if(_0x193d1c[_0x34ce('0x56')]==='user'){var _0x292f4b=_0x18f424[_0x34ce('0x30')]({'plain':!![]});var _0x47fd2f=_0x34ce('0x31');return db['UserProfileSection'][_0x34ce('0x51')]({'where':{'name':_0x47fd2f,'userProfileId':_0x193d1c[_0x34ce('0x57')]},'raw':!![]})['then'](function(_0x197a51){if(_0x197a51&&_0x197a51[_0x34ce('0x58')]===0x0){return db[_0x34ce('0x32')][_0x34ce('0x52')]({'name':_0x292f4b['name'],'resourceId':_0x292f4b['id'],'type':_0x197a51[_0x34ce('0x34')],'sectionId':_0x197a51['id']},{})['then'](function(){return _0x18f424;});}else{return _0x18f424;}})[_0x34ce('0x50')](function(_0x481302){logger[_0x34ce('0x33')](_0x34ce('0x59'),_0x481302);throw _0x481302;});}return _0x18f424;})[_0x34ce('0x2e')](respondWithResult(_0x58e38e,0xc9))[_0x34ce('0x50')](handleError(_0x58e38e,null));};exports[_0x34ce('0x2d')]=function(_0x8266eb,_0x1ddfef){if(_0x8266eb[_0x34ce('0x53')]['id']){delete _0x8266eb[_0x34ce('0x53')]['id'];}return db[_0x34ce('0x36')]['find']({'where':{'id':_0x8266eb[_0x34ce('0x5a')]['id']}})[_0x34ce('0x2e')](handleEntityNotFound(_0x1ddfef,null))['then'](saveUpdates(_0x8266eb[_0x34ce('0x53')],null))['then'](respondWithResult(_0x1ddfef,null))[_0x34ce('0x50')](handleError(_0x1ddfef,null));};exports[_0x34ce('0x2f')]=function(_0xe12220,_0x5a7b12){return db[_0x34ce('0x36')][_0x34ce('0x51')]({'where':{'id':_0xe12220[_0x34ce('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5a7b12,null))[_0x34ce('0x2e')](removeEntity(_0x5a7b12,null))[_0x34ce('0x50')](handleError(_0x5a7b12,null));};exports[_0x34ce('0x5b')]=function(_0x5006bf,_0x4f0ae0,_0x475b92){return db[_0x34ce('0x36')]['findOne']({'where':{'id':_0x5006bf[_0x34ce('0x5a')]['id']}})[_0x34ce('0x2e')](handleEntityNotFound(_0x4f0ae0,null))[_0x34ce('0x2e')](function(_0xa5c247){if(!_0x5006bf[_0x34ce('0x3d')][_0x34ce('0x5c')]||!utils[_0x34ce('0x5d')](_0x5006bf[_0x34ce('0x3d')]['channel'])){throw new db['Sequelize'][(_0x34ce('0x5e'))](_0x34ce('0x5f'));}var _0x1249f8={};var _0x535042={};_0x535042[_0x34ce('0x3b')]=_[_0x34ce('0x3e')](db[_['capitalize'](_0x5006bf[_0x34ce('0x3d')][_0x34ce('0x5c')]['toLowerCase']())+_0x34ce('0x60')][_0x34ce('0x37')]);_0x535042[_0x34ce('0x3d')]=_[_0x34ce('0x3e')](_0x5006bf[_0x34ce('0x3d')]);_0x535042['filters']=_['intersection'](_0x535042[_0x34ce('0x3b')],_0x535042['query']);_0x1249f8[_0x34ce('0x41')]=_[_0x34ce('0x40')](_0x535042[_0x34ce('0x3b')],qs[_0x34ce('0x42')](_0x5006bf[_0x34ce('0x3d')][_0x34ce('0x42')]));_0x1249f8[_0x34ce('0x41')]=_0x1249f8[_0x34ce('0x41')][_0x34ce('0x43')]?_0x1249f8[_0x34ce('0x41')]:_0x535042[_0x34ce('0x3b')];_0x1249f8['limit']=qs[_0x34ce('0x26')](_0x5006bf[_0x34ce('0x3d')][_0x34ce('0x26')]);_0x1249f8[_0x34ce('0x24')]=qs[_0x34ce('0x24')](_0x5006bf[_0x34ce('0x3d')][_0x34ce('0x24')]);_0x1249f8[_0x34ce('0x45')]=qs[_0x34ce('0x46')](_0x5006bf[_0x34ce('0x3d')][_0x34ce('0x46')]);_0x1249f8[_0x34ce('0x48')]=qs['filters'](_[_0x34ce('0x47')](_0x5006bf['query'],_0x535042[_0x34ce('0x3f')]));_0x1249f8=_['merge']({},_0x1249f8,_0x5006bf[_0x34ce('0x4b')]);return _0xa5c247[_0x34ce('0x30')+_['capitalize'](_0x5006bf['query'][_0x34ce('0x5c')][_0x34ce('0x61')]())+_0x34ce('0x62')](_0x1249f8);})[_0x34ce('0x2e')](respondWithResult(_0x4f0ae0,null))['catch'](handleError(_0x4f0ae0,null));};exports[_0x34ce('0x63')]=function(_0x4c0476,_0xcf51c6,_0xb9bd05){return db['Team'][_0x34ce('0x64')]({'where':{'id':_0x4c0476[_0x34ce('0x5a')]['id']}})[_0x34ce('0x2e')](function(_0x51b6ef){if(_0x51b6ef){if(!_0x4c0476['body'][_0x34ce('0x5c')]||!utils[_0x34ce('0x5d')](_0x4c0476['body'][_0x34ce('0x5c')])){throw new db[(_0x34ce('0x65'))]['ValidationError'](_0x34ce('0x5f'));}return _0x51b6ef[_0x34ce('0x66')+_['capitalize'](_0x4c0476[_0x34ce('0x53')]['channel'][_0x34ce('0x61')]())+_0x34ce('0x62')](_0x4c0476[_0x34ce('0x53')]['ids']);}return null;})[_0x34ce('0x2e')](handleEntityNotFound(_0xcf51c6,null))[_0x34ce('0x2e')](respondWithStatusCode(_0xcf51c6,null))[_0x34ce('0x50')](handleError(_0xcf51c6,null));};exports[_0x34ce('0x67')]=function(_0x31f7a8,_0x450d03,_0x3520a9){return db[_0x34ce('0x36')][_0x34ce('0x64')]({'where':{'id':_0x31f7a8[_0x34ce('0x5a')]['id']}})['then'](function(_0x106226){if(_0x106226){if(!_0x31f7a8[_0x34ce('0x3d')]['channel']||!utils[_0x34ce('0x5d')](_0x31f7a8[_0x34ce('0x3d')][_0x34ce('0x5c')])){throw new db['Sequelize'][(_0x34ce('0x5e'))](_0x34ce('0x5f'));}return _0x106226[_0x34ce('0x68')+_[_0x34ce('0x69')](_0x31f7a8[_0x34ce('0x3d')][_0x34ce('0x5c')][_0x34ce('0x61')]())+'Queues'](_0x31f7a8[_0x34ce('0x3d')]['ids']);}return null;})['then'](handleEntityNotFound(_0x450d03,null))['then'](respondWithStatusCode(_0x450d03,null))[_0x34ce('0x50')](handleError(_0x450d03,null));};exports[_0x34ce('0x6a')]=function(_0x173653,_0x2952a5){return db['Team']['find']({'where':{'id':_0x173653[_0x34ce('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2952a5,null))[_0x34ce('0x2e')](function(_0x476bbf){if(_0x476bbf){var _0x34f53a=[_0x34ce('0x6b'),_0x34ce('0x6c'),_0x34ce('0x6d'),_0x34ce('0x6e'),_0x34ce('0x6f'),_0x34ce('0x70'),_0x34ce('0x71')];return db[_0x34ce('0x72')][_0x34ce('0x73')](function(_0x2b8c95){var _0x520ded=_[_0x34ce('0x3c')](_0x34f53a,function(_0x463a0d){var _0x3e01d2={'attributes':['id',_0x34ce('0x34')]};if(_0x463a0d===_0x34ce('0x6b')){_0x3e01d2[_0x34ce('0x74')]={'attributes':[_0x34ce('0x75')]};}return _0x476bbf[_0x34ce('0x30')+_0x463a0d+_0x34ce('0x62')](_0x3e01d2)[_0x34ce('0x2e')](function(_0x1eb8cb){var _0x4b1c8b=_[_0x34ce('0x3c')](_0x1eb8cb,function(_0x5355a1){var _0x2f84e7=_['map'](_0x173653[_0x34ce('0x53')][_0x34ce('0x76')],function(_0x5204f9){var _0x492e8b={'where':{'UserId':_0x5204f9,[_0x463a0d+'QueueId']:_0x5355a1['id']},'transaction':_0x2b8c95};if(_0x463a0d===_0x34ce('0x6b')){_0x492e8b['defaults']={'penalty':_0x5355a1[_0x34ce('0x77')]['penalty']};}return db['User'+_0x463a0d+'Queue']['findOrCreate'](_0x492e8b)[_0x34ce('0x2e')](function(){socket['emit'](_0x34ce('0x54')+_0x463a0d+_0x34ce('0x78'),{'UserId':_0x5204f9,[_0x463a0d+_0x34ce('0x79')]:_0x5355a1['id']});if(_0x463a0d!==_0x34ce('0x6b'))return;return db[_0x34ce('0x7a')][_0x34ce('0x4e')]({'where':{'id':_0x173653[_0x34ce('0x53')][_0x34ce('0x76')],'online':0x1},'attributes':['id',_0x34ce('0x34'),_0x34ce('0x7b'),_0x34ce('0x7c'),_0x34ce('0x7d')],'raw':!![]})[_0x34ce('0x2e')](function(_0x2d93f0){var _0x210cc6=_[_0x34ce('0x3c')](_0x2d93f0,function(_0x4ed810){return db[_0x34ce('0x7e')]['upsert']({'membername':_0x4ed810[_0x34ce('0x34')],'UserId':_0x4ed810['id'],'queue_name':_0x5355a1[_0x34ce('0x34')],'VoiceQueueId':_0x5355a1['id'],'interface':_['isNil'](_0x4ed810[_0x34ce('0x7d')])?util['format'](_0x34ce('0x7f'),_0x4ed810[_0x34ce('0x34')]):_0x4ed810['interface'],'paused':_0x4ed810['voicePause']||![],'penalty':_0x5355a1[_0x34ce('0x77')][_0x34ce('0x75')]},{'transaction':_0x2b8c95});});return Promise[_0x34ce('0x80')](_0x210cc6);});});});return Promise[_0x34ce('0x80')](_0x2f84e7);});return Promise[_0x34ce('0x80')](_0x4b1c8b);})[_0x34ce('0x2e')](function(){var _0x12e3ef=JSON[_0x34ce('0x81')]('['+_0x173653[_0x34ce('0x53')][_0x34ce('0x76')]+']');db['TeamVoicePrefix'][_0x34ce('0x64')]({'where':{'teamId':_0x173653['params']['id']}})['then'](function(_0x5b1b4d){if(_0x5b1b4d){for(var _0xb22cb8=0x0;_0xb22cb8<_0x12e3ef[_0x34ce('0x43')];_0xb22cb8++){var _0x4ef124=_0x12e3ef[_0xb22cb8];db[_0x34ce('0x82')]['upsert']({'UserId':_0x4ef124,'VoicePrefixId':_0x5b1b4d['VoicePrefixId']});}}});});});return Promise[_0x34ce('0x80')](_0x520ded)[_0x34ce('0x2e')](function(){return _0x476bbf[_0x34ce('0x6a')](_0x173653[_0x34ce('0x53')][_0x34ce('0x76')],{'transaction':_0x2b8c95})[_0x34ce('0x83')](function(_0x264d31){return _0x264d31;});});});}})[_0x34ce('0x2e')](respondWithResult(_0x2952a5,null))[_0x34ce('0x50')](handleError(_0x2952a5,null));};exports[_0x34ce('0x84')]=function(_0x2f32de,_0x132d53){return db[_0x34ce('0x36')]['find']({'where':{'id':_0x2f32de[_0x34ce('0x5a')]['id']}})[_0x34ce('0x2e')](handleEntityNotFound(_0x132d53,null))[_0x34ce('0x2e')](function(_0x52e7cb){if(_0x52e7cb){var _0x4c726a=[_0x34ce('0x6b'),_0x34ce('0x6c'),_0x34ce('0x6d'),'Sms',_0x34ce('0x6f'),_0x34ce('0x70'),'Whatsapp'];return db[_0x34ce('0x72')]['transaction'](function(_0x30cdbc){var _0x17fb18=_[_0x34ce('0x3c')](_0x4c726a,function(_0x23e5ab){var _0x5cdebe={'attributes':['id',_0x34ce('0x34')]};return _0x52e7cb[_0x34ce('0x30')+_0x23e5ab+_0x34ce('0x62')](_0x5cdebe)[_0x34ce('0x2e')](function(_0x3fc5b5){var _0x2b237e=_['map'](_0x3fc5b5,function(_0x5e3467){return _0x5e3467[_0x34ce('0x84')](_0x2f32de[_0x34ce('0x3d')][_0x34ce('0x76')],{'transaction':_0x30cdbc})['then'](function(){var _0x5a3546=JSON[_0x34ce('0x81')]('['+_0x2f32de['query'][_0x34ce('0x76')]+']');var _0x3bcdb4=_[_0x34ce('0x3c')](_0x5a3546,function(_0x4bdb7f){socket[_0x34ce('0x85')](_0x34ce('0x54')+_0x23e5ab+_0x34ce('0x86'),{'UserId':Number(_0x4bdb7f),[_0x23e5ab+_0x34ce('0x79')]:_0x5e3467['id']});if(_0x23e5ab!==_0x34ce('0x6b'))return;return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x5e3467['id'],'UserId':_0x4bdb7f},'transaction':_0x30cdbc});});return Promise[_0x34ce('0x80')](_0x3bcdb4);});});return Promise['all'](_0x2b237e);});});return Promise[_0x34ce('0x80')](_0x17fb18)[_0x34ce('0x2e')](function(){return _0x52e7cb[_0x34ce('0x84')](_0x2f32de[_0x34ce('0x3d')][_0x34ce('0x76')],{'transaction':_0x30cdbc});})['then'](function(){var _0x56c8cf=JSON[_0x34ce('0x81')]('['+_0x2f32de[_0x34ce('0x3d')][_0x34ce('0x76')]+']');db[_0x34ce('0x87')]['findOne']({'where':{'teamId':_0x2f32de[_0x34ce('0x5a')]['id']}})[_0x34ce('0x2e')](function(_0x4f6778){if(_0x4f6778){for(var _0x216266=0x0;_0x216266<_0x56c8cf[_0x34ce('0x43')];_0x216266++){var _0x1970d1=_0x56c8cf[_0x216266];db[_0x34ce('0x82')][_0x34ce('0x2f')]({'where':{'UserId':_0x1970d1,'VoicePrefixId':_0x4f6778['VoicePrefixId']}});}}});});});}})[_0x34ce('0x2e')](respondWithStatusCode(_0x132d53,null))[_0x34ce('0x50')](handleError(_0x132d53,null));};exports[_0x34ce('0x88')]=function(_0x67a159,_0x52cfbf,_0x5a6d30){var _0x2a5f61={};var _0x11e4c8={};var _0x5cd256;var _0x520c24;return db[_0x34ce('0x36')][_0x34ce('0x64')]({'where':{'id':_0x67a159[_0x34ce('0x5a')]['id']}})['then'](handleEntityNotFound(_0x52cfbf,null))['then'](function(_0x1b3461){if(_0x1b3461){_0x5cd256=_0x1b3461;_0x11e4c8[_0x34ce('0x3b')]=_[_0x34ce('0x3e')](db[_0x34ce('0x7a')][_0x34ce('0x37')]);_0x11e4c8[_0x34ce('0x3d')]=_[_0x34ce('0x3e')](_0x67a159['query']);_0x11e4c8[_0x34ce('0x3f')]=_[_0x34ce('0x40')](_0x11e4c8[_0x34ce('0x3b')],_0x11e4c8[_0x34ce('0x3d')]);_0x2a5f61[_0x34ce('0x41')]=_[_0x34ce('0x40')](_0x11e4c8[_0x34ce('0x3b')],qs[_0x34ce('0x42')](_0x67a159[_0x34ce('0x3d')][_0x34ce('0x42')]));_0x2a5f61[_0x34ce('0x41')]=_0x2a5f61[_0x34ce('0x41')]['length']?_0x2a5f61[_0x34ce('0x41')]:_0x11e4c8[_0x34ce('0x3b')];_0x2a5f61[_0x34ce('0x45')]=qs[_0x34ce('0x46')](_0x67a159[_0x34ce('0x3d')][_0x34ce('0x46')]);_0x2a5f61['where']=qs[_0x34ce('0x3f')](_['pick'](_0x67a159[_0x34ce('0x3d')],_0x11e4c8[_0x34ce('0x3f')]));if(_0x67a159[_0x34ce('0x3d')][_0x34ce('0x89')]){_0x2a5f61['where']=_[_0x34ce('0x4a')](_0x2a5f61['where'],{'$or':_[_0x34ce('0x3c')](_0x2a5f61[_0x34ce('0x41')],function(_0x12bc7e){var _0x3ce9a0={};_0x3ce9a0[_0x12bc7e]={'$like':'%'+_0x67a159[_0x34ce('0x3d')][_0x34ce('0x89')]+'%'};return _0x3ce9a0;})});}_0x2a5f61=_[_0x34ce('0x4a')]({},_0x2a5f61,_0x67a159[_0x34ce('0x4b')]);return _0x5cd256[_0x34ce('0x88')](_0x2a5f61);}})[_0x34ce('0x2e')](function(_0x278559){if(_0x278559){_0x520c24=_0x278559['length'];if(!_0x67a159['query'][_0x34ce('0x8a')](_0x34ce('0x44'))){_0x2a5f61[_0x34ce('0x26')]=qs['limit'](_0x67a159[_0x34ce('0x3d')]['limit']);_0x2a5f61['offset']=qs[_0x34ce('0x24')](_0x67a159[_0x34ce('0x3d')]['offset']);}return _0x5cd256[_0x34ce('0x88')](_0x2a5f61);}})[_0x34ce('0x2e')](function(_0x2e5f3c){if(_0x2e5f3c){return _0x2e5f3c?{'count':_0x520c24,'rows':_0x2e5f3c}:null;}})[_0x34ce('0x2e')](respondWithResult(_0x52cfbf,null))[_0x34ce('0x50')](handleError(_0x52cfbf,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 579cf9f..167719f 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 _0x7560=['events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2218ea,_0x28db8f){var _0x3d3442=function(_0x457fab){while(--_0x457fab){_0x2218ea['push'](_0x2218ea['shift']());}};_0x3d3442(++_0x28db8f);}(_0x7560,0x6e));var _0x0756=function(_0x50ceed,_0x2cf670){_0x50ceed=_0x50ceed-0x0;var _0x9034e2=_0x7560[_0x50ceed];return _0x9034e2;};'use strict';var EventEmitter=require(_0x0756('0x0'));var Team=require(_0x0756('0x1'))['db'][_0x0756('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x0756('0x3')](0x0);var events={'afterCreate':_0x0756('0x4'),'afterUpdate':_0x0756('0x5'),'afterDestroy':_0x0756('0x6')};function emitEvent(_0x3bf247){return function(_0x13c3f0,_0x1fe862,_0x47bef1){TeamEvents[_0x0756('0x7')](_0x3bf247+':'+_0x13c3f0['id'],_0x13c3f0);TeamEvents['emit'](_0x3bf247,_0x13c3f0);_0x47bef1(null);};}for(var e in events){if(events[_0x0756('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x0756('0x9')]=TeamEvents; \ No newline at end of file +var _0xeb30=['Team','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3d0d9f,_0x383936){var _0x3807ed=function(_0x1f569e){while(--_0x1f569e){_0x3d0d9f['push'](_0x3d0d9f['shift']());}};_0x3807ed(++_0x383936);}(_0xeb30,0x80));var _0x0eb3=function(_0x2731c5,_0x1c7fa0){_0x2731c5=_0x2731c5-0x0;var _0x1c4fee=_0xeb30[_0x2731c5];return _0x1c4fee;};'use strict';var EventEmitter=require(_0x0eb3('0x0'));var Team=require(_0x0eb3('0x1'))['db'][_0x0eb3('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x0eb3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0eb3('0x4'),'afterDestroy':_0x0eb3('0x5')};function emitEvent(_0x135699){return function(_0x211862,_0x1ba387,_0x2ea6c3){TeamEvents[_0x0eb3('0x6')](_0x135699+':'+_0x211862['id'],_0x211862);TeamEvents['emit'](_0x135699,_0x211862);_0x2ea6c3(null);};}for(var e in events){if(events[_0x0eb3('0x7')](e)){var event=events[e];Team[_0x0eb3('0x8')](e,emitEvent(event));}}module[_0x0eb3('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2935ba5..a6907fc 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 _0x823a=['../../config/logger','moment','bluebird','request-promise','path','./team.attributes','exports','define','teams','util'];(function(_0x3060e3,_0x14f2c6){var _0x497d2c=function(_0x2a274a){while(--_0x2a274a){_0x3060e3['push'](_0x3060e3['shift']());}};_0x497d2c(++_0x14f2c6);}(_0x823a,0x199));var _0xa823=function(_0x5b8a99,_0x2e0c12){_0x5b8a99=_0x5b8a99-0x0;var _0x31fa01=_0x823a[_0x5b8a99];return _0x31fa01;};'use strict';var _=require('lodash');var util=require(_0xa823('0x0'));var logger=require(_0xa823('0x1'))('api');var moment=require(_0xa823('0x2'));var BPromise=require(_0xa823('0x3'));var rp=require(_0xa823('0x4'));var fs=require('fs');var path=require(_0xa823('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa823('0x6'));module[_0xa823('0x7')]=function(_0x528d52,_0x5387ba){return _0x528d52[_0xa823('0x8')]('Team',attributes,{'tableName':_0xa823('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03f2=['define','teams','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x03f2,0x91));var _0x203f=function(_0x392b28,_0x3f796d){_0x392b28=_0x392b28-0x0;var _0x5bf702=_0x03f2[_0x392b28];return _0x5bf702;};'use strict';var _=require(_0x203f('0x0'));var util=require(_0x203f('0x1'));var logger=require('../../config/logger')(_0x203f('0x2'));var moment=require(_0x203f('0x3'));var BPromise=require(_0x203f('0x4'));var rp=require(_0x203f('0x5'));var fs=require('fs');var path=require(_0x203f('0x6'));var rimraf=require(_0x203f('0x7'));var config=require(_0x203f('0x8'));var attributes=require(_0x203f('0x9'));module[_0x203f('0xa')]=function(_0x37a75d,_0x130f9d){return _0x37a75d[_0x203f('0xb')]('Team',attributes,{'tableName':_0x203f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index ec7c470..7a37f37 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 _0xa092=['redis','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0xa092,0x17b));var _0x2a09=function(_0x25292e,_0x44f47f){_0x25292e=_0x25292e-0x0;var _0x48de57=_0xa092[_0x25292e];return _0x48de57;};'use strict';var _=require('lodash');var util=require(_0x2a09('0x0'));var moment=require('moment');var BPromise=require(_0x2a09('0x1'));var rs=require(_0x2a09('0x2'));var fs=require('fs');var Redis=require(_0x2a09('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a09('0x4'));var logger=require('../../config/logger')(_0x2a09('0x5'));var config=require(_0x2a09('0x6'));var jayson=require(_0x2a09('0x7'));var client=jayson[_0x2a09('0x8')][_0x2a09('0x9')]({'port':0x232a});config['redis']=_[_0x2a09('0xa')](config[_0x2a09('0xb')],{'host':_0x2a09('0xc'),'port':0x18eb});var socket=require(_0x2a09('0xd'))(new Redis(config[_0x2a09('0xb')]));require(_0x2a09('0xe'))[_0x2a09('0xf')](socket);function respondWithRpcPromise(_0xc3fde0,_0x16ab72,_0x498f4e){return new BPromise(function(_0x426b6d,_0xcbc194){return client[_0x2a09('0x10')](_0xc3fde0,_0x498f4e)[_0x2a09('0x11')](function(_0x348ce5){logger['info'](_0x2a09('0x12'),_0x16ab72,_0x2a09('0x13'));logger['debug'](_0x2a09('0x14'),_0x16ab72,_0x2a09('0x13'),JSON[_0x2a09('0x15')](_0x348ce5));if(_0x348ce5['error']){if(_0x348ce5['error'][_0x2a09('0x16')]===0x1f4){logger['error'](_0x2a09('0x12'),_0x16ab72,_0x348ce5['error'][_0x2a09('0x17')]);return _0xcbc194(_0x348ce5[_0x2a09('0x18')][_0x2a09('0x17')]);}logger[_0x2a09('0x18')](_0x2a09('0x12'),_0x16ab72,_0x348ce5['error'][_0x2a09('0x17')]);return _0x426b6d(_0x348ce5[_0x2a09('0x18')][_0x2a09('0x17')]);}else{logger[_0x2a09('0x19')]('Team,\x20%s,\x20%s',_0x16ab72,'request\x20sent');_0x426b6d(_0x348ce5['result']['message']);}})['catch'](function(_0xe12e53){logger['error'](_0x2a09('0x12'),_0x16ab72,_0xe12e53);_0xcbc194(_0xe12e53);});});} \ No newline at end of file +var _0x23ca=['message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x19bd89,_0x35f482){var _0x361193=function(_0x231a48){while(--_0x231a48){_0x19bd89['push'](_0x19bd89['shift']());}};_0x361193(++_0x35f482);}(_0x23ca,0x18e));var _0xa23c=function(_0x515540,_0x5d251f){_0x515540=_0x515540-0x0;var _0x38daee=_0x23ca[_0x515540];return _0x38daee;};'use strict';var _=require(_0xa23c('0x0'));var util=require(_0xa23c('0x1'));var moment=require(_0xa23c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa23c('0x3'));var db=require(_0xa23c('0x4'))['db'];var utils=require(_0xa23c('0x5'));var logger=require(_0xa23c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa23c('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xa23c('0x8')]=_[_0xa23c('0x9')](config[_0xa23c('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa23c('0x8')]));require(_0xa23c('0xa'))[_0xa23c('0xb')](socket);function respondWithRpcPromise(_0xfffef7,_0x133ec3,_0x28927b){return new BPromise(function(_0x4fd6a1,_0x36fc51){return client['request'](_0xfffef7,_0x28927b)[_0xa23c('0xc')](function(_0x49f459){logger[_0xa23c('0xd')](_0xa23c('0xe'),_0x133ec3,_0xa23c('0xf'));logger['debug'](_0xa23c('0x10'),_0x133ec3,_0xa23c('0xf'),JSON[_0xa23c('0x11')](_0x49f459));if(_0x49f459['error']){if(_0x49f459[_0xa23c('0x12')][_0xa23c('0x13')]===0x1f4){logger[_0xa23c('0x12')]('Team,\x20%s,\x20%s',_0x133ec3,_0x49f459[_0xa23c('0x12')][_0xa23c('0x14')]);return _0x36fc51(_0x49f459[_0xa23c('0x12')]['message']);}logger[_0xa23c('0x12')](_0xa23c('0xe'),_0x133ec3,_0x49f459[_0xa23c('0x12')][_0xa23c('0x14')]);return _0x4fd6a1(_0x49f459['error']['message']);}else{logger[_0xa23c('0xd')]('Team,\x20%s,\x20%s',_0x133ec3,'request\x20sent');_0x4fd6a1(_0x49f459[_0xa23c('0x15')][_0xa23c('0x14')]);}})['catch'](function(_0x590b95){logger[_0xa23c('0x12')]('Team,\x20%s,\x20%s',_0x133ec3,_0x590b95);_0x36fc51(_0x590b95);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5ede657..7a73ad1 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 _0x93b5=['./team.events','save','emit','length'];(function(_0x4d991c,_0x449566){var _0x306108=function(_0xdc9c0e){while(--_0xdc9c0e){_0x4d991c['push'](_0x4d991c['shift']());}};_0x306108(++_0x449566);}(_0x93b5,0x178));var _0x593b=function(_0xcf6a6e,_0x6c05b1){_0xcf6a6e=_0xcf6a6e-0x0;var _0x1edc19=_0x93b5[_0xcf6a6e];return _0x1edc19;};'use strict';var TeamEvents=require(_0x593b('0x0'));var events=[_0x593b('0x1'),'remove','update'];function createListener(_0x1c4b71,_0x17767f){return function(_0xa86b8f){_0x17767f[_0x593b('0x2')](_0x1c4b71,_0xa86b8f);};}function removeListener(_0x5c97d4,_0x1b5dc9){return function(){TeamEvents['removeListener'](_0x5c97d4,_0x1b5dc9);};}exports['register']=function(_0x30bd3a){for(var _0x40ee1b=0x0,_0x3c2f6a=events[_0x593b('0x3')];_0x40ee1b<_0x3c2f6a;_0x40ee1b++){var _0x1ba963=events[_0x40ee1b];var _0x5dddbc=createListener('team:'+_0x1ba963,_0x30bd3a);TeamEvents['on'](_0x1ba963,_0x5dddbc);}}; \ No newline at end of file +var _0x6487=['team:','./team.events','emit','removeListener','register','length'];(function(_0x47620a,_0x227283){var _0x1f777=function(_0x2b38ef){while(--_0x2b38ef){_0x47620a['push'](_0x47620a['shift']());}};_0x1f777(++_0x227283);}(_0x6487,0x19f));var _0x7648=function(_0x51d3f6,_0x36f36a){_0x51d3f6=_0x51d3f6-0x0;var _0x38b89d=_0x6487[_0x51d3f6];return _0x38b89d;};'use strict';var TeamEvents=require(_0x7648('0x0'));var events=['save','remove','update'];function createListener(_0x322da0,_0x93db45){return function(_0x27fe87){_0x93db45[_0x7648('0x1')](_0x322da0,_0x27fe87);};}function removeListener(_0x4aaff7,_0x21402c){return function(){TeamEvents[_0x7648('0x2')](_0x4aaff7,_0x21402c);};}exports[_0x7648('0x3')]=function(_0xc007d2){for(var _0x4da4a1=0x0,_0x5d6f08=events[_0x7648('0x4')];_0x4da4a1<_0x5d6f08;_0x4da4a1++){var _0x52a6a9=events[_0x4da4a1];var _0x23d012=createListener(_0x7648('0x5')+_0x52a6a9,_0xc007d2);TeamEvents['on'](_0x52a6a9,_0x23d012);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/index.js b/server/api/teamVoicePrefix/index.js index 4c8155d..a5551e2 100644 --- a/server/api/teamVoicePrefix/index.js +++ b/server/api/teamVoicePrefix/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(_0x535072,_0x27d434){var _0x3ff7e9=function(_0x309522){while(--_0x309522){_0x535072['push'](_0x535072['shift']());}};_0x3ff7e9(++_0x27d434);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0xcb91[_0xd9f102];return _0x2652e4;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4e7b6f,_0x377078){var _0x20a5be=function(_0x171161){while(--_0x171161){_0x4e7b6f['push'](_0x4e7b6f['shift']());}};_0x20a5be(++_0x377078);}(_0x70e0,0x17b));var _0x070e=function(_0x149023,_0x817c1a){_0x149023=_0x149023-0x0;var _0x2e4797=_0x70e0[_0x149023];return _0x2e4797;};'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/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 5484e58..675b487 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 _0xeea4=['sequelize','exports','INTEGER'];(function(_0x21306b,_0x57603a){var _0x187d72=function(_0xbff95){while(--_0xbff95){_0x21306b['push'](_0x21306b['shift']());}};_0x187d72(++_0x57603a);}(_0xeea4,0x19e));var _0x4eea=function(_0x45bd9c,_0x4ef5c8){_0x45bd9c=_0x45bd9c-0x0;var _0x17a5dd=_0xeea4[_0x45bd9c];return _0x17a5dd;};'use strict';var Sequelize=require(_0x4eea('0x0'));module[_0x4eea('0x1')]={'TeamId':{'type':Sequelize[_0x4eea('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x4eea('0x2')]}}; \ No newline at end of file +var _0x8192=['INTEGER','sequelize','exports'];(function(_0x90cba6,_0x3c97d3){var _0x500b97=function(_0x2b6263){while(--_0x2b6263){_0x90cba6['push'](_0x90cba6['shift']());}};_0x500b97(++_0x3c97d3);}(_0x8192,0x82));var _0x2819=function(_0x392755,_0x28f06f){_0x392755=_0x392755-0x0;var _0xd2d4a6=_0x8192[_0x392755];return _0xd2d4a6;};'use strict';var Sequelize=require(_0x2819('0x0'));module[_0x2819('0x1')]={'TeamId':{'type':Sequelize[_0x2819('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x2819('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 4d239c6..68d3777 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 _0xfc61=['util','../../config/logger','api','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xfc61,0x78));var _0x1fc6=function(_0x1c4013,_0x2a5ac9){_0x1c4013=_0x1c4013-0x0;var _0x47a12d=_0xfc61[_0x1c4013];return _0x47a12d;};'use strict';var _=require(_0x1fc6('0x0'));var util=require(_0x1fc6('0x1'));var logger=require(_0x1fc6('0x2'))(_0x1fc6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fc6('0x4'));var rimraf=require(_0x1fc6('0x5'));var config=require(_0x1fc6('0x6'));var attributes=require(_0x1fc6('0x7'));module['exports']=function(_0x5b5f8c,_0x2c32ca){return _0x5b5f8c[_0x1fc6('0x8')](_0x1fc6('0x9'),attributes,{'tableName':_0x1fc6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b00=['bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','moment'];(function(_0x563fb6,_0x29c9c2){var _0x4dedd4=function(_0x3d0b61){while(--_0x3d0b61){_0x563fb6['push'](_0x563fb6['shift']());}};_0x4dedd4(++_0x29c9c2);}(_0x9b00,0xcc));var _0x09b0=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x9b00[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x09b0('0x0'));var util=require(_0x09b0('0x1'));var logger=require(_0x09b0('0x2'))('api');var moment=require(_0x09b0('0x3'));var BPromise=require(_0x09b0('0x4'));var rp=require(_0x09b0('0x5'));var fs=require('fs');var path=require(_0x09b0('0x6'));var rimraf=require(_0x09b0('0x7'));var config=require(_0x09b0('0x8'));var attributes=require(_0x09b0('0x9'));module['exports']=function(_0x79bc56,_0x57b9e0){return _0x79bc56[_0x09b0('0xa')](_0x09b0('0xb'),attributes,{'tableName':_0x09b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js index 773f200..38c5633 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a9e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','TeamVoicePrefix,\x20%s,\x20%s','debug','TeamVoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','ioredis'];(function(_0x193215,_0x5acfa0){var _0x223511=function(_0x90213b){while(--_0x90213b){_0x193215['push'](_0x193215['shift']());}};_0x223511(++_0x5acfa0);}(_0x4a9e,0x97));var _0xe4a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a9e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe4a9('0x0'));var BPromise=require(_0xe4a9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4a9('0x2'));var db=require(_0xe4a9('0x3'))['db'];var utils=require(_0xe4a9('0x4'));var logger=require(_0xe4a9('0x5'))(_0xe4a9('0x6'));var config=require(_0xe4a9('0x7'));var jayson=require(_0xe4a9('0x8'));var client=jayson['client'][_0xe4a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33f84f,_0x28e583,_0xc481b){return new BPromise(function(_0x400504,_0x1a39fb){return client[_0xe4a9('0xa')](_0x33f84f,_0xc481b)[_0xe4a9('0xb')](function(_0x491562){logger[_0xe4a9('0xc')](_0xe4a9('0xd'),_0x28e583,'request\x20sent');logger[_0xe4a9('0xe')](_0xe4a9('0xf'),_0x28e583,_0xe4a9('0x10'),JSON[_0xe4a9('0x11')](_0x491562));if(_0x491562[_0xe4a9('0x12')]){if(_0x491562[_0xe4a9('0x12')][_0xe4a9('0x13')]===0x1f4){logger[_0xe4a9('0x12')]('TeamVoicePrefix,\x20%s,\x20%s',_0x28e583,_0x491562[_0xe4a9('0x12')][_0xe4a9('0x14')]);return _0x1a39fb(_0x491562['error']['message']);}logger['error'](_0xe4a9('0xd'),_0x28e583,_0x491562[_0xe4a9('0x12')][_0xe4a9('0x14')]);return _0x400504(_0x491562[_0xe4a9('0x12')][_0xe4a9('0x14')]);}else{logger[_0xe4a9('0xc')](_0xe4a9('0xd'),_0x28e583,'request\x20sent');_0x400504(_0x491562[_0xe4a9('0x15')]['message']);}})['catch'](function(_0x180e1d){logger[_0xe4a9('0x12')](_0xe4a9('0xd'),_0x28e583,_0x180e1d);_0x1a39fb(_0x180e1d);});});} \ No newline at end of file +var _0xc33d=['util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','TeamVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','TeamVoicePrefix,\x20%s,\x20%s','result','catch','lodash'];(function(_0x104651,_0xc9839d){var _0x387659=function(_0x37250b){while(--_0x37250b){_0x104651['push'](_0x104651['shift']());}};_0x387659(++_0xc9839d);}(_0xc33d,0xbf));var _0xdc33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc33d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdc33('0x0'));var util=require(_0xdc33('0x1'));var moment=require(_0xdc33('0x2'));var BPromise=require(_0xdc33('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc33('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc33('0x5'))(_0xdc33('0x6'));var config=require(_0xdc33('0x7'));var jayson=require(_0xdc33('0x8'));var client=jayson[_0xdc33('0x9')][_0xdc33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x590f04,_0x21a01b,_0x156bfe){return new BPromise(function(_0x395ee3,_0x32f363){return client[_0xdc33('0xb')](_0x590f04,_0x156bfe)[_0xdc33('0xc')](function(_0x538685){logger[_0xdc33('0xd')]('TeamVoicePrefix,\x20%s,\x20%s',_0x21a01b,_0xdc33('0xe'));logger[_0xdc33('0xf')](_0xdc33('0x10'),_0x21a01b,'request\x20sent',JSON[_0xdc33('0x11')](_0x538685));if(_0x538685[_0xdc33('0x12')]){if(_0x538685[_0xdc33('0x12')][_0xdc33('0x13')]===0x1f4){logger[_0xdc33('0x12')]('TeamVoicePrefix,\x20%s,\x20%s',_0x21a01b,_0x538685[_0xdc33('0x12')]['message']);return _0x32f363(_0x538685[_0xdc33('0x12')][_0xdc33('0x14')]);}logger[_0xdc33('0x12')](_0xdc33('0x15'),_0x21a01b,_0x538685[_0xdc33('0x12')][_0xdc33('0x14')]);return _0x395ee3(_0x538685[_0xdc33('0x12')]['message']);}else{logger[_0xdc33('0xd')](_0xdc33('0x15'),_0x21a01b,_0xdc33('0xe'));_0x395ee3(_0x538685[_0xdc33('0x16')][_0xdc33('0x14')]);}})[_0xdc33('0x17')](function(_0x3e8b09){logger['error'](_0xdc33('0x15'),_0x21a01b,_0x3e8b09);_0x32f363(_0x3e8b09);});});} \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index ea603dd..59f2cf9 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x38d883,_0x3be1ae){var _0x5e1601=function(_0x54e09b){while(--_0x54e09b){_0x38d883['push'](_0x38d883['shift']());}};_0x5e1601(++_0x3be1ae);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x30121e,_0x240c86){var _0x4ba328=function(_0x2601c1){while(--_0x2601c1){_0x30121e['push'](_0x30121e['shift']());}};_0x4ba328(++_0x240c86);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 694ed80..9138573 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 _0x687d=['sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x687d,0x194));var _0xd687=function(_0x5ecbe8,_0x42522f){_0x5ecbe8=_0x5ecbe8-0x0;var _0x1c6e21=_0x687d[_0x5ecbe8];return _0x1c6e21;};'use strict';var Sequelize=require(_0xd687('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd687('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa249=['exports','INTEGER','sequelize'];(function(_0x2b2858,_0x4c68d6){var _0x5f28a5=function(_0x47ccb7){while(--_0x47ccb7){_0x2b2858['push'](_0x2b2858['shift']());}};_0x5f28a5(++_0x4c68d6);}(_0xa249,0x1ee));var _0x9a24=function(_0x93792,_0x1ffdfa){_0x93792=_0x93792-0x0;var _0x88947c=_0xa249[_0x93792];return _0x88947c;};'use strict';var Sequelize=require(_0x9a24('0x0'));module[_0x9a24('0x1')]={'penalty':{'type':Sequelize[_0x9a24('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 b62e1d7..d461a55 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 _0x5af0=['moment','bluebird','request-promise','path','../../config/environment','exports','TeamVoiceQueue','lodash','util','../../config/logger','api'];(function(_0x29956a,_0x5923a0){var _0x527998=function(_0x17b512){while(--_0x17b512){_0x29956a['push'](_0x29956a['shift']());}};_0x527998(++_0x5923a0);}(_0x5af0,0x1eb));var _0x05af=function(_0x1e6964,_0x2c1736){_0x1e6964=_0x1e6964-0x0;var _0x1a7fed=_0x5af0[_0x1e6964];return _0x1a7fed;};'use strict';var _=require(_0x05af('0x0'));var util=require(_0x05af('0x1'));var logger=require(_0x05af('0x2'))(_0x05af('0x3'));var moment=require(_0x05af('0x4'));var BPromise=require(_0x05af('0x5'));var rp=require(_0x05af('0x6'));var fs=require('fs');var path=require(_0x05af('0x7'));var rimraf=require('rimraf');var config=require(_0x05af('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0x05af('0x9')]=function(_0x27a3e2,_0x2a8ef6){return _0x27a3e2['define'](_0x05af('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41f2=['rimraf','../../config/environment','exports','define','TeamVoiceQueue','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1736d9,_0xf977a7){var _0x4a09cb=function(_0x5c92af){while(--_0x5c92af){_0x1736d9['push'](_0x1736d9['shift']());}};_0x4a09cb(++_0xf977a7);}(_0x41f2,0x14f));var _0x241f=function(_0x46ef39,_0x47bd61){_0x46ef39=_0x46ef39-0x0;var _0x1225d9=_0x41f2[_0x46ef39];return _0x1225d9;};'use strict';var _=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var logger=require('../../config/logger')(_0x241f('0x2'));var moment=require(_0x241f('0x3'));var BPromise=require(_0x241f('0x4'));var rp=require(_0x241f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x241f('0x6'));var config=require(_0x241f('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0x241f('0x8')]=function(_0x2e8e9f,_0x253edb){return _0x2e8e9f[_0x241f('0x9')](_0x241f('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 7f11b65..d9d6f62 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 _0xb549=['request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xb549,0x164));var _0x9b54=function(_0x13a43c,_0x3d2385){_0x13a43c=_0x13a43c-0x0;var _0x3f3b30=_0xb549[_0x13a43c];return _0x3f3b30;};'use strict';var _=require(_0x9b54('0x0'));var util=require(_0x9b54('0x1'));var moment=require(_0x9b54('0x2'));var BPromise=require(_0x9b54('0x3'));var rs=require(_0x9b54('0x4'));var fs=require('fs');var Redis=require(_0x9b54('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b54('0x6'));var logger=require(_0x9b54('0x7'))(_0x9b54('0x8'));var config=require(_0x9b54('0x9'));var jayson=require(_0x9b54('0xa'));var client=jayson[_0x9b54('0xb')][_0x9b54('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ca4a1,_0xad9f5d,_0x277695){return new BPromise(function(_0x13bcfd,_0x1d1723){return client[_0x9b54('0xd')](_0x1ca4a1,_0x277695)[_0x9b54('0xe')](function(_0x470578){logger[_0x9b54('0xf')](_0x9b54('0x10'),_0xad9f5d,'request\x20sent');logger[_0x9b54('0x11')](_0x9b54('0x12'),_0xad9f5d,_0x9b54('0x13'),JSON[_0x9b54('0x14')](_0x470578));if(_0x470578[_0x9b54('0x15')]){if(_0x470578[_0x9b54('0x15')]['code']===0x1f4){logger['error'](_0x9b54('0x10'),_0xad9f5d,_0x470578[_0x9b54('0x15')][_0x9b54('0x16')]);return _0x1d1723(_0x470578[_0x9b54('0x15')]['message']);}logger[_0x9b54('0x15')]('TeamVoiceQueue,\x20%s,\x20%s',_0xad9f5d,_0x470578['error'][_0x9b54('0x16')]);return _0x13bcfd(_0x470578['error'][_0x9b54('0x16')]);}else{logger[_0x9b54('0xf')](_0x9b54('0x10'),_0xad9f5d,_0x9b54('0x13'));_0x13bcfd(_0x470578[_0x9b54('0x17')][_0x9b54('0x16')]);}})[_0x9b54('0x18')](function(_0x217b44){logger[_0x9b54('0x15')]('TeamVoiceQueue,\x20%s,\x20%s',_0xad9f5d,_0x217b44);_0x1d1723(_0x217b44);});});} \ No newline at end of file +var _0xa27b=['moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch'];(function(_0x17c1f1,_0x3e4549){var _0x5a286a=function(_0x149dbf){while(--_0x149dbf){_0x17c1f1['push'](_0x17c1f1['shift']());}};_0x5a286a(++_0x3e4549);}(_0xa27b,0x1b5));var _0xba27=function(_0x1dd888,_0x4811cf){_0x1dd888=_0x1dd888-0x0;var _0x48cb2c=_0xa27b[_0x1dd888];return _0x48cb2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xba27('0x0'));var BPromise=require('bluebird');var rs=require(_0xba27('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba27('0x2'))['db'];var utils=require(_0xba27('0x3'));var logger=require('../../config/logger')(_0xba27('0x4'));var config=require('../../config/environment');var jayson=require(_0xba27('0x5'));var client=jayson[_0xba27('0x6')][_0xba27('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c92f0,_0x426c10,_0x2e9f8c){return new BPromise(function(_0xb61079,_0x410dda){return client[_0xba27('0x8')](_0x2c92f0,_0x2e9f8c)[_0xba27('0x9')](function(_0x5b36d4){logger[_0xba27('0xa')](_0xba27('0xb'),_0x426c10,'request\x20sent');logger[_0xba27('0xc')](_0xba27('0xd'),_0x426c10,'request\x20sent',JSON['stringify'](_0x5b36d4));if(_0x5b36d4[_0xba27('0xe')]){if(_0x5b36d4[_0xba27('0xe')][_0xba27('0xf')]===0x1f4){logger[_0xba27('0xe')](_0xba27('0xb'),_0x426c10,_0x5b36d4[_0xba27('0xe')]['message']);return _0x410dda(_0x5b36d4[_0xba27('0xe')][_0xba27('0x10')]);}logger[_0xba27('0xe')](_0xba27('0xb'),_0x426c10,_0x5b36d4[_0xba27('0xe')][_0xba27('0x10')]);return _0xb61079(_0x5b36d4[_0xba27('0xe')][_0xba27('0x10')]);}else{logger[_0xba27('0xa')](_0xba27('0xb'),_0x426c10,_0xba27('0x11'));_0xb61079(_0x5b36d4['result'][_0xba27('0x10')]);}})[_0xba27('0x12')](function(_0x2c4c61){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x426c10,_0x2c4c61);_0x410dda(_0x2c4c61);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 67a6d69..8f83a4b 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 _0x4201=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post'];(function(_0x344367,_0x1b663a){var _0x38e51f=function(_0x4370a1){while(--_0x4370a1){_0x344367['push'](_0x344367['shift']());}};_0x38e51f(++_0x1b663a);}(_0x4201,0x71));var _0x1420=function(_0x24b852,_0x2bad67){_0x24b852=_0x24b852-0x0;var _0x180ad2=_0x4201[_0x24b852];return _0x180ad2;};'use strict';var multer=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var path=require('path');var timeout=require(_0x1420('0x2'));var express=require(_0x1420('0x3'));var router=express[_0x1420('0x4')]();var fs_extra=require(_0x1420('0x5'));var auth=require(_0x1420('0x6'));var interaction=require(_0x1420('0x7'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x1420('0x8')]('/',auth[_0x1420('0x9')](),controller[_0x1420('0xa')]);router[_0x1420('0x8')](_0x1420('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1420('0xc')]('/',auth[_0x1420('0x9')](),controller['create']);router[_0x1420('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x1420('0xe')]);router[_0x1420('0xf')]('/:id',auth[_0x1420('0x9')](),controller[_0x1420('0x10')]);module[_0x1420('0x11')]=router; \ No newline at end of file +var _0x9bd9=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./template.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports'];(function(_0x6e078b,_0x120566){var _0x5e3126=function(_0x2f6a0c){while(--_0x2f6a0c){_0x6e078b['push'](_0x6e078b['shift']());}};_0x5e3126(++_0x120566);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x35f5a5,_0x3f8a65){_0x35f5a5=_0x35f5a5-0x0;var _0x143dce=_0x9bd9[_0x35f5a5];return _0x143dce;};'use strict';var multer=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var path=require(_0x99bd('0x2'));var timeout=require(_0x99bd('0x3'));var express=require(_0x99bd('0x4'));var router=express[_0x99bd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x99bd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99bd('0x7'));var controller=require(_0x99bd('0x8'));router['get']('/',auth[_0x99bd('0x9')](),controller[_0x99bd('0xa')]);router[_0x99bd('0xb')](_0x99bd('0xc'),auth[_0x99bd('0x9')](),controller[_0x99bd('0xd')]);router[_0x99bd('0xe')]('/',auth[_0x99bd('0x9')](),controller[_0x99bd('0xf')]);router[_0x99bd('0x10')](_0x99bd('0xc'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x11')]);router[_0x99bd('0x12')]('/:id',auth[_0x99bd('0x9')](),controller['destroy']);module[_0x99bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 26f1a14..5e7fcf1 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 _0xf20f=['TEXT','sequelize','exports','STRING'];(function(_0x2c6ae0,_0x3405eb){var _0x4c7c51=function(_0x249e22){while(--_0x249e22){_0x2c6ae0['push'](_0x2c6ae0['shift']());}};_0x4c7c51(++_0x3405eb);}(_0xf20f,0x89));var _0xff20=function(_0x27bc24,_0x1753b1){_0x27bc24=_0x27bc24-0x0;var _0x282e1d=_0xf20f[_0x27bc24];return _0x282e1d;};'use strict';var Sequelize=require(_0xff20('0x0'));module[_0xff20('0x1')]={'name':{'type':Sequelize[_0xff20('0x2')]},'description':{'type':Sequelize[_0xff20('0x2')]},'html':{'type':Sequelize[_0xff20('0x3')]}}; \ No newline at end of file +var _0xa612=['TEXT','STRING'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0xa612,0x1b5));var _0x2a61=function(_0x89ff89,_0x237c50){_0x89ff89=_0x89ff89-0x0;var _0x2a2750=_0xa612[_0x89ff89];return _0x2a2750;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2a61('0x0')]},'description':{'type':Sequelize[_0x2a61('0x0')]},'html':{'type':Sequelize[_0x2a61('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 99cb700..0324949 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 _0xe92e=['bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','UserProfileResource','error','stack','name','map','Template','fieldName','key','query','filters','intersection','attributes','model','fields','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','params','keys','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0xe92e,0x136));var _0xee92=function(_0x4a53f1,_0x7b3736){_0x4a53f1=_0x4a53f1-0x0;var _0x1dd005=_0xe92e[_0x4a53f1];return _0x1dd005;};'use strict';var emlformat=require(_0xee92('0x0'));var rimraf=require(_0xee92('0x1'));var zipdir=require(_0xee92('0x2'));var jsonpatch=require(_0xee92('0x3'));var rp=require(_0xee92('0x4'));var moment=require(_0xee92('0x5'));var BPromise=require(_0xee92('0x6'));var Mustache=require('mustache');var util=require(_0xee92('0x7'));var path=require(_0xee92('0x8'));var sox=require(_0xee92('0x9'));var csv=require('to-csv');var ejs=require(_0xee92('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee92('0xb'));var squel=require(_0xee92('0xc'));var crypto=require(_0xee92('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xee92('0xe'));var querystring=require(_0xee92('0xf'));var Papa=require(_0xee92('0x10'));var Redis=require(_0xee92('0x11'));var authService=require(_0xee92('0x12'));var qs=require(_0xee92('0x13'));var as=require(_0xee92('0x14'));var hardwareService=require(_0xee92('0x15'));var logger=require(_0xee92('0x16'))('api');var utils=require(_0xee92('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xee92('0x18'));var db=require(_0xee92('0x19'))['db'];function respondWithStatusCode(_0x41cb86,_0x4d09e8){_0x4d09e8=_0x4d09e8||0xcc;return function(_0x7c6883){if(_0x7c6883){return _0x41cb86[_0xee92('0x1a')](_0x4d09e8);}return _0x41cb86['status'](_0x4d09e8)[_0xee92('0x1b')]();};}function respondWithResult(_0xd79352,_0x3daedc){_0x3daedc=_0x3daedc||0xc8;return function(_0x40e1ff){if(_0x40e1ff){return _0xd79352[_0xee92('0x1c')](_0x3daedc)[_0xee92('0x1d')](_0x40e1ff);}};}function respondWithFilteredResult(_0x10014d,_0x406e98){return function(_0x1a53a4){if(_0x1a53a4){var _0x247c41=typeof _0x406e98[_0xee92('0x1e')]===_0xee92('0x1f')&&typeof _0x406e98[_0xee92('0x20')]===_0xee92('0x1f');var _0x376a88=_0x1a53a4['count'];var _0x7ff52b=_0x247c41?0x0:_0x406e98[_0xee92('0x1e')];var _0x8080cf=_0x247c41?_0x1a53a4[_0xee92('0x21')]:_0x406e98[_0xee92('0x1e')]+_0x406e98['limit'];var _0x3f121a;if(_0x8080cf>=_0x376a88){_0x8080cf=_0x376a88;_0x3f121a=0xc8;}else{_0x3f121a=0xce;}_0x10014d[_0xee92('0x1c')](_0x3f121a);return _0x10014d[_0xee92('0x22')](_0xee92('0x23'),_0x7ff52b+'-'+_0x8080cf+'/'+_0x376a88)['json'](_0x1a53a4);}return null;};}function patchUpdates(_0x3bcc50){return function(_0x459d73){try{jsonpatch['apply'](_0x459d73,_0x3bcc50,!![]);}catch(_0x57d4b1){return BPromise['reject'](_0x57d4b1);}return _0x459d73['save']();};}function saveUpdates(_0x597ef3,_0x29b4ff){return function(_0x851ef7){if(_0x851ef7){return _0x851ef7['update'](_0x597ef3)[_0xee92('0x24')](function(_0x200ccc){return _0x200ccc;});}return null;};}function removeEntity(_0x3e8ac1,_0x128ce2){return function(_0x34daf6){if(_0x34daf6){return _0x34daf6[_0xee92('0x25')]()[_0xee92('0x24')](function(){var _0x500d2f=_0x34daf6[_0xee92('0x26')]({'plain':!![]});var _0x1c39f6='Templates';return db[_0xee92('0x27')][_0xee92('0x25')]({'where':{'type':_0x1c39f6,'resourceId':_0x500d2f['id']}})[_0xee92('0x24')](function(){return _0x34daf6;});})['then'](function(){_0x3e8ac1['status'](0xcc)[_0xee92('0x1b')]();});}};}function handleEntityNotFound(_0xd71c4b,_0x19a2f1){return function(_0x294df5){if(!_0x294df5){_0xd71c4b['sendStatus'](0x194);}return _0x294df5;};}function handleError(_0x51ddfa,_0x174919){_0x174919=_0x174919||0x1f4;return function(_0x81ba){logger[_0xee92('0x28')](_0x81ba[_0xee92('0x29')]);if(_0x81ba[_0xee92('0x2a')]){delete _0x81ba[_0xee92('0x2a')];}_0x51ddfa['status'](_0x174919)['send'](_0x81ba);};}exports['index']=function(_0x3daa25,_0x3ceffc){var _0x2d5ed9={},_0xc662cb={},_0x460ad7={'count':0x0,'rows':[]};var _0x47b3fe=_[_0xee92('0x2b')](db[_0xee92('0x2c')]['rawAttributes'],function(_0x511c55){return{'name':_0x511c55[_0xee92('0x2d')],'type':_0x511c55['type'][_0xee92('0x2e')]};});_0xc662cb['model']=_[_0xee92('0x2b')](_0x47b3fe,_0xee92('0x2a'));_0xc662cb[_0xee92('0x2f')]=_['keys'](_0x3daa25['query']);_0xc662cb[_0xee92('0x30')]=_[_0xee92('0x31')](_0xc662cb['model'],_0xc662cb['query']);_0x2d5ed9[_0xee92('0x32')]=_['intersection'](_0xc662cb[_0xee92('0x33')],qs[_0xee92('0x34')](_0x3daa25['query'][_0xee92('0x34')]));_0x2d5ed9['attributes']=_0x2d5ed9[_0xee92('0x32')]['length']?_0x2d5ed9[_0xee92('0x32')]:_0xc662cb[_0xee92('0x33')];if(!_0x3daa25[_0xee92('0x2f')]['hasOwnProperty'](_0xee92('0x35'))){_0x2d5ed9['limit']=qs[_0xee92('0x20')](_0x3daa25[_0xee92('0x2f')][_0xee92('0x20')]);_0x2d5ed9[_0xee92('0x1e')]=qs[_0xee92('0x1e')](_0x3daa25[_0xee92('0x2f')][_0xee92('0x1e')]);}_0x2d5ed9['order']=qs[_0xee92('0x36')](_0x3daa25[_0xee92('0x2f')][_0xee92('0x36')]);_0x2d5ed9[_0xee92('0x37')]=qs['filters'](_[_0xee92('0x38')](_0x3daa25['query'],_0xc662cb[_0xee92('0x30')]),_0x47b3fe);if(_0x3daa25[_0xee92('0x2f')][_0xee92('0x39')]){_0x2d5ed9[_0xee92('0x37')]=_[_0xee92('0x3a')](_0x2d5ed9[_0xee92('0x37')],{'$or':_['map'](_0x47b3fe,function(_0x214c54){if(_0x214c54[_0xee92('0x3b')]!==_0xee92('0x3c')){var _0x9d8bc7={};_0x9d8bc7[_0x214c54['name']]={'$like':'%'+_0x3daa25[_0xee92('0x2f')][_0xee92('0x39')]+'%'};return _0x9d8bc7;}})});}_0x2d5ed9=_[_0xee92('0x3a')]({},_0x2d5ed9,_0x3daa25[_0xee92('0x3d')]);var _0x4ba493={'where':_0x2d5ed9[_0xee92('0x37')]};return db[_0xee92('0x2c')]['count'](_0x4ba493)[_0xee92('0x24')](function(_0xa67ad1){_0x460ad7[_0xee92('0x21')]=_0xa67ad1;if(_0x3daa25['query'][_0xee92('0x3e')]){_0x2d5ed9['include']=[{'all':!![]}];}return db[_0xee92('0x2c')][_0xee92('0x3f')](_0x2d5ed9);})['then'](function(_0x4b42f5){_0x460ad7['rows']=_0x4b42f5;return _0x460ad7;})[_0xee92('0x24')](respondWithFilteredResult(_0x3ceffc,_0x2d5ed9))['catch'](handleError(_0x3ceffc,null));};exports[_0xee92('0x40')]=function(_0x44d62a,_0x1ae44f){var _0x393c01={'raw':!![],'where':{'id':_0x44d62a[_0xee92('0x41')]['id']}},_0x5bacf5={};_0x5bacf5[_0xee92('0x33')]=_[_0xee92('0x42')](db[_0xee92('0x2c')]['rawAttributes']);_0x5bacf5[_0xee92('0x2f')]=_[_0xee92('0x42')](_0x44d62a[_0xee92('0x2f')]);_0x5bacf5[_0xee92('0x30')]=_[_0xee92('0x31')](_0x5bacf5[_0xee92('0x33')],_0x5bacf5[_0xee92('0x2f')]);_0x393c01['attributes']=_[_0xee92('0x31')](_0x5bacf5[_0xee92('0x33')],qs['fields'](_0x44d62a['query']['fields']));_0x393c01[_0xee92('0x32')]=_0x393c01[_0xee92('0x32')][_0xee92('0x43')]?_0x393c01['attributes']:_0x5bacf5[_0xee92('0x33')];if(_0x44d62a['query']['includeAll']){_0x393c01[_0xee92('0x44')]=[{'all':!![]}];}_0x393c01=_[_0xee92('0x3a')]({},_0x393c01,_0x44d62a['options']);return db[_0xee92('0x2c')][_0xee92('0x45')](_0x393c01)[_0xee92('0x24')](handleEntityNotFound(_0x1ae44f,null))['then'](respondWithResult(_0x1ae44f,null))[_0xee92('0x46')](handleError(_0x1ae44f,null));};exports[_0xee92('0x47')]=function(_0x150836,_0x256d0e){return db['Template'][_0xee92('0x47')](_0x150836[_0xee92('0x48')],{})['then'](function(_0x54b359){var _0x5376f9=_0x150836[_0xee92('0x49')][_0xee92('0x26')]({'plain':!![]});if(!_0x5376f9)throw new Error(_0xee92('0x4a'));if(_0x5376f9[_0xee92('0x4b')]==='user'){var _0x2985d0=_0x54b359[_0xee92('0x26')]({'plain':!![]});var _0x49d3fd=_0xee92('0x4c');return db[_0xee92('0x4d')][_0xee92('0x45')]({'where':{'name':_0x49d3fd,'userProfileId':_0x5376f9['userProfileId']},'raw':!![]})[_0xee92('0x24')](function(_0xb886af){if(_0xb886af&&_0xb886af[_0xee92('0x4e')]===0x0){return db['UserProfileResource'][_0xee92('0x47')]({'name':_0x2985d0[_0xee92('0x2a')],'resourceId':_0x2985d0['id'],'type':_0xb886af[_0xee92('0x2a')],'sectionId':_0xb886af['id']},{})[_0xee92('0x24')](function(){return _0x54b359;});}else{return _0x54b359;}})[_0xee92('0x46')](function(_0x55c164){logger[_0xee92('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55c164);throw _0x55c164;});}return _0x54b359;})[_0xee92('0x24')](respondWithResult(_0x256d0e,0xc9))[_0xee92('0x46')](handleError(_0x256d0e,null));};exports['update']=function(_0x4a668e,_0x17003a){if(_0x4a668e['body']['id']){delete _0x4a668e[_0xee92('0x48')]['id'];}return db['Template'][_0xee92('0x45')]({'where':{'id':_0x4a668e[_0xee92('0x41')]['id']}})[_0xee92('0x24')](handleEntityNotFound(_0x17003a,null))[_0xee92('0x24')](saveUpdates(_0x4a668e[_0xee92('0x48')],null))[_0xee92('0x24')](respondWithResult(_0x17003a,null))[_0xee92('0x46')](handleError(_0x17003a,null));};exports[_0xee92('0x25')]=function(_0x28bf1a,_0xb1d085){return db[_0xee92('0x2c')][_0xee92('0x45')]({'where':{'id':_0x28bf1a[_0xee92('0x41')]['id']}})[_0xee92('0x24')](handleEntityNotFound(_0xb1d085,null))['then'](removeEntity(_0xb1d085,null))['catch'](handleError(_0xb1d085,null));}; \ No newline at end of file +var _0xe842=['catch','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','get','Templates','UserProfileResource','sendStatus','error','name','send','index','map','Template','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','options','findAll','rows'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xe842,0xa8));var _0x2e84=function(_0x151762,_0x17691f){_0x151762=_0x151762-0x0;var _0x27f596=_0xe842[_0x151762];return _0x27f596;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e84('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e84('0x1'));var rp=require(_0x2e84('0x2'));var moment=require(_0x2e84('0x3'));var BPromise=require(_0x2e84('0x4'));var Mustache=require(_0x2e84('0x5'));var util=require(_0x2e84('0x6'));var path=require(_0x2e84('0x7'));var sox=require(_0x2e84('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e84('0x9'));var _=require('lodash');var squel=require(_0x2e84('0xa'));var crypto=require(_0x2e84('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2e84('0xc'));var toCsv=require(_0x2e84('0xd'));var querystring=require(_0x2e84('0xe'));var Papa=require(_0x2e84('0xf'));var Redis=require('ioredis');var authService=require(_0x2e84('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2e84('0x11'));var hardwareService=require(_0x2e84('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2e84('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb88c3b,_0x1bc36c){_0x1bc36c=_0x1bc36c||0xcc;return function(_0x492eab){if(_0x492eab){return _0xb88c3b['sendStatus'](_0x1bc36c);}return _0xb88c3b[_0x2e84('0x14')](_0x1bc36c)[_0x2e84('0x15')]();};}function respondWithResult(_0x339ac6,_0x5145b2){_0x5145b2=_0x5145b2||0xc8;return function(_0x3ef923){if(_0x3ef923){return _0x339ac6[_0x2e84('0x14')](_0x5145b2)['json'](_0x3ef923);}};}function respondWithFilteredResult(_0x52e439,_0x1af3f6){return function(_0x30222a){if(_0x30222a){var _0x57f031=typeof _0x1af3f6['offset']===_0x2e84('0x16')&&typeof _0x1af3f6[_0x2e84('0x17')]===_0x2e84('0x16');var _0xc36f7d=_0x30222a[_0x2e84('0x18')];var _0x529468=_0x57f031?0x0:_0x1af3f6[_0x2e84('0x19')];var _0x2ddaf8=_0x57f031?_0x30222a['count']:_0x1af3f6[_0x2e84('0x19')]+_0x1af3f6[_0x2e84('0x17')];var _0x387b1c;if(_0x2ddaf8>=_0xc36f7d){_0x2ddaf8=_0xc36f7d;_0x387b1c=0xc8;}else{_0x387b1c=0xce;}_0x52e439[_0x2e84('0x14')](_0x387b1c);return _0x52e439[_0x2e84('0x1a')]('Content-Range',_0x529468+'-'+_0x2ddaf8+'/'+_0xc36f7d)[_0x2e84('0x1b')](_0x30222a);}return null;};}function patchUpdates(_0x515a54){return function(_0x3640d6){try{jsonpatch[_0x2e84('0x1c')](_0x3640d6,_0x515a54,!![]);}catch(_0x3f65ba){return BPromise[_0x2e84('0x1d')](_0x3f65ba);}return _0x3640d6[_0x2e84('0x1e')]();};}function saveUpdates(_0x1eec60,_0x1ae167){return function(_0x41e79e){if(_0x41e79e){return _0x41e79e[_0x2e84('0x1f')](_0x1eec60)[_0x2e84('0x20')](function(_0x53b03c){return _0x53b03c;});}return null;};}function removeEntity(_0x4bd9a1,_0x55fa18){return function(_0x26dbb1){if(_0x26dbb1){return _0x26dbb1['destroy']()[_0x2e84('0x20')](function(){var _0x325400=_0x26dbb1[_0x2e84('0x21')]({'plain':!![]});var _0x559499=_0x2e84('0x22');return db[_0x2e84('0x23')]['destroy']({'where':{'type':_0x559499,'resourceId':_0x325400['id']}})[_0x2e84('0x20')](function(){return _0x26dbb1;});})[_0x2e84('0x20')](function(){_0x4bd9a1[_0x2e84('0x14')](0xcc)[_0x2e84('0x15')]();});}};}function handleEntityNotFound(_0x572246,_0x5c72f9){return function(_0x31cd4b){if(!_0x31cd4b){_0x572246[_0x2e84('0x24')](0x194);}return _0x31cd4b;};}function handleError(_0x2e2f73,_0x449cc0){_0x449cc0=_0x449cc0||0x1f4;return function(_0x1cd4cc){logger[_0x2e84('0x25')](_0x1cd4cc['stack']);if(_0x1cd4cc[_0x2e84('0x26')]){delete _0x1cd4cc[_0x2e84('0x26')];}_0x2e2f73[_0x2e84('0x14')](_0x449cc0)[_0x2e84('0x27')](_0x1cd4cc);};}exports[_0x2e84('0x28')]=function(_0x4b6c55,_0x52feca){var _0x5a3448={},_0x5e70c0={},_0x53c0b2={'count':0x0,'rows':[]};var _0x5e9cab=_[_0x2e84('0x29')](db[_0x2e84('0x2a')]['rawAttributes'],function(_0x1635ab){return{'name':_0x1635ab[_0x2e84('0x2b')],'type':_0x1635ab[_0x2e84('0x2c')][_0x2e84('0x2d')]};});_0x5e70c0[_0x2e84('0x2e')]=_[_0x2e84('0x29')](_0x5e9cab,_0x2e84('0x26'));_0x5e70c0[_0x2e84('0x2f')]=_[_0x2e84('0x30')](_0x4b6c55[_0x2e84('0x2f')]);_0x5e70c0[_0x2e84('0x31')]=_[_0x2e84('0x32')](_0x5e70c0[_0x2e84('0x2e')],_0x5e70c0[_0x2e84('0x2f')]);_0x5a3448[_0x2e84('0x33')]=_[_0x2e84('0x32')](_0x5e70c0[_0x2e84('0x2e')],qs['fields'](_0x4b6c55[_0x2e84('0x2f')][_0x2e84('0x34')]));_0x5a3448[_0x2e84('0x33')]=_0x5a3448['attributes'][_0x2e84('0x35')]?_0x5a3448['attributes']:_0x5e70c0[_0x2e84('0x2e')];if(!_0x4b6c55['query']['hasOwnProperty'](_0x2e84('0x36'))){_0x5a3448[_0x2e84('0x17')]=qs[_0x2e84('0x17')](_0x4b6c55[_0x2e84('0x2f')]['limit']);_0x5a3448['offset']=qs[_0x2e84('0x19')](_0x4b6c55[_0x2e84('0x2f')][_0x2e84('0x19')]);}_0x5a3448[_0x2e84('0x37')]=qs['sort'](_0x4b6c55[_0x2e84('0x2f')][_0x2e84('0x38')]);_0x5a3448[_0x2e84('0x39')]=qs['filters'](_[_0x2e84('0x3a')](_0x4b6c55['query'],_0x5e70c0['filters']),_0x5e9cab);if(_0x4b6c55['query']['filter']){_0x5a3448[_0x2e84('0x39')]=_[_0x2e84('0x3b')](_0x5a3448[_0x2e84('0x39')],{'$or':_['map'](_0x5e9cab,function(_0x42eb38){if(_0x42eb38[_0x2e84('0x2c')]!=='VIRTUAL'){var _0x38912f={};_0x38912f[_0x42eb38[_0x2e84('0x26')]]={'$like':'%'+_0x4b6c55[_0x2e84('0x2f')]['filter']+'%'};return _0x38912f;}})});}_0x5a3448=_[_0x2e84('0x3b')]({},_0x5a3448,_0x4b6c55[_0x2e84('0x3c')]);var _0x3293f6={'where':_0x5a3448['where']};return db[_0x2e84('0x2a')]['count'](_0x3293f6)['then'](function(_0x1fbc76){_0x53c0b2['count']=_0x1fbc76;if(_0x4b6c55[_0x2e84('0x2f')]['includeAll']){_0x5a3448['include']=[{'all':!![]}];}return db[_0x2e84('0x2a')][_0x2e84('0x3d')](_0x5a3448);})['then'](function(_0x35e35c){_0x53c0b2[_0x2e84('0x3e')]=_0x35e35c;return _0x53c0b2;})['then'](respondWithFilteredResult(_0x52feca,_0x5a3448))[_0x2e84('0x3f')](handleError(_0x52feca,null));};exports['show']=function(_0x26d2c1,_0x1c67d8){var _0x2bb5b2={'raw':!![],'where':{'id':_0x26d2c1[_0x2e84('0x40')]['id']}},_0x484c0d={};_0x484c0d[_0x2e84('0x2e')]=_['keys'](db[_0x2e84('0x2a')][_0x2e84('0x41')]);_0x484c0d[_0x2e84('0x2f')]=_[_0x2e84('0x30')](_0x26d2c1[_0x2e84('0x2f')]);_0x484c0d[_0x2e84('0x31')]=_[_0x2e84('0x32')](_0x484c0d[_0x2e84('0x2e')],_0x484c0d[_0x2e84('0x2f')]);_0x2bb5b2['attributes']=_[_0x2e84('0x32')](_0x484c0d[_0x2e84('0x2e')],qs[_0x2e84('0x34')](_0x26d2c1[_0x2e84('0x2f')][_0x2e84('0x34')]));_0x2bb5b2['attributes']=_0x2bb5b2[_0x2e84('0x33')][_0x2e84('0x35')]?_0x2bb5b2[_0x2e84('0x33')]:_0x484c0d[_0x2e84('0x2e')];if(_0x26d2c1[_0x2e84('0x2f')][_0x2e84('0x42')]){_0x2bb5b2[_0x2e84('0x43')]=[{'all':!![]}];}_0x2bb5b2=_['merge']({},_0x2bb5b2,_0x26d2c1[_0x2e84('0x3c')]);return db['Template'][_0x2e84('0x44')](_0x2bb5b2)[_0x2e84('0x20')](handleEntityNotFound(_0x1c67d8,null))[_0x2e84('0x20')](respondWithResult(_0x1c67d8,null))['catch'](handleError(_0x1c67d8,null));};exports[_0x2e84('0x45')]=function(_0x1d075a,_0x3f3355){return db[_0x2e84('0x2a')][_0x2e84('0x45')](_0x1d075a[_0x2e84('0x46')],{})[_0x2e84('0x20')](function(_0x17cd57){var _0x570377=_0x1d075a[_0x2e84('0x47')]['get']({'plain':!![]});if(!_0x570377)throw new Error(_0x2e84('0x48'));if(_0x570377['role']===_0x2e84('0x47')){var _0x80e6ad=_0x17cd57[_0x2e84('0x21')]({'plain':!![]});var _0x253efa=_0x2e84('0x22');return db[_0x2e84('0x49')]['find']({'where':{'name':_0x253efa,'userProfileId':_0x570377['userProfileId']},'raw':!![]})['then'](function(_0x4815f0){if(_0x4815f0&&_0x4815f0[_0x2e84('0x4a')]===0x0){return db[_0x2e84('0x23')]['create']({'name':_0x80e6ad[_0x2e84('0x26')],'resourceId':_0x80e6ad['id'],'type':_0x4815f0[_0x2e84('0x26')],'sectionId':_0x4815f0['id']},{})['then'](function(){return _0x17cd57;});}else{return _0x17cd57;}})[_0x2e84('0x3f')](function(_0x4963fb){logger['error'](_0x2e84('0x4b'),_0x4963fb);throw _0x4963fb;});}return _0x17cd57;})['then'](respondWithResult(_0x3f3355,0xc9))[_0x2e84('0x3f')](handleError(_0x3f3355,null));};exports[_0x2e84('0x1f')]=function(_0x175055,_0x4b078d){if(_0x175055['body']['id']){delete _0x175055['body']['id'];}return db[_0x2e84('0x2a')][_0x2e84('0x44')]({'where':{'id':_0x175055[_0x2e84('0x40')]['id']}})[_0x2e84('0x20')](handleEntityNotFound(_0x4b078d,null))[_0x2e84('0x20')](saveUpdates(_0x175055[_0x2e84('0x46')],null))['then'](respondWithResult(_0x4b078d,null))['catch'](handleError(_0x4b078d,null));};exports[_0x2e84('0x4c')]=function(_0x40f3e0,_0x31ad58){return db[_0x2e84('0x2a')][_0x2e84('0x44')]({'where':{'id':_0x40f3e0['params']['id']}})[_0x2e84('0x20')](handleEntityNotFound(_0x31ad58,null))[_0x2e84('0x20')](removeEntity(_0x31ad58,null))['catch'](handleError(_0x31ad58,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 2eb3139..259e5f4 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 _0x2509=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','define','tools_templates','lodash','util','../../config/logger'];(function(_0x2e0f32,_0x212897){var _0x1c1f3e=function(_0x22c3cd){while(--_0x22c3cd){_0x2e0f32['push'](_0x2e0f32['shift']());}};_0x1c1f3e(++_0x212897);}(_0x2509,0x128));var _0x9250=function(_0x5de83e,_0x58dc33){_0x5de83e=_0x5de83e-0x0;var _0x20559a=_0x2509[_0x5de83e];return _0x20559a;};'use strict';var _=require(_0x9250('0x0'));var util=require(_0x9250('0x1'));var logger=require(_0x9250('0x2'))(_0x9250('0x3'));var moment=require(_0x9250('0x4'));var BPromise=require(_0x9250('0x5'));var rp=require(_0x9250('0x6'));var fs=require('fs');var path=require(_0x9250('0x7'));var rimraf=require(_0x9250('0x8'));var config=require(_0x9250('0x9'));var attributes=require(_0x9250('0xa'));module['exports']=function(_0x52412c,_0xfae24e){return _0x52412c[_0x9250('0xb')]('Template',attributes,{'tableName':_0x9250('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe70f=['bluebird','path','rimraf','./template.attributes','exports','Template','tools_templates','util','../../config/logger','api','moment'];(function(_0x7aee1f,_0x59515e){var _0x9e8831=function(_0x410253){while(--_0x410253){_0x7aee1f['push'](_0x7aee1f['shift']());}};_0x9e8831(++_0x59515e);}(_0xe70f,0xb7));var _0xfe70=function(_0xf66807,_0x249b84){_0xf66807=_0xf66807-0x0;var _0x3c1db3=_0xe70f[_0xf66807];return _0x3c1db3;};'use strict';var _=require('lodash');var util=require(_0xfe70('0x0'));var logger=require(_0xfe70('0x1'))(_0xfe70('0x2'));var moment=require(_0xfe70('0x3'));var BPromise=require(_0xfe70('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe70('0x5'));var rimraf=require(_0xfe70('0x6'));var config=require('../../config/environment');var attributes=require(_0xfe70('0x7'));module[_0xfe70('0x8')]=function(_0x227e29,_0x13d178){return _0x227e29['define'](_0xfe70('0x9'),attributes,{'tableName':_0xfe70('0xa'),'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 343fce0..7bf1804 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 _0xb4ba=['options','raw','where','include','map','model','attributes','GetTemplate','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll'];(function(_0x25ef3a,_0x3b1379){var _0x571193=function(_0x17ebc1){while(--_0x17ebc1){_0x25ef3a['push'](_0x25ef3a['shift']());}};_0x571193(++_0x3b1379);}(_0xb4ba,0x152));var _0xab4b=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0xb4ba[_0x580971];return _0x16d873;};'use strict';var _=require(_0xab4b('0x0'));var util=require(_0xab4b('0x1'));var moment=require('moment');var BPromise=require(_0xab4b('0x2'));var rs=require(_0xab4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab4b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xab4b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab4b('0x6'));var client=jayson[_0xab4b('0x7')][_0xab4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57a06b,_0x4b2ce7,_0xcb8cf8){return new BPromise(function(_0x46a9b0,_0x41983f){return client[_0xab4b('0x9')](_0x57a06b,_0xcb8cf8)[_0xab4b('0xa')](function(_0x4d26d4){logger[_0xab4b('0xb')](_0xab4b('0xc'),_0x4b2ce7,_0xab4b('0xd'));logger[_0xab4b('0xe')](_0xab4b('0xf'),_0x4b2ce7,'request\x20sent',JSON[_0xab4b('0x10')](_0x4d26d4));if(_0x4d26d4[_0xab4b('0x11')]){if(_0x4d26d4[_0xab4b('0x11')][_0xab4b('0x12')]===0x1f4){logger[_0xab4b('0x11')](_0xab4b('0xc'),_0x4b2ce7,_0x4d26d4[_0xab4b('0x11')][_0xab4b('0x13')]);return _0x41983f(_0x4d26d4['error'][_0xab4b('0x13')]);}logger['error'](_0xab4b('0xc'),_0x4b2ce7,_0x4d26d4['error']['message']);return _0x46a9b0(_0x4d26d4[_0xab4b('0x11')][_0xab4b('0x13')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x4b2ce7,_0xab4b('0xd'));_0x46a9b0(_0x4d26d4['result'][_0xab4b('0x13')]);}})[_0xab4b('0x14')](function(_0x55e4e5){logger['error']('Template,\x20%s,\x20%s',_0x4b2ce7,_0x55e4e5);_0x41983f(_0x55e4e5);});});}exports['GetTemplate']=function(_0x4bb5ad){var _0x968723=this;return new Promise(function(_0x24987d,_0x4d6aca){return db['Template'][_0xab4b('0x15')]({'raw':_0x4bb5ad['options']?_0x4bb5ad[_0xab4b('0x16')][_0xab4b('0x17')]===undefined?!![]:![]:!![],'where':_0x4bb5ad[_0xab4b('0x16')]?_0x4bb5ad[_0xab4b('0x16')][_0xab4b('0x18')]||null:null,'attributes':_0x4bb5ad[_0xab4b('0x16')]?_0x4bb5ad[_0xab4b('0x16')]['attributes']||null:null,'limit':_0x4bb5ad[_0xab4b('0x16')]?_0x4bb5ad[_0xab4b('0x16')]['limit']||null:null,'include':_0x4bb5ad['options']?_0x4bb5ad['options'][_0xab4b('0x19')]?_[_0xab4b('0x1a')](_0x4bb5ad['options']['include'],function(_0x31a720){return{'model':db[_0x31a720[_0xab4b('0x1b')]],'as':_0x31a720['as'],'attributes':_0x31a720[_0xab4b('0x1c')],'include':_0x31a720['include']?_[_0xab4b('0x1a')](_0x31a720[_0xab4b('0x19')],function(_0x3dadc5){return{'model':db[_0x3dadc5['model']],'as':_0x3dadc5['as'],'attributes':_0x3dadc5[_0xab4b('0x1c')],'include':_0x3dadc5[_0xab4b('0x19')]?_[_0xab4b('0x1a')](_0x3dadc5[_0xab4b('0x19')],function(_0x123b87){return{'model':db[_0x123b87[_0xab4b('0x1b')]],'as':_0x123b87['as'],'attributes':_0x123b87[_0xab4b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb4fd82){logger['info'](_0xab4b('0x1d'),_0x4bb5ad);logger['debug'](_0xab4b('0x1d'),_0x4bb5ad,JSON['stringify'](_0xb4fd82));_0x24987d(_0xb4fd82);})[_0xab4b('0x14')](function(_0xe7a7dc){logger[_0xab4b('0x11')](_0xab4b('0x1d'),_0xe7a7dc[_0xab4b('0x13')],_0x4bb5ad);_0x4d6aca(_0x968723[_0xab4b('0x11')](0x1f4,_0xe7a7dc[_0xab4b('0x13')]));});});}; \ No newline at end of file +var _0xa8ff=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch','GetTemplate','options','attributes','include','map','model','lodash','util','moment'];(function(_0x227069,_0x59e113){var _0x7d562=function(_0x3d2852){while(--_0x3d2852){_0x227069['push'](_0x227069['shift']());}};_0x7d562(++_0x59e113);}(_0xa8ff,0x176));var _0xfa8f=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xa8ff[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xfa8f('0x0'));var util=require(_0xfa8f('0x1'));var moment=require(_0xfa8f('0x2'));var BPromise=require(_0xfa8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa8f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa8f('0x5'));var logger=require(_0xfa8f('0x6'))(_0xfa8f('0x7'));var config=require(_0xfa8f('0x8'));var jayson=require(_0xfa8f('0x9'));var client=jayson['client'][_0xfa8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x291c09,_0x2f12ac,_0x41cac8){return new BPromise(function(_0x418e36,_0x5698db){return client[_0xfa8f('0xb')](_0x291c09,_0x41cac8)[_0xfa8f('0xc')](function(_0x57d240){logger[_0xfa8f('0xd')](_0xfa8f('0xe'),_0x2f12ac,'request\x20sent');logger[_0xfa8f('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x2f12ac,'request\x20sent',JSON[_0xfa8f('0x10')](_0x57d240));if(_0x57d240['error']){if(_0x57d240['error'][_0xfa8f('0x11')]===0x1f4){logger[_0xfa8f('0x12')](_0xfa8f('0xe'),_0x2f12ac,_0x57d240[_0xfa8f('0x12')][_0xfa8f('0x13')]);return _0x5698db(_0x57d240[_0xfa8f('0x12')][_0xfa8f('0x13')]);}logger[_0xfa8f('0x12')]('Template,\x20%s,\x20%s',_0x2f12ac,_0x57d240[_0xfa8f('0x12')][_0xfa8f('0x13')]);return _0x418e36(_0x57d240[_0xfa8f('0x12')]['message']);}else{logger[_0xfa8f('0xd')](_0xfa8f('0xe'),_0x2f12ac,_0xfa8f('0x14'));_0x418e36(_0x57d240[_0xfa8f('0x15')][_0xfa8f('0x13')]);}})[_0xfa8f('0x16')](function(_0x5cfe4b){logger[_0xfa8f('0x12')](_0xfa8f('0xe'),_0x2f12ac,_0x5cfe4b);_0x5698db(_0x5cfe4b);});});}exports[_0xfa8f('0x17')]=function(_0x1bff1e){var _0x5d2d31=this;return new Promise(function(_0x6c57a4,_0x8d4135){return db['Template']['findAll']({'raw':_0x1bff1e[_0xfa8f('0x18')]?_0x1bff1e[_0xfa8f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1bff1e[_0xfa8f('0x18')]?_0x1bff1e[_0xfa8f('0x18')]['where']||null:null,'attributes':_0x1bff1e[_0xfa8f('0x18')]?_0x1bff1e[_0xfa8f('0x18')][_0xfa8f('0x19')]||null:null,'limit':_0x1bff1e[_0xfa8f('0x18')]?_0x1bff1e[_0xfa8f('0x18')]['limit']||null:null,'include':_0x1bff1e[_0xfa8f('0x18')]?_0x1bff1e[_0xfa8f('0x18')][_0xfa8f('0x1a')]?_[_0xfa8f('0x1b')](_0x1bff1e['options'][_0xfa8f('0x1a')],function(_0x17d565){return{'model':db[_0x17d565[_0xfa8f('0x1c')]],'as':_0x17d565['as'],'attributes':_0x17d565[_0xfa8f('0x19')],'include':_0x17d565['include']?_[_0xfa8f('0x1b')](_0x17d565[_0xfa8f('0x1a')],function(_0x3ff68b){return{'model':db[_0x3ff68b[_0xfa8f('0x1c')]],'as':_0x3ff68b['as'],'attributes':_0x3ff68b[_0xfa8f('0x19')],'include':_0x3ff68b[_0xfa8f('0x1a')]?_[_0xfa8f('0x1b')](_0x3ff68b[_0xfa8f('0x1a')],function(_0x1b5d8e){return{'model':db[_0x1b5d8e[_0xfa8f('0x1c')]],'as':_0x1b5d8e['as'],'attributes':_0x1b5d8e['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa8f('0xc')](function(_0x19c79d){logger[_0xfa8f('0xd')](_0xfa8f('0x17'),_0x1bff1e);logger[_0xfa8f('0xf')]('GetTemplate',_0x1bff1e,JSON[_0xfa8f('0x10')](_0x19c79d));_0x6c57a4(_0x19c79d);})[_0xfa8f('0x16')](function(_0x4f527){logger['error'](_0xfa8f('0x17'),_0x4f527['message'],_0x1bff1e);_0x8d4135(_0x5d2d31['error'](0x1f4,_0x4f527['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 28c52ee..10e9032 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 _0x29ce=['addAnyCondition','post','addAction','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','get','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','addAllCondition','/:id/any_conditions'];(function(_0x2edbf9,_0x1f52a9){var _0x3f0791=function(_0x1dab49){while(--_0x1dab49){_0x2edbf9['push'](_0x2edbf9['shift']());}};_0x3f0791(++_0x1f52a9);}(_0x29ce,0x96));var _0xe29c=function(_0x5de6f4,_0x9b4883){_0x5de6f4=_0x5de6f4-0x0;var _0x4ac36a=_0x29ce[_0x5de6f4];return _0x4ac36a;};'use strict';var multer=require('multer');var util=require(_0xe29c('0x0'));var path=require(_0xe29c('0x1'));var timeout=require(_0xe29c('0x2'));var express=require(_0xe29c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe29c('0x4'));var interaction=require(_0xe29c('0x5'));var config=require(_0xe29c('0x6'));var controller=require(_0xe29c('0x7'));router['get']('/',auth[_0xe29c('0x8')](),controller['index']);router[_0xe29c('0x9')](_0xe29c('0xa'),auth['isAuthenticated'](),controller[_0xe29c('0xb')]);router[_0xe29c('0x9')](_0xe29c('0xc'),auth['isAuthenticated'](),controller[_0xe29c('0xd')]);router[_0xe29c('0x9')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xe29c('0xe')]);router[_0xe29c('0x9')](_0xe29c('0xf'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/all_conditions',auth[_0xe29c('0x8')](),controller[_0xe29c('0x10')]);router['post'](_0xe29c('0x11'),auth['isAuthenticated'](),controller[_0xe29c('0x12')]);router[_0xe29c('0x13')]('/:id/actions',auth[_0xe29c('0x8')](),controller[_0xe29c('0x14')]);router['put'](_0xe29c('0xa'),auth[_0xe29c('0x8')](),controller[_0xe29c('0x15')]);router[_0xe29c('0x16')](_0xe29c('0xa'),auth[_0xe29c('0x8')](),controller['destroy']);module[_0xe29c('0x17')]=router; \ No newline at end of file +var _0xc1a2=['index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','addAllCondition','addAnyCondition','/:id/actions','addAction','put','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated'];(function(_0x1a7996,_0xffb958){var _0x53498f=function(_0x11c8e1){while(--_0x11c8e1){_0x1a7996['push'](_0x1a7996['shift']());}};_0x53498f(++_0xffb958);}(_0xc1a2,0x148));var _0x2c1a=function(_0x17dac0,_0x182df7){_0x17dac0=_0x17dac0-0x0;var _0x497770=_0xc1a2[_0x17dac0];return _0x497770;};'use strict';var multer=require(_0x2c1a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2c1a('0x1'));var express=require(_0x2c1a('0x2'));var router=express[_0x2c1a('0x3')]();var fs_extra=require(_0x2c1a('0x4'));var auth=require(_0x2c1a('0x5'));var interaction=require(_0x2c1a('0x6'));var config=require('../../config/environment');var controller=require(_0x2c1a('0x7'));router[_0x2c1a('0x8')]('/',auth[_0x2c1a('0x9')](),controller[_0x2c1a('0xa')]);router['get'](_0x2c1a('0xb'),auth[_0x2c1a('0x9')](),controller[_0x2c1a('0xc')]);router['get'](_0x2c1a('0xd'),auth[_0x2c1a('0x9')](),controller[_0x2c1a('0xe')]);router[_0x2c1a('0x8')](_0x2c1a('0xf'),auth[_0x2c1a('0x9')](),controller[_0x2c1a('0x10')]);router['get']('/:id/actions',auth[_0x2c1a('0x9')](),controller[_0x2c1a('0x11')]);router[_0x2c1a('0x12')]('/',auth[_0x2c1a('0x9')](),controller['create']);router['post'](_0x2c1a('0xd'),auth[_0x2c1a('0x9')](),controller[_0x2c1a('0x13')]);router[_0x2c1a('0x12')](_0x2c1a('0xf'),auth[_0x2c1a('0x9')](),controller[_0x2c1a('0x14')]);router[_0x2c1a('0x12')](_0x2c1a('0x15'),auth[_0x2c1a('0x9')](),controller[_0x2c1a('0x16')]);router[_0x2c1a('0x17')](_0x2c1a('0xb'),auth[_0x2c1a('0x9')](),controller['update']);router[_0x2c1a('0x18')](_0x2c1a('0xb'),auth[_0x2c1a('0x9')](),controller[_0x2c1a('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 5bd03c0..c410dc8 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 _0x4c81=['exports','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4c81,0x180));var _0x14c8=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4c81[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x14c8('0x0')]={'name':{'type':Sequelize[_0x14c8('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x14c8('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x956e=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4e0ab8,_0x401afb){var _0x4c1f40=function(_0x7f95ef){while(--_0x7f95ef){_0x4e0ab8['push'](_0x4e0ab8['shift']());}};_0x4c1f40(++_0x401afb);}(_0x956e,0x164));var _0xe956=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0x956e[_0x5ac1e5];return _0x1bccc6;};'use strict';var Sequelize=require(_0xe956('0x0'));module[_0xe956('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe956('0x2')]},'description':{'type':Sequelize[_0xe956('0x2')]},'status':{'type':Sequelize[_0xe956('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 9ca5b25..d908cb5 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 _0xe9a1=['crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','end','error','stack','send','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','name','options','Trigger','includeAll','findAll','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','map','getAnyConditions','order','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3ca4da,_0x3dba84){var _0x1814be=function(_0xe8e9c2){while(--_0xe8e9c2){_0x3ca4da['push'](_0x3ca4da['shift']());}};_0x1814be(++_0x3dba84);}(_0xe9a1,0xa8));var _0x1e9a=function(_0x119555,_0x154910){_0x119555=_0x119555-0x0;var _0x5a5779=_0xe9a1[_0x119555];return _0x5a5779;};'use strict';var emlformat=require(_0x1e9a('0x0'));var rimraf=require(_0x1e9a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e9a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e9a('0x3'));var Mustache=require(_0x1e9a('0x4'));var util=require(_0x1e9a('0x5'));var path=require(_0x1e9a('0x6'));var sox=require('sox');var csv=require(_0x1e9a('0x7'));var ejs=require(_0x1e9a('0x8'));var fs=require('fs');var fs_extra=require(_0x1e9a('0x9'));var _=require(_0x1e9a('0xa'));var squel=require(_0x1e9a('0xb'));var crypto=require(_0x1e9a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1e9a('0xd'));var toCsv=require(_0x1e9a('0x7'));var querystring=require('querystring');var Papa=require(_0x1e9a('0xe'));var Redis=require(_0x1e9a('0xf'));var authService=require(_0x1e9a('0x10'));var qs=require(_0x1e9a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e9a('0x12'));var logger=require(_0x1e9a('0x13'))('api');var utils=require(_0x1e9a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1e9a('0x15'));var db=require(_0x1e9a('0x16'))['db'];function respondWithStatusCode(_0x1d7805,_0x31187e){_0x31187e=_0x31187e||0xcc;return function(_0x13da80){if(_0x13da80){return _0x1d7805[_0x1e9a('0x17')](_0x31187e);}return _0x1d7805[_0x1e9a('0x18')](_0x31187e)['end']();};}function respondWithResult(_0x90962,_0x4d970d){_0x4d970d=_0x4d970d||0xc8;return function(_0x59b135){if(_0x59b135){return _0x90962[_0x1e9a('0x18')](_0x4d970d)['json'](_0x59b135);}};}function respondWithFilteredResult(_0xf986f2,_0x54cea5){return function(_0x210ae9){if(_0x210ae9){var _0x1b963b=typeof _0x54cea5['offset']===_0x1e9a('0x19')&&typeof _0x54cea5[_0x1e9a('0x1a')]===_0x1e9a('0x19');var _0x2cf88b=_0x210ae9[_0x1e9a('0x1b')];var _0x5efea3=_0x1b963b?0x0:_0x54cea5['offset'];var _0x22c371=_0x1b963b?_0x210ae9[_0x1e9a('0x1b')]:_0x54cea5[_0x1e9a('0x1c')]+_0x54cea5['limit'];var _0xd0dfc1;if(_0x22c371>=_0x2cf88b){_0x22c371=_0x2cf88b;_0xd0dfc1=0xc8;}else{_0xd0dfc1=0xce;}_0xf986f2[_0x1e9a('0x18')](_0xd0dfc1);return _0xf986f2[_0x1e9a('0x1d')](_0x1e9a('0x1e'),_0x5efea3+'-'+_0x22c371+'/'+_0x2cf88b)['json'](_0x210ae9);}return null;};}function patchUpdates(_0x3d3001){return function(_0x38d067){try{jsonpatch[_0x1e9a('0x1f')](_0x38d067,_0x3d3001,!![]);}catch(_0x3d8a60){return BPromise[_0x1e9a('0x20')](_0x3d8a60);}return _0x38d067[_0x1e9a('0x21')]();};}function saveUpdates(_0x538e58,_0x1c527c){return function(_0x2472fc){if(_0x2472fc){return _0x2472fc['update'](_0x538e58)[_0x1e9a('0x22')](function(_0x368d51){return _0x368d51;});}return null;};}function removeEntity(_0x456384,_0x1df583){return function(_0x41c038){if(_0x41c038){return _0x41c038[_0x1e9a('0x23')]()[_0x1e9a('0x22')](function(){var _0x14e948=_0x41c038[_0x1e9a('0x24')]({'plain':!![]});var _0x53e5d5=_0x1e9a('0x25');return db[_0x1e9a('0x26')]['destroy']({'where':{'type':_0x53e5d5,'resourceId':_0x14e948['id']}})['then'](function(){return _0x41c038;});})[_0x1e9a('0x22')](function(){_0x456384[_0x1e9a('0x18')](0xcc)[_0x1e9a('0x27')]();});}};}function handleEntityNotFound(_0x1381c1,_0x5d70de){return function(_0x3a35da){if(!_0x3a35da){_0x1381c1[_0x1e9a('0x17')](0x194);}return _0x3a35da;};}function handleError(_0x3ab2d4,_0x557007){_0x557007=_0x557007||0x1f4;return function(_0x16b2e1){logger[_0x1e9a('0x28')](_0x16b2e1[_0x1e9a('0x29')]);if(_0x16b2e1['name']){delete _0x16b2e1['name'];}_0x3ab2d4[_0x1e9a('0x18')](_0x557007)[_0x1e9a('0x2a')](_0x16b2e1);};}exports[_0x1e9a('0x2b')]=function(_0x1cdc7a,_0x2a8581){var _0x59af30={},_0x31bfb9={},_0x2aaaa2={'count':0x0,'rows':[]};var _0x340411=_['map'](db['Trigger'][_0x1e9a('0x2c')],function(_0x3969ae){return{'name':_0x3969ae[_0x1e9a('0x2d')],'type':_0x3969ae[_0x1e9a('0x2e')][_0x1e9a('0x2f')]};});_0x31bfb9[_0x1e9a('0x30')]=_['map'](_0x340411,'name');_0x31bfb9[_0x1e9a('0x31')]=_[_0x1e9a('0x32')](_0x1cdc7a[_0x1e9a('0x31')]);_0x31bfb9['filters']=_[_0x1e9a('0x33')](_0x31bfb9['model'],_0x31bfb9[_0x1e9a('0x31')]);_0x59af30[_0x1e9a('0x34')]=_[_0x1e9a('0x33')](_0x31bfb9[_0x1e9a('0x30')],qs[_0x1e9a('0x35')](_0x1cdc7a[_0x1e9a('0x31')][_0x1e9a('0x35')]));_0x59af30[_0x1e9a('0x34')]=_0x59af30['attributes'][_0x1e9a('0x36')]?_0x59af30[_0x1e9a('0x34')]:_0x31bfb9['model'];if(!_0x1cdc7a[_0x1e9a('0x31')][_0x1e9a('0x37')](_0x1e9a('0x38'))){_0x59af30['limit']=qs['limit'](_0x1cdc7a[_0x1e9a('0x31')]['limit']);_0x59af30[_0x1e9a('0x1c')]=qs['offset'](_0x1cdc7a['query'][_0x1e9a('0x1c')]);}_0x59af30['order']=qs[_0x1e9a('0x39')](_0x1cdc7a[_0x1e9a('0x31')][_0x1e9a('0x39')]);_0x59af30['where']=qs[_0x1e9a('0x3a')](_[_0x1e9a('0x3b')](_0x1cdc7a[_0x1e9a('0x31')],_0x31bfb9['filters']),_0x340411);if(_0x1cdc7a[_0x1e9a('0x31')][_0x1e9a('0x3c')]){_0x59af30[_0x1e9a('0x3d')]=_[_0x1e9a('0x3e')](_0x59af30['where'],{'$or':_['map'](_0x340411,function(_0x301efa){if(_0x301efa[_0x1e9a('0x2e')]!=='VIRTUAL'){var _0x3ef325={};_0x3ef325[_0x301efa[_0x1e9a('0x3f')]]={'$like':'%'+_0x1cdc7a[_0x1e9a('0x31')]['filter']+'%'};return _0x3ef325;}})});}_0x59af30=_[_0x1e9a('0x3e')]({},_0x59af30,_0x1cdc7a[_0x1e9a('0x40')]);var _0x198077={'where':_0x59af30[_0x1e9a('0x3d')]};return db[_0x1e9a('0x41')]['count'](_0x198077)[_0x1e9a('0x22')](function(_0x2724d0){_0x2aaaa2[_0x1e9a('0x1b')]=_0x2724d0;if(_0x1cdc7a['query'][_0x1e9a('0x42')]){_0x59af30['include']=[{'all':!![]}];}return db[_0x1e9a('0x41')][_0x1e9a('0x43')](_0x59af30);})[_0x1e9a('0x22')](function(_0x287670){_0x2aaaa2['rows']=_0x287670;return _0x2aaaa2;})[_0x1e9a('0x22')](respondWithFilteredResult(_0x2a8581,_0x59af30))[_0x1e9a('0x44')](handleError(_0x2a8581,null));};exports['show']=function(_0x3f72af,_0x33eda8){var _0x42d23d={'raw':![],'where':{'id':_0x3f72af[_0x1e9a('0x45')]['id']}},_0x52818e={};_0x52818e['model']=_[_0x1e9a('0x32')](db[_0x1e9a('0x41')][_0x1e9a('0x2c')]);_0x52818e[_0x1e9a('0x31')]=_['keys'](_0x3f72af[_0x1e9a('0x31')]);_0x52818e[_0x1e9a('0x3a')]=_[_0x1e9a('0x33')](_0x52818e[_0x1e9a('0x30')],_0x52818e[_0x1e9a('0x31')]);_0x42d23d['attributes']=_[_0x1e9a('0x33')](_0x52818e['model'],qs[_0x1e9a('0x35')](_0x3f72af['query'][_0x1e9a('0x35')]));_0x42d23d[_0x1e9a('0x34')]=_0x42d23d[_0x1e9a('0x34')][_0x1e9a('0x36')]?_0x42d23d[_0x1e9a('0x34')]:_0x52818e[_0x1e9a('0x30')];if(_0x3f72af[_0x1e9a('0x31')][_0x1e9a('0x42')]){_0x42d23d[_0x1e9a('0x46')]=[{'all':!![]}];}_0x42d23d=_['merge']({},_0x42d23d,_0x3f72af[_0x1e9a('0x40')]);return db[_0x1e9a('0x41')][_0x1e9a('0x47')](_0x42d23d)[_0x1e9a('0x22')](handleEntityNotFound(_0x33eda8,null))[_0x1e9a('0x22')](respondWithResult(_0x33eda8,null))[_0x1e9a('0x44')](handleError(_0x33eda8,null));};exports[_0x1e9a('0x48')]=function(_0x2dbbaf,_0x32f351){return db[_0x1e9a('0x41')][_0x1e9a('0x48')](_0x2dbbaf[_0x1e9a('0x49')],{})['then'](function(_0x239715){var _0x5b8378=_0x2dbbaf[_0x1e9a('0x4a')][_0x1e9a('0x24')]({'plain':!![]});if(!_0x5b8378)throw new Error(_0x1e9a('0x4b'));if(_0x5b8378['role']===_0x1e9a('0x4a')){var _0x3be3b7=_0x239715[_0x1e9a('0x24')]({'plain':!![]});var _0x11e38e=_0x1e9a('0x25');return db['UserProfileSection'][_0x1e9a('0x47')]({'where':{'name':_0x11e38e,'userProfileId':_0x5b8378['userProfileId']},'raw':!![]})[_0x1e9a('0x22')](function(_0x23a1ec){if(_0x23a1ec&&_0x23a1ec['autoAssociation']===0x0){return db[_0x1e9a('0x26')][_0x1e9a('0x48')]({'name':_0x3be3b7[_0x1e9a('0x3f')],'resourceId':_0x3be3b7['id'],'type':_0x23a1ec[_0x1e9a('0x3f')],'sectionId':_0x23a1ec['id']},{})[_0x1e9a('0x22')](function(){return _0x239715;});}else{return _0x239715;}})['catch'](function(_0x1a03c5){logger[_0x1e9a('0x28')](_0x1e9a('0x4c'),_0x1a03c5);throw _0x1a03c5;});}return _0x239715;})[_0x1e9a('0x22')](respondWithResult(_0x32f351,0xc9))[_0x1e9a('0x44')](handleError(_0x32f351,null));};exports[_0x1e9a('0x4d')]=function(_0x427ad4,_0x1fa3be){if(_0x427ad4[_0x1e9a('0x49')]['id']){delete _0x427ad4['body']['id'];}return db[_0x1e9a('0x41')][_0x1e9a('0x47')]({'where':{'id':_0x427ad4[_0x1e9a('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fa3be,null))[_0x1e9a('0x22')](saveUpdates(_0x427ad4[_0x1e9a('0x49')],null))[_0x1e9a('0x22')](respondWithResult(_0x1fa3be,null))[_0x1e9a('0x44')](handleError(_0x1fa3be,null));};exports[_0x1e9a('0x23')]=function(_0x45f950,_0x522dbb){return db[_0x1e9a('0x41')]['find']({'where':{'id':_0x45f950[_0x1e9a('0x45')]['id']}})['then'](handleEntityNotFound(_0x522dbb,null))['then'](removeEntity(_0x522dbb,null))[_0x1e9a('0x44')](handleError(_0x522dbb,null));};exports['addAllCondition']=function(_0x1ee0e3,_0xd25d00,_0x1a15bb){if(_0x1ee0e3['body']['id']){delete _0x1ee0e3[_0x1e9a('0x49')]['id'];}return db[_0x1e9a('0x41')][_0x1e9a('0x47')]({'where':{'id':_0x1ee0e3[_0x1e9a('0x45')]['id']}})['then'](handleEntityNotFound(_0xd25d00,null))[_0x1e9a('0x22')](function(_0x4fcf0c){if(_0x4fcf0c){_0x1ee0e3['body'][_0x1e9a('0x4e')]=_0x4fcf0c['id'];return db['Condition'][_0x1e9a('0x48')](_0x1ee0e3[_0x1e9a('0x49')]);}})['then'](respondWithResult(_0xd25d00,null))[_0x1e9a('0x44')](handleError(_0xd25d00,null));};exports[_0x1e9a('0x4f')]=function(_0x52510f,_0x168567,_0x15ae82){if(_0x52510f[_0x1e9a('0x49')]['id']){delete _0x52510f[_0x1e9a('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x52510f[_0x1e9a('0x45')]['id']}})[_0x1e9a('0x22')](handleEntityNotFound(_0x168567,null))[_0x1e9a('0x22')](function(_0x4b5239){if(_0x4b5239){_0x52510f['body'][_0x1e9a('0x50')]=_0x4b5239['id'];return db[_0x1e9a('0x51')][_0x1e9a('0x48')](_0x52510f[_0x1e9a('0x49')]);}})[_0x1e9a('0x22')](respondWithResult(_0x168567,null))[_0x1e9a('0x44')](handleError(_0x168567,null));};exports[_0x1e9a('0x52')]=function(_0x4f5bec,_0x4536ae,_0x2ec590){var _0x323318={};var _0x13ea9e={};var _0x1ce340;var _0x465784;return db['Trigger'][_0x1e9a('0x53')]({'where':{'id':_0x4f5bec[_0x1e9a('0x45')]['id']}})[_0x1e9a('0x22')](handleEntityNotFound(_0x4536ae,null))['then'](function(_0x5b0c68){if(_0x5b0c68){_0x1ce340=_0x5b0c68;_0x13ea9e['model']=_[_0x1e9a('0x32')](db['Condition']['rawAttributes']);_0x13ea9e[_0x1e9a('0x31')]=_['keys'](_0x4f5bec['query']);_0x13ea9e['filters']=_['intersection'](_0x13ea9e[_0x1e9a('0x30')],_0x13ea9e['query']);_0x323318['attributes']=_['intersection'](_0x13ea9e['model'],qs['fields'](_0x4f5bec['query'][_0x1e9a('0x35')]));_0x323318[_0x1e9a('0x34')]=_0x323318['attributes']['length']?_0x323318[_0x1e9a('0x34')]:_0x13ea9e[_0x1e9a('0x30')];_0x323318['order']=qs[_0x1e9a('0x39')](_0x4f5bec[_0x1e9a('0x31')][_0x1e9a('0x39')]);_0x323318['where']=qs[_0x1e9a('0x3a')](_[_0x1e9a('0x3b')](_0x4f5bec[_0x1e9a('0x31')],_0x13ea9e['filters']));if(_0x4f5bec[_0x1e9a('0x31')][_0x1e9a('0x3c')]){_0x323318[_0x1e9a('0x3d')]=_[_0x1e9a('0x3e')](_0x323318[_0x1e9a('0x3d')],{'$or':_[_0x1e9a('0x54')](_0x323318['attributes'],function(_0x258091){var _0x27c957={};_0x27c957[_0x258091]={'$like':'%'+_0x4f5bec[_0x1e9a('0x31')][_0x1e9a('0x3c')]+'%'};return _0x27c957;})});}_0x323318=_[_0x1e9a('0x3e')]({},_0x323318,_0x4f5bec[_0x1e9a('0x40')]);return _0x1ce340['getAllConditions'](_0x323318);}})[_0x1e9a('0x22')](function(_0x5bfd36){if(_0x5bfd36){_0x465784=_0x5bfd36['length'];if(!_0x4f5bec[_0x1e9a('0x31')][_0x1e9a('0x37')](_0x1e9a('0x38'))){_0x323318[_0x1e9a('0x1a')]=qs[_0x1e9a('0x1a')](_0x4f5bec[_0x1e9a('0x31')][_0x1e9a('0x1a')]);_0x323318[_0x1e9a('0x1c')]=qs[_0x1e9a('0x1c')](_0x4f5bec[_0x1e9a('0x31')][_0x1e9a('0x1c')]);}return _0x1ce340[_0x1e9a('0x52')](_0x323318);}})['then'](function(_0x2f29da){if(_0x2f29da){return _0x2f29da?{'count':_0x465784,'rows':_0x2f29da}:null;}})[_0x1e9a('0x22')](respondWithResult(_0x4536ae,null))[_0x1e9a('0x44')](handleError(_0x4536ae,null));};exports[_0x1e9a('0x55')]=function(_0x472e60,_0x46520f,_0x28e2df){var _0x2dd7cb={};var _0x1a24d3={};var _0x31a26d;var _0x5cc942;return db[_0x1e9a('0x41')][_0x1e9a('0x53')]({'where':{'id':_0x472e60[_0x1e9a('0x45')]['id']}})[_0x1e9a('0x22')](handleEntityNotFound(_0x46520f,null))[_0x1e9a('0x22')](function(_0x5e0c5d){if(_0x5e0c5d){_0x31a26d=_0x5e0c5d;_0x1a24d3[_0x1e9a('0x30')]=_[_0x1e9a('0x32')](db[_0x1e9a('0x51')][_0x1e9a('0x2c')]);_0x1a24d3['query']=_[_0x1e9a('0x32')](_0x472e60[_0x1e9a('0x31')]);_0x1a24d3['filters']=_['intersection'](_0x1a24d3[_0x1e9a('0x30')],_0x1a24d3[_0x1e9a('0x31')]);_0x2dd7cb['attributes']=_[_0x1e9a('0x33')](_0x1a24d3[_0x1e9a('0x30')],qs[_0x1e9a('0x35')](_0x472e60[_0x1e9a('0x31')][_0x1e9a('0x35')]));_0x2dd7cb[_0x1e9a('0x34')]=_0x2dd7cb[_0x1e9a('0x34')][_0x1e9a('0x36')]?_0x2dd7cb[_0x1e9a('0x34')]:_0x1a24d3['model'];_0x2dd7cb[_0x1e9a('0x56')]=qs[_0x1e9a('0x39')](_0x472e60[_0x1e9a('0x31')][_0x1e9a('0x39')]);_0x2dd7cb['where']=qs[_0x1e9a('0x3a')](_[_0x1e9a('0x3b')](_0x472e60[_0x1e9a('0x31')],_0x1a24d3[_0x1e9a('0x3a')]));if(_0x472e60[_0x1e9a('0x31')][_0x1e9a('0x3c')]){_0x2dd7cb[_0x1e9a('0x3d')]=_[_0x1e9a('0x3e')](_0x2dd7cb[_0x1e9a('0x3d')],{'$or':_[_0x1e9a('0x54')](_0x2dd7cb[_0x1e9a('0x34')],function(_0x442185){var _0x5e0977={};_0x5e0977[_0x442185]={'$like':'%'+_0x472e60[_0x1e9a('0x31')][_0x1e9a('0x3c')]+'%'};return _0x5e0977;})});}_0x2dd7cb=_[_0x1e9a('0x3e')]({},_0x2dd7cb,_0x472e60[_0x1e9a('0x40')]);return _0x31a26d[_0x1e9a('0x55')](_0x2dd7cb);}})[_0x1e9a('0x22')](function(_0x2e7e57){if(_0x2e7e57){_0x5cc942=_0x2e7e57['length'];if(!_0x472e60[_0x1e9a('0x31')][_0x1e9a('0x37')](_0x1e9a('0x38'))){_0x2dd7cb[_0x1e9a('0x1a')]=qs['limit'](_0x472e60['query'][_0x1e9a('0x1a')]);_0x2dd7cb[_0x1e9a('0x1c')]=qs[_0x1e9a('0x1c')](_0x472e60['query'][_0x1e9a('0x1c')]);}return _0x31a26d[_0x1e9a('0x55')](_0x2dd7cb);}})[_0x1e9a('0x22')](function(_0x28fb14){if(_0x28fb14){return _0x28fb14?{'count':_0x5cc942,'rows':_0x28fb14}:null;}})['then'](respondWithResult(_0x46520f,null))[_0x1e9a('0x44')](handleError(_0x46520f,null));};exports['addAction']=function(_0x14b5e4,_0x2233a4,_0xb9020){if(_0x14b5e4[_0x1e9a('0x49')]['id']){delete _0x14b5e4['body']['id'];}return db['Trigger'][_0x1e9a('0x47')]({'where':{'id':_0x14b5e4[_0x1e9a('0x45')]['id']}})['then'](handleEntityNotFound(_0x2233a4,null))[_0x1e9a('0x22')](function(_0x1b1a7e){if(_0x1b1a7e){_0x14b5e4[_0x1e9a('0x49')][_0x1e9a('0x57')]=_0x1b1a7e['id'];return db[_0x1e9a('0x58')][_0x1e9a('0x48')](_0x14b5e4[_0x1e9a('0x49')]);}})[_0x1e9a('0x22')](respondWithResult(_0x2233a4,null))['catch'](handleError(_0x2233a4,null));};exports['getActions']=function(_0x1ced2c,_0xf06cf6,_0x2153aa){var _0x50741f={};var _0x1a9c72={};var _0x547439;var _0x5a8767;return db[_0x1e9a('0x41')]['findOne']({'where':{'id':_0x1ced2c[_0x1e9a('0x45')]['id']}})[_0x1e9a('0x22')](handleEntityNotFound(_0xf06cf6,null))[_0x1e9a('0x22')](function(_0x433f84){if(_0x433f84){_0x547439=_0x433f84;_0x1a9c72[_0x1e9a('0x30')]=_[_0x1e9a('0x32')](db[_0x1e9a('0x58')][_0x1e9a('0x2c')]);_0x1a9c72[_0x1e9a('0x31')]=_[_0x1e9a('0x32')](_0x1ced2c['query']);_0x1a9c72[_0x1e9a('0x3a')]=_[_0x1e9a('0x33')](_0x1a9c72[_0x1e9a('0x30')],_0x1a9c72[_0x1e9a('0x31')]);_0x50741f[_0x1e9a('0x34')]=_[_0x1e9a('0x33')](_0x1a9c72['model'],qs[_0x1e9a('0x35')](_0x1ced2c['query'][_0x1e9a('0x35')]));_0x50741f['attributes']=_0x50741f[_0x1e9a('0x34')][_0x1e9a('0x36')]?_0x50741f[_0x1e9a('0x34')]:_0x1a9c72[_0x1e9a('0x30')];_0x50741f[_0x1e9a('0x56')]=qs[_0x1e9a('0x39')](_0x1ced2c['query'][_0x1e9a('0x39')]);_0x50741f['where']=qs['filters'](_[_0x1e9a('0x3b')](_0x1ced2c[_0x1e9a('0x31')],_0x1a9c72[_0x1e9a('0x3a')]));if(_0x1ced2c[_0x1e9a('0x31')][_0x1e9a('0x3c')]){_0x50741f['where']=_[_0x1e9a('0x3e')](_0x50741f['where'],{'$or':_[_0x1e9a('0x54')](_0x50741f[_0x1e9a('0x34')],function(_0xdd01e3){var _0x25e07e={};_0x25e07e[_0xdd01e3]={'$like':'%'+_0x1ced2c[_0x1e9a('0x31')][_0x1e9a('0x3c')]+'%'};return _0x25e07e;})});}_0x50741f=_[_0x1e9a('0x3e')]({},_0x50741f,_0x1ced2c['options']);return _0x547439[_0x1e9a('0x59')](_0x50741f);}})['then'](function(_0x5375a7){if(_0x5375a7){_0x5a8767=_0x5375a7[_0x1e9a('0x36')];if(!_0x1ced2c[_0x1e9a('0x31')][_0x1e9a('0x37')]('nolimit')){_0x50741f[_0x1e9a('0x1a')]=qs[_0x1e9a('0x1a')](_0x1ced2c[_0x1e9a('0x31')][_0x1e9a('0x1a')]);_0x50741f[_0x1e9a('0x1c')]=qs[_0x1e9a('0x1c')](_0x1ced2c[_0x1e9a('0x31')][_0x1e9a('0x1c')]);}return _0x547439['getActions'](_0x50741f);}})['then'](function(_0x4a09df){if(_0x4a09df){return _0x4a09df?{'count':_0x5a8767,'rows':_0x4a09df}:null;}})[_0x1e9a('0x22')](respondWithResult(_0xf06cf6,null))[_0x1e9a('0x44')](handleError(_0xf06cf6,null));}; \ No newline at end of file +var _0xe654=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Triggers','error','stack','name','send','index','map','Trigger','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','findAll','rows','catch','show','keys','rawAttributes','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','length','getAnyConditions','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x178013,_0x5b8239){var _0x2aea76=function(_0x3a9866){while(--_0x3a9866){_0x178013['push'](_0x178013['shift']());}};_0x2aea76(++_0x5b8239);}(_0xe654,0x1cd));var _0x4e65=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe654[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e65('0x0'));var zipdir=require(_0x4e65('0x1'));var jsonpatch=require(_0x4e65('0x2'));var rp=require(_0x4e65('0x3'));var moment=require(_0x4e65('0x4'));var BPromise=require(_0x4e65('0x5'));var Mustache=require(_0x4e65('0x6'));var util=require(_0x4e65('0x7'));var path=require('path');var sox=require(_0x4e65('0x8'));var csv=require(_0x4e65('0x9'));var ejs=require(_0x4e65('0xa'));var fs=require('fs');var fs_extra=require(_0x4e65('0xb'));var _=require(_0x4e65('0xc'));var squel=require(_0x4e65('0xd'));var crypto=require(_0x4e65('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4e65('0xf'));var toCsv=require(_0x4e65('0x9'));var querystring=require('querystring');var Papa=require(_0x4e65('0x10'));var Redis=require(_0x4e65('0x11'));var authService=require(_0x4e65('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e65('0x13'));var logger=require(_0x4e65('0x14'))(_0x4e65('0x15'));var utils=require(_0x4e65('0x16'));var config=require(_0x4e65('0x17'));var licenseUtil=require(_0x4e65('0x18'));var db=require(_0x4e65('0x19'))['db'];function respondWithStatusCode(_0x2a3652,_0x5a84a2){_0x5a84a2=_0x5a84a2||0xcc;return function(_0x3c2b83){if(_0x3c2b83){return _0x2a3652['sendStatus'](_0x5a84a2);}return _0x2a3652[_0x4e65('0x1a')](_0x5a84a2)[_0x4e65('0x1b')]();};}function respondWithResult(_0x517124,_0xaff9eb){_0xaff9eb=_0xaff9eb||0xc8;return function(_0x2c94f4){if(_0x2c94f4){return _0x517124['status'](_0xaff9eb)[_0x4e65('0x1c')](_0x2c94f4);}};}function respondWithFilteredResult(_0x5f3da4,_0x4a2ccb){return function(_0x1873d8){if(_0x1873d8){var _0xfaa4e3=typeof _0x4a2ccb[_0x4e65('0x1d')]===_0x4e65('0x1e')&&typeof _0x4a2ccb[_0x4e65('0x1f')]===_0x4e65('0x1e');var _0x26f014=_0x1873d8[_0x4e65('0x20')];var _0x360d0e=_0xfaa4e3?0x0:_0x4a2ccb['offset'];var _0x522b29=_0xfaa4e3?_0x1873d8[_0x4e65('0x20')]:_0x4a2ccb[_0x4e65('0x1d')]+_0x4a2ccb[_0x4e65('0x1f')];var _0x4544da;if(_0x522b29>=_0x26f014){_0x522b29=_0x26f014;_0x4544da=0xc8;}else{_0x4544da=0xce;}_0x5f3da4[_0x4e65('0x1a')](_0x4544da);return _0x5f3da4[_0x4e65('0x21')](_0x4e65('0x22'),_0x360d0e+'-'+_0x522b29+'/'+_0x26f014)[_0x4e65('0x1c')](_0x1873d8);}return null;};}function patchUpdates(_0x2e1991){return function(_0x1a436c){try{jsonpatch['apply'](_0x1a436c,_0x2e1991,!![]);}catch(_0xa7b16){return BPromise['reject'](_0xa7b16);}return _0x1a436c[_0x4e65('0x23')]();};}function saveUpdates(_0x2b9aa5,_0x304fae){return function(_0x58ef64){if(_0x58ef64){return _0x58ef64['update'](_0x2b9aa5)[_0x4e65('0x24')](function(_0x230f01){return _0x230f01;});}return null;};}function removeEntity(_0xc374be,_0x6f6536){return function(_0x5d1e97){if(_0x5d1e97){return _0x5d1e97[_0x4e65('0x25')]()[_0x4e65('0x24')](function(){var _0x23d276=_0x5d1e97[_0x4e65('0x26')]({'plain':!![]});var _0x25af20=_0x4e65('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x25af20,'resourceId':_0x23d276['id']}})[_0x4e65('0x24')](function(){return _0x5d1e97;});})[_0x4e65('0x24')](function(){_0xc374be[_0x4e65('0x1a')](0xcc)[_0x4e65('0x1b')]();});}};}function handleEntityNotFound(_0x19bf22,_0x411de6){return function(_0x39f119){if(!_0x39f119){_0x19bf22['sendStatus'](0x194);}return _0x39f119;};}function handleError(_0x39d3a4,_0x37eebb){_0x37eebb=_0x37eebb||0x1f4;return function(_0x2baf34){logger[_0x4e65('0x28')](_0x2baf34[_0x4e65('0x29')]);if(_0x2baf34[_0x4e65('0x2a')]){delete _0x2baf34[_0x4e65('0x2a')];}_0x39d3a4[_0x4e65('0x1a')](_0x37eebb)[_0x4e65('0x2b')](_0x2baf34);};}exports[_0x4e65('0x2c')]=function(_0x323aba,_0x171f3e){var _0x2febeb={},_0x421ee8={},_0x28ff34={'count':0x0,'rows':[]};var _0x556dcd=_[_0x4e65('0x2d')](db[_0x4e65('0x2e')]['rawAttributes'],function(_0x45ef97){return{'name':_0x45ef97[_0x4e65('0x2f')],'type':_0x45ef97[_0x4e65('0x30')][_0x4e65('0x31')]};});_0x421ee8[_0x4e65('0x32')]=_[_0x4e65('0x2d')](_0x556dcd,_0x4e65('0x2a'));_0x421ee8[_0x4e65('0x33')]=_['keys'](_0x323aba['query']);_0x421ee8[_0x4e65('0x34')]=_[_0x4e65('0x35')](_0x421ee8['model'],_0x421ee8[_0x4e65('0x33')]);_0x2febeb[_0x4e65('0x36')]=_[_0x4e65('0x35')](_0x421ee8[_0x4e65('0x32')],qs[_0x4e65('0x37')](_0x323aba['query'][_0x4e65('0x37')]));_0x2febeb[_0x4e65('0x36')]=_0x2febeb[_0x4e65('0x36')]['length']?_0x2febeb[_0x4e65('0x36')]:_0x421ee8['model'];if(!_0x323aba[_0x4e65('0x33')][_0x4e65('0x38')](_0x4e65('0x39'))){_0x2febeb[_0x4e65('0x1f')]=qs[_0x4e65('0x1f')](_0x323aba[_0x4e65('0x33')][_0x4e65('0x1f')]);_0x2febeb[_0x4e65('0x1d')]=qs[_0x4e65('0x1d')](_0x323aba[_0x4e65('0x33')][_0x4e65('0x1d')]);}_0x2febeb[_0x4e65('0x3a')]=qs[_0x4e65('0x3b')](_0x323aba[_0x4e65('0x33')][_0x4e65('0x3b')]);_0x2febeb['where']=qs[_0x4e65('0x34')](_[_0x4e65('0x3c')](_0x323aba[_0x4e65('0x33')],_0x421ee8[_0x4e65('0x34')]),_0x556dcd);if(_0x323aba['query'][_0x4e65('0x3d')]){_0x2febeb[_0x4e65('0x3e')]=_[_0x4e65('0x3f')](_0x2febeb[_0x4e65('0x3e')],{'$or':_[_0x4e65('0x2d')](_0x556dcd,function(_0x1c1ebd){if(_0x1c1ebd['type']!=='VIRTUAL'){var _0x4a4396={};_0x4a4396[_0x1c1ebd[_0x4e65('0x2a')]]={'$like':'%'+_0x323aba[_0x4e65('0x33')]['filter']+'%'};return _0x4a4396;}})});}_0x2febeb=_['merge']({},_0x2febeb,_0x323aba[_0x4e65('0x40')]);var _0x53167d={'where':_0x2febeb[_0x4e65('0x3e')]};return db['Trigger'][_0x4e65('0x20')](_0x53167d)[_0x4e65('0x24')](function(_0x44400e){_0x28ff34['count']=_0x44400e;if(_0x323aba[_0x4e65('0x33')]['includeAll']){_0x2febeb['include']=[{'all':!![]}];}return db[_0x4e65('0x2e')][_0x4e65('0x41')](_0x2febeb);})[_0x4e65('0x24')](function(_0x9377c5){_0x28ff34[_0x4e65('0x42')]=_0x9377c5;return _0x28ff34;})[_0x4e65('0x24')](respondWithFilteredResult(_0x171f3e,_0x2febeb))[_0x4e65('0x43')](handleError(_0x171f3e,null));};exports[_0x4e65('0x44')]=function(_0x3b4eaa,_0x4fbb4b){var _0x28cae2={'raw':![],'where':{'id':_0x3b4eaa['params']['id']}},_0x1744ca={};_0x1744ca[_0x4e65('0x32')]=_[_0x4e65('0x45')](db[_0x4e65('0x2e')][_0x4e65('0x46')]);_0x1744ca[_0x4e65('0x33')]=_[_0x4e65('0x45')](_0x3b4eaa[_0x4e65('0x33')]);_0x1744ca['filters']=_[_0x4e65('0x35')](_0x1744ca[_0x4e65('0x32')],_0x1744ca[_0x4e65('0x33')]);_0x28cae2['attributes']=_[_0x4e65('0x35')](_0x1744ca[_0x4e65('0x32')],qs[_0x4e65('0x37')](_0x3b4eaa[_0x4e65('0x33')][_0x4e65('0x37')]));_0x28cae2['attributes']=_0x28cae2[_0x4e65('0x36')]['length']?_0x28cae2[_0x4e65('0x36')]:_0x1744ca[_0x4e65('0x32')];if(_0x3b4eaa[_0x4e65('0x33')][_0x4e65('0x47')]){_0x28cae2[_0x4e65('0x48')]=[{'all':!![]}];}_0x28cae2=_[_0x4e65('0x3f')]({},_0x28cae2,_0x3b4eaa[_0x4e65('0x40')]);return db[_0x4e65('0x2e')]['find'](_0x28cae2)[_0x4e65('0x24')](handleEntityNotFound(_0x4fbb4b,null))[_0x4e65('0x24')](respondWithResult(_0x4fbb4b,null))['catch'](handleError(_0x4fbb4b,null));};exports[_0x4e65('0x49')]=function(_0x4cb0db,_0x3a0c70){return db[_0x4e65('0x2e')][_0x4e65('0x49')](_0x4cb0db['body'],{})['then'](function(_0x2d28a7){var _0x30efbb=_0x4cb0db[_0x4e65('0x4a')]['get']({'plain':!![]});if(!_0x30efbb)throw new Error(_0x4e65('0x4b'));if(_0x30efbb['role']===_0x4e65('0x4a')){var _0x2cc503=_0x2d28a7[_0x4e65('0x26')]({'plain':!![]});var _0xbe0778=_0x4e65('0x27');return db['UserProfileSection'][_0x4e65('0x4c')]({'where':{'name':_0xbe0778,'userProfileId':_0x30efbb['userProfileId']},'raw':!![]})[_0x4e65('0x24')](function(_0x27861a){if(_0x27861a&&_0x27861a[_0x4e65('0x4d')]===0x0){return db['UserProfileResource'][_0x4e65('0x49')]({'name':_0x2cc503[_0x4e65('0x2a')],'resourceId':_0x2cc503['id'],'type':_0x27861a[_0x4e65('0x2a')],'sectionId':_0x27861a['id']},{})[_0x4e65('0x24')](function(){return _0x2d28a7;});}else{return _0x2d28a7;}})[_0x4e65('0x43')](function(_0x5d7447){logger['error'](_0x4e65('0x4e'),_0x5d7447);throw _0x5d7447;});}return _0x2d28a7;})[_0x4e65('0x24')](respondWithResult(_0x3a0c70,0xc9))['catch'](handleError(_0x3a0c70,null));};exports['update']=function(_0x19be7b,_0x4d29c2){if(_0x19be7b[_0x4e65('0x4f')]['id']){delete _0x19be7b[_0x4e65('0x4f')]['id'];}return db[_0x4e65('0x2e')][_0x4e65('0x4c')]({'where':{'id':_0x19be7b[_0x4e65('0x50')]['id']}})[_0x4e65('0x24')](handleEntityNotFound(_0x4d29c2,null))[_0x4e65('0x24')](saveUpdates(_0x19be7b[_0x4e65('0x4f')],null))[_0x4e65('0x24')](respondWithResult(_0x4d29c2,null))[_0x4e65('0x43')](handleError(_0x4d29c2,null));};exports[_0x4e65('0x25')]=function(_0x341515,_0x15b22b){return db['Trigger'][_0x4e65('0x4c')]({'where':{'id':_0x341515[_0x4e65('0x50')]['id']}})[_0x4e65('0x24')](handleEntityNotFound(_0x15b22b,null))[_0x4e65('0x24')](removeEntity(_0x15b22b,null))[_0x4e65('0x43')](handleError(_0x15b22b,null));};exports[_0x4e65('0x51')]=function(_0x4613e2,_0x1d2203,_0x306189){if(_0x4613e2[_0x4e65('0x4f')]['id']){delete _0x4613e2[_0x4e65('0x4f')]['id'];}return db[_0x4e65('0x2e')]['find']({'where':{'id':_0x4613e2['params']['id']}})[_0x4e65('0x24')](handleEntityNotFound(_0x1d2203,null))[_0x4e65('0x24')](function(_0x28ab3d){if(_0x28ab3d){_0x4613e2['body'][_0x4e65('0x52')]=_0x28ab3d['id'];return db[_0x4e65('0x53')]['create'](_0x4613e2[_0x4e65('0x4f')]);}})['then'](respondWithResult(_0x1d2203,null))['catch'](handleError(_0x1d2203,null));};exports[_0x4e65('0x54')]=function(_0x3e75b6,_0x5d37af,_0x371563){if(_0x3e75b6[_0x4e65('0x4f')]['id']){delete _0x3e75b6[_0x4e65('0x4f')]['id'];}return db[_0x4e65('0x2e')][_0x4e65('0x4c')]({'where':{'id':_0x3e75b6[_0x4e65('0x50')]['id']}})[_0x4e65('0x24')](handleEntityNotFound(_0x5d37af,null))[_0x4e65('0x24')](function(_0x168972){if(_0x168972){_0x3e75b6['body'][_0x4e65('0x55')]=_0x168972['id'];return db[_0x4e65('0x53')][_0x4e65('0x49')](_0x3e75b6['body']);}})['then'](respondWithResult(_0x5d37af,null))[_0x4e65('0x43')](handleError(_0x5d37af,null));};exports[_0x4e65('0x56')]=function(_0x7de9e8,_0x1f984f,_0x57587f){var _0x5d90a8={};var _0x2ce258={};var _0x50867c;var _0x3fd690;return db[_0x4e65('0x2e')][_0x4e65('0x57')]({'where':{'id':_0x7de9e8['params']['id']}})[_0x4e65('0x24')](handleEntityNotFound(_0x1f984f,null))[_0x4e65('0x24')](function(_0xd359d5){if(_0xd359d5){_0x50867c=_0xd359d5;_0x2ce258['model']=_[_0x4e65('0x45')](db[_0x4e65('0x53')][_0x4e65('0x46')]);_0x2ce258[_0x4e65('0x33')]=_['keys'](_0x7de9e8[_0x4e65('0x33')]);_0x2ce258[_0x4e65('0x34')]=_['intersection'](_0x2ce258[_0x4e65('0x32')],_0x2ce258['query']);_0x5d90a8[_0x4e65('0x36')]=_[_0x4e65('0x35')](_0x2ce258['model'],qs['fields'](_0x7de9e8[_0x4e65('0x33')][_0x4e65('0x37')]));_0x5d90a8['attributes']=_0x5d90a8[_0x4e65('0x36')][_0x4e65('0x58')]?_0x5d90a8[_0x4e65('0x36')]:_0x2ce258['model'];_0x5d90a8['order']=qs[_0x4e65('0x3b')](_0x7de9e8[_0x4e65('0x33')]['sort']);_0x5d90a8[_0x4e65('0x3e')]=qs[_0x4e65('0x34')](_['pick'](_0x7de9e8[_0x4e65('0x33')],_0x2ce258[_0x4e65('0x34')]));if(_0x7de9e8[_0x4e65('0x33')]['filter']){_0x5d90a8[_0x4e65('0x3e')]=_[_0x4e65('0x3f')](_0x5d90a8[_0x4e65('0x3e')],{'$or':_[_0x4e65('0x2d')](_0x5d90a8[_0x4e65('0x36')],function(_0xaceaa6){var _0x1580f2={};_0x1580f2[_0xaceaa6]={'$like':'%'+_0x7de9e8[_0x4e65('0x33')][_0x4e65('0x3d')]+'%'};return _0x1580f2;})});}_0x5d90a8=_[_0x4e65('0x3f')]({},_0x5d90a8,_0x7de9e8[_0x4e65('0x40')]);return _0x50867c[_0x4e65('0x56')](_0x5d90a8);}})[_0x4e65('0x24')](function(_0x4d7cba){if(_0x4d7cba){_0x3fd690=_0x4d7cba[_0x4e65('0x58')];if(!_0x7de9e8['query']['hasOwnProperty']('nolimit')){_0x5d90a8['limit']=qs['limit'](_0x7de9e8[_0x4e65('0x33')][_0x4e65('0x1f')]);_0x5d90a8[_0x4e65('0x1d')]=qs['offset'](_0x7de9e8[_0x4e65('0x33')][_0x4e65('0x1d')]);}return _0x50867c[_0x4e65('0x56')](_0x5d90a8);}})[_0x4e65('0x24')](function(_0x59c7c9){if(_0x59c7c9){return _0x59c7c9?{'count':_0x3fd690,'rows':_0x59c7c9}:null;}})[_0x4e65('0x24')](respondWithResult(_0x1f984f,null))[_0x4e65('0x43')](handleError(_0x1f984f,null));};exports['getAnyConditions']=function(_0xedc209,_0x1d558c,_0x5d2553){var _0x20d003={};var _0x3ba813={};var _0x3f6121;var _0x251303;return db[_0x4e65('0x2e')][_0x4e65('0x57')]({'where':{'id':_0xedc209['params']['id']}})[_0x4e65('0x24')](handleEntityNotFound(_0x1d558c,null))[_0x4e65('0x24')](function(_0x318e60){if(_0x318e60){_0x3f6121=_0x318e60;_0x3ba813[_0x4e65('0x32')]=_['keys'](db['Condition']['rawAttributes']);_0x3ba813[_0x4e65('0x33')]=_[_0x4e65('0x45')](_0xedc209['query']);_0x3ba813[_0x4e65('0x34')]=_[_0x4e65('0x35')](_0x3ba813[_0x4e65('0x32')],_0x3ba813[_0x4e65('0x33')]);_0x20d003['attributes']=_['intersection'](_0x3ba813[_0x4e65('0x32')],qs[_0x4e65('0x37')](_0xedc209[_0x4e65('0x33')][_0x4e65('0x37')]));_0x20d003[_0x4e65('0x36')]=_0x20d003[_0x4e65('0x36')]['length']?_0x20d003['attributes']:_0x3ba813[_0x4e65('0x32')];_0x20d003[_0x4e65('0x3a')]=qs[_0x4e65('0x3b')](_0xedc209[_0x4e65('0x33')][_0x4e65('0x3b')]);_0x20d003[_0x4e65('0x3e')]=qs[_0x4e65('0x34')](_[_0x4e65('0x3c')](_0xedc209[_0x4e65('0x33')],_0x3ba813['filters']));if(_0xedc209[_0x4e65('0x33')][_0x4e65('0x3d')]){_0x20d003[_0x4e65('0x3e')]=_[_0x4e65('0x3f')](_0x20d003[_0x4e65('0x3e')],{'$or':_['map'](_0x20d003[_0x4e65('0x36')],function(_0x2e6fd9){var _0x235cf3={};_0x235cf3[_0x2e6fd9]={'$like':'%'+_0xedc209[_0x4e65('0x33')][_0x4e65('0x3d')]+'%'};return _0x235cf3;})});}_0x20d003=_[_0x4e65('0x3f')]({},_0x20d003,_0xedc209['options']);return _0x3f6121[_0x4e65('0x59')](_0x20d003);}})[_0x4e65('0x24')](function(_0x53dcfc){if(_0x53dcfc){_0x251303=_0x53dcfc[_0x4e65('0x58')];if(!_0xedc209[_0x4e65('0x33')][_0x4e65('0x38')](_0x4e65('0x39'))){_0x20d003[_0x4e65('0x1f')]=qs[_0x4e65('0x1f')](_0xedc209[_0x4e65('0x33')][_0x4e65('0x1f')]);_0x20d003[_0x4e65('0x1d')]=qs['offset'](_0xedc209[_0x4e65('0x33')]['offset']);}return _0x3f6121['getAnyConditions'](_0x20d003);}})[_0x4e65('0x24')](function(_0x1c8d8a){if(_0x1c8d8a){return _0x1c8d8a?{'count':_0x251303,'rows':_0x1c8d8a}:null;}})[_0x4e65('0x24')](respondWithResult(_0x1d558c,null))[_0x4e65('0x43')](handleError(_0x1d558c,null));};exports['addAction']=function(_0x223bb9,_0x3b4f42,_0x582abb){if(_0x223bb9['body']['id']){delete _0x223bb9[_0x4e65('0x4f')]['id'];}return db[_0x4e65('0x2e')][_0x4e65('0x4c')]({'where':{'id':_0x223bb9[_0x4e65('0x50')]['id']}})[_0x4e65('0x24')](handleEntityNotFound(_0x3b4f42,null))[_0x4e65('0x24')](function(_0x48ed2f){if(_0x48ed2f){_0x223bb9[_0x4e65('0x4f')][_0x4e65('0x5a')]=_0x48ed2f['id'];return db[_0x4e65('0x5b')][_0x4e65('0x49')](_0x223bb9['body']);}})[_0x4e65('0x24')](respondWithResult(_0x3b4f42,null))[_0x4e65('0x43')](handleError(_0x3b4f42,null));};exports[_0x4e65('0x5c')]=function(_0x2d1760,_0x1f2e5c,_0x1496e3){var _0x3ca34f={};var _0x157a1c={};var _0x10e1a9;var _0x54762a;return db['Trigger'][_0x4e65('0x57')]({'where':{'id':_0x2d1760['params']['id']}})[_0x4e65('0x24')](handleEntityNotFound(_0x1f2e5c,null))[_0x4e65('0x24')](function(_0x37518e){if(_0x37518e){_0x10e1a9=_0x37518e;_0x157a1c['model']=_[_0x4e65('0x45')](db[_0x4e65('0x5b')][_0x4e65('0x46')]);_0x157a1c[_0x4e65('0x33')]=_[_0x4e65('0x45')](_0x2d1760['query']);_0x157a1c[_0x4e65('0x34')]=_[_0x4e65('0x35')](_0x157a1c[_0x4e65('0x32')],_0x157a1c['query']);_0x3ca34f[_0x4e65('0x36')]=_['intersection'](_0x157a1c[_0x4e65('0x32')],qs[_0x4e65('0x37')](_0x2d1760[_0x4e65('0x33')][_0x4e65('0x37')]));_0x3ca34f['attributes']=_0x3ca34f['attributes']['length']?_0x3ca34f[_0x4e65('0x36')]:_0x157a1c[_0x4e65('0x32')];_0x3ca34f[_0x4e65('0x3a')]=qs['sort'](_0x2d1760[_0x4e65('0x33')][_0x4e65('0x3b')]);_0x3ca34f[_0x4e65('0x3e')]=qs[_0x4e65('0x34')](_['pick'](_0x2d1760[_0x4e65('0x33')],_0x157a1c[_0x4e65('0x34')]));if(_0x2d1760['query']['filter']){_0x3ca34f[_0x4e65('0x3e')]=_[_0x4e65('0x3f')](_0x3ca34f['where'],{'$or':_[_0x4e65('0x2d')](_0x3ca34f[_0x4e65('0x36')],function(_0x488b4a){var _0x2f1230={};_0x2f1230[_0x488b4a]={'$like':'%'+_0x2d1760[_0x4e65('0x33')][_0x4e65('0x3d')]+'%'};return _0x2f1230;})});}_0x3ca34f=_[_0x4e65('0x3f')]({},_0x3ca34f,_0x2d1760[_0x4e65('0x40')]);return _0x10e1a9[_0x4e65('0x5c')](_0x3ca34f);}})[_0x4e65('0x24')](function(_0x177fbf){if(_0x177fbf){_0x54762a=_0x177fbf[_0x4e65('0x58')];if(!_0x2d1760[_0x4e65('0x33')][_0x4e65('0x38')](_0x4e65('0x39'))){_0x3ca34f[_0x4e65('0x1f')]=qs[_0x4e65('0x1f')](_0x2d1760[_0x4e65('0x33')][_0x4e65('0x1f')]);_0x3ca34f[_0x4e65('0x1d')]=qs['offset'](_0x2d1760['query']['offset']);}return _0x10e1a9[_0x4e65('0x5c')](_0x3ca34f);}})[_0x4e65('0x24')](function(_0x4a95d6){if(_0x4a95d6){return _0x4a95d6?{'count':_0x54762a,'rows':_0x4a95d6}:null;}})[_0x4e65('0x24')](respondWithResult(_0x1f2e5c,null))[_0x4e65('0x43')](handleError(_0x1f2e5c,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d6fd10e..250a358 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 _0x80ce=['moment','request-promise','path','rimraf','define','Trigger','api'];(function(_0xf4d05,_0x5e601f){var _0x47c971=function(_0x17aae3){while(--_0x17aae3){_0xf4d05['push'](_0xf4d05['shift']());}};_0x47c971(++_0x5e601f);}(_0x80ce,0xae));var _0xe80c=function(_0x55e620,_0xee59af){_0x55e620=_0x55e620-0x0;var _0x330dfd=_0x80ce[_0x55e620];return _0x330dfd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe80c('0x0'));var moment=require(_0xe80c('0x1'));var BPromise=require('bluebird');var rp=require(_0xe80c('0x2'));var fs=require('fs');var path=require(_0xe80c('0x3'));var rimraf=require(_0xe80c('0x4'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module['exports']=function(_0x48d62c,_0x19b480){return _0x48d62c[_0xe80c('0x5')](_0xe80c('0x6'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe45=['rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x402203,_0x4f8a71){var _0x40889c=function(_0x45bc02){while(--_0x45bc02){_0x402203['push'](_0x402203['shift']());}};_0x40889c(++_0x4f8a71);}(_0xbe45,0xf0));var _0x5be4=function(_0x12e55f,_0x5ad85f){_0x12e55f=_0x12e55f-0x0;var _0x24db1f=_0xbe45[_0x12e55f];return _0x24db1f;};'use strict';var _=require(_0x5be4('0x0'));var util=require(_0x5be4('0x1'));var logger=require('../../config/logger')(_0x5be4('0x2'));var moment=require(_0x5be4('0x3'));var BPromise=require(_0x5be4('0x4'));var rp=require(_0x5be4('0x5'));var fs=require('fs');var path=require(_0x5be4('0x6'));var rimraf=require(_0x5be4('0x7'));var config=require('../../config/environment');var attributes=require(_0x5be4('0x8'));module[_0x5be4('0x9')]=function(_0x2681c7,_0x2b3c60){return _0x2681c7[_0x5be4('0xa')](_0x5be4('0xb'),attributes,{'tableName':_0x5be4('0xc'),'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 f01248f..0f89919 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 _0x0144=['Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTrigger','debug','ShowTrigger','Trigger','find','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x45fc19,_0x273c70){var _0x2458a7=function(_0xf8219a){while(--_0xf8219a){_0x45fc19['push'](_0x45fc19['shift']());}};_0x2458a7(++_0x273c70);}(_0x0144,0xee));var _0x4014=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x0144[_0x5471ec];return _0x121d4c;};'use strict';var _=require(_0x4014('0x0'));var util=require(_0x4014('0x1'));var moment=require(_0x4014('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4014('0x3'));var db=require(_0x4014('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4014('0x5'))(_0x4014('0x6'));var config=require(_0x4014('0x7'));var jayson=require(_0x4014('0x8'));var client=jayson[_0x4014('0x9')][_0x4014('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24d28d,_0x4b062b,_0x2bf527){return new BPromise(function(_0x5708e4,_0x1d99d2){return client['request'](_0x24d28d,_0x2bf527)['then'](function(_0x5647c3){logger[_0x4014('0xb')](_0x4014('0xc'),_0x4b062b,_0x4014('0xd'));logger['debug'](_0x4014('0xe'),_0x4b062b,'request\x20sent',JSON['stringify'](_0x5647c3));if(_0x5647c3['error']){if(_0x5647c3[_0x4014('0xf')][_0x4014('0x10')]===0x1f4){logger['error'](_0x4014('0xc'),_0x4b062b,_0x5647c3['error']['message']);return _0x1d99d2(_0x5647c3[_0x4014('0xf')][_0x4014('0x11')]);}logger[_0x4014('0xf')](_0x4014('0xc'),_0x4b062b,_0x5647c3['error'][_0x4014('0x11')]);return _0x5708e4(_0x5647c3[_0x4014('0xf')][_0x4014('0x11')]);}else{logger[_0x4014('0xb')]('Trigger,\x20%s,\x20%s',_0x4b062b,'request\x20sent');_0x5708e4(_0x5647c3[_0x4014('0x12')][_0x4014('0x11')]);}})[_0x4014('0x13')](function(_0x3f7d04){logger[_0x4014('0xf')]('Trigger,\x20%s,\x20%s',_0x4b062b,_0x3f7d04);_0x1d99d2(_0x3f7d04);});});}exports['GetTrigger']=function(_0xd87c8e){var _0x3ae8d2=this;return new Promise(function(_0x2f0442,_0x48a05c){return db['Trigger'][_0x4014('0x14')]({'raw':_0xd87c8e[_0x4014('0x15')]?_0xd87c8e[_0x4014('0x15')][_0x4014('0x16')]===undefined?!![]:![]:!![],'where':_0xd87c8e[_0x4014('0x15')]?_0xd87c8e['options'][_0x4014('0x17')]||null:null,'attributes':_0xd87c8e[_0x4014('0x15')]?_0xd87c8e[_0x4014('0x15')][_0x4014('0x18')]||null:null,'limit':_0xd87c8e[_0x4014('0x15')]?_0xd87c8e[_0x4014('0x15')][_0x4014('0x19')]||null:null,'include':_0xd87c8e[_0x4014('0x15')]?_0xd87c8e[_0x4014('0x15')][_0x4014('0x1a')]?_[_0x4014('0x1b')](_0xd87c8e[_0x4014('0x15')][_0x4014('0x1a')],function(_0xd1e1f0){return{'model':db[_0xd1e1f0['model']],'as':_0xd1e1f0['as'],'attributes':_0xd1e1f0['attributes'],'include':_0xd1e1f0[_0x4014('0x1a')]?_[_0x4014('0x1b')](_0xd1e1f0[_0x4014('0x1a')],function(_0x85b96c){return{'model':db[_0x85b96c['model']],'as':_0x85b96c['as'],'attributes':_0x85b96c[_0x4014('0x18')],'include':_0x85b96c[_0x4014('0x1a')]?_[_0x4014('0x1b')](_0x85b96c['include'],function(_0x44181e){return{'model':db[_0x44181e[_0x4014('0x1c')]],'as':_0x44181e['as'],'attributes':_0x44181e[_0x4014('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4014('0x1d')](function(_0x1a3c0b){logger[_0x4014('0xb')](_0x4014('0x1e'),_0xd87c8e);logger[_0x4014('0x1f')](_0x4014('0x1e'),_0xd87c8e,JSON['stringify'](_0x1a3c0b));_0x2f0442(_0x1a3c0b);})[_0x4014('0x13')](function(_0x45d209){logger[_0x4014('0xf')]('GetTrigger',_0x45d209[_0x4014('0x11')],_0xd87c8e);_0x48a05c(_0x3ae8d2[_0x4014('0xf')](0x1f4,_0x45d209[_0x4014('0x11')]));});});};exports[_0x4014('0x20')]=function(_0x9c79b2){var _0x51f58d=this;return new Promise(function(_0xa3ac84,_0x5595da){return db[_0x4014('0x21')][_0x4014('0x22')]({'raw':_0x9c79b2[_0x4014('0x15')]?_0x9c79b2[_0x4014('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x9c79b2['options']?_0x9c79b2[_0x4014('0x15')][_0x4014('0x17')]||null:null,'attributes':_0x9c79b2['options']?_0x9c79b2[_0x4014('0x15')][_0x4014('0x18')]||null:null,'include':_0x9c79b2[_0x4014('0x15')]?_0x9c79b2['options'][_0x4014('0x1a')]?_[_0x4014('0x1b')](_0x9c79b2[_0x4014('0x15')][_0x4014('0x1a')],function(_0x371294){return{'model':db[_0x371294[_0x4014('0x1c')]],'as':_0x371294['as'],'attributes':_0x371294['attributes'],'include':_0x371294[_0x4014('0x1a')]?_[_0x4014('0x1b')](_0x371294[_0x4014('0x1a')],function(_0xc75052){return{'model':db[_0xc75052[_0x4014('0x1c')]],'as':_0xc75052['as'],'attributes':_0xc75052[_0x4014('0x18')],'include':_0xc75052[_0x4014('0x1a')]?_[_0x4014('0x1b')](_0xc75052[_0x4014('0x1a')],function(_0xc3254){return{'model':db[_0xc3254[_0x4014('0x1c')]],'as':_0xc3254['as'],'attributes':_0xc3254[_0x4014('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4014('0x1d')](function(_0x5a6af5){logger['info'](_0x4014('0x20'),_0x9c79b2);logger['debug'](_0x4014('0x20'),_0x9c79b2,JSON[_0x4014('0x23')](_0x5a6af5));_0xa3ac84(_0x5a6af5);})[_0x4014('0x13')](function(_0x1be206){logger['error'](_0x4014('0x20'),_0x1be206[_0x4014('0x11')],_0x9c79b2);_0x5595da(_0x51f58d[_0x4014('0xf')](0x1f4,_0x1be206[_0x4014('0x11')]));});});}; \ No newline at end of file +var _0x65dd=['where','limit','include','map','attributes','model','catch','ShowTrigger','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTrigger','Trigger','findAll','raw','options'];(function(_0x318c82,_0x11762f){var _0x4d9259=function(_0x1e44ac){while(--_0x1e44ac){_0x318c82['push'](_0x318c82['shift']());}};_0x4d9259(++_0x11762f);}(_0x65dd,0x71));var _0xd65d=function(_0x29dfc7,_0x5d32a5){_0x29dfc7=_0x29dfc7-0x0;var _0x22d34a=_0x65dd[_0x29dfc7];return _0x22d34a;};'use strict';var _=require(_0xd65d('0x0'));var util=require('util');var moment=require(_0xd65d('0x1'));var BPromise=require('bluebird');var rs=require(_0xd65d('0x2'));var fs=require('fs');var Redis=require(_0xd65d('0x3'));var db=require(_0xd65d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd65d('0x5'))(_0xd65d('0x6'));var config=require(_0xd65d('0x7'));var jayson=require(_0xd65d('0x8'));var client=jayson[_0xd65d('0x9')][_0xd65d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18a6b9,_0x2ab450,_0xf0617c){return new BPromise(function(_0x164f28,_0x669ea1){return client['request'](_0x18a6b9,_0xf0617c)[_0xd65d('0xb')](function(_0x4d076a){logger[_0xd65d('0xc')](_0xd65d('0xd'),_0x2ab450,'request\x20sent');logger[_0xd65d('0xe')](_0xd65d('0xf'),_0x2ab450,_0xd65d('0x10'),JSON[_0xd65d('0x11')](_0x4d076a));if(_0x4d076a[_0xd65d('0x12')]){if(_0x4d076a[_0xd65d('0x12')][_0xd65d('0x13')]===0x1f4){logger[_0xd65d('0x12')]('Trigger,\x20%s,\x20%s',_0x2ab450,_0x4d076a['error'][_0xd65d('0x14')]);return _0x669ea1(_0x4d076a['error']['message']);}logger['error']('Trigger,\x20%s,\x20%s',_0x2ab450,_0x4d076a['error'][_0xd65d('0x14')]);return _0x164f28(_0x4d076a['error']['message']);}else{logger[_0xd65d('0xc')](_0xd65d('0xd'),_0x2ab450,_0xd65d('0x10'));_0x164f28(_0x4d076a[_0xd65d('0x15')][_0xd65d('0x14')]);}})['catch'](function(_0x421a77){logger[_0xd65d('0x12')](_0xd65d('0xd'),_0x2ab450,_0x421a77);_0x669ea1(_0x421a77);});});}exports[_0xd65d('0x16')]=function(_0x51acc0){var _0x25b0cd=this;return new Promise(function(_0x4136e6,_0x240ce8){return db[_0xd65d('0x17')][_0xd65d('0x18')]({'raw':_0x51acc0['options']?_0x51acc0['options'][_0xd65d('0x19')]===undefined?!![]:![]:!![],'where':_0x51acc0[_0xd65d('0x1a')]?_0x51acc0[_0xd65d('0x1a')][_0xd65d('0x1b')]||null:null,'attributes':_0x51acc0[_0xd65d('0x1a')]?_0x51acc0[_0xd65d('0x1a')]['attributes']||null:null,'limit':_0x51acc0[_0xd65d('0x1a')]?_0x51acc0['options'][_0xd65d('0x1c')]||null:null,'include':_0x51acc0[_0xd65d('0x1a')]?_0x51acc0[_0xd65d('0x1a')][_0xd65d('0x1d')]?_[_0xd65d('0x1e')](_0x51acc0[_0xd65d('0x1a')][_0xd65d('0x1d')],function(_0x186746){return{'model':db[_0x186746['model']],'as':_0x186746['as'],'attributes':_0x186746[_0xd65d('0x1f')],'include':_0x186746['include']?_[_0xd65d('0x1e')](_0x186746[_0xd65d('0x1d')],function(_0x4368e7){return{'model':db[_0x4368e7['model']],'as':_0x4368e7['as'],'attributes':_0x4368e7[_0xd65d('0x1f')],'include':_0x4368e7[_0xd65d('0x1d')]?_[_0xd65d('0x1e')](_0x4368e7[_0xd65d('0x1d')],function(_0x51e0d3){return{'model':db[_0x51e0d3[_0xd65d('0x20')]],'as':_0x51e0d3['as'],'attributes':_0x51e0d3[_0xd65d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd65d('0xb')](function(_0x10c8d1){logger['info'](_0xd65d('0x16'),_0x51acc0);logger['debug']('GetTrigger',_0x51acc0,JSON[_0xd65d('0x11')](_0x10c8d1));_0x4136e6(_0x10c8d1);})[_0xd65d('0x21')](function(_0x502b1b){logger[_0xd65d('0x12')](_0xd65d('0x16'),_0x502b1b[_0xd65d('0x14')],_0x51acc0);_0x240ce8(_0x25b0cd[_0xd65d('0x12')](0x1f4,_0x502b1b['message']));});});};exports[_0xd65d('0x22')]=function(_0x4226c3){var _0x4a67ca=this;return new Promise(function(_0x3b3e30,_0x5ae818){return db[_0xd65d('0x17')]['find']({'raw':_0x4226c3[_0xd65d('0x1a')]?_0x4226c3['options'][_0xd65d('0x19')]===undefined?!![]:![]:!![],'where':_0x4226c3['options']?_0x4226c3[_0xd65d('0x1a')]['where']||null:null,'attributes':_0x4226c3[_0xd65d('0x1a')]?_0x4226c3[_0xd65d('0x1a')][_0xd65d('0x1f')]||null:null,'include':_0x4226c3[_0xd65d('0x1a')]?_0x4226c3[_0xd65d('0x1a')][_0xd65d('0x1d')]?_[_0xd65d('0x1e')](_0x4226c3[_0xd65d('0x1a')][_0xd65d('0x1d')],function(_0x4f2af1){return{'model':db[_0x4f2af1['model']],'as':_0x4f2af1['as'],'attributes':_0x4f2af1[_0xd65d('0x1f')],'include':_0x4f2af1[_0xd65d('0x1d')]?_[_0xd65d('0x1e')](_0x4f2af1[_0xd65d('0x1d')],function(_0x4a4e31){return{'model':db[_0x4a4e31[_0xd65d('0x20')]],'as':_0x4a4e31['as'],'attributes':_0x4a4e31['attributes'],'include':_0x4a4e31['include']?_[_0xd65d('0x1e')](_0x4a4e31[_0xd65d('0x1d')],function(_0x5f14d8){return{'model':db[_0x5f14d8['model']],'as':_0x5f14d8['as'],'attributes':_0x5f14d8[_0xd65d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd65d('0xb')](function(_0x3a76da){logger['info'](_0xd65d('0x22'),_0x4226c3);logger[_0xd65d('0xe')]('ShowTrigger',_0x4226c3,JSON[_0xd65d('0x11')](_0x3a76da));_0x3b3e30(_0x3a76da);})[_0xd65d('0x21')](function(_0x3cfebb){logger['error'](_0xd65d('0x22'),_0x3cfebb[_0xd65d('0x14')],_0x4226c3);_0x5ae818(_0x4a67ca[_0xd65d('0x12')](0x1f4,_0x3cfebb['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5e8869f..eef966b 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 _0xfd54=['create','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','/:id/clone','clone'];(function(_0x521b8c,_0x39ca83){var _0x5a617f=function(_0x1ee75f){while(--_0x1ee75f){_0x521b8c['push'](_0x521b8c['shift']());}};_0x5a617f(++_0x39ca83);}(_0xfd54,0x10e));var _0x4fd5=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0xfd54[_0xa8b370];return _0x643e37;};'use strict';var multer=require(_0x4fd5('0x0'));var util=require(_0x4fd5('0x1'));var path=require(_0x4fd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x4fd5('0x3'));var router=express[_0x4fd5('0x4')]();var fs_extra=require(_0x4fd5('0x5'));var auth=require(_0x4fd5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4fd5('0x7'));var controller=require(_0x4fd5('0x8'));router[_0x4fd5('0x9')]('/',auth[_0x4fd5('0xa')](),controller[_0x4fd5('0xb')]);router[_0x4fd5('0x9')]('/:id',auth[_0x4fd5('0xa')](),controller[_0x4fd5('0xc')]);router[_0x4fd5('0xd')](_0x4fd5('0xe'),auth[_0x4fd5('0xa')](),controller[_0x4fd5('0xf')]);router[_0x4fd5('0xd')]('/',auth['isAuthenticated'](),controller[_0x4fd5('0x10')]);router['put'](_0x4fd5('0x11'),auth[_0x4fd5('0xa')](),controller[_0x4fd5('0x12')]);router[_0x4fd5('0x13')]('/:id',auth[_0x4fd5('0xa')](),controller[_0x4fd5('0x14')]);module[_0x4fd5('0x15')]=router; \ No newline at end of file +var _0x150d=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/clone','clone','post','create','put','update'];(function(_0x107cff,_0x2b0a26){var _0x41594f=function(_0x3cfb2f){while(--_0x3cfb2f){_0x107cff['push'](_0x107cff['shift']());}};_0x41594f(++_0x2b0a26);}(_0x150d,0x6a));var _0xd150=function(_0x566168,_0x4c39af){_0x566168=_0x566168-0x0;var _0x4e1f7a=_0x150d[_0x566168];return _0x4e1f7a;};'use strict';var multer=require(_0xd150('0x0'));var util=require(_0xd150('0x1'));var path=require(_0xd150('0x2'));var timeout=require(_0xd150('0x3'));var express=require(_0xd150('0x4'));var router=express[_0xd150('0x5')]();var fs_extra=require(_0xd150('0x6'));var auth=require(_0xd150('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd150('0x8'));var controller=require('./trunk.controller');router['get']('/',auth[_0xd150('0x9')](),controller[_0xd150('0xa')]);router[_0xd150('0xb')](_0xd150('0xc'),auth['isAuthenticated'](),controller[_0xd150('0xd')]);router['post'](_0xd150('0xe'),auth[_0xd150('0x9')](),controller[_0xd150('0xf')]);router[_0xd150('0x10')]('/',auth['isAuthenticated'](),controller[_0xd150('0x11')]);router[_0xd150('0x12')](_0xd150('0xc'),auth[_0xd150('0x9')](),controller[_0xd150('0x13')]);router['delete'](_0xd150('0xc'),auth[_0xd150('0x9')](),controller[_0xd150('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 63a59ab..236c1af 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 _0x85ea=['peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','yes','update','outgoing','join','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uas','certificate','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0x85ea,0x8d));var _0xa85e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x85ea[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0xa85e('0x0'));module[_0xa85e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa85e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x4'),_0xa85e('0x5'),_0xa85e('0x6')),'allowNull':![],'defaultValue':_0xa85e('0x4')},'context':{'type':Sequelize[_0xa85e('0x7')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xa85e('0x8'),_0xa85e('0x9'),_0xa85e('0xa'),'ALLOWED',_0xa85e('0xb'),_0xa85e('0xc'),_0xa85e('0xd'),_0xa85e('0xe'))},'deny':{'type':Sequelize[_0xa85e('0x7')]},'permit':{'type':Sequelize[_0xa85e('0x7')]},'secret':{'type':Sequelize[_0xa85e('0x7')]},'md5secret':{'type':Sequelize[_0xa85e('0x7')]},'remotesecret':{'type':Sequelize[_0xa85e('0x7')]},'transport':{'type':Sequelize[_0xa85e('0x7')],'defaultValue':_0xa85e('0xf'),'set':function(_0x391002){this['setDataValue'](_0xa85e('0x10'),_0x391002?_0x391002['join'](','):null);},'get':function(){return this[_0xa85e('0x11')](_0xa85e('0x10'))?this['getDataValue']('transport')['split'](','):null;},'comment':_0xa85e('0x12')},'dtmfmode':{'type':Sequelize[_0xa85e('0x3')]('rfc2833','info',_0xa85e('0x13'),_0xa85e('0x14'),_0xa85e('0x15')),'defaultValue':_0xa85e('0x16')},'directmedia':{'type':Sequelize['ENUM'](_0xa85e('0x17'),'no','nonat',_0xa85e('0x18'),_0xa85e('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa85e('0x7')]},'directmediadeny':{'type':Sequelize[_0xa85e('0x7')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x3ae4ec){this['setDataValue']('nat',_0x3ae4ec?_0x3ae4ec[_0xa85e('0x1a')](','):null);},'get':function(){return this[_0xa85e('0x11')](_0xa85e('0x1b'))?this[_0xa85e('0x11')](_0xa85e('0x1b'))[_0xa85e('0x1c')](','):null;},'comment':_0xa85e('0x1d')},'callgroup':{'type':Sequelize[_0xa85e('0x7')]},'namedcallgroup':{'type':Sequelize[_0xa85e('0x7')]},'pickupgroup':{'type':Sequelize[_0xa85e('0x7')]},'namedpickupgroup':{'type':Sequelize[_0xa85e('0x7')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa85e('0x7')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa85e('0x7')],'defaultValue':_0xa85e('0x1e')},'allow':{'type':Sequelize[_0xa85e('0x7')],'allowNull':![],'defaultValue':_0xa85e('0x1f'),'set':function(_0x1c9c90){this[_0xa85e('0x20')](_0xa85e('0x21'),_0x1c9c90?_0x1c9c90[_0xa85e('0x1a')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xa85e('0x11')](_0xa85e('0x21'))?this[_0xa85e('0x11')](_0xa85e('0x21'))[_0xa85e('0x1c')](';'):null;},'comment':_0xa85e('0x22')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0xa85e('0x7')],'defaultValue':'port,invite','set':function(_0x1efde4){this[_0xa85e('0x20')](_0xa85e('0x23'),_0x1efde4?_0x1efde4[_0xa85e('0x1a')](','):null);},'get':function(){return this[_0xa85e('0x11')]('insecure')?this[_0xa85e('0x11')](_0xa85e('0x23'))[_0xa85e('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0xa85e('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no',_0xa85e('0x24'))},'promiscredir':{'type':Sequelize[_0xa85e('0x3')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0xa85e('0x17'),'no')},'accountcode':{'type':Sequelize[_0xa85e('0x25')](0xb)},'setvar':{'type':Sequelize[_0xa85e('0x7')]},'callerid':{'type':Sequelize[_0xa85e('0x7')],'defaultValue':_0xa85e('0x26')},'amaflags':{'type':Sequelize[_0xa85e('0x7')]},'callcounter':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no'),'defaultValue':_0xa85e('0x17')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xa85e('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0xa85e('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xa85e('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xa85e('0x7')]},'template':{'type':Sequelize[_0xa85e('0x7')]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xa85e('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa85e('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no')},'mailbox':{'type':Sequelize[_0xa85e('0x7')]},'session_timers':{'type':Sequelize['ENUM'](_0xa85e('0x28'),_0xa85e('0x29'),'originate')},'session_expires':{'type':Sequelize[_0xa85e('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xa85e('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xa85e('0x2a')),'defaultValue':_0xa85e('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xa85e('0x7')]},'regexten':{'type':Sequelize[_0xa85e('0x7')]},'fromdomain':{'type':Sequelize[_0xa85e('0x7')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xa85e('0x25')](0x5)},'qualify':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xa85e('0x25')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xa85e('0x7')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa85e('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa85e('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xa85e('0x17'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xa85e('0x7')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xa85e('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xa85e('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xa85e('0x7')]},'contactdeny':{'type':Sequelize[_0xa85e('0x7')]},'contactacl':{'type':Sequelize[_0xa85e('0x7')]},'unsolicited_mailbox':{'type':Sequelize[_0xa85e('0x7')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xa85e('0x17'),'no')},'icesupport':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no','fingerprint',_0xa85e('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xa85e('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa85e('0x7')]},'dtlsprivatekey':{'type':Sequelize[_0xa85e('0x7')]},'dtlscipher':{'type':Sequelize[_0xa85e('0x7')]},'dtlscafile':{'type':Sequelize[_0xa85e('0x7')]},'dtlscapath':{'type':Sequelize[_0xa85e('0x7')]},'dtlssetup':{'type':Sequelize['ENUM']('active','passive',_0xa85e('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa85e('0x7')]},'usereqphone':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xa85e('0x7')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no')},'vmexten':{'type':Sequelize[_0xa85e('0x7')]},'mohinterpret':{'type':Sequelize[_0xa85e('0x7')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xa85e('0x7')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0xa85e('0x2d')},'canreinvite':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x17'),'no',_0xa85e('0x2e'),_0xa85e('0x18'),_0xa85e('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa85e('0x7')]},'otherFields':{'type':Sequelize[_0xa85e('0x7')]},'active':{'type':Sequelize[_0xa85e('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa85e('0x7')],'defaultValue':'no'}}; \ No newline at end of file +var _0x17dd=['certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','INTEGER','pai','fingerprint'];(function(_0x3dbd10,_0x4d631f){var _0x39f5ed=function(_0x464394){while(--_0x464394){_0x3dbd10['push'](_0x3dbd10['shift']());}};_0x39f5ed(++_0x4d631f);}(_0x17dd,0x177));var _0xd17d=function(_0x1619cf,_0x20ed6e){_0x1619cf=_0x1619cf-0x0;var _0x36e7d7=_0x17dd[_0x1619cf];return _0x36e7d7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd17d('0x0')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x2'),_0xd17d('0x3'),_0xd17d('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xd17d('0x0')],'allowNull':![],'defaultValue':_0xd17d('0x5')},'callingpres':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x6'),'ALLOWED_PASSED_SCREEN',_0xd17d('0x7'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xd17d('0x8'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xd17d('0x0')]},'secret':{'type':Sequelize[_0xd17d('0x0')]},'md5secret':{'type':Sequelize[_0xd17d('0x0')]},'remotesecret':{'type':Sequelize[_0xd17d('0x0')]},'transport':{'type':Sequelize[_0xd17d('0x0')],'defaultValue':_0xd17d('0x9'),'set':function(_0x57b368){this[_0xd17d('0xa')](_0xd17d('0xb'),_0x57b368?_0x57b368['join'](','):null);},'get':function(){return this[_0xd17d('0xc')]('transport')?this[_0xd17d('0xc')]('transport')['split'](','):null;},'comment':_0xd17d('0xd')},'dtmfmode':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0xe'),'info',_0xd17d('0xf'),'inband','auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xd17d('0x10'),'no',_0xd17d('0x11'),_0xd17d('0x12'),_0xd17d('0x13')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xd17d('0x10'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd17d('0x0')]},'directmediadeny':{'type':Sequelize[_0xd17d('0x0')]},'nat':{'type':Sequelize[_0xd17d('0x0')],'defaultValue':_0xd17d('0x14'),'set':function(_0x3a1c32){this[_0xd17d('0xa')](_0xd17d('0x15'),_0x3a1c32?_0x3a1c32['join'](','):null);},'get':function(){return this[_0xd17d('0xc')]('nat')?this[_0xd17d('0xc')](_0xd17d('0x15'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xd17d('0x0')]},'namedcallgroup':{'type':Sequelize[_0xd17d('0x0')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xd17d('0x0')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd17d('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd17d('0x0')],'defaultValue':_0xd17d('0x16')},'allow':{'type':Sequelize[_0xd17d('0x0')],'allowNull':![],'defaultValue':_0xd17d('0x17'),'set':function(_0x175803){this['setDataValue'](_0xd17d('0x18'),_0x175803?_0x175803['join'](';'):_0xd17d('0x17'));},'get':function(){return this['getDataValue'](_0xd17d('0x18'))?this[_0xd17d('0xc')]('allow')[_0xd17d('0x19')](';'):null;},'comment':_0xd17d('0x1a')},'autoframing':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no')},'insecure':{'type':Sequelize[_0xd17d('0x0')],'defaultValue':_0xd17d('0x1b'),'set':function(_0x1c98d7){this[_0xd17d('0xa')](_0xd17d('0x1c'),_0x1c98d7?_0x1c98d7['join'](','):null);},'get':function(){return this[_0xd17d('0xc')](_0xd17d('0x1c'))?this['getDataValue'](_0xd17d('0x1c'))[_0xd17d('0x19')](','):null;},'comment':_0xd17d('0x1d')},'trustrpid':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no','never')},'promiscredir':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no')},'useclientcode':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xd17d('0x0')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xd17d('0x1e')},'amaflags':{'type':Sequelize[_0xd17d('0x0')]},'callcounter':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no'),'defaultValue':_0xd17d('0x10')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xd17d('0x1')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xd17d('0x1')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xd17d('0x10'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xd17d('0x10'),'no')},'subscribecontext':{'type':Sequelize[_0xd17d('0x0')]},'template':{'type':Sequelize[_0xd17d('0x0')]},'videosupport':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xd17d('0x10'),'no')},'mailbox':{'type':Sequelize[_0xd17d('0x0')]},'session_timers':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x1f'),_0xd17d('0x20'),_0xd17d('0x21'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x22'),'uas'),'defaultValue':_0xd17d('0x23')},'t38pt_usertpsource':{'type':Sequelize[_0xd17d('0x0')]},'regexten':{'type':Sequelize[_0xd17d('0x0')]},'fromdomain':{'type':Sequelize[_0xd17d('0x0')]},'fromuser':{'type':Sequelize[_0xd17d('0x0')]},'port':{'type':Sequelize[_0xd17d('0x24')](0x5)},'qualify':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no'),'defaultValue':_0xd17d('0x10')},'keepalive':{'type':Sequelize[_0xd17d('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xd17d('0x0')]},'defaultuser':{'type':Sequelize[_0xd17d('0x0')]},'rtptimeout':{'type':Sequelize[_0xd17d('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd17d('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no',_0xd17d('0x25')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd17d('0x0')]},'callbackextension':{'type':Sequelize[_0xd17d('0x0')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xd17d('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xd17d('0x0')]},'contactdeny':{'type':Sequelize[_0xd17d('0x0')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xd17d('0x0')]},'use_q850_reason':{'type':Sequelize[_0xd17d('0x0')]},'maxforwards':{'type':Sequelize[_0xd17d('0x24')](0xb)},'encryption':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no')},'force_avp':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no')},'icesupport':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no')},'dtlsenable':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no')},'dtlsverify':{'type':Sequelize[_0xd17d('0x1')]('yes','no',_0xd17d('0x26'),_0xd17d('0x27'))},'dtlsrekey':{'type':Sequelize[_0xd17d('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd17d('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0xd17d('0x0')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xd17d('0x0')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xd17d('0x28'),_0xd17d('0x29'),_0xd17d('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd17d('0x0')]},'usereqphone':{'type':Sequelize['ENUM'](_0xd17d('0x10'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd17d('0x0')]},'recordofffeature':{'type':Sequelize[_0xd17d('0x0')]},'call_limit':{'type':Sequelize[_0xd17d('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xd17d('0x10'),'no')},'subscribemwi':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no')},'vmexten':{'type':Sequelize[_0xd17d('0x0')]},'mohinterpret':{'type':Sequelize[_0xd17d('0x0')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xd17d('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0xd17d('0x2b')},'canreinvite':{'type':Sequelize[_0xd17d('0x1')](_0xd17d('0x10'),'no',_0xd17d('0x11'),_0xd17d('0x12'),_0xd17d('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd17d('0x0')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xd17d('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd17d('0x0')],'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 bb98313..d5e3cc8 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 _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x353635,_0x282f23){var _0x1839d4=function(_0x11157e){while(--_0x11157e){_0x353635['push'](_0x353635['shift']());}};_0x1839d4(++_0x282f23);}(_0xedd9,0xfc));var _0x9edd=function(_0x33dccb,_0x416f33){_0x33dccb=_0x33dccb-0x0;var _0x20df89=_0xedd9[_0x33dccb];return _0x20df89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file +var _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x5e6ebe,_0x373752){var _0x5d80a0=function(_0x145677){while(--_0x145677){_0x5e6ebe['push'](_0x5e6ebe['shift']());}};_0x5d80a0(++_0x373752);}(_0x9bde,0xe1));var _0xe9bd=function(_0xd4642d,_0x1e261e){_0xd4642d=_0xd4642d-0x0;var _0x2c2ba7=_0x9bde[_0xd4642d];return _0x2c2ba7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1517c9f..cdc492f 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 _0x1daa=['define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./trunk.attributes','exports'];(function(_0x172264,_0xecae8c){var _0x3f254c=function(_0xf60453){while(--_0xf60453){_0x172264['push'](_0x172264['shift']());}};_0x3f254c(++_0xecae8c);}(_0x1daa,0xac));var _0xa1da=function(_0x2f0bf1,_0x183ef1){_0x2f0bf1=_0x2f0bf1-0x0;var _0xf1df38=_0x1daa[_0x2f0bf1];return _0xf1df38;};'use strict';var _=require(_0xa1da('0x0'));var util=require(_0xa1da('0x1'));var logger=require(_0xa1da('0x2'))(_0xa1da('0x3'));var moment=require(_0xa1da('0x4'));var BPromise=require('bluebird');var rp=require(_0xa1da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1da('0x6'));var config=require(_0xa1da('0x7'));var attributes=require(_0xa1da('0x8'));module[_0xa1da('0x9')]=function(_0x16435b,_0x5593db){return _0x16435b[_0xa1da('0xa')](_0xa1da('0xb'),attributes,{'tableName':_0xa1da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf447=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash'];(function(_0x2c3e77,_0x2ee981){var _0x1dd9e8=function(_0x37c3f8){while(--_0x37c3f8){_0x2c3e77['push'](_0x2c3e77['shift']());}};_0x1dd9e8(++_0x2ee981);}(_0xf447,0x1e9));var _0x7f44=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xf447[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x7f44('0x0'));var util=require(_0x7f44('0x1'));var logger=require(_0x7f44('0x2'))(_0x7f44('0x3'));var moment=require(_0x7f44('0x4'));var BPromise=require(_0x7f44('0x5'));var rp=require(_0x7f44('0x6'));var fs=require('fs');var path=require(_0x7f44('0x7'));var rimraf=require(_0x7f44('0x8'));var config=require(_0x7f44('0x9'));var attributes=require(_0x7f44('0xa'));module[_0x7f44('0xb')]=function(_0x2ef469,_0xda1f4a){return _0x2ef469[_0x7f44('0xc')]('Trunk',attributes,{'tableName':_0x7f44('0xd'),'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 59cbd6a..0ee6c95 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 _0x19a5=['where','limit','include','map','model','attributes','GetTrunk','Trunk','find','raw','ShowTrunk','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','findAll','options'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x19a5,0x1d9));var _0x519a=function(_0x2602d6,_0xc35133){_0x2602d6=_0x2602d6-0x0;var _0x219c4e=_0x19a5[_0x2602d6];return _0x219c4e;};'use strict';var _=require(_0x519a('0x0'));var util=require(_0x519a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x519a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x519a('0x3'));var logger=require(_0x519a('0x4'))(_0x519a('0x5'));var config=require(_0x519a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x519a('0x7')][_0x519a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2980f9,_0x3da5eb,_0x5426d1){return new BPromise(function(_0x21cef2,_0x3f2cc9){return client[_0x519a('0x9')](_0x2980f9,_0x5426d1)[_0x519a('0xa')](function(_0x36116e){logger[_0x519a('0xb')](_0x519a('0xc'),_0x3da5eb,_0x519a('0xd'));logger[_0x519a('0xe')](_0x519a('0xf'),_0x3da5eb,'request\x20sent',JSON[_0x519a('0x10')](_0x36116e));if(_0x36116e[_0x519a('0x11')]){if(_0x36116e[_0x519a('0x11')]['code']===0x1f4){logger[_0x519a('0x11')](_0x519a('0xc'),_0x3da5eb,_0x36116e['error']['message']);return _0x3f2cc9(_0x36116e[_0x519a('0x11')]['message']);}logger[_0x519a('0x11')](_0x519a('0xc'),_0x3da5eb,_0x36116e[_0x519a('0x11')][_0x519a('0x12')]);return _0x21cef2(_0x36116e[_0x519a('0x11')][_0x519a('0x12')]);}else{logger[_0x519a('0xb')](_0x519a('0xc'),_0x3da5eb,_0x519a('0xd'));_0x21cef2(_0x36116e['result'][_0x519a('0x12')]);}})[_0x519a('0x13')](function(_0x55ebb1){logger[_0x519a('0x11')](_0x519a('0xc'),_0x3da5eb,_0x55ebb1);_0x3f2cc9(_0x55ebb1);});});}exports['GetTrunk']=function(_0x56ccfd){var _0x570c83=this;return new Promise(function(_0x493600,_0x37e057){return db['Trunk'][_0x519a('0x14')]({'raw':_0x56ccfd[_0x519a('0x15')]?_0x56ccfd[_0x519a('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x56ccfd[_0x519a('0x15')]?_0x56ccfd[_0x519a('0x15')][_0x519a('0x16')]||null:null,'attributes':_0x56ccfd[_0x519a('0x15')]?_0x56ccfd[_0x519a('0x15')]['attributes']||null:null,'limit':_0x56ccfd[_0x519a('0x15')]?_0x56ccfd[_0x519a('0x15')][_0x519a('0x17')]||null:null,'include':_0x56ccfd['options']?_0x56ccfd[_0x519a('0x15')][_0x519a('0x18')]?_[_0x519a('0x19')](_0x56ccfd[_0x519a('0x15')]['include'],function(_0x577f88){return{'model':db[_0x577f88[_0x519a('0x1a')]],'as':_0x577f88['as'],'attributes':_0x577f88[_0x519a('0x1b')],'include':_0x577f88[_0x519a('0x18')]?_[_0x519a('0x19')](_0x577f88['include'],function(_0x3f16a8){return{'model':db[_0x3f16a8[_0x519a('0x1a')]],'as':_0x3f16a8['as'],'attributes':_0x3f16a8[_0x519a('0x1b')],'include':_0x3f16a8[_0x519a('0x18')]?_[_0x519a('0x19')](_0x3f16a8[_0x519a('0x18')],function(_0x1f924a){return{'model':db[_0x1f924a['model']],'as':_0x1f924a['as'],'attributes':_0x1f924a['attributes']};}):[]};}):[]};}):[]:[]})[_0x519a('0xa')](function(_0x5cc7a2){logger[_0x519a('0xb')](_0x519a('0x1c'),_0x56ccfd);logger[_0x519a('0xe')]('GetTrunk',_0x56ccfd,JSON[_0x519a('0x10')](_0x5cc7a2));_0x493600(_0x5cc7a2);})[_0x519a('0x13')](function(_0x4598e1){logger[_0x519a('0x11')]('GetTrunk',_0x4598e1[_0x519a('0x12')],_0x56ccfd);_0x37e057(_0x570c83['error'](0x1f4,_0x4598e1[_0x519a('0x12')]));});});};exports['ShowTrunk']=function(_0x5b09ad){var _0x32b2bf=this;return new Promise(function(_0x3cb2d7,_0x48dbbd){return db[_0x519a('0x1d')][_0x519a('0x1e')]({'raw':_0x5b09ad[_0x519a('0x15')]?_0x5b09ad[_0x519a('0x15')][_0x519a('0x1f')]===undefined?!![]:![]:!![],'where':_0x5b09ad[_0x519a('0x15')]?_0x5b09ad[_0x519a('0x15')][_0x519a('0x16')]||null:null,'attributes':_0x5b09ad['options']?_0x5b09ad[_0x519a('0x15')][_0x519a('0x1b')]||null:null,'include':_0x5b09ad[_0x519a('0x15')]?_0x5b09ad[_0x519a('0x15')]['include']?_[_0x519a('0x19')](_0x5b09ad[_0x519a('0x15')]['include'],function(_0x478367){return{'model':db[_0x478367[_0x519a('0x1a')]],'as':_0x478367['as'],'attributes':_0x478367[_0x519a('0x1b')],'include':_0x478367[_0x519a('0x18')]?_['map'](_0x478367[_0x519a('0x18')],function(_0x3d42f2){return{'model':db[_0x3d42f2[_0x519a('0x1a')]],'as':_0x3d42f2['as'],'attributes':_0x3d42f2[_0x519a('0x1b')],'include':_0x3d42f2[_0x519a('0x18')]?_[_0x519a('0x19')](_0x3d42f2[_0x519a('0x18')],function(_0x527390){return{'model':db[_0x527390[_0x519a('0x1a')]],'as':_0x527390['as'],'attributes':_0x527390[_0x519a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x519a('0xa')](function(_0x674b6e){logger['info'](_0x519a('0x20'),_0x5b09ad);logger[_0x519a('0xe')]('ShowTrunk',_0x5b09ad,JSON['stringify'](_0x674b6e));_0x3cb2d7(_0x674b6e);})[_0x519a('0x13')](function(_0xfae734){logger[_0x519a('0x11')]('ShowTrunk',_0xfae734[_0x519a('0x12')],_0x5b09ad);_0x48dbbd(_0x32b2bf[_0x519a('0x11')](0x1f4,_0xfae734[_0x519a('0x12')]));});});}; \ No newline at end of file +var _0x954e=['code','Trunk,\x20%s,\x20%s','message','info','result','GetTrunk','Trunk','findAll','options','raw','attributes','limit','map','include','model','catch','ShowTrunk','where','util','moment','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x41bcdf,_0x242cae){var _0xfd7d88=function(_0x4fd7b5){while(--_0x4fd7b5){_0x41bcdf['push'](_0x41bcdf['shift']());}};_0xfd7d88(++_0x242cae);}(_0x954e,0x15c));var _0xe954=function(_0x47087a,_0x5ef3c6){_0x47087a=_0x47087a-0x0;var _0x28fdf1=_0x954e[_0x47087a];return _0x28fdf1;};'use strict';var _=require('lodash');var util=require(_0xe954('0x0'));var moment=require(_0xe954('0x1'));var BPromise=require('bluebird');var rs=require(_0xe954('0x2'));var fs=require('fs');var Redis=require(_0xe954('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe954('0x4'));var config=require('../../config/environment');var jayson=require(_0xe954('0x5'));var client=jayson[_0xe954('0x6')][_0xe954('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35ce1f,_0x286eab,_0x50e683){return new BPromise(function(_0x4afaee,_0x3ab8fc){return client[_0xe954('0x8')](_0x35ce1f,_0x50e683)[_0xe954('0x9')](function(_0x478dab){logger['info']('Trunk,\x20%s,\x20%s',_0x286eab,_0xe954('0xa'));logger[_0xe954('0xb')](_0xe954('0xc'),_0x286eab,_0xe954('0xa'),JSON[_0xe954('0xd')](_0x478dab));if(_0x478dab[_0xe954('0xe')]){if(_0x478dab['error'][_0xe954('0xf')]===0x1f4){logger['error'](_0xe954('0x10'),_0x286eab,_0x478dab[_0xe954('0xe')][_0xe954('0x11')]);return _0x3ab8fc(_0x478dab[_0xe954('0xe')][_0xe954('0x11')]);}logger[_0xe954('0xe')](_0xe954('0x10'),_0x286eab,_0x478dab[_0xe954('0xe')][_0xe954('0x11')]);return _0x4afaee(_0x478dab['error']['message']);}else{logger[_0xe954('0x12')]('Trunk,\x20%s,\x20%s',_0x286eab,_0xe954('0xa'));_0x4afaee(_0x478dab[_0xe954('0x13')]['message']);}})['catch'](function(_0x50154d){logger[_0xe954('0xe')](_0xe954('0x10'),_0x286eab,_0x50154d);_0x3ab8fc(_0x50154d);});});}exports[_0xe954('0x14')]=function(_0x5a68e0){var _0xc46af3=this;return new Promise(function(_0x1adb3b,_0x4af3dc){return db[_0xe954('0x15')][_0xe954('0x16')]({'raw':_0x5a68e0[_0xe954('0x17')]?_0x5a68e0['options'][_0xe954('0x18')]===undefined?!![]:![]:!![],'where':_0x5a68e0[_0xe954('0x17')]?_0x5a68e0[_0xe954('0x17')]['where']||null:null,'attributes':_0x5a68e0['options']?_0x5a68e0[_0xe954('0x17')][_0xe954('0x19')]||null:null,'limit':_0x5a68e0['options']?_0x5a68e0[_0xe954('0x17')][_0xe954('0x1a')]||null:null,'include':_0x5a68e0[_0xe954('0x17')]?_0x5a68e0[_0xe954('0x17')]['include']?_[_0xe954('0x1b')](_0x5a68e0[_0xe954('0x17')][_0xe954('0x1c')],function(_0x4e6f2f){return{'model':db[_0x4e6f2f[_0xe954('0x1d')]],'as':_0x4e6f2f['as'],'attributes':_0x4e6f2f[_0xe954('0x19')],'include':_0x4e6f2f[_0xe954('0x1c')]?_[_0xe954('0x1b')](_0x4e6f2f[_0xe954('0x1c')],function(_0x453ba9){return{'model':db[_0x453ba9['model']],'as':_0x453ba9['as'],'attributes':_0x453ba9[_0xe954('0x19')],'include':_0x453ba9[_0xe954('0x1c')]?_[_0xe954('0x1b')](_0x453ba9['include'],function(_0x5786d7){return{'model':db[_0x5786d7[_0xe954('0x1d')]],'as':_0x5786d7['as'],'attributes':_0x5786d7[_0xe954('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56943b){logger[_0xe954('0x12')](_0xe954('0x14'),_0x5a68e0);logger[_0xe954('0xb')](_0xe954('0x14'),_0x5a68e0,JSON[_0xe954('0xd')](_0x56943b));_0x1adb3b(_0x56943b);})[_0xe954('0x1e')](function(_0x489393){logger[_0xe954('0xe')](_0xe954('0x14'),_0x489393['message'],_0x5a68e0);_0x4af3dc(_0xc46af3[_0xe954('0xe')](0x1f4,_0x489393[_0xe954('0x11')]));});});};exports[_0xe954('0x1f')]=function(_0x338561){var _0x5acbc2=this;return new Promise(function(_0x1d8fea,_0x5f51b4){return db[_0xe954('0x15')]['find']({'raw':_0x338561['options']?_0x338561[_0xe954('0x17')][_0xe954('0x18')]===undefined?!![]:![]:!![],'where':_0x338561[_0xe954('0x17')]?_0x338561[_0xe954('0x17')][_0xe954('0x20')]||null:null,'attributes':_0x338561[_0xe954('0x17')]?_0x338561['options'][_0xe954('0x19')]||null:null,'include':_0x338561[_0xe954('0x17')]?_0x338561['options'][_0xe954('0x1c')]?_[_0xe954('0x1b')](_0x338561[_0xe954('0x17')][_0xe954('0x1c')],function(_0x19ef36){return{'model':db[_0x19ef36[_0xe954('0x1d')]],'as':_0x19ef36['as'],'attributes':_0x19ef36[_0xe954('0x19')],'include':_0x19ef36[_0xe954('0x1c')]?_[_0xe954('0x1b')](_0x19ef36[_0xe954('0x1c')],function(_0x34f771){return{'model':db[_0x34f771[_0xe954('0x1d')]],'as':_0x34f771['as'],'attributes':_0x34f771[_0xe954('0x19')],'include':_0x34f771['include']?_['map'](_0x34f771[_0xe954('0x1c')],function(_0x31c915){return{'model':db[_0x31c915[_0xe954('0x1d')]],'as':_0x31c915['as'],'attributes':_0x31c915['attributes']};}):[]};}):[]};}):[]:[]})[_0xe954('0x9')](function(_0x291b44){logger[_0xe954('0x12')](_0xe954('0x1f'),_0x338561);logger['debug'](_0xe954('0x1f'),_0x338561,JSON[_0xe954('0xd')](_0x291b44));_0x1d8fea(_0x291b44);})[_0xe954('0x1e')](function(_0x420dd7){logger[_0xe954('0xe')](_0xe954('0x1f'),_0x420dd7[_0xe954('0x11')],_0x338561);_0x5f51b4(_0x5acbc2[_0xe954('0xe')](0x1f4,_0x420dd7['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index d9e3a1d..c83a6d9 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 _0xf303=['getOpenTabs','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/:id/contacts','addContacts','create','/create_many','join','root','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','/:id/openchannel_accounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar'];(function(_0x1d180e,_0x3829f0){var _0x2c53bd=function(_0x14063a){while(--_0x14063a){_0x1d180e['push'](_0x1d180e['shift']());}};_0x2c53bd(++_0x3829f0);}(_0xf303,0x1b8));var _0x3f30=function(_0x28bf41,_0x492fef){_0x28bf41=_0x28bf41-0x0;var _0x42d9a5=_0xf303[_0x28bf41];return _0x42d9a5;};'use strict';var multer=require('multer');var util=require(_0x3f30('0x0'));var path=require(_0x3f30('0x1'));var timeout=require('connect-timeout');var express=require(_0x3f30('0x2'));var router=express[_0x3f30('0x3')]();var fs_extra=require(_0x3f30('0x4'));var auth=require(_0x3f30('0x5'));var interaction=require(_0x3f30('0x6'));var config=require(_0x3f30('0x7'));var controller=require(_0x3f30('0x8'));router[_0x3f30('0x9')]('/',auth[_0x3f30('0xa')](),controller[_0x3f30('0xb')]);router['get'](_0x3f30('0xc'),auth['isAuthenticated'](),controller[_0x3f30('0xd')]);router[_0x3f30('0x9')](_0x3f30('0xe'),auth[_0x3f30('0xa')](),controller['whoami']);router[_0x3f30('0x9')](_0x3f30('0xf'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x10')]);router[_0x3f30('0x9')](_0x3f30('0x11'),auth[_0x3f30('0xa')](),controller['show']);router[_0x3f30('0x9')](_0x3f30('0x12'),controller[_0x3f30('0x13')]);router[_0x3f30('0x9')]('/:id/open_tabs',auth[_0x3f30('0xa')](),controller[_0x3f30('0x14')]);router[_0x3f30('0x9')]('/:id/contacts',auth[_0x3f30('0xa')](),controller['getContacts']);router[_0x3f30('0x9')](_0x3f30('0x15'),auth['isAuthenticated'](),controller[_0x3f30('0x16')]);router['get'](_0x3f30('0x17'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x18')]);router[_0x3f30('0x9')](_0x3f30('0x19'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x1a')]);router['get'](_0x3f30('0x1b'),auth[_0x3f30('0xa')](),controller['getRecordings']);router[_0x3f30('0x9')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0x3f30('0x1c')]);router[_0x3f30('0x9')](_0x3f30('0x1d'),auth[_0x3f30('0xa')](),controller['getChatInteractions']);router[_0x3f30('0x9')](_0x3f30('0x1e'),auth[_0x3f30('0xa')](),controller['getOpenchannelInteractions']);router['get'](_0x3f30('0x1f'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x20')]);router['get'](_0x3f30('0x21'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x22')]);router[_0x3f30('0x9')](_0x3f30('0x23'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x24')]);router[_0x3f30('0x9')]('/:id/whatsapp/interactions',auth[_0x3f30('0xa')](),controller[_0x3f30('0x25')]);router[_0x3f30('0x9')](_0x3f30('0x26'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x27')]);router[_0x3f30('0x9')](_0x3f30('0x28'),auth[_0x3f30('0xa')](),controller['getLists']);router[_0x3f30('0x9')](_0x3f30('0x29'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x2a')]);router[_0x3f30('0x9')]('/:id/prefixes',auth[_0x3f30('0xa')](),controller['getVoicePrefixes']);router[_0x3f30('0x9')](_0x3f30('0x2b'),auth['isAuthenticated'](),controller[_0x3f30('0x2c')]);router[_0x3f30('0x9')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x3f30('0x2d')]);router[_0x3f30('0x9')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x3f30('0x2e')]);router[_0x3f30('0x9')](_0x3f30('0x2f'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x30')]);router['get'](_0x3f30('0x31'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x32')]);router[_0x3f30('0x9')](_0x3f30('0x33'),auth['isAuthenticated'](),controller[_0x3f30('0x34')]);router[_0x3f30('0x9')](_0x3f30('0x35'),auth[_0x3f30('0xa')](),controller['getSquareProjects']);router[_0x3f30('0x9')](_0x3f30('0x36'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x37')]);router['get']('/:id/api_key',auth[_0x3f30('0xa')](),controller[_0x3f30('0x38')]);router[_0x3f30('0x39')](_0x3f30('0x3a'),auth['isAuthenticated'](),controller[_0x3f30('0x3b')]);router[_0x3f30('0x39')]('/',auth[_0x3f30('0xa')](),controller[_0x3f30('0x3c')]);router['post'](_0x3f30('0x3d'),auth[_0x3f30('0xa')](),controller['bulkCreate']);router[_0x3f30('0x39')](_0x3f30('0x15'),auth[_0x3f30('0xa')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x51d6ce,_0x2b4b59,_0x50af76){_0x50af76(null,path[_0x3f30('0x3e')](config[_0x3f30('0x3f')],_0x3f30('0x40')));},'filename':function(_0x291de1,_0x6f7844,_0x4b1593){_0x4b1593(null,util[_0x3f30('0x41')](_0x3f30('0x42'),Date['now'](),_0x6f7844[_0x3f30('0x43')]));}})});router[_0x3f30('0x39')](_0x3f30('0x12'),upload[_0x3f30('0x44')](_0x3f30('0x45')),controller[_0x3f30('0x46')]);router[_0x3f30('0x39')](_0x3f30('0x47'),auth['isAuthenticated'](),controller[_0x3f30('0x48')]);router[_0x3f30('0x39')](_0x3f30('0x49'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x4a')]);router[_0x3f30('0x39')]('/:id/pause',auth[_0x3f30('0xa')](),controller[_0x3f30('0x4b')]);router[_0x3f30('0x39')](_0x3f30('0x4c'),auth[_0x3f30('0xa')](),controller['unpause']);router[_0x3f30('0x39')](_0x3f30('0x26'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x3f30('0x4d'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x4e')]);router[_0x3f30('0x39')](_0x3f30('0x4f'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x50')]);router[_0x3f30('0x39')](_0x3f30('0x51'),auth[_0x3f30('0xa')](),controller['addFaxInteractions']);router[_0x3f30('0x39')]('/:id/sms_interactions',auth[_0x3f30('0xa')](),controller[_0x3f30('0x52')]);router[_0x3f30('0x39')]('/:id/openchannel_interactions',auth[_0x3f30('0xa')](),controller[_0x3f30('0x53')]);router['post'](_0x3f30('0x54'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x55')]);router[_0x3f30('0x39')]('/:id/fax_accounts',auth[_0x3f30('0xa')](),controller[_0x3f30('0x56')]);router[_0x3f30('0x39')](_0x3f30('0x57'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0x3f30('0x39')]('/:id/openchannel_accounts',auth[_0x3f30('0xa')](),controller[_0x3f30('0x58')]);router['post'](_0x3f30('0x2f'),auth['isAuthenticated'](),controller['addSmsAccounts']);router['post'](_0x3f30('0x31'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x59')]);router[_0x3f30('0x39')](_0x3f30('0x33'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x5a')]);router[_0x3f30('0x39')](_0x3f30('0x35'),auth['isAuthenticated'](),controller[_0x3f30('0x5b')]);router[_0x3f30('0x39')](_0x3f30('0x5c'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x5d')]);router[_0x3f30('0x5e')](_0x3f30('0x11'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x5f')]);router['put'](_0x3f30('0x60'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x61')]);router[_0x3f30('0x62')](_0x3f30('0x15'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x63')]);router[_0x3f30('0x62')](_0x3f30('0x26'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x64')]);router[_0x3f30('0x62')](_0x3f30('0x11'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x65')]);router['delete']('/:id/chat_interactions',auth[_0x3f30('0xa')](),controller[_0x3f30('0x66')]);router[_0x3f30('0x62')](_0x3f30('0x4f'),auth['isAuthenticated'](),controller[_0x3f30('0x67')]);router[_0x3f30('0x62')](_0x3f30('0x51'),auth[_0x3f30('0xa')](),controller['removeFaxInteractions']);router[_0x3f30('0x62')](_0x3f30('0x68'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x69')]);router[_0x3f30('0x62')](_0x3f30('0x6a'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x6b')]);router[_0x3f30('0x62')](_0x3f30('0x54'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x6c')]);router[_0x3f30('0x62')](_0x3f30('0x2b'),auth['isAuthenticated'](),controller[_0x3f30('0x6d')]);router[_0x3f30('0x62')]('/:id/mail_accounts',auth[_0x3f30('0xa')](),controller['removeMailAccounts']);router[_0x3f30('0x62')](_0x3f30('0x6e'),auth[_0x3f30('0xa')](),controller['removeOpenchannelAccounts']);router['delete'](_0x3f30('0x2f'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x6f')]);router[_0x3f30('0x62')](_0x3f30('0x31'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x70')]);router['delete'](_0x3f30('0x33'),auth[_0x3f30('0xa')](),controller['removeWhatsappAccounts']);router[_0x3f30('0x62')](_0x3f30('0x35'),auth[_0x3f30('0xa')](),controller[_0x3f30('0x71')]);router[_0x3f30('0x62')]('/:id/api_key',auth[_0x3f30('0xa')](),controller['removeApiKey']);module[_0x3f30('0x72')]=router; \ No newline at end of file +var _0x3a04=['/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','index','isAuthenticated','describe','/whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','/:id/api_key','getApiKey','addContacts','post','bulkCreate','addQueues','diskStorage','server/files/images/','format','%s-%s','now','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addFaxInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','update','/:id/password','delete','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0x3a04,0x1de));var _0x43a0=function(_0x33466d,_0x4d7e8c){_0x33466d=_0x33466d-0x0;var _0x401b25=_0x3a04[_0x33466d];return _0x401b25;};'use strict';var multer=require(_0x43a0('0x0'));var util=require(_0x43a0('0x1'));var path=require(_0x43a0('0x2'));var timeout=require(_0x43a0('0x3'));var express=require(_0x43a0('0x4'));var router=express[_0x43a0('0x5')]();var fs_extra=require(_0x43a0('0x6'));var auth=require(_0x43a0('0x7'));var interaction=require(_0x43a0('0x8'));var config=require('../../config/environment');var controller=require(_0x43a0('0x9'));router[_0x43a0('0xa')]('/',auth['isAuthenticated'](),controller[_0x43a0('0xb')]);router['get']('/describe',auth[_0x43a0('0xc')](),controller[_0x43a0('0xd')]);router[_0x43a0('0xa')](_0x43a0('0xe'),auth[_0x43a0('0xc')](),controller['whoami']);router[_0x43a0('0xa')](_0x43a0('0xf'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x10')]);router[_0x43a0('0xa')]('/:id',auth[_0x43a0('0xc')](),controller[_0x43a0('0x11')]);router[_0x43a0('0xa')](_0x43a0('0x12'),controller[_0x43a0('0x13')]);router[_0x43a0('0xa')](_0x43a0('0x14'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x15')]);router[_0x43a0('0xa')](_0x43a0('0x16'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x17')]);router[_0x43a0('0xa')](_0x43a0('0x18'),auth[_0x43a0('0xc')](),controller['getQueues']);router[_0x43a0('0xa')](_0x43a0('0x19'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x1a')]);router[_0x43a0('0xa')]('/:id/groups',auth[_0x43a0('0xc')](),controller[_0x43a0('0x1b')]);router[_0x43a0('0xa')](_0x43a0('0x1c'),auth['isAuthenticated'](),controller[_0x43a0('0x1d')]);router[_0x43a0('0xa')]('/:id/screen_recordings',auth[_0x43a0('0xc')](),controller['getScreenRecordings']);router[_0x43a0('0xa')](_0x43a0('0x1e'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x1f')]);router[_0x43a0('0xa')](_0x43a0('0x20'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x21')]);router[_0x43a0('0xa')]('/:id/mail/interactions',auth[_0x43a0('0xc')](),controller[_0x43a0('0x22')]);router['get'](_0x43a0('0x23'),auth['isAuthenticated'](),controller['getSmsInteractions']);router['get'](_0x43a0('0x24'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x25')]);router[_0x43a0('0xa')]('/:id/whatsapp/interactions',auth[_0x43a0('0xc')](),controller[_0x43a0('0x26')]);router[_0x43a0('0xa')](_0x43a0('0x27'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x28')]);router[_0x43a0('0xa')](_0x43a0('0x29'),auth[_0x43a0('0xc')](),controller['getLists']);router[_0x43a0('0xa')](_0x43a0('0x2a'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x2b')]);router[_0x43a0('0xa')]('/:id/prefixes',auth[_0x43a0('0xc')](),controller[_0x43a0('0x2c')]);router[_0x43a0('0xa')](_0x43a0('0x2d'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x2e')]);router[_0x43a0('0xa')](_0x43a0('0x2f'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x30')]);router[_0x43a0('0xa')](_0x43a0('0x31'),auth['isAuthenticated'](),controller[_0x43a0('0x32')]);router[_0x43a0('0xa')](_0x43a0('0x33'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x34')]);router[_0x43a0('0xa')](_0x43a0('0x35'),auth[_0x43a0('0xc')](),controller['getChatWebsites']);router[_0x43a0('0xa')](_0x43a0('0x36'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x37')]);router['get'](_0x43a0('0x38'),auth[_0x43a0('0xc')](),controller['getSquareProjects']);router[_0x43a0('0xa')](_0x43a0('0x39'),auth[_0x43a0('0xc')](),controller['getScheduledCalls']);router[_0x43a0('0xa')](_0x43a0('0x3a'),auth['isAuthenticated'](),controller[_0x43a0('0x3b')]);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0x43a0('0x3c')]);router[_0x43a0('0x3d')]('/',auth[_0x43a0('0xc')](),controller['create']);router[_0x43a0('0x3d')]('/create_many',auth['isAuthenticated'](),controller[_0x43a0('0x3e')]);router[_0x43a0('0x3d')](_0x43a0('0x18'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x3f')]);var upload=multer({'storage':multer[_0x43a0('0x40')]({'destination':function(_0x40454b,_0x5ecc87,_0x124912){_0x124912(null,path['join'](config['root'],_0x43a0('0x41')));},'filename':function(_0x45085d,_0x4c094c,_0x1284d1){_0x1284d1(null,util[_0x43a0('0x42')](_0x43a0('0x43'),Date[_0x43a0('0x44')](),_0x4c094c['originalname']));}})});router[_0x43a0('0x3d')](_0x43a0('0x12'),upload[_0x43a0('0x45')](_0x43a0('0x46')),controller['addAvatar']);router[_0x43a0('0x3d')](_0x43a0('0x47'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x48')]);router[_0x43a0('0x3d')](_0x43a0('0x49'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x4a')]);router[_0x43a0('0x3d')](_0x43a0('0x4b'),auth[_0x43a0('0xc')](),controller['pause']);router['post']('/:id/unpause',auth['isAuthenticated'](),controller[_0x43a0('0x4c')]);router[_0x43a0('0x3d')](_0x43a0('0x27'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x4d')]);router[_0x43a0('0x3d')](_0x43a0('0x4e'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x4f')]);router[_0x43a0('0x3d')]('/:id/mail_interactions',auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x43a0('0x3d')]('/:id/fax_interactions',auth[_0x43a0('0xc')](),controller[_0x43a0('0x50')]);router[_0x43a0('0x3d')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x43a0('0x3d')](_0x43a0('0x51'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x52')]);router[_0x43a0('0x3d')](_0x43a0('0x53'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x54')]);router[_0x43a0('0x3d')](_0x43a0('0x2d'),auth[_0x43a0('0xc')](),controller['addFaxAccounts']);router[_0x43a0('0x3d')]('/:id/mail_accounts',auth[_0x43a0('0xc')](),controller[_0x43a0('0x55')]);router['post']('/:id/openchannel_accounts',auth[_0x43a0('0xc')](),controller[_0x43a0('0x56')]);router['post'](_0x43a0('0x33'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x57')]);router[_0x43a0('0x3d')](_0x43a0('0x35'),auth['isAuthenticated'](),controller[_0x43a0('0x58')]);router['post'](_0x43a0('0x36'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x59')]);router[_0x43a0('0x3d')]('/:id/square_projects',auth[_0x43a0('0xc')](),controller[_0x43a0('0x5a')]);router['post'](_0x43a0('0x3a'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x5b')]);router[_0x43a0('0x5c')](_0x43a0('0x5d'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x5e')]);router[_0x43a0('0x5c')](_0x43a0('0x5f'),auth[_0x43a0('0xc')](),controller['changePassword']);router[_0x43a0('0x60')](_0x43a0('0x18'),auth[_0x43a0('0xc')](),controller['removeQueues']);router[_0x43a0('0x60')]('/:id/teams',auth[_0x43a0('0xc')](),controller[_0x43a0('0x61')]);router[_0x43a0('0x60')](_0x43a0('0x5d'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x62')]);router['delete']('/:id/chat_interactions',auth[_0x43a0('0xc')](),controller[_0x43a0('0x63')]);router['delete'](_0x43a0('0x64'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x65')]);router[_0x43a0('0x60')](_0x43a0('0x66'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x67')]);router[_0x43a0('0x60')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x43a0('0x68')]);router[_0x43a0('0x60')](_0x43a0('0x51'),auth['isAuthenticated'](),controller[_0x43a0('0x69')]);router['delete'](_0x43a0('0x53'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x6a')]);router[_0x43a0('0x60')](_0x43a0('0x2d'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x6b')]);router[_0x43a0('0x60')]('/:id/mail_accounts',auth[_0x43a0('0xc')](),controller[_0x43a0('0x6c')]);router[_0x43a0('0x60')](_0x43a0('0x31'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x6d')]);router[_0x43a0('0x60')](_0x43a0('0x33'),auth['isAuthenticated'](),controller[_0x43a0('0x6e')]);router['delete']('/:id/chat_websites',auth[_0x43a0('0xc')](),controller[_0x43a0('0x6f')]);router['delete'](_0x43a0('0x36'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x70')]);router['delete'](_0x43a0('0x38'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x71')]);router[_0x43a0('0x60')](_0x43a0('0x3a'),auth[_0x43a0('0xc')](),controller[_0x43a0('0x72')]);module[_0x43a0('0x73')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 818e76c..d1edc4d 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 _0xb39f=['PROHIB','udp','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','force_rport,comedia','join','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','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','refuse','originate','uas','fingerprint','active','actpass','update,nonat','showWebBar','get','wss','encryption','avpf','force_avp','dtlsenable','dtlssetup','dtlsprivatekey','rtcp_mux','dtlsverify','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','callerid','format','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','accountcode','getDataValue','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_FAILED_SCREEN'];(function(_0x137cdc,_0x5a4dff){var _0x1e5435=function(_0x38db30){while(--_0x38db30){_0x137cdc['push'](_0x137cdc['shift']());}};_0x1e5435(++_0x5a4dff);}(_0xb39f,0x1e6));var _0xfb39=function(_0x3759c9,_0x5a0853){_0x3759c9=_0x3759c9-0x0;var _0x5346fb=_0xb39f[_0x3759c9];return _0x5346fb;};'use strict';var Sequelize=require(_0xfb39('0x0'));var moment=require(_0xfb39('0x1'));var util=require(_0xfb39('0x2'));var _=require(_0xfb39('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4170c5){this['setDataValue'](_0xfb39('0x4'),_0x4170c5);this[_0xfb39('0x5')]('defaultuser',_0x4170c5);},'comment':_0xfb39('0x6')},'fullname':{'type':Sequelize[_0xfb39('0x7')],'allowNull':![],'set':function(_0x45bb1c){this[_0xfb39('0x5')]('fullname',_0x45bb1c);this['setDataValue'](_0xfb39('0x8'),util[_0xfb39('0x9')]('\x22%s\x22\x20<%s>',_0x45bb1c,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0xfb39('0x7')]},'email':{'type':Sequelize[_0xfb39('0x7')],'allowNull':![],'unique':_0xfb39('0xa'),'validate':{'isEmail':!![]},'set':function(_0x11fb19){if(_0x11fb19){this[_0xfb39('0x5')]('email',_0x11fb19[_0xfb39('0xb')]());}}},'role':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0xd'),_0xfb39('0xe'),_0xfb39('0xf'),'telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xfb39('0x7')],'defaultValue':_0xfb39('0x10')},'internal':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':![],'unique':'internal','set':function(_0x3ef405){this[_0xfb39('0x5')]('internal',_0x3ef405);this['setDataValue'](_0xfb39('0x12'),_0x3ef405);this[_0xfb39('0x5')](_0xfb39('0x8'),util['format']('\x22%s\x22\x20<%s>',this[_0xfb39('0x13')](_0xfb39('0x14')),_0x3ef405));}},'salt':{'type':Sequelize[_0xfb39('0x7')]},'phone':{'type':Sequelize[_0xfb39('0x7')]},'mobile':{'type':Sequelize[_0xfb39('0x7')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xfb39('0x7')]},'userpic':{'type':Sequelize[_0xfb39('0x7')]},'city':{'type':Sequelize[_0xfb39('0x7')]},'country':{'type':Sequelize[_0xfb39('0x7')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xfb39('0x7')],'defaultValue':_0xfb39('0x16')},'lastPauseAt':{'type':Sequelize[_0xfb39('0x17')]},'chatCapacity':{'type':Sequelize[_0xfb39('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xfb39('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xfb39('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xfb39('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xfb39('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'host':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![],'defaultValue':_0xfb39('0x18')},'ipaddr':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0xfb39('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x19'),'user','peer'),'allowNull':!![],'defaultValue':_0xfb39('0x19')},'context':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![],'defaultValue':_0xfb39('0x1a')},'callingpres':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x1b'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xfb39('0x1c'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xfb39('0x1d'),_0xfb39('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![],'defaultValue':_0xfb39('0x1f'),'set':function(_0x505aa1){this[_0xfb39('0x5')](_0xfb39('0x20'),_0x505aa1?_0x505aa1['join'](','):null);},'get':function(){return this[_0xfb39('0x13')]('transport')?this[_0xfb39('0x13')](_0xfb39('0x20'))['split'](','):null;},'comment':_0xfb39('0x21')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xfb39('0x22'),_0xfb39('0x23'),_0xfb39('0x24'),_0xfb39('0x25')),'allowNull':!![],'defaultValue':_0xfb39('0x26')},'directmedia':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no',_0xfb39('0x28'),_0xfb39('0x29'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![],'defaultValue':_0xfb39('0x2a'),'set':function(_0x8c88e){this[_0xfb39('0x5')]('nat',_0x8c88e?_0x8c88e[_0xfb39('0x2b')](','):null);},'get':function(){return this[_0xfb39('0x13')]('nat')?this[_0xfb39('0x13')](_0xfb39('0x2c'))[_0xfb39('0x2d')](','):null;},'comment':_0xfb39('0x2e')},'callgroup':{'type':Sequelize[_0xfb39('0x7')]},'namedcallgroup':{'type':Sequelize[_0xfb39('0x7')]},'pickupgroup':{'type':Sequelize[_0xfb39('0x7')]},'namedpickupgroup':{'type':Sequelize[_0xfb39('0x7')]},'language':{'type':Sequelize[_0xfb39('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xfb39('0x7')]},'disallow':{'type':Sequelize[_0xfb39('0x7')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xfb39('0x7')],'allowNull':![],'defaultValue':_0xfb39('0x2f'),'set':function(_0x5e55b7){this[_0xfb39('0x5')](_0xfb39('0x30'),_0x5e55b7?_0x5e55b7[_0xfb39('0x2b')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xfb39('0x13')](_0xfb39('0x30'))?this['getDataValue'](_0xfb39('0x30'))['split'](';'):null;},'comment':_0xfb39('0x31')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3b754e){this[_0xfb39('0x5')]('insecure',_0x3b754e?_0x3b754e[_0xfb39('0x2b')](','):null);},'get':function(){return this[_0xfb39('0x13')](_0xfb39('0x32'))?this[_0xfb39('0x13')]('insecure')[_0xfb39('0x2d')](','):null;},'comment':_0xfb39('0x33')},'trustrpid':{'type':Sequelize[_0xfb39('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xfb39('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xfb39('0x27'),'no',_0xfb39('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xfb39('0xc')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no'),'allowNull':!![],'defaultValue':_0xfb39('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xfb39('0xc')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xfb39('0xc')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xfb39('0xc')]('yes','no',_0xfb39('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x36'),_0xfb39('0x37'),_0xfb39('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xfb39('0x39')),'allowNull':!![],'defaultValue':_0xfb39('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no'),'allowNull':!![],'defaultValue':_0xfb39('0x27')},'keepalive':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xfb39('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xfb39('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xfb39('0xc')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no',_0xfb39('0x3a'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x3b'),'passive',_0xfb39('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xfb39('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xfb39('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xfb39('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xfb39('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no','nonat',_0xfb39('0x29'),_0xfb39('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xfb39('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0xfb39('0x17')]},'passwordResetAt':{'type':Sequelize[_0xfb39('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xfb39('0x11')],'defaultValue':0x0,'set':function(_0xa6d48d){this[_0xfb39('0x5')](_0xfb39('0x3e'),_0xa6d48d);var _0x7b64d2=this[_0xfb39('0x3f')]({'plain':!![]});switch(_0xa6d48d){case 0x0:case 0x1:var _0x3dd154=_0x7b64d2[_0xfb39('0x20')]?_['isArray'](_0x7b64d2['transport'])?_0x7b64d2[_0xfb39('0x20')]['join']():_0x7b64d2['transport']:_0xfb39('0x1f');if(_0x3dd154===_0xfb39('0x40')){_0x3dd154=_0xfb39('0x1f');}this[_0xfb39('0x5')](_0xfb39('0x20'),_0x3dd154);this['setDataValue'](_0xfb39('0x41'),'no');this[_0xfb39('0x5')](_0xfb39('0x42'),null);this[_0xfb39('0x5')](_0xfb39('0x43'),null);this['setDataValue']('icesupport',null);this['setDataValue'](_0xfb39('0x44'),null);this[_0xfb39('0x5')]('dtlsverify',null);this[_0xfb39('0x5')](_0xfb39('0x45'),null);this[_0xfb39('0x5')]('dtlscertfile',null);this[_0xfb39('0x5')](_0xfb39('0x46'),null);this[_0xfb39('0x5')](_0xfb39('0x47'),'no');break;case 0x2:this[_0xfb39('0x5')](_0xfb39('0x20'),'wss');this[_0xfb39('0x5')](_0xfb39('0x41'),_0xfb39('0x27'));this[_0xfb39('0x5')](_0xfb39('0x42'),_0xfb39('0x27'));this[_0xfb39('0x5')](_0xfb39('0x43'),_0xfb39('0x27'));this[_0xfb39('0x5')]('icesupport',_0xfb39('0x27'));this[_0xfb39('0x5')]('dtlsenable',_0xfb39('0x27'));this[_0xfb39('0x5')](_0xfb39('0x48'),'no');this['setDataValue']('dtlssetup',_0xfb39('0x3c'));this['setDataValue']('dtlscertfile',_0x7b64d2[_0xfb39('0x49')]||_0xfb39('0x4a'));this[_0xfb39('0x5')](_0xfb39('0x46'),_0x7b64d2[_0xfb39('0x46')]||_0xfb39('0x4b'));this[_0xfb39('0x5')](_0xfb39('0x47'),_0xfb39('0x27'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x312dde){this['setDataValue'](_0xfb39('0x4c'),_0x312dde?_0x312dde[_0xfb39('0x2b')](','):[]);},'get':function(){return this[_0xfb39('0x13')](_0xfb39('0x4c'))?_[_0xfb39('0x4d')](this[_0xfb39('0x13')](_0xfb39('0x4c'))[_0xfb39('0x2d')](','),function(_0xff12eb){return parseInt(_0xff12eb,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xfb39('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xfb39('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xfb39('0xc')](_0xfb39('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xfb39('0x7')]},'phoneBarEnableJaws':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xfb39('0x4e')],'get':function(){return this[_0xfb39('0x13')](_0xfb39('0x4f'))?this['getDataValue'](_0xfb39('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xfb39('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![],'set':function(_0x6fcb9e){if(typeof _0x6fcb9e===_0xfb39('0x50')){var _0x4502fe=_0x6fcb9e==='1'?!![]:_0x6fcb9e==='0'?![]:_0x6fcb9e==='true'?!![]:_0x6fcb9e==='false'?![]:![];this[_0xfb39('0x5')](_0xfb39('0x51'),_0x4502fe);}else{this['setDataValue']('screenrecording',_0x6fcb9e);}}},'blocked':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![],'set':function(_0x5695af){this[_0xfb39('0x5')](_0xfb39('0x52'),_0x5695af);if(_0x5695af===!![]){this[_0xfb39('0x5')](_0xfb39('0x53'),moment());this['setDataValue'](_0xfb39('0x54'),0x0);}else{this[_0xfb39('0x5')](_0xfb39('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0xfb39('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xfb39('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xfb39('0x11')](0x5)[_0xfb39('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xfb39('0x15')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0b78=['passive','actpass','update','update,nonat','showWebBar','get','wss','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','encryption','avpf','dtlsenable','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','loginAttempts','blockedAt','UNSIGNED','moment','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','internal','email','toLowerCase','ENUM','agent','telephone','local','INTEGER','\x22%s\x22\x20<%s>','getDataValue','fullname','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','nat','join','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','uac','uas','fingerprint','active'];(function(_0x35ea36,_0x1b73a2){var _0x1b1bc6=function(_0x28cdd7){while(--_0x28cdd7){_0x35ea36['push'](_0x35ea36['shift']());}};_0x1b1bc6(++_0x1b73a2);}(_0x0b78,0x1d6));var _0x80b7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0b78[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var _=require(_0x80b7('0x2'));module['exports']={'name':{'type':Sequelize[_0x80b7('0x3')],'allowNull':![],'unique':_0x80b7('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4ad62b){this['setDataValue']('name',_0x4ad62b);this[_0x80b7('0x5')](_0x80b7('0x6'),_0x4ad62b);},'comment':_0x80b7('0x7')},'fullname':{'type':Sequelize[_0x80b7('0x3')],'allowNull':![],'set':function(_0x33bdd8){this[_0x80b7('0x5')]('fullname',_0x33bdd8);this[_0x80b7('0x5')](_0x80b7('0x8'),util[_0x80b7('0x9')]('\x22%s\x22\x20<%s>',_0x33bdd8,this['getDataValue'](_0x80b7('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x80b7('0x3')],'allowNull':![],'unique':_0x80b7('0xb'),'validate':{'isEmail':!![]},'set':function(_0x47910c){if(_0x47910c){this[_0x80b7('0x5')](_0x80b7('0xb'),_0x47910c[_0x80b7('0xc')]());}}},'role':{'type':Sequelize[_0x80b7('0xd')]('admin','user',_0x80b7('0xe'),_0x80b7('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x80b7('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x80b7('0x3')],'defaultValue':_0x80b7('0x10')},'internal':{'type':Sequelize[_0x80b7('0x11')](0xb),'allowNull':![],'unique':_0x80b7('0xa'),'set':function(_0x32cecc){this[_0x80b7('0x5')]('internal',_0x32cecc);this['setDataValue']('accountcode',_0x32cecc);this['setDataValue'](_0x80b7('0x8'),util[_0x80b7('0x9')](_0x80b7('0x12'),this[_0x80b7('0x13')](_0x80b7('0x14')),_0x32cecc));}},'salt':{'type':Sequelize[_0x80b7('0x3')]},'phone':{'type':Sequelize[_0x80b7('0x3')]},'mobile':{'type':Sequelize[_0x80b7('0x3')]},'address':{'type':Sequelize[_0x80b7('0x3')]},'zipcode':{'type':Sequelize[_0x80b7('0x3')]},'userpic':{'type':Sequelize[_0x80b7('0x3')]},'city':{'type':Sequelize[_0x80b7('0x3')]},'country':{'type':Sequelize[_0x80b7('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x80b7('0x15')]},'voicePause':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x80b7('0x3')],'defaultValue':_0x80b7('0x17')},'lastPauseAt':{'type':Sequelize[_0x80b7('0x15')]},'chatCapacity':{'type':Sequelize[_0x80b7('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x80b7('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x80b7('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x80b7('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x80b7('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x80b7('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x80b7('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![],'defaultValue':_0x80b7('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x80b7('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x80b7('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x80b7('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x19'),'user',_0x80b7('0x1a')),'allowNull':!![],'defaultValue':_0x80b7('0x19')},'context':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![],'defaultValue':_0x80b7('0x1b')},'callingpres':{'type':Sequelize[_0x80b7('0xd')]('ALLOWED_NOT_SCREENED',_0x80b7('0x1c'),_0x80b7('0x1d'),_0x80b7('0x1e'),_0x80b7('0x1f'),_0x80b7('0x20'),_0x80b7('0x21'),_0x80b7('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![],'defaultValue':_0x80b7('0x23'),'set':function(_0x1dfde6){this[_0x80b7('0x5')](_0x80b7('0x24'),_0x1dfde6?_0x1dfde6['join'](','):null);},'get':function(){return this[_0x80b7('0x13')](_0x80b7('0x24'))?this[_0x80b7('0x13')]('transport')[_0x80b7('0x25')](','):null;},'comment':_0x80b7('0x26')},'dtmfmode':{'type':Sequelize[_0x80b7('0xd')]('rfc2833',_0x80b7('0x27'),_0x80b7('0x28'),_0x80b7('0x29'),_0x80b7('0x2a')),'allowNull':!![],'defaultValue':_0x80b7('0x2b')},'directmedia':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no',_0x80b7('0x2d'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x3d33fa){this[_0x80b7('0x5')](_0x80b7('0x2e'),_0x3d33fa?_0x3d33fa[_0x80b7('0x2f')](','):null);},'get':function(){return this['getDataValue'](_0x80b7('0x2e'))?this[_0x80b7('0x13')]('nat')[_0x80b7('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x80b7('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x80b7('0x3')]},'language':{'type':Sequelize[_0x80b7('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x80b7('0x3')]},'disallow':{'type':Sequelize[_0x80b7('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x80b7('0x30'),'set':function(_0x4f50ca){this[_0x80b7('0x5')](_0x80b7('0x31'),_0x4f50ca?_0x4f50ca['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x80b7('0x13')](_0x80b7('0x31'))?this[_0x80b7('0x13')]('allow')[_0x80b7('0x25')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x80b7('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![],'set':function(_0x1b1b68){this[_0x80b7('0x5')](_0x80b7('0x32'),_0x1b1b68?_0x1b1b68[_0x80b7('0x2f')](','):null);},'get':function(){return this[_0x80b7('0x13')](_0x80b7('0x32'))?this[_0x80b7('0x13')](_0x80b7('0x32'))[_0x80b7('0x25')](','):null;},'comment':_0x80b7('0x33')},'trustrpid':{'type':Sequelize['ENUM'](_0x80b7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no',_0x80b7('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x80b7('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x80b7('0x2c')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x80b7('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x80b7('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no',_0x80b7('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x80b7('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept','refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x36'),_0x80b7('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x80b7('0xd')]('yes','no'),'allowNull':!![],'defaultValue':_0x80b7('0x2c')},'keepalive':{'type':Sequelize[_0x80b7('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x80b7('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x80b7('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x80b7('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x80b7('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x80b7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x80b7('0xd')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no',_0x80b7('0x38'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x80b7('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x39'),_0x80b7('0x3a'),_0x80b7('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x80b7('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no',_0x80b7('0x2d'),_0x80b7('0x3c'),_0x80b7('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x80b7('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x80b7('0x15')]},'passwordResetAt':{'type':Sequelize[_0x80b7('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x80b7('0x11')],'defaultValue':0x0,'set':function(_0x148e8c){this[_0x80b7('0x5')](_0x80b7('0x3e'),_0x148e8c);var _0x35171f=this[_0x80b7('0x3f')]({'plain':!![]});switch(_0x148e8c){case 0x0:case 0x1:var _0x350570=_0x35171f['transport']?_['isArray'](_0x35171f[_0x80b7('0x24')])?_0x35171f[_0x80b7('0x24')][_0x80b7('0x2f')]():_0x35171f['transport']:_0x80b7('0x23');if(_0x350570===_0x80b7('0x40')){_0x350570=_0x80b7('0x23');}this[_0x80b7('0x5')]('transport',_0x350570);this[_0x80b7('0x5')]('encryption','no');this['setDataValue']('avpf',null);this[_0x80b7('0x5')](_0x80b7('0x41'),null);this[_0x80b7('0x5')](_0x80b7('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x80b7('0x5')](_0x80b7('0x43'),null);this['setDataValue'](_0x80b7('0x44'),null);this['setDataValue'](_0x80b7('0x45'),null);this['setDataValue'](_0x80b7('0x46'),null);this[_0x80b7('0x5')]('rtcp_mux','no');break;case 0x2:this[_0x80b7('0x5')](_0x80b7('0x24'),_0x80b7('0x40'));this['setDataValue'](_0x80b7('0x47'),_0x80b7('0x2c'));this['setDataValue'](_0x80b7('0x48'),_0x80b7('0x2c'));this['setDataValue']('force_avp',_0x80b7('0x2c'));this[_0x80b7('0x5')]('icesupport',_0x80b7('0x2c'));this['setDataValue'](_0x80b7('0x49'),_0x80b7('0x2c'));this[_0x80b7('0x5')](_0x80b7('0x43'),'no');this[_0x80b7('0x5')](_0x80b7('0x44'),_0x80b7('0x3b'));this[_0x80b7('0x5')](_0x80b7('0x45'),_0x35171f[_0x80b7('0x45')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue']('dtlsprivatekey',_0x35171f['dtlsprivatekey']||_0x80b7('0x4a'));this[_0x80b7('0x5')](_0x80b7('0x4b'),_0x80b7('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x80b7('0x4c')],'set':function(_0x276631){this[_0x80b7('0x5')](_0x80b7('0x4d'),_0x276631?_0x276631['join'](','):[]);},'get':function(){return this[_0x80b7('0x13')](_0x80b7('0x4d'))?_[_0x80b7('0x4e')](this[_0x80b7('0x13')]('permissions')[_0x80b7('0x25')](','),function(_0x56a7f3){return parseInt(_0x56a7f3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x80b7('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x80b7('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x80b7('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x80b7('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x80b7('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x80b7('0xd')](_0x80b7('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x80b7('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x80b7('0x4f')],'get':function(){return this['getDataValue'](_0x80b7('0x50'))?this[_0x80b7('0x13')](_0x80b7('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x80b7('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x80b7('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![],'set':function(_0x33f4a1){if(typeof _0x33f4a1===_0x80b7('0x51')){var _0x5068f5=_0x33f4a1==='1'?!![]:_0x33f4a1==='0'?![]:_0x33f4a1===_0x80b7('0x52')?!![]:_0x33f4a1===_0x80b7('0x53')?![]:![];this[_0x80b7('0x5')](_0x80b7('0x54'),_0x5068f5);}else{this[_0x80b7('0x5')](_0x80b7('0x54'),_0x33f4a1);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x26b2dc){this[_0x80b7('0x5')]('blocked',_0x26b2dc);if(_0x26b2dc===!![]){this[_0x80b7('0x5')]('blockedAt',moment());this[_0x80b7('0x5')](_0x80b7('0x55'),0x0);}else{this[_0x80b7('0x5')](_0x80b7('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x80b7('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x80b7('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x80b7('0x11')](0x5)[_0x80b7('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x80b7('0x16')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 447b7ca..97155a3 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 _0x98d8=['WhatsappOpenTabs','WHATSAPP','getContacts','sort','pick','merge','options','hasOwnProperty','CmList','List','Tag','Tags','color','tag','nolimit','getQueues','Queue','order','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','phone','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','isMiddleware','logout','forEach','pause','QueuePause','MemberReport','updateAttributes','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','smsPause','whatsapppause','pauseType','manual','%s%s','Pause','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','Chat','Mail','getSmsQueues','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','getDataValue','TeamVoicePrefix','VoicePrefixId','removeTeams','getVoiceQueues','getMailQueues','Sms','removeAgent','UserVoicePrefix','Queue:remove','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','CmHopper','concat','$gte','$lt','$lte','$ne','$eq','$between','$in','$notLike','$iLike','$like','$overlap','$contains','$contained','$any','lastName','CmContact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','queues','teams','inbound','isEmpty','lower','toString','asc','substring','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','voiceStatus','slice','toUpperCase','select','InteractionId','field','ui.createdAt','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','../../components/parsers/qs','../../config/utils','../../config/license/util','socket.io-emitter','./user.socket','register','redis','defaults','localhost','client','http','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','destroy','get','Users','user','Agents','Telephones','telephone','filter','map','value','includes','role','find','name','UserProfileResource','end','stack','send','index','type','key','password','salt','getOptions','where','User','includeAll','include','attributes','push','findAll','rows','query','openTabs','true','dataValues','sms','fax','mail','openchannel','all','show','params','model','differenceBy','keys','rawAttributes','filters','intersection','fields','length','chat','whatsapp','update','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','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','mailbox','VoiceMail','agent','permissions','113','105','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','UserProfileSection','autoAssociation','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','addQueues','channel','online','loginInPause','voicePause','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','interface','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','remove','file','filename','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs'];(function(_0x1a40cf,_0x244f4e){var _0x462a94=function(_0x7e63d3){while(--_0x7e63d3){_0x1a40cf['push'](_0x1a40cf['shift']());}};_0x462a94(++_0x244f4e);}(_0x98d8,0xce));var _0x898d=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x98d8[_0x4099ee];return _0x1b7bfc;};'use strict';var moment=require(_0x898d('0x0'));var BPromise=require(_0x898d('0x1'));var util=require(_0x898d('0x2'));var path=require(_0x898d('0x3'));var fs=require('fs');var _=require(_0x898d('0x4'));var squel=require(_0x898d('0x5'));var jayson=require(_0x898d('0x6'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x898d('0x7'));var logger=require('../../config/logger')('api');var utils=require(_0x898d('0x8'));var config=require('../../config/environment');var licenseUtil=require(_0x898d('0x9'));var db=require('../../mysqldb')['db'];var socket=require(_0x898d('0xa'))(new Redis(config['redis']));require(_0x898d('0xb'))[_0x898d('0xc')](socket);config[_0x898d('0xd')]=_[_0x898d('0xe')](config[_0x898d('0xd')],{'host':_0x898d('0xf'),'port':0x18eb});var client=jayson[_0x898d('0x10')][_0x898d('0x11')]({'port':0x232a});var values;function respondWithRpcPromise(_0x316b5a,_0x3f15f3,_0xf85d8c,_0x424a43){return new BPromise(function(_0x4742c1,_0x27b9df){var _0x14767e=_0x424a43||client;return _0x14767e['request'](_0x316b5a,_0xf85d8c)[_0x898d('0x12')](function(_0x2f0844){logger['info'](_0x898d('0x13'),_0x3f15f3,_0x898d('0x14'));logger[_0x898d('0x15')](_0x898d('0x16'),_0x3f15f3,_0x898d('0x14'),JSON[_0x898d('0x17')](_0x2f0844));if(_0x2f0844[_0x898d('0x18')]){if(_0x2f0844['error'][_0x898d('0x19')]===0x1f4){logger[_0x898d('0x18')]('User,\x20%s,\x20%s',_0x3f15f3,_0x2f0844['error'][_0x898d('0x1a')]);return _0x27b9df(_0x2f0844[_0x898d('0x18')][_0x898d('0x1a')]);}logger[_0x898d('0x18')](_0x898d('0x13'),_0x3f15f3,_0x2f0844[_0x898d('0x18')]['message']);return _0x4742c1(_0x2f0844['error'][_0x898d('0x1a')]);}else{logger[_0x898d('0x1b')](_0x898d('0x13'),_0x3f15f3,_0x898d('0x14'));_0x4742c1(_0x2f0844[_0x898d('0x1c')][_0x898d('0x1a')]);}})[_0x898d('0x1d')](function(_0x229d49){logger[_0x898d('0x18')](_0x898d('0x13'),_0x3f15f3,_0x229d49);_0x27b9df(_0x229d49);});});}function respondWithStatusCode(_0x220d7b,_0x4f1aa4){_0x4f1aa4=_0x4f1aa4||0xcc;return function(_0xb593a8){if(_0xb593a8){return _0x220d7b[_0x898d('0x1e')](_0x4f1aa4);}return _0x220d7b[_0x898d('0x1f')](_0x4f1aa4)['end']();};}function respondWithResult(_0x5d18a3,_0x16e720){_0x16e720=_0x16e720||0xc8;return function(_0x46abab){if(_0x46abab){return _0x5d18a3[_0x898d('0x1f')](_0x16e720)[_0x898d('0x20')](_0x46abab);}};}function respondWithFilteredResult(_0x1bdbd0,_0x3fc201){return function(_0x25c138){if(_0x25c138){var _0x3bf744=typeof _0x3fc201[_0x898d('0x21')]==='undefined'&&typeof _0x3fc201['limit']===_0x898d('0x22');var _0x252887=_0x25c138[_0x898d('0x23')];var _0x39b61e=_0x3bf744?0x0:_0x3fc201[_0x898d('0x21')];var _0xef200a=_0x3bf744?_0x25c138[_0x898d('0x23')]:_0x3fc201['offset']+_0x3fc201[_0x898d('0x24')];var _0x50f602;if(_0xef200a>=_0x252887){_0xef200a=_0x252887;_0x50f602=0xc8;}else{_0x50f602=0xce;}_0x1bdbd0[_0x898d('0x1f')](_0x50f602);return _0x1bdbd0[_0x898d('0x25')](_0x898d('0x26'),_0x39b61e+'-'+_0xef200a+'/'+_0x252887)[_0x898d('0x20')](_0x25c138);}return null;};}function saveUpdates(_0x28186b){return function(_0x3a57a0){if(_0x3a57a0){return _0x3a57a0['update'](_0x28186b)[_0x898d('0x12')](function(_0xfcae2d){return _0xfcae2d;});}return null;};}function removeEntity(_0x1baec7){return function(_0x47ea99){if(_0x47ea99){return _0x47ea99[_0x898d('0x27')]()[_0x898d('0x12')](function(){var _0x417c8e=_0x47ea99[_0x898d('0x28')]({'plain':!![]});if(_0x417c8e['role']==='admin')return;var _0x51b399=[{'name':_0x898d('0x29'),'value':_0x898d('0x2a'),'ignore':!![]},{'name':_0x898d('0x2b'),'value':'agent','ignore':![]},{'name':_0x898d('0x2c'),'value':_0x898d('0x2d'),'ignore':![]}];var _0x1b8eb2=_(_0x51b399)[_0x898d('0x2e')]('ignore')[_0x898d('0x2f')]('value')[_0x898d('0x30')]();if(_[_0x898d('0x31')](_0x1b8eb2,_0x417c8e[_0x898d('0x32')])){return;}var _0x261b29=_[_0x898d('0x33')](_0x51b399,['value',_0x417c8e['role']])[_0x898d('0x34')];return db[_0x898d('0x35')]['destroy']({'where':{'type':_0x261b29,'resourceId':_0x417c8e['id']}})[_0x898d('0x12')](function(){return _0x47ea99;});})[_0x898d('0x12')](function(){_0x1baec7[_0x898d('0x1f')](0xcc)[_0x898d('0x36')]();});}};}function handleEntityNotFound(_0x1712ab){return function(_0x20d1fd){if(!_0x20d1fd){_0x1712ab['sendStatus'](0x194);}return _0x20d1fd;};}function handleError(_0x433997,_0x11978c){_0x11978c=_0x11978c||0x1f4;return function(_0x1dd9d2){logger['error'](_0x1dd9d2[_0x898d('0x37')]);if(_0x1dd9d2[_0x898d('0x34')]){delete _0x1dd9d2[_0x898d('0x34')];}_0x433997['status'](_0x11978c)[_0x898d('0x38')](_0x1dd9d2);};}exports[_0x898d('0x39')]=function(_0x3ac2e0,_0x34d9a6){var _0x21a1a8={},_0x33e8ea={'count':0x0,'rows':[]};var _0x3eca23=_(db['User']['rawAttributes'])[_0x898d('0x2f')](function(_0x1c736e){return{'name':_0x1c736e['fieldName'],'type':_0x1c736e[_0x898d('0x3a')][_0x898d('0x3b')]};})[_0x898d('0x2e')](function(_0x388c88){return!_[_0x898d('0x31')]([_0x898d('0x3c'),_0x898d('0x3d')],_0x388c88[_0x898d('0x34')]);})[_0x898d('0x30')]();_0x21a1a8=qs[_0x898d('0x3e')](_0x3eca23,_0x3ac2e0);var _0x42b380={'where':_0x21a1a8[_0x898d('0x3f')]};return db[_0x898d('0x40')][_0x898d('0x23')](_0x42b380)['then'](function(_0x1d630b){_0x33e8ea[_0x898d('0x23')]=_0x1d630b;if(_0x3ac2e0['query'][_0x898d('0x41')]){_0x21a1a8[_0x898d('0x42')]=[{'all':!![]}];}if(!_['includes'](_0x21a1a8[_0x898d('0x43')],'id')){_0x21a1a8[_0x898d('0x43')][_0x898d('0x44')]('id');}return db[_0x898d('0x40')][_0x898d('0x45')](_0x21a1a8);})['then'](function(_0x29250d){_0x33e8ea[_0x898d('0x46')]=_0x29250d;if(_0x3ac2e0[_0x898d('0x47')][_0x898d('0x48')]===_0x898d('0x49')){var _0x2d818a=[];for(var _0x452e3a=0x0;_0x452e3a<_0x33e8ea[_0x898d('0x46')]['length'];_0x452e3a++){_0x2d818a[_0x898d('0x44')](get_open_tabs('chat',_0x33e8ea[_0x898d('0x46')][_0x452e3a][_0x898d('0x4a')]));_0x2d818a['push'](get_open_tabs(_0x898d('0x4b'),_0x33e8ea[_0x898d('0x46')][_0x452e3a][_0x898d('0x4a')]));_0x2d818a[_0x898d('0x44')](get_open_tabs(_0x898d('0x4c'),_0x33e8ea[_0x898d('0x46')][_0x452e3a][_0x898d('0x4a')]));_0x2d818a[_0x898d('0x44')](get_open_tabs(_0x898d('0x4d'),_0x33e8ea[_0x898d('0x46')][_0x452e3a][_0x898d('0x4a')]));_0x2d818a[_0x898d('0x44')](get_open_tabs(_0x898d('0x4e'),_0x33e8ea[_0x898d('0x46')][_0x452e3a][_0x898d('0x4a')]));_0x2d818a[_0x898d('0x44')](get_open_tabs('whatsapp',_0x33e8ea[_0x898d('0x46')][_0x452e3a]['dataValues']));}return BPromise[_0x898d('0x4f')](_0x2d818a)[_0x898d('0x12')](function(_0x6384b5){return _0x33e8ea;});}else{return _0x33e8ea;}})[_0x898d('0x12')](respondWithFilteredResult(_0x34d9a6,_0x21a1a8))[_0x898d('0x1d')](handleError(_0x34d9a6,null));};exports[_0x898d('0x50')]=function(_0x48f1f6,_0x184df8){var _0x12b03d={'raw':![],'where':{'id':_0x48f1f6[_0x898d('0x51')]['id']}},_0x13e7a4={};_0x13e7a4[_0x898d('0x52')]=_[_0x898d('0x53')](_[_0x898d('0x54')](db[_0x898d('0x40')][_0x898d('0x55')]),['password','salt']);_0x13e7a4['query']=_[_0x898d('0x54')](_0x48f1f6[_0x898d('0x47')]);_0x13e7a4[_0x898d('0x56')]=_[_0x898d('0x57')](_0x13e7a4['model'],_0x13e7a4[_0x898d('0x47')]);_0x12b03d['attributes']=_[_0x898d('0x57')](_0x13e7a4['model'],qs[_0x898d('0x58')](_0x48f1f6[_0x898d('0x47')]['fields']));_0x12b03d[_0x898d('0x43')]=_0x12b03d[_0x898d('0x43')][_0x898d('0x59')]?_0x12b03d['attributes']:_0x13e7a4[_0x898d('0x52')];if(_0x48f1f6[_0x898d('0x47')][_0x898d('0x41')]){_0x12b03d[_0x898d('0x42')]=[{'all':!![]}];}_0x12b03d=_['merge']({},_0x12b03d,_0x48f1f6['options']);if(!_[_0x898d('0x31')](_0x12b03d[_0x898d('0x43')],'id')){_0x12b03d[_0x898d('0x43')][_0x898d('0x44')]('id');}return db['User'][_0x898d('0x33')](_0x12b03d)['then'](handleEntityNotFound(_0x184df8,null))['then'](function(_0x3c055a){var _0x146c3c=[];values=_0x3c055a;if(_0x48f1f6[_0x898d('0x47')]['openTabs']==='true'){_0x146c3c['push'](get_open_tabs(_0x898d('0x5a'),_0x3c055a[_0x898d('0x4a')]));_0x146c3c[_0x898d('0x44')](get_open_tabs(_0x898d('0x4b'),_0x3c055a[_0x898d('0x4a')]));_0x146c3c['push'](get_open_tabs(_0x898d('0x4e'),_0x3c055a[_0x898d('0x4a')]));_0x146c3c[_0x898d('0x44')](get_open_tabs(_0x898d('0x5b'),_0x3c055a[_0x898d('0x4a')]));_0x146c3c[_0x898d('0x44')](get_open_tabs(_0x898d('0x4c'),_0x3c055a[_0x898d('0x4a')]));_0x146c3c['push'](get_open_tabs(_0x898d('0x4d'),_0x3c055a['dataValues']));return BPromise[_0x898d('0x4f')](_0x146c3c);}else{return values;}})['then'](function(_0x23710f){return values;})[_0x898d('0x12')](respondWithResult(_0x184df8,null))[_0x898d('0x1d')](handleError(_0x184df8,null));};exports[_0x898d('0x5c')]=function(_0x5da24,_0x36b4c3){if(_0x5da24[_0x898d('0x5d')]['id']){delete _0x5da24[_0x898d('0x5d')]['id'];}delete _0x5da24[_0x898d('0x5d')][_0x898d('0x32')];return db['User'][_0x898d('0x33')]({'where':{'id':_0x5da24[_0x898d('0x51')]['id']}})[_0x898d('0x12')](handleEntityNotFound(_0x36b4c3,null))[_0x898d('0x12')](saveUpdates(_0x5da24['body'],null))['then'](respondWithResult(_0x36b4c3,null))[_0x898d('0x1d')](handleError(_0x36b4c3,null));};exports[_0x898d('0x5e')]=function(_0x2b26cc,_0x5acec1){return db[_0x898d('0x40')]['describe']()['then'](respondWithResult(_0x5acec1,null))[_0x898d('0x1d')](handleError(_0x5acec1,null));};exports['addContacts']=function(_0x478a6b,_0x5b8bc3){return db['User']['find']({'where':{'id':_0x478a6b[_0x898d('0x51')]['id']}})[_0x898d('0x12')](handleEntityNotFound(_0x5b8bc3,null))['then'](function(_0x1ea130){if(_0x1ea130){return _0x1ea130[_0x898d('0x5f')](_0x478a6b[_0x898d('0x5d')][_0x898d('0x60')],_[_0x898d('0x61')](_0x478a6b[_0x898d('0x5d')],['ids','id'])||{});}})[_0x898d('0x12')](respondWithResult(_0x5b8bc3,null))[_0x898d('0x1d')](handleError(_0x5b8bc3,null));};function validateUser(_0x501b3f){return new BPromise(function(_0x4e4e04,_0x55d569){if(_0x501b3f[_0x898d('0x62')])return _0x4e4e04(_0x501b3f);return db[_0x898d('0x63')][_0x898d('0x64')](0x1)['then'](function(_0x15b803){if(_0x15b803[_0x898d('0x65')])authService[_0x898d('0x66')](_0x501b3f[_0x898d('0x3c')]);db[_0x898d('0x40')]['max'](_0x898d('0x62'))[_0x898d('0x12')](function(_0x54b7c4){if(_[_0x898d('0x67')](_0x54b7c4)){_0x501b3f[_0x898d('0x62')]=_0x15b803[_0x898d('0x68')]||0x1;return;}if(_[_0x898d('0x67')](_0x15b803[_0x898d('0x68')])||_0x15b803['min_internal']===_0x54b7c4){_0x501b3f['internal']=_0x54b7c4+0x1;return;}if(_0x15b803[_0x898d('0x68')]>_0x54b7c4){_0x501b3f[_0x898d('0x62')]=_0x15b803[_0x898d('0x68')];return;}return db[_0x898d('0x69')]['query'](_0x898d('0x6a'),{'type':db['sequelize'][_0x898d('0x6b')][_0x898d('0x6c')]})['then'](function(_0x2db22c){if(_0x2db22c&&_0x2db22c['length']){for(var _0x3d5a40=0x0,_0x35b416=_0x2db22c[_0x898d('0x59')];_0x3d5a40<_0x35b416&&_[_0x898d('0x67')](_0x501b3f[_0x898d('0x62')]);_0x3d5a40++){if(_0x15b803['min_internal']<=_0x2db22c[_0x3d5a40][_0x898d('0x6d')]){_0x501b3f[_0x898d('0x62')]=_0x2db22c[_0x3d5a40][_0x898d('0x6d')];}else if(_0x15b803[_0x898d('0x68')]>_0x2db22c[_0x3d5a40][_0x898d('0x6d')]&&_0x15b803['min_internal']<=_0x2db22c[_0x3d5a40]['to']){_0x501b3f['internal']=_0x15b803[_0x898d('0x68')];}}}if(_['isNil'](_0x501b3f[_0x898d('0x62')])){_0x501b3f[_0x898d('0x62')]=_0x54b7c4+0x1;}return _0x4e4e04(_0x501b3f);});});})['catch'](function(_0x142e77){_0x55d569(_0x142e77);});});}function updateUser(_0x4d329d){return new BPromise(function(_0x489c61,_0x42ae9e){try{if(_0x4d329d['voicemail']){_0x4d329d[_0x898d('0x6e')]=_0x4d329d[_0x898d('0x62')];_0x4d329d[_0x898d('0x6f')]={'mailbox':_0x4d329d[_0x898d('0x62')],'password':_0x4d329d['password'],'fullname':_0x4d329d['fullname'],'email':_0x4d329d['email']};}if(_0x4d329d['role']===_0x898d('0x70')){if(!_0x4d329d[_0x898d('0x71')])_0x4d329d['permissions']=['101','102','103',_0x898d('0x72'),'110','104',_0x898d('0x73'),'106','107','108',_0x898d('0x74'),_0x898d('0x75'),_0x898d('0x76'),_0x898d('0x77'),_0x898d('0x78')];}_0x489c61(_0x4d329d);}catch(_0x7d9a8e){_0x42ae9e(_0x7d9a8e);}});}exports[_0x898d('0x79')]=function(_0x2b7889,_0x28f535){if(_0x2b7889['user'][_0x898d('0x32')]==='agent')throw new Error(_0x898d('0x7a'));if(_0x2b7889[_0x898d('0x5d')][_0x898d('0x32')]===_0x898d('0x2a')&&_0x2b7889[_0x898d('0x2a')]['role']!=='admin'){throw new Error(_0x898d('0x7b'));}if(_0x2b7889[_0x898d('0x5d')][_0x898d('0x32')]===_0x898d('0x7c')&&_0x2b7889[_0x898d('0x2a')][_0x898d('0x32')]!==_0x898d('0x7c')){throw new Error(_0x898d('0x7d'));}return licenseUtil[_0x898d('0x7e')]([_0x2b7889[_0x898d('0x5d')]])[_0x898d('0x12')](function(){return validateUser(_0x2b7889['body']);})[_0x898d('0x12')](function(_0x5e58b7){return updateUser(_0x5e58b7)['then'](function(_0x588a36){if(_0x588a36[_0x898d('0x32')]===_0x898d('0x7c')){_0x588a36['settingsEnabled']=_0x2b7889[_0x898d('0x2a')][_0x898d('0x7f')];delete _0x588a36[_0x898d('0x80')];}return _0x588a36;});})[_0x898d('0x12')](function(_0x55a5fc){return db[_0x898d('0x40')][_0x898d('0x79')](_0x55a5fc,{'include':[{'model':db[_0x898d('0x6f')],'as':_0x898d('0x6f')}]});})[_0x898d('0x12')](function(_0x370593){if(_0x2b7889[_0x898d('0x5d')][_0x898d('0x32')]===_0x898d('0x2a'))return _0x370593;if(_0x2b7889['user'][_0x898d('0x32')]!==_0x898d('0x2a'))return _0x370593;return db['UserProfileSection']['find']({'where':{'name':_0x370593[_0x898d('0x32')]==='agent'?_0x898d('0x2b'):_0x898d('0x2c'),'userProfileId':_0x2b7889[_0x898d('0x2a')][_0x898d('0x80')]},'raw':!![]})[_0x898d('0x12')](function(_0x6fb89f){if(!_0x6fb89f||_0x6fb89f['autoAssociation']!=0x0)return _0x370593;return db[_0x898d('0x35')]['create']({'name':_0x370593[_0x898d('0x34')],'resourceId':_0x370593['id'],'type':_0x6fb89f[_0x898d('0x34')],'sectionId':_0x6fb89f['id']},{})[_0x898d('0x12')](function(){return _0x370593;});})[_0x898d('0x1d')](function(_0x1a9963){logger[_0x898d('0x18')](_0x898d('0x81'),_0x1a9963);throw _0x1a9963;});})[_0x898d('0x12')](respondWithResult(_0x28f535,0xc9))[_0x898d('0x1d')](handleError(_0x28f535,null));};exports[_0x898d('0x82')]=function(_0xc6593a,_0x48b104){var _0x8c5d60=_0xc6593a[_0x898d('0x5d')];var _0x5361b6=[];if(_0xc6593a[_0x898d('0x2a')][_0x898d('0x32')]===_0x898d('0x70'))throw new Error(_0x898d('0x7a'));if(_[_0x898d('0x83')](_0x8c5d60,[_0x898d('0x32'),_0x898d('0x2a')])&&_0xc6593a['user'][_0x898d('0x32')]!=='admin'){throw new Error(_0x898d('0x7b'));}if(_[_0x898d('0x83')](_0x8c5d60,[_0x898d('0x32'),'admin'])&&_0xc6593a[_0x898d('0x2a')][_0x898d('0x32')]!=='admin'){throw new Error(_0x898d('0x84'));}return licenseUtil[_0x898d('0x7e')](_0x8c5d60)[_0x898d('0x12')](function(){return validateUser(_0x8c5d60[0x0]);})[_0x898d('0x12')](function(){for(var _0xd17946=0x1;_0xd17946<_0x8c5d60[_0x898d('0x59')];_0xd17946++){var _0x3a1e5b=_0x8c5d60[_0xd17946-0x1][_0x898d('0x62')];if(!_0x8c5d60[_0xd17946][_0x898d('0x62')])_0x8c5d60[_0xd17946][_0x898d('0x62')]=_0x3a1e5b+0x1;_0x5361b6[_0x898d('0x44')](validateUser(_0x8c5d60[_0xd17946]));}return BPromise[_0x898d('0x4f')](_0x5361b6);})['then'](function(){_0x5361b6=[];for(var _0x5d70dd=0x0;_0x5d70dd<_0x8c5d60[_0x898d('0x59')];_0x5d70dd++){_0x5361b6[_0x898d('0x44')](updateUser(_0x8c5d60[_0x5d70dd]));}return BPromise['all'](_0x5361b6);})[_0x898d('0x12')](function(){return BPromise[_0x898d('0x85')](_0x8c5d60,function(_0x3a3cf7){return db[_0x898d('0x40')][_0x898d('0x79')](_0x3a3cf7,{'include':[{'model':db[_0x898d('0x6f')],'as':_0x898d('0x6f')}]})[_0x898d('0x12')](function(_0x309bce){_0x3a3cf7['id']=_0x309bce['id'];return _0x3a3cf7;});});})[_0x898d('0x12')](function(_0x5dca3d){if(_0xc6593a[_0x898d('0x5d')][_0x898d('0x32')]===_0x898d('0x2a'))return _0x5dca3d;if(_0xc6593a[_0x898d('0x2a')][_0x898d('0x32')]!==_0x898d('0x2a'))return _0x5dca3d;var _0x58fd21=_[_0x898d('0x83')](_0x5dca3d,function(_0xb4d6d4){return _0xb4d6d4[_0x898d('0x32')]===_0x898d('0x70')||_0xb4d6d4[_0x898d('0x32')]===_0x898d('0x2d');});if(!_0x58fd21)return _0x5dca3d;return db[_0x898d('0x86')][_0x898d('0x45')]({'where':{'name':{'$or':['Agents',_0x898d('0x2c')]},'userProfileId':_0xc6593a['user'][_0x898d('0x80')]},'raw':!![]})[_0x898d('0x12')](function(_0x54aa01){if(_['isEmpty'](_0x54aa01)||!_[_0x898d('0x83')](_0x54aa01,[_0x898d('0x87'),0x0]))return _0x5dca3d;_0x5361b6=[];var _0x3504ad=_(_0x54aa01)['map'](function(_0xeabbe5){if(_0xeabbe5[_0x898d('0x87')]===0x1)return;return _0xeabbe5[_0x898d('0x34')]==='Agents'?_0x898d('0x70'):_0x898d('0x2d');})[_0x898d('0x88')]()[_0x898d('0x30')]();for(var _0x432bdb=0x0;_0x432bdb<_0x5dca3d['length'];_0x432bdb++){if(!_[_0x898d('0x31')](_0x3504ad,_0x5dca3d[_0x432bdb][_0x898d('0x32')]))return;var _0x26146c=_0x5dca3d[_0x432bdb]['role']==='agent'?'Agents':_0x898d('0x2c');_0x5361b6[_0x898d('0x44')](db[_0x898d('0x35')][_0x898d('0x79')]({'name':_0x5dca3d[_0x432bdb][_0x898d('0x34')],'resourceId':_0x5dca3d[_0x432bdb]['id'],'type':_0x26146c,'sectionId':_[_0x898d('0x33')](_0x54aa01,[_0x898d('0x34'),_0x26146c])['id']},{}));}return BPromise[_0x898d('0x4f')](_0x5361b6);});})[_0x898d('0x12')](respondWithResult(_0x48b104,0xc9))[_0x898d('0x1d')](handleError(_0x48b104,null));};exports[_0x898d('0x89')]=function(_0x1f5873,_0x2ffef5){if(_0x1f5873['body']['id']){delete _0x1f5873[_0x898d('0x5d')]['id'];}return db['User'][_0x898d('0x33')]({'where':{'id':_0x1f5873['params']['id']}})['then'](function(_0x172d0c){if(!_0x172d0c)return null;if(_0x172d0c['id']===_0x1f5873[_0x898d('0x2a')]['id']){if(!_0x1f5873['body'][_0x898d('0x8a')]||!_0x1f5873[_0x898d('0x5d')][_0x898d('0x8b')]){throw new db['Sequelize'][(_0x898d('0x8c'))](_0x898d('0x8d'));}if(!_0x172d0c[_0x898d('0x8e')](_0x1f5873['body']['oldPassword'])){throw new db['Sequelize'][(_0x898d('0x8c'))]('Wrong\x20credentials');}if(_0x1f5873[_0x898d('0x5d')][_0x898d('0x8a')]===_0x1f5873[_0x898d('0x5d')][_0x898d('0x8b')]){throw new db[(_0x898d('0x8f'))][(_0x898d('0x8c'))](_0x898d('0x90'));}}else if(_0x1f5873[_0x898d('0x2a')][_0x898d('0x32')]===_0x898d('0x7c')){if(!_0x1f5873[_0x898d('0x5d')][_0x898d('0x8b')]){throw new db[(_0x898d('0x8f'))][(_0x898d('0x8c'))](_0x898d('0x91'));}}else if(_0x1f5873[_0x898d('0x2a')]['role']===_0x898d('0x2a')){if(!_0x1f5873[_0x898d('0x5d')][_0x898d('0x8b')]){throw new db[(_0x898d('0x8f'))][(_0x898d('0x8c'))](_0x898d('0x91'));}if(_0x172d0c[_0x898d('0x32')]!==_0x898d('0x70')){throw new db[(_0x898d('0x8f'))][(_0x898d('0x8c'))](_0x898d('0x7a'));}}else{throw new db[(_0x898d('0x8f'))]['ValidationError'](_0x898d('0x7a'));}return _0x172d0c;})[_0x898d('0x12')](handleEntityNotFound(_0x2ffef5,null))[_0x898d('0x12')](function(_0x4cd426){return db[_0x898d('0x63')][_0x898d('0x92')]({'attributes':['id','securePassword',_0x898d('0x93'),'passwordHistoryLimit']})[_0x898d('0x12')](function(_0x304eb6){if(_0x304eb6[_0x898d('0x65')])authService['validatePasswordPattern'](_0x1f5873[_0x898d('0x5d')][_0x898d('0x8b')]);if(!_0x304eb6[_0x898d('0x93')]||!_0x4cd426['previousPasswords'])return _0x4cd426;authService[_0x898d('0x94')](_0x1f5873['body'][_0x898d('0x8b')],_0x4cd426[_0x898d('0x95')],_0x304eb6[_0x898d('0x96')]);return _0x4cd426;})['then'](saveUpdates({'password':_0x1f5873[_0x898d('0x5d')][_0x898d('0x8b')],'passwordResetAt':_0x1f5873[_0x898d('0x2a')]['id']==_0x1f5873[_0x898d('0x51')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x1f5873[_0x898d('0x5d')][_0x898d('0x8b')],_0x4cd426[_0x898d('0x95')])},null));})[_0x898d('0x12')](respondWithResult(_0x2ffef5,null))[_0x898d('0x1d')](handleError(_0x2ffef5,null));};exports[_0x898d('0x97')]=function(_0x5d7c68,_0x11a674){var _0x33a6fd=_0x5d7c68[_0x898d('0x5d')][_0x898d('0x98')];return db['User']['find']({'where':{'id':_0x5d7c68[_0x898d('0x51')]['id']},'attributes':['id',_0x898d('0x34'),_0x898d('0x32'),_0x898d('0x99'),_0x898d('0x9a'),_0x898d('0x9b'),'interface']})[_0x898d('0x12')](handleEntityNotFound(_0x11a674,null))['then'](function(_0x1a46c7){if(_0x1a46c7){if(!utils['isValidChannel'](_0x33a6fd)){throw new db[(_0x898d('0x8f'))][(_0x898d('0x8c'))](_0x898d('0x9c'));}return _0x1a46c7['add'+_[_0x898d('0x9d')](_0x33a6fd[_0x898d('0x9e')]())+_0x898d('0x9f')](_0x5d7c68['body'][_0x898d('0x60')],{'penalty':_0x5d7c68[_0x898d('0x5d')][_0x898d('0xa0')]||0x0})[_0x898d('0xa1')](function(_0x2fd5ba){for(var _0x5afb65=0x0;_0x5afb65<_0x5d7c68[_0x898d('0x5d')][_0x898d('0x60')][_0x898d('0x59')];_0x5afb65+=0x1){var _0xb3719e={'UserId':Number(_0x5d7c68['params']['id'])};_0xb3719e[_[_0x898d('0x9d')](_0x33a6fd[_0x898d('0x9e')]())+_0x898d('0xa2')]=Number(_0x5d7c68[_0x898d('0x5d')][_0x898d('0x60')][_0x5afb65]);socket[_0x898d('0xa3')](_0x898d('0x2a')+_[_0x898d('0x9d')](_0x33a6fd[_0x898d('0x9e')]())+_0x898d('0xa4'),_0xb3719e);}return _0x2fd5ba;})[_0x898d('0x12')](function(){if(_0x33a6fd===_0x898d('0xa5')){return db[_0x898d('0xa6')][_0x898d('0x45')]({'where':{'id':_0x5d7c68[_0x898d('0x5d')][_0x898d('0x60')]||[]},'raw':!![],'attributes':['id',_0x898d('0x34')]});}})[_0x898d('0x12')](function(_0x1f3200){var _0x55378b=_0x1a46c7[_0x898d('0x28')]({'plain':!![]});var _0x2f1cd2=[];if(_0x33a6fd===_0x898d('0xa5')&&_0x55378b['role']==='agent'&&_0x55378b[_0x898d('0x99')]){for(var _0x2ae770=0x0;_0x2ae770<_0x1f3200[_0x898d('0x59')];_0x2ae770+=0x1){_0x2f1cd2[_0x898d('0x44')]({'membername':_0x55378b[_0x898d('0x34')],'UserId':_0x55378b['id'],'queue_name':_0x1f3200[_0x2ae770][_0x898d('0x34')],'VoiceQueueId':_0x1f3200[_0x2ae770]['id'],'interface':_[_0x898d('0x67')](_0x55378b[_0x898d('0xa7')])?util[_0x898d('0xa8')](_0x898d('0xa9'),_0x55378b[_0x898d('0x34')]):_0x55378b[_0x898d('0xa7')],'paused':_0x55378b[_0x898d('0x9b')]||![],'penalty':_0x5d7c68[_0x898d('0x5d')]['penalty']||0x0});}return BPromise['each'](_0x2f1cd2,function(_0x290026){return db[_0x898d('0xaa')][_0x898d('0xab')](_0x290026);});}return _0x1a46c7;});}})[_0x898d('0x12')](respondWithStatusCode(_0x11a674,null))['catch'](handleError(_0x11a674,null));};exports[_0x898d('0xac')]=function(_0x7a2e02,_0x56296e){var _0x4dd7d0;return db[_0x898d('0x40')][_0x898d('0x33')]({'where':{'id':_0x7a2e02[_0x898d('0x51')]['id']},'attributes':['id',_0x898d('0x34'),_0x898d('0x32')]})[_0x898d('0x12')](handleEntityNotFound(_0x56296e,null))[_0x898d('0x12')](function(_0x29b035){if(_0x29b035){_0x4dd7d0=_0x29b035;if(!_0x7a2e02['query'][_0x898d('0x98')]||!utils[_0x898d('0xad')](_0x7a2e02[_0x898d('0x47')][_0x898d('0x98')])){throw new db[(_0x898d('0x8f'))][(_0x898d('0x8c'))](_0x898d('0x9c'));}return _0x29b035[_0x898d('0xae')+_[_0x898d('0x9d')](_0x7a2e02[_0x898d('0x47')][_0x898d('0x98')]['toLowerCase']())+'Queues'](_0x7a2e02[_0x898d('0x47')]['ids']);}})[_0x898d('0x12')](function(_0x19c329){if(_['isArray'](_0x7a2e02['query'][_0x898d('0x60')])){for(var _0x25fd63=0x0;_0x25fd63<_0x7a2e02['query'][_0x898d('0x60')][_0x898d('0x59')];_0x25fd63+=0x1){var _0x47e4e9={'UserId':Number(_0x7a2e02[_0x898d('0x51')]['id'])};_0x47e4e9[_[_0x898d('0x9d')](_0x7a2e02['query'][_0x898d('0x98')][_0x898d('0x9e')]())+'QueueId']=Number(_0x7a2e02[_0x898d('0x47')]['ids'][_0x25fd63]);socket['emit'](_0x898d('0x2a')+_[_0x898d('0x9d')](_0x7a2e02[_0x898d('0x47')][_0x898d('0x98')]['toLowerCase']())+'Queue:remove',_0x47e4e9);}}else{var _0x47e4e9={'UserId':Number(_0x7a2e02['params']['id'])};_0x47e4e9[_['capitalize'](_0x7a2e02[_0x898d('0x47')]['channel'][_0x898d('0x9e')]())+_0x898d('0xa2')]=Number(_0x7a2e02[_0x898d('0x47')][_0x898d('0x60')]);socket['emit'](_0x898d('0x2a')+_[_0x898d('0x9d')](_0x7a2e02['query']['channel'][_0x898d('0x9e')]())+'Queue:remove',_0x47e4e9);}return _0x19c329;})['then'](function(){if(_0x7a2e02[_0x898d('0x47')][_0x898d('0x98')]===_0x898d('0xa5')){return db[_0x898d('0xaa')][_0x898d('0x27')]({'where':{'UserId':_0x7a2e02['params']['id'],'VoiceQueueId':_0x7a2e02['query'][_0x898d('0x60')]},'individualHooks':!![]})[_0x898d('0x12')](function(){return _0x4dd7d0;});}return _0x4dd7d0;})[_0x898d('0x12')](respondWithStatusCode(_0x56296e,null))[_0x898d('0x1d')](handleError(_0x56296e,null));};exports['addAvatar']=function(_0x3c03b4,_0x21b474){_0x3c03b4[_0x898d('0x5d')]['userpic']=_0x3c03b4[_0x898d('0xaf')][_0x898d('0xb0')];return db[_0x898d('0x40')]['find']({'where':{'id':_0x3c03b4[_0x898d('0x51')]['id']}})['then'](handleEntityNotFound(_0x21b474,null))[_0x898d('0x12')](saveUpdates(_0x3c03b4[_0x898d('0x5d')],null))['then'](respondWithResult(_0x21b474,null))['catch'](handleError(_0x21b474,null));};exports['getAvatar']=function(_0x44b304,_0x45e4a4){var _0x372dfe=path[_0x898d('0xb1')](config[_0x898d('0xb2')],_0x898d('0xb3'));return db[_0x898d('0x40')][_0x898d('0x33')]({'where':{'id':_0x44b304[_0x898d('0x51')]['id']},'attributes':['id',_0x898d('0xb4')],'raw':!![]})[_0x898d('0x12')](handleEntityNotFound(_0x45e4a4,null))[_0x898d('0x12')](function(_0x151c4a){if(_0x151c4a){if(_[_0x898d('0x67')](_0x151c4a[_0x898d('0xb4')])){return _0x45e4a4[_0x898d('0xb5')](_0x372dfe);}else{if(!fs[_0x898d('0xb6')](path[_0x898d('0xb1')](config[_0x898d('0xb2')],_0x898d('0xb7'),_0x151c4a[_0x898d('0xb4')]))){return _0x45e4a4[_0x898d('0xb5')](_0x372dfe);}return _0x45e4a4[_0x898d('0xb5')](path[_0x898d('0xb1')](config[_0x898d('0xb2')],_0x898d('0xb7'),_0x151c4a['userpic']));}}})[_0x898d('0x1d')](handleError(_0x45e4a4,null));};exports[_0x898d('0xb8')]=function(_0x57d8a8,_0x1ed12f){return db['User'][_0x898d('0x33')]({'where':{'id':_0x57d8a8[_0x898d('0x51')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x1ed12f,null))[_0x898d('0x12')](function(_0x29e039){var _0x257213=[];values=_0x29e039['dataValues'];_0x257213[_0x898d('0x44')](get_open_tabs(_0x898d('0x5a'),_0x29e039[_0x898d('0x4a')]));_0x257213[_0x898d('0x44')](get_open_tabs('sms',_0x29e039[_0x898d('0x4a')]));_0x257213[_0x898d('0x44')](get_open_tabs(_0x898d('0x4e'),_0x29e039['dataValues']));_0x257213[_0x898d('0x44')](get_open_tabs(_0x898d('0x5b'),_0x29e039[_0x898d('0x4a')]));_0x257213['push'](get_open_tabs(_0x898d('0x4c'),_0x29e039[_0x898d('0x4a')]));_0x257213[_0x898d('0x44')](get_open_tabs(_0x898d('0x4d'),_0x29e039[_0x898d('0x4a')]));return BPromise[_0x898d('0x4f')](_0x257213);})['then'](function(_0x186717){var _0xeae44f=[];if(_0x186717){for(var _0x1cc62f=0x0;_0x1cc62f=_0x19a847){_0xdee0ec=_0x19a847;_0x49fd2b=0xc8;}else{_0x49fd2b=0xce;}_0x43b096['status'](_0x49fd2b);return _0x43b096['set'](_0xb6a0('0x25'),_0x38a343+'-'+_0xdee0ec+'/'+_0x19a847)['json'](_0x369626);}return null;};}function saveUpdates(_0x1318e2){return function(_0x372e32){if(_0x372e32){return _0x372e32[_0xb6a0('0x26')](_0x1318e2)['then'](function(_0x10e8ba){return _0x10e8ba;});}return null;};}function removeEntity(_0x16d2ea){return function(_0x528b5a){if(_0x528b5a){return _0x528b5a[_0xb6a0('0x27')]()[_0xb6a0('0x13')](function(){var _0x5ec47e=_0x528b5a['get']({'plain':!![]});if(_0x5ec47e['role']===_0xb6a0('0x28'))return;var _0x3f194b=[{'name':'Users','value':_0xb6a0('0x29'),'ignore':!![]},{'name':_0xb6a0('0x2a'),'value':'agent','ignore':![]},{'name':_0xb6a0('0x2b'),'value':_0xb6a0('0x2c'),'ignore':![]}];var _0x431117=_(_0x3f194b)[_0xb6a0('0x2d')](_0xb6a0('0x2e'))[_0xb6a0('0x2f')]('value')[_0xb6a0('0x30')]();if(_[_0xb6a0('0x31')](_0x431117,_0x5ec47e[_0xb6a0('0x32')])){return;}var _0x2b2ffd=_['find'](_0x3f194b,[_0xb6a0('0x30'),_0x5ec47e[_0xb6a0('0x32')]])[_0xb6a0('0x33')];return db[_0xb6a0('0x34')]['destroy']({'where':{'type':_0x2b2ffd,'resourceId':_0x5ec47e['id']}})[_0xb6a0('0x13')](function(){return _0x528b5a;});})['then'](function(){_0x16d2ea[_0xb6a0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43aa0c){return function(_0x16bd71){if(!_0x16bd71){_0x43aa0c[_0xb6a0('0x1d')](0x194);}return _0x16bd71;};}function handleError(_0x3c6afa,_0x2ec4af){_0x2ec4af=_0x2ec4af||0x1f4;return function(_0x1ae439){logger[_0xb6a0('0x19')](_0x1ae439['stack']);if(_0x1ae439[_0xb6a0('0x33')]){delete _0x1ae439['name'];}_0x3c6afa['status'](_0x2ec4af)[_0xb6a0('0x35')](_0x1ae439);};}exports[_0xb6a0('0x36')]=function(_0x1c3793,_0x59f822){var _0x5a9cad={},_0x27f461={'count':0x0,'rows':[]};var _0x5e0c63=_(db[_0xb6a0('0x37')]['rawAttributes'])[_0xb6a0('0x2f')](function(_0x54836f){return{'name':_0x54836f['fieldName'],'type':_0x54836f[_0xb6a0('0x38')][_0xb6a0('0x39')]};})['filter'](function(_0x153d3e){return!_[_0xb6a0('0x31')]([_0xb6a0('0x3a'),_0xb6a0('0x3b')],_0x153d3e[_0xb6a0('0x33')]);})[_0xb6a0('0x30')]();_0x5a9cad=qs[_0xb6a0('0x3c')](_0x5e0c63,_0x1c3793);var _0x408001={'where':_0x5a9cad[_0xb6a0('0x3d')]};return db[_0xb6a0('0x37')]['count'](_0x408001)['then'](function(_0x199d7e){_0x27f461[_0xb6a0('0x24')]=_0x199d7e;if(_0x1c3793['query'][_0xb6a0('0x3e')]){_0x5a9cad[_0xb6a0('0x3f')]=[{'all':!![]}];}if(!_['includes'](_0x5a9cad['attributes'],'id')){_0x5a9cad[_0xb6a0('0x40')][_0xb6a0('0x41')]('id');}return db[_0xb6a0('0x37')]['findAll'](_0x5a9cad);})[_0xb6a0('0x13')](function(_0x57f968){_0x27f461['rows']=_0x57f968;if(_0x1c3793['query']['openTabs']==='true'){var _0x311a63=[];for(var _0x414ad0=0x0;_0x414ad0<_0x27f461[_0xb6a0('0x42')][_0xb6a0('0x43')];_0x414ad0++){_0x311a63[_0xb6a0('0x41')](get_open_tabs('chat',_0x27f461[_0xb6a0('0x42')][_0x414ad0][_0xb6a0('0x44')]));_0x311a63[_0xb6a0('0x41')](get_open_tabs(_0xb6a0('0x45'),_0x27f461[_0xb6a0('0x42')][_0x414ad0]['dataValues']));_0x311a63[_0xb6a0('0x41')](get_open_tabs(_0xb6a0('0x46'),_0x27f461['rows'][_0x414ad0]['dataValues']));_0x311a63[_0xb6a0('0x41')](get_open_tabs(_0xb6a0('0x47'),_0x27f461[_0xb6a0('0x42')][_0x414ad0][_0xb6a0('0x44')]));_0x311a63[_0xb6a0('0x41')](get_open_tabs(_0xb6a0('0x48'),_0x27f461[_0xb6a0('0x42')][_0x414ad0]['dataValues']));_0x311a63['push'](get_open_tabs(_0xb6a0('0x49'),_0x27f461['rows'][_0x414ad0][_0xb6a0('0x44')]));}return BPromise['all'](_0x311a63)[_0xb6a0('0x13')](function(_0x36e405){return _0x27f461;});}else{return _0x27f461;}})['then'](respondWithFilteredResult(_0x59f822,_0x5a9cad))['catch'](handleError(_0x59f822,null));};exports['show']=function(_0x330710,_0x4d3586){var _0xa38cad={'raw':![],'where':{'id':_0x330710[_0xb6a0('0x4a')]['id']}},_0x51c927={};_0x51c927[_0xb6a0('0x4b')]=_[_0xb6a0('0x4c')](_[_0xb6a0('0x4d')](db[_0xb6a0('0x37')]['rawAttributes']),['password',_0xb6a0('0x3b')]);_0x51c927[_0xb6a0('0x4e')]=_['keys'](_0x330710['query']);_0x51c927[_0xb6a0('0x4f')]=_['intersection'](_0x51c927[_0xb6a0('0x4b')],_0x51c927[_0xb6a0('0x4e')]);_0xa38cad[_0xb6a0('0x40')]=_['intersection'](_0x51c927[_0xb6a0('0x4b')],qs['fields'](_0x330710['query'][_0xb6a0('0x50')]));_0xa38cad[_0xb6a0('0x40')]=_0xa38cad[_0xb6a0('0x40')][_0xb6a0('0x43')]?_0xa38cad['attributes']:_0x51c927[_0xb6a0('0x4b')];if(_0x330710[_0xb6a0('0x4e')][_0xb6a0('0x3e')]){_0xa38cad['include']=[{'all':!![]}];}_0xa38cad=_[_0xb6a0('0x51')]({},_0xa38cad,_0x330710['options']);if(!_[_0xb6a0('0x31')](_0xa38cad['attributes'],'id')){_0xa38cad['attributes']['push']('id');}return db[_0xb6a0('0x37')][_0xb6a0('0x52')](_0xa38cad)[_0xb6a0('0x13')](handleEntityNotFound(_0x4d3586,null))[_0xb6a0('0x13')](function(_0x35c326){var _0xcd872b=[];values=_0x35c326;if(_0x330710[_0xb6a0('0x4e')][_0xb6a0('0x53')]==='true'){_0xcd872b[_0xb6a0('0x41')](get_open_tabs('chat',_0x35c326[_0xb6a0('0x44')]));_0xcd872b[_0xb6a0('0x41')](get_open_tabs(_0xb6a0('0x45'),_0x35c326[_0xb6a0('0x44')]));_0xcd872b['push'](get_open_tabs(_0xb6a0('0x48'),_0x35c326[_0xb6a0('0x44')]));_0xcd872b['push'](get_open_tabs(_0xb6a0('0x49'),_0x35c326[_0xb6a0('0x44')]));_0xcd872b[_0xb6a0('0x41')](get_open_tabs(_0xb6a0('0x46'),_0x35c326[_0xb6a0('0x44')]));_0xcd872b[_0xb6a0('0x41')](get_open_tabs(_0xb6a0('0x47'),_0x35c326['dataValues']));return BPromise['all'](_0xcd872b);}else{return values;}})[_0xb6a0('0x13')](function(_0x5c5057){return values;})['then'](respondWithResult(_0x4d3586,null))[_0xb6a0('0x54')](handleError(_0x4d3586,null));};exports[_0xb6a0('0x26')]=function(_0xd4ba23,_0x24666a){if(_0xd4ba23[_0xb6a0('0x55')]['id']){delete _0xd4ba23[_0xb6a0('0x55')]['id'];}delete _0xd4ba23[_0xb6a0('0x55')][_0xb6a0('0x32')];return db[_0xb6a0('0x37')]['find']({'where':{'id':_0xd4ba23[_0xb6a0('0x4a')]['id']}})[_0xb6a0('0x13')](handleEntityNotFound(_0x24666a,null))[_0xb6a0('0x13')](saveUpdates(_0xd4ba23[_0xb6a0('0x55')],null))['then'](respondWithResult(_0x24666a,null))['catch'](handleError(_0x24666a,null));};exports[_0xb6a0('0x56')]=function(_0x21bb7e,_0x27dca4){return db[_0xb6a0('0x37')][_0xb6a0('0x56')]()['then'](respondWithResult(_0x27dca4,null))[_0xb6a0('0x54')](handleError(_0x27dca4,null));};exports[_0xb6a0('0x57')]=function(_0xa99008,_0x1cc05c){return db[_0xb6a0('0x37')][_0xb6a0('0x52')]({'where':{'id':_0xa99008[_0xb6a0('0x4a')]['id']}})[_0xb6a0('0x13')](handleEntityNotFound(_0x1cc05c,null))[_0xb6a0('0x13')](function(_0x493a97){if(_0x493a97){return _0x493a97[_0xb6a0('0x57')](_0xa99008['body'][_0xb6a0('0x58')],_[_0xb6a0('0x59')](_0xa99008[_0xb6a0('0x55')],[_0xb6a0('0x58'),'id'])||{});}})[_0xb6a0('0x13')](respondWithResult(_0x1cc05c,null))[_0xb6a0('0x54')](handleError(_0x1cc05c,null));};function validateUser(_0x2b15fc){return new BPromise(function(_0x223b7e,_0x5cf40d){if(_0x2b15fc[_0xb6a0('0x5a')])return _0x223b7e(_0x2b15fc);return db[_0xb6a0('0x5b')]['findById'](0x1)[_0xb6a0('0x13')](function(_0x4f47e7){if(_0x4f47e7[_0xb6a0('0x5c')])authService[_0xb6a0('0x5d')](_0x2b15fc[_0xb6a0('0x3a')]);db[_0xb6a0('0x37')][_0xb6a0('0x5e')](_0xb6a0('0x5a'))[_0xb6a0('0x13')](function(_0x1ec899){if(_['isNil'](_0x1ec899)){_0x2b15fc['internal']=_0x4f47e7[_0xb6a0('0x5f')]||0x1;return;}if(_[_0xb6a0('0x60')](_0x4f47e7[_0xb6a0('0x5f')])||_0x4f47e7[_0xb6a0('0x5f')]===_0x1ec899){_0x2b15fc[_0xb6a0('0x5a')]=_0x1ec899+0x1;return;}if(_0x4f47e7['min_internal']>_0x1ec899){_0x2b15fc[_0xb6a0('0x5a')]=_0x4f47e7[_0xb6a0('0x5f')];return;}return db[_0xb6a0('0x61')][_0xb6a0('0x4e')](_0xb6a0('0x62'),{'type':db[_0xb6a0('0x61')]['QueryTypes'][_0xb6a0('0x63')]})['then'](function(_0x4563ae){if(_0x4563ae&&_0x4563ae[_0xb6a0('0x43')]){for(var _0x4b06d8=0x0,_0x4de1fd=_0x4563ae[_0xb6a0('0x43')];_0x4b06d8<_0x4de1fd&&_[_0xb6a0('0x60')](_0x2b15fc[_0xb6a0('0x5a')]);_0x4b06d8++){if(_0x4f47e7[_0xb6a0('0x5f')]<=_0x4563ae[_0x4b06d8][_0xb6a0('0x64')]){_0x2b15fc[_0xb6a0('0x5a')]=_0x4563ae[_0x4b06d8][_0xb6a0('0x64')];}else if(_0x4f47e7[_0xb6a0('0x5f')]>_0x4563ae[_0x4b06d8]['from']&&_0x4f47e7[_0xb6a0('0x5f')]<=_0x4563ae[_0x4b06d8]['to']){_0x2b15fc[_0xb6a0('0x5a')]=_0x4f47e7[_0xb6a0('0x5f')];}}}if(_[_0xb6a0('0x60')](_0x2b15fc['internal'])){_0x2b15fc[_0xb6a0('0x5a')]=_0x1ec899+0x1;}return _0x223b7e(_0x2b15fc);});});})[_0xb6a0('0x54')](function(_0x3378e5){_0x5cf40d(_0x3378e5);});});}function updateUser(_0x2392f7){return new BPromise(function(_0x54912c,_0x19dd75){try{if(_0x2392f7[_0xb6a0('0x65')]){_0x2392f7[_0xb6a0('0x66')]=_0x2392f7[_0xb6a0('0x5a')];_0x2392f7[_0xb6a0('0x67')]={'mailbox':_0x2392f7['internal'],'password':_0x2392f7[_0xb6a0('0x3a')],'fullname':_0x2392f7['fullname'],'email':_0x2392f7['email']};}if(_0x2392f7['role']===_0xb6a0('0x68')){if(!_0x2392f7[_0xb6a0('0x69')])_0x2392f7[_0xb6a0('0x69')]=['101',_0xb6a0('0x6a'),_0xb6a0('0x6b'),'113',_0xb6a0('0x6c'),_0xb6a0('0x6d'),_0xb6a0('0x6e'),_0xb6a0('0x6f'),_0xb6a0('0x70'),_0xb6a0('0x71'),_0xb6a0('0x72'),'100',_0xb6a0('0x73'),_0xb6a0('0x74'),_0xb6a0('0x75')];}_0x54912c(_0x2392f7);}catch(_0x1997be){_0x19dd75(_0x1997be);}});}exports[_0xb6a0('0x76')]=function(_0x311349,_0x2d148a){if(_0x311349['user'][_0xb6a0('0x32')]===_0xb6a0('0x68'))throw new Error('Unauthorized');if(_0x311349[_0xb6a0('0x55')]['role']==='user'&&_0x311349[_0xb6a0('0x29')][_0xb6a0('0x32')]!==_0xb6a0('0x28')){throw new Error(_0xb6a0('0x77'));}if(_0x311349[_0xb6a0('0x55')]['role']==='admin'&&_0x311349[_0xb6a0('0x29')][_0xb6a0('0x32')]!==_0xb6a0('0x28')){throw new Error(_0xb6a0('0x78'));}return licenseUtil[_0xb6a0('0x79')]([_0x311349[_0xb6a0('0x55')]])['then'](function(){return validateUser(_0x311349[_0xb6a0('0x55')]);})[_0xb6a0('0x13')](function(_0x582050){return updateUser(_0x582050)[_0xb6a0('0x13')](function(_0x217470){if(_0x217470[_0xb6a0('0x32')]==='admin'){_0x217470[_0xb6a0('0x7a')]=_0x311349[_0xb6a0('0x29')][_0xb6a0('0x7a')];delete _0x217470['userProfileId'];}return _0x217470;});})[_0xb6a0('0x13')](function(_0x5abece){return db[_0xb6a0('0x37')]['create'](_0x5abece,{'include':[{'model':db['VoiceMail'],'as':_0xb6a0('0x67')}]});})[_0xb6a0('0x13')](function(_0x8bc6e){if(_0x311349[_0xb6a0('0x55')]['role']===_0xb6a0('0x29'))return _0x8bc6e;if(_0x311349['user'][_0xb6a0('0x32')]!=='user')return _0x8bc6e;return db[_0xb6a0('0x7b')]['find']({'where':{'name':_0x8bc6e[_0xb6a0('0x32')]==='agent'?_0xb6a0('0x2a'):_0xb6a0('0x2b'),'userProfileId':_0x311349[_0xb6a0('0x29')][_0xb6a0('0x7c')]},'raw':!![]})[_0xb6a0('0x13')](function(_0xa2860a){if(!_0xa2860a||_0xa2860a[_0xb6a0('0x7d')]!=0x0)return _0x8bc6e;return db['UserProfileResource'][_0xb6a0('0x76')]({'name':_0x8bc6e[_0xb6a0('0x33')],'resourceId':_0x8bc6e['id'],'type':_0xa2860a[_0xb6a0('0x33')],'sectionId':_0xa2860a['id']},{})[_0xb6a0('0x13')](function(){return _0x8bc6e;});})[_0xb6a0('0x54')](function(_0x5a0ff0){logger['error'](_0xb6a0('0x7e'),_0x5a0ff0);throw _0x5a0ff0;});})[_0xb6a0('0x13')](respondWithResult(_0x2d148a,0xc9))[_0xb6a0('0x54')](handleError(_0x2d148a,null));};exports[_0xb6a0('0x7f')]=function(_0xa442a9,_0x1e354f){var _0x3f40c8=_0xa442a9[_0xb6a0('0x55')];var _0x12e953=[];if(_0xa442a9['user'][_0xb6a0('0x32')]===_0xb6a0('0x68'))throw new Error('Unauthorized');if(_[_0xb6a0('0x80')](_0x3f40c8,[_0xb6a0('0x32'),'user'])&&_0xa442a9[_0xb6a0('0x29')][_0xb6a0('0x32')]!==_0xb6a0('0x28')){throw new Error(_0xb6a0('0x77'));}if(_[_0xb6a0('0x80')](_0x3f40c8,[_0xb6a0('0x32'),'admin'])&&_0xa442a9[_0xb6a0('0x29')][_0xb6a0('0x32')]!==_0xb6a0('0x28')){throw new Error(_0xb6a0('0x81'));}return licenseUtil[_0xb6a0('0x79')](_0x3f40c8)[_0xb6a0('0x13')](function(){return validateUser(_0x3f40c8[0x0]);})[_0xb6a0('0x13')](function(){for(var _0x3e48b1=0x1;_0x3e48b1<_0x3f40c8[_0xb6a0('0x43')];_0x3e48b1++){var _0x1586f5=_0x3f40c8[_0x3e48b1-0x1][_0xb6a0('0x5a')];if(!_0x3f40c8[_0x3e48b1][_0xb6a0('0x5a')])_0x3f40c8[_0x3e48b1][_0xb6a0('0x5a')]=_0x1586f5+0x1;_0x12e953[_0xb6a0('0x41')](validateUser(_0x3f40c8[_0x3e48b1]));}return BPromise['all'](_0x12e953);})[_0xb6a0('0x13')](function(){_0x12e953=[];for(var _0xea6c58=0x0;_0xea6c58<_0x3f40c8['length'];_0xea6c58++){_0x12e953[_0xb6a0('0x41')](updateUser(_0x3f40c8[_0xea6c58]));}return BPromise[_0xb6a0('0x82')](_0x12e953);})[_0xb6a0('0x13')](function(){return BPromise[_0xb6a0('0x83')](_0x3f40c8,function(_0x149e77){return db[_0xb6a0('0x37')][_0xb6a0('0x76')](_0x149e77,{'include':[{'model':db[_0xb6a0('0x67')],'as':_0xb6a0('0x67')}]})[_0xb6a0('0x13')](function(_0x1da976){_0x149e77['id']=_0x1da976['id'];return _0x149e77;});});})[_0xb6a0('0x13')](function(_0x555ad7){if(_0xa442a9[_0xb6a0('0x55')][_0xb6a0('0x32')]===_0xb6a0('0x29'))return _0x555ad7;if(_0xa442a9[_0xb6a0('0x29')]['role']!==_0xb6a0('0x29'))return _0x555ad7;var _0x28e39a=_[_0xb6a0('0x80')](_0x555ad7,function(_0x1f0630){return _0x1f0630[_0xb6a0('0x32')]===_0xb6a0('0x68')||_0x1f0630[_0xb6a0('0x32')]===_0xb6a0('0x2c');});if(!_0x28e39a)return _0x555ad7;return db[_0xb6a0('0x7b')][_0xb6a0('0x84')]({'where':{'name':{'$or':[_0xb6a0('0x2a'),_0xb6a0('0x2b')]},'userProfileId':_0xa442a9['user']['userProfileId']},'raw':!![]})[_0xb6a0('0x13')](function(_0x530202){if(_[_0xb6a0('0x85')](_0x530202)||!_[_0xb6a0('0x80')](_0x530202,[_0xb6a0('0x7d'),0x0]))return _0x555ad7;_0x12e953=[];var _0xec540e=_(_0x530202)[_0xb6a0('0x2f')](function(_0x396852){if(_0x396852[_0xb6a0('0x7d')]===0x1)return;return _0x396852['name']===_0xb6a0('0x2a')?_0xb6a0('0x68'):'telephone';})[_0xb6a0('0x86')]()['value']();for(var _0xd4a68a=0x0;_0xd4a68a<_0x555ad7[_0xb6a0('0x43')];_0xd4a68a++){if(!_[_0xb6a0('0x31')](_0xec540e,_0x555ad7[_0xd4a68a][_0xb6a0('0x32')]))return;var _0x2865c0=_0x555ad7[_0xd4a68a][_0xb6a0('0x32')]==='agent'?_0xb6a0('0x2a'):_0xb6a0('0x2b');_0x12e953['push'](db[_0xb6a0('0x34')][_0xb6a0('0x76')]({'name':_0x555ad7[_0xd4a68a][_0xb6a0('0x33')],'resourceId':_0x555ad7[_0xd4a68a]['id'],'type':_0x2865c0,'sectionId':_[_0xb6a0('0x52')](_0x530202,[_0xb6a0('0x33'),_0x2865c0])['id']},{}));}return BPromise[_0xb6a0('0x82')](_0x12e953);});})[_0xb6a0('0x13')](respondWithResult(_0x1e354f,0xc9))[_0xb6a0('0x54')](handleError(_0x1e354f,null));};exports['changePassword']=function(_0x38d71f,_0x4135ac){if(_0x38d71f[_0xb6a0('0x55')]['id']){delete _0x38d71f[_0xb6a0('0x55')]['id'];}return db['User']['find']({'where':{'id':_0x38d71f['params']['id']}})['then'](function(_0x2e0145){if(!_0x2e0145)return null;if(_0x2e0145['id']===_0x38d71f[_0xb6a0('0x29')]['id']){if(!_0x38d71f[_0xb6a0('0x55')][_0xb6a0('0x87')]||!_0x38d71f[_0xb6a0('0x55')]['newPassword']){throw new db[(_0xb6a0('0x88'))][(_0xb6a0('0x89'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2e0145['authenticate'](_0x38d71f[_0xb6a0('0x55')][_0xb6a0('0x87')])){throw new db['Sequelize'][(_0xb6a0('0x89'))](_0xb6a0('0x8a'));}if(_0x38d71f[_0xb6a0('0x55')][_0xb6a0('0x87')]===_0x38d71f['body'][_0xb6a0('0x8b')]){throw new db[(_0xb6a0('0x88'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x38d71f[_0xb6a0('0x29')]['role']===_0xb6a0('0x28')){if(!_0x38d71f['body']['newPassword']){throw new db[(_0xb6a0('0x88'))][(_0xb6a0('0x89'))](_0xb6a0('0x8c'));}}else if(_0x38d71f[_0xb6a0('0x29')][_0xb6a0('0x32')]===_0xb6a0('0x29')){if(!_0x38d71f['body'][_0xb6a0('0x8b')]){throw new db[(_0xb6a0('0x88'))]['ValidationError'](_0xb6a0('0x8c'));}if(_0x2e0145[_0xb6a0('0x32')]!==_0xb6a0('0x68')){throw new db[(_0xb6a0('0x88'))][(_0xb6a0('0x89'))](_0xb6a0('0x8d'));}}else{throw new db['Sequelize'][(_0xb6a0('0x89'))](_0xb6a0('0x8d'));}return _0x2e0145;})[_0xb6a0('0x13')](handleEntityNotFound(_0x4135ac,null))[_0xb6a0('0x13')](function(_0x18ff22){return db['Setting']['findOne']({'attributes':['id',_0xb6a0('0x5c'),_0xb6a0('0x8e'),_0xb6a0('0x8f')]})['then'](function(_0x35cc5a){if(_0x35cc5a[_0xb6a0('0x5c')])authService[_0xb6a0('0x5d')](_0x38d71f[_0xb6a0('0x55')][_0xb6a0('0x8b')]);if(!_0x35cc5a[_0xb6a0('0x8e')]||!_0x18ff22['previousPasswords'])return _0x18ff22;authService['validatePasswordHistory'](_0x38d71f[_0xb6a0('0x55')]['newPassword'],_0x18ff22[_0xb6a0('0x90')],_0x35cc5a['passwordHistoryLimit']);return _0x18ff22;})['then'](saveUpdates({'password':_0x38d71f[_0xb6a0('0x55')]['newPassword'],'passwordResetAt':_0x38d71f[_0xb6a0('0x29')]['id']==_0x38d71f['params']['id']?moment():null,'previousPasswords':authService[_0xb6a0('0x91')](_0x38d71f['body']['newPassword'],_0x18ff22['previousPasswords'])},null));})[_0xb6a0('0x13')](respondWithResult(_0x4135ac,null))[_0xb6a0('0x54')](handleError(_0x4135ac,null));};exports[_0xb6a0('0x92')]=function(_0xa9c240,_0x42ca21){var _0x4a17df=_0xa9c240[_0xb6a0('0x55')]['channel'];return db[_0xb6a0('0x37')][_0xb6a0('0x52')]({'where':{'id':_0xa9c240['params']['id']},'attributes':['id',_0xb6a0('0x33'),'role',_0xb6a0('0x93'),_0xb6a0('0x94'),_0xb6a0('0x95'),_0xb6a0('0x96')]})[_0xb6a0('0x13')](handleEntityNotFound(_0x42ca21,null))[_0xb6a0('0x13')](function(_0x5eea65){if(_0x5eea65){if(!utils[_0xb6a0('0x97')](_0x4a17df)){throw new db[(_0xb6a0('0x88'))]['ValidationError'](_0xb6a0('0x98'));}return _0x5eea65[_0xb6a0('0x99')+_[_0xb6a0('0x9a')](_0x4a17df[_0xb6a0('0x9b')]())+'Queues'](_0xa9c240[_0xb6a0('0x55')][_0xb6a0('0x58')],{'penalty':_0xa9c240[_0xb6a0('0x55')][_0xb6a0('0x9c')]||0x0})[_0xb6a0('0x9d')](function(_0x59b3ec){for(var _0x3b2c63=0x0;_0x3b2c63<_0xa9c240[_0xb6a0('0x55')][_0xb6a0('0x58')][_0xb6a0('0x43')];_0x3b2c63+=0x1){var _0x3578e3={'UserId':Number(_0xa9c240[_0xb6a0('0x4a')]['id'])};_0x3578e3[_[_0xb6a0('0x9a')](_0x4a17df[_0xb6a0('0x9b')]())+_0xb6a0('0x9e')]=Number(_0xa9c240[_0xb6a0('0x55')][_0xb6a0('0x58')][_0x3b2c63]);socket[_0xb6a0('0x9f')](_0xb6a0('0x29')+_[_0xb6a0('0x9a')](_0x4a17df[_0xb6a0('0x9b')]())+_0xb6a0('0xa0'),_0x3578e3);}return _0x59b3ec;})['then'](function(){if(_0x4a17df===_0xb6a0('0xa1')){return db[_0xb6a0('0xa2')][_0xb6a0('0x84')]({'where':{'id':_0xa9c240['body'][_0xb6a0('0x58')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xb6a0('0x13')](function(_0x2af8c0){var _0x18b1b7=_0x5eea65[_0xb6a0('0xa3')]({'plain':!![]});var _0x5c55aa=[];if(_0x4a17df==='voice'&&_0x18b1b7[_0xb6a0('0x32')]===_0xb6a0('0x68')&&_0x18b1b7[_0xb6a0('0x93')]){for(var _0x5bb0e6=0x0;_0x5bb0e6<_0x2af8c0['length'];_0x5bb0e6+=0x1){_0x5c55aa[_0xb6a0('0x41')]({'membername':_0x18b1b7[_0xb6a0('0x33')],'UserId':_0x18b1b7['id'],'queue_name':_0x2af8c0[_0x5bb0e6][_0xb6a0('0x33')],'VoiceQueueId':_0x2af8c0[_0x5bb0e6]['id'],'interface':_['isNil'](_0x18b1b7[_0xb6a0('0x96')])?util['format']('SIP/%s',_0x18b1b7['name']):_0x18b1b7['interface'],'paused':_0x18b1b7['voicePause']||![],'penalty':_0xa9c240['body'][_0xb6a0('0x9c')]||0x0});}return BPromise['each'](_0x5c55aa,function(_0x5b8875){return db['UserVoiceQueueRt']['upsert'](_0x5b8875);});}return _0x5eea65;});}})[_0xb6a0('0x13')](respondWithStatusCode(_0x42ca21,null))[_0xb6a0('0x54')](handleError(_0x42ca21,null));};exports[_0xb6a0('0xa4')]=function(_0x4db8ca,_0x4bdcc2){var _0x38e676;return db[_0xb6a0('0x37')][_0xb6a0('0x52')]({'where':{'id':_0x4db8ca[_0xb6a0('0x4a')]['id']},'attributes':['id',_0xb6a0('0x33'),_0xb6a0('0x32')]})['then'](handleEntityNotFound(_0x4bdcc2,null))[_0xb6a0('0x13')](function(_0x443f35){if(_0x443f35){_0x38e676=_0x443f35;if(!_0x4db8ca[_0xb6a0('0x4e')][_0xb6a0('0xa5')]||!utils[_0xb6a0('0x97')](_0x4db8ca[_0xb6a0('0x4e')][_0xb6a0('0xa5')])){throw new db['Sequelize'][(_0xb6a0('0x89'))](_0xb6a0('0x98'));}return _0x443f35[_0xb6a0('0xa6')+_[_0xb6a0('0x9a')](_0x4db8ca[_0xb6a0('0x4e')]['channel'][_0xb6a0('0x9b')]())+_0xb6a0('0xa7')](_0x4db8ca[_0xb6a0('0x4e')][_0xb6a0('0x58')]);}})[_0xb6a0('0x13')](function(_0x119844){if(_[_0xb6a0('0xa8')](_0x4db8ca['query'][_0xb6a0('0x58')])){for(var _0x2f0556=0x0;_0x2f0556<_0x4db8ca[_0xb6a0('0x4e')][_0xb6a0('0x58')][_0xb6a0('0x43')];_0x2f0556+=0x1){var _0x310872={'UserId':Number(_0x4db8ca[_0xb6a0('0x4a')]['id'])};_0x310872[_[_0xb6a0('0x9a')](_0x4db8ca[_0xb6a0('0x4e')][_0xb6a0('0xa5')][_0xb6a0('0x9b')]())+'QueueId']=Number(_0x4db8ca[_0xb6a0('0x4e')][_0xb6a0('0x58')][_0x2f0556]);socket[_0xb6a0('0x9f')](_0xb6a0('0x29')+_[_0xb6a0('0x9a')](_0x4db8ca[_0xb6a0('0x4e')][_0xb6a0('0xa5')][_0xb6a0('0x9b')]())+_0xb6a0('0xa9'),_0x310872);}}else{var _0x310872={'UserId':Number(_0x4db8ca[_0xb6a0('0x4a')]['id'])};_0x310872[_[_0xb6a0('0x9a')](_0x4db8ca[_0xb6a0('0x4e')]['channel']['toLowerCase']())+_0xb6a0('0x9e')]=Number(_0x4db8ca[_0xb6a0('0x4e')][_0xb6a0('0x58')]);socket[_0xb6a0('0x9f')]('user'+_[_0xb6a0('0x9a')](_0x4db8ca['query'][_0xb6a0('0xa5')][_0xb6a0('0x9b')]())+_0xb6a0('0xa9'),_0x310872);}return _0x119844;})[_0xb6a0('0x13')](function(){if(_0x4db8ca[_0xb6a0('0x4e')][_0xb6a0('0xa5')]==='voice'){return db[_0xb6a0('0xaa')][_0xb6a0('0x27')]({'where':{'UserId':_0x4db8ca[_0xb6a0('0x4a')]['id'],'VoiceQueueId':_0x4db8ca[_0xb6a0('0x4e')][_0xb6a0('0x58')]},'individualHooks':!![]})[_0xb6a0('0x13')](function(){return _0x38e676;});}return _0x38e676;})[_0xb6a0('0x13')](respondWithStatusCode(_0x4bdcc2,null))[_0xb6a0('0x54')](handleError(_0x4bdcc2,null));};exports['addAvatar']=function(_0x4232ff,_0x57f166){_0x4232ff[_0xb6a0('0x55')][_0xb6a0('0xab')]=_0x4232ff[_0xb6a0('0xac')][_0xb6a0('0xad')];return db[_0xb6a0('0x37')][_0xb6a0('0x52')]({'where':{'id':_0x4232ff[_0xb6a0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57f166,null))[_0xb6a0('0x13')](saveUpdates(_0x4232ff[_0xb6a0('0x55')],null))[_0xb6a0('0x13')](respondWithResult(_0x57f166,null))['catch'](handleError(_0x57f166,null));};exports['getAvatar']=function(_0x2af6ae,_0x892e80){var _0x13483f=path[_0xb6a0('0xae')](config[_0xb6a0('0xaf')],'server/files/images/logos/default_profile.png');return db[_0xb6a0('0x37')][_0xb6a0('0x52')]({'where':{'id':_0x2af6ae[_0xb6a0('0x4a')]['id']},'attributes':['id',_0xb6a0('0xab')],'raw':!![]})[_0xb6a0('0x13')](handleEntityNotFound(_0x892e80,null))[_0xb6a0('0x13')](function(_0x7a6123){if(_0x7a6123){if(_['isNil'](_0x7a6123[_0xb6a0('0xab')])){return _0x892e80[_0xb6a0('0xb0')](_0x13483f);}else{if(!fs[_0xb6a0('0xb1')](path[_0xb6a0('0xae')](config[_0xb6a0('0xaf')],_0xb6a0('0xb2'),_0x7a6123[_0xb6a0('0xab')]))){return _0x892e80[_0xb6a0('0xb0')](_0x13483f);}return _0x892e80[_0xb6a0('0xb0')](path[_0xb6a0('0xae')](config[_0xb6a0('0xaf')],_0xb6a0('0xb2'),_0x7a6123[_0xb6a0('0xab')]));}}})[_0xb6a0('0x54')](handleError(_0x892e80,null));};exports['getOpenTabs']=function(_0x25691a,_0x1686ef){return db['User']['find']({'where':{'id':_0x25691a[_0xb6a0('0x4a')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x1686ef,null))[_0xb6a0('0x13')](function(_0x1b53b1){var _0x4b02de=[];values=_0x1b53b1[_0xb6a0('0x44')];_0x4b02de[_0xb6a0('0x41')](get_open_tabs(_0xb6a0('0xb3'),_0x1b53b1['dataValues']));_0x4b02de[_0xb6a0('0x41')](get_open_tabs(_0xb6a0('0x45'),_0x1b53b1[_0xb6a0('0x44')]));_0x4b02de[_0xb6a0('0x41')](get_open_tabs('openchannel',_0x1b53b1[_0xb6a0('0x44')]));_0x4b02de[_0xb6a0('0x41')](get_open_tabs('whatsapp',_0x1b53b1['dataValues']));_0x4b02de[_0xb6a0('0x41')](get_open_tabs('fax',_0x1b53b1[_0xb6a0('0x44')]));_0x4b02de['push'](get_open_tabs('mail',_0x1b53b1[_0xb6a0('0x44')]));return BPromise[_0xb6a0('0x82')](_0x4b02de);})[_0xb6a0('0x13')](function(_0x45e90d){var _0x1f0286=[];if(_0x45e90d){for(var _0x5cc0f6=0x0;_0x5cc0f6=_0x201932[_0x13bf('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x13bf('0xf')](function(){if(_0x3dac09){return db['UserVoiceQueueRt'][_0x13bf('0x52')]({'where':{'membername':_0x3dac09['name']},'individualHooks':!![]});}})['then'](function(){if(_0x3dac09){return _0x3dac09[_0x13bf('0x53')]({'raw':!![]});}})['then'](function(_0x44d780){if(_0x3dac09){if(_0x44d780){var _0x58121e=[];_0x18316a=_0x44d780;if(_0x18316a[_0x13bf('0x30')]){for(var _0x6880df=0x0;_0x6880df<_0x18316a[_0x13bf('0x30')];_0x6880df++){_0x58121e[_0x13bf('0x35')](db[_0x13bf('0x41')][_0x13bf('0x54')]({'membername':_0x3dac09['name'],'UserId':_0x3dac09['id'],'queue_name':_0x18316a[_0x6880df]['name'],'VoiceQueueId':_0x18316a[_0x6880df]['id'],'interface':_0x4637c1,'paused':_0x3dac09['loginInPause']||![],'penalty':_0x18316a[_0x6880df][_0x13bf('0x55')]||0x0}));}return BPromise['all'](_0x58121e);}}}})[_0x13bf('0xf')](function(){if(_0x3dac09){return db[_0x13bf('0x2e')][_0x13bf('0x1d')]({'where':{'membername':_0x3dac09[_0x13bf('0x29')],'exitAt':null}});}})[_0x13bf('0xf')](function(_0x5e76ca){if(_0x3dac09){if(_0x5e76ca&&_0x5e76ca[_0x13bf('0x30')]){var _0x4fd00b=[];_0x5e76ca['forEach'](function(_0x3e67b3){_0x4fd00b[_0x13bf('0x35')](_0x3e67b3['update']({'exitAt':moment()[_0x13bf('0x31')](_0x13bf('0x38'))}));});return BPromise[_0x13bf('0x4b')](_0x4fd00b);}}})[_0x13bf('0xf')](function(_0x1d93e1){if(_0x3dac09){var _0x3d063f=[];var _0x256889=[];var _0x3fc4bd=utils[_0x13bf('0x33')]();var _0x55a78c={'membername':_0x3dac09[_0x13bf('0x29')],'interface':_0x4637c1,'enterAt':moment()['format'](_0x13bf('0x38')),'role':_0x3dac09[_0x13bf('0x2a')],'internal':_0x3dac09[_0x13bf('0x2b')]};_0x3fc4bd[_0x13bf('0x34')](function(_0x3d74a6){_0x3d063f['push'](_['merge']({'channel':_0x3d74a6,'type':_0x13bf('0x56'),'data1':_0x13bf('0x57'),'data2':_0x4637c1},_0x55a78c));if(_0x3dac09['loginInPause']){_0x256889[_0x13bf('0x35')](_[_0x13bf('0x58')]({'channel':_0x3d74a6,'type':_0x13bf('0x2f'),'data1':_0x13bf('0x59')},_0x55a78c));}});return db[_0x13bf('0x2e')]['bulkCreate'](_0x3d063f[_0x13bf('0x5a')](_0x256889),{'individualHooks':!![]});}})[_0x13bf('0xf')](function(){if(_0x3dac09){return _0x3dac09[_0x13bf('0x2d')]({'online':!![],'lastLoginAt':moment()[_0x13bf('0x31')](_0x13bf('0x38')),'voicePause':_0x3dac09['loginInPause']||![],'mailPause':_0x3dac09[_0x13bf('0x4f')]||![],'chatPause':_0x3dac09[_0x13bf('0x4f')]||![],'faxPause':_0x3dac09[_0x13bf('0x4f')]||![],'smsPause':_0x3dac09[_0x13bf('0x4f')]||![],'openchannelPause':_0x3dac09[_0x13bf('0x4f')]||![],'pauseType':_0x3dac09[_0x13bf('0x4f')]?_0x13bf('0x59'):null,'lastPauseAt':moment()[_0x13bf('0x31')](_0x13bf('0x38')),'interface':_0x4637c1});}})[_0x13bf('0xf')](function(_0x3ed0d6){_0x2ddfe4(_0x3ed0d6);})[_0x13bf('0x1a')](function(_0x48586f){_0x536946(_0x50033e[_0x13bf('0x16')](0x1f4,_0x48586f[_0x13bf('0x18')]));});});}; \ No newline at end of file +var _0x2a0e=['code','message','info','catch','GetUser','User','findAll','options','raw','where','attributes','limit','map','include','model','stringify','ShowUser','name','role','internal','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','getChannels','forEach','push','isNil','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','type','DEFAULT\x20PAUSE','body','uniqueid','findOne','isValidChannel','channel','voice','find','system','openchannel','whatsapp','set','Pause','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN','callysquare','merge','LOGININPAUSE','bulkCreate','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error'];(function(_0x558c7b,_0x8905e0){var _0x3aded1=function(_0x231bef){while(--_0x231bef){_0x558c7b['push'](_0x558c7b['shift']());}};_0x3aded1(++_0x8905e0);}(_0x2a0e,0x1b7));var _0xe2a0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2a0e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe2a0('0x0'));var util=require(_0xe2a0('0x1'));var moment=require(_0xe2a0('0x2'));var BPromise=require(_0xe2a0('0x3'));var rs=require(_0xe2a0('0x4'));var fs=require('fs');var Redis=require(_0xe2a0('0x5'));var db=require(_0xe2a0('0x6'))['db'];var utils=require(_0xe2a0('0x7'));var logger=require(_0xe2a0('0x8'))(_0xe2a0('0x9'));var config=require(_0xe2a0('0xa'));var jayson=require(_0xe2a0('0xb'));var client=jayson[_0xe2a0('0xc')][_0xe2a0('0xd')]({'port':0x232a});config['redis']=_[_0xe2a0('0xe')](config[_0xe2a0('0xf')],{'host':_0xe2a0('0x10'),'port':0x18eb});var socket=require(_0xe2a0('0x11'))(new Redis(config[_0xe2a0('0xf')]));require('./user.socket')[_0xe2a0('0x12')](socket);function respondWithRpcPromise(_0x1fbd64,_0x4a6296,_0x4e1899){return new BPromise(function(_0xde43ae,_0x2fe37f){return client[_0xe2a0('0x13')](_0x1fbd64,_0x4e1899)[_0xe2a0('0x14')](function(_0x557dd6){logger['info'](_0xe2a0('0x15'),_0x4a6296,_0xe2a0('0x16'));logger[_0xe2a0('0x17')](_0xe2a0('0x18'),_0x4a6296,_0xe2a0('0x16'),JSON['stringify'](_0x557dd6));if(_0x557dd6[_0xe2a0('0x19')]){if(_0x557dd6[_0xe2a0('0x19')][_0xe2a0('0x1a')]===0x1f4){logger[_0xe2a0('0x19')]('User,\x20%s,\x20%s',_0x4a6296,_0x557dd6[_0xe2a0('0x19')][_0xe2a0('0x1b')]);return _0x2fe37f(_0x557dd6[_0xe2a0('0x19')][_0xe2a0('0x1b')]);}logger['error'](_0xe2a0('0x15'),_0x4a6296,_0x557dd6['error']['message']);return _0xde43ae(_0x557dd6[_0xe2a0('0x19')][_0xe2a0('0x1b')]);}else{logger[_0xe2a0('0x1c')](_0xe2a0('0x15'),_0x4a6296,'request\x20sent');_0xde43ae(_0x557dd6['result']['message']);}})[_0xe2a0('0x1d')](function(_0x394f47){logger[_0xe2a0('0x19')](_0xe2a0('0x15'),_0x4a6296,_0x394f47);_0x2fe37f(_0x394f47);});});}exports[_0xe2a0('0x1e')]=function(_0x492c88){var _0x1c9460=this;return new Promise(function(_0x37b307,_0xfc7193){return db[_0xe2a0('0x1f')][_0xe2a0('0x20')]({'raw':_0x492c88[_0xe2a0('0x21')]?_0x492c88[_0xe2a0('0x21')][_0xe2a0('0x22')]===undefined?!![]:![]:!![],'where':_0x492c88['options']?_0x492c88[_0xe2a0('0x21')][_0xe2a0('0x23')]||null:null,'attributes':_0x492c88[_0xe2a0('0x21')]?_0x492c88[_0xe2a0('0x21')][_0xe2a0('0x24')]||null:null,'limit':_0x492c88[_0xe2a0('0x21')]?_0x492c88[_0xe2a0('0x21')][_0xe2a0('0x25')]||null:null,'include':_0x492c88[_0xe2a0('0x21')]?_0x492c88[_0xe2a0('0x21')]['include']?_[_0xe2a0('0x26')](_0x492c88['options'][_0xe2a0('0x27')],function(_0xc5379){return{'model':db[_0xc5379[_0xe2a0('0x28')]],'as':_0xc5379['as'],'attributes':_0xc5379[_0xe2a0('0x24')],'include':_0xc5379['include']?_[_0xe2a0('0x26')](_0xc5379['include'],function(_0x2a049a){return{'model':db[_0x2a049a[_0xe2a0('0x28')]],'as':_0x2a049a['as'],'attributes':_0x2a049a[_0xe2a0('0x24')],'include':_0x2a049a[_0xe2a0('0x27')]?_['map'](_0x2a049a['include'],function(_0x5c233a){return{'model':db[_0x5c233a[_0xe2a0('0x28')]],'as':_0x5c233a['as'],'attributes':_0x5c233a[_0xe2a0('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46dfbb){logger[_0xe2a0('0x1c')]('GetUser',_0x492c88);logger[_0xe2a0('0x17')](_0xe2a0('0x1e'),_0x492c88,JSON[_0xe2a0('0x29')](_0x46dfbb));_0x37b307(_0x46dfbb);})[_0xe2a0('0x1d')](function(_0x1c8d47){logger[_0xe2a0('0x19')](_0xe2a0('0x1e'),_0x1c8d47['message'],_0x492c88);_0xfc7193(_0x1c9460['error'](0x1f4,_0x1c8d47[_0xe2a0('0x1b')]));});});};exports[_0xe2a0('0x2a')]=function(_0x343083){var _0x2c948b=this;return new Promise(function(_0x30ee4d,_0x2de336){return db[_0xe2a0('0x1f')]['find']({'raw':_0x343083[_0xe2a0('0x21')]?_0x343083['options'][_0xe2a0('0x22')]===undefined?!![]:![]:!![],'where':_0x343083['options']?_0x343083[_0xe2a0('0x21')][_0xe2a0('0x23')]||null:null,'attributes':_0x343083[_0xe2a0('0x21')]?_0x343083[_0xe2a0('0x21')][_0xe2a0('0x24')]||null:null,'include':_0x343083[_0xe2a0('0x21')]?_0x343083[_0xe2a0('0x21')]['include']?_[_0xe2a0('0x26')](_0x343083['options'][_0xe2a0('0x27')],function(_0x8b0fd3){return{'model':db[_0x8b0fd3[_0xe2a0('0x28')]],'as':_0x8b0fd3['as'],'attributes':_0x8b0fd3[_0xe2a0('0x24')],'include':_0x8b0fd3[_0xe2a0('0x27')]?_[_0xe2a0('0x26')](_0x8b0fd3[_0xe2a0('0x27')],function(_0x5515d8){return{'model':db[_0x5515d8[_0xe2a0('0x28')]],'as':_0x5515d8['as'],'attributes':_0x5515d8[_0xe2a0('0x24')],'include':_0x5515d8[_0xe2a0('0x27')]?_[_0xe2a0('0x26')](_0x5515d8[_0xe2a0('0x27')],function(_0x274c15){return{'model':db[_0x274c15['model']],'as':_0x274c15['as'],'attributes':_0x274c15[_0xe2a0('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d9116){logger['info'](_0xe2a0('0x2a'),_0x343083);logger[_0xe2a0('0x17')](_0xe2a0('0x2a'),_0x343083,JSON['stringify'](_0x4d9116));_0x30ee4d(_0x4d9116);})[_0xe2a0('0x1d')](function(_0x25dea7){logger[_0xe2a0('0x19')](_0xe2a0('0x2a'),_0x25dea7[_0xe2a0('0x1b')],_0x343083);_0x2de336(_0x2c948b[_0xe2a0('0x19')](0x1f4,_0x25dea7['message']));});});};exports['PauseUser']=function(_0x3d54b1){var _0x38c918=this;return new Promise(function(_0x4af0b9,_0x1aaed2){var _0x1e53ff;return db[_0xe2a0('0x1f')]['find']({'where':_0x3d54b1['options'][_0xe2a0('0x23')]||{},'attributes':['id',_0xe2a0('0x2b'),_0xe2a0('0x2c'),_0xe2a0('0x2d'),'interface']})[_0xe2a0('0x14')](function(_0x3a743d){if(_0x3a743d){_0x1e53ff=_0x3a743d;return db[_0xe2a0('0x2e')][_0xe2a0('0x2f')]({'paused':0x1},{'where':{'UserId':_0x1e53ff['id']},'individualHooks':!![]});}})[_0xe2a0('0x14')](function(){if(_0x1e53ff){return db[_0xe2a0('0x30')]['findAll']({'where':{'membername':_0x1e53ff[_0xe2a0('0x2b')],'type':_0xe2a0('0x31'),'exitAt':null}});}})['then'](function(_0x15f865){if(_0x1e53ff){if(_0x15f865&&_0x15f865[_0xe2a0('0x32')]){var _0x42f4d4=moment()[_0xe2a0('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x47dc7f=0x0,_0x4a2011=_0x15f865['length'];_0x47dc7f<_0x4a2011;_0x47dc7f++){_0x15f865[_0x47dc7f]['updateAttributes']({'exitAt':_0x42f4d4});}}}})[_0xe2a0('0x14')](function(){if(_0x1e53ff){var _0x247dda=[];var _0x59f0e9=utils[_0xe2a0('0x34')]();_0x59f0e9[_0xe2a0('0x35')](function(_0x3896a4){_0x247dda[_0xe2a0('0x36')]({'channel':_0x3896a4,'membername':_0x1e53ff[_0xe2a0('0x2b')],'interface':_[_0xe2a0('0x37')](_0x1e53ff[_0xe2a0('0x38')])?util[_0xe2a0('0x33')](_0xe2a0('0x39'),_0x1e53ff[_0xe2a0('0x2b')]):_0x1e53ff['interface'],'type':'PAUSE','enterAt':moment()[_0xe2a0('0x33')](_0xe2a0('0x3a')),'data1':_0x3d54b1['body'][_0xe2a0('0x3b')]||_0xe2a0('0x3c'),'role':_0x1e53ff['role'],'internal':_0x1e53ff[_0xe2a0('0x2d')],'uniqueid':_0x3d54b1[_0xe2a0('0x3d')][_0xe2a0('0x3e')]||null});});return db[_0xe2a0('0x30')]['bulkCreate'](_0x247dda,{'individualHooks':!![]});}})[_0xe2a0('0x14')](function(){if(_0x1e53ff){return _0x1e53ff[_0xe2a0('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3d54b1['body'][_0xe2a0('0x3b')]||_0xe2a0('0x3c'),'lastPauseAt':moment()[_0xe2a0('0x33')](_0xe2a0('0x3a'))});}})[_0xe2a0('0x14')](function(_0x3e8790){_0x4af0b9(_0x3e8790);})[_0xe2a0('0x1d')](function(_0x28c91e){_0x1aaed2(_0x38c918[_0xe2a0('0x19')](0x1f4,_0x28c91e[_0xe2a0('0x1b')]));});});};exports['UnpauseUser']=function(_0x26f58){var _0x1c710c=this;return new Promise(function(_0x3a528a,_0x2954f3){var _0x18cfa6;return db[_0xe2a0('0x1f')][_0xe2a0('0x3f')]({'where':_0x26f58['options']['where']||{},'attributes':['id','name']})[_0xe2a0('0x14')](function(_0x193b8b){if(_0x193b8b){_0x18cfa6=_0x193b8b;if(_0x26f58[_0xe2a0('0x3d')]['channel']&&!utils[_0xe2a0('0x40')](_0x26f58['body']['channel'])){throw new Error('Unknown\x20channel');}switch(_0x26f58[_0xe2a0('0x3d')][_0xe2a0('0x41')]){case _0xe2a0('0x42'):return db[_0xe2a0('0x2e')]['update']({'paused':0x0},{'where':{'UserId':_0x18cfa6['id']}})[_0xe2a0('0x14')](function(){return db[_0xe2a0('0x30')][_0xe2a0('0x43')]({'where':{'channel':_0x26f58[_0xe2a0('0x3d')][_0xe2a0('0x41')],'membername':_0x18cfa6['name'],'type':_0xe2a0('0x31'),'exitAt':null}});})['then'](function(_0x3d5d94){if(_0x3d5d94){return _0x3d5d94['update']({'exitAt':moment()[_0xe2a0('0x33')](_0xe2a0('0x3a')),'data2':_0xe2a0('0x44')},{'individualHooks':!![]});}return null;})[_0xe2a0('0x14')](function(){return _0x18cfa6['update']({'voicePause':![]});});case'mail':case'chat':case'fax':case'sms':case _0xe2a0('0x45'):case _0xe2a0('0x46'):return db[_0xe2a0('0x30')]['find']({'where':{'channel':_0x26f58[_0xe2a0('0x3d')][_0xe2a0('0x41')],'membername':_0x18cfa6['name'],'type':'PAUSE','exitAt':null}})[_0xe2a0('0x14')](function(_0x279948){return _0x279948[_0xe2a0('0x2f')]({'exitAt':moment()[_0xe2a0('0x33')](_0xe2a0('0x3a')),'data2':'system'},{'individualHooks':!![]});})['then'](function(){var _0x2f3870={};_[_0xe2a0('0x47')](_0x2f3870,util[_0xe2a0('0x33')]('%s%s',_0x26f58['body'][_0xe2a0('0x41')],_0xe2a0('0x48')),![]);return _0x18cfa6[_0xe2a0('0x2f')](_0x2f3870);});default:return db['UserVoiceQueueRt'][_0xe2a0('0x2f')]({'paused':0x0},{'where':{'UserId':_0x18cfa6['id']}})[_0xe2a0('0x14')](function(){return db[_0xe2a0('0x30')][_0xe2a0('0x20')]({'where':{'membername':_0x18cfa6[_0xe2a0('0x2b')],'type':'PAUSE','exitAt':null}});})[_0xe2a0('0x14')](function(_0x46446b){var _0x1dccf9=[];_0x46446b[_0xe2a0('0x35')](function(_0x5e494a){_0x1dccf9[_0xe2a0('0x36')](_0x5e494a['update']({'exitAt':moment()[_0xe2a0('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xe2a0('0x44')}));});return BPromise[_0xe2a0('0x49')](_0x1dccf9);})[_0xe2a0('0x14')](function(){return _0x18cfa6[_0xe2a0('0x2f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xe2a0('0x14')](function(_0xbab50e){_0x3a528a(_0xbab50e);})[_0xe2a0('0x1d')](function(_0x44badb){_0x2954f3(_0x1c710c[_0xe2a0('0x19')](0x1f4,_0x44badb[_0xe2a0('0x1b')]));});});};exports[_0xe2a0('0x4a')]=function(_0x2a0103){var _0x336f43=this;return new Promise(function(_0x598381,_0x34ecdd){var _0xa11320;return db[_0xe2a0('0x1f')][_0xe2a0('0x3f')]({'where':_0x2a0103[_0xe2a0('0x21')][_0xe2a0('0x23')]||{},'attributes':['id',_0xe2a0('0x2b')]})[_0xe2a0('0x14')](function(_0x7bdde2){if(_0x7bdde2){_0xa11320=_0x7bdde2;return db['UserVoiceQueueRt'][_0xe2a0('0x4b')]({'where':{'membername':_0xa11320['name']},'individualHooks':!![]});}})['then'](function(){if(_0xa11320){return db[_0xe2a0('0x30')]['findAll']({'where':{'membername':_0xa11320['name'],'exitAt':null}});}})[_0xe2a0('0x14')](function(_0x20a215){if(_0xa11320){if(_0x20a215&&_0x20a215[_0xe2a0('0x32')]){var _0x4780ff=[];_0x20a215[_0xe2a0('0x35')](function(_0x106b6a){_0x4780ff[_0xe2a0('0x36')](_0x106b6a['update']({'exitAt':moment()[_0xe2a0('0x33')](_0xe2a0('0x3a'))}));});return BPromise[_0xe2a0('0x49')](_0x4780ff);}}})[_0xe2a0('0x14')](function(){if(_0xa11320){return _0xa11320[_0xe2a0('0x2f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x2b58fa){_0x598381(_0x2b58fa);})[_0xe2a0('0x1d')](function(_0x18322f){_0x34ecdd(_0x336f43[_0xe2a0('0x19')](0x1f4,_0x18322f[_0xe2a0('0x1b')]));});});};exports[_0xe2a0('0x4c')]=function(_0xb14112){var _0x33cb7f=this;return new Promise(function(_0x3348ac,_0x56fb44){var _0x463986;var _0x286244;var _0x20513b;var _0x31cebf;return db['User'][_0xe2a0('0x3f')]({'where':_0xb14112['options'][_0xe2a0('0x23')]||{},'attributes':['id','name','role',_0xe2a0('0x4d'),_0xe2a0('0x4e'),_0xe2a0('0x2d'),_0xe2a0('0x4f'),'interface']})[_0xe2a0('0x14')](function(_0x1934dd){if(_0x1934dd){_0x463986=_0x1934dd;_0x31cebf=_0xb14112['body']['interface']?_0xb14112[_0xe2a0('0x3d')][_0xe2a0('0x38')]:util[_0xe2a0('0x33')](_0xe2a0('0x39'),_0x463986[_0xe2a0('0x2b')]);return db['User'][_0xe2a0('0x50')]({'where':{'role':_0xe2a0('0x51'),'online':!![],'id':{'$ne':_0x463986['id']}}});}})['then'](function(_0x4f0f34){if(_0x4f0f34){_0x20513b=_0x4f0f34;return require('../../config/license/util')[_0xe2a0('0x52')]();}})[_0xe2a0('0x14')](function(_0x39e918){if(_0x39e918&&_0x39e918[_0xe2a0('0x53')]&&_0x20513b>=_0x39e918[_0xe2a0('0x53')]){throw new Error(_0xe2a0('0x54'));}})[_0xe2a0('0x14')](function(){if(_0x463986){return db[_0xe2a0('0x2e')]['destroy']({'where':{'membername':_0x463986['name']},'individualHooks':!![]});}})[_0xe2a0('0x14')](function(){if(_0x463986){return _0x463986[_0xe2a0('0x55')]({'raw':!![]});}})['then'](function(_0x541b8a){if(_0x463986){if(_0x541b8a){var _0x358238=[];_0x286244=_0x541b8a;if(_0x286244[_0xe2a0('0x32')]){for(var _0x222a50=0x0;_0x222a50<_0x286244[_0xe2a0('0x32')];_0x222a50++){_0x358238[_0xe2a0('0x36')](db[_0xe2a0('0x2e')][_0xe2a0('0x56')]({'membername':_0x463986['name'],'UserId':_0x463986['id'],'queue_name':_0x286244[_0x222a50][_0xe2a0('0x2b')],'VoiceQueueId':_0x286244[_0x222a50]['id'],'interface':_0x31cebf,'paused':_0x463986[_0xe2a0('0x4f')]||![],'penalty':_0x286244[_0x222a50][_0xe2a0('0x57')]||0x0}));}return BPromise['all'](_0x358238);}}}})[_0xe2a0('0x14')](function(){if(_0x463986){return db['MemberReport'][_0xe2a0('0x20')]({'where':{'membername':_0x463986[_0xe2a0('0x2b')],'exitAt':null}});}})[_0xe2a0('0x14')](function(_0x4c1a93){if(_0x463986){if(_0x4c1a93&&_0x4c1a93[_0xe2a0('0x32')]){var _0xe28ec6=[];_0x4c1a93[_0xe2a0('0x35')](function(_0x49bf2c){_0xe28ec6['push'](_0x49bf2c[_0xe2a0('0x2f')]({'exitAt':moment()[_0xe2a0('0x33')](_0xe2a0('0x3a'))}));});return BPromise[_0xe2a0('0x49')](_0xe28ec6);}}})[_0xe2a0('0x14')](function(_0x49bc06){if(_0x463986){var _0x5962e3=[];var _0x259456=[];var _0xcc94fe=utils['getChannels']();var _0x316da0={'membername':_0x463986[_0xe2a0('0x2b')],'interface':_0x31cebf,'enterAt':moment()[_0xe2a0('0x33')](_0xe2a0('0x3a')),'role':_0x463986[_0xe2a0('0x2c')],'internal':_0x463986[_0xe2a0('0x2d')]};_0xcc94fe['forEach'](function(_0x5721d5){_0x5962e3['push'](_['merge']({'channel':_0x5721d5,'type':_0xe2a0('0x58'),'data1':_0xe2a0('0x59'),'data2':_0x31cebf},_0x316da0));if(_0x463986[_0xe2a0('0x4f')]){_0x259456[_0xe2a0('0x36')](_[_0xe2a0('0x5a')]({'channel':_0x5721d5,'type':_0xe2a0('0x31'),'data1':_0xe2a0('0x5b')},_0x316da0));}});return db['MemberReport'][_0xe2a0('0x5c')](_0x5962e3['concat'](_0x259456),{'individualHooks':!![]});}})[_0xe2a0('0x14')](function(){if(_0x463986){return _0x463986[_0xe2a0('0x2f')]({'online':!![],'lastLoginAt':moment()[_0xe2a0('0x33')](_0xe2a0('0x3a')),'voicePause':_0x463986['loginInPause']||![],'mailPause':_0x463986[_0xe2a0('0x4f')]||![],'chatPause':_0x463986['loginInPause']||![],'faxPause':_0x463986['loginInPause']||![],'smsPause':_0x463986[_0xe2a0('0x4f')]||![],'openchannelPause':_0x463986['loginInPause']||![],'pauseType':_0x463986[_0xe2a0('0x4f')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xe2a0('0x33')](_0xe2a0('0x3a')),'interface':_0x31cebf});}})[_0xe2a0('0x14')](function(_0x31a1f1){_0x3348ac(_0x31a1f1);})[_0xe2a0('0x1d')](function(_0x2d4a0f){_0x56fb44(_0x33cb7f['error'](0x1f4,_0x2d4a0f[_0xe2a0('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index e922366..da55aea 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 _0xd624=['user:','save','remove','emit','removeListener','register','length'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0xd624,0x78));var _0x4d62=function(_0x59d264,_0x40027a){_0x59d264=_0x59d264-0x0;var _0x4ef974=_0xd624[_0x59d264];return _0x4ef974;};'use strict';var UserEvents=require('./user.events');var events=[_0x4d62('0x0'),_0x4d62('0x1'),'update'];function createListener(_0x5098a2,_0x4c9bad){return function(_0x3985e7){_0x4c9bad[_0x4d62('0x2')](_0x5098a2,_0x3985e7);};}function removeListener(_0x1c266d,_0x2b90fa){return function(){UserEvents[_0x4d62('0x3')](_0x1c266d,_0x2b90fa);};}exports[_0x4d62('0x4')]=function(_0x2639c1){for(var _0xbfcc51=0x0,_0x3b65ca=events[_0x4d62('0x5')];_0xbfcc51<_0x3b65ca;_0xbfcc51++){var _0x190689=events[_0xbfcc51];var _0x1f3ac4=createListener(_0x4d62('0x6')+_0x190689,_0x2639c1);UserEvents['on'](_0x190689,_0x1f3ac4);}}; \ No newline at end of file +var _0x557f=['save','update','emit','register','length','user:'];(function(_0x3ab928,_0x2b990b){var _0xf47692=function(_0x311b8e){while(--_0x311b8e){_0x3ab928['push'](_0x3ab928['shift']());}};_0xf47692(++_0x2b990b);}(_0x557f,0x18c));var _0xf557=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x557f[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require('./user.events');var events=[_0xf557('0x0'),'remove',_0xf557('0x1')];function createListener(_0x1f2eba,_0x12a962){return function(_0x167864){_0x12a962[_0xf557('0x2')](_0x1f2eba,_0x167864);};}function removeListener(_0x44c9e4,_0x56cb0e){return function(){UserEvents['removeListener'](_0x44c9e4,_0x56cb0e);};}exports[_0xf557('0x3')]=function(_0x4c50e8){for(var _0x3c3330=0x0,_0x5c2c76=events[_0xf557('0x4')];_0x3c3330<_0x5c2c76;_0x3c3330++){var _0x1a4e55=events[_0x3c3330];var _0x8adb8e=createListener(_0xf557('0x5')+_0x1a4e55,_0x4c50e8);UserEvents['on'](_0x1a4e55,_0x8adb8e);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index ddd07d6..29a5ed1 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x168089,_0x32d594){var _0x1e8e51=function(_0x59f062){while(--_0x59f062){_0x168089['push'](_0x168089['shift']());}};_0x1e8e51(++_0x32d594);}(_0x70e0,0x17b));var _0x070e=function(_0x2c0108,_0x5100b6){_0x2c0108=_0x2c0108-0x0;var _0x4a9155=_0x70e0[_0x2c0108];return _0x4a9155;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x57912c,_0x4f0e41){var _0x2a1da4=function(_0xbbb44b){while(--_0xbbb44b){_0x57912c['push'](_0x57912c['shift']());}};_0x2a1da4(++_0x4f0e41);}(_0xe706,0xa3));var _0x6e70=function(_0x46a81e,_0x28ca60){_0x46a81e=_0x46a81e-0x0;var _0x464725=_0xe706[_0x46a81e];return _0x464725;};'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 9006424..d066f29 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb8f0=['sequelize','INTEGER'];(function(_0x290c09,_0x297a58){var _0x447fe8=function(_0x108775){while(--_0x108775){_0x290c09['push'](_0x290c09['shift']());}};_0x447fe8(++_0x297a58);}(_0xb8f0,0xf2));var _0x0b8f=function(_0x3e11b9,_0x3de9ff){_0x3e11b9=_0x3e11b9-0x0;var _0x297f3d=_0xb8f0[_0x3e11b9];return _0x297f3d;};'use strict';var Sequelize=require(_0x0b8f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0b8f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 4693d88..05f6fa2 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 _0x644b=['request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x644b,0x159));var _0xb644=function(_0x24c15a,_0x261c48){_0x24c15a=_0x24c15a-0x0;var _0x2a3137=_0x644b[_0x24c15a];return _0x2a3137;};'use strict';var _=require(_0xb644('0x0'));var util=require(_0xb644('0x1'));var logger=require(_0xb644('0x2'))(_0xb644('0x3'));var moment=require(_0xb644('0x4'));var BPromise=require(_0xb644('0x5'));var rp=require(_0xb644('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb644('0x7'));var config=require(_0xb644('0x8'));var attributes=require(_0xb644('0x9'));module[_0xb644('0xa')]=function(_0x59b871,_0x2125b1){return _0x59b871[_0xb644('0xb')](_0xb644('0xc'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcba7=['UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2ec905,_0x442fb6){var _0xc98bd=function(_0x363b91){while(--_0x363b91){_0x2ec905['push'](_0x2ec905['shift']());}};_0xc98bd(++_0x442fb6);}(_0xcba7,0x66));var _0x7cba=function(_0x507c4b,_0x36cc1a){_0x507c4b=_0x507c4b-0x0;var _0x1b8bb6=_0xcba7[_0x507c4b];return _0x1b8bb6;};'use strict';var _=require(_0x7cba('0x0'));var util=require('util');var logger=require(_0x7cba('0x1'))(_0x7cba('0x2'));var moment=require(_0x7cba('0x3'));var BPromise=require(_0x7cba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cba('0x5'));var rimraf=require(_0x7cba('0x6'));var config=require(_0x7cba('0x7'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0xb1b9eb,_0x5c9cd1){return _0xb1b9eb['define'](_0x7cba('0x8'),attributes,{'tableName':_0x7cba('0x9'),'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 a988fcb..07479f9 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 _0x1471=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2c88ca,_0x1c12ea){var _0x113a07=function(_0x3e8a0c){while(--_0x3e8a0c){_0x2c88ca['push'](_0x2c88ca['shift']());}};_0x113a07(++_0x1c12ea);}(_0x1471,0x137));var _0x1147=function(_0x4e1d03,_0x4f7343){_0x4e1d03=_0x4e1d03-0x0;var _0x49c8d1=_0x1471[_0x4e1d03];return _0x49c8d1;};'use strict';var _=require(_0x1147('0x0'));var util=require(_0x1147('0x1'));var moment=require(_0x1147('0x2'));var BPromise=require(_0x1147('0x3'));var rs=require(_0x1147('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1147('0x5'))['db'];var utils=require(_0x1147('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1147('0x7'));var client=jayson[_0x1147('0x8')][_0x1147('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e2dc4,_0x573dfe,_0x438c24){return new BPromise(function(_0xa5764e,_0x33c00d){return client[_0x1147('0xa')](_0x1e2dc4,_0x438c24)[_0x1147('0xb')](function(_0x1321bd){logger[_0x1147('0xc')](_0x1147('0xd'),_0x573dfe,_0x1147('0xe'));logger[_0x1147('0xf')](_0x1147('0x10'),_0x573dfe,_0x1147('0xe'),JSON['stringify'](_0x1321bd));if(_0x1321bd['error']){if(_0x1321bd[_0x1147('0x11')][_0x1147('0x12')]===0x1f4){logger[_0x1147('0x11')](_0x1147('0xd'),_0x573dfe,_0x1321bd['error'][_0x1147('0x13')]);return _0x33c00d(_0x1321bd['error'][_0x1147('0x13')]);}logger[_0x1147('0x11')](_0x1147('0xd'),_0x573dfe,_0x1321bd[_0x1147('0x11')][_0x1147('0x13')]);return _0xa5764e(_0x1321bd[_0x1147('0x11')][_0x1147('0x13')]);}else{logger[_0x1147('0xc')](_0x1147('0xd'),_0x573dfe,_0x1147('0xe'));_0xa5764e(_0x1321bd[_0x1147('0x14')][_0x1147('0x13')]);}})[_0x1147('0x15')](function(_0xb0ad83){logger[_0x1147('0x11')](_0x1147('0xd'),_0x573dfe,_0xb0ad83);_0x33c00d(_0xb0ad83);});});} \ No newline at end of file +var _0x4e6a=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x4e6a,0xb0));var _0xa4e6=function(_0x17d590,_0x50e4e9){_0x17d590=_0x17d590-0x0;var _0x24b927=_0x4e6a[_0x17d590];return _0x24b927;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa4e6('0x0'));var BPromise=require(_0xa4e6('0x1'));var rs=require(_0xa4e6('0x2'));var fs=require('fs');var Redis=require(_0xa4e6('0x3'));var db=require(_0xa4e6('0x4'))['db'];var utils=require(_0xa4e6('0x5'));var logger=require('../../config/logger')(_0xa4e6('0x6'));var config=require(_0xa4e6('0x7'));var jayson=require(_0xa4e6('0x8'));var client=jayson[_0xa4e6('0x9')][_0xa4e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dcc86,_0x2caec1,_0x195b48){return new BPromise(function(_0x523e92,_0x69bf89){return client[_0xa4e6('0xb')](_0x1dcc86,_0x195b48)[_0xa4e6('0xc')](function(_0x29061c){logger[_0xa4e6('0xd')](_0xa4e6('0xe'),_0x2caec1,_0xa4e6('0xf'));logger['debug'](_0xa4e6('0x10'),_0x2caec1,_0xa4e6('0xf'),JSON['stringify'](_0x29061c));if(_0x29061c[_0xa4e6('0x11')]){if(_0x29061c['error']['code']===0x1f4){logger[_0xa4e6('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x2caec1,_0x29061c[_0xa4e6('0x11')][_0xa4e6('0x12')]);return _0x69bf89(_0x29061c['error']['message']);}logger[_0xa4e6('0x11')](_0xa4e6('0xe'),_0x2caec1,_0x29061c[_0xa4e6('0x11')][_0xa4e6('0x12')]);return _0x523e92(_0x29061c[_0xa4e6('0x11')][_0xa4e6('0x12')]);}else{logger[_0xa4e6('0xd')](_0xa4e6('0xe'),_0x2caec1,_0xa4e6('0xf'));_0x523e92(_0x29061c['result'][_0xa4e6('0x12')]);}})[_0xa4e6('0x13')](function(_0xb703a4){logger[_0xa4e6('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x2caec1,_0xb703a4);_0x69bf89(_0xb703a4);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 2e0c34a..a03001a 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4f025f,_0x274149){var _0x143048=function(_0x197ea5){while(--_0x197ea5){_0x4f025f['push'](_0x4f025f['shift']());}};_0x143048(++_0x274149);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x6148ee,_0x4d2fca){var _0x5afc74=function(_0x351621){while(--_0x351621){_0x6148ee['push'](_0x6148ee['shift']());}};_0x5afc74(++_0x4d2fca);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ba300c7..df5f380 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 _0xa5f1=['sequelize','exports','INTEGER','STRING'];(function(_0x491f57,_0x497b22){var _0x51e9a2=function(_0x39e0bf){while(--_0x39e0bf){_0x491f57['push'](_0x491f57['shift']());}};_0x51e9a2(++_0x497b22);}(_0xa5f1,0x128));var _0x1a5f=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa5f1[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x1a5f('0x0'));module[_0x1a5f('0x1')]={'penalty':{'type':Sequelize[_0x1a5f('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1a5f('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1a5f('0x3')]}}; \ No newline at end of file +var _0xae6f=['sequelize'];(function(_0x2c5d38,_0x53dab8){var _0x5107fe=function(_0x5be3fb){while(--_0x5be3fb){_0x2c5d38['push'](_0x2c5d38['shift']());}};_0x5107fe(++_0x53dab8);}(_0xae6f,0x1bb));var _0xfae6=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xae6f[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xfae6('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index cae1936..14f6e35 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 _0x77e9=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserFaxQueue','lodash','util','../../config/logger','moment'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x77e9,0x1dc));var _0x977e=function(_0x4ca729,_0x260508){_0x4ca729=_0x4ca729-0x0;var _0x19715b=_0x77e9[_0x4ca729];return _0x19715b;};'use strict';var _=require(_0x977e('0x0'));var util=require(_0x977e('0x1'));var logger=require(_0x977e('0x2'))('api');var moment=require(_0x977e('0x3'));var BPromise=require(_0x977e('0x4'));var rp=require(_0x977e('0x5'));var fs=require('fs');var path=require(_0x977e('0x6'));var rimraf=require(_0x977e('0x7'));var config=require(_0x977e('0x8'));var attributes=require('./userFaxQueue.attributes');module[_0x977e('0x9')]=function(_0x4aa91a,_0x1fcc5f){return _0x4aa91a[_0x977e('0xa')](_0x977e('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1847=['define','UserFaxQueue','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x2f6085,_0x5cc1c2){var _0x1e7989=function(_0x5f0f2b){while(--_0x5f0f2b){_0x2f6085['push'](_0x2f6085['shift']());}};_0x1e7989(++_0x5cc1c2);}(_0x1847,0x10a));var _0x7184=function(_0x28383d,_0x4c101e){_0x28383d=_0x28383d-0x0;var _0x2e919e=_0x1847[_0x28383d];return _0x2e919e;};'use strict';var _=require(_0x7184('0x0'));var util=require(_0x7184('0x1'));var logger=require(_0x7184('0x2'))(_0x7184('0x3'));var moment=require('moment');var BPromise=require(_0x7184('0x4'));var rp=require(_0x7184('0x5'));var fs=require('fs');var path=require(_0x7184('0x6'));var rimraf=require(_0x7184('0x7'));var config=require(_0x7184('0x8'));var attributes=require(_0x7184('0x9'));module['exports']=function(_0xd02fa5,_0x169c52){return _0xd02fa5[_0x7184('0xa')](_0x7184('0xb'),attributes,{'tableName':'user_has_fax_queues','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 6f2ab1d..086c225 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 _0xf23e=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x5a7220,_0x54dedc){var _0x47522e=function(_0x3de79d){while(--_0x3de79d){_0x5a7220['push'](_0x5a7220['shift']());}};_0x47522e(++_0x54dedc);}(_0xf23e,0x1ce));var _0xef23=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf23e[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xef23('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xef23('0x1'));var rs=require(_0xef23('0x2'));var fs=require('fs');var Redis=require(_0xef23('0x3'));var db=require(_0xef23('0x4'))['db'];var utils=require(_0xef23('0x5'));var logger=require(_0xef23('0x6'))(_0xef23('0x7'));var config=require(_0xef23('0x8'));var jayson=require(_0xef23('0x9'));var client=jayson[_0xef23('0xa')][_0xef23('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x562d37,_0x1daff0,_0x90a197){return new BPromise(function(_0xf6afe2,_0x408736){return client['request'](_0x562d37,_0x90a197)[_0xef23('0xc')](function(_0x183419){logger['info'](_0xef23('0xd'),_0x1daff0,_0xef23('0xe'));logger[_0xef23('0xf')](_0xef23('0x10'),_0x1daff0,_0xef23('0xe'),JSON[_0xef23('0x11')](_0x183419));if(_0x183419[_0xef23('0x12')]){if(_0x183419[_0xef23('0x12')]['code']===0x1f4){logger[_0xef23('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x1daff0,_0x183419[_0xef23('0x12')][_0xef23('0x13')]);return _0x408736(_0x183419[_0xef23('0x12')][_0xef23('0x13')]);}logger[_0xef23('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x1daff0,_0x183419[_0xef23('0x12')]['message']);return _0xf6afe2(_0x183419[_0xef23('0x12')][_0xef23('0x13')]);}else{logger['info'](_0xef23('0xd'),_0x1daff0,_0xef23('0xe'));_0xf6afe2(_0x183419[_0xef23('0x14')][_0xef23('0x13')]);}})[_0xef23('0x15')](function(_0x5d253d){logger[_0xef23('0x12')](_0xef23('0xd'),_0x1daff0,_0x5d253d);_0x408736(_0x5d253d);});});} \ No newline at end of file +var _0x8821=['info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','then'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x8821,0x113));var _0x1882=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0x8821[_0x3acee8];return _0x5046cc;};'use strict';var _=require(_0x1882('0x0'));var util=require('util');var moment=require(_0x1882('0x1'));var BPromise=require('bluebird');var rs=require(_0x1882('0x2'));var fs=require('fs');var Redis=require(_0x1882('0x3'));var db=require(_0x1882('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1882('0x5'));var jayson=require(_0x1882('0x6'));var client=jayson['client'][_0x1882('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4eb449,_0x38bbba,_0x1882d4){return new BPromise(function(_0x40bde3,_0x20756e){return client[_0x1882('0x8')](_0x4eb449,_0x1882d4)[_0x1882('0x9')](function(_0x3533d4){logger[_0x1882('0xa')](_0x1882('0xb'),_0x38bbba,_0x1882('0xc'));logger['debug'](_0x1882('0xd'),_0x38bbba,_0x1882('0xc'),JSON[_0x1882('0xe')](_0x3533d4));if(_0x3533d4['error']){if(_0x3533d4[_0x1882('0xf')]['code']===0x1f4){logger[_0x1882('0xf')](_0x1882('0xb'),_0x38bbba,_0x3533d4[_0x1882('0xf')][_0x1882('0x10')]);return _0x20756e(_0x3533d4[_0x1882('0xf')][_0x1882('0x10')]);}logger[_0x1882('0xf')](_0x1882('0xb'),_0x38bbba,_0x3533d4['error'][_0x1882('0x10')]);return _0x40bde3(_0x3533d4[_0x1882('0xf')][_0x1882('0x10')]);}else{logger[_0x1882('0xa')](_0x1882('0xb'),_0x38bbba,_0x1882('0xc'));_0x40bde3(_0x3533d4[_0x1882('0x11')][_0x1882('0x10')]);}})[_0x1882('0x12')](function(_0x46a1a2){logger[_0x1882('0xf')](_0x1882('0xb'),_0x38bbba,_0x46a1a2);_0x20756e(_0x46a1a2);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 0599a07..ab7c1f1 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x337d75,_0x40c15b){var _0x443884=function(_0x256b9d){while(--_0x256b9d){_0x337d75['push'](_0x337d75['shift']());}};_0x443884(++_0x40c15b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x327ec3,_0x4fb2c3){var _0x3d6b4d=function(_0x1d7041){while(--_0x1d7041){_0x327ec3['push'](_0x327ec3['shift']());}};_0x3d6b4d(++_0x4fb2c3);}(_0x70e0,0x17b));var _0x070e=function(_0x1835fb,_0x367f55){_0x1835fb=_0x1835fb-0x0;var _0x4d8eed=_0x70e0[_0x1835fb];return _0x4d8eed;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index dc7e278..012ed5b 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 _0x19be=['INTEGER','sequelize','exports'];(function(_0xd7f338,_0x3a74a6){var _0x5cc6bb=function(_0x36b974){while(--_0x36b974){_0xd7f338['push'](_0xd7f338['shift']());}};_0x5cc6bb(++_0x3a74a6);}(_0x19be,0x1de));var _0xe19b=function(_0x178ef2,_0x373ded){_0x178ef2=_0x178ef2-0x0;var _0x1c605e=_0x19be[_0x178ef2];return _0x1c605e;};'use strict';var Sequelize=require(_0xe19b('0x0'));module[_0xe19b('0x1')]={'penalty':{'type':Sequelize[_0xe19b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd9dc=['INTEGER','sequelize'];(function(_0x2fce6d,_0x7dac79){var _0x6f16e=function(_0x4beed9){while(--_0x4beed9){_0x2fce6d['push'](_0x2fce6d['shift']());}};_0x6f16e(++_0x7dac79);}(_0xd9dc,0x18b));var _0xcd9d=function(_0x15e0d2,_0x8333c){_0x15e0d2=_0x15e0d2-0x0;var _0x45bb73=_0xd9dc[_0x15e0d2];return _0x45bb73;};'use strict';var Sequelize=require(_0xcd9d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xcd9d('0x1')],'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 668539a..50d6ae3 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 _0x1f8a=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util'];(function(_0xfc1c03,_0x107b3e){var _0x37e07e=function(_0x2c66fb){while(--_0x2c66fb){_0xfc1c03['push'](_0xfc1c03['shift']());}};_0x37e07e(++_0x107b3e);}(_0x1f8a,0x16a));var _0xa1f8=function(_0x2d05ec,_0x30b6f9){_0x2d05ec=_0x2d05ec-0x0;var _0x4b7025=_0x1f8a[_0x2d05ec];return _0x4b7025;};'use strict';var _=require(_0xa1f8('0x0'));var util=require(_0xa1f8('0x1'));var logger=require(_0xa1f8('0x2'))(_0xa1f8('0x3'));var moment=require(_0xa1f8('0x4'));var BPromise=require(_0xa1f8('0x5'));var rp=require(_0xa1f8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1f8('0x7'));var config=require(_0xa1f8('0x8'));var attributes=require(_0xa1f8('0x9'));module[_0xa1f8('0xa')]=function(_0x2d8863,_0xbbc0a9){return _0x2d8863[_0xa1f8('0xb')](_0xa1f8('0xc'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ca9=['define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0xb0d0bf,_0x2cfd3d){var _0x526825=function(_0x72f373){while(--_0x72f373){_0xb0d0bf['push'](_0xb0d0bf['shift']());}};_0x526825(++_0x2cfd3d);}(_0x9ca9,0x153));var _0x99ca=function(_0xafa60,_0x584027){_0xafa60=_0xafa60-0x0;var _0x38af2a=_0x9ca9[_0xafa60];return _0x38af2a;};'use strict';var _=require('lodash');var util=require(_0x99ca('0x0'));var logger=require(_0x99ca('0x1'))(_0x99ca('0x2'));var moment=require(_0x99ca('0x3'));var BPromise=require(_0x99ca('0x4'));var rp=require(_0x99ca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99ca('0x6'));var config=require(_0x99ca('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x99ca('0x8')]=function(_0xf73cb0,_0x1f3056){return _0xf73cb0[_0x99ca('0x9')](_0x99ca('0xa'),attributes,{'tableName':_0x99ca('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 63e5da0..3e82705 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(_0x1c3377,_0x28631d){var _0x4532d0=function(_0x5af5f2){while(--_0x5af5f2){_0x1c3377['push'](_0x1c3377['shift']());}};_0x4532d0(++_0x28631d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3b29d5,_0x12faa2){_0x3b29d5=_0x3b29d5-0x0;var _0x20b96d=_0xf3cd[_0x3b29d5];return _0x20b96d;};'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 _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x008c,0x188));var _0xc008=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0x008c[_0x77773a];return _0x1091a2;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 94e1df9..74f3a72 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 _0x691d=['../../components/interaction/service','post','isAuthenticated','sendUserNotification','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x54b458,_0x4da21b){var _0x18d704=function(_0x3ca278){while(--_0x3ca278){_0x54b458['push'](_0x54b458['shift']());}};_0x18d704(++_0x4da21b);}(_0x691d,0x1e4));var _0xd691=function(_0x38bbd2,_0x709b0a){_0x38bbd2=_0x38bbd2-0x0;var _0x32c72c=_0x691d[_0x38bbd2];return _0x32c72c;};'use strict';var multer=require(_0xd691('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd691('0x1'));var express=require(_0xd691('0x2'));var router=express[_0xd691('0x3')]();var fs_extra=require(_0xd691('0x4'));var auth=require(_0xd691('0x5'));var interaction=require(_0xd691('0x6'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0xd691('0x7')]('/',auth[_0xd691('0x8')](),controller[_0xd691('0x9')]);module['exports']=router; \ No newline at end of file +var _0xac09=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0xac09,0x132));var _0x9ac0=function(_0x538986,_0x5897ea){_0x538986=_0x538986-0x0;var _0x1454cd=_0xac09[_0x538986];return _0x1454cd;};'use strict';var multer=require('multer');var util=require(_0x9ac0('0x0'));var path=require(_0x9ac0('0x1'));var timeout=require(_0x9ac0('0x2'));var express=require(_0x9ac0('0x3'));var router=express[_0x9ac0('0x4')]();var fs_extra=require(_0x9ac0('0x5'));var auth=require(_0x9ac0('0x6'));var interaction=require(_0x9ac0('0x7'));var config=require(_0x9ac0('0x8'));var controller=require('./userNotification.controller');router['post']('/',auth[_0x9ac0('0x9')](),controller[_0x9ac0('0xa')]);module[_0x9ac0('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 1bce704..f74f36f 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 _0xdf08=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x2fc6ba,_0x203a19){var _0x3b2b3c=function(_0x422d49){while(--_0x422d49){_0x2fc6ba['push'](_0x2fc6ba['shift']());}};_0x3b2b3c(++_0x203a19);}(_0xdf08,0x1e3));var _0x8df0=function(_0x4b6a96,_0x1ab5d){_0x4b6a96=_0x4b6a96-0x0;var _0x188e3f=_0xdf08[_0x4b6a96];return _0x188e3f;};'use strict';var Sequelize=require(_0x8df0('0x0'));module[_0x8df0('0x1')]={'body':{'type':Sequelize[_0x8df0('0x2')]},'senderName':{'type':Sequelize[_0x8df0('0x3')]},'recipientsId':{'type':Sequelize[_0x8df0('0x2')]},'recipientsDescription':{'type':Sequelize[_0x8df0('0x3')]},'beep':{'type':Sequelize[_0x8df0('0x4')]}}; \ No newline at end of file +var _0xd4fd=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x1716fd,_0x5168d6){var _0x5e4382=function(_0x49f304){while(--_0x49f304){_0x1716fd['push'](_0x1716fd['shift']());}};_0x5e4382(++_0x5168d6);}(_0xd4fd,0x19c));var _0xdd4f=function(_0x403430,_0x5e8f27){_0x403430=_0x403430-0x0;var _0x2baede=_0xd4fd[_0x403430];return _0x2baede;};'use strict';var Sequelize=require(_0xdd4f('0x0'));module[_0xdd4f('0x1')]={'body':{'type':Sequelize[_0xdd4f('0x2')]},'senderName':{'type':Sequelize[_0xdd4f('0x3')]},'recipientsId':{'type':Sequelize[_0xdd4f('0x2')]},'recipientsDescription':{'type':Sequelize[_0xdd4f('0x3')]},'beep':{'type':Sequelize[_0xdd4f('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index fbb2e34..ada3988 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 _0xf78d=['some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','create','forEach','recipient','emit','userNotification:send','catch','Template','html','render','startCase','toLowerCase','union','ids','queue','replace','Queue','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userNotification.socket','sendStatus','status','json','undefined','count','offset','limit','Content-Range','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','user'];(function(_0x321e66,_0x6dfc01){var _0x3bd8a7=function(_0x2787a6){while(--_0x2787a6){_0x321e66['push'](_0x321e66['shift']());}};_0x3bd8a7(++_0x6dfc01);}(_0xf78d,0x137));var _0xdf78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf78d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdf78('0x0'));var rimraf=require(_0xdf78('0x1'));var zipdir=require(_0xdf78('0x2'));var jsonpatch=require(_0xdf78('0x3'));var rp=require(_0xdf78('0x4'));var moment=require(_0xdf78('0x5'));var BPromise=require(_0xdf78('0x6'));var Mustache=require(_0xdf78('0x7'));var util=require(_0xdf78('0x8'));var path=require(_0xdf78('0x9'));var sox=require(_0xdf78('0xa'));var csv=require(_0xdf78('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf78('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdf78('0xd'));var jsforce=require(_0xdf78('0xe'));var deskjs=require(_0xdf78('0xf'));var toCsv=require(_0xdf78('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdf78('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdf78('0x11'));var as=require(_0xdf78('0x12'));var hardwareService=require(_0xdf78('0x13'));var logger=require(_0xdf78('0x14'))('api');var utils=require(_0xdf78('0x15'));var config=require(_0xdf78('0x16'));var licenseUtil=require(_0xdf78('0x17'));var db=require(_0xdf78('0x18'))['db'];config[_0xdf78('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdf78('0x1a'))(new Redis(config[_0xdf78('0x19')]));require(_0xdf78('0x1b'))['register'](socket);function respondWithStatusCode(_0x32e164,_0x2ae754){_0x2ae754=_0x2ae754||0xcc;return function(_0x2a7ba3){if(_0x2a7ba3){return _0x32e164[_0xdf78('0x1c')](_0x2ae754);}return _0x32e164[_0xdf78('0x1d')](_0x2ae754)['end']();};}function respondWithResult(_0x27d8c,_0x471e8e){_0x471e8e=_0x471e8e||0xc8;return function(_0x3d8149){if(_0x3d8149){return _0x27d8c[_0xdf78('0x1d')](_0x471e8e)[_0xdf78('0x1e')](_0x3d8149);}};}function respondWithFilteredResult(_0x1d5c39,_0x475403){return function(_0xf7ad4){if(_0xf7ad4){var _0x53256f=typeof _0x475403['offset']===_0xdf78('0x1f')&&typeof _0x475403['limit']===_0xdf78('0x1f');var _0x5116fe=_0xf7ad4[_0xdf78('0x20')];var _0x646b05=_0x53256f?0x0:_0x475403[_0xdf78('0x21')];var _0x4bf7d6=_0x53256f?_0xf7ad4['count']:_0x475403['offset']+_0x475403[_0xdf78('0x22')];var _0x311d0d;if(_0x4bf7d6>=_0x5116fe){_0x4bf7d6=_0x5116fe;_0x311d0d=0xc8;}else{_0x311d0d=0xce;}_0x1d5c39[_0xdf78('0x1d')](_0x311d0d);return _0x1d5c39['set'](_0xdf78('0x23'),_0x646b05+'-'+_0x4bf7d6+'/'+_0x5116fe)[_0xdf78('0x1e')](_0xf7ad4);}return null;};}function patchUpdates(_0x3d58c2){return function(_0x55dc50){try{jsonpatch['apply'](_0x55dc50,_0x3d58c2,!![]);}catch(_0xb7fa1f){return BPromise['reject'](_0xb7fa1f);}return _0x55dc50[_0xdf78('0x24')]();};}function saveUpdates(_0x4cc42f,_0x340905){return function(_0x5381b1){if(_0x5381b1){return _0x5381b1[_0xdf78('0x25')](_0x4cc42f)[_0xdf78('0x26')](function(_0x218c2d){return _0x218c2d;});}return null;};}function removeEntity(_0x5a183a,_0xd10959){return function(_0x28e458){if(_0x28e458){return _0x28e458[_0xdf78('0x27')]()[_0xdf78('0x26')](function(){_0x5a183a[_0xdf78('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f2ab6,_0x154d50){return function(_0x313390){if(!_0x313390){_0x1f2ab6[_0xdf78('0x1c')](0x194);}return _0x313390;};}function handleError(_0x5c238c,_0x2f6361){_0x2f6361=_0x2f6361||0x1f4;return function(_0x450ee6){logger[_0xdf78('0x28')](_0x450ee6[_0xdf78('0x29')]);if(_0x450ee6[_0xdf78('0x2a')]){delete _0x450ee6[_0xdf78('0x2a')];}_0x5c238c[_0xdf78('0x1d')](_0x2f6361)[_0xdf78('0x2b')](_0x450ee6);};}exports[_0xdf78('0x2c')]=function(_0x53a039,_0x380f5e,_0x4674b3){if(!_0x53a039[_0xdf78('0x2d')][_0xdf78('0x2e')](_0xdf78('0x2f'))&&!_0x53a039[_0xdf78('0x2d')][_0xdf78('0x2e')]('TemplateId')){throw new db['Sequelize']['ValidationError'](_0xdf78('0x30'));}else{if(_0x53a039[_0xdf78('0x2d')][_0xdf78('0x2e')](_0xdf78('0x31'))&&!_0x53a039[_0xdf78('0x2d')]['hasOwnProperty'](_0xdf78('0x32'))){throw new db[(_0xdf78('0x33'))][(_0xdf78('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x53a039[_0xdf78('0x2d')][_0xdf78('0x2e')](_0xdf78('0x35'))){throw new db[(_0xdf78('0x33'))][(_0xdf78('0x34'))](_0xdf78('0x36'));}else{try{var _0xccf0d5=JSON[_0xdf78('0x37')](_0x53a039['body'][_0xdf78('0x35')]);}catch(_0x3148f9){logger[_0xdf78('0x28')](_0x3148f9);throw new db[(_0xdf78('0x33'))][(_0xdf78('0x34'))](_0xdf78('0x38'));}var _0x5ae0d3=[_0xdf78('0x39'),'faxqueue',_0xdf78('0x3a'),_0xdf78('0x3b'),'smsqueue','voicequeue','whatsappqueue','team',_0xdf78('0x3c')];if(_[_0xdf78('0x3d')](_0xccf0d5,function(_0x3b3998){return!_[_0xdf78('0x3e')](_0x5ae0d3,_0x3b3998[_0xdf78('0x3f')]['toLowerCase']());})){throw new db[(_0xdf78('0x33'))][(_0xdf78('0x34'))](_0xdf78('0x40'));}}}var _0x335a0e={};_0x335a0e['senderName']=_0x53a039[_0xdf78('0x2d')][_0xdf78('0x2e')]('senderName')?_0x53a039[_0xdf78('0x2d')][_0xdf78('0x41')]:_0x53a039[_0xdf78('0x3c')][_0xdf78('0x42')];_0x335a0e[_0xdf78('0x43')]=_['isEmpty'](_0x53a039[_0xdf78('0x2d')][_0xdf78('0x43')])?null:_0x53a039[_0xdf78('0x2d')][_0xdf78('0x43')];_0x335a0e[_0xdf78('0x44')]=_0x53a039[_0xdf78('0x2d')]['beep']||![];_0x335a0e[_0xdf78('0x45')]=_0x53a039[_0xdf78('0x3c')]['id'];return getContent(_0x53a039[_0xdf78('0x2d')])[_0xdf78('0x26')](function(_0x342533){_0x335a0e['body']=_0x342533;return getRecipients(_0xccf0d5);})[_0xdf78('0x26')](function(_0x470fb8){_0x335a0e[_0xdf78('0x46')]=_[_0xdf78('0x47')](_0x470fb8)[_0xdf78('0x48')](',');return db[_0xdf78('0x49')]['transaction'](function(_0x45bfdd){return db['UserNotification'][_0xdf78('0x4a')](_0x335a0e,{'raw':!![],'transaction':_0x45bfdd})[_0xdf78('0x26')](function(_0x5bae98){var _0x9ad716={'sender':_0x335a0e[_0xdf78('0x41')],'description':_0x335a0e[_0xdf78('0x43')],'content':_0x335a0e['body'],'beep':_0x335a0e[_0xdf78('0x44')]};_0x470fb8[_0xdf78('0x4b')](function(_0x37426d){_0x9ad716[_0xdf78('0x4c')]=_0x37426d;socket[_0xdf78('0x4d')](_0xdf78('0x4e'),_0x9ad716);});return _0x5bae98;});});})[_0xdf78('0x26')](respondWithResult(_0x380f5e,0xc9))[_0xdf78('0x4f')](handleError(_0x380f5e,null));};function getContent(_0x4fc6b8){return new BPromise(function(_0x5643a6,_0x25d830){if(_0x4fc6b8[_0xdf78('0x2f')]){_0x5643a6(_0x4fc6b8[_0xdf78('0x2f')]);return;}return db[_0xdf78('0x50')]['findOne']({'attributes':[_0xdf78('0x51')],'where':{'id':_0x4fc6b8[_0xdf78('0x31')]},'raw':!![]})[_0xdf78('0x26')](function(_0x311827){if(!_0x311827)throw new db['Sequelize']['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x20c6db=Mustache[_0xdf78('0x52')](_0x311827[_0xdf78('0x51')],_0x4fc6b8[_0xdf78('0x32')]);_0x5643a6(_0x20c6db);})['catch'](function(_0x350342){_0x25d830(_0x350342);});});}function getRecipients(_0x13c4c3){return new BPromise(function(_0x450082,_0x13b65a){var _0x2758f0=[];var _0x9493d4=[];_0x13c4c3[_0xdf78('0x4b')](function(_0x3229e7){var _0x52b0c1=_[_0xdf78('0x53')](_0x3229e7[_0xdf78('0x3f')][_0xdf78('0x54')]());if(_0x52b0c1==='User'){_0x2758f0=_[_0xdf78('0x55')](_0x2758f0,_0x3229e7[_0xdf78('0x56')]);}else{if(_[_0xdf78('0x3e')](_0x52b0c1,_0xdf78('0x57')))_0x52b0c1=_0x52b0c1[_0xdf78('0x58')](_0xdf78('0x57'),_0xdf78('0x59'));_0x3229e7[_0xdf78('0x56')][_0xdf78('0x4b')](function(_0x189c51){_0x9493d4['push'](getAgents(_0x52b0c1,_0x189c51));});}});return BPromise[_0xdf78('0x5a')](_0x9493d4)[_0xdf78('0x26')](function(_0x425b5c){_0x2758f0=_['union'](_0x2758f0,_[_0xdf78('0x5b')](_0x425b5c));_0x450082(_0x2758f0);})[_0xdf78('0x4f')](function(_0xe9e98){_0x13b65a(_0xe9e98);});});}function getAgents(_0x3f768c,_0x16d874){return new BPromise(function(_0x21352c,_0x423eac){return db[_0x3f768c]['findOne']({'where':{'id':_0x16d874}})[_0xdf78('0x26')](function(_0x5a7a35){return _0x5a7a35['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x1fcf19){var _0x1a8c8a=_[_0xdf78('0x5c')](_0x1fcf19,'id');_0x21352c(_0x1a8c8a);});})[_0xdf78('0x4f')](function(_0x32ebe5){_0x423eac(_0x32ebe5);});});} \ No newline at end of file +var _0x5e1c=['hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','UserNotification','create','recipient','emit','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','forEach','startCase','model','User','union','queue','replace','ids','push','all','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','status','error','stack','name','sendUserNotification','body'];(function(_0x38f5ad,_0x8e24db){var _0x372bbc=function(_0x3a85b8){while(--_0x3a85b8){_0x38f5ad['push'](_0x38f5ad['shift']());}};_0x372bbc(++_0x8e24db);}(_0x5e1c,0x9f));var _0xc5e1=function(_0x3e6cbf,_0x205b53){_0x3e6cbf=_0x3e6cbf-0x0;var _0x2ffbf8=_0x5e1c[_0x3e6cbf];return _0x2ffbf8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc5e1('0x0'));var zipdir=require(_0xc5e1('0x1'));var jsonpatch=require(_0xc5e1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc5e1('0x3'));var util=require(_0xc5e1('0x4'));var path=require('path');var sox=require(_0xc5e1('0x5'));var csv=require(_0xc5e1('0x6'));var ejs=require(_0xc5e1('0x7'));var fs=require('fs');var fs_extra=require(_0xc5e1('0x8'));var _=require(_0xc5e1('0x9'));var squel=require(_0xc5e1('0xa'));var crypto=require('crypto');var jsforce=require(_0xc5e1('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc5e1('0xc'));var Papa=require(_0xc5e1('0xd'));var Redis=require(_0xc5e1('0xe'));var authService=require(_0xc5e1('0xf'));var qs=require(_0xc5e1('0x10'));var as=require(_0xc5e1('0x11'));var hardwareService=require(_0xc5e1('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc5e1('0x13'));var licenseUtil=require(_0xc5e1('0x14'));var db=require(_0xc5e1('0x15'))['db'];config[_0xc5e1('0x16')]=_[_0xc5e1('0x17')](config[_0xc5e1('0x16')],{'host':_0xc5e1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc5e1('0x16')]));require(_0xc5e1('0x19'))[_0xc5e1('0x1a')](socket);function respondWithStatusCode(_0x13148c,_0x24d7ac){_0x24d7ac=_0x24d7ac||0xcc;return function(_0x503feb){if(_0x503feb){return _0x13148c[_0xc5e1('0x1b')](_0x24d7ac);}return _0x13148c['status'](_0x24d7ac)[_0xc5e1('0x1c')]();};}function respondWithResult(_0xfc752d,_0x137138){_0x137138=_0x137138||0xc8;return function(_0x3adfa0){if(_0x3adfa0){return _0xfc752d['status'](_0x137138)[_0xc5e1('0x1d')](_0x3adfa0);}};}function respondWithFilteredResult(_0x2302a7,_0x5f8482){return function(_0x9b6fc4){if(_0x9b6fc4){var _0x1c4152=typeof _0x5f8482[_0xc5e1('0x1e')]==='undefined'&&typeof _0x5f8482[_0xc5e1('0x1f')]===_0xc5e1('0x20');var _0x3c03cc=_0x9b6fc4[_0xc5e1('0x21')];var _0x4756f0=_0x1c4152?0x0:_0x5f8482[_0xc5e1('0x1e')];var _0xde7e24=_0x1c4152?_0x9b6fc4[_0xc5e1('0x21')]:_0x5f8482[_0xc5e1('0x1e')]+_0x5f8482[_0xc5e1('0x1f')];var _0x4c3332;if(_0xde7e24>=_0x3c03cc){_0xde7e24=_0x3c03cc;_0x4c3332=0xc8;}else{_0x4c3332=0xce;}_0x2302a7['status'](_0x4c3332);return _0x2302a7[_0xc5e1('0x22')](_0xc5e1('0x23'),_0x4756f0+'-'+_0xde7e24+'/'+_0x3c03cc)[_0xc5e1('0x1d')](_0x9b6fc4);}return null;};}function patchUpdates(_0x5f2cd1){return function(_0x2a32dd){try{jsonpatch[_0xc5e1('0x24')](_0x2a32dd,_0x5f2cd1,!![]);}catch(_0x21edd6){return BPromise[_0xc5e1('0x25')](_0x21edd6);}return _0x2a32dd[_0xc5e1('0x26')]();};}function saveUpdates(_0x476aca,_0x394737){return function(_0x133076){if(_0x133076){return _0x133076[_0xc5e1('0x27')](_0x476aca)[_0xc5e1('0x28')](function(_0x44ba31){return _0x44ba31;});}return null;};}function removeEntity(_0x4160de,_0x314abf){return function(_0x28768a){if(_0x28768a){return _0x28768a['destroy']()[_0xc5e1('0x28')](function(){_0x4160de[_0xc5e1('0x29')](0xcc)[_0xc5e1('0x1c')]();});}};}function handleEntityNotFound(_0x3d3da3,_0x1788cd){return function(_0x577d97){if(!_0x577d97){_0x3d3da3[_0xc5e1('0x1b')](0x194);}return _0x577d97;};}function handleError(_0x4bd0b6,_0x3ad098){_0x3ad098=_0x3ad098||0x1f4;return function(_0x34ec57){logger[_0xc5e1('0x2a')](_0x34ec57[_0xc5e1('0x2b')]);if(_0x34ec57[_0xc5e1('0x2c')]){delete _0x34ec57[_0xc5e1('0x2c')];}_0x4bd0b6[_0xc5e1('0x29')](_0x3ad098)['send'](_0x34ec57);};}exports[_0xc5e1('0x2d')]=function(_0x4cec6c,_0xdfcfde,_0x185989){if(!_0x4cec6c[_0xc5e1('0x2e')][_0xc5e1('0x2f')](_0xc5e1('0x30'))&&!_0x4cec6c['body'][_0xc5e1('0x2f')](_0xc5e1('0x31'))){throw new db[(_0xc5e1('0x32'))][(_0xc5e1('0x33'))](_0xc5e1('0x34'));}else{if(_0x4cec6c[_0xc5e1('0x2e')][_0xc5e1('0x2f')](_0xc5e1('0x31'))&&!_0x4cec6c[_0xc5e1('0x2e')][_0xc5e1('0x2f')](_0xc5e1('0x35'))){throw new db[(_0xc5e1('0x32'))][(_0xc5e1('0x33'))](_0xc5e1('0x36'));}if(!_0x4cec6c[_0xc5e1('0x2e')][_0xc5e1('0x2f')](_0xc5e1('0x37'))){throw new db[(_0xc5e1('0x32'))][(_0xc5e1('0x33'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x19f009=JSON[_0xc5e1('0x38')](_0x4cec6c[_0xc5e1('0x2e')][_0xc5e1('0x37')]);}catch(_0x2e6506){logger[_0xc5e1('0x2a')](_0x2e6506);throw new db[(_0xc5e1('0x32'))][(_0xc5e1('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x1c4aa4=[_0xc5e1('0x39'),_0xc5e1('0x3a'),_0xc5e1('0x3b'),_0xc5e1('0x3c'),_0xc5e1('0x3d'),_0xc5e1('0x3e'),_0xc5e1('0x3f'),_0xc5e1('0x40'),_0xc5e1('0x41')];if(_[_0xc5e1('0x42')](_0x19f009,function(_0x1d942e){return!_[_0xc5e1('0x43')](_0x1c4aa4,_0x1d942e['model'][_0xc5e1('0x44')]());})){throw new db[(_0xc5e1('0x32'))][(_0xc5e1('0x33'))](_0xc5e1('0x45'));}}}var _0x462196={};_0x462196['senderName']=_0x4cec6c['body'][_0xc5e1('0x2f')](_0xc5e1('0x46'))?_0x4cec6c['body']['senderName']:_0x4cec6c[_0xc5e1('0x41')][_0xc5e1('0x47')];_0x462196[_0xc5e1('0x48')]=_[_0xc5e1('0x49')](_0x4cec6c[_0xc5e1('0x2e')][_0xc5e1('0x48')])?null:_0x4cec6c[_0xc5e1('0x2e')]['recipientsDescription'];_0x462196[_0xc5e1('0x4a')]=_0x4cec6c['body']['beep']||![];_0x462196[_0xc5e1('0x4b')]=_0x4cec6c[_0xc5e1('0x41')]['id'];return getContent(_0x4cec6c['body'])['then'](function(_0x35492f){_0x462196['body']=_0x35492f;return getRecipients(_0x19f009);})[_0xc5e1('0x28')](function(_0x456e88){_0x462196[_0xc5e1('0x4c')]=_['sortBy'](_0x456e88)[_0xc5e1('0x4d')](',');return db[_0xc5e1('0x4e')][_0xc5e1('0x4f')](function(_0xbd654a){return db[_0xc5e1('0x50')][_0xc5e1('0x51')](_0x462196,{'raw':!![],'transaction':_0xbd654a})['then'](function(_0x1d330f){var _0x47780b={'sender':_0x462196[_0xc5e1('0x46')],'description':_0x462196[_0xc5e1('0x48')],'content':_0x462196[_0xc5e1('0x2e')],'beep':_0x462196['beep']};_0x456e88['forEach'](function(_0x5b4c2d){_0x47780b[_0xc5e1('0x52')]=_0x5b4c2d;socket[_0xc5e1('0x53')]('userNotification:send',_0x47780b);});return _0x1d330f;});});})[_0xc5e1('0x28')](respondWithResult(_0xdfcfde,0xc9))[_0xc5e1('0x54')](handleError(_0xdfcfde,null));};function getContent(_0x163f32){return new BPromise(function(_0x4309be,_0x4fe4dc){if(_0x163f32[_0xc5e1('0x30')]){_0x4309be(_0x163f32[_0xc5e1('0x30')]);return;}return db[_0xc5e1('0x55')][_0xc5e1('0x56')]({'attributes':['html'],'where':{'id':_0x163f32[_0xc5e1('0x31')]},'raw':!![]})[_0xc5e1('0x28')](function(_0x38dbd9){if(!_0x38dbd9)throw new db[(_0xc5e1('0x32'))][(_0xc5e1('0x33'))](_0xc5e1('0x57'));var _0xd7a945=Mustache[_0xc5e1('0x58')](_0x38dbd9[_0xc5e1('0x59')],_0x163f32['view']);_0x4309be(_0xd7a945);})['catch'](function(_0xef7362){_0x4fe4dc(_0xef7362);});});}function getRecipients(_0x114c62){return new BPromise(function(_0x5ebe58,_0x16c961){var _0x21e91c=[];var _0x4b896b=[];_0x114c62[_0xc5e1('0x5a')](function(_0x501ae2){var _0x35f53c=_[_0xc5e1('0x5b')](_0x501ae2[_0xc5e1('0x5c')][_0xc5e1('0x44')]());if(_0x35f53c===_0xc5e1('0x5d')){_0x21e91c=_[_0xc5e1('0x5e')](_0x21e91c,_0x501ae2['ids']);}else{if(_[_0xc5e1('0x43')](_0x35f53c,_0xc5e1('0x5f')))_0x35f53c=_0x35f53c[_0xc5e1('0x60')](_0xc5e1('0x5f'),'Queue');_0x501ae2[_0xc5e1('0x61')]['forEach'](function(_0x59157f){_0x4b896b[_0xc5e1('0x62')](getAgents(_0x35f53c,_0x59157f));});}});return BPromise[_0xc5e1('0x63')](_0x4b896b)['then'](function(_0x34c016){_0x21e91c=_[_0xc5e1('0x5e')](_0x21e91c,_[_0xc5e1('0x64')](_0x34c016));_0x5ebe58(_0x21e91c);})[_0xc5e1('0x54')](function(_0x587e72){_0x16c961(_0x587e72);});});}function getAgents(_0x4a96f3,_0x58a68e){return new BPromise(function(_0x283f5a,_0x5ded89){return db[_0x4a96f3]['findOne']({'where':{'id':_0x58a68e}})['then'](function(_0x439469){return _0x439469[_0xc5e1('0x65')]({'attributes':['id'],'raw':!![]})['then'](function(_0x9cb269){var _0xecee9c=_[_0xc5e1('0x66')](_0x9cb269,'id');_0x283f5a(_0xecee9c);});})['catch'](function(_0x17b42e){_0x5ded89(_0x17b42e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 98c4075..7998ab4 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 _0x34e9=['setMaxListeners','save','emit','hasOwnProperty','exports','../../mysqldb','UserNotification'];(function(_0x48a96f,_0x530059){var _0x3ff3ef=function(_0x286059){while(--_0x286059){_0x48a96f['push'](_0x48a96f['shift']());}};_0x3ff3ef(++_0x530059);}(_0x34e9,0xf3));var _0x934e=function(_0x384b73,_0x18967c){_0x384b73=_0x384b73-0x0;var _0x3a188f=_0x34e9[_0x384b73];return _0x3a188f;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x934e('0x0'))['db'][_0x934e('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x934e('0x2')](0x0);var events={'afterCreate':_0x934e('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5a5a52){return function(_0xd1150d,_0x17143d,_0x2fccee){UserNotificationEvents[_0x934e('0x4')](_0x5a5a52+':'+_0xd1150d['id'],_0xd1150d);UserNotificationEvents[_0x934e('0x4')](_0x5a5a52,_0xd1150d);_0x2fccee(null);};}for(var e in events){if(events[_0x934e('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x934e('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0xfb33=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification'];(function(_0x1be422,_0x290870){var _0x57cb2f=function(_0x512c83){while(--_0x512c83){_0x1be422['push'](_0x1be422['shift']());}};_0x57cb2f(++_0x290870);}(_0xfb33,0x96));var _0x3fb3=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0xfb33[_0x211632];return _0x5a1da1;};'use strict';var EventEmitter=require(_0x3fb3('0x0'));var UserNotification=require(_0x3fb3('0x1'))['db'][_0x3fb3('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3fb3('0x3')](0x0);var events={'afterCreate':_0x3fb3('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x566cc2){return function(_0x505594,_0x58015c,_0x15aa9a){UserNotificationEvents[_0x3fb3('0x5')](_0x566cc2+':'+_0x505594['id'],_0x505594);UserNotificationEvents[_0x3fb3('0x5')](_0x566cc2,_0x505594);_0x15aa9a(null);};}for(var e in events){if(events[_0x3fb3('0x6')](e)){var event=events[e];UserNotification[_0x3fb3('0x7')](e,emitEvent(event));}}module[_0x3fb3('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 812e404..1b75540 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 _0x315e=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0x315e,0x1ed));var _0xe315=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x315e[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xe315('0x0'));var util=require(_0xe315('0x1'));var logger=require(_0xe315('0x2'))('api');var moment=require(_0xe315('0x3'));var BPromise=require('bluebird');var rp=require(_0xe315('0x4'));var fs=require('fs');var path=require(_0xe315('0x5'));var rimraf=require(_0xe315('0x6'));var config=require(_0xe315('0x7'));var attributes=require(_0xe315('0x8'));module['exports']=function(_0xc745b0,_0x2361f7){return _0xc745b0[_0xe315('0x9')](_0xe315('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe315('0xb'),'collate':_0xe315('0xc')});}; \ No newline at end of file +var _0x63a1=['define','UserNotification','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x239f31,_0x2934ca){var _0x5926d9=function(_0x1ee23b){while(--_0x1ee23b){_0x239f31['push'](_0x239f31['shift']());}};_0x5926d9(++_0x2934ca);}(_0x63a1,0xdf));var _0x163a=function(_0x3b15ad,_0x3050f1){_0x3b15ad=_0x3b15ad-0x0;var _0x23840f=_0x63a1[_0x3b15ad];return _0x23840f;};'use strict';var _=require('lodash');var util=require(_0x163a('0x0'));var logger=require(_0x163a('0x1'))(_0x163a('0x2'));var moment=require(_0x163a('0x3'));var BPromise=require('bluebird');var rp=require(_0x163a('0x4'));var fs=require('fs');var path=require(_0x163a('0x5'));var rimraf=require('rimraf');var config=require(_0x163a('0x6'));var attributes=require('./userNotification.attributes');module[_0x163a('0x7')]=function(_0x50099a,_0x5c8108){return _0x50099a[_0x163a('0x8')](_0x163a('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x163a('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 1caf555..e6271a5 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 _0x7fad=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userNotification.socket','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','UserNotification,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x41c5a6,_0x5310f1){var _0x1aa3f8=function(_0x3ca8ad){while(--_0x3ca8ad){_0x41c5a6['push'](_0x41c5a6['shift']());}};_0x1aa3f8(++_0x5310f1);}(_0x7fad,0x17f));var _0xd7fa=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x7fad[_0x4f5108];return _0x2d56ca;};'use strict';var _=require(_0xd7fa('0x0'));var util=require(_0xd7fa('0x1'));var moment=require(_0xd7fa('0x2'));var BPromise=require(_0xd7fa('0x3'));var rs=require(_0xd7fa('0x4'));var fs=require('fs');var Redis=require(_0xd7fa('0x5'));var db=require(_0xd7fa('0x6'))['db'];var utils=require(_0xd7fa('0x7'));var logger=require(_0xd7fa('0x8'))(_0xd7fa('0x9'));var config=require(_0xd7fa('0xa'));var jayson=require(_0xd7fa('0xb'));var client=jayson[_0xd7fa('0xc')]['http']({'port':0x232a});config[_0xd7fa('0xd')]=_[_0xd7fa('0xe')](config['redis'],{'host':_0xd7fa('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7fa('0xd')]));require(_0xd7fa('0x10'))['register'](socket);function respondWithRpcPromise(_0x14b4b2,_0x27d259,_0xcf4363){return new BPromise(function(_0x5975dd,_0x3b02a3){return client['request'](_0x14b4b2,_0xcf4363)[_0xd7fa('0x11')](function(_0x19f346){logger[_0xd7fa('0x12')]('UserNotification,\x20%s,\x20%s',_0x27d259,'request\x20sent');logger[_0xd7fa('0x13')](_0xd7fa('0x14'),_0x27d259,'request\x20sent',JSON['stringify'](_0x19f346));if(_0x19f346[_0xd7fa('0x15')]){if(_0x19f346[_0xd7fa('0x15')]['code']===0x1f4){logger[_0xd7fa('0x15')](_0xd7fa('0x16'),_0x27d259,_0x19f346['error']['message']);return _0x3b02a3(_0x19f346[_0xd7fa('0x15')]['message']);}logger[_0xd7fa('0x15')](_0xd7fa('0x16'),_0x27d259,_0x19f346[_0xd7fa('0x15')]['message']);return _0x5975dd(_0x19f346['error'][_0xd7fa('0x17')]);}else{logger[_0xd7fa('0x12')](_0xd7fa('0x16'),_0x27d259,_0xd7fa('0x18'));_0x5975dd(_0x19f346['result'][_0xd7fa('0x17')]);}})[_0xd7fa('0x19')](function(_0x5bbf21){logger[_0xd7fa('0x15')](_0xd7fa('0x16'),_0x27d259,_0x5bbf21);_0x3b02a3(_0x5bbf21);});});} \ No newline at end of file +var _0x6055=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','lodash','util','bluebird','randomstring','ioredis'];(function(_0x18a04f,_0x53abcd){var _0x2bb3ea=function(_0x159fde){while(--_0x159fde){_0x18a04f['push'](_0x18a04f['shift']());}};_0x2bb3ea(++_0x53abcd);}(_0x6055,0xc3));var _0x5605=function(_0x23082c,_0x2043c3){_0x23082c=_0x23082c-0x0;var _0x2bc8da=_0x6055[_0x23082c];return _0x2bc8da;};'use strict';var _=require(_0x5605('0x0'));var util=require(_0x5605('0x1'));var moment=require('moment');var BPromise=require(_0x5605('0x2'));var rs=require(_0x5605('0x3'));var fs=require('fs');var Redis=require(_0x5605('0x4'));var db=require(_0x5605('0x5'))['db'];var utils=require(_0x5605('0x6'));var logger=require('../../config/logger')(_0x5605('0x7'));var config=require(_0x5605('0x8'));var jayson=require(_0x5605('0x9'));var client=jayson['client'][_0x5605('0xa')]({'port':0x232a});config[_0x5605('0xb')]=_[_0x5605('0xc')](config[_0x5605('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5605('0xd'))(new Redis(config[_0x5605('0xb')]));require(_0x5605('0xe'))[_0x5605('0xf')](socket);function respondWithRpcPromise(_0x53ce16,_0x1ef454,_0x2546e3){return new BPromise(function(_0x4c10f7,_0x3d52ab){return client[_0x5605('0x10')](_0x53ce16,_0x2546e3)[_0x5605('0x11')](function(_0x219636){logger[_0x5605('0x12')](_0x5605('0x13'),_0x1ef454,'request\x20sent');logger[_0x5605('0x14')](_0x5605('0x15'),_0x1ef454,_0x5605('0x16'),JSON['stringify'](_0x219636));if(_0x219636[_0x5605('0x17')]){if(_0x219636['error']['code']===0x1f4){logger[_0x5605('0x17')]('UserNotification,\x20%s,\x20%s',_0x1ef454,_0x219636['error'][_0x5605('0x18')]);return _0x3d52ab(_0x219636[_0x5605('0x17')][_0x5605('0x18')]);}logger[_0x5605('0x17')](_0x5605('0x13'),_0x1ef454,_0x219636[_0x5605('0x17')]['message']);return _0x4c10f7(_0x219636[_0x5605('0x17')][_0x5605('0x18')]);}else{logger['info'](_0x5605('0x13'),_0x1ef454,_0x5605('0x16'));_0x4c10f7(_0x219636['result'][_0x5605('0x18')]);}})['catch'](function(_0xb0cf53){logger[_0x5605('0x17')](_0x5605('0x13'),_0x1ef454,_0xb0cf53);_0x3d52ab(_0xb0cf53);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index ce492d9..f71c520 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 _0x5324=['update','emit','register','./userNotification.events','save','remove'];(function(_0x570d8c,_0x269f01){var _0x4583a7=function(_0x207371){while(--_0x207371){_0x570d8c['push'](_0x570d8c['shift']());}};_0x4583a7(++_0x269f01);}(_0x5324,0x6f));var _0x4532=function(_0x381bff,_0x19d01f){_0x381bff=_0x381bff-0x0;var _0x201ab1=_0x5324[_0x381bff];return _0x201ab1;};'use strict';var UserNotificationEvents=require(_0x4532('0x0'));var events=[_0x4532('0x1'),_0x4532('0x2'),_0x4532('0x3')];function createListener(_0x4a71c9,_0x4621be){return function(_0x4e28dc){_0x4621be[_0x4532('0x4')](_0x4a71c9,_0x4e28dc);};}function removeListener(_0x1fc446,_0x9b3ce3){return function(){UserNotificationEvents['removeListener'](_0x1fc446,_0x9b3ce3);};}exports[_0x4532('0x5')]=function(_0x3972b3){for(var _0x264d29=0x0,_0x3030b7=events['length'];_0x264d29<_0x3030b7;_0x264d29++){var _0x2f2fa1=events[_0x264d29];var _0x27bd6a=createListener('userNotification:'+_0x2f2fa1,_0x3972b3);UserNotificationEvents['on'](_0x2f2fa1,_0x27bd6a);}}; \ No newline at end of file +var _0xc6ec=['length','userNotification:','./userNotification.events','save','update','removeListener'];(function(_0x40127c,_0x84d923){var _0x455dff=function(_0x1eed1a){while(--_0x1eed1a){_0x40127c['push'](_0x40127c['shift']());}};_0x455dff(++_0x84d923);}(_0xc6ec,0x15e));var _0xcc6e=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0xc6ec[_0x25fc41];return _0x1371d1;};'use strict';var UserNotificationEvents=require(_0xcc6e('0x0'));var events=[_0xcc6e('0x1'),'remove',_0xcc6e('0x2')];function createListener(_0x1093d1,_0x367e30){return function(_0x4554f2){_0x367e30['emit'](_0x1093d1,_0x4554f2);};}function removeListener(_0x57585d,_0x102019){return function(){UserNotificationEvents[_0xcc6e('0x3')](_0x57585d,_0x102019);};}exports['register']=function(_0x72c8e5){for(var _0x14a480=0x0,_0x433d99=events[_0xcc6e('0x4')];_0x14a480<_0x433d99;_0x14a480++){var _0x231e99=events[_0x14a480];var _0x2ba0e3=createListener(_0xcc6e('0x5')+_0x231e99,_0x72c8e5);UserNotificationEvents['on'](_0x231e99,_0x2ba0e3);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 701f9eb..cce8619 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4d9fed,_0x4d4dcc){var _0x19728d=function(_0x3dba7c){while(--_0x3dba7c){_0x4d9fed['push'](_0x4d9fed['shift']());}};_0x19728d(++_0x4d4dcc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xcb91[_0x88cd7b];return _0x56fcc8;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x58dd05,_0x12a36f){var _0xc8f4a4=function(_0x5edfaf){while(--_0x5edfaf){_0x58dd05['push'](_0x58dd05['shift']());}};_0xc8f4a4(++_0x12a36f);}(_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 3df7509..da51263 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 _0xaf8f=['INTEGER','sequelize','exports'];(function(_0xabcb43,_0x2b605f){var _0x3680c1=function(_0x44aa61){while(--_0x44aa61){_0xabcb43['push'](_0xabcb43['shift']());}};_0x3680c1(++_0x2b605f);}(_0xaf8f,0xcd));var _0xfaf8=function(_0x4711bc,_0x31426){_0x4711bc=_0x4711bc-0x0;var _0x4d35ae=_0xaf8f[_0x4711bc];return _0x4d35ae;};'use strict';var Sequelize=require(_0xfaf8('0x0'));module[_0xfaf8('0x1')]={'penalty':{'type':Sequelize[_0xfaf8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x86d8=['sequelize','exports'];(function(_0x4e5a09,_0x26c2cd){var _0x24ecfe=function(_0x3f929c){while(--_0x3f929c){_0x4e5a09['push'](_0x4e5a09['shift']());}};_0x24ecfe(++_0x26c2cd);}(_0x86d8,0xb8));var _0x886d=function(_0x2605d5,_0x300b07){_0x2605d5=_0x2605d5-0x0;var _0x1e545f=_0x86d8[_0x2605d5];return _0x1e545f;};'use strict';var Sequelize=require(_0x886d('0x0'));module[_0x886d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 29386fe..c67eb08 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 _0x233b=['exports','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','moment','bluebird','request-promise','./userOpenchannelQueue.attributes'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0x233b,0x15a));var _0xb233=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x233b[_0x422905];return _0x33dc6c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb233('0x0'))('api');var moment=require(_0xb233('0x1'));var BPromise=require(_0xb233('0x2'));var rp=require(_0xb233('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb233('0x4'));module[_0xb233('0x5')]=function(_0x20a4a1,_0x12fac4){return _0x20a4a1[_0xb233('0x6')](_0xb233('0x7'),attributes,{'tableName':_0xb233('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48a9=['user_has_openchannel_queues','lodash','util','api','moment','bluebird','request-promise','path','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x48a9,0x16c));var _0x948a=function(_0x441f7a,_0x576321){_0x441f7a=_0x441f7a-0x0;var _0x4821da=_0x48a9[_0x441f7a];return _0x4821da;};'use strict';var _=require(_0x948a('0x0'));var util=require(_0x948a('0x1'));var logger=require('../../config/logger')(_0x948a('0x2'));var moment=require(_0x948a('0x3'));var BPromise=require(_0x948a('0x4'));var rp=require(_0x948a('0x5'));var fs=require('fs');var path=require(_0x948a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x948a('0x7'));module['exports']=function(_0x3c00f0,_0x35b99c){return _0x3c00f0[_0x948a('0x8')](_0x948a('0x9'),attributes,{'tableName':_0x948a('0xa'),'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 ddc4063..ca26386 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 _0xffa1=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x4ad622,_0x50e10f){var _0x2cda3b=function(_0x56df53){while(--_0x56df53){_0x4ad622['push'](_0x4ad622['shift']());}};_0x2cda3b(++_0x50e10f);}(_0xffa1,0xce));var _0x1ffa=function(_0x1e80f3,_0x41b598){_0x1e80f3=_0x1e80f3-0x0;var _0x34328c=_0xffa1[_0x1e80f3];return _0x34328c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1ffa('0x0'));var BPromise=require(_0x1ffa('0x1'));var rs=require(_0x1ffa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ffa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ffa('0x4'))(_0x1ffa('0x5'));var config=require(_0x1ffa('0x6'));var jayson=require(_0x1ffa('0x7'));var client=jayson[_0x1ffa('0x8')][_0x1ffa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x344343,_0x1511cb,_0x137d24){return new BPromise(function(_0xefdf08,_0x47d269){return client[_0x1ffa('0xa')](_0x344343,_0x137d24)[_0x1ffa('0xb')](function(_0x446b69){logger[_0x1ffa('0xc')](_0x1ffa('0xd'),_0x1511cb,'request\x20sent');logger['debug'](_0x1ffa('0xe'),_0x1511cb,_0x1ffa('0xf'),JSON[_0x1ffa('0x10')](_0x446b69));if(_0x446b69[_0x1ffa('0x11')]){if(_0x446b69[_0x1ffa('0x11')][_0x1ffa('0x12')]===0x1f4){logger[_0x1ffa('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1511cb,_0x446b69[_0x1ffa('0x11')][_0x1ffa('0x13')]);return _0x47d269(_0x446b69[_0x1ffa('0x11')][_0x1ffa('0x13')]);}logger[_0x1ffa('0x11')](_0x1ffa('0xd'),_0x1511cb,_0x446b69['error'][_0x1ffa('0x13')]);return _0xefdf08(_0x446b69[_0x1ffa('0x11')]['message']);}else{logger[_0x1ffa('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1511cb,_0x1ffa('0xf'));_0xefdf08(_0x446b69[_0x1ffa('0x14')][_0x1ffa('0x13')]);}})[_0x1ffa('0x15')](function(_0x3a7d0e){logger[_0x1ffa('0x11')](_0x1ffa('0xd'),_0x1511cb,_0x3a7d0e);_0x47d269(_0x3a7d0e);});});} \ No newline at end of file +var _0xa9c9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','ioredis'];(function(_0x1ac2ef,_0x401fa2){var _0x410bc4=function(_0x415c97){while(--_0x415c97){_0x1ac2ef['push'](_0x1ac2ef['shift']());}};_0x410bc4(++_0x401fa2);}(_0xa9c9,0x11f));var _0x9a9c=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xa9c9[_0x344a3f];return _0x264712;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a9c('0x0'));var db=require(_0x9a9c('0x1'))['db'];var utils=require(_0x9a9c('0x2'));var logger=require(_0x9a9c('0x3'))(_0x9a9c('0x4'));var config=require(_0x9a9c('0x5'));var jayson=require(_0x9a9c('0x6'));var client=jayson[_0x9a9c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6a4c6b,_0x5e26e9,_0xa52e63){return new BPromise(function(_0x16baa0,_0x11715d){return client[_0x9a9c('0x8')](_0x6a4c6b,_0xa52e63)['then'](function(_0x3ee1e5){logger[_0x9a9c('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5e26e9,_0x9a9c('0xa'));logger[_0x9a9c('0xb')](_0x9a9c('0xc'),_0x5e26e9,_0x9a9c('0xa'),JSON[_0x9a9c('0xd')](_0x3ee1e5));if(_0x3ee1e5[_0x9a9c('0xe')]){if(_0x3ee1e5[_0x9a9c('0xe')]['code']===0x1f4){logger['error'](_0x9a9c('0xf'),_0x5e26e9,_0x3ee1e5[_0x9a9c('0xe')]['message']);return _0x11715d(_0x3ee1e5[_0x9a9c('0xe')][_0x9a9c('0x10')]);}logger[_0x9a9c('0xe')](_0x9a9c('0xf'),_0x5e26e9,_0x3ee1e5[_0x9a9c('0xe')][_0x9a9c('0x10')]);return _0x16baa0(_0x3ee1e5[_0x9a9c('0xe')][_0x9a9c('0x10')]);}else{logger['info'](_0x9a9c('0xf'),_0x5e26e9,_0x9a9c('0xa'));_0x16baa0(_0x3ee1e5[_0x9a9c('0x11')][_0x9a9c('0x10')]);}})['catch'](function(_0x46a8ce){logger[_0x9a9c('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5e26e9,_0x46a8ce);_0x11715d(_0x46a8ce);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 1eb652e..d522693 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 _0x6c33=['/:id','/:id/sections','getSections','getResources','post','/:id/clone','clone','addSections','/:id/resources','addResources','update','delete','destroy','removeSections','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0x6c33,0x186));var _0x36c3=function(_0xd256a1,_0x2aae80){_0xd256a1=_0xd256a1-0x0;var _0x2a11a4=_0x6c33[_0xd256a1];return _0x2a11a4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x36c3('0x0'));var timeout=require(_0x36c3('0x1'));var express=require('express');var router=express[_0x36c3('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x36c3('0x3'));var interaction=require(_0x36c3('0x4'));var config=require(_0x36c3('0x5'));var controller=require('./userProfile.controller');router[_0x36c3('0x6')]('/',auth[_0x36c3('0x7')](),controller['index']);router[_0x36c3('0x6')](_0x36c3('0x8'),auth[_0x36c3('0x7')](),controller[_0x36c3('0x9')]);router[_0x36c3('0x6')](_0x36c3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x36c3('0x6')](_0x36c3('0xb'),auth['isAuthenticated'](),controller[_0x36c3('0xc')]);router['get']('/:id/resources',auth[_0x36c3('0x7')](),controller[_0x36c3('0xd')]);router[_0x36c3('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x36c3('0xe')](_0x36c3('0xf'),auth[_0x36c3('0x7')](),controller[_0x36c3('0x10')]);router[_0x36c3('0xe')](_0x36c3('0xb'),auth['isAuthenticated'](),controller[_0x36c3('0x11')]);router[_0x36c3('0xe')](_0x36c3('0x12'),auth[_0x36c3('0x7')](),controller[_0x36c3('0x13')]);router['put']('/:id',auth[_0x36c3('0x7')](),controller[_0x36c3('0x14')]);router[_0x36c3('0x15')](_0x36c3('0xa'),auth[_0x36c3('0x7')](),controller[_0x36c3('0x16')]);router[_0x36c3('0x15')](_0x36c3('0xb'),auth[_0x36c3('0x7')](),controller[_0x36c3('0x17')]);router[_0x36c3('0x15')](_0x36c3('0x12'),auth[_0x36c3('0x7')](),controller['removeResources']);module[_0x36c3('0x18')]=router; \ No newline at end of file +var _0x1364=['/:id','show','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','/:id/sections','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe'];(function(_0x29cb37,_0x3954b2){var _0x4a4bee=function(_0x385b24){while(--_0x385b24){_0x29cb37['push'](_0x29cb37['shift']());}};_0x4a4bee(++_0x3954b2);}(_0x1364,0x12e));var _0x4136=function(_0x3a5858,_0x8af652){_0x3a5858=_0x3a5858-0x0;var _0x1f333f=_0x1364[_0x3a5858];return _0x1f333f;};'use strict';var multer=require(_0x4136('0x0'));var util=require(_0x4136('0x1'));var path=require(_0x4136('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4136('0x3')]();var fs_extra=require(_0x4136('0x4'));var auth=require(_0x4136('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4136('0x6'));var controller=require('./userProfile.controller');router[_0x4136('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4136('0x7')]('/describe',auth[_0x4136('0x8')](),controller[_0x4136('0x9')]);router['get'](_0x4136('0xa'),auth[_0x4136('0x8')](),controller[_0x4136('0xb')]);router[_0x4136('0x7')]('/:id/sections',auth['isAuthenticated'](),controller[_0x4136('0xc')]);router[_0x4136('0x7')](_0x4136('0xd'),auth[_0x4136('0x8')](),controller[_0x4136('0xe')]);router['post']('/',auth[_0x4136('0x8')](),controller['create']);router[_0x4136('0xf')](_0x4136('0x10'),auth[_0x4136('0x8')](),controller[_0x4136('0x11')]);router[_0x4136('0xf')]('/:id/sections',auth['isAuthenticated'](),controller[_0x4136('0x12')]);router[_0x4136('0xf')](_0x4136('0xd'),auth['isAuthenticated'](),controller[_0x4136('0x13')]);router[_0x4136('0x14')](_0x4136('0xa'),auth['isAuthenticated'](),controller[_0x4136('0x15')]);router[_0x4136('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x4136('0x17')]);router[_0x4136('0x16')](_0x4136('0x18'),auth[_0x4136('0x8')](),controller['removeSections']);router[_0x4136('0x16')](_0x4136('0xd'),auth[_0x4136('0x8')](),controller['removeResources']);module[_0x4136('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 4a56246..c19331d 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 _0xed80=['join','crudPermissions','getDataValue','BOOLEAN','sequelize','exports','name','STRING','setDataValue'];(function(_0x417e0a,_0x446db8){var _0x223dab=function(_0x56978c){while(--_0x56978c){_0x417e0a['push'](_0x417e0a['shift']());}};_0x223dab(++_0x446db8);}(_0xed80,0xaf));var _0x0ed8=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xed80[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x0ed8('0x0'));module[_0x0ed8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0ed8('0x2')},'crudPermissions':{'type':Sequelize[_0x0ed8('0x3')],'set':function(_0x4a6c27){this[_0x0ed8('0x4')]('crudPermissions',_0x4a6c27?_0x4a6c27[_0x0ed8('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x0ed8('0x6'))?this[_0x0ed8('0x7')](_0x0ed8('0x6'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0ed8('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x0ed8('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0ed8('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0ed8('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x0ed8('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x0ed8('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x0ed8('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0ed8('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdbdc=['join','getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x24b92c,_0x50b579){var _0x2bad2d=function(_0x4d3adb){while(--_0x4d3adb){_0x24b92c['push'](_0x24b92c['shift']());}};_0x2bad2d(++_0x50b579);}(_0xdbdc,0x109));var _0xcdbd=function(_0x20e979,_0x4ade4e){_0x20e979=_0x20e979-0x0;var _0x1adb1f=_0xdbdc[_0x20e979];return _0x1adb1f;};'use strict';var Sequelize=require('sequelize');module[_0xcdbd('0x0')]={'name':{'type':Sequelize[_0xcdbd('0x1')],'allowNull':![],'unique':_0xcdbd('0x2')},'crudPermissions':{'type':Sequelize[_0xcdbd('0x1')],'set':function(_0x2db28c){this[_0xcdbd('0x3')](_0xcdbd('0x4'),_0x2db28c?_0x2db28c[_0xcdbd('0x5')](''):[]);},'get':function(){return this[_0xcdbd('0x6')](_0xcdbd('0x4'))?this[_0xcdbd('0x6')]('crudPermissions')[_0xcdbd('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xcdbd('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcdbd('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xcdbd('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcdbd('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcdbd('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 67edafd..2e2490c 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 _0x93e9=['../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','options','UserProfile','includeAll','include','rows','params','find','catch','create','body','clone','omit','createdAt','updatedAt','transaction','get','findAll','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','push','removeSections','ids','getSections','enabled','includes','subsections','Dashboard','UserProfileResource','forEach','resourceId','Plugin','addResources','sequelize','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3d8893,_0x324402){var _0x2adf49=function(_0x4f2be2){while(--_0x4f2be2){_0x3d8893['push'](_0x3d8893['shift']());}};_0x2adf49(++_0x324402);}(_0x93e9,0xcc));var _0x993e=function(_0x5bab26,_0x437a03){_0x5bab26=_0x5bab26-0x0;var _0x34e3f2=_0x93e9[_0x5bab26];return _0x34e3f2;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];config['redis']=_['defaults'](config[_0x993e('0x19')],{'host':_0x993e('0x1a'),'port':0x18eb});var socket=require(_0x993e('0x1b'))(new Redis(config[_0x993e('0x19')]));require(_0x993e('0x1c'))[_0x993e('0x1d')](socket);function respondWithStatusCode(_0x34ddda,_0x20f32a){_0x20f32a=_0x20f32a||0xcc;return function(_0x2a184b){if(_0x2a184b){return _0x34ddda[_0x993e('0x1e')](_0x20f32a);}return _0x34ddda[_0x993e('0x1f')](_0x20f32a)[_0x993e('0x20')]();};}function respondWithResult(_0x3df0e7,_0x125322){_0x125322=_0x125322||0xc8;return function(_0x1f267f){if(_0x1f267f){return _0x3df0e7[_0x993e('0x1f')](_0x125322)[_0x993e('0x21')](_0x1f267f);}};}function respondWithFilteredResult(_0x526e06,_0x22f7cc){return function(_0x1acd21){if(_0x1acd21){var _0x3cc2b9=typeof _0x22f7cc[_0x993e('0x22')]===_0x993e('0x23')&&typeof _0x22f7cc[_0x993e('0x24')]==='undefined';var _0x11cd41=_0x1acd21[_0x993e('0x25')];var _0x1eaf57=_0x3cc2b9?0x0:_0x22f7cc[_0x993e('0x22')];var _0x130a8a=_0x3cc2b9?_0x1acd21[_0x993e('0x25')]:_0x22f7cc[_0x993e('0x22')]+_0x22f7cc[_0x993e('0x24')];var _0x4bbe9c;if(_0x130a8a>=_0x11cd41){_0x130a8a=_0x11cd41;_0x4bbe9c=0xc8;}else{_0x4bbe9c=0xce;}_0x526e06[_0x993e('0x1f')](_0x4bbe9c);return _0x526e06['set'](_0x993e('0x26'),_0x1eaf57+'-'+_0x130a8a+'/'+_0x11cd41)[_0x993e('0x21')](_0x1acd21);}return null;};}function patchUpdates(_0x32b09e){return function(_0x5ba2a1){try{jsonpatch[_0x993e('0x27')](_0x5ba2a1,_0x32b09e,!![]);}catch(_0x13db4e){return BPromise[_0x993e('0x28')](_0x13db4e);}return _0x5ba2a1[_0x993e('0x29')]();};}function saveUpdates(_0x3b45ef,_0x328d22){return function(_0xa1c83e){if(_0xa1c83e){return _0xa1c83e[_0x993e('0x2a')](_0x3b45ef)[_0x993e('0x2b')](function(_0x18f6ac){return _0x18f6ac;});}return null;};}function removeEntity(_0x3fe099,_0x3603fa){return function(_0x4fe471){if(_0x4fe471){return _0x4fe471[_0x993e('0x2c')]()[_0x993e('0x2b')](function(){_0x3fe099['status'](0xcc)[_0x993e('0x20')]();});}};}function handleEntityNotFound(_0x4f5cc1,_0x14a0c7){return function(_0xa03fbd){if(!_0xa03fbd){_0x4f5cc1[_0x993e('0x1e')](0x194);}return _0xa03fbd;};}function handleError(_0x2ff973,_0x5c7507){_0x5c7507=_0x5c7507||0x1f4;return function(_0x48d457){logger[_0x993e('0x2d')](_0x48d457[_0x993e('0x2e')]);if(_0x48d457['name']){delete _0x48d457[_0x993e('0x2f')];}_0x2ff973[_0x993e('0x1f')](_0x5c7507)[_0x993e('0x30')](_0x48d457);};}exports['index']=function(_0x2495b7,_0x9e0309){var _0x1f5d51={},_0x1fa8a5={},_0x2599ec={'count':0x0,'rows':[]};var _0x54da4e=_[_0x993e('0x31')](db['UserProfile'][_0x993e('0x32')],function(_0x5ba163){return{'name':_0x5ba163[_0x993e('0x33')],'type':_0x5ba163['type'][_0x993e('0x34')]};});_0x1fa8a5[_0x993e('0x35')]=_[_0x993e('0x31')](_0x54da4e,_0x993e('0x2f'));_0x1fa8a5[_0x993e('0x36')]=_[_0x993e('0x37')](_0x2495b7['query']);_0x1fa8a5[_0x993e('0x38')]=_['intersection'](_0x1fa8a5['model'],_0x1fa8a5[_0x993e('0x36')]);_0x1f5d51['attributes']=_[_0x993e('0x39')](_0x1fa8a5[_0x993e('0x35')],qs[_0x993e('0x3a')](_0x2495b7[_0x993e('0x36')][_0x993e('0x3a')]));_0x1f5d51[_0x993e('0x3b')]=_0x1f5d51[_0x993e('0x3b')][_0x993e('0x3c')]?_0x1f5d51[_0x993e('0x3b')]:_0x1fa8a5[_0x993e('0x35')];if(!_0x2495b7[_0x993e('0x36')][_0x993e('0x3d')](_0x993e('0x3e'))){_0x1f5d51[_0x993e('0x24')]=qs[_0x993e('0x24')](_0x2495b7['query'][_0x993e('0x24')]);_0x1f5d51[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x2495b7[_0x993e('0x36')][_0x993e('0x22')]);}_0x1f5d51[_0x993e('0x3f')]=qs[_0x993e('0x40')](_0x2495b7[_0x993e('0x36')][_0x993e('0x40')]);_0x1f5d51['where']=qs[_0x993e('0x38')](_['pick'](_0x2495b7[_0x993e('0x36')],_0x1fa8a5[_0x993e('0x38')]),_0x54da4e);if(_0x2495b7[_0x993e('0x36')][_0x993e('0x41')]){_0x1f5d51[_0x993e('0x42')]=_[_0x993e('0x43')](_0x1f5d51[_0x993e('0x42')],{'$or':_[_0x993e('0x31')](_0x54da4e,function(_0x4f057e){if(_0x4f057e[_0x993e('0x44')]!=='VIRTUAL'){var _0x180ad4={};_0x180ad4[_0x4f057e['name']]={'$like':'%'+_0x2495b7[_0x993e('0x36')][_0x993e('0x41')]+'%'};return _0x180ad4;}})});}_0x1f5d51=_[_0x993e('0x43')]({},_0x1f5d51,_0x2495b7[_0x993e('0x45')]);var _0x39424a={'where':_0x1f5d51[_0x993e('0x42')]};return db[_0x993e('0x46')][_0x993e('0x25')](_0x39424a)['then'](function(_0xe64c){_0x2599ec['count']=_0xe64c;if(_0x2495b7['query'][_0x993e('0x47')]){_0x1f5d51[_0x993e('0x48')]=[{'all':!![]}];}return db[_0x993e('0x46')]['findAll'](_0x1f5d51);})[_0x993e('0x2b')](function(_0x40719d){_0x2599ec[_0x993e('0x49')]=_0x40719d;return _0x2599ec;})['then'](respondWithFilteredResult(_0x9e0309,_0x1f5d51))['catch'](handleError(_0x9e0309,null));};exports['show']=function(_0x3f29c8,_0x1adb09){var _0x254f74={'raw':![],'where':{'id':_0x3f29c8[_0x993e('0x4a')]['id']}},_0x539c9d={};_0x539c9d[_0x993e('0x35')]=_['keys'](db[_0x993e('0x46')][_0x993e('0x32')]);_0x539c9d['query']=_[_0x993e('0x37')](_0x3f29c8[_0x993e('0x36')]);_0x539c9d[_0x993e('0x38')]=_['intersection'](_0x539c9d['model'],_0x539c9d['query']);_0x254f74[_0x993e('0x3b')]=_[_0x993e('0x39')](_0x539c9d[_0x993e('0x35')],qs[_0x993e('0x3a')](_0x3f29c8['query'][_0x993e('0x3a')]));_0x254f74[_0x993e('0x3b')]=_0x254f74[_0x993e('0x3b')][_0x993e('0x3c')]?_0x254f74[_0x993e('0x3b')]:_0x539c9d[_0x993e('0x35')];if(_0x3f29c8['query']['includeAll']){_0x254f74[_0x993e('0x48')]=[{'all':!![]}];}_0x254f74=_[_0x993e('0x43')]({},_0x254f74,_0x3f29c8['options']);return db['UserProfile'][_0x993e('0x4b')](_0x254f74)[_0x993e('0x2b')](handleEntityNotFound(_0x1adb09,null))[_0x993e('0x2b')](respondWithResult(_0x1adb09,null))[_0x993e('0x4c')](handleError(_0x1adb09,null));};exports[_0x993e('0x4d')]=function(_0x256ce3,_0x5b18e3){return db[_0x993e('0x46')]['create'](_0x256ce3[_0x993e('0x4e')],{})[_0x993e('0x2b')](respondWithResult(_0x5b18e3,0xc9))[_0x993e('0x4c')](handleError(_0x5b18e3,null));};exports[_0x993e('0x4f')]=function(_0x2cba37,_0x276b99){var _0x1aeaa6={'where':{'id':_0x2cba37['params']['id']}},_0xa8ec7a={};_0xa8ec7a[_0x993e('0x35')]=_[_0x993e('0x37')](db[_0x993e('0x46')]['rawAttributes']);_0x1aeaa6[_0x993e('0x3b')]=_['intersection'](_0xa8ec7a[_0x993e('0x35')],qs[_0x993e('0x3a')](_0x2cba37['query'][_0x993e('0x3a')]));_0x1aeaa6[_0x993e('0x3b')]=_0x1aeaa6['attributes'][_0x993e('0x3c')]?_0x1aeaa6[_0x993e('0x3b')]:_0xa8ec7a[_0x993e('0x35')];if(_0x2cba37[_0x993e('0x36')][_0x993e('0x47')]){_0x1aeaa6['include']=[{'all':!![]}];}_0x1aeaa6=_['merge']({},_0x1aeaa6,_0x2cba37['options']);return db[_0x993e('0x46')][_0x993e('0x4b')](_0x1aeaa6)[_0x993e('0x2b')](handleEntityNotFound(_0x276b99,null))[_0x993e('0x2b')](function(_0x1f7813){if(_0x1f7813){var _0x2598ae=_0x1f7813['get']({'plain':!![]});_0x2598ae=qs[_0x993e('0x50')](_0x2598ae,['id',_0x993e('0x51'),_0x993e('0x52'),'crudPermissions']);_0x2cba37[_0x993e('0x4e')]=_['omit'](_0x2cba37['body'],['id',_0x993e('0x51'),_0x993e('0x52')]);return db['sequelize'][_0x993e('0x53')](function(_0x4f9f58){return db[_0x993e('0x46')][_0x993e('0x4d')](_['merge'](_0x2598ae,_0x2cba37['body']),{'include':_0x2cba37[_0x993e('0x36')][_0x993e('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x4f9f58})[_0x993e('0x2b')](function(_0x43b224){var _0xd04096=_0x43b224[_0x993e('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x993e('0x55')]({'where':{'userProfileId':_0x2cba37[_0x993e('0x4a')]['id']},'raw':!![]})['then'](function(_0xc2714a){if(_0xc2714a){return BPromise[_0x993e('0x56')](_0xc2714a,function(_0x1b2113){return new BPromise(function(_0x5ebaec,_0x426341){if(_0x1b2113[_0x993e('0x57')]===null||_0x1b2113[_0x993e('0x57')]===0x1)_0x5ebaec(null);return db['UserProfileResource'][_0x993e('0x55')]({'where':{'sectionId':_0x1b2113['id']},'raw':!![]})[_0x993e('0x2b')](function(_0x110a04){var _0x5f16d2=_['map'](_0x110a04,function(_0x53c68a){return qs[_0x993e('0x50')](_0x53c68a,['id',_0x993e('0x51'),_0x993e('0x52'),_0x993e('0x58')]);});_0x5ebaec(_0x5f16d2);})[_0x993e('0x4c')](function(_0x55a347){_0x426341(_0x55a347);});})[_0x993e('0x2b')](function(_0x1e020b){var _0x1344de=qs['omit'](_0x1b2113,['id',_0x993e('0x51'),_0x993e('0x52')]);_0x1344de[_0x993e('0x59')]=_0xd04096['id'];if(_0x1e020b)_0x1344de[_0x993e('0x5a')]=_0x1e020b;return _0x1344de;})['then'](function(_0x54417b){return db[_0x993e('0x5b')]['create'](_0x54417b,{'include':[{'model':db['UserProfileResource'],'as':_0x993e('0x5a')}],'raw':!![],'transaction':_0x4f9f58});});})[_0x993e('0x2b')](function(){return _0xd04096;});}});});});}})[_0x993e('0x2b')](respondWithResult(_0x276b99,0xc9))[_0x993e('0x4c')](handleError(_0x276b99,null));};exports[_0x993e('0x2a')]=function(_0x18ac12,_0x211204){if(_0x18ac12[_0x993e('0x4e')]['id']){delete _0x18ac12[_0x993e('0x4e')]['id'];}return db[_0x993e('0x46')][_0x993e('0x4b')]({'where':{'id':_0x18ac12[_0x993e('0x4a')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x211204,null))[_0x993e('0x2b')](saveUpdates(_0x18ac12[_0x993e('0x4e')],null))[_0x993e('0x2b')](respondWithResult(_0x211204,null))['catch'](handleError(_0x211204,null));};exports[_0x993e('0x2c')]=function(_0x1cbd37,_0x598e41){return db[_0x993e('0x46')]['find']({'where':{'id':_0x1cbd37[_0x993e('0x4a')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x598e41,null))[_0x993e('0x2b')](removeEntity(_0x598e41,null))['catch'](handleError(_0x598e41,null));};exports[_0x993e('0x5c')]=function(_0x5e9222,_0x5dca64){return db[_0x993e('0x46')][_0x993e('0x5c')]()[_0x993e('0x2b')](respondWithResult(_0x5dca64,null))[_0x993e('0x4c')](handleError(_0x5dca64,null));};exports[_0x993e('0x5d')]=function(_0x5194de,_0x120d51){var _0x418441=_0x5194de[_0x993e('0x4e')];return db['UserProfile'][_0x993e('0x4b')]({'where':{'id':_0x5194de['params']['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x120d51,null))[_0x993e('0x2b')](function(_0x42288d){if(_0x42288d){return db['sequelize'][_0x993e('0x53')](function(_0x3455b2){return db[_0x993e('0x5b')][_0x993e('0x2c')]({'where':{'userProfileId':_0x5194de[_0x993e('0x4a')]['id'],'sectionId':_[_0x993e('0x31')](_0x418441,function(_0x108cad){return _0x108cad[_0x993e('0x58')];})},'transaction':_0x3455b2})[_0x993e('0x2b')](function(){var _0xec4000=_['map'](_0x418441,function(_0x188d38){_0x188d38[_0x993e('0x59')]=_0x5194de[_0x993e('0x4a')]['id'];return _0x188d38;});var _0x23244b=[];return BPromise[_0x993e('0x56')](_0xec4000,function(_0x1a155b){return db[_0x993e('0x5b')][_0x993e('0x4d')](_0x1a155b,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x3455b2})[_0x993e('0x2b')](function(_0x5123cf){_0x23244b[_0x993e('0x5e')](_0x5123cf[_0x993e('0x54')]({'plain':!![]}));});})[_0x993e('0x2b')](function(){return _0x23244b;});});});}})['then'](function(_0x2bf739){return _0x2bf739;})['then'](respondWithResult(_0x120d51,null))[_0x993e('0x4c')](handleError(_0x120d51,null));};exports[_0x993e('0x5f')]=function(_0x8a951a,_0x40768a){var _0x9ff2b5;return db[_0x993e('0x46')][_0x993e('0x4b')]({'where':{'id':_0x8a951a[_0x993e('0x4a')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x40768a,null))[_0x993e('0x2b')](function(_0x5a70ff){if(_0x5a70ff){_0x9ff2b5=_0x5a70ff;return db[_0x993e('0x5b')][_0x993e('0x2c')]({'where':{'userProfileId':_0x8a951a[_0x993e('0x4a')]['id'],'sectionId':_0x8a951a[_0x993e('0x36')][_0x993e('0x60')]}});}})[_0x993e('0x2b')](function(){return _0x9ff2b5;})[_0x993e('0x2b')](respondWithStatusCode(_0x40768a,null))[_0x993e('0x4c')](handleError(_0x40768a,null));};exports[_0x993e('0x61')]=function(_0xca7c33,_0x4b4514){var _0x168bc0=[];var _0x14347f=[];return db['UserProfileSection'][_0x993e('0x55')]({'where':{'userProfileId':_0xca7c33[_0x993e('0x4a')]['id']},'raw':!![]})[_0x993e('0x2b')](function(_0xa143b){_0x168bc0=_[_0x993e('0x41')](_0xa143b,function(_0x24a12c){return _0x24a12c[_0x993e('0x62')]===0x1||_[_0x993e('0x63')]([0x3eb,0x709],_0x24a12c[_0x993e('0x58')]);});if(!_['isEmpty'](_0x168bc0)){return _[_0x993e('0x31')](_0x168bc0,function(_0x1b9add){return _0x1b9add[_0x993e('0x58')];});}else{return;}})[_0x993e('0x2b')](function(_0x53ce16){if(_0x53ce16)_0x14347f=_0x53ce16;if(_['includes'](_0x14347f,0x64)){var _0x35ad1b=_['find'](_0x168bc0,{'sectionId':0x64});return hasDefaultDashboard(_0x35ad1b)[_0x993e('0x2b')](function(_0xec52b){return _[_0x993e('0x31')](_0x168bc0,function(_0x2a24aa){if(_0x2a24aa[_0x993e('0x58')]===0x64){_0x2a24aa[_0x993e('0x64')]=_0xec52b;}return _0x2a24aa;});});}else{return;}})[_0x993e('0x2b')](function(_0x22dd6b){if(_0x22dd6b)_0x168bc0=_0x22dd6b;if(_[_0x993e('0x63')](_0x14347f,0x3eb)){var _0x13a047=_['find'](_0x168bc0,{'sectionId':0x3eb});return getCustomDashboards(_0x13a047)[_0x993e('0x2b')](function(_0x3d28d3){return _[_0x993e('0x31')](_0x168bc0,function(_0x278c2a){if(_0x13a047[_0x993e('0x62')]){if(_0x278c2a[_0x993e('0x58')]===0x3eb){_0x278c2a[_0x993e('0x64')]=_0x3d28d3;}}else{if(_0x278c2a['sectionId']===0x64){_0x278c2a['subsections']=_0x3d28d3;}}return _0x278c2a;});});}else{return;}})[_0x993e('0x2b')](function(_0x38f02d){if(_0x38f02d)_0x168bc0=_0x38f02d;if(_[_0x993e('0x63')](_0x14347f,0x709)){var _0x383c54=_[_0x993e('0x4b')](_0x168bc0,{'sectionId':0x709});return getPlugins(_0x383c54)['then'](function(_0x5a3c42){if(_0x383c54['enabled']){return _[_0x993e('0x31')](_0x168bc0,function(_0x2edae0){if(_0x2edae0[_0x993e('0x58')]===0x709){_0x2edae0[_0x993e('0x64')]=_0x5a3c42;}return _0x2edae0;});}else{var _0x26cb50={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5a3c42};var _0x5b7951=_[_0x993e('0x31')](_0x168bc0);_0x5b7951[_0x993e('0x5e')](_0x26cb50);return _0x5b7951;}});}else{return;}})[_0x993e('0x2b')](function(_0x59ed7a){if(_0x59ed7a)_0x168bc0=_0x59ed7a;return _[_0x993e('0x41')](_0x168bc0,[_0x993e('0x62'),0x1]);})[_0x993e('0x2b')](respondWithResult(_0x4b4514,null))[_0x993e('0x4c')](handleError(_0x4b4514,null));};function hasDefaultDashboard(_0xc6cf93){var _0x19dad2=[0x65];return new BPromise(function(_0x4b1810,_0x3e765a){try{if(_0xc6cf93['autoAssociation']){_0x4b1810(_0x19dad2);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0xc6cf93['id']},'raw':!![]})['then'](function(_0x23b2a9){_0x23b2a9?_0x4b1810(_0x19dad2):_0x4b1810();});}}catch(_0x2276a1){_0x3e765a(_0x2276a1);}});}function getCustomDashboards(_0x110032){var _0xd1b14e=[];return new BPromise(function(_0x1e9b85,_0x1c9733){try{if(_0x110032[_0x993e('0x57')]){return db[_0x993e('0x65')][_0x993e('0x55')]({'raw':!![]})['then'](function(_0x1c2b5f){_0x1c2b5f['forEach'](function(_0x2cae0f){_0xd1b14e[_0x993e('0x5e')](_0x2cae0f['id']+0x1869f);});_0x1e9b85(_0xd1b14e);});}else{return db[_0x993e('0x66')][_0x993e('0x55')]({'where':{'sectionId':_0x110032['id']},'raw':!![]})[_0x993e('0x2b')](function(_0x9ed82b){_0x9ed82b[_0x993e('0x67')](function(_0x5aaf3b){_0xd1b14e[_0x993e('0x5e')](_0x5aaf3b[_0x993e('0x68')]+0x1869f);});_0x1e9b85(_0xd1b14e);});}}catch(_0x285c93){_0x1c9733(_0x285c93);}});}function getPlugins(_0x49302e){var _0x1157ea=[];return new BPromise(function(_0x23d82e,_0x1528c0){try{if(_0x49302e['autoAssociation']){return db[_0x993e('0x69')][_0x993e('0x55')]({'raw':!![]})[_0x993e('0x2b')](function(_0x34e85b){_0x34e85b[_0x993e('0x67')](function(_0x20ca03){_0x1157ea[_0x993e('0x5e')](_0x20ca03['id']+0x15b38);});_0x23d82e(_0x1157ea);});}else{return db[_0x993e('0x66')]['findAll']({'where':{'sectionId':_0x49302e['id']},'raw':!![]})[_0x993e('0x2b')](function(_0x561589){_0x561589[_0x993e('0x67')](function(_0xc2ecae){_0x1157ea[_0x993e('0x5e')](_0xc2ecae['resourceId']+0x15b38);});_0x23d82e(_0x1157ea);});}}catch(_0x4e2ccf){_0x1528c0(_0x4e2ccf);}});}exports[_0x993e('0x6a')]=function(_0x31e947,_0x7800d4){return db['UserProfile'][_0x993e('0x4b')]({'where':{'id':_0x31e947[_0x993e('0x4a')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x7800d4,null))[_0x993e('0x2b')](function(_0x5ec605){if(_0x5ec605){return db[_0x993e('0x6b')]['transaction'](function(_0x40dfde){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x31e947[_0x993e('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x993e('0x2b')](function(_0x43c538){if(_0x43c538){return db[_0x993e('0x5b')]['destroy']({'where':{'userProfileId':_0x31e947['params']['id'],'id':_['map'](_0x43c538,function(_0x1f6596){return _0x1f6596['id'];})},'transaction':_0x40dfde});}})['then'](function(_0x3bce82){var _0x11ffb2=_[_0x993e('0x31')](_0x31e947[_0x993e('0x4e')],function(_0x3d4ebf){_0x3d4ebf['userProfileId']=_0x31e947[_0x993e('0x4a')]['id'];return _0x3d4ebf;});return db[_0x993e('0x5b')]['bulkCreate'](_0x11ffb2,{'raw':!![],'transaction':_0x40dfde});})[_0x993e('0x2b')](function(_0x4d2739){var _0x8ab4ed=_[_0x993e('0x41')](_[_0x993e('0x31')](_0x4d2739,function(_0x2bcdc8){return _0x2bcdc8[_0x993e('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x8ab4ed){return db[_0x993e('0x5b')][_0x993e('0x55')]({'where':{'userProfileId':_0x31e947[_0x993e('0x4a')]['id'],'sectionId':_[_0x993e('0x31')](_0x8ab4ed,function(_0x4d23d1){return _0x4d23d1[_0x993e('0x58')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x993e('0x2b')](function(_0x23973e){var _0x50dd66=_['map'](_0x31e947[_0x993e('0x4e')],function(_0x3fd160){_0x3fd160['userProfileId']=_0x31e947[_0x993e('0x4a')]['id'];return _0x3fd160;});return db[_0x993e('0x66')][_0x993e('0x6c')](_0x50dd66,{'raw':!![],'transaction':_0x40dfde});});}})[_0x993e('0x4c')](handleError(_0x7800d4,null));});}})['then'](function(_0x1abd59){var _0x1b5408=_[_0x993e('0x31')](_0x1abd59,function(_0x2b800a){return _0x2b800a[_0x993e('0x54')]({'plain':!![]});});})['then'](respondWithResult(_0x7800d4,null))[_0x993e('0x4c')](handleError(_0x7800d4,null));};exports[_0x993e('0x6d')]=function(_0x2518bb,_0x134482,_0x17d6fa){return db[_0x993e('0x46')][_0x993e('0x4b')]({'where':{'id':_0x2518bb['params']['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x134482,null))['then'](function(_0x3b940e){if(_0x3b940e){return _0x3b940e[_0x993e('0x6d')](_0x2518bb['query'][_0x993e('0x60')]);}})[_0x993e('0x2b')](respondWithStatusCode(_0x134482,null))['catch'](handleError(_0x134482,null));};exports[_0x993e('0x6e')]=function(_0x371be2,_0x5c2ba3){var _0x19d402={};if(!_0x371be2[_0x993e('0x36')][_0x993e('0x6f')])throw new Error(_0x993e('0x70'));if(!_0x371be2['query'][_0x993e('0x3d')]('nolimit')){_0x19d402[_0x993e('0x24')]=qs['limit'](_0x371be2[_0x993e('0x36')][_0x993e('0x24')]);_0x19d402[_0x993e('0x22')]=qs['offset'](_0x371be2['query'][_0x993e('0x22')]);}return db[_0x993e('0x46')][_0x993e('0x4b')]({'where':{'id':_0x371be2[_0x993e('0x4a')]['id']}})['then'](function(_0x37409f){if(!_0x37409f)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x371be2[_0x993e('0x4a')]['id']);return db[_0x993e('0x46')][_0x993e('0x6e')](_0x371be2);})['then'](respondWithFilteredResult(_0x5c2ba3,_0x19d402))[_0x993e('0x4c')](handleError(_0x5c2ba3,null));}; \ No newline at end of file +var _0x84c6=['addResources','bulkCreate','removeResources','getResources','section','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','UserProfile','findAll','rows','catch','params','keys','includeAll','include','find','create','get','createdAt','updatedAt','crudPermissions','body','omit','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','describe','addSections','transaction','Resources','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','Plugin','resourceId'];(function(_0xcb19e1,_0x465489){var _0x121872=function(_0x5c9cd1){while(--_0x5c9cd1){_0xcb19e1['push'](_0xcb19e1['shift']());}};_0x121872(++_0x465489);}(_0x84c6,0xe7));var _0x684c=function(_0x405b23,_0x2fb7c6){_0x405b23=_0x405b23-0x0;var _0x2270b0=_0x84c6[_0x405b23];return _0x2270b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x684c('0x0'));var jsonpatch=require(_0x684c('0x1'));var rp=require(_0x684c('0x2'));var moment=require('moment');var BPromise=require(_0x684c('0x3'));var Mustache=require('mustache');var util=require(_0x684c('0x4'));var path=require(_0x684c('0x5'));var sox=require(_0x684c('0x6'));var csv=require(_0x684c('0x7'));var ejs=require(_0x684c('0x8'));var fs=require('fs');var fs_extra=require(_0x684c('0x9'));var _=require(_0x684c('0xa'));var squel=require(_0x684c('0xb'));var crypto=require(_0x684c('0xc'));var jsforce=require(_0x684c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x684c('0x7'));var querystring=require(_0x684c('0xe'));var Papa=require('papaparse');var Redis=require(_0x684c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x684c('0x10'));var as=require(_0x684c('0x11'));var hardwareService=require(_0x684c('0x12'));var logger=require(_0x684c('0x13'))(_0x684c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x684c('0x15'));var db=require('../../mysqldb')['db'];config[_0x684c('0x16')]=_[_0x684c('0x17')](config[_0x684c('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x684c('0x18'))(new Redis(config['redis']));require(_0x684c('0x19'))[_0x684c('0x1a')](socket);function respondWithStatusCode(_0x4e6a97,_0x12b881){_0x12b881=_0x12b881||0xcc;return function(_0x329a6d){if(_0x329a6d){return _0x4e6a97[_0x684c('0x1b')](_0x12b881);}return _0x4e6a97[_0x684c('0x1c')](_0x12b881)[_0x684c('0x1d')]();};}function respondWithResult(_0x319df7,_0x5cf7c8){_0x5cf7c8=_0x5cf7c8||0xc8;return function(_0x41b04b){if(_0x41b04b){return _0x319df7['status'](_0x5cf7c8)['json'](_0x41b04b);}};}function respondWithFilteredResult(_0xaae9f4,_0xf94e28){return function(_0x421404){if(_0x421404){var _0x1dc55d=typeof _0xf94e28[_0x684c('0x1e')]==='undefined'&&typeof _0xf94e28[_0x684c('0x1f')]==='undefined';var _0x527731=_0x421404[_0x684c('0x20')];var _0x5afd17=_0x1dc55d?0x0:_0xf94e28[_0x684c('0x1e')];var _0x584c42=_0x1dc55d?_0x421404[_0x684c('0x20')]:_0xf94e28[_0x684c('0x1e')]+_0xf94e28[_0x684c('0x1f')];var _0x4cfeff;if(_0x584c42>=_0x527731){_0x584c42=_0x527731;_0x4cfeff=0xc8;}else{_0x4cfeff=0xce;}_0xaae9f4[_0x684c('0x1c')](_0x4cfeff);return _0xaae9f4[_0x684c('0x21')](_0x684c('0x22'),_0x5afd17+'-'+_0x584c42+'/'+_0x527731)[_0x684c('0x23')](_0x421404);}return null;};}function patchUpdates(_0x389f81){return function(_0x5060cc){try{jsonpatch[_0x684c('0x24')](_0x5060cc,_0x389f81,!![]);}catch(_0x281592){return BPromise[_0x684c('0x25')](_0x281592);}return _0x5060cc[_0x684c('0x26')]();};}function saveUpdates(_0x33524a,_0x646ee4){return function(_0x5e58e2){if(_0x5e58e2){return _0x5e58e2[_0x684c('0x27')](_0x33524a)[_0x684c('0x28')](function(_0x1962a0){return _0x1962a0;});}return null;};}function removeEntity(_0x3be964,_0xddd459){return function(_0xfa7426){if(_0xfa7426){return _0xfa7426[_0x684c('0x29')]()[_0x684c('0x28')](function(){_0x3be964[_0x684c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55194f,_0x59ac0a){return function(_0x1d3445){if(!_0x1d3445){_0x55194f[_0x684c('0x1b')](0x194);}return _0x1d3445;};}function handleError(_0xeb1c0e,_0xa56b8e){_0xa56b8e=_0xa56b8e||0x1f4;return function(_0x5d8bf9){logger[_0x684c('0x2a')](_0x5d8bf9['stack']);if(_0x5d8bf9[_0x684c('0x2b')]){delete _0x5d8bf9['name'];}_0xeb1c0e[_0x684c('0x1c')](_0xa56b8e)[_0x684c('0x2c')](_0x5d8bf9);};}exports[_0x684c('0x2d')]=function(_0x4e995d,_0x2420d5){var _0x7b3900={},_0x5dedcb={},_0xadb242={'count':0x0,'rows':[]};var _0x1a944b=_[_0x684c('0x2e')](db['UserProfile'][_0x684c('0x2f')],function(_0x2d40c6){return{'name':_0x2d40c6[_0x684c('0x30')],'type':_0x2d40c6[_0x684c('0x31')]['key']};});_0x5dedcb[_0x684c('0x32')]=_[_0x684c('0x2e')](_0x1a944b,_0x684c('0x2b'));_0x5dedcb[_0x684c('0x33')]=_['keys'](_0x4e995d[_0x684c('0x33')]);_0x5dedcb['filters']=_[_0x684c('0x34')](_0x5dedcb[_0x684c('0x32')],_0x5dedcb[_0x684c('0x33')]);_0x7b3900['attributes']=_[_0x684c('0x34')](_0x5dedcb[_0x684c('0x32')],qs[_0x684c('0x35')](_0x4e995d[_0x684c('0x33')][_0x684c('0x35')]));_0x7b3900[_0x684c('0x36')]=_0x7b3900[_0x684c('0x36')][_0x684c('0x37')]?_0x7b3900[_0x684c('0x36')]:_0x5dedcb[_0x684c('0x32')];if(!_0x4e995d[_0x684c('0x33')][_0x684c('0x38')]('nolimit')){_0x7b3900[_0x684c('0x1f')]=qs['limit'](_0x4e995d[_0x684c('0x33')]['limit']);_0x7b3900[_0x684c('0x1e')]=qs['offset'](_0x4e995d[_0x684c('0x33')]['offset']);}_0x7b3900[_0x684c('0x39')]=qs['sort'](_0x4e995d[_0x684c('0x33')][_0x684c('0x3a')]);_0x7b3900[_0x684c('0x3b')]=qs[_0x684c('0x3c')](_[_0x684c('0x3d')](_0x4e995d[_0x684c('0x33')],_0x5dedcb[_0x684c('0x3c')]),_0x1a944b);if(_0x4e995d[_0x684c('0x33')][_0x684c('0x3e')]){_0x7b3900[_0x684c('0x3b')]=_['merge'](_0x7b3900[_0x684c('0x3b')],{'$or':_['map'](_0x1a944b,function(_0xc78730){if(_0xc78730[_0x684c('0x31')]!=='VIRTUAL'){var _0x4c5cd7={};_0x4c5cd7[_0xc78730[_0x684c('0x2b')]]={'$like':'%'+_0x4e995d[_0x684c('0x33')][_0x684c('0x3e')]+'%'};return _0x4c5cd7;}})});}_0x7b3900=_[_0x684c('0x3f')]({},_0x7b3900,_0x4e995d[_0x684c('0x40')]);var _0x32250a={'where':_0x7b3900[_0x684c('0x3b')]};return db['UserProfile'][_0x684c('0x20')](_0x32250a)[_0x684c('0x28')](function(_0x2a37b0){_0xadb242[_0x684c('0x20')]=_0x2a37b0;if(_0x4e995d['query']['includeAll']){_0x7b3900['include']=[{'all':!![]}];}return db[_0x684c('0x41')][_0x684c('0x42')](_0x7b3900);})[_0x684c('0x28')](function(_0x146994){_0xadb242[_0x684c('0x43')]=_0x146994;return _0xadb242;})['then'](respondWithFilteredResult(_0x2420d5,_0x7b3900))[_0x684c('0x44')](handleError(_0x2420d5,null));};exports['show']=function(_0xd5f115,_0x6ec8ce){var _0x4d3be3={'raw':![],'where':{'id':_0xd5f115[_0x684c('0x45')]['id']}},_0x4fba4a={};_0x4fba4a['model']=_['keys'](db[_0x684c('0x41')][_0x684c('0x2f')]);_0x4fba4a[_0x684c('0x33')]=_[_0x684c('0x46')](_0xd5f115['query']);_0x4fba4a['filters']=_[_0x684c('0x34')](_0x4fba4a['model'],_0x4fba4a['query']);_0x4d3be3[_0x684c('0x36')]=_[_0x684c('0x34')](_0x4fba4a[_0x684c('0x32')],qs[_0x684c('0x35')](_0xd5f115[_0x684c('0x33')][_0x684c('0x35')]));_0x4d3be3[_0x684c('0x36')]=_0x4d3be3[_0x684c('0x36')][_0x684c('0x37')]?_0x4d3be3[_0x684c('0x36')]:_0x4fba4a[_0x684c('0x32')];if(_0xd5f115['query'][_0x684c('0x47')]){_0x4d3be3[_0x684c('0x48')]=[{'all':!![]}];}_0x4d3be3=_[_0x684c('0x3f')]({},_0x4d3be3,_0xd5f115['options']);return db['UserProfile'][_0x684c('0x49')](_0x4d3be3)[_0x684c('0x28')](handleEntityNotFound(_0x6ec8ce,null))[_0x684c('0x28')](respondWithResult(_0x6ec8ce,null))[_0x684c('0x44')](handleError(_0x6ec8ce,null));};exports[_0x684c('0x4a')]=function(_0x3c51af,_0x548479){return db[_0x684c('0x41')][_0x684c('0x4a')](_0x3c51af['body'],{})[_0x684c('0x28')](respondWithResult(_0x548479,0xc9))[_0x684c('0x44')](handleError(_0x548479,null));};exports['clone']=function(_0xcb6105,_0x40eed8){var _0x205227={'where':{'id':_0xcb6105[_0x684c('0x45')]['id']}},_0xfb5cf7={};_0xfb5cf7[_0x684c('0x32')]=_[_0x684c('0x46')](db['UserProfile'][_0x684c('0x2f')]);_0x205227[_0x684c('0x36')]=_[_0x684c('0x34')](_0xfb5cf7[_0x684c('0x32')],qs['fields'](_0xcb6105[_0x684c('0x33')][_0x684c('0x35')]));_0x205227[_0x684c('0x36')]=_0x205227[_0x684c('0x36')]['length']?_0x205227[_0x684c('0x36')]:_0xfb5cf7[_0x684c('0x32')];if(_0xcb6105[_0x684c('0x33')][_0x684c('0x47')]){_0x205227['include']=[{'all':!![]}];}_0x205227=_[_0x684c('0x3f')]({},_0x205227,_0xcb6105[_0x684c('0x40')]);return db[_0x684c('0x41')]['find'](_0x205227)['then'](handleEntityNotFound(_0x40eed8,null))[_0x684c('0x28')](function(_0x45a05d){if(_0x45a05d){var _0x4df769=_0x45a05d[_0x684c('0x4b')]({'plain':!![]});_0x4df769=qs['omit'](_0x4df769,['id',_0x684c('0x4c'),_0x684c('0x4d'),_0x684c('0x4e')]);_0xcb6105[_0x684c('0x4f')]=_[_0x684c('0x50')](_0xcb6105['body'],['id',_0x684c('0x4c'),_0x684c('0x4d')]);return db[_0x684c('0x51')]['transaction'](function(_0xc15f76){return db[_0x684c('0x41')][_0x684c('0x4a')](_[_0x684c('0x3f')](_0x4df769,_0xcb6105[_0x684c('0x4f')]),{'include':_0xcb6105[_0x684c('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0xc15f76})[_0x684c('0x28')](function(_0x205ca0){var _0x5f19c8=_0x205ca0[_0x684c('0x4b')]({'plain':!![]});return db[_0x684c('0x52')][_0x684c('0x42')]({'where':{'userProfileId':_0xcb6105[_0x684c('0x45')]['id']},'raw':!![]})['then'](function(_0x143ba5){if(_0x143ba5){return BPromise[_0x684c('0x53')](_0x143ba5,function(_0x202ba5){return new BPromise(function(_0x47e75f,_0x490800){if(_0x202ba5[_0x684c('0x54')]===null||_0x202ba5[_0x684c('0x54')]===0x1)_0x47e75f(null);return db[_0x684c('0x55')][_0x684c('0x42')]({'where':{'sectionId':_0x202ba5['id']},'raw':!![]})[_0x684c('0x28')](function(_0x5e963d){var _0x819ba4=_[_0x684c('0x2e')](_0x5e963d,function(_0x2c462c){return qs[_0x684c('0x50')](_0x2c462c,['id',_0x684c('0x4c'),_0x684c('0x4d'),_0x684c('0x56')]);});_0x47e75f(_0x819ba4);})[_0x684c('0x44')](function(_0x5d746c){_0x490800(_0x5d746c);});})[_0x684c('0x28')](function(_0x74dc34){var _0x2ea3a4=qs['omit'](_0x202ba5,['id',_0x684c('0x4c'),_0x684c('0x4d')]);_0x2ea3a4[_0x684c('0x57')]=_0x5f19c8['id'];if(_0x74dc34)_0x2ea3a4['Resources']=_0x74dc34;return _0x2ea3a4;})[_0x684c('0x28')](function(_0x34eb38){return db[_0x684c('0x52')][_0x684c('0x4a')](_0x34eb38,{'include':[{'model':db[_0x684c('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0xc15f76});});})[_0x684c('0x28')](function(){return _0x5f19c8;});}});});});}})['then'](respondWithResult(_0x40eed8,0xc9))[_0x684c('0x44')](handleError(_0x40eed8,null));};exports['update']=function(_0x3139d6,_0x546fea){if(_0x3139d6[_0x684c('0x4f')]['id']){delete _0x3139d6[_0x684c('0x4f')]['id'];}return db[_0x684c('0x41')][_0x684c('0x49')]({'where':{'id':_0x3139d6['params']['id']}})['then'](handleEntityNotFound(_0x546fea,null))[_0x684c('0x28')](saveUpdates(_0x3139d6[_0x684c('0x4f')],null))['then'](respondWithResult(_0x546fea,null))['catch'](handleError(_0x546fea,null));};exports[_0x684c('0x29')]=function(_0x227c79,_0x4abf84){return db[_0x684c('0x41')][_0x684c('0x49')]({'where':{'id':_0x227c79[_0x684c('0x45')]['id']}})[_0x684c('0x28')](handleEntityNotFound(_0x4abf84,null))['then'](removeEntity(_0x4abf84,null))[_0x684c('0x44')](handleError(_0x4abf84,null));};exports[_0x684c('0x58')]=function(_0x45eecc,_0x202ad5){return db[_0x684c('0x41')][_0x684c('0x58')]()[_0x684c('0x28')](respondWithResult(_0x202ad5,null))['catch'](handleError(_0x202ad5,null));};exports[_0x684c('0x59')]=function(_0x45a1dd,_0x44e1b0){var _0x2b904c=_0x45a1dd['body'];return db[_0x684c('0x41')][_0x684c('0x49')]({'where':{'id':_0x45a1dd[_0x684c('0x45')]['id']}})['then'](handleEntityNotFound(_0x44e1b0,null))[_0x684c('0x28')](function(_0x297c3c){if(_0x297c3c){return db[_0x684c('0x51')][_0x684c('0x5a')](function(_0xa1d4e8){return db[_0x684c('0x52')][_0x684c('0x29')]({'where':{'userProfileId':_0x45a1dd[_0x684c('0x45')]['id'],'sectionId':_[_0x684c('0x2e')](_0x2b904c,function(_0x310e1e){return _0x310e1e['sectionId'];})},'transaction':_0xa1d4e8})[_0x684c('0x28')](function(){var _0x465da7=_[_0x684c('0x2e')](_0x2b904c,function(_0x44e0ea){_0x44e0ea['userProfileId']=_0x45a1dd[_0x684c('0x45')]['id'];return _0x44e0ea;});var _0x36755c=[];return BPromise[_0x684c('0x53')](_0x465da7,function(_0x2490b8){return db['UserProfileSection']['create'](_0x2490b8,{'include':[{'model':db[_0x684c('0x55')],'as':_0x684c('0x5b')}],'raw':!![],'transaction':_0xa1d4e8})['then'](function(_0x45287a){_0x36755c[_0x684c('0x5c')](_0x45287a[_0x684c('0x4b')]({'plain':!![]}));});})[_0x684c('0x28')](function(){return _0x36755c;});});});}})[_0x684c('0x28')](function(_0x6d1dcf){return _0x6d1dcf;})[_0x684c('0x28')](respondWithResult(_0x44e1b0,null))[_0x684c('0x44')](handleError(_0x44e1b0,null));};exports[_0x684c('0x5d')]=function(_0x661aee,_0x46d432){var _0x3fef4a;return db[_0x684c('0x41')][_0x684c('0x49')]({'where':{'id':_0x661aee[_0x684c('0x45')]['id']},'attributes':['id',_0x684c('0x2b')]})[_0x684c('0x28')](handleEntityNotFound(_0x46d432,null))['then'](function(_0x832a37){if(_0x832a37){_0x3fef4a=_0x832a37;return db[_0x684c('0x52')]['destroy']({'where':{'userProfileId':_0x661aee[_0x684c('0x45')]['id'],'sectionId':_0x661aee[_0x684c('0x33')][_0x684c('0x5e')]}});}})[_0x684c('0x28')](function(){return _0x3fef4a;})[_0x684c('0x28')](respondWithStatusCode(_0x46d432,null))[_0x684c('0x44')](handleError(_0x46d432,null));};exports[_0x684c('0x5f')]=function(_0x28eb8a,_0x309c67){var _0x3681c9=[];var _0x1247b6=[];return db['UserProfileSection'][_0x684c('0x42')]({'where':{'userProfileId':_0x28eb8a[_0x684c('0x45')]['id']},'raw':!![]})[_0x684c('0x28')](function(_0x39084c){_0x3681c9=_['filter'](_0x39084c,function(_0x463ae7){return _0x463ae7[_0x684c('0x60')]===0x1||_[_0x684c('0x61')]([0x3eb,0x709],_0x463ae7['sectionId']);});if(!_[_0x684c('0x62')](_0x3681c9)){return _[_0x684c('0x2e')](_0x3681c9,function(_0xf4291f){return _0xf4291f[_0x684c('0x56')];});}else{return;}})[_0x684c('0x28')](function(_0x4c61bd){if(_0x4c61bd)_0x1247b6=_0x4c61bd;if(_[_0x684c('0x61')](_0x1247b6,0x64)){var _0x43c268=_['find'](_0x3681c9,{'sectionId':0x64});return hasDefaultDashboard(_0x43c268)['then'](function(_0x331262){return _[_0x684c('0x2e')](_0x3681c9,function(_0x5c5a52){if(_0x5c5a52['sectionId']===0x64){_0x5c5a52[_0x684c('0x63')]=_0x331262;}return _0x5c5a52;});});}else{return;}})[_0x684c('0x28')](function(_0x2ca21a){if(_0x2ca21a)_0x3681c9=_0x2ca21a;if(_[_0x684c('0x61')](_0x1247b6,0x3eb)){var _0x2092b4=_[_0x684c('0x49')](_0x3681c9,{'sectionId':0x3eb});return getCustomDashboards(_0x2092b4)[_0x684c('0x28')](function(_0x18b53d){return _['map'](_0x3681c9,function(_0x3e944f){if(_0x2092b4[_0x684c('0x60')]){if(_0x3e944f[_0x684c('0x56')]===0x3eb){_0x3e944f[_0x684c('0x63')]=_0x18b53d;}}else{if(_0x3e944f[_0x684c('0x56')]===0x64){_0x3e944f[_0x684c('0x63')]=_0x18b53d;}}return _0x3e944f;});});}else{return;}})['then'](function(_0x5a816c){if(_0x5a816c)_0x3681c9=_0x5a816c;if(_['includes'](_0x1247b6,0x709)){var _0x2e3029=_[_0x684c('0x49')](_0x3681c9,{'sectionId':0x709});return getPlugins(_0x2e3029)[_0x684c('0x28')](function(_0xa1e2b2){if(_0x2e3029['enabled']){return _[_0x684c('0x2e')](_0x3681c9,function(_0x35d1d0){if(_0x35d1d0['sectionId']===0x709){_0x35d1d0['subsections']=_0xa1e2b2;}return _0x35d1d0;});}else{var _0x12edbe={'sectionId':0x76c,'enabled':0x1,'subsections':_0xa1e2b2};var _0xe44382=_[_0x684c('0x2e')](_0x3681c9);_0xe44382[_0x684c('0x5c')](_0x12edbe);return _0xe44382;}});}else{return;}})[_0x684c('0x28')](function(_0x41ed18){if(_0x41ed18)_0x3681c9=_0x41ed18;return _[_0x684c('0x3e')](_0x3681c9,[_0x684c('0x60'),0x1]);})[_0x684c('0x28')](respondWithResult(_0x309c67,null))[_0x684c('0x44')](handleError(_0x309c67,null));};function hasDefaultDashboard(_0x1abba5){var _0x2804b4=[0x65];return new BPromise(function(_0x4b3c80,_0x2c0552){try{if(_0x1abba5[_0x684c('0x54')]){_0x4b3c80(_0x2804b4);}else{return db[_0x684c('0x55')][_0x684c('0x64')]({'where':{'sectionId':_0x1abba5['id']},'raw':!![]})['then'](function(_0x3b0890){_0x3b0890?_0x4b3c80(_0x2804b4):_0x4b3c80();});}}catch(_0x4b660a){_0x2c0552(_0x4b660a);}});}function getCustomDashboards(_0x2c3c88){var _0x157259=[];return new BPromise(function(_0x27d558,_0x366380){try{if(_0x2c3c88[_0x684c('0x54')]){return db[_0x684c('0x65')][_0x684c('0x42')]({'raw':!![]})[_0x684c('0x28')](function(_0x5dfb11){_0x5dfb11[_0x684c('0x66')](function(_0x129d97){_0x157259['push'](_0x129d97['id']+0x1869f);});_0x27d558(_0x157259);});}else{return db[_0x684c('0x55')][_0x684c('0x42')]({'where':{'sectionId':_0x2c3c88['id']},'raw':!![]})[_0x684c('0x28')](function(_0x134f52){_0x134f52['forEach'](function(_0x5bda8c){_0x157259[_0x684c('0x5c')](_0x5bda8c['resourceId']+0x1869f);});_0x27d558(_0x157259);});}}catch(_0x25a9f3){_0x366380(_0x25a9f3);}});}function getPlugins(_0x260b9e){var _0x5a9705=[];return new BPromise(function(_0x118b64,_0x4d35d5){try{if(_0x260b9e['autoAssociation']){return db[_0x684c('0x67')][_0x684c('0x42')]({'raw':!![]})[_0x684c('0x28')](function(_0x22e970){_0x22e970['forEach'](function(_0x430688){_0x5a9705[_0x684c('0x5c')](_0x430688['id']+0x15b38);});_0x118b64(_0x5a9705);});}else{return db['UserProfileResource'][_0x684c('0x42')]({'where':{'sectionId':_0x260b9e['id']},'raw':!![]})[_0x684c('0x28')](function(_0xc5f495){_0xc5f495[_0x684c('0x66')](function(_0x4bc4f6){_0x5a9705[_0x684c('0x5c')](_0x4bc4f6[_0x684c('0x68')]+0x15b38);});_0x118b64(_0x5a9705);});}}catch(_0x1dcb99){_0x4d35d5(_0x1dcb99);}});}exports[_0x684c('0x69')]=function(_0x5bbae6,_0x22825b){return db['UserProfile'][_0x684c('0x49')]({'where':{'id':_0x5bbae6[_0x684c('0x45')]['id']}})['then'](handleEntityNotFound(_0x22825b,null))[_0x684c('0x28')](function(_0x4f5abb){if(_0x4f5abb){return db[_0x684c('0x51')]['transaction'](function(_0x12f62f){return db[_0x684c('0x52')][_0x684c('0x42')]({'where':{'userProfileId':_0x5bbae6[_0x684c('0x45')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x21d912){if(_0x21d912){return db[_0x684c('0x52')][_0x684c('0x29')]({'where':{'userProfileId':_0x5bbae6[_0x684c('0x45')]['id'],'id':_[_0x684c('0x2e')](_0x21d912,function(_0x48c32e){return _0x48c32e['id'];})},'transaction':_0x12f62f});}})[_0x684c('0x28')](function(_0x459f5a){var _0x2887ab=_[_0x684c('0x2e')](_0x5bbae6[_0x684c('0x4f')],function(_0xe93653){_0xe93653[_0x684c('0x57')]=_0x5bbae6[_0x684c('0x45')]['id'];return _0xe93653;});return db[_0x684c('0x52')][_0x684c('0x6a')](_0x2887ab,{'raw':!![],'transaction':_0x12f62f});})['then'](function(_0x466b21){var _0x4a7c82=_[_0x684c('0x3e')](_[_0x684c('0x2e')](_0x466b21,function(_0x31669e){return _0x31669e[_0x684c('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x4a7c82){return db[_0x684c('0x52')][_0x684c('0x42')]({'where':{'userProfileId':_0x5bbae6[_0x684c('0x45')]['id'],'sectionId':_[_0x684c('0x2e')](_0x4a7c82,function(_0x281943){return _0x281943[_0x684c('0x56')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x33e74a){var _0x4cc9dd=_[_0x684c('0x2e')](_0x5bbae6[_0x684c('0x4f')],function(_0x73e277){_0x73e277[_0x684c('0x57')]=_0x5bbae6[_0x684c('0x45')]['id'];return _0x73e277;});return db[_0x684c('0x55')][_0x684c('0x6a')](_0x4cc9dd,{'raw':!![],'transaction':_0x12f62f});});}})[_0x684c('0x44')](handleError(_0x22825b,null));});}})[_0x684c('0x28')](function(_0x8c02d0){var _0x5a79c5=_[_0x684c('0x2e')](_0x8c02d0,function(_0xd18f85){return _0xd18f85[_0x684c('0x4b')]({'plain':!![]});});})[_0x684c('0x28')](respondWithResult(_0x22825b,null))[_0x684c('0x44')](handleError(_0x22825b,null));};exports['removeResources']=function(_0x3c694f,_0x5cdcac,_0x2970cc){return db[_0x684c('0x41')][_0x684c('0x49')]({'where':{'id':_0x3c694f[_0x684c('0x45')]['id']}})[_0x684c('0x28')](handleEntityNotFound(_0x5cdcac,null))['then'](function(_0x22f803){if(_0x22f803){return _0x22f803[_0x684c('0x6b')](_0x3c694f[_0x684c('0x33')][_0x684c('0x5e')]);}})[_0x684c('0x28')](respondWithStatusCode(_0x5cdcac,null))[_0x684c('0x44')](handleError(_0x5cdcac,null));};exports[_0x684c('0x6c')]=function(_0x1a5b1b,_0x51d3f7){var _0x875ccc={};if(!_0x1a5b1b[_0x684c('0x33')][_0x684c('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x1a5b1b[_0x684c('0x33')][_0x684c('0x38')](_0x684c('0x6e'))){_0x875ccc[_0x684c('0x1f')]=qs[_0x684c('0x1f')](_0x1a5b1b[_0x684c('0x33')][_0x684c('0x1f')]);_0x875ccc[_0x684c('0x1e')]=qs[_0x684c('0x1e')](_0x1a5b1b[_0x684c('0x33')][_0x684c('0x1e')]);}return db[_0x684c('0x41')][_0x684c('0x49')]({'where':{'id':_0x1a5b1b[_0x684c('0x45')]['id']}})[_0x684c('0x28')](function(_0x54b91d){if(!_0x54b91d)throw new Error(_0x684c('0x6f')+_0x1a5b1b['params']['id']);return db[_0x684c('0x41')][_0x684c('0x6c')](_0x1a5b1b);})[_0x684c('0x28')](respondWithFilteredResult(_0x51d3f7,_0x875ccc))[_0x684c('0x44')](handleError(_0x51d3f7,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index b1ea77b..364c5a3 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 _0x0650=['update','emit','exports','events','UserProfile','setMaxListeners'];(function(_0x2a0f43,_0x3ba48b){var _0x39b9d6=function(_0x2d1d8e){while(--_0x2d1d8e){_0x2a0f43['push'](_0x2a0f43['shift']());}};_0x39b9d6(++_0x3ba48b);}(_0x0650,0xed));var _0x0065=function(_0x4d593e,_0x131776){_0x4d593e=_0x4d593e-0x0;var _0x31e2df=_0x0650[_0x4d593e];return _0x31e2df;};'use strict';var EventEmitter=require(_0x0065('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x0065('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0065('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0065('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2e05a4){return function(_0x8260ba,_0x3dd8c6,_0x4b15b1){UserProfileEvents[_0x0065('0x4')](_0x2e05a4+':'+_0x8260ba['id'],_0x8260ba);UserProfileEvents['emit'](_0x2e05a4,_0x8260ba);_0x4b15b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x0065('0x5')]=UserProfileEvents; \ No newline at end of file +var _0x1751=['UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3011b7,_0x56b4b0){var _0x304ca2=function(_0x5832be){while(--_0x5832be){_0x3011b7['push'](_0x3011b7['shift']());}};_0x304ca2(++_0x56b4b0);}(_0x1751,0x76));var _0x1175=function(_0x1e2a91,_0x2172d4){_0x1e2a91=_0x1e2a91-0x0;var _0x1771f0=_0x1751[_0x1e2a91];return _0x1771f0;};'use strict';var EventEmitter=require(_0x1175('0x0'));var UserProfile=require(_0x1175('0x1'))['db'][_0x1175('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1175('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1175('0x4'),'afterDestroy':_0x1175('0x5')};function emitEvent(_0x1a62f7){return function(_0x3d5dd9,_0x3087ab,_0xfd3308){UserProfileEvents[_0x1175('0x6')](_0x1a62f7+':'+_0x3d5dd9['id'],_0x3d5dd9);UserProfileEvents[_0x1175('0x6')](_0x1a62f7,_0x3d5dd9);_0xfd3308(null);};}for(var e in events){if(events[_0x1175('0x7')](e)){var event=events[e];UserProfile[_0x1175('0x8')](e,emitEvent(event));}}module[_0x1175('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 6078d63..6fe779c 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 _0x4745=['smsqueues','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','QueueCampaigns','users','telephones','User','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','triggers','trunks','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','QueryTypes','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','user_profiles','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','params','union','autoAssociation','length','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','filters','merge','key','VIRTUAL','find','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','Tags','color','tag','openTabs','true','chat','sms','dataValues','fax','mail','openchannel','all','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','associatedResources','map','catch','model','then','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','lists','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','parentSections','Agents','name','membername','agent','Telephones','role','telephone','VoiceQueues','inbound','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','mailqueues','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount'];(function(_0x35beda,_0xe7244a){var _0x43454c=function(_0x7a9fbc){while(--_0x7a9fbc){_0x35beda['push'](_0x35beda['shift']());}};_0x43454c(++_0xe7244a);}(_0x4745,0x1e7));var _0x5474=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4745[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x5474('0x0'));var attributes=require(_0x5474('0x1'));var qs=require(_0x5474('0x2'));var squel=require(_0x5474('0x3'));module[_0x5474('0x4')]=function(_0xa40879){var _0x4bd69d=_0xa40879[_0x5474('0x5')];function _0x28d8aa(_0x39fb9b,_0x45a895){return new Promise(function(_0x34f89b,_0x4e7ce7){if(!_0x45a895)return _0x34f89b(null);var _0x3d1e1=_0x45a895[_0x5474('0x6')]?{[_0x45a895['filter'][_0x5474('0x7')]]:_0x45a895['filter'][_0x5474('0x8')]}:undefined;return _0x4bd69d[_0x39fb9b][_0x5474('0x9')]({'where':_0x3d1e1,'raw':!![]})['then'](function(_0xf876f8){_0x45a895[_0x5474('0xa')]=_[_0x5474('0xb')](_0xf876f8,'id');_0x34f89b(_0x45a895);})[_0x5474('0xc')](function(_0x4444dd){_0x4e7ce7(_0x4444dd);});});}function _0x40c4a8(_0x3f729f,_0x2fc637){return new Promise(function(_0x48fc51,_0x38dadb){var _0x2bb3c1=_0x3f729f[_0x5474('0x6')]?{[_0x3f729f[_0x5474('0x6')][_0x5474('0x7')]]:_0x3f729f[_0x5474('0x6')][_0x5474('0x8')]}:undefined;return _0x4bd69d[_0x3f729f[_0x5474('0xd')]][_0x5474('0x9')]({'where':_0x2bb3c1,'raw':!![]})['then'](function(_0xb828fe){_0x2fc637[_0x5474('0xa')]=_[_0x5474('0xb')](_0xb828fe,function(_0x1790eb){return _0x1790eb['name'];});_0x48fc51(_0x2fc637);})['catch'](function(_0x50b949){_0x38dadb(_0x50b949);});});}function _0x50eb42(_0x32f0e4,_0x172bcb,_0x2da774){if(!_0x172bcb)return Promise['resolve'](null);return new Promise(function(_0x3da004,_0x2be746){return _0x4bd69d['UserProfileResource'][_0x5474('0x9')]({'where':{'sectionId':_0x172bcb['id']},'raw':!![]})[_0x5474('0xe')](function(_0x18b0fe){if(_0x32f0e4[_0x5474('0x7')]&&_0x32f0e4[_0x5474('0x7')]!=='id'){_0x172bcb['associatedResources']=_[_0x5474('0xb')](_0x18b0fe,function(_0x5f31a9){return _0x5f31a9[_0x32f0e4[_0x5474('0x7')]];});}else{if(_0x2da774===_0x5474('0xf')){_0x172bcb['associatedResources']=_['map'](_0x18b0fe,function(_0x563539){return{'id':_0x563539[_0x5474('0x10')],'type':_0x563539[_0x5474('0x11')]};});}else{_0x172bcb[_0x5474('0xa')]=_[_0x5474('0xb')](_0x18b0fe,function(_0x36b389){return _0x36b389[_0x5474('0x10')];});}}_0x3da004(_0x172bcb);})[_0x5474('0xc')](function(_0x1e512d){_0x2be746(_0x1e512d);});});}function _0x219be1(_0x9c80cc,_0x542d1f){var _0x5f065d={'parentSections':[]};switch(_0x9c80cc[_0x5474('0x12')]()){case _0x5474('0x13'):_0x5f065d[_0x5474('0x14')]='SquareProject';break;case _0x5474('0x15'):_0x5f065d['childModel']=_0x5474('0x16');break;case _0x5474('0x17'):_0x5f065d['childModel']=_0x5474('0x18');_0x5f065d['parentSections']=[{'name':_0x5474('0x19'),'field':'name','foreignKey':_0x5474('0x1a')}];break;case _0x5474('0x1b'):_0x5f065d[_0x5474('0x14')]='JscriptyProject';break;case _0x5474('0x1c'):_0x5f065d[_0x5474('0x14')]='CmContact';_0x5f065d['parentSections']=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x5474('0x1d'):_0x5f065d[_0x5474('0x14')]='CmList';break;case _0x5474('0x1e'):_0x5f065d['childModel']=_0x5474('0x1f');break;case'globalcustomfields':_0x5f065d[_0x5474('0x14')]='CmCustomField';break;case _0x5474('0x20'):_0x5f065d['childModel']=_0x5474('0x21');break;case _0x5474('0x22'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x23');break;case'faxqueues':_0x5f065d['childModel']=_0x5474('0x24');break;case _0x5474('0x25'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x26');break;case'inboundroutes':case'internalroutes':case _0x5474('0x27'):_0x5f065d[_0x5474('0x14')]='VoiceExtension';break;case _0x5474('0x28'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x29');break;case _0x5474('0x2a'):_0x5f065d['childModel']=_0x5474('0x2b');break;case _0x5474('0x2c'):_0x5f065d[_0x5474('0x14')]='VoiceRecording';_0x5f065d[_0x5474('0x2d')]=[{'name':_0x5474('0x2e'),'field':_0x5474('0x2f'),'foreignKey':_0x5474('0x30'),'model':'User','filter':{'field':'role','value':[_0x5474('0x31')]}},{'name':_0x5474('0x32'),'field':_0x5474('0x2f'),'foreignKey':_0x5474('0x30'),'model':'User','filter':{'field':_0x5474('0x33'),'value':[_0x5474('0x34')]}},{'name':_0x5474('0x35'),'field':_0x5474('0x2f'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0x5474('0x36')]}},{'name':'QueueCampaigns','field':_0x5474('0x2f'),'foreignKey':_0x5474('0x37'),'model':_0x5474('0x38'),'filter':{'field':_0x5474('0x11'),'value':[_0x5474('0x39')]}}];break;case _0x5474('0x3a'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x3b');break;case _0x5474('0x3c'):_0x5f065d['childModel']=_0x5474('0x3d');break;case _0x5474('0x3e'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x3f');break;case'ivrcampaigns':_0x5f065d[_0x5474('0x14')]='Campaign';break;case _0x5474('0x40'):_0x5f065d[_0x5474('0x14')]='MailQueue';break;case _0x5474('0x41'):_0x5f065d[_0x5474('0x14')]='MailAccount';break;case _0x5474('0x42'):_0x5f065d[_0x5474('0x14')]='MailSubstatus';break;case _0x5474('0x43'):_0x5f065d['childModel']=_0x5474('0x44');break;case _0x5474('0x45'):_0x5f065d['childModel']=_0x5474('0x46');break;case _0x5474('0x47'):_0x5f065d[_0x5474('0x14')]='SmsQueue';break;case _0x5474('0x48'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x49');break;case _0x5474('0x4a'):_0x5f065d['childModel']='WhatsappQueue';break;case _0x5474('0x4b'):_0x5f065d['childModel']=_0x5474('0x4c');break;case _0x5474('0x4d'):_0x5f065d['childModel']=_0x5474('0x4e');break;case _0x5474('0x4f'):case'queuecampaigns':_0x5f065d[_0x5474('0x14')]=_0x5474('0x38');if(_0x542d1f){_0x5f065d['parentSections']=[{'name':'VoiceQueues'},{'name':_0x5474('0x50')}];}break;case _0x5474('0x51'):case'agents':case _0x5474('0x52'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x53');if(_0x542d1f){_0x5f065d[_0x5474('0x2d')]=[{'name':'Users','filter':{'field':_0x5474('0x33'),'value':[_0x5474('0x54'),'user']},'ignore':!![]},{'name':_0x5474('0x2e')},{'name':_0x5474('0x32')}];}break;case _0x5474('0x55'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x56');break;case _0x5474('0x57'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x58');break;case _0x5474('0x59'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x5a');break;case _0x5474('0x5b'):_0x5f065d['childModel']=_0x5474('0x5c');break;case _0x5474('0x5d'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x5e');break;case'zohoaccounts':_0x5f065d[_0x5474('0x14')]=_0x5474('0x5f');break;case _0x5474('0x60'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x53');break;case _0x5474('0x61'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x62');break;case _0x5474('0x63'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x64');break;case _0x5474('0x65'):_0x5f065d[_0x5474('0x14')]='Dashboard';break;case'intervals':_0x5f065d['childModel']=_0x5474('0x66');break;case _0x5474('0x67'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x68');break;case _0x5474('0x69'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x6a');break;case _0x5474('0x6b'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x6c');break;case'tags':_0x5f065d[_0x5474('0x14')]=_0x5474('0x6d');break;case _0x5474('0x6e'):_0x5f065d[_0x5474('0x14')]=_0x5474('0x6f');break;case _0x5474('0x70'):_0x5f065d['childModel']='Trigger';break;case _0x5474('0x71'):_0x5f065d['childModel']=_0x5474('0x72');break;case _0x5474('0x73'):_0x5f065d[_0x5474('0x14')]='Variable';break;case _0x5474('0x74'):_0x5f065d['childModel']=_0x5474('0x75');break;case _0x5474('0x76'):_0x5f065d[_0x5474('0x14')]=_0x5474('0xf');_0x5f065d[_0x5474('0x2d')]=[{'name':_0x5474('0x77'),'field':'id','foreignKey':_0x5474('0x78')}];break;case'metrics':_0x5f065d['childModel']=_0x5474('0x79');break;}return _0x5f065d;}function _0x42d6ba(_0x5d2aa1,_0x191401){var _0x282a17=_0x5d2aa1[_0x5474('0x7a')](0x0)['toUpperCase']()+_0x5d2aa1['slice'](0x1);var _0x27e27d={'type':_0x4bd69d['Sequelize'][_0x5474('0x7b')]['SELECT'],'raw':!![]};return new Promise(function(_0x121951,_0x438290){var _0x142edd=squel['select']()['field'](_0x5474('0x7c')+_0x282a17+_0x5474('0x7d'),'id')['field'](_0x5474('0x7e'))[_0x5474('0x7f')](_0x5474('0x80')+_0x5d2aa1+_0x5474('0x81'),'ui')[_0x5474('0x82')](_0x5474('0x83'),_0x191401['id']);return _0x4bd69d['sequelize'][_0x5474('0x84')](_0x142edd[_0x5474('0x85')](),_0x27e27d)['then'](function(_0x3ad815){_0x191401[_0x282a17+_0x5474('0x86')]=_0x3ad815;_0x121951(_0x3ad815);})['catch'](function(_0x495737){_0x438290(_0x495737);});});}return _0xa40879[_0x5474('0x87')]('UserProfile',attributes,{'tableName':_0x5474('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x13cda3){var _0x458805={'raw':![],'where':{}};var _0x173dad={};var _0xaa0f67={'count':0x0,'rows':[]};var _0x2a9f70=_0x13cda3['query']['section'];var _0x1cbdc5=_0x13cda3[_0x5474('0x84')][_0x5474('0x89')]||![];var _0x2eb32e=_0x219be1(_0x2a9f70,_0x1cbdc5);if(!_0x2eb32e[_0x5474('0x14')])throw new Error(_0x5474('0x8a')+_0x2a9f70+'\x27');var _0x200b78=[{'name':_0x2a9f70}];if(!_[_0x5474('0x8b')](_0x2eb32e[_0x5474('0x2d')]))_0x200b78=_0x2eb32e[_0x5474('0x2d')];var _0x59e85e=[];for(var _0x38e08f=0x0;_0x38e08f<_0x200b78['length'];_0x38e08f++){_0x59e85e[_0x5474('0x8c')](_0x4bd69d[_0x5474('0x8d')]['find']({'where':{'userProfileId':_0x13cda3[_0x5474('0x8e')]['id'],'name':_0x200b78[_0x38e08f]['name']},'raw':!![]}));}return Promise['all'](_0x59e85e)[_0x5474('0xe')](function(_0x593672){var _0x526b3c=_[_0x5474('0x6')](_0x593672,function(_0x18a99a){return _0x18a99a?_0x18a99a:undefined;});var _0x2f4d1e=_[_0x5474('0x6')](_0x200b78,['ignore',!![]]);var _0x25a24e=_[_0x5474('0x8b')](_0x526b3c)&&_[_0x5474('0x8b')](_0x2f4d1e)?null:_[_0x5474('0x8f')](_0x2f4d1e,_0x526b3c);if(!_0x25a24e)return null;var _0x1920a3=[];for(var _0x1a5ac0=0x0;_0x1a5ac0<_0x25a24e['length'];_0x1a5ac0++){var _0x4131bb=_['find'](_0x200b78,function(_0x198eb8){return _0x25a24e[_0x1a5ac0]?_0x198eb8[_0x5474('0x2f')]===_0x25a24e[_0x1a5ac0]['name']:null;});if(_0x4131bb){if(_0x25a24e[_0x1a5ac0]['ignore']){_0x1920a3[_0x5474('0x8c')](_0x28d8aa(_0x2eb32e[_0x5474('0x14')],_0x25a24e[_0x1a5ac0]));}else{if(!_0x25a24e[_0x1a5ac0][_0x5474('0x90')]){_0x1920a3[_0x5474('0x8c')](_0x50eb42(_0x4131bb,_0x25a24e[_0x1a5ac0],_0x2eb32e[_0x5474('0x14')]));}else{if(_0x4131bb[_0x5474('0xd')]){_0x1920a3[_0x5474('0x8c')](_0x40c4a8(_0x4131bb,_0x25a24e[_0x1a5ac0]));}}}}}return Promise['all'](_0x1920a3);})['then'](function(_0x28823e){var _0x10cff3=_0x28823e;var _0x41b119=null;if(_0x10cff3){_0x41b119=_0x10cff3[_0x5474('0x91')]===0x1?_0x10cff3[0x0]:null;}if(!_0x41b119&&!_0x10cff3)return _0xaa0f67;var _0xa69efe=_0x4bd69d[_0x2eb32e[_0x5474('0x14')]][_0x5474('0x92')];_0x173dad[_0x5474('0xd')]=_[_0x5474('0x93')](_0xa69efe);_0x173dad['query']=_['keys'](_0x13cda3['query']);_0x173dad['filters']=_[_0x5474('0x94')](_0x173dad['model'],_0x173dad[_0x5474('0x84')]);_0x458805[_0x5474('0x95')]=_[_0x5474('0x94')](_0x173dad[_0x5474('0xd')],qs[_0x5474('0x96')](_0x13cda3[_0x5474('0x84')]['fields']));_0x458805[_0x5474('0x95')]=_0x458805[_0x5474('0x95')][_0x5474('0x91')]?_0x458805['attributes']:_0x173dad[_0x5474('0xd')];if(!_0x13cda3[_0x5474('0x84')][_0x5474('0x97')]('nolimit')){_0x458805[_0x5474('0x98')]=qs[_0x5474('0x98')](_0x13cda3[_0x5474('0x84')][_0x5474('0x98')]);_0x458805[_0x5474('0x99')]=qs[_0x5474('0x99')](_0x13cda3[_0x5474('0x84')]['offset']);}_0x458805[_0x5474('0x9a')]=qs[_0x5474('0x9b')](_0x13cda3[_0x5474('0x84')][_0x5474('0x9b')]);_0x458805[_0x5474('0x82')]=qs['filters'](_[_0x5474('0x9c')](_0x13cda3[_0x5474('0x84')],_0x173dad[_0x5474('0x9d')]));if(_0x13cda3[_0x5474('0x84')][_0x5474('0x6')]){_0x458805['where']=_[_0x5474('0x9e')](_0x458805[_0x5474('0x82')],{'$or':_[_0x5474('0xb')](_0xa69efe,function(_0x2a3746){if(_0x2a3746[_0x5474('0x11')][_0x5474('0x9f')]!==_0x5474('0xa0')){var _0x38a640={};_0x38a640[_0x2a3746[_0x5474('0x7')]]={'$like':'%'+_0x13cda3['query']['filter']+'%'};return _0x38a640;}})});}var _0x14deb4=[];var _0x1c8148=null;var _0x15fb33={};if(_0x41b119){_0x1c8148=_[_0x5474('0xa1')](_0x200b78,[_0x5474('0x2f'),_0x41b119[_0x5474('0x2f')]]);if(_0x1c8148['field']){_0x15fb33={};if(_0x2eb32e[_0x5474('0x14')]==='AnalyticExtractedReport'){_0x15fb33[_0x1c8148[_0x5474('0xa2')]]=_[_0x5474('0xb')](_0x41b119[_0x5474('0xa')],'id');}else{_0x15fb33[_0x1c8148['foreignKey']]=_0x41b119[_0x5474('0xa')];}_0x14deb4[_0x5474('0x8c')](_0x15fb33);}else{_0x458805[_0x5474('0x82')]['id']=_0x41b119['associatedResources'];}}else{for(var _0x21f6e6=0x0;_0x21f6e6<_0x10cff3[_0x5474('0x91')];_0x21f6e6++){_0x1c8148=_[_0x5474('0xa1')](_0x200b78,['name',_0x10cff3[_0x21f6e6]['name']]);if(_0x1c8148['field']){_0x15fb33={};_0x15fb33[_0x1c8148[_0x5474('0xa2')]]=_0x10cff3[_0x21f6e6][_0x5474('0xa')];_0x14deb4[_0x5474('0x8c')](_0x15fb33);}else{if(!_0x458805[_0x5474('0x82')]['id'])_0x458805[_0x5474('0x82')]['id']=[];_0x10cff3[_0x21f6e6][_0x5474('0xa')][_0x5474('0xa3')](function(_0x5362cc){_0x458805[_0x5474('0x82')]['id'][_0x5474('0x8c')](_0x5362cc);});}}}if(!_[_0x5474('0x8b')](_0x14deb4)){_0x458805[_0x5474('0x82')]=_[_0x5474('0x9e')](_0x458805[_0x5474('0x82')],{'$and':{'$or':_0x14deb4}});}_0x458805=_[_0x5474('0x9e')]({},_0x458805,_0x13cda3[_0x5474('0xa4')]);if(_0x41b119&&!_0x41b119[_0x5474('0x90')]&&_0x2eb32e[_0x5474('0x14')]===_0x5474('0xf')){if(_0x13cda3[_0x5474('0x84')][_0x5474('0xa5')]){_0x458805[_0x5474('0xa6')]=[{'all':!![]}];}return _0x4bd69d[_0x2eb32e[_0x5474('0x14')]][_0x5474('0x9')](_0x458805)[_0x5474('0xe')](function(_0x19aa83){var _0x1de17a=[];_0x19aa83[_0x5474('0xa3')](function(_0x5994f5){var _0xbd8403;switch(_0x5994f5[_0x5474('0xa7')]){case _0x5474('0xa8'):_0xbd8403=_['find'](_0x41b119['associatedResources'],function(_0x20c3ed){return _0x20c3ed['id']===_0x5994f5['reportId']&&_0x20c3ed[_0x5474('0x11')]===_0x5474('0xa9');});break;case _0x5474('0xaa'):_0xbd8403=_[_0x5474('0xa1')](_0x41b119[_0x5474('0xa')],function(_0x67b1a9){return _0x67b1a9['id']===_0x5994f5[_0x5474('0x78')]&&_0x67b1a9[_0x5474('0x11')]===_0x5474('0xab');});break;}if(_0xbd8403)_0x1de17a[_0x5474('0x8c')](_0x5994f5);});_0xaa0f67[_0x5474('0xac')]=_0x1de17a['length'];_0xaa0f67[_0x5474('0xad')]=_0x1de17a;return _0xaa0f67;});}else{return _0x4bd69d[_0x2eb32e[_0x5474('0x14')]][_0x5474('0xac')]({'where':_0x458805[_0x5474('0x82')]})[_0x5474('0xe')](function(_0x2f8c7b){_0xaa0f67['count']=_0x2f8c7b;if(_0x13cda3[_0x5474('0x84')]['includeAll']){if(_0x2eb32e[_0x5474('0x14')]==='CmContact'){_0x458805[_0x5474('0xa6')]=[{'model':_0x4bd69d[_0x5474('0x6d')],'as':_0x5474('0xae'),'attributes':['id',_0x5474('0x2f'),_0x5474('0xaf')],'required':_0x13cda3[_0x5474('0x84')][_0x5474('0xb0')]?!![]:![]},{'model':_0x4bd69d[_0x5474('0x6d')],'as':'ThroughTags','attributes':['id','name',_0x5474('0xaf')],'through':_0x13cda3['query'][_0x5474('0xb0')]?{'attributes':[],'where':{'TagId':_0x13cda3['query']['tag']||undefined}}:{},'required':_0x13cda3[_0x5474('0x84')][_0x5474('0xb0')]?!![]:![]}];}else{_0x458805[_0x5474('0xa6')]=[{'all':!![]}];}}return _0x4bd69d[_0x2eb32e[_0x5474('0x14')]]['findAll'](_0x458805);})[_0x5474('0xe')](function(_0x22e42d){_0xaa0f67['rows']=_0x22e42d;if(_0x2a9f70===_0x5474('0x2e')&&_0x13cda3[_0x5474('0x84')][_0x5474('0xb1')]===_0x5474('0xb2')){var _0x5ec2a3=[];for(var _0x28b73f=0x0;_0x28b73f<_0xaa0f67[_0x5474('0xad')][_0x5474('0x91')];_0x28b73f++){_0x5ec2a3['push'](_0x42d6ba(_0x5474('0xb3'),_0xaa0f67['rows'][_0x28b73f]['dataValues']));_0x5ec2a3[_0x5474('0x8c')](_0x42d6ba(_0x5474('0xb4'),_0xaa0f67[_0x5474('0xad')][_0x28b73f][_0x5474('0xb5')]));_0x5ec2a3[_0x5474('0x8c')](_0x42d6ba(_0x5474('0xb6'),_0xaa0f67[_0x5474('0xad')][_0x28b73f][_0x5474('0xb5')]));_0x5ec2a3[_0x5474('0x8c')](_0x42d6ba(_0x5474('0xb7'),_0xaa0f67[_0x5474('0xad')][_0x28b73f][_0x5474('0xb5')]));_0x5ec2a3[_0x5474('0x8c')](_0x42d6ba(_0x5474('0xb8'),_0xaa0f67[_0x5474('0xad')][_0x28b73f][_0x5474('0xb5')]));_0x5ec2a3[_0x5474('0x8c')](_0x42d6ba('whatsapp',_0xaa0f67['rows'][_0x28b73f][_0x5474('0xb5')]));}return Promise[_0x5474('0xb9')](_0x5ec2a3)[_0x5474('0xe')](function(){return _0xaa0f67;});}return _0xaa0f67;});}});}}});}; \ No newline at end of file +var _0x2da6=['QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','OpenchannelQueue','SmsQueue','smsaccounts','SmsAccount','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','_interactions','where','sequelize','query','OpenTabs','define','user_profiles','section','mergeResources','length','push','UserProfileSection','find','all','ignore','isEmpty','autoAssociation','model','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','Tags','color','Tag','ThroughTags','tag','rows','true','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','then','associatedResources','map','findAll','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','childModel','SquareProject','odbc','squarerecordings','parentSections','SquareProjects','projects','JscriptyProject','CmContact','Lists','lists','CmList','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','VoiceQueues','queue','VoiceQueue'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x2da6,0x1dd));var _0x62da=function(_0x1ce0ed,_0x385194){_0x1ce0ed=_0x1ce0ed-0x0;var _0x310640=_0x2da6[_0x1ce0ed];return _0x310640;};'use strict';var _=require(_0x62da('0x0'));var attributes=require(_0x62da('0x1'));var qs=require(_0x62da('0x2'));var squel=require(_0x62da('0x3'));module[_0x62da('0x4')]=function(_0x12b8ad){var _0x19081e=_0x12b8ad[_0x62da('0x5')];function _0x4c079d(_0x4a8428,_0xe28204){return new Promise(function(_0x3163df,_0x3a59f8){if(!_0xe28204)return _0x3163df(null);var _0x30437f=_0xe28204[_0x62da('0x6')]?{[_0xe28204[_0x62da('0x6')][_0x62da('0x7')]]:_0xe28204[_0x62da('0x6')][_0x62da('0x8')]}:undefined;return _0x19081e[_0x4a8428]['findAll']({'where':_0x30437f,'raw':!![]})[_0x62da('0x9')](function(_0x2a3937){_0xe28204[_0x62da('0xa')]=_[_0x62da('0xb')](_0x2a3937,'id');_0x3163df(_0xe28204);})['catch'](function(_0x241090){_0x3a59f8(_0x241090);});});}function _0x3afe3b(_0x260fee,_0x39cffa){return new Promise(function(_0x23be32,_0x5c990c){var _0x42a387=_0x260fee[_0x62da('0x6')]?{[_0x260fee[_0x62da('0x6')][_0x62da('0x7')]]:_0x260fee[_0x62da('0x6')]['value']}:undefined;return _0x19081e[_0x260fee['model']][_0x62da('0xc')]({'where':_0x42a387,'raw':!![]})[_0x62da('0x9')](function(_0x1bd7f9){_0x39cffa[_0x62da('0xa')]=_[_0x62da('0xb')](_0x1bd7f9,function(_0x2c7ca5){return _0x2c7ca5[_0x62da('0xd')];});_0x23be32(_0x39cffa);})[_0x62da('0xe')](function(_0x2cbdf6){_0x5c990c(_0x2cbdf6);});});}function _0xcc1a25(_0x33ec53,_0x27ab5f,_0x1f6bc8){if(!_0x27ab5f)return Promise[_0x62da('0xf')](null);return new Promise(function(_0x4bdab9,_0x4ad626){return _0x19081e[_0x62da('0x10')]['findAll']({'where':{'sectionId':_0x27ab5f['id']},'raw':!![]})[_0x62da('0x9')](function(_0x264366){if(_0x33ec53[_0x62da('0x7')]&&_0x33ec53['field']!=='id'){_0x27ab5f[_0x62da('0xa')]=_['map'](_0x264366,function(_0x2e6b7e){return _0x2e6b7e[_0x33ec53[_0x62da('0x7')]];});}else{if(_0x1f6bc8===_0x62da('0x11')){_0x27ab5f[_0x62da('0xa')]=_[_0x62da('0xb')](_0x264366,function(_0x267cef){return{'id':_0x267cef[_0x62da('0x12')],'type':_0x267cef[_0x62da('0x13')]};});}else{_0x27ab5f[_0x62da('0xa')]=_['map'](_0x264366,function(_0x13bf6d){return _0x13bf6d[_0x62da('0x12')];});}}_0x4bdab9(_0x27ab5f);})[_0x62da('0xe')](function(_0x1f6f96){_0x4ad626(_0x1f6f96);});});}function _0x35f687(_0x54b936,_0x24298a){var _0x50ed6b={'parentSections':[]};switch(_0x54b936['toLowerCase']()){case'squareprojects':_0x50ed6b[_0x62da('0x14')]=_0x62da('0x15');break;case _0x62da('0x16'):_0x50ed6b[_0x62da('0x14')]='SquareOdbc';break;case _0x62da('0x17'):_0x50ed6b[_0x62da('0x14')]='SquareRecording';_0x50ed6b[_0x62da('0x18')]=[{'name':_0x62da('0x19'),'field':_0x62da('0xd'),'foreignKey':'projectName'}];break;case _0x62da('0x1a'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x1b');break;case'contacts':_0x50ed6b['childModel']=_0x62da('0x1c');_0x50ed6b[_0x62da('0x18')]=[{'name':_0x62da('0x1d'),'field':'id','foreignKey':'ListId'}];break;case _0x62da('0x1e'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x1f');break;case _0x62da('0x20'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x21');break;case'globalcustomfields':_0x50ed6b[_0x62da('0x14')]='CmCustomField';break;case _0x62da('0x22'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x23');break;case _0x62da('0x24'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x25');break;case'faxqueues':_0x50ed6b[_0x62da('0x14')]=_0x62da('0x26');break;case _0x62da('0x27'):_0x50ed6b['childModel']=_0x62da('0x28');break;case _0x62da('0x29'):case _0x62da('0x2a'):case'outboundroutes':_0x50ed6b[_0x62da('0x14')]=_0x62da('0x2b');break;case'contexts':_0x50ed6b[_0x62da('0x14')]=_0x62da('0x2c');break;case'voicemails':_0x50ed6b[_0x62da('0x14')]=_0x62da('0x2d');break;case _0x62da('0x2e'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x2f');_0x50ed6b[_0x62da('0x18')]=[{'name':_0x62da('0x30'),'field':_0x62da('0xd'),'foreignKey':_0x62da('0x31'),'model':_0x62da('0x32'),'filter':{'field':_0x62da('0x33'),'value':[_0x62da('0x34')]}},{'name':_0x62da('0x35'),'field':_0x62da('0xd'),'foreignKey':_0x62da('0x31'),'model':_0x62da('0x32'),'filter':{'field':_0x62da('0x33'),'value':['telephone']}},{'name':_0x62da('0x36'),'field':'name','foreignKey':_0x62da('0x37'),'model':_0x62da('0x38'),'filter':{'field':_0x62da('0x13'),'value':['inbound']}},{'name':_0x62da('0x39'),'field':_0x62da('0xd'),'foreignKey':_0x62da('0x37'),'model':_0x62da('0x38'),'filter':{'field':'type','value':[_0x62da('0x3a')]}}];break;case _0x62da('0x3b'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x3c');break;case _0x62da('0x3d'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x3e');break;case _0x62da('0x3f'):_0x50ed6b[_0x62da('0x14')]='VoicePrefix';break;case _0x62da('0x40'):_0x50ed6b[_0x62da('0x14')]='Campaign';break;case _0x62da('0x41'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x42');break;case _0x62da('0x43'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x44');break;case _0x62da('0x45'):_0x50ed6b[_0x62da('0x14')]='MailSubstatus';break;case'openchannelqueues':_0x50ed6b['childModel']=_0x62da('0x46');break;case'openchannelaccounts':_0x50ed6b[_0x62da('0x14')]='OpenchannelAccount';break;case'smsqueues':_0x50ed6b['childModel']=_0x62da('0x47');break;case _0x62da('0x48'):_0x50ed6b['childModel']=_0x62da('0x49');break;case'whatsappqueues':_0x50ed6b[_0x62da('0x14')]='WhatsappQueue';break;case'whatsappaccounts':_0x50ed6b[_0x62da('0x14')]=_0x62da('0x4a');break;case _0x62da('0x4b'):_0x50ed6b['childModel']=_0x62da('0x4c');break;case _0x62da('0x4d'):case _0x62da('0x4e'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x38');if(_0x24298a){_0x50ed6b['parentSections']=[{'name':'VoiceQueues'},{'name':_0x62da('0x39')}];}break;case _0x62da('0x4f'):case _0x62da('0x50'):case _0x62da('0x51'):_0x50ed6b[_0x62da('0x14')]='User';if(_0x24298a){_0x50ed6b['parentSections']=[{'name':_0x62da('0x52'),'filter':{'field':_0x62da('0x33'),'value':['admin',_0x62da('0x53')]},'ignore':!![]},{'name':_0x62da('0x30')},{'name':_0x62da('0x35')}];}break;case _0x62da('0x54'):_0x50ed6b[_0x62da('0x14')]='ZendeskAccount';break;case _0x62da('0x55'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x56');break;case _0x62da('0x57'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x58');break;case _0x62da('0x59'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x5a');break;case'deskaccounts':_0x50ed6b[_0x62da('0x14')]=_0x62da('0x5b');break;case'zohoaccounts':_0x50ed6b['childModel']='ZohoAccount';break;case _0x62da('0x5c'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x32');break;case'cannedanswers':_0x50ed6b[_0x62da('0x14')]=_0x62da('0x5d');break;case _0x62da('0x5e'):_0x50ed6b['childModel']=_0x62da('0x5f');break;case _0x62da('0x60'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x61');break;case'intervals':_0x50ed6b[_0x62da('0x14')]=_0x62da('0x62');break;case _0x62da('0x63'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x64');break;case _0x62da('0x65'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x66');break;case _0x62da('0x67'):_0x50ed6b['childModel']='Sound';break;case _0x62da('0x68'):_0x50ed6b['childModel']='Tag';break;case'templates':_0x50ed6b[_0x62da('0x14')]=_0x62da('0x69');break;case _0x62da('0x6a'):_0x50ed6b['childModel']=_0x62da('0x6b');break;case _0x62da('0x6c'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x6d');break;case'variables':_0x50ed6b[_0x62da('0x14')]=_0x62da('0x6e');break;case _0x62da('0x6f'):_0x50ed6b['childModel']=_0x62da('0x70');break;case'extractedreports':_0x50ed6b[_0x62da('0x14')]='AnalyticExtractedReport';_0x50ed6b[_0x62da('0x18')]=[{'name':_0x62da('0x71'),'field':'id','foreignKey':_0x62da('0x72')}];break;case _0x62da('0x73'):_0x50ed6b[_0x62da('0x14')]=_0x62da('0x74');break;}return _0x50ed6b;}function _0x2b62ad(_0x4b1dd8,_0x1b484c){var _0x2c5a57=_0x4b1dd8['charAt'](0x0)['toUpperCase']()+_0x4b1dd8[_0x62da('0x75')](0x1);var _0x51150e={'type':_0x19081e['Sequelize'][_0x62da('0x76')][_0x62da('0x77')],'raw':!![]};return new Promise(function(_0x24e8f0,_0x81f616){var _0x35793a=squel[_0x62da('0x78')]()[_0x62da('0x7')](_0x62da('0x79')+_0x2c5a57+_0x62da('0x7a'),'id')[_0x62da('0x7')](_0x62da('0x7b'))['from']('user_has_'+_0x4b1dd8+_0x62da('0x7c'),'ui')[_0x62da('0x7d')]('ui.UserId\x20=\x20?',_0x1b484c['id']);return _0x19081e[_0x62da('0x7e')][_0x62da('0x7f')](_0x35793a['toString'](),_0x51150e)['then'](function(_0x54f527){_0x1b484c[_0x2c5a57+_0x62da('0x80')]=_0x54f527;_0x24e8f0(_0x54f527);})[_0x62da('0xe')](function(_0x505b32){_0x81f616(_0x505b32);});});}return _0x12b8ad[_0x62da('0x81')]('UserProfile',attributes,{'tableName':_0x62da('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x34f0ff){var _0x3b59de={'raw':![],'where':{}};var _0x2b4c0d={};var _0xd07536={'count':0x0,'rows':[]};var _0x49145d=_0x34f0ff['query'][_0x62da('0x83')];var _0x47e36a=_0x34f0ff[_0x62da('0x7f')][_0x62da('0x84')]||![];var _0x5ab20a=_0x35f687(_0x49145d,_0x47e36a);if(!_0x5ab20a[_0x62da('0x14')])throw new Error('Invalid\x20section\x20\x27'+_0x49145d+'\x27');var _0x48a928=[{'name':_0x49145d}];if(!_['isEmpty'](_0x5ab20a['parentSections']))_0x48a928=_0x5ab20a[_0x62da('0x18')];var _0x52b8fa=[];for(var _0x1430d3=0x0;_0x1430d3<_0x48a928[_0x62da('0x85')];_0x1430d3++){_0x52b8fa[_0x62da('0x86')](_0x19081e[_0x62da('0x87')][_0x62da('0x88')]({'where':{'userProfileId':_0x34f0ff['params']['id'],'name':_0x48a928[_0x1430d3]['name']},'raw':!![]}));}return Promise[_0x62da('0x89')](_0x52b8fa)[_0x62da('0x9')](function(_0x20bdf6){var _0x5e1cf5=_[_0x62da('0x6')](_0x20bdf6,function(_0x44563e){return _0x44563e?_0x44563e:undefined;});var _0x5bbd58=_['filter'](_0x48a928,[_0x62da('0x8a'),!![]]);var _0xe7392=_[_0x62da('0x8b')](_0x5e1cf5)&&_['isEmpty'](_0x5bbd58)?null:_['union'](_0x5bbd58,_0x5e1cf5);if(!_0xe7392)return null;var _0x1939aa=[];for(var _0x1f23eb=0x0;_0x1f23eb<_0xe7392[_0x62da('0x85')];_0x1f23eb++){var _0x48cdc3=_[_0x62da('0x88')](_0x48a928,function(_0xf0a02d){return _0xe7392[_0x1f23eb]?_0xf0a02d['name']===_0xe7392[_0x1f23eb][_0x62da('0xd')]:null;});if(_0x48cdc3){if(_0xe7392[_0x1f23eb][_0x62da('0x8a')]){_0x1939aa[_0x62da('0x86')](_0x4c079d(_0x5ab20a[_0x62da('0x14')],_0xe7392[_0x1f23eb]));}else{if(!_0xe7392[_0x1f23eb][_0x62da('0x8c')]){_0x1939aa[_0x62da('0x86')](_0xcc1a25(_0x48cdc3,_0xe7392[_0x1f23eb],_0x5ab20a[_0x62da('0x14')]));}else{if(_0x48cdc3[_0x62da('0x8d')]){_0x1939aa[_0x62da('0x86')](_0x3afe3b(_0x48cdc3,_0xe7392[_0x1f23eb]));}}}}}return Promise[_0x62da('0x89')](_0x1939aa);})['then'](function(_0x34956a){var _0x455702=_0x34956a;var _0x48f059=null;if(_0x455702){_0x48f059=_0x455702['length']===0x1?_0x455702[0x0]:null;}if(!_0x48f059&&!_0x455702)return _0xd07536;var _0x3fd3d3=_0x19081e[_0x5ab20a[_0x62da('0x14')]]['rawAttributes'];_0x2b4c0d[_0x62da('0x8d')]=_[_0x62da('0x8e')](_0x3fd3d3);_0x2b4c0d[_0x62da('0x7f')]=_[_0x62da('0x8e')](_0x34f0ff['query']);_0x2b4c0d[_0x62da('0x8f')]=_[_0x62da('0x90')](_0x2b4c0d[_0x62da('0x8d')],_0x2b4c0d[_0x62da('0x7f')]);_0x3b59de[_0x62da('0x91')]=_[_0x62da('0x90')](_0x2b4c0d[_0x62da('0x8d')],qs[_0x62da('0x92')](_0x34f0ff[_0x62da('0x7f')][_0x62da('0x92')]));_0x3b59de[_0x62da('0x91')]=_0x3b59de[_0x62da('0x91')][_0x62da('0x85')]?_0x3b59de[_0x62da('0x91')]:_0x2b4c0d[_0x62da('0x8d')];if(!_0x34f0ff[_0x62da('0x7f')][_0x62da('0x93')](_0x62da('0x94'))){_0x3b59de['limit']=qs['limit'](_0x34f0ff[_0x62da('0x7f')][_0x62da('0x95')]);_0x3b59de[_0x62da('0x96')]=qs[_0x62da('0x96')](_0x34f0ff['query']['offset']);}_0x3b59de[_0x62da('0x97')]=qs[_0x62da('0x98')](_0x34f0ff[_0x62da('0x7f')][_0x62da('0x98')]);_0x3b59de[_0x62da('0x7d')]=qs[_0x62da('0x8f')](_[_0x62da('0x99')](_0x34f0ff[_0x62da('0x7f')],_0x2b4c0d[_0x62da('0x8f')]));if(_0x34f0ff['query'][_0x62da('0x6')]){_0x3b59de[_0x62da('0x7d')]=_[_0x62da('0x9a')](_0x3b59de[_0x62da('0x7d')],{'$or':_[_0x62da('0xb')](_0x3fd3d3,function(_0x4e43c9){if(_0x4e43c9[_0x62da('0x13')]['key']!=='VIRTUAL'){var _0x552183={};_0x552183[_0x4e43c9[_0x62da('0x7')]]={'$like':'%'+_0x34f0ff[_0x62da('0x7f')]['filter']+'%'};return _0x552183;}})});}var _0x46156a=[];var _0x24eaf0=null;var _0x554566={};if(_0x48f059){_0x24eaf0=_['find'](_0x48a928,['name',_0x48f059[_0x62da('0xd')]]);if(_0x24eaf0[_0x62da('0x7')]){_0x554566={};if(_0x5ab20a[_0x62da('0x14')]===_0x62da('0x11')){_0x554566[_0x24eaf0[_0x62da('0x9b')]]=_['map'](_0x48f059['associatedResources'],'id');}else{_0x554566[_0x24eaf0['foreignKey']]=_0x48f059[_0x62da('0xa')];}_0x46156a[_0x62da('0x86')](_0x554566);}else{_0x3b59de[_0x62da('0x7d')]['id']=_0x48f059[_0x62da('0xa')];}}else{for(var _0x39d59d=0x0;_0x39d59d<_0x455702[_0x62da('0x85')];_0x39d59d++){_0x24eaf0=_[_0x62da('0x88')](_0x48a928,[_0x62da('0xd'),_0x455702[_0x39d59d][_0x62da('0xd')]]);if(_0x24eaf0['field']){_0x554566={};_0x554566[_0x24eaf0[_0x62da('0x9b')]]=_0x455702[_0x39d59d]['associatedResources'];_0x46156a[_0x62da('0x86')](_0x554566);}else{if(!_0x3b59de[_0x62da('0x7d')]['id'])_0x3b59de[_0x62da('0x7d')]['id']=[];_0x455702[_0x39d59d][_0x62da('0xa')][_0x62da('0x9c')](function(_0x18439f){_0x3b59de[_0x62da('0x7d')]['id'][_0x62da('0x86')](_0x18439f);});}}}if(!_['isEmpty'](_0x46156a)){_0x3b59de[_0x62da('0x7d')]=_[_0x62da('0x9a')](_0x3b59de['where'],{'$and':{'$or':_0x46156a}});}_0x3b59de=_['merge']({},_0x3b59de,_0x34f0ff[_0x62da('0x9d')]);if(_0x48f059&&!_0x48f059[_0x62da('0x8c')]&&_0x5ab20a[_0x62da('0x14')]==='AnalyticExtractedReport'){if(_0x34f0ff[_0x62da('0x7f')][_0x62da('0x9e')]){_0x3b59de[_0x62da('0x9f')]=[{'all':!![]}];}return _0x19081e[_0x5ab20a[_0x62da('0x14')]][_0x62da('0xc')](_0x3b59de)[_0x62da('0x9')](function(_0x4b5495){var _0x3f08d6=[];_0x4b5495[_0x62da('0x9c')](function(_0x8bf464){var _0x472df0;switch(_0x8bf464[_0x62da('0xa0')]){case _0x62da('0xa1'):_0x472df0=_[_0x62da('0x88')](_0x48f059[_0x62da('0xa')],function(_0x4cb41c){return _0x4cb41c['id']===_0x8bf464[_0x62da('0x72')]&&_0x4cb41c[_0x62da('0x13')]===_0x62da('0xa2');});break;case _0x62da('0xa3'):_0x472df0=_[_0x62da('0x88')](_0x48f059[_0x62da('0xa')],function(_0x167ded){return _0x167ded['id']===_0x8bf464['reportId']&&_0x167ded[_0x62da('0x13')]===_0x62da('0xa4');});break;}if(_0x472df0)_0x3f08d6[_0x62da('0x86')](_0x8bf464);});_0xd07536[_0x62da('0xa5')]=_0x3f08d6[_0x62da('0x85')];_0xd07536['rows']=_0x3f08d6;return _0xd07536;});}else{return _0x19081e[_0x5ab20a[_0x62da('0x14')]][_0x62da('0xa5')]({'where':_0x3b59de[_0x62da('0x7d')]})['then'](function(_0x59258f){_0xd07536[_0x62da('0xa5')]=_0x59258f;if(_0x34f0ff[_0x62da('0x7f')]['includeAll']){if(_0x5ab20a['childModel']===_0x62da('0x1c')){_0x3b59de[_0x62da('0x9f')]=[{'model':_0x19081e['Tag'],'as':_0x62da('0xa6'),'attributes':['id',_0x62da('0xd'),_0x62da('0xa7')],'required':_0x34f0ff[_0x62da('0x7f')]['tag']?!![]:![]},{'model':_0x19081e[_0x62da('0xa8')],'as':_0x62da('0xa9'),'attributes':['id',_0x62da('0xd'),_0x62da('0xa7')],'through':_0x34f0ff[_0x62da('0x7f')][_0x62da('0xaa')]?{'attributes':[],'where':{'TagId':_0x34f0ff[_0x62da('0x7f')][_0x62da('0xaa')]||undefined}}:{},'required':_0x34f0ff[_0x62da('0x7f')]['tag']?!![]:![]}];}else{_0x3b59de['include']=[{'all':!![]}];}}return _0x19081e[_0x5ab20a[_0x62da('0x14')]][_0x62da('0xc')](_0x3b59de);})['then'](function(_0x10caa6){_0xd07536[_0x62da('0xab')]=_0x10caa6;if(_0x49145d===_0x62da('0x30')&&_0x34f0ff[_0x62da('0x7f')]['openTabs']===_0x62da('0xac')){var _0x233888=[];for(var _0x428e74=0x0;_0x428e74<_0xd07536['rows'][_0x62da('0x85')];_0x428e74++){_0x233888[_0x62da('0x86')](_0x2b62ad('chat',_0xd07536[_0x62da('0xab')][_0x428e74][_0x62da('0xad')]));_0x233888[_0x62da('0x86')](_0x2b62ad(_0x62da('0xae'),_0xd07536['rows'][_0x428e74]['dataValues']));_0x233888['push'](_0x2b62ad('fax',_0xd07536['rows'][_0x428e74]['dataValues']));_0x233888[_0x62da('0x86')](_0x2b62ad(_0x62da('0xaf'),_0xd07536[_0x62da('0xab')][_0x428e74][_0x62da('0xad')]));_0x233888[_0x62da('0x86')](_0x2b62ad(_0x62da('0xb0'),_0xd07536[_0x62da('0xab')][_0x428e74][_0x62da('0xad')]));_0x233888[_0x62da('0x86')](_0x2b62ad(_0x62da('0xb1'),_0xd07536[_0x62da('0xab')][_0x428e74][_0x62da('0xad')]));}return Promise[_0x62da('0x89')](_0x233888)['then'](function(){return _0xd07536;});}return _0xd07536;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 74d25e7..4b6c826 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 _0x806b=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','then','info','request\x20sent','debug','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1e1593,_0x3c96d7){var _0x215afb=function(_0x562154){while(--_0x562154){_0x1e1593['push'](_0x1e1593['shift']());}};_0x215afb(++_0x3c96d7);}(_0x806b,0x163));var _0xb806=function(_0x4f51d5,_0x2d9954){_0x4f51d5=_0x4f51d5-0x0;var _0x11f38e=_0x806b[_0x4f51d5];return _0x11f38e;};'use strict';var _=require(_0xb806('0x0'));var util=require(_0xb806('0x1'));var moment=require(_0xb806('0x2'));var BPromise=require(_0xb806('0x3'));var rs=require(_0xb806('0x4'));var fs=require('fs');var Redis=require(_0xb806('0x5'));var db=require(_0xb806('0x6'))['db'];var utils=require(_0xb806('0x7'));var logger=require('../../config/logger')(_0xb806('0x8'));var config=require(_0xb806('0x9'));var jayson=require(_0xb806('0xa'));var client=jayson[_0xb806('0xb')]['http']({'port':0x232a});config[_0xb806('0xc')]=_[_0xb806('0xd')](config['redis'],{'host':_0xb806('0xe'),'port':0x18eb});var socket=require(_0xb806('0xf'))(new Redis(config[_0xb806('0xc')]));require(_0xb806('0x10'))['register'](socket);function respondWithRpcPromise(_0x2b38df,_0x554c82,_0x466e0f){return new BPromise(function(_0x4cd6b4,_0x355422){return client['request'](_0x2b38df,_0x466e0f)[_0xb806('0x11')](function(_0x30c60f){logger[_0xb806('0x12')]('UserProfile,\x20%s,\x20%s',_0x554c82,_0xb806('0x13'));logger[_0xb806('0x14')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x554c82,_0xb806('0x13'),JSON[_0xb806('0x15')](_0x30c60f));if(_0x30c60f['error']){if(_0x30c60f[_0xb806('0x16')][_0xb806('0x17')]===0x1f4){logger['error'](_0xb806('0x18'),_0x554c82,_0x30c60f[_0xb806('0x16')][_0xb806('0x19')]);return _0x355422(_0x30c60f[_0xb806('0x16')][_0xb806('0x19')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x554c82,_0x30c60f[_0xb806('0x16')]['message']);return _0x4cd6b4(_0x30c60f[_0xb806('0x16')][_0xb806('0x19')]);}else{logger[_0xb806('0x12')](_0xb806('0x18'),_0x554c82,'request\x20sent');_0x4cd6b4(_0x30c60f[_0xb806('0x1a')][_0xb806('0x19')]);}})[_0xb806('0x1b')](function(_0x226945){logger[_0xb806('0x16')](_0xb806('0x18'),_0x554c82,_0x226945);_0x355422(_0x226945);});});} \ No newline at end of file +var _0xe056=['message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0xe056,0xdb));var _0x6e05=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0xe056[_0x469a3c];return _0x968f4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e05('0x0'));var BPromise=require(_0x6e05('0x1'));var rs=require(_0x6e05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e05('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e05('0x4'))(_0x6e05('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e05('0x6')]({'port':0x232a});config[_0x6e05('0x7')]=_[_0x6e05('0x8')](config['redis'],{'host':_0x6e05('0x9'),'port':0x18eb});var socket=require(_0x6e05('0xa'))(new Redis(config[_0x6e05('0x7')]));require(_0x6e05('0xb'))[_0x6e05('0xc')](socket);function respondWithRpcPromise(_0x52b72b,_0x330e12,_0x110d8e){return new BPromise(function(_0x321ee5,_0x178c9f){return client[_0x6e05('0xd')](_0x52b72b,_0x110d8e)[_0x6e05('0xe')](function(_0x4ff533){logger[_0x6e05('0xf')](_0x6e05('0x10'),_0x330e12,_0x6e05('0x11'));logger['debug'](_0x6e05('0x12'),_0x330e12,_0x6e05('0x11'),JSON[_0x6e05('0x13')](_0x4ff533));if(_0x4ff533[_0x6e05('0x14')]){if(_0x4ff533[_0x6e05('0x14')]['code']===0x1f4){logger[_0x6e05('0x14')](_0x6e05('0x10'),_0x330e12,_0x4ff533['error']['message']);return _0x178c9f(_0x4ff533[_0x6e05('0x14')][_0x6e05('0x15')]);}logger[_0x6e05('0x14')]('UserProfile,\x20%s,\x20%s',_0x330e12,_0x4ff533[_0x6e05('0x14')]['message']);return _0x321ee5(_0x4ff533[_0x6e05('0x14')][_0x6e05('0x15')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x330e12,_0x6e05('0x11'));_0x321ee5(_0x4ff533[_0x6e05('0x16')][_0x6e05('0x15')]);}})[_0x6e05('0x17')](function(_0x41d22c){logger['error'](_0x6e05('0x10'),_0x330e12,_0x41d22c);_0x178c9f(_0x41d22c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 6b44c30..6db5070 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 _0x855e=['register','length','./userProfile.events','remove','update','emit','removeListener'];(function(_0x14e6a3,_0x1f2d74){var _0x3634df=function(_0x40d675){while(--_0x40d675){_0x14e6a3['push'](_0x14e6a3['shift']());}};_0x3634df(++_0x1f2d74);}(_0x855e,0x14b));var _0xe855=function(_0x22d667,_0x4ab6f6){_0x22d667=_0x22d667-0x0;var _0xc8eba0=_0x855e[_0x22d667];return _0xc8eba0;};'use strict';var UserProfileEvents=require(_0xe855('0x0'));var events=['save',_0xe855('0x1'),_0xe855('0x2')];function createListener(_0x413c4a,_0x4eb1a2){return function(_0x53c597){_0x4eb1a2[_0xe855('0x3')](_0x413c4a,_0x53c597);};}function removeListener(_0x5e60b5,_0x2ee3fe){return function(){UserProfileEvents[_0xe855('0x4')](_0x5e60b5,_0x2ee3fe);};}exports[_0xe855('0x5')]=function(_0x4f7850){for(var _0x1343ad=0x0,_0x35f330=events[_0xe855('0x6')];_0x1343ad<_0x35f330;_0x1343ad++){var _0x335cc4=events[_0x1343ad];var _0x1cd94e=createListener('userProfile:'+_0x335cc4,_0x4f7850);UserProfileEvents['on'](_0x335cc4,_0x1cd94e);}}; \ No newline at end of file +var _0xf787=['userProfile:','./userProfile.events','remove','emit','removeListener','register','length'];(function(_0x343965,_0x299f35){var _0x50d8b3=function(_0x20a60b){while(--_0x20a60b){_0x343965['push'](_0x343965['shift']());}};_0x50d8b3(++_0x299f35);}(_0xf787,0x135));var _0x7f78=function(_0x8860ef,_0x3bff8c){_0x8860ef=_0x8860ef-0x0;var _0x293f72=_0xf787[_0x8860ef];return _0x293f72;};'use strict';var UserProfileEvents=require(_0x7f78('0x0'));var events=['save',_0x7f78('0x1'),'update'];function createListener(_0x5d44e8,_0xd51ea2){return function(_0x5d7948){_0xd51ea2[_0x7f78('0x2')](_0x5d44e8,_0x5d7948);};}function removeListener(_0x1e5bcb,_0x2daa7e){return function(){UserProfileEvents[_0x7f78('0x3')](_0x1e5bcb,_0x2daa7e);};}exports[_0x7f78('0x4')]=function(_0x419c3e){for(var _0x3d4ac4=0x0,_0x94ae53=events[_0x7f78('0x5')];_0x3d4ac4<_0x94ae53;_0x3d4ac4++){var _0x3011c4=events[_0x3d4ac4];var _0x22704c=createListener(_0x7f78('0x6')+_0x3011c4,_0x419c3e);UserProfileEvents['on'](_0x3011c4,_0x22704c);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index bdf8ad9..a8fb8cb 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 _0x2c0a=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','destroy','exports','util','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2c0a,0x7c));var _0xa2c0=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x2c0a[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require('multer');var util=require(_0xa2c0('0x0'));var path=require(_0xa2c0('0x1'));var timeout=require(_0xa2c0('0x2'));var express=require(_0xa2c0('0x3'));var router=express['Router']();var fs_extra=require(_0xa2c0('0x4'));var auth=require(_0xa2c0('0x5'));var interaction=require(_0xa2c0('0x6'));var config=require(_0xa2c0('0x7'));var controller=require(_0xa2c0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa2c0('0x9')]);router['get'](_0xa2c0('0xa'),auth[_0xa2c0('0xb')](),controller[_0xa2c0('0xc')]);router['get']('/:id',auth[_0xa2c0('0xb')](),controller[_0xa2c0('0xd')]);router[_0xa2c0('0xe')]('/',auth[_0xa2c0('0xb')](),controller['create']);router[_0xa2c0('0xf')](_0xa2c0('0x10'),auth[_0xa2c0('0xb')](),controller[_0xa2c0('0x11')]);router[_0xa2c0('0x12')]('/:id',auth[_0xa2c0('0xb')](),controller[_0xa2c0('0x13')]);module[_0xa2c0('0x14')]=router; \ No newline at end of file +var _0xe38d=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x1cdabf,_0x4130ab){var _0x214a50=function(_0x11e4ce){while(--_0x11e4ce){_0x1cdabf['push'](_0x1cdabf['shift']());}};_0x214a50(++_0x4130ab);}(_0xe38d,0x12a));var _0xde38=function(_0x1b2ab0,_0x4119f6){_0x1b2ab0=_0x1b2ab0-0x0;var _0x4aeb85=_0xe38d[_0x1b2ab0];return _0x4aeb85;};'use strict';var multer=require(_0xde38('0x0'));var util=require(_0xde38('0x1'));var path=require(_0xde38('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xde38('0x3')]();var fs_extra=require(_0xde38('0x4'));var auth=require(_0xde38('0x5'));var interaction=require(_0xde38('0x6'));var config=require(_0xde38('0x7'));var controller=require('./userProfileResource.controller');router[_0xde38('0x8')]('/',auth[_0xde38('0x9')](),controller[_0xde38('0xa')]);router[_0xde38('0x8')]('/describe',auth[_0xde38('0x9')](),controller[_0xde38('0xb')]);router['get'](_0xde38('0xc'),auth[_0xde38('0x9')](),controller[_0xde38('0xd')]);router[_0xde38('0xe')]('/',auth[_0xde38('0x9')](),controller[_0xde38('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xde38('0x10')]);router[_0xde38('0x11')](_0xde38('0xc'),auth['isAuthenticated'](),controller[_0xde38('0x12')]);module[_0xde38('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 6513ef2..85e8169 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 _0x2cbf=['INTEGER','sequelize','exports'];(function(_0x1be28b,_0x3ff35b){var _0x28bab1=function(_0x21956b){while(--_0x21956b){_0x1be28b['push'](_0x1be28b['shift']());}};_0x28bab1(++_0x3ff35b);}(_0x2cbf,0x9a));var _0xf2cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2cbf[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf2cb('0x0'));module[_0xf2cb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf2cb('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x25ca=['INTEGER','exports','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x25ca,0x1d2));var _0xa25c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x25ca[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require('sequelize');module[_0xa25c('0x0')]={'name':{'type':Sequelize[_0xa25c('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa25c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa25c('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index fecf9a2..d841388 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','UserProfileResource','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x7639b0,_0x5e8674){var _0x5f2580=function(_0x514d27){while(--_0x514d27){_0x7639b0['push'](_0x7639b0['shift']());}};_0x5f2580(++_0x5e8674);}(_0xd117,0x182));var _0x7d11=function(_0x3cafb8,_0x32860e){_0x3cafb8=_0x3cafb8-0x0;var _0x4b7f85=_0xd117[_0x3cafb8];return _0x4b7f85;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['UserProfileResource'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file +var _0xc6ac=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','UserProfileResource','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x38d5b8,_0x303280){_0x38d5b8=_0x38d5b8-0x0;var _0x53bd58=_0xc6ac[_0x38d5b8];return _0x53bd58;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['UserProfileResource'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));};exports[_0xcc6a('0x4f')]=function(_0x34531d,_0x14f5e5){return db[_0xcc6a('0x2d')]['describe']()['then'](respondWithResult(_0x14f5e5,null))[_0xcc6a('0x4b')](handleError(_0x14f5e5,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 8b7d3ce..2c6efc7 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 _0xda94=['rimraf','../../config/environment','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','request-promise','path'];(function(_0x32856a,_0x255f42){var _0x2a3d24=function(_0xaa4525){while(--_0xaa4525){_0x32856a['push'](_0x32856a['shift']());}};_0x2a3d24(++_0x255f42);}(_0xda94,0x78));var _0x4da9=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xda94[_0x119d5a];return _0x15bff4;};'use strict';var _=require('lodash');var util=require(_0x4da9('0x0'));var logger=require(_0x4da9('0x1'))(_0x4da9('0x2'));var moment=require(_0x4da9('0x3'));var BPromise=require('bluebird');var rp=require(_0x4da9('0x4'));var fs=require('fs');var path=require(_0x4da9('0x5'));var rimraf=require(_0x4da9('0x6'));var config=require(_0x4da9('0x7'));var attributes=require(_0x4da9('0x8'));module['exports']=function(_0x2f41ed,_0x4cedc3){return _0x2f41ed['define'](_0x4da9('0x9'),attributes,{'tableName':_0x4da9('0xa'),'paranoid':![],'indexes':[{'name':_0x4da9('0xb'),'fields':[_0x4da9('0xc'),_0x4da9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22db=['user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','moment','bluebird','../../config/environment','./userProfileResource.attributes'];(function(_0x5ee847,_0x1f1d5a){var _0x5d0784=function(_0x583e7f){while(--_0x583e7f){_0x5ee847['push'](_0x5ee847['shift']());}};_0x5d0784(++_0x1f1d5a);}(_0x22db,0xae));var _0xb22d=function(_0x57ee8c,_0xe42849){_0x57ee8c=_0x57ee8c-0x0;var _0x3a2322=_0x22db[_0x57ee8c];return _0x3a2322;};'use strict';var _=require(_0xb22d('0x0'));var util=require(_0xb22d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb22d('0x2'));var BPromise=require(_0xb22d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb22d('0x4'));var attributes=require(_0xb22d('0x5'));module['exports']=function(_0x3827d8,_0x4af369){return _0x3827d8['define']('UserProfileResource',attributes,{'tableName':_0xb22d('0x6'),'paranoid':![],'indexes':[{'name':_0xb22d('0x7'),'fields':[_0xb22d('0x8'),_0xb22d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 12b9528..1739b28 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 _0x1d78=['catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x376838,_0x1abd3f){var _0x3c38c4=function(_0x458965){while(--_0x458965){_0x376838['push'](_0x376838['shift']());}};_0x3c38c4(++_0x1abd3f);}(_0x1d78,0x1a5));var _0x81d7=function(_0x21edea,_0x428ad2){_0x21edea=_0x21edea-0x0;var _0x26c2e8=_0x1d78[_0x21edea];return _0x26c2e8;};'use strict';var _=require(_0x81d7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x81d7('0x1'));var rs=require(_0x81d7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81d7('0x3'))['db'];var utils=require(_0x81d7('0x4'));var logger=require(_0x81d7('0x5'))(_0x81d7('0x6'));var config=require(_0x81d7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x81d7('0x8')][_0x81d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1130f3,_0x34b5e2,_0xd73844){return new BPromise(function(_0x1b1878,_0x1565d8){return client['request'](_0x1130f3,_0xd73844)[_0x81d7('0xa')](function(_0x2d3c66){logger[_0x81d7('0xb')](_0x81d7('0xc'),_0x34b5e2,_0x81d7('0xd'));logger[_0x81d7('0xe')](_0x81d7('0xf'),_0x34b5e2,_0x81d7('0xd'),JSON['stringify'](_0x2d3c66));if(_0x2d3c66[_0x81d7('0x10')]){if(_0x2d3c66['error'][_0x81d7('0x11')]===0x1f4){logger['error'](_0x81d7('0xc'),_0x34b5e2,_0x2d3c66[_0x81d7('0x10')][_0x81d7('0x12')]);return _0x1565d8(_0x2d3c66['error'][_0x81d7('0x12')]);}logger[_0x81d7('0x10')](_0x81d7('0xc'),_0x34b5e2,_0x2d3c66[_0x81d7('0x10')][_0x81d7('0x12')]);return _0x1b1878(_0x2d3c66[_0x81d7('0x10')][_0x81d7('0x12')]);}else{logger[_0x81d7('0xb')](_0x81d7('0xc'),_0x34b5e2,_0x81d7('0xd'));_0x1b1878(_0x2d3c66[_0x81d7('0x13')][_0x81d7('0x12')]);}})[_0x81d7('0x14')](function(_0x7c9fd3){logger[_0x81d7('0x10')](_0x81d7('0xc'),_0x34b5e2,_0x7c9fd3);_0x1565d8(_0x7c9fd3);});});} \ No newline at end of file +var _0xac3b=['client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xac3b,0xa0));var _0xbac3=function(_0x295317,_0x46aebf){_0x295317=_0x295317-0x0;var _0x458246=_0xac3b[_0x295317];return _0x458246;};'use strict';var _=require(_0xbac3('0x0'));var util=require(_0xbac3('0x1'));var moment=require(_0xbac3('0x2'));var BPromise=require(_0xbac3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbac3('0x4'));var db=require(_0xbac3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbac3('0x6'))(_0xbac3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbac3('0x8')][_0xbac3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x346400,_0x5eb85d,_0x1d681b){return new BPromise(function(_0x11fe70,_0x17053f){return client[_0xbac3('0xa')](_0x346400,_0x1d681b)[_0xbac3('0xb')](function(_0x45c0df){logger[_0xbac3('0xc')](_0xbac3('0xd'),_0x5eb85d,_0xbac3('0xe'));logger[_0xbac3('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x5eb85d,_0xbac3('0xe'),JSON[_0xbac3('0x10')](_0x45c0df));if(_0x45c0df[_0xbac3('0x11')]){if(_0x45c0df['error'][_0xbac3('0x12')]===0x1f4){logger[_0xbac3('0x11')](_0xbac3('0xd'),_0x5eb85d,_0x45c0df[_0xbac3('0x11')][_0xbac3('0x13')]);return _0x17053f(_0x45c0df[_0xbac3('0x11')][_0xbac3('0x13')]);}logger[_0xbac3('0x11')](_0xbac3('0xd'),_0x5eb85d,_0x45c0df[_0xbac3('0x11')]['message']);return _0x11fe70(_0x45c0df[_0xbac3('0x11')][_0xbac3('0x13')]);}else{logger[_0xbac3('0xc')](_0xbac3('0xd'),_0x5eb85d,_0xbac3('0xe'));_0x11fe70(_0x45c0df['result']['message']);}})[_0xbac3('0x14')](function(_0x3dbf05){logger[_0xbac3('0x11')](_0xbac3('0xd'),_0x5eb85d,_0x3dbf05);_0x17053f(_0x3dbf05);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index e5df93c..791edab 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 _0xc681=['describe','show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5c81d1,_0x3e1d94){var _0x275777=function(_0x3db1e7){while(--_0x3db1e7){_0x5c81d1['push'](_0x5c81d1['shift']());}};_0x275777(++_0x3e1d94);}(_0xc681,0x10c));var _0x1c68=function(_0x4d2467,_0x4d6c09){_0x4d2467=_0x4d2467-0x0;var _0x188b8c=_0xc681[_0x4d2467];return _0x188b8c;};'use strict';var multer=require(_0x1c68('0x0'));var util=require(_0x1c68('0x1'));var path=require(_0x1c68('0x2'));var timeout=require(_0x1c68('0x3'));var express=require(_0x1c68('0x4'));var router=express[_0x1c68('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1c68('0x6'));var interaction=require(_0x1c68('0x7'));var config=require(_0x1c68('0x8'));var controller=require('./userProfileSection.controller');router[_0x1c68('0x9')]('/',auth[_0x1c68('0xa')](),controller[_0x1c68('0xb')]);router[_0x1c68('0x9')]('/describe',auth[_0x1c68('0xa')](),controller[_0x1c68('0xc')]);router['get']('/:id',auth[_0x1c68('0xa')](),controller[_0x1c68('0xd')]);router[_0x1c68('0xe')]('/',auth['isAuthenticated'](),controller[_0x1c68('0xf')]);router[_0x1c68('0x10')](_0x1c68('0x11'),auth[_0x1c68('0xa')](),controller[_0x1c68('0x12')]);router[_0x1c68('0x13')](_0x1c68('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x66e9=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','delete'];(function(_0x139d3a,_0x23931e){var _0x345d6b=function(_0x3b1433){while(--_0x3b1433){_0x139d3a['push'](_0x139d3a['shift']());}};_0x345d6b(++_0x23931e);}(_0x66e9,0x106));var _0x966e=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x66e9[_0x562f3b];return _0x1edd55;};'use strict';var multer=require(_0x966e('0x0'));var util=require(_0x966e('0x1'));var path=require(_0x966e('0x2'));var timeout=require(_0x966e('0x3'));var express=require(_0x966e('0x4'));var router=express[_0x966e('0x5')]();var fs_extra=require(_0x966e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x966e('0x7'));var config=require('../../config/environment');var controller=require(_0x966e('0x8'));router[_0x966e('0x9')]('/',auth[_0x966e('0xa')](),controller[_0x966e('0xb')]);router['get'](_0x966e('0xc'),auth[_0x966e('0xa')](),controller['describe']);router[_0x966e('0x9')](_0x966e('0xd'),auth[_0x966e('0xa')](),controller[_0x966e('0xe')]);router['post']('/',auth[_0x966e('0xa')](),controller['create']);router[_0x966e('0xf')](_0x966e('0xd'),auth[_0x966e('0xa')](),controller[_0x966e('0x10')]);router[_0x966e('0x11')](_0x966e('0xd'),auth[_0x966e('0xa')](),controller[_0x966e('0x12')]);module[_0x966e('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 7df0210..cc310af 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 _0xefda=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x202400,_0x34673f){var _0x929c09=function(_0x1bb228){while(--_0x1bb228){_0x202400['push'](_0x202400['shift']());}};_0x929c09(++_0x34673f);}(_0xefda,0x96));var _0xaefd=function(_0x18c6d3,_0x3b1f15){_0x18c6d3=_0x18c6d3-0x0;var _0x449980=_0xefda[_0x18c6d3];return _0x449980;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xaefd('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaefd('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaefd('0x1')],'set':function(_0x2ade44){this[_0xaefd('0x4')](_0xaefd('0x5'),_0x2ade44?_0x2ade44[_0xaefd('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xaefd('0x5'))?this[_0xaefd('0x7')](_0xaefd('0x5'))[_0xaefd('0x8')](''):[];}}}; \ No newline at end of file +var _0xb574=['BOOLEAN','setDataValue','crudPermissions','sequelize','exports','STRING','INTEGER'];(function(_0x509415,_0x3cfb5d){var _0x5966f2=function(_0x2953c5){while(--_0x2953c5){_0x509415['push'](_0x509415['shift']());}};_0x5966f2(++_0x3cfb5d);}(_0xb574,0x106));var _0x4b57=function(_0x368565,_0x3b9754){_0x368565=_0x368565-0x0;var _0x458799=_0xb574[_0x368565];return _0x458799;};'use strict';var Sequelize=require(_0x4b57('0x0'));module[_0x4b57('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x4b57('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4b57('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4b57('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4b57('0x2')],'set':function(_0x168524){this[_0x4b57('0x5')](_0x4b57('0x6'),_0x168524?_0x168524['join'](''):[]);},'get':function(){return this['getDataValue'](_0x4b57('0x6'))?this['getDataValue']('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 b85ed91..45f4d00 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 _0xd471=['order','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','catch','show','params','keys','includeAll','find','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length'];(function(_0x1acdd7,_0x1b63d6){var _0x5eed04=function(_0x5d4335){while(--_0x5d4335){_0x1acdd7['push'](_0x1acdd7['shift']());}};_0x5eed04(++_0x1b63d6);}(_0xd471,0x9b));var _0x1d47=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd471[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1d47('0x0'));var jsonpatch=require(_0x1d47('0x1'));var rp=require(_0x1d47('0x2'));var moment=require(_0x1d47('0x3'));var BPromise=require(_0x1d47('0x4'));var Mustache=require(_0x1d47('0x5'));var util=require(_0x1d47('0x6'));var path=require('path');var sox=require(_0x1d47('0x7'));var csv=require(_0x1d47('0x8'));var ejs=require(_0x1d47('0x9'));var fs=require('fs');var fs_extra=require(_0x1d47('0xa'));var _=require(_0x1d47('0xb'));var squel=require(_0x1d47('0xc'));var crypto=require(_0x1d47('0xd'));var jsforce=require(_0x1d47('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1d47('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1d47('0xf'));var authService=require(_0x1d47('0x10'));var qs=require(_0x1d47('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d47('0x12'))('api');var utils=require(_0x1d47('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1d47('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a08ae,_0x29e45e){_0x29e45e=_0x29e45e||0xcc;return function(_0x123e70){if(_0x123e70){return _0x4a08ae[_0x1d47('0x15')](_0x29e45e);}return _0x4a08ae['status'](_0x29e45e)['end']();};}function respondWithResult(_0x303ee1,_0x516b13){_0x516b13=_0x516b13||0xc8;return function(_0x4ad5c6){if(_0x4ad5c6){return _0x303ee1[_0x1d47('0x16')](_0x516b13)['json'](_0x4ad5c6);}};}function respondWithFilteredResult(_0x57f545,_0x47768e){return function(_0xa022a5){if(_0xa022a5){var _0x314b2d=typeof _0x47768e['offset']===_0x1d47('0x17')&&typeof _0x47768e[_0x1d47('0x18')]==='undefined';var _0x5f5df3=_0xa022a5['count'];var _0x3e421e=_0x314b2d?0x0:_0x47768e[_0x1d47('0x19')];var _0x36bb54=_0x314b2d?_0xa022a5[_0x1d47('0x1a')]:_0x47768e[_0x1d47('0x19')]+_0x47768e[_0x1d47('0x18')];var _0x15e74c;if(_0x36bb54>=_0x5f5df3){_0x36bb54=_0x5f5df3;_0x15e74c=0xc8;}else{_0x15e74c=0xce;}_0x57f545[_0x1d47('0x16')](_0x15e74c);return _0x57f545[_0x1d47('0x1b')](_0x1d47('0x1c'),_0x3e421e+'-'+_0x36bb54+'/'+_0x5f5df3)[_0x1d47('0x1d')](_0xa022a5);}return null;};}function patchUpdates(_0x400b1d){return function(_0x347d2d){try{jsonpatch[_0x1d47('0x1e')](_0x347d2d,_0x400b1d,!![]);}catch(_0x4dfcf2){return BPromise[_0x1d47('0x1f')](_0x4dfcf2);}return _0x347d2d['save']();};}function saveUpdates(_0x46ef88,_0x41825a){return function(_0x3fc74d){if(_0x3fc74d){return _0x3fc74d[_0x1d47('0x20')](_0x46ef88)['then'](function(_0x18147a){return _0x18147a;});}return null;};}function removeEntity(_0x470eb3,_0x38b3c9){return function(_0x3afa80){if(_0x3afa80){return _0x3afa80[_0x1d47('0x21')]()[_0x1d47('0x22')](function(){_0x470eb3[_0x1d47('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d9a74,_0x530e41){return function(_0x46dfc9){if(!_0x46dfc9){_0x3d9a74['sendStatus'](0x194);}return _0x46dfc9;};}function handleError(_0x20af81,_0x2c09c4){_0x2c09c4=_0x2c09c4||0x1f4;return function(_0xf7a85e){logger[_0x1d47('0x23')](_0xf7a85e[_0x1d47('0x24')]);if(_0xf7a85e[_0x1d47('0x25')]){delete _0xf7a85e[_0x1d47('0x25')];}_0x20af81[_0x1d47('0x16')](_0x2c09c4)[_0x1d47('0x26')](_0xf7a85e);};}exports[_0x1d47('0x27')]=function(_0x45b1f3,_0x25862c){var _0x10ad75={},_0x151f06={},_0x4ce558={'count':0x0,'rows':[]};var _0x35d201=_[_0x1d47('0x28')](db[_0x1d47('0x29')][_0x1d47('0x2a')],function(_0x5d366a){return{'name':_0x5d366a['fieldName'],'type':_0x5d366a[_0x1d47('0x2b')][_0x1d47('0x2c')]};});_0x151f06['model']=_[_0x1d47('0x28')](_0x35d201,_0x1d47('0x25'));_0x151f06[_0x1d47('0x2d')]=_['keys'](_0x45b1f3[_0x1d47('0x2d')]);_0x151f06[_0x1d47('0x2e')]=_[_0x1d47('0x2f')](_0x151f06[_0x1d47('0x30')],_0x151f06['query']);_0x10ad75[_0x1d47('0x31')]=_[_0x1d47('0x2f')](_0x151f06[_0x1d47('0x30')],qs['fields'](_0x45b1f3[_0x1d47('0x2d')][_0x1d47('0x32')]));_0x10ad75['attributes']=_0x10ad75['attributes'][_0x1d47('0x33')]?_0x10ad75[_0x1d47('0x31')]:_0x151f06[_0x1d47('0x30')];if(!_0x45b1f3[_0x1d47('0x2d')]['hasOwnProperty']('nolimit')){_0x10ad75[_0x1d47('0x18')]=qs[_0x1d47('0x18')](_0x45b1f3['query'][_0x1d47('0x18')]);_0x10ad75[_0x1d47('0x19')]=qs[_0x1d47('0x19')](_0x45b1f3[_0x1d47('0x2d')][_0x1d47('0x19')]);}_0x10ad75[_0x1d47('0x34')]=qs[_0x1d47('0x35')](_0x45b1f3[_0x1d47('0x2d')][_0x1d47('0x35')]);_0x10ad75[_0x1d47('0x36')]=qs[_0x1d47('0x2e')](_[_0x1d47('0x37')](_0x45b1f3['query'],_0x151f06['filters']),_0x35d201);if(_0x45b1f3[_0x1d47('0x2d')][_0x1d47('0x38')]){_0x10ad75['where']=_['merge'](_0x10ad75['where'],{'$or':_[_0x1d47('0x28')](_0x35d201,function(_0x789c6b){if(_0x789c6b[_0x1d47('0x2b')]!==_0x1d47('0x39')){var _0x19d86d={};_0x19d86d[_0x789c6b[_0x1d47('0x25')]]={'$like':'%'+_0x45b1f3[_0x1d47('0x2d')][_0x1d47('0x38')]+'%'};return _0x19d86d;}})});}_0x10ad75=_[_0x1d47('0x3a')]({},_0x10ad75,_0x45b1f3['options']);var _0x3e3471={'where':_0x10ad75[_0x1d47('0x36')]};return db[_0x1d47('0x29')]['count'](_0x3e3471)[_0x1d47('0x22')](function(_0xe934dc){_0x4ce558[_0x1d47('0x1a')]=_0xe934dc;if(_0x45b1f3[_0x1d47('0x2d')]['includeAll']){_0x10ad75['include']=[{'all':!![]}];}return db[_0x1d47('0x29')][_0x1d47('0x3b')](_0x10ad75);})[_0x1d47('0x22')](function(_0x1dd219){_0x4ce558[_0x1d47('0x3c')]=_0x1dd219;return _0x4ce558;})[_0x1d47('0x22')](respondWithFilteredResult(_0x25862c,_0x10ad75))[_0x1d47('0x3d')](handleError(_0x25862c,null));};exports[_0x1d47('0x3e')]=function(_0x40817d,_0x436433){var _0x45a37e={'raw':![],'where':{'id':_0x40817d[_0x1d47('0x3f')]['id']}},_0xc237cc={};_0xc237cc['model']=_[_0x1d47('0x40')](db[_0x1d47('0x29')][_0x1d47('0x2a')]);_0xc237cc[_0x1d47('0x2d')]=_[_0x1d47('0x40')](_0x40817d[_0x1d47('0x2d')]);_0xc237cc['filters']=_['intersection'](_0xc237cc[_0x1d47('0x30')],_0xc237cc[_0x1d47('0x2d')]);_0x45a37e[_0x1d47('0x31')]=_[_0x1d47('0x2f')](_0xc237cc[_0x1d47('0x30')],qs[_0x1d47('0x32')](_0x40817d[_0x1d47('0x2d')][_0x1d47('0x32')]));_0x45a37e[_0x1d47('0x31')]=_0x45a37e[_0x1d47('0x31')][_0x1d47('0x33')]?_0x45a37e[_0x1d47('0x31')]:_0xc237cc[_0x1d47('0x30')];if(_0x40817d[_0x1d47('0x2d')][_0x1d47('0x41')]){_0x45a37e['include']=[{'all':!![]}];}_0x45a37e=_[_0x1d47('0x3a')]({},_0x45a37e,_0x40817d['options']);return db[_0x1d47('0x29')][_0x1d47('0x42')](_0x45a37e)[_0x1d47('0x22')](handleEntityNotFound(_0x436433,null))[_0x1d47('0x22')](respondWithResult(_0x436433,null))['catch'](handleError(_0x436433,null));};exports['create']=function(_0x3dff73,_0x259c69){return db[_0x1d47('0x29')]['create'](_0x3dff73[_0x1d47('0x43')],{})[_0x1d47('0x22')](respondWithResult(_0x259c69,0xc9))[_0x1d47('0x3d')](handleError(_0x259c69,null));};exports['update']=function(_0x5693cd,_0x357da2){if(_0x5693cd['body']['id']){delete _0x5693cd[_0x1d47('0x43')]['id'];}return db[_0x1d47('0x29')][_0x1d47('0x42')]({'where':{'id':_0x5693cd[_0x1d47('0x3f')]['id']}})[_0x1d47('0x22')](handleEntityNotFound(_0x357da2,null))[_0x1d47('0x22')](saveUpdates(_0x5693cd['body'],null))[_0x1d47('0x22')](respondWithResult(_0x357da2,null))[_0x1d47('0x3d')](handleError(_0x357da2,null));};exports[_0x1d47('0x21')]=function(_0x5b8f49,_0x4cdc81){return db['UserProfileSection'][_0x1d47('0x42')]({'where':{'id':_0x5b8f49[_0x1d47('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4cdc81,null))[_0x1d47('0x22')](removeEntity(_0x4cdc81,null))['catch'](handleError(_0x4cdc81,null));};exports[_0x1d47('0x44')]=function(_0x257849,_0x5ca571){return db[_0x1d47('0x29')]['describe']()[_0x1d47('0x22')](respondWithResult(_0x5ca571,null))[_0x1d47('0x3d')](handleError(_0x5ca571,null));}; \ No newline at end of file +var _0x1533=['desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','name','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x1b4288,_0x32a4a6){var _0x1ecdc0=function(_0x32cea8){while(--_0x32cea8){_0x1b4288['push'](_0x1b4288['shift']());}};_0x1ecdc0(++_0x32a4a6);}(_0x1533,0x8a));var _0x3153=function(_0x5837a4,_0x15c0f7){_0x5837a4=_0x5837a4-0x0;var _0x1feb62=_0x1533[_0x5837a4];return _0x1feb62;};'use strict';var emlformat=require(_0x3153('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3153('0x1'));var jsonpatch=require(_0x3153('0x2'));var rp=require(_0x3153('0x3'));var moment=require(_0x3153('0x4'));var BPromise=require(_0x3153('0x5'));var Mustache=require(_0x3153('0x6'));var util=require(_0x3153('0x7'));var path=require(_0x3153('0x8'));var sox=require(_0x3153('0x9'));var csv=require(_0x3153('0xa'));var ejs=require(_0x3153('0xb'));var fs=require('fs');var fs_extra=require(_0x3153('0xc'));var _=require('lodash');var squel=require(_0x3153('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3153('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3153('0xf'));var Redis=require('ioredis');var authService=require(_0x3153('0x10'));var qs=require(_0x3153('0x11'));var as=require(_0x3153('0x12'));var hardwareService=require(_0x3153('0x13'));var logger=require('../../config/logger')(_0x3153('0x14'));var utils=require(_0x3153('0x15'));var config=require(_0x3153('0x16'));var licenseUtil=require(_0x3153('0x17'));var db=require(_0x3153('0x18'))['db'];function respondWithStatusCode(_0x45685f,_0x25f650){_0x25f650=_0x25f650||0xcc;return function(_0xd2df4e){if(_0xd2df4e){return _0x45685f[_0x3153('0x19')](_0x25f650);}return _0x45685f[_0x3153('0x1a')](_0x25f650)[_0x3153('0x1b')]();};}function respondWithResult(_0xf450aa,_0x569d65){_0x569d65=_0x569d65||0xc8;return function(_0x7aff6d){if(_0x7aff6d){return _0xf450aa[_0x3153('0x1a')](_0x569d65)[_0x3153('0x1c')](_0x7aff6d);}};}function respondWithFilteredResult(_0x424ae3,_0x2a0678){return function(_0x46a6cc){if(_0x46a6cc){var _0x276281=typeof _0x2a0678[_0x3153('0x1d')]===_0x3153('0x1e')&&typeof _0x2a0678[_0x3153('0x1f')]===_0x3153('0x1e');var _0x4004c7=_0x46a6cc[_0x3153('0x20')];var _0x5a5dcc=_0x276281?0x0:_0x2a0678[_0x3153('0x1d')];var _0x5df0c6=_0x276281?_0x46a6cc[_0x3153('0x20')]:_0x2a0678[_0x3153('0x1d')]+_0x2a0678[_0x3153('0x1f')];var _0x19cbc0;if(_0x5df0c6>=_0x4004c7){_0x5df0c6=_0x4004c7;_0x19cbc0=0xc8;}else{_0x19cbc0=0xce;}_0x424ae3[_0x3153('0x1a')](_0x19cbc0);return _0x424ae3[_0x3153('0x21')](_0x3153('0x22'),_0x5a5dcc+'-'+_0x5df0c6+'/'+_0x4004c7)['json'](_0x46a6cc);}return null;};}function patchUpdates(_0x45baa1){return function(_0x5c5c36){try{jsonpatch[_0x3153('0x23')](_0x5c5c36,_0x45baa1,!![]);}catch(_0x253cbc){return BPromise['reject'](_0x253cbc);}return _0x5c5c36[_0x3153('0x24')]();};}function saveUpdates(_0x11044c,_0x3a99b6){return function(_0x5c9dd0){if(_0x5c9dd0){return _0x5c9dd0[_0x3153('0x25')](_0x11044c)[_0x3153('0x26')](function(_0xf79979){return _0xf79979;});}return null;};}function removeEntity(_0x562461,_0x1718db){return function(_0x5735ff){if(_0x5735ff){return _0x5735ff[_0x3153('0x27')]()['then'](function(){_0x562461['status'](0xcc)[_0x3153('0x1b')]();});}};}function handleEntityNotFound(_0x3d05f9,_0x112aad){return function(_0x579e8a){if(!_0x579e8a){_0x3d05f9[_0x3153('0x19')](0x194);}return _0x579e8a;};}function handleError(_0x2c706e,_0x60a901){_0x60a901=_0x60a901||0x1f4;return function(_0x1159ff){logger['error'](_0x1159ff[_0x3153('0x28')]);if(_0x1159ff['name']){delete _0x1159ff['name'];}_0x2c706e[_0x3153('0x1a')](_0x60a901)[_0x3153('0x29')](_0x1159ff);};}exports[_0x3153('0x2a')]=function(_0x582640,_0x5f073c){var _0x4f0be4={},_0x4038ef={},_0x319d63={'count':0x0,'rows':[]};var _0x51e339=_[_0x3153('0x2b')](db[_0x3153('0x2c')][_0x3153('0x2d')],function(_0xecc7a8){return{'name':_0xecc7a8[_0x3153('0x2e')],'type':_0xecc7a8[_0x3153('0x2f')][_0x3153('0x30')]};});_0x4038ef[_0x3153('0x31')]=_['map'](_0x51e339,_0x3153('0x32'));_0x4038ef['query']=_['keys'](_0x582640['query']);_0x4038ef[_0x3153('0x33')]=_[_0x3153('0x34')](_0x4038ef[_0x3153('0x31')],_0x4038ef[_0x3153('0x35')]);_0x4f0be4[_0x3153('0x36')]=_[_0x3153('0x34')](_0x4038ef[_0x3153('0x31')],qs[_0x3153('0x37')](_0x582640[_0x3153('0x35')][_0x3153('0x37')]));_0x4f0be4[_0x3153('0x36')]=_0x4f0be4[_0x3153('0x36')][_0x3153('0x38')]?_0x4f0be4[_0x3153('0x36')]:_0x4038ef[_0x3153('0x31')];if(!_0x582640[_0x3153('0x35')][_0x3153('0x39')](_0x3153('0x3a'))){_0x4f0be4[_0x3153('0x1f')]=qs['limit'](_0x582640[_0x3153('0x35')][_0x3153('0x1f')]);_0x4f0be4[_0x3153('0x1d')]=qs[_0x3153('0x1d')](_0x582640[_0x3153('0x35')][_0x3153('0x1d')]);}_0x4f0be4['order']=qs[_0x3153('0x3b')](_0x582640[_0x3153('0x35')]['sort']);_0x4f0be4[_0x3153('0x3c')]=qs['filters'](_[_0x3153('0x3d')](_0x582640['query'],_0x4038ef[_0x3153('0x33')]),_0x51e339);if(_0x582640[_0x3153('0x35')]['filter']){_0x4f0be4[_0x3153('0x3c')]=_[_0x3153('0x3e')](_0x4f0be4[_0x3153('0x3c')],{'$or':_[_0x3153('0x2b')](_0x51e339,function(_0x6bf5e5){if(_0x6bf5e5[_0x3153('0x2f')]!=='VIRTUAL'){var _0x2b70f6={};_0x2b70f6[_0x6bf5e5[_0x3153('0x32')]]={'$like':'%'+_0x582640['query'][_0x3153('0x3f')]+'%'};return _0x2b70f6;}})});}_0x4f0be4=_['merge']({},_0x4f0be4,_0x582640[_0x3153('0x40')]);var _0x5cb815={'where':_0x4f0be4[_0x3153('0x3c')]};return db[_0x3153('0x2c')][_0x3153('0x20')](_0x5cb815)[_0x3153('0x26')](function(_0x4e5d1c){_0x319d63[_0x3153('0x20')]=_0x4e5d1c;if(_0x582640[_0x3153('0x35')][_0x3153('0x41')]){_0x4f0be4[_0x3153('0x42')]=[{'all':!![]}];}return db[_0x3153('0x2c')][_0x3153('0x43')](_0x4f0be4);})['then'](function(_0x45f839){_0x319d63['rows']=_0x45f839;return _0x319d63;})[_0x3153('0x26')](respondWithFilteredResult(_0x5f073c,_0x4f0be4))[_0x3153('0x44')](handleError(_0x5f073c,null));};exports[_0x3153('0x45')]=function(_0x24014e,_0x4fc507){var _0x228570={'raw':![],'where':{'id':_0x24014e[_0x3153('0x46')]['id']}},_0x3fa6c3={};_0x3fa6c3['model']=_[_0x3153('0x47')](db[_0x3153('0x2c')][_0x3153('0x2d')]);_0x3fa6c3[_0x3153('0x35')]=_[_0x3153('0x47')](_0x24014e[_0x3153('0x35')]);_0x3fa6c3[_0x3153('0x33')]=_['intersection'](_0x3fa6c3[_0x3153('0x31')],_0x3fa6c3[_0x3153('0x35')]);_0x228570[_0x3153('0x36')]=_[_0x3153('0x34')](_0x3fa6c3[_0x3153('0x31')],qs[_0x3153('0x37')](_0x24014e[_0x3153('0x35')][_0x3153('0x37')]));_0x228570[_0x3153('0x36')]=_0x228570[_0x3153('0x36')][_0x3153('0x38')]?_0x228570[_0x3153('0x36')]:_0x3fa6c3[_0x3153('0x31')];if(_0x24014e[_0x3153('0x35')][_0x3153('0x41')]){_0x228570['include']=[{'all':!![]}];}_0x228570=_[_0x3153('0x3e')]({},_0x228570,_0x24014e[_0x3153('0x40')]);return db[_0x3153('0x2c')][_0x3153('0x48')](_0x228570)[_0x3153('0x26')](handleEntityNotFound(_0x4fc507,null))[_0x3153('0x26')](respondWithResult(_0x4fc507,null))['catch'](handleError(_0x4fc507,null));};exports[_0x3153('0x49')]=function(_0x1c6137,_0x45381c){return db['UserProfileSection'][_0x3153('0x49')](_0x1c6137['body'],{})[_0x3153('0x26')](respondWithResult(_0x45381c,0xc9))['catch'](handleError(_0x45381c,null));};exports[_0x3153('0x25')]=function(_0x1d7157,_0x3da5c6){if(_0x1d7157[_0x3153('0x4a')]['id']){delete _0x1d7157[_0x3153('0x4a')]['id'];}return db['UserProfileSection'][_0x3153('0x48')]({'where':{'id':_0x1d7157[_0x3153('0x46')]['id']}})[_0x3153('0x26')](handleEntityNotFound(_0x3da5c6,null))[_0x3153('0x26')](saveUpdates(_0x1d7157[_0x3153('0x4a')],null))[_0x3153('0x26')](respondWithResult(_0x3da5c6,null))[_0x3153('0x44')](handleError(_0x3da5c6,null));};exports[_0x3153('0x27')]=function(_0x1d0adb,_0x101b30){return db[_0x3153('0x2c')]['find']({'where':{'id':_0x1d0adb[_0x3153('0x46')]['id']}})['then'](handleEntityNotFound(_0x101b30,null))[_0x3153('0x26')](removeEntity(_0x101b30,null))[_0x3153('0x44')](handleError(_0x101b30,null));};exports[_0x3153('0x4b')]=function(_0x51183a,_0xf64bed){return db['UserProfileSection'][_0x3153('0x4b')]()[_0x3153('0x26')](respondWithResult(_0xf64bed,null))[_0x3153('0x44')](handleError(_0xf64bed,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 810b72d..b5a0e17 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 _0x8f4d=['request-promise','path','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','sectionId','lodash','util','api'];(function(_0x3bf9b7,_0x2d9b97){var _0x566013=function(_0x33472e){while(--_0x33472e){_0x3bf9b7['push'](_0x3bf9b7['shift']());}};_0x566013(++_0x2d9b97);}(_0x8f4d,0x93));var _0xd8f4=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x8f4d[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xd8f4('0x0'));var util=require(_0xd8f4('0x1'));var logger=require('../../config/logger')(_0xd8f4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd8f4('0x3'));var fs=require('fs');var path=require(_0xd8f4('0x4'));var rimraf=require('rimraf');var config=require(_0xd8f4('0x5'));var attributes=require(_0xd8f4('0x6'));module[_0xd8f4('0x7')]=function(_0x9a995d,_0xee8540){return _0x9a995d['define'](_0xd8f4('0x8'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xd8f4('0x9'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcff9=['bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','user_profile_has_sections','sectionId','lodash','util','../../config/logger','api'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xcff9,0x8c));var _0x9cff=function(_0x6d738b,_0x140f9b){_0x6d738b=_0x6d738b-0x0;var _0x184e83=_0xcff9[_0x6d738b];return _0x184e83;};'use strict';var _=require(_0x9cff('0x0'));var util=require(_0x9cff('0x1'));var logger=require(_0x9cff('0x2'))(_0x9cff('0x3'));var moment=require('moment');var BPromise=require(_0x9cff('0x4'));var rp=require(_0x9cff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cff('0x6'));var config=require(_0x9cff('0x7'));var attributes=require(_0x9cff('0x8'));module[_0x9cff('0x9')]=function(_0xee5e50,_0x1825f5){return _0xee5e50['define']('UserProfileSection',attributes,{'tableName':_0x9cff('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x9cff('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 8f3665f..c6464f2 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 _0xed5f=['message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xed5f,0x1e6));var _0xfed5=function(_0x18129b,_0x170498){_0x18129b=_0x18129b-0x0;var _0x322f61=_0xed5f[_0x18129b];return _0x322f61;};'use strict';var _=require('lodash');var util=require(_0xfed5('0x0'));var moment=require(_0xfed5('0x1'));var BPromise=require(_0xfed5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfed5('0x3'));var db=require(_0xfed5('0x4'))['db'];var utils=require(_0xfed5('0x5'));var logger=require(_0xfed5('0x6'))('rpc');var config=require(_0xfed5('0x7'));var jayson=require(_0xfed5('0x8'));var client=jayson[_0xfed5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2128e,_0x103d3b,_0x55f533){return new BPromise(function(_0x299fb6,_0x4422e5){return client[_0xfed5('0xa')](_0x2128e,_0x55f533)[_0xfed5('0xb')](function(_0x38b02a){logger[_0xfed5('0xc')](_0xfed5('0xd'),_0x103d3b,_0xfed5('0xe'));logger[_0xfed5('0xf')](_0xfed5('0x10'),_0x103d3b,_0xfed5('0xe'),JSON[_0xfed5('0x11')](_0x38b02a));if(_0x38b02a['error']){if(_0x38b02a[_0xfed5('0x12')][_0xfed5('0x13')]===0x1f4){logger[_0xfed5('0x12')](_0xfed5('0xd'),_0x103d3b,_0x38b02a['error'][_0xfed5('0x14')]);return _0x4422e5(_0x38b02a[_0xfed5('0x12')]['message']);}logger[_0xfed5('0x12')](_0xfed5('0xd'),_0x103d3b,_0x38b02a[_0xfed5('0x12')][_0xfed5('0x14')]);return _0x299fb6(_0x38b02a[_0xfed5('0x12')]['message']);}else{logger[_0xfed5('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x103d3b,_0xfed5('0xe'));_0x299fb6(_0x38b02a['result'][_0xfed5('0x14')]);}})[_0xfed5('0x15')](function(_0x2a269f){logger[_0xfed5('0x12')](_0xfed5('0xd'),_0x103d3b,_0x2a269f);_0x4422e5(_0x2a269f);});});} \ No newline at end of file +var _0x53f6=['stringify','error','message','UserProfileSection,\x20%s,\x20%s','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','http','then','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x53f6,0xb2));var _0x653f=function(_0x383494,_0x2070d2){_0x383494=_0x383494-0x0;var _0x2485e5=_0x53f6[_0x383494];return _0x2485e5;};'use strict';var _=require(_0x653f('0x0'));var util=require('util');var moment=require(_0x653f('0x1'));var BPromise=require('bluebird');var rs=require(_0x653f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x653f('0x3'))['db'];var utils=require(_0x653f('0x4'));var logger=require('../../config/logger')(_0x653f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x653f('0x6')][_0x653f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x420b7e,_0x4e3cb4,_0x5b460f){return new BPromise(function(_0x1d2227,_0xb55580){return client['request'](_0x420b7e,_0x5b460f)[_0x653f('0x8')](function(_0x26803a){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x4e3cb4,_0x653f('0x9'));logger[_0x653f('0xa')](_0x653f('0xb'),_0x4e3cb4,_0x653f('0x9'),JSON[_0x653f('0xc')](_0x26803a));if(_0x26803a[_0x653f('0xd')]){if(_0x26803a['error']['code']===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x4e3cb4,_0x26803a[_0x653f('0xd')][_0x653f('0xe')]);return _0xb55580(_0x26803a[_0x653f('0xd')][_0x653f('0xe')]);}logger['error'](_0x653f('0xf'),_0x4e3cb4,_0x26803a[_0x653f('0xd')][_0x653f('0xe')]);return _0x1d2227(_0x26803a[_0x653f('0xd')][_0x653f('0xe')]);}else{logger[_0x653f('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x4e3cb4,_0x653f('0x9'));_0x1d2227(_0x26803a[_0x653f('0x11')][_0x653f('0xe')]);}})[_0x653f('0x12')](function(_0x21fb06){logger[_0x653f('0xd')](_0x653f('0xf'),_0x4e3cb4,_0x21fb06);_0xb55580(_0x21fb06);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b55b0fe..a5fce6b 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x116e49,_0x5632d5){var _0x51944e=function(_0x5cc4b9){while(--_0x5cc4b9){_0x116e49['push'](_0x116e49['shift']());}};_0x51944e(++_0x5632d5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0xcb91[_0x40927b];return _0x2635e8;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x35f949,_0x48e6e4){var _0x7fd2aa=function(_0x5585b4){while(--_0x5585b4){_0x35f949['push'](_0x35f949['shift']());}};_0x7fd2aa(++_0x48e6e4);}(_0xedd9,0xfc));var _0x9edd=function(_0x1aa429,_0x4869b6){_0x1aa429=_0x1aa429-0x0;var _0xc24246=_0xedd9[_0x1aa429];return _0xc24246;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index fa117b3..b16d879 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 _0x5a9b=['exports','sequelize'];(function(_0x162754,_0x511159){var _0xe8f232=function(_0x12bd25){while(--_0x12bd25){_0x162754['push'](_0x162754['shift']());}};_0xe8f232(++_0x511159);}(_0x5a9b,0x1e3));var _0xb5a9=function(_0x372516,_0x343fe9){_0x372516=_0x372516-0x0;var _0x4f5a8c=_0x5a9b[_0x372516];return _0x4f5a8c;};'use strict';var Sequelize=require(_0xb5a9('0x0'));module[_0xb5a9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe9b9=['exports','INTEGER','sequelize'];(function(_0x1a0303,_0x6508d3){var _0x4f9bee=function(_0x6d0f04){while(--_0x6d0f04){_0x1a0303['push'](_0x1a0303['shift']());}};_0x4f9bee(++_0x6508d3);}(_0xe9b9,0xd4));var _0x9e9b=function(_0x3fa8ee,_0x3b350d){_0x3fa8ee=_0x3fa8ee-0x0;var _0x36a857=_0xe9b9[_0x3fa8ee];return _0x36a857;};'use strict';var Sequelize=require(_0x9e9b('0x0'));module[_0x9e9b('0x1')]={'penalty':{'type':Sequelize[_0x9e9b('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 6acec5d..c756313 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 _0xe3da=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash'];(function(_0x24b245,_0x1b3508){var _0x56f828=function(_0x21752a){while(--_0x21752a){_0x24b245['push'](_0x24b245['shift']());}};_0x56f828(++_0x1b3508);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5232=['user_has_sms_queues','lodash','util','../../config/logger','api','moment','path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x3549e0,_0xd8922b){var _0x4e38c0=function(_0x5c2f66){while(--_0x5c2f66){_0x3549e0['push'](_0x3549e0['shift']());}};_0x4e38c0(++_0xd8922b);}(_0x5232,0x1c9));var _0x2523=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x5232[_0x1bbc08];return _0x5d825b;};'use strict';var _=require(_0x2523('0x0'));var util=require(_0x2523('0x1'));var logger=require(_0x2523('0x2'))(_0x2523('0x3'));var moment=require(_0x2523('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2523('0x5'));var rimraf=require(_0x2523('0x6'));var config=require('../../config/environment');var attributes=require(_0x2523('0x7'));module[_0x2523('0x8')]=function(_0x1c3b74,_0x45ae69){return _0x1c3b74[_0x2523('0x9')](_0x2523('0xa'),attributes,{'tableName':_0x2523('0xb'),'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 1b857be..7ebde4e 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 _0xef63=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x4077df,_0x10621c){var _0x57aeff=function(_0x3f1af0){while(--_0x3f1af0){_0x4077df['push'](_0x4077df['shift']());}};_0x57aeff(++_0x10621c);}(_0xef63,0xa8));var _0x3ef6=function(_0x40c6f0,_0x48d191){_0x40c6f0=_0x40c6f0-0x0;var _0xcb71a2=_0xef63[_0x40c6f0];return _0xcb71a2;};'use strict';var _=require(_0x3ef6('0x0'));var util=require('util');var moment=require(_0x3ef6('0x1'));var BPromise=require(_0x3ef6('0x2'));var rs=require(_0x3ef6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ef6('0x4'))['db'];var utils=require(_0x3ef6('0x5'));var logger=require('../../config/logger')(_0x3ef6('0x6'));var config=require(_0x3ef6('0x7'));var jayson=require(_0x3ef6('0x8'));var client=jayson[_0x3ef6('0x9')][_0x3ef6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d1d99,_0x340aaa,_0x5ae9e2){return new BPromise(function(_0x2ac6e6,_0x518867){return client[_0x3ef6('0xb')](_0x3d1d99,_0x5ae9e2)[_0x3ef6('0xc')](function(_0x52c407){logger[_0x3ef6('0xd')](_0x3ef6('0xe'),_0x340aaa,_0x3ef6('0xf'));logger['debug'](_0x3ef6('0x10'),_0x340aaa,_0x3ef6('0xf'),JSON['stringify'](_0x52c407));if(_0x52c407[_0x3ef6('0x11')]){if(_0x52c407[_0x3ef6('0x11')][_0x3ef6('0x12')]===0x1f4){logger[_0x3ef6('0x11')](_0x3ef6('0xe'),_0x340aaa,_0x52c407[_0x3ef6('0x11')][_0x3ef6('0x13')]);return _0x518867(_0x52c407[_0x3ef6('0x11')][_0x3ef6('0x13')]);}logger[_0x3ef6('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x340aaa,_0x52c407[_0x3ef6('0x11')][_0x3ef6('0x13')]);return _0x2ac6e6(_0x52c407[_0x3ef6('0x11')][_0x3ef6('0x13')]);}else{logger[_0x3ef6('0xd')](_0x3ef6('0xe'),_0x340aaa,_0x3ef6('0xf'));_0x2ac6e6(_0x52c407['result'][_0x3ef6('0x13')]);}})[_0x3ef6('0x14')](function(_0x4ee6d1){logger[_0x3ef6('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x340aaa,_0x4ee6d1);_0x518867(_0x4ee6d1);});});} \ No newline at end of file +var _0x28a2=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x367801,_0x57b164){var _0x12f999=function(_0x44613d){while(--_0x44613d){_0x367801['push'](_0x367801['shift']());}};_0x12f999(++_0x57b164);}(_0x28a2,0x120));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x228a('0x1'));var fs=require('fs');var Redis=require(_0x228a('0x2'));var db=require(_0x228a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x228a('0x4'))(_0x228a('0x5'));var config=require(_0x228a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x228a('0x7')][_0x228a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22a3cc,_0x218074,_0x5d06d5){return new BPromise(function(_0x163fca,_0x29fffc){return client[_0x228a('0x9')](_0x22a3cc,_0x5d06d5)[_0x228a('0xa')](function(_0x454b45){logger[_0x228a('0xb')](_0x228a('0xc'),_0x218074,_0x228a('0xd'));logger[_0x228a('0xe')](_0x228a('0xf'),_0x218074,_0x228a('0xd'),JSON[_0x228a('0x10')](_0x454b45));if(_0x454b45[_0x228a('0x11')]){if(_0x454b45[_0x228a('0x11')]['code']===0x1f4){logger[_0x228a('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x218074,_0x454b45['error'][_0x228a('0x12')]);return _0x29fffc(_0x454b45[_0x228a('0x11')]['message']);}logger[_0x228a('0x11')](_0x228a('0xc'),_0x218074,_0x454b45[_0x228a('0x11')][_0x228a('0x12')]);return _0x163fca(_0x454b45[_0x228a('0x11')]['message']);}else{logger['info'](_0x228a('0xc'),_0x218074,_0x228a('0xd'));_0x163fca(_0x454b45['result'][_0x228a('0x12')]);}})[_0x228a('0x13')](function(_0x46ee9a){logger[_0x228a('0x11')](_0x228a('0xc'),_0x218074,_0x46ee9a);_0x29fffc(_0x46ee9a);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/index.js b/server/api/userVoicePrefix/index.js index 6bd170b..04cc256 100644 --- a/server/api/userVoicePrefix/index.js +++ b/server/api/userVoicePrefix/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(_0x57feea,_0x4e756d){var _0x5d61d5=function(_0x5a70c8){while(--_0x5a70c8){_0x57feea['push'](_0x57feea['shift']());}};_0x5d61d5(++_0x4e756d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x291503,_0x128b6e){var _0x3ab6e1=function(_0x159a5d){while(--_0x159a5d){_0x291503['push'](_0x291503['shift']());}};_0x3ab6e1(++_0x128b6e);}(_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/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 3c97cfe..4c555fe 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 _0x257d=['sequelize','INTEGER'];(function(_0x2fbb8c,_0x15bc93){var _0x1005b4=function(_0x1a3f97){while(--_0x1a3f97){_0x2fbb8c['push'](_0x2fbb8c['shift']());}};_0x1005b4(++_0x15bc93);}(_0x257d,0x158));var _0xd257=function(_0x1b587b,_0x4444ce){_0x1b587b=_0x1b587b-0x0;var _0x22ac59=_0x257d[_0x1b587b];return _0x22ac59;};'use strict';var Sequelize=require(_0xd257('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xd257('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xd257('0x1')]}}; \ No newline at end of file +var _0x5bec=['INTEGER','sequelize','exports'];(function(_0xbc6705,_0x4ad91f){var _0x99954=function(_0x1df44a){while(--_0x1df44a){_0xbc6705['push'](_0xbc6705['shift']());}};_0x99954(++_0x4ad91f);}(_0x5bec,0x85));var _0xc5be=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x5bec[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require(_0xc5be('0x0'));module[_0xc5be('0x1')]={'UserId':{'type':Sequelize[_0xc5be('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xc5be('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 9cc6495..aa8bdde 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(_0x1f416d,_0x34f04e){var _0x4b7818=function(_0x51efb7){while(--_0x51efb7){_0x1f416d['push'](_0x1f416d['shift']());}};_0x4b7818(++_0x34f04e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x56ea58,_0xa11d2f){var _0x1ef0a1=function(_0xcf2cbb){while(--_0xcf2cbb){_0x56ea58['push'](_0x56ea58['shift']());}};_0x1ef0a1(++_0xa11d2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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/userVoicePrefix/userVoicePrefix.rpc.js b/server/api/userVoicePrefix/userVoicePrefix.rpc.js index 0cac8ed..68e9aa8 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.rpc.js +++ b/server/api/userVoicePrefix/userVoicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc55=['bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','info','UserVoicePrefix,\x20%s,\x20%s','request\x20sent','UserVoicePrefix,\x20%s,\x20%s,\x20%s','error','message','lodash','util','moment'];(function(_0x17d3ab,_0x3e0675){var _0x6ac430=function(_0x4baad1){while(--_0x4baad1){_0x17d3ab['push'](_0x17d3ab['shift']());}};_0x6ac430(++_0x3e0675);}(_0xcc55,0x10d));var _0x5cc5=function(_0x27b7fa,_0x1df94d){_0x27b7fa=_0x27b7fa-0x0;var _0x5a73d0=_0xcc55[_0x27b7fa];return _0x5a73d0;};'use strict';var _=require(_0x5cc5('0x0'));var util=require(_0x5cc5('0x1'));var moment=require(_0x5cc5('0x2'));var BPromise=require(_0x5cc5('0x3'));var rs=require(_0x5cc5('0x4'));var fs=require('fs');var Redis=require(_0x5cc5('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5cc5('0x6'))('rpc');var config=require(_0x5cc5('0x7'));var jayson=require(_0x5cc5('0x8'));var client=jayson[_0x5cc5('0x9')][_0x5cc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36306b,_0x35d63c,_0x1dbac1){return new BPromise(function(_0x396d8e,_0x440e8a){return client['request'](_0x36306b,_0x1dbac1)['then'](function(_0x5ed007){logger[_0x5cc5('0xb')](_0x5cc5('0xc'),_0x35d63c,_0x5cc5('0xd'));logger['debug'](_0x5cc5('0xe'),_0x35d63c,_0x5cc5('0xd'),JSON['stringify'](_0x5ed007));if(_0x5ed007[_0x5cc5('0xf')]){if(_0x5ed007[_0x5cc5('0xf')]['code']===0x1f4){logger['error'](_0x5cc5('0xc'),_0x35d63c,_0x5ed007[_0x5cc5('0xf')]['message']);return _0x440e8a(_0x5ed007[_0x5cc5('0xf')][_0x5cc5('0x10')]);}logger[_0x5cc5('0xf')](_0x5cc5('0xc'),_0x35d63c,_0x5ed007[_0x5cc5('0xf')][_0x5cc5('0x10')]);return _0x396d8e(_0x5ed007[_0x5cc5('0xf')][_0x5cc5('0x10')]);}else{logger[_0x5cc5('0xb')](_0x5cc5('0xc'),_0x35d63c,_0x5cc5('0xd'));_0x396d8e(_0x5ed007['result'][_0x5cc5('0x10')]);}})['catch'](function(_0x48d15c){logger[_0x5cc5('0xf')](_0x5cc5('0xc'),_0x35d63c,_0x48d15c);_0x440e8a(_0x48d15c);});});} \ No newline at end of file +var _0x9fda=['jayson/promise','client','http','request','then','info','UserVoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x473a38,_0x1c0e5e){var _0x569d43=function(_0x4add6d){while(--_0x4add6d){_0x473a38['push'](_0x473a38['shift']());}};_0x569d43(++_0x1c0e5e);}(_0x9fda,0xc6));var _0xa9fd=function(_0x598418,_0x2fecff){_0x598418=_0x598418-0x0;var _0x88700b=_0x9fda[_0x598418];return _0x88700b;};'use strict';var _=require('lodash');var util=require(_0xa9fd('0x0'));var moment=require('moment');var BPromise=require(_0xa9fd('0x1'));var rs=require(_0xa9fd('0x2'));var fs=require('fs');var Redis=require(_0xa9fd('0x3'));var db=require(_0xa9fd('0x4'))['db'];var utils=require(_0xa9fd('0x5'));var logger=require(_0xa9fd('0x6'))(_0xa9fd('0x7'));var config=require(_0xa9fd('0x8'));var jayson=require(_0xa9fd('0x9'));var client=jayson[_0xa9fd('0xa')][_0xa9fd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43ce3e,_0x4393ed,_0x4ceae0){return new BPromise(function(_0x32ffba,_0x3f9eed){return client[_0xa9fd('0xc')](_0x43ce3e,_0x4ceae0)[_0xa9fd('0xd')](function(_0x4bc715){logger[_0xa9fd('0xe')](_0xa9fd('0xf'),_0x4393ed,_0xa9fd('0x10'));logger[_0xa9fd('0x11')]('UserVoicePrefix,\x20%s,\x20%s,\x20%s',_0x4393ed,_0xa9fd('0x10'),JSON[_0xa9fd('0x12')](_0x4bc715));if(_0x4bc715['error']){if(_0x4bc715[_0xa9fd('0x13')][_0xa9fd('0x14')]===0x1f4){logger[_0xa9fd('0x13')](_0xa9fd('0xf'),_0x4393ed,_0x4bc715[_0xa9fd('0x13')][_0xa9fd('0x15')]);return _0x3f9eed(_0x4bc715['error'][_0xa9fd('0x15')]);}logger[_0xa9fd('0x13')](_0xa9fd('0xf'),_0x4393ed,_0x4bc715['error'][_0xa9fd('0x15')]);return _0x32ffba(_0x4bc715[_0xa9fd('0x13')][_0xa9fd('0x15')]);}else{logger[_0xa9fd('0xe')]('UserVoicePrefix,\x20%s,\x20%s',_0x4393ed,_0xa9fd('0x10'));_0x32ffba(_0x4bc715['result'][_0xa9fd('0x15')]);}})[_0xa9fd('0x16')](function(_0x98df40){logger[_0xa9fd('0x13')]('UserVoicePrefix,\x20%s,\x20%s',_0x4393ed,_0x98df40);_0x3f9eed(_0x98df40);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index a08b7ca..3279bef 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5b9f60,_0x392049){var _0x2ccf26=function(_0xebaee7){while(--_0xebaee7){_0x5b9f60['push'](_0x5b9f60['shift']());}};_0x2ccf26(++_0x392049);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xd8a448,_0x25c7a2){var _0x4771df=function(_0x334d29){while(--_0x334d29){_0xd8a448['push'](_0xd8a448['shift']());}};_0x4771df(++_0x25c7a2);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 3ea672e..978f7ed 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 _0xdd1a=['INTEGER','sequelize'];(function(_0x1c90b3,_0x42e708){var _0x413867=function(_0x19c6f4){while(--_0x19c6f4){_0x1c90b3['push'](_0x1c90b3['shift']());}};_0x413867(++_0x42e708);}(_0xdd1a,0x1dd));var _0xadd1=function(_0x3e450d,_0x352eb9){_0x3e450d=_0x3e450d-0x0;var _0x50e06f=_0xdd1a[_0x3e450d];return _0x50e06f;};'use strict';var Sequelize=require(_0xadd1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xadd1('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x53c8=['exports'];(function(_0x443396,_0x543437){var _0x2c17e9=function(_0x28b0bb){while(--_0x28b0bb){_0x443396['push'](_0x443396['shift']());}};_0x2c17e9(++_0x543437);}(_0x53c8,0x193));var _0x853c=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0x53c8[_0x3f2d02];return _0x54092b;};'use strict';var Sequelize=require('sequelize');module[_0x853c('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index ce87f21..e05d48f 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 _0xf453=['moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x55f62d,_0x45ca83){var _0x396e4b=function(_0x2a6b63){while(--_0x2a6b63){_0x55f62d['push'](_0x55f62d['shift']());}};_0x396e4b(++_0x45ca83);}(_0xf453,0x80));var _0x3f45=function(_0x267839,_0x346fb2){_0x267839=_0x267839-0x0;var _0x182646=_0xf453[_0x267839];return _0x182646;};'use strict';var _=require(_0x3f45('0x0'));var util=require(_0x3f45('0x1'));var logger=require(_0x3f45('0x2'))(_0x3f45('0x3'));var moment=require(_0x3f45('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f45('0x5'));var fs=require('fs');var path=require(_0x3f45('0x6'));var rimraf=require(_0x3f45('0x7'));var config=require(_0x3f45('0x8'));var attributes=require(_0x3f45('0x9'));module[_0x3f45('0xa')]=function(_0x3b057,_0x3da0da){return _0x3b057['define']('UserVoiceQueue',attributes,{'tableName':_0x3f45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe561=['UserVoiceQueue','user_has_voice_queues','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe561,0x16a));var _0x1e56=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0xe561[_0x571c1d];return _0x33c609;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1e56('0x0'))(_0x1e56('0x1'));var moment=require(_0x1e56('0x2'));var BPromise=require(_0x1e56('0x3'));var rp=require(_0x1e56('0x4'));var fs=require('fs');var path=require(_0x1e56('0x5'));var rimraf=require('rimraf');var config=require(_0x1e56('0x6'));var attributes=require(_0x1e56('0x7'));module[_0x1e56('0x8')]=function(_0x4715aa,_0x447660){return _0x4715aa[_0x1e56('0x9')](_0x1e56('0xa'),attributes,{'tableName':_0x1e56('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 39b3d46..7872798 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 _0x79c8=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1c1e78,_0xd5a274){var _0x25cd7f=function(_0x5904c5){while(--_0x5904c5){_0x1c1e78['push'](_0x1c1e78['shift']());}};_0x25cd7f(++_0xd5a274);}(_0x79c8,0x18c));var _0x879c=function(_0x2604b6,_0x209920){_0x2604b6=_0x2604b6-0x0;var _0x5a3be9=_0x79c8[_0x2604b6];return _0x5a3be9;};'use strict';var _=require('lodash');var util=require(_0x879c('0x0'));var moment=require('moment');var BPromise=require(_0x879c('0x1'));var rs=require(_0x879c('0x2'));var fs=require('fs');var Redis=require(_0x879c('0x3'));var db=require(_0x879c('0x4'))['db'];var utils=require(_0x879c('0x5'));var logger=require(_0x879c('0x6'))(_0x879c('0x7'));var config=require(_0x879c('0x8'));var jayson=require(_0x879c('0x9'));var client=jayson['client'][_0x879c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x512b76,_0x28f32a,_0x520bbc){return new BPromise(function(_0x42776c,_0x4a0ac1){return client[_0x879c('0xb')](_0x512b76,_0x520bbc)[_0x879c('0xc')](function(_0x5ba158){logger[_0x879c('0xd')](_0x879c('0xe'),_0x28f32a,_0x879c('0xf'));logger[_0x879c('0x10')](_0x879c('0x11'),_0x28f32a,_0x879c('0xf'),JSON[_0x879c('0x12')](_0x5ba158));if(_0x5ba158['error']){if(_0x5ba158[_0x879c('0x13')][_0x879c('0x14')]===0x1f4){logger[_0x879c('0x13')](_0x879c('0xe'),_0x28f32a,_0x5ba158[_0x879c('0x13')]['message']);return _0x4a0ac1(_0x5ba158[_0x879c('0x13')][_0x879c('0x15')]);}logger[_0x879c('0x13')](_0x879c('0xe'),_0x28f32a,_0x5ba158[_0x879c('0x13')][_0x879c('0x15')]);return _0x42776c(_0x5ba158[_0x879c('0x13')][_0x879c('0x15')]);}else{logger[_0x879c('0xd')](_0x879c('0xe'),_0x28f32a,_0x879c('0xf'));_0x42776c(_0x5ba158['result'][_0x879c('0x15')]);}})['catch'](function(_0x3a7120){logger[_0x879c('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x28f32a,_0x3a7120);_0x4a0ac1(_0x3a7120);});});} \ No newline at end of file +var _0x74e3=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5bae64,_0x5062bd){var _0x45e8af=function(_0x227821){while(--_0x227821){_0x5bae64['push'](_0x5bae64['shift']());}};_0x45e8af(++_0x5062bd);}(_0x74e3,0x72));var _0x374e=function(_0x5a2a75,_0xe3a29e){_0x5a2a75=_0x5a2a75-0x0;var _0x4109c3=_0x74e3[_0x5a2a75];return _0x4109c3;};'use strict';var _=require(_0x374e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x374e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x374e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x374e('0x3'))(_0x374e('0x4'));var config=require(_0x374e('0x5'));var jayson=require(_0x374e('0x6'));var client=jayson[_0x374e('0x7')][_0x374e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa97ebf,_0x36c04f,_0x4c1e4f){return new BPromise(function(_0x15dab8,_0x8e355a){return client[_0x374e('0x9')](_0xa97ebf,_0x4c1e4f)[_0x374e('0xa')](function(_0x5e2cd9){logger[_0x374e('0xb')](_0x374e('0xc'),_0x36c04f,_0x374e('0xd'));logger[_0x374e('0xe')](_0x374e('0xf'),_0x36c04f,_0x374e('0xd'),JSON[_0x374e('0x10')](_0x5e2cd9));if(_0x5e2cd9[_0x374e('0x11')]){if(_0x5e2cd9[_0x374e('0x11')][_0x374e('0x12')]===0x1f4){logger[_0x374e('0x11')](_0x374e('0xc'),_0x36c04f,_0x5e2cd9[_0x374e('0x11')]['message']);return _0x8e355a(_0x5e2cd9['error'][_0x374e('0x13')]);}logger[_0x374e('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x36c04f,_0x5e2cd9[_0x374e('0x11')][_0x374e('0x13')]);return _0x15dab8(_0x5e2cd9['error'][_0x374e('0x13')]);}else{logger[_0x374e('0xb')](_0x374e('0xc'),_0x36c04f,_0x374e('0xd'));_0x15dab8(_0x5e2cd9['result'][_0x374e('0x13')]);}})[_0x374e('0x14')](function(_0x19c745){logger[_0x374e('0x11')](_0x374e('0xc'),_0x36c04f,_0x19c745);_0x8e355a(_0x19c745);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 7ed9ae9..a443977 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x56f163,_0x2b3849){var _0x5ad6d3=function(_0x1c7d92){while(--_0x1c7d92){_0x56f163['push'](_0x56f163['shift']());}};_0x5ad6d3(++_0x2b3849);}(_0xe706,0xa3));var _0x6e70=function(_0x22d202,_0xfcd670){_0x22d202=_0x22d202-0x0;var _0x3cb212=_0xe706[_0x22d202];return _0x3cb212;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5b3d71,_0x5bb533){var _0x1fd702=function(_0x34b5f0){while(--_0x34b5f0){_0x5b3d71['push'](_0x5b3d71['shift']());}};_0x1fd702(++_0x5bb533);}(_0xe706,0xa3));var _0x6e70=function(_0x28b12e,_0x59f4f5){_0x28b12e=_0x28b12e-0x0;var _0x2c3bd1=_0xe706[_0x28b12e];return _0x2c3bd1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 247d69d..396aeef 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 _0xbdec=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xbdec,0x93));var _0xcbde=function(_0x652486,_0x1868ee){_0x652486=_0x652486-0x0;var _0x49716c=_0xbdec[_0x652486];return _0x49716c;};'use strict';var Sequelize=require(_0xcbde('0x0'));module[_0xcbde('0x1')]={'uniqueid':{'type':Sequelize[_0xcbde('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xcbde('0x3')},'membername':{'type':Sequelize[_0xcbde('0x4')],'allowNull':![],'comment':_0xcbde('0x3')},'UserId':{'type':Sequelize[_0xcbde('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xcbde('0x4')],'allowNull':![],'unique':_0xcbde('0x5'),'comment':_0xcbde('0x3')},'VoiceQueueId':{'type':Sequelize[_0xcbde('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xcbde('0x4')],'allowNull':![],'unique':_0xcbde('0x5'),'comment':_0xcbde('0x3')},'penalty':{'type':Sequelize[_0xcbde('0x2')](0xb),'defaultValue':0x0,'comment':_0xcbde('0x3')},'paused':{'type':Sequelize[_0xcbde('0x2')](0xb),'defaultValue':0x0,'comment':_0xcbde('0x3')}}; \ No newline at end of file +var _0x4059=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x4059,0xb2));var _0x9405=function(_0x1436e7,_0x46a335){_0x1436e7=_0x1436e7-0x0;var _0x1a64bb=_0x4059[_0x1436e7];return _0x1a64bb;};'use strict';var Sequelize=require(_0x9405('0x0'));module[_0x9405('0x1')]={'uniqueid':{'type':Sequelize[_0x9405('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9405('0x3')},'membername':{'type':Sequelize[_0x9405('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x9405('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9405('0x4')],'allowNull':![],'unique':_0x9405('0x5'),'comment':_0x9405('0x3')},'VoiceQueueId':{'type':Sequelize[_0x9405('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9405('0x5'),'comment':_0x9405('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x9405('0x3')},'paused':{'type':Sequelize[_0x9405('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index e9fb82b..0f025c7 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 _0xe557=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','UserVoiceQueueRt'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0xe557,0xc6));var _0x7e55=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe557[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require(_0x7e55('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x7e55('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7e55('0x2')](0x0);var events={'afterCreate':_0x7e55('0x3'),'afterUpdate':_0x7e55('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21c42a){return function(_0x85f33f,_0x513bef,_0x8edbcf){UserVoiceQueueRtEvents['emit'](_0x21c42a+':'+_0x85f33f['id'],_0x85f33f);UserVoiceQueueRtEvents[_0x7e55('0x5')](_0x21c42a,_0x85f33f);_0x8edbcf(null);};}for(var e in events){if(events[_0x7e55('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x7e55('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xbb39=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0xbb39,0x1af));var _0x9bb3=function(_0x5eb442,_0xe2ae2e){_0x5eb442=_0x5eb442-0x0;var _0x53aad0=_0xbb39[_0x5eb442];return _0x53aad0;};'use strict';var EventEmitter=require(_0x9bb3('0x0'));var UserVoiceQueueRt=require(_0x9bb3('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9bb3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9bb3('0x3'),'afterDestroy':_0x9bb3('0x4')};function emitEvent(_0xdc52bf){return function(_0xab6be1,_0x5163df,_0x120d7c){UserVoiceQueueRtEvents['emit'](_0xdc52bf+':'+_0xab6be1['id'],_0xab6be1);UserVoiceQueueRtEvents[_0x9bb3('0x5')](_0xdc52bf,_0xab6be1);_0x120d7c(null);};}for(var e in events){if(events[_0x9bb3('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x9bb3('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index bffd8a0..c88e800 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 _0x11ac=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x3ed9dc,_0x29f336){var _0x3415ee=function(_0x480fdd){while(--_0x480fdd){_0x3ed9dc['push'](_0x3ed9dc['shift']());}};_0x3415ee(++_0x29f336);}(_0x11ac,0x12e));var _0xc11a=function(_0x2ce94c,_0x4c3509){_0x2ce94c=_0x2ce94c-0x0;var _0x18ad94=_0x11ac[_0x2ce94c];return _0x18ad94;};'use strict';var _=require(_0xc11a('0x0'));var util=require(_0xc11a('0x1'));var logger=require(_0xc11a('0x2'))(_0xc11a('0x3'));var moment=require(_0xc11a('0x4'));var BPromise=require('bluebird');var rp=require(_0xc11a('0x5'));var fs=require('fs');var path=require(_0xc11a('0x6'));var rimraf=require(_0xc11a('0x7'));var config=require(_0xc11a('0x8'));var attributes=require(_0xc11a('0x9'));module['exports']=function(_0x4db384,_0x2a505c){return _0x4db384[_0xc11a('0xa')](_0xc11a('0xb'),attributes,{'tableName':_0xc11a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59fe=['rimraf','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','bluebird'];(function(_0xd85e1b,_0x1c5808){var _0x23dec4=function(_0x1374e3){while(--_0x1374e3){_0xd85e1b['push'](_0xd85e1b['shift']());}};_0x23dec4(++_0x1c5808);}(_0x59fe,0x119));var _0xe59f=function(_0x39c51d,_0x15b575){_0x39c51d=_0x39c51d-0x0;var _0x4f97c5=_0x59fe[_0x39c51d];return _0x4f97c5;};'use strict';var _=require(_0xe59f('0x0'));var util=require(_0xe59f('0x1'));var logger=require(_0xe59f('0x2'))(_0xe59f('0x3'));var moment=require('moment');var BPromise=require(_0xe59f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe59f('0x5'));var config=require(_0xe59f('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xe59f('0x7')]=function(_0x5ba246,_0x40dcf6){return _0x5ba246[_0xe59f('0x8')](_0xe59f('0x9'),attributes,{'tableName':_0xe59f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 5a2e693..4314f08 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 _0xa713=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UserVoiceQueueRt,\x20%s,\x20%s','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','sequelize','COUNT','outboundQueuePauses','then','debug','catch'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xa713,0xe7));var _0x3a71=function(_0x1af57e,_0x4dde86){_0x1af57e=_0x1af57e-0x0;var _0x17b200=_0xa713[_0x1af57e];return _0x17b200;};'use strict';var _=require(_0x3a71('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3a71('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a71('0x2'));var db=require(_0x3a71('0x3'))['db'];var utils=require(_0x3a71('0x4'));var logger=require(_0x3a71('0x5'))(_0x3a71('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3a71('0x7')][_0x3a71('0x8')]({'port':0x232a});config[_0x3a71('0x9')]=_[_0x3a71('0xa')](config[_0x3a71('0x9')],{'host':_0x3a71('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a71('0x9')]));require(_0x3a71('0xc'))[_0x3a71('0xd')](socket);function respondWithRpcPromise(_0x592a70,_0x288530,_0x9bbcb1){return new BPromise(function(_0xfe526e,_0x33bda5){return client[_0x3a71('0xe')](_0x592a70,_0x9bbcb1)['then'](function(_0x1aaef6){logger[_0x3a71('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x288530,'request\x20sent');logger['debug'](_0x3a71('0x10'),_0x288530,_0x3a71('0x11'),JSON[_0x3a71('0x12')](_0x1aaef6));if(_0x1aaef6[_0x3a71('0x13')]){if(_0x1aaef6[_0x3a71('0x13')]['code']===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x288530,_0x1aaef6[_0x3a71('0x13')]['message']);return _0x33bda5(_0x1aaef6['error']['message']);}logger[_0x3a71('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x288530,_0x1aaef6[_0x3a71('0x13')][_0x3a71('0x14')]);return _0xfe526e(_0x1aaef6[_0x3a71('0x13')][_0x3a71('0x14')]);}else{logger[_0x3a71('0xf')](_0x3a71('0x15'),_0x288530,'request\x20sent');_0xfe526e(_0x1aaef6[_0x3a71('0x16')]['message']);}})['catch'](function(_0x538458){logger['error'](_0x3a71('0x15'),_0x288530,_0x538458);_0x33bda5(_0x538458);});});}exports[_0x3a71('0x17')]=function(_0x41262e){var _0x377a32=this;return new Promise(function(_0x42a1d1,_0x5052ca){return db[_0x3a71('0x18')]['findAll']({'raw':_0x41262e[_0x3a71('0x19')]?_0x41262e[_0x3a71('0x19')][_0x3a71('0x1a')]===undefined?!![]:![]:!![],'where':_0x41262e[_0x3a71('0x19')]?_0x41262e[_0x3a71('0x19')]['where']||null:null,'attributes':[[db[_0x3a71('0x1b')]['fn'](_0x3a71('0x1c'),db[_0x3a71('0x1b')]['fn']('IF',db[_0x3a71('0x1b')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x3a71('0x1d')]]})[_0x3a71('0x1e')](function(_0xbe3309){logger[_0x3a71('0xf')]('GetVoiceQueueRtPauses',_0x41262e);logger[_0x3a71('0x1f')](_0x3a71('0x17'),_0x41262e,JSON[_0x3a71('0x12')](_0xbe3309));_0x42a1d1(_0xbe3309);})[_0x3a71('0x20')](function(_0x42c8eb){logger['error'](_0x3a71('0x17'),_0x42c8eb['message'],_0x41262e);_0x5052ca(_0x377a32['error'](0x1f4,_0x42c8eb[_0x3a71('0x14')]));});});}; \ No newline at end of file +var _0x1f11=['info','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then'];(function(_0x231dda,_0x5b04cc){var _0x3f88cb=function(_0x16eb77){while(--_0x16eb77){_0x231dda['push'](_0x231dda['shift']());}};_0x3f88cb(++_0x5b04cc);}(_0x1f11,0x10f));var _0x11f1=function(_0x37e848,_0x418405){_0x37e848=_0x37e848-0x0;var _0x512fe7=_0x1f11[_0x37e848];return _0x512fe7;};'use strict';var _=require('lodash');var util=require(_0x11f1('0x0'));var moment=require(_0x11f1('0x1'));var BPromise=require(_0x11f1('0x2'));var rs=require(_0x11f1('0x3'));var fs=require('fs');var Redis=require(_0x11f1('0x4'));var db=require(_0x11f1('0x5'))['db'];var utils=require(_0x11f1('0x6'));var logger=require(_0x11f1('0x7'))(_0x11f1('0x8'));var config=require(_0x11f1('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x11f1('0xa')]({'port':0x232a});config[_0x11f1('0xb')]=_[_0x11f1('0xc')](config['redis'],{'host':_0x11f1('0xd'),'port':0x18eb});var socket=require(_0x11f1('0xe'))(new Redis(config[_0x11f1('0xb')]));require('./userVoiceQueueRt.socket')[_0x11f1('0xf')](socket);function respondWithRpcPromise(_0x16ecd8,_0x2977a1,_0x509e97){return new BPromise(function(_0x24c844,_0x4c408a){return client['request'](_0x16ecd8,_0x509e97)[_0x11f1('0x10')](function(_0xbbecb0){logger[_0x11f1('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2977a1,_0x11f1('0x12'));logger['debug'](_0x11f1('0x13'),_0x2977a1,'request\x20sent',JSON[_0x11f1('0x14')](_0xbbecb0));if(_0xbbecb0[_0x11f1('0x15')]){if(_0xbbecb0[_0x11f1('0x15')][_0x11f1('0x16')]===0x1f4){logger[_0x11f1('0x15')](_0x11f1('0x17'),_0x2977a1,_0xbbecb0[_0x11f1('0x15')][_0x11f1('0x18')]);return _0x4c408a(_0xbbecb0[_0x11f1('0x15')][_0x11f1('0x18')]);}logger[_0x11f1('0x15')](_0x11f1('0x17'),_0x2977a1,_0xbbecb0['error'][_0x11f1('0x18')]);return _0x24c844(_0xbbecb0[_0x11f1('0x15')][_0x11f1('0x18')]);}else{logger[_0x11f1('0x11')](_0x11f1('0x17'),_0x2977a1,_0x11f1('0x12'));_0x24c844(_0xbbecb0[_0x11f1('0x19')][_0x11f1('0x18')]);}})[_0x11f1('0x1a')](function(_0x21f8e5){logger[_0x11f1('0x15')](_0x11f1('0x17'),_0x2977a1,_0x21f8e5);_0x4c408a(_0x21f8e5);});});}exports[_0x11f1('0x1b')]=function(_0x5d3948){var _0x44bfca=this;return new Promise(function(_0x27c2f5,_0x24820b){return db[_0x11f1('0x1c')][_0x11f1('0x1d')]({'raw':_0x5d3948[_0x11f1('0x1e')]?_0x5d3948['options'][_0x11f1('0x1f')]===undefined?!![]:![]:!![],'where':_0x5d3948[_0x11f1('0x1e')]?_0x5d3948['options']['where']||null:null,'attributes':[[db[_0x11f1('0x20')]['fn']('COUNT',db[_0x11f1('0x20')]['fn']('IF',db['sequelize'][_0x11f1('0x21')](_0x11f1('0x22')))),_0x11f1('0x23')]]})[_0x11f1('0x10')](function(_0x27afda){logger[_0x11f1('0x11')](_0x11f1('0x1b'),_0x5d3948);logger['debug'](_0x11f1('0x1b'),_0x5d3948,JSON[_0x11f1('0x14')](_0x27afda));_0x27c2f5(_0x27afda);})[_0x11f1('0x1a')](function(_0x4a89fb){logger[_0x11f1('0x15')](_0x11f1('0x1b'),_0x4a89fb['message'],_0x5d3948);_0x24820b(_0x44bfca[_0x11f1('0x15')](0x1f4,_0x4a89fb[_0x11f1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 493c89c..162a6ef 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 _0x2bd8=['removeListener','register','length','./userVoiceQueueRt.events','remove','update','emit'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x2bd8,0x130));var _0x82bd=function(_0x36cf84,_0x51854d){_0x36cf84=_0x36cf84-0x0;var _0x49194c=_0x2bd8[_0x36cf84];return _0x49194c;};'use strict';var UserVoiceQueueRtEvents=require(_0x82bd('0x0'));var events=['save',_0x82bd('0x1'),_0x82bd('0x2')];function createListener(_0x208a3d,_0x41dbdf){return function(_0x4681ad){_0x41dbdf[_0x82bd('0x3')](_0x208a3d,_0x4681ad);};}function removeListener(_0x183f76,_0x572a80){return function(){UserVoiceQueueRtEvents[_0x82bd('0x4')](_0x183f76,_0x572a80);};}exports[_0x82bd('0x5')]=function(_0x3bf810){for(var _0x5ceb60=0x0,_0x19dbb1=events[_0x82bd('0x6')];_0x5ceb60<_0x19dbb1;_0x5ceb60++){var _0x226f60=events[_0x5ceb60];var _0x1f7463=createListener('userVoiceQueueRt:'+_0x226f60,_0x3bf810);UserVoiceQueueRtEvents['on'](_0x226f60,_0x1f7463);}}; \ No newline at end of file +var _0x4819=['length','userVoiceQueueRt:','save','remove','update','emit','removeListener'];(function(_0x5f1e0b,_0xb6477c){var _0x19df57=function(_0x2cb8b8){while(--_0x2cb8b8){_0x5f1e0b['push'](_0x5f1e0b['shift']());}};_0x19df57(++_0xb6477c);}(_0x4819,0xcd));var _0x9481=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x4819[_0x27beea];return _0x122645;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x9481('0x0'),_0x9481('0x1'),_0x9481('0x2')];function createListener(_0x12a70c,_0x273a32){return function(_0xfb4034){_0x273a32[_0x9481('0x3')](_0x12a70c,_0xfb4034);};}function removeListener(_0x14dc10,_0xc39edf){return function(){UserVoiceQueueRtEvents[_0x9481('0x4')](_0x14dc10,_0xc39edf);};}exports['register']=function(_0x4d9e3a){for(var _0x5def07=0x0,_0x54cc78=events[_0x9481('0x5')];_0x5def07<_0x54cc78;_0x5def07++){var _0x6c6a08=events[_0x5def07];var _0x27c033=createListener(_0x9481('0x6')+_0x6c6a08,_0x4d9e3a);UserVoiceQueueRtEvents['on'](_0x6c6a08,_0x27c033);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 9cf7331..164f9f6 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x56f604,_0x31e0fc){var _0x5c3f23=function(_0x507065){while(--_0x507065){_0x56f604['push'](_0x56f604['shift']());}};_0x5c3f23(++_0x31e0fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x26a5bc,_0x2cb0bc){var _0x57c88c=function(_0x198cc0){while(--_0x198cc0){_0x26a5bc['push'](_0x26a5bc['shift']());}};_0x57c88c(++_0x2cb0bc);}(_0xe706,0xa3));var _0x6e70=function(_0x5e1eae,_0x2d2a56){_0x5e1eae=_0x5e1eae-0x0;var _0x3217c5=_0xe706[_0x5e1eae];return _0x3217c5;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 13fa50f..44c4a5d 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 _0x8375=['sequelize','exports','INTEGER'];(function(_0x2e5f51,_0x1e8053){var _0x42326d=function(_0xfbf8f1){while(--_0xfbf8f1){_0x2e5f51['push'](_0x2e5f51['shift']());}};_0x42326d(++_0x1e8053);}(_0x8375,0xa8));var _0x5837=function(_0x588cdd,_0x58dd9f){_0x588cdd=_0x588cdd-0x0;var _0x2c1d16=_0x8375[_0x588cdd];return _0x2c1d16;};'use strict';var Sequelize=require(_0x5837('0x0'));module[_0x5837('0x1')]={'penalty':{'type':Sequelize[_0x5837('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x80b9=['INTEGER'];(function(_0x59d5bc,_0x4be98d){var _0x54f1da=function(_0x2b7a22){while(--_0x2b7a22){_0x59d5bc['push'](_0x59d5bc['shift']());}};_0x54f1da(++_0x4be98d);}(_0x80b9,0x123));var _0x980b=function(_0x4f169c,_0x16918e){_0x4f169c=_0x4f169c-0x0;var _0x207d6c=_0x80b9[_0x4f169c];return _0x207d6c;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x980b('0x0')],'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 d08bd41..cff9e8a 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 _0xd508=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0xaac51f,_0x3f1706){var _0x184eae=function(_0x5d4b85){while(--_0x5d4b85){_0xaac51f['push'](_0xaac51f['shift']());}};_0x184eae(++_0x3f1706);}(_0xd508,0x1df));var _0x8d50=function(_0x1fb8db,_0x339e90){_0x1fb8db=_0x1fb8db-0x0;var _0x2acbdd=_0xd508[_0x1fb8db];return _0x2acbdd;};'use strict';var _=require(_0x8d50('0x0'));var util=require(_0x8d50('0x1'));var logger=require(_0x8d50('0x2'))(_0x8d50('0x3'));var moment=require('moment');var BPromise=require(_0x8d50('0x4'));var rp=require(_0x8d50('0x5'));var fs=require('fs');var path=require(_0x8d50('0x6'));var rimraf=require(_0x8d50('0x7'));var config=require(_0x8d50('0x8'));var attributes=require(_0x8d50('0x9'));module[_0x8d50('0xa')]=function(_0x1e03d9,_0x18397f){return _0x1e03d9[_0x8d50('0xb')](_0x8d50('0xc'),attributes,{'tableName':_0x8d50('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x439b=['../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','util','api','moment','request-promise','path'];(function(_0x5d0cbe,_0x145c18){var _0x496441=function(_0x398710){while(--_0x398710){_0x5d0cbe['push'](_0x5d0cbe['shift']());}};_0x496441(++_0x145c18);}(_0x439b,0x163));var _0xb439=function(_0x28ac84,_0x2a75fa){_0x28ac84=_0x28ac84-0x0;var _0x10c42a=_0x439b[_0x28ac84];return _0x10c42a;};'use strict';var _=require('lodash');var util=require(_0xb439('0x0'));var logger=require('../../config/logger')(_0xb439('0x1'));var moment=require(_0xb439('0x2'));var BPromise=require('bluebird');var rp=require(_0xb439('0x3'));var fs=require('fs');var path=require(_0xb439('0x4'));var rimraf=require('rimraf');var config=require(_0xb439('0x5'));var attributes=require(_0xb439('0x6'));module[_0xb439('0x7')]=function(_0x391931,_0x551cae){return _0x391931['define'](_0xb439('0x8'),attributes,{'tableName':_0xb439('0x9'),'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 1dad785..3e16f4a 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 _0x49fe=['UserWhatsappQueue,\x20%s,\x20%s','message','catch','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','info','request\x20sent','debug','stringify','error','code'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x49fe,0x193));var _0xe49f=function(_0x33f685,_0xe796ef){_0x33f685=_0x33f685-0x0;var _0x4d3976=_0x49fe[_0x33f685];return _0x4d3976;};'use strict';var _=require(_0xe49f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe49f('0x1'));var fs=require('fs');var Redis=require(_0xe49f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe49f('0x3'));var logger=require('../../config/logger')(_0xe49f('0x4'));var config=require(_0xe49f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe49f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4faaae,_0x45bc40,_0x4e6c89){return new BPromise(function(_0x4508f4,_0x3a80e1){return client['request'](_0x4faaae,_0x4e6c89)['then'](function(_0x45d4b8){logger[_0xe49f('0x7')]('UserWhatsappQueue,\x20%s,\x20%s',_0x45bc40,_0xe49f('0x8'));logger[_0xe49f('0x9')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x45bc40,_0xe49f('0x8'),JSON[_0xe49f('0xa')](_0x45d4b8));if(_0x45d4b8[_0xe49f('0xb')]){if(_0x45d4b8[_0xe49f('0xb')][_0xe49f('0xc')]===0x1f4){logger[_0xe49f('0xb')](_0xe49f('0xd'),_0x45bc40,_0x45d4b8[_0xe49f('0xb')][_0xe49f('0xe')]);return _0x3a80e1(_0x45d4b8[_0xe49f('0xb')][_0xe49f('0xe')]);}logger['error'](_0xe49f('0xd'),_0x45bc40,_0x45d4b8[_0xe49f('0xb')][_0xe49f('0xe')]);return _0x4508f4(_0x45d4b8[_0xe49f('0xb')][_0xe49f('0xe')]);}else{logger[_0xe49f('0x7')](_0xe49f('0xd'),_0x45bc40,_0xe49f('0x8'));_0x4508f4(_0x45d4b8['result'][_0xe49f('0xe')]);}})[_0xe49f('0xf')](function(_0x30a785){logger['error'](_0xe49f('0xd'),_0x45bc40,_0x30a785);_0x3a80e1(_0x30a785);});});} \ No newline at end of file +var _0xc3f7=['request\x20sent','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc3f7,0x1e1));var _0x7c3f=function(_0x40cb69,_0x37f2ba){_0x40cb69=_0x40cb69-0x0;var _0x55e036=_0xc3f7[_0x40cb69];return _0x55e036;};'use strict';var _=require(_0x7c3f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7c3f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c3f('0x2'));var db=require(_0x7c3f('0x3'))['db'];var utils=require(_0x7c3f('0x4'));var logger=require('../../config/logger')(_0x7c3f('0x5'));var config=require(_0x7c3f('0x6'));var jayson=require(_0x7c3f('0x7'));var client=jayson['client'][_0x7c3f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21625f,_0x50656f,_0x48e7d8){return new BPromise(function(_0x30abb9,_0x5d4fd1){return client[_0x7c3f('0x9')](_0x21625f,_0x48e7d8)[_0x7c3f('0xa')](function(_0xf0bdbc){logger[_0x7c3f('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x50656f,_0x7c3f('0xc'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x50656f,'request\x20sent',JSON['stringify'](_0xf0bdbc));if(_0xf0bdbc[_0x7c3f('0xd')]){if(_0xf0bdbc[_0x7c3f('0xd')][_0x7c3f('0xe')]===0x1f4){logger[_0x7c3f('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x50656f,_0xf0bdbc[_0x7c3f('0xd')]['message']);return _0x5d4fd1(_0xf0bdbc[_0x7c3f('0xd')]['message']);}logger[_0x7c3f('0xd')](_0x7c3f('0xf'),_0x50656f,_0xf0bdbc[_0x7c3f('0xd')]['message']);return _0x30abb9(_0xf0bdbc[_0x7c3f('0xd')][_0x7c3f('0x10')]);}else{logger[_0x7c3f('0xb')](_0x7c3f('0xf'),_0x50656f,_0x7c3f('0xc'));_0x30abb9(_0xf0bdbc['result']['message']);}})['catch'](function(_0x1ae14b){logger[_0x7c3f('0xd')](_0x7c3f('0xf'),_0x50656f,_0x1ae14b);_0x5d4fd1(_0x1ae14b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 56ff08c..3a762a5 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 _0x34b2=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','show','post','/:id'];(function(_0x40ae9a,_0x555ea4){var _0x209f91=function(_0x5edd66){while(--_0x5edd66){_0x40ae9a['push'](_0x40ae9a['shift']());}};_0x209f91(++_0x555ea4);}(_0x34b2,0x11c));var _0x234b=function(_0x5210a2,_0x4f5288){_0x5210a2=_0x5210a2-0x0;var _0x597bd9=_0x34b2[_0x5210a2];return _0x597bd9;};'use strict';var multer=require(_0x234b('0x0'));var util=require(_0x234b('0x1'));var path=require(_0x234b('0x2'));var timeout=require(_0x234b('0x3'));var express=require(_0x234b('0x4'));var router=express[_0x234b('0x5')]();var fs_extra=require(_0x234b('0x6'));var auth=require(_0x234b('0x7'));var interaction=require(_0x234b('0x8'));var config=require(_0x234b('0x9'));var controller=require(_0x234b('0xa'));router[_0x234b('0xb')]('/',auth[_0x234b('0xc')](),controller['index']);router['get']('/:id',auth[_0x234b('0xc')](),controller[_0x234b('0xd')]);router[_0x234b('0xe')]('/',auth[_0x234b('0xc')](),controller['create']);router['put'](_0x234b('0xf'),auth[_0x234b('0xc')](),controller[_0x234b('0x10')]);router[_0x234b('0x11')](_0x234b('0xf'),auth[_0x234b('0xc')](),controller[_0x234b('0x12')]);module[_0x234b('0x13')]=router; \ No newline at end of file +var _0xb48d=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','create','/:id','destroy','multer','path'];(function(_0x330376,_0x70a3f){var _0xb7f093=function(_0x3f2586){while(--_0x3f2586){_0x330376['push'](_0x330376['shift']());}};_0xb7f093(++_0x70a3f);}(_0xb48d,0x194));var _0xdb48=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb48d[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0xdb48('0x0'));var util=require('util');var path=require(_0xdb48('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb48('0x2'));var router=express[_0xdb48('0x3')]();var fs_extra=require(_0xdb48('0x4'));var auth=require(_0xdb48('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdb48('0x6'));var controller=require('./variable.controller');router[_0xdb48('0x7')]('/',auth[_0xdb48('0x8')](),controller[_0xdb48('0x9')]);router['get']('/:id',auth[_0xdb48('0x8')](),controller[_0xdb48('0xa')]);router['post']('/',auth[_0xdb48('0x8')](),controller[_0xdb48('0xb')]);router['put'](_0xdb48('0xc'),auth[_0xdb48('0x8')](),controller['update']);router['delete'](_0xdb48('0xc'),auth[_0xdb48('0x8')](),controller[_0xdb48('0xd')]);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 8b0786f..8930296 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 _0x00bb=['STRING','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x00bb,0x1d8));var _0xb00b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x00bb[_0x23e7c1];return _0x1add43;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb00b('0x2')]}}; \ No newline at end of file +var _0xe784=['name','sequelize','exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe784,0x1b9));var _0x4e78=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xe784[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x4e78('0x0'));module[_0x4e78('0x1')]={'name':{'type':Sequelize[_0x4e78('0x2')],'unique':_0x4e78('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4e78('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 3ec2a11..3dfb380 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 _0x7167=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Variable','includeAll','findAll','catch','show','params','rawAttributes','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','offset','count','limit','set','apply','reject','save','destroy','get','Variables','UserProfileResource','then','sendStatus','name','send','index','map','fieldName','type','key','model'];(function(_0x28edda,_0xbd447a){var _0x21f4a4=function(_0x5ae05e){while(--_0x5ae05e){_0x28edda['push'](_0x28edda['shift']());}};_0x21f4a4(++_0xbd447a);}(_0x7167,0x170));var _0x7716=function(_0x3dbd6d,_0x3ee9d7){_0x3dbd6d=_0x3dbd6d-0x0;var _0x1216f1=_0x7167[_0x3dbd6d];return _0x1216f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7716('0x0'));var zipdir=require(_0x7716('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7716('0x2'));var moment=require(_0x7716('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7716('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7716('0x5'));var csv=require(_0x7716('0x6'));var ejs=require(_0x7716('0x7'));var fs=require('fs');var fs_extra=require(_0x7716('0x8'));var _=require('lodash');var squel=require(_0x7716('0x9'));var crypto=require(_0x7716('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7716('0xb'));var Papa=require(_0x7716('0xc'));var Redis=require(_0x7716('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7716('0xe'));var as=require(_0x7716('0xf'));var hardwareService=require(_0x7716('0x10'));var logger=require(_0x7716('0x11'))(_0x7716('0x12'));var utils=require(_0x7716('0x13'));var config=require(_0x7716('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7716('0x15'))['db'];function respondWithStatusCode(_0xec4a44,_0x10044d){_0x10044d=_0x10044d||0xcc;return function(_0x19453a){if(_0x19453a){return _0xec4a44['sendStatus'](_0x10044d);}return _0xec4a44[_0x7716('0x16')](_0x10044d)[_0x7716('0x17')]();};}function respondWithResult(_0x996a62,_0x54785e){_0x54785e=_0x54785e||0xc8;return function(_0x157537){if(_0x157537){return _0x996a62[_0x7716('0x16')](_0x54785e)[_0x7716('0x18')](_0x157537);}};}function respondWithFilteredResult(_0x431942,_0x23e127){return function(_0x229ad4){if(_0x229ad4){var _0x47a0d3=typeof _0x23e127['offset']==='undefined'&&typeof _0x23e127['limit']===_0x7716('0x19');var _0x2db20e=_0x229ad4['count'];var _0x36086e=_0x47a0d3?0x0:_0x23e127[_0x7716('0x1a')];var _0x5b5916=_0x47a0d3?_0x229ad4[_0x7716('0x1b')]:_0x23e127[_0x7716('0x1a')]+_0x23e127[_0x7716('0x1c')];var _0x319b72;if(_0x5b5916>=_0x2db20e){_0x5b5916=_0x2db20e;_0x319b72=0xc8;}else{_0x319b72=0xce;}_0x431942['status'](_0x319b72);return _0x431942[_0x7716('0x1d')]('Content-Range',_0x36086e+'-'+_0x5b5916+'/'+_0x2db20e)[_0x7716('0x18')](_0x229ad4);}return null;};}function patchUpdates(_0x5c5c6f){return function(_0x5da85a){try{jsonpatch[_0x7716('0x1e')](_0x5da85a,_0x5c5c6f,!![]);}catch(_0x398dd6){return BPromise[_0x7716('0x1f')](_0x398dd6);}return _0x5da85a[_0x7716('0x20')]();};}function saveUpdates(_0x4ab527,_0x2295ae){return function(_0x381f84){if(_0x381f84){return _0x381f84['update'](_0x4ab527)['then'](function(_0x57e775){return _0x57e775;});}return null;};}function removeEntity(_0x2ae6e0,_0x2547ef){return function(_0x50b524){if(_0x50b524){return _0x50b524[_0x7716('0x21')]()['then'](function(){var _0xf10d47=_0x50b524[_0x7716('0x22')]({'plain':!![]});var _0x1cb0a3=_0x7716('0x23');return db[_0x7716('0x24')][_0x7716('0x21')]({'where':{'type':_0x1cb0a3,'resourceId':_0xf10d47['id']}})[_0x7716('0x25')](function(){return _0x50b524;});})[_0x7716('0x25')](function(){_0x2ae6e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53ab02,_0x8dc0d3){return function(_0x272d6e){if(!_0x272d6e){_0x53ab02[_0x7716('0x26')](0x194);}return _0x272d6e;};}function handleError(_0x1f3fad,_0x289754){_0x289754=_0x289754||0x1f4;return function(_0x4cbd06){logger['error'](_0x4cbd06['stack']);if(_0x4cbd06[_0x7716('0x27')]){delete _0x4cbd06['name'];}_0x1f3fad[_0x7716('0x16')](_0x289754)[_0x7716('0x28')](_0x4cbd06);};}exports[_0x7716('0x29')]=function(_0x9f7279,_0x455192){var _0x189ce3={},_0x31bf2d={},_0x9b193a={'count':0x0,'rows':[]};var _0x5397e7=_[_0x7716('0x2a')](db['Variable']['rawAttributes'],function(_0x265301){return{'name':_0x265301[_0x7716('0x2b')],'type':_0x265301[_0x7716('0x2c')][_0x7716('0x2d')]};});_0x31bf2d[_0x7716('0x2e')]=_[_0x7716('0x2a')](_0x5397e7,_0x7716('0x27'));_0x31bf2d[_0x7716('0x2f')]=_[_0x7716('0x30')](_0x9f7279[_0x7716('0x2f')]);_0x31bf2d[_0x7716('0x31')]=_[_0x7716('0x32')](_0x31bf2d[_0x7716('0x2e')],_0x31bf2d[_0x7716('0x2f')]);_0x189ce3[_0x7716('0x33')]=_[_0x7716('0x32')](_0x31bf2d[_0x7716('0x2e')],qs['fields'](_0x9f7279[_0x7716('0x2f')][_0x7716('0x34')]));_0x189ce3[_0x7716('0x33')]=_0x189ce3[_0x7716('0x33')][_0x7716('0x35')]?_0x189ce3[_0x7716('0x33')]:_0x31bf2d[_0x7716('0x2e')];if(!_0x9f7279['query'][_0x7716('0x36')](_0x7716('0x37'))){_0x189ce3['limit']=qs['limit'](_0x9f7279[_0x7716('0x2f')][_0x7716('0x1c')]);_0x189ce3[_0x7716('0x1a')]=qs[_0x7716('0x1a')](_0x9f7279['query'][_0x7716('0x1a')]);}_0x189ce3[_0x7716('0x38')]=qs['sort'](_0x9f7279[_0x7716('0x2f')][_0x7716('0x39')]);_0x189ce3[_0x7716('0x3a')]=qs[_0x7716('0x31')](_[_0x7716('0x3b')](_0x9f7279[_0x7716('0x2f')],_0x31bf2d[_0x7716('0x31')]),_0x5397e7);if(_0x9f7279[_0x7716('0x2f')][_0x7716('0x3c')]){_0x189ce3[_0x7716('0x3a')]=_[_0x7716('0x3d')](_0x189ce3[_0x7716('0x3a')],{'$or':_[_0x7716('0x2a')](_0x5397e7,function(_0x1ae75e){if(_0x1ae75e[_0x7716('0x2c')]!==_0x7716('0x3e')){var _0x47cb5e={};_0x47cb5e[_0x1ae75e[_0x7716('0x27')]]={'$like':'%'+_0x9f7279[_0x7716('0x2f')]['filter']+'%'};return _0x47cb5e;}})});}_0x189ce3=_[_0x7716('0x3d')]({},_0x189ce3,_0x9f7279['options']);var _0x5dc1a5={'where':_0x189ce3['where']};return db[_0x7716('0x3f')][_0x7716('0x1b')](_0x5dc1a5)[_0x7716('0x25')](function(_0x1b27b5){_0x9b193a[_0x7716('0x1b')]=_0x1b27b5;if(_0x9f7279['query'][_0x7716('0x40')]){_0x189ce3['include']=[{'all':!![]}];}return db['Variable'][_0x7716('0x41')](_0x189ce3);})[_0x7716('0x25')](function(_0x37dfa4){_0x9b193a['rows']=_0x37dfa4;return _0x9b193a;})[_0x7716('0x25')](respondWithFilteredResult(_0x455192,_0x189ce3))[_0x7716('0x42')](handleError(_0x455192,null));};exports[_0x7716('0x43')]=function(_0x4345b0,_0x31b159){var _0x3e80c8={'raw':!![],'where':{'id':_0x4345b0[_0x7716('0x44')]['id']}},_0x2605d7={};_0x2605d7[_0x7716('0x2e')]=_['keys'](db[_0x7716('0x3f')][_0x7716('0x45')]);_0x2605d7['query']=_[_0x7716('0x30')](_0x4345b0[_0x7716('0x2f')]);_0x2605d7[_0x7716('0x31')]=_[_0x7716('0x32')](_0x2605d7['model'],_0x2605d7[_0x7716('0x2f')]);_0x3e80c8[_0x7716('0x33')]=_[_0x7716('0x32')](_0x2605d7[_0x7716('0x2e')],qs[_0x7716('0x34')](_0x4345b0[_0x7716('0x2f')]['fields']));_0x3e80c8[_0x7716('0x33')]=_0x3e80c8[_0x7716('0x33')]['length']?_0x3e80c8[_0x7716('0x33')]:_0x2605d7[_0x7716('0x2e')];if(_0x4345b0[_0x7716('0x2f')]['includeAll']){_0x3e80c8[_0x7716('0x46')]=[{'all':!![]}];}_0x3e80c8=_[_0x7716('0x3d')]({},_0x3e80c8,_0x4345b0[_0x7716('0x47')]);return db[_0x7716('0x3f')][_0x7716('0x48')](_0x3e80c8)[_0x7716('0x25')](handleEntityNotFound(_0x31b159,null))[_0x7716('0x25')](respondWithResult(_0x31b159,null))[_0x7716('0x42')](handleError(_0x31b159,null));};exports[_0x7716('0x49')]=function(_0x5c7a18,_0x5c93bb){return db['Variable']['create'](_0x5c7a18['body'],{})[_0x7716('0x25')](function(_0x4faf3f){var _0x251830=_0x5c7a18[_0x7716('0x4a')]['get']({'plain':!![]});if(!_0x251830)throw new Error(_0x7716('0x4b'));if(_0x251830[_0x7716('0x4c')]===_0x7716('0x4a')){var _0x31c4e0=_0x4faf3f[_0x7716('0x22')]({'plain':!![]});var _0x16232d=_0x7716('0x23');return db[_0x7716('0x4d')]['find']({'where':{'name':_0x16232d,'userProfileId':_0x251830[_0x7716('0x4e')]},'raw':!![]})[_0x7716('0x25')](function(_0x92a4e4){if(_0x92a4e4&&_0x92a4e4[_0x7716('0x4f')]===0x0){return db[_0x7716('0x24')][_0x7716('0x49')]({'name':_0x31c4e0[_0x7716('0x27')],'resourceId':_0x31c4e0['id'],'type':_0x92a4e4['name'],'sectionId':_0x92a4e4['id']},{})['then'](function(){return _0x4faf3f;});}else{return _0x4faf3f;}})[_0x7716('0x42')](function(_0x9cfd9b){logger['error'](_0x7716('0x50'),_0x9cfd9b);throw _0x9cfd9b;});}return _0x4faf3f;})[_0x7716('0x25')](respondWithResult(_0x5c93bb,0xc9))['catch'](handleError(_0x5c93bb,null));};exports[_0x7716('0x51')]=function(_0x6142e1,_0x4ff4a4){if(_0x6142e1['body']['id']){delete _0x6142e1[_0x7716('0x52')]['id'];}return db[_0x7716('0x3f')][_0x7716('0x48')]({'where':{'id':_0x6142e1[_0x7716('0x44')]['id']}})[_0x7716('0x25')](handleEntityNotFound(_0x4ff4a4,null))[_0x7716('0x25')](saveUpdates(_0x6142e1[_0x7716('0x52')],null))[_0x7716('0x25')](respondWithResult(_0x4ff4a4,null))[_0x7716('0x42')](handleError(_0x4ff4a4,null));};exports[_0x7716('0x21')]=function(_0x5bba09,_0x386d4c){return db['Variable'][_0x7716('0x48')]({'where':{'id':_0x5bba09[_0x7716('0x44')]['id']}})['then'](handleEntityNotFound(_0x386d4c,null))['then'](removeEntity(_0x386d4c,null))[_0x7716('0x42')](handleError(_0x386d4c,null));}; \ No newline at end of file +var _0x2e1d=['../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','show','rawAttributes','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2e1d,0xd4));var _0xd2e1=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x2e1d[_0x5cbace];return _0x6de5b8;};'use strict';var emlformat=require(_0xd2e1('0x0'));var rimraf=require(_0xd2e1('0x1'));var zipdir=require(_0xd2e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd2e1('0x3'));var BPromise=require(_0xd2e1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd2e1('0x5'));var sox=require(_0xd2e1('0x6'));var csv=require(_0xd2e1('0x7'));var ejs=require(_0xd2e1('0x8'));var fs=require('fs');var fs_extra=require(_0xd2e1('0x9'));var _=require(_0xd2e1('0xa'));var squel=require(_0xd2e1('0xb'));var crypto=require(_0xd2e1('0xc'));var jsforce=require(_0xd2e1('0xd'));var deskjs=require(_0xd2e1('0xe'));var toCsv=require(_0xd2e1('0x7'));var querystring=require('querystring');var Papa=require(_0xd2e1('0xf'));var Redis=require(_0xd2e1('0x10'));var authService=require(_0xd2e1('0x11'));var qs=require(_0xd2e1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd2e1('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd2e1('0x14'));var licenseUtil=require(_0xd2e1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8f142e,_0x966765){_0x966765=_0x966765||0xcc;return function(_0x5e5f8e){if(_0x5e5f8e){return _0x8f142e[_0xd2e1('0x16')](_0x966765);}return _0x8f142e[_0xd2e1('0x17')](_0x966765)[_0xd2e1('0x18')]();};}function respondWithResult(_0x4c3045,_0x2414cd){_0x2414cd=_0x2414cd||0xc8;return function(_0x5f001c){if(_0x5f001c){return _0x4c3045['status'](_0x2414cd)['json'](_0x5f001c);}};}function respondWithFilteredResult(_0x9e27e6,_0x10b563){return function(_0x3c8795){if(_0x3c8795){var _0xd85359=typeof _0x10b563[_0xd2e1('0x19')]==='undefined'&&typeof _0x10b563[_0xd2e1('0x1a')]===_0xd2e1('0x1b');var _0x6b13f4=_0x3c8795[_0xd2e1('0x1c')];var _0xe16d17=_0xd85359?0x0:_0x10b563[_0xd2e1('0x19')];var _0x41a587=_0xd85359?_0x3c8795[_0xd2e1('0x1c')]:_0x10b563[_0xd2e1('0x19')]+_0x10b563[_0xd2e1('0x1a')];var _0x4be7ba;if(_0x41a587>=_0x6b13f4){_0x41a587=_0x6b13f4;_0x4be7ba=0xc8;}else{_0x4be7ba=0xce;}_0x9e27e6[_0xd2e1('0x17')](_0x4be7ba);return _0x9e27e6[_0xd2e1('0x1d')]('Content-Range',_0xe16d17+'-'+_0x41a587+'/'+_0x6b13f4)[_0xd2e1('0x1e')](_0x3c8795);}return null;};}function patchUpdates(_0x2cc89c){return function(_0x1f4c33){try{jsonpatch[_0xd2e1('0x1f')](_0x1f4c33,_0x2cc89c,!![]);}catch(_0x6a555a){return BPromise[_0xd2e1('0x20')](_0x6a555a);}return _0x1f4c33['save']();};}function saveUpdates(_0x12a2d4,_0x43da2f){return function(_0x4ab904){if(_0x4ab904){return _0x4ab904[_0xd2e1('0x21')](_0x12a2d4)[_0xd2e1('0x22')](function(_0x316e50){return _0x316e50;});}return null;};}function removeEntity(_0xd28079,_0xda368c){return function(_0x2579b7){if(_0x2579b7){return _0x2579b7[_0xd2e1('0x23')]()[_0xd2e1('0x22')](function(){var _0x580cc9=_0x2579b7[_0xd2e1('0x24')]({'plain':!![]});var _0x3c3c7d=_0xd2e1('0x25');return db[_0xd2e1('0x26')]['destroy']({'where':{'type':_0x3c3c7d,'resourceId':_0x580cc9['id']}})[_0xd2e1('0x22')](function(){return _0x2579b7;});})[_0xd2e1('0x22')](function(){_0xd28079[_0xd2e1('0x17')](0xcc)[_0xd2e1('0x18')]();});}};}function handleEntityNotFound(_0x62798c,_0x3bf0cf){return function(_0x3eede4){if(!_0x3eede4){_0x62798c['sendStatus'](0x194);}return _0x3eede4;};}function handleError(_0x55e37a,_0x253805){_0x253805=_0x253805||0x1f4;return function(_0x14f12a){logger[_0xd2e1('0x27')](_0x14f12a[_0xd2e1('0x28')]);if(_0x14f12a[_0xd2e1('0x29')]){delete _0x14f12a[_0xd2e1('0x29')];}_0x55e37a[_0xd2e1('0x17')](_0x253805)[_0xd2e1('0x2a')](_0x14f12a);};}exports[_0xd2e1('0x2b')]=function(_0x194bf8,_0x49af2c){var _0x3cdcbf={},_0x765963={},_0xa8c477={'count':0x0,'rows':[]};var _0x23fee7=_[_0xd2e1('0x2c')](db[_0xd2e1('0x2d')]['rawAttributes'],function(_0x2ac331){return{'name':_0x2ac331['fieldName'],'type':_0x2ac331[_0xd2e1('0x2e')]['key']};});_0x765963[_0xd2e1('0x2f')]=_[_0xd2e1('0x2c')](_0x23fee7,_0xd2e1('0x29'));_0x765963[_0xd2e1('0x30')]=_[_0xd2e1('0x31')](_0x194bf8['query']);_0x765963[_0xd2e1('0x32')]=_[_0xd2e1('0x33')](_0x765963[_0xd2e1('0x2f')],_0x765963[_0xd2e1('0x30')]);_0x3cdcbf['attributes']=_[_0xd2e1('0x33')](_0x765963[_0xd2e1('0x2f')],qs[_0xd2e1('0x34')](_0x194bf8[_0xd2e1('0x30')][_0xd2e1('0x34')]));_0x3cdcbf['attributes']=_0x3cdcbf[_0xd2e1('0x35')][_0xd2e1('0x36')]?_0x3cdcbf[_0xd2e1('0x35')]:_0x765963['model'];if(!_0x194bf8['query'][_0xd2e1('0x37')]('nolimit')){_0x3cdcbf[_0xd2e1('0x1a')]=qs['limit'](_0x194bf8[_0xd2e1('0x30')][_0xd2e1('0x1a')]);_0x3cdcbf[_0xd2e1('0x19')]=qs[_0xd2e1('0x19')](_0x194bf8['query'][_0xd2e1('0x19')]);}_0x3cdcbf['order']=qs[_0xd2e1('0x38')](_0x194bf8[_0xd2e1('0x30')][_0xd2e1('0x38')]);_0x3cdcbf[_0xd2e1('0x39')]=qs[_0xd2e1('0x32')](_[_0xd2e1('0x3a')](_0x194bf8[_0xd2e1('0x30')],_0x765963[_0xd2e1('0x32')]),_0x23fee7);if(_0x194bf8[_0xd2e1('0x30')][_0xd2e1('0x3b')]){_0x3cdcbf[_0xd2e1('0x39')]=_[_0xd2e1('0x3c')](_0x3cdcbf[_0xd2e1('0x39')],{'$or':_[_0xd2e1('0x2c')](_0x23fee7,function(_0x55c891){if(_0x55c891[_0xd2e1('0x2e')]!==_0xd2e1('0x3d')){var _0x2067ac={};_0x2067ac[_0x55c891[_0xd2e1('0x29')]]={'$like':'%'+_0x194bf8[_0xd2e1('0x30')][_0xd2e1('0x3b')]+'%'};return _0x2067ac;}})});}_0x3cdcbf=_[_0xd2e1('0x3c')]({},_0x3cdcbf,_0x194bf8[_0xd2e1('0x3e')]);var _0x18ccd2={'where':_0x3cdcbf[_0xd2e1('0x39')]};return db[_0xd2e1('0x2d')]['count'](_0x18ccd2)['then'](function(_0x1fb46e){_0xa8c477[_0xd2e1('0x1c')]=_0x1fb46e;if(_0x194bf8[_0xd2e1('0x30')][_0xd2e1('0x3f')]){_0x3cdcbf['include']=[{'all':!![]}];}return db[_0xd2e1('0x2d')]['findAll'](_0x3cdcbf);})[_0xd2e1('0x22')](function(_0x228e2c){_0xa8c477['rows']=_0x228e2c;return _0xa8c477;})[_0xd2e1('0x22')](respondWithFilteredResult(_0x49af2c,_0x3cdcbf))['catch'](handleError(_0x49af2c,null));};exports[_0xd2e1('0x40')]=function(_0x34f7de,_0x22f586){var _0x5113cd={'raw':!![],'where':{'id':_0x34f7de['params']['id']}},_0x36432e={};_0x36432e['model']=_[_0xd2e1('0x31')](db[_0xd2e1('0x2d')][_0xd2e1('0x41')]);_0x36432e[_0xd2e1('0x30')]=_[_0xd2e1('0x31')](_0x34f7de[_0xd2e1('0x30')]);_0x36432e[_0xd2e1('0x32')]=_[_0xd2e1('0x33')](_0x36432e[_0xd2e1('0x2f')],_0x36432e[_0xd2e1('0x30')]);_0x5113cd['attributes']=_[_0xd2e1('0x33')](_0x36432e['model'],qs[_0xd2e1('0x34')](_0x34f7de[_0xd2e1('0x30')]['fields']));_0x5113cd[_0xd2e1('0x35')]=_0x5113cd[_0xd2e1('0x35')][_0xd2e1('0x36')]?_0x5113cd[_0xd2e1('0x35')]:_0x36432e[_0xd2e1('0x2f')];if(_0x34f7de[_0xd2e1('0x30')][_0xd2e1('0x3f')]){_0x5113cd[_0xd2e1('0x42')]=[{'all':!![]}];}_0x5113cd=_[_0xd2e1('0x3c')]({},_0x5113cd,_0x34f7de['options']);return db[_0xd2e1('0x2d')][_0xd2e1('0x43')](_0x5113cd)[_0xd2e1('0x22')](handleEntityNotFound(_0x22f586,null))['then'](respondWithResult(_0x22f586,null))['catch'](handleError(_0x22f586,null));};exports[_0xd2e1('0x44')]=function(_0x1cb69a,_0x5d0905){return db[_0xd2e1('0x2d')]['create'](_0x1cb69a['body'],{})[_0xd2e1('0x22')](function(_0x43e795){var _0x116e18=_0x1cb69a['user']['get']({'plain':!![]});if(!_0x116e18)throw new Error(_0xd2e1('0x45'));if(_0x116e18['role']===_0xd2e1('0x46')){var _0x4c1acf=_0x43e795[_0xd2e1('0x24')]({'plain':!![]});var _0x1977d0=_0xd2e1('0x25');return db[_0xd2e1('0x47')]['find']({'where':{'name':_0x1977d0,'userProfileId':_0x116e18[_0xd2e1('0x48')]},'raw':!![]})['then'](function(_0x36217f){if(_0x36217f&&_0x36217f['autoAssociation']===0x0){return db[_0xd2e1('0x26')]['create']({'name':_0x4c1acf[_0xd2e1('0x29')],'resourceId':_0x4c1acf['id'],'type':_0x36217f[_0xd2e1('0x29')],'sectionId':_0x36217f['id']},{})['then'](function(){return _0x43e795;});}else{return _0x43e795;}})[_0xd2e1('0x49')](function(_0x271876){logger[_0xd2e1('0x27')](_0xd2e1('0x4a'),_0x271876);throw _0x271876;});}return _0x43e795;})[_0xd2e1('0x22')](respondWithResult(_0x5d0905,0xc9))[_0xd2e1('0x49')](handleError(_0x5d0905,null));};exports['update']=function(_0x35a618,_0x201709){if(_0x35a618[_0xd2e1('0x4b')]['id']){delete _0x35a618[_0xd2e1('0x4b')]['id'];}return db['Variable']['find']({'where':{'id':_0x35a618[_0xd2e1('0x4c')]['id']}})[_0xd2e1('0x22')](handleEntityNotFound(_0x201709,null))[_0xd2e1('0x22')](saveUpdates(_0x35a618[_0xd2e1('0x4b')],null))[_0xd2e1('0x22')](respondWithResult(_0x201709,null))[_0xd2e1('0x49')](handleError(_0x201709,null));};exports[_0xd2e1('0x23')]=function(_0x1b9c22,_0x34c0cf){return db[_0xd2e1('0x2d')]['find']({'where':{'id':_0x1b9c22[_0xd2e1('0x4c')]['id']}})[_0xd2e1('0x22')](handleEntityNotFound(_0x34c0cf,null))[_0xd2e1('0x22')](removeEntity(_0x34c0cf,null))['catch'](handleError(_0x34c0cf,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 889fd91..58ae16a 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 _0xec3c=['rimraf','../../config/environment','./variable.attributes','define','Variable','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x34f9b4,_0x4aba0d){var _0x3d454a=function(_0x368fc0){while(--_0x368fc0){_0x34f9b4['push'](_0x34f9b4['shift']());}};_0x3d454a(++_0x4aba0d);}(_0xec3c,0x6d));var _0xcec3=function(_0x241dbf,_0x2fffa5){_0x241dbf=_0x241dbf-0x0;var _0x34b554=_0xec3c[_0x241dbf];return _0x34b554;};'use strict';var _=require(_0xcec3('0x0'));var util=require(_0xcec3('0x1'));var logger=require(_0xcec3('0x2'))(_0xcec3('0x3'));var moment=require(_0xcec3('0x4'));var BPromise=require(_0xcec3('0x5'));var rp=require(_0xcec3('0x6'));var fs=require('fs');var path=require(_0xcec3('0x7'));var rimraf=require(_0xcec3('0x8'));var config=require(_0xcec3('0x9'));var attributes=require(_0xcec3('0xa'));module['exports']=function(_0x1b58ac,_0x3dffd8){return _0x1b58ac[_0xcec3('0xb')](_0xcec3('0xc'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b81=['path','../../config/environment','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x7b81,0x9f));var _0x17b8=function(_0x4e49f7,_0x316afe){_0x4e49f7=_0x4e49f7-0x0;var _0x3b4a59=_0x7b81[_0x4e49f7];return _0x3b4a59;};'use strict';var _=require(_0x17b8('0x0'));var util=require(_0x17b8('0x1'));var logger=require(_0x17b8('0x2'))(_0x17b8('0x3'));var moment=require(_0x17b8('0x4'));var BPromise=require('bluebird');var rp=require(_0x17b8('0x5'));var fs=require('fs');var path=require(_0x17b8('0x6'));var rimraf=require('rimraf');var config=require(_0x17b8('0x7'));var attributes=require('./variable.attributes');module['exports']=function(_0x39c1d4,_0x2637ed){return _0x39c1d4[_0x17b8('0x8')](_0x17b8('0x9'),attributes,{'tableName':_0x17b8('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 c21ecac..f2b6f78 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x545ed3,_0xe51819){var _0x32c68e=function(_0x1d8604){while(--_0x1d8604){_0x545ed3['push'](_0x545ed3['shift']());}};_0x32c68e(++_0xe51819);}(_0x814b,0x1a2));var _0xb814=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x814b[_0x40a825];return _0x273a54;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x4b84=['catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0x5a872c,_0x30c88b){var _0x5df4c9=function(_0x2f1e2b){while(--_0x2f1e2b){_0x5a872c['push'](_0x5a872c['shift']());}};_0x5df4c9(++_0x30c88b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0x4b84[_0x23a79e];return _0x3dab57;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('Variable,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('Variable,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')]({'raw':_0x55e258['options']?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![],'where':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x15')]||null:null,'attributes':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x16')]||null:null,'include':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x55e258['options'][_0x44b8('0x17')],function(_0x3a8aa4){return{'model':db[_0x3a8aa4[_0x44b8('0x19')]],'as':_0x3a8aa4['as'],'attributes':_0x3a8aa4[_0x44b8('0x16')],'include':_0x3a8aa4[_0x44b8('0x17')]?_['map'](_0x3a8aa4[_0x44b8('0x17')],function(_0x54677c){return{'model':db[_0x54677c[_0x44b8('0x19')]],'as':_0x54677c['as'],'attributes':_0x54677c[_0x44b8('0x16')],'include':_0x54677c[_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x54677c[_0x44b8('0x17')],function(_0x59acbc){return{'model':db[_0x59acbc[_0x44b8('0x19')]],'as':_0x59acbc['as'],'attributes':_0x59acbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b8('0x7')](function(_0x350482){logger['info'](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON['stringify'](_0x350482));_0xe3de8f(_0x350482);})[_0x44b8('0x1a')](function(_0x242342){logger['error'](_0x44b8('0x10'),_0x242342['message'],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x242342['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index d4126dd..b8d385c 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 _0x0daf=['Router','../../components/auth/service','./version.controller','get','index','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','/pull','/restart','restart','migrations','exports','express'];(function(_0x57a711,_0x419635){var _0x3e4c01=function(_0xedabd1){while(--_0xedabd1){_0x57a711['push'](_0x57a711['shift']());}};_0x3e4c01(++_0x419635);}(_0x0daf,0x175));var _0xf0da=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0x0daf[_0x59eacf];return _0x5d74f2;};'use strict';var express=require(_0xf0da('0x0'));var router=express[_0xf0da('0x1')]();var auth=require(_0xf0da('0x2'));var controller=require(_0xf0da('0x3'));router[_0xf0da('0x4')]('/',controller[_0xf0da('0x5')]);router['get'](_0xf0da('0x6'),auth['isAuthenticated'](),auth[_0xf0da('0x7')](),controller[_0xf0da('0x8')]);router[_0xf0da('0x4')](_0xf0da('0x9'),auth[_0xf0da('0xa')](),auth[_0xf0da('0x7')](),controller[_0xf0da('0xb')]);router[_0xf0da('0x4')](_0xf0da('0xc'),auth['isAuthenticated'](),auth['canUpdate'](),controller['pull']);router[_0xf0da('0x4')](_0xf0da('0xd'),auth[_0xf0da('0xa')](),controller[_0xf0da('0xe')]);router[_0xf0da('0x4')]('/migrations',controller[_0xf0da('0xf')]);module[_0xf0da('0x10')]=router; \ No newline at end of file +var _0x7754=['restart','/migrations','migrations','Router','../../components/auth/service','./version.controller','index','get','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','/pull','pull','/restart'];(function(_0x4f236d,_0x893a26){var _0x59c1be=function(_0x45cd04){while(--_0x45cd04){_0x4f236d['push'](_0x4f236d['shift']());}};_0x59c1be(++_0x893a26);}(_0x7754,0xe0));var _0x4775=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x7754[_0x1f7201];return _0x289fd2;};'use strict';var express=require('express');var router=express[_0x4775('0x0')]();var auth=require(_0x4775('0x1'));var controller=require(_0x4775('0x2'));router['get']('/',controller[_0x4775('0x3')]);router[_0x4775('0x4')](_0x4775('0x5'),auth['isAuthenticated'](),auth[_0x4775('0x6')](),controller[_0x4775('0x7')]);router[_0x4775('0x4')](_0x4775('0x8'),auth[_0x4775('0x9')](),auth[_0x4775('0x6')](),controller[_0x4775('0xa')]);router[_0x4775('0x4')](_0x4775('0xb'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4775('0xc')]);router[_0x4775('0x4')](_0x4775('0xd'),auth[_0x4775('0x9')](),controller[_0x4775('0xe')]);router[_0x4775('0x4')](_0x4775('0xf'),controller[_0x4775('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 31845ac..e07dce3 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 _0xd3fb=['Database\x20already\x20up-to-date','version','compare-versions','child_process','exec','../../config/environment','update','simple-git','exports','query','fetch','tags','latest','2.0.0','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','catch','migrations','join','server','length','.js','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.','root','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20'];(function(_0x2555f1,_0x16edf1){var _0x4542a0=function(_0x3f4c44){while(--_0x3f4c44){_0x2555f1['push'](_0x2555f1['shift']());}};_0x4542a0(++_0x16edf1);}(_0xd3fb,0x19f));var _0xbd3f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd3fb[_0x1facfa];return _0x9ec701;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0xbd3f('0x0'));var compareVersions=require(_0xbd3f('0x1'));var exec=require(_0xbd3f('0x2'))[_0xbd3f('0x3')];var db=require('../../mysqldb')['db'];var config=require(_0xbd3f('0x4'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xbd3f('0x5'));var git=require(_0xbd3f('0x6'))(config['root']);exports['index']=function(_0x29fee0,_0x5b1b97){var _0x41817c={'current':module[_0xbd3f('0x7')][_0xbd3f('0x0')],'phonebar':0x2};if(_0x29fee0[_0xbd3f('0x8')]&&_0x29fee0[_0xbd3f('0x8')]['latest']){return git[_0xbd3f('0x9')]()[_0xbd3f('0xa')](function(_0x439d6d,_0x43e4b3){_0x41817c[_0xbd3f('0xb')]=(_0x439d6d?module[_0xbd3f('0x7')][_0xbd3f('0x0')]:_0x43e4b3['latest'])||_0xbd3f('0xc');return _0x5b1b97[_0xbd3f('0xd')](0xc8)[_0xbd3f('0xe')](_0x41817c);});}else{return _0x5b1b97['status'](0xc8)[_0xbd3f('0xe')](_0x41817c);}};exports[_0xbd3f('0x9')]=function(_0x16d6fd,_0x5dbfef){return git['fetch']([_0xbd3f('0xf'),'master'],function(_0x4bf01b){if(_0x4bf01b){logger[_0xbd3f('0x10')](_0x4bf01b);return _0x5dbfef[_0xbd3f('0xd')](0x1f4)[_0xbd3f('0xe')](_0x4bf01b);}logger[_0xbd3f('0x11')](_0xbd3f('0x12'));return _0x5dbfef[_0xbd3f('0xd')](0xc8)[_0xbd3f('0xe')]({'output':_0xbd3f('0x13')});});};exports[_0xbd3f('0x14')]=function(_0x7d926c,_0x47c6c1){return git[_0xbd3f('0x14')]([_0xbd3f('0x15'),_0xbd3f('0x16')],function(_0x3d6741){if(_0x3d6741){logger[_0xbd3f('0x10')](_0x3d6741);return _0x47c6c1[_0xbd3f('0xd')](0x1f4)[_0xbd3f('0xe')](_0x3d6741);}logger['info'](_0xbd3f('0x17'));return _0x47c6c1[_0xbd3f('0xd')](0xc8)['json']({'output':_0xbd3f('0x18')});});};exports['pull']=function(_0x57359e,_0x46a42b){exec(_0xbd3f('0x19'),function(_0x31e20b,_0x236bbb,_0x2bfd18){logger[_0xbd3f('0x11')](_0x236bbb);logger[_0xbd3f('0x11')](_0x2bfd18);if(_0x31e20b){logger[_0xbd3f('0x10')](_0x31e20b);return _0x46a42b[_0xbd3f('0xd')](0x1f4)['json'](_0x31e20b);}return _0x46a42b[_0xbd3f('0xd')](0xc8)['json']({'output':_0x236bbb});});};exports['restart']=function(_0x5cb7af,_0x1d35f2){return pm2[_0xbd3f('0x1a')](_0xbd3f('0x1b'))['then'](function(_0xe3c7c4){logger[_0xbd3f('0x11')](_0xbd3f('0x1c'),_0xe3c7c4);return _0x1d35f2['status'](0xc8)[_0xbd3f('0xe')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xbd3f('0x1d')](function(_0xbfb373){logger[_0xbd3f('0x10')](_0xbfb373);return _0x1d35f2[_0xbd3f('0xd')](0x1f4)['json'](_0xbfb373);});};exports[_0xbd3f('0x1e')]=function(_0x59cc23,_0x1c5fc2){var _0x1ccf74=fs['readdirSync'](path[_0xbd3f('0x1f')](config['root'],_0xbd3f('0x20'),_0xbd3f('0x1e')));var _0x4199e5=[];for(var _0x4a13d0=0x0;_0x4a13d0<_0x1ccf74[_0xbd3f('0x21')];_0x4a13d0++){var _0x1dcd40=_0x1ccf74[_0x4a13d0]['replace'](_0xbd3f('0x22'),'');if(compareVersions(module[_0xbd3f('0x7')][_0xbd3f('0x0')],_0x1dcd40)===-0x1){_0x4199e5[_0xbd3f('0x23')](_0x1dcd40);}}if(_0x4199e5[_0xbd3f('0x21')]){var _0x1089bc=_0x4199e5['sort'](compareVersions);var _0xc58936=new Umzug({'storage':_0xbd3f('0x24'),'storageOptions':{'model':db[_0xbd3f('0x25')],'modelName':_0xbd3f('0x25'),'columnName':_0xbd3f('0x0')},'migrations':{'params':[db['sequelize'][_0xbd3f('0x26')](),db['sequelize'][_0xbd3f('0x27')],function(){throw new Error(_0xbd3f('0x28'));}],'path':path['join'](config[_0xbd3f('0x29')],_0xbd3f('0x20'),'migrations'),'pattern':/\.js$/}});_0xc58936['up']({'migrations':_[_0xbd3f('0x2a')](_0x1089bc,function(_0x1cac17){return _0x1cac17+_0xbd3f('0x22');})})['then'](function(){return _0x1c5fc2[_0xbd3f('0xd')](0xc8)[_0xbd3f('0xe')]({'output':_0xbd3f('0x2b')+module[_0xbd3f('0x7')]['version']+_0xbd3f('0x2c')+_['last'](_0x1089bc),'migrations':_[_0xbd3f('0x1f')](_0x1089bc)});})[_0xbd3f('0x1d')](function(_0x4faf04){if(_0x4faf04 instanceof db[_0xbd3f('0x24')]['UniqueConstraintError']){return _0x1c5fc2[_0xbd3f('0xd')](0xc8)['json']({'output':_0xbd3f('0x2d')});}else{return _0x1c5fc2['status'](0x1f4)[_0xbd3f('0xe')](_0x4faf04);}});}else{return _0x1c5fc2['status'](0xc8)[_0xbd3f('0xe')]({'output':_0xbd3f('0x2d')});}}; \ No newline at end of file +var _0xc467=['index','exports','query','fetch','tags','latest','2.0.0','json','status','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_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','server','replace','push','length','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.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','umzug','lodash','version','compare-versions','child_process','exec','../../config/environment','../../config/logger','update','simple-git','root'];(function(_0x2836d3,_0x422f66){var _0x10a971=function(_0x16c393){while(--_0x16c393){_0x2836d3['push'](_0x2836d3['shift']());}};_0x10a971(++_0x422f66);}(_0xc467,0x16f));var _0x7c46=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xc467[_0x5608a3];return _0x1ed50a;};'use strict';var Umzug=require(_0x7c46('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x7c46('0x1'));var pkginfo=require('pkginfo')(module,_0x7c46('0x2'));var compareVersions=require(_0x7c46('0x3'));var exec=require(_0x7c46('0x4'))[_0x7c46('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x7c46('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x7c46('0x7'))(_0x7c46('0x8'));var git=require(_0x7c46('0x9'))(config[_0x7c46('0xa')]);exports[_0x7c46('0xb')]=function(_0x435a73,_0x3942ca){var _0x2adc6e={'current':module[_0x7c46('0xc')]['version'],'phonebar':0x2};if(_0x435a73[_0x7c46('0xd')]&&_0x435a73[_0x7c46('0xd')]['latest']){return git[_0x7c46('0xe')]()[_0x7c46('0xf')](function(_0x2b78fe,_0x60d9e4){_0x2adc6e['latest']=(_0x2b78fe?module[_0x7c46('0xc')]['version']:_0x60d9e4[_0x7c46('0x10')])||_0x7c46('0x11');return _0x3942ca['status'](0xc8)[_0x7c46('0x12')](_0x2adc6e);});}else{return _0x3942ca[_0x7c46('0x13')](0xc8)[_0x7c46('0x12')](_0x2adc6e);}};exports[_0x7c46('0xe')]=function(_0x480e91,_0x3fc92d){return git[_0x7c46('0xe')](['origin',_0x7c46('0x14')],function(_0x2a19b2){if(_0x2a19b2){logger[_0x7c46('0x15')](_0x2a19b2);return _0x3fc92d[_0x7c46('0x13')](0x1f4)['json'](_0x2a19b2);}logger[_0x7c46('0x16')](_0x7c46('0x17'));return _0x3fc92d[_0x7c46('0x13')](0xc8)[_0x7c46('0x12')]({'output':_0x7c46('0x18')});});};exports[_0x7c46('0x19')]=function(_0x24a9bf,_0x157dbb){return git[_0x7c46('0x19')]([_0x7c46('0x1a'),_0x7c46('0x1b')],function(_0x20da72){if(_0x20da72){logger[_0x7c46('0x15')](_0x20da72);return _0x157dbb['status'](0x1f4)[_0x7c46('0x12')](_0x20da72);}logger[_0x7c46('0x16')](_0x7c46('0x1c'));return _0x157dbb['status'](0xc8)[_0x7c46('0x12')]({'output':_0x7c46('0x1d')});});};exports[_0x7c46('0x1e')]=function(_0x174dae,_0x175a4e){exec(_0x7c46('0x1f'),function(_0x285c93,_0x516e56,_0x692f1d){logger[_0x7c46('0x16')](_0x516e56);logger[_0x7c46('0x16')](_0x692f1d);if(_0x285c93){logger['error'](_0x285c93);return _0x175a4e[_0x7c46('0x13')](0x1f4)[_0x7c46('0x12')](_0x285c93);}return _0x175a4e[_0x7c46('0x13')](0xc8)[_0x7c46('0x12')]({'output':_0x516e56});});};exports[_0x7c46('0x20')]=function(_0x1f5501,_0x3e07eb){return pm2['restart']('motion2')[_0x7c46('0x21')](function(_0x375702){logger[_0x7c46('0x16')](_0x7c46('0x22'),_0x375702);return _0x3e07eb['status'](0xc8)[_0x7c46('0x12')]({'output':_0x7c46('0x23')});})[_0x7c46('0x24')](function(_0x14d555){logger[_0x7c46('0x15')](_0x14d555);return _0x3e07eb[_0x7c46('0x13')](0x1f4)[_0x7c46('0x12')](_0x14d555);});};exports[_0x7c46('0x25')]=function(_0x376bae,_0x8f0775){var _0x2ba5a6=fs[_0x7c46('0x26')](path[_0x7c46('0x27')](config[_0x7c46('0xa')],_0x7c46('0x28'),_0x7c46('0x25')));var _0x570094=[];for(var _0x4c2deb=0x0;_0x4c2deb<_0x2ba5a6['length'];_0x4c2deb++){var _0x27430f=_0x2ba5a6[_0x4c2deb][_0x7c46('0x29')]('.js','');if(compareVersions(module['exports'][_0x7c46('0x2')],_0x27430f)===-0x1){_0x570094[_0x7c46('0x2a')](_0x27430f);}}if(_0x570094[_0x7c46('0x2b')]){var _0x13af51=_0x570094['sort'](compareVersions);var _0xa4c9eb=new Umzug({'storage':_0x7c46('0x2c'),'storageOptions':{'model':db[_0x7c46('0x2d')],'modelName':_0x7c46('0x2d'),'columnName':'version'},'migrations':{'params':[db[_0x7c46('0x2c')][_0x7c46('0x2e')](),db[_0x7c46('0x2c')][_0x7c46('0x2f')],function(){throw new Error(_0x7c46('0x30'));}],'path':path[_0x7c46('0x27')](config[_0x7c46('0xa')],_0x7c46('0x28'),_0x7c46('0x25')),'pattern':/\.js$/}});_0xa4c9eb['up']({'migrations':_[_0x7c46('0x31')](_0x13af51,function(_0x5417b3){return _0x5417b3+_0x7c46('0x32');})})[_0x7c46('0x21')](function(){return _0x8f0775[_0x7c46('0x13')](0xc8)[_0x7c46('0x12')]({'output':_0x7c46('0x33')+module[_0x7c46('0xc')][_0x7c46('0x2')]+_0x7c46('0x34')+_[_0x7c46('0x35')](_0x13af51),'migrations':_[_0x7c46('0x27')](_0x13af51)});})[_0x7c46('0x24')](function(_0x570f23){if(_0x570f23 instanceof db[_0x7c46('0x2c')]['UniqueConstraintError']){return _0x8f0775[_0x7c46('0x13')](0xc8)[_0x7c46('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x8f0775[_0x7c46('0x13')](0x1f4)[_0x7c46('0x12')](_0x570f23);}});}else{return _0x8f0775[_0x7c46('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 09869e0..01f8036 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 _0x061e=['delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','update'];(function(_0x31f1bf,_0x79a6f0){var _0x325dcb=function(_0x2ce5e8){while(--_0x2ce5e8){_0x31f1bf['push'](_0x31f1bf['shift']());}};_0x325dcb(++_0x79a6f0);}(_0x061e,0x7f));var _0xe061=function(_0x1dee00,_0x4c15b9){_0x1dee00=_0x1dee00-0x0;var _0x37cc5=_0x061e[_0x1dee00];return _0x37cc5;};'use strict';var multer=require(_0xe061('0x0'));var util=require(_0xe061('0x1'));var path=require(_0xe061('0x2'));var timeout=require(_0xe061('0x3'));var express=require(_0xe061('0x4'));var router=express['Router']();var fs_extra=require(_0xe061('0x5'));var auth=require(_0xe061('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe061('0x7'));var controller=require(_0xe061('0x8'));router[_0xe061('0x9')]('/',auth[_0xe061('0xa')](),controller['index']);router[_0xe061('0x9')](_0xe061('0xb'),auth[_0xe061('0xa')](),controller[_0xe061('0xc')]);router[_0xe061('0x9')](_0xe061('0xd'),auth[_0xe061('0xa')](),controller[_0xe061('0xe')]);router['post']('/',auth[_0xe061('0xa')](),controller[_0xe061('0xf')]);router['put'](_0xe061('0xd'),auth[_0xe061('0xa')](),controller[_0xe061('0x10')]);router[_0xe061('0x11')]('/:id',auth[_0xe061('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb159=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x149ca0,_0x2ac7f5){var _0x56b6b9=function(_0x486ac3){while(--_0x486ac3){_0x149ca0['push'](_0x149ca0['shift']());}};_0x56b6b9(++_0x2ac7f5);}(_0xb159,0x91));var _0x9b15=function(_0x257823,_0x597e9f){_0x257823=_0x257823-0x0;var _0x4d562f=_0xb159[_0x257823];return _0x4d562f;};'use strict';var multer=require(_0x9b15('0x0'));var util=require(_0x9b15('0x1'));var path=require(_0x9b15('0x2'));var timeout=require(_0x9b15('0x3'));var express=require('express');var router=express[_0x9b15('0x4')]();var fs_extra=require(_0x9b15('0x5'));var auth=require(_0x9b15('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9b15('0x7'));var controller=require(_0x9b15('0x8'));router[_0x9b15('0x9')]('/',auth[_0x9b15('0xa')](),controller[_0x9b15('0xb')]);router[_0x9b15('0x9')](_0x9b15('0xc'),auth[_0x9b15('0xa')](),controller['describe']);router[_0x9b15('0x9')]('/:id',auth[_0x9b15('0xa')](),controller[_0x9b15('0xd')]);router[_0x9b15('0xe')]('/',auth[_0x9b15('0xa')](),controller[_0x9b15('0xf')]);router[_0x9b15('0x10')](_0x9b15('0x11'),auth[_0x9b15('0xa')](),controller[_0x9b15('0x12')]);router['delete'](_0x9b15('0x11'),auth[_0x9b15('0xa')](),controller[_0x9b15('0x13')]);module[_0x9b15('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 9dd2edb..0ee2103 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 _0x6a95=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x1f6601,_0x22c4cf){var _0x218871=function(_0x254dfa){while(--_0x254dfa){_0x1f6601['push'](_0x1f6601['shift']());}};_0x218871(++_0x22c4cf);}(_0x6a95,0x1db));var _0x56a9=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x6a95[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'type':{'type':Sequelize[_0x56a9('0x2')]},'uniqueid':{'type':Sequelize[_0x56a9('0x2')]},'calleridnum':{'type':Sequelize[_0x56a9('0x2')]},'calleridname':{'type':Sequelize[_0x56a9('0x2')]},'queue':{'type':Sequelize[_0x56a9('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x56a9('0x3')]},'agentconnectAt':{'type':Sequelize[_0x56a9('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x56a9('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x56a9('0x3')]},'agentdumpAt':{'type':Sequelize[_0x56a9('0x3')]},'holdtime':{'type':Sequelize[_0x56a9('0x4')]},'agentcomplete':{'type':Sequelize[_0x56a9('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x56a9('0x4')]},'agentacw':{'type':Sequelize[_0x56a9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x56a9('0x2')]},'lastevent':{'type':Sequelize[_0x56a9('0x2')]},'channel':{'type':Sequelize[_0x56a9('0x2')]},'channelstate':{'type':Sequelize[_0x56a9('0x4')]},'channelstatedesc':{'type':Sequelize[_0x56a9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x56a9('0x2')]},'connectedlinename':{'type':Sequelize[_0x56a9('0x2')]},'language':{'type':Sequelize[_0x56a9('0x2')]},'accountcode':{'type':Sequelize[_0x56a9('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x56a9('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x56a9('0x2')]},'destchannelstate':{'type':Sequelize[_0x56a9('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x56a9('0x2')]},'destcalleridnum':{'type':Sequelize[_0x56a9('0x2')]},'destcalleridname':{'type':Sequelize[_0x56a9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x56a9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x56a9('0x2')]},'destlanguage':{'type':Sequelize[_0x56a9('0x2')]},'destaccountcode':{'type':Sequelize[_0x56a9('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x56a9('0x2')]},'destuniqueid':{'type':Sequelize[_0x56a9('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x56a9('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x56a9('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x56a9('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x56a9('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x867f=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x248ca2,_0x4cb8d8){var _0x590684=function(_0x2fc702){while(--_0x2fc702){_0x248ca2['push'](_0x248ca2['shift']());}};_0x590684(++_0x4cb8d8);}(_0x867f,0xdc));var _0xf867=function(_0x21fc0a,_0x1c3a72){_0x21fc0a=_0x21fc0a-0x0;var _0x485574=_0x867f[_0x21fc0a];return _0x485574;};'use strict';var Sequelize=require(_0xf867('0x0'));module[_0xf867('0x1')]={'type':{'type':Sequelize[_0xf867('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf867('0x2')]},'calleridname':{'type':Sequelize[_0xf867('0x2')]},'queue':{'type':Sequelize[_0xf867('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf867('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf867('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xf867('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xf867('0x3')]},'agentdumpAt':{'type':Sequelize[_0xf867('0x3')]},'holdtime':{'type':Sequelize[_0xf867('0x4')]},'agentcomplete':{'type':Sequelize[_0xf867('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xf867('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf867('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xf867('0x4')]},'agentacw':{'type':Sequelize[_0xf867('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xf867('0x2')]},'channel':{'type':Sequelize[_0xf867('0x2')]},'channelstate':{'type':Sequelize[_0xf867('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf867('0x2')]},'language':{'type':Sequelize[_0xf867('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf867('0x2')]},'exten':{'type':Sequelize[_0xf867('0x2')]},'priority':{'type':Sequelize[_0xf867('0x2')]},'destchannel':{'type':Sequelize[_0xf867('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf867('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf867('0x2')]},'destcalleridname':{'type':Sequelize[_0xf867('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf867('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf867('0x2')]},'destlanguage':{'type':Sequelize[_0xf867('0x2')]},'destaccountcode':{'type':Sequelize[_0xf867('0x2')]},'destcontext':{'type':Sequelize[_0xf867('0x2')]},'destexten':{'type':Sequelize[_0xf867('0x2')]},'destpriority':{'type':Sequelize[_0xf867('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xf867('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf867('0x2')],'comment':_0xf867('0x6')},'transferexten':{'type':Sequelize[_0xf867('0x2')]},'transferuniqueid':{'type':Sequelize[_0xf867('0x2')]},'agententerreason':{'type':Sequelize[_0xf867('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 87565d2..bd602bd 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(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 7107373..7641179 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 _0x68f5=['bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment'];(function(_0x71ed21,_0x515877){var _0x8c3050=function(_0x1cae55){while(--_0x1cae55){_0x71ed21['push'](_0x71ed21['shift']());}};_0x8c3050(++_0x515877);}(_0x68f5,0x11a));var _0x568f=function(_0x39e134,_0xd37a5d){_0x39e134=_0x39e134-0x0;var _0x3239a7=_0x68f5[_0x39e134];return _0x3239a7;};'use strict';var _=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var logger=require(_0x568f('0x2'))('api');var moment=require(_0x568f('0x3'));var BPromise=require(_0x568f('0x4'));var rp=require(_0x568f('0x5'));var fs=require('fs');var path=require(_0x568f('0x6'));var rimraf=require(_0x568f('0x7'));var config=require('../../config/environment');var attributes=require(_0x568f('0x8'));module[_0x568f('0x9')]=function(_0x31444b,_0x3181fd){return _0x31444b['define']('VoiceAgentReport',attributes,{'tableName':_0x568f('0xa'),'paranoid':![],'indexes':[{'fields':[_0x568f('0xb'),_0x568f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b83=['./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x2d48cb,_0x4dd465){var _0x9f5395=function(_0x4cb289){while(--_0x4cb289){_0x2d48cb['push'](_0x2d48cb['shift']());}};_0x9f5395(++_0x4dd465);}(_0x2b83,0x1d3));var _0x32b8=function(_0x25598c,_0x9ec56c){_0x25598c=_0x25598c-0x0;var _0x57813c=_0x2b83[_0x25598c];return _0x57813c;};'use strict';var _=require('lodash');var util=require(_0x32b8('0x0'));var logger=require(_0x32b8('0x1'))('api');var moment=require(_0x32b8('0x2'));var BPromise=require(_0x32b8('0x3'));var rp=require(_0x32b8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x32b8('0x5'));var attributes=require(_0x32b8('0x6'));module['exports']=function(_0x6bbc3d,_0x55abd0){return _0x6bbc3d[_0x32b8('0x7')](_0x32b8('0x8'),attributes,{'tableName':_0x32b8('0x9'),'paranoid':![],'indexes':[{'fields':[_0x32b8('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index d4121bc..afd2993 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 _0x7713=['rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','create','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','VoiceAgentReport','update','body','options','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x7713,0x17a));var _0x3771=function(_0x55f94a,_0x320f6d){_0x55f94a=_0x55f94a-0x0;var _0x5c67d9=_0x7713[_0x55f94a];return _0x5c67d9;};'use strict';var _=require(_0x3771('0x0'));var util=require(_0x3771('0x1'));var moment=require('moment');var BPromise=require(_0x3771('0x2'));var rs=require(_0x3771('0x3'));var fs=require('fs');var Redis=require(_0x3771('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3771('0x5'));var logger=require(_0x3771('0x6'))(_0x3771('0x7'));var config=require(_0x3771('0x8'));var jayson=require(_0x3771('0x9'));var client=jayson[_0x3771('0xa')][_0x3771('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a9825,_0x433e7a,_0x43ebea){return new BPromise(function(_0x25f3e5,_0x2eccb6){return client[_0x3771('0xc')](_0x2a9825,_0x43ebea)[_0x3771('0xd')](function(_0x62961e){logger['info'](_0x3771('0xe'),_0x433e7a,_0x3771('0xf'));logger[_0x3771('0x10')](_0x3771('0x11'),_0x433e7a,'request\x20sent',JSON[_0x3771('0x12')](_0x62961e));if(_0x62961e[_0x3771('0x13')]){if(_0x62961e[_0x3771('0x13')]['code']===0x1f4){logger[_0x3771('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x433e7a,_0x62961e[_0x3771('0x13')]['message']);return _0x2eccb6(_0x62961e[_0x3771('0x13')][_0x3771('0x14')]);}logger[_0x3771('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x433e7a,_0x62961e[_0x3771('0x13')][_0x3771('0x14')]);return _0x25f3e5(_0x62961e[_0x3771('0x13')][_0x3771('0x14')]);}else{logger[_0x3771('0x15')]('VoiceAgentReport,\x20%s,\x20%s',_0x433e7a,_0x3771('0xf'));_0x25f3e5(_0x62961e[_0x3771('0x16')][_0x3771('0x14')]);}})[_0x3771('0x17')](function(_0x5ccdb8){logger[_0x3771('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x433e7a,_0x5ccdb8);_0x2eccb6(_0x5ccdb8);});});}exports['CreateVoiceAgentReport']=function(_0x580e8f){var _0x5e6c68=this;return new Promise(function(_0x5489ec,_0x442657){return db['VoiceAgentReport'][_0x3771('0x18')](_0x580e8f['body'],{'raw':_0x580e8f['options']?_0x580e8f['options'][_0x3771('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x69d1a0){logger[_0x3771('0x15')](_0x3771('0x1a'),_0x580e8f);logger['debug'](_0x3771('0x1a'),_0x580e8f,JSON[_0x3771('0x12')](_0x69d1a0));_0x5489ec(_0x69d1a0);})[_0x3771('0x17')](function(_0x18847e){logger[_0x3771('0x13')](_0x3771('0x1a'),_0x18847e[_0x3771('0x14')],_0x580e8f);_0x442657(_0x5e6c68[_0x3771('0x13')](0x1f4,_0x18847e['message']));});});};exports[_0x3771('0x1b')]=function(_0x561450){var _0x4cccaa=this;return new Promise(function(_0xab451f,_0x2882a6){return db[_0x3771('0x1c')][_0x3771('0x1d')](_0x561450[_0x3771('0x1e')],{'raw':_0x561450[_0x3771('0x1f')]?_0x561450[_0x3771('0x1f')][_0x3771('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x561450[_0x3771('0x1f')]?_0x561450[_0x3771('0x1f')][_0x3771('0x20')]||null:null,'attributes':_0x561450[_0x3771('0x1f')]?_0x561450['options'][_0x3771('0x21')]||null:null,'limit':_0x561450[_0x3771('0x1f')]?_0x561450['options'][_0x3771('0x22')]||null:null})[_0x3771('0xd')](function(_0x4f8291){logger['info'](_0x3771('0x1b'),_0x561450);logger['debug']('UpdateVoiceAgentReport',_0x561450,JSON[_0x3771('0x12')](_0x4f8291));_0xab451f(_0x4f8291);})[_0x3771('0x17')](function(_0x23ef1a){logger[_0x3771('0x13')](_0x3771('0x1b'),_0x23ef1a[_0x3771('0x14')],_0x561450);_0x2882a6(_0x4cccaa['error'](0x1f4,_0x23ef1a[_0x3771('0x14')]));});});}; \ No newline at end of file +var _0x8490=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','stringify','UpdateVoiceAgentReport','update','raw','where','limit','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x58893c,_0x132cce){var _0x1867ed=function(_0x15e02a){while(--_0x15e02a){_0x58893c['push'](_0x58893c['shift']());}};_0x1867ed(++_0x132cce);}(_0x8490,0x1e0));var _0x0849=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x8490[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x0849('0x0'));var util=require('util');var moment=require(_0x0849('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0849('0x2'));var db=require(_0x0849('0x3'))['db'];var utils=require(_0x0849('0x4'));var logger=require(_0x0849('0x5'))(_0x0849('0x6'));var config=require(_0x0849('0x7'));var jayson=require(_0x0849('0x8'));var client=jayson[_0x0849('0x9')][_0x0849('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26cd8f,_0x36c467,_0x4241b0){return new BPromise(function(_0x3b2e74,_0x48eec5){return client['request'](_0x26cd8f,_0x4241b0)[_0x0849('0xb')](function(_0x10e0a8){logger[_0x0849('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x36c467,_0x0849('0xd'));logger[_0x0849('0xe')](_0x0849('0xf'),_0x36c467,_0x0849('0xd'),JSON['stringify'](_0x10e0a8));if(_0x10e0a8[_0x0849('0x10')]){if(_0x10e0a8[_0x0849('0x10')][_0x0849('0x11')]===0x1f4){logger[_0x0849('0x10')](_0x0849('0x12'),_0x36c467,_0x10e0a8[_0x0849('0x10')][_0x0849('0x13')]);return _0x48eec5(_0x10e0a8[_0x0849('0x10')][_0x0849('0x13')]);}logger[_0x0849('0x10')](_0x0849('0x12'),_0x36c467,_0x10e0a8[_0x0849('0x10')][_0x0849('0x13')]);return _0x3b2e74(_0x10e0a8[_0x0849('0x10')][_0x0849('0x13')]);}else{logger['info'](_0x0849('0x12'),_0x36c467,_0x0849('0xd'));_0x3b2e74(_0x10e0a8[_0x0849('0x14')]['message']);}})[_0x0849('0x15')](function(_0x3ecb2e){logger[_0x0849('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x36c467,_0x3ecb2e);_0x48eec5(_0x3ecb2e);});});}exports[_0x0849('0x16')]=function(_0x27098d){var _0x2cd3fb=this;return new Promise(function(_0x4b7ac9,_0x6e26e6){return db[_0x0849('0x17')][_0x0849('0x18')](_0x27098d[_0x0849('0x19')],{'raw':_0x27098d[_0x0849('0x1a')]?_0x27098d['options']['raw']===undefined?!![]:![]:!![]})[_0x0849('0xb')](function(_0x17e2f2){logger[_0x0849('0xc')](_0x0849('0x16'),_0x27098d);logger[_0x0849('0xe')](_0x0849('0x16'),_0x27098d,JSON[_0x0849('0x1b')](_0x17e2f2));_0x4b7ac9(_0x17e2f2);})['catch'](function(_0x3489aa){logger[_0x0849('0x10')](_0x0849('0x16'),_0x3489aa[_0x0849('0x13')],_0x27098d);_0x6e26e6(_0x2cd3fb['error'](0x1f4,_0x3489aa[_0x0849('0x13')]));});});};exports[_0x0849('0x1c')]=function(_0x49fd9a){var _0x2db8d0=this;return new Promise(function(_0xb4d55e,_0x230775){return db[_0x0849('0x17')][_0x0849('0x1d')](_0x49fd9a[_0x0849('0x19')],{'raw':_0x49fd9a[_0x0849('0x1a')]?_0x49fd9a['options'][_0x0849('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49fd9a[_0x0849('0x1a')]?_0x49fd9a['options'][_0x0849('0x1f')]||null:null,'attributes':_0x49fd9a[_0x0849('0x1a')]?_0x49fd9a[_0x0849('0x1a')]['attributes']||null:null,'limit':_0x49fd9a['options']?_0x49fd9a[_0x0849('0x1a')][_0x0849('0x20')]||null:null})[_0x0849('0xb')](function(_0x4b0a7b){logger[_0x0849('0xc')](_0x0849('0x1c'),_0x49fd9a);logger[_0x0849('0xe')](_0x0849('0x1c'),_0x49fd9a,JSON[_0x0849('0x1b')](_0x4b0a7b));_0xb4d55e(_0x4b0a7b);})[_0x0849('0x15')](function(_0xa53063){logger[_0x0849('0x10')](_0x0849('0x1c'),_0xa53063[_0x0849('0x13')],_0x49fd9a);_0x230775(_0x2db8d0[_0x0849('0x10')](0x1f4,_0xa53063['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 41381ae..b0957bf 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 _0x98a8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports'];(function(_0x2f1171,_0x128d87){var _0x561e07=function(_0x1957d8){while(--_0x1957d8){_0x2f1171['push'](_0x2f1171['shift']());}};_0x561e07(++_0x128d87);}(_0x98a8,0x12c));var _0x898a=function(_0x113781,_0x33ebbf){_0x113781=_0x113781-0x0;var _0x1b740a=_0x98a8[_0x113781];return _0x1b740a;};'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')]('/',auth[_0x898a('0xb')](),controller['index']);router[_0x898a('0xa')]('/describe',auth[_0x898a('0xb')](),controller['describe']);router[_0x898a('0xa')](_0x898a('0xc'),auth[_0x898a('0xb')](),controller[_0x898a('0xd')]);router[_0x898a('0xe')]('/',auth[_0x898a('0xb')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x11')]);router['delete'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x12')]);module[_0x898a('0x13')]=router; \ No newline at end of file +var _0xd0bb=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x15cd59,_0x3a34ef){var _0x19a1bf=function(_0x10cd12){while(--_0x10cd12){_0x15cd59['push'](_0x15cd59['shift']());}};_0x19a1bf(++_0x3a34ef);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x482a1c,_0xcecccf){_0x482a1c=_0x482a1c-0x0;var _0x2dab39=_0xd0bb[_0x482a1c];return _0x2dab39;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./voiceCallReport.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xb')]);router[_0xbd0b('0x7')](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x10')]);router['delete'](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index a1579ee..2847255 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 _0xdc64=['internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x409582,_0x1f0415){var _0xc9369d=function(_0x18dddf){while(--_0x18dddf){_0x409582['push'](_0x409582['shift']());}};_0xc9369d(++_0x1f0415);}(_0xdc64,0x80));var _0x4dc6=function(_0x15d2d4,_0x512a97){_0x15d2d4=_0x15d2d4-0x0;var _0x6bc721=_0xdc64[_0x15d2d4];return _0x6bc721;};'use strict';var Sequelize=require(_0x4dc6('0x0'));module[_0x4dc6('0x1')]={'uniqueid':{'type':Sequelize[_0x4dc6('0x2')]},'type':{'type':Sequelize[_0x4dc6('0x3')]('inbound',_0x4dc6('0x4'),_0x4dc6('0x5'),_0x4dc6('0x6'),_0x4dc6('0x7'),_0x4dc6('0x8'))},'tag':{'type':Sequelize[_0x4dc6('0x2')]},'accountcode':{'type':Sequelize[_0x4dc6('0x2')]},'source':{'type':Sequelize[_0x4dc6('0x2')]},'destination':{'type':Sequelize[_0x4dc6('0x2')]},'destinationcontext':{'type':Sequelize[_0x4dc6('0x2')]},'callerid':{'type':Sequelize[_0x4dc6('0x2')]},'channel':{'type':Sequelize[_0x4dc6('0x2')]},'destinationchannel':{'type':Sequelize[_0x4dc6('0x2')]},'lastapplication':{'type':Sequelize[_0x4dc6('0x2')]},'lastdata':{'type':Sequelize[_0x4dc6('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x4dc6('0xa')]},'answertime':{'type':Sequelize[_0x4dc6('0xa')]},'endtime':{'type':Sequelize[_0x4dc6('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x4dc6('0xb')]},'mohtime':{'type':Sequelize[_0x4dc6('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x4dc6('0x2')]},'userfield':{'type':Sequelize[_0x4dc6('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x4dc6('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x4dc6('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x4dc6('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x4dc6('0x2')]}}; \ No newline at end of file +var _0x9e7b=['inbound','internal','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM'];(function(_0x534ebb,_0x1c5cc8){var _0x358229=function(_0x3fef1c){while(--_0x3fef1c){_0x534ebb['push'](_0x534ebb['shift']());}};_0x358229(++_0x1c5cc8);}(_0x9e7b,0xed));var _0xb9e7=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x9e7b[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require(_0xb9e7('0x0'));module[_0xb9e7('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb9e7('0x2')](_0xb9e7('0x3'),_0xb9e7('0x4'),'outbound',_0xb9e7('0x5'),_0xb9e7('0x6'),_0xb9e7('0x7'))},'tag':{'type':Sequelize[_0xb9e7('0x8')]},'accountcode':{'type':Sequelize[_0xb9e7('0x8')]},'source':{'type':Sequelize[_0xb9e7('0x8')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xb9e7('0x8')]},'callerid':{'type':Sequelize[_0xb9e7('0x8')]},'channel':{'type':Sequelize[_0xb9e7('0x8')]},'destinationchannel':{'type':Sequelize[_0xb9e7('0x8')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xb9e7('0x9')]},'starttime':{'type':Sequelize[_0xb9e7('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb9e7('0xa')]},'duration':{'type':Sequelize[_0xb9e7('0xb')]},'billableseconds':{'type':Sequelize[_0xb9e7('0xb')]},'mohtime':{'type':Sequelize[_0xb9e7('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb9e7('0x8')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xb9e7('0x8')]},'userDisposition':{'type':Sequelize[_0xb9e7('0x8')]},'userSecondDisposition':{'type':Sequelize[_0xb9e7('0x8')]},'userThirdDisposition':{'type':Sequelize[_0xb9e7('0x8')]},'note':{'type':Sequelize[_0xb9e7('0x8')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 7138b34..22aec67 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(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0x5f2f,0x73));var _0xf5f2=function(_0x139e43,_0x443da9){_0x139e43=_0x139e43-0x0;var _0x4463ef=_0x5f2f[_0x139e43];return _0x4463ef;};'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 _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x14db7e,_0x5d001e){_0x14db7e=_0x14db7e-0x0;var _0x5f5b45=_0x2032[_0x14db7e];return _0x5f5b45;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index f4045a4..4f58a42 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 _0x1c81=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x247a6d,_0x2c201f){var _0x4b437f=function(_0x17a018){while(--_0x17a018){_0x247a6d['push'](_0x247a6d['shift']());}};_0x4b437f(++_0x2c201f);}(_0x1c81,0x7e));var _0x11c8=function(_0x4f5906,_0x3b22d0){_0x4f5906=_0x4f5906-0x0;var _0x22ea8b=_0x1c81[_0x4f5906];return _0x22ea8b;};'use strict';var _=require(_0x11c8('0x0'));var util=require(_0x11c8('0x1'));var logger=require(_0x11c8('0x2'))(_0x11c8('0x3'));var moment=require(_0x11c8('0x4'));var BPromise=require(_0x11c8('0x5'));var rp=require(_0x11c8('0x6'));var fs=require('fs');var path=require(_0x11c8('0x7'));var rimraf=require(_0x11c8('0x8'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x11c8('0x9')]=function(_0x309621,_0x36a501){return _0x309621[_0x11c8('0xa')](_0x11c8('0xb'),attributes,{'tableName':_0x11c8('0xc'),'paranoid':![],'indexes':[{'fields':[_0x11c8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6dc4=['report_call','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6dc4,0x1a5));var _0x46dc=function(_0x85eedc,_0x577293){_0x85eedc=_0x85eedc-0x0;var _0x3b8ee1=_0x6dc4[_0x85eedc];return _0x3b8ee1;};'use strict';var _=require('lodash');var util=require(_0x46dc('0x0'));var logger=require(_0x46dc('0x1'))('api');var moment=require(_0x46dc('0x2'));var BPromise=require(_0x46dc('0x3'));var rp=require(_0x46dc('0x4'));var fs=require('fs');var path=require(_0x46dc('0x5'));var rimraf=require(_0x46dc('0x6'));var config=require(_0x46dc('0x7'));var attributes=require(_0x46dc('0x8'));module['exports']=function(_0x1918b9,_0x3378f9){return _0x1918b9[_0x46dc('0x9')](_0x46dc('0xa'),attributes,{'tableName':_0x46dc('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c94e859..a85de82 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 _0xd602=['VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','raw','options','where','limit','include','model','map','attributes','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xd602,0xc4));var _0x2d60=function(_0x1f23f4,_0x4fb6d6){_0x1f23f4=_0x1f23f4-0x0;var _0x2a63fc=_0xd602[_0x1f23f4];return _0x2a63fc;};'use strict';var _=require(_0x2d60('0x0'));var util=require('util');var moment=require(_0x2d60('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d60('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d60('0x3'));var logger=require(_0x2d60('0x4'))(_0x2d60('0x5'));var config=require(_0x2d60('0x6'));var jayson=require(_0x2d60('0x7'));var client=jayson[_0x2d60('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf25cf3,_0x121efb,_0x3cb6ee){return new BPromise(function(_0x46bfc2,_0x33fc7a){return client['request'](_0xf25cf3,_0x3cb6ee)[_0x2d60('0x9')](function(_0x57a380){logger[_0x2d60('0xa')](_0x2d60('0xb'),_0x121efb,_0x2d60('0xc'));logger[_0x2d60('0xd')](_0x2d60('0xe'),_0x121efb,'request\x20sent',JSON[_0x2d60('0xf')](_0x57a380));if(_0x57a380['error']){if(_0x57a380[_0x2d60('0x10')]['code']===0x1f4){logger[_0x2d60('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x121efb,_0x57a380['error'][_0x2d60('0x11')]);return _0x33fc7a(_0x57a380[_0x2d60('0x10')]['message']);}logger[_0x2d60('0x10')](_0x2d60('0xb'),_0x121efb,_0x57a380[_0x2d60('0x10')]['message']);return _0x46bfc2(_0x57a380[_0x2d60('0x10')][_0x2d60('0x11')]);}else{logger[_0x2d60('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x121efb,'request\x20sent');_0x46bfc2(_0x57a380['result'][_0x2d60('0x11')]);}})[_0x2d60('0x12')](function(_0x2c7b40){logger[_0x2d60('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x121efb,_0x2c7b40);_0x33fc7a(_0x2c7b40);});});}exports[_0x2d60('0x13')]=function(_0x1b1253){var _0xf21345=this;return new Promise(function(_0x32a3ad,_0x4e9b00){return db[_0x2d60('0x14')][_0x2d60('0x15')]({'raw':_0x1b1253['options']?_0x1b1253['options'][_0x2d60('0x16')]===undefined?!![]:![]:!![],'where':_0x1b1253[_0x2d60('0x17')]?_0x1b1253[_0x2d60('0x17')][_0x2d60('0x18')]||null:null,'attributes':_0x1b1253['options']?_0x1b1253[_0x2d60('0x17')]['attributes']||null:null,'limit':_0x1b1253['options']?_0x1b1253[_0x2d60('0x17')][_0x2d60('0x19')]||null:null,'include':_0x1b1253['options']?_0x1b1253[_0x2d60('0x17')][_0x2d60('0x1a')]?_['map'](_0x1b1253[_0x2d60('0x17')][_0x2d60('0x1a')],function(_0x2d45bf){return{'model':db[_0x2d45bf[_0x2d60('0x1b')]],'as':_0x2d45bf['as'],'attributes':_0x2d45bf['attributes'],'include':_0x2d45bf[_0x2d60('0x1a')]?_[_0x2d60('0x1c')](_0x2d45bf[_0x2d60('0x1a')],function(_0xaeef41){return{'model':db[_0xaeef41[_0x2d60('0x1b')]],'as':_0xaeef41['as'],'attributes':_0xaeef41[_0x2d60('0x1d')],'include':_0xaeef41[_0x2d60('0x1a')]?_[_0x2d60('0x1c')](_0xaeef41[_0x2d60('0x1a')],function(_0x576ab8){return{'model':db[_0x576ab8['model']],'as':_0x576ab8['as'],'attributes':_0x576ab8[_0x2d60('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2d60('0x9')](function(_0x35dbe9){logger[_0x2d60('0xa')]('GetVoiceCallReport',_0x1b1253);logger['debug'](_0x2d60('0x13'),_0x1b1253,JSON[_0x2d60('0xf')](_0x35dbe9));_0x32a3ad(_0x35dbe9);})[_0x2d60('0x12')](function(_0xc0b66){logger[_0x2d60('0x10')](_0x2d60('0x13'),_0xc0b66[_0x2d60('0x11')],_0x1b1253);_0x4e9b00(_0xf21345[_0x2d60('0x10')](0x1f4,_0xc0b66[_0x2d60('0x11')]));});});};exports[_0x2d60('0x1e')]=function(_0x60b589){var _0x3734a6=this;return new Promise(function(_0x3111ae,_0x4aeacc){return db[_0x2d60('0x14')][_0x2d60('0x1f')](_0x60b589[_0x2d60('0x20')],{'raw':_0x60b589[_0x2d60('0x17')]?_0x60b589[_0x2d60('0x17')][_0x2d60('0x16')]===undefined?!![]:![]:!![]})[_0x2d60('0x9')](function(_0x1c0468){logger['info'](_0x2d60('0x1e'),_0x60b589);logger[_0x2d60('0xd')](_0x2d60('0x1e'),_0x60b589,JSON[_0x2d60('0xf')](_0x1c0468));_0x3111ae(_0x1c0468);})[_0x2d60('0x12')](function(_0x182ff3){logger[_0x2d60('0x10')]('CreateVoiceCallReport',_0x182ff3[_0x2d60('0x11')],_0x60b589);_0x4aeacc(_0x3734a6[_0x2d60('0x10')](0x1f4,_0x182ff3[_0x2d60('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x350e01){var _0x3748dc=this;return new Promise(function(_0x1b3f1c,_0x15a49e){return db[_0x2d60('0x14')][_0x2d60('0x21')](_0x350e01[_0x2d60('0x20')],{'raw':_0x350e01[_0x2d60('0x17')]?_0x350e01['options'][_0x2d60('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x350e01[_0x2d60('0x17')]?_0x350e01[_0x2d60('0x17')][_0x2d60('0x18')]||null:null,'attributes':_0x350e01[_0x2d60('0x17')]?_0x350e01['options']['attributes']||null:null,'limit':_0x350e01[_0x2d60('0x17')]?_0x350e01['options'][_0x2d60('0x19')]||null:null})[_0x2d60('0x9')](function(_0x15682d){logger[_0x2d60('0xa')](_0x2d60('0x22'),_0x350e01);logger[_0x2d60('0xd')]('UpdateVoiceCallReport',_0x350e01,JSON['stringify'](_0x15682d));_0x1b3f1c(_0x15682d);})[_0x2d60('0x12')](function(_0x49ddda){logger[_0x2d60('0x10')](_0x2d60('0x22'),_0x49ddda[_0x2d60('0x11')],_0x350e01);_0x15a49e(_0x3748dc['error'](0x1f4,_0x49ddda['message']));});});}; \ No newline at end of file +var _0x7c43=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceCallReport','options','where','limit','include','map','model','attributes','then','GetVoiceCallReport','body','raw','CreateVoiceCallReport','update','UpdateVoiceCallReport','lodash','util','moment'];(function(_0x431590,_0x2d1b31){var _0x5c3ec5=function(_0x2813e1){while(--_0x2813e1){_0x431590['push'](_0x431590['shift']());}};_0x5c3ec5(++_0x2d1b31);}(_0x7c43,0xed));var _0x37c4=function(_0x5bf619,_0x15df87){_0x5bf619=_0x5bf619-0x0;var _0x49cd77=_0x7c43[_0x5bf619];return _0x49cd77;};'use strict';var _=require(_0x37c4('0x0'));var util=require(_0x37c4('0x1'));var moment=require(_0x37c4('0x2'));var BPromise=require(_0x37c4('0x3'));var rs=require(_0x37c4('0x4'));var fs=require('fs');var Redis=require(_0x37c4('0x5'));var db=require(_0x37c4('0x6'))['db'];var utils=require(_0x37c4('0x7'));var logger=require(_0x37c4('0x8'))(_0x37c4('0x9'));var config=require(_0x37c4('0xa'));var jayson=require(_0x37c4('0xb'));var client=jayson[_0x37c4('0xc')][_0x37c4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4b2a9e,_0x1b265d,_0x4ee66d){return new BPromise(function(_0x22727e,_0x865444){return client['request'](_0x4b2a9e,_0x4ee66d)['then'](function(_0x182931){logger[_0x37c4('0xe')](_0x37c4('0xf'),_0x1b265d,_0x37c4('0x10'));logger[_0x37c4('0x11')](_0x37c4('0x12'),_0x1b265d,_0x37c4('0x10'),JSON[_0x37c4('0x13')](_0x182931));if(_0x182931[_0x37c4('0x14')]){if(_0x182931['error'][_0x37c4('0x15')]===0x1f4){logger[_0x37c4('0x14')](_0x37c4('0xf'),_0x1b265d,_0x182931[_0x37c4('0x14')][_0x37c4('0x16')]);return _0x865444(_0x182931[_0x37c4('0x14')][_0x37c4('0x16')]);}logger[_0x37c4('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x1b265d,_0x182931[_0x37c4('0x14')][_0x37c4('0x16')]);return _0x22727e(_0x182931[_0x37c4('0x14')]['message']);}else{logger[_0x37c4('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x1b265d,_0x37c4('0x10'));_0x22727e(_0x182931[_0x37c4('0x17')][_0x37c4('0x16')]);}})[_0x37c4('0x18')](function(_0x2a5010){logger['error'](_0x37c4('0xf'),_0x1b265d,_0x2a5010);_0x865444(_0x2a5010);});});}exports['GetVoiceCallReport']=function(_0x3b6f96){var _0x2b02ae=this;return new Promise(function(_0xaa036b,_0x7c1e1){return db[_0x37c4('0x19')]['findAll']({'raw':_0x3b6f96[_0x37c4('0x1a')]?_0x3b6f96[_0x37c4('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3b6f96[_0x37c4('0x1a')]?_0x3b6f96[_0x37c4('0x1a')][_0x37c4('0x1b')]||null:null,'attributes':_0x3b6f96['options']?_0x3b6f96['options']['attributes']||null:null,'limit':_0x3b6f96[_0x37c4('0x1a')]?_0x3b6f96['options'][_0x37c4('0x1c')]||null:null,'include':_0x3b6f96[_0x37c4('0x1a')]?_0x3b6f96[_0x37c4('0x1a')][_0x37c4('0x1d')]?_[_0x37c4('0x1e')](_0x3b6f96[_0x37c4('0x1a')][_0x37c4('0x1d')],function(_0x364295){return{'model':db[_0x364295[_0x37c4('0x1f')]],'as':_0x364295['as'],'attributes':_0x364295[_0x37c4('0x20')],'include':_0x364295[_0x37c4('0x1d')]?_[_0x37c4('0x1e')](_0x364295[_0x37c4('0x1d')],function(_0x3119da){return{'model':db[_0x3119da[_0x37c4('0x1f')]],'as':_0x3119da['as'],'attributes':_0x3119da[_0x37c4('0x20')],'include':_0x3119da[_0x37c4('0x1d')]?_[_0x37c4('0x1e')](_0x3119da[_0x37c4('0x1d')],function(_0x471474){return{'model':db[_0x471474[_0x37c4('0x1f')]],'as':_0x471474['as'],'attributes':_0x471474[_0x37c4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x37c4('0x21')](function(_0x24a5eb){logger[_0x37c4('0xe')](_0x37c4('0x22'),_0x3b6f96);logger[_0x37c4('0x11')](_0x37c4('0x22'),_0x3b6f96,JSON[_0x37c4('0x13')](_0x24a5eb));_0xaa036b(_0x24a5eb);})[_0x37c4('0x18')](function(_0x58d509){logger[_0x37c4('0x14')]('GetVoiceCallReport',_0x58d509['message'],_0x3b6f96);_0x7c1e1(_0x2b02ae['error'](0x1f4,_0x58d509[_0x37c4('0x16')]));});});};exports['CreateVoiceCallReport']=function(_0x2c7cbb){var _0x54e49c=this;return new Promise(function(_0x20cfd0,_0x3e0225){return db[_0x37c4('0x19')]['create'](_0x2c7cbb[_0x37c4('0x23')],{'raw':_0x2c7cbb[_0x37c4('0x1a')]?_0x2c7cbb['options'][_0x37c4('0x24')]===undefined?!![]:![]:!![]})[_0x37c4('0x21')](function(_0x553125){logger[_0x37c4('0xe')](_0x37c4('0x25'),_0x2c7cbb);logger[_0x37c4('0x11')](_0x37c4('0x25'),_0x2c7cbb,JSON[_0x37c4('0x13')](_0x553125));_0x20cfd0(_0x553125);})[_0x37c4('0x18')](function(_0x8217cf){logger[_0x37c4('0x14')](_0x37c4('0x25'),_0x8217cf[_0x37c4('0x16')],_0x2c7cbb);_0x3e0225(_0x54e49c[_0x37c4('0x14')](0x1f4,_0x8217cf[_0x37c4('0x16')]));});});};exports['UpdateVoiceCallReport']=function(_0x317bb9){var _0x285ddd=this;return new Promise(function(_0x425235,_0x30530a){return db[_0x37c4('0x19')][_0x37c4('0x26')](_0x317bb9['body'],{'raw':_0x317bb9[_0x37c4('0x1a')]?_0x317bb9[_0x37c4('0x1a')][_0x37c4('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x317bb9[_0x37c4('0x1a')]?_0x317bb9[_0x37c4('0x1a')][_0x37c4('0x1b')]||null:null,'attributes':_0x317bb9[_0x37c4('0x1a')]?_0x317bb9[_0x37c4('0x1a')][_0x37c4('0x20')]||null:null,'limit':_0x317bb9[_0x37c4('0x1a')]?_0x317bb9[_0x37c4('0x1a')][_0x37c4('0x1c')]||null:null})[_0x37c4('0x21')](function(_0x47be1a){logger['info'](_0x37c4('0x27'),_0x317bb9);logger[_0x37c4('0x11')]('UpdateVoiceCallReport',_0x317bb9,JSON[_0x37c4('0x13')](_0x47be1a));_0x425235(_0x47be1a);})[_0x37c4('0x18')](function(_0x341731){logger[_0x37c4('0x14')](_0x37c4('0x27'),_0x341731['message'],_0x317bb9);_0x30530a(_0x285ddd[_0x37c4('0x14')](0x1f4,_0x341731['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 8aa6c9a..2cb940c 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 _0xe3f8=['../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1f11de,_0x29f7a8){var _0x49849c=function(_0x562332){while(--_0x562332){_0x1f11de['push'](_0x1f11de['shift']());}};_0x49849c(++_0x29f7a8);}(_0xe3f8,0x158));var _0x8e3f=function(_0x53cdbd,_0x29e771){_0x53cdbd=_0x53cdbd-0x0;var _0x4f5512=_0xe3f8[_0x53cdbd];return _0x4f5512;};'use strict';var multer=require(_0x8e3f('0x0'));var util=require(_0x8e3f('0x1'));var path=require(_0x8e3f('0x2'));var timeout=require(_0x8e3f('0x3'));var express=require(_0x8e3f('0x4'));var router=express[_0x8e3f('0x5')]();var fs_extra=require(_0x8e3f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8e3f('0x7'));var config=require(_0x8e3f('0x8'));var controller=require(_0x8e3f('0x9'));router[_0x8e3f('0xa')]('/',auth[_0x8e3f('0xb')](),controller['index']);router['get'](_0x8e3f('0xc'),auth['isAuthenticated'](),controller[_0x8e3f('0xd')]);router['post']('/',auth[_0x8e3f('0xb')](),controller['create']);router[_0x8e3f('0xe')]('/:id',auth[_0x8e3f('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8e3f('0xf')]);module['exports']=router; \ No newline at end of file +var _0xaa1f=['/:id','update','multer','connect-timeout','Router','fs-extra','./voiceChanSpy.controller','get','index','isAuthenticated','post','create','put'];(function(_0x95c573,_0x284e8f){var _0x52daf0=function(_0x3891f9){while(--_0x3891f9){_0x95c573['push'](_0x95c573['shift']());}};_0x52daf0(++_0x284e8f);}(_0xaa1f,0x113));var _0xfaa1=function(_0x3b34d9,_0x4f4508){_0x3b34d9=_0x3b34d9-0x0;var _0x2d9f9c=_0xaa1f[_0x3b34d9];return _0x2d9f9c;};'use strict';var multer=require(_0xfaa1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfaa1('0x1'));var express=require('express');var router=express[_0xfaa1('0x2')]();var fs_extra=require(_0xfaa1('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfaa1('0x4'));router[_0xfaa1('0x5')]('/',auth['isAuthenticated'](),controller[_0xfaa1('0x6')]);router[_0xfaa1('0x5')]('/:id',auth[_0xfaa1('0x7')](),controller['show']);router[_0xfaa1('0x8')]('/',auth[_0xfaa1('0x7')](),controller[_0xfaa1('0x9')]);router[_0xfaa1('0xa')](_0xfaa1('0xb'),auth['isAuthenticated'](),controller[_0xfaa1('0xc')]);router['delete'](_0xfaa1('0xb'),auth[_0xfaa1('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 5d6f1ee..952d381 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 _0x0440=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','options','join'];(function(_0x3ceb06,_0x8a2f85){var _0x4dff8c=function(_0x469d7d){while(--_0x469d7d){_0x3ceb06['push'](_0x3ceb06['shift']());}};_0x4dff8c(++_0x8a2f85);}(_0x0440,0x16b));var _0x0044=function(_0x324e86,_0x81b1cb){_0x324e86=_0x324e86-0x0;var _0x592846=_0x0440[_0x324e86];return _0x592846;};'use strict';var Sequelize=require(_0x0044('0x0'));module[_0x0044('0x1')]={'name':{'type':Sequelize[_0x0044('0x2')]},'prefix':{'type':Sequelize[_0x0044('0x2')],'unique':_0x0044('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x0044('0x2')],'set':function(_0x242420){this['setDataValue'](_0x0044('0x4'),_0x242420?_0x242420[_0x0044('0x5')](''):[]);},'get':function(){return this[_0x0044('0x6')](_0x0044('0x4'))?this[_0x0044('0x6')](_0x0044('0x4'))[_0x0044('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x0044('0x2')]},'record':{'type':Sequelize[_0x0044('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0044('0x2')]},'description':{'type':Sequelize[_0x0044('0x2')]}}; \ No newline at end of file +var _0xe0c1=['split','BOOLEAN','exports','STRING','name','setDataValue','options'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe0c1,0x14b));var _0x1e0c=function(_0x3644a8,_0x167ced){_0x3644a8=_0x3644a8-0x0;var _0x5b97c6=_0xe0c1[_0x3644a8];return _0x5b97c6;};'use strict';var Sequelize=require('sequelize');module[_0x1e0c('0x0')]={'name':{'type':Sequelize[_0x1e0c('0x1')]},'prefix':{'type':Sequelize[_0x1e0c('0x1')],'unique':_0x1e0c('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x1e0c('0x1')],'set':function(_0x334b60){this[_0x1e0c('0x3')](_0x1e0c('0x4'),_0x334b60?_0x334b60['join'](''):[]);},'get':function(){return this['getDataValue'](_0x1e0c('0x4'))?this['getDataValue']('options')[_0x1e0c('0x5')](''):[];}},'auth':{'type':Sequelize[_0x1e0c('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x1e0c('0x1')]},'record':{'type':Sequelize[_0x1e0c('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1e0c('0x1')]},'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 b4c7d84..1720ba9 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 _0x4ea3=['order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','error','stack','name','send','map','VoiceChanSpy','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty'];(function(_0x46a181,_0x38f540){var _0xf51ca3=function(_0x5976a8){while(--_0x5976a8){_0x46a181['push'](_0x46a181['shift']());}};_0xf51ca3(++_0x38f540);}(_0x4ea3,0x70));var _0x34ea=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4ea3[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x34ea('0x0'));var rimraf=require(_0x34ea('0x1'));var zipdir=require(_0x34ea('0x2'));var jsonpatch=require(_0x34ea('0x3'));var rp=require('request-promise');var moment=require(_0x34ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x34ea('0x5'));var util=require('util');var path=require('path');var sox=require(_0x34ea('0x6'));var csv=require(_0x34ea('0x7'));var ejs=require(_0x34ea('0x8'));var fs=require('fs');var fs_extra=require(_0x34ea('0x9'));var _=require(_0x34ea('0xa'));var squel=require(_0x34ea('0xb'));var crypto=require(_0x34ea('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x34ea('0xd'));var toCsv=require(_0x34ea('0x7'));var querystring=require(_0x34ea('0xe'));var Papa=require('papaparse');var Redis=require(_0x34ea('0xf'));var authService=require(_0x34ea('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34ea('0x11'));var logger=require(_0x34ea('0x12'))(_0x34ea('0x13'));var utils=require('../../config/utils');var config=require(_0x34ea('0x14'));var licenseUtil=require(_0x34ea('0x15'));var db=require(_0x34ea('0x16'))['db'];function respondWithStatusCode(_0x233b11,_0x60725f){_0x60725f=_0x60725f||0xcc;return function(_0xc56a7d){if(_0xc56a7d){return _0x233b11[_0x34ea('0x17')](_0x60725f);}return _0x233b11[_0x34ea('0x18')](_0x60725f)[_0x34ea('0x19')]();};}function respondWithResult(_0x2a19c6,_0x36a4c6){_0x36a4c6=_0x36a4c6||0xc8;return function(_0x5ef9ae){if(_0x5ef9ae){return _0x2a19c6[_0x34ea('0x18')](_0x36a4c6)[_0x34ea('0x1a')](_0x5ef9ae);}};}function respondWithFilteredResult(_0x14ebb9,_0x3f9ffe){return function(_0x44e44e){if(_0x44e44e){var _0x56b2d7=typeof _0x3f9ffe[_0x34ea('0x1b')]===_0x34ea('0x1c')&&typeof _0x3f9ffe[_0x34ea('0x1d')]===_0x34ea('0x1c');var _0x5f420f=_0x44e44e[_0x34ea('0x1e')];var _0x34caea=_0x56b2d7?0x0:_0x3f9ffe[_0x34ea('0x1b')];var _0x5340a4=_0x56b2d7?_0x44e44e[_0x34ea('0x1e')]:_0x3f9ffe[_0x34ea('0x1b')]+_0x3f9ffe[_0x34ea('0x1d')];var _0x127308;if(_0x5340a4>=_0x5f420f){_0x5340a4=_0x5f420f;_0x127308=0xc8;}else{_0x127308=0xce;}_0x14ebb9['status'](_0x127308);return _0x14ebb9[_0x34ea('0x1f')](_0x34ea('0x20'),_0x34caea+'-'+_0x5340a4+'/'+_0x5f420f)[_0x34ea('0x1a')](_0x44e44e);}return null;};}function patchUpdates(_0x247ee7){return function(_0x4fc1a2){try{jsonpatch['apply'](_0x4fc1a2,_0x247ee7,!![]);}catch(_0xe3b292){return BPromise[_0x34ea('0x21')](_0xe3b292);}return _0x4fc1a2[_0x34ea('0x22')]();};}function saveUpdates(_0x51022f,_0x5197a2){return function(_0x2eafc6){if(_0x2eafc6){return _0x2eafc6[_0x34ea('0x23')](_0x51022f)[_0x34ea('0x24')](function(_0x30c4b0){return _0x30c4b0;});}return null;};}function removeEntity(_0x12e7e9,_0x697475){return function(_0x5ade46){if(_0x5ade46){return _0x5ade46[_0x34ea('0x25')]()[_0x34ea('0x24')](function(){var _0x3c0983=_0x5ade46[_0x34ea('0x26')]({'plain':!![]});var _0x5b5885='ChanSpies';return db['UserProfileResource'][_0x34ea('0x25')]({'where':{'type':_0x5b5885,'resourceId':_0x3c0983['id']}})[_0x34ea('0x24')](function(){return _0x5ade46;});})[_0x34ea('0x24')](function(){_0x12e7e9[_0x34ea('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26c80b,_0x267083){return function(_0x27c6f7){if(!_0x27c6f7){_0x26c80b['sendStatus'](0x194);}return _0x27c6f7;};}function handleError(_0x4cded8,_0x5b4727){_0x5b4727=_0x5b4727||0x1f4;return function(_0x4d4360){logger[_0x34ea('0x27')](_0x4d4360[_0x34ea('0x28')]);if(_0x4d4360[_0x34ea('0x29')]){delete _0x4d4360[_0x34ea('0x29')];}_0x4cded8['status'](_0x5b4727)[_0x34ea('0x2a')](_0x4d4360);};}exports['index']=function(_0x2c6de8,_0x4f2b77){var _0x3272f9={},_0x14e018={},_0x3cb968={'count':0x0,'rows':[]};var _0x57b19d=_[_0x34ea('0x2b')](db[_0x34ea('0x2c')]['rawAttributes'],function(_0x10bcfe){return{'name':_0x10bcfe['fieldName'],'type':_0x10bcfe[_0x34ea('0x2d')][_0x34ea('0x2e')]};});_0x14e018[_0x34ea('0x2f')]=_['map'](_0x57b19d,'name');_0x14e018[_0x34ea('0x30')]=_['keys'](_0x2c6de8[_0x34ea('0x30')]);_0x14e018[_0x34ea('0x31')]=_['intersection'](_0x14e018[_0x34ea('0x2f')],_0x14e018[_0x34ea('0x30')]);_0x3272f9[_0x34ea('0x32')]=_[_0x34ea('0x33')](_0x14e018['model'],qs['fields'](_0x2c6de8['query'][_0x34ea('0x34')]));_0x3272f9[_0x34ea('0x32')]=_0x3272f9[_0x34ea('0x32')]['length']?_0x3272f9['attributes']:_0x14e018['model'];if(!_0x2c6de8[_0x34ea('0x30')][_0x34ea('0x35')]('nolimit')){_0x3272f9[_0x34ea('0x1d')]=qs[_0x34ea('0x1d')](_0x2c6de8[_0x34ea('0x30')][_0x34ea('0x1d')]);_0x3272f9[_0x34ea('0x1b')]=qs[_0x34ea('0x1b')](_0x2c6de8['query'][_0x34ea('0x1b')]);}_0x3272f9[_0x34ea('0x36')]=qs[_0x34ea('0x37')](_0x2c6de8[_0x34ea('0x30')]['sort']);_0x3272f9['where']=qs[_0x34ea('0x31')](_[_0x34ea('0x38')](_0x2c6de8[_0x34ea('0x30')],_0x14e018[_0x34ea('0x31')]),_0x57b19d);if(_0x2c6de8[_0x34ea('0x30')]['filter']){_0x3272f9[_0x34ea('0x39')]=_[_0x34ea('0x3a')](_0x3272f9[_0x34ea('0x39')],{'$or':_[_0x34ea('0x2b')](_0x57b19d,function(_0x5787db){if(_0x5787db[_0x34ea('0x2d')]!==_0x34ea('0x3b')){var _0xa1ff39={};_0xa1ff39[_0x5787db[_0x34ea('0x29')]]={'$like':'%'+_0x2c6de8[_0x34ea('0x30')][_0x34ea('0x3c')]+'%'};return _0xa1ff39;}})});}_0x3272f9=_[_0x34ea('0x3a')]({},_0x3272f9,_0x2c6de8[_0x34ea('0x3d')]);var _0x41fefb={'where':_0x3272f9[_0x34ea('0x39')]};return db[_0x34ea('0x2c')]['count'](_0x41fefb)[_0x34ea('0x24')](function(_0x4ae353){_0x3cb968[_0x34ea('0x1e')]=_0x4ae353;if(_0x2c6de8[_0x34ea('0x30')][_0x34ea('0x3e')]){_0x3272f9[_0x34ea('0x3f')]=[{'all':!![]}];}return db[_0x34ea('0x2c')][_0x34ea('0x40')](_0x3272f9);})[_0x34ea('0x24')](function(_0x17ba01){_0x3cb968[_0x34ea('0x41')]=_0x17ba01;return _0x3cb968;})['then'](respondWithFilteredResult(_0x4f2b77,_0x3272f9))[_0x34ea('0x42')](handleError(_0x4f2b77,null));};exports['show']=function(_0x45f170,_0x273a51){var _0x39bc9a={'raw':![],'where':{'id':_0x45f170[_0x34ea('0x43')]['id']}},_0x379282={};_0x379282[_0x34ea('0x2f')]=_['keys'](db[_0x34ea('0x2c')][_0x34ea('0x44')]);_0x379282['query']=_[_0x34ea('0x45')](_0x45f170[_0x34ea('0x30')]);_0x379282[_0x34ea('0x31')]=_[_0x34ea('0x33')](_0x379282[_0x34ea('0x2f')],_0x379282['query']);_0x39bc9a[_0x34ea('0x32')]=_[_0x34ea('0x33')](_0x379282[_0x34ea('0x2f')],qs[_0x34ea('0x34')](_0x45f170[_0x34ea('0x30')][_0x34ea('0x34')]));_0x39bc9a['attributes']=_0x39bc9a['attributes'][_0x34ea('0x46')]?_0x39bc9a[_0x34ea('0x32')]:_0x379282[_0x34ea('0x2f')];if(_0x45f170['query'][_0x34ea('0x3e')]){_0x39bc9a['include']=[{'all':!![]}];}_0x39bc9a=_[_0x34ea('0x3a')]({},_0x39bc9a,_0x45f170['options']);return db[_0x34ea('0x2c')][_0x34ea('0x47')](_0x39bc9a)[_0x34ea('0x24')](handleEntityNotFound(_0x273a51,null))['then'](respondWithResult(_0x273a51,null))[_0x34ea('0x42')](handleError(_0x273a51,null));};exports['create']=function(_0x404a59,_0x3fb739){return db[_0x34ea('0x2c')][_0x34ea('0x48')](_0x404a59['body'],{})[_0x34ea('0x24')](function(_0x2d07cf){var _0x312ff8=_0x404a59[_0x34ea('0x49')][_0x34ea('0x26')]({'plain':!![]});if(!_0x312ff8)throw new Error(_0x34ea('0x4a'));if(_0x312ff8[_0x34ea('0x4b')]==='user'){var _0x1059dc=_0x2d07cf[_0x34ea('0x26')]({'plain':!![]});var _0x26ea1d=_0x34ea('0x4c');return db[_0x34ea('0x4d')][_0x34ea('0x47')]({'where':{'name':_0x26ea1d,'userProfileId':_0x312ff8[_0x34ea('0x4e')]},'raw':!![]})[_0x34ea('0x24')](function(_0x11a9f7){if(_0x11a9f7&&_0x11a9f7[_0x34ea('0x4f')]===0x0){return db[_0x34ea('0x50')][_0x34ea('0x48')]({'name':_0x1059dc[_0x34ea('0x29')],'resourceId':_0x1059dc['id'],'type':_0x11a9f7['name'],'sectionId':_0x11a9f7['id']},{})[_0x34ea('0x24')](function(){return _0x2d07cf;});}else{return _0x2d07cf;}})[_0x34ea('0x42')](function(_0x33f7c6){logger['error'](_0x34ea('0x51'),_0x33f7c6);throw _0x33f7c6;});}return _0x2d07cf;})['then'](respondWithResult(_0x3fb739,0xc9))[_0x34ea('0x42')](handleError(_0x3fb739,null));};exports[_0x34ea('0x23')]=function(_0x47aab6,_0xe8d397){if(_0x47aab6[_0x34ea('0x52')]['id']){delete _0x47aab6[_0x34ea('0x52')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x47aab6[_0x34ea('0x43')]['id']}})['then'](handleEntityNotFound(_0xe8d397,null))['then'](saveUpdates(_0x47aab6[_0x34ea('0x52')],null))['then'](respondWithResult(_0xe8d397,null))[_0x34ea('0x42')](handleError(_0xe8d397,null));};exports[_0x34ea('0x25')]=function(_0x3918c5,_0x443c98){return db[_0x34ea('0x2c')][_0x34ea('0x47')]({'where':{'id':_0x3918c5[_0x34ea('0x43')]['id']}})[_0x34ea('0x24')](handleEntityNotFound(_0x443c98,null))[_0x34ea('0x24')](removeEntity(_0x443c98,null))[_0x34ea('0x42')](handleError(_0x443c98,null));}; \ No newline at end of file +var _0x49e9=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','error','name','index','map','VoiceChanSpy','rawAttributes','type'];(function(_0x13f980,_0x1e1c56){var _0x27153c=function(_0x3953d5){while(--_0x3953d5){_0x13f980['push'](_0x13f980['shift']());}};_0x27153c(++_0x1e1c56);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];function respondWithStatusCode(_0x253d5e,_0x1871a5){_0x1871a5=_0x1871a5||0xcc;return function(_0x17d1f3){if(_0x17d1f3){return _0x253d5e[_0x949e('0x18')](_0x1871a5);}return _0x253d5e[_0x949e('0x19')](_0x1871a5)[_0x949e('0x1a')]();};}function respondWithResult(_0x7a8954,_0x3e0e54){_0x3e0e54=_0x3e0e54||0xc8;return function(_0x7f8be2){if(_0x7f8be2){return _0x7a8954[_0x949e('0x19')](_0x3e0e54)['json'](_0x7f8be2);}};}function respondWithFilteredResult(_0x257981,_0x3d81cd){return function(_0x587bff){if(_0x587bff){var _0xf1f41a=typeof _0x3d81cd['offset']===_0x949e('0x1b')&&typeof _0x3d81cd[_0x949e('0x1c')]==='undefined';var _0x37fd96=_0x587bff[_0x949e('0x1d')];var _0x43498d=_0xf1f41a?0x0:_0x3d81cd[_0x949e('0x1e')];var _0x20333c=_0xf1f41a?_0x587bff['count']:_0x3d81cd[_0x949e('0x1e')]+_0x3d81cd[_0x949e('0x1c')];var _0x476fa8;if(_0x20333c>=_0x37fd96){_0x20333c=_0x37fd96;_0x476fa8=0xc8;}else{_0x476fa8=0xce;}_0x257981[_0x949e('0x19')](_0x476fa8);return _0x257981[_0x949e('0x1f')](_0x949e('0x20'),_0x43498d+'-'+_0x20333c+'/'+_0x37fd96)[_0x949e('0x21')](_0x587bff);}return null;};}function patchUpdates(_0x2f21bd){return function(_0x104740){try{jsonpatch[_0x949e('0x22')](_0x104740,_0x2f21bd,!![]);}catch(_0x23fc20){return BPromise[_0x949e('0x23')](_0x23fc20);}return _0x104740[_0x949e('0x24')]();};}function saveUpdates(_0x1927ab,_0x199d53){return function(_0x2e81f2){if(_0x2e81f2){return _0x2e81f2['update'](_0x1927ab)[_0x949e('0x25')](function(_0x44ffb4){return _0x44ffb4;});}return null;};}function removeEntity(_0x5572ae,_0x48a1d1){return function(_0x23b38e){if(_0x23b38e){return _0x23b38e[_0x949e('0x26')]()[_0x949e('0x25')](function(){var _0x36c890=_0x23b38e[_0x949e('0x27')]({'plain':!![]});var _0x1185b3=_0x949e('0x28');return db[_0x949e('0x29')][_0x949e('0x26')]({'where':{'type':_0x1185b3,'resourceId':_0x36c890['id']}})[_0x949e('0x25')](function(){return _0x23b38e;});})['then'](function(){_0x5572ae[_0x949e('0x19')](0xcc)[_0x949e('0x1a')]();});}};}function handleEntityNotFound(_0x59b3a1,_0x39308f){return function(_0x20061d){if(!_0x20061d){_0x59b3a1['sendStatus'](0x194);}return _0x20061d;};}function handleError(_0x446401,_0x36dc1d){_0x36dc1d=_0x36dc1d||0x1f4;return function(_0x5b9f28){logger[_0x949e('0x2a')](_0x5b9f28['stack']);if(_0x5b9f28['name']){delete _0x5b9f28[_0x949e('0x2b')];}_0x446401['status'](_0x36dc1d)['send'](_0x5b9f28);};}exports[_0x949e('0x2c')]=function(_0x3502c1,_0x3051ec){var _0x4c890f={},_0x4ca7ae={},_0x56dc85={'count':0x0,'rows':[]};var _0x4eddbd=_[_0x949e('0x2d')](db[_0x949e('0x2e')][_0x949e('0x2f')],function(_0x1fe31b){return{'name':_0x1fe31b['fieldName'],'type':_0x1fe31b[_0x949e('0x30')][_0x949e('0x31')]};});_0x4ca7ae[_0x949e('0x32')]=_['map'](_0x4eddbd,_0x949e('0x2b'));_0x4ca7ae[_0x949e('0x33')]=_[_0x949e('0x34')](_0x3502c1['query']);_0x4ca7ae['filters']=_[_0x949e('0x35')](_0x4ca7ae[_0x949e('0x32')],_0x4ca7ae[_0x949e('0x33')]);_0x4c890f[_0x949e('0x36')]=_['intersection'](_0x4ca7ae[_0x949e('0x32')],qs[_0x949e('0x37')](_0x3502c1[_0x949e('0x33')][_0x949e('0x37')]));_0x4c890f[_0x949e('0x36')]=_0x4c890f[_0x949e('0x36')][_0x949e('0x38')]?_0x4c890f[_0x949e('0x36')]:_0x4ca7ae['model'];if(!_0x3502c1['query'][_0x949e('0x39')]('nolimit')){_0x4c890f['limit']=qs[_0x949e('0x1c')](_0x3502c1[_0x949e('0x33')][_0x949e('0x1c')]);_0x4c890f[_0x949e('0x1e')]=qs[_0x949e('0x1e')](_0x3502c1[_0x949e('0x33')][_0x949e('0x1e')]);}_0x4c890f[_0x949e('0x3a')]=qs[_0x949e('0x3b')](_0x3502c1[_0x949e('0x33')][_0x949e('0x3b')]);_0x4c890f[_0x949e('0x3c')]=qs[_0x949e('0x3d')](_[_0x949e('0x3e')](_0x3502c1[_0x949e('0x33')],_0x4ca7ae[_0x949e('0x3d')]),_0x4eddbd);if(_0x3502c1[_0x949e('0x33')]['filter']){_0x4c890f[_0x949e('0x3c')]=_['merge'](_0x4c890f[_0x949e('0x3c')],{'$or':_[_0x949e('0x2d')](_0x4eddbd,function(_0x53629d){if(_0x53629d['type']!=='VIRTUAL'){var _0x1e848c={};_0x1e848c[_0x53629d[_0x949e('0x2b')]]={'$like':'%'+_0x3502c1['query']['filter']+'%'};return _0x1e848c;}})});}_0x4c890f=_['merge']({},_0x4c890f,_0x3502c1[_0x949e('0x3f')]);var _0x2bd51b={'where':_0x4c890f['where']};return db[_0x949e('0x2e')][_0x949e('0x1d')](_0x2bd51b)['then'](function(_0x3a1bc7){_0x56dc85[_0x949e('0x1d')]=_0x3a1bc7;if(_0x3502c1[_0x949e('0x33')][_0x949e('0x40')]){_0x4c890f['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x949e('0x41')](_0x4c890f);})[_0x949e('0x25')](function(_0x7201da){_0x56dc85[_0x949e('0x42')]=_0x7201da;return _0x56dc85;})[_0x949e('0x25')](respondWithFilteredResult(_0x3051ec,_0x4c890f))[_0x949e('0x43')](handleError(_0x3051ec,null));};exports[_0x949e('0x44')]=function(_0x572f20,_0x4c7d73){var _0x985ff8={'raw':![],'where':{'id':_0x572f20[_0x949e('0x45')]['id']}},_0x5e970b={};_0x5e970b[_0x949e('0x32')]=_[_0x949e('0x34')](db[_0x949e('0x2e')][_0x949e('0x2f')]);_0x5e970b[_0x949e('0x33')]=_['keys'](_0x572f20['query']);_0x5e970b[_0x949e('0x3d')]=_[_0x949e('0x35')](_0x5e970b[_0x949e('0x32')],_0x5e970b[_0x949e('0x33')]);_0x985ff8[_0x949e('0x36')]=_['intersection'](_0x5e970b[_0x949e('0x32')],qs[_0x949e('0x37')](_0x572f20['query'][_0x949e('0x37')]));_0x985ff8[_0x949e('0x36')]=_0x985ff8[_0x949e('0x36')][_0x949e('0x38')]?_0x985ff8[_0x949e('0x36')]:_0x5e970b[_0x949e('0x32')];if(_0x572f20[_0x949e('0x33')][_0x949e('0x40')]){_0x985ff8[_0x949e('0x46')]=[{'all':!![]}];}_0x985ff8=_['merge']({},_0x985ff8,_0x572f20[_0x949e('0x3f')]);return db['VoiceChanSpy'][_0x949e('0x47')](_0x985ff8)[_0x949e('0x25')](handleEntityNotFound(_0x4c7d73,null))['then'](respondWithResult(_0x4c7d73,null))[_0x949e('0x43')](handleError(_0x4c7d73,null));};exports[_0x949e('0x48')]=function(_0x121355,_0x2e2b6a){return db[_0x949e('0x2e')][_0x949e('0x48')](_0x121355[_0x949e('0x49')],{})[_0x949e('0x25')](function(_0x5d4348){var _0x8f2a58=_0x121355[_0x949e('0x4a')][_0x949e('0x27')]({'plain':!![]});if(!_0x8f2a58)throw new Error(_0x949e('0x4b'));if(_0x8f2a58[_0x949e('0x4c')]==='user'){var _0x5f23b2=_0x5d4348[_0x949e('0x27')]({'plain':!![]});var _0x16f5ad='ChanSpies';return db[_0x949e('0x4d')][_0x949e('0x47')]({'where':{'name':_0x16f5ad,'userProfileId':_0x8f2a58[_0x949e('0x4e')]},'raw':!![]})[_0x949e('0x25')](function(_0x48c677){if(_0x48c677&&_0x48c677['autoAssociation']===0x0){return db[_0x949e('0x29')][_0x949e('0x48')]({'name':_0x5f23b2[_0x949e('0x2b')],'resourceId':_0x5f23b2['id'],'type':_0x48c677[_0x949e('0x2b')],'sectionId':_0x48c677['id']},{})[_0x949e('0x25')](function(){return _0x5d4348;});}else{return _0x5d4348;}})[_0x949e('0x43')](function(_0x29ebb6){logger[_0x949e('0x2a')](_0x949e('0x4f'),_0x29ebb6);throw _0x29ebb6;});}return _0x5d4348;})['then'](respondWithResult(_0x2e2b6a,0xc9))[_0x949e('0x43')](handleError(_0x2e2b6a,null));};exports['update']=function(_0x2f63aa,_0x4fb3d5){if(_0x2f63aa[_0x949e('0x49')]['id']){delete _0x2f63aa['body']['id'];}return db[_0x949e('0x2e')][_0x949e('0x47')]({'where':{'id':_0x2f63aa['params']['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x4fb3d5,null))[_0x949e('0x25')](saveUpdates(_0x2f63aa[_0x949e('0x49')],null))[_0x949e('0x25')](respondWithResult(_0x4fb3d5,null))[_0x949e('0x43')](handleError(_0x4fb3d5,null));};exports['destroy']=function(_0x48a016,_0x287a45){return db[_0x949e('0x2e')]['find']({'where':{'id':_0x48a016[_0x949e('0x45')]['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x287a45,null))['then'](removeEntity(_0x287a45,null))[_0x949e('0x43')](handleError(_0x287a45,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 1b14d8d..c23eefe 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 _0xc1bc=['Authenticate','password','SIP/%s,%s','name','options','join','length','internal','concat','then','catch','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','merge','CDR(type)=%s','chanspy','record','MixMonitor','recordingFormat','auth'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xc1bc,0xd7));var _0xcc1b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc1bc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xcc1b('0x0'));var BPromise=require(_0xcc1b('0x1'));var attributes=require(_0xcc1b('0x2'));var getUserApplications=function(_0x16a969,_0x2b4f6f,_0x44d6bb){var _0x18aeae=0x1;var _0x1fc507=[];var _0x591996={'context':_0x2b4f6f[_0xcc1b('0x3')]||_0xcc1b('0x4'),'exten':util[_0xcc1b('0x5')](_0xcc1b('0x6'),_0x16a969['prefix'],_0x44d6bb),'type':_0xcc1b('0x7'),'isApp':![],'ChanSpyId':_0x16a969['id'],'UserId':_0x2b4f6f['id']};_0x1fc507[_0xcc1b('0x8')](_[_0xcc1b('0x9')]({'app':'Set','appdata':util['format'](_0xcc1b('0xa'),_0xcc1b('0xb')),'priority':_0x18aeae++},_0x591996));if(_0x16a969[_0xcc1b('0xc')]){_0x1fc507[_0xcc1b('0x8')](_[_0xcc1b('0x9')]({'app':_0xcc1b('0xd'),'appdata':util[_0xcc1b('0x5')]('${UNIQUEID}.%s,a',_0x16a969[_0xcc1b('0xe')]),'priority':_0x18aeae++},_0x591996));}if(_0x16a969[_0xcc1b('0xf')]){_0x1fc507[_0xcc1b('0x8')](_[_0xcc1b('0x9')]({'app':_0xcc1b('0x10'),'appdata':_0x16a969[_0xcc1b('0x11')],'priority':_0x18aeae++},_0x591996));}_0x1fc507[_0xcc1b('0x8')](_[_0xcc1b('0x9')]({'app':'ChanSpy','appdata':util['format'](_0xcc1b('0x12'),_0x2b4f6f[_0xcc1b('0x13')],_0x16a969['options']?_0x16a969[_0xcc1b('0x14')][_0xcc1b('0x15')](''):''),'priority':_0x18aeae++},_0x591996));if(_0x16a969[_0xcc1b('0xc')]){_0x1fc507[_0xcc1b('0x8')](_[_0xcc1b('0x9')]({'app':'StopMixMonitor','priority':_0x18aeae++},_0x591996));}return _0x1fc507;};var getChanSpyApplications=function(_0x4e10fe,_0x40b021){var _0x4874d9=[];for(var _0x38de94=0x0,_0x1ae340=0x1;_0x38de94<_0x40b021[_0xcc1b('0x16')];_0x38de94++,_0x1ae340=0x1){_0x4874d9=_0x4874d9['concat'](getUserApplications(_0x4e10fe,_0x40b021[_0x38de94],_0x40b021[_0x38de94][_0xcc1b('0x17')]));if(_0x40b021[_0x38de94][_0xcc1b('0x17')]!=_0x40b021[_0x38de94]['name']){_0x4874d9=_0x4874d9[_0xcc1b('0x18')](getUserApplications(_0x4e10fe,_0x40b021[_0x38de94],_0x40b021[_0x38de94][_0xcc1b('0x13')]));}}return _0x4874d9;};var getChanSpyPromise=function(_0x69e521,_0x5d6467){return new BPromise(function(_0xd27e32,_0x3ecd3a){return _0x69e521['User']['findAll']({'attributes':['id',_0xcc1b('0x13'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xcc1b('0x19')](function(_0x1dfaef){if(_0x1dfaef){return _0xd27e32(getChanSpyApplications(_0x5d6467,_0x1dfaef));}return _0xd27e32([]);})[_0xcc1b('0x1a')](function(_0x3aeabf){_0x3ecd3a(_0x3aeabf);});});};module['exports']=function(_0x536188,_0x235636){var _0x2a0eba=_0x536188['models'];return _0x536188[_0xcc1b('0x1b')](_0xcc1b('0x1c'),attributes,{'tableName':_0xcc1b('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e8344,_0x45c7d1,_0x49e808){return getChanSpyPromise(_0x2a0eba,_0x2e8344)['then'](function(_0x2f2aa7){if(_0x2f2aa7&&_0x2f2aa7[_0xcc1b('0x16')]){return _0x2a0eba[_0xcc1b('0x1e')][_0xcc1b('0x1f')](_0x2f2aa7);}})[_0xcc1b('0x19')](function(){_0x49e808();})[_0xcc1b('0x1a')](function(_0x1778a7){_0x49e808(_0x1778a7);});},'afterUpdate':function(_0x51e258,_0x515d2c,_0x2e3bbc){return _0x2a0eba[_0xcc1b('0x1e')][_0xcc1b('0x20')]({'where':{'ChanSpyId':_0x51e258['id']}})[_0xcc1b('0x19')](function(){return getChanSpyPromise(_0x2a0eba,_0x51e258);})['then'](function(_0x5a7868){if(_0x5a7868&&_0x5a7868['length']){return _0x2a0eba[_0xcc1b('0x1e')][_0xcc1b('0x1f')](_0x5a7868);}})['then'](function(){_0x2e3bbc();})[_0xcc1b('0x1a')](function(_0xf8850d){_0x2e3bbc(_0xf8850d);});},'afterDestroy':function(_0x184d65,_0x2f97f4,_0x5391b3){return _0x2a0eba['VoiceExtension'][_0xcc1b('0x20')]({'where':{'ChanSpyId':_0x184d65['id']}})[_0xcc1b('0x19')](function(){_0x5391b3();})[_0xcc1b('0x1a')](function(_0x6b716d){_0x5391b3(_0x6b716d);});}}});}; \ No newline at end of file +var _0xe1fd=['password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','system','push','merge','Set','format','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a'];(function(_0x29a247,_0x40df67){var _0x5e249a=function(_0x5f074f){while(--_0x5f074f){_0x29a247['push'](_0x29a247['shift']());}};_0x5e249a(++_0x40df67);}(_0xe1fd,0x13c));var _0xde1f=function(_0x1c7c97,_0x168086){_0x1c7c97=_0x1c7c97-0x0;var _0x1d5252=_0xe1fd[_0x1c7c97];return _0x1d5252;};'use strict';var _=require(_0xde1f('0x0'));var util=require('util');var BPromise=require(_0xde1f('0x1'));var attributes=require(_0xde1f('0x2'));var getUserApplications=function(_0x538ecd,_0x2c106c,_0x4c63a9){var _0x25fbe6=0x1;var _0x1a00cb=[];var _0x2ad4b5={'context':_0x2c106c['context']||_0xde1f('0x3'),'exten':util['format'](_0xde1f('0x4'),_0x538ecd['prefix'],_0x4c63a9),'type':_0xde1f('0x5'),'isApp':![],'ChanSpyId':_0x538ecd['id'],'UserId':_0x2c106c['id']};_0x1a00cb[_0xde1f('0x6')](_[_0xde1f('0x7')]({'app':_0xde1f('0x8'),'appdata':util[_0xde1f('0x9')](_0xde1f('0xa'),'chanspy'),'priority':_0x25fbe6++},_0x2ad4b5));if(_0x538ecd[_0xde1f('0xb')]){_0x1a00cb['push'](_[_0xde1f('0x7')]({'app':_0xde1f('0xc'),'appdata':util[_0xde1f('0x9')](_0xde1f('0xd'),_0x538ecd['recordingFormat']),'priority':_0x25fbe6++},_0x2ad4b5));}if(_0x538ecd['auth']){_0x1a00cb[_0xde1f('0x6')](_[_0xde1f('0x7')]({'app':'Authenticate','appdata':_0x538ecd[_0xde1f('0xe')],'priority':_0x25fbe6++},_0x2ad4b5));}_0x1a00cb[_0xde1f('0x6')](_[_0xde1f('0x7')]({'app':'ChanSpy','appdata':util['format'](_0xde1f('0xf'),_0x2c106c[_0xde1f('0x10')],_0x538ecd[_0xde1f('0x11')]?_0x538ecd['options'][_0xde1f('0x12')](''):''),'priority':_0x25fbe6++},_0x2ad4b5));if(_0x538ecd[_0xde1f('0xb')]){_0x1a00cb[_0xde1f('0x6')](_[_0xde1f('0x7')]({'app':_0xde1f('0x13'),'priority':_0x25fbe6++},_0x2ad4b5));}return _0x1a00cb;};var getChanSpyApplications=function(_0x323708,_0x2c1382){var _0x56c074=[];for(var _0x51bb0a=0x0,_0x38da53=0x1;_0x51bb0a<_0x2c1382[_0xde1f('0x14')];_0x51bb0a++,_0x38da53=0x1){_0x56c074=_0x56c074[_0xde1f('0x15')](getUserApplications(_0x323708,_0x2c1382[_0x51bb0a],_0x2c1382[_0x51bb0a][_0xde1f('0x16')]));if(_0x2c1382[_0x51bb0a][_0xde1f('0x16')]!=_0x2c1382[_0x51bb0a][_0xde1f('0x10')]){_0x56c074=_0x56c074[_0xde1f('0x15')](getUserApplications(_0x323708,_0x2c1382[_0x51bb0a],_0x2c1382[_0x51bb0a]['name']));}}return _0x56c074;};var getChanSpyPromise=function(_0xf4f350,_0x2f8387){return new BPromise(function(_0x45cbf0,_0x50be58){return _0xf4f350['User'][_0xde1f('0x17')]({'attributes':['id','name','internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xde1f('0x18')](function(_0x2e2f93){if(_0x2e2f93){return _0x45cbf0(getChanSpyApplications(_0x2f8387,_0x2e2f93));}return _0x45cbf0([]);})[_0xde1f('0x19')](function(_0x1ac10){_0x50be58(_0x1ac10);});});};module[_0xde1f('0x1a')]=function(_0x2c4196,_0x50043c){var _0xa48b80=_0x2c4196['models'];return _0x2c4196[_0xde1f('0x1b')](_0xde1f('0x1c'),attributes,{'tableName':_0xde1f('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5acdea,_0x4d4f1f,_0x2cd498){return getChanSpyPromise(_0xa48b80,_0x5acdea)[_0xde1f('0x18')](function(_0xf04ee){if(_0xf04ee&&_0xf04ee[_0xde1f('0x14')]){return _0xa48b80[_0xde1f('0x1e')][_0xde1f('0x1f')](_0xf04ee);}})['then'](function(){_0x2cd498();})[_0xde1f('0x19')](function(_0xccd6a4){_0x2cd498(_0xccd6a4);});},'afterUpdate':function(_0x270087,_0x589513,_0x246fe6){return _0xa48b80['VoiceExtension'][_0xde1f('0x20')]({'where':{'ChanSpyId':_0x270087['id']}})[_0xde1f('0x18')](function(){return getChanSpyPromise(_0xa48b80,_0x270087);})[_0xde1f('0x18')](function(_0x5e26ed){if(_0x5e26ed&&_0x5e26ed['length']){return _0xa48b80[_0xde1f('0x1e')][_0xde1f('0x1f')](_0x5e26ed);}})['then'](function(){_0x246fe6();})[_0xde1f('0x19')](function(_0x2e3043){_0x246fe6(_0x2e3043);});},'afterDestroy':function(_0x87bb2,_0x2c637e,_0x127847){return _0xa48b80[_0xde1f('0x1e')][_0xde1f('0x20')]({'where':{'ChanSpyId':_0x87bb2['id']}})[_0xde1f('0x18')](function(){_0x127847();})[_0xde1f('0x19')](function(_0xf76d5e){_0x127847(_0xf76d5e);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index cbaa823..4690b9e 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 _0x55ea=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x32a797,_0x420af5){var _0x16537f=function(_0x51cd90){while(--_0x51cd90){_0x32a797['push'](_0x32a797['shift']());}};_0x16537f(++_0x420af5);}(_0x55ea,0xc9));var _0xa55e=function(_0x583f70,_0x3a5858){_0x583f70=_0x583f70-0x0;var _0x2f7b52=_0x55ea[_0x583f70];return _0x2f7b52;};'use strict';var _=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var moment=require(_0xa55e('0x2'));var BPromise=require('bluebird');var rs=require(_0xa55e('0x3'));var fs=require('fs');var Redis=require(_0xa55e('0x4'));var db=require(_0xa55e('0x5'))['db'];var utils=require(_0xa55e('0x6'));var logger=require(_0xa55e('0x7'))('rpc');var config=require(_0xa55e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a009c,_0x38378e,_0x20f2ac){return new BPromise(function(_0x30b885,_0xca9526){return client[_0xa55e('0x9')](_0x5a009c,_0x20f2ac)[_0xa55e('0xa')](function(_0x32f6f7){logger[_0xa55e('0xb')](_0xa55e('0xc'),_0x38378e,'request\x20sent');logger['debug'](_0xa55e('0xd'),_0x38378e,_0xa55e('0xe'),JSON[_0xa55e('0xf')](_0x32f6f7));if(_0x32f6f7[_0xa55e('0x10')]){if(_0x32f6f7[_0xa55e('0x10')]['code']===0x1f4){logger[_0xa55e('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x38378e,_0x32f6f7[_0xa55e('0x10')][_0xa55e('0x11')]);return _0xca9526(_0x32f6f7[_0xa55e('0x10')][_0xa55e('0x11')]);}logger[_0xa55e('0x10')](_0xa55e('0xc'),_0x38378e,_0x32f6f7[_0xa55e('0x10')][_0xa55e('0x11')]);return _0x30b885(_0x32f6f7[_0xa55e('0x10')]['message']);}else{logger[_0xa55e('0xb')](_0xa55e('0xc'),_0x38378e,_0xa55e('0xe'));_0x30b885(_0x32f6f7[_0xa55e('0x12')][_0xa55e('0x11')]);}})[_0xa55e('0x13')](function(_0x585d3a){logger[_0xa55e('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x38378e,_0x585d3a);_0xca9526(_0x585d3a);});});} \ No newline at end of file +var _0xf109=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x32338a,_0x319903){var _0xfca2ce=function(_0x1ce649){while(--_0x1ce649){_0x32338a['push'](_0x32338a['shift']());}};_0xfca2ce(++_0x319903);}(_0xf109,0xce));var _0x9f10=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xf109[_0x35da42];return _0x370035;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var moment=require(_0x9f10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f10('0x3'))['db'];var utils=require(_0x9f10('0x4'));var logger=require(_0x9f10('0x5'))(_0x9f10('0x6'));var config=require(_0x9f10('0x7'));var jayson=require(_0x9f10('0x8'));var client=jayson[_0x9f10('0x9')][_0x9f10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227a29,_0x2a877e,_0x3fd82f){return new BPromise(function(_0x5c8719,_0x42a8cd){return client[_0x9f10('0xb')](_0x227a29,_0x3fd82f)[_0x9f10('0xc')](function(_0x1bde2e){logger[_0x9f10('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x2a877e,_0x9f10('0xe'));logger[_0x9f10('0xf')](_0x9f10('0x10'),_0x2a877e,'request\x20sent',JSON['stringify'](_0x1bde2e));if(_0x1bde2e[_0x9f10('0x11')]){if(_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x12')]===0x1f4){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x42a8cd(_0x1bde2e['error'][_0x9f10('0x14')]);}logger[_0x9f10('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x5c8719(_0x1bde2e['error']['message']);}else{logger[_0x9f10('0xd')](_0x9f10('0x13'),_0x2a877e,'request\x20sent');_0x5c8719(_0x1bde2e[_0x9f10('0x15')]['message']);}})[_0x9f10('0x16')](function(_0x1f68d8){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1f68d8);_0x42a8cd(_0x1f68d8);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 450f531..96c1745 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 _0x3de9=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','delete','destroy','exports'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x3de9,0xb0));var _0x93de=function(_0x491903,_0x2893f8){_0x491903=_0x491903-0x0;var _0x3f5dca=_0x3de9[_0x491903];return _0x3f5dca;};'use strict';var multer=require('multer');var util=require(_0x93de('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x93de('0x1'));var router=express[_0x93de('0x2')]();var fs_extra=require(_0x93de('0x3'));var auth=require(_0x93de('0x4'));var interaction=require(_0x93de('0x5'));var config=require(_0x93de('0x6'));var controller=require('./voiceContext.controller');router[_0x93de('0x7')]('/',auth[_0x93de('0x8')](),controller[_0x93de('0x9')]);router[_0x93de('0x7')](_0x93de('0xa'),auth[_0x93de('0x8')](),controller['show']);router[_0x93de('0xb')]('/',auth[_0x93de('0x8')](),controller[_0x93de('0xc')]);router['put'](_0x93de('0xa'),auth[_0x93de('0x8')](),controller['update']);router[_0x93de('0xd')]('/:id',auth[_0x93de('0x8')](),controller[_0x93de('0xe')]);module[_0x93de('0xf')]=router; \ No newline at end of file +var _0x4059=['isAuthenticated','index','/:id','show','create','put','destroy','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4229ac,_0x121e6c){var _0x4f93f1=function(_0x2f2bee){while(--_0x2f2bee){_0x4229ac['push'](_0x4229ac['shift']());}};_0x4f93f1(++_0x121e6c);}(_0x4059,0x10b));var _0x9405=function(_0x23c79b,_0x95cf1b){_0x23c79b=_0x23c79b-0x0;var _0x584dc6=_0x4059[_0x23c79b];return _0x584dc6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9405('0x0'));var router=express[_0x9405('0x1')]();var fs_extra=require(_0x9405('0x2'));var auth=require(_0x9405('0x3'));var interaction=require(_0x9405('0x4'));var config=require(_0x9405('0x5'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0x9405('0x6')](),controller[_0x9405('0x7')]);router['get'](_0x9405('0x8'),auth[_0x9405('0x6')](),controller[_0x9405('0x9')]);router['post']('/',auth[_0x9405('0x6')](),controller[_0x9405('0xa')]);router[_0x9405('0xb')]('/:id',auth[_0x9405('0x6')](),controller['update']);router['delete'](_0x9405('0x8'),auth['isAuthenticated'](),controller[_0x9405('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 756f339..9eeead3 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 _0xf7c7=['STRING','BOOLEAN','exports','name'];(function(_0x14c360,_0xeea136){var _0x49e3d7=function(_0x3954fa){while(--_0x3954fa){_0x14c360['push'](_0x14c360['shift']());}};_0x49e3d7(++_0xeea136);}(_0xf7c7,0xb6));var _0x7f7c=function(_0x58bfde,_0x44766e){_0x58bfde=_0x58bfde-0x0;var _0x325629=_0xf7c7[_0x58bfde];return _0x325629;};'use strict';var Sequelize=require('sequelize');module[_0x7f7c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7f7c('0x1')},'description':{'type':Sequelize[_0x7f7c('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7f7c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x88d2=['exports','STRING'];(function(_0x4551ce,_0x1c1ebd){var _0x5b1270=function(_0xa37345){while(--_0xa37345){_0x4551ce['push'](_0x4551ce['shift']());}};_0x5b1270(++_0x1c1ebd);}(_0x88d2,0xce));var _0x288d=function(_0x9dcf66,_0x1756bb){_0x9dcf66=_0x9dcf66-0x0;var _0x5cd9c8=_0x88d2[_0x9dcf66];return _0x5cd9c8;};'use strict';var Sequelize=require('sequelize');module[_0x288d('0x0')]={'name':{'type':Sequelize[_0x288d('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 227474b..a081698 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 _0x928d=['find','create','readFileSync','join','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','utf8','params','writeFileSync','eml-format','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','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','get','UserProfileResource','end','name','send','index','map','VoiceContext','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','show','includeAll','include'];(function(_0x58f245,_0x3e4f31){var _0x1f0cfb=function(_0x515942){while(--_0x515942){_0x58f245['push'](_0x58f245['shift']());}};_0x1f0cfb(++_0x3e4f31);}(_0x928d,0x7e));var _0xd928=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x928d[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0xd928('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd928('0x1'));var jsonpatch=require(_0xd928('0x2'));var rp=require(_0xd928('0x3'));var moment=require(_0xd928('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd928('0x5'));var util=require(_0xd928('0x6'));var path=require(_0xd928('0x7'));var sox=require(_0xd928('0x8'));var csv=require('to-csv');var ejs=require(_0xd928('0x9'));var fs=require('fs');var fs_extra=require(_0xd928('0xa'));var _=require(_0xd928('0xb'));var squel=require(_0xd928('0xc'));var crypto=require(_0xd928('0xd'));var jsforce=require(_0xd928('0xe'));var deskjs=require(_0xd928('0xf'));var toCsv=require(_0xd928('0x10'));var querystring=require(_0xd928('0x11'));var Papa=require(_0xd928('0x12'));var Redis=require('ioredis');var authService=require(_0xd928('0x13'));var qs=require(_0xd928('0x14'));var as=require(_0xd928('0x15'));var hardwareService=require(_0xd928('0x16'));var logger=require(_0xd928('0x17'))(_0xd928('0x18'));var utils=require(_0xd928('0x19'));var config=require(_0xd928('0x1a'));var licenseUtil=require(_0xd928('0x1b'));var db=require(_0xd928('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd928('0x1d')][_0xd928('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2f9674,_0x326f2a,_0xab0383,_0x26218a){return new BPromise(function(_0x5ee814,_0x56d488){var _0x12547e=_0x26218a||client;return _0x12547e[_0xd928('0x1f')](_0x2f9674,_0xab0383)[_0xd928('0x20')](function(_0x5f48fa){logger[_0xd928('0x21')]('VoiceContext,\x20%s,\x20%s',_0x326f2a,_0xd928('0x22'));logger[_0xd928('0x23')](_0xd928('0x24'),_0x326f2a,_0xd928('0x22'),JSON[_0xd928('0x25')](_0x5f48fa));if(_0x5f48fa['error']){if(_0x5f48fa[_0xd928('0x26')][_0xd928('0x27')]===0x1f4){logger['error'](_0xd928('0x28'),_0x326f2a,_0x5f48fa[_0xd928('0x26')][_0xd928('0x29')]);return _0x56d488(_0x5f48fa[_0xd928('0x26')][_0xd928('0x29')]);}logger['error'](_0xd928('0x28'),_0x326f2a,_0x5f48fa[_0xd928('0x26')][_0xd928('0x29')]);return _0x5ee814(_0x5f48fa['error'][_0xd928('0x29')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x326f2a,'request\x20sent');_0x5ee814(_0x5f48fa[_0xd928('0x2a')]['message']);}})[_0xd928('0x2b')](function(_0x2ac080){logger[_0xd928('0x26')]('VoiceContext,\x20%s,\x20%s',_0x326f2a,_0x2ac080);_0x56d488(_0x2ac080);});});}function respondWithStatusCode(_0x279eeb,_0x3bd2e4){_0x3bd2e4=_0x3bd2e4||0xcc;return function(_0x2053ae){if(_0x2053ae){return _0x279eeb[_0xd928('0x2c')](_0x3bd2e4);}return _0x279eeb[_0xd928('0x2d')](_0x3bd2e4)['end']();};}function respondWithResult(_0xe4b37d,_0x4c3ccc){_0x4c3ccc=_0x4c3ccc||0xc8;return function(_0x59d075){if(_0x59d075){return _0xe4b37d[_0xd928('0x2d')](_0x4c3ccc)[_0xd928('0x2e')](_0x59d075);}};}function respondWithFilteredResult(_0x4f7657,_0x38f1c5){return function(_0x109c6b){if(_0x109c6b){var _0x136a54=typeof _0x38f1c5[_0xd928('0x2f')]===_0xd928('0x30')&&typeof _0x38f1c5[_0xd928('0x31')]===_0xd928('0x30');var _0x43793c=_0x109c6b[_0xd928('0x32')];var _0xfcab35=_0x136a54?0x0:_0x38f1c5[_0xd928('0x2f')];var _0x36c239=_0x136a54?_0x109c6b['count']:_0x38f1c5[_0xd928('0x2f')]+_0x38f1c5[_0xd928('0x31')];var _0x3ab49c;if(_0x36c239>=_0x43793c){_0x36c239=_0x43793c;_0x3ab49c=0xc8;}else{_0x3ab49c=0xce;}_0x4f7657[_0xd928('0x2d')](_0x3ab49c);return _0x4f7657['set'](_0xd928('0x33'),_0xfcab35+'-'+_0x36c239+'/'+_0x43793c)[_0xd928('0x2e')](_0x109c6b);}return null;};}function patchUpdates(_0x3ec51b){return function(_0x209933){try{jsonpatch[_0xd928('0x34')](_0x209933,_0x3ec51b,!![]);}catch(_0x3294b6){return BPromise[_0xd928('0x35')](_0x3294b6);}return _0x209933['save']();};}function saveUpdates(_0x4be1b8,_0x329e3b){return function(_0x23fc5d){if(_0x23fc5d){return _0x23fc5d['update'](_0x4be1b8)[_0xd928('0x20')](function(_0x9d3b70){return _0x9d3b70;});}return null;};}function removeEntity(_0x3021c6,_0x2f3084){return function(_0x5c0163){if(_0x5c0163){return _0x5c0163[_0xd928('0x36')]()[_0xd928('0x20')](function(){var _0x424aa5=_0x5c0163[_0xd928('0x37')]({'plain':!![]});var _0x101a4f='Contexts';return db[_0xd928('0x38')][_0xd928('0x36')]({'where':{'type':_0x101a4f,'resourceId':_0x424aa5['id']}})[_0xd928('0x20')](function(){return _0x5c0163;});})[_0xd928('0x20')](function(){_0x3021c6[_0xd928('0x2d')](0xcc)[_0xd928('0x39')]();});}};}function handleEntityNotFound(_0x29c896,_0x110139){return function(_0x2fc62b){if(!_0x2fc62b){_0x29c896['sendStatus'](0x194);}return _0x2fc62b;};}function handleError(_0x21a73a,_0x292319){_0x292319=_0x292319||0x1f4;return function(_0x4256b3){logger['error'](_0x4256b3['stack']);if(_0x4256b3['name']){delete _0x4256b3[_0xd928('0x3a')];}_0x21a73a[_0xd928('0x2d')](_0x292319)[_0xd928('0x3b')](_0x4256b3);};}exports[_0xd928('0x3c')]=function(_0x444cd6,_0x12de13){var _0x95184d={},_0x3775cb={},_0xdd85fb={'count':0x0,'rows':[]};var _0x393454=_[_0xd928('0x3d')](db[_0xd928('0x3e')][_0xd928('0x3f')],function(_0x273831){return{'name':_0x273831[_0xd928('0x40')],'type':_0x273831['type'][_0xd928('0x41')]};});_0x3775cb[_0xd928('0x42')]=_['map'](_0x393454,_0xd928('0x3a'));_0x3775cb[_0xd928('0x43')]=_[_0xd928('0x44')](_0x444cd6[_0xd928('0x43')]);_0x3775cb[_0xd928('0x45')]=_[_0xd928('0x46')](_0x3775cb[_0xd928('0x42')],_0x3775cb['query']);_0x95184d['attributes']=_[_0xd928('0x46')](_0x3775cb[_0xd928('0x42')],qs['fields'](_0x444cd6['query'][_0xd928('0x47')]));_0x95184d['attributes']=_0x95184d['attributes'][_0xd928('0x48')]?_0x95184d[_0xd928('0x49')]:_0x3775cb['model'];if(!_0x444cd6[_0xd928('0x43')]['hasOwnProperty'](_0xd928('0x4a'))){_0x95184d['limit']=qs[_0xd928('0x31')](_0x444cd6[_0xd928('0x43')][_0xd928('0x31')]);_0x95184d[_0xd928('0x2f')]=qs[_0xd928('0x2f')](_0x444cd6[_0xd928('0x43')][_0xd928('0x2f')]);}_0x95184d['order']=qs[_0xd928('0x4b')](_0x444cd6[_0xd928('0x43')]['sort']);_0x95184d[_0xd928('0x4c')]=qs['filters'](_[_0xd928('0x4d')](_0x444cd6[_0xd928('0x43')],_0x3775cb['filters']),_0x393454);if(_0x444cd6[_0xd928('0x43')][_0xd928('0x4e')]){_0x95184d[_0xd928('0x4c')]=_[_0xd928('0x4f')](_0x95184d[_0xd928('0x4c')],{'$or':_[_0xd928('0x3d')](_0x393454,function(_0x1d80e1){if(_0x1d80e1[_0xd928('0x50')]!==_0xd928('0x51')){var _0x3cb315={};_0x3cb315[_0x1d80e1['name']]={'$like':'%'+_0x444cd6[_0xd928('0x43')][_0xd928('0x4e')]+'%'};return _0x3cb315;}})});}_0x95184d=_[_0xd928('0x4f')]({},_0x95184d,_0x444cd6[_0xd928('0x52')]);var _0x45c935={'where':_0x95184d[_0xd928('0x4c')]};return db['VoiceContext']['count'](_0x45c935)[_0xd928('0x20')](function(_0x236fa3){_0xdd85fb['count']=_0x236fa3;if(_0x444cd6['query']['includeAll']){_0x95184d['include']=[{'all':!![]}];}return db[_0xd928('0x3e')][_0xd928('0x53')](_0x95184d);})[_0xd928('0x20')](function(_0x3026a5){_0xdd85fb[_0xd928('0x54')]=_0x3026a5;return _0xdd85fb;})[_0xd928('0x20')](respondWithFilteredResult(_0x12de13,_0x95184d))['catch'](handleError(_0x12de13,null));};exports[_0xd928('0x55')]=function(_0x5768e4,_0x3a5cd4){var _0x1cbef7={'raw':![],'where':{'id':_0x5768e4['params']['id']}},_0x21283f={};_0x21283f[_0xd928('0x42')]=_[_0xd928('0x44')](db[_0xd928('0x3e')][_0xd928('0x3f')]);_0x21283f[_0xd928('0x43')]=_[_0xd928('0x44')](_0x5768e4[_0xd928('0x43')]);_0x21283f['filters']=_[_0xd928('0x46')](_0x21283f[_0xd928('0x42')],_0x21283f['query']);_0x1cbef7[_0xd928('0x49')]=_[_0xd928('0x46')](_0x21283f[_0xd928('0x42')],qs[_0xd928('0x47')](_0x5768e4[_0xd928('0x43')][_0xd928('0x47')]));_0x1cbef7[_0xd928('0x49')]=_0x1cbef7[_0xd928('0x49')][_0xd928('0x48')]?_0x1cbef7[_0xd928('0x49')]:_0x21283f[_0xd928('0x42')];if(_0x5768e4[_0xd928('0x43')][_0xd928('0x56')]){_0x1cbef7[_0xd928('0x57')]=[{'all':!![]}];}_0x1cbef7=_[_0xd928('0x4f')]({},_0x1cbef7,_0x5768e4[_0xd928('0x52')]);return db['VoiceContext'][_0xd928('0x58')](_0x1cbef7)['then'](handleEntityNotFound(_0x3a5cd4,null))['then'](respondWithResult(_0x3a5cd4,null))['catch'](handleError(_0x3a5cd4,null));};exports[_0xd928('0x59')]=function(_0x5b881f,_0x4053f9,_0x27de0e){var _0xc5f007;return db[_0xd928('0x3e')][_0xd928('0x59')](_0x5b881f['body'],{'raw':!![]})[_0xd928('0x20')](function(_0xe08842){_0xc5f007=_0xe08842;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x44f624){var _0x46623a=fs[_0xd928('0x5a')](path[_0xd928('0x5b')](config[_0xd928('0x5c')],_0xd928('0x5d')),'utf8');var _0x1c9092=ejs[_0xd928('0x5e')](_0x46623a,{'contexts':_0x44f624||[]});fs['writeFileSync'](_0xd928('0x5f'),_0x1c9092);})[_0xd928('0x20')](function(){return respondWithRpcPromise(_0xd928('0x60'),_0xd928('0x59'),{'module':_0xd928('0x61')});})['then'](function(){var _0x3bb406=_0x5b881f[_0xd928('0x62')][_0xd928('0x37')]({'plain':!![]});if(!_0x3bb406)throw new Error(_0xd928('0x63'));if(_0x3bb406[_0xd928('0x64')]===_0xd928('0x62')){var _0x356346=_0xc5f007[_0xd928('0x37')]({'plain':!![]});return db['UserProfileSection'][_0xd928('0x58')]({'where':{'name':'Contexts','userProfileId':_0x3bb406[_0xd928('0x65')]},'raw':!![]})[_0xd928('0x20')](function(_0x281c7e){if(_0x281c7e&&_0x281c7e['autoAssociation']===0x0){return db[_0xd928('0x38')][_0xd928('0x59')]({'name':_0x356346[_0xd928('0x3a')],'resourceId':_0x356346['id'],'type':_0x281c7e['name'],'sectionId':_0x281c7e['id']},{})[_0xd928('0x20')](function(){return _0xc5f007;});}else{return _0xc5f007;}})['catch'](function(_0x43b161){logger['error'](_0xd928('0x66'),_0x43b161);throw _0x43b161;});}return _0xc5f007;})[_0xd928('0x20')](respondWithResult(_0x4053f9,0xc9))[_0xd928('0x2b')](handleError(_0x4053f9,null));};exports[_0xd928('0x67')]=function(_0x324729,_0x5c0e19,_0x4a875f){var _0x2e08c6;return db[_0xd928('0x3e')][_0xd928('0x58')]({'where':{'id':_0x324729['params']['id']}})[_0xd928('0x20')](handleEntityNotFound(_0x5c0e19,null))[_0xd928('0x20')](saveUpdates(_0x324729['body'],null))[_0xd928('0x20')](function(_0x23cbb3){if(_0x23cbb3){_0x2e08c6=_0x23cbb3;return db['VoiceContext'][_0xd928('0x53')]({'raw':!![]});}})[_0xd928('0x20')](function(_0x12a5f8){var _0x14980e=fs['readFileSync'](path[_0xd928('0x5b')](config[_0xd928('0x5c')],_0xd928('0x5d')),_0xd928('0x68'));var _0x15f5f1=ejs[_0xd928('0x5e')](_0x14980e,{'contexts':_0x12a5f8||[]});fs['writeFileSync'](_0xd928('0x5f'),_0x15f5f1);})[_0xd928('0x20')](function(){return respondWithRpcPromise(_0xd928('0x60'),_0xd928('0x67'),{'module':_0xd928('0x61')});})[_0xd928('0x20')](function(){return _0x2e08c6;})[_0xd928('0x20')](respondWithResult(_0x5c0e19,null))[_0xd928('0x2b')](handleError(_0x5c0e19,null));};exports['destroy']=function(_0x5bc0d7,_0x53e3d3,_0x2f570f){var _0x4665cf;return db['VoiceContext'][_0xd928('0x58')]({'where':{'id':_0x5bc0d7[_0xd928('0x69')]['id']}})['then'](handleEntityNotFound(_0x53e3d3,null))['then'](removeEntity(_0x53e3d3,null))[_0xd928('0x20')](function(){return db[_0xd928('0x3e')][_0xd928('0x53')]({'raw':!![]});})['then'](function(_0x9e4938){var _0x16d482=fs['readFileSync'](path[_0xd928('0x5b')](config[_0xd928('0x5c')],_0xd928('0x5d')),_0xd928('0x68'));var _0xc81ebf=ejs[_0xd928('0x5e')](_0x16d482,{'contexts':_0x9e4938});fs[_0xd928('0x6a')](_0xd928('0x5f'),_0xc81ebf);return respondWithRpcPromise(_0xd928('0x60'),_0xd928('0x36'),{'module':_0xd928('0x61')});})['catch'](handleError(_0x53e3d3,null));}; \ No newline at end of file +var _0x7a06=['end','json','offset','undefined','limit','count','set','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','intersection','find','body','readFileSync','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','catch','sendStatus','status'];(function(_0x3557d0,_0x39f204){var _0x38d56c=function(_0x5a582e){while(--_0x5a582e){_0x3557d0['push'](_0x3557d0['shift']());}};_0x38d56c(++_0x39f204);}(_0x7a06,0x177));var _0x67a0=function(_0x5bc733,_0x5e34a1){_0x5bc733=_0x5bc733-0x0;var _0x29cb31=_0x7a06[_0x5bc733];return _0x29cb31;};'use strict';var emlformat=require(_0x67a0('0x0'));var rimraf=require(_0x67a0('0x1'));var zipdir=require(_0x67a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x67a0('0x3'));var moment=require(_0x67a0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x67a0('0x5'));var util=require(_0x67a0('0x6'));var path=require(_0x67a0('0x7'));var sox=require(_0x67a0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67a0('0x9'));var _=require(_0x67a0('0xa'));var squel=require(_0x67a0('0xb'));var crypto=require(_0x67a0('0xc'));var jsforce=require(_0x67a0('0xd'));var deskjs=require(_0x67a0('0xe'));var toCsv=require(_0x67a0('0xf'));var querystring=require(_0x67a0('0x10'));var Papa=require('papaparse');var Redis=require(_0x67a0('0x11'));var authService=require(_0x67a0('0x12'));var qs=require(_0x67a0('0x13'));var as=require(_0x67a0('0x14'));var hardwareService=require(_0x67a0('0x15'));var logger=require(_0x67a0('0x16'))(_0x67a0('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x67a0('0x18'));var db=require(_0x67a0('0x19'))['db'];var jayson=require(_0x67a0('0x1a'));var client=jayson[_0x67a0('0x1b')][_0x67a0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1f1a2b,_0x3755ab,_0x3d8364,_0x1aba8f){return new BPromise(function(_0x19fa5d,_0x4b6d0c){var _0x464b1a=_0x1aba8f||client;return _0x464b1a[_0x67a0('0x1d')](_0x1f1a2b,_0x3d8364)[_0x67a0('0x1e')](function(_0x979cae){logger['info'](_0x67a0('0x1f'),_0x3755ab,'request\x20sent');logger[_0x67a0('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3755ab,_0x67a0('0x21'),JSON[_0x67a0('0x22')](_0x979cae));if(_0x979cae['error']){if(_0x979cae[_0x67a0('0x23')]['code']===0x1f4){logger[_0x67a0('0x23')](_0x67a0('0x1f'),_0x3755ab,_0x979cae[_0x67a0('0x23')][_0x67a0('0x24')]);return _0x4b6d0c(_0x979cae['error'][_0x67a0('0x24')]);}logger['error'](_0x67a0('0x1f'),_0x3755ab,_0x979cae[_0x67a0('0x23')][_0x67a0('0x24')]);return _0x19fa5d(_0x979cae['error']['message']);}else{logger[_0x67a0('0x25')](_0x67a0('0x1f'),_0x3755ab,_0x67a0('0x21'));_0x19fa5d(_0x979cae['result'][_0x67a0('0x24')]);}})[_0x67a0('0x26')](function(_0xa88890){logger[_0x67a0('0x23')](_0x67a0('0x1f'),_0x3755ab,_0xa88890);_0x4b6d0c(_0xa88890);});});}function respondWithStatusCode(_0x895a7b,_0x4bc9fb){_0x4bc9fb=_0x4bc9fb||0xcc;return function(_0x33d811){if(_0x33d811){return _0x895a7b[_0x67a0('0x27')](_0x4bc9fb);}return _0x895a7b[_0x67a0('0x28')](_0x4bc9fb)[_0x67a0('0x29')]();};}function respondWithResult(_0x1c5ef4,_0x532b5d){_0x532b5d=_0x532b5d||0xc8;return function(_0x38550e){if(_0x38550e){return _0x1c5ef4[_0x67a0('0x28')](_0x532b5d)[_0x67a0('0x2a')](_0x38550e);}};}function respondWithFilteredResult(_0x972e26,_0x5926ed){return function(_0x10450a){if(_0x10450a){var _0x2eaf49=typeof _0x5926ed[_0x67a0('0x2b')]===_0x67a0('0x2c')&&typeof _0x5926ed[_0x67a0('0x2d')]===_0x67a0('0x2c');var _0x588ee9=_0x10450a[_0x67a0('0x2e')];var _0x408f90=_0x2eaf49?0x0:_0x5926ed[_0x67a0('0x2b')];var _0x4db1bd=_0x2eaf49?_0x10450a['count']:_0x5926ed['offset']+_0x5926ed['limit'];var _0x44d47e;if(_0x4db1bd>=_0x588ee9){_0x4db1bd=_0x588ee9;_0x44d47e=0xc8;}else{_0x44d47e=0xce;}_0x972e26[_0x67a0('0x28')](_0x44d47e);return _0x972e26[_0x67a0('0x2f')]('Content-Range',_0x408f90+'-'+_0x4db1bd+'/'+_0x588ee9)['json'](_0x10450a);}return null;};}function patchUpdates(_0x466d6c){return function(_0xb130b2){try{jsonpatch['apply'](_0xb130b2,_0x466d6c,!![]);}catch(_0x1e31ad){return BPromise[_0x67a0('0x30')](_0x1e31ad);}return _0xb130b2[_0x67a0('0x31')]();};}function saveUpdates(_0x2a6636,_0xd68e56){return function(_0x1f989a){if(_0x1f989a){return _0x1f989a[_0x67a0('0x32')](_0x2a6636)[_0x67a0('0x1e')](function(_0x5eccfc){return _0x5eccfc;});}return null;};}function removeEntity(_0x3f778a,_0x2c058b){return function(_0x3a2120){if(_0x3a2120){return _0x3a2120[_0x67a0('0x33')]()['then'](function(){var _0x538384=_0x3a2120[_0x67a0('0x34')]({'plain':!![]});var _0x2c861a=_0x67a0('0x35');return db[_0x67a0('0x36')][_0x67a0('0x33')]({'where':{'type':_0x2c861a,'resourceId':_0x538384['id']}})[_0x67a0('0x1e')](function(){return _0x3a2120;});})['then'](function(){_0x3f778a[_0x67a0('0x28')](0xcc)[_0x67a0('0x29')]();});}};}function handleEntityNotFound(_0x4ccb02,_0x37c1a1){return function(_0x675b5c){if(!_0x675b5c){_0x4ccb02['sendStatus'](0x194);}return _0x675b5c;};}function handleError(_0x4b75ff,_0x3c6b7d){_0x3c6b7d=_0x3c6b7d||0x1f4;return function(_0x174707){logger[_0x67a0('0x23')](_0x174707[_0x67a0('0x37')]);if(_0x174707[_0x67a0('0x38')]){delete _0x174707[_0x67a0('0x38')];}_0x4b75ff[_0x67a0('0x28')](_0x3c6b7d)[_0x67a0('0x39')](_0x174707);};}exports[_0x67a0('0x3a')]=function(_0x34a302,_0x48ddc6){var _0x2988bc={},_0x2f453f={},_0x54f581={'count':0x0,'rows':[]};var _0x27edc5=_[_0x67a0('0x3b')](db[_0x67a0('0x3c')][_0x67a0('0x3d')],function(_0x57b2d1){return{'name':_0x57b2d1[_0x67a0('0x3e')],'type':_0x57b2d1['type'][_0x67a0('0x3f')]};});_0x2f453f[_0x67a0('0x40')]=_['map'](_0x27edc5,_0x67a0('0x38'));_0x2f453f[_0x67a0('0x41')]=_[_0x67a0('0x42')](_0x34a302[_0x67a0('0x41')]);_0x2f453f['filters']=_['intersection'](_0x2f453f[_0x67a0('0x40')],_0x2f453f['query']);_0x2988bc[_0x67a0('0x43')]=_['intersection'](_0x2f453f[_0x67a0('0x40')],qs[_0x67a0('0x44')](_0x34a302['query'][_0x67a0('0x44')]));_0x2988bc['attributes']=_0x2988bc[_0x67a0('0x43')]['length']?_0x2988bc[_0x67a0('0x43')]:_0x2f453f[_0x67a0('0x40')];if(!_0x34a302[_0x67a0('0x41')][_0x67a0('0x45')](_0x67a0('0x46'))){_0x2988bc[_0x67a0('0x2d')]=qs['limit'](_0x34a302[_0x67a0('0x41')][_0x67a0('0x2d')]);_0x2988bc[_0x67a0('0x2b')]=qs['offset'](_0x34a302['query'][_0x67a0('0x2b')]);}_0x2988bc['order']=qs[_0x67a0('0x47')](_0x34a302[_0x67a0('0x41')]['sort']);_0x2988bc[_0x67a0('0x48')]=qs[_0x67a0('0x49')](_[_0x67a0('0x4a')](_0x34a302[_0x67a0('0x41')],_0x2f453f[_0x67a0('0x49')]),_0x27edc5);if(_0x34a302[_0x67a0('0x41')][_0x67a0('0x4b')]){_0x2988bc[_0x67a0('0x48')]=_[_0x67a0('0x4c')](_0x2988bc[_0x67a0('0x48')],{'$or':_[_0x67a0('0x3b')](_0x27edc5,function(_0x115afb){if(_0x115afb['type']!==_0x67a0('0x4d')){var _0x148715={};_0x148715[_0x115afb[_0x67a0('0x38')]]={'$like':'%'+_0x34a302[_0x67a0('0x41')][_0x67a0('0x4b')]+'%'};return _0x148715;}})});}_0x2988bc=_[_0x67a0('0x4c')]({},_0x2988bc,_0x34a302[_0x67a0('0x4e')]);var _0x88e836={'where':_0x2988bc[_0x67a0('0x48')]};return db[_0x67a0('0x3c')][_0x67a0('0x2e')](_0x88e836)['then'](function(_0x14e042){_0x54f581[_0x67a0('0x2e')]=_0x14e042;if(_0x34a302['query'][_0x67a0('0x4f')]){_0x2988bc[_0x67a0('0x50')]=[{'all':!![]}];}return db[_0x67a0('0x3c')][_0x67a0('0x51')](_0x2988bc);})['then'](function(_0x4d7720){_0x54f581['rows']=_0x4d7720;return _0x54f581;})['then'](respondWithFilteredResult(_0x48ddc6,_0x2988bc))[_0x67a0('0x26')](handleError(_0x48ddc6,null));};exports[_0x67a0('0x52')]=function(_0x4ff560,_0x29527c){var _0x4ba56a={'raw':![],'where':{'id':_0x4ff560[_0x67a0('0x53')]['id']}},_0x1b2166={};_0x1b2166[_0x67a0('0x40')]=_['keys'](db['VoiceContext'][_0x67a0('0x3d')]);_0x1b2166['query']=_['keys'](_0x4ff560['query']);_0x1b2166[_0x67a0('0x49')]=_[_0x67a0('0x54')](_0x1b2166['model'],_0x1b2166[_0x67a0('0x41')]);_0x4ba56a[_0x67a0('0x43')]=_[_0x67a0('0x54')](_0x1b2166[_0x67a0('0x40')],qs[_0x67a0('0x44')](_0x4ff560[_0x67a0('0x41')][_0x67a0('0x44')]));_0x4ba56a[_0x67a0('0x43')]=_0x4ba56a['attributes']['length']?_0x4ba56a[_0x67a0('0x43')]:_0x1b2166[_0x67a0('0x40')];if(_0x4ff560['query'][_0x67a0('0x4f')]){_0x4ba56a['include']=[{'all':!![]}];}_0x4ba56a=_[_0x67a0('0x4c')]({},_0x4ba56a,_0x4ff560[_0x67a0('0x4e')]);return db[_0x67a0('0x3c')][_0x67a0('0x55')](_0x4ba56a)[_0x67a0('0x1e')](handleEntityNotFound(_0x29527c,null))[_0x67a0('0x1e')](respondWithResult(_0x29527c,null))['catch'](handleError(_0x29527c,null));};exports['create']=function(_0xc7b15d,_0x2ab0cb,_0x7ede97){var _0x459bab;return db['VoiceContext']['create'](_0xc7b15d[_0x67a0('0x56')],{'raw':!![]})[_0x67a0('0x1e')](function(_0x31cad3){_0x459bab=_0x31cad3;return db[_0x67a0('0x3c')][_0x67a0('0x51')]({'raw':!![]});})[_0x67a0('0x1e')](function(_0x9a8625){var _0x3445a2=fs[_0x67a0('0x57')](path['join'](config[_0x67a0('0x58')],_0x67a0('0x59')),_0x67a0('0x5a'));var _0x481655=ejs[_0x67a0('0x5b')](_0x3445a2,{'contexts':_0x9a8625||[]});fs[_0x67a0('0x5c')](_0x67a0('0x5d'),_0x481655);})['then'](function(){return respondWithRpcPromise(_0x67a0('0x5e'),'create',{'module':_0x67a0('0x5f')});})[_0x67a0('0x1e')](function(){var _0x2697ef=_0xc7b15d[_0x67a0('0x60')][_0x67a0('0x34')]({'plain':!![]});if(!_0x2697ef)throw new Error(_0x67a0('0x61'));if(_0x2697ef['role']===_0x67a0('0x60')){var _0x14a222=_0x459bab['get']({'plain':!![]});return db[_0x67a0('0x62')]['find']({'where':{'name':_0x67a0('0x35'),'userProfileId':_0x2697ef[_0x67a0('0x63')]},'raw':!![]})[_0x67a0('0x1e')](function(_0xb80af6){if(_0xb80af6&&_0xb80af6[_0x67a0('0x64')]===0x0){return db['UserProfileResource'][_0x67a0('0x65')]({'name':_0x14a222[_0x67a0('0x38')],'resourceId':_0x14a222['id'],'type':_0xb80af6[_0x67a0('0x38')],'sectionId':_0xb80af6['id']},{})[_0x67a0('0x1e')](function(){return _0x459bab;});}else{return _0x459bab;}})['catch'](function(_0x16dc16){logger['error'](_0x67a0('0x66'),_0x16dc16);throw _0x16dc16;});}return _0x459bab;})[_0x67a0('0x1e')](respondWithResult(_0x2ab0cb,0xc9))[_0x67a0('0x26')](handleError(_0x2ab0cb,null));};exports[_0x67a0('0x32')]=function(_0x555fe2,_0x5e1855,_0xb7cd93){var _0x911af7;return db['VoiceContext'][_0x67a0('0x55')]({'where':{'id':_0x555fe2[_0x67a0('0x53')]['id']}})[_0x67a0('0x1e')](handleEntityNotFound(_0x5e1855,null))['then'](saveUpdates(_0x555fe2[_0x67a0('0x56')],null))['then'](function(_0x533d9a){if(_0x533d9a){_0x911af7=_0x533d9a;return db[_0x67a0('0x3c')][_0x67a0('0x51')]({'raw':!![]});}})['then'](function(_0x4b2492){var _0x17fb16=fs[_0x67a0('0x57')](path[_0x67a0('0x67')](config['root'],_0x67a0('0x59')),_0x67a0('0x5a'));var _0x516b61=ejs[_0x67a0('0x5b')](_0x17fb16,{'contexts':_0x4b2492||[]});fs[_0x67a0('0x5c')](_0x67a0('0x5d'),_0x516b61);})[_0x67a0('0x1e')](function(){return respondWithRpcPromise(_0x67a0('0x5e'),_0x67a0('0x32'),{'module':_0x67a0('0x5f')});})['then'](function(){return _0x911af7;})[_0x67a0('0x1e')](respondWithResult(_0x5e1855,null))[_0x67a0('0x26')](handleError(_0x5e1855,null));};exports[_0x67a0('0x33')]=function(_0x21f2da,_0x27a70d,_0x221dd0){var _0x400180;return db['VoiceContext'][_0x67a0('0x55')]({'where':{'id':_0x21f2da[_0x67a0('0x53')]['id']}})[_0x67a0('0x1e')](handleEntityNotFound(_0x27a70d,null))[_0x67a0('0x1e')](removeEntity(_0x27a70d,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x67a0('0x1e')](function(_0x2cc937){var _0x235608=fs[_0x67a0('0x57')](path[_0x67a0('0x67')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x5d4120=ejs['render'](_0x235608,{'contexts':_0x2cc937});fs[_0x67a0('0x5c')](_0x67a0('0x5d'),_0x5d4120);return respondWithRpcPromise('Reload','destroy',{'module':_0x67a0('0x5f')});})[_0x67a0('0x26')](handleError(_0x27a70d,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 86f7652..03a0090 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 _0x31b9=['./voiceContext.attributes','define','VoiceContext','voice_contexts','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5e56d2,_0x69a9d9){var _0x382751=function(_0x44c5ef){while(--_0x44c5ef){_0x5e56d2['push'](_0x5e56d2['shift']());}};_0x382751(++_0x69a9d9);}(_0x31b9,0xb4));var _0x931b=function(_0x56918b,_0x117dd6){_0x56918b=_0x56918b-0x0;var _0x4a0076=_0x31b9[_0x56918b];return _0x4a0076;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x931b('0x0'))(_0x931b('0x1'));var moment=require(_0x931b('0x2'));var BPromise=require(_0x931b('0x3'));var rp=require(_0x931b('0x4'));var fs=require('fs');var path=require(_0x931b('0x5'));var rimraf=require('rimraf');var config=require(_0x931b('0x6'));var attributes=require(_0x931b('0x7'));module['exports']=function(_0x29f022,_0x1112bb){return _0x29f022[_0x931b('0x8')](_0x931b('0x9'),attributes,{'tableName':_0x931b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x549c=['path','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xbef738,_0x1156e6){var _0x512fc9=function(_0x2ad735){while(--_0x2ad735){_0xbef738['push'](_0xbef738['shift']());}};_0x512fc9(++_0x1156e6);}(_0x549c,0x12e));var _0xc549=function(_0x33b741,_0x314b3a){_0x33b741=_0x33b741-0x0;var _0x90efe6=_0x549c[_0x33b741];return _0x90efe6;};'use strict';var _=require(_0xc549('0x0'));var util=require(_0xc549('0x1'));var logger=require(_0xc549('0x2'))(_0xc549('0x3'));var moment=require(_0xc549('0x4'));var BPromise=require(_0xc549('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc549('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc549('0x7'));module[_0xc549('0x8')]=function(_0x267510,_0x460411){return _0x267510['define'](_0xc549('0x9'),attributes,{'tableName':_0xc549('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 4311a11..d4c1074 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 _0xbc23=['error','message','info','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x4cf092,_0x5d5002){var _0x1d8c0=function(_0xe6afe5){while(--_0xe6afe5){_0x4cf092['push'](_0x4cf092['shift']());}};_0x1d8c0(++_0x5d5002);}(_0xbc23,0x1bd));var _0x3bc2=function(_0x5e2299,_0xee7351){_0x5e2299=_0x5e2299-0x0;var _0x356678=_0xbc23[_0x5e2299];return _0x356678;};'use strict';var _=require(_0x3bc2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3bc2('0x1'));var rs=require(_0x3bc2('0x2'));var fs=require('fs');var Redis=require(_0x3bc2('0x3'));var db=require(_0x3bc2('0x4'))['db'];var utils=require(_0x3bc2('0x5'));var logger=require(_0x3bc2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3bc2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5addfc,_0x12e582,_0x3d80ae){return new BPromise(function(_0x96349e,_0x115135){return client[_0x3bc2('0x8')](_0x5addfc,_0x3d80ae)[_0x3bc2('0x9')](function(_0x319b5d){logger['info'](_0x3bc2('0xa'),_0x12e582,'request\x20sent');logger[_0x3bc2('0xb')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x12e582,_0x3bc2('0xc'),JSON[_0x3bc2('0xd')](_0x319b5d));if(_0x319b5d[_0x3bc2('0xe')]){if(_0x319b5d[_0x3bc2('0xe')]['code']===0x1f4){logger[_0x3bc2('0xe')](_0x3bc2('0xa'),_0x12e582,_0x319b5d[_0x3bc2('0xe')][_0x3bc2('0xf')]);return _0x115135(_0x319b5d['error'][_0x3bc2('0xf')]);}logger['error'](_0x3bc2('0xa'),_0x12e582,_0x319b5d[_0x3bc2('0xe')]['message']);return _0x96349e(_0x319b5d[_0x3bc2('0xe')][_0x3bc2('0xf')]);}else{logger[_0x3bc2('0x10')]('VoiceContext,\x20%s,\x20%s',_0x12e582,_0x3bc2('0xc'));_0x96349e(_0x319b5d['result'][_0x3bc2('0xf')]);}})['catch'](function(_0x12b3c6){logger[_0x3bc2('0xe')](_0x3bc2('0xa'),_0x12e582,_0x12b3c6);_0x115135(_0x12b3c6);});});} \ No newline at end of file +var _0xa67e=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','code','error','message','result','util','bluebird','randomstring','ioredis'];(function(_0x19b2d3,_0x4c9e89){var _0x1191a7=function(_0x2754c7){while(--_0x2754c7){_0x19b2d3['push'](_0x19b2d3['shift']());}};_0x1191a7(++_0x4c9e89);}(_0xa67e,0xce));var _0xea67=function(_0x461bcd,_0x17c819){_0x461bcd=_0x461bcd-0x0;var _0x1bf0dc=_0xa67e[_0x461bcd];return _0x1bf0dc;};'use strict';var _=require('lodash');var util=require(_0xea67('0x0'));var moment=require('moment');var BPromise=require(_0xea67('0x1'));var rs=require(_0xea67('0x2'));var fs=require('fs');var Redis=require(_0xea67('0x3'));var db=require(_0xea67('0x4'))['db'];var utils=require(_0xea67('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xea67('0x6'));var jayson=require(_0xea67('0x7'));var client=jayson[_0xea67('0x8')][_0xea67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bb0e2,_0x156416,_0x2fe018){return new BPromise(function(_0x1b932b,_0x3e8174){return client[_0xea67('0xa')](_0x1bb0e2,_0x2fe018)[_0xea67('0xb')](function(_0x5a5d44){logger[_0xea67('0xc')](_0xea67('0xd'),_0x156416,_0xea67('0xe'));logger[_0xea67('0xf')](_0xea67('0x10'),_0x156416,'request\x20sent',JSON['stringify'](_0x5a5d44));if(_0x5a5d44['error']){if(_0x5a5d44['error'][_0xea67('0x11')]===0x1f4){logger[_0xea67('0x12')](_0xea67('0xd'),_0x156416,_0x5a5d44['error'][_0xea67('0x13')]);return _0x3e8174(_0x5a5d44[_0xea67('0x12')]['message']);}logger[_0xea67('0x12')](_0xea67('0xd'),_0x156416,_0x5a5d44['error']['message']);return _0x1b932b(_0x5a5d44[_0xea67('0x12')]['message']);}else{logger[_0xea67('0xc')](_0xea67('0xd'),_0x156416,_0xea67('0xe'));_0x1b932b(_0x5a5d44[_0xea67('0x14')][_0xea67('0x13')]);}})['catch'](function(_0x4b4714){logger['error'](_0xea67('0xd'),_0x156416,_0x4b4714);_0x3e8174(_0x4b4714);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a8be05b..4ea32a2 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 _0xc89a=['../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xc89a,0x177));var _0xac89=function(_0x1099d7,_0x5df3d5){_0x1099d7=_0x1099d7-0x0;var _0x3cc5e0=_0xc89a[_0x1099d7];return _0x3cc5e0;};'use strict';var multer=require(_0xac89('0x0'));var util=require(_0xac89('0x1'));var path=require('path');var timeout=require(_0xac89('0x2'));var express=require(_0xac89('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xac89('0x4'));var interaction=require(_0xac89('0x5'));var config=require('../../config/environment');var controller=require(_0xac89('0x6'));router[_0xac89('0x7')]('/',auth[_0xac89('0x8')](),controller[_0xac89('0x9')]);router[_0xac89('0x7')](_0xac89('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xac89('0x7')](_0xac89('0xb'),auth[_0xac89('0x8')](),controller['show']);router[_0xac89('0xc')]('/',auth[_0xac89('0x8')](),controller[_0xac89('0xd')]);router[_0xac89('0xe')](_0xac89('0xb'),auth[_0xac89('0x8')](),controller[_0xac89('0xf')]);router[_0xac89('0x10')](_0xac89('0xb'),auth[_0xac89('0x8')](),controller[_0xac89('0x11')]);module[_0xac89('0x12')]=router; \ No newline at end of file +var _0x4fa1=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','index','get','/describe'];(function(_0x3bfa9c,_0x4230d7){var _0x12348a=function(_0x22ebab){while(--_0x22ebab){_0x3bfa9c['push'](_0x3bfa9c['shift']());}};_0x12348a(++_0x4230d7);}(_0x4fa1,0xb1));var _0x14fa=function(_0x788af0,_0x353aed){_0x788af0=_0x788af0-0x0;var _0x56561b=_0x4fa1[_0x788af0];return _0x56561b;};'use strict';var multer=require(_0x14fa('0x0'));var util=require(_0x14fa('0x1'));var path=require(_0x14fa('0x2'));var timeout=require(_0x14fa('0x3'));var express=require('express');var router=express[_0x14fa('0x4')]();var fs_extra=require(_0x14fa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x14fa('0x6'));var config=require('../../config/environment');var controller=require(_0x14fa('0x7'));router['get']('/',auth[_0x14fa('0x8')](),controller[_0x14fa('0x9')]);router[_0x14fa('0xa')](_0x14fa('0xb'),auth[_0x14fa('0x8')](),controller['describe']);router['get'](_0x14fa('0xc'),auth[_0x14fa('0x8')](),controller[_0x14fa('0xd')]);router[_0x14fa('0xe')]('/',auth[_0x14fa('0x8')](),controller[_0x14fa('0xf')]);router[_0x14fa('0x10')]('/:id',auth[_0x14fa('0x8')](),controller[_0x14fa('0x11')]);router[_0x14fa('0x12')]('/:id',auth[_0x14fa('0x8')](),controller[_0x14fa('0x13')]);module[_0x14fa('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 8b76005..a344b35 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 _0x00bb=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x75a17,_0x2d60d5){var _0xda2812=function(_0x12d97c){while(--_0x12d97c){_0x75a17['push'](_0x75a17['shift']());}};_0xda2812(++_0x2d60d5);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'privilege':{'type':Sequelize[_0xb00b('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb00b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb00b('0x2')]},'calleridname':{'type':Sequelize[_0xb00b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'language':{'type':Sequelize[_0xb00b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb00b('0x3')]},'uniqueid':{'type':Sequelize[_0xb00b('0x2')]},'linkedid':{'type':Sequelize[_0xb00b('0x2')]},'destchannel':{'type':Sequelize[_0xb00b('0x2')]},'destchannelstate':{'type':Sequelize[_0xb00b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb00b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb00b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'destlanguage':{'type':Sequelize[_0xb00b('0x2')]},'destaccountcode':{'type':Sequelize[_0xb00b('0x2')]},'destcontext':{'type':Sequelize[_0xb00b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb00b('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb00b('0x2')]},'starttime':{'type':Sequelize[_0xb00b('0x4')]},'answertime':{'type':Sequelize[_0xb00b('0x4')]},'endtime':{'type':Sequelize[_0xb00b('0x4')]},'lastevent':{'type':Sequelize[_0xb00b('0x2')],'comment':_0xb00b('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xb00b('0x3')]},'holdtime':{'type':Sequelize[_0xb00b('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x008c=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x540610,_0x818fd6){var _0x2fa8a8=function(_0xe2b11a){while(--_0xe2b11a){_0x540610['push'](_0x540610['shift']());}};_0x2fa8a8(++_0x818fd6);}(_0x008c,0x188));var _0xc008=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0x008c[_0x4629ed];return _0x52ca04;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'privilege':{'type':Sequelize[_0xc008('0x2')]},'channel':{'type':Sequelize[_0xc008('0x2')]},'channelstate':{'type':Sequelize[_0xc008('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc008('0x2')]},'calleridname':{'type':Sequelize[_0xc008('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'connectedlinename':{'type':Sequelize[_0xc008('0x2')]},'language':{'type':Sequelize[_0xc008('0x2')]},'accountcode':{'type':Sequelize[_0xc008('0x2')]},'context':{'type':Sequelize[_0xc008('0x2')]},'exten':{'type':Sequelize[_0xc008('0x2')]},'priority':{'type':Sequelize[_0xc008('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xc008('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc008('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc008('0x2')]},'destexten':{'type':Sequelize[_0xc008('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xc008('0x2')]},'destlinkedid':{'type':Sequelize[_0xc008('0x2')]},'dialstring':{'type':Sequelize[_0xc008('0x2')]},'dialstatus':{'type':Sequelize[_0xc008('0x2')]},'starttime':{'type':Sequelize[_0xc008('0x4')]},'answertime':{'type':Sequelize[_0xc008('0x4')]},'endtime':{'type':Sequelize[_0xc008('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xc008('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xc008('0x3')]},'billableseconds':{'type':Sequelize[_0xc008('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index a42cb2c..c2e0e1a 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 _0x218f=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','VoiceDialReport','include','findAll','catch','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x28de32,_0x242d8b){var _0x5ec7a8=function(_0x4c1a27){while(--_0x4c1a27){_0x28de32['push'](_0x28de32['shift']());}};_0x5ec7a8(++_0x242d8b);}(_0x218f,0x103));var _0xf218=function(_0x20dcf6,_0xf3c3f7){_0x20dcf6=_0x20dcf6-0x0;var _0x5183ee=_0x218f[_0x20dcf6];return _0x5183ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf218('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf218('0x1'));var rp=require(_0xf218('0x2'));var moment=require(_0xf218('0x3'));var BPromise=require(_0xf218('0x4'));var Mustache=require(_0xf218('0x5'));var util=require(_0xf218('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf218('0x7'));var ejs=require(_0xf218('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf218('0x9'));var jsforce=require(_0xf218('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf218('0x7'));var querystring=require('querystring');var Papa=require(_0xf218('0xb'));var Redis=require(_0xf218('0xc'));var authService=require(_0xf218('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf218('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf218('0xf'));var utils=require(_0xf218('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xf218('0x11'));var db=require(_0xf218('0x12'))['db'];function respondWithStatusCode(_0x473f7a,_0x3c848f){_0x3c848f=_0x3c848f||0xcc;return function(_0xcac4fa){if(_0xcac4fa){return _0x473f7a[_0xf218('0x13')](_0x3c848f);}return _0x473f7a[_0xf218('0x14')](_0x3c848f)['end']();};}function respondWithResult(_0x1d3899,_0x2f1680){_0x2f1680=_0x2f1680||0xc8;return function(_0x528109){if(_0x528109){return _0x1d3899[_0xf218('0x14')](_0x2f1680)[_0xf218('0x15')](_0x528109);}};}function respondWithFilteredResult(_0x37def0,_0x505b22){return function(_0x532895){if(_0x532895){var _0x29936a=typeof _0x505b22[_0xf218('0x16')]==='undefined'&&typeof _0x505b22[_0xf218('0x17')]===_0xf218('0x18');var _0x4250e6=_0x532895[_0xf218('0x19')];var _0x323c88=_0x29936a?0x0:_0x505b22[_0xf218('0x16')];var _0x1dfe6e=_0x29936a?_0x532895['count']:_0x505b22[_0xf218('0x16')]+_0x505b22['limit'];var _0x4d6a25;if(_0x1dfe6e>=_0x4250e6){_0x1dfe6e=_0x4250e6;_0x4d6a25=0xc8;}else{_0x4d6a25=0xce;}_0x37def0[_0xf218('0x14')](_0x4d6a25);return _0x37def0[_0xf218('0x1a')](_0xf218('0x1b'),_0x323c88+'-'+_0x1dfe6e+'/'+_0x4250e6)[_0xf218('0x15')](_0x532895);}return null;};}function patchUpdates(_0x149651){return function(_0x207f0e){try{jsonpatch[_0xf218('0x1c')](_0x207f0e,_0x149651,!![]);}catch(_0x341573){return BPromise[_0xf218('0x1d')](_0x341573);}return _0x207f0e[_0xf218('0x1e')]();};}function saveUpdates(_0x35c309,_0x14b050){return function(_0x142874){if(_0x142874){return _0x142874[_0xf218('0x1f')](_0x35c309)[_0xf218('0x20')](function(_0x1e8d9b){return _0x1e8d9b;});}return null;};}function removeEntity(_0x3f0011,_0x52154f){return function(_0x2f2234){if(_0x2f2234){return _0x2f2234[_0xf218('0x21')]()[_0xf218('0x20')](function(){_0x3f0011[_0xf218('0x14')](0xcc)[_0xf218('0x22')]();});}};}function handleEntityNotFound(_0x3c5d42,_0x212a2d){return function(_0x450682){if(!_0x450682){_0x3c5d42['sendStatus'](0x194);}return _0x450682;};}function handleError(_0x381719,_0xb338ee){_0xb338ee=_0xb338ee||0x1f4;return function(_0x2b6a7e){logger[_0xf218('0x23')](_0x2b6a7e[_0xf218('0x24')]);if(_0x2b6a7e['name']){delete _0x2b6a7e[_0xf218('0x25')];}_0x381719['status'](_0xb338ee)['send'](_0x2b6a7e);};}exports['index']=function(_0x29f479,_0x26e334){var _0x401d28={},_0x3e3b59={},_0x499995={'count':0x0,'rows':[]};var _0x372c48=_[_0xf218('0x26')](db['VoiceDialReport'][_0xf218('0x27')],function(_0x3a43b5){return{'name':_0x3a43b5['fieldName'],'type':_0x3a43b5[_0xf218('0x28')][_0xf218('0x29')]};});_0x3e3b59[_0xf218('0x2a')]=_[_0xf218('0x26')](_0x372c48,'name');_0x3e3b59[_0xf218('0x2b')]=_[_0xf218('0x2c')](_0x29f479['query']);_0x3e3b59['filters']=_[_0xf218('0x2d')](_0x3e3b59[_0xf218('0x2a')],_0x3e3b59['query']);_0x401d28[_0xf218('0x2e')]=_[_0xf218('0x2d')](_0x3e3b59[_0xf218('0x2a')],qs['fields'](_0x29f479[_0xf218('0x2b')][_0xf218('0x2f')]));_0x401d28[_0xf218('0x2e')]=_0x401d28['attributes'][_0xf218('0x30')]?_0x401d28[_0xf218('0x2e')]:_0x3e3b59['model'];if(!_0x29f479[_0xf218('0x2b')][_0xf218('0x31')](_0xf218('0x32'))){_0x401d28[_0xf218('0x17')]=qs['limit'](_0x29f479[_0xf218('0x2b')]['limit']);_0x401d28['offset']=qs[_0xf218('0x16')](_0x29f479[_0xf218('0x2b')][_0xf218('0x16')]);}_0x401d28[_0xf218('0x33')]=qs[_0xf218('0x34')](_0x29f479[_0xf218('0x2b')][_0xf218('0x34')]);_0x401d28[_0xf218('0x35')]=qs[_0xf218('0x36')](_[_0xf218('0x37')](_0x29f479['query'],_0x3e3b59['filters']),_0x372c48);if(_0x29f479[_0xf218('0x2b')][_0xf218('0x38')]){_0x401d28[_0xf218('0x35')]=_['merge'](_0x401d28[_0xf218('0x35')],{'$or':_[_0xf218('0x26')](_0x372c48,function(_0x1f1028){if(_0x1f1028[_0xf218('0x28')]!==_0xf218('0x39')){var _0x4d8825={};_0x4d8825[_0x1f1028[_0xf218('0x25')]]={'$like':'%'+_0x29f479['query'][_0xf218('0x38')]+'%'};return _0x4d8825;}})});}_0x401d28=_[_0xf218('0x3a')]({},_0x401d28,_0x29f479[_0xf218('0x3b')]);var _0xa15f39={'where':_0x401d28[_0xf218('0x35')]};return db[_0xf218('0x3c')]['count'](_0xa15f39)[_0xf218('0x20')](function(_0x5210e6){_0x499995['count']=_0x5210e6;if(_0x29f479[_0xf218('0x2b')]['includeAll']){_0x401d28[_0xf218('0x3d')]=[{'all':!![]}];}return db[_0xf218('0x3c')][_0xf218('0x3e')](_0x401d28);})[_0xf218('0x20')](function(_0x4f7515){_0x499995['rows']=_0x4f7515;return _0x499995;})[_0xf218('0x20')](respondWithFilteredResult(_0x26e334,_0x401d28))[_0xf218('0x3f')](handleError(_0x26e334,null));};exports['show']=function(_0x57992c,_0x3b9ac4){var _0x532fd7={'raw':!![],'where':{'id':_0x57992c[_0xf218('0x40')]['id']}},_0x336701={};_0x336701[_0xf218('0x2a')]=_[_0xf218('0x2c')](db['VoiceDialReport'][_0xf218('0x27')]);_0x336701[_0xf218('0x2b')]=_['keys'](_0x57992c[_0xf218('0x2b')]);_0x336701[_0xf218('0x36')]=_['intersection'](_0x336701[_0xf218('0x2a')],_0x336701[_0xf218('0x2b')]);_0x532fd7[_0xf218('0x2e')]=_[_0xf218('0x2d')](_0x336701[_0xf218('0x2a')],qs['fields'](_0x57992c[_0xf218('0x2b')][_0xf218('0x2f')]));_0x532fd7[_0xf218('0x2e')]=_0x532fd7[_0xf218('0x2e')][_0xf218('0x30')]?_0x532fd7[_0xf218('0x2e')]:_0x336701[_0xf218('0x2a')];if(_0x57992c[_0xf218('0x2b')]['includeAll']){_0x532fd7['include']=[{'all':!![]}];}_0x532fd7=_['merge']({},_0x532fd7,_0x57992c[_0xf218('0x3b')]);return db[_0xf218('0x3c')][_0xf218('0x41')](_0x532fd7)['then'](handleEntityNotFound(_0x3b9ac4,null))[_0xf218('0x20')](respondWithResult(_0x3b9ac4,null))[_0xf218('0x3f')](handleError(_0x3b9ac4,null));};exports[_0xf218('0x42')]=function(_0x24ed3c,_0x492845){return db[_0xf218('0x3c')][_0xf218('0x42')](_0x24ed3c[_0xf218('0x43')],{})[_0xf218('0x20')](respondWithResult(_0x492845,0xc9))[_0xf218('0x3f')](handleError(_0x492845,null));};exports[_0xf218('0x1f')]=function(_0x133efb,_0x35621d){if(_0x133efb['body']['id']){delete _0x133efb[_0xf218('0x43')]['id'];}return db['VoiceDialReport'][_0xf218('0x41')]({'where':{'id':_0x133efb['params']['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x35621d,null))['then'](saveUpdates(_0x133efb[_0xf218('0x43')],null))['then'](respondWithResult(_0x35621d,null))[_0xf218('0x3f')](handleError(_0x35621d,null));};exports[_0xf218('0x21')]=function(_0x2de9c7,_0x4d0254){return db[_0xf218('0x3c')][_0xf218('0x41')]({'where':{'id':_0x2de9c7[_0xf218('0x40')]['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x4d0254,null))['then'](removeEntity(_0x4d0254,null))[_0xf218('0x3f')](handleError(_0x4d0254,null));};exports[_0xf218('0x44')]=function(_0x2f1fb9,_0x553bdf){return db['VoiceDialReport'][_0xf218('0x44')]()[_0xf218('0x20')](respondWithResult(_0x553bdf,null))[_0xf218('0x3f')](handleError(_0x553bdf,null));}; \ No newline at end of file +var _0x1c08=['attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','VoiceDialReport','includeAll','include','rows','show','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x2706f2,_0x9a058){var _0x595bab=function(_0x54371f){while(--_0x54371f){_0x2706f2['push'](_0x2706f2['shift']());}};_0x595bab(++_0x9a058);}(_0x1c08,0xe8));var _0x81c0=function(_0x42ba3b,_0x355441){_0x42ba3b=_0x42ba3b-0x0;var _0x17634b=_0x1c08[_0x42ba3b];return _0x17634b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81c0('0x0'));var zipdir=require(_0x81c0('0x1'));var jsonpatch=require(_0x81c0('0x2'));var rp=require(_0x81c0('0x3'));var moment=require(_0x81c0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x81c0('0x5'));var util=require('util');var path=require('path');var sox=require(_0x81c0('0x6'));var csv=require(_0x81c0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81c0('0x8'));var squel=require(_0x81c0('0x9'));var crypto=require(_0x81c0('0xa'));var jsforce=require(_0x81c0('0xb'));var deskjs=require(_0x81c0('0xc'));var toCsv=require(_0x81c0('0x7'));var querystring=require('querystring');var Papa=require(_0x81c0('0xd'));var Redis=require('ioredis');var authService=require(_0x81c0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x81c0('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x81c0('0x10'));var utils=require(_0x81c0('0x11'));var config=require(_0x81c0('0x12'));var licenseUtil=require(_0x81c0('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ba4e1,_0x5e806e){_0x5e806e=_0x5e806e||0xcc;return function(_0x8b88c1){if(_0x8b88c1){return _0x5ba4e1[_0x81c0('0x14')](_0x5e806e);}return _0x5ba4e1[_0x81c0('0x15')](_0x5e806e)[_0x81c0('0x16')]();};}function respondWithResult(_0x1da1c4,_0x9c39cc){_0x9c39cc=_0x9c39cc||0xc8;return function(_0x294caf){if(_0x294caf){return _0x1da1c4[_0x81c0('0x15')](_0x9c39cc)[_0x81c0('0x17')](_0x294caf);}};}function respondWithFilteredResult(_0x5a978a,_0x2d7ff3){return function(_0x3d246a){if(_0x3d246a){var _0x24f9fe=typeof _0x2d7ff3['offset']===_0x81c0('0x18')&&typeof _0x2d7ff3[_0x81c0('0x19')]==='undefined';var _0x25d81f=_0x3d246a[_0x81c0('0x1a')];var _0x2c3c6d=_0x24f9fe?0x0:_0x2d7ff3[_0x81c0('0x1b')];var _0x3cab9b=_0x24f9fe?_0x3d246a[_0x81c0('0x1a')]:_0x2d7ff3[_0x81c0('0x1b')]+_0x2d7ff3[_0x81c0('0x19')];var _0x3dd847;if(_0x3cab9b>=_0x25d81f){_0x3cab9b=_0x25d81f;_0x3dd847=0xc8;}else{_0x3dd847=0xce;}_0x5a978a['status'](_0x3dd847);return _0x5a978a[_0x81c0('0x1c')](_0x81c0('0x1d'),_0x2c3c6d+'-'+_0x3cab9b+'/'+_0x25d81f)['json'](_0x3d246a);}return null;};}function patchUpdates(_0xc4c97b){return function(_0x409985){try{jsonpatch[_0x81c0('0x1e')](_0x409985,_0xc4c97b,!![]);}catch(_0x53a942){return BPromise[_0x81c0('0x1f')](_0x53a942);}return _0x409985['save']();};}function saveUpdates(_0x1236b0,_0x3b1f92){return function(_0xda156a){if(_0xda156a){return _0xda156a[_0x81c0('0x20')](_0x1236b0)['then'](function(_0x170ce3){return _0x170ce3;});}return null;};}function removeEntity(_0x5f2976,_0x45eedd){return function(_0x1f128c){if(_0x1f128c){return _0x1f128c[_0x81c0('0x21')]()[_0x81c0('0x22')](function(){_0x5f2976[_0x81c0('0x15')](0xcc)[_0x81c0('0x16')]();});}};}function handleEntityNotFound(_0x3451da,_0x54348b){return function(_0x4117a1){if(!_0x4117a1){_0x3451da[_0x81c0('0x14')](0x194);}return _0x4117a1;};}function handleError(_0x68d626,_0x242385){_0x242385=_0x242385||0x1f4;return function(_0x14efdb){logger[_0x81c0('0x23')](_0x14efdb[_0x81c0('0x24')]);if(_0x14efdb['name']){delete _0x14efdb[_0x81c0('0x25')];}_0x68d626[_0x81c0('0x15')](_0x242385)[_0x81c0('0x26')](_0x14efdb);};}exports[_0x81c0('0x27')]=function(_0x4e5080,_0x2ad196){var _0x42fad2={},_0x569f6e={},_0x253dec={'count':0x0,'rows':[]};var _0x5a84cc=_[_0x81c0('0x28')](db['VoiceDialReport'][_0x81c0('0x29')],function(_0x34b020){return{'name':_0x34b020[_0x81c0('0x2a')],'type':_0x34b020[_0x81c0('0x2b')]['key']};});_0x569f6e[_0x81c0('0x2c')]=_[_0x81c0('0x28')](_0x5a84cc,_0x81c0('0x25'));_0x569f6e[_0x81c0('0x2d')]=_[_0x81c0('0x2e')](_0x4e5080['query']);_0x569f6e[_0x81c0('0x2f')]=_['intersection'](_0x569f6e[_0x81c0('0x2c')],_0x569f6e[_0x81c0('0x2d')]);_0x42fad2[_0x81c0('0x30')]=_[_0x81c0('0x31')](_0x569f6e[_0x81c0('0x2c')],qs['fields'](_0x4e5080[_0x81c0('0x2d')][_0x81c0('0x32')]));_0x42fad2[_0x81c0('0x30')]=_0x42fad2[_0x81c0('0x30')][_0x81c0('0x33')]?_0x42fad2[_0x81c0('0x30')]:_0x569f6e['model'];if(!_0x4e5080[_0x81c0('0x2d')]['hasOwnProperty'](_0x81c0('0x34'))){_0x42fad2[_0x81c0('0x19')]=qs[_0x81c0('0x19')](_0x4e5080[_0x81c0('0x2d')][_0x81c0('0x19')]);_0x42fad2['offset']=qs[_0x81c0('0x1b')](_0x4e5080['query'][_0x81c0('0x1b')]);}_0x42fad2[_0x81c0('0x35')]=qs[_0x81c0('0x36')](_0x4e5080[_0x81c0('0x2d')]['sort']);_0x42fad2[_0x81c0('0x37')]=qs[_0x81c0('0x2f')](_[_0x81c0('0x38')](_0x4e5080[_0x81c0('0x2d')],_0x569f6e['filters']),_0x5a84cc);if(_0x4e5080['query'][_0x81c0('0x39')]){_0x42fad2[_0x81c0('0x37')]=_[_0x81c0('0x3a')](_0x42fad2[_0x81c0('0x37')],{'$or':_[_0x81c0('0x28')](_0x5a84cc,function(_0x2ef0b8){if(_0x2ef0b8[_0x81c0('0x2b')]!=='VIRTUAL'){var _0x49f861={};_0x49f861[_0x2ef0b8[_0x81c0('0x25')]]={'$like':'%'+_0x4e5080[_0x81c0('0x2d')][_0x81c0('0x39')]+'%'};return _0x49f861;}})});}_0x42fad2=_['merge']({},_0x42fad2,_0x4e5080[_0x81c0('0x3b')]);var _0x44c700={'where':_0x42fad2[_0x81c0('0x37')]};return db[_0x81c0('0x3c')][_0x81c0('0x1a')](_0x44c700)[_0x81c0('0x22')](function(_0x5a8ab2){_0x253dec[_0x81c0('0x1a')]=_0x5a8ab2;if(_0x4e5080['query'][_0x81c0('0x3d')]){_0x42fad2[_0x81c0('0x3e')]=[{'all':!![]}];}return db[_0x81c0('0x3c')]['findAll'](_0x42fad2);})[_0x81c0('0x22')](function(_0x723e83){_0x253dec[_0x81c0('0x3f')]=_0x723e83;return _0x253dec;})[_0x81c0('0x22')](respondWithFilteredResult(_0x2ad196,_0x42fad2))['catch'](handleError(_0x2ad196,null));};exports[_0x81c0('0x40')]=function(_0x4b76f4,_0x2e89e8){var _0x3f784f={'raw':!![],'where':{'id':_0x4b76f4['params']['id']}},_0x773a49={};_0x773a49[_0x81c0('0x2c')]=_['keys'](db['VoiceDialReport'][_0x81c0('0x29')]);_0x773a49['query']=_['keys'](_0x4b76f4['query']);_0x773a49[_0x81c0('0x2f')]=_[_0x81c0('0x31')](_0x773a49['model'],_0x773a49[_0x81c0('0x2d')]);_0x3f784f[_0x81c0('0x30')]=_[_0x81c0('0x31')](_0x773a49[_0x81c0('0x2c')],qs[_0x81c0('0x32')](_0x4b76f4[_0x81c0('0x2d')][_0x81c0('0x32')]));_0x3f784f[_0x81c0('0x30')]=_0x3f784f[_0x81c0('0x30')][_0x81c0('0x33')]?_0x3f784f[_0x81c0('0x30')]:_0x773a49[_0x81c0('0x2c')];if(_0x4b76f4['query'][_0x81c0('0x3d')]){_0x3f784f['include']=[{'all':!![]}];}_0x3f784f=_[_0x81c0('0x3a')]({},_0x3f784f,_0x4b76f4[_0x81c0('0x3b')]);return db[_0x81c0('0x3c')][_0x81c0('0x41')](_0x3f784f)[_0x81c0('0x22')](handleEntityNotFound(_0x2e89e8,null))[_0x81c0('0x22')](respondWithResult(_0x2e89e8,null))[_0x81c0('0x42')](handleError(_0x2e89e8,null));};exports[_0x81c0('0x43')]=function(_0x42c5af,_0x48d540){return db[_0x81c0('0x3c')]['create'](_0x42c5af[_0x81c0('0x44')],{})[_0x81c0('0x22')](respondWithResult(_0x48d540,0xc9))[_0x81c0('0x42')](handleError(_0x48d540,null));};exports['update']=function(_0x1086c5,_0x40580f){if(_0x1086c5[_0x81c0('0x44')]['id']){delete _0x1086c5[_0x81c0('0x44')]['id'];}return db[_0x81c0('0x3c')][_0x81c0('0x41')]({'where':{'id':_0x1086c5['params']['id']}})[_0x81c0('0x22')](handleEntityNotFound(_0x40580f,null))['then'](saveUpdates(_0x1086c5[_0x81c0('0x44')],null))[_0x81c0('0x22')](respondWithResult(_0x40580f,null))[_0x81c0('0x42')](handleError(_0x40580f,null));};exports[_0x81c0('0x21')]=function(_0x37be78,_0x44e674){return db[_0x81c0('0x3c')][_0x81c0('0x41')]({'where':{'id':_0x37be78['params']['id']}})[_0x81c0('0x22')](handleEntityNotFound(_0x44e674,null))[_0x81c0('0x22')](removeEntity(_0x44e674,null))[_0x81c0('0x42')](handleError(_0x44e674,null));};exports[_0x81c0('0x45')]=function(_0x4a4d7e,_0x5c7540){return db['VoiceDialReport'][_0x81c0('0x45')]()[_0x81c0('0x22')](respondWithResult(_0x5c7540,null))[_0x81c0('0x42')](handleError(_0x5c7540,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9033382..c6c1d02 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 _0xa633=['request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','lodash','api'];(function(_0x163571,_0x32b1bf){var _0x112f49=function(_0x1069a0){while(--_0x1069a0){_0x163571['push'](_0x163571['shift']());}};_0x112f49(++_0x32b1bf);}(_0xa633,0x15d));var _0x3a63=function(_0x2ca22d,_0x148303){_0x2ca22d=_0x2ca22d-0x0;var _0x407ca1=_0xa633[_0x2ca22d];return _0x407ca1;};'use strict';var _=require(_0x3a63('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3a63('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3a63('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a63('0x3'));var config=require(_0x3a63('0x4'));var attributes=require(_0x3a63('0x5'));module[_0x3a63('0x6')]=function(_0x1315cb,_0xc9221d){return _0x1315cb[_0x3a63('0x7')](_0x3a63('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x33d8=['bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','util','../../config/logger','api','moment'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x33d8,0x164));var _0x833d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x33d8[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x833d('0x0'));var logger=require(_0x833d('0x1'))(_0x833d('0x2'));var moment=require(_0x833d('0x3'));var BPromise=require(_0x833d('0x4'));var rp=require(_0x833d('0x5'));var fs=require('fs');var path=require(_0x833d('0x6'));var rimraf=require('rimraf');var config=require(_0x833d('0x7'));var attributes=require(_0x833d('0x8'));module[_0x833d('0x9')]=function(_0x49a48e,_0x4b7e06){return _0x49a48e[_0x833d('0xa')]('VoiceDialReport',attributes,{'tableName':_0x833d('0xb'),'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 548472b..0d184d4 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 _0x7109=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','UpdateVoiceDialReport','update','attributes','then'];(function(_0x5e0e00,_0x4881d9){var _0x55c5ed=function(_0x4ae5f5){while(--_0x4ae5f5){_0x5e0e00['push'](_0x5e0e00['shift']());}};_0x55c5ed(++_0x4881d9);}(_0x7109,0xcb));var _0x9710=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0x7109[_0x4d67b8];return _0x55af3b;};'use strict';var _=require(_0x9710('0x0'));var util=require(_0x9710('0x1'));var moment=require(_0x9710('0x2'));var BPromise=require(_0x9710('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9710('0x4'))['db'];var utils=require(_0x9710('0x5'));var logger=require(_0x9710('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9710('0x7'));var client=jayson[_0x9710('0x8')][_0x9710('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x696635,_0x180911,_0x4aa768){return new BPromise(function(_0x5d34af,_0x36482c){return client[_0x9710('0xa')](_0x696635,_0x4aa768)['then'](function(_0x2e7d71){logger[_0x9710('0xb')](_0x9710('0xc'),_0x180911,_0x9710('0xd'));logger['debug'](_0x9710('0xe'),_0x180911,_0x9710('0xd'),JSON['stringify'](_0x2e7d71));if(_0x2e7d71['error']){if(_0x2e7d71['error']['code']===0x1f4){logger[_0x9710('0xf')](_0x9710('0xc'),_0x180911,_0x2e7d71[_0x9710('0xf')][_0x9710('0x10')]);return _0x36482c(_0x2e7d71[_0x9710('0xf')]['message']);}logger[_0x9710('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x180911,_0x2e7d71[_0x9710('0xf')][_0x9710('0x10')]);return _0x5d34af(_0x2e7d71[_0x9710('0xf')][_0x9710('0x10')]);}else{logger[_0x9710('0xb')](_0x9710('0xc'),_0x180911,_0x9710('0xd'));_0x5d34af(_0x2e7d71[_0x9710('0x11')]['message']);}})[_0x9710('0x12')](function(_0x5b6077){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x180911,_0x5b6077);_0x36482c(_0x5b6077);});});}exports[_0x9710('0x13')]=function(_0x5903d0){var _0x1e59ba=this;return new Promise(function(_0x5d5a42,_0x215e26){return db[_0x9710('0x14')][_0x9710('0x15')](_0x5903d0['body'],{'raw':_0x5903d0[_0x9710('0x16')]?_0x5903d0[_0x9710('0x16')][_0x9710('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1b87c1){logger[_0x9710('0xb')](_0x9710('0x13'),_0x5903d0);logger['debug']('CreateVoiceDialReport',_0x5903d0,JSON[_0x9710('0x18')](_0x1b87c1));_0x5d5a42(_0x1b87c1);})[_0x9710('0x12')](function(_0x2090fe){logger[_0x9710('0xf')](_0x9710('0x13'),_0x2090fe[_0x9710('0x10')],_0x5903d0);_0x215e26(_0x1e59ba[_0x9710('0xf')](0x1f4,_0x2090fe[_0x9710('0x10')]));});});};exports[_0x9710('0x19')]=function(_0x6787fb){var _0x405639=this;return new Promise(function(_0x2b000,_0x3d9bf1){return db[_0x9710('0x14')][_0x9710('0x1a')](_0x6787fb['body'],{'raw':_0x6787fb['options']?_0x6787fb[_0x9710('0x16')][_0x9710('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6787fb[_0x9710('0x16')]?_0x6787fb[_0x9710('0x16')]['where']||null:null,'attributes':_0x6787fb[_0x9710('0x16')]?_0x6787fb['options'][_0x9710('0x1b')]||null:null,'limit':_0x6787fb['options']?_0x6787fb[_0x9710('0x16')]['limit']||null:null})[_0x9710('0x1c')](function(_0x1bed11){logger[_0x9710('0xb')](_0x9710('0x19'),_0x6787fb);logger['debug'](_0x9710('0x19'),_0x6787fb,JSON[_0x9710('0x18')](_0x1bed11));_0x2b000(_0x1bed11);})[_0x9710('0x12')](function(_0x4704a6){logger[_0x9710('0xf')](_0x9710('0x19'),_0x4704a6[_0x9710('0x10')],_0x6787fb);_0x3d9bf1(_0x405639['error'](0x1f4,_0x4704a6[_0x9710('0x10')]));});});}; \ No newline at end of file +var _0xc2e6=['attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','raw'];(function(_0x5a53d0,_0x378b6f){var _0x14f287=function(_0xe93aaa){while(--_0xe93aaa){_0x5a53d0['push'](_0x5a53d0['shift']());}};_0x14f287(++_0x378b6f);}(_0xc2e6,0x176));var _0x6c2e=function(_0x3b9fcf,_0x1c39a9){_0x3b9fcf=_0x3b9fcf-0x0;var _0xc5092b=_0xc2e6[_0x3b9fcf];return _0xc5092b;};'use strict';var _=require('lodash');var util=require(_0x6c2e('0x0'));var moment=require(_0x6c2e('0x1'));var BPromise=require(_0x6c2e('0x2'));var rs=require(_0x6c2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c2e('0x4'))['db'];var utils=require(_0x6c2e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6c2e('0x6'));var client=jayson['client'][_0x6c2e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1dd02e,_0x39e462,_0x90f1cd){return new BPromise(function(_0x2046d8,_0x6f9c21){return client[_0x6c2e('0x8')](_0x1dd02e,_0x90f1cd)[_0x6c2e('0x9')](function(_0x592e38){logger[_0x6c2e('0xa')](_0x6c2e('0xb'),_0x39e462,_0x6c2e('0xc'));logger[_0x6c2e('0xd')](_0x6c2e('0xe'),_0x39e462,_0x6c2e('0xc'),JSON[_0x6c2e('0xf')](_0x592e38));if(_0x592e38[_0x6c2e('0x10')]){if(_0x592e38['error'][_0x6c2e('0x11')]===0x1f4){logger[_0x6c2e('0x10')](_0x6c2e('0xb'),_0x39e462,_0x592e38['error'][_0x6c2e('0x12')]);return _0x6f9c21(_0x592e38[_0x6c2e('0x10')][_0x6c2e('0x12')]);}logger[_0x6c2e('0x10')](_0x6c2e('0xb'),_0x39e462,_0x592e38[_0x6c2e('0x10')]['message']);return _0x2046d8(_0x592e38[_0x6c2e('0x10')][_0x6c2e('0x12')]);}else{logger[_0x6c2e('0xa')](_0x6c2e('0xb'),_0x39e462,'request\x20sent');_0x2046d8(_0x592e38[_0x6c2e('0x13')]['message']);}})[_0x6c2e('0x14')](function(_0x398453){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x39e462,_0x398453);_0x6f9c21(_0x398453);});});}exports[_0x6c2e('0x15')]=function(_0x49159f){var _0x6180a2=this;return new Promise(function(_0x4ba3e4,_0x26baa6){return db[_0x6c2e('0x16')][_0x6c2e('0x17')](_0x49159f[_0x6c2e('0x18')],{'raw':_0x49159f[_0x6c2e('0x19')]?_0x49159f['options']['raw']===undefined?!![]:![]:!![]})[_0x6c2e('0x9')](function(_0x11f967){logger['info']('CreateVoiceDialReport',_0x49159f);logger[_0x6c2e('0xd')]('CreateVoiceDialReport',_0x49159f,JSON[_0x6c2e('0xf')](_0x11f967));_0x4ba3e4(_0x11f967);})['catch'](function(_0x20542c){logger['error'](_0x6c2e('0x15'),_0x20542c['message'],_0x49159f);_0x26baa6(_0x6180a2[_0x6c2e('0x10')](0x1f4,_0x20542c[_0x6c2e('0x12')]));});});};exports[_0x6c2e('0x1a')]=function(_0x48ef3e){var _0x2c0cf7=this;return new Promise(function(_0x2499f1,_0x557572){return db['VoiceDialReport'][_0x6c2e('0x1b')](_0x48ef3e[_0x6c2e('0x18')],{'raw':_0x48ef3e['options']?_0x48ef3e[_0x6c2e('0x19')][_0x6c2e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48ef3e[_0x6c2e('0x19')]?_0x48ef3e[_0x6c2e('0x19')]['where']||null:null,'attributes':_0x48ef3e['options']?_0x48ef3e[_0x6c2e('0x19')][_0x6c2e('0x1d')]||null:null,'limit':_0x48ef3e[_0x6c2e('0x19')]?_0x48ef3e['options'][_0x6c2e('0x1e')]||null:null})[_0x6c2e('0x9')](function(_0x585fd3){logger[_0x6c2e('0xa')](_0x6c2e('0x1a'),_0x48ef3e);logger[_0x6c2e('0xd')](_0x6c2e('0x1a'),_0x48ef3e,JSON[_0x6c2e('0xf')](_0x585fd3));_0x2499f1(_0x585fd3);})[_0x6c2e('0x14')](function(_0x2b8259){logger[_0x6c2e('0x10')](_0x6c2e('0x1a'),_0x2b8259[_0x6c2e('0x12')],_0x48ef3e);_0x557572(_0x2c0cf7['error'](0x1f4,_0x2b8259[_0x6c2e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 911a101..bb12f6a 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 _0x78ad=['/:id/applications','addApplications','put','/:id','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','post','create'];(function(_0x5559e6,_0x3d93cf){var _0x55f7be=function(_0x483d36){while(--_0x483d36){_0x5559e6['push'](_0x5559e6['shift']());}};_0x55f7be(++_0x3d93cf);}(_0x78ad,0x132));var _0xd78a=function(_0x2a02b0,_0xe2b325){_0x2a02b0=_0x2a02b0-0x0;var _0x3ccb24=_0x78ad[_0x2a02b0];return _0x3ccb24;};'use strict';var multer=require(_0xd78a('0x0'));var util=require(_0xd78a('0x1'));var path=require(_0xd78a('0x2'));var timeout=require(_0xd78a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd78a('0x4'));var auth=require(_0xd78a('0x5'));var interaction=require(_0xd78a('0x6'));var config=require(_0xd78a('0x7'));var controller=require(_0xd78a('0x8'));router[_0xd78a('0x9')]('/',auth[_0xd78a('0xa')](),controller[_0xd78a('0xb')]);router[_0xd78a('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd78a('0xc')]('/',auth[_0xd78a('0xa')](),controller[_0xd78a('0xd')]);router[_0xd78a('0xc')](_0xd78a('0xe'),auth[_0xd78a('0xa')](),controller[_0xd78a('0xf')]);router[_0xd78a('0x10')](_0xd78a('0x11'),auth[_0xd78a('0xa')](),controller['update']);router[_0xd78a('0x12')]('/:id',auth[_0xd78a('0xa')](),controller[_0xd78a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6cb2=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','create','/:id/applications','put','delete','destroy','exports','util'];(function(_0x50f111,_0x1fefca){var _0xcdf899=function(_0x31992e){while(--_0x31992e){_0x50f111['push'](_0x50f111['shift']());}};_0xcdf899(++_0x1fefca);}(_0x6cb2,0x8b));var _0x26cb=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x6cb2[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require(_0x26cb('0x0'));var path=require(_0x26cb('0x1'));var timeout=require(_0x26cb('0x2'));var express=require(_0x26cb('0x3'));var router=express[_0x26cb('0x4')]();var fs_extra=require(_0x26cb('0x5'));var auth=require(_0x26cb('0x6'));var interaction=require(_0x26cb('0x7'));var config=require(_0x26cb('0x8'));var controller=require('./voiceExtension.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x26cb('0x9')]);router[_0x26cb('0xa')](_0x26cb('0xb'),auth[_0x26cb('0xc')](),controller[_0x26cb('0xd')]);router['post']('/',auth[_0x26cb('0xc')](),controller[_0x26cb('0xe')]);router['post'](_0x26cb('0xf'),auth[_0x26cb('0xc')](),controller['addApplications']);router[_0x26cb('0x10')](_0x26cb('0xb'),auth[_0x26cb('0xc')](),controller['update']);router[_0x26cb('0x11')](_0x26cb('0xb'),auth[_0x26cb('0xc')](),controller[_0x26cb('0x12')]);module[_0x26cb('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 4d187ec..66b128b 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 _0x98f8=['exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue'];(function(_0x5132df,_0x24b568){var _0x358a2c=function(_0x2a96a1){while(--_0x2a96a1){_0x5132df['push'](_0x5132df['shift']());}};_0x358a2c(++_0x24b568);}(_0x98f8,0x1c9));var _0x898f=function(_0x176a4d,_0x3ac206){_0x176a4d=_0x176a4d-0x0;var _0x4bcd4e=_0x98f8[_0x176a4d];return _0x4bcd4e;};'use strict';var Sequelize=require(_0x898f('0x0'));module[_0x898f('0x1')]={'context':{'type':Sequelize[_0x898f('0x2')],'allowNull':![],'unique':_0x898f('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x898f('0x2')],'allowNull':![],'unique':_0x898f('0x3')},'priority':{'type':Sequelize[_0x898f('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x898f('0x3')},'tag':{'type':Sequelize[_0x898f('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x898f('0x2')],'allowNull':![],'defaultValue':_0x898f('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x898f('0x5')]('inbound',_0x898f('0x6'),_0x898f('0x7'),_0x898f('0x8'),_0x898f('0x9'),_0x898f('0xa'),_0x898f('0xb')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x898f('0x2')],'allowNull':![],'defaultValue':_0x898f('0xc')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x898f('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x898f('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x898f('0xe')]},'recordingFormat':{'type':Sequelize[_0x898f('0x2')],'defaultValue':_0x898f('0xf')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x898f('0x10')],'get':function(_0x12da1d){return this[_0x898f('0x11')](_0x898f('0x12'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x82d5=['inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','compositeIndex','STRING','NoOp','inbound'];(function(_0x155c75,_0x15e896){var _0x133721=function(_0x540f3c){while(--_0x540f3c){_0x155c75['push'](_0x155c75['shift']());}};_0x133721(++_0x15e896);}(_0x82d5,0x182));var _0x582d=function(_0x411172,_0x5f3b53){_0x411172=_0x411172-0x0;var _0x489979=_0x82d5[_0x411172];return _0x489979;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x582d('0x0'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x582d('0x1')],'allowNull':![],'unique':_0x582d('0x0')},'priority':{'type':Sequelize[_0x582d('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x582d('0x0')},'tag':{'type':Sequelize[_0x582d('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x582d('0x1')],'allowNull':![],'defaultValue':_0x582d('0x2')},'appdata':{'type':Sequelize[_0x582d('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x582d('0x3'),'outbound','internal',_0x582d('0x4'),_0x582d('0x5'),_0x582d('0x6'),_0x582d('0x7')),'allowNull':![]},'description':{'type':Sequelize[_0x582d('0x1')]},'interval':{'type':Sequelize[_0x582d('0x1')],'allowNull':![],'defaultValue':_0x582d('0x8')},'IntervalId':{'type':Sequelize[_0x582d('0x9')]},'isApp':{'type':Sequelize[_0x582d('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x582d('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x582d('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x582d('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x582d('0x9')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x582d('0xb')},'answer':{'type':Sequelize[_0x582d('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x582d('0xc')],'get':function(_0x3760c3){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x582d('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index f22157c..154c481 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 _0x8b4a=['VoiceExtension','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','include','findAll','rows','catch','show','create','body','startsWith','exten','concat','user','role','get','InternalRoutes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','pick','context','description','mandatoryDisposition','alias','addApplications','sequelize','VoiceExtensionId','isApp','rewriteDial','toLowerCase','true','createRouting','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/license/util','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','save','update','then','InboundRoutes','inbound','OutboundRoutes','outbound','internal','ignore','value','includes','type','find','name','UserProfileResource','destroy','end','error','stack'];(function(_0x1fa159,_0x2f7ca8){var _0x4c95ab=function(_0x280e47){while(--_0x280e47){_0x1fa159['push'](_0x1fa159['shift']());}};_0x4c95ab(++_0x2f7ca8);}(_0x8b4a,0x1e3));var _0xa8b4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8b4a[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xa8b4('0x0'));var rimraf=require(_0xa8b4('0x1'));var zipdir=require(_0xa8b4('0x2'));var jsonpatch=require(_0xa8b4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa8b4('0x4'));var Mustache=require(_0xa8b4('0x5'));var util=require(_0xa8b4('0x6'));var path=require('path');var sox=require(_0xa8b4('0x7'));var csv=require(_0xa8b4('0x8'));var ejs=require(_0xa8b4('0x9'));var fs=require('fs');var fs_extra=require(_0xa8b4('0xa'));var _=require(_0xa8b4('0xb'));var squel=require('squel');var crypto=require(_0xa8b4('0xc'));var jsforce=require(_0xa8b4('0xd'));var deskjs=require(_0xa8b4('0xe'));var toCsv=require(_0xa8b4('0x8'));var querystring=require(_0xa8b4('0xf'));var Papa=require(_0xa8b4('0x10'));var Redis=require(_0xa8b4('0x11'));var authService=require(_0xa8b4('0x12'));var qs=require(_0xa8b4('0x13'));var as=require(_0xa8b4('0x14'));var hardwareService=require(_0xa8b4('0x15'));var logger=require(_0xa8b4('0x16'))(_0xa8b4('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa8b4('0x18'));var db=require('../../mysqldb')['db'];config[_0xa8b4('0x19')]=_[_0xa8b4('0x1a')](config['redis'],{'host':_0xa8b4('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8b4('0x19')]));require(_0xa8b4('0x1c'))[_0xa8b4('0x1d')](socket);function respondWithStatusCode(_0x385cd3,_0x29a3dc){_0x29a3dc=_0x29a3dc||0xcc;return function(_0x33b3df){if(_0x33b3df){return _0x385cd3[_0xa8b4('0x1e')](_0x29a3dc);}return _0x385cd3[_0xa8b4('0x1f')](_0x29a3dc)['end']();};}function respondWithResult(_0x567fb2,_0x49a81f){_0x49a81f=_0x49a81f||0xc8;return function(_0x240aa0){if(_0x240aa0){return _0x567fb2['status'](_0x49a81f)[_0xa8b4('0x20')](_0x240aa0);}};}function respondWithFilteredResult(_0x6655cb,_0x596086){return function(_0x5b2a80){if(_0x5b2a80){var _0x1120e9=typeof _0x596086[_0xa8b4('0x21')]===_0xa8b4('0x22')&&typeof _0x596086['limit']===_0xa8b4('0x22');var _0x38eb62=_0x5b2a80[_0xa8b4('0x23')];var _0x571765=_0x1120e9?0x0:_0x596086['offset'];var _0x9234de=_0x1120e9?_0x5b2a80[_0xa8b4('0x23')]:_0x596086[_0xa8b4('0x21')]+_0x596086[_0xa8b4('0x24')];var _0xb5bb58;if(_0x9234de>=_0x38eb62){_0x9234de=_0x38eb62;_0xb5bb58=0xc8;}else{_0xb5bb58=0xce;}_0x6655cb['status'](_0xb5bb58);return _0x6655cb['set'](_0xa8b4('0x25'),_0x571765+'-'+_0x9234de+'/'+_0x38eb62)[_0xa8b4('0x20')](_0x5b2a80);}return null;};}function patchUpdates(_0x3db925){return function(_0x46b9ca){try{jsonpatch['apply'](_0x46b9ca,_0x3db925,!![]);}catch(_0xfc3856){return BPromise['reject'](_0xfc3856);}return _0x46b9ca[_0xa8b4('0x26')]();};}function saveUpdates(_0xd25450,_0x11591a){return function(_0x348927){if(_0x348927){return _0x348927[_0xa8b4('0x27')](_0xd25450)['then'](function(_0x2f65ec){return _0x2f65ec;});}return null;};}function removeEntity(_0x8fe765,_0x154b24){return function(_0x3a8134){if(_0x3a8134){return _0x3a8134['destroy']()[_0xa8b4('0x28')](function(){var _0x391ebe=_0x3a8134['get']({'plain':!![]});var _0x2feb31=[{'name':_0xa8b4('0x29'),'value':_0xa8b4('0x2a'),'ignore':![]},{'name':_0xa8b4('0x2b'),'value':_0xa8b4('0x2c'),'ignore':![]},{'name':'InternalRoutes','value':_0xa8b4('0x2d'),'ignore':![]}];var _0x5238c7=_(_0x2feb31)['filter'](_0xa8b4('0x2e'))['map'](_0xa8b4('0x2f'))[_0xa8b4('0x2f')]();if(_[_0xa8b4('0x30')](_0x5238c7,_0x391ebe[_0xa8b4('0x31')])){return;}var _0x7a4291=_[_0xa8b4('0x32')](_0x2feb31,[_0xa8b4('0x2f'),_0x391ebe[_0xa8b4('0x31')]])[_0xa8b4('0x33')];return db[_0xa8b4('0x34')][_0xa8b4('0x35')]({'where':{'type':_0x7a4291,'resourceId':_0x391ebe['id']}})['then'](function(){return _0x3a8134;});})[_0xa8b4('0x28')](function(){_0x8fe765[_0xa8b4('0x1f')](0xcc)[_0xa8b4('0x36')]();});}};}function handleEntityNotFound(_0x45307f,_0x33e564){return function(_0x5d735f){if(!_0x5d735f){_0x45307f[_0xa8b4('0x1e')](0x194);}return _0x5d735f;};}function handleError(_0x230b6c,_0x3c756c){_0x3c756c=_0x3c756c||0x1f4;return function(_0x35f966){logger[_0xa8b4('0x37')](_0x35f966[_0xa8b4('0x38')]);if(_0x35f966['name']){delete _0x35f966['name'];}_0x230b6c['status'](_0x3c756c)['send'](_0x35f966);};}exports['index']=function(_0xaa3ab2,_0x1c9c24){var _0x346105={},_0x4bc9a8={},_0x77049d={'count':0x0,'rows':[]};var _0x5c0d3c=_['map'](db[_0xa8b4('0x39')][_0xa8b4('0x3a')],function(_0x148c70){return{'name':_0x148c70[_0xa8b4('0x3b')],'type':_0x148c70[_0xa8b4('0x31')][_0xa8b4('0x3c')]};});_0x4bc9a8['model']=_[_0xa8b4('0x3d')](_0x5c0d3c,'name');_0x4bc9a8[_0xa8b4('0x3e')]=_[_0xa8b4('0x3f')](_0xaa3ab2[_0xa8b4('0x3e')]);_0x4bc9a8[_0xa8b4('0x40')]=_[_0xa8b4('0x41')](_0x4bc9a8[_0xa8b4('0x42')],_0x4bc9a8['query']);_0x346105[_0xa8b4('0x43')]=_[_0xa8b4('0x41')](_0x4bc9a8[_0xa8b4('0x42')],qs['fields'](_0xaa3ab2[_0xa8b4('0x3e')][_0xa8b4('0x44')]));_0x346105[_0xa8b4('0x43')]=_0x346105[_0xa8b4('0x43')][_0xa8b4('0x45')]?_0x346105[_0xa8b4('0x43')]:_0x4bc9a8[_0xa8b4('0x42')];if(!_0xaa3ab2[_0xa8b4('0x3e')][_0xa8b4('0x46')]('nolimit')){_0x346105[_0xa8b4('0x24')]=qs[_0xa8b4('0x24')](_0xaa3ab2[_0xa8b4('0x3e')][_0xa8b4('0x24')]);_0x346105[_0xa8b4('0x21')]=qs[_0xa8b4('0x21')](_0xaa3ab2['query']['offset']);}_0x346105['order']=qs['sort'](_0xaa3ab2[_0xa8b4('0x3e')][_0xa8b4('0x47')]);_0x346105[_0xa8b4('0x48')]=qs[_0xa8b4('0x40')](_['pick'](_0xaa3ab2['query'],_0x4bc9a8['filters']),_0x5c0d3c);if(_0xaa3ab2[_0xa8b4('0x3e')][_0xa8b4('0x49')]){_0x346105[_0xa8b4('0x48')]=_[_0xa8b4('0x4a')](_0x346105['where'],{'$or':_[_0xa8b4('0x3d')](_0x5c0d3c,function(_0x3ce23d){if(_0x3ce23d[_0xa8b4('0x31')]!=='VIRTUAL'){var _0x19272a={};_0x19272a[_0x3ce23d['name']]={'$like':'%'+_0xaa3ab2[_0xa8b4('0x3e')][_0xa8b4('0x49')]+'%'};return _0x19272a;}})});}_0x346105=_[_0xa8b4('0x4a')]({},_0x346105,_0xaa3ab2[_0xa8b4('0x4b')]);var _0x3da7d1={'where':_0x346105['where']};return db[_0xa8b4('0x39')]['count'](_0x3da7d1)[_0xa8b4('0x28')](function(_0x3a9ce7){_0x77049d[_0xa8b4('0x23')]=_0x3a9ce7;if(_0xaa3ab2[_0xa8b4('0x3e')]['includeAll']){_0x346105[_0xa8b4('0x4c')]=[{'all':!![]}];}return db[_0xa8b4('0x39')][_0xa8b4('0x4d')](_0x346105);})[_0xa8b4('0x28')](function(_0x4ec16b){_0x77049d[_0xa8b4('0x4e')]=_0x4ec16b;return _0x77049d;})['then'](respondWithFilteredResult(_0x1c9c24,_0x346105))[_0xa8b4('0x4f')](handleError(_0x1c9c24,null));};exports[_0xa8b4('0x50')]=function(_0x473bde,_0x3f6ea2){var _0x5a3eab={'raw':![],'where':{'id':_0x473bde['params']['id']}},_0x548fc9={};_0x548fc9[_0xa8b4('0x42')]=_[_0xa8b4('0x3f')](db[_0xa8b4('0x39')][_0xa8b4('0x3a')]);_0x548fc9[_0xa8b4('0x3e')]=_[_0xa8b4('0x3f')](_0x473bde[_0xa8b4('0x3e')]);_0x548fc9['filters']=_[_0xa8b4('0x41')](_0x548fc9[_0xa8b4('0x42')],_0x548fc9[_0xa8b4('0x3e')]);_0x5a3eab[_0xa8b4('0x43')]=_[_0xa8b4('0x41')](_0x548fc9[_0xa8b4('0x42')],qs[_0xa8b4('0x44')](_0x473bde[_0xa8b4('0x3e')]['fields']));_0x5a3eab[_0xa8b4('0x43')]=_0x5a3eab[_0xa8b4('0x43')][_0xa8b4('0x45')]?_0x5a3eab[_0xa8b4('0x43')]:_0x548fc9[_0xa8b4('0x42')];if(_0x473bde[_0xa8b4('0x3e')]['includeAll']){_0x5a3eab[_0xa8b4('0x4c')]=[{'all':!![]}];}_0x5a3eab=_[_0xa8b4('0x4a')]({},_0x5a3eab,_0x473bde[_0xa8b4('0x4b')]);return db['VoiceExtension'][_0xa8b4('0x32')](_0x5a3eab)[_0xa8b4('0x28')](handleEntityNotFound(_0x3f6ea2,null))[_0xa8b4('0x28')](respondWithResult(_0x3f6ea2,null))[_0xa8b4('0x4f')](handleError(_0x3f6ea2,null));};exports[_0xa8b4('0x35')]=function(_0xf209ca,_0x4b94cb){return db[_0xa8b4('0x39')][_0xa8b4('0x32')]({'where':{'id':_0xf209ca['params']['id']}})[_0xa8b4('0x28')](handleEntityNotFound(_0x4b94cb,null))[_0xa8b4('0x28')](removeEntity(_0x4b94cb,null))[_0xa8b4('0x4f')](handleError(_0x4b94cb,null));};exports[_0xa8b4('0x51')]=function(_0x205092,_0x2808ab){if(_0x205092[_0xa8b4('0x52')][_0xa8b4('0x31')]===_0xa8b4('0x2c')&&!_[_0xa8b4('0x53')](_0x205092[_0xa8b4('0x52')][_0xa8b4('0x54')],'_')){_0x205092[_0xa8b4('0x52')]['exten']='_'[_0xa8b4('0x55')](_0x205092[_0xa8b4('0x52')][_0xa8b4('0x54')]);}return db[_0xa8b4('0x39')][_0xa8b4('0x51')](_0x205092[_0xa8b4('0x52')],{'raw':![]})[_0xa8b4('0x28')](function(_0x28a1b4){var _0x29bf3d=_0x205092[_0xa8b4('0x56')]['get']({'plain':!![]});if(!_0x29bf3d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29bf3d[_0xa8b4('0x57')]==='user'){var _0xe03f36=_0x28a1b4[_0xa8b4('0x58')]({'plain':!![]});var _0x23127f=[{'name':_0xa8b4('0x29'),'value':'inbound'},{'name':'OutboundRoutes','value':_0xa8b4('0x2c')},{'name':_0xa8b4('0x59'),'value':_0xa8b4('0x2d')}];var _0x2091cf=_[_0xa8b4('0x32')](_0x23127f,[_0xa8b4('0x2f'),_0xe03f36['type']])['name'];return db[_0xa8b4('0x5a')]['find']({'where':{'name':_0x2091cf,'userProfileId':_0x29bf3d['userProfileId']},'raw':!![]})[_0xa8b4('0x28')](function(_0x4bbb35){if(_0x4bbb35&&_0x4bbb35[_0xa8b4('0x5b')]===0x0){return db['UserProfileResource'][_0xa8b4('0x51')]({'name':_0xe03f36[_0xa8b4('0x33')],'resourceId':_0xe03f36['id'],'type':_0x4bbb35[_0xa8b4('0x33')],'sectionId':_0x4bbb35['id']},{})[_0xa8b4('0x28')](function(){return _0x28a1b4;});}else{return _0x28a1b4;}})[_0xa8b4('0x4f')](function(_0x159731){logger[_0xa8b4('0x37')](_0xa8b4('0x5c'),_0x159731);throw _0x159731;});}return _0x28a1b4;})[_0xa8b4('0x28')](respondWithResult(_0x2808ab,0xc9))[_0xa8b4('0x4f')](handleError(_0x2808ab,null));};exports[_0xa8b4('0x27')]=function(_0x548940,_0x318089){if(_0x548940[_0xa8b4('0x52')]['id']){delete _0x548940['body']['id'];}return db[_0xa8b4('0x39')][_0xa8b4('0x32')]({'where':{'id':_0x548940[_0xa8b4('0x5d')]['id']}})[_0xa8b4('0x28')](handleEntityNotFound(_0x318089,null))[_0xa8b4('0x28')](function(_0x48c525){if(_0x48c525){return db[_0xa8b4('0x39')][_0xa8b4('0x27')](_[_0xa8b4('0x5e')](_0x548940[_0xa8b4('0x52')],[_0xa8b4('0x54'),_0xa8b4('0x5f'),_0xa8b4('0x60'),'recordingFormat','cutdigits',_0xa8b4('0x61'),_0xa8b4('0x62')]),{'where':{'context':_0x48c525[_0xa8b4('0x5f')],'exten':_0x48c525[_0xa8b4('0x54')]},'individualHooks':!![]})[_0xa8b4('0x28')](function(_0xa6ae35){return _0xa6ae35;});}return null;})['then'](respondWithStatusCode(_0x318089,null))[_0xa8b4('0x4f')](handleError(_0x318089,null));};exports[_0xa8b4('0x63')]=function(_0x44cb82,_0x33fe57){return db[_0xa8b4('0x39')]['findOne']({'where':{'id':_0x44cb82['params']['id']}})[_0xa8b4('0x28')](function(_0x586dc5){if(_0x586dc5){return db[_0xa8b4('0x64')]['transaction'](function(_0x24d477){return db[_0xa8b4('0x39')][_0xa8b4('0x35')]({'where':{'VoiceExtensionId':_0x44cb82['params']['id']},'transaction':_0x24d477})[_0xa8b4('0x28')](function(){var _0x4a24e0=_['map'](_0x44cb82['body'],function(_0x45b4e7){_0x45b4e7[_0xa8b4('0x65')]=_0x44cb82['params']['id'];_0x45b4e7[_0xa8b4('0x66')]=!![];return _0x45b4e7;});var _0x237826=_0x44cb82[_0xa8b4('0x3e')]['rewriteDial']&&_0x44cb82[_0xa8b4('0x3e')][_0xa8b4('0x67')][_0xa8b4('0x68')]()===_0xa8b4('0x69')?!![]:![];return _0x586dc5[_0xa8b4('0x6a')](_0x4a24e0,_0x237826);})[_0xa8b4('0x28')](function(_0x1ccbb8){return db[_0xa8b4('0x39')]['bulkCreate'](_0x1ccbb8,{'transaction':_0x24d477});});})[_0xa8b4('0x28')](function(){return db['VoiceExtension'][_0xa8b4('0x6b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x44cb82[_0xa8b4('0x5d')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xa8b4('0x28')](respondWithResult(_0x33fe57,null))[_0xa8b4('0x4f')](handleError(_0x33fe57,null));}; \ No newline at end of file +var _0x7885=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','alias','addApplications','findOne','sequelize','VoiceExtensionId','rewriteDial','true','createRouting','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','register','end','status','offset','undefined','count','limit','set','Content-Range','json','save','destroy','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','then','sendStatus','error','stack','index','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','body','startsWith','concat','exten','create','user','get'];(function(_0x3f78ed,_0x546c39){var _0x45d0c3=function(_0xf941cb){while(--_0xf941cb){_0x3f78ed['push'](_0x3f78ed['shift']());}};_0x45d0c3(++_0x546c39);}(_0x7885,0x153));var _0x5788=function(_0x5c12c8,_0x3906f4){_0x5c12c8=_0x5c12c8-0x0;var _0x2f6e12=_0x7885[_0x5c12c8];return _0x2f6e12;};'use strict';var emlformat=require(_0x5788('0x0'));var rimraf=require(_0x5788('0x1'));var zipdir=require(_0x5788('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5788('0x3'));var moment=require(_0x5788('0x4'));var BPromise=require(_0x5788('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5788('0x6'));var sox=require(_0x5788('0x7'));var csv=require(_0x5788('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5788('0x9'));var _=require(_0x5788('0xa'));var squel=require(_0x5788('0xb'));var crypto=require(_0x5788('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5788('0x8'));var querystring=require(_0x5788('0xd'));var Papa=require(_0x5788('0xe'));var Redis=require('ioredis');var authService=require(_0x5788('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5788('0x10'));var hardwareService=require(_0x5788('0x11'));var logger=require(_0x5788('0x12'))(_0x5788('0x13'));var utils=require('../../config/utils');var config=require(_0x5788('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5788('0x15')]=_[_0x5788('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5788('0x17'))(new Redis(config[_0x5788('0x15')]));require('./voiceExtension.socket')[_0x5788('0x18')](socket);function respondWithStatusCode(_0x5761ba,_0x4f466d){_0x4f466d=_0x4f466d||0xcc;return function(_0x31e081){if(_0x31e081){return _0x5761ba['sendStatus'](_0x4f466d);}return _0x5761ba['status'](_0x4f466d)[_0x5788('0x19')]();};}function respondWithResult(_0x5a8c71,_0x426d87){_0x426d87=_0x426d87||0xc8;return function(_0x1c8d6a){if(_0x1c8d6a){return _0x5a8c71[_0x5788('0x1a')](_0x426d87)['json'](_0x1c8d6a);}};}function respondWithFilteredResult(_0x15329d,_0x298041){return function(_0x437a69){if(_0x437a69){var _0x7e84c5=typeof _0x298041[_0x5788('0x1b')]===_0x5788('0x1c')&&typeof _0x298041['limit']==='undefined';var _0x228e73=_0x437a69[_0x5788('0x1d')];var _0xf64a57=_0x7e84c5?0x0:_0x298041[_0x5788('0x1b')];var _0x45f8b0=_0x7e84c5?_0x437a69[_0x5788('0x1d')]:_0x298041[_0x5788('0x1b')]+_0x298041[_0x5788('0x1e')];var _0x57c888;if(_0x45f8b0>=_0x228e73){_0x45f8b0=_0x228e73;_0x57c888=0xc8;}else{_0x57c888=0xce;}_0x15329d[_0x5788('0x1a')](_0x57c888);return _0x15329d[_0x5788('0x1f')](_0x5788('0x20'),_0xf64a57+'-'+_0x45f8b0+'/'+_0x228e73)[_0x5788('0x21')](_0x437a69);}return null;};}function patchUpdates(_0x1ccc04){return function(_0x33b16a){try{jsonpatch['apply'](_0x33b16a,_0x1ccc04,!![]);}catch(_0x3bbd65){return BPromise['reject'](_0x3bbd65);}return _0x33b16a[_0x5788('0x22')]();};}function saveUpdates(_0x5a655e,_0x4b4a64){return function(_0x165a58){if(_0x165a58){return _0x165a58['update'](_0x5a655e)['then'](function(_0x11322f){return _0x11322f;});}return null;};}function removeEntity(_0x26bb0f,_0x2040ea){return function(_0x386d2e){if(_0x386d2e){return _0x386d2e[_0x5788('0x23')]()['then'](function(){var _0x3d2de3=_0x386d2e['get']({'plain':!![]});var _0x122959=[{'name':_0x5788('0x24'),'value':_0x5788('0x25'),'ignore':![]},{'name':_0x5788('0x26'),'value':_0x5788('0x27'),'ignore':![]},{'name':_0x5788('0x28'),'value':_0x5788('0x29'),'ignore':![]}];var _0x17016f=_(_0x122959)['filter'](_0x5788('0x2a'))[_0x5788('0x2b')](_0x5788('0x2c'))[_0x5788('0x2c')]();if(_[_0x5788('0x2d')](_0x17016f,_0x3d2de3[_0x5788('0x2e')])){return;}var _0x12d888=_[_0x5788('0x2f')](_0x122959,[_0x5788('0x2c'),_0x3d2de3[_0x5788('0x2e')]])[_0x5788('0x30')];return db[_0x5788('0x31')]['destroy']({'where':{'type':_0x12d888,'resourceId':_0x3d2de3['id']}})['then'](function(){return _0x386d2e;});})[_0x5788('0x32')](function(){_0x26bb0f[_0x5788('0x1a')](0xcc)[_0x5788('0x19')]();});}};}function handleEntityNotFound(_0x5ebb22,_0x4b4334){return function(_0x23b96b){if(!_0x23b96b){_0x5ebb22[_0x5788('0x33')](0x194);}return _0x23b96b;};}function handleError(_0x14327e,_0x175ac1){_0x175ac1=_0x175ac1||0x1f4;return function(_0x27dfbb){logger[_0x5788('0x34')](_0x27dfbb[_0x5788('0x35')]);if(_0x27dfbb[_0x5788('0x30')]){delete _0x27dfbb['name'];}_0x14327e['status'](_0x175ac1)['send'](_0x27dfbb);};}exports[_0x5788('0x36')]=function(_0x5de143,_0x32a441){var _0x447c59={},_0x5234c3={},_0x32b5d8={'count':0x0,'rows':[]};var _0x5f0360=_[_0x5788('0x2b')](db['VoiceExtension'][_0x5788('0x37')],function(_0x1fecc5){return{'name':_0x1fecc5[_0x5788('0x38')],'type':_0x1fecc5[_0x5788('0x2e')][_0x5788('0x39')]};});_0x5234c3[_0x5788('0x3a')]=_[_0x5788('0x2b')](_0x5f0360,'name');_0x5234c3['query']=_[_0x5788('0x3b')](_0x5de143[_0x5788('0x3c')]);_0x5234c3[_0x5788('0x3d')]=_[_0x5788('0x3e')](_0x5234c3[_0x5788('0x3a')],_0x5234c3['query']);_0x447c59['attributes']=_[_0x5788('0x3e')](_0x5234c3['model'],qs[_0x5788('0x3f')](_0x5de143[_0x5788('0x3c')][_0x5788('0x3f')]));_0x447c59[_0x5788('0x40')]=_0x447c59[_0x5788('0x40')][_0x5788('0x41')]?_0x447c59[_0x5788('0x40')]:_0x5234c3['model'];if(!_0x5de143[_0x5788('0x3c')][_0x5788('0x42')](_0x5788('0x43'))){_0x447c59['limit']=qs[_0x5788('0x1e')](_0x5de143[_0x5788('0x3c')][_0x5788('0x1e')]);_0x447c59['offset']=qs['offset'](_0x5de143['query']['offset']);}_0x447c59[_0x5788('0x44')]=qs['sort'](_0x5de143[_0x5788('0x3c')]['sort']);_0x447c59[_0x5788('0x45')]=qs[_0x5788('0x3d')](_['pick'](_0x5de143[_0x5788('0x3c')],_0x5234c3[_0x5788('0x3d')]),_0x5f0360);if(_0x5de143[_0x5788('0x3c')][_0x5788('0x46')]){_0x447c59[_0x5788('0x45')]=_[_0x5788('0x47')](_0x447c59[_0x5788('0x45')],{'$or':_['map'](_0x5f0360,function(_0x262fd9){if(_0x262fd9['type']!==_0x5788('0x48')){var _0x4872d7={};_0x4872d7[_0x262fd9[_0x5788('0x30')]]={'$like':'%'+_0x5de143[_0x5788('0x3c')][_0x5788('0x46')]+'%'};return _0x4872d7;}})});}_0x447c59=_[_0x5788('0x47')]({},_0x447c59,_0x5de143[_0x5788('0x49')]);var _0x270439={'where':_0x447c59[_0x5788('0x45')]};return db[_0x5788('0x4a')][_0x5788('0x1d')](_0x270439)[_0x5788('0x32')](function(_0x24f554){_0x32b5d8[_0x5788('0x1d')]=_0x24f554;if(_0x5de143[_0x5788('0x3c')][_0x5788('0x4b')]){_0x447c59[_0x5788('0x4c')]=[{'all':!![]}];}return db[_0x5788('0x4a')][_0x5788('0x4d')](_0x447c59);})[_0x5788('0x32')](function(_0x1a5a20){_0x32b5d8[_0x5788('0x4e')]=_0x1a5a20;return _0x32b5d8;})['then'](respondWithFilteredResult(_0x32a441,_0x447c59))[_0x5788('0x4f')](handleError(_0x32a441,null));};exports[_0x5788('0x50')]=function(_0x2e5d06,_0x35d839){var _0x494dbe={'raw':![],'where':{'id':_0x2e5d06['params']['id']}},_0x5bca4b={};_0x5bca4b[_0x5788('0x3a')]=_['keys'](db['VoiceExtension'][_0x5788('0x37')]);_0x5bca4b['query']=_[_0x5788('0x3b')](_0x2e5d06[_0x5788('0x3c')]);_0x5bca4b[_0x5788('0x3d')]=_[_0x5788('0x3e')](_0x5bca4b[_0x5788('0x3a')],_0x5bca4b[_0x5788('0x3c')]);_0x494dbe['attributes']=_['intersection'](_0x5bca4b[_0x5788('0x3a')],qs[_0x5788('0x3f')](_0x2e5d06[_0x5788('0x3c')][_0x5788('0x3f')]));_0x494dbe['attributes']=_0x494dbe['attributes'][_0x5788('0x41')]?_0x494dbe[_0x5788('0x40')]:_0x5bca4b[_0x5788('0x3a')];if(_0x2e5d06['query'][_0x5788('0x4b')]){_0x494dbe[_0x5788('0x4c')]=[{'all':!![]}];}_0x494dbe=_[_0x5788('0x47')]({},_0x494dbe,_0x2e5d06[_0x5788('0x49')]);return db['VoiceExtension']['find'](_0x494dbe)['then'](handleEntityNotFound(_0x35d839,null))['then'](respondWithResult(_0x35d839,null))[_0x5788('0x4f')](handleError(_0x35d839,null));};exports['destroy']=function(_0x53dcea,_0x54d543){return db[_0x5788('0x4a')][_0x5788('0x2f')]({'where':{'id':_0x53dcea[_0x5788('0x51')]['id']}})[_0x5788('0x32')](handleEntityNotFound(_0x54d543,null))[_0x5788('0x32')](removeEntity(_0x54d543,null))[_0x5788('0x4f')](handleError(_0x54d543,null));};exports['create']=function(_0x56498,_0x4af229){if(_0x56498[_0x5788('0x52')][_0x5788('0x2e')]===_0x5788('0x27')&&!_[_0x5788('0x53')](_0x56498[_0x5788('0x52')]['exten'],'_')){_0x56498[_0x5788('0x52')]['exten']='_'[_0x5788('0x54')](_0x56498['body'][_0x5788('0x55')]);}return db[_0x5788('0x4a')][_0x5788('0x56')](_0x56498[_0x5788('0x52')],{'raw':![]})[_0x5788('0x32')](function(_0xaf52f8){var _0x52577c=_0x56498[_0x5788('0x57')][_0x5788('0x58')]({'plain':!![]});if(!_0x52577c)throw new Error(_0x5788('0x59'));if(_0x52577c[_0x5788('0x5a')]===_0x5788('0x57')){var _0x3f2c73=_0xaf52f8[_0x5788('0x58')]({'plain':!![]});var _0x1bb9e9=[{'name':_0x5788('0x24'),'value':'inbound'},{'name':_0x5788('0x26'),'value':_0x5788('0x27')},{'name':_0x5788('0x28'),'value':'internal'}];var _0x206da2=_[_0x5788('0x2f')](_0x1bb9e9,[_0x5788('0x2c'),_0x3f2c73[_0x5788('0x2e')]])[_0x5788('0x30')];return db[_0x5788('0x5b')][_0x5788('0x2f')]({'where':{'name':_0x206da2,'userProfileId':_0x52577c[_0x5788('0x5c')]},'raw':!![]})['then'](function(_0x50d7ee){if(_0x50d7ee&&_0x50d7ee[_0x5788('0x5d')]===0x0){return db[_0x5788('0x31')]['create']({'name':_0x3f2c73[_0x5788('0x30')],'resourceId':_0x3f2c73['id'],'type':_0x50d7ee[_0x5788('0x30')],'sectionId':_0x50d7ee['id']},{})[_0x5788('0x32')](function(){return _0xaf52f8;});}else{return _0xaf52f8;}})[_0x5788('0x4f')](function(_0x1a0613){logger[_0x5788('0x34')](_0x5788('0x5e'),_0x1a0613);throw _0x1a0613;});}return _0xaf52f8;})[_0x5788('0x32')](respondWithResult(_0x4af229,0xc9))['catch'](handleError(_0x4af229,null));};exports[_0x5788('0x5f')]=function(_0x3e8a68,_0x3e6fa6){if(_0x3e8a68[_0x5788('0x52')]['id']){delete _0x3e8a68[_0x5788('0x52')]['id'];}return db[_0x5788('0x4a')][_0x5788('0x2f')]({'where':{'id':_0x3e8a68[_0x5788('0x51')]['id']}})[_0x5788('0x32')](handleEntityNotFound(_0x3e6fa6,null))[_0x5788('0x32')](function(_0x1c15a9){if(_0x1c15a9){return db['VoiceExtension']['update'](_['pick'](_0x3e8a68[_0x5788('0x52')],[_0x5788('0x55'),_0x5788('0x60'),_0x5788('0x61'),'recordingFormat','cutdigits','mandatoryDisposition',_0x5788('0x62')]),{'where':{'context':_0x1c15a9[_0x5788('0x60')],'exten':_0x1c15a9['exten']},'individualHooks':!![]})[_0x5788('0x32')](function(_0x15ae0b){return _0x15ae0b;});}return null;})[_0x5788('0x32')](respondWithStatusCode(_0x3e6fa6,null))[_0x5788('0x4f')](handleError(_0x3e6fa6,null));};exports[_0x5788('0x63')]=function(_0x235d54,_0x51d6da){return db[_0x5788('0x4a')][_0x5788('0x64')]({'where':{'id':_0x235d54['params']['id']}})[_0x5788('0x32')](function(_0x37a61d){if(_0x37a61d){return db[_0x5788('0x65')]['transaction'](function(_0x5eba46){return db[_0x5788('0x4a')][_0x5788('0x23')]({'where':{'VoiceExtensionId':_0x235d54['params']['id']},'transaction':_0x5eba46})[_0x5788('0x32')](function(){var _0x40838f=_['map'](_0x235d54[_0x5788('0x52')],function(_0xfd0703){_0xfd0703[_0x5788('0x66')]=_0x235d54[_0x5788('0x51')]['id'];_0xfd0703['isApp']=!![];return _0xfd0703;});var _0x544f07=_0x235d54[_0x5788('0x3c')][_0x5788('0x67')]&&_0x235d54['query'][_0x5788('0x67')]['toLowerCase']()===_0x5788('0x68')?!![]:![];return _0x37a61d[_0x5788('0x69')](_0x40838f,_0x544f07);})[_0x5788('0x32')](function(_0x3bd4b3){return db[_0x5788('0x4a')]['bulkCreate'](_0x3bd4b3,{'transaction':_0x5eba46});});})[_0x5788('0x32')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x235d54[_0x5788('0x51')]['id']},'order':_0x5788('0x6a')});});}})[_0x5788('0x32')](respondWithResult(_0x51d6da,null))['catch'](handleError(_0x51d6da,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 82143fd..3773fdc 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 _0x66fb=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x66fb,0x116));var _0xb66f=function(_0x5a7fcf,_0x247b71){_0x5a7fcf=_0x5a7fcf-0x0;var _0x537148=_0x66fb[_0x5a7fcf];return _0x537148;};'use strict';var EventEmitter=require(_0xb66f('0x0'));var VoiceExtension=require(_0xb66f('0x1'))['db'][_0xb66f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb66f('0x3')](0x0);var events={'afterCreate':_0xb66f('0x4'),'afterUpdate':_0xb66f('0x5'),'afterDestroy':_0xb66f('0x6')};function emitEvent(_0x253e82){return function(_0x37c875,_0x15a083,_0x51e660){VoiceExtensionEvents[_0xb66f('0x7')](_0x253e82+':'+_0x37c875['id'],_0x37c875);VoiceExtensionEvents[_0xb66f('0x7')](_0x253e82,_0x37c875);_0x51e660(null);};}for(var e in events){if(events[_0xb66f('0x8')](e)){var event=events[e];VoiceExtension[_0xb66f('0x9')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x67e0=['save','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x11908c,_0x4550dd){var _0x3781b2=function(_0x1d034f){while(--_0x1d034f){_0x11908c['push'](_0x11908c['shift']());}};_0x3781b2(++_0x4550dd);}(_0x67e0,0x194));var _0x067e=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0x67e0[_0x102f97];return _0xd22058;};'use strict';var EventEmitter=require(_0x067e('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x067e('0x1')](0x0);var events={'afterCreate':_0x067e('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x29d7a4){return function(_0x137dd6,_0x3a37b2,_0x5dbd46){VoiceExtensionEvents['emit'](_0x29d7a4+':'+_0x137dd6['id'],_0x137dd6);VoiceExtensionEvents[_0x067e('0x3')](_0x29d7a4,_0x137dd6);_0x5dbd46(null);};}for(var e in events){if(events[_0x067e('0x4')](e)){var event=events[e];VoiceExtension[_0x067e('0x5')](e,emitEvent(event));}}module[_0x067e('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a9ff037..15d3bfc 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 _0x7f3b=['appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','Hangup','util','lodash','./voiceExtension.attributes','exports','models','CDR(type)=','type','context','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','param','split','phone','prefix','${EXTEN:','join','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','answer','queue','app'];(function(_0x1e4635,_0x589a9b){var _0x4a6dae=function(_0x3288dd){while(--_0x3288dd){_0x1e4635['push'](_0x1e4635['shift']());}};_0x4a6dae(++_0x589a9b);}(_0x7f3b,0xb5));var _0xb7f3=function(_0x52e3ba,_0x17f9c8){_0x52e3ba=_0x52e3ba-0x0;var _0xbc51e0=_0x7f3b[_0x52e3ba];return _0xbc51e0;};'use strict';var util=require(_0xb7f3('0x0'));var _=require(_0xb7f3('0x1'));var attributes=require(_0xb7f3('0x2'));module[_0xb7f3('0x3')]=function(_0x42dab0){var _0x1dbf72=_0x42dab0[_0xb7f3('0x4')];function _0x43226b(_0x23478b){var _0x553504=0x2;var _0x425639=[{'type':_0x23478b['type'],'app':'Set','appdata':_0xb7f3('0x5')+_0x23478b[_0xb7f3('0x6')],'context':_0x23478b[_0xb7f3('0x7')],'exten':_0x23478b['exten'],'priority':_0x553504++,'VoiceExtensionId':_0x23478b['id']},{'type':_0x23478b[_0xb7f3('0x6')],'app':_0x23478b[_0xb7f3('0x8')]?_0xb7f3('0x9'):_0xb7f3('0xa'),'appdata':_0x23478b[_0xb7f3('0x8')]?_0xb7f3('0xb')+_0x23478b[_0xb7f3('0x8')]:_0xb7f3('0xc'),'context':_0x23478b[_0xb7f3('0x7')],'exten':_0x23478b[_0xb7f3('0xd')],'priority':_0x553504++,'VoiceExtensionId':_0x23478b['id']}];if(_0x23478b['type']===_0xb7f3('0xe')){_0x425639['push']({'type':_0xb7f3('0xe'),'app':_0xb7f3('0x9'),'appdata':_0xb7f3('0xf')+_0x23478b['id'],'context':_0x23478b['context'],'exten':_0x23478b[_0xb7f3('0xd')],'priority':_0x553504++,'VoiceExtensionId':_0x23478b['id']});}_0x425639[_0xb7f3('0x10')]({'type':_0x23478b[_0xb7f3('0x6')],'app':_0xb7f3('0x9'),'appdata':_0xb7f3('0x11'),'context':_0x23478b[_0xb7f3('0x7')],'exten':_0x23478b[_0xb7f3('0xd')],'priority':_0x553504++,'VoiceExtensionId':_0x23478b['id']},{'type':_0x23478b[_0xb7f3('0x6')],'app':_0xb7f3('0x9'),'appdata':_0xb7f3('0x12'),'context':_0x23478b[_0xb7f3('0x7')],'exten':_0x23478b[_0xb7f3('0xd')],'priority':_0x553504++,'VoiceExtensionId':_0x23478b['id']},{'type':_0x23478b[_0xb7f3('0x6')],'app':_0xb7f3('0x9'),'appdata':'MONITOR_OPTIONS=ab','context':_0x23478b[_0xb7f3('0x7')],'exten':_0x23478b[_0xb7f3('0xd')],'priority':_0x553504++,'VoiceExtensionId':_0x23478b['id']});return _0x425639;}function _0x5e4fd5(_0x48e4e5){var _0x54510b=0x2;var _0x179e42=[{'type':_0xb7f3('0x13'),'app':_0xb7f3('0x9'),'appdata':_0xb7f3('0x14'),'context':_0x48e4e5[_0xb7f3('0x7')],'exten':_0x48e4e5[_0xb7f3('0xd')],'priority':_0x54510b++,'VoiceExtensionId':_0x48e4e5['id']},{'type':_0xb7f3('0x13'),'app':_0x48e4e5[_0xb7f3('0x8')]?_0xb7f3('0x9'):'NoOp','appdata':_0x48e4e5['alias']?_0xb7f3('0xb')+_0x48e4e5[_0xb7f3('0x8')]:'No\x20alias\x20set','context':_0x48e4e5[_0xb7f3('0x7')],'exten':_0x48e4e5['exten'],'priority':_0x54510b++,'VoiceExtensionId':_0x48e4e5['id']},{'type':_0xb7f3('0x13'),'app':_0xb7f3('0x9'),'appdata':_0xb7f3('0x15')+(_0x48e4e5[_0xb7f3('0x16')]?'${EXTEN:'+_0x48e4e5[_0xb7f3('0x16')]+'}':'${EXTEN}'),'context':_0x48e4e5['context'],'exten':_0x48e4e5[_0xb7f3('0xd')],'priority':_0x54510b++,'VoiceExtensionId':_0x48e4e5['id']},{'type':_0xb7f3('0x13'),'app':'Set','appdata':_0xb7f3('0xf')+_0x48e4e5['id'],'context':_0x48e4e5[_0xb7f3('0x7')],'exten':_0x48e4e5['exten'],'priority':_0x54510b++,'VoiceExtensionId':_0x48e4e5['id']},{'type':'outbound','app':'ExecIf','appdata':_0xb7f3('0x17')+(_0x54510b+0x2)+_0xb7f3('0x18')+(_0x54510b+0x1)+')','context':_0x48e4e5[_0xb7f3('0x7')],'exten':_0x48e4e5[_0xb7f3('0xd')],'priority':_0x54510b++,'VoiceExtensionId':_0x48e4e5['id']},{'type':_0xb7f3('0x13'),'app':'Set','appdata':_0x48e4e5[_0xb7f3('0x16')]?'CDR(prefix)=${EXTEN:0:'+_0x48e4e5[_0xb7f3('0x16')]+'}':_0xb7f3('0x19'),'context':_0x48e4e5[_0xb7f3('0x7')],'exten':_0x48e4e5['exten'],'priority':_0x54510b++,'VoiceExtensionId':_0x48e4e5['id']},{'type':_0xb7f3('0x13'),'app':_0xb7f3('0x9'),'appdata':_0xb7f3('0x11'),'context':_0x48e4e5[_0xb7f3('0x7')],'exten':_0x48e4e5[_0xb7f3('0xd')],'priority':_0x54510b++,'VoiceExtensionId':_0x48e4e5['id']},{'type':_0xb7f3('0x13'),'app':_0xb7f3('0x9'),'appdata':_0xb7f3('0x12'),'context':_0x48e4e5[_0xb7f3('0x7')],'exten':_0x48e4e5[_0xb7f3('0xd')],'priority':_0x54510b++,'VoiceExtensionId':_0x48e4e5['id']},{'type':_0xb7f3('0x13'),'app':'Set','appdata':_0xb7f3('0x1a'),'context':_0x48e4e5[_0xb7f3('0x7')],'exten':_0x48e4e5[_0xb7f3('0xd')],'priority':_0x54510b++,'VoiceExtensionId':_0x48e4e5['id']},{'type':'outbound','app':_0xb7f3('0x9'),'appdata':_0xb7f3('0x1b')+_0x48e4e5['id'],'context':_0x48e4e5[_0xb7f3('0x7')],'exten':_0x48e4e5[_0xb7f3('0xd')],'priority':_0x54510b++,'VoiceExtensionId':_0x48e4e5['id']}];if(_0x48e4e5[_0xb7f3('0x1c')]('recordingFormat')&&_0x48e4e5[_0xb7f3('0x1d')]!=='none'){_0x179e42[_0xb7f3('0x10')]({'type':_0xb7f3('0x13'),'app':_0xb7f3('0x9'),'appdata':_0xb7f3('0x1e'),'context':_0x48e4e5[_0xb7f3('0x7')],'exten':_0x48e4e5[_0xb7f3('0xd')],'priority':_0x54510b++,'VoiceExtensionId':_0x48e4e5['id']},{'type':_0xb7f3('0x13'),'app':_0xb7f3('0x9'),'appdata':_0xb7f3('0x1f')+_0x48e4e5[_0xb7f3('0x1d')]||_0xb7f3('0x20'),'context':_0x48e4e5[_0xb7f3('0x7')],'exten':_0x48e4e5[_0xb7f3('0xd')],'priority':_0x54510b++,'VoiceExtensionId':_0x48e4e5['id']});}return _0x179e42;}function _0x69a96(_0x29d3fa){var _0x3deb62=[{'name':_0xb7f3('0x21'),'param':0x0},{'name':_0xb7f3('0x22'),'param':0x1},{'name':_0xb7f3('0x23'),'param':0x2},{'name':_0xb7f3('0x24'),'param':0x3}];var _0x50ed4b={};var _0x2f142a=_0x29d3fa['split'](',');var _0x2c2a1d=[];for(var _0x2e404a=0x0;_0x2e404a<_0x3deb62['length'];_0x2e404a++){switch(_0x3deb62[_0x2e404a]['name']){case'trunk':_0x50ed4b['trunk']=_0x2f142a[_0x3deb62[_0x2e404a][_0xb7f3('0x25')]][_0xb7f3('0x26')]('/')[0x1];_0x50ed4b[_0xb7f3('0x27')]=_0x2f142a[_0x3deb62[_0x2e404a]['param']][_0xb7f3('0x26')]('/')[0x2];_0x50ed4b[_0xb7f3('0x28')]=_0x50ed4b[_0xb7f3('0x27')]?_0x50ed4b[_0xb7f3('0x27')][_0xb7f3('0x26')]('$')[0x0]:undefined;_0x50ed4b[_0xb7f3('0x27')]=route[_0xb7f3('0x16')]?(_0x50ed4b[_0xb7f3('0x28')]||'')+_0xb7f3('0x29')+route[_0xb7f3('0x16')]+'}':(_0x50ed4b['prefix']||'')+'${EXTEN}';_0x2c2a1d[_0x3deb62[_0x2e404a]['param']]=['SIP',_0x50ed4b[_0xb7f3('0x21')],_0x50ed4b[_0xb7f3('0x27')]][_0xb7f3('0x2a')]('/');break;case _0xb7f3('0x23'):_0x50ed4b['options']=_0x2f142a[_0x3deb62[_0x2e404a][_0xb7f3('0x25')]];if(route[_0xb7f3('0x1d')]!=='none'){if(_0x50ed4b[_0xb7f3('0x23')][_0xb7f3('0x2b')](_0xb7f3('0x2c'))<0x0){_0x50ed4b[_0xb7f3('0x23')]+=_0xb7f3('0x2c');}}else{_0x50ed4b[_0xb7f3('0x23')]=_0x50ed4b[_0xb7f3('0x23')]['replace']('U(xcally-mixmonitor-context)','');}_0x2c2a1d[_0x3deb62[_0x2e404a][_0xb7f3('0x25')]]=_0x50ed4b['options'];break;default:_0x2c2a1d[_0x3deb62[_0x2e404a][_0xb7f3('0x25')]]=_0x2f142a[_0x3deb62[_0x2e404a]['param']];}}return _0x2c2a1d[_0xb7f3('0x2a')](',');}function _0x494e00(_0x4699c1,_0x5c5ac2,_0x448aff,_0x30bb37){return new Promise(function(_0x3a01b0,_0x28dc66){var _0x122032=[];if(_['isEmpty'](_0x5c5ac2))return _0x3a01b0(_0x122032);_0x1dbf72[_0xb7f3('0x2d')][_0xb7f3('0x2e')]({'attributes':['id',_0xb7f3('0x2f'),_0xb7f3('0x30')],'raw':!![]})[_0xb7f3('0x31')](function(_0x4772b0){for(var _0x26f1db=0x0,_0x5a58d4=0x0;_0x26f1db<_0x5c5ac2[_0xb7f3('0x32')];_0x26f1db++,_0x5a58d4=0x0){var _0x3bfa03=_0x5c5ac2[_0x26f1db];var _0x4122bf=[];var _0x5bcc8f=[];if(_0x3bfa03[_0xb7f3('0x2f')]!==_0xb7f3('0x33')){_0x3bfa03['intervals']=[_0x3bfa03[_0xb7f3('0x2f')]];}else{_0x3bfa03[_0xb7f3('0x34')]=_0x3bfa03[_0xb7f3('0x30')]?_[_0xb7f3('0x35')](_[_0xb7f3('0x36')](_0x4772b0,{'IntervalId':_0x3bfa03[_0xb7f3('0x30')]}),_0xb7f3('0x2f')):[];}_0x3bfa03[_0xb7f3('0x7')]=_0x4699c1['context'];_0x3bfa03[_0xb7f3('0xd')]=_0x4699c1[_0xb7f3('0xd')];if(_0x3bfa03['type'])_0x3bfa03[_0xb7f3('0x6')]=_0x3bfa03[_0xb7f3('0x6')][_0xb7f3('0x37')]();if(_0x4699c1[_0xb7f3('0x6')]===_0xb7f3('0x13')){if(_0x3bfa03[_0xb7f3('0x1c')]('tag')&&_0x3bfa03[_0xb7f3('0x38')]&&_0x3bfa03[_0xb7f3('0x38')]!=='--'){_0x4122bf[_0xb7f3('0x10')]({'type':_0x3bfa03['type']['toLowerCase'](),'app':_0xb7f3('0x9'),'appdata':_0xb7f3('0x39')+_0x3bfa03[_0xb7f3('0x38')],'context':_0x4699c1['context'],'exten':_0x4699c1[_0xb7f3('0xd')],'priority':_0x3bfa03[_0xb7f3('0x34')]['length']+_0x448aff+_0x5a58d4++,'VoiceExtensionId':_0x4699c1['id']});}_0x4122bf[_0xb7f3('0x10')]({'type':_0x3bfa03[_0xb7f3('0x6')][_0xb7f3('0x37')](),'app':_0xb7f3('0x3a'),'appdata':_0xb7f3('0x3b')+(_0x3bfa03['callerID']?_0xb7f3('0x3c')+_0x3bfa03[_0xb7f3('0x3d')]+')':'NoOp(No\x20number\x20available)'),'context':_0x4699c1[_0xb7f3('0x7')],'exten':_0x4699c1['exten'],'priority':_0x3bfa03[_0xb7f3('0x34')]['length']+_0x448aff+_0x5a58d4++,'VoiceExtensionId':_0x4699c1['id']});}else{if(_0x3bfa03[_0xb7f3('0x1c')](_0xb7f3('0x3e'))){if([_0xb7f3('0x3f'),'playback']['includes'](_0x3bfa03[_0xb7f3('0x40')][_0xb7f3('0x37')]())&&_0x3bfa03[_0xb7f3('0x41')]!==_0xb7f3('0x42')){if(_0x3bfa03[_0xb7f3('0x3e')]){_0x4122bf[_0xb7f3('0x10')]({'type':_0x3bfa03[_0xb7f3('0x6')][_0xb7f3('0x37')](),'app':_0xb7f3('0x3a'),'appdata':_0xb7f3('0x43'),'context':_0x4699c1[_0xb7f3('0x7')],'exten':_0x4699c1['exten'],'priority':_0x3bfa03[_0xb7f3('0x34')][_0xb7f3('0x32')]+_0x448aff+_0x5a58d4++,'VoiceExtensionId':_0x4699c1['id']});_0x4122bf[_0xb7f3('0x10')]({'type':_0x3bfa03['type'][_0xb7f3('0x37')](),'app':_0xb7f3('0x9'),'appdata':_0xb7f3('0x44'),'context':_0x4699c1[_0xb7f3('0x7')],'exten':_0x4699c1['exten'],'priority':_0x3bfa03['intervals'][_0xb7f3('0x32')]+_0x448aff+_0x5a58d4++,'VoiceExtensionId':_0x4699c1['id']});}else{_0x4122bf[_0xb7f3('0x10')]({'type':_0x3bfa03['type']['toLowerCase'](),'app':'ExecIf','appdata':_0xb7f3('0x45'),'context':_0x4699c1[_0xb7f3('0x7')],'exten':_0x4699c1[_0xb7f3('0xd')],'priority':_0x3bfa03[_0xb7f3('0x34')][_0xb7f3('0x32')]+_0x448aff+_0x5a58d4++,'VoiceExtensionId':_0x4699c1['id']});_0x4122bf[_0xb7f3('0x10')]({'type':_0x3bfa03[_0xb7f3('0x6')][_0xb7f3('0x37')](),'app':'Set','appdata':_0xb7f3('0x46'),'context':_0x4699c1[_0xb7f3('0x7')],'exten':_0x4699c1['exten'],'priority':_0x3bfa03[_0xb7f3('0x34')][_0xb7f3('0x32')]+_0x448aff+_0x5a58d4++,'VoiceExtensionId':_0x4699c1['id']});}}}}for(var _0x214f70=0x0;_0x214f70<_0x3bfa03['intervals']['length'];_0x214f70++){var _0x39bb1c=_0x448aff+_0x3bfa03[_0xb7f3('0x34')][_0xb7f3('0x32')];var _0x216d9c=_0x214f70===_0x3bfa03[_0xb7f3('0x34')][_0xb7f3('0x32')]-0x1?_0x448aff+_0x4122bf['length']+_0x5bcc8f[_0xb7f3('0x32')]+0x2:_0x448aff+_0x214f70+0x1;_0x4122bf['splice'](_0x214f70,0x0,{'type':_0x4699c1[_0xb7f3('0x6')],'app':_0xb7f3('0x47'),'appdata':_0x3bfa03[_0xb7f3('0x34')][_0x214f70]+'?'+_0x4699c1['context']+_0xb7f3('0x48')+_0x39bb1c+':'+_0x4699c1[_0xb7f3('0x7')]+',${EXTEN},'+_0x216d9c,'exten':_0x4699c1['exten'],'context':_0x4699c1[_0xb7f3('0x7')],'priority':_0x448aff+_0x214f70,'VoiceExtensionId':_0x4699c1['id']});}if(_0x30bb37&&_0x3bfa03[_0xb7f3('0x41')]===_0xb7f3('0x49'))_0x3bfa03[_0xb7f3('0x4a')]=_0x69a96(_0x3bfa03[_0xb7f3('0x4a')]);_0x3bfa03[_0xb7f3('0x4b')]=_0x4122bf['length']?_[_0xb7f3('0x4c')](_0x4122bf)[_0xb7f3('0x4b')]+0x1:_0x448aff;_0x122032=_[_0xb7f3('0x4d')](_0x122032,_0x4122bf,[_0x3bfa03],_0x5bcc8f);_0x448aff=_[_0xb7f3('0x4c')](_0x122032)['priority']+0x1;}return _0x3a01b0(_0x122032);})[_0xb7f3('0x4e')](function(_0xb0875e){_0x28dc66(_0xb0875e);});});}return _0x42dab0[_0xb7f3('0x4f')](_0xb7f3('0x50'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4a6ec9,_0x4ec0ec){var _0x1f16e1=this;var _0x946f85=_0x1f16e1[_0xb7f3('0x6')]===_0xb7f3('0x13')?_0x5e4fd5(_0x1f16e1):_0x43226b(_0x1f16e1);return _0x494e00(_0x1f16e1,_0x4a6ec9,_[_0xb7f3('0x4c')](_0x946f85)['priority']+0x1,_0x4ec0ec)[_0xb7f3('0x31')](function(_0x3b7773){var _0x2385fd=_[_0xb7f3('0x4d')](_0x946f85,_0x3b7773);_0x2385fd['push']({'type':_0x1f16e1[_0xb7f3('0x6')],'app':_0xb7f3('0x51'),'exten':_0x1f16e1[_0xb7f3('0xd')],'context':_0x1f16e1['context'],'priority':_['last'](_0x2385fd)['priority']+0x1,'VoiceExtensionId':_0x1f16e1['id']});return _0x2385fd;});}}});}; \ No newline at end of file +var _0xad8e=['Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','length','param','split','phone','prefix','${EXTEN}','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','map','filter','toLowerCase','tag','CDR(tag)=','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch'];(function(_0x11b4fb,_0x10c784){var _0x56cbb5=function(_0x56d812){while(--_0x56d812){_0x11b4fb['push'](_0x11b4fb['shift']());}};_0x56cbb5(++_0x10c784);}(_0xad8e,0x155));var _0xead8=function(_0x150bc2,_0x12d085){_0x150bc2=_0x150bc2-0x0;var _0x5c32b6=_0xad8e[_0x150bc2];return _0x5c32b6;};'use strict';var util=require('util');var _=require(_0xead8('0x0'));var attributes=require(_0xead8('0x1'));module[_0xead8('0x2')]=function(_0x2520a2){var _0x4a9d15=_0x2520a2['models'];function _0x44471a(_0xc7631f){var _0xd03db8=0x2;var _0x4be2be=[{'type':_0xc7631f[_0xead8('0x3')],'app':_0xead8('0x4'),'appdata':_0xead8('0x5')+_0xc7631f[_0xead8('0x3')],'context':_0xc7631f[_0xead8('0x6')],'exten':_0xc7631f[_0xead8('0x7')],'priority':_0xd03db8++,'VoiceExtensionId':_0xc7631f['id']},{'type':_0xc7631f[_0xead8('0x3')],'app':_0xc7631f[_0xead8('0x8')]?_0xead8('0x4'):_0xead8('0x9'),'appdata':_0xc7631f[_0xead8('0x8')]?_0xead8('0xa')+_0xc7631f[_0xead8('0x8')]:_0xead8('0xb'),'context':_0xc7631f[_0xead8('0x6')],'exten':_0xc7631f['exten'],'priority':_0xd03db8++,'VoiceExtensionId':_0xc7631f['id']}];if(_0xc7631f[_0xead8('0x3')]===_0xead8('0xc')){_0x4be2be[_0xead8('0xd')]({'type':_0xead8('0xc'),'app':_0xead8('0x4'),'appdata':_0xead8('0xe')+_0xc7631f['id'],'context':_0xc7631f[_0xead8('0x6')],'exten':_0xc7631f[_0xead8('0x7')],'priority':_0xd03db8++,'VoiceExtensionId':_0xc7631f['id']});}_0x4be2be[_0xead8('0xd')]({'type':_0xc7631f[_0xead8('0x3')],'app':_0xead8('0x4'),'appdata':_0xead8('0xf'),'context':_0xc7631f[_0xead8('0x6')],'exten':_0xc7631f[_0xead8('0x7')],'priority':_0xd03db8++,'VoiceExtensionId':_0xc7631f['id']},{'type':_0xc7631f['type'],'app':_0xead8('0x4'),'appdata':_0xead8('0x10'),'context':_0xc7631f[_0xead8('0x6')],'exten':_0xc7631f[_0xead8('0x7')],'priority':_0xd03db8++,'VoiceExtensionId':_0xc7631f['id']},{'type':_0xc7631f[_0xead8('0x3')],'app':'Set','appdata':_0xead8('0x11'),'context':_0xc7631f[_0xead8('0x6')],'exten':_0xc7631f[_0xead8('0x7')],'priority':_0xd03db8++,'VoiceExtensionId':_0xc7631f['id']});return _0x4be2be;}function _0x1f2110(_0x2e4034){var _0x1a0b25=0x2;var _0x103c13=[{'type':_0xead8('0x12'),'app':_0xead8('0x4'),'appdata':_0xead8('0x13'),'context':_0x2e4034[_0xead8('0x6')],'exten':_0x2e4034[_0xead8('0x7')],'priority':_0x1a0b25++,'VoiceExtensionId':_0x2e4034['id']},{'type':_0xead8('0x12'),'app':_0x2e4034[_0xead8('0x8')]?_0xead8('0x4'):_0xead8('0x9'),'appdata':_0x2e4034[_0xead8('0x8')]?_0xead8('0xa')+_0x2e4034['alias']:'No\x20alias\x20set','context':_0x2e4034['context'],'exten':_0x2e4034[_0xead8('0x7')],'priority':_0x1a0b25++,'VoiceExtensionId':_0x2e4034['id']},{'type':_0xead8('0x12'),'app':_0xead8('0x4'),'appdata':_0xead8('0x14')+(_0x2e4034[_0xead8('0x15')]?_0xead8('0x16')+_0x2e4034[_0xead8('0x15')]+'}':'${EXTEN}'),'context':_0x2e4034['context'],'exten':_0x2e4034[_0xead8('0x7')],'priority':_0x1a0b25++,'VoiceExtensionId':_0x2e4034['id']},{'type':_0xead8('0x12'),'app':'Set','appdata':_0xead8('0xe')+_0x2e4034['id'],'context':_0x2e4034[_0xead8('0x6')],'exten':_0x2e4034['exten'],'priority':_0x1a0b25++,'VoiceExtensionId':_0x2e4034['id']},{'type':_0xead8('0x12'),'app':_0xead8('0x17'),'appdata':_0xead8('0x18')+(_0x1a0b25+0x2)+_0xead8('0x19')+(_0x1a0b25+0x1)+')','context':_0x2e4034['context'],'exten':_0x2e4034[_0xead8('0x7')],'priority':_0x1a0b25++,'VoiceExtensionId':_0x2e4034['id']},{'type':'outbound','app':_0xead8('0x4'),'appdata':_0x2e4034[_0xead8('0x15')]?_0xead8('0x1a')+_0x2e4034[_0xead8('0x15')]+'}':_0xead8('0x1b'),'context':_0x2e4034['context'],'exten':_0x2e4034['exten'],'priority':_0x1a0b25++,'VoiceExtensionId':_0x2e4034['id']},{'type':_0xead8('0x12'),'app':'Set','appdata':_0xead8('0xf'),'context':_0x2e4034['context'],'exten':_0x2e4034[_0xead8('0x7')],'priority':_0x1a0b25++,'VoiceExtensionId':_0x2e4034['id']},{'type':_0xead8('0x12'),'app':_0xead8('0x4'),'appdata':_0xead8('0x10'),'context':_0x2e4034[_0xead8('0x6')],'exten':_0x2e4034['exten'],'priority':_0x1a0b25++,'VoiceExtensionId':_0x2e4034['id']},{'type':_0xead8('0x12'),'app':_0xead8('0x4'),'appdata':_0xead8('0x11'),'context':_0x2e4034[_0xead8('0x6')],'exten':_0x2e4034[_0xead8('0x7')],'priority':_0x1a0b25++,'VoiceExtensionId':_0x2e4034['id']},{'type':_0xead8('0x12'),'app':_0xead8('0x4'),'appdata':'outboundrouteid='+_0x2e4034['id'],'context':_0x2e4034[_0xead8('0x6')],'exten':_0x2e4034['exten'],'priority':_0x1a0b25++,'VoiceExtensionId':_0x2e4034['id']}];if(_0x2e4034[_0xead8('0x1c')](_0xead8('0x1d'))&&_0x2e4034['recordingFormat']!==_0xead8('0x1e')){_0x103c13[_0xead8('0xd')]({'type':_0xead8('0x12'),'app':_0xead8('0x4'),'appdata':_0xead8('0x1f'),'context':_0x2e4034[_0xead8('0x6')],'exten':_0x2e4034['exten'],'priority':_0x1a0b25++,'VoiceExtensionId':_0x2e4034['id']},{'type':'outbound','app':_0xead8('0x4'),'appdata':_0xead8('0x20')+_0x2e4034[_0xead8('0x1d')]||_0xead8('0x21'),'context':_0x2e4034[_0xead8('0x6')],'exten':_0x2e4034[_0xead8('0x7')],'priority':_0x1a0b25++,'VoiceExtensionId':_0x2e4034['id']});}return _0x103c13;}function _0x1c3c08(_0x41c767){var _0x9ff715=[{'name':_0xead8('0x22'),'param':0x0},{'name':_0xead8('0x23'),'param':0x1},{'name':_0xead8('0x24'),'param':0x2},{'name':'url','param':0x3}];var _0x3293c6={};var _0x2ee40e=_0x41c767['split'](',');var _0x12d4ce=[];for(var _0x40b41f=0x0;_0x40b41f<_0x9ff715[_0xead8('0x25')];_0x40b41f++){switch(_0x9ff715[_0x40b41f]['name']){case _0xead8('0x22'):_0x3293c6[_0xead8('0x22')]=_0x2ee40e[_0x9ff715[_0x40b41f][_0xead8('0x26')]][_0xead8('0x27')]('/')[0x1];_0x3293c6[_0xead8('0x28')]=_0x2ee40e[_0x9ff715[_0x40b41f]['param']][_0xead8('0x27')]('/')[0x2];_0x3293c6[_0xead8('0x29')]=_0x3293c6[_0xead8('0x28')]?_0x3293c6[_0xead8('0x28')][_0xead8('0x27')]('$')[0x0]:undefined;_0x3293c6[_0xead8('0x28')]=route[_0xead8('0x15')]?(_0x3293c6[_0xead8('0x29')]||'')+'${EXTEN:'+route[_0xead8('0x15')]+'}':(_0x3293c6[_0xead8('0x29')]||'')+_0xead8('0x2a');_0x12d4ce[_0x9ff715[_0x40b41f][_0xead8('0x26')]]=['SIP',_0x3293c6['trunk'],_0x3293c6[_0xead8('0x28')]][_0xead8('0x2b')]('/');break;case _0xead8('0x24'):_0x3293c6[_0xead8('0x24')]=_0x2ee40e[_0x9ff715[_0x40b41f][_0xead8('0x26')]];if(route[_0xead8('0x1d')]!==_0xead8('0x1e')){if(_0x3293c6[_0xead8('0x24')][_0xead8('0x2c')](_0xead8('0x2d'))<0x0){_0x3293c6['options']+='U(xcally-mixmonitor-context)';}}else{_0x3293c6[_0xead8('0x24')]=_0x3293c6['options'][_0xead8('0x2e')](_0xead8('0x2d'),'');}_0x12d4ce[_0x9ff715[_0x40b41f]['param']]=_0x3293c6['options'];break;default:_0x12d4ce[_0x9ff715[_0x40b41f]['param']]=_0x2ee40e[_0x9ff715[_0x40b41f][_0xead8('0x26')]];}}return _0x12d4ce['join'](',');}function _0x4f0c15(_0x2519e2,_0x1360ce,_0x54c1e4,_0x357086){return new Promise(function(_0x8d1420,_0x176759){var _0x554542=[];if(_[_0xead8('0x2f')](_0x1360ce))return _0x8d1420(_0x554542);_0x4a9d15[_0xead8('0x30')][_0xead8('0x31')]({'attributes':['id',_0xead8('0x32'),_0xead8('0x33')],'raw':!![]})[_0xead8('0x34')](function(_0x4d029b){for(var _0x535f77=0x0,_0x3b1a4b=0x0;_0x535f77<_0x1360ce[_0xead8('0x25')];_0x535f77++,_0x3b1a4b=0x0){var _0x35119c=_0x1360ce[_0x535f77];var _0x13d6d1=[];var _0x6efc33=[];if(_0x35119c[_0xead8('0x32')]!==_0xead8('0x35')){_0x35119c['intervals']=[_0x35119c[_0xead8('0x32')]];}else{_0x35119c['intervals']=_0x35119c[_0xead8('0x33')]?_[_0xead8('0x36')](_[_0xead8('0x37')](_0x4d029b,{'IntervalId':_0x35119c['IntervalId']}),_0xead8('0x32')):[];}_0x35119c['context']=_0x2519e2[_0xead8('0x6')];_0x35119c[_0xead8('0x7')]=_0x2519e2[_0xead8('0x7')];if(_0x35119c[_0xead8('0x3')])_0x35119c[_0xead8('0x3')]=_0x35119c[_0xead8('0x3')][_0xead8('0x38')]();if(_0x2519e2[_0xead8('0x3')]===_0xead8('0x12')){if(_0x35119c['hasOwnProperty']('tag')&&_0x35119c[_0xead8('0x39')]&&_0x35119c[_0xead8('0x39')]!=='--'){_0x13d6d1['push']({'type':_0x35119c[_0xead8('0x3')]['toLowerCase'](),'app':_0xead8('0x4'),'appdata':_0xead8('0x3a')+_0x35119c['tag'],'context':_0x2519e2['context'],'exten':_0x2519e2[_0xead8('0x7')],'priority':_0x35119c[_0xead8('0x3b')]['length']+_0x54c1e4+_0x3b1a4b++,'VoiceExtensionId':_0x2519e2['id']});}_0x13d6d1[_0xead8('0xd')]({'type':_0x35119c[_0xead8('0x3')][_0xead8('0x38')](),'app':_0xead8('0x17'),'appdata':_0xead8('0x3c')+(_0x35119c[_0xead8('0x3d')]?_0xead8('0x3e')+_0x35119c['callerID']+')':_0xead8('0x3f')),'context':_0x2519e2['context'],'exten':_0x2519e2['exten'],'priority':_0x35119c[_0xead8('0x3b')][_0xead8('0x25')]+_0x54c1e4+_0x3b1a4b++,'VoiceExtensionId':_0x2519e2['id']});}else{if(_0x35119c['hasOwnProperty']('answer')){if([_0xead8('0x40'),_0xead8('0x41')][_0xead8('0x42')](_0x35119c[_0xead8('0x43')][_0xead8('0x38')]())&&_0x35119c['appType']!==_0xead8('0x44')){if(_0x35119c[_0xead8('0x45')]){_0x13d6d1[_0xead8('0xd')]({'type':_0x35119c[_0xead8('0x3')]['toLowerCase'](),'app':_0xead8('0x17'),'appdata':_0xead8('0x46'),'context':_0x2519e2[_0xead8('0x6')],'exten':_0x2519e2['exten'],'priority':_0x35119c[_0xead8('0x3b')]['length']+_0x54c1e4+_0x3b1a4b++,'VoiceExtensionId':_0x2519e2['id']});_0x13d6d1[_0xead8('0xd')]({'type':_0x35119c['type'][_0xead8('0x38')](),'app':'Set','appdata':_0xead8('0x47'),'context':_0x2519e2[_0xead8('0x6')],'exten':_0x2519e2[_0xead8('0x7')],'priority':_0x35119c[_0xead8('0x3b')]['length']+_0x54c1e4+_0x3b1a4b++,'VoiceExtensionId':_0x2519e2['id']});}else{_0x13d6d1['push']({'type':_0x35119c['type']['toLowerCase'](),'app':_0xead8('0x17'),'appdata':_0xead8('0x48'),'context':_0x2519e2['context'],'exten':_0x2519e2[_0xead8('0x7')],'priority':_0x35119c[_0xead8('0x3b')][_0xead8('0x25')]+_0x54c1e4+_0x3b1a4b++,'VoiceExtensionId':_0x2519e2['id']});_0x13d6d1['push']({'type':_0x35119c[_0xead8('0x3')]['toLowerCase'](),'app':_0xead8('0x4'),'appdata':_0xead8('0x49'),'context':_0x2519e2[_0xead8('0x6')],'exten':_0x2519e2['exten'],'priority':_0x35119c['intervals']['length']+_0x54c1e4+_0x3b1a4b++,'VoiceExtensionId':_0x2519e2['id']});}}}}for(var _0x4e336d=0x0;_0x4e336d<_0x35119c[_0xead8('0x3b')]['length'];_0x4e336d++){var _0x2f8190=_0x54c1e4+_0x35119c['intervals'][_0xead8('0x25')];var _0x1515c7=_0x4e336d===_0x35119c['intervals'][_0xead8('0x25')]-0x1?_0x54c1e4+_0x13d6d1['length']+_0x6efc33[_0xead8('0x25')]+0x2:_0x54c1e4+_0x4e336d+0x1;_0x13d6d1[_0xead8('0x4a')](_0x4e336d,0x0,{'type':_0x2519e2[_0xead8('0x3')],'app':_0xead8('0x4b'),'appdata':_0x35119c[_0xead8('0x3b')][_0x4e336d]+'?'+_0x2519e2['context']+_0xead8('0x4c')+_0x2f8190+':'+_0x2519e2[_0xead8('0x6')]+',${EXTEN},'+_0x1515c7,'exten':_0x2519e2['exten'],'context':_0x2519e2[_0xead8('0x6')],'priority':_0x54c1e4+_0x4e336d,'VoiceExtensionId':_0x2519e2['id']});}if(_0x357086&&_0x35119c[_0xead8('0x4d')]===_0xead8('0x4e'))_0x35119c[_0xead8('0x4f')]=_0x1c3c08(_0x35119c[_0xead8('0x4f')]);_0x35119c[_0xead8('0x50')]=_0x13d6d1[_0xead8('0x25')]?_[_0xead8('0x51')](_0x13d6d1)[_0xead8('0x50')]+0x1:_0x54c1e4;_0x554542=_[_0xead8('0x52')](_0x554542,_0x13d6d1,[_0x35119c],_0x6efc33);_0x54c1e4=_[_0xead8('0x51')](_0x554542)['priority']+0x1;}return _0x8d1420(_0x554542);})[_0xead8('0x53')](function(_0x48541d){_0x176759(_0x48541d);});});}return _0x2520a2['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3e4f27,_0x331479){var _0x13cb0c=this;var _0x5590bf=_0x13cb0c['type']===_0xead8('0x12')?_0x1f2110(_0x13cb0c):_0x44471a(_0x13cb0c);return _0x4f0c15(_0x13cb0c,_0x3e4f27,_[_0xead8('0x51')](_0x5590bf)[_0xead8('0x50')]+0x1,_0x331479)[_0xead8('0x34')](function(_0x50b3e8){var _0x3952bc=_[_0xead8('0x52')](_0x5590bf,_0x50b3e8);_0x3952bc[_0xead8('0xd')]({'type':_0x13cb0c['type'],'app':_0xead8('0x54'),'exten':_0x13cb0c['exten'],'context':_0x13cb0c['context'],'priority':_[_0xead8('0x51')](_0x3952bc)['priority']+0x1,'VoiceExtensionId':_0x13cb0c['id']});return _0x3952bc;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index ef5c88a..100628b 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 _0xdc59=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','findAll','options','where','attributes','limit','include','model','map','GetVoiceExtension','lodash','util','moment','ioredis'];(function(_0x1e2cc9,_0x4454e0){var _0x3075f9=function(_0x2832d1){while(--_0x2832d1){_0x1e2cc9['push'](_0x1e2cc9['shift']());}};_0x3075f9(++_0x4454e0);}(_0xdc59,0x12c));var _0x9dc5=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xdc59[_0x35da42];return _0x370035;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var moment=require(_0x9dc5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dc5('0x3'));var db=require(_0x9dc5('0x4'))['db'];var utils=require(_0x9dc5('0x5'));var logger=require(_0x9dc5('0x6'))(_0x9dc5('0x7'));var config=require(_0x9dc5('0x8'));var jayson=require(_0x9dc5('0x9'));var client=jayson[_0x9dc5('0xa')][_0x9dc5('0xb')]({'port':0x232a});config['redis']=_[_0x9dc5('0xc')](config[_0x9dc5('0xd')],{'host':_0x9dc5('0xe'),'port':0x18eb});var socket=require(_0x9dc5('0xf'))(new Redis(config[_0x9dc5('0xd')]));require(_0x9dc5('0x10'))[_0x9dc5('0x11')](socket);function respondWithRpcPromise(_0x15cebe,_0x13d604,_0x32c99b){return new BPromise(function(_0x5abb32,_0x163e06){return client[_0x9dc5('0x12')](_0x15cebe,_0x32c99b)[_0x9dc5('0x13')](function(_0x455164){logger['info'](_0x9dc5('0x14'),_0x13d604,_0x9dc5('0x15'));logger[_0x9dc5('0x16')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x13d604,_0x9dc5('0x15'),JSON[_0x9dc5('0x17')](_0x455164));if(_0x455164[_0x9dc5('0x18')]){if(_0x455164[_0x9dc5('0x18')][_0x9dc5('0x19')]===0x1f4){logger[_0x9dc5('0x18')](_0x9dc5('0x14'),_0x13d604,_0x455164[_0x9dc5('0x18')][_0x9dc5('0x1a')]);return _0x163e06(_0x455164[_0x9dc5('0x18')]['message']);}logger[_0x9dc5('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x13d604,_0x455164[_0x9dc5('0x18')][_0x9dc5('0x1a')]);return _0x5abb32(_0x455164['error'][_0x9dc5('0x1a')]);}else{logger[_0x9dc5('0x1b')](_0x9dc5('0x14'),_0x13d604,_0x9dc5('0x15'));_0x5abb32(_0x455164['result'][_0x9dc5('0x1a')]);}})[_0x9dc5('0x1c')](function(_0x410929){logger[_0x9dc5('0x18')](_0x9dc5('0x14'),_0x13d604,_0x410929);_0x163e06(_0x410929);});});}exports['GetVoiceExtension']=function(_0x6355d2){var _0x39aa04=this;return new Promise(function(_0x8e7b1c,_0x4e6388){return db['VoiceExtension'][_0x9dc5('0x1d')]({'raw':_0x6355d2['options']?_0x6355d2[_0x9dc5('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x6355d2[_0x9dc5('0x1e')]?_0x6355d2['options'][_0x9dc5('0x1f')]||null:null,'attributes':_0x6355d2['options']?_0x6355d2[_0x9dc5('0x1e')][_0x9dc5('0x20')]||null:null,'limit':_0x6355d2[_0x9dc5('0x1e')]?_0x6355d2['options'][_0x9dc5('0x21')]||null:null,'include':_0x6355d2[_0x9dc5('0x1e')]?_0x6355d2[_0x9dc5('0x1e')][_0x9dc5('0x22')]?_['map'](_0x6355d2['options'][_0x9dc5('0x22')],function(_0xf6da02){return{'model':db[_0xf6da02[_0x9dc5('0x23')]],'as':_0xf6da02['as'],'attributes':_0xf6da02[_0x9dc5('0x20')],'include':_0xf6da02['include']?_['map'](_0xf6da02[_0x9dc5('0x22')],function(_0x427cc3){return{'model':db[_0x427cc3['model']],'as':_0x427cc3['as'],'attributes':_0x427cc3[_0x9dc5('0x20')],'include':_0x427cc3[_0x9dc5('0x22')]?_[_0x9dc5('0x24')](_0x427cc3['include'],function(_0x4777f0){return{'model':db[_0x4777f0[_0x9dc5('0x23')]],'as':_0x4777f0['as'],'attributes':_0x4777f0[_0x9dc5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9dc5('0x13')](function(_0x3659a6){logger[_0x9dc5('0x1b')]('GetVoiceExtension',_0x6355d2);logger[_0x9dc5('0x16')](_0x9dc5('0x25'),_0x6355d2,JSON[_0x9dc5('0x17')](_0x3659a6));_0x8e7b1c(_0x3659a6);})[_0x9dc5('0x1c')](function(_0x420158){logger['error']('GetVoiceExtension',_0x420158[_0x9dc5('0x1a')],_0x6355d2);_0x4e6388(_0x39aa04[_0x9dc5('0x18')](0x1f4,_0x420158['message']));});});}; \ No newline at end of file +var _0xf722=['options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','VoiceExtension'];(function(_0x360882,_0x4ce93a){var _0x3ac9b1=function(_0x18b7d0){while(--_0x18b7d0){_0x360882['push'](_0x360882['shift']());}};_0x3ac9b1(++_0x4ce93a);}(_0xf722,0x18f));var _0x2f72=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xf722[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x2f72('0x0'));var util=require(_0x2f72('0x1'));var moment=require(_0x2f72('0x2'));var BPromise=require(_0x2f72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f72('0x4'));var db=require(_0x2f72('0x5'))['db'];var utils=require(_0x2f72('0x6'));var logger=require(_0x2f72('0x7'))('rpc');var config=require(_0x2f72('0x8'));var jayson=require(_0x2f72('0x9'));var client=jayson[_0x2f72('0xa')]['http']({'port':0x232a});config['redis']=_[_0x2f72('0xb')](config[_0x2f72('0xc')],{'host':_0x2f72('0xd'),'port':0x18eb});var socket=require(_0x2f72('0xe'))(new Redis(config[_0x2f72('0xc')]));require(_0x2f72('0xf'))[_0x2f72('0x10')](socket);function respondWithRpcPromise(_0x4305e3,_0x227a77,_0x1c0927){return new BPromise(function(_0x119484,_0x1f4fad){return client[_0x2f72('0x11')](_0x4305e3,_0x1c0927)[_0x2f72('0x12')](function(_0x4f1cb8){logger[_0x2f72('0x13')](_0x2f72('0x14'),_0x227a77,_0x2f72('0x15'));logger[_0x2f72('0x16')](_0x2f72('0x17'),_0x227a77,_0x2f72('0x15'),JSON[_0x2f72('0x18')](_0x4f1cb8));if(_0x4f1cb8['error']){if(_0x4f1cb8['error'][_0x2f72('0x19')]===0x1f4){logger[_0x2f72('0x1a')]('VoiceExtension,\x20%s,\x20%s',_0x227a77,_0x4f1cb8[_0x2f72('0x1a')][_0x2f72('0x1b')]);return _0x1f4fad(_0x4f1cb8[_0x2f72('0x1a')]['message']);}logger[_0x2f72('0x1a')](_0x2f72('0x14'),_0x227a77,_0x4f1cb8[_0x2f72('0x1a')][_0x2f72('0x1b')]);return _0x119484(_0x4f1cb8[_0x2f72('0x1a')][_0x2f72('0x1b')]);}else{logger[_0x2f72('0x13')](_0x2f72('0x14'),_0x227a77,'request\x20sent');_0x119484(_0x4f1cb8['result'][_0x2f72('0x1b')]);}})[_0x2f72('0x1c')](function(_0x330593){logger[_0x2f72('0x1a')]('VoiceExtension,\x20%s,\x20%s',_0x227a77,_0x330593);_0x1f4fad(_0x330593);});});}exports['GetVoiceExtension']=function(_0x2ec849){var _0x246468=this;return new Promise(function(_0x5ea7f9,_0x1ff1fe){return db[_0x2f72('0x1d')]['findAll']({'raw':_0x2ec849[_0x2f72('0x1e')]?_0x2ec849[_0x2f72('0x1e')][_0x2f72('0x1f')]===undefined?!![]:![]:!![],'where':_0x2ec849[_0x2f72('0x1e')]?_0x2ec849[_0x2f72('0x1e')][_0x2f72('0x20')]||null:null,'attributes':_0x2ec849[_0x2f72('0x1e')]?_0x2ec849['options'][_0x2f72('0x21')]||null:null,'limit':_0x2ec849[_0x2f72('0x1e')]?_0x2ec849[_0x2f72('0x1e')][_0x2f72('0x22')]||null:null,'include':_0x2ec849[_0x2f72('0x1e')]?_0x2ec849['options'][_0x2f72('0x23')]?_[_0x2f72('0x24')](_0x2ec849[_0x2f72('0x1e')][_0x2f72('0x23')],function(_0x5670c2){return{'model':db[_0x5670c2[_0x2f72('0x25')]],'as':_0x5670c2['as'],'attributes':_0x5670c2['attributes'],'include':_0x5670c2[_0x2f72('0x23')]?_['map'](_0x5670c2[_0x2f72('0x23')],function(_0x2fc5d6){return{'model':db[_0x2fc5d6['model']],'as':_0x2fc5d6['as'],'attributes':_0x2fc5d6[_0x2f72('0x21')],'include':_0x2fc5d6[_0x2f72('0x23')]?_[_0x2f72('0x24')](_0x2fc5d6[_0x2f72('0x23')],function(_0x5b8f6b){return{'model':db[_0x5b8f6b[_0x2f72('0x25')]],'as':_0x5b8f6b['as'],'attributes':_0x5b8f6b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2f72('0x12')](function(_0x4f099e){logger[_0x2f72('0x13')](_0x2f72('0x26'),_0x2ec849);logger['debug'](_0x2f72('0x26'),_0x2ec849,JSON[_0x2f72('0x18')](_0x4f099e));_0x5ea7f9(_0x4f099e);})[_0x2f72('0x1c')](function(_0x148294){logger[_0x2f72('0x1a')](_0x2f72('0x26'),_0x148294[_0x2f72('0x1b')],_0x2ec849);_0x1ff1fe(_0x246468[_0x2f72('0x1a')](0x1f4,_0x148294['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 6cf6529..6e31170 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 _0x7fbe=['length','voiceExtension:','remove','update','emit','removeListener','register'];(function(_0x5ef1b9,_0x4e779a){var _0x1ab3e1=function(_0x501fb2){while(--_0x501fb2){_0x5ef1b9['push'](_0x5ef1b9['shift']());}};_0x1ab3e1(++_0x4e779a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x11bf1b,_0x50581b){_0x11bf1b=_0x11bf1b-0x0;var _0x387d1c=_0x7fbe[_0x11bf1b];return _0x387d1c;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save',_0xe7fb('0x0'),_0xe7fb('0x1')];function createListener(_0x294c21,_0x1703d5){return function(_0x517d3a){_0x1703d5[_0xe7fb('0x2')](_0x294c21,_0x517d3a);};}function removeListener(_0x11d2c4,_0x4524ff){return function(){VoiceExtensionEvents[_0xe7fb('0x3')](_0x11d2c4,_0x4524ff);};}exports[_0xe7fb('0x4')]=function(_0x290172){for(var _0x12d1b0=0x0,_0x24cd67=events[_0xe7fb('0x5')];_0x12d1b0<_0x24cd67;_0x12d1b0++){var _0x5ad75b=events[_0x12d1b0];var _0x213ebc=createListener(_0xe7fb('0x6')+_0x5ad75b,_0x290172);VoiceExtensionEvents['on'](_0x5ad75b,_0x213ebc);}}; \ No newline at end of file +var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x4224d1,_0x40adc4){var _0x1f1205=function(_0x56c74f){while(--_0x56c74f){_0x4224d1['push'](_0x4224d1['shift']());}};_0x1f1205(++_0x40adc4);}(_0x5fab,0x177));var _0xb5fa=function(_0x102b48,_0x1ffa36){_0x102b48=_0x102b48-0x0;var _0x1819c4=_0x5fab[_0x102b48];return _0x1819c4;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index da25fa3..2e3e19d 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 _0x81c6=['isAuthenticated','/:id','/:id/messages','put','update','destroy','exports','util','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x81c6,0x1d5));var _0x681c=function(_0x2534b5,_0x46d576){_0x2534b5=_0x2534b5-0x0;var _0x58212c=_0x81c6[_0x2534b5];return _0x58212c;};'use strict';var multer=require('multer');var util=require(_0x681c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x681c('0x1')]();var fs_extra=require(_0x681c('0x2'));var auth=require(_0x681c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x681c('0x4'));var controller=require(_0x681c('0x5'));router[_0x681c('0x6')]('/',auth[_0x681c('0x7')](),controller['index']);router[_0x681c('0x6')](_0x681c('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x681c('0x6')](_0x681c('0x9'),auth[_0x681c('0x7')](),controller['getMessages']);router['post']('/',auth[_0x681c('0x7')](),controller['create']);router[_0x681c('0xa')](_0x681c('0x8'),auth[_0x681c('0x7')](),controller[_0x681c('0xb')]);router['delete']('/:id',auth[_0x681c('0x7')](),controller[_0x681c('0xc')]);module[_0x681c('0xd')]=router; \ No newline at end of file +var _0x4fb4=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x4fb4,0x190));var _0x44fb=function(_0x1779f6,_0x5f3c86){_0x1779f6=_0x1779f6-0x0;var _0x1ab540=_0x4fb4[_0x1779f6];return _0x1ab540;};'use strict';var multer=require('multer');var util=require(_0x44fb('0x0'));var path=require(_0x44fb('0x1'));var timeout=require(_0x44fb('0x2'));var express=require(_0x44fb('0x3'));var router=express[_0x44fb('0x4')]();var fs_extra=require(_0x44fb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var controller=require(_0x44fb('0x8'));router[_0x44fb('0x9')]('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0xb')]);router[_0x44fb('0x9')](_0x44fb('0xc'),auth['isAuthenticated'](),controller[_0x44fb('0xd')]);router[_0x44fb('0x9')]('/:id/messages',auth[_0x44fb('0xa')](),controller[_0x44fb('0xe')]);router[_0x44fb('0xf')]('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0x10')]);router[_0x44fb('0x11')](_0x44fb('0xc'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x12')]);router[_0x44fb('0x13')]('/:id',auth[_0x44fb('0xa')](),controller[_0x44fb('0x14')]);module[_0x44fb('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 bf2bcf1..51fef12 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 _0x95ee=['TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x296754,_0x5befe9){var _0x1d9f1d=function(_0x3f033e){while(--_0x3f033e){_0x296754['push'](_0x296754['shift']());}};_0x1d9f1d(++_0x5befe9);}(_0x95ee,0x15d));var _0xe95e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x95ee[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0xe95e('0x0'));module[_0xe95e('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe95e('0x2')],'defaultValue':_0xe95e('0x3'),'unique':_0xe95e('0x4')},'mailbox':{'type':Sequelize[_0xe95e('0x2')],'defaultValue':'','allowNull':![],'unique':_0xe95e('0x4')},'password':{'type':Sequelize[_0xe95e('0x2')]},'fullname':{'type':Sequelize[_0xe95e('0x2')]},'email':{'type':Sequelize[_0xe95e('0x2')],'validate':{'isEmail':!![]},'set':function(_0x33f0f5){this[_0xe95e('0x5')](_0xe95e('0x6'),typeof _0x33f0f5==='string'&&_0x33f0f5[_0xe95e('0x7')]()?_0x33f0f5[_0xe95e('0x7')]():null);}},'pager':{'type':Sequelize[_0xe95e('0x2')]},'tz':{'type':Sequelize[_0xe95e('0x2')],'defaultValue':_0xe95e('0x8')},'attach':{'type':Sequelize[_0xe95e('0x9')](_0xe95e('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xe95e('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xe95e('0x2')]},'callback':{'type':Sequelize[_0xe95e('0x2')]},'review':{'type':Sequelize[_0xe95e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xe95e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xe95e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xe95e('0x9')](_0xe95e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xe95e('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xe95e('0x9')](_0xe95e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xe95e('0x9')](_0xe95e('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xe95e('0x9')](_0xe95e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xe95e('0x9')](_0xe95e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xe95e('0x9')](_0xe95e('0xa'),'no'),'defaultValue':_0xe95e('0xa'),'allowNull':![]},'stamp':{'type':_0xe95e('0xc')},'emailsubject':{'type':Sequelize[_0xe95e('0x2')]},'emailbody':{'type':Sequelize[_0xe95e('0x2')]},'maxsecs':{'type':Sequelize[_0xe95e('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xe95e('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xe95e('0xe')],'get':function(){return this[_0xe95e('0xf')](_0xe95e('0x10'))+_0xe95e('0x11')+this[_0xe95e('0xf')](_0xe95e('0x12'));}}}; \ No newline at end of file +var _0x2d41=['exports','STRING','from-voicemail','contest_mailbox','string','trim','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20'];(function(_0x16bf5f,_0x56b3c2){var _0x253a71=function(_0x4e139c){while(--_0x4e139c){_0x16bf5f['push'](_0x16bf5f['shift']());}};_0x253a71(++_0x56b3c2);}(_0x2d41,0x68));var _0x12d4=function(_0x54f218,_0x3ce0a6){_0x54f218=_0x54f218-0x0;var _0x3adf0e=_0x2d41[_0x54f218];return _0x3adf0e;};'use strict';var Sequelize=require('sequelize');module[_0x12d4('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x12d4('0x1')],'defaultValue':_0x12d4('0x2'),'unique':_0x12d4('0x3')},'mailbox':{'type':Sequelize[_0x12d4('0x1')],'defaultValue':'','allowNull':![],'unique':_0x12d4('0x3')},'password':{'type':Sequelize[_0x12d4('0x1')]},'fullname':{'type':Sequelize[_0x12d4('0x1')]},'email':{'type':Sequelize[_0x12d4('0x1')],'validate':{'isEmail':!![]},'set':function(_0x437114){this['setDataValue']('email',typeof _0x437114===_0x12d4('0x4')&&_0x437114[_0x12d4('0x5')]()?_0x437114[_0x12d4('0x5')]():null);}},'pager':{'type':Sequelize[_0x12d4('0x1')]},'tz':{'type':Sequelize[_0x12d4('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x12d4('0x6')]('yes','no'),'defaultValue':_0x12d4('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x12d4('0x6')](_0x12d4('0x7'),'no'),'defaultValue':_0x12d4('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x12d4('0x1')]},'callback':{'type':Sequelize[_0x12d4('0x1')]},'review':{'type':Sequelize[_0x12d4('0x6')](_0x12d4('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x12d4('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x12d4('0x6')](_0x12d4('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x12d4('0x6')](_0x12d4('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x12d4('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x12d4('0x6')](_0x12d4('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x12d4('0x6')](_0x12d4('0x7'),'no'),'defaultValue':_0x12d4('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x12d4('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x12d4('0x6')](_0x12d4('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x12d4('0x7'),'no'),'defaultValue':_0x12d4('0x7'),'allowNull':![]},'stamp':{'type':_0x12d4('0x8')},'emailsubject':{'type':Sequelize[_0x12d4('0x1')]},'emailbody':{'type':Sequelize[_0x12d4('0x1')]},'maxsecs':{'type':Sequelize[_0x12d4('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x12d4('0xa')],'get':function(){return this[_0x12d4('0xb')]('fullname')+_0x12d4('0xc')+this[_0x12d4('0xb')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 06dd69f..672ba2b 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 _0x0972=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','mailbox','rimraf','fast-json-patch','moment','bluebird','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','Voicemails','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','include','findAll','rows','catch','params','length','options'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x0972,0x64));var _0x2097=function(_0x1d0bd8,_0x540bc4){_0x1d0bd8=_0x1d0bd8-0x0;var _0x5ced56=_0x0972[_0x1d0bd8];return _0x5ced56;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];function respondWithStatusCode(_0x3b2f94,_0x170005){_0x170005=_0x170005||0xcc;return function(_0x16871b){if(_0x16871b){return _0x3b2f94[_0x2097('0x1a')](_0x170005);}return _0x3b2f94[_0x2097('0x1b')](_0x170005)[_0x2097('0x1c')]();};}function respondWithResult(_0x1c9ef9,_0x2c3e41){_0x2c3e41=_0x2c3e41||0xc8;return function(_0x354387){if(_0x354387){return _0x1c9ef9['status'](_0x2c3e41)[_0x2097('0x1d')](_0x354387);}};}function respondWithFilteredResult(_0x35c062,_0x4d31bc){return function(_0x4eec05){if(_0x4eec05){var _0x4fc8c5=typeof _0x4d31bc[_0x2097('0x1e')]==='undefined'&&typeof _0x4d31bc[_0x2097('0x1f')]===_0x2097('0x20');var _0x43fec9=_0x4eec05[_0x2097('0x21')];var _0x44c584=_0x4fc8c5?0x0:_0x4d31bc['offset'];var _0x324652=_0x4fc8c5?_0x4eec05[_0x2097('0x21')]:_0x4d31bc[_0x2097('0x1e')]+_0x4d31bc[_0x2097('0x1f')];var _0x1d3804;if(_0x324652>=_0x43fec9){_0x324652=_0x43fec9;_0x1d3804=0xc8;}else{_0x1d3804=0xce;}_0x35c062[_0x2097('0x1b')](_0x1d3804);return _0x35c062[_0x2097('0x22')](_0x2097('0x23'),_0x44c584+'-'+_0x324652+'/'+_0x43fec9)['json'](_0x4eec05);}return null;};}function patchUpdates(_0x4d957e){return function(_0xf65dc6){try{jsonpatch['apply'](_0xf65dc6,_0x4d957e,!![]);}catch(_0x227c00){return BPromise[_0x2097('0x24')](_0x227c00);}return _0xf65dc6['save']();};}function saveUpdates(_0x442db7,_0x5b0582){return function(_0x2e17c8){if(_0x2e17c8){return _0x2e17c8[_0x2097('0x25')](_0x442db7)[_0x2097('0x26')](function(_0x20b93a){return _0x20b93a;});}return null;};}function removeEntity(_0x36b15e,_0x35047b){return function(_0x56390a){if(_0x56390a){return _0x56390a[_0x2097('0x27')]()['then'](function(){var _0x3f9279=_0x56390a[_0x2097('0x28')]({'plain':!![]});var _0x345875=_0x2097('0x29');return db['UserProfileResource'][_0x2097('0x27')]({'where':{'type':_0x345875,'resourceId':_0x3f9279['id']}})[_0x2097('0x26')](function(){return _0x56390a;});})['then'](function(){_0x36b15e[_0x2097('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b879,_0x48ae06){return function(_0xbc0339){if(!_0xbc0339){_0x29b879[_0x2097('0x1a')](0x194);}return _0xbc0339;};}function handleError(_0x407a2a,_0x7eefb4){_0x7eefb4=_0x7eefb4||0x1f4;return function(_0x410afa){logger[_0x2097('0x2a')](_0x410afa[_0x2097('0x2b')]);if(_0x410afa['name']){delete _0x410afa[_0x2097('0x2c')];}_0x407a2a[_0x2097('0x1b')](_0x7eefb4)['send'](_0x410afa);};}exports[_0x2097('0x2d')]=function(_0x41487d,_0x59fb84){var _0x4d0916={},_0x312c77={},_0x11b051={'count':0x0,'rows':[]};var _0x1649c8=_[_0x2097('0x2e')](db[_0x2097('0x2f')][_0x2097('0x30')],function(_0x56c538){return{'name':_0x56c538[_0x2097('0x31')],'type':_0x56c538['type'][_0x2097('0x32')]};});_0x312c77[_0x2097('0x33')]=_[_0x2097('0x2e')](_0x1649c8,_0x2097('0x2c'));_0x312c77[_0x2097('0x34')]=_[_0x2097('0x35')](_0x41487d[_0x2097('0x34')]);_0x312c77[_0x2097('0x36')]=_[_0x2097('0x37')](_0x312c77['model'],_0x312c77[_0x2097('0x34')]);_0x4d0916[_0x2097('0x38')]=_[_0x2097('0x37')](_0x312c77['model'],qs[_0x2097('0x39')](_0x41487d[_0x2097('0x34')][_0x2097('0x39')]));_0x4d0916[_0x2097('0x38')]=_0x4d0916['attributes']['length']?_0x4d0916['attributes']:_0x312c77[_0x2097('0x33')];if(!_0x41487d[_0x2097('0x34')][_0x2097('0x3a')](_0x2097('0x3b'))){_0x4d0916[_0x2097('0x1f')]=qs[_0x2097('0x1f')](_0x41487d['query'][_0x2097('0x1f')]);_0x4d0916[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x41487d[_0x2097('0x34')][_0x2097('0x1e')]);}_0x4d0916[_0x2097('0x3c')]=qs['sort'](_0x41487d[_0x2097('0x34')][_0x2097('0x3d')]);_0x4d0916[_0x2097('0x3e')]=qs['filters'](_['pick'](_0x41487d[_0x2097('0x34')],_0x312c77[_0x2097('0x36')]),_0x1649c8);if(_0x41487d[_0x2097('0x34')][_0x2097('0x3f')]){_0x4d0916[_0x2097('0x3e')]=_[_0x2097('0x40')](_0x4d0916[_0x2097('0x3e')],{'$or':_[_0x2097('0x2e')](_0x1649c8,function(_0x23c4a5){if(_0x23c4a5[_0x2097('0x41')]!==_0x2097('0x42')){var _0x1ef92a={};_0x1ef92a[_0x23c4a5['name']]={'$like':'%'+_0x41487d[_0x2097('0x34')][_0x2097('0x3f')]+'%'};return _0x1ef92a;}})});}_0x4d0916=_[_0x2097('0x40')]({},_0x4d0916,_0x41487d['options']);var _0x1394df={'where':_0x4d0916[_0x2097('0x3e')]};return db[_0x2097('0x2f')][_0x2097('0x21')](_0x1394df)[_0x2097('0x26')](function(_0xd4d89e){_0x11b051[_0x2097('0x21')]=_0xd4d89e;if(_0x41487d[_0x2097('0x34')]['includeAll']){_0x4d0916[_0x2097('0x43')]=[{'all':!![]}];}return db[_0x2097('0x2f')][_0x2097('0x44')](_0x4d0916);})[_0x2097('0x26')](function(_0x12e0e2){_0x11b051[_0x2097('0x45')]=_0x12e0e2;return _0x11b051;})[_0x2097('0x26')](respondWithFilteredResult(_0x59fb84,_0x4d0916))[_0x2097('0x46')](handleError(_0x59fb84,null));};exports['show']=function(_0x3fc3fe,_0x5869d8){var _0x3e0739={'raw':!![],'where':{'id':_0x3fc3fe[_0x2097('0x47')]['id']}},_0x298e49={};_0x298e49[_0x2097('0x33')]=_[_0x2097('0x35')](db['VoiceMail'][_0x2097('0x30')]);_0x298e49[_0x2097('0x34')]=_[_0x2097('0x35')](_0x3fc3fe[_0x2097('0x34')]);_0x298e49[_0x2097('0x36')]=_['intersection'](_0x298e49[_0x2097('0x33')],_0x298e49[_0x2097('0x34')]);_0x3e0739[_0x2097('0x38')]=_[_0x2097('0x37')](_0x298e49[_0x2097('0x33')],qs[_0x2097('0x39')](_0x3fc3fe[_0x2097('0x34')][_0x2097('0x39')]));_0x3e0739['attributes']=_0x3e0739[_0x2097('0x38')][_0x2097('0x48')]?_0x3e0739[_0x2097('0x38')]:_0x298e49[_0x2097('0x33')];if(_0x3fc3fe['query']['includeAll']){_0x3e0739['include']=[{'all':!![]}];}_0x3e0739=_[_0x2097('0x40')]({},_0x3e0739,_0x3fc3fe[_0x2097('0x49')]);return db['VoiceMail'][_0x2097('0x4a')](_0x3e0739)[_0x2097('0x26')](handleEntityNotFound(_0x5869d8,null))['then'](respondWithResult(_0x5869d8,null))['catch'](handleError(_0x5869d8,null));};exports[_0x2097('0x4b')]=function(_0x21829d,_0x1b4de6){return db['VoiceMail'][_0x2097('0x4b')](_0x21829d[_0x2097('0x4c')],{})['then'](function(_0x86a05a){var _0x2682a9=_0x21829d[_0x2097('0x4d')][_0x2097('0x28')]({'plain':!![]});if(!_0x2682a9)throw new Error(_0x2097('0x4e'));if(_0x2682a9['role']==='user'){var _0x140b41=_0x86a05a[_0x2097('0x28')]({'plain':!![]});var _0x329632='Voicemails';return db['UserProfileSection'][_0x2097('0x4a')]({'where':{'name':_0x329632,'userProfileId':_0x2682a9[_0x2097('0x4f')]},'raw':!![]})['then'](function(_0x41cd90){if(_0x41cd90&&_0x41cd90[_0x2097('0x50')]===0x0){return db[_0x2097('0x51')][_0x2097('0x4b')]({'name':_0x140b41[_0x2097('0x2c')],'resourceId':_0x140b41['id'],'type':_0x41cd90['name'],'sectionId':_0x41cd90['id']},{})[_0x2097('0x26')](function(){return _0x86a05a;});}else{return _0x86a05a;}})[_0x2097('0x46')](function(_0x190859){logger['error'](_0x2097('0x52'),_0x190859);throw _0x190859;});}return _0x86a05a;})[_0x2097('0x26')](respondWithResult(_0x1b4de6,0xc9))['catch'](handleError(_0x1b4de6,null));};exports[_0x2097('0x25')]=function(_0x4d6ed6,_0x30b4cd){if(_0x4d6ed6['body']['id']){delete _0x4d6ed6['body']['id'];}return db['VoiceMail'][_0x2097('0x4a')]({'where':{'id':_0x4d6ed6['params']['id']}})['then'](handleEntityNotFound(_0x30b4cd,null))[_0x2097('0x26')](saveUpdates(_0x4d6ed6['body'],null))[_0x2097('0x26')](respondWithResult(_0x30b4cd,null))[_0x2097('0x46')](handleError(_0x30b4cd,null));};exports['destroy']=function(_0x3e799f,_0x3e2e45){return db[_0x2097('0x2f')][_0x2097('0x4a')]({'where':{'id':_0x3e799f[_0x2097('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e2e45,null))[_0x2097('0x26')](removeEntity(_0x3e2e45,null))['catch'](handleError(_0x3e2e45,null));};exports[_0x2097('0x53')]=function(_0x140e43,_0x24f166,_0x55e3cd){return db[_0x2097('0x2f')][_0x2097('0x54')]({'where':{'id':_0x140e43[_0x2097('0x47')]['id']}})[_0x2097('0x26')](handleEntityNotFound(_0x24f166,null))[_0x2097('0x26')](function(_0x56cfbf){var _0x5b9fa2;var _0x265eac={},_0x275578={};_0x275578['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x275578[_0x2097('0x34')]=_['keys'](_0x140e43[_0x2097('0x34')]);_0x275578[_0x2097('0x36')]=_['intersection'](_0x275578[_0x2097('0x33')],_0x275578[_0x2097('0x34')]);_0x265eac[_0x2097('0x38')]=_[_0x2097('0x37')](_0x275578[_0x2097('0x33')],qs[_0x2097('0x39')](_0x140e43[_0x2097('0x34')][_0x2097('0x39')]));_0x265eac[_0x2097('0x38')]=_0x265eac['attributes'][_0x2097('0x48')]?_0x265eac[_0x2097('0x38')]:_0x275578[_0x2097('0x33')];if(!_0x140e43[_0x2097('0x34')][_0x2097('0x3a')](_0x2097('0x3b'))){_0x265eac['limit']=qs[_0x2097('0x1f')](_0x140e43[_0x2097('0x34')][_0x2097('0x1f')]);_0x265eac[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x140e43['query'][_0x2097('0x1e')]);}_0x265eac[_0x2097('0x3c')]=qs['sort'](_0x140e43['query']['sort']);_0x265eac[_0x2097('0x3e')]=qs[_0x2097('0x36')](_[_0x2097('0x55')](_0x140e43[_0x2097('0x34')],_0x275578[_0x2097('0x36')]));if(_0x140e43[_0x2097('0x34')][_0x2097('0x3f')]){_0x265eac[_0x2097('0x3e')]=_[_0x2097('0x40')](_0x265eac['where'],{'$or':_['map'](_0x265eac[_0x2097('0x38')],function(_0x34d832){var _0x1eeb30={};_0x1eeb30[_0x34d832]={'$like':'%'+_0x140e43[_0x2097('0x34')][_0x2097('0x3f')]+'%'};return _0x1eeb30;})});}_0x265eac[_0x2097('0x3e')]=_['merge'](_0x265eac[_0x2097('0x3e')],{'mailboxuser':_0x56cfbf[_0x2097('0x56')]});_0x265eac=_[_0x2097('0x40')]({},_0x265eac,_0x140e43[_0x2097('0x49')]);return db['VoiceMailMessage']['findAndCountAll'](_0x265eac)[_0x2097('0x26')](respondWithFilteredResult(_0x24f166,_0x265eac));})[_0x2097('0x46')](handleError(_0x24f166,null));}; \ No newline at end of file +var _0x9354=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','map','VIRTUAL','filter','merge','options','VoiceMail','include','findAll','catch','params','keys','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','getMessages','VoiceMailMessage','pick','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x699f50,_0x437189){var _0x352739=function(_0x30fa7a){while(--_0x30fa7a){_0x699f50['push'](_0x699f50['shift']());}};_0x352739(++_0x437189);}(_0x9354,0x96));var _0x4935=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0x9354[_0x52666e];return _0x515330;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4935('0x0'));var zipdir=require(_0x4935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4935('0x2'));var moment=require(_0x4935('0x3'));var BPromise=require(_0x4935('0x4'));var Mustache=require(_0x4935('0x5'));var util=require('util');var path=require(_0x4935('0x6'));var sox=require(_0x4935('0x7'));var csv=require(_0x4935('0x8'));var ejs=require(_0x4935('0x9'));var fs=require('fs');var fs_extra=require(_0x4935('0xa'));var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x8'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4935('0x16'))['db'];function respondWithStatusCode(_0x32916f,_0x3bb388){_0x3bb388=_0x3bb388||0xcc;return function(_0x1c6c22){if(_0x1c6c22){return _0x32916f[_0x4935('0x17')](_0x3bb388);}return _0x32916f[_0x4935('0x18')](_0x3bb388)[_0x4935('0x19')]();};}function respondWithResult(_0x3a7c30,_0x57549f){_0x57549f=_0x57549f||0xc8;return function(_0x237e28){if(_0x237e28){return _0x3a7c30[_0x4935('0x18')](_0x57549f)[_0x4935('0x1a')](_0x237e28);}};}function respondWithFilteredResult(_0xa41961,_0x3652c4){return function(_0x24cc99){if(_0x24cc99){var _0x395a43=typeof _0x3652c4['offset']===_0x4935('0x1b')&&typeof _0x3652c4[_0x4935('0x1c')]===_0x4935('0x1b');var _0x123300=_0x24cc99[_0x4935('0x1d')];var _0x429ef3=_0x395a43?0x0:_0x3652c4['offset'];var _0xd70eff=_0x395a43?_0x24cc99[_0x4935('0x1d')]:_0x3652c4['offset']+_0x3652c4[_0x4935('0x1c')];var _0x10407f;if(_0xd70eff>=_0x123300){_0xd70eff=_0x123300;_0x10407f=0xc8;}else{_0x10407f=0xce;}_0xa41961[_0x4935('0x18')](_0x10407f);return _0xa41961['set']('Content-Range',_0x429ef3+'-'+_0xd70eff+'/'+_0x123300)[_0x4935('0x1a')](_0x24cc99);}return null;};}function patchUpdates(_0x6b849f){return function(_0x1ae059){try{jsonpatch[_0x4935('0x1e')](_0x1ae059,_0x6b849f,!![]);}catch(_0x41d76e){return BPromise[_0x4935('0x1f')](_0x41d76e);}return _0x1ae059[_0x4935('0x20')]();};}function saveUpdates(_0xe482a5,_0x58b2f3){return function(_0x2f520a){if(_0x2f520a){return _0x2f520a[_0x4935('0x21')](_0xe482a5)[_0x4935('0x22')](function(_0x2c701f){return _0x2c701f;});}return null;};}function removeEntity(_0x52c65a,_0x53530f){return function(_0x4dc1f5){if(_0x4dc1f5){return _0x4dc1f5[_0x4935('0x23')]()[_0x4935('0x22')](function(){var _0x3786ff=_0x4dc1f5[_0x4935('0x24')]({'plain':!![]});var _0x344e51=_0x4935('0x25');return db[_0x4935('0x26')][_0x4935('0x23')]({'where':{'type':_0x344e51,'resourceId':_0x3786ff['id']}})[_0x4935('0x22')](function(){return _0x4dc1f5;});})[_0x4935('0x22')](function(){_0x52c65a[_0x4935('0x18')](0xcc)[_0x4935('0x19')]();});}};}function handleEntityNotFound(_0x2c47ab,_0xbb00d6){return function(_0x359522){if(!_0x359522){_0x2c47ab['sendStatus'](0x194);}return _0x359522;};}function handleError(_0x5c3aaa,_0x5cec4d){_0x5cec4d=_0x5cec4d||0x1f4;return function(_0x1fc218){logger[_0x4935('0x27')](_0x1fc218['stack']);if(_0x1fc218[_0x4935('0x28')]){delete _0x1fc218[_0x4935('0x28')];}_0x5c3aaa[_0x4935('0x18')](_0x5cec4d)[_0x4935('0x29')](_0x1fc218);};}exports[_0x4935('0x2a')]=function(_0x24262e,_0x28afc2){var _0x2fe6da={},_0x5b3c8e={},_0xb7fe2a={'count':0x0,'rows':[]};var _0x2dcb0b=_['map'](db['VoiceMail'][_0x4935('0x2b')],function(_0x479d28){return{'name':_0x479d28[_0x4935('0x2c')],'type':_0x479d28[_0x4935('0x2d')][_0x4935('0x2e')]};});_0x5b3c8e['model']=_['map'](_0x2dcb0b,_0x4935('0x28'));_0x5b3c8e[_0x4935('0x2f')]=_['keys'](_0x24262e[_0x4935('0x2f')]);_0x5b3c8e[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5b3c8e[_0x4935('0x32')],_0x5b3c8e[_0x4935('0x2f')]);_0x2fe6da['attributes']=_['intersection'](_0x5b3c8e[_0x4935('0x32')],qs[_0x4935('0x33')](_0x24262e['query']['fields']));_0x2fe6da[_0x4935('0x34')]=_0x2fe6da['attributes'][_0x4935('0x35')]?_0x2fe6da[_0x4935('0x34')]:_0x5b3c8e[_0x4935('0x32')];if(!_0x24262e[_0x4935('0x2f')][_0x4935('0x36')](_0x4935('0x37'))){_0x2fe6da['limit']=qs[_0x4935('0x1c')](_0x24262e['query'][_0x4935('0x1c')]);_0x2fe6da['offset']=qs[_0x4935('0x38')](_0x24262e['query'][_0x4935('0x38')]);}_0x2fe6da[_0x4935('0x39')]=qs[_0x4935('0x3a')](_0x24262e[_0x4935('0x2f')][_0x4935('0x3a')]);_0x2fe6da[_0x4935('0x3b')]=qs[_0x4935('0x30')](_['pick'](_0x24262e['query'],_0x5b3c8e[_0x4935('0x30')]),_0x2dcb0b);if(_0x24262e['query']['filter']){_0x2fe6da[_0x4935('0x3b')]=_['merge'](_0x2fe6da[_0x4935('0x3b')],{'$or':_[_0x4935('0x3c')](_0x2dcb0b,function(_0x2d67e3){if(_0x2d67e3[_0x4935('0x2d')]!==_0x4935('0x3d')){var _0x53aac5={};_0x53aac5[_0x2d67e3['name']]={'$like':'%'+_0x24262e[_0x4935('0x2f')][_0x4935('0x3e')]+'%'};return _0x53aac5;}})});}_0x2fe6da=_[_0x4935('0x3f')]({},_0x2fe6da,_0x24262e[_0x4935('0x40')]);var _0x4d9436={'where':_0x2fe6da[_0x4935('0x3b')]};return db[_0x4935('0x41')][_0x4935('0x1d')](_0x4d9436)['then'](function(_0x4e94f6){_0xb7fe2a[_0x4935('0x1d')]=_0x4e94f6;if(_0x24262e[_0x4935('0x2f')]['includeAll']){_0x2fe6da[_0x4935('0x42')]=[{'all':!![]}];}return db[_0x4935('0x41')][_0x4935('0x43')](_0x2fe6da);})[_0x4935('0x22')](function(_0x52ab0c){_0xb7fe2a['rows']=_0x52ab0c;return _0xb7fe2a;})[_0x4935('0x22')](respondWithFilteredResult(_0x28afc2,_0x2fe6da))[_0x4935('0x44')](handleError(_0x28afc2,null));};exports['show']=function(_0x1eaa47,_0x40f5ff){var _0x2195da={'raw':!![],'where':{'id':_0x1eaa47[_0x4935('0x45')]['id']}},_0x5135fd={};_0x5135fd[_0x4935('0x32')]=_[_0x4935('0x46')](db[_0x4935('0x41')][_0x4935('0x2b')]);_0x5135fd[_0x4935('0x2f')]=_[_0x4935('0x46')](_0x1eaa47[_0x4935('0x2f')]);_0x5135fd[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],_0x5135fd[_0x4935('0x2f')]);_0x2195da[_0x4935('0x34')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],qs[_0x4935('0x33')](_0x1eaa47[_0x4935('0x2f')][_0x4935('0x33')]));_0x2195da['attributes']=_0x2195da[_0x4935('0x34')]['length']?_0x2195da[_0x4935('0x34')]:_0x5135fd[_0x4935('0x32')];if(_0x1eaa47[_0x4935('0x2f')][_0x4935('0x47')]){_0x2195da['include']=[{'all':!![]}];}_0x2195da=_[_0x4935('0x3f')]({},_0x2195da,_0x1eaa47[_0x4935('0x40')]);return db[_0x4935('0x41')][_0x4935('0x48')](_0x2195da)[_0x4935('0x22')](handleEntityNotFound(_0x40f5ff,null))[_0x4935('0x22')](respondWithResult(_0x40f5ff,null))[_0x4935('0x44')](handleError(_0x40f5ff,null));};exports[_0x4935('0x49')]=function(_0x29b932,_0x392cba){return db['VoiceMail'][_0x4935('0x49')](_0x29b932[_0x4935('0x4a')],{})['then'](function(_0x447a64){var _0x2636f4=_0x29b932[_0x4935('0x4b')][_0x4935('0x24')]({'plain':!![]});if(!_0x2636f4)throw new Error(_0x4935('0x4c'));if(_0x2636f4[_0x4935('0x4d')]===_0x4935('0x4b')){var _0x471fb1=_0x447a64['get']({'plain':!![]});var _0x57d0d9='Voicemails';return db['UserProfileSection'][_0x4935('0x48')]({'where':{'name':_0x57d0d9,'userProfileId':_0x2636f4[_0x4935('0x4e')]},'raw':!![]})[_0x4935('0x22')](function(_0x2072df){if(_0x2072df&&_0x2072df[_0x4935('0x4f')]===0x0){return db['UserProfileResource'][_0x4935('0x49')]({'name':_0x471fb1[_0x4935('0x28')],'resourceId':_0x471fb1['id'],'type':_0x2072df[_0x4935('0x28')],'sectionId':_0x2072df['id']},{})[_0x4935('0x22')](function(){return _0x447a64;});}else{return _0x447a64;}})[_0x4935('0x44')](function(_0x8196b4){logger[_0x4935('0x27')](_0x4935('0x50'),_0x8196b4);throw _0x8196b4;});}return _0x447a64;})[_0x4935('0x22')](respondWithResult(_0x392cba,0xc9))[_0x4935('0x44')](handleError(_0x392cba,null));};exports['update']=function(_0x24b83b,_0x4e99bb){if(_0x24b83b[_0x4935('0x4a')]['id']){delete _0x24b83b[_0x4935('0x4a')]['id'];}return db['VoiceMail'][_0x4935('0x48')]({'where':{'id':_0x24b83b['params']['id']}})['then'](handleEntityNotFound(_0x4e99bb,null))['then'](saveUpdates(_0x24b83b[_0x4935('0x4a')],null))[_0x4935('0x22')](respondWithResult(_0x4e99bb,null))[_0x4935('0x44')](handleError(_0x4e99bb,null));};exports[_0x4935('0x23')]=function(_0xd5a489,_0x56db7f){return db['VoiceMail'][_0x4935('0x48')]({'where':{'id':_0xd5a489[_0x4935('0x45')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x56db7f,null))['then'](removeEntity(_0x56db7f,null))[_0x4935('0x44')](handleError(_0x56db7f,null));};exports[_0x4935('0x51')]=function(_0x24141a,_0xc92288,_0x5009c9){return db[_0x4935('0x41')]['findOne']({'where':{'id':_0x24141a['params']['id']}})['then'](handleEntityNotFound(_0xc92288,null))[_0x4935('0x22')](function(_0x10cd78){var _0x47e73d;var _0x3190d2={},_0x395eba={};_0x395eba['model']=_[_0x4935('0x46')](db[_0x4935('0x52')][_0x4935('0x2b')]);_0x395eba[_0x4935('0x2f')]=_[_0x4935('0x46')](_0x24141a[_0x4935('0x2f')]);_0x395eba[_0x4935('0x30')]=_['intersection'](_0x395eba[_0x4935('0x32')],_0x395eba['query']);_0x3190d2['attributes']=_[_0x4935('0x31')](_0x395eba[_0x4935('0x32')],qs['fields'](_0x24141a['query'][_0x4935('0x33')]));_0x3190d2[_0x4935('0x34')]=_0x3190d2[_0x4935('0x34')]['length']?_0x3190d2[_0x4935('0x34')]:_0x395eba['model'];if(!_0x24141a[_0x4935('0x2f')][_0x4935('0x36')](_0x4935('0x37'))){_0x3190d2[_0x4935('0x1c')]=qs[_0x4935('0x1c')](_0x24141a['query'][_0x4935('0x1c')]);_0x3190d2[_0x4935('0x38')]=qs['offset'](_0x24141a[_0x4935('0x2f')][_0x4935('0x38')]);}_0x3190d2[_0x4935('0x39')]=qs[_0x4935('0x3a')](_0x24141a[_0x4935('0x2f')][_0x4935('0x3a')]);_0x3190d2[_0x4935('0x3b')]=qs[_0x4935('0x30')](_[_0x4935('0x53')](_0x24141a[_0x4935('0x2f')],_0x395eba[_0x4935('0x30')]));if(_0x24141a['query'][_0x4935('0x3e')]){_0x3190d2[_0x4935('0x3b')]=_[_0x4935('0x3f')](_0x3190d2[_0x4935('0x3b')],{'$or':_[_0x4935('0x3c')](_0x3190d2[_0x4935('0x34')],function(_0x2c06f5){var _0x9023e={};_0x9023e[_0x2c06f5]={'$like':'%'+_0x24141a[_0x4935('0x2f')][_0x4935('0x3e')]+'%'};return _0x9023e;})});}_0x3190d2[_0x4935('0x3b')]=_[_0x4935('0x3f')](_0x3190d2[_0x4935('0x3b')],{'mailboxuser':_0x10cd78['mailbox']});_0x3190d2=_['merge']({},_0x3190d2,_0x24141a[_0x4935('0x40')]);return db[_0x4935('0x52')]['findAndCountAll'](_0x3190d2)[_0x4935('0x22')](respondWithFilteredResult(_0xc92288,_0x3190d2));})[_0x4935('0x44')](handleError(_0xc92288,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index c30eb58..d4ff368 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 _0xf1a4=['voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail'];(function(_0x143f43,_0x5b1236){var _0x1138ef=function(_0x308374){while(--_0x308374){_0x143f43['push'](_0x143f43['shift']());}};_0x1138ef(++_0x5b1236);}(_0xf1a4,0x103));var _0x4f1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1a4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4f1a('0x0'));var util=require(_0x4f1a('0x1'));var logger=require(_0x4f1a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4f1a('0x3'));var rp=require(_0x4f1a('0x4'));var fs=require('fs');var path=require(_0x4f1a('0x5'));var rimraf=require(_0x4f1a('0x6'));var config=require('../../config/environment');var attributes=require(_0x4f1a('0x7'));module[_0x4f1a('0x8')]=function(_0x16c2d8,_0x383b14){return _0x16c2d8[_0x4f1a('0x9')](_0x4f1a('0xa'),attributes,{'tableName':_0x4f1a('0xb'),'paranoid':![],'indexes':[{'name':_0x4f1a('0xc'),'fields':[_0x4f1a('0xd'),_0x4f1a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x95a8=['exports','define','voice_voicemail','mailbox','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x95a8,0x12f));var _0x895a=function(_0x2382b5,_0x447dcf){_0x2382b5=_0x2382b5-0x0;var _0x4d5019=_0x95a8[_0x2382b5];return _0x4d5019;};'use strict';var _=require(_0x895a('0x0'));var util=require(_0x895a('0x1'));var logger=require(_0x895a('0x2'))(_0x895a('0x3'));var moment=require(_0x895a('0x4'));var BPromise=require(_0x895a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x895a('0x6'));var rimraf=require(_0x895a('0x7'));var config=require(_0x895a('0x8'));var attributes=require('./voiceMail.attributes');module[_0x895a('0x9')]=function(_0x26b765,_0x3a594c){return _0x26b765[_0x895a('0xa')]('VoiceMail',attributes,{'tableName':_0x895a('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x895a('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 0a51ab9..9af917e 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 _0x8cbc=['debug','error','code','message','result','lodash','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent'];(function(_0x57f27d,_0x2bcde2){var _0x24894d=function(_0x459b92){while(--_0x459b92){_0x57f27d['push'](_0x57f27d['shift']());}};_0x24894d(++_0x2bcde2);}(_0x8cbc,0xdd));var _0xc8cb=function(_0x27eb53,_0x3b9675){_0x27eb53=_0x27eb53-0x0;var _0x101736=_0x8cbc[_0x27eb53];return _0x101736;};'use strict';var _=require(_0xc8cb('0x0'));var util=require('util');var moment=require(_0xc8cb('0x1'));var BPromise=require('bluebird');var rs=require(_0xc8cb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc8cb('0x3'));var logger=require(_0xc8cb('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc8cb('0x5'));var client=jayson[_0xc8cb('0x6')][_0xc8cb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x230256,_0x587e7c,_0x13597b){return new BPromise(function(_0x388a1c,_0x2c6ba2){return client[_0xc8cb('0x8')](_0x230256,_0x13597b)[_0xc8cb('0x9')](function(_0x315201){logger[_0xc8cb('0xa')](_0xc8cb('0xb'),_0x587e7c,_0xc8cb('0xc'));logger[_0xc8cb('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x587e7c,_0xc8cb('0xc'),JSON['stringify'](_0x315201));if(_0x315201[_0xc8cb('0xe')]){if(_0x315201['error'][_0xc8cb('0xf')]===0x1f4){logger[_0xc8cb('0xe')](_0xc8cb('0xb'),_0x587e7c,_0x315201[_0xc8cb('0xe')][_0xc8cb('0x10')]);return _0x2c6ba2(_0x315201[_0xc8cb('0xe')][_0xc8cb('0x10')]);}logger[_0xc8cb('0xe')](_0xc8cb('0xb'),_0x587e7c,_0x315201[_0xc8cb('0xe')][_0xc8cb('0x10')]);return _0x388a1c(_0x315201['error'][_0xc8cb('0x10')]);}else{logger['info'](_0xc8cb('0xb'),_0x587e7c,_0xc8cb('0xc'));_0x388a1c(_0x315201[_0xc8cb('0x11')][_0xc8cb('0x10')]);}})['catch'](function(_0x38c9fe){logger[_0xc8cb('0xe')](_0xc8cb('0xb'),_0x587e7c,_0x38c9fe);_0x2c6ba2(_0x38c9fe);});});} \ No newline at end of file +var _0x9160=['jayson/promise','client','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x9160,0x15d));var _0x0916=function(_0x2c5286,_0x326183){_0x2c5286=_0x2c5286-0x0;var _0x24711e=_0x9160[_0x2c5286];return _0x24711e;};'use strict';var _=require('lodash');var util=require(_0x0916('0x0'));var moment=require(_0x0916('0x1'));var BPromise=require(_0x0916('0x2'));var rs=require(_0x0916('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0916('0x4'));var logger=require(_0x0916('0x5'))(_0x0916('0x6'));var config=require(_0x0916('0x7'));var jayson=require(_0x0916('0x8'));var client=jayson[_0x0916('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26bfb8,_0x2f61ba,_0x4328d2){return new BPromise(function(_0x3a40ed,_0x18abcd){return client[_0x0916('0xa')](_0x26bfb8,_0x4328d2)[_0x0916('0xb')](function(_0x4f9d35){logger['info'](_0x0916('0xc'),_0x2f61ba,_0x0916('0xd'));logger[_0x0916('0xe')](_0x0916('0xf'),_0x2f61ba,_0x0916('0xd'),JSON['stringify'](_0x4f9d35));if(_0x4f9d35[_0x0916('0x10')]){if(_0x4f9d35['error'][_0x0916('0x11')]===0x1f4){logger[_0x0916('0x10')](_0x0916('0xc'),_0x2f61ba,_0x4f9d35[_0x0916('0x10')][_0x0916('0x12')]);return _0x18abcd(_0x4f9d35[_0x0916('0x10')][_0x0916('0x12')]);}logger[_0x0916('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2f61ba,_0x4f9d35[_0x0916('0x10')][_0x0916('0x12')]);return _0x3a40ed(_0x4f9d35[_0x0916('0x10')]['message']);}else{logger[_0x0916('0x13')](_0x0916('0xc'),_0x2f61ba,'request\x20sent');_0x3a40ed(_0x4f9d35[_0x0916('0x14')][_0x0916('0x12')]);}})['catch'](function(_0x36ed55){logger[_0x0916('0x10')](_0x0916('0xc'),_0x2f61ba,_0x36ed55);_0x18abcd(_0x36ed55);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 4d47aac..41bd44b 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 _0x98cf=['./voiceMailMessage.controller','get','index','isAuthenticated','show','/:id/download','download','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x275567,_0x40f5fc){var _0x4a8859=function(_0x4abc11){while(--_0x4abc11){_0x275567['push'](_0x275567['shift']());}};_0x4a8859(++_0x40f5fc);}(_0x98cf,0x1d4));var _0xf98c=function(_0x20994b,_0x3e4825){_0x20994b=_0x20994b-0x0;var _0x2c21f7=_0x98cf[_0x20994b];return _0x2c21f7;};'use strict';var multer=require(_0xf98c('0x0'));var util=require(_0xf98c('0x1'));var path=require(_0xf98c('0x2'));var timeout=require(_0xf98c('0x3'));var express=require(_0xf98c('0x4'));var router=express[_0xf98c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf98c('0x6'));var controller=require(_0xf98c('0x7'));router[_0xf98c('0x8')]('/',auth['isAuthenticated'](),controller[_0xf98c('0x9')]);router[_0xf98c('0x8')]('/:id',auth[_0xf98c('0xa')](),controller[_0xf98c('0xb')]);router[_0xf98c('0x8')](_0xf98c('0xc'),auth['isAuthenticated'](),controller[_0xf98c('0xd')]);router['post']('/',auth[_0xf98c('0xa')](),controller[_0xf98c('0xe')]);router['put'](_0xf98c('0xf'),auth[_0xf98c('0xa')](),controller[_0xf98c('0x10')]);router[_0xf98c('0x11')](_0xf98c('0xf'),auth[_0xf98c('0xa')](),controller[_0xf98c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x41ae=['/:id','/:id/download','download','post','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x29e74e,_0x36522d){var _0x3c82d5=function(_0x211dc8){while(--_0x211dc8){_0x29e74e['push'](_0x29e74e['shift']());}};_0x3c82d5(++_0x36522d);}(_0x41ae,0x1ca));var _0xe41a=function(_0x18d03a,_0x295d41){_0x18d03a=_0x18d03a-0x0;var _0x13aa29=_0x41ae[_0x18d03a];return _0x13aa29;};'use strict';var multer=require(_0xe41a('0x0'));var util=require(_0xe41a('0x1'));var path=require('path');var timeout=require(_0xe41a('0x2'));var express=require(_0xe41a('0x3'));var router=express['Router']();var fs_extra=require(_0xe41a('0x4'));var auth=require(_0xe41a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe41a('0x6'));router[_0xe41a('0x7')]('/',auth[_0xe41a('0x8')](),controller[_0xe41a('0x9')]);router[_0xe41a('0x7')](_0xe41a('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xe41a('0xb'),auth[_0xe41a('0x8')](),controller[_0xe41a('0xc')]);router[_0xe41a('0xd')]('/',auth[_0xe41a('0x8')](),controller['create']);router[_0xe41a('0xe')]('/:id',auth[_0xe41a('0x8')](),controller[_0xe41a('0xf')]);router[_0xe41a('0x10')]('/:id',auth[_0xe41a('0x8')](),controller[_0xe41a('0x11')]);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 1861ba8..ad85fb1 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 _0x45ba=['BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','STRING'];(function(_0x42b938,_0x1ba98c){var _0x5cd611=function(_0xa55185){while(--_0xa55185){_0x42b938['push'](_0x42b938['shift']());}};_0x5cd611(++_0x1ba98c);}(_0x45ba,0x15a));var _0xa45b=function(_0x4cbb7c,_0x1bf567){_0x4cbb7c=_0x4cbb7c-0x0;var _0xde1764=_0x45ba[_0x4cbb7c];return _0xde1764;};'use strict';var Sequelize=require(_0xa45b('0x0'));module[_0xa45b('0x1')]={'name':{'type':Sequelize[_0xa45b('0x2')],'get':function(_0x346182){return this[_0xa45b('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa45b('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xa45b('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa45b('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa45b('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa45b('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xa45b('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xa45b('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xa45b('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa45b('0x4')],'defaultValue':''},'stamp':{'type':_0xa45b('0x6'),'defaultValue':Sequelize[_0xa45b('0x7')](_0xa45b('0x8'))}}; \ No newline at end of file +var _0xd2d0=['VIRTUAL','getDataValue','INTEGER','STRING','long','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x106214,_0x454b8d){var _0x5f5cea=function(_0x247841){while(--_0x247841){_0x106214['push'](_0x106214['shift']());}};_0x5f5cea(++_0x454b8d);}(_0xd2d0,0x17e));var _0x0d2d=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xd2d0[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x0d2d('0x0'));module[_0x0d2d('0x1')]={'name':{'type':Sequelize[_0x0d2d('0x2')],'get':function(_0x57c30b){return this[_0x0d2d('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x0d2d('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x0d2d('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x0d2d('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0d2d('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x0d2d('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x0d2d('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0d2d('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x0d2d('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x0d2d('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0d2d('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x0d2d('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 45ba5bc..ac980bb 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 _0x10b0=['../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','VoiceMailMessage','rawAttributes','type','key','differenceBy','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','destroy','download','recording','Sequelize','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','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/license/hardware','../../config/utils','../../config/license/util'];(function(_0xffd1b5,_0x1ede18){var _0x3176d6=function(_0xe9ba48){while(--_0xe9ba48){_0xffd1b5['push'](_0xffd1b5['shift']());}};_0x3176d6(++_0x1ede18);}(_0x10b0,0x196));var _0x010b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x10b0[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x010b('0x0'));var rimraf=require(_0x010b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x010b('0x2'));var rp=require(_0x010b('0x3'));var moment=require(_0x010b('0x4'));var BPromise=require(_0x010b('0x5'));var Mustache=require(_0x010b('0x6'));var util=require(_0x010b('0x7'));var path=require(_0x010b('0x8'));var sox=require('sox');var csv=require(_0x010b('0x9'));var ejs=require(_0x010b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x010b('0xb'));var squel=require(_0x010b('0xc'));var crypto=require(_0x010b('0xd'));var jsforce=require(_0x010b('0xe'));var deskjs=require(_0x010b('0xf'));var toCsv=require(_0x010b('0x9'));var querystring=require('querystring');var Papa=require(_0x010b('0x10'));var Redis=require(_0x010b('0x11'));var authService=require(_0x010b('0x12'));var qs=require(_0x010b('0x13'));var as=require(_0x010b('0x14'));var hardwareService=require(_0x010b('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x010b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x010b('0x17'));var db=require(_0x010b('0x18'))['db'];function respondWithStatusCode(_0x17bd85,_0x3cea65){_0x3cea65=_0x3cea65||0xcc;return function(_0x30ba92){if(_0x30ba92){return _0x17bd85[_0x010b('0x19')](_0x3cea65);}return _0x17bd85['status'](_0x3cea65)[_0x010b('0x1a')]();};}function respondWithResult(_0x33ae4d,_0xfc0970){_0xfc0970=_0xfc0970||0xc8;return function(_0x25db8d){if(_0x25db8d){return _0x33ae4d[_0x010b('0x1b')](_0xfc0970)[_0x010b('0x1c')](_0x25db8d);}};}function respondWithFilteredResult(_0x4b9301,_0xb52637){return function(_0xeca383){if(_0xeca383){var _0x2cdf81=typeof _0xb52637[_0x010b('0x1d')]==='undefined'&&typeof _0xb52637[_0x010b('0x1e')]===_0x010b('0x1f');var _0xe80f9=_0xeca383[_0x010b('0x20')];var _0x3df2f7=_0x2cdf81?0x0:_0xb52637[_0x010b('0x1d')];var _0x34e601=_0x2cdf81?_0xeca383[_0x010b('0x20')]:_0xb52637['offset']+_0xb52637[_0x010b('0x1e')];var _0x5a3b66;if(_0x34e601>=_0xe80f9){_0x34e601=_0xe80f9;_0x5a3b66=0xc8;}else{_0x5a3b66=0xce;}_0x4b9301[_0x010b('0x1b')](_0x5a3b66);return _0x4b9301[_0x010b('0x21')](_0x010b('0x22'),_0x3df2f7+'-'+_0x34e601+'/'+_0xe80f9)[_0x010b('0x1c')](_0xeca383);}return null;};}function patchUpdates(_0x292eae){return function(_0x247540){try{jsonpatch[_0x010b('0x23')](_0x247540,_0x292eae,!![]);}catch(_0x26250a){return BPromise[_0x010b('0x24')](_0x26250a);}return _0x247540[_0x010b('0x25')]();};}function saveUpdates(_0x42da08,_0x205ae8){return function(_0x4c7083){if(_0x4c7083){return _0x4c7083['update'](_0x42da08)[_0x010b('0x26')](function(_0x323600){return _0x323600;});}return null;};}function removeEntity(_0x46c1d6,_0x154fd3){return function(_0x388c61){if(_0x388c61){return _0x388c61['destroy']()[_0x010b('0x26')](function(){_0x46c1d6['status'](0xcc)[_0x010b('0x1a')]();});}};}function handleEntityNotFound(_0x553f74,_0x375c91){return function(_0xd96214){if(!_0xd96214){_0x553f74[_0x010b('0x19')](0x194);}return _0xd96214;};}function handleError(_0x28a71b,_0x464ed){_0x464ed=_0x464ed||0x1f4;return function(_0x283c74){logger[_0x010b('0x27')](_0x283c74[_0x010b('0x28')]);if(_0x283c74[_0x010b('0x29')]){delete _0x283c74[_0x010b('0x29')];}_0x28a71b[_0x010b('0x1b')](_0x464ed)[_0x010b('0x2a')](_0x283c74);};}exports[_0x010b('0x2b')]=function(_0x49662d,_0x1289c4){var _0x706f80={},_0x53554e={},_0x46045d={'count':0x0,'rows':[]};var _0x3380b9=_['map'](db[_0x010b('0x2c')][_0x010b('0x2d')],function(_0x1ce61c){return{'name':_0x1ce61c['fieldName'],'type':_0x1ce61c[_0x010b('0x2e')][_0x010b('0x2f')]};});_0x53554e['model']=_[_0x010b('0x30')](_[_0x010b('0x31')](_0x3380b9,_0x010b('0x29')),[_0x010b('0x29')]);_0x53554e[_0x010b('0x32')]=_['keys'](_0x49662d[_0x010b('0x32')]);_0x53554e[_0x010b('0x33')]=_[_0x010b('0x34')](_0x53554e[_0x010b('0x35')],_0x53554e[_0x010b('0x32')]);_0x706f80['attributes']=_['intersection'](_0x53554e[_0x010b('0x35')],qs['fields'](_0x49662d[_0x010b('0x32')][_0x010b('0x36')]));_0x706f80['attributes']=_0x706f80[_0x010b('0x37')]['length']?_0x706f80['attributes']:_0x53554e[_0x010b('0x35')];if(!_0x49662d[_0x010b('0x32')][_0x010b('0x38')]('nolimit')){_0x706f80['limit']=qs[_0x010b('0x1e')](_0x49662d['query'][_0x010b('0x1e')]);_0x706f80[_0x010b('0x1d')]=qs['offset'](_0x49662d[_0x010b('0x32')][_0x010b('0x1d')]);}_0x706f80[_0x010b('0x39')]=qs[_0x010b('0x3a')](_0x49662d['query'][_0x010b('0x3a')]);_0x706f80[_0x010b('0x3b')]=qs[_0x010b('0x33')](_[_0x010b('0x3c')](_0x49662d['query'],_0x53554e[_0x010b('0x33')]),_0x3380b9);if(_0x49662d['query'][_0x010b('0x3d')]){_0x706f80[_0x010b('0x3b')]=_[_0x010b('0x3e')](_0x706f80[_0x010b('0x3b')],{'$or':_[_0x010b('0x31')](_0x3380b9,function(_0x4788b3){if(_0x4788b3['type']!==_0x010b('0x3f')){var _0x338b3c={};_0x338b3c[_0x4788b3[_0x010b('0x29')]]={'$like':'%'+_0x49662d[_0x010b('0x32')]['filter']+'%'};return _0x338b3c;}})});}_0x706f80=_['merge']({},_0x706f80,_0x49662d[_0x010b('0x40')]);var _0x290170={'where':_0x706f80[_0x010b('0x3b')]};return db[_0x010b('0x2c')][_0x010b('0x20')](_0x290170)[_0x010b('0x26')](function(_0x1746b6){_0x46045d[_0x010b('0x20')]=_0x1746b6;if(_0x49662d[_0x010b('0x32')][_0x010b('0x41')]){_0x706f80['include']=[{'all':!![]}];}return db[_0x010b('0x2c')][_0x010b('0x42')](_0x706f80);})[_0x010b('0x26')](function(_0x262565){_0x46045d[_0x010b('0x43')]=_0x262565;return _0x46045d;})[_0x010b('0x26')](respondWithFilteredResult(_0x1289c4,_0x706f80))[_0x010b('0x44')](handleError(_0x1289c4,null));};exports[_0x010b('0x45')]=function(_0x4e4704,_0x4c43f9){var _0xa15e0a={'raw':!![],'where':{'id':_0x4e4704[_0x010b('0x46')]['id']}},_0x1d6325={};_0x1d6325['model']=_[_0x010b('0x47')](db[_0x010b('0x2c')]['rawAttributes']);_0x1d6325[_0x010b('0x32')]=_[_0x010b('0x47')](_0x4e4704[_0x010b('0x32')]);_0x1d6325[_0x010b('0x33')]=_[_0x010b('0x34')](_0x1d6325['model'],_0x1d6325[_0x010b('0x32')]);_0xa15e0a[_0x010b('0x37')]=_[_0x010b('0x34')](_0x1d6325[_0x010b('0x35')],qs[_0x010b('0x36')](_0x4e4704[_0x010b('0x32')][_0x010b('0x36')]));_0xa15e0a[_0x010b('0x37')]=_0xa15e0a[_0x010b('0x37')][_0x010b('0x48')]?_0xa15e0a[_0x010b('0x37')]:_0x1d6325[_0x010b('0x35')];if(_0x4e4704[_0x010b('0x32')][_0x010b('0x41')]){_0xa15e0a[_0x010b('0x49')]=[{'all':!![]}];}_0xa15e0a=_[_0x010b('0x3e')]({},_0xa15e0a,_0x4e4704[_0x010b('0x40')]);return db[_0x010b('0x2c')][_0x010b('0x4a')](_0xa15e0a)['then'](handleEntityNotFound(_0x4c43f9,null))[_0x010b('0x26')](respondWithResult(_0x4c43f9,null))[_0x010b('0x44')](handleError(_0x4c43f9,null));};exports[_0x010b('0x4b')]=function(_0x98d8a0,_0x46efa0){return db['VoiceMailMessage'][_0x010b('0x4b')](_0x98d8a0[_0x010b('0x4c')],{})[_0x010b('0x26')](respondWithResult(_0x46efa0,0xc9))['catch'](handleError(_0x46efa0,null));};exports['update']=function(_0x4e7ff1,_0x411095){if(_0x4e7ff1[_0x010b('0x4c')]['id']){delete _0x4e7ff1[_0x010b('0x4c')]['id'];}return db[_0x010b('0x2c')]['find']({'where':{'id':_0x4e7ff1[_0x010b('0x46')]['id']}})['then'](handleEntityNotFound(_0x411095,null))[_0x010b('0x26')](saveUpdates(_0x4e7ff1[_0x010b('0x4c')],null))[_0x010b('0x26')](respondWithResult(_0x411095,null))[_0x010b('0x44')](handleError(_0x411095,null));};exports[_0x010b('0x4d')]=function(_0x3e0cef,_0x6cda25){return db[_0x010b('0x2c')][_0x010b('0x4a')]({'where':{'id':_0x3e0cef[_0x010b('0x46')]['id']}})[_0x010b('0x26')](handleEntityNotFound(_0x6cda25,null))[_0x010b('0x26')](removeEntity(_0x6cda25,null))[_0x010b('0x44')](handleError(_0x6cda25,null));};exports[_0x010b('0x4e')]=function(_0x1ac98d,_0x233a4b,_0xf3bc28){return db['VoiceMailMessage']['find']({'where':{'id':_0x1ac98d[_0x010b('0x46')]['id']},'attributes':['id',_0x010b('0x4f'),'msg_id']})[_0x010b('0x26')](handleEntityNotFound(_0x233a4b,null))[_0x010b('0x26')](function(_0x338ef8){if(_0x338ef8){if(!_0x338ef8[_0x010b('0x4f')]){throw new db[(_0x010b('0x50'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0xde81c1={'Content-Type':_0x010b('0x51'),'Content-Disposition':_0x010b('0x52')};if(_0x338ef8['msg_id']){_0xde81c1[_0x010b('0x53')]=_0x010b('0x54')+_0x338ef8['msg_id']+_0x010b('0x55');}_0x233a4b['set'](_0xde81c1);return _0x233a4b[_0x010b('0x2a')](new Buffer(_0x338ef8[_0x010b('0x4f')]));}})[_0x010b('0x44')](handleError(_0x233a4b,null));}; \ No newline at end of file +var _0xacd0=['where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','.wav\x22','set','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1514b1,_0x5bfe61){var _0x28cdfe=function(_0xf79d8b){while(--_0xf79d8b){_0x1514b1['push'](_0x1514b1['shift']());}};_0x28cdfe(++_0x5bfe61);}(_0xacd0,0x70));var _0x0acd=function(_0x4689d0,_0x5a28c5){_0x4689d0=_0x4689d0-0x0;var _0xb61270=_0xacd0[_0x4689d0];return _0xb61270;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0acd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0acd('0x1'));var rp=require(_0x0acd('0x2'));var moment=require(_0x0acd('0x3'));var BPromise=require(_0x0acd('0x4'));var Mustache=require(_0x0acd('0x5'));var util=require(_0x0acd('0x6'));var path=require(_0x0acd('0x7'));var sox=require(_0x0acd('0x8'));var csv=require(_0x0acd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0acd('0xa'));var _=require(_0x0acd('0xb'));var squel=require(_0x0acd('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0acd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0acd('0xe'));var Redis=require(_0x0acd('0xf'));var authService=require(_0x0acd('0x10'));var qs=require(_0x0acd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0acd('0x12'))(_0x0acd('0x13'));var utils=require(_0x0acd('0x14'));var config=require(_0x0acd('0x15'));var licenseUtil=require(_0x0acd('0x16'));var db=require(_0x0acd('0x17'))['db'];function respondWithStatusCode(_0x18150e,_0x1aac4e){_0x1aac4e=_0x1aac4e||0xcc;return function(_0x187411){if(_0x187411){return _0x18150e[_0x0acd('0x18')](_0x1aac4e);}return _0x18150e[_0x0acd('0x19')](_0x1aac4e)[_0x0acd('0x1a')]();};}function respondWithResult(_0x553b40,_0x8778b7){_0x8778b7=_0x8778b7||0xc8;return function(_0x5e321e){if(_0x5e321e){return _0x553b40['status'](_0x8778b7)['json'](_0x5e321e);}};}function respondWithFilteredResult(_0x2f57e3,_0x28002f){return function(_0x4d50c0){if(_0x4d50c0){var _0x51bde2=typeof _0x28002f['offset']===_0x0acd('0x1b')&&typeof _0x28002f[_0x0acd('0x1c')]==='undefined';var _0x551320=_0x4d50c0[_0x0acd('0x1d')];var _0x1e5fc6=_0x51bde2?0x0:_0x28002f[_0x0acd('0x1e')];var _0xf99843=_0x51bde2?_0x4d50c0[_0x0acd('0x1d')]:_0x28002f['offset']+_0x28002f[_0x0acd('0x1c')];var _0x4a4624;if(_0xf99843>=_0x551320){_0xf99843=_0x551320;_0x4a4624=0xc8;}else{_0x4a4624=0xce;}_0x2f57e3['status'](_0x4a4624);return _0x2f57e3['set'](_0x0acd('0x1f'),_0x1e5fc6+'-'+_0xf99843+'/'+_0x551320)['json'](_0x4d50c0);}return null;};}function patchUpdates(_0x3f5f4c){return function(_0xa0f9dd){try{jsonpatch[_0x0acd('0x20')](_0xa0f9dd,_0x3f5f4c,!![]);}catch(_0x4e47f7){return BPromise[_0x0acd('0x21')](_0x4e47f7);}return _0xa0f9dd[_0x0acd('0x22')]();};}function saveUpdates(_0x14b30f,_0x4612b2){return function(_0x5877b5){if(_0x5877b5){return _0x5877b5[_0x0acd('0x23')](_0x14b30f)[_0x0acd('0x24')](function(_0x2c61d8){return _0x2c61d8;});}return null;};}function removeEntity(_0x822b0f,_0x33e8cb){return function(_0x5dc346){if(_0x5dc346){return _0x5dc346[_0x0acd('0x25')]()[_0x0acd('0x24')](function(){_0x822b0f[_0x0acd('0x19')](0xcc)[_0x0acd('0x1a')]();});}};}function handleEntityNotFound(_0x262620,_0x4e84ed){return function(_0x3fee65){if(!_0x3fee65){_0x262620[_0x0acd('0x18')](0x194);}return _0x3fee65;};}function handleError(_0x36394f,_0x12d667){_0x12d667=_0x12d667||0x1f4;return function(_0x38c1ce){logger[_0x0acd('0x26')](_0x38c1ce[_0x0acd('0x27')]);if(_0x38c1ce[_0x0acd('0x28')]){delete _0x38c1ce['name'];}_0x36394f[_0x0acd('0x19')](_0x12d667)[_0x0acd('0x29')](_0x38c1ce);};}exports[_0x0acd('0x2a')]=function(_0x33fed6,_0x50c764){var _0x560436={},_0x226166={},_0x44c6c7={'count':0x0,'rows':[]};var _0x7cbd1b=_[_0x0acd('0x2b')](db[_0x0acd('0x2c')]['rawAttributes'],function(_0x2e555b){return{'name':_0x2e555b['fieldName'],'type':_0x2e555b[_0x0acd('0x2d')][_0x0acd('0x2e')]};});_0x226166[_0x0acd('0x2f')]=_[_0x0acd('0x30')](_['map'](_0x7cbd1b,'name'),[_0x0acd('0x28')]);_0x226166[_0x0acd('0x31')]=_[_0x0acd('0x32')](_0x33fed6['query']);_0x226166[_0x0acd('0x33')]=_[_0x0acd('0x34')](_0x226166[_0x0acd('0x2f')],_0x226166[_0x0acd('0x31')]);_0x560436['attributes']=_['intersection'](_0x226166[_0x0acd('0x2f')],qs['fields'](_0x33fed6[_0x0acd('0x31')][_0x0acd('0x35')]));_0x560436[_0x0acd('0x36')]=_0x560436[_0x0acd('0x36')][_0x0acd('0x37')]?_0x560436[_0x0acd('0x36')]:_0x226166[_0x0acd('0x2f')];if(!_0x33fed6[_0x0acd('0x31')][_0x0acd('0x38')](_0x0acd('0x39'))){_0x560436[_0x0acd('0x1c')]=qs[_0x0acd('0x1c')](_0x33fed6['query'][_0x0acd('0x1c')]);_0x560436[_0x0acd('0x1e')]=qs['offset'](_0x33fed6[_0x0acd('0x31')]['offset']);}_0x560436[_0x0acd('0x3a')]=qs['sort'](_0x33fed6['query'][_0x0acd('0x3b')]);_0x560436[_0x0acd('0x3c')]=qs[_0x0acd('0x33')](_[_0x0acd('0x3d')](_0x33fed6['query'],_0x226166[_0x0acd('0x33')]),_0x7cbd1b);if(_0x33fed6[_0x0acd('0x31')][_0x0acd('0x3e')]){_0x560436['where']=_[_0x0acd('0x3f')](_0x560436[_0x0acd('0x3c')],{'$or':_[_0x0acd('0x2b')](_0x7cbd1b,function(_0x1dabe1){if(_0x1dabe1[_0x0acd('0x2d')]!=='VIRTUAL'){var _0x5070db={};_0x5070db[_0x1dabe1[_0x0acd('0x28')]]={'$like':'%'+_0x33fed6[_0x0acd('0x31')][_0x0acd('0x3e')]+'%'};return _0x5070db;}})});}_0x560436=_[_0x0acd('0x3f')]({},_0x560436,_0x33fed6[_0x0acd('0x40')]);var _0x3b8c8d={'where':_0x560436[_0x0acd('0x3c')]};return db[_0x0acd('0x2c')]['count'](_0x3b8c8d)[_0x0acd('0x24')](function(_0x2d54ed){_0x44c6c7[_0x0acd('0x1d')]=_0x2d54ed;if(_0x33fed6['query'][_0x0acd('0x41')]){_0x560436[_0x0acd('0x42')]=[{'all':!![]}];}return db[_0x0acd('0x2c')][_0x0acd('0x43')](_0x560436);})[_0x0acd('0x24')](function(_0x4e55f5){_0x44c6c7[_0x0acd('0x44')]=_0x4e55f5;return _0x44c6c7;})[_0x0acd('0x24')](respondWithFilteredResult(_0x50c764,_0x560436))['catch'](handleError(_0x50c764,null));};exports[_0x0acd('0x45')]=function(_0x1a7b26,_0x53345d){var _0x24f3d9={'raw':!![],'where':{'id':_0x1a7b26[_0x0acd('0x46')]['id']}},_0x316058={};_0x316058[_0x0acd('0x2f')]=_[_0x0acd('0x32')](db[_0x0acd('0x2c')][_0x0acd('0x47')]);_0x316058['query']=_[_0x0acd('0x32')](_0x1a7b26[_0x0acd('0x31')]);_0x316058[_0x0acd('0x33')]=_['intersection'](_0x316058[_0x0acd('0x2f')],_0x316058['query']);_0x24f3d9['attributes']=_['intersection'](_0x316058['model'],qs[_0x0acd('0x35')](_0x1a7b26[_0x0acd('0x31')][_0x0acd('0x35')]));_0x24f3d9[_0x0acd('0x36')]=_0x24f3d9['attributes'][_0x0acd('0x37')]?_0x24f3d9[_0x0acd('0x36')]:_0x316058[_0x0acd('0x2f')];if(_0x1a7b26['query'][_0x0acd('0x41')]){_0x24f3d9['include']=[{'all':!![]}];}_0x24f3d9=_['merge']({},_0x24f3d9,_0x1a7b26['options']);return db[_0x0acd('0x2c')][_0x0acd('0x48')](_0x24f3d9)[_0x0acd('0x24')](handleEntityNotFound(_0x53345d,null))['then'](respondWithResult(_0x53345d,null))[_0x0acd('0x49')](handleError(_0x53345d,null));};exports[_0x0acd('0x4a')]=function(_0x1d7886,_0x43cbd4){return db['VoiceMailMessage'][_0x0acd('0x4a')](_0x1d7886[_0x0acd('0x4b')],{})[_0x0acd('0x24')](respondWithResult(_0x43cbd4,0xc9))['catch'](handleError(_0x43cbd4,null));};exports[_0x0acd('0x23')]=function(_0x23b415,_0x2f61ab){if(_0x23b415[_0x0acd('0x4b')]['id']){delete _0x23b415[_0x0acd('0x4b')]['id'];}return db[_0x0acd('0x2c')]['find']({'where':{'id':_0x23b415[_0x0acd('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f61ab,null))[_0x0acd('0x24')](saveUpdates(_0x23b415[_0x0acd('0x4b')],null))['then'](respondWithResult(_0x2f61ab,null))[_0x0acd('0x49')](handleError(_0x2f61ab,null));};exports[_0x0acd('0x25')]=function(_0x45171a,_0x6df167){return db[_0x0acd('0x2c')][_0x0acd('0x48')]({'where':{'id':_0x45171a[_0x0acd('0x46')]['id']}})[_0x0acd('0x24')](handleEntityNotFound(_0x6df167,null))[_0x0acd('0x24')](removeEntity(_0x6df167,null))[_0x0acd('0x49')](handleError(_0x6df167,null));};exports[_0x0acd('0x4c')]=function(_0xb179f9,_0x6545a3,_0x244bf5){return db['VoiceMailMessage'][_0x0acd('0x48')]({'where':{'id':_0xb179f9[_0x0acd('0x46')]['id']},'attributes':['id',_0x0acd('0x4d'),_0x0acd('0x4e')]})[_0x0acd('0x24')](handleEntityNotFound(_0x6545a3,null))['then'](function(_0x246730){if(_0x246730){if(!_0x246730[_0x0acd('0x4d')]){throw new db[(_0x0acd('0x4f'))][(_0x0acd('0x50'))]('VoiceMailMessage\x20not\x20found');}var _0x193b15={'Content-Type':_0x0acd('0x51'),'Content-Disposition':_0x0acd('0x52')};if(_0x246730['msg_id']){_0x193b15[_0x0acd('0x53')]='attachment;\x20filename=\x22'+_0x246730[_0x0acd('0x4e')]+_0x0acd('0x54');}_0x6545a3[_0x0acd('0x55')](_0x193b15);return _0x6545a3[_0x0acd('0x29')](new Buffer(_0x246730[_0x0acd('0x4d')]));}})[_0x0acd('0x49')](handleError(_0x6545a3,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 037f4bd..c12fb03 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 _0xb70f=['bluebird','path','rimraf','../../config/environment','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment'];(function(_0x5b17b4,_0x5a3221){var _0x55af79=function(_0x888225){while(--_0x888225){_0x5b17b4['push'](_0x5b17b4['shift']());}};_0x55af79(++_0x5a3221);}(_0xb70f,0x14d));var _0xfb70=function(_0x501cf3,_0x266818){_0x501cf3=_0x501cf3-0x0;var _0x36c4ab=_0xb70f[_0x501cf3];return _0x36c4ab;};'use strict';var _=require(_0xfb70('0x0'));var util=require(_0xfb70('0x1'));var logger=require(_0xfb70('0x2'))(_0xfb70('0x3'));var moment=require(_0xfb70('0x4'));var BPromise=require(_0xfb70('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb70('0x6'));var rimraf=require(_0xfb70('0x7'));var config=require(_0xfb70('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0xfb70('0x9')]=function(_0x2e5b23,_0x779a03){return _0x2e5b23['define'](_0xfb70('0xa'),attributes,{'tableName':_0xfb70('0xb'),'paranoid':![],'indexes':[{'name':_0xfb70('0xc'),'fields':[_0xfb70('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf315=['VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x361798,_0x486a6d){var _0x41091b=function(_0x2bfd25){while(--_0x2bfd25){_0x361798['push'](_0x361798['shift']());}};_0x41091b(++_0x486a6d);}(_0xf315,0x1f2));var _0x5f31=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf315[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x5f31('0x0'));var logger=require(_0x5f31('0x1'))(_0x5f31('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5f31('0x3'));var config=require(_0x5f31('0x4'));var attributes=require(_0x5f31('0x5'));module[_0x5f31('0x6')]=function(_0x40dc25,_0x2e6af0){return _0x40dc25[_0x5f31('0x7')](_0x5f31('0x8'),attributes,{'tableName':_0x5f31('0x9'),'paranoid':![],'indexes':[{'name':_0x5f31('0xa'),'fields':[_0x5f31('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index a4136ab..494194e 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 _0x8f7b=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x412dd8,_0x355780){var _0x47b96=function(_0x58b680){while(--_0x58b680){_0x412dd8['push'](_0x412dd8['shift']());}};_0x47b96(++_0x355780);}(_0x8f7b,0x16d));var _0xb8f7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8f7b[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xb8f7('0x0'));var util=require(_0xb8f7('0x1'));var moment=require(_0xb8f7('0x2'));var BPromise=require(_0xb8f7('0x3'));var rs=require(_0xb8f7('0x4'));var fs=require('fs');var Redis=require(_0xb8f7('0x5'));var db=require(_0xb8f7('0x6'))['db'];var utils=require(_0xb8f7('0x7'));var logger=require('../../config/logger')(_0xb8f7('0x8'));var config=require('../../config/environment');var jayson=require(_0xb8f7('0x9'));var client=jayson[_0xb8f7('0xa')][_0xb8f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f7940,_0xd1cada,_0xa44f7d){return new BPromise(function(_0xb31221,_0x39b619){return client[_0xb8f7('0xc')](_0x1f7940,_0xa44f7d)[_0xb8f7('0xd')](function(_0x55ae41){logger[_0xb8f7('0xe')](_0xb8f7('0xf'),_0xd1cada,_0xb8f7('0x10'));logger[_0xb8f7('0x11')](_0xb8f7('0x12'),_0xd1cada,_0xb8f7('0x10'),JSON[_0xb8f7('0x13')](_0x55ae41));if(_0x55ae41[_0xb8f7('0x14')]){if(_0x55ae41[_0xb8f7('0x14')][_0xb8f7('0x15')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0xd1cada,_0x55ae41['error']['message']);return _0x39b619(_0x55ae41['error'][_0xb8f7('0x16')]);}logger[_0xb8f7('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0xd1cada,_0x55ae41[_0xb8f7('0x14')][_0xb8f7('0x16')]);return _0xb31221(_0x55ae41[_0xb8f7('0x14')][_0xb8f7('0x16')]);}else{logger[_0xb8f7('0xe')](_0xb8f7('0xf'),_0xd1cada,_0xb8f7('0x10'));_0xb31221(_0x55ae41['result']['message']);}})[_0xb8f7('0x17')](function(_0x498a46){logger[_0xb8f7('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0xd1cada,_0x498a46);_0x39b619(_0x498a46);});});} \ No newline at end of file +var _0xe696=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2c466f,_0x5203a9){var _0x8eeef4=function(_0x24e9d3){while(--_0x24e9d3){_0x2c466f['push'](_0x2c466f['shift']());}};_0x8eeef4(++_0x5203a9);}(_0xe696,0x1a0));var _0x6e69=function(_0x11994e,_0x4e6a1d){_0x11994e=_0x11994e-0x0;var _0x456d3a=_0xe696[_0x11994e];return _0x456d3a;};'use strict';var _=require('lodash');var util=require(_0x6e69('0x0'));var moment=require(_0x6e69('0x1'));var BPromise=require(_0x6e69('0x2'));var rs=require(_0x6e69('0x3'));var fs=require('fs');var Redis=require(_0x6e69('0x4'));var db=require(_0x6e69('0x5'))['db'];var utils=require(_0x6e69('0x6'));var logger=require('../../config/logger')(_0x6e69('0x7'));var config=require(_0x6e69('0x8'));var jayson=require(_0x6e69('0x9'));var client=jayson['client'][_0x6e69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47709f,_0x9c587,_0x14f343){return new BPromise(function(_0x2cef54,_0x19c11c){return client[_0x6e69('0xb')](_0x47709f,_0x14f343)['then'](function(_0x21b7fa){logger[_0x6e69('0xc')](_0x6e69('0xd'),_0x9c587,_0x6e69('0xe'));logger[_0x6e69('0xf')](_0x6e69('0x10'),_0x9c587,_0x6e69('0xe'),JSON[_0x6e69('0x11')](_0x21b7fa));if(_0x21b7fa[_0x6e69('0x12')]){if(_0x21b7fa[_0x6e69('0x12')][_0x6e69('0x13')]===0x1f4){logger[_0x6e69('0x12')](_0x6e69('0xd'),_0x9c587,_0x21b7fa[_0x6e69('0x12')]['message']);return _0x19c11c(_0x21b7fa[_0x6e69('0x12')][_0x6e69('0x14')]);}logger[_0x6e69('0x12')](_0x6e69('0xd'),_0x9c587,_0x21b7fa[_0x6e69('0x12')][_0x6e69('0x14')]);return _0x2cef54(_0x21b7fa[_0x6e69('0x12')][_0x6e69('0x14')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x9c587,'request\x20sent');_0x2cef54(_0x21b7fa[_0x6e69('0x15')][_0x6e69('0x14')]);}})[_0x6e69('0x16')](function(_0x5445c6){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x9c587,_0x5445c6);_0x19c11c(_0x5445c6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f1d4424..2b58f79 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 _0xec89=['isAuthenticated','show','getSounds','post','/:id/sounds','addSound','/:id','destroy','delete','removeSound','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','index'];(function(_0x642bd7,_0x2950eb){var _0x2c49e5=function(_0x58b53f){while(--_0x58b53f){_0x642bd7['push'](_0x642bd7['shift']());}};_0x2c49e5(++_0x2950eb);}(_0xec89,0x16b));var _0x9ec8=function(_0x36adda,_0x1c396c){_0x36adda=_0x36adda-0x0;var _0x182992=_0xec89[_0x36adda];return _0x182992;};'use strict';var multer=require(_0x9ec8('0x0'));var util=require(_0x9ec8('0x1'));var path=require(_0x9ec8('0x2'));var timeout=require('connect-timeout');var express=require(_0x9ec8('0x3'));var router=express[_0x9ec8('0x4')]();var fs_extra=require(_0x9ec8('0x5'));var auth=require(_0x9ec8('0x6'));var interaction=require(_0x9ec8('0x7'));var config=require('../../config/environment');var controller=require(_0x9ec8('0x8'));router[_0x9ec8('0x9')]('/',auth['isAuthenticated'](),controller[_0x9ec8('0xa')]);router[_0x9ec8('0x9')]('/:id',auth[_0x9ec8('0xb')](),controller[_0x9ec8('0xc')]);router[_0x9ec8('0x9')]('/:id/sounds',auth[_0x9ec8('0xb')](),controller[_0x9ec8('0xd')]);router[_0x9ec8('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9ec8('0xf'),auth[_0x9ec8('0xb')](),controller[_0x9ec8('0x10')]);router['put'](_0x9ec8('0x11'),auth[_0x9ec8('0xb')](),controller['update']);router['delete'](_0x9ec8('0x11'),auth[_0x9ec8('0xb')](),controller[_0x9ec8('0x12')]);router[_0x9ec8('0x13')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x9ec8('0x14')]);module[_0x9ec8('0x15')]=router; \ No newline at end of file +var _0xde41=['../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','getSounds','post','create','/:id/sounds','update','delete','removeSound','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x117007,_0x4d3414){var _0x2e5522=function(_0x1f9459){while(--_0x1f9459){_0x117007['push'](_0x117007['shift']());}};_0x2e5522(++_0x4d3414);}(_0xde41,0x72));var _0x1de4=function(_0x38e765,_0x2b9189){_0x38e765=_0x38e765-0x0;var _0x5512e3=_0xde41[_0x38e765];return _0x5512e3;};'use strict';var multer=require(_0x1de4('0x0'));var util=require(_0x1de4('0x1'));var path=require('path');var timeout=require(_0x1de4('0x2'));var express=require('express');var router=express[_0x1de4('0x3')]();var fs_extra=require(_0x1de4('0x4'));var auth=require(_0x1de4('0x5'));var interaction=require(_0x1de4('0x6'));var config=require(_0x1de4('0x7'));var controller=require(_0x1de4('0x8'));router[_0x1de4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1de4('0x9')](_0x1de4('0xa'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/sounds',auth[_0x1de4('0xb')](),controller[_0x1de4('0xc')]);router[_0x1de4('0xd')]('/',auth[_0x1de4('0xb')](),controller[_0x1de4('0xe')]);router[_0x1de4('0xd')](_0x1de4('0xf'),auth['isAuthenticated'](),controller['addSound']);router['put'](_0x1de4('0xa'),auth['isAuthenticated'](),controller[_0x1de4('0x10')]);router[_0x1de4('0x11')](_0x1de4('0xa'),auth[_0x1de4('0xb')](),controller['destroy']);router['delete']('/:id/sounds/:id2',auth[_0x1de4('0xb')](),controller[_0x1de4('0x12')]);module[_0x1de4('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 7c1594f..dcc0451 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 _0x3d01=['files','STRING','TIMESTAMP','BOOLEAN','sequelize','exports','custom','mp3nb','quietmp3nb','quietmp3','mp3'];(function(_0x208c12,_0xa84ba4){var _0x238060=function(_0x85d05f){while(--_0x85d05f){_0x208c12['push'](_0x208c12['shift']());}};_0x238060(++_0xa84ba4);}(_0x3d01,0x1d2));var _0x13d0=function(_0x4904cd,_0x438a8b){_0x4904cd=_0x4904cd-0x0;var _0x2842e0=_0x3d01[_0x4904cd];return _0x2842e0;};'use strict';var Sequelize=require(_0x13d0('0x0'));module[_0x13d0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x13d0('0x2'),'files',_0x13d0('0x3'),_0x13d0('0x4'),_0x13d0('0x5'),_0x13d0('0x6')),'allowNull':!![],'defaultValue':_0x13d0('0x7')},'directory':{'type':Sequelize[_0x13d0('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x13d0('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x13d0('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x13d0('0x8')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x13d0('0x9')},'defaultEntry':{'type':Sequelize[_0x13d0('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e21=['sequelize','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','STRING','alpha','BOOLEAN'];(function(_0x45094e,_0x570d4e){var _0x2b2905=function(_0x27456c){while(--_0x27456c){_0x45094e['push'](_0x45094e['shift']());}};_0x2b2905(++_0x570d4e);}(_0x3e21,0x1d9));var _0x13e2=function(_0x5eb4af,_0x5a73fb){_0x5eb4af=_0x5eb4af-0x0;var _0x2107cc=_0x3e21[_0x5eb4af];return _0x2107cc;};'use strict';var Sequelize=require(_0x13e2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x13e2('0x1')](_0x13e2('0x2'),_0x13e2('0x3'),_0x13e2('0x4'),_0x13e2('0x5'),_0x13e2('0x6'),_0x13e2('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x13e2('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x13e2('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x13e2('0x8')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x13e2('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x13e2('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 25e701c..373c497 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 _0x099f=['undefined','count','limit','Content-Range','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','error','name','send','index','map','VoiceMusicOnHold','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','includeAll','findAll','rows','catch','include','body','find','params','create','sequelize','mode','directory','server/files/moh','files','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','addSound','Sound','save_name','createdAt','root','format','%s.%s','basename','converted_format','symlinkSync','message','removeSound','id2','getSounds','findOne','rawAttributes','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x41017c,_0x43599a){var _0x2ea5ff=function(_0x31f64f){while(--_0x31f64f){_0x41017c['push'](_0x41017c['shift']());}};_0x2ea5ff(++_0x43599a);}(_0x099f,0x196));var _0xf099=function(_0x580d3e,_0x40eb3c){_0x580d3e=_0x580d3e-0x0;var _0x267afe=_0x099f[_0x580d3e];return _0x267afe;};'use strict';var emlformat=require(_0xf099('0x0'));var rimraf=require(_0xf099('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf099('0x2'));var rp=require(_0xf099('0x3'));var moment=require(_0xf099('0x4'));var BPromise=require(_0xf099('0x5'));var Mustache=require(_0xf099('0x6'));var util=require(_0xf099('0x7'));var path=require('path');var sox=require(_0xf099('0x8'));var csv=require(_0xf099('0x9'));var ejs=require(_0xf099('0xa'));var fs=require('fs');var fs_extra=require(_0xf099('0xb'));var _=require(_0xf099('0xc'));var squel=require('squel');var crypto=require(_0xf099('0xd'));var jsforce=require(_0xf099('0xe'));var deskjs=require(_0xf099('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf099('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf099('0x11'));var qs=require(_0xf099('0x12'));var as=require(_0xf099('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf099('0x14'))(_0xf099('0x15'));var utils=require(_0xf099('0x16'));var config=require(_0xf099('0x17'));var licenseUtil=require(_0xf099('0x18'));var db=require(_0xf099('0x19'))['db'];function respondWithStatusCode(_0x1c9449,_0x224142){_0x224142=_0x224142||0xcc;return function(_0x5d313f){if(_0x5d313f){return _0x1c9449[_0xf099('0x1a')](_0x224142);}return _0x1c9449[_0xf099('0x1b')](_0x224142)['end']();};}function respondWithResult(_0x4b3a6e,_0x330db1){_0x330db1=_0x330db1||0xc8;return function(_0x363ff7){if(_0x363ff7){return _0x4b3a6e[_0xf099('0x1b')](_0x330db1)[_0xf099('0x1c')](_0x363ff7);}};}function respondWithFilteredResult(_0xb478dd,_0x3fa2c3){return function(_0x206441){if(_0x206441){var _0x3615d0=typeof _0x3fa2c3[_0xf099('0x1d')]==='undefined'&&typeof _0x3fa2c3['limit']===_0xf099('0x1e');var _0xaebf33=_0x206441[_0xf099('0x1f')];var _0x241d70=_0x3615d0?0x0:_0x3fa2c3[_0xf099('0x1d')];var _0x52490e=_0x3615d0?_0x206441['count']:_0x3fa2c3[_0xf099('0x1d')]+_0x3fa2c3[_0xf099('0x20')];var _0x23cdc1;if(_0x52490e>=_0xaebf33){_0x52490e=_0xaebf33;_0x23cdc1=0xc8;}else{_0x23cdc1=0xce;}_0xb478dd[_0xf099('0x1b')](_0x23cdc1);return _0xb478dd['set'](_0xf099('0x21'),_0x241d70+'-'+_0x52490e+'/'+_0xaebf33)[_0xf099('0x1c')](_0x206441);}return null;};}function patchUpdates(_0x26046c){return function(_0x435a40){try{jsonpatch['apply'](_0x435a40,_0x26046c,!![]);}catch(_0x5b107d){return BPromise['reject'](_0x5b107d);}return _0x435a40[_0xf099('0x22')]();};}function saveUpdates(_0x4ad2b6,_0x33b105){return function(_0x52acbd){if(_0x52acbd){return _0x52acbd[_0xf099('0x23')](_0x4ad2b6)['then'](function(_0x433cc8){return _0x433cc8;});}return null;};}function removeEntity(_0x5df26d,_0x26fb43){return function(_0x4b19ec){if(_0x4b19ec){return _0x4b19ec[_0xf099('0x24')]()[_0xf099('0x25')](function(){var _0x469192=_0x4b19ec[_0xf099('0x26')]({'plain':!![]});var _0x1ab7f2=_0xf099('0x27');return db[_0xf099('0x28')][_0xf099('0x24')]({'where':{'type':_0x1ab7f2,'resourceId':_0x469192['id']}})[_0xf099('0x25')](function(){return _0x4b19ec;});})[_0xf099('0x25')](function(){_0x5df26d[_0xf099('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34980,_0x3310e7){return function(_0x52a281){if(!_0x52a281){_0x34980[_0xf099('0x1a')](0x194);}return _0x52a281;};}function handleError(_0xa01f0c,_0x44fc4e){_0x44fc4e=_0x44fc4e||0x1f4;return function(_0x30281c){logger[_0xf099('0x29')](_0x30281c['stack']);if(_0x30281c['name']){delete _0x30281c[_0xf099('0x2a')];}_0xa01f0c[_0xf099('0x1b')](_0x44fc4e)[_0xf099('0x2b')](_0x30281c);};}exports[_0xf099('0x2c')]=function(_0x3b39f0,_0x48f6db){var _0x26e852={},_0x3ce5d8={},_0x176d2b={'count':0x0,'rows':[]};var _0x39dbc0=_[_0xf099('0x2d')](db[_0xf099('0x2e')]['rawAttributes'],function(_0x54e883){return{'name':_0x54e883[_0xf099('0x2f')],'type':_0x54e883['type'][_0xf099('0x30')]};});_0x3ce5d8[_0xf099('0x31')]=_[_0xf099('0x2d')](_0x39dbc0,_0xf099('0x2a'));_0x3ce5d8[_0xf099('0x32')]=_[_0xf099('0x33')](_0x3b39f0[_0xf099('0x32')]);_0x3ce5d8[_0xf099('0x34')]=_[_0xf099('0x35')](_0x3ce5d8[_0xf099('0x31')],_0x3ce5d8[_0xf099('0x32')]);_0x26e852[_0xf099('0x36')]=_['intersection'](_0x3ce5d8[_0xf099('0x31')],qs[_0xf099('0x37')](_0x3b39f0[_0xf099('0x32')][_0xf099('0x37')]));_0x26e852[_0xf099('0x36')]=_0x26e852[_0xf099('0x36')][_0xf099('0x38')]?_0x26e852[_0xf099('0x36')]:_0x3ce5d8[_0xf099('0x31')];if(!_0x3b39f0[_0xf099('0x32')]['hasOwnProperty'](_0xf099('0x39'))){_0x26e852['limit']=qs[_0xf099('0x20')](_0x3b39f0[_0xf099('0x32')][_0xf099('0x20')]);_0x26e852[_0xf099('0x1d')]=qs[_0xf099('0x1d')](_0x3b39f0[_0xf099('0x32')]['offset']);}_0x26e852[_0xf099('0x3a')]=qs['sort'](_0x3b39f0[_0xf099('0x32')][_0xf099('0x3b')]);delete _0x3b39f0[_0xf099('0x32')][_0xf099('0x3b')];_0x26e852[_0xf099('0x3c')]=qs[_0xf099('0x34')](_['pick'](_0x3b39f0['query'],_0x3ce5d8[_0xf099('0x34')]),_0x39dbc0);if(_0x3b39f0[_0xf099('0x32')][_0xf099('0x3d')]){_0x26e852['where']=_[_0xf099('0x3e')](_0x26e852['where'],{'$or':_[_0xf099('0x2d')](_0x39dbc0,function(_0x4b7ad7){if(_0x4b7ad7[_0xf099('0x3f')]!=='VIRTUAL'){var _0x5147df={};_0x5147df[_0x4b7ad7[_0xf099('0x2a')]]={'$like':'%'+_0x3b39f0[_0xf099('0x32')]['filter']+'%'};return _0x5147df;}})});}_0x26e852=_[_0xf099('0x3e')]({},_0x26e852,_0x3b39f0['options']);var _0xa2c7e8={'where':_0x26e852[_0xf099('0x3c')]};return db[_0xf099('0x2e')][_0xf099('0x1f')](_0xa2c7e8)[_0xf099('0x25')](function(_0x4e709d){_0x176d2b[_0xf099('0x1f')]=_0x4e709d;if(_0x3b39f0[_0xf099('0x32')][_0xf099('0x40')]){_0x26e852['include']=[{'all':!![]}];}return db[_0xf099('0x2e')][_0xf099('0x41')](_0x26e852);})[_0xf099('0x25')](function(_0x3c9edf){_0x176d2b[_0xf099('0x42')]=_0x3c9edf;return _0x176d2b;})[_0xf099('0x25')](respondWithFilteredResult(_0x48f6db,_0x26e852))[_0xf099('0x43')](handleError(_0x48f6db,null));};exports['show']=function(_0x191206,_0x4f943d){var _0x5ad386={'raw':![],'where':{'id':_0x191206['params']['id']}},_0x33884a={};_0x33884a[_0xf099('0x31')]=_[_0xf099('0x33')](db[_0xf099('0x2e')]['rawAttributes']);_0x33884a['query']=_[_0xf099('0x33')](_0x191206[_0xf099('0x32')]);_0x33884a[_0xf099('0x34')]=_['intersection'](_0x33884a[_0xf099('0x31')],_0x33884a[_0xf099('0x32')]);_0x5ad386[_0xf099('0x36')]=_[_0xf099('0x35')](_0x33884a[_0xf099('0x31')],qs['fields'](_0x191206[_0xf099('0x32')][_0xf099('0x37')]));_0x5ad386[_0xf099('0x36')]=_0x5ad386['attributes']['length']?_0x5ad386[_0xf099('0x36')]:_0x33884a[_0xf099('0x31')];if(_0x191206[_0xf099('0x32')][_0xf099('0x40')]){_0x5ad386[_0xf099('0x44')]=[{'all':!![]}];}_0x5ad386=_[_0xf099('0x3e')]({},_0x5ad386,_0x191206['options']);return db[_0xf099('0x2e')]['find'](_0x5ad386)['then'](handleEntityNotFound(_0x4f943d,null))[_0xf099('0x25')](respondWithResult(_0x4f943d,null))[_0xf099('0x43')](handleError(_0x4f943d,null));};exports[_0xf099('0x23')]=function(_0x5e87a2,_0x148714){if(_0x5e87a2[_0xf099('0x45')]['id']){delete _0x5e87a2[_0xf099('0x45')]['id'];}return db['VoiceMusicOnHold'][_0xf099('0x46')]({'where':{'id':_0x5e87a2[_0xf099('0x47')]['id']}})[_0xf099('0x25')](handleEntityNotFound(_0x148714,null))[_0xf099('0x25')](saveUpdates(_0x5e87a2[_0xf099('0x45')],null))[_0xf099('0x25')](respondWithResult(_0x148714,null))['catch'](handleError(_0x148714,null));};exports[_0xf099('0x48')]=function(_0x17487e,_0x1e3e98,_0x1e8d70){return db[_0xf099('0x49')]['transaction'](function(_0x1e6021){if(_0x17487e[_0xf099('0x45')][_0xf099('0x4a')]==='files'){_0x17487e['body'][_0xf099('0x4b')]=path['join'](config['root'],_0xf099('0x4c'),_0x17487e['body'][_0xf099('0x2a')]);}return db['VoiceMusicOnHold'][_0xf099('0x48')](_0x17487e[_0xf099('0x45')],{'transaction':_0x1e6021})[_0xf099('0x25')](function(_0x226efb){if(_0x17487e[_0xf099('0x45')][_0xf099('0x4a')]===_0xf099('0x4d')){fs['mkdirSync'](_0x226efb[_0xf099('0x4b')],parseInt('0777',0x8));}var _0x257c59=_0x17487e[_0xf099('0x4e')][_0xf099('0x26')]({'plain':!![]});if(!_0x257c59)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x257c59[_0xf099('0x4f')]===_0xf099('0x4e')){var _0x4030ee=_0x226efb[_0xf099('0x26')]({'plain':!![]});return db[_0xf099('0x50')][_0xf099('0x46')]({'where':{'name':'MusicOnHolds','userProfileId':_0x257c59[_0xf099('0x51')]},'raw':!![]})[_0xf099('0x25')](function(_0x1f6d31){if(_0x1f6d31&&_0x1f6d31[_0xf099('0x52')]===0x0){return db[_0xf099('0x28')][_0xf099('0x48')]({'name':_0x4030ee[_0xf099('0x2a')],'resourceId':_0x4030ee['id'],'type':_0x1f6d31[_0xf099('0x2a')],'sectionId':_0x1f6d31['id']},{})[_0xf099('0x25')](function(){return _0x226efb;});}else{return _0x226efb;}})[_0xf099('0x43')](function(_0x12544b){logger['error'](_0xf099('0x53'),_0x12544b);});}return _0x226efb;});})[_0xf099('0x25')](respondWithResult(_0x1e3e98,0xc9))[_0xf099('0x43')](handleError(_0x1e3e98,null));};exports[_0xf099('0x24')]=function(_0x126ea3,_0x3a812b,_0x197802){var _0x31e502;return db[_0xf099('0x2e')][_0xf099('0x46')]({'where':{'id':_0x126ea3['params']['id']}})[_0xf099('0x25')](function(_0x34c7f2){if(_0x34c7f2){return db['sequelize'][_0xf099('0x54')](function(_0x7337dd){return _0x34c7f2[_0xf099('0x24')]({'transaction':_0x7337dd,'raw':!![]})[_0xf099('0x25')](function(_0x3f369a){if(_0x3f369a[_0xf099('0x4b')]){fs[_0xf099('0x55')](_0x3f369a[_0xf099('0x4b')])[_0xf099('0x56')](function(_0x5e3366){fs[_0xf099('0x57')](path[_0xf099('0x58')](_0x3f369a['directory'],_0x5e3366));});fs[_0xf099('0x59')](_0x3f369a[_0xf099('0x4b')]);}return _0x3f369a;});})['catch'](function(_0x73e8f5){throw new db[(_0xf099('0x5a'))][(_0xf099('0x5b'))](_0x73e8f5['message']);});}})[_0xf099('0x25')](handleEntityNotFound(_0x3a812b,null))[_0xf099('0x25')](removeEntity(_0x3a812b,null))['catch'](handleError(_0x3a812b,null));};exports[_0xf099('0x5c')]=function(_0x1afd0a,_0x4dcf1e,_0x1a6061){return db[_0xf099('0x49')][_0xf099('0x54')](function(_0x528113){var _0x296d6d;return db[_0xf099('0x2e')]['find']({'where':{'id':_0x1afd0a[_0xf099('0x47')]['id']}})[_0xf099('0x25')](function(_0x4e7fa1){if(_0x4e7fa1){_0x296d6d=_0x4e7fa1;return _0x4e7fa1['addSound'](_0x1afd0a[_0xf099('0x45')]['id'],{'transaction':_0x528113});}})['then'](function(_0x567ffc){if(_0x567ffc){return db[_0xf099('0x5d')]['findOne']({'where':{'id':_0x1afd0a[_0xf099('0x45')]['id']},'attributes':['id',_0xf099('0x2a'),_0xf099('0x5e'),'converted_format',_0xf099('0x5f')],'raw':!![]});}})[_0xf099('0x25')](function(_0x2080b7){if(_0x2080b7){var _0x565d7c=path[_0xf099('0x58')](config[_0xf099('0x60')],'server/files/sounds/converted',util[_0xf099('0x61')](_0xf099('0x62'),path[_0xf099('0x63')](_0x2080b7[_0xf099('0x5e')],path['extname'](_0x2080b7[_0xf099('0x5e')])),_0x2080b7[_0xf099('0x64')]));var _0x57f6d7=path['join'](config[_0xf099('0x60')],_0xf099('0x4c'),_0x296d6d[_0xf099('0x2a')],util['format']('%s.%s',_0x2080b7[_0xf099('0x2a')],_0x2080b7[_0xf099('0x64')]));fs[_0xf099('0x65')](_0x565d7c,_0x57f6d7);return _0x2080b7;}})[_0xf099('0x43')](function(_0x175925){throw new db['Sequelize']['ValidationError'](_0x175925[_0xf099('0x66')]);});})[_0xf099('0x25')](handleEntityNotFound(_0x4dcf1e,null))[_0xf099('0x25')](respondWithResult(_0x4dcf1e,0xc9))[_0xf099('0x43')](handleError(_0x4dcf1e,null));};exports[_0xf099('0x67')]=function(_0x2df5c7,_0x11487f,_0x31679e){return db['sequelize'][_0xf099('0x54')](function(_0x9d74){var _0x39dcb6;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x2df5c7['params']['id']}})[_0xf099('0x25')](handleEntityNotFound(_0x11487f,null))[_0xf099('0x25')](function(_0x4dd901){if(_0x4dd901){_0x39dcb6=_0x4dd901;return _0x4dd901[_0xf099('0x67')](_0x2df5c7['params'][_0xf099('0x68')]);}})['then'](function(_0x18f06d){if(_0x18f06d){return db[_0xf099('0x5d')]['findOne']({'where':{'id':_0x2df5c7[_0xf099('0x47')][_0xf099('0x68')]},'attributes':['id','name',_0xf099('0x5e'),'converted_format',_0xf099('0x5f')],'raw':!![]});}})[_0xf099('0x25')](function(_0x5eee3c){if(_0x5eee3c){fs['unlinkSync'](path['join'](_0x39dcb6[_0xf099('0x4b')],util[_0xf099('0x61')](_0xf099('0x62'),_0x5eee3c[_0xf099('0x2a')],_0x5eee3c[_0xf099('0x64')])));return _0x5eee3c;}})['catch'](function(_0x13fb72){throw new db['Sequelize']['ValidationError'](_0x13fb72[_0xf099('0x66')]);});})[_0xf099('0x25')](handleEntityNotFound(_0x11487f,null))[_0xf099('0x25')](respondWithStatusCode(_0x11487f,0xcc))[_0xf099('0x43')](handleError(_0x11487f,null));};exports[_0xf099('0x69')]=function(_0x534c43,_0x4d73d6,_0x2ab572){var _0x316203={};var _0x484e7f={};var _0x3e7bf1;var _0x26a2be;return db['VoiceMusicOnHold'][_0xf099('0x6a')]({'where':{'id':_0x534c43[_0xf099('0x47')]['id']}})[_0xf099('0x25')](handleEntityNotFound(_0x4d73d6,null))[_0xf099('0x25')](function(_0xac9939){if(_0xac9939){_0x3e7bf1=_0xac9939;_0x484e7f[_0xf099('0x31')]=_['keys'](db[_0xf099('0x5d')][_0xf099('0x6b')]);_0x484e7f[_0xf099('0x32')]=_[_0xf099('0x33')](_0x534c43[_0xf099('0x32')]);_0x484e7f['filters']=_[_0xf099('0x35')](_0x484e7f[_0xf099('0x31')],_0x484e7f['query']);_0x316203[_0xf099('0x36')]=_[_0xf099('0x35')](_0x484e7f['model'],qs[_0xf099('0x37')](_0x534c43[_0xf099('0x32')]['fields']));_0x316203[_0xf099('0x36')]=_0x316203[_0xf099('0x36')][_0xf099('0x38')]?_0x316203[_0xf099('0x36')]:_0x484e7f[_0xf099('0x31')];_0x316203[_0xf099('0x3a')]=qs[_0xf099('0x3b')](_0x534c43[_0xf099('0x32')][_0xf099('0x3b')]);_0x316203[_0xf099('0x3c')]=qs[_0xf099('0x34')](_['pick'](_0x534c43[_0xf099('0x32')],_0x484e7f[_0xf099('0x34')]));if(_0x534c43[_0xf099('0x32')]['filter']){_0x316203['where']=_[_0xf099('0x3e')](_0x316203[_0xf099('0x3c')],{'$or':_['map'](_0x316203['attributes'],function(_0x5ad99c){var _0x2215c8={};_0x2215c8[_0x5ad99c]={'$like':'%'+_0x534c43['query'][_0xf099('0x3d')]+'%'};return _0x2215c8;})});}_0x316203=_[_0xf099('0x3e')]({},_0x316203,_0x534c43['options']);return _0x3e7bf1[_0xf099('0x69')](_0x316203);}})['then'](function(_0x3d8f1b){if(_0x3d8f1b){_0x26a2be=_0x3d8f1b[_0xf099('0x38')];if(!_0x534c43['query'][_0xf099('0x6c')](_0xf099('0x39'))){_0x316203[_0xf099('0x20')]=qs[_0xf099('0x20')](_0x534c43[_0xf099('0x32')][_0xf099('0x20')]);_0x316203[_0xf099('0x1d')]=qs['offset'](_0x534c43[_0xf099('0x32')][_0xf099('0x1d')]);}return _0x3e7bf1[_0xf099('0x69')](_0x316203);}})[_0xf099('0x25')](function(_0x5804e3){if(_0x5804e3){return _0x5804e3?{'count':_0x26a2be,'rows':_0x5804e3}:null;}})[_0xf099('0x25')](respondWithResult(_0x4d73d6,null))['catch'](handleError(_0x4d73d6,null));}; \ No newline at end of file +var _0x9107=['where','merge','type','VIRTUAL','filter','VoiceMusicOnHold','include','findAll','show','includeAll','options','catch','body','find','create','sequelize','mode','files','directory','join','root','mkdirSync','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','transaction','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','server/files/moh','symlinkSync','removeSound','id2','getSounds','pick','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','MusicOnHolds','UserProfileResource','destroy','error','name','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','order','sort','filters'];(function(_0x2d054f,_0xe341b){var _0x52e88a=function(_0x186824){while(--_0x186824){_0x2d054f['push'](_0x2d054f['shift']());}};_0x52e88a(++_0xe341b);}(_0x9107,0xa9));var _0x7910=function(_0x18c4a4,_0x5e30ac){_0x18c4a4=_0x18c4a4-0x0;var _0x1777a0=_0x9107[_0x18c4a4];return _0x1777a0;};'use strict';var emlformat=require(_0x7910('0x0'));var rimraf=require(_0x7910('0x1'));var zipdir=require(_0x7910('0x2'));var jsonpatch=require(_0x7910('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7910('0x4'));var Mustache=require(_0x7910('0x5'));var util=require(_0x7910('0x6'));var path=require(_0x7910('0x7'));var sox=require(_0x7910('0x8'));var csv=require(_0x7910('0x9'));var ejs=require(_0x7910('0xa'));var fs=require('fs');var fs_extra=require(_0x7910('0xb'));var _=require(_0x7910('0xc'));var squel=require(_0x7910('0xd'));var crypto=require(_0x7910('0xe'));var jsforce=require(_0x7910('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7910('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7910('0x10'));var authService=require(_0x7910('0x11'));var qs=require(_0x7910('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7910('0x13'));var logger=require(_0x7910('0x14'))(_0x7910('0x15'));var utils=require(_0x7910('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7910('0x17'))['db'];function respondWithStatusCode(_0x2c199a,_0x293a13){_0x293a13=_0x293a13||0xcc;return function(_0x61a4a5){if(_0x61a4a5){return _0x2c199a[_0x7910('0x18')](_0x293a13);}return _0x2c199a['status'](_0x293a13)[_0x7910('0x19')]();};}function respondWithResult(_0x1a9903,_0x6a642){_0x6a642=_0x6a642||0xc8;return function(_0x34e0b6){if(_0x34e0b6){return _0x1a9903[_0x7910('0x1a')](_0x6a642)['json'](_0x34e0b6);}};}function respondWithFilteredResult(_0x5aa275,_0x13d5de){return function(_0x4b1787){if(_0x4b1787){var _0x1f673e=typeof _0x13d5de[_0x7910('0x1b')]===_0x7910('0x1c')&&typeof _0x13d5de[_0x7910('0x1d')]===_0x7910('0x1c');var _0x2d2e18=_0x4b1787[_0x7910('0x1e')];var _0x3fd362=_0x1f673e?0x0:_0x13d5de[_0x7910('0x1b')];var _0x1d5f91=_0x1f673e?_0x4b1787['count']:_0x13d5de[_0x7910('0x1b')]+_0x13d5de[_0x7910('0x1d')];var _0x961c82;if(_0x1d5f91>=_0x2d2e18){_0x1d5f91=_0x2d2e18;_0x961c82=0xc8;}else{_0x961c82=0xce;}_0x5aa275[_0x7910('0x1a')](_0x961c82);return _0x5aa275[_0x7910('0x1f')](_0x7910('0x20'),_0x3fd362+'-'+_0x1d5f91+'/'+_0x2d2e18)['json'](_0x4b1787);}return null;};}function patchUpdates(_0x2d3a73){return function(_0x395ee9){try{jsonpatch[_0x7910('0x21')](_0x395ee9,_0x2d3a73,!![]);}catch(_0x5e32ec){return BPromise[_0x7910('0x22')](_0x5e32ec);}return _0x395ee9['save']();};}function saveUpdates(_0x1f0bb3,_0x4ea355){return function(_0x32bae5){if(_0x32bae5){return _0x32bae5[_0x7910('0x23')](_0x1f0bb3)[_0x7910('0x24')](function(_0x3cf9c9){return _0x3cf9c9;});}return null;};}function removeEntity(_0x4d7938,_0x15a017){return function(_0x19f27d){if(_0x19f27d){return _0x19f27d['destroy']()[_0x7910('0x24')](function(){var _0x4a3958=_0x19f27d['get']({'plain':!![]});var _0x4e484f=_0x7910('0x25');return db[_0x7910('0x26')][_0x7910('0x27')]({'where':{'type':_0x4e484f,'resourceId':_0x4a3958['id']}})['then'](function(){return _0x19f27d;});})[_0x7910('0x24')](function(){_0x4d7938[_0x7910('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1997b8,_0x1512c5){return function(_0x68ed89){if(!_0x68ed89){_0x1997b8[_0x7910('0x18')](0x194);}return _0x68ed89;};}function handleError(_0x2d5c85,_0x3dbf9b){_0x3dbf9b=_0x3dbf9b||0x1f4;return function(_0x5abdc5){logger[_0x7910('0x28')](_0x5abdc5['stack']);if(_0x5abdc5[_0x7910('0x29')]){delete _0x5abdc5['name'];}_0x2d5c85[_0x7910('0x1a')](_0x3dbf9b)['send'](_0x5abdc5);};}exports[_0x7910('0x2a')]=function(_0x3f07c8,_0x3f29d1){var _0x100c5f={},_0xe576c6={},_0x7d91c3={'count':0x0,'rows':[]};var _0x1e2b30=_[_0x7910('0x2b')](db['VoiceMusicOnHold'][_0x7910('0x2c')],function(_0x556ce0){return{'name':_0x556ce0[_0x7910('0x2d')],'type':_0x556ce0['type'][_0x7910('0x2e')]};});_0xe576c6[_0x7910('0x2f')]=_[_0x7910('0x2b')](_0x1e2b30,'name');_0xe576c6[_0x7910('0x30')]=_[_0x7910('0x31')](_0x3f07c8[_0x7910('0x30')]);_0xe576c6['filters']=_[_0x7910('0x32')](_0xe576c6[_0x7910('0x2f')],_0xe576c6[_0x7910('0x30')]);_0x100c5f['attributes']=_[_0x7910('0x32')](_0xe576c6[_0x7910('0x2f')],qs['fields'](_0x3f07c8['query'][_0x7910('0x33')]));_0x100c5f[_0x7910('0x34')]=_0x100c5f[_0x7910('0x34')][_0x7910('0x35')]?_0x100c5f[_0x7910('0x34')]:_0xe576c6['model'];if(!_0x3f07c8[_0x7910('0x30')]['hasOwnProperty']('nolimit')){_0x100c5f[_0x7910('0x1d')]=qs[_0x7910('0x1d')](_0x3f07c8[_0x7910('0x30')][_0x7910('0x1d')]);_0x100c5f[_0x7910('0x1b')]=qs[_0x7910('0x1b')](_0x3f07c8[_0x7910('0x30')][_0x7910('0x1b')]);}_0x100c5f[_0x7910('0x36')]=qs[_0x7910('0x37')](_0x3f07c8[_0x7910('0x30')]['sort']);delete _0x3f07c8[_0x7910('0x30')][_0x7910('0x37')];_0x100c5f['where']=qs[_0x7910('0x38')](_['pick'](_0x3f07c8[_0x7910('0x30')],_0xe576c6[_0x7910('0x38')]),_0x1e2b30);if(_0x3f07c8[_0x7910('0x30')]['filter']){_0x100c5f[_0x7910('0x39')]=_[_0x7910('0x3a')](_0x100c5f['where'],{'$or':_['map'](_0x1e2b30,function(_0x1bf9f9){if(_0x1bf9f9[_0x7910('0x3b')]!==_0x7910('0x3c')){var _0x1f854f={};_0x1f854f[_0x1bf9f9['name']]={'$like':'%'+_0x3f07c8[_0x7910('0x30')][_0x7910('0x3d')]+'%'};return _0x1f854f;}})});}_0x100c5f=_[_0x7910('0x3a')]({},_0x100c5f,_0x3f07c8['options']);var _0x45a0d8={'where':_0x100c5f[_0x7910('0x39')]};return db[_0x7910('0x3e')][_0x7910('0x1e')](_0x45a0d8)[_0x7910('0x24')](function(_0x3c3d6b){_0x7d91c3[_0x7910('0x1e')]=_0x3c3d6b;if(_0x3f07c8[_0x7910('0x30')]['includeAll']){_0x100c5f[_0x7910('0x3f')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x7910('0x40')](_0x100c5f);})[_0x7910('0x24')](function(_0x32d6f9){_0x7d91c3['rows']=_0x32d6f9;return _0x7d91c3;})[_0x7910('0x24')](respondWithFilteredResult(_0x3f29d1,_0x100c5f))['catch'](handleError(_0x3f29d1,null));};exports[_0x7910('0x41')]=function(_0x30240c,_0x412342){var _0x435b4a={'raw':![],'where':{'id':_0x30240c['params']['id']}},_0x1dc1f2={};_0x1dc1f2['model']=_[_0x7910('0x31')](db[_0x7910('0x3e')][_0x7910('0x2c')]);_0x1dc1f2['query']=_['keys'](_0x30240c[_0x7910('0x30')]);_0x1dc1f2[_0x7910('0x38')]=_[_0x7910('0x32')](_0x1dc1f2[_0x7910('0x2f')],_0x1dc1f2[_0x7910('0x30')]);_0x435b4a[_0x7910('0x34')]=_[_0x7910('0x32')](_0x1dc1f2['model'],qs[_0x7910('0x33')](_0x30240c[_0x7910('0x30')]['fields']));_0x435b4a[_0x7910('0x34')]=_0x435b4a[_0x7910('0x34')][_0x7910('0x35')]?_0x435b4a[_0x7910('0x34')]:_0x1dc1f2[_0x7910('0x2f')];if(_0x30240c[_0x7910('0x30')][_0x7910('0x42')]){_0x435b4a[_0x7910('0x3f')]=[{'all':!![]}];}_0x435b4a=_['merge']({},_0x435b4a,_0x30240c[_0x7910('0x43')]);return db[_0x7910('0x3e')]['find'](_0x435b4a)['then'](handleEntityNotFound(_0x412342,null))[_0x7910('0x24')](respondWithResult(_0x412342,null))[_0x7910('0x44')](handleError(_0x412342,null));};exports['update']=function(_0x5bbe6a,_0x393d3a){if(_0x5bbe6a['body']['id']){delete _0x5bbe6a[_0x7910('0x45')]['id'];}return db[_0x7910('0x3e')][_0x7910('0x46')]({'where':{'id':_0x5bbe6a['params']['id']}})[_0x7910('0x24')](handleEntityNotFound(_0x393d3a,null))[_0x7910('0x24')](saveUpdates(_0x5bbe6a[_0x7910('0x45')],null))[_0x7910('0x24')](respondWithResult(_0x393d3a,null))[_0x7910('0x44')](handleError(_0x393d3a,null));};exports[_0x7910('0x47')]=function(_0x61e340,_0x4e679d,_0x5725f3){return db[_0x7910('0x48')]['transaction'](function(_0xf92d3f){if(_0x61e340[_0x7910('0x45')][_0x7910('0x49')]===_0x7910('0x4a')){_0x61e340[_0x7910('0x45')][_0x7910('0x4b')]=path[_0x7910('0x4c')](config[_0x7910('0x4d')],'server/files/moh',_0x61e340[_0x7910('0x45')]['name']);}return db[_0x7910('0x3e')]['create'](_0x61e340[_0x7910('0x45')],{'transaction':_0xf92d3f})[_0x7910('0x24')](function(_0x437e0c){if(_0x61e340[_0x7910('0x45')][_0x7910('0x49')]===_0x7910('0x4a')){fs[_0x7910('0x4e')](_0x437e0c[_0x7910('0x4b')],parseInt('0777',0x8));}var _0x16db1b=_0x61e340[_0x7910('0x4f')][_0x7910('0x50')]({'plain':!![]});if(!_0x16db1b)throw new Error(_0x7910('0x51'));if(_0x16db1b[_0x7910('0x52')]===_0x7910('0x4f')){var _0x48895e=_0x437e0c[_0x7910('0x50')]({'plain':!![]});return db[_0x7910('0x53')][_0x7910('0x46')]({'where':{'name':'MusicOnHolds','userProfileId':_0x16db1b[_0x7910('0x54')]},'raw':!![]})[_0x7910('0x24')](function(_0x4f879a){if(_0x4f879a&&_0x4f879a[_0x7910('0x55')]===0x0){return db[_0x7910('0x26')][_0x7910('0x47')]({'name':_0x48895e[_0x7910('0x29')],'resourceId':_0x48895e['id'],'type':_0x4f879a[_0x7910('0x29')],'sectionId':_0x4f879a['id']},{})[_0x7910('0x24')](function(){return _0x437e0c;});}else{return _0x437e0c;}})['catch'](function(_0x48d75d){logger[_0x7910('0x28')](_0x7910('0x56'),_0x48d75d);});}return _0x437e0c;});})[_0x7910('0x24')](respondWithResult(_0x4e679d,0xc9))['catch'](handleError(_0x4e679d,null));};exports['destroy']=function(_0x197af7,_0xc27c3a,_0x13d35c){var _0x12a49e;return db['VoiceMusicOnHold'][_0x7910('0x46')]({'where':{'id':_0x197af7[_0x7910('0x57')]['id']}})[_0x7910('0x24')](function(_0x3fea68){if(_0x3fea68){return db[_0x7910('0x48')][_0x7910('0x58')](function(_0x2b0949){return _0x3fea68[_0x7910('0x27')]({'transaction':_0x2b0949,'raw':!![]})['then'](function(_0x5eb110){if(_0x5eb110[_0x7910('0x4b')]){fs['readdirSync'](_0x5eb110['directory'])[_0x7910('0x59')](function(_0x405bba){fs[_0x7910('0x5a')](path[_0x7910('0x4c')](_0x5eb110[_0x7910('0x4b')],_0x405bba));});fs['rmdirSync'](_0x5eb110[_0x7910('0x4b')]);}return _0x5eb110;});})['catch'](function(_0x1d3913){throw new db[(_0x7910('0x5b'))][(_0x7910('0x5c'))](_0x1d3913[_0x7910('0x5d')]);});}})[_0x7910('0x24')](handleEntityNotFound(_0xc27c3a,null))[_0x7910('0x24')](removeEntity(_0xc27c3a,null))[_0x7910('0x44')](handleError(_0xc27c3a,null));};exports[_0x7910('0x5e')]=function(_0x5e1af,_0x3c28,_0x3398cc){return db[_0x7910('0x48')][_0x7910('0x58')](function(_0x2ad221){var _0x28ca4b;return db[_0x7910('0x3e')][_0x7910('0x46')]({'where':{'id':_0x5e1af['params']['id']}})[_0x7910('0x24')](function(_0x5b0070){if(_0x5b0070){_0x28ca4b=_0x5b0070;return _0x5b0070[_0x7910('0x5e')](_0x5e1af['body']['id'],{'transaction':_0x2ad221});}})[_0x7910('0x24')](function(_0x330f1c){if(_0x330f1c){return db[_0x7910('0x5f')][_0x7910('0x60')]({'where':{'id':_0x5e1af[_0x7910('0x45')]['id']},'attributes':['id','name',_0x7910('0x61'),'converted_format',_0x7910('0x62')],'raw':!![]});}})[_0x7910('0x24')](function(_0x4ca9ce){if(_0x4ca9ce){var _0x28ead7=path[_0x7910('0x4c')](config[_0x7910('0x4d')],_0x7910('0x63'),util[_0x7910('0x64')](_0x7910('0x65'),path[_0x7910('0x66')](_0x4ca9ce[_0x7910('0x61')],path[_0x7910('0x67')](_0x4ca9ce[_0x7910('0x61')])),_0x4ca9ce[_0x7910('0x68')]));var _0x31f2a2=path[_0x7910('0x4c')](config[_0x7910('0x4d')],_0x7910('0x69'),_0x28ca4b[_0x7910('0x29')],util[_0x7910('0x64')](_0x7910('0x65'),_0x4ca9ce['name'],_0x4ca9ce[_0x7910('0x68')]));fs[_0x7910('0x6a')](_0x28ead7,_0x31f2a2);return _0x4ca9ce;}})[_0x7910('0x44')](function(_0x2a1d4f){throw new db[(_0x7910('0x5b'))]['ValidationError'](_0x2a1d4f[_0x7910('0x5d')]);});})[_0x7910('0x24')](handleEntityNotFound(_0x3c28,null))[_0x7910('0x24')](respondWithResult(_0x3c28,0xc9))[_0x7910('0x44')](handleError(_0x3c28,null));};exports['removeSound']=function(_0x9c67d8,_0x38825c,_0xa6a9eb){return db[_0x7910('0x48')][_0x7910('0x58')](function(_0x5839bb){var _0x1d5e76;return db[_0x7910('0x3e')]['findOne']({'where':{'id':_0x9c67d8['params']['id']}})['then'](handleEntityNotFound(_0x38825c,null))[_0x7910('0x24')](function(_0x31df2a){if(_0x31df2a){_0x1d5e76=_0x31df2a;return _0x31df2a[_0x7910('0x6b')](_0x9c67d8[_0x7910('0x57')][_0x7910('0x6c')]);}})[_0x7910('0x24')](function(_0x35218f){if(_0x35218f){return db['Sound']['findOne']({'where':{'id':_0x9c67d8[_0x7910('0x57')]['id2']},'attributes':['id',_0x7910('0x29'),_0x7910('0x61'),_0x7910('0x68'),_0x7910('0x62')],'raw':!![]});}})[_0x7910('0x24')](function(_0xe7de34){if(_0xe7de34){fs[_0x7910('0x5a')](path[_0x7910('0x4c')](_0x1d5e76[_0x7910('0x4b')],util[_0x7910('0x64')](_0x7910('0x65'),_0xe7de34[_0x7910('0x29')],_0xe7de34[_0x7910('0x68')])));return _0xe7de34;}})[_0x7910('0x44')](function(_0x53e746){throw new db['Sequelize'][(_0x7910('0x5c'))](_0x53e746[_0x7910('0x5d')]);});})[_0x7910('0x24')](handleEntityNotFound(_0x38825c,null))[_0x7910('0x24')](respondWithStatusCode(_0x38825c,0xcc))[_0x7910('0x44')](handleError(_0x38825c,null));};exports[_0x7910('0x6d')]=function(_0xc56378,_0x1e1b23,_0x43affe){var _0x333838={};var _0x2649ba={};var _0x5305c9;var _0x1cd477;return db['VoiceMusicOnHold'][_0x7910('0x60')]({'where':{'id':_0xc56378[_0x7910('0x57')]['id']}})[_0x7910('0x24')](handleEntityNotFound(_0x1e1b23,null))['then'](function(_0x5a94cf){if(_0x5a94cf){_0x5305c9=_0x5a94cf;_0x2649ba[_0x7910('0x2f')]=_['keys'](db[_0x7910('0x5f')][_0x7910('0x2c')]);_0x2649ba[_0x7910('0x30')]=_[_0x7910('0x31')](_0xc56378[_0x7910('0x30')]);_0x2649ba[_0x7910('0x38')]=_[_0x7910('0x32')](_0x2649ba[_0x7910('0x2f')],_0x2649ba[_0x7910('0x30')]);_0x333838[_0x7910('0x34')]=_[_0x7910('0x32')](_0x2649ba['model'],qs[_0x7910('0x33')](_0xc56378['query'][_0x7910('0x33')]));_0x333838[_0x7910('0x34')]=_0x333838[_0x7910('0x34')][_0x7910('0x35')]?_0x333838[_0x7910('0x34')]:_0x2649ba[_0x7910('0x2f')];_0x333838[_0x7910('0x36')]=qs[_0x7910('0x37')](_0xc56378[_0x7910('0x30')][_0x7910('0x37')]);_0x333838['where']=qs[_0x7910('0x38')](_[_0x7910('0x6e')](_0xc56378[_0x7910('0x30')],_0x2649ba['filters']));if(_0xc56378[_0x7910('0x30')][_0x7910('0x3d')]){_0x333838[_0x7910('0x39')]=_[_0x7910('0x3a')](_0x333838[_0x7910('0x39')],{'$or':_[_0x7910('0x2b')](_0x333838[_0x7910('0x34')],function(_0x20e546){var _0x56d812={};_0x56d812[_0x20e546]={'$like':'%'+_0xc56378[_0x7910('0x30')][_0x7910('0x3d')]+'%'};return _0x56d812;})});}_0x333838=_[_0x7910('0x3a')]({},_0x333838,_0xc56378[_0x7910('0x43')]);return _0x5305c9[_0x7910('0x6d')](_0x333838);}})[_0x7910('0x24')](function(_0x31df4e){if(_0x31df4e){_0x1cd477=_0x31df4e[_0x7910('0x35')];if(!_0xc56378['query'][_0x7910('0x6f')](_0x7910('0x70'))){_0x333838[_0x7910('0x1d')]=qs[_0x7910('0x1d')](_0xc56378['query'][_0x7910('0x1d')]);_0x333838[_0x7910('0x1b')]=qs['offset'](_0xc56378[_0x7910('0x30')][_0x7910('0x1b')]);}return _0x5305c9['getSounds'](_0x333838);}})[_0x7910('0x24')](function(_0x47023a){if(_0x47023a){return _0x47023a?{'count':_0x1cd477,'rows':_0x47023a}:null;}})[_0x7910('0x24')](respondWithResult(_0x1e1b23,null))[_0x7910('0x44')](handleError(_0x1e1b23,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 18e14f1..90c40af 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 _0x21a9=['util','api','moment','bluebird','path','./voiceMusicOnHold.attributes','exports','voice_musiconhold','lodash'];(function(_0x396910,_0x397bda){var _0x217d81=function(_0x1e6ab9){while(--_0x1e6ab9){_0x396910['push'](_0x396910['shift']());}};_0x217d81(++_0x397bda);}(_0x21a9,0x128));var _0x921a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x21a9[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x921a('0x0'));var util=require(_0x921a('0x1'));var logger=require('../../config/logger')(_0x921a('0x2'));var moment=require(_0x921a('0x3'));var BPromise=require(_0x921a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x921a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x921a('0x6'));module[_0x921a('0x7')]=function(_0x49885c,_0x33d0e7){return _0x49885c['define']('VoiceMusicOnHold',attributes,{'tableName':_0x921a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4357=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger'];(function(_0x5bfbc4,_0xceeb1){var _0x1489d3=function(_0x11e6a2){while(--_0x11e6a2){_0x5bfbc4['push'](_0x5bfbc4['shift']());}};_0x1489d3(++_0xceeb1);}(_0x4357,0x9a));var _0x7435=function(_0xfcfc35,_0x41125e){_0xfcfc35=_0xfcfc35-0x0;var _0x13a3c7=_0x4357[_0xfcfc35];return _0x13a3c7;};'use strict';var _=require(_0x7435('0x0'));var util=require('util');var logger=require(_0x7435('0x1'))(_0x7435('0x2'));var moment=require(_0x7435('0x3'));var BPromise=require('bluebird');var rp=require(_0x7435('0x4'));var fs=require('fs');var path=require(_0x7435('0x5'));var rimraf=require(_0x7435('0x6'));var config=require(_0x7435('0x7'));var attributes=require(_0x7435('0x8'));module[_0x7435('0x9')]=function(_0x2a4d74,_0x397df3){return _0x2a4d74[_0x7435('0xa')](_0x7435('0xb'),attributes,{'tableName':_0x7435('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index b50dd7d..674b140 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(_0x263656,_0x5b1504){var _0x1516d7=function(_0x38da93){while(--_0x38da93){_0x263656['push'](_0x263656['shift']());}};_0x1516d7(++_0x5b1504);}(_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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x9bbd8e,_0x7e8e34){var _0x2a4a00=function(_0x50b811){while(--_0x50b811){_0x9bbd8e['push'](_0x9bbd8e['shift']());}};_0x2a4a00(++_0x7e8e34);}(_0xe706,0xa3));var _0x6e70=function(_0x264d6f,_0x2bf363){_0x264d6f=_0x264d6f-0x0;var _0x26bb6f=_0xe706[_0x264d6f];return _0x26bb6f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 2c78e0e..ec8aae5 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 _0x8f23=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','post','create','addTeams','update','delete','destroy','removeTeams','exports','multer'];(function(_0x1caecf,_0x141586){var _0x482886=function(_0x668f29){while(--_0x668f29){_0x1caecf['push'](_0x1caecf['shift']());}};_0x482886(++_0x141586);}(_0x8f23,0x1e5));var _0x38f2=function(_0xa97568,_0x582b50){_0xa97568=_0xa97568-0x0;var _0x154634=_0x8f23[_0xa97568];return _0x154634;};'use strict';var multer=require(_0x38f2('0x0'));var util=require(_0x38f2('0x1'));var path=require(_0x38f2('0x2'));var timeout=require(_0x38f2('0x3'));var express=require(_0x38f2('0x4'));var router=express[_0x38f2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x38f2('0x6'));var config=require(_0x38f2('0x7'));var controller=require(_0x38f2('0x8'));router[_0x38f2('0x9')]('/',auth[_0x38f2('0xa')](),controller[_0x38f2('0xb')]);router[_0x38f2('0x9')](_0x38f2('0xc'),auth['isAuthenticated'](),controller[_0x38f2('0xd')]);router[_0x38f2('0x9')](_0x38f2('0xe'),auth[_0x38f2('0xa')](),controller[_0x38f2('0xf')]);router[_0x38f2('0x9')](_0x38f2('0x10'),auth[_0x38f2('0xa')](),controller[_0x38f2('0x11')]);router[_0x38f2('0x9')](_0x38f2('0x12'),auth[_0x38f2('0xa')](),controller['getTeams']);router[_0x38f2('0x13')]('/',auth['isAuthenticated'](),controller[_0x38f2('0x14')]);router[_0x38f2('0x13')](_0x38f2('0x10'),auth[_0x38f2('0xa')](),controller['addAgents']);router[_0x38f2('0x13')]('/:id/teams',auth[_0x38f2('0xa')](),controller[_0x38f2('0x15')]);router['put'](_0x38f2('0xe'),auth[_0x38f2('0xa')](),controller[_0x38f2('0x16')]);router[_0x38f2('0x17')](_0x38f2('0xe'),auth[_0x38f2('0xa')](),controller[_0x38f2('0x18')]);router[_0x38f2('0x17')](_0x38f2('0x10'),auth[_0x38f2('0xa')](),controller['removeAgents']);router['delete'](_0x38f2('0x12'),auth[_0x38f2('0xa')](),controller[_0x38f2('0x19')]);module[_0x38f2('0x1a')]=router; \ No newline at end of file +var _0x2f91=['isAuthenticated','/describe','/:id','show','/:id/users','getAgents','getTeams','post','create','addAgents','/:id/teams','addTeams','put','delete','destroy','removeAgents','removeTeams','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get'];(function(_0x449acc,_0x416458){var _0x15d15d=function(_0x5626a0){while(--_0x5626a0){_0x449acc['push'](_0x449acc['shift']());}};_0x15d15d(++_0x416458);}(_0x2f91,0x98));var _0x12f9=function(_0x1a529f,_0x2af13d){_0x1a529f=_0x1a529f-0x0;var _0x2ec887=_0x2f91[_0x1a529f];return _0x2ec887;};'use strict';var multer=require(_0x12f9('0x0'));var util=require(_0x12f9('0x1'));var path=require(_0x12f9('0x2'));var timeout=require('connect-timeout');var express=require(_0x12f9('0x3'));var router=express[_0x12f9('0x4')]();var fs_extra=require(_0x12f9('0x5'));var auth=require(_0x12f9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x12f9('0x7'));var controller=require(_0x12f9('0x8'));router[_0x12f9('0x9')]('/',auth[_0x12f9('0xa')](),controller['index']);router[_0x12f9('0x9')](_0x12f9('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x12f9('0xc'),auth[_0x12f9('0xa')](),controller[_0x12f9('0xd')]);router[_0x12f9('0x9')](_0x12f9('0xe'),auth[_0x12f9('0xa')](),controller[_0x12f9('0xf')]);router['get']('/:id/teams',auth[_0x12f9('0xa')](),controller[_0x12f9('0x10')]);router[_0x12f9('0x11')]('/',auth[_0x12f9('0xa')](),controller[_0x12f9('0x12')]);router[_0x12f9('0x11')](_0x12f9('0xe'),auth['isAuthenticated'](),controller[_0x12f9('0x13')]);router[_0x12f9('0x11')](_0x12f9('0x14'),auth[_0x12f9('0xa')](),controller[_0x12f9('0x15')]);router[_0x12f9('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x12f9('0x17')](_0x12f9('0xc'),auth[_0x12f9('0xa')](),controller[_0x12f9('0x18')]);router[_0x12f9('0x17')](_0x12f9('0xe'),auth[_0x12f9('0xa')](),controller[_0x12f9('0x19')]);router[_0x12f9('0x17')](_0x12f9('0x14'),auth[_0x12f9('0xa')](),controller[_0x12f9('0x1a')]);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 e70def1..fb68260 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 _0x7b4b=['name','sequelize','exports','STRING'];(function(_0x357bff,_0xb781f4){var _0x236163=function(_0x21ace8){while(--_0x21ace8){_0x357bff['push'](_0x357bff['shift']());}};_0x236163(++_0xb781f4);}(_0x7b4b,0xfd));var _0xb7b4=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0x7b4b[_0x330723];return _0x60c546;};'use strict';var Sequelize=require(_0xb7b4('0x0'));module[_0xb7b4('0x1')]={'name':{'type':Sequelize[_0xb7b4('0x2')],'allowNull':![],'unique':_0xb7b4('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x474bbc){return'system-'+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xb7b4('0x2')]},'callerIdAll':{'type':Sequelize[_0xb7b4('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x810e=['name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x12254f,_0x100cfe){var _0x3a4fa2=function(_0x1ce891){while(--_0x1ce891){_0x12254f['push'](_0x12254f['shift']());}};_0x3a4fa2(++_0x100cfe);}(_0x810e,0x16d));var _0xe810=function(_0x316c50,_0x3fd0a5){_0x316c50=_0x316c50-0x0;var _0x38a5d7=_0x810e[_0x316c50];return _0x38a5d7;};'use strict';var Sequelize=require(_0xe810('0x0'));module[_0xe810('0x1')]={'name':{'type':Sequelize[_0xe810('0x2')],'allowNull':![],'unique':_0xe810('0x3')},'prefix':{'type':Sequelize[_0xe810('0x4')],'get':function(_0x2fdab6){return _0xe810('0x5')+this[_0xe810('0x6')](_0xe810('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xe810('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xe810('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5eb9d5f..a2f0ebc 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 _0xfef3=['../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','VoicePrefixes','then','error','stack','name','index','map','VoicePrefix','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','describe','create','sequelize','transaction','body','get','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','hasOwnProperty','Team','Agents','online','interface','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','value','isEmpty','eml-format','zip-dir','request-promise','moment','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','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x113fa8,_0x106708){var _0x53c61f=function(_0x4b4d98){while(--_0x4b4d98){_0x113fa8['push'](_0x113fa8['shift']());}};_0x53c61f(++_0x106708);}(_0xfef3,0x118));var _0x3fef=function(_0x39d1b6,_0x5c506a){_0x39d1b6=_0x39d1b6-0x0;var _0x26ad32=_0xfef3[_0x39d1b6];return _0x26ad32;};'use strict';var emlformat=require(_0x3fef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fef('0x2'));var moment=require(_0x3fef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fef('0x4'));var util=require(_0x3fef('0x5'));var path=require('path');var sox=require(_0x3fef('0x6'));var csv=require(_0x3fef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fef('0x8'));var _=require(_0x3fef('0x9'));var squel=require(_0x3fef('0xa'));var crypto=require(_0x3fef('0xb'));var jsforce=require(_0x3fef('0xc'));var deskjs=require(_0x3fef('0xd'));var toCsv=require(_0x3fef('0x7'));var querystring=require(_0x3fef('0xe'));var Papa=require(_0x3fef('0xf'));var Redis=require(_0x3fef('0x10'));var authService=require(_0x3fef('0x11'));var qs=require(_0x3fef('0x12'));var as=require(_0x3fef('0x13'));var hardwareService=require(_0x3fef('0x14'));var logger=require('../../config/logger')(_0x3fef('0x15'));var utils=require(_0x3fef('0x16'));var config=require(_0x3fef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fef('0x18'))['db'];config['redis']=_[_0x3fef('0x19')](config[_0x3fef('0x1a')],{'host':_0x3fef('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3fef('0x1a')]));require('./voicePrefix.socket')[_0x3fef('0x1c')](socket);function respondWithStatusCode(_0x14c053,_0x56a65d){_0x56a65d=_0x56a65d||0xcc;return function(_0x2dec1b){if(_0x2dec1b){return _0x14c053[_0x3fef('0x1d')](_0x56a65d);}return _0x14c053[_0x3fef('0x1e')](_0x56a65d)[_0x3fef('0x1f')]();};}function respondWithResult(_0x395df0,_0x2af1ba){_0x2af1ba=_0x2af1ba||0xc8;return function(_0x5c899f){if(_0x5c899f){return _0x395df0[_0x3fef('0x1e')](_0x2af1ba)[_0x3fef('0x20')](_0x5c899f);}};}function respondWithFilteredResult(_0x1ec282,_0x3f2997){return function(_0x1613ad){if(_0x1613ad){var _0xaa0ae3=typeof _0x3f2997['offset']===_0x3fef('0x21')&&typeof _0x3f2997[_0x3fef('0x22')]==='undefined';var _0x2c7f36=_0x1613ad[_0x3fef('0x23')];var _0x42e095=_0xaa0ae3?0x0:_0x3f2997[_0x3fef('0x24')];var _0x245332=_0xaa0ae3?_0x1613ad[_0x3fef('0x23')]:_0x3f2997[_0x3fef('0x24')]+_0x3f2997[_0x3fef('0x22')];var _0x124e7c;if(_0x245332>=_0x2c7f36){_0x245332=_0x2c7f36;_0x124e7c=0xc8;}else{_0x124e7c=0xce;}_0x1ec282[_0x3fef('0x1e')](_0x124e7c);return _0x1ec282[_0x3fef('0x25')](_0x3fef('0x26'),_0x42e095+'-'+_0x245332+'/'+_0x2c7f36)[_0x3fef('0x20')](_0x1613ad);}return null;};}function patchUpdates(_0x39a8ea){return function(_0x433a3e){try{jsonpatch['apply'](_0x433a3e,_0x39a8ea,!![]);}catch(_0x5b56de){return BPromise['reject'](_0x5b56de);}return _0x433a3e[_0x3fef('0x27')]();};}function saveUpdates(_0x3ba38d,_0xa16dc){return function(_0x5f047c){if(_0x5f047c){return _0x5f047c[_0x3fef('0x28')](_0x3ba38d)['then'](function(_0x45464b){return _0x45464b;});}return null;};}function removeEntity(_0x2c0848,_0x64d3e6){return function(_0xf2b269){if(_0xf2b269){return _0xf2b269[_0x3fef('0x29')]()['then'](function(){var _0x4b4dee=_0xf2b269['get']({'plain':!![]});var _0x121ff0=_0x3fef('0x2a');return db['UserProfileResource'][_0x3fef('0x29')]({'where':{'type':_0x121ff0,'resourceId':_0x4b4dee['id']}})[_0x3fef('0x2b')](function(){return _0xf2b269;});})['then'](function(){_0x2c0848[_0x3fef('0x1e')](0xcc)[_0x3fef('0x1f')]();});}};}function handleEntityNotFound(_0xf892bb,_0x2b73fb){return function(_0x3a1a0a){if(!_0x3a1a0a){_0xf892bb[_0x3fef('0x1d')](0x194);}return _0x3a1a0a;};}function handleError(_0x20abb6,_0x4a632c){_0x4a632c=_0x4a632c||0x1f4;return function(_0x34576a){logger[_0x3fef('0x2c')](_0x34576a[_0x3fef('0x2d')]);if(_0x34576a[_0x3fef('0x2e')]){delete _0x34576a['name'];}_0x20abb6[_0x3fef('0x1e')](_0x4a632c)['send'](_0x34576a);};}exports[_0x3fef('0x2f')]=function(_0x3c4483,_0x16009a){var _0x1136b3={},_0x10b803={},_0x464763={'count':0x0,'rows':[]};var _0x355c03=_[_0x3fef('0x30')](db[_0x3fef('0x31')][_0x3fef('0x32')],function(_0x4f1061){return{'name':_0x4f1061['fieldName'],'type':_0x4f1061[_0x3fef('0x33')]['key']};});_0x10b803[_0x3fef('0x34')]=_[_0x3fef('0x30')](_0x355c03,_0x3fef('0x2e'));_0x10b803[_0x3fef('0x35')]=_[_0x3fef('0x36')](_0x3c4483[_0x3fef('0x35')]);_0x10b803[_0x3fef('0x37')]=_[_0x3fef('0x38')](_0x10b803[_0x3fef('0x34')],_0x10b803[_0x3fef('0x35')]);_0x1136b3[_0x3fef('0x39')]=_[_0x3fef('0x38')](_0x10b803[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x3c4483['query'][_0x3fef('0x3a')]));_0x1136b3[_0x3fef('0x39')]=_0x1136b3[_0x3fef('0x39')][_0x3fef('0x3b')]?_0x1136b3[_0x3fef('0x39')]:_0x10b803[_0x3fef('0x34')];if(!_0x3c4483['query']['hasOwnProperty'](_0x3fef('0x3c'))){_0x1136b3[_0x3fef('0x22')]=qs[_0x3fef('0x22')](_0x3c4483[_0x3fef('0x35')][_0x3fef('0x22')]);_0x1136b3[_0x3fef('0x24')]=qs[_0x3fef('0x24')](_0x3c4483[_0x3fef('0x35')][_0x3fef('0x24')]);}_0x1136b3[_0x3fef('0x3d')]=qs[_0x3fef('0x3e')](_0x3c4483['query'][_0x3fef('0x3e')]);_0x1136b3[_0x3fef('0x3f')]=qs['filters'](_['pick'](_0x3c4483[_0x3fef('0x35')],_0x10b803[_0x3fef('0x37')]),_0x355c03);if(_0x3c4483[_0x3fef('0x35')][_0x3fef('0x40')]){_0x1136b3[_0x3fef('0x3f')]=_[_0x3fef('0x41')](_0x1136b3[_0x3fef('0x3f')],{'$or':_[_0x3fef('0x30')](_0x355c03,function(_0x577ab8){if(_0x577ab8[_0x3fef('0x33')]!==_0x3fef('0x42')){var _0x2859db={};_0x2859db[_0x577ab8[_0x3fef('0x2e')]]={'$like':'%'+_0x3c4483[_0x3fef('0x35')][_0x3fef('0x40')]+'%'};return _0x2859db;}})});}_0x1136b3=_[_0x3fef('0x41')]({},_0x1136b3,_0x3c4483[_0x3fef('0x43')]);var _0x3df52b={'where':_0x1136b3[_0x3fef('0x3f')]};return db[_0x3fef('0x31')][_0x3fef('0x23')](_0x3df52b)[_0x3fef('0x2b')](function(_0x15d2c7){_0x464763[_0x3fef('0x23')]=_0x15d2c7;if(_0x3c4483['query'][_0x3fef('0x44')]){_0x1136b3[_0x3fef('0x45')]=[{'all':!![]}];}return db[_0x3fef('0x31')][_0x3fef('0x46')](_0x1136b3);})[_0x3fef('0x2b')](function(_0x33b145){_0x464763['rows']=_0x33b145;return _0x464763;})[_0x3fef('0x2b')](respondWithFilteredResult(_0x16009a,_0x1136b3))['catch'](handleError(_0x16009a,null));};exports[_0x3fef('0x47')]=function(_0x40a206,_0x59e3b0){var _0xa1a53d={'raw':![],'where':{'id':_0x40a206[_0x3fef('0x48')]['id']}},_0x4e662c={};_0x4e662c[_0x3fef('0x34')]=_[_0x3fef('0x36')](db[_0x3fef('0x31')][_0x3fef('0x32')]);_0x4e662c[_0x3fef('0x35')]=_[_0x3fef('0x36')](_0x40a206[_0x3fef('0x35')]);_0x4e662c[_0x3fef('0x37')]=_[_0x3fef('0x38')](_0x4e662c[_0x3fef('0x34')],_0x4e662c[_0x3fef('0x35')]);_0xa1a53d[_0x3fef('0x39')]=_['intersection'](_0x4e662c[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x40a206['query'][_0x3fef('0x3a')]));_0xa1a53d[_0x3fef('0x39')]=_0xa1a53d[_0x3fef('0x39')]['length']?_0xa1a53d[_0x3fef('0x39')]:_0x4e662c[_0x3fef('0x34')];if(_0x40a206['query'][_0x3fef('0x44')]){_0xa1a53d['include']=[{'all':!![]}];}_0xa1a53d=_['merge']({},_0xa1a53d,_0x40a206[_0x3fef('0x43')]);return db['VoicePrefix'][_0x3fef('0x49')](_0xa1a53d)[_0x3fef('0x2b')](handleEntityNotFound(_0x59e3b0,null))['then'](respondWithResult(_0x59e3b0,null))[_0x3fef('0x4a')](handleError(_0x59e3b0,null));};exports[_0x3fef('0x29')]=function(_0x2f8bb2,_0x5902b1){return db[_0x3fef('0x31')][_0x3fef('0x49')]({'where':{'id':_0x2f8bb2[_0x3fef('0x48')]['id']}})['then'](handleEntityNotFound(_0x5902b1,null))[_0x3fef('0x2b')](removeEntity(_0x5902b1,null))[_0x3fef('0x4a')](handleError(_0x5902b1,null));};exports[_0x3fef('0x4b')]=function(_0x6a5321,_0x3ae6a7){return db['VoicePrefix'][_0x3fef('0x4b')]()[_0x3fef('0x2b')](respondWithResult(_0x3ae6a7,null))[_0x3fef('0x4a')](handleError(_0x3ae6a7,null));};exports[_0x3fef('0x4c')]=function(_0x3dc5b5,_0x15be93){var _0x3f9d35;return db[_0x3fef('0x4d')][_0x3fef('0x4e')](function(_0x4862a5){return db['VoicePrefix'][_0x3fef('0x4c')](_0x3dc5b5[_0x3fef('0x4f')],{'transaction':_0x4862a5})[_0x3fef('0x2b')](function(_0x29c619){_0x3f9d35=_0x29c619[_0x3fef('0x50')]({'plain':!![]});return db[_0x3fef('0x51')][_0x3fef('0x49')]({'where':{'id':_0x3f9d35[_0x3fef('0x52')]},'raw':!![]})[_0x3fef('0x2b')](function(_0x36e054){return createVoicePrefixExtensions(_0x3f9d35,_0x36e054,_0x4862a5);});});})[_0x3fef('0x2b')](function(){var _0x109fac=_0x3dc5b5['user'][_0x3fef('0x50')]({'plain':!![]});if(!_0x109fac)throw new Error(_0x3fef('0x53'));if(_0x109fac[_0x3fef('0x54')]===_0x3fef('0x55')){var _0x5b0415=_0x3f9d35;return db[_0x3fef('0x56')][_0x3fef('0x49')]({'where':{'name':_0x3fef('0x2a'),'userProfileId':_0x109fac[_0x3fef('0x57')]},'raw':!![]})['then'](function(_0x189d48){if(_0x189d48&&_0x189d48[_0x3fef('0x58')]===0x0){return db[_0x3fef('0x59')]['create']({'name':_0x5b0415['name'],'resourceId':_0x5b0415['id'],'type':_0x189d48[_0x3fef('0x2e')],'sectionId':_0x189d48['id']},{})[_0x3fef('0x2b')](function(){return _0x3f9d35;});}else{return _0x3f9d35;}})[_0x3fef('0x4a')](function(_0x3370ef){logger['error'](_0x3fef('0x5a'),_0x3370ef);throw _0x3370ef;});}return _0x3f9d35;})['then'](respondWithResult(_0x15be93,null))[_0x3fef('0x4a')](handleError(_0x15be93,null));};function Extension(_0x48a329,_0x43b311,_0x4cc6de,_0x155fcb){this[_0x3fef('0x5b')]=_0x3fef('0x5c');this['exten']=_0x48a329;this['app']=_0x4cc6de;this[_0x3fef('0x33')]=_0x3fef('0x5d');this[_0x3fef('0x5e')]=_0x3fef('0x5f');this[_0x3fef('0x60')]=_0x43b311;this[_0x3fef('0x61')]=_0x155fcb;}function createVoicePrefixExtensions(_0x1095b6,_0x2b9a5e,_0x5493a8){return new BPromise(function(_0x12ffca,_0x4b6d74){var _0x5ec4e7=new Extension(formatPrefixName(_0x1095b6[_0x3fef('0x62')]),0x1,_0x3fef('0x63'),_0x3fef('0x64'));_0x5ec4e7[_0x3fef('0x65')]=_0x1095b6['id'];return db[_0x3fef('0x51')][_0x3fef('0x4c')](_0x5ec4e7,{'transaction':_0x5493a8})[_0x3fef('0x2b')](function(_0x187c0f){var _0x62e2c4=_0x187c0f['get']({'plain':!![]});var _0x2d36fd=_['map'](addVoicePrefixExtensions(_0x1095b6,_0x2b9a5e),function(_0xc01327){_0xc01327[_0x3fef('0x52')]=_0x62e2c4['id'];_0xc01327[_0x3fef('0x65')]=_0x1095b6['id'];return _0xc01327;});return db[_0x3fef('0x51')][_0x3fef('0x66')](_0x2d36fd,{'transaction':_0x5493a8})[_0x3fef('0x2b')](function(_0x4a4631){if(!_0x4a4631){return _0x4b6d74(_0x3fef('0x67'));}else{return _0x12ffca(_0x4a4631);}})[_0x3fef('0x4a')](function(_0x3e98fb){return _0x4b6d74(_0x3e98fb);});});;});};function addVoicePrefixExtensions(_0x200d07,_0x6cc4a3){var _0x40bd7e=[];var _0x10b869=formatPrefixName(_0x200d07[_0x3fef('0x62')]);_0x40bd7e[_0x3fef('0x68')](new Extension(_0x10b869,0x2,_0x3fef('0x69'),_0x3fef('0x6a')+_0x200d07['name']));if(_0x200d07[_0x3fef('0x6b')]){_0x40bd7e['push'](new Extension(_0x10b869,0x3,'Set','PREFIX-CALLERIDALL='+_0x200d07[_0x3fef('0x6b')]));}else{_0x40bd7e['push'](new Extension(_0x10b869,0x3,_0x3fef('0x63'),_0x3fef('0x6c')));}_0x40bd7e[_0x3fef('0x68')](new Extension(_0x10b869,0x4,'goto',_0x6cc4a3[_0x3fef('0x5b')]+','+'${EXTEN:'+(0x8+_0x200d07[_0x3fef('0x2e')][_0x3fef('0x3b')])+'}'+','+0x1));return _0x40bd7e;}function formatPrefixName(_0x51ea04){var _0x1d0ae0='_';for(var _0x458583=0x0;_0x458583<_0x51ea04[_0x3fef('0x3b')];_0x458583++){if(_0x51ea04[_0x3fef('0x6d')](_0x458583)=='-'){_0x1d0ae0+=_0x51ea04[_0x3fef('0x6d')](_0x458583);}else{_0x1d0ae0+='['+_0x51ea04[_0x3fef('0x6d')](_0x458583)+']';}}_0x1d0ae0+='.';return _0x1d0ae0;}exports[_0x3fef('0x28')]=function(_0x1362ce,_0x4fde10,_0x25467e){var _0x410951=_0x1362ce[_0x3fef('0x4f')];_0x410951[_0x3fef('0x62')]=_0x3fef('0x6e')+_0x410951[_0x3fef('0x2e')]+'-';return db[_0x3fef('0x4d')][_0x3fef('0x4e')](function(_0xaff567){return db[_0x3fef('0x31')][_0x3fef('0x28')](_0x410951,{'where':{'id':_0x410951['id']},'transaction':_0xaff567})[_0x3fef('0x2b')](function(){return db[_0x3fef('0x51')][_0x3fef('0x29')]({'where':{'VoicePrefixId':_0x410951['id']},'transaction':_0xaff567})['then'](function(){return db[_0x3fef('0x51')][_0x3fef('0x49')]({'where':{'id':_0x410951[_0x3fef('0x52')]},'raw':!![]})['then'](function(_0x5e430a){return createVoicePrefixExtensions(_0x410951,_0x5e430a,_0xaff567);});});});})['then'](function(){return db[_0x3fef('0x31')][_0x3fef('0x6f')](_0x410951['id']);})[_0x3fef('0x2b')](respondWithResult(_0x4fde10,null))[_0x3fef('0x4a')](handleError(_0x4fde10,null));};exports['addAgents']=function(_0x441f1f,_0x17856b,_0x2f9b5f){return db[_0x3fef('0x31')]['find']({'where':{'id':_0x441f1f[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](handleEntityNotFound(_0x17856b,null))[_0x3fef('0x2b')](function(_0xf80bab){if(_0xf80bab){return _0xf80bab[_0x3fef('0x70')](_0x441f1f['body'][_0x3fef('0x71')],_['omit'](_0x441f1f[_0x3fef('0x4f')],['ids','id'])||{})[_0x3fef('0x72')](function(_0x13b272){for(var _0x2948c4=0x0;_0x2948c4<_0x441f1f[_0x3fef('0x4f')][_0x3fef('0x71')][_0x3fef('0x3b')];_0x2948c4+=0x1){socket[_0x3fef('0x73')](_0x3fef('0x74'),{'UserId':Number(_0x441f1f[_0x3fef('0x4f')]['ids'][_0x2948c4]),'VoicePrefixId':Number(_0x441f1f[_0x3fef('0x48')]['id'])});}return _0x13b272;});}})[_0x3fef('0x2b')](respondWithResult(_0x17856b,null))[_0x3fef('0x4a')](handleError(_0x17856b,null));};exports[_0x3fef('0x75')]=function(_0x4d8a00,_0x766e5d,_0x244d0b){return db[_0x3fef('0x31')][_0x3fef('0x49')]({'where':{'id':_0x4d8a00[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](handleEntityNotFound(_0x766e5d,null))['then'](function(_0x34aecb){if(_0x34aecb){return _0x34aecb[_0x3fef('0x75')](_0x4d8a00[_0x3fef('0x35')][_0x3fef('0x71')])[_0x3fef('0x2b')](function(){if(_[_0x3fef('0x76')](_0x4d8a00['query'][_0x3fef('0x71')])){for(var _0x414bfe=0x0;_0x414bfe<_0x4d8a00[_0x3fef('0x35')][_0x3fef('0x71')][_0x3fef('0x3b')];_0x414bfe+=0x1){socket['emit'](_0x3fef('0x77'),{'UserId':Number(_0x4d8a00[_0x3fef('0x35')][_0x3fef('0x71')][_0x414bfe]),'VoicePrefixId':Number(_0x4d8a00['params']['id'])});}}else{socket[_0x3fef('0x73')](_0x3fef('0x77'),{'UserId':Number(_0x4d8a00[_0x3fef('0x35')]['ids']),'VoicePrefixId':Number(_0x4d8a00['params']['id'])});}});}})[_0x3fef('0x2b')](respondWithStatusCode(_0x766e5d,null))[_0x3fef('0x4a')](handleError(_0x766e5d,null));};exports[_0x3fef('0x78')]=function(_0x25914c,_0x573323,_0x169b33){var _0x1361d2={};var _0x29b668={};var _0x5bf8b7;var _0x1cddf6;return db[_0x3fef('0x31')][_0x3fef('0x79')]({'where':{'id':_0x25914c[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](handleEntityNotFound(_0x573323,null))[_0x3fef('0x2b')](function(_0x277f65){if(_0x277f65){_0x5bf8b7=_0x277f65;_0x29b668['model']=_['keys'](db[_0x3fef('0x7a')]['rawAttributes']);_0x29b668[_0x3fef('0x35')]=_[_0x3fef('0x36')](_0x25914c[_0x3fef('0x35')]);_0x29b668['filters']=_[_0x3fef('0x38')](_0x29b668['model'],_0x29b668[_0x3fef('0x35')]);_0x1361d2['attributes']=_['intersection'](_0x29b668['model'],qs[_0x3fef('0x3a')](_0x25914c[_0x3fef('0x35')][_0x3fef('0x3a')]));_0x1361d2[_0x3fef('0x39')]=_0x1361d2[_0x3fef('0x39')][_0x3fef('0x3b')]?_0x1361d2[_0x3fef('0x39')]:_0x29b668['model'];_0x1361d2[_0x3fef('0x3d')]=qs[_0x3fef('0x3e')](_0x25914c[_0x3fef('0x35')]['sort']);_0x1361d2[_0x3fef('0x3f')]=qs[_0x3fef('0x37')](_[_0x3fef('0x7b')](_0x25914c[_0x3fef('0x35')],_0x29b668['filters']));if(_0x25914c[_0x3fef('0x35')]['filter']){_0x1361d2[_0x3fef('0x3f')]=_[_0x3fef('0x41')](_0x1361d2[_0x3fef('0x3f')],{'$or':_[_0x3fef('0x30')](_0x1361d2[_0x3fef('0x39')],function(_0x1804a5){var _0x3100c3={};_0x3100c3[_0x1804a5]={'$like':'%'+_0x25914c[_0x3fef('0x35')]['filter']+'%'};return _0x3100c3;})});}_0x1361d2=_[_0x3fef('0x41')]({},_0x1361d2,_0x25914c['options']);return _0x5bf8b7['getAgents'](_0x1361d2);}})[_0x3fef('0x2b')](function(_0x1b9cdc){if(_0x1b9cdc){_0x1cddf6=_0x1b9cdc[_0x3fef('0x3b')];if(!_0x25914c[_0x3fef('0x35')]['hasOwnProperty'](_0x3fef('0x3c'))){_0x1361d2[_0x3fef('0x22')]=qs[_0x3fef('0x22')](_0x25914c[_0x3fef('0x35')]['limit']);_0x1361d2[_0x3fef('0x24')]=qs[_0x3fef('0x24')](_0x25914c[_0x3fef('0x35')][_0x3fef('0x24')]);}return _0x5bf8b7[_0x3fef('0x78')](_0x1361d2);}})['then'](function(_0x27fd0b){if(_0x27fd0b){return _0x27fd0b?{'count':_0x1cddf6,'rows':_0x27fd0b}:null;}})[_0x3fef('0x2b')](respondWithResult(_0x573323,null))[_0x3fef('0x4a')](handleError(_0x573323,null));};exports[_0x3fef('0x7c')]=function(_0x14e142,_0x5894f5,_0xe6a6b7){var _0x26b1c0={};var _0x2000b2={};var _0x44310b;var _0x400fff;return db['VoicePrefix'][_0x3fef('0x79')]({'where':{'id':_0x14e142[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](handleEntityNotFound(_0x5894f5,null))[_0x3fef('0x2b')](function(_0x1a5f47){if(_0x1a5f47){_0x44310b=_0x1a5f47;_0x2000b2[_0x3fef('0x34')]=_['keys'](db['Team']['rawAttributes']);_0x2000b2['query']=_['keys'](_0x14e142[_0x3fef('0x35')]);_0x2000b2[_0x3fef('0x37')]=_[_0x3fef('0x38')](_0x2000b2[_0x3fef('0x34')],_0x2000b2[_0x3fef('0x35')]);_0x26b1c0['attributes']=_[_0x3fef('0x38')](_0x2000b2[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x14e142[_0x3fef('0x35')][_0x3fef('0x3a')]));_0x26b1c0[_0x3fef('0x39')]=_0x26b1c0[_0x3fef('0x39')]['length']?_0x26b1c0[_0x3fef('0x39')]:_0x2000b2['model'];_0x26b1c0[_0x3fef('0x3d')]=qs[_0x3fef('0x3e')](_0x14e142[_0x3fef('0x35')][_0x3fef('0x3e')]);_0x26b1c0[_0x3fef('0x3f')]=qs[_0x3fef('0x37')](_[_0x3fef('0x7b')](_0x14e142['query'],_0x2000b2['filters']));if(_0x14e142['query']['filter']){_0x26b1c0[_0x3fef('0x3f')]=_[_0x3fef('0x41')](_0x26b1c0[_0x3fef('0x3f')],{'$or':_[_0x3fef('0x30')](_0x26b1c0[_0x3fef('0x39')],function(_0x580a23){var _0x8d6d0e={};_0x8d6d0e[_0x580a23]={'$like':'%'+_0x14e142[_0x3fef('0x35')][_0x3fef('0x40')]+'%'};return _0x8d6d0e;})});}_0x26b1c0=_['merge']({},_0x26b1c0,_0x14e142[_0x3fef('0x43')]);return _0x44310b[_0x3fef('0x7c')](_0x26b1c0);}})['then'](function(_0x59654f){if(_0x59654f){_0x400fff=_0x59654f[_0x3fef('0x3b')];if(!_0x14e142['query'][_0x3fef('0x7d')](_0x3fef('0x3c'))){_0x26b1c0['limit']=qs[_0x3fef('0x22')](_0x14e142[_0x3fef('0x35')][_0x3fef('0x22')]);_0x26b1c0['offset']=qs[_0x3fef('0x24')](_0x14e142[_0x3fef('0x35')]['offset']);}return _0x44310b[_0x3fef('0x7c')](_0x26b1c0);}})[_0x3fef('0x2b')](function(_0xb08e2c){if(_0xb08e2c){return _0xb08e2c?{'count':_0x400fff,'rows':_0xb08e2c}:null;}})[_0x3fef('0x2b')](respondWithResult(_0x5894f5,null))['catch'](handleError(_0x5894f5,null));};exports['addTeams']=function(_0x91a872,_0x5ce3d8,_0x15cc4f){var _0x11a3d3=_0x91a872[_0x3fef('0x4f')][_0x3fef('0x71')];var _0x4e4a3c;return db[_0x3fef('0x7e')][_0x3fef('0x46')]({'where':{'id':_0x11a3d3},'attributes':['id'],'include':[{'model':db[_0x3fef('0x7a')],'as':_0x3fef('0x7f'),'attributes':['id','name',_0x3fef('0x80'),'voicePause',_0x3fef('0x81')],'raw':!![]}]})[_0x3fef('0x2b')](function(_0x578303){if(_0x578303){_0x4e4a3c=_0x578303;var _0x4c575a=_[_0x3fef('0x82')](_0x578303,function(_0xee8848){var _0x5089f2=_0xee8848[_0x3fef('0x50')]({'plain':!![]});return _0x5089f2[_0x3fef('0x7f')];});return db['VoicePrefix']['find']({'where':{'id':_0x91a872[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](function(_0x5e5b34){return db[_0x3fef('0x4d')][_0x3fef('0x4e')](function(_0x14c4bb){return _0x5e5b34['addTeams'](_0x11a3d3,{'transaction':_0x14c4bb})[_0x3fef('0x2b')](function(){return BPromise[_0x3fef('0x83')](_0x4e4a3c,function(_0x349180){return db[_0x3fef('0x84')][_0x3fef('0x85')]({'TeamId':_0x349180['id'],'VoicePrefixId':_0x91a872['params']['id']},{'transaction':_0x14c4bb});});})[_0x3fef('0x2b')](function(){return BPromise[_0x3fef('0x83')](_0x4c575a,function(_0x45ab57){return db['UserVoicePrefix'][_0x3fef('0x86')]({'where':{'UserId':_0x45ab57['id'],'VoicePrefixId':_0x91a872['params']['id']},'transaction':_0x14c4bb});});})['then'](function(){_0x4c575a[_0x3fef('0x87')](function(_0x1d43ba){socket['emit'](_0x3fef('0x74'),{'UserId':_0x1d43ba['id'],'VoicePrefixId':_0x5e5b34['id']});});});});});}})[_0x3fef('0x2b')](respondWithStatusCode(_0x5ce3d8,null))['catch'](handleError(_0x5ce3d8,null));};exports['removeTeams']=function(_0x373a45,_0x1a792b,_0x34e182){return db['Team'][_0x3fef('0x46')]({'where':{'id':_0x373a45[_0x3fef('0x35')][_0x3fef('0x71')]},'attributes':['id'],'include':[{'model':db[_0x3fef('0x7a')],'as':_0x3fef('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x3fef('0x2b')](handleEntityNotFound(_0x1a792b,null))[_0x3fef('0x2b')](function(_0x114585){var _0x4725dd=_[_0x3fef('0x30')](_0x114585,'id');var _0x3b9285=[];var _0x550ba3=[];var _0x778837=squel[_0x3fef('0x88')]();_0x778837[_0x3fef('0x89')](_0x3fef('0x8a'))['from'](_0x3fef('0x8b'),'tq')[_0x3fef('0x8c')](_0x3fef('0x8d'),'ut',_0x3fef('0x8e'))['where']('VoicePrefixId\x20=\x20?',_0x373a45[_0x3fef('0x48')]['id']);for(var _0x9110ca=0x0;_0x9110ca<_0x114585[_0x3fef('0x3b')];_0x9110ca+=0x1){let _0x2bb28c=_0x114585[_0x9110ca];for(var _0x99fa04=0x0;_0x99fa04<_0x2bb28c['Agents'][_0x3fef('0x3b')];_0x99fa04+=0x1){let _0x2aa67e=_0x2bb28c['Agents'][_0x99fa04];var _0x541b46=_0x778837[_0x3fef('0x8f')]();_0x541b46[_0x3fef('0x3f')](_0x3fef('0x90'),_0x2aa67e['id']);_0x550ba3[_0x3fef('0x68')](db[_0x3fef('0x4d')][_0x3fef('0x35')](_0x541b46['toString'](),{'type':db['sequelize'][_0x3fef('0x91')]['SELECT']})[_0x3fef('0x2b')](function(_0x18afc9){if(_0x18afc9[_0x3fef('0x3b')]===0x1){return _0x2aa67e['id'];}else{var _0x5b6489=_[_0x3fef('0x92')](_[_0x3fef('0x30')](_0x18afc9,_0x3fef('0x93')),function(_0x259fc1){return _['includes'](_0x4725dd,_0x259fc1);});if(_0x5b6489){return _0x2aa67e['id'];}}}));}}return BPromise[_0x3fef('0x94')](_0x550ba3)[_0x3fef('0x2b')](function(_0x37b1a3){_0x3b9285=_(_0x3b9285)[_0x3fef('0x95')](_0x37b1a3)['compact']()[_0x3fef('0x96')]();return db[_0x3fef('0x31')][_0x3fef('0x49')]({'where':{'id':_0x373a45[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](function(_0x446bab){return db[_0x3fef('0x4d')][_0x3fef('0x4e')](function(_0x2eddc5){return _0x446bab['removeTeams'](_0x373a45['query'][_0x3fef('0x71')],{'transaction':_0x2eddc5})[_0x3fef('0x2b')](function(){if(!_[_0x3fef('0x97')](_0x3b9285)){return _0x446bab[_0x3fef('0x75')](_0x3b9285,{'transaction':_0x2eddc5});}})['then'](function(){_0x3b9285[_0x3fef('0x87')](function(_0x2e642d){socket[_0x3fef('0x73')]('userVoicePrefix:remove',{'UserId':_0x2e642d,'VoicePrefixId':_0x446bab['id']});});});});});});})[_0x3fef('0x2b')](respondWithStatusCode(_0x1a792b,null))['catch'](handleError(_0x1a792b,null));}; \ No newline at end of file +var _0x4213=['limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','name','index','map','VoicePrefix','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','includeAll','findAll','show','params','find','catch','describe','create','sequelize','transaction','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','type','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','CDR(prefix)=','callerIdAll','Set','${EXTEN:','charAt','system-','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','User','nolimit','Team','order','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','offset','undefined'];(function(_0xbc08ff,_0x2763c6){var _0x498a41=function(_0xdb615f){while(--_0xdb615f){_0xbc08ff['push'](_0xbc08ff['shift']());}};_0x498a41(++_0x2763c6);}(_0x4213,0x77));var _0x3421=function(_0x6ab5b0,_0x471b81){_0x6ab5b0=_0x6ab5b0-0x0;var _0x4bcaef=_0x4213[_0x6ab5b0];return _0x4bcaef;};'use strict';var emlformat=require(_0x3421('0x0'));var rimraf=require(_0x3421('0x1'));var zipdir=require(_0x3421('0x2'));var jsonpatch=require(_0x3421('0x3'));var rp=require(_0x3421('0x4'));var moment=require(_0x3421('0x5'));var BPromise=require(_0x3421('0x6'));var Mustache=require('mustache');var util=require(_0x3421('0x7'));var path=require('path');var sox=require(_0x3421('0x8'));var csv=require(_0x3421('0x9'));var ejs=require(_0x3421('0xa'));var fs=require('fs');var fs_extra=require(_0x3421('0xb'));var _=require('lodash');var squel=require(_0x3421('0xc'));var crypto=require(_0x3421('0xd'));var jsforce=require(_0x3421('0xe'));var deskjs=require(_0x3421('0xf'));var toCsv=require(_0x3421('0x9'));var querystring=require('querystring');var Papa=require(_0x3421('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3421('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3421('0x12'));var logger=require(_0x3421('0x13'))(_0x3421('0x14'));var utils=require(_0x3421('0x15'));var config=require(_0x3421('0x16'));var licenseUtil=require(_0x3421('0x17'));var db=require(_0x3421('0x18'))['db'];config['redis']=_[_0x3421('0x19')](config[_0x3421('0x1a')],{'host':_0x3421('0x1b'),'port':0x18eb});var socket=require(_0x3421('0x1c'))(new Redis(config[_0x3421('0x1a')]));require(_0x3421('0x1d'))[_0x3421('0x1e')](socket);function respondWithStatusCode(_0x59ea4a,_0xafd9e0){_0xafd9e0=_0xafd9e0||0xcc;return function(_0x4b5f43){if(_0x4b5f43){return _0x59ea4a[_0x3421('0x1f')](_0xafd9e0);}return _0x59ea4a[_0x3421('0x20')](_0xafd9e0)['end']();};}function respondWithResult(_0x1e33ab,_0x4c6f7b){_0x4c6f7b=_0x4c6f7b||0xc8;return function(_0x16bc8f){if(_0x16bc8f){return _0x1e33ab[_0x3421('0x20')](_0x4c6f7b)['json'](_0x16bc8f);}};}function respondWithFilteredResult(_0x3584d6,_0x3dec08){return function(_0x130d3c){if(_0x130d3c){var _0x104cc5=typeof _0x3dec08[_0x3421('0x21')]===_0x3421('0x22')&&typeof _0x3dec08[_0x3421('0x23')]===_0x3421('0x22');var _0x197b83=_0x130d3c[_0x3421('0x24')];var _0x538a8b=_0x104cc5?0x0:_0x3dec08['offset'];var _0x420114=_0x104cc5?_0x130d3c['count']:_0x3dec08['offset']+_0x3dec08['limit'];var _0x33155b;if(_0x420114>=_0x197b83){_0x420114=_0x197b83;_0x33155b=0xc8;}else{_0x33155b=0xce;}_0x3584d6[_0x3421('0x20')](_0x33155b);return _0x3584d6[_0x3421('0x25')](_0x3421('0x26'),_0x538a8b+'-'+_0x420114+'/'+_0x197b83)[_0x3421('0x27')](_0x130d3c);}return null;};}function patchUpdates(_0x39bed4){return function(_0x3df305){try{jsonpatch[_0x3421('0x28')](_0x3df305,_0x39bed4,!![]);}catch(_0xb9af5f){return BPromise[_0x3421('0x29')](_0xb9af5f);}return _0x3df305['save']();};}function saveUpdates(_0x57a4af,_0x494423){return function(_0x3fef90){if(_0x3fef90){return _0x3fef90[_0x3421('0x2a')](_0x57a4af)[_0x3421('0x2b')](function(_0x5bc28a){return _0x5bc28a;});}return null;};}function removeEntity(_0x506af4,_0x1b65d0){return function(_0x5b53b6){if(_0x5b53b6){return _0x5b53b6[_0x3421('0x2c')]()['then'](function(){var _0x15e73c=_0x5b53b6[_0x3421('0x2d')]({'plain':!![]});var _0x36d75f=_0x3421('0x2e');return db[_0x3421('0x2f')]['destroy']({'where':{'type':_0x36d75f,'resourceId':_0x15e73c['id']}})[_0x3421('0x2b')](function(){return _0x5b53b6;});})['then'](function(){_0x506af4['status'](0xcc)[_0x3421('0x30')]();});}};}function handleEntityNotFound(_0x5aa96b,_0x5074a2){return function(_0xb4eaf4){if(!_0xb4eaf4){_0x5aa96b['sendStatus'](0x194);}return _0xb4eaf4;};}function handleError(_0x20abc7,_0x5bcd19){_0x5bcd19=_0x5bcd19||0x1f4;return function(_0xc7f9fb){logger[_0x3421('0x31')](_0xc7f9fb['stack']);if(_0xc7f9fb[_0x3421('0x32')]){delete _0xc7f9fb[_0x3421('0x32')];}_0x20abc7[_0x3421('0x20')](_0x5bcd19)['send'](_0xc7f9fb);};}exports[_0x3421('0x33')]=function(_0x50d61b,_0x2b5af4){var _0xf0039={},_0x1045ab={},_0x841e08={'count':0x0,'rows':[]};var _0x3875c6=_[_0x3421('0x34')](db[_0x3421('0x35')][_0x3421('0x36')],function(_0x94559a){return{'name':_0x94559a[_0x3421('0x37')],'type':_0x94559a['type']['key']};});_0x1045ab[_0x3421('0x38')]=_[_0x3421('0x34')](_0x3875c6,'name');_0x1045ab[_0x3421('0x39')]=_[_0x3421('0x3a')](_0x50d61b[_0x3421('0x39')]);_0x1045ab[_0x3421('0x3b')]=_[_0x3421('0x3c')](_0x1045ab['model'],_0x1045ab[_0x3421('0x39')]);_0xf0039[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x1045ab['model'],qs[_0x3421('0x3e')](_0x50d61b['query'][_0x3421('0x3e')]));_0xf0039[_0x3421('0x3d')]=_0xf0039[_0x3421('0x3d')][_0x3421('0x3f')]?_0xf0039[_0x3421('0x3d')]:_0x1045ab[_0x3421('0x38')];if(!_0x50d61b[_0x3421('0x39')]['hasOwnProperty']('nolimit')){_0xf0039['limit']=qs[_0x3421('0x23')](_0x50d61b['query']['limit']);_0xf0039[_0x3421('0x21')]=qs['offset'](_0x50d61b[_0x3421('0x39')][_0x3421('0x21')]);}_0xf0039['order']=qs[_0x3421('0x40')](_0x50d61b[_0x3421('0x39')][_0x3421('0x40')]);_0xf0039[_0x3421('0x41')]=qs['filters'](_[_0x3421('0x42')](_0x50d61b[_0x3421('0x39')],_0x1045ab[_0x3421('0x3b')]),_0x3875c6);if(_0x50d61b[_0x3421('0x39')][_0x3421('0x43')]){_0xf0039['where']=_[_0x3421('0x44')](_0xf0039[_0x3421('0x41')],{'$or':_['map'](_0x3875c6,function(_0x15551c){if(_0x15551c['type']!=='VIRTUAL'){var _0x486ce8={};_0x486ce8[_0x15551c[_0x3421('0x32')]]={'$like':'%'+_0x50d61b[_0x3421('0x39')][_0x3421('0x43')]+'%'};return _0x486ce8;}})});}_0xf0039=_[_0x3421('0x44')]({},_0xf0039,_0x50d61b[_0x3421('0x45')]);var _0x417d6e={'where':_0xf0039[_0x3421('0x41')]};return db[_0x3421('0x35')][_0x3421('0x24')](_0x417d6e)[_0x3421('0x2b')](function(_0x3b9d15){_0x841e08[_0x3421('0x24')]=_0x3b9d15;if(_0x50d61b[_0x3421('0x39')][_0x3421('0x46')]){_0xf0039['include']=[{'all':!![]}];}return db[_0x3421('0x35')][_0x3421('0x47')](_0xf0039);})[_0x3421('0x2b')](function(_0x4466be){_0x841e08['rows']=_0x4466be;return _0x841e08;})[_0x3421('0x2b')](respondWithFilteredResult(_0x2b5af4,_0xf0039))['catch'](handleError(_0x2b5af4,null));};exports[_0x3421('0x48')]=function(_0x248f84,_0x669cfd){var _0x176aef={'raw':![],'where':{'id':_0x248f84[_0x3421('0x49')]['id']}},_0x2f9a84={};_0x2f9a84[_0x3421('0x38')]=_[_0x3421('0x3a')](db[_0x3421('0x35')][_0x3421('0x36')]);_0x2f9a84[_0x3421('0x39')]=_[_0x3421('0x3a')](_0x248f84[_0x3421('0x39')]);_0x2f9a84['filters']=_[_0x3421('0x3c')](_0x2f9a84['model'],_0x2f9a84[_0x3421('0x39')]);_0x176aef[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x2f9a84[_0x3421('0x38')],qs[_0x3421('0x3e')](_0x248f84[_0x3421('0x39')][_0x3421('0x3e')]));_0x176aef[_0x3421('0x3d')]=_0x176aef[_0x3421('0x3d')][_0x3421('0x3f')]?_0x176aef['attributes']:_0x2f9a84[_0x3421('0x38')];if(_0x248f84[_0x3421('0x39')][_0x3421('0x46')]){_0x176aef['include']=[{'all':!![]}];}_0x176aef=_['merge']({},_0x176aef,_0x248f84[_0x3421('0x45')]);return db[_0x3421('0x35')][_0x3421('0x4a')](_0x176aef)['then'](handleEntityNotFound(_0x669cfd,null))[_0x3421('0x2b')](respondWithResult(_0x669cfd,null))[_0x3421('0x4b')](handleError(_0x669cfd,null));};exports[_0x3421('0x2c')]=function(_0x356376,_0x57554a){return db[_0x3421('0x35')][_0x3421('0x4a')]({'where':{'id':_0x356376[_0x3421('0x49')]['id']}})['then'](handleEntityNotFound(_0x57554a,null))['then'](removeEntity(_0x57554a,null))['catch'](handleError(_0x57554a,null));};exports[_0x3421('0x4c')]=function(_0x1021f8,_0x5a9ccf){return db['VoicePrefix'][_0x3421('0x4c')]()[_0x3421('0x2b')](respondWithResult(_0x5a9ccf,null))[_0x3421('0x4b')](handleError(_0x5a9ccf,null));};exports[_0x3421('0x4d')]=function(_0x127835,_0x4987e3){var _0x27d284;return db[_0x3421('0x4e')][_0x3421('0x4f')](function(_0x2f9ce1){return db['VoicePrefix'][_0x3421('0x4d')](_0x127835[_0x3421('0x50')],{'transaction':_0x2f9ce1})[_0x3421('0x2b')](function(_0x48a967){_0x27d284=_0x48a967[_0x3421('0x2d')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x27d284[_0x3421('0x51')]},'raw':!![]})['then'](function(_0x4e33a0){return createVoicePrefixExtensions(_0x27d284,_0x4e33a0,_0x2f9ce1);});});})[_0x3421('0x2b')](function(){var _0x12bd9a=_0x127835['user'][_0x3421('0x2d')]({'plain':!![]});if(!_0x12bd9a)throw new Error(_0x3421('0x52'));if(_0x12bd9a[_0x3421('0x53')]===_0x3421('0x54')){var _0x1c73b9=_0x27d284;return db[_0x3421('0x55')][_0x3421('0x4a')]({'where':{'name':_0x3421('0x2e'),'userProfileId':_0x12bd9a[_0x3421('0x56')]},'raw':!![]})['then'](function(_0x1e4add){if(_0x1e4add&&_0x1e4add[_0x3421('0x57')]===0x0){return db['UserProfileResource'][_0x3421('0x4d')]({'name':_0x1c73b9[_0x3421('0x32')],'resourceId':_0x1c73b9['id'],'type':_0x1e4add[_0x3421('0x32')],'sectionId':_0x1e4add['id']},{})['then'](function(){return _0x27d284;});}else{return _0x27d284;}})[_0x3421('0x4b')](function(_0x27085d){logger[_0x3421('0x31')](_0x3421('0x58'),_0x27085d);throw _0x27085d;});}return _0x27d284;})[_0x3421('0x2b')](respondWithResult(_0x4987e3,null))[_0x3421('0x4b')](handleError(_0x4987e3,null));};function Extension(_0x333b86,_0x3254aa,_0x31fd9b,_0x279b44){this[_0x3421('0x59')]=_0x3421('0x5a');this[_0x3421('0x5b')]=_0x333b86;this[_0x3421('0x5c')]=_0x31fd9b;this[_0x3421('0x5d')]='system';this[_0x3421('0x5e')]=_0x3421('0x5f');this[_0x3421('0x60')]=_0x3254aa;this[_0x3421('0x61')]=_0x279b44;}function createVoicePrefixExtensions(_0x1813c9,_0x25a641,_0x32c9a7){return new BPromise(function(_0x374a6a,_0x5d6488){var _0x379673=new Extension(formatPrefixName(_0x1813c9['prefix']),0x1,_0x3421('0x62'),_0x3421('0x63'));_0x379673[_0x3421('0x64')]=_0x1813c9['id'];return db[_0x3421('0x65')]['create'](_0x379673,{'transaction':_0x32c9a7})[_0x3421('0x2b')](function(_0x21e11b){var _0x9def45=_0x21e11b[_0x3421('0x2d')]({'plain':!![]});var _0x9e649=_[_0x3421('0x34')](addVoicePrefixExtensions(_0x1813c9,_0x25a641),function(_0x5e6c4d){_0x5e6c4d[_0x3421('0x51')]=_0x9def45['id'];_0x5e6c4d[_0x3421('0x64')]=_0x1813c9['id'];return _0x5e6c4d;});return db[_0x3421('0x65')][_0x3421('0x66')](_0x9e649,{'transaction':_0x32c9a7})[_0x3421('0x2b')](function(_0x1ba5e1){if(!_0x1ba5e1){return _0x5d6488(_0x3421('0x67'));}else{return _0x374a6a(_0x1ba5e1);}})[_0x3421('0x4b')](function(_0x4edb4e){return _0x5d6488(_0x4edb4e);});});;});};function addVoicePrefixExtensions(_0xfbdb57,_0x46717b){var _0x200958=[];var _0x40ae83=formatPrefixName(_0xfbdb57[_0x3421('0x68')]);_0x200958['push'](new Extension(_0x40ae83,0x2,'Set',_0x3421('0x69')+_0xfbdb57[_0x3421('0x32')]));if(_0xfbdb57[_0x3421('0x6a')]){_0x200958['push'](new Extension(_0x40ae83,0x3,_0x3421('0x6b'),'PREFIX-CALLERIDALL='+_0xfbdb57[_0x3421('0x6a')]));}else{_0x200958['push'](new Extension(_0x40ae83,0x3,'NoOp','No\x20callerid\x20available'));}_0x200958['push'](new Extension(_0x40ae83,0x4,'goto',_0x46717b[_0x3421('0x59')]+','+_0x3421('0x6c')+(0x8+_0xfbdb57[_0x3421('0x32')][_0x3421('0x3f')])+'}'+','+0x1));return _0x200958;}function formatPrefixName(_0xa05828){var _0x3ccb08='_';for(var _0x231067=0x0;_0x231067<_0xa05828[_0x3421('0x3f')];_0x231067++){if(_0xa05828[_0x3421('0x6d')](_0x231067)=='-'){_0x3ccb08+=_0xa05828[_0x3421('0x6d')](_0x231067);}else{_0x3ccb08+='['+_0xa05828['charAt'](_0x231067)+']';}}_0x3ccb08+='.';return _0x3ccb08;}exports[_0x3421('0x2a')]=function(_0x4dce60,_0x252b28,_0x41e5f8){var _0x40e0a6=_0x4dce60[_0x3421('0x50')];_0x40e0a6[_0x3421('0x68')]=_0x3421('0x6e')+_0x40e0a6[_0x3421('0x32')]+'-';return db[_0x3421('0x4e')][_0x3421('0x4f')](function(_0x5c74a8){return db[_0x3421('0x35')][_0x3421('0x2a')](_0x40e0a6,{'where':{'id':_0x40e0a6['id']},'transaction':_0x5c74a8})[_0x3421('0x2b')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x40e0a6['id']},'transaction':_0x5c74a8})['then'](function(){return db['VoiceExtension'][_0x3421('0x4a')]({'where':{'id':_0x40e0a6['VoiceExtensionId']},'raw':!![]})[_0x3421('0x2b')](function(_0x8aee05){return createVoicePrefixExtensions(_0x40e0a6,_0x8aee05,_0x5c74a8);});});});})[_0x3421('0x2b')](function(){return db[_0x3421('0x35')]['findById'](_0x40e0a6['id']);})[_0x3421('0x2b')](respondWithResult(_0x252b28,null))[_0x3421('0x4b')](handleError(_0x252b28,null));};exports[_0x3421('0x6f')]=function(_0xfb8c60,_0x151eaf,_0x4177cc){return db['VoicePrefix'][_0x3421('0x4a')]({'where':{'id':_0xfb8c60[_0x3421('0x49')]['id']}})[_0x3421('0x2b')](handleEntityNotFound(_0x151eaf,null))[_0x3421('0x2b')](function(_0x37e6d8){if(_0x37e6d8){return _0x37e6d8[_0x3421('0x6f')](_0xfb8c60[_0x3421('0x50')]['ids'],_['omit'](_0xfb8c60[_0x3421('0x50')],[_0x3421('0x70'),'id'])||{})[_0x3421('0x71')](function(_0x5d04c6){for(var _0x2dac40=0x0;_0x2dac40<_0xfb8c60['body'][_0x3421('0x70')]['length'];_0x2dac40+=0x1){socket[_0x3421('0x72')](_0x3421('0x73'),{'UserId':Number(_0xfb8c60[_0x3421('0x50')][_0x3421('0x70')][_0x2dac40]),'VoicePrefixId':Number(_0xfb8c60[_0x3421('0x49')]['id'])});}return _0x5d04c6;});}})[_0x3421('0x2b')](respondWithResult(_0x151eaf,null))[_0x3421('0x4b')](handleError(_0x151eaf,null));};exports[_0x3421('0x74')]=function(_0x3f1df5,_0x37ca80,_0x427013){return db[_0x3421('0x35')]['find']({'where':{'id':_0x3f1df5[_0x3421('0x49')]['id']}})[_0x3421('0x2b')](handleEntityNotFound(_0x37ca80,null))[_0x3421('0x2b')](function(_0x387d09){if(_0x387d09){return _0x387d09[_0x3421('0x74')](_0x3f1df5[_0x3421('0x39')][_0x3421('0x70')])[_0x3421('0x2b')](function(){if(_['isArray'](_0x3f1df5[_0x3421('0x39')]['ids'])){for(var _0x4d92ed=0x0;_0x4d92ed<_0x3f1df5['query'][_0x3421('0x70')][_0x3421('0x3f')];_0x4d92ed+=0x1){socket[_0x3421('0x72')](_0x3421('0x75'),{'UserId':Number(_0x3f1df5['query'][_0x3421('0x70')][_0x4d92ed]),'VoicePrefixId':Number(_0x3f1df5[_0x3421('0x49')]['id'])});}}else{socket[_0x3421('0x72')](_0x3421('0x75'),{'UserId':Number(_0x3f1df5[_0x3421('0x39')][_0x3421('0x70')]),'VoicePrefixId':Number(_0x3f1df5[_0x3421('0x49')]['id'])});}});}})[_0x3421('0x2b')](respondWithStatusCode(_0x37ca80,null))[_0x3421('0x4b')](handleError(_0x37ca80,null));};exports[_0x3421('0x76')]=function(_0x19e35d,_0x414218,_0x1d65ba){var _0x170340={};var _0x456644={};var _0x355f47;var _0x826d7c;return db['VoicePrefix']['findOne']({'where':{'id':_0x19e35d[_0x3421('0x49')]['id']}})['then'](handleEntityNotFound(_0x414218,null))[_0x3421('0x2b')](function(_0x2fd442){if(_0x2fd442){_0x355f47=_0x2fd442;_0x456644['model']=_[_0x3421('0x3a')](db[_0x3421('0x77')][_0x3421('0x36')]);_0x456644[_0x3421('0x39')]=_[_0x3421('0x3a')](_0x19e35d[_0x3421('0x39')]);_0x456644[_0x3421('0x3b')]=_[_0x3421('0x3c')](_0x456644[_0x3421('0x38')],_0x456644[_0x3421('0x39')]);_0x170340[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x456644[_0x3421('0x38')],qs['fields'](_0x19e35d[_0x3421('0x39')]['fields']));_0x170340[_0x3421('0x3d')]=_0x170340[_0x3421('0x3d')]['length']?_0x170340[_0x3421('0x3d')]:_0x456644['model'];_0x170340['order']=qs[_0x3421('0x40')](_0x19e35d[_0x3421('0x39')][_0x3421('0x40')]);_0x170340['where']=qs[_0x3421('0x3b')](_[_0x3421('0x42')](_0x19e35d[_0x3421('0x39')],_0x456644['filters']));if(_0x19e35d['query'][_0x3421('0x43')]){_0x170340[_0x3421('0x41')]=_[_0x3421('0x44')](_0x170340[_0x3421('0x41')],{'$or':_['map'](_0x170340[_0x3421('0x3d')],function(_0x1fcd4b){var _0x298afc={};_0x298afc[_0x1fcd4b]={'$like':'%'+_0x19e35d[_0x3421('0x39')][_0x3421('0x43')]+'%'};return _0x298afc;})});}_0x170340=_[_0x3421('0x44')]({},_0x170340,_0x19e35d[_0x3421('0x45')]);return _0x355f47[_0x3421('0x76')](_0x170340);}})['then'](function(_0x27967d){if(_0x27967d){_0x826d7c=_0x27967d[_0x3421('0x3f')];if(!_0x19e35d['query']['hasOwnProperty'](_0x3421('0x78'))){_0x170340[_0x3421('0x23')]=qs[_0x3421('0x23')](_0x19e35d[_0x3421('0x39')][_0x3421('0x23')]);_0x170340['offset']=qs['offset'](_0x19e35d[_0x3421('0x39')]['offset']);}return _0x355f47['getAgents'](_0x170340);}})[_0x3421('0x2b')](function(_0x1a5b7c){if(_0x1a5b7c){return _0x1a5b7c?{'count':_0x826d7c,'rows':_0x1a5b7c}:null;}})[_0x3421('0x2b')](respondWithResult(_0x414218,null))[_0x3421('0x4b')](handleError(_0x414218,null));};exports['getTeams']=function(_0x595f0a,_0x335331,_0x5a922d){var _0x5af9c9={};var _0x1fb48f={};var _0x3fc2b6;var _0x4289f3;return db['VoicePrefix']['findOne']({'where':{'id':_0x595f0a['params']['id']}})[_0x3421('0x2b')](handleEntityNotFound(_0x335331,null))[_0x3421('0x2b')](function(_0x176b12){if(_0x176b12){_0x3fc2b6=_0x176b12;_0x1fb48f[_0x3421('0x38')]=_[_0x3421('0x3a')](db[_0x3421('0x79')][_0x3421('0x36')]);_0x1fb48f['query']=_[_0x3421('0x3a')](_0x595f0a[_0x3421('0x39')]);_0x1fb48f[_0x3421('0x3b')]=_[_0x3421('0x3c')](_0x1fb48f[_0x3421('0x38')],_0x1fb48f[_0x3421('0x39')]);_0x5af9c9[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x1fb48f[_0x3421('0x38')],qs['fields'](_0x595f0a['query'][_0x3421('0x3e')]));_0x5af9c9['attributes']=_0x5af9c9[_0x3421('0x3d')]['length']?_0x5af9c9[_0x3421('0x3d')]:_0x1fb48f[_0x3421('0x38')];_0x5af9c9[_0x3421('0x7a')]=qs[_0x3421('0x40')](_0x595f0a[_0x3421('0x39')]['sort']);_0x5af9c9['where']=qs[_0x3421('0x3b')](_[_0x3421('0x42')](_0x595f0a[_0x3421('0x39')],_0x1fb48f[_0x3421('0x3b')]));if(_0x595f0a['query'][_0x3421('0x43')]){_0x5af9c9[_0x3421('0x41')]=_[_0x3421('0x44')](_0x5af9c9[_0x3421('0x41')],{'$or':_[_0x3421('0x34')](_0x5af9c9[_0x3421('0x3d')],function(_0x31095c){var _0x4c3058={};_0x4c3058[_0x31095c]={'$like':'%'+_0x595f0a[_0x3421('0x39')][_0x3421('0x43')]+'%'};return _0x4c3058;})});}_0x5af9c9=_['merge']({},_0x5af9c9,_0x595f0a[_0x3421('0x45')]);return _0x3fc2b6[_0x3421('0x7b')](_0x5af9c9);}})[_0x3421('0x2b')](function(_0x58b3e4){if(_0x58b3e4){_0x4289f3=_0x58b3e4[_0x3421('0x3f')];if(!_0x595f0a[_0x3421('0x39')]['hasOwnProperty'](_0x3421('0x78'))){_0x5af9c9[_0x3421('0x23')]=qs[_0x3421('0x23')](_0x595f0a[_0x3421('0x39')][_0x3421('0x23')]);_0x5af9c9[_0x3421('0x21')]=qs[_0x3421('0x21')](_0x595f0a[_0x3421('0x39')]['offset']);}return _0x3fc2b6[_0x3421('0x7b')](_0x5af9c9);}})['then'](function(_0x5aaa8a){if(_0x5aaa8a){return _0x5aaa8a?{'count':_0x4289f3,'rows':_0x5aaa8a}:null;}})[_0x3421('0x2b')](respondWithResult(_0x335331,null))[_0x3421('0x4b')](handleError(_0x335331,null));};exports[_0x3421('0x7c')]=function(_0x2c62d7,_0x5cbf21,_0x25c6a0){var _0x44e166=_0x2c62d7[_0x3421('0x50')][_0x3421('0x70')];var _0x13b03f;return db[_0x3421('0x79')][_0x3421('0x47')]({'where':{'id':_0x44e166},'attributes':['id'],'include':[{'model':db[_0x3421('0x77')],'as':_0x3421('0x7d'),'attributes':['id',_0x3421('0x32'),_0x3421('0x7e'),_0x3421('0x7f'),_0x3421('0x80')],'raw':!![]}]})[_0x3421('0x2b')](function(_0x1cde5f){if(_0x1cde5f){_0x13b03f=_0x1cde5f;var _0x1ddc33=_[_0x3421('0x81')](_0x1cde5f,function(_0x34f980){var _0x7d7398=_0x34f980[_0x3421('0x2d')]({'plain':!![]});return _0x7d7398[_0x3421('0x7d')];});return db['VoicePrefix']['find']({'where':{'id':_0x2c62d7[_0x3421('0x49')]['id']}})[_0x3421('0x2b')](function(_0x1a7038){return db[_0x3421('0x4e')]['transaction'](function(_0x18f27a){return _0x1a7038[_0x3421('0x7c')](_0x44e166,{'transaction':_0x18f27a})['then'](function(){return BPromise[_0x3421('0x82')](_0x13b03f,function(_0x2eb3f4){return db[_0x3421('0x83')]['upsert']({'TeamId':_0x2eb3f4['id'],'VoicePrefixId':_0x2c62d7[_0x3421('0x49')]['id']},{'transaction':_0x18f27a});});})['then'](function(){return BPromise[_0x3421('0x82')](_0x1ddc33,function(_0x3f6f2c){return db[_0x3421('0x84')][_0x3421('0x85')]({'where':{'UserId':_0x3f6f2c['id'],'VoicePrefixId':_0x2c62d7[_0x3421('0x49')]['id']},'transaction':_0x18f27a});});})[_0x3421('0x2b')](function(){_0x1ddc33[_0x3421('0x86')](function(_0x50607f){socket[_0x3421('0x72')]('userVoicePrefix:save',{'UserId':_0x50607f['id'],'VoicePrefixId':_0x1a7038['id']});});});});});}})['then'](respondWithStatusCode(_0x5cbf21,null))[_0x3421('0x4b')](handleError(_0x5cbf21,null));};exports[_0x3421('0x87')]=function(_0x4a85d1,_0x1b48e1,_0x4c357e){return db[_0x3421('0x79')][_0x3421('0x47')]({'where':{'id':_0x4a85d1[_0x3421('0x39')][_0x3421('0x70')]},'attributes':['id'],'include':[{'model':db[_0x3421('0x77')],'as':_0x3421('0x7d'),'attributes':['id'],'raw':!![]}]})[_0x3421('0x2b')](handleEntityNotFound(_0x1b48e1,null))[_0x3421('0x2b')](function(_0x2f38ec){var _0x11f294=_[_0x3421('0x34')](_0x2f38ec,'id');var _0x2d7330=[];var _0x5bf9a4=[];var _0x36868f=squel['select']();_0x36868f['field'](_0x3421('0x88'))[_0x3421('0x89')](_0x3421('0x8a'),'tq')[_0x3421('0x8b')]('user_has_teams','ut',_0x3421('0x8c'))[_0x3421('0x41')]('VoicePrefixId\x20=\x20?',_0x4a85d1[_0x3421('0x49')]['id']);for(var _0x4a933a=0x0;_0x4a933a<_0x2f38ec[_0x3421('0x3f')];_0x4a933a+=0x1){let _0x2defcb=_0x2f38ec[_0x4a933a];for(var _0x16735e=0x0;_0x16735e<_0x2defcb['Agents'][_0x3421('0x3f')];_0x16735e+=0x1){let _0x303df7=_0x2defcb[_0x3421('0x7d')][_0x16735e];var _0x1d8163=_0x36868f[_0x3421('0x8d')]();_0x1d8163[_0x3421('0x41')](_0x3421('0x8e'),_0x303df7['id']);_0x5bf9a4[_0x3421('0x8f')](db['sequelize'][_0x3421('0x39')](_0x1d8163[_0x3421('0x90')](),{'type':db[_0x3421('0x4e')][_0x3421('0x91')][_0x3421('0x92')]})[_0x3421('0x2b')](function(_0x3a5346){if(_0x3a5346['length']===0x1){return _0x303df7['id'];}else{var _0x3f64d0=_[_0x3421('0x93')](_['map'](_0x3a5346,'TeamId'),function(_0x4aa261){return _[_0x3421('0x94')](_0x11f294,_0x4aa261);});if(_0x3f64d0){return _0x303df7['id'];}}}));}}return BPromise[_0x3421('0x95')](_0x5bf9a4)['then'](function(_0x256976){_0x2d7330=_(_0x2d7330)[_0x3421('0x96')](_0x256976)[_0x3421('0x97')]()[_0x3421('0x98')]();return db[_0x3421('0x35')][_0x3421('0x4a')]({'where':{'id':_0x4a85d1[_0x3421('0x49')]['id']}})['then'](function(_0x224e26){return db[_0x3421('0x4e')][_0x3421('0x4f')](function(_0x1e2a67){return _0x224e26[_0x3421('0x87')](_0x4a85d1[_0x3421('0x39')]['ids'],{'transaction':_0x1e2a67})[_0x3421('0x2b')](function(){if(!_[_0x3421('0x99')](_0x2d7330)){return _0x224e26['removeAgents'](_0x2d7330,{'transaction':_0x1e2a67});}})[_0x3421('0x2b')](function(){_0x2d7330[_0x3421('0x86')](function(_0x25cc13){socket[_0x3421('0x72')](_0x3421('0x75'),{'UserId':_0x25cc13,'VoicePrefixId':_0x224e26['id']});});});});});});})[_0x3421('0x2b')](respondWithStatusCode(_0x1b48e1,null))[_0x3421('0x4b')](handleError(_0x1b48e1,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0ea198b..9ea9d14 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 _0x234f=['events','VoicePrefix','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x316904,_0x1e8b77){var _0xfa9a21=function(_0x2b75ae){while(--_0x2b75ae){_0x316904['push'](_0x316904['shift']());}};_0xfa9a21(++_0x1e8b77);}(_0x234f,0x1f0));var _0xf234=function(_0xd0c4ac,_0x17cc7a){_0xd0c4ac=_0xd0c4ac-0x0;var _0xa27128=_0x234f[_0xd0c4ac];return _0xa27128;};'use strict';var EventEmitter=require(_0xf234('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xf234('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf234('0x2'),'afterUpdate':_0xf234('0x3'),'afterDestroy':_0xf234('0x4')};function emitEvent(_0x620eaa){return function(_0x1ef8bc,_0x127392,_0x499e99){VoicePrefixEvents[_0xf234('0x5')](_0x620eaa+':'+_0x1ef8bc['id'],_0x1ef8bc);VoicePrefixEvents[_0xf234('0x5')](_0x620eaa,_0x1ef8bc);_0x499e99(null);};}for(var e in events){if(events[_0xf234('0x6')](e)){var event=events[e];VoicePrefix[_0xf234('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x4087=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix'];(function(_0x4f81f6,_0x4d8c60){var _0x283e8e=function(_0x3b2889){while(--_0x3b2889){_0x4f81f6['push'](_0x4f81f6['shift']());}};_0x283e8e(++_0x4d8c60);}(_0x4087,0xf0));var _0x7408=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4087[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x7408('0x0'));var VoicePrefix=require(_0x7408('0x1'))['db'][_0x7408('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7408('0x3'),'afterUpdate':_0x7408('0x4'),'afterDestroy':_0x7408('0x5')};function emitEvent(_0x24cbb2){return function(_0x118140,_0x21abf2,_0x258f8b){VoicePrefixEvents['emit'](_0x24cbb2+':'+_0x118140['id'],_0x118140);VoicePrefixEvents['emit'](_0x24cbb2,_0x118140);_0x258f8b(null);};}for(var e in events){if(events[_0x7408('0x6')](e)){var event=events[e];VoicePrefix[_0x7408('0x7')](e,emitEvent(event));}}module[_0x7408('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 bf35d4d..cd963f0 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 _0x7697=['VoicePrefix','voice_prefixes','lodash','util','moment','path','rimraf','exports','define'];(function(_0x42135f,_0x27e237){var _0x42f55b=function(_0x469077){while(--_0x469077){_0x42135f['push'](_0x42135f['shift']());}};_0x42f55b(++_0x27e237);}(_0x7697,0x18e));var _0x7769=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x7697[_0x5c6244];return _0x5800ce;};'use strict';var _=require(_0x7769('0x0'));var util=require(_0x7769('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7769('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7769('0x3'));var rimraf=require(_0x7769('0x4'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x7769('0x5')]=function(_0x5507c2,_0x125b0f){return _0x5507c2[_0x7769('0x6')](_0x7769('0x7'),attributes,{'tableName':_0x7769('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98b2=['../../config/environment','./voicePrefix.attributes','define','VoicePrefix','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x144728,_0x11b05b){var _0x54cde2=function(_0x532b8b){while(--_0x532b8b){_0x144728['push'](_0x144728['shift']());}};_0x54cde2(++_0x11b05b);}(_0x98b2,0x108));var _0x298b=function(_0x5ef2d3,_0x2a6fa1){_0x5ef2d3=_0x5ef2d3-0x0;var _0x2a78fe=_0x98b2[_0x5ef2d3];return _0x2a78fe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x298b('0x0'))(_0x298b('0x1'));var moment=require(_0x298b('0x2'));var BPromise=require(_0x298b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x298b('0x4'));var rimraf=require(_0x298b('0x5'));var config=require(_0x298b('0x6'));var attributes=require(_0x298b('0x7'));module['exports']=function(_0x370bd3,_0x3e23ef){return _0x370bd3[_0x298b('0x8')](_0x298b('0x9'),attributes,{'tableName':'voice_prefixes','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 97128a4..7d34448 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 _0x5d95=['rpc','client','http','redis','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4d0b1f,_0x3e9d04){var _0xde9596=function(_0x2beec4){while(--_0x2beec4){_0x4d0b1f['push'](_0x4d0b1f['shift']());}};_0xde9596(++_0x3e9d04);}(_0x5d95,0x77));var _0x55d9=function(_0x368f4c,_0x528236){_0x368f4c=_0x368f4c-0x0;var _0x65c0be=_0x5d95[_0x368f4c];return _0x65c0be;};'use strict';var _=require(_0x55d9('0x0'));var util=require(_0x55d9('0x1'));var moment=require('moment');var BPromise=require(_0x55d9('0x2'));var rs=require(_0x55d9('0x3'));var fs=require('fs');var Redis=require(_0x55d9('0x4'));var db=require(_0x55d9('0x5'))['db'];var utils=require(_0x55d9('0x6'));var logger=require('../../config/logger')(_0x55d9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x55d9('0x8')][_0x55d9('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55d9('0xa')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x77a04f,_0x373788,_0x2b406c){return new BPromise(function(_0xfd0f08,_0x38cde2){return client[_0x55d9('0xb')](_0x77a04f,_0x2b406c)['then'](function(_0x552cb8){logger[_0x55d9('0xc')](_0x55d9('0xd'),_0x373788,_0x55d9('0xe'));logger[_0x55d9('0xf')](_0x55d9('0x10'),_0x373788,_0x55d9('0xe'),JSON[_0x55d9('0x11')](_0x552cb8));if(_0x552cb8[_0x55d9('0x12')]){if(_0x552cb8[_0x55d9('0x12')]['code']===0x1f4){logger[_0x55d9('0x12')](_0x55d9('0xd'),_0x373788,_0x552cb8[_0x55d9('0x12')][_0x55d9('0x13')]);return _0x38cde2(_0x552cb8[_0x55d9('0x12')][_0x55d9('0x13')]);}logger[_0x55d9('0x12')](_0x55d9('0xd'),_0x373788,_0x552cb8[_0x55d9('0x12')][_0x55d9('0x13')]);return _0xfd0f08(_0x552cb8[_0x55d9('0x12')][_0x55d9('0x13')]);}else{logger[_0x55d9('0xc')](_0x55d9('0xd'),_0x373788,'request\x20sent');_0xfd0f08(_0x552cb8[_0x55d9('0x14')][_0x55d9('0x13')]);}})['catch'](function(_0x4c8561){logger['error'](_0x55d9('0xd'),_0x373788,_0x4c8561);_0x38cde2(_0x4c8561);});});} \ No newline at end of file +var _0xd290=['../../config/environment','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x127074,_0x3bd855){var _0x4c9463=function(_0xf337a6){while(--_0xf337a6){_0x127074['push'](_0x127074['shift']());}};_0x4c9463(++_0x3bd855);}(_0xd290,0x165));var _0x0d29=function(_0x5662a1,_0x184de1){_0x5662a1=_0x5662a1-0x0;var _0x45ebdf=_0xd290[_0x5662a1];return _0x45ebdf;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var moment=require('moment');var BPromise=require(_0x0d29('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d29('0x3'))['db'];var utils=require(_0x0d29('0x4'));var logger=require(_0x0d29('0x5'))(_0x0d29('0x6'));var config=require(_0x0d29('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d29('0x8')][_0x0d29('0x9')]({'port':0x232a});config[_0x0d29('0xa')]=_[_0x0d29('0xb')](config[_0x0d29('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0d29('0xc'))(new Redis(config[_0x0d29('0xa')]));require(_0x0d29('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e3dd7,_0x2da8de,_0x591d7f){return new BPromise(function(_0x3b5660,_0x39d315){return client['request'](_0x2e3dd7,_0x591d7f)[_0x0d29('0xe')](function(_0x4ffd50){logger[_0x0d29('0xf')](_0x0d29('0x10'),_0x2da8de,_0x0d29('0x11'));logger[_0x0d29('0x12')](_0x0d29('0x13'),_0x2da8de,'request\x20sent',JSON[_0x0d29('0x14')](_0x4ffd50));if(_0x4ffd50[_0x0d29('0x15')]){if(_0x4ffd50[_0x0d29('0x15')][_0x0d29('0x16')]===0x1f4){logger[_0x0d29('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x2da8de,_0x4ffd50['error']['message']);return _0x39d315(_0x4ffd50[_0x0d29('0x15')]['message']);}logger[_0x0d29('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x2da8de,_0x4ffd50[_0x0d29('0x15')][_0x0d29('0x17')]);return _0x3b5660(_0x4ffd50[_0x0d29('0x15')][_0x0d29('0x17')]);}else{logger[_0x0d29('0xf')](_0x0d29('0x10'),_0x2da8de,'request\x20sent');_0x3b5660(_0x4ffd50[_0x0d29('0x18')][_0x0d29('0x17')]);}})[_0x0d29('0x19')](function(_0x24e774){logger[_0x0d29('0x15')](_0x0d29('0x10'),_0x2da8de,_0x24e774);_0x39d315(_0x24e774);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 547763d..ffe9bf2 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 _0x0cee=['save','remove','update','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x43ae2d,_0x194fac){var _0x25e6a2=function(_0x16eaf9){while(--_0x16eaf9){_0x43ae2d['push'](_0x43ae2d['shift']());}};_0x25e6a2(++_0x194fac);}(_0x0cee,0x12f));var _0xe0ce=function(_0x499a99,_0x1abd8c){_0x499a99=_0x499a99-0x0;var _0x5e8d49=_0x0cee[_0x499a99];return _0x5e8d49;};'use strict';var VoicePrefixEvents=require(_0xe0ce('0x0'));var events=[_0xe0ce('0x1'),_0xe0ce('0x2'),_0xe0ce('0x3')];function createListener(_0x315ac1,_0x25ec67){return function(_0x54f977){_0x25ec67['emit'](_0x315ac1,_0x54f977);};}function removeListener(_0xe181aa,_0x3e377b){return function(){VoicePrefixEvents[_0xe0ce('0x4')](_0xe181aa,_0x3e377b);};}exports[_0xe0ce('0x5')]=function(_0x1cfee1){for(var _0x1ce646=0x0,_0x64f82c=events[_0xe0ce('0x6')];_0x1ce646<_0x64f82c;_0x1ce646++){var _0x494eca=events[_0x1ce646];var _0x27eea3=createListener(_0xe0ce('0x7')+_0x494eca,_0x1cfee1);VoicePrefixEvents['on'](_0x494eca,_0x27eea3);}}; \ No newline at end of file +var _0x3013=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x54d514,_0x5d67dc){var _0x2b6036=function(_0x1e16fc){while(--_0x1e16fc){_0x54d514['push'](_0x54d514['shift']());}};_0x2b6036(++_0x5d67dc);}(_0x3013,0xea));var _0x3301=function(_0x35319a,_0x3305f5){_0x35319a=_0x35319a-0x0;var _0x2a1016=_0x3013[_0x35319a];return _0x2a1016;};'use strict';var VoicePrefixEvents=require(_0x3301('0x0'));var events=[_0x3301('0x1'),_0x3301('0x2'),_0x3301('0x3')];function createListener(_0x5e4344,_0x4e38dd){return function(_0x49d628){_0x4e38dd[_0x3301('0x4')](_0x5e4344,_0x49d628);};}function removeListener(_0x153554,_0xb395bd){return function(){VoicePrefixEvents[_0x3301('0x5')](_0x153554,_0xb395bd);};}exports['register']=function(_0x30b608){for(var _0x52515d=0x0,_0x41dd5b=events[_0x3301('0x6')];_0x52515d<_0x41dd5b;_0x52515d++){var _0x4299f9=events[_0x52515d];var _0x1b1d66=createListener(_0x3301('0x7')+_0x4299f9,_0x30b608);VoicePrefixEvents['on'](_0x4299f9,_0x1b1d66);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 9e84466..085f284 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 _0x177a=['addTeams','addAgents','addLists','addBlackLists','put','destroy','delete','removeTeams','removeAgents','removeLists','removeBlackLists','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','post','create'];(function(_0x29e038,_0x477239){var _0x9c0462=function(_0xd9d9ff){while(--_0xd9d9ff){_0x29e038['push'](_0x29e038['shift']());}};_0x9c0462(++_0x477239);}(_0x177a,0xdd));var _0xa177=function(_0x112f60,_0xc8585e){_0x112f60=_0x112f60-0x0;var _0x22e028=_0x177a[_0x112f60];return _0x22e028;};'use strict';var multer=require(_0xa177('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa177('0x1'));var express=require(_0xa177('0x2'));var router=express[_0xa177('0x3')]();var fs_extra=require(_0xa177('0x4'));var auth=require(_0xa177('0x5'));var interaction=require(_0xa177('0x6'));var config=require('../../config/environment');var controller=require(_0xa177('0x7'));router[_0xa177('0x8')]('/',auth[_0xa177('0x9')](),controller[_0xa177('0xa')]);router[_0xa177('0x8')](_0xa177('0xb'),auth[_0xa177('0x9')](),controller[_0xa177('0xc')]);router['get'](_0xa177('0xd'),auth['isAuthenticated'](),controller[_0xa177('0xe')]);router[_0xa177('0x8')](_0xa177('0xf'),auth[_0xa177('0x9')](),controller[_0xa177('0x10')]);router[_0xa177('0x8')](_0xa177('0x11'),auth['isAuthenticated'](),controller[_0xa177('0x12')]);router[_0xa177('0x8')](_0xa177('0x13'),auth[_0xa177('0x9')](),controller[_0xa177('0x14')]);router[_0xa177('0x8')](_0xa177('0x15'),auth['isAuthenticated'](),controller['getTeams']);router[_0xa177('0x8')](_0xa177('0x16'),auth[_0xa177('0x9')](),controller[_0xa177('0x17')]);router[_0xa177('0x8')](_0xa177('0x18'),auth[_0xa177('0x9')](),controller[_0xa177('0x19')]);router[_0xa177('0x8')](_0xa177('0x1a'),auth[_0xa177('0x9')](),controller[_0xa177('0x1b')]);router['get'](_0xa177('0x1c'),auth[_0xa177('0x9')](),controller['getBlackLists']);router[_0xa177('0x1d')]('/',auth[_0xa177('0x9')](),controller[_0xa177('0x1e')]);router[_0xa177('0x1d')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0xa177('0x1d')](_0xa177('0x15'),auth[_0xa177('0x9')](),controller[_0xa177('0x1f')]);router['post'](_0xa177('0x16'),auth['isAuthenticated'](),controller[_0xa177('0x20')]);router['post'](_0xa177('0x1a'),auth[_0xa177('0x9')](),controller[_0xa177('0x21')]);router[_0xa177('0x1d')]('/:id/blacklists',auth[_0xa177('0x9')](),controller[_0xa177('0x22')]);router[_0xa177('0x23')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xa177('0xb'),auth[_0xa177('0x9')](),controller[_0xa177('0x24')]);router[_0xa177('0x25')](_0xa177('0x15'),auth['isAuthenticated'](),controller[_0xa177('0x26')]);router[_0xa177('0x25')]('/:id/users',auth['isAuthenticated'](),controller[_0xa177('0x27')]);router['delete']('/:id/lists',auth['isAuthenticated'](),controller[_0xa177('0x28')]);router['delete'](_0xa177('0x1c'),auth[_0xa177('0x9')](),controller[_0xa177('0x29')]);module['exports']=router; \ No newline at end of file +var _0x9e72=['/:id/lists','/:id/blacklists','addBlackLists','update','destroy','removeAgents','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getTeams','/:id/users','getMembers','getLists','getBlackLists','post','create','clone','/:id/teams'];(function(_0x3bbaec,_0x5ba5de){var _0x5ea30e=function(_0x3b3b83){while(--_0x3b3b83){_0x3bbaec['push'](_0x3bbaec['shift']());}};_0x5ea30e(++_0x5ba5de);}(_0x9e72,0xcd));var _0x29e7=function(_0x4ca8e9,_0x149974){_0x4ca8e9=_0x4ca8e9-0x0;var _0x228253=_0x9e72[_0x4ca8e9];return _0x228253;};'use strict';var multer=require(_0x29e7('0x0'));var util=require(_0x29e7('0x1'));var path=require(_0x29e7('0x2'));var timeout=require(_0x29e7('0x3'));var express=require('express');var router=express[_0x29e7('0x4')]();var fs_extra=require(_0x29e7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29e7('0x6'));var controller=require(_0x29e7('0x7'));router[_0x29e7('0x8')]('/',auth[_0x29e7('0x9')](),controller[_0x29e7('0xa')]);router[_0x29e7('0x8')](_0x29e7('0xb'),auth[_0x29e7('0x9')](),controller[_0x29e7('0xc')]);router[_0x29e7('0x8')](_0x29e7('0xd'),auth[_0x29e7('0x9')](),controller[_0x29e7('0xe')]);router[_0x29e7('0x8')](_0x29e7('0xf'),auth[_0x29e7('0x9')](),controller[_0x29e7('0x10')]);router[_0x29e7('0x8')](_0x29e7('0x11'),auth[_0x29e7('0x9')](),controller[_0x29e7('0x12')]);router[_0x29e7('0x8')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x29e7('0x13')]);router[_0x29e7('0x8')]('/:id/teams',auth[_0x29e7('0x9')](),controller[_0x29e7('0x14')]);router[_0x29e7('0x8')](_0x29e7('0x15'),auth[_0x29e7('0x9')](),controller['getAgents']);router[_0x29e7('0x8')]('/:id/members',auth[_0x29e7('0x9')](),controller[_0x29e7('0x16')]);router[_0x29e7('0x8')]('/:id/lists',auth[_0x29e7('0x9')](),controller[_0x29e7('0x17')]);router['get']('/:id/blacklists',auth[_0x29e7('0x9')](),controller[_0x29e7('0x18')]);router[_0x29e7('0x19')]('/',auth['isAuthenticated'](),controller[_0x29e7('0x1a')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x29e7('0x1b')]);router[_0x29e7('0x19')](_0x29e7('0x1c'),auth[_0x29e7('0x9')](),controller['addTeams']);router[_0x29e7('0x19')](_0x29e7('0x15'),auth[_0x29e7('0x9')](),controller['addAgents']);router[_0x29e7('0x19')](_0x29e7('0x1d'),auth[_0x29e7('0x9')](),controller['addLists']);router[_0x29e7('0x19')](_0x29e7('0x1e'),auth['isAuthenticated'](),controller[_0x29e7('0x1f')]);router['put'](_0x29e7('0xb'),auth[_0x29e7('0x9')](),controller[_0x29e7('0x20')]);router['delete'](_0x29e7('0xb'),auth[_0x29e7('0x9')](),controller[_0x29e7('0x21')]);router['delete']('/:id/teams',auth[_0x29e7('0x9')](),controller['removeTeams']);router['delete'](_0x29e7('0x15'),auth[_0x29e7('0x9')](),controller[_0x29e7('0x22')]);router[_0x29e7('0x23')](_0x29e7('0x1d'),auth['isAuthenticated'](),controller[_0x29e7('0x24')]);router[_0x29e7('0x23')](_0x29e7('0x1e'),auth[_0x29e7('0x9')](),controller[_0x29e7('0x25')]);module[_0x29e7('0x26')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index d551f6e..bbd62ce 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 _0x5fdc=['dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','#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)','#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)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','name','ENUM','inbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','dialMethod','getDataValue','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor'];(function(_0x115cc8,_0x473f87){var _0x485dd9=function(_0x263e73){while(--_0x263e73){_0x115cc8['push'](_0x115cc8['shift']());}};_0x485dd9(++_0x473f87);}(_0x5fdc,0xcb));var _0xc5fd=function(_0x1ce5f5,_0x33e04d){_0x1ce5f5=_0x1ce5f5-0x0;var _0x9d5f32=_0x5fdc[_0x1ce5f5];return _0x9d5f32;};'use strict';var Sequelize=require(_0xc5fd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc5fd('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc5fd('0x2')](_0xc5fd('0x3'),'outbound'),'allowNull':![],'defaultValue':_0xc5fd('0x3')},'musiconhold':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':_0xc5fd('0x5')},'announce':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc5fd('0x2')]('rr',_0xc5fd('0x6'),_0xc5fd('0x7'),_0xc5fd('0x8'),_0xc5fd('0x9'),_0xc5fd('0xa'),'linear',_0xc5fd('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0xc5fd('0x6'),'set':function(_0x2f7654){this['setDataValue']('strategy',_0x2f7654?_0x2f7654:_0xc5fd('0xa'));},'get':function(){var _0x177049=this['getDataValue']('type');var _0x3b8606=this['getDataValue'](_0xc5fd('0xc'));var _0x4cdfa3=this[_0xc5fd('0xd')](_0xc5fd('0xe'));if(_0x177049===_0xc5fd('0x3')){return _0x4cdfa3;}if(_0x3b8606===_0xc5fd('0xf')&&_0x4cdfa3===_0xc5fd('0xa')||_0x3b8606===_0xc5fd('0xf')&&_0x4cdfa3===_0xc5fd('0x10')){return _0x4cdfa3;}if(_0x3b8606===_0xc5fd('0x11')||_0x3b8606===_0xc5fd('0x12')||_0x3b8606===_0xc5fd('0x13')){return _0x4cdfa3;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc5fd('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc5fd('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xc5fd('0x2')]('yes','no'),'defaultValue':_0xc5fd('0x15')},'autopause':{'type':Sequelize[_0xc5fd('0x2')](_0xc5fd('0x15'),'no',_0xc5fd('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xc5fd('0x2')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc5fd('0x2')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc5fd('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc5fd('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc5fd('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc5fd('0x2')](_0xc5fd('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc5fd('0x2')](_0xc5fd('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc5fd('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc5fd('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc5fd('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc5fd('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xc5fd('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc5fd('0x2')](_0xc5fd('0x15'),'no'),'defaultValue':_0xc5fd('0x15')},'announce_holdtime':{'type':Sequelize[_0xc5fd('0x2')]('yes','no',_0xc5fd('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc5fd('0x2')](_0xc5fd('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xc5fd('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc5fd('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc5fd('0x4')]},'queue_youarenext':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc5fd('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc5fd('0x4')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xc5fd('0x4')]},'queue_less_than':{'type':Sequelize[_0xc5fd('0x4')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x171d01){this[_0xc5fd('0x18')](_0xc5fd('0x19'),_0x171d01?_0x171d01[_0xc5fd('0x1a')](','):[]);},'get':function(){return this[_0xc5fd('0xd')]('periodic_announce')?this[_0xc5fd('0xd')]('periodic_announce')[_0xc5fd('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':'yes','set':function(_0x252538){this[_0xc5fd('0x18')](_0xc5fd('0x1c'),_0x252538?_0x252538[_0xc5fd('0x1a')](','):undefined);},'get':function(){return this[_0xc5fd('0xd')](_0xc5fd('0x1c'))?this['getDataValue'](_0xc5fd('0x1c'))[_0xc5fd('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x5d2521){this['setDataValue'](_0xc5fd('0x1d'),_0x5d2521?_0x5d2521[_0xc5fd('0x1a')](','):undefined);},'get':function(){return this[_0xc5fd('0xd')](_0xc5fd('0x1d'))?this[_0xc5fd('0xd')](_0xc5fd('0x1d'))[_0xc5fd('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc5fd('0x2')](_0xc5fd('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xc5fd('0x2')](_0xc5fd('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc5fd('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc5fd('0x2')](_0xc5fd('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc5fd('0x4')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x2075ba){this[_0xc5fd('0x18')](_0xc5fd('0x1e'),_0x2075ba);if(_0x2075ba){if(this[_0xc5fd('0xd')](_0xc5fd('0x1f'))<0x2){this['setDataValue'](_0xc5fd('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc5fd('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc5fd('0x20')},'dialMethod':{'type':Sequelize[_0xc5fd('0x2')](_0xc5fd('0x21'),_0xc5fd('0x11'),_0xc5fd('0x13'),_0xc5fd('0x12'),'booked'),'defaultValue':'progressive','comment':_0xc5fd('0x22')},'dialLimitChannel':{'type':Sequelize[_0xc5fd('0x14')](0x4)[_0xc5fd('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc5fd('0x24')},'dialLimitQueue':{'type':Sequelize[_0xc5fd('0x14')](0x4)[_0xc5fd('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc5fd('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc5fd('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0xc5fd('0x2')](_0xc5fd('0x27'),'dropRate'),'defaultValue':_0xc5fd('0x28'),'comment':_0xc5fd('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xc5fd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc5fd('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xc5fd('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc5fd('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5fd('0x2b')},'dialQueueOptions':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':_0xc5fd('0x2c'),'comment':_0xc5fd('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5fd('0x2e')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xc5fd('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc5fd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5fd('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5fd('0x31')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc5fd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5fd('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc5fd('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'defaultValue':0x3,'comment':_0xc5fd('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc5fd('0x14')](0x5)[_0xc5fd('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':_0xc5fd('0x34')},'dialPrefix':{'type':Sequelize[_0xc5fd('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xc5fd('0x35'),_0xc5fd('0x36'),_0xc5fd('0x37')),'defaultValue':_0xc5fd('0x35')},'dialAMDActive':{'type':Sequelize[_0xc5fd('0x38')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc5fd('0x14')](0x9)[_0xc5fd('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc5fd('0x14')](0x9)[_0xc5fd('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc5fd('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc5fd('0x14')](0x9)[_0xc5fd('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc5fd('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc5fd('0x14')](0x9)[_0xc5fd('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc5fd('0x14')](0x9)[_0xc5fd('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc5fd('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc5fd('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc5fd('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc5fd('0x14')](0x9)[_0xc5fd('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc5fd('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc5fd('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc5fd('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xc5fd('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xc5fd('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc5fd('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xc5fd('0x38')],'defaultValue':0x0,'comment':_0xc5fd('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc5fd('0x2')](_0xc5fd('0x41'),_0xc5fd('0x42')),'defaultValue':_0xc5fd('0x41')},'dialQueueProject2':{'type':Sequelize[_0xc5fd('0x4')],'comment':_0xc5fd('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc5fd('0x38')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc5fd('0x38')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc5fd('0x43')},'dialCutDigit':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc5fd('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5fd('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc5fd('0x14')](0x5)[_0xc5fd('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5fd('0x46')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc5fd('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5fd('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc5fd('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5fd('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc5fd('0x14')](0x5)[_0xc5fd('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5fd('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5fd('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc5fd('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5fd('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc5fd('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc5fd('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc5fd('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xc5fd('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0xc5fd('0x38')],'defaultValue':![],'comment':_0xc5fd('0x4f'),'set':function(_0x53df7c){if(!_0x53df7c)this[_0xc5fd('0x18')](_0xc5fd('0x50'),null);this['setDataValue']('mandatoryDisposition',_0x53df7c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xc5fd('0x14')](0x3)[_0xc5fd('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x3c2a=['#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','sequelize','exports','name','inbound','outbound','STRING','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','strategy','type','getDataValue','booked','roundrobin','progressive','predictive','INTEGER','yes','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','power','Dial\x20Method.','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)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length'];(function(_0x18b64d,_0x1c0d7c){var _0x2fcf7e=function(_0x416e0c){while(--_0x416e0c){_0x18b64d['push'](_0x18b64d['shift']());}};_0x2fcf7e(++_0x1c0d7c);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0x328570,_0x18796f){_0x328570=_0x328570-0x0;var _0x2d3d73=_0x3c2a[_0x328570];return _0x2d3d73;};'use strict';var Sequelize=require(_0xa3c2('0x0'));module[_0xa3c2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa3c2('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xa3c2('0x3'),_0xa3c2('0x4')),'allowNull':![],'defaultValue':_0xa3c2('0x3')},'musiconhold':{'type':Sequelize[_0xa3c2('0x5')],'defaultValue':_0xa3c2('0x6')},'announce':{'type':Sequelize[_0xa3c2('0x5')],'defaultValue':''},'strategy':{'type':Sequelize[_0xa3c2('0x7')]('rr',_0xa3c2('0x8'),_0xa3c2('0x9'),_0xa3c2('0xa'),_0xa3c2('0xb'),_0xa3c2('0xc'),_0xa3c2('0xd'),_0xa3c2('0xe'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x23497b){this[_0xa3c2('0xf')](_0xa3c2('0x10'),_0x23497b?_0x23497b:_0xa3c2('0xc'));},'get':function(){var _0x31f8d1=this['getDataValue'](_0xa3c2('0x11'));var _0x5ea440=this[_0xa3c2('0x12')]('dialMethod');var _0x5d6259=this[_0xa3c2('0x12')](_0xa3c2('0x10'));if(_0x31f8d1==='inbound'){return _0x5d6259;}if(_0x5ea440===_0xa3c2('0x13')&&_0x5d6259===_0xa3c2('0xc')||_0x5ea440===_0xa3c2('0x13')&&_0x5d6259===_0xa3c2('0x14')){return _0x5d6259;}if(_0x5ea440===_0xa3c2('0x15')||_0x5ea440===_0xa3c2('0x16')||_0x5ea440==='power'){return _0x5d6259;}return null;}},'servicelevel':{'type':Sequelize[_0xa3c2('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xa3c2('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xa3c2('0x17')](0xb)},'timeout':{'type':Sequelize[_0xa3c2('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xa3c2('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xa3c2('0x5')]},'weight':{'type':Sequelize[_0xa3c2('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xa3c2('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xa3c2('0x7')](_0xa3c2('0x18'),'no'),'defaultValue':_0xa3c2('0x18')},'autopause':{'type':Sequelize[_0xa3c2('0x7')](_0xa3c2('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xa3c2('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xa3c2('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xa3c2('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xa3c2('0x7')](_0xa3c2('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xa3c2('0x7')](_0xa3c2('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xa3c2('0x7')](_0xa3c2('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xa3c2('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xa3c2('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xa3c2('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa3c2('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xa3c2('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xa3c2('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xa3c2('0x7')](_0xa3c2('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xa3c2('0x7')]('yes','no'),'defaultValue':_0xa3c2('0x18')},'announce_holdtime':{'type':Sequelize[_0xa3c2('0x7')](_0xa3c2('0x18'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xa3c2('0x7')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xa3c2('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xa3c2('0x5')]},'queue_youarenext':{'type':Sequelize[_0xa3c2('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xa3c2('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa3c2('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xa3c2('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xa3c2('0x5')]},'queue_quantity1':{'type':Sequelize[_0xa3c2('0x5')]},'queue_quantity2':{'type':Sequelize[_0xa3c2('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0xa3c2('0x5')]},'queue_less_than':{'type':Sequelize[_0xa3c2('0x5')]},'periodic_announce':{'type':Sequelize[_0xa3c2('0x19')],'set':function(_0x218bfd){this[_0xa3c2('0xf')](_0xa3c2('0x1a'),_0x218bfd?_0x218bfd[_0xa3c2('0x1b')](','):[]);},'get':function(){return this[_0xa3c2('0x12')](_0xa3c2('0x1a'))?this['getDataValue'](_0xa3c2('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xa3c2('0x5')],'defaultValue':_0xa3c2('0x18'),'set':function(_0x436384){this['setDataValue']('joinempty',_0x436384?_0x436384[_0xa3c2('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0xa3c2('0x1c'))?this[_0xa3c2('0x12')](_0xa3c2('0x1c'))[_0xa3c2('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xa3c2('0x5')],'defaultValue':'no','set':function(_0x504e03){this[_0xa3c2('0xf')](_0xa3c2('0x1e'),_0x504e03?_0x504e03[_0xa3c2('0x1b')](','):undefined);},'get':function(){return this[_0xa3c2('0x12')](_0xa3c2('0x1e'))?this[_0xa3c2('0x12')](_0xa3c2('0x1e'))[_0xa3c2('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa3c2('0x7')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xa3c2('0x7')](_0xa3c2('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xa3c2('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xa3c2('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa3c2('0x5')]},'description':{'type':Sequelize[_0xa3c2('0x5')]},'acw':{'type':Sequelize[_0xa3c2('0x1f')],'defaultValue':0x0,'set':function(_0x24dd61){this['setDataValue']('acw',_0x24dd61);if(_0x24dd61){if(this['getDataValue'](_0xa3c2('0x20'))<0x2){this[_0xa3c2('0xf')](_0xa3c2('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xa3c2('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xa3c2('0x1f')],'defaultValue':0x0,'comment':_0xa3c2('0x21')},'dialMethod':{'type':Sequelize[_0xa3c2('0x7')]('preview','progressive',_0xa3c2('0x22'),_0xa3c2('0x16'),'booked'),'defaultValue':_0xa3c2('0x15'),'comment':_0xa3c2('0x23')},'dialLimitChannel':{'type':Sequelize[_0xa3c2('0x17')](0x4)[_0xa3c2('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa3c2('0x25')},'dialLimitQueue':{'type':Sequelize[_0xa3c2('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa3c2('0x26')},'dialPowerLevel':{'type':Sequelize[_0xa3c2('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xa3c2('0x7')](_0xa3c2('0x28'),_0xa3c2('0x29')),'defaultValue':'dropRate','comment':_0xa3c2('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xa3c2('0x27')](0x2)[_0xa3c2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xa3c2('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xa3c2('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xa3c2('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa3c2('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa3c2('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0xa3c2('0x17')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3c2('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xa3c2('0x5')],'defaultValue':'tTxX','comment':_0xa3c2('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xa3c2('0x17')](0x3)[_0xa3c2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3c2('0x2f')},'dialQueueProject':{'type':Sequelize[_0xa3c2('0x5')],'comment':_0xa3c2('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa3c2('0x17')](0x3)[_0xa3c2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3c2('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa3c2('0x17')](0x5)[_0xa3c2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3c2('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0xa3c2('0x17')](0x3)[_0xa3c2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3c2('0x33')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa3c2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3c2('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa3c2('0x17')](0x3)[_0xa3c2('0x24')],'defaultValue':0x3,'comment':_0xa3c2('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa3c2('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xa3c2('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa3c2('0x36')},'dialTimezone':{'type':Sequelize[_0xa3c2('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xa3c2('0x37')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xa3c2('0x7')](_0xa3c2('0x38'),_0xa3c2('0x39'),_0xa3c2('0x3a')),'defaultValue':_0xa3c2('0x38')},'dialAMDActive':{'type':Sequelize[_0xa3c2('0x1f')],'defaultValue':0x0,'comment':_0xa3c2('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xa3c2('0x17')](0x9)[_0xa3c2('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa3c2('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xa3c2('0x17')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa3c2('0x17')](0x9)[_0xa3c2('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa3c2('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa3c2('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa3c2('0x3e')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xa3c2('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa3c2('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa3c2('0x17')](0x9)[_0xa3c2('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa3c2('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xa3c2('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa3c2('0x17')](0x5)[_0xa3c2('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa3c2('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa3c2('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0xa3c2('0x17')](0x5)[_0xa3c2('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xa3c2('0x43')},'dialRecallInQueue':{'type':Sequelize[_0xa3c2('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xa3c2('0x7')](_0xa3c2('0x44'),'ASC'),'defaultValue':_0xa3c2('0x44')},'dialQueueProject2':{'type':Sequelize[_0xa3c2('0x5')],'comment':_0xa3c2('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xa3c2('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xa3c2('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xa3c2('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa3c2('0x45')},'dialCutDigit':{'type':Sequelize[_0xa3c2('0x17')](0x3)[_0xa3c2('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa3c2('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa3c2('0x17')](0x3)[_0xa3c2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3c2('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa3c2('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3c2('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0xa3c2('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3c2('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0xa3c2('0x17')](0x5)[_0xa3c2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3c2('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa3c2('0x17')](0x3)[_0xa3c2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3c2('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa3c2('0x17')](0x5)[_0xa3c2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3c2('0x4c')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa3c2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3c2('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa3c2('0x17')](0x5)[_0xa3c2('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3c2('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa3c2('0x17')](0x3)[_0xa3c2('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa3c2('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa3c2('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa3c2('0x50')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa3c2('0x17')],'allowNull':!![],'comment':_0xa3c2('0x51')},'mandatoryDisposition':{'type':Sequelize[_0xa3c2('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xadfb7){if(!_0xadfb7)this[_0xa3c2('0xf')](_0xa3c2('0x52'),null);this[_0xa3c2('0xf')]('mandatoryDisposition',_0xadfb7);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xa3c2('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xa3c2('0x17')](0x3)[_0xa3c2('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index ef41941..46783de 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 _0x91dc=['catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','inbound','update','getHoppers','findOne','CmHopper','VoiceQueueId','findAll','rows','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','penalty','sequelize','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','interface','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','all','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','cm_hopper','fromQuery','field','phone','NOW()','scheduledAt','ContactId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','CmListId','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','get','VoiceQueues','outbound','filter','ignore','value','type','find','name','UserProfileResource','error','stack','send','index','map','VoiceQueue','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91dc,0x1da));var _0xc91d=function(_0x1f2926,_0x4a3767){_0x1f2926=_0x1f2926-0x0;var _0x38feb6=_0x91dc[_0x1f2926];return _0x38feb6;};'use strict';var emlformat=require(_0xc91d('0x0'));var rimraf=require(_0xc91d('0x1'));var zipdir=require(_0xc91d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc91d('0x3'));var moment=require('moment');var BPromise=require(_0xc91d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc91d('0x5'));var csv=require('to-csv');var ejs=require(_0xc91d('0x6'));var fs=require('fs');var fs_extra=require(_0xc91d('0x7'));var _=require(_0xc91d('0x8'));var squel=require('squel');var crypto=require(_0xc91d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc91d('0xa'));var toCsv=require(_0xc91d('0xb'));var querystring=require(_0xc91d('0xc'));var Papa=require(_0xc91d('0xd'));var Redis=require('ioredis');var authService=require(_0xc91d('0xe'));var qs=require(_0xc91d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc91d('0x10'));var logger=require('../../config/logger')(_0xc91d('0x11'));var utils=require(_0xc91d('0x12'));var config=require(_0xc91d('0x13'));var licenseUtil=require(_0xc91d('0x14'));var db=require('../../mysqldb')['db'];config[_0xc91d('0x15')]=_[_0xc91d('0x16')](config[_0xc91d('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xc91d('0x17'))(new Redis(config['redis']));require(_0xc91d('0x18'))[_0xc91d('0x19')](socket);function respondWithStatusCode(_0x16fa80,_0x5e1207){_0x5e1207=_0x5e1207||0xcc;return function(_0x2499a5){if(_0x2499a5){return _0x16fa80[_0xc91d('0x1a')](_0x5e1207);}return _0x16fa80[_0xc91d('0x1b')](_0x5e1207)[_0xc91d('0x1c')]();};}function respondWithResult(_0x1848e4,_0x3afb6a){_0x3afb6a=_0x3afb6a||0xc8;return function(_0x2fc96f){if(_0x2fc96f){return _0x1848e4[_0xc91d('0x1b')](_0x3afb6a)['json'](_0x2fc96f);}};}function respondWithFilteredResult(_0x17af8f,_0x1f23e3){return function(_0x3592b8){if(_0x3592b8){var _0x3448bf=typeof _0x1f23e3[_0xc91d('0x1d')]===_0xc91d('0x1e')&&typeof _0x1f23e3[_0xc91d('0x1f')]==='undefined';var _0x781ccc=_0x3592b8[_0xc91d('0x20')];var _0x45af83=_0x3448bf?0x0:_0x1f23e3[_0xc91d('0x1d')];var _0x21a1fe=_0x3448bf?_0x3592b8[_0xc91d('0x20')]:_0x1f23e3[_0xc91d('0x1d')]+_0x1f23e3[_0xc91d('0x1f')];var _0xeac996;if(_0x21a1fe>=_0x781ccc){_0x21a1fe=_0x781ccc;_0xeac996=0xc8;}else{_0xeac996=0xce;}_0x17af8f['status'](_0xeac996);return _0x17af8f[_0xc91d('0x21')](_0xc91d('0x22'),_0x45af83+'-'+_0x21a1fe+'/'+_0x781ccc)[_0xc91d('0x23')](_0x3592b8);}return null;};}function patchUpdates(_0x372c1b){return function(_0x17eb70){try{jsonpatch[_0xc91d('0x24')](_0x17eb70,_0x372c1b,!![]);}catch(_0x1020a4){return BPromise['reject'](_0x1020a4);}return _0x17eb70['save']();};}function saveUpdates(_0x5a6b8f,_0x381033){return function(_0x4eb981){if(_0x4eb981){return _0x4eb981['update'](_0x5a6b8f)[_0xc91d('0x25')](function(_0xa462fb){return _0xa462fb;});}return null;};}function removeEntity(_0x130938,_0x3d3c5b){return function(_0x2a58e1){if(_0x2a58e1){return _0x2a58e1[_0xc91d('0x26')]()[_0xc91d('0x25')](function(){var _0x1e15ab=_0x2a58e1[_0xc91d('0x27')]({'plain':!![]});var _0x23ca3b=[{'name':_0xc91d('0x28'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0xc91d('0x29'),'ignore':![]}];var _0xb4ba83=_(_0x23ca3b)[_0xc91d('0x2a')](_0xc91d('0x2b'))['map'](_0xc91d('0x2c'))[_0xc91d('0x2c')]();if(_['includes'](_0xb4ba83,_0x1e15ab[_0xc91d('0x2d')])){return;}var _0x5c43b4=_[_0xc91d('0x2e')](_0x23ca3b,[_0xc91d('0x2c'),_0x1e15ab[_0xc91d('0x2d')]])[_0xc91d('0x2f')];return db[_0xc91d('0x30')][_0xc91d('0x26')]({'where':{'type':_0x5c43b4,'resourceId':_0x1e15ab['id']}})[_0xc91d('0x25')](function(){return _0x2a58e1;});})[_0xc91d('0x25')](function(){_0x130938['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5652c6,_0x5e0496){return function(_0x2c6fe5){if(!_0x2c6fe5){_0x5652c6[_0xc91d('0x1a')](0x194);}return _0x2c6fe5;};}function handleError(_0x365cd6,_0x28c3c9){_0x28c3c9=_0x28c3c9||0x1f4;return function(_0x42c0fd){logger[_0xc91d('0x31')](_0x42c0fd[_0xc91d('0x32')]);if(_0x42c0fd['name']){delete _0x42c0fd[_0xc91d('0x2f')];}_0x365cd6['status'](_0x28c3c9)[_0xc91d('0x33')](_0x42c0fd);};}exports[_0xc91d('0x34')]=function(_0x212f29,_0x3f91bc){var _0x4fcfb4={},_0x5bb3a6={},_0x429703={'count':0x0,'rows':[]};var _0x629ea=_[_0xc91d('0x35')](db[_0xc91d('0x36')][_0xc91d('0x37')],function(_0x4666c1){return{'name':_0x4666c1['fieldName'],'type':_0x4666c1['type'][_0xc91d('0x38')]};});_0x5bb3a6[_0xc91d('0x39')]=_[_0xc91d('0x35')](_0x629ea,_0xc91d('0x2f'));_0x5bb3a6['query']=_[_0xc91d('0x3a')](_0x212f29[_0xc91d('0x3b')]);_0x5bb3a6['filters']=_[_0xc91d('0x3c')](_0x5bb3a6[_0xc91d('0x39')],_0x5bb3a6['query']);_0x4fcfb4[_0xc91d('0x3d')]=_[_0xc91d('0x3c')](_0x5bb3a6['model'],qs[_0xc91d('0x3e')](_0x212f29[_0xc91d('0x3b')][_0xc91d('0x3e')]));_0x4fcfb4[_0xc91d('0x3d')]=_0x4fcfb4['attributes'][_0xc91d('0x3f')]?_0x4fcfb4[_0xc91d('0x3d')]:_0x5bb3a6[_0xc91d('0x39')];if(!_0x212f29[_0xc91d('0x3b')][_0xc91d('0x40')](_0xc91d('0x41'))){_0x4fcfb4['limit']=qs['limit'](_0x212f29[_0xc91d('0x3b')][_0xc91d('0x1f')]);_0x4fcfb4[_0xc91d('0x1d')]=qs[_0xc91d('0x1d')](_0x212f29[_0xc91d('0x3b')]['offset']);}_0x4fcfb4[_0xc91d('0x42')]=qs[_0xc91d('0x43')](_0x212f29[_0xc91d('0x3b')][_0xc91d('0x43')]);_0x4fcfb4[_0xc91d('0x44')]=qs['filters'](_['pick'](_0x212f29['query'],_0x5bb3a6[_0xc91d('0x45')]),_0x629ea);if(_0x212f29[_0xc91d('0x3b')][_0xc91d('0x2a')]){_0x4fcfb4[_0xc91d('0x44')]=_[_0xc91d('0x46')](_0x4fcfb4[_0xc91d('0x44')],{'$or':_[_0xc91d('0x35')](_0x629ea,function(_0x553186){if(_0x553186[_0xc91d('0x2d')]!==_0xc91d('0x47')){var _0x209423={};_0x209423[_0x553186[_0xc91d('0x2f')]]={'$like':'%'+_0x212f29[_0xc91d('0x3b')][_0xc91d('0x2a')]+'%'};return _0x209423;}})});}_0x4fcfb4=_[_0xc91d('0x46')]({},_0x4fcfb4,_0x212f29[_0xc91d('0x48')]);var _0x2eb251={'where':_0x4fcfb4['where']};return db['VoiceQueue'][_0xc91d('0x20')](_0x2eb251)[_0xc91d('0x25')](function(_0x4177ae){_0x429703[_0xc91d('0x20')]=_0x4177ae;if(_0x212f29[_0xc91d('0x3b')][_0xc91d('0x49')]){_0x4fcfb4[_0xc91d('0x4a')]=[{'all':!![]}];}return db[_0xc91d('0x36')]['findAll'](_0x4fcfb4);})[_0xc91d('0x25')](function(_0x27ce2f){_0x429703['rows']=_0x27ce2f;return _0x429703;})[_0xc91d('0x25')](respondWithFilteredResult(_0x3f91bc,_0x4fcfb4))[_0xc91d('0x4b')](handleError(_0x3f91bc,null));};exports['show']=function(_0x3b08fd,_0x5ed302){var _0x4be57a={'raw':![],'where':{'id':_0x3b08fd['params']['id']}},_0x414ae1={};_0x414ae1['model']=_[_0xc91d('0x3a')](db['VoiceQueue'][_0xc91d('0x37')]);_0x414ae1['query']=_['keys'](_0x3b08fd['query']);_0x414ae1['filters']=_[_0xc91d('0x3c')](_0x414ae1['model'],_0x414ae1[_0xc91d('0x3b')]);_0x4be57a[_0xc91d('0x3d')]=_[_0xc91d('0x3c')](_0x414ae1[_0xc91d('0x39')],qs[_0xc91d('0x3e')](_0x3b08fd[_0xc91d('0x3b')]['fields']));_0x4be57a[_0xc91d('0x3d')]=_0x4be57a[_0xc91d('0x3d')][_0xc91d('0x3f')]?_0x4be57a[_0xc91d('0x3d')]:_0x414ae1[_0xc91d('0x39')];if(_0x3b08fd[_0xc91d('0x3b')][_0xc91d('0x49')]){_0x4be57a[_0xc91d('0x4a')]=[{'all':!![]}];}_0x4be57a=_[_0xc91d('0x46')]({},_0x4be57a,_0x3b08fd['options']);return db['VoiceQueue'][_0xc91d('0x2e')](_0x4be57a)['then'](handleEntityNotFound(_0x5ed302,null))[_0xc91d('0x25')](respondWithResult(_0x5ed302,null))['catch'](handleError(_0x5ed302,null));};exports[_0xc91d('0x4c')]=function(_0xf99022,_0x5de542){return db[_0xc91d('0x36')][_0xc91d('0x4c')](_0xf99022[_0xc91d('0x4d')],{})[_0xc91d('0x25')](function(_0x53d67a){var _0x45daca=_0xf99022[_0xc91d('0x4e')]['get']({'plain':!![]});if(!_0x45daca)throw new Error(_0xc91d('0x4f'));if(_0x45daca[_0xc91d('0x50')]===_0xc91d('0x4e')){var _0x37d1e7=_0x53d67a[_0xc91d('0x27')]({'plain':!![]});var _0x409524=[{'name':_0xc91d('0x28'),'value':'inbound'},{'name':_0xc91d('0x51'),'value':'outbound'}];var _0x40a3b3=_[_0xc91d('0x2e')](_0x409524,[_0xc91d('0x2c'),_0x37d1e7[_0xc91d('0x2d')]])['name'];return db[_0xc91d('0x52')][_0xc91d('0x2e')]({'where':{'name':_0x40a3b3,'userProfileId':_0x45daca[_0xc91d('0x53')]},'raw':!![]})[_0xc91d('0x25')](function(_0x252a2d){if(_0x252a2d&&_0x252a2d[_0xc91d('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x37d1e7[_0xc91d('0x2f')],'resourceId':_0x37d1e7['id'],'type':_0x252a2d[_0xc91d('0x2f')],'sectionId':_0x252a2d['id']},{})[_0xc91d('0x25')](function(){return _0x53d67a;});}else{return _0x53d67a;}})[_0xc91d('0x4b')](function(_0x1395b2){logger[_0xc91d('0x31')](_0xc91d('0x55'),_0x1395b2);throw _0x1395b2;});}return _0x53d67a;})['then'](respondWithResult(_0x5de542,0xc9))[_0xc91d('0x4b')](handleError(_0x5de542,null));};exports[_0xc91d('0x56')]=function(_0x5006b2,_0x16ff10){var _0x4bc7a9={'where':{'id':_0x5006b2[_0xc91d('0x57')]['id']}},_0x540983={};_0x540983[_0xc91d('0x39')]=_[_0xc91d('0x3a')](db[_0xc91d('0x36')][_0xc91d('0x37')]);_0x4bc7a9[_0xc91d('0x3d')]=_[_0xc91d('0x3c')](_0x540983['model'],qs[_0xc91d('0x3e')](_0x5006b2[_0xc91d('0x3b')]['fields']));_0x4bc7a9[_0xc91d('0x3d')]=_0x4bc7a9[_0xc91d('0x3d')][_0xc91d('0x3f')]?_0x4bc7a9['attributes']:_0x540983[_0xc91d('0x39')];if(_0x5006b2[_0xc91d('0x3b')][_0xc91d('0x49')]){_0x4bc7a9[_0xc91d('0x4a')]=[{'all':!![]}];}_0x4bc7a9=_[_0xc91d('0x46')]({},_0x4bc7a9,_0x5006b2['options']);return db[_0xc91d('0x36')][_0xc91d('0x2e')](_0x4bc7a9)[_0xc91d('0x25')](handleEntityNotFound(_0x16ff10,null))['then'](function(_0x5df947){if(_0x5df947){var _0x5a1860=_0x5df947[_0xc91d('0x27')]({'plain':!![]});_0x5a1860=qs[_0xc91d('0x58')](_0x5a1860,['id',_0xc91d('0x59'),'updatedAt']);_0x5006b2[_0xc91d('0x4d')]=_[_0xc91d('0x58')](_0x5006b2[_0xc91d('0x4d')],['id',_0xc91d('0x59'),_0xc91d('0x5a')]);return db['VoiceQueue'][_0xc91d('0x4c')](_[_0xc91d('0x46')](_0x5a1860,_0x5006b2['body']),{'include':_0x5006b2[_0xc91d('0x3b')][_0xc91d('0x49')]?[{'all':!![]}]:undefined})[_0xc91d('0x25')](function(_0x305e4c){var _0xbf3613=_0x5006b2[_0xc91d('0x4e')]['get']({'plain':!![]});if(!_0xbf3613)throw new Error(_0xc91d('0x4f'));if(_0xbf3613[_0xc91d('0x50')]===_0xc91d('0x4e')){var _0x2d1941=_0x305e4c[_0xc91d('0x27')]({'plain':!![]});var _0x533efe=[{'name':_0xc91d('0x28'),'value':_0xc91d('0x5b')},{'name':_0xc91d('0x51'),'value':_0xc91d('0x29')}];var _0x1ef985=_[_0xc91d('0x2e')](_0x533efe,[_0xc91d('0x2c'),_0x2d1941['type']])['name'];return db[_0xc91d('0x52')]['find']({'where':{'name':_0x1ef985,'userProfileId':_0xbf3613[_0xc91d('0x53')]},'raw':!![]})[_0xc91d('0x25')](function(_0x32c21b){if(_0x32c21b&&_0x32c21b[_0xc91d('0x54')]===0x0){return db[_0xc91d('0x30')]['create']({'name':_0x2d1941['name'],'resourceId':_0x2d1941['id'],'type':_0x32c21b[_0xc91d('0x2f')],'sectionId':_0x32c21b['id']},{})[_0xc91d('0x25')](function(){return _0x305e4c;});}else{return _0x305e4c;}})[_0xc91d('0x4b')](function(_0x476035){logger[_0xc91d('0x31')](_0xc91d('0x55'),_0x476035);throw _0x476035;});}return _0x305e4c;});}})[_0xc91d('0x25')](respondWithResult(_0x16ff10,0xc9))[_0xc91d('0x4b')](handleError(_0x16ff10,null));};exports[_0xc91d('0x5c')]=function(_0x4daad7,_0x2719ac){if(_0x4daad7['body']['id']){delete _0x4daad7[_0xc91d('0x4d')]['id'];}return db['VoiceQueue'][_0xc91d('0x2e')]({'where':{'id':_0x4daad7[_0xc91d('0x57')]['id']}})[_0xc91d('0x25')](handleEntityNotFound(_0x2719ac,null))[_0xc91d('0x25')](saveUpdates(_0x4daad7[_0xc91d('0x4d')],null))['then'](respondWithResult(_0x2719ac,null))['catch'](handleError(_0x2719ac,null));};exports[_0xc91d('0x26')]=function(_0x2d86f5,_0x5c1c53){return db[_0xc91d('0x36')]['find']({'where':{'id':_0x2d86f5['params']['id']}})[_0xc91d('0x25')](handleEntityNotFound(_0x5c1c53,null))[_0xc91d('0x25')](removeEntity(_0x5c1c53,null))['catch'](handleError(_0x5c1c53,null));};exports[_0xc91d('0x5d')]=function(_0x3a5660,_0x5b6e41,_0x59c575){var _0x231992={'raw':![],'where':{}};var _0x5575be={};var _0x134e79={'count':0x0,'rows':[]};return db[_0xc91d('0x36')][_0xc91d('0x5e')]({'where':{'id':_0x3a5660[_0xc91d('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b6e41,null))[_0xc91d('0x25')](function(_0x431ffb){if(_0x431ffb){_0x5575be[_0xc91d('0x39')]=_[_0xc91d('0x3a')](db[_0xc91d('0x5f')][_0xc91d('0x37')]);_0x5575be['query']=_['keys'](_0x3a5660[_0xc91d('0x3b')]);_0x5575be[_0xc91d('0x45')]=_[_0xc91d('0x3c')](_0x5575be[_0xc91d('0x39')],_0x5575be[_0xc91d('0x3b')]);_0x231992['attributes']=_['intersection'](_0x5575be[_0xc91d('0x39')],qs[_0xc91d('0x3e')](_0x3a5660['query'][_0xc91d('0x3e')]));_0x231992[_0xc91d('0x3d')]=_0x231992['attributes'][_0xc91d('0x3f')]?_0x231992[_0xc91d('0x3d')]:_0x5575be[_0xc91d('0x39')];if(!_0x3a5660[_0xc91d('0x3b')]['hasOwnProperty'](_0xc91d('0x41'))){_0x231992[_0xc91d('0x1f')]=qs['limit'](_0x3a5660['query'][_0xc91d('0x1f')]);_0x231992[_0xc91d('0x1d')]=qs[_0xc91d('0x1d')](_0x3a5660[_0xc91d('0x3b')][_0xc91d('0x1d')]);}_0x231992[_0xc91d('0x42')]=qs[_0xc91d('0x43')](_0x3a5660['query'][_0xc91d('0x43')]);_0x231992[_0xc91d('0x44')]=qs[_0xc91d('0x45')](_['pick'](_0x3a5660['query'],_0x5575be[_0xc91d('0x45')]));_0x231992[_0xc91d('0x44')][_0xc91d('0x60')]=_0x431ffb['id'];if(_0x3a5660[_0xc91d('0x3b')]['filter']){_0x231992['where']=_[_0xc91d('0x46')](_0x231992[_0xc91d('0x44')],{'$or':_[_0xc91d('0x35')](_0x231992[_0xc91d('0x3d')],function(_0x2e53ac){var _0x1bbc5c={};_0x1bbc5c[_0x2e53ac]={'$like':'%'+_0x3a5660[_0xc91d('0x3b')][_0xc91d('0x2a')]+'%'};return _0x1bbc5c;})});}_0x231992=_[_0xc91d('0x46')]({},_0x231992,_0x3a5660[_0xc91d('0x48')]);return db['CmHopper'][_0xc91d('0x20')]({'where':_0x231992['where']})['then'](function(_0x524dde){_0x134e79['count']=_0x524dde;if(_0x3a5660[_0xc91d('0x3b')][_0xc91d('0x49')]){_0x231992[_0xc91d('0x4a')]=[{'all':!![]}];}return db[_0xc91d('0x5f')][_0xc91d('0x61')](_0x231992);})[_0xc91d('0x25')](function(_0x4d252f){_0x134e79[_0xc91d('0x62')]=_0x4d252f;return _0x134e79;});}})['then'](respondWithFilteredResult(_0x5b6e41,_0x231992))['catch'](handleError(_0x5b6e41,null));};exports['getHopperHistories']=function(_0x241ad0,_0x8a2ebd,_0x391ed2){var _0x202a61={'raw':!![],'where':{}};var _0x16923c={};var _0x4bc502={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc91d('0x5e')]({'where':{'id':_0x241ad0[_0xc91d('0x57')]['id']}})[_0xc91d('0x25')](handleEntityNotFound(_0x8a2ebd,null))[_0xc91d('0x25')](function(_0x571a87){if(_0x571a87){_0x16923c[_0xc91d('0x39')]=_['keys'](db[_0xc91d('0x63')][_0xc91d('0x37')]);_0x16923c[_0xc91d('0x3b')]=_[_0xc91d('0x3a')](_0x241ad0['query']);_0x16923c[_0xc91d('0x45')]=_['intersection'](_0x16923c[_0xc91d('0x39')],_0x16923c[_0xc91d('0x3b')]);_0x202a61[_0xc91d('0x3d')]=_[_0xc91d('0x3c')](_0x16923c['model'],qs[_0xc91d('0x3e')](_0x241ad0[_0xc91d('0x3b')][_0xc91d('0x3e')]));_0x202a61[_0xc91d('0x3d')]=_0x202a61[_0xc91d('0x3d')][_0xc91d('0x3f')]?_0x202a61[_0xc91d('0x3d')]:_0x16923c[_0xc91d('0x39')];if(!_0x241ad0[_0xc91d('0x3b')]['hasOwnProperty'](_0xc91d('0x41'))){_0x202a61[_0xc91d('0x1f')]=qs[_0xc91d('0x1f')](_0x241ad0['query'][_0xc91d('0x1f')]);_0x202a61[_0xc91d('0x1d')]=qs[_0xc91d('0x1d')](_0x241ad0[_0xc91d('0x3b')]['offset']);}_0x202a61[_0xc91d('0x42')]=qs[_0xc91d('0x43')](_0x241ad0[_0xc91d('0x3b')][_0xc91d('0x43')]);_0x202a61['where']=qs[_0xc91d('0x45')](_[_0xc91d('0x64')](_0x241ad0['query'],_0x16923c[_0xc91d('0x45')]));_0x202a61['where'][_0xc91d('0x60')]=_0x571a87['id'];if(_0x241ad0[_0xc91d('0x3b')][_0xc91d('0x2a')]){_0x202a61[_0xc91d('0x44')]=_['merge'](_0x202a61['where'],{'$or':_['map'](_0x202a61[_0xc91d('0x3d')],function(_0x3fd7ab){var _0x592343={};_0x592343[_0x3fd7ab]={'$like':'%'+_0x241ad0[_0xc91d('0x3b')][_0xc91d('0x2a')]+'%'};return _0x592343;})});}_0x202a61=_[_0xc91d('0x46')]({},_0x202a61,_0x241ad0[_0xc91d('0x48')]);return db['CmHopperHistory'][_0xc91d('0x20')]({'where':_0x202a61['where']})[_0xc91d('0x25')](function(_0x561bf9){_0x4bc502['count']=_0x561bf9;if(_0x241ad0[_0xc91d('0x3b')][_0xc91d('0x49')]){_0x202a61['include']=[{'all':!![]}];}return db[_0xc91d('0x63')]['findAll'](_0x202a61);})[_0xc91d('0x25')](function(_0x3f6100){_0x4bc502['rows']=_0x3f6100;return _0x4bc502;});}})['then'](respondWithFilteredResult(_0x8a2ebd,_0x202a61))[_0xc91d('0x4b')](handleError(_0x8a2ebd,null));};exports[_0xc91d('0x65')]=function(_0x5e28a8,_0x15a2b8,_0x435f56){var _0x584eb7={'raw':!![],'where':{}};var _0x36d7c2={};var _0x108300={'count':0x0,'rows':[]};return db[_0xc91d('0x36')][_0xc91d('0x5e')]({'where':{'id':_0x5e28a8[_0xc91d('0x57')]['id']}})[_0xc91d('0x25')](handleEntityNotFound(_0x15a2b8,null))['then'](function(_0x549adf){if(_0x549adf){_0x36d7c2[_0xc91d('0x39')]=_[_0xc91d('0x3a')](db['CmHopperFinal'][_0xc91d('0x37')]);_0x36d7c2[_0xc91d('0x3b')]=_[_0xc91d('0x3a')](_0x5e28a8[_0xc91d('0x3b')]);_0x36d7c2[_0xc91d('0x45')]=_[_0xc91d('0x3c')](_0x36d7c2[_0xc91d('0x39')],_0x36d7c2[_0xc91d('0x3b')]);_0x584eb7[_0xc91d('0x3d')]=_[_0xc91d('0x3c')](_0x36d7c2[_0xc91d('0x39')],qs[_0xc91d('0x3e')](_0x5e28a8[_0xc91d('0x3b')]['fields']));_0x584eb7[_0xc91d('0x3d')]=_0x584eb7['attributes'][_0xc91d('0x3f')]?_0x584eb7[_0xc91d('0x3d')]:_0x36d7c2[_0xc91d('0x39')];if(!_0x5e28a8[_0xc91d('0x3b')][_0xc91d('0x40')](_0xc91d('0x41'))){_0x584eb7[_0xc91d('0x1f')]=qs['limit'](_0x5e28a8[_0xc91d('0x3b')]['limit']);_0x584eb7[_0xc91d('0x1d')]=qs[_0xc91d('0x1d')](_0x5e28a8[_0xc91d('0x3b')][_0xc91d('0x1d')]);}_0x584eb7['order']=qs[_0xc91d('0x43')](_0x5e28a8[_0xc91d('0x3b')]['sort']);_0x584eb7['where']=qs[_0xc91d('0x45')](_[_0xc91d('0x64')](_0x5e28a8[_0xc91d('0x3b')],_0x36d7c2['filters']));_0x584eb7[_0xc91d('0x44')]['VoiceQueueId']=_0x549adf['id'];if(_0x5e28a8['query'][_0xc91d('0x2a')]){_0x584eb7[_0xc91d('0x44')]=_['merge'](_0x584eb7[_0xc91d('0x44')],{'$or':_[_0xc91d('0x35')](_0x584eb7[_0xc91d('0x3d')],function(_0x5ab64a){var _0xd1ecf2={};_0xd1ecf2[_0x5ab64a]={'$like':'%'+_0x5e28a8['query'][_0xc91d('0x2a')]+'%'};return _0xd1ecf2;})});}_0x584eb7=_[_0xc91d('0x46')]({},_0x584eb7,_0x5e28a8['options']);return db['CmHopperFinal'][_0xc91d('0x20')]({'where':_0x584eb7['where']})[_0xc91d('0x25')](function(_0x9f17e3){_0x108300[_0xc91d('0x20')]=_0x9f17e3;if(_0x5e28a8['query']['includeAll']){_0x584eb7[_0xc91d('0x4a')]=[{'all':!![]}];}return db[_0xc91d('0x66')]['findAll'](_0x584eb7);})[_0xc91d('0x25')](function(_0x2c455b){_0x108300[_0xc91d('0x62')]=_0x2c455b;return _0x108300;});}})[_0xc91d('0x25')](respondWithFilteredResult(_0x15a2b8,_0x584eb7))[_0xc91d('0x4b')](handleError(_0x15a2b8,null));};exports[_0xc91d('0x67')]=function(_0x49fd6a,_0x5800ef,_0x334035){var _0x2f50f7={'raw':!![],'where':{}};var _0x18e080={};var _0x3f257e={'count':0x0,'rows':[]};return db[_0xc91d('0x36')][_0xc91d('0x5e')]({'where':{'id':_0x49fd6a[_0xc91d('0x57')]['id']}})['then'](handleEntityNotFound(_0x5800ef,null))[_0xc91d('0x25')](function(_0x33823a){if(_0x33823a){_0x18e080[_0xc91d('0x39')]=_['keys'](db[_0xc91d('0x68')][_0xc91d('0x37')]);_0x18e080[_0xc91d('0x3b')]=_['keys'](_0x49fd6a[_0xc91d('0x3b')]);_0x18e080[_0xc91d('0x45')]=_[_0xc91d('0x3c')](_0x18e080['model'],_0x18e080[_0xc91d('0x3b')]);_0x2f50f7['attributes']=_['intersection'](_0x18e080[_0xc91d('0x39')],qs[_0xc91d('0x3e')](_0x49fd6a['query'][_0xc91d('0x3e')]));_0x2f50f7[_0xc91d('0x3d')]=_0x2f50f7['attributes']['length']?_0x2f50f7['attributes']:_0x18e080[_0xc91d('0x39')];if(!_0x49fd6a[_0xc91d('0x3b')]['hasOwnProperty'](_0xc91d('0x41'))){_0x2f50f7[_0xc91d('0x1f')]=qs['limit'](_0x49fd6a[_0xc91d('0x3b')][_0xc91d('0x1f')]);_0x2f50f7[_0xc91d('0x1d')]=qs[_0xc91d('0x1d')](_0x49fd6a[_0xc91d('0x3b')]['offset']);}_0x2f50f7[_0xc91d('0x42')]=qs[_0xc91d('0x43')](_0x49fd6a[_0xc91d('0x3b')]['sort']);_0x2f50f7[_0xc91d('0x44')]=qs[_0xc91d('0x45')](_[_0xc91d('0x64')](_0x49fd6a[_0xc91d('0x3b')],_0x18e080[_0xc91d('0x45')]));_0x2f50f7[_0xc91d('0x44')][_0xc91d('0x60')]=_0x33823a['id'];if(_0x49fd6a['query'][_0xc91d('0x2a')]){_0x2f50f7[_0xc91d('0x44')]=_['merge'](_0x2f50f7[_0xc91d('0x44')],{'$or':_[_0xc91d('0x35')](_0x2f50f7['attributes'],function(_0x2db687){var _0x4ccdd1={};_0x4ccdd1[_0x2db687]={'$like':'%'+_0x49fd6a[_0xc91d('0x3b')][_0xc91d('0x2a')]+'%'};return _0x4ccdd1;})});}_0x2f50f7=_[_0xc91d('0x46')]({},_0x2f50f7,_0x49fd6a[_0xc91d('0x48')]);return db[_0xc91d('0x68')][_0xc91d('0x20')]({'where':_0x2f50f7[_0xc91d('0x44')]})[_0xc91d('0x25')](function(_0xba539a){_0x3f257e[_0xc91d('0x20')]=_0xba539a;if(_0x49fd6a['query'][_0xc91d('0x49')]){_0x2f50f7[_0xc91d('0x4a')]=[{'all':!![]}];}return db[_0xc91d('0x68')][_0xc91d('0x61')](_0x2f50f7);})[_0xc91d('0x25')](function(_0x3e58c6){_0x3f257e[_0xc91d('0x62')]=_0x3e58c6;return _0x3f257e;});}})[_0xc91d('0x25')](respondWithFilteredResult(_0x5800ef,_0x2f50f7))['catch'](handleError(_0x5800ef,null));};exports[_0xc91d('0x69')]=function(_0x369abe,_0x333910,_0x4255d9){var _0x3db073={};var _0x528fe4={};var _0x2f62f6;var _0x333b59;return db['VoiceQueue'][_0xc91d('0x5e')]({'where':{'id':_0x369abe[_0xc91d('0x57')]['id']}})['then'](handleEntityNotFound(_0x333910,null))[_0xc91d('0x25')](function(_0x23420f){if(_0x23420f){_0x2f62f6=_0x23420f;_0x528fe4[_0xc91d('0x39')]=_[_0xc91d('0x3a')](db[_0xc91d('0x6a')][_0xc91d('0x37')]);_0x528fe4[_0xc91d('0x3b')]=_[_0xc91d('0x3a')](_0x369abe[_0xc91d('0x3b')]);_0x528fe4['filters']=_['intersection'](_0x528fe4['model'],_0x528fe4['query']);_0x3db073[_0xc91d('0x3d')]=_['intersection'](_0x528fe4[_0xc91d('0x39')],qs[_0xc91d('0x3e')](_0x369abe[_0xc91d('0x3b')]['fields']));_0x3db073['attributes']=_0x3db073['attributes']['length']?_0x3db073['attributes']:_0x528fe4['model'];_0x3db073['order']=qs[_0xc91d('0x43')](_0x369abe[_0xc91d('0x3b')][_0xc91d('0x43')]);_0x3db073[_0xc91d('0x44')]=qs[_0xc91d('0x45')](_[_0xc91d('0x64')](_0x369abe[_0xc91d('0x3b')],_0x528fe4[_0xc91d('0x45')]));if(_0x369abe['query']['filter']){_0x3db073[_0xc91d('0x44')]=_[_0xc91d('0x46')](_0x3db073['where'],{'$or':_[_0xc91d('0x35')](_0x3db073[_0xc91d('0x3d')],function(_0x3a9ff9){var _0x53a05b={};_0x53a05b[_0x3a9ff9]={'$like':'%'+_0x369abe[_0xc91d('0x3b')][_0xc91d('0x2a')]+'%'};return _0x53a05b;})});}_0x3db073=_[_0xc91d('0x46')]({},_0x3db073,_0x369abe[_0xc91d('0x48')]);return _0x2f62f6[_0xc91d('0x69')](_0x3db073);}})[_0xc91d('0x25')](function(_0x4e1eb1){if(_0x4e1eb1){_0x333b59=_0x4e1eb1[_0xc91d('0x3f')];if(!_0x369abe[_0xc91d('0x3b')]['hasOwnProperty']('nolimit')){_0x3db073['limit']=qs[_0xc91d('0x1f')](_0x369abe['query'][_0xc91d('0x1f')]);_0x3db073[_0xc91d('0x1d')]=qs[_0xc91d('0x1d')](_0x369abe[_0xc91d('0x3b')][_0xc91d('0x1d')]);}return _0x2f62f6[_0xc91d('0x69')](_0x3db073);}})[_0xc91d('0x25')](function(_0x222e89){if(_0x222e89){return _0x222e89?{'count':_0x333b59,'rows':_0x222e89}:null;}})['then'](respondWithResult(_0x333910,null))[_0xc91d('0x4b')](handleError(_0x333910,null));};exports[_0xc91d('0x6b')]=function(_0x4d9b11,_0x106870,_0x2f3d68){var _0x30b822=_0x4d9b11[_0xc91d('0x4d')][_0xc91d('0x6c')];var _0x355af3=_[_0xc91d('0x35')](_0x30b822,'id');return db[_0xc91d('0x6a')][_0xc91d('0x61')]({'where':{'id':_0x355af3},'attributes':['id'],'include':[{'model':db[_0xc91d('0x6d')],'as':_0xc91d('0x6e'),'attributes':['id',_0xc91d('0x2f'),_0xc91d('0x6f'),_0xc91d('0x70'),'interface'],'raw':!![]}]})[_0xc91d('0x25')](function(_0x4b6a3c){if(_0x4b6a3c){var _0x134367=_[_0xc91d('0x71')](_0x4b6a3c,function(_0x20a9bc){var _0x4c85b9=_0x20a9bc[_0xc91d('0x27')]({'plain':!![]});_0x4c85b9['Agents']['forEach'](function(_0x5a3ead){_0x5a3ead['penalty']=_[_0xc91d('0x2e')](_0x30b822,{'id':_0x4c85b9['id']})[_0xc91d('0x72')];});return _0x4c85b9[_0xc91d('0x6e')];});return db[_0xc91d('0x36')][_0xc91d('0x2e')]({'where':{'id':_0x4d9b11[_0xc91d('0x57')]['id']}})[_0xc91d('0x25')](function(_0x2f4101){return db[_0xc91d('0x73')]['transaction'](function(_0x394aea){return _0x2f4101[_0xc91d('0x6b')](_0x355af3,{'transaction':_0x394aea})[_0xc91d('0x25')](function(){return BPromise['each'](_0x30b822,function(_0x11a703){return db[_0xc91d('0x74')][_0xc91d('0x75')]({'TeamId':_0x11a703['id'],'VoiceQueueId':_0x4d9b11[_0xc91d('0x57')]['id'],'penalty':_0x11a703[_0xc91d('0x72')]},{'transaction':_0x394aea});});})[_0xc91d('0x25')](function(){return BPromise['each'](_0x134367,function(_0x698e6d){return db[_0xc91d('0x76')][_0xc91d('0x77')]({'where':{'UserId':_0x698e6d['id'],'VoiceQueueId':_0x4d9b11['params']['id']},'defaults':{'penalty':_0x698e6d[_0xc91d('0x72')]},'transaction':_0x394aea});});})['then'](function(){return BPromise['each'](_['filter'](_0x134367,{'online':!![]}),function(_0x3fc1fb){return db[_0xc91d('0x78')][_0xc91d('0x75')]({'membername':_0x3fc1fb['name'],'UserId':_0x3fc1fb['id'],'queue_name':_0x2f4101[_0xc91d('0x2f')],'VoiceQueueId':_0x2f4101['id'],'interface':_[_0xc91d('0x79')](_0x3fc1fb['interface'])?util[_0xc91d('0x7a')](_0xc91d('0x7b'),_0x3fc1fb['name']):_0x3fc1fb[_0xc91d('0x7c')],'paused':_0x3fc1fb[_0xc91d('0x70')]||![],'penalty':_0x3fc1fb[_0xc91d('0x72')]},{'transaction':_0x394aea});});})[_0xc91d('0x25')](function(){_0x134367[_0xc91d('0x7d')](function(_0x9097a1){socket[_0xc91d('0x7e')](_0xc91d('0x7f'),{'UserId':_0x9097a1['id'],'VoiceQueueId':_0x2f4101['id']});});});});});}})[_0xc91d('0x25')](respondWithStatusCode(_0x106870,null))['catch'](handleError(_0x106870,null));};exports[_0xc91d('0x80')]=function(_0x22a0a9,_0xc73d3c,_0x2e9444){return db[_0xc91d('0x6a')][_0xc91d('0x61')]({'where':{'id':_0x22a0a9[_0xc91d('0x3b')][_0xc91d('0x81')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc91d('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xc91d('0x25')](handleEntityNotFound(_0xc73d3c,null))[_0xc91d('0x25')](function(_0x42ec71){var _0x994a22=_[_0xc91d('0x35')](_0x42ec71,'id');var _0x2c7be4=[];var _0x4a1b42=[];var _0x53d82e=squel[_0xc91d('0x82')]();_0x53d82e['field'](_0xc91d('0x83'))[_0xc91d('0x84')]('team_has_voice_queues','tq')[_0xc91d('0x85')](_0xc91d('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc91d('0x44')](_0xc91d('0x87'),_0x22a0a9[_0xc91d('0x57')]['id']);for(var _0x3087ec=0x0;_0x3087ec<_0x42ec71[_0xc91d('0x3f')];_0x3087ec+=0x1){let _0x53bee6=_0x42ec71[_0x3087ec];for(var _0x38c499=0x0;_0x38c499<_0x53bee6['Agents'][_0xc91d('0x3f')];_0x38c499+=0x1){let _0x4c37e6=_0x53bee6[_0xc91d('0x6e')][_0x38c499];var _0xc5ec48=_0x53d82e[_0xc91d('0x56')]();_0xc5ec48[_0xc91d('0x44')](_0xc91d('0x88'),_0x4c37e6['id']);_0x4a1b42[_0xc91d('0x89')](db[_0xc91d('0x73')][_0xc91d('0x3b')](_0xc5ec48[_0xc91d('0x8a')](),{'type':db[_0xc91d('0x73')][_0xc91d('0x8b')][_0xc91d('0x8c')]})[_0xc91d('0x25')](function(_0xd436fa){if(_0xd436fa[_0xc91d('0x3f')]===0x1){return _0x4c37e6['id'];}else{var _0x56bf4f=_[_0xc91d('0x8d')](_[_0xc91d('0x35')](_0xd436fa,'TeamId'),function(_0x4ad9d9){return _[_0xc91d('0x8e')](_0x994a22,_0x4ad9d9);});if(_0x56bf4f){return _0x4c37e6['id'];}}}));}}return BPromise['all'](_0x4a1b42)[_0xc91d('0x25')](function(_0x7b39a1){_0x2c7be4=_(_0x2c7be4)[_0xc91d('0x8f')](_0x7b39a1)[_0xc91d('0x90')]()[_0xc91d('0x2c')]();return db[_0xc91d('0x36')]['find']({'where':{'id':_0x22a0a9['params']['id']}})['then'](function(_0x191fde){return db[_0xc91d('0x73')]['transaction'](function(_0x2950c3){return _0x191fde[_0xc91d('0x80')](_0x22a0a9[_0xc91d('0x3b')]['ids'],{'transaction':_0x2950c3})[_0xc91d('0x25')](function(){if(!_[_0xc91d('0x91')](_0x2c7be4)){return _0x191fde[_0xc91d('0x92')](_0x2c7be4,{'transaction':_0x2950c3})[_0xc91d('0x25')](function(){return db[_0xc91d('0x78')][_0xc91d('0x26')]({'where':{'VoiceQueueId':_0x22a0a9['params']['id'],'UserId':_0x2c7be4},'transaction':_0x2950c3});});}})[_0xc91d('0x25')](function(){_0x2c7be4[_0xc91d('0x7d')](function(_0x240e8c){socket[_0xc91d('0x7e')](_0xc91d('0x93'),{'UserId':_0x240e8c,'VoiceQueueId':_0x191fde['id']});});});});});});})[_0xc91d('0x25')](respondWithStatusCode(_0xc73d3c,null))[_0xc91d('0x4b')](handleError(_0xc73d3c,null));};exports[_0xc91d('0x94')]=function(_0x29a115,_0x12496a,_0x514064){var _0x31df5d,_0x1b9bd1;return db[_0xc91d('0x36')][_0xc91d('0x2e')]({'where':{'id':_0x29a115[_0xc91d('0x57')]['id']}})['then'](handleEntityNotFound(_0x12496a,null))['then'](function(_0x6145b6){if(_0x6145b6){_0x1b9bd1=_0x6145b6;return _0x6145b6['addAgents'](_0x29a115[_0xc91d('0x4d')][_0xc91d('0x81')],_[_0xc91d('0x58')](_0x29a115['body'],[_0xc91d('0x81'),'id'])||{})[_0xc91d('0x95')](function(_0x534cbb){for(var _0x197009=0x0;_0x197009<_0x29a115[_0xc91d('0x4d')][_0xc91d('0x81')][_0xc91d('0x3f')];_0x197009+=0x1){socket[_0xc91d('0x7e')]('userVoiceQueue:save',{'UserId':Number(_0x29a115[_0xc91d('0x4d')][_0xc91d('0x81')][_0x197009]),'VoiceQueueId':Number(_0x29a115[_0xc91d('0x57')]['id'])});}return _0x534cbb;});}})[_0xc91d('0x25')](function(_0x2b5a65){_0x31df5d=_0x2b5a65||[];if(_0x1b9bd1){return db[_0xc91d('0x6d')][_0xc91d('0x61')]({'where':{'id':_0x29a115[_0xc91d('0x4d')][_0xc91d('0x81')]},'attributes':['id','name',_0xc91d('0x6f'),'voicePause',_0xc91d('0x7c')],'raw':!![]});}})['then'](function(_0x1cba83){if(!_['isEmpty'](_0x1cba83)){var _0x494b17=[];for(var _0x573783=0x0;_0x573783<_0x1cba83[_0xc91d('0x3f')];_0x573783++){if(_0x1cba83[_0x573783][_0xc91d('0x6f')]){_0x494b17[_0xc91d('0x89')](db['UserVoiceQueueRt'][_0xc91d('0x75')]({'membername':_0x1cba83[_0x573783][_0xc91d('0x2f')],'UserId':_0x1cba83[_0x573783]['id'],'queue_name':_0x1b9bd1[_0xc91d('0x2f')],'VoiceQueueId':_0x1b9bd1['id'],'interface':_[_0xc91d('0x79')](_0x1cba83[_0x573783]['interface'])?util[_0xc91d('0x7a')]('SIP/%s',_0x1cba83[_0x573783][_0xc91d('0x2f')]):_0x1cba83[_0x573783][_0xc91d('0x7c')],'paused':_0x1cba83[_0x573783][_0xc91d('0x70')]||![],'penalty':_0x29a115[_0xc91d('0x4d')][_0xc91d('0x72')]||0x0}));}}return BPromise[_0xc91d('0x96')](_0x494b17);}})[_0xc91d('0x25')](function(){return _0x31df5d;})[_0xc91d('0x25')](respondWithResult(_0x12496a,null))[_0xc91d('0x4b')](handleError(_0x12496a,null));};exports[_0xc91d('0x92')]=function(_0x24bcd8,_0xc14510,_0xe28804){return db['VoiceQueue'][_0xc91d('0x2e')]({'where':{'id':_0x24bcd8['params']['id']}})[_0xc91d('0x25')](handleEntityNotFound(_0xc14510,null))[_0xc91d('0x25')](function(_0x2a8e7b){if(_0x2a8e7b){return _0x2a8e7b[_0xc91d('0x92')](_0x24bcd8[_0xc91d('0x3b')][_0xc91d('0x81')])[_0xc91d('0x25')](function(){if(_[_0xc91d('0x97')](_0x24bcd8[_0xc91d('0x3b')][_0xc91d('0x81')])){for(var _0x14280a=0x0;_0x14280a<_0x24bcd8['query'][_0xc91d('0x81')]['length'];_0x14280a+=0x1){socket[_0xc91d('0x7e')](_0xc91d('0x93'),{'UserId':Number(_0x24bcd8[_0xc91d('0x3b')][_0xc91d('0x81')][_0x14280a]),'VoiceQueueId':Number(_0x24bcd8[_0xc91d('0x57')]['id'])});}}else{socket[_0xc91d('0x7e')](_0xc91d('0x93'),{'UserId':Number(_0x24bcd8['query'][_0xc91d('0x81')]),'VoiceQueueId':Number(_0x24bcd8['params']['id'])});}});}})[_0xc91d('0x25')](function(_0x54426d){return db[_0xc91d('0x78')][_0xc91d('0x26')]({'where':{'VoiceQueueId':_0x24bcd8[_0xc91d('0x57')]['id'],'UserId':_0x24bcd8['query'][_0xc91d('0x81')]}})[_0xc91d('0x25')](function(){return _0x54426d;});})[_0xc91d('0x25')](respondWithStatusCode(_0xc14510,null))['catch'](handleError(_0xc14510,null));};exports[_0xc91d('0x98')]=function(_0x4b6c12,_0x1c0de0,_0x546d2f){var _0x425eb2={};var _0xd36c14={};var _0x17078a;var _0x11503e;return db[_0xc91d('0x36')]['findOne']({'where':{'id':_0x4b6c12[_0xc91d('0x57')]['id']}})[_0xc91d('0x25')](handleEntityNotFound(_0x1c0de0,null))[_0xc91d('0x25')](function(_0x5cdd08){if(_0x5cdd08){_0x17078a=_0x5cdd08;_0xd36c14[_0xc91d('0x39')]=_['keys'](db[_0xc91d('0x6d')]['rawAttributes']);_0xd36c14[_0xc91d('0x3b')]=_[_0xc91d('0x3a')](_0x4b6c12[_0xc91d('0x3b')]);_0xd36c14[_0xc91d('0x45')]=_['intersection'](_0xd36c14[_0xc91d('0x39')],_0xd36c14['query']);_0x425eb2[_0xc91d('0x3d')]=_['intersection'](_0xd36c14[_0xc91d('0x39')],qs['fields'](_0x4b6c12[_0xc91d('0x3b')]['fields']));_0x425eb2[_0xc91d('0x3d')]=_0x425eb2[_0xc91d('0x3d')]['length']?_0x425eb2[_0xc91d('0x3d')]:_0xd36c14[_0xc91d('0x39')];_0x425eb2['order']=qs['sort'](_0x4b6c12[_0xc91d('0x3b')][_0xc91d('0x43')]);_0x425eb2['where']=qs['filters'](_['pick'](_0x4b6c12[_0xc91d('0x3b')],_0xd36c14[_0xc91d('0x45')]));if(_0x4b6c12[_0xc91d('0x3b')]['filter']){_0x425eb2[_0xc91d('0x44')]=_[_0xc91d('0x46')](_0x425eb2[_0xc91d('0x44')],{'$or':_['map'](_0x425eb2[_0xc91d('0x3d')],function(_0x1d13e4){var _0x37cb47={};_0x37cb47[_0x1d13e4]={'$like':'%'+_0x4b6c12[_0xc91d('0x3b')][_0xc91d('0x2a')]+'%'};return _0x37cb47;})});}_0x425eb2=_['merge']({},_0x425eb2,_0x4b6c12[_0xc91d('0x48')]);return _0x17078a['getAgents'](_0x425eb2);}})[_0xc91d('0x25')](function(_0x2442fe){if(_0x2442fe){_0x11503e=_0x2442fe['length'];if(!_0x4b6c12[_0xc91d('0x3b')][_0xc91d('0x40')](_0xc91d('0x41'))){_0x425eb2[_0xc91d('0x1f')]=qs[_0xc91d('0x1f')](_0x4b6c12[_0xc91d('0x3b')]['limit']);_0x425eb2['offset']=qs[_0xc91d('0x1d')](_0x4b6c12[_0xc91d('0x3b')]['offset']);}return _0x17078a[_0xc91d('0x98')](_0x425eb2);}})['then'](function(_0x1b8093){if(_0x1b8093){return _0x1b8093?{'count':_0x11503e,'rows':_0x1b8093}:null;}})[_0xc91d('0x25')](respondWithResult(_0x1c0de0,null))[_0xc91d('0x4b')](handleError(_0x1c0de0,null));};exports[_0xc91d('0x99')]=function(_0x2ebfe6,_0x33c941,_0x48c850){var _0x17ec8b={};var _0x4eb97f={};var _0x53d246;var _0x27608d;return db[_0xc91d('0x36')][_0xc91d('0x5e')]({'where':{'id':_0x2ebfe6[_0xc91d('0x57')]['id']}})['then'](handleEntityNotFound(_0x33c941,null))[_0xc91d('0x25')](function(_0x43ca36){if(_0x43ca36){_0x53d246=_0x43ca36;_0x4eb97f['model']=_[_0xc91d('0x3a')](db['UserVoiceQueueRt']['rawAttributes']);_0x4eb97f['query']=_[_0xc91d('0x3a')](_0x2ebfe6['query']);_0x4eb97f[_0xc91d('0x45')]=_[_0xc91d('0x3c')](_0x4eb97f[_0xc91d('0x39')],_0x4eb97f[_0xc91d('0x3b')]);_0x17ec8b['attributes']=_[_0xc91d('0x3c')](_0x4eb97f[_0xc91d('0x39')],qs[_0xc91d('0x3e')](_0x2ebfe6[_0xc91d('0x3b')]['fields']));_0x17ec8b['attributes']=_0x17ec8b[_0xc91d('0x3d')][_0xc91d('0x3f')]?_0x17ec8b[_0xc91d('0x3d')]:_0x4eb97f['model'];_0x17ec8b['order']=qs[_0xc91d('0x43')](_0x2ebfe6[_0xc91d('0x3b')][_0xc91d('0x43')]);_0x17ec8b[_0xc91d('0x44')]=qs[_0xc91d('0x45')](_[_0xc91d('0x64')](_0x2ebfe6[_0xc91d('0x3b')],_0x4eb97f['filters']));if(_0x2ebfe6['query'][_0xc91d('0x2a')]){_0x17ec8b[_0xc91d('0x44')]=_[_0xc91d('0x46')](_0x17ec8b['where'],{'$or':_['map'](_0x17ec8b['attributes'],function(_0x396c3d){var _0xcabdbe={};_0xcabdbe[_0x396c3d]={'$like':'%'+_0x2ebfe6[_0xc91d('0x3b')][_0xc91d('0x2a')]+'%'};return _0xcabdbe;})});}_0x17ec8b=_[_0xc91d('0x46')]({},_0x17ec8b,_0x2ebfe6[_0xc91d('0x48')]);return _0x53d246[_0xc91d('0x99')](_0x17ec8b);}})['then'](function(_0x5a2953){if(_0x5a2953){_0x27608d=_0x5a2953['length'];if(!_0x2ebfe6[_0xc91d('0x3b')][_0xc91d('0x40')](_0xc91d('0x41'))){_0x17ec8b[_0xc91d('0x1f')]=qs['limit'](_0x2ebfe6[_0xc91d('0x3b')][_0xc91d('0x1f')]);_0x17ec8b['offset']=qs['offset'](_0x2ebfe6[_0xc91d('0x3b')][_0xc91d('0x1d')]);}return _0x53d246[_0xc91d('0x99')](_0x17ec8b);}})['then'](function(_0x36fe26){return _0x36fe26?{'count':_0x27608d,'rows':_0x36fe26}:null;})['then'](respondWithResult(_0x33c941,null))[_0xc91d('0x4b')](handleError(_0x33c941,null));};exports[_0xc91d('0x9a')]=function(_0x38cb6e,_0x3c5792,_0x147d58){var _0x4f64be={};var _0x4a40b7={};var _0xc5047;var _0x196af7;return db['VoiceQueue']['findOne']({'where':{'id':_0x38cb6e[_0xc91d('0x57')]['id']}})['then'](handleEntityNotFound(_0x3c5792,null))['then'](function(_0x68754f){if(_0x68754f){_0xc5047=_0x68754f;_0x4a40b7['model']=_[_0xc91d('0x3a')](db[_0xc91d('0x9b')][_0xc91d('0x37')]);_0x4a40b7[_0xc91d('0x3b')]=_['keys'](_0x38cb6e[_0xc91d('0x3b')]);_0x4a40b7[_0xc91d('0x45')]=_[_0xc91d('0x3c')](_0x4a40b7['model'],_0x4a40b7[_0xc91d('0x3b')]);_0x4f64be[_0xc91d('0x3d')]=_[_0xc91d('0x3c')](_0x4a40b7[_0xc91d('0x39')],qs[_0xc91d('0x3e')](_0x38cb6e[_0xc91d('0x3b')][_0xc91d('0x3e')]));_0x4f64be[_0xc91d('0x3d')]=_0x4f64be['attributes'][_0xc91d('0x3f')]?_0x4f64be[_0xc91d('0x3d')]:_0x4a40b7[_0xc91d('0x39')];_0x4f64be[_0xc91d('0x42')]=qs['sort'](_0x38cb6e['query']['sort']);_0x4f64be[_0xc91d('0x44')]=qs[_0xc91d('0x45')](_[_0xc91d('0x64')](_0x38cb6e[_0xc91d('0x3b')],_0x4a40b7[_0xc91d('0x45')]));if(_0x38cb6e[_0xc91d('0x3b')][_0xc91d('0x2a')]){_0x4f64be['where']=_[_0xc91d('0x46')](_0x4f64be[_0xc91d('0x44')],{'$or':_[_0xc91d('0x35')](_0x4f64be[_0xc91d('0x3d')],function(_0x3b08ec){var _0x59585a={};_0x59585a[_0x3b08ec]={'$like':'%'+_0x38cb6e[_0xc91d('0x3b')][_0xc91d('0x2a')]+'%'};return _0x59585a;})});}_0x4f64be=_['merge']({},_0x4f64be,_0x38cb6e['options']);return _0xc5047[_0xc91d('0x9a')](_0x4f64be);}})[_0xc91d('0x25')](function(_0x391a55){if(_0x391a55){_0x196af7=_0x391a55[_0xc91d('0x3f')];if(!_0x38cb6e[_0xc91d('0x3b')]['hasOwnProperty'](_0xc91d('0x41'))){_0x4f64be[_0xc91d('0x1f')]=qs[_0xc91d('0x1f')](_0x38cb6e[_0xc91d('0x3b')][_0xc91d('0x1f')]);_0x4f64be[_0xc91d('0x1d')]=qs[_0xc91d('0x1d')](_0x38cb6e[_0xc91d('0x3b')][_0xc91d('0x1d')]);}return _0xc5047[_0xc91d('0x9a')](_0x4f64be);}})[_0xc91d('0x25')](function(_0x1b2062){if(_0x1b2062){return _0x1b2062?{'count':_0x196af7,'rows':_0x1b2062}:null;}})[_0xc91d('0x25')](respondWithResult(_0x3c5792,null))[_0xc91d('0x4b')](handleError(_0x3c5792,null));};exports[_0xc91d('0x9c')]=function(_0x41ee8a,_0x35af4e,_0x1d99f7){var _0x30125b,_0x4dc4da;return db['VoiceQueue']['find']({'where':{'id':_0x41ee8a['params']['id']}})[_0xc91d('0x25')](handleEntityNotFound(_0x35af4e,null))[_0xc91d('0x25')](function(_0x3c1c50){if(_0x3c1c50){_0x4dc4da=_0x3c1c50;return _0x3c1c50[_0xc91d('0x9c')](_0x41ee8a['body'][_0xc91d('0x81')],_[_0xc91d('0x58')](_0x41ee8a['body'],[_0xc91d('0x81'),'id'])||{});}return null;})[_0xc91d('0x95')](function(_0x648c73){var _0x1f0db2;_0x30125b=_0x648c73||[];var _0x35d013=[];if(_0x648c73){for(var _0x10dd6d=0x0;_0x10dd6d<_0x648c73['length'];_0x10dd6d+=0x1){var _0x39da87=_0x648c73[_0x10dd6d][_0xc91d('0x27')]({'plain':!![]});_0x4dc4da[_0xc91d('0x9d')]=_0x41ee8a[_0xc91d('0x4d')][_0xc91d('0x9d')]?_0x41ee8a[_0xc91d('0x4d')][_0xc91d('0x9d')]:_0x4dc4da['dialCheckDuplicateType'];switch(_0x4dc4da[_0xc91d('0x9d')]){case _0xc91d('0x9e'):_0x1f0db2=squel['insert']()['into'](_0xc91d('0x9f'))[_0xc91d('0xa0')](['phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt',_0xc91d('0x5a')],squel[_0xc91d('0x82')]()[_0xc91d('0xa1')](_0xc91d('0xa2'),_0xc91d('0xa2'))[_0xc91d('0xa1')](_0xc91d('0xa3'),_0xc91d('0xa4'))['field']('id',_0xc91d('0xa5'))[_0xc91d('0xa1')](_0x39da87['CmListId'][_0xc91d('0x8a')](),_0xc91d('0xa6'))[_0xc91d('0xa1')](_0x41ee8a[_0xc91d('0x57')]['id']['toString'](),_0xc91d('0x60'))[_0xc91d('0xa1')](_0xc91d('0xa3'),_0xc91d('0x59'))[_0xc91d('0xa1')]('NOW()',_0xc91d('0x5a'))[_0xc91d('0x84')](_0xc91d('0xa7'))['where'](_0xc91d('0xa8'))['where'](_0xc91d('0xa9'),_0x39da87['CmListId'][_0xc91d('0x8a')]())[_0xc91d('0x44')](_0xc91d('0xaa'))[_0xc91d('0x44')](_0xc91d('0xab'),squel[_0xc91d('0x82')]()[_0xc91d('0xa1')]('COALESCE(calleridnum,\x27\x27)')[_0xc91d('0x84')](_0xc91d('0xac'))['where']('VoiceQueueId\x20=\x20?',_0x41ee8a[_0xc91d('0x57')]['id']['toString']()))[_0xc91d('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xc91d('0xad'))[_0xc91d('0x84')](_0xc91d('0x9f'))['where'](_0xc91d('0x87'),_0x41ee8a[_0xc91d('0x57')]['id'][_0xc91d('0x8a')]())))['toString']();break;case _0xc91d('0xae'):_0x1f0db2=squel[_0xc91d('0xaf')]()[_0xc91d('0xb0')]('cm_hopper')['fromQuery']([_0xc91d('0xa2'),_0xc91d('0xa4'),_0xc91d('0xa5'),_0xc91d('0xa6'),_0xc91d('0x60'),'createdAt',_0xc91d('0x5a')],squel['select']()[_0xc91d('0xa1')]('phone',_0xc91d('0xa2'))[_0xc91d('0xa1')]('NOW()',_0xc91d('0xa4'))['field']('id',_0xc91d('0xa5'))[_0xc91d('0xa1')](_0x39da87['CmListId'][_0xc91d('0x8a')](),_0xc91d('0xa6'))[_0xc91d('0xa1')](_0x41ee8a['params']['id'][_0xc91d('0x8a')](),_0xc91d('0x60'))[_0xc91d('0xa1')](_0xc91d('0xa3'),_0xc91d('0x59'))['field']('NOW()',_0xc91d('0x5a'))[_0xc91d('0x84')]('cm_contacts')[_0xc91d('0x44')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x39da87[_0xc91d('0xb1')][_0xc91d('0x8a')]())[_0xc91d('0x44')](_0xc91d('0xaa'))[_0xc91d('0x44')](_0xc91d('0xab'),squel[_0xc91d('0x82')]()[_0xc91d('0xa1')](_0xc91d('0xad'))[_0xc91d('0x84')](_0xc91d('0x9f'))[_0xc91d('0x44')]('VoiceQueueId\x20=\x20?',_0x41ee8a[_0xc91d('0x57')]['id'][_0xc91d('0x8a')]())))[_0xc91d('0x8a')]();break;default:_0x1f0db2=squel[_0xc91d('0xaf')]()['into'](_0xc91d('0x9f'))[_0xc91d('0xa0')](['phone','scheduledAt','ContactId',_0xc91d('0xa6'),'VoiceQueueId',_0xc91d('0x59'),_0xc91d('0x5a')],squel[_0xc91d('0x82')]()[_0xc91d('0xa1')](_0xc91d('0xa2'),_0xc91d('0xa2'))[_0xc91d('0xa1')](_0xc91d('0xa3'),_0xc91d('0xa4'))[_0xc91d('0xa1')]('id',_0xc91d('0xa5'))[_0xc91d('0xa1')](_0x39da87[_0xc91d('0xb1')][_0xc91d('0x8a')](),_0xc91d('0xa6'))['field'](_0x41ee8a[_0xc91d('0x57')]['id'][_0xc91d('0x8a')](),_0xc91d('0x60'))[_0xc91d('0xa1')](_0xc91d('0xa3'),'createdAt')[_0xc91d('0xa1')](_0xc91d('0xa3'),_0xc91d('0x5a'))['from'](_0xc91d('0xa7'))[_0xc91d('0x44')](_0xc91d('0xa8'))['where']('ListId\x20=\x20?',_0x39da87[_0xc91d('0xb1')][_0xc91d('0x8a')]())[_0xc91d('0x44')](_0xc91d('0xaa')))[_0xc91d('0x8a')]();}_0x35d013[_0xc91d('0x89')](db[_0xc91d('0x73')][_0xc91d('0x3b')](_0x1f0db2));}return BPromise['all'](_0x35d013);}})[_0xc91d('0x25')](function(){return _0x30125b;})['then'](respondWithResult(_0x35af4e,null))[_0xc91d('0x4b')](handleError(_0x35af4e,null));};exports[_0xc91d('0xb2')]=function(_0x96b4af,_0x574811,_0x536870){return db[_0xc91d('0x36')][_0xc91d('0x2e')]({'where':{'id':_0x96b4af[_0xc91d('0x57')]['id']}})['then'](handleEntityNotFound(_0x574811,null))['then'](function(_0x53e45a){if(_0x53e45a){return _0x53e45a[_0xc91d('0xb2')](_0x96b4af[_0xc91d('0x3b')][_0xc91d('0x81')]);}})['then'](function(_0x35266b){if(_0x35266b){return db[_0xc91d('0x5f')]['destroy']({'where':{'ListId':_0x96b4af[_0xc91d('0x3b')]['ids'],'VoiceQueueId':_0x96b4af['params']['id']}})[_0xc91d('0x25')](function(){return _0x35266b;});}})[_0xc91d('0x25')](respondWithStatusCode(_0x574811,null))[_0xc91d('0x4b')](handleError(_0x574811,null));};exports[_0xc91d('0xb3')]=function(_0x18eea0,_0x5cc486,_0x5dfc3e){var _0x41fb65={};var _0x13a2f7={};var _0x5f43f9;var _0x4afead;return db[_0xc91d('0x36')]['findOne']({'where':{'id':_0x18eea0[_0xc91d('0x57')]['id']}})[_0xc91d('0x25')](handleEntityNotFound(_0x5cc486,null))[_0xc91d('0x25')](function(_0x62ed6f){if(_0x62ed6f){_0x5f43f9=_0x62ed6f;_0x13a2f7[_0xc91d('0x39')]=_['keys'](db[_0xc91d('0x9b')][_0xc91d('0x37')]);_0x13a2f7['query']=_[_0xc91d('0x3a')](_0x18eea0[_0xc91d('0x3b')]);_0x13a2f7[_0xc91d('0x45')]=_[_0xc91d('0x3c')](_0x13a2f7[_0xc91d('0x39')],_0x13a2f7[_0xc91d('0x3b')]);_0x41fb65[_0xc91d('0x3d')]=_[_0xc91d('0x3c')](_0x13a2f7['model'],qs[_0xc91d('0x3e')](_0x18eea0[_0xc91d('0x3b')][_0xc91d('0x3e')]));_0x41fb65[_0xc91d('0x3d')]=_0x41fb65[_0xc91d('0x3d')][_0xc91d('0x3f')]?_0x41fb65[_0xc91d('0x3d')]:_0x13a2f7[_0xc91d('0x39')];_0x41fb65[_0xc91d('0x42')]=qs['sort'](_0x18eea0[_0xc91d('0x3b')][_0xc91d('0x43')]);_0x41fb65[_0xc91d('0x44')]=qs[_0xc91d('0x45')](_[_0xc91d('0x64')](_0x18eea0[_0xc91d('0x3b')],_0x13a2f7[_0xc91d('0x45')]));if(_0x18eea0[_0xc91d('0x3b')][_0xc91d('0x2a')]){_0x41fb65[_0xc91d('0x44')]=_['merge'](_0x41fb65[_0xc91d('0x44')],{'$or':_[_0xc91d('0x35')](_0x41fb65[_0xc91d('0x3d')],function(_0x8146a3){var _0x32de75={};_0x32de75[_0x8146a3]={'$like':'%'+_0x18eea0[_0xc91d('0x3b')]['filter']+'%'};return _0x32de75;})});}_0x41fb65=_[_0xc91d('0x46')]({},_0x41fb65,_0x18eea0['options']);return _0x5f43f9['getBlackLists'](_0x41fb65);}})[_0xc91d('0x25')](function(_0x39ccbd){if(_0x39ccbd){_0x4afead=_0x39ccbd['length'];if(!_0x18eea0['query'][_0xc91d('0x40')](_0xc91d('0x41'))){_0x41fb65[_0xc91d('0x1f')]=qs[_0xc91d('0x1f')](_0x18eea0['query'][_0xc91d('0x1f')]);_0x41fb65['offset']=qs[_0xc91d('0x1d')](_0x18eea0[_0xc91d('0x3b')][_0xc91d('0x1d')]);}return _0x5f43f9[_0xc91d('0xb3')](_0x41fb65);}})[_0xc91d('0x25')](function(_0x2e562c){if(_0x2e562c){return _0x2e562c?{'count':_0x4afead,'rows':_0x2e562c}:null;}})['then'](respondWithResult(_0x5cc486,null))['catch'](handleError(_0x5cc486,null));};exports[_0xc91d('0xb4')]=function(_0x4d9684,_0x4af380,_0x27cdee){var _0x2c1f30,_0x343af9;return db[_0xc91d('0x36')][_0xc91d('0x2e')]({'where':{'id':_0x4d9684[_0xc91d('0x57')]['id']}})[_0xc91d('0x25')](handleEntityNotFound(_0x4af380,null))[_0xc91d('0x25')](function(_0x3be153){if(_0x3be153){_0x343af9=_0x3be153;return _0x3be153['addBlackLists'](_0x4d9684['body'][_0xc91d('0x81')],_[_0xc91d('0x58')](_0x4d9684[_0xc91d('0x4d')],[_0xc91d('0x81'),'id'])||{});}return null;})[_0xc91d('0x95')](function(_0x53c713){var _0x5d06fe;_0x2c1f30=_0x53c713||[];var _0x5a0626=[];if(_0x53c713){for(var _0x38c448=0x0;_0x38c448<_0x53c713[_0xc91d('0x3f')];_0x38c448+=0x1){var _0x67c94=_0x53c713[_0x38c448]['get']({'plain':!![]});_0x5d06fe=squel['insert']()['into'](_0xc91d('0xb5'))['fromQuery']([_0xc91d('0xa2'),_0xc91d('0xa5'),_0xc91d('0xa6'),_0xc91d('0x60'),_0xc91d('0x59'),'updatedAt'],squel[_0xc91d('0x82')]()[_0xc91d('0xa1')]('phone','phone')[_0xc91d('0xa1')]('id',_0xc91d('0xa5'))[_0xc91d('0xa1')](_0x67c94[_0xc91d('0xb1')]['toString'](),'ListId')[_0xc91d('0xa1')](_0x4d9684[_0xc91d('0x57')]['id']['toString'](),_0xc91d('0x60'))[_0xc91d('0xa1')](_0xc91d('0xa3'),_0xc91d('0x59'))[_0xc91d('0xa1')](_0xc91d('0xa3'),_0xc91d('0x5a'))[_0xc91d('0x84')](_0xc91d('0xa7'))['where'](_0xc91d('0xa8'))[_0xc91d('0x44')](_0xc91d('0xa9'),_0x67c94[_0xc91d('0xb1')][_0xc91d('0x8a')]())[_0xc91d('0x44')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x5a0626['push'](db[_0xc91d('0x73')]['query'](_0x5d06fe));}return BPromise['all'](_0x5a0626);}})[_0xc91d('0x25')](function(){return _0x2c1f30;})['then'](respondWithResult(_0x4af380,null))['catch'](handleError(_0x4af380,null));};exports[_0xc91d('0xb6')]=function(_0x2f681f,_0x3c4a2b,_0x4c63b1){return db['VoiceQueue'][_0xc91d('0x2e')]({'where':{'id':_0x2f681f[_0xc91d('0x57')]['id']}})[_0xc91d('0x25')](handleEntityNotFound(_0x3c4a2b,null))[_0xc91d('0x25')](function(_0x2ba97e){if(_0x2ba97e){return _0x2ba97e['removeBlackLists'](_0x2f681f[_0xc91d('0x3b')][_0xc91d('0x81')]);}})[_0xc91d('0x25')](function(_0x3da3d9){if(_0x3da3d9){return db[_0xc91d('0x68')]['destroy']({'where':{'ListId':_0x2f681f[_0xc91d('0x3b')][_0xc91d('0x81')],'VoiceQueueId':_0x2f681f['params']['id']}})[_0xc91d('0x25')](function(){return _0x3da3d9;});}})[_0xc91d('0x25')](respondWithStatusCode(_0x3c4a2b,null))[_0xc91d('0x4b')](handleError(_0x3c4a2b,null));}; \ No newline at end of file +var _0xfc2d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','UserProfileResource','end','stack','name','send','VoiceQueue','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','CmHopper','rows','CmHopperHistory','order','VoiceQueueId','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','Team','User','voicePause','interface','flatMap','forEach','penalty','Agents','each','UserVoiceQueue','findOrCreate','upsert','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','field','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','all','union','compact','ids','removeAgents','UserVoiceQueueRt','emit','addAgents','spread','isEmpty','online','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','NOW()','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','ListId','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service'];(function(_0x20bff3,_0x16d38a){var _0xd6b5e1=function(_0x45b00c){while(--_0x45b00c){_0x20bff3['push'](_0x20bff3['shift']());}};_0xd6b5e1(++_0x16d38a);}(_0xfc2d,0x15a));var _0xdfc2=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xfc2d[_0x5a9c0c];return _0x53c77d;};'use strict';var emlformat=require(_0xdfc2('0x0'));var rimraf=require(_0xdfc2('0x1'));var zipdir=require(_0xdfc2('0x2'));var jsonpatch=require(_0xdfc2('0x3'));var rp=require('request-promise');var moment=require(_0xdfc2('0x4'));var BPromise=require(_0xdfc2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdfc2('0x6'));var sox=require(_0xdfc2('0x7'));var csv=require(_0xdfc2('0x8'));var ejs=require(_0xdfc2('0x9'));var fs=require('fs');var fs_extra=require(_0xdfc2('0xa'));var _=require(_0xdfc2('0xb'));var squel=require(_0xdfc2('0xc'));var crypto=require(_0xdfc2('0xd'));var jsforce=require(_0xdfc2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdfc2('0x8'));var querystring=require(_0xdfc2('0xf'));var Papa=require(_0xdfc2('0x10'));var Redis=require('ioredis');var authService=require(_0xdfc2('0x11'));var qs=require(_0xdfc2('0x12'));var as=require(_0xdfc2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdfc2('0x14'))(_0xdfc2('0x15'));var utils=require('../../config/utils');var config=require(_0xdfc2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdfc2('0x17'))['db'];config[_0xdfc2('0x18')]=_[_0xdfc2('0x19')](config['redis'],{'host':_0xdfc2('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdfc2('0x18')]));require(_0xdfc2('0x1b'))[_0xdfc2('0x1c')](socket);function respondWithStatusCode(_0x55cb21,_0xd2c9f2){_0xd2c9f2=_0xd2c9f2||0xcc;return function(_0x171e4f){if(_0x171e4f){return _0x55cb21[_0xdfc2('0x1d')](_0xd2c9f2);}return _0x55cb21[_0xdfc2('0x1e')](_0xd2c9f2)['end']();};}function respondWithResult(_0x5aeb7e,_0x3f7a65){_0x3f7a65=_0x3f7a65||0xc8;return function(_0x2e528a){if(_0x2e528a){return _0x5aeb7e['status'](_0x3f7a65)[_0xdfc2('0x1f')](_0x2e528a);}};}function respondWithFilteredResult(_0x14ffb3,_0x4d76c5){return function(_0x15eec2){if(_0x15eec2){var _0x424975=typeof _0x4d76c5[_0xdfc2('0x20')]===_0xdfc2('0x21')&&typeof _0x4d76c5[_0xdfc2('0x22')]==='undefined';var _0x180cb0=_0x15eec2[_0xdfc2('0x23')];var _0x1311b2=_0x424975?0x0:_0x4d76c5['offset'];var _0x91a3d9=_0x424975?_0x15eec2[_0xdfc2('0x23')]:_0x4d76c5[_0xdfc2('0x20')]+_0x4d76c5[_0xdfc2('0x22')];var _0x368de4;if(_0x91a3d9>=_0x180cb0){_0x91a3d9=_0x180cb0;_0x368de4=0xc8;}else{_0x368de4=0xce;}_0x14ffb3[_0xdfc2('0x1e')](_0x368de4);return _0x14ffb3[_0xdfc2('0x24')]('Content-Range',_0x1311b2+'-'+_0x91a3d9+'/'+_0x180cb0)[_0xdfc2('0x1f')](_0x15eec2);}return null;};}function patchUpdates(_0x214df6){return function(_0x5eff87){try{jsonpatch[_0xdfc2('0x25')](_0x5eff87,_0x214df6,!![]);}catch(_0x2195e9){return BPromise[_0xdfc2('0x26')](_0x2195e9);}return _0x5eff87['save']();};}function saveUpdates(_0x44e0cf,_0x15954c){return function(_0x439564){if(_0x439564){return _0x439564[_0xdfc2('0x27')](_0x44e0cf)[_0xdfc2('0x28')](function(_0x22f686){return _0x22f686;});}return null;};}function removeEntity(_0x513844,_0x167c37){return function(_0x523d77){if(_0x523d77){return _0x523d77[_0xdfc2('0x29')]()[_0xdfc2('0x28')](function(){var _0x5420a8=_0x523d77[_0xdfc2('0x2a')]({'plain':!![]});var _0xe13999=[{'name':_0xdfc2('0x2b'),'value':_0xdfc2('0x2c'),'ignore':![]},{'name':_0xdfc2('0x2d'),'value':_0xdfc2('0x2e'),'ignore':![]}];var _0x3f4cc9=_(_0xe13999)[_0xdfc2('0x2f')]('ignore')[_0xdfc2('0x30')](_0xdfc2('0x31'))['value']();if(_[_0xdfc2('0x32')](_0x3f4cc9,_0x5420a8[_0xdfc2('0x33')])){return;}var _0x50909f=_['find'](_0xe13999,[_0xdfc2('0x31'),_0x5420a8['type']])['name'];return db[_0xdfc2('0x34')][_0xdfc2('0x29')]({'where':{'type':_0x50909f,'resourceId':_0x5420a8['id']}})[_0xdfc2('0x28')](function(){return _0x523d77;});})['then'](function(){_0x513844[_0xdfc2('0x1e')](0xcc)[_0xdfc2('0x35')]();});}};}function handleEntityNotFound(_0x441a8e,_0xd87f88){return function(_0x3a0c5c){if(!_0x3a0c5c){_0x441a8e[_0xdfc2('0x1d')](0x194);}return _0x3a0c5c;};}function handleError(_0xd5d153,_0x4f301c){_0x4f301c=_0x4f301c||0x1f4;return function(_0x5c22dd){logger['error'](_0x5c22dd[_0xdfc2('0x36')]);if(_0x5c22dd[_0xdfc2('0x37')]){delete _0x5c22dd[_0xdfc2('0x37')];}_0xd5d153['status'](_0x4f301c)[_0xdfc2('0x38')](_0x5c22dd);};}exports['index']=function(_0x230db4,_0x442135){var _0x1c24a9={},_0x1f8f05={},_0x1eb41e={'count':0x0,'rows':[]};var _0x546e97=_[_0xdfc2('0x30')](db[_0xdfc2('0x39')][_0xdfc2('0x3a')],function(_0x3b9dea){return{'name':_0x3b9dea[_0xdfc2('0x3b')],'type':_0x3b9dea[_0xdfc2('0x33')]['key']};});_0x1f8f05[_0xdfc2('0x3c')]=_[_0xdfc2('0x30')](_0x546e97,_0xdfc2('0x37'));_0x1f8f05['query']=_[_0xdfc2('0x3d')](_0x230db4[_0xdfc2('0x3e')]);_0x1f8f05[_0xdfc2('0x3f')]=_[_0xdfc2('0x40')](_0x1f8f05['model'],_0x1f8f05[_0xdfc2('0x3e')]);_0x1c24a9[_0xdfc2('0x41')]=_[_0xdfc2('0x40')](_0x1f8f05[_0xdfc2('0x3c')],qs[_0xdfc2('0x42')](_0x230db4[_0xdfc2('0x3e')][_0xdfc2('0x42')]));_0x1c24a9[_0xdfc2('0x41')]=_0x1c24a9[_0xdfc2('0x41')][_0xdfc2('0x43')]?_0x1c24a9[_0xdfc2('0x41')]:_0x1f8f05[_0xdfc2('0x3c')];if(!_0x230db4[_0xdfc2('0x3e')][_0xdfc2('0x44')](_0xdfc2('0x45'))){_0x1c24a9[_0xdfc2('0x22')]=qs['limit'](_0x230db4[_0xdfc2('0x3e')][_0xdfc2('0x22')]);_0x1c24a9[_0xdfc2('0x20')]=qs['offset'](_0x230db4[_0xdfc2('0x3e')]['offset']);}_0x1c24a9['order']=qs['sort'](_0x230db4['query'][_0xdfc2('0x46')]);_0x1c24a9[_0xdfc2('0x47')]=qs['filters'](_[_0xdfc2('0x48')](_0x230db4['query'],_0x1f8f05[_0xdfc2('0x3f')]),_0x546e97);if(_0x230db4[_0xdfc2('0x3e')][_0xdfc2('0x2f')]){_0x1c24a9[_0xdfc2('0x47')]=_[_0xdfc2('0x49')](_0x1c24a9['where'],{'$or':_[_0xdfc2('0x30')](_0x546e97,function(_0x42c396){if(_0x42c396[_0xdfc2('0x33')]!==_0xdfc2('0x4a')){var _0x131373={};_0x131373[_0x42c396[_0xdfc2('0x37')]]={'$like':'%'+_0x230db4[_0xdfc2('0x3e')][_0xdfc2('0x2f')]+'%'};return _0x131373;}})});}_0x1c24a9=_['merge']({},_0x1c24a9,_0x230db4[_0xdfc2('0x4b')]);var _0x100b3b={'where':_0x1c24a9[_0xdfc2('0x47')]};return db['VoiceQueue'][_0xdfc2('0x23')](_0x100b3b)['then'](function(_0x23894e){_0x1eb41e[_0xdfc2('0x23')]=_0x23894e;if(_0x230db4['query'][_0xdfc2('0x4c')]){_0x1c24a9[_0xdfc2('0x4d')]=[{'all':!![]}];}return db[_0xdfc2('0x39')][_0xdfc2('0x4e')](_0x1c24a9);})[_0xdfc2('0x28')](function(_0x43cf0e){_0x1eb41e['rows']=_0x43cf0e;return _0x1eb41e;})[_0xdfc2('0x28')](respondWithFilteredResult(_0x442135,_0x1c24a9))[_0xdfc2('0x4f')](handleError(_0x442135,null));};exports[_0xdfc2('0x50')]=function(_0x140e96,_0x537414){var _0x4c8d2c={'raw':![],'where':{'id':_0x140e96[_0xdfc2('0x51')]['id']}},_0x3bfd1e={};_0x3bfd1e[_0xdfc2('0x3c')]=_[_0xdfc2('0x3d')](db[_0xdfc2('0x39')]['rawAttributes']);_0x3bfd1e[_0xdfc2('0x3e')]=_[_0xdfc2('0x3d')](_0x140e96['query']);_0x3bfd1e[_0xdfc2('0x3f')]=_[_0xdfc2('0x40')](_0x3bfd1e[_0xdfc2('0x3c')],_0x3bfd1e[_0xdfc2('0x3e')]);_0x4c8d2c['attributes']=_[_0xdfc2('0x40')](_0x3bfd1e[_0xdfc2('0x3c')],qs[_0xdfc2('0x42')](_0x140e96[_0xdfc2('0x3e')][_0xdfc2('0x42')]));_0x4c8d2c[_0xdfc2('0x41')]=_0x4c8d2c[_0xdfc2('0x41')][_0xdfc2('0x43')]?_0x4c8d2c['attributes']:_0x3bfd1e['model'];if(_0x140e96[_0xdfc2('0x3e')]['includeAll']){_0x4c8d2c[_0xdfc2('0x4d')]=[{'all':!![]}];}_0x4c8d2c=_['merge']({},_0x4c8d2c,_0x140e96[_0xdfc2('0x4b')]);return db['VoiceQueue'][_0xdfc2('0x52')](_0x4c8d2c)[_0xdfc2('0x28')](handleEntityNotFound(_0x537414,null))[_0xdfc2('0x28')](respondWithResult(_0x537414,null))[_0xdfc2('0x4f')](handleError(_0x537414,null));};exports[_0xdfc2('0x53')]=function(_0x48d9ff,_0x118b4c){return db[_0xdfc2('0x39')][_0xdfc2('0x53')](_0x48d9ff[_0xdfc2('0x54')],{})['then'](function(_0x259b0d){var _0x3c07ea=_0x48d9ff[_0xdfc2('0x55')][_0xdfc2('0x2a')]({'plain':!![]});if(!_0x3c07ea)throw new Error(_0xdfc2('0x56'));if(_0x3c07ea[_0xdfc2('0x57')]===_0xdfc2('0x55')){var _0x352d3f=_0x259b0d[_0xdfc2('0x2a')]({'plain':!![]});var _0x41b3b0=[{'name':_0xdfc2('0x2b'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xdfc2('0x2e')}];var _0x1bb7d5=_[_0xdfc2('0x52')](_0x41b3b0,[_0xdfc2('0x31'),_0x352d3f[_0xdfc2('0x33')]])[_0xdfc2('0x37')];return db[_0xdfc2('0x58')]['find']({'where':{'name':_0x1bb7d5,'userProfileId':_0x3c07ea['userProfileId']},'raw':!![]})[_0xdfc2('0x28')](function(_0x1790bf){if(_0x1790bf&&_0x1790bf[_0xdfc2('0x59')]===0x0){return db[_0xdfc2('0x34')][_0xdfc2('0x53')]({'name':_0x352d3f[_0xdfc2('0x37')],'resourceId':_0x352d3f['id'],'type':_0x1790bf[_0xdfc2('0x37')],'sectionId':_0x1790bf['id']},{})[_0xdfc2('0x28')](function(){return _0x259b0d;});}else{return _0x259b0d;}})[_0xdfc2('0x4f')](function(_0x209e9c){logger[_0xdfc2('0x5a')](_0xdfc2('0x5b'),_0x209e9c);throw _0x209e9c;});}return _0x259b0d;})[_0xdfc2('0x28')](respondWithResult(_0x118b4c,0xc9))[_0xdfc2('0x4f')](handleError(_0x118b4c,null));};exports[_0xdfc2('0x5c')]=function(_0x58e6dd,_0x2fd148){var _0x479b8a={'where':{'id':_0x58e6dd['params']['id']}},_0x1814a6={};_0x1814a6[_0xdfc2('0x3c')]=_[_0xdfc2('0x3d')](db[_0xdfc2('0x39')]['rawAttributes']);_0x479b8a['attributes']=_[_0xdfc2('0x40')](_0x1814a6['model'],qs[_0xdfc2('0x42')](_0x58e6dd['query'][_0xdfc2('0x42')]));_0x479b8a[_0xdfc2('0x41')]=_0x479b8a[_0xdfc2('0x41')][_0xdfc2('0x43')]?_0x479b8a[_0xdfc2('0x41')]:_0x1814a6[_0xdfc2('0x3c')];if(_0x58e6dd['query'][_0xdfc2('0x4c')]){_0x479b8a[_0xdfc2('0x4d')]=[{'all':!![]}];}_0x479b8a=_[_0xdfc2('0x49')]({},_0x479b8a,_0x58e6dd[_0xdfc2('0x4b')]);return db[_0xdfc2('0x39')][_0xdfc2('0x52')](_0x479b8a)['then'](handleEntityNotFound(_0x2fd148,null))[_0xdfc2('0x28')](function(_0x573b0d){if(_0x573b0d){var _0x17cfa5=_0x573b0d[_0xdfc2('0x2a')]({'plain':!![]});_0x17cfa5=qs[_0xdfc2('0x5d')](_0x17cfa5,['id',_0xdfc2('0x5e'),_0xdfc2('0x5f')]);_0x58e6dd[_0xdfc2('0x54')]=_['omit'](_0x58e6dd[_0xdfc2('0x54')],['id','createdAt',_0xdfc2('0x5f')]);return db[_0xdfc2('0x39')][_0xdfc2('0x53')](_['merge'](_0x17cfa5,_0x58e6dd[_0xdfc2('0x54')]),{'include':_0x58e6dd[_0xdfc2('0x3e')][_0xdfc2('0x4c')]?[{'all':!![]}]:undefined})[_0xdfc2('0x28')](function(_0x3c246f){var _0x3dead5=_0x58e6dd[_0xdfc2('0x55')][_0xdfc2('0x2a')]({'plain':!![]});if(!_0x3dead5)throw new Error(_0xdfc2('0x56'));if(_0x3dead5[_0xdfc2('0x57')]==='user'){var _0x4edfad=_0x3c246f[_0xdfc2('0x2a')]({'plain':!![]});var _0x2ccb71=[{'name':_0xdfc2('0x2b'),'value':_0xdfc2('0x2c')},{'name':'QueueCampaigns','value':_0xdfc2('0x2e')}];var _0x8b4b9=_[_0xdfc2('0x52')](_0x2ccb71,[_0xdfc2('0x31'),_0x4edfad[_0xdfc2('0x33')]])[_0xdfc2('0x37')];return db['UserProfileSection'][_0xdfc2('0x52')]({'where':{'name':_0x8b4b9,'userProfileId':_0x3dead5[_0xdfc2('0x60')]},'raw':!![]})[_0xdfc2('0x28')](function(_0x1d1779){if(_0x1d1779&&_0x1d1779[_0xdfc2('0x59')]===0x0){return db['UserProfileResource'][_0xdfc2('0x53')]({'name':_0x4edfad[_0xdfc2('0x37')],'resourceId':_0x4edfad['id'],'type':_0x1d1779[_0xdfc2('0x37')],'sectionId':_0x1d1779['id']},{})[_0xdfc2('0x28')](function(){return _0x3c246f;});}else{return _0x3c246f;}})[_0xdfc2('0x4f')](function(_0x107c88){logger[_0xdfc2('0x5a')](_0xdfc2('0x5b'),_0x107c88);throw _0x107c88;});}return _0x3c246f;});}})[_0xdfc2('0x28')](respondWithResult(_0x2fd148,0xc9))[_0xdfc2('0x4f')](handleError(_0x2fd148,null));};exports[_0xdfc2('0x27')]=function(_0x311e54,_0x29e75e){if(_0x311e54[_0xdfc2('0x54')]['id']){delete _0x311e54['body']['id'];}return db[_0xdfc2('0x39')][_0xdfc2('0x52')]({'where':{'id':_0x311e54[_0xdfc2('0x51')]['id']}})[_0xdfc2('0x28')](handleEntityNotFound(_0x29e75e,null))['then'](saveUpdates(_0x311e54[_0xdfc2('0x54')],null))[_0xdfc2('0x28')](respondWithResult(_0x29e75e,null))[_0xdfc2('0x4f')](handleError(_0x29e75e,null));};exports['destroy']=function(_0x4e990c,_0x532d02){return db[_0xdfc2('0x39')][_0xdfc2('0x52')]({'where':{'id':_0x4e990c[_0xdfc2('0x51')]['id']}})[_0xdfc2('0x28')](handleEntityNotFound(_0x532d02,null))['then'](removeEntity(_0x532d02,null))[_0xdfc2('0x4f')](handleError(_0x532d02,null));};exports['getHoppers']=function(_0x4ffbcc,_0x3a2ab3,_0xf5eea7){var _0x1fae92={'raw':![],'where':{}};var _0x2b3dc4={};var _0x30784d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xdfc2('0x61')]({'where':{'id':_0x4ffbcc[_0xdfc2('0x51')]['id']}})[_0xdfc2('0x28')](handleEntityNotFound(_0x3a2ab3,null))[_0xdfc2('0x28')](function(_0x375043){if(_0x375043){_0x2b3dc4['model']=_[_0xdfc2('0x3d')](db[_0xdfc2('0x62')][_0xdfc2('0x3a')]);_0x2b3dc4[_0xdfc2('0x3e')]=_[_0xdfc2('0x3d')](_0x4ffbcc[_0xdfc2('0x3e')]);_0x2b3dc4[_0xdfc2('0x3f')]=_[_0xdfc2('0x40')](_0x2b3dc4[_0xdfc2('0x3c')],_0x2b3dc4[_0xdfc2('0x3e')]);_0x1fae92[_0xdfc2('0x41')]=_[_0xdfc2('0x40')](_0x2b3dc4[_0xdfc2('0x3c')],qs[_0xdfc2('0x42')](_0x4ffbcc['query'][_0xdfc2('0x42')]));_0x1fae92['attributes']=_0x1fae92[_0xdfc2('0x41')][_0xdfc2('0x43')]?_0x1fae92[_0xdfc2('0x41')]:_0x2b3dc4[_0xdfc2('0x3c')];if(!_0x4ffbcc[_0xdfc2('0x3e')][_0xdfc2('0x44')](_0xdfc2('0x45'))){_0x1fae92[_0xdfc2('0x22')]=qs[_0xdfc2('0x22')](_0x4ffbcc[_0xdfc2('0x3e')][_0xdfc2('0x22')]);_0x1fae92[_0xdfc2('0x20')]=qs[_0xdfc2('0x20')](_0x4ffbcc[_0xdfc2('0x3e')]['offset']);}_0x1fae92['order']=qs[_0xdfc2('0x46')](_0x4ffbcc['query'][_0xdfc2('0x46')]);_0x1fae92[_0xdfc2('0x47')]=qs[_0xdfc2('0x3f')](_['pick'](_0x4ffbcc[_0xdfc2('0x3e')],_0x2b3dc4[_0xdfc2('0x3f')]));_0x1fae92[_0xdfc2('0x47')]['VoiceQueueId']=_0x375043['id'];if(_0x4ffbcc[_0xdfc2('0x3e')][_0xdfc2('0x2f')]){_0x1fae92[_0xdfc2('0x47')]=_[_0xdfc2('0x49')](_0x1fae92[_0xdfc2('0x47')],{'$or':_[_0xdfc2('0x30')](_0x1fae92[_0xdfc2('0x41')],function(_0x1edcbd){var _0x4c67bc={};_0x4c67bc[_0x1edcbd]={'$like':'%'+_0x4ffbcc['query'][_0xdfc2('0x2f')]+'%'};return _0x4c67bc;})});}_0x1fae92=_[_0xdfc2('0x49')]({},_0x1fae92,_0x4ffbcc[_0xdfc2('0x4b')]);return db[_0xdfc2('0x62')][_0xdfc2('0x23')]({'where':_0x1fae92[_0xdfc2('0x47')]})['then'](function(_0xc43019){_0x30784d['count']=_0xc43019;if(_0x4ffbcc['query'][_0xdfc2('0x4c')]){_0x1fae92[_0xdfc2('0x4d')]=[{'all':!![]}];}return db[_0xdfc2('0x62')][_0xdfc2('0x4e')](_0x1fae92);})[_0xdfc2('0x28')](function(_0x32772a){_0x30784d[_0xdfc2('0x63')]=_0x32772a;return _0x30784d;});}})[_0xdfc2('0x28')](respondWithFilteredResult(_0x3a2ab3,_0x1fae92))[_0xdfc2('0x4f')](handleError(_0x3a2ab3,null));};exports['getHopperHistories']=function(_0x264c4b,_0xd25521,_0xd2ff0c){var _0x23ff37={'raw':!![],'where':{}};var _0x32f6ca={};var _0x435cfb={'count':0x0,'rows':[]};return db[_0xdfc2('0x39')]['findOne']({'where':{'id':_0x264c4b[_0xdfc2('0x51')]['id']}})['then'](handleEntityNotFound(_0xd25521,null))[_0xdfc2('0x28')](function(_0x5acd03){if(_0x5acd03){_0x32f6ca[_0xdfc2('0x3c')]=_['keys'](db[_0xdfc2('0x64')][_0xdfc2('0x3a')]);_0x32f6ca[_0xdfc2('0x3e')]=_[_0xdfc2('0x3d')](_0x264c4b[_0xdfc2('0x3e')]);_0x32f6ca['filters']=_[_0xdfc2('0x40')](_0x32f6ca[_0xdfc2('0x3c')],_0x32f6ca[_0xdfc2('0x3e')]);_0x23ff37['attributes']=_[_0xdfc2('0x40')](_0x32f6ca[_0xdfc2('0x3c')],qs['fields'](_0x264c4b['query'][_0xdfc2('0x42')]));_0x23ff37['attributes']=_0x23ff37[_0xdfc2('0x41')]['length']?_0x23ff37[_0xdfc2('0x41')]:_0x32f6ca[_0xdfc2('0x3c')];if(!_0x264c4b[_0xdfc2('0x3e')][_0xdfc2('0x44')](_0xdfc2('0x45'))){_0x23ff37[_0xdfc2('0x22')]=qs[_0xdfc2('0x22')](_0x264c4b[_0xdfc2('0x3e')][_0xdfc2('0x22')]);_0x23ff37[_0xdfc2('0x20')]=qs[_0xdfc2('0x20')](_0x264c4b[_0xdfc2('0x3e')]['offset']);}_0x23ff37[_0xdfc2('0x65')]=qs[_0xdfc2('0x46')](_0x264c4b[_0xdfc2('0x3e')]['sort']);_0x23ff37[_0xdfc2('0x47')]=qs[_0xdfc2('0x3f')](_[_0xdfc2('0x48')](_0x264c4b[_0xdfc2('0x3e')],_0x32f6ca[_0xdfc2('0x3f')]));_0x23ff37[_0xdfc2('0x47')][_0xdfc2('0x66')]=_0x5acd03['id'];if(_0x264c4b[_0xdfc2('0x3e')][_0xdfc2('0x2f')]){_0x23ff37['where']=_[_0xdfc2('0x49')](_0x23ff37[_0xdfc2('0x47')],{'$or':_['map'](_0x23ff37[_0xdfc2('0x41')],function(_0x2de52c){var _0x1ff973={};_0x1ff973[_0x2de52c]={'$like':'%'+_0x264c4b[_0xdfc2('0x3e')][_0xdfc2('0x2f')]+'%'};return _0x1ff973;})});}_0x23ff37=_[_0xdfc2('0x49')]({},_0x23ff37,_0x264c4b[_0xdfc2('0x4b')]);return db[_0xdfc2('0x64')][_0xdfc2('0x23')]({'where':_0x23ff37[_0xdfc2('0x47')]})[_0xdfc2('0x28')](function(_0x40a1c7){_0x435cfb['count']=_0x40a1c7;if(_0x264c4b[_0xdfc2('0x3e')][_0xdfc2('0x4c')]){_0x23ff37[_0xdfc2('0x4d')]=[{'all':!![]}];}return db[_0xdfc2('0x64')][_0xdfc2('0x4e')](_0x23ff37);})[_0xdfc2('0x28')](function(_0x9c659e){_0x435cfb[_0xdfc2('0x63')]=_0x9c659e;return _0x435cfb;});}})[_0xdfc2('0x28')](respondWithFilteredResult(_0xd25521,_0x23ff37))['catch'](handleError(_0xd25521,null));};exports['getHopperFinals']=function(_0x1291df,_0x4e265a,_0x5dcb6b){var _0x18830d={'raw':!![],'where':{}};var _0x133026={};var _0x3bc56a={'count':0x0,'rows':[]};return db[_0xdfc2('0x39')][_0xdfc2('0x61')]({'where':{'id':_0x1291df[_0xdfc2('0x51')]['id']}})['then'](handleEntityNotFound(_0x4e265a,null))['then'](function(_0x2dd5cf){if(_0x2dd5cf){_0x133026[_0xdfc2('0x3c')]=_[_0xdfc2('0x3d')](db[_0xdfc2('0x67')][_0xdfc2('0x3a')]);_0x133026['query']=_[_0xdfc2('0x3d')](_0x1291df[_0xdfc2('0x3e')]);_0x133026[_0xdfc2('0x3f')]=_['intersection'](_0x133026[_0xdfc2('0x3c')],_0x133026[_0xdfc2('0x3e')]);_0x18830d[_0xdfc2('0x41')]=_[_0xdfc2('0x40')](_0x133026[_0xdfc2('0x3c')],qs[_0xdfc2('0x42')](_0x1291df[_0xdfc2('0x3e')][_0xdfc2('0x42')]));_0x18830d['attributes']=_0x18830d[_0xdfc2('0x41')][_0xdfc2('0x43')]?_0x18830d[_0xdfc2('0x41')]:_0x133026[_0xdfc2('0x3c')];if(!_0x1291df[_0xdfc2('0x3e')][_0xdfc2('0x44')](_0xdfc2('0x45'))){_0x18830d[_0xdfc2('0x22')]=qs[_0xdfc2('0x22')](_0x1291df[_0xdfc2('0x3e')][_0xdfc2('0x22')]);_0x18830d[_0xdfc2('0x20')]=qs[_0xdfc2('0x20')](_0x1291df[_0xdfc2('0x3e')]['offset']);}_0x18830d['order']=qs[_0xdfc2('0x46')](_0x1291df[_0xdfc2('0x3e')][_0xdfc2('0x46')]);_0x18830d[_0xdfc2('0x47')]=qs[_0xdfc2('0x3f')](_[_0xdfc2('0x48')](_0x1291df[_0xdfc2('0x3e')],_0x133026[_0xdfc2('0x3f')]));_0x18830d['where'][_0xdfc2('0x66')]=_0x2dd5cf['id'];if(_0x1291df[_0xdfc2('0x3e')]['filter']){_0x18830d[_0xdfc2('0x47')]=_[_0xdfc2('0x49')](_0x18830d['where'],{'$or':_[_0xdfc2('0x30')](_0x18830d[_0xdfc2('0x41')],function(_0x557ebe){var _0x5a9358={};_0x5a9358[_0x557ebe]={'$like':'%'+_0x1291df[_0xdfc2('0x3e')][_0xdfc2('0x2f')]+'%'};return _0x5a9358;})});}_0x18830d=_[_0xdfc2('0x49')]({},_0x18830d,_0x1291df['options']);return db[_0xdfc2('0x67')][_0xdfc2('0x23')]({'where':_0x18830d[_0xdfc2('0x47')]})[_0xdfc2('0x28')](function(_0x529661){_0x3bc56a[_0xdfc2('0x23')]=_0x529661;if(_0x1291df['query']['includeAll']){_0x18830d[_0xdfc2('0x4d')]=[{'all':!![]}];}return db[_0xdfc2('0x67')][_0xdfc2('0x4e')](_0x18830d);})[_0xdfc2('0x28')](function(_0x4acfe9){_0x3bc56a[_0xdfc2('0x63')]=_0x4acfe9;return _0x3bc56a;});}})[_0xdfc2('0x28')](respondWithFilteredResult(_0x4e265a,_0x18830d))[_0xdfc2('0x4f')](handleError(_0x4e265a,null));};exports['getHopperBlacks']=function(_0x46ba8b,_0x25817c,_0x4f610b){var _0x58f5fb={'raw':!![],'where':{}};var _0xc1bb32={};var _0x40f541={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xdfc2('0x61')]({'where':{'id':_0x46ba8b[_0xdfc2('0x51')]['id']}})[_0xdfc2('0x28')](handleEntityNotFound(_0x25817c,null))[_0xdfc2('0x28')](function(_0x12e399){if(_0x12e399){_0xc1bb32['model']=_['keys'](db[_0xdfc2('0x68')]['rawAttributes']);_0xc1bb32[_0xdfc2('0x3e')]=_[_0xdfc2('0x3d')](_0x46ba8b[_0xdfc2('0x3e')]);_0xc1bb32[_0xdfc2('0x3f')]=_['intersection'](_0xc1bb32[_0xdfc2('0x3c')],_0xc1bb32['query']);_0x58f5fb['attributes']=_[_0xdfc2('0x40')](_0xc1bb32[_0xdfc2('0x3c')],qs[_0xdfc2('0x42')](_0x46ba8b[_0xdfc2('0x3e')][_0xdfc2('0x42')]));_0x58f5fb[_0xdfc2('0x41')]=_0x58f5fb[_0xdfc2('0x41')][_0xdfc2('0x43')]?_0x58f5fb[_0xdfc2('0x41')]:_0xc1bb32[_0xdfc2('0x3c')];if(!_0x46ba8b['query'][_0xdfc2('0x44')](_0xdfc2('0x45'))){_0x58f5fb[_0xdfc2('0x22')]=qs['limit'](_0x46ba8b['query'][_0xdfc2('0x22')]);_0x58f5fb[_0xdfc2('0x20')]=qs['offset'](_0x46ba8b[_0xdfc2('0x3e')][_0xdfc2('0x20')]);}_0x58f5fb['order']=qs[_0xdfc2('0x46')](_0x46ba8b[_0xdfc2('0x3e')][_0xdfc2('0x46')]);_0x58f5fb['where']=qs['filters'](_[_0xdfc2('0x48')](_0x46ba8b['query'],_0xc1bb32[_0xdfc2('0x3f')]));_0x58f5fb[_0xdfc2('0x47')][_0xdfc2('0x66')]=_0x12e399['id'];if(_0x46ba8b[_0xdfc2('0x3e')][_0xdfc2('0x2f')]){_0x58f5fb['where']=_[_0xdfc2('0x49')](_0x58f5fb[_0xdfc2('0x47')],{'$or':_[_0xdfc2('0x30')](_0x58f5fb[_0xdfc2('0x41')],function(_0x32a317){var _0x5c687c={};_0x5c687c[_0x32a317]={'$like':'%'+_0x46ba8b[_0xdfc2('0x3e')][_0xdfc2('0x2f')]+'%'};return _0x5c687c;})});}_0x58f5fb=_[_0xdfc2('0x49')]({},_0x58f5fb,_0x46ba8b[_0xdfc2('0x4b')]);return db[_0xdfc2('0x68')][_0xdfc2('0x23')]({'where':_0x58f5fb['where']})[_0xdfc2('0x28')](function(_0x13913f){_0x40f541[_0xdfc2('0x23')]=_0x13913f;if(_0x46ba8b[_0xdfc2('0x3e')][_0xdfc2('0x4c')]){_0x58f5fb[_0xdfc2('0x4d')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x58f5fb);})['then'](function(_0xfb7f7e){_0x40f541[_0xdfc2('0x63')]=_0xfb7f7e;return _0x40f541;});}})[_0xdfc2('0x28')](respondWithFilteredResult(_0x25817c,_0x58f5fb))[_0xdfc2('0x4f')](handleError(_0x25817c,null));};exports[_0xdfc2('0x69')]=function(_0x35d6e2,_0x3ac385,_0x51d6d3){var _0x218e87={};var _0x27c5cf={};var _0x1a8f28;var _0x49fc9f;return db[_0xdfc2('0x39')][_0xdfc2('0x61')]({'where':{'id':_0x35d6e2[_0xdfc2('0x51')]['id']}})[_0xdfc2('0x28')](handleEntityNotFound(_0x3ac385,null))[_0xdfc2('0x28')](function(_0xf8d03e){if(_0xf8d03e){_0x1a8f28=_0xf8d03e;_0x27c5cf[_0xdfc2('0x3c')]=_[_0xdfc2('0x3d')](db['Team'][_0xdfc2('0x3a')]);_0x27c5cf['query']=_[_0xdfc2('0x3d')](_0x35d6e2[_0xdfc2('0x3e')]);_0x27c5cf[_0xdfc2('0x3f')]=_[_0xdfc2('0x40')](_0x27c5cf[_0xdfc2('0x3c')],_0x27c5cf[_0xdfc2('0x3e')]);_0x218e87[_0xdfc2('0x41')]=_['intersection'](_0x27c5cf[_0xdfc2('0x3c')],qs[_0xdfc2('0x42')](_0x35d6e2['query'][_0xdfc2('0x42')]));_0x218e87[_0xdfc2('0x41')]=_0x218e87[_0xdfc2('0x41')]['length']?_0x218e87[_0xdfc2('0x41')]:_0x27c5cf[_0xdfc2('0x3c')];_0x218e87[_0xdfc2('0x65')]=qs['sort'](_0x35d6e2[_0xdfc2('0x3e')]['sort']);_0x218e87[_0xdfc2('0x47')]=qs[_0xdfc2('0x3f')](_[_0xdfc2('0x48')](_0x35d6e2[_0xdfc2('0x3e')],_0x27c5cf[_0xdfc2('0x3f')]));if(_0x35d6e2[_0xdfc2('0x3e')][_0xdfc2('0x2f')]){_0x218e87[_0xdfc2('0x47')]=_[_0xdfc2('0x49')](_0x218e87[_0xdfc2('0x47')],{'$or':_[_0xdfc2('0x30')](_0x218e87[_0xdfc2('0x41')],function(_0x3f19ac){var _0x3d0814={};_0x3d0814[_0x3f19ac]={'$like':'%'+_0x35d6e2[_0xdfc2('0x3e')][_0xdfc2('0x2f')]+'%'};return _0x3d0814;})});}_0x218e87=_[_0xdfc2('0x49')]({},_0x218e87,_0x35d6e2[_0xdfc2('0x4b')]);return _0x1a8f28[_0xdfc2('0x69')](_0x218e87);}})[_0xdfc2('0x28')](function(_0x2893a5){if(_0x2893a5){_0x49fc9f=_0x2893a5['length'];if(!_0x35d6e2[_0xdfc2('0x3e')][_0xdfc2('0x44')]('nolimit')){_0x218e87['limit']=qs['limit'](_0x35d6e2[_0xdfc2('0x3e')][_0xdfc2('0x22')]);_0x218e87['offset']=qs[_0xdfc2('0x20')](_0x35d6e2[_0xdfc2('0x3e')]['offset']);}return _0x1a8f28[_0xdfc2('0x69')](_0x218e87);}})['then'](function(_0x471381){if(_0x471381){return _0x471381?{'count':_0x49fc9f,'rows':_0x471381}:null;}})[_0xdfc2('0x28')](respondWithResult(_0x3ac385,null))[_0xdfc2('0x4f')](handleError(_0x3ac385,null));};exports[_0xdfc2('0x6a')]=function(_0x388351,_0x140b18,_0x59dc08){var _0x16ad2f=_0x388351[_0xdfc2('0x54')][_0xdfc2('0x6b')];var _0x39be9e=_['map'](_0x16ad2f,'id');return db[_0xdfc2('0x6c')][_0xdfc2('0x4e')]({'where':{'id':_0x39be9e},'attributes':['id'],'include':[{'model':db[_0xdfc2('0x6d')],'as':'Agents','attributes':['id',_0xdfc2('0x37'),'online',_0xdfc2('0x6e'),_0xdfc2('0x6f')],'raw':!![]}]})['then'](function(_0x1948c3){if(_0x1948c3){var _0x27a0cb=_[_0xdfc2('0x70')](_0x1948c3,function(_0x2cfee8){var _0x29ca5d=_0x2cfee8[_0xdfc2('0x2a')]({'plain':!![]});_0x29ca5d['Agents'][_0xdfc2('0x71')](function(_0x2c68e2){_0x2c68e2[_0xdfc2('0x72')]=_[_0xdfc2('0x52')](_0x16ad2f,{'id':_0x29ca5d['id']})[_0xdfc2('0x72')];});return _0x29ca5d[_0xdfc2('0x73')];});return db[_0xdfc2('0x39')]['find']({'where':{'id':_0x388351[_0xdfc2('0x51')]['id']}})['then'](function(_0x50776c){return db['sequelize']['transaction'](function(_0x3be2ae){return _0x50776c['addTeams'](_0x39be9e,{'transaction':_0x3be2ae})[_0xdfc2('0x28')](function(){return BPromise[_0xdfc2('0x74')](_0x16ad2f,function(_0x17548c){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x17548c['id'],'VoiceQueueId':_0x388351[_0xdfc2('0x51')]['id'],'penalty':_0x17548c[_0xdfc2('0x72')]},{'transaction':_0x3be2ae});});})['then'](function(){return BPromise['each'](_0x27a0cb,function(_0x323f8c){return db[_0xdfc2('0x75')][_0xdfc2('0x76')]({'where':{'UserId':_0x323f8c['id'],'VoiceQueueId':_0x388351['params']['id']},'defaults':{'penalty':_0x323f8c[_0xdfc2('0x72')]},'transaction':_0x3be2ae});});})['then'](function(){return BPromise[_0xdfc2('0x74')](_['filter'](_0x27a0cb,{'online':!![]}),function(_0x5e41cb){return db['UserVoiceQueueRt'][_0xdfc2('0x77')]({'membername':_0x5e41cb[_0xdfc2('0x37')],'UserId':_0x5e41cb['id'],'queue_name':_0x50776c[_0xdfc2('0x37')],'VoiceQueueId':_0x50776c['id'],'interface':_[_0xdfc2('0x78')](_0x5e41cb['interface'])?util[_0xdfc2('0x79')](_0xdfc2('0x7a'),_0x5e41cb[_0xdfc2('0x37')]):_0x5e41cb[_0xdfc2('0x6f')],'paused':_0x5e41cb[_0xdfc2('0x6e')]||![],'penalty':_0x5e41cb[_0xdfc2('0x72')]},{'transaction':_0x3be2ae});});})[_0xdfc2('0x28')](function(){_0x27a0cb[_0xdfc2('0x71')](function(_0x314a96){socket['emit'](_0xdfc2('0x7b'),{'UserId':_0x314a96['id'],'VoiceQueueId':_0x50776c['id']});});});});});}})[_0xdfc2('0x28')](respondWithStatusCode(_0x140b18,null))[_0xdfc2('0x4f')](handleError(_0x140b18,null));};exports[_0xdfc2('0x7c')]=function(_0x38fd60,_0x1e9772,_0x1af44e){return db['Team'][_0xdfc2('0x4e')]({'where':{'id':_0x38fd60[_0xdfc2('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db[_0xdfc2('0x6d')],'as':_0xdfc2('0x73'),'attributes':['id'],'raw':!![]}]})[_0xdfc2('0x28')](handleEntityNotFound(_0x1e9772,null))['then'](function(_0x1dea81){var _0x272b73=_[_0xdfc2('0x30')](_0x1dea81,'id');var _0x7ebdb5=[];var _0x4cd111=[];var _0x4d6eeb=squel['select']();_0x4d6eeb[_0xdfc2('0x7d')](_0xdfc2('0x7e'))[_0xdfc2('0x7f')](_0xdfc2('0x80'),'tq')[_0xdfc2('0x81')]('user_has_teams','ut',_0xdfc2('0x82'))[_0xdfc2('0x47')]('VoiceQueueId\x20=\x20?',_0x38fd60[_0xdfc2('0x51')]['id']);for(var _0x58555d=0x0;_0x58555d<_0x1dea81[_0xdfc2('0x43')];_0x58555d+=0x1){let _0x7f6ea3=_0x1dea81[_0x58555d];for(var _0x25b098=0x0;_0x25b098<_0x7f6ea3[_0xdfc2('0x73')]['length'];_0x25b098+=0x1){let _0x210648=_0x7f6ea3[_0xdfc2('0x73')][_0x25b098];var _0x1d6b7d=_0x4d6eeb[_0xdfc2('0x5c')]();_0x1d6b7d[_0xdfc2('0x47')](_0xdfc2('0x83'),_0x210648['id']);_0x4cd111[_0xdfc2('0x84')](db[_0xdfc2('0x85')][_0xdfc2('0x3e')](_0x1d6b7d['toString'](),{'type':db['sequelize']['QueryTypes'][_0xdfc2('0x86')]})[_0xdfc2('0x28')](function(_0x5d27b3){if(_0x5d27b3[_0xdfc2('0x43')]===0x1){return _0x210648['id'];}else{var _0x32fa92=_[_0xdfc2('0x87')](_[_0xdfc2('0x30')](_0x5d27b3,_0xdfc2('0x88')),function(_0x11981a){return _['includes'](_0x272b73,_0x11981a);});if(_0x32fa92){return _0x210648['id'];}}}));}}return BPromise[_0xdfc2('0x89')](_0x4cd111)[_0xdfc2('0x28')](function(_0x1458e6){_0x7ebdb5=_(_0x7ebdb5)[_0xdfc2('0x8a')](_0x1458e6)[_0xdfc2('0x8b')]()[_0xdfc2('0x31')]();return db['VoiceQueue'][_0xdfc2('0x52')]({'where':{'id':_0x38fd60['params']['id']}})['then'](function(_0x44612f){return db['sequelize']['transaction'](function(_0x19c179){return _0x44612f[_0xdfc2('0x7c')](_0x38fd60[_0xdfc2('0x3e')][_0xdfc2('0x8c')],{'transaction':_0x19c179})[_0xdfc2('0x28')](function(){if(!_['isEmpty'](_0x7ebdb5)){return _0x44612f[_0xdfc2('0x8d')](_0x7ebdb5,{'transaction':_0x19c179})[_0xdfc2('0x28')](function(){return db[_0xdfc2('0x8e')][_0xdfc2('0x29')]({'where':{'VoiceQueueId':_0x38fd60[_0xdfc2('0x51')]['id'],'UserId':_0x7ebdb5},'transaction':_0x19c179});});}})['then'](function(){_0x7ebdb5[_0xdfc2('0x71')](function(_0x2a6f72){socket[_0xdfc2('0x8f')]('userVoiceQueue:remove',{'UserId':_0x2a6f72,'VoiceQueueId':_0x44612f['id']});});});});});});})[_0xdfc2('0x28')](respondWithStatusCode(_0x1e9772,null))['catch'](handleError(_0x1e9772,null));};exports['addAgents']=function(_0x1973f0,_0x460dea,_0x491d4c){var _0x52b81a,_0x3afd06;return db[_0xdfc2('0x39')][_0xdfc2('0x52')]({'where':{'id':_0x1973f0[_0xdfc2('0x51')]['id']}})[_0xdfc2('0x28')](handleEntityNotFound(_0x460dea,null))['then'](function(_0x5d5156){if(_0x5d5156){_0x3afd06=_0x5d5156;return _0x5d5156[_0xdfc2('0x90')](_0x1973f0[_0xdfc2('0x54')][_0xdfc2('0x8c')],_[_0xdfc2('0x5d')](_0x1973f0['body'],[_0xdfc2('0x8c'),'id'])||{})[_0xdfc2('0x91')](function(_0x4dada8){for(var _0xb9a011=0x0;_0xb9a011<_0x1973f0[_0xdfc2('0x54')][_0xdfc2('0x8c')][_0xdfc2('0x43')];_0xb9a011+=0x1){socket[_0xdfc2('0x8f')](_0xdfc2('0x7b'),{'UserId':Number(_0x1973f0[_0xdfc2('0x54')][_0xdfc2('0x8c')][_0xb9a011]),'VoiceQueueId':Number(_0x1973f0[_0xdfc2('0x51')]['id'])});}return _0x4dada8;});}})['then'](function(_0x39fb2a){_0x52b81a=_0x39fb2a||[];if(_0x3afd06){return db[_0xdfc2('0x6d')][_0xdfc2('0x4e')]({'where':{'id':_0x1973f0[_0xdfc2('0x54')][_0xdfc2('0x8c')]},'attributes':['id',_0xdfc2('0x37'),'online',_0xdfc2('0x6e'),_0xdfc2('0x6f')],'raw':!![]});}})[_0xdfc2('0x28')](function(_0x10d44d){if(!_[_0xdfc2('0x92')](_0x10d44d)){var _0x4f2c44=[];for(var _0x293572=0x0;_0x293572<_0x10d44d[_0xdfc2('0x43')];_0x293572++){if(_0x10d44d[_0x293572][_0xdfc2('0x93')]){_0x4f2c44[_0xdfc2('0x84')](db[_0xdfc2('0x8e')]['upsert']({'membername':_0x10d44d[_0x293572][_0xdfc2('0x37')],'UserId':_0x10d44d[_0x293572]['id'],'queue_name':_0x3afd06[_0xdfc2('0x37')],'VoiceQueueId':_0x3afd06['id'],'interface':_[_0xdfc2('0x78')](_0x10d44d[_0x293572][_0xdfc2('0x6f')])?util[_0xdfc2('0x79')](_0xdfc2('0x7a'),_0x10d44d[_0x293572][_0xdfc2('0x37')]):_0x10d44d[_0x293572][_0xdfc2('0x6f')],'paused':_0x10d44d[_0x293572][_0xdfc2('0x6e')]||![],'penalty':_0x1973f0[_0xdfc2('0x54')][_0xdfc2('0x72')]||0x0}));}}return BPromise[_0xdfc2('0x89')](_0x4f2c44);}})[_0xdfc2('0x28')](function(){return _0x52b81a;})[_0xdfc2('0x28')](respondWithResult(_0x460dea,null))[_0xdfc2('0x4f')](handleError(_0x460dea,null));};exports['removeAgents']=function(_0x43bdd5,_0x49682c,_0x5caa84){return db[_0xdfc2('0x39')]['find']({'where':{'id':_0x43bdd5[_0xdfc2('0x51')]['id']}})['then'](handleEntityNotFound(_0x49682c,null))[_0xdfc2('0x28')](function(_0xf96c34){if(_0xf96c34){return _0xf96c34[_0xdfc2('0x8d')](_0x43bdd5[_0xdfc2('0x3e')][_0xdfc2('0x8c')])[_0xdfc2('0x28')](function(){if(_[_0xdfc2('0x94')](_0x43bdd5[_0xdfc2('0x3e')][_0xdfc2('0x8c')])){for(var _0x1c2f00=0x0;_0x1c2f00<_0x43bdd5[_0xdfc2('0x3e')][_0xdfc2('0x8c')]['length'];_0x1c2f00+=0x1){socket[_0xdfc2('0x8f')]('userVoiceQueue:remove',{'UserId':Number(_0x43bdd5['query'][_0xdfc2('0x8c')][_0x1c2f00]),'VoiceQueueId':Number(_0x43bdd5[_0xdfc2('0x51')]['id'])});}}else{socket[_0xdfc2('0x8f')](_0xdfc2('0x95'),{'UserId':Number(_0x43bdd5[_0xdfc2('0x3e')]['ids']),'VoiceQueueId':Number(_0x43bdd5[_0xdfc2('0x51')]['id'])});}});}})[_0xdfc2('0x28')](function(_0x1f370c){return db['UserVoiceQueueRt'][_0xdfc2('0x29')]({'where':{'VoiceQueueId':_0x43bdd5[_0xdfc2('0x51')]['id'],'UserId':_0x43bdd5[_0xdfc2('0x3e')][_0xdfc2('0x8c')]}})[_0xdfc2('0x28')](function(){return _0x1f370c;});})[_0xdfc2('0x28')](respondWithStatusCode(_0x49682c,null))[_0xdfc2('0x4f')](handleError(_0x49682c,null));};exports[_0xdfc2('0x96')]=function(_0x400983,_0x39937f,_0x1249d6){var _0x2d3e9a={};var _0x3819e9={};var _0x31deaa;var _0x1e1616;return db[_0xdfc2('0x39')][_0xdfc2('0x61')]({'where':{'id':_0x400983['params']['id']}})[_0xdfc2('0x28')](handleEntityNotFound(_0x39937f,null))[_0xdfc2('0x28')](function(_0x5843fd){if(_0x5843fd){_0x31deaa=_0x5843fd;_0x3819e9['model']=_[_0xdfc2('0x3d')](db[_0xdfc2('0x6d')][_0xdfc2('0x3a')]);_0x3819e9[_0xdfc2('0x3e')]=_[_0xdfc2('0x3d')](_0x400983[_0xdfc2('0x3e')]);_0x3819e9[_0xdfc2('0x3f')]=_[_0xdfc2('0x40')](_0x3819e9[_0xdfc2('0x3c')],_0x3819e9[_0xdfc2('0x3e')]);_0x2d3e9a[_0xdfc2('0x41')]=_[_0xdfc2('0x40')](_0x3819e9[_0xdfc2('0x3c')],qs[_0xdfc2('0x42')](_0x400983[_0xdfc2('0x3e')][_0xdfc2('0x42')]));_0x2d3e9a[_0xdfc2('0x41')]=_0x2d3e9a['attributes']['length']?_0x2d3e9a[_0xdfc2('0x41')]:_0x3819e9[_0xdfc2('0x3c')];_0x2d3e9a[_0xdfc2('0x65')]=qs['sort'](_0x400983[_0xdfc2('0x3e')][_0xdfc2('0x46')]);_0x2d3e9a['where']=qs['filters'](_['pick'](_0x400983['query'],_0x3819e9[_0xdfc2('0x3f')]));if(_0x400983[_0xdfc2('0x3e')][_0xdfc2('0x2f')]){_0x2d3e9a[_0xdfc2('0x47')]=_[_0xdfc2('0x49')](_0x2d3e9a[_0xdfc2('0x47')],{'$or':_[_0xdfc2('0x30')](_0x2d3e9a['attributes'],function(_0x4459d2){var _0x37fd5b={};_0x37fd5b[_0x4459d2]={'$like':'%'+_0x400983[_0xdfc2('0x3e')][_0xdfc2('0x2f')]+'%'};return _0x37fd5b;})});}_0x2d3e9a=_['merge']({},_0x2d3e9a,_0x400983[_0xdfc2('0x4b')]);return _0x31deaa['getAgents'](_0x2d3e9a);}})['then'](function(_0x1fd5ca){if(_0x1fd5ca){_0x1e1616=_0x1fd5ca[_0xdfc2('0x43')];if(!_0x400983[_0xdfc2('0x3e')]['hasOwnProperty'](_0xdfc2('0x45'))){_0x2d3e9a[_0xdfc2('0x22')]=qs[_0xdfc2('0x22')](_0x400983[_0xdfc2('0x3e')]['limit']);_0x2d3e9a[_0xdfc2('0x20')]=qs[_0xdfc2('0x20')](_0x400983[_0xdfc2('0x3e')][_0xdfc2('0x20')]);}return _0x31deaa[_0xdfc2('0x96')](_0x2d3e9a);}})[_0xdfc2('0x28')](function(_0x19fc65){if(_0x19fc65){return _0x19fc65?{'count':_0x1e1616,'rows':_0x19fc65}:null;}})['then'](respondWithResult(_0x39937f,null))[_0xdfc2('0x4f')](handleError(_0x39937f,null));};exports[_0xdfc2('0x97')]=function(_0x25b86a,_0x46f326,_0x1ddf8a){var _0x98b2e0={};var _0x4ec88a={};var _0x7b8f13;var _0x1f55f3;return db[_0xdfc2('0x39')][_0xdfc2('0x61')]({'where':{'id':_0x25b86a[_0xdfc2('0x51')]['id']}})['then'](handleEntityNotFound(_0x46f326,null))[_0xdfc2('0x28')](function(_0x552921){if(_0x552921){_0x7b8f13=_0x552921;_0x4ec88a[_0xdfc2('0x3c')]=_['keys'](db[_0xdfc2('0x8e')][_0xdfc2('0x3a')]);_0x4ec88a[_0xdfc2('0x3e')]=_[_0xdfc2('0x3d')](_0x25b86a[_0xdfc2('0x3e')]);_0x4ec88a[_0xdfc2('0x3f')]=_[_0xdfc2('0x40')](_0x4ec88a[_0xdfc2('0x3c')],_0x4ec88a[_0xdfc2('0x3e')]);_0x98b2e0[_0xdfc2('0x41')]=_['intersection'](_0x4ec88a[_0xdfc2('0x3c')],qs[_0xdfc2('0x42')](_0x25b86a[_0xdfc2('0x3e')][_0xdfc2('0x42')]));_0x98b2e0[_0xdfc2('0x41')]=_0x98b2e0['attributes'][_0xdfc2('0x43')]?_0x98b2e0['attributes']:_0x4ec88a['model'];_0x98b2e0[_0xdfc2('0x65')]=qs['sort'](_0x25b86a[_0xdfc2('0x3e')][_0xdfc2('0x46')]);_0x98b2e0['where']=qs[_0xdfc2('0x3f')](_[_0xdfc2('0x48')](_0x25b86a[_0xdfc2('0x3e')],_0x4ec88a[_0xdfc2('0x3f')]));if(_0x25b86a[_0xdfc2('0x3e')]['filter']){_0x98b2e0[_0xdfc2('0x47')]=_[_0xdfc2('0x49')](_0x98b2e0['where'],{'$or':_[_0xdfc2('0x30')](_0x98b2e0[_0xdfc2('0x41')],function(_0x40384b){var _0x4aa6c9={};_0x4aa6c9[_0x40384b]={'$like':'%'+_0x25b86a[_0xdfc2('0x3e')][_0xdfc2('0x2f')]+'%'};return _0x4aa6c9;})});}_0x98b2e0=_['merge']({},_0x98b2e0,_0x25b86a['options']);return _0x7b8f13[_0xdfc2('0x97')](_0x98b2e0);}})[_0xdfc2('0x28')](function(_0x425f83){if(_0x425f83){_0x1f55f3=_0x425f83[_0xdfc2('0x43')];if(!_0x25b86a['query']['hasOwnProperty'](_0xdfc2('0x45'))){_0x98b2e0[_0xdfc2('0x22')]=qs[_0xdfc2('0x22')](_0x25b86a[_0xdfc2('0x3e')][_0xdfc2('0x22')]);_0x98b2e0['offset']=qs[_0xdfc2('0x20')](_0x25b86a[_0xdfc2('0x3e')][_0xdfc2('0x20')]);}return _0x7b8f13[_0xdfc2('0x97')](_0x98b2e0);}})['then'](function(_0x2465a4){return _0x2465a4?{'count':_0x1f55f3,'rows':_0x2465a4}:null;})[_0xdfc2('0x28')](respondWithResult(_0x46f326,null))[_0xdfc2('0x4f')](handleError(_0x46f326,null));};exports[_0xdfc2('0x98')]=function(_0x5b3c10,_0x1875e8,_0xd7c460){var _0x222fc7={};var _0x1b3e31={};var _0x58df74;var _0x444236;return db[_0xdfc2('0x39')][_0xdfc2('0x61')]({'where':{'id':_0x5b3c10['params']['id']}})[_0xdfc2('0x28')](handleEntityNotFound(_0x1875e8,null))[_0xdfc2('0x28')](function(_0x373f93){if(_0x373f93){_0x58df74=_0x373f93;_0x1b3e31[_0xdfc2('0x3c')]=_['keys'](db[_0xdfc2('0x99')][_0xdfc2('0x3a')]);_0x1b3e31[_0xdfc2('0x3e')]=_[_0xdfc2('0x3d')](_0x5b3c10[_0xdfc2('0x3e')]);_0x1b3e31[_0xdfc2('0x3f')]=_[_0xdfc2('0x40')](_0x1b3e31[_0xdfc2('0x3c')],_0x1b3e31[_0xdfc2('0x3e')]);_0x222fc7[_0xdfc2('0x41')]=_[_0xdfc2('0x40')](_0x1b3e31[_0xdfc2('0x3c')],qs['fields'](_0x5b3c10[_0xdfc2('0x3e')][_0xdfc2('0x42')]));_0x222fc7[_0xdfc2('0x41')]=_0x222fc7[_0xdfc2('0x41')][_0xdfc2('0x43')]?_0x222fc7[_0xdfc2('0x41')]:_0x1b3e31[_0xdfc2('0x3c')];_0x222fc7[_0xdfc2('0x65')]=qs[_0xdfc2('0x46')](_0x5b3c10['query'][_0xdfc2('0x46')]);_0x222fc7[_0xdfc2('0x47')]=qs['filters'](_['pick'](_0x5b3c10['query'],_0x1b3e31[_0xdfc2('0x3f')]));if(_0x5b3c10[_0xdfc2('0x3e')][_0xdfc2('0x2f')]){_0x222fc7['where']=_[_0xdfc2('0x49')](_0x222fc7[_0xdfc2('0x47')],{'$or':_['map'](_0x222fc7['attributes'],function(_0x2d79f8){var _0x43cf44={};_0x43cf44[_0x2d79f8]={'$like':'%'+_0x5b3c10[_0xdfc2('0x3e')][_0xdfc2('0x2f')]+'%'};return _0x43cf44;})});}_0x222fc7=_[_0xdfc2('0x49')]({},_0x222fc7,_0x5b3c10[_0xdfc2('0x4b')]);return _0x58df74[_0xdfc2('0x98')](_0x222fc7);}})['then'](function(_0xdb7d1b){if(_0xdb7d1b){_0x444236=_0xdb7d1b[_0xdfc2('0x43')];if(!_0x5b3c10[_0xdfc2('0x3e')][_0xdfc2('0x44')](_0xdfc2('0x45'))){_0x222fc7[_0xdfc2('0x22')]=qs[_0xdfc2('0x22')](_0x5b3c10[_0xdfc2('0x3e')][_0xdfc2('0x22')]);_0x222fc7[_0xdfc2('0x20')]=qs[_0xdfc2('0x20')](_0x5b3c10['query'][_0xdfc2('0x20')]);}return _0x58df74['getLists'](_0x222fc7);}})[_0xdfc2('0x28')](function(_0x187298){if(_0x187298){return _0x187298?{'count':_0x444236,'rows':_0x187298}:null;}})['then'](respondWithResult(_0x1875e8,null))[_0xdfc2('0x4f')](handleError(_0x1875e8,null));};exports[_0xdfc2('0x9a')]=function(_0x2e5030,_0x2b2c16,_0x5bc489){var _0x16004d,_0x4df2d5;return db[_0xdfc2('0x39')][_0xdfc2('0x52')]({'where':{'id':_0x2e5030['params']['id']}})[_0xdfc2('0x28')](handleEntityNotFound(_0x2b2c16,null))[_0xdfc2('0x28')](function(_0x430cf1){if(_0x430cf1){_0x4df2d5=_0x430cf1;return _0x430cf1[_0xdfc2('0x9a')](_0x2e5030[_0xdfc2('0x54')][_0xdfc2('0x8c')],_[_0xdfc2('0x5d')](_0x2e5030[_0xdfc2('0x54')],[_0xdfc2('0x8c'),'id'])||{});}return null;})[_0xdfc2('0x91')](function(_0x5c774d){var _0x256090;_0x16004d=_0x5c774d||[];var _0x1850cf=[];if(_0x5c774d){for(var _0x4bee36=0x0;_0x4bee36<_0x5c774d[_0xdfc2('0x43')];_0x4bee36+=0x1){var _0x3dce91=_0x5c774d[_0x4bee36][_0xdfc2('0x2a')]({'plain':!![]});_0x4df2d5[_0xdfc2('0x9b')]=_0x2e5030[_0xdfc2('0x54')]['dialCheckDuplicateType']?_0x2e5030['body'][_0xdfc2('0x9b')]:_0x4df2d5[_0xdfc2('0x9b')];switch(_0x4df2d5[_0xdfc2('0x9b')]){case _0xdfc2('0x9c'):_0x256090=squel[_0xdfc2('0x9d')]()[_0xdfc2('0x9e')](_0xdfc2('0x9f'))[_0xdfc2('0xa0')]([_0xdfc2('0xa1'),_0xdfc2('0xa2'),_0xdfc2('0xa3'),'ListId',_0xdfc2('0x66'),'createdAt',_0xdfc2('0x5f')],squel[_0xdfc2('0xa4')]()[_0xdfc2('0x7d')](_0xdfc2('0xa1'),_0xdfc2('0xa1'))[_0xdfc2('0x7d')](_0xdfc2('0xa5'),_0xdfc2('0xa2'))[_0xdfc2('0x7d')]('id','ContactId')[_0xdfc2('0x7d')](_0x3dce91['CmListId']['toString'](),'ListId')[_0xdfc2('0x7d')](_0x2e5030[_0xdfc2('0x51')]['id'][_0xdfc2('0xa6')](),'VoiceQueueId')[_0xdfc2('0x7d')](_0xdfc2('0xa5'),'createdAt')[_0xdfc2('0x7d')](_0xdfc2('0xa5'),_0xdfc2('0x5f'))[_0xdfc2('0x7f')]('cm_contacts')[_0xdfc2('0x47')](_0xdfc2('0xa7'))['where'](_0xdfc2('0xa8'),_0x3dce91[_0xdfc2('0xa9')]['toString']())[_0xdfc2('0x47')](_0xdfc2('0xaa'))[_0xdfc2('0x47')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xdfc2('0x7d')]('COALESCE(calleridnum,\x27\x27)')[_0xdfc2('0x7f')](_0xdfc2('0xab'))[_0xdfc2('0x47')](_0xdfc2('0xac'),_0x2e5030[_0xdfc2('0x51')]['id'][_0xdfc2('0xa6')]()))[_0xdfc2('0x47')](_0xdfc2('0xad'),squel[_0xdfc2('0xa4')]()['field']('COALESCE(phone,\x27\x27)')[_0xdfc2('0x7f')](_0xdfc2('0x9f'))[_0xdfc2('0x47')]('VoiceQueueId\x20=\x20?',_0x2e5030[_0xdfc2('0x51')]['id']['toString']())))[_0xdfc2('0xa6')]();break;case _0xdfc2('0xae'):_0x256090=squel['insert']()['into'](_0xdfc2('0x9f'))['fromQuery']([_0xdfc2('0xa1'),'scheduledAt',_0xdfc2('0xa3'),'ListId',_0xdfc2('0x66'),_0xdfc2('0x5e'),_0xdfc2('0x5f')],squel[_0xdfc2('0xa4')]()[_0xdfc2('0x7d')](_0xdfc2('0xa1'),_0xdfc2('0xa1'))[_0xdfc2('0x7d')]('NOW()',_0xdfc2('0xa2'))[_0xdfc2('0x7d')]('id',_0xdfc2('0xa3'))['field'](_0x3dce91[_0xdfc2('0xa9')][_0xdfc2('0xa6')](),_0xdfc2('0xaf'))[_0xdfc2('0x7d')](_0x2e5030[_0xdfc2('0x51')]['id'][_0xdfc2('0xa6')](),_0xdfc2('0x66'))[_0xdfc2('0x7d')](_0xdfc2('0xa5'),_0xdfc2('0x5e'))[_0xdfc2('0x7d')](_0xdfc2('0xa5'),'updatedAt')[_0xdfc2('0x7f')]('cm_contacts')[_0xdfc2('0x47')]('deletedAt\x20IS\x20NULL')[_0xdfc2('0x47')](_0xdfc2('0xa8'),_0x3dce91[_0xdfc2('0xa9')][_0xdfc2('0xa6')]())[_0xdfc2('0x47')](_0xdfc2('0xaa'))[_0xdfc2('0x47')](_0xdfc2('0xad'),squel[_0xdfc2('0xa4')]()[_0xdfc2('0x7d')]('COALESCE(phone,\x27\x27)')[_0xdfc2('0x7f')](_0xdfc2('0x9f'))[_0xdfc2('0x47')](_0xdfc2('0xac'),_0x2e5030['params']['id']['toString']())))['toString']();break;default:_0x256090=squel[_0xdfc2('0x9d')]()[_0xdfc2('0x9e')](_0xdfc2('0x9f'))[_0xdfc2('0xa0')]([_0xdfc2('0xa1'),_0xdfc2('0xa2'),_0xdfc2('0xa3'),'ListId',_0xdfc2('0x66'),'createdAt',_0xdfc2('0x5f')],squel[_0xdfc2('0xa4')]()[_0xdfc2('0x7d')](_0xdfc2('0xa1'),'phone')[_0xdfc2('0x7d')]('NOW()',_0xdfc2('0xa2'))[_0xdfc2('0x7d')]('id',_0xdfc2('0xa3'))['field'](_0x3dce91['CmListId'][_0xdfc2('0xa6')](),_0xdfc2('0xaf'))[_0xdfc2('0x7d')](_0x2e5030[_0xdfc2('0x51')]['id'][_0xdfc2('0xa6')](),_0xdfc2('0x66'))[_0xdfc2('0x7d')](_0xdfc2('0xa5'),_0xdfc2('0x5e'))[_0xdfc2('0x7d')](_0xdfc2('0xa5'),_0xdfc2('0x5f'))[_0xdfc2('0x7f')](_0xdfc2('0xb0'))[_0xdfc2('0x47')](_0xdfc2('0xa7'))[_0xdfc2('0x47')](_0xdfc2('0xa8'),_0x3dce91[_0xdfc2('0xa9')]['toString']())[_0xdfc2('0x47')](_0xdfc2('0xaa')))[_0xdfc2('0xa6')]();}_0x1850cf[_0xdfc2('0x84')](db[_0xdfc2('0x85')]['query'](_0x256090));}return BPromise[_0xdfc2('0x89')](_0x1850cf);}})[_0xdfc2('0x28')](function(){return _0x16004d;})['then'](respondWithResult(_0x2b2c16,null))['catch'](handleError(_0x2b2c16,null));};exports[_0xdfc2('0xb1')]=function(_0x4a874e,_0x422042,_0x3d2011){return db['VoiceQueue'][_0xdfc2('0x52')]({'where':{'id':_0x4a874e[_0xdfc2('0x51')]['id']}})[_0xdfc2('0x28')](handleEntityNotFound(_0x422042,null))[_0xdfc2('0x28')](function(_0x4e32f6){if(_0x4e32f6){return _0x4e32f6[_0xdfc2('0xb1')](_0x4a874e[_0xdfc2('0x3e')][_0xdfc2('0x8c')]);}})['then'](function(_0xeb1ef4){if(_0xeb1ef4){return db['CmHopper']['destroy']({'where':{'ListId':_0x4a874e[_0xdfc2('0x3e')][_0xdfc2('0x8c')],'VoiceQueueId':_0x4a874e[_0xdfc2('0x51')]['id']}})[_0xdfc2('0x28')](function(){return _0xeb1ef4;});}})['then'](respondWithStatusCode(_0x422042,null))[_0xdfc2('0x4f')](handleError(_0x422042,null));};exports[_0xdfc2('0xb2')]=function(_0x2be883,_0x1cad5e,_0x365dec){var _0x4a8c45={};var _0x45f10b={};var _0xb03722;var _0x397d4f;return db[_0xdfc2('0x39')][_0xdfc2('0x61')]({'where':{'id':_0x2be883[_0xdfc2('0x51')]['id']}})['then'](handleEntityNotFound(_0x1cad5e,null))[_0xdfc2('0x28')](function(_0x297461){if(_0x297461){_0xb03722=_0x297461;_0x45f10b[_0xdfc2('0x3c')]=_['keys'](db['CmList'][_0xdfc2('0x3a')]);_0x45f10b['query']=_['keys'](_0x2be883[_0xdfc2('0x3e')]);_0x45f10b['filters']=_[_0xdfc2('0x40')](_0x45f10b[_0xdfc2('0x3c')],_0x45f10b[_0xdfc2('0x3e')]);_0x4a8c45['attributes']=_[_0xdfc2('0x40')](_0x45f10b[_0xdfc2('0x3c')],qs[_0xdfc2('0x42')](_0x2be883[_0xdfc2('0x3e')][_0xdfc2('0x42')]));_0x4a8c45['attributes']=_0x4a8c45[_0xdfc2('0x41')]['length']?_0x4a8c45['attributes']:_0x45f10b['model'];_0x4a8c45[_0xdfc2('0x65')]=qs[_0xdfc2('0x46')](_0x2be883[_0xdfc2('0x3e')][_0xdfc2('0x46')]);_0x4a8c45[_0xdfc2('0x47')]=qs['filters'](_['pick'](_0x2be883[_0xdfc2('0x3e')],_0x45f10b[_0xdfc2('0x3f')]));if(_0x2be883[_0xdfc2('0x3e')][_0xdfc2('0x2f')]){_0x4a8c45[_0xdfc2('0x47')]=_[_0xdfc2('0x49')](_0x4a8c45[_0xdfc2('0x47')],{'$or':_[_0xdfc2('0x30')](_0x4a8c45['attributes'],function(_0xbe827e){var _0x384957={};_0x384957[_0xbe827e]={'$like':'%'+_0x2be883[_0xdfc2('0x3e')][_0xdfc2('0x2f')]+'%'};return _0x384957;})});}_0x4a8c45=_['merge']({},_0x4a8c45,_0x2be883[_0xdfc2('0x4b')]);return _0xb03722[_0xdfc2('0xb2')](_0x4a8c45);}})['then'](function(_0x175c5a){if(_0x175c5a){_0x397d4f=_0x175c5a[_0xdfc2('0x43')];if(!_0x2be883[_0xdfc2('0x3e')][_0xdfc2('0x44')](_0xdfc2('0x45'))){_0x4a8c45[_0xdfc2('0x22')]=qs[_0xdfc2('0x22')](_0x2be883['query'][_0xdfc2('0x22')]);_0x4a8c45[_0xdfc2('0x20')]=qs[_0xdfc2('0x20')](_0x2be883[_0xdfc2('0x3e')]['offset']);}return _0xb03722[_0xdfc2('0xb2')](_0x4a8c45);}})[_0xdfc2('0x28')](function(_0x4b42c4){if(_0x4b42c4){return _0x4b42c4?{'count':_0x397d4f,'rows':_0x4b42c4}:null;}})[_0xdfc2('0x28')](respondWithResult(_0x1cad5e,null))[_0xdfc2('0x4f')](handleError(_0x1cad5e,null));};exports[_0xdfc2('0xb3')]=function(_0x4db531,_0x37c04d,_0x16b706){var _0x26bb23,_0x5d1880;return db['VoiceQueue']['find']({'where':{'id':_0x4db531[_0xdfc2('0x51')]['id']}})[_0xdfc2('0x28')](handleEntityNotFound(_0x37c04d,null))[_0xdfc2('0x28')](function(_0x3d84a4){if(_0x3d84a4){_0x5d1880=_0x3d84a4;return _0x3d84a4[_0xdfc2('0xb3')](_0x4db531[_0xdfc2('0x54')]['ids'],_[_0xdfc2('0x5d')](_0x4db531[_0xdfc2('0x54')],[_0xdfc2('0x8c'),'id'])||{});}return null;})[_0xdfc2('0x91')](function(_0x138cfb){var _0xf34746;_0x26bb23=_0x138cfb||[];var _0x3e2f61=[];if(_0x138cfb){for(var _0x491215=0x0;_0x491215<_0x138cfb[_0xdfc2('0x43')];_0x491215+=0x1){var _0x234a39=_0x138cfb[_0x491215][_0xdfc2('0x2a')]({'plain':!![]});_0xf34746=squel[_0xdfc2('0x9d')]()[_0xdfc2('0x9e')](_0xdfc2('0xb4'))[_0xdfc2('0xa0')]([_0xdfc2('0xa1'),_0xdfc2('0xa3'),_0xdfc2('0xaf'),_0xdfc2('0x66'),_0xdfc2('0x5e'),_0xdfc2('0x5f')],squel[_0xdfc2('0xa4')]()[_0xdfc2('0x7d')]('phone','phone')['field']('id',_0xdfc2('0xa3'))[_0xdfc2('0x7d')](_0x234a39['CmListId'][_0xdfc2('0xa6')](),_0xdfc2('0xaf'))[_0xdfc2('0x7d')](_0x4db531['params']['id'][_0xdfc2('0xa6')](),_0xdfc2('0x66'))[_0xdfc2('0x7d')]('NOW()',_0xdfc2('0x5e'))['field'](_0xdfc2('0xa5'),_0xdfc2('0x5f'))['from']('cm_contacts')['where'](_0xdfc2('0xa7'))[_0xdfc2('0x47')](_0xdfc2('0xa8'),_0x234a39[_0xdfc2('0xa9')]['toString']())[_0xdfc2('0x47')]('phone\x20IS\x20NOT\x20NULL'))[_0xdfc2('0xa6')]();_0x3e2f61[_0xdfc2('0x84')](db[_0xdfc2('0x85')]['query'](_0xf34746));}return BPromise[_0xdfc2('0x89')](_0x3e2f61);}})['then'](function(){return _0x26bb23;})['then'](respondWithResult(_0x37c04d,null))[_0xdfc2('0x4f')](handleError(_0x37c04d,null));};exports['removeBlackLists']=function(_0x173170,_0x5313ba,_0x1a7002){return db[_0xdfc2('0x39')][_0xdfc2('0x52')]({'where':{'id':_0x173170['params']['id']}})[_0xdfc2('0x28')](handleEntityNotFound(_0x5313ba,null))[_0xdfc2('0x28')](function(_0x2cac89){if(_0x2cac89){return _0x2cac89[_0xdfc2('0xb5')](_0x173170[_0xdfc2('0x3e')][_0xdfc2('0x8c')]);}})[_0xdfc2('0x28')](function(_0x11db2f){if(_0x11db2f){return db[_0xdfc2('0x68')][_0xdfc2('0x29')]({'where':{'ListId':_0x173170[_0xdfc2('0x3e')][_0xdfc2('0x8c')],'VoiceQueueId':_0x173170['params']['id']}})['then'](function(){return _0x11db2f;});}})['then'](respondWithStatusCode(_0x5313ba,null))['catch'](handleError(_0x5313ba,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 6ba41e9..063dac2 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 _0x7206=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue'];(function(_0x565588,_0x21ca1f){var _0x23bba0=function(_0x2f2967){while(--_0x2f2967){_0x565588['push'](_0x565588['shift']());}};_0x23bba0(++_0x21ca1f);}(_0x7206,0x10b));var _0x6720=function(_0x5a1256,_0x1d166e){_0x5a1256=_0x5a1256-0x0;var _0x2b377f=_0x7206[_0x5a1256];return _0x2b377f;};'use strict';var EventEmitter=require(_0x6720('0x0'));var VoiceQueue=require(_0x6720('0x1'))['db'][_0x6720('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6720('0x3')](0x0);var events={'afterCreate':_0x6720('0x4'),'afterUpdate':_0x6720('0x5'),'afterDestroy':_0x6720('0x6')};function emitEvent(_0x132038){return function(_0x2b82dd,_0x1b8f06,_0x22a00e){VoiceQueueEvents[_0x6720('0x7')](_0x132038+':'+_0x2b82dd['id'],_0x2b82dd);VoiceQueueEvents[_0x6720('0x7')](_0x132038,_0x2b82dd);_0x22a00e(null);};}for(var e in events){if(events[_0x6720('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x6720('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xe273=['hook','exports','events','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe273,0x1e2));var _0x3e27=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0xe273[_0x2b9e8a];return _0x520e67;};'use strict';var EventEmitter=require(_0x3e27('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x3e27('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3e27('0x2')](0x0);var events={'afterCreate':_0x3e27('0x3'),'afterUpdate':_0x3e27('0x4'),'afterDestroy':_0x3e27('0x5')};function emitEvent(_0x44c616){return function(_0x250003,_0x1333b3,_0x3aa4b5){VoiceQueueEvents[_0x3e27('0x6')](_0x44c616+':'+_0x250003['id'],_0x250003);VoiceQueueEvents[_0x3e27('0x6')](_0x44c616,_0x250003);_0x3aa4b5(null);};}for(var e in events){if(events[_0x3e27('0x7')](e)){var event=events[e];VoiceQueue[_0x3e27('0x8')](e,emitEvent(event));}}module[_0x3e27('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 665c58d..3b723ff 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(_0x3070b6,_0x312ade){var _0x566a9b=function(_0x224c63){while(--_0x224c63){_0x3070b6['push'](_0x3070b6['shift']());}};_0x566a9b(++_0x312ade);}(_0x34e8,0x12c));var _0x834e=function(_0x3a07be,_0xab5afb){_0x3a07be=_0x3a07be-0x0;var _0x5034b0=_0x34e8[_0x3a07be];return _0x5034b0;};'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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x229066,_0x443063){var _0xd7c89=function(_0x8c80e6){while(--_0x8c80e6){_0x229066['push'](_0x229066['shift']());}};_0xd7c89(++_0x443063);}(_0x008c,0x188));var _0xc008=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x008c[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 1d216a1..6ecdf90 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 _0xb252=['request\x20sent','stringify','error','VoiceQueue,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueue','options','limit','map','include','model','attributes','then','ShowVoiceQueue','VoiceQueue','raw','where','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','request','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x13c88b,_0x34e5ba){var _0x196079=function(_0x2238c8){while(--_0x2238c8){_0x13c88b['push'](_0x13c88b['shift']());}};_0x196079(++_0x34e5ba);}(_0xb252,0x14d));var _0x2b25=function(_0x5b3939,_0x5044a0){_0x5b3939=_0x5b3939-0x0;var _0x466dcb=_0xb252[_0x5b3939];return _0x466dcb;};'use strict';var _=require(_0x2b25('0x0'));var util=require(_0x2b25('0x1'));var moment=require('moment');var BPromise=require(_0x2b25('0x2'));var rs=require(_0x2b25('0x3'));var fs=require('fs');var Redis=require(_0x2b25('0x4'));var db=require(_0x2b25('0x5'))['db'];var utils=require(_0x2b25('0x6'));var logger=require(_0x2b25('0x7'))(_0x2b25('0x8'));var config=require(_0x2b25('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2b25('0xa')][_0x2b25('0xb')]({'port':0x232a});config['redis']=_[_0x2b25('0xc')](config[_0x2b25('0xd')],{'host':_0x2b25('0xe'),'port':0x18eb});var socket=require(_0x2b25('0xf'))(new Redis(config[_0x2b25('0xd')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x21a190,_0x44c8c5,_0x257264){return new BPromise(function(_0x323b37,_0x3d5b5a){return client[_0x2b25('0x10')](_0x21a190,_0x257264)['then'](function(_0x2cd637){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x44c8c5,'request\x20sent');logger['debug'](_0x2b25('0x11'),_0x44c8c5,_0x2b25('0x12'),JSON[_0x2b25('0x13')](_0x2cd637));if(_0x2cd637['error']){if(_0x2cd637[_0x2b25('0x14')]['code']===0x1f4){logger[_0x2b25('0x14')](_0x2b25('0x15'),_0x44c8c5,_0x2cd637[_0x2b25('0x14')][_0x2b25('0x16')]);return _0x3d5b5a(_0x2cd637[_0x2b25('0x14')][_0x2b25('0x16')]);}logger[_0x2b25('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x44c8c5,_0x2cd637['error'][_0x2b25('0x16')]);return _0x323b37(_0x2cd637[_0x2b25('0x14')]['message']);}else{logger[_0x2b25('0x17')](_0x2b25('0x15'),_0x44c8c5,_0x2b25('0x12'));_0x323b37(_0x2cd637[_0x2b25('0x18')][_0x2b25('0x16')]);}})[_0x2b25('0x19')](function(_0x4f370e){logger[_0x2b25('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x44c8c5,_0x4f370e);_0x3d5b5a(_0x4f370e);});});}exports[_0x2b25('0x1a')]=function(_0xf2696c){var _0xe461d8=this;return new Promise(function(_0x5f101f,_0x450e6b){return db['VoiceQueue']['findAll']({'raw':_0xf2696c[_0x2b25('0x1b')]?_0xf2696c['options']['raw']===undefined?!![]:![]:!![],'where':_0xf2696c['options']?_0xf2696c['options']['where']||null:null,'attributes':_0xf2696c[_0x2b25('0x1b')]?_0xf2696c[_0x2b25('0x1b')]['attributes']||null:null,'limit':_0xf2696c['options']?_0xf2696c[_0x2b25('0x1b')][_0x2b25('0x1c')]||null:null,'include':_0xf2696c[_0x2b25('0x1b')]?_0xf2696c['options']['include']?_[_0x2b25('0x1d')](_0xf2696c[_0x2b25('0x1b')][_0x2b25('0x1e')],function(_0x380839){return{'model':db[_0x380839[_0x2b25('0x1f')]],'as':_0x380839['as'],'attributes':_0x380839['attributes'],'include':_0x380839[_0x2b25('0x1e')]?_[_0x2b25('0x1d')](_0x380839[_0x2b25('0x1e')],function(_0x471fab){return{'model':db[_0x471fab[_0x2b25('0x1f')]],'as':_0x471fab['as'],'attributes':_0x471fab[_0x2b25('0x20')],'include':_0x471fab[_0x2b25('0x1e')]?_[_0x2b25('0x1d')](_0x471fab['include'],function(_0x4c9fc6){return{'model':db[_0x4c9fc6['model']],'as':_0x4c9fc6['as'],'attributes':_0x4c9fc6[_0x2b25('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2b25('0x21')](function(_0x2e25f7){logger[_0x2b25('0x17')]('GetVoiceQueue',_0xf2696c);logger['debug'](_0x2b25('0x1a'),_0xf2696c,JSON['stringify'](_0x2e25f7));_0x5f101f(_0x2e25f7);})[_0x2b25('0x19')](function(_0x2dc0a1){logger[_0x2b25('0x14')](_0x2b25('0x1a'),_0x2dc0a1[_0x2b25('0x16')],_0xf2696c);_0x450e6b(_0xe461d8[_0x2b25('0x14')](0x1f4,_0x2dc0a1[_0x2b25('0x16')]));});});};exports[_0x2b25('0x22')]=function(_0x30bce0){var _0x2a6886=this;return new Promise(function(_0x12a302,_0x2dcf22){return db[_0x2b25('0x23')]['find']({'raw':_0x30bce0[_0x2b25('0x1b')]?_0x30bce0['options'][_0x2b25('0x24')]===undefined?!![]:![]:!![],'where':_0x30bce0[_0x2b25('0x1b')]?_0x30bce0[_0x2b25('0x1b')][_0x2b25('0x25')]||null:null,'attributes':_0x30bce0['options']?_0x30bce0[_0x2b25('0x1b')][_0x2b25('0x20')]||null:null,'include':_0x30bce0[_0x2b25('0x1b')]?_0x30bce0['options'][_0x2b25('0x1e')]?_['map'](_0x30bce0['options'][_0x2b25('0x1e')],function(_0x3d4bab){return{'model':db[_0x3d4bab[_0x2b25('0x1f')]],'as':_0x3d4bab['as'],'attributes':_0x3d4bab[_0x2b25('0x20')],'include':_0x3d4bab['include']?_[_0x2b25('0x1d')](_0x3d4bab[_0x2b25('0x1e')],function(_0x1e7ad8){return{'model':db[_0x1e7ad8['model']],'as':_0x1e7ad8['as'],'attributes':_0x1e7ad8[_0x2b25('0x20')],'include':_0x1e7ad8[_0x2b25('0x1e')]?_[_0x2b25('0x1d')](_0x1e7ad8[_0x2b25('0x1e')],function(_0x53eead){return{'model':db[_0x53eead['model']],'as':_0x53eead['as'],'attributes':_0x53eead[_0x2b25('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2b25('0x21')](function(_0x77ec57){logger[_0x2b25('0x17')](_0x2b25('0x22'),_0x30bce0);logger[_0x2b25('0x26')]('ShowVoiceQueue',_0x30bce0,JSON[_0x2b25('0x13')](_0x77ec57));_0x12a302(_0x77ec57);})[_0x2b25('0x19')](function(_0x3f7916){logger['error']('ShowVoiceQueue',_0x3f7916[_0x2b25('0x16')],_0x30bce0);_0x2dcf22(_0x2a6886[_0x2b25('0x14')](0x1f4,_0x3f7916[_0x2b25('0x16')]));});});}; \ No newline at end of file +var _0x2c48=['stringify','error','code','message','result','GetVoiceQueue','options','raw','where','attributes','limit','map','include','model','catch','VoiceQueue','find','ShowVoiceQueue','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x2c48,0x1b4));var _0x82c4=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0x2c48[_0x3d27a];return _0x314fd7;};'use strict';var _=require(_0x82c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x82c4('0x1'));var fs=require('fs');var Redis=require(_0x82c4('0x2'));var db=require(_0x82c4('0x3'))['db'];var utils=require(_0x82c4('0x4'));var logger=require(_0x82c4('0x5'))(_0x82c4('0x6'));var config=require(_0x82c4('0x7'));var jayson=require(_0x82c4('0x8'));var client=jayson[_0x82c4('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x82c4('0xa')],{'host':_0x82c4('0xb'),'port':0x18eb});var socket=require(_0x82c4('0xc'))(new Redis(config[_0x82c4('0xa')]));require('./voiceQueue.socket')[_0x82c4('0xd')](socket);function respondWithRpcPromise(_0xbb31fc,_0x5dcaef,_0x31412e){return new BPromise(function(_0x1cc119,_0x4b1632){return client['request'](_0xbb31fc,_0x31412e)[_0x82c4('0xe')](function(_0x49e9a0){logger[_0x82c4('0xf')](_0x82c4('0x10'),_0x5dcaef,'request\x20sent');logger[_0x82c4('0x11')](_0x82c4('0x12'),_0x5dcaef,_0x82c4('0x13'),JSON[_0x82c4('0x14')](_0x49e9a0));if(_0x49e9a0[_0x82c4('0x15')]){if(_0x49e9a0['error'][_0x82c4('0x16')]===0x1f4){logger['error'](_0x82c4('0x10'),_0x5dcaef,_0x49e9a0[_0x82c4('0x15')]['message']);return _0x4b1632(_0x49e9a0[_0x82c4('0x15')]['message']);}logger[_0x82c4('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x5dcaef,_0x49e9a0['error'][_0x82c4('0x17')]);return _0x1cc119(_0x49e9a0['error']['message']);}else{logger[_0x82c4('0xf')](_0x82c4('0x10'),_0x5dcaef,_0x82c4('0x13'));_0x1cc119(_0x49e9a0[_0x82c4('0x18')]['message']);}})['catch'](function(_0x5908ff){logger[_0x82c4('0x15')](_0x82c4('0x10'),_0x5dcaef,_0x5908ff);_0x4b1632(_0x5908ff);});});}exports[_0x82c4('0x19')]=function(_0x3bf29a){var _0x410f57=this;return new Promise(function(_0x48e8c9,_0x4df81d){return db['VoiceQueue']['findAll']({'raw':_0x3bf29a[_0x82c4('0x1a')]?_0x3bf29a['options'][_0x82c4('0x1b')]===undefined?!![]:![]:!![],'where':_0x3bf29a[_0x82c4('0x1a')]?_0x3bf29a[_0x82c4('0x1a')][_0x82c4('0x1c')]||null:null,'attributes':_0x3bf29a[_0x82c4('0x1a')]?_0x3bf29a[_0x82c4('0x1a')][_0x82c4('0x1d')]||null:null,'limit':_0x3bf29a[_0x82c4('0x1a')]?_0x3bf29a['options'][_0x82c4('0x1e')]||null:null,'include':_0x3bf29a['options']?_0x3bf29a[_0x82c4('0x1a')]['include']?_[_0x82c4('0x1f')](_0x3bf29a[_0x82c4('0x1a')]['include'],function(_0x4806ca){return{'model':db[_0x4806ca['model']],'as':_0x4806ca['as'],'attributes':_0x4806ca[_0x82c4('0x1d')],'include':_0x4806ca[_0x82c4('0x20')]?_['map'](_0x4806ca[_0x82c4('0x20')],function(_0x4bfc82){return{'model':db[_0x4bfc82[_0x82c4('0x21')]],'as':_0x4bfc82['as'],'attributes':_0x4bfc82[_0x82c4('0x1d')],'include':_0x4bfc82[_0x82c4('0x20')]?_[_0x82c4('0x1f')](_0x4bfc82[_0x82c4('0x20')],function(_0x44b8b2){return{'model':db[_0x44b8b2[_0x82c4('0x21')]],'as':_0x44b8b2['as'],'attributes':_0x44b8b2[_0x82c4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x82c4('0xe')](function(_0xa31a91){logger[_0x82c4('0xf')](_0x82c4('0x19'),_0x3bf29a);logger[_0x82c4('0x11')](_0x82c4('0x19'),_0x3bf29a,JSON[_0x82c4('0x14')](_0xa31a91));_0x48e8c9(_0xa31a91);})[_0x82c4('0x22')](function(_0xd6afce){logger[_0x82c4('0x15')](_0x82c4('0x19'),_0xd6afce['message'],_0x3bf29a);_0x4df81d(_0x410f57[_0x82c4('0x15')](0x1f4,_0xd6afce[_0x82c4('0x17')]));});});};exports['ShowVoiceQueue']=function(_0x35f4ff){var _0x4fdf43=this;return new Promise(function(_0x15c40c,_0x4c2a51){return db[_0x82c4('0x23')][_0x82c4('0x24')]({'raw':_0x35f4ff['options']?_0x35f4ff['options'][_0x82c4('0x1b')]===undefined?!![]:![]:!![],'where':_0x35f4ff[_0x82c4('0x1a')]?_0x35f4ff[_0x82c4('0x1a')][_0x82c4('0x1c')]||null:null,'attributes':_0x35f4ff[_0x82c4('0x1a')]?_0x35f4ff[_0x82c4('0x1a')]['attributes']||null:null,'include':_0x35f4ff['options']?_0x35f4ff[_0x82c4('0x1a')][_0x82c4('0x20')]?_[_0x82c4('0x1f')](_0x35f4ff[_0x82c4('0x1a')][_0x82c4('0x20')],function(_0x291261){return{'model':db[_0x291261[_0x82c4('0x21')]],'as':_0x291261['as'],'attributes':_0x291261[_0x82c4('0x1d')],'include':_0x291261[_0x82c4('0x20')]?_[_0x82c4('0x1f')](_0x291261['include'],function(_0x268760){return{'model':db[_0x268760[_0x82c4('0x21')]],'as':_0x268760['as'],'attributes':_0x268760[_0x82c4('0x1d')],'include':_0x268760['include']?_[_0x82c4('0x1f')](_0x268760[_0x82c4('0x20')],function(_0x214fa5){return{'model':db[_0x214fa5[_0x82c4('0x21')]],'as':_0x214fa5['as'],'attributes':_0x214fa5[_0x82c4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x82c4('0xe')](function(_0x4a05b3){logger[_0x82c4('0xf')](_0x82c4('0x25'),_0x35f4ff);logger[_0x82c4('0x11')](_0x82c4('0x25'),_0x35f4ff,JSON[_0x82c4('0x14')](_0x4a05b3));_0x15c40c(_0x4a05b3);})[_0x82c4('0x22')](function(_0x36d4eb){logger['error']('ShowVoiceQueue',_0x36d4eb[_0x82c4('0x17')],_0x35f4ff);_0x4c2a51(_0x4fdf43[_0x82c4('0x15')](0x1f4,_0x36d4eb[_0x82c4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index b1713db..0a07517 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 _0xf59c=['voiceQueue:','./voiceQueue.events','save','remove','update','emit','register','length'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0xf59c,0x189));var _0xcf59=function(_0x335c99,_0xe6066b){_0x335c99=_0x335c99-0x0;var _0x42df13=_0xf59c[_0x335c99];return _0x42df13;};'use strict';var VoiceQueueEvents=require(_0xcf59('0x0'));var events=[_0xcf59('0x1'),_0xcf59('0x2'),_0xcf59('0x3')];function createListener(_0x575fd6,_0x5eaa05){return function(_0x17cbf2){_0x5eaa05[_0xcf59('0x4')](_0x575fd6,_0x17cbf2);};}function removeListener(_0x5342de,_0x7af672){return function(){VoiceQueueEvents['removeListener'](_0x5342de,_0x7af672);};}exports[_0xcf59('0x5')]=function(_0x98d231){for(var _0x20c855=0x0,_0x1c7bc3=events[_0xcf59('0x6')];_0x20c855<_0x1c7bc3;_0x20c855++){var _0x3a57f4=events[_0x20c855];var _0x1ce929=createListener(_0xcf59('0x7')+_0x3a57f4,_0x98d231);VoiceQueueEvents['on'](_0x3a57f4,_0x1ce929);}}; \ No newline at end of file +var _0xd1a7=['remove','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x56766c,_0x57397b){var _0x225590=function(_0x1320ea){while(--_0x1320ea){_0x56766c['push'](_0x56766c['shift']());}};_0x225590(++_0x57397b);}(_0xd1a7,0xf1));var _0x7d1a=function(_0x1d881b,_0x104b66){_0x1d881b=_0x1d881b-0x0;var _0x15bfad=_0xd1a7[_0x1d881b];return _0x15bfad;};'use strict';var VoiceQueueEvents=require(_0x7d1a('0x0'));var events=[_0x7d1a('0x1'),_0x7d1a('0x2'),_0x7d1a('0x3')];function createListener(_0x397e3e,_0x5c407b){return function(_0xa2dd8b){_0x5c407b[_0x7d1a('0x4')](_0x397e3e,_0xa2dd8b);};}function removeListener(_0x371932,_0x2e8248){return function(){VoiceQueueEvents[_0x7d1a('0x5')](_0x371932,_0x2e8248);};}exports[_0x7d1a('0x6')]=function(_0x19c11b){for(var _0x1e01c0=0x0,_0x54c6a3=events[_0x7d1a('0x7')];_0x1e01c0<_0x54c6a3;_0x1e01c0++){var _0x3091d4=events[_0x1e01c0];var _0x4716c6=createListener(_0x7d1a('0x8')+_0x3091d4,_0x19c11b);VoiceQueueEvents['on'](_0x3091d4,_0x4716c6);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 1b372ad..784136c 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 _0x60b9=['/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x60b9,0x1ee));var _0x960b=function(_0x40f4c0,_0x4f9604){_0x40f4c0=_0x40f4c0-0x0;var _0x4df43e=_0x60b9[_0x40f4c0];return _0x4df43e;};'use strict';var multer=require('multer');var util=require(_0x960b('0x0'));var path=require(_0x960b('0x1'));var timeout=require(_0x960b('0x2'));var express=require(_0x960b('0x3'));var router=express[_0x960b('0x4')]();var fs_extra=require(_0x960b('0x5'));var auth=require(_0x960b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x960b('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x960b('0x8')]('/',auth[_0x960b('0x9')](),controller['index']);router['get'](_0x960b('0xa'),auth['isAuthenticated'](),controller[_0x960b('0xb')]);router['get'](_0x960b('0xc'),auth['isAuthenticated'](),controller[_0x960b('0xd')]);router[_0x960b('0x8')](_0x960b('0xe'),auth[_0x960b('0x9')](),controller[_0x960b('0xf')]);router[_0x960b('0x10')]('/',auth[_0x960b('0x9')](),controller['create']);router[_0x960b('0x11')](_0x960b('0xe'),auth[_0x960b('0x9')](),controller[_0x960b('0x12')]);router[_0x960b('0x13')](_0x960b('0xe'),auth[_0x960b('0x9')](),controller[_0x960b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8555=['describe','/index','show','post','create','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x11ccf5,_0x79ec95){var _0x105d66=function(_0x3a5423){while(--_0x3a5423){_0x11ccf5['push'](_0x11ccf5['shift']());}};_0x105d66(++_0x79ec95);}(_0x8555,0x96));var _0x5855=function(_0x229838,_0xc3107e){_0x229838=_0x229838-0x0;var _0x292ef3=_0x8555[_0x229838];return _0x292ef3;};'use strict';var multer=require(_0x5855('0x0'));var util=require('util');var path=require(_0x5855('0x1'));var timeout=require('connect-timeout');var express=require(_0x5855('0x2'));var router=express[_0x5855('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5855('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5855('0x5'));var controller=require('./voiceQueueReport.controller');router[_0x5855('0x6')]('/',auth['isAuthenticated'](),controller[_0x5855('0x7')]);router['get'](_0x5855('0x8'),auth[_0x5855('0x9')](),controller[_0x5855('0xa')]);router[_0x5855('0x6')](_0x5855('0xb'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x5855('0x6')]('/:id',auth[_0x5855('0x9')](),controller[_0x5855('0xc')]);router[_0x5855('0xd')]('/',auth[_0x5855('0x9')](),controller[_0x5855('0xe')]);router['put'](_0x5855('0xf'),auth['isAuthenticated'](),controller[_0x5855('0x10')]);router[_0x5855('0x11')](_0x5855('0xf'),auth[_0x5855('0x9')](),controller[_0x5855('0x12')]);module[_0x5855('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index c9f5f80..718eef5 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 _0xfeec=['setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xfeec,0x1b7));var _0xcfee=function(_0x49999b,_0x2c660c){_0x49999b=_0x49999b-0x0;var _0x33d3cb=_0xfeec[_0x49999b];return _0x33d3cb;};'use strict';var Sequelize=require(_0xcfee('0x0'));var moment=require(_0xcfee('0x1'));module[_0xcfee('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xcfee('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xcfee('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xcfee('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x4ecb64){var _0x3e7478=moment(_0x4ecb64);var _0x3606aa=moment(this[_0xcfee('0x5')]('queuecallerjoinAt'))[_0xcfee('0x6')](_0xcfee('0x7'));var _0x36e605=_0x3e7478[_0xcfee('0x8')](_0x3606aa,'seconds');this[_0xcfee('0x9')]('queuecallerleaveAt',_0x4ecb64);this[_0xcfee('0x9')]('holdtime',_0x36e605||null);}},'position':{'type':Sequelize[_0xcfee('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xcfee('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xcfee('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xcfee('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xcfee('0xc')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xcfee('0x3')]},'connectedlinename':{'type':Sequelize[_0xcfee('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xcfee('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xcfee('0x3')]},'holdtime':{'type':Sequelize[_0xcfee('0xa')]},'mohtime':{'type':Sequelize[_0xcfee('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcfee('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xcfee('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xcfee('0x3')],'comment':_0xcfee('0xd')},'transferexten':{'type':Sequelize[_0xcfee('0x3')]},'transferuniqueid':{'type':Sequelize[_0xcfee('0x3')]},'disposition':{'type':Sequelize[_0xcfee('0x3')]},'secondDisposition':{'type':Sequelize[_0xcfee('0x3')]},'thirdDisposition':{'type':Sequelize[_0xcfee('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa088=['seconds','setDataValue','INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x33f88e,_0x5df3a2){var _0x1fa1fe=function(_0xedfbba){while(--_0xedfbba){_0x33f88e['push'](_0x33f88e['shift']());}};_0x1fa1fe(++_0x5df3a2);}(_0xa088,0x1e8));var _0x8a08=function(_0x1f9662,_0xaccc55){_0x1f9662=_0x1f9662-0x0;var _0x480ad0=_0xa088[_0x1f9662];return _0x480ad0;};'use strict';var Sequelize=require(_0x8a08('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x8a08('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8a08('0x1')]},'queue':{'type':Sequelize[_0x8a08('0x1')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x475656){var _0x19a2c9=moment(_0x475656);var _0x194375=moment(this[_0x8a08('0x2')](_0x8a08('0x3')))['format'](_0x8a08('0x4'));var _0xbe4a68=_0x19a2c9[_0x8a08('0x5')](_0x194375,_0x8a08('0x6'));this['setDataValue']('queuecallerleaveAt',_0x475656);this[_0x8a08('0x7')]('holdtime',_0xbe4a68||null);}},'position':{'type':Sequelize[_0x8a08('0x8')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x8a08('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x8a08('0xa')]},'queuecallerexit':{'type':Sequelize[_0x8a08('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x8a08('0xa')]},'queuecallerexitreason':{'type':Sequelize[_0x8a08('0x1')],'comment':_0x8a08('0xb')},'originalposition':{'type':Sequelize[_0x8a08('0x8')]},'channel':{'type':Sequelize[_0x8a08('0x1')]},'connectedlinenum':{'type':Sequelize[_0x8a08('0x1')]},'connectedlinename':{'type':Sequelize[_0x8a08('0x1')]},'accountcode':{'type':Sequelize[_0x8a08('0x1')]},'context':{'type':Sequelize[_0x8a08('0x1')]},'exten':{'type':Sequelize[_0x8a08('0x1')]},'priority':{'type':Sequelize[_0x8a08('0x1')]},'holdtime':{'type':Sequelize[_0x8a08('0x8')]},'mohtime':{'type':Sequelize[_0x8a08('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8a08('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x8a08('0x1')]},'transfer':{'type':Sequelize[_0x8a08('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x8a08('0xc')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x8a08('0x1')]},'secondDisposition':{'type':Sequelize[_0x8a08('0x1')]},'thirdDisposition':{'type':Sequelize[_0x8a08('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x8a08('0x8')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index ccbb954..278ab91 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 _0xbbfd=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','name','index','map','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','VoiceQueueReport','includeAll','include','findAll','catch','show','params','create','body','find','describe','nolimit','rows','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xbbfd,0x184));var _0xdbbf=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xbbfd[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0xdbbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdbbf('0x1'));var jsonpatch=require(_0xdbbf('0x2'));var rp=require(_0xdbbf('0x3'));var moment=require(_0xdbbf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbbf('0x5'));var util=require(_0xdbbf('0x6'));var path=require('path');var sox=require(_0xdbbf('0x7'));var csv=require(_0xdbbf('0x8'));var ejs=require(_0xdbbf('0x9'));var fs=require('fs');var fs_extra=require(_0xdbbf('0xa'));var _=require(_0xdbbf('0xb'));var squel=require(_0xdbbf('0xc'));var crypto=require(_0xdbbf('0xd'));var jsforce=require(_0xdbbf('0xe'));var deskjs=require(_0xdbbf('0xf'));var toCsv=require(_0xdbbf('0x8'));var querystring=require('querystring');var Papa=require(_0xdbbf('0x10'));var Redis=require(_0xdbbf('0x11'));var authService=require(_0xdbbf('0x12'));var qs=require(_0xdbbf('0x13'));var as=require(_0xdbbf('0x14'));var hardwareService=require(_0xdbbf('0x15'));var logger=require(_0xdbbf('0x16'))(_0xdbbf('0x17'));var utils=require(_0xdbbf('0x18'));var config=require(_0xdbbf('0x19'));var licenseUtil=require(_0xdbbf('0x1a'));var db=require(_0xdbbf('0x1b'))['db'];config['redis']=_['defaults'](config[_0xdbbf('0x1c')],{'host':_0xdbbf('0x1d'),'port':0x18eb});var socket=require(_0xdbbf('0x1e'))(new Redis(config[_0xdbbf('0x1c')]));require(_0xdbbf('0x1f'))[_0xdbbf('0x20')](socket);function respondWithStatusCode(_0x272820,_0xfd2411){_0xfd2411=_0xfd2411||0xcc;return function(_0x56de41){if(_0x56de41){return _0x272820[_0xdbbf('0x21')](_0xfd2411);}return _0x272820[_0xdbbf('0x22')](_0xfd2411)[_0xdbbf('0x23')]();};}function respondWithResult(_0x5b4477,_0x11c884){_0x11c884=_0x11c884||0xc8;return function(_0x31f5e1){if(_0x31f5e1){return _0x5b4477['status'](_0x11c884)['json'](_0x31f5e1);}};}function respondWithFilteredResult(_0x308586,_0x34fa8d){return function(_0x342b0e){if(_0x342b0e){var _0x41ea9a=typeof _0x34fa8d[_0xdbbf('0x24')]===_0xdbbf('0x25')&&typeof _0x34fa8d[_0xdbbf('0x26')]===_0xdbbf('0x25');var _0xf1b4db=_0x342b0e[_0xdbbf('0x27')];var _0x58cdbb=_0x41ea9a?0x0:_0x34fa8d['offset'];var _0x38c5a4=_0x41ea9a?_0x342b0e[_0xdbbf('0x27')]:_0x34fa8d[_0xdbbf('0x24')]+_0x34fa8d[_0xdbbf('0x26')];var _0x2e7614;if(_0x38c5a4>=_0xf1b4db){_0x38c5a4=_0xf1b4db;_0x2e7614=0xc8;}else{_0x2e7614=0xce;}_0x308586[_0xdbbf('0x22')](_0x2e7614);return _0x308586['set'](_0xdbbf('0x28'),_0x58cdbb+'-'+_0x38c5a4+'/'+_0xf1b4db)['json'](_0x342b0e);}return null;};}function patchUpdates(_0x4d7242){return function(_0x2c66cb){try{jsonpatch[_0xdbbf('0x29')](_0x2c66cb,_0x4d7242,!![]);}catch(_0x3d8ea2){return BPromise['reject'](_0x3d8ea2);}return _0x2c66cb['save']();};}function saveUpdates(_0x23f3a5,_0x4c19cc){return function(_0x41d8c0){if(_0x41d8c0){return _0x41d8c0[_0xdbbf('0x2a')](_0x23f3a5)[_0xdbbf('0x2b')](function(_0x5c4829){return _0x5c4829;});}return null;};}function removeEntity(_0x1d103b,_0x2e1309){return function(_0x483bcc){if(_0x483bcc){return _0x483bcc[_0xdbbf('0x2c')]()[_0xdbbf('0x2b')](function(){_0x1d103b['status'](0xcc)[_0xdbbf('0x23')]();});}};}function handleEntityNotFound(_0x416eca,_0x299e33){return function(_0x46ea11){if(!_0x46ea11){_0x416eca['sendStatus'](0x194);}return _0x46ea11;};}function handleError(_0x25dba0,_0x1f269f){_0x1f269f=_0x1f269f||0x1f4;return function(_0x5e9501){logger[_0xdbbf('0x2d')](_0x5e9501['stack']);if(_0x5e9501[_0xdbbf('0x2e')]){delete _0x5e9501[_0xdbbf('0x2e')];}_0x25dba0[_0xdbbf('0x22')](_0x1f269f)['send'](_0x5e9501);};}exports[_0xdbbf('0x2f')]=function(_0x4e369e,_0x169a76){var _0x3c2592={},_0x2c0957={},_0x3e90d3={'count':0x0,'rows':[]};var _0xe9de9f=_[_0xdbbf('0x30')](db['VoiceQueueReport'][_0xdbbf('0x31')],function(_0x540017){return{'name':_0x540017['fieldName'],'type':_0x540017[_0xdbbf('0x32')][_0xdbbf('0x33')]};});_0x2c0957[_0xdbbf('0x34')]=_[_0xdbbf('0x30')](_0xe9de9f,_0xdbbf('0x2e'));_0x2c0957['query']=_[_0xdbbf('0x35')](_0x4e369e['query']);_0x2c0957[_0xdbbf('0x36')]=_[_0xdbbf('0x37')](_0x2c0957['model'],_0x2c0957[_0xdbbf('0x38')]);_0x3c2592[_0xdbbf('0x39')]=_['intersection'](_0x2c0957[_0xdbbf('0x34')],qs[_0xdbbf('0x3a')](_0x4e369e['query'][_0xdbbf('0x3a')]));_0x3c2592[_0xdbbf('0x39')]=_0x3c2592[_0xdbbf('0x39')][_0xdbbf('0x3b')]?_0x3c2592[_0xdbbf('0x39')]:_0x2c0957['model'];if(!_0x4e369e[_0xdbbf('0x38')][_0xdbbf('0x3c')]('nolimit')){_0x3c2592[_0xdbbf('0x26')]=qs[_0xdbbf('0x26')](_0x4e369e['query']['limit']);_0x3c2592[_0xdbbf('0x24')]=qs[_0xdbbf('0x24')](_0x4e369e[_0xdbbf('0x38')]['offset']);}_0x3c2592[_0xdbbf('0x3d')]=qs[_0xdbbf('0x3e')](_0x4e369e[_0xdbbf('0x38')][_0xdbbf('0x3e')]);_0x3c2592[_0xdbbf('0x3f')]=qs[_0xdbbf('0x36')](_[_0xdbbf('0x40')](_0x4e369e[_0xdbbf('0x38')],_0x2c0957[_0xdbbf('0x36')]),_0xe9de9f);if(_0x4e369e[_0xdbbf('0x38')][_0xdbbf('0x41')]){_0x3c2592['where']=_[_0xdbbf('0x42')](_0x3c2592['where'],{'$or':_[_0xdbbf('0x30')](_0xe9de9f,function(_0x1623d2){if(_0x1623d2['type']!=='VIRTUAL'){var _0x14c3ad={};_0x14c3ad[_0x1623d2[_0xdbbf('0x2e')]]={'$like':'%'+_0x4e369e[_0xdbbf('0x38')][_0xdbbf('0x41')]+'%'};return _0x14c3ad;}})});}_0x3c2592=_[_0xdbbf('0x42')]({},_0x3c2592,_0x4e369e[_0xdbbf('0x43')]);var _0x58bae3={'where':_0x3c2592[_0xdbbf('0x3f')]};return db[_0xdbbf('0x44')]['count'](_0x58bae3)[_0xdbbf('0x2b')](function(_0x28ffc0){_0x3e90d3['count']=_0x28ffc0;if(_0x4e369e[_0xdbbf('0x38')][_0xdbbf('0x45')]){_0x3c2592[_0xdbbf('0x46')]=[{'all':!![]}];}return db[_0xdbbf('0x44')][_0xdbbf('0x47')](_0x3c2592);})['then'](function(_0x3348f0){_0x3e90d3['rows']=_0x3348f0;return _0x3e90d3;})[_0xdbbf('0x2b')](respondWithFilteredResult(_0x169a76,_0x3c2592))[_0xdbbf('0x48')](handleError(_0x169a76,null));};exports[_0xdbbf('0x49')]=function(_0x2242a4,_0x31037c){var _0x41e3eb={'raw':![],'where':{'id':_0x2242a4[_0xdbbf('0x4a')]['id']}},_0x4ea8a1={};_0x4ea8a1['model']=_[_0xdbbf('0x35')](db[_0xdbbf('0x44')][_0xdbbf('0x31')]);_0x4ea8a1[_0xdbbf('0x38')]=_['keys'](_0x2242a4[_0xdbbf('0x38')]);_0x4ea8a1[_0xdbbf('0x36')]=_[_0xdbbf('0x37')](_0x4ea8a1[_0xdbbf('0x34')],_0x4ea8a1[_0xdbbf('0x38')]);_0x41e3eb[_0xdbbf('0x39')]=_['intersection'](_0x4ea8a1['model'],qs['fields'](_0x2242a4['query'][_0xdbbf('0x3a')]));_0x41e3eb[_0xdbbf('0x39')]=_0x41e3eb[_0xdbbf('0x39')]['length']?_0x41e3eb[_0xdbbf('0x39')]:_0x4ea8a1[_0xdbbf('0x34')];if(_0x2242a4[_0xdbbf('0x38')][_0xdbbf('0x45')]){_0x41e3eb[_0xdbbf('0x46')]=[{'all':!![]}];}_0x41e3eb=_[_0xdbbf('0x42')]({},_0x41e3eb,_0x2242a4['options']);return db[_0xdbbf('0x44')]['find'](_0x41e3eb)['then'](handleEntityNotFound(_0x31037c,null))[_0xdbbf('0x2b')](respondWithResult(_0x31037c,null))[_0xdbbf('0x48')](handleError(_0x31037c,null));};exports['create']=function(_0xd714ac,_0x5df211){return db[_0xdbbf('0x44')][_0xdbbf('0x4b')](_0xd714ac[_0xdbbf('0x4c')],{})['then'](respondWithResult(_0x5df211,0xc9))[_0xdbbf('0x48')](handleError(_0x5df211,null));};exports[_0xdbbf('0x2a')]=function(_0x286582,_0x4eecfe){if(_0x286582['body']['id']){delete _0x286582['body']['id'];}return db[_0xdbbf('0x44')][_0xdbbf('0x4d')]({'where':{'id':_0x286582[_0xdbbf('0x4a')]['id']}})[_0xdbbf('0x2b')](handleEntityNotFound(_0x4eecfe,null))[_0xdbbf('0x2b')](saveUpdates(_0x286582[_0xdbbf('0x4c')],null))[_0xdbbf('0x2b')](respondWithResult(_0x4eecfe,null))[_0xdbbf('0x48')](handleError(_0x4eecfe,null));};exports[_0xdbbf('0x2c')]=function(_0x40380c,_0x2db736){return db['VoiceQueueReport']['find']({'where':{'id':_0x40380c[_0xdbbf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2db736,null))[_0xdbbf('0x2b')](removeEntity(_0x2db736,null))[_0xdbbf('0x48')](handleError(_0x2db736,null));};exports[_0xdbbf('0x4e')]=function(_0xb8cf9b,_0x83aabf){return db[_0xdbbf('0x44')][_0xdbbf('0x4e')]()[_0xdbbf('0x2b')](respondWithResult(_0x83aabf,null))['catch'](handleError(_0x83aabf,null));};exports['getVoiceQueuesReport']=function(_0x4f89ed,_0x3a9e19){var _0x29ec29={},_0x43bcb3={},_0x36e562={'count':0x0,'rows':[]};_0x43bcb3[_0xdbbf('0x34')]=_[_0xdbbf('0x35')](db['VoiceQueueReport'][_0xdbbf('0x31')]);_0x43bcb3[_0xdbbf('0x38')]=_[_0xdbbf('0x35')](_0x4f89ed[_0xdbbf('0x38')]);_0x43bcb3[_0xdbbf('0x36')]=_['intersection'](_0x43bcb3['model'],_0x43bcb3[_0xdbbf('0x38')]);_0x29ec29[_0xdbbf('0x39')]=_[_0xdbbf('0x37')](_0x43bcb3[_0xdbbf('0x34')],qs[_0xdbbf('0x3a')](_0x4f89ed[_0xdbbf('0x38')][_0xdbbf('0x3a')]));_0x29ec29[_0xdbbf('0x39')]=_0x29ec29[_0xdbbf('0x39')][_0xdbbf('0x3b')]?_0x29ec29[_0xdbbf('0x39')]:_0x43bcb3[_0xdbbf('0x34')];if(!_0x4f89ed[_0xdbbf('0x38')][_0xdbbf('0x3c')](_0xdbbf('0x4f'))){_0x29ec29[_0xdbbf('0x26')]=qs[_0xdbbf('0x26')](_0x4f89ed[_0xdbbf('0x38')]['limit']);_0x29ec29[_0xdbbf('0x24')]=qs[_0xdbbf('0x24')](_0x4f89ed[_0xdbbf('0x38')][_0xdbbf('0x24')]);}_0x29ec29[_0xdbbf('0x3d')]=qs[_0xdbbf('0x3e')](_0x4f89ed[_0xdbbf('0x38')][_0xdbbf('0x3e')]);_0x29ec29[_0xdbbf('0x3f')]=qs['filters'](_['pick'](_0x4f89ed[_0xdbbf('0x38')],_0x43bcb3[_0xdbbf('0x36')]));if(_0x4f89ed[_0xdbbf('0x38')][_0xdbbf('0x41')]){_0x29ec29[_0xdbbf('0x3f')]=_[_0xdbbf('0x42')](_0x29ec29[_0xdbbf('0x3f')],{'$or':_[_0xdbbf('0x30')](_0x29ec29[_0xdbbf('0x39')],function(_0x2c9d90){var _0x27b977={};_0x27b977[_0x2c9d90]={'$like':'%'+_0x4f89ed[_0xdbbf('0x38')]['filter']+'%'};return _0x27b977;})});}_0x29ec29=_[_0xdbbf('0x42')]({},_0x29ec29,_0x4f89ed[_0xdbbf('0x43')]);var _0x4f3f34={'where':_0x29ec29[_0xdbbf('0x3f')]};return db['VoiceQueueReport'][_0xdbbf('0x27')](_0x4f3f34)[_0xdbbf('0x2b')](function(_0x2b1ad3){_0x36e562[_0xdbbf('0x27')]=_0x2b1ad3;if(_0x4f89ed[_0xdbbf('0x38')][_0xdbbf('0x45')]){_0x29ec29[_0xdbbf('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xdbbf('0x47')](_0x29ec29);})[_0xdbbf('0x2b')](function(_0x3cfe0b){_0x36e562[_0xdbbf('0x50')]=_0x3cfe0b;return _0x36e562;})['then'](respondWithFilteredResult(_0x3a9e19,_0x29ec29,_0xdbbf('0x51')))[_0xdbbf('0x48')](handleError(_0x3a9e19,null,_0xdbbf('0x51')));}; \ No newline at end of file +var _0x0b8a=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','merge','where','filter','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','destroy','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir'];(function(_0x3ea6ba,_0x17f5dd){var _0x920fab=function(_0x146ff2){while(--_0x146ff2){_0x3ea6ba['push'](_0x3ea6ba['shift']());}};_0x920fab(++_0x17f5dd);}(_0x0b8a,0x9f));var _0xa0b8=function(_0x5ab3b5,_0x828533){_0x5ab3b5=_0x5ab3b5-0x0;var _0xc13606=_0x0b8a[_0x5ab3b5];return _0xc13606;};'use strict';var emlformat=require(_0xa0b8('0x0'));var rimraf=require(_0xa0b8('0x1'));var zipdir=require(_0xa0b8('0x2'));var jsonpatch=require(_0xa0b8('0x3'));var rp=require(_0xa0b8('0x4'));var moment=require(_0xa0b8('0x5'));var BPromise=require(_0xa0b8('0x6'));var Mustache=require(_0xa0b8('0x7'));var util=require(_0xa0b8('0x8'));var path=require(_0xa0b8('0x9'));var sox=require(_0xa0b8('0xa'));var csv=require(_0xa0b8('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0b8('0xc'));var _=require(_0xa0b8('0xd'));var squel=require('squel');var crypto=require(_0xa0b8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa0b8('0xf'));var toCsv=require(_0xa0b8('0xb'));var querystring=require(_0xa0b8('0x10'));var Papa=require(_0xa0b8('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa0b8('0x12'));var as=require(_0xa0b8('0x13'));var hardwareService=require(_0xa0b8('0x14'));var logger=require(_0xa0b8('0x15'))('api');var utils=require(_0xa0b8('0x16'));var config=require(_0xa0b8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa0b8('0x18')]=_[_0xa0b8('0x19')](config[_0xa0b8('0x18')],{'host':_0xa0b8('0x1a'),'port':0x18eb});var socket=require(_0xa0b8('0x1b'))(new Redis(config[_0xa0b8('0x18')]));require(_0xa0b8('0x1c'))[_0xa0b8('0x1d')](socket);function respondWithStatusCode(_0x1e9584,_0x232098){_0x232098=_0x232098||0xcc;return function(_0x2b9e78){if(_0x2b9e78){return _0x1e9584[_0xa0b8('0x1e')](_0x232098);}return _0x1e9584[_0xa0b8('0x1f')](_0x232098)[_0xa0b8('0x20')]();};}function respondWithResult(_0x41d289,_0x5b1eb6){_0x5b1eb6=_0x5b1eb6||0xc8;return function(_0x1bb20b){if(_0x1bb20b){return _0x41d289[_0xa0b8('0x1f')](_0x5b1eb6)['json'](_0x1bb20b);}};}function respondWithFilteredResult(_0x1b0913,_0x413f33){return function(_0x15227a){if(_0x15227a){var _0x282a92=typeof _0x413f33[_0xa0b8('0x21')]===_0xa0b8('0x22')&&typeof _0x413f33[_0xa0b8('0x23')]===_0xa0b8('0x22');var _0x97929=_0x15227a['count'];var _0x2e8375=_0x282a92?0x0:_0x413f33[_0xa0b8('0x21')];var _0x5181f0=_0x282a92?_0x15227a[_0xa0b8('0x24')]:_0x413f33[_0xa0b8('0x21')]+_0x413f33['limit'];var _0x33fb82;if(_0x5181f0>=_0x97929){_0x5181f0=_0x97929;_0x33fb82=0xc8;}else{_0x33fb82=0xce;}_0x1b0913[_0xa0b8('0x1f')](_0x33fb82);return _0x1b0913['set'](_0xa0b8('0x25'),_0x2e8375+'-'+_0x5181f0+'/'+_0x97929)[_0xa0b8('0x26')](_0x15227a);}return null;};}function patchUpdates(_0x147f02){return function(_0x2a0f54){try{jsonpatch[_0xa0b8('0x27')](_0x2a0f54,_0x147f02,!![]);}catch(_0x195d55){return BPromise['reject'](_0x195d55);}return _0x2a0f54[_0xa0b8('0x28')]();};}function saveUpdates(_0x3ddf19,_0x136c14){return function(_0x48c9f2){if(_0x48c9f2){return _0x48c9f2[_0xa0b8('0x29')](_0x3ddf19)[_0xa0b8('0x2a')](function(_0x3dc680){return _0x3dc680;});}return null;};}function removeEntity(_0x1b09cd,_0x228228){return function(_0xd8dc88){if(_0xd8dc88){return _0xd8dc88['destroy']()[_0xa0b8('0x2a')](function(){_0x1b09cd[_0xa0b8('0x1f')](0xcc)[_0xa0b8('0x20')]();});}};}function handleEntityNotFound(_0x2e8f44,_0x20715b){return function(_0x3cf935){if(!_0x3cf935){_0x2e8f44[_0xa0b8('0x1e')](0x194);}return _0x3cf935;};}function handleError(_0x27eb73,_0x2ad230){_0x2ad230=_0x2ad230||0x1f4;return function(_0x443e0a){logger['error'](_0x443e0a[_0xa0b8('0x2b')]);if(_0x443e0a[_0xa0b8('0x2c')]){delete _0x443e0a[_0xa0b8('0x2c')];}_0x27eb73['status'](_0x2ad230)['send'](_0x443e0a);};}exports[_0xa0b8('0x2d')]=function(_0x1d65bf,_0x517b71){var _0xbe47f5={},_0x55b886={},_0x244149={'count':0x0,'rows':[]};var _0x10dbbb=_[_0xa0b8('0x2e')](db[_0xa0b8('0x2f')][_0xa0b8('0x30')],function(_0x164a3a){return{'name':_0x164a3a[_0xa0b8('0x31')],'type':_0x164a3a[_0xa0b8('0x32')][_0xa0b8('0x33')]};});_0x55b886[_0xa0b8('0x34')]=_[_0xa0b8('0x2e')](_0x10dbbb,_0xa0b8('0x2c'));_0x55b886[_0xa0b8('0x35')]=_[_0xa0b8('0x36')](_0x1d65bf[_0xa0b8('0x35')]);_0x55b886['filters']=_[_0xa0b8('0x37')](_0x55b886[_0xa0b8('0x34')],_0x55b886[_0xa0b8('0x35')]);_0xbe47f5[_0xa0b8('0x38')]=_[_0xa0b8('0x37')](_0x55b886[_0xa0b8('0x34')],qs[_0xa0b8('0x39')](_0x1d65bf[_0xa0b8('0x35')][_0xa0b8('0x39')]));_0xbe47f5['attributes']=_0xbe47f5[_0xa0b8('0x38')][_0xa0b8('0x3a')]?_0xbe47f5[_0xa0b8('0x38')]:_0x55b886[_0xa0b8('0x34')];if(!_0x1d65bf[_0xa0b8('0x35')]['hasOwnProperty'](_0xa0b8('0x3b'))){_0xbe47f5['limit']=qs[_0xa0b8('0x23')](_0x1d65bf[_0xa0b8('0x35')][_0xa0b8('0x23')]);_0xbe47f5['offset']=qs['offset'](_0x1d65bf[_0xa0b8('0x35')][_0xa0b8('0x21')]);}_0xbe47f5[_0xa0b8('0x3c')]=qs[_0xa0b8('0x3d')](_0x1d65bf['query'][_0xa0b8('0x3d')]);_0xbe47f5['where']=qs[_0xa0b8('0x3e')](_[_0xa0b8('0x3f')](_0x1d65bf[_0xa0b8('0x35')],_0x55b886[_0xa0b8('0x3e')]),_0x10dbbb);if(_0x1d65bf[_0xa0b8('0x35')]['filter']){_0xbe47f5['where']=_[_0xa0b8('0x40')](_0xbe47f5[_0xa0b8('0x41')],{'$or':_[_0xa0b8('0x2e')](_0x10dbbb,function(_0x1e1f28){if(_0x1e1f28['type']!=='VIRTUAL'){var _0x28e1da={};_0x28e1da[_0x1e1f28[_0xa0b8('0x2c')]]={'$like':'%'+_0x1d65bf[_0xa0b8('0x35')][_0xa0b8('0x42')]+'%'};return _0x28e1da;}})});}_0xbe47f5=_[_0xa0b8('0x40')]({},_0xbe47f5,_0x1d65bf['options']);var _0xc6c82b={'where':_0xbe47f5[_0xa0b8('0x41')]};return db['VoiceQueueReport'][_0xa0b8('0x24')](_0xc6c82b)['then'](function(_0x4ba3b1){_0x244149['count']=_0x4ba3b1;if(_0x1d65bf[_0xa0b8('0x35')][_0xa0b8('0x43')]){_0xbe47f5['include']=[{'all':!![]}];}return db[_0xa0b8('0x2f')][_0xa0b8('0x44')](_0xbe47f5);})[_0xa0b8('0x2a')](function(_0x22222d){_0x244149[_0xa0b8('0x45')]=_0x22222d;return _0x244149;})['then'](respondWithFilteredResult(_0x517b71,_0xbe47f5))[_0xa0b8('0x46')](handleError(_0x517b71,null));};exports[_0xa0b8('0x47')]=function(_0x4e0cdb,_0x2498ba){var _0xc4cfa5={'raw':![],'where':{'id':_0x4e0cdb[_0xa0b8('0x48')]['id']}},_0x39cc9b={};_0x39cc9b[_0xa0b8('0x34')]=_[_0xa0b8('0x36')](db['VoiceQueueReport']['rawAttributes']);_0x39cc9b[_0xa0b8('0x35')]=_[_0xa0b8('0x36')](_0x4e0cdb[_0xa0b8('0x35')]);_0x39cc9b[_0xa0b8('0x3e')]=_['intersection'](_0x39cc9b['model'],_0x39cc9b[_0xa0b8('0x35')]);_0xc4cfa5[_0xa0b8('0x38')]=_[_0xa0b8('0x37')](_0x39cc9b[_0xa0b8('0x34')],qs[_0xa0b8('0x39')](_0x4e0cdb[_0xa0b8('0x35')][_0xa0b8('0x39')]));_0xc4cfa5[_0xa0b8('0x38')]=_0xc4cfa5[_0xa0b8('0x38')][_0xa0b8('0x3a')]?_0xc4cfa5['attributes']:_0x39cc9b['model'];if(_0x4e0cdb['query'][_0xa0b8('0x43')]){_0xc4cfa5[_0xa0b8('0x49')]=[{'all':!![]}];}_0xc4cfa5=_[_0xa0b8('0x40')]({},_0xc4cfa5,_0x4e0cdb[_0xa0b8('0x4a')]);return db[_0xa0b8('0x2f')][_0xa0b8('0x4b')](_0xc4cfa5)['then'](handleEntityNotFound(_0x2498ba,null))[_0xa0b8('0x2a')](respondWithResult(_0x2498ba,null))[_0xa0b8('0x46')](handleError(_0x2498ba,null));};exports['create']=function(_0x2eac94,_0x3192fa){return db['VoiceQueueReport'][_0xa0b8('0x4c')](_0x2eac94['body'],{})[_0xa0b8('0x2a')](respondWithResult(_0x3192fa,0xc9))['catch'](handleError(_0x3192fa,null));};exports['update']=function(_0x1a9389,_0x5e2ff5){if(_0x1a9389[_0xa0b8('0x4d')]['id']){delete _0x1a9389[_0xa0b8('0x4d')]['id'];}return db[_0xa0b8('0x2f')][_0xa0b8('0x4b')]({'where':{'id':_0x1a9389['params']['id']}})[_0xa0b8('0x2a')](handleEntityNotFound(_0x5e2ff5,null))[_0xa0b8('0x2a')](saveUpdates(_0x1a9389[_0xa0b8('0x4d')],null))[_0xa0b8('0x2a')](respondWithResult(_0x5e2ff5,null))[_0xa0b8('0x46')](handleError(_0x5e2ff5,null));};exports[_0xa0b8('0x4e')]=function(_0x5cbb4a,_0x5f3903){return db[_0xa0b8('0x2f')][_0xa0b8('0x4b')]({'where':{'id':_0x5cbb4a[_0xa0b8('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f3903,null))[_0xa0b8('0x2a')](removeEntity(_0x5f3903,null))[_0xa0b8('0x46')](handleError(_0x5f3903,null));};exports[_0xa0b8('0x4f')]=function(_0x35b290,_0x2121ce){return db[_0xa0b8('0x2f')]['describe']()[_0xa0b8('0x2a')](respondWithResult(_0x2121ce,null))['catch'](handleError(_0x2121ce,null));};exports[_0xa0b8('0x50')]=function(_0x41f3cc,_0x33553b){var _0x100924={},_0x2e461f={},_0xf4bd38={'count':0x0,'rows':[]};_0x2e461f['model']=_[_0xa0b8('0x36')](db[_0xa0b8('0x2f')][_0xa0b8('0x30')]);_0x2e461f['query']=_[_0xa0b8('0x36')](_0x41f3cc[_0xa0b8('0x35')]);_0x2e461f['filters']=_[_0xa0b8('0x37')](_0x2e461f[_0xa0b8('0x34')],_0x2e461f[_0xa0b8('0x35')]);_0x100924[_0xa0b8('0x38')]=_[_0xa0b8('0x37')](_0x2e461f[_0xa0b8('0x34')],qs[_0xa0b8('0x39')](_0x41f3cc[_0xa0b8('0x35')]['fields']));_0x100924['attributes']=_0x100924['attributes'][_0xa0b8('0x3a')]?_0x100924[_0xa0b8('0x38')]:_0x2e461f[_0xa0b8('0x34')];if(!_0x41f3cc['query']['hasOwnProperty'](_0xa0b8('0x3b'))){_0x100924[_0xa0b8('0x23')]=qs[_0xa0b8('0x23')](_0x41f3cc['query'][_0xa0b8('0x23')]);_0x100924[_0xa0b8('0x21')]=qs[_0xa0b8('0x21')](_0x41f3cc[_0xa0b8('0x35')][_0xa0b8('0x21')]);}_0x100924['order']=qs[_0xa0b8('0x3d')](_0x41f3cc['query'][_0xa0b8('0x3d')]);_0x100924[_0xa0b8('0x41')]=qs['filters'](_[_0xa0b8('0x3f')](_0x41f3cc[_0xa0b8('0x35')],_0x2e461f['filters']));if(_0x41f3cc[_0xa0b8('0x35')][_0xa0b8('0x42')]){_0x100924[_0xa0b8('0x41')]=_[_0xa0b8('0x40')](_0x100924[_0xa0b8('0x41')],{'$or':_[_0xa0b8('0x2e')](_0x100924[_0xa0b8('0x38')],function(_0x23e488){var _0x2a71fb={};_0x2a71fb[_0x23e488]={'$like':'%'+_0x41f3cc[_0xa0b8('0x35')][_0xa0b8('0x42')]+'%'};return _0x2a71fb;})});}_0x100924=_['merge']({},_0x100924,_0x41f3cc['options']);var _0x1fbb06={'where':_0x100924[_0xa0b8('0x41')]};return db[_0xa0b8('0x2f')][_0xa0b8('0x24')](_0x1fbb06)[_0xa0b8('0x2a')](function(_0x40bdfd){_0xf4bd38['count']=_0x40bdfd;if(_0x41f3cc['query'][_0xa0b8('0x43')]){_0x100924[_0xa0b8('0x49')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x100924);})[_0xa0b8('0x2a')](function(_0x1e903c){_0xf4bd38[_0xa0b8('0x45')]=_0x1e903c;return _0xf4bd38;})[_0xa0b8('0x2a')](respondWithFilteredResult(_0x33553b,_0x100924,_0xa0b8('0x50')))['catch'](handleError(_0x33553b,null,_0xa0b8('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 3004d41..42858b7 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 _0x04cc=['remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update'];(function(_0x565c4e,_0x1e77f9){var _0x4a167f=function(_0x537269){while(--_0x537269){_0x565c4e['push'](_0x565c4e['shift']());}};_0x4a167f(++_0x1e77f9);}(_0x04cc,0xe5));var _0xc04c=function(_0x457bc6,_0x431adc){_0x457bc6=_0x457bc6-0x0;var _0x337f06=_0x04cc[_0x457bc6];return _0x337f06;};'use strict';var EventEmitter=require(_0xc04c('0x0'));var VoiceQueueReport=require(_0xc04c('0x1'))['db'][_0xc04c('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc04c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc04c('0x4'),'afterDestroy':_0xc04c('0x5')};function emitEvent(_0x55a55a){return function(_0x4d567f,_0x51105a,_0x2fe1be){VoiceQueueReportEvents['emit'](_0x55a55a+':'+_0x4d567f['id'],_0x4d567f);VoiceQueueReportEvents[_0xc04c('0x6')](_0x55a55a,_0x4d567f);_0x2fe1be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xc04c('0x7')](e,emitEvent(event));}}module[_0xc04c('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x587f=['emit','hasOwnProperty','hook','../../mysqldb','VoiceQueueReport','save','update','remove'];(function(_0x1edffc,_0xb87918){var _0x21c950=function(_0x261e3d){while(--_0x261e3d){_0x1edffc['push'](_0x1edffc['shift']());}};_0x21c950(++_0xb87918);}(_0x587f,0x153));var _0xf587=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0x587f[_0x2f227c];return _0x5032bc;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xf587('0x0'))['db'][_0xf587('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf587('0x2'),'afterUpdate':_0xf587('0x3'),'afterDestroy':_0xf587('0x4')};function emitEvent(_0x304e23){return function(_0xf420d8,_0x183ba8,_0x5cc6ac){VoiceQueueReportEvents[_0xf587('0x5')](_0x304e23+':'+_0xf420d8['id'],_0xf420d8);VoiceQueueReportEvents[_0xf587('0x5')](_0x304e23,_0xf420d8);_0x5cc6ac(null);};}for(var e in events){if(events[_0xf587('0x6')](e)){var event=events[e];VoiceQueueReport[_0xf587('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index f2d1bc1..4efa3d5 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 _0x55b9=['request-promise','rimraf','exports','report_queue','calleridnum','lodash','util','api','moment','bluebird'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x55b9,0x69));var _0x955b=function(_0x2f76ae,_0x36b482){_0x2f76ae=_0x2f76ae-0x0;var _0xf0923f=_0x55b9[_0x2f76ae];return _0xf0923f;};'use strict';var _=require(_0x955b('0x0'));var util=require(_0x955b('0x1'));var logger=require('../../config/logger')(_0x955b('0x2'));var moment=require(_0x955b('0x3'));var BPromise=require(_0x955b('0x4'));var rp=require(_0x955b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x955b('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0x955b('0x7')]=function(_0x133976,_0x2e1e09){return _0x133976['define']('VoiceQueueReport',attributes,{'tableName':_0x955b('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x955b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4cf1=['../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','calleridnum','util','api','bluebird','request-promise','path','rimraf'];(function(_0x5f523a,_0xc5f615){var _0x53360f=function(_0x4c8d0f){while(--_0x4c8d0f){_0x5f523a['push'](_0x5f523a['shift']());}};_0x53360f(++_0xc5f615);}(_0x4cf1,0x1c8));var _0x14cf=function(_0xa8f776,_0x420cbf){_0xa8f776=_0xa8f776-0x0;var _0x435961=_0x4cf1[_0xa8f776];return _0x435961;};'use strict';var _=require('lodash');var util=require(_0x14cf('0x0'));var logger=require('../../config/logger')(_0x14cf('0x1'));var moment=require('moment');var BPromise=require(_0x14cf('0x2'));var rp=require(_0x14cf('0x3'));var fs=require('fs');var path=require(_0x14cf('0x4'));var rimraf=require(_0x14cf('0x5'));var config=require(_0x14cf('0x6'));var attributes=require(_0x14cf('0x7'));module[_0x14cf('0x8')]=function(_0x2aef0c,_0x58fd8f){return _0x2aef0c['define'](_0x14cf('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x14cf('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index ff1ad64..6722d2b 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 _0x34b3=['GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceQueueReport','VoiceQueueReport','create','UpdateVoiceQueueReport','update','body','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','then','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info','catch'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x34b3,0x193));var _0x334b=function(_0xa8d663,_0xe89864){_0xa8d663=_0xa8d663-0x0;var _0x53bfb7=_0x34b3[_0xa8d663];return _0x53bfb7;};'use strict';var _=require(_0x334b('0x0'));var util=require(_0x334b('0x1'));var moment=require(_0x334b('0x2'));var BPromise=require('bluebird');var rs=require(_0x334b('0x3'));var fs=require('fs');var Redis=require(_0x334b('0x4'));var db=require(_0x334b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x334b('0x6'))('rpc');var config=require(_0x334b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x334b('0x8')][_0x334b('0x9')]({'port':0x232a});config[_0x334b('0xa')]=_[_0x334b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x334b('0xc'))(new Redis(config[_0x334b('0xa')]));require(_0x334b('0xd'))[_0x334b('0xe')](socket);function respondWithRpcPromise(_0x521c33,_0x20c1ee,_0xc55072){return new BPromise(function(_0x488728,_0x28b9c6){return client[_0x334b('0xf')](_0x521c33,_0xc55072)[_0x334b('0x10')](function(_0x151878){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x20c1ee,_0x334b('0x11'));logger[_0x334b('0x12')](_0x334b('0x13'),_0x20c1ee,_0x334b('0x11'),JSON[_0x334b('0x14')](_0x151878));if(_0x151878[_0x334b('0x15')]){if(_0x151878[_0x334b('0x15')][_0x334b('0x16')]===0x1f4){logger['error'](_0x334b('0x17'),_0x20c1ee,_0x151878[_0x334b('0x15')][_0x334b('0x18')]);return _0x28b9c6(_0x151878[_0x334b('0x15')][_0x334b('0x18')]);}logger['error'](_0x334b('0x17'),_0x20c1ee,_0x151878[_0x334b('0x15')][_0x334b('0x18')]);return _0x488728(_0x151878[_0x334b('0x15')][_0x334b('0x18')]);}else{logger[_0x334b('0x19')](_0x334b('0x17'),_0x20c1ee,'request\x20sent');_0x488728(_0x151878['result'][_0x334b('0x18')]);}})[_0x334b('0x1a')](function(_0x113971){logger[_0x334b('0x15')](_0x334b('0x17'),_0x20c1ee,_0x113971);_0x28b9c6(_0x113971);});});}exports[_0x334b('0x1b')]=function(_0xad74c4){var _0x4fa3ac=this;return new Promise(function(_0x179889,_0x546623){return db['VoiceQueueReport'][_0x334b('0x1c')]({'raw':_0xad74c4[_0x334b('0x1d')]?_0xad74c4[_0x334b('0x1d')][_0x334b('0x1e')]===undefined?!![]:![]:!![],'where':_0xad74c4[_0x334b('0x1d')]?_0xad74c4[_0x334b('0x1d')][_0x334b('0x1f')]||null:null,'attributes':_0xad74c4[_0x334b('0x1d')]?_0xad74c4[_0x334b('0x1d')][_0x334b('0x20')]||null:null,'limit':_0xad74c4[_0x334b('0x1d')]?_0xad74c4[_0x334b('0x1d')][_0x334b('0x21')]||null:null,'include':_0xad74c4[_0x334b('0x1d')]?_0xad74c4[_0x334b('0x1d')][_0x334b('0x22')]?_[_0x334b('0x23')](_0xad74c4['options'][_0x334b('0x22')],function(_0x352955){return{'model':db[_0x352955[_0x334b('0x24')]],'as':_0x352955['as'],'attributes':_0x352955[_0x334b('0x20')],'include':_0x352955[_0x334b('0x22')]?_[_0x334b('0x23')](_0x352955[_0x334b('0x22')],function(_0x2a9756){return{'model':db[_0x2a9756[_0x334b('0x24')]],'as':_0x2a9756['as'],'attributes':_0x2a9756['attributes'],'include':_0x2a9756[_0x334b('0x22')]?_[_0x334b('0x23')](_0x2a9756['include'],function(_0x4cd6b3){return{'model':db[_0x4cd6b3[_0x334b('0x24')]],'as':_0x4cd6b3['as'],'attributes':_0x4cd6b3[_0x334b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x334b('0x10')](function(_0x431f47){logger[_0x334b('0x19')]('GetVoiceQueueReport',_0xad74c4);logger['debug']('GetVoiceQueueReport',_0xad74c4,JSON[_0x334b('0x14')](_0x431f47));_0x179889(_0x431f47);})[_0x334b('0x1a')](function(_0x2c5d7c){logger[_0x334b('0x15')]('GetVoiceQueueReport',_0x2c5d7c[_0x334b('0x18')],_0xad74c4);_0x546623(_0x4fa3ac[_0x334b('0x15')](0x1f4,_0x2c5d7c[_0x334b('0x18')]));});});};exports[_0x334b('0x25')]=function(_0x4f811b){var _0x128f19=this;return new Promise(function(_0x5c93ce,_0x214813){return db[_0x334b('0x26')][_0x334b('0x27')](_0x4f811b['body'],{'raw':_0x4f811b[_0x334b('0x1d')]?_0x4f811b[_0x334b('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x334b('0x10')](function(_0x1d4614){logger[_0x334b('0x19')]('CreateVoiceQueueReport',_0x4f811b);logger['debug'](_0x334b('0x25'),_0x4f811b,JSON[_0x334b('0x14')](_0x1d4614));_0x5c93ce(_0x1d4614);})[_0x334b('0x1a')](function(_0x1cb274){logger[_0x334b('0x15')]('CreateVoiceQueueReport',_0x1cb274['message'],_0x4f811b);_0x214813(_0x128f19[_0x334b('0x15')](0x1f4,_0x1cb274['message']));});});};exports[_0x334b('0x28')]=function(_0x4b1eb5){var _0x1330a4=this;return new Promise(function(_0x11ac3f,_0x28ff5a){return db[_0x334b('0x26')][_0x334b('0x29')](_0x4b1eb5[_0x334b('0x2a')],{'raw':_0x4b1eb5[_0x334b('0x1d')]?_0x4b1eb5[_0x334b('0x1d')][_0x334b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1eb5[_0x334b('0x1d')]?_0x4b1eb5[_0x334b('0x1d')][_0x334b('0x1f')]||null:null,'attributes':_0x4b1eb5[_0x334b('0x1d')]?_0x4b1eb5[_0x334b('0x1d')]['attributes']||null:null,'limit':_0x4b1eb5[_0x334b('0x1d')]?_0x4b1eb5[_0x334b('0x1d')][_0x334b('0x21')]||null:null})[_0x334b('0x10')](function(_0xda03d8){logger[_0x334b('0x19')](_0x334b('0x28'),_0x4b1eb5);logger[_0x334b('0x12')](_0x334b('0x28'),_0x4b1eb5,JSON[_0x334b('0x14')](_0xda03d8));_0x11ac3f(_0xda03d8);})[_0x334b('0x1a')](function(_0x8fdaf){logger[_0x334b('0x15')](_0x334b('0x28'),_0x8fdaf[_0x334b('0x18')],_0x4b1eb5);_0x28ff5a(_0x1330a4['error'](0x1f4,_0x8fdaf[_0x334b('0x18')]));});});}; \ No newline at end of file +var _0x2acb=['redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','stringify','code','error','message','VoiceQueueReport,\x20%s,\x20%s','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','debug','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x35be45,_0x1fa73a){var _0x5c6db0=function(_0x18fcb1){while(--_0x18fcb1){_0x35be45['push'](_0x35be45['shift']());}};_0x5c6db0(++_0x1fa73a);}(_0x2acb,0x1e3));var _0xb2ac=function(_0x2e65bb,_0xed53f6){_0x2e65bb=_0x2e65bb-0x0;var _0x229b39=_0x2acb[_0x2e65bb];return _0x229b39;};'use strict';var _=require(_0xb2ac('0x0'));var util=require(_0xb2ac('0x1'));var moment=require(_0xb2ac('0x2'));var BPromise=require(_0xb2ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2ac('0x4'));var db=require(_0xb2ac('0x5'))['db'];var utils=require(_0xb2ac('0x6'));var logger=require(_0xb2ac('0x7'))(_0xb2ac('0x8'));var config=require(_0xb2ac('0x9'));var jayson=require(_0xb2ac('0xa'));var client=jayson['client'][_0xb2ac('0xb')]({'port':0x232a});config[_0xb2ac('0xc')]=_[_0xb2ac('0xd')](config[_0xb2ac('0xc')],{'host':_0xb2ac('0xe'),'port':0x18eb});var socket=require(_0xb2ac('0xf'))(new Redis(config[_0xb2ac('0xc')]));require(_0xb2ac('0x10'))[_0xb2ac('0x11')](socket);function respondWithRpcPromise(_0x31398d,_0x1289ba,_0x5e5932){return new BPromise(function(_0x3f4009,_0x4c2b6a){return client[_0xb2ac('0x12')](_0x31398d,_0x5e5932)[_0xb2ac('0x13')](function(_0x127b2b){logger[_0xb2ac('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x1289ba,_0xb2ac('0x15'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1289ba,'request\x20sent',JSON[_0xb2ac('0x16')](_0x127b2b));if(_0x127b2b['error']){if(_0x127b2b['error'][_0xb2ac('0x17')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x1289ba,_0x127b2b[_0xb2ac('0x18')]['message']);return _0x4c2b6a(_0x127b2b['error'][_0xb2ac('0x19')]);}logger[_0xb2ac('0x18')](_0xb2ac('0x1a'),_0x1289ba,_0x127b2b['error'][_0xb2ac('0x19')]);return _0x3f4009(_0x127b2b[_0xb2ac('0x18')][_0xb2ac('0x19')]);}else{logger[_0xb2ac('0x14')](_0xb2ac('0x1a'),_0x1289ba,_0xb2ac('0x15'));_0x3f4009(_0x127b2b[_0xb2ac('0x1b')][_0xb2ac('0x19')]);}})[_0xb2ac('0x1c')](function(_0x251a7e){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x1289ba,_0x251a7e);_0x4c2b6a(_0x251a7e);});});}exports[_0xb2ac('0x1d')]=function(_0x4de579){var _0x17dcb2=this;return new Promise(function(_0x1f0fd3,_0x47aa12){return db[_0xb2ac('0x1e')][_0xb2ac('0x1f')]({'raw':_0x4de579['options']?_0x4de579[_0xb2ac('0x20')][_0xb2ac('0x21')]===undefined?!![]:![]:!![],'where':_0x4de579['options']?_0x4de579['options'][_0xb2ac('0x22')]||null:null,'attributes':_0x4de579[_0xb2ac('0x20')]?_0x4de579[_0xb2ac('0x20')][_0xb2ac('0x23')]||null:null,'limit':_0x4de579[_0xb2ac('0x20')]?_0x4de579[_0xb2ac('0x20')]['limit']||null:null,'include':_0x4de579[_0xb2ac('0x20')]?_0x4de579['options'][_0xb2ac('0x24')]?_[_0xb2ac('0x25')](_0x4de579['options'][_0xb2ac('0x24')],function(_0x125243){return{'model':db[_0x125243['model']],'as':_0x125243['as'],'attributes':_0x125243['attributes'],'include':_0x125243[_0xb2ac('0x24')]?_[_0xb2ac('0x25')](_0x125243[_0xb2ac('0x24')],function(_0x1c91c9){return{'model':db[_0x1c91c9[_0xb2ac('0x26')]],'as':_0x1c91c9['as'],'attributes':_0x1c91c9[_0xb2ac('0x23')],'include':_0x1c91c9['include']?_[_0xb2ac('0x25')](_0x1c91c9[_0xb2ac('0x24')],function(_0xbf5087){return{'model':db[_0xbf5087[_0xb2ac('0x26')]],'as':_0xbf5087['as'],'attributes':_0xbf5087[_0xb2ac('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb2ac('0x13')](function(_0xdc4e26){logger[_0xb2ac('0x14')]('GetVoiceQueueReport',_0x4de579);logger[_0xb2ac('0x27')](_0xb2ac('0x1d'),_0x4de579,JSON[_0xb2ac('0x16')](_0xdc4e26));_0x1f0fd3(_0xdc4e26);})['catch'](function(_0x3036b2){logger[_0xb2ac('0x18')](_0xb2ac('0x1d'),_0x3036b2[_0xb2ac('0x19')],_0x4de579);_0x47aa12(_0x17dcb2['error'](0x1f4,_0x3036b2[_0xb2ac('0x19')]));});});};exports['CreateVoiceQueueReport']=function(_0xe1a190){var _0x5bda54=this;return new Promise(function(_0x351443,_0x1a6100){return db['VoiceQueueReport'][_0xb2ac('0x28')](_0xe1a190[_0xb2ac('0x29')],{'raw':_0xe1a190[_0xb2ac('0x20')]?_0xe1a190[_0xb2ac('0x20')][_0xb2ac('0x21')]===undefined?!![]:![]:!![]})[_0xb2ac('0x13')](function(_0x4b02dd){logger[_0xb2ac('0x14')](_0xb2ac('0x2a'),_0xe1a190);logger['debug']('CreateVoiceQueueReport',_0xe1a190,JSON['stringify'](_0x4b02dd));_0x351443(_0x4b02dd);})[_0xb2ac('0x1c')](function(_0x5b8f33){logger[_0xb2ac('0x18')](_0xb2ac('0x2a'),_0x5b8f33[_0xb2ac('0x19')],_0xe1a190);_0x1a6100(_0x5bda54[_0xb2ac('0x18')](0x1f4,_0x5b8f33[_0xb2ac('0x19')]));});});};exports[_0xb2ac('0x2b')]=function(_0x39d851){var _0x54d779=this;return new Promise(function(_0x5d7650,_0x617785){return db[_0xb2ac('0x1e')][_0xb2ac('0x2c')](_0x39d851[_0xb2ac('0x29')],{'raw':_0x39d851['options']?_0x39d851['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39d851['options']?_0x39d851[_0xb2ac('0x20')][_0xb2ac('0x22')]||null:null,'attributes':_0x39d851[_0xb2ac('0x20')]?_0x39d851['options'][_0xb2ac('0x23')]||null:null,'limit':_0x39d851[_0xb2ac('0x20')]?_0x39d851['options']['limit']||null:null})['then'](function(_0x311f12){logger[_0xb2ac('0x14')]('UpdateVoiceQueueReport',_0x39d851);logger[_0xb2ac('0x27')]('UpdateVoiceQueueReport',_0x39d851,JSON[_0xb2ac('0x16')](_0x311f12));_0x5d7650(_0x311f12);})[_0xb2ac('0x1c')](function(_0xc60be8){logger['error'](_0xb2ac('0x2b'),_0xc60be8[_0xb2ac('0x19')],_0x39d851);_0x617785(_0x54d779[_0xb2ac('0x18')](0x1f4,_0xc60be8['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 81df3f0..5313474 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 _0xcb70=['emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x3a1a93,_0x394bc7){var _0xc82471=function(_0x2ad1d4){while(--_0x2ad1d4){_0x3a1a93['push'](_0x3a1a93['shift']());}};_0xc82471(++_0x394bc7);}(_0xcb70,0xf3));var _0x0cb7=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xcb70[_0x42bdad];return _0x122626;};'use strict';var VoiceQueueReportEvents=require(_0x0cb7('0x0'));var events=[_0x0cb7('0x1'),'remove','update'];function createListener(_0x4bf2f9,_0x54827c){return function(_0x1ee6b8){_0x54827c[_0x0cb7('0x2')](_0x4bf2f9,_0x1ee6b8);};}function removeListener(_0x3552c8,_0x391056){return function(){VoiceQueueReportEvents[_0x0cb7('0x3')](_0x3552c8,_0x391056);};}exports[_0x0cb7('0x4')]=function(_0x19a010){for(var _0x4e5b82=0x0,_0x4143e9=events[_0x0cb7('0x5')];_0x4e5b82<_0x4143e9;_0x4e5b82++){var _0x2a55ec=events[_0x4e5b82];var _0xdbc70b=createListener(_0x0cb7('0x6')+_0x2a55ec,_0x19a010);VoiceQueueReportEvents['on'](_0x2a55ec,_0xdbc70b);}}; \ No newline at end of file +var _0xa81a=['voiceQueueReport:','./voiceQueueReport.events','remove','update','emit','removeListener','register','length'];(function(_0x5bb736,_0x32c198){var _0x483aad=function(_0x426b8e){while(--_0x426b8e){_0x5bb736['push'](_0x5bb736['shift']());}};_0x483aad(++_0x32c198);}(_0xa81a,0x1f1));var _0xaa81=function(_0x3436f6,_0xc22b38){_0x3436f6=_0x3436f6-0x0;var _0x346a25=_0xa81a[_0x3436f6];return _0x346a25;};'use strict';var VoiceQueueReportEvents=require(_0xaa81('0x0'));var events=['save',_0xaa81('0x1'),_0xaa81('0x2')];function createListener(_0x39b293,_0x529601){return function(_0x79f781){_0x529601[_0xaa81('0x3')](_0x39b293,_0x79f781);};}function removeListener(_0x27da76,_0x5accbf){return function(){VoiceQueueReportEvents[_0xaa81('0x4')](_0x27da76,_0x5accbf);};}exports[_0xaa81('0x5')]=function(_0x597248){for(var _0x1df780=0x0,_0x246d56=events[_0xaa81('0x6')];_0x1df780<_0x246d56;_0x1df780++){var _0x3c2502=events[_0x1df780];var _0x4ab928=createListener(_0xaa81('0x7')+_0x3c2502,_0x597248);VoiceQueueReportEvents['on'](_0x3c2502,_0x4ab928);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index de6d8b2..b5f7fba 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 _0x4297=['isAuthenticated','index','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x2ec37e,_0x93586a){var _0x3c5980=function(_0x555fb8){while(--_0x555fb8){_0x2ec37e['push'](_0x2ec37e['shift']());}};_0x3c5980(++_0x93586a);}(_0x4297,0x13a));var _0x7429=function(_0x5b4ab6,_0x2328ab){_0x5b4ab6=_0x5b4ab6-0x0;var _0x5c766f=_0x4297[_0x5b4ab6];return _0x5c766f;};'use strict';var multer=require(_0x7429('0x0'));var util=require('util');var path=require(_0x7429('0x1'));var timeout=require('connect-timeout');var express=require(_0x7429('0x2'));var router=express[_0x7429('0x3')]();var fs_extra=require(_0x7429('0x4'));var auth=require(_0x7429('0x5'));var interaction=require(_0x7429('0x6'));var config=require(_0x7429('0x7'));var controller=require(_0x7429('0x8'));router[_0x7429('0x9')]('/',auth[_0x7429('0xa')](),controller[_0x7429('0xb')]);router[_0x7429('0x9')]('/:id',auth[_0x7429('0xa')](),controller['show']);router['post']('/',auth[_0x7429('0xa')](),controller[_0x7429('0xc')]);router[_0x7429('0xd')](_0x7429('0xe'),auth[_0x7429('0xa')](),controller[_0x7429('0xf')]);router['delete'](_0x7429('0xe'),auth[_0x7429('0xa')](),controller[_0x7429('0x10')]);module[_0x7429('0x11')]=router; \ No newline at end of file +var _0x20b5=['../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1b1d64,_0xa7d24d){var _0x3c8cc7=function(_0x317eeb){while(--_0x317eeb){_0x1b1d64['push'](_0x1b1d64['shift']());}};_0x3c8cc7(++_0xa7d24d);}(_0x20b5,0x11a));var _0x520b=function(_0x26ccfe,_0x3f8f73){_0x26ccfe=_0x26ccfe-0x0;var _0x151096=_0x20b5[_0x26ccfe];return _0x151096;};'use strict';var multer=require(_0x520b('0x0'));var util=require(_0x520b('0x1'));var path=require(_0x520b('0x2'));var timeout=require(_0x520b('0x3'));var express=require('express');var router=express[_0x520b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x520b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x520b('0x6'));var controller=require(_0x520b('0x7'));router['get']('/',auth[_0x520b('0x8')](),controller[_0x520b('0x9')]);router['get'](_0x520b('0xa'),auth[_0x520b('0x8')](),controller[_0x520b('0xb')]);router[_0x520b('0xc')]('/',auth[_0x520b('0x8')](),controller[_0x520b('0xd')]);router[_0x520b('0xe')](_0x520b('0xa'),auth[_0x520b('0x8')](),controller['update']);router[_0x520b('0xf')](_0x520b('0xa'),auth[_0x520b('0x8')](),controller[_0x520b('0x10')]);module[_0x520b('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 a90bd89..ada98e1 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 _0xe984=['YYYY-MM-DD\x20HH:mm:ss','moment','STRING','DATE','format'];(function(_0x21ece6,_0x489fde){var _0x22a7e3=function(_0x1c43f5){while(--_0x1c43f5){_0x21ece6['push'](_0x21ece6['shift']());}};_0x22a7e3(++_0x489fde);}(_0xe984,0x1aa));var _0x4e98=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0xe984[_0x4f431d];return _0x4f31e1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4e98('0x0'));module['exports']={'time':{'type':Sequelize[_0x4e98('0x1')]},'callid':{'type':Sequelize[_0x4e98('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4e98('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4e98('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4e98('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4e98('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4e98('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4e98('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4e98('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4e98('0x2')],'allowNull':![],'defaultValue':moment()[_0x4e98('0x3')](_0x4e98('0x4'))}}; \ No newline at end of file +var _0xda1f=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x5ac36b,_0x5bad9b){var _0x4a054b=function(_0xd7459){while(--_0xd7459){_0x5ac36b['push'](_0x5ac36b['shift']());}};_0x4a054b(++_0x5bad9b);}(_0xda1f,0x18a));var _0xfda1=function(_0x3eb0da,_0x21e103){_0x3eb0da=_0x3eb0da-0x0;var _0x4d3553=_0xda1f[_0x3eb0da];return _0x4d3553;};'use strict';var Sequelize=require(_0xfda1('0x0'));var moment=require(_0xfda1('0x1'));module[_0xfda1('0x2')]={'time':{'type':Sequelize[_0xfda1('0x3')]},'callid':{'type':Sequelize[_0xfda1('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xfda1('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xfda1('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfda1('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfda1('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfda1('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfda1('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfda1('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfda1('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xfda1('0x4')],'allowNull':![],'defaultValue':moment()[_0xfda1('0x5')](_0xfda1('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 29877d6..94cae66 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 _0x23ed=['then','destroy','error','stack','name','send','map','rawAttributes','key','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceQueuesLog','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','reject','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x23ed,0xb5));var _0xd23e=function(_0x1f91b8,_0x4dbf7d){_0x1f91b8=_0x1f91b8-0x0;var _0x26ac54=_0x23ed[_0x1f91b8];return _0x26ac54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd23e('0x0'));var zipdir=require(_0xd23e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd23e('0x2'));var moment=require('moment');var BPromise=require(_0xd23e('0x3'));var Mustache=require(_0xd23e('0x4'));var util=require(_0xd23e('0x5'));var path=require(_0xd23e('0x6'));var sox=require('sox');var csv=require(_0xd23e('0x7'));var ejs=require(_0xd23e('0x8'));var fs=require('fs');var fs_extra=require(_0xd23e('0x9'));var _=require(_0xd23e('0xa'));var squel=require(_0xd23e('0xb'));var crypto=require(_0xd23e('0xc'));var jsforce=require(_0xd23e('0xd'));var deskjs=require(_0xd23e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd23e('0xf'));var Papa=require('papaparse');var Redis=require(_0xd23e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd23e('0x11'));var as=require(_0xd23e('0x12'));var hardwareService=require(_0xd23e('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd23e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd23e('0x15'))['db'];function respondWithStatusCode(_0x4898db,_0x34dc2f){_0x34dc2f=_0x34dc2f||0xcc;return function(_0x32da88){if(_0x32da88){return _0x4898db[_0xd23e('0x16')](_0x34dc2f);}return _0x4898db[_0xd23e('0x17')](_0x34dc2f)[_0xd23e('0x18')]();};}function respondWithResult(_0x3eb949,_0x309547){_0x309547=_0x309547||0xc8;return function(_0x1847f9){if(_0x1847f9){return _0x3eb949[_0xd23e('0x17')](_0x309547)['json'](_0x1847f9);}};}function respondWithFilteredResult(_0x582190,_0x47b1cc){return function(_0x8a453c){if(_0x8a453c){var _0x1bf093=typeof _0x47b1cc['offset']==='undefined'&&typeof _0x47b1cc['limit']==='undefined';var _0x4457bb=_0x8a453c[_0xd23e('0x19')];var _0x313fe1=_0x1bf093?0x0:_0x47b1cc[_0xd23e('0x1a')];var _0x530e18=_0x1bf093?_0x8a453c[_0xd23e('0x19')]:_0x47b1cc['offset']+_0x47b1cc['limit'];var _0x2f8f8b;if(_0x530e18>=_0x4457bb){_0x530e18=_0x4457bb;_0x2f8f8b=0xc8;}else{_0x2f8f8b=0xce;}_0x582190[_0xd23e('0x17')](_0x2f8f8b);return _0x582190[_0xd23e('0x1b')](_0xd23e('0x1c'),_0x313fe1+'-'+_0x530e18+'/'+_0x4457bb)[_0xd23e('0x1d')](_0x8a453c);}return null;};}function patchUpdates(_0x4af012){return function(_0x3b3f96){try{jsonpatch['apply'](_0x3b3f96,_0x4af012,!![]);}catch(_0x284e8d){return BPromise[_0xd23e('0x1e')](_0x284e8d);}return _0x3b3f96['save']();};}function saveUpdates(_0x525791,_0x4b9fbc){return function(_0x3f8f0b){if(_0x3f8f0b){return _0x3f8f0b[_0xd23e('0x1f')](_0x525791)[_0xd23e('0x20')](function(_0x10ff0d){return _0x10ff0d;});}return null;};}function removeEntity(_0x363093,_0x5a2217){return function(_0x179acd){if(_0x179acd){return _0x179acd[_0xd23e('0x21')]()[_0xd23e('0x20')](function(){_0x363093[_0xd23e('0x17')](0xcc)[_0xd23e('0x18')]();});}};}function handleEntityNotFound(_0x11269a,_0x328ea6){return function(_0x258123){if(!_0x258123){_0x11269a[_0xd23e('0x16')](0x194);}return _0x258123;};}function handleError(_0x573f7f,_0xb22c95){_0xb22c95=_0xb22c95||0x1f4;return function(_0x1b3b87){logger[_0xd23e('0x22')](_0x1b3b87[_0xd23e('0x23')]);if(_0x1b3b87[_0xd23e('0x24')]){delete _0x1b3b87[_0xd23e('0x24')];}_0x573f7f[_0xd23e('0x17')](_0xb22c95)[_0xd23e('0x25')](_0x1b3b87);};}exports['index']=function(_0x140a35,_0x44f484){var _0x22e777={},_0x5d5d8d={},_0x1bf4f0={'count':0x0,'rows':[]};var _0x57d9a8=_[_0xd23e('0x26')](db['VoiceQueuesLog'][_0xd23e('0x27')],function(_0x25cde9){return{'name':_0x25cde9['fieldName'],'type':_0x25cde9['type'][_0xd23e('0x28')]};});_0x5d5d8d['model']=_[_0xd23e('0x26')](_0x57d9a8,_0xd23e('0x24'));_0x5d5d8d['query']=_[_0xd23e('0x29')](_0x140a35[_0xd23e('0x2a')]);_0x5d5d8d['filters']=_['intersection'](_0x5d5d8d['model'],_0x5d5d8d[_0xd23e('0x2a')]);_0x22e777['attributes']=_[_0xd23e('0x2b')](_0x5d5d8d[_0xd23e('0x2c')],qs[_0xd23e('0x2d')](_0x140a35[_0xd23e('0x2a')]['fields']));_0x22e777[_0xd23e('0x2e')]=_0x22e777[_0xd23e('0x2e')]['length']?_0x22e777[_0xd23e('0x2e')]:_0x5d5d8d[_0xd23e('0x2c')];if(!_0x140a35[_0xd23e('0x2a')][_0xd23e('0x2f')](_0xd23e('0x30'))){_0x22e777[_0xd23e('0x31')]=qs[_0xd23e('0x31')](_0x140a35[_0xd23e('0x2a')]['limit']);_0x22e777[_0xd23e('0x1a')]=qs[_0xd23e('0x1a')](_0x140a35[_0xd23e('0x2a')]['offset']);}_0x22e777[_0xd23e('0x32')]=qs[_0xd23e('0x33')](_0x140a35[_0xd23e('0x2a')]['sort']);_0x22e777[_0xd23e('0x34')]=qs[_0xd23e('0x35')](_[_0xd23e('0x36')](_0x140a35[_0xd23e('0x2a')],_0x5d5d8d['filters']),_0x57d9a8);if(_0x140a35[_0xd23e('0x2a')][_0xd23e('0x37')]){_0x22e777['where']=_[_0xd23e('0x38')](_0x22e777[_0xd23e('0x34')],{'$or':_['map'](_0x57d9a8,function(_0x576f0e){if(_0x576f0e['type']!==_0xd23e('0x39')){var _0x4a398f={};_0x4a398f[_0x576f0e[_0xd23e('0x24')]]={'$like':'%'+_0x140a35['query'][_0xd23e('0x37')]+'%'};return _0x4a398f;}})});}_0x22e777=_[_0xd23e('0x38')]({},_0x22e777,_0x140a35[_0xd23e('0x3a')]);var _0x226796={'where':_0x22e777[_0xd23e('0x34')]};return db[_0xd23e('0x3b')][_0xd23e('0x19')](_0x226796)['then'](function(_0x2bd758){_0x1bf4f0[_0xd23e('0x19')]=_0x2bd758;if(_0x140a35['query'][_0xd23e('0x3c')]){_0x22e777[_0xd23e('0x3d')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xd23e('0x3e')](_0x22e777);})[_0xd23e('0x20')](function(_0x881917){_0x1bf4f0[_0xd23e('0x3f')]=_0x881917;return _0x1bf4f0;})[_0xd23e('0x20')](respondWithFilteredResult(_0x44f484,_0x22e777))[_0xd23e('0x40')](handleError(_0x44f484,null));};exports[_0xd23e('0x41')]=function(_0x480e96,_0x31878a){var _0x12ddf5={'raw':!![],'where':{'id':_0x480e96['params']['id']}},_0x52c42d={};_0x52c42d[_0xd23e('0x2c')]=_[_0xd23e('0x29')](db[_0xd23e('0x3b')]['rawAttributes']);_0x52c42d['query']=_[_0xd23e('0x29')](_0x480e96[_0xd23e('0x2a')]);_0x52c42d[_0xd23e('0x35')]=_['intersection'](_0x52c42d[_0xd23e('0x2c')],_0x52c42d[_0xd23e('0x2a')]);_0x12ddf5['attributes']=_[_0xd23e('0x2b')](_0x52c42d[_0xd23e('0x2c')],qs[_0xd23e('0x2d')](_0x480e96['query'][_0xd23e('0x2d')]));_0x12ddf5[_0xd23e('0x2e')]=_0x12ddf5['attributes'][_0xd23e('0x42')]?_0x12ddf5['attributes']:_0x52c42d[_0xd23e('0x2c')];if(_0x480e96[_0xd23e('0x2a')][_0xd23e('0x3c')]){_0x12ddf5[_0xd23e('0x3d')]=[{'all':!![]}];}_0x12ddf5=_['merge']({},_0x12ddf5,_0x480e96[_0xd23e('0x3a')]);return db[_0xd23e('0x3b')][_0xd23e('0x43')](_0x12ddf5)['then'](handleEntityNotFound(_0x31878a,null))[_0xd23e('0x20')](respondWithResult(_0x31878a,null))[_0xd23e('0x40')](handleError(_0x31878a,null));};exports[_0xd23e('0x44')]=function(_0x325820,_0x1517e8){return db[_0xd23e('0x3b')][_0xd23e('0x44')](_0x325820[_0xd23e('0x45')],{})[_0xd23e('0x20')](respondWithResult(_0x1517e8,0xc9))[_0xd23e('0x40')](handleError(_0x1517e8,null));};exports[_0xd23e('0x1f')]=function(_0x1b29b6,_0x4ff992){if(_0x1b29b6[_0xd23e('0x45')]['id']){delete _0x1b29b6[_0xd23e('0x45')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x1b29b6[_0xd23e('0x46')]['id']}})[_0xd23e('0x20')](handleEntityNotFound(_0x4ff992,null))[_0xd23e('0x20')](saveUpdates(_0x1b29b6[_0xd23e('0x45')],null))[_0xd23e('0x20')](respondWithResult(_0x4ff992,null))['catch'](handleError(_0x4ff992,null));};exports[_0xd23e('0x21')]=function(_0x23acc7,_0x394919){return db[_0xd23e('0x3b')]['find']({'where':{'id':_0x23acc7[_0xd23e('0x46')]['id']}})[_0xd23e('0x20')](handleEntityNotFound(_0x394919,null))[_0xd23e('0x20')](removeEntity(_0x394919,null))['catch'](handleError(_0x394919,null));}; \ No newline at end of file +var _0x372b=['squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','lodash'];(function(_0x584c47,_0x3b4ed6){var _0x121216=function(_0x2499dd){while(--_0x2499dd){_0x584c47['push'](_0x584c47['shift']());}};_0x121216(++_0x3b4ed6);}(_0x372b,0x84));var _0xb372=function(_0x47f3fd,_0x2c995d){_0x47f3fd=_0x47f3fd-0x0;var _0x3f286e=_0x372b[_0x47f3fd];return _0x3f286e;};'use strict';var emlformat=require(_0xb372('0x0'));var rimraf=require(_0xb372('0x1'));var zipdir=require(_0xb372('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb372('0x3'));var moment=require(_0xb372('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb372('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb372('0x6'));var csv=require(_0xb372('0x7'));var ejs=require(_0xb372('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb372('0x9'));var squel=require(_0xb372('0xa'));var crypto=require(_0xb372('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb372('0x7'));var querystring=require(_0xb372('0xc'));var Papa=require(_0xb372('0xd'));var Redis=require(_0xb372('0xe'));var authService=require(_0xb372('0xf'));var qs=require(_0xb372('0x10'));var as=require(_0xb372('0x11'));var hardwareService=require(_0xb372('0x12'));var logger=require('../../config/logger')(_0xb372('0x13'));var utils=require(_0xb372('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb372('0x15'))['db'];function respondWithStatusCode(_0x185e96,_0x299c49){_0x299c49=_0x299c49||0xcc;return function(_0x22d43a){if(_0x22d43a){return _0x185e96['sendStatus'](_0x299c49);}return _0x185e96[_0xb372('0x16')](_0x299c49)[_0xb372('0x17')]();};}function respondWithResult(_0x4bc2ea,_0x1a3843){_0x1a3843=_0x1a3843||0xc8;return function(_0x34747b){if(_0x34747b){return _0x4bc2ea[_0xb372('0x16')](_0x1a3843)[_0xb372('0x18')](_0x34747b);}};}function respondWithFilteredResult(_0x3bf932,_0x4bbcd1){return function(_0x704b64){if(_0x704b64){var _0x46881e=typeof _0x4bbcd1[_0xb372('0x19')]===_0xb372('0x1a')&&typeof _0x4bbcd1[_0xb372('0x1b')]==='undefined';var _0x3c26f2=_0x704b64[_0xb372('0x1c')];var _0x4bb9ef=_0x46881e?0x0:_0x4bbcd1[_0xb372('0x19')];var _0x39278c=_0x46881e?_0x704b64[_0xb372('0x1c')]:_0x4bbcd1[_0xb372('0x19')]+_0x4bbcd1[_0xb372('0x1b')];var _0x2f6ca6;if(_0x39278c>=_0x3c26f2){_0x39278c=_0x3c26f2;_0x2f6ca6=0xc8;}else{_0x2f6ca6=0xce;}_0x3bf932[_0xb372('0x16')](_0x2f6ca6);return _0x3bf932['set'](_0xb372('0x1d'),_0x4bb9ef+'-'+_0x39278c+'/'+_0x3c26f2)[_0xb372('0x18')](_0x704b64);}return null;};}function patchUpdates(_0x4d853d){return function(_0x34fbda){try{jsonpatch['apply'](_0x34fbda,_0x4d853d,!![]);}catch(_0xa3f89){return BPromise[_0xb372('0x1e')](_0xa3f89);}return _0x34fbda[_0xb372('0x1f')]();};}function saveUpdates(_0x5bb326,_0x57ce07){return function(_0x5f3499){if(_0x5f3499){return _0x5f3499[_0xb372('0x20')](_0x5bb326)[_0xb372('0x21')](function(_0x435cf5){return _0x435cf5;});}return null;};}function removeEntity(_0x22b0a3,_0xa51041){return function(_0x3920d1){if(_0x3920d1){return _0x3920d1[_0xb372('0x22')]()[_0xb372('0x21')](function(){_0x22b0a3[_0xb372('0x16')](0xcc)[_0xb372('0x17')]();});}};}function handleEntityNotFound(_0xbbd15e,_0x48d5f5){return function(_0x4e6fe5){if(!_0x4e6fe5){_0xbbd15e[_0xb372('0x23')](0x194);}return _0x4e6fe5;};}function handleError(_0x10d2bc,_0x5cb34b){_0x5cb34b=_0x5cb34b||0x1f4;return function(_0x4438ee){logger[_0xb372('0x24')](_0x4438ee[_0xb372('0x25')]);if(_0x4438ee[_0xb372('0x26')]){delete _0x4438ee[_0xb372('0x26')];}_0x10d2bc[_0xb372('0x16')](_0x5cb34b)['send'](_0x4438ee);};}exports[_0xb372('0x27')]=function(_0x7cdd0,_0x2d38b3){var _0x5a098c={},_0xbae092={},_0x354571={'count':0x0,'rows':[]};var _0x27463d=_[_0xb372('0x28')](db[_0xb372('0x29')][_0xb372('0x2a')],function(_0x3f9c9c){return{'name':_0x3f9c9c[_0xb372('0x2b')],'type':_0x3f9c9c[_0xb372('0x2c')][_0xb372('0x2d')]};});_0xbae092[_0xb372('0x2e')]=_[_0xb372('0x28')](_0x27463d,_0xb372('0x26'));_0xbae092[_0xb372('0x2f')]=_[_0xb372('0x30')](_0x7cdd0[_0xb372('0x2f')]);_0xbae092[_0xb372('0x31')]=_[_0xb372('0x32')](_0xbae092[_0xb372('0x2e')],_0xbae092[_0xb372('0x2f')]);_0x5a098c[_0xb372('0x33')]=_[_0xb372('0x32')](_0xbae092[_0xb372('0x2e')],qs[_0xb372('0x34')](_0x7cdd0[_0xb372('0x2f')][_0xb372('0x34')]));_0x5a098c['attributes']=_0x5a098c[_0xb372('0x33')][_0xb372('0x35')]?_0x5a098c[_0xb372('0x33')]:_0xbae092[_0xb372('0x2e')];if(!_0x7cdd0['query'][_0xb372('0x36')](_0xb372('0x37'))){_0x5a098c[_0xb372('0x1b')]=qs['limit'](_0x7cdd0[_0xb372('0x2f')]['limit']);_0x5a098c[_0xb372('0x19')]=qs[_0xb372('0x19')](_0x7cdd0[_0xb372('0x2f')][_0xb372('0x19')]);}_0x5a098c[_0xb372('0x38')]=qs['sort'](_0x7cdd0[_0xb372('0x2f')]['sort']);_0x5a098c[_0xb372('0x39')]=qs[_0xb372('0x31')](_[_0xb372('0x3a')](_0x7cdd0['query'],_0xbae092[_0xb372('0x31')]),_0x27463d);if(_0x7cdd0[_0xb372('0x2f')][_0xb372('0x3b')]){_0x5a098c[_0xb372('0x39')]=_['merge'](_0x5a098c[_0xb372('0x39')],{'$or':_['map'](_0x27463d,function(_0x4b2e7e){if(_0x4b2e7e[_0xb372('0x2c')]!==_0xb372('0x3c')){var _0x57b756={};_0x57b756[_0x4b2e7e['name']]={'$like':'%'+_0x7cdd0[_0xb372('0x2f')][_0xb372('0x3b')]+'%'};return _0x57b756;}})});}_0x5a098c=_[_0xb372('0x3d')]({},_0x5a098c,_0x7cdd0['options']);var _0x438db8={'where':_0x5a098c['where']};return db[_0xb372('0x29')]['count'](_0x438db8)['then'](function(_0x5bf151){_0x354571[_0xb372('0x1c')]=_0x5bf151;if(_0x7cdd0[_0xb372('0x2f')][_0xb372('0x3e')]){_0x5a098c[_0xb372('0x3f')]=[{'all':!![]}];}return db[_0xb372('0x29')]['findAll'](_0x5a098c);})[_0xb372('0x21')](function(_0x2258ff){_0x354571[_0xb372('0x40')]=_0x2258ff;return _0x354571;})[_0xb372('0x21')](respondWithFilteredResult(_0x2d38b3,_0x5a098c))[_0xb372('0x41')](handleError(_0x2d38b3,null));};exports[_0xb372('0x42')]=function(_0x572d09,_0x109a28){var _0x12e4ab={'raw':!![],'where':{'id':_0x572d09[_0xb372('0x43')]['id']}},_0x5040a5={};_0x5040a5[_0xb372('0x2e')]=_[_0xb372('0x30')](db[_0xb372('0x29')][_0xb372('0x2a')]);_0x5040a5[_0xb372('0x2f')]=_[_0xb372('0x30')](_0x572d09[_0xb372('0x2f')]);_0x5040a5[_0xb372('0x31')]=_['intersection'](_0x5040a5[_0xb372('0x2e')],_0x5040a5[_0xb372('0x2f')]);_0x12e4ab[_0xb372('0x33')]=_['intersection'](_0x5040a5[_0xb372('0x2e')],qs['fields'](_0x572d09[_0xb372('0x2f')][_0xb372('0x34')]));_0x12e4ab[_0xb372('0x33')]=_0x12e4ab[_0xb372('0x33')][_0xb372('0x35')]?_0x12e4ab[_0xb372('0x33')]:_0x5040a5[_0xb372('0x2e')];if(_0x572d09[_0xb372('0x2f')][_0xb372('0x3e')]){_0x12e4ab['include']=[{'all':!![]}];}_0x12e4ab=_['merge']({},_0x12e4ab,_0x572d09['options']);return db[_0xb372('0x29')][_0xb372('0x44')](_0x12e4ab)[_0xb372('0x21')](handleEntityNotFound(_0x109a28,null))[_0xb372('0x21')](respondWithResult(_0x109a28,null))[_0xb372('0x41')](handleError(_0x109a28,null));};exports[_0xb372('0x45')]=function(_0x3110c1,_0x17f179){return db['VoiceQueuesLog']['create'](_0x3110c1[_0xb372('0x46')],{})[_0xb372('0x21')](respondWithResult(_0x17f179,0xc9))[_0xb372('0x41')](handleError(_0x17f179,null));};exports['update']=function(_0xf4fc30,_0x632c27){if(_0xf4fc30[_0xb372('0x46')]['id']){delete _0xf4fc30['body']['id'];}return db[_0xb372('0x29')][_0xb372('0x44')]({'where':{'id':_0xf4fc30[_0xb372('0x43')]['id']}})[_0xb372('0x21')](handleEntityNotFound(_0x632c27,null))[_0xb372('0x21')](saveUpdates(_0xf4fc30[_0xb372('0x46')],null))['then'](respondWithResult(_0x632c27,null))[_0xb372('0x41')](handleError(_0x632c27,null));};exports[_0xb372('0x22')]=function(_0x274525,_0x2d62c1){return db[_0xb372('0x29')][_0xb372('0x44')]({'where':{'id':_0x274525['params']['id']}})[_0xb372('0x21')](handleEntityNotFound(_0x2d62c1,null))[_0xb372('0x21')](removeEntity(_0x2d62c1,null))[_0xb372('0x41')](handleError(_0x2d62c1,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 047f341..24f35f3 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 _0x70e0=['path','rimraf','./voiceQueuesLog.attributes','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x3ddda1,_0x40a94b){var _0x85c5e3=function(_0x55c6cc){while(--_0x55c6cc){_0x3ddda1['push'](_0x3ddda1['shift']());}};_0x85c5e3(++_0x40a94b);}(_0x70e0,0x17b));var _0x070e=function(_0x3c1639,_0x3e8d98){_0x3c1639=_0x3c1639-0x0;var _0x31e3dd=_0x70e0[_0x3c1639];return _0x31e3dd;};'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']('VoiceQueuesLog',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0xa'),_0x070e('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc96c=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','event_dtm','event'];(function(_0xc8f717,_0x1913d3){var _0x40a5a8=function(_0x213657){while(--_0x213657){_0xc8f717['push'](_0xc8f717['shift']());}};_0x40a5a8(++_0x1913d3);}(_0xc96c,0x14a));var _0xcc96=function(_0x28b3d7,_0x17b41d){_0x28b3d7=_0x28b3d7-0x0;var _0x49619d=_0xc96c[_0x28b3d7];return _0x49619d;};'use strict';var _=require('lodash');var util=require(_0xcc96('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xcc96('0x1'));var BPromise=require(_0xcc96('0x2'));var rp=require(_0xcc96('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc96('0x4'));var config=require(_0xcc96('0x5'));var attributes=require(_0xcc96('0x6'));module[_0xcc96('0x7')]=function(_0x32cba9,_0x5e3ce3){return _0x32cba9['define'](_0xcc96('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xcc96('0x9'),'fields':[_0xcc96('0xa'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index b4e36ab..7cd6c0e 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 _0x7376=['client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x4426f3,_0x29cd53){var _0x30b462=function(_0x16ed47){while(--_0x16ed47){_0x4426f3['push'](_0x4426f3['shift']());}};_0x30b462(++_0x29cd53);}(_0x7376,0xa8));var _0x6737=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7376[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x6737('0x0'));var moment=require(_0x6737('0x1'));var BPromise=require(_0x6737('0x2'));var rs=require(_0x6737('0x3'));var fs=require('fs');var Redis=require(_0x6737('0x4'));var db=require(_0x6737('0x5'))['db'];var utils=require(_0x6737('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6737('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6737('0x8')][_0x6737('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17eae0,_0x43445a,_0x579b64){return new BPromise(function(_0x184a47,_0x2bb7a6){return client[_0x6737('0xa')](_0x17eae0,_0x579b64)[_0x6737('0xb')](function(_0x7b9603){logger[_0x6737('0xc')](_0x6737('0xd'),_0x43445a,_0x6737('0xe'));logger['debug'](_0x6737('0xf'),_0x43445a,_0x6737('0xe'),JSON[_0x6737('0x10')](_0x7b9603));if(_0x7b9603[_0x6737('0x11')]){if(_0x7b9603[_0x6737('0x11')][_0x6737('0x12')]===0x1f4){logger['error'](_0x6737('0xd'),_0x43445a,_0x7b9603['error'][_0x6737('0x13')]);return _0x2bb7a6(_0x7b9603['error'][_0x6737('0x13')]);}logger['error'](_0x6737('0xd'),_0x43445a,_0x7b9603[_0x6737('0x11')][_0x6737('0x13')]);return _0x184a47(_0x7b9603[_0x6737('0x11')][_0x6737('0x13')]);}else{logger[_0x6737('0xc')](_0x6737('0xd'),_0x43445a,_0x6737('0xe'));_0x184a47(_0x7b9603[_0x6737('0x14')]['message']);}})[_0x6737('0x15')](function(_0x467b3f){logger['error'](_0x6737('0xd'),_0x43445a,_0x467b3f);_0x2bb7a6(_0x467b3f);});});} \ No newline at end of file +var _0xc212=['../../config/environment','jayson/promise','client','http','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xd710d6,_0x2b26eb){var _0x195306=function(_0x33e48a){while(--_0x33e48a){_0xd710d6['push'](_0xd710d6['shift']());}};_0x195306(++_0x2b26eb);}(_0xc212,0x1af));var _0x2c21=function(_0x15b4ff,_0x4eece9){_0x15b4ff=_0x15b4ff-0x0;var _0x2ce43a=_0xc212[_0x15b4ff];return _0x2ce43a;};'use strict';var _=require('lodash');var util=require(_0x2c21('0x0'));var moment=require(_0x2c21('0x1'));var BPromise=require(_0x2c21('0x2'));var rs=require(_0x2c21('0x3'));var fs=require('fs');var Redis=require(_0x2c21('0x4'));var db=require(_0x2c21('0x5'))['db'];var utils=require(_0x2c21('0x6'));var logger=require(_0x2c21('0x7'))(_0x2c21('0x8'));var config=require(_0x2c21('0x9'));var jayson=require(_0x2c21('0xa'));var client=jayson[_0x2c21('0xb')][_0x2c21('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x402ecc,_0x5929fe,_0xb17623){return new BPromise(function(_0x6c578a,_0x16682b){return client['request'](_0x402ecc,_0xb17623)['then'](function(_0x42deae){logger[_0x2c21('0xd')](_0x2c21('0xe'),_0x5929fe,_0x2c21('0xf'));logger[_0x2c21('0x10')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x5929fe,_0x2c21('0xf'),JSON['stringify'](_0x42deae));if(_0x42deae[_0x2c21('0x11')]){if(_0x42deae[_0x2c21('0x11')][_0x2c21('0x12')]===0x1f4){logger[_0x2c21('0x11')](_0x2c21('0xe'),_0x5929fe,_0x42deae['error'][_0x2c21('0x13')]);return _0x16682b(_0x42deae['error']['message']);}logger[_0x2c21('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5929fe,_0x42deae[_0x2c21('0x11')][_0x2c21('0x13')]);return _0x6c578a(_0x42deae[_0x2c21('0x11')][_0x2c21('0x13')]);}else{logger[_0x2c21('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5929fe,'request\x20sent');_0x6c578a(_0x42deae[_0x2c21('0x14')][_0x2c21('0x13')]);}})[_0x2c21('0x15')](function(_0x5ca61a){logger[_0x2c21('0x11')](_0x2c21('0xe'),_0x5929fe,_0x5ca61a);_0x16682b(_0x5ca61a);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 0cd8a7b..f81223e 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 _0x9a45=['../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9a45,0x1de));var _0x59a4=function(_0x322e30,_0x2810c9){_0x322e30=_0x322e30-0x0;var _0x24f5fb=_0x9a45[_0x322e30];return _0x24f5fb;};'use strict';var multer=require(_0x59a4('0x0'));var util=require(_0x59a4('0x1'));var path=require(_0x59a4('0x2'));var timeout=require(_0x59a4('0x3'));var express=require(_0x59a4('0x4'));var router=express['Router']();var fs_extra=require(_0x59a4('0x5'));var auth=require(_0x59a4('0x6'));var interaction=require(_0x59a4('0x7'));var config=require(_0x59a4('0x8'));var controller=require(_0x59a4('0x9'));router['get']('/',auth[_0x59a4('0xa')](),controller[_0x59a4('0xb')]);router[_0x59a4('0xc')](_0x59a4('0xd'),auth['isAuthenticated'](),controller[_0x59a4('0xe')]);router[_0x59a4('0xc')](_0x59a4('0xf'),auth[_0x59a4('0xa')](),controller['show']);router[_0x59a4('0xc')](_0x59a4('0x10'),auth[_0x59a4('0xa')](),controller[_0x59a4('0x11')]);router[_0x59a4('0xc')]('/:id/downloads',controller[_0x59a4('0x12')]);router[_0x59a4('0xc')](_0x59a4('0x13'),auth['isAuthenticated'](),controller[_0x59a4('0x14')]);router[_0x59a4('0x15')]('/',auth[_0x59a4('0xa')](),controller[_0x59a4('0x16')]);router[_0x59a4('0x15')]('/:id/transcribe',auth[_0x59a4('0xa')](),controller['runTranscribe']);router[_0x59a4('0x17')](_0x59a4('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x59a4('0x18')](_0x59a4('0xf'),auth[_0x59a4('0xa')](),controller[_0x59a4('0x19')]);module[_0x59a4('0x1a')]=router; \ No newline at end of file +var _0xfadd=['/:id/transcribe','post','create','runTranscribe','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','isAuthenticated','describe','get','show','/:id/download','download','downloads'];(function(_0x15fd23,_0x217c79){var _0x2cb9de=function(_0x2ac2c4){while(--_0x2ac2c4){_0x15fd23['push'](_0x15fd23['shift']());}};_0x2cb9de(++_0x217c79);}(_0xfadd,0x1b9));var _0xdfad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfadd[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xdfad('0x0'));var util=require(_0xdfad('0x1'));var path=require(_0xdfad('0x2'));var timeout=require(_0xdfad('0x3'));var express=require(_0xdfad('0x4'));var router=express[_0xdfad('0x5')]();var fs_extra=require(_0xdfad('0x6'));var auth=require(_0xdfad('0x7'));var interaction=require(_0xdfad('0x8'));var config=require(_0xdfad('0x9'));var controller=require('./voiceRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xdfad('0xa')]);router['get']('/describe',auth[_0xdfad('0xb')](),controller[_0xdfad('0xc')]);router[_0xdfad('0xd')]('/:id',auth[_0xdfad('0xb')](),controller[_0xdfad('0xe')]);router['get'](_0xdfad('0xf'),auth[_0xdfad('0xb')](),controller[_0xdfad('0x10')]);router[_0xdfad('0xd')]('/:id/downloads',controller[_0xdfad('0x11')]);router[_0xdfad('0xd')](_0xdfad('0x12'),auth[_0xdfad('0xb')](),controller['downloadTranscribe']);router[_0xdfad('0x13')]('/',auth[_0xdfad('0xb')](),controller[_0xdfad('0x14')]);router[_0xdfad('0x13')](_0xdfad('0x12'),auth[_0xdfad('0xb')](),controller[_0xdfad('0x15')]);router[_0xdfad('0x16')](_0xdfad('0x17'),auth['isAuthenticated'](),controller[_0xdfad('0x18')]);router[_0xdfad('0x19')]('/:id',auth[_0xdfad('0xb')](),controller['destroy']);module[_0xdfad('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 0a12423..d95062f 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(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_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(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 e857d85..f00f988 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 _0x303d=['Location','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJob','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','bucket','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','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','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','error','name','send','map','VoiceRecording','rawAttributes','key','model','differenceBy','format','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','filter','options','includeAll','include','catch','params','create','body','find','describe','download','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','push','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)'];(function(_0x503d66,_0x771276){var _0x187491=function(_0x90b07c){while(--_0x90b07c){_0x503d66['push'](_0x503d66['shift']());}};_0x187491(++_0x771276);}(_0x303d,0x152));var _0xd303=function(_0x4276e1,_0x547409){_0x4276e1=_0x4276e1-0x0;var _0x55cc5c=_0x303d[_0x4276e1];return _0x55cc5c;};'use strict';var emlformat=require(_0xd303('0x0'));var rimraf=require(_0xd303('0x1'));var zipdir=require(_0xd303('0x2'));var jsonpatch=require(_0xd303('0x3'));var rp=require(_0xd303('0x4'));var moment=require('moment');var BPromise=require(_0xd303('0x5'));var Mustache=require(_0xd303('0x6'));var util=require(_0xd303('0x7'));var path=require(_0xd303('0x8'));var sox=require(_0xd303('0x9'));var csv=require(_0xd303('0xa'));var ejs=require(_0xd303('0xb'));var fs=require('fs');var fs_extra=require(_0xd303('0xc'));var _=require(_0xd303('0xd'));var squel=require(_0xd303('0xe'));var crypto=require(_0xd303('0xf'));var jsforce=require(_0xd303('0x10'));var deskjs=require(_0xd303('0x11'));var toCsv=require(_0xd303('0xa'));var querystring=require(_0xd303('0x12'));var Papa=require('papaparse');var AWS=require(_0xd303('0x13'));var uuidv4=require(_0xd303('0x14'));var Redis=require(_0xd303('0x15'));var authService=require(_0xd303('0x16'));var qs=require(_0xd303('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd303('0x18'));var logger=require(_0xd303('0x19'))(_0xd303('0x1a'));var utils=require(_0xd303('0x1b'));var config=require(_0xd303('0x1c'));var licenseUtil=require(_0xd303('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x417358,_0x1c3e5c){_0x1c3e5c=_0x1c3e5c||0xcc;return function(_0x1effc1){if(_0x1effc1){return _0x417358['sendStatus'](_0x1c3e5c);}return _0x417358[_0xd303('0x1e')](_0x1c3e5c)[_0xd303('0x1f')]();};}function respondWithResult(_0x425431,_0x2cd76e){_0x2cd76e=_0x2cd76e||0xc8;return function(_0x4005bb){if(_0x4005bb){return _0x425431['status'](_0x2cd76e)[_0xd303('0x20')](_0x4005bb);}};}function respondWithFilteredResult(_0x149c7c,_0x1c9acb){return function(_0x8a4ff8){if(_0x8a4ff8){var _0xed3bee=typeof _0x1c9acb[_0xd303('0x21')]===_0xd303('0x22')&&typeof _0x1c9acb[_0xd303('0x23')]===_0xd303('0x22');var _0x513ea6=_0x8a4ff8[_0xd303('0x24')];var _0x4974f4=_0xed3bee?0x0:_0x1c9acb['offset'];var _0x192dd5=_0xed3bee?_0x8a4ff8[_0xd303('0x24')]:_0x1c9acb[_0xd303('0x21')]+_0x1c9acb['limit'];var _0x457276;if(_0x192dd5>=_0x513ea6){_0x192dd5=_0x513ea6;_0x457276=0xc8;}else{_0x457276=0xce;}_0x149c7c[_0xd303('0x1e')](_0x457276);return _0x149c7c[_0xd303('0x25')](_0xd303('0x26'),_0x4974f4+'-'+_0x192dd5+'/'+_0x513ea6)[_0xd303('0x20')](_0x8a4ff8);}return null;};}function patchUpdates(_0x55f44d){return function(_0x363dad){try{jsonpatch['apply'](_0x363dad,_0x55f44d,!![]);}catch(_0xb5eaac){return BPromise['reject'](_0xb5eaac);}return _0x363dad[_0xd303('0x27')]();};}function saveUpdates(_0x7b3391,_0x3b2a5d){return function(_0xc1e506){if(_0xc1e506){return _0xc1e506[_0xd303('0x28')](_0x7b3391)[_0xd303('0x29')](function(_0x44b00c){return _0x44b00c;});}return null;};}function removeEntity(_0x53c125,_0x5bf0f1){return function(_0x5236d3){if(_0x5236d3){return _0x5236d3[_0xd303('0x2a')]()[_0xd303('0x29')](function(){_0x53c125['status'](0xcc)[_0xd303('0x1f')]();});}};}function handleEntityNotFound(_0x5aa792,_0x4fc5f1){return function(_0x17b0ee){if(!_0x17b0ee){_0x5aa792[_0xd303('0x2b')](0x194);}return _0x17b0ee;};}function handleError(_0x4eb57e,_0x41823c){_0x41823c=_0x41823c||0x1f4;return function(_0x9baff3){logger[_0xd303('0x2c')](_0x9baff3['stack']);if(_0x9baff3[_0xd303('0x2d')]){delete _0x9baff3['name'];}_0x4eb57e[_0xd303('0x1e')](_0x41823c)[_0xd303('0x2e')](_0x9baff3);};}exports['index']=function(_0x1e2bea,_0x16b811){var _0x19f35b={},_0x3cce9a={},_0x35db31={'count':0x0,'rows':[]};var _0x46b3af=_[_0xd303('0x2f')](db[_0xd303('0x30')][_0xd303('0x31')],function(_0x4170b9){return{'name':_0x4170b9['fieldName'],'type':_0x4170b9['type'][_0xd303('0x32')]};});_0x3cce9a[_0xd303('0x33')]=_[_0xd303('0x34')](_[_0xd303('0x2f')](_0x46b3af,_0xd303('0x2d')),[_0xd303('0x35')]);_0x3cce9a['query']=_[_0xd303('0x36')](_0x1e2bea[_0xd303('0x37')]);_0x3cce9a['filters']=_[_0xd303('0x38')](_0x3cce9a['model'],_0x3cce9a[_0xd303('0x37')]);_0x19f35b['attributes']=_[_0xd303('0x38')](_0x3cce9a[_0xd303('0x33')],qs[_0xd303('0x39')](_0x1e2bea[_0xd303('0x37')][_0xd303('0x39')]));_0x19f35b[_0xd303('0x3a')]=_0x19f35b['attributes'][_0xd303('0x3b')]?_0x19f35b[_0xd303('0x3a')]:_0x3cce9a[_0xd303('0x33')];if(!_0x1e2bea['query'][_0xd303('0x3c')]('nolimit')){_0x19f35b['limit']=qs[_0xd303('0x23')](_0x1e2bea[_0xd303('0x37')][_0xd303('0x23')]);_0x19f35b['offset']=qs['offset'](_0x1e2bea[_0xd303('0x37')][_0xd303('0x21')]);}_0x19f35b[_0xd303('0x3d')]=qs[_0xd303('0x3e')](_0x1e2bea[_0xd303('0x37')][_0xd303('0x3e')]);_0x19f35b[_0xd303('0x3f')]=qs[_0xd303('0x40')](_[_0xd303('0x41')](_0x1e2bea[_0xd303('0x37')],_0x3cce9a[_0xd303('0x40')]),_0x46b3af);if(_0x1e2bea['query']['filter']){_0x19f35b['where']=_[_0xd303('0x42')](_0x19f35b[_0xd303('0x3f')],{'$or':_[_0xd303('0x2f')](_0x46b3af,function(_0x4ce6ca){if(_0x4ce6ca[_0xd303('0x43')]!=='VIRTUAL'){var _0x284303={};_0x284303[_0x4ce6ca[_0xd303('0x2d')]]={'$like':'%'+_0x1e2bea['query'][_0xd303('0x44')]+'%'};return _0x284303;}})});}_0x19f35b=_['merge']({},_0x19f35b,_0x1e2bea[_0xd303('0x45')]);var _0x232bcd={'where':_0x19f35b[_0xd303('0x3f')]};return db[_0xd303('0x30')][_0xd303('0x24')](_0x232bcd)[_0xd303('0x29')](function(_0x16855d){_0x35db31[_0xd303('0x24')]=_0x16855d;if(_0x1e2bea[_0xd303('0x37')][_0xd303('0x46')]){_0x19f35b[_0xd303('0x47')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x19f35b);})['then'](function(_0x55cfc9){_0x35db31['rows']=_0x55cfc9;return _0x35db31;})[_0xd303('0x29')](respondWithFilteredResult(_0x16b811,_0x19f35b))[_0xd303('0x48')](handleError(_0x16b811,null));};exports['show']=function(_0x5df3d3,_0x540fd8){var _0x330b05={'raw':![],'where':{'id':_0x5df3d3[_0xd303('0x49')]['id']}},_0x372ba6={};_0x372ba6[_0xd303('0x33')]=_['keys'](db[_0xd303('0x30')]['rawAttributes']);_0x372ba6[_0xd303('0x37')]=_[_0xd303('0x36')](_0x5df3d3['query']);_0x372ba6['filters']=_[_0xd303('0x38')](_0x372ba6['model'],_0x372ba6[_0xd303('0x37')]);_0x330b05[_0xd303('0x3a')]=_[_0xd303('0x38')](_0x372ba6[_0xd303('0x33')],qs[_0xd303('0x39')](_0x5df3d3[_0xd303('0x37')]['fields']));_0x330b05['attributes']=_0x330b05[_0xd303('0x3a')][_0xd303('0x3b')]?_0x330b05[_0xd303('0x3a')]:_0x372ba6[_0xd303('0x33')];if(_0x5df3d3[_0xd303('0x37')]['includeAll']){_0x330b05[_0xd303('0x47')]=[{'all':!![]}];}_0x330b05=_[_0xd303('0x42')]({},_0x330b05,_0x5df3d3[_0xd303('0x45')]);return db[_0xd303('0x30')]['find'](_0x330b05)[_0xd303('0x29')](handleEntityNotFound(_0x540fd8,null))[_0xd303('0x29')](respondWithResult(_0x540fd8,null))[_0xd303('0x48')](handleError(_0x540fd8,null));};exports[_0xd303('0x4a')]=function(_0x122a8a,_0x1618d8){return db[_0xd303('0x30')]['create'](_0x122a8a[_0xd303('0x4b')],{})[_0xd303('0x29')](respondWithResult(_0x1618d8,0xc9))[_0xd303('0x48')](handleError(_0x1618d8,null));};exports['update']=function(_0xeb1a2b,_0x24bf9a){if(_0xeb1a2b[_0xd303('0x4b')]['id']){delete _0xeb1a2b[_0xd303('0x4b')]['id'];}return db[_0xd303('0x30')][_0xd303('0x4c')]({'where':{'id':_0xeb1a2b['params']['id']}})[_0xd303('0x29')](handleEntityNotFound(_0x24bf9a,null))['then'](saveUpdates(_0xeb1a2b[_0xd303('0x4b')],null))[_0xd303('0x29')](respondWithResult(_0x24bf9a,null))[_0xd303('0x48')](handleError(_0x24bf9a,null));};exports['describe']=function(_0x36859c,_0x2132ea){return db['VoiceRecording'][_0xd303('0x4d')]()[_0xd303('0x29')](respondWithResult(_0x2132ea,null))[_0xd303('0x48')](handleError(_0x2132ea,null));};exports[_0xd303('0x4e')]=function(_0x382f2c,_0x25e8eb,_0x1007c3){var _0x3efd63=require('../../components/encryptor');var _0x19f5fd=![];var _0x1929ae={};if(_0x382f2c['query']['type']&&_0x382f2c[_0xd303('0x37')][_0xd303('0x43')]===_0xd303('0x4f')){_0x1929ae['uniqueid']=_0x382f2c['params']['id'];}else{_0x1929ae['id']=_0x382f2c['params']['id'];}return db[_0xd303('0x30')][_0xd303('0x4c')]({'where':_0x1929ae,'attributes':['id',_0xd303('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x25e8eb,null))[_0xd303('0x29')](function(_0x23e373){if(_0x23e373){var _0x363fda=_0x23e373[_0xd303('0x50')];var _0x71a68=util[_0xd303('0x35')]('%s.cypher',_0x363fda);if(fs[_0xd303('0x51')](_0x71a68)){_0x19f5fd=!![];return _0x3efd63[_0xd303('0x52')](_0x71a68,_0x363fda,config[_0xd303('0x53')][_0xd303('0x54')])[_0xd303('0x29')](function(){return _0x23e373;});}return _0x23e373;}})[_0xd303('0x29')](function(_0x2e34d2){if(_0x2e34d2){var _0x156b54=_0x2e34d2['value'];if(!fs[_0xd303('0x51')](_0x156b54)){throw new db[(_0xd303('0x55'))][(_0xd303('0x56'))](_0xd303('0x57'));}if(_0x2e34d2[_0xd303('0x58')]){return _0x25e8eb[_0xd303('0x4e')](_0x156b54,_0x2e34d2['filename']+path['extname'](_0x156b54),function(){if(_0x19f5fd){fs[_0xd303('0x59')](_0x156b54);}});}else{return _0x25e8eb[_0xd303('0x4e')](_0x156b54,function(_0x10df43){if(_0x19f5fd){fs[_0xd303('0x59')](_0x156b54);}});}}})[_0xd303('0x48')](function(_0x2d0232){if(_0x2d0232['message']===_0xd303('0x57')){_0x25e8eb[_0xd303('0x1e')](0x194)[_0xd303('0x2e')](_0xd303('0x5a'));}else{return handleError(_0x25e8eb,null);}});};exports['downloads']=function(_0x2a42fb,_0x1f90e6,_0x452fc3){var _0x5c9b5e=require(_0xd303('0x5b'));var _0x1047fb=![];var _0x419fa9={'$and':[db[_0xd303('0x5c')][_0xd303('0x3f')](db[_0xd303('0x5c')]['fn'](_0xd303('0x5d'),db[_0xd303('0x5c')][_0xd303('0x5e')](_0xd303('0x4f'))),_0x2a42fb['query'][_0xd303('0x5f')])]};if(_0x2a42fb['query'][_0xd303('0x43')]&&_0x2a42fb['query'][_0xd303('0x43')]===_0xd303('0x4f')){_0x419fa9['$and'][_0xd303('0x60')]({'uniqueid':_0x2a42fb['params']['id']});}else{_0x419fa9['$and'][_0xd303('0x60')]({'id':_0x2a42fb[_0xd303('0x49')]['id']});}return db[_0xd303('0x30')][_0xd303('0x4c')]({'where':_0x419fa9,'attributes':['id','value'],'raw':!![]})[_0xd303('0x29')](handleEntityNotFound(_0x1f90e6,null))[_0xd303('0x29')](function(_0x5d2173){if(_0x5d2173){var _0x57b0b8=util[_0xd303('0x35')]('%s.cypher',_0x5d2173[_0xd303('0x50')]);if(fs[_0xd303('0x51')](_0x57b0b8)){_0x1047fb=!![];return _0x5c9b5e['decryptFile'](_0x57b0b8,_0x5d2173[_0xd303('0x50')],config[_0xd303('0x53')]['recording'])[_0xd303('0x29')](function(){return _0x5d2173;});}return _0x5d2173;}})['then'](function(_0xad944e){if(_0xad944e){if(!fs['existsSync'](_0xad944e['value'])){throw new db[(_0xd303('0x55'))][(_0xd303('0x56'))](_0xd303('0x57'));}if(_0xad944e[_0xd303('0x58')]){return _0x1f90e6[_0xd303('0x4e')](_0xad944e[_0xd303('0x50')],_0xad944e[_0xd303('0x58')]+path['extname'](_0xad944e[_0xd303('0x50')]),function(){if(_0x1047fb){fs[_0xd303('0x59')](_0xad944e[_0xd303('0x50')]);}});}else{return _0x1f90e6[_0xd303('0x4e')](_0xad944e[_0xd303('0x50')],function(_0x11d0c2){if(_0x1047fb){fs[_0xd303('0x59')](_0xad944e[_0xd303('0x50')]);}});}}})['catch'](handleError(_0x1f90e6,null));};exports['destroy']=function(_0x3a60ec,_0x48dc87){return db[_0xd303('0x30')][_0xd303('0x4c')]({'where':{'id':_0x3a60ec[_0xd303('0x49')]['id']}})[_0xd303('0x29')](function(_0xfcd383){if(_['isNil'](_0xfcd383)){throw new ReferenceError(_0xd303('0x61'));}return _0xfcd383;})['then'](function(_0x1cff16){var _0x39021a=_0x1cff16['value'];logger[_0xd303('0x62')](_0xd303('0x63'),_0x39021a);if(!_[_0xd303('0x64')](_0x1cff16[_0xd303('0x50')])&&fs[_0xd303('0x51')](_0x39021a)){logger[_0xd303('0x62')](_0xd303('0x65')+_0x39021a+_0xd303('0x66'));fs[_0xd303('0x67')](_0x39021a);}_0x39021a=_0x39021a+_0xd303('0x68');if(!_[_0xd303('0x64')](_0x1cff16[_0xd303('0x50')])&&fs[_0xd303('0x51')](_0x39021a)){logger[_0xd303('0x62')]('File:\x20\x22'+_0x39021a+_0xd303('0x66'));fs['unlinkSync'](_0x39021a);}return _0x1cff16;})['then'](function(_0x466b29){if(!_0x466b29)throw new InternalError();return _0x466b29[_0xd303('0x2a')]();})[_0xd303('0x29')](function(){_0x48dc87[_0xd303('0x1e')](0xcc)[_0xd303('0x1f')]();})['catch'](handleError(_0x48dc87,null));};function getBucketslist(_0x50e350,_0x13522a,_0x32d113){return new Promise(function(_0x2bb8e2,_0x55ce43){var _0xb882dd=new AWS['S3']({'accessKeyId':_0x13522a,'secretAccessKey':_0x50e350,'region':_0x32d113});_0xb882dd['listBuckets']({},function(_0x14dba2,_0x1afcae){if(_0x14dba2){return _0x55ce43(_0x14dba2);}else{return _0x2bb8e2(_0x1afcae);}});});}function createBucket(_0x43135b,_0x36a5b7,_0x125483,_0x1c0d76){return new Promise(function(_0x40f7fd,_0x56902e){var _0x1b04e9=new AWS['S3']({'accessKeyId':_0x36a5b7,'secretAccessKey':_0x43135b,'region':_0x125483});_0x1b04e9[_0xd303('0x69')]({'Bucket':_0x1c0d76},function(_0x4fd907,_0x4e12d6){if(_0x4fd907){return _0x56902e(_0x4fd907);}else{return _0x40f7fd(_0x4e12d6);}});});}function uploadFile(_0x27bb05,_0x53feeb,_0x7d4036,_0x5f2bd3,_0x17497e,_0x39fefc){return new Promise(function(_0x1f914c,_0x3610c7){var _0x2b9698=new AWS['S3']({'accessKeyId':_0x53feeb,'secretAccessKey':_0x27bb05,'region':_0x7d4036});_0x2b9698['upload']({'Bucket':_0x5f2bd3,'Key':_0x17497e,'Body':_0x39fefc},function(_0xe4cce2,_0x15067){if(_0xe4cce2){return _0x3610c7(_0xe4cce2);}else{return _0x1f914c(_0x15067);}});});}function startTranscribe(_0x224041,_0x5c2107,_0x2609b2,_0x3c01d1,_0x2b26b6,_0x13273c){return new Promise(function(_0x9c4c0d,_0x58dd9e){var _0x10717a=new AWS[(_0xd303('0x6a'))]({'accessKeyId':_0x5c2107,'secretAccessKey':_0x224041,'region':_0x2609b2});_0x10717a[_0xd303('0x6b')]({'TranscriptionJobName':_0x3c01d1,'LanguageCode':_0x2b26b6,'Media':{'MediaFileUri':_0x13273c}},function(_0x2f8885,_0x18c42d){if(_0x2f8885){return _0x58dd9e(_0x2f8885);}else{return _0x9c4c0d(_0x18c42d);}});});}function transcribe(_0x42f1f5,_0x1ca4c6,_0x334c4e,_0xe56081,_0x2df573,_0x532ace,_0x307d49){return new Promise(function(_0x5e5746,_0xac3028){var _0x1b9381={};logger[_0xd303('0x62')](util[_0xd303('0x35')](_0xd303('0x6c'),_0x42f1f5,_0x2df573));return uploadFile(_0x1ca4c6,_0x334c4e,_0xe56081,_0x2df573,path[_0xd303('0x6d')](_0x532ace),fs[_0xd303('0x6e')](_0x532ace))[_0xd303('0x29')](function(_0x48cffe){logger[_0xd303('0x62')](util[_0xd303('0x35')](_0xd303('0x6f'),_0x42f1f5,_0x2df573,_0x48cffe[_0xd303('0x70')]));_0x1b9381['bucket']=_0x48cffe['Bucket'];_0x1b9381[_0xd303('0x71')]=_0x48cffe[_0xd303('0x70')];logger[_0xd303('0x62')](util[_0xd303('0x35')](_0xd303('0x72'),_0x42f1f5));return startTranscribe(_0x1ca4c6,_0x334c4e,_0xe56081,uuidv4(),_0x307d49,_0x48cffe['Location']);})[_0xd303('0x29')](function(_0x4ef741){logger[_0xd303('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x42f1f5,_0x4ef741['TranscriptionJob'][_0xd303('0x73')]));_0x1b9381[_0xd303('0x74')]=_0x4ef741['TranscriptionJob'][_0xd303('0x73')];_0x1b9381[_0xd303('0x75')]=_0x4ef741[_0xd303('0x76')]['TranscriptionJobStatus'];return _0x5e5746(_0x1b9381);})['catch'](function(_0x36690e){return _0xac3028(_0x36690e);});});}exports[_0xd303('0x77')]=function(_0x2db856,_0x4af1b6,_0x5bc039){var _0x484a0a;var _0x25f9a7;var _0x438728;var _0x132aea=require(_0xd303('0x5b'));return db[_0xd303('0x30')][_0xd303('0x78')]({'where':{'id':_0x2db856[_0xd303('0x49')]['id']}})['then'](function(_0x45b7a4){if(_0x45b7a4){var _0x19a0e3=util[_0xd303('0x35')](_0xd303('0x79'),_0x45b7a4['value']);if(fs[_0xd303('0x51')](_0x19a0e3)){cypher=!![];return _0x132aea[_0xd303('0x52')](_0x19a0e3,_0x45b7a4[_0xd303('0x50')],config[_0xd303('0x53')][_0xd303('0x54')])[_0xd303('0x29')](function(){return _0x45b7a4;});}return _0x45b7a4;}})[_0xd303('0x29')](function(_0x3faf50){if(!_0x3faf50){throw new db['Sequelize'][(_0xd303('0x56'))](_0xd303('0x7a'));}_0x25f9a7=_0x3faf50;return db[_0xd303('0x7b')][_0xd303('0x78')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4af1b6,null))['then'](function(_0x38d329){if(_0x38d329){_0x484a0a=_0x38d329;if(!_0x484a0a[_0xd303('0x7c')]||!_0x484a0a[_0xd303('0x7d')]||!_0x484a0a[_0xd303('0x7e')]||!_0x484a0a['language']||!_0x484a0a[_0xd303('0x7f')]){throw new db[(_0xd303('0x55'))][(_0xd303('0x56'))]('Transcribe\x20not\x20configured');}if(_0x2db856['body']['runSentiment']&&(!_0x484a0a[_0xd303('0x80')]||!_0x484a0a['sentimentAccountId']||!_0x484a0a[_0xd303('0x81')]||!_0x484a0a[_0xd303('0x82')]||!_0x484a0a[_0xd303('0x7f')])){throw new db[(_0xd303('0x55'))][(_0xd303('0x56'))](_0xd303('0x83'));}return db[_0xd303('0x84')][_0xd303('0x78')]({'where':{'id':_0x484a0a[_0xd303('0x7d')]}});}})[_0xd303('0x29')](function(_0x23ebaa){if(!_0x23ebaa){throw new db[(_0xd303('0x55'))][(_0xd303('0x56'))](_0xd303('0x85'));}if(!_0x23ebaa[_0xd303('0x86')]||!_0x23ebaa[_0xd303('0x87')]){throw new db[(_0xd303('0x55'))]['ValidationError'](_0xd303('0x88'));}_0x438728=_0x23ebaa;return getBucketslist(_0x438728[_0xd303('0x86')],_0x438728[_0xd303('0x87')],_0x484a0a[_0xd303('0x7e')]);})['then'](function(_0x22429a){if(_0x22429a&&_0x22429a[_0xd303('0x89')]){var _0x23273d=_[_0xd303('0x4c')](_0x22429a['Buckets'],function(_0xadb873){return _0xadb873['Name']===_0x484a0a['bucket'];});if(!_0x23273d){logger['info'](util[_0xd303('0x35')](_0xd303('0x8a'),_0x2db856[_0xd303('0x49')]['id'],_0x484a0a[_0xd303('0x7f')]));return createBucket(_0x438728['data1'],_0x438728[_0xd303('0x87')],_0x484a0a[_0xd303('0x7e')],_0x484a0a[_0xd303('0x7f')]);}logger[_0xd303('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2db856[_0xd303('0x49')]['id'],_0x484a0a[_0xd303('0x7f')]));return;}})[_0xd303('0x29')](function(_0x2dc559){if(_0x25f9a7['transcribeStatus']===_0xd303('0x8b')){return transcribe(_0x2db856[_0xd303('0x49')]['id'],_0x438728[_0xd303('0x86')],_0x438728[_0xd303('0x87')],_0x484a0a['transcribeRegion'],_0x484a0a[_0xd303('0x7f')],_0x25f9a7[_0xd303('0x50')],_0x484a0a[_0xd303('0x82')]);}else{logger[_0xd303('0x62')](util[_0xd303('0x35')](_0xd303('0x8c'),_0x2db856[_0xd303('0x49')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xd303('0x29')](function(_0x4586aa){if(_0x4586aa){_0x4586aa[_0xd303('0x8d')]=_0x2db856[_0xd303('0x4b')][_0xd303('0x8e')];return _0x25f9a7[_0xd303('0x8f')](_0x4586aa);}})['then'](respondWithResult(_0x4af1b6,null))['catch'](handleError(_0x4af1b6,null));};function writeFile(_0x37b3e8,_0x5f0a21){return new Promise(function(_0x582b32,_0x54729f){fs[_0xd303('0x90')](_0x5f0a21,_0x37b3e8,function(_0x184924,_0x414b28){if(_0x184924){return _0x54729f(_0x184924);}else{return _0x582b32(_0x414b28);}});});}exports[_0xd303('0x91')]=function(_0x1ce8e6,_0xd5bd8f,_0x396ea9){return db[_0xd303('0x30')][_0xd303('0x78')]({'where':{'id':_0x1ce8e6[_0xd303('0x49')]['id']}})[_0xd303('0x29')](handleEntityNotFound(_0xd5bd8f))['then'](function(_0x588b94){if(_0x588b94&&_0x588b94[_0xd303('0x92')]){var _0x224fcb=_0x588b94[_0xd303('0x92')];var _0x56eebe=config[_0xd303('0x93')]+'/server/files/transcribes/transcribe_'+_0x588b94['id']+_0xd303('0x94');if(fs[_0xd303('0x51')](_0x56eebe)){return _0x56eebe;}return writeFile(_0x224fcb,_0x56eebe)['then'](function(){return _0x56eebe;});}else{throw new db['Sequelize'][(_0xd303('0x56'))](_0xd303('0x95'));}})['then'](function(_0x837b01){return _0xd5bd8f['download'](_0x837b01);})[_0xd303('0x48')](handleError(_0xd5bd8f));}; \ No newline at end of file +var _0x05fc=['TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','data1','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','VoiceRecording','fieldName','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','recording','Sequelize','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request'];(function(_0x97eb96,_0x33e265){var _0x346a06=function(_0x1572b8){while(--_0x1572b8){_0x97eb96['push'](_0x97eb96['shift']());}};_0x346a06(++_0x33e265);}(_0x05fc,0x1ef));var _0xc05f=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x05fc[_0x24259d];return _0x5a701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc05f('0x0'));var zipdir=require(_0xc05f('0x1'));var jsonpatch=require(_0xc05f('0x2'));var rp=require(_0xc05f('0x3'));var moment=require(_0xc05f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc05f('0x5'));var util=require(_0xc05f('0x6'));var path=require(_0xc05f('0x7'));var sox=require(_0xc05f('0x8'));var csv=require(_0xc05f('0x9'));var ejs=require(_0xc05f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc05f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc05f('0x9'));var querystring=require(_0xc05f('0xc'));var Papa=require(_0xc05f('0xd'));var AWS=require(_0xc05f('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0xc05f('0xf'));var authService=require(_0xc05f('0x10'));var qs=require(_0xc05f('0x11'));var as=require(_0xc05f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc05f('0x13'))(_0xc05f('0x14'));var utils=require(_0xc05f('0x15'));var config=require(_0xc05f('0x16'));var licenseUtil=require(_0xc05f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x325895,_0x3dd17f){_0x3dd17f=_0x3dd17f||0xcc;return function(_0x456e65){if(_0x456e65){return _0x325895[_0xc05f('0x18')](_0x3dd17f);}return _0x325895['status'](_0x3dd17f)[_0xc05f('0x19')]();};}function respondWithResult(_0x161c68,_0x28cfb7){_0x28cfb7=_0x28cfb7||0xc8;return function(_0x5cde5c){if(_0x5cde5c){return _0x161c68[_0xc05f('0x1a')](_0x28cfb7)[_0xc05f('0x1b')](_0x5cde5c);}};}function respondWithFilteredResult(_0x179323,_0x11aac7){return function(_0x2cfc0a){if(_0x2cfc0a){var _0xa47ff4=typeof _0x11aac7[_0xc05f('0x1c')]===_0xc05f('0x1d')&&typeof _0x11aac7[_0xc05f('0x1e')]===_0xc05f('0x1d');var _0x2a23fa=_0x2cfc0a[_0xc05f('0x1f')];var _0x32dfe9=_0xa47ff4?0x0:_0x11aac7[_0xc05f('0x1c')];var _0x2f4c04=_0xa47ff4?_0x2cfc0a[_0xc05f('0x1f')]:_0x11aac7[_0xc05f('0x1c')]+_0x11aac7[_0xc05f('0x1e')];var _0x218ddc;if(_0x2f4c04>=_0x2a23fa){_0x2f4c04=_0x2a23fa;_0x218ddc=0xc8;}else{_0x218ddc=0xce;}_0x179323['status'](_0x218ddc);return _0x179323[_0xc05f('0x20')](_0xc05f('0x21'),_0x32dfe9+'-'+_0x2f4c04+'/'+_0x2a23fa)[_0xc05f('0x1b')](_0x2cfc0a);}return null;};}function patchUpdates(_0x59c992){return function(_0x14f876){try{jsonpatch[_0xc05f('0x22')](_0x14f876,_0x59c992,!![]);}catch(_0x273f6f){return BPromise[_0xc05f('0x23')](_0x273f6f);}return _0x14f876[_0xc05f('0x24')]();};}function saveUpdates(_0x163e53,_0x90fa30){return function(_0x59bc5f){if(_0x59bc5f){return _0x59bc5f['update'](_0x163e53)[_0xc05f('0x25')](function(_0x516258){return _0x516258;});}return null;};}function removeEntity(_0x1f3dc7,_0xdf608a){return function(_0x45c5c6){if(_0x45c5c6){return _0x45c5c6[_0xc05f('0x26')]()[_0xc05f('0x25')](function(){_0x1f3dc7[_0xc05f('0x1a')](0xcc)[_0xc05f('0x19')]();});}};}function handleEntityNotFound(_0xd5d76c,_0x527757){return function(_0x4ec0fd){if(!_0x4ec0fd){_0xd5d76c[_0xc05f('0x18')](0x194);}return _0x4ec0fd;};}function handleError(_0x2fbfe2,_0x321a5f){_0x321a5f=_0x321a5f||0x1f4;return function(_0xdce678){logger['error'](_0xdce678[_0xc05f('0x27')]);if(_0xdce678[_0xc05f('0x28')]){delete _0xdce678[_0xc05f('0x28')];}_0x2fbfe2[_0xc05f('0x1a')](_0x321a5f)[_0xc05f('0x29')](_0xdce678);};}exports[_0xc05f('0x2a')]=function(_0x250a70,_0x48c85b){var _0x4c8b7c={},_0x29456f={},_0x85830c={'count':0x0,'rows':[]};var _0x3e0120=_[_0xc05f('0x2b')](db[_0xc05f('0x2c')]['rawAttributes'],function(_0x20a9f2){return{'name':_0x20a9f2[_0xc05f('0x2d')],'type':_0x20a9f2['type']['key']};});_0x29456f[_0xc05f('0x2e')]=_[_0xc05f('0x2f')](_[_0xc05f('0x2b')](_0x3e0120,_0xc05f('0x28')),[_0xc05f('0x30')]);_0x29456f[_0xc05f('0x31')]=_[_0xc05f('0x32')](_0x250a70['query']);_0x29456f[_0xc05f('0x33')]=_['intersection'](_0x29456f[_0xc05f('0x2e')],_0x29456f[_0xc05f('0x31')]);_0x4c8b7c[_0xc05f('0x34')]=_[_0xc05f('0x35')](_0x29456f[_0xc05f('0x2e')],qs[_0xc05f('0x36')](_0x250a70[_0xc05f('0x31')]['fields']));_0x4c8b7c[_0xc05f('0x34')]=_0x4c8b7c[_0xc05f('0x34')]['length']?_0x4c8b7c[_0xc05f('0x34')]:_0x29456f[_0xc05f('0x2e')];if(!_0x250a70['query'][_0xc05f('0x37')](_0xc05f('0x38'))){_0x4c8b7c[_0xc05f('0x1e')]=qs['limit'](_0x250a70[_0xc05f('0x31')]['limit']);_0x4c8b7c[_0xc05f('0x1c')]=qs[_0xc05f('0x1c')](_0x250a70[_0xc05f('0x31')][_0xc05f('0x1c')]);}_0x4c8b7c[_0xc05f('0x39')]=qs[_0xc05f('0x3a')](_0x250a70[_0xc05f('0x31')][_0xc05f('0x3a')]);_0x4c8b7c[_0xc05f('0x3b')]=qs['filters'](_[_0xc05f('0x3c')](_0x250a70[_0xc05f('0x31')],_0x29456f[_0xc05f('0x33')]),_0x3e0120);if(_0x250a70[_0xc05f('0x31')][_0xc05f('0x3d')]){_0x4c8b7c[_0xc05f('0x3b')]=_[_0xc05f('0x3e')](_0x4c8b7c[_0xc05f('0x3b')],{'$or':_['map'](_0x3e0120,function(_0x3e5e63){if(_0x3e5e63[_0xc05f('0x3f')]!==_0xc05f('0x40')){var _0x320f43={};_0x320f43[_0x3e5e63[_0xc05f('0x28')]]={'$like':'%'+_0x250a70[_0xc05f('0x31')]['filter']+'%'};return _0x320f43;}})});}_0x4c8b7c=_[_0xc05f('0x3e')]({},_0x4c8b7c,_0x250a70[_0xc05f('0x41')]);var _0x1f410b={'where':_0x4c8b7c['where']};return db[_0xc05f('0x2c')][_0xc05f('0x1f')](_0x1f410b)[_0xc05f('0x25')](function(_0x13bdf4){_0x85830c[_0xc05f('0x1f')]=_0x13bdf4;if(_0x250a70[_0xc05f('0x31')][_0xc05f('0x42')]){_0x4c8b7c[_0xc05f('0x43')]=[{'all':!![]}];}return db[_0xc05f('0x2c')][_0xc05f('0x44')](_0x4c8b7c);})[_0xc05f('0x25')](function(_0x3654ff){_0x85830c[_0xc05f('0x45')]=_0x3654ff;return _0x85830c;})['then'](respondWithFilteredResult(_0x48c85b,_0x4c8b7c))[_0xc05f('0x46')](handleError(_0x48c85b,null));};exports[_0xc05f('0x47')]=function(_0x4e2f3f,_0x41a385){var _0x232f73={'raw':![],'where':{'id':_0x4e2f3f[_0xc05f('0x48')]['id']}},_0x55ec04={};_0x55ec04['model']=_['keys'](db[_0xc05f('0x2c')]['rawAttributes']);_0x55ec04[_0xc05f('0x31')]=_[_0xc05f('0x32')](_0x4e2f3f[_0xc05f('0x31')]);_0x55ec04[_0xc05f('0x33')]=_[_0xc05f('0x35')](_0x55ec04['model'],_0x55ec04[_0xc05f('0x31')]);_0x232f73[_0xc05f('0x34')]=_[_0xc05f('0x35')](_0x55ec04[_0xc05f('0x2e')],qs[_0xc05f('0x36')](_0x4e2f3f[_0xc05f('0x31')][_0xc05f('0x36')]));_0x232f73['attributes']=_0x232f73[_0xc05f('0x34')][_0xc05f('0x49')]?_0x232f73['attributes']:_0x55ec04['model'];if(_0x4e2f3f[_0xc05f('0x31')][_0xc05f('0x42')]){_0x232f73[_0xc05f('0x43')]=[{'all':!![]}];}_0x232f73=_[_0xc05f('0x3e')]({},_0x232f73,_0x4e2f3f[_0xc05f('0x41')]);return db[_0xc05f('0x2c')][_0xc05f('0x4a')](_0x232f73)[_0xc05f('0x25')](handleEntityNotFound(_0x41a385,null))['then'](respondWithResult(_0x41a385,null))[_0xc05f('0x46')](handleError(_0x41a385,null));};exports[_0xc05f('0x4b')]=function(_0x495165,_0x28167f){return db[_0xc05f('0x2c')]['create'](_0x495165[_0xc05f('0x4c')],{})[_0xc05f('0x25')](respondWithResult(_0x28167f,0xc9))[_0xc05f('0x46')](handleError(_0x28167f,null));};exports[_0xc05f('0x4d')]=function(_0x1191b5,_0x4a553e){if(_0x1191b5['body']['id']){delete _0x1191b5[_0xc05f('0x4c')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x1191b5['params']['id']}})[_0xc05f('0x25')](handleEntityNotFound(_0x4a553e,null))['then'](saveUpdates(_0x1191b5[_0xc05f('0x4c')],null))['then'](respondWithResult(_0x4a553e,null))[_0xc05f('0x46')](handleError(_0x4a553e,null));};exports[_0xc05f('0x4e')]=function(_0x3e74b3,_0x3aa0f5){return db[_0xc05f('0x2c')][_0xc05f('0x4e')]()[_0xc05f('0x25')](respondWithResult(_0x3aa0f5,null))[_0xc05f('0x46')](handleError(_0x3aa0f5,null));};exports['download']=function(_0x11ed37,_0x3a6692,_0xe4f73e){var _0x440b3a=require(_0xc05f('0x4f'));var _0x199240=![];var _0x3c11c7={};if(_0x11ed37['query'][_0xc05f('0x3f')]&&_0x11ed37['query'][_0xc05f('0x3f')]===_0xc05f('0x50')){_0x3c11c7[_0xc05f('0x50')]=_0x11ed37[_0xc05f('0x48')]['id'];}else{_0x3c11c7['id']=_0x11ed37[_0xc05f('0x48')]['id'];}return db[_0xc05f('0x2c')][_0xc05f('0x4a')]({'where':_0x3c11c7,'attributes':['id',_0xc05f('0x51')],'raw':!![]})[_0xc05f('0x25')](handleEntityNotFound(_0x3a6692,null))[_0xc05f('0x25')](function(_0x58f84e){if(_0x58f84e){var _0x597a91=_0x58f84e[_0xc05f('0x51')];var _0x1249b0=util[_0xc05f('0x30')](_0xc05f('0x52'),_0x597a91);if(fs[_0xc05f('0x53')](_0x1249b0)){_0x199240=!![];return _0x440b3a[_0xc05f('0x54')](_0x1249b0,_0x597a91,config[_0xc05f('0x55')]['recording'])[_0xc05f('0x25')](function(){return _0x58f84e;});}return _0x58f84e;}})['then'](function(_0x44ad7b){if(_0x44ad7b){var _0x1f311d=_0x44ad7b[_0xc05f('0x51')];if(!fs[_0xc05f('0x53')](_0x1f311d)){throw new db['Sequelize'][(_0xc05f('0x56'))](_0xc05f('0x57'));}if(_0x44ad7b[_0xc05f('0x58')]){return _0x3a6692['download'](_0x1f311d,_0x44ad7b[_0xc05f('0x58')]+path[_0xc05f('0x59')](_0x1f311d),function(){if(_0x199240){fs[_0xc05f('0x5a')](_0x1f311d);}});}else{return _0x3a6692[_0xc05f('0x5b')](_0x1f311d,function(_0x21b812){if(_0x199240){fs['unlink'](_0x1f311d);}});}}})['catch'](function(_0x5145ef){if(_0x5145ef[_0xc05f('0x5c')]==='VoiceRecording\x20not\x20found'){_0x3a6692[_0xc05f('0x1a')](0x194)[_0xc05f('0x29')](_0xc05f('0x5d'));}else{return handleError(_0x3a6692,null);}});};exports[_0xc05f('0x5e')]=function(_0x302379,_0x109e30,_0x551d95){var _0x4e14f1=require('../../components/encryptor');var _0x502590=![];var _0x196136={'$and':[db[_0xc05f('0x5f')]['where'](db[_0xc05f('0x5f')]['fn'](_0xc05f('0x60'),db[_0xc05f('0x5f')][_0xc05f('0x61')]('uniqueid')),_0x302379[_0xc05f('0x31')]['token'])]};if(_0x302379[_0xc05f('0x31')][_0xc05f('0x3f')]&&_0x302379[_0xc05f('0x31')][_0xc05f('0x3f')]===_0xc05f('0x50')){_0x196136[_0xc05f('0x62')][_0xc05f('0x63')]({'uniqueid':_0x302379[_0xc05f('0x48')]['id']});}else{_0x196136[_0xc05f('0x62')][_0xc05f('0x63')]({'id':_0x302379[_0xc05f('0x48')]['id']});}return db[_0xc05f('0x2c')][_0xc05f('0x4a')]({'where':_0x196136,'attributes':['id','value'],'raw':!![]})[_0xc05f('0x25')](handleEntityNotFound(_0x109e30,null))[_0xc05f('0x25')](function(_0xe03e7a){if(_0xe03e7a){var _0x5b8cda=util[_0xc05f('0x30')]('%s.cypher',_0xe03e7a[_0xc05f('0x51')]);if(fs[_0xc05f('0x53')](_0x5b8cda)){_0x502590=!![];return _0x4e14f1[_0xc05f('0x54')](_0x5b8cda,_0xe03e7a[_0xc05f('0x51')],config[_0xc05f('0x55')][_0xc05f('0x64')])['then'](function(){return _0xe03e7a;});}return _0xe03e7a;}})[_0xc05f('0x25')](function(_0x3df5ed){if(_0x3df5ed){if(!fs[_0xc05f('0x53')](_0x3df5ed['value'])){throw new db[(_0xc05f('0x65'))][(_0xc05f('0x56'))](_0xc05f('0x57'));}if(_0x3df5ed[_0xc05f('0x58')]){return _0x109e30[_0xc05f('0x5b')](_0x3df5ed['value'],_0x3df5ed[_0xc05f('0x58')]+path[_0xc05f('0x59')](_0x3df5ed['value']),function(){if(_0x502590){fs['unlink'](_0x3df5ed[_0xc05f('0x51')]);}});}else{return _0x109e30[_0xc05f('0x5b')](_0x3df5ed[_0xc05f('0x51')],function(_0x127790){if(_0x502590){fs[_0xc05f('0x5a')](_0x3df5ed[_0xc05f('0x51')]);}});}}})[_0xc05f('0x46')](handleError(_0x109e30,null));};exports['destroy']=function(_0x453200,_0x507b49){return db['VoiceRecording']['find']({'where':{'id':_0x453200[_0xc05f('0x48')]['id']}})[_0xc05f('0x25')](function(_0x10bb95){if(_['isNil'](_0x10bb95)){throw new ReferenceError(_0xc05f('0x66'));}return _0x10bb95;})[_0xc05f('0x25')](function(_0x20adee){var _0x416551=_0x20adee['value'];logger[_0xc05f('0x67')]('cancellazione\x20fisica\x20documento\x20%s',_0x416551);if(!_[_0xc05f('0x68')](_0x20adee[_0xc05f('0x51')])&&fs[_0xc05f('0x53')](_0x416551)){logger[_0xc05f('0x67')](_0xc05f('0x69')+_0x416551+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc05f('0x6a')](_0x416551);}_0x416551=_0x416551+_0xc05f('0x6b');if(!_['isNil'](_0x20adee[_0xc05f('0x51')])&&fs[_0xc05f('0x53')](_0x416551)){logger['info'](_0xc05f('0x69')+_0x416551+_0xc05f('0x6c'));fs[_0xc05f('0x6a')](_0x416551);}return _0x20adee;})['then'](function(_0x511af6){if(!_0x511af6)throw new InternalError();return _0x511af6[_0xc05f('0x26')]();})[_0xc05f('0x25')](function(){_0x507b49[_0xc05f('0x1a')](0xcc)[_0xc05f('0x19')]();})[_0xc05f('0x46')](handleError(_0x507b49,null));};function getBucketslist(_0x52f955,_0x37f422,_0x3d2937){return new Promise(function(_0x13fb55,_0x3efe6a){var _0x4a7ec3=new AWS['S3']({'accessKeyId':_0x37f422,'secretAccessKey':_0x52f955,'region':_0x3d2937});_0x4a7ec3[_0xc05f('0x6d')]({},function(_0x218b37,_0x1f9233){if(_0x218b37){return _0x3efe6a(_0x218b37);}else{return _0x13fb55(_0x1f9233);}});});}function createBucket(_0x31a519,_0x552c2a,_0x499aae,_0x3c37d0){return new Promise(function(_0x271f39,_0x531dc4){var _0x3fa2cc=new AWS['S3']({'accessKeyId':_0x552c2a,'secretAccessKey':_0x31a519,'region':_0x499aae});_0x3fa2cc[_0xc05f('0x6e')]({'Bucket':_0x3c37d0},function(_0x4c2d20,_0x5c134d){if(_0x4c2d20){return _0x531dc4(_0x4c2d20);}else{return _0x271f39(_0x5c134d);}});});}function uploadFile(_0x43f2bb,_0x3fcd58,_0x284e3d,_0x95e8c0,_0x55c293,_0x395f9c){return new Promise(function(_0x413109,_0x15efe7){var _0x2b00bf=new AWS['S3']({'accessKeyId':_0x3fcd58,'secretAccessKey':_0x43f2bb,'region':_0x284e3d});_0x2b00bf[_0xc05f('0x6f')]({'Bucket':_0x95e8c0,'Key':_0x55c293,'Body':_0x395f9c},function(_0x329971,_0xb0d67b){if(_0x329971){return _0x15efe7(_0x329971);}else{return _0x413109(_0xb0d67b);}});});}function startTranscribe(_0x31827d,_0x5d4971,_0x5de609,_0x4e8d64,_0x369c83,_0x562fe2){return new Promise(function(_0x4bcdba,_0x4b8b87){var _0x982974=new AWS[(_0xc05f('0x70'))]({'accessKeyId':_0x5d4971,'secretAccessKey':_0x31827d,'region':_0x5de609});_0x982974[_0xc05f('0x71')]({'TranscriptionJobName':_0x4e8d64,'LanguageCode':_0x369c83,'Media':{'MediaFileUri':_0x562fe2}},function(_0x37cf38,_0x5e0715){if(_0x37cf38){return _0x4b8b87(_0x37cf38);}else{return _0x4bcdba(_0x5e0715);}});});}function transcribe(_0x59a90e,_0x5d361e,_0x29e840,_0xd8e04e,_0x3cb18e,_0x5e59f7,_0x4e49cd){return new Promise(function(_0x2cfc7c,_0x481ec1){var _0x4a60b8={};logger[_0xc05f('0x67')](util[_0xc05f('0x30')](_0xc05f('0x72'),_0x59a90e,_0x3cb18e));return uploadFile(_0x5d361e,_0x29e840,_0xd8e04e,_0x3cb18e,path['basename'](_0x5e59f7),fs[_0xc05f('0x73')](_0x5e59f7))['then'](function(_0x24e94a){logger[_0xc05f('0x67')](util['format'](_0xc05f('0x74'),_0x59a90e,_0x3cb18e,_0x24e94a['Location']));_0x4a60b8[_0xc05f('0x75')]=_0x24e94a[_0xc05f('0x76')];_0x4a60b8['location']=_0x24e94a[_0xc05f('0x77')];logger[_0xc05f('0x67')](util[_0xc05f('0x30')](_0xc05f('0x78'),_0x59a90e));return startTranscribe(_0x5d361e,_0x29e840,_0xd8e04e,uuidv4(),_0x4e49cd,_0x24e94a[_0xc05f('0x77')]);})[_0xc05f('0x25')](function(_0x89b635){logger[_0xc05f('0x67')](util[_0xc05f('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x59a90e,_0x89b635[_0xc05f('0x79')][_0xc05f('0x7a')]));_0x4a60b8['transcribeName']=_0x89b635[_0xc05f('0x79')][_0xc05f('0x7a')];_0x4a60b8[_0xc05f('0x7b')]=_0x89b635[_0xc05f('0x79')][_0xc05f('0x7c')];return _0x2cfc7c(_0x4a60b8);})['catch'](function(_0x5a334f){return _0x481ec1(_0x5a334f);});});}exports[_0xc05f('0x7d')]=function(_0x5bf32f,_0x5638af,_0x114179){var _0x19ae0c;var _0x1bd164;var _0x47150d;var _0x4034b9=require(_0xc05f('0x4f'));return db['VoiceRecording'][_0xc05f('0x7e')]({'where':{'id':_0x5bf32f['params']['id']}})[_0xc05f('0x25')](function(_0x222fa8){if(_0x222fa8){var _0x5bf821=util[_0xc05f('0x30')](_0xc05f('0x52'),_0x222fa8[_0xc05f('0x51')]);if(fs[_0xc05f('0x53')](_0x5bf821)){cypher=!![];return _0x4034b9[_0xc05f('0x54')](_0x5bf821,_0x222fa8[_0xc05f('0x51')],config[_0xc05f('0x55')][_0xc05f('0x64')])['then'](function(){return _0x222fa8;});}return _0x222fa8;}})['then'](function(_0xb78ad6){if(!_0xb78ad6){throw new db['Sequelize'][(_0xc05f('0x56'))](_0xc05f('0x7f'));}_0x1bd164=_0xb78ad6;return db['Setting'][_0xc05f('0x7e')]({'where':{'id':0x1}});})[_0xc05f('0x25')](handleEntityNotFound(_0x5638af,null))[_0xc05f('0x25')](function(_0x6c5cfa){if(_0x6c5cfa){_0x19ae0c=_0x6c5cfa;if(!_0x19ae0c[_0xc05f('0x80')]||!_0x19ae0c['transcribeAccountId']||!_0x19ae0c[_0xc05f('0x81')]||!_0x19ae0c[_0xc05f('0x82')]||!_0x19ae0c['bucket']){throw new db[(_0xc05f('0x65'))][(_0xc05f('0x56'))](_0xc05f('0x83'));}if(_0x5bf32f[_0xc05f('0x4c')][_0xc05f('0x84')]&&(!_0x19ae0c['sentiment']||!_0x19ae0c[_0xc05f('0x85')]||!_0x19ae0c[_0xc05f('0x86')]||!_0x19ae0c[_0xc05f('0x82')]||!_0x19ae0c['bucket'])){throw new db[(_0xc05f('0x65'))][(_0xc05f('0x56'))](_0xc05f('0x87'));}return db['CloudProvider'][_0xc05f('0x7e')]({'where':{'id':_0x19ae0c[_0xc05f('0x88')]}});}})['then'](function(_0xc781bd){if(!_0xc781bd){throw new db[(_0xc05f('0x65'))][(_0xc05f('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xc781bd[_0xc05f('0x89')]||!_0xc781bd['data2']){throw new db['Sequelize'][(_0xc05f('0x56'))](_0xc05f('0x8a'));}_0x47150d=_0xc781bd;return getBucketslist(_0x47150d[_0xc05f('0x89')],_0x47150d['data2'],_0x19ae0c[_0xc05f('0x81')]);})[_0xc05f('0x25')](function(_0x467143){if(_0x467143&&_0x467143['Buckets']){var _0x162995=_[_0xc05f('0x4a')](_0x467143[_0xc05f('0x8b')],function(_0x362b5c){return _0x362b5c['Name']===_0x19ae0c['bucket'];});if(!_0x162995){logger['info'](util[_0xc05f('0x30')](_0xc05f('0x8c'),_0x5bf32f[_0xc05f('0x48')]['id'],_0x19ae0c[_0xc05f('0x75')]));return createBucket(_0x47150d[_0xc05f('0x89')],_0x47150d[_0xc05f('0x8d')],_0x19ae0c['transcribeRegion'],_0x19ae0c[_0xc05f('0x75')]);}logger[_0xc05f('0x67')](util['format'](_0xc05f('0x8e'),_0x5bf32f[_0xc05f('0x48')]['id'],_0x19ae0c[_0xc05f('0x75')]));return;}})[_0xc05f('0x25')](function(_0x1daa41){if(_0x1bd164[_0xc05f('0x7b')]===_0xc05f('0x8f')){return transcribe(_0x5bf32f[_0xc05f('0x48')]['id'],_0x47150d[_0xc05f('0x89')],_0x47150d['data2'],_0x19ae0c[_0xc05f('0x81')],_0x19ae0c[_0xc05f('0x75')],_0x1bd164['value'],_0x19ae0c[_0xc05f('0x82')]);}else{logger[_0xc05f('0x67')](util[_0xc05f('0x30')](_0xc05f('0x90'),_0x5bf32f[_0xc05f('0x48')]['id']));return{'transcribeStatus':_0xc05f('0x91')};}})[_0xc05f('0x25')](function(_0x36ffe1){if(_0x36ffe1){_0x36ffe1[_0xc05f('0x92')]=_0x5bf32f[_0xc05f('0x4c')][_0xc05f('0x84')];return _0x1bd164[_0xc05f('0x93')](_0x36ffe1);}})['then'](respondWithResult(_0x5638af,null))[_0xc05f('0x46')](handleError(_0x5638af,null));};function writeFile(_0x3376e7,_0x4dc269){return new Promise(function(_0x31c7d2,_0x5a027d){fs[_0xc05f('0x94')](_0x4dc269,_0x3376e7,function(_0x5305f9,_0x239a2e){if(_0x5305f9){return _0x5a027d(_0x5305f9);}else{return _0x31c7d2(_0x239a2e);}});});}exports[_0xc05f('0x95')]=function(_0x561345,_0x4a719f,_0x41cb64){return db[_0xc05f('0x2c')][_0xc05f('0x7e')]({'where':{'id':_0x561345[_0xc05f('0x48')]['id']}})[_0xc05f('0x25')](handleEntityNotFound(_0x4a719f))[_0xc05f('0x25')](function(_0x75a1ee){if(_0x75a1ee&&_0x75a1ee['fileText']){var _0x4e426a=_0x75a1ee['fileText'];var _0x417745=config[_0xc05f('0x96')]+_0xc05f('0x97')+_0x75a1ee['id']+_0xc05f('0x98');if(fs[_0xc05f('0x53')](_0x417745)){return _0x417745;}return writeFile(_0x4e426a,_0x417745)['then'](function(){return _0x417745;});}else{throw new db['Sequelize'][(_0xc05f('0x56'))](_0xc05f('0x99'));}})[_0xc05f('0x25')](function(_0x124c91){return _0x4a719f[_0xc05f('0x5b')](_0x124c91);})[_0xc05f('0x46')](handleError(_0x4a719f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 593577e..a5e63b6 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 _0xe862=['request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','uniqueid','../../config/logger','api','moment'];(function(_0x3f870a,_0x2346aa){var _0x54323d=function(_0x4e6629){while(--_0x4e6629){_0x3f870a['push'](_0x3f870a['shift']());}};_0x54323d(++_0x2346aa);}(_0xe862,0x76));var _0x2e86=function(_0x16c4a4,_0x185394){_0x16c4a4=_0x16c4a4-0x0;var _0x523160=_0xe862[_0x16c4a4];return _0x523160;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2e86('0x0'))(_0x2e86('0x1'));var moment=require(_0x2e86('0x2'));var BPromise=require('bluebird');var rp=require(_0x2e86('0x3'));var fs=require('fs');var path=require(_0x2e86('0x4'));var rimraf=require(_0x2e86('0x5'));var config=require(_0x2e86('0x6'));var attributes=require(_0x2e86('0x7'));module['exports']=function(_0x38851d,_0x191d4c){return _0x38851d[_0x2e86('0x8')](_0x2e86('0x9'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x2e86('0xa'),'fields':[_0x2e86('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f21=['VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define'];(function(_0x2eba70,_0x578a66){var _0x10875d=function(_0x125cc6){while(--_0x125cc6){_0x2eba70['push'](_0x2eba70['shift']());}};_0x10875d(++_0x578a66);}(_0x3f21,0x7b));var _0x13f2=function(_0x508a38,_0xb8e8ca){_0x508a38=_0x508a38-0x0;var _0x2784de=_0x3f21[_0x508a38];return _0x2784de;};'use strict';var _=require(_0x13f2('0x0'));var util=require(_0x13f2('0x1'));var logger=require(_0x13f2('0x2'))(_0x13f2('0x3'));var moment=require('moment');var BPromise=require(_0x13f2('0x4'));var rp=require(_0x13f2('0x5'));var fs=require('fs');var path=require(_0x13f2('0x6'));var rimraf=require(_0x13f2('0x7'));var config=require(_0x13f2('0x8'));var attributes=require(_0x13f2('0x9'));module[_0x13f2('0xa')]=function(_0x46ff0e,_0x7bc7a5){return _0x46ff0e[_0x13f2('0xb')](_0x13f2('0xc'),attributes,{'tableName':_0x13f2('0xd'),'paranoid':![],'indexes':[{'name':_0x13f2('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 78d2efa..02d9ca8 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 _0x77d4=['%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format'];(function(_0x5cf8ac,_0x3d45c8){var _0x200e85=function(_0x1e7f24){while(--_0x1e7f24){_0x5cf8ac['push'](_0x5cf8ac['shift']());}};_0x200e85(++_0x3d45c8);}(_0x77d4,0x108));var _0x477d=function(_0x5d5e22,_0x58888f){_0x5d5e22=_0x5d5e22-0x0;var _0x45ac12=_0x77d4[_0x5d5e22];return _0x45ac12;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});}exports[_0x477d('0x13')]=function(_0x5d5553){var _0x367965=this;return new Promise(function(_0x1399d7,_0x159beb){return db[_0x477d('0x14')][_0x477d('0x15')](_0x5d5553[_0x477d('0x16')],{'raw':_0x5d5553['options']?_0x5d5553[_0x477d('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d5553[_0x477d('0x17')]?_0x5d5553[_0x477d('0x17')][_0x477d('0x18')]||null:null,'attributes':_0x5d5553[_0x477d('0x17')]?_0x5d5553[_0x477d('0x17')][_0x477d('0x19')]||null:null,'limit':_0x5d5553[_0x477d('0x17')]?_0x5d5553[_0x477d('0x17')][_0x477d('0x1a')]||null:null})[_0x477d('0x9')](function(_0x3d2943){logger[_0x477d('0xa')](_0x477d('0x13'),_0x5d5553);logger[_0x477d('0x1b')]('UpdateVoiceRecording',_0x5d5553,JSON[_0x477d('0xe')](_0x3d2943));_0x1399d7(_0x3d2943);})['catch'](function(_0x239b56){logger[_0x477d('0xf')](_0x477d('0x13'),_0x239b56[_0x477d('0x11')],_0x5d5553);_0x159beb(_0x367965['error'](0x1f4,_0x239b56[_0x477d('0x11')]));});});};exports[_0x477d('0x1c')]=function(_0x1ca4fe){var _0x48ee5e=this;return new Promise(function(_0x585648,_0x198697){var _0x3c6270=require(_0x477d('0x1d'));var _0x5c8ef1;return db[_0x477d('0x1e')][_0x477d('0x1f')]({'attributes':['id',_0x477d('0x20')],'where':{'id':0x1},'raw':!![]})[_0x477d('0x9')](function(_0x37b332){_0x5c8ef1=_0x37b332;return db['VoiceRecording'][_0x477d('0x21')](_0x1ca4fe[_0x477d('0x16')]);})[_0x477d('0x9')](function(_0x25a329){if(_0x5c8ef1[_0x477d('0x20')]&&fs[_0x477d('0x22')](_0x25a329[_0x477d('0x23')])){var _0x98b5d9=util[_0x477d('0x24')](_0x477d('0x25'),_0x25a329[_0x477d('0x23')]);return _0x3c6270[_0x477d('0x26')](_0x25a329[_0x477d('0x23')],_0x98b5d9,config[_0x477d('0x27')][_0x477d('0x28')])[_0x477d('0x9')](function(){fs[_0x477d('0x29')](_0x25a329[_0x477d('0x23')]);logger[_0x477d('0xa')](_0x477d('0x2a'));return _0x25a329;});}return _0x25a329;})['then'](function(_0x304d25){logger['info'](_0x477d('0x1c'),_0x1ca4fe);logger[_0x477d('0x1b')](_0x477d('0x1c'),_0x1ca4fe,JSON['stringify'](_0x304d25));_0x585648(_0x304d25);})[_0x477d('0x12')](function(_0x1201a9){logger[_0x477d('0xf')](_0x477d('0x1c'),_0x1201a9[_0x477d('0x11')],_0x1ca4fe);_0x198697(_0x48ee5e[_0x477d('0xf')](0x1f4,_0x1201a9[_0x477d('0x11')]));});});}; \ No newline at end of file +var _0x4e2e=['error','message','result','VoiceRecording','update','body','options','raw','attributes','limit','UpdateVoiceRecording','debug','catch','../../components/encryptor','findOne','create','callRecordingEncryption','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1a911,_0x1ac1cb){var _0x5c66b2=function(_0xf2bd2e){while(--_0xf2bd2e){_0x1a911['push'](_0x1a911['shift']());}};_0x5c66b2(++_0x1ac1cb);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x3eeda4,_0x460b21){_0x3eeda4=_0x3eeda4-0x0;var _0x54bc96=_0x4e2e[_0x3eeda4];return _0x54bc96;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});}exports['UpdateVoiceRecording']=function(_0x196f16){var _0x54c80b=this;return new Promise(function(_0x1d5e9d,_0x3f313b){return db[_0xe4e2('0x15')][_0xe4e2('0x16')](_0x196f16[_0xe4e2('0x17')],{'raw':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')]['where']||null:null,'attributes':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x1a')]||null:null,'limit':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x1b')]||null:null})[_0xe4e2('0xc')](function(_0x51c67e){logger[_0xe4e2('0xd')](_0xe4e2('0x1c'),_0x196f16);logger[_0xe4e2('0x1d')]('UpdateVoiceRecording',_0x196f16,JSON[_0xe4e2('0x11')](_0x51c67e));_0x1d5e9d(_0x51c67e);})[_0xe4e2('0x1e')](function(_0x598fa3){logger[_0xe4e2('0x12')](_0xe4e2('0x1c'),_0x598fa3[_0xe4e2('0x13')],_0x196f16);_0x3f313b(_0x54c80b[_0xe4e2('0x12')](0x1f4,_0x598fa3[_0xe4e2('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x166610){var _0x357903=this;return new Promise(function(_0x1f6d1f,_0x5120fd){var _0x3a31b8=require(_0xe4e2('0x1f'));var _0x31f651;return db['Setting'][_0xe4e2('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xe4e2('0xc')](function(_0x1e21c0){_0x31f651=_0x1e21c0;return db['VoiceRecording'][_0xe4e2('0x21')](_0x166610[_0xe4e2('0x17')]);})[_0xe4e2('0xc')](function(_0x41500b){if(_0x31f651[_0xe4e2('0x22')]&&fs['existsSync'](_0x41500b['value'])){var _0x2cb235=util[_0xe4e2('0x23')](_0xe4e2('0x24'),_0x41500b[_0xe4e2('0x25')]);return _0x3a31b8[_0xe4e2('0x26')](_0x41500b[_0xe4e2('0x25')],_0x2cb235,config[_0xe4e2('0x27')][_0xe4e2('0x28')])[_0xe4e2('0xc')](function(){fs[_0xe4e2('0x29')](_0x41500b[_0xe4e2('0x25')]);logger[_0xe4e2('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x41500b;});}return _0x41500b;})[_0xe4e2('0xc')](function(_0x8ffc6){logger[_0xe4e2('0xd')](_0xe4e2('0x2a'),_0x166610);logger[_0xe4e2('0x1d')](_0xe4e2('0x2a'),_0x166610,JSON['stringify'](_0x8ffc6));_0x1f6d1f(_0x8ffc6);})[_0xe4e2('0x1e')](function(_0x286714){logger[_0xe4e2('0x12')](_0xe4e2('0x2a'),_0x286714[_0xe4e2('0x13')],_0x166610);_0x5120fd(_0x357903[_0xe4e2('0x12')](0x1f4,_0x286714[_0xe4e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 28605c6..20829ce 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 _0xdf24=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','/:id','update','destroy','exports','multer','util','path'];(function(_0x392f24,_0x20ee72){var _0x22f4c3=function(_0x261c6a){while(--_0x261c6a){_0x392f24['push'](_0x392f24['shift']());}};_0x22f4c3(++_0x20ee72);}(_0xdf24,0x7b));var _0x4df2=function(_0x58a9e2,_0x5b741c){_0x58a9e2=_0x58a9e2-0x0;var _0x1885c6=_0xdf24[_0x58a9e2];return _0x1885c6;};'use strict';var multer=require(_0x4df2('0x0'));var util=require(_0x4df2('0x1'));var path=require(_0x4df2('0x2'));var timeout=require(_0x4df2('0x3'));var express=require('express');var router=express[_0x4df2('0x4')]();var fs_extra=require(_0x4df2('0x5'));var auth=require(_0x4df2('0x6'));var interaction=require(_0x4df2('0x7'));var config=require(_0x4df2('0x8'));var controller=require(_0x4df2('0x9'));router[_0x4df2('0xa')]('/',auth[_0x4df2('0xb')](),controller[_0x4df2('0xc')]);router[_0x4df2('0xa')]('/describe',auth[_0x4df2('0xb')](),controller[_0x4df2('0xd')]);router[_0x4df2('0xa')]('/:id',auth[_0x4df2('0xb')](),controller[_0x4df2('0xe')]);router[_0x4df2('0xf')]('/',auth[_0x4df2('0xb')](),controller[_0x4df2('0x10')]);router['put'](_0x4df2('0x11'),auth[_0x4df2('0xb')](),controller[_0x4df2('0x12')]);router['delete']('/:id',auth[_0x4df2('0xb')](),controller[_0x4df2('0x13')]);module[_0x4df2('0x14')]=router; \ No newline at end of file +var _0x0601=['isAuthenticated','exports','multer','express','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','index','describe','/:id','show','post','create','update','delete'];(function(_0x209fdf,_0x17d62b){var _0x34e9bc=function(_0x35dbd1){while(--_0x35dbd1){_0x209fdf['push'](_0x209fdf['shift']());}};_0x34e9bc(++_0x17d62b);}(_0x0601,0x82));var _0x1060=function(_0x58008c,_0x165ac3){_0x58008c=_0x58008c-0x0;var _0x267dd7=_0x0601[_0x58008c];return _0x267dd7;};'use strict';var multer=require(_0x1060('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1060('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1060('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x1060('0x3'));var controller=require(_0x1060('0x4'));router[_0x1060('0x5')]('/',auth['isAuthenticated'](),controller[_0x1060('0x6')]);router[_0x1060('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x1060('0x7')]);router[_0x1060('0x5')](_0x1060('0x8'),auth['isAuthenticated'](),controller[_0x1060('0x9')]);router[_0x1060('0xa')]('/',auth['isAuthenticated'](),controller[_0x1060('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1060('0xc')]);router[_0x1060('0xd')](_0x1060('0x8'),auth[_0x1060('0xe')](),controller['destroy']);module[_0x1060('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 72a68d4..ab7f3fb 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 _0x8777=['moment','exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x3c4ea0,_0x19c67f){var _0x1f3bcb=function(_0x1699e0){while(--_0x1699e0){_0x3c4ea0['push'](_0x3c4ea0['shift']());}};_0x1f3bcb(++_0x19c67f);}(_0x8777,0x10f));var _0x7877=function(_0x5591b5,_0x3adb2d){_0x5591b5=_0x5591b5-0x0;var _0x121cac=_0x8777[_0x5591b5];return _0x121cac;};'use strict';var Sequelize=require(_0x7877('0x0'));var moment=require(_0x7877('0x1'));module[_0x7877('0x2')]={'type':{'type':Sequelize[_0x7877('0x3')](_0x7877('0x4'),_0x7877('0x5'))},'result':{'type':Sequelize[_0x7877('0x6')]},'transfererchannel':{'type':Sequelize[_0x7877('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x7877('0x6')]},'transferercalleridname':{'type':Sequelize[_0x7877('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7877('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x7877('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x7877('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x7877('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x7877('0x6')]},'transfereechannel':{'type':Sequelize[_0x7877('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x7877('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x7877('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x7877('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x7877('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x7877('0x6')]},'isexternal':{'type':Sequelize[_0x7877('0x3')](_0x7877('0x7'),'No')},'context':{'type':Sequelize[_0x7877('0x6')]},'extension':{'type':Sequelize[_0x7877('0x6')]}}; \ No newline at end of file +var _0x80e6=['moment','ENUM','STRING','sequelize'];(function(_0x5554f3,_0x490882){var _0x3c4d1a=function(_0x356693){while(--_0x356693){_0x5554f3['push'](_0x5554f3['shift']());}};_0x3c4d1a(++_0x490882);}(_0x80e6,0x97));var _0x680e=function(_0x5cfa07,_0x440af3){_0x5cfa07=_0x5cfa07-0x0;var _0xf1ec8e=_0x80e6[_0x5cfa07];return _0xf1ec8e;};'use strict';var Sequelize=require(_0x680e('0x0'));var moment=require(_0x680e('0x1'));module['exports']={'type':{'type':Sequelize[_0x680e('0x2')]('blind','attended')},'result':{'type':Sequelize[_0x680e('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x680e('0x3')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x680e('0x3')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x680e('0x3')]},'transferercontext':{'type':Sequelize[_0x680e('0x3')]},'transfererexten':{'type':Sequelize[_0x680e('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x680e('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x680e('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x680e('0x3')]},'transfereeexten':{'type':Sequelize[_0x680e('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x680e('0x3')]},'isexternal':{'type':Sequelize[_0x680e('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x680e('0x3')]},'extension':{'type':Sequelize[_0x680e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 70d0023..f2879eb 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 _0x9c4e=['offset','limit','undefined','count','set','json','apply','reject','then','destroy','sendStatus','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','create','body','catch','find','describe','eml-format','rimraf','request-promise','bluebird','mustache','path','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','../../mysqldb','end','status'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9c4e,0x10a));var _0xe9c4=function(_0x4e1ef7,_0x349fa5){_0x4e1ef7=_0x4e1ef7-0x0;var _0x20f191=_0x9c4e[_0x4e1ef7];return _0x20f191;};'use strict';var emlformat=require(_0xe9c4('0x0'));var rimraf=require(_0xe9c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe9c4('0x2'));var moment=require('moment');var BPromise=require(_0xe9c4('0x3'));var Mustache=require(_0xe9c4('0x4'));var util=require('util');var path=require(_0xe9c4('0x5'));var sox=require('sox');var csv=require(_0xe9c4('0x6'));var ejs=require(_0xe9c4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9c4('0x8'));var squel=require(_0xe9c4('0x9'));var crypto=require('crypto');var jsforce=require(_0xe9c4('0xa'));var deskjs=require(_0xe9c4('0xb'));var toCsv=require(_0xe9c4('0x6'));var querystring=require('querystring');var Papa=require(_0xe9c4('0xc'));var Redis=require(_0xe9c4('0xd'));var authService=require(_0xe9c4('0xe'));var qs=require(_0xe9c4('0xf'));var as=require(_0xe9c4('0x10'));var hardwareService=require(_0xe9c4('0x11'));var logger=require(_0xe9c4('0x12'))(_0xe9c4('0x13'));var utils=require(_0xe9c4('0x14'));var config=require(_0xe9c4('0x15'));var licenseUtil=require(_0xe9c4('0x16'));var db=require(_0xe9c4('0x17'))['db'];function respondWithStatusCode(_0x9d675,_0x12d72f){_0x12d72f=_0x12d72f||0xcc;return function(_0x4ea429){if(_0x4ea429){return _0x9d675['sendStatus'](_0x12d72f);}return _0x9d675['status'](_0x12d72f)[_0xe9c4('0x18')]();};}function respondWithResult(_0x37b999,_0x8a8209){_0x8a8209=_0x8a8209||0xc8;return function(_0x2c2a6c){if(_0x2c2a6c){return _0x37b999[_0xe9c4('0x19')](_0x8a8209)['json'](_0x2c2a6c);}};}function respondWithFilteredResult(_0x375f90,_0x3e8364){return function(_0x36fd9a){if(_0x36fd9a){var _0x809c54=typeof _0x3e8364[_0xe9c4('0x1a')]==='undefined'&&typeof _0x3e8364[_0xe9c4('0x1b')]===_0xe9c4('0x1c');var _0x323754=_0x36fd9a[_0xe9c4('0x1d')];var _0x4eced5=_0x809c54?0x0:_0x3e8364['offset'];var _0x3a3f23=_0x809c54?_0x36fd9a['count']:_0x3e8364['offset']+_0x3e8364[_0xe9c4('0x1b')];var _0x4ebecf;if(_0x3a3f23>=_0x323754){_0x3a3f23=_0x323754;_0x4ebecf=0xc8;}else{_0x4ebecf=0xce;}_0x375f90[_0xe9c4('0x19')](_0x4ebecf);return _0x375f90[_0xe9c4('0x1e')]('Content-Range',_0x4eced5+'-'+_0x3a3f23+'/'+_0x323754)[_0xe9c4('0x1f')](_0x36fd9a);}return null;};}function patchUpdates(_0x7f8701){return function(_0x4b35eb){try{jsonpatch[_0xe9c4('0x20')](_0x4b35eb,_0x7f8701,!![]);}catch(_0xa645a7){return BPromise[_0xe9c4('0x21')](_0xa645a7);}return _0x4b35eb['save']();};}function saveUpdates(_0x14f48f,_0xf213e8){return function(_0x195cfb){if(_0x195cfb){return _0x195cfb['update'](_0x14f48f)[_0xe9c4('0x22')](function(_0x25df65){return _0x25df65;});}return null;};}function removeEntity(_0x10b7ae,_0x4396cc){return function(_0x513def){if(_0x513def){return _0x513def[_0xe9c4('0x23')]()[_0xe9c4('0x22')](function(){_0x10b7ae['status'](0xcc)[_0xe9c4('0x18')]();});}};}function handleEntityNotFound(_0x5f0fcf,_0x3d4902){return function(_0x1996a1){if(!_0x1996a1){_0x5f0fcf[_0xe9c4('0x24')](0x194);}return _0x1996a1;};}function handleError(_0x35b579,_0x1dcf0c){_0x1dcf0c=_0x1dcf0c||0x1f4;return function(_0x3fbbd3){logger[_0xe9c4('0x25')](_0x3fbbd3[_0xe9c4('0x26')]);if(_0x3fbbd3['name']){delete _0x3fbbd3[_0xe9c4('0x27')];}_0x35b579['status'](_0x1dcf0c)['send'](_0x3fbbd3);};}exports[_0xe9c4('0x28')]=function(_0x2635ce,_0x30a0ee){var _0x4c4d8e={},_0x17d8a0={},_0x3fcb85={'count':0x0,'rows':[]};var _0x4155da=_[_0xe9c4('0x29')](db[_0xe9c4('0x2a')][_0xe9c4('0x2b')],function(_0x4d46fb){return{'name':_0x4d46fb[_0xe9c4('0x2c')],'type':_0x4d46fb[_0xe9c4('0x2d')][_0xe9c4('0x2e')]};});_0x17d8a0[_0xe9c4('0x2f')]=_[_0xe9c4('0x29')](_0x4155da,'name');_0x17d8a0[_0xe9c4('0x30')]=_[_0xe9c4('0x31')](_0x2635ce['query']);_0x17d8a0[_0xe9c4('0x32')]=_[_0xe9c4('0x33')](_0x17d8a0['model'],_0x17d8a0[_0xe9c4('0x30')]);_0x4c4d8e['attributes']=_[_0xe9c4('0x33')](_0x17d8a0[_0xe9c4('0x2f')],qs['fields'](_0x2635ce[_0xe9c4('0x30')][_0xe9c4('0x34')]));_0x4c4d8e[_0xe9c4('0x35')]=_0x4c4d8e[_0xe9c4('0x35')][_0xe9c4('0x36')]?_0x4c4d8e[_0xe9c4('0x35')]:_0x17d8a0[_0xe9c4('0x2f')];if(!_0x2635ce['query'][_0xe9c4('0x37')]('nolimit')){_0x4c4d8e[_0xe9c4('0x1b')]=qs[_0xe9c4('0x1b')](_0x2635ce[_0xe9c4('0x30')][_0xe9c4('0x1b')]);_0x4c4d8e[_0xe9c4('0x1a')]=qs['offset'](_0x2635ce[_0xe9c4('0x30')]['offset']);}_0x4c4d8e[_0xe9c4('0x38')]=qs['sort'](_0x2635ce[_0xe9c4('0x30')][_0xe9c4('0x39')]);_0x4c4d8e[_0xe9c4('0x3a')]=qs['filters'](_['pick'](_0x2635ce[_0xe9c4('0x30')],_0x17d8a0[_0xe9c4('0x32')]),_0x4155da);if(_0x2635ce[_0xe9c4('0x30')][_0xe9c4('0x3b')]){_0x4c4d8e[_0xe9c4('0x3a')]=_['merge'](_0x4c4d8e[_0xe9c4('0x3a')],{'$or':_['map'](_0x4155da,function(_0x216ce8){if(_0x216ce8[_0xe9c4('0x2d')]!=='VIRTUAL'){var _0x271d20={};_0x271d20[_0x216ce8[_0xe9c4('0x27')]]={'$like':'%'+_0x2635ce['query'][_0xe9c4('0x3b')]+'%'};return _0x271d20;}})});}_0x4c4d8e=_[_0xe9c4('0x3c')]({},_0x4c4d8e,_0x2635ce[_0xe9c4('0x3d')]);var _0x2fa3fe={'where':_0x4c4d8e[_0xe9c4('0x3a')]};return db[_0xe9c4('0x2a')][_0xe9c4('0x1d')](_0x2fa3fe)[_0xe9c4('0x22')](function(_0x168b48){_0x3fcb85[_0xe9c4('0x1d')]=_0x168b48;if(_0x2635ce[_0xe9c4('0x30')][_0xe9c4('0x3e')]){_0x4c4d8e[_0xe9c4('0x3f')]=[{'all':!![]}];}return db[_0xe9c4('0x2a')][_0xe9c4('0x40')](_0x4c4d8e);})[_0xe9c4('0x22')](function(_0x1acb43){_0x3fcb85[_0xe9c4('0x41')]=_0x1acb43;return _0x3fcb85;})[_0xe9c4('0x22')](respondWithFilteredResult(_0x30a0ee,_0x4c4d8e))['catch'](handleError(_0x30a0ee,null));};exports[_0xe9c4('0x42')]=function(_0x385149,_0x18499e){var _0xd572c9={'raw':!![],'where':{'id':_0x385149[_0xe9c4('0x43')]['id']}},_0x1111bc={};_0x1111bc[_0xe9c4('0x2f')]=_[_0xe9c4('0x31')](db[_0xe9c4('0x2a')][_0xe9c4('0x2b')]);_0x1111bc[_0xe9c4('0x30')]=_['keys'](_0x385149['query']);_0x1111bc[_0xe9c4('0x32')]=_[_0xe9c4('0x33')](_0x1111bc[_0xe9c4('0x2f')],_0x1111bc[_0xe9c4('0x30')]);_0xd572c9[_0xe9c4('0x35')]=_[_0xe9c4('0x33')](_0x1111bc['model'],qs[_0xe9c4('0x34')](_0x385149[_0xe9c4('0x30')][_0xe9c4('0x34')]));_0xd572c9[_0xe9c4('0x35')]=_0xd572c9[_0xe9c4('0x35')]['length']?_0xd572c9[_0xe9c4('0x35')]:_0x1111bc['model'];if(_0x385149[_0xe9c4('0x30')]['includeAll']){_0xd572c9[_0xe9c4('0x3f')]=[{'all':!![]}];}_0xd572c9=_[_0xe9c4('0x3c')]({},_0xd572c9,_0x385149[_0xe9c4('0x3d')]);return db[_0xe9c4('0x2a')]['find'](_0xd572c9)['then'](handleEntityNotFound(_0x18499e,null))['then'](respondWithResult(_0x18499e,null))['catch'](handleError(_0x18499e,null));};exports[_0xe9c4('0x44')]=function(_0x506445,_0x2a3926){return db[_0xe9c4('0x2a')][_0xe9c4('0x44')](_0x506445[_0xe9c4('0x45')],{})['then'](respondWithResult(_0x2a3926,0xc9))[_0xe9c4('0x46')](handleError(_0x2a3926,null));};exports['update']=function(_0x570159,_0x14865d){if(_0x570159['body']['id']){delete _0x570159[_0xe9c4('0x45')]['id'];}return db['VoiceTransferReport'][_0xe9c4('0x47')]({'where':{'id':_0x570159[_0xe9c4('0x43')]['id']}})[_0xe9c4('0x22')](handleEntityNotFound(_0x14865d,null))['then'](saveUpdates(_0x570159['body'],null))[_0xe9c4('0x22')](respondWithResult(_0x14865d,null))['catch'](handleError(_0x14865d,null));};exports[_0xe9c4('0x23')]=function(_0x375497,_0x5881f2){return db[_0xe9c4('0x2a')][_0xe9c4('0x47')]({'where':{'id':_0x375497['params']['id']}})[_0xe9c4('0x22')](handleEntityNotFound(_0x5881f2,null))[_0xe9c4('0x22')](removeEntity(_0x5881f2,null))[_0xe9c4('0x46')](handleError(_0x5881f2,null));};exports[_0xe9c4('0x48')]=function(_0xff29ce,_0x49c08e){return db[_0xe9c4('0x2a')][_0xe9c4('0x48')]()['then'](respondWithResult(_0x49c08e,null))[_0xe9c4('0x46')](handleError(_0x49c08e,null));}; \ No newline at end of file +var _0x8424=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','eml-format','rimraf','moment','bluebird','path','ejs','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0x8424,0x10f));var _0x4842=function(_0x566cda,_0x5ef10f){_0x566cda=_0x566cda-0x0;var _0x4c0fd5=_0x8424[_0x566cda];return _0x4c0fd5;};'use strict';var emlformat=require(_0x4842('0x0'));var rimraf=require(_0x4842('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4842('0x2'));var BPromise=require(_0x4842('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4842('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4842('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4842('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4842('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x4842('0x8'));var querystring=require(_0x4842('0x9'));var Papa=require(_0x4842('0xa'));var Redis=require(_0x4842('0xb'));var authService=require(_0x4842('0xc'));var qs=require(_0x4842('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4842('0xe'))(_0x4842('0xf'));var utils=require('../../config/utils');var config=require(_0x4842('0x10'));var licenseUtil=require(_0x4842('0x11'));var db=require(_0x4842('0x12'))['db'];function respondWithStatusCode(_0x3498fd,_0x28457a){_0x28457a=_0x28457a||0xcc;return function(_0x1e1aa4){if(_0x1e1aa4){return _0x3498fd[_0x4842('0x13')](_0x28457a);}return _0x3498fd[_0x4842('0x14')](_0x28457a)[_0x4842('0x15')]();};}function respondWithResult(_0x5a220b,_0x3f1362){_0x3f1362=_0x3f1362||0xc8;return function(_0xbf1d2d){if(_0xbf1d2d){return _0x5a220b[_0x4842('0x14')](_0x3f1362)[_0x4842('0x16')](_0xbf1d2d);}};}function respondWithFilteredResult(_0x180d9b,_0xf89e40){return function(_0x5cd5bb){if(_0x5cd5bb){var _0x2c1caf=typeof _0xf89e40[_0x4842('0x17')]===_0x4842('0x18')&&typeof _0xf89e40[_0x4842('0x19')]===_0x4842('0x18');var _0x46cd41=_0x5cd5bb[_0x4842('0x1a')];var _0x10f3d4=_0x2c1caf?0x0:_0xf89e40[_0x4842('0x17')];var _0x187d69=_0x2c1caf?_0x5cd5bb[_0x4842('0x1a')]:_0xf89e40[_0x4842('0x17')]+_0xf89e40[_0x4842('0x19')];var _0x520e4b;if(_0x187d69>=_0x46cd41){_0x187d69=_0x46cd41;_0x520e4b=0xc8;}else{_0x520e4b=0xce;}_0x180d9b[_0x4842('0x14')](_0x520e4b);return _0x180d9b[_0x4842('0x1b')](_0x4842('0x1c'),_0x10f3d4+'-'+_0x187d69+'/'+_0x46cd41)['json'](_0x5cd5bb);}return null;};}function patchUpdates(_0x585519){return function(_0x2d44dc){try{jsonpatch[_0x4842('0x1d')](_0x2d44dc,_0x585519,!![]);}catch(_0x322d45){return BPromise[_0x4842('0x1e')](_0x322d45);}return _0x2d44dc['save']();};}function saveUpdates(_0x134072,_0x5bd73d){return function(_0x1f6be0){if(_0x1f6be0){return _0x1f6be0[_0x4842('0x1f')](_0x134072)[_0x4842('0x20')](function(_0x1f9d57){return _0x1f9d57;});}return null;};}function removeEntity(_0x2b6734,_0x21221a){return function(_0x536d76){if(_0x536d76){return _0x536d76[_0x4842('0x21')]()[_0x4842('0x20')](function(){_0x2b6734[_0x4842('0x14')](0xcc)[_0x4842('0x15')]();});}};}function handleEntityNotFound(_0x1a01d8,_0x52fab3){return function(_0x25634b){if(!_0x25634b){_0x1a01d8[_0x4842('0x13')](0x194);}return _0x25634b;};}function handleError(_0x3cca0a,_0x23fcea){_0x23fcea=_0x23fcea||0x1f4;return function(_0x4dc12b){logger[_0x4842('0x22')](_0x4dc12b[_0x4842('0x23')]);if(_0x4dc12b[_0x4842('0x24')]){delete _0x4dc12b[_0x4842('0x24')];}_0x3cca0a[_0x4842('0x14')](_0x23fcea)[_0x4842('0x25')](_0x4dc12b);};}exports[_0x4842('0x26')]=function(_0x283732,_0x31ee9e){var _0x3cad5d={},_0x597598={},_0x2992ba={'count':0x0,'rows':[]};var _0x277cee=_['map'](db['VoiceTransferReport'][_0x4842('0x27')],function(_0x2766f6){return{'name':_0x2766f6[_0x4842('0x28')],'type':_0x2766f6[_0x4842('0x29')][_0x4842('0x2a')]};});_0x597598[_0x4842('0x2b')]=_[_0x4842('0x2c')](_0x277cee,_0x4842('0x24'));_0x597598[_0x4842('0x2d')]=_[_0x4842('0x2e')](_0x283732['query']);_0x597598[_0x4842('0x2f')]=_[_0x4842('0x30')](_0x597598[_0x4842('0x2b')],_0x597598['query']);_0x3cad5d[_0x4842('0x31')]=_['intersection'](_0x597598[_0x4842('0x2b')],qs[_0x4842('0x32')](_0x283732[_0x4842('0x2d')][_0x4842('0x32')]));_0x3cad5d[_0x4842('0x31')]=_0x3cad5d[_0x4842('0x31')][_0x4842('0x33')]?_0x3cad5d[_0x4842('0x31')]:_0x597598[_0x4842('0x2b')];if(!_0x283732['query']['hasOwnProperty'](_0x4842('0x34'))){_0x3cad5d[_0x4842('0x19')]=qs[_0x4842('0x19')](_0x283732['query']['limit']);_0x3cad5d[_0x4842('0x17')]=qs['offset'](_0x283732[_0x4842('0x2d')][_0x4842('0x17')]);}_0x3cad5d[_0x4842('0x35')]=qs[_0x4842('0x36')](_0x283732[_0x4842('0x2d')][_0x4842('0x36')]);_0x3cad5d[_0x4842('0x37')]=qs['filters'](_[_0x4842('0x38')](_0x283732['query'],_0x597598[_0x4842('0x2f')]),_0x277cee);if(_0x283732[_0x4842('0x2d')][_0x4842('0x39')]){_0x3cad5d['where']=_[_0x4842('0x3a')](_0x3cad5d[_0x4842('0x37')],{'$or':_[_0x4842('0x2c')](_0x277cee,function(_0x35b3f1){if(_0x35b3f1[_0x4842('0x29')]!==_0x4842('0x3b')){var _0x4dc3b8={};_0x4dc3b8[_0x35b3f1[_0x4842('0x24')]]={'$like':'%'+_0x283732[_0x4842('0x2d')][_0x4842('0x39')]+'%'};return _0x4dc3b8;}})});}_0x3cad5d=_[_0x4842('0x3a')]({},_0x3cad5d,_0x283732[_0x4842('0x3c')]);var _0x448b23={'where':_0x3cad5d['where']};return db[_0x4842('0x3d')]['count'](_0x448b23)[_0x4842('0x20')](function(_0x2a8916){_0x2992ba[_0x4842('0x1a')]=_0x2a8916;if(_0x283732[_0x4842('0x2d')][_0x4842('0x3e')]){_0x3cad5d[_0x4842('0x3f')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x4842('0x40')](_0x3cad5d);})[_0x4842('0x20')](function(_0x3f9d81){_0x2992ba[_0x4842('0x41')]=_0x3f9d81;return _0x2992ba;})[_0x4842('0x20')](respondWithFilteredResult(_0x31ee9e,_0x3cad5d))['catch'](handleError(_0x31ee9e,null));};exports[_0x4842('0x42')]=function(_0x4f8dcf,_0x42023a){var _0x21a05d={'raw':!![],'where':{'id':_0x4f8dcf[_0x4842('0x43')]['id']}},_0x37b10f={};_0x37b10f[_0x4842('0x2b')]=_[_0x4842('0x2e')](db[_0x4842('0x3d')][_0x4842('0x27')]);_0x37b10f[_0x4842('0x2d')]=_[_0x4842('0x2e')](_0x4f8dcf['query']);_0x37b10f[_0x4842('0x2f')]=_['intersection'](_0x37b10f[_0x4842('0x2b')],_0x37b10f[_0x4842('0x2d')]);_0x21a05d['attributes']=_[_0x4842('0x30')](_0x37b10f[_0x4842('0x2b')],qs[_0x4842('0x32')](_0x4f8dcf[_0x4842('0x2d')]['fields']));_0x21a05d[_0x4842('0x31')]=_0x21a05d['attributes'][_0x4842('0x33')]?_0x21a05d['attributes']:_0x37b10f[_0x4842('0x2b')];if(_0x4f8dcf[_0x4842('0x2d')][_0x4842('0x3e')]){_0x21a05d[_0x4842('0x3f')]=[{'all':!![]}];}_0x21a05d=_[_0x4842('0x3a')]({},_0x21a05d,_0x4f8dcf[_0x4842('0x3c')]);return db[_0x4842('0x3d')]['find'](_0x21a05d)['then'](handleEntityNotFound(_0x42023a,null))[_0x4842('0x20')](respondWithResult(_0x42023a,null))[_0x4842('0x44')](handleError(_0x42023a,null));};exports['create']=function(_0x1d31ee,_0x57095d){return db[_0x4842('0x3d')][_0x4842('0x45')](_0x1d31ee['body'],{})['then'](respondWithResult(_0x57095d,0xc9))[_0x4842('0x44')](handleError(_0x57095d,null));};exports[_0x4842('0x1f')]=function(_0x4a734f,_0x2cd9ba){if(_0x4a734f[_0x4842('0x46')]['id']){delete _0x4a734f[_0x4842('0x46')]['id'];}return db['VoiceTransferReport'][_0x4842('0x47')]({'where':{'id':_0x4a734f[_0x4842('0x43')]['id']}})[_0x4842('0x20')](handleEntityNotFound(_0x2cd9ba,null))['then'](saveUpdates(_0x4a734f[_0x4842('0x46')],null))[_0x4842('0x20')](respondWithResult(_0x2cd9ba,null))[_0x4842('0x44')](handleError(_0x2cd9ba,null));};exports[_0x4842('0x21')]=function(_0x4ecf30,_0xe414b3){return db[_0x4842('0x3d')][_0x4842('0x47')]({'where':{'id':_0x4ecf30[_0x4842('0x43')]['id']}})['then'](handleEntityNotFound(_0xe414b3,null))[_0x4842('0x20')](removeEntity(_0xe414b3,null))['catch'](handleError(_0xe414b3,null));};exports[_0x4842('0x48')]=function(_0x2b4e4c,_0x20eb44){return db[_0x4842('0x3d')][_0x4842('0x48')]()[_0x4842('0x20')](respondWithResult(_0x20eb44,null))[_0x4842('0x44')](handleError(_0x20eb44,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index b6ce257..7224cf6 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 _0x4f9b=['api','moment','path','rimraf','./voiceTransferReport.attributes','define','VoiceTransferReport','util','../../config/logger'];(function(_0x1d70eb,_0x34450e){var _0xb3a567=function(_0x4ed96f){while(--_0x4ed96f){_0x1d70eb['push'](_0x1d70eb['shift']());}};_0xb3a567(++_0x34450e);}(_0x4f9b,0x130));var _0xb4f9=function(_0x2676a1,_0x2c0e27){_0x2676a1=_0x2676a1-0x0;var _0x42d2bf=_0x4f9b[_0x2676a1];return _0x42d2bf;};'use strict';var _=require('lodash');var util=require(_0xb4f9('0x0'));var logger=require(_0xb4f9('0x1'))(_0xb4f9('0x2'));var moment=require(_0xb4f9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4f9('0x4'));var rimraf=require(_0xb4f9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb4f9('0x6'));module['exports']=function(_0x4e200c,_0x103d48){return _0x4e200c[_0xb4f9('0x7')](_0xb4f9('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd50f=['bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','report_call_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x116357,_0x4abb1c){var _0x168851=function(_0x3809b7){while(--_0x3809b7){_0x116357['push'](_0x116357['shift']());}};_0x168851(++_0x4abb1c);}(_0xd50f,0x157));var _0xfd50=function(_0xd78b1d,_0x5590d4){_0xd78b1d=_0xd78b1d-0x0;var _0x1c014b=_0xd50f[_0xd78b1d];return _0x1c014b;};'use strict';var _=require(_0xfd50('0x0'));var util=require(_0xfd50('0x1'));var logger=require(_0xfd50('0x2'))(_0xfd50('0x3'));var moment=require(_0xfd50('0x4'));var BPromise=require(_0xfd50('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd50('0x6'));var rimraf=require(_0xfd50('0x7'));var config=require(_0xfd50('0x8'));var attributes=require(_0xfd50('0x9'));module['exports']=function(_0x14b4c0,_0x1fdaeb){return _0x14b4c0[_0xfd50('0xa')]('VoiceTransferReport',attributes,{'tableName':_0xfd50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index a1808bb..bc330bf 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 _0x63eb=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','then','lodash','util','moment'];(function(_0x2df87e,_0x4fcd8a){var _0x4d243f=function(_0x50be07){while(--_0x50be07){_0x2df87e['push'](_0x2df87e['shift']());}};_0x4d243f(++_0x4fcd8a);}(_0x63eb,0x71));var _0xb63e=function(_0x3d08c3,_0x349785){_0x3d08c3=_0x3d08c3-0x0;var _0xda5926=_0x63eb[_0x3d08c3];return _0xda5926;};'use strict';var _=require(_0xb63e('0x0'));var util=require(_0xb63e('0x1'));var moment=require(_0xb63e('0x2'));var BPromise=require(_0xb63e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb63e('0x4'));var db=require(_0xb63e('0x5'))['db'];var utils=require(_0xb63e('0x6'));var logger=require(_0xb63e('0x7'))(_0xb63e('0x8'));var config=require(_0xb63e('0x9'));var jayson=require(_0xb63e('0xa'));var client=jayson[_0xb63e('0xb')][_0xb63e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x442aa9,_0x16b5de,_0x443f15){return new BPromise(function(_0x35c54f,_0x34b454){return client['request'](_0x442aa9,_0x443f15)['then'](function(_0x16b649){logger['info'](_0xb63e('0xd'),_0x16b5de,_0xb63e('0xe'));logger[_0xb63e('0xf')](_0xb63e('0x10'),_0x16b5de,_0xb63e('0xe'),JSON[_0xb63e('0x11')](_0x16b649));if(_0x16b649[_0xb63e('0x12')]){if(_0x16b649[_0xb63e('0x12')][_0xb63e('0x13')]===0x1f4){logger[_0xb63e('0x12')](_0xb63e('0xd'),_0x16b5de,_0x16b649[_0xb63e('0x12')][_0xb63e('0x14')]);return _0x34b454(_0x16b649[_0xb63e('0x12')][_0xb63e('0x14')]);}logger[_0xb63e('0x12')](_0xb63e('0xd'),_0x16b5de,_0x16b649['error'][_0xb63e('0x14')]);return _0x35c54f(_0x16b649[_0xb63e('0x12')][_0xb63e('0x14')]);}else{logger[_0xb63e('0x15')](_0xb63e('0xd'),_0x16b5de,_0xb63e('0xe'));_0x35c54f(_0x16b649['result'][_0xb63e('0x14')]);}})[_0xb63e('0x16')](function(_0x458dff){logger[_0xb63e('0x12')](_0xb63e('0xd'),_0x16b5de,_0x458dff);_0x34b454(_0x458dff);});});}exports[_0xb63e('0x17')]=function(_0x38e10e){var _0x5b5b9c=this;return new Promise(function(_0x558c4e,_0x1bad80){return db[_0xb63e('0x18')]['create'](_0x38e10e[_0xb63e('0x19')],{'raw':_0x38e10e[_0xb63e('0x1a')]?_0x38e10e['options'][_0xb63e('0x1b')]===undefined?!![]:![]:!![]})[_0xb63e('0x1c')](function(_0x591c08){logger[_0xb63e('0x15')](_0xb63e('0x17'),_0x38e10e);logger[_0xb63e('0xf')](_0xb63e('0x17'),_0x38e10e,JSON[_0xb63e('0x11')](_0x591c08));_0x558c4e(_0x591c08);})[_0xb63e('0x16')](function(_0x2e2eff){logger[_0xb63e('0x12')](_0xb63e('0x17'),_0x2e2eff[_0xb63e('0x14')],_0x38e10e);_0x1bad80(_0x5b5b9c['error'](0x1f4,_0x2e2eff['message']));});});}; \ No newline at end of file +var _0x991d=['debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','raw','CreateVoiceTransferReport','stringify','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x130878,_0xed8ad3){var _0x292e68=function(_0x3462d7){while(--_0x3462d7){_0x130878['push'](_0x130878['shift']());}};_0x292e68(++_0xed8ad3);}(_0x991d,0x1ab));var _0xd991=function(_0x522549,_0x2ea72f){_0x522549=_0x522549-0x0;var _0x56add8=_0x991d[_0x522549];return _0x56add8;};'use strict';var _=require(_0xd991('0x0'));var util=require(_0xd991('0x1'));var moment=require(_0xd991('0x2'));var BPromise=require(_0xd991('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd991('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd991('0x5'));var config=require(_0xd991('0x6'));var jayson=require(_0xd991('0x7'));var client=jayson[_0xd991('0x8')][_0xd991('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b6895,_0x2cadd1,_0x3b4c28){return new BPromise(function(_0xda7aea,_0x21bf15){return client[_0xd991('0xa')](_0x2b6895,_0x3b4c28)[_0xd991('0xb')](function(_0x2a3aea){logger[_0xd991('0xc')](_0xd991('0xd'),_0x2cadd1,_0xd991('0xe'));logger[_0xd991('0xf')](_0xd991('0x10'),_0x2cadd1,_0xd991('0xe'),JSON['stringify'](_0x2a3aea));if(_0x2a3aea[_0xd991('0x11')]){if(_0x2a3aea['error'][_0xd991('0x12')]===0x1f4){logger[_0xd991('0x11')](_0xd991('0xd'),_0x2cadd1,_0x2a3aea[_0xd991('0x11')][_0xd991('0x13')]);return _0x21bf15(_0x2a3aea[_0xd991('0x11')][_0xd991('0x13')]);}logger[_0xd991('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x2cadd1,_0x2a3aea[_0xd991('0x11')][_0xd991('0x13')]);return _0xda7aea(_0x2a3aea[_0xd991('0x11')][_0xd991('0x13')]);}else{logger[_0xd991('0xc')](_0xd991('0xd'),_0x2cadd1,'request\x20sent');_0xda7aea(_0x2a3aea[_0xd991('0x14')]['message']);}})[_0xd991('0x15')](function(_0x1bb087){logger[_0xd991('0x11')](_0xd991('0xd'),_0x2cadd1,_0x1bb087);_0x21bf15(_0x1bb087);});});}exports['CreateVoiceTransferReport']=function(_0x2d490e){var _0x566021=this;return new Promise(function(_0x5dbc01,_0x2bb6cc){return db['VoiceTransferReport']['create'](_0x2d490e['body'],{'raw':_0x2d490e[_0xd991('0x16')]?_0x2d490e[_0xd991('0x16')][_0xd991('0x17')]===undefined?!![]:![]:!![]})[_0xd991('0xb')](function(_0x25b49d){logger[_0xd991('0xc')](_0xd991('0x18'),_0x2d490e);logger[_0xd991('0xf')](_0xd991('0x18'),_0x2d490e,JSON[_0xd991('0x19')](_0x25b49d));_0x5dbc01(_0x25b49d);})['catch'](function(_0x57ee74){logger['error'](_0xd991('0x18'),_0x57ee74['message'],_0x2d490e);_0x2bb6cc(_0x566021['error'](0x1f4,_0x57ee74[_0xd991('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 7b192ce..4223b9b 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 _0x264f=['unhold','/calls','calls','transfer','exports','Router','post','/originate','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','answer','hold','/unhold'];(function(_0x11c42b,_0x4e646f){var _0x33d6e8=function(_0x10f235){while(--_0x10f235){_0x11c42b['push'](_0x11c42b['shift']());}};_0x33d6e8(++_0x4e646f);}(_0x264f,0x19d));var _0xf264=function(_0x5923bb,_0x47d8de){_0x5923bb=_0x5923bb-0x0;var _0x779397=_0x264f[_0x5923bb];return _0x779397;};'use strict';var express=require('express');var router=express[_0xf264('0x0')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0xf264('0x1')](_0xf264('0x2'),auth[_0xf264('0x3')](),auth[_0xf264('0x4')](),controller[_0xf264('0x5')]);router['post'](_0xf264('0x6'),auth[_0xf264('0x3')](),auth[_0xf264('0x4')](),controller[_0xf264('0x7')]);router[_0xf264('0x1')](_0xf264('0x8'),auth[_0xf264('0x3')](),auth[_0xf264('0x4')](),controller[_0xf264('0x9')]);router[_0xf264('0x1')]('/hold',auth[_0xf264('0x3')](),auth[_0xf264('0x4')](),controller[_0xf264('0xa')]);router[_0xf264('0x1')](_0xf264('0xb'),auth[_0xf264('0x3')](),auth[_0xf264('0x4')](),controller[_0xf264('0xc')]);router[_0xf264('0x1')](_0xf264('0xd'),auth[_0xf264('0x3')](),auth[_0xf264('0x4')](),controller[_0xf264('0xe')]);router[_0xf264('0x1')]('/transfer',auth[_0xf264('0x3')](),auth[_0xf264('0x4')](),controller[_0xf264('0xf')]);module[_0xf264('0x10')]=router; \ No newline at end of file +var _0x8916=['express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','/hangup','hangup','/answer','answer','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports'];(function(_0x46dab8,_0x4ef8ed){var _0x3d1e3a=function(_0x4579fe){while(--_0x4579fe){_0x46dab8['push'](_0x46dab8['shift']());}};_0x3d1e3a(++_0x4ef8ed);}(_0x8916,0x12c));var _0x6891=function(_0x58cee1,_0x143808){_0x58cee1=_0x58cee1-0x0;var _0x28cb09=_0x8916[_0x58cee1];return _0x28cb09;};'use strict';var express=require(_0x6891('0x0'));var router=express[_0x6891('0x1')]();var auth=require(_0x6891('0x2'));var controller=require(_0x6891('0x3'));router[_0x6891('0x4')](_0x6891('0x5'),auth[_0x6891('0x6')](),auth[_0x6891('0x7')](),controller['originate']);router[_0x6891('0x4')](_0x6891('0x8'),auth[_0x6891('0x6')](),auth[_0x6891('0x7')](),controller[_0x6891('0x9')]);router[_0x6891('0x4')](_0x6891('0xa'),auth[_0x6891('0x6')](),auth[_0x6891('0x7')](),controller[_0x6891('0xb')]);router['post']('/hold',auth['isAuthenticated'](),auth[_0x6891('0x7')](),controller[_0x6891('0xc')]);router[_0x6891('0x4')](_0x6891('0xd'),auth[_0x6891('0x6')](),auth['canUpdate'](),controller[_0x6891('0xe')]);router[_0x6891('0x4')](_0x6891('0xf'),auth[_0x6891('0x6')](),auth[_0x6891('0x7')](),controller[_0x6891('0x10')]);router['post'](_0x6891('0x11'),auth['isAuthenticated'](),auth[_0x6891('0x7')](),controller[_0x6891('0x12')]);module[_0x6891('0x13')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index fb51b4d..a9e4f78 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 _0x39cb=['transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','status','send','NotFound','then','error','code','message','result','catch','User','agent','VoiceChannels','all','rows','UserId','sessionId','length','\x20not\x20found!','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup','hangup\x20fired:','validate','json','webbar:hangup','hangup\x20executed!','answer\x20fired:','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39cb,0x1bd));var _0xb39c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x39cb[_0x3ab51d];return _0x29a04e;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xb39c('0x0'));var db=require(_0xb39c('0x1'))['db'];var config=require('../../config/environment');var util=require(_0xb39c('0x2'));var BPromise=require(_0xb39c('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xb39c('0x4')][_0xb39c('0x5')]({'port':0x232a});var logger=require(_0xb39c('0x6'))(_0xb39c('0x7'));var Redis=require(_0xb39c('0x8'));config['redis']=_[_0xb39c('0x9')](config[_0xb39c('0xa')],{'host':_0xb39c('0xb'),'port':0x18eb});var io=require(_0xb39c('0xc'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],_0xb39c('0xe')]},'callNumber':{'type':_0xb39c('0xf'),'required':[!![],_0xb39c('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb39c('0xe')]},'sessionId':{'type':_0xb39c('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],_0xb39c('0xe')]},'sessionId':{'type':_0xb39c('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],_0xb39c('0xe')]},'sessionId':{'type':_0xb39c('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xb39c('0xf'),'required':[!![],_0xb39c('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb39c('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],_0xb39c('0xe')]},'sessionId':{'type':_0xb39c('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],_0xb39c('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xb39c('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x316c9b,_0x3223f6,_0x10989d){logger[_0xb39c('0x12')](_0x316c9b,_0x3223f6,JSON[_0xb39c('0x13')](_0x10989d));io['to'](_0x316c9b)[_0xb39c('0x14')](_0x3223f6,_0x10989d);}function handleError(_0x1a2f48){return function(_0x4e02cf){console[_0xb39c('0x15')](_0xb39c('0x16'),_0x4e02cf,_0x4e02cf instanceof RangeError);logger['error'](_0x4e02cf[_0xb39c('0x17')]);if(_0x4e02cf instanceof RangeError){if(_0x4e02cf[_0xb39c('0x18')]){delete _0x4e02cf[_0xb39c('0x18')];}_0x1a2f48[_0xb39c('0x19')](0x194)['send'](_0x4e02cf);}else{if(_0x4e02cf[_0xb39c('0x18')]){delete _0x4e02cf[_0xb39c('0x18')];}_0x1a2f48['status'](0x1f4)[_0xb39c('0x1a')](_0x4e02cf);}};}function checkError(){return function(_0x363e52){if(!_0x363e52){throw new RangeError(_0xb39c('0x1b'));}return _0x363e52;};}function respondWithRpcPromise(_0x4ebfca,_0x539d27){return new BPromise(function(_0x2789fd,_0x1a5b9d){var _0x3c8dfd=amiClient;return _0x3c8dfd['request'](_0x4ebfca,_0x539d27)[_0xb39c('0x1c')](function(_0x438207){if(_0x438207[_0xb39c('0x1d')]){if(_0x438207[_0xb39c('0x1d')][_0xb39c('0x1e')]===0x1f4){return _0x1a5b9d(_0x438207['error'][_0xb39c('0x1f')]);}return _0x2789fd(_0x438207[_0xb39c('0x1d')]['message']);}else{_0x2789fd(_0x438207[_0xb39c('0x20')]);}})[_0xb39c('0x21')](function(_0x39116b){_0x1a5b9d(_0x39116b);});});}function getAgent(_0x12be70){return db[_0xb39c('0x22')]['findOne']({'where':{'id':_0x12be70,'role':_0xb39c('0x23')}})[_0xb39c('0x1c')](checkError());}function getAgentCheckSession(_0x132769,_0x4c06fa){return new BPromise(function(_0x41fff2,_0x337532){var _0x52eb5e=respondWithRpcPromise(_0xb39c('0x24'));var _0x4b4458=getAgent(_0x132769);Promise[_0xb39c('0x25')]([_0x52eb5e,_0x4b4458])['then'](function(_0x714d20){var _0x45fed4=_0x714d20[0x0];var _0x59172f=_0x714d20[0x1];var _0x2bc742=_['filter'](_0x45fed4[_0xb39c('0x26')],function(_0x2d2743){return _0x2d2743[_0xb39c('0x27')]==_0x59172f['id']&&_0x2d2743[_0xb39c('0x28')]==_0x4c06fa;});if(_0x2bc742[_0xb39c('0x29')]==0x1){_0x41fff2(_0x59172f);}else{_0x337532(new RangeError('sessionId\x20'+_0x4c06fa+_0xb39c('0x2a')));}});});}exports['originate']=function(_0x351d60,_0x48a888){logger[_0xb39c('0x12')](_0xb39c('0x2b'),_0x351d60[_0xb39c('0x2c')]);var _0x11ad56=originateValidation['validate'](_0x351d60['body']);if(_0x11ad56[_0xb39c('0x29')]>0x0){return _0x48a888[_0xb39c('0x19')](0x190)['json'](_0x11ad56);}var _0x1d7f2a=_0x351d60[_0xb39c('0x2c')][_0xb39c('0x2d')];var _0x1b15e7=_0x351d60[_0xb39c('0x2c')][_0xb39c('0x2e')];var _0x41cdd1=_0x351d60[_0xb39c('0x2c')][_0xb39c('0x2f')];var _0x24e9e8=_0x351d60[_0xb39c('0x2c')][_0xb39c('0x30')];return getAgent(_0x1d7f2a)[_0xb39c('0x1c')](function(_0x2f6b5a){logger[_0xb39c('0x12')](_0xb39c('0x31'),_0x2f6b5a[_0xb39c('0x18')]);emit(util[_0xb39c('0x32')](_0xb39c('0x33'),_0x2f6b5a['name']),_0xb39c('0x34'),{'callNumber':_0x1b15e7,'callerId':_0x41cdd1,'callbackUrl':_0x24e9e8});return _0x48a888[_0xb39c('0x19')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x48a888));};exports[_0xb39c('0x35')]=function(_0x33e468,_0xe6bc2e){logger['info'](_0xb39c('0x36'),_0x33e468[_0xb39c('0x2c')]);var _0x44afba=hangupValidation[_0xb39c('0x37')](_0x33e468[_0xb39c('0x2c')]);if(_0x44afba['length']>0x0){return _0xe6bc2e[_0xb39c('0x19')](0x190)[_0xb39c('0x38')](_0x44afba);}var _0x51b489=_0x33e468[_0xb39c('0x2c')]['userId'];var _0x1ee418=_0x33e468[_0xb39c('0x2c')][_0xb39c('0x28')];return getAgent(_0x51b489)['then'](function(_0x406fc6){logger[_0xb39c('0x12')](_0xb39c('0x31'),_0x406fc6[_0xb39c('0x18')]);emit(util[_0xb39c('0x32')](_0xb39c('0x33'),_0x406fc6[_0xb39c('0x18')]),_0xb39c('0x39'),{'sessionId':_0x1ee418});return _0xe6bc2e[_0xb39c('0x19')](0xc8)[_0xb39c('0x38')]({'error':![],'message':_0xb39c('0x3a')});})[_0xb39c('0x21')](handleError(_0xe6bc2e));};exports['answer']=function(_0x38e8ba,_0xbeb7b3){logger[_0xb39c('0x12')](_0xb39c('0x3b'),_0x38e8ba[_0xb39c('0x2c')]);var _0x390cd7=answerValidation[_0xb39c('0x37')](_0x38e8ba[_0xb39c('0x2c')]);if(_0x390cd7[_0xb39c('0x29')]>0x0){return _0xbeb7b3['status'](0x190)['json'](_0x390cd7);}var _0x2f88c9=_0x38e8ba[_0xb39c('0x2c')]['userId'];var _0x4bc2be=_0x38e8ba[_0xb39c('0x2c')]['sessionId'];return getAgent(_0x2f88c9)[_0xb39c('0x1c')](function(_0x3e0071){logger[_0xb39c('0x12')](_0xb39c('0x31'),_0x3e0071[_0xb39c('0x18')]);emit(util['format'](_0xb39c('0x33'),_0x3e0071[_0xb39c('0x18')]),'webbar:answer',{'sessionId':_0x4bc2be});return _0xbeb7b3['status'](0xc8)[_0xb39c('0x38')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0xbeb7b3));};exports[_0xb39c('0x3c')]=function(_0x2ff5ac,_0x4497a7){logger[_0xb39c('0x12')](_0xb39c('0x3d'),_0x2ff5ac[_0xb39c('0x2c')]);var _0x25ca4e=holdValidation[_0xb39c('0x37')](_0x2ff5ac[_0xb39c('0x2c')]);if(_0x25ca4e[_0xb39c('0x29')]>0x0){return _0x4497a7['status'](0x190)[_0xb39c('0x38')](_0x25ca4e);}var _0x7e9750=_0x2ff5ac[_0xb39c('0x2c')][_0xb39c('0x2d')];var _0x40e1dc=_0x2ff5ac[_0xb39c('0x2c')][_0xb39c('0x28')];return getAgent(_0x7e9750)[_0xb39c('0x1c')](function(_0x38bc36){logger[_0xb39c('0x12')](_0xb39c('0x31'),_0x38bc36[_0xb39c('0x18')]);emit(util[_0xb39c('0x32')](_0xb39c('0x33'),_0x38bc36[_0xb39c('0x18')]),_0xb39c('0x3e'),{'sessionId':_0x40e1dc});return _0x4497a7['status'](0xc8)[_0xb39c('0x38')]({'error':![],'message':_0xb39c('0x3f')});})[_0xb39c('0x21')](handleError(_0x4497a7));};exports[_0xb39c('0x40')]=function(_0xa50077,_0x18db8f){logger[_0xb39c('0x12')](_0xb39c('0x41'),_0xa50077['body']);var _0x4886ab=unholdValidation[_0xb39c('0x37')](_0xa50077[_0xb39c('0x2c')]);if(_0x4886ab['length']>0x0){return _0x18db8f['status'](0x190)[_0xb39c('0x38')](_0x4886ab);}var _0x1d1abf=_0xa50077['body'][_0xb39c('0x2d')];var _0x55b6b1=_0xa50077['body'][_0xb39c('0x28')];return getAgent(_0x1d1abf)['then'](function(_0x2c5434){logger[_0xb39c('0x12')](_0xb39c('0x31'),_0x2c5434[_0xb39c('0x18')]);emit(util[_0xb39c('0x32')](_0xb39c('0x33'),_0x2c5434['name']),_0xb39c('0x42'),{'sessionId':_0x55b6b1});return _0x18db8f[_0xb39c('0x19')](0xc8)[_0xb39c('0x38')]({'error':![],'message':_0xb39c('0x43')});})[_0xb39c('0x21')](handleError(_0x18db8f));};exports['calls']=function(_0x285313,_0x4ab58e){logger[_0xb39c('0x12')](_0xb39c('0x44'),_0x4ab58e[_0xb39c('0x2c')]);var _0x9e4e89=callsValidation[_0xb39c('0x37')](_0x285313[_0xb39c('0x2c')]);if(_0x9e4e89[_0xb39c('0x29')]>0x0){return _0x4ab58e[_0xb39c('0x19')](0x190)[_0xb39c('0x38')](_0x9e4e89);}var _0x3c17d1=_0x285313[_0xb39c('0x2c')][_0xb39c('0x2d')];var _0x2620ee=respondWithRpcPromise(_0xb39c('0x24'));var _0xe31742=getAgent(_0x3c17d1);return Promise[_0xb39c('0x25')]([_0x2620ee,_0xe31742])[_0xb39c('0x1c')](function(_0x3a617e){var _0x18431c=_0x3a617e[0x0];var _0x49f118=_0x3a617e[0x1];var _0x57f2f4=_[_0xb39c('0x45')](_0x18431c[_0xb39c('0x26')],function(_0x52daf6){return _0x52daf6[_0xb39c('0x27')]==_0x49f118['id'];});return _0x4ab58e[_0xb39c('0x19')](0xc8)['json']({'count':_0x57f2f4[_0xb39c('0x29')],'rows':_0x57f2f4});})[_0xb39c('0x21')](handleError(_0x4ab58e));};exports[_0xb39c('0x46')]=function(_0x19647a,_0x453a21){logger[_0xb39c('0x12')]('conference\x20fired:',_0x19647a[_0xb39c('0x2c')]);var _0x384f4f=conferenceValidation[_0xb39c('0x37')](_0x19647a[_0xb39c('0x2c')]);if(_0x384f4f[_0xb39c('0x29')]>0x0){return _0x453a21[_0xb39c('0x19')](0x190)[_0xb39c('0x38')](_0x384f4f);}var _0x47dcda=_0x19647a[_0xb39c('0x2c')][_0xb39c('0x2d')];return getAgent(_0x47dcda)[_0xb39c('0x1c')](function(_0x17b0c4){logger[_0xb39c('0x12')]('entityFound:',_0x17b0c4['name']);emit(util[_0xb39c('0x32')](_0xb39c('0x33'),_0x17b0c4[_0xb39c('0x18')]),'webbar:conference');return _0x453a21[_0xb39c('0x19')](0xc8)['json']({'error':![],'message':_0xb39c('0x47')});})['catch'](handleError(_0x453a21));};exports[_0xb39c('0x48')]=function(_0x82b625,_0x6aa1ee){logger['info'](_0xb39c('0x49'),_0x82b625[_0xb39c('0x2c')]);var _0x14b448=transferValidation[_0xb39c('0x37')](_0x82b625[_0xb39c('0x2c')]);if(_0x14b448[_0xb39c('0x29')]>0x0){return _0x6aa1ee[_0xb39c('0x19')](0x190)[_0xb39c('0x38')](_0x14b448);}var _0x14dce7=_0x82b625[_0xb39c('0x2c')][_0xb39c('0x2d')];var _0x227152=_0x82b625[_0xb39c('0x2c')][_0xb39c('0x28')];var _0x1b2138=_0x82b625[_0xb39c('0x2c')][_0xb39c('0x4a')];return getAgent(_0x14dce7)['then'](function(_0x2d936f){logger[_0xb39c('0x12')](_0xb39c('0x31'),_0x2d936f['name']);emit(util[_0xb39c('0x32')]('user:%s',_0x2d936f['name']),_0xb39c('0x4b'),{'sessionId':_0x227152,'transferNumber':_0x1b2138});return _0x6aa1ee[_0xb39c('0x19')](0xc8)[_0xb39c('0x38')]({'error':![],'message':_0xb39c('0x4c')});})[_0xb39c('0x21')](handleError(_0x6aa1ee));}; \ No newline at end of file +var _0xaa7c=['answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','bluebird','jayson/promise','http','../../config/logger','webbarapi','ioredis','redis','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer'];(function(_0x51063d,_0x1a8eba){var _0x3b3e89=function(_0x258cc6){while(--_0x258cc6){_0x51063d['push'](_0x51063d['shift']());}};_0x3b3e89(++_0x1a8eba);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x2e34e7,_0x1bf85b){_0x2e34e7=_0x2e34e7-0x0;var _0x2b39d4=_0xaa7c[_0x2e34e7];return _0x2b39d4;};'use strict';var path=require(_0xcaa7('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0xcaa7('0x1'));var jayson=require(_0xcaa7('0x2'));var amiClient=jayson['client'][_0xcaa7('0x3')]({'port':0x232a});var logger=require(_0xcaa7('0x4'))(_0xcaa7('0x5'));var Redis=require(_0xcaa7('0x6'));config[_0xcaa7('0x7')]=_['defaults'](config[_0xcaa7('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcaa7('0x7')]));var Schema=require(_0xcaa7('0x8'));var originateValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xcaa7('0xa'),'required':[!![],_0xcaa7('0xb')]},'callerId':{'type':_0xcaa7('0xa')},'callbackUrl':{'type':_0xcaa7('0xa')}});var hangupValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xcaa7('0xa'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]},'sessionId':{'type':_0xcaa7('0xa'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]},'sessionId':{'type':'string','required':[!![],_0xcaa7('0xd')]},'transferNumber':{'type':_0xcaa7('0xa'),'required':[!![],_0xcaa7('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]},'sessionId':{'type':_0xcaa7('0xa'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xcaa7('0x9'),'required':[!![],_0xcaa7('0xc')]}});function emit(_0x49a218,_0x98c3e2,_0x13f970){logger[_0xcaa7('0xf')](_0x49a218,_0x98c3e2,JSON[_0xcaa7('0x10')](_0x13f970));io['to'](_0x49a218)[_0xcaa7('0x11')](_0x98c3e2,_0x13f970);}function handleError(_0xc46e37){return function(_0x20ede0){console['log']('handleError:',_0x20ede0,_0x20ede0 instanceof RangeError);logger[_0xcaa7('0x12')](_0x20ede0[_0xcaa7('0x13')]);if(_0x20ede0 instanceof RangeError){if(_0x20ede0[_0xcaa7('0x14')]){delete _0x20ede0[_0xcaa7('0x14')];}_0xc46e37[_0xcaa7('0x15')](0x194)[_0xcaa7('0x16')](_0x20ede0);}else{if(_0x20ede0[_0xcaa7('0x14')]){delete _0x20ede0['name'];}_0xc46e37[_0xcaa7('0x15')](0x1f4)[_0xcaa7('0x16')](_0x20ede0);}};}function checkError(){return function(_0x1aa4d2){if(!_0x1aa4d2){throw new RangeError(_0xcaa7('0x17'));}return _0x1aa4d2;};}function respondWithRpcPromise(_0x31ce99,_0x2fcdf7){return new BPromise(function(_0x3119d5,_0x4259b7){var _0x2a9a79=amiClient;return _0x2a9a79[_0xcaa7('0x18')](_0x31ce99,_0x2fcdf7)[_0xcaa7('0x19')](function(_0x140c5a){if(_0x140c5a[_0xcaa7('0x12')]){if(_0x140c5a['error'][_0xcaa7('0x1a')]===0x1f4){return _0x4259b7(_0x140c5a[_0xcaa7('0x12')]['message']);}return _0x3119d5(_0x140c5a[_0xcaa7('0x12')][_0xcaa7('0x1b')]);}else{_0x3119d5(_0x140c5a[_0xcaa7('0x1c')]);}})[_0xcaa7('0x1d')](function(_0x58384f){_0x4259b7(_0x58384f);});});}function getAgent(_0x5d4e7e){return db[_0xcaa7('0x1e')][_0xcaa7('0x1f')]({'where':{'id':_0x5d4e7e,'role':_0xcaa7('0x20')}})[_0xcaa7('0x19')](checkError());}function getAgentCheckSession(_0x4391a9,_0x4ec9e9){return new BPromise(function(_0x1a2577,_0x4c6e87){var _0x5b4914=respondWithRpcPromise(_0xcaa7('0x21'));var _0x492362=getAgent(_0x4391a9);Promise[_0xcaa7('0x22')]([_0x5b4914,_0x492362])[_0xcaa7('0x19')](function(_0x748bda){var _0x1c4200=_0x748bda[0x0];var _0x248ca5=_0x748bda[0x1];var _0x292222=_[_0xcaa7('0x23')](_0x1c4200[_0xcaa7('0x24')],function(_0x492843){return _0x492843[_0xcaa7('0x25')]==_0x248ca5['id']&&_0x492843[_0xcaa7('0x26')]==_0x4ec9e9;});if(_0x292222[_0xcaa7('0x27')]==0x1){_0x1a2577(_0x248ca5);}else{_0x4c6e87(new RangeError(_0xcaa7('0x28')+_0x4ec9e9+_0xcaa7('0x29')));}});});}exports['originate']=function(_0x25c847,_0x394da5){logger[_0xcaa7('0xf')](_0xcaa7('0x2a'),_0x25c847[_0xcaa7('0x2b')]);var _0x483b44=originateValidation[_0xcaa7('0x8')](_0x25c847['body']);if(_0x483b44[_0xcaa7('0x27')]>0x0){return _0x394da5[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x483b44);}var _0x59f2c7=_0x25c847[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0x133114=_0x25c847[_0xcaa7('0x2b')][_0xcaa7('0x2e')];var _0x27be59=_0x25c847['body'][_0xcaa7('0x2f')];var _0x2b6708=_0x25c847['body'][_0xcaa7('0x30')];return getAgent(_0x59f2c7)[_0xcaa7('0x19')](function(_0x444add){logger[_0xcaa7('0xf')]('entityFound:',_0x444add[_0xcaa7('0x14')]);emit(util[_0xcaa7('0x31')](_0xcaa7('0x32'),_0x444add[_0xcaa7('0x14')]),_0xcaa7('0x33'),{'callNumber':_0x133114,'callerId':_0x27be59,'callbackUrl':_0x2b6708});return _0x394da5[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x34')});})[_0xcaa7('0x1d')](handleError(_0x394da5));};exports[_0xcaa7('0x35')]=function(_0xf55432,_0x266d5f){logger['info'](_0xcaa7('0x36'),_0xf55432[_0xcaa7('0x2b')]);var _0x2a57ed=hangupValidation[_0xcaa7('0x8')](_0xf55432[_0xcaa7('0x2b')]);if(_0x2a57ed['length']>0x0){return _0x266d5f[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x2a57ed);}var _0x387b12=_0xf55432['body'][_0xcaa7('0x2d')];var _0x3016f1=_0xf55432[_0xcaa7('0x2b')][_0xcaa7('0x26')];return getAgent(_0x387b12)['then'](function(_0x3b7884){logger['info'](_0xcaa7('0x37'),_0x3b7884['name']);emit(util[_0xcaa7('0x31')]('user:%s',_0x3b7884['name']),_0xcaa7('0x38'),{'sessionId':_0x3016f1});return _0x266d5f[_0xcaa7('0x15')](0xc8)['json']({'error':![],'message':_0xcaa7('0x39')});})[_0xcaa7('0x1d')](handleError(_0x266d5f));};exports[_0xcaa7('0x3a')]=function(_0x202572,_0x341e41){logger[_0xcaa7('0xf')](_0xcaa7('0x3b'),_0x202572[_0xcaa7('0x2b')]);var _0x55caaa=answerValidation[_0xcaa7('0x8')](_0x202572[_0xcaa7('0x2b')]);if(_0x55caaa[_0xcaa7('0x27')]>0x0){return _0x341e41[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x55caaa);}var _0x3d6c26=_0x202572['body'][_0xcaa7('0x2d')];var _0x3da46d=_0x202572[_0xcaa7('0x2b')][_0xcaa7('0x26')];return getAgent(_0x3d6c26)[_0xcaa7('0x19')](function(_0x4df9a6){logger[_0xcaa7('0xf')](_0xcaa7('0x37'),_0x4df9a6[_0xcaa7('0x14')]);emit(util['format'](_0xcaa7('0x32'),_0x4df9a6['name']),_0xcaa7('0x3c'),{'sessionId':_0x3da46d});return _0x341e41[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x3d')});})[_0xcaa7('0x1d')](handleError(_0x341e41));};exports[_0xcaa7('0x3e')]=function(_0x3827b8,_0x53a482){logger['info'](_0xcaa7('0x3f'),_0x3827b8['body']);var _0xa2dbac=holdValidation['validate'](_0x3827b8[_0xcaa7('0x2b')]);if(_0xa2dbac['length']>0x0){return _0x53a482[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0xa2dbac);}var _0x1304a1=_0x3827b8[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0x46c790=_0x3827b8['body']['sessionId'];return getAgent(_0x1304a1)[_0xcaa7('0x19')](function(_0x3a5f1f){logger['info'](_0xcaa7('0x37'),_0x3a5f1f[_0xcaa7('0x14')]);emit(util[_0xcaa7('0x31')](_0xcaa7('0x32'),_0x3a5f1f[_0xcaa7('0x14')]),_0xcaa7('0x40'),{'sessionId':_0x46c790});return _0x53a482[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x41')});})[_0xcaa7('0x1d')](handleError(_0x53a482));};exports[_0xcaa7('0x42')]=function(_0x3cc7ae,_0x6dfe9e){logger[_0xcaa7('0xf')](_0xcaa7('0x43'),_0x3cc7ae[_0xcaa7('0x2b')]);var _0x5dcc42=unholdValidation[_0xcaa7('0x8')](_0x3cc7ae['body']);if(_0x5dcc42[_0xcaa7('0x27')]>0x0){return _0x6dfe9e[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x5dcc42);}var _0x3e88bb=_0x3cc7ae[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0x1a2e55=_0x3cc7ae[_0xcaa7('0x2b')][_0xcaa7('0x26')];return getAgent(_0x3e88bb)[_0xcaa7('0x19')](function(_0x1df544){logger['info'](_0xcaa7('0x37'),_0x1df544[_0xcaa7('0x14')]);emit(util[_0xcaa7('0x31')]('user:%s',_0x1df544[_0xcaa7('0x14')]),'webbar:unhold',{'sessionId':_0x1a2e55});return _0x6dfe9e[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x44')});})[_0xcaa7('0x1d')](handleError(_0x6dfe9e));};exports['calls']=function(_0x13c14b,_0x1da84b){logger[_0xcaa7('0xf')](_0xcaa7('0x45'),_0x1da84b[_0xcaa7('0x2b')]);var _0x2d219a=callsValidation[_0xcaa7('0x8')](_0x13c14b[_0xcaa7('0x2b')]);if(_0x2d219a['length']>0x0){return _0x1da84b[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x2d219a);}var _0x42795f=_0x13c14b[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0xb7a21b=respondWithRpcPromise('VoiceChannels');var _0xcf623b=getAgent(_0x42795f);return Promise[_0xcaa7('0x22')]([_0xb7a21b,_0xcf623b])['then'](function(_0x9cb6ca){var _0x1a4a4c=_0x9cb6ca[0x0];var _0x39558c=_0x9cb6ca[0x1];var _0x48272e=_[_0xcaa7('0x23')](_0x1a4a4c[_0xcaa7('0x24')],function(_0x49cfd6){return _0x49cfd6[_0xcaa7('0x25')]==_0x39558c['id'];});return _0x1da84b[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'count':_0x48272e[_0xcaa7('0x27')],'rows':_0x48272e});})[_0xcaa7('0x1d')](handleError(_0x1da84b));};exports[_0xcaa7('0x46')]=function(_0x3d4743,_0x206df4){logger[_0xcaa7('0xf')](_0xcaa7('0x47'),_0x3d4743[_0xcaa7('0x2b')]);var _0x994af2=conferenceValidation[_0xcaa7('0x8')](_0x3d4743[_0xcaa7('0x2b')]);if(_0x994af2[_0xcaa7('0x27')]>0x0){return _0x206df4[_0xcaa7('0x15')](0x190)[_0xcaa7('0x2c')](_0x994af2);}var _0x145444=_0x3d4743['body'][_0xcaa7('0x2d')];return getAgent(_0x145444)['then'](function(_0x20b9f4){logger[_0xcaa7('0xf')](_0xcaa7('0x37'),_0x20b9f4['name']);emit(util[_0xcaa7('0x31')](_0xcaa7('0x32'),_0x20b9f4[_0xcaa7('0x14')]),_0xcaa7('0x48'));return _0x206df4[_0xcaa7('0x15')](0xc8)[_0xcaa7('0x2c')]({'error':![],'message':_0xcaa7('0x49')});})[_0xcaa7('0x1d')](handleError(_0x206df4));};exports[_0xcaa7('0x4a')]=function(_0x75be2c,_0x525dfb){logger[_0xcaa7('0xf')](_0xcaa7('0x4b'),_0x75be2c['body']);var _0x5ce1e9=transferValidation[_0xcaa7('0x8')](_0x75be2c['body']);if(_0x5ce1e9[_0xcaa7('0x27')]>0x0){return _0x525dfb['status'](0x190)[_0xcaa7('0x2c')](_0x5ce1e9);}var _0x4b87f5=_0x75be2c[_0xcaa7('0x2b')][_0xcaa7('0x2d')];var _0x1645f2=_0x75be2c[_0xcaa7('0x2b')][_0xcaa7('0x26')];var _0x43e4f6=_0x75be2c[_0xcaa7('0x2b')][_0xcaa7('0x4c')];return getAgent(_0x4b87f5)[_0xcaa7('0x19')](function(_0x34d5df){logger['info'](_0xcaa7('0x37'),_0x34d5df[_0xcaa7('0x14')]);emit(util[_0xcaa7('0x31')](_0xcaa7('0x32'),_0x34d5df[_0xcaa7('0x14')]),_0xcaa7('0x4d'),{'sessionId':_0x1645f2,'transferNumber':_0x43e4f6});return _0x525dfb[_0xcaa7('0x15')](0xc8)['json']({'error':![],'message':_0xcaa7('0x4e')});})[_0xcaa7('0x1d')](handleError(_0x525dfb));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index b751150..d6de27c 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 _0xc2c7=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x14fe1a,_0x5bc7c8){var _0x540aa8=function(_0x175327){while(--_0x175327){_0x14fe1a['push'](_0x14fe1a['shift']());}};_0x540aa8(++_0x5bc7c8);}(_0xc2c7,0x134));var _0x7c2c=function(_0x528241,_0xf2825f){_0x528241=_0x528241-0x0;var _0x497cf0=_0xc2c7[_0x528241];return _0x497cf0;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['get'](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x8')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x8')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x13')]);router[_0x7c2c('0x8')](_0x7c2c('0x14'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x15')]);router[_0x7c2c('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7c2c('0x16')](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller['addDisposition']);router[_0x7c2c('0x16')](_0x7c2c('0x10'),auth['isAuthenticated'](),controller[_0x7c2c('0x17')]);router['post'](_0x7c2c('0x12'),auth['isAuthenticated'](),controller[_0x7c2c('0x18')]);router[_0x7c2c('0x16')](_0x7c2c('0x14'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x19')]);router[_0x7c2c('0x16')](_0x7c2c('0x1a'),controller[_0x7c2c('0x1b')]);router[_0x7c2c('0x16')](_0x7c2c('0x1c'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1d')]);router['put'](_0x7c2c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7c2c('0x1e')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1f')]);router[_0x7c2c('0x1e')](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller['removeDispositions']);router[_0x7c2c('0x1e')]('/:id/canned_answers',auth[_0x7c2c('0x9')](),controller['removeAnswers']);router[_0x7c2c('0x1e')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x1a85=['removeAgents','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addAnswer','addApplications','/:id/notify','/:id/send','send','put','/:id','update','destroy','delete','removeAnswers'];(function(_0x18e9d8,_0x5c798d){var _0x5c6ec3=function(_0x17d61a){while(--_0x17d61a){_0x18e9d8['push'](_0x18e9d8['shift']());}};_0x5c6ec3(++_0x5c798d);}(_0x1a85,0x178));var _0x51a8=function(_0x5c6aeb,_0x1a3eda){_0x5c6aeb=_0x5c6aeb-0x0;var _0x518281=_0x1a85[_0x5c6aeb];return _0x518281;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./whatsappAccount.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0x6')](_0x51a8('0xb'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0x6')](_0x51a8('0xd'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xe')]);router[_0x51a8('0x6')](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x10')]);router[_0x51a8('0x6')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x12')]);router['post']('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0x13')]);router[_0x51a8('0x14')]('/:id/dispositions',auth[_0x51a8('0x9')](),controller['addDisposition']);router[_0x51a8('0x14')](_0x51a8('0xd'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x15')]);router[_0x51a8('0x14')](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller['addAgents']);router[_0x51a8('0x14')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x16')]);router[_0x51a8('0x14')](_0x51a8('0x17'),controller['notify']);router[_0x51a8('0x14')](_0x51a8('0x18'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x19')]);router[_0x51a8('0x1a')](_0x51a8('0x1b'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x1c')]);router['delete'](_0x51a8('0x1b'),auth['isAuthenticated'](),controller[_0x51a8('0x1d')]);router[_0x51a8('0x1e')](_0x51a8('0xb'),auth[_0x51a8('0x9')](),controller['removeDispositions']);router[_0x51a8('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x51a8('0x1f')]);router['delete'](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x20')]);module[_0x51a8('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 30eb2ef..ba9b7aa 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 _0xdc2f=['STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name'];(function(_0x418650,_0x408171){var _0x3b2f27=function(_0x53c192){while(--_0x53c192){_0x418650['push'](_0x418650['shift']());}};_0x3b2f27(++_0x408171);}(_0xdc2f,0x182));var _0xfdc2=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xdc2f[_0x1a9204];return _0x17ca68;};'use strict';var Sequelize=require(_0xfdc2('0x0'));var rs=require(_0xfdc2('0x1'));module[_0xfdc2('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xfdc2('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xfdc2('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0xfdc2('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0xfdc2('0x4')],'defaultValue':function(){return rs[_0xfdc2('0x5')]();}},'phone':{'type':Sequelize[_0xfdc2('0x4')]},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xfdc2('0x4')]},'notificationTemplate':{'type':Sequelize[_0xfdc2('0x6')],'defaultValue':function(){return _0xfdc2('0x7');}},'notificationSound':{'type':Sequelize[_0xfdc2('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xfdc2('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfdc2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfdc2('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfdc2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xfdc2('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xfdc2('0x8')],'defaultValue':![],'comment':_0xfdc2('0xb'),'set':function(_0xd7922b){if(!_0xd7922b){this[_0xfdc2('0xc')](_0xfdc2('0xd'),null);}this[_0xfdc2('0xc')](_0xfdc2('0xe'),_0xd7922b);}},'description':{'type':Sequelize[_0xfdc2('0x4')]}}; \ No newline at end of file +var _0xa5ff=['INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x5376b5,_0xbb66e7){var _0x61aa59=function(_0x1ecf4d){while(--_0x1ecf4d){_0x5376b5['push'](_0x5376b5['shift']());}};_0x61aa59(++_0xbb66e7);}(_0xa5ff,0x12f));var _0xfa5f=function(_0x3b21cb,_0x37beff){_0x3b21cb=_0x3b21cb-0x0;var _0x1297be=_0xa5ff[_0x3b21cb];return _0x1297be;};'use strict';var Sequelize=require(_0xfa5f('0x0'));var rs=require(_0xfa5f('0x1'));module['exports']={'name':{'type':Sequelize[_0xfa5f('0x2')],'unique':_0xfa5f('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xfa5f('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xfa5f('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xfa5f('0x2')],'defaultValue':function(){return rs[_0xfa5f('0x4')]();}},'phone':{'type':Sequelize[_0xfa5f('0x2')]},'type':{'type':Sequelize['ENUM'](_0xfa5f('0x5'))},'accountSid':{'type':Sequelize[_0xfa5f('0x2')]},'authToken':{'type':Sequelize[_0xfa5f('0x2')]},'notificationTemplate':{'type':Sequelize[_0xfa5f('0x6')],'defaultValue':function(){return _0xfa5f('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xfa5f('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfa5f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfa5f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfa5f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfa5f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfa5f('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xfa5f('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4af2e1){if(!_0x4af2e1){this[_0xfa5f('0xa')](_0xfa5f('0xb'),null);}this[_0xfa5f('0xa')](_0xfa5f('0xc'),_0x4af2e1);}},'description':{'type':Sequelize[_0xfa5f('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8fac3bc..c097c66 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 _0xefbf=['\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','./whatsappAccount.socket','register','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','update','get','WhatsappAccounts','destroy','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','include','findAll','rows','show','params','Pause','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','describe','WhatsappAccountId','getDispositions','Disposition','hasOwnProperty','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','applications','orderBy','account','ValidationError','difference','updatedAt','CompanyId','mobile','twilio','from','From','replace','whatsapp:','messageId','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','ListId','CmContact','Contacts','contact','WhatsappInteraction','interaction','autoclose','push','close','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0xefbf,0xbc));var _0xfefb=function(_0x2e4797,_0x29e4be){_0x2e4797=_0x2e4797-0x0;var _0x1efe7e=_0xefbf[_0x2e4797];return _0x1efe7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfefb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfefb('0x1'));var rp=require(_0xfefb('0x2'));var moment=require(_0xfefb('0x3'));var BPromise=require(_0xfefb('0x4'));var Mustache=require('mustache');var util=require(_0xfefb('0x5'));var path=require(_0xfefb('0x6'));var sox=require(_0xfefb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfefb('0x8'));var crypto=require(_0xfefb('0x9'));var jsforce=require(_0xfefb('0xa'));var deskjs=require(_0xfefb('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfefb('0xc'));var Papa=require(_0xfefb('0xd'));var Redis=require(_0xfefb('0xe'));var authService=require(_0xfefb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfefb('0x10'));var hardwareService=require(_0xfefb('0x11'));var logger=require(_0xfefb('0x12'))(_0xfefb('0x13'));var utils=require(_0xfefb('0x14'));var config=require(_0xfefb('0x15'));var licenseUtil=require(_0xfefb('0x16'));var db=require(_0xfefb('0x17'))['db'];config['redis']=_[_0xfefb('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfefb('0x19'))(new Redis(config['redis']));require(_0xfefb('0x1a'))[_0xfefb('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xfefb('0x1c')][_0xfefb('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5b98e4,_0x9ed3f2,_0x6b5d1f,_0x191611){return new BPromise(function(_0x14a04e,_0x14ab75){var _0x54377e=_0x191611||client;return _0x54377e['request'](_0x5b98e4,_0x6b5d1f)[_0xfefb('0x1e')](function(_0x6d82ef){logger[_0xfefb('0x1f')](_0xfefb('0x20'),_0x9ed3f2,_0xfefb('0x21'));logger[_0xfefb('0x22')](_0xfefb('0x23'),_0x9ed3f2,_0xfefb('0x21'),JSON[_0xfefb('0x24')](_0x6d82ef));if(_0x6d82ef['error']){if(_0x6d82ef[_0xfefb('0x25')][_0xfefb('0x26')]===0x1f4){logger[_0xfefb('0x25')](_0xfefb('0x20'),_0x9ed3f2,_0x6d82ef[_0xfefb('0x25')][_0xfefb('0x27')]);return _0x14ab75(_0x6d82ef[_0xfefb('0x25')][_0xfefb('0x27')]);}logger['error'](_0xfefb('0x20'),_0x9ed3f2,_0x6d82ef['error'][_0xfefb('0x27')]);return _0x14a04e(_0x6d82ef[_0xfefb('0x25')]['message']);}else{logger['info'](_0xfefb('0x20'),_0x9ed3f2,'request\x20sent');_0x14a04e(_0x6d82ef[_0xfefb('0x28')][_0xfefb('0x27')]);}})[_0xfefb('0x29')](function(_0xe487bf){logger[_0xfefb('0x25')](_0xfefb('0x20'),_0x9ed3f2,_0xe487bf);_0x14ab75(_0xe487bf);});});}function respondWithStatusCode(_0x3c8c1c,_0x11ba70){_0x11ba70=_0x11ba70||0xcc;return function(_0x3be2c5){if(_0x3be2c5){return _0x3c8c1c[_0xfefb('0x2a')](_0x11ba70);}return _0x3c8c1c['status'](_0x11ba70)[_0xfefb('0x2b')]();};}function respondWithResult(_0x100c26,_0x25cda8){_0x25cda8=_0x25cda8||0xc8;return function(_0x21e9c8){if(_0x21e9c8){return _0x100c26[_0xfefb('0x2c')](_0x25cda8)['json'](_0x21e9c8);}};}function respondWithFilteredResult(_0x217dd8,_0x2531d6){return function(_0x497c9b){if(_0x497c9b){var _0xef995c=typeof _0x2531d6[_0xfefb('0x2d')]===_0xfefb('0x2e')&&typeof _0x2531d6[_0xfefb('0x2f')]==='undefined';var _0x11639e=_0x497c9b[_0xfefb('0x30')];var _0x42ce2a=_0xef995c?0x0:_0x2531d6['offset'];var _0x5e6c6c=_0xef995c?_0x497c9b[_0xfefb('0x30')]:_0x2531d6['offset']+_0x2531d6[_0xfefb('0x2f')];var _0x553897;if(_0x5e6c6c>=_0x11639e){_0x5e6c6c=_0x11639e;_0x553897=0xc8;}else{_0x553897=0xce;}_0x217dd8[_0xfefb('0x2c')](_0x553897);return _0x217dd8['set']('Content-Range',_0x42ce2a+'-'+_0x5e6c6c+'/'+_0x11639e)[_0xfefb('0x31')](_0x497c9b);}return null;};}function patchUpdates(_0x44236f){return function(_0x222460){try{jsonpatch[_0xfefb('0x32')](_0x222460,_0x44236f,!![]);}catch(_0x4fa013){return BPromise[_0xfefb('0x33')](_0x4fa013);}return _0x222460[_0xfefb('0x34')]();};}function saveUpdates(_0x21b82b,_0x176041){return function(_0xda4244){if(_0xda4244){return _0xda4244[_0xfefb('0x35')](_0x21b82b)[_0xfefb('0x1e')](function(_0x168e06){return _0x168e06;});}return null;};}function removeEntity(_0x98ff3e,_0x4e2107){return function(_0x3da4ba){if(_0x3da4ba){return _0x3da4ba['destroy']()[_0xfefb('0x1e')](function(){var _0x4b2ce9=_0x3da4ba[_0xfefb('0x36')]({'plain':!![]});var _0x49b0a2=_0xfefb('0x37');return db['UserProfileResource'][_0xfefb('0x38')]({'where':{'type':_0x49b0a2,'resourceId':_0x4b2ce9['id']}})['then'](function(){return _0x3da4ba;});})['then'](function(){_0x98ff3e[_0xfefb('0x2c')](0xcc)[_0xfefb('0x2b')]();});}};}function handleEntityNotFound(_0x9d154a,_0x361e7d){return function(_0x385f73){if(!_0x385f73){_0x9d154a[_0xfefb('0x2a')](0x194);}return _0x385f73;};}function handleError(_0x2cda06,_0x17ee67){_0x17ee67=_0x17ee67||0x1f4;return function(_0x1e4314){logger[_0xfefb('0x25')](_0x1e4314['stack']);if(_0x1e4314[_0xfefb('0x39')]){delete _0x1e4314['name'];}_0x2cda06[_0xfefb('0x2c')](_0x17ee67)[_0xfefb('0x3a')](_0x1e4314);};}exports[_0xfefb('0x3b')]=function(_0x397373,_0x2afc74){var _0x563a36={'include':[{'model':db['Pause'],'as':_0xfefb('0x3c')}]},_0x5efeca={},_0x3a5781={'count':0x0,'rows':[]};var _0x54830d=_[_0xfefb('0x3d')](db[_0xfefb('0x3e')]['rawAttributes'],function(_0x2ac3a4){return{'name':_0x2ac3a4[_0xfefb('0x3f')],'type':_0x2ac3a4[_0xfefb('0x40')][_0xfefb('0x41')]};});_0x5efeca[_0xfefb('0x42')]=_[_0xfefb('0x3d')](_0x54830d,_0xfefb('0x39'));_0x5efeca[_0xfefb('0x43')]=_[_0xfefb('0x44')](_0x397373[_0xfefb('0x43')]);_0x5efeca[_0xfefb('0x45')]=_[_0xfefb('0x46')](_0x5efeca[_0xfefb('0x42')],_0x5efeca[_0xfefb('0x43')]);_0x563a36[_0xfefb('0x47')]=_['intersection'](_0x5efeca['model'],qs['fields'](_0x397373[_0xfefb('0x43')][_0xfefb('0x48')]));_0x563a36['attributes']=_0x563a36['attributes'][_0xfefb('0x49')]?_0x563a36[_0xfefb('0x47')]:_0x5efeca[_0xfefb('0x42')];if(!_0x397373['query']['hasOwnProperty'](_0xfefb('0x4a'))){_0x563a36[_0xfefb('0x2f')]=qs['limit'](_0x397373[_0xfefb('0x43')][_0xfefb('0x2f')]);_0x563a36[_0xfefb('0x2d')]=qs[_0xfefb('0x2d')](_0x397373[_0xfefb('0x43')][_0xfefb('0x2d')]);}_0x563a36[_0xfefb('0x4b')]=qs['sort'](_0x397373[_0xfefb('0x43')]['sort']);_0x563a36[_0xfefb('0x4c')]=qs[_0xfefb('0x45')](_[_0xfefb('0x4d')](_0x397373['query'],_0x5efeca[_0xfefb('0x45')]),_0x54830d);if(_0x397373[_0xfefb('0x43')][_0xfefb('0x4e')]){_0x563a36['where']=_[_0xfefb('0x4f')](_0x563a36[_0xfefb('0x4c')],{'$or':_['map'](_0x54830d,function(_0x3ac236){if(_0x3ac236[_0xfefb('0x40')]!=='VIRTUAL'){var _0x1d5f95={};_0x1d5f95[_0x3ac236[_0xfefb('0x39')]]={'$like':'%'+_0x397373[_0xfefb('0x43')]['filter']+'%'};return _0x1d5f95;}})});}_0x563a36=_['merge']({},_0x563a36,_0x397373['options']);var _0x1184b7={'where':_0x563a36[_0xfefb('0x4c')]};return db[_0xfefb('0x3e')][_0xfefb('0x30')](_0x1184b7)[_0xfefb('0x1e')](function(_0x2d2fa1){_0x3a5781[_0xfefb('0x30')]=_0x2d2fa1;if(_0x397373[_0xfefb('0x43')]['includeAll']){_0x563a36[_0xfefb('0x50')]=[{'all':!![]}];}return db[_0xfefb('0x3e')][_0xfefb('0x51')](_0x563a36);})['then'](function(_0x4bd998){_0x3a5781[_0xfefb('0x52')]=_0x4bd998;return _0x3a5781;})[_0xfefb('0x1e')](respondWithFilteredResult(_0x2afc74,_0x563a36))[_0xfefb('0x29')](handleError(_0x2afc74,null));};exports[_0xfefb('0x53')]=function(_0x386388,_0x294548){var _0x4f113d={'raw':![],'where':{'id':_0x386388[_0xfefb('0x54')]['id']},'include':[{'model':db[_0xfefb('0x55')],'as':_0xfefb('0x3c')}]},_0x4b0180={};_0x4b0180['model']=_[_0xfefb('0x44')](db[_0xfefb('0x3e')][_0xfefb('0x56')]);_0x4b0180['query']=_[_0xfefb('0x44')](_0x386388[_0xfefb('0x43')]);_0x4b0180[_0xfefb('0x45')]=_[_0xfefb('0x46')](_0x4b0180['model'],_0x4b0180[_0xfefb('0x43')]);_0x4f113d[_0xfefb('0x47')]=_['intersection'](_0x4b0180[_0xfefb('0x42')],qs[_0xfefb('0x48')](_0x386388['query']['fields']));_0x4f113d[_0xfefb('0x47')]=_0x4f113d[_0xfefb('0x47')][_0xfefb('0x49')]?_0x4f113d[_0xfefb('0x47')]:_0x4b0180[_0xfefb('0x42')];if(_0x386388['query'][_0xfefb('0x57')]){_0x4f113d[_0xfefb('0x50')]=[{'all':!![]}];}_0x4f113d=_[_0xfefb('0x4f')]({},_0x4f113d,_0x386388[_0xfefb('0x58')]);return db[_0xfefb('0x3e')][_0xfefb('0x59')](_0x4f113d)[_0xfefb('0x1e')](handleEntityNotFound(_0x294548,null))[_0xfefb('0x1e')](respondWithResult(_0x294548,null))['catch'](handleError(_0x294548,null));};exports[_0xfefb('0x5a')]=function(_0x284dc7,_0x4e206e){return db[_0xfefb('0x3e')][_0xfefb('0x5a')](_0x284dc7[_0xfefb('0x5b')],{})['then'](function(_0x181c5b){var _0x18ab67=_0x284dc7[_0xfefb('0x5c')][_0xfefb('0x36')]({'plain':!![]});if(!_0x18ab67)throw new Error(_0xfefb('0x5d'));if(_0x18ab67[_0xfefb('0x5e')]===_0xfefb('0x5c')){var _0x293817=_0x181c5b[_0xfefb('0x36')]({'plain':!![]});var _0xe98059=_0xfefb('0x37');return db[_0xfefb('0x5f')][_0xfefb('0x59')]({'where':{'name':_0xe98059,'userProfileId':_0x18ab67[_0xfefb('0x60')]},'raw':!![]})['then'](function(_0x4f15e4){if(_0x4f15e4&&_0x4f15e4['autoAssociation']===0x0){return db[_0xfefb('0x61')][_0xfefb('0x5a')]({'name':_0x293817['name'],'resourceId':_0x293817['id'],'type':_0x4f15e4[_0xfefb('0x39')],'sectionId':_0x4f15e4['id']},{})[_0xfefb('0x1e')](function(){return _0x181c5b;});}else{return _0x181c5b;}})['catch'](function(_0x363c00){logger[_0xfefb('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x363c00);throw _0x363c00;});}return _0x181c5b;})[_0xfefb('0x1e')](respondWithResult(_0x4e206e,0xc9))[_0xfefb('0x29')](handleError(_0x4e206e,null));};exports[_0xfefb('0x35')]=function(_0x5d0a4d,_0x4e596e){if(_0x5d0a4d[_0xfefb('0x5b')]['id']){delete _0x5d0a4d[_0xfefb('0x5b')]['id'];}return db[_0xfefb('0x3e')]['find']({'where':{'id':_0x5d0a4d[_0xfefb('0x54')]['id']},'include':[{'model':db[_0xfefb('0x55')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4e596e,null))[_0xfefb('0x1e')](saveUpdates(_0x5d0a4d[_0xfefb('0x5b')],null))['then'](respondWithResult(_0x4e596e,null))[_0xfefb('0x29')](handleError(_0x4e596e,null));};exports[_0xfefb('0x38')]=function(_0x273299,_0x323a03){return db[_0xfefb('0x3e')]['find']({'where':{'id':_0x273299[_0xfefb('0x54')]['id']}})[_0xfefb('0x1e')](handleEntityNotFound(_0x323a03,null))[_0xfefb('0x1e')](removeEntity(_0x323a03,null))[_0xfefb('0x29')](handleError(_0x323a03,null));};exports['describe']=function(_0x4e9899,_0x6bfbd4){return db['WhatsappAccount'][_0xfefb('0x62')]()['then'](respondWithResult(_0x6bfbd4,null))['catch'](handleError(_0x6bfbd4,null));};exports['addDisposition']=function(_0x938595,_0x2bcbc7,_0x4d9bff){if(_0x938595[_0xfefb('0x5b')]['id']){delete _0x938595['body']['id'];}return db[_0xfefb('0x3e')]['find']({'where':{'id':_0x938595[_0xfefb('0x54')]['id']}})['then'](handleEntityNotFound(_0x2bcbc7,null))[_0xfefb('0x1e')](function(_0x466800){if(_0x466800){_0x938595[_0xfefb('0x5b')][_0xfefb('0x63')]=_0x466800['id'];return db['Disposition'][_0xfefb('0x5a')](_0x938595[_0xfefb('0x5b')]);}})['then'](respondWithResult(_0x2bcbc7,null))[_0xfefb('0x29')](handleError(_0x2bcbc7,null));};exports[_0xfefb('0x64')]=function(_0x1dcf99,_0x51f908,_0x584382){var _0x3e9af3={'raw':![],'where':{}};var _0x54e3f9={};var _0x302238={'count':0x0,'rows':[]};return db[_0xfefb('0x3e')]['findOne']({'where':{'id':_0x1dcf99[_0xfefb('0x54')]['id']}})[_0xfefb('0x1e')](handleEntityNotFound(_0x51f908,null))[_0xfefb('0x1e')](function(_0x492e84){if(_0x492e84){_0x54e3f9[_0xfefb('0x42')]=_[_0xfefb('0x44')](db[_0xfefb('0x65')]['rawAttributes']);_0x54e3f9[_0xfefb('0x43')]=_[_0xfefb('0x44')](_0x1dcf99[_0xfefb('0x43')]);_0x54e3f9[_0xfefb('0x45')]=_[_0xfefb('0x46')](_0x54e3f9[_0xfefb('0x42')],_0x54e3f9['query']);_0x3e9af3[_0xfefb('0x47')]=_[_0xfefb('0x46')](_0x54e3f9[_0xfefb('0x42')],qs['fields'](_0x1dcf99['query']['fields']));_0x3e9af3[_0xfefb('0x47')]=_0x3e9af3[_0xfefb('0x47')][_0xfefb('0x49')]?_0x3e9af3[_0xfefb('0x47')]:_0x54e3f9[_0xfefb('0x42')];if(!_0x1dcf99[_0xfefb('0x43')][_0xfefb('0x66')]('nolimit')){_0x3e9af3[_0xfefb('0x2f')]=qs[_0xfefb('0x2f')](_0x1dcf99['query']['limit']);_0x3e9af3[_0xfefb('0x2d')]=qs[_0xfefb('0x2d')](_0x1dcf99['query'][_0xfefb('0x2d')]);}_0x3e9af3['order']=qs[_0xfefb('0x67')](_0x1dcf99[_0xfefb('0x43')][_0xfefb('0x67')]);_0x3e9af3['where']=qs[_0xfefb('0x45')](_[_0xfefb('0x4d')](_0x1dcf99[_0xfefb('0x43')],_0x54e3f9[_0xfefb('0x45')]));_0x3e9af3[_0xfefb('0x4c')]['WhatsappAccountId']=_0x492e84['id'];if(_0x1dcf99[_0xfefb('0x43')][_0xfefb('0x4e')]){_0x3e9af3[_0xfefb('0x4c')]=_['merge'](_0x3e9af3[_0xfefb('0x4c')],{'$or':_[_0xfefb('0x3d')](_0x3e9af3[_0xfefb('0x47')],function(_0x2922e4){var _0x285d1d={};_0x285d1d[_0x2922e4]={'$like':'%'+_0x1dcf99[_0xfefb('0x43')][_0xfefb('0x4e')]+'%'};return _0x285d1d;})});}_0x3e9af3=_[_0xfefb('0x4f')]({},_0x3e9af3,_0x1dcf99[_0xfefb('0x58')]);return db[_0xfefb('0x65')][_0xfefb('0x30')]({'where':_0x3e9af3['where']})[_0xfefb('0x1e')](function(_0x325ec3){_0x302238[_0xfefb('0x30')]=_0x325ec3;if(_0x1dcf99[_0xfefb('0x43')][_0xfefb('0x57')]){_0x3e9af3[_0xfefb('0x50')]=[{'all':!![]}];}return db['Disposition'][_0xfefb('0x51')](_0x3e9af3);})[_0xfefb('0x1e')](function(_0x326cb0){_0x302238[_0xfefb('0x52')]=_0x326cb0;return _0x302238;});}})[_0xfefb('0x1e')](respondWithFilteredResult(_0x51f908,_0x3e9af3))[_0xfefb('0x29')](handleError(_0x51f908,null));};exports[_0xfefb('0x68')]=function(_0x2fe0a6,_0x5320a6,_0x2ea3fa){return db[_0xfefb('0x3e')]['find']({'where':{'id':_0x2fe0a6[_0xfefb('0x54')]['id']}})[_0xfefb('0x1e')](handleEntityNotFound(_0x5320a6,null))[_0xfefb('0x1e')](function(_0xf24afc){if(_0xf24afc){return _0xf24afc[_0xfefb('0x68')](_0x2fe0a6['query'][_0xfefb('0x69')]);}})[_0xfefb('0x1e')](respondWithStatusCode(_0x5320a6,null))[_0xfefb('0x29')](handleError(_0x5320a6,null));};exports[_0xfefb('0x6a')]=function(_0x43d8dc,_0x1a551a,_0x521f4e){if(_0x43d8dc[_0xfefb('0x5b')]['id']){delete _0x43d8dc[_0xfefb('0x5b')]['id'];}return db[_0xfefb('0x3e')][_0xfefb('0x59')]({'where':{'id':_0x43d8dc[_0xfefb('0x54')]['id']}})['then'](handleEntityNotFound(_0x1a551a,null))[_0xfefb('0x1e')](function(_0x58b1b3){if(_0x58b1b3){_0x43d8dc[_0xfefb('0x5b')]['WhatsappAccountId']=_0x58b1b3['id'];return db[_0xfefb('0x6b')][_0xfefb('0x5a')](_0x43d8dc[_0xfefb('0x5b')]);}})[_0xfefb('0x1e')](respondWithResult(_0x1a551a,null))[_0xfefb('0x29')](handleError(_0x1a551a,null));};exports[_0xfefb('0x6c')]=function(_0x4a57f8,_0x3da609,_0x190f6d){var _0x12c7bf={'raw':![],'where':{}};var _0x4dfd09={};var _0x5bbe2f={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xfefb('0x6d')]({'where':{'id':_0x4a57f8['params']['id']}})[_0xfefb('0x1e')](handleEntityNotFound(_0x3da609,null))['then'](function(_0x36fed3){if(_0x36fed3){_0x4dfd09['model']=_['keys'](db[_0xfefb('0x6b')]['rawAttributes']);_0x4dfd09[_0xfefb('0x43')]=_[_0xfefb('0x44')](_0x4a57f8[_0xfefb('0x43')]);_0x4dfd09[_0xfefb('0x45')]=_[_0xfefb('0x46')](_0x4dfd09[_0xfefb('0x42')],_0x4dfd09['query']);_0x12c7bf[_0xfefb('0x47')]=_['intersection'](_0x4dfd09[_0xfefb('0x42')],qs[_0xfefb('0x48')](_0x4a57f8[_0xfefb('0x43')][_0xfefb('0x48')]));_0x12c7bf[_0xfefb('0x47')]=_0x12c7bf[_0xfefb('0x47')][_0xfefb('0x49')]?_0x12c7bf['attributes']:_0x4dfd09['model'];if(!_0x4a57f8[_0xfefb('0x43')][_0xfefb('0x66')](_0xfefb('0x4a'))){_0x12c7bf[_0xfefb('0x2f')]=qs[_0xfefb('0x2f')](_0x4a57f8['query'][_0xfefb('0x2f')]);_0x12c7bf[_0xfefb('0x2d')]=qs[_0xfefb('0x2d')](_0x4a57f8[_0xfefb('0x43')][_0xfefb('0x2d')]);}_0x12c7bf['order']=qs[_0xfefb('0x67')](_0x4a57f8[_0xfefb('0x43')][_0xfefb('0x67')]);_0x12c7bf[_0xfefb('0x4c')]=qs[_0xfefb('0x45')](_[_0xfefb('0x4d')](_0x4a57f8['query'],_0x4dfd09[_0xfefb('0x45')]));_0x12c7bf[_0xfefb('0x4c')][_0xfefb('0x63')]=_0x36fed3['id'];if(_0x4a57f8[_0xfefb('0x43')][_0xfefb('0x4e')]){_0x12c7bf[_0xfefb('0x4c')]=_['merge'](_0x12c7bf[_0xfefb('0x4c')],{'$or':_[_0xfefb('0x3d')](_0x12c7bf[_0xfefb('0x47')],function(_0x35a5e9){var _0x457ba0={};_0x457ba0[_0x35a5e9]={'$like':'%'+_0x4a57f8[_0xfefb('0x43')][_0xfefb('0x4e')]+'%'};return _0x457ba0;})});}_0x12c7bf=_[_0xfefb('0x4f')]({},_0x12c7bf,_0x4a57f8[_0xfefb('0x58')]);return db[_0xfefb('0x6b')]['count']({'where':_0x12c7bf[_0xfefb('0x4c')]})['then'](function(_0x983a18){_0x5bbe2f[_0xfefb('0x30')]=_0x983a18;if(_0x4a57f8[_0xfefb('0x43')][_0xfefb('0x57')]){_0x12c7bf['include']=[{'all':!![]}];}return db[_0xfefb('0x6b')]['findAll'](_0x12c7bf);})[_0xfefb('0x1e')](function(_0x135daa){_0x5bbe2f['rows']=_0x135daa;return _0x5bbe2f;});}})['then'](respondWithFilteredResult(_0x3da609,_0x12c7bf))[_0xfefb('0x29')](handleError(_0x3da609,null));};exports[_0xfefb('0x6e')]=function(_0x330f3f,_0x497421,_0x47752d){return db[_0xfefb('0x3e')][_0xfefb('0x59')]({'where':{'id':_0x330f3f[_0xfefb('0x54')]['id']}})[_0xfefb('0x1e')](handleEntityNotFound(_0x497421,null))['then'](function(_0x4b3446){if(_0x4b3446){return _0x4b3446[_0xfefb('0x6e')](_0x330f3f[_0xfefb('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x497421,null))[_0xfefb('0x29')](handleError(_0x497421,null));};exports[_0xfefb('0x6f')]=function(_0x75ab14,_0x4dbe72,_0x907f0a){return db['WhatsappAccount']['find']({'where':{'id':_0x75ab14['params']['id']}})['then'](handleEntityNotFound(_0x4dbe72,null))[_0xfefb('0x1e')](function(_0x384c04){if(_0x384c04){return _0x384c04[_0xfefb('0x6f')](_0x75ab14[_0xfefb('0x5b')][_0xfefb('0x69')],_[_0xfefb('0x70')](_0x75ab14['body'],[_0xfefb('0x69'),'id'])||{})[_0xfefb('0x71')](function(_0xe2ac3){for(var _0x150959=0x0;_0x150959<_0x75ab14[_0xfefb('0x5b')][_0xfefb('0x69')]['length'];_0x150959+=0x1){socket[_0xfefb('0x72')](_0xfefb('0x73'),{'UserId':Number(_0x75ab14[_0xfefb('0x5b')][_0xfefb('0x69')][_0x150959]),'WhatsappAccountId':Number(_0x75ab14['params']['id'])});}return _0xe2ac3;});}})[_0xfefb('0x1e')](respondWithResult(_0x4dbe72,null))[_0xfefb('0x29')](handleError(_0x4dbe72,null));};exports[_0xfefb('0x74')]=function(_0x2f5f23,_0x3e6687,_0x4f98eb){return db[_0xfefb('0x3e')][_0xfefb('0x59')]({'where':{'id':_0x2f5f23[_0xfefb('0x54')]['id']}})[_0xfefb('0x1e')](handleEntityNotFound(_0x3e6687,null))['then'](function(_0x3ada1d){if(_0x3ada1d){return _0x3ada1d['removeAgents'](_0x2f5f23[_0xfefb('0x43')][_0xfefb('0x69')])[_0xfefb('0x1e')](function(){if(_[_0xfefb('0x75')](_0x2f5f23[_0xfefb('0x43')][_0xfefb('0x69')])){for(var _0x2223b7=0x0;_0x2223b7<_0x2f5f23[_0xfefb('0x43')][_0xfefb('0x69')]['length'];_0x2223b7+=0x1){socket['emit'](_0xfefb('0x76'),{'UserId':Number(_0x2f5f23[_0xfefb('0x43')][_0xfefb('0x69')][_0x2223b7]),'WhatsappAccountId':Number(_0x2f5f23[_0xfefb('0x54')]['id'])});}}else{socket[_0xfefb('0x72')](_0xfefb('0x76'),{'UserId':Number(_0x2f5f23[_0xfefb('0x43')][_0xfefb('0x69')]),'WhatsappAccountId':Number(_0x2f5f23['params']['id'])});}});}})[_0xfefb('0x1e')](respondWithStatusCode(_0x3e6687,null))['catch'](handleError(_0x3e6687,null));};exports['getAgents']=function(_0x4fa65a,_0x250778,_0x32c532){var _0x3903d5={};var _0x415553={};var _0xfe0b94;var _0x41d627;return db[_0xfefb('0x3e')][_0xfefb('0x6d')]({'where':{'id':_0x4fa65a['params']['id']}})['then'](handleEntityNotFound(_0x250778,null))['then'](function(_0x2cb6dc){if(_0x2cb6dc){_0xfe0b94=_0x2cb6dc;_0x415553['model']=_[_0xfefb('0x44')](db['User'][_0xfefb('0x56')]);_0x415553[_0xfefb('0x43')]=_[_0xfefb('0x44')](_0x4fa65a['query']);_0x415553['filters']=_[_0xfefb('0x46')](_0x415553[_0xfefb('0x42')],_0x415553['query']);_0x3903d5['attributes']=_[_0xfefb('0x46')](_0x415553[_0xfefb('0x42')],qs[_0xfefb('0x48')](_0x4fa65a[_0xfefb('0x43')][_0xfefb('0x48')]));_0x3903d5[_0xfefb('0x47')]=_0x3903d5[_0xfefb('0x47')][_0xfefb('0x49')]?_0x3903d5['attributes']:_0x415553[_0xfefb('0x42')];_0x3903d5[_0xfefb('0x4b')]=qs['sort'](_0x4fa65a[_0xfefb('0x43')]['sort']);_0x3903d5['where']=qs[_0xfefb('0x45')](_[_0xfefb('0x4d')](_0x4fa65a[_0xfefb('0x43')],_0x415553[_0xfefb('0x45')]));if(_0x4fa65a[_0xfefb('0x43')][_0xfefb('0x4e')]){_0x3903d5['where']=_[_0xfefb('0x4f')](_0x3903d5[_0xfefb('0x4c')],{'$or':_['map'](_0x3903d5[_0xfefb('0x47')],function(_0x54dd07){var _0x713992={};_0x713992[_0x54dd07]={'$like':'%'+_0x4fa65a['query'][_0xfefb('0x4e')]+'%'};return _0x713992;})});}_0x3903d5=_[_0xfefb('0x4f')]({},_0x3903d5,_0x4fa65a[_0xfefb('0x58')]);return _0xfe0b94[_0xfefb('0x77')](_0x3903d5);}})['then'](function(_0x50c35c){if(_0x50c35c){_0x41d627=_0x50c35c[_0xfefb('0x49')];if(!_0x4fa65a[_0xfefb('0x43')][_0xfefb('0x66')](_0xfefb('0x4a'))){_0x3903d5['limit']=qs[_0xfefb('0x2f')](_0x4fa65a[_0xfefb('0x43')][_0xfefb('0x2f')]);_0x3903d5['offset']=qs[_0xfefb('0x2d')](_0x4fa65a[_0xfefb('0x43')][_0xfefb('0x2d')]);}return _0xfe0b94['getAgents'](_0x3903d5);}})[_0xfefb('0x1e')](function(_0x1cf60f){if(_0x1cf60f){return _0x1cf60f?{'count':_0x41d627,'rows':_0x1cf60f}:null;}})['then'](respondWithResult(_0x250778,null))['catch'](handleError(_0x250778,null));};exports[_0xfefb('0x78')]=function(_0x4eb895,_0x17caeb,_0x30c26e){return db[_0xfefb('0x3e')][_0xfefb('0x6d')]({'where':{'id':_0x4eb895[_0xfefb('0x54')]['id']}})[_0xfefb('0x1e')](handleEntityNotFound(_0x17caeb,null))[_0xfefb('0x1e')](function(_0x36c7bd){if(_0x36c7bd){return db[_0xfefb('0x79')]['transaction'](function(_0x4b2485){return db[_0xfefb('0x7a')]['destroy']({'where':{'WhatsappAccountId':_0x4eb895[_0xfefb('0x54')]['id']},'transaction':_0x4b2485})['then'](function(_0x1fb8e3){var _0xb7daa8=_[_0xfefb('0x3d')](_0x4eb895[_0xfefb('0x5b')],function(_0x348edc){_0x348edc['WhatsappAccountId']=_0x4eb895['params']['id'];return _0x348edc;});return db[_0xfefb('0x7a')][_0xfefb('0x7b')](_0xb7daa8,{'transaction':_0x4b2485});});})[_0xfefb('0x1e')](function(){return db[_0xfefb('0x7a')][_0xfefb('0x7c')]({'where':{'WhatsappAccountId':_0x4eb895['params']['id']},'order':_0xfefb('0x7d')});});}})['then'](respondWithResult(_0x17caeb,null))['catch'](handleError(_0x17caeb,null));};exports[_0xfefb('0x7e')]=function(_0x37bdd2,_0x6ac5da,_0x357ae7){var _0x218195={};var _0x36e38b={};var _0x17a548;var _0x49ad69;return db[_0xfefb('0x3e')]['findOne']({'where':{'id':_0x37bdd2[_0xfefb('0x54')]['id']}})['then'](handleEntityNotFound(_0x6ac5da,null))['then'](function(_0x442cd9){if(_0x442cd9){_0x17a548=_0x442cd9;_0x36e38b[_0xfefb('0x42')]=_['keys'](db[_0xfefb('0x7a')][_0xfefb('0x56')]);_0x36e38b['query']=_[_0xfefb('0x44')](_0x37bdd2['query']);_0x36e38b[_0xfefb('0x45')]=_[_0xfefb('0x46')](_0x36e38b[_0xfefb('0x42')],_0x36e38b['query']);_0x218195[_0xfefb('0x47')]=_[_0xfefb('0x46')](_0x36e38b[_0xfefb('0x42')],qs[_0xfefb('0x48')](_0x37bdd2[_0xfefb('0x43')][_0xfefb('0x48')]));_0x218195[_0xfefb('0x47')]=_0x218195['attributes']['length']?_0x218195[_0xfefb('0x47')]:_0x36e38b['model'];_0x218195[_0xfefb('0x4b')]=qs[_0xfefb('0x67')](_0x37bdd2[_0xfefb('0x43')]['sort']);_0x218195[_0xfefb('0x4c')]=qs[_0xfefb('0x45')](_[_0xfefb('0x4d')](_0x37bdd2[_0xfefb('0x43')],_0x36e38b[_0xfefb('0x45')]));if(_0x37bdd2[_0xfefb('0x43')][_0xfefb('0x4e')]){_0x218195['where']=_[_0xfefb('0x4f')](_0x218195[_0xfefb('0x4c')],{'$or':_[_0xfefb('0x3d')](_0x218195[_0xfefb('0x47')],function(_0x20a097){var _0x2f8e2b={};_0x2f8e2b[_0x20a097]={'$like':'%'+_0x37bdd2[_0xfefb('0x43')][_0xfefb('0x4e')]+'%'};return _0x2f8e2b;})});}_0x218195=_[_0xfefb('0x4f')]({},_0x218195,_0x37bdd2[_0xfefb('0x58')]);return _0x17a548[_0xfefb('0x7e')](_0x218195);}})['then'](function(_0x52d57f){if(_0x52d57f){_0x49ad69=_0x52d57f[_0xfefb('0x49')];if(!_0x37bdd2[_0xfefb('0x43')]['hasOwnProperty'](_0xfefb('0x4a'))){_0x218195[_0xfefb('0x2f')]=qs['limit'](_0x37bdd2[_0xfefb('0x43')][_0xfefb('0x2f')]);_0x218195['offset']=qs[_0xfefb('0x2d')](_0x37bdd2['query'][_0xfefb('0x2d')]);}return _0x17a548[_0xfefb('0x7e')](_0x218195);}})[_0xfefb('0x1e')](function(_0x3c37c4){if(_0x3c37c4){return _0x3c37c4?{'count':_0x49ad69,'rows':_0x3c37c4}:null;}})[_0xfefb('0x1e')](respondWithResult(_0x6ac5da,null))[_0xfefb('0x29')](handleError(_0x6ac5da,null));};exports[_0xfefb('0x7f')]=function(_0x1a91df,_0x3f6308,_0x421e0c){var _0x1e6257={'channel':_0xfefb('0x80')};var _0x3ca222=[];var _0x58140b=[];var _0xc7c6db={};return db[_0xfefb('0x3e')]['find']({'where':{'id':_0x1a91df['params']['id']},'include':[{'model':db[_0xfefb('0x7a')],'as':_0xfefb('0x81')}]})[_0xfefb('0x1e')](handleEntityNotFound(_0x3f6308,null))[_0xfefb('0x1e')](function(_0x90073c){_0x1e6257['account']=_0x90073c;_0x1e6257[_0xfefb('0x82')]=_[_0xfefb('0x83')](_0x90073c['Applications'],['priority'],['asc']);if(_0x1e6257[_0xfefb('0x84')]['Applications']){delete _0x1e6257[_0xfefb('0x84')]['Applications'];}return db['CmContact'][_0xfefb('0x62')]();})[_0xfefb('0x1e')](function(_0x2c1075){if(!_0x2c1075){throw new db['Sequelize'][(_0xfefb('0x85'))]('no\x20available\x20attributes');}_0x3ca222=_[_0xfefb('0x86')](_[_0xfefb('0x44')](_0x2c1075),['createdAt',_0xfefb('0x87')]);_0x58140b=_['difference'](_[_0xfefb('0x44')](_0x2c1075),['createdAt',_0xfefb('0x87'),_0xfefb('0x88'),'ListId']);_0x1e6257[_0xfefb('0x5b')]={'mapKey':_0xfefb('0x89')};if(_0x1e6257[_0xfefb('0x84')][_0xfefb('0x40')]&&_0x1e6257[_0xfefb('0x84')][_0xfefb('0x40')]===_0xfefb('0x8a')){_0x1e6257['body'][_0xfefb('0x8b')]=_0x1a91df[_0xfefb('0x5b')][_0xfefb('0x8c')][_0xfefb('0x8d')](_0xfefb('0x8e'),'');_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x5b')]=_0x1a91df[_0xfefb('0x5b')]['Body'];_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x8f')]=_0x1a91df['body']['MessageSid'];}if(_0x1e6257[_0xfefb('0x5b')]['id']){delete _0x1e6257[_0xfefb('0x5b')]['id'];}if(_[_0xfefb('0x90')](_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x8b')])){throw new db[(_0xfefb('0x91'))]['ValidationError'](_0xfefb('0x92'));}if(_['isNil'](_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x5b')])||_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x5b')]===''){throw new db[(_0xfefb('0x91'))][(_0xfefb('0x85'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfefb('0x90')](_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x93')])){throw new db[(_0xfefb('0x91'))][(_0xfefb('0x85'))](_0xfefb('0x94')+_0x58140b);}if(!_[_0xfefb('0x95')](_0x58140b,_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x93')])){throw new db[(_0xfefb('0x91'))][(_0xfefb('0x85'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x58140b);}_0xc7c6db[_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x93')]]=_0x1e6257[_0xfefb('0x5b')]['from'];return db[_0xfefb('0x96')][_0xfefb('0x59')]({'where':{'id':_0x1e6257['account'][_0xfefb('0x97')]},'include':[{'model':db[_0xfefb('0x98')],'as':_0xfefb('0x99'),'where':_0xc7c6db,'limit':0x1,'order':[[_0xfefb('0x87'),'DESC']]}]});})[_0xfefb('0x1e')](handleEntityNotFound(_0x3f6308,null))['then'](function(_0x19fa5d){if(_0x19fa5d){_0x1e6257['list']=_[_0xfefb('0x70')](_0x19fa5d,[_0xfefb('0x99')]);if(_0x19fa5d['Contacts']['length']){return _0x19fa5d[_0xfefb('0x99')][0x0];}var _0x4c23e6=_[_0xfefb('0x18')](_0x1e6257[_0xfefb('0x5b')],{'firstName':_0x1e6257[_0xfefb('0x5b')]['from'],'ListId':_0x19fa5d['id']});_0x4c23e6[_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x93')]]=_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x8b')];return db[_0xfefb('0x98')]['create'](_0x4c23e6,{'fields':_0x3ca222,'raw':!![]});}})['then'](handleEntityNotFound(_0x3f6308,null))['then'](function(_0x4cae46){if(_0x4cae46){_0x1e6257[_0xfefb('0x9a')]=_0x4cae46;var _0x4d2f2b={'ContactId':_0x4cae46['id'],'phone':_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x8b')],'WhatsappAccountId':_0x1a91df[_0xfefb('0x54')]['id']};var _0x257bd9={'ContactId':_0x4cae46['id'],'WhatsappAccountId':_0x1a91df[_0xfefb('0x54')]['id'],'closed':![]};return db[_0xfefb('0x9b')][_0xfefb('0x59')]({'where':_0x257bd9})['then'](function(_0x158dfa){if(_0x158dfa){return[_0x158dfa,![]];}return db['WhatsappInteraction'][_0xfefb('0x5a')](_0x4d2f2b)[_0xfefb('0x1e')](function(_0x497705){return[_0x497705,!![]];});});}})[_0xfefb('0x71')](function(_0x324434,_0x5494ea){_0x1e6257[_0xfefb('0x9c')]=_0x324434[_0xfefb('0x36')]({'plain':!![]});_0x1e6257[_0xfefb('0x9c')]['created']=![];if(_0x5494ea){if(_0x1e6257[_0xfefb('0x84')][_0xfefb('0x9d')]){_0x1e6257[_0xfefb('0x82')][_0xfefb('0x9e')]({'id':0x0,'priority':_0x1e6257[_0xfefb('0x82')]['length']+0x1,'app':_0xfefb('0x9f'),'appdata':'unmanaged','interval':_0xfefb('0xa0')});}_0x1e6257[_0xfefb('0x9c')][_0xfefb('0xa1')]=!![];}return db[_0xfefb('0xa2')][_0xfefb('0x5a')]({'phone':_0x1e6257['body'][_0xfefb('0x8b')],'messageId':_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x8f')],'body':_0x1e6257[_0xfefb('0x5b')][_0xfefb('0x5b')],'WhatsappAccountId':_0x1a91df[_0xfefb('0x54')]['id'],'WhatsappInteractionId':_0x324434['id'],'direction':'in','ContactId':_0x324434[_0xfefb('0xa3')],'AttachmentId':_0x1e6257[_0xfefb('0x5b')][_0xfefb('0xa4')]});})[_0xfefb('0x1e')](function(_0x3ec7a5){_0x1e6257[_0xfefb('0x27')]=_0x3ec7a5;if(_0x1e6257[_0xfefb('0x9c')][_0xfefb('0xa5')]){return db['User'][_0xfefb('0x59')]({'attributes':['id','name'],'where':{'id':_0x1e6257[_0xfefb('0x9c')][_0xfefb('0xa5')]}})[_0xfefb('0x1e')](function(_0x55ab56){if(_0x55ab56){_0x1e6257['applications'][_0xfefb('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x55ab56[_0xfefb('0x39')]+','+(_0x1e6257['account']['waitForTheAssignedAgent']||0xa),'interval':_0xfefb('0xa0')});}return respondWithRpcPromise(_0xfefb('0xa7'),_0xfefb('0xa8'),_0x1e6257);});}return respondWithRpcPromise(_0xfefb('0xa7'),_0xfefb('0xa8'),_0x1e6257);})['then'](function(_0x31b978){if(_0x31b978){var _0x492e11=0xc8;var _0xa972b3=_0xfefb('0xa9');logger['info'](_0xfefb('0x23'),_0xa972b3,_0x492e11,'entity\x20found');logger['debug'](_0xfefb('0xaa'),_0xa972b3,_0x492e11,_0xfefb('0xab'),JSON[_0xfefb('0x24')](_0x31b978));if(_0x1e6257[_0xfefb('0x84')]['type']==='twilio'){return _0x3f6308[_0xfefb('0x2c')](_0x492e11)['set'](_0xfefb('0xac'),_0xfefb('0xad'))['send'](_0xfefb('0xae'));}else{return _0x3f6308['status'](_0x492e11)['json'](_0x31b978);}}})[_0xfefb('0x29')](handleError(_0x3f6308,null));};exports[_0xfefb('0x3a')]=function(_0x3f4fb2,_0x49f514,_0x3db721){var _0x3062b7,_0x39c8ee,_0xf688cc;if(_[_0xfefb('0x90')](_0x3f4fb2[_0xfefb('0x5b')][_0xfefb('0x5b')])||_0x3f4fb2[_0xfefb('0x5b')][_0xfefb('0x5b')]===''){throw new db[(_0xfefb('0x91'))][(_0xfefb('0x85'))](_0xfefb('0xaf'));}if(_['isNil'](_0x3f4fb2[_0xfefb('0x5b')]['to'])){throw new db['Sequelize'][(_0xfefb('0x85'))](_0xfefb('0xb0'));}_0x3062b7=_0x3f4fb2['body']['to'];return db[_0xfefb('0x3e')][_0xfefb('0x59')]({'where':{'id':_0x3f4fb2[_0xfefb('0x54')]['id']},'include':[{'model':db[_0xfefb('0x96')],'as':_0xfefb('0xb1'),'include':[{'model':db[_0xfefb('0x98')],'as':_0xfefb('0x99'),'where':{'mobile':_0x3062b7},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xfefb('0x1e')](handleEntityNotFound(_0x49f514,null))['then'](function(_0x553bd9){if(_0x553bd9&&_0x553bd9['List']){_0x39c8ee=_0x553bd9['get']({'plain':!![]});if(_0x39c8ee[_0xfefb('0xb1')]&&_0x39c8ee[_0xfefb('0xb1')][_0xfefb('0x99')]['length']){return _0x39c8ee['List'][_0xfefb('0x99')][0x0];}return db[_0xfefb('0x98')]['create'](_[_0xfefb('0x18')](_0x3f4fb2[_0xfefb('0x5b')],{'firstName':_0x3062b7,'mobile':_0x3062b7,'phone':_0x3062b7,'ListId':_0x39c8ee['ListId']}));}})[_0xfefb('0x1e')](handleEntityNotFound(_0x49f514,null))[_0xfefb('0x1e')](function(_0x5e25a5){if(_0x5e25a5){_0xf688cc=_0x5e25a5;return db[_0xfefb('0x9b')]['find']({'where':{'ContactId':_0xf688cc['id'],'closed':![],'WhatsappAccountId':_0x39c8ee['id']}})['then'](function(_0x3ddcc1){if(_0x3ddcc1){return[_0x3ddcc1,![]];}return db[_0xfefb('0x9b')]['create']({'UserId':_0x3f4fb2[_0xfefb('0x5c')]['id'],'ContactId':_0xf688cc['id'],'WhatsappAccountId':_0x39c8ee['id'],'phone':_0x3062b7,'firstMsgDirection':_0xfefb('0xb2'),'Messages':[_[_0xfefb('0x4f')](_0x3f4fb2[_0xfefb('0x5b')],{'read':![],'body':_0x3f4fb2[_0xfefb('0x5b')][_0xfefb('0x5b')],'phone':_0x3062b7,'WhatsappAccountId':_0x39c8ee['id'],'UserId':_0x3f4fb2[_0xfefb('0x5c')]['id'],'ContactId':_0xf688cc['id']})]},{'include':[{'model':db[_0xfefb('0xa2')],'as':_0xfefb('0xb3')}]})[_0xfefb('0x1e')](function(_0x5a0650){return[_0x5a0650,!![]];});});}})[_0xfefb('0x71')](function(_0xbf781a,_0x4e4700){if(_0x4e4700){return _0xbf781a;}return db[_0xfefb('0xa2')][_0xfefb('0x5a')](_[_0xfefb('0x4f')](_0x3f4fb2[_0xfefb('0x5b')],{'read':![],'body':_0x3f4fb2['body'][_0xfefb('0x5b')],'phone':_0x3062b7,'WhatsappAccountId':_0x39c8ee['id'],'WhatsappInteractionId':_0xbf781a['id'],'UserId':_0x3f4fb2[_0xfefb('0x5c')]['id'],'ContactId':_0xf688cc['id']}))[_0xfefb('0x1e')](function(_0xc1bb00){_0xbf781a[_0xfefb('0xb4')][_0xfefb('0xb3')]=[];_0xbf781a[_0xfefb('0xb4')][_0xfefb('0xb3')][_0xfefb('0x9e')](_0xc1bb00['dataValues']);return _0xbf781a;});})[_0xfefb('0x1e')](respondWithResult(_0x49f514,null))['catch'](handleError(_0x49f514,null));}; \ No newline at end of file +var _0xf737=['UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','mandatoryDispositionPause','describe','addDisposition','WhatsappAccountId','Disposition','findOne','hasOwnProperty','order','rows','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','Body','messageId','MessageSid','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','WhatsappInteraction','interaction','created','autoclose','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','out','dataValues','Messages','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','update','then','get','WhatsappAccounts','destroy','stack','name','send','index','Pause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','WhatsappAccount','findAll','show','keys','find','create','body','role','user','userProfileId'];(function(_0x2d2532,_0x5bf4d3){var _0x266a4a=function(_0x214af4){while(--_0x214af4){_0x2d2532['push'](_0x2d2532['shift']());}};_0x266a4a(++_0x5bf4d3);}(_0xf737,0x1c6));var _0x7f73=function(_0x4b2956,_0x47bc8b){_0x4b2956=_0x4b2956-0x0;var _0x5978ff=_0xf737[_0x4b2956];return _0x5978ff;};'use strict';var emlformat=require(_0x7f73('0x0'));var rimraf=require(_0x7f73('0x1'));var zipdir=require(_0x7f73('0x2'));var jsonpatch=require(_0x7f73('0x3'));var rp=require(_0x7f73('0x4'));var moment=require('moment');var BPromise=require(_0x7f73('0x5'));var Mustache=require(_0x7f73('0x6'));var util=require(_0x7f73('0x7'));var path=require('path');var sox=require(_0x7f73('0x8'));var csv=require(_0x7f73('0x9'));var ejs=require(_0x7f73('0xa'));var fs=require('fs');var fs_extra=require(_0x7f73('0xb'));var _=require(_0x7f73('0xc'));var squel=require(_0x7f73('0xd'));var crypto=require('crypto');var jsforce=require(_0x7f73('0xe'));var deskjs=require(_0x7f73('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7f73('0x10'));var Papa=require(_0x7f73('0x11'));var Redis=require('ioredis');var authService=require(_0x7f73('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f73('0x13'));var logger=require(_0x7f73('0x14'))(_0x7f73('0x15'));var utils=require(_0x7f73('0x16'));var config=require(_0x7f73('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f73('0x18'))['db'];config['redis']=_[_0x7f73('0x19')](config[_0x7f73('0x1a')],{'host':_0x7f73('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f73('0x1a')]));require('./whatsappAccount.socket')[_0x7f73('0x1c')](socket);var jayson=require(_0x7f73('0x1d'));var client=jayson[_0x7f73('0x1e')][_0x7f73('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x1fc52b,_0x5e135f,_0x2d313f,_0x161cef){return new BPromise(function(_0x51e59e,_0x59b545){var _0x3c780e=_0x161cef||client;return _0x3c780e[_0x7f73('0x20')](_0x1fc52b,_0x2d313f)['then'](function(_0x28599a){logger[_0x7f73('0x21')](_0x7f73('0x22'),_0x5e135f,_0x7f73('0x23'));logger[_0x7f73('0x24')](_0x7f73('0x25'),_0x5e135f,'request\x20sent',JSON[_0x7f73('0x26')](_0x28599a));if(_0x28599a[_0x7f73('0x27')]){if(_0x28599a['error'][_0x7f73('0x28')]===0x1f4){logger[_0x7f73('0x27')](_0x7f73('0x22'),_0x5e135f,_0x28599a[_0x7f73('0x27')][_0x7f73('0x29')]);return _0x59b545(_0x28599a['error']['message']);}logger['error'](_0x7f73('0x22'),_0x5e135f,_0x28599a[_0x7f73('0x27')][_0x7f73('0x29')]);return _0x51e59e(_0x28599a['error'][_0x7f73('0x29')]);}else{logger[_0x7f73('0x21')](_0x7f73('0x22'),_0x5e135f,_0x7f73('0x23'));_0x51e59e(_0x28599a['result'][_0x7f73('0x29')]);}})[_0x7f73('0x2a')](function(_0x37f98a){logger['error'](_0x7f73('0x22'),_0x5e135f,_0x37f98a);_0x59b545(_0x37f98a);});});}function respondWithStatusCode(_0x4aa598,_0x3b2ca2){_0x3b2ca2=_0x3b2ca2||0xcc;return function(_0x1df0db){if(_0x1df0db){return _0x4aa598['sendStatus'](_0x3b2ca2);}return _0x4aa598['status'](_0x3b2ca2)[_0x7f73('0x2b')]();};}function respondWithResult(_0x3a110c,_0x8d384e){_0x8d384e=_0x8d384e||0xc8;return function(_0x12cba0){if(_0x12cba0){return _0x3a110c['status'](_0x8d384e)[_0x7f73('0x2c')](_0x12cba0);}};}function respondWithFilteredResult(_0x399c19,_0x166bf4){return function(_0x394353){if(_0x394353){var _0x261d76=typeof _0x166bf4['offset']==='undefined'&&typeof _0x166bf4[_0x7f73('0x2d')]===_0x7f73('0x2e');var _0xc2256b=_0x394353[_0x7f73('0x2f')];var _0x3b00c9=_0x261d76?0x0:_0x166bf4[_0x7f73('0x30')];var _0x1a44ea=_0x261d76?_0x394353[_0x7f73('0x2f')]:_0x166bf4[_0x7f73('0x30')]+_0x166bf4[_0x7f73('0x2d')];var _0x185e9b;if(_0x1a44ea>=_0xc2256b){_0x1a44ea=_0xc2256b;_0x185e9b=0xc8;}else{_0x185e9b=0xce;}_0x399c19[_0x7f73('0x31')](_0x185e9b);return _0x399c19[_0x7f73('0x32')](_0x7f73('0x33'),_0x3b00c9+'-'+_0x1a44ea+'/'+_0xc2256b)[_0x7f73('0x2c')](_0x394353);}return null;};}function patchUpdates(_0x24f0db){return function(_0x4bb92b){try{jsonpatch[_0x7f73('0x34')](_0x4bb92b,_0x24f0db,!![]);}catch(_0x13cecb){return BPromise[_0x7f73('0x35')](_0x13cecb);}return _0x4bb92b['save']();};}function saveUpdates(_0xc6c234,_0x206a98){return function(_0x14bd33){if(_0x14bd33){return _0x14bd33[_0x7f73('0x36')](_0xc6c234)[_0x7f73('0x37')](function(_0x57fa0b){return _0x57fa0b;});}return null;};}function removeEntity(_0x3c475c,_0x39bf9){return function(_0x5c00e8){if(_0x5c00e8){return _0x5c00e8['destroy']()[_0x7f73('0x37')](function(){var _0x594c0a=_0x5c00e8[_0x7f73('0x38')]({'plain':!![]});var _0x4f1f1f=_0x7f73('0x39');return db['UserProfileResource'][_0x7f73('0x3a')]({'where':{'type':_0x4f1f1f,'resourceId':_0x594c0a['id']}})[_0x7f73('0x37')](function(){return _0x5c00e8;});})[_0x7f73('0x37')](function(){_0x3c475c[_0x7f73('0x31')](0xcc)[_0x7f73('0x2b')]();});}};}function handleEntityNotFound(_0x582265,_0x2644ea){return function(_0x87be6d){if(!_0x87be6d){_0x582265['sendStatus'](0x194);}return _0x87be6d;};}function handleError(_0x15181f,_0x26544a){_0x26544a=_0x26544a||0x1f4;return function(_0x1a01c6){logger['error'](_0x1a01c6[_0x7f73('0x3b')]);if(_0x1a01c6['name']){delete _0x1a01c6[_0x7f73('0x3c')];}_0x15181f[_0x7f73('0x31')](_0x26544a)[_0x7f73('0x3d')](_0x1a01c6);};}exports[_0x7f73('0x3e')]=function(_0x4e9fee,_0x3dff02){var _0x528aab={'include':[{'model':db[_0x7f73('0x3f')],'as':'mandatoryDispositionPause'}]},_0x5902a2={},_0x5f1895={'count':0x0,'rows':[]};var _0x3b9025=_[_0x7f73('0x40')](db['WhatsappAccount'][_0x7f73('0x41')],function(_0x2d8a66){return{'name':_0x2d8a66[_0x7f73('0x42')],'type':_0x2d8a66[_0x7f73('0x43')][_0x7f73('0x44')]};});_0x5902a2[_0x7f73('0x45')]=_['map'](_0x3b9025,_0x7f73('0x3c'));_0x5902a2[_0x7f73('0x46')]=_['keys'](_0x4e9fee[_0x7f73('0x46')]);_0x5902a2[_0x7f73('0x47')]=_[_0x7f73('0x48')](_0x5902a2[_0x7f73('0x45')],_0x5902a2[_0x7f73('0x46')]);_0x528aab[_0x7f73('0x49')]=_[_0x7f73('0x48')](_0x5902a2[_0x7f73('0x45')],qs[_0x7f73('0x4a')](_0x4e9fee['query'][_0x7f73('0x4a')]));_0x528aab[_0x7f73('0x49')]=_0x528aab[_0x7f73('0x49')][_0x7f73('0x4b')]?_0x528aab[_0x7f73('0x49')]:_0x5902a2['model'];if(!_0x4e9fee[_0x7f73('0x46')]['hasOwnProperty'](_0x7f73('0x4c'))){_0x528aab[_0x7f73('0x2d')]=qs[_0x7f73('0x2d')](_0x4e9fee['query'][_0x7f73('0x2d')]);_0x528aab[_0x7f73('0x30')]=qs[_0x7f73('0x30')](_0x4e9fee[_0x7f73('0x46')][_0x7f73('0x30')]);}_0x528aab['order']=qs['sort'](_0x4e9fee[_0x7f73('0x46')][_0x7f73('0x4d')]);_0x528aab[_0x7f73('0x4e')]=qs[_0x7f73('0x47')](_[_0x7f73('0x4f')](_0x4e9fee['query'],_0x5902a2[_0x7f73('0x47')]),_0x3b9025);if(_0x4e9fee['query'][_0x7f73('0x50')]){_0x528aab['where']=_[_0x7f73('0x51')](_0x528aab[_0x7f73('0x4e')],{'$or':_['map'](_0x3b9025,function(_0x3b4d22){if(_0x3b4d22[_0x7f73('0x43')]!=='VIRTUAL'){var _0x554e14={};_0x554e14[_0x3b4d22['name']]={'$like':'%'+_0x4e9fee['query']['filter']+'%'};return _0x554e14;}})});}_0x528aab=_[_0x7f73('0x51')]({},_0x528aab,_0x4e9fee[_0x7f73('0x52')]);var _0x55b8d4={'where':_0x528aab[_0x7f73('0x4e')]};return db['WhatsappAccount'][_0x7f73('0x2f')](_0x55b8d4)['then'](function(_0xd2ff86){_0x5f1895[_0x7f73('0x2f')]=_0xd2ff86;if(_0x4e9fee['query'][_0x7f73('0x53')]){_0x528aab[_0x7f73('0x54')]=[{'all':!![]}];}return db[_0x7f73('0x55')][_0x7f73('0x56')](_0x528aab);})[_0x7f73('0x37')](function(_0x2b266c){_0x5f1895['rows']=_0x2b266c;return _0x5f1895;})['then'](respondWithFilteredResult(_0x3dff02,_0x528aab))[_0x7f73('0x2a')](handleError(_0x3dff02,null));};exports[_0x7f73('0x57')]=function(_0x59edd4,_0x459b52){var _0xcf7fed={'raw':![],'where':{'id':_0x59edd4['params']['id']},'include':[{'model':db[_0x7f73('0x3f')],'as':'mandatoryDispositionPause'}]},_0x29e5ce={};_0x29e5ce[_0x7f73('0x45')]=_[_0x7f73('0x58')](db['WhatsappAccount'][_0x7f73('0x41')]);_0x29e5ce[_0x7f73('0x46')]=_[_0x7f73('0x58')](_0x59edd4[_0x7f73('0x46')]);_0x29e5ce['filters']=_[_0x7f73('0x48')](_0x29e5ce[_0x7f73('0x45')],_0x29e5ce['query']);_0xcf7fed[_0x7f73('0x49')]=_[_0x7f73('0x48')](_0x29e5ce[_0x7f73('0x45')],qs[_0x7f73('0x4a')](_0x59edd4['query'][_0x7f73('0x4a')]));_0xcf7fed[_0x7f73('0x49')]=_0xcf7fed[_0x7f73('0x49')]['length']?_0xcf7fed['attributes']:_0x29e5ce[_0x7f73('0x45')];if(_0x59edd4[_0x7f73('0x46')][_0x7f73('0x53')]){_0xcf7fed[_0x7f73('0x54')]=[{'all':!![]}];}_0xcf7fed=_['merge']({},_0xcf7fed,_0x59edd4[_0x7f73('0x52')]);return db[_0x7f73('0x55')][_0x7f73('0x59')](_0xcf7fed)['then'](handleEntityNotFound(_0x459b52,null))[_0x7f73('0x37')](respondWithResult(_0x459b52,null))[_0x7f73('0x2a')](handleError(_0x459b52,null));};exports[_0x7f73('0x5a')]=function(_0x3f7f48,_0x4a6f11){return db['WhatsappAccount']['create'](_0x3f7f48[_0x7f73('0x5b')],{})[_0x7f73('0x37')](function(_0x46de8a){var _0x2693bc=_0x3f7f48['user'][_0x7f73('0x38')]({'plain':!![]});if(!_0x2693bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2693bc[_0x7f73('0x5c')]===_0x7f73('0x5d')){var _0x4bc401=_0x46de8a[_0x7f73('0x38')]({'plain':!![]});var _0x17d39d=_0x7f73('0x39');return db['UserProfileSection'][_0x7f73('0x59')]({'where':{'name':_0x17d39d,'userProfileId':_0x2693bc[_0x7f73('0x5e')]},'raw':!![]})[_0x7f73('0x37')](function(_0x369664){if(_0x369664&&_0x369664['autoAssociation']===0x0){return db[_0x7f73('0x5f')][_0x7f73('0x5a')]({'name':_0x4bc401[_0x7f73('0x3c')],'resourceId':_0x4bc401['id'],'type':_0x369664[_0x7f73('0x3c')],'sectionId':_0x369664['id']},{})[_0x7f73('0x37')](function(){return _0x46de8a;});}else{return _0x46de8a;}})[_0x7f73('0x2a')](function(_0x111688){logger[_0x7f73('0x27')](_0x7f73('0x60'),_0x111688);throw _0x111688;});}return _0x46de8a;})[_0x7f73('0x37')](respondWithResult(_0x4a6f11,0xc9))[_0x7f73('0x2a')](handleError(_0x4a6f11,null));};exports[_0x7f73('0x36')]=function(_0x51008d,_0x53768e){if(_0x51008d[_0x7f73('0x5b')]['id']){delete _0x51008d['body']['id'];}return db[_0x7f73('0x55')][_0x7f73('0x59')]({'where':{'id':_0x51008d[_0x7f73('0x61')]['id']},'include':[{'model':db[_0x7f73('0x3f')],'as':_0x7f73('0x62')}]})[_0x7f73('0x37')](handleEntityNotFound(_0x53768e,null))[_0x7f73('0x37')](saveUpdates(_0x51008d[_0x7f73('0x5b')],null))[_0x7f73('0x37')](respondWithResult(_0x53768e,null))[_0x7f73('0x2a')](handleError(_0x53768e,null));};exports[_0x7f73('0x3a')]=function(_0x4c8240,_0x3a5ddd){return db[_0x7f73('0x55')][_0x7f73('0x59')]({'where':{'id':_0x4c8240['params']['id']}})[_0x7f73('0x37')](handleEntityNotFound(_0x3a5ddd,null))[_0x7f73('0x37')](removeEntity(_0x3a5ddd,null))[_0x7f73('0x2a')](handleError(_0x3a5ddd,null));};exports[_0x7f73('0x63')]=function(_0x2b8351,_0x59f931){return db[_0x7f73('0x55')][_0x7f73('0x63')]()[_0x7f73('0x37')](respondWithResult(_0x59f931,null))[_0x7f73('0x2a')](handleError(_0x59f931,null));};exports[_0x7f73('0x64')]=function(_0x52f11,_0x1f1e18,_0x2072c5){if(_0x52f11['body']['id']){delete _0x52f11[_0x7f73('0x5b')]['id'];}return db[_0x7f73('0x55')]['find']({'where':{'id':_0x52f11['params']['id']}})[_0x7f73('0x37')](handleEntityNotFound(_0x1f1e18,null))['then'](function(_0x11308d){if(_0x11308d){_0x52f11['body'][_0x7f73('0x65')]=_0x11308d['id'];return db[_0x7f73('0x66')][_0x7f73('0x5a')](_0x52f11['body']);}})[_0x7f73('0x37')](respondWithResult(_0x1f1e18,null))[_0x7f73('0x2a')](handleError(_0x1f1e18,null));};exports['getDispositions']=function(_0x4591c7,_0x53b61f,_0x1f08fa){var _0x26916b={'raw':![],'where':{}};var _0x52c00d={};var _0x51b8c0={'count':0x0,'rows':[]};return db[_0x7f73('0x55')][_0x7f73('0x67')]({'where':{'id':_0x4591c7[_0x7f73('0x61')]['id']}})[_0x7f73('0x37')](handleEntityNotFound(_0x53b61f,null))[_0x7f73('0x37')](function(_0x38001b){if(_0x38001b){_0x52c00d[_0x7f73('0x45')]=_[_0x7f73('0x58')](db['Disposition']['rawAttributes']);_0x52c00d['query']=_[_0x7f73('0x58')](_0x4591c7[_0x7f73('0x46')]);_0x52c00d[_0x7f73('0x47')]=_[_0x7f73('0x48')](_0x52c00d[_0x7f73('0x45')],_0x52c00d[_0x7f73('0x46')]);_0x26916b[_0x7f73('0x49')]=_[_0x7f73('0x48')](_0x52c00d[_0x7f73('0x45')],qs[_0x7f73('0x4a')](_0x4591c7['query'][_0x7f73('0x4a')]));_0x26916b[_0x7f73('0x49')]=_0x26916b[_0x7f73('0x49')]['length']?_0x26916b[_0x7f73('0x49')]:_0x52c00d['model'];if(!_0x4591c7[_0x7f73('0x46')][_0x7f73('0x68')]('nolimit')){_0x26916b['limit']=qs['limit'](_0x4591c7['query']['limit']);_0x26916b['offset']=qs[_0x7f73('0x30')](_0x4591c7[_0x7f73('0x46')][_0x7f73('0x30')]);}_0x26916b[_0x7f73('0x69')]=qs[_0x7f73('0x4d')](_0x4591c7['query'][_0x7f73('0x4d')]);_0x26916b[_0x7f73('0x4e')]=qs[_0x7f73('0x47')](_[_0x7f73('0x4f')](_0x4591c7[_0x7f73('0x46')],_0x52c00d[_0x7f73('0x47')]));_0x26916b[_0x7f73('0x4e')][_0x7f73('0x65')]=_0x38001b['id'];if(_0x4591c7[_0x7f73('0x46')][_0x7f73('0x50')]){_0x26916b[_0x7f73('0x4e')]=_[_0x7f73('0x51')](_0x26916b[_0x7f73('0x4e')],{'$or':_[_0x7f73('0x40')](_0x26916b[_0x7f73('0x49')],function(_0x4fac7a){var _0xc84b3a={};_0xc84b3a[_0x4fac7a]={'$like':'%'+_0x4591c7[_0x7f73('0x46')][_0x7f73('0x50')]+'%'};return _0xc84b3a;})});}_0x26916b=_[_0x7f73('0x51')]({},_0x26916b,_0x4591c7[_0x7f73('0x52')]);return db[_0x7f73('0x66')][_0x7f73('0x2f')]({'where':_0x26916b['where']})[_0x7f73('0x37')](function(_0xcdde60){_0x51b8c0[_0x7f73('0x2f')]=_0xcdde60;if(_0x4591c7[_0x7f73('0x46')][_0x7f73('0x53')]){_0x26916b['include']=[{'all':!![]}];}return db[_0x7f73('0x66')][_0x7f73('0x56')](_0x26916b);})[_0x7f73('0x37')](function(_0x561542){_0x51b8c0[_0x7f73('0x6a')]=_0x561542;return _0x51b8c0;});}})[_0x7f73('0x37')](respondWithFilteredResult(_0x53b61f,_0x26916b))[_0x7f73('0x2a')](handleError(_0x53b61f,null));};exports['removeDispositions']=function(_0x383fc5,_0x17f9cf,_0xa1bebd){return db[_0x7f73('0x55')][_0x7f73('0x59')]({'where':{'id':_0x383fc5[_0x7f73('0x61')]['id']}})['then'](handleEntityNotFound(_0x17f9cf,null))[_0x7f73('0x37')](function(_0x446fc7){if(_0x446fc7){return _0x446fc7[_0x7f73('0x6b')](_0x383fc5[_0x7f73('0x46')]['ids']);}})[_0x7f73('0x37')](respondWithStatusCode(_0x17f9cf,null))[_0x7f73('0x2a')](handleError(_0x17f9cf,null));};exports[_0x7f73('0x6c')]=function(_0x227c5e,_0x2ebf0c,_0x50d811){if(_0x227c5e[_0x7f73('0x5b')]['id']){delete _0x227c5e[_0x7f73('0x5b')]['id'];}return db['WhatsappAccount'][_0x7f73('0x59')]({'where':{'id':_0x227c5e[_0x7f73('0x61')]['id']}})[_0x7f73('0x37')](handleEntityNotFound(_0x2ebf0c,null))['then'](function(_0x3e5cdc){if(_0x3e5cdc){_0x227c5e['body'][_0x7f73('0x65')]=_0x3e5cdc['id'];return db[_0x7f73('0x6d')][_0x7f73('0x5a')](_0x227c5e[_0x7f73('0x5b')]);}})[_0x7f73('0x37')](respondWithResult(_0x2ebf0c,null))[_0x7f73('0x2a')](handleError(_0x2ebf0c,null));};exports['getAnswers']=function(_0x489676,_0x2d3af8,_0x4a06f9){var _0x2a5987={'raw':![],'where':{}};var _0x5128c9={};var _0x4103a6={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x7f73('0x67')]({'where':{'id':_0x489676[_0x7f73('0x61')]['id']}})['then'](handleEntityNotFound(_0x2d3af8,null))[_0x7f73('0x37')](function(_0x2499f4){if(_0x2499f4){_0x5128c9[_0x7f73('0x45')]=_['keys'](db[_0x7f73('0x6d')]['rawAttributes']);_0x5128c9[_0x7f73('0x46')]=_[_0x7f73('0x58')](_0x489676[_0x7f73('0x46')]);_0x5128c9[_0x7f73('0x47')]=_[_0x7f73('0x48')](_0x5128c9[_0x7f73('0x45')],_0x5128c9[_0x7f73('0x46')]);_0x2a5987[_0x7f73('0x49')]=_[_0x7f73('0x48')](_0x5128c9[_0x7f73('0x45')],qs[_0x7f73('0x4a')](_0x489676['query']['fields']));_0x2a5987[_0x7f73('0x49')]=_0x2a5987[_0x7f73('0x49')][_0x7f73('0x4b')]?_0x2a5987['attributes']:_0x5128c9['model'];if(!_0x489676['query'][_0x7f73('0x68')](_0x7f73('0x4c'))){_0x2a5987[_0x7f73('0x2d')]=qs['limit'](_0x489676[_0x7f73('0x46')][_0x7f73('0x2d')]);_0x2a5987['offset']=qs['offset'](_0x489676[_0x7f73('0x46')][_0x7f73('0x30')]);}_0x2a5987[_0x7f73('0x69')]=qs[_0x7f73('0x4d')](_0x489676[_0x7f73('0x46')][_0x7f73('0x4d')]);_0x2a5987[_0x7f73('0x4e')]=qs[_0x7f73('0x47')](_['pick'](_0x489676['query'],_0x5128c9[_0x7f73('0x47')]));_0x2a5987[_0x7f73('0x4e')][_0x7f73('0x65')]=_0x2499f4['id'];if(_0x489676['query'][_0x7f73('0x50')]){_0x2a5987['where']=_[_0x7f73('0x51')](_0x2a5987[_0x7f73('0x4e')],{'$or':_['map'](_0x2a5987['attributes'],function(_0x211a17){var _0x3891cc={};_0x3891cc[_0x211a17]={'$like':'%'+_0x489676[_0x7f73('0x46')][_0x7f73('0x50')]+'%'};return _0x3891cc;})});}_0x2a5987=_['merge']({},_0x2a5987,_0x489676[_0x7f73('0x52')]);return db[_0x7f73('0x6d')][_0x7f73('0x2f')]({'where':_0x2a5987['where']})[_0x7f73('0x37')](function(_0x41730f){_0x4103a6[_0x7f73('0x2f')]=_0x41730f;if(_0x489676[_0x7f73('0x46')]['includeAll']){_0x2a5987['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x7f73('0x56')](_0x2a5987);})['then'](function(_0xe6ffd8){_0x4103a6[_0x7f73('0x6a')]=_0xe6ffd8;return _0x4103a6;});}})[_0x7f73('0x37')](respondWithFilteredResult(_0x2d3af8,_0x2a5987))[_0x7f73('0x2a')](handleError(_0x2d3af8,null));};exports[_0x7f73('0x6e')]=function(_0x40c55b,_0x2fa2d1,_0x1e7763){return db['WhatsappAccount'][_0x7f73('0x59')]({'where':{'id':_0x40c55b[_0x7f73('0x61')]['id']}})[_0x7f73('0x37')](handleEntityNotFound(_0x2fa2d1,null))[_0x7f73('0x37')](function(_0x5363aa){if(_0x5363aa){return _0x5363aa['removeAnswers'](_0x40c55b[_0x7f73('0x46')][_0x7f73('0x6f')]);}})[_0x7f73('0x37')](respondWithStatusCode(_0x2fa2d1,null))['catch'](handleError(_0x2fa2d1,null));};exports['addAgents']=function(_0x4a76b0,_0x291a62,_0x2bce98){return db[_0x7f73('0x55')]['find']({'where':{'id':_0x4a76b0[_0x7f73('0x61')]['id']}})[_0x7f73('0x37')](handleEntityNotFound(_0x291a62,null))[_0x7f73('0x37')](function(_0xd04d75){if(_0xd04d75){return _0xd04d75[_0x7f73('0x70')](_0x4a76b0[_0x7f73('0x5b')]['ids'],_['omit'](_0x4a76b0[_0x7f73('0x5b')],['ids','id'])||{})[_0x7f73('0x71')](function(_0x16cb7c){for(var _0x781238=0x0;_0x781238<_0x4a76b0[_0x7f73('0x5b')][_0x7f73('0x6f')][_0x7f73('0x4b')];_0x781238+=0x1){socket[_0x7f73('0x72')](_0x7f73('0x73'),{'UserId':Number(_0x4a76b0[_0x7f73('0x5b')][_0x7f73('0x6f')][_0x781238]),'WhatsappAccountId':Number(_0x4a76b0[_0x7f73('0x61')]['id'])});}return _0x16cb7c;});}})['then'](respondWithResult(_0x291a62,null))[_0x7f73('0x2a')](handleError(_0x291a62,null));};exports[_0x7f73('0x74')]=function(_0x491ad3,_0x3032e4,_0x261955){return db[_0x7f73('0x55')][_0x7f73('0x59')]({'where':{'id':_0x491ad3[_0x7f73('0x61')]['id']}})[_0x7f73('0x37')](handleEntityNotFound(_0x3032e4,null))[_0x7f73('0x37')](function(_0x49ba95){if(_0x49ba95){return _0x49ba95[_0x7f73('0x74')](_0x491ad3[_0x7f73('0x46')][_0x7f73('0x6f')])['then'](function(){if(_['isArray'](_0x491ad3[_0x7f73('0x46')]['ids'])){for(var _0x37ab68=0x0;_0x37ab68<_0x491ad3[_0x7f73('0x46')]['ids'][_0x7f73('0x4b')];_0x37ab68+=0x1){socket['emit'](_0x7f73('0x75'),{'UserId':Number(_0x491ad3[_0x7f73('0x46')][_0x7f73('0x6f')][_0x37ab68]),'WhatsappAccountId':Number(_0x491ad3[_0x7f73('0x61')]['id'])});}}else{socket['emit'](_0x7f73('0x75'),{'UserId':Number(_0x491ad3[_0x7f73('0x46')]['ids']),'WhatsappAccountId':Number(_0x491ad3[_0x7f73('0x61')]['id'])});}});}})[_0x7f73('0x37')](respondWithStatusCode(_0x3032e4,null))[_0x7f73('0x2a')](handleError(_0x3032e4,null));};exports[_0x7f73('0x76')]=function(_0x4fb88c,_0x5d5110,_0x848f41){var _0x42fa82={};var _0x186924={};var _0x247ba8;var _0x1bacf1;return db[_0x7f73('0x55')][_0x7f73('0x67')]({'where':{'id':_0x4fb88c[_0x7f73('0x61')]['id']}})[_0x7f73('0x37')](handleEntityNotFound(_0x5d5110,null))[_0x7f73('0x37')](function(_0x42fad6){if(_0x42fad6){_0x247ba8=_0x42fad6;_0x186924[_0x7f73('0x45')]=_['keys'](db[_0x7f73('0x77')][_0x7f73('0x41')]);_0x186924['query']=_[_0x7f73('0x58')](_0x4fb88c[_0x7f73('0x46')]);_0x186924[_0x7f73('0x47')]=_[_0x7f73('0x48')](_0x186924[_0x7f73('0x45')],_0x186924[_0x7f73('0x46')]);_0x42fa82['attributes']=_[_0x7f73('0x48')](_0x186924['model'],qs[_0x7f73('0x4a')](_0x4fb88c[_0x7f73('0x46')][_0x7f73('0x4a')]));_0x42fa82[_0x7f73('0x49')]=_0x42fa82['attributes'][_0x7f73('0x4b')]?_0x42fa82['attributes']:_0x186924[_0x7f73('0x45')];_0x42fa82['order']=qs[_0x7f73('0x4d')](_0x4fb88c[_0x7f73('0x46')][_0x7f73('0x4d')]);_0x42fa82[_0x7f73('0x4e')]=qs['filters'](_[_0x7f73('0x4f')](_0x4fb88c[_0x7f73('0x46')],_0x186924['filters']));if(_0x4fb88c['query'][_0x7f73('0x50')]){_0x42fa82['where']=_[_0x7f73('0x51')](_0x42fa82[_0x7f73('0x4e')],{'$or':_[_0x7f73('0x40')](_0x42fa82[_0x7f73('0x49')],function(_0x4b9e69){var _0x570410={};_0x570410[_0x4b9e69]={'$like':'%'+_0x4fb88c[_0x7f73('0x46')][_0x7f73('0x50')]+'%'};return _0x570410;})});}_0x42fa82=_[_0x7f73('0x51')]({},_0x42fa82,_0x4fb88c[_0x7f73('0x52')]);return _0x247ba8['getAgents'](_0x42fa82);}})[_0x7f73('0x37')](function(_0x177c81){if(_0x177c81){_0x1bacf1=_0x177c81['length'];if(!_0x4fb88c[_0x7f73('0x46')][_0x7f73('0x68')](_0x7f73('0x4c'))){_0x42fa82[_0x7f73('0x2d')]=qs[_0x7f73('0x2d')](_0x4fb88c[_0x7f73('0x46')][_0x7f73('0x2d')]);_0x42fa82[_0x7f73('0x30')]=qs[_0x7f73('0x30')](_0x4fb88c[_0x7f73('0x46')][_0x7f73('0x30')]);}return _0x247ba8[_0x7f73('0x76')](_0x42fa82);}})[_0x7f73('0x37')](function(_0x81c7e6){if(_0x81c7e6){return _0x81c7e6?{'count':_0x1bacf1,'rows':_0x81c7e6}:null;}})[_0x7f73('0x37')](respondWithResult(_0x5d5110,null))[_0x7f73('0x2a')](handleError(_0x5d5110,null));};exports[_0x7f73('0x78')]=function(_0x2f349a,_0x30762b,_0xaf0b34){return db[_0x7f73('0x55')][_0x7f73('0x67')]({'where':{'id':_0x2f349a[_0x7f73('0x61')]['id']}})[_0x7f73('0x37')](handleEntityNotFound(_0x30762b,null))[_0x7f73('0x37')](function(_0x3b5963){if(_0x3b5963){return db[_0x7f73('0x79')][_0x7f73('0x7a')](function(_0x2c8bff){return db[_0x7f73('0x7b')]['destroy']({'where':{'WhatsappAccountId':_0x2f349a[_0x7f73('0x61')]['id']},'transaction':_0x2c8bff})['then'](function(_0x21b3a0){var _0x43d2c9=_[_0x7f73('0x40')](_0x2f349a[_0x7f73('0x5b')],function(_0x2eb31c){_0x2eb31c[_0x7f73('0x65')]=_0x2f349a[_0x7f73('0x61')]['id'];return _0x2eb31c;});return db['WhatsappApplication'][_0x7f73('0x7c')](_0x43d2c9,{'transaction':_0x2c8bff});});})['then'](function(){return db[_0x7f73('0x7b')][_0x7f73('0x7d')]({'where':{'WhatsappAccountId':_0x2f349a[_0x7f73('0x61')]['id']},'order':_0x7f73('0x7e')});});}})[_0x7f73('0x37')](respondWithResult(_0x30762b,null))[_0x7f73('0x2a')](handleError(_0x30762b,null));};exports['getApplications']=function(_0x5e1c69,_0x13ae3a,_0x3ab368){var _0x52daaf={};var _0x5147f3={};var _0x46cd73;var _0x26ca52;return db[_0x7f73('0x55')][_0x7f73('0x67')]({'where':{'id':_0x5e1c69[_0x7f73('0x61')]['id']}})['then'](handleEntityNotFound(_0x13ae3a,null))['then'](function(_0x354130){if(_0x354130){_0x46cd73=_0x354130;_0x5147f3[_0x7f73('0x45')]=_[_0x7f73('0x58')](db['WhatsappApplication'][_0x7f73('0x41')]);_0x5147f3[_0x7f73('0x46')]=_[_0x7f73('0x58')](_0x5e1c69[_0x7f73('0x46')]);_0x5147f3[_0x7f73('0x47')]=_[_0x7f73('0x48')](_0x5147f3['model'],_0x5147f3[_0x7f73('0x46')]);_0x52daaf[_0x7f73('0x49')]=_[_0x7f73('0x48')](_0x5147f3[_0x7f73('0x45')],qs[_0x7f73('0x4a')](_0x5e1c69[_0x7f73('0x46')]['fields']));_0x52daaf[_0x7f73('0x49')]=_0x52daaf[_0x7f73('0x49')]['length']?_0x52daaf[_0x7f73('0x49')]:_0x5147f3[_0x7f73('0x45')];_0x52daaf['order']=qs['sort'](_0x5e1c69['query'][_0x7f73('0x4d')]);_0x52daaf['where']=qs[_0x7f73('0x47')](_[_0x7f73('0x4f')](_0x5e1c69[_0x7f73('0x46')],_0x5147f3[_0x7f73('0x47')]));if(_0x5e1c69[_0x7f73('0x46')][_0x7f73('0x50')]){_0x52daaf['where']=_['merge'](_0x52daaf[_0x7f73('0x4e')],{'$or':_[_0x7f73('0x40')](_0x52daaf['attributes'],function(_0x1c731b){var _0x43029a={};_0x43029a[_0x1c731b]={'$like':'%'+_0x5e1c69['query'][_0x7f73('0x50')]+'%'};return _0x43029a;})});}_0x52daaf=_[_0x7f73('0x51')]({},_0x52daaf,_0x5e1c69[_0x7f73('0x52')]);return _0x46cd73['getApplications'](_0x52daaf);}})[_0x7f73('0x37')](function(_0x37c3ce){if(_0x37c3ce){_0x26ca52=_0x37c3ce[_0x7f73('0x4b')];if(!_0x5e1c69['query'][_0x7f73('0x68')](_0x7f73('0x4c'))){_0x52daaf[_0x7f73('0x2d')]=qs[_0x7f73('0x2d')](_0x5e1c69[_0x7f73('0x46')][_0x7f73('0x2d')]);_0x52daaf[_0x7f73('0x30')]=qs[_0x7f73('0x30')](_0x5e1c69[_0x7f73('0x46')]['offset']);}return _0x46cd73[_0x7f73('0x7f')](_0x52daaf);}})[_0x7f73('0x37')](function(_0x3c7bf9){if(_0x3c7bf9){return _0x3c7bf9?{'count':_0x26ca52,'rows':_0x3c7bf9}:null;}})[_0x7f73('0x37')](respondWithResult(_0x13ae3a,null))[_0x7f73('0x2a')](handleError(_0x13ae3a,null));};exports[_0x7f73('0x80')]=function(_0x5adad2,_0x503e3d,_0xfcbd35){var _0xbe9c26={'channel':_0x7f73('0x81')};var _0x2102bf=[];var _0x503d3d=[];var _0x1261b4={};return db['WhatsappAccount']['find']({'where':{'id':_0x5adad2[_0x7f73('0x61')]['id']},'include':[{'model':db[_0x7f73('0x7b')],'as':_0x7f73('0x82')}]})[_0x7f73('0x37')](handleEntityNotFound(_0x503e3d,null))[_0x7f73('0x37')](function(_0x132434){_0xbe9c26[_0x7f73('0x83')]=_0x132434;_0xbe9c26[_0x7f73('0x84')]=_['orderBy'](_0x132434[_0x7f73('0x82')],[_0x7f73('0x7e')],[_0x7f73('0x85')]);if(_0xbe9c26[_0x7f73('0x83')][_0x7f73('0x82')]){delete _0xbe9c26[_0x7f73('0x83')][_0x7f73('0x82')];}return db[_0x7f73('0x86')][_0x7f73('0x63')]();})[_0x7f73('0x37')](function(_0x30fe2a){if(!_0x30fe2a){throw new db[(_0x7f73('0x87'))][(_0x7f73('0x88'))]('no\x20available\x20attributes');}_0x2102bf=_['difference'](_[_0x7f73('0x58')](_0x30fe2a),[_0x7f73('0x89'),_0x7f73('0x8a')]);_0x503d3d=_['difference'](_[_0x7f73('0x58')](_0x30fe2a),[_0x7f73('0x89'),_0x7f73('0x8a'),_0x7f73('0x8b'),_0x7f73('0x8c')]);_0xbe9c26['body']={'mapKey':_0x7f73('0x8d')};if(_0xbe9c26[_0x7f73('0x83')]['type']&&_0xbe9c26['account'][_0x7f73('0x43')]===_0x7f73('0x8e')){_0xbe9c26[_0x7f73('0x5b')][_0x7f73('0x8f')]=_0x5adad2[_0x7f73('0x5b')][_0x7f73('0x90')][_0x7f73('0x91')]('whatsapp:','');_0xbe9c26['body']['body']=_0x5adad2[_0x7f73('0x5b')][_0x7f73('0x92')];_0xbe9c26[_0x7f73('0x5b')][_0x7f73('0x93')]=_0x5adad2[_0x7f73('0x5b')][_0x7f73('0x94')];}if(_0xbe9c26[_0x7f73('0x5b')]['id']){delete _0xbe9c26[_0x7f73('0x5b')]['id'];}if(_[_0x7f73('0x95')](_0xbe9c26['body']['from'])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x7f73('0x95')](_0xbe9c26[_0x7f73('0x5b')][_0x7f73('0x5b')])||_0xbe9c26[_0x7f73('0x5b')][_0x7f73('0x5b')]===''){throw new db[(_0x7f73('0x87'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7f73('0x95')](_0xbe9c26[_0x7f73('0x5b')][_0x7f73('0x96')])){throw new db['Sequelize'][(_0x7f73('0x88'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x503d3d);}if(!_[_0x7f73('0x97')](_0x503d3d,_0xbe9c26['body']['mapKey'])){throw new db[(_0x7f73('0x87'))][(_0x7f73('0x88'))](_0x7f73('0x98')+_0x503d3d);}_0x1261b4[_0xbe9c26[_0x7f73('0x5b')]['mapKey']]=_0xbe9c26[_0x7f73('0x5b')][_0x7f73('0x8f')];return db[_0x7f73('0x99')][_0x7f73('0x59')]({'where':{'id':_0xbe9c26[_0x7f73('0x83')][_0x7f73('0x8c')]},'include':[{'model':db[_0x7f73('0x86')],'as':_0x7f73('0x9a'),'where':_0x1261b4,'limit':0x1,'order':[[_0x7f73('0x8a'),'DESC']]}]});})[_0x7f73('0x37')](handleEntityNotFound(_0x503e3d,null))['then'](function(_0x3191b4){if(_0x3191b4){_0xbe9c26[_0x7f73('0x9b')]=_['omit'](_0x3191b4,[_0x7f73('0x9a')]);if(_0x3191b4[_0x7f73('0x9a')][_0x7f73('0x4b')]){return _0x3191b4[_0x7f73('0x9a')][0x0];}var _0x573952=_['defaults'](_0xbe9c26[_0x7f73('0x5b')],{'firstName':_0xbe9c26[_0x7f73('0x5b')][_0x7f73('0x8f')],'ListId':_0x3191b4['id']});_0x573952[_0xbe9c26['body']['mapKey']]=_0xbe9c26[_0x7f73('0x5b')][_0x7f73('0x8f')];return db[_0x7f73('0x86')][_0x7f73('0x5a')](_0x573952,{'fields':_0x2102bf,'raw':!![]});}})[_0x7f73('0x37')](handleEntityNotFound(_0x503e3d,null))[_0x7f73('0x37')](function(_0xdbcc58){if(_0xdbcc58){_0xbe9c26[_0x7f73('0x9c')]=_0xdbcc58;var _0x1ae6db={'ContactId':_0xdbcc58['id'],'phone':_0xbe9c26[_0x7f73('0x5b')][_0x7f73('0x8f')],'WhatsappAccountId':_0x5adad2[_0x7f73('0x61')]['id']};var _0x27796e={'ContactId':_0xdbcc58['id'],'WhatsappAccountId':_0x5adad2['params']['id'],'closed':![]};return db[_0x7f73('0x9d')][_0x7f73('0x59')]({'where':_0x27796e})[_0x7f73('0x37')](function(_0x179886){if(_0x179886){return[_0x179886,![]];}return db[_0x7f73('0x9d')][_0x7f73('0x5a')](_0x1ae6db)[_0x7f73('0x37')](function(_0x47655b){return[_0x47655b,!![]];});});}})['spread'](function(_0x1012e4,_0x32a6d3){_0xbe9c26[_0x7f73('0x9e')]=_0x1012e4[_0x7f73('0x38')]({'plain':!![]});_0xbe9c26[_0x7f73('0x9e')][_0x7f73('0x9f')]=![];if(_0x32a6d3){if(_0xbe9c26[_0x7f73('0x83')][_0x7f73('0xa0')]){_0xbe9c26['applications']['push']({'id':0x0,'priority':_0xbe9c26[_0x7f73('0x84')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x7f73('0xa1')});}_0xbe9c26['interaction'][_0x7f73('0x9f')]=!![];}return db[_0x7f73('0xa2')][_0x7f73('0x5a')]({'phone':_0xbe9c26[_0x7f73('0x5b')][_0x7f73('0x8f')],'messageId':_0xbe9c26['body']['messageId'],'body':_0xbe9c26[_0x7f73('0x5b')][_0x7f73('0x5b')],'WhatsappAccountId':_0x5adad2['params']['id'],'WhatsappInteractionId':_0x1012e4['id'],'direction':'in','ContactId':_0x1012e4[_0x7f73('0xa3')],'AttachmentId':_0xbe9c26[_0x7f73('0x5b')][_0x7f73('0xa4')]});})['then'](function(_0x26d5be){_0xbe9c26[_0x7f73('0x29')]=_0x26d5be;if(_0xbe9c26['interaction'][_0x7f73('0xa5')]){return db['User'][_0x7f73('0x59')]({'attributes':['id',_0x7f73('0x3c')],'where':{'id':_0xbe9c26[_0x7f73('0x9e')][_0x7f73('0xa5')]}})[_0x7f73('0x37')](function(_0x483ae1){if(_0x483ae1){_0xbe9c26[_0x7f73('0x84')][_0x7f73('0xa6')]({'id':0x0,'priority':0x0,'app':_0x7f73('0xa7'),'appdata':_0x483ae1[_0x7f73('0x3c')]+','+(_0xbe9c26[_0x7f73('0x83')]['waitForTheAssignedAgent']||0xa),'interval':_0x7f73('0xa1')});}return respondWithRpcPromise(_0x7f73('0xa8'),_0x7f73('0xa9'),_0xbe9c26);});}return respondWithRpcPromise('Start',_0x7f73('0xa9'),_0xbe9c26);})[_0x7f73('0x37')](function(_0x2c94c6){if(_0x2c94c6){var _0x4b4c70=0xc8;var _0x411125=_0x7f73('0xaa');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x411125,_0x4b4c70,_0x7f73('0xab'));logger[_0x7f73('0x24')](_0x7f73('0xac'),_0x411125,_0x4b4c70,_0x7f73('0xab'),JSON['stringify'](_0x2c94c6));if(_0xbe9c26[_0x7f73('0x83')][_0x7f73('0x43')]==='twilio'){return _0x503e3d['status'](_0x4b4c70)[_0x7f73('0x32')]('Content-Type',_0x7f73('0xad'))[_0x7f73('0x3d')](_0x7f73('0xae'));}else{return _0x503e3d['status'](_0x4b4c70)[_0x7f73('0x2c')](_0x2c94c6);}}})[_0x7f73('0x2a')](handleError(_0x503e3d,null));};exports[_0x7f73('0x3d')]=function(_0x4c295a,_0x1c841b,_0x3e92b0){var _0x3a8026,_0x537fab,_0x376db1;if(_[_0x7f73('0x95')](_0x4c295a['body'][_0x7f73('0x5b')])||_0x4c295a[_0x7f73('0x5b')][_0x7f73('0x5b')]===''){throw new db['Sequelize']['ValidationError'](_0x7f73('0xaf'));}if(_[_0x7f73('0x95')](_0x4c295a[_0x7f73('0x5b')]['to'])){throw new db[(_0x7f73('0x87'))]['ValidationError'](_0x7f73('0xb0'));}_0x3a8026=_0x4c295a[_0x7f73('0x5b')]['to'];return db[_0x7f73('0x55')][_0x7f73('0x59')]({'where':{'id':_0x4c295a[_0x7f73('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0x7f73('0xb1'),'include':[{'model':db[_0x7f73('0x86')],'as':'Contacts','where':{'mobile':_0x3a8026},'limit':0x1,'order':[['updatedAt',_0x7f73('0xb2')]]}]}]})[_0x7f73('0x37')](handleEntityNotFound(_0x1c841b,null))['then'](function(_0xb074f){if(_0xb074f&&_0xb074f[_0x7f73('0xb1')]){_0x537fab=_0xb074f[_0x7f73('0x38')]({'plain':!![]});if(_0x537fab[_0x7f73('0xb1')]&&_0x537fab[_0x7f73('0xb1')][_0x7f73('0x9a')][_0x7f73('0x4b')]){return _0x537fab['List'][_0x7f73('0x9a')][0x0];}return db['CmContact'][_0x7f73('0x5a')](_[_0x7f73('0x19')](_0x4c295a[_0x7f73('0x5b')],{'firstName':_0x3a8026,'mobile':_0x3a8026,'phone':_0x3a8026,'ListId':_0x537fab[_0x7f73('0x8c')]}));}})[_0x7f73('0x37')](handleEntityNotFound(_0x1c841b,null))[_0x7f73('0x37')](function(_0x53e300){if(_0x53e300){_0x376db1=_0x53e300;return db['WhatsappInteraction'][_0x7f73('0x59')]({'where':{'ContactId':_0x376db1['id'],'closed':![],'WhatsappAccountId':_0x537fab['id']}})[_0x7f73('0x37')](function(_0x72f1f1){if(_0x72f1f1){return[_0x72f1f1,![]];}return db[_0x7f73('0x9d')][_0x7f73('0x5a')]({'UserId':_0x4c295a[_0x7f73('0x5d')]['id'],'ContactId':_0x376db1['id'],'WhatsappAccountId':_0x537fab['id'],'phone':_0x3a8026,'firstMsgDirection':_0x7f73('0xb3'),'Messages':[_['merge'](_0x4c295a[_0x7f73('0x5b')],{'read':![],'body':_0x4c295a['body'][_0x7f73('0x5b')],'phone':_0x3a8026,'WhatsappAccountId':_0x537fab['id'],'UserId':_0x4c295a[_0x7f73('0x5d')]['id'],'ContactId':_0x376db1['id']})]},{'include':[{'model':db[_0x7f73('0xa2')],'as':'Messages'}]})['then'](function(_0x78b0c3){return[_0x78b0c3,!![]];});});}})['spread'](function(_0x58a191,_0x1d5c12){if(_0x1d5c12){return _0x58a191;}return db[_0x7f73('0xa2')]['create'](_[_0x7f73('0x51')](_0x4c295a[_0x7f73('0x5b')],{'read':![],'body':_0x4c295a[_0x7f73('0x5b')][_0x7f73('0x5b')],'phone':_0x3a8026,'WhatsappAccountId':_0x537fab['id'],'WhatsappInteractionId':_0x58a191['id'],'UserId':_0x4c295a[_0x7f73('0x5d')]['id'],'ContactId':_0x376db1['id']}))[_0x7f73('0x37')](function(_0x15c8f0){_0x58a191[_0x7f73('0xb4')][_0x7f73('0xb5')]=[];_0x58a191[_0x7f73('0xb4')][_0x7f73('0xb5')][_0x7f73('0xb6')](_0x15c8f0[_0x7f73('0xb4')]);return _0x58a191;});})[_0x7f73('0x37')](respondWithResult(_0x1c841b,null))[_0x7f73('0x2a')](handleError(_0x1c841b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 7f5bff3..70366cd 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 _0x34bb=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x43b78f,_0x2880e9){var _0xa5bb5a=function(_0x6f6ddd){while(--_0x6f6ddd){_0x43b78f['push'](_0x43b78f['shift']());}};_0xa5bb5a(++_0x2880e9);}(_0x34bb,0x7a));var _0xb34b=function(_0xc941d,_0x25db14){_0xc941d=_0xc941d-0x0;var _0x29ae55=_0x34bb[_0xc941d];return _0x29ae55;};'use strict';var EventEmitter=require(_0xb34b('0x0'));var WhatsappAccount=require(_0xb34b('0x1'))['db'][_0xb34b('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb34b('0x3')](0x0);var events={'afterCreate':_0xb34b('0x4'),'afterUpdate':_0xb34b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3da338){return function(_0x2e3ccb,_0x1cc454,_0x229e63){WhatsappAccountEvents[_0xb34b('0x6')](_0x3da338+':'+_0x2e3ccb['id'],_0x2e3ccb);WhatsappAccountEvents[_0xb34b('0x6')](_0x3da338,_0x2e3ccb);_0x229e63(null);};}for(var e in events){if(events[_0xb34b('0x7')](e)){var event=events[e];WhatsappAccount[_0xb34b('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xff1c=['update','emit','hasOwnProperty','exports','events','WhatsappAccount','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff1c,0x1c4));var _0xcff1=function(_0xa40135,_0x5ccefa){_0xa40135=_0xa40135-0x0;var _0x27e38c=_0xff1c[_0xa40135];return _0x27e38c;};'use strict';var EventEmitter=require(_0xcff1('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xcff1('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xcff1('0x2')](0x0);var events={'afterCreate':_0xcff1('0x3'),'afterUpdate':_0xcff1('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa737e){return function(_0x146642,_0xe802ec,_0x16d41a){WhatsappAccountEvents[_0xcff1('0x5')](_0xa737e+':'+_0x146642['id'],_0x146642);WhatsappAccountEvents['emit'](_0xa737e,_0x146642);_0x16d41a(null);};}for(var e in events){if(events[_0xcff1('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xcff1('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 5e66d81..7e30e7f 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 _0x5d9e=['path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','moment','request-promise'];(function(_0x3875cb,_0x978722){var _0x3e2c08=function(_0x54f2a4){while(--_0x54f2a4){_0x3875cb['push'](_0x3875cb['shift']());}};_0x3e2c08(++_0x978722);}(_0x5d9e,0x8b));var _0xe5d9=function(_0x42a6af,_0x5d3070){_0x42a6af=_0x42a6af-0x0;var _0x25a639=_0x5d9e[_0x42a6af];return _0x25a639;};'use strict';var _=require(_0xe5d9('0x0'));var util=require(_0xe5d9('0x1'));var logger=require(_0xe5d9('0x2'))('api');var moment=require(_0xe5d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xe5d9('0x4'));var fs=require('fs');var path=require(_0xe5d9('0x5'));var rimraf=require(_0xe5d9('0x6'));var config=require('../../config/environment');var attributes=require(_0xe5d9('0x7'));module[_0xe5d9('0x8')]=function(_0x4dbc07,_0x48f012){return _0x4dbc07[_0xe5d9('0x9')](_0xe5d9('0xa'),attributes,{'tableName':_0xe5d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0dff=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts'];(function(_0x340da7,_0x13d6fc){var _0x43b466=function(_0x59e11e){while(--_0x59e11e){_0x340da7['push'](_0x340da7['shift']());}};_0x43b466(++_0x13d6fc);}(_0x0dff,0xa5));var _0xf0df=function(_0x34d494,_0x423fdb){_0x34d494=_0x34d494-0x0;var _0x3ecdc1=_0x0dff[_0x34d494];return _0x3ecdc1;};'use strict';var _=require('lodash');var util=require(_0xf0df('0x0'));var logger=require(_0xf0df('0x1'))('api');var moment=require(_0xf0df('0x2'));var BPromise=require(_0xf0df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0df('0x4'));var rimraf=require(_0xf0df('0x5'));var config=require(_0xf0df('0x6'));var attributes=require(_0xf0df('0x7'));module[_0xf0df('0x8')]=function(_0x3e24cc,_0x3ffaa1){return _0x3e24cc[_0xf0df('0x9')]('WhatsappAccount',attributes,{'tableName':_0xf0df('0xa'),'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 53966aa..7547f40 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 _0x2cfa=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','request\x20sent','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','find','options','where','attributes','include','map','model'];(function(_0x3c5ad6,_0x47b7bf){var _0x3154f2=function(_0x3a24de){while(--_0x3a24de){_0x3c5ad6['push'](_0x3c5ad6['shift']());}};_0x3154f2(++_0x47b7bf);}(_0x2cfa,0x1a0));var _0xa2cf=function(_0x4fcd21,_0x3b4148){_0x4fcd21=_0x4fcd21-0x0;var _0x3af7b8=_0x2cfa[_0x4fcd21];return _0x3af7b8;};'use strict';var _=require(_0xa2cf('0x0'));var util=require('util');var moment=require(_0xa2cf('0x1'));var BPromise=require('bluebird');var rs=require(_0xa2cf('0x2'));var fs=require('fs');var Redis=require(_0xa2cf('0x3'));var db=require(_0xa2cf('0x4'))['db'];var utils=require(_0xa2cf('0x5'));var logger=require('../../config/logger')(_0xa2cf('0x6'));var config=require(_0xa2cf('0x7'));var jayson=require(_0xa2cf('0x8'));var client=jayson[_0xa2cf('0x9')][_0xa2cf('0xa')]({'port':0x232a});config['redis']=_[_0xa2cf('0xb')](config[_0xa2cf('0xc')],{'host':_0xa2cf('0xd'),'port':0x18eb});var socket=require(_0xa2cf('0xe'))(new Redis(config[_0xa2cf('0xc')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2faa2c,_0x54fd3c,_0x3b986a){return new BPromise(function(_0x391d57,_0x24dc66){return client[_0xa2cf('0xf')](_0x2faa2c,_0x3b986a)[_0xa2cf('0x10')](function(_0xb61bb){logger[_0xa2cf('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x54fd3c,_0xa2cf('0x12'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x54fd3c,_0xa2cf('0x12'),JSON['stringify'](_0xb61bb));if(_0xb61bb[_0xa2cf('0x13')]){if(_0xb61bb[_0xa2cf('0x13')]['code']===0x1f4){logger[_0xa2cf('0x13')](_0xa2cf('0x14'),_0x54fd3c,_0xb61bb['error']['message']);return _0x24dc66(_0xb61bb[_0xa2cf('0x13')][_0xa2cf('0x15')]);}logger[_0xa2cf('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x54fd3c,_0xb61bb['error'][_0xa2cf('0x15')]);return _0x391d57(_0xb61bb['error'][_0xa2cf('0x15')]);}else{logger[_0xa2cf('0x11')](_0xa2cf('0x14'),_0x54fd3c,_0xa2cf('0x12'));_0x391d57(_0xb61bb[_0xa2cf('0x16')][_0xa2cf('0x15')]);}})[_0xa2cf('0x17')](function(_0x5311fe){logger[_0xa2cf('0x13')](_0xa2cf('0x14'),_0x54fd3c,_0x5311fe);_0x24dc66(_0x5311fe);});});}exports[_0xa2cf('0x18')]=function(_0x37b04c){var _0x54e3c8=this;return new Promise(function(_0x42d59e,_0x4149f8){return db['WhatsappAccount'][_0xa2cf('0x19')]({'raw':_0x37b04c[_0xa2cf('0x1a')]?_0x37b04c['options']['raw']===undefined?!![]:![]:!![],'where':_0x37b04c[_0xa2cf('0x1a')]?_0x37b04c['options'][_0xa2cf('0x1b')]||null:null,'attributes':_0x37b04c[_0xa2cf('0x1a')]?_0x37b04c[_0xa2cf('0x1a')][_0xa2cf('0x1c')]||null:null,'include':_0x37b04c[_0xa2cf('0x1a')]?_0x37b04c[_0xa2cf('0x1a')][_0xa2cf('0x1d')]?_[_0xa2cf('0x1e')](_0x37b04c[_0xa2cf('0x1a')][_0xa2cf('0x1d')],function(_0x5a1d52){return{'model':db[_0x5a1d52['model']],'as':_0x5a1d52['as'],'attributes':_0x5a1d52['attributes'],'include':_0x5a1d52[_0xa2cf('0x1d')]?_[_0xa2cf('0x1e')](_0x5a1d52[_0xa2cf('0x1d')],function(_0x7156cf){return{'model':db[_0x7156cf[_0xa2cf('0x1f')]],'as':_0x7156cf['as'],'attributes':_0x7156cf[_0xa2cf('0x1c')],'include':_0x7156cf['include']?_[_0xa2cf('0x1e')](_0x7156cf[_0xa2cf('0x1d')],function(_0x3b9dd4){return{'model':db[_0x3b9dd4[_0xa2cf('0x1f')]],'as':_0x3b9dd4['as'],'attributes':_0x3b9dd4[_0xa2cf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa2cf('0x10')](function(_0x3a87c1){logger[_0xa2cf('0x11')](_0xa2cf('0x18'),_0x37b04c);logger['debug'](_0xa2cf('0x18'),_0x37b04c,JSON['stringify'](_0x3a87c1));_0x42d59e(_0x3a87c1);})[_0xa2cf('0x17')](function(_0x260220){logger[_0xa2cf('0x13')](_0xa2cf('0x18'),_0x260220['message'],_0x37b04c);_0x4149f8(_0x54e3c8[_0xa2cf('0x13')](0x1f4,_0x260220[_0xa2cf('0x15')]));});});}; \ No newline at end of file +var _0x546b=['request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','map','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','WhatsappAccount,\x20%s,\x20%s'];(function(_0x49459e,_0x33e67c){var _0x3c1f85=function(_0x43693a){while(--_0x43693a){_0x49459e['push'](_0x49459e['shift']());}};_0x3c1f85(++_0x33e67c);}(_0x546b,0x17a));var _0xb546=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0x546b[_0x1db251];return _0x56685a;};'use strict';var _=require(_0xb546('0x0'));var util=require('util');var moment=require(_0xb546('0x1'));var BPromise=require(_0xb546('0x2'));var rs=require(_0xb546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb546('0x4'))['db'];var utils=require(_0xb546('0x5'));var logger=require(_0xb546('0x6'))(_0xb546('0x7'));var config=require(_0xb546('0x8'));var jayson=require(_0xb546('0x9'));var client=jayson[_0xb546('0xa')][_0xb546('0xb')]({'port':0x232a});config[_0xb546('0xc')]=_['defaults'](config['redis'],{'host':_0xb546('0xd'),'port':0x18eb});var socket=require(_0xb546('0xe'))(new Redis(config[_0xb546('0xc')]));require('./whatsappAccount.socket')[_0xb546('0xf')](socket);function respondWithRpcPromise(_0x37e7c2,_0xf7791c,_0x32bb65){return new BPromise(function(_0x113422,_0x44f74a){return client['request'](_0x37e7c2,_0x32bb65)[_0xb546('0x10')](function(_0x46ff2c){logger['info'](_0xb546('0x11'),_0xf7791c,_0xb546('0x12'));logger['debug'](_0xb546('0x13'),_0xf7791c,_0xb546('0x12'),JSON[_0xb546('0x14')](_0x46ff2c));if(_0x46ff2c[_0xb546('0x15')]){if(_0x46ff2c[_0xb546('0x15')][_0xb546('0x16')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xf7791c,_0x46ff2c[_0xb546('0x15')]['message']);return _0x44f74a(_0x46ff2c[_0xb546('0x15')][_0xb546('0x17')]);}logger[_0xb546('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0xf7791c,_0x46ff2c[_0xb546('0x15')]['message']);return _0x113422(_0x46ff2c['error'][_0xb546('0x17')]);}else{logger[_0xb546('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0xf7791c,_0xb546('0x12'));_0x113422(_0x46ff2c[_0xb546('0x19')]['message']);}})[_0xb546('0x1a')](function(_0x18cdaf){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xf7791c,_0x18cdaf);_0x44f74a(_0x18cdaf);});});}exports[_0xb546('0x1b')]=function(_0x41906c){var _0x592a65=this;return new Promise(function(_0x1a93eb,_0x4ba355){return db[_0xb546('0x1c')][_0xb546('0x1d')]({'raw':_0x41906c[_0xb546('0x1e')]?_0x41906c[_0xb546('0x1e')][_0xb546('0x1f')]===undefined?!![]:![]:!![],'where':_0x41906c['options']?_0x41906c[_0xb546('0x1e')]['where']||null:null,'attributes':_0x41906c[_0xb546('0x1e')]?_0x41906c[_0xb546('0x1e')][_0xb546('0x20')]||null:null,'include':_0x41906c[_0xb546('0x1e')]?_0x41906c[_0xb546('0x1e')][_0xb546('0x21')]?_[_0xb546('0x22')](_0x41906c[_0xb546('0x1e')]['include'],function(_0x46f2c0){return{'model':db[_0x46f2c0['model']],'as':_0x46f2c0['as'],'attributes':_0x46f2c0[_0xb546('0x20')],'include':_0x46f2c0['include']?_[_0xb546('0x22')](_0x46f2c0[_0xb546('0x21')],function(_0x52792a){return{'model':db[_0x52792a['model']],'as':_0x52792a['as'],'attributes':_0x52792a[_0xb546('0x20')],'include':_0x52792a['include']?_['map'](_0x52792a[_0xb546('0x21')],function(_0x56ba59){return{'model':db[_0x56ba59[_0xb546('0x23')]],'as':_0x56ba59['as'],'attributes':_0x56ba59[_0xb546('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb546('0x10')](function(_0xcb4502){logger[_0xb546('0x18')](_0xb546('0x1b'),_0x41906c);logger['debug']('ShowWhatsappAccount',_0x41906c,JSON[_0xb546('0x14')](_0xcb4502));_0x1a93eb(_0xcb4502);})[_0xb546('0x1a')](function(_0x1c920d){logger[_0xb546('0x15')](_0xb546('0x1b'),_0x1c920d[_0xb546('0x17')],_0x41906c);_0x4ba355(_0x592a65[_0xb546('0x15')](0x1f4,_0x1c920d[_0xb546('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 02ddf1b..fa1f1f6 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 _0x9acd=['./whatsappAccount.events','save','remove','update','removeListener','register','length','whatsappAccount:'];(function(_0x27367e,_0x2b8de3){var _0x34e3ee=function(_0x3cfb99){while(--_0x3cfb99){_0x27367e['push'](_0x27367e['shift']());}};_0x34e3ee(++_0x2b8de3);}(_0x9acd,0xc8));var _0xd9ac=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9acd[_0x334841];return _0x5beb4b;};'use strict';var WhatsappAccountEvents=require(_0xd9ac('0x0'));var events=[_0xd9ac('0x1'),_0xd9ac('0x2'),_0xd9ac('0x3')];function createListener(_0x576dda,_0xa45128){return function(_0x2bbba0){_0xa45128['emit'](_0x576dda,_0x2bbba0);};}function removeListener(_0x474bfd,_0x55f863){return function(){WhatsappAccountEvents[_0xd9ac('0x4')](_0x474bfd,_0x55f863);};}exports[_0xd9ac('0x5')]=function(_0x508b49){for(var _0x4f105f=0x0,_0x4838e4=events[_0xd9ac('0x6')];_0x4f105f<_0x4838e4;_0x4f105f++){var _0xf344b=events[_0x4f105f];var _0xadb044=createListener(_0xd9ac('0x7')+_0xf344b,_0x508b49);WhatsappAccountEvents['on'](_0xf344b,_0xadb044);}}; \ No newline at end of file +var _0xbc8d=['removeListener','register','length','whatsappAccount:','remove','emit'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xbc8d,0x94));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0xdbc8('0x0'),'update'];function createListener(_0x24e574,_0x3c0ab4){return function(_0x1f5222){_0x3c0ab4[_0xdbc8('0x1')](_0x24e574,_0x1f5222);};}function removeListener(_0x571330,_0x216f45){return function(){WhatsappAccountEvents[_0xdbc8('0x2')](_0x571330,_0x216f45);};}exports[_0xdbc8('0x3')]=function(_0x57e518){for(var _0x161d3e=0x0,_0x3887b2=events[_0xdbc8('0x4')];_0x161d3e<_0x3887b2;_0x161d3e++){var _0x1a283e=events[_0x161d3e];var _0x3d459f=createListener(_0xdbc8('0x5')+_0x1a283e,_0x57e518);WhatsappAccountEvents['on'](_0x1a283e,_0x3d459f);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 3bbc4b9..86b434c 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 _0xbb93=['/:id','show','post','delete','exports','util','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated'];(function(_0xd19602,_0x279863){var _0x1f083f=function(_0x5b704b){while(--_0x5b704b){_0xd19602['push'](_0xd19602['shift']());}};_0x1f083f(++_0x279863);}(_0xbb93,0xa1));var _0x3bb9=function(_0x4a3de2,_0x2fcb03){_0x4a3de2=_0x4a3de2-0x0;var _0x279bde=_0xbb93[_0x4a3de2];return _0x279bde;};'use strict';var multer=require('multer');var util=require(_0x3bb9('0x0'));var path=require(_0x3bb9('0x1'));var timeout=require(_0x3bb9('0x2'));var express=require(_0x3bb9('0x3'));var router=express[_0x3bb9('0x4')]();var fs_extra=require(_0x3bb9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x3bb9('0x6')]('/',auth[_0x3bb9('0x7')](),controller['index']);router[_0x3bb9('0x6')](_0x3bb9('0x8'),auth[_0x3bb9('0x7')](),controller[_0x3bb9('0x9')]);router[_0x3bb9('0xa')]('/',auth[_0x3bb9('0x7')](),controller['create']);router['put'](_0x3bb9('0x8'),auth[_0x3bb9('0x7')](),controller['update']);router[_0x3bb9('0xb')](_0x3bb9('0x8'),auth[_0x3bb9('0x7')](),controller['destroy']);module[_0x3bb9('0xc')]=router; \ No newline at end of file +var _0x2ddb=['Router','fs-extra','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','post','create','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x2ddb,0x11d));var _0xb2dd=function(_0x188b35,_0x30bc5d){_0x188b35=_0x188b35-0x0;var _0x166778=_0x2ddb[_0x188b35];return _0x166778;};'use strict';var multer=require(_0xb2dd('0x0'));var util=require('util');var path=require(_0xb2dd('0x1'));var timeout=require(_0xb2dd('0x2'));var express=require('express');var router=express[_0xb2dd('0x3')]();var fs_extra=require(_0xb2dd('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb2dd('0x5'));var controller=require(_0xb2dd('0x6'));router[_0xb2dd('0x7')]('/',auth[_0xb2dd('0x8')](),controller[_0xb2dd('0x9')]);router[_0xb2dd('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb2dd('0xa')]);router[_0xb2dd('0xb')]('/',auth[_0xb2dd('0x8')](),controller[_0xb2dd('0xc')]);router['put'](_0xb2dd('0xd'),auth[_0xb2dd('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb2dd('0x8')](),controller[_0xb2dd('0xe')]);module[_0xb2dd('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 8432a08..0bbdc05 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 _0x0001=['sequelize','INTEGER','noop','TEXT','STRING'];(function(_0x4324e4,_0x2c9f7a){var _0x31c8b9=function(_0x1059a3){while(--_0x1059a3){_0x4324e4['push'](_0x4324e4['shift']());}};_0x31c8b9(++_0x2c9f7a);}(_0x0001,0x154));var _0x1000=function(_0x4527b3,_0x70e163){_0x4527b3=_0x4527b3-0x0;var _0x32e04d=_0x0001[_0x4527b3];return _0x32e04d;};'use strict';var Sequelize=require(_0x1000('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1000('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1000('0x2')},'appdata':{'type':Sequelize[_0x1000('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1000('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb910=['exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x1412db,_0x288f5c){var _0x12349a=function(_0x2d1ca8){while(--_0x2d1ca8){_0x1412db['push'](_0x1412db['shift']());}};_0x12349a(++_0x288f5c);}(_0xb910,0x1ea));var _0x0b91=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xb910[_0x3ea913];return _0x2b4f28;};'use strict';var Sequelize=require('sequelize');module[_0x0b91('0x0')]={'priority':{'type':Sequelize[_0x0b91('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0b91('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0b91('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0b91('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 9c5a707..c27ced3 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 _0x6b19=['name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x67c742,_0x24d70d){var _0x2b36c6=function(_0x22c36b){while(--_0x22c36b){_0x67c742['push'](_0x67c742['shift']());}};_0x2b36c6(++_0x24d70d);}(_0x6b19,0xf4));var _0x96b1=function(_0x3cdf08,_0x5d36ed){_0x3cdf08=_0x3cdf08-0x0;var _0x123667=_0x6b19[_0x3cdf08];return _0x123667;};'use strict';var emlformat=require(_0x96b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96b1('0x1'));var jsonpatch=require(_0x96b1('0x2'));var rp=require('request-promise');var moment=require(_0x96b1('0x3'));var BPromise=require(_0x96b1('0x4'));var Mustache=require(_0x96b1('0x5'));var util=require(_0x96b1('0x6'));var path=require('path');var sox=require(_0x96b1('0x7'));var csv=require(_0x96b1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96b1('0x9'));var squel=require(_0x96b1('0xa'));var crypto=require('crypto');var jsforce=require(_0x96b1('0xb'));var deskjs=require(_0x96b1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x96b1('0xd'));var Papa=require(_0x96b1('0xe'));var Redis=require(_0x96b1('0xf'));var authService=require(_0x96b1('0x10'));var qs=require(_0x96b1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96b1('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x96b1('0x13'));var db=require(_0x96b1('0x14'))['db'];function respondWithStatusCode(_0x16ee32,_0x1d942a){_0x1d942a=_0x1d942a||0xcc;return function(_0x2d7569){if(_0x2d7569){return _0x16ee32['sendStatus'](_0x1d942a);}return _0x16ee32[_0x96b1('0x15')](_0x1d942a)[_0x96b1('0x16')]();};}function respondWithResult(_0xe809b6,_0x2dbaac){_0x2dbaac=_0x2dbaac||0xc8;return function(_0x28b596){if(_0x28b596){return _0xe809b6[_0x96b1('0x15')](_0x2dbaac)[_0x96b1('0x17')](_0x28b596);}};}function respondWithFilteredResult(_0x1e5fdf,_0x3ba832){return function(_0x5772d3){if(_0x5772d3){var _0x2e9615=typeof _0x3ba832[_0x96b1('0x18')]===_0x96b1('0x19')&&typeof _0x3ba832[_0x96b1('0x1a')]===_0x96b1('0x19');var _0x23852a=_0x5772d3[_0x96b1('0x1b')];var _0x41227b=_0x2e9615?0x0:_0x3ba832[_0x96b1('0x18')];var _0x44cc44=_0x2e9615?_0x5772d3[_0x96b1('0x1b')]:_0x3ba832['offset']+_0x3ba832['limit'];var _0x151178;if(_0x44cc44>=_0x23852a){_0x44cc44=_0x23852a;_0x151178=0xc8;}else{_0x151178=0xce;}_0x1e5fdf['status'](_0x151178);return _0x1e5fdf['set'](_0x96b1('0x1c'),_0x41227b+'-'+_0x44cc44+'/'+_0x23852a)[_0x96b1('0x17')](_0x5772d3);}return null;};}function patchUpdates(_0x2bb819){return function(_0x4f0d78){try{jsonpatch[_0x96b1('0x1d')](_0x4f0d78,_0x2bb819,!![]);}catch(_0x3954e3){return BPromise[_0x96b1('0x1e')](_0x3954e3);}return _0x4f0d78[_0x96b1('0x1f')]();};}function saveUpdates(_0x1e1436,_0x276919){return function(_0x416022){if(_0x416022){return _0x416022[_0x96b1('0x20')](_0x1e1436)[_0x96b1('0x21')](function(_0x3a17d3){return _0x3a17d3;});}return null;};}function removeEntity(_0x2acd58,_0x1b0f88){return function(_0x295f05){if(_0x295f05){return _0x295f05[_0x96b1('0x22')]()[_0x96b1('0x21')](function(){_0x2acd58[_0x96b1('0x15')](0xcc)[_0x96b1('0x16')]();});}};}function handleEntityNotFound(_0x5b19b6,_0x3f5049){return function(_0x226603){if(!_0x226603){_0x5b19b6[_0x96b1('0x23')](0x194);}return _0x226603;};}function handleError(_0x321863,_0x3b7492){_0x3b7492=_0x3b7492||0x1f4;return function(_0x2ad760){logger['error'](_0x2ad760['stack']);if(_0x2ad760[_0x96b1('0x24')]){delete _0x2ad760['name'];}_0x321863[_0x96b1('0x15')](_0x3b7492)[_0x96b1('0x25')](_0x2ad760);};}exports[_0x96b1('0x26')]=function(_0x106864,_0x4e4426){var _0x59fc7c={},_0x45c20e={},_0x9fc960={'count':0x0,'rows':[]};var _0x5a9332=_[_0x96b1('0x27')](db[_0x96b1('0x28')][_0x96b1('0x29')],function(_0x2262ad){return{'name':_0x2262ad[_0x96b1('0x2a')],'type':_0x2262ad[_0x96b1('0x2b')]['key']};});_0x45c20e[_0x96b1('0x2c')]=_[_0x96b1('0x27')](_0x5a9332,_0x96b1('0x24'));_0x45c20e[_0x96b1('0x2d')]=_[_0x96b1('0x2e')](_0x106864[_0x96b1('0x2d')]);_0x45c20e[_0x96b1('0x2f')]=_[_0x96b1('0x30')](_0x45c20e['model'],_0x45c20e[_0x96b1('0x2d')]);_0x59fc7c[_0x96b1('0x31')]=_[_0x96b1('0x30')](_0x45c20e[_0x96b1('0x2c')],qs[_0x96b1('0x32')](_0x106864[_0x96b1('0x2d')][_0x96b1('0x32')]));_0x59fc7c[_0x96b1('0x31')]=_0x59fc7c['attributes'][_0x96b1('0x33')]?_0x59fc7c[_0x96b1('0x31')]:_0x45c20e[_0x96b1('0x2c')];if(!_0x106864['query']['hasOwnProperty'](_0x96b1('0x34'))){_0x59fc7c[_0x96b1('0x1a')]=qs['limit'](_0x106864['query']['limit']);_0x59fc7c[_0x96b1('0x18')]=qs[_0x96b1('0x18')](_0x106864[_0x96b1('0x2d')][_0x96b1('0x18')]);}_0x59fc7c[_0x96b1('0x35')]=qs[_0x96b1('0x36')](_0x106864[_0x96b1('0x2d')]['sort']);_0x59fc7c[_0x96b1('0x37')]=qs['filters'](_['pick'](_0x106864[_0x96b1('0x2d')],_0x45c20e[_0x96b1('0x2f')]),_0x5a9332);if(_0x106864['query'][_0x96b1('0x38')]){_0x59fc7c[_0x96b1('0x37')]=_[_0x96b1('0x39')](_0x59fc7c[_0x96b1('0x37')],{'$or':_[_0x96b1('0x27')](_0x5a9332,function(_0x49a5d7){if(_0x49a5d7[_0x96b1('0x2b')]!==_0x96b1('0x3a')){var _0x35ea21={};_0x35ea21[_0x49a5d7['name']]={'$like':'%'+_0x106864[_0x96b1('0x2d')]['filter']+'%'};return _0x35ea21;}})});}_0x59fc7c=_[_0x96b1('0x39')]({},_0x59fc7c,_0x106864['options']);var _0x53e072={'where':_0x59fc7c[_0x96b1('0x37')]};return db[_0x96b1('0x28')][_0x96b1('0x1b')](_0x53e072)[_0x96b1('0x21')](function(_0x4833c0){_0x9fc960[_0x96b1('0x1b')]=_0x4833c0;if(_0x106864[_0x96b1('0x2d')][_0x96b1('0x3b')]){_0x59fc7c[_0x96b1('0x3c')]=[{'all':!![]}];}return db[_0x96b1('0x28')][_0x96b1('0x3d')](_0x59fc7c);})[_0x96b1('0x21')](function(_0x52c232){_0x9fc960[_0x96b1('0x3e')]=_0x52c232;return _0x9fc960;})[_0x96b1('0x21')](respondWithFilteredResult(_0x4e4426,_0x59fc7c))[_0x96b1('0x3f')](handleError(_0x4e4426,null));};exports[_0x96b1('0x40')]=function(_0x50949f,_0x101253){var _0x40adda={'raw':!![],'where':{'id':_0x50949f[_0x96b1('0x41')]['id']}},_0x40a022={};_0x40a022[_0x96b1('0x2c')]=_[_0x96b1('0x2e')](db[_0x96b1('0x28')]['rawAttributes']);_0x40a022[_0x96b1('0x2d')]=_['keys'](_0x50949f[_0x96b1('0x2d')]);_0x40a022[_0x96b1('0x2f')]=_[_0x96b1('0x30')](_0x40a022[_0x96b1('0x2c')],_0x40a022[_0x96b1('0x2d')]);_0x40adda[_0x96b1('0x31')]=_[_0x96b1('0x30')](_0x40a022[_0x96b1('0x2c')],qs[_0x96b1('0x32')](_0x50949f[_0x96b1('0x2d')][_0x96b1('0x32')]));_0x40adda[_0x96b1('0x31')]=_0x40adda['attributes']['length']?_0x40adda[_0x96b1('0x31')]:_0x40a022['model'];if(_0x50949f['query'][_0x96b1('0x3b')]){_0x40adda['include']=[{'all':!![]}];}_0x40adda=_[_0x96b1('0x39')]({},_0x40adda,_0x50949f[_0x96b1('0x42')]);return db[_0x96b1('0x28')]['find'](_0x40adda)[_0x96b1('0x21')](handleEntityNotFound(_0x101253,null))[_0x96b1('0x21')](respondWithResult(_0x101253,null))[_0x96b1('0x3f')](handleError(_0x101253,null));};exports[_0x96b1('0x43')]=function(_0x584582,_0x27be9f){return db['WhatsappApplication'][_0x96b1('0x43')](_0x584582[_0x96b1('0x44')],{})[_0x96b1('0x21')](respondWithResult(_0x27be9f,0xc9))[_0x96b1('0x3f')](handleError(_0x27be9f,null));};exports[_0x96b1('0x20')]=function(_0x3070da,_0x248844){if(_0x3070da[_0x96b1('0x44')]['id']){delete _0x3070da['body']['id'];}return db[_0x96b1('0x28')][_0x96b1('0x45')]({'where':{'id':_0x3070da['params']['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x248844,null))[_0x96b1('0x21')](saveUpdates(_0x3070da[_0x96b1('0x44')],null))[_0x96b1('0x21')](respondWithResult(_0x248844,null))[_0x96b1('0x3f')](handleError(_0x248844,null));};exports[_0x96b1('0x22')]=function(_0x404848,_0x2159ba){return db[_0x96b1('0x28')]['find']({'where':{'id':_0x404848[_0x96b1('0x41')]['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x2159ba,null))[_0x96b1('0x21')](removeEntity(_0x2159ba,null))[_0x96b1('0x3f')](handleError(_0x2159ba,null));}; \ No newline at end of file +var _0xa498=['fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x4cd3da,_0x5b1dd3){var _0x567881=function(_0x13de75){while(--_0x13de75){_0x4cd3da['push'](_0x4cd3da['shift']());}};_0x567881(++_0x5b1dd3);}(_0xa498,0x1d6));var _0x8a49=function(_0x173eff,_0x55a7d0){_0x173eff=_0x173eff-0x0;var _0x119fbd=_0xa498[_0x173eff];return _0x119fbd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a49('0x0'));var zipdir=require(_0x8a49('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8a49('0x2'));var BPromise=require(_0x8a49('0x3'));var Mustache=require(_0x8a49('0x4'));var util=require(_0x8a49('0x5'));var path=require(_0x8a49('0x6'));var sox=require('sox');var csv=require(_0x8a49('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a49('0x8'));var _=require(_0x8a49('0x9'));var squel=require(_0x8a49('0xa'));var crypto=require('crypto');var jsforce=require(_0x8a49('0xb'));var deskjs=require(_0x8a49('0xc'));var toCsv=require(_0x8a49('0x7'));var querystring=require(_0x8a49('0xd'));var Papa=require(_0x8a49('0xe'));var Redis=require(_0x8a49('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8a49('0x10'));var as=require(_0x8a49('0x11'));var hardwareService=require(_0x8a49('0x12'));var logger=require(_0x8a49('0x13'))(_0x8a49('0x14'));var utils=require(_0x8a49('0x15'));var config=require(_0x8a49('0x16'));var licenseUtil=require(_0x8a49('0x17'));var db=require(_0x8a49('0x18'))['db'];function respondWithStatusCode(_0x5b8111,_0x352528){_0x352528=_0x352528||0xcc;return function(_0x6ee27b){if(_0x6ee27b){return _0x5b8111[_0x8a49('0x19')](_0x352528);}return _0x5b8111['status'](_0x352528)[_0x8a49('0x1a')]();};}function respondWithResult(_0x57b350,_0x4454de){_0x4454de=_0x4454de||0xc8;return function(_0x2fe212){if(_0x2fe212){return _0x57b350['status'](_0x4454de)[_0x8a49('0x1b')](_0x2fe212);}};}function respondWithFilteredResult(_0x902ee2,_0x329a7b){return function(_0x4760d7){if(_0x4760d7){var _0x5275aa=typeof _0x329a7b['offset']===_0x8a49('0x1c')&&typeof _0x329a7b[_0x8a49('0x1d')]===_0x8a49('0x1c');var _0x2d0261=_0x4760d7['count'];var _0x47604e=_0x5275aa?0x0:_0x329a7b[_0x8a49('0x1e')];var _0x47328a=_0x5275aa?_0x4760d7[_0x8a49('0x1f')]:_0x329a7b[_0x8a49('0x1e')]+_0x329a7b['limit'];var _0x5ac3ca;if(_0x47328a>=_0x2d0261){_0x47328a=_0x2d0261;_0x5ac3ca=0xc8;}else{_0x5ac3ca=0xce;}_0x902ee2[_0x8a49('0x20')](_0x5ac3ca);return _0x902ee2[_0x8a49('0x21')](_0x8a49('0x22'),_0x47604e+'-'+_0x47328a+'/'+_0x2d0261)['json'](_0x4760d7);}return null;};}function patchUpdates(_0x2baa30){return function(_0x2e45fc){try{jsonpatch[_0x8a49('0x23')](_0x2e45fc,_0x2baa30,!![]);}catch(_0x21f407){return BPromise[_0x8a49('0x24')](_0x21f407);}return _0x2e45fc[_0x8a49('0x25')]();};}function saveUpdates(_0x16072f,_0x4bc3bc){return function(_0x304372){if(_0x304372){return _0x304372[_0x8a49('0x26')](_0x16072f)['then'](function(_0x3b6220){return _0x3b6220;});}return null;};}function removeEntity(_0x479bca,_0x41bee7){return function(_0x52811c){if(_0x52811c){return _0x52811c[_0x8a49('0x27')]()[_0x8a49('0x28')](function(){_0x479bca[_0x8a49('0x20')](0xcc)[_0x8a49('0x1a')]();});}};}function handleEntityNotFound(_0xe2ca8b,_0x2b5d8b){return function(_0x1b0a01){if(!_0x1b0a01){_0xe2ca8b['sendStatus'](0x194);}return _0x1b0a01;};}function handleError(_0x2fc60e,_0x4d72a3){_0x4d72a3=_0x4d72a3||0x1f4;return function(_0x29af9f){logger['error'](_0x29af9f[_0x8a49('0x29')]);if(_0x29af9f[_0x8a49('0x2a')]){delete _0x29af9f['name'];}_0x2fc60e['status'](_0x4d72a3)[_0x8a49('0x2b')](_0x29af9f);};}exports[_0x8a49('0x2c')]=function(_0x387b06,_0x30fffd){var _0x484a57={},_0x29de89={},_0xef6542={'count':0x0,'rows':[]};var _0x33d7c6=_[_0x8a49('0x2d')](db[_0x8a49('0x2e')]['rawAttributes'],function(_0x223ed9){return{'name':_0x223ed9[_0x8a49('0x2f')],'type':_0x223ed9[_0x8a49('0x30')][_0x8a49('0x31')]};});_0x29de89[_0x8a49('0x32')]=_[_0x8a49('0x2d')](_0x33d7c6,_0x8a49('0x2a'));_0x29de89['query']=_['keys'](_0x387b06[_0x8a49('0x33')]);_0x29de89[_0x8a49('0x34')]=_[_0x8a49('0x35')](_0x29de89[_0x8a49('0x32')],_0x29de89['query']);_0x484a57[_0x8a49('0x36')]=_[_0x8a49('0x35')](_0x29de89['model'],qs[_0x8a49('0x37')](_0x387b06['query'][_0x8a49('0x37')]));_0x484a57[_0x8a49('0x36')]=_0x484a57[_0x8a49('0x36')][_0x8a49('0x38')]?_0x484a57['attributes']:_0x29de89[_0x8a49('0x32')];if(!_0x387b06[_0x8a49('0x33')][_0x8a49('0x39')]('nolimit')){_0x484a57[_0x8a49('0x1d')]=qs['limit'](_0x387b06['query'][_0x8a49('0x1d')]);_0x484a57[_0x8a49('0x1e')]=qs[_0x8a49('0x1e')](_0x387b06[_0x8a49('0x33')]['offset']);}_0x484a57['order']=qs[_0x8a49('0x3a')](_0x387b06[_0x8a49('0x33')][_0x8a49('0x3a')]);_0x484a57[_0x8a49('0x3b')]=qs['filters'](_[_0x8a49('0x3c')](_0x387b06[_0x8a49('0x33')],_0x29de89[_0x8a49('0x34')]),_0x33d7c6);if(_0x387b06['query']['filter']){_0x484a57[_0x8a49('0x3b')]=_[_0x8a49('0x3d')](_0x484a57[_0x8a49('0x3b')],{'$or':_['map'](_0x33d7c6,function(_0x158d8c){if(_0x158d8c[_0x8a49('0x30')]!==_0x8a49('0x3e')){var _0x7b71bb={};_0x7b71bb[_0x158d8c[_0x8a49('0x2a')]]={'$like':'%'+_0x387b06[_0x8a49('0x33')]['filter']+'%'};return _0x7b71bb;}})});}_0x484a57=_[_0x8a49('0x3d')]({},_0x484a57,_0x387b06[_0x8a49('0x3f')]);var _0x309482={'where':_0x484a57[_0x8a49('0x3b')]};return db[_0x8a49('0x2e')][_0x8a49('0x1f')](_0x309482)['then'](function(_0x2c9838){_0xef6542[_0x8a49('0x1f')]=_0x2c9838;if(_0x387b06[_0x8a49('0x33')][_0x8a49('0x40')]){_0x484a57[_0x8a49('0x41')]=[{'all':!![]}];}return db[_0x8a49('0x2e')][_0x8a49('0x42')](_0x484a57);})[_0x8a49('0x28')](function(_0x41b6c2){_0xef6542[_0x8a49('0x43')]=_0x41b6c2;return _0xef6542;})[_0x8a49('0x28')](respondWithFilteredResult(_0x30fffd,_0x484a57))['catch'](handleError(_0x30fffd,null));};exports[_0x8a49('0x44')]=function(_0x1b4b6d,_0x2938a8){var _0x4aac2b={'raw':!![],'where':{'id':_0x1b4b6d[_0x8a49('0x45')]['id']}},_0x411c9d={};_0x411c9d[_0x8a49('0x32')]=_[_0x8a49('0x46')](db[_0x8a49('0x2e')]['rawAttributes']);_0x411c9d[_0x8a49('0x33')]=_[_0x8a49('0x46')](_0x1b4b6d['query']);_0x411c9d[_0x8a49('0x34')]=_['intersection'](_0x411c9d['model'],_0x411c9d[_0x8a49('0x33')]);_0x4aac2b['attributes']=_[_0x8a49('0x35')](_0x411c9d[_0x8a49('0x32')],qs[_0x8a49('0x37')](_0x1b4b6d[_0x8a49('0x33')]['fields']));_0x4aac2b[_0x8a49('0x36')]=_0x4aac2b[_0x8a49('0x36')][_0x8a49('0x38')]?_0x4aac2b[_0x8a49('0x36')]:_0x411c9d[_0x8a49('0x32')];if(_0x1b4b6d[_0x8a49('0x33')][_0x8a49('0x40')]){_0x4aac2b['include']=[{'all':!![]}];}_0x4aac2b=_['merge']({},_0x4aac2b,_0x1b4b6d[_0x8a49('0x3f')]);return db[_0x8a49('0x2e')][_0x8a49('0x47')](_0x4aac2b)[_0x8a49('0x28')](handleEntityNotFound(_0x2938a8,null))[_0x8a49('0x28')](respondWithResult(_0x2938a8,null))[_0x8a49('0x48')](handleError(_0x2938a8,null));};exports[_0x8a49('0x49')]=function(_0x33ec7a,_0x5a428a){return db[_0x8a49('0x2e')][_0x8a49('0x49')](_0x33ec7a[_0x8a49('0x4a')],{})[_0x8a49('0x28')](respondWithResult(_0x5a428a,0xc9))[_0x8a49('0x48')](handleError(_0x5a428a,null));};exports[_0x8a49('0x26')]=function(_0x3d8fcc,_0xe3e213){if(_0x3d8fcc[_0x8a49('0x4a')]['id']){delete _0x3d8fcc[_0x8a49('0x4a')]['id'];}return db[_0x8a49('0x2e')]['find']({'where':{'id':_0x3d8fcc['params']['id']}})[_0x8a49('0x28')](handleEntityNotFound(_0xe3e213,null))[_0x8a49('0x28')](saveUpdates(_0x3d8fcc[_0x8a49('0x4a')],null))[_0x8a49('0x28')](respondWithResult(_0xe3e213,null))[_0x8a49('0x48')](handleError(_0xe3e213,null));};exports[_0x8a49('0x27')]=function(_0x3e066e,_0x4d9306){return db['WhatsappApplication']['find']({'where':{'id':_0x3e066e[_0x8a49('0x45')]['id']}})[_0x8a49('0x28')](handleEntityNotFound(_0x4d9306,null))[_0x8a49('0x28')](removeEntity(_0x4d9306,null))['catch'](handleError(_0x4d9306,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 666a129..ba671d2 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 _0x943c=['path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise'];(function(_0x33935c,_0x44ba2b){var _0x3ff39d=function(_0x3bfccc){while(--_0x3bfccc){_0x33935c['push'](_0x33935c['shift']());}};_0x3ff39d(++_0x44ba2b);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var logger=require(_0xc943('0x2'))(_0xc943('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc943('0x4'));var fs=require('fs');var path=require(_0xc943('0x5'));var rimraf=require(_0xc943('0x6'));var config=require('../../config/environment');var attributes=require(_0xc943('0x7'));module[_0xc943('0x8')]=function(_0x3307ef,_0xaff37f){return _0x3307ef[_0xc943('0x9')](_0xc943('0xa'),attributes,{'tableName':_0xc943('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc943('0xc')});}; \ No newline at end of file +var _0xfd7b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','utf8mb4','util','../../config/logger'];(function(_0x45f055,_0x5c59e4){var _0x5d90c7=function(_0x208944){while(--_0x208944){_0x45f055['push'](_0x45f055['shift']());}};_0x5d90c7(++_0x5c59e4);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xfd7b[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var logger=require(_0xbfd7('0x1'))(_0xbfd7('0x2'));var moment=require(_0xbfd7('0x3'));var BPromise=require(_0xbfd7('0x4'));var rp=require(_0xbfd7('0x5'));var fs=require('fs');var path=require(_0xbfd7('0x6'));var rimraf=require(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var attributes=require(_0xbfd7('0x9'));module[_0xbfd7('0xa')]=function(_0x2ad158,_0x639dd4){return _0x2ad158['define'](_0xbfd7('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbfd7('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index d9a169b..4349fb2 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 _0xbd50=['WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x307176,_0x75c5c2){_0x307176=_0x307176-0x0;var _0x2c35d5=_0xbd50[_0x307176];return _0x2c35d5;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','util'];(function(_0x809315,_0x497d48){var _0x1a00b1=function(_0x174df0){while(--_0x174df0){_0x809315['push'](_0x809315['shift']());}};_0x1a00b1(++_0x497d48);}(_0xedd9,0xfc));var _0x9edd=function(_0x2859bd,_0x2597ad){_0x2859bd=_0x2859bd-0x0;var _0xcc9b93=_0xedd9[_0x2859bd];return _0xcc9b93;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f140c5b..ea84aa7 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 _0x9206=['whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x30102a,_0x4d2496){var _0x4fac61=function(_0x36b8bd){while(--_0x36b8bd){_0x30102a['push'](_0x30102a['shift']());}};_0x4fac61(++_0x4d2496);}(_0x9206,0x176));var _0x6920=function(_0x430e7b,_0x3dd5b5){_0x430e7b=_0x430e7b-0x0;var _0xee5433=_0x9206[_0x430e7b];return _0xee5433;};'use strict';var multer=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var path=require(_0x6920('0x2'));var timeout=require(_0x6920('0x3'));var express=require(_0x6920('0x4'));var router=express[_0x6920('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6920('0x6'));var config=require(_0x6920('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0x6920('0x8')](),controller['index']);router[_0x6920('0x9')](_0x6920('0xa'),auth[_0x6920('0x8')](),controller[_0x6920('0xb')]);router['get']('/:id',auth[_0x6920('0x8')](),controller[_0x6920('0xc')]);router[_0x6920('0x9')](_0x6920('0xd'),auth[_0x6920('0x8')](),controller[_0x6920('0xe')]);router[_0x6920('0x9')](_0x6920('0xf'),auth[_0x6920('0x8')](),controller[_0x6920('0x10')]);router[_0x6920('0x11')]('/',auth[_0x6920('0x8')](),controller[_0x6920('0x12')]);router['post']('/:id/messages',auth[_0x6920('0x8')](),controller[_0x6920('0x13')]);router['post'](_0x6920('0x14'),auth[_0x6920('0x8')](),interaction[_0x6920('0x15')](_0x6920('0x16'),_0x6920('0x17')),controller['addTags']);router[_0x6920('0x18')](_0x6920('0x19'),auth[_0x6920('0x8')](),interaction[_0x6920('0x15')](_0x6920('0x16'),_0x6920('0x1a')),controller[_0x6920('0x1b')]);router[_0x6920('0x1c')](_0x6920('0x19'),auth[_0x6920('0x8')](),interaction[_0x6920('0x15')](_0x6920('0x16'),_0x6920('0x1d')),controller[_0x6920('0x1e')]);router[_0x6920('0x1c')]('/:id/tags',auth[_0x6920('0x8')](),controller[_0x6920('0x1f')]);module[_0x6920('0x20')]=router; \ No newline at end of file +var _0x39e6=['/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','removeTags','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x39e6,0x9e));var _0x639e=function(_0x1ce483,_0x2a5911){_0x1ce483=_0x1ce483-0x0;var _0x37db0d=_0x39e6[_0x1ce483];return _0x37db0d;};'use strict';var multer=require(_0x639e('0x0'));var util=require('util');var path=require(_0x639e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x639e('0x2')]();var fs_extra=require(_0x639e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x639e('0x4'));var config=require(_0x639e('0x5'));var controller=require(_0x639e('0x6'));router[_0x639e('0x7')]('/',auth[_0x639e('0x8')](),controller[_0x639e('0x9')]);router[_0x639e('0x7')](_0x639e('0xa'),auth[_0x639e('0x8')](),controller[_0x639e('0xb')]);router[_0x639e('0x7')](_0x639e('0xc'),auth[_0x639e('0x8')](),controller[_0x639e('0xd')]);router[_0x639e('0x7')](_0x639e('0xe'),auth[_0x639e('0x8')](),controller[_0x639e('0xf')]);router['get']('/:id/download',auth[_0x639e('0x8')](),controller[_0x639e('0x10')]);router[_0x639e('0x11')]('/',auth[_0x639e('0x8')](),controller[_0x639e('0x12')]);router[_0x639e('0x11')](_0x639e('0xe'),auth['isAuthenticated'](),controller['addMessage']);router[_0x639e('0x11')](_0x639e('0x13'),auth[_0x639e('0x8')](),interaction[_0x639e('0x14')](_0x639e('0x15'),_0x639e('0x16')),controller['addTags']);router[_0x639e('0x17')](_0x639e('0xc'),auth[_0x639e('0x8')](),interaction[_0x639e('0x14')]('whatsapp',_0x639e('0x18')),controller['update']);router[_0x639e('0x19')](_0x639e('0xc'),auth[_0x639e('0x8')](),interaction[_0x639e('0x14')](_0x639e('0x15'),_0x639e('0x1a')),controller['destroy']);router[_0x639e('0x19')](_0x639e('0x13'),auth[_0x639e('0x8')](),controller[_0x639e('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 1d7df4b..a844dd8 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 _0x1354=['STRING','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x2a6553,_0xd5e9e5){var _0x2253b1=function(_0x50ff8a){while(--_0x50ff8a){_0x2a6553['push'](_0x2a6553['shift']());}};_0x2253b1(++_0xd5e9e5);}(_0x1354,0x95));var _0x4135=function(_0x5d949e,_0x555707){_0x5d949e=_0x5d949e-0x0;var _0x445c1e=_0x1354[_0x5d949e];return _0x445c1e;};'use strict';var Sequelize=require(_0x4135('0x0'));var moment=require(_0x4135('0x1'));module[_0x4135('0x2')]={'closed':{'type':Sequelize[_0x4135('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4135('0x4')]},'disposition':{'type':Sequelize[_0x4135('0x5')]},'secondDisposition':{'type':Sequelize[_0x4135('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4135('0x5')]},'phone':{'type':Sequelize[_0x4135('0x5')]},'read1stAt':{'type':Sequelize[_0x4135('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4135('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4135('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4135('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4135('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb3d8=['STRING','ENUM','out','moment','exports','BOOLEAN','DATE'];(function(_0xddfe18,_0x4c3969){var _0x4ec006=function(_0x97a183){while(--_0x97a183){_0xddfe18['push'](_0xddfe18['shift']());}};_0x4ec006(++_0x4c3969);}(_0xb3d8,0xdc));var _0x8b3d=function(_0x4688c1,_0x465b08){_0x4688c1=_0x4688c1-0x0;var _0x2e0b77=_0xb3d8[_0x4688c1];return _0x2e0b77;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8b3d('0x0'));module[_0x8b3d('0x1')]={'closed':{'type':Sequelize[_0x8b3d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8b3d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8b3d('0x4')]},'note':{'type':Sequelize[_0x8b3d('0x4')]},'phone':{'type':Sequelize[_0x8b3d('0x4')]},'read1stAt':{'type':Sequelize[_0x8b3d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8b3d('0x5')]('in',_0x8b3d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8b3d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8b3d('0x5')]('in',_0x8b3d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 05d9ade..72bc15d 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 _0x9099=['reject','save','update','then','destroy','end','error','stack','name','send','map','fullname','TagIds','split','Tags','push','catch','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','select','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','search','sqlOperator','conditions','length','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','body','some','compact','isEmpty','forEach','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','merge','create','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','format','CmContact','firstName','lastName','Attachment','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','closed','Messages','existsSync','createReadStream','createWriteStream','basename','System','out','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x417b6d,_0x4520d0){var _0x35ecc8=function(_0x3c574b){while(--_0x3c574b){_0x417b6d['push'](_0x417b6d['shift']());}};_0x35ecc8(++_0x4520d0);}(_0x9099,0x1ac));var _0x9909=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0x9099[_0x285c85];return _0x2f81cd;};'use strict';var emlformat=require(_0x9909('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9909('0x1'));var jsonpatch=require(_0x9909('0x2'));var rp=require(_0x9909('0x3'));var moment=require(_0x9909('0x4'));var BPromise=require(_0x9909('0x5'));var Mustache=require(_0x9909('0x6'));var util=require(_0x9909('0x7'));var path=require(_0x9909('0x8'));var sox=require(_0x9909('0x9'));var csv=require(_0x9909('0xa'));var ejs=require(_0x9909('0xb'));var fs=require('fs');var fs_extra=require(_0x9909('0xc'));var _=require(_0x9909('0xd'));var squel=require(_0x9909('0xe'));var crypto=require('crypto');var jsforce=require(_0x9909('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9909('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9909('0x11'));var as=require(_0x9909('0x12'));var pdf=require(_0x9909('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9909('0x14'))('api');var utils=require(_0x9909('0x15'));var config=require(_0x9909('0x16'));var licenseUtil=require(_0x9909('0x17'));var db=require(_0x9909('0x18'))['db'];config[_0x9909('0x19')]=_[_0x9909('0x1a')](config[_0x9909('0x19')],{'host':_0x9909('0x1b'),'port':0x18eb});var socket=require(_0x9909('0x1c'))(new Redis(config[_0x9909('0x19')]));require(_0x9909('0x1d'))[_0x9909('0x1e')](socket);function respondWithStatusCode(_0x4618eb,_0x5699d8){_0x5699d8=_0x5699d8||0xcc;return function(_0x33a8e3){if(_0x33a8e3){return _0x4618eb['sendStatus'](_0x5699d8);}return _0x4618eb[_0x9909('0x1f')](_0x5699d8)['end']();};}function respondWithResult(_0x1a9c97,_0x1b56c7){_0x1b56c7=_0x1b56c7||0xc8;return function(_0x245f0d){if(_0x245f0d){return _0x1a9c97['status'](_0x1b56c7)[_0x9909('0x20')](_0x245f0d);}};}function respondWithFilteredResult(_0xb003b6,_0x180929){return function(_0x2e6c16){if(_0x2e6c16){var _0x1106e5=typeof _0x180929[_0x9909('0x21')]===_0x9909('0x22')&&typeof _0x180929['limit']===_0x9909('0x22');var _0x1ec2d6=_0x2e6c16['count'];var _0x131c0e=_0x1106e5?0x0:_0x180929[_0x9909('0x21')];var _0x20c236=_0x1106e5?_0x2e6c16[_0x9909('0x23')]:_0x180929[_0x9909('0x21')]+_0x180929[_0x9909('0x24')];var _0x262d69;if(_0x20c236>=_0x1ec2d6){_0x20c236=_0x1ec2d6;_0x262d69=0xc8;}else{_0x262d69=0xce;}_0xb003b6['status'](_0x262d69);return _0xb003b6[_0x9909('0x25')](_0x9909('0x26'),_0x131c0e+'-'+_0x20c236+'/'+_0x1ec2d6)['json'](_0x2e6c16);}return null;};}function patchUpdates(_0x4e3651){return function(_0x3a59dc){try{jsonpatch[_0x9909('0x27')](_0x3a59dc,_0x4e3651,!![]);}catch(_0xdd5088){return BPromise[_0x9909('0x28')](_0xdd5088);}return _0x3a59dc[_0x9909('0x29')]();};}function saveUpdates(_0x59c5c9,_0x5f3a5a){return function(_0x2d83a5){if(_0x2d83a5){return _0x2d83a5[_0x9909('0x2a')](_0x59c5c9)[_0x9909('0x2b')](function(_0x1c7ee5){return _0x1c7ee5;});}return null;};}function removeEntity(_0x52be17,_0x20a8ec){return function(_0x2886e2){if(_0x2886e2){return _0x2886e2[_0x9909('0x2c')]()[_0x9909('0x2b')](function(){_0x52be17['status'](0xcc)[_0x9909('0x2d')]();});}};}function handleEntityNotFound(_0x22ff12,_0x19c7e8){return function(_0x14ec4b){if(!_0x14ec4b){_0x22ff12['sendStatus'](0x194);}return _0x14ec4b;};}function handleError(_0xb0b66f,_0x175d52){_0x175d52=_0x175d52||0x1f4;return function(_0x277bec){logger[_0x9909('0x2e')](_0x277bec[_0x9909('0x2f')]);if(_0x277bec[_0x9909('0x30')]){delete _0x277bec[_0x9909('0x30')];}_0xb0b66f['status'](_0x175d52)[_0x9909('0x31')](_0x277bec);};}function getInteractionUsers(_0x3a3f4f,_0x87ac8a){return new BPromise(function(_0x42f1e5,_0x3e4e07){try{if(_0x87ac8a[_0x3a3f4f['id']]){_0x3a3f4f['Users']=_[_0x9909('0x32')](_0x87ac8a[_0x3a3f4f['id']],function(_0x28430b){return{'id':_0x28430b['id'],'fullname':_0x28430b[_0x9909('0x33')]};});}}catch(_0x3e599a){_0x3e4e07(_0x3e599a);}_0x42f1e5(_0x3a3f4f);});}function getInteractionTags(_0xc1bd06,_0x222dd1){return new BPromise(function(_0x3ce25e,_0x342049){try{if(_0xc1bd06['TagIds']){_0xc1bd06['Tags']=[];_0xc1bd06[_0x9909('0x34')][_0x9909('0x35')](',')['forEach'](function(_0x3f218f){_0xc1bd06[_0x9909('0x36')][_0x9909('0x37')](_0x222dd1[_0x3f218f]);});}delete _0xc1bd06[_0x9909('0x34')];}catch(_0x46affb){_0x342049(_0x46affb);}_0x3ce25e(_0xc1bd06);});}function updateWhatsappInteraction(_0x18ecd7,_0x627715,_0x51ed4e){return new BPromise(function(_0x17a7bd,_0x2686f3){return getInteractionUsers(_0x18ecd7,_0x51ed4e)[_0x9909('0x2b')](function(_0x2ed1b7){return getInteractionTags(_0x2ed1b7,_0x627715);})[_0x9909('0x2b')](function(_0x51d546){_0x17a7bd(_0x51d546);})[_0x9909('0x38')](function(_0x362851){_0x2686f3(_0x362851);});});}exports['index']=function(_0xba6bd7,_0x3df562){var _0x26121f={},_0x23035a={},_0x1e2fcc={'count':0x0,'rows':[]};var _0x12f896=_['map'](db[_0x9909('0x39')][_0x9909('0x3a')],function(_0x452b73){return{'name':_0x452b73[_0x9909('0x3b')],'type':_0x452b73[_0x9909('0x3c')][_0x9909('0x3d')]};});_0x23035a[_0x9909('0x3e')]=_[_0x9909('0x32')](_0x12f896,_0x9909('0x30'));_0x23035a[_0x9909('0x3f')]=_[_0x9909('0x40')](_0xba6bd7[_0x9909('0x3f')]);_0x23035a[_0x9909('0x41')]=_[_0x9909('0x42')](_0x23035a[_0x9909('0x3e')],_0x23035a[_0x9909('0x3f')]);_0x26121f[_0x9909('0x43')]=_[_0x9909('0x42')](_0x23035a[_0x9909('0x3e')],qs[_0x9909('0x44')](_0xba6bd7[_0x9909('0x3f')][_0x9909('0x44')]));_0x26121f[_0x9909('0x43')]=_0x26121f['attributes']['length']?_0x26121f[_0x9909('0x43')]:_0x23035a['model'];if(!_0xba6bd7['query'][_0x9909('0x45')](_0x9909('0x46'))){_0x26121f[_0x9909('0x24')]=qs[_0x9909('0x24')](_0xba6bd7['query'][_0x9909('0x24')]);_0x26121f[_0x9909('0x21')]=qs[_0x9909('0x21')](_0xba6bd7['query'][_0x9909('0x21')]);}_0x26121f[_0x9909('0x47')]=qs[_0x9909('0x48')](_0xba6bd7['query'][_0x9909('0x48')]);_0x26121f[_0x9909('0x49')]=qs[_0x9909('0x41')](_[_0x9909('0x4a')](_0xba6bd7[_0x9909('0x3f')],_0x23035a[_0x9909('0x41')]),_0x12f896);var _0xef5aa6=[];var _0x3b1844=squel['select']()[_0x9909('0x4b')]('id')[_0x9909('0x4b')]('name')[_0x9909('0x4b')](_0x9909('0x4c'))['from']('tools_tags');var _0x339a40=squel[_0x9909('0x4d')]()[_0x9909('0x4b')](_0x9909('0x4e'))[_0x9909('0x4b')](_0x9909('0x4f'))[_0x9909('0x4b')](_0x9909('0x50'))[_0x9909('0x51')](_0x9909('0x52'),'ui')['left_join'](_0x9909('0x53'),'u',_0x9909('0x54'));var _0x4234fd=squel[_0x9909('0x4d')]()['from']('whatsapp_interactions','i')[_0x9909('0x55')]('cm_contacts','c',_0x9909('0x56'))[_0x9909('0x55')](_0x9909('0x53'),'o','o.id\x20=\x20i.UserId')[_0x9909('0x55')](_0x9909('0x57'),'a',_0x9909('0x58'))['left_join'](_0x9909('0x59'),'me',_0x9909('0x5a'))[_0x9909('0x55')](_0x9909('0x5b'),'it',_0x9909('0x5c'))[_0x9909('0x55')](_0x9909('0x5d'),'t','t.id\x20=\x20it.TagId');var _0x3bae79=squel[_0x9909('0x5e')]();var _0x515a20=[];var _0x1a7818=squel[_0x9909('0x5e')]();var _0x3d105f;if(_0xba6bd7[_0x9909('0x3f')][_0x9909('0x5f')]){_0x3d105f=as['parseSearch'](_0xba6bd7[_0x9909('0x3f')]['search']);var _0xda6344=_0x3d105f[_0x9909('0x60')];for(var _0x3ced89=0x0;_0x3ced89<_0x3d105f[_0x9909('0x61')][_0x9909('0x62')];_0x3ced89++){var _0x3bab23=_0x3d105f[_0x9909('0x61')][_0x3ced89];var _0x109625='i';var _0x5eca81=_['find'](_0x12f896,[_0x9909('0x30'),_0x3bab23['field']]);if(!_0x5eca81){switch(_0x3bab23['field']){case _0x9909('0x63'):if(_0x3bab23[_0x9909('0x64')]==0x1){_0x4234fd['having']('`'+_0x3bab23[_0x9909('0x4b')]+_0x9909('0x65'));}else{_0x4234fd[_0x9909('0x66')]('`'+_0x3bab23[_0x9909('0x4b')]+_0x9909('0x67'));}break;case _0x9909('0x68'):if(_0x3bab23['operator']===_0x9909('0x69')){if(_0x3bab23[_0x9909('0x64')]['split']('\x20')['length']>0x1){_0x3bae79[_0xda6344](_0x9909('0x6a'),qs['getFullTextValue'](_0x3bab23[_0x9909('0x64')]),null);}else{var _0xcec05f='%'+_0x3bab23[_0x9909('0x64')]+'%';_0x3bae79[_0xda6344](_0x9909('0x6b'),_0xcec05f,_0xcec05f,_0xcec05f);}}else{_0x5eca81=_['find'](_0x12f896,['name','ContactId']);_0x3bab23[_0x9909('0x4b')]=_0x9909('0x6c');_0x2fa6d4=as['buildExpression'](_0x109625,_0x5eca81['type'],_0x3bab23);_0x3bae79[_0xda6344](_0x2fa6d4[_0x9909('0x6d')],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x6e')],_0x2fa6d4['value'][_0x9909('0x2d')]);}break;case _0x9909('0x6f'):var _0x4826b7=_0x3bab23[_0x9909('0x64')][_0x9909('0x35')](',')[_0x9909('0x32')](function(_0x3055fb){return Number(_0x3055fb);});_0x4826b7['forEach'](function(_0x5210bb){_0x1a7818['or'](_0x9909('0x70'),'%,'+_0x5210bb+',%');});_0x515a20=_[_0x9909('0x71')](_0x515a20,_0x4826b7);break;case _0x9909('0x72'):if(_0x3bab23[_0x9909('0x73')]===_0x9909('0x69')){_0x3bae79[_0xda6344](_0x9909('0x74'),'%'+_0x3bab23[_0x9909('0x64')]+'%',null);}else{_0x5eca81=_[_0x9909('0x75')](_0x12f896,[_0x9909('0x30'),_0x9909('0x76')]);_0x3bab23['field']=_0x9909('0x76');_0x2fa6d4=as[_0x9909('0x77')](_0x109625,_0x5eca81[_0x9909('0x3c')],_0x3bab23);_0x3bae79[_0xda6344](_0x2fa6d4[_0x9909('0x6d')],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x6e')],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x2d')]);}break;case _0x9909('0x78'):_0x2fa6d4=as[_0x9909('0x77')]('me',null,_0x3bab23);_0x3bae79[_0xda6344](_0x2fa6d4['text'],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x6e')],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x2d')]);break;}}else{var _0x2fa6d4=as['buildExpression'](_0x109625,_0x5eca81[_0x9909('0x3c')],_0x3bab23);_0x3bae79[_0xda6344](_0x2fa6d4['text'],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x6e')],_0x2fa6d4[_0x9909('0x64')][_0x9909('0x2d')]);}}}else{var _0x54d71c=_(_0xba6bd7[_0x9909('0x3f')])[_0x9909('0x40')]()['map'](function(_0x441efb){return _[_0x9909('0x79')](_0x12f896,[_0x9909('0x30'),_0x441efb])?_0x441efb:undefined;})[_0x9909('0x7a')]()[_0x9909('0x64')]();if(!_[_0x9909('0x7b')](_0x54d71c)){_0x54d71c[_0x9909('0x7c')](function(_0x2ed52e){if(_0x2ed52e===_0x9909('0x7d')){_0x4234fd['where'](_0x9909('0x7e'),[]['concat'](_0xba6bd7[_0x9909('0x3f')][_0x2ed52e]));}else if(_0x2ed52e===_0x9909('0x7f')){var _0x5a15eb=JSON[_0x9909('0x80')](_0xba6bd7[_0x9909('0x3f')][_0x2ed52e])[_0x9909('0x81')];var _0x213a4b=JSON[_0x9909('0x80')](_0xba6bd7['query'][_0x2ed52e])['$lte'];_0x4234fd[_0x9909('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5a15eb,_0x213a4b);}else{if(_0xba6bd7[_0x9909('0x3f')][_0x2ed52e]===_0x9909('0x82')){_0x4234fd['where']('i.'+_0x2ed52e+_0x9909('0x83'));}else{_0x4234fd[_0x9909('0x49')]('i.'+_0x2ed52e+'\x20=\x20?',_0xba6bd7[_0x9909('0x3f')][_0x2ed52e]);}}});}if(_0xba6bd7['query']['read']){if(_0xba6bd7[_0x9909('0x3f')][_0x9909('0x84')]==0x1){_0x4234fd[_0x9909('0x66')]('`unreadMessages`\x20=\x200');}else{_0x4234fd[_0x9909('0x66')](_0x9909('0x85'));}}if(_0xba6bd7[_0x9909('0x3f')][_0x9909('0x86')]){_0x515a20=_[_0x9909('0x87')](_0xba6bd7[_0x9909('0x3f')][_0x9909('0x86')])?_0xba6bd7['query']['tag']:new Array(_0xba6bd7['query'][_0x9909('0x86')]);_0x515a20[_0x9909('0x7c')](function(_0x3764b9){_0x1a7818['or'](_0x9909('0x70'),'%,'+_0x3764b9+',%');});}if(_0xba6bd7[_0x9909('0x3f')][_0x9909('0x88')]){var _0x38cc08=_0xba6bd7[_0x9909('0x3f')][_0x9909('0x88')][_0x9909('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x9909('0x8a')](_0x38cc08)){_0x3bae79['or'](_0x9909('0x8b'),_0x38cc08+'%')['or'](_0x9909('0x8c'),_0x38cc08+'%');}else{_0x3bae79['or'](_0x9909('0x8d'),qs['getFullTextValue'](_0x38cc08))['or'](_0x9909('0x8e'),_0x38cc08+'%');}}}_0x4234fd[_0x9909('0x49')](_0x3bae79);_0x4234fd['group'](_0x9909('0x8f'));var _0x86b352={'type':db['Sequelize'][_0x9909('0x90')][_0x9909('0x91')],'raw':!![]};var _0x509f45=_0x4234fd[_0x9909('0x92')]();_0x509f45[_0x9909('0x4b')](_0x9909('0x8f'));_0x509f45[_0x9909('0x4b')](_0x9909('0x93'),_0x9909('0x63'));if(_0x26121f['order']){_0x26121f['order'][_0x9909('0x7c')](function(_0x2c07c2){var _0x1b36b8=_0x2c07c2[0x0]===_0x9909('0x94')?_0x2c07c2[0x0]:'i.'+_0x2c07c2[0x0];_0x4234fd[_0x9909('0x47')](_0x1b36b8,_0x2c07c2[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9909('0x7b')](_0x515a20)){_0x4234fd[_0x9909('0x66')](_0x1a7818);_0x509f45[_0x9909('0x49')]('t.id\x20IN\x20?',_0x515a20);}BPromise[_0x9909('0x95')]()['then'](function(){if(!_0x3d105f){if(_0xba6bd7[_0x9909('0x3f')][_0x9909('0x7d')])return;_0x509f45[_0x9909('0x49')](_0x9909('0x96'));_0x4234fd[_0x9909('0x49')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0xba6bd7[_0x9909('0x97')]['role']!==_0x9909('0x98'))return;return _0xba6bd7['user'][_0x9909('0x99')]({'attributes':['id'],'raw':!![]})[_0x9909('0x2b')](function(_0x592553){if(_[_0x9909('0x7b')](_0x592553)){_0x509f45[_0x9909('0x49')](_0x9909('0x9a'));_0x4234fd[_0x9909('0x49')](_0x9909('0x9a'));}else{_0x509f45[_0x9909('0x49')](_0x9909('0x7e'),_[_0x9909('0x32')](_0x592553,'id'));_0x4234fd['where']('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x592553,'id'));}});})[_0x9909('0x2b')](function(){if(_0xba6bd7[_0x9909('0x97')][_0x9909('0x9b')]===_0x9909('0x98')&&!_0x3d105f&&!_0xba6bd7[_0x9909('0x3f')][_0x9909('0x7d')])return[];return db[_0x9909('0x9c')]['query'](_0x509f45[_0x9909('0x9d')](),_0x86b352);})['then'](function(_0x20692c){_0x1e2fcc[_0x9909('0x23')]=_0x20692c[_0x9909('0x62')];if(_0x1e2fcc[_0x9909('0x23')]===0x0)return[];return db['sequelize'][_0x9909('0x3f')](_0x3b1844['toString'](),_0x86b352)['then'](function(_0x26520d){_0xef5aa6=_['keyBy'](_0x26520d,'id');_0x86b352=_['merge'](_0x86b352,{'model':db[_0x9909('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xba6bd7[_0x9909('0x3f')][_0x9909('0x44')]){_0x26121f[_0x9909('0x43')][_0x9909('0x7c')](function(_0x143a48){_0x4234fd[_0x9909('0x4b')]('i.'+_0x143a48);});}else{_0x4234fd[_0x9909('0x4b')](_0x9909('0x93'),_0x9909('0x63'));_0x4234fd[_0x9909('0x4b')]('a.key','Account.key');_0x4234fd[_0x9909('0x4b')](_0x9909('0x9e'),_0x9909('0x9f'));_0x4234fd[_0x9909('0x4b')](_0x9909('0xa0'),_0x9909('0x94'));_0x4234fd['field']('i.*');_0x4234fd[_0x9909('0x4b')](_0x9909('0xa1'),'Contact.firstName');_0x4234fd['field'](_0x9909('0xa2'),'Contact.lastName');_0x4234fd['field'](_0x9909('0xa3'),_0x9909('0xa4'));_0x4234fd[_0x9909('0x4b')](_0x9909('0xa5'),'Contact.phone');_0x4234fd['field'](_0x9909('0xa6'),_0x9909('0xa7'));_0x4234fd['field'](_0x9909('0xa8'),_0x9909('0xa9'));_0x4234fd[_0x9909('0x4b')](_0x9909('0xaa'),_0x9909('0xab'));_0x4234fd[_0x9909('0x4b')](_0x9909('0xac'),_0x9909('0xad'));_0x4234fd[_0x9909('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x9909('0x34'));}if(_0x26121f[_0x9909('0x24')])_0x4234fd[_0x9909('0x24')](_0x26121f[_0x9909('0x24')]);if(_0x26121f[_0x9909('0x21')])_0x4234fd[_0x9909('0x21')](_0x26121f[_0x9909('0x21')]);return db[_0x9909('0x9c')][_0x9909('0x3f')](_0x4234fd[_0x9909('0x9d')](),_0x86b352);})['then'](function(_0x287490){if(_0x287490[_0x9909('0x62')]>0x0)_0x339a40[_0x9909('0x49')](_0x9909('0xae'),_[_0x9909('0x32')](_0x287490,'id'));return db[_0x9909('0x9c')]['query'](_0x339a40['toString'](),_0x86b352)['then'](function(_0x45b5b8){var _0x422ae1=_[_0x9909('0xaf')](_0x45b5b8,'WhatsappInteractionId');var _0x254a9d=[];_0x287490['forEach'](function(_0x3a4663){_0x254a9d[_0x9909('0x37')](updateWhatsappInteraction(_0x3a4663,_0xef5aa6,_0x422ae1));});return BPromise[_0x9909('0xb0')](_0x254a9d);});});})[_0x9909('0x2b')](function(_0x33cdfd){_0x1e2fcc[_0x9909('0xb1')]=_0x33cdfd;return _0x1e2fcc;})[_0x9909('0x2b')](respondWithFilteredResult(_0x3df562,_0x26121f))[_0x9909('0x38')](handleError(_0x3df562,null));};exports[_0x9909('0xb2')]=function(_0x4dc982,_0x5c74a8){var _0x3c822a={'raw':![],'where':{'id':_0x4dc982[_0x9909('0xb3')]['id']}},_0x4ef9ef={};_0x4ef9ef[_0x9909('0x3e')]=_[_0x9909('0x40')](db['WhatsappInteraction'][_0x9909('0x3a')]);_0x4ef9ef[_0x9909('0x3f')]=_[_0x9909('0x40')](_0x4dc982[_0x9909('0x3f')]);_0x4ef9ef[_0x9909('0x41')]=_['intersection'](_0x4ef9ef['model'],_0x4ef9ef[_0x9909('0x3f')]);_0x3c822a['attributes']=_[_0x9909('0x42')](_0x4ef9ef[_0x9909('0x3e')],qs['fields'](_0x4dc982['query'][_0x9909('0x44')]));_0x3c822a['attributes']=_0x3c822a['attributes'][_0x9909('0x62')]?_0x3c822a[_0x9909('0x43')]:_0x4ef9ef[_0x9909('0x3e')];if(_0x4dc982[_0x9909('0x3f')][_0x9909('0xb4')]){_0x3c822a[_0x9909('0xb5')]=[{'all':!![]}];}_0x3c822a=_[_0x9909('0xb6')]({},_0x3c822a,_0x4dc982['options']);return db['WhatsappInteraction'][_0x9909('0x75')](_0x3c822a)[_0x9909('0x2b')](handleEntityNotFound(_0x5c74a8,null))[_0x9909('0x2b')](respondWithResult(_0x5c74a8,null))[_0x9909('0x38')](handleError(_0x5c74a8,null));};exports[_0x9909('0xb7')]=function(_0x54a088,_0x22d6de){return db['WhatsappInteraction'][_0x9909('0xb7')](_0x54a088[_0x9909('0x78')],{})[_0x9909('0x2b')](respondWithResult(_0x22d6de,0xc9))[_0x9909('0x38')](handleError(_0x22d6de,null));};exports['update']=function(_0x2a06ed,_0x500e3b){if(_0x2a06ed[_0x9909('0x78')]['id']){delete _0x2a06ed[_0x9909('0x78')]['id'];}return db[_0x9909('0x39')][_0x9909('0x75')]({'where':{'id':_0x2a06ed[_0x9909('0xb3')]['id']}})[_0x9909('0x2b')](handleEntityNotFound(_0x500e3b,null))['then'](saveUpdates(_0x2a06ed['body'],null))[_0x9909('0x2b')](respondWithResult(_0x500e3b,null))[_0x9909('0x38')](handleError(_0x500e3b,null));};exports[_0x9909('0x2c')]=function(_0x335271,_0x889f15){return db[_0x9909('0x39')][_0x9909('0x75')]({'where':{'id':_0x335271[_0x9909('0xb3')]['id']}})['then'](handleEntityNotFound(_0x889f15,null))[_0x9909('0x2b')](removeEntity(_0x889f15,null))['catch'](handleError(_0x889f15,null));};exports[_0x9909('0xb8')]=function(_0x4f13ab,_0x379bd3){return db[_0x9909('0x39')]['describe']()['then'](respondWithResult(_0x379bd3,null))['catch'](handleError(_0x379bd3,null));};exports['addMessage']=function(_0x1ba368,_0x2db4be,_0x117c43){return db['WhatsappMessage']['find']({'where':{'id':_0x1ba368['params']['id']}})['then'](handleEntityNotFound(_0x2db4be,null))[_0x9909('0x2b')](function(_0x578700){if(_0x578700){return _0x578700[_0x9909('0xb9')](_0x1ba368[_0x9909('0x78')][_0x9909('0xba')],_[_0x9909('0xbb')](_0x1ba368[_0x9909('0x78')],[_0x9909('0xba'),'id'])||{});}})[_0x9909('0x2b')](respondWithResult(_0x2db4be,null))[_0x9909('0x38')](handleError(_0x2db4be,null));};exports[_0x9909('0xbc')]=function(_0x251274,_0x25bb8f,_0x50d944){var _0x1de908={'raw':![],'where':{}};var _0x207cae={};var _0x21c7ed={'count':0x0,'rows':[]};return db[_0x9909('0x39')][_0x9909('0xbd')]({'where':{'id':_0x251274[_0x9909('0xb3')]['id']}})[_0x9909('0x2b')](handleEntityNotFound(_0x25bb8f,null))[_0x9909('0x2b')](function(_0x2c6625){if(_0x2c6625){_0x207cae['model']=_[_0x9909('0x40')](db[_0x9909('0xbe')][_0x9909('0x3a')]);_0x207cae[_0x9909('0x3f')]=_[_0x9909('0x40')](_0x251274['query']);_0x207cae[_0x9909('0x41')]=_[_0x9909('0x42')](_0x207cae[_0x9909('0x3e')],_0x207cae['query']);_0x1de908[_0x9909('0x43')]=_['intersection'](_0x207cae[_0x9909('0x3e')],qs['fields'](_0x251274['query'][_0x9909('0x44')]));_0x1de908[_0x9909('0x43')]=_0x1de908['attributes'][_0x9909('0x62')]?_0x1de908['attributes']:_0x207cae[_0x9909('0x3e')];if(!_0x251274[_0x9909('0x3f')][_0x9909('0x45')](_0x9909('0x46'))){_0x1de908[_0x9909('0x24')]=qs[_0x9909('0x24')](_0x251274[_0x9909('0x3f')][_0x9909('0x24')]);_0x1de908[_0x9909('0x21')]=qs[_0x9909('0x21')](_0x251274[_0x9909('0x3f')][_0x9909('0x21')]);}_0x1de908[_0x9909('0x47')]=qs['sort'](_0x251274[_0x9909('0x3f')][_0x9909('0x48')]);_0x1de908[_0x9909('0x49')]=qs[_0x9909('0x41')](_[_0x9909('0x4a')](_0x251274[_0x9909('0x3f')],_0x207cae[_0x9909('0x41')]));_0x1de908[_0x9909('0x49')]['WhatsappInteractionId']=_0x2c6625['id'];if(_0x251274[_0x9909('0x3f')][_0x9909('0x88')]){_0x1de908[_0x9909('0x49')]=_[_0x9909('0xb6')](_0x1de908[_0x9909('0x49')],{'$or':_[_0x9909('0x32')](_0x1de908[_0x9909('0x43')],function(_0x4fd410){var _0xdcba2c={};_0xdcba2c[_0x4fd410]={'$like':'%'+_0x251274[_0x9909('0x3f')]['filter']+'%'};return _0xdcba2c;})});}if(_0x251274[_0x9909('0x3f')]['$gte']){var _0x15728d=_0x251274[_0x9909('0x3f')][_0x9909('0x81')][_0x9909('0x35')](',');var _0x32a09d={};_0x32a09d[_0x15728d[0x0]]={'$gte':moment(_0x15728d[0x1])['format'](_0x9909('0xbf'))};_0x1de908[_0x9909('0x49')]=_[_0x9909('0xb6')](_0x1de908[_0x9909('0x49')],_0x32a09d);}_0x1de908=_[_0x9909('0xb6')]({},_0x1de908,_0x251274[_0x9909('0xc0')]);return db[_0x9909('0xbe')][_0x9909('0x23')]({'where':_0x1de908[_0x9909('0x49')]})[_0x9909('0x2b')](function(_0x36fcf8){_0x21c7ed[_0x9909('0x23')]=_0x36fcf8;if(_0x251274[_0x9909('0x3f')]['includeAll']){_0x1de908[_0x9909('0xb5')]=[{'all':!![]}];}return db[_0x9909('0xbe')][_0x9909('0xc1')](_0x1de908);})[_0x9909('0x2b')](function(_0x404c56){_0x21c7ed['rows']=_0x404c56;return _0x21c7ed;});}})[_0x9909('0x2b')](respondWithFilteredResult(_0x25bb8f,_0x1de908))[_0x9909('0x38')](handleError(_0x25bb8f,null));};exports[_0x9909('0xc2')]=function(_0x27bd6c,_0x20e40a,_0x143436){return db['WhatsappInteraction'][_0x9909('0x75')]({'where':{'id':_0x27bd6c[_0x9909('0xb3')]['id']}})[_0x9909('0x2b')](handleEntityNotFound(_0x20e40a,null))[_0x9909('0x2b')](function(_0x468395){if(_0x468395){return _0x468395[_0x9909('0xc3')](_0x27bd6c['body']['ids'],_['omit'](_0x27bd6c[_0x9909('0x78')],[_0x9909('0xba'),'id'])||{})['spread'](function(){return db['Tag'][_0x9909('0xc1')]({'attributes':['id','name','color'],'where':{'id':_0x27bd6c[_0x9909('0x78')][_0x9909('0xba')]}});})['then'](function(_0x27c595){socket[_0x9909('0xc4')]('whatsappInteractionTags:save',{'id':Number(_0x27bd6c[_0x9909('0xb3')]['id']),'tags':_0x27c595||[]});return{'id':Number(_0x27bd6c[_0x9909('0xb3')]['id']),'tags':_0x27c595||[]};});}})['then'](respondWithResult(_0x20e40a,null))[_0x9909('0x38')](handleError(_0x20e40a,null));};exports[_0x9909('0xc5')]=function(_0x55ebd6,_0x4cf2ee,_0xd5b857){return db[_0x9909('0x39')][_0x9909('0x75')]({'where':{'id':_0x55ebd6[_0x9909('0xb3')]['id']}})[_0x9909('0x2b')](handleEntityNotFound(_0x4cf2ee,null))[_0x9909('0x2b')](function(_0x3ff0ca){if(_0x3ff0ca){return _0x3ff0ca[_0x9909('0xc5')](_0x55ebd6[_0x9909('0x3f')]['ids']);}})[_0x9909('0x2b')](respondWithStatusCode(_0x4cf2ee,null))[_0x9909('0x38')](handleError(_0x4cf2ee,null));};exports[_0x9909('0xc6')]=function(_0x3e2137,_0x1246f3){var _0x1ee511=moment()[_0x9909('0xc7')]()[_0x9909('0x9d')]();var _0x315a3c=path[_0x9909('0xc8')](config[_0x9909('0xc9')],_0x9909('0xca'),_0x9909('0xcb'),_0x9909('0xcc'));var _0x18506f=path['join'](config['root'],'server',_0x9909('0xcb'),_0x9909('0xcd'));var _0x57eda2=path[_0x9909('0xc8')](_0x315a3c,_0x1ee511);var _0x433f2e=util[_0x9909('0xce')]('transcript-%d-%s.zip',_0x3e2137[_0x9909('0xb3')]['id'],_0x1ee511);var _0x3cf227=path['join'](_0x315a3c,_0x433f2e);var _0x18d4e0=[];_0x18d4e0[_0x9909('0x37')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x18d4e0[_0x9909('0x37')]({'model':db[_0x9909('0xcf')],'as':'Contact','attributes':['id',_0x9909('0xd0'),_0x9909('0xd1')],'raw':!![]});if(_0x3e2137[_0x9909('0x3f')][_0x9909('0xcd')]){_0x18d4e0[_0x9909('0x37')]({'model':db[_0x9909('0xd2')],'as':_0x9909('0xd2'),'raw':!![]});}var _0xe69745=[{'model':db[_0x9909('0xbe')],'as':'Messages','attributes':['id',_0x9909('0x78'),_0x9909('0x7f'),_0x9909('0xd3'),_0x9909('0xd4'),_0x9909('0x84')],'include':_0x18d4e0}];_0xe69745[_0x9909('0x37')]({'model':db[_0x9909('0xd5')],'as':_0x9909('0xd6'),'attributes':['id',_0x9909('0x30')]});_0xe69745[_0x9909('0x37')]({'model':db[_0x9909('0x72')],'as':_0x9909('0xd7'),'attributes':['id',_0x9909('0x33')]});return db[_0x9909('0x39')][_0x9909('0x75')]({'where':{'id':_0x3e2137[_0x9909('0xb3')]['id']},'include':_0xe69745})[_0x9909('0x2b')](handleEntityNotFound(_0x1246f3,null))[_0x9909('0x2b')](function(_0x1704cf){if(_0x1704cf){var _0xb64266=_0x1704cf[_0x9909('0xd8')]({'plain':!![]});fs[_0x9909('0xd9')](_0x57eda2);var _0x8c0b89={'channel':_0x9909('0xda'),'account':_0xb64266[_0x9909('0xd6')]['name'],'agent':_0xb64266['Owner']?_0xb64266[_0x9909('0xd7')]['fullname']:'N.A.','createdAt':moment(_0xb64266['createdAt'])[_0x9909('0xce')](_0x9909('0xbf'))[_0x9909('0x9d')](),'closedAt':_0xb64266[_0x9909('0xdb')]?moment(_0xb64266['closedAt'])[_0x9909('0xce')](_0x9909('0xbf'))[_0x9909('0x9d')]():'','disposition':_0xb64266['disposition'],'messages':_(_0xb64266[_0x9909('0xdc')])['filter']({'secret':![]})[_0x9909('0x32')](function(_0x55c326){if(_0x55c326['Attachment']){var _0x531bad=path[_0x9909('0xc8')](_0x18506f,_0x55c326[_0x9909('0xd2')]['basename']);if(fs[_0x9909('0xdd')](_0x531bad)){fs[_0x9909('0xde')](_0x531bad)['pipe'](fs[_0x9909('0xdf')](path['join'](_0x57eda2,_0x55c326[_0x9909('0xd2')][_0x9909('0xe0')])));}}return{'date':moment(_0x55c326[_0x9909('0x7f')])[_0x9909('0xce')](_0x9909('0xbf'))[_0x9909('0x9d')](),'sender':_0x55c326[_0x9909('0xd3')]==='out'?_0x55c326['User']?_0x55c326['User'][_0x9909('0x33')]:_0x9909('0xe1'):_0x55c326[_0x9909('0x68')]['firstName']+(_0x55c326[_0x9909('0x68')][_0x9909('0xd1')]?'\x20'+_0x55c326[_0x9909('0x68')][_0x9909('0xd1')]:''),'body':_0x55c326[_0x9909('0xd2')]?_0x55c326[_0x9909('0xd2')]['basename']:_0x55c326[_0x9909('0x78')],'direction':_0x55c326[_0x9909('0xd3')]===_0x9909('0xe2')?'A':'C','secret':_0x55c326[_0x9909('0xd4')],'read':_0x55c326['read'],'attachment':_0x55c326[_0x9909('0xd2')]};})[_0x9909('0x64')]()};return ejs[_0x9909('0xe3')](path['join'](config[_0x9909('0xc9')],_0x9909('0xca'),_0x9909('0xe4'),_0x9909('0xe5')),{'interaction':_0x8c0b89})['then'](function(_0x25b65a){var _0x229a9d=path[_0x9909('0xc8')](_0x57eda2,'transcript-'+_0xb64266['id']+'-'+_0x1ee511+_0x9909('0xe6'));var _0x3dd43c={'path':_0x229a9d,'channel':_0x9909('0xda'),'interactionId':_0xb64266['id']};return pdf[_0x9909('0xe7')](_0x25b65a,_0x3dd43c);})[_0x9909('0x2b')](function(){return new BPromise(function(_0x5bf403,_0xec5a91){zipdir(_0x57eda2,{'saveTo':_0x3cf227},function(_0x3dac68,_0x253994){if(_0x3dac68)return _0xec5a91(_0x3dac68);return _0x5bf403(_0x253994);});})[_0x9909('0x2b')](function(){return new BPromise(function(_0x275550,_0x3efe39){rimraf(_0x57eda2,function(_0x5845fc){if(_0x5845fc)_0x3efe39(_0x5845fc);return _0x275550();});});})[_0x9909('0x2b')](function(){return _0x1246f3[_0x9909('0xc6')](_0x3cf227,_0x433f2e,function(_0xd230ed){if(_0xd230ed){console[_0x9909('0xe8')]('err',_0xd230ed);}else{fs[_0x9909('0xe9')](_0x3cf227);}});});});}else{return _0x1246f3['sendStatus'](0xc8);}})[_0x9909('0x38')](handleError(_0x1246f3,null));}; \ No newline at end of file +var _0x7bb8=['unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','end','error','name','Users','fullname','TagIds','Tags','split','forEach','catch','map','WhatsappInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','field','color','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','rows','show','params','include','options','create','body','describe','addMessage','omit','ids','getMessages','WhatsappMessage','rawAttributes','format','YYYY-MM-DD\x20HH:mm:ss','findAll','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','files','tmp','join','transcript-%d-%s.zip','User','CmContact','firstName','lastName','attachments','Attachment','secret','WhatsappAccount','Account','mkdirSync','Whatsapp','Owner','N.A.','closed','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7bb8,0xe8));var _0x87bb=function(_0x1d18f5,_0x55e81b){_0x1d18f5=_0x1d18f5-0x0;var _0x3d9c9d=_0x7bb8[_0x1d18f5];return _0x3d9c9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87bb('0x0'));var zipdir=require(_0x87bb('0x1'));var jsonpatch=require(_0x87bb('0x2'));var rp=require(_0x87bb('0x3'));var moment=require('moment');var BPromise=require(_0x87bb('0x4'));var Mustache=require(_0x87bb('0x5'));var util=require('util');var path=require(_0x87bb('0x6'));var sox=require(_0x87bb('0x7'));var csv=require('to-csv');var ejs=require(_0x87bb('0x8'));var fs=require('fs');var fs_extra=require(_0x87bb('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x87bb('0xa'));var jsforce=require(_0x87bb('0xb'));var deskjs=require(_0x87bb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x87bb('0xd'));var Papa=require(_0x87bb('0xe'));var Redis=require(_0x87bb('0xf'));var authService=require(_0x87bb('0x10'));var qs=require(_0x87bb('0x11'));var as=require(_0x87bb('0x12'));var pdf=require(_0x87bb('0x13'));var hardwareService=require(_0x87bb('0x14'));var logger=require(_0x87bb('0x15'))(_0x87bb('0x16'));var utils=require(_0x87bb('0x17'));var config=require(_0x87bb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x87bb('0x19'))['db'];config[_0x87bb('0x1a')]=_[_0x87bb('0x1b')](config[_0x87bb('0x1a')],{'host':_0x87bb('0x1c'),'port':0x18eb});var socket=require(_0x87bb('0x1d'))(new Redis(config['redis']));require(_0x87bb('0x1e'))[_0x87bb('0x1f')](socket);function respondWithStatusCode(_0x208f46,_0x428fd7){_0x428fd7=_0x428fd7||0xcc;return function(_0x542e30){if(_0x542e30){return _0x208f46[_0x87bb('0x20')](_0x428fd7);}return _0x208f46['status'](_0x428fd7)['end']();};}function respondWithResult(_0x48a6a2,_0x529c34){_0x529c34=_0x529c34||0xc8;return function(_0x429266){if(_0x429266){return _0x48a6a2[_0x87bb('0x21')](_0x529c34)[_0x87bb('0x22')](_0x429266);}};}function respondWithFilteredResult(_0x48edf0,_0x3505fa){return function(_0x1442c7){if(_0x1442c7){var _0x29dd42=typeof _0x3505fa[_0x87bb('0x23')]===_0x87bb('0x24')&&typeof _0x3505fa[_0x87bb('0x25')]===_0x87bb('0x24');var _0x1bad1a=_0x1442c7[_0x87bb('0x26')];var _0x1d0c84=_0x29dd42?0x0:_0x3505fa[_0x87bb('0x23')];var _0x913750=_0x29dd42?_0x1442c7[_0x87bb('0x26')]:_0x3505fa[_0x87bb('0x23')]+_0x3505fa[_0x87bb('0x25')];var _0x277375;if(_0x913750>=_0x1bad1a){_0x913750=_0x1bad1a;_0x277375=0xc8;}else{_0x277375=0xce;}_0x48edf0[_0x87bb('0x21')](_0x277375);return _0x48edf0['set'](_0x87bb('0x27'),_0x1d0c84+'-'+_0x913750+'/'+_0x1bad1a)[_0x87bb('0x22')](_0x1442c7);}return null;};}function patchUpdates(_0x51280b){return function(_0x2d5904){try{jsonpatch[_0x87bb('0x28')](_0x2d5904,_0x51280b,!![]);}catch(_0xf68459){return BPromise[_0x87bb('0x29')](_0xf68459);}return _0x2d5904[_0x87bb('0x2a')]();};}function saveUpdates(_0x14f192,_0x2d8223){return function(_0x52cc70){if(_0x52cc70){return _0x52cc70[_0x87bb('0x2b')](_0x14f192)['then'](function(_0x33987b){return _0x33987b;});}return null;};}function removeEntity(_0x3a6a41,_0x3130cc){return function(_0x2984d8){if(_0x2984d8){return _0x2984d8[_0x87bb('0x2c')]()[_0x87bb('0x2d')](function(){_0x3a6a41[_0x87bb('0x21')](0xcc)[_0x87bb('0x2e')]();});}};}function handleEntityNotFound(_0x198e97,_0x1c9038){return function(_0x221ebe){if(!_0x221ebe){_0x198e97[_0x87bb('0x20')](0x194);}return _0x221ebe;};}function handleError(_0x750248,_0x6d9150){_0x6d9150=_0x6d9150||0x1f4;return function(_0x9b947c){logger[_0x87bb('0x2f')](_0x9b947c['stack']);if(_0x9b947c[_0x87bb('0x30')]){delete _0x9b947c[_0x87bb('0x30')];}_0x750248[_0x87bb('0x21')](_0x6d9150)['send'](_0x9b947c);};}function getInteractionUsers(_0x5d5ec,_0x2cbf8e){return new BPromise(function(_0x1b7b67,_0x20aed){try{if(_0x2cbf8e[_0x5d5ec['id']]){_0x5d5ec[_0x87bb('0x31')]=_['map'](_0x2cbf8e[_0x5d5ec['id']],function(_0x1d92c1){return{'id':_0x1d92c1['id'],'fullname':_0x1d92c1[_0x87bb('0x32')]};});}}catch(_0x420003){_0x20aed(_0x420003);}_0x1b7b67(_0x5d5ec);});}function getInteractionTags(_0x63d57e,_0x279034){return new BPromise(function(_0xef1548,_0x2cad08){try{if(_0x63d57e[_0x87bb('0x33')]){_0x63d57e[_0x87bb('0x34')]=[];_0x63d57e[_0x87bb('0x33')][_0x87bb('0x35')](',')[_0x87bb('0x36')](function(_0x430ec8){_0x63d57e['Tags']['push'](_0x279034[_0x430ec8]);});}delete _0x63d57e[_0x87bb('0x33')];}catch(_0x54b345){_0x2cad08(_0x54b345);}_0xef1548(_0x63d57e);});}function updateWhatsappInteraction(_0x495c97,_0x1672b9,_0x3cc024){return new BPromise(function(_0x23b426,_0x18aa11){return getInteractionUsers(_0x495c97,_0x3cc024)[_0x87bb('0x2d')](function(_0xccc965){return getInteractionTags(_0xccc965,_0x1672b9);})['then'](function(_0x10f502){_0x23b426(_0x10f502);})[_0x87bb('0x37')](function(_0x10b3ee){_0x18aa11(_0x10b3ee);});});}exports['index']=function(_0x47b895,_0x552896){var _0x3db137={},_0x31afa8={},_0x31fb3d={'count':0x0,'rows':[]};var _0x11a1c=_[_0x87bb('0x38')](db[_0x87bb('0x39')]['rawAttributes'],function(_0x354d4b){return{'name':_0x354d4b[_0x87bb('0x3a')],'type':_0x354d4b[_0x87bb('0x3b')][_0x87bb('0x3c')]};});_0x31afa8[_0x87bb('0x3d')]=_[_0x87bb('0x38')](_0x11a1c,'name');_0x31afa8[_0x87bb('0x3e')]=_[_0x87bb('0x3f')](_0x47b895[_0x87bb('0x3e')]);_0x31afa8[_0x87bb('0x40')]=_[_0x87bb('0x41')](_0x31afa8['model'],_0x31afa8[_0x87bb('0x3e')]);_0x3db137[_0x87bb('0x42')]=_[_0x87bb('0x41')](_0x31afa8[_0x87bb('0x3d')],qs[_0x87bb('0x43')](_0x47b895[_0x87bb('0x3e')]['fields']));_0x3db137['attributes']=_0x3db137[_0x87bb('0x42')][_0x87bb('0x44')]?_0x3db137['attributes']:_0x31afa8[_0x87bb('0x3d')];if(!_0x47b895['query'][_0x87bb('0x45')](_0x87bb('0x46'))){_0x3db137[_0x87bb('0x25')]=qs['limit'](_0x47b895[_0x87bb('0x3e')][_0x87bb('0x25')]);_0x3db137[_0x87bb('0x23')]=qs['offset'](_0x47b895[_0x87bb('0x3e')][_0x87bb('0x23')]);}_0x3db137['order']=qs[_0x87bb('0x47')](_0x47b895[_0x87bb('0x3e')][_0x87bb('0x47')]);_0x3db137[_0x87bb('0x48')]=qs[_0x87bb('0x40')](_['pick'](_0x47b895[_0x87bb('0x3e')],_0x31afa8['filters']),_0x11a1c);var _0x546ed1=[];var _0x2e276a=squel['select']()[_0x87bb('0x49')]('id')[_0x87bb('0x49')](_0x87bb('0x30'))[_0x87bb('0x49')](_0x87bb('0x4a'))['from'](_0x87bb('0x4b'));var _0x242d32=squel[_0x87bb('0x4c')]()[_0x87bb('0x49')](_0x87bb('0x4d'))[_0x87bb('0x49')](_0x87bb('0x4e'))[_0x87bb('0x49')](_0x87bb('0x4f'))[_0x87bb('0x50')]('user_has_whatsapp_interactions','ui')[_0x87bb('0x51')](_0x87bb('0x52'),'u',_0x87bb('0x53'));var _0xe6cc25=squel[_0x87bb('0x4c')]()[_0x87bb('0x50')]('whatsapp_interactions','i')[_0x87bb('0x51')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x87bb('0x51')](_0x87bb('0x52'),'o',_0x87bb('0x54'))[_0x87bb('0x51')](_0x87bb('0x55'),'a',_0x87bb('0x56'))[_0x87bb('0x51')](_0x87bb('0x57'),'me',_0x87bb('0x58'))[_0x87bb('0x51')]('whatsapp_interaction_has_tags','it',_0x87bb('0x59'))[_0x87bb('0x51')](_0x87bb('0x4b'),'t',_0x87bb('0x5a'));var _0x11d64b=squel['expr']();var _0x54fdef=[];var _0x158137=squel['expr']();var _0x25839a;if(_0x47b895[_0x87bb('0x3e')][_0x87bb('0x5b')]){_0x25839a=as[_0x87bb('0x5c')](_0x47b895[_0x87bb('0x3e')][_0x87bb('0x5b')]);var _0x5c563b=_0x25839a[_0x87bb('0x5d')];for(var _0x4c85c2=0x0;_0x4c85c2<_0x25839a[_0x87bb('0x5e')][_0x87bb('0x44')];_0x4c85c2++){var _0x398622=_0x25839a[_0x87bb('0x5e')][_0x4c85c2];var _0x28de85='i';var _0x8d5b76=_[_0x87bb('0x5f')](_0x11a1c,[_0x87bb('0x30'),_0x398622[_0x87bb('0x49')]]);if(!_0x8d5b76){switch(_0x398622[_0x87bb('0x49')]){case'unreadMessages':if(_0x398622[_0x87bb('0x60')]==0x1){_0xe6cc25['having']('`'+_0x398622[_0x87bb('0x49')]+_0x87bb('0x61'));}else{_0xe6cc25[_0x87bb('0x62')]('`'+_0x398622[_0x87bb('0x49')]+_0x87bb('0x63'));}break;case _0x87bb('0x64'):if(_0x398622[_0x87bb('0x65')]===_0x87bb('0x66')){if(_0x398622[_0x87bb('0x60')][_0x87bb('0x35')]('\x20')[_0x87bb('0x44')]>0x1){_0x11d64b[_0x5c563b]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x87bb('0x67')](_0x398622[_0x87bb('0x60')]),null);}else{var _0x23b71b='%'+_0x398622['value']+'%';_0x11d64b[_0x5c563b](_0x87bb('0x68'),_0x23b71b,_0x23b71b,_0x23b71b);}}else{_0x8d5b76=_[_0x87bb('0x5f')](_0x11a1c,[_0x87bb('0x30'),_0x87bb('0x69')]);_0x398622[_0x87bb('0x49')]=_0x87bb('0x69');_0x4b97dd=as[_0x87bb('0x6a')](_0x28de85,_0x8d5b76['type'],_0x398622);_0x11d64b[_0x5c563b](_0x4b97dd[_0x87bb('0x6b')],_0x4b97dd['value']['start'],_0x4b97dd[_0x87bb('0x60')][_0x87bb('0x2e')]);}break;case _0x87bb('0x6c'):var _0x4a4f2b=_0x398622['value'][_0x87bb('0x35')](',')[_0x87bb('0x38')](function(_0x1b63f4){return Number(_0x1b63f4);});_0x4a4f2b['forEach'](function(_0x1a53b8){_0x158137['or'](_0x87bb('0x6d'),'%,'+_0x1a53b8+',%');});_0x54fdef=_['union'](_0x54fdef,_0x4a4f2b);break;case'User':if(_0x398622[_0x87bb('0x65')]===_0x87bb('0x66')){_0x11d64b[_0x5c563b](_0x87bb('0x6e'),'%'+_0x398622[_0x87bb('0x60')]+'%',null);}else{_0x8d5b76=_[_0x87bb('0x5f')](_0x11a1c,['name',_0x87bb('0x6f')]);_0x398622[_0x87bb('0x49')]=_0x87bb('0x6f');_0x4b97dd=as['buildExpression'](_0x28de85,_0x8d5b76['type'],_0x398622);_0x11d64b[_0x5c563b](_0x4b97dd[_0x87bb('0x6b')],_0x4b97dd[_0x87bb('0x60')]['start'],_0x4b97dd[_0x87bb('0x60')][_0x87bb('0x2e')]);}break;case'body':_0x4b97dd=as[_0x87bb('0x6a')]('me',null,_0x398622);_0x11d64b[_0x5c563b](_0x4b97dd[_0x87bb('0x6b')],_0x4b97dd[_0x87bb('0x60')][_0x87bb('0x70')],_0x4b97dd[_0x87bb('0x60')][_0x87bb('0x2e')]);break;}}else{var _0x4b97dd=as[_0x87bb('0x6a')](_0x28de85,_0x8d5b76['type'],_0x398622);_0x11d64b[_0x5c563b](_0x4b97dd['text'],_0x4b97dd[_0x87bb('0x60')][_0x87bb('0x70')],_0x4b97dd[_0x87bb('0x60')]['end']);}}}else{var _0x339c82=_(_0x47b895['query'])['keys']()[_0x87bb('0x38')](function(_0x534e53){return _[_0x87bb('0x71')](_0x11a1c,[_0x87bb('0x30'),_0x534e53])?_0x534e53:undefined;})[_0x87bb('0x72')]()[_0x87bb('0x60')]();if(!_[_0x87bb('0x73')](_0x339c82)){_0x339c82[_0x87bb('0x36')](function(_0x1550b8){if(_0x1550b8===_0x87bb('0x74')){_0xe6cc25[_0x87bb('0x48')](_0x87bb('0x75'),[]['concat'](_0x47b895[_0x87bb('0x3e')][_0x1550b8]));}else if(_0x1550b8===_0x87bb('0x76')){var _0x239d45=JSON[_0x87bb('0x77')](_0x47b895['query'][_0x1550b8])[_0x87bb('0x78')];var _0x5f2e4a=JSON[_0x87bb('0x77')](_0x47b895['query'][_0x1550b8])['$lte'];_0xe6cc25[_0x87bb('0x48')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x239d45,_0x5f2e4a);}else{if(_0x47b895['query'][_0x1550b8]==='null'){_0xe6cc25['where']('i.'+_0x1550b8+_0x87bb('0x79'));}else{_0xe6cc25[_0x87bb('0x48')]('i.'+_0x1550b8+_0x87bb('0x7a'),_0x47b895[_0x87bb('0x3e')][_0x1550b8]);}}});}if(_0x47b895[_0x87bb('0x3e')][_0x87bb('0x7b')]){if(_0x47b895[_0x87bb('0x3e')][_0x87bb('0x7b')]==0x1){_0xe6cc25[_0x87bb('0x62')](_0x87bb('0x7c'));}else{_0xe6cc25[_0x87bb('0x62')](_0x87bb('0x7d'));}}if(_0x47b895[_0x87bb('0x3e')][_0x87bb('0x7e')]){_0x54fdef=_['isArray'](_0x47b895[_0x87bb('0x3e')]['tag'])?_0x47b895[_0x87bb('0x3e')][_0x87bb('0x7e')]:new Array(_0x47b895[_0x87bb('0x3e')][_0x87bb('0x7e')]);_0x54fdef[_0x87bb('0x36')](function(_0xc72c43){_0x158137['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xc72c43+',%');});}if(_0x47b895['query'][_0x87bb('0x7f')]){var _0x4d2b60=_0x47b895[_0x87bb('0x3e')][_0x87bb('0x7f')]['replace']('\x5c','\x5c\x5c')[_0x87bb('0x80')](/'/g,'\x27\x27');if(qs[_0x87bb('0x81')](_0x4d2b60)){_0x11d64b['or']('i.id\x20LIKE\x20?',_0x4d2b60+'%')['or'](_0x87bb('0x82'),_0x4d2b60+'%');}else{_0x11d64b['or'](_0x87bb('0x83'),qs[_0x87bb('0x67')](_0x4d2b60))['or'](_0x87bb('0x84'),_0x4d2b60+'%');}}}_0xe6cc25[_0x87bb('0x48')](_0x11d64b);_0xe6cc25[_0x87bb('0x85')](_0x87bb('0x86'));var _0x40098c={'type':db['Sequelize'][_0x87bb('0x87')][_0x87bb('0x88')],'raw':!![]};var _0xe6b2f=_0xe6cc25[_0x87bb('0x89')]();_0xe6b2f[_0x87bb('0x49')](_0x87bb('0x86'));_0xe6b2f[_0x87bb('0x49')](_0x87bb('0x8a'),'unreadMessages');if(_0x3db137[_0x87bb('0x8b')]){_0x3db137[_0x87bb('0x8b')][_0x87bb('0x36')](function(_0x23e711){var _0x5905df=_0x23e711[0x0]===_0x87bb('0x8c')?_0x23e711[0x0]:'i.'+_0x23e711[0x0];_0xe6cc25['order'](_0x5905df,_0x23e711[0x1]===_0x87bb('0x8d')?![]:!![]);});}if(!_[_0x87bb('0x73')](_0x54fdef)){_0xe6cc25[_0x87bb('0x62')](_0x158137);_0xe6b2f[_0x87bb('0x48')]('t.id\x20IN\x20?',_0x54fdef);}BPromise[_0x87bb('0x8e')]()[_0x87bb('0x2d')](function(){if(!_0x25839a){if(_0x47b895[_0x87bb('0x3e')][_0x87bb('0x74')])return;_0xe6b2f['where'](_0x87bb('0x8f'));_0xe6cc25[_0x87bb('0x48')](_0x87bb('0x8f'));return;}if(_0x47b895[_0x87bb('0x90')][_0x87bb('0x91')]!==_0x87bb('0x92'))return;return _0x47b895[_0x87bb('0x90')][_0x87bb('0x93')]({'attributes':['id'],'raw':!![]})[_0x87bb('0x2d')](function(_0x421508){if(_[_0x87bb('0x73')](_0x421508)){_0xe6b2f[_0x87bb('0x48')](_0x87bb('0x94'));_0xe6cc25[_0x87bb('0x48')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0xe6b2f[_0x87bb('0x48')](_0x87bb('0x75'),_['map'](_0x421508,'id'));_0xe6cc25[_0x87bb('0x48')](_0x87bb('0x75'),_[_0x87bb('0x38')](_0x421508,'id'));}});})[_0x87bb('0x2d')](function(){if(_0x47b895['user'][_0x87bb('0x91')]===_0x87bb('0x92')&&!_0x25839a&&!_0x47b895[_0x87bb('0x3e')][_0x87bb('0x74')])return[];return db[_0x87bb('0x95')][_0x87bb('0x3e')](_0xe6b2f[_0x87bb('0x96')](),_0x40098c);})[_0x87bb('0x2d')](function(_0x5ee92f){_0x31fb3d[_0x87bb('0x26')]=_0x5ee92f[_0x87bb('0x44')];if(_0x31fb3d[_0x87bb('0x26')]===0x0)return[];return db['sequelize']['query'](_0x2e276a[_0x87bb('0x96')](),_0x40098c)[_0x87bb('0x2d')](function(_0x2be2d0){_0x546ed1=_[_0x87bb('0x97')](_0x2be2d0,'id');_0x40098c=_[_0x87bb('0x98')](_0x40098c,{'model':db[_0x87bb('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x47b895[_0x87bb('0x3e')][_0x87bb('0x43')]){_0x3db137['attributes'][_0x87bb('0x36')](function(_0x422216){_0xe6cc25[_0x87bb('0x49')]('i.'+_0x422216);});}else{_0xe6cc25[_0x87bb('0x49')](_0x87bb('0x8a'),'unreadMessages');_0xe6cc25[_0x87bb('0x49')](_0x87bb('0x99'),'Account.key');_0xe6cc25[_0x87bb('0x49')](_0x87bb('0x9a'),'Account.mandatoryDisposition');_0xe6cc25['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x87bb('0x8c'));_0xe6cc25[_0x87bb('0x49')]('i.*');_0xe6cc25[_0x87bb('0x49')](_0x87bb('0x9b'),_0x87bb('0x9c'));_0xe6cc25[_0x87bb('0x49')](_0x87bb('0x9d'),_0x87bb('0x9e'));_0xe6cc25[_0x87bb('0x49')](_0x87bb('0x9f'),'Contact.email');_0xe6cc25[_0x87bb('0x49')](_0x87bb('0xa0'),_0x87bb('0xa1'));_0xe6cc25['field']('c.mobile',_0x87bb('0xa2'));_0xe6cc25[_0x87bb('0x49')](_0x87bb('0xa3'),_0x87bb('0xa4'));_0xe6cc25[_0x87bb('0x49')]('o.fullname',_0x87bb('0xa5'));_0xe6cc25[_0x87bb('0x49')](_0x87bb('0xa6'),_0x87bb('0xa7'));_0xe6cc25[_0x87bb('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3db137['limit'])_0xe6cc25[_0x87bb('0x25')](_0x3db137[_0x87bb('0x25')]);if(_0x3db137['offset'])_0xe6cc25['offset'](_0x3db137[_0x87bb('0x23')]);return db[_0x87bb('0x95')][_0x87bb('0x3e')](_0xe6cc25[_0x87bb('0x96')](),_0x40098c);})[_0x87bb('0x2d')](function(_0x128b9d){if(_0x128b9d[_0x87bb('0x44')]>0x0)_0x242d32['where'](_0x87bb('0xa8'),_[_0x87bb('0x38')](_0x128b9d,'id'));return db['sequelize'][_0x87bb('0x3e')](_0x242d32[_0x87bb('0x96')](),_0x40098c)[_0x87bb('0x2d')](function(_0x514e14){var _0x169073=_[_0x87bb('0xa9')](_0x514e14,_0x87bb('0xaa'));var _0x251bf2=[];_0x128b9d['forEach'](function(_0x46ee97){_0x251bf2[_0x87bb('0xab')](updateWhatsappInteraction(_0x46ee97,_0x546ed1,_0x169073));});return BPromise['all'](_0x251bf2);});});})['then'](function(_0x1622ae){_0x31fb3d[_0x87bb('0xac')]=_0x1622ae;return _0x31fb3d;})[_0x87bb('0x2d')](respondWithFilteredResult(_0x552896,_0x3db137))['catch'](handleError(_0x552896,null));};exports[_0x87bb('0xad')]=function(_0x1db1de,_0x36efcf){var _0x577c93={'raw':![],'where':{'id':_0x1db1de[_0x87bb('0xae')]['id']}},_0x1cf457={};_0x1cf457[_0x87bb('0x3d')]=_[_0x87bb('0x3f')](db[_0x87bb('0x39')]['rawAttributes']);_0x1cf457[_0x87bb('0x3e')]=_[_0x87bb('0x3f')](_0x1db1de[_0x87bb('0x3e')]);_0x1cf457[_0x87bb('0x40')]=_[_0x87bb('0x41')](_0x1cf457[_0x87bb('0x3d')],_0x1cf457[_0x87bb('0x3e')]);_0x577c93[_0x87bb('0x42')]=_['intersection'](_0x1cf457[_0x87bb('0x3d')],qs[_0x87bb('0x43')](_0x1db1de[_0x87bb('0x3e')][_0x87bb('0x43')]));_0x577c93[_0x87bb('0x42')]=_0x577c93[_0x87bb('0x42')][_0x87bb('0x44')]?_0x577c93['attributes']:_0x1cf457[_0x87bb('0x3d')];if(_0x1db1de[_0x87bb('0x3e')]['includeAll']){_0x577c93[_0x87bb('0xaf')]=[{'all':!![]}];}_0x577c93=_['merge']({},_0x577c93,_0x1db1de[_0x87bb('0xb0')]);return db[_0x87bb('0x39')]['find'](_0x577c93)[_0x87bb('0x2d')](handleEntityNotFound(_0x36efcf,null))[_0x87bb('0x2d')](respondWithResult(_0x36efcf,null))[_0x87bb('0x37')](handleError(_0x36efcf,null));};exports[_0x87bb('0xb1')]=function(_0x1aa9ff,_0x30c8a1){return db[_0x87bb('0x39')][_0x87bb('0xb1')](_0x1aa9ff[_0x87bb('0xb2')],{})['then'](respondWithResult(_0x30c8a1,0xc9))[_0x87bb('0x37')](handleError(_0x30c8a1,null));};exports[_0x87bb('0x2b')]=function(_0x32af4c,_0x390250){if(_0x32af4c[_0x87bb('0xb2')]['id']){delete _0x32af4c[_0x87bb('0xb2')]['id'];}return db[_0x87bb('0x39')]['find']({'where':{'id':_0x32af4c[_0x87bb('0xae')]['id']}})['then'](handleEntityNotFound(_0x390250,null))[_0x87bb('0x2d')](saveUpdates(_0x32af4c[_0x87bb('0xb2')],null))[_0x87bb('0x2d')](respondWithResult(_0x390250,null))[_0x87bb('0x37')](handleError(_0x390250,null));};exports[_0x87bb('0x2c')]=function(_0x2f2617,_0x14020a){return db[_0x87bb('0x39')][_0x87bb('0x5f')]({'where':{'id':_0x2f2617[_0x87bb('0xae')]['id']}})['then'](handleEntityNotFound(_0x14020a,null))[_0x87bb('0x2d')](removeEntity(_0x14020a,null))['catch'](handleError(_0x14020a,null));};exports[_0x87bb('0xb3')]=function(_0x4b0d58,_0x55dc43){return db[_0x87bb('0x39')][_0x87bb('0xb3')]()[_0x87bb('0x2d')](respondWithResult(_0x55dc43,null))[_0x87bb('0x37')](handleError(_0x55dc43,null));};exports['addMessage']=function(_0x2c909d,_0x53b35c,_0x470373){return db['WhatsappMessage'][_0x87bb('0x5f')]({'where':{'id':_0x2c909d[_0x87bb('0xae')]['id']}})[_0x87bb('0x2d')](handleEntityNotFound(_0x53b35c,null))[_0x87bb('0x2d')](function(_0x494842){if(_0x494842){return _0x494842[_0x87bb('0xb4')](_0x2c909d[_0x87bb('0xb2')]['ids'],_[_0x87bb('0xb5')](_0x2c909d[_0x87bb('0xb2')],[_0x87bb('0xb6'),'id'])||{});}})[_0x87bb('0x2d')](respondWithResult(_0x53b35c,null))[_0x87bb('0x37')](handleError(_0x53b35c,null));};exports[_0x87bb('0xb7')]=function(_0x1141ff,_0x1c89ea,_0x335253){var _0x336e41={'raw':![],'where':{}};var _0x5bba03={};var _0x285985={'count':0x0,'rows':[]};return db[_0x87bb('0x39')]['findOne']({'where':{'id':_0x1141ff['params']['id']}})[_0x87bb('0x2d')](handleEntityNotFound(_0x1c89ea,null))[_0x87bb('0x2d')](function(_0x561e95){if(_0x561e95){_0x5bba03[_0x87bb('0x3d')]=_[_0x87bb('0x3f')](db[_0x87bb('0xb8')][_0x87bb('0xb9')]);_0x5bba03[_0x87bb('0x3e')]=_[_0x87bb('0x3f')](_0x1141ff[_0x87bb('0x3e')]);_0x5bba03[_0x87bb('0x40')]=_[_0x87bb('0x41')](_0x5bba03[_0x87bb('0x3d')],_0x5bba03[_0x87bb('0x3e')]);_0x336e41['attributes']=_[_0x87bb('0x41')](_0x5bba03[_0x87bb('0x3d')],qs[_0x87bb('0x43')](_0x1141ff[_0x87bb('0x3e')][_0x87bb('0x43')]));_0x336e41['attributes']=_0x336e41['attributes'][_0x87bb('0x44')]?_0x336e41['attributes']:_0x5bba03[_0x87bb('0x3d')];if(!_0x1141ff['query'][_0x87bb('0x45')](_0x87bb('0x46'))){_0x336e41[_0x87bb('0x25')]=qs[_0x87bb('0x25')](_0x1141ff[_0x87bb('0x3e')]['limit']);_0x336e41[_0x87bb('0x23')]=qs[_0x87bb('0x23')](_0x1141ff[_0x87bb('0x3e')][_0x87bb('0x23')]);}_0x336e41[_0x87bb('0x8b')]=qs[_0x87bb('0x47')](_0x1141ff[_0x87bb('0x3e')]['sort']);_0x336e41['where']=qs[_0x87bb('0x40')](_['pick'](_0x1141ff[_0x87bb('0x3e')],_0x5bba03[_0x87bb('0x40')]));_0x336e41[_0x87bb('0x48')][_0x87bb('0xaa')]=_0x561e95['id'];if(_0x1141ff[_0x87bb('0x3e')][_0x87bb('0x7f')]){_0x336e41['where']=_[_0x87bb('0x98')](_0x336e41['where'],{'$or':_[_0x87bb('0x38')](_0x336e41[_0x87bb('0x42')],function(_0x18374d){var _0x1d49a6={};_0x1d49a6[_0x18374d]={'$like':'%'+_0x1141ff['query'][_0x87bb('0x7f')]+'%'};return _0x1d49a6;})});}if(_0x1141ff[_0x87bb('0x3e')][_0x87bb('0x78')]){var _0x5cbe8c=_0x1141ff[_0x87bb('0x3e')]['$gte']['split'](',');var _0x28cb9f={};_0x28cb9f[_0x5cbe8c[0x0]]={'$gte':moment(_0x5cbe8c[0x1])[_0x87bb('0xba')](_0x87bb('0xbb'))};_0x336e41[_0x87bb('0x48')]=_[_0x87bb('0x98')](_0x336e41[_0x87bb('0x48')],_0x28cb9f);}_0x336e41=_[_0x87bb('0x98')]({},_0x336e41,_0x1141ff[_0x87bb('0xb0')]);return db[_0x87bb('0xb8')][_0x87bb('0x26')]({'where':_0x336e41[_0x87bb('0x48')]})[_0x87bb('0x2d')](function(_0x1e905b){_0x285985[_0x87bb('0x26')]=_0x1e905b;if(_0x1141ff[_0x87bb('0x3e')]['includeAll']){_0x336e41['include']=[{'all':!![]}];}return db[_0x87bb('0xb8')][_0x87bb('0xbc')](_0x336e41);})['then'](function(_0x1b5e62){_0x285985['rows']=_0x1b5e62;return _0x285985;});}})['then'](respondWithFilteredResult(_0x1c89ea,_0x336e41))[_0x87bb('0x37')](handleError(_0x1c89ea,null));};exports['addTags']=function(_0x3f7840,_0x5cedfc,_0x938d6a){return db[_0x87bb('0x39')][_0x87bb('0x5f')]({'where':{'id':_0x3f7840[_0x87bb('0xae')]['id']}})[_0x87bb('0x2d')](handleEntityNotFound(_0x5cedfc,null))['then'](function(_0x5f0b8a){if(_0x5f0b8a){return _0x5f0b8a['setTags'](_0x3f7840[_0x87bb('0xb2')][_0x87bb('0xb6')],_[_0x87bb('0xb5')](_0x3f7840[_0x87bb('0xb2')],['ids','id'])||{})[_0x87bb('0xbd')](function(){return db[_0x87bb('0x6c')][_0x87bb('0xbc')]({'attributes':['id','name',_0x87bb('0x4a')],'where':{'id':_0x3f7840[_0x87bb('0xb2')]['ids']}});})['then'](function(_0x31206e){socket[_0x87bb('0xbe')](_0x87bb('0xbf'),{'id':Number(_0x3f7840[_0x87bb('0xae')]['id']),'tags':_0x31206e||[]});return{'id':Number(_0x3f7840[_0x87bb('0xae')]['id']),'tags':_0x31206e||[]};});}})[_0x87bb('0x2d')](respondWithResult(_0x5cedfc,null))[_0x87bb('0x37')](handleError(_0x5cedfc,null));};exports[_0x87bb('0xc0')]=function(_0x26574d,_0x3e3c6b,_0x157276){return db[_0x87bb('0x39')]['find']({'where':{'id':_0x26574d[_0x87bb('0xae')]['id']}})[_0x87bb('0x2d')](handleEntityNotFound(_0x3e3c6b,null))[_0x87bb('0x2d')](function(_0x4229bb){if(_0x4229bb){return _0x4229bb[_0x87bb('0xc0')](_0x26574d[_0x87bb('0x3e')][_0x87bb('0xb6')]);}})[_0x87bb('0x2d')](respondWithStatusCode(_0x3e3c6b,null))[_0x87bb('0x37')](handleError(_0x3e3c6b,null));};exports[_0x87bb('0xc1')]=function(_0x5b1e61,_0x13b8cf){var _0x24e19a=moment()[_0x87bb('0xc2')]()[_0x87bb('0x96')]();var _0x21dab1=path['join'](config[_0x87bb('0xc3')],'server',_0x87bb('0xc4'),_0x87bb('0xc5'));var _0x305ad1=path['join'](config[_0x87bb('0xc3')],'server',_0x87bb('0xc4'),'attachments');var _0x5f3c67=path[_0x87bb('0xc6')](_0x21dab1,_0x24e19a);var _0x703649=util[_0x87bb('0xba')](_0x87bb('0xc7'),_0x5b1e61[_0x87bb('0xae')]['id'],_0x24e19a);var _0x1ee8a6=path[_0x87bb('0xc6')](_0x21dab1,_0x703649);var _0x250ba9=[];_0x250ba9[_0x87bb('0xab')]({'model':db[_0x87bb('0xc8')],'as':'User','attributes':['id',_0x87bb('0x32')],'raw':!![]});_0x250ba9['push']({'model':db[_0x87bb('0xc9')],'as':_0x87bb('0x64'),'attributes':['id',_0x87bb('0xca'),_0x87bb('0xcb')],'raw':!![]});if(_0x5b1e61['query'][_0x87bb('0xcc')]){_0x250ba9[_0x87bb('0xab')]({'model':db['Attachment'],'as':_0x87bb('0xcd'),'raw':!![]});}var _0x5b6724=[{'model':db[_0x87bb('0xb8')],'as':'Messages','attributes':['id',_0x87bb('0xb2'),'createdAt','direction',_0x87bb('0xce'),_0x87bb('0x7b')],'include':_0x250ba9}];_0x5b6724[_0x87bb('0xab')]({'model':db[_0x87bb('0xcf')],'as':_0x87bb('0xd0'),'attributes':['id','name']});_0x5b6724[_0x87bb('0xab')]({'model':db[_0x87bb('0xc8')],'as':'Owner','attributes':['id',_0x87bb('0x32')]});return db[_0x87bb('0x39')]['find']({'where':{'id':_0x5b1e61['params']['id']},'include':_0x5b6724})[_0x87bb('0x2d')](handleEntityNotFound(_0x13b8cf,null))[_0x87bb('0x2d')](function(_0x277dbc){if(_0x277dbc){var _0x1ad7cc=_0x277dbc['get']({'plain':!![]});fs[_0x87bb('0xd1')](_0x5f3c67);var _0x3b11be={'channel':_0x87bb('0xd2'),'account':_0x1ad7cc[_0x87bb('0xd0')][_0x87bb('0x30')],'agent':_0x1ad7cc[_0x87bb('0xd3')]?_0x1ad7cc[_0x87bb('0xd3')][_0x87bb('0x32')]:_0x87bb('0xd4'),'createdAt':moment(_0x1ad7cc[_0x87bb('0x76')])[_0x87bb('0xba')](_0x87bb('0xbb'))[_0x87bb('0x96')](),'closedAt':_0x1ad7cc[_0x87bb('0xd5')]?moment(_0x1ad7cc['closedAt'])[_0x87bb('0xba')](_0x87bb('0xbb'))[_0x87bb('0x96')]():'','disposition':_0x1ad7cc['disposition'],'messages':_(_0x1ad7cc[_0x87bb('0xd6')])['filter']({'secret':![]})[_0x87bb('0x38')](function(_0xbf99d1){if(_0xbf99d1[_0x87bb('0xcd')]){var _0x21705b=path[_0x87bb('0xc6')](_0x305ad1,_0xbf99d1[_0x87bb('0xcd')][_0x87bb('0xd7')]);if(fs[_0x87bb('0xd8')](_0x21705b)){fs[_0x87bb('0xd9')](_0x21705b)[_0x87bb('0xda')](fs[_0x87bb('0xdb')](path['join'](_0x5f3c67,_0xbf99d1['Attachment'][_0x87bb('0xd7')])));}}return{'date':moment(_0xbf99d1[_0x87bb('0x76')])[_0x87bb('0xba')](_0x87bb('0xbb'))[_0x87bb('0x96')](),'sender':_0xbf99d1[_0x87bb('0xdc')]===_0x87bb('0xdd')?_0xbf99d1[_0x87bb('0xc8')]?_0xbf99d1['User']['fullname']:'System':_0xbf99d1[_0x87bb('0x64')][_0x87bb('0xca')]+(_0xbf99d1[_0x87bb('0x64')][_0x87bb('0xcb')]?'\x20'+_0xbf99d1[_0x87bb('0x64')][_0x87bb('0xcb')]:''),'body':_0xbf99d1['Attachment']?_0xbf99d1[_0x87bb('0xcd')][_0x87bb('0xd7')]:_0xbf99d1[_0x87bb('0xb2')],'direction':_0xbf99d1[_0x87bb('0xdc')]===_0x87bb('0xdd')?'A':'C','secret':_0xbf99d1[_0x87bb('0xce')],'read':_0xbf99d1[_0x87bb('0x7b')],'attachment':_0xbf99d1[_0x87bb('0xcd')]};})[_0x87bb('0x60')]()};return ejs[_0x87bb('0xde')](path[_0x87bb('0xc6')](config[_0x87bb('0xc3')],_0x87bb('0xdf'),_0x87bb('0xe0'),_0x87bb('0xe1')),{'interaction':_0x3b11be})[_0x87bb('0x2d')](function(_0x23aea1){var _0xf1ca73=path['join'](_0x5f3c67,_0x87bb('0xe2')+_0x1ad7cc['id']+'-'+_0x24e19a+_0x87bb('0xe3'));var _0x569ac7={'path':_0xf1ca73,'channel':_0x87bb('0xd2'),'interactionId':_0x1ad7cc['id']};return pdf[_0x87bb('0xe4')](_0x23aea1,_0x569ac7);})['then'](function(){return new BPromise(function(_0x14f335,_0x25b4e6){zipdir(_0x5f3c67,{'saveTo':_0x1ee8a6},function(_0xb63950,_0x3e3409){if(_0xb63950)return _0x25b4e6(_0xb63950);return _0x14f335(_0x3e3409);});})[_0x87bb('0x2d')](function(){return new BPromise(function(_0x25e77f,_0x44a03c){rimraf(_0x5f3c67,function(_0x48ea2e){if(_0x48ea2e)_0x44a03c(_0x48ea2e);return _0x25e77f();});});})[_0x87bb('0x2d')](function(){return _0x13b8cf[_0x87bb('0xc1')](_0x1ee8a6,_0x703649,function(_0x1bcd36){if(_0x1bcd36){console['log'](_0x87bb('0xe5'),_0x1bcd36);}else{fs[_0x87bb('0xe6')](_0x1ee8a6);}});});});}else{return _0x13b8cf['sendStatus'](0xc8);}})[_0x87bb('0x37')](handleError(_0x13b8cf,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 21ef0d4..76dbd08 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 _0x2572=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0x23958e,_0x474ab8){var _0x162a9f=function(_0xa063f6){while(--_0xa063f6){_0x23958e['push'](_0x23958e['shift']());}};_0x162a9f(++_0x474ab8);}(_0x2572,0x110));var _0x2257=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x2572[_0x2bf141];return _0x48277b;};'use strict';var EventEmitter=require(_0x2257('0x0'));var WhatsappInteraction=require(_0x2257('0x1'))['db'][_0x2257('0x2')];var WhatsappMessage=require(_0x2257('0x1'))['db'][_0x2257('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x2257('0x4')](0x0);var events={'afterCreate':_0x2257('0x5'),'afterUpdate':_0x2257('0x6'),'afterDestroy':_0x2257('0x7')};function emitEvent(_0x5bb654){return function(_0x3abf7b,_0x3fcebd,_0x43ffe5){_0x3abf7b[_0x2257('0x8')]({'attributes':['id'],'raw':!![]})[_0x2257('0x9')](function(_0x339619){_0x3abf7b[_0x2257('0xa')](_0x2257('0xb'),_0x339619[_0x2257('0xc')](function(_0x4c9b99){return{'id':_0x4c9b99['id']};}));return WhatsappMessage[_0x2257('0xd')]({'where':{'WhatsappInteractionId':_0x3abf7b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2257('0x9')](function(_0x585a28){_0x3abf7b[_0x2257('0xa')](_0x2257('0xe'),_0x585a28[_0x2257('0xf')]);WhatsappInteractionEvents['emit'](_0x5bb654+':'+_0x3abf7b['id'],_0x3abf7b);WhatsappInteractionEvents[_0x2257('0x10')](_0x5bb654,_0x3abf7b);_0x43ffe5(null);})[_0x2257('0x11')](_0x43ffe5(null));};}for(var e in events){if(events[_0x2257('0x12')](e)){var event=events[e];WhatsappInteraction[_0x2257('0x13')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xb377=['setMaxListeners','save','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','emit','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0x2b946a,_0x104b7c){var _0x32d1e4=function(_0x1c60c7){while(--_0x1c60c7){_0x2b946a['push'](_0x2b946a['shift']());}};_0x32d1e4(++_0x104b7c);}(_0xb377,0x1b6));var _0x7b37=function(_0x250a1f,_0x1e551){_0x250a1f=_0x250a1f-0x0;var _0x5dcbdc=_0xb377[_0x250a1f];return _0x5dcbdc;};'use strict';var EventEmitter=require(_0x7b37('0x0'));var WhatsappInteraction=require(_0x7b37('0x1'))['db'][_0x7b37('0x2')];var WhatsappMessage=require(_0x7b37('0x1'))['db'][_0x7b37('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7b37('0x4')](0x0);var events={'afterCreate':_0x7b37('0x5'),'afterUpdate':_0x7b37('0x6'),'afterDestroy':_0x7b37('0x7')};function emitEvent(_0x13f4c4){return function(_0x2aed77,_0x38d1b4,_0x58edf9){_0x2aed77['getUsers']({'attributes':['id'],'raw':!![]})[_0x7b37('0x8')](function(_0x4cb89b){_0x2aed77['setDataValue'](_0x7b37('0x9'),_0x4cb89b[_0x7b37('0xa')](function(_0x62d37a){return{'id':_0x62d37a['id']};}));return WhatsappMessage[_0x7b37('0xb')]({'where':{'WhatsappInteractionId':_0x2aed77['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7b37('0x8')](function(_0x2c8991){_0x2aed77[_0x7b37('0xc')](_0x7b37('0xd'),_0x2c8991['length']);WhatsappInteractionEvents[_0x7b37('0xe')](_0x13f4c4+':'+_0x2aed77['id'],_0x2aed77);WhatsappInteractionEvents[_0x7b37('0xe')](_0x13f4c4,_0x2aed77);_0x58edf9(null);})['catch'](_0x58edf9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x7b37('0xf')](e,emitEvent(event));}}module[_0x7b37('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index bdf8aac..43fe00a 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 _0xdec0=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x4ab35e,_0x9919a1){var _0x336164=function(_0x5a2840){while(--_0x5a2840){_0x4ab35e['push'](_0x4ab35e['shift']());}};_0x336164(++_0x9919a1);}(_0xdec0,0x1d4));var _0x0dec=function(_0x2b49bc,_0x47b636){_0x2b49bc=_0x2b49bc-0x0;var _0x43cc65=_0xdec0[_0x2b49bc];return _0x43cc65;};'use strict';var _=require(_0x0dec('0x0'));var util=require(_0x0dec('0x1'));var logger=require(_0x0dec('0x2'))(_0x0dec('0x3'));var moment=require('moment');var BPromise=require(_0x0dec('0x4'));var rp=require(_0x0dec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0dec('0x6'));var config=require('../../config/environment');var attributes=require(_0x0dec('0x7'));module[_0x0dec('0x8')]=function(_0x281750,_0x2bd5dd){return _0x281750[_0x0dec('0x9')](_0x0dec('0xa'),attributes,{'tableName':_0x0dec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21f055,_0x117d45,_0x48e999){if(_0x21f055[_0x0dec('0xc')](_0x0dec('0xd'))){_0x21f055[_0x0dec('0xe')]=moment()['format'](_0x0dec('0xf'));}_0x48e999(null,_0x21f055);}}});}; \ No newline at end of file +var _0x2c2d=['whatsapp_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','define'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x2c2d,0x19d));var _0xd2c2=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x2c2d[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0xd2c2('0x0'));var util=require(_0xd2c2('0x1'));var logger=require(_0xd2c2('0x2'))(_0xd2c2('0x3'));var moment=require(_0xd2c2('0x4'));var BPromise=require(_0xd2c2('0x5'));var rp=require(_0xd2c2('0x6'));var fs=require('fs');var path=require(_0xd2c2('0x7'));var rimraf=require(_0xd2c2('0x8'));var config=require('../../config/environment');var attributes=require(_0xd2c2('0x9'));module[_0xd2c2('0xa')]=function(_0x7bd8fd,_0x1312b0){return _0x7bd8fd[_0xd2c2('0xb')]('WhatsappInteraction',attributes,{'tableName':_0xd2c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25c4c2,_0x19d513,_0x3c8bfc){if(_0x25c4c2[_0xd2c2('0xd')](_0xd2c2('0xe'))){_0x25c4c2[_0xd2c2('0xf')]=moment()[_0xd2c2('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3c8bfc(null,_0x25c4c2);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 3df6cae..eb20ca3 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 _0xc72e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','limit','AddTagsToWhatsappInteraction','find','omit','AddTags','lodash','util','moment'];(function(_0x5ce99e,_0x59cc7a){var _0x174f4f=function(_0x1eda3d){while(--_0x1eda3d){_0x5ce99e['push'](_0x5ce99e['shift']());}};_0x174f4f(++_0x59cc7a);}(_0xc72e,0x1aa));var _0xec72=function(_0x283e40,_0x11487a){_0x283e40=_0x283e40-0x0;var _0x289686=_0xc72e[_0x283e40];return _0x289686;};'use strict';var _=require(_0xec72('0x0'));var util=require(_0xec72('0x1'));var moment=require(_0xec72('0x2'));var BPromise=require('bluebird');var rs=require(_0xec72('0x3'));var fs=require('fs');var Redis=require(_0xec72('0x4'));var db=require(_0xec72('0x5'))['db'];var utils=require(_0xec72('0x6'));var logger=require(_0xec72('0x7'))(_0xec72('0x8'));var config=require(_0xec72('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xec72('0xa')]({'port':0x232a});config[_0xec72('0xb')]=_[_0xec72('0xc')](config[_0xec72('0xb')],{'host':_0xec72('0xd'),'port':0x18eb});var socket=require(_0xec72('0xe'))(new Redis(config[_0xec72('0xb')]));require(_0xec72('0xf'))[_0xec72('0x10')](socket);function respondWithRpcPromise(_0x3d3a23,_0x1bef0f,_0x43d677){return new BPromise(function(_0x15bb6f,_0x4431a0){return client[_0xec72('0x11')](_0x3d3a23,_0x43d677)[_0xec72('0x12')](function(_0x5be0db){logger[_0xec72('0x13')](_0xec72('0x14'),_0x1bef0f,_0xec72('0x15'));logger[_0xec72('0x16')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1bef0f,_0xec72('0x15'),JSON[_0xec72('0x17')](_0x5be0db));if(_0x5be0db[_0xec72('0x18')]){if(_0x5be0db[_0xec72('0x18')]['code']===0x1f4){logger[_0xec72('0x18')](_0xec72('0x14'),_0x1bef0f,_0x5be0db['error'][_0xec72('0x19')]);return _0x4431a0(_0x5be0db[_0xec72('0x18')][_0xec72('0x19')]);}logger[_0xec72('0x18')](_0xec72('0x14'),_0x1bef0f,_0x5be0db['error'][_0xec72('0x19')]);return _0x15bb6f(_0x5be0db[_0xec72('0x18')][_0xec72('0x19')]);}else{logger[_0xec72('0x13')](_0xec72('0x14'),_0x1bef0f,_0xec72('0x15'));_0x15bb6f(_0x5be0db['result'][_0xec72('0x19')]);}})[_0xec72('0x1a')](function(_0x27d73a){logger[_0xec72('0x18')](_0xec72('0x14'),_0x1bef0f,_0x27d73a);_0x4431a0(_0x27d73a);});});}exports[_0xec72('0x1b')]=function(_0x411444){var _0x2a8de4=this;return new Promise(function(_0x56f778,_0x16e9e7){return db[_0xec72('0x1c')][_0xec72('0x1d')](_0x411444[_0xec72('0x1e')],{'raw':_0x411444[_0xec72('0x1f')]?_0x411444[_0xec72('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x411444[_0xec72('0x1f')]?_0x411444['options'][_0xec72('0x20')]||null:null,'attributes':_0x411444[_0xec72('0x1f')]?_0x411444[_0xec72('0x1f')][_0xec72('0x21')]||null:null,'limit':_0x411444[_0xec72('0x1f')]?_0x411444['options'][_0xec72('0x22')]||null:null})[_0xec72('0x12')](function(_0xfe4331){logger[_0xec72('0x13')]('UpdateWhatsappInteraction',_0x411444);logger['debug']('UpdateWhatsappInteraction',_0x411444,JSON[_0xec72('0x17')](_0xfe4331));_0x56f778(_0xfe4331);})[_0xec72('0x1a')](function(_0x4b6d9a){logger[_0xec72('0x18')](_0xec72('0x1b'),_0x4b6d9a[_0xec72('0x19')],_0x411444);_0x16e9e7(_0x2a8de4['error'](0x1f4,_0x4b6d9a['message']));});});};exports[_0xec72('0x23')]=function(_0x3dac63){return new Promise(function(_0x217d0e,_0x5aa03c){return db[_0xec72('0x1c')][_0xec72('0x24')]({'where':_0x3dac63[_0xec72('0x1f')]?_0x3dac63[_0xec72('0x1f')][_0xec72('0x20')]||null:null})[_0xec72('0x12')](function(_0xaa36c9){if(_0xaa36c9){return _0xaa36c9['addTags'](_0x3dac63[_0xec72('0x1e')]['ids'],_[_0xec72('0x25')](_0x3dac63[_0xec72('0x1e')],['ids','id'])||{});}})['spread'](function(_0x59d9fb){logger[_0xec72('0x13')](_0xec72('0x26'),_0x3dac63);logger['debug'](_0xec72('0x26'),_0x3dac63,JSON[_0xec72('0x17')](_0x59d9fb));_0x217d0e(_0x59d9fb);})[_0xec72('0x1a')](function(_0x1c2e86){logger[_0xec72('0x18')]('AddTags',_0x1c2e86[_0xec72('0x19')],_0x3dac63);_0x5aa03c(_this[_0xec72('0x18')](0x1f4,_0x1c2e86['message']));});});}; \ No newline at end of file +var _0xf40e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateWhatsappInteraction','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','spread','AddTags','lodash','util','bluebird'];(function(_0x484da6,_0x10686f){var _0x4cbfb7=function(_0xed5b0e){while(--_0xed5b0e){_0x484da6['push'](_0x484da6['shift']());}};_0x4cbfb7(++_0x10686f);}(_0xf40e,0x78));var _0xef40=function(_0x50192b,_0x185471){_0x50192b=_0x50192b-0x0;var _0x30a681=_0xf40e[_0x50192b];return _0x30a681;};'use strict';var _=require(_0xef40('0x0'));var util=require(_0xef40('0x1'));var moment=require('moment');var BPromise=require(_0xef40('0x2'));var rs=require(_0xef40('0x3'));var fs=require('fs');var Redis=require(_0xef40('0x4'));var db=require(_0xef40('0x5'))['db'];var utils=require(_0xef40('0x6'));var logger=require(_0xef40('0x7'))('rpc');var config=require(_0xef40('0x8'));var jayson=require(_0xef40('0x9'));var client=jayson[_0xef40('0xa')]['http']({'port':0x232a});config[_0xef40('0xb')]=_['defaults'](config[_0xef40('0xb')],{'host':_0xef40('0xc'),'port':0x18eb});var socket=require(_0xef40('0xd'))(new Redis(config[_0xef40('0xb')]));require(_0xef40('0xe'))[_0xef40('0xf')](socket);function respondWithRpcPromise(_0x1e6539,_0x29caea,_0x3930a4){return new BPromise(function(_0x5930b6,_0x442b31){return client[_0xef40('0x10')](_0x1e6539,_0x3930a4)[_0xef40('0x11')](function(_0x5a8329){logger[_0xef40('0x12')](_0xef40('0x13'),_0x29caea,'request\x20sent');logger[_0xef40('0x14')](_0xef40('0x15'),_0x29caea,_0xef40('0x16'),JSON[_0xef40('0x17')](_0x5a8329));if(_0x5a8329[_0xef40('0x18')]){if(_0x5a8329[_0xef40('0x18')][_0xef40('0x19')]===0x1f4){logger[_0xef40('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x29caea,_0x5a8329[_0xef40('0x18')]['message']);return _0x442b31(_0x5a8329['error']['message']);}logger[_0xef40('0x18')](_0xef40('0x13'),_0x29caea,_0x5a8329['error'][_0xef40('0x1a')]);return _0x5930b6(_0x5a8329[_0xef40('0x18')][_0xef40('0x1a')]);}else{logger[_0xef40('0x12')](_0xef40('0x13'),_0x29caea,'request\x20sent');_0x5930b6(_0x5a8329['result'][_0xef40('0x1a')]);}})[_0xef40('0x1b')](function(_0x58623e){logger[_0xef40('0x18')](_0xef40('0x13'),_0x29caea,_0x58623e);_0x442b31(_0x58623e);});});}exports[_0xef40('0x1c')]=function(_0x13765c){var _0x3e9649=this;return new Promise(function(_0x2f5813,_0x40ea28){return db['WhatsappInteraction']['update'](_0x13765c[_0xef40('0x1d')],{'raw':_0x13765c['options']?_0x13765c[_0xef40('0x1e')][_0xef40('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13765c['options']?_0x13765c[_0xef40('0x1e')][_0xef40('0x20')]||null:null,'attributes':_0x13765c[_0xef40('0x1e')]?_0x13765c[_0xef40('0x1e')][_0xef40('0x21')]||null:null,'limit':_0x13765c['options']?_0x13765c[_0xef40('0x1e')][_0xef40('0x22')]||null:null})[_0xef40('0x11')](function(_0x38c23c){logger['info']('UpdateWhatsappInteraction',_0x13765c);logger[_0xef40('0x14')](_0xef40('0x1c'),_0x13765c,JSON[_0xef40('0x17')](_0x38c23c));_0x2f5813(_0x38c23c);})[_0xef40('0x1b')](function(_0x17f2c0){logger[_0xef40('0x18')]('UpdateWhatsappInteraction',_0x17f2c0[_0xef40('0x1a')],_0x13765c);_0x40ea28(_0x3e9649['error'](0x1f4,_0x17f2c0['message']));});});};exports[_0xef40('0x23')]=function(_0x5cadab){return new Promise(function(_0x4f1b21,_0x490d31){return db[_0xef40('0x24')][_0xef40('0x25')]({'where':_0x5cadab[_0xef40('0x1e')]?_0x5cadab[_0xef40('0x1e')][_0xef40('0x20')]||null:null})[_0xef40('0x11')](function(_0x5903a5){if(_0x5903a5){return _0x5903a5[_0xef40('0x26')](_0x5cadab[_0xef40('0x1d')]['ids'],_['omit'](_0x5cadab['body'],['ids','id'])||{});}})[_0xef40('0x27')](function(_0x13cb37){logger[_0xef40('0x12')]('AddTags',_0x5cadab);logger[_0xef40('0x14')](_0xef40('0x28'),_0x5cadab,JSON[_0xef40('0x17')](_0x13cb37));_0x4f1b21(_0x13cb37);})['catch'](function(_0x35ed2a){logger[_0xef40('0x18')]('AddTags',_0x35ed2a[_0xef40('0x1a')],_0x5cadab);_0x490d31(_this[_0xef40('0x18')](0x1f4,_0x35ed2a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4277fbc..b334d13 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 _0x4876=['register','./whatsappInteraction.events','save','remove','emit','removeListener'];(function(_0x224b9b,_0x39ae3b){var _0x27efe0=function(_0xf1a128){while(--_0xf1a128){_0x224b9b['push'](_0x224b9b['shift']());}};_0x27efe0(++_0x39ae3b);}(_0x4876,0x145));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require(_0x6487('0x0'));var events=[_0x6487('0x1'),_0x6487('0x2'),'update'];function createListener(_0x23b794,_0x302356){return function(_0x46d17b){_0x302356[_0x6487('0x3')](_0x23b794,_0x46d17b);};}function removeListener(_0x34857f,_0x4a34d4){return function(){WhatsappInteractionEvents[_0x6487('0x4')](_0x34857f,_0x4a34d4);};}exports[_0x6487('0x5')]=function(_0x583e2c){for(var _0x5a03bd=0x0,_0x121e14=events['length'];_0x5a03bd<_0x121e14;_0x5a03bd++){var _0x3a4ddf=events[_0x5a03bd];var _0x75fce1=createListener('whatsappInteraction:'+_0x3a4ddf,_0x583e2c);WhatsappInteractionEvents['on'](_0x3a4ddf,_0x75fce1);}}; \ No newline at end of file +var _0x792d=['length','whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','removeListener','register'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x792d,0x1a2));var _0xd792=function(_0x108156,_0x1c0acf){_0x108156=_0x108156-0x0;var _0x59b3dc=_0x792d[_0x108156];return _0x59b3dc;};'use strict';var WhatsappInteractionEvents=require(_0xd792('0x0'));var events=['save',_0xd792('0x1'),_0xd792('0x2')];function createListener(_0x587520,_0x3c0591){return function(_0x4064ef){_0x3c0591[_0xd792('0x3')](_0x587520,_0x4064ef);};}function removeListener(_0x558686,_0x1fac9f){return function(){WhatsappInteractionEvents[_0xd792('0x4')](_0x558686,_0x1fac9f);};}exports[_0xd792('0x5')]=function(_0x21a16d){for(var _0x5bee08=0x0,_0x374cd8=events[_0xd792('0x6')];_0x5bee08<_0x374cd8;_0x5bee08++){var _0x2a90bf=events[_0x5bee08];var _0xe786c1=createListener(_0xd792('0x7')+_0x2a90bf,_0x21a16d);WhatsappInteractionEvents['on'](_0x2a90bf,_0xe786c1);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 56ea64c..fa63deb 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 _0xb7d5=['status','put','isAuthenticated','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','create','/:id/status'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xb7d5,0x160));var _0x5b7d=function(_0x43f89b,_0x233ecb){_0x43f89b=_0x43f89b-0x0;var _0xecf308=_0xb7d5[_0x43f89b];return _0xecf308;};'use strict';var multer=require(_0x5b7d('0x0'));var util=require(_0x5b7d('0x1'));var path=require(_0x5b7d('0x2'));var timeout=require(_0x5b7d('0x3'));var express=require(_0x5b7d('0x4'));var router=express[_0x5b7d('0x5')]();var fs_extra=require(_0x5b7d('0x6'));var auth=require(_0x5b7d('0x7'));var interaction=require(_0x5b7d('0x8'));var config=require(_0x5b7d('0x9'));var controller=require('./whatsappMessage.controller');router[_0x5b7d('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5b7d('0xa')](_0x5b7d('0xb'),auth['isAuthenticated'](),controller[_0x5b7d('0xc')]);router['get'](_0x5b7d('0xd'),auth['isAuthenticated'](),controller[_0x5b7d('0xe')]);router[_0x5b7d('0xf')]('/',auth['isAuthenticated'](),interaction[_0x5b7d('0x10')]('whatsapp',_0x5b7d('0x11')),controller[_0x5b7d('0x12')]);router[_0x5b7d('0xf')](_0x5b7d('0x13'),controller[_0x5b7d('0x14')]);router[_0x5b7d('0x15')]('/:id',auth[_0x5b7d('0x16')](),controller[_0x5b7d('0x17')]);router['put'](_0x5b7d('0x18'),auth[_0x5b7d('0x16')](),controller[_0x5b7d('0x19')]);router[_0x5b7d('0x15')](_0x5b7d('0x1a'),auth[_0x5b7d('0x16')](),controller[_0x5b7d('0x1b')]);router[_0x5b7d('0x1c')](_0x5b7d('0xd'),auth[_0x5b7d('0x16')](),controller[_0x5b7d('0x1d')]);module[_0x5b7d('0x1e')]=router; \ No newline at end of file +var _0x4b17=['./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','post','tracked','whatsappmessage:create','/:id/status','status','put','accept','reject','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x13b07a,_0x49cfc3){var _0xdcbe0=function(_0x45dee2){while(--_0x45dee2){_0x13b07a['push'](_0x13b07a['shift']());}};_0xdcbe0(++_0x49cfc3);}(_0x4b17,0xf7));var _0x74b1=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x4b17[_0x4defd6];return _0x4c9276;};'use strict';var multer=require(_0x74b1('0x0'));var util=require('util');var path=require(_0x74b1('0x1'));var timeout=require('connect-timeout');var express=require(_0x74b1('0x2'));var router=express[_0x74b1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x74b1('0x4'));var interaction=require(_0x74b1('0x5'));var config=require('../../config/environment');var controller=require(_0x74b1('0x6'));router[_0x74b1('0x7')]('/',auth[_0x74b1('0x8')](),controller['index']);router['get'](_0x74b1('0x9'),auth[_0x74b1('0x8')](),controller[_0x74b1('0xa')]);router[_0x74b1('0x7')](_0x74b1('0xb'),auth[_0x74b1('0x8')](),controller['show']);router[_0x74b1('0xc')]('/',auth[_0x74b1('0x8')](),interaction[_0x74b1('0xd')]('whatsapp',_0x74b1('0xe')),controller['create']);router['post'](_0x74b1('0xf'),controller[_0x74b1('0x10')]);router[_0x74b1('0x11')](_0x74b1('0xb'),auth[_0x74b1('0x8')](),controller['update']);router[_0x74b1('0x11')]('/:id/accept',auth[_0x74b1('0x8')](),controller[_0x74b1('0x12')]);router[_0x74b1('0x11')]('/:id/reject',auth[_0x74b1('0x8')](),controller[_0x74b1('0x13')]);router[_0x74b1('0x14')](_0x74b1('0xb'),auth[_0x74b1('0x8')](),controller[_0x74b1('0x15')]);module[_0x74b1('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 720ada8..fad5aff 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 _0x5a9b=['DATE','BOOLEAN','TEXT','sequelize','exports','medium','out','STRING'];(function(_0x49da51,_0x3bb528){var _0x38a511=function(_0x10c384){while(--_0x10c384){_0x49da51['push'](_0x49da51['shift']());}};_0x38a511(++_0x3bb528);}(_0x5a9b,0x1e3));var _0xb5a9=function(_0x318075,_0x90a4eb){_0x318075=_0x318075-0x0;var _0x507497=_0x5a9b[_0x318075];return _0x507497;};'use strict';var Sequelize=require(_0xb5a9('0x0'));module[_0xb5a9('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb5a9('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb5a9('0x3')),'defaultValue':_0xb5a9('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb5a9('0x4')](0xbe)},'phone':{'type':Sequelize[_0xb5a9('0x4')]},'readAt':{'type':Sequelize[_0xb5a9('0x5')]},'secret':{'type':Sequelize[_0xb5a9('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb5a9('0x7')]}}; \ No newline at end of file +var _0x77ed=['out','STRING','DATE','BOOLEAN','TEXT','sequelize','exports','medium','ENUM'];(function(_0x44c44b,_0x57e40d){var _0xb29ca8=function(_0x1fea49){while(--_0x1fea49){_0x44c44b['push'](_0x44c44b['shift']());}};_0xb29ca8(++_0x57e40d);}(_0x77ed,0x152));var _0xd77e=function(_0x1ab570,_0x25ee76){_0x1ab570=_0x1ab570-0x0;var _0x4aa48b=_0x77ed[_0x1ab570];return _0x4aa48b;};'use strict';var Sequelize=require(_0xd77e('0x0'));module[_0xd77e('0x1')]={'body':{'type':Sequelize['TEXT'](_0xd77e('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd77e('0x3')]('in',_0xd77e('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd77e('0x5')](0xbe)},'phone':{'type':Sequelize[_0xd77e('0x5')]},'readAt':{'type':Sequelize[_0xd77e('0x6')]},'secret':{'type':Sequelize[_0xd77e('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd77e('0x5')]},'providerResponse':{'type':Sequelize[_0xd77e('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 41330cb..df05358 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 _0x46db=['ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','internal','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','stack','name','send','index','map','WhatsappMessage','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','create','body','find','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage'];(function(_0x2e334b,_0x426b6e){var _0x390570=function(_0x46a2a5){while(--_0x46a2a5){_0x2e334b['push'](_0x2e334b['shift']());}};_0x390570(++_0x426b6e);}(_0x46db,0x1c7));var _0xb46d=function(_0x3eaf50,_0x63c064){_0x3eaf50=_0x3eaf50-0x0;var _0x4cc499=_0x46db[_0x3eaf50];return _0x4cc499;};'use strict';var emlformat=require(_0xb46d('0x0'));var rimraf=require(_0xb46d('0x1'));var zipdir=require(_0xb46d('0x2'));var jsonpatch=require(_0xb46d('0x3'));var rp=require(_0xb46d('0x4'));var moment=require(_0xb46d('0x5'));var BPromise=require(_0xb46d('0x6'));var Mustache=require(_0xb46d('0x7'));var util=require(_0xb46d('0x8'));var path=require('path');var sox=require(_0xb46d('0x9'));var csv=require(_0xb46d('0xa'));var ejs=require(_0xb46d('0xb'));var fs=require('fs');var fs_extra=require(_0xb46d('0xc'));var _=require(_0xb46d('0xd'));var squel=require(_0xb46d('0xe'));var crypto=require(_0xb46d('0xf'));var jsforce=require(_0xb46d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb46d('0xa'));var querystring=require(_0xb46d('0x11'));var Papa=require(_0xb46d('0x12'));var Redis=require(_0xb46d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb46d('0x14'));var as=require(_0xb46d('0x15'));var hardwareService=require(_0xb46d('0x16'));var logger=require(_0xb46d('0x17'))(_0xb46d('0x18'));var utils=require(_0xb46d('0x19'));var config=require(_0xb46d('0x1a'));var licenseUtil=require(_0xb46d('0x1b'));var db=require('../../mysqldb')['db'];config[_0xb46d('0x1c')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb46d('0x1c')]));require(_0xb46d('0x1d'))[_0xb46d('0x1e')](socket);var jayson=require(_0xb46d('0x1f'));var client=jayson[_0xb46d('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xb46d('0x20')][_0xb46d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x52fe9a,_0x3516d8,_0x4254c7,_0x196997){return new BPromise(function(_0x24a477,_0x32e281){var _0x1e566e=_0x196997||client;return _0x1e566e[_0xb46d('0x22')](_0x52fe9a,_0x4254c7)[_0xb46d('0x23')](function(_0x2b5425){logger[_0xb46d('0x24')](_0xb46d('0x25'),_0x3516d8,_0xb46d('0x26'));logger[_0xb46d('0x27')](_0xb46d('0x28'),_0x3516d8,_0xb46d('0x26'),JSON['stringify'](_0x2b5425));if(_0x2b5425[_0xb46d('0x29')]){if(_0x2b5425['error']['code']===0x1f4){logger[_0xb46d('0x29')](_0xb46d('0x25'),_0x3516d8,_0x2b5425[_0xb46d('0x29')][_0xb46d('0x2a')]);return _0x32e281(_0x2b5425[_0xb46d('0x29')][_0xb46d('0x2a')]);}logger[_0xb46d('0x29')](_0xb46d('0x25'),_0x3516d8,_0x2b5425[_0xb46d('0x29')][_0xb46d('0x2a')]);return _0x24a477(_0x2b5425[_0xb46d('0x29')]['message']);}else{logger['info'](_0xb46d('0x25'),_0x3516d8,_0xb46d('0x26'));_0x24a477(_0x2b5425['result'][_0xb46d('0x2a')]);}})[_0xb46d('0x2b')](function(_0x22efc5){logger[_0xb46d('0x29')](_0xb46d('0x25'),_0x3516d8,_0x22efc5);_0x32e281(_0x22efc5);});});}function respondWithStatusCode(_0x3484cc,_0x340a2e){_0x340a2e=_0x340a2e||0xcc;return function(_0xd7c14b){if(_0xd7c14b){return _0x3484cc[_0xb46d('0x2c')](_0x340a2e);}return _0x3484cc[_0xb46d('0x2d')](_0x340a2e)[_0xb46d('0x2e')]();};}function respondWithResult(_0xcb5e64,_0x26f4b3){_0x26f4b3=_0x26f4b3||0xc8;return function(_0x36df4f){if(_0x36df4f){return _0xcb5e64[_0xb46d('0x2d')](_0x26f4b3)['json'](_0x36df4f);}};}function respondWithFilteredResult(_0xcff66c,_0x5f2c71){return function(_0x6b5269){if(_0x6b5269){var _0x307f87=typeof _0x5f2c71[_0xb46d('0x2f')]===_0xb46d('0x30')&&typeof _0x5f2c71['limit']==='undefined';var _0x33db03=_0x6b5269[_0xb46d('0x31')];var _0x6c8f7e=_0x307f87?0x0:_0x5f2c71[_0xb46d('0x2f')];var _0x6e7281=_0x307f87?_0x6b5269[_0xb46d('0x31')]:_0x5f2c71[_0xb46d('0x2f')]+_0x5f2c71[_0xb46d('0x32')];var _0x39bf26;if(_0x6e7281>=_0x33db03){_0x6e7281=_0x33db03;_0x39bf26=0xc8;}else{_0x39bf26=0xce;}_0xcff66c[_0xb46d('0x2d')](_0x39bf26);return _0xcff66c['set'](_0xb46d('0x33'),_0x6c8f7e+'-'+_0x6e7281+'/'+_0x33db03)[_0xb46d('0x34')](_0x6b5269);}return null;};}function patchUpdates(_0x1926f3){return function(_0x47b420){try{jsonpatch[_0xb46d('0x35')](_0x47b420,_0x1926f3,!![]);}catch(_0x350af9){return BPromise[_0xb46d('0x36')](_0x350af9);}return _0x47b420[_0xb46d('0x37')]();};}function saveUpdates(_0x3e0c69,_0x5257db){return function(_0x1daf7c){if(_0x1daf7c){return _0x1daf7c[_0xb46d('0x38')](_0x3e0c69)['then'](function(_0x1d3620){return _0x1d3620;});}return null;};}function removeEntity(_0x1580af,_0x226988){return function(_0x2b7e48){if(_0x2b7e48){return _0x2b7e48['destroy']()['then'](function(){_0x1580af[_0xb46d('0x2d')](0xcc)[_0xb46d('0x2e')]();});}};}function handleEntityNotFound(_0x278fad,_0x5f10d8){return function(_0x4e08fc){if(!_0x4e08fc){_0x278fad[_0xb46d('0x2c')](0x194);}return _0x4e08fc;};}function handleError(_0x44b817,_0x5dcc45){_0x5dcc45=_0x5dcc45||0x1f4;return function(_0x48102c){logger[_0xb46d('0x29')](_0x48102c[_0xb46d('0x39')]);if(_0x48102c[_0xb46d('0x3a')]){delete _0x48102c[_0xb46d('0x3a')];}_0x44b817[_0xb46d('0x2d')](_0x5dcc45)[_0xb46d('0x3b')](_0x48102c);};}exports[_0xb46d('0x3c')]=function(_0x48683a,_0x54d931){var _0x1fca39={},_0x4b0fec={},_0x8d8642={'count':0x0,'rows':[]};var _0x43e3c4=_[_0xb46d('0x3d')](db[_0xb46d('0x3e')]['rawAttributes'],function(_0x3dd81d){return{'name':_0x3dd81d['fieldName'],'type':_0x3dd81d['type']['key']};});_0x4b0fec[_0xb46d('0x3f')]=_[_0xb46d('0x3d')](_0x43e3c4,_0xb46d('0x3a'));_0x4b0fec[_0xb46d('0x40')]=_[_0xb46d('0x41')](_0x48683a[_0xb46d('0x40')]);_0x4b0fec[_0xb46d('0x42')]=_[_0xb46d('0x43')](_0x4b0fec['model'],_0x4b0fec[_0xb46d('0x40')]);_0x1fca39[_0xb46d('0x44')]=_[_0xb46d('0x43')](_0x4b0fec[_0xb46d('0x3f')],qs[_0xb46d('0x45')](_0x48683a['query'][_0xb46d('0x45')]));_0x1fca39['attributes']=_0x1fca39[_0xb46d('0x44')][_0xb46d('0x46')]?_0x1fca39[_0xb46d('0x44')]:_0x4b0fec[_0xb46d('0x3f')];if(!_0x48683a[_0xb46d('0x40')]['hasOwnProperty'](_0xb46d('0x47'))){_0x1fca39[_0xb46d('0x32')]=qs['limit'](_0x48683a[_0xb46d('0x40')][_0xb46d('0x32')]);_0x1fca39[_0xb46d('0x2f')]=qs[_0xb46d('0x2f')](_0x48683a[_0xb46d('0x40')][_0xb46d('0x2f')]);}_0x1fca39[_0xb46d('0x48')]=qs[_0xb46d('0x49')](_0x48683a[_0xb46d('0x40')][_0xb46d('0x49')]);_0x1fca39[_0xb46d('0x4a')]=qs['filters'](_['pick'](_0x48683a[_0xb46d('0x40')],_0x4b0fec['filters']),_0x43e3c4);if(_0x48683a[_0xb46d('0x40')][_0xb46d('0x4b')]){_0x1fca39['where']=_[_0xb46d('0x4c')](_0x1fca39[_0xb46d('0x4a')],{'$or':_[_0xb46d('0x3d')](_0x43e3c4,function(_0x8431f2){if(_0x8431f2[_0xb46d('0x4d')]!==_0xb46d('0x4e')){var _0xf72b4f={};_0xf72b4f[_0x8431f2[_0xb46d('0x3a')]]={'$like':'%'+_0x48683a[_0xb46d('0x40')][_0xb46d('0x4b')]+'%'};return _0xf72b4f;}})});}_0x1fca39=_[_0xb46d('0x4c')]({},_0x1fca39,_0x48683a[_0xb46d('0x4f')]);var _0x33eee9={'where':_0x1fca39[_0xb46d('0x4a')]};return db['WhatsappMessage'][_0xb46d('0x31')](_0x33eee9)['then'](function(_0x36f5c3){_0x8d8642[_0xb46d('0x31')]=_0x36f5c3;if(_0x48683a[_0xb46d('0x40')][_0xb46d('0x50')]){_0x1fca39['include']=[{'all':!![]}];}return db[_0xb46d('0x3e')][_0xb46d('0x51')](_0x1fca39);})[_0xb46d('0x23')](function(_0x3f6d7a){_0x8d8642[_0xb46d('0x52')]=_0x3f6d7a;return _0x8d8642;})[_0xb46d('0x23')](respondWithFilteredResult(_0x54d931,_0x1fca39))[_0xb46d('0x2b')](handleError(_0x54d931,null));};exports['show']=function(_0x175a99,_0x420ef6){var _0x2a904e={'raw':!![],'where':{'id':_0x175a99[_0xb46d('0x53')]['id']}},_0x4179e3={};_0x4179e3[_0xb46d('0x3f')]=_[_0xb46d('0x41')](db['WhatsappMessage'][_0xb46d('0x54')]);_0x4179e3[_0xb46d('0x40')]=_[_0xb46d('0x41')](_0x175a99[_0xb46d('0x40')]);_0x4179e3['filters']=_[_0xb46d('0x43')](_0x4179e3[_0xb46d('0x3f')],_0x4179e3[_0xb46d('0x40')]);_0x2a904e[_0xb46d('0x44')]=_[_0xb46d('0x43')](_0x4179e3['model'],qs[_0xb46d('0x45')](_0x175a99[_0xb46d('0x40')][_0xb46d('0x45')]));_0x2a904e['attributes']=_0x2a904e[_0xb46d('0x44')]['length']?_0x2a904e[_0xb46d('0x44')]:_0x4179e3['model'];if(_0x175a99[_0xb46d('0x40')][_0xb46d('0x50')]){_0x2a904e[_0xb46d('0x55')]=[{'all':!![]}];}_0x2a904e=_[_0xb46d('0x4c')]({},_0x2a904e,_0x175a99[_0xb46d('0x4f')]);return db[_0xb46d('0x3e')]['find'](_0x2a904e)[_0xb46d('0x23')](handleEntityNotFound(_0x420ef6,null))['then'](respondWithResult(_0x420ef6,null))['catch'](handleError(_0x420ef6,null));};exports[_0xb46d('0x56')]=function(_0x392963,_0x1b8f97){return db['WhatsappMessage'][_0xb46d('0x56')](_0x392963[_0xb46d('0x57')],{})[_0xb46d('0x23')](respondWithResult(_0x1b8f97,0xc9))[_0xb46d('0x2b')](handleError(_0x1b8f97,null));};exports[_0xb46d('0x38')]=function(_0x480a25,_0x4c4e86){if(_0x480a25[_0xb46d('0x57')]['id']){delete _0x480a25[_0xb46d('0x57')]['id'];}return db[_0xb46d('0x3e')][_0xb46d('0x58')]({'where':{'id':_0x480a25['params']['id']}})['then'](handleEntityNotFound(_0x4c4e86,null))[_0xb46d('0x23')](saveUpdates(_0x480a25[_0xb46d('0x57')],null))[_0xb46d('0x23')](respondWithResult(_0x4c4e86,null))[_0xb46d('0x2b')](handleError(_0x4c4e86,null));};exports[_0xb46d('0x59')]=function(_0x968bea,_0x3b3a47){return db[_0xb46d('0x3e')][_0xb46d('0x58')]({'where':{'id':_0x968bea[_0xb46d('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b3a47,null))['then'](removeEntity(_0x3b3a47,null))[_0xb46d('0x2b')](handleError(_0x3b3a47,null));};exports[_0xb46d('0x5a')]=function(_0x1001e5,_0x322308){return db[_0xb46d('0x3e')][_0xb46d('0x5a')]()[_0xb46d('0x23')](respondWithResult(_0x322308,null))[_0xb46d('0x2b')](handleError(_0x322308,null));};var interaction_log=require(_0xb46d('0x17'))(_0xb46d('0x5b'));exports[_0xb46d('0x5c')]=function(_0x4f1d4f,_0xd4cad9,_0x368457){var _0x141bd1={'agent':{},'channel':_0xb46d('0x5d')};if(_0x4f1d4f['body']['id']){delete _0x4f1d4f[_0xb46d('0x57')]['id'];}_0x4f1d4f[_0xb46d('0x57')][_0xb46d('0x5e')]=!![];_0x4f1d4f['body'][_0xb46d('0x5f')]=moment()[_0xb46d('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f1d4f['body'][_0xb46d('0x61')]=_0x4f1d4f[_0xb46d('0x57')][_0xb46d('0x61')]||_0x4f1d4f[_0xb46d('0x62')]['id'];_0x141bd1[_0xb46d('0x63')]['id']=_0x4f1d4f[_0xb46d('0x57')][_0xb46d('0x61')];return db[_0xb46d('0x3e')]['find']({'where':{'id':_0x4f1d4f[_0xb46d('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xd4cad9,null))[_0xb46d('0x23')](saveUpdates(_0x4f1d4f[_0xb46d('0x57')],null))[_0xb46d('0x23')](function(_0x23e1fd){if(_0x23e1fd){_0x141bd1['message']=_0x23e1fd[_0xb46d('0x64')]({'plain':!![]});return db[_0xb46d('0x65')][_0xb46d('0x58')]({'where':{'id':_0x23e1fd[_0xb46d('0x66')]}});}return null;})[_0xb46d('0x23')](handleEntityNotFound(_0xd4cad9,null))[_0xb46d('0x23')](function(_0x130af7){if(_0x130af7){return _0x130af7[_0xb46d('0x38')]({'UserId':_0x4f1d4f['body']['UserId'],'read1stAt':_[_0xb46d('0x67')](_0x130af7[_0xb46d('0x68')])?moment()[_0xb46d('0x60')](_0xb46d('0x69')):undefined});}return null;})[_0xb46d('0x23')](function(_0x409b1d){if(_0x409b1d){_0x141bd1[_0xb46d('0x6a')]=_0x409b1d[_0xb46d('0x64')]({'plain':!![]});interaction_log[_0xb46d('0x24')](_0xb46d('0x6b'),_0x4f1d4f[_0xb46d('0x62')]['id'],_0x4f1d4f[_0xb46d('0x62')]['name'],_0x4f1d4f[_0xb46d('0x62')][_0xb46d('0x6c')],_0x141bd1[_0xb46d('0x6a')]['id'],_0x4f1d4f[_0xb46d('0x57')]?JSON[_0xb46d('0x6d')](_0x4f1d4f[_0xb46d('0x57')]):_0xb46d('0x6e'));return respondWithRpcPromise(_0xb46d('0x6f'),_0xb46d('0x70'),_0x141bd1);}return null;})[_0xb46d('0x23')](function(_0x24a6ef){var _0x179ea8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x24a6ef['message'][_0xb46d('0x71')];return db[_0xb46d('0x72')][_0xb46d('0x40')](_0x179ea8,{'type':db['Sequelize'][_0xb46d('0x73')][_0xb46d('0x74')],'raw':!![]})['then'](function(_0x385c15){return _0x385c15;});})[_0xb46d('0x23')](function(_0x47e8f0){if(_0x47e8f0){_0x141bd1[_0xb46d('0x2a')][_0xb46d('0x75')]=_0x47e8f0[0x0];if(!_0x4f1d4f[_0xb46d('0x57')][_0xb46d('0x61')])return;return db[_0xb46d('0x76')]['find']({'where':{'id':_0x4f1d4f['body'][_0xb46d('0x61')],'role':_0xb46d('0x63')},'attributes':['id',_0xb46d('0x3a'),_0xb46d('0x77'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x17621e){if(!_0x17621e)return null;_0x141bd1[_0xb46d('0x2a')][_0xb46d('0x63')]=_0x17621e;return _0x141bd1;})[_0xb46d('0x23')](function(_0x20c061){if(_0x20c061){if(_0x4f1d4f[_0xb46d('0x57')][_0xb46d('0x78')]){_0x141bd1[_0xb46d('0x2a')]['interface']=util[_0xb46d('0x60')](_0xb46d('0x79'),_0x4f1d4f[_0xb46d('0x62')][_0xb46d('0x3a')]);_0x141bd1[_0xb46d('0x2a')][_0xb46d('0x7a')]=_0x141bd1['channel'];_0x141bd1[_0xb46d('0x2a')][_0xb46d('0x7b')]=_0x141bd1[_0xb46d('0x7a')];_0x141bd1[_0xb46d('0x2a')][_0xb46d('0x7c')]=_0xb46d('0x5c');return respondWithRpcPromise(_0xb46d('0x7d'),_0xb46d('0x7d'),{'event':_0xb46d('0x7e'),'message':_0x141bd1[_0xb46d('0x2a')]},client9002)[_0xb46d('0x23')](function(){return _0x141bd1;});}return _0x141bd1;}return null;})[_0xb46d('0x23')](respondWithResult(_0xd4cad9,null))[_0xb46d('0x2b')](handleError(_0xd4cad9,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xb46d('0x36')]=function(_0x3196c0,_0x275256,_0xc974e){var _0x36605a={'agent':{},'channel':'whatsapp'};if(_0x3196c0[_0xb46d('0x57')]['id']){delete _0x3196c0['body']['id'];}_0x3196c0[_0xb46d('0x57')]['UserId']=_0x3196c0[_0xb46d('0x57')][_0xb46d('0x61')]||_0x3196c0[_0xb46d('0x62')]['id'];_0x36605a[_0xb46d('0x63')]['id']=_0x3196c0[_0xb46d('0x57')][_0xb46d('0x61')];return db['WhatsappMessage'][_0xb46d('0x58')]({'where':{'id':_0x3196c0[_0xb46d('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x275256,null))[_0xb46d('0x23')](function(_0x4253bb){if(_0x4253bb){_0x36605a[_0xb46d('0x2a')]=_0x4253bb[_0xb46d('0x64')]({'plain':!![]});return db[_0xb46d('0x65')][_0xb46d('0x58')]({'where':{'id':_0x4253bb[_0xb46d('0x66')]}});}return null;})[_0xb46d('0x23')](handleEntityNotFound(_0x275256,null))[_0xb46d('0x23')](function(_0x31e9e1){if(_0x31e9e1){_0x36605a[_0xb46d('0x6a')]=_0x31e9e1[_0xb46d('0x64')]({'plain':!![]});interaction_log[_0xb46d('0x24')](_0xb46d('0x7f'),_0x3196c0[_0xb46d('0x62')]['id'],_0x3196c0[_0xb46d('0x62')][_0xb46d('0x3a')],_0x3196c0[_0xb46d('0x62')][_0xb46d('0x6c')],_0x36605a['interaction']['id'],_0x3196c0['body']?JSON['stringify'](_0x3196c0[_0xb46d('0x57')]):_0xb46d('0x6e'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x36605a);}return null;})[_0xb46d('0x23')](function(_0x31f6df){var _0x1d9b7c=_0xb46d('0x80')+_0x31f6df[_0xb46d('0x2a')][_0xb46d('0x71')];return db['sequelize'][_0xb46d('0x40')](_0x1d9b7c,{'type':db[_0xb46d('0x81')][_0xb46d('0x73')][_0xb46d('0x74')],'raw':!![]})['then'](function(_0x5d14df){return _0x5d14df;});})[_0xb46d('0x23')](function(_0x5cb455){if(_0x5cb455){_0x36605a[_0xb46d('0x2a')]['contact']=_0x5cb455[0x0];if(!_0x3196c0[_0xb46d('0x57')][_0xb46d('0x61')])return;return db['User'][_0xb46d('0x58')]({'where':{'id':_0x3196c0['body'][_0xb46d('0x61')],'role':'agent'},'attributes':['id',_0xb46d('0x3a'),'fullname','email',_0xb46d('0x82')],'raw':!![]});}return null;})['then'](function(_0xa851a1){if(!_0xa851a1)return null;_0x36605a['message'][_0xb46d('0x63')]=_0xa851a1;return _0x36605a;})[_0xb46d('0x23')](function(_0x33c66f){if(_0x33c66f){_0x33c66f[_0xb46d('0x2a')][_0xb46d('0x83')]=util[_0xb46d('0x60')](_0xb46d('0x79'),_0x3196c0[_0xb46d('0x62')][_0xb46d('0x3a')]);_0x33c66f[_0xb46d('0x2a')]['channel']=_0x36605a['channel'];_0x33c66f[_0xb46d('0x2a')][_0xb46d('0x7b')]=_0x36605a[_0xb46d('0x7a')];_0x33c66f[_0xb46d('0x2a')][_0xb46d('0x7c')]=_0xb46d('0x36');respondWithRpcPromise(_0xb46d('0x7d'),_0xb46d('0x7d'),{'event':_0xb46d('0x84'),'message':_0x33c66f['message']},client9002);return _0x36605a;}return null;})[_0xb46d('0x23')](respondWithResult(_0x275256,null))[_0xb46d('0x2b')](handleError(_0x275256,null));};exports['status']=function(_0x54de58,_0xbf9435,_0x4eb3b6){if(_0x54de58[_0xb46d('0x57')]['id']){delete _0x54de58['body']['id'];}var _0x4bfba4;return db[_0xb46d('0x3e')][_0xb46d('0x58')]({'where':{'id':_0x54de58[_0xb46d('0x53')]['id']}})[_0xb46d('0x23')](handleEntityNotFound(_0xbf9435,null))[_0xb46d('0x23')](function(_0x3b9900){if(_0x3b9900){_0x4bfba4=_0x3b9900;return db[_0xb46d('0x85')][_0xb46d('0x58')]({'where':{'id':_0x3b9900[_0xb46d('0x86')]}});}})[_0xb46d('0x23')](handleEntityNotFound(_0xbf9435,null))[_0xb46d('0x23')](function(_0x4a8d59){if(_0x4a8d59){logger[_0xb46d('0x27')](_0xb46d('0x87'),_0xb46d('0x2d'),'received\x20delivery\x20report\x20from',_0x4a8d59[_0xb46d('0x4d')],util[_0xb46d('0x88')](_0x54de58[_0xb46d('0x57')],{'showHidden':![],'depth':null}));switch(_0x4a8d59[_0xb46d('0x4d')]){case _0xb46d('0x89'):if(_0x54de58[_0xb46d('0x57')][_0xb46d('0x8a')]&&_0x54de58[_0xb46d('0x57')][_0xb46d('0x8a')]===_0x4bfba4[_0xb46d('0x8b')]&&_0x54de58[_0xb46d('0x57')]['MessageStatus']&&_0x54de58['body'][_0xb46d('0x8c')]==='read'){return _0x4bfba4[_0xb46d('0x38')]({'read':!![]});}else{logger[_0xb46d('0x29')](_0xb46d('0x8d'),'status',_0xb46d('0x89'),util['inspect'](_0x54de58[_0xb46d('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4bfba4;}})[_0xb46d('0x23')](respondWithResult(_0xbf9435,null))['catch'](handleError(_0xbf9435,null));}; \ No newline at end of file +var _0x3659=['SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','reject','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','undefined','count','offset','limit','set','json','destroy','end','name','send','index','map','WhatsappMessage','fieldName','type','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteractionId','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage'];(function(_0x4b1701,_0x252348){var _0x474d9c=function(_0x9652cf){while(--_0x9652cf){_0x4b1701['push'](_0x4b1701['shift']());}};_0x474d9c(++_0x252348);}(_0x3659,0x97));var _0x9365=function(_0x8be9fb,_0x2f90d9){_0x8be9fb=_0x8be9fb-0x0;var _0x3b41ac=_0x3659[_0x8be9fb];return _0x3b41ac;};'use strict';var emlformat=require(_0x9365('0x0'));var rimraf=require(_0x9365('0x1'));var zipdir=require(_0x9365('0x2'));var jsonpatch=require(_0x9365('0x3'));var rp=require('request-promise');var moment=require(_0x9365('0x4'));var BPromise=require(_0x9365('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9365('0x6'));var csv=require(_0x9365('0x7'));var ejs=require(_0x9365('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9365('0x9'));var squel=require('squel');var crypto=require(_0x9365('0xa'));var jsforce=require(_0x9365('0xb'));var deskjs=require(_0x9365('0xc'));var toCsv=require(_0x9365('0x7'));var querystring=require(_0x9365('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9365('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9365('0xf'));var logger=require(_0x9365('0x10'))(_0x9365('0x11'));var utils=require(_0x9365('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9365('0x13'));var db=require(_0x9365('0x14'))['db'];config[_0x9365('0x15')]=_[_0x9365('0x16')](config[_0x9365('0x15')],{'host':_0x9365('0x17'),'port':0x18eb});var socket=require(_0x9365('0x18'))(new Redis(config[_0x9365('0x15')]));require('./whatsappMessage.socket')[_0x9365('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9365('0x1a')][_0x9365('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x9365('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x37ac8a,_0x3c25f6,_0x431c59,_0x1ebfb7){return new BPromise(function(_0x404283,_0x181ee2){var _0x5f36e2=_0x1ebfb7||client;return _0x5f36e2['request'](_0x37ac8a,_0x431c59)[_0x9365('0x1c')](function(_0x3be50){logger[_0x9365('0x1d')](_0x9365('0x1e'),_0x3c25f6,_0x9365('0x1f'));logger[_0x9365('0x20')](_0x9365('0x21'),_0x3c25f6,_0x9365('0x1f'),JSON[_0x9365('0x22')](_0x3be50));if(_0x3be50[_0x9365('0x23')]){if(_0x3be50[_0x9365('0x23')][_0x9365('0x24')]===0x1f4){logger['error'](_0x9365('0x1e'),_0x3c25f6,_0x3be50['error'][_0x9365('0x25')]);return _0x181ee2(_0x3be50['error'][_0x9365('0x25')]);}logger[_0x9365('0x23')](_0x9365('0x1e'),_0x3c25f6,_0x3be50['error'][_0x9365('0x25')]);return _0x404283(_0x3be50[_0x9365('0x23')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3c25f6,_0x9365('0x1f'));_0x404283(_0x3be50[_0x9365('0x26')][_0x9365('0x25')]);}})[_0x9365('0x27')](function(_0x488e0d){logger[_0x9365('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x3c25f6,_0x488e0d);_0x181ee2(_0x488e0d);});});}function respondWithStatusCode(_0x310a3e,_0x3fa7c0){_0x3fa7c0=_0x3fa7c0||0xcc;return function(_0x4c1c9f){if(_0x4c1c9f){return _0x310a3e[_0x9365('0x28')](_0x3fa7c0);}return _0x310a3e[_0x9365('0x29')](_0x3fa7c0)['end']();};}function respondWithResult(_0x91b585,_0x11dc8d){_0x11dc8d=_0x11dc8d||0xc8;return function(_0x5e9c84){if(_0x5e9c84){return _0x91b585['status'](_0x11dc8d)['json'](_0x5e9c84);}};}function respondWithFilteredResult(_0x4732ff,_0x95197f){return function(_0x343914){if(_0x343914){var _0x577463=typeof _0x95197f['offset']===_0x9365('0x2a')&&typeof _0x95197f['limit']===_0x9365('0x2a');var _0x5bef4a=_0x343914[_0x9365('0x2b')];var _0x4fc1c2=_0x577463?0x0:_0x95197f[_0x9365('0x2c')];var _0x5a89d7=_0x577463?_0x343914[_0x9365('0x2b')]:_0x95197f['offset']+_0x95197f[_0x9365('0x2d')];var _0x49a87d;if(_0x5a89d7>=_0x5bef4a){_0x5a89d7=_0x5bef4a;_0x49a87d=0xc8;}else{_0x49a87d=0xce;}_0x4732ff['status'](_0x49a87d);return _0x4732ff[_0x9365('0x2e')]('Content-Range',_0x4fc1c2+'-'+_0x5a89d7+'/'+_0x5bef4a)[_0x9365('0x2f')](_0x343914);}return null;};}function patchUpdates(_0x2ed096){return function(_0x26807f){try{jsonpatch['apply'](_0x26807f,_0x2ed096,!![]);}catch(_0x11cec3){return BPromise['reject'](_0x11cec3);}return _0x26807f['save']();};}function saveUpdates(_0x4cd915,_0x2cda70){return function(_0x550e3e){if(_0x550e3e){return _0x550e3e['update'](_0x4cd915)[_0x9365('0x1c')](function(_0x314238){return _0x314238;});}return null;};}function removeEntity(_0x342250,_0x5a1ee2){return function(_0x477c64){if(_0x477c64){return _0x477c64[_0x9365('0x30')]()[_0x9365('0x1c')](function(){_0x342250[_0x9365('0x29')](0xcc)[_0x9365('0x31')]();});}};}function handleEntityNotFound(_0xe8c06b,_0x30b104){return function(_0x5c99f2){if(!_0x5c99f2){_0xe8c06b[_0x9365('0x28')](0x194);}return _0x5c99f2;};}function handleError(_0x1b4879,_0x2f760a){_0x2f760a=_0x2f760a||0x1f4;return function(_0x32668f){logger['error'](_0x32668f['stack']);if(_0x32668f[_0x9365('0x32')]){delete _0x32668f[_0x9365('0x32')];}_0x1b4879[_0x9365('0x29')](_0x2f760a)[_0x9365('0x33')](_0x32668f);};}exports[_0x9365('0x34')]=function(_0x3c1a3e,_0x3fff0e){var _0x9b0dcf={},_0xb2703d={},_0x1a1b56={'count':0x0,'rows':[]};var _0x187529=_[_0x9365('0x35')](db[_0x9365('0x36')]['rawAttributes'],function(_0x13d5d7){return{'name':_0x13d5d7[_0x9365('0x37')],'type':_0x13d5d7[_0x9365('0x38')][_0x9365('0x39')]};});_0xb2703d['model']=_['map'](_0x187529,'name');_0xb2703d[_0x9365('0x3a')]=_['keys'](_0x3c1a3e['query']);_0xb2703d[_0x9365('0x3b')]=_[_0x9365('0x3c')](_0xb2703d['model'],_0xb2703d[_0x9365('0x3a')]);_0x9b0dcf[_0x9365('0x3d')]=_[_0x9365('0x3c')](_0xb2703d['model'],qs['fields'](_0x3c1a3e['query'][_0x9365('0x3e')]));_0x9b0dcf[_0x9365('0x3d')]=_0x9b0dcf[_0x9365('0x3d')][_0x9365('0x3f')]?_0x9b0dcf[_0x9365('0x3d')]:_0xb2703d[_0x9365('0x40')];if(!_0x3c1a3e[_0x9365('0x3a')][_0x9365('0x41')]('nolimit')){_0x9b0dcf[_0x9365('0x2d')]=qs['limit'](_0x3c1a3e[_0x9365('0x3a')][_0x9365('0x2d')]);_0x9b0dcf['offset']=qs[_0x9365('0x2c')](_0x3c1a3e[_0x9365('0x3a')][_0x9365('0x2c')]);}_0x9b0dcf[_0x9365('0x42')]=qs[_0x9365('0x43')](_0x3c1a3e[_0x9365('0x3a')][_0x9365('0x43')]);_0x9b0dcf['where']=qs[_0x9365('0x3b')](_[_0x9365('0x44')](_0x3c1a3e[_0x9365('0x3a')],_0xb2703d[_0x9365('0x3b')]),_0x187529);if(_0x3c1a3e['query'][_0x9365('0x45')]){_0x9b0dcf[_0x9365('0x46')]=_[_0x9365('0x47')](_0x9b0dcf['where'],{'$or':_[_0x9365('0x35')](_0x187529,function(_0x25afe0){if(_0x25afe0['type']!==_0x9365('0x48')){var _0x113661={};_0x113661[_0x25afe0[_0x9365('0x32')]]={'$like':'%'+_0x3c1a3e[_0x9365('0x3a')][_0x9365('0x45')]+'%'};return _0x113661;}})});}_0x9b0dcf=_[_0x9365('0x47')]({},_0x9b0dcf,_0x3c1a3e[_0x9365('0x49')]);var _0x5c56d3={'where':_0x9b0dcf[_0x9365('0x46')]};return db[_0x9365('0x36')][_0x9365('0x2b')](_0x5c56d3)[_0x9365('0x1c')](function(_0x2ed6ae){_0x1a1b56[_0x9365('0x2b')]=_0x2ed6ae;if(_0x3c1a3e[_0x9365('0x3a')]['includeAll']){_0x9b0dcf[_0x9365('0x4a')]=[{'all':!![]}];}return db[_0x9365('0x36')][_0x9365('0x4b')](_0x9b0dcf);})[_0x9365('0x1c')](function(_0x2d5fc2){_0x1a1b56[_0x9365('0x4c')]=_0x2d5fc2;return _0x1a1b56;})[_0x9365('0x1c')](respondWithFilteredResult(_0x3fff0e,_0x9b0dcf))[_0x9365('0x27')](handleError(_0x3fff0e,null));};exports[_0x9365('0x4d')]=function(_0x402519,_0x413be9){var _0x872da6={'raw':!![],'where':{'id':_0x402519[_0x9365('0x4e')]['id']}},_0x42605b={};_0x42605b['model']=_[_0x9365('0x4f')](db[_0x9365('0x36')][_0x9365('0x50')]);_0x42605b[_0x9365('0x3a')]=_[_0x9365('0x4f')](_0x402519['query']);_0x42605b[_0x9365('0x3b')]=_[_0x9365('0x3c')](_0x42605b[_0x9365('0x40')],_0x42605b[_0x9365('0x3a')]);_0x872da6['attributes']=_[_0x9365('0x3c')](_0x42605b[_0x9365('0x40')],qs[_0x9365('0x3e')](_0x402519['query'][_0x9365('0x3e')]));_0x872da6[_0x9365('0x3d')]=_0x872da6['attributes'][_0x9365('0x3f')]?_0x872da6[_0x9365('0x3d')]:_0x42605b[_0x9365('0x40')];if(_0x402519[_0x9365('0x3a')][_0x9365('0x51')]){_0x872da6[_0x9365('0x4a')]=[{'all':!![]}];}_0x872da6=_[_0x9365('0x47')]({},_0x872da6,_0x402519[_0x9365('0x49')]);return db[_0x9365('0x36')][_0x9365('0x52')](_0x872da6)[_0x9365('0x1c')](handleEntityNotFound(_0x413be9,null))['then'](respondWithResult(_0x413be9,null))[_0x9365('0x27')](handleError(_0x413be9,null));};exports[_0x9365('0x53')]=function(_0x42c4a9,_0x51b64c){return db[_0x9365('0x36')][_0x9365('0x53')](_0x42c4a9[_0x9365('0x54')],{})['then'](respondWithResult(_0x51b64c,0xc9))['catch'](handleError(_0x51b64c,null));};exports[_0x9365('0x55')]=function(_0x53c898,_0x44ff9a){if(_0x53c898[_0x9365('0x54')]['id']){delete _0x53c898[_0x9365('0x54')]['id'];}return db[_0x9365('0x36')][_0x9365('0x52')]({'where':{'id':_0x53c898['params']['id']}})[_0x9365('0x1c')](handleEntityNotFound(_0x44ff9a,null))[_0x9365('0x1c')](saveUpdates(_0x53c898['body'],null))[_0x9365('0x1c')](respondWithResult(_0x44ff9a,null))['catch'](handleError(_0x44ff9a,null));};exports[_0x9365('0x30')]=function(_0x1ae9b1,_0x4dd00e){return db[_0x9365('0x36')][_0x9365('0x52')]({'where':{'id':_0x1ae9b1[_0x9365('0x4e')]['id']}})[_0x9365('0x1c')](handleEntityNotFound(_0x4dd00e,null))[_0x9365('0x1c')](removeEntity(_0x4dd00e,null))[_0x9365('0x27')](handleError(_0x4dd00e,null));};exports['describe']=function(_0x8f7c8a,_0x2ce551){return db[_0x9365('0x36')][_0x9365('0x56')]()[_0x9365('0x1c')](respondWithResult(_0x2ce551,null))[_0x9365('0x27')](handleError(_0x2ce551,null));};var interaction_log=require(_0x9365('0x10'))(_0x9365('0x57'));exports[_0x9365('0x58')]=function(_0x52ff47,_0x4620cf,_0x52f758){var _0x5cf21c={'agent':{},'channel':_0x9365('0x59')};if(_0x52ff47[_0x9365('0x54')]['id']){delete _0x52ff47['body']['id'];}_0x52ff47[_0x9365('0x54')][_0x9365('0x5a')]=!![];_0x52ff47[_0x9365('0x54')][_0x9365('0x5b')]=moment()[_0x9365('0x5c')](_0x9365('0x5d'));_0x52ff47[_0x9365('0x54')][_0x9365('0x5e')]=_0x52ff47[_0x9365('0x54')][_0x9365('0x5e')]||_0x52ff47[_0x9365('0x5f')]['id'];_0x5cf21c[_0x9365('0x60')]['id']=_0x52ff47['body'][_0x9365('0x5e')];return db[_0x9365('0x36')][_0x9365('0x52')]({'where':{'id':_0x52ff47['params']['id'],'UserId':null}})[_0x9365('0x1c')](handleEntityNotFound(_0x4620cf,null))['then'](saveUpdates(_0x52ff47[_0x9365('0x54')],null))[_0x9365('0x1c')](function(_0x252b2e){if(_0x252b2e){_0x5cf21c['message']=_0x252b2e['get']({'plain':!![]});return db['WhatsappInteraction'][_0x9365('0x52')]({'where':{'id':_0x252b2e[_0x9365('0x61')]}});}return null;})[_0x9365('0x1c')](handleEntityNotFound(_0x4620cf,null))[_0x9365('0x1c')](function(_0x25bf34){if(_0x25bf34){return _0x25bf34['update']({'UserId':_0x52ff47[_0x9365('0x54')][_0x9365('0x5e')],'read1stAt':_['isNil'](_0x25bf34[_0x9365('0x62')])?moment()['format'](_0x9365('0x5d')):undefined});}return null;})['then'](function(_0x2e6d8a){if(_0x2e6d8a){_0x5cf21c[_0x9365('0x63')]=_0x2e6d8a[_0x9365('0x64')]({'plain':!![]});interaction_log[_0x9365('0x1d')](_0x9365('0x65'),_0x52ff47[_0x9365('0x5f')]['id'],_0x52ff47[_0x9365('0x5f')][_0x9365('0x32')],_0x52ff47[_0x9365('0x5f')][_0x9365('0x66')],_0x5cf21c[_0x9365('0x63')]['id'],_0x52ff47[_0x9365('0x54')]?JSON[_0x9365('0x22')](_0x52ff47['body']):_0x9365('0x67'));return respondWithRpcPromise(_0x9365('0x68'),_0x9365('0x69'),_0x5cf21c);}return null;})[_0x9365('0x1c')](function(_0xfbe07b){var _0x3ec27a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xfbe07b[_0x9365('0x25')][_0x9365('0x6a')];return db[_0x9365('0x6b')][_0x9365('0x3a')](_0x3ec27a,{'type':db[_0x9365('0x6c')][_0x9365('0x6d')][_0x9365('0x6e')],'raw':!![]})['then'](function(_0x1a4fb4){return _0x1a4fb4;});})['then'](function(_0x20055a){if(_0x20055a){_0x5cf21c[_0x9365('0x25')]['contact']=_0x20055a[0x0];if(!_0x52ff47[_0x9365('0x54')][_0x9365('0x5e')])return;return db[_0x9365('0x6f')][_0x9365('0x52')]({'where':{'id':_0x52ff47[_0x9365('0x54')]['UserId'],'role':_0x9365('0x60')},'attributes':['id',_0x9365('0x32'),_0x9365('0x70'),_0x9365('0x71'),_0x9365('0x72')],'raw':!![]});}return null;})[_0x9365('0x1c')](function(_0x327767){if(!_0x327767)return null;_0x5cf21c[_0x9365('0x25')][_0x9365('0x60')]=_0x327767;return _0x5cf21c;})[_0x9365('0x1c')](function(_0x46719f){if(_0x46719f){if(_0x52ff47[_0x9365('0x54')]['manual']){_0x5cf21c[_0x9365('0x25')][_0x9365('0x73')]=util['format'](_0x9365('0x74'),_0x52ff47[_0x9365('0x5f')]['name']);_0x5cf21c[_0x9365('0x25')]['channel']=_0x5cf21c[_0x9365('0x75')];_0x5cf21c[_0x9365('0x25')][_0x9365('0x76')]=_0x5cf21c[_0x9365('0x75')];_0x5cf21c['message']['event']='accept';return respondWithRpcPromise(_0x9365('0x77'),_0x9365('0x77'),{'event':_0x9365('0x78'),'message':_0x5cf21c[_0x9365('0x25')]},client9002)['then'](function(){return _0x5cf21c;});}return _0x5cf21c;}return null;})[_0x9365('0x1c')](respondWithResult(_0x4620cf,null))['catch'](handleError(_0x4620cf,null));};var interaction_log=require(_0x9365('0x10'))(_0x9365('0x57'));exports['reject']=function(_0x16e178,_0x4f65df,_0x1cd933){var _0x4a0f18={'agent':{},'channel':_0x9365('0x59')};if(_0x16e178[_0x9365('0x54')]['id']){delete _0x16e178[_0x9365('0x54')]['id'];}_0x16e178[_0x9365('0x54')][_0x9365('0x5e')]=_0x16e178[_0x9365('0x54')][_0x9365('0x5e')]||_0x16e178[_0x9365('0x5f')]['id'];_0x4a0f18[_0x9365('0x60')]['id']=_0x16e178[_0x9365('0x54')][_0x9365('0x5e')];return db[_0x9365('0x36')]['find']({'where':{'id':_0x16e178['params']['id'],'UserId':null}})[_0x9365('0x1c')](handleEntityNotFound(_0x4f65df,null))['then'](function(_0x1e1d65){if(_0x1e1d65){_0x4a0f18[_0x9365('0x25')]=_0x1e1d65[_0x9365('0x64')]({'plain':!![]});return db[_0x9365('0x79')][_0x9365('0x52')]({'where':{'id':_0x1e1d65[_0x9365('0x61')]}});}return null;})[_0x9365('0x1c')](handleEntityNotFound(_0x4f65df,null))[_0x9365('0x1c')](function(_0x5bee26){if(_0x5bee26){_0x4a0f18['interaction']=_0x5bee26['get']({'plain':!![]});interaction_log['info'](_0x9365('0x7a'),_0x16e178[_0x9365('0x5f')]['id'],_0x16e178[_0x9365('0x5f')][_0x9365('0x32')],_0x16e178[_0x9365('0x5f')][_0x9365('0x66')],_0x4a0f18[_0x9365('0x63')]['id'],_0x16e178['body']?JSON[_0x9365('0x22')](_0x16e178[_0x9365('0x54')]):_0x9365('0x67'));return respondWithRpcPromise(_0x9365('0x7b'),_0x9365('0x7c'),_0x4a0f18);}return null;})[_0x9365('0x1c')](function(_0x22df24){var _0x86e231=_0x9365('0x7d')+_0x22df24[_0x9365('0x25')][_0x9365('0x6a')];return db[_0x9365('0x6b')][_0x9365('0x3a')](_0x86e231,{'type':db['Sequelize'][_0x9365('0x6d')][_0x9365('0x6e')],'raw':!![]})[_0x9365('0x1c')](function(_0x53b34f){return _0x53b34f;});})[_0x9365('0x1c')](function(_0x37941b){if(_0x37941b){_0x4a0f18[_0x9365('0x25')]['contact']=_0x37941b[0x0];if(!_0x16e178[_0x9365('0x54')][_0x9365('0x5e')])return;return db[_0x9365('0x6f')][_0x9365('0x52')]({'where':{'id':_0x16e178[_0x9365('0x54')]['UserId'],'role':_0x9365('0x60')},'attributes':['id',_0x9365('0x32'),_0x9365('0x70'),_0x9365('0x71'),'internal'],'raw':!![]});}return null;})['then'](function(_0x36007e){if(!_0x36007e)return null;_0x4a0f18[_0x9365('0x25')][_0x9365('0x60')]=_0x36007e;return _0x4a0f18;})[_0x9365('0x1c')](function(_0x30d79c){if(_0x30d79c){_0x30d79c[_0x9365('0x25')][_0x9365('0x73')]=util[_0x9365('0x5c')](_0x9365('0x74'),_0x16e178[_0x9365('0x5f')][_0x9365('0x32')]);_0x30d79c[_0x9365('0x25')][_0x9365('0x75')]=_0x4a0f18[_0x9365('0x75')];_0x30d79c['message'][_0x9365('0x76')]=_0x4a0f18['channel'];_0x30d79c[_0x9365('0x25')]['event']=_0x9365('0x7e');respondWithRpcPromise(_0x9365('0x77'),'EventManager',{'event':_0x9365('0x7f'),'message':_0x30d79c[_0x9365('0x25')]},client9002);return _0x4a0f18;}return null;})[_0x9365('0x1c')](respondWithResult(_0x4f65df,null))['catch'](handleError(_0x4f65df,null));};exports['status']=function(_0x41d0c4,_0x4f1643,_0x1af9be){if(_0x41d0c4[_0x9365('0x54')]['id']){delete _0x41d0c4[_0x9365('0x54')]['id'];}var _0x46b06b;return db[_0x9365('0x36')][_0x9365('0x52')]({'where':{'id':_0x41d0c4[_0x9365('0x4e')]['id']}})[_0x9365('0x1c')](handleEntityNotFound(_0x4f1643,null))[_0x9365('0x1c')](function(_0x4f67cb){if(_0x4f67cb){_0x46b06b=_0x4f67cb;return db[_0x9365('0x80')]['find']({'where':{'id':_0x4f67cb[_0x9365('0x81')]}});}})[_0x9365('0x1c')](handleEntityNotFound(_0x4f1643,null))[_0x9365('0x1c')](function(_0x31564){if(_0x31564){logger[_0x9365('0x20')](_0x9365('0x82'),_0x9365('0x29'),_0x9365('0x83'),_0x31564[_0x9365('0x38')],util[_0x9365('0x84')](_0x41d0c4[_0x9365('0x54')],{'showHidden':![],'depth':null}));switch(_0x31564[_0x9365('0x38')]){case _0x9365('0x85'):if(_0x41d0c4[_0x9365('0x54')]['MessageSid']&&_0x41d0c4[_0x9365('0x54')][_0x9365('0x86')]===_0x46b06b[_0x9365('0x87')]&&_0x41d0c4[_0x9365('0x54')]['MessageStatus']&&_0x41d0c4[_0x9365('0x54')][_0x9365('0x88')]===_0x9365('0x5a')){return _0x46b06b['update']({'read':!![]});}else{logger['error'](_0x9365('0x89'),'status',_0x9365('0x85'),util[_0x9365('0x84')](_0x41d0c4[_0x9365('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x46b06b;}})[_0x9365('0x1c')](respondWithResult(_0x4f1643,null))[_0x9365('0x27')](handleError(_0x4f1643,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index d3673c4..b690c2a 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 _0x131e=['hasOwnProperty','hook','setMaxListeners','save','update','remove','emit'];(function(_0x2dd324,_0x2d0881){var _0x33bc5c=function(_0x4bcbc7){while(--_0x4bcbc7){_0x2dd324['push'](_0x2dd324['shift']());}};_0x33bc5c(++_0x2d0881);}(_0x131e,0x1ec));var _0xe131=function(_0x25116a,_0x2ce417){_0x25116a=_0x25116a-0x0;var _0x1cf53d=_0x131e[_0x25116a];return _0x1cf53d;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xe131('0x0')](0x0);var events={'afterCreate':_0xe131('0x1'),'afterUpdate':_0xe131('0x2'),'afterDestroy':_0xe131('0x3')};function emitEvent(_0x30486b){return function(_0x761c,_0x4ff7f7,_0x2fc440){WhatsappMessageEvents[_0xe131('0x4')](_0x30486b+':'+_0x761c['id'],_0x761c);WhatsappMessageEvents[_0xe131('0x4')](_0x30486b,_0x761c);_0x2fc440(null);};}for(var e in events){if(events[_0xe131('0x5')](e)){var event=events[e];WhatsappMessage[_0xe131('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x1339=['update','remove','emit','hasOwnProperty','exports','WhatsappMessage','setMaxListeners','save'];(function(_0x55d02b,_0x40a188){var _0x10eefe=function(_0xb106a2){while(--_0xb106a2){_0x55d02b['push'](_0x55d02b['shift']());}};_0x10eefe(++_0x40a188);}(_0x1339,0x1ed));var _0x9133=function(_0x1f70c7,_0xe746c){_0x1f70c7=_0x1f70c7-0x0;var _0x3aa4e5=_0x1339[_0x1f70c7];return _0x3aa4e5;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x9133('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x9133('0x1')](0x0);var events={'afterCreate':_0x9133('0x2'),'afterUpdate':_0x9133('0x3'),'afterDestroy':_0x9133('0x4')};function emitEvent(_0x192d48){return function(_0x176e80,_0x110c51,_0x558345){WhatsappMessageEvents[_0x9133('0x5')](_0x192d48+':'+_0x176e80['id'],_0x176e80);WhatsappMessageEvents[_0x9133('0x5')](_0x192d48,_0x176e80);_0x558345(null);};}for(var e in events){if(events[_0x9133('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x9133('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 2704e9c..b3b0087 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 _0x3877=['/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','direction','toLowerCase','out','secret','WhatsappInteraction','findOne','createdAt','catch','error','WhatsappAccount','find','then','type','twilio','accountSid','authToken','phone','create','whatsapp:'];(function(_0x5a5992,_0x307552){var _0x59afcc=function(_0x5c02ca){while(--_0x5c02ca){_0x5a5992['push'](_0x5a5992['shift']());}};_0x59afcc(++_0x307552);}(_0x3877,0x1c1));var _0x7387=function(_0x219bc1,_0x280a17){_0x219bc1=_0x219bc1-0x0;var _0x50a12c=_0x3877[_0x219bc1];return _0x50a12c;};'use strict';var _=require('lodash');var util=require(_0x7387('0x0'));var logger=require('../../config/logger')(_0x7387('0x1'));var moment=require(_0x7387('0x2'));var BPromise=require(_0x7387('0x3'));var rp=require(_0x7387('0x4'));var fs=require('fs');var path=require(_0x7387('0x5'));var rimraf=require(_0x7387('0x6'));var config=require('../../config/environment');var attributes=require(_0x7387('0x7'));module[_0x7387('0x8')]=function(_0x40fd0a,_0x979116){return _0x40fd0a[_0x7387('0x9')](_0x7387('0xa'),attributes,{'tableName':_0x7387('0xb'),'paranoid':![],'indexes':[{'name':_0x7387('0xc'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0x7387('0xd')],'type':_0x7387('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8150d5,_0x3db5bd,_0x4935a2){var _0xf24763=_0x40fd0a[_0x7387('0xf')];var _0x26f297=_0x8150d5['get']({'plain':!![]});if(_0x26f297[_0x7387('0x10')][_0x7387('0x11')]()==='in'||_0x26f297['direction'][_0x7387('0x11')]()===_0x7387('0x12')&&!_0x26f297[_0x7387('0x13')]&&!_['isNil'](_0x26f297['UserId'])){_0xf24763[_0x7387('0x14')][_0x7387('0x15')]({'where':{'id':_0x26f297['WhatsappInteractionId']}})['then'](function(_0xe885bf){if(_0xe885bf){_0xe885bf['update']({'lastMsgAt':_0x26f297[_0x7387('0x16')],'lastMsgDirection':_0x26f297[_0x7387('0x10')][_0x7387('0x11')]()});}})[_0x7387('0x17')](function(_0x5e9c1c){console[_0x7387('0x18')](_0x5e9c1c);});}if(_0x26f297[_0x7387('0x10')]===_0x7387('0x12')&&!_0x26f297['secret']){var _0x33ddbd;_0xf24763[_0x7387('0x19')][_0x7387('0x1a')]({'where':{'id':_0x26f297['WhatsappAccountId']},'raw':!![]})[_0x7387('0x1b')](function(_0x3f23e9){_0x33ddbd=_0x3f23e9;if(_0x33ddbd&&_0x33ddbd[_0x7387('0x1c')]){switch(_0x33ddbd[_0x7387('0x1c')]){case _0x7387('0x1d'):var _0x2cdf7f=require('twilio');if(_0x33ddbd[_0x7387('0x1e')]&&_0x33ddbd[_0x7387('0x1f')]&&_0x33ddbd[_0x7387('0x20')]){var _0x84656a=new _0x2cdf7f(_0x33ddbd[_0x7387('0x1e')],_0x33ddbd[_0x7387('0x1f')]);_0x84656a['messages'][_0x7387('0x21')]({'body':_0x26f297[_0x7387('0xd')],'to':'whatsapp:'+_0x26f297[_0x7387('0x20')],'from':_0x7387('0x22')+_0x33ddbd[_0x7387('0x20')],'statusCallback':_0x33ddbd['remote']+'/api/whatsapp/messages/'+_0x26f297['id']+_0x7387('0x23')+_0x33ddbd[_0x7387('0x24')]})[_0x7387('0x1b')](function(_0x13295e){if(_0x13295e[_0x7387('0x25')]){return _0x8150d5['update']({'messageId':_0x13295e['sid']});}})['catch'](function(_0x1b132a){logger['error'](_0x7387('0x26'),_0x7387('0x27'),_0x7387('0x1d'),util['inspect'](_0x1b132a,{'showHidden':![],'depth':null}));});}else{logger[_0x7387('0x18')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x7387('0x27'),_0x7387('0x1d'),_0x7387('0x28'));}break;}}})[_0x7387('0x29')](function(){_0x4935a2();});}else{_0x4935a2();}}},'charset':_0x7387('0x2a'),'collate':_0x7387('0x2b')});}; \ No newline at end of file +var _0xee29=['request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','finally','utf8mb4_unicode_ci','lodash','api','bluebird'];(function(_0x840bad,_0x3d8ffe){var _0x15b936=function(_0xcdfa8c){while(--_0xcdfa8c){_0x840bad['push'](_0x840bad['shift']());}};_0x15b936(++_0x3d8ffe);}(_0xee29,0x81));var _0x9ee2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee29[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9ee2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9ee2('0x1'));var moment=require('moment');var BPromise=require(_0x9ee2('0x2'));var rp=require(_0x9ee2('0x3'));var fs=require('fs');var path=require(_0x9ee2('0x4'));var rimraf=require(_0x9ee2('0x5'));var config=require(_0x9ee2('0x6'));var attributes=require(_0x9ee2('0x7'));module['exports']=function(_0x57b1dc,_0x121917){return _0x57b1dc[_0x9ee2('0x8')]('WhatsappMessage',attributes,{'tableName':_0x9ee2('0x9'),'paranoid':![],'indexes':[{'name':_0x9ee2('0xa'),'fields':['messageId']},{'name':_0x9ee2('0xb'),'fields':['body'],'type':_0x9ee2('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x499a9f,_0xdd70e9,_0x445908){var _0x1da7be=_0x57b1dc[_0x9ee2('0xd')];var _0x270f82=_0x499a9f[_0x9ee2('0xe')]({'plain':!![]});if(_0x270f82[_0x9ee2('0xf')][_0x9ee2('0x10')]()==='in'||_0x270f82['direction'][_0x9ee2('0x10')]()===_0x9ee2('0x11')&&!_0x270f82[_0x9ee2('0x12')]&&!_[_0x9ee2('0x13')](_0x270f82[_0x9ee2('0x14')])){_0x1da7be['WhatsappInteraction'][_0x9ee2('0x15')]({'where':{'id':_0x270f82['WhatsappInteractionId']}})[_0x9ee2('0x16')](function(_0x2bc0f3){if(_0x2bc0f3){_0x2bc0f3[_0x9ee2('0x17')]({'lastMsgAt':_0x270f82['createdAt'],'lastMsgDirection':_0x270f82['direction']['toLowerCase']()});}})['catch'](function(_0x1f89ee){console[_0x9ee2('0x18')](_0x1f89ee);});}if(_0x270f82[_0x9ee2('0xf')]===_0x9ee2('0x11')&&!_0x270f82[_0x9ee2('0x12')]){var _0x327700;_0x1da7be[_0x9ee2('0x19')][_0x9ee2('0x1a')]({'where':{'id':_0x270f82[_0x9ee2('0x1b')]},'raw':!![]})['then'](function(_0x46ecdb){_0x327700=_0x46ecdb;if(_0x327700&&_0x327700[_0x9ee2('0x1c')]){switch(_0x327700[_0x9ee2('0x1c')]){case _0x9ee2('0x1d'):var _0x5715d1=require('twilio');if(_0x327700['accountSid']&&_0x327700[_0x9ee2('0x1e')]&&_0x327700[_0x9ee2('0x1f')]){var _0x2a6e90=new _0x5715d1(_0x327700['accountSid'],_0x327700[_0x9ee2('0x1e')]);_0x2a6e90[_0x9ee2('0x20')]['create']({'body':_0x270f82['body'],'to':'whatsapp:'+_0x270f82[_0x9ee2('0x1f')],'from':_0x9ee2('0x21')+_0x327700[_0x9ee2('0x1f')],'statusCallback':_0x327700[_0x9ee2('0x22')]+_0x9ee2('0x23')+_0x270f82['id']+_0x9ee2('0x24')+_0x327700[_0x9ee2('0x25')]})['then'](function(_0x38980c){if(_0x38980c[_0x9ee2('0x26')]){return _0x499a9f[_0x9ee2('0x17')]({'messageId':_0x38980c[_0x9ee2('0x26')]});}})[_0x9ee2('0x27')](function(_0x190d5f){logger[_0x9ee2('0x18')](_0x9ee2('0x28'),'afterCreate',_0x9ee2('0x1d'),util[_0x9ee2('0x29')](_0x190d5f,{'showHidden':![],'depth':null}));});}else{logger[_0x9ee2('0x18')](_0x9ee2('0x28'),'afterCreate',_0x9ee2('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x9ee2('0x2a')](function(){_0x445908();});}else{_0x445908();}}},'charset':'utf8mb4','collate':_0x9ee2('0x2b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 1f908c9..01a9dbf 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 _0xb983=['request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','then','lodash','util','moment','bluebird','../../config/utils','rpc','client','defaults','redis','localhost','./whatsappMessage.socket','register'];(function(_0x5b30bf,_0xadc1b0){var _0x3e0614=function(_0x589abe){while(--_0x589abe){_0x5b30bf['push'](_0x5b30bf['shift']());}};_0x3e0614(++_0xadc1b0);}(_0xb983,0x8a));var _0x3b98=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0xb983[_0x2f6f50];return _0x2cf365;};'use strict';var _=require(_0x3b98('0x0'));var util=require(_0x3b98('0x1'));var moment=require(_0x3b98('0x2'));var BPromise=require(_0x3b98('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3b98('0x4'));var logger=require('../../config/logger')(_0x3b98('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3b98('0x6')]['http']({'port':0x232a});config['redis']=_[_0x3b98('0x7')](config[_0x3b98('0x8')],{'host':_0x3b98('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3b98('0xa'))[_0x3b98('0xb')](socket);function respondWithRpcPromise(_0x3cfdf6,_0x3d1286,_0xa79bec){return new BPromise(function(_0x5ee747,_0xae53f){return client[_0x3b98('0xc')](_0x3cfdf6,_0xa79bec)['then'](function(_0x1cf8c4){logger['info'](_0x3b98('0xd'),_0x3d1286,_0x3b98('0xe'));logger['debug'](_0x3b98('0xf'),_0x3d1286,_0x3b98('0xe'),JSON[_0x3b98('0x10')](_0x1cf8c4));if(_0x1cf8c4[_0x3b98('0x11')]){if(_0x1cf8c4['error'][_0x3b98('0x12')]===0x1f4){logger[_0x3b98('0x11')](_0x3b98('0xd'),_0x3d1286,_0x1cf8c4[_0x3b98('0x11')][_0x3b98('0x13')]);return _0xae53f(_0x1cf8c4[_0x3b98('0x11')][_0x3b98('0x13')]);}logger[_0x3b98('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x3d1286,_0x1cf8c4[_0x3b98('0x11')][_0x3b98('0x13')]);return _0x5ee747(_0x1cf8c4[_0x3b98('0x11')][_0x3b98('0x13')]);}else{logger[_0x3b98('0x14')](_0x3b98('0xd'),_0x3d1286,_0x3b98('0xe'));_0x5ee747(_0x1cf8c4[_0x3b98('0x15')][_0x3b98('0x13')]);}})[_0x3b98('0x16')](function(_0x45bf5a){logger[_0x3b98('0x11')](_0x3b98('0xd'),_0x3d1286,_0x45bf5a);_0xae53f(_0x45bf5a);});});}exports[_0x3b98('0x17')]=function(_0x472260){var _0x345d9b=this;return new Promise(function(_0x6651ac,_0x46d6bf){return db[_0x3b98('0x18')][_0x3b98('0x19')](_0x472260[_0x3b98('0x1a')],{'raw':_0x472260[_0x3b98('0x1b')]?_0x472260[_0x3b98('0x1b')][_0x3b98('0x1c')]===undefined?!![]:![]:!![]})[_0x3b98('0x1d')](function(_0x2b0b34){logger['info'](_0x3b98('0x17'),_0x472260);logger['debug']('CreateWhatsappMessage',_0x472260,JSON['stringify'](_0x2b0b34));_0x6651ac(_0x2b0b34);})[_0x3b98('0x16')](function(_0x4d944e){logger[_0x3b98('0x11')]('CreateWhatsappMessage',_0x4d944e[_0x3b98('0x13')],_0x472260);_0x46d6bf(_0x345d9b['error'](0x1f4,_0x4d944e['message']));});});}; \ No newline at end of file +var _0x6098=['redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6098,0x197));var _0x8609=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x6098[_0x5c4e16];return _0x36044a;};'use strict';var _=require(_0x8609('0x0'));var util=require(_0x8609('0x1'));var moment=require(_0x8609('0x2'));var BPromise=require('bluebird');var rs=require(_0x8609('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8609('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8609('0x5'));var config=require(_0x8609('0x6'));var jayson=require(_0x8609('0x7'));var client=jayson[_0x8609('0x8')]['http']({'port':0x232a});config[_0x8609('0x9')]=_[_0x8609('0xa')](config[_0x8609('0x9')],{'host':_0x8609('0xb'),'port':0x18eb});var socket=require(_0x8609('0xc'))(new Redis(config[_0x8609('0x9')]));require(_0x8609('0xd'))[_0x8609('0xe')](socket);function respondWithRpcPromise(_0x568687,_0x50597f,_0x42bed1){return new BPromise(function(_0x90ed6c,_0x118c3b){return client[_0x8609('0xf')](_0x568687,_0x42bed1)[_0x8609('0x10')](function(_0x382242){logger[_0x8609('0x11')](_0x8609('0x12'),_0x50597f,_0x8609('0x13'));logger[_0x8609('0x14')](_0x8609('0x15'),_0x50597f,_0x8609('0x13'),JSON[_0x8609('0x16')](_0x382242));if(_0x382242[_0x8609('0x17')]){if(_0x382242['error'][_0x8609('0x18')]===0x1f4){logger[_0x8609('0x17')](_0x8609('0x12'),_0x50597f,_0x382242[_0x8609('0x17')][_0x8609('0x19')]);return _0x118c3b(_0x382242[_0x8609('0x17')][_0x8609('0x19')]);}logger[_0x8609('0x17')](_0x8609('0x12'),_0x50597f,_0x382242[_0x8609('0x17')][_0x8609('0x19')]);return _0x90ed6c(_0x382242[_0x8609('0x17')][_0x8609('0x19')]);}else{logger[_0x8609('0x11')](_0x8609('0x12'),_0x50597f,_0x8609('0x13'));_0x90ed6c(_0x382242[_0x8609('0x1a')][_0x8609('0x19')]);}})[_0x8609('0x1b')](function(_0x2d9df1){logger[_0x8609('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x50597f,_0x2d9df1);_0x118c3b(_0x2d9df1);});});}exports[_0x8609('0x1c')]=function(_0x3c8895){var _0x1d2836=this;return new Promise(function(_0x5ba91a,_0x1b435b){return db[_0x8609('0x1d')][_0x8609('0x1e')](_0x3c8895['body'],{'raw':_0x3c8895[_0x8609('0x1f')]?_0x3c8895[_0x8609('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x8609('0x10')](function(_0x16eec3){logger['info'](_0x8609('0x1c'),_0x3c8895);logger[_0x8609('0x14')]('CreateWhatsappMessage',_0x3c8895,JSON[_0x8609('0x16')](_0x16eec3));_0x5ba91a(_0x16eec3);})['catch'](function(_0x2382fe){logger[_0x8609('0x17')]('CreateWhatsappMessage',_0x2382fe[_0x8609('0x19')],_0x3c8895);_0x1b435b(_0x1d2836['error'](0x1f4,_0x2382fe[_0x8609('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 7eb8243..0b7ed20 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 _0xc26b=['remove','update','emit','removeListener','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x3199cc,_0x59d2a2){var _0x21c2e8=function(_0x3039a6){while(--_0x3039a6){_0x3199cc['push'](_0x3199cc['shift']());}};_0x21c2e8(++_0x59d2a2);}(_0xc26b,0x1ee));var _0xbc26=function(_0x18d5dc,_0x999e75){_0x18d5dc=_0x18d5dc-0x0;var _0x154d6f=_0xc26b[_0x18d5dc];return _0x154d6f;};'use strict';var WhatsappMessageEvents=require(_0xbc26('0x0'));var events=[_0xbc26('0x1'),_0xbc26('0x2'),_0xbc26('0x3')];function createListener(_0x39a496,_0x231d29){return function(_0x518f91){_0x231d29[_0xbc26('0x4')](_0x39a496,_0x518f91);};}function removeListener(_0x17617c,_0xc19d4f){return function(){WhatsappMessageEvents[_0xbc26('0x5')](_0x17617c,_0xc19d4f);};}exports['register']=function(_0x86489d){for(var _0x1dd6e4=0x0,_0x2bb97a=events[_0xbc26('0x6')];_0x1dd6e4<_0x2bb97a;_0x1dd6e4++){var _0x4f72f4=events[_0x1dd6e4];var _0x3b1c7b=createListener(_0xbc26('0x7')+_0x4f72f4,_0x86489d);WhatsappMessageEvents['on'](_0x4f72f4,_0x3b1c7b);}}; \ No newline at end of file +var _0x824d=['length','save','remove','update','removeListener'];(function(_0x31a655,_0x581842){var _0x361094=function(_0x2529bc){while(--_0x2529bc){_0x31a655['push'](_0x31a655['shift']());}};_0x361094(++_0x581842);}(_0x824d,0xd3));var _0xd824=function(_0x422abc,_0x4a113c){_0x422abc=_0x422abc-0x0;var _0x475987=_0x824d[_0x422abc];return _0x475987;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xd824('0x0'),_0xd824('0x1'),_0xd824('0x2')];function createListener(_0x49eeaa,_0xf048b8){return function(_0x286972){_0xf048b8['emit'](_0x49eeaa,_0x286972);};}function removeListener(_0x1e5709,_0x463f91){return function(){WhatsappMessageEvents[_0xd824('0x3')](_0x1e5709,_0x463f91);};}exports['register']=function(_0x53e89c){for(var _0x4f7052=0x0,_0x41a77d=events[_0xd824('0x4')];_0x4f7052<_0x41a77d;_0x4f7052++){var _0x58664f=events[_0x4f7052];var _0x2a1151=createListener('whatsappMessage:'+_0x58664f,_0x53e89c);WhatsappMessageEvents['on'](_0x58664f,_0x2a1151);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 299d4a7..f4dc6bf 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 _0xb32f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id/members','getMembers','getTeams','/:id/users','post','create','/:id/teams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','fs-extra'];(function(_0x45de39,_0x2afe0d){var _0x23d3fa=function(_0x1f12eb){while(--_0x1f12eb){_0x45de39['push'](_0x45de39['shift']());}};_0x23d3fa(++_0x2afe0d);}(_0xb32f,0x14c));var _0xfb32=function(_0x153e3e,_0x17c73a){_0x153e3e=_0x153e3e-0x0;var _0x59c1a8=_0xb32f[_0x153e3e];return _0x59c1a8;};'use strict';var multer=require(_0xfb32('0x0'));var util=require('util');var path=require(_0xfb32('0x1'));var timeout=require('connect-timeout');var express=require(_0xfb32('0x2'));var router=express['Router']();var fs_extra=require(_0xfb32('0x3'));var auth=require(_0xfb32('0x4'));var interaction=require(_0xfb32('0x5'));var config=require(_0xfb32('0x6'));var controller=require(_0xfb32('0x7'));router[_0xfb32('0x8')]('/',auth[_0xfb32('0x9')](),controller['index']);router[_0xfb32('0x8')](_0xfb32('0xa'),auth[_0xfb32('0x9')](),controller[_0xfb32('0xb')]);router['get']('/:id',auth[_0xfb32('0x9')](),controller['show']);router['get'](_0xfb32('0xc'),auth[_0xfb32('0x9')](),controller[_0xfb32('0xd')]);router[_0xfb32('0x8')]('/:id/teams',auth[_0xfb32('0x9')](),controller[_0xfb32('0xe')]);router[_0xfb32('0x8')](_0xfb32('0xf'),auth[_0xfb32('0x9')](),controller['getAgents']);router[_0xfb32('0x10')]('/',auth[_0xfb32('0x9')](),controller[_0xfb32('0x11')]);router[_0xfb32('0x10')](_0xfb32('0x12'),auth[_0xfb32('0x9')](),controller['addTeams']);router['post'](_0xfb32('0xf'),auth[_0xfb32('0x9')](),controller[_0xfb32('0x13')]);router[_0xfb32('0x14')](_0xfb32('0x15'),auth[_0xfb32('0x9')](),controller[_0xfb32('0x16')]);router[_0xfb32('0x17')]('/:id',auth[_0xfb32('0x9')](),controller[_0xfb32('0x18')]);router[_0xfb32('0x17')](_0xfb32('0x12'),auth['isAuthenticated'](),controller[_0xfb32('0x19')]);router[_0xfb32('0x17')](_0xfb32('0xf'),auth[_0xfb32('0x9')](),controller[_0xfb32('0x1a')]);module[_0xfb32('0x1b')]=router; \ No newline at end of file +var _0xc212=['post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','index','get','/describe','isAuthenticated','show','/:id/members','/:id/teams','getTeams','getAgents'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xc212,0x1ad));var _0x2c21=function(_0x66e38f,_0x33c677){_0x66e38f=_0x66e38f-0x0;var _0x8f6d31=_0xc212[_0x66e38f];return _0x8f6d31;};'use strict';var multer=require(_0x2c21('0x0'));var util=require(_0x2c21('0x1'));var path=require(_0x2c21('0x2'));var timeout=require(_0x2c21('0x3'));var express=require('express');var router=express[_0x2c21('0x4')]();var fs_extra=require(_0x2c21('0x5'));var auth=require(_0x2c21('0x6'));var interaction=require(_0x2c21('0x7'));var config=require(_0x2c21('0x8'));var controller=require(_0x2c21('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2c21('0xa')]);router[_0x2c21('0xb')](_0x2c21('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x2c21('0xb')]('/:id',auth[_0x2c21('0xd')](),controller[_0x2c21('0xe')]);router[_0x2c21('0xb')](_0x2c21('0xf'),auth[_0x2c21('0xd')](),controller['getMembers']);router[_0x2c21('0xb')](_0x2c21('0x10'),auth[_0x2c21('0xd')](),controller[_0x2c21('0x11')]);router[_0x2c21('0xb')]('/:id/users',auth[_0x2c21('0xd')](),controller[_0x2c21('0x12')]);router[_0x2c21('0x13')]('/',auth[_0x2c21('0xd')](),controller[_0x2c21('0x14')]);router['post'](_0x2c21('0x10'),auth[_0x2c21('0xd')](),controller[_0x2c21('0x15')]);router[_0x2c21('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c21('0x16')]);router[_0x2c21('0x17')]('/:id',auth[_0x2c21('0xd')](),controller[_0x2c21('0x18')]);router[_0x2c21('0x19')]('/:id',auth[_0x2c21('0xd')](),controller[_0x2c21('0x1a')]);router[_0x2c21('0x19')]('/:id/teams',auth[_0x2c21('0xd')](),controller['removeTeams']);router[_0x2c21('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c21('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 562bc91..4184b03 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 _0x4899=['beepall','roundrobin','sequelize','STRING','INTEGER','rrmemory'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x4899,0x74));var _0x9489=function(_0x2dbf77,_0x2757ad){_0x2dbf77=_0x2dbf77-0x0;var _0x1546b8=_0x4899[_0x2dbf77];return _0x1546b8;};'use strict';var Sequelize=require(_0x9489('0x0'));module['exports']={'name':{'type':Sequelize[_0x9489('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9489('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9489('0x3'),_0x9489('0x4'),_0x9489('0x5'))},'description':{'type':Sequelize[_0x9489('0x1')]}}; \ No newline at end of file +var _0xdeb7=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xdeb7,0x77));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x7deb('0x0'));module[_0x7deb('0x1')]={'name':{'type':Sequelize[_0x7deb('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7deb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7deb('0x4')](_0x7deb('0x5'),_0x7deb('0x6'),_0x7deb('0x7'))},'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 6ce1a1b..0651847 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 _0x2dd8=['socket.io-emitter','./whatsappQueue.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','map','WhatsappQueue','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','find','describe','getMembers','findOne','UserWhatsappQueue','rawAttributes','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','createdAt','rows','format','%s/%s','SIP','updatedAt','Team','order','getTeams','addTeams','online','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeTeams','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost'];(function(_0x2dc4da,_0x4b3fa3){var _0x4ce05f=function(_0x3ccc2e){while(--_0x3ccc2e){_0x2dc4da['push'](_0x2dc4da['shift']());}};_0x4ce05f(++_0x4b3fa3);}(_0x2dd8,0x7b));var _0x82dd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dd8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x82dd('0x0'));var rimraf=require(_0x82dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x82dd('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x82dd('0x3'));var path=require(_0x82dd('0x4'));var sox=require(_0x82dd('0x5'));var csv=require('to-csv');var ejs=require(_0x82dd('0x6'));var fs=require('fs');var fs_extra=require(_0x82dd('0x7'));var _=require('lodash');var squel=require(_0x82dd('0x8'));var crypto=require(_0x82dd('0x9'));var jsforce=require(_0x82dd('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x82dd('0xb'));var querystring=require(_0x82dd('0xc'));var Papa=require(_0x82dd('0xd'));var Redis=require(_0x82dd('0xe'));var authService=require(_0x82dd('0xf'));var qs=require(_0x82dd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82dd('0x11'));var logger=require(_0x82dd('0x12'))(_0x82dd('0x13'));var utils=require(_0x82dd('0x14'));var config=require(_0x82dd('0x15'));var licenseUtil=require(_0x82dd('0x16'));var db=require('../../mysqldb')['db'];config[_0x82dd('0x17')]=_[_0x82dd('0x18')](config[_0x82dd('0x17')],{'host':_0x82dd('0x19'),'port':0x18eb});var socket=require(_0x82dd('0x1a'))(new Redis(config[_0x82dd('0x17')]));require(_0x82dd('0x1b'))[_0x82dd('0x1c')](socket);function respondWithStatusCode(_0x33802d,_0x52c4c2){_0x52c4c2=_0x52c4c2||0xcc;return function(_0x1dcede){if(_0x1dcede){return _0x33802d['sendStatus'](_0x52c4c2);}return _0x33802d[_0x82dd('0x1d')](_0x52c4c2)[_0x82dd('0x1e')]();};}function respondWithResult(_0x312a3a,_0x17c9d3){_0x17c9d3=_0x17c9d3||0xc8;return function(_0x3a667e){if(_0x3a667e){return _0x312a3a[_0x82dd('0x1d')](_0x17c9d3)[_0x82dd('0x1f')](_0x3a667e);}};}function respondWithFilteredResult(_0x5d2bed,_0x4bc5f0){return function(_0xf3ed82){if(_0xf3ed82){var _0x41a080=typeof _0x4bc5f0[_0x82dd('0x20')]===_0x82dd('0x21')&&typeof _0x4bc5f0[_0x82dd('0x22')]===_0x82dd('0x21');var _0x2a9d69=_0xf3ed82[_0x82dd('0x23')];var _0x2bb789=_0x41a080?0x0:_0x4bc5f0[_0x82dd('0x20')];var _0x4628c1=_0x41a080?_0xf3ed82[_0x82dd('0x23')]:_0x4bc5f0[_0x82dd('0x20')]+_0x4bc5f0[_0x82dd('0x22')];var _0x33a137;if(_0x4628c1>=_0x2a9d69){_0x4628c1=_0x2a9d69;_0x33a137=0xc8;}else{_0x33a137=0xce;}_0x5d2bed[_0x82dd('0x1d')](_0x33a137);return _0x5d2bed[_0x82dd('0x24')]('Content-Range',_0x2bb789+'-'+_0x4628c1+'/'+_0x2a9d69)['json'](_0xf3ed82);}return null;};}function patchUpdates(_0x2e547a){return function(_0x682745){try{jsonpatch[_0x82dd('0x25')](_0x682745,_0x2e547a,!![]);}catch(_0x34adac){return BPromise[_0x82dd('0x26')](_0x34adac);}return _0x682745[_0x82dd('0x27')]();};}function saveUpdates(_0x473a3a,_0x46c63b){return function(_0x5167bc){if(_0x5167bc){return _0x5167bc[_0x82dd('0x28')](_0x473a3a)[_0x82dd('0x29')](function(_0x5cb5bb){return _0x5cb5bb;});}return null;};}function removeEntity(_0x5b0984,_0xcfd9f3){return function(_0x5e3c02){if(_0x5e3c02){return _0x5e3c02['destroy']()[_0x82dd('0x29')](function(){var _0x8f26bd=_0x5e3c02[_0x82dd('0x2a')]({'plain':!![]});var _0x2d0912=_0x82dd('0x2b');return db[_0x82dd('0x2c')]['destroy']({'where':{'type':_0x2d0912,'resourceId':_0x8f26bd['id']}})['then'](function(){return _0x5e3c02;});})[_0x82dd('0x29')](function(){_0x5b0984[_0x82dd('0x1d')](0xcc)[_0x82dd('0x1e')]();});}};}function handleEntityNotFound(_0x56e9f5,_0x21d36d){return function(_0x477c9c){if(!_0x477c9c){_0x56e9f5[_0x82dd('0x2d')](0x194);}return _0x477c9c;};}function handleError(_0x26a18f,_0xabaa30){_0xabaa30=_0xabaa30||0x1f4;return function(_0x4ecc53){logger[_0x82dd('0x2e')](_0x4ecc53[_0x82dd('0x2f')]);if(_0x4ecc53[_0x82dd('0x30')]){delete _0x4ecc53['name'];}_0x26a18f[_0x82dd('0x1d')](_0xabaa30)[_0x82dd('0x31')](_0x4ecc53);};}exports['index']=function(_0x3935e3,_0x91c2ee){var _0x4f3ab2={},_0x5d8ef7={},_0x588745={'count':0x0,'rows':[]};var _0x3eba76=_[_0x82dd('0x32')](db[_0x82dd('0x33')]['rawAttributes'],function(_0x3b6f33){return{'name':_0x3b6f33[_0x82dd('0x34')],'type':_0x3b6f33['type']['key']};});_0x5d8ef7[_0x82dd('0x35')]=_[_0x82dd('0x32')](_0x3eba76,'name');_0x5d8ef7['query']=_[_0x82dd('0x36')](_0x3935e3[_0x82dd('0x37')]);_0x5d8ef7[_0x82dd('0x38')]=_['intersection'](_0x5d8ef7[_0x82dd('0x35')],_0x5d8ef7['query']);_0x4f3ab2['attributes']=_[_0x82dd('0x39')](_0x5d8ef7[_0x82dd('0x35')],qs[_0x82dd('0x3a')](_0x3935e3[_0x82dd('0x37')][_0x82dd('0x3a')]));_0x4f3ab2['attributes']=_0x4f3ab2[_0x82dd('0x3b')][_0x82dd('0x3c')]?_0x4f3ab2[_0x82dd('0x3b')]:_0x5d8ef7[_0x82dd('0x35')];if(!_0x3935e3[_0x82dd('0x37')][_0x82dd('0x3d')](_0x82dd('0x3e'))){_0x4f3ab2[_0x82dd('0x22')]=qs['limit'](_0x3935e3[_0x82dd('0x37')][_0x82dd('0x22')]);_0x4f3ab2[_0x82dd('0x20')]=qs[_0x82dd('0x20')](_0x3935e3[_0x82dd('0x37')][_0x82dd('0x20')]);}_0x4f3ab2['order']=qs[_0x82dd('0x3f')](_0x3935e3[_0x82dd('0x37')][_0x82dd('0x3f')]);_0x4f3ab2[_0x82dd('0x40')]=qs['filters'](_[_0x82dd('0x41')](_0x3935e3['query'],_0x5d8ef7[_0x82dd('0x38')]),_0x3eba76);if(_0x3935e3['query'][_0x82dd('0x42')]){_0x4f3ab2[_0x82dd('0x40')]=_['merge'](_0x4f3ab2[_0x82dd('0x40')],{'$or':_['map'](_0x3eba76,function(_0x2cde7d){if(_0x2cde7d[_0x82dd('0x43')]!==_0x82dd('0x44')){var _0x1ee09e={};_0x1ee09e[_0x2cde7d[_0x82dd('0x30')]]={'$like':'%'+_0x3935e3[_0x82dd('0x37')][_0x82dd('0x42')]+'%'};return _0x1ee09e;}})});}_0x4f3ab2=_[_0x82dd('0x45')]({},_0x4f3ab2,_0x3935e3['options']);var _0x18cd98={'where':_0x4f3ab2[_0x82dd('0x40')]};return db[_0x82dd('0x33')][_0x82dd('0x23')](_0x18cd98)['then'](function(_0x4648b4){_0x588745[_0x82dd('0x23')]=_0x4648b4;if(_0x3935e3[_0x82dd('0x37')][_0x82dd('0x46')]){_0x4f3ab2[_0x82dd('0x47')]=[{'all':!![]}];}return db[_0x82dd('0x33')][_0x82dd('0x48')](_0x4f3ab2);})[_0x82dd('0x29')](function(_0x1f6255){_0x588745['rows']=_0x1f6255;return _0x588745;})['then'](respondWithFilteredResult(_0x91c2ee,_0x4f3ab2))[_0x82dd('0x49')](handleError(_0x91c2ee,null));};exports[_0x82dd('0x4a')]=function(_0x2bc87f,_0x13d030){var _0x4d674b={'raw':!![],'where':{'id':_0x2bc87f[_0x82dd('0x4b')]['id']}},_0x2e6f72={};_0x2e6f72[_0x82dd('0x35')]=_[_0x82dd('0x36')](db[_0x82dd('0x33')]['rawAttributes']);_0x2e6f72[_0x82dd('0x37')]=_[_0x82dd('0x36')](_0x2bc87f[_0x82dd('0x37')]);_0x2e6f72[_0x82dd('0x38')]=_['intersection'](_0x2e6f72['model'],_0x2e6f72[_0x82dd('0x37')]);_0x4d674b[_0x82dd('0x3b')]=_[_0x82dd('0x39')](_0x2e6f72[_0x82dd('0x35')],qs[_0x82dd('0x3a')](_0x2bc87f[_0x82dd('0x37')][_0x82dd('0x3a')]));_0x4d674b[_0x82dd('0x3b')]=_0x4d674b[_0x82dd('0x3b')][_0x82dd('0x3c')]?_0x4d674b[_0x82dd('0x3b')]:_0x2e6f72[_0x82dd('0x35')];if(_0x2bc87f[_0x82dd('0x37')][_0x82dd('0x46')]){_0x4d674b[_0x82dd('0x47')]=[{'all':!![]}];}_0x4d674b=_['merge']({},_0x4d674b,_0x2bc87f[_0x82dd('0x4c')]);return db[_0x82dd('0x33')]['find'](_0x4d674b)[_0x82dd('0x29')](handleEntityNotFound(_0x13d030,null))['then'](respondWithResult(_0x13d030,null))[_0x82dd('0x49')](handleError(_0x13d030,null));};exports['create']=function(_0x5593ee,_0x2b84f4){return db['WhatsappQueue'][_0x82dd('0x4d')](_0x5593ee['body'],{})['then'](function(_0x553eb8){var _0x433870=_0x5593ee[_0x82dd('0x4e')][_0x82dd('0x2a')]({'plain':!![]});if(!_0x433870)throw new Error(_0x82dd('0x4f'));if(_0x433870[_0x82dd('0x50')]===_0x82dd('0x4e')){var _0x45fe09=_0x553eb8['get']({'plain':!![]});var _0x55955c=_0x82dd('0x2b');return db[_0x82dd('0x51')]['find']({'where':{'name':_0x55955c,'userProfileId':_0x433870[_0x82dd('0x52')]},'raw':!![]})[_0x82dd('0x29')](function(_0x331ef4){if(_0x331ef4&&_0x331ef4[_0x82dd('0x53')]===0x0){return db['UserProfileResource'][_0x82dd('0x4d')]({'name':_0x45fe09['name'],'resourceId':_0x45fe09['id'],'type':_0x331ef4[_0x82dd('0x30')],'sectionId':_0x331ef4['id']},{})['then'](function(){return _0x553eb8;});}else{return _0x553eb8;}})[_0x82dd('0x49')](function(_0x358581){logger[_0x82dd('0x2e')](_0x82dd('0x54'),_0x358581);throw _0x358581;});}return _0x553eb8;})[_0x82dd('0x29')](respondWithResult(_0x2b84f4,0xc9))['catch'](handleError(_0x2b84f4,null));};exports[_0x82dd('0x28')]=function(_0x3a4ea7,_0xd93af3){if(_0x3a4ea7['body']['id']){delete _0x3a4ea7[_0x82dd('0x55')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x3a4ea7[_0x82dd('0x4b')]['id']}})[_0x82dd('0x29')](handleEntityNotFound(_0xd93af3,null))[_0x82dd('0x29')](saveUpdates(_0x3a4ea7['body'],null))[_0x82dd('0x29')](respondWithResult(_0xd93af3,null))[_0x82dd('0x49')](handleError(_0xd93af3,null));};exports[_0x82dd('0x56')]=function(_0x1a75a9,_0x3794bf){return db[_0x82dd('0x33')][_0x82dd('0x57')]({'where':{'id':_0x1a75a9[_0x82dd('0x4b')]['id']}})[_0x82dd('0x29')](handleEntityNotFound(_0x3794bf,null))[_0x82dd('0x29')](removeEntity(_0x3794bf,null))[_0x82dd('0x49')](handleError(_0x3794bf,null));};exports[_0x82dd('0x58')]=function(_0x1e0226,_0x1ad989){return db['WhatsappQueue'][_0x82dd('0x58')]()[_0x82dd('0x29')](respondWithResult(_0x1ad989,null))[_0x82dd('0x49')](handleError(_0x1ad989,null));};exports[_0x82dd('0x59')]=function(_0x2d59e5,_0x1d29c4,_0x4b71e7){var _0x199da2={'raw':!![],'where':{}},_0x1abe7c={},_0x200a50;return db['WhatsappQueue'][_0x82dd('0x5a')]({'where':{'id':_0x2d59e5[_0x82dd('0x4b')]['id']}})[_0x82dd('0x29')](handleEntityNotFound(_0x1d29c4,null))['then'](function(_0x219c06){if(_0x219c06){_0x200a50=_0x219c06['get']({'plain':!![]});_0x1abe7c[_0x82dd('0x35')]=_[_0x82dd('0x36')](db[_0x82dd('0x5b')][_0x82dd('0x5c')]);_0x1abe7c['query']=_[_0x82dd('0x36')](_0x2d59e5[_0x82dd('0x37')]);_0x1abe7c[_0x82dd('0x38')]=_[_0x82dd('0x39')](_0x1abe7c[_0x82dd('0x35')],_0x1abe7c[_0x82dd('0x37')]);_0x199da2[_0x82dd('0x3b')]=_[_0x82dd('0x39')](_0x1abe7c[_0x82dd('0x35')],qs[_0x82dd('0x3a')](_0x2d59e5[_0x82dd('0x37')][_0x82dd('0x3a')]));_0x199da2['attributes']=_0x199da2[_0x82dd('0x3b')][_0x82dd('0x3c')]?_0x199da2[_0x82dd('0x3b')]:_0x1abe7c[_0x82dd('0x35')];if(!_0x2d59e5[_0x82dd('0x37')][_0x82dd('0x3d')](_0x82dd('0x3e'))){_0x199da2['limit']=qs[_0x82dd('0x22')](_0x2d59e5['query'][_0x82dd('0x22')]);_0x199da2[_0x82dd('0x20')]=qs[_0x82dd('0x20')](_0x2d59e5[_0x82dd('0x37')][_0x82dd('0x20')]);}_0x199da2['order']=qs[_0x82dd('0x3f')](_0x2d59e5['query'][_0x82dd('0x3f')]);_0x199da2['where']=qs[_0x82dd('0x38')](_[_0x82dd('0x41')](_0x2d59e5[_0x82dd('0x37')],_0x1abe7c[_0x82dd('0x38')]));_0x199da2[_0x82dd('0x40')][_0x82dd('0x5d')]=_0x219c06['id'];if(_0x2d59e5['query'][_0x82dd('0x42')]){_0x199da2[_0x82dd('0x40')]=_[_0x82dd('0x45')](_0x199da2[_0x82dd('0x40')],{'$or':_[_0x82dd('0x32')](_0x199da2['attributes'],function(_0x40836e){var _0x3c71b1={};_0x3c71b1[_0x40836e]={'$like':'%'+_0x2d59e5[_0x82dd('0x37')]['filter']+'%'};return _0x3c71b1;})});}_0x199da2=_[_0x82dd('0x45')]({},_0x199da2,_0x2d59e5[_0x82dd('0x4c')]);return db[_0x82dd('0x5b')]['findAll'](_0x199da2);}})[_0x82dd('0x29')](function(_0x57ebe2){if(_0x57ebe2){return db[_0x82dd('0x5e')][_0x82dd('0x5f')]({'where':{'id':_[_0x82dd('0x32')](_0x57ebe2,'UserId'),'role':_0x82dd('0x60')},'attributes':['id',_0x82dd('0x30'),_0x82dd('0x61'),'updatedAt',_0x82dd('0x62')]});}})[_0x82dd('0x29')](function(_0x345dd9){if(_0x345dd9){return{'count':_0x345dd9[_0x82dd('0x23')],'rows':_[_0x82dd('0x32')](_0x345dd9[_0x82dd('0x63')],function(_0x580a95){return{'membername':_0x580a95['name'],'UserId':_0x580a95['id'],'queue_name':_0x200a50[_0x82dd('0x30')],'WhatsappQueueId':_0x200a50['id'],'interface':util[_0x82dd('0x64')](_0x82dd('0x65'),_0x82dd('0x66'),_0x580a95[_0x82dd('0x30')]),'penalty':0x0,'paused':_0x580a95[_0x82dd('0x61')],'createdAt':_0x580a95['createdAt'],'updatedAt':_0x580a95[_0x82dd('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x82dd('0x29')](respondWithFilteredResult(_0x1d29c4,_0x199da2))[_0x82dd('0x49')](handleError(_0x1d29c4,null));};exports['getTeams']=function(_0x4e24c1,_0xecf6f0,_0x453da2){var _0x43b7da={};var _0x5e28a3={};var _0x2532bc;var _0xc70a8;return db[_0x82dd('0x33')][_0x82dd('0x5a')]({'where':{'id':_0x4e24c1[_0x82dd('0x4b')]['id']}})[_0x82dd('0x29')](handleEntityNotFound(_0xecf6f0,null))[_0x82dd('0x29')](function(_0x1072bb){if(_0x1072bb){_0x2532bc=_0x1072bb;_0x5e28a3[_0x82dd('0x35')]=_[_0x82dd('0x36')](db[_0x82dd('0x68')][_0x82dd('0x5c')]);_0x5e28a3[_0x82dd('0x37')]=_[_0x82dd('0x36')](_0x4e24c1[_0x82dd('0x37')]);_0x5e28a3['filters']=_[_0x82dd('0x39')](_0x5e28a3[_0x82dd('0x35')],_0x5e28a3[_0x82dd('0x37')]);_0x43b7da[_0x82dd('0x3b')]=_[_0x82dd('0x39')](_0x5e28a3[_0x82dd('0x35')],qs[_0x82dd('0x3a')](_0x4e24c1['query'][_0x82dd('0x3a')]));_0x43b7da[_0x82dd('0x3b')]=_0x43b7da[_0x82dd('0x3b')][_0x82dd('0x3c')]?_0x43b7da[_0x82dd('0x3b')]:_0x5e28a3[_0x82dd('0x35')];_0x43b7da[_0x82dd('0x69')]=qs[_0x82dd('0x3f')](_0x4e24c1['query'][_0x82dd('0x3f')]);_0x43b7da['where']=qs[_0x82dd('0x38')](_[_0x82dd('0x41')](_0x4e24c1[_0x82dd('0x37')],_0x5e28a3[_0x82dd('0x38')]));if(_0x4e24c1[_0x82dd('0x37')][_0x82dd('0x42')]){_0x43b7da['where']=_[_0x82dd('0x45')](_0x43b7da[_0x82dd('0x40')],{'$or':_[_0x82dd('0x32')](_0x43b7da[_0x82dd('0x3b')],function(_0x10ffc4){var _0x56b46e={};_0x56b46e[_0x10ffc4]={'$like':'%'+_0x4e24c1[_0x82dd('0x37')][_0x82dd('0x42')]+'%'};return _0x56b46e;})});}_0x43b7da=_[_0x82dd('0x45')]({},_0x43b7da,_0x4e24c1[_0x82dd('0x4c')]);return _0x2532bc['getTeams'](_0x43b7da);}})['then'](function(_0x9b6b01){if(_0x9b6b01){_0xc70a8=_0x9b6b01[_0x82dd('0x3c')];if(!_0x4e24c1['query']['hasOwnProperty'](_0x82dd('0x3e'))){_0x43b7da[_0x82dd('0x22')]=qs[_0x82dd('0x22')](_0x4e24c1[_0x82dd('0x37')]['limit']);_0x43b7da['offset']=qs[_0x82dd('0x20')](_0x4e24c1[_0x82dd('0x37')]['offset']);}return _0x2532bc[_0x82dd('0x6a')](_0x43b7da);}})[_0x82dd('0x29')](function(_0x4a32cd){if(_0x4a32cd){return _0x4a32cd?{'count':_0xc70a8,'rows':_0x4a32cd}:null;}})[_0x82dd('0x29')](respondWithResult(_0xecf6f0,null))[_0x82dd('0x49')](handleError(_0xecf6f0,null));};exports[_0x82dd('0x6b')]=function(_0x5248ed,_0x58e88f,_0x5bc6e1){var _0x1d16c7=_0x5248ed[_0x82dd('0x55')]['ids'];return db['Team'][_0x82dd('0x48')]({'where':{'id':_0x1d16c7},'attributes':['id'],'include':[{'model':db[_0x82dd('0x5e')],'as':'Agents','attributes':['id','name',_0x82dd('0x6c'),'voicePause',_0x82dd('0x6d')],'raw':!![]}]})['then'](function(_0x39efc8){if(_0x39efc8){var _0x2035f5=_[_0x82dd('0x6e')](_0x39efc8,function(_0x25bedc){var _0x246e51=_0x25bedc[_0x82dd('0x2a')]({'plain':!![]});return _0x246e51[_0x82dd('0x6f')];});return db[_0x82dd('0x33')]['find']({'where':{'id':_0x5248ed[_0x82dd('0x4b')]['id']}})[_0x82dd('0x29')](function(_0x16d7c7){return db[_0x82dd('0x70')]['transaction'](function(_0x5679a3){return _0x16d7c7['addTeams'](_0x1d16c7,{'transaction':_0x5679a3})[_0x82dd('0x29')](function(){return BPromise[_0x82dd('0x71')](_0x2035f5,function(_0x3c089f){return db[_0x82dd('0x5b')][_0x82dd('0x72')]({'where':{'UserId':_0x3c089f['id'],'WhatsappQueueId':_0x5248ed[_0x82dd('0x4b')]['id']},'transaction':_0x5679a3});});})['then'](function(){_0x2035f5[_0x82dd('0x73')](function(_0x8e131f){socket[_0x82dd('0x74')](_0x82dd('0x75'),{'UserId':_0x8e131f['id'],'WhatsappQueueId':_0x16d7c7['id']});});});});});}})['then'](respondWithStatusCode(_0x58e88f,null))[_0x82dd('0x49')](handleError(_0x58e88f,null));};exports['removeTeams']=function(_0x4bdfee,_0xf21692,_0x3c2144){return db[_0x82dd('0x68')][_0x82dd('0x48')]({'where':{'id':_0x4bdfee['query'][_0x82dd('0x76')]},'attributes':['id'],'include':[{'model':db[_0x82dd('0x5e')],'as':_0x82dd('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x82dd('0x29')](handleEntityNotFound(_0xf21692,null))[_0x82dd('0x29')](function(_0x5ee1c4){var _0x141aaa=_[_0x82dd('0x32')](_0x5ee1c4,'id');var _0x15ee08=[];var _0x4b2eac=[];var _0x39adbd=squel[_0x82dd('0x77')]();_0x39adbd[_0x82dd('0x78')](_0x82dd('0x79'))[_0x82dd('0x7a')](_0x82dd('0x7b'),'tq')[_0x82dd('0x7c')]('user_has_teams','ut',_0x82dd('0x7d'))['where'](_0x82dd('0x7e'),_0x4bdfee[_0x82dd('0x4b')]['id']);for(var _0x3ef416=0x0;_0x3ef416<_0x5ee1c4[_0x82dd('0x3c')];_0x3ef416+=0x1){let _0x33fb63=_0x5ee1c4[_0x3ef416];for(var _0xf56d9=0x0;_0xf56d9<_0x33fb63['Agents'][_0x82dd('0x3c')];_0xf56d9+=0x1){let _0x39e837=_0x33fb63[_0x82dd('0x6f')][_0xf56d9];var _0x51bfb4=_0x39adbd[_0x82dd('0x7f')]();_0x51bfb4[_0x82dd('0x40')](_0x82dd('0x80'),_0x39e837['id']);_0x4b2eac[_0x82dd('0x81')](db['sequelize'][_0x82dd('0x37')](_0x51bfb4[_0x82dd('0x82')](),{'type':db[_0x82dd('0x70')][_0x82dd('0x83')][_0x82dd('0x84')]})[_0x82dd('0x29')](function(_0x253b04){if(_0x253b04['length']===0x1){return _0x39e837['id'];}else{var _0x5046f4=_[_0x82dd('0x85')](_[_0x82dd('0x32')](_0x253b04,_0x82dd('0x86')),function(_0x1dd8a8){return _[_0x82dd('0x87')](_0x141aaa,_0x1dd8a8);});if(_0x5046f4){return _0x39e837['id'];}}}));}}return BPromise[_0x82dd('0x88')](_0x4b2eac)['then'](function(_0x2358d9){_0x15ee08=_(_0x15ee08)[_0x82dd('0x89')](_0x2358d9)[_0x82dd('0x8a')]()[_0x82dd('0x8b')]();return db[_0x82dd('0x33')][_0x82dd('0x57')]({'where':{'id':_0x4bdfee['params']['id']}})[_0x82dd('0x29')](function(_0x2ac187){return db['sequelize'][_0x82dd('0x8c')](function(_0x300908){return _0x2ac187[_0x82dd('0x8d')](_0x4bdfee[_0x82dd('0x37')][_0x82dd('0x76')],{'transaction':_0x300908})[_0x82dd('0x29')](function(){if(!_['isEmpty'](_0x15ee08)){return _0x2ac187[_0x82dd('0x8e')](_0x15ee08,{'transaction':_0x300908});}})[_0x82dd('0x29')](function(){_0x15ee08[_0x82dd('0x73')](function(_0x19c4b6){socket[_0x82dd('0x74')](_0x82dd('0x8f'),{'UserId':_0x19c4b6,'WhatsappQueueId':_0x2ac187['id']});});});});});});})[_0x82dd('0x29')](respondWithStatusCode(_0xf21692,null))[_0x82dd('0x49')](handleError(_0xf21692,null));};exports[_0x82dd('0x90')]=function(_0x47b3b6,_0x310cfa,_0x27b497){return db[_0x82dd('0x33')][_0x82dd('0x57')]({'where':{'id':_0x47b3b6['params']['id']}})['then'](handleEntityNotFound(_0x310cfa,null))['then'](function(_0xaab732){if(_0xaab732){return _0xaab732[_0x82dd('0x90')](_0x47b3b6['body'][_0x82dd('0x76')],_[_0x82dd('0x91')](_0x47b3b6[_0x82dd('0x55')],[_0x82dd('0x76'),'id'])||{})[_0x82dd('0x92')](function(_0x5d7e0f){for(var _0x3cb393=0x0;_0x3cb393<_0x47b3b6[_0x82dd('0x55')]['ids'][_0x82dd('0x3c')];_0x3cb393+=0x1){socket[_0x82dd('0x74')](_0x82dd('0x75'),{'UserId':Number(_0x47b3b6[_0x82dd('0x55')]['ids'][_0x3cb393]),'WhatsappQueueId':Number(_0x47b3b6['params']['id'])});}return _0x5d7e0f;});}})['then'](respondWithResult(_0x310cfa,null))['catch'](handleError(_0x310cfa,null));};exports[_0x82dd('0x8e')]=function(_0x42bf3a,_0x196785,_0x13b1f3){return db['WhatsappQueue']['find']({'where':{'id':_0x42bf3a[_0x82dd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x196785,null))[_0x82dd('0x29')](function(_0x288712){if(_0x288712){return _0x288712[_0x82dd('0x8e')](_0x42bf3a['query']['ids'])['then'](function(){if(_[_0x82dd('0x93')](_0x42bf3a[_0x82dd('0x37')][_0x82dd('0x76')])){for(var _0x4d62e8=0x0;_0x4d62e8<_0x42bf3a[_0x82dd('0x37')][_0x82dd('0x76')][_0x82dd('0x3c')];_0x4d62e8+=0x1){socket[_0x82dd('0x74')]('userWhatsappQueue:remove',{'UserId':Number(_0x42bf3a['query'][_0x82dd('0x76')][_0x4d62e8]),'WhatsappQueueId':Number(_0x42bf3a[_0x82dd('0x4b')]['id'])});}}else{socket['emit'](_0x82dd('0x8f'),{'UserId':Number(_0x42bf3a['query'][_0x82dd('0x76')]),'WhatsappQueueId':Number(_0x42bf3a[_0x82dd('0x4b')]['id'])});}});}})[_0x82dd('0x29')](respondWithStatusCode(_0x196785,null))[_0x82dd('0x49')](handleError(_0x196785,null));};exports[_0x82dd('0x94')]=function(_0x5f02cf,_0x5ab27c,_0x41ffc4){var _0xbef541={};var _0x163bc0={};var _0x195ce0;var _0x1bd40b;return db[_0x82dd('0x33')][_0x82dd('0x5a')]({'where':{'id':_0x5f02cf[_0x82dd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5ab27c,null))[_0x82dd('0x29')](function(_0x28d048){if(_0x28d048){_0x195ce0=_0x28d048;_0x163bc0[_0x82dd('0x35')]=_[_0x82dd('0x36')](db[_0x82dd('0x5e')]['rawAttributes']);_0x163bc0[_0x82dd('0x37')]=_[_0x82dd('0x36')](_0x5f02cf[_0x82dd('0x37')]);_0x163bc0[_0x82dd('0x38')]=_[_0x82dd('0x39')](_0x163bc0[_0x82dd('0x35')],_0x163bc0['query']);_0xbef541[_0x82dd('0x3b')]=_[_0x82dd('0x39')](_0x163bc0[_0x82dd('0x35')],qs['fields'](_0x5f02cf[_0x82dd('0x37')]['fields']));_0xbef541[_0x82dd('0x3b')]=_0xbef541[_0x82dd('0x3b')][_0x82dd('0x3c')]?_0xbef541['attributes']:_0x163bc0[_0x82dd('0x35')];_0xbef541[_0x82dd('0x69')]=qs[_0x82dd('0x3f')](_0x5f02cf[_0x82dd('0x37')]['sort']);_0xbef541['where']=qs[_0x82dd('0x38')](_['pick'](_0x5f02cf['query'],_0x163bc0['filters']));if(_0x5f02cf[_0x82dd('0x37')][_0x82dd('0x42')]){_0xbef541['where']=_[_0x82dd('0x45')](_0xbef541['where'],{'$or':_[_0x82dd('0x32')](_0xbef541[_0x82dd('0x3b')],function(_0x1e74dc){var _0x376f64={};_0x376f64[_0x1e74dc]={'$like':'%'+_0x5f02cf[_0x82dd('0x37')][_0x82dd('0x42')]+'%'};return _0x376f64;})});}_0xbef541=_[_0x82dd('0x45')]({},_0xbef541,_0x5f02cf[_0x82dd('0x4c')]);return _0x195ce0['getAgents'](_0xbef541);}})[_0x82dd('0x29')](function(_0x5a5320){if(_0x5a5320){_0x1bd40b=_0x5a5320[_0x82dd('0x3c')];if(!_0x5f02cf[_0x82dd('0x37')][_0x82dd('0x3d')](_0x82dd('0x3e'))){_0xbef541[_0x82dd('0x22')]=qs[_0x82dd('0x22')](_0x5f02cf[_0x82dd('0x37')][_0x82dd('0x22')]);_0xbef541[_0x82dd('0x20')]=qs['offset'](_0x5f02cf[_0x82dd('0x37')][_0x82dd('0x20')]);}return _0x195ce0[_0x82dd('0x94')](_0xbef541);}})[_0x82dd('0x29')](function(_0x41eb4b){if(_0x41eb4b){return _0x41eb4b?{'count':_0x1bd40b,'rows':_0x41eb4b}:null;}})[_0x82dd('0x29')](respondWithResult(_0x5ab27c,null))[_0x82dd('0x49')](handleError(_0x5ab27c,null));}; \ No newline at end of file +var _0x2d04=['WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','pick','WhatsappQueueId','map','merge','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','getAgents','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','role'];(function(_0x102914,_0x14a7fa){var _0x2dc143=function(_0x33a6b6){while(--_0x33a6b6){_0x102914['push'](_0x102914['shift']());}};_0x2dc143(++_0x14a7fa);}(_0x2d04,0xc3));var _0x42d0=function(_0x3bbf27,_0x189cf4){_0x3bbf27=_0x3bbf27-0x0;var _0xbe42fb=_0x2d04[_0x3bbf27];return _0xbe42fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x42d0('0x0'));var zipdir=require(_0x42d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x42d0('0x2'));var moment=require(_0x42d0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x42d0('0x4'));var path=require('path');var sox=require(_0x42d0('0x5'));var csv=require(_0x42d0('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x42d0('0x7'));var _=require(_0x42d0('0x8'));var squel=require(_0x42d0('0x9'));var crypto=require('crypto');var jsforce=require(_0x42d0('0xa'));var deskjs=require(_0x42d0('0xb'));var toCsv=require(_0x42d0('0x6'));var querystring=require('querystring');var Papa=require(_0x42d0('0xc'));var Redis=require(_0x42d0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x42d0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x42d0('0xf'));var logger=require(_0x42d0('0x10'))(_0x42d0('0x11'));var utils=require('../../config/utils');var config=require(_0x42d0('0x12'));var licenseUtil=require(_0x42d0('0x13'));var db=require(_0x42d0('0x14'))['db'];config[_0x42d0('0x15')]=_[_0x42d0('0x16')](config[_0x42d0('0x15')],{'host':_0x42d0('0x17'),'port':0x18eb});var socket=require(_0x42d0('0x18'))(new Redis(config[_0x42d0('0x15')]));require(_0x42d0('0x19'))[_0x42d0('0x1a')](socket);function respondWithStatusCode(_0x1553b7,_0x5ec7bf){_0x5ec7bf=_0x5ec7bf||0xcc;return function(_0x490da4){if(_0x490da4){return _0x1553b7[_0x42d0('0x1b')](_0x5ec7bf);}return _0x1553b7[_0x42d0('0x1c')](_0x5ec7bf)['end']();};}function respondWithResult(_0x51597b,_0x1a4c29){_0x1a4c29=_0x1a4c29||0xc8;return function(_0x539c65){if(_0x539c65){return _0x51597b[_0x42d0('0x1c')](_0x1a4c29)['json'](_0x539c65);}};}function respondWithFilteredResult(_0x33e3d9,_0x13a590){return function(_0x3da0ab){if(_0x3da0ab){var _0x460812=typeof _0x13a590[_0x42d0('0x1d')]===_0x42d0('0x1e')&&typeof _0x13a590[_0x42d0('0x1f')]===_0x42d0('0x1e');var _0x48da24=_0x3da0ab['count'];var _0x11f3d2=_0x460812?0x0:_0x13a590[_0x42d0('0x1d')];var _0x234dbd=_0x460812?_0x3da0ab[_0x42d0('0x20')]:_0x13a590[_0x42d0('0x1d')]+_0x13a590['limit'];var _0x3e5048;if(_0x234dbd>=_0x48da24){_0x234dbd=_0x48da24;_0x3e5048=0xc8;}else{_0x3e5048=0xce;}_0x33e3d9[_0x42d0('0x1c')](_0x3e5048);return _0x33e3d9['set'](_0x42d0('0x21'),_0x11f3d2+'-'+_0x234dbd+'/'+_0x48da24)[_0x42d0('0x22')](_0x3da0ab);}return null;};}function patchUpdates(_0x409c8d){return function(_0x13110f){try{jsonpatch[_0x42d0('0x23')](_0x13110f,_0x409c8d,!![]);}catch(_0x48a88c){return BPromise[_0x42d0('0x24')](_0x48a88c);}return _0x13110f[_0x42d0('0x25')]();};}function saveUpdates(_0x347581,_0x1e2a8e){return function(_0x354696){if(_0x354696){return _0x354696[_0x42d0('0x26')](_0x347581)[_0x42d0('0x27')](function(_0x550306){return _0x550306;});}return null;};}function removeEntity(_0x2ff37d,_0x3d209e){return function(_0x5c90e5){if(_0x5c90e5){return _0x5c90e5[_0x42d0('0x28')]()[_0x42d0('0x27')](function(){var _0x4c924b=_0x5c90e5[_0x42d0('0x29')]({'plain':!![]});var _0x52dbfc='WhatsappQueues';return db[_0x42d0('0x2a')]['destroy']({'where':{'type':_0x52dbfc,'resourceId':_0x4c924b['id']}})['then'](function(){return _0x5c90e5;});})[_0x42d0('0x27')](function(){_0x2ff37d[_0x42d0('0x1c')](0xcc)[_0x42d0('0x2b')]();});}};}function handleEntityNotFound(_0x47b02f,_0x53ea8a){return function(_0x18f29f){if(!_0x18f29f){_0x47b02f[_0x42d0('0x1b')](0x194);}return _0x18f29f;};}function handleError(_0x3da95f,_0x277d21){_0x277d21=_0x277d21||0x1f4;return function(_0x55ce10){logger['error'](_0x55ce10[_0x42d0('0x2c')]);if(_0x55ce10[_0x42d0('0x2d')]){delete _0x55ce10[_0x42d0('0x2d')];}_0x3da95f[_0x42d0('0x1c')](_0x277d21)[_0x42d0('0x2e')](_0x55ce10);};}exports[_0x42d0('0x2f')]=function(_0x1ddc1e,_0x53fed5){var _0x4920e7={},_0x580787={},_0x8ab5ca={'count':0x0,'rows':[]};var _0xda10f7=_['map'](db[_0x42d0('0x30')][_0x42d0('0x31')],function(_0x359641){return{'name':_0x359641[_0x42d0('0x32')],'type':_0x359641[_0x42d0('0x33')]['key']};});_0x580787[_0x42d0('0x34')]=_['map'](_0xda10f7,_0x42d0('0x2d'));_0x580787['query']=_[_0x42d0('0x35')](_0x1ddc1e[_0x42d0('0x36')]);_0x580787[_0x42d0('0x37')]=_[_0x42d0('0x38')](_0x580787[_0x42d0('0x34')],_0x580787['query']);_0x4920e7[_0x42d0('0x39')]=_['intersection'](_0x580787[_0x42d0('0x34')],qs['fields'](_0x1ddc1e['query'][_0x42d0('0x3a')]));_0x4920e7[_0x42d0('0x39')]=_0x4920e7[_0x42d0('0x39')][_0x42d0('0x3b')]?_0x4920e7[_0x42d0('0x39')]:_0x580787['model'];if(!_0x1ddc1e['query'][_0x42d0('0x3c')](_0x42d0('0x3d'))){_0x4920e7[_0x42d0('0x1f')]=qs[_0x42d0('0x1f')](_0x1ddc1e[_0x42d0('0x36')][_0x42d0('0x1f')]);_0x4920e7['offset']=qs[_0x42d0('0x1d')](_0x1ddc1e[_0x42d0('0x36')]['offset']);}_0x4920e7[_0x42d0('0x3e')]=qs[_0x42d0('0x3f')](_0x1ddc1e[_0x42d0('0x36')][_0x42d0('0x3f')]);_0x4920e7[_0x42d0('0x40')]=qs[_0x42d0('0x37')](_['pick'](_0x1ddc1e[_0x42d0('0x36')],_0x580787[_0x42d0('0x37')]),_0xda10f7);if(_0x1ddc1e[_0x42d0('0x36')]['filter']){_0x4920e7[_0x42d0('0x40')]=_['merge'](_0x4920e7[_0x42d0('0x40')],{'$or':_['map'](_0xda10f7,function(_0x48b113){if(_0x48b113[_0x42d0('0x33')]!==_0x42d0('0x41')){var _0x2cc8ef={};_0x2cc8ef[_0x48b113[_0x42d0('0x2d')]]={'$like':'%'+_0x1ddc1e['query'][_0x42d0('0x42')]+'%'};return _0x2cc8ef;}})});}_0x4920e7=_['merge']({},_0x4920e7,_0x1ddc1e[_0x42d0('0x43')]);var _0x4dfd2f={'where':_0x4920e7[_0x42d0('0x40')]};return db['WhatsappQueue']['count'](_0x4dfd2f)[_0x42d0('0x27')](function(_0x148d4e){_0x8ab5ca[_0x42d0('0x20')]=_0x148d4e;if(_0x1ddc1e[_0x42d0('0x36')][_0x42d0('0x44')]){_0x4920e7['include']=[{'all':!![]}];}return db[_0x42d0('0x30')][_0x42d0('0x45')](_0x4920e7);})[_0x42d0('0x27')](function(_0x16220e){_0x8ab5ca[_0x42d0('0x46')]=_0x16220e;return _0x8ab5ca;})[_0x42d0('0x27')](respondWithFilteredResult(_0x53fed5,_0x4920e7))[_0x42d0('0x47')](handleError(_0x53fed5,null));};exports[_0x42d0('0x48')]=function(_0x1f1ef3,_0x123d55){var _0xbed556={'raw':!![],'where':{'id':_0x1f1ef3['params']['id']}},_0x7b3f59={};_0x7b3f59[_0x42d0('0x34')]=_[_0x42d0('0x35')](db[_0x42d0('0x30')]['rawAttributes']);_0x7b3f59[_0x42d0('0x36')]=_[_0x42d0('0x35')](_0x1f1ef3[_0x42d0('0x36')]);_0x7b3f59['filters']=_[_0x42d0('0x38')](_0x7b3f59[_0x42d0('0x34')],_0x7b3f59[_0x42d0('0x36')]);_0xbed556['attributes']=_['intersection'](_0x7b3f59[_0x42d0('0x34')],qs[_0x42d0('0x3a')](_0x1f1ef3[_0x42d0('0x36')][_0x42d0('0x3a')]));_0xbed556['attributes']=_0xbed556[_0x42d0('0x39')][_0x42d0('0x3b')]?_0xbed556['attributes']:_0x7b3f59['model'];if(_0x1f1ef3[_0x42d0('0x36')]['includeAll']){_0xbed556[_0x42d0('0x49')]=[{'all':!![]}];}_0xbed556=_['merge']({},_0xbed556,_0x1f1ef3[_0x42d0('0x43')]);return db[_0x42d0('0x30')][_0x42d0('0x4a')](_0xbed556)[_0x42d0('0x27')](handleEntityNotFound(_0x123d55,null))[_0x42d0('0x27')](respondWithResult(_0x123d55,null))[_0x42d0('0x47')](handleError(_0x123d55,null));};exports[_0x42d0('0x4b')]=function(_0x406e59,_0x2fe29b){return db[_0x42d0('0x30')][_0x42d0('0x4b')](_0x406e59[_0x42d0('0x4c')],{})[_0x42d0('0x27')](function(_0x1c6821){var _0x426c01=_0x406e59[_0x42d0('0x4d')]['get']({'plain':!![]});if(!_0x426c01)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x426c01[_0x42d0('0x4e')]===_0x42d0('0x4d')){var _0x3a6e9d=_0x1c6821[_0x42d0('0x29')]({'plain':!![]});var _0x453e8f=_0x42d0('0x4f');return db[_0x42d0('0x50')][_0x42d0('0x4a')]({'where':{'name':_0x453e8f,'userProfileId':_0x426c01[_0x42d0('0x51')]},'raw':!![]})[_0x42d0('0x27')](function(_0x17b542){if(_0x17b542&&_0x17b542[_0x42d0('0x52')]===0x0){return db[_0x42d0('0x2a')][_0x42d0('0x4b')]({'name':_0x3a6e9d[_0x42d0('0x2d')],'resourceId':_0x3a6e9d['id'],'type':_0x17b542['name'],'sectionId':_0x17b542['id']},{})[_0x42d0('0x27')](function(){return _0x1c6821;});}else{return _0x1c6821;}})[_0x42d0('0x47')](function(_0x1d08cb){logger[_0x42d0('0x53')](_0x42d0('0x54'),_0x1d08cb);throw _0x1d08cb;});}return _0x1c6821;})[_0x42d0('0x27')](respondWithResult(_0x2fe29b,0xc9))[_0x42d0('0x47')](handleError(_0x2fe29b,null));};exports['update']=function(_0x165324,_0x5dd380){if(_0x165324['body']['id']){delete _0x165324[_0x42d0('0x4c')]['id'];}return db[_0x42d0('0x30')]['find']({'where':{'id':_0x165324[_0x42d0('0x55')]['id']}})['then'](handleEntityNotFound(_0x5dd380,null))[_0x42d0('0x27')](saveUpdates(_0x165324['body'],null))['then'](respondWithResult(_0x5dd380,null))[_0x42d0('0x47')](handleError(_0x5dd380,null));};exports['destroy']=function(_0x2dabc3,_0x4f293c){return db[_0x42d0('0x30')][_0x42d0('0x4a')]({'where':{'id':_0x2dabc3[_0x42d0('0x55')]['id']}})['then'](handleEntityNotFound(_0x4f293c,null))[_0x42d0('0x27')](removeEntity(_0x4f293c,null))['catch'](handleError(_0x4f293c,null));};exports[_0x42d0('0x56')]=function(_0x40aba4,_0x286a3a){return db['WhatsappQueue'][_0x42d0('0x56')]()['then'](respondWithResult(_0x286a3a,null))['catch'](handleError(_0x286a3a,null));};exports[_0x42d0('0x57')]=function(_0x3a349c,_0x5b5750,_0x3457a8){var _0xb68560={'raw':!![],'where':{}},_0x296311={},_0x51b03b;return db['WhatsappQueue'][_0x42d0('0x58')]({'where':{'id':_0x3a349c['params']['id']}})[_0x42d0('0x27')](handleEntityNotFound(_0x5b5750,null))[_0x42d0('0x27')](function(_0x14216a){if(_0x14216a){_0x51b03b=_0x14216a['get']({'plain':!![]});_0x296311[_0x42d0('0x34')]=_[_0x42d0('0x35')](db['UserWhatsappQueue'][_0x42d0('0x31')]);_0x296311['query']=_[_0x42d0('0x35')](_0x3a349c[_0x42d0('0x36')]);_0x296311[_0x42d0('0x37')]=_[_0x42d0('0x38')](_0x296311[_0x42d0('0x34')],_0x296311['query']);_0xb68560['attributes']=_[_0x42d0('0x38')](_0x296311['model'],qs[_0x42d0('0x3a')](_0x3a349c[_0x42d0('0x36')][_0x42d0('0x3a')]));_0xb68560[_0x42d0('0x39')]=_0xb68560['attributes'][_0x42d0('0x3b')]?_0xb68560[_0x42d0('0x39')]:_0x296311[_0x42d0('0x34')];if(!_0x3a349c[_0x42d0('0x36')][_0x42d0('0x3c')](_0x42d0('0x3d'))){_0xb68560[_0x42d0('0x1f')]=qs['limit'](_0x3a349c[_0x42d0('0x36')][_0x42d0('0x1f')]);_0xb68560[_0x42d0('0x1d')]=qs[_0x42d0('0x1d')](_0x3a349c[_0x42d0('0x36')]['offset']);}_0xb68560[_0x42d0('0x3e')]=qs[_0x42d0('0x3f')](_0x3a349c[_0x42d0('0x36')][_0x42d0('0x3f')]);_0xb68560[_0x42d0('0x40')]=qs[_0x42d0('0x37')](_[_0x42d0('0x59')](_0x3a349c[_0x42d0('0x36')],_0x296311[_0x42d0('0x37')]));_0xb68560['where'][_0x42d0('0x5a')]=_0x14216a['id'];if(_0x3a349c['query'][_0x42d0('0x42')]){_0xb68560[_0x42d0('0x40')]=_['merge'](_0xb68560[_0x42d0('0x40')],{'$or':_[_0x42d0('0x5b')](_0xb68560[_0x42d0('0x39')],function(_0x30d9d9){var _0x2a3b69={};_0x2a3b69[_0x30d9d9]={'$like':'%'+_0x3a349c['query'][_0x42d0('0x42')]+'%'};return _0x2a3b69;})});}_0xb68560=_[_0x42d0('0x5c')]({},_0xb68560,_0x3a349c['options']);return db['UserWhatsappQueue'][_0x42d0('0x45')](_0xb68560);}})[_0x42d0('0x27')](function(_0x148fe4){if(_0x148fe4){return db[_0x42d0('0x5d')][_0x42d0('0x5e')]({'where':{'id':_['map'](_0x148fe4,_0x42d0('0x5f')),'role':'agent'},'attributes':['id',_0x42d0('0x2d'),_0x42d0('0x60'),_0x42d0('0x61'),_0x42d0('0x62')]});}})[_0x42d0('0x27')](function(_0x1cfc96){if(_0x1cfc96){return{'count':_0x1cfc96[_0x42d0('0x20')],'rows':_['map'](_0x1cfc96['rows'],function(_0x1c3f3f){return{'membername':_0x1c3f3f['name'],'UserId':_0x1c3f3f['id'],'queue_name':_0x51b03b[_0x42d0('0x2d')],'WhatsappQueueId':_0x51b03b['id'],'interface':util['format'](_0x42d0('0x63'),_0x42d0('0x64'),_0x1c3f3f[_0x42d0('0x2d')]),'penalty':0x0,'paused':_0x1c3f3f[_0x42d0('0x60')],'createdAt':_0x1c3f3f['createdAt'],'updatedAt':_0x1c3f3f[_0x42d0('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x42d0('0x27')](respondWithFilteredResult(_0x5b5750,_0xb68560))[_0x42d0('0x47')](handleError(_0x5b5750,null));};exports[_0x42d0('0x65')]=function(_0x50c421,_0x148557,_0x5388a8){var _0x5f1668={};var _0x1218f2={};var _0x39b1f2;var _0x5859cc;return db[_0x42d0('0x30')]['findOne']({'where':{'id':_0x50c421[_0x42d0('0x55')]['id']}})[_0x42d0('0x27')](handleEntityNotFound(_0x148557,null))[_0x42d0('0x27')](function(_0x59f5f1){if(_0x59f5f1){_0x39b1f2=_0x59f5f1;_0x1218f2[_0x42d0('0x34')]=_['keys'](db[_0x42d0('0x66')]['rawAttributes']);_0x1218f2[_0x42d0('0x36')]=_['keys'](_0x50c421[_0x42d0('0x36')]);_0x1218f2['filters']=_[_0x42d0('0x38')](_0x1218f2[_0x42d0('0x34')],_0x1218f2[_0x42d0('0x36')]);_0x5f1668[_0x42d0('0x39')]=_[_0x42d0('0x38')](_0x1218f2[_0x42d0('0x34')],qs[_0x42d0('0x3a')](_0x50c421['query'][_0x42d0('0x3a')]));_0x5f1668['attributes']=_0x5f1668[_0x42d0('0x39')][_0x42d0('0x3b')]?_0x5f1668[_0x42d0('0x39')]:_0x1218f2[_0x42d0('0x34')];_0x5f1668['order']=qs[_0x42d0('0x3f')](_0x50c421['query'][_0x42d0('0x3f')]);_0x5f1668[_0x42d0('0x40')]=qs[_0x42d0('0x37')](_[_0x42d0('0x59')](_0x50c421[_0x42d0('0x36')],_0x1218f2[_0x42d0('0x37')]));if(_0x50c421[_0x42d0('0x36')]['filter']){_0x5f1668['where']=_[_0x42d0('0x5c')](_0x5f1668['where'],{'$or':_['map'](_0x5f1668[_0x42d0('0x39')],function(_0x17064b){var _0x40d428={};_0x40d428[_0x17064b]={'$like':'%'+_0x50c421['query'][_0x42d0('0x42')]+'%'};return _0x40d428;})});}_0x5f1668=_[_0x42d0('0x5c')]({},_0x5f1668,_0x50c421[_0x42d0('0x43')]);return _0x39b1f2['getTeams'](_0x5f1668);}})[_0x42d0('0x27')](function(_0x202230){if(_0x202230){_0x5859cc=_0x202230[_0x42d0('0x3b')];if(!_0x50c421['query'][_0x42d0('0x3c')](_0x42d0('0x3d'))){_0x5f1668['limit']=qs[_0x42d0('0x1f')](_0x50c421[_0x42d0('0x36')][_0x42d0('0x1f')]);_0x5f1668[_0x42d0('0x1d')]=qs[_0x42d0('0x1d')](_0x50c421[_0x42d0('0x36')][_0x42d0('0x1d')]);}return _0x39b1f2[_0x42d0('0x65')](_0x5f1668);}})[_0x42d0('0x27')](function(_0x39bd11){if(_0x39bd11){return _0x39bd11?{'count':_0x5859cc,'rows':_0x39bd11}:null;}})['then'](respondWithResult(_0x148557,null))[_0x42d0('0x47')](handleError(_0x148557,null));};exports[_0x42d0('0x67')]=function(_0x191bfa,_0x50ba2e,_0x2856c8){var _0x4f4470=_0x191bfa[_0x42d0('0x4c')][_0x42d0('0x68')];return db[_0x42d0('0x66')][_0x42d0('0x45')]({'where':{'id':_0x4f4470},'attributes':['id'],'include':[{'model':db[_0x42d0('0x5d')],'as':_0x42d0('0x69'),'attributes':['id',_0x42d0('0x2d'),_0x42d0('0x6a'),_0x42d0('0x6b'),_0x42d0('0x6c')],'raw':!![]}]})[_0x42d0('0x27')](function(_0x3dad13){if(_0x3dad13){var _0x421215=_['flatMap'](_0x3dad13,function(_0x5cd9cf){var _0x31411d=_0x5cd9cf[_0x42d0('0x29')]({'plain':!![]});return _0x31411d[_0x42d0('0x69')];});return db['WhatsappQueue'][_0x42d0('0x4a')]({'where':{'id':_0x191bfa['params']['id']}})[_0x42d0('0x27')](function(_0x48dddb){return db[_0x42d0('0x6d')][_0x42d0('0x6e')](function(_0x172226){return _0x48dddb['addTeams'](_0x4f4470,{'transaction':_0x172226})[_0x42d0('0x27')](function(){return BPromise[_0x42d0('0x6f')](_0x421215,function(_0x5b5c8d){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x5b5c8d['id'],'WhatsappQueueId':_0x191bfa[_0x42d0('0x55')]['id']},'transaction':_0x172226});});})[_0x42d0('0x27')](function(){_0x421215[_0x42d0('0x70')](function(_0x2df26a){socket[_0x42d0('0x71')]('userWhatsappQueue:save',{'UserId':_0x2df26a['id'],'WhatsappQueueId':_0x48dddb['id']});});});});});}})[_0x42d0('0x27')](respondWithStatusCode(_0x50ba2e,null))[_0x42d0('0x47')](handleError(_0x50ba2e,null));};exports[_0x42d0('0x72')]=function(_0x4e2898,_0x525bf6,_0x2c33a8){return db['Team'][_0x42d0('0x45')]({'where':{'id':_0x4e2898[_0x42d0('0x36')][_0x42d0('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x42d0('0x69'),'attributes':['id'],'raw':!![]}]})[_0x42d0('0x27')](handleEntityNotFound(_0x525bf6,null))[_0x42d0('0x27')](function(_0x4f4679){var _0x7fc26c=_['map'](_0x4f4679,'id');var _0x3b6a25=[];var _0x15e1cc=[];var _0x4e07b1=squel[_0x42d0('0x73')]();_0x4e07b1['field'](_0x42d0('0x74'))[_0x42d0('0x75')](_0x42d0('0x76'),'tq')['join'](_0x42d0('0x77'),'ut',_0x42d0('0x78'))[_0x42d0('0x40')](_0x42d0('0x79'),_0x4e2898['params']['id']);for(var _0x3dda23=0x0;_0x3dda23<_0x4f4679[_0x42d0('0x3b')];_0x3dda23+=0x1){let _0x4c39c7=_0x4f4679[_0x3dda23];for(var _0x26d933=0x0;_0x26d933<_0x4c39c7[_0x42d0('0x69')][_0x42d0('0x3b')];_0x26d933+=0x1){let _0x2f93c6=_0x4c39c7[_0x42d0('0x69')][_0x26d933];var _0x12eee3=_0x4e07b1['clone']();_0x12eee3['where'](_0x42d0('0x7a'),_0x2f93c6['id']);_0x15e1cc[_0x42d0('0x7b')](db[_0x42d0('0x6d')]['query'](_0x12eee3[_0x42d0('0x7c')](),{'type':db[_0x42d0('0x6d')][_0x42d0('0x7d')]['SELECT']})['then'](function(_0x79d1bb){if(_0x79d1bb[_0x42d0('0x3b')]===0x1){return _0x2f93c6['id'];}else{var _0x3f0473=_[_0x42d0('0x7e')](_[_0x42d0('0x5b')](_0x79d1bb,'TeamId'),function(_0x4d577d){return _[_0x42d0('0x7f')](_0x7fc26c,_0x4d577d);});if(_0x3f0473){return _0x2f93c6['id'];}}}));}}return BPromise[_0x42d0('0x80')](_0x15e1cc)['then'](function(_0x87eda){_0x3b6a25=_(_0x3b6a25)['union'](_0x87eda)[_0x42d0('0x81')]()['value']();return db[_0x42d0('0x30')][_0x42d0('0x4a')]({'where':{'id':_0x4e2898[_0x42d0('0x55')]['id']}})[_0x42d0('0x27')](function(_0xd1b827){return db[_0x42d0('0x6d')][_0x42d0('0x6e')](function(_0x3a78f4){return _0xd1b827[_0x42d0('0x72')](_0x4e2898['query'][_0x42d0('0x68')],{'transaction':_0x3a78f4})[_0x42d0('0x27')](function(){if(!_[_0x42d0('0x82')](_0x3b6a25)){return _0xd1b827[_0x42d0('0x83')](_0x3b6a25,{'transaction':_0x3a78f4});}})[_0x42d0('0x27')](function(){_0x3b6a25[_0x42d0('0x70')](function(_0x260b82){socket[_0x42d0('0x71')](_0x42d0('0x84'),{'UserId':_0x260b82,'WhatsappQueueId':_0xd1b827['id']});});});});});});})['then'](respondWithStatusCode(_0x525bf6,null))[_0x42d0('0x47')](handleError(_0x525bf6,null));};exports[_0x42d0('0x85')]=function(_0x2b580d,_0x314310,_0x19907b){return db[_0x42d0('0x30')][_0x42d0('0x4a')]({'where':{'id':_0x2b580d['params']['id']}})['then'](handleEntityNotFound(_0x314310,null))[_0x42d0('0x27')](function(_0x2bee51){if(_0x2bee51){return _0x2bee51[_0x42d0('0x85')](_0x2b580d['body'][_0x42d0('0x68')],_['omit'](_0x2b580d[_0x42d0('0x4c')],[_0x42d0('0x68'),'id'])||{})[_0x42d0('0x86')](function(_0x2cdadf){for(var _0x51523c=0x0;_0x51523c<_0x2b580d[_0x42d0('0x4c')][_0x42d0('0x68')][_0x42d0('0x3b')];_0x51523c+=0x1){socket[_0x42d0('0x71')](_0x42d0('0x87'),{'UserId':Number(_0x2b580d[_0x42d0('0x4c')]['ids'][_0x51523c]),'WhatsappQueueId':Number(_0x2b580d['params']['id'])});}return _0x2cdadf;});}})[_0x42d0('0x27')](respondWithResult(_0x314310,null))['catch'](handleError(_0x314310,null));};exports[_0x42d0('0x83')]=function(_0x282efe,_0x2f01b3,_0x39fc4c){return db['WhatsappQueue'][_0x42d0('0x4a')]({'where':{'id':_0x282efe['params']['id']}})[_0x42d0('0x27')](handleEntityNotFound(_0x2f01b3,null))[_0x42d0('0x27')](function(_0x3cde48){if(_0x3cde48){return _0x3cde48[_0x42d0('0x83')](_0x282efe[_0x42d0('0x36')][_0x42d0('0x68')])[_0x42d0('0x27')](function(){if(_['isArray'](_0x282efe[_0x42d0('0x36')][_0x42d0('0x68')])){for(var _0x1be5d2=0x0;_0x1be5d2<_0x282efe[_0x42d0('0x36')][_0x42d0('0x68')][_0x42d0('0x3b')];_0x1be5d2+=0x1){socket[_0x42d0('0x71')](_0x42d0('0x84'),{'UserId':Number(_0x282efe['query'][_0x42d0('0x68')][_0x1be5d2]),'WhatsappQueueId':Number(_0x282efe[_0x42d0('0x55')]['id'])});}}else{socket[_0x42d0('0x71')](_0x42d0('0x84'),{'UserId':Number(_0x282efe['query']['ids']),'WhatsappQueueId':Number(_0x282efe[_0x42d0('0x55')]['id'])});}});}})[_0x42d0('0x27')](respondWithStatusCode(_0x2f01b3,null))['catch'](handleError(_0x2f01b3,null));};exports[_0x42d0('0x88')]=function(_0x4cce41,_0x47403b,_0x5e3ed0){var _0x364567={};var _0x14342e={};var _0x1df657;var _0x17cd87;return db[_0x42d0('0x30')]['findOne']({'where':{'id':_0x4cce41[_0x42d0('0x55')]['id']}})['then'](handleEntityNotFound(_0x47403b,null))[_0x42d0('0x27')](function(_0x1eed84){if(_0x1eed84){_0x1df657=_0x1eed84;_0x14342e[_0x42d0('0x34')]=_[_0x42d0('0x35')](db['User'][_0x42d0('0x31')]);_0x14342e[_0x42d0('0x36')]=_[_0x42d0('0x35')](_0x4cce41[_0x42d0('0x36')]);_0x14342e['filters']=_[_0x42d0('0x38')](_0x14342e[_0x42d0('0x34')],_0x14342e['query']);_0x364567[_0x42d0('0x39')]=_[_0x42d0('0x38')](_0x14342e[_0x42d0('0x34')],qs[_0x42d0('0x3a')](_0x4cce41[_0x42d0('0x36')][_0x42d0('0x3a')]));_0x364567[_0x42d0('0x39')]=_0x364567['attributes'][_0x42d0('0x3b')]?_0x364567['attributes']:_0x14342e[_0x42d0('0x34')];_0x364567[_0x42d0('0x3e')]=qs['sort'](_0x4cce41['query'][_0x42d0('0x3f')]);_0x364567[_0x42d0('0x40')]=qs['filters'](_[_0x42d0('0x59')](_0x4cce41[_0x42d0('0x36')],_0x14342e[_0x42d0('0x37')]));if(_0x4cce41[_0x42d0('0x36')]['filter']){_0x364567[_0x42d0('0x40')]=_['merge'](_0x364567[_0x42d0('0x40')],{'$or':_[_0x42d0('0x5b')](_0x364567[_0x42d0('0x39')],function(_0x4c9130){var _0x1f738e={};_0x1f738e[_0x4c9130]={'$like':'%'+_0x4cce41['query']['filter']+'%'};return _0x1f738e;})});}_0x364567=_[_0x42d0('0x5c')]({},_0x364567,_0x4cce41[_0x42d0('0x43')]);return _0x1df657['getAgents'](_0x364567);}})[_0x42d0('0x27')](function(_0x33fa5a){if(_0x33fa5a){_0x17cd87=_0x33fa5a[_0x42d0('0x3b')];if(!_0x4cce41[_0x42d0('0x36')]['hasOwnProperty']('nolimit')){_0x364567[_0x42d0('0x1f')]=qs['limit'](_0x4cce41[_0x42d0('0x36')][_0x42d0('0x1f')]);_0x364567[_0x42d0('0x1d')]=qs['offset'](_0x4cce41['query'][_0x42d0('0x1d')]);}return _0x1df657[_0x42d0('0x88')](_0x364567);}})[_0x42d0('0x27')](function(_0x567404){if(_0x567404){return _0x567404?{'count':_0x17cd87,'rows':_0x567404}:null;}})[_0x42d0('0x27')](respondWithResult(_0x47403b,null))['catch'](handleError(_0x47403b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index d3d6436..1c5041b 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 _0xe823=['../../mysqldb','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x5ea923,_0x3918e5){var _0x33dc66=function(_0x26cd0e){while(--_0x26cd0e){_0x5ea923['push'](_0x5ea923['shift']());}};_0x33dc66(++_0x3918e5);}(_0xe823,0x156));var _0x3e82=function(_0x544a0d,_0xa18cd4){_0x544a0d=_0x544a0d-0x0;var _0x4cd8ea=_0xe823[_0x544a0d];return _0x4cd8ea;};'use strict';var EventEmitter=require(_0x3e82('0x0'));var WhatsappQueue=require(_0x3e82('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3e82('0x2'),'afterDestroy':_0x3e82('0x3')};function emitEvent(_0x311ee4){return function(_0x4e92fe,_0x4f9343,_0x2063ec){WhatsappQueueEvents['emit'](_0x311ee4+':'+_0x4e92fe['id'],_0x4e92fe);WhatsappQueueEvents['emit'](_0x311ee4,_0x4e92fe);_0x2063ec(null);};}for(var e in events){if(events[_0x3e82('0x4')](e)){var event=events[e];WhatsappQueue[_0x3e82('0x5')](e,emitEvent(event));}}module[_0x3e82('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x058d=['exports','events','../../mysqldb','WhatsappQueue','remove','emit','hasOwnProperty','hook'];(function(_0x5e9ac7,_0x3b9467){var _0x41a746=function(_0x561903){while(--_0x561903){_0x5e9ac7['push'](_0x5e9ac7['shift']());}};_0x41a746(++_0x3b9467);}(_0x058d,0x191));var _0xd058=function(_0x1b5432,_0x129c06){_0x1b5432=_0x1b5432-0x0;var _0x218eec=_0x058d[_0x1b5432];return _0x218eec;};'use strict';var EventEmitter=require(_0xd058('0x0'));var WhatsappQueue=require(_0xd058('0x1'))['db'][_0xd058('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd058('0x3')};function emitEvent(_0x1ac3fb){return function(_0x37700d,_0x32ba4e,_0x3cfe40){WhatsappQueueEvents['emit'](_0x1ac3fb+':'+_0x37700d['id'],_0x37700d);WhatsappQueueEvents[_0xd058('0x4')](_0x1ac3fb,_0x37700d);_0x3cfe40(null);};}for(var e in events){if(events[_0xd058('0x5')](e)){var event=events[e];WhatsappQueue[_0xd058('0x6')](e,emitEvent(event));}}module[_0xd058('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 5c727af..9107024 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 _0x3ad4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0x3ad4,0xb4));var _0x43ad=function(_0x1781de,_0x5c4b38){_0x1781de=_0x1781de-0x0;var _0x48d7fc=_0x3ad4[_0x1781de];return _0x48d7fc;};'use strict';var _=require(_0x43ad('0x0'));var util=require(_0x43ad('0x1'));var logger=require(_0x43ad('0x2'))(_0x43ad('0x3'));var moment=require(_0x43ad('0x4'));var BPromise=require(_0x43ad('0x5'));var rp=require(_0x43ad('0x6'));var fs=require('fs');var path=require(_0x43ad('0x7'));var rimraf=require(_0x43ad('0x8'));var config=require(_0x43ad('0x9'));var attributes=require('./whatsappQueue.attributes');module[_0x43ad('0xa')]=function(_0x1df620,_0x1c0dc6){return _0x1df620['define'](_0x43ad('0xb'),attributes,{'tableName':_0x43ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3a9=['bluebird','request-promise','path','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','util','../../config/logger','moment'];(function(_0x3a2e56,_0x524af1){var _0x15b224=function(_0x1b982b){while(--_0x1b982b){_0x3a2e56['push'](_0x3a2e56['shift']());}};_0x15b224(++_0x524af1);}(_0xc3a9,0x104));var _0x9c3a=function(_0x3e6c72,_0x3e4de7){_0x3e6c72=_0x3e6c72-0x0;var _0x156b9b=_0xc3a9[_0x3e6c72];return _0x156b9b;};'use strict';var _=require(_0x9c3a('0x0'));var util=require(_0x9c3a('0x1'));var logger=require(_0x9c3a('0x2'))('api');var moment=require(_0x9c3a('0x3'));var BPromise=require(_0x9c3a('0x4'));var rp=require(_0x9c3a('0x5'));var fs=require('fs');var path=require(_0x9c3a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9c3a('0x7'));module[_0x9c3a('0x8')]=function(_0x44c06c,_0x3244c3){return _0x44c06c[_0x9c3a('0x9')]('WhatsappQueue',attributes,{'tableName':_0x9c3a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 66c277e..09ad0c8 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 _0x6b5d=['WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','include','map','model','stringify','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info'];(function(_0x509578,_0x2a2324){var _0x2080b9=function(_0xe9e16c){while(--_0xe9e16c){_0x509578['push'](_0x509578['shift']());}};_0x2080b9(++_0x2a2324);}(_0x6b5d,0x155));var _0xd6b5=function(_0x11eb9a,_0x584e83){_0x11eb9a=_0x11eb9a-0x0;var _0x1afd32=_0x6b5d[_0x11eb9a];return _0x1afd32;};'use strict';var _=require(_0xd6b5('0x0'));var util=require(_0xd6b5('0x1'));var moment=require(_0xd6b5('0x2'));var BPromise=require(_0xd6b5('0x3'));var rs=require(_0xd6b5('0x4'));var fs=require('fs');var Redis=require(_0xd6b5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6b5('0x6'));var logger=require(_0xd6b5('0x7'))(_0xd6b5('0x8'));var config=require(_0xd6b5('0x9'));var jayson=require(_0xd6b5('0xa'));var client=jayson[_0xd6b5('0xb')][_0xd6b5('0xc')]({'port':0x232a});config[_0xd6b5('0xd')]=_[_0xd6b5('0xe')](config[_0xd6b5('0xd')],{'host':_0xd6b5('0xf'),'port':0x18eb});var socket=require(_0xd6b5('0x10'))(new Redis(config[_0xd6b5('0xd')]));require('./whatsappQueue.socket')[_0xd6b5('0x11')](socket);function respondWithRpcPromise(_0x1708a7,_0x5c0f8e,_0x29b2f4){return new BPromise(function(_0x1dca63,_0x37a728){return client['request'](_0x1708a7,_0x29b2f4)['then'](function(_0x3feb91){logger[_0xd6b5('0x12')](_0xd6b5('0x13'),_0x5c0f8e,_0xd6b5('0x14'));logger[_0xd6b5('0x15')](_0xd6b5('0x16'),_0x5c0f8e,_0xd6b5('0x14'),JSON['stringify'](_0x3feb91));if(_0x3feb91['error']){if(_0x3feb91[_0xd6b5('0x17')][_0xd6b5('0x18')]===0x1f4){logger[_0xd6b5('0x17')](_0xd6b5('0x13'),_0x5c0f8e,_0x3feb91[_0xd6b5('0x17')][_0xd6b5('0x19')]);return _0x37a728(_0x3feb91[_0xd6b5('0x17')][_0xd6b5('0x19')]);}logger['error'](_0xd6b5('0x13'),_0x5c0f8e,_0x3feb91[_0xd6b5('0x17')]['message']);return _0x1dca63(_0x3feb91['error']['message']);}else{logger[_0xd6b5('0x12')](_0xd6b5('0x13'),_0x5c0f8e,_0xd6b5('0x14'));_0x1dca63(_0x3feb91[_0xd6b5('0x1a')][_0xd6b5('0x19')]);}})[_0xd6b5('0x1b')](function(_0x67c6a3){logger[_0xd6b5('0x17')](_0xd6b5('0x13'),_0x5c0f8e,_0x67c6a3);_0x37a728(_0x67c6a3);});});}exports[_0xd6b5('0x1c')]=function(_0x4328ed){var _0x17a6b1=this;return new Promise(function(_0x251a16,_0x12eb07){return db[_0xd6b5('0x1d')][_0xd6b5('0x1e')]({'raw':_0x4328ed[_0xd6b5('0x1f')]?_0x4328ed[_0xd6b5('0x1f')][_0xd6b5('0x20')]===undefined?!![]:![]:!![],'where':_0x4328ed[_0xd6b5('0x1f')]?_0x4328ed[_0xd6b5('0x1f')][_0xd6b5('0x21')]||null:null,'attributes':_0x4328ed[_0xd6b5('0x1f')]?_0x4328ed[_0xd6b5('0x1f')][_0xd6b5('0x22')]||null:null,'limit':_0x4328ed[_0xd6b5('0x1f')]?_0x4328ed[_0xd6b5('0x1f')]['limit']||null:null,'include':_0x4328ed[_0xd6b5('0x1f')]?_0x4328ed[_0xd6b5('0x1f')][_0xd6b5('0x23')]?_[_0xd6b5('0x24')](_0x4328ed['options'][_0xd6b5('0x23')],function(_0xc16952){return{'model':db[_0xc16952[_0xd6b5('0x25')]],'as':_0xc16952['as'],'attributes':_0xc16952[_0xd6b5('0x22')],'include':_0xc16952[_0xd6b5('0x23')]?_[_0xd6b5('0x24')](_0xc16952['include'],function(_0x591bfe){return{'model':db[_0x591bfe[_0xd6b5('0x25')]],'as':_0x591bfe['as'],'attributes':_0x591bfe[_0xd6b5('0x22')],'include':_0x591bfe[_0xd6b5('0x23')]?_['map'](_0x591bfe[_0xd6b5('0x23')],function(_0x246687){return{'model':db[_0x246687['model']],'as':_0x246687['as'],'attributes':_0x246687['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e4682){logger['info'](_0xd6b5('0x1c'),_0x4328ed);logger[_0xd6b5('0x15')]('GetWhatsappQueue',_0x4328ed,JSON[_0xd6b5('0x26')](_0x1e4682));_0x251a16(_0x1e4682);})[_0xd6b5('0x1b')](function(_0x2e0665){logger[_0xd6b5('0x17')](_0xd6b5('0x1c'),_0x2e0665[_0xd6b5('0x19')],_0x4328ed);_0x12eb07(_0x17a6b1[_0xd6b5('0x17')](0x1f4,_0x2e0665[_0xd6b5('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x532485){var _0x1f3ce2=this;return new Promise(function(_0x55592f,_0x33c1c0){return db[_0xd6b5('0x1d')]['find']({'raw':_0x532485[_0xd6b5('0x1f')]?_0x532485['options'][_0xd6b5('0x20')]===undefined?!![]:![]:!![],'where':_0x532485[_0xd6b5('0x1f')]?_0x532485['options']['where']||null:null,'attributes':_0x532485[_0xd6b5('0x1f')]?_0x532485[_0xd6b5('0x1f')][_0xd6b5('0x22')]||null:null,'include':_0x532485[_0xd6b5('0x1f')]?_0x532485['options'][_0xd6b5('0x23')]?_['map'](_0x532485[_0xd6b5('0x1f')][_0xd6b5('0x23')],function(_0x17d458){return{'model':db[_0x17d458['model']],'as':_0x17d458['as'],'attributes':_0x17d458[_0xd6b5('0x22')],'include':_0x17d458['include']?_[_0xd6b5('0x24')](_0x17d458[_0xd6b5('0x23')],function(_0x117aec){return{'model':db[_0x117aec[_0xd6b5('0x25')]],'as':_0x117aec['as'],'attributes':_0x117aec[_0xd6b5('0x22')],'include':_0x117aec[_0xd6b5('0x23')]?_['map'](_0x117aec[_0xd6b5('0x23')],function(_0x21b647){return{'model':db[_0x21b647[_0xd6b5('0x25')]],'as':_0x21b647['as'],'attributes':_0x21b647['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfedf37){logger[_0xd6b5('0x12')](_0xd6b5('0x27'),_0x532485);logger[_0xd6b5('0x15')](_0xd6b5('0x27'),_0x532485,JSON[_0xd6b5('0x26')](_0xfedf37));_0x55592f(_0xfedf37);})[_0xd6b5('0x1b')](function(_0xb8bce1){logger[_0xd6b5('0x17')](_0xd6b5('0x27'),_0xb8bce1['message'],_0x532485);_0x33c1c0(_0x1f3ce2[_0xd6b5('0x17')](0x1f4,_0xb8bce1['message']));});});}; \ No newline at end of file +var _0x8718=['error','code','WhatsappQueue,\x20%s,\x20%s','message','catch','GetWhatsappQueue','WhatsappQueue','options','limit','map','include','model','attributes','then','stringify','ShowWhatsappQueue','find','raw','where','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','request','info','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x268e42,_0x428d8a){var _0x1dae4c=function(_0x570035){while(--_0x570035){_0x268e42['push'](_0x268e42['shift']());}};_0x1dae4c(++_0x428d8a);}(_0x8718,0x125));var _0x8871=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0x8718[_0x18aaaf];return _0x52d892;};'use strict';var _=require(_0x8871('0x0'));var util=require('util');var moment=require(_0x8871('0x1'));var BPromise=require(_0x8871('0x2'));var rs=require(_0x8871('0x3'));var fs=require('fs');var Redis=require(_0x8871('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8871('0x5'))(_0x8871('0x6'));var config=require(_0x8871('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8871('0x8')]({'port':0x232a});config['redis']=_[_0x8871('0x9')](config['redis'],{'host':_0x8871('0xa'),'port':0x18eb});var socket=require(_0x8871('0xb'))(new Redis(config[_0x8871('0xc')]));require(_0x8871('0xd'))[_0x8871('0xe')](socket);function respondWithRpcPromise(_0x5d17de,_0x65c34e,_0x4058a1){return new BPromise(function(_0x400a41,_0x54992f){return client[_0x8871('0xf')](_0x5d17de,_0x4058a1)['then'](function(_0x56c96d){logger[_0x8871('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x65c34e,_0x8871('0x11'));logger['debug'](_0x8871('0x12'),_0x65c34e,_0x8871('0x11'),JSON['stringify'](_0x56c96d));if(_0x56c96d[_0x8871('0x13')]){if(_0x56c96d[_0x8871('0x13')][_0x8871('0x14')]===0x1f4){logger[_0x8871('0x13')](_0x8871('0x15'),_0x65c34e,_0x56c96d[_0x8871('0x13')]['message']);return _0x54992f(_0x56c96d[_0x8871('0x13')]['message']);}logger[_0x8871('0x13')](_0x8871('0x15'),_0x65c34e,_0x56c96d[_0x8871('0x13')][_0x8871('0x16')]);return _0x400a41(_0x56c96d['error'][_0x8871('0x16')]);}else{logger[_0x8871('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x65c34e,_0x8871('0x11'));_0x400a41(_0x56c96d['result']['message']);}})[_0x8871('0x17')](function(_0x2cc51e){logger[_0x8871('0x13')](_0x8871('0x15'),_0x65c34e,_0x2cc51e);_0x54992f(_0x2cc51e);});});}exports[_0x8871('0x18')]=function(_0x48340c){var _0x3a9f71=this;return new Promise(function(_0x32ff77,_0x491324){return db[_0x8871('0x19')]['findAll']({'raw':_0x48340c[_0x8871('0x1a')]?_0x48340c[_0x8871('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x48340c[_0x8871('0x1a')]?_0x48340c[_0x8871('0x1a')]['where']||null:null,'attributes':_0x48340c[_0x8871('0x1a')]?_0x48340c[_0x8871('0x1a')]['attributes']||null:null,'limit':_0x48340c[_0x8871('0x1a')]?_0x48340c[_0x8871('0x1a')][_0x8871('0x1b')]||null:null,'include':_0x48340c[_0x8871('0x1a')]?_0x48340c['options']['include']?_[_0x8871('0x1c')](_0x48340c[_0x8871('0x1a')][_0x8871('0x1d')],function(_0x2fccd5){return{'model':db[_0x2fccd5[_0x8871('0x1e')]],'as':_0x2fccd5['as'],'attributes':_0x2fccd5[_0x8871('0x1f')],'include':_0x2fccd5[_0x8871('0x1d')]?_[_0x8871('0x1c')](_0x2fccd5[_0x8871('0x1d')],function(_0x40d1af){return{'model':db[_0x40d1af[_0x8871('0x1e')]],'as':_0x40d1af['as'],'attributes':_0x40d1af[_0x8871('0x1f')],'include':_0x40d1af[_0x8871('0x1d')]?_[_0x8871('0x1c')](_0x40d1af[_0x8871('0x1d')],function(_0x598d36){return{'model':db[_0x598d36[_0x8871('0x1e')]],'as':_0x598d36['as'],'attributes':_0x598d36[_0x8871('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8871('0x20')](function(_0x4b8844){logger[_0x8871('0x10')]('GetWhatsappQueue',_0x48340c);logger['debug'](_0x8871('0x18'),_0x48340c,JSON[_0x8871('0x21')](_0x4b8844));_0x32ff77(_0x4b8844);})[_0x8871('0x17')](function(_0x2ae6ba){logger[_0x8871('0x13')](_0x8871('0x18'),_0x2ae6ba[_0x8871('0x16')],_0x48340c);_0x491324(_0x3a9f71[_0x8871('0x13')](0x1f4,_0x2ae6ba[_0x8871('0x16')]));});});};exports[_0x8871('0x22')]=function(_0x4a2a52){var _0x3ae4cb=this;return new Promise(function(_0x5003cf,_0x290b49){return db[_0x8871('0x19')][_0x8871('0x23')]({'raw':_0x4a2a52['options']?_0x4a2a52[_0x8871('0x1a')][_0x8871('0x24')]===undefined?!![]:![]:!![],'where':_0x4a2a52[_0x8871('0x1a')]?_0x4a2a52[_0x8871('0x1a')][_0x8871('0x25')]||null:null,'attributes':_0x4a2a52[_0x8871('0x1a')]?_0x4a2a52[_0x8871('0x1a')][_0x8871('0x1f')]||null:null,'include':_0x4a2a52[_0x8871('0x1a')]?_0x4a2a52[_0x8871('0x1a')][_0x8871('0x1d')]?_[_0x8871('0x1c')](_0x4a2a52[_0x8871('0x1a')][_0x8871('0x1d')],function(_0x10f660){return{'model':db[_0x10f660[_0x8871('0x1e')]],'as':_0x10f660['as'],'attributes':_0x10f660[_0x8871('0x1f')],'include':_0x10f660[_0x8871('0x1d')]?_[_0x8871('0x1c')](_0x10f660[_0x8871('0x1d')],function(_0x52dfe8){return{'model':db[_0x52dfe8['model']],'as':_0x52dfe8['as'],'attributes':_0x52dfe8['attributes'],'include':_0x52dfe8[_0x8871('0x1d')]?_['map'](_0x52dfe8[_0x8871('0x1d')],function(_0x4caee3){return{'model':db[_0x4caee3[_0x8871('0x1e')]],'as':_0x4caee3['as'],'attributes':_0x4caee3['attributes']};}):[]};}):[]};}):[]:[]})[_0x8871('0x20')](function(_0x29a95b){logger['info'](_0x8871('0x22'),_0x4a2a52);logger[_0x8871('0x26')](_0x8871('0x22'),_0x4a2a52,JSON[_0x8871('0x21')](_0x29a95b));_0x5003cf(_0x29a95b);})[_0x8871('0x17')](function(_0x4ef12c){logger[_0x8871('0x13')](_0x8871('0x22'),_0x4ef12c[_0x8871('0x16')],_0x4a2a52);_0x290b49(_0x3ae4cb['error'](0x1f4,_0x4ef12c[_0x8871('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ab38c16..6f60b19 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 _0xda0f=['removeListener','length','whatsappQueue:','./whatsappQueue.events','save','update'];(function(_0x4f5af0,_0x2710d0){var _0x1ad6c4=function(_0x5101a9){while(--_0x5101a9){_0x4f5af0['push'](_0x4f5af0['shift']());}};_0x1ad6c4(++_0x2710d0);}(_0xda0f,0x1cb));var _0xfda0=function(_0x5cb990,_0x38831c){_0x5cb990=_0x5cb990-0x0;var _0x353fd2=_0xda0f[_0x5cb990];return _0x353fd2;};'use strict';var WhatsappQueueEvents=require(_0xfda0('0x0'));var events=[_0xfda0('0x1'),'remove',_0xfda0('0x2')];function createListener(_0x550940,_0x2035d4){return function(_0x4acb68){_0x2035d4['emit'](_0x550940,_0x4acb68);};}function removeListener(_0x31d92f,_0xfefea7){return function(){WhatsappQueueEvents[_0xfda0('0x3')](_0x31d92f,_0xfefea7);};}exports['register']=function(_0x188dcf){for(var _0x34a8c0=0x0,_0x2cebe0=events[_0xfda0('0x4')];_0x34a8c0<_0x2cebe0;_0x34a8c0++){var _0x43fb8b=events[_0x34a8c0];var _0x155b94=createListener(_0xfda0('0x5')+_0x43fb8b,_0x188dcf);WhatsappQueueEvents['on'](_0x43fb8b,_0x155b94);}}; \ No newline at end of file +var _0x025f=['emit','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x306861,_0x261ee4){var _0x36ae36=function(_0x264716){while(--_0x264716){_0x306861['push'](_0x306861['shift']());}};_0x36ae36(++_0x261ee4);}(_0x025f,0x98));var _0xf025=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x025f[_0x4565bf];return _0x5610ba;};'use strict';var WhatsappQueueEvents=require(_0xf025('0x0'));var events=[_0xf025('0x1'),_0xf025('0x2'),_0xf025('0x3')];function createListener(_0x3c6fbc,_0x478d69){return function(_0xa04dd6){_0x478d69[_0xf025('0x4')](_0x3c6fbc,_0xa04dd6);};}function removeListener(_0x30d709,_0x44172d){return function(){WhatsappQueueEvents['removeListener'](_0x30d709,_0x44172d);};}exports['register']=function(_0x35e970){for(var _0x150cea=0x0,_0x1ac07b=events['length'];_0x150cea<_0x1ac07b;_0x150cea++){var _0x31fa56=events[_0x150cea];var _0x37404f=createListener(_0xf025('0x5')+_0x31fa56,_0x35e970);WhatsappQueueEvents['on'](_0x31fa56,_0x37404f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 3002c2d..13d1701 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 _0x000f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x119e29,_0x26a6b4){var _0x581540=function(_0xcc1585){while(--_0xcc1585){_0x119e29['push'](_0x119e29['shift']());}};_0x581540(++_0x26a6b4);}(_0x000f,0x1e1));var _0xf000=function(_0x571f28,_0x517182){_0x571f28=_0x571f28-0x0;var _0x4816b5=_0x000f[_0x571f28];return _0x4816b5;};'use strict';var multer=require('multer');var util=require(_0xf000('0x0'));var path=require(_0xf000('0x1'));var timeout=require(_0xf000('0x2'));var express=require(_0xf000('0x3'));var router=express[_0xf000('0x4')]();var fs_extra=require(_0xf000('0x5'));var auth=require(_0xf000('0x6'));var interaction=require(_0xf000('0x7'));var config=require(_0xf000('0x8'));var controller=require(_0xf000('0x9'));router[_0xf000('0xa')]('/',auth[_0xf000('0xb')](),controller[_0xf000('0xc')]);router[_0xf000('0xa')](_0xf000('0xd'),auth[_0xf000('0xb')](),controller[_0xf000('0xe')]);router['get'](_0xf000('0xf'),auth[_0xf000('0xb')](),controller[_0xf000('0x10')]);router[_0xf000('0x11')]('/',auth[_0xf000('0xb')](),controller['create']);router[_0xf000('0x12')]('/:id',auth[_0xf000('0xb')](),controller[_0xf000('0x13')]);router[_0xf000('0x14')](_0xf000('0xf'),auth['isAuthenticated'](),controller[_0xf000('0x15')]);module['exports']=router; \ No newline at end of file +var _0x3750=['describe','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0xe87d12,_0x431c2e){var _0x2ea444=function(_0x44c3f1){while(--_0x44c3f1){_0xe87d12['push'](_0xe87d12['shift']());}};_0x2ea444(++_0x431c2e);}(_0x3750,0xda));var _0x0375=function(_0x417774,_0x1b95e6){_0x417774=_0x417774-0x0;var _0x10015d=_0x3750[_0x417774];return _0x10015d;};'use strict';var multer=require('multer');var util=require(_0x0375('0x0'));var path=require('path');var timeout=require(_0x0375('0x1'));var express=require(_0x0375('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0375('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0375('0x4'));var controller=require(_0x0375('0x5'));router[_0x0375('0x6')]('/',auth[_0x0375('0x7')](),controller[_0x0375('0x8')]);router[_0x0375('0x6')](_0x0375('0x9'),auth[_0x0375('0x7')](),controller[_0x0375('0xa')]);router[_0x0375('0x6')](_0x0375('0xb'),auth['isAuthenticated'](),controller[_0x0375('0xc')]);router[_0x0375('0xd')]('/',auth[_0x0375('0x7')](),controller['create']);router[_0x0375('0xe')](_0x0375('0xb'),auth[_0x0375('0x7')](),controller[_0x0375('0xf')]);router[_0x0375('0x10')](_0x0375('0xb'),auth[_0x0375('0x7')](),controller[_0x0375('0x11')]);module[_0x0375('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 14d112b..43a3d97 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x4d54d8,_0x43a43c){var _0x49de62=function(_0x23b830){while(--_0x23b830){_0x4d54d8['push'](_0x4d54d8['shift']());}};_0x49de62(++_0x43a43c);}(_0x7a54,0x106));var _0x47a5=function(_0x11ed21,_0x5cec92){_0x11ed21=_0x11ed21-0x0;var _0x5c0c02=_0x7a54[_0x11ed21];return _0x5c0c02;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4f4bb5,_0x59db4f){var _0x54ce24=function(_0x3a300d){while(--_0x3a300d){_0x4f4bb5['push'](_0x4f4bb5['shift']());}};_0x54ce24(++_0x59db4f);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 5ad79cf..d8fbf7e 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 _0x373d=['order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','rawAttributes','includeAll','options','catch','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0xff9a45,_0x3d125d){var _0x5cf2e1=function(_0x174c14){while(--_0x174c14){_0xff9a45['push'](_0xff9a45['shift']());}};_0x5cf2e1(++_0x3d125d);}(_0x373d,0x1e2));var _0xd373=function(_0x44e8fb,_0x23e56a){_0x44e8fb=_0x44e8fb-0x0;var _0x1d5476=_0x373d[_0x44e8fb];return _0x1d5476;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x437110,_0x34f05a){return function(_0x388182){if(!_0x388182){_0x437110[_0xd373('0x15')](0x194);}return _0x388182;};}function handleError(_0x18d7ab,_0x38ba50){_0x38ba50=_0x38ba50||0x1f4;return function(_0x50b987){logger[_0xd373('0x25')](_0x50b987[_0xd373('0x26')]);if(_0x50b987[_0xd373('0x27')]){delete _0x50b987[_0xd373('0x27')];}_0x18d7ab[_0xd373('0x17')](_0x38ba50)[_0xd373('0x28')](_0x50b987);};}exports[_0xd373('0x29')]=function(_0xf85ca8,_0x2869e5){var _0x158825={},_0xbc420b={},_0x2ee37c={'count':0x0,'rows':[]};var _0x7dad3e=_['map'](db[_0xd373('0x2a')]['rawAttributes'],function(_0x498aaa){return{'name':_0x498aaa[_0xd373('0x2b')],'type':_0x498aaa[_0xd373('0x2c')][_0xd373('0x2d')]};});_0xbc420b[_0xd373('0x2e')]=_[_0xd373('0x2f')](_0x7dad3e,'name');_0xbc420b[_0xd373('0x30')]=_[_0xd373('0x31')](_0xf85ca8['query']);_0xbc420b[_0xd373('0x32')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],_0xbc420b[_0xd373('0x30')]);_0x158825[_0xd373('0x34')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],qs[_0xd373('0x35')](_0xf85ca8[_0xd373('0x30')]['fields']));_0x158825[_0xd373('0x34')]=_0x158825[_0xd373('0x34')][_0xd373('0x36')]?_0x158825[_0xd373('0x34')]:_0xbc420b[_0xd373('0x2e')];if(!_0xf85ca8[_0xd373('0x30')][_0xd373('0x37')](_0xd373('0x38'))){_0x158825[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x1b')]);_0x158825[_0xd373('0x19')]=qs[_0xd373('0x19')](_0xf85ca8[_0xd373('0x30')]['offset']);}_0x158825[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x3a')]);_0x158825['where']=qs[_0xd373('0x32')](_[_0xd373('0x3b')](_0xf85ca8[_0xd373('0x30')],_0xbc420b[_0xd373('0x32')]),_0x7dad3e);if(_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]){_0x158825['where']=_['merge'](_0x158825[_0xd373('0x3d')],{'$or':_['map'](_0x7dad3e,function(_0x37c97e){if(_0x37c97e[_0xd373('0x2c')]!==_0xd373('0x3e')){var _0x51ba69={};_0x51ba69[_0x37c97e[_0xd373('0x27')]]={'$like':'%'+_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]+'%'};return _0x51ba69;}})});}_0x158825=_[_0xd373('0x3f')]({},_0x158825,_0xf85ca8['options']);var _0x513038={'where':_0x158825['where']};return db[_0xd373('0x2a')]['count'](_0x513038)[_0xd373('0x23')](function(_0x2fa6c4){_0x2ee37c['count']=_0x2fa6c4;if(_0xf85ca8['query']['includeAll']){_0x158825[_0xd373('0x40')]=[{'all':!![]}];}return db[_0xd373('0x2a')][_0xd373('0x41')](_0x158825);})['then'](function(_0x5c3b22){_0x2ee37c[_0xd373('0x42')]=_0x5c3b22;return _0x2ee37c;})[_0xd373('0x23')](respondWithFilteredResult(_0x2869e5,_0x158825))['catch'](handleError(_0x2869e5,null));};exports[_0xd373('0x43')]=function(_0x2ee75f,_0x1e3de1){var _0x9989e4={'raw':!![],'where':{'id':_0x2ee75f['params']['id']}},_0x2d8c7d={};_0x2d8c7d['model']=_[_0xd373('0x31')](db[_0xd373('0x2a')][_0xd373('0x44')]);_0x2d8c7d[_0xd373('0x30')]=_['keys'](_0x2ee75f[_0xd373('0x30')]);_0x2d8c7d['filters']=_[_0xd373('0x33')](_0x2d8c7d[_0xd373('0x2e')],_0x2d8c7d[_0xd373('0x30')]);_0x9989e4[_0xd373('0x34')]=_[_0xd373('0x33')](_0x2d8c7d['model'],qs[_0xd373('0x35')](_0x2ee75f[_0xd373('0x30')]['fields']));_0x9989e4[_0xd373('0x34')]=_0x9989e4[_0xd373('0x34')][_0xd373('0x36')]?_0x9989e4[_0xd373('0x34')]:_0x2d8c7d[_0xd373('0x2e')];if(_0x2ee75f[_0xd373('0x30')][_0xd373('0x45')]){_0x9989e4[_0xd373('0x40')]=[{'all':!![]}];}_0x9989e4=_[_0xd373('0x3f')]({},_0x9989e4,_0x2ee75f[_0xd373('0x46')]);return db['WhatsappQueueReport']['find'](_0x9989e4)[_0xd373('0x23')](handleEntityNotFound(_0x1e3de1,null))['then'](respondWithResult(_0x1e3de1,null))[_0xd373('0x47')](handleError(_0x1e3de1,null));};exports['create']=function(_0x5e5279,_0x5cbc16){return db[_0xd373('0x2a')][_0xd373('0x48')](_0x5e5279[_0xd373('0x49')],{})[_0xd373('0x23')](respondWithResult(_0x5cbc16,0xc9))[_0xd373('0x47')](handleError(_0x5cbc16,null));};exports[_0xd373('0x22')]=function(_0x1855aa,_0x4d1088){if(_0x1855aa[_0xd373('0x49')]['id']){delete _0x1855aa['body']['id'];}return db[_0xd373('0x2a')][_0xd373('0x4a')]({'where':{'id':_0x1855aa['params']['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4d1088,null))['then'](saveUpdates(_0x1855aa[_0xd373('0x49')],null))[_0xd373('0x23')](respondWithResult(_0x4d1088,null))[_0xd373('0x47')](handleError(_0x4d1088,null));};exports[_0xd373('0x24')]=function(_0xe22cbd,_0x4bc631){return db['WhatsappQueueReport']['find']({'where':{'id':_0xe22cbd[_0xd373('0x4b')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4bc631,null))['then'](removeEntity(_0x4bc631,null))[_0xd373('0x47')](handleError(_0x4bc631,null));};exports[_0xd373('0x4c')]=function(_0x4d7020,_0xae7067){return db[_0xd373('0x2a')][_0xd373('0x4c')]()[_0xd373('0x23')](respondWithResult(_0xae7067,null))[_0xd373('0x47')](handleError(_0xae7067,null));}; \ No newline at end of file +var _0xa902=['ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv'];(function(_0x289e48,_0x2fe387){var _0x56d497=function(_0x2abb13){while(--_0x2abb13){_0x289e48['push'](_0x289e48['shift']());}};_0x56d497(++_0x2fe387);}(_0xa902,0x8d));var _0x2a90=function(_0x2820ed,_0x5869fc){_0x2820ed=_0x2820ed-0x0;var _0xb5cd39=_0xa902[_0x2820ed];return _0xb5cd39;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=typeof _0x1ff63d[_0x2a90('0x1b')]===_0x2a90('0x1c')&&typeof _0x1ff63d[_0x2a90('0x1d')]===_0x2a90('0x1c');var _0x10cf94=_0x21c648[_0x2a90('0x1e')];var _0x5c3e4b=_0x312782?0x0:_0x1ff63d[_0x2a90('0x1b')];var _0x1d9a28=_0x312782?_0x21c648[_0x2a90('0x1e')]:_0x1ff63d['offset']+_0x1ff63d[_0x2a90('0x1d')];var _0x1f51a6;if(_0x1d9a28>=_0x10cf94){_0x1d9a28=_0x10cf94;_0x1f51a6=0xc8;}else{_0x1f51a6=0xce;}_0x5a2682[_0x2a90('0x18')](_0x1f51a6);return _0x5a2682[_0x2a90('0x1f')](_0x2a90('0x20'),_0x5c3e4b+'-'+_0x1d9a28+'/'+_0x10cf94)[_0x2a90('0x1a')](_0x21c648);}return null;};}function patchUpdates(_0x312cd5){return function(_0x114d42){try{jsonpatch[_0x2a90('0x21')](_0x114d42,_0x312cd5,!![]);}catch(_0x465284){return BPromise[_0x2a90('0x22')](_0x465284);}return _0x114d42[_0x2a90('0x23')]();};}function saveUpdates(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')](_0x4fdd62)[_0x2a90('0x25')](function(_0x5912fd){return _0x5912fd;});}return null;};}function removeEntity(_0x180485,_0xd033d){return function(_0x4ed9e6){if(_0x4ed9e6){return _0x4ed9e6[_0x2a90('0x26')]()[_0x2a90('0x25')](function(){_0x180485[_0x2a90('0x18')](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0x2a212c,_0x1303d9){return function(_0x29ed73){if(!_0x29ed73){_0x2a212c[_0x2a90('0x17')](0x194);}return _0x29ed73;};}function handleError(_0x48c2f9,_0x27f883){_0x27f883=_0x27f883||0x1f4;return function(_0x17f978){logger[_0x2a90('0x27')](_0x17f978[_0x2a90('0x28')]);if(_0x17f978[_0x2a90('0x29')]){delete _0x17f978['name'];}_0x48c2f9['status'](_0x27f883)[_0x2a90('0x2a')](_0x17f978);};}exports['index']=function(_0x53391e,_0x4969c3){var _0x2d83b3={},_0x3c78f5={},_0x595638={'count':0x0,'rows':[]};var _0x5bd700=_[_0x2a90('0x2b')](db['WhatsappQueueReport'][_0x2a90('0x2c')],function(_0x6892e1){return{'name':_0x6892e1[_0x2a90('0x2d')],'type':_0x6892e1[_0x2a90('0x2e')][_0x2a90('0x2f')]};});_0x3c78f5[_0x2a90('0x30')]=_[_0x2a90('0x2b')](_0x5bd700,'name');_0x3c78f5[_0x2a90('0x31')]=_[_0x2a90('0x32')](_0x53391e[_0x2a90('0x31')]);_0x3c78f5['filters']=_[_0x2a90('0x33')](_0x3c78f5[_0x2a90('0x30')],_0x3c78f5[_0x2a90('0x31')]);_0x2d83b3[_0x2a90('0x34')]=_['intersection'](_0x3c78f5[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x53391e[_0x2a90('0x31')][_0x2a90('0x35')]));_0x2d83b3[_0x2a90('0x34')]=_0x2d83b3[_0x2a90('0x34')]['length']?_0x2d83b3[_0x2a90('0x34')]:_0x3c78f5[_0x2a90('0x30')];if(!_0x53391e[_0x2a90('0x31')][_0x2a90('0x36')]('nolimit')){_0x2d83b3[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x53391e['query'][_0x2a90('0x1d')]);_0x2d83b3[_0x2a90('0x1b')]=qs['offset'](_0x53391e['query'][_0x2a90('0x1b')]);}_0x2d83b3[_0x2a90('0x37')]=qs[_0x2a90('0x38')](_0x53391e['query'][_0x2a90('0x38')]);_0x2d83b3['where']=qs[_0x2a90('0x39')](_['pick'](_0x53391e[_0x2a90('0x31')],_0x3c78f5['filters']),_0x5bd700);if(_0x53391e['query'][_0x2a90('0x3a')]){_0x2d83b3['where']=_[_0x2a90('0x3b')](_0x2d83b3[_0x2a90('0x3c')],{'$or':_[_0x2a90('0x2b')](_0x5bd700,function(_0x573aee){if(_0x573aee[_0x2a90('0x2e')]!==_0x2a90('0x3d')){var _0x3be438={};_0x3be438[_0x573aee['name']]={'$like':'%'+_0x53391e[_0x2a90('0x31')][_0x2a90('0x3a')]+'%'};return _0x3be438;}})});}_0x2d83b3=_[_0x2a90('0x3b')]({},_0x2d83b3,_0x53391e['options']);var _0x1aa096={'where':_0x2d83b3[_0x2a90('0x3c')]};return db['WhatsappQueueReport'][_0x2a90('0x1e')](_0x1aa096)[_0x2a90('0x25')](function(_0x2a6bea){_0x595638[_0x2a90('0x1e')]=_0x2a6bea;if(_0x53391e[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x2d83b3[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x40')][_0x2a90('0x41')](_0x2d83b3);})[_0x2a90('0x25')](function(_0x45b41c){_0x595638[_0x2a90('0x42')]=_0x45b41c;return _0x595638;})[_0x2a90('0x25')](respondWithFilteredResult(_0x4969c3,_0x2d83b3))[_0x2a90('0x43')](handleError(_0x4969c3,null));};exports['show']=function(_0x45cbc2,_0x3a70fe){var _0x528b41={'raw':!![],'where':{'id':_0x45cbc2[_0x2a90('0x44')]['id']}},_0x1045bb={};_0x1045bb[_0x2a90('0x30')]=_[_0x2a90('0x32')](db[_0x2a90('0x40')]['rawAttributes']);_0x1045bb[_0x2a90('0x31')]=_['keys'](_0x45cbc2[_0x2a90('0x31')]);_0x1045bb['filters']=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],_0x1045bb[_0x2a90('0x31')]);_0x528b41[_0x2a90('0x34')]=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x45cbc2['query']['fields']));_0x528b41[_0x2a90('0x34')]=_0x528b41[_0x2a90('0x34')][_0x2a90('0x45')]?_0x528b41[_0x2a90('0x34')]:_0x1045bb[_0x2a90('0x30')];if(_0x45cbc2[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x528b41[_0x2a90('0x3f')]=[{'all':!![]}];}_0x528b41=_['merge']({},_0x528b41,_0x45cbc2[_0x2a90('0x46')]);return db['WhatsappQueueReport'][_0x2a90('0x47')](_0x528b41)[_0x2a90('0x25')](handleEntityNotFound(_0x3a70fe,null))['then'](respondWithResult(_0x3a70fe,null))[_0x2a90('0x43')](handleError(_0x3a70fe,null));};exports[_0x2a90('0x48')]=function(_0x280e63,_0x1d55db){return db[_0x2a90('0x40')][_0x2a90('0x48')](_0x280e63[_0x2a90('0x49')],{})['then'](respondWithResult(_0x1d55db,0xc9))['catch'](handleError(_0x1d55db,null));};exports[_0x2a90('0x24')]=function(_0x2611d0,_0x42c890){if(_0x2611d0[_0x2a90('0x49')]['id']){delete _0x2611d0[_0x2a90('0x49')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x2611d0[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x42c890,null))['then'](saveUpdates(_0x2611d0['body'],null))['then'](respondWithResult(_0x42c890,null))[_0x2a90('0x43')](handleError(_0x42c890,null));};exports['destroy']=function(_0x370da3,_0x3dfe72){return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x370da3[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x3dfe72,null))['then'](removeEntity(_0x3dfe72,null))[_0x2a90('0x43')](handleError(_0x3dfe72,null));};exports[_0x2a90('0x4a')]=function(_0x48d3bc,_0x265769){return db['WhatsappQueueReport']['describe']()[_0x2a90('0x25')](respondWithResult(_0x265769,null))[_0x2a90('0x43')](handleError(_0x265769,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index e093fc7..9ef1528 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 _0xfcea=['../../config/logger','api','moment','bluebird','request-promise','path','./whatsappQueueReport.attributes','report_whatsapp_queue','lodash'];(function(_0x4a23c1,_0x52c02e){var _0x27a476=function(_0x1cc727){while(--_0x1cc727){_0x4a23c1['push'](_0x4a23c1['shift']());}};_0x27a476(++_0x52c02e);}(_0xfcea,0x10d));var _0xafce=function(_0x243982,_0x4acb6f){_0x243982=_0x243982-0x0;var _0x237a9d=_0xfcea[_0x243982];return _0x237a9d;};'use strict';var _=require(_0xafce('0x0'));var util=require('util');var logger=require(_0xafce('0x1'))(_0xafce('0x2'));var moment=require(_0xafce('0x3'));var BPromise=require(_0xafce('0x4'));var rp=require(_0xafce('0x5'));var fs=require('fs');var path=require(_0xafce('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xafce('0x7'));module['exports']=function(_0xfb09cb,_0x5bf327){return _0xfb09cb['define']('WhatsappQueueReport',attributes,{'tableName':_0xafce('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6400=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x26e331,_0x3afe25){var _0x1a65a8=function(_0x4d675f){while(--_0x4d675f){_0x26e331['push'](_0x26e331['shift']());}};_0x1a65a8(++_0x3afe25);}(_0x6400,0xcf));var _0x0640=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0x6400[_0x13594e];return _0x1a4f42;};'use strict';var _=require(_0x0640('0x0'));var util=require(_0x0640('0x1'));var logger=require(_0x0640('0x2'))(_0x0640('0x3'));var moment=require(_0x0640('0x4'));var BPromise=require(_0x0640('0x5'));var rp=require(_0x0640('0x6'));var fs=require('fs');var path=require(_0x0640('0x7'));var rimraf=require('rimraf');var config=require(_0x0640('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0x0640('0x9')]=function(_0x5cc067,_0x203a8c){return _0x5cc067[_0x0640('0xa')](_0x0640('0xb'),attributes,{'tableName':_0x0640('0xc'),'paranoid':![],'indexes':[{'name':_0x0640('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 9518385..0054cc0 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 _0x1356=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','update','where','attributes','limit','then','UpdateWhatsappQueueReport','lodash','util','moment'];(function(_0x9c3b6b,_0x2594d2){var _0x3f00ac=function(_0x2973f6){while(--_0x2973f6){_0x9c3b6b['push'](_0x9c3b6b['shift']());}};_0x3f00ac(++_0x2594d2);}(_0x1356,0x10d));var _0x6135=function(_0x28e1f0,_0x2e4634){_0x28e1f0=_0x28e1f0-0x0;var _0x57a56c=_0x1356[_0x28e1f0];return _0x57a56c;};'use strict';var _=require(_0x6135('0x0'));var util=require(_0x6135('0x1'));var moment=require(_0x6135('0x2'));var BPromise=require(_0x6135('0x3'));var rs=require(_0x6135('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6135('0x5'))['db'];var utils=require(_0x6135('0x6'));var logger=require(_0x6135('0x7'))(_0x6135('0x8'));var config=require('../../config/environment');var jayson=require(_0x6135('0x9'));var client=jayson[_0x6135('0xa')][_0x6135('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cbd22,_0x2204cf,_0x1a1e2a){return new BPromise(function(_0x464258,_0x2e9a8a){return client['request'](_0x1cbd22,_0x1a1e2a)['then'](function(_0x4e3a73){logger[_0x6135('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2204cf,'request\x20sent');logger[_0x6135('0xd')](_0x6135('0xe'),_0x2204cf,'request\x20sent',JSON[_0x6135('0xf')](_0x4e3a73));if(_0x4e3a73[_0x6135('0x10')]){if(_0x4e3a73[_0x6135('0x10')][_0x6135('0x11')]===0x1f4){logger[_0x6135('0x10')](_0x6135('0x12'),_0x2204cf,_0x4e3a73[_0x6135('0x10')][_0x6135('0x13')]);return _0x2e9a8a(_0x4e3a73[_0x6135('0x10')][_0x6135('0x13')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x2204cf,_0x4e3a73[_0x6135('0x10')][_0x6135('0x13')]);return _0x464258(_0x4e3a73['error']['message']);}else{logger[_0x6135('0xc')](_0x6135('0x12'),_0x2204cf,'request\x20sent');_0x464258(_0x4e3a73[_0x6135('0x14')][_0x6135('0x13')]);}})[_0x6135('0x15')](function(_0x330d41){logger[_0x6135('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2204cf,_0x330d41);_0x2e9a8a(_0x330d41);});});}exports[_0x6135('0x16')]=function(_0x18e96f){var _0x8f3729=this;return new Promise(function(_0x45c95a,_0x1cd490){return db[_0x6135('0x17')][_0x6135('0x18')](_0x18e96f[_0x6135('0x19')],{'raw':_0x18e96f[_0x6135('0x1a')]?_0x18e96f[_0x6135('0x1a')][_0x6135('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x20bc97){logger[_0x6135('0xc')](_0x6135('0x16'),_0x18e96f);logger[_0x6135('0xd')](_0x6135('0x16'),_0x18e96f,JSON[_0x6135('0xf')](_0x20bc97));_0x45c95a(_0x20bc97);})[_0x6135('0x15')](function(_0x264fcc){logger['error']('CreateWhatsappQueueReport',_0x264fcc[_0x6135('0x13')],_0x18e96f);_0x1cd490(_0x8f3729[_0x6135('0x10')](0x1f4,_0x264fcc[_0x6135('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x7ba3a7){var _0x22f439=this;return new Promise(function(_0x3ffd1e,_0x171a7f){return db[_0x6135('0x17')][_0x6135('0x1c')](_0x7ba3a7['body'],{'raw':_0x7ba3a7[_0x6135('0x1a')]?_0x7ba3a7[_0x6135('0x1a')][_0x6135('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7ba3a7['options']?_0x7ba3a7['options'][_0x6135('0x1d')]||null:null,'attributes':_0x7ba3a7[_0x6135('0x1a')]?_0x7ba3a7[_0x6135('0x1a')][_0x6135('0x1e')]||null:null,'limit':_0x7ba3a7['options']?_0x7ba3a7[_0x6135('0x1a')][_0x6135('0x1f')]||null:null})[_0x6135('0x20')](function(_0x3de465){logger[_0x6135('0xc')](_0x6135('0x21'),_0x7ba3a7);logger['debug'](_0x6135('0x21'),_0x7ba3a7,JSON['stringify'](_0x3de465));_0x3ffd1e(_0x3de465);})[_0x6135('0x15')](function(_0x29ce8e){logger['error'](_0x6135('0x21'),_0x29ce8e[_0x6135('0x13')],_0x7ba3a7);_0x171a7f(_0x22f439['error'](0x1f4,_0x29ce8e['message']));});});}; \ No newline at end of file +var _0xb343=['UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','WhatsappQueueReport,\x20%s,\x20%s','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','then','update','raw','attributes','limit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb343,0xd3));var _0x3b34=function(_0x33cbc2,_0x5f33d1){_0x33cbc2=_0x33cbc2-0x0;var _0x16b882=_0xb343[_0x33cbc2];return _0x16b882;};'use strict';var _=require(_0x3b34('0x0'));var util=require(_0x3b34('0x1'));var moment=require(_0x3b34('0x2'));var BPromise=require(_0x3b34('0x3'));var rs=require(_0x3b34('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b34('0x5'))['db'];var utils=require(_0x3b34('0x6'));var logger=require('../../config/logger')(_0x3b34('0x7'));var config=require('../../config/environment');var jayson=require(_0x3b34('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x204464,_0x8f8fee,_0x5c3e21){return new BPromise(function(_0xba8894,_0x591fef){return client[_0x3b34('0x9')](_0x204464,_0x5c3e21)['then'](function(_0x11c574){logger[_0x3b34('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x8f8fee,'request\x20sent');logger[_0x3b34('0xb')](_0x3b34('0xc'),_0x8f8fee,_0x3b34('0xd'),JSON[_0x3b34('0xe')](_0x11c574));if(_0x11c574[_0x3b34('0xf')]){if(_0x11c574[_0x3b34('0xf')]['code']===0x1f4){logger[_0x3b34('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x8f8fee,_0x11c574['error']['message']);return _0x591fef(_0x11c574['error'][_0x3b34('0x10')]);}logger[_0x3b34('0xf')](_0x3b34('0x11'),_0x8f8fee,_0x11c574[_0x3b34('0xf')][_0x3b34('0x10')]);return _0xba8894(_0x11c574[_0x3b34('0xf')][_0x3b34('0x10')]);}else{logger[_0x3b34('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x8f8fee,'request\x20sent');_0xba8894(_0x11c574['result'][_0x3b34('0x10')]);}})[_0x3b34('0x12')](function(_0x4486e1){logger['error'](_0x3b34('0x11'),_0x8f8fee,_0x4486e1);_0x591fef(_0x4486e1);});});}exports[_0x3b34('0x13')]=function(_0x4c9437){var _0x598f24=this;return new Promise(function(_0x3f9ce4,_0x3219af){return db[_0x3b34('0x14')][_0x3b34('0x15')](_0x4c9437[_0x3b34('0x16')],{'raw':_0x4c9437['options']?_0x4c9437[_0x3b34('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x3b34('0x18')](function(_0x16fba9){logger[_0x3b34('0xa')]('CreateWhatsappQueueReport',_0x4c9437);logger[_0x3b34('0xb')](_0x3b34('0x13'),_0x4c9437,JSON[_0x3b34('0xe')](_0x16fba9));_0x3f9ce4(_0x16fba9);})[_0x3b34('0x12')](function(_0x3da27b){logger['error'](_0x3b34('0x13'),_0x3da27b[_0x3b34('0x10')],_0x4c9437);_0x3219af(_0x598f24[_0x3b34('0xf')](0x1f4,_0x3da27b['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x658f49){var _0x1d0407=this;return new Promise(function(_0x3abc22,_0x2126bf){return db[_0x3b34('0x14')][_0x3b34('0x19')](_0x658f49[_0x3b34('0x16')],{'raw':_0x658f49[_0x3b34('0x17')]?_0x658f49['options'][_0x3b34('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x658f49[_0x3b34('0x17')]?_0x658f49[_0x3b34('0x17')]['where']||null:null,'attributes':_0x658f49['options']?_0x658f49[_0x3b34('0x17')][_0x3b34('0x1b')]||null:null,'limit':_0x658f49[_0x3b34('0x17')]?_0x658f49[_0x3b34('0x17')][_0x3b34('0x1c')]||null:null})[_0x3b34('0x18')](function(_0x5d1218){logger['info'](_0x3b34('0x1d'),_0x658f49);logger['debug'](_0x3b34('0x1d'),_0x658f49,JSON[_0x3b34('0xe')](_0x5d1218));_0x3abc22(_0x5d1218);})[_0x3b34('0x12')](function(_0x3fe8e3){logger[_0x3b34('0xf')](_0x3b34('0x1d'),_0x3fe8e3[_0x3b34('0x10')],_0x658f49);_0x2126bf(_0x1d0407[_0x3b34('0xf')](0x1f4,_0x3fe8e3[_0x3b34('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 2616f9f..7f8d2cc 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 _0xca76=['Router','fs-extra','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x22ffbf,_0x16f31e){var _0x360c17=function(_0x40807f){while(--_0x40807f){_0x22ffbf['push'](_0x22ffbf['shift']());}};_0x360c17(++_0x16f31e);}(_0xca76,0xd7));var _0x6ca7=function(_0x5a8276,_0x1aeb59){_0x5a8276=_0x5a8276-0x0;var _0x5c725f=_0xca76[_0x5a8276];return _0x5c725f;};'use strict';var multer=require(_0x6ca7('0x0'));var util=require(_0x6ca7('0x1'));var path=require(_0x6ca7('0x2'));var timeout=require(_0x6ca7('0x3'));var express=require(_0x6ca7('0x4'));var router=express[_0x6ca7('0x5')]();var fs_extra=require(_0x6ca7('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6ca7('0x7'));var controller=require(_0x6ca7('0x8'));router[_0x6ca7('0x9')]('/',auth[_0x6ca7('0xa')](),controller['index']);router[_0x6ca7('0x9')](_0x6ca7('0xb'),auth['isAuthenticated'](),controller[_0x6ca7('0xc')]);router[_0x6ca7('0x9')](_0x6ca7('0xd'),auth[_0x6ca7('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6ca7('0xe')]);router[_0x6ca7('0xf')]('/:id',auth[_0x6ca7('0xa')](),controller[_0x6ca7('0x10')]);router[_0x6ca7('0x11')](_0x6ca7('0xd'),auth[_0x6ca7('0xa')](),controller[_0x6ca7('0x12')]);module[_0x6ca7('0x13')]=router; \ No newline at end of file +var _0x128f=['../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','update','delete','multer','util','path','express','Router','../../components/auth/service'];(function(_0x87085,_0x16229c){var _0x1e3a50=function(_0x29a362){while(--_0x29a362){_0x87085['push'](_0x87085['shift']());}};_0x1e3a50(++_0x16229c);}(_0x128f,0x150));var _0xf128=function(_0x1438c5,_0x2ca66e){_0x1438c5=_0x1438c5-0x0;var _0xf782b7=_0x128f[_0x1438c5];return _0xf782b7;};'use strict';var multer=require(_0xf128('0x0'));var util=require(_0xf128('0x1'));var path=require(_0xf128('0x2'));var timeout=require('connect-timeout');var express=require(_0xf128('0x3'));var router=express[_0xf128('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf128('0x5'));var interaction=require(_0xf128('0x6'));var config=require(_0xf128('0x7'));var controller=require(_0xf128('0x8'));router[_0xf128('0x9')]('/',auth['isAuthenticated'](),controller[_0xf128('0xa')]);router[_0xf128('0x9')](_0xf128('0xb'),auth[_0xf128('0xc')](),controller['describe']);router[_0xf128('0x9')](_0xf128('0xd'),auth['isAuthenticated'](),controller[_0xf128('0xe')]);router[_0xf128('0xf')]('/',auth[_0xf128('0xc')](),controller[_0xf128('0x10')]);router['put']('/:id',auth[_0xf128('0xc')](),controller[_0xf128('0x11')]);router[_0xf128('0x12')](_0xf128('0xd'),auth[_0xf128('0xc')](),controller['destroy']);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 c29cf0f..15af27e 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 _0xa149=['account','agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x5d31ee,_0x183e43){var _0x21c2e6=function(_0x176343){while(--_0x176343){_0x5d31ee['push'](_0x5d31ee['shift']());}};_0x21c2e6(++_0x183e43);}(_0xa149,0x18c));var _0x9a14=function(_0xf2f962,_0x3c829e){_0xf2f962=_0xf2f962-0x0;var _0x5869ab=_0xa149[_0xf2f962];return _0x5869ab;};'use strict';var Sequelize=require(_0x9a14('0x0'));module[_0x9a14('0x1')]={'uniqueid':{'type':Sequelize[_0x9a14('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9a14('0x3')](_0x9a14('0x4'),_0x9a14('0x5'),_0x9a14('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x9a14('0x7')]}}; \ No newline at end of file +var _0x5eb8=['queue','DATE','STRING','ENUM','account','agent'];(function(_0x49c54c,_0x54a647){var _0x446225=function(_0x462f62){while(--_0x462f62){_0x49c54c['push'](_0x49c54c['shift']());}};_0x446225(++_0x54a647);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x5eb8[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x85eb('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x85eb('0x1')](_0x85eb('0x2'),_0x85eb('0x3'),_0x85eb('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x85eb('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 746da4d..4d9a8ec 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 _0xc593=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappTransferReport','include','findAll','catch','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','key','query','keys','filters'];(function(_0x4e6ff1,_0x21e5f8){var _0x2567c1=function(_0x2f945b){while(--_0x2f945b){_0x4e6ff1['push'](_0x4e6ff1['shift']());}};_0x2567c1(++_0x21e5f8);}(_0xc593,0xb1));var _0x3c59=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc593[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x3c59('0x0'));var rimraf=require(_0x3c59('0x1'));var zipdir=require(_0x3c59('0x2'));var jsonpatch=require(_0x3c59('0x3'));var rp=require(_0x3c59('0x4'));var moment=require('moment');var BPromise=require(_0x3c59('0x5'));var Mustache=require(_0x3c59('0x6'));var util=require(_0x3c59('0x7'));var path=require(_0x3c59('0x8'));var sox=require('sox');var csv=require(_0x3c59('0x9'));var ejs=require(_0x3c59('0xa'));var fs=require('fs');var fs_extra=require(_0x3c59('0xb'));var _=require(_0x3c59('0xc'));var squel=require(_0x3c59('0xd'));var crypto=require(_0x3c59('0xe'));var jsforce=require(_0x3c59('0xf'));var deskjs=require(_0x3c59('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3c59('0x11'));var Papa=require('papaparse');var Redis=require(_0x3c59('0x12'));var authService=require(_0x3c59('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3c59('0x14'));var hardwareService=require(_0x3c59('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x3c59('0x16'));var config=require(_0x3c59('0x17'));var licenseUtil=require(_0x3c59('0x18'));var db=require(_0x3c59('0x19'))['db'];function respondWithStatusCode(_0x1441be,_0x13fc8f){_0x13fc8f=_0x13fc8f||0xcc;return function(_0x322104){if(_0x322104){return _0x1441be[_0x3c59('0x1a')](_0x13fc8f);}return _0x1441be[_0x3c59('0x1b')](_0x13fc8f)[_0x3c59('0x1c')]();};}function respondWithResult(_0x12d126,_0x30a3ea){_0x30a3ea=_0x30a3ea||0xc8;return function(_0x1e0f88){if(_0x1e0f88){return _0x12d126[_0x3c59('0x1b')](_0x30a3ea)[_0x3c59('0x1d')](_0x1e0f88);}};}function respondWithFilteredResult(_0x4c3f82,_0x5f0994){return function(_0x28cf07){if(_0x28cf07){var _0x4df0f7=typeof _0x5f0994['offset']===_0x3c59('0x1e')&&typeof _0x5f0994[_0x3c59('0x1f')]===_0x3c59('0x1e');var _0x300aa5=_0x28cf07['count'];var _0x1bd4d6=_0x4df0f7?0x0:_0x5f0994[_0x3c59('0x20')];var _0x4003f6=_0x4df0f7?_0x28cf07[_0x3c59('0x21')]:_0x5f0994[_0x3c59('0x20')]+_0x5f0994[_0x3c59('0x1f')];var _0x4fb3f0;if(_0x4003f6>=_0x300aa5){_0x4003f6=_0x300aa5;_0x4fb3f0=0xc8;}else{_0x4fb3f0=0xce;}_0x4c3f82[_0x3c59('0x1b')](_0x4fb3f0);return _0x4c3f82[_0x3c59('0x22')](_0x3c59('0x23'),_0x1bd4d6+'-'+_0x4003f6+'/'+_0x300aa5)['json'](_0x28cf07);}return null;};}function patchUpdates(_0x9dfc5f){return function(_0x5efe9b){try{jsonpatch[_0x3c59('0x24')](_0x5efe9b,_0x9dfc5f,!![]);}catch(_0x3c9238){return BPromise[_0x3c59('0x25')](_0x3c9238);}return _0x5efe9b['save']();};}function saveUpdates(_0x483eeb,_0x1c0e74){return function(_0x3e4906){if(_0x3e4906){return _0x3e4906[_0x3c59('0x26')](_0x483eeb)[_0x3c59('0x27')](function(_0xbf43d5){return _0xbf43d5;});}return null;};}function removeEntity(_0x59b135,_0x17b1a7){return function(_0x4b66d5){if(_0x4b66d5){return _0x4b66d5[_0x3c59('0x28')]()[_0x3c59('0x27')](function(){_0x59b135['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x109759,_0x1fe18f){return function(_0x5eeb7a){if(!_0x5eeb7a){_0x109759[_0x3c59('0x1a')](0x194);}return _0x5eeb7a;};}function handleError(_0x261415,_0x2f0174){_0x2f0174=_0x2f0174||0x1f4;return function(_0x34eb21){logger[_0x3c59('0x29')](_0x34eb21[_0x3c59('0x2a')]);if(_0x34eb21['name']){delete _0x34eb21[_0x3c59('0x2b')];}_0x261415[_0x3c59('0x1b')](_0x2f0174)[_0x3c59('0x2c')](_0x34eb21);};}exports[_0x3c59('0x2d')]=function(_0x5661fb,_0x2cac2b){var _0x3d4fd5={},_0x3abcbd={},_0xd075d4={'count':0x0,'rows':[]};var _0x196b8d=_[_0x3c59('0x2e')](db['WhatsappTransferReport']['rawAttributes'],function(_0x46ce2b){return{'name':_0x46ce2b['fieldName'],'type':_0x46ce2b['type'][_0x3c59('0x2f')]};});_0x3abcbd['model']=_[_0x3c59('0x2e')](_0x196b8d,'name');_0x3abcbd[_0x3c59('0x30')]=_[_0x3c59('0x31')](_0x5661fb['query']);_0x3abcbd[_0x3c59('0x32')]=_[_0x3c59('0x33')](_0x3abcbd[_0x3c59('0x34')],_0x3abcbd[_0x3c59('0x30')]);_0x3d4fd5[_0x3c59('0x35')]=_[_0x3c59('0x33')](_0x3abcbd[_0x3c59('0x34')],qs[_0x3c59('0x36')](_0x5661fb['query'][_0x3c59('0x36')]));_0x3d4fd5[_0x3c59('0x35')]=_0x3d4fd5['attributes'][_0x3c59('0x37')]?_0x3d4fd5[_0x3c59('0x35')]:_0x3abcbd[_0x3c59('0x34')];if(!_0x5661fb['query'][_0x3c59('0x38')](_0x3c59('0x39'))){_0x3d4fd5['limit']=qs[_0x3c59('0x1f')](_0x5661fb[_0x3c59('0x30')][_0x3c59('0x1f')]);_0x3d4fd5[_0x3c59('0x20')]=qs[_0x3c59('0x20')](_0x5661fb[_0x3c59('0x30')]['offset']);}_0x3d4fd5[_0x3c59('0x3a')]=qs[_0x3c59('0x3b')](_0x5661fb[_0x3c59('0x30')][_0x3c59('0x3b')]);_0x3d4fd5[_0x3c59('0x3c')]=qs[_0x3c59('0x32')](_[_0x3c59('0x3d')](_0x5661fb['query'],_0x3abcbd[_0x3c59('0x32')]),_0x196b8d);if(_0x5661fb[_0x3c59('0x30')][_0x3c59('0x3e')]){_0x3d4fd5['where']=_[_0x3c59('0x3f')](_0x3d4fd5[_0x3c59('0x3c')],{'$or':_[_0x3c59('0x2e')](_0x196b8d,function(_0x3f5f68){if(_0x3f5f68['type']!==_0x3c59('0x40')){var _0x22deaf={};_0x22deaf[_0x3f5f68[_0x3c59('0x2b')]]={'$like':'%'+_0x5661fb[_0x3c59('0x30')]['filter']+'%'};return _0x22deaf;}})});}_0x3d4fd5=_['merge']({},_0x3d4fd5,_0x5661fb[_0x3c59('0x41')]);var _0x1d37f8={'where':_0x3d4fd5['where']};return db[_0x3c59('0x42')][_0x3c59('0x21')](_0x1d37f8)[_0x3c59('0x27')](function(_0x2768ff){_0xd075d4[_0x3c59('0x21')]=_0x2768ff;if(_0x5661fb[_0x3c59('0x30')]['includeAll']){_0x3d4fd5[_0x3c59('0x43')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x3c59('0x44')](_0x3d4fd5);})[_0x3c59('0x27')](function(_0x29aaa2){_0xd075d4['rows']=_0x29aaa2;return _0xd075d4;})[_0x3c59('0x27')](respondWithFilteredResult(_0x2cac2b,_0x3d4fd5))[_0x3c59('0x45')](handleError(_0x2cac2b,null));};exports['show']=function(_0x1aca94,_0x5efcbf){var _0x3fa771={'raw':!![],'where':{'id':_0x1aca94[_0x3c59('0x46')]['id']}},_0x2649d8={};_0x2649d8[_0x3c59('0x34')]=_[_0x3c59('0x31')](db[_0x3c59('0x42')][_0x3c59('0x47')]);_0x2649d8[_0x3c59('0x30')]=_[_0x3c59('0x31')](_0x1aca94[_0x3c59('0x30')]);_0x2649d8['filters']=_[_0x3c59('0x33')](_0x2649d8['model'],_0x2649d8[_0x3c59('0x30')]);_0x3fa771[_0x3c59('0x35')]=_[_0x3c59('0x33')](_0x2649d8[_0x3c59('0x34')],qs['fields'](_0x1aca94[_0x3c59('0x30')][_0x3c59('0x36')]));_0x3fa771[_0x3c59('0x35')]=_0x3fa771[_0x3c59('0x35')][_0x3c59('0x37')]?_0x3fa771[_0x3c59('0x35')]:_0x2649d8[_0x3c59('0x34')];if(_0x1aca94[_0x3c59('0x30')]['includeAll']){_0x3fa771[_0x3c59('0x43')]=[{'all':!![]}];}_0x3fa771=_[_0x3c59('0x3f')]({},_0x3fa771,_0x1aca94['options']);return db[_0x3c59('0x42')]['find'](_0x3fa771)[_0x3c59('0x27')](handleEntityNotFound(_0x5efcbf,null))[_0x3c59('0x27')](respondWithResult(_0x5efcbf,null))[_0x3c59('0x45')](handleError(_0x5efcbf,null));};exports[_0x3c59('0x48')]=function(_0x3dd620,_0xd8c971){return db[_0x3c59('0x42')][_0x3c59('0x48')](_0x3dd620[_0x3c59('0x49')],{})[_0x3c59('0x27')](respondWithResult(_0xd8c971,0xc9))[_0x3c59('0x45')](handleError(_0xd8c971,null));};exports[_0x3c59('0x26')]=function(_0x1dea8a,_0x3afc67){if(_0x1dea8a[_0x3c59('0x49')]['id']){delete _0x1dea8a[_0x3c59('0x49')]['id'];}return db['WhatsappTransferReport'][_0x3c59('0x4a')]({'where':{'id':_0x1dea8a[_0x3c59('0x46')]['id']}})[_0x3c59('0x27')](handleEntityNotFound(_0x3afc67,null))[_0x3c59('0x27')](saveUpdates(_0x1dea8a[_0x3c59('0x49')],null))[_0x3c59('0x27')](respondWithResult(_0x3afc67,null))[_0x3c59('0x45')](handleError(_0x3afc67,null));};exports[_0x3c59('0x28')]=function(_0xf9bf4a,_0x2c9455){return db['WhatsappTransferReport'][_0x3c59('0x4a')]({'where':{'id':_0xf9bf4a[_0x3c59('0x46')]['id']}})[_0x3c59('0x27')](handleEntityNotFound(_0x2c9455,null))[_0x3c59('0x27')](removeEntity(_0x2c9455,null))['catch'](handleError(_0x2c9455,null));};exports[_0x3c59('0x4b')]=function(_0x432c40,_0x32078e){return db[_0x3c59('0x42')][_0x3c59('0x4b')]()[_0x3c59('0x27')](respondWithResult(_0x32078e,null))[_0x3c59('0x45')](handleError(_0x32078e,null));}; \ No newline at end of file +var _0x207a=['request-promise','bluebird','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','then','includeAll','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','rimraf','fast-json-patch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x207a,0x83));var _0xa207=function(_0x4c9357,_0xd30c4d){_0x4c9357=_0x4c9357-0x0;var _0x3464ca=_0x207a[_0x4c9357];return _0x3464ca;};'use strict';var emlformat=require(_0xa207('0x0'));var rimraf=require(_0xa207('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa207('0x2'));var rp=require(_0xa207('0x3'));var moment=require('moment');var BPromise=require(_0xa207('0x4'));var Mustache=require('mustache');var util=require(_0xa207('0x5'));var path=require('path');var sox=require(_0xa207('0x6'));var csv=require(_0xa207('0x7'));var ejs=require(_0xa207('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa207('0x9'));var crypto=require('crypto');var jsforce=require(_0xa207('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa207('0x7'));var querystring=require(_0xa207('0xb'));var Papa=require(_0xa207('0xc'));var Redis=require(_0xa207('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa207('0xe'))(_0xa207('0xf'));var utils=require(_0xa207('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x770753,_0x43742b){_0x43742b=_0x43742b||0xcc;return function(_0x1deabe){if(_0x1deabe){return _0x770753['sendStatus'](_0x43742b);}return _0x770753[_0xa207('0x11')](_0x43742b)[_0xa207('0x12')]();};}function respondWithResult(_0x2011d9,_0xd0a82e){_0xd0a82e=_0xd0a82e||0xc8;return function(_0x525e21){if(_0x525e21){return _0x2011d9['status'](_0xd0a82e)[_0xa207('0x13')](_0x525e21);}};}function respondWithFilteredResult(_0x32c907,_0x34e954){return function(_0x3322e2){if(_0x3322e2){var _0xcd2aad=typeof _0x34e954[_0xa207('0x14')]===_0xa207('0x15')&&typeof _0x34e954[_0xa207('0x16')]===_0xa207('0x15');var _0x3a233f=_0x3322e2[_0xa207('0x17')];var _0x59f735=_0xcd2aad?0x0:_0x34e954['offset'];var _0x4b33b3=_0xcd2aad?_0x3322e2[_0xa207('0x17')]:_0x34e954[_0xa207('0x14')]+_0x34e954[_0xa207('0x16')];var _0x2a4153;if(_0x4b33b3>=_0x3a233f){_0x4b33b3=_0x3a233f;_0x2a4153=0xc8;}else{_0x2a4153=0xce;}_0x32c907['status'](_0x2a4153);return _0x32c907[_0xa207('0x18')](_0xa207('0x19'),_0x59f735+'-'+_0x4b33b3+'/'+_0x3a233f)[_0xa207('0x13')](_0x3322e2);}return null;};}function patchUpdates(_0x5881d2){return function(_0x472270){try{jsonpatch[_0xa207('0x1a')](_0x472270,_0x5881d2,!![]);}catch(_0x5b3e0b){return BPromise['reject'](_0x5b3e0b);}return _0x472270['save']();};}function saveUpdates(_0x508bc3,_0x4b4396){return function(_0x41d1d1){if(_0x41d1d1){return _0x41d1d1[_0xa207('0x1b')](_0x508bc3)['then'](function(_0x44f40a){return _0x44f40a;});}return null;};}function removeEntity(_0x1a1a12,_0x221264){return function(_0x550c3f){if(_0x550c3f){return _0x550c3f[_0xa207('0x1c')]()['then'](function(){_0x1a1a12['status'](0xcc)[_0xa207('0x12')]();});}};}function handleEntityNotFound(_0x14af7d,_0x2a2659){return function(_0x19fc0a){if(!_0x19fc0a){_0x14af7d['sendStatus'](0x194);}return _0x19fc0a;};}function handleError(_0x150c06,_0x34dc12){_0x34dc12=_0x34dc12||0x1f4;return function(_0x209e75){logger[_0xa207('0x1d')](_0x209e75[_0xa207('0x1e')]);if(_0x209e75[_0xa207('0x1f')]){delete _0x209e75[_0xa207('0x1f')];}_0x150c06[_0xa207('0x11')](_0x34dc12)[_0xa207('0x20')](_0x209e75);};}exports[_0xa207('0x21')]=function(_0x527510,_0x46a947){var _0x2d4b6e={},_0x3dba66={},_0xbb6d82={'count':0x0,'rows':[]};var _0x47fc34=_[_0xa207('0x22')](db[_0xa207('0x23')]['rawAttributes'],function(_0x2247f9){return{'name':_0x2247f9[_0xa207('0x24')],'type':_0x2247f9[_0xa207('0x25')][_0xa207('0x26')]};});_0x3dba66[_0xa207('0x27')]=_[_0xa207('0x22')](_0x47fc34,_0xa207('0x1f'));_0x3dba66[_0xa207('0x28')]=_[_0xa207('0x29')](_0x527510['query']);_0x3dba66[_0xa207('0x2a')]=_[_0xa207('0x2b')](_0x3dba66['model'],_0x3dba66[_0xa207('0x28')]);_0x2d4b6e[_0xa207('0x2c')]=_['intersection'](_0x3dba66[_0xa207('0x27')],qs[_0xa207('0x2d')](_0x527510[_0xa207('0x28')][_0xa207('0x2d')]));_0x2d4b6e['attributes']=_0x2d4b6e[_0xa207('0x2c')][_0xa207('0x2e')]?_0x2d4b6e[_0xa207('0x2c')]:_0x3dba66['model'];if(!_0x527510[_0xa207('0x28')][_0xa207('0x2f')](_0xa207('0x30'))){_0x2d4b6e[_0xa207('0x16')]=qs['limit'](_0x527510[_0xa207('0x28')][_0xa207('0x16')]);_0x2d4b6e['offset']=qs[_0xa207('0x14')](_0x527510[_0xa207('0x28')]['offset']);}_0x2d4b6e['order']=qs['sort'](_0x527510['query'][_0xa207('0x31')]);_0x2d4b6e[_0xa207('0x32')]=qs['filters'](_[_0xa207('0x33')](_0x527510[_0xa207('0x28')],_0x3dba66[_0xa207('0x2a')]),_0x47fc34);if(_0x527510[_0xa207('0x28')][_0xa207('0x34')]){_0x2d4b6e['where']=_[_0xa207('0x35')](_0x2d4b6e[_0xa207('0x32')],{'$or':_[_0xa207('0x22')](_0x47fc34,function(_0xf80a82){if(_0xf80a82[_0xa207('0x25')]!=='VIRTUAL'){var _0x22ee79={};_0x22ee79[_0xf80a82[_0xa207('0x1f')]]={'$like':'%'+_0x527510[_0xa207('0x28')][_0xa207('0x34')]+'%'};return _0x22ee79;}})});}_0x2d4b6e=_[_0xa207('0x35')]({},_0x2d4b6e,_0x527510[_0xa207('0x36')]);var _0xa7dbfa={'where':_0x2d4b6e[_0xa207('0x32')]};return db['WhatsappTransferReport']['count'](_0xa7dbfa)[_0xa207('0x37')](function(_0x655da){_0xbb6d82[_0xa207('0x17')]=_0x655da;if(_0x527510['query'][_0xa207('0x38')]){_0x2d4b6e['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xa207('0x39')](_0x2d4b6e);})['then'](function(_0x32e345){_0xbb6d82[_0xa207('0x3a')]=_0x32e345;return _0xbb6d82;})[_0xa207('0x37')](respondWithFilteredResult(_0x46a947,_0x2d4b6e))[_0xa207('0x3b')](handleError(_0x46a947,null));};exports[_0xa207('0x3c')]=function(_0x2a0617,_0x11b2f0){var _0x478ba8={'raw':!![],'where':{'id':_0x2a0617['params']['id']}},_0x480fb6={};_0x480fb6['model']=_[_0xa207('0x29')](db['WhatsappTransferReport'][_0xa207('0x3d')]);_0x480fb6[_0xa207('0x28')]=_[_0xa207('0x29')](_0x2a0617[_0xa207('0x28')]);_0x480fb6[_0xa207('0x2a')]=_[_0xa207('0x2b')](_0x480fb6[_0xa207('0x27')],_0x480fb6[_0xa207('0x28')]);_0x478ba8[_0xa207('0x2c')]=_[_0xa207('0x2b')](_0x480fb6[_0xa207('0x27')],qs['fields'](_0x2a0617[_0xa207('0x28')][_0xa207('0x2d')]));_0x478ba8[_0xa207('0x2c')]=_0x478ba8[_0xa207('0x2c')][_0xa207('0x2e')]?_0x478ba8[_0xa207('0x2c')]:_0x480fb6['model'];if(_0x2a0617[_0xa207('0x28')][_0xa207('0x38')]){_0x478ba8['include']=[{'all':!![]}];}_0x478ba8=_['merge']({},_0x478ba8,_0x2a0617[_0xa207('0x36')]);return db['WhatsappTransferReport'][_0xa207('0x3e')](_0x478ba8)[_0xa207('0x37')](handleEntityNotFound(_0x11b2f0,null))['then'](respondWithResult(_0x11b2f0,null))[_0xa207('0x3b')](handleError(_0x11b2f0,null));};exports['create']=function(_0x54469e,_0x3c6d46){return db[_0xa207('0x23')][_0xa207('0x3f')](_0x54469e['body'],{})[_0xa207('0x37')](respondWithResult(_0x3c6d46,0xc9))[_0xa207('0x3b')](handleError(_0x3c6d46,null));};exports[_0xa207('0x1b')]=function(_0x296677,_0x37177b){if(_0x296677[_0xa207('0x40')]['id']){delete _0x296677['body']['id'];}return db[_0xa207('0x23')][_0xa207('0x3e')]({'where':{'id':_0x296677[_0xa207('0x41')]['id']}})[_0xa207('0x37')](handleEntityNotFound(_0x37177b,null))['then'](saveUpdates(_0x296677[_0xa207('0x40')],null))[_0xa207('0x37')](respondWithResult(_0x37177b,null))['catch'](handleError(_0x37177b,null));};exports[_0xa207('0x1c')]=function(_0x339719,_0x40571e){return db[_0xa207('0x23')]['find']({'where':{'id':_0x339719[_0xa207('0x41')]['id']}})['then'](handleEntityNotFound(_0x40571e,null))[_0xa207('0x37')](removeEntity(_0x40571e,null))['catch'](handleError(_0x40571e,null));};exports['describe']=function(_0x422fe8,_0x3c4f4c){return db[_0xa207('0x23')][_0xa207('0x42')]()[_0xa207('0x37')](respondWithResult(_0x3c4f4c,null))['catch'](handleError(_0x3c4f4c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index c7d8f15..2d373ac 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 _0xbc59=['bluebird','request-promise','rimraf','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','lodash','util','../../config/logger','api'];(function(_0x4bcc87,_0x2eece8){var _0x569f05=function(_0x594371){while(--_0x594371){_0x4bcc87['push'](_0x4bcc87['shift']());}};_0x569f05(++_0x2eece8);}(_0xbc59,0xc2));var _0x9bc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc59[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9bc5('0x0'));var util=require(_0x9bc5('0x1'));var logger=require(_0x9bc5('0x2'))(_0x9bc5('0x3'));var moment=require('moment');var BPromise=require(_0x9bc5('0x4'));var rp=require(_0x9bc5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9bc5('0x6'));var config=require('../../config/environment');var attributes=require(_0x9bc5('0x7'));module[_0x9bc5('0x8')]=function(_0x193990,_0x2713ef){return _0x193990[_0x9bc5('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x9bc5('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3de7=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','moment','bluebird','request-promise','path'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x3de7,0xd7));var _0x73de=function(_0x31bf3d,_0x4e63e6){_0x31bf3d=_0x31bf3d-0x0;var _0x150a23=_0x3de7[_0x31bf3d];return _0x150a23;};'use strict';var _=require(_0x73de('0x0'));var util=require(_0x73de('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x73de('0x2'));var BPromise=require(_0x73de('0x3'));var rp=require(_0x73de('0x4'));var fs=require('fs');var path=require(_0x73de('0x5'));var rimraf=require(_0x73de('0x6'));var config=require(_0x73de('0x7'));var attributes=require(_0x73de('0x8'));module[_0x73de('0x9')]=function(_0x40a16a,_0xcea93e){return _0x40a16a[_0x73de('0xa')](_0x73de('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x73de('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 1560f51..6e53e81 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 _0xb107=['message','WhatsappTransferReport,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x175296,_0x22773b){var _0x1ee423=function(_0x59bde9){while(--_0x59bde9){_0x175296['push'](_0x175296['shift']());}};_0x1ee423(++_0x22773b);}(_0xb107,0x14e));var _0x7b10=function(_0x37986d,_0x43d65e){_0x37986d=_0x37986d-0x0;var _0x8b724f=_0xb107[_0x37986d];return _0x8b724f;};'use strict';var _=require(_0x7b10('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7b10('0x1'));var rs=require(_0x7b10('0x2'));var fs=require('fs');var Redis=require(_0x7b10('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b10('0x4'));var logger=require(_0x7b10('0x5'))(_0x7b10('0x6'));var config=require(_0x7b10('0x7'));var jayson=require(_0x7b10('0x8'));var client=jayson['client'][_0x7b10('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x315dfd,_0x2644be,_0x510530){return new BPromise(function(_0x39c393,_0x37c787){return client[_0x7b10('0xa')](_0x315dfd,_0x510530)[_0x7b10('0xb')](function(_0x25cd03){logger[_0x7b10('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2644be,'request\x20sent');logger['debug'](_0x7b10('0xd'),_0x2644be,_0x7b10('0xe'),JSON[_0x7b10('0xf')](_0x25cd03));if(_0x25cd03[_0x7b10('0x10')]){if(_0x25cd03[_0x7b10('0x10')][_0x7b10('0x11')]===0x1f4){logger[_0x7b10('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2644be,_0x25cd03['error'][_0x7b10('0x12')]);return _0x37c787(_0x25cd03['error']['message']);}logger['error'](_0x7b10('0x13'),_0x2644be,_0x25cd03[_0x7b10('0x10')][_0x7b10('0x12')]);return _0x39c393(_0x25cd03[_0x7b10('0x10')]['message']);}else{logger[_0x7b10('0xc')](_0x7b10('0x13'),_0x2644be,_0x7b10('0xe'));_0x39c393(_0x25cd03[_0x7b10('0x14')][_0x7b10('0x12')]);}})[_0x7b10('0x15')](function(_0x58f8e8){logger[_0x7b10('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2644be,_0x58f8e8);_0x37c787(_0x58f8e8);});});} \ No newline at end of file +var _0xe17b=['request','then','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x150841,_0x48fc7c){var _0x248e69=function(_0x4ce225){while(--_0x4ce225){_0x150841['push'](_0x150841['shift']());}};_0x248e69(++_0x48fc7c);}(_0xe17b,0x182));var _0xbe17=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xe17b[_0x39f34f];return _0x59fee1;};'use strict';var _=require(_0xbe17('0x0'));var util=require(_0xbe17('0x1'));var moment=require(_0xbe17('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe17('0x3'));var fs=require('fs');var Redis=require(_0xbe17('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbe17('0x5'))(_0xbe17('0x6'));var config=require('../../config/environment');var jayson=require(_0xbe17('0x7'));var client=jayson[_0xbe17('0x8')][_0xbe17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x392843,_0x25a990,_0x5879dd){return new BPromise(function(_0x1e5d8d,_0x3d993b){return client[_0xbe17('0xa')](_0x392843,_0x5879dd)[_0xbe17('0xb')](function(_0x34024c){logger[_0xbe17('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x25a990,_0xbe17('0xd'));logger['debug'](_0xbe17('0xe'),_0x25a990,_0xbe17('0xd'),JSON[_0xbe17('0xf')](_0x34024c));if(_0x34024c[_0xbe17('0x10')]){if(_0x34024c['error'][_0xbe17('0x11')]===0x1f4){logger[_0xbe17('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x25a990,_0x34024c[_0xbe17('0x10')][_0xbe17('0x12')]);return _0x3d993b(_0x34024c[_0xbe17('0x10')][_0xbe17('0x12')]);}logger['error'](_0xbe17('0x13'),_0x25a990,_0x34024c[_0xbe17('0x10')]['message']);return _0x1e5d8d(_0x34024c[_0xbe17('0x10')][_0xbe17('0x12')]);}else{logger[_0xbe17('0xc')](_0xbe17('0x13'),_0x25a990,_0xbe17('0xd'));_0x1e5d8d(_0x34024c[_0xbe17('0x14')][_0xbe17('0x12')]);}})[_0xbe17('0x15')](function(_0x301938){logger[_0xbe17('0x10')](_0xbe17('0x13'),_0x25a990,_0x301938);_0x3d993b(_0x301938);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 79d5a3b..b622b67 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x105d=['./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','map','filter','online','name','join','Offline\x20apps:','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/logger'];(function(_0x3caefb,_0x172f93){var _0x5edb67=function(_0x48a909){while(--_0x48a909){_0x3caefb['push'](_0x3caefb['shift']());}};_0x5edb67(++_0x172f93);}(_0x105d,0x1bd));var _0xd105=function(_0x24bac6,_0x2a01df){_0x24bac6=_0x24bac6-0x0;var _0x5b399d=_0x105d[_0x24bac6];return _0x5b399d;};'use strict';var _=require(_0xd105('0x0'));var mysqldb=require(_0xd105('0x1'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0xd105('0x2'))('app');var pm2=require(_0xd105('0x3'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xd105('0x4'));var chat=require(_0xd105('0x5'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xd105('0x6'));function main(){return mysqldb['db'][_0xd105('0x7')][_0xd105('0x8')]()[_0xd105('0x9')](function(){return rpc[_0xd105('0xa')]();})[_0xd105('0x9')](function(_0x10e532){logger[_0xd105('0xb')](_0x10e532);return chat[_0xd105('0xc')]();})[_0xd105('0x9')](function(){return whatsapp[_0xd105('0xc')]();})[_0xd105('0x9')](function(){return schedule[_0xd105('0xc')]();})['then'](function(){return transcribe[_0xd105('0xc')]();})[_0xd105('0x9')](function(_0x278370){logger[_0xd105('0xb')](_0x278370);return pm2[_0xd105('0xc')](pm2Config);})[_0xd105('0x9')](function(_0x47cccd){logger[_0xd105('0xb')]('Online\x20apps:',_[_0xd105('0xd')](_[_0xd105('0xe')](_0x47cccd,{'status':_0xd105('0xf')}),_0xd105('0x10'))[_0xd105('0x11')]());logger[_0xd105('0xb')](_0xd105('0x12'),_[_0xd105('0xd')](_[_0xd105('0xe')](_0x47cccd,function(_0x4b7962){return _0x4b7962['status']!==_0xd105('0xf');}),_0xd105('0x10'))[_0xd105('0x11')]()||_0xd105('0x13'));config[_0xd105('0x14')]&&require(_0xd105('0x15'))[_0xd105('0x16')]();require(_0xd105('0x17'))[_0xd105('0x16')]();})[_0xd105('0x18')](function(_0x1ebf3a){logger[_0xd105('0x19')](_0xd105('0x1a'),_0x1ebf3a);process[_0xd105('0x1b')](0x1);});}main(); \ No newline at end of file +var _0xac5b=['./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','online','join','Offline\x20apps:','status','name','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat'];(function(_0x27e4cc,_0x50e9ce){var _0x510182=function(_0x470aac){while(--_0x470aac){_0x27e4cc['push'](_0x27e4cc['shift']());}};_0x510182(++_0x50e9ce);}(_0xac5b,0x19e));var _0xbac5=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0xac5b[_0x5519a9];return _0x32f2cc;};'use strict';var _=require('lodash');var mysqldb=require(_0xbac5('0x0'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0xbac5('0x1'))(_0xbac5('0x2'));var pm2=require('./config/pm2');var pm2Config=require(_0xbac5('0x3'));var schedule=require(_0xbac5('0x4'));var chat=require(_0xbac5('0x5'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xbac5('0x6'));function main(){return mysqldb['db'][_0xbac5('0x7')][_0xbac5('0x8')]()[_0xbac5('0x9')](function(){return rpc[_0xbac5('0xa')]();})[_0xbac5('0x9')](function(_0x16aa2a){logger[_0xbac5('0xb')](_0x16aa2a);return chat['start']();})['then'](function(){return whatsapp[_0xbac5('0xc')]();})[_0xbac5('0x9')](function(){return schedule[_0xbac5('0xc')]();})['then'](function(){return transcribe['start']();})[_0xbac5('0x9')](function(_0x28315e){logger[_0xbac5('0xb')](_0x28315e);return pm2[_0xbac5('0xc')](pm2Config);})[_0xbac5('0x9')](function(_0x5068f0){logger[_0xbac5('0xb')](_0xbac5('0xd'),_[_0xbac5('0xe')](_[_0xbac5('0xf')](_0x5068f0,{'status':_0xbac5('0x10')}),'name')[_0xbac5('0x11')]());logger[_0xbac5('0xb')](_0xbac5('0x12'),_[_0xbac5('0xe')](_[_0xbac5('0xf')](_0x5068f0,function(_0x1ae693){return _0x1ae693[_0xbac5('0x13')]!==_0xbac5('0x10');}),_0xbac5('0x14'))[_0xbac5('0x11')]()||_0xbac5('0x15'));config[_0xbac5('0x16')]&&require(_0xbac5('0x17'))[_0xbac5('0x18')]();require(_0xbac5('0x19'))['default']();})[_0xbac5('0x1a')](function(_0xaa1734){logger[_0xbac5('0x1b')](_0xbac5('0x1c'),_0xaa1734);process[_0xbac5('0x1d')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 99491b5..ed52a17 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 _0x9329=['phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','name','pass','Bearer','Unknown\x20authorization\x20format','query','getUuid','Setting','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','HS512','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','email','permissions','md5secret','voicePause','faxPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording'];(function(_0x3fb0de,_0x48b64c){var _0x5a3090=function(_0x1356a7){while(--_0x1356a7){_0x3fb0de['push'](_0x3fb0de['shift']());}};_0x5a3090(++_0x48b64c);}(_0x9329,0x15c));var _0x9932=function(_0x2080e5,_0x5b6dbf){_0x2080e5=_0x2080e5-0x0;var _0x42d17c=_0x9329[_0x2080e5];return _0x42d17c;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9932('0x0'));var hardwareConf=require(_0x9932('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x9932('0x2'));var jwt=require(_0x9932('0x3'));var expressJwt=require(_0x9932('0x4'));var compose=require(_0x9932('0x5'));var basicAuth=require(_0x9932('0x6'));var crypto=require('crypto');var BPromise=require(_0x9932('0x7'));var util=require(_0x9932('0x8'));var moment=require(_0x9932('0x9'));var validateJwt=expressJwt({'secret':config[_0x9932('0xa')][_0x9932('0xb')]});var userAttributes=['id',_0x9932('0xc'),_0x9932('0xd'),'name','internal',_0x9932('0xe'),'userpic',_0x9932('0xf'),_0x9932('0x10'),_0x9932('0x11'),'chatPause','mailPause',_0x9932('0x12'),'smsPause',_0x9932('0x13'),_0x9932('0x14'),_0x9932('0x15'),'lastLoginAt',_0x9932('0x16'),_0x9932('0x17'),_0x9932('0x18'),_0x9932('0x19'),_0x9932('0x1a'),'phoneBarAutoAnswer',_0x9932('0x1b'),_0x9932('0x1c'),_0x9932('0x1d'),'phoneBarEnableDtmfTone',_0x9932('0x1e'),'phoneBarExpires','phoneBarPrefixRequired',_0x9932('0x1f'),_0x9932('0x20'),'hotdesk',_0x9932('0x21'),_0x9932('0x22'),_0x9932('0x23'),_0x9932('0x24'),_0x9932('0x25'),_0x9932('0x26'),'downloadOmnichannelInteractions',_0x9932('0x27')];exports[_0x9932('0x28')]=function(){return this[_0x9932('0x29')](!![])[_0x9932('0x2a')](function(_0x59be82,_0x23909d,_0x4db544){if(_0x59be82[_0x9932('0x2b')]){_0x4db544();}else{return db[_0x9932('0x2c')][_0x9932('0x2d')]({'where':{'id':_0x59be82['params']['id']},'attributes':['id',_0x9932('0x2e'),_0x9932('0x2f')],'raw':!![]})[_0x9932('0x30')](function(_0x5724ab){if(_0x5724ab&&_0x5724ab[_0x9932('0x2e')]){return _0x23909d[_0x9932('0x31')](_0x5724ab[_0x9932('0x2f')]===_0x9932('0x32')?0x195:0x193)[_0x9932('0x33')]({'message':_0x5724ab[_0x9932('0x2f')]===_0x9932('0x32')?_0x9932('0x34'):_0x9932('0x35')});}else{_0x4db544();}})[_0x9932('0x36')](function(_0x4d9d6b){_0x4db544(_0x4d9d6b);});}});};exports[_0x9932('0x29')]=function isAuthenticated(_0x51034d){return compose()[_0x9932('0x2a')](function(_0x9b9fe9,_0x1b0f6f,_0x17568c){var _0x3431a9;if(_0x9b9fe9['headers'][_0x9932('0x37')]){if(_[_0x9932('0x38')](_0x9b9fe9[_0x9932('0x39')][_0x9932('0x37')],_0x9932('0x3a'))){var _0x56ca08=basicAuth(_0x9b9fe9);db[_0x9932('0x3b')][_0x9932('0x3c')]({'where':{'name':_0x56ca08[_0x9932('0x3d')]}})['then'](function(_0x90a2b6){if(!_0x90a2b6||!_0x90a2b6['authenticate'](_0x56ca08[_0x9932('0x3e')])){return _0x1b0f6f['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x9b9fe9['user']={'id':_0x90a2b6['id']};_0x17568c();})[_0x9932('0x36')](function(_0x1542c1){_0x17568c(_0x1542c1);});}else if(_[_0x9932('0x38')](_0x9b9fe9[_0x9932('0x39')]['authorization'],_0x9932('0x3f'))){validateJwt(_0x9b9fe9,_0x1b0f6f,_0x17568c);}else{if(_0x51034d){_0x17568c();}else{return _0x1b0f6f['status'](0x193)[_0x9932('0x33')]({'message':_0x9932('0x40')});}}}else if(_0x9b9fe9[_0x9932('0x41')]['apikey']){try{var _0x4c6e9b={'audience':hardwareConf[_0x9932('0x42')](),'issuer':hardwareConf[_0x9932('0x42')]()};verifyJwt(_0x9b9fe9['query']['apikey'],_0x4c6e9b)[_0x9932('0x30')](function(_0x44d1d6){return db[_0x9932('0x3b')][_0x9932('0x3c')]({'where':{'id':_0x44d1d6['sub']}})[_0x9932('0x30')](function(_0x199b3d){_0x3431a9=_0x199b3d;return db[_0x9932('0x43')]['findOne']({'where':{'id':0x1},'attributes':[_0x9932('0x44'),_0x9932('0x45')],'raw':!![]});})[_0x9932('0x30')](function(_0xe12c64){if(!_0x3431a9||!_[_0x9932('0x46')](_0x3431a9['apiKeyNonce'],_0x44d1d6['nonce'])){return _0x1b0f6f[_0x9932('0x31')](0x191)[_0x9932('0x33')]({'message':_0x9932('0x47')});}if(_0x3431a9[_0x9932('0x48')]){return _0x1b0f6f[_0x9932('0x31')](0x191)['json']({'message':_0x9932('0x49')});}if(_0x3431a9[_0x9932('0x4a')]){if(_0xe12c64[_0x9932('0x45')]>0x0){if(moment(_0x3431a9[_0x9932('0x4b')])[_0x9932('0x4c')](_0xe12c64[_0x9932('0x45')],_0x9932('0x4d'))>moment()){return _0x1b0f6f[_0x9932('0x31')](0x191)['json']({'message':_0x9932('0x49')});}}else{return _0x1b0f6f[_0x9932('0x31')](0x191)[_0x9932('0x33')]({'message':_0x9932('0x49')});}}_0x9b9fe9[_0x9932('0x2b')]={'id':_0x3431a9['id']};_0x17568c();});})[_0x9932('0x36')](function(){return _0x1b0f6f[_0x9932('0x31')](0x191)[_0x9932('0x33')]({'message':_0x9932('0x49')});});}catch(_0x44c87f){_0x17568c(_0x44c87f);}}else if(_0x51034d){_0x17568c();}else{return _0x1b0f6f['status'](0x193)[_0x9932('0x33')]({'message':_0x9932('0x40')});}})[_0x9932('0x2a')](function(_0x417058,_0x388d35,_0x2e5531){if(_0x417058[_0x9932('0x2b')]){db[_0x9932('0x3b')][_0x9932('0x3c')]({'where':{'id':_0x417058[_0x9932('0x2b')]['id']},'attributes':userAttributes})[_0x9932('0x30')](function(_0x247ea4){if(!_0x247ea4){return _0x388d35[_0x9932('0x31')](0x194)[_0x9932('0x33')]({'message':_0x9932('0x4e')});}_0x417058[_0x9932('0x2b')]=_0x247ea4;_0x2e5531();})[_0x9932('0x36')](function(_0x55c7d9){_0x2e5531(_0x55c7d9);});}else if(_0x51034d){_0x2e5531();}else{return _0x388d35[_0x9932('0x31')](0x194)['json']({'message':_0x9932('0x4f')});}});};exports[_0x9932('0x50')]=function canUpdate(){return compose()[_0x9932('0x2a')](function(_0x3c023a,_0x31481e,_0x288d9d){return licenseUtil['getLicense']()[_0x9932('0x30')](function(_0xa0767e){if(_0xa0767e[_0x9932('0x51')]){_0x288d9d();}else{return _0x31481e[_0x9932('0x31')](0x193)[_0x9932('0x33')]({'message':_0x9932('0x52')});}})[_0x9932('0x36')](function(_0xc4ae6d){_0x288d9d(_0xc4ae6d);});});};exports[_0x9932('0x53')]=function(_0xc64f45,_0x5356c8,_0x27565a){_0xc64f45[_0x9932('0x53')]=!![];return _0x27565a();};exports[_0x9932('0x54')]=function signToken(_0x507003){return signJwt(_0x507003);};exports[_0x9932('0x55')]=function(_0x2007ff,_0x160949){if(!_0x2007ff[_0x9932('0x2b')]){return _0x160949[_0x9932('0x31')](0x194)[_0x9932('0x33')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5d3c82={'payload':{'id':_0x2007ff[_0x9932('0x2b')]['id'],'role':_0x2007ff['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x5d3c82)[_0x9932('0x30')](function(_0x311e84){_0x160949[_0x9932('0x56')](_0x9932('0x57'),_0x311e84);_0x160949[_0x9932('0x58')]('/dashboards/general');})[_0x9932('0x36')](function(_0x14eaf5){return _0x160949[_0x9932('0x31')](0x1f4)[_0x9932('0x59')](_0x14eaf5);});};exports[_0x9932('0x5a')]=function(_0x3315a0){if(_[_0x9932('0x5b')](_0x3315a0[_0x9932('0x5c')])||_[_0x9932('0x5b')](_0x3315a0[_0x9932('0x5d')])){return null;}else{return createJwt(_0x3315a0);}};exports[_0x9932('0x5e')]=function(_0x10a92c){_0x10a92c['apiKeyNonce']=generateNonce();_0x10a92c[_0x9932('0x5d')]=generateIssuedAt();return createJwt(_0x10a92c);};exports[_0x9932('0x5f')]=function(_0x4b54e2,_0x25be28){var _0x2227ef=_0x4b54e2[_0x9932('0x41')][_0x9932('0x60')];if(_0x2227ef){var _0x1ec74e={'nonce':_0x25be28[_0x9932('0x5c')],'iat':_0x25be28[_0x9932('0x5d')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x2227ef,_0x1ec74e)['then'](function(){return generateApiKey(_0x25be28);});}else{throw{'message':_0x9932('0x61')};}};exports[_0x9932('0x62')]=function(_0x34f343){var _0x2c215e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2c215e[_0x9932('0x63')](_0x34f343))throw new db[(_0x9932('0x64'))]['ValidationError'](_0x9932('0x65'));return;};exports[_0x9932('0x66')]=function(_0x59f75d,_0x1969e3,_0x199277){var _0x3925e8=encryptor[_0x9932('0x67')](_0x1969e3)[_0x9932('0x68')](',');for(var _0x28d2a2=0x0;_0x28d2a2<_0x199277;_0x28d2a2++){if(!_0x3925e8[_0x28d2a2])break;if(_0x59f75d[_0x9932('0x69')]()===_0x3925e8[_0x28d2a2]['toLowerCase']()){var _0x310e5c=util[_0x9932('0x6a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x199277);if(_0x199277===0x1){_0x310e5c=_0x9932('0x6b');}throw new db[(_0x9932('0x64'))][(_0x9932('0x6c'))](_0x310e5c);}}return;};exports[_0x9932('0x6d')]=function(_0xfb9209,_0x8f002f){var _0xdefa32=_0x8f002f?encryptor[_0x9932('0x67')](_0x8f002f)[_0x9932('0x68')](','):[];if(_0xdefa32[_0x9932('0x6e')]===0x5){_0xdefa32[_0x9932('0x6f')](-0x1,0x1);}_0xdefa32[_0x9932('0x70')](_0xfb9209);return encryptor[_0x9932('0x71')](_0xdefa32[_0x9932('0x72')](','));};function signJwt(_0x5a735c){var _0x45c5f9=BPromise[_0x9932('0x73')](jwt[_0x9932('0x74')],{'context':jwt});var _0xd82a7b=_0x5a735c[_0x9932('0x75')]||config[_0x9932('0xa')][_0x9932('0xb')];return new BPromise(function(_0x52ad84,_0x1d058c){_0x45c5f9(_0x5a735c[_0x9932('0x76')],_0xd82a7b,_0x5a735c[_0x9932('0x77')])[_0x9932('0x30')](function(_0x3a389d){_0x52ad84(_0x3a389d);})['catch'](function(_0x239d15){_0x1d058c(_0x239d15);});});}function verifyJwt(_0x425db2,_0x359a40,_0x3165e5){var _0x28270d=BPromise[_0x9932('0x73')](jwt[_0x9932('0x78')],{'context':jwt});var _0x2b9234=_0x3165e5||config[_0x9932('0xa')][_0x9932('0xb')];return new BPromise(function(_0x3c7215,_0x212e3f){_0x28270d(_0x425db2,_0x2b9234,_0x359a40)[_0x9932('0x30')](function(_0x3b4f5e){_0x3c7215(_0x3b4f5e);})['catch'](function(_0x1531b0){_0x212e3f(_0x1531b0);});});}function generateNonce(){return crypto[_0x9932('0x79')](0x10)[_0x9932('0x7a')](_0x9932('0x7b'));}function generateIssuedAt(){return Math[_0x9932('0x7c')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x935215){var _0x488d99={'payload':{'iat':_0x935215['apiKeyIat'],'nonce':_0x935215[_0x9932('0x5c')]},'options':{'algorithm':_0x9932('0x7d'),'subject':_0x935215['id'][_0x9932('0x7a')](),'issuer':hardwareConf[_0x9932('0x42')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x488d99)[_0x9932('0x30')](function(_0x50c21a){return{'iat':_0x935215[_0x9932('0x5d')],'nonce':_0x935215['apiKeyNonce'],'token':_0x50c21a};});} \ No newline at end of file +var _0x06ec=['isAuthenticated','headers','authorization','startsWith','Basic','User','find','name','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','nonce','disabled','blocked','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','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~!@#$%^&-_=+[{]}.','decryptString','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','unshift','encryptString','join','promisify','sign','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/util','../encryptor','jsonwebtoken','composable-middleware','basic-auth','crypto','util','moment','secrets','session','role','fullname','internal','permissions','voicePause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x06ec,0x135));var _0xc06e=function(_0x13e139,_0x52ff63){_0x13e139=_0x13e139-0x0;var _0x14f091=_0x06ec[_0x13e139];return _0x14f091;};'use strict';var db=require(_0xc06e('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xc06e('0x1'));var encryptor=require(_0xc06e('0x2'));var _=require('lodash');var jwt=require(_0xc06e('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xc06e('0x4'));var basicAuth=require(_0xc06e('0x5'));var crypto=require(_0xc06e('0x6'));var BPromise=require('bluebird');var util=require(_0xc06e('0x7'));var moment=require(_0xc06e('0x8'));var validateJwt=expressJwt({'secret':config[_0xc06e('0x9')][_0xc06e('0xa')]});var userAttributes=['id',_0xc06e('0xb'),_0xc06e('0xc'),'name',_0xc06e('0xd'),'email','userpic',_0xc06e('0xe'),'md5secret',_0xc06e('0xf'),'chatPause',_0xc06e('0x10'),_0xc06e('0x11'),'smsPause',_0xc06e('0x12'),_0xc06e('0x13'),_0xc06e('0x14'),'lastLoginAt',_0xc06e('0x15'),'crudPermissions',_0xc06e('0x16'),_0xc06e('0x17'),_0xc06e('0x18'),_0xc06e('0x19'),_0xc06e('0x1a'),_0xc06e('0x1b'),_0xc06e('0x1c'),'phoneBarEnableDtmfTone',_0xc06e('0x1d'),_0xc06e('0x1e'),'phoneBarPrefixRequired',_0xc06e('0x1f'),_0xc06e('0x20'),_0xc06e('0x21'),_0xc06e('0x22'),_0xc06e('0x23'),_0xc06e('0x24'),_0xc06e('0x25'),_0xc06e('0x26'),_0xc06e('0x27'),_0xc06e('0x28'),_0xc06e('0x29')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0xc06e('0x2a')](function(_0xd92cd8,_0x32b1e5,_0x53d2bd){if(_0xd92cd8[_0xc06e('0x2b')]){_0x53d2bd();}else{return db[_0xc06e('0x2c')]['findOne']({'where':{'id':_0xd92cd8[_0xc06e('0x2d')]['id']},'attributes':['id',_0xc06e('0x2e'),_0xc06e('0x2f')],'raw':!![]})[_0xc06e('0x30')](function(_0x30d00c){if(_0x30d00c&&_0x30d00c[_0xc06e('0x2e')]){return _0x32b1e5[_0xc06e('0x31')](_0x30d00c[_0xc06e('0x2f')]===_0xc06e('0x32')?0x195:0x193)[_0xc06e('0x33')]({'message':_0x30d00c[_0xc06e('0x2f')]===_0xc06e('0x32')?_0xc06e('0x34'):'Forbidden.'});}else{_0x53d2bd();}})[_0xc06e('0x35')](function(_0x2b0f4a){_0x53d2bd(_0x2b0f4a);});}});};exports[_0xc06e('0x36')]=function isAuthenticated(_0x39ecab){return compose()[_0xc06e('0x2a')](function(_0x440fb1,_0x1a48b7,_0x105f68){var _0x567d0b;if(_0x440fb1[_0xc06e('0x37')][_0xc06e('0x38')]){if(_[_0xc06e('0x39')](_0x440fb1[_0xc06e('0x37')][_0xc06e('0x38')],_0xc06e('0x3a'))){var _0x4a9ccd=basicAuth(_0x440fb1);db[_0xc06e('0x3b')][_0xc06e('0x3c')]({'where':{'name':_0x4a9ccd[_0xc06e('0x3d')]}})['then'](function(_0x82d093){if(!_0x82d093||!_0x82d093['authenticate'](_0x4a9ccd['pass'])){return _0x1a48b7[_0xc06e('0x31')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x440fb1[_0xc06e('0x2b')]={'id':_0x82d093['id']};_0x105f68();})[_0xc06e('0x35')](function(_0x35900b){_0x105f68(_0x35900b);});}else if(_[_0xc06e('0x39')](_0x440fb1['headers'][_0xc06e('0x38')],'Bearer')){validateJwt(_0x440fb1,_0x1a48b7,_0x105f68);}else{if(_0x39ecab){_0x105f68();}else{return _0x1a48b7[_0xc06e('0x31')](0x193)[_0xc06e('0x33')]({'message':_0xc06e('0x3e')});}}}else if(_0x440fb1[_0xc06e('0x3f')][_0xc06e('0x40')]){try{var _0x21fa7c={'audience':hardwareConf[_0xc06e('0x41')](),'issuer':hardwareConf[_0xc06e('0x41')]()};verifyJwt(_0x440fb1[_0xc06e('0x3f')][_0xc06e('0x40')],_0x21fa7c)['then'](function(_0xf5df){return db[_0xc06e('0x3b')][_0xc06e('0x3c')]({'where':{'id':_0xf5df[_0xc06e('0x42')]}})['then'](function(_0x46279d){_0x567d0b=_0x46279d;return db[_0xc06e('0x43')][_0xc06e('0x44')]({'where':{'id':0x1},'attributes':[_0xc06e('0x45'),_0xc06e('0x46')],'raw':!![]});})[_0xc06e('0x30')](function(_0x48c463){if(!_0x567d0b||!_[_0xc06e('0x47')](_0x567d0b['apiKeyNonce'],_0xf5df[_0xc06e('0x48')])){return _0x1a48b7['status'](0x191)[_0xc06e('0x33')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x567d0b[_0xc06e('0x49')]){return _0x1a48b7[_0xc06e('0x31')](0x191)[_0xc06e('0x33')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x567d0b[_0xc06e('0x4a')]){if(_0x48c463[_0xc06e('0x46')]>0x0){if(moment(_0x567d0b['blockedAt'])[_0xc06e('0x4b')](_0x48c463['blockDuration'],_0xc06e('0x4c'))>moment()){return _0x1a48b7[_0xc06e('0x31')](0x191)['json']({'message':_0xc06e('0x4d')});}}else{return _0x1a48b7['status'](0x191)[_0xc06e('0x33')]({'message':_0xc06e('0x4d')});}}_0x440fb1[_0xc06e('0x2b')]={'id':_0x567d0b['id']};_0x105f68();});})[_0xc06e('0x35')](function(){return _0x1a48b7[_0xc06e('0x31')](0x191)[_0xc06e('0x33')]({'message':_0xc06e('0x4d')});});}catch(_0x1c8e77){_0x105f68(_0x1c8e77);}}else if(_0x39ecab){_0x105f68();}else{return _0x1a48b7[_0xc06e('0x31')](0x193)['json']({'message':_0xc06e('0x3e')});}})[_0xc06e('0x2a')](function(_0x4ae7b0,_0x82bbdd,_0x1f682c){if(_0x4ae7b0['user']){db['User'][_0xc06e('0x3c')]({'where':{'id':_0x4ae7b0[_0xc06e('0x2b')]['id']},'attributes':userAttributes})[_0xc06e('0x30')](function(_0x5081cb){if(!_0x5081cb){return _0x82bbdd[_0xc06e('0x31')](0x194)['json']({'message':_0xc06e('0x4e')});}_0x4ae7b0['user']=_0x5081cb;_0x1f682c();})[_0xc06e('0x35')](function(_0x56b6f7){_0x1f682c(_0x56b6f7);});}else if(_0x39ecab){_0x1f682c();}else{return _0x82bbdd[_0xc06e('0x31')](0x194)[_0xc06e('0x33')]({'message':_0xc06e('0x4f')});}});};exports[_0xc06e('0x50')]=function canUpdate(){return compose()[_0xc06e('0x2a')](function(_0x46dd3a,_0x3edae0,_0x4bb0de){return licenseUtil['getLicense']()['then'](function(_0x44c22d){if(_0x44c22d[_0xc06e('0x51')]){_0x4bb0de();}else{return _0x3edae0[_0xc06e('0x31')](0x193)['json']({'message':_0xc06e('0x52')});}})[_0xc06e('0x35')](function(_0x4e748e){_0x4bb0de(_0x4e748e);});});};exports[_0xc06e('0x53')]=function(_0x3a37a0,_0x87d97b,_0x18e9e3){_0x3a37a0[_0xc06e('0x53')]=!![];return _0x18e9e3();};exports[_0xc06e('0x54')]=function signToken(_0x4c0ab7){return signJwt(_0x4c0ab7);};exports[_0xc06e('0x55')]=function(_0x176b89,_0x3f7fe8){if(!_0x176b89[_0xc06e('0x2b')]){return _0x3f7fe8['status'](0x194)[_0xc06e('0x33')]({'message':_0xc06e('0x56')});}var _0x197aea={'payload':{'id':_0x176b89[_0xc06e('0x2b')]['id'],'role':_0x176b89[_0xc06e('0x2b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x197aea)[_0xc06e('0x30')](function(_0xca07c6){_0x3f7fe8[_0xc06e('0x57')](_0xc06e('0x58'),_0xca07c6);_0x3f7fe8[_0xc06e('0x59')](_0xc06e('0x5a'));})['catch'](function(_0x35d957){return _0x3f7fe8[_0xc06e('0x31')](0x1f4)[_0xc06e('0x5b')](_0x35d957);});};exports[_0xc06e('0x5c')]=function(_0x5f1c7b){if(_['isNil'](_0x5f1c7b[_0xc06e('0x5d')])||_['isNil'](_0x5f1c7b[_0xc06e('0x5e')])){return null;}else{return createJwt(_0x5f1c7b);}};exports[_0xc06e('0x5f')]=function(_0x160d37){_0x160d37['apiKeyNonce']=generateNonce();_0x160d37[_0xc06e('0x5e')]=generateIssuedAt();return createJwt(_0x160d37);};exports[_0xc06e('0x60')]=function(_0x8ca4de,_0x543660){var _0x2637f4=_0x8ca4de[_0xc06e('0x3f')][_0xc06e('0x40')];if(_0x2637f4){var _0x6159cb={'nonce':_0x543660[_0xc06e('0x5d')],'iat':_0x543660[_0xc06e('0x5e')],'audience':hardwareConf[_0xc06e('0x41')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x2637f4,_0x6159cb)[_0xc06e('0x30')](function(){return generateApiKey(_0x543660);});}else{throw{'message':_0xc06e('0x61')};}};exports['validatePasswordPattern']=function(_0x3cd99f){var _0x35a7d5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x35a7d5[_0xc06e('0x62')](_0x3cd99f))throw new db[(_0xc06e('0x63'))][(_0xc06e('0x64'))](_0xc06e('0x65'));return;};exports['validatePasswordHistory']=function(_0x36f01c,_0x2cb028,_0x11c727){var _0x321be8=encryptor[_0xc06e('0x66')](_0x2cb028)['split'](',');for(var _0x56ae26=0x0;_0x56ae26<_0x11c727;_0x56ae26++){if(!_0x321be8[_0x56ae26])break;if(_0x36f01c['toLowerCase']()===_0x321be8[_0x56ae26]['toLowerCase']()){var _0x227d8e=util[_0xc06e('0x67')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x11c727);if(_0x11c727===0x1){_0x227d8e=_0xc06e('0x68');}throw new db[(_0xc06e('0x63'))][(_0xc06e('0x64'))](_0x227d8e);}}return;};exports[_0xc06e('0x69')]=function(_0x10a1dd,_0x4b7d1b){var _0x1fb988=_0x4b7d1b?encryptor[_0xc06e('0x66')](_0x4b7d1b)[_0xc06e('0x6a')](','):[];if(_0x1fb988[_0xc06e('0x6b')]===0x5){_0x1fb988[_0xc06e('0x6c')](-0x1,0x1);}_0x1fb988[_0xc06e('0x6d')](_0x10a1dd);return encryptor[_0xc06e('0x6e')](_0x1fb988[_0xc06e('0x6f')](','));};function signJwt(_0x33da81){var _0x23ac62=BPromise[_0xc06e('0x70')](jwt[_0xc06e('0x71')],{'context':jwt});var _0xd69257=_0x33da81['secret']||config[_0xc06e('0x9')][_0xc06e('0xa')];return new BPromise(function(_0x49bd49,_0x4a3796){_0x23ac62(_0x33da81['payload'],_0xd69257,_0x33da81['options'])['then'](function(_0x4779cb){_0x49bd49(_0x4779cb);})['catch'](function(_0x4db324){_0x4a3796(_0x4db324);});});}function verifyJwt(_0xacdeaf,_0xcb92c6,_0x31e0c7){var _0x247050=BPromise[_0xc06e('0x70')](jwt[_0xc06e('0x72')],{'context':jwt});var _0x1e0c6e=_0x31e0c7||config[_0xc06e('0x9')][_0xc06e('0xa')];return new BPromise(function(_0x5150ff,_0x1d9a7d){_0x247050(_0xacdeaf,_0x1e0c6e,_0xcb92c6)['then'](function(_0x3799cf){_0x5150ff(_0x3799cf);})[_0xc06e('0x35')](function(_0x347934){_0x1d9a7d(_0x347934);});});}function generateNonce(){return crypto[_0xc06e('0x73')](0x10)[_0xc06e('0x74')](_0xc06e('0x75'));}function generateIssuedAt(){return Math[_0xc06e('0x76')](Date[_0xc06e('0x77')]()/0x3e8)[_0xc06e('0x74')]();}function createJwt(_0x4e686c){var _0x456071={'payload':{'iat':_0x4e686c[_0xc06e('0x5e')],'nonce':_0x4e686c[_0xc06e('0x5d')]},'options':{'algorithm':_0xc06e('0x78'),'subject':_0x4e686c['id'][_0xc06e('0x74')](),'issuer':hardwareConf[_0xc06e('0x41')](),'audience':hardwareConf[_0xc06e('0x41')]()}};return signJwt(_0x456071)[_0xc06e('0x30')](function(_0x2d01c8){return{'iat':_0x4e686c['apiKeyIat'],'nonce':_0x4e686c[_0xc06e('0x5d')],'token':_0x2d01c8};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index c9bb21d..a2e4f64 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 _0x48a8=['hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','close','unlink','decryptFile','utf8','base64','final','decryptString','lodash','../../config/environment','session','aes-256-ctr','aes192','algorithm','join','error','encrypt','test','indexOf'];(function(_0x1fcc97,_0x1f2d7d){var _0x118815=function(_0x325585){while(--_0x325585){_0x1fcc97['push'](_0x1fcc97['shift']());}};_0x118815(++_0x1f2d7d);}(_0x48a8,0x199));var _0x848a=function(_0xa9416a,_0x466fb2){_0xa9416a=_0xa9416a-0x0;var _0x4d1835=_0x48a8[_0xa9416a];return _0x4d1835;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x848a('0x0'));var config=require(_0x848a('0x1'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x848a('0x2')],'algorithm':_0x848a('0x3')};const fileOptions={'algorithm':_0x848a('0x4')};if(config['encrypt']&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0x848a('0x5')]);if(isSupported){fileOptions[_0x848a('0x5')]=config['encrypt'][_0x848a('0x5')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x848a('0x6')](',\x20');logger[_0x848a('0x7')](config[_0x848a('0x8')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x3186a9){return AES_SUPPORTED_RX[_0x848a('0x9')](_0x3186a9);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x39fce4){return getSupportedCiphers()[_0x848a('0xa')](_0x39fce4)>-0x1;}function combineOptions(_0x2b79a8){var _0xf3e8f1={};for(var _0xdb6d0f in fileOptions){if(fileOptions[_0x848a('0xb')](_0xdb6d0f)){_0xf3e8f1[_0xdb6d0f]=fileOptions[_0xdb6d0f];}}if(_0x2b79a8){for(var _0x334047 in _0x2b79a8){if(_0x2b79a8[_0x848a('0xb')](_0x334047)){_0xf3e8f1[_0x334047]=_0x2b79a8[_0x334047];}}}return _0xf3e8f1;}exports[_0x848a('0xc')]=function(_0x24559e,_0x5f1adc,_0x33ce3f,_0x5dd4a0){return new BPromise(function(_0x16d5ca,_0x2bc50a){_0x5dd4a0=combineOptions(_0x5dd4a0);var _0x3dd95e=new Buffer(_0x33ce3f);var _0x2c3393=fs[_0x848a('0xd')](_0x24559e);var _0x5af945=fs[_0x848a('0xe')](_0x5f1adc);var _0x2013c0=crypto[_0x848a('0xf')](_0x5dd4a0[_0x848a('0x5')],_0x3dd95e);_0x2c3393['on'](_0x848a('0x10'),function(_0xd571dc){var _0x187f05=new Buffer(_0x2013c0[_0x848a('0x11')](_0xd571dc),_0x848a('0x12'));_0x5af945[_0x848a('0x13')](_0x187f05);});_0x2c3393['on'](_0x848a('0x14'),function(){try{var _0x54828d=new Buffer(_0x2013c0['final'](_0x848a('0x12')),_0x848a('0x12'));_0x5af945['write'](_0x54828d);_0x5af945[_0x848a('0x14')]();_0x5af945['on'](_0x848a('0x15'),function(){return _0x16d5ca(_0x5f1adc);});}catch(_0xa9caa5){fs[_0x848a('0x16')](_0x5f1adc);return _0x2bc50a(_0xa9caa5);}});});};exports[_0x848a('0x17')]=function(_0x4c8673,_0x3dfab7,_0x24f3b1,_0x5bdae8){return new BPromise(function(_0x59f22a,_0x3a355a){_0x5bdae8=combineOptions(_0x5bdae8);var _0x3de455=new Buffer(_0x24f3b1);var _0x3588af=fs[_0x848a('0xd')](_0x4c8673);var _0x2e4f77=fs[_0x848a('0xe')](_0x3dfab7);var _0x449b56=crypto['createDecipher'](_0x5bdae8['algorithm'],_0x3de455);_0x3588af['on'](_0x848a('0x10'),function(_0x2b6499){var _0x556a6f=new Buffer(_0x449b56[_0x848a('0x11')](_0x2b6499),_0x848a('0x12'));_0x2e4f77[_0x848a('0x13')](_0x556a6f);});_0x3588af['on'](_0x848a('0x14'),function(){try{var _0x148c96=new Buffer(_0x449b56['final'](_0x848a('0x12')),_0x848a('0x12'));_0x2e4f77[_0x848a('0x13')](_0x148c96);_0x2e4f77[_0x848a('0x14')]();_0x2e4f77['on'](_0x848a('0x15'),function(){return _0x59f22a(_0x3dfab7);});}catch(_0x573c87){fs[_0x848a('0x16')](_0x3dfab7);return _0x3a355a(_0x573c87);}});});};exports['encryptString']=function(_0x14bfea,_0xd48197,_0x19a005){var _0x1b50ca=_0x19a005||stringOptions[_0x848a('0x5')];var _0x50c620=_0xd48197||stringOptions['secret'];var _0x553745=crypto[_0x848a('0xf')](_0x1b50ca,_0x50c620);var _0x35aa9c=_0x553745[_0x848a('0x11')](_0x14bfea,_0x848a('0x18'),_0x848a('0x19'));_0x35aa9c+=_0x553745[_0x848a('0x1a')](_0x848a('0x19'));return _0x35aa9c;};exports[_0x848a('0x1b')]=function(_0x35cbee,_0x10b499,_0x4c7150){var _0x11466a=_0x4c7150||stringOptions[_0x848a('0x5')];var _0x34c7d9=_0x10b499||stringOptions['secret'];var _0x50f15e=crypto['createDecipher'](_0x11466a,_0x34c7d9);var _0x7d5cca=_0x50f15e['update'](_0x35cbee,_0x848a('0x19'),_0x848a('0x18'));_0x7d5cca+=_0x50f15e[_0x848a('0x1a')](_0x848a('0x18'));return _0x7d5cca;}; \ No newline at end of file +var _0x6036=['createDecipher','update','encryptString','secret','base64','utf8','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','write','end','final','binary','close','unlink','decryptFile'];(function(_0x28552d,_0x347c64){var _0x3e3484=function(_0x25b3e8){while(--_0x25b3e8){_0x28552d['push'](_0x28552d['shift']());}};_0x3e3484(++_0x347c64);}(_0x6036,0xb5));var _0x6603=function(_0x3f24f1,_0x3c634a){_0x3f24f1=_0x3f24f1-0x0;var _0x246c77=_0x6036[_0x3f24f1];return _0x246c77;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x6603('0x0'));var _=require(_0x6603('0x1'));var config=require(_0x6603('0x2'));var logger=require(_0x6603('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x6603('0x4')][_0x6603('0x5')],'algorithm':_0x6603('0x6')};const fileOptions={'algorithm':_0x6603('0x7')};if(config[_0x6603('0x8')]&&config[_0x6603('0x8')][_0x6603('0x9')]){var isSupported=isAlgorithmSupported(config[_0x6603('0x8')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0x6603('0x8')][_0x6603('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6603('0xa')](',\x20');logger[_0x6603('0xb')](config[_0x6603('0x8')][_0x6603('0x9')],_0x6603('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x9c1dd8){return AES_SUPPORTED_RX[_0x6603('0xd')](_0x9c1dd8);}function getSupportedCiphers(){return crypto[_0x6603('0xe')]()[_0x6603('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x4b6517){return getSupportedCiphers()[_0x6603('0x10')](_0x4b6517)>-0x1;}function combineOptions(_0x20fb85){var _0x147dfc={};for(var _0x46c247 in fileOptions){if(fileOptions[_0x6603('0x11')](_0x46c247)){_0x147dfc[_0x46c247]=fileOptions[_0x46c247];}}if(_0x20fb85){for(var _0x3bdf54 in _0x20fb85){if(_0x20fb85[_0x6603('0x11')](_0x3bdf54)){_0x147dfc[_0x3bdf54]=_0x20fb85[_0x3bdf54];}}}return _0x147dfc;}exports[_0x6603('0x12')]=function(_0x565a58,_0x568267,_0x5a373d,_0x222d7f){return new BPromise(function(_0xa2073b,_0x581098){_0x222d7f=combineOptions(_0x222d7f);var _0x343aa=new Buffer(_0x5a373d);var _0x11fe45=fs['createReadStream'](_0x565a58);var _0x5e7ce2=fs[_0x6603('0x13')](_0x568267);var _0x30a9e5=crypto[_0x6603('0x14')](_0x222d7f[_0x6603('0x9')],_0x343aa);_0x11fe45['on'](_0x6603('0x15'),function(_0x49d951){var _0xbd3ad=new Buffer(_0x30a9e5['update'](_0x49d951),'binary');_0x5e7ce2[_0x6603('0x16')](_0xbd3ad);});_0x11fe45['on'](_0x6603('0x17'),function(){try{var _0x261aba=new Buffer(_0x30a9e5[_0x6603('0x18')](_0x6603('0x19')),_0x6603('0x19'));_0x5e7ce2[_0x6603('0x16')](_0x261aba);_0x5e7ce2[_0x6603('0x17')]();_0x5e7ce2['on'](_0x6603('0x1a'),function(){return _0xa2073b(_0x568267);});}catch(_0x45715d){fs[_0x6603('0x1b')](_0x568267);return _0x581098(_0x45715d);}});});};exports[_0x6603('0x1c')]=function(_0x2c5b3e,_0x338358,_0x4278e5,_0x54c7d2){return new BPromise(function(_0x583676,_0x222fea){_0x54c7d2=combineOptions(_0x54c7d2);var _0x4fd026=new Buffer(_0x4278e5);var _0x270881=fs['createReadStream'](_0x2c5b3e);var _0x118ad3=fs[_0x6603('0x13')](_0x338358);var _0x5c976b=crypto[_0x6603('0x1d')](_0x54c7d2[_0x6603('0x9')],_0x4fd026);_0x270881['on'](_0x6603('0x15'),function(_0x170ee5){var _0x2b5e20=new Buffer(_0x5c976b[_0x6603('0x1e')](_0x170ee5),'binary');_0x118ad3['write'](_0x2b5e20);});_0x270881['on'](_0x6603('0x17'),function(){try{var _0x10c57c=new Buffer(_0x5c976b[_0x6603('0x18')](_0x6603('0x19')),_0x6603('0x19'));_0x118ad3['write'](_0x10c57c);_0x118ad3['end']();_0x118ad3['on']('close',function(){return _0x583676(_0x338358);});}catch(_0x2db802){fs[_0x6603('0x1b')](_0x338358);return _0x222fea(_0x2db802);}});});};exports[_0x6603('0x1f')]=function(_0x466a00,_0x42696c,_0x5c6785){var _0xc78fc4=_0x5c6785||stringOptions[_0x6603('0x9')];var _0x2f1119=_0x42696c||stringOptions[_0x6603('0x20')];var _0x14c235=crypto[_0x6603('0x14')](_0xc78fc4,_0x2f1119);var _0x48ce5d=_0x14c235[_0x6603('0x1e')](_0x466a00,'utf8',_0x6603('0x21'));_0x48ce5d+=_0x14c235[_0x6603('0x18')]('base64');return _0x48ce5d;};exports['decryptString']=function(_0x2e8986,_0xd632e2,_0x247b16){var _0x1c8b28=_0x247b16||stringOptions[_0x6603('0x9')];var _0x2e5970=_0xd632e2||stringOptions['secret'];var _0x2196ef=crypto[_0x6603('0x1d')](_0x1c8b28,_0x2e5970);var _0x3c2e80=_0x2196ef[_0x6603('0x1e')](_0x2e8986,_0x6603('0x21'),_0x6603('0x22'));_0x3c2e80+=_0x2196ef['final']('utf8');return _0x3c2e80;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 969ab18..4b2efa1 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 _0x710d=['zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','num','Empty','length','range','SELECT','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x710d,0xfc));var _0xd710=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x710d[_0x135904];return _0x1ce7d5;};'use strict';var util=require(_0xd710('0x0'));var path=require('path');var _=require(_0xd710('0x1'));var csv=require(_0xd710('0x2'));var fs=require('fs');var BPromise=require(_0xd710('0x3'));var zipdir=require(_0xd710('0x4'));var rimraf=require(_0xd710('0x5'));var db=require(_0xd710('0x6'))['db'];var dbH=require(_0xd710('0x6'))[_0xd710('0x7')];var logger=require('../../config/logger')(_0xd710('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xd710('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd710('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4d792e,_0x19dd28){var _0x46a482={'status':_0x4d792e};var _0x10b490={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x19dd28){_0x46a482[_0xd710('0xa')]=_0x19dd28;}return db[_0xd710('0xb')][_0xd710('0xc')](_0x46a482,_0x10b490);}function main(){var _0x55818c=0x1388;var _0x746ea5;logger[_0xd710('0xd')](util[_0xd710('0xe')](_0xd710('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xd710('0x10')][_0xd710('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd710('0x12'),_0xd710('0x13')]})['then'](function(_0x330c09){if(_0x330c09){_0x746ea5=_0x330c09;_0x55818c=_0x746ea5[_0xd710('0x13')]||0x1388;}})[_0xd710('0x14')](function(){return dbH['sequelize'][_0xd710('0x15')](util[_0xd710('0xe')](_0xd710('0x16'),QUERY),{'type':dbH[_0xd710('0x17')][_0xd710('0x18')]['SELECT']});})[_0xd710('0x14')](function(_0x1a9bd5){if(!_0x1a9bd5[0x0][_0xd710('0x19')]){return analyticExtractedReport(_0xd710('0x1a'));}var _0x1f49f0=[];var _0x19a1ff=0x0;if(_0x746ea5['split']){if(_0x1a9bd5&&_0x1a9bd5[_0xd710('0x1b')]){var _0x15fe23=_[_0xd710('0x1c')](_0x1a9bd5[0x0][_0xd710('0x19')]/_0x55818c);var _0x8e72a3=Number['isInteger'](_0x1a9bd5[0x0][_0xd710('0x19')]/_0x55818c)?_0x1a9bd5[0x0][_0xd710('0x19')]%_0x55818c:0x0;_0x15fe23['forEach'](function(_0x4cbf56){if(_0x4cbf56>0x0){_0x19a1ff+=_0x55818c;}_0x1f49f0['push'](dbH[_0xd710('0x17')][_0xd710('0x15')](util[_0xd710('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x55818c,_0x19a1ff),{'type':dbH[_0xd710('0x17')][_0xd710('0x18')][_0xd710('0x1d')]}));});if(_0x8e72a3>0x0){_0x19a1ff+=_0x55818c;_0x1f49f0[_0xd710('0x1e')](dbH[_0xd710('0x17')][_0xd710('0x15')](util['format'](_0xd710('0x1f'),QUERY,_0x8e72a3,_0x19a1ff),{'type':dbH[_0xd710('0x17')][_0xd710('0x18')][_0xd710('0x1d')]}));}}}else{_0x1f49f0['push'](dbH[_0xd710('0x17')][_0xd710('0x15')](QUERY,{'type':dbH[_0xd710('0x17')][_0xd710('0x18')][_0xd710('0x1d')]}));}var _0x42fc85=path[_0xd710('0x20')](PATH);var _0x24786e=path[_0xd710('0x21')](PATH,_0xd710('0x22'));var _0x1591d7=_0x746ea5[_0xd710('0x12')]&&_0x1f49f0[_0xd710('0x1b')]>0x1;var _0x5b2215=[];if(!fs[_0xd710('0x23')](path[_0xd710('0x24')](_0x42fc85,_0x24786e))&&_0x1591d7){fs['mkdirSync'](path[_0xd710('0x24')](_0x42fc85,_0x24786e));}return BPromise[_0xd710('0x25')](_0x1f49f0,function(_0x47e0cb){_0x5b2215[_0xd710('0x1e')](_0x47e0cb);})[_0xd710('0x14')](function(){for(var _0x3ab3d0=0x0;_0x3ab3d0<_0x5b2215[_0xd710('0x1b')];_0x3ab3d0+=0x1){var _0x5b7b7b;var _0x21f964=_0x5b2215[_0x3ab3d0];if(_0x1591d7){_0x5b7b7b=path[_0xd710('0x24')](_0x42fc85,_0x24786e,util[_0xd710('0xe')](_0xd710('0x26'),_0x24786e,_0x3ab3d0,_0xd710('0x27')));}else{_0x5b7b7b=path[_0xd710('0x24')](_0x42fc85,util[_0xd710('0xe')](_0xd710('0x28'),_0x24786e,_0xd710('0x27')));}fs[_0xd710('0x29')](_0x5b7b7b,csv(_0x21f964));}})[_0xd710('0x14')](function(){if(_0x1591d7){return new Promise(function(_0x3999ab){zipdir(path[_0xd710('0x24')](_0x42fc85,_0x24786e),{'saveTo':path[_0xd710('0x24')](_0x42fc85,util[_0xd710('0xe')](_0xd710('0x28'),_0x24786e,_0xd710('0x2a')))},function(_0x406a33,_0x2b30d6){rimraf(path[_0xd710('0x24')](_0x42fc85,_0x24786e),function(){});_0x3999ab('zip\x20finished');});});}})[_0xd710('0x14')](function(){logger[_0xd710('0xd')](util[_0xd710('0xe')](_0xd710('0x2b'),EXTRACTED_REPORT_ID,_0xd710('0x2c')));return analyticExtractedReport('Completed',_0x1591d7?util[_0xd710('0xe')](_0xd710('0x28'),_0x24786e,_0x1591d7?_0xd710('0x2a'):'csv'):null);});})['catch'](function(_0x3be267){logger[_0xd710('0xd')](util[_0xd710('0xe')](_0xd710('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util[_0xd710('0x2e')](_0x3be267,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd710('0x2f')](function(){process[_0xd710('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf652=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','join','%s%d.%s','%s.%s','csv','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize'];(function(_0x5536dd,_0x508e83){var _0x4ba2d3=function(_0xdf069a){while(--_0xdf069a){_0x5536dd['push'](_0x5536dd['shift']());}};_0x4ba2d3(++_0x508e83);}(_0xf652,0x12f));var _0x2f65=function(_0x187a67,_0x113062){_0x187a67=_0x187a67-0x0;var _0xeaf443=_0xf652[_0x187a67];return _0xeaf443;};'use strict';var util=require(_0x2f65('0x0'));var path=require(_0x2f65('0x1'));var _=require(_0x2f65('0x2'));var csv=require(_0x2f65('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x2f65('0x4'));var rimraf=require(_0x2f65('0x5'));var db=require(_0x2f65('0x6'))['db'];var dbH=require(_0x2f65('0x6'))[_0x2f65('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x2f65('0x8')][0x2]);var QUERY=process[_0x2f65('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d0765,_0x5824a2){var _0x201458={'status':_0x5d0765};var _0x262c9f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5824a2){_0x201458[_0x2f65('0x9')]=_0x5824a2;}return db[_0x2f65('0xa')]['update'](_0x201458,_0x262c9f);}function main(){var _0x4fdcc6=0x1388;var _0x1839c9;logger['info'](util[_0x2f65('0xb')](_0x2f65('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x2f65('0xd')][_0x2f65('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2f65('0xf'),_0x2f65('0x10')]})[_0x2f65('0x11')](function(_0x147ca9){if(_0x147ca9){_0x1839c9=_0x147ca9;_0x4fdcc6=_0x1839c9[_0x2f65('0x10')]||0x1388;}})[_0x2f65('0x11')](function(){return dbH[_0x2f65('0x12')][_0x2f65('0x13')](util['format'](_0x2f65('0x14'),QUERY),{'type':dbH[_0x2f65('0x12')][_0x2f65('0x15')]['SELECT']});})[_0x2f65('0x11')](function(_0x4eac06){if(!_0x4eac06[0x0][_0x2f65('0x16')]){return analyticExtractedReport(_0x2f65('0x17'));}var _0x212446=[];var _0x5c76c2=0x0;if(_0x1839c9[_0x2f65('0xf')]){if(_0x4eac06&&_0x4eac06[_0x2f65('0x18')]){var _0x1f2dd5=_[_0x2f65('0x19')](_0x4eac06[0x0][_0x2f65('0x16')]/_0x4fdcc6);var _0x28fc77=Number[_0x2f65('0x1a')](_0x4eac06[0x0][_0x2f65('0x16')]/_0x4fdcc6)?_0x4eac06[0x0]['num']%_0x4fdcc6:0x0;_0x1f2dd5[_0x2f65('0x1b')](function(_0x15323d){if(_0x15323d>0x0){_0x5c76c2+=_0x4fdcc6;}_0x212446[_0x2f65('0x1c')](dbH['sequelize'][_0x2f65('0x13')](util[_0x2f65('0xb')](_0x2f65('0x1d'),QUERY,_0x4fdcc6,_0x5c76c2),{'type':dbH[_0x2f65('0x12')][_0x2f65('0x15')]['SELECT']}));});if(_0x28fc77>0x0){_0x5c76c2+=_0x4fdcc6;_0x212446[_0x2f65('0x1c')](dbH['sequelize']['query'](util[_0x2f65('0xb')](_0x2f65('0x1d'),QUERY,_0x28fc77,_0x5c76c2),{'type':dbH['sequelize'][_0x2f65('0x15')][_0x2f65('0x1e')]}));}}}else{_0x212446['push'](dbH['sequelize'][_0x2f65('0x13')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x2f65('0x1e')]}));}var _0x59846b=path[_0x2f65('0x1f')](PATH);var _0x36d420=path[_0x2f65('0x20')](PATH,_0x2f65('0x21'));var _0x2ad239=_0x1839c9[_0x2f65('0xf')]&&_0x212446['length']>0x1;var _0x131330=[];if(!fs['existsSync'](path['join'](_0x59846b,_0x36d420))&&_0x2ad239){fs['mkdirSync'](path[_0x2f65('0x22')](_0x59846b,_0x36d420));}return BPromise['each'](_0x212446,function(_0x1f2e2c){_0x131330[_0x2f65('0x1c')](_0x1f2e2c);})[_0x2f65('0x11')](function(){for(var _0x5b6c5e=0x0;_0x5b6c5e<_0x131330[_0x2f65('0x18')];_0x5b6c5e+=0x1){var _0xc33bfc;var _0x137b8c=_0x131330[_0x5b6c5e];if(_0x2ad239){_0xc33bfc=path['join'](_0x59846b,_0x36d420,util['format'](_0x2f65('0x23'),_0x36d420,_0x5b6c5e,'csv'));}else{_0xc33bfc=path[_0x2f65('0x22')](_0x59846b,util[_0x2f65('0xb')](_0x2f65('0x24'),_0x36d420,_0x2f65('0x25')));}fs['writeFileSync'](_0xc33bfc,csv(_0x137b8c));}})[_0x2f65('0x11')](function(){if(_0x2ad239){return new Promise(function(_0x2304cb){zipdir(path[_0x2f65('0x22')](_0x59846b,_0x36d420),{'saveTo':path[_0x2f65('0x22')](_0x59846b,util[_0x2f65('0xb')](_0x2f65('0x24'),_0x36d420,_0x2f65('0x26')))},function(_0x1fb9f8,_0x1d7eed){rimraf(path[_0x2f65('0x22')](_0x59846b,_0x36d420),function(){});_0x2304cb('zip\x20finished');});});}})['then'](function(){logger['info'](util[_0x2f65('0xb')](_0x2f65('0x27'),EXTRACTED_REPORT_ID,_0x2f65('0x28')));return analyticExtractedReport('Completed',_0x2ad239?util[_0x2f65('0xb')](_0x2f65('0x24'),_0x36d420,_0x2ad239?_0x2f65('0x26'):'csv'):null);});})['catch'](function(_0x5aa65e){logger[_0x2f65('0x29')](util[_0x2f65('0xb')](_0x2f65('0x2a'),EXTRACTED_REPORT_ID,_0x2f65('0x28')),util['inspect'](_0x5aa65e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2f65('0x2b'));})[_0x2f65('0x2c')](function(){process[_0x2f65('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 21ce002..618e46c 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 _0x52bc=['createPdfFromHTML','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','fill','length','auto','body','push','concat','chunk','keys','forEach','format','name','before','landscape','toString','\x20/\x20','footer','Arial','black','num','Setting','split','splitSizePdf','then','isInteger','query','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync','mkdirSync','each','flatten','createPdfKitDocument','join','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end'];(function(_0x27e307,_0x1057c3){var _0x3ac590=function(_0x5a1a17){while(--_0x5a1a17){_0x27e307['push'](_0x27e307['shift']());}};_0x3ac590(++_0x1057c3);}(_0x52bc,0x106));var _0xc52b=function(_0x3a2c3d,_0x6a37fb){_0x3a2c3d=_0x3a2c3d-0x0;var _0x8cadc7=_0x52bc[_0x3a2c3d];return _0x8cadc7;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require('path');var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xc52b('0x0'));var zipdir=require(_0xc52b('0x1'));var rimraf=require(_0xc52b('0x2'));var JSDOM=require(_0xc52b('0x3'))[_0xc52b('0x4')];var window=new JSDOM('')[_0xc52b('0x5')];var BPromise=require(_0xc52b('0x6'));var db=require(_0xc52b('0x7'))['db'];var dbH=require(_0xc52b('0x7'))[_0xc52b('0x8')];var logger=require(_0xc52b('0x9'))(_0xc52b('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xc52b('0xb')][0x2]);var QUERY=process[_0xc52b('0xb')][0x3];var PATH=process[_0xc52b('0xb')][0x4];var NAME=process[_0xc52b('0xb')][0x5];var FORMAT=_0xc52b('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5b9ead,_0x1d446f){var _0x41b073={'status':_0x5b9ead};var _0x5a8a60={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1d446f){_0x41b073[_0xc52b('0xd')]=_0x1d446f;}return db[_0xc52b('0xe')][_0xc52b('0xf')](_0x41b073,_0x5a8a60);}function getHeaders(_0x1d5574){return _['map'](_0x1d5574,function(_0x485e6d){return{'text':_0x485e6d,'style':_0xc52b('0x10')};});}function getRows(_0x642b6d,_0x5b6490){return _[_0xc52b('0x11')](_0x5b6490,function(_0x3a3446){return _(_0x3a3446)['pick'](_0x642b6d)['map'](function(_0x51a3ab){return _0x51a3ab?_['toString'](_0x51a3ab):'';})['value']();});}function createTable(_0x191bf3,_0x198c2b){var _0x5cdc1d={'widths':_[_0xc52b('0x12')](Array(_0x191bf3[_0xc52b('0x13')]),0x91),'heights':function(_0xa23f03){return _0xa23f03===0x0?_0xc52b('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x503837=getHeaders(_0x191bf3);_0x5cdc1d[_0xc52b('0x15')][_0xc52b('0x16')](_0x503837);var _0xf2c02a=getRows(_0x191bf3,_0x198c2b);_0x5cdc1d[_0xc52b('0x15')]=_0x5cdc1d[_0xc52b('0x15')][_0xc52b('0x17')](_0xf2c02a);return _0x5cdc1d;}function createTables(_0xa6d3e0){var _0x1216f7=[];var _0x582a6d=_[_0xc52b('0x18')](Object[_0xc52b('0x19')](_0xa6d3e0[0x0]),0x5);_0x582a6d[_0xc52b('0x1a')](function(_0x2583a0){_0x1216f7[_0xc52b('0x16')](createTable(_0x2583a0,_0xa6d3e0));});return _0x1216f7;}function getPDFDocDefinition(_0x475335){var _0xb5f586=util[_0xc52b('0x1b')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xc52b('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0xc52b('0x1b')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x55e136=[];for(var _0x429e41=0x0;_0x429e41<_0x475335[_0xc52b('0x13')];_0x429e41++){var _0x28bc27=[];if(_0x429e41===0x0){_0x28bc27[_0xc52b('0x16')]({'text':_0xb5f586,'style':'header'});}var _0x588bab={'table':_0x475335[_0x429e41]};if(_0x429e41>0x0){_0x588bab['pageBreak']=_0xc52b('0x1d');_0x588bab['margin']=[0x0,0x46,0x0,0x0];}_0x28bc27[_0xc52b('0x16')](_0x588bab);_0x55e136[_0xc52b('0x16')](_0x28bc27);}return{'pageSize':'A4','pageOrientation':_0xc52b('0x1e'),'content':_0x55e136,'footer':function(_0x3648a7,_0x4a7de8){return{'text':_0x3648a7[_0xc52b('0x1f')]()+_0xc52b('0x20')+_0x4a7de8,'style':_0xc52b('0x21')};},'defaultStyle':{'font':_0xc52b('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc52b('0x23')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1168ff){var _0x4b1d40=0x1388;var _0x5d050d;if(!_0x1168ff[0x0][_0xc52b('0x24')]){return analyticExtractedReport('Empty');}return db[_0xc52b('0x25')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc52b('0x26'),_0xc52b('0x27')]})[_0xc52b('0x28')](function(_0x2848e5){if(_0x2848e5){_0x5d050d=_0x2848e5;_0x4b1d40=_0x5d050d[_0xc52b('0x27')]||0x3e8;}})[_0xc52b('0x28')](function(){var _0x50f790=[];var _0x2cb9dd=0x0;if(_0x5d050d['split']){if(_0x1168ff&&_0x1168ff[_0xc52b('0x13')]){var _0x40f734=_['range'](_0x1168ff[0x0][_0xc52b('0x24')]/_0x4b1d40);var _0x946da7=Number[_0xc52b('0x29')](_0x1168ff[0x0][_0xc52b('0x24')]/_0x4b1d40)?_0x1168ff[0x0][_0xc52b('0x24')]%_0x4b1d40:0x0;_0x40f734[_0xc52b('0x1a')](function(_0x239d9c){if(_0x239d9c>0x0){_0x2cb9dd+=_0x4b1d40;}_0x50f790[_0xc52b('0x16')](dbH['sequelize'][_0xc52b('0x2a')](util[_0xc52b('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4b1d40,_0x2cb9dd),{'type':dbH[_0xc52b('0x2b')][_0xc52b('0x2c')][_0xc52b('0x2d')]}));});if(_0x946da7>0x0){_0x2cb9dd+=_0x4b1d40;_0x50f790[_0xc52b('0x16')](dbH[_0xc52b('0x2b')][_0xc52b('0x2a')](util['format'](_0xc52b('0x2e'),QUERY,_0x946da7,_0x2cb9dd),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x50f790['push'](dbH[_0xc52b('0x2b')][_0xc52b('0x2a')](QUERY,{'type':dbH[_0xc52b('0x2b')][_0xc52b('0x2c')][_0xc52b('0x2d')]}));}var _0x314785=path[_0xc52b('0x2f')](PATH);var _0x56fba7=path[_0xc52b('0x30')](PATH,_0xc52b('0x31'));var _0x5c272c=_0x5d050d['split']&&_0x50f790[_0xc52b('0x13')]>0x1;var _0x5a3b9c=[];if(!fs[_0xc52b('0x32')](path['join'](_0x314785,_0x56fba7))&&_0x5c272c){fs[_0xc52b('0x33')](path['join'](_0x314785,_0x56fba7));}return BPromise[_0xc52b('0x34')](_0x50f790,function(_0x47dc84){_0x5a3b9c[_0xc52b('0x16')](_0x47dc84);})[_0xc52b('0x28')](function(){var _0x498129=[];for(var _0x318c7d=0x0;_0x318c7d<_0x5a3b9c['length'];_0x318c7d+=0x1){var _0x52a13c=_0x5a3b9c[_0x318c7d];var _0x56c3e1=createTables(_[_0xc52b('0x35')](_0x52a13c));var _0xff81b6;var _0x8fce4f=getPDFDocDefinition(_0x56c3e1);var _0x5d26ac=getPDFPrinter();var _0x398ee4=_0x5d26ac[_0xc52b('0x36')](_0x8fce4f);if(_0x5c272c){_0xff81b6=path[_0xc52b('0x37')](_0x314785,_0x56fba7,util[_0xc52b('0x1b')](_0xc52b('0x38'),_0x56fba7,_0x318c7d,'pdf'));}else{_0xff81b6=path[_0xc52b('0x37')](_0x314785,util[_0xc52b('0x1b')](_0xc52b('0x39'),_0x56fba7,_0xc52b('0x3a')));}_0x498129[_0xc52b('0x16')](writePDFDocument(_0x398ee4,_0xff81b6));}return Promise[_0xc52b('0x3b')](_0x498129);})[_0xc52b('0x28')](function(){if(_0x5c272c){return new Promise(function(_0x46bc85){zipdir(path[_0xc52b('0x37')](_0x314785,_0x56fba7),{'saveTo':path[_0xc52b('0x37')](_0x314785,util[_0xc52b('0x1b')](_0xc52b('0x39'),_0x56fba7,_0xc52b('0x3c')))},function(){rimraf(path[_0xc52b('0x37')](_0x314785,_0x56fba7),function(){});_0x46bc85(_0xc52b('0x3d'));});});}})[_0xc52b('0x28')](function(){if(!_0x5c272c)return;rimraf(path['join'](_0x314785,_0x56fba7),function(){});})[_0xc52b('0x28')](function(){logger['info'](util[_0xc52b('0x1b')](_0xc52b('0x3e'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xc52b('0x3f'),_0x5c272c?util['format'](_0xc52b('0x39'),_0x56fba7,_0x5c272c?_0xc52b('0x3c'):_0xc52b('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xc52b('0x40')](util[_0xc52b('0x1b')](_0xc52b('0x41'),EXTRACTED_REPORT_ID,_0xc52b('0x42')));return db['AnalyticExtractedReport'][_0xc52b('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xc52b('0x28')](function(_0x1b0efd){EXTRACTED_REPORT=_0x1b0efd;return dbH[_0xc52b('0x2b')][_0xc52b('0x2a')](util[_0xc52b('0x1b')](_0xc52b('0x44'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0xc52b('0x28')](extractReport)[_0xc52b('0x45')](function(_0x35dc3c){logger[_0xc52b('0x40')](util[_0xc52b('0x1b')](_0xc52b('0x46'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x35dc3c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xc52b('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x193306=new PdfPrinter({'Arial':{'normal':__dirname+_0xc52b('0x48'),'bold':__dirname+_0xc52b('0x49'),'italics':__dirname+_0xc52b('0x4a'),'bolditalics':__dirname+_0xc52b('0x4b')}});return _0x193306;}function getPDFDocDefinitionFromHTML(_0x46e2b5,_0x27c505){var _0x363f00=util[_0xc52b('0x1b')]('%s\x20#%d',_0x27c505['channel'],_0x27c505[_0xc52b('0x4c')]);var _0x24b5b0=moment()['format'](_0xc52b('0x4d'))[_0xc52b('0x1f')]();var _0x57f602=htmlToPdfmake(_0x46e2b5,{'window':window,'tableAutoSize':!![]});return{'content':[_0x57f602],'defaultStyle':{'font':_0xc52b('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xc52b('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xc52b('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xc52b('0x4e')}},'header':function(){return[{'text':_0xc52b('0x4f'),'style':_0xc52b('0x50')}];},'footer':function(_0x4a1bfc,_0x1d23ab){return[{'text':util[_0xc52b('0x1b')](_0xc52b('0x51'),_0x363f00,_0x4a1bfc,_0x1d23ab,_0x24b5b0),'style':_0xc52b('0x21')}];}};}function writePDFDocument(_0x3226b3,_0x58bbad){return new Promise(function(_0x1bc46d,_0x1a4141){var _0x4fd832=_0x3226b3[_0xc52b('0x52')](fs[_0xc52b('0x53')](_0x58bbad));_0x4fd832['on']('finish',function(){_0x1bc46d(_0xc52b('0x54'));});_0x4fd832['on']('error',function(_0x4b7c2e){_0x1a4141(_0x4b7c2e);});_0x3226b3[_0xc52b('0x55')]();});}exports[_0xc52b('0x56')]=function(_0x3f1a86,_0x494337){var _0x9244dc=getPDFPrinter();var _0x4ae0e6=getPDFDocDefinitionFromHTML(_0x3f1a86,_0x494337);var _0x5de51=_0x9244dc['createPdfKitDocument'](_0x4ae0e6);return writePDFDocument(_0x5de51,_0x494337['path'])[_0xc52b('0x45')](function(_0x2ce8bd){throw _0x2ce8bd;});}; \ No newline at end of file +var _0x435d=['splitSizePdf','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','catch','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','end','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','pick','toString','value','length','auto','body','push','concat','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','landscape','\x20/\x20','footer','Arial','black','right','num','Setting','find','split','then'];(function(_0x180bef,_0x1fcfa0){var _0x377b0d=function(_0x1fe992){while(--_0x1fe992){_0x180bef['push'](_0x180bef['shift']());}};_0x377b0d(++_0x1fcfa0);}(_0x435d,0x1dc));var _0xd435=function(_0x28805a,_0x1dd79e){_0x28805a=_0x28805a-0x0;var _0x576a4c=_0x435d[_0x28805a];return _0x576a4c;};'use strict';var _=require(_0xd435('0x0'));var fs=require('fs');var util=require(_0xd435('0x1'));var path=require(_0xd435('0x2'));var moment=require(_0xd435('0x3'));var htmlToPdfmake=require(_0xd435('0x4'));var PdfPrinter=require(_0xd435('0x5'));var zipdir=require(_0xd435('0x6'));var rimraf=require(_0xd435('0x7'));var JSDOM=require(_0xd435('0x8'))[_0xd435('0x9')];var window=new JSDOM('')[_0xd435('0xa')];var BPromise=require(_0xd435('0xb'));var db=require(_0xd435('0xc'))['db'];var dbH=require(_0xd435('0xc'))[_0xd435('0xd')];var logger=require(_0xd435('0xe'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd435('0xf')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd435('0xf')][0x4];var NAME=process[_0xd435('0xf')][0x5];var FORMAT=_0xd435('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x19e4ef,_0x3c99d0){var _0x471365={'status':_0x19e4ef};var _0xde24bd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3c99d0){_0x471365[_0xd435('0x11')]=_0x3c99d0;}return db['AnalyticExtractedReport'][_0xd435('0x12')](_0x471365,_0xde24bd);}function getHeaders(_0x1c9691){return _[_0xd435('0x13')](_0x1c9691,function(_0x4635e5){return{'text':_0x4635e5,'style':'tableHeader'};});}function getRows(_0x30e326,_0x110178){return _[_0xd435('0x13')](_0x110178,function(_0x4ace0c){return _(_0x4ace0c)[_0xd435('0x14')](_0x30e326)[_0xd435('0x13')](function(_0x25605e){return _0x25605e?_[_0xd435('0x15')](_0x25605e):'';})[_0xd435('0x16')]();});}function createTable(_0x513df1,_0x3ebc4c){var _0x3203c4={'widths':_['fill'](Array(_0x513df1[_0xd435('0x17')]),0x91),'heights':function(_0x36d896){return _0x36d896===0x0?_0xd435('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x59c9d3=getHeaders(_0x513df1);_0x3203c4[_0xd435('0x19')][_0xd435('0x1a')](_0x59c9d3);var _0x26e646=getRows(_0x513df1,_0x3ebc4c);_0x3203c4[_0xd435('0x19')]=_0x3203c4[_0xd435('0x19')][_0xd435('0x1b')](_0x26e646);return _0x3203c4;}function createTables(_0x1349ba){var _0x59a833=[];var _0x5525c9=_['chunk'](Object['keys'](_0x1349ba[0x0]),0x5);_0x5525c9[_0xd435('0x1c')](function(_0x1b12bb){_0x59a833[_0xd435('0x1a')](createTable(_0x1b12bb,_0x1349ba));});return _0x59a833;}function getPDFDocDefinition(_0x3f2187){var _0x32f7ae=util['format'](_0xd435('0x1d'),NAME,EXTRACTED_REPORT[_0xd435('0x1e')],moment(EXTRACTED_REPORT[_0xd435('0x1f')])[_0xd435('0x20')](FORMAT),moment(EXTRACTED_REPORT[_0xd435('0x21')])[_0xd435('0x20')](FORMAT));var _0x4c5a22=[];for(var _0xe2b2ac=0x0;_0xe2b2ac<_0x3f2187[_0xd435('0x17')];_0xe2b2ac++){var _0x7d43a8=[];if(_0xe2b2ac===0x0){_0x7d43a8[_0xd435('0x1a')]({'text':_0x32f7ae,'style':_0xd435('0x22')});}var _0x1a6268={'table':_0x3f2187[_0xe2b2ac]};if(_0xe2b2ac>0x0){_0x1a6268['pageBreak']='before';_0x1a6268['margin']=[0x0,0x46,0x0,0x0];}_0x7d43a8[_0xd435('0x1a')](_0x1a6268);_0x4c5a22[_0xd435('0x1a')](_0x7d43a8);}return{'pageSize':'A4','pageOrientation':_0xd435('0x23'),'content':_0x4c5a22,'footer':function(_0x46a064,_0x18457b){return{'text':_0x46a064['toString']()+_0xd435('0x24')+_0x18457b,'style':_0xd435('0x25')};},'defaultStyle':{'font':_0xd435('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd435('0x27')},'footer':{'alignment':_0xd435('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x29896b){var _0x200de7=0x1388;var _0x319402;if(!_0x29896b[0x0][_0xd435('0x29')]){return analyticExtractedReport('Empty');}return db[_0xd435('0x2a')][_0xd435('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd435('0x2c'),'splitSizePdf']})[_0xd435('0x2d')](function(_0xe98782){if(_0xe98782){_0x319402=_0xe98782;_0x200de7=_0x319402[_0xd435('0x2e')]||0x3e8;}})[_0xd435('0x2d')](function(){var _0x2a89d1=[];var _0x396990=0x0;if(_0x319402[_0xd435('0x2c')]){if(_0x29896b&&_0x29896b[_0xd435('0x17')]){var _0x515715=_[_0xd435('0x2f')](_0x29896b[0x0][_0xd435('0x29')]/_0x200de7);var _0x23d39d=Number[_0xd435('0x30')](_0x29896b[0x0]['num']/_0x200de7)?_0x29896b[0x0][_0xd435('0x29')]%_0x200de7:0x0;_0x515715['forEach'](function(_0x468cec){if(_0x468cec>0x0){_0x396990+=_0x200de7;}_0x2a89d1[_0xd435('0x1a')](dbH[_0xd435('0x31')][_0xd435('0x32')](util[_0xd435('0x20')](_0xd435('0x33'),QUERY,_0x200de7,_0x396990),{'type':dbH[_0xd435('0x31')][_0xd435('0x34')][_0xd435('0x35')]}));});if(_0x23d39d>0x0){_0x396990+=_0x200de7;_0x2a89d1[_0xd435('0x1a')](dbH[_0xd435('0x31')][_0xd435('0x32')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x23d39d,_0x396990),{'type':dbH[_0xd435('0x31')]['QueryTypes'][_0xd435('0x35')]}));}}}else{_0x2a89d1[_0xd435('0x1a')](dbH['sequelize'][_0xd435('0x32')](QUERY,{'type':dbH[_0xd435('0x31')][_0xd435('0x34')][_0xd435('0x35')]}));}var _0x1e2241=path['dirname'](PATH);var _0x37aa86=path[_0xd435('0x36')](PATH,_0xd435('0x37'));var _0x3ced97=_0x319402[_0xd435('0x2c')]&&_0x2a89d1[_0xd435('0x17')]>0x1;var _0x485fab=[];if(!fs[_0xd435('0x38')](path[_0xd435('0x39')](_0x1e2241,_0x37aa86))&&_0x3ced97){fs[_0xd435('0x3a')](path[_0xd435('0x39')](_0x1e2241,_0x37aa86));}return BPromise[_0xd435('0x3b')](_0x2a89d1,function(_0x35d301){_0x485fab[_0xd435('0x1a')](_0x35d301);})[_0xd435('0x2d')](function(){var _0x401cae=[];for(var _0x248c2c=0x0;_0x248c2c<_0x485fab[_0xd435('0x17')];_0x248c2c+=0x1){var _0x19649a=_0x485fab[_0x248c2c];var _0x1403e5=createTables(_[_0xd435('0x3c')](_0x19649a));var _0x997087;var _0x3ba28f=getPDFDocDefinition(_0x1403e5);var _0x26fbe0=getPDFPrinter();var _0x7d0ac3=_0x26fbe0[_0xd435('0x3d')](_0x3ba28f);if(_0x3ced97){_0x997087=path[_0xd435('0x39')](_0x1e2241,_0x37aa86,util[_0xd435('0x20')](_0xd435('0x3e'),_0x37aa86,_0x248c2c,_0xd435('0x3f')));}else{_0x997087=path[_0xd435('0x39')](_0x1e2241,util[_0xd435('0x20')](_0xd435('0x40'),_0x37aa86,_0xd435('0x3f')));}_0x401cae[_0xd435('0x1a')](writePDFDocument(_0x7d0ac3,_0x997087));}return Promise[_0xd435('0x41')](_0x401cae);})[_0xd435('0x2d')](function(){if(_0x3ced97){return new Promise(function(_0x64bcfe){zipdir(path[_0xd435('0x39')](_0x1e2241,_0x37aa86),{'saveTo':path['join'](_0x1e2241,util[_0xd435('0x20')](_0xd435('0x40'),_0x37aa86,_0xd435('0x42')))},function(){rimraf(path[_0xd435('0x39')](_0x1e2241,_0x37aa86),function(){});_0x64bcfe('zip\x20finished');});});}})['then'](function(){if(!_0x3ced97)return;rimraf(path['join'](_0x1e2241,_0x37aa86),function(){});})['then'](function(){logger[_0xd435('0x43')](util[_0xd435('0x20')](_0xd435('0x44'),EXTRACTED_REPORT_ID,_0xd435('0x45')));return analyticExtractedReport(_0xd435('0x46'),_0x3ced97?util[_0xd435('0x20')](_0xd435('0x40'),_0x37aa86,_0x3ced97?'zip':_0xd435('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd435('0x43')](util[_0xd435('0x20')](_0xd435('0x47'),EXTRACTED_REPORT_ID,_0xd435('0x45')));return db[_0xd435('0x48')][_0xd435('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd435('0x2d')](function(_0x347456){EXTRACTED_REPORT=_0x347456;return dbH[_0xd435('0x31')]['query'](util[_0xd435('0x20')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd435('0x31')][_0xd435('0x34')][_0xd435('0x35')]});})[_0xd435('0x2d')](extractReport)[_0xd435('0x4a')](function(_0x273c23){logger['info'](util[_0xd435('0x20')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0xd435('0x4b')](_0x273c23,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd435('0x4c'));})['finally'](function(){process[_0xd435('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x310d07=new PdfPrinter({'Arial':{'normal':__dirname+_0xd435('0x4e'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xd435('0x4f'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x310d07;}function getPDFDocDefinitionFromHTML(_0xb395d6,_0x10ccf0){var _0x1f762f=util['format']('%s\x20#%d',_0x10ccf0['channel'],_0x10ccf0[_0xd435('0x50')]);var _0x968761=moment()['format']('YYYY-MM-DD')['toString']();var _0x3280ae=htmlToPdfmake(_0xb395d6,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3280ae],'defaultStyle':{'font':_0xd435('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd435('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xd435('0x52'),'style':_0xd435('0x22')}];},'footer':function(_0x52ec2c,_0x51141f){return[{'text':util[_0xd435('0x20')](_0xd435('0x53'),_0x1f762f,_0x52ec2c,_0x51141f,_0x968761),'style':_0xd435('0x25')}];}};}function writePDFDocument(_0xd70298,_0x3b62e5){return new Promise(function(_0x1b0b09,_0x1f0ea){var _0x5873bd=_0xd70298[_0xd435('0x54')](fs[_0xd435('0x55')](_0x3b62e5));_0x5873bd['on']('finish',function(){_0x1b0b09('finish');});_0x5873bd['on']('error',function(_0xccc625){_0x1f0ea(_0xccc625);});_0xd70298[_0xd435('0x56')]();});}exports['createPdfFromHTML']=function(_0x51b1c7,_0x308eb8){var _0x1b5131=getPDFPrinter();var _0x239197=getPDFDocDefinitionFromHTML(_0x51b1c7,_0x308eb8);var _0x3d9254=_0x1b5131[_0xd435('0x3d')](_0x239197);return writePDFDocument(_0x3d9254,_0x308eb8[_0xd435('0x2')])[_0xd435('0x4a')](function(_0x3688c7){throw _0x3688c7;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 93378cc..ef03454 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 _0xd674=['SELECT','num','length','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','join','each','xlsx','%s.%s','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','splitSizeXlsx','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x1f2b0e,_0xc804dc){var _0x23b334=function(_0x138ed9){while(--_0x138ed9){_0x1f2b0e['push'](_0x1f2b0e['shift']());}};_0x23b334(++_0xc804dc);}(_0xd674,0xb9));var _0x4d67=function(_0x2883b1,_0x15fad8){_0x2883b1=_0x2883b1-0x0;var _0x52696a=_0xd674[_0x2883b1];return _0x52696a;};'use strict';var util=require(_0x4d67('0x0'));var path=require(_0x4d67('0x1'));var _=require(_0x4d67('0x2'));var fs=require('fs');var json2xls=require(_0x4d67('0x3'));var BPromise=require(_0x4d67('0x4'));var zipdir=require(_0x4d67('0x5'));var rimraf=require(_0x4d67('0x6'));var db=require(_0x4d67('0x7'))['db'];var dbH=require(_0x4d67('0x7'))[_0x4d67('0x8')];var logger=require(_0x4d67('0x9'))(_0x4d67('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x4d67('0xb')][0x2]);var QUERY=process[_0x4d67('0xb')][0x3];var PATH=process[_0x4d67('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5cc1d0,_0x484baa){var _0x4a21b6={'status':_0x5cc1d0};var _0x9ccd71={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x484baa){_0x4a21b6[_0x4d67('0xc')]=_0x484baa;}return db[_0x4d67('0xd')][_0x4d67('0xe')](_0x4a21b6,_0x9ccd71);}function main(){var _0x15f9b8=0x1388;var _0xf77a04;logger[_0x4d67('0xf')](util['format'](_0x4d67('0x10'),EXTRACTED_REPORT_ID,_0x4d67('0x11')));return db[_0x4d67('0x12')][_0x4d67('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4d67('0x14'),'splitSizeXlsx']})[_0x4d67('0x15')](function(_0x41bf2a){if(_0x41bf2a){_0xf77a04=_0x41bf2a;_0x15f9b8=_0xf77a04[_0x4d67('0x16')]||0x1388;}})['then'](function(){return dbH[_0x4d67('0x17')]['query'](util[_0x4d67('0x18')](_0x4d67('0x19'),QUERY),{'type':dbH[_0x4d67('0x17')][_0x4d67('0x1a')][_0x4d67('0x1b')]});})['then'](function(_0xcabb9b){if(!_0xcabb9b[0x0][_0x4d67('0x1c')]){return analyticExtractedReport('Empty');}var _0x35f177=[];var _0x1deca8=0x0;if(_0xf77a04[_0x4d67('0x14')]){if(_0xcabb9b&&_0xcabb9b[_0x4d67('0x1d')]){var _0x1be977=_[_0x4d67('0x1e')](_0xcabb9b[0x0][_0x4d67('0x1c')]/_0x15f9b8);var _0x2369a0=Number[_0x4d67('0x1f')](_0xcabb9b[0x0]['num']/_0x15f9b8)?_0xcabb9b[0x0]['num']%_0x15f9b8:0x0;_0x1be977[_0x4d67('0x20')](function(_0x400de1){if(_0x400de1>0x0){_0x1deca8+=_0x15f9b8;}_0x35f177['push'](dbH[_0x4d67('0x17')][_0x4d67('0x21')](util[_0x4d67('0x18')](_0x4d67('0x22'),QUERY,_0x15f9b8,_0x1deca8),{'type':dbH[_0x4d67('0x17')]['QueryTypes'][_0x4d67('0x1b')]}));});if(_0x2369a0>0x0){_0x1deca8+=_0x15f9b8;_0x35f177[_0x4d67('0x23')](dbH[_0x4d67('0x17')][_0x4d67('0x21')](util['format'](_0x4d67('0x22'),QUERY,_0x2369a0,_0x1deca8),{'type':dbH[_0x4d67('0x17')][_0x4d67('0x1a')]['SELECT']}));}}}else{_0x35f177[_0x4d67('0x23')](dbH['sequelize'][_0x4d67('0x21')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x4d67('0x1b')]}));}var _0x25c5ca=path[_0x4d67('0x24')](PATH);var _0x36f3cc=path[_0x4d67('0x25')](PATH,_0x4d67('0x26'));var _0x338e9e=_0xf77a04['split']&&_0x35f177[_0x4d67('0x1d')]>0x1;var _0x328396=[];if(!fs['existsSync'](path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc))&&_0x338e9e){fs['mkdirSync'](path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc));}return BPromise[_0x4d67('0x28')](_0x35f177,function(_0x1e0cf1){_0x328396[_0x4d67('0x23')](_0x1e0cf1);})['then'](function(){for(var _0x1b7c37=0x0;_0x1b7c37<_0x328396[_0x4d67('0x1d')];_0x1b7c37+=0x1){var _0x439360;var _0x2bac9d=_0x328396[_0x1b7c37];if(_0x338e9e){_0x439360=path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc,util[_0x4d67('0x18')]('%s%d.%s',_0x36f3cc,_0x1b7c37,_0x4d67('0x29')));}else{_0x439360=path['join'](_0x25c5ca,util[_0x4d67('0x18')](_0x4d67('0x2a'),_0x36f3cc,_0x4d67('0x29')));}fs['writeFileSync'](_0x439360,json2xls(_0x2bac9d),_0x4d67('0x2b'));}})['then'](function(){if(_0x338e9e){return new Promise(function(_0x55ce8f){zipdir(path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc),{'saveTo':path[_0x4d67('0x27')](_0x25c5ca,util[_0x4d67('0x18')](_0x4d67('0x2a'),_0x36f3cc,'zip'))},function(_0x15c39c,_0x50b688){rimraf(path[_0x4d67('0x27')](_0x25c5ca,_0x36f3cc),function(){});_0x55ce8f(_0x4d67('0x2c'));});});}})['then'](function(){logger[_0x4d67('0xf')](util[_0x4d67('0x18')](_0x4d67('0x2d'),EXTRACTED_REPORT_ID,_0x4d67('0x11')));return analyticExtractedReport(_0x4d67('0x2e'),_0x338e9e?util[_0x4d67('0x18')](_0x4d67('0x2a'),_0x36f3cc,_0x338e9e?_0x4d67('0x2f'):_0x4d67('0x29')):null);});})[_0x4d67('0x30')](function(_0x182a85){logger[_0x4d67('0xf')](util[_0x4d67('0x18')](_0x4d67('0x31'),EXTRACTED_REPORT_ID,_0x4d67('0x11')),util[_0x4d67('0x32')](_0x182a85,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4d67('0x33')](function(){process[_0x4d67('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xafbf=['inspect','Failed','finally','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','format','XLSX','split','then','splitSizeXlsx','sequelize','query','QueryTypes','SELECT','num','Empty','length','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Completed','info'];(function(_0x200517,_0x5ba257){var _0x509f69=function(_0x19e35f){while(--_0x19e35f){_0x200517['push'](_0x200517['shift']());}};_0x509f69(++_0x5ba257);}(_0xafbf,0x130));var _0xfafb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xafbf[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0xfafb('0x0'));var path=require('path');var _=require(_0xfafb('0x1'));var fs=require('fs');var json2xls=require(_0xfafb('0x2'));var BPromise=require(_0xfafb('0x3'));var zipdir=require(_0xfafb('0x4'));var rimraf=require(_0xfafb('0x5'));var db=require(_0xfafb('0x6'))['db'];var dbH=require(_0xfafb('0x6'))[_0xfafb('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xfafb('0x8')][0x2]);var QUERY=process[_0xfafb('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x598cbe,_0x110a1d){var _0x2526c2={'status':_0x598cbe};var _0x5bb1be={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x110a1d){_0x2526c2[_0xfafb('0x9')]=_0x110a1d;}return db['AnalyticExtractedReport']['update'](_0x2526c2,_0x5bb1be);}function main(){var _0xadd5cf=0x1388;var _0x23fd65;logger['info'](util[_0xfafb('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xfafb('0xb')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfafb('0xc'),'splitSizeXlsx']})[_0xfafb('0xd')](function(_0x3f2446){if(_0x3f2446){_0x23fd65=_0x3f2446;_0xadd5cf=_0x23fd65[_0xfafb('0xe')]||0x1388;}})[_0xfafb('0xd')](function(){return dbH[_0xfafb('0xf')][_0xfafb('0x10')](util[_0xfafb('0xa')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xfafb('0xf')][_0xfafb('0x11')][_0xfafb('0x12')]});})[_0xfafb('0xd')](function(_0x1757a6){if(!_0x1757a6[0x0][_0xfafb('0x13')]){return analyticExtractedReport(_0xfafb('0x14'));}var _0x4d1bdc=[];var _0x58a2cb=0x0;if(_0x23fd65[_0xfafb('0xc')]){if(_0x1757a6&&_0x1757a6[_0xfafb('0x15')]){var _0x34a9a1=_['range'](_0x1757a6[0x0]['num']/_0xadd5cf);var _0x54d563=Number[_0xfafb('0x16')](_0x1757a6[0x0][_0xfafb('0x13')]/_0xadd5cf)?_0x1757a6[0x0][_0xfafb('0x13')]%_0xadd5cf:0x0;_0x34a9a1[_0xfafb('0x17')](function(_0x6019d){if(_0x6019d>0x0){_0x58a2cb+=_0xadd5cf;}_0x4d1bdc['push'](dbH[_0xfafb('0xf')]['query'](util[_0xfafb('0xa')](_0xfafb('0x18'),QUERY,_0xadd5cf,_0x58a2cb),{'type':dbH[_0xfafb('0xf')][_0xfafb('0x11')][_0xfafb('0x12')]}));});if(_0x54d563>0x0){_0x58a2cb+=_0xadd5cf;_0x4d1bdc[_0xfafb('0x19')](dbH['sequelize'][_0xfafb('0x10')](util[_0xfafb('0xa')](_0xfafb('0x18'),QUERY,_0x54d563,_0x58a2cb),{'type':dbH[_0xfafb('0xf')]['QueryTypes'][_0xfafb('0x12')]}));}}}else{_0x4d1bdc[_0xfafb('0x19')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0xfafb('0x11')][_0xfafb('0x12')]}));}var _0x16ae35=path[_0xfafb('0x1a')](PATH);var _0x376dfc=path[_0xfafb('0x1b')](PATH,_0xfafb('0x1c'));var _0x230c91=_0x23fd65[_0xfafb('0xc')]&&_0x4d1bdc[_0xfafb('0x15')]>0x1;var _0x127340=[];if(!fs['existsSync'](path[_0xfafb('0x1d')](_0x16ae35,_0x376dfc))&&_0x230c91){fs['mkdirSync'](path[_0xfafb('0x1d')](_0x16ae35,_0x376dfc));}return BPromise[_0xfafb('0x1e')](_0x4d1bdc,function(_0x1d51b2){_0x127340[_0xfafb('0x19')](_0x1d51b2);})[_0xfafb('0xd')](function(){for(var _0x23ada5=0x0;_0x23ada5<_0x127340[_0xfafb('0x15')];_0x23ada5+=0x1){var _0x443f41;var _0x439ddc=_0x127340[_0x23ada5];if(_0x230c91){_0x443f41=path[_0xfafb('0x1d')](_0x16ae35,_0x376dfc,util[_0xfafb('0xa')](_0xfafb('0x1f'),_0x376dfc,_0x23ada5,_0xfafb('0x20')));}else{_0x443f41=path[_0xfafb('0x1d')](_0x16ae35,util[_0xfafb('0xa')](_0xfafb('0x21'),_0x376dfc,_0xfafb('0x20')));}fs[_0xfafb('0x22')](_0x443f41,json2xls(_0x439ddc),_0xfafb('0x23'));}})[_0xfafb('0xd')](function(){if(_0x230c91){return new Promise(function(_0x53c476){zipdir(path[_0xfafb('0x1d')](_0x16ae35,_0x376dfc),{'saveTo':path[_0xfafb('0x1d')](_0x16ae35,util[_0xfafb('0xa')](_0xfafb('0x21'),_0x376dfc,_0xfafb('0x24')))},function(_0x38f27c,_0x158db1){rimraf(path[_0xfafb('0x1d')](_0x16ae35,_0x376dfc),function(){});_0x53c476(_0xfafb('0x25'));});});}})[_0xfafb('0xd')](function(){logger['info'](util[_0xfafb('0xa')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xfafb('0xb')));return analyticExtractedReport(_0xfafb('0x26'),_0x230c91?util[_0xfafb('0xa')]('%s.%s',_0x376dfc,_0x230c91?_0xfafb('0x24'):'xlsx'):null);});})['catch'](function(_0x307916){logger[_0xfafb('0x27')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0xfafb('0x28')](_0x307916,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfafb('0x29'));})[_0xfafb('0x2a')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index e7df02d..5fe30c2 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 _0xb67f=['intervals','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','find','push','type','Set','format','CDR(type)=%s','priority','VoiceExtensionId','inbound','context','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','VoiceExtension','sortBy','catch','lodash','util','models','Interval','findAll','then'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xb67f,0x1dd));var _0xfb67=function(_0x113485,_0x1d82dd){_0x113485=_0x113485-0x0;var _0x38d59d=_0xb67f[_0x113485];return _0x38d59d;};'use strict';var _=require(_0xfb67('0x0'));var util=require(_0xfb67('0x1'));function rewrite(_0x173c88,_0x2c658b){var _0xa93480=this;return _0x173c88[_0xfb67('0x2')][_0xfb67('0x3')][_0xfb67('0x4')]({'raw':!![]})[_0xfb67('0x5')](function(_0x1d92fc){_0xa93480[_0xfb67('0x6')]=_0x1d92fc;return _0x173c88[_0xfb67('0x2')]['VoiceExtension'][_0xfb67('0x4')]({'where':{'IntervalId':_0x2c658b[_0xfb67('0x7')]},'raw':!![]});})['then'](function(_0x2f9495){return _0x173c88[_0xfb67('0x2')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0xfb67('0x8')](_[_0xfb67('0x9')](_0x2f9495,_0xfb67('0xa')))}},'order':[{'raw':_0xfb67('0xb')}],'raw':!![]});})[_0xfb67('0x5')](function(_0x5c8db5){var _0x138d8c=_['filter'](_0x5c8db5,{'priority':'1'});var _0x5e918d=_[_0xfb67('0xc')](_0x5c8db5,{'isApp':0x1});var _0x116fc0=_[_0xfb67('0xd')](_0x5e918d,'exten');var _0x3811d6=[_0xfb67('0xe'),_0xfb67('0xf')];var _0x2f7296=[];var _0x43f723=[];for(var _0x660e01 in _0x116fc0){if(_0x116fc0[_0xfb67('0x10')](_0x660e01)){_0xa93480['priority']=0x2;_0xa93480[_0xfb67('0x11')]=[];_0xa93480['extension']=_[_0xfb67('0x12')](_0x138d8c,{'exten':_0x116fc0[_0x660e01][0x0]['exten']});_0xa93480[_0xfb67('0x11')][_0xfb67('0x13')]({'type':_0x116fc0[_0x660e01][0x0][_0xfb67('0x14')],'app':_0xfb67('0x15'),'appdata':util[_0xfb67('0x16')](_0xfb67('0x17'),_0x116fc0[_0x660e01][0x0][_0xfb67('0x14')]),'context':_0x116fc0[_0x660e01][0x0]['context'],'exten':_0x116fc0[_0x660e01][0x0]['exten'],'priority':_0xa93480[_0xfb67('0x18')]++,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0][_0xfb67('0x19')]});if(_0x116fc0[_0x660e01][0x0][_0xfb67('0x14')]===_0xfb67('0x1a')){_0xa93480['extensions'][_0xfb67('0x13')]({'type':_0x116fc0[_0x660e01][0x0][_0xfb67('0x14')],'app':_0xfb67('0x15'),'appdata':'CDR(routeid)='+_0x116fc0[_0x660e01][0x0]['VoiceExtensionId'],'context':_0x116fc0[_0x660e01][0x0][_0xfb67('0x1b')],'exten':_0x116fc0[_0x660e01][0x0][_0xfb67('0xa')],'priority':_0xa93480[_0xfb67('0x18')]++,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0][_0xfb67('0x19')]});}else if(_0x116fc0[_0x660e01][0x0][_0xfb67('0x14')]===_0xfb67('0x1c')){if(_0xa93480[_0xfb67('0x1d')]){_0xa93480[_0xfb67('0x11')][_0xfb67('0x13')]({'type':_0x116fc0[_0x660e01][0x0][_0xfb67('0x14')],'app':_0xfb67('0x15'),'appdata':_0xfb67('0x1e')+(_0xa93480['extension'][_0xfb67('0x1f')]?_0xfb67('0x20')+_0xa93480[_0xfb67('0x1d')]['cutdigits']+'}':_0xfb67('0x21')),'context':_0x116fc0[_0x660e01][0x0]['context'],'exten':_0x116fc0[_0x660e01][0x0][_0xfb67('0xa')],'priority':_0xa93480[_0xfb67('0x18')]++,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0]['VoiceExtensionId']});}_0xa93480[_0xfb67('0x11')][_0xfb67('0x13')]({'type':_0x116fc0[_0x660e01][0x0][_0xfb67('0x14')],'app':_0xfb67('0x15'),'appdata':_0xfb67('0x22')+_0x116fc0[_0x660e01][0x0][_0xfb67('0x19')],'context':_0x116fc0[_0x660e01][0x0][_0xfb67('0x1b')],'exten':_0x116fc0[_0x660e01][0x0][_0xfb67('0xa')],'priority':_0xa93480['priority']++,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0]['VoiceExtensionId']});var _0x2a8764=_0xa93480[_0xfb67('0x18')]++;_0xa93480[_0xfb67('0x11')][_0xfb67('0x13')]({'type':_0x116fc0[_0x660e01][0x0]['type'],'app':_0xfb67('0x23'),'appdata':_0xfb67('0x24')+(_0x2a8764+0x2)+_0xfb67('0x25')+(_0x2a8764+0x1)+')','context':_0x116fc0[_0x660e01][0x0][_0xfb67('0x1b')],'exten':_0x116fc0[_0x660e01][0x0]['exten'],'priority':_0x2a8764,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0][_0xfb67('0x19')]});if(_0xa93480[_0xfb67('0x1d')]){_0xa93480[_0xfb67('0x11')][_0xfb67('0x13')]({'type':_0x116fc0[_0x660e01][0x0][_0xfb67('0x14')],'app':_0xfb67('0x15'),'appdata':_0xa93480[_0xfb67('0x1d')][_0xfb67('0x1f')]?'CDR(prefix)=${EXTEN:0:'+_0xa93480[_0xfb67('0x1d')]['cutdigits']+'}':_0xfb67('0x26'),'context':_0x116fc0[_0x660e01][0x0][_0xfb67('0x1b')],'exten':_0x116fc0[_0x660e01][0x0][_0xfb67('0xa')],'priority':_0xa93480[_0xfb67('0x18')]++,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0]['VoiceExtensionId']});}_0xa93480['extensions'][_0xfb67('0x13')]({'type':_0x116fc0[_0x660e01][0x0]['type'],'app':_0xfb67('0x15'),'appdata':'outboundrouteid='+_0x116fc0[_0x660e01][0x0][_0xfb67('0x19')],'context':_0x116fc0[_0x660e01][0x0][_0xfb67('0x1b')],'exten':_0x116fc0[_0x660e01][0x0]['exten'],'priority':_0xa93480[_0xfb67('0x18')]++,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0][_0xfb67('0x19')]});if(_0xa93480[_0xfb67('0x1d')]&&_0xa93480['extension'][_0xfb67('0x10')](_0xfb67('0x27'))&&_0xa93480[_0xfb67('0x1d')]['recordingFormat']!==_0xfb67('0x28')){_0xa93480['extensions'][_0xfb67('0x13')]({'type':_0x116fc0[_0x660e01][0x0][_0xfb67('0x14')],'app':'Set','appdata':_0xfb67('0x29'),'context':_0x116fc0[_0x660e01][0x0][_0xfb67('0x1b')],'exten':_0x116fc0[_0x660e01][0x0][_0xfb67('0xa')],'priority':_0xa93480['priority']++,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0]['VoiceExtensionId']});_0xa93480[_0xfb67('0x11')]['push']({'type':_0x116fc0[_0x660e01][0x0][_0xfb67('0x14')],'app':_0xfb67('0x15'),'appdata':_0xfb67('0x2a')+_0xa93480[_0xfb67('0x1d')]['recordingFormat']||'wav','context':_0x116fc0[_0x660e01][0x0][_0xfb67('0x1b')],'exten':_0x116fc0[_0x660e01][0x0][_0xfb67('0xa')],'priority':_0xa93480['priority']++,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0]['VoiceExtensionId']});}}_0xa93480[_0xfb67('0x11')][_0xfb67('0x13')]({'type':_0x116fc0[_0x660e01][0x0][_0xfb67('0x14')],'app':'Set','appdata':_0xfb67('0x2b'),'context':_0x116fc0[_0x660e01][0x0]['context'],'exten':_0x116fc0[_0x660e01][0x0]['exten'],'priority':_0xa93480[_0xfb67('0x18')]++,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0][_0xfb67('0x19')]});_0xa93480[_0xfb67('0x11')]['push']({'type':_0x116fc0[_0x660e01][0x0][_0xfb67('0x14')],'app':_0xfb67('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x116fc0[_0x660e01][0x0][_0xfb67('0x1b')],'exten':_0x116fc0[_0x660e01][0x0][_0xfb67('0xa')],'priority':_0xa93480[_0xfb67('0x18')]++,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0][_0xfb67('0x19')]});_0xa93480[_0xfb67('0x11')][_0xfb67('0x13')]({'type':_0x116fc0[_0x660e01][0x0]['type'],'app':_0xfb67('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x116fc0[_0x660e01][0x0][_0xfb67('0x1b')],'exten':_0x116fc0[_0x660e01][0x0][_0xfb67('0xa')],'priority':_0xa93480[_0xfb67('0x18')]++,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0]['VoiceExtensionId']});for(var _0x50948a=0x0,_0x5e4125=0x0;_0x50948a<_0x116fc0[_0x660e01][_0xfb67('0x2c')];_0x50948a+=0x1,_0x5e4125=0x0){var _0x590335=_0x116fc0[_0x660e01][_0x50948a];if(_0x590335[_0xfb67('0x14')]){_0x590335[_0xfb67('0x14')]=_0x590335[_0xfb67('0x14')][_0xfb67('0x2d')]();}var _0x5b85ce=[];var _0x4f9d45=[];delete _0x590335['id'];delete _0x590335[_0xfb67('0x2e')];delete _0x590335[_0xfb67('0x2f')];var _0x556d1c=_0x590335[_0xfb67('0x30')]!==_0xfb67('0x31')?[_0x590335[_0xfb67('0x30')]]:_0x590335[_0xfb67('0x7')]?_['map'](_[_0xfb67('0xc')](_0xa93480[_0xfb67('0x6')],{'IntervalId':_0x590335['IntervalId']}),_0xfb67('0x30')):[];if(_0x590335['hasOwnProperty']('tag')){if(_0x590335[_0xfb67('0x32')]&&_0x590335[_0xfb67('0x32')]!=='--'){_0x5b85ce['push']({'type':_0x590335['type'],'app':'Set','appdata':_0xfb67('0x33')+_0x590335[_0xfb67('0x32')],'context':_0x590335[_0xfb67('0x1b')],'exten':_0x590335[_0xfb67('0xa')],'priority':_0x556d1c[_0xfb67('0x2c')]+_0xa93480[_0xfb67('0x18')]+_0x5e4125++,'VoiceExtensionId':_0x590335[_0xfb67('0x19')]});}}if(_0x590335['type']===_0xfb67('0x1c')&&_0x590335['hasOwnProperty'](_0xfb67('0x34'))){if(_0x590335[_0xfb67('0x34')]){_0x5b85ce['push']({'type':_0x590335[_0xfb67('0x14')],'app':_0xfb67('0x23'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x590335[_0xfb67('0x34')]+')','context':_0x590335['context'],'exten':_0x590335[_0xfb67('0xa')],'priority':_0x556d1c[_0xfb67('0x2c')]+_0xa93480[_0xfb67('0x18')]+_0x5e4125++,'VoiceExtensionId':_0x590335[_0xfb67('0x19')]});}else{_0x5b85ce[_0xfb67('0x13')]({'type':_0x590335[_0xfb67('0x14')],'app':_0xfb67('0x23'),'appdata':_0xfb67('0x35'),'context':_0x590335[_0xfb67('0x1b')],'exten':_0x590335[_0xfb67('0xa')],'priority':_0x556d1c['length']+_0xa93480[_0xfb67('0x18')]+_0x5e4125++,'VoiceExtensionId':_0x590335[_0xfb67('0x19')]});}}if(_0x590335['hasOwnProperty'](_0xfb67('0x36'))){if(_0x3811d6[_0xfb67('0x37')](_0x590335[_0xfb67('0x38')][_0xfb67('0x2d')]())>=0x0&&_0x590335['appType']!==_0xfb67('0x39')){if(_0x590335[_0xfb67('0x36')]){_0x5b85ce[_0xfb67('0x13')]({'type':_0x590335[_0xfb67('0x14')],'app':_0xfb67('0x23'),'appdata':_0xfb67('0x3a'),'context':_0x590335[_0xfb67('0x1b')],'exten':_0x590335[_0xfb67('0xa')],'priority':_0x556d1c['length']+_0xa93480[_0xfb67('0x18')]+_0x5e4125++,'VoiceExtensionId':_0x590335[_0xfb67('0x19')]});_0x5b85ce['push']({'type':_0x590335[_0xfb67('0x14')],'app':'Set','appdata':_0xfb67('0x3b'),'context':_0x590335[_0xfb67('0x1b')],'exten':_0x590335[_0xfb67('0xa')],'priority':_0x556d1c['length']+_0xa93480[_0xfb67('0x18')]+_0x5e4125++,'VoiceExtensionId':_0x590335[_0xfb67('0x19')]});}else{_0x5b85ce[_0xfb67('0x13')]({'type':_0x590335[_0xfb67('0x14')],'app':_0xfb67('0x23'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x590335[_0xfb67('0x1b')],'exten':_0x590335['exten'],'priority':_0x556d1c[_0xfb67('0x2c')]+_0xa93480[_0xfb67('0x18')]+_0x5e4125++,'VoiceExtensionId':_0x590335['VoiceExtensionId']});_0x5b85ce[_0xfb67('0x13')]({'type':_0x590335[_0xfb67('0x14')],'app':_0xfb67('0x15'),'appdata':_0xfb67('0x3c'),'context':_0x590335[_0xfb67('0x1b')],'exten':_0x590335[_0xfb67('0xa')],'priority':_0x556d1c['length']+_0xa93480['priority']+_0x5e4125++,'VoiceExtensionId':_0x590335[_0xfb67('0x19')]});}}}for(var _0x407b17=0x0;_0x407b17<_0x556d1c[_0xfb67('0x2c')];_0x407b17+=0x1){var _0x38013f=_0xa93480[_0xfb67('0x18')]+_0x556d1c[_0xfb67('0x2c')];var _0x1a7fe0=_0x407b17===_0x556d1c[_0xfb67('0x2c')]-0x1?_0xa93480[_0xfb67('0x18')]+_0x5b85ce[_0xfb67('0x2c')]+_0x4f9d45[_0xfb67('0x2c')]+0x2:_0xa93480[_0xfb67('0x18')]+_0x407b17+0x1;_0x5b85ce['splice'](_0x407b17,0x0,{'type':_0x590335['type'],'app':_0xfb67('0x3d'),'appdata':_0x556d1c[_0x407b17]+'?'+_0x590335[_0xfb67('0x1b')]+_0xfb67('0x3e')+_0x38013f+':'+_0x590335[_0xfb67('0x1b')]+_0xfb67('0x3e')+_0x1a7fe0,'exten':_0x590335[_0xfb67('0xa')],'context':_0x590335['context'],'priority':_0xa93480[_0xfb67('0x18')]+_0x407b17,'VoiceExtensionId':_0x116fc0[_0x660e01][0x0]['VoiceExtensionId']});}_0x590335['priority']=_0x5b85ce[_0xfb67('0x2c')]?_[_0xfb67('0x3f')](_0x5b85ce)[_0xfb67('0x18')]+0x1:_0xa93480[_0xfb67('0x18')];_0xa93480['priority']=(_0x4f9d45[_0xfb67('0x2c')]?_['last'](_0x4f9d45)[_0xfb67('0x18')]:_0x590335[_0xfb67('0x18')])+0x1;_0xa93480['extensions']=_[_0xfb67('0x40')](_0xa93480['extensions'],_0x5b85ce,[_0x590335],_0x4f9d45);}_0xa93480[_0xfb67('0x11')][_0xfb67('0x13')]({'type':_0x116fc0[_0x660e01][0x0]['type'],'app':'Hangup','exten':_0x116fc0[_0x660e01][0x0][_0xfb67('0xa')],'context':_0x116fc0[_0x660e01][0x0]['context'],'priority':_0xa93480[_0xfb67('0x18')],'VoiceExtensionId':_0x116fc0[_0x660e01][0x0][_0xfb67('0x19')]});_0x2f7296[_0xfb67('0x13')](_0x116fc0[_0x660e01][0x0][_0xfb67('0x19')]);_0x43f723=_[_0xfb67('0x40')](_0x43f723,_0xa93480[_0xfb67('0x11')]);}}return _0x173c88[_0xfb67('0x41')](function(_0x1d2be0){return _0x173c88[_0xfb67('0x2')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x2f7296}},'transaction':_0x1d2be0})[_0xfb67('0x5')](function(_0x3b8d45){return _0x173c88[_0xfb67('0x2')][_0xfb67('0x42')]['bulkCreate'](_[_0xfb67('0x43')](_0x43f723,'priority'),{'transaction':_0x1d2be0});});});})[_0xfb67('0x44')](function(_0x418b1f){console['error'](_0x418b1f);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xcb3e=['CDR(destination)=','extension','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','intervals','tag','CDR(tag)=','outbound','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','extensions','push','type','format','CDR(type)=%s','context','priority','Set','CDR(routeid)=','VoiceExtensionId'];(function(_0x555d4a,_0xae3113){var _0x965087=function(_0x226afe){while(--_0x226afe){_0x555d4a['push'](_0x555d4a['shift']());}};_0x965087(++_0xae3113);}(_0xcb3e,0x77));var _0xecb3=function(_0x5051fa,_0x358ab2){_0x5051fa=_0x5051fa-0x0;var _0x4180cf=_0xcb3e[_0x5051fa];return _0x4180cf;};'use strict';var _=require(_0xecb3('0x0'));var util=require(_0xecb3('0x1'));function rewrite(_0x321860,_0x59abe2){var _0x3fd443=this;return _0x321860[_0xecb3('0x2')][_0xecb3('0x3')][_0xecb3('0x4')]({'raw':!![]})[_0xecb3('0x5')](function(_0x17d0df){_0x3fd443['intervals']=_0x17d0df;return _0x321860[_0xecb3('0x2')][_0xecb3('0x6')][_0xecb3('0x4')]({'where':{'IntervalId':_0x59abe2[_0xecb3('0x7')]},'raw':!![]});})[_0xecb3('0x5')](function(_0x3ee70f){return _0x321860[_0xecb3('0x2')][_0xecb3('0x6')][_0xecb3('0x4')]({'where':{'exten':{'$in':_[_0xecb3('0x8')](_[_0xecb3('0x9')](_0x3ee70f,_0xecb3('0xa')))}},'order':[{'raw':_0xecb3('0xb')}],'raw':!![]});})[_0xecb3('0x5')](function(_0x448062){var _0x3f0a2b=_[_0xecb3('0xc')](_0x448062,{'priority':'1'});var _0x5437a4=_[_0xecb3('0xc')](_0x448062,{'isApp':0x1});var _0x295753=_['groupBy'](_0x5437a4,_0xecb3('0xa'));var _0x1be129=['queue',_0xecb3('0xd')];var _0x45a072=[];var _0x42c267=[];for(var _0x198cfa in _0x295753){if(_0x295753[_0xecb3('0xe')](_0x198cfa)){_0x3fd443['priority']=0x2;_0x3fd443[_0xecb3('0xf')]=[];_0x3fd443['extension']=_['find'](_0x3f0a2b,{'exten':_0x295753[_0x198cfa][0x0]['exten']});_0x3fd443[_0xecb3('0xf')][_0xecb3('0x10')]({'type':_0x295753[_0x198cfa][0x0][_0xecb3('0x11')],'app':'Set','appdata':util[_0xecb3('0x12')](_0xecb3('0x13'),_0x295753[_0x198cfa][0x0][_0xecb3('0x11')]),'context':_0x295753[_0x198cfa][0x0][_0xecb3('0x14')],'exten':_0x295753[_0x198cfa][0x0][_0xecb3('0xa')],'priority':_0x3fd443[_0xecb3('0x15')]++,'VoiceExtensionId':_0x295753[_0x198cfa][0x0]['VoiceExtensionId']});if(_0x295753[_0x198cfa][0x0]['type']==='inbound'){_0x3fd443['extensions'][_0xecb3('0x10')]({'type':_0x295753[_0x198cfa][0x0][_0xecb3('0x11')],'app':_0xecb3('0x16'),'appdata':_0xecb3('0x17')+_0x295753[_0x198cfa][0x0][_0xecb3('0x18')],'context':_0x295753[_0x198cfa][0x0][_0xecb3('0x14')],'exten':_0x295753[_0x198cfa][0x0][_0xecb3('0xa')],'priority':_0x3fd443['priority']++,'VoiceExtensionId':_0x295753[_0x198cfa][0x0]['VoiceExtensionId']});}else if(_0x295753[_0x198cfa][0x0]['type']==='outbound'){if(_0x3fd443['extension']){_0x3fd443['extensions'][_0xecb3('0x10')]({'type':_0x295753[_0x198cfa][0x0][_0xecb3('0x11')],'app':_0xecb3('0x16'),'appdata':_0xecb3('0x19')+(_0x3fd443[_0xecb3('0x1a')][_0xecb3('0x1b')]?_0xecb3('0x1c')+_0x3fd443[_0xecb3('0x1a')][_0xecb3('0x1b')]+'}':_0xecb3('0x1d')),'context':_0x295753[_0x198cfa][0x0][_0xecb3('0x14')],'exten':_0x295753[_0x198cfa][0x0][_0xecb3('0xa')],'priority':_0x3fd443['priority']++,'VoiceExtensionId':_0x295753[_0x198cfa][0x0]['VoiceExtensionId']});}_0x3fd443[_0xecb3('0xf')][_0xecb3('0x10')]({'type':_0x295753[_0x198cfa][0x0]['type'],'app':_0xecb3('0x16'),'appdata':'CDR(routeid)='+_0x295753[_0x198cfa][0x0][_0xecb3('0x18')],'context':_0x295753[_0x198cfa][0x0][_0xecb3('0x14')],'exten':_0x295753[_0x198cfa][0x0]['exten'],'priority':_0x3fd443[_0xecb3('0x15')]++,'VoiceExtensionId':_0x295753[_0x198cfa][0x0][_0xecb3('0x18')]});var _0x2af07c=_0x3fd443['priority']++;_0x3fd443[_0xecb3('0xf')][_0xecb3('0x10')]({'type':_0x295753[_0x198cfa][0x0][_0xecb3('0x11')],'app':_0xecb3('0x1e'),'appdata':_0xecb3('0x1f')+(_0x2af07c+0x2)+'):Goto('+(_0x2af07c+0x1)+')','context':_0x295753[_0x198cfa][0x0][_0xecb3('0x14')],'exten':_0x295753[_0x198cfa][0x0]['exten'],'priority':_0x2af07c,'VoiceExtensionId':_0x295753[_0x198cfa][0x0]['VoiceExtensionId']});if(_0x3fd443[_0xecb3('0x1a')]){_0x3fd443[_0xecb3('0xf')][_0xecb3('0x10')]({'type':_0x295753[_0x198cfa][0x0][_0xecb3('0x11')],'app':_0xecb3('0x16'),'appdata':_0x3fd443[_0xecb3('0x1a')][_0xecb3('0x1b')]?_0xecb3('0x20')+_0x3fd443[_0xecb3('0x1a')][_0xecb3('0x1b')]+'}':_0xecb3('0x21'),'context':_0x295753[_0x198cfa][0x0][_0xecb3('0x14')],'exten':_0x295753[_0x198cfa][0x0]['exten'],'priority':_0x3fd443[_0xecb3('0x15')]++,'VoiceExtensionId':_0x295753[_0x198cfa][0x0]['VoiceExtensionId']});}_0x3fd443[_0xecb3('0xf')][_0xecb3('0x10')]({'type':_0x295753[_0x198cfa][0x0][_0xecb3('0x11')],'app':_0xecb3('0x16'),'appdata':'outboundrouteid='+_0x295753[_0x198cfa][0x0][_0xecb3('0x18')],'context':_0x295753[_0x198cfa][0x0]['context'],'exten':_0x295753[_0x198cfa][0x0]['exten'],'priority':_0x3fd443[_0xecb3('0x15')]++,'VoiceExtensionId':_0x295753[_0x198cfa][0x0]['VoiceExtensionId']});if(_0x3fd443[_0xecb3('0x1a')]&&_0x3fd443[_0xecb3('0x1a')][_0xecb3('0xe')]('recordingFormat')&&_0x3fd443[_0xecb3('0x1a')][_0xecb3('0x22')]!==_0xecb3('0x23')){_0x3fd443['extensions'][_0xecb3('0x10')]({'type':_0x295753[_0x198cfa][0x0][_0xecb3('0x11')],'app':'Set','appdata':_0xecb3('0x24'),'context':_0x295753[_0x198cfa][0x0]['context'],'exten':_0x295753[_0x198cfa][0x0][_0xecb3('0xa')],'priority':_0x3fd443[_0xecb3('0x15')]++,'VoiceExtensionId':_0x295753[_0x198cfa][0x0][_0xecb3('0x18')]});_0x3fd443[_0xecb3('0xf')]['push']({'type':_0x295753[_0x198cfa][0x0]['type'],'app':_0xecb3('0x16'),'appdata':_0xecb3('0x25')+_0x3fd443[_0xecb3('0x1a')]['recordingFormat']||_0xecb3('0x26'),'context':_0x295753[_0x198cfa][0x0][_0xecb3('0x14')],'exten':_0x295753[_0x198cfa][0x0][_0xecb3('0xa')],'priority':_0x3fd443[_0xecb3('0x15')]++,'VoiceExtensionId':_0x295753[_0x198cfa][0x0][_0xecb3('0x18')]});}}_0x3fd443[_0xecb3('0xf')][_0xecb3('0x10')]({'type':_0x295753[_0x198cfa][0x0][_0xecb3('0x11')],'app':_0xecb3('0x16'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x295753[_0x198cfa][0x0][_0xecb3('0x14')],'exten':_0x295753[_0x198cfa][0x0][_0xecb3('0xa')],'priority':_0x3fd443[_0xecb3('0x15')]++,'VoiceExtensionId':_0x295753[_0x198cfa][0x0][_0xecb3('0x18')]});_0x3fd443['extensions'][_0xecb3('0x10')]({'type':_0x295753[_0x198cfa][0x0]['type'],'app':_0xecb3('0x16'),'appdata':_0xecb3('0x27'),'context':_0x295753[_0x198cfa][0x0]['context'],'exten':_0x295753[_0x198cfa][0x0][_0xecb3('0xa')],'priority':_0x3fd443['priority']++,'VoiceExtensionId':_0x295753[_0x198cfa][0x0]['VoiceExtensionId']});_0x3fd443[_0xecb3('0xf')]['push']({'type':_0x295753[_0x198cfa][0x0][_0xecb3('0x11')],'app':_0xecb3('0x16'),'appdata':_0xecb3('0x28'),'context':_0x295753[_0x198cfa][0x0][_0xecb3('0x14')],'exten':_0x295753[_0x198cfa][0x0][_0xecb3('0xa')],'priority':_0x3fd443[_0xecb3('0x15')]++,'VoiceExtensionId':_0x295753[_0x198cfa][0x0][_0xecb3('0x18')]});for(var _0x26689f=0x0,_0x1b800e=0x0;_0x26689f<_0x295753[_0x198cfa][_0xecb3('0x29')];_0x26689f+=0x1,_0x1b800e=0x0){var _0xf4a119=_0x295753[_0x198cfa][_0x26689f];if(_0xf4a119[_0xecb3('0x11')]){_0xf4a119[_0xecb3('0x11')]=_0xf4a119[_0xecb3('0x11')][_0xecb3('0x2a')]();}var _0x5b645e=[];var _0x84d78f=[];delete _0xf4a119['id'];delete _0xf4a119[_0xecb3('0x2b')];delete _0xf4a119[_0xecb3('0x2c')];var _0x5127d1=_0xf4a119['interval']!=='*,*,*,*'?[_0xf4a119[_0xecb3('0x2d')]]:_0xf4a119[_0xecb3('0x7')]?_[_0xecb3('0x9')](_[_0xecb3('0xc')](_0x3fd443[_0xecb3('0x2e')],{'IntervalId':_0xf4a119[_0xecb3('0x7')]}),'interval'):[];if(_0xf4a119[_0xecb3('0xe')](_0xecb3('0x2f'))){if(_0xf4a119[_0xecb3('0x2f')]&&_0xf4a119['tag']!=='--'){_0x5b645e['push']({'type':_0xf4a119['type'],'app':_0xecb3('0x16'),'appdata':_0xecb3('0x30')+_0xf4a119[_0xecb3('0x2f')],'context':_0xf4a119['context'],'exten':_0xf4a119[_0xecb3('0xa')],'priority':_0x5127d1['length']+_0x3fd443[_0xecb3('0x15')]+_0x1b800e++,'VoiceExtensionId':_0xf4a119[_0xecb3('0x18')]});}}if(_0xf4a119[_0xecb3('0x11')]===_0xecb3('0x31')&&_0xf4a119[_0xecb3('0xe')]('callerID')){if(_0xf4a119['callerID']){_0x5b645e['push']({'type':_0xf4a119[_0xecb3('0x11')],'app':_0xecb3('0x1e'),'appdata':_0xecb3('0x32')+_0xf4a119[_0xecb3('0x33')]+')','context':_0xf4a119[_0xecb3('0x14')],'exten':_0xf4a119[_0xecb3('0xa')],'priority':_0x5127d1['length']+_0x3fd443[_0xecb3('0x15')]+_0x1b800e++,'VoiceExtensionId':_0xf4a119[_0xecb3('0x18')]});}else{_0x5b645e[_0xecb3('0x10')]({'type':_0xf4a119[_0xecb3('0x11')],'app':_0xecb3('0x1e'),'appdata':_0xecb3('0x34'),'context':_0xf4a119[_0xecb3('0x14')],'exten':_0xf4a119[_0xecb3('0xa')],'priority':_0x5127d1[_0xecb3('0x29')]+_0x3fd443[_0xecb3('0x15')]+_0x1b800e++,'VoiceExtensionId':_0xf4a119[_0xecb3('0x18')]});}}if(_0xf4a119[_0xecb3('0xe')](_0xecb3('0x35'))){if(_0x1be129[_0xecb3('0x36')](_0xf4a119[_0xecb3('0x37')][_0xecb3('0x2a')]())>=0x0&&_0xf4a119[_0xecb3('0x38')]!==_0xecb3('0x39')){if(_0xf4a119[_0xecb3('0x35')]){_0x5b645e[_0xecb3('0x10')]({'type':_0xf4a119[_0xecb3('0x11')],'app':_0xecb3('0x1e'),'appdata':_0xecb3('0x3a'),'context':_0xf4a119[_0xecb3('0x14')],'exten':_0xf4a119['exten'],'priority':_0x5127d1[_0xecb3('0x29')]+_0x3fd443[_0xecb3('0x15')]+_0x1b800e++,'VoiceExtensionId':_0xf4a119[_0xecb3('0x18')]});_0x5b645e[_0xecb3('0x10')]({'type':_0xf4a119[_0xecb3('0x11')],'app':_0xecb3('0x16'),'appdata':_0xecb3('0x3b'),'context':_0xf4a119[_0xecb3('0x14')],'exten':_0xf4a119[_0xecb3('0xa')],'priority':_0x5127d1[_0xecb3('0x29')]+_0x3fd443[_0xecb3('0x15')]+_0x1b800e++,'VoiceExtensionId':_0xf4a119[_0xecb3('0x18')]});}else{_0x5b645e[_0xecb3('0x10')]({'type':_0xf4a119[_0xecb3('0x11')],'app':_0xecb3('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xf4a119[_0xecb3('0x14')],'exten':_0xf4a119[_0xecb3('0xa')],'priority':_0x5127d1[_0xecb3('0x29')]+_0x3fd443[_0xecb3('0x15')]+_0x1b800e++,'VoiceExtensionId':_0xf4a119['VoiceExtensionId']});_0x5b645e[_0xecb3('0x10')]({'type':_0xf4a119[_0xecb3('0x11')],'app':_0xecb3('0x16'),'appdata':_0xecb3('0x3c'),'context':_0xf4a119[_0xecb3('0x14')],'exten':_0xf4a119[_0xecb3('0xa')],'priority':_0x5127d1[_0xecb3('0x29')]+_0x3fd443[_0xecb3('0x15')]+_0x1b800e++,'VoiceExtensionId':_0xf4a119[_0xecb3('0x18')]});}}}for(var _0x515da1=0x0;_0x515da1<_0x5127d1[_0xecb3('0x29')];_0x515da1+=0x1){var _0x474451=_0x3fd443[_0xecb3('0x15')]+_0x5127d1['length'];var _0x340da4=_0x515da1===_0x5127d1[_0xecb3('0x29')]-0x1?_0x3fd443[_0xecb3('0x15')]+_0x5b645e['length']+_0x84d78f[_0xecb3('0x29')]+0x2:_0x3fd443[_0xecb3('0x15')]+_0x515da1+0x1;_0x5b645e[_0xecb3('0x3d')](_0x515da1,0x0,{'type':_0xf4a119[_0xecb3('0x11')],'app':'GotoIfTime','appdata':_0x5127d1[_0x515da1]+'?'+_0xf4a119[_0xecb3('0x14')]+',${EXTEN},'+_0x474451+':'+_0xf4a119['context']+_0xecb3('0x3e')+_0x340da4,'exten':_0xf4a119[_0xecb3('0xa')],'context':_0xf4a119['context'],'priority':_0x3fd443[_0xecb3('0x15')]+_0x515da1,'VoiceExtensionId':_0x295753[_0x198cfa][0x0][_0xecb3('0x18')]});}_0xf4a119['priority']=_0x5b645e[_0xecb3('0x29')]?_[_0xecb3('0x3f')](_0x5b645e)['priority']+0x1:_0x3fd443['priority'];_0x3fd443[_0xecb3('0x15')]=(_0x84d78f[_0xecb3('0x29')]?_[_0xecb3('0x3f')](_0x84d78f)[_0xecb3('0x15')]:_0xf4a119[_0xecb3('0x15')])+0x1;_0x3fd443[_0xecb3('0xf')]=_[_0xecb3('0x40')](_0x3fd443[_0xecb3('0xf')],_0x5b645e,[_0xf4a119],_0x84d78f);}_0x3fd443[_0xecb3('0xf')]['push']({'type':_0x295753[_0x198cfa][0x0][_0xecb3('0x11')],'app':_0xecb3('0x41'),'exten':_0x295753[_0x198cfa][0x0][_0xecb3('0xa')],'context':_0x295753[_0x198cfa][0x0][_0xecb3('0x14')],'priority':_0x3fd443[_0xecb3('0x15')],'VoiceExtensionId':_0x295753[_0x198cfa][0x0][_0xecb3('0x18')]});_0x45a072['push'](_0x295753[_0x198cfa][0x0][_0xecb3('0x18')]);_0x42c267=_['concat'](_0x42c267,_0x3fd443[_0xecb3('0xf')]);}}return _0x321860[_0xecb3('0x42')](function(_0x44dce1){return _0x321860['models'][_0xecb3('0x6')][_0xecb3('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x45a072}},'transaction':_0x44dce1})['then'](function(_0x52f39c){return _0x321860[_0xecb3('0x2')]['VoiceExtension'][_0xecb3('0x44')](_[_0xecb3('0x45')](_0x42c267,_0xecb3('0x15')),{'transaction':_0x44dce1});});});})['catch'](function(_0x3e97bc){console[_0xecb3('0x46')](_0x3e97bc);});}exports[_0xecb3('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index d82add2..e8eae4f 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 _0x8074=['from','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','calleridnum','\x20=\x20?','cm_contacts','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','get','always','sequelize','query','VoiceQueueId','then','onlyIfOpen','push','outbound','all','Campaign','Lists','CampaignId','BlackLists','generalCheckHopper','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','data','firstName','firstName\x20not\x20specified!','phone','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','keys','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8074,0x16a));var _0x4807=function(_0x307578,_0x29be12){_0x307578=_0x307578-0x0;var _0x36351c=_0x8074[_0x307578];return _0x36351c;};'use strict';var BPromise=require(_0x4807('0x0'));var util=require(_0x4807('0x1'));var _=require(_0x4807('0x2'));var fs=require('fs');var squel=require(_0x4807('0x3'));var Papa=require('papaparse');var Redis=require(_0x4807('0x4'));var db=require(_0x4807('0x5'))['db'];var config=require(_0x4807('0x6'));var logger=require(_0x4807('0x7'))(_0x4807('0x8'));config[_0x4807('0x9')]=_[_0x4807('0xa')](config[_0x4807('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4807('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0x4807('0xb')](socket);try{if(!process[_0x4807('0xc')][0x2]||process[_0x4807('0xc')][0x2]===_0x4807('0xd')||process[_0x4807('0xc')][0x2]===_0x4807('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x4807('0xc')][0x3]||process[_0x4807('0xc')][0x3]===_0x4807('0xd')||process[_0x4807('0xc')][0x3]===_0x4807('0xe')||!process[_0x4807('0xc')][0x4]||process[_0x4807('0xc')][0x4]===_0x4807('0xd')||process[_0x4807('0xc')][0x4]===_0x4807('0xe')){throw new Error(_0x4807('0xf'));}var FIELDS=_[_0x4807('0x10')](process[_0x4807('0xc')][0x3][_0x4807('0x11')](','),process['argv'][0x4][_0x4807('0x11')](','));if(!process['argv'][0x5]||process[_0x4807('0xc')][0x5]===_0x4807('0xd')||process[_0x4807('0xc')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x4807('0xc')][0x6]!=='undefined'&&process[_0x4807('0xc')][0x6]!==_0x4807('0xe')?process[_0x4807('0xc')][0x6]:null;var DUPLICATES=process[_0x4807('0xc')][0x7]&&process[_0x4807('0xc')][0x7]!==_0x4807('0xd')&&process[_0x4807('0xc')][0x7]!==_0x4807('0xe')?process[_0x4807('0xc')][0x7]:null;if(!process[_0x4807('0xc')][0x8]||process[_0x4807('0xc')][0x8]===_0x4807('0xd')||process['argv'][0x8]===_0x4807('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x36801a){logger['error'](_0x36801a);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(_0x2e8938,_0x146f14,_0x895fa3,_0xdafe81){var _0x23dfdf={'message':_0x146f14};_0x23dfdf[_0x2e8938]=!![];if(_0x895fa3){_0x23dfdf['contact']=_0x895fa3;}if(_0xdafe81){_0x23dfdf[_0x4807('0x12')]=_0xdafe81;}return _0x23dfdf;}function isEmail(_0x15f4a7){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))*$/[_0x4807('0x13')](_0x15f4a7);}function checkRow(_0x525a96,_0x328e8f,_0x2e378f){return new BPromise(function(_0x28ba68,_0x166fa7){if(_[_0x4807('0x14')](_0x525a96)){return _0x166fa7(handleCheckRowError(_0x4807('0x15'),_0x4807('0x16'),null,_0x2e378f));}if(_0x525a96[_0x4807('0x17')]&&_0x525a96['errors']['length']){var _0x4aead8=_[_0x4807('0x18')](_0x525a96[_0x4807('0x17')],'message')[_0x4807('0x19')](';');return _0x166fa7(handleCheckRowError(_0x4807('0x15'),_0x4aead8,null,_0x2e378f));}var _0x483f7b={};for(var _0x50baf1 in FIELDS){if(FIELDS['hasOwnProperty'](_0x50baf1)&&FIELDS[_0x50baf1]){_0x483f7b[_0x50baf1]=_0x525a96[_0x4807('0x1a')][0x0][FIELDS[_0x50baf1]]||_0x525a96[_0x4807('0x1a')][0x0]['\ufeff'+FIELDS[_0x50baf1]];}}if(!_0x483f7b[_0x4807('0x1b')]){return _0x166fa7(handleCheckRowError(_0x4807('0x15'),_0x4807('0x1c'),null,_0x2e378f));}if(!_0x483f7b[_0x4807('0x1d')]){return _0x166fa7(handleCheckRowError(_0x4807('0x15'),'phone\x20not\x20specified!',null,_0x2e378f));}if(_0x483f7b['birthDate']){var _0x14ea41=moment(_0x483f7b[_0x4807('0x1e')],'YYYY-MM-DD');if(!_0x14ea41[_0x4807('0x1f')]()){return _0x166fa7(handleCheckRowError(_0x4807('0x15'),_0x4807('0x20'),null,_0x2e378f));}}if(_0x483f7b[_0x4807('0x21')]){if(!isEmail(_0x483f7b[_0x4807('0x21')])){return _0x166fa7(handleCheckRowError(_0x4807('0x15'),_0x4807('0x22'),null,_0x2e378f));}}_0x483f7b[_0x4807('0x23')]=LISTID;_0x483f7b[_0x4807('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x4807('0x25')]&&_0x328e8f){var _0x33bf8b={};for(var _0x227dda=0x0,_0x459859=DUPLICATES[_0x4807('0x25')];_0x227dda<_0x459859;_0x227dda+=0x1){_0x33bf8b[DUPLICATES[_0x227dda]]=_0x483f7b[DUPLICATES[_0x227dda]];}var _0x560e31=_[_0x4807('0x26')](_0x328e8f,_0x33bf8b);if(_0x560e31){return _0x166fa7(handleCheckRowError(_0x4807('0x27'),_0x4807('0x28'),_0x560e31,_0x2e378f));}}return db[_0x4807('0x29')]['create'](_0x483f7b,{'raw':!![],'hooks':![],'fields':_[_0x4807('0x2a')](_0x483f7b)})['then'](function(_0x2a1457){if(DUPLICATES&&DUPLICATES[_0x4807('0x25')]&&_0x328e8f){_0x328e8f['push'](_[_0x4807('0x2b')](_0x483f7b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2a1457['id'];return _0x28ba68();})[_0x4807('0x2c')](function(_0x290c3d){return _0x166fa7(handleCheckRowError(_0x4807('0x15'),_0x4807('0x2d')+(_0x290c3d[_0x4807('0x2e')]||JSON[_0x4807('0x2f')](_0x290c3d)),null,_0x2e378f));});});}function checkHopper(){function _0x202271(){return function(_0x5389fd){logger[_0x4807('0x15')]('cmContact',_0x4807('0x30'),util[_0x4807('0x31')](_0x5389fd,{'showHidden':![],'depth':null}));};}var _0x3b14da=function(_0x1d67a1,_0x57327f){var _0x581b99=squel[_0x4807('0x32')]()[_0x4807('0x33')](_0x4807('0x34'))[_0x4807('0x35')]([_0x4807('0x1d'),_0x4807('0x36'),_0x4807('0x37'),_0x4807('0x23'),_0x57327f,_0x4807('0x38'),_0x4807('0x39')],squel[_0x4807('0x3a')]()[_0x4807('0x3b')](_0x4807('0x1d'),_0x4807('0x1d'))['field'](_0x4807('0x3c'),_0x4807('0x36'))[_0x4807('0x3b')]('id',_0x4807('0x37'))[_0x4807('0x3b')](LISTID[_0x4807('0x3d')](),'ListId')[_0x4807('0x3b')](_0x1d67a1['id'][_0x4807('0x3d')](),_0x57327f)[_0x4807('0x3b')]('NOW()',_0x4807('0x38'))[_0x4807('0x3b')](_0x4807('0x3c'),_0x4807('0x39'))[_0x4807('0x3e')]('cm_contacts')[_0x4807('0x3f')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x4807('0x3d')]())[_0x4807('0x3f')](_0x4807('0x40'))[_0x4807('0x3f')](_0x4807('0x41'),squel['select']()[_0x4807('0x3b')](_0x4807('0x1d'))['from'](_0x4807('0x34'))[_0x4807('0x3f')](_0x57327f+'\x20=\x20?',_0x1d67a1['id'][_0x4807('0x3d')]())))[_0x4807('0x3d')]();return _0x581b99;};var _0x413dcd=function(_0x152673,_0x30c370){var _0x455fd0=squel[_0x4807('0x32')]()['into'](_0x4807('0x34'))[_0x4807('0x35')]([_0x4807('0x1d'),_0x4807('0x36'),_0x4807('0x37'),'ListId',_0x30c370,'createdAt',_0x4807('0x39')],squel[_0x4807('0x3a')]()[_0x4807('0x3b')](_0x4807('0x1d'),_0x4807('0x1d'))[_0x4807('0x3b')](_0x4807('0x3c'),_0x4807('0x36'))[_0x4807('0x3b')]('id',_0x4807('0x37'))[_0x4807('0x3b')](LISTID['toString'](),_0x4807('0x23'))[_0x4807('0x3b')](_0x152673['id']['toString'](),_0x30c370)[_0x4807('0x3b')](_0x4807('0x3c'),_0x4807('0x38'))[_0x4807('0x3b')](_0x4807('0x3c'),_0x4807('0x39'))[_0x4807('0x3e')]('cm_contacts')[_0x4807('0x3f')](_0x4807('0x42'))[_0x4807('0x3f')](_0x4807('0x43'),LISTID[_0x4807('0x3d')]())[_0x4807('0x3f')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x4807('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x4807('0x3f')](_0x4807('0x41'),squel[_0x4807('0x3a')]()[_0x4807('0x3b')](_0x4807('0x44'))['from']('cm_hopper_final')[_0x4807('0x3f')](_0x30c370+_0x4807('0x45'),_0x152673['id'][_0x4807('0x3d')]()))['where'](_0x4807('0x41'),squel[_0x4807('0x3a')]()['field'](_0x4807('0x1d'))['from']('cm_hopper')[_0x4807('0x3f')](_0x30c370+_0x4807('0x45'),_0x152673['id']['toString']())))[_0x4807('0x3d')]();return _0x455fd0;};function _0x1a66ea(_0x229662,_0x37cde3){var _0x5f3b99=squel[_0x4807('0x32')]()[_0x4807('0x33')]('cm_hopper')[_0x4807('0x35')]([_0x4807('0x1d'),_0x4807('0x36'),_0x4807('0x37'),'ListId',_0x37cde3,_0x4807('0x38'),_0x4807('0x39')],squel[_0x4807('0x3a')]()[_0x4807('0x3b')](_0x4807('0x1d'),_0x4807('0x1d'))[_0x4807('0x3b')](_0x4807('0x3c'),_0x4807('0x36'))['field']('id',_0x4807('0x37'))[_0x4807('0x3b')](LISTID['toString'](),'ListId')[_0x4807('0x3b')](_0x229662['id'][_0x4807('0x3d')](),_0x37cde3)[_0x4807('0x3b')](_0x4807('0x3c'),_0x4807('0x38'))['field'](_0x4807('0x3c'),_0x4807('0x39'))[_0x4807('0x3e')](_0x4807('0x46'))[_0x4807('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0x4807('0x43'),LISTID['toString']())[_0x4807('0x3f')](_0x4807('0x47'),squel[_0x4807('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x4807('0x3d')]();return _0x5f3b99;}function _0x39c179(_0x172fe1,_0x4fb9a6){var _0x51b7e7=squel[_0x4807('0x32')]()[_0x4807('0x33')](_0x4807('0x49'))[_0x4807('0x35')](['phone',_0x4807('0x37'),_0x4807('0x23'),_0x4fb9a6,_0x4807('0x38'),_0x4807('0x39')],squel[_0x4807('0x3a')]()[_0x4807('0x3b')](_0x4807('0x1d'),_0x4807('0x1d'))[_0x4807('0x3b')]('id',_0x4807('0x37'))[_0x4807('0x3b')](LISTID[_0x4807('0x3d')](),_0x4807('0x23'))[_0x4807('0x3b')](_0x172fe1['id'][_0x4807('0x3d')](),_0x4fb9a6)['field'](_0x4807('0x3c'),'createdAt')[_0x4807('0x3b')](_0x4807('0x3c'),_0x4807('0x39'))[_0x4807('0x3e')]('cm_contacts')[_0x4807('0x3f')](_0x4807('0x42'))[_0x4807('0x3f')]('ListId\x20=\x20?',LISTID[_0x4807('0x3d')]())[_0x4807('0x3f')](_0x4807('0x47'),squel[_0x4807('0x48')](hopperContacts))[_0x4807('0x3f')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x51b7e7;}return db[_0x4807('0x4a')][_0x4807('0x4b')]({'where':{'type':'outbound'},'attributes':['id',_0x4807('0x4c')],'include':[{'model':db[_0x4807('0x4d')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x1b7647){var _0x581eb3=[];if(_0x1b7647){var _0x1bfca9;for(var _0x5d7f37=0x0,_0x3b1400;_0x5d7f37<_0x1b7647[_0x4807('0x25')];_0x5d7f37+=0x1){_0x3b1400=_0x1b7647[_0x5d7f37][_0x4807('0x4e')]({'plain':!![]});switch(_0x3b1400[_0x4807('0x4c')]){case _0x4807('0x4f'):_0x581eb3['push'](db[_0x4807('0x50')][_0x4807('0x51')](_0x413dcd(_0x3b1400,_0x4807('0x52')))[_0x4807('0x53')](function(){})[_0x4807('0x2c')](_0x202271()));break;case _0x4807('0x54'):_0x581eb3[_0x4807('0x55')](db[_0x4807('0x50')][_0x4807('0x51')](_0x3b14da(_0x3b1400,_0x4807('0x52')))[_0x4807('0x53')](function(){})[_0x4807('0x2c')](_0x202271()));break;default:_0x581eb3[_0x4807('0x55')](db[_0x4807('0x50')]['query'](_0x1a66ea(_0x3b1400,_0x4807('0x52')))['then'](function(){})[_0x4807('0x2c')](_0x202271()));}}}return _0x581eb3;})['all']()[_0x4807('0x53')](function(){return db[_0x4807('0x4a')][_0x4807('0x4b')]({'where':{'type':_0x4807('0x56')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x148e3d){var _0x113fb0=[];if(_0x148e3d){var _0x159773;for(var _0x47b1bc=0x0,_0x2ed1e6;_0x47b1bc<_0x148e3d['length'];_0x47b1bc+=0x1){_0x2ed1e6=_0x148e3d[_0x47b1bc][_0x4807('0x4e')]({'plain':!![]});_0x113fb0[_0x4807('0x55')](db[_0x4807('0x50')][_0x4807('0x51')](_0x39c179(_0x2ed1e6,_0x4807('0x52')))[_0x4807('0x53')](function(){})['catch'](_0x202271()));}}return _0x113fb0;})[_0x4807('0x57')]();})[_0x4807('0x53')](function(){return db[_0x4807('0x58')][_0x4807('0x4b')]({'attributes':['id',_0x4807('0x4c')],'include':[{'model':db['CmList'],'as':_0x4807('0x59'),'where':{'id':LISTID}}]})[_0x4807('0x53')](function(_0xab40ab){var _0x16c255=[];if(_0xab40ab){for(var _0x11f3c9=0x0,_0x7dc46c;_0x11f3c9<_0xab40ab[_0x4807('0x25')];_0x11f3c9+=0x1){_0x7dc46c=_0xab40ab[_0x11f3c9][_0x4807('0x4e')]({'plain':!![]});switch(_0x7dc46c[_0x4807('0x4c')]){case _0x4807('0x4f'):_0x16c255['push'](db['sequelize']['query'](_0x413dcd(_0x7dc46c,_0x4807('0x5a')))[_0x4807('0x53')](function(){})[_0x4807('0x2c')](_0x202271()));break;case _0x4807('0x54'):_0x16c255['push'](db[_0x4807('0x50')][_0x4807('0x51')](_0x3b14da(_0x7dc46c,_0x4807('0x5a')))['then'](function(){})['catch'](_0x202271()));break;default:_0x16c255[_0x4807('0x55')](db[_0x4807('0x50')]['query'](_0x1a66ea(_0x7dc46c,'CampaignId'))[_0x4807('0x53')](function(){})[_0x4807('0x2c')](_0x202271()));}}}return _0x16c255;})[_0x4807('0x57')]();})[_0x4807('0x53')](function(){return db[_0x4807('0x58')][_0x4807('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x4807('0x4d')],'as':_0x4807('0x5b'),'where':{'id':LISTID}}]})[_0x4807('0x53')](function(_0x4aaf7a){var _0x3ed5d4=[];if(_0x4aaf7a){for(var _0x5dc454=0x0,_0x419509;_0x5dc454<_0x4aaf7a[_0x4807('0x25')];_0x5dc454+=0x1){_0x419509=_0x4aaf7a[_0x5dc454]['get']({'plain':!![]});_0x3ed5d4[_0x4807('0x55')](db[_0x4807('0x50')]['query'](_0x39c179(_0x419509,'CampaignId'))['then'](function(){})[_0x4807('0x2c')](_0x202271()));}}return _0x3ed5d4;})[_0x4807('0x57')]();})[_0x4807('0x2c')](function(_0x1d6ce3){logger['error']('cmContact,\x20%s,\x20%s',_0x4807('0x5c'),_0x1d6ce3[_0x4807('0x2e')]);});}var processPromises=function(_0x148d4c){return BPromise[_0x4807('0x57')](promises)[_0x4807('0x53')](function(_0x4d5e1b){})[_0x4807('0x2c')](function(_0x1f58fa){logger[_0x4807('0x15')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x1f58fa));})['finally'](function(){socket['emit'](_0x4807('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x148d4c){return _0x148d4c[_0x4807('0x5e')]();}});};var endCsv=function(){return BPromise[_0x4807('0x5f')]()[_0x4807('0x53')](function(){if(hopperContacts){return checkHopper();}})[_0x4807('0x53')](function(){socket[_0x4807('0x60')](_0x4807('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x4807('0x61')](FILEPATH);}catch(_0x58fe35){logger[_0x4807('0x15')](_0x4807('0x62'),JSON[_0x4807('0x2f')](_0x58fe35));}finally{process[_0x4807('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0x4807('0x64')](_0x4807('0x65'));endCsv();});function main(){return BPromise[_0x4807('0x5f')]()[_0x4807('0x53')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4807('0x11')](',');return db[_0x4807('0x29')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x4807('0x53')](function(_0x2a66d7){var _0x5ceac2=fs[_0x4807('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x4807('0x67')](_0x5ceac2,{'header':!![],'skipEmptyLines':!![],'step':function(_0x322016,_0x159dde){total+=0x1;var _0x5883a1=total;promises[_0x4807('0x55')](checkRow(_0x322016,_0x2a66d7,_0x5883a1)['then'](function(){success+=0x1;})[_0x4807('0x2c')](function(_0x5b989a){if(_0x5b989a[_0x4807('0x15')]){errors+=0x1;delete _0x5b989a[_0x4807('0x15')];}else if(_0x5b989a[_0x4807('0x27')]){duplicates+=0x1;delete _0x5b989a[_0x4807('0x27')];}rows['push'](_0x5b989a);}));if(total%0xc8===0x0){_0x159dde[_0x4807('0x68')]();return processPromises(_0x159dde);}},'complete':function(){return processPromises()[_0x4807('0x53')](function(){logger[_0x4807('0x64')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x3b81c5,_0x56eda5){logger[_0x4807('0x64')]('CSV\x20parse\x20error',JSON[_0x4807('0x2f')](_0x3b81c5));endCsv();}});})['catch'](function(_0x44f976){logger[_0x4807('0x15')](_0x4807('0x69'),JSON[_0x4807('0x2f')](_0x44f976));});}main(); \ No newline at end of file +var _0x5a6b=['socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','toString','id\x20IN\x20?','str','calleridnum','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','Campaign','Lists','always','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','parse','duplicate','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost'];(function(_0x89ee68,_0x18ca4d){var _0x1dfd3b=function(_0x2f8d31){while(--_0x2f8d31){_0x89ee68['push'](_0x89ee68['shift']());}};_0x1dfd3b(++_0x18ca4d);}(_0x5a6b,0x13d));var _0xb5a6=function(_0x50cf17,_0x53bd00){_0x50cf17=_0x50cf17-0x0;var _0x526372=_0x5a6b[_0x50cf17];return _0x526372;};'use strict';var BPromise=require('bluebird');var util=require(_0xb5a6('0x0'));var _=require(_0xb5a6('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xb5a6('0x2'));var Redis=require(_0xb5a6('0x3'));var db=require(_0xb5a6('0x4'))['db'];var config=require(_0xb5a6('0x5'));var logger=require(_0xb5a6('0x6'))('api');config[_0xb5a6('0x7')]=_[_0xb5a6('0x8')](config[_0xb5a6('0x7')],{'host':_0xb5a6('0x9'),'port':0x18eb});var socket=require(_0xb5a6('0xa'))(new Redis(config[_0xb5a6('0x7')]));require(_0xb5a6('0xb'))[_0xb5a6('0xc')](socket);try{if(!process[_0xb5a6('0xd')][0x2]||process['argv'][0x2]==='undefined'||process['argv'][0x2]===_0xb5a6('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xb5a6('0xd')][0x2];if(!process['argv'][0x3]||process[_0xb5a6('0xd')][0x3]===_0xb5a6('0xf')||process[_0xb5a6('0xd')][0x3]===_0xb5a6('0xe')||!process[_0xb5a6('0xd')][0x4]||process[_0xb5a6('0xd')][0x4]===_0xb5a6('0xf')||process[_0xb5a6('0xd')][0x4]==='null'){throw new Error(_0xb5a6('0x10'));}var FIELDS=_[_0xb5a6('0x11')](process[_0xb5a6('0xd')][0x3][_0xb5a6('0x12')](','),process['argv'][0x4][_0xb5a6('0x12')](','));if(!process[_0xb5a6('0xd')][0x5]||process[_0xb5a6('0xd')][0x5]==='undefined'||process[_0xb5a6('0xd')][0x5]===_0xb5a6('0xe')){throw new Error(_0xb5a6('0x13'));}var LISTID=process[_0xb5a6('0xd')][0x5];var COMPANYID=process[_0xb5a6('0xd')][0x6]&&process[_0xb5a6('0xd')][0x6]!==_0xb5a6('0xf')&&process[_0xb5a6('0xd')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0xb5a6('0xd')][0x7]&&process['argv'][0x7]!==_0xb5a6('0xf')&&process[_0xb5a6('0xd')][0x7]!==_0xb5a6('0xe')?process['argv'][0x7]:null;if(!process[_0xb5a6('0xd')][0x8]||process['argv'][0x8]===_0xb5a6('0xf')||process[_0xb5a6('0xd')][0x8]===_0xb5a6('0xe')){throw new Error(_0xb5a6('0x14'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2da40a){logger[_0xb5a6('0x15')](_0x2da40a);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(_0x33cfc0,_0x36c79d,_0x586da9,_0x1cd439){var _0x4b32f6={'message':_0x36c79d};_0x4b32f6[_0x33cfc0]=!![];if(_0x586da9){_0x4b32f6[_0xb5a6('0x16')]=_0x586da9;}if(_0x1cd439){_0x4b32f6[_0xb5a6('0x17')]=_0x1cd439;}return _0x4b32f6;}function isEmail(_0xaf845c){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'](_0xaf845c);}function checkRow(_0x567f05,_0x5e5551,_0x44d306){return new BPromise(function(_0x203193,_0x2fee7a){if(_[_0xb5a6('0x18')](_0x567f05)){return _0x2fee7a(handleCheckRowError('error',_0xb5a6('0x19'),null,_0x44d306));}if(_0x567f05[_0xb5a6('0x1a')]&&_0x567f05[_0xb5a6('0x1a')]['length']){var _0x15e5a8=_[_0xb5a6('0x1b')](_0x567f05[_0xb5a6('0x1a')],'message')[_0xb5a6('0x1c')](';');return _0x2fee7a(handleCheckRowError('error',_0x15e5a8,null,_0x44d306));}var _0x53f630={};for(var _0x4afe34 in FIELDS){if(FIELDS[_0xb5a6('0x1d')](_0x4afe34)&&FIELDS[_0x4afe34]){_0x53f630[_0x4afe34]=_0x567f05[_0xb5a6('0x1e')][0x0][FIELDS[_0x4afe34]]||_0x567f05[_0xb5a6('0x1e')][0x0]['\ufeff'+FIELDS[_0x4afe34]];}}if(!_0x53f630[_0xb5a6('0x1f')]){return _0x2fee7a(handleCheckRowError(_0xb5a6('0x15'),_0xb5a6('0x20'),null,_0x44d306));}if(!_0x53f630[_0xb5a6('0x21')]){return _0x2fee7a(handleCheckRowError(_0xb5a6('0x15'),'phone\x20not\x20specified!',null,_0x44d306));}if(_0x53f630[_0xb5a6('0x22')]){var _0x278cd1=moment(_0x53f630[_0xb5a6('0x22')],_0xb5a6('0x23'));if(!_0x278cd1['isValid']()){return _0x2fee7a(handleCheckRowError(_0xb5a6('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x44d306));}}if(_0x53f630[_0xb5a6('0x24')]){if(!isEmail(_0x53f630[_0xb5a6('0x24')])){return _0x2fee7a(handleCheckRowError('error',_0xb5a6('0x25'),null,_0x44d306));}}_0x53f630[_0xb5a6('0x26')]=LISTID;_0x53f630[_0xb5a6('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xb5a6('0x28')]&&_0x5e5551){var _0xafb00a={};for(var _0x500567=0x0,_0x47ca64=DUPLICATES[_0xb5a6('0x28')];_0x500567<_0x47ca64;_0x500567+=0x1){_0xafb00a[DUPLICATES[_0x500567]]=_0x53f630[DUPLICATES[_0x500567]];}var _0x132205=_[_0xb5a6('0x29')](_0x5e5551,_0xafb00a);if(_0x132205){return _0x2fee7a(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x132205,_0x44d306));}}return db[_0xb5a6('0x2a')][_0xb5a6('0x2b')](_0x53f630,{'raw':!![],'hooks':![],'fields':_[_0xb5a6('0x2c')](_0x53f630)})[_0xb5a6('0x2d')](function(_0x16083e){if(DUPLICATES&&DUPLICATES[_0xb5a6('0x28')]&&_0x5e5551){_0x5e5551[_0xb5a6('0x2e')](_[_0xb5a6('0x2f')](_0x53f630,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x16083e['id'];return _0x203193();})['catch'](function(_0x56229c){return _0x2fee7a(handleCheckRowError(_0xb5a6('0x15'),_0xb5a6('0x30')+(_0x56229c['message']||JSON[_0xb5a6('0x31')](_0x56229c)),null,_0x44d306));});});}function checkHopper(){function _0xf3b6e8(){return function(_0xe6c256){logger['error']('cmContact',_0xb5a6('0x32'),util['inspect'](_0xe6c256,{'showHidden':![],'depth':null}));};}var _0x55859a=function(_0x30bdc0,_0x531938){var _0x4a32e1=squel[_0xb5a6('0x33')]()[_0xb5a6('0x34')](_0xb5a6('0x35'))[_0xb5a6('0x36')](['phone',_0xb5a6('0x37'),_0xb5a6('0x38'),_0xb5a6('0x26'),_0x531938,_0xb5a6('0x39'),_0xb5a6('0x3a')],squel[_0xb5a6('0x3b')]()[_0xb5a6('0x3c')](_0xb5a6('0x21'),_0xb5a6('0x21'))[_0xb5a6('0x3c')]('NOW()',_0xb5a6('0x37'))[_0xb5a6('0x3c')]('id',_0xb5a6('0x38'))[_0xb5a6('0x3c')](LISTID['toString'](),_0xb5a6('0x26'))[_0xb5a6('0x3c')](_0x30bdc0['id']['toString'](),_0x531938)[_0xb5a6('0x3c')](_0xb5a6('0x3d'),'createdAt')[_0xb5a6('0x3c')](_0xb5a6('0x3d'),_0xb5a6('0x3a'))[_0xb5a6('0x3e')](_0xb5a6('0x3f'))['where'](_0xb5a6('0x40'))[_0xb5a6('0x41')](_0xb5a6('0x42'),LISTID['toString']())[_0xb5a6('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0xb5a6('0x41')](_0xb5a6('0x43'),squel[_0xb5a6('0x3b')]()[_0xb5a6('0x3c')](_0xb5a6('0x21'))['from'](_0xb5a6('0x35'))[_0xb5a6('0x41')](_0x531938+_0xb5a6('0x44'),_0x30bdc0['id'][_0xb5a6('0x45')]())))[_0xb5a6('0x45')]();return _0x4a32e1;};var _0x34e905=function(_0x5a5a61,_0x1b8a6d){var _0x47c779=squel['insert']()[_0xb5a6('0x34')](_0xb5a6('0x35'))['fromQuery'](['phone','scheduledAt',_0xb5a6('0x38'),'ListId',_0x1b8a6d,_0xb5a6('0x39'),_0xb5a6('0x3a')],squel[_0xb5a6('0x3b')]()[_0xb5a6('0x3c')](_0xb5a6('0x21'),_0xb5a6('0x21'))[_0xb5a6('0x3c')](_0xb5a6('0x3d'),'scheduledAt')[_0xb5a6('0x3c')]('id',_0xb5a6('0x38'))[_0xb5a6('0x3c')](LISTID[_0xb5a6('0x45')](),_0xb5a6('0x26'))['field'](_0x5a5a61['id'][_0xb5a6('0x45')](),_0x1b8a6d)[_0xb5a6('0x3c')](_0xb5a6('0x3d'),_0xb5a6('0x39'))[_0xb5a6('0x3c')]('NOW()',_0xb5a6('0x3a'))[_0xb5a6('0x3e')](_0xb5a6('0x3f'))[_0xb5a6('0x41')]('deletedAt\x20IS\x20NULL')[_0xb5a6('0x41')](_0xb5a6('0x42'),LISTID[_0xb5a6('0x45')]())[_0xb5a6('0x41')](_0xb5a6('0x46'),squel[_0xb5a6('0x47')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0xb5a6('0x41')](_0xb5a6('0x43'),squel[_0xb5a6('0x3b')]()[_0xb5a6('0x3c')](_0xb5a6('0x48'))['from']('cm_hopper_final')[_0xb5a6('0x41')](_0x1b8a6d+_0xb5a6('0x44'),_0x5a5a61['id']['toString']()))[_0xb5a6('0x41')](_0xb5a6('0x43'),squel['select']()[_0xb5a6('0x3c')](_0xb5a6('0x21'))['from'](_0xb5a6('0x35'))[_0xb5a6('0x41')](_0x1b8a6d+_0xb5a6('0x44'),_0x5a5a61['id'][_0xb5a6('0x45')]())))[_0xb5a6('0x45')]();return _0x47c779;};function _0x2262f9(_0x21c1f7,_0x29672e){var _0x58f34f=squel[_0xb5a6('0x33')]()[_0xb5a6('0x34')](_0xb5a6('0x35'))[_0xb5a6('0x36')]([_0xb5a6('0x21'),_0xb5a6('0x37'),_0xb5a6('0x38'),_0xb5a6('0x26'),_0x29672e,_0xb5a6('0x39'),'updatedAt'],squel[_0xb5a6('0x3b')]()[_0xb5a6('0x3c')]('phone',_0xb5a6('0x21'))[_0xb5a6('0x3c')](_0xb5a6('0x3d'),_0xb5a6('0x37'))[_0xb5a6('0x3c')]('id',_0xb5a6('0x38'))[_0xb5a6('0x3c')](LISTID[_0xb5a6('0x45')](),_0xb5a6('0x26'))['field'](_0x21c1f7['id'][_0xb5a6('0x45')](),_0x29672e)[_0xb5a6('0x3c')](_0xb5a6('0x3d'),_0xb5a6('0x39'))[_0xb5a6('0x3c')](_0xb5a6('0x3d'),'updatedAt')[_0xb5a6('0x3e')](_0xb5a6('0x3f'))[_0xb5a6('0x41')](_0xb5a6('0x40'))[_0xb5a6('0x41')](_0xb5a6('0x42'),LISTID[_0xb5a6('0x45')]())[_0xb5a6('0x41')](_0xb5a6('0x46'),squel[_0xb5a6('0x47')](hopperContacts))[_0xb5a6('0x41')](_0xb5a6('0x49')))[_0xb5a6('0x45')]();return _0x58f34f;}function _0x4df13a(_0x82df01,_0x532279){var _0x1aac1d=squel['insert']()[_0xb5a6('0x34')](_0xb5a6('0x4a'))[_0xb5a6('0x36')]([_0xb5a6('0x21'),_0xb5a6('0x38'),_0xb5a6('0x26'),_0x532279,'createdAt',_0xb5a6('0x3a')],squel[_0xb5a6('0x3b')]()[_0xb5a6('0x3c')](_0xb5a6('0x21'),'phone')[_0xb5a6('0x3c')]('id',_0xb5a6('0x38'))['field'](LISTID['toString'](),_0xb5a6('0x26'))[_0xb5a6('0x3c')](_0x82df01['id'][_0xb5a6('0x45')](),_0x532279)['field'](_0xb5a6('0x3d'),_0xb5a6('0x39'))[_0xb5a6('0x3c')](_0xb5a6('0x3d'),'updatedAt')[_0xb5a6('0x3e')](_0xb5a6('0x3f'))[_0xb5a6('0x41')](_0xb5a6('0x40'))['where'](_0xb5a6('0x42'),LISTID['toString']())[_0xb5a6('0x41')](_0xb5a6('0x46'),squel[_0xb5a6('0x47')](hopperContacts))[_0xb5a6('0x41')](_0xb5a6('0x49')))[_0xb5a6('0x45')]();return _0x1aac1d;}return db[_0xb5a6('0x4b')][_0xb5a6('0x4c')]({'where':{'type':_0xb5a6('0x4d')},'attributes':['id',_0xb5a6('0x4e')],'include':[{'model':db[_0xb5a6('0x4f')],'as':'Lists','where':{'id':LISTID}}]})[_0xb5a6('0x2d')](function(_0x870c56){var _0x54b0cc=[];if(_0x870c56){var _0x3df824;for(var _0x700746=0x0,_0x42e369;_0x700746<_0x870c56[_0xb5a6('0x28')];_0x700746+=0x1){_0x42e369=_0x870c56[_0x700746][_0xb5a6('0x50')]({'plain':!![]});switch(_0x42e369[_0xb5a6('0x4e')]){case'always':_0x54b0cc[_0xb5a6('0x2e')](db[_0xb5a6('0x51')][_0xb5a6('0x52')](_0x34e905(_0x42e369,_0xb5a6('0x53')))[_0xb5a6('0x2d')](function(){})['catch'](_0xf3b6e8()));break;case _0xb5a6('0x54'):_0x54b0cc[_0xb5a6('0x2e')](db[_0xb5a6('0x51')][_0xb5a6('0x52')](_0x55859a(_0x42e369,_0xb5a6('0x53')))[_0xb5a6('0x2d')](function(){})[_0xb5a6('0x55')](_0xf3b6e8()));break;default:_0x54b0cc['push'](db[_0xb5a6('0x51')][_0xb5a6('0x52')](_0x2262f9(_0x42e369,_0xb5a6('0x53')))[_0xb5a6('0x2d')](function(){})[_0xb5a6('0x55')](_0xf3b6e8()));}}}return _0x54b0cc;})[_0xb5a6('0x56')]()[_0xb5a6('0x2d')](function(){return db[_0xb5a6('0x4b')][_0xb5a6('0x4c')]({'where':{'type':_0xb5a6('0x4d')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xb5a6('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x2cff55){var _0x153763=[];if(_0x2cff55){var _0x49fa66;for(var _0x353bcd=0x0,_0x311c4d;_0x353bcd<_0x2cff55[_0xb5a6('0x28')];_0x353bcd+=0x1){_0x311c4d=_0x2cff55[_0x353bcd]['get']({'plain':!![]});_0x153763[_0xb5a6('0x2e')](db[_0xb5a6('0x51')]['query'](_0x4df13a(_0x311c4d,'VoiceQueueId'))[_0xb5a6('0x2d')](function(){})[_0xb5a6('0x55')](_0xf3b6e8()));}}return _0x153763;})[_0xb5a6('0x56')]();})[_0xb5a6('0x2d')](function(){return db[_0xb5a6('0x58')][_0xb5a6('0x4c')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xb5a6('0x4f')],'as':_0xb5a6('0x59'),'where':{'id':LISTID}}]})[_0xb5a6('0x2d')](function(_0x2d03e1){var _0x366d58=[];if(_0x2d03e1){for(var _0x2340f5=0x0,_0x13f025;_0x2340f5<_0x2d03e1[_0xb5a6('0x28')];_0x2340f5+=0x1){_0x13f025=_0x2d03e1[_0x2340f5][_0xb5a6('0x50')]({'plain':!![]});switch(_0x13f025[_0xb5a6('0x4e')]){case _0xb5a6('0x5a'):_0x366d58[_0xb5a6('0x2e')](db[_0xb5a6('0x51')][_0xb5a6('0x52')](_0x34e905(_0x13f025,_0xb5a6('0x5b')))[_0xb5a6('0x2d')](function(){})[_0xb5a6('0x55')](_0xf3b6e8()));break;case'onlyIfOpen':_0x366d58[_0xb5a6('0x2e')](db[_0xb5a6('0x51')][_0xb5a6('0x52')](_0x55859a(_0x13f025,_0xb5a6('0x5b')))['then'](function(){})[_0xb5a6('0x55')](_0xf3b6e8()));break;default:_0x366d58[_0xb5a6('0x2e')](db['sequelize'][_0xb5a6('0x52')](_0x2262f9(_0x13f025,_0xb5a6('0x5b')))[_0xb5a6('0x2d')](function(){})[_0xb5a6('0x55')](_0xf3b6e8()));}}}return _0x366d58;})['all']();})[_0xb5a6('0x2d')](function(){return db[_0xb5a6('0x58')][_0xb5a6('0x4c')]({'attributes':['id'],'include':[{'model':db[_0xb5a6('0x4f')],'as':_0xb5a6('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x59b37c){var _0x249a4a=[];if(_0x59b37c){for(var _0x258b71=0x0,_0x5da177;_0x258b71<_0x59b37c[_0xb5a6('0x28')];_0x258b71+=0x1){_0x5da177=_0x59b37c[_0x258b71][_0xb5a6('0x50')]({'plain':!![]});_0x249a4a[_0xb5a6('0x2e')](db['sequelize'][_0xb5a6('0x52')](_0x4df13a(_0x5da177,'CampaignId'))[_0xb5a6('0x2d')](function(){})[_0xb5a6('0x55')](_0xf3b6e8()));}}return _0x249a4a;})['all']();})[_0xb5a6('0x55')](function(_0x13bd31){logger[_0xb5a6('0x15')]('cmContact,\x20%s,\x20%s',_0xb5a6('0x5c'),_0x13bd31['message']);});}var processPromises=function(_0x39fe03){return BPromise[_0xb5a6('0x56')](promises)['then'](function(_0x4c42c6){})[_0xb5a6('0x55')](function(_0xabf982){logger[_0xb5a6('0x15')](_0xb5a6('0x5d'),JSON[_0xb5a6('0x31')](_0xabf982));})[_0xb5a6('0x5e')](function(){socket[_0xb5a6('0x5f')](_0xb5a6('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x39fe03){return _0x39fe03['resume']();}});};var endCsv=function(){return BPromise[_0xb5a6('0x61')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0xb5a6('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xb5a6('0x62')](FILEPATH);}catch(_0x15568c){logger[_0xb5a6('0x15')](_0xb5a6('0x63'),JSON['stringify'](_0x15568c));}finally{process[_0xb5a6('0x64')](0x0);}});};process['on'](_0xb5a6('0x65'),function(){logger[_0xb5a6('0x66')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xb5a6('0x61')]()[_0xb5a6('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xb5a6('0x12')](',');return db[_0xb5a6('0x2a')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xb5a6('0x2d')](function(_0x33222b){var _0x47122a=fs[_0xb5a6('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xb5a6('0x68')](_0x47122a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2b29d1,_0x2c794c){total+=0x1;var _0x3a907b=total;promises[_0xb5a6('0x2e')](checkRow(_0x2b29d1,_0x33222b,_0x3a907b)[_0xb5a6('0x2d')](function(){success+=0x1;})[_0xb5a6('0x55')](function(_0x948229){if(_0x948229[_0xb5a6('0x15')]){errors+=0x1;delete _0x948229[_0xb5a6('0x15')];}else if(_0x948229[_0xb5a6('0x69')]){duplicates+=0x1;delete _0x948229[_0xb5a6('0x69')];}rows[_0xb5a6('0x2e')](_0x948229);}));if(total%0xc8===0x0){_0x2c794c['pause']();return processPromises(_0x2c794c);}},'complete':function(){return processPromises()[_0xb5a6('0x2d')](function(){logger['info'](_0xb5a6('0x6a'));endCsv();});},'error':function(_0xbb6fbd,_0x5c3a59){logger[_0xb5a6('0x66')](_0xb5a6('0x6b'),JSON[_0xb5a6('0x31')](_0xbb6fbd));endCsv();}});})[_0xb5a6('0x55')](function(_0x199c26){logger[_0xb5a6('0x15')](_0xb5a6('0x6c'),JSON[_0xb5a6('0x31')](_0x199c26));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index aa14dc2..6a8a7b3 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 _0xf820=['uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','format','test','select','field','phone','join','.id\x20=\x20','\x20=\x20','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','recallme','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','cm_hopper_black','updatedAt','cm_contacts','\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','error','message','push','code','sequelize','query','catch','stringify','start','binding','root','server/files/tmp','header','writeFileSync','parse','createReadStream','data','length','errors','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','priority','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','emit','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','contact:import:','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available'];(function(_0x1c50d6,_0x1097f2){var _0x566560=function(_0x7fad7){while(--_0x7fad7){_0x1c50d6['push'](_0x1c50d6['shift']());}};_0x566560(++_0x1097f2);}(_0xf820,0x86));var _0x0f82=function(_0x9692be,_0x533c06){_0x9692be=_0x9692be-0x0;var _0x288a1b=_0xf820[_0x9692be];return _0x288a1b;};'use strict';var fs=require('fs');var path=require(_0x0f82('0x0'));var _=require(_0x0f82('0x1'));var Papa=require(_0x0f82('0x2'));var util=require('util');var BPromise=require(_0x0f82('0x3'));var moment=require(_0x0f82('0x4'));var squel=require(_0x0f82('0x5'));var Redis=require(_0x0f82('0x6'));var db=require(_0x0f82('0x7'))['db'];var config=require(_0x0f82('0x8'));var logger=require(_0x0f82('0x9'))('import');config[_0x0f82('0xa')]=_[_0x0f82('0xb')](config[_0x0f82('0xa')],{'host':_0x0f82('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x0f82('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4183b3){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))*$/[_0x0f82('0xe')](_0x4183b3);}function selectNotIn(_0x4b2fae,_0x1286ad,_0x271ac0,_0x1c6dbf,_0x4b1d54){return squel[_0x0f82('0xf')]()[_0x0f82('0x10')](_0x0f82('0x11'))['from'](_0x1c6dbf)[_0x0f82('0x12')](_0x1286ad,null,_0x1286ad+_0x0f82('0x13')+_0x1c6dbf+'.'+_0x271ac0)['where'](_0x1c6dbf+'.'+_0x271ac0+_0x0f82('0x14')+_0x4b2fae+'.'+_0x271ac0)['where'](_0x1286ad+'.dialCheckDuplicateType\x20IN\x20('+_0x4b1d54[_0x0f82('0x12')]()+')');}function insertCmHopper(_0x2339ec,_0x2535df,_0x425553,_0x5155c9,_0x1ae868){var _0xeaaf26=['cm_contacts.phone',_0x0f82('0x15'),'cm_contacts.id',_0x0f82('0x16'),_0x2535df+'.'+_0x5155c9,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x0f82('0x17'),'cm_contacts.UserId','\x22'+_0x1ae868+'\x22'];return squel[_0x0f82('0x18')]()[_0x0f82('0x19')](_0x0f82('0x1a'))[_0x0f82('0x1b')]([_0x0f82('0x11'),_0x0f82('0x1c'),_0x0f82('0x1d'),_0x0f82('0x1e'),_0x5155c9,_0x0f82('0x1f'),'updatedAt','priority','UserId',_0x0f82('0x20')],squel[_0x0f82('0xf')]()[_0x0f82('0x21')](_0xeaaf26)[_0x0f82('0x22')](_0x2535df)[_0x0f82('0x12')]('cm_contacts',null,_0x0f82('0x23')+_0x2535df+_0x0f82('0x24'))[_0x0f82('0x12')](_0x425553,null,_0x425553+_0x0f82('0x13')+_0x2535df+'.'+_0x5155c9)[_0x0f82('0x25')](_0x2535df+_0x0f82('0x26'),_0x2339ec)[_0x0f82('0x25')](_0x0f82('0x27'),NOW)[_0x0f82('0x25')](_0x0f82('0x28'),selectNotIn(_0x2535df,_0x425553,_0x5155c9,_0x0f82('0x1a'),[_0x0f82('0x29'),_0x0f82('0x2a')]))[_0x0f82('0x25')](_0x0f82('0x28'),selectNotIn(_0x2535df,_0x425553,_0x5155c9,_0x0f82('0x1a'),[_0x0f82('0x29')])))[_0x0f82('0x2b')]();}function insertCmHopperBlack(_0x141000,_0x334d8a,_0x47b356,_0x15421e){var _0x1a21d1=['cm_contacts.phone','cm_contacts.id',_0x0f82('0x16'),_0x334d8a+'.'+_0x15421e,'cm_contacts.createdAt',_0x0f82('0x2c')];return squel[_0x0f82('0x18')]()[_0x0f82('0x19')](_0x0f82('0x2d'))[_0x0f82('0x1b')]([_0x0f82('0x11'),_0x0f82('0x1d'),'ListId',_0x15421e,_0x0f82('0x1f'),_0x0f82('0x2e')],squel['select']()[_0x0f82('0x21')](_0x1a21d1)[_0x0f82('0x22')](_0x334d8a)[_0x0f82('0x12')](_0x0f82('0x2f'),null,_0x0f82('0x23')+_0x334d8a+_0x0f82('0x24'))[_0x0f82('0x12')](_0x47b356,null,_0x47b356+_0x0f82('0x13')+_0x334d8a+'.'+_0x15421e)[_0x0f82('0x25')](_0x334d8a+_0x0f82('0x26'),_0x141000)['where'](_0x0f82('0x27'),NOW)[_0x0f82('0x25')](_0x0f82('0x28'),squel[_0x0f82('0xf')]()[_0x0f82('0x10')](_0x0f82('0x11'))[_0x0f82('0x22')](_0x0f82('0x2d'))['where']('ListId\x20=\x20?',_0x141000)[_0x0f82('0x25')](_0x15421e+_0x0f82('0x30'),_0x334d8a+'.'+_0x15421e)))[_0x0f82('0x2b')]();}function insertCmContact(_0x4a690d,_0x3fae95,_0x422bc4,_0x32ce39){var _0x434cd3=_['concat'](_[_0x0f82('0x31')](_0x32ce39),[_0x0f82('0x1e'),_0x0f82('0x32'),_0x0f82('0x1f'),_0x0f82('0x2e')]);return squel['insert']()[_0x0f82('0x19')](_0x0f82('0x2f'))[_0x0f82('0x1b')](_0x434cd3,squel[_0x0f82('0xf')]()[_0x0f82('0x21')](_0x434cd3)[_0x0f82('0x22')](_0x3fae95)[_0x0f82('0x25')]('('+_0x422bc4[_0x0f82('0x12')](',')+_0x0f82('0x33'),squel[_0x0f82('0xf')]()['fields'](_0x422bc4)[_0x0f82('0x22')](_0x0f82('0x2f'))[_0x0f82('0x25')]('ListId\x20=\x20?',_0x4a690d)[_0x0f82('0x25')](_0x0f82('0x34')))[_0x0f82('0x25')](_0x0f82('0x35'),squel['select']()['field'](_0x0f82('0x36'),_0x0f82('0x37'))[_0x0f82('0x22')](_0x3fae95)['group'](_0x422bc4['join'](','))))[_0x0f82('0x2b')]();}function handleStop(){logger[_0x0f82('0x38')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x110819){logger[_0x0f82('0x39')](_0x110819[_0x0f82('0x3a')]);process['exit'](0x1);}function handleError(_0x51df3d,_0x4c7cb4){stats['errors'][_0x0f82('0x3b')]({'name':_0x4c7cb4[_0x0f82('0x3c')],'message':_0x4c7cb4[_0x0f82('0x3a')],'row':_0x51df3d});}function handleQuery(_0x2f0673){logger['info'](_0x2f0673);return db[_0x0f82('0x3d')][_0x0f82('0x3e')](_0x2f0673)['spread'](function(_0x461e60){results['push'](_0x461e60);})[_0x0f82('0x3f')](function(_0x4f3e30){logger[_0x0f82('0x39')](_0x4f3e30[_0x0f82('0x3a')]);});}function main(_0x1b7bc4,_0x4e4db5,_0x19c97d,_0x48333a){logger[_0x0f82('0x38')]('main',_0x1b7bc4,JSON[_0x0f82('0x40')](_0x4e4db5));process['send'](_0x0f82('0x41'));var _0x39683c=_0x4e4db5[_0x0f82('0x42')];var _0x2728d0=_0x4e4db5['socket_timestamp'];var _0x57059f=path[_0x0f82('0x12')](config[_0x0f82('0x43')],_0x0f82('0x44'),_0x2728d0+'.csv');var _0xf99586=_['keys'](_0x39683c)[_0x0f82('0x12')]();logger[_0x0f82('0x38')](_0x0f82('0x45'),_0xf99586);fs[_0x0f82('0x46')](_0x57059f,_0xf99586+'\x0a');Papa[_0x0f82('0x47')](fs[_0x0f82('0x48')](_0x1b7bc4),{'header':!![],'skipEmptyLines':!![],'step':function(_0xf6f47d,_0x479c27){try{for(var _0x6b21a4=0x0,_0x400b08=[];_0x6b21a4<_0xf6f47d[_0x0f82('0x49')][_0x0f82('0x4a')];_0x6b21a4++){stats['rows']+=0x1;if(_0xf6f47d[_0x0f82('0x4b')][_0x6b21a4]){handleError(_0xf6f47d[_0x0f82('0x49')][_0x6b21a4],_0xf6f47d[_0x0f82('0x4b')][_0x6b21a4]);}else{var _0x40cad2=[];for(var _0x538f76 in _0x39683c){if(_0x39683c[_0x0f82('0x4c')](_0x538f76)){if(_0xf6f47d[_0x0f82('0x49')][_0x6b21a4][_0x39683c[_0x538f76]]){var _0x129c57=_[_0x0f82('0x4d')](_0xf6f47d[_0x0f82('0x49')][_0x6b21a4][_0x39683c[_0x538f76]][_0x0f82('0x4e')](/"/g,'\x27'));switch(_0x538f76){case _0x0f82('0x1c'):var _0x1ceb17=moment(_0x129c57,_0x0f82('0x4f'),!![]);if(_0x1ceb17[_0x0f82('0x50')]()){_0x400b08['push']('\x22'+_0x129c57+'\x22');}else{_0x40cad2[_0x0f82('0x3b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x0f82('0x51'):var _0x1d2ce9=parseInt(_0x129c57);_0x129c57=_[_0x0f82('0x52')](_0x1d2ce9)||_0x1d2ce9<0x0||_0x1d2ce9>0x4?_0x48333a?0x3:0x2:_0x1d2ce9;_0x400b08[_0x0f82('0x3b')]('\x22'+_0x129c57+'\x22');break;case _0x0f82('0x53'):var _0x96b017=parseInt(_0x129c57);if(_[_0x0f82('0x54')](_0x96b017)&&_['includes'](_0x19c97d,_0x96b017)){_0x400b08[_0x0f82('0x3b')]('\x22'+_0x96b017+'\x22');}else{_0x40cad2[_0x0f82('0x3b')](_0x0f82('0x55'));}break;case _0x0f82('0x56'):if(isEmail(_0x129c57)){_0x400b08['push']('\x22'+_0x129c57+'\x22');}else{_0x40cad2[_0x0f82('0x3b')](_0x0f82('0x57'));}break;case _0x0f82('0x58'):var _0x4a056b=moment(_0x129c57,'YYYY-MM-DD',!![]);if(_0x4a056b[_0x0f82('0x50')]()){_0x400b08[_0x0f82('0x3b')]('\x22'+_0x129c57+'\x22');}else{_0x40cad2[_0x0f82('0x3b')](_0x0f82('0x59'));}break;default:_0x400b08['push']('\x22'+_0x129c57+'\x22');}}else{switch(_0x538f76){case _0x0f82('0x5a'):case'phone':_0x40cad2['push'](_0x538f76+_0x0f82('0x5b'));break;default:_0x400b08['push']('\x22\x22');}}}}if(_0x40cad2[_0x0f82('0x4a')]){handleError(_0xf6f47d[_0x0f82('0x49')][_0x6b21a4],{'code':_0x0f82('0x5c'),'message':_0x40cad2[_0x0f82('0x12')]()});}else{fs[_0x0f82('0x5d')](_0x57059f,_0x400b08[_0x0f82('0x12')]()+'\x0a');}_0x400b08=[];}if(!(stats[_0x0f82('0x5e')]%0xc8)){socket[_0x0f82('0x5f')]('contact:import:'+_0x2728d0,stats);stats[_0x0f82('0x4b')]=[];}}if(stopped){logger[_0x0f82('0x38')](_0x0f82('0x60'));_0x479c27[_0x0f82('0x61')]();}}catch(_0x5dbd52){handleError(_0xf6f47d[_0x0f82('0x49')][_0x6b21a4],{'code':'SystemError','message':_0x5dbd52['message']});logger[_0x0f82('0x39')](_0x0f82('0x62'),_0x5dbd52[_0x0f82('0x3a')]);}},'complete':function(){try{var _0x25e41b=[];var _0x52f8bb=_0x0f82('0x2f');if(_0x4e4db5['duplicates']&&_0x4e4db5[_0x0f82('0x63')]['length']){_0x52f8bb=_0x0f82('0x64')+_0x2728d0;_0x25e41b[_0x0f82('0x3b')](_0x0f82('0x65')+_0x52f8bb+_0x0f82('0x66'));}var _0xd0310f=util[_0x0f82('0xd')](_0x0f82('0x67'),_0x57059f,_0x52f8bb,_0xf99586,_0x4e4db5[_0x0f82('0x1e')],_0x4e4db5['CompanyId']||null,NOW,NOW);if(_[_0x0f82('0x68')](_0x39683c['scheduledat'])){_0xd0310f+=_0x0f82('0x69');}_0x25e41b['push'](_0xd0310f);if(_0x4e4db5[_0x0f82('0x63')]&&_0x4e4db5[_0x0f82('0x63')]['length']){_0x25e41b[_0x0f82('0x3b')](insertCmContact(_0x4e4db5[_0x0f82('0x1e')],_0x52f8bb,_0x4e4db5[_0x0f82('0x63')],_0x39683c));_0x25e41b[_0x0f82('0x3b')](_0x0f82('0x6a')+_0x52f8bb+';');}_0x25e41b[_0x0f82('0x3b')](insertCmHopper(_0x4e4db5[_0x0f82('0x1e')],_0x0f82('0x6b'),_0x0f82('0x6c'),_0x0f82('0x6d'),_0x48333a));_0x25e41b[_0x0f82('0x3b')](insertCmHopperBlack(_0x4e4db5['ListId'],_0x0f82('0x6e'),_0x0f82('0x6c'),'VoiceQueueId'));_0x25e41b[_0x0f82('0x3b')](insertCmHopper(_0x4e4db5[_0x0f82('0x1e')],_0x0f82('0x6f'),_0x0f82('0x70'),_0x0f82('0x71'),_0x48333a));_0x25e41b[_0x0f82('0x3b')](insertCmHopperBlack(_0x4e4db5[_0x0f82('0x1e')],_0x0f82('0x72'),_0x0f82('0x70'),_0x0f82('0x71')));BPromise[_0x0f82('0x73')](_0x25e41b,handleQuery)[_0x0f82('0x74')](function(_0x33230c){stats[_0x0f82('0x75')]=!![];stats['affectedRows']=_0x4e4db5[_0x0f82('0x63')]&&_0x4e4db5[_0x0f82('0x63')][_0x0f82('0x4a')]?results[0x2]['affectedRows']:results[0x0][_0x0f82('0x76')];socket[_0x0f82('0x5f')](_0x0f82('0x77')+_0x2728d0,stats);fs[_0x0f82('0x78')](_0x1b7bc4);fs[_0x0f82('0x78')](_0x57059f);process[_0x0f82('0x79')](0x0);})[_0x0f82('0x3f')](function(_0x426cec){logger[_0x0f82('0x39')](_0x426cec['message']);process[_0x0f82('0x79')](0x1);});}catch(_0x311320){logger[_0x0f82('0x39')](_0x0f82('0x7a'),_0x311320['message']);process[_0x0f82('0x79')](0x1);}},'error':function(_0x210006,_0x4df156,_0x1e1dd7,_0x261616){throw new Error(_0x261616);}});}function validate(){if(process[_0x0f82('0x7b')]&&process[_0x0f82('0x7b')][_0x0f82('0x4a')]<0x4){throw new Error(_0x0f82('0x7c'));}var _0x1f9b1a=path[_0x0f82('0x12')](config[_0x0f82('0x43')],_0x0f82('0x44'),process['argv'][0x2]);if(!fs['existsSync'](_0x1f9b1a)){throw new Error(_0x0f82('0x7d'));}var _0x5d2b6b={};try{_0x5d2b6b=JSON['parse'](process[_0x0f82('0x7b')][0x3]);if(!_0x5d2b6b[_0x0f82('0x42')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x5d2b6b[_0x0f82('0x42')][_0x0f82('0x11')]){throw new Error(_0x0f82('0x7e'));}if(!_0x5d2b6b[_0x0f82('0x42')]['firstName']){throw new Error(_0x0f82('0x7f'));}var _0x5bad0d=0x0;if(_0x5d2b6b[_0x0f82('0x42')]['UserId']){_0x5bad0d=0x1;}if(!_0x5d2b6b['ListId']){throw new Error(_0x0f82('0x80'));}}catch(_0xbd1963){throw new Error(_0x0f82('0x81'));}var _0x563c5f=[];try{_0x563c5f=_[_0x0f82('0x82')](JSON[_0x0f82('0x47')](process[_0x0f82('0x7b')][0x4]),'id');}catch(_0x4458ef){logger['info'](_0x0f82('0x83'));}main(_0x1f9b1a,_0x5d2b6b,_0x563c5f,_0x5bad0d);}validate();process['on']('SIGINT',handleStop);process['on'](_0x0f82('0x84'),handleUncaughtException); \ No newline at end of file +var _0xecdc=['affectedRows','unlink','catch','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','select','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_hopper','toString','into','cm_hopper_black','fields','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','field','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','code','info','sequelize','query','spread','push','main','stringify','send','start','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','errors','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','format','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','finish'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0xecdc,0x125));var _0xcecd=function(_0x5ad1dc,_0x28a660){_0x5ad1dc=_0x5ad1dc-0x0;var _0x24efd8=_0xecdc[_0x5ad1dc];return _0x24efd8;};'use strict';var fs=require('fs');var path=require(_0xcecd('0x0'));var _=require(_0xcecd('0x1'));var Papa=require('papaparse');var util=require(_0xcecd('0x2'));var BPromise=require(_0xcecd('0x3'));var moment=require(_0xcecd('0x4'));var squel=require(_0xcecd('0x5'));var Redis=require(_0xcecd('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xcecd('0x7'));var logger=require(_0xcecd('0x8'))(_0xcecd('0x9'));config['redis']=_[_0xcecd('0xa')](config[_0xcecd('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcecd('0xc'))(new Redis(config[_0xcecd('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0xcecd('0xd'));function isEmail(_0x4c0e2a){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))*$/[_0xcecd('0xe')](_0x4c0e2a);}function selectNotIn(_0x445331,_0x5b31b6,_0x253fa6,_0xe85d3c,_0x58f74c){return squel['select']()['field']('phone')[_0xcecd('0xf')](_0xe85d3c)[_0xcecd('0x10')](_0x5b31b6,null,_0x5b31b6+_0xcecd('0x11')+_0xe85d3c+'.'+_0x253fa6)[_0xcecd('0x12')](_0xe85d3c+'.'+_0x253fa6+'\x20=\x20'+_0x445331+'.'+_0x253fa6)['where'](_0x5b31b6+_0xcecd('0x13')+_0x58f74c[_0xcecd('0x10')]()+')');}function insertCmHopper(_0x25fafc,_0x176199,_0x5dbdef,_0x280d5f,_0x4a9d0f){var _0x194103=[_0xcecd('0x14'),_0xcecd('0x15'),_0xcecd('0x16'),_0xcecd('0x17'),_0x176199+'.'+_0x280d5f,_0xcecd('0x18'),'cm_contacts.updatedAt',_0xcecd('0x19'),_0xcecd('0x1a'),'\x22'+_0x4a9d0f+'\x22'];return squel[_0xcecd('0x1b')]()['into']('cm_hopper')[_0xcecd('0x1c')]([_0xcecd('0x1d'),_0xcecd('0x1e'),_0xcecd('0x1f'),_0xcecd('0x20'),_0x280d5f,_0xcecd('0x21'),_0xcecd('0x22'),'priority',_0xcecd('0x23'),'recallme'],squel[_0xcecd('0x24')]()['fields'](_0x194103)[_0xcecd('0xf')](_0x176199)['join'](_0xcecd('0x25'),null,_0xcecd('0x26')+_0x176199+_0xcecd('0x27'))['join'](_0x5dbdef,null,_0x5dbdef+_0xcecd('0x11')+_0x176199+'.'+_0x280d5f)[_0xcecd('0x12')](_0x176199+_0xcecd('0x28'),_0x25fafc)['where'](_0xcecd('0x29'),NOW)[_0xcecd('0x12')](_0xcecd('0x2a'),selectNotIn(_0x176199,_0x5dbdef,_0x280d5f,'cm_hopper',[_0xcecd('0x2b'),'\x22onlyIfOpen\x22']))[_0xcecd('0x12')](_0xcecd('0x2a'),selectNotIn(_0x176199,_0x5dbdef,_0x280d5f,_0xcecd('0x2c'),[_0xcecd('0x2b')])))[_0xcecd('0x2d')]();}function insertCmHopperBlack(_0x2d91ee,_0x242dec,_0x27d0fe,_0x4115f6){var _0x350110=[_0xcecd('0x14'),_0xcecd('0x16'),_0xcecd('0x17'),_0x242dec+'.'+_0x4115f6,_0xcecd('0x18'),'cm_contacts.updatedAt'];return squel['insert']()[_0xcecd('0x2e')](_0xcecd('0x2f'))[_0xcecd('0x1c')]([_0xcecd('0x1d'),_0xcecd('0x1f'),_0xcecd('0x20'),_0x4115f6,_0xcecd('0x21'),_0xcecd('0x22')],squel[_0xcecd('0x24')]()[_0xcecd('0x30')](_0x350110)['from'](_0x242dec)[_0xcecd('0x10')](_0xcecd('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0x242dec+_0xcecd('0x27'))[_0xcecd('0x10')](_0x27d0fe,null,_0x27d0fe+'.id\x20=\x20'+_0x242dec+'.'+_0x4115f6)[_0xcecd('0x12')](_0x242dec+_0xcecd('0x28'),_0x2d91ee)[_0xcecd('0x12')](_0xcecd('0x29'),NOW)[_0xcecd('0x12')](_0xcecd('0x2a'),squel[_0xcecd('0x24')]()['field'](_0xcecd('0x1d'))[_0xcecd('0xf')]('cm_hopper_black')['where'](_0xcecd('0x31'),_0x2d91ee)[_0xcecd('0x12')](_0x4115f6+_0xcecd('0x32'),_0x242dec+'.'+_0x4115f6)))[_0xcecd('0x2d')]();}function insertCmContact(_0x3ecf61,_0x3bed6d,_0x220d9f,_0x1854fe){var _0x5bcf58=_['concat'](_[_0xcecd('0x33')](_0x1854fe),[_0xcecd('0x20'),_0xcecd('0x34'),_0xcecd('0x21'),_0xcecd('0x22')]);return squel[_0xcecd('0x1b')]()[_0xcecd('0x2e')](_0xcecd('0x25'))[_0xcecd('0x1c')](_0x5bcf58,squel[_0xcecd('0x24')]()[_0xcecd('0x30')](_0x5bcf58)[_0xcecd('0xf')](_0x3bed6d)[_0xcecd('0x12')]('('+_0x220d9f[_0xcecd('0x10')](',')+_0xcecd('0x35'),squel['select']()[_0xcecd('0x30')](_0x220d9f)['from'](_0xcecd('0x25'))[_0xcecd('0x12')](_0xcecd('0x31'),_0x3ecf61)[_0xcecd('0x12')](_0xcecd('0x36')))[_0xcecd('0x12')](_0xcecd('0x37'),squel['select']()[_0xcecd('0x38')](_0xcecd('0x39'),_0xcecd('0x3a'))[_0xcecd('0xf')](_0x3bed6d)[_0xcecd('0x3b')](_0x220d9f[_0xcecd('0x10')](','))))[_0xcecd('0x2d')]();}function handleStop(){logger['info'](_0xcecd('0x3c'));stopped=!![];}function handleUncaughtException(_0x972c0e){logger[_0xcecd('0x3d')](_0x972c0e[_0xcecd('0x3e')]);process[_0xcecd('0x3f')](0x1);}function handleError(_0x2c3ccb,_0x5a4cdd){stats['errors']['push']({'name':_0x5a4cdd[_0xcecd('0x40')],'message':_0x5a4cdd[_0xcecd('0x3e')],'row':_0x2c3ccb});}function handleQuery(_0x4a245a){logger[_0xcecd('0x41')](_0x4a245a);return db[_0xcecd('0x42')][_0xcecd('0x43')](_0x4a245a)[_0xcecd('0x44')](function(_0x41d848){results[_0xcecd('0x45')](_0x41d848);})['catch'](function(_0x5d0314){logger['error'](_0x5d0314[_0xcecd('0x3e')]);});}function main(_0x305503,_0x33b164,_0x316dd6,_0x37bcac){logger[_0xcecd('0x41')](_0xcecd('0x46'),_0x305503,JSON[_0xcecd('0x47')](_0x33b164));process[_0xcecd('0x48')](_0xcecd('0x49'));var _0x24bbe1=_0x33b164['binding'];var _0x353141=_0x33b164[_0xcecd('0x4a')];var _0x1548c6=path['join'](config[_0xcecd('0x4b')],_0xcecd('0x4c'),_0x353141+_0xcecd('0x4d'));var _0x5ebd0d=_[_0xcecd('0x33')](_0x24bbe1)[_0xcecd('0x10')]();logger[_0xcecd('0x41')](_0xcecd('0x4e'),_0x5ebd0d);fs[_0xcecd('0x4f')](_0x1548c6,_0x5ebd0d+'\x0a');Papa[_0xcecd('0x50')](fs[_0xcecd('0x51')](_0x305503),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2eb104,_0x450be1){try{for(var _0x4bcff2=0x0,_0x1940ed=[];_0x4bcff2<_0x2eb104[_0xcecd('0x52')][_0xcecd('0x53')];_0x4bcff2++){stats[_0xcecd('0x54')]+=0x1;if(_0x2eb104[_0xcecd('0x55')][_0x4bcff2]){handleError(_0x2eb104[_0xcecd('0x52')][_0x4bcff2],_0x2eb104['errors'][_0x4bcff2]);}else{var _0x37f374=[];for(var _0x498fa0 in _0x24bbe1){if(_0x24bbe1[_0xcecd('0x56')](_0x498fa0)){if(_0x2eb104['data'][_0x4bcff2][_0x24bbe1[_0x498fa0]]){var _0x4bc59a=_[_0xcecd('0x57')](_0x2eb104[_0xcecd('0x52')][_0x4bcff2][_0x24bbe1[_0x498fa0]]['replace'](/"/g,'\x27'));switch(_0x498fa0){case _0xcecd('0x1e'):var _0x587a28=moment(_0x4bc59a,_0xcecd('0xd'),!![]);if(_0x587a28[_0xcecd('0x58')]()){_0x1940ed[_0xcecd('0x45')]('\x22'+_0x4bc59a+'\x22');}else{_0x37f374[_0xcecd('0x45')](_0xcecd('0x59'));}break;case _0xcecd('0x5a'):var _0x4a1378=parseInt(_0x4bc59a);_0x4bc59a=_[_0xcecd('0x5b')](_0x4a1378)||_0x4a1378<0x0||_0x4a1378>0x4?_0x37bcac?0x3:0x2:_0x4a1378;_0x1940ed[_0xcecd('0x45')]('\x22'+_0x4bc59a+'\x22');break;case _0xcecd('0x23'):var _0x4f7302=parseInt(_0x4bc59a);if(_[_0xcecd('0x5c')](_0x4f7302)&&_['includes'](_0x316dd6,_0x4f7302)){_0x1940ed[_0xcecd('0x45')]('\x22'+_0x4f7302+'\x22');}else{_0x37f374[_0xcecd('0x45')](_0xcecd('0x5d'));}break;case'email':if(isEmail(_0x4bc59a)){_0x1940ed[_0xcecd('0x45')]('\x22'+_0x4bc59a+'\x22');}else{_0x37f374['push'](_0xcecd('0x5e'));}break;case'dateOfBirth':var _0x3298df=moment(_0x4bc59a,_0xcecd('0x5f'),!![]);if(_0x3298df[_0xcecd('0x58')]()){_0x1940ed[_0xcecd('0x45')]('\x22'+_0x4bc59a+'\x22');}else{_0x37f374[_0xcecd('0x45')](_0xcecd('0x60'));}break;default:_0x1940ed[_0xcecd('0x45')]('\x22'+_0x4bc59a+'\x22');}}else{switch(_0x498fa0){case _0xcecd('0x61'):case'phone':_0x37f374['push'](_0x498fa0+'\x20not\x20specified');break;default:_0x1940ed[_0xcecd('0x45')]('\x22\x22');}}}}if(_0x37f374[_0xcecd('0x53')]){handleError(_0x2eb104[_0xcecd('0x52')][_0x4bcff2],{'code':'SystemRow','message':_0x37f374[_0xcecd('0x10')]()});}else{fs[_0xcecd('0x62')](_0x1548c6,_0x1940ed['join']()+'\x0a');}_0x1940ed=[];}if(!(stats[_0xcecd('0x54')]%0xc8)){socket[_0xcecd('0x63')](_0xcecd('0x64')+_0x353141,stats);stats[_0xcecd('0x55')]=[];}}if(stopped){logger[_0xcecd('0x41')](_0xcecd('0x65'));_0x450be1[_0xcecd('0x66')]();}}catch(_0x2f9c3b){handleError(_0x2eb104[_0xcecd('0x52')][_0x4bcff2],{'code':_0xcecd('0x67'),'message':_0x2f9c3b[_0xcecd('0x3e')]});logger[_0xcecd('0x3d')](_0xcecd('0x68'),_0x2f9c3b['message']);}},'complete':function(){try{var _0x586b4e=[];var _0xe2918=_0xcecd('0x25');if(_0x33b164[_0xcecd('0x69')]&&_0x33b164['duplicates'][_0xcecd('0x53')]){_0xe2918=_0xcecd('0x6a')+_0x353141;_0x586b4e['push']('CREATE\x20TABLE\x20'+_0xe2918+'\x20LIKE\x20cm_contacts;');}var _0x3b53d4=util[_0xcecd('0x6b')](_0xcecd('0x6c'),_0x1548c6,_0xe2918,_0x5ebd0d,_0x33b164['ListId'],_0x33b164[_0xcecd('0x34')]||null,NOW,NOW);if(_[_0xcecd('0x6d')](_0x24bbe1[_0xcecd('0x1e')])){_0x3b53d4+=_0xcecd('0x6e');}_0x586b4e[_0xcecd('0x45')](_0x3b53d4);if(_0x33b164[_0xcecd('0x69')]&&_0x33b164['duplicates']['length']){_0x586b4e[_0xcecd('0x45')](insertCmContact(_0x33b164['ListId'],_0xe2918,_0x33b164[_0xcecd('0x69')],_0x24bbe1));_0x586b4e[_0xcecd('0x45')](_0xcecd('0x6f')+_0xe2918+';');}_0x586b4e[_0xcecd('0x45')](insertCmHopper(_0x33b164[_0xcecd('0x20')],_0xcecd('0x70'),_0xcecd('0x71'),'VoiceQueueId',_0x37bcac));_0x586b4e[_0xcecd('0x45')](insertCmHopperBlack(_0x33b164[_0xcecd('0x20')],_0xcecd('0x72'),'voice_queues','VoiceQueueId'));_0x586b4e[_0xcecd('0x45')](insertCmHopper(_0x33b164['ListId'],_0xcecd('0x73'),_0xcecd('0x74'),_0xcecd('0x75'),_0x37bcac));_0x586b4e[_0xcecd('0x45')](insertCmHopperBlack(_0x33b164[_0xcecd('0x20')],_0xcecd('0x76'),'campaigns',_0xcecd('0x75')));BPromise[_0xcecd('0x77')](_0x586b4e,handleQuery)['then'](function(_0x154877){stats[_0xcecd('0x78')]=!![];stats[_0xcecd('0x79')]=_0x33b164['duplicates']&&_0x33b164[_0xcecd('0x69')][_0xcecd('0x53')]?results[0x2][_0xcecd('0x79')]:results[0x0][_0xcecd('0x79')];socket[_0xcecd('0x63')]('contact:import:'+_0x353141,stats);fs[_0xcecd('0x7a')](_0x305503);fs[_0xcecd('0x7a')](_0x1548c6);process['exit'](0x0);})[_0xcecd('0x7b')](function(_0x5efffb){logger[_0xcecd('0x3d')](_0x5efffb[_0xcecd('0x3e')]);process['exit'](0x1);});}catch(_0xb8bfc1){logger['error'](_0xcecd('0x7c'),_0xb8bfc1[_0xcecd('0x3e')]);process[_0xcecd('0x3f')](0x1);}},'error':function(_0x6cddfe,_0x59d367,_0x1c4d25,_0x41616a){throw new Error(_0x41616a);}});}function validate(){if(process[_0xcecd('0x7d')]&&process[_0xcecd('0x7d')][_0xcecd('0x53')]<0x4){throw new Error(_0xcecd('0x7e'));}var _0x23fc07=path[_0xcecd('0x10')](config[_0xcecd('0x4b')],_0xcecd('0x4c'),process[_0xcecd('0x7d')][0x2]);if(!fs[_0xcecd('0x7f')](_0x23fc07)){throw new Error(_0xcecd('0x80'));}var _0x4acc32={};try{_0x4acc32=JSON['parse'](process['argv'][0x3]);if(!_0x4acc32[_0xcecd('0x81')]){throw new Error(_0xcecd('0x82'));}if(!_0x4acc32['binding'][_0xcecd('0x1d')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x4acc32[_0xcecd('0x81')][_0xcecd('0x61')]){throw new Error(_0xcecd('0x83'));}var _0x2c69a0=0x0;if(_0x4acc32[_0xcecd('0x81')][_0xcecd('0x23')]){_0x2c69a0=0x1;}if(!_0x4acc32[_0xcecd('0x20')]){throw new Error(_0xcecd('0x84'));}}catch(_0x264417){throw new Error(_0xcecd('0x85'));}var _0x2d0484=[];try{_0x2d0484=_[_0xcecd('0x86')](JSON[_0xcecd('0x50')](process[_0xcecd('0x7d')][0x4]),'id');}catch(_0x30aa1b){logger[_0xcecd('0x41')](_0xcecd('0x87'));}main(_0x23fc07,_0x4acc32,_0x2d0484,_0x2c69a0);}validate();process['on'](_0xcecd('0x88'),handleStop);process['on'](_0xcecd('0x89'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 0c2cd1e..d8687e6 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6af=['UniqueId','uniqueid','Date','agentcalledAt','destcalleridname','Agent\x20Number','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','push','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','calleridnum','calleridname','Call\x20To','destexten','Queue','queue'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0xb6af,0xe2));var _0xfb6a=function(_0x77d76e,_0x106ed2){_0x77d76e=_0x77d76e-0x0;var _0x5620c8=_0xb6af[_0x77d76e];return _0x5620c8;};'use strict';exports[_0xfb6a('0x0')]=function(_0xe3d53b,_0x243bb3){var _0x50e2a1=[{'type':_0xfb6a('0x1'),'content':_0xfb6a('0x2'),'variableName':null}];switch(_0xe3d53b[_0xfb6a('0x3')]()){case _0xfb6a('0x4'):switch(_0x243bb3[_0xfb6a('0x3')]()){case _0xfb6a('0x5'):_0x50e2a1['push']({'type':_0xfb6a('0x6'),'content':'','variableName':'queue'});_0x50e2a1[_0xfb6a('0x7')]({'type':_0xfb6a('0x6'),'content':'','variableName':'calleridnum'});break;case _0xfb6a('0x8'):_0x50e2a1[_0xfb6a('0x7')]({'type':_0xfb6a('0x1'),'content':_0xfb6a('0x9'),'variableName':null});_0x50e2a1[_0xfb6a('0x7')]({'type':_0xfb6a('0x6'),'content':'','variableName':_0xfb6a('0xa')});break;}}return _0x50e2a1;};exports[_0xfb6a('0xb')]=function(_0x1fe5db,_0x326efc){var _0x26f7e2=[];switch(_0x1fe5db[_0xfb6a('0x3')]()){case _0xfb6a('0x4'):switch(_0x326efc[_0xfb6a('0x3')]()){case _0xfb6a('0x5'):_0x26f7e2=[{'type':_0xfb6a('0x1'),'content':_0xfb6a('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xfb6a('0xd'),'content':'','key':'Caller\x20Number','keyType':_0xfb6a('0x6'),'variableName':_0xfb6a('0xe')},{'type':_0xfb6a('0xd'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0xfb6a('0xf')},{'type':'keyValue','content':'','key':_0xfb6a('0x10'),'keyType':_0xfb6a('0x6'),'variableName':_0xfb6a('0x11')},{'type':'keyValue','content':'','key':_0xfb6a('0x12'),'keyType':_0xfb6a('0x6'),'variableName':_0xfb6a('0x13')},{'type':'keyValue','content':'','key':_0xfb6a('0x14'),'keyType':_0xfb6a('0x6'),'variableName':_0xfb6a('0x15')},{'type':_0xfb6a('0xd'),'content':'','key':_0xfb6a('0x16'),'keyType':_0xfb6a('0x6'),'variableName':_0xfb6a('0x17')},{'type':_0xfb6a('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0xfb6a('0x6'),'variableName':_0xfb6a('0x18')},{'type':'keyValue','content':'','key':_0xfb6a('0x19'),'keyType':_0xfb6a('0x6'),'variableName':_0xfb6a('0xa')},{'type':_0xfb6a('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0xfb6a('0x6'),'variableName':_0xfb6a('0x17')},{'type':_0xfb6a('0xd'),'content':'','key':_0xfb6a('0x1a'),'keyType':_0xfb6a('0x6'),'variableName':'agentconnectAt'},{'type':_0xfb6a('0xd'),'content':'','key':_0xfb6a('0x1b'),'keyType':_0xfb6a('0x6'),'variableName':_0xfb6a('0x1c')},{'type':'keyValue','content':'','key':_0xfb6a('0x1d'),'keyType':_0xfb6a('0x6'),'variableName':_0xfb6a('0x1e')},{'type':_0xfb6a('0xd'),'content':'','key':_0xfb6a('0x1f'),'keyType':'variable','variableName':_0xfb6a('0x20')}];break;case _0xfb6a('0x8'):_0x26f7e2=[{'type':_0xfb6a('0x1'),'content':_0xfb6a('0xc'),'variableName':null},{'type':_0xfb6a('0xd'),'content':'','key':'Called\x20Number','keyType':_0xfb6a('0x6'),'keyContent':'','variableName':_0xfb6a('0xa')},{'type':_0xfb6a('0xd'),'content':'','key':'Member\x20Name','keyType':_0xfb6a('0x6'),'keyContent':'','variableName':'membername'},{'type':_0xfb6a('0xd'),'content':'','key':_0xfb6a('0x14'),'keyType':_0xfb6a('0x6'),'keyContent':'','variableName':_0xfb6a('0x15')},{'type':'keyValue','content':'','key':_0xfb6a('0x16'),'keyType':_0xfb6a('0x6'),'keyContent':'','variableName':_0xfb6a('0x21')},{'type':_0xfb6a('0x1'),'content':_0xfb6a('0x22')},{'type':'keyValue','content':'','key':_0xfb6a('0x23'),'keyType':_0xfb6a('0x6'),'keyContent':'','variableName':_0xfb6a('0x24')},{'type':_0xfb6a('0xd'),'content':'','key':_0xfb6a('0x25'),'keyType':_0xfb6a('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0xfb6a('0xd'),'content':'','key':_0xfb6a('0x26'),'keyType':_0xfb6a('0x6'),'keyContent':'','variableName':_0xfb6a('0x27')},{'type':'keyValue','content':'','key':_0xfb6a('0x28'),'keyType':_0xfb6a('0x6'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x26f7e2;}; \ No newline at end of file +var _0x18b8=['answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','push','queue','Outbound\x20Call','destcalleridnum','getDescriptions','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','variable','calleridname','destexten','Queue','UniqueId','uniqueid','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','Date','starttime','***\x20Time\x20Info\x20***','Answer\x20Time'];(function(_0x42ed8c,_0x1df79b){var _0x2dc28f=function(_0x945fb0){while(--_0x945fb0){_0x42ed8c['push'](_0x42ed8c['shift']());}};_0x2dc28f(++_0x1df79b);}(_0x18b8,0xdd));var _0x818b=function(_0x49e789,_0x4777de){_0x49e789=_0x49e789-0x0;var _0x6e6793=_0x18b8[_0x49e789];return _0x6e6793;};'use strict';exports[_0x818b('0x0')]=function(_0x97126c,_0x28a5a3){var _0x5d048f=[{'type':_0x818b('0x1'),'content':_0x818b('0x2'),'variableName':null}];switch(_0x97126c[_0x818b('0x3')]()){case _0x818b('0x4'):switch(_0x28a5a3[_0x818b('0x3')]()){case'inbound':_0x5d048f[_0x818b('0x5')]({'type':'variable','content':'','variableName':_0x818b('0x6')});_0x5d048f['push']({'type':'variable','content':'','variableName':'calleridnum'});break;case'outbound':_0x5d048f[_0x818b('0x5')]({'type':_0x818b('0x1'),'content':_0x818b('0x7'),'variableName':null});_0x5d048f['push']({'type':'variable','content':'','variableName':_0x818b('0x8')});break;}}return _0x5d048f;};exports[_0x818b('0x9')]=function(_0x3b2377,_0x4ff6de){var _0x371ab6=[];switch(_0x3b2377[_0x818b('0x3')]()){case _0x818b('0x4'):switch(_0x4ff6de['toLowerCase']()){case _0x818b('0xa'):_0x371ab6=[{'type':'string','content':_0x818b('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x818b('0xc'),'content':'','key':_0x818b('0xd'),'keyType':_0x818b('0xe'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':_0x818b('0xe'),'variableName':_0x818b('0xf')},{'type':_0x818b('0xc'),'content':'','key':'Call\x20To','keyType':_0x818b('0xe'),'variableName':_0x818b('0x10')},{'type':'keyValue','content':'','key':_0x818b('0x11'),'keyType':_0x818b('0xe'),'variableName':_0x818b('0x6')},{'type':_0x818b('0xc'),'content':'','key':_0x818b('0x12'),'keyType':_0x818b('0xe'),'variableName':_0x818b('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0x818b('0xe'),'variableName':_0x818b('0x14')},{'type':_0x818b('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x818b('0x15'),'keyType':_0x818b('0xe'),'variableName':_0x818b('0x16')},{'type':_0x818b('0xc'),'content':'','key':'Agent\x20Number','keyType':_0x818b('0xe'),'variableName':_0x818b('0x8')},{'type':_0x818b('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x818b('0xc'),'content':'','key':_0x818b('0x17'),'keyType':'variable','variableName':_0x818b('0x14')},{'type':'keyValue','content':'','key':_0x818b('0x18'),'keyType':_0x818b('0xe'),'variableName':_0x818b('0x19')},{'type':_0x818b('0xc'),'content':'','key':_0x818b('0x1a'),'keyType':_0x818b('0xe'),'variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':_0x818b('0x1b'),'keyType':_0x818b('0xe'),'variableName':'holdtime'},{'type':_0x818b('0xc'),'content':'','key':_0x818b('0x1c'),'keyType':'variable','variableName':_0x818b('0x1d')}];break;case'outbound':_0x371ab6=[{'type':_0x818b('0x1'),'content':_0x818b('0xb'),'variableName':null},{'type':_0x818b('0xc'),'content':'','key':_0x818b('0x1e'),'keyType':_0x818b('0xe'),'keyContent':'','variableName':_0x818b('0x8')},{'type':'keyValue','content':'','key':_0x818b('0x1f'),'keyType':_0x818b('0xe'),'keyContent':'','variableName':_0x818b('0x20')},{'type':_0x818b('0xc'),'content':'','key':_0x818b('0x12'),'keyType':_0x818b('0xe'),'keyContent':'','variableName':_0x818b('0x13')},{'type':_0x818b('0xc'),'content':'','key':_0x818b('0x21'),'keyType':'variable','keyContent':'','variableName':_0x818b('0x22')},{'type':_0x818b('0x1'),'content':_0x818b('0x23')},{'type':_0x818b('0xc'),'content':'','key':_0x818b('0x24'),'keyType':_0x818b('0xe'),'keyContent':'','variableName':_0x818b('0x25')},{'type':_0x818b('0xc'),'content':'','key':_0x818b('0x26'),'keyType':_0x818b('0xe'),'keyContent':'','variableName':_0x818b('0x27')},{'type':_0x818b('0xc'),'content':'','key':_0x818b('0x28'),'keyType':'variable','keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':_0x818b('0x29'),'keyType':_0x818b('0xe'),'keyContent':'','variableName':_0x818b('0x2a')}];break;}}return _0x371ab6;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 9febd44..e6bce02 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90ce=['body','omit','phone','fax','mobile','lodash','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','then','info','catch','error','tracked','clone'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x90ce,0x19a));var _0xe90c=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0x90ce[_0x29e35f];return _0x266b74;};'use strict';var _=require(_0xe90c('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xe90c('0x1'))('openchannel-interactions'),'mail':require(_0xe90c('0x1'))(_0xe90c('0x2')),'fax':require(_0xe90c('0x1'))(_0xe90c('0x3')),'sms':require(_0xe90c('0x1'))(_0xe90c('0x4')),'chat':require('../../config/logger')(_0xe90c('0x5')),'whatsapp':require(_0xe90c('0x1'))(_0xe90c('0x6'))};function getInteractionId(_0x3dafcf,_0x1f7bfc,_0x47db63){if(_0x3dafcf&&_0x3dafcf[_[_0xe90c('0x7')](_0x47db63)+_0xe90c('0x8')]){return _0x3dafcf[_['upperFirst'](_0x47db63)+_0xe90c('0x8')];}else if(_0x3dafcf&&_0x3dafcf['id']){return _0x3dafcf['id'];}else if(_0x1f7bfc&&_0x1f7bfc['id']){return _0x1f7bfc['id'];}else{return _0xe90c('0x9');}}function log(_0x4cbe06,_0x5f4c85,_0x100726,_0x2205ff,_0x50e59b,_0xe7e2f5){loggers[_0x50e59b[_0xe90c('0xa')]()][_0x4cbe06](_0xe90c('0xb'),_0xe7e2f5[_0xe90c('0xc')](),_0x5f4c85?_0x5f4c85['id']:null,_0x5f4c85?_0x5f4c85[_0xe90c('0xd')]:null,_0x5f4c85?_0x5f4c85['role']:null,getInteractionId(_0x100726,_0x2205ff,_0x50e59b),_0x100726?JSON[_0xe90c('0xe')](_0x100726):_0xe90c('0xf'));}function updateUser(_0x425734,_0x439642,_0x4b8f33,_0x394455,_0x1cde1c){db[_[_0xe90c('0x7')](_0x394455)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x439642,_0x4b8f33,_0x394455)}})['then'](function(_0x1bf3e9){if(_0x1bf3e9){return _0x1bf3e9['update']({'UserId':_0x425734?_0x425734['id']:null});}})[_0xe90c('0x10')](function(_0x857d20){if(_0x857d20){log(_0xe90c('0x11'),_0x425734,_0x439642,_0x4b8f33,_0x394455,_0x1cde1c);}})[_0xe90c('0x12')](function(){log(_0xe90c('0x13'),_0x425734,_0x439642,_0x4b8f33,_0x394455,_0x1cde1c);});}exports[_0xe90c('0x14')]=function(_0x1c77a5,_0x393b1f){return function(_0x49ba81,_0x311e1d,_0x112947){var _0x1566ac=_0x49ba81['user'];var _0x3b13aa={};var _0x1fe5ef=_0x49ba81['query'];if(_0x3b13aa){_0x3b13aa=_[_0xe90c('0x15')](_0x49ba81[_0xe90c('0x16')]);_0x3b13aa=_[_0xe90c('0x17')](_0x3b13aa,[_0xe90c('0x16'),'html',_0xe90c('0x18'),_0xe90c('0x19'),_0xe90c('0x1a')]);}updateUser(_0x1566ac,_0x3b13aa,_0x1fe5ef,_0x1c77a5,_0x393b1f);_0x112947(null);};}; \ No newline at end of file +var _0x606e=['name','role','stringify','null','Interaction','then','update','info','catch','tracked','user','query','clone','body','html','phone','fax','mobile','../../config/logger','mail-interactions','fax-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase'];(function(_0x30b10c,_0x1e70c2){var _0x3cb444=function(_0x42b381){while(--_0x42b381){_0x30b10c['push'](_0x30b10c['shift']());}};_0x3cb444(++_0x1e70c2);}(_0x606e,0x17e));var _0xe606=function(_0x29e0eb,_0x9acb52){_0x29e0eb=_0x29e0eb-0x0;var _0x597d2d=_0x606e[_0x29e0eb];return _0x597d2d;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xe606('0x0'))('openchannel-interactions'),'mail':require(_0xe606('0x0'))(_0xe606('0x1')),'fax':require(_0xe606('0x0'))(_0xe606('0x2')),'sms':require(_0xe606('0x0'))('sms-interactions'),'chat':require('../../config/logger')(_0xe606('0x3')),'whatsapp':require(_0xe606('0x0'))('whatsapp-interactions')};function getInteractionId(_0x1b37c3,_0x1c2ce3,_0x55a120){if(_0x1b37c3&&_0x1b37c3[_[_0xe606('0x4')](_0x55a120)+'InteractionId']){return _0x1b37c3[_[_0xe606('0x4')](_0x55a120)+_0xe606('0x5')];}else if(_0x1b37c3&&_0x1b37c3['id']){return _0x1b37c3['id'];}else if(_0x1c2ce3&&_0x1c2ce3['id']){return _0x1c2ce3['id'];}else{return _0xe606('0x6');}}function log(_0x57e63a,_0x488d94,_0x46b70a,_0x3d4078,_0x1dbb8b,_0x1ec824){loggers[_0x1dbb8b[_0xe606('0x7')]()][_0x57e63a](_0xe606('0x8'),_0x1ec824[_0xe606('0x9')](),_0x488d94?_0x488d94['id']:null,_0x488d94?_0x488d94[_0xe606('0xa')]:null,_0x488d94?_0x488d94[_0xe606('0xb')]:null,getInteractionId(_0x46b70a,_0x3d4078,_0x1dbb8b),_0x46b70a?JSON[_0xe606('0xc')](_0x46b70a):_0xe606('0xd'));}function updateUser(_0x29d1eb,_0x499837,_0x5c9d29,_0x4b4f16,_0xcc943f){db[_[_0xe606('0x4')](_0x4b4f16)+_0xe606('0xe')]['findOne']({'where':{'id':getInteractionId(_0x499837,_0x5c9d29,_0x4b4f16)}})[_0xe606('0xf')](function(_0x568f55){if(_0x568f55){return _0x568f55[_0xe606('0x10')]({'UserId':_0x29d1eb?_0x29d1eb['id']:null});}})['then'](function(_0x11a963){if(_0x11a963){log(_0xe606('0x11'),_0x29d1eb,_0x499837,_0x5c9d29,_0x4b4f16,_0xcc943f);}})[_0xe606('0x12')](function(){log('error',_0x29d1eb,_0x499837,_0x5c9d29,_0x4b4f16,_0xcc943f);});}exports[_0xe606('0x13')]=function(_0x21cfb4,_0x2797e0){return function(_0x48a1a7,_0x487b1f,_0x12db8c){var _0x4e408c=_0x48a1a7[_0xe606('0x14')];var _0xf319f={};var _0x3ee3f9=_0x48a1a7[_0xe606('0x15')];if(_0xf319f){_0xf319f=_[_0xe606('0x16')](_0x48a1a7['body']);_0xf319f=_['omit'](_0xf319f,[_0xe606('0x17'),_0xe606('0x18'),_0xe606('0x19'),_0xe606('0x1a'),_0xe606('0x1b')]);}updateUser(_0x4e408c,_0xf319f,_0x3ee3f9,_0x21cfb4,_0x2797e0);_0x12db8c(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index e9f90f0..004e763 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 _0x278e=['user','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','final','utf8','hasOwnProperty','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x278e,0x6f));var _0xe278=function(_0x52d8d9,_0x289741){_0x52d8d9=_0x52d8d9-0x0;var _0x5eb0ca=_0x278e[_0x52d8d9];return _0x5eb0ca;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0xe278('0x0'));var db=require(_0xe278('0x1'))['db'];var config=require(_0xe278('0x2'));function getValueFromLicense(_0x28fb5f,_0x2841d5){if(_0x28fb5f&&_0x2841d5){if(_0x2841d5[_0xe278('0x3')]&&_0x2841d5['license']){var _0x2b545f=_0x2841d5['data1'];var _0x240c05=_0x2841d5[_0xe278('0x4')];var _0x2d0431=_0x2b545f['split']('-')[0x4];var _0x193a6e=_0x2b545f[_0xe278('0x5')]('-')[0x0];var _0x2d8913=crypto[_0xe278('0x6')]('aes-256-ctr',util[_0xe278('0x7')](_0xe278('0x8'),_0x2d0431,_0x2b545f,_0x193a6e));var _0x16a2b6=_0x2d8913['update'](_0x240c05,'base64','utf8');_0x16a2b6+=_0x2d8913[_0xe278('0x9')](_0xe278('0xa'));var _0x348c75=JSON['parse'](_0x16a2b6);return _0x348c75[_0xe278('0xb')](_0x28fb5f)?_0x348c75[_0x28fb5f]:null;}}return null;}function isLimit(_0x73c348,_0xd9aba,_0x6ff890,_0x51cfe2){var _0x1eec8a=_0xd9aba;return compose()['use'](function(_0x9a659c,_0x3c677a,_0x2fcdcf){return db[_0xe278('0xc')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1e3d94){var _0x88abec=getValueFromLicense(_0x73c348,_0x1e3d94);return _0x88abec?_0x88abec:_0x1eec8a;})[_0xe278('0xd')](function(_0x4f153c){_0x1eec8a=_0x4f153c;return _0x6ff890[_0xe278('0xe')](_0x51cfe2);})[_0xe278('0xd')](function(_0x353f62){if(_0x353f62>=_0x1eec8a){return _0x3c677a[_0xe278('0xf')](0x193)[_0xe278('0x10')]({'message':util[_0xe278('0x7')](_0xe278('0x11'),_0x73c348)});}_0x2fcdcf();})[_0xe278('0x12')](function(_0x314b41){_0x2fcdcf(_0x314b41);});});}function isUserLimit(){return isLimit(_0xe278('0x13'),0x1,db[_0xe278('0x14')],{'where':{'$or':[{'role':'admin'},{'role':_0xe278('0x15')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x4890=['crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit'];(function(_0x46d1f0,_0x2b7073){var _0x37cf20=function(_0x2f47ac){while(--_0x2f47ac){_0x46d1f0['push'](_0x46d1f0['shift']());}};_0x37cf20(++_0x2b7073);}(_0x4890,0x87));var _0x0489=function(_0x44d869,_0x49425f){_0x44d869=_0x44d869-0x0;var _0x1ed521=_0x4890[_0x44d869];return _0x1ed521;};'use strict';var crypto=require(_0x0489('0x0'));var util=require(_0x0489('0x1'));var compose=require(_0x0489('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x0489('0x3'));function getValueFromLicense(_0x13741a,_0xd99470){if(_0x13741a&&_0xd99470){if(_0xd99470[_0x0489('0x4')]&&_0xd99470[_0x0489('0x5')]){var _0x4cdd9e=_0xd99470[_0x0489('0x4')];var _0x3f2b99=_0xd99470[_0x0489('0x5')];var _0x2c4a90=_0x4cdd9e[_0x0489('0x6')]('-')[0x4];var _0x3a95e4=_0x4cdd9e['split']('-')[0x0];var _0x1fbdf9=crypto[_0x0489('0x7')](_0x0489('0x8'),util[_0x0489('0x9')](_0x0489('0xa'),_0x2c4a90,_0x4cdd9e,_0x3a95e4));var _0x16455a=_0x1fbdf9['update'](_0x3f2b99,_0x0489('0xb'),_0x0489('0xc'));_0x16455a+=_0x1fbdf9[_0x0489('0xd')](_0x0489('0xc'));var _0x277d67=JSON['parse'](_0x16455a);return _0x277d67['hasOwnProperty'](_0x13741a)?_0x277d67[_0x13741a]:null;}}return null;}function isLimit(_0x2d5d46,_0x452fcf,_0xb95371,_0x46ce4c){var _0x5b1940=_0x452fcf;return compose()['use'](function(_0x2b2a88,_0x41ae8f,_0x23e876){return db[_0x0489('0xe')][_0x0489('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x0489('0x10')](function(_0x52e962){var _0x5ced9d=getValueFromLicense(_0x2d5d46,_0x52e962);return _0x5ced9d?_0x5ced9d:_0x5b1940;})[_0x0489('0x10')](function(_0x504787){_0x5b1940=_0x504787;return _0xb95371[_0x0489('0x11')](_0x46ce4c);})['then'](function(_0x192a87){if(_0x192a87>=_0x5b1940){return _0x41ae8f[_0x0489('0x12')](0x193)[_0x0489('0x13')]({'message':util['format'](_0x0489('0x14'),_0x2d5d46)});}_0x23e876();})[_0x0489('0x15')](function(_0x4e44ba){_0x23e876(_0x4e44ba);});});}function isUserLimit(){return isLimit(_0x0489('0x16'),0x1,db[_0x0489('0x17')],{'where':{'$or':[{'role':_0x0489('0x18')},{'role':_0x0489('0x19')}]}});}exports[_0x0489('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 0c6f817..b22ca5c 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 _0x7591=['startsWith','[$or]','and','replace','length','slice','forEach','split','match','indexOf','map','conditions','buildExpression','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','hours','lodash','moment','sqlOperator'];(function(_0xf8c126,_0x29c545){var _0x2575e6=function(_0x40d054){while(--_0x40d054){_0xf8c126['push'](_0xf8c126['shift']());}};_0x2575e6(++_0x29c545);}(_0x7591,0xcd));var _0x1759=function(_0x457c05,_0x8d10fa){_0x457c05=_0x457c05-0x0;var _0x312d9a=_0x7591[_0x457c05];return _0x312d9a;};'use strict';var _=require(_0x1759('0x0'));var moment=require(_0x1759('0x1'));exports['parseSearch']=function(_0x1913be){var _0x2568be={'conditions':[]};_0x2568be[_0x1759('0x2')]=_[_0x1759('0x3')](_0x1913be,_0x1759('0x4'))?'or':_0x1759('0x5');var _0x599eae=_0x1913be['replace']('[$and]','')[_0x1759('0x6')]('[$or]','')['split']('||');for(var _0x2ecce1=0x0;_0x2ecce1<_0x599eae[_0x1759('0x7')];_0x2ecce1++){var _0x5c505b=_0x599eae[_0x2ecce1]['split'](':=');var _0x48bb87=_0x5c505b[0x0];var _0x58873d=_0x5c505b[_0x1759('0x8')](0x1);_0x58873d[_0x1759('0x9')](function(_0x1c578d){var _0x4edbce=_0x1c578d[_0x1759('0xa')]('[')['shift']();var _0x2a62db=_0x1c578d[_0x1759('0xb')](/\[(.*?)\]/g);_0x2a62db[_0x1759('0x9')](function(_0x3dedd3){var _0x56954e=_0x3dedd3['split']('[')['filter'](function(_0x34f61e){return _0x34f61e[_0x1759('0xc')](']')>-0x1;})[_0x1759('0xd')](function(_0x5c8a66){return _0x5c8a66[_0x1759('0xa')](']')[0x0];})[0x0];_0x2568be[_0x1759('0xe')]['push']({'field':_0x48bb87,'operator':_0x4edbce,'value':_0x56954e});});});}return _0x2568be;};exports[_0x1759('0xf')]=function(_0xbd0685,_0x540e50,_0x354390){var _0x9a0599={};if(_0x540e50==='DATE'){if(_0x354390[_0x1759('0x10')]===_0x1759('0x11')){_0x354390[_0x1759('0x10')]=_0x1759('0x12');_0x354390[_0x1759('0x13')]+=','+_0x354390[_0x1759('0x13')];}else if(_['includes']([_0x1759('0x14'),_0x1759('0x15')],_0x354390[_0x1759('0x10')])){_0x354390['value']=moment(_0x354390[_0x1759('0x13')])[_0x1759('0x16')](0x1,_0x1759('0x17'))[_0x1759('0x18')](_0x1759('0x19'));}}if(_0x354390['castTo']){_0x540e50=_0x354390[_0x1759('0x1a')];_0x9a0599[_0x1759('0x1b')]=_0x1759('0x1c')+_0xbd0685+'.'+_0x354390[_0x1759('0x1d')]+_0x1759('0x1e')+_0x354390[_0x1759('0x1a')]+')\x20'+parseOperator(_0x354390[_0x1759('0x10')]);}else{_0x9a0599[_0x1759('0x1b')]=_0xbd0685+'.'+_0x354390[_0x1759('0x1d')]+'\x20'+parseOperator(_0x354390[_0x1759('0x10')]);}if(_[_0x1759('0x1f')]([_0x1759('0x20'),'$notIn'],_0x354390[_0x1759('0x10')]))_0x9a0599[_0x1759('0x1b')]='('+_0x9a0599['text']+_0x1759('0x21')+_0xbd0685+'.'+_0x354390[_0x1759('0x1d')]+_0x1759('0x22');_0x9a0599['value']=parseValue(_0x540e50,_0x354390['operator'],_0x354390['value']);return _0x9a0599;};function parseOperator(_0x4d62d3){var _0x49368b;switch(_0x4d62d3){case _0x1759('0x23'):_0x49368b=_0x1759('0x24');break;case _0x1759('0x25'):_0x49368b=_0x1759('0x26');break;case _0x1759('0x11'):_0x49368b='=\x20?';break;case _0x1759('0x20'):_0x49368b='<>\x20?';break;case _0x1759('0x27'):case _0x1759('0x28'):case _0x1759('0x29'):_0x49368b=_0x1759('0x2a');break;case _0x1759('0x2b'):_0x49368b='<\x20?';break;case _0x1759('0x14'):_0x49368b='>\x20?';break;case'$lte':_0x49368b=_0x1759('0x2c');break;case'$gte':_0x49368b=_0x1759('0x2d');break;case _0x1759('0x12'):_0x49368b=_0x1759('0x2e');break;}return _0x49368b;}function parseValue(_0x3c55e5,_0x4e4779,_0x125c0a){var _0x47414f={'start':undefined,'end':undefined};switch(_0x4e4779){case'$in':case'$notIn':_0x47414f[_0x1759('0x2f')]=_0x125c0a['split'](',');break;case _0x1759('0x27'):_0x47414f[_0x1759('0x2f')]='%'+_0x125c0a+'%';break;case _0x1759('0x28'):_0x47414f['start']=_0x125c0a+'%';break;case _0x1759('0x29'):_0x47414f[_0x1759('0x2f')]='%'+_0x125c0a;break;case _0x1759('0x12'):var _0x9facb4=_0x125c0a[_0x1759('0xa')](',');var _0x125c0a=_0x9facb4['shift']();var _0x4ab761=_0x9facb4[_0x1759('0x30')]();if(_0x3c55e5===_0x1759('0x31')){_0x125c0a=moment(_0x125c0a)['utcOffset'](0x0,!![])[_0x1759('0x18')]();_0x4ab761=moment(_0x4ab761)[_0x1759('0x32')](0x0,!![])[_0x1759('0x16')](0x17,_0x1759('0x33'))['add'](0x3b,'minutes')[_0x1759('0x16')](0x3b,'seconds')[_0x1759('0x18')]();}_0x47414f={'start':_0x125c0a,'end':_0x4ab761};break;default:_0x47414f['start']=_0x125c0a;break;}return _0x47414f;} \ No newline at end of file +var _0x6717=['$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','hours','minutes','seconds','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','indexOf','map','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?'];(function(_0x5a970d,_0x5a6937){var _0x2431ce=function(_0xce1557){while(--_0xce1557){_0x5a970d['push'](_0x5a970d['shift']());}};_0x2431ce(++_0x5a6937);}(_0x6717,0xea));var _0x7671=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6717[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0x4ff0c8){var _0x56c639={'conditions':[]};_0x56c639['sqlOperator']=_[_0x7671('0x0')](_0x4ff0c8,_0x7671('0x1'))?'or':_0x7671('0x2');var _0x45c73c=_0x4ff0c8[_0x7671('0x3')](_0x7671('0x4'),'')[_0x7671('0x3')]('[$or]','')[_0x7671('0x5')]('||');for(var _0x46a067=0x0;_0x46a067<_0x45c73c[_0x7671('0x6')];_0x46a067++){var _0x19972b=_0x45c73c[_0x46a067][_0x7671('0x5')](':=');var _0x443d1a=_0x19972b[0x0];var _0x3549a4=_0x19972b[_0x7671('0x7')](0x1);_0x3549a4[_0x7671('0x8')](function(_0x571901){var _0x2fc7c8=_0x571901['split']('[')[_0x7671('0x9')]();var _0x573558=_0x571901[_0x7671('0xa')](/\[(.*?)\]/g);_0x573558[_0x7671('0x8')](function(_0x362a1d){var _0x14ecdf=_0x362a1d[_0x7671('0x5')]('[')['filter'](function(_0x4b03c){return _0x4b03c[_0x7671('0xb')](']')>-0x1;})[_0x7671('0xc')](function(_0x590af0){return _0x590af0[_0x7671('0x5')](']')[0x0];})[0x0];_0x56c639['conditions'][_0x7671('0xd')]({'field':_0x443d1a,'operator':_0x2fc7c8,'value':_0x14ecdf});});});}return _0x56c639;};exports[_0x7671('0xe')]=function(_0x1d2bf6,_0x145689,_0x355b2c){var _0x45a844={};if(_0x145689===_0x7671('0xf')){if(_0x355b2c[_0x7671('0x10')]===_0x7671('0x11')){_0x355b2c[_0x7671('0x10')]=_0x7671('0x12');_0x355b2c['value']+=','+_0x355b2c[_0x7671('0x13')];}else if(_['includes']([_0x7671('0x14'),_0x7671('0x15')],_0x355b2c[_0x7671('0x10')])){_0x355b2c[_0x7671('0x13')]=moment(_0x355b2c['value'])[_0x7671('0x16')](0x1,_0x7671('0x17'))[_0x7671('0x18')](_0x7671('0x19'));}}if(_0x355b2c[_0x7671('0x1a')]){_0x145689=_0x355b2c[_0x7671('0x1a')];_0x45a844[_0x7671('0x1b')]=_0x7671('0x1c')+_0x1d2bf6+'.'+_0x355b2c[_0x7671('0x1d')]+_0x7671('0x1e')+_0x355b2c[_0x7671('0x1a')]+')\x20'+parseOperator(_0x355b2c[_0x7671('0x10')]);}else{_0x45a844['text']=_0x1d2bf6+'.'+_0x355b2c['field']+'\x20'+parseOperator(_0x355b2c[_0x7671('0x10')]);}if(_[_0x7671('0x1f')]([_0x7671('0x20'),_0x7671('0x21')],_0x355b2c[_0x7671('0x10')]))_0x45a844[_0x7671('0x1b')]='('+_0x45a844[_0x7671('0x1b')]+'\x20OR\x20'+_0x1d2bf6+'.'+_0x355b2c[_0x7671('0x1d')]+'\x20IS\x20NULL)';_0x45a844[_0x7671('0x13')]=parseValue(_0x145689,_0x355b2c['operator'],_0x355b2c[_0x7671('0x13')]);return _0x45a844;};function parseOperator(_0x30f55c){var _0x5b5265;switch(_0x30f55c){case _0x7671('0x22'):_0x5b5265=_0x7671('0x23');break;case _0x7671('0x21'):_0x5b5265='NOT\x20IN\x20?';break;case _0x7671('0x11'):_0x5b5265=_0x7671('0x24');break;case _0x7671('0x20'):_0x5b5265=_0x7671('0x25');break;case _0x7671('0x26'):case _0x7671('0x27'):case'$endsWith':_0x5b5265=_0x7671('0x28');break;case _0x7671('0x29'):_0x5b5265=_0x7671('0x2a');break;case _0x7671('0x14'):_0x5b5265=_0x7671('0x2b');break;case'$lte':_0x5b5265=_0x7671('0x2c');break;case _0x7671('0x2d'):_0x5b5265=_0x7671('0x2e');break;case _0x7671('0x12'):_0x5b5265=_0x7671('0x2f');break;}return _0x5b5265;}function parseValue(_0x40b798,_0x7409a5,_0x36d5cc){var _0x472020={'start':undefined,'end':undefined};switch(_0x7409a5){case _0x7671('0x22'):case'$notIn':_0x472020[_0x7671('0x30')]=_0x36d5cc['split'](',');break;case _0x7671('0x26'):_0x472020['start']='%'+_0x36d5cc+'%';break;case _0x7671('0x27'):_0x472020[_0x7671('0x30')]=_0x36d5cc+'%';break;case _0x7671('0x31'):_0x472020[_0x7671('0x30')]='%'+_0x36d5cc;break;case'$between':var _0x18e376=_0x36d5cc[_0x7671('0x5')](',');var _0x36d5cc=_0x18e376[_0x7671('0x9')]();var _0x2e24b7=_0x18e376[_0x7671('0x32')]();if(_0x40b798===_0x7671('0xf')){_0x36d5cc=moment(_0x36d5cc)['utcOffset'](0x0,!![])[_0x7671('0x18')]();_0x2e24b7=moment(_0x2e24b7)[_0x7671('0x33')](0x0,!![])[_0x7671('0x16')](0x17,_0x7671('0x34'))[_0x7671('0x16')](0x3b,_0x7671('0x35'))[_0x7671('0x16')](0x3b,_0x7671('0x36'))[_0x7671('0x18')]();}_0x472020={'start':_0x36d5cc,'end':_0x2e24b7};break;default:_0x472020[_0x7671('0x30')]=_0x36d5cc;break;}return _0x472020;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 02937c1..312c83c 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 _0xee41=['push','getOptions','query','$id','model','keys','intersection','attributes','nolimit','pick','filter','where','lower','merge','options','lodash','sequelize','moment','parse','includes','fields','split','filters','isEmpty','find','type','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','limit','offset','map','indexOf','priority','cast','col','substr','DESC','unsigned','ASC','omit','isArray','length','isString','isNumeric','match','getFullTextValue','forEach','replace'];(function(_0x1f7092,_0x3917d9){var _0x401872=function(_0x2d228e){while(--_0x2d228e){_0x1f7092['push'](_0x1f7092['shift']());}};_0x401872(++_0x3917d9);}(_0xee41,0x7b));var _0x1ee4=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0xee41[_0x3ceb54];return _0x26d8a6;};'use strict';var _=require(_0x1ee4('0x0'));var sequelize=require(_0x1ee4('0x1'));var moment=require(_0x1ee4('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4b6a1d){var _0x2abdae=['ne'];try{var _0x42259b=JSON[_0x1ee4('0x3')](_0x4b6a1d);var _0x5457ea=Object['keys'](_0x42259b)[0x0];return _0x2abdae[_0x1ee4('0x4')](_0x5457ea);}catch(_0x47b377){return![];}}function getOperatorValue(_0x200ed9){var _0x2ff66c=JSON[_0x1ee4('0x3')](_0x200ed9);var _0x145ac1=Object['keys'](_0x2ff66c)[0x0];var _0x242f2f=_0x2ff66c[_0x145ac1];return{['$'+_0x145ac1]:_0x242f2f};}exports[_0x1ee4('0x5')]=function(_0x4d10f5){var _0x30285c=null;if(_0x4d10f5){_0x30285c=_0x4d10f5[_0x1ee4('0x6')](',');}return _0x30285c;};exports[_0x1ee4('0x7')]=function(_0x10fa8f,_0x37dcd9){var _0x3241ba={};if(!_[_0x1ee4('0x8')](_0x10fa8f)){_['forOwn'](_0x10fa8f,function(_0x9963f4,_0x1c38f4){try{if(_0x37dcd9){var _0xea4ae7=_[_0x1ee4('0x9')](_0x37dcd9,{'name':_0x1c38f4})||{};if(hasSequelizeOperator(_0x9963f4)){_0x3241ba[_0x1c38f4]=getOperatorValue(_0x9963f4);}else if(_0xea4ae7[_0x1ee4('0xa')]==='DATE'&&_[_0x1ee4('0xb')](_0x9963f4)){var _0x4424ac=JSON['parse'](_0x9963f4);var _0x1b2cd5={'$gte':moment(moment(_0x4424ac[_0x1ee4('0xc')])['format'](_0x1ee4('0xd')))[_0x1ee4('0xe')]()[_0x1ee4('0xf')](),'$lte':moment(moment(_0x4424ac['$lte'])[_0x1ee4('0xf')](_0x1ee4('0xd')))[_0x1ee4('0xe')]()[_0x1ee4('0x10')](0x1,'s')[_0x1ee4('0xf')]()};_0x3241ba[_0x1c38f4]=_0x1b2cd5;}else if(_0xea4ae7[_0x1ee4('0x11')]===_0x1ee4('0x12')){_0x3241ba[_0x1c38f4]=_0x9963f4;}else{_0x3241ba[_0x1c38f4]=_['isArray'](_0x9963f4)?_0x9963f4:JSON[_0x1ee4('0x3')](_0x9963f4);}}else{_0x3241ba[_0x1c38f4]=_['isArray'](_0x9963f4)?_0x9963f4:JSON[_0x1ee4('0x3')](_0x9963f4);}}catch(_0x40314b){_0x3241ba[_0x1c38f4]=_0x9963f4[_0x1ee4('0x6')](',');}});}return _0x3241ba;};exports[_0x1ee4('0x13')]=function(_0x8844f){_0x8844f=parseInt(_0x8844f,0xa);if(!_0x8844f||_0x8844f<0x0){_0x8844f=LIMIT_VALUE;}return _0x8844f;};exports[_0x1ee4('0x14')]=function(_0x4b1b92){_0x4b1b92=parseInt(_0x4b1b92,0xa);if(!_0x4b1b92||_0x4b1b92<0x0){_0x4b1b92=0x0;}return _0x4b1b92;};exports['sort']=function(_0x1c1385){var _0x4d63af,_0x575d86=null;if(_0x1c1385){_0x4d63af=_0x1c1385['split'](',');_0x575d86=_[_0x1ee4('0x15')](_0x4d63af,function(_0x271c44){if(_0x271c44[_0x1ee4('0x16')]('-')===0x0){return[_0x271c44===_0x1ee4('0x17')?sequelize[_0x1ee4('0x18')](sequelize[_0x1ee4('0x19')](_0x1ee4('0x17')),'unsigned'):_0x271c44[_0x1ee4('0x1a')](0x1),_0x1ee4('0x1b')];}else{return[_0x271c44===_0x1ee4('0x17')?sequelize[_0x1ee4('0x18')](sequelize[_0x1ee4('0x19')](_0x1ee4('0x17')),_0x1ee4('0x1c')):_0x271c44,_0x1ee4('0x1d')];}});}return _0x575d86;};exports[_0x1ee4('0x1e')]=function(_0x55babf,_0x1aca32){if(_[_0x1ee4('0x8')](_0x55babf)){return _0x55babf;}if(_[_0x1ee4('0x1f')](_0x55babf)){for(var _0x5563c0=0x0;_0x5563c0<_0x55babf[_0x1ee4('0x20')];_0x5563c0+=0x1){_0x55babf[_0x5563c0]=this[_0x1ee4('0x1e')](_0x55babf[_0x5563c0],_0x1aca32);}return _0x55babf;}if(!_['isObject'](_0x55babf)){return _0x55babf;}if(_[_0x1ee4('0x21')](_0x1aca32)){_0x1aca32=[_0x1aca32];}if(!_[_0x1ee4('0x1f')](_0x1aca32)){return _0x55babf;}for(var _0x4e073e=0x0;_0x4e073e<_0x1aca32['length'];_0x4e073e+=0x1){_['unset'](_0x55babf,_0x1aca32[_0x4e073e]);}for(var _0x53b1cb in _0x55babf){if(_0x55babf['hasOwnProperty'](_0x53b1cb)){_0x55babf[_0x53b1cb]=this['omit'](_0x55babf[_0x53b1cb],_0x1aca32);}}return _0x55babf;};exports[_0x1ee4('0x22')]=function(_0x4f2a53){return _0x4f2a53[_0x1ee4('0x23')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x4fe024){return _0x4fe024[_0x1ee4('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x1ee4('0x24')]=function(_0x1419b3){var _0x3c3e9a=[];_0x1419b3[_0x1ee4('0x6')](/[ ,]+/)[_0x1ee4('0x25')](function(_0x1c0a99){_0x1c0a99=_0x1c0a99[_0x1ee4('0x26')](/([^:]")"+/g,'$1');_0x1c0a99='+'+_0x1c0a99+'*';if(_0x1c0a99['includes']('@'))_0x1c0a99='\x22'+_0x1c0a99+'\x22';_0x3c3e9a[_0x1ee4('0x27')](_0x1c0a99);});return _0x3c3e9a['join']('\x20');};exports[_0x1ee4('0x28')]=function(_0x58a6da,_0x4dcebb,_0x392043){var _0x106d1b={},_0x552798={};if(_0x4dcebb[_0x1ee4('0x29')]['$id']){_0x4dcebb['query']['id']=_0x4dcebb[_0x1ee4('0x29')][_0x1ee4('0x2a')];delete _0x4dcebb[_0x1ee4('0x29')][_0x1ee4('0x2a')];}_0x106d1b[_0x1ee4('0x2b')]=_['map'](_0x58a6da,_0x1ee4('0x11'));_0x106d1b['query']=_[_0x1ee4('0x2c')](_0x4dcebb['query']);_0x106d1b[_0x1ee4('0x7')]=_[_0x1ee4('0x2d')](_0x106d1b[_0x1ee4('0x2b')],_0x106d1b[_0x1ee4('0x29')]);_0x552798[_0x1ee4('0x2e')]=_['intersection'](_0x106d1b[_0x1ee4('0x2b')],this[_0x1ee4('0x5')](_0x4dcebb[_0x1ee4('0x29')]['fields']));_0x552798[_0x1ee4('0x2e')]=_0x552798[_0x1ee4('0x2e')]['length']?_0x552798['attributes']:_0x106d1b['model'];if(!_0x4dcebb[_0x1ee4('0x29')]['hasOwnProperty'](_0x1ee4('0x2f'))){_0x552798[_0x1ee4('0x13')]=this[_0x1ee4('0x13')](_0x4dcebb[_0x1ee4('0x29')][_0x1ee4('0x13')]);_0x552798[_0x1ee4('0x14')]=this[_0x1ee4('0x14')](_0x4dcebb[_0x1ee4('0x29')][_0x1ee4('0x14')]);}_0x552798['order']=this['sort'](_0x4dcebb[_0x1ee4('0x29')]['sort']);_0x552798['where']=this[_0x1ee4('0x7')](_[_0x1ee4('0x30')](_0x4dcebb[_0x1ee4('0x29')],_0x106d1b[_0x1ee4('0x7')]),_0x58a6da);if(_0x4dcebb[_0x1ee4('0x29')][_0x1ee4('0x31')]){_0x552798[_0x1ee4('0x32')]=_['merge'](_0x552798[_0x1ee4('0x32')],{'$or':_[_0x1ee4('0x15')](_0x58a6da,function(_0x65e1fa){if(_0x65e1fa[_0x1ee4('0xa')]!=='VIRTUAL'){if(_0x392043){return sequelize[_0x1ee4('0x32')](sequelize['fn'](_0x1ee4('0x33'),sequelize[_0x1ee4('0x19')](_0x65e1fa[_0x1ee4('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x4dcebb['query'][_0x1ee4('0x31')]+'%')});}else{var _0x52565f={};_0x52565f[_0x65e1fa['name']]={'$like':'%'+_0x4dcebb[_0x1ee4('0x29')][_0x1ee4('0x31')]+'%'};return _0x52565f;}}})});}_0x552798=_[_0x1ee4('0x34')]({},_0x552798,_0x4dcebb[_0x1ee4('0x35')]);return _0x552798;}; \ No newline at end of file +var _0x0819=['DATE','$gte','YYYY-MM-DD','format','$lte','subtract','name','isArray','split','limit','offset','sort','map','priority','cast','unsigned','substr','DESC','col','ASC','omit','length','isString','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace','includes','push','getOptions','query','$id','intersection','model','attributes','nolimit','order','where','pick','filter','merge','VIRTUAL','lower','options','parse','keys','fields','filters','isEmpty','forOwn','find','type'];(function(_0x521b48,_0x5f1de5){var _0x4b20ac=function(_0x2909ef){while(--_0x2909ef){_0x521b48['push'](_0x521b48['shift']());}};_0x4b20ac(++_0x5f1de5);}(_0x0819,0x66));var _0x9081=function(_0x34a688,_0x188b21){_0x34a688=_0x34a688-0x0;var _0x544473=_0x0819[_0x34a688];return _0x544473;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x677e58){var _0x35d209=['ne'];try{var _0x392dfd=JSON[_0x9081('0x0')](_0x677e58);var _0x224f00=Object[_0x9081('0x1')](_0x392dfd)[0x0];return _0x35d209['includes'](_0x224f00);}catch(_0x48c064){return![];}}function getOperatorValue(_0x147e0){var _0x48c01b=JSON[_0x9081('0x0')](_0x147e0);var _0x146359=Object[_0x9081('0x1')](_0x48c01b)[0x0];var _0x60d808=_0x48c01b[_0x146359];return{['$'+_0x146359]:_0x60d808};}exports[_0x9081('0x2')]=function(_0x552a97){var _0x1634d3=null;if(_0x552a97){_0x1634d3=_0x552a97['split'](',');}return _0x1634d3;};exports[_0x9081('0x3')]=function(_0x79dafc,_0x5a7dfd){var _0x402b83={};if(!_[_0x9081('0x4')](_0x79dafc)){_[_0x9081('0x5')](_0x79dafc,function(_0x871fad,_0x1dd464){try{if(_0x5a7dfd){var _0x167c22=_[_0x9081('0x6')](_0x5a7dfd,{'name':_0x1dd464})||{};if(hasSequelizeOperator(_0x871fad)){_0x402b83[_0x1dd464]=getOperatorValue(_0x871fad);}else if(_0x167c22[_0x9081('0x7')]===_0x9081('0x8')&&_['isPlainObject'](_0x871fad)){var _0x15a2fd=JSON[_0x9081('0x0')](_0x871fad);var _0x290245={'$gte':moment(moment(_0x15a2fd[_0x9081('0x9')])['format'](_0x9081('0xa')))['utc']()[_0x9081('0xb')](),'$lte':moment(moment(_0x15a2fd[_0x9081('0xc')])['format'](_0x9081('0xa')))['utc']()[_0x9081('0xd')](0x1,'s')['format']()};_0x402b83[_0x1dd464]=_0x290245;}else if(_0x167c22[_0x9081('0xe')]==='uniqueid'){_0x402b83[_0x1dd464]=_0x871fad;}else{_0x402b83[_0x1dd464]=_[_0x9081('0xf')](_0x871fad)?_0x871fad:JSON['parse'](_0x871fad);}}else{_0x402b83[_0x1dd464]=_[_0x9081('0xf')](_0x871fad)?_0x871fad:JSON['parse'](_0x871fad);}}catch(_0x38398b){_0x402b83[_0x1dd464]=_0x871fad[_0x9081('0x10')](',');}});}return _0x402b83;};exports[_0x9081('0x11')]=function(_0x2776f6){_0x2776f6=parseInt(_0x2776f6,0xa);if(!_0x2776f6||_0x2776f6<0x0){_0x2776f6=LIMIT_VALUE;}return _0x2776f6;};exports[_0x9081('0x12')]=function(_0x345b25){_0x345b25=parseInt(_0x345b25,0xa);if(!_0x345b25||_0x345b25<0x0){_0x345b25=0x0;}return _0x345b25;};exports[_0x9081('0x13')]=function(_0x15b9b1){var _0x43ff3f,_0x47a9bd=null;if(_0x15b9b1){_0x43ff3f=_0x15b9b1[_0x9081('0x10')](',');_0x47a9bd=_[_0x9081('0x14')](_0x43ff3f,function(_0x38844d){if(_0x38844d['indexOf']('-')===0x0){return[_0x38844d===_0x9081('0x15')?sequelize[_0x9081('0x16')](sequelize['col'](_0x9081('0x15')),_0x9081('0x17')):_0x38844d[_0x9081('0x18')](0x1),_0x9081('0x19')];}else{return[_0x38844d===_0x9081('0x15')?sequelize[_0x9081('0x16')](sequelize[_0x9081('0x1a')](_0x9081('0x15')),_0x9081('0x17')):_0x38844d,_0x9081('0x1b')];}});}return _0x47a9bd;};exports[_0x9081('0x1c')]=function(_0x8d9935,_0x36827a){if(_['isEmpty'](_0x8d9935)){return _0x8d9935;}if(_[_0x9081('0xf')](_0x8d9935)){for(var _0xe22206=0x0;_0xe22206<_0x8d9935[_0x9081('0x1d')];_0xe22206+=0x1){_0x8d9935[_0xe22206]=this['omit'](_0x8d9935[_0xe22206],_0x36827a);}return _0x8d9935;}if(!_['isObject'](_0x8d9935)){return _0x8d9935;}if(_[_0x9081('0x1e')](_0x36827a)){_0x36827a=[_0x36827a];}if(!_['isArray'](_0x36827a)){return _0x8d9935;}for(var _0x53b989=0x0;_0x53b989<_0x36827a[_0x9081('0x1d')];_0x53b989+=0x1){_['unset'](_0x8d9935,_0x36827a[_0x53b989]);}for(var _0x47ab03 in _0x8d9935){if(_0x8d9935[_0x9081('0x1f')](_0x47ab03)){_0x8d9935[_0x47ab03]=this[_0x9081('0x1c')](_0x8d9935[_0x47ab03],_0x36827a);}}return _0x8d9935;};exports[_0x9081('0x20')]=function(_0xd4d272){return _0xd4d272[_0x9081('0x21')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x9081('0x22')]=function(_0x1cdb89){return _0x1cdb89['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x9081('0x23')]=function(_0x48274e){var _0x1ff518=[];_0x48274e['split'](/[ ,]+/)[_0x9081('0x24')](function(_0x27bb2d){_0x27bb2d=_0x27bb2d[_0x9081('0x25')](/([^:]")"+/g,'$1');_0x27bb2d='+'+_0x27bb2d+'*';if(_0x27bb2d[_0x9081('0x26')]('@'))_0x27bb2d='\x22'+_0x27bb2d+'\x22';_0x1ff518[_0x9081('0x27')](_0x27bb2d);});return _0x1ff518['join']('\x20');};exports[_0x9081('0x28')]=function(_0x5e4de2,_0x5c171f,_0x236e30){var _0x3c89d3={},_0x4c0768={};if(_0x5c171f[_0x9081('0x29')][_0x9081('0x2a')]){_0x5c171f[_0x9081('0x29')]['id']=_0x5c171f['query'][_0x9081('0x2a')];delete _0x5c171f[_0x9081('0x29')][_0x9081('0x2a')];}_0x3c89d3['model']=_['map'](_0x5e4de2,_0x9081('0xe'));_0x3c89d3[_0x9081('0x29')]=_[_0x9081('0x1')](_0x5c171f[_0x9081('0x29')]);_0x3c89d3[_0x9081('0x3')]=_[_0x9081('0x2b')](_0x3c89d3[_0x9081('0x2c')],_0x3c89d3['query']);_0x4c0768[_0x9081('0x2d')]=_['intersection'](_0x3c89d3[_0x9081('0x2c')],this[_0x9081('0x2')](_0x5c171f[_0x9081('0x29')]['fields']));_0x4c0768[_0x9081('0x2d')]=_0x4c0768[_0x9081('0x2d')][_0x9081('0x1d')]?_0x4c0768[_0x9081('0x2d')]:_0x3c89d3[_0x9081('0x2c')];if(!_0x5c171f[_0x9081('0x29')][_0x9081('0x1f')](_0x9081('0x2e'))){_0x4c0768[_0x9081('0x11')]=this[_0x9081('0x11')](_0x5c171f[_0x9081('0x29')][_0x9081('0x11')]);_0x4c0768[_0x9081('0x12')]=this[_0x9081('0x12')](_0x5c171f['query'][_0x9081('0x12')]);}_0x4c0768[_0x9081('0x2f')]=this[_0x9081('0x13')](_0x5c171f[_0x9081('0x29')]['sort']);_0x4c0768[_0x9081('0x30')]=this[_0x9081('0x3')](_[_0x9081('0x31')](_0x5c171f[_0x9081('0x29')],_0x3c89d3[_0x9081('0x3')]),_0x5e4de2);if(_0x5c171f['query'][_0x9081('0x32')]){_0x4c0768[_0x9081('0x30')]=_[_0x9081('0x33')](_0x4c0768['where'],{'$or':_[_0x9081('0x14')](_0x5e4de2,function(_0x4596f1){if(_0x4596f1[_0x9081('0x7')]!==_0x9081('0x34')){if(_0x236e30){return sequelize[_0x9081('0x30')](sequelize['fn'](_0x9081('0x35'),sequelize[_0x9081('0x1a')](_0x4596f1[_0x9081('0xe')])),{'$like':sequelize['fn']('lower','%'+_0x5c171f[_0x9081('0x29')][_0x9081('0x32')]+'%')});}else{var _0x13df69={};_0x13df69[_0x4596f1[_0x9081('0xe')]]={'$like':'%'+_0x5c171f['query'][_0x9081('0x32')]+'%'};return _0x13df69;}}})});}_0x4c0768=_[_0x9081('0x33')]({},_0x4c0768,_0x5c171f[_0x9081('0x36')]);return _0x4c0768;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 0e0ed35..034edfe 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ce1=['root','public','development','test','client','use','json\x20replacer','toISOString','split','static','ejs','renderFile','view\x20engine','html','urlencoded','50mb','json','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb','get','env','production','set','appPath','join'];(function(_0x22c84a,_0x250554){var _0xcc2e99=function(_0x10171a){while(--_0x10171a){_0x22c84a['push'](_0x22c84a['shift']());}};_0xcc2e99(++_0x250554);}(_0x7ce1,0xdd));var _0x17ce=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x7ce1[_0x27bd2c];return _0x3784ea;};'use strict';var express=require(_0x17ce('0x0'));var favicon=require(_0x17ce('0x1'));var bodyParser=require(_0x17ce('0x2'));var methodOverride=require(_0x17ce('0x3'));var cookieParser=require(_0x17ce('0x4'));var errorHandler=require(_0x17ce('0x5'));var path=require(_0x17ce('0x6'));var passport=require(_0x17ce('0x7'));var cors=require(_0x17ce('0x8'));var moment=require(_0x17ce('0x9'));var config=require('./environment');var db=require(_0x17ce('0xa'))['db'];exports['default']=function(_0x2ff68b){var _0x4dda82=_0x2ff68b[_0x17ce('0xb')](_0x17ce('0xc'));if(_0x4dda82===_0x17ce('0xd')){_0x2ff68b[_0x17ce('0xe')](_0x17ce('0xf'),path[_0x17ce('0x10')](config[_0x17ce('0x11')],_0x17ce('0x12')));}if(_0x4dda82===_0x17ce('0x13')||_0x4dda82===_0x17ce('0x14')){_0x2ff68b[_0x17ce('0xe')](_0x17ce('0xf'),path[_0x17ce('0x10')](config[_0x17ce('0x11')],_0x17ce('0x15')));_0x2ff68b[_0x17ce('0x16')](errorHandler());}_0x2ff68b[_0x17ce('0xe')](_0x17ce('0x17'),function(_0x19c6e1,_0x521a47){if(this[_0x19c6e1]instanceof Date){_0x521a47=this[_0x19c6e1][_0x17ce('0x18')]()[_0x17ce('0x19')]('.')[0x0]+'Z';}return _0x521a47;});_0x2ff68b['use'](express[_0x17ce('0x1a')](_0x2ff68b['get'](_0x17ce('0xf'))));_0x2ff68b[_0x17ce('0xe')]('views',config[_0x17ce('0x11')]+'/server/views');_0x2ff68b['engine']('html',require(_0x17ce('0x1b'))[_0x17ce('0x1c')]);_0x2ff68b[_0x17ce('0xe')](_0x17ce('0x1d'),_0x17ce('0x1e'));_0x2ff68b[_0x17ce('0x16')](bodyParser[_0x17ce('0x1f')]({'limit':_0x17ce('0x20'),'extended':!![]}));_0x2ff68b[_0x17ce('0x16')](bodyParser[_0x17ce('0x21')]({'limit':_0x17ce('0x20')}));_0x2ff68b[_0x17ce('0x16')](cors());_0x2ff68b[_0x17ce('0x16')](methodOverride());_0x2ff68b[_0x17ce('0x16')](cookieParser());_0x2ff68b[_0x17ce('0x16')](passport['initialize']());}; \ No newline at end of file +var _0x2338=['root','public','test','set','client','use','json\x20replacer','split','static','views','ejs','view\x20engine','urlencoded','50mb','errorhandler','passport','cors','get','production','appPath','join'];(function(_0x4b6515,_0x502a20){var _0x366511=function(_0x35f0f3){while(--_0x35f0f3){_0x4b6515['push'](_0x4b6515['shift']());}};_0x366511(++_0x502a20);}(_0x2338,0x1dc));var _0x8233=function(_0x4882ae,_0x13b957){_0x4882ae=_0x4882ae-0x0;var _0x1972ff=_0x2338[_0x4882ae];return _0x1972ff;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0x8233('0x0'));var path=require('path');var passport=require(_0x8233('0x1'));var cors=require(_0x8233('0x2'));var moment=require('moment');var config=require('./environment');var db=require('../mysqldb')['db'];exports['default']=function(_0xb20980){var _0x536da2=_0xb20980[_0x8233('0x3')]('env');if(_0x536da2===_0x8233('0x4')){_0xb20980['set'](_0x8233('0x5'),path[_0x8233('0x6')](config[_0x8233('0x7')],_0x8233('0x8')));}if(_0x536da2==='development'||_0x536da2===_0x8233('0x9')){_0xb20980[_0x8233('0xa')](_0x8233('0x5'),path[_0x8233('0x6')](config[_0x8233('0x7')],_0x8233('0xb')));_0xb20980[_0x8233('0xc')](errorHandler());}_0xb20980['set'](_0x8233('0xd'),function(_0x12bd19,_0x37d279){if(this[_0x12bd19]instanceof Date){_0x37d279=this[_0x12bd19]['toISOString']()[_0x8233('0xe')]('.')[0x0]+'Z';}return _0x37d279;});_0xb20980[_0x8233('0xc')](express[_0x8233('0xf')](_0xb20980[_0x8233('0x3')]('appPath')));_0xb20980[_0x8233('0xa')](_0x8233('0x10'),config[_0x8233('0x7')]+'/server/views');_0xb20980['engine']('html',require(_0x8233('0x11'))['renderFile']);_0xb20980[_0x8233('0xa')](_0x8233('0x12'),'html');_0xb20980['use'](bodyParser[_0x8233('0x13')]({'limit':_0x8233('0x14'),'extended':!![]}));_0xb20980['use'](bodyParser['json']({'limit':_0x8233('0x14')}));_0xb20980[_0x8233('0xc')](cors());_0xb20980['use'](methodOverride());_0xb20980[_0x8233('0xc')](cookieParser());_0xb20980[_0x8233('0xc')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 5d617e9..77e6bd7 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 _0x551a=['model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','family','IPv4','internal','mac','address','127.0.0.1','getFirstInterface','map'];(function(_0x3d2422,_0x12c582){var _0x4cec16=function(_0x3851d1){while(--_0x3851d1){_0x3d2422['push'](_0x3d2422['shift']());}};_0x4cec16(++_0x12c582);}(_0x551a,0x1aa));var _0xa551=function(_0x4edf1e,_0x10c990){_0x4edf1e=_0x4edf1e-0x0;var _0x4abf1f=_0x551a[_0x4edf1e];return _0x4abf1f;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xa551('0x0'));var machine=require(_0xa551('0x1'));var exec=require(_0xa551('0x2'))[_0xa551('0x3')];var config=require(_0xa551('0x4'));function getInterfaces(){var _0x42cd2e=[];var _0x14b86b=os[_0xa551('0x5')]();var _0x792005=_[_0xa551('0x6')](_['keys'](_0x14b86b));for(var _0x1f1969=0x0;_0x1f1969<_0x792005[_0xa551('0x7')];_0x1f1969++){var _0x3f1f34=_0x14b86b[_0x792005[_0x1f1969]]['filter'](function(_0x37284c){return _0x37284c[_0xa551('0x8')]===_0xa551('0x9')&&_0x37284c[_0xa551('0xa')]===![];});_0x42cd2e=_0x42cd2e['concat'](_0x3f1f34);}return _0x42cd2e;}function getFirstInterface(){var _0x21567a=_['head'](getInterfaces());return{'macAddress':_0x21567a&&_0x21567a['mac']?_0x21567a[_0xa551('0xb')]:'00:00:00:00:00:00','ipAddress':_0x21567a&&_0x21567a[_0xa551('0xc')]?_0x21567a[_0xa551('0xc')]:_0xa551('0xd')};}exports[_0xa551('0xe')]=getFirstInterface;function getCPUhash(){var _0x483a1a=_['orderBy'](os['cpus']()[_0xa551('0xf')](function(_0xf494b0){return _0xf494b0[_0xa551('0x10')];}))[_0xa551('0x11')](':');return crypto[_0xa551('0x12')](_0xa551('0x13'))[_0xa551('0x14')](_0x483a1a)[_0xa551('0x15')](_0xa551('0x16'));}exports[_0xa551('0x17')]=function(){var _0x36c064=os[_0xa551('0x18')]();var _0x31b08a=/[0-9a-f-]{36}/;if(config[_0xa551('0x19')]&&_0x31b08a[_0xa551('0x1a')](config[_0xa551('0x19')])){return config[_0xa551('0x19')];}else if(_0x36c064===_0xa551('0x1b')){return exec(_0xa551('0x1c'),{'encoding':_0xa551('0x1d')})[_0xa551('0x1e')]('\x0d\x0a','');}else{var _0x522a42=getFirstInterface();var _0x188f75=getCPUhash();var _0xfc4cb=_0x188f75+'|'+os['hostname']()+'|'+_0x522a42[_0xa551('0x1f')]+'|'+_0x522a42[_0xa551('0x20')];var _0x43eb5a=crypto[_0xa551('0x12')](_0xa551('0x13'))['update'](_0xfc4cb)[_0xa551('0x15')](_0xa551('0x16'));return _0x43eb5a[_0xa551('0x21')](0x0,0x8)+'-'+_0x43eb5a['substring'](0x8,0xc)+'-'+_0x43eb5a[_0xa551('0x21')](0xc,0x10)+'-'+_0x43eb5a[_0xa551('0x21')](0x10,0x14)+'-'+_0x43eb5a[_0xa551('0x21')](0x14);}}; \ No newline at end of file +var _0xc081=['IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','model','join','createHash','md5','update','digest','hex','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','substring','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','filter','family'];(function(_0x33b49d,_0x5e1ee4){var _0x48bed3=function(_0x50aafd){while(--_0x50aafd){_0x33b49d['push'](_0x33b49d['shift']());}};_0x48bed3(++_0x5e1ee4);}(_0xc081,0x110));var _0x1c08=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xc081[_0x1f71d8];return _0x10b045;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x1c08('0x0'));var machine=require(_0x1c08('0x1'));var exec=require(_0x1c08('0x2'))['execSync'];var config=require(_0x1c08('0x3'));function getInterfaces(){var _0x45c0cf=[];var _0xfcc37d=os[_0x1c08('0x4')]();var _0x25b8b1=_['orderBy'](_['keys'](_0xfcc37d));for(var _0x29389f=0x0;_0x29389f<_0x25b8b1['length'];_0x29389f++){var _0x435e05=_0xfcc37d[_0x25b8b1[_0x29389f]][_0x1c08('0x5')](function(_0x535954){return _0x535954[_0x1c08('0x6')]===_0x1c08('0x7')&&_0x535954[_0x1c08('0x8')]===![];});_0x45c0cf=_0x45c0cf[_0x1c08('0x9')](_0x435e05);}return _0x45c0cf;}function getFirstInterface(){var _0x274126=_['head'](getInterfaces());return{'macAddress':_0x274126&&_0x274126[_0x1c08('0xa')]?_0x274126['mac']:_0x1c08('0xb'),'ipAddress':_0x274126&&_0x274126[_0x1c08('0xc')]?_0x274126[_0x1c08('0xc')]:_0x1c08('0xd')};}exports[_0x1c08('0xe')]=getFirstInterface;function getCPUhash(){var _0x4a5bfa=_[_0x1c08('0xf')](os['cpus']()['map'](function(_0x1f90b5){return _0x1f90b5[_0x1c08('0x10')];}))[_0x1c08('0x11')](':');return crypto[_0x1c08('0x12')](_0x1c08('0x13'))[_0x1c08('0x14')](_0x4a5bfa)[_0x1c08('0x15')](_0x1c08('0x16'));}exports['getUuid']=function(){var _0x2b0d8c=os[_0x1c08('0x17')]();var _0x57a466=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x57a466['test'](config[_0x1c08('0x18')])){return config[_0x1c08('0x18')];}else if(_0x2b0d8c===_0x1c08('0x19')){return exec(_0x1c08('0x1a'),{'encoding':_0x1c08('0x1b')})[_0x1c08('0x1c')]('\x0d\x0a','');}else{var _0x7e9424=getFirstInterface();var _0xfa91b3=getCPUhash();var _0x2d3a31=_0xfa91b3+'|'+os['hostname']()+'|'+_0x7e9424[_0x1c08('0x1d')]+'|'+_0x7e9424['ipAddress'];var _0x394a45=crypto[_0x1c08('0x12')](_0x1c08('0x13'))[_0x1c08('0x14')](_0x2d3a31)[_0x1c08('0x15')](_0x1c08('0x16'));return _0x394a45['substring'](0x0,0x8)+'-'+_0x394a45['substring'](0x8,0xc)+'-'+_0x394a45[_0x1c08('0x1e')](0xc,0x10)+'-'+_0x394a45[_0x1c08('0x1e')](0x10,0x14)+'-'+_0x394a45[_0x1c08('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index afdc32b..a8a8ec2 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 _0xbcd4=['encryptString','diff','decryptString','days','error','message','finally','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm'];(function(_0x3fe30d,_0x469e48){var _0x37b3e1=function(_0x5f1a27){while(--_0x5f1a27){_0x3fe30d['push'](_0x3fe30d['shift']());}};_0x37b3e1(++_0x469e48);}(_0xbcd4,0x161));var _0x4bcd=function(_0x1f80c6,_0x447da3){_0x1f80c6=_0x1f80c6-0x0;var _0x178e39=_0xbcd4[_0x1f80c6];return _0x178e39;};'use strict';var util=require(_0x4bcd('0x0'));var moment=require('moment');var rp=require(_0x4bcd('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x4bcd('0x2'))(module,_0x4bcd('0x3'));var db=require(_0x4bcd('0x4'))['db'];var encryptor=require(_0x4bcd('0x5'));var hardware=require('./hardware');var logger=require(_0x4bcd('0x6'))(_0x4bcd('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4b1c8c){return new BPromise(function(_0xbea796,_0x32fc98){var _0x24d839=util[_0x4bcd('0x8')](_0x4bcd('0x9'),HOST,_0x4b1c8c,module[_0x4bcd('0xa')][_0x4bcd('0x3')]);if(oldToken){_0x24d839=util[_0x4bcd('0x8')](_0x4bcd('0xb'),HOST,_0x4b1c8c,module[_0x4bcd('0xa')][_0x4bcd('0x3')],oldToken);}var _0x2b8d67={'uri':_0x24d839,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x2b8d67)[_0x4bcd('0xc')](function(_0x8cceaa){_0xbea796(_0x8cceaa);})[_0x4bcd('0xd')](function(_0x42afe7){_0x32fc98(_0x42afe7);});});}function manageLicense(_0xacb92,_0x5e6533){var _0x1c0dd6=_0x5e6533[_0x4bcd('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x1c0dd6[_0x4bcd('0xf')]!==_0xacb92&&!_0x1c0dd6[_0x4bcd('0x10')]){oldToken=_0x1c0dd6['data1'];}httpRequest(_0xacb92)[_0x4bcd('0xc')](function(_0x362057){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x362057[_0x4bcd('0x11')]){isOldTokenSent=![];if(!_0x1c0dd6['license']&&_0x1c0dd6[_0x4bcd('0x7')]!=_0x362057['license']||_0x1c0dd6['license']&&_0x1c0dd6[_0x4bcd('0x10')]){logger[_0x4bcd('0x12')](_0x4bcd('0x13'));}if(_0x1c0dd6[_0x4bcd('0x7')]&&!_0x1c0dd6[_0x4bcd('0x10')]&&_0x1c0dd6[_0x4bcd('0x7')]!=_0x362057[_0x4bcd('0x7')]){logger[_0x4bcd('0x12')](_0x4bcd('0x14'));}if(_0x1c0dd6['license']&&!_0x1c0dd6[_0x4bcd('0x10')]&&_0x1c0dd6[_0x4bcd('0x7')]==_0x362057['license']){return _0x5e6533;}return _0x5e6533[_0x4bcd('0x15')]({'data1':_0xacb92,'data2':null,'license':_0x362057[_0x4bcd('0x7')]});}else{if(_0x362057[_0x4bcd('0x7')]||_0x1c0dd6[_0x4bcd('0x7')]){if(!_0x1c0dd6['data2']){if(_0x1c0dd6['data1']==_0xacb92){GRAY_PERIOD_REASON=_0x4bcd('0x16');logger[_0x4bcd('0x12')](_0x4bcd('0x17'));}else{GRAY_PERIOD_REASON=_0x4bcd('0x18');logger[_0x4bcd('0x12')](_0x4bcd('0x19'),_0x1c0dd6['data1'],_0xacb92);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x4bcd('0x8')](_0x4bcd('0x1a')));return _0x5e6533[_0x4bcd('0x15')]({'data2':encryptor[_0x4bcd('0x1b')](moment()[_0x4bcd('0x8')](_0x4bcd('0x1a')))});}else{if(moment()[_0x4bcd('0x1c')](encryptor[_0x4bcd('0x1d')](_0x1c0dd6[_0x4bcd('0x10')]),_0x4bcd('0x1e'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x4bcd('0x8')](_0x4bcd('0x1a')));isOldTokenSent=![];return _0x5e6533[_0x4bcd('0x15')]({'data1':_0xacb92,'data2':null,'license':null});}}}else{if(_0x1c0dd6[_0x4bcd('0xf')]!=_0xacb92){logger['info'](_0x4bcd('0x19'),_0x1c0dd6[_0x4bcd('0xf')],_0xacb92);return _0x5e6533[_0x4bcd('0x15')]({'data1':_0xacb92,'data2':null,'license':null});}}}return _0x5e6533;})[_0x4bcd('0xc')](function(_0x157de6){_0x5e6533=_0x157de6;})[_0x4bcd('0xd')](function(_0x2e283e){logger[_0x4bcd('0x1f')](_0x2e283e[_0x4bcd('0x20')]);})[_0x4bcd('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x4bcd('0x22')](),_0x5e6533);},TIME);});}function defaultLicense(){var _0xea5914=hardware[_0x4bcd('0x22')]();if(_0xea5914){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0xea5914}})[_0x4bcd('0x23')](function(_0x3fe50f,_0x31ed16){logger[_0x4bcd('0x12')](_0x4bcd('0x24'),_0xea5914);manageLicense(_0xea5914,_0x3fe50f);})['catch'](function(_0xa2bbad){logger[_0x4bcd('0x1f')](_0xa2bbad[_0x4bcd('0x20')]);});}}exports[_0x4bcd('0x25')]=defaultLicense; \ No newline at end of file +var _0xdb0d=['info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','catch','get','data1','data2','then','active'];(function(_0x25dd71,_0x11ed1c){var _0x13a3b3=function(_0x43ac66){while(--_0x43ac66){_0x25dd71['push'](_0x25dd71['shift']());}};_0x13a3b3(++_0x11ed1c);}(_0xdb0d,0x6d));var _0xddb0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb0d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xddb0('0x0'));var moment=require('moment');var rp=require(_0xddb0('0x1'));var BPromise=require(_0xddb0('0x2'));var pkginfo=require(_0xddb0('0x3'))(module,_0xddb0('0x4'));var db=require(_0xddb0('0x5'))['db'];var encryptor=require(_0xddb0('0x6'));var hardware=require(_0xddb0('0x7'));var logger=require(_0xddb0('0x8'))(_0xddb0('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x418870){return new BPromise(function(_0x7a81f2,_0x57bf73){var _0x2b4ff4=util[_0xddb0('0xa')](_0xddb0('0xb'),HOST,_0x418870,module[_0xddb0('0xc')][_0xddb0('0x4')]);if(oldToken){_0x2b4ff4=util['format'](_0xddb0('0xd'),HOST,_0x418870,module['exports'][_0xddb0('0x4')],oldToken);}var _0x10a400={'uri':_0x2b4ff4,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x10a400)['then'](function(_0x4f55cd){_0x7a81f2(_0x4f55cd);})[_0xddb0('0xe')](function(_0x3efd2d){_0x57bf73(_0x3efd2d);});});}function manageLicense(_0x3c36af,_0x59a8c5){var _0xc7b2a3=_0x59a8c5[_0xddb0('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0xc7b2a3[_0xddb0('0x10')]!==_0x3c36af&&!_0xc7b2a3[_0xddb0('0x11')]){oldToken=_0xc7b2a3[_0xddb0('0x10')];}httpRequest(_0x3c36af)[_0xddb0('0x12')](function(_0xd4ffe9){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xd4ffe9[_0xddb0('0x13')]){isOldTokenSent=![];if(!_0xc7b2a3['license']&&_0xc7b2a3[_0xddb0('0x9')]!=_0xd4ffe9[_0xddb0('0x9')]||_0xc7b2a3[_0xddb0('0x9')]&&_0xc7b2a3[_0xddb0('0x11')]){logger[_0xddb0('0x14')](_0xddb0('0x15'));}if(_0xc7b2a3[_0xddb0('0x9')]&&!_0xc7b2a3[_0xddb0('0x11')]&&_0xc7b2a3[_0xddb0('0x9')]!=_0xd4ffe9[_0xddb0('0x9')]){logger[_0xddb0('0x14')](_0xddb0('0x16'));}if(_0xc7b2a3[_0xddb0('0x9')]&&!_0xc7b2a3[_0xddb0('0x11')]&&_0xc7b2a3[_0xddb0('0x9')]==_0xd4ffe9[_0xddb0('0x9')]){return _0x59a8c5;}return _0x59a8c5['update']({'data1':_0x3c36af,'data2':null,'license':_0xd4ffe9[_0xddb0('0x9')]});}else{if(_0xd4ffe9[_0xddb0('0x9')]||_0xc7b2a3[_0xddb0('0x9')]){if(!_0xc7b2a3[_0xddb0('0x11')]){if(_0xc7b2a3[_0xddb0('0x10')]==_0x3c36af){GRAY_PERIOD_REASON=_0xddb0('0x17');logger[_0xddb0('0x14')](_0xddb0('0x18'));}else{GRAY_PERIOD_REASON=_0xddb0('0x19');logger[_0xddb0('0x14')](_0xddb0('0x1a'),_0xc7b2a3[_0xddb0('0x10')],_0x3c36af);}logger[_0xddb0('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xddb0('0x1b')](),moment()[_0xddb0('0xa')](_0xddb0('0x1c')));return _0x59a8c5[_0xddb0('0x1d')]({'data2':encryptor['encryptString'](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xddb0('0x1e')](encryptor[_0xddb0('0x1f')](_0xc7b2a3[_0xddb0('0x11')]),_0xddb0('0x20'))>DAYS){logger[_0xddb0('0x14')](_0xddb0('0x21'),moment()[_0xddb0('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x59a8c5[_0xddb0('0x1d')]({'data1':_0x3c36af,'data2':null,'license':null});}}}else{if(_0xc7b2a3[_0xddb0('0x10')]!=_0x3c36af){logger[_0xddb0('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xc7b2a3[_0xddb0('0x10')],_0x3c36af);return _0x59a8c5[_0xddb0('0x1d')]({'data1':_0x3c36af,'data2':null,'license':null});}}}return _0x59a8c5;})[_0xddb0('0x12')](function(_0x3e604c){_0x59a8c5=_0x3e604c;})[_0xddb0('0xe')](function(_0x1f2e7f){logger[_0xddb0('0x22')](_0x1f2e7f[_0xddb0('0x23')]);})[_0xddb0('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xddb0('0x25')](),_0x59a8c5);},TIME);});}function defaultLicense(){var _0x1b19ee=hardware['getUuid']();if(_0x1b19ee){return db[_0xddb0('0x26')][_0xddb0('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x1b19ee}})[_0xddb0('0x28')](function(_0x79a2fa,_0x15950e){logger[_0xddb0('0x14')](_0xddb0('0x29'),_0x1b19ee);manageLicense(_0x1b19ee,_0x79a2fa);})[_0xddb0('0xe')](function(_0x115d06){logger['error'](_0x115d06['message']);});}}exports[_0xddb0('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 36a29ce..b579e88 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 _0x0a57=['deadline','add','days','grayReason','machineUuid','changed','message','User','sequelize','COUNT','col','role','count','admin','user','telephone','users','telephones','forEach','pick','License\x20limit\x20reached\x20for\x20users','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse'];(function(_0x976d66,_0x1fe525){var _0x1e9300=function(_0x4b55ca){while(--_0x4b55ca){_0x976d66['push'](_0x976d66['shift']());}};_0x1e9300(++_0x1fe525);}(_0x0a57,0x1aa));var _0x70a5=function(_0x1587c3,_0x2ee5aa){_0x1587c3=_0x1587c3-0x0;var _0x9386b6=_0x0a57[_0x1587c3];return _0x9386b6;};'use strict';var util=require(_0x70a5('0x0'));var _=require(_0x70a5('0x1'));var moment=require(_0x70a5('0x2'));var BPromise=require(_0x70a5('0x3'));var hardware=require(_0x70a5('0x4'));var encryptor=require(_0x70a5('0x5'));var db=require(_0x70a5('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x70a5('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x70a5('0x8'),'machineUuid':hardware[_0x70a5('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x70a5('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x70a5('0xa'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2b0739){return new BPromise(function(_0x48cc5b,_0x44081c){return db['License'][_0x70a5('0xb')](_['defaults'](_0x2b0739,{'raw':!![],'where':{'id':0x1}}))[_0x70a5('0xc')](function(_0x3f7a69){return checkLicense(_0x3f7a69,null);})[_0x70a5('0xc')](function(_0x148751){_0x48cc5b(_0x148751);return;})[_0x70a5('0xd')](function(_0x4a56ac){_0x44081c(_0x4a56ac);});});}function checkLicense(_0x4a9316,_0x3af23a){if(!_0x4a9316){demoLicense[_0x70a5('0xe')]=_0x4a9316[_0x70a5('0xf')];return demoLicense;}try{var _0x1ecfbd=_0x3af23a||_0x4a9316[_0x70a5('0x10')];if(_['isEmpty'](_0x1ecfbd)){throw new Error(_0x70a5('0x11'));}var _0x313638=_0x4a9316[_0x70a5('0xf')];var _0xde2d5e=_0x4a9316[_0x70a5('0x12')];var _0x5d2295=_0x313638[_0x70a5('0x13')]('-')[0x4];var _0x38a5c5=_0x313638[_0x70a5('0x13')]('-')[0x0];var _0x34b7b1=encryptor[_0x70a5('0x14')](_0x1ecfbd,util[_0x70a5('0x15')](_0x70a5('0x16'),_0x5d2295,_0x313638,_0x38a5c5));var _0x39cdd9=JSON[_0x70a5('0x17')](_0x34b7b1);_0x39cdd9['demo']=![];_0x39cdd9[_0x70a5('0xe')]=_0x313638;_0x39cdd9['machineUuid']=hardware[_0x70a5('0x9')]();if(_0xde2d5e){var _0x2ead88=encryptor[_0x70a5('0x14')](_0xde2d5e);_0x39cdd9['gray']=_0x2ead88;_0x39cdd9[_0x70a5('0x18')]=moment(_0x2ead88)[_0x70a5('0x19')](0x7,_0x70a5('0x1a'))[_0x70a5('0x15')]();_0x39cdd9[_0x70a5('0x1b')]=_0x39cdd9['uuid']!=_0x39cdd9[_0x70a5('0x1c')]?_0x70a5('0x1d'):'disabled';}return _0x39cdd9;}catch(_0x17fb19){breakingLicense[_0x70a5('0xe')]=_0x4a9316['data1'];breakingLicense[_0x70a5('0x1e')]=_0x17fb19[_0x70a5('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3c43b7,_0x4b440e){getLicense()[_0x70a5('0xc')](function(_0x40a8d7){return db[_0x70a5('0x1f')]['findAll']({'attributes':['role',[db[_0x70a5('0x20')]['fn'](_0x70a5('0x21'),db[_0x70a5('0x20')][_0x70a5('0x22')](_0x70a5('0x23'))),_0x70a5('0x24')]],'group':_0x70a5('0x23'),'where':{'role':{'$or':[_0x70a5('0x25'),_0x70a5('0x26'),_0x70a5('0x27')]}},'raw':!![]})[_0x70a5('0xc')](function(_0x153cfe){var _0x2e8283={'user':_0x40a8d7[_0x70a5('0x28')]||0x0,'telephone':_0x40a8d7[_0x70a5('0x29')]||0x0};_0x153cfe[_0x70a5('0x2a')](function(_0x441702){var _0xbec604=_0x441702[_0x70a5('0x23')]==='admin'?'user':_0x441702[_0x70a5('0x23')];_0x2e8283[_0xbec604]-=_0x441702[_0x70a5('0x24')];if(_0x2e8283[_0xbec604]<0x0)_0x2e8283[_0xbec604]=0x0;});_0x3c43b7(_0x2e8283);return;});})[_0x70a5('0xd')](function(_0x3eb5cd){_0x4b440e(_0x3eb5cd);});});}function checkUserLimits(_0x2d63be){return new BPromise(function(_0x56845c,_0x3155cb){getLimits()[_0x70a5('0xc')](function(_0x3e0d33){var _0x2577d8=_[_0x70a5('0x2b')](_['countBy'](_0x2d63be,_0x70a5('0x23')),[_0x70a5('0x25'),_0x70a5('0x26'),_0x70a5('0x27')]);var _0x4a323b=(_0x2577d8[_0x70a5('0x25')]||0x0)+(_0x2577d8['user']||0x0);var _0x548bfc=_0x2577d8[_0x70a5('0x27')]||0x0;if(_0x4a323b>_0x3e0d33[_0x70a5('0x26')])return _0x3155cb(_0x70a5('0x2c'));if(_0x548bfc>_0x3e0d33[_0x70a5('0x27')])return _0x3155cb('License\x20limit\x20reached\x20for\x20telephones');return _0x56845c();})['catch'](function(_0x4fb8fb){_0x3155cb(_0x4fb8fb);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x90b2=['exports','util','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','machineUuid','gray','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','user','telephone','count','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones'];(function(_0x20b035,_0x33e530){var _0x26d5ec=function(_0x34fafa){while(--_0x34fafa){_0x20b035['push'](_0x20b035['shift']());}};_0x26d5ec(++_0x33e530);}(_0x90b2,0x7c));var _0x290b=function(_0x2e7d8b,_0x3eed43){_0x2e7d8b=_0x2e7d8b-0x0;var _0x29dbbf=_0x90b2[_0x2e7d8b];return _0x29dbbf;};'use strict';var util=require(_0x290b('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0x290b('0x1'));var db=require(_0x290b('0x2'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x290b('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x290b('0x4'),'machineUuid':hardware[_0x290b('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x290b('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x290b('0x6'),'machineUuid':hardware[_0x290b('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4dd03d){return new BPromise(function(_0x2af6e7,_0x349a96){return db['License']['find'](_[_0x290b('0x7')](_0x4dd03d,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4c318d){return checkLicense(_0x4c318d,null);})[_0x290b('0x8')](function(_0x4c67d1){_0x2af6e7(_0x4c67d1);return;})[_0x290b('0x9')](function(_0x40493c){_0x349a96(_0x40493c);});});}function checkLicense(_0x4b732c,_0x49aca8){if(!_0x4b732c){demoLicense[_0x290b('0xa')]=_0x4b732c[_0x290b('0xb')];return demoLicense;}try{var _0x2c9aa3=_0x49aca8||_0x4b732c[_0x290b('0xc')];if(_[_0x290b('0xd')](_0x2c9aa3)){throw new Error(_0x290b('0xe'));}var _0x2dc97d=_0x4b732c['data1'];var _0x32c719=_0x4b732c[_0x290b('0xf')];var _0x255ef5=_0x2dc97d[_0x290b('0x10')]('-')[0x4];var _0x9782d9=_0x2dc97d[_0x290b('0x10')]('-')[0x0];var _0x58f4b9=encryptor[_0x290b('0x11')](_0x2c9aa3,util[_0x290b('0x12')](_0x290b('0x13'),_0x255ef5,_0x2dc97d,_0x9782d9));var _0x77212=JSON[_0x290b('0x14')](_0x58f4b9);_0x77212['demo']=![];_0x77212[_0x290b('0xa')]=_0x2dc97d;_0x77212[_0x290b('0x15')]=hardware[_0x290b('0x5')]();if(_0x32c719){var _0x2eb891=encryptor[_0x290b('0x11')](_0x32c719);_0x77212[_0x290b('0x16')]=_0x2eb891;_0x77212['deadline']=moment(_0x2eb891)['add'](0x7,_0x290b('0x17'))['format']();_0x77212['grayReason']=_0x77212[_0x290b('0xa')]!=_0x77212[_0x290b('0x15')]?_0x290b('0x18'):_0x290b('0x19');}return _0x77212;}catch(_0x157b60){breakingLicense[_0x290b('0xa')]=_0x4b732c['data1'];breakingLicense[_0x290b('0x1a')]=_0x157b60[_0x290b('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3c3eab,_0x2f2f3a){getLicense()[_0x290b('0x8')](function(_0x29f9c9){return db[_0x290b('0x1b')][_0x290b('0x1c')]({'attributes':[_0x290b('0x1d'),[db[_0x290b('0x1e')]['fn'](_0x290b('0x1f'),db[_0x290b('0x1e')][_0x290b('0x20')]('role')),'count']],'group':_0x290b('0x1d'),'where':{'role':{'$or':[_0x290b('0x21'),_0x290b('0x22'),_0x290b('0x23')]}},'raw':!![]})[_0x290b('0x8')](function(_0x45350c){var _0x3a5f8f={'user':_0x29f9c9['users']||0x0,'telephone':_0x29f9c9['telephones']||0x0};_0x45350c['forEach'](function(_0x4a38d9){var _0x31c1ef=_0x4a38d9[_0x290b('0x1d')]===_0x290b('0x21')?_0x290b('0x22'):_0x4a38d9[_0x290b('0x1d')];_0x3a5f8f[_0x31c1ef]-=_0x4a38d9[_0x290b('0x24')];if(_0x3a5f8f[_0x31c1ef]<0x0)_0x3a5f8f[_0x31c1ef]=0x0;});_0x3c3eab(_0x3a5f8f);return;});})[_0x290b('0x9')](function(_0x4d30ef){_0x2f2f3a(_0x4d30ef);});});}function checkUserLimits(_0x2e4922){return new BPromise(function(_0x8140b3,_0x234fab){getLimits()[_0x290b('0x8')](function(_0x2bceec){var _0x67b815=_['pick'](_[_0x290b('0x25')](_0x2e4922,_0x290b('0x1d')),[_0x290b('0x21'),_0x290b('0x22'),_0x290b('0x23')]);var _0x463ec9=(_0x67b815['admin']||0x0)+(_0x67b815[_0x290b('0x22')]||0x0);var _0x5685c5=_0x67b815[_0x290b('0x23')]||0x0;if(_0x463ec9>_0x2bceec[_0x290b('0x22')])return _0x234fab(_0x290b('0x26'));if(_0x5685c5>_0x2bceec[_0x290b('0x23')])return _0x234fab(_0x290b('0x27'));return _0x8140b3();})['catch'](function(_0x26d371){_0x234fab(_0x26d371);});});}module[_0x290b('0x28')]={'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 74dc57a..f7c9343 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 _0xd4f4=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x26779f,_0x552286){var _0x2c943d=function(_0x5c947f){while(--_0x5c947f){_0x26779f['push'](_0x26779f['shift']());}};_0x2c943d(++_0x552286);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x2d3008,_0x5d8c2e){_0x2d3008=_0x2d3008-0x0;var _0x1f0612=_0xd4f4[_0x2d3008];return _0x1f0612;};'use strict';module[_0x4d4f('0x0')]={'DOMAIN':_0x4d4f('0x1'),'SESSION_SECRET':_0x4d4f('0x2'),'GOOGLE_ID':_0x4d4f('0x3'),'GOOGLE_SECRET':_0x4d4f('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x2272=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x11f28f,_0x30ebf9){var _0x413f1a=function(_0x537f8b){while(--_0x537f8b){_0x11f28f['push'](_0x11f28f['shift']());}};_0x413f1a(++_0x30ebf9);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';module[_0x2227('0x0')]={'DOMAIN':_0x2227('0x1'),'SESSION_SECRET':_0x2227('0x2'),'GOOGLE_ID':_0x2227('0x3'),'GOOGLE_SECRET':_0x2227('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index c0641fe..8628ea7 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa54e=['}}}','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','%s-%s','error','transports','File','info','Console','env','moment','winston','path','INFO','log','format','%s-%s.log','message','replace'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0xa54e,0x132));var _0xea54=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0xa54e[_0x22bdd3];return _0x44d9d9;};'use strict';var moment=require(_0xea54('0x0'));var winston=require(_0xea54('0x1'));var util=require('util');var path=require(_0xea54('0x2'));var debugLevel=_0xea54('0x3');function filename(_0x5532bd,_0x31289a){return path['join']('/var',_0xea54('0x4'),'xcally',util[_0xea54('0x5')](_0xea54('0x6'),_0x5532bd,_0x31289a));}function formatter(_0x5cd368,_0x4aca11){_0x4aca11[_0xea54('0x7')]=_0x4aca11['message'][_0xea54('0x8')](/@@{/g,'{{{')[_0xea54('0x8')](/}@@/g,_0xea54('0x9'))[_0xea54('0x8')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xea54('0x5')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xea54('0x5')](_0xea54('0xa')),_0x4aca11['level'][_0xea54('0xb')](),_0x5cd368,_0x4aca11[_0xea54('0x7')]);}module[_0xea54('0xc')]=function(_0x42e8dc){return new winston[(_0xea54('0xd'))]({'transports':[new winston['transports']['File']({'name':util[_0xea54('0x5')](_0xea54('0xe'),_0x42e8dc,_0xea54('0xf')),'filename':filename(_0x42e8dc,_0xea54('0xf')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x319565){return formatter(_0x42e8dc,_0x319565);}}),new winston[(_0xea54('0x10'))][(_0xea54('0x11'))]({'name':util['format'](_0xea54('0xe'),_0x42e8dc,_0xea54('0x12')),'filename':filename(_0x42e8dc,_0xea54('0x12')),'level':_0xea54('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x55369c){return formatter(_0x42e8dc,_0x55369c);}}),new winston[(_0xea54('0x10'))][(_0xea54('0x13'))]({'level':process[_0xea54('0x14')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0xf66b0d){return formatter(_0x42e8dc,_0xf66b0d);}})]});}; \ No newline at end of file +var _0x3476=['transports','File','error','info','Console','env','debugLevel','moment','winston','util','path','join','/var','log','xcally','format','%s-%s.log','message','replace','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger'];(function(_0x44b5d5,_0x186691){var _0x357513=function(_0x1ae921){while(--_0x1ae921){_0x44b5d5['push'](_0x44b5d5['shift']());}};_0x357513(++_0x186691);}(_0x3476,0x132));var _0x6347=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x3476[_0x101e7b];return _0x4995c0;};'use strict';var moment=require(_0x6347('0x0'));var winston=require(_0x6347('0x1'));var util=require(_0x6347('0x2'));var path=require(_0x6347('0x3'));var debugLevel='INFO';function filename(_0x246a1e,_0x1a5852){return path[_0x6347('0x4')](_0x6347('0x5'),_0x6347('0x6'),_0x6347('0x7'),util[_0x6347('0x8')](_0x6347('0x9'),_0x246a1e,_0x1a5852));}function formatter(_0x13bd46,_0x40c8f2){_0x40c8f2['message']=_0x40c8f2[_0x6347('0xa')]['replace'](/@@{/g,'{{{')[_0x6347('0xb')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x6347('0xb')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x6347('0x8')](_0x6347('0xc')),_0x40c8f2['level'][_0x6347('0xd')](),_0x13bd46,_0x40c8f2[_0x6347('0xa')]);}module[_0x6347('0xe')]=function(_0x2c77a6){return new winston[(_0x6347('0xf'))]({'transports':[new winston[(_0x6347('0x10'))][(_0x6347('0x11'))]({'name':util[_0x6347('0x8')]('%s-%s',_0x2c77a6,_0x6347('0x12')),'filename':filename(_0x2c77a6,_0x6347('0x12')),'level':_0x6347('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x28cfd1){return formatter(_0x2c77a6,_0x28cfd1);}}),new winston[(_0x6347('0x10'))]['File']({'name':util[_0x6347('0x8')]('%s-%s',_0x2c77a6,'info'),'filename':filename(_0x2c77a6,_0x6347('0x13')),'level':_0x6347('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3b3ca4){return formatter(_0x2c77a6,_0x3b3ca4);}}),new winston[(_0x6347('0x10'))][(_0x6347('0x14'))]({'level':process[_0x6347('0x15')][_0x6347('0x16')]||debugLevel,'json':![],'formatter':function(_0x345d86){return formatter(_0x2c77a6,_0x345d86);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 0395827..2a14699 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 _0x4dfc=['../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join'];(function(_0x323fca,_0x369c53){var _0x2f4122=function(_0x8d8818){while(--_0x8d8818){_0x323fca['push'](_0x323fca['shift']());}};_0x2f4122(++_0x369c53);}(_0x4dfc,0x1b7));var _0xc4df=function(_0x5cd7a3,_0x1aa14f){_0x5cd7a3=_0x5cd7a3-0x0;var _0x21235d=_0x4dfc[_0x5cd7a3];return _0x21235d;};'use strict';var path=require(_0xc4df('0x0'));var os=require('os');var config={'apps':[{'name':_0xc4df('0x1'),'script':path[_0xc4df('0x2')](__dirname,_0xc4df('0x3'))},{'name':_0xc4df('0x4'),'script':path[_0xc4df('0x2')](__dirname,_0xc4df('0x5'))},{'name':_0xc4df('0x6'),'script':path[_0xc4df('0x2')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0xc4df('0x2')](__dirname,_0xc4df('0x7'))},{'name':_0xc4df('0x8'),'script':path[_0xc4df('0x2')](__dirname,_0xc4df('0x9'))},{'name':_0xc4df('0xa'),'script':path['join'](__dirname,_0xc4df('0xb'))}]};module[_0xc4df('0xc')]=config; \ No newline at end of file +var _0xab76=['agi','email','../../services/email/index.js','routing','exports','path','join','../../services/express/index.js','ami'];(function(_0x2a5302,_0x3c00b2){var _0x175c4a=function(_0x18d620){while(--_0x18d620){_0x2a5302['push'](_0x2a5302['shift']());}};_0x175c4a(++_0x3c00b2);}(_0xab76,0x7a));var _0x6ab7=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xab76[_0x24237f];return _0x48298e;};'use strict';var path=require(_0x6ab7('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x6ab7('0x1')](__dirname,_0x6ab7('0x2'))},{'name':_0x6ab7('0x3'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0x6ab7('0x4'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x6ab7('0x5'),'script':path[_0x6ab7('0x1')](__dirname,_0x6ab7('0x6'))},{'name':_0x6ab7('0x7'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x6ab7('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0x6ab7('0x8')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index b3bc8ae..26bbfc5 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 _0xba37=['list','describe','delete','dump','bluebird','./config','connect','connected','start','disconnect','stop','then','restart'];(function(_0x318d81,_0x579b2d){var _0x3014a7=function(_0x39ef6e){while(--_0x39ef6e){_0x318d81['push'](_0x318d81['shift']());}};_0x3014a7(++_0x579b2d);}(_0xba37,0x93));var _0x7ba3=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xba37[_0x2dadb9];return _0x2f0097;};'use strict';var pm2=require('pm2');var BPromise=require(_0x7ba3('0x0'));var config=require(_0x7ba3('0x1'));function connect(){return new BPromise(function(_0x4be504,_0x184b51){return pm2[_0x7ba3('0x2')](function(_0x2af730){if(_0x2af730){return _0x184b51(_0x2af730);}return _0x4be504(_0x7ba3('0x3'));});});};exports[_0x7ba3('0x4')]=function(_0x12380f){return connect()['then'](function(){return new BPromise(function(_0x385ccd,_0x16592c){return pm2[_0x7ba3('0x4')](_0x12380f,function(_0x15d739,_0xec1391){if(_0x15d739){return _0x16592c(_0x15d739);}pm2[_0x7ba3('0x5')]();return _0x385ccd(_0xec1391);});});});};exports[_0x7ba3('0x6')]=function(_0x3d525f){return connect()[_0x7ba3('0x7')](function(){return new BPromise(function(_0x54f596,_0x269cb0){return pm2[_0x7ba3('0x6')](_0x3d525f,function(_0x20b1b5,_0x5320c){if(_0x20b1b5){return _0x269cb0(_0x20b1b5);}pm2['disconnect']();return _0x54f596(_0x5320c);});});});};exports[_0x7ba3('0x8')]=function(_0x2b11ac){return connect()[_0x7ba3('0x7')](function(){return new BPromise(function(_0xf9b6cc,_0x16d0a3){return pm2[_0x7ba3('0x8')](_0x2b11ac,function(_0x234aea,_0x2bdd9b){if(_0x234aea){return _0x16d0a3(_0x234aea);}pm2[_0x7ba3('0x5')]();return _0xf9b6cc(_0x2bdd9b);});});});};exports[_0x7ba3('0x9')]=function(){return connect()[_0x7ba3('0x7')](function(){return new BPromise(function(_0xf72731,_0x3101fe){return pm2[_0x7ba3('0x9')](function(_0x473f48,_0x278e38){if(_0x473f48){return _0x3101fe(_0x473f48);}pm2[_0x7ba3('0x5')]();return _0xf72731(_0x278e38);});});});};exports['describe']=function(_0x1f9979){return connect()[_0x7ba3('0x7')](function(){return new BPromise(function(_0x130a1b,_0x5a52d3){return pm2[_0x7ba3('0xa')](_0x1f9979,function(_0x313672,_0xe88c6b){if(_0x313672){return _0x5a52d3(_0x313672);}pm2['disconnect']();return _0x130a1b(_0xe88c6b);});});});};exports['delete']=function(_0x5be296){return connect()[_0x7ba3('0x7')](function(){return new BPromise(function(_0x3b4bc9,_0x3de0fa){return pm2[_0x7ba3('0xb')](_0x5be296,function(_0x3f20f8,_0x34a7a1){if(_0x3f20f8){return _0x3de0fa(_0x3f20f8);}pm2['disconnect']();return _0x3b4bc9(_0x34a7a1);});});});};exports[_0x7ba3('0xc')]=function(){return connect()[_0x7ba3('0x7')](function(){return new BPromise(function(_0x56d956,_0x491a6b){return pm2[_0x7ba3('0xc')](function(_0x5b03f3){if(_0x5b03f3){return _0x491a6b(_0x5b03f3);}return _0x56d956('saved');});});});}; \ No newline at end of file +var _0x2e6f=['pm2','connected','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0x2e5e3f,_0x4b2a89){var _0x324aad=function(_0x57f6e9){while(--_0x57f6e9){_0x2e5e3f['push'](_0x2e5e3f['shift']());}};_0x324aad(++_0x4b2a89);}(_0x2e6f,0x1a2));var _0xf2e6=function(_0xf73a2f,_0x338e57){_0xf73a2f=_0xf73a2f-0x0;var _0xc5b50d=_0x2e6f[_0xf73a2f];return _0xc5b50d;};'use strict';var pm2=require(_0xf2e6('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x2793c4,_0x39def5){return pm2['connect'](function(_0x4588b3){if(_0x4588b3){return _0x39def5(_0x4588b3);}return _0x2793c4(_0xf2e6('0x1'));});});};exports[_0xf2e6('0x2')]=function(_0x26febf){return connect()[_0xf2e6('0x3')](function(){return new BPromise(function(_0x24dfef,_0x442e53){return pm2[_0xf2e6('0x2')](_0x26febf,function(_0x4f145e,_0x508426){if(_0x4f145e){return _0x442e53(_0x4f145e);}pm2[_0xf2e6('0x4')]();return _0x24dfef(_0x508426);});});});};exports[_0xf2e6('0x5')]=function(_0x16b6e0){return connect()[_0xf2e6('0x3')](function(){return new BPromise(function(_0x13236b,_0x594689){return pm2['stop'](_0x16b6e0,function(_0x1ce6e3,_0x216871){if(_0x1ce6e3){return _0x594689(_0x1ce6e3);}pm2[_0xf2e6('0x4')]();return _0x13236b(_0x216871);});});});};exports[_0xf2e6('0x6')]=function(_0x3481c5){return connect()[_0xf2e6('0x3')](function(){return new BPromise(function(_0x58a35c,_0x1b73f2){return pm2[_0xf2e6('0x6')](_0x3481c5,function(_0x5493cf,_0x1d03f9){if(_0x5493cf){return _0x1b73f2(_0x5493cf);}pm2[_0xf2e6('0x4')]();return _0x58a35c(_0x1d03f9);});});});};exports['list']=function(){return connect()[_0xf2e6('0x3')](function(){return new BPromise(function(_0x30d5a0,_0x24b218){return pm2[_0xf2e6('0x7')](function(_0xd7700c,_0x55ae97){if(_0xd7700c){return _0x24b218(_0xd7700c);}pm2[_0xf2e6('0x4')]();return _0x30d5a0(_0x55ae97);});});});};exports[_0xf2e6('0x8')]=function(_0x29ff0e){return connect()[_0xf2e6('0x3')](function(){return new BPromise(function(_0x19dcef,_0x2d9b03){return pm2[_0xf2e6('0x8')](_0x29ff0e,function(_0x126fbe,_0x22ef24){if(_0x126fbe){return _0x2d9b03(_0x126fbe);}pm2['disconnect']();return _0x19dcef(_0x22ef24);});});});};exports[_0xf2e6('0x9')]=function(_0x1a357a){return connect()[_0xf2e6('0x3')](function(){return new BPromise(function(_0x4140c9,_0x4308d6){return pm2[_0xf2e6('0x9')](_0x1a357a,function(_0x1c0910,_0x37e149){if(_0x1c0910){return _0x4308d6(_0x1c0910);}pm2[_0xf2e6('0x4')]();return _0x4140c9(_0x37e149);});});});};exports[_0xf2e6('0xa')]=function(){return connect()[_0xf2e6('0x3')](function(){return new BPromise(function(_0x3b0309,_0xcae3c6){return pm2[_0xf2e6('0xa')](function(_0x1a12d3){if(_0x1a12d3){return _0xcae3c6(_0x1a12d3);}return _0x3b0309('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 2869cad..4fc06ed 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 _0x712c=['ChatInteraction','update','system','timeout','format','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then','findAll','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join'];(function(_0x20e81e,_0x2ad41f){var _0x3e6654=function(_0x3f2904){while(--_0x3f2904){_0x20e81e['push'](_0x20e81e['shift']());}};_0x3e6654(++_0x2ad41f);}(_0x712c,0x69));var _0xc712=function(_0x2c5e04,_0x1b22f){_0x2c5e04=_0x2c5e04-0x0;var _0x40d748=_0x712c[_0x2c5e04];return _0x40d748;};'use strict';var _=require(_0xc712('0x0'));var moment=require(_0xc712('0x1'));var Redis=require(_0xc712('0x2'));var util=require(_0xc712('0x3'));var config=require(_0xc712('0x4'));var db=require(_0xc712('0x5'))['db'];var logger=require('../logger')('schedule');config[_0xc712('0x6')]=_[_0xc712('0x7')](config[_0xc712('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xc712('0x8'))(new Redis(config[_0xc712('0x6')]));function closeInteractions(){var _0x12f6a2=0x0;var _0x3c5b20=[];return db[_0xc712('0x9')][_0xc712('0xa')]({'raw':!![],'attributes':['id',_0xc712('0xb')],'where':{'id':0x1}})[_0xc712('0xc')](function(_0x10deb9){_0x12f6a2=_0x10deb9[_0xc712('0xb')];if(_0x12f6a2){return db['ChatInteraction'][_0xc712('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x10deb9[_0xc712('0xb')],_0xc712('0xe'))}}});}else{return[];}})[_0xc712('0xc')](function(_0x4f2a0a){if(_0x4f2a0a&&_0x4f2a0a['length']){_0x3c5b20=_[_0xc712('0xf')](_0x4f2a0a||[],'id');logger[_0xc712('0x10')](_0xc712('0x11'),_0x3c5b20[_0xc712('0x12')]());return db[_0xc712('0x13')][_0xc712('0x14')]({'closeReason':_0xc712('0x15'),'disposition':_0xc712('0x16'),'closed':!![],'closedAt':moment()[_0xc712('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3c5b20}});}})[_0xc712('0xc')](function(){if(_0x3c5b20&&_0x3c5b20[_0xc712('0x18')]){logger[_0xc712('0x10')](_0xc712('0x19'),_0x3c5b20['join']());for(var _0x490e38=0x0;_0x490e38<_0x3c5b20['length'];_0x490e38++){io[_0xc712('0x1a')](_0xc712('0x1b'),{'id':_0x3c5b20[_0x490e38],'closed':!![]});}}})[_0xc712('0x1c')](function(_0x4fdab3){logger[_0xc712('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0x4fdab3?util[_0xc712('0x1e')](_0x4fdab3,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe335=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','Setting','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','join'];(function(_0x234606,_0x38306d){var _0x565687=function(_0x287bd2){while(--_0x287bd2){_0x234606['push'](_0x234606['shift']());}};_0x565687(++_0x38306d);}(_0xe335,0x1b0));var _0x5e33=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe335[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x5e33('0x0'));var moment=require(_0x5e33('0x1'));var Redis=require(_0x5e33('0x2'));var util=require(_0x5e33('0x3'));var config=require(_0x5e33('0x4'));var db=require(_0x5e33('0x5'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0x5e33('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5e33('0x7'))(new Redis(config[_0x5e33('0x8')]));function closeInteractions(){var _0x5b4a64=0x0;var _0x5b10fc=[];return db[_0x5e33('0x9')]['find']({'raw':!![],'attributes':['id',_0x5e33('0xa')],'where':{'id':0x1}})[_0x5e33('0xb')](function(_0x26f3c4){_0x5b4a64=_0x26f3c4[_0x5e33('0xa')];if(_0x5b4a64){return db[_0x5e33('0xc')][_0x5e33('0xd')]({'raw':!![],'attributes':['id',_0x5e33('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5e33('0xf')](_0x26f3c4['chatTimeout'],'minutes')}}});}else{return[];}})[_0x5e33('0xb')](function(_0x3fc074){if(_0x3fc074&&_0x3fc074[_0x5e33('0x10')]){_0x5b10fc=_['map'](_0x3fc074||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x5b10fc[_0x5e33('0x11')]());return db[_0x5e33('0xc')][_0x5e33('0x12')]({'closeReason':_0x5e33('0x13'),'disposition':_0x5e33('0x14'),'closed':!![],'closedAt':moment()[_0x5e33('0x15')](_0x5e33('0x16'))},{'where':{'id':_0x5b10fc}});}})[_0x5e33('0xb')](function(){if(_0x5b10fc&&_0x5b10fc[_0x5e33('0x10')]){logger['info'](_0x5e33('0x17'),_0x5b10fc['join']());for(var _0x492197=0x0;_0x492197<_0x5b10fc[_0x5e33('0x10')];_0x492197++){io['emit'](_0x5e33('0x18'),{'id':_0x5b10fc[_0x492197],'closed':!![]});}}})[_0x5e33('0x19')](function(_0x2726a2){logger[_0x5e33('0x1a')](_0x5e33('0x1b'),_0x2726a2?util[_0x5e33('0x1c')](_0x2726a2,{'showHidden':![],'depth':null}):'');});}exports[_0x5e33('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index d5d2e60..538340a 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 _0x459f=['CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','index','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','stop','stop\x20cron','active','update','update\x20cron','util','cron-job-manager','bluebird','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','auth','user','format','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','basename','extname','savename','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','runReport','DefaultReportId','exec\x20custom\x20report\x20id:%s'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0x459f,0xc8));var _0xf459=function(_0x41c2c5,_0x854dfd){_0x41c2c5=_0x41c2c5-0x0;var _0x5367a6=_0x459f[_0x41c2c5];return _0x5367a6;};'use strict';var fs=require('fs');var util=require(_0xf459('0x0'));var path=require('path');var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0xf459('0x1'));var jayson=require('jayson/promise');var BPromise=require(_0xf459('0x2'));var logger=require(_0xf459('0x3'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xf459('0x4'));var analyticDefaultReportController=require(_0xf459('0x5'));var client=jayson[_0xf459('0x6')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x54e1cf,_0x550d5e){return function(){logger[_0xf459('0x7')](_0xf459('0x8'),_0x54e1cf['email']);var _0x416d89=!![];var _0x4e7ea5={'tls':{'rejectUnauthorized':![]}};if(_0x54e1cf[_0xf459('0x9')][_0xf459('0xa')]['service']){_0x4e7ea5['service']=_0x54e1cf[_0xf459('0x9')][_0xf459('0xa')][_0xf459('0xb')];}else{_0x4e7ea5[_0xf459('0xc')]=_0x54e1cf[_0xf459('0x9')][_0xf459('0xa')][_0xf459('0xc')];_0x4e7ea5[_0xf459('0xd')]=_0x54e1cf[_0xf459('0x9')][_0xf459('0xa')]['port'];_0x4e7ea5[_0xf459('0xe')]=_0x54e1cf[_0xf459('0x9')][_0xf459('0xa')]['secure'];}if(_0x54e1cf[_0xf459('0x9')][_0xf459('0xa')]['authentication']){_0x4e7ea5[_0xf459('0xf')]={'user':_0x54e1cf[_0xf459('0x9')]['Smtp'][_0xf459('0x10')],'pass':_0x54e1cf[_0xf459('0x9')][_0xf459('0xa')]['pass']};}var _0x2eec83={'account':_0x4e7ea5,'message':{'from':util[_0xf459('0x11')]('\x22%s\x22\x20<%s>',_0x54e1cf[_0xf459('0x9')][_0xf459('0x12')],_0x54e1cf['MailAccount'][_0xf459('0x13')]||_0x54e1cf[_0xf459('0x9')][_0xf459('0xa')][_0xf459('0x10')]),'to':_0x54e1cf[_0xf459('0x13')],'cc':_0x54e1cf['cc'],'bcc':_0x54e1cf[_0xf459('0x14')],'subject':util[_0xf459('0x11')](_0xf459('0x15'),_0x550d5e[_0xf459('0x12')],_0x54e1cf['subtractNumber'],_0x54e1cf[_0xf459('0x16')])}};var _0x3e1323=path[_0xf459('0x17')](__dirname,_0xf459('0x18'));var _0x4eb968=_0x550d5e['savename'];var _0x53b7bd=util[_0xf459('0x11')]('%s.%s',path[_0xf459('0x19')](_0x550d5e['savename'],path[_0xf459('0x1a')](_0x550d5e[_0xf459('0x1b')])),_0xf459('0x1c'));var _0x2e544b=path[_0xf459('0x17')](_0x3e1323,_0x4eb968);var _0x3894d1=path['join'](_0x3e1323,_0x53b7bd);if(fs[_0xf459('0x1d')](_0x2e544b)){_0x550d5e[_0xf459('0x1e')]=_0xf459('0x1f');_0x2eec83[_0xf459('0x20')][_0xf459('0x21')]=[{'filename':_0x4eb968,'path':_0x2e544b}];_0x2eec83['message'][_0xf459('0x22')]=util['format'](_0xf459('0x23'),JSON[_0xf459('0x24')](_0x550d5e,null,0x2));}else if(fs[_0xf459('0x1d')](_0x3894d1)){_0x550d5e[_0xf459('0x1e')]=_0xf459('0x1f');_0x2eec83['message'][_0xf459('0x21')]=[{'filename':_0x53b7bd,'path':_0x3894d1}];}else{_0x2eec83[_0xf459('0x20')][_0xf459('0x22')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x54e1cf[_0xf459('0x25')]){_0x416d89=![];logger[_0xf459('0x7')](_0xf459('0x26'));}}if(_0x416d89){return client['request'](_0xf459('0x27'),_0x2eec83)[_0xf459('0x28')](function(_0x4f2ece){if(_0x4f2ece[_0xf459('0x29')]){return logger[_0xf459('0x29')]('error\x20mail',JSON[_0xf459('0x24')](_0x4f2ece));}return logger['info'](_0xf459('0x2a'));})[_0xf459('0x2b')](function(_0x214cb1){return logger[_0xf459('0x29')](_0xf459('0x2c'),JSON[_0xf459('0x24')](_0x214cb1));});}};}function handleError(){return function(_0x500dcf){return logger['error'](JSON[_0xf459('0x24')](_0x500dcf));};}function handleResult(_0x277d42){return function(_0x28d17e){logger['info'](_0xf459('0x2d'),JSON[_0xf459('0x24')](_0x28d17e));if(_0x277d42[_0xf459('0x9')]&&_0x277d42[_0xf459('0x9')][_0xf459('0xa')]&&!_[_0xf459('0x2e')](_0x277d42[_0xf459('0x13')])){setTimeout(handleSendEmail(_0x277d42,_0x28d17e),0x3c*0x3e8);}};}function handleJob(_0x3e5fed){return function(){try{if(_[_0xf459('0x2e')](_0x3e5fed[_0xf459('0x2f')])){return logger[_0xf459('0x7')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xf459('0x2e')](_0x3e5fed[_0xf459('0x16')])){return logger[_0xf459('0x7')](_0xf459('0x30'));}var _0x499675={'startDate':moment()[_0xf459('0x31')](_0x3e5fed[_0xf459('0x2f')],_0x3e5fed[_0xf459('0x16')])[_0xf459('0x11')](_0xf459('0x32')),'endDate':moment()[_0xf459('0x11')](_0xf459('0x32')),'type':_0xf459('0x33'),'output':_0x3e5fed['output'],'name':_0x3e5fed[_0xf459('0x12')]};if(!_[_0xf459('0x2e')](_0x3e5fed['DefaultReportId'])){logger[_0xf459('0x7')]('exec\x20defaul\x20report\x20id:%s',_0x3e5fed['DefaultReportId']);return analyticDefaultReportController[_0xf459('0x34')]({'id':_0x3e5fed[_0xf459('0x35')]},_0x499675)['then'](handleResult(_0x3e5fed))[_0xf459('0x2b')](handleError());}if(!_['isNil'](_0x3e5fed['CustomReportId'])){logger[_0xf459('0x7')](_0xf459('0x36'),_0x3e5fed[_0xf459('0x37')]);return analyticCustomReportController[_0xf459('0x34')]({'id':_0x3e5fed[_0xf459('0x37')]},_0x499675)['then'](handleResult(_0x3e5fed))[_0xf459('0x2b')](handleError());}}catch(_0x2d101c){logger[_0xf459('0x29')](JSON[_0xf459('0x24')](_0x2d101c));}return logger['info'](_0xf459('0x38'));};}function getJobs(_0xff319d){var _0x5e0c02={};if(_0xff319d){_0x5e0c02['id']=_0xff319d;}return db[_0xf459('0x39')][_0xf459('0x3a')]({'where':_0x5e0c02,'include':[{'model':db[_0xf459('0x9')],'attributes':['id',_0xf459('0x12'),_0xf459('0x13')],'include':[{'model':db[_0xf459('0x3b')],'as':_0xf459('0xa')}]}]})[_0xf459('0x28')](function(_0x15488a){var _0x2f5738=_[_0xf459('0x3c')](manager[_0xf459('0x3d')]);var _0x451788=_[_0xf459('0x3e')](_0x15488a,function(_0x1f6ad3){return _0x1f6ad3['id'][_0xf459('0x3f')]();});var _0x40885d=_[_0xf459('0x40')](_0x15488a,function(_0x3743ff){return _0x3743ff['id'][_0xf459('0x3f')]();});var _0x3f9a37=_0xff319d?_0x451788:_[_0xf459('0x41')](_0x451788,_0x2f5738);var _0x24d16f=_[_0xf459('0x42')](_0x451788,_0x2f5738);var _0x4b5b11=_[_0xf459('0x41')](_0x2f5738,_0x451788);var _0x228b4e;var _0x26817c;for(_0x228b4e=0x0;_0x228b4e<_0x4b5b11[_0xf459('0x43')]&&!_0xff319d;_0x228b4e+=0x1){_0x26817c=_0x4b5b11[_0x228b4e]['toString']();if(manager[_0xf459('0x44')](_0x26817c)){manager['stop'](_0x26817c);manager[_0xf459('0x45')](_0x26817c);logger[_0xf459('0x7')]('delete\x20cron',_0x26817c);}}logger[_0xf459('0x7')]('toRun',JSON[_0xf459('0x24')](_0x3f9a37));for(_0x228b4e=0x0;_0x228b4e<_0x3f9a37[_0xf459('0x43')];_0x228b4e+=0x1){_0x26817c=_0x3f9a37[_0x228b4e][_0xf459('0x3f')]();logger['info'](_0xf459('0x46'),_0x26817c);if(_0xff319d){logger['info']('my\x20id',_0xff319d);logger[_0xf459('0x7')](JSON['stringify'](_0x40885d[_0x26817c]));BPromise[_0xf459('0x47')]()[_0xf459('0x28')](handleJob(_0x40885d[_0x26817c]));logger['info'](_0xf459('0x48'),_0x40885d[_0x26817c][_0xf459('0x12')],_0x40885d[_0x26817c][_0xf459('0x49')]);}else if(_0x40885d[_0x26817c][_0xf459('0x49')]&&_0x40885d[_0x26817c]['active']&&moment()[_0xf459('0x4a')](_0x40885d[_0x26817c][_0xf459('0x4b')],_0x40885d[_0x26817c][_0xf459('0x4c')])){manager[_0xf459('0x4d')](_0x26817c,_0x40885d[_0x26817c][_0xf459('0x49')],handleJob(_0x40885d[_0x26817c]));manager[_0xf459('0x4e')](_0x26817c);logger[_0xf459('0x7')](_0xf459('0x4f'),_0x40885d[_0x26817c][_0xf459('0x12')],_0x40885d[_0x26817c][_0xf459('0x49')]);}else if(manager['exists'](_0x26817c)){manager[_0xf459('0x50')](_0x26817c);manager['deleteJob'](_0x26817c);logger[_0xf459('0x7')](_0xf459('0x51'),_0x40885d[_0x26817c][_0xf459('0x12')],_0x40885d[_0x26817c][_0xf459('0x49')]);}}for(_0x228b4e=0x0,_0x26817c;_0x228b4e<_0x24d16f[_0xf459('0x43')]&&!_0xff319d;_0x228b4e+=0x1){_0x26817c=_0x24d16f[_0x228b4e]['toString']();if(manager[_0xf459('0x44')](_0x26817c)){if(_0x40885d[_0x26817c][_0xf459('0x49')]&&_0x40885d[_0x26817c][_0xf459('0x52')]&&moment()[_0xf459('0x4a')](_0x40885d[_0x26817c][_0xf459('0x4b')],_0x40885d[_0x26817c][_0xf459('0x4c')])){manager[_0xf459('0x53')](_0x26817c,_0x40885d[_0x26817c][_0xf459('0x49')],handleJob(_0x40885d[_0x26817c]));logger[_0xf459('0x7')](_0xf459('0x54'),_0x40885d[_0x26817c][_0xf459('0x12')],_0x40885d[_0x26817c]['cron']);}else{manager[_0xf459('0x50')](_0x26817c);manager[_0xf459('0x45')](_0x26817c);logger[_0xf459('0x7')](_0xf459('0x51'),_0x40885d[_0x26817c][_0xf459('0x12')],_0x40885d[_0x26817c]['cron']);}}}})[_0xf459('0x2b')](function(_0x5b682e){logger[_0xf459('0x29')](JSON[_0xf459('0x24')](_0x5b682e));});}exports['run']=function(_0x596673){return getJobs(_0x596673);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x05d8=['message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','error','stringify','email\x20sent','error\x20mail','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','catch','CustomReportId','no\x20report\x20id','Schedule','findAll','keys','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','add\x20cron','stop\x20cron','endAt','update','update\x20cron','run','util','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','join','../../files/reports','savename','extname','zip','existsSync','status','Sent'];(function(_0x2e8131,_0x57709d){var _0x5c95e9=function(_0x1795c9){while(--_0x1795c9){_0x2e8131['push'](_0x2e8131['shift']());}};_0x5c95e9(++_0x57709d);}(_0x05d8,0xf1));var _0x805d=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x05d8[_0x58dc25];return _0x21b0a7;};'use strict';var fs=require('fs');var util=require(_0x805d('0x0'));var path=require('path');var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x805d('0x1'));var jayson=require(_0x805d('0x2'));var BPromise=require(_0x805d('0x3'));var logger=require('../logger')(_0x805d('0x4'));var db=require(_0x805d('0x5'))['db'];var analyticCustomReportController=require(_0x805d('0x6'));var analyticDefaultReportController=require(_0x805d('0x7'));var client=jayson[_0x805d('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2b34cc,_0x5d1431){return function(){logger[_0x805d('0x9')](_0x805d('0xa'),_0x2b34cc['email']);var _0xc14d43=!![];var _0x18a931={'tls':{'rejectUnauthorized':![]}};if(_0x2b34cc[_0x805d('0xb')][_0x805d('0xc')][_0x805d('0xd')]){_0x18a931[_0x805d('0xd')]=_0x2b34cc[_0x805d('0xb')][_0x805d('0xc')][_0x805d('0xd')];}else{_0x18a931[_0x805d('0xe')]=_0x2b34cc[_0x805d('0xb')][_0x805d('0xc')][_0x805d('0xe')];_0x18a931['port']=_0x2b34cc['MailAccount']['Smtp'][_0x805d('0xf')];_0x18a931[_0x805d('0x10')]=_0x2b34cc[_0x805d('0xb')][_0x805d('0xc')]['secure'];}if(_0x2b34cc[_0x805d('0xb')]['Smtp'][_0x805d('0x11')]){_0x18a931[_0x805d('0x12')]={'user':_0x2b34cc['MailAccount']['Smtp'][_0x805d('0x13')],'pass':_0x2b34cc[_0x805d('0xb')][_0x805d('0xc')][_0x805d('0x14')]};}var _0x278498={'account':_0x18a931,'message':{'from':util[_0x805d('0x15')](_0x805d('0x16'),_0x2b34cc['MailAccount'][_0x805d('0x17')],_0x2b34cc[_0x805d('0xb')][_0x805d('0x18')]||_0x2b34cc[_0x805d('0xb')][_0x805d('0xc')]['user']),'to':_0x2b34cc[_0x805d('0x18')],'cc':_0x2b34cc['cc'],'bcc':_0x2b34cc[_0x805d('0x19')],'subject':util[_0x805d('0x15')](_0x805d('0x1a'),_0x5d1431[_0x805d('0x17')],_0x2b34cc['subtractNumber'],_0x2b34cc['subtractUnit'])}};var _0x500974=path[_0x805d('0x1b')](__dirname,_0x805d('0x1c'));var _0x1b00c3=_0x5d1431['savename'];var _0x49c610=util[_0x805d('0x15')]('%s.%s',path['basename'](_0x5d1431[_0x805d('0x1d')],path[_0x805d('0x1e')](_0x5d1431['savename'])),_0x805d('0x1f'));var _0x258eea=path[_0x805d('0x1b')](_0x500974,_0x1b00c3);var _0x58f704=path['join'](_0x500974,_0x49c610);if(fs[_0x805d('0x20')](_0x258eea)){_0x5d1431[_0x805d('0x21')]=_0x805d('0x22');_0x278498[_0x805d('0x23')][_0x805d('0x24')]=[{'filename':_0x1b00c3,'path':_0x258eea}];_0x278498[_0x805d('0x23')]['text']=util[_0x805d('0x15')](_0x805d('0x25'),JSON['stringify'](_0x5d1431,null,0x2));}else if(fs[_0x805d('0x20')](_0x58f704)){_0x5d1431['status']=_0x805d('0x22');_0x278498[_0x805d('0x23')][_0x805d('0x24')]=[{'filename':_0x49c610,'path':_0x58f704}];}else{_0x278498['message'][_0x805d('0x26')]=_0x805d('0x27');if(!_0x2b34cc[_0x805d('0x28')]){_0xc14d43=![];logger[_0x805d('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0xc14d43){return client[_0x805d('0x29')]('SendMail',_0x278498)['then'](function(_0x19f76b){if(_0x19f76b['error']){return logger[_0x805d('0x2a')]('error\x20mail',JSON[_0x805d('0x2b')](_0x19f76b));}return logger[_0x805d('0x9')](_0x805d('0x2c'));})['catch'](function(_0x3aa078){return logger[_0x805d('0x2a')](_0x805d('0x2d'),JSON['stringify'](_0x3aa078));});}};}function handleError(){return function(_0x405f0c){return logger[_0x805d('0x2a')](JSON[_0x805d('0x2b')](_0x405f0c));};}function handleResult(_0x5d0350){return function(_0x834bb8){logger['info'](_0x805d('0x2e'),JSON['stringify'](_0x834bb8));if(_0x5d0350[_0x805d('0xb')]&&_0x5d0350[_0x805d('0xb')][_0x805d('0xc')]&&!_[_0x805d('0x2f')](_0x5d0350['email'])){setTimeout(handleSendEmail(_0x5d0350,_0x834bb8),0x3c*0x3e8);}};}function handleJob(_0x11d22d){return function(){try{if(_['isNil'](_0x11d22d[_0x805d('0x30')])){return logger['info'](_0x805d('0x31'));}if(_[_0x805d('0x2f')](_0x11d22d[_0x805d('0x32')])){return logger['info'](_0x805d('0x33'));}var _0x34b96e={'startDate':moment()[_0x805d('0x34')](_0x11d22d[_0x805d('0x30')],_0x11d22d[_0x805d('0x32')])[_0x805d('0x15')](_0x805d('0x35')),'endDate':moment()[_0x805d('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x11d22d[_0x805d('0x36')],'name':_0x11d22d[_0x805d('0x17')]};if(!_[_0x805d('0x2f')](_0x11d22d[_0x805d('0x37')])){logger[_0x805d('0x9')](_0x805d('0x38'),_0x11d22d[_0x805d('0x37')]);return analyticDefaultReportController[_0x805d('0x39')]({'id':_0x11d22d['DefaultReportId']},_0x34b96e)[_0x805d('0x3a')](handleResult(_0x11d22d))[_0x805d('0x3b')](handleError());}if(!_[_0x805d('0x2f')](_0x11d22d[_0x805d('0x3c')])){logger[_0x805d('0x9')]('exec\x20custom\x20report\x20id:%s',_0x11d22d['CustomReportId']);return analyticCustomReportController[_0x805d('0x39')]({'id':_0x11d22d[_0x805d('0x3c')]},_0x34b96e)[_0x805d('0x3a')](handleResult(_0x11d22d))['catch'](handleError());}}catch(_0x6e5f78){logger['error'](JSON[_0x805d('0x2b')](_0x6e5f78));}return logger[_0x805d('0x9')](_0x805d('0x3d'));};}function getJobs(_0x278857){var _0x3c149d={};if(_0x278857){_0x3c149d['id']=_0x278857;}return db[_0x805d('0x3e')][_0x805d('0x3f')]({'where':_0x3c149d,'include':[{'model':db[_0x805d('0xb')],'attributes':['id',_0x805d('0x17'),_0x805d('0x18')],'include':[{'model':db['MailServerOut'],'as':_0x805d('0xc')}]}]})[_0x805d('0x3a')](function(_0x42b827){var _0x66c273=_[_0x805d('0x40')](manager[_0x805d('0x41')]);var _0x2bf466=_[_0x805d('0x42')](_0x42b827,function(_0x4398ff){return _0x4398ff['id']['toString']();});var _0x4079f1=_[_0x805d('0x43')](_0x42b827,function(_0x169d8c){return _0x169d8c['id'][_0x805d('0x44')]();});var _0x33e54c=_0x278857?_0x2bf466:_[_0x805d('0x45')](_0x2bf466,_0x66c273);var _0x11b546=_[_0x805d('0x46')](_0x2bf466,_0x66c273);var _0xc24fc3=_['difference'](_0x66c273,_0x2bf466);var _0x3dbf36;var _0x423639;for(_0x3dbf36=0x0;_0x3dbf36<_0xc24fc3[_0x805d('0x47')]&&!_0x278857;_0x3dbf36+=0x1){_0x423639=_0xc24fc3[_0x3dbf36][_0x805d('0x44')]();if(manager[_0x805d('0x48')](_0x423639)){manager[_0x805d('0x49')](_0x423639);manager[_0x805d('0x4a')](_0x423639);logger[_0x805d('0x9')](_0x805d('0x4b'),_0x423639);}}logger['info'](_0x805d('0x4c'),JSON[_0x805d('0x2b')](_0x33e54c));for(_0x3dbf36=0x0;_0x3dbf36<_0x33e54c[_0x805d('0x47')];_0x3dbf36+=0x1){_0x423639=_0x33e54c[_0x3dbf36][_0x805d('0x44')]();logger[_0x805d('0x9')](_0x805d('0x4d'),_0x423639);if(_0x278857){logger[_0x805d('0x9')](_0x805d('0x4e'),_0x278857);logger[_0x805d('0x9')](JSON[_0x805d('0x2b')](_0x4079f1[_0x423639]));BPromise[_0x805d('0x4f')]()[_0x805d('0x3a')](handleJob(_0x4079f1[_0x423639]));logger[_0x805d('0x9')](_0x805d('0x50'),_0x4079f1[_0x423639][_0x805d('0x17')],_0x4079f1[_0x423639][_0x805d('0x51')]);}else if(_0x4079f1[_0x423639][_0x805d('0x51')]&&_0x4079f1[_0x423639][_0x805d('0x52')]&&moment()[_0x805d('0x53')](_0x4079f1[_0x423639][_0x805d('0x54')],_0x4079f1[_0x423639]['endAt'])){manager[_0x805d('0x55')](_0x423639,_0x4079f1[_0x423639][_0x805d('0x51')],handleJob(_0x4079f1[_0x423639]));manager['start'](_0x423639);logger[_0x805d('0x9')](_0x805d('0x56'),_0x4079f1[_0x423639]['name'],_0x4079f1[_0x423639][_0x805d('0x51')]);}else if(manager[_0x805d('0x48')](_0x423639)){manager[_0x805d('0x49')](_0x423639);manager[_0x805d('0x4a')](_0x423639);logger[_0x805d('0x9')](_0x805d('0x57'),_0x4079f1[_0x423639][_0x805d('0x17')],_0x4079f1[_0x423639][_0x805d('0x51')]);}}for(_0x3dbf36=0x0,_0x423639;_0x3dbf36<_0x11b546[_0x805d('0x47')]&&!_0x278857;_0x3dbf36+=0x1){_0x423639=_0x11b546[_0x3dbf36][_0x805d('0x44')]();if(manager[_0x805d('0x48')](_0x423639)){if(_0x4079f1[_0x423639][_0x805d('0x51')]&&_0x4079f1[_0x423639][_0x805d('0x52')]&&moment()[_0x805d('0x53')](_0x4079f1[_0x423639][_0x805d('0x54')],_0x4079f1[_0x423639][_0x805d('0x58')])){manager[_0x805d('0x59')](_0x423639,_0x4079f1[_0x423639][_0x805d('0x51')],handleJob(_0x4079f1[_0x423639]));logger[_0x805d('0x9')](_0x805d('0x5a'),_0x4079f1[_0x423639][_0x805d('0x17')],_0x4079f1[_0x423639]['cron']);}else{manager[_0x805d('0x49')](_0x423639);manager[_0x805d('0x4a')](_0x423639);logger[_0x805d('0x9')]('stop\x20cron',_0x4079f1[_0x423639]['name'],_0x4079f1[_0x423639][_0x805d('0x51')]);}}}})[_0x805d('0x3b')](function(_0x543f87){logger['error'](JSON[_0x805d('0x2b')](_0x543f87));});}exports[_0x805d('0x5b')]=function(_0x40b6e3){return getJobs(_0x40b6e3);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index fae17fb..37cd331 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 _0x0b70=['[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','CloudProvider','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','error','aws-sdk','util','bluebird','../../config/logger','transcribe','getTranscriptionJob','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri'];(function(_0x33d581,_0x2da6d0){var _0x3320da=function(_0x17d76a){while(--_0x17d76a){_0x33d581['push'](_0x33d581['shift']());}};_0x3320da(++_0x2da6d0);}(_0x0b70,0x159));var _0x00b7=function(_0x2d81ab,_0xd6dd90){_0x2d81ab=_0x2d81ab-0x0;var _0x522817=_0x0b70[_0x2d81ab];return _0x522817;};var _=require('lodash');var AWS=require(_0x00b7('0x0'));var rp=require('request-promise');var util=require(_0x00b7('0x1'));var BPromise=require(_0x00b7('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x00b7('0x3'))(_0x00b7('0x4'));function getTranscriptionJob(_0x43e9a3,_0x5dbda0,_0x275d4b,_0x4c0d64){return new Promise(function(_0x81e64,_0x54332d){var _0x3f8137=new AWS['TranscribeService']({'accessKeyId':_0x5dbda0,'secretAccessKey':_0x43e9a3,'region':_0x275d4b});_0x3f8137[_0x00b7('0x5')]({'TranscriptionJobName':_0x4c0d64},function(_0x56adcc,_0x420f35){if(_0x56adcc){return _0x54332d(_0x56adcc);}else{return _0x81e64(_0x420f35);}});});}function sentiment(_0x26aa66,_0x3c4f09,_0x203c15,_0x5b9752,_0x3d245d){return new Promise(function(_0xe3599a,_0x11198e){var _0x56fbe6=new AWS[(_0x00b7('0x6'))]({'accessKeyId':_0x3c4f09,'secretAccessKey':_0x26aa66,'region':_0x203c15});_0x56fbe6['detectSentiment']({'Text':_0x5b9752,'LanguageCode':_0x3d245d[_0x00b7('0x7')](0x0,0x2)},function(_0x18f8b6,_0xd9a4cb){if(_0x18f8b6){return _0x11198e(_0x18f8b6);}else{return _0xe3599a(_0xd9a4cb);}});});}function checkTranscribeJob(_0x457f3c,_0x26619a,_0x32e813){var _0x14dce6;return new BPromise(function(_0x47edc1,_0x34efcc){logger[_0x00b7('0x8')](util['format'](_0x00b7('0x9'),_0x457f3c['id'],_0x457f3c[_0x00b7('0xa')]));return getTranscriptionJob(_0x32e813['data1'],_0x32e813['data2'],_0x26619a[_0x00b7('0xb')],_0x457f3c[_0x00b7('0xa')])[_0x00b7('0xc')](function(_0x17e0d0){logger[_0x00b7('0x8')](util[_0x00b7('0xd')](_0x00b7('0xe'),_0x457f3c['id'],_0x457f3c[_0x00b7('0xa')],_0x17e0d0['TranscriptionJob'][_0x00b7('0xf')]));if(!_0x457f3c['fileText']){switch(_0x17e0d0[_0x00b7('0x10')][_0x00b7('0xf')]){case _0x00b7('0x11'):var _0x19681b={'transcribeStatus':_0x17e0d0[_0x00b7('0x10')][_0x00b7('0xf')],'fileUri':_0x17e0d0[_0x00b7('0x10')][_0x00b7('0x12')][_0x00b7('0x13')]};logger[_0x00b7('0x8')](util[_0x00b7('0xd')](_0x00b7('0x14'),_0x457f3c['id']));return rp({'uri':_0x17e0d0[_0x00b7('0x10')][_0x00b7('0x12')][_0x00b7('0x13')],'json':!![]})[_0x00b7('0xc')](function(_0x208636){logger['info'](util[_0x00b7('0xd')](_0x00b7('0x15'),_0x457f3c['id']));if(_0x208636&&_0x208636[_0x00b7('0x16')]&&_0x208636[_0x00b7('0x16')][_0x00b7('0x17')]&&_0x208636[_0x00b7('0x16')][_0x00b7('0x17')][_0x00b7('0x18')]){_0x19681b[_0x00b7('0x19')]='';for(var _0x438d3f=0x0;_0x438d3f<_0x208636[_0x00b7('0x16')][_0x00b7('0x17')][_0x00b7('0x18')];_0x438d3f++){_0x19681b['fileText']+=_0x208636[_0x00b7('0x16')]['transcripts'][_0x438d3f][_0x00b7('0x1a')]+'';}}return _0x457f3c[_0x00b7('0x1b')](_0x19681b);})[_0x00b7('0xc')](function(){logger[_0x00b7('0x8')](util[_0x00b7('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x457f3c['id']));if(!_0x457f3c[_0x00b7('0x1c')]){throw new db[(_0x00b7('0x1d'))][(_0x00b7('0x1e'))](_0x00b7('0x1f'));}if(!_0x26619a[_0x00b7('0x20')]||!_0x26619a[_0x00b7('0x21')]||!_0x26619a[_0x00b7('0x22')]||!_0x26619a[_0x00b7('0x23')]||!_0x26619a[_0x00b7('0x24')]){throw new db[(_0x00b7('0x1d'))][(_0x00b7('0x1e'))](_0x00b7('0x25'));}if(!_0x19681b[_0x00b7('0x19')]){throw new Error('Transcript\x20not\x20available');}if(_0x26619a[_0x00b7('0x21')]===_0x32e813['id']){return _0x32e813;}else{return db['CloudProvider'][_0x00b7('0x26')]({'where':{'id':_settings[_0x00b7('0x21')]}});}})['then'](function(_0x2c20b6){if(!_0x2c20b6){throw new db[(_0x00b7('0x1d'))][(_0x00b7('0x1e'))](_0x00b7('0x27'));}if(!_0x2c20b6[_0x00b7('0x28')]||!_0x2c20b6[_0x00b7('0x29')]){throw new db[(_0x00b7('0x1d'))][(_0x00b7('0x1e'))](_0x00b7('0x2a'));}_0x14dce6=_0x2c20b6;logger[_0x00b7('0x8')](util[_0x00b7('0xd')](_0x00b7('0x2b'),_0x457f3c['id']));return sentiment(_0x14dce6[_0x00b7('0x28')],_0x14dce6[_0x00b7('0x29')],_0x26619a['sentimentRegion'],_0x19681b[_0x00b7('0x19')],_0x26619a[_0x00b7('0x23')]);})[_0x00b7('0xc')](function(_0x3c0ca2){logger['info'](util[_0x00b7('0xd')](_0x00b7('0x2c'),_0x457f3c['id']));return _0x457f3c[_0x00b7('0x1b')]({'sentiment':_0x3c0ca2[_0x00b7('0x2d')],'sPositive':_0x3c0ca2['SentimentScore'][_0x00b7('0x2e')],'sNegative':_0x3c0ca2[_0x00b7('0x2f')][_0x00b7('0x30')],'sMixed':_0x3c0ca2[_0x00b7('0x2f')][_0x00b7('0x31')],'sNeutral':_0x3c0ca2['SentimentScore'][_0x00b7('0x32')]});})[_0x00b7('0xc')](function(){logger[_0x00b7('0x8')](util[_0x00b7('0xd')](_0x00b7('0x33'),_0x457f3c['id']));_0x47edc1();});case _0x00b7('0x34'):return _0x457f3c['update']({'transcribeStatus':'FAILED','failureReason':_0x17e0d0[_0x00b7('0x10')][_0x00b7('0x35')]})[_0x00b7('0xc')](function(){logger[_0x00b7('0x8')](util[_0x00b7('0xd')](_0x00b7('0x33'),_0x457f3c['id']));_0x47edc1();});default:logger[_0x00b7('0x8')](util['format'](_0x00b7('0x36'),_0x457f3c['id']));break;}}else{return BPromise[_0x00b7('0x37')]()[_0x00b7('0xc')](function(){if(!_0x457f3c['tempSentiment']){throw new db[(_0x00b7('0x1d'))][(_0x00b7('0x1e'))](_0x00b7('0x1f'));}if(!_0x26619a['sentiment']||!_0x26619a['sentimentAccountId']||!_0x26619a[_0x00b7('0x22')]||!_0x26619a[_0x00b7('0x23')]||!_0x26619a[_0x00b7('0x24')]){throw new db[(_0x00b7('0x1d'))]['ValidationError'](_0x00b7('0x25'));}if(!_0x457f3c[_0x00b7('0x19')]){throw new Error(_0x00b7('0x38'));}if(_0x26619a[_0x00b7('0x21')]===_0x32e813['id']){return _0x32e813;}else{return db[_0x00b7('0x39')][_0x00b7('0x26')]({'where':{'id':_settings[_0x00b7('0x21')]}});}})[_0x00b7('0xc')](function(_0x14bc7e){if(!_0x14bc7e){throw new db[(_0x00b7('0x1d'))][(_0x00b7('0x1e'))](_0x00b7('0x27'));}if(!_0x14bc7e['data1']||!_0x14bc7e['data2']){throw new db[(_0x00b7('0x1d'))][(_0x00b7('0x1e'))](_0x00b7('0x2a'));}_0x14dce6=_0x14bc7e;logger[_0x00b7('0x8')](util[_0x00b7('0xd')](_0x00b7('0x2b'),_0x457f3c['id']));return sentiment(_0x14dce6['data1'],_0x14dce6['data2'],_0x26619a[_0x00b7('0x22')],_0x457f3c['fileText'],_0x26619a[_0x00b7('0x23')]);})[_0x00b7('0xc')](function(_0x372e17){logger['info'](util[_0x00b7('0xd')](_0x00b7('0x2c'),_0x457f3c['id']));return _0x457f3c[_0x00b7('0x1b')]({'sentiment':_0x372e17['Sentiment'],'sPositive':_0x372e17[_0x00b7('0x2f')][_0x00b7('0x2e')],'sNegative':_0x372e17[_0x00b7('0x2f')][_0x00b7('0x30')],'sMixed':_0x372e17['SentimentScore'][_0x00b7('0x31')],'sNeutral':_0x372e17[_0x00b7('0x2f')][_0x00b7('0x32')],'transcribeStatus':_0x00b7('0x11')});})[_0x00b7('0xc')](function(){logger['info'](util[_0x00b7('0xd')](_0x00b7('0x33'),_0x457f3c['id']));_0x47edc1();});}})['catch'](function(_0x1d7301){if(_0x1d7301){if(!_0x1d7301['name']||_0x1d7301[_0x00b7('0x3a')]!=='SequelizeValidationError'){logger['error'](util[_0x00b7('0xd')](_0x00b7('0x3b'),_0x457f3c['id']),util[_0x00b7('0x3c')](_0x1d7301,{'showHidden':![],'depth':null}));}}_0x47edc1();});});}function checkTranscribe(){var _0x176e37;var _0x511f7d;var _0x3047ac;return db[_0x00b7('0x3d')][_0x00b7('0x3e')]({'where':{'transcribeStatus':_0x00b7('0x3f')}})[_0x00b7('0xc')](function(_0x579bb7){if(!_0x579bb7||!_0x579bb7['length']){throw new db[(_0x00b7('0x1d'))][(_0x00b7('0x1e'))](_0x00b7('0x40'));}_0x176e37=_0x579bb7;return db[_0x00b7('0x41')][_0x00b7('0x26')]({'where':{'id':0x1}});})[_0x00b7('0xc')](function(_0x32747d){if(!_0x32747d){throw new db[(_0x00b7('0x1d'))][(_0x00b7('0x1e'))](_0x00b7('0x42'));}_0x511f7d=_0x32747d;if(!_0x511f7d['transcribe']||!_0x511f7d[_0x00b7('0x43')]||!_0x511f7d[_0x00b7('0xb')]||!_0x511f7d[_0x00b7('0x23')]||!_0x511f7d[_0x00b7('0x24')]){throw new db[(_0x00b7('0x1d'))][(_0x00b7('0x1e'))](_0x00b7('0x44'));}return db[_0x00b7('0x39')][_0x00b7('0x26')]({'where':{'id':_0x511f7d[_0x00b7('0x43')]}});})[_0x00b7('0xc')](function(_0x391e3f){if(!_0x391e3f){throw new db[(_0x00b7('0x1d'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x391e3f[_0x00b7('0x28')]||!_0x391e3f[_0x00b7('0x29')]){throw new db[(_0x00b7('0x1d'))][(_0x00b7('0x1e'))](_0x00b7('0x2a'));}_0x3047ac=_0x391e3f;var _0x5e36e8=[];_0x176e37[_0x00b7('0x45')](function(_0x2c46a7){_0x5e36e8[_0x00b7('0x46')](checkTranscribeJob(_0x2c46a7,_0x511f7d,_0x3047ac));});return BPromise[_0x00b7('0x47')](_0x5e36e8);})['catch'](function(_0x3fdd1a){if(_0x3fdd1a){if(!_0x3fdd1a[_0x00b7('0x3a')]||_0x3fdd1a[_0x00b7('0x3a')]!=='SequelizeValidationError'){logger[_0x00b7('0x48')](util[_0x00b7('0x3c')](_0x3fdd1a,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xa788=['update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','ValidationError','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','SentimentScore','Positive','Mixed','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Negative','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','push','inspect','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','Comprehend','detectSentiment','substring','info','format','transcribeName','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','then','results','transcripts','length','transcript'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa788,0x70));var _0x8a78=function(_0x4c1ce5,_0x444dd6){_0x4c1ce5=_0x4c1ce5-0x0;var _0x11b0e2=_0xa788[_0x4c1ce5];return _0x11b0e2;};var _=require(_0x8a78('0x0'));var AWS=require(_0x8a78('0x1'));var rp=require(_0x8a78('0x2'));var util=require(_0x8a78('0x3'));var BPromise=require('bluebird');var db=require(_0x8a78('0x4'))['db'];var logger=require(_0x8a78('0x5'))('transcribe');function getTranscriptionJob(_0x627de3,_0x12ce72,_0x5af5af,_0x47be20){return new Promise(function(_0x506edf,_0x316a62){var _0x344c6d=new AWS['TranscribeService']({'accessKeyId':_0x12ce72,'secretAccessKey':_0x627de3,'region':_0x5af5af});_0x344c6d['getTranscriptionJob']({'TranscriptionJobName':_0x47be20},function(_0x22ebca,_0x542ac5){if(_0x22ebca){return _0x316a62(_0x22ebca);}else{return _0x506edf(_0x542ac5);}});});}function sentiment(_0x5e655c,_0x234cec,_0x811201,_0x4e2918,_0x4361e7){return new Promise(function(_0x169e69,_0x4324cc){var _0x24cf71=new AWS[(_0x8a78('0x6'))]({'accessKeyId':_0x234cec,'secretAccessKey':_0x5e655c,'region':_0x811201});_0x24cf71[_0x8a78('0x7')]({'Text':_0x4e2918,'LanguageCode':_0x4361e7[_0x8a78('0x8')](0x0,0x2)},function(_0xa706cd,_0x10f17c){if(_0xa706cd){return _0x4324cc(_0xa706cd);}else{return _0x169e69(_0x10f17c);}});});}function checkTranscribeJob(_0x574808,_0x299461,_0x294b34){var _0x31b77e;return new BPromise(function(_0x4b4bc8,_0x200dde){logger[_0x8a78('0x9')](util[_0x8a78('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x574808['id'],_0x574808[_0x8a78('0xb')]));return getTranscriptionJob(_0x294b34['data1'],_0x294b34[_0x8a78('0xc')],_0x299461['transcribeRegion'],_0x574808[_0x8a78('0xb')])['then'](function(_0x57212b){logger['info'](util[_0x8a78('0xa')](_0x8a78('0xd'),_0x574808['id'],_0x574808[_0x8a78('0xb')],_0x57212b[_0x8a78('0xe')][_0x8a78('0xf')]));if(!_0x574808[_0x8a78('0x10')]){switch(_0x57212b[_0x8a78('0xe')][_0x8a78('0xf')]){case _0x8a78('0x11'):var _0x3ea9f1={'transcribeStatus':_0x57212b[_0x8a78('0xe')][_0x8a78('0xf')],'fileUri':_0x57212b[_0x8a78('0xe')][_0x8a78('0x12')]['TranscriptFileUri']};logger[_0x8a78('0x9')](util['format'](_0x8a78('0x13'),_0x574808['id']));return rp({'uri':_0x57212b[_0x8a78('0xe')]['Transcript'][_0x8a78('0x14')],'json':!![]})[_0x8a78('0x15')](function(_0x2ceb56){logger[_0x8a78('0x9')](util[_0x8a78('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x574808['id']));if(_0x2ceb56&&_0x2ceb56[_0x8a78('0x16')]&&_0x2ceb56['results'][_0x8a78('0x17')]&&_0x2ceb56[_0x8a78('0x16')][_0x8a78('0x17')][_0x8a78('0x18')]){_0x3ea9f1[_0x8a78('0x10')]='';for(var _0x326add=0x0;_0x326add<_0x2ceb56['results']['transcripts'][_0x8a78('0x18')];_0x326add++){_0x3ea9f1[_0x8a78('0x10')]+=_0x2ceb56[_0x8a78('0x16')]['transcripts'][_0x326add][_0x8a78('0x19')]+'';}}return _0x574808[_0x8a78('0x1a')](_0x3ea9f1);})[_0x8a78('0x15')](function(){logger[_0x8a78('0x9')](util[_0x8a78('0xa')](_0x8a78('0x1b'),_0x574808['id']));if(!_0x574808[_0x8a78('0x1c')]){throw new db['Sequelize']['ValidationError'](_0x8a78('0x1d'));}if(!_0x299461[_0x8a78('0x1e')]||!_0x299461[_0x8a78('0x1f')]||!_0x299461[_0x8a78('0x20')]||!_0x299461['language']||!_0x299461[_0x8a78('0x21')]){throw new db[(_0x8a78('0x22'))]['ValidationError'](_0x8a78('0x23'));}if(!_0x3ea9f1[_0x8a78('0x10')]){throw new Error(_0x8a78('0x24'));}if(_0x299461[_0x8a78('0x1f')]===_0x294b34['id']){return _0x294b34;}else{return db[_0x8a78('0x25')][_0x8a78('0x26')]({'where':{'id':_settings[_0x8a78('0x1f')]}});}})[_0x8a78('0x15')](function(_0x2f4efb){if(!_0x2f4efb){throw new db[(_0x8a78('0x22'))][(_0x8a78('0x27'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2f4efb[_0x8a78('0x28')]||!_0x2f4efb[_0x8a78('0xc')]){throw new db['Sequelize'][(_0x8a78('0x27'))]('Cloud\x20Provider\x20not\x20configured');}_0x31b77e=_0x2f4efb;logger[_0x8a78('0x9')](util[_0x8a78('0xa')](_0x8a78('0x29'),_0x574808['id']));return sentiment(_0x31b77e['data1'],_0x31b77e['data2'],_0x299461[_0x8a78('0x20')],_0x3ea9f1['fileText'],_0x299461[_0x8a78('0x2a')]);})[_0x8a78('0x15')](function(_0x260e9c){logger[_0x8a78('0x9')](util[_0x8a78('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x574808['id']));return _0x574808[_0x8a78('0x1a')]({'sentiment':_0x260e9c[_0x8a78('0x2b')],'sPositive':_0x260e9c[_0x8a78('0x2c')][_0x8a78('0x2d')],'sNegative':_0x260e9c[_0x8a78('0x2c')]['Negative'],'sMixed':_0x260e9c[_0x8a78('0x2c')][_0x8a78('0x2e')],'sNeutral':_0x260e9c[_0x8a78('0x2c')]['Neutral']});})[_0x8a78('0x15')](function(){logger[_0x8a78('0x9')](util[_0x8a78('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x574808['id']));_0x4b4bc8();});case'FAILED':return _0x574808['update']({'transcribeStatus':'FAILED','failureReason':_0x57212b[_0x8a78('0xe')][_0x8a78('0x2f')]})[_0x8a78('0x15')](function(){logger[_0x8a78('0x9')](util[_0x8a78('0xa')](_0x8a78('0x1b'),_0x574808['id']));_0x4b4bc8();});default:logger[_0x8a78('0x9')](util['format'](_0x8a78('0x30'),_0x574808['id']));break;}}else{return BPromise[_0x8a78('0x31')]()['then'](function(){if(!_0x574808[_0x8a78('0x1c')]){throw new db[(_0x8a78('0x22'))][(_0x8a78('0x27'))](_0x8a78('0x1d'));}if(!_0x299461[_0x8a78('0x1e')]||!_0x299461[_0x8a78('0x1f')]||!_0x299461[_0x8a78('0x20')]||!_0x299461[_0x8a78('0x2a')]||!_0x299461[_0x8a78('0x21')]){throw new db[(_0x8a78('0x22'))][(_0x8a78('0x27'))](_0x8a78('0x23'));}if(!_0x574808[_0x8a78('0x10')]){throw new Error(_0x8a78('0x24'));}if(_0x299461[_0x8a78('0x1f')]===_0x294b34['id']){return _0x294b34;}else{return db[_0x8a78('0x25')][_0x8a78('0x26')]({'where':{'id':_settings[_0x8a78('0x1f')]}});}})[_0x8a78('0x15')](function(_0x7eddc0){if(!_0x7eddc0){throw new db[(_0x8a78('0x22'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x7eddc0[_0x8a78('0x28')]||!_0x7eddc0[_0x8a78('0xc')]){throw new db[(_0x8a78('0x22'))][(_0x8a78('0x27'))](_0x8a78('0x32'));}_0x31b77e=_0x7eddc0;logger[_0x8a78('0x9')](util['format'](_0x8a78('0x29'),_0x574808['id']));return sentiment(_0x31b77e[_0x8a78('0x28')],_0x31b77e[_0x8a78('0xc')],_0x299461[_0x8a78('0x20')],_0x574808[_0x8a78('0x10')],_0x299461[_0x8a78('0x2a')]);})[_0x8a78('0x15')](function(_0xc5fa2f){logger[_0x8a78('0x9')](util[_0x8a78('0xa')](_0x8a78('0x33'),_0x574808['id']));return _0x574808[_0x8a78('0x1a')]({'sentiment':_0xc5fa2f[_0x8a78('0x2b')],'sPositive':_0xc5fa2f[_0x8a78('0x2c')][_0x8a78('0x2d')],'sNegative':_0xc5fa2f[_0x8a78('0x2c')][_0x8a78('0x34')],'sMixed':_0xc5fa2f[_0x8a78('0x2c')][_0x8a78('0x2e')],'sNeutral':_0xc5fa2f[_0x8a78('0x2c')]['Neutral'],'transcribeStatus':_0x8a78('0x11')});})[_0x8a78('0x15')](function(){logger[_0x8a78('0x9')](util['format'](_0x8a78('0x1b'),_0x574808['id']));_0x4b4bc8();});}})[_0x8a78('0x35')](function(_0x5e9631){if(_0x5e9631){if(!_0x5e9631[_0x8a78('0x36')]||_0x5e9631[_0x8a78('0x36')]!==_0x8a78('0x37')){logger[_0x8a78('0x38')](util['format'](_0x8a78('0x39'),_0x574808['id']),util['inspect'](_0x5e9631,{'showHidden':![],'depth':null}));}}_0x4b4bc8();});});}function checkTranscribe(){var _0x2ed158;var _0x4c147c;var _0x5f0e1f;return db['VoiceRecording'][_0x8a78('0x3a')]({'where':{'transcribeStatus':_0x8a78('0x3b')}})[_0x8a78('0x15')](function(_0x1bcbb1){if(!_0x1bcbb1||!_0x1bcbb1[_0x8a78('0x18')]){throw new db[(_0x8a78('0x22'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x2ed158=_0x1bcbb1;return db[_0x8a78('0x3c')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x242126){if(!_0x242126){throw new db[(_0x8a78('0x22'))][(_0x8a78('0x27'))](_0x8a78('0x3d'));}_0x4c147c=_0x242126;if(!_0x4c147c[_0x8a78('0x3e')]||!_0x4c147c[_0x8a78('0x3f')]||!_0x4c147c['transcribeRegion']||!_0x4c147c[_0x8a78('0x2a')]||!_0x4c147c[_0x8a78('0x21')]){throw new db[(_0x8a78('0x22'))][(_0x8a78('0x27'))](_0x8a78('0x40'));}return db[_0x8a78('0x25')][_0x8a78('0x26')]({'where':{'id':_0x4c147c[_0x8a78('0x3f')]}});})[_0x8a78('0x15')](function(_0x49e5e4){if(!_0x49e5e4){throw new db[(_0x8a78('0x22'))][(_0x8a78('0x27'))](_0x8a78('0x41'));}if(!_0x49e5e4['data1']||!_0x49e5e4['data2']){throw new db[(_0x8a78('0x22'))]['ValidationError'](_0x8a78('0x32'));}_0x5f0e1f=_0x49e5e4;var _0x2e40bd=[];_0x2ed158['forEach'](function(_0x111029){_0x2e40bd[_0x8a78('0x42')](checkTranscribeJob(_0x111029,_0x4c147c,_0x5f0e1f));});return BPromise['all'](_0x2e40bd);})[_0x8a78('0x35')](function(_0x1ff2ea){if(_0x1ff2ea){if(!_0x1ff2ea[_0x8a78('0x36')]||_0x1ff2ea[_0x8a78('0x36')]!==_0x8a78('0x37')){logger[_0x8a78('0x38')](util[_0x8a78('0x43')](_0x1ff2ea,{'showHidden':![],'depth':null}));}}});}exports[_0x8a78('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 167e6c2..065ba96 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 _0xf6c9=['then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','findAll','lastMsgAt','hours'];(function(_0x3d6137,_0x13d351){var _0x5daf34=function(_0x46d844){while(--_0x46d844){_0x3d6137['push'](_0x3d6137['shift']());}};_0x5daf34(++_0x13d351);}(_0xf6c9,0x10b));var _0x9f6c=function(_0x11d4f4,_0x42b966){_0x11d4f4=_0x11d4f4-0x0;var _0x2dd19d=_0xf6c9[_0x11d4f4];return _0x2dd19d;};'use strict';var _=require(_0x9f6c('0x0'));var moment=require('moment');var Redis=require(_0x9f6c('0x1'));var util=require(_0x9f6c('0x2'));var config=require('../../config/environment');var db=require(_0x9f6c('0x3'))['db'];var logger=require(_0x9f6c('0x4'))(_0x9f6c('0x5'));config['redis']=_['defaults'](config[_0x9f6c('0x6')],{'host':_0x9f6c('0x7'),'port':0x18eb});var io=require(_0x9f6c('0x8'))(new Redis(config[_0x9f6c('0x6')]));function closeInteractions(){var _0x22ecde=[];return db['WhatsappInteraction'][_0x9f6c('0x9')]({'raw':!![],'attributes':['id',_0x9f6c('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x9f6c('0xb'))}}})[_0x9f6c('0xc')](function(_0x59361b){if(_0x59361b&&_0x59361b['length']){_0x22ecde=_[_0x9f6c('0xd')](_0x59361b||[],'id');logger[_0x9f6c('0xe')](_0x9f6c('0xf'),_0x22ecde[_0x9f6c('0x10')]());return db[_0x9f6c('0x11')]['update']({'closeReason':_0x9f6c('0x12'),'disposition':_0x9f6c('0x13'),'closed':!![],'closedAt':moment()[_0x9f6c('0x14')](_0x9f6c('0x15'))},{'where':{'id':_0x22ecde}});}})[_0x9f6c('0xc')](function(){if(_0x22ecde&&_0x22ecde[_0x9f6c('0x16')]){logger['info'](_0x9f6c('0x17'),_0x22ecde[_0x9f6c('0x10')]());for(var _0x2094bc=0x0;_0x2094bc<_0x22ecde['length'];_0x2094bc++){io[_0x9f6c('0x18')](_0x9f6c('0x19'),{'id':_0x22ecde[_0x2094bc],'closed':!![]});}}})[_0x9f6c('0x1a')](function(_0x2170d6){logger[_0x9f6c('0x1b')](_0x9f6c('0x1c'),_0x2170d6?util[_0x9f6c('0x1d')](_0x2170d6,{'showHidden':![],'depth':null}):'');});}exports[_0x9f6c('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb098=['lastMsgAt','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','socket.io-emitter','redis','WhatsappInteraction','findAll'];(function(_0x25eb4e,_0x57e603){var _0x350f68=function(_0x887b76){while(--_0x887b76){_0x25eb4e['push'](_0x25eb4e['shift']());}};_0x350f68(++_0x57e603);}(_0xb098,0x1c4));var _0x8b09=function(_0x45869b,_0x153e41){_0x45869b=_0x45869b-0x0;var _0x3bd0af=_0xb098[_0x45869b];return _0x3bd0af;};'use strict';var _=require(_0x8b09('0x0'));var moment=require(_0x8b09('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x8b09('0x2'));var db=require(_0x8b09('0x3'))['db'];var logger=require(_0x8b09('0x4'))(_0x8b09('0x5'));config['redis']=_[_0x8b09('0x6')](config['redis'],{'host':_0x8b09('0x7'),'port':0x18eb});var io=require(_0x8b09('0x8'))(new Redis(config[_0x8b09('0x9')]));function closeInteractions(){var _0x3a92a7=[];return db[_0x8b09('0xa')][_0x8b09('0xb')]({'raw':!![],'attributes':['id',_0x8b09('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8b09('0xd')](0x18,_0x8b09('0xe'))}}})[_0x8b09('0xf')](function(_0x5cea28){if(_0x5cea28&&_0x5cea28[_0x8b09('0x10')]){_0x3a92a7=_[_0x8b09('0x11')](_0x5cea28||[],'id');logger['info'](_0x8b09('0x12'),_0x3a92a7[_0x8b09('0x13')]());return db[_0x8b09('0xa')]['update']({'closeReason':_0x8b09('0x14'),'disposition':_0x8b09('0x15'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3a92a7}});}})[_0x8b09('0xf')](function(){if(_0x3a92a7&&_0x3a92a7[_0x8b09('0x10')]){logger['info'](_0x8b09('0x16'),_0x3a92a7['join']());for(var _0x230f09=0x0;_0x230f09<_0x3a92a7[_0x8b09('0x10')];_0x230f09++){io[_0x8b09('0x17')](_0x8b09('0x18'),{'id':_0x3a92a7[_0x230f09],'closed':!![]});}}})[_0x8b09('0x19')](function(_0x409fc5){logger['error'](_0x8b09('0x1a'),_0x409fc5?util[_0x8b09('0x1b')](_0x409fc5,{'showHidden':![],'depth':null}):'');});}exports[_0x8b09('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 38f25c1..2c3155f 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4245=['CmHopper','destroy','bulkCreate','log','hopper1','contacts2','hopper2','util','../mysqldb','push','Biondo','innocenzo.biondo','now','Innocenzo','CmContact','then','finished\x20populating','contacts1'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x4245,0x1ed));var _0x5424=function(_0x2479be,_0x12baf3){_0x2479be=_0x2479be-0x0;var _0x170063=_0x4245[_0x2479be];return _0x170063;};'use strict';var util=require(_0x5424('0x0'));var db=require(_0x5424('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5424('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x5424('0x3')+i,'phone':0xf879fb460+i,'email':_0x5424('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5424('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x5424('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5424('0x5')](),'updatedAt':Date[_0x5424('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5424('0x2')]({'id':i,'firstName':_0x5424('0x6')+i,'lastName':_0x5424('0x3')+i,'phone':0xf879fb460+i,'email':_0x5424('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x5424('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5424('0x5')](),'updatedAt':Date['now']()});}db[_0x5424('0x7')]['destroy']({'where':{}})['then'](function(){return db[_0x5424('0x7')]['bulkCreate'](contacts);})[_0x5424('0x8')](function(){console['log'](_0x5424('0x9'),_0x5424('0xa'));return db[_0x5424('0xb')][_0x5424('0xc')]({'where':{}});})[_0x5424('0x8')](function(){return db[_0x5424('0xb')][_0x5424('0xd')](hopper);})['then'](function(){console[_0x5424('0xe')](_0x5424('0x9'),_0x5424('0xf'));return db['CmContact'][_0x5424('0xd')](contacts2);})[_0x5424('0x8')](function(){console[_0x5424('0xe')](_0x5424('0x9'),_0x5424('0x10'));return db[_0x5424('0xb')][_0x5424('0xd')](hopper2);})[_0x5424('0x8')](function(){console[_0x5424('0xe')](_0x5424('0x9'),_0x5424('0x11'));})['catch'](function(_0x50c4e7){console[_0x5424('0xe')](_0x50c4e7);}); \ No newline at end of file +var _0xd2d4=['contacts1','contacts2','hopper2','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','CmContact','destroy','then','bulkCreate','log','finished\x20populating'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xd2d4,0x123));var _0x4d2d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd2d4[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var db=require(_0x4d2d('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4d2d('0x1')+i,'phone':0xf879fb460+i,'email':_0x4d2d('0x2')+i+_0x4d2d('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4d2d('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x4d2d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4d2d('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x4d2d('0x6')+i,'lastName':_0x4d2d('0x1')+i,'phone':0xf879fb460+i,'email':_0x4d2d('0x2')+i+_0x4d2d('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4d2d('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x4d2d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4d2d('0x5')](),'updatedAt':Date[_0x4d2d('0x5')]()});}db[_0x4d2d('0x7')][_0x4d2d('0x8')]({'where':{}})[_0x4d2d('0x9')](function(){return db[_0x4d2d('0x7')][_0x4d2d('0xa')](contacts);})[_0x4d2d('0x9')](function(){console[_0x4d2d('0xb')](_0x4d2d('0xc'),_0x4d2d('0xd'));return db['CmHopper']['destroy']({'where':{}});})[_0x4d2d('0x9')](function(){return db['CmHopper'][_0x4d2d('0xa')](hopper);})[_0x4d2d('0x9')](function(){console[_0x4d2d('0xb')](_0x4d2d('0xc'),'hopper1');return db['CmContact'][_0x4d2d('0xa')](contacts2);})[_0x4d2d('0x9')](function(){console['log']('finished\x20populating',_0x4d2d('0xe'));return db['CmHopper'][_0x4d2d('0xa')](hopper2);})[_0x4d2d('0x9')](function(){console[_0x4d2d('0xb')](_0x4d2d('0xc'),_0x4d2d('0xf'));})['catch'](function(_0x1bcb35){console[_0x4d2d('0xb')](_0x1bcb35);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index fe3982f..4117400 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ec1=['\x22%s\x22\x20<%s>','bulkCreate','log','add\x20user','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass'];(function(_0x3d4d3a,_0x3326ee){var _0x329ba1=function(_0x568212){while(--_0x568212){_0x3d4d3a['push'](_0x3d4d3a['shift']());}};_0x329ba1(++_0x3326ee);}(_0x1ec1,0x17a));var _0x11ec=function(_0x356384,_0xe34901){_0x356384=_0x356384-0x0;var _0x1d2c0d=_0x1ec1[_0x356384];return _0x1d2c0d;};'use strict';var util=require('util');var db=require(_0x11ec('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x11ec('0x1')](_0x11ec('0x2'),_0x11ec('0x3'),i),'fullname':util[_0x11ec('0x1')](_0x11ec('0x2'),_0x11ec('0x3'),i),'email':util[_0x11ec('0x1')](_0x11ec('0x4'),_0x11ec('0x3'),i),'role':_0x11ec('0x3'),'password':_0x11ec('0x5'),'internal':0xfa0+i,'type':_0x11ec('0x6'),'transport':['udp','ws',_0x11ec('0x7')],'disallow':[_0x11ec('0x8')],'allow':['ulaw'],'defaultuser':util['format']('%s%s',_0x11ec('0x3'),i),'encryption':_0x11ec('0x9'),'avpf':'yes','force_avp':_0x11ec('0x9'),'icesupport':_0x11ec('0x9'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x11ec('0xa'),'dtlsprivatekey':_0x11ec('0xb'),'dtlssetup':_0x11ec('0xc'),'callerid':util[_0x11ec('0x1')](_0x11ec('0xd'),util[_0x11ec('0x1')](_0x11ec('0x2'),_0x11ec('0x3'),i),0xfa0+i)});}db['User'][_0x11ec('0xe')](users)['then'](function(){console[_0x11ec('0xf')](_0x11ec('0x10'));})['catch'](function(_0x5dd2df){console[_0x11ec('0xf')](_0x5dd2df);}); \ No newline at end of file +var _0x0cab=['/etc/pki/tls/private/motion.key','actpass','User','then','log','add\x20user','catch','util','push','format','%s%s','agent','password','friend','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x11e97f,_0x38212f){var _0x426756=function(_0x4c7351){while(--_0x4c7351){_0x11e97f['push'](_0x11e97f['shift']());}};_0x426756(++_0x38212f);}(_0x0cab,0x17d));var _0xb0ca=function(_0x38e31f,_0x51efc4){_0x38e31f=_0x38e31f-0x0;var _0x567363=_0x0cab[_0x38e31f];return _0x567363;};'use strict';var util=require(_0xb0ca('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb0ca('0x1')]({'name':util[_0xb0ca('0x2')](_0xb0ca('0x3'),'agent',i),'fullname':util['format'](_0xb0ca('0x3'),'agent',i),'email':util[_0xb0ca('0x2')]('%s%s@xcally.com',_0xb0ca('0x4'),i),'role':_0xb0ca('0x4'),'password':_0xb0ca('0x5'),'internal':0xfa0+i,'type':_0xb0ca('0x6'),'transport':['udp','ws','wss'],'disallow':['all'],'allow':[_0xb0ca('0x7')],'defaultuser':util[_0xb0ca('0x2')](_0xb0ca('0x3'),_0xb0ca('0x4'),i),'encryption':_0xb0ca('0x8'),'avpf':_0xb0ca('0x8'),'force_avp':_0xb0ca('0x8'),'icesupport':_0xb0ca('0x8'),'dtlsenable':_0xb0ca('0x8'),'dtlsverify':'no','dtlscertfile':_0xb0ca('0x9'),'dtlsprivatekey':_0xb0ca('0xa'),'dtlssetup':_0xb0ca('0xb'),'callerid':util[_0xb0ca('0x2')]('\x22%s\x22\x20<%s>',util[_0xb0ca('0x2')](_0xb0ca('0x3'),_0xb0ca('0x4'),i),0xfa0+i)});}db[_0xb0ca('0xc')]['bulkCreate'](users)[_0xb0ca('0xd')](function(){console[_0xb0ca('0xe')](_0xb0ca('0xf'));})[_0xb0ca('0x10')](function(_0x1dab5c){console[_0xb0ca('0xe')](_0x1dab5c);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 2ff2bb9..438667f 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0628=['Trunk','user','FaxQueue','SmsQueues','OpenchannelQueue','WhatsappQueues','agent','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','sms','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','telephone','ivr','UserProfileSection','then','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','type','format','%s:queue:%s','user:%s','handshake','find','userProfileId','query','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','WhatsappQueue'];(function(_0x536595,_0x10ebd2){var _0x24fc8e=function(_0x151ae7){while(--_0x151ae7){_0x536595['push'](_0x536595['shift']());}};_0x24fc8e(++_0x10ebd2);}(_0x0628,0x15c));var _0x8062=function(_0x46ac31,_0x2a2686){_0x46ac31=_0x46ac31-0x0;var _0x3d59ff=_0x0628[_0x46ac31];return _0x3d59ff;};'use strict';var _=require(_0x8062('0x0'));var util=require(_0x8062('0x1'));var BPromise=require('bluebird');var db=require(_0x8062('0x2'))['db'];var config=require(_0x8062('0x3'));var queryQueues={'attributes':['id',_0x8062('0x4')],'include':[{'as':_0x8062('0x5'),'model':db[_0x8062('0x6')],'attributes':['id','name',_0x8062('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8062('0x4')],'where':{'role':_0x8062('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x8062('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x8062('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8062('0x4'),'type'],'where':{'type':_0x8062('0x9')}};function getAssociatedResources(_0x3c2a55,_0x38fb22,_0x38390f){return db[_0x8062('0xa')]['findOne']({'where':{'name':_0x3c2a55,'userProfileId':_0x38fb22},'raw':!![]})[_0x8062('0xb')](function(_0x4192c4){if(_0x4192c4){if(_0x4192c4[_0x8062('0xc')]){switch(_0x3c2a55){case'VoiceQueues':case _0x8062('0xd'):case _0x8062('0xe'):case'SmsQueues':case _0x8062('0xf'):case _0x8062('0x10'):case'WhatsappQueues':return db[_0x38390f]['findAll'](queryQueues);case _0x8062('0x11'):return db[_0x38390f][_0x8062('0x12')](queryTelephones);case _0x8062('0x13'):return db[_0x38390f]['findAll'](queryTrunks);case _0x8062('0x14'):return db[_0x38390f][_0x8062('0x12')](queryCampaigns);}}else{return db[_0x8062('0x15')][_0x8062('0x12')]({'attributes':[_0x8062('0x16')],'where':{'sectionId':_0x4192c4['id']},'raw':!![]})['then'](function(_0x159c98){if(_0x159c98){var _0x350b3f={'where':{'id':_[_0x8062('0x17')](_0x159c98,_0x8062('0x16'))},'raw':!![]};switch(_0x38390f){case _0x8062('0x6'):_0x350b3f[_0x8062('0x18')][_0x8062('0x7')]=_0x8062('0x8');break;case _0x8062('0x19'):_0x350b3f[_0x8062('0x18')][_0x8062('0x1a')]='ivr';break;}return db[_0x38390f]['findAll'](_0x350b3f);}else{return[];}});}}else{return[];}})[_0x8062('0xb')](function(_0x18f662){return _0x18f662;});}function joinOrLeaveQueues(_0x31f3f8,_0x46b067,_0x513c81,_0x3997a7){_0x31f3f8[_0x46b067](util[_0x8062('0x1b')](_0x8062('0x1c'),_0x513c81,_0x3997a7['name']));if(_0x3997a7[_0x8062('0x5')]){for(var _0x1680a2=0x0;_0x1680a2<_0x3997a7['Agents']['length'];_0x1680a2+=0x1){_0x31f3f8[_0x46b067](util[_0x8062('0x1b')](_0x8062('0x1d'),_0x3997a7[_0x8062('0x5')][_0x1680a2]['name']));}}}function joinOrLeave(_0x32ef6c,_0xe8b135,_0x55f118){var _0x2893fb;if(_0x32ef6c[_0x8062('0x1e')]['query']['id']){db[_0x8062('0x6')][_0x8062('0x1f')]({'attributes':['id',_0x8062('0x4'),'role',_0x8062('0x20')],'where':{'id':_0x32ef6c['handshake'][_0x8062('0x21')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x8062('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x8062('0x23')],'as':_0x8062('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x8062('0x25')],'as':_0x8062('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x8062('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8062('0x28')],'as':_0x8062('0x29'),'attributes':['id'],'raw':!![]}]})[_0x8062('0xb')](function(_0x115616){if(_0x115616){_0x2893fb=_0x115616;_0x32ef6c[_0xe8b135](util['format'](_0x8062('0x1d'),_0x115616[_0x8062('0x4')]));var _0x227f40=[];switch(_0x115616[_0x8062('0x7')]){case _0x8062('0x2a'):_0x32ef6c[_0xe8b135](_0x8062('0x2b'));_0x32ef6c[_0xe8b135](_0x8062('0x2c'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x8062('0x2d')];}_0x227f40[_0x8062('0x2e')](db[_0x8062('0x2f')][_0x8062('0x12')](queryQueues));_0x227f40[_0x8062('0x2e')](db[_0x8062('0x30')][_0x8062('0x12')](queryQueues));_0x227f40['push'](db['FaxQueue']['findAll'](queryQueues));_0x227f40[_0x8062('0x2e')](db[_0x8062('0x31')][_0x8062('0x12')](queryQueues));_0x227f40[_0x8062('0x2e')](db[_0x8062('0x32')][_0x8062('0x12')](queryQueues));_0x227f40[_0x8062('0x2e')](db['OpenchannelQueue']['findAll'](queryQueues));_0x227f40['push'](db[_0x8062('0x33')]['findAll'](queryQueues));_0x227f40[_0x8062('0x2e')](db['User'][_0x8062('0x12')](queryTelephones));_0x227f40[_0x8062('0x2e')](db[_0x8062('0x34')][_0x8062('0x12')](queryTrunks));_0x227f40['push'](db[_0x8062('0x19')][_0x8062('0x12')](queryCampaigns));_0x227f40['push'](db[_0x8062('0x6')][_0x8062('0x12')](queryAgents));break;case _0x8062('0x35'):_0x32ef6c[_0xe8b135](_0x8062('0x2b'));_0x32ef6c[_0xe8b135](_0x8062('0x2c'));_0x227f40['push'](getAssociatedResources('VoiceQueues',_0x115616[_0x8062('0x20')],'VoiceQueue'));_0x227f40['push'](getAssociatedResources(_0x8062('0xd'),_0x115616[_0x8062('0x20')],_0x8062('0x30')));_0x227f40[_0x8062('0x2e')](getAssociatedResources(_0x8062('0xe'),_0x115616[_0x8062('0x20')],_0x8062('0x36')));_0x227f40[_0x8062('0x2e')](getAssociatedResources(_0x8062('0x37'),_0x115616['userProfileId'],_0x8062('0x31')));_0x227f40['push'](getAssociatedResources('MailQueues',_0x115616['userProfileId'],_0x8062('0x32')));_0x227f40['push'](getAssociatedResources(_0x8062('0x10'),_0x115616[_0x8062('0x20')],_0x8062('0x38')));_0x227f40[_0x8062('0x2e')](getAssociatedResources(_0x8062('0x39'),_0x115616[_0x8062('0x20')],_0x8062('0x33')));_0x227f40[_0x8062('0x2e')](getAssociatedResources(_0x8062('0x11'),_0x115616[_0x8062('0x20')],_0x8062('0x6')));_0x227f40[_0x8062('0x2e')](getAssociatedResources(_0x8062('0x13'),_0x115616['userProfileId'],_0x8062('0x34')));_0x227f40[_0x8062('0x2e')](getAssociatedResources('IvrCampaigns',_0x115616[_0x8062('0x20')],'Campaign'));_0x227f40['push'](db[_0x8062('0x6')][_0x8062('0x12')](queryAgents));break;case _0x8062('0x3a'):_0x32ef6c[_0xe8b135](_0x8062('0x2b'));_0x32ef6c[_0xe8b135](_0x8062('0x2c'));_0x227f40[_0x8062('0x2e')](_0x115616['getVoiceQueues']({'attributes':['id',_0x8062('0x4')]}));_0x227f40['push'](_0x115616[_0x8062('0x3b')]({'attributes':['id',_0x8062('0x4')]}));_0x227f40[_0x8062('0x2e')](_0x115616[_0x8062('0x3c')]({'attributes':['id',_0x8062('0x4')]}));_0x227f40['push'](_0x115616['getSmsQueues']({'attributes':['id',_0x8062('0x4')]}));_0x227f40[_0x8062('0x2e')](_0x115616[_0x8062('0x3d')]({'attributes':['id',_0x8062('0x4')]}));_0x227f40[_0x8062('0x2e')](_0x115616[_0x8062('0x3e')]({'attributes':['id',_0x8062('0x4')]}));_0x227f40[_0x8062('0x2e')](_0x115616[_0x8062('0x3f')]({'attributes':['id',_0x8062('0x4')]}));break;}return BPromise[_0x8062('0x40')](_0x227f40);}})[_0x8062('0xb')](function(_0x2b5847){if(_0x2b5847&&_0x2b5847[_0x8062('0x41')]){for(var _0x44644f=0x0;_0x44644f<_0x2b5847[_0x8062('0x41')];_0x44644f+=0x1){for(var _0x4c476a=0x0;_0x4c476a<_0x2b5847[_0x44644f]['length'];_0x4c476a+=0x1){switch(_0x44644f){case 0x0:joinOrLeaveQueues(_0x32ef6c,_0xe8b135,_0x8062('0x42'),_0x2b5847[_0x44644f][_0x4c476a]);break;case 0x1:joinOrLeaveQueues(_0x32ef6c,_0xe8b135,_0x8062('0x43'),_0x2b5847[_0x44644f][_0x4c476a]);break;case 0x2:joinOrLeaveQueues(_0x32ef6c,_0xe8b135,'fax',_0x2b5847[_0x44644f][_0x4c476a]);break;case 0x3:joinOrLeaveQueues(_0x32ef6c,_0xe8b135,_0x8062('0x44'),_0x2b5847[_0x44644f][_0x4c476a]);break;case 0x4:joinOrLeaveQueues(_0x32ef6c,_0xe8b135,'mail',_0x2b5847[_0x44644f][_0x4c476a]);break;case 0x5:joinOrLeaveQueues(_0x32ef6c,_0xe8b135,'openchannel',_0x2b5847[_0x44644f][_0x4c476a]);break;case 0x6:joinOrLeaveQueues(_0x32ef6c,_0xe8b135,_0x8062('0x45'),_0x2b5847[_0x44644f][_0x4c476a]);break;case 0x7:if(_0x2893fb['role']!==_0x8062('0x3a'))_0x32ef6c[_0xe8b135](util[_0x8062('0x1b')](_0x8062('0x46'),_0x2b5847[_0x44644f][_0x4c476a][_0x8062('0x4')]));break;case 0x8:if(_0x2893fb['role']!==_0x8062('0x3a'))_0x32ef6c[_0xe8b135](util[_0x8062('0x1b')](_0x8062('0x47'),_0x2b5847[_0x44644f][_0x4c476a]['name']));break;case 0x9:if(_0x2893fb[_0x8062('0x7')]!==_0x8062('0x3a'))_0x32ef6c[_0xe8b135](util[_0x8062('0x1b')](_0x8062('0x48'),_0x2b5847[_0x44644f][_0x4c476a][_0x8062('0x1a')],_0x2b5847[_0x44644f][_0x4c476a][_0x8062('0x4')]));break;case 0xa:_0x32ef6c[_0xe8b135](util[_0x8062('0x1b')](_0x8062('0x1d'),_0x2b5847[_0x44644f][_0x4c476a][_0x8062('0x4')]));break;}}}}})[_0x8062('0xb')](function(){if(_0xe8b135===_0x8062('0x49')){var _0x574192=_['map'](_0x2893fb['ChatInteractions'],'id');return _0x2893fb['removeChatInteractions'](_0x574192)[_0x8062('0xb')](function(){for(var _0x19dc8e=0x0;_0x19dc8e<_0x574192[_0x8062('0x41')];_0x19dc8e+=0x1){_0x55f118[_0x8062('0x4a')](_0x8062('0x4b'),{'ChatInteractionId':Number(_0x574192[_0x19dc8e]),'UserId':Number(_0x2893fb['id'])});}});}})['then'](function(){if(_0xe8b135==='leave'){var _0x276f59=_[_0x8062('0x17')](_0x2893fb[_0x8062('0x24')],'id');return _0x2893fb[_0x8062('0x4c')](_0x276f59)['then'](function(){for(var _0x596c41=0x0;_0x596c41<_0x276f59[_0x8062('0x41')];_0x596c41+=0x1){_0x55f118[_0x8062('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x276f59[_0x596c41]),'UserId':Number(_0x2893fb['id'])});}});}})[_0x8062('0xb')](function(){if(_0xe8b135===_0x8062('0x49')){var _0x2a431c=_[_0x8062('0x17')](_0x2893fb[_0x8062('0x26')],'id');return _0x2893fb['removeFaxInteractions'](_0x2a431c)['then'](function(){for(var _0x28061a=0x0;_0x28061a<_0x2a431c[_0x8062('0x41')];_0x28061a+=0x1){_0x55f118[_0x8062('0x4a')](_0x8062('0x4d'),{'FaxInteractionId':Number(_0x2a431c[_0x28061a]),'UserId':Number(_0x2893fb['id'])});}});}})[_0x8062('0xb')](function(){if(_0xe8b135===_0x8062('0x49')){var _0x1409bc=_[_0x8062('0x17')](_0x2893fb[_0x8062('0x4e')],'id');return _0x2893fb[_0x8062('0x4f')](_0x1409bc)['then'](function(){for(var _0x10df60=0x0;_0x10df60<_0x1409bc[_0x8062('0x41')];_0x10df60+=0x1){_0x55f118[_0x8062('0x4a')](_0x8062('0x50'),{'SmsInteractionId':Number(_0x1409bc[_0x10df60]),'UserId':Number(_0x2893fb['id'])});}});}})[_0x8062('0xb')](function(){if(_0xe8b135===_0x8062('0x49')){var _0x141715=_['map'](_0x2893fb[_0x8062('0x51')],'id');return _0x2893fb[_0x8062('0x52')](_0x141715)[_0x8062('0xb')](function(){for(var _0x307aa8=0x0;_0x307aa8<_0x141715[_0x8062('0x41')];_0x307aa8+=0x1){_0x55f118['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x141715[_0x307aa8]),'UserId':Number(_0x2893fb['id'])});}});}})[_0x8062('0xb')](function(){if(_0xe8b135===_0x8062('0x49')){var _0x1766b8=_[_0x8062('0x17')](_0x2893fb[_0x8062('0x29')],'id');return _0x2893fb[_0x8062('0x53')](_0x1766b8)[_0x8062('0xb')](function(){for(var _0x48e319=0x0;_0x48e319<_0x1766b8[_0x8062('0x41')];_0x48e319+=0x1){_0x55f118['emit'](_0x8062('0x54'),{'WhatsappInteractionId':Number(_0x1766b8[_0x48e319]),'UserId':Number(_0x2893fb['id'])});}});}})[_0x8062('0x55')](function(_0x397196){_0x32ef6c[_0x8062('0x56')](_0x397196);});}}function onDisconnect(_0x503fb9,_0x10f2b6){joinOrLeave(_0x503fb9,_0x8062('0x49'),_0x10f2b6);}function onConnect(_0x2f3eed){joinOrLeave(_0x2f3eed,_0x8062('0x57'));}exports[_0x8062('0x58')]=function(_0x511216){_0x511216['on'](_0x8062('0x59'),function(_0x20c422){_0x20c422[_0x8062('0x5a')](0x0);_0x20c422[_0x8062('0x5b')]=_0x20c422[_0x8062('0x5c')][_0x8062('0x59')][_0x8062('0x5d')]+':'+_0x20c422[_0x8062('0x5c')][_0x8062('0x59')][_0x8062('0x5e')];_0x20c422[_0x8062('0x5f')]=new Date();_0x20c422[_0x8062('0x56')]=function(_0x155f4d){console[_0x8062('0x56')](_0x8062('0x60')+_0x20c422['nsp']['name']+'['+_0x20c422[_0x8062('0x5b')]+']',_0x155f4d);};_0x20c422['on'](_0x8062('0x61'),function(){onDisconnect(_0x20c422,_0x511216);_0x20c422[_0x8062('0x56')](_0x8062('0x62'));});onConnect(_0x20c422);_0x20c422[_0x8062('0x56')](_0x8062('0x63'));});}; \ No newline at end of file +var _0x4815=['VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','OpenchannelQueue','Trunks','IvrCampaigns','voice:outbound','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','setMaxListeners','address','request','connection','remotePort','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','UserProfileResource','resourceId','map','User','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty'];(function(_0x4799d4,_0x182346){var _0x4b15b6=function(_0x171632){while(--_0x171632){_0x4799d4['push'](_0x4799d4['shift']());}};_0x4b15b6(++_0x182346);}(_0x4815,0xff));var _0x5481=function(_0x565674,_0x1be0de){_0x565674=_0x565674-0x0;var _0x1044fa=_0x4815[_0x565674];return _0x1044fa;};'use strict';var _=require(_0x5481('0x0'));var util=require(_0x5481('0x1'));var BPromise=require(_0x5481('0x2'));var db=require(_0x5481('0x3'))['db'];var config=require(_0x5481('0x4'));var queryQueues={'attributes':['id',_0x5481('0x5')],'include':[{'as':_0x5481('0x6'),'model':db['User'],'attributes':['id','name',_0x5481('0x7')],'raw':!![],'where':{'role':_0x5481('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x5481('0x5')],'where':{'role':_0x5481('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x5481('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x5481('0x5')],'where':{'role':_0x5481('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5481('0x5'),_0x5481('0xa')],'where':{'type':_0x5481('0xb')}};function getAssociatedResources(_0x390325,_0x2268fd,_0x471b72){return db[_0x5481('0xc')][_0x5481('0xd')]({'where':{'name':_0x390325,'userProfileId':_0x2268fd},'raw':!![]})[_0x5481('0xe')](function(_0x4ba568){if(_0x4ba568){if(_0x4ba568['autoAssociation']){switch(_0x390325){case _0x5481('0xf'):case _0x5481('0x10'):case _0x5481('0x11'):case _0x5481('0x12'):case'MailQueues':case _0x5481('0x13'):case'WhatsappQueues':return db[_0x471b72][_0x5481('0x14')](queryQueues);case _0x5481('0x15'):return db[_0x471b72][_0x5481('0x14')](queryTelephones);case'Trunks':return db[_0x471b72][_0x5481('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x471b72][_0x5481('0x14')](queryCampaigns);}}else{return db[_0x5481('0x16')][_0x5481('0x14')]({'attributes':[_0x5481('0x17')],'where':{'sectionId':_0x4ba568['id']},'raw':!![]})[_0x5481('0xe')](function(_0x35d490){if(_0x35d490){var _0x31b8c9={'where':{'id':_[_0x5481('0x18')](_0x35d490,_0x5481('0x17'))},'raw':!![]};switch(_0x471b72){case _0x5481('0x19'):_0x31b8c9['where'][_0x5481('0x7')]=_0x5481('0x9');break;case _0x5481('0x1a'):_0x31b8c9['where']['type']='ivr';break;}return db[_0x471b72]['findAll'](_0x31b8c9);}else{return[];}});}}else{return[];}})[_0x5481('0xe')](function(_0x23319a){return _0x23319a;});}function joinOrLeaveQueues(_0x35f015,_0x4acda2,_0x59b071,_0x5526e5){_0x35f015[_0x4acda2](util[_0x5481('0x1b')](_0x5481('0x1c'),_0x59b071,_0x5526e5[_0x5481('0x5')]));if(_0x5526e5[_0x5481('0x6')]){for(var _0x1cb8dd=0x0;_0x1cb8dd<_0x5526e5[_0x5481('0x6')][_0x5481('0x1d')];_0x1cb8dd+=0x1){_0x35f015[_0x4acda2](util[_0x5481('0x1b')](_0x5481('0x1e'),_0x5526e5[_0x5481('0x6')][_0x1cb8dd][_0x5481('0x5')]));}}}function joinOrLeave(_0x5c3248,_0xee5dad,_0x4c86d5){var _0x321b28;if(_0x5c3248[_0x5481('0x1f')][_0x5481('0x20')]['id']){db[_0x5481('0x19')][_0x5481('0x21')]({'attributes':['id',_0x5481('0x5'),_0x5481('0x7'),_0x5481('0x22')],'where':{'id':_0x5c3248[_0x5481('0x1f')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0x5481('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x5481('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x5481('0x25')],'as':_0x5481('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x5481('0x27')],'as':_0x5481('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x5481('0x29')],'as':_0x5481('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x5481('0x2b')],'as':_0x5481('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x5481('0xe')](function(_0x47cbd2){if(_0x47cbd2){_0x321b28=_0x47cbd2;_0x5c3248[_0xee5dad](util[_0x5481('0x1b')](_0x5481('0x1e'),_0x47cbd2[_0x5481('0x5')]));var _0x2218d3=[];switch(_0x47cbd2[_0x5481('0x7')]){case _0x5481('0x2d'):_0x5c3248[_0xee5dad](_0x5481('0x2e'));_0x5c3248[_0xee5dad]('voice:outbound');if(queryQueues[_0x5481('0x2f')]('include')){delete queryQueues['include'];}_0x2218d3['push'](db[_0x5481('0x30')]['findAll'](queryQueues));_0x2218d3[_0x5481('0x31')](db[_0x5481('0x32')][_0x5481('0x14')](queryQueues));_0x2218d3[_0x5481('0x31')](db[_0x5481('0x33')][_0x5481('0x14')](queryQueues));_0x2218d3['push'](db[_0x5481('0x34')][_0x5481('0x14')](queryQueues));_0x2218d3['push'](db[_0x5481('0x35')][_0x5481('0x14')](queryQueues));_0x2218d3[_0x5481('0x31')](db['OpenchannelQueue'][_0x5481('0x14')](queryQueues));_0x2218d3[_0x5481('0x31')](db[_0x5481('0x36')][_0x5481('0x14')](queryQueues));_0x2218d3[_0x5481('0x31')](db[_0x5481('0x19')][_0x5481('0x14')](queryTelephones));_0x2218d3[_0x5481('0x31')](db[_0x5481('0x37')][_0x5481('0x14')](queryTrunks));_0x2218d3[_0x5481('0x31')](db[_0x5481('0x1a')][_0x5481('0x14')](queryCampaigns));_0x2218d3[_0x5481('0x31')](db['User'][_0x5481('0x14')](queryAgents));break;case'user':_0x5c3248[_0xee5dad]('voice:inbound');_0x5c3248[_0xee5dad]('voice:outbound');_0x2218d3['push'](getAssociatedResources(_0x5481('0xf'),_0x47cbd2[_0x5481('0x22')],'VoiceQueue'));_0x2218d3['push'](getAssociatedResources('ChatQueues',_0x47cbd2[_0x5481('0x22')],_0x5481('0x32')));_0x2218d3['push'](getAssociatedResources(_0x5481('0x11'),_0x47cbd2['userProfileId'],_0x5481('0x33')));_0x2218d3[_0x5481('0x31')](getAssociatedResources(_0x5481('0x12'),_0x47cbd2['userProfileId'],'SmsQueue'));_0x2218d3[_0x5481('0x31')](getAssociatedResources('MailQueues',_0x47cbd2[_0x5481('0x22')],_0x5481('0x35')));_0x2218d3['push'](getAssociatedResources(_0x5481('0x13'),_0x47cbd2['userProfileId'],_0x5481('0x38')));_0x2218d3['push'](getAssociatedResources('WhatsappQueues',_0x47cbd2[_0x5481('0x22')],_0x5481('0x36')));_0x2218d3[_0x5481('0x31')](getAssociatedResources(_0x5481('0x15'),_0x47cbd2[_0x5481('0x22')],_0x5481('0x19')));_0x2218d3[_0x5481('0x31')](getAssociatedResources(_0x5481('0x39'),_0x47cbd2[_0x5481('0x22')],'Trunk'));_0x2218d3[_0x5481('0x31')](getAssociatedResources(_0x5481('0x3a'),_0x47cbd2[_0x5481('0x22')],_0x5481('0x1a')));_0x2218d3[_0x5481('0x31')](db['User'][_0x5481('0x14')](queryAgents));break;case _0x5481('0x8'):_0x5c3248[_0xee5dad]('voice:inbound');_0x5c3248[_0xee5dad](_0x5481('0x3b'));_0x2218d3[_0x5481('0x31')](_0x47cbd2[_0x5481('0x3c')]({'attributes':['id','name']}));_0x2218d3[_0x5481('0x31')](_0x47cbd2[_0x5481('0x3d')]({'attributes':['id',_0x5481('0x5')]}));_0x2218d3[_0x5481('0x31')](_0x47cbd2['getFaxQueues']({'attributes':['id',_0x5481('0x5')]}));_0x2218d3['push'](_0x47cbd2[_0x5481('0x3e')]({'attributes':['id',_0x5481('0x5')]}));_0x2218d3[_0x5481('0x31')](_0x47cbd2[_0x5481('0x3f')]({'attributes':['id','name']}));_0x2218d3['push'](_0x47cbd2[_0x5481('0x40')]({'attributes':['id',_0x5481('0x5')]}));_0x2218d3['push'](_0x47cbd2[_0x5481('0x41')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x2218d3);}})['then'](function(_0x589e12){if(_0x589e12&&_0x589e12['length']){for(var _0xefbb04=0x0;_0xefbb04<_0x589e12[_0x5481('0x1d')];_0xefbb04+=0x1){for(var _0x2b22fb=0x0;_0x2b22fb<_0x589e12[_0xefbb04][_0x5481('0x1d')];_0x2b22fb+=0x1){switch(_0xefbb04){case 0x0:joinOrLeaveQueues(_0x5c3248,_0xee5dad,_0x5481('0x42'),_0x589e12[_0xefbb04][_0x2b22fb]);break;case 0x1:joinOrLeaveQueues(_0x5c3248,_0xee5dad,_0x5481('0x43'),_0x589e12[_0xefbb04][_0x2b22fb]);break;case 0x2:joinOrLeaveQueues(_0x5c3248,_0xee5dad,_0x5481('0x44'),_0x589e12[_0xefbb04][_0x2b22fb]);break;case 0x3:joinOrLeaveQueues(_0x5c3248,_0xee5dad,_0x5481('0x45'),_0x589e12[_0xefbb04][_0x2b22fb]);break;case 0x4:joinOrLeaveQueues(_0x5c3248,_0xee5dad,_0x5481('0x46'),_0x589e12[_0xefbb04][_0x2b22fb]);break;case 0x5:joinOrLeaveQueues(_0x5c3248,_0xee5dad,_0x5481('0x47'),_0x589e12[_0xefbb04][_0x2b22fb]);break;case 0x6:joinOrLeaveQueues(_0x5c3248,_0xee5dad,'whatsapp',_0x589e12[_0xefbb04][_0x2b22fb]);break;case 0x7:if(_0x321b28[_0x5481('0x7')]!==_0x5481('0x8'))_0x5c3248[_0xee5dad](util[_0x5481('0x1b')](_0x5481('0x48'),_0x589e12[_0xefbb04][_0x2b22fb][_0x5481('0x5')]));break;case 0x8:if(_0x321b28[_0x5481('0x7')]!==_0x5481('0x8'))_0x5c3248[_0xee5dad](util[_0x5481('0x1b')](_0x5481('0x49'),_0x589e12[_0xefbb04][_0x2b22fb]['name']));break;case 0x9:if(_0x321b28['role']!==_0x5481('0x8'))_0x5c3248[_0xee5dad](util[_0x5481('0x1b')](_0x5481('0x4a'),_0x589e12[_0xefbb04][_0x2b22fb][_0x5481('0xa')],_0x589e12[_0xefbb04][_0x2b22fb]['name']));break;case 0xa:_0x5c3248[_0xee5dad](util[_0x5481('0x1b')](_0x5481('0x1e'),_0x589e12[_0xefbb04][_0x2b22fb][_0x5481('0x5')]));break;}}}}})['then'](function(){if(_0xee5dad===_0x5481('0x4b')){var _0x109f4a=_[_0x5481('0x18')](_0x321b28['ChatInteractions'],'id');return _0x321b28[_0x5481('0x4c')](_0x109f4a)[_0x5481('0xe')](function(){for(var _0x1679b0=0x0;_0x1679b0<_0x109f4a[_0x5481('0x1d')];_0x1679b0+=0x1){_0x4c86d5[_0x5481('0x4d')](_0x5481('0x4e'),{'ChatInteractionId':Number(_0x109f4a[_0x1679b0]),'UserId':Number(_0x321b28['id'])});}});}})['then'](function(){if(_0xee5dad===_0x5481('0x4b')){var _0x1736ce=_[_0x5481('0x18')](_0x321b28[_0x5481('0x4f')],'id');return _0x321b28[_0x5481('0x50')](_0x1736ce)[_0x5481('0xe')](function(){for(var _0x12eab6=0x0;_0x12eab6<_0x1736ce['length'];_0x12eab6+=0x1){_0x4c86d5['emit'](_0x5481('0x51'),{'MailInteractionId':Number(_0x1736ce[_0x12eab6]),'UserId':Number(_0x321b28['id'])});}});}})[_0x5481('0xe')](function(){if(_0xee5dad===_0x5481('0x4b')){var _0xd27bab=_['map'](_0x321b28[_0x5481('0x26')],'id');return _0x321b28['removeFaxInteractions'](_0xd27bab)[_0x5481('0xe')](function(){for(var _0x55f92e=0x0;_0x55f92e<_0xd27bab[_0x5481('0x1d')];_0x55f92e+=0x1){_0x4c86d5[_0x5481('0x4d')](_0x5481('0x52'),{'FaxInteractionId':Number(_0xd27bab[_0x55f92e]),'UserId':Number(_0x321b28['id'])});}});}})[_0x5481('0xe')](function(){if(_0xee5dad===_0x5481('0x4b')){var _0x13d20b=_[_0x5481('0x18')](_0x321b28['SmsInteractions'],'id');return _0x321b28[_0x5481('0x53')](_0x13d20b)['then'](function(){for(var _0x1da964=0x0;_0x1da964<_0x13d20b[_0x5481('0x1d')];_0x1da964+=0x1){_0x4c86d5[_0x5481('0x4d')](_0x5481('0x54'),{'SmsInteractionId':Number(_0x13d20b[_0x1da964]),'UserId':Number(_0x321b28['id'])});}});}})[_0x5481('0xe')](function(){if(_0xee5dad===_0x5481('0x4b')){var _0x11604b=_[_0x5481('0x18')](_0x321b28[_0x5481('0x2a')],'id');return _0x321b28['removeOpenchannelInteractions'](_0x11604b)[_0x5481('0xe')](function(){for(var _0x115aa3=0x0;_0x115aa3<_0x11604b[_0x5481('0x1d')];_0x115aa3+=0x1){_0x4c86d5[_0x5481('0x4d')](_0x5481('0x55'),{'OpenchannelInteractionId':Number(_0x11604b[_0x115aa3]),'UserId':Number(_0x321b28['id'])});}});}})['then'](function(){if(_0xee5dad==='leave'){var _0x42950a=_['map'](_0x321b28[_0x5481('0x2c')],'id');return _0x321b28[_0x5481('0x56')](_0x42950a)[_0x5481('0xe')](function(){for(var _0x5671a6=0x0;_0x5671a6<_0x42950a[_0x5481('0x1d')];_0x5671a6+=0x1){_0x4c86d5[_0x5481('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x42950a[_0x5671a6]),'UserId':Number(_0x321b28['id'])});}});}})[_0x5481('0x57')](function(_0xc9aebe){_0x5c3248['log'](_0xc9aebe);});}}function onDisconnect(_0x4e1ce8,_0x1446a0){joinOrLeave(_0x4e1ce8,_0x5481('0x4b'),_0x1446a0);}function onConnect(_0x197390){joinOrLeave(_0x197390,_0x5481('0x58'));}exports[_0x5481('0x59')]=function(_0x491e71){_0x491e71['on']('connection',function(_0x4799a5){_0x4799a5[_0x5481('0x5a')](0x0);_0x4799a5[_0x5481('0x5b')]=_0x4799a5['request']['connection']['remoteAddress']+':'+_0x4799a5[_0x5481('0x5c')][_0x5481('0x5d')][_0x5481('0x5e')];_0x4799a5[_0x5481('0x5f')]=new Date();_0x4799a5[_0x5481('0x60')]=function(_0x4f89f5){console['log'](_0x5481('0x61')+_0x4799a5[_0x5481('0x62')][_0x5481('0x5')]+'['+_0x4799a5[_0x5481('0x5b')]+']',_0x4f89f5);};_0x4799a5['on']('disconnect',function(){onDisconnect(_0x4799a5,_0x491e71);_0x4799a5[_0x5481('0x60')](_0x5481('0x63'));});onConnect(_0x4799a5);_0x4799a5['log'](_0x5481('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 50f62fc..7764058 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 _0x3804=['http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','Sms','SmsInteraction','SmsMessage','afterCreate','WhatsappInteraction','Whatsapp','WhatsappMessage','newmessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','Trigger,\x20%s','EventManager','error','code','channel','motionChannel','event','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','User','find','name','fullname','email','interface','SIP/%s','agent','catch','outgoingmessage','get','opened','contact','changed','substatus','closed','internal','default','hasOwnProperty','model','callback','condition','util','../../mysqldb','../logger','triggers','lodash'];(function(_0x12d000,_0x338ab3){var _0x488efd=function(_0x44cc48){while(--_0x44cc48){_0x12d000['push'](_0x12d000['shift']());}};_0x488efd(++_0x338ab3);}(_0x3804,0x83));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x4380('0x0'));var db=require(_0x4380('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x4380('0x2'))(_0x4380('0x3'));var _=require(_0x4380('0x4'));var client=jayson['client'][_0x4380('0x5')]({'port':0x232a});var triggers=[{'channel':_0x4380('0x6'),'model':_0x4380('0x7'),'event':'afterCreate','condition':_0x4380('0x8'),'callback':afterCreate},{'channel':_0x4380('0x6'),'model':_0x4380('0x7'),'event':_0x4380('0x9'),'condition':_0x4380('0xa'),'callback':afterUpdate},{'channel':_0x4380('0x6'),'model':'ChatMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x4380('0xb'),'model':'SmsInteraction','event':'afterCreate','condition':_0x4380('0x8'),'callback':afterCreate},{'channel':_0x4380('0xb'),'model':_0x4380('0xc'),'event':_0x4380('0x9'),'condition':_0x4380('0xa'),'callback':afterUpdate},{'channel':'Sms','model':_0x4380('0xd'),'event':_0x4380('0xe'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x4380('0xf'),'event':_0x4380('0xe'),'condition':_0x4380('0x8'),'callback':afterCreate},{'channel':_0x4380('0x10'),'model':_0x4380('0xf'),'event':_0x4380('0x9'),'condition':_0x4380('0xa'),'callback':afterUpdate},{'channel':_0x4380('0x10'),'model':_0x4380('0x11'),'event':_0x4380('0xe'),'condition':_0x4380('0x12'),'callback':afterCreateMessage},{'channel':_0x4380('0x13'),'model':_0x4380('0x14'),'event':_0x4380('0xe'),'condition':_0x4380('0x8'),'callback':afterCreate},{'channel':_0x4380('0x13'),'model':'FaxInteraction','event':_0x4380('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x4380('0x13'),'model':_0x4380('0x15'),'event':_0x4380('0xe'),'condition':_0x4380('0x12'),'callback':afterCreateMessage},{'channel':_0x4380('0x16'),'model':_0x4380('0x17'),'event':_0x4380('0xe'),'condition':_0x4380('0x8'),'callback':afterCreate},{'channel':_0x4380('0x16'),'model':_0x4380('0x17'),'event':_0x4380('0x9'),'condition':_0x4380('0xa'),'callback':afterUpdate},{'channel':_0x4380('0x16'),'model':_0x4380('0x18'),'event':'afterCreate','condition':_0x4380('0x12'),'callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x4380('0xe'),'condition':_0x4380('0x8'),'callback':afterCreate},{'channel':_0x4380('0x19'),'model':_0x4380('0x1a'),'event':_0x4380('0x9'),'condition':_0x4380('0xa'),'callback':afterUpdate},{'channel':_0x4380('0x19'),'model':_0x4380('0x1b'),'event':_0x4380('0xe'),'condition':_0x4380('0x12'),'callback':afterCreateMessage}];function request(_0x5f54ff){return client[_0x4380('0x1c')]('EventManager',_0x5f54ff)[_0x4380('0x1d')](function(_0x1bc457){logger[_0x4380('0x1e')](_0x4380('0x1f'),_0x4380('0x20'),_0x1bc457);if(_0x1bc457['error']){if(_0x1bc457[_0x4380('0x21')][_0x4380('0x22')]===0x1f4){logger[_0x4380('0x21')]('Trigger,\x20%s',_0x4380('0x20'),_0x1bc457['error']);}}})['catch'](function(_0x50ec31){logger[_0x4380('0x21')](_0x4380('0x1f'),'EventManager',_0x50ec31);});}function afterCreateMessage(_0x28c2a8,_0x5b9324){return function(_0x346b7c,_0x2d626b){_0x346b7c=_0x346b7c['get']({'plain':!![]});_0x346b7c[_0x4380('0x23')]=_0x28c2a8;_0x346b7c[_0x4380('0x24')]=_0x28c2a8;_0x346b7c[_0x4380('0x25')]=_0x346b7c['direction'];var _0x392e13=_0x4380('0x26')+_0x346b7c[_0x4380('0x27')];return db[_0x4380('0x28')][_0x4380('0x29')](_0x392e13,{'type':db[_0x4380('0x2a')][_0x4380('0x2b')][_0x4380('0x2c')],'raw':!![]})['then'](function(_0x22567f){return _0x22567f;})[_0x4380('0x1d')](function(_0x57f437){if(_0x57f437){_0x346b7c['contact']=_0x57f437[0x0];}if(_0x346b7c[_0x4380('0x2d')]){return db[_0x4380('0x2e')][_0x4380('0x2f')]({'where':{'id':_0x346b7c[_0x4380('0x2d')]},'attributes':['id',_0x4380('0x30'),_0x4380('0x31'),_0x4380('0x32'),'internal'],'raw':!![]})['then'](function(_0x58ca5a){_0x346b7c[_0x4380('0x33')]=util['format'](_0x4380('0x34'),_0x58ca5a[_0x4380('0x30')]);_0x346b7c[_0x4380('0x23')]=_0x28c2a8;_0x346b7c[_0x4380('0x35')]=_0x58ca5a;return request({'event':'incomingmessage','message':_0x346b7c});})[_0x4380('0x36')](function(_0x2a00f6){console[_0x4380('0x21')](_0x2a00f6);});}else{return request({'event':_0x4380('0x37'),'message':_0x346b7c});}});};}function afterCreate(_0x5d0326,_0x4391e4){return function(_0x4552de,_0x685f9a){_0x4552de=_0x4552de[_0x4380('0x38')]({'plain':!![]});_0x4552de[_0x4380('0x23')]=_0x5d0326;_0x4552de['motionChannel']=_0x5d0326;_0x4552de['event']=_0x4380('0x39');var _0x5a9c03=_0x4380('0x26')+_0x4552de['ContactId'];return db[_0x4380('0x28')]['query'](_0x5a9c03,{'type':db[_0x4380('0x2a')][_0x4380('0x2b')][_0x4380('0x2c')],'raw':!![]})[_0x4380('0x1d')](function(_0x350c7b){return _0x350c7b;})[_0x4380('0x1d')](function(_0x3b0384){if(_0x3b0384){_0x4552de[_0x4380('0x3a')]=_0x3b0384[0x0];}return request({'event':_0x4391e4,'message':_0x4552de});});};}function afterUpdate(_0x10bf5f,_0x4651aa){return function(_0x37378f,_0x5c5ba5){var _0x4b7f8d=_0x37378f[_0x4380('0x3b')](_0x4380('0x3c'));if(_0x37378f['changed'](_0x4380('0x3d'))&&_0x37378f[_0x4380('0x3d')]||_0x4b7f8d){_0x37378f=_0x37378f[_0x4380('0x38')]({'plain':!![]});_0x37378f[_0x4380('0x23')]=_0x10bf5f;_0x37378f[_0x4380('0x24')]=_0x10bf5f;if(_0x4b7f8d){_0x37378f['event']='substatus';}else{_0x37378f[_0x4380('0x25')]=_0x4380('0x3d');}var _0x46a913='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x37378f[_0x4380('0x27')];return db[_0x4380('0x28')][_0x4380('0x29')](_0x46a913,{'type':db[_0x4380('0x2a')][_0x4380('0x2b')]['SELECT'],'raw':!![]})[_0x4380('0x1d')](function(_0x29ff38){return _0x29ff38;})[_0x4380('0x1d')](function(_0x5d7267){if(_0x5d7267){_0x37378f['contact']=_0x5d7267[0x0];}if(_0x37378f[_0x4380('0x2d')]){return db[_0x4380('0x2e')][_0x4380('0x2f')]({'where':{'id':_0x37378f[_0x4380('0x2d')]},'attributes':['id','name',_0x4380('0x31'),'email',_0x4380('0x3e')],'raw':!![]})[_0x4380('0x1d')](function(_0x5a2343){_0x37378f[_0x4380('0x33')]=util['format'](_0x4380('0x34'),_0x5a2343[_0x4380('0x30')]);_0x37378f[_0x4380('0x35')]=_0x5a2343;return request({'event':_0x4651aa,'message':_0x37378f});})['catch'](function(_0xbfe063){console[_0x4380('0x21')](_0xbfe063);});}else{return request({'event':_0x4651aa,'message':_0x37378f});}});}};}exports[_0x4380('0x3f')]=function(){for(var _0x22d8e9=0x0;_0x22d8e9=_0x46540b[_0xb3b3('0xf')]){throw Error(_0xb3b3('0x10'));}_0x53d7dc(_0x1a87ac);})[_0xb3b3('0x11')](function(_0x230140){_0x28e1d3(_0x230140);});});}; \ No newline at end of file +var _0x8127=['bluebird','../mysqldb','./license/util','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent','User','count','getLicense','then','Maximum\x20login\x20has\x20been\x20reached','catch','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8127,0x81));var _0x7812=function(_0x38b347,_0x29f7f6){_0x38b347=_0x38b347-0x0;var _0x24134e=_0x8127[_0x38b347];return _0x24134e;};'use strict';var _=require(_0x7812('0x0'));var BPromise=require(_0x7812('0x1'));var db=require(_0x7812('0x2'))['db'];var util=require(_0x7812('0x3'));var channels=['voice',_0x7812('0x4'),_0x7812('0x5'),_0x7812('0x6'),_0x7812('0x7'),_0x7812('0x8'),_0x7812('0x9')];exports[_0x7812('0xa')]=function(){return channels;};exports[_0x7812('0xb')]=function(_0x136792){_0x136792=_0x136792[_0x7812('0xc')]();return _[_0x7812('0xd')](channels,_0x136792);};exports[_0x7812('0xe')]=function(_0x43ac33,_0x3758b5,_0x473d4e,_0x595b9a){var _0x5c4b75={'loginAttempts':_0x3758b5,'blocked':_0x473d4e};if(!_[_0x7812('0xf')](_0x595b9a)){_0x5c4b75[_0x7812('0x10')]=_0x595b9a;}return _0x43ac33[_0x7812('0x11')](_0x5c4b75);};exports['getLicense']=function(_0x19e94b){return new BPromise(function(_0x1ddaef,_0x115a6e){var _0x19e253=0x0;if(_0x19e94b[_0x7812('0x12')]!==_0x7812('0x13')){_0x1ddaef(_0x19e94b);}db[_0x7812('0x14')][_0x7812('0x15')]({'where':{'role':_0x7812('0x13'),'online':!![],'id':{'$ne':_0x19e94b['id']}}})['then'](function(_0x1eff6e){_0x19e253=_0x1eff6e;return util[_0x7812('0x16')]();})[_0x7812('0x17')](function(_0x5e7ea8){if(_0x5e7ea8&&_0x5e7ea8['agents']&&_0x19e253>=_0x5e7ea8['agents']){throw Error(_0x7812('0x18'));}_0x1ddaef(_0x19e94b);})[_0x7812('0x19')](function(_0x7d1cae){_0x115a6e(_0x7d1cae);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 6aa03ce..e6d807d 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb34=['render','json','send','exports','404','status'];(function(_0xb91507,_0x1a4296){var _0x1f1136=function(_0x561bc8){while(--_0x561bc8){_0xb91507['push'](_0xb91507['shift']());}};_0x1f1136(++_0x1a4296);}(_0xeb34,0xc9));var _0x4eb3=function(_0x1d5458,_0x3acf09){_0x1d5458=_0x1d5458-0x0;var _0x9bf6f=_0xeb34[_0x1d5458];return _0x9bf6f;};'use strict';module[_0x4eb3('0x0')][0x194]=function pageNotFound(_0x41da65,_0x4f434d){var _0x3079fa=_0x4eb3('0x1');var _0x53afa9=0x194;var _0x1dea6a={'status':_0x53afa9};_0x4f434d[_0x4eb3('0x2')](_0x1dea6a['status']);_0x4f434d[_0x4eb3('0x3')](_0x3079fa,{},function(_0x174f4e,_0x21dae7){if(_0x174f4e){return _0x4f434d[_0x4eb3('0x2')](_0x1dea6a[_0x4eb3('0x2')])[_0x4eb3('0x4')](_0x1dea6a);}_0x4f434d[_0x4eb3('0x5')](_0x21dae7);});}; \ No newline at end of file +var _0xf60a=['json','send','404','status'];(function(_0x5a2660,_0x52e389){var _0x542d3b=function(_0x15a105){while(--_0x15a105){_0x5a2660['push'](_0x5a2660['shift']());}};_0x542d3b(++_0x52e389);}(_0xf60a,0x166));var _0xaf60=function(_0xa07ec5,_0xd94082){_0xa07ec5=_0xa07ec5-0x0;var _0x470e57=_0xf60a[_0xa07ec5];return _0x470e57;};'use strict';module['exports'][0x194]=function pageNotFound(_0x26672e,_0x2a2e60){var _0x476c71=_0xaf60('0x0');var _0x50a547=0x194;var _0x193795={'status':_0x50a547};_0x2a2e60['status'](_0x193795[_0xaf60('0x1')]);_0x2a2e60['render'](_0x476c71,{},function(_0x5add85,_0x13b79e){if(_0x5add85){return _0x2a2e60[_0xaf60('0x1')](_0x193795[_0xaf60('0x1')])[_0xaf60('0x2')](_0x193795);}_0x2a2e60[_0xaf60('0x3')](_0x13b79e);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 423ad9e..8502bd3 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fa0=['../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','hasOne','cascade','UserId','hasMany','Extensions','CmHopperFinal','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','SmsInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Contacts','cm_user_has_contacts','user_has_teams','MailInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoicePrefixes','MailQueue','MailQueues','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','UserSmsQueue','OpenchannelQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','CmList','cm_user_has_lists','user_has_voice_prefixes','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','SmsAccount','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','VoiceAgentReport','AgentReports','ContactId','Imap','Smtp','Dispositions','Answers','Interactions','MailApplication','List','ListId','Team','Account','Contact','mail_interaction_has_tags','user_has_mail_interactions','MailInteractionId','Attachment','Attachments','Interaction','restrict','TagId','Dashboard','Items','Disposition','FaxAccountId','Agents','FaxInteractionId','fax_interaction_has_tags','Tags','ThroughTags','AttachmentId','team_has_fax_queues','SmsAccountId','mandatoryDispositionPause','user_has_sms_accounts','SmsQueue','SmsMessage','SmsInteractionId','Users','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','MailAccountId','ChatApplication','Agent','Queue','ChatQueueId','Website','Owner','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','chat_group_has_users','ChatProactiveAction','CompanyId','JscriptySessionReport','ChatInteractions','Company','cm_contact_has_tags','CampaignId','Automation','All','OneAll','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','sms_interaction_has_tags','AllConditions','AnyConditions','TriggerId','Fields','AnalyticMetric','MetricId','SalesforceConfiguration','AccountId','Subjects','SubjectId','SalesforceField','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','SugarcrmAccount','Configurations','SugarcrmField','Description','int_desk_configuration_has_tags','ZohoField','ZendeskConfiguration','int_zendesk_configuration_has_tags','VtigerField','VtigerConfiguration','ChatQueueReport','FromId','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','VoiceQueues','team_has_whatsapp_queues','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','FromFaxAccountId','FromAgent','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','sequelize','determine','defaultsDeep','motion2','xcall','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','mysql','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag'];(function(_0x73906d,_0x56e6d8){var _0x5d03ff=function(_0xdd30d2){while(--_0xdd30d2){_0x73906d['push'](_0x73906d['shift']());}};_0x5d03ff(++_0x56e6d8);}(_0x5fa0,0x167));var _0x05fa=function(_0x52bb92,_0x95d061){_0x52bb92=_0x52bb92-0x0;var _0x37e354=_0x5fa0[_0x52bb92];return _0x37e354;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x05fa('0x0'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x05fa('0x1')]();config[_0x05fa('0x0')]=_[_0x05fa('0x2')](config['sequelize'],{'database':_0x05fa('0x3'),'username':_0x05fa('0x4'),'password':'xC@LL1234','options':{'host':_0x05fa('0x5'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x05fa('0x6')},'logging':![],'timezone':timezone[_0x05fa('0x7')](),'define':{'charset':_0x05fa('0x8'),'collate':_0x05fa('0x9')}}});config[_0x05fa('0xa')]=_[_0x05fa('0x2')](config['sequelizeHistory'],{'database':_0x05fa('0x3'),'username':_0x05fa('0x4'),'password':'xC@LL1234','options':{'host':_0x05fa('0x5'),'port':0xcea,'dialect':_0x05fa('0xb'),'dialectOptions':{'charset':_0x05fa('0x6')},'logging':![],'timezone':timezone[_0x05fa('0x7')](),'define':{'charset':'utf8','collate':_0x05fa('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x05fa('0x0')][_0x05fa('0xc')],config[_0x05fa('0x0')][_0x05fa('0xd')],config['sequelize'][_0x05fa('0xe')],config[_0x05fa('0x0')][_0x05fa('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x05fa('0xa')][_0x05fa('0xc')],config[_0x05fa('0xa')]['username'],config[_0x05fa('0xa')]['password'],config[_0x05fa('0xa')]['options'])};db[_0x05fa('0x10')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x12'));db['VoiceChanSpy']=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x13'));db[_0x05fa('0x14')]=db[_0x05fa('0x0')]['import']('../api/voiceContext/voiceContext.model');db[_0x05fa('0x15')]=db['sequelize'][_0x05fa('0x11')]('../api/voiceExtension/voiceExtension.model');db[_0x05fa('0x16')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x17'));db[_0x05fa('0x18')]=db[_0x05fa('0x0')]['import'](_0x05fa('0x19'));db[_0x05fa('0x1a')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/voiceRecording/voiceRecording.model');db[_0x05fa('0x1b')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x1c'));db[_0x05fa('0x1d')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x1e'));db[_0x05fa('0x1f')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x20'));db['VoiceCallReport']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x21'));db['VoiceDialReport']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x22'));db['VoiceAgentReport']=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x23'));db[_0x05fa('0x24')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x05fa('0x25')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x26'));db['Trunk']=db[_0x05fa('0x0')]['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x27'));db[_0x05fa('0x28')]=db[_0x05fa('0x0')]['import'](_0x05fa('0x29'));db[_0x05fa('0x2a')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x05fa('0x2b')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x2c'));db[_0x05fa('0x2d')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0x05fa('0x0')]['import'](_0x05fa('0x2e'));db['UserSmsQueue']=db[_0x05fa('0x0')]['import'](_0x05fa('0x2f'));db[_0x05fa('0x30')]=db[_0x05fa('0x0')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x05fa('0x31')]=db[_0x05fa('0x0')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x05fa('0x32')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x33'));db[_0x05fa('0x34')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x35'));db[_0x05fa('0x36')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x37'));db['MailQueue']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x38'));db[_0x05fa('0x39')]=db[_0x05fa('0x0')]['import'](_0x05fa('0x3a'));db[_0x05fa('0x3b')]=db['sequelize'][_0x05fa('0x11')]('../api/mailInteraction/mailInteraction.model');db[_0x05fa('0x3c')]=db[_0x05fa('0x0')]['import']('../api/mailMessage/mailMessage.model');db['MailApplication']=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x3d'));db[_0x05fa('0x3e')]=db['sequelize']['import'](_0x05fa('0x3f'));db['Dashboard']=db[_0x05fa('0x0')]['import']('../api/dashboard/dashboard.model');db[_0x05fa('0x40')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x41'));db[_0x05fa('0x42')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x43'));db[_0x05fa('0x44')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/faxApplication/faxApplication.model');db[_0x05fa('0x45')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x46'));db[_0x05fa('0x47')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x48'));db[_0x05fa('0x49')]=db['sequelize']['import'](_0x05fa('0x4a'));db[_0x05fa('0x4b')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x4c'));db['SmsAccount']=db[_0x05fa('0x0')]['import']('../api/smsAccount/smsAccount.model');db[_0x05fa('0x4d')]=db[_0x05fa('0x0')]['import'](_0x05fa('0x4e'));db[_0x05fa('0x4f')]=db[_0x05fa('0x0')]['import']('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x50'));db['SmsQueue']=db['sequelize']['import']('../api/smsQueue/smsQueue.model');db[_0x05fa('0x51')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x52'));db['OpenchannelApplication']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x53'));db[_0x05fa('0x54')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x55'));db[_0x05fa('0x56')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x57'));db['OpenchannelQueue']=db[_0x05fa('0x0')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0x05fa('0x58')]=db['sequelize']['import']('../api/chatWebsite/chatWebsite.model');db[_0x05fa('0x59')]=db['sequelize'][_0x05fa('0x11')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x5a'));db[_0x05fa('0x5b')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x5c'));db[_0x05fa('0x5d')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x5e'));db[_0x05fa('0x5f')]=db['sequelize']['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x05fa('0x60')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/chatQueue/chatQueue.model');db[_0x05fa('0x61')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x62'));db['ChatProactiveAction']=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x63'));db[_0x05fa('0x64')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x65'));db[_0x05fa('0x66')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x67'));db[_0x05fa('0x68')]=db['sequelize'][_0x05fa('0x11')]('../api/cmHopper/cmHopper.model');db[_0x05fa('0x69')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x6a'));db['CmHopperFinal']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x6b'));db[_0x05fa('0x6c')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x05fa('0x0')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x05fa('0x6d')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x6e'));db['Action']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x6f'));db['Automation']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x70'));db[_0x05fa('0x71')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x72'));db['Disposition']=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x73'));db[_0x05fa('0x74')]=db[_0x05fa('0x0')]['import']('../api/condition/condition.model');db[_0x05fa('0x75')]=db[_0x05fa('0x0')]['import']('../api/interval/interval.model');db[_0x05fa('0x76')]=db['sequelize'][_0x05fa('0x11')]('../api/pause/pause.model');db[_0x05fa('0x77')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x78'));db[_0x05fa('0x79')]=db['sequelize']['import'](_0x05fa('0x7a'));db[_0x05fa('0x7b')]=db[_0x05fa('0x0')]['import'](_0x05fa('0x7c'));db[_0x05fa('0x7d')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x7e'));db[_0x05fa('0x7f')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x80'));db[_0x05fa('0x81')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x82'));db[_0x05fa('0x83')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x84'));db[_0x05fa('0x85')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x86'));db[_0x05fa('0x87')]=db[_0x05fa('0x0')]['import'](_0x05fa('0x88'));db[_0x05fa('0x89')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/integrationReport/integrationReport.model');db[_0x05fa('0x8a')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x8b'));db[_0x05fa('0x8c')]=db[_0x05fa('0x0')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x05fa('0x8d')]=db[_0x05fa('0x0')]['import'](_0x05fa('0x8e'));db['AnalyticMetric']=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x8f'));db[_0x05fa('0x90')]=db[_0x05fa('0x0')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x05fa('0x91')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x92'));db[_0x05fa('0x93')]=db['sequelize']['import'](_0x05fa('0x94'));db['SalesforceConfiguration']=db[_0x05fa('0x0')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x05fa('0x0')]['import'](_0x05fa('0x95'));db['SugarcrmAccount']=db[_0x05fa('0x0')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x05fa('0x96')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x97'));db['SugarcrmField']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x98'));db[_0x05fa('0x99')]=db[_0x05fa('0x0')]['import'](_0x05fa('0x9a'));db[_0x05fa('0x9b')]=db['sequelize']['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x05fa('0x9c')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x9d'));db[_0x05fa('0x9e')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0x9f'));db[_0x05fa('0xa0')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xa1'));db['ZohoField']=db['sequelize'][_0x05fa('0x11')](_0x05fa('0xa2'));db[_0x05fa('0xa3')]=db[_0x05fa('0x0')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xa4'));db[_0x05fa('0xa5')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xa6'));db[_0x05fa('0xa7')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xa8'));db[_0x05fa('0xa9')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xaa'));db[_0x05fa('0xab')]=db['sequelize']['import'](_0x05fa('0xac'));db[_0x05fa('0xad')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xae'));db['VtigerConfiguration']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xaf'));db['VtigerField']=db[_0x05fa('0x0')]['import'](_0x05fa('0xb0'));db[_0x05fa('0xb1')]=db[_0x05fa('0x0')]['import'](_0x05fa('0xb2'));db[_0x05fa('0xb3')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xb4'));db[_0x05fa('0xb5')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/intServicenowField/intServicenowField.model');db[_0x05fa('0xb6')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xb7'));db[_0x05fa('0xb8')]=db['sequelize'][_0x05fa('0x11')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x05fa('0xb9')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0xba'));db[_0x05fa('0xbb')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xbc'));db[_0x05fa('0xbd')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xbe'));db[_0x05fa('0xbf')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0xc0'));db[_0x05fa('0x87')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0x88'));db['Network']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xc1'));db['ChatQueueReport']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xc2'));db['ChatInternalMessage']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xc3'));db[_0x05fa('0xc4')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0xc5'));db['JscriptyQuestionReport']=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xc6'));db['SmsQueueReport']=db['sequelize'][_0x05fa('0x11')]('../api/smsQueueReport/smsQueueReport.model');db[_0x05fa('0xc7')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xc8'));db[_0x05fa('0xc9')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0xca'));db[_0x05fa('0xcb')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xcc'));db['Setting']=db['sequelize'][_0x05fa('0x11')](_0x05fa('0xcd'));db[_0x05fa('0xce')]=db['sequelize']['import'](_0x05fa('0xcf'));db[_0x05fa('0xd0')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xd1'));db[_0x05fa('0xd2')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xd3'));db['SquareMessage']=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/squareMessage/squareMessage.model');db['Team']=db['sequelize']['import']('../api/team/team.model');db['License']=db[_0x05fa('0x0')]['import'](_0x05fa('0xd4'));db[_0x05fa('0xd5')]=db[_0x05fa('0x0')]['import'](_0x05fa('0xd6'));db[_0x05fa('0xd7')]=db['sequelize']['import'](_0x05fa('0xd8'));db['Attachment']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xd9'));db[_0x05fa('0xda')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/plugin/plugin.model');db[_0x05fa('0xdb')]=db[_0x05fa('0x0')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0x05fa('0xdc')]=db['sequelize'][_0x05fa('0x11')](_0x05fa('0xdd'));db[_0x05fa('0xde')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xdf'));db[_0x05fa('0xe0')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xe1'));db[_0x05fa('0xe2')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/cmList/cmList.model');db[_0x05fa('0xe3')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xe4'));db[_0x05fa('0xe5')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xe6'));db[_0x05fa('0xe7')]=db['sequelize'][_0x05fa('0x11')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xe8'));db[_0x05fa('0xe9')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/userNotification/userNotification.model');db[_0x05fa('0xea')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xeb'));db['WhatsappApplication']=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xec'));db[_0x05fa('0xed')]=db[_0x05fa('0x0')]['import'](_0x05fa('0xee'));db['WhatsappMessage']=db['sequelize'][_0x05fa('0x11')](_0x05fa('0xef'));db[_0x05fa('0xf0')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xf1'));db[_0x05fa('0xf2')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xf3'));db['WhatsappQueue']=db[_0x05fa('0x0')]['import'](_0x05fa('0xf4'));db[_0x05fa('0xf5')]=db[_0x05fa('0x0')][_0x05fa('0x11')](_0x05fa('0xf6'));db[_0x05fa('0xf7')]=db[_0x05fa('0x0')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x05fa('0xf8')]=db[_0x05fa('0x0')]['import'](_0x05fa('0xf9'));db[_0x05fa('0xfa')]=db[_0x05fa('0x0')][_0x05fa('0x11')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x05fa('0x10')][_0x05fa('0xfb')](db[_0x05fa('0x1d')],{'as':_0x05fa('0x1d'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0xfd')});db[_0x05fa('0x10')][_0x05fa('0xfe')](db[_0x05fa('0x1a')],{'as':'Recordings','foreignKey':_0x05fa('0xfd')});db[_0x05fa('0x10')]['hasMany'](db[_0x05fa('0x28')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x05fa('0x10')]['hasMany'](db['VoiceExtension'],{'as':_0x05fa('0xff'),'onDelete':_0x05fa('0xfc'),'hooks':!![]});db[_0x05fa('0x10')]['hasMany'](db[_0x05fa('0x100')],{'as':_0x05fa('0x101'),'foreignKey':'UserId'});db[_0x05fa('0x10')][_0x05fa('0xfe')](db[_0x05fa('0x6c')],{'as':_0x05fa('0x102'),'foreignKey':'UserId'});db[_0x05fa('0x10')][_0x05fa('0xfe')](db[_0x05fa('0x103')],{'as':_0x05fa('0x103'),'foreignKey':_0x05fa('0xfd')});db['User']['hasMany'](db[_0x05fa('0x54')],{'as':_0x05fa('0x104'),'foreignKey':_0x05fa('0xfd')});db[_0x05fa('0x10')][_0x05fa('0xfe')](db[_0x05fa('0x5b')],{'as':'ChatInteractions','foreignKey':_0x05fa('0xfd')});db[_0x05fa('0x10')]['hasMany'](db[_0x05fa('0x4f')],{'as':_0x05fa('0x105'),'foreignKey':_0x05fa('0xfd')});db[_0x05fa('0x10')]['hasMany'](db[_0x05fa('0x45')],{'as':'FaxInteractions','foreignKey':_0x05fa('0xfd')});db[_0x05fa('0x10')]['hasMany'](db[_0x05fa('0x3b')],{'as':'MailInteractions','foreignKey':_0x05fa('0xfd')});db[_0x05fa('0x10')][_0x05fa('0xfe')](db[_0x05fa('0xed')],{'as':_0x05fa('0x106'),'foreignKey':_0x05fa('0xfd')});db[_0x05fa('0x10')][_0x05fa('0xfe')](db[_0x05fa('0xe9')],{'as':_0x05fa('0x107'),'foreignKey':_0x05fa('0x108')});db['User'][_0x05fa('0x109')](db[_0x05fa('0xe5')],{'as':'UserProfile','foreignKey':_0x05fa('0x10a')});db['User'][_0x05fa('0x10b')](db[_0x05fa('0x61')],{'as':'Groups','through':'chat_group_has_users'});db[_0x05fa('0x10')][_0x05fa('0x10b')](db[_0x05fa('0x66')],{'as':_0x05fa('0x10c'),'through':_0x05fa('0x10d')});db[_0x05fa('0x10')][_0x05fa('0x10b')](db['CmList'],{'as':'Lists','through':'cm_user_has_lists'});db[_0x05fa('0x10')][_0x05fa('0x10b')](db['Team'],{'through':_0x05fa('0x10e')});db[_0x05fa('0x10')][_0x05fa('0x10b')](db[_0x05fa('0x3b')],{'as':_0x05fa('0x10f'),'through':'user_has_mail_interactions'});db['User'][_0x05fa('0x10b')](db[_0x05fa('0x5b')],{'as':'ChatInteractions','through':_0x05fa('0x110')});db[_0x05fa('0x10')][_0x05fa('0x10b')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x05fa('0x111')});db[_0x05fa('0x10')][_0x05fa('0x10b')](db[_0x05fa('0x4f')],{'as':_0x05fa('0x105'),'through':_0x05fa('0x112')});db[_0x05fa('0x10')][_0x05fa('0x10b')](db[_0x05fa('0x54')],{'as':_0x05fa('0x104'),'through':_0x05fa('0x113')});db['User'][_0x05fa('0x10b')](db['WhatsappInteraction'],{'as':_0x05fa('0x106'),'through':'user_has_whatsapp_interactions'});db['User'][_0x05fa('0x10b')](db[_0x05fa('0x18')],{'as':'VoiceQueues','through':_0x05fa('0x2a'),'required':![]});db['User']['belongsToMany'](db[_0x05fa('0xe3')],{'as':_0x05fa('0x114'),'through':_0x05fa('0xfa'),'required':![]});db['User'][_0x05fa('0x10b')](db[_0x05fa('0x115')],{'as':_0x05fa('0x116'),'through':_0x05fa('0x2d'),'required':![]});db[_0x05fa('0x10')][_0x05fa('0x10b')](db[_0x05fa('0x60')],{'as':_0x05fa('0x117'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x05fa('0x10')][_0x05fa('0x10b')](db[_0x05fa('0x49')],{'as':_0x05fa('0x118'),'through':_0x05fa('0x119'),'required':![]});db[_0x05fa('0x10')][_0x05fa('0x10b')](db['SmsQueue'],{'as':_0x05fa('0x11a'),'through':_0x05fa('0x11b'),'required':![]});db[_0x05fa('0x10')][_0x05fa('0x10b')](db[_0x05fa('0x11c')],{'as':_0x05fa('0x11d'),'through':_0x05fa('0x30'),'required':![]});db['User']['belongsToMany'](db[_0x05fa('0x11e')],{'as':_0x05fa('0x11f'),'through':'UserWhatsappQueue','required':![]});db[_0x05fa('0x10')]['belongsToMany'](db[_0x05fa('0x120')],{'through':_0x05fa('0x121')});db[_0x05fa('0x10')][_0x05fa('0x10b')](db[_0x05fa('0xe3')],{'as':_0x05fa('0x114'),'through':_0x05fa('0x122'),'required':![]});db['User']['belongsToMany'](db[_0x05fa('0x58')],{'as':_0x05fa('0x123'),'through':'user_has_chat_websites'});db[_0x05fa('0x10')][_0x05fa('0x10b')](db[_0x05fa('0x42')],{'as':_0x05fa('0x124'),'through':_0x05fa('0x125')});db[_0x05fa('0x10')]['belongsToMany'](db[_0x05fa('0x36')],{'as':_0x05fa('0x126'),'through':'user_has_mail_accounts'});db['User'][_0x05fa('0x10b')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x05fa('0x10')][_0x05fa('0x10b')](db[_0x05fa('0x127')],{'as':_0x05fa('0x128'),'through':'user_has_sms_accounts'});db['User'][_0x05fa('0x10b')](db[_0x05fa('0xea')],{'as':_0x05fa('0x129'),'through':_0x05fa('0x12a')});db[_0x05fa('0x10')][_0x05fa('0x10b')](db[_0x05fa('0xd0')],{'as':_0x05fa('0x12b'),'through':_0x05fa('0x12c')});db['VoiceChanSpy'][_0x05fa('0xfe')](db[_0x05fa('0x15')],{'as':'SpiedAgents','onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x12d')});db[_0x05fa('0x14')][_0x05fa('0xfe')](db[_0x05fa('0x15')],{'onDelete':_0x05fa('0xfc')});db[_0x05fa('0x15')][_0x05fa('0xfe')](db[_0x05fa('0x15')],{'as':_0x05fa('0x12e'),'onDelete':_0x05fa('0xfc')});db[_0x05fa('0x16')][_0x05fa('0x10b')](db[_0x05fa('0x7d')],{'as':_0x05fa('0x12f'),'through':_0x05fa('0x130')});db[_0x05fa('0x18')][_0x05fa('0xfe')](db[_0x05fa('0x28')],{'as':'Members','foreignKey':_0x05fa('0x131')});db['VoiceQueue'][_0x05fa('0xfe')](db['CmHopper'],{'as':_0x05fa('0x132'),'foreignKey':'VoiceQueueId'});db[_0x05fa('0x18')][_0x05fa('0xfe')](db[_0x05fa('0x100')],{'as':_0x05fa('0x101'),'foreignKey':'VoiceQueueId'});db[_0x05fa('0x18')][_0x05fa('0xfe')](db[_0x05fa('0x6c')],{'as':_0x05fa('0x133'),'foreignKey':'VoiceQueueId'});db[_0x05fa('0x18')][_0x05fa('0xfe')](db[_0x05fa('0x103')],{'as':'ReportAgentPreview','foreignKey':_0x05fa('0x131')});db[_0x05fa('0x18')][_0x05fa('0xfe')](db[_0x05fa('0x69')],{'as':_0x05fa('0x134'),'foreignKey':_0x05fa('0x131')});db[_0x05fa('0x18')][_0x05fa('0xfe')](db['JscriptySessionReport'],{'as':_0x05fa('0x135'),'foreignKey':_0x05fa('0x131')});db[_0x05fa('0x18')][_0x05fa('0x109')](db[_0x05fa('0x136')],{'as':'Trunk','foreignKey':_0x05fa('0x137')});db['VoiceQueue'][_0x05fa('0x109')](db[_0x05fa('0x136')],{'as':_0x05fa('0x138'),'foreignKey':_0x05fa('0x139')});db[_0x05fa('0x18')][_0x05fa('0x109')](db[_0x05fa('0x75')],{'as':_0x05fa('0x75'),'foreignKey':_0x05fa('0x13a')});db[_0x05fa('0x18')][_0x05fa('0x109')](db[_0x05fa('0x76')],{'as':'mandatoryDispositionPause','foreignKey':_0x05fa('0x13b')});db[_0x05fa('0x18')][_0x05fa('0x10b')](db[_0x05fa('0x120')],{'as':_0x05fa('0x13c'),'through':_0x05fa('0x13d')});db['VoiceQueue'][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':'Agents','through':_0x05fa('0x2a')});db[_0x05fa('0x18')][_0x05fa('0x10b')](db['Team'],{'as':_0x05fa('0x13e'),'through':_0x05fa('0xf7')});db[_0x05fa('0x18')]['belongsToMany'](db[_0x05fa('0x120')],{'as':_0x05fa('0x13f'),'through':_0x05fa('0x140')});db[_0x05fa('0x1a')]['belongsTo'](db[_0x05fa('0x10')],{'as':_0x05fa('0x10'),'foreignKey':_0x05fa('0xfd')});db['ScreenRecording'][_0x05fa('0x109')](db[_0x05fa('0x10')],{'as':_0x05fa('0x10'),'foreignKey':'UserId'});db[_0x05fa('0x1d')][_0x05fa('0xfe')](db[_0x05fa('0x1f')],{'as':_0x05fa('0x141'),'onDelete':'cascade','foreignKey':_0x05fa('0x142'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0x05fa('0x109')](db[_0x05fa('0x1d')],{'foreignKey':_0x05fa('0x142'),'targetKey':_0x05fa('0x143')});db[_0x05fa('0x144')][_0x05fa('0xfe')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x05fa('0x145'),'constraints':![]});db[_0x05fa('0x144')]['hasMany'](db[_0x05fa('0x146')],{'as':_0x05fa('0x147'),'foreignKey':_0x05fa('0x145'),'constraints':![]});db[_0x05fa('0x144')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'as':_0x05fa('0x10'),'foreignKey':_0x05fa('0xfd')});db[_0x05fa('0x144')]['belongsTo'](db[_0x05fa('0x66')],{'as':'Contact','foreignKey':_0x05fa('0x148')});db[_0x05fa('0x32')]['belongsTo'](db[_0x05fa('0x36')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x05fa('0x34')]['belongsTo'](db[_0x05fa('0x36')],{'as':_0x05fa('0x36'),'foreignKey':'MailAccountId'});db[_0x05fa('0x36')][_0x05fa('0xfb')](db[_0x05fa('0x32')],{'as':_0x05fa('0x149'),'onDelete':_0x05fa('0xfc')});db['MailAccount']['hasOne'](db[_0x05fa('0x34')],{'as':_0x05fa('0x14a'),'onDelete':'cascade'});db[_0x05fa('0x36')][_0x05fa('0xfe')](db['Disposition'],{'as':_0x05fa('0x14b'),'foreignKey':'MailAccountId','onDelete':_0x05fa('0xfc')});db['MailAccount'][_0x05fa('0xfe')](db[_0x05fa('0x71')],{'as':_0x05fa('0x14c'),'foreignKey':'MailAccountId'});db[_0x05fa('0x36')][_0x05fa('0xfe')](db[_0x05fa('0x3c')],{'as':_0x05fa('0x141'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x05fa('0xfe')](db[_0x05fa('0x3b')],{'as':_0x05fa('0x14d')});db['MailAccount'][_0x05fa('0xfe')](db[_0x05fa('0x14e')],{'as':_0x05fa('0x12e')});db[_0x05fa('0x36')]['belongsTo'](db[_0x05fa('0x120')],{'as':_0x05fa('0x14f'),'foreignKey':_0x05fa('0x150')});db[_0x05fa('0x36')][_0x05fa('0x109')](db[_0x05fa('0x81')],{'as':'Template','foreignKey':'TemplateId'});db['MailAccount'][_0x05fa('0x109')](db[_0x05fa('0x76')],{'as':'mandatoryDispositionPause','foreignKey':_0x05fa('0x13b')});db[_0x05fa('0x36')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x05fa('0x115')]['belongsToMany'](db[_0x05fa('0x10')],{'as':'Agents','through':'UserMailQueue'});db['MailQueue'][_0x05fa('0x10b')](db[_0x05fa('0x151')],{'through':'team_has_mail_queues','as':_0x05fa('0x13e')});db[_0x05fa('0x3b')][_0x05fa('0xfe')](db[_0x05fa('0x3c')],{'as':_0x05fa('0x141'),'onDelete':_0x05fa('0xfc'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x05fa('0x109')](db[_0x05fa('0x36')],{'as':_0x05fa('0x152'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0x05fa('0x109')](db[_0x05fa('0x66')],{'as':_0x05fa('0x153'),'foreignKey':'ContactId'});db[_0x05fa('0x3b')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'as':'Owner','foreignKey':_0x05fa('0xfd')});db['MailInteraction'][_0x05fa('0x10b')](db[_0x05fa('0x7f')],{'through':_0x05fa('0x154'),'as':'Tags'});db[_0x05fa('0x3b')]['belongsToMany'](db[_0x05fa('0x7f')],{'through':_0x05fa('0x154'),'as':'ThroughTags'});db[_0x05fa('0x3b')][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':'Users','through':_0x05fa('0x155'),'foreignKey':_0x05fa('0x156')});db[_0x05fa('0x3c')][_0x05fa('0xfe')](db[_0x05fa('0x157')],{'as':_0x05fa('0x158'),'onDelete':_0x05fa('0xfc')});db[_0x05fa('0x3c')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'as':'User'});db[_0x05fa('0x3c')][_0x05fa('0x109')](db[_0x05fa('0x66')],{'onDelete':_0x05fa('0xfc'),'as':_0x05fa('0x153')});db[_0x05fa('0x3c')]['belongsTo'](db[_0x05fa('0x3b')],{'as':_0x05fa('0x159'),'foreignKey':_0x05fa('0x156')});db[_0x05fa('0x3c')][_0x05fa('0x109')](db[_0x05fa('0x36')],{'as':_0x05fa('0x152'),'foreignKey':'MailAccountId'});db[_0x05fa('0x3c')][_0x05fa('0x109')](db[_0x05fa('0x58')],{'as':_0x05fa('0x58'),'foreignKey':'ChatWebsiteId'});db[_0x05fa('0x3c')][_0x05fa('0x109')](db['ChatOfflineMessage'],{'as':_0x05fa('0x5f'),'foreignKey':'ChatOfflineMessageId'});db[_0x05fa('0x14e')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x05fa('0x14e')][_0x05fa('0x109')](db[_0x05fa('0x115')],{'onDelete':'restrict'});db[_0x05fa('0x14e')][_0x05fa('0x109')](db[_0x05fa('0x36')],{'onDelete':_0x05fa('0x15a')});db[_0x05fa('0x14e')][_0x05fa('0x109')](db[_0x05fa('0x75')],{'onDelete':_0x05fa('0x15a'),'foreignKey':_0x05fa('0x13a')});db[_0x05fa('0x14e')][_0x05fa('0x109')](db[_0x05fa('0x7f')],{'onDelete':_0x05fa('0x15a'),'foreignKey':_0x05fa('0x15b')});db[_0x05fa('0x3e')]['belongsTo'](db['MailAccount'],{});db[_0x05fa('0x3e')][_0x05fa('0x109')](db[_0x05fa('0x120')],{'as':_0x05fa('0x14f'),'foreignKey':_0x05fa('0x150')});db[_0x05fa('0x3e')]['belongsTo'](db[_0x05fa('0x66')],{'as':'Contact','foreignKey':_0x05fa('0x148')});db[_0x05fa('0x3e')]['belongsTo'](db['MailInteraction'],{});db[_0x05fa('0x3e')][_0x05fa('0x109')](db['MailMessage'],{});db['MailQueueReport'][_0x05fa('0x109')](db[_0x05fa('0x10')],{});db['MailQueueReport'][_0x05fa('0x109')](db[_0x05fa('0x115')],{});db[_0x05fa('0x15c')]['hasMany'](db[_0x05fa('0x40')],{'as':_0x05fa('0x15d'),'onDelete':'cascade'});db[_0x05fa('0x42')]['hasMany'](db[_0x05fa('0x15e')],{'as':_0x05fa('0x14b'),'foreignKey':'FaxAccountId','onDelete':_0x05fa('0xfc')});db[_0x05fa('0x42')]['hasMany'](db[_0x05fa('0x71')],{'as':_0x05fa('0x14c'),'foreignKey':_0x05fa('0x15f')});db[_0x05fa('0x42')][_0x05fa('0xfe')](db[_0x05fa('0x45')],{'as':'Interactions'});db[_0x05fa('0x42')][_0x05fa('0xfe')](db['FaxApplication'],{'as':_0x05fa('0x12e')});db[_0x05fa('0x42')]['hasMany'](db[_0x05fa('0x15')],{'as':'Exntensions','onDelete':_0x05fa('0xfc')});db[_0x05fa('0x42')]['hasMany'](db[_0x05fa('0x47')],{'as':_0x05fa('0x141')});db[_0x05fa('0x42')]['belongsTo'](db[_0x05fa('0x136')],{'as':_0x05fa('0x136')});db['FaxAccount'][_0x05fa('0x109')](db[_0x05fa('0x120')],{'as':_0x05fa('0x14f'),'foreignKey':_0x05fa('0x150')});db[_0x05fa('0x42')][_0x05fa('0x109')](db[_0x05fa('0x76')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x05fa('0x42')][_0x05fa('0x10b')](db['User'],{'as':_0x05fa('0x160'),'through':_0x05fa('0x125')});db[_0x05fa('0x44')]['belongsTo'](db['User'],{'onDelete':_0x05fa('0x15a')});db['FaxApplication']['belongsTo'](db[_0x05fa('0x49')],{'onDelete':_0x05fa('0x15a')});db['FaxApplication'][_0x05fa('0x109')](db['FaxAccount'],{'onDelete':'restrict'});db[_0x05fa('0x44')][_0x05fa('0x109')](db[_0x05fa('0x7f')],{'onDelete':_0x05fa('0x15a'),'foreignKey':_0x05fa('0x15b')});db[_0x05fa('0x45')]['hasMany'](db[_0x05fa('0x47')],{'as':_0x05fa('0x141'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x161')});db[_0x05fa('0x45')][_0x05fa('0x109')](db[_0x05fa('0x42')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x05fa('0x45')][_0x05fa('0x109')](db['CmContact'],{'as':_0x05fa('0x153'),'foreignKey':_0x05fa('0x148')});db[_0x05fa('0x45')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'as':'Owner','foreignKey':_0x05fa('0xfd')});db[_0x05fa('0x45')][_0x05fa('0x10b')](db[_0x05fa('0x7f')],{'through':_0x05fa('0x162'),'as':_0x05fa('0x163')});db[_0x05fa('0x45')]['belongsToMany'](db['Tag'],{'through':_0x05fa('0x162'),'as':_0x05fa('0x164')});db['FaxInteraction'][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':'Users','through':_0x05fa('0x111'),'foreignKey':_0x05fa('0x161')});db[_0x05fa('0x47')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'onDelete':_0x05fa('0xfc'),'as':_0x05fa('0x10')});db['FaxMessage'][_0x05fa('0x109')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0x05fa('0x161')});db[_0x05fa('0x47')][_0x05fa('0x109')](db[_0x05fa('0x66')],{'onDelete':_0x05fa('0xfc'),'as':_0x05fa('0x153')});db[_0x05fa('0x47')][_0x05fa('0x109')](db[_0x05fa('0x157')],{'as':'Attachment','foreignKey':_0x05fa('0x165')});db[_0x05fa('0x47')][_0x05fa('0x109')](db[_0x05fa('0x42')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x05fa('0x49')][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':_0x05fa('0x160'),'through':_0x05fa('0x119')});db[_0x05fa('0x49')][_0x05fa('0x10b')](db[_0x05fa('0x151')],{'through':_0x05fa('0x166'),'as':_0x05fa('0x13e')});db[_0x05fa('0x4b')][_0x05fa('0x109')](db[_0x05fa('0x42')],{});db[_0x05fa('0x4b')]['belongsTo'](db['CmList'],{'as':_0x05fa('0x14f'),'foreignKey':_0x05fa('0x150')});db[_0x05fa('0x4b')]['belongsTo'](db['CmContact'],{'as':_0x05fa('0x153'),'foreignKey':_0x05fa('0x148')});db[_0x05fa('0x4b')][_0x05fa('0x109')](db[_0x05fa('0x45')],{});db[_0x05fa('0x4b')][_0x05fa('0x109')](db[_0x05fa('0x47')],{});db[_0x05fa('0x4b')][_0x05fa('0x109')](db[_0x05fa('0x10')],{});db[_0x05fa('0x4b')]['belongsTo'](db[_0x05fa('0x49')],{});db[_0x05fa('0x127')][_0x05fa('0xfe')](db[_0x05fa('0x15e')],{'as':'Dispositions','foreignKey':_0x05fa('0x167'),'onDelete':_0x05fa('0xfc')});db[_0x05fa('0x127')][_0x05fa('0xfe')](db['CannedAnswer'],{'as':_0x05fa('0x14c'),'foreignKey':_0x05fa('0x167')});db[_0x05fa('0x127')][_0x05fa('0xfe')](db['SmsMessage'],{'as':_0x05fa('0x141'),'foreignKey':_0x05fa('0x167')});db[_0x05fa('0x127')][_0x05fa('0xfe')](db[_0x05fa('0x4f')],{'as':_0x05fa('0x14d')});db['SmsAccount'][_0x05fa('0xfe')](db[_0x05fa('0x4d')],{'as':_0x05fa('0x12e')});db['SmsAccount'][_0x05fa('0x109')](db[_0x05fa('0x120')],{'as':'List','foreignKey':_0x05fa('0x150')});db['SmsAccount'][_0x05fa('0x109')](db[_0x05fa('0x76')],{'as':_0x05fa('0x168'),'foreignKey':_0x05fa('0x13b')});db['SmsAccount'][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':_0x05fa('0x160'),'through':_0x05fa('0x169')});db[_0x05fa('0x4d')][_0x05fa('0x109')](db['User'],{'onDelete':_0x05fa('0x15a')});db[_0x05fa('0x4d')][_0x05fa('0x109')](db[_0x05fa('0x16a')],{'onDelete':_0x05fa('0x15a')});db['SmsApplication'][_0x05fa('0x109')](db[_0x05fa('0x127')],{'onDelete':_0x05fa('0x15a')});db['SmsApplication']['belongsTo'](db[_0x05fa('0x75')],{'onDelete':_0x05fa('0x15a'),'foreignKey':_0x05fa('0x13a')});db[_0x05fa('0x4d')][_0x05fa('0x109')](db[_0x05fa('0x7f')],{'onDelete':_0x05fa('0x15a'),'foreignKey':'TagId'});db['SmsInteraction'][_0x05fa('0xfe')](db[_0x05fa('0x16b')],{'as':'Messages','onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x16c')});db[_0x05fa('0x4f')]['belongsTo'](db['SmsAccount'],{'as':'Account','foreignKey':_0x05fa('0x167')});db[_0x05fa('0x4f')][_0x05fa('0x109')](db[_0x05fa('0x66')],{'as':_0x05fa('0x153'),'foreignKey':'ContactId'});db[_0x05fa('0x4f')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'as':'Owner','foreignKey':_0x05fa('0xfd')});db['SmsInteraction'][_0x05fa('0x10b')](db[_0x05fa('0x7f')],{'through':'sms_interaction_has_tags','as':_0x05fa('0x163')});db[_0x05fa('0x4f')][_0x05fa('0x10b')](db[_0x05fa('0x7f')],{'through':'sms_interaction_has_tags','as':_0x05fa('0x164')});db[_0x05fa('0x4f')][_0x05fa('0x10b')](db['User'],{'as':_0x05fa('0x16d'),'through':_0x05fa('0x112'),'foreignKey':_0x05fa('0x16c')});db[_0x05fa('0x16b')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'as':_0x05fa('0x10')});db[_0x05fa('0x16b')][_0x05fa('0x109')](db[_0x05fa('0x66')],{'onDelete':'cascade','as':_0x05fa('0x153')});db[_0x05fa('0x16b')][_0x05fa('0x109')](db[_0x05fa('0x4f')],{'onDelete':'cascade','as':_0x05fa('0x159'),'foreignKey':_0x05fa('0x16c')});db['SmsMessage'][_0x05fa('0x109')](db[_0x05fa('0x127')],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x167')});db['SmsQueue'][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':_0x05fa('0x160'),'through':_0x05fa('0x11b'),'foreignKey':_0x05fa('0x16e')});db[_0x05fa('0x16a')]['belongsToMany'](db['Team'],{'through':_0x05fa('0x16f'),'as':'Teams'});db[_0x05fa('0x51')][_0x05fa('0xfe')](db['Disposition'],{'as':_0x05fa('0x14b'),'foreignKey':_0x05fa('0x170'),'onDelete':_0x05fa('0xfc')});db[_0x05fa('0x51')]['hasMany'](db[_0x05fa('0x71')],{'as':_0x05fa('0x14c'),'foreignKey':_0x05fa('0x170')});db[_0x05fa('0x51')][_0x05fa('0xfe')](db[_0x05fa('0x54')],{'as':_0x05fa('0x14d'),'foreignKey':_0x05fa('0x170')});db[_0x05fa('0x51')]['hasMany'](db[_0x05fa('0x56')],{'as':'Messages','foreignKey':_0x05fa('0x170')});db[_0x05fa('0x51')][_0x05fa('0xfe')](db[_0x05fa('0x171')],{'as':_0x05fa('0x12e'),'foreignKey':_0x05fa('0x170')});db[_0x05fa('0x51')]['belongsTo'](db[_0x05fa('0x120')],{'as':'List','foreignKey':_0x05fa('0x150')});db[_0x05fa('0x51')][_0x05fa('0x109')](db[_0x05fa('0x76')],{'as':_0x05fa('0x168'),'foreignKey':_0x05fa('0x13b')});db['OpenchannelAccount'][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':_0x05fa('0x160'),'through':_0x05fa('0x172')});db[_0x05fa('0x171')]['belongsTo'](db[_0x05fa('0x10')],{'onDelete':'restrict'});db[_0x05fa('0x171')][_0x05fa('0x109')](db[_0x05fa('0x11c')],{'onDelete':_0x05fa('0x15a'),'foreignKey':_0x05fa('0x173')});db[_0x05fa('0x171')]['belongsTo'](db[_0x05fa('0x51')],{'onDelete':_0x05fa('0x15a'),'foreignKey':_0x05fa('0x170')});db[_0x05fa('0x171')][_0x05fa('0x109')](db[_0x05fa('0x75')],{'onDelete':_0x05fa('0x15a'),'foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x05fa('0x109')](db['Tag'],{'onDelete':_0x05fa('0x15a'),'foreignKey':_0x05fa('0x15b')});db[_0x05fa('0x54')][_0x05fa('0xfe')](db[_0x05fa('0x56')],{'as':_0x05fa('0x141'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x174')});db['OpenchannelInteraction']['belongsTo'](db[_0x05fa('0x51')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction']['belongsTo'](db[_0x05fa('0x66')],{'as':_0x05fa('0x153'),'foreignKey':_0x05fa('0x148')});db[_0x05fa('0x54')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'as':'Owner','foreignKey':_0x05fa('0xfd')});db['OpenchannelInteraction'][_0x05fa('0x10b')](db[_0x05fa('0x7f')],{'through':_0x05fa('0x175'),'as':_0x05fa('0x163')});db['OpenchannelInteraction'][_0x05fa('0x10b')](db[_0x05fa('0x7f')],{'through':'openchannel_interaction_has_tags','as':_0x05fa('0x164')});db['OpenchannelInteraction'][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':_0x05fa('0x16d'),'through':'user_has_openchannel_interactions','foreignKey':_0x05fa('0x174')});db['OpenchannelMessage'][_0x05fa('0x109')](db[_0x05fa('0x10')],{'onDelete':'cascade','as':'User'});db[_0x05fa('0x56')]['belongsTo'](db[_0x05fa('0x66')],{'onDelete':_0x05fa('0xfc'),'as':_0x05fa('0x153')});db[_0x05fa('0x56')][_0x05fa('0x109')](db[_0x05fa('0x54')],{'onDelete':_0x05fa('0xfc'),'as':'Interaction','foreignKey':_0x05fa('0x174')});db[_0x05fa('0x56')][_0x05fa('0x109')](db[_0x05fa('0x157')],{'as':_0x05fa('0x157'),'foreignKey':_0x05fa('0x165')});db[_0x05fa('0x56')]['belongsTo'](db[_0x05fa('0x51')],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x170')});db[_0x05fa('0x11c')][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':_0x05fa('0x160'),'through':_0x05fa('0x30'),'foreignKey':_0x05fa('0x173')});db[_0x05fa('0x11c')][_0x05fa('0x10b')](db[_0x05fa('0x151')],{'through':_0x05fa('0x176'),'as':_0x05fa('0x13e')});db[_0x05fa('0x58')]['hasMany'](db[_0x05fa('0x15e')],{'as':_0x05fa('0x14b'),'foreignKey':_0x05fa('0x177'),'onDelete':'cascade'});db[_0x05fa('0x58')]['hasMany'](db[_0x05fa('0x71')],{'as':_0x05fa('0x14c'),'foreignKey':_0x05fa('0x177')});db['ChatWebsite'][_0x05fa('0xfe')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0x05fa('0x58')][_0x05fa('0xfe')](db[_0x05fa('0x5b')],{'as':_0x05fa('0x14d')});db[_0x05fa('0x58')][_0x05fa('0xfe')](db['ChatApplication'],{'as':_0x05fa('0x12e')});db[_0x05fa('0x58')][_0x05fa('0xfe')](db[_0x05fa('0x5d')],{'as':_0x05fa('0x141')});db[_0x05fa('0x58')][_0x05fa('0x109')](db[_0x05fa('0x120')],{'as':_0x05fa('0x14f'),'foreignKey':_0x05fa('0x150')});db['ChatWebsite']['belongsTo'](db[_0x05fa('0x75')],{'as':'Interval','foreignKey':_0x05fa('0x13a')});db[_0x05fa('0x58')][_0x05fa('0x109')](db[_0x05fa('0x36')],{'as':'MailAccount','foreignKey':_0x05fa('0x178')});db[_0x05fa('0x58')][_0x05fa('0x109')](db[_0x05fa('0x76')],{'as':_0x05fa('0x168'),'foreignKey':_0x05fa('0x13b')});db[_0x05fa('0x58')][_0x05fa('0x10b')](db['User'],{'as':_0x05fa('0x160'),'through':'user_has_chat_websites'});db[_0x05fa('0x59')][_0x05fa('0x109')](db[_0x05fa('0x51')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x05fa('0x120')],{'as':_0x05fa('0x14f'),'foreignKey':'ListId'});db[_0x05fa('0x59')][_0x05fa('0x109')](db[_0x05fa('0x66')],{'as':'Contact','foreignKey':_0x05fa('0x148')});db[_0x05fa('0x59')][_0x05fa('0x109')](db[_0x05fa('0x54')],{});db[_0x05fa('0x59')][_0x05fa('0x109')](db[_0x05fa('0x56')],{});db[_0x05fa('0x59')]['belongsTo'](db[_0x05fa('0x10')],{});db[_0x05fa('0x59')][_0x05fa('0x109')](db[_0x05fa('0x11c')],{});db[_0x05fa('0x179')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'as':_0x05fa('0x17a'),'foreignKey':_0x05fa('0xfd'),'onDelete':'restrict'});db[_0x05fa('0x179')][_0x05fa('0x109')](db[_0x05fa('0x60')],{'as':_0x05fa('0x17b'),'foreignKey':_0x05fa('0x17c'),'onDelete':_0x05fa('0x15a')});db['ChatApplication']['belongsTo'](db[_0x05fa('0x58')],{'as':_0x05fa('0x17d'),'foreignKey':_0x05fa('0x177'),'onDelete':_0x05fa('0x15a')});db[_0x05fa('0x179')][_0x05fa('0x109')](db[_0x05fa('0x7f')],{'onDelete':_0x05fa('0x15a'),'foreignKey':_0x05fa('0x15b')});db[_0x05fa('0x5b')][_0x05fa('0xfe')](db[_0x05fa('0x5d')],{'as':'Messages','onDelete':_0x05fa('0xfc'),'foreignKey':'ChatInteractionId'});db[_0x05fa('0x5b')][_0x05fa('0x109')](db[_0x05fa('0x58')],{'as':'Account','foreignKey':_0x05fa('0x177')});db[_0x05fa('0x5b')][_0x05fa('0x109')](db[_0x05fa('0x66')],{'as':_0x05fa('0x153'),'foreignKey':_0x05fa('0x148')});db[_0x05fa('0x5b')]['belongsTo'](db['User'],{'as':_0x05fa('0x17e'),'foreignKey':_0x05fa('0xfd')});db['ChatInteraction'][_0x05fa('0x10b')](db[_0x05fa('0x7f')],{'through':_0x05fa('0x17f'),'as':_0x05fa('0x163')});db[_0x05fa('0x5b')]['belongsToMany'](db[_0x05fa('0x7f')],{'through':_0x05fa('0x17f'),'as':'ThroughTags'});db[_0x05fa('0x5b')][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':_0x05fa('0x16d'),'through':_0x05fa('0x110'),'foreignKey':_0x05fa('0x180')});db['ChatMessage'][_0x05fa('0x109')](db[_0x05fa('0x10')],{'onDelete':'cascade','as':_0x05fa('0x10')});db[_0x05fa('0x5d')]['belongsTo'](db[_0x05fa('0x66')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x05fa('0x148')});db[_0x05fa('0x5d')][_0x05fa('0x109')](db[_0x05fa('0x5b')],{'onDelete':_0x05fa('0xfc'),'as':_0x05fa('0x159'),'foreignKey':_0x05fa('0x180')});db[_0x05fa('0x5d')][_0x05fa('0x109')](db['Attachment'],{'as':_0x05fa('0x157'),'foreignKey':_0x05fa('0x165')});db['ChatMessage'][_0x05fa('0x109')](db[_0x05fa('0x58')],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x177')});db[_0x05fa('0x5f')]['hasMany'](db[_0x05fa('0x157')],{'as':_0x05fa('0x158'),'foreignKey':_0x05fa('0x181'),'onDelete':_0x05fa('0xfc'),'hooks':!![]});db[_0x05fa('0x5f')][_0x05fa('0x109')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0x05fa('0x148')});db[_0x05fa('0x5f')][_0x05fa('0x109')](db['ChatWebsite'],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x177')});db[_0x05fa('0x60')]['belongsToMany'](db[_0x05fa('0x10')],{'as':_0x05fa('0x160'),'through':_0x05fa('0x2b'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0x05fa('0x151')],{'through':_0x05fa('0x182'),'as':_0x05fa('0x13e')});db[_0x05fa('0x61')][_0x05fa('0xfe')](db[_0x05fa('0x183')],{'as':'Messages','foreignKey':_0x05fa('0x184'),'onDelete':_0x05fa('0xfc')});db[_0x05fa('0x61')][_0x05fa('0x10b')](db['User'],{'as':_0x05fa('0x185'),'through':_0x05fa('0x186')});db[_0x05fa('0x187')]['belongsTo'](db['ChatWebsite'],{'as':_0x05fa('0x17d'),'foreignKey':_0x05fa('0x177')});db[_0x05fa('0x64')][_0x05fa('0xfe')](db[_0x05fa('0x66')],{'as':_0x05fa('0x10c'),'foreignKey':_0x05fa('0x188')});db[_0x05fa('0x66')][_0x05fa('0xfe')](db[_0x05fa('0x68')],{'as':_0x05fa('0x132'),'foreignKey':_0x05fa('0x148')});db['CmContact'][_0x05fa('0xfe')](db[_0x05fa('0x100')],{'as':_0x05fa('0x101'),'foreignKey':_0x05fa('0x148')});db[_0x05fa('0x66')]['hasMany'](db[_0x05fa('0x6c')],{'as':_0x05fa('0x133'),'foreignKey':'ContactId'});db['CmContact'][_0x05fa('0xfe')](db[_0x05fa('0x103')],{'as':_0x05fa('0x103'),'foreignKey':_0x05fa('0x148')});db[_0x05fa('0x66')][_0x05fa('0xfe')](db[_0x05fa('0x189')],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0x05fa('0x66')][_0x05fa('0xfe')](db[_0x05fa('0x54')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x05fa('0x15a')});db[_0x05fa('0x66')][_0x05fa('0xfe')](db[_0x05fa('0x5b')],{'as':_0x05fa('0x18a'),'foreignKey':_0x05fa('0x148'),'onDelete':_0x05fa('0x15a')});db[_0x05fa('0x66')]['hasMany'](db[_0x05fa('0x4f')],{'as':_0x05fa('0x105'),'foreignKey':_0x05fa('0x148'),'onDelete':'restrict'});db[_0x05fa('0x66')][_0x05fa('0xfe')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x05fa('0x148'),'onDelete':_0x05fa('0x15a')});db[_0x05fa('0x66')][_0x05fa('0xfe')](db[_0x05fa('0x3b')],{'as':'MailInteractions','foreignKey':_0x05fa('0x148'),'onDelete':_0x05fa('0x15a')});db[_0x05fa('0x66')][_0x05fa('0x109')](db[_0x05fa('0x64')],{'as':_0x05fa('0x18b'),'foreignKey':'CompanyId'});db[_0x05fa('0x66')][_0x05fa('0x109')](db[_0x05fa('0x120')],{'as':'List','foreignKey':'ListId','onDelete':_0x05fa('0xfc')});db['CmContact'][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':_0x05fa('0x16d'),'through':_0x05fa('0x10d')});db[_0x05fa('0x66')]['belongsToMany'](db[_0x05fa('0x7f')],{'as':_0x05fa('0x163'),'through':_0x05fa('0x18c')});db[_0x05fa('0x66')][_0x05fa('0x10b')](db[_0x05fa('0x7f')],{'through':'cm_contact_has_tags','as':_0x05fa('0x164')});db[_0x05fa('0x68')]['belongsTo'](db[_0x05fa('0x66')],{'as':_0x05fa('0x153'),'foreignKey':_0x05fa('0x148'),'onDelete':_0x05fa('0xfc')});db[_0x05fa('0x68')]['belongsTo'](db[_0x05fa('0x120')],{'as':_0x05fa('0x14f'),'foreignKey':_0x05fa('0x150'),'onDelete':_0x05fa('0xfc')});db[_0x05fa('0x68')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'as':_0x05fa('0x17a'),'foreignKey':_0x05fa('0xfd')});db[_0x05fa('0x68')][_0x05fa('0x109')](db[_0x05fa('0x18')],{'as':_0x05fa('0x17b'),'foreignKey':'VoiceQueueId','onDelete':_0x05fa('0xfc')});db[_0x05fa('0x68')][_0x05fa('0x109')](db[_0x05fa('0xd5')],{'as':_0x05fa('0xd5'),'foreignKey':_0x05fa('0x18d'),'onDelete':_0x05fa('0xfc')});db['CmHopper'][_0x05fa('0x109')](db[_0x05fa('0x10')],{'as':_0x05fa('0x17e'),'foreignKey':'OwnerId'});db[_0x05fa('0x69')][_0x05fa('0x109')](db['CmContact'],{'as':_0x05fa('0x153'),'foreignKey':'ContactId','onDelete':_0x05fa('0xfc')});db[_0x05fa('0x69')][_0x05fa('0x109')](db[_0x05fa('0x120')],{'as':_0x05fa('0x14f'),'foreignKey':_0x05fa('0x150'),'onDelete':_0x05fa('0xfc')});db[_0x05fa('0x69')][_0x05fa('0x109')](db[_0x05fa('0x18')],{'as':_0x05fa('0x17b'),'foreignKey':_0x05fa('0x131'),'onDelete':_0x05fa('0xfc')});db[_0x05fa('0x69')]['belongsTo'](db[_0x05fa('0xd5')],{'as':'Campaign','foreignKey':_0x05fa('0x18d'),'onDelete':_0x05fa('0xfc')});db[_0x05fa('0x18e')][_0x05fa('0xfe')](db['Condition'],{'as':{'plural':_0x05fa('0x18f'),'singular':_0x05fa('0x190')},'foreignKey':'AutomationAllId','onDelete':_0x05fa('0xfc'),'hooks':!![]});db[_0x05fa('0x18e')][_0x05fa('0xfe')](db[_0x05fa('0x74')],{'as':{'plural':'Any','singular':_0x05fa('0x191')},'foreignKey':_0x05fa('0x192'),'onDelete':_0x05fa('0xfc'),'hooks':!![]});db['Automation'][_0x05fa('0xfe')](db[_0x05fa('0x193')],{'as':_0x05fa('0x194'),'foreignKey':_0x05fa('0x195'),'onDelete':_0x05fa('0xfc'),'hooks':!![]});db[_0x05fa('0x15e')][_0x05fa('0xfe')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x05fa('0x196'),'onDelete':'cascade'});db[_0x05fa('0x75')][_0x05fa('0xfe')](db['Interval'],{'as':_0x05fa('0x197'),'foreignKey':_0x05fa('0x13a'),'onDelete':_0x05fa('0xfc'),'hooks':!![],'required':![]});db[_0x05fa('0x75')][_0x05fa('0xfe')](db['VoiceExtension'],{'as':_0x05fa('0xff'),'foreignKey':_0x05fa('0x13a'),'onDelete':_0x05fa('0x15a')});db[_0x05fa('0x75')][_0x05fa('0xfe')](db[_0x05fa('0x14e')],{'as':_0x05fa('0x198'),'foreignKey':_0x05fa('0x13a')});db[_0x05fa('0x75')]['hasMany'](db[_0x05fa('0x179')],{'as':_0x05fa('0x199'),'foreignKey':_0x05fa('0x13a')});db[_0x05fa('0x75')]['hasMany'](db[_0x05fa('0x44')],{'as':'FaxApplications','foreignKey':_0x05fa('0x13a')});db['Interval'][_0x05fa('0xfe')](db[_0x05fa('0x4d')],{'as':_0x05fa('0x19a'),'foreignKey':'IntervalId'});db[_0x05fa('0x7b')][_0x05fa('0x109')](db['MailAccount'],{});db[_0x05fa('0x7b')][_0x05fa('0x109')](db[_0x05fa('0x8c')],{'foreignKey':_0x05fa('0x19b')});db['Schedule'][_0x05fa('0x109')](db['AnalyticCustomReport'],{'foreignKey':_0x05fa('0x19c')});db['Sound']['belongsToMany'](db[_0x05fa('0x16')],{'as':_0x05fa('0x19d'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0x05fa('0x7f')][_0x05fa('0x10b')](db[_0x05fa('0x66')],{'through':'cm_contact_has_tags'});db[_0x05fa('0x7f')]['belongsToMany'](db[_0x05fa('0x5b')],{'through':_0x05fa('0x17f')});db['Tag']['belongsToMany'](db[_0x05fa('0x3b')],{'through':_0x05fa('0x154')});db[_0x05fa('0x7f')][_0x05fa('0x10b')](db['SmsInteraction'],{'through':_0x05fa('0x19e')});db[_0x05fa('0x7f')][_0x05fa('0x10b')](db[_0x05fa('0x45')],{'through':_0x05fa('0x162')});db['Tag'][_0x05fa('0x10b')](db['OpenchannelInteraction'],{'through':_0x05fa('0x175')});db[_0x05fa('0x7f')][_0x05fa('0x10b')](db[_0x05fa('0xed')],{'through':'whatsapp_interaction_has_tags'});db[_0x05fa('0x83')]['hasMany'](db[_0x05fa('0x74')],{'as':{'plural':_0x05fa('0x19f'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0x05fa('0xfc'),'hooks':!![]});db[_0x05fa('0x83')][_0x05fa('0xfe')](db[_0x05fa('0x74')],{'as':{'plural':_0x05fa('0x1a0'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x05fa('0x83')][_0x05fa('0xfe')](db[_0x05fa('0x193')],{'as':_0x05fa('0x194'),'foreignKey':_0x05fa('0x1a1'),'onDelete':_0x05fa('0xfc'),'hooks':!![]});db[_0x05fa('0x8a')][_0x05fa('0xfe')](db['AnalyticFieldReport'],{'as':_0x05fa('0x1a2'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x19c'),'hooks':!![]});db[_0x05fa('0x8c')][_0x05fa('0xfe')](db['AnalyticFieldReport'],{'as':_0x05fa('0x1a2'),'onDelete':_0x05fa('0xfc'),'foreignKey':'DefaultReportId'});db[_0x05fa('0x1a3')][_0x05fa('0xfe')](db['AnalyticFieldReport'],{'as':_0x05fa('0x1a2'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0x05fa('0x90')]['belongsTo'](db[_0x05fa('0x1a3')],{'foreignKey':_0x05fa('0x1a4')});db['SalesforceAccount'][_0x05fa('0xfe')](db[_0x05fa('0x1a5')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x05fa('0x1a6')});db[_0x05fa('0x1a5')][_0x05fa('0xfe')](db['SalesforceField'],{'as':_0x05fa('0x1a7'),'onDelete':'cascade','foreignKey':_0x05fa('0x1a8')});db['SalesforceConfiguration'][_0x05fa('0xfe')](db[_0x05fa('0x1a9')],{'as':_0x05fa('0x1aa'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1ab')});db['SalesforceConfiguration']['hasMany'](db[_0x05fa('0x1a9')],{'as':'Fields','onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1ac')});db['SalesforceConfiguration']['belongsTo'](db['SalesforceAccount'],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x1a6')});db[_0x05fa('0x1a9')][_0x05fa('0xfe')](db[_0x05fa('0x1a9')],{'as':_0x05fa('0x1ad'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0x1a9')][_0x05fa('0xfe')](db[_0x05fa('0x1a9')],{'as':'Description','foreignKey':_0x05fa('0x1ab')});db['SalesforceField'][_0x05fa('0xfe')](db[_0x05fa('0x1a9')],{'as':_0x05fa('0x1ae'),'foreignKey':_0x05fa('0x1ac')});db[_0x05fa('0x1a9')]['belongsTo'](db['Variable'],{'as':_0x05fa('0x85'),'foreignKey':_0x05fa('0x1af')});db[_0x05fa('0x1b0')][_0x05fa('0xfe')](db[_0x05fa('0x96')],{'as':_0x05fa('0x1b1'),'onDelete':_0x05fa('0xfc'),'foreignKey':'AccountId'});db[_0x05fa('0x96')][_0x05fa('0xfe')](db[_0x05fa('0x1b2')],{'as':_0x05fa('0x1a7'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0x96')][_0x05fa('0xfe')](db[_0x05fa('0x1b2')],{'as':_0x05fa('0x1aa'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1ab')});db[_0x05fa('0x96')][_0x05fa('0xfe')](db['SugarcrmField'],{'as':_0x05fa('0x1a2'),'onDelete':_0x05fa('0xfc'),'foreignKey':'FieldId'});db[_0x05fa('0x96')][_0x05fa('0x109')](db[_0x05fa('0x1b0')],{'as':_0x05fa('0x152'),'foreignKey':'AccountId'});db[_0x05fa('0x1b2')][_0x05fa('0xfe')](db[_0x05fa('0x1b2')],{'as':_0x05fa('0x1ad'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0x1b2')][_0x05fa('0xfe')](db[_0x05fa('0x1b2')],{'as':_0x05fa('0x1b3'),'foreignKey':'DescriptionId'});db[_0x05fa('0x1b2')][_0x05fa('0xfe')](db['SugarcrmField'],{'as':_0x05fa('0x1ae'),'foreignKey':_0x05fa('0x1ac')});db[_0x05fa('0x1b2')][_0x05fa('0x109')](db['Variable'],{'as':_0x05fa('0x85'),'foreignKey':_0x05fa('0x1af')});db[_0x05fa('0x99')][_0x05fa('0xfe')](db[_0x05fa('0x9b')],{'as':'Configurations','onDelete':_0x05fa('0xfc'),'foreignKey':'AccountId'});db[_0x05fa('0x9b')]['hasMany'](db[_0x05fa('0x9c')],{'as':_0x05fa('0x1a7'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0x9b')][_0x05fa('0xfe')](db[_0x05fa('0x9c')],{'as':'Descriptions','onDelete':_0x05fa('0xfc'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x05fa('0xfe')](db[_0x05fa('0x9c')],{'as':_0x05fa('0x1a2'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1ac')});db['DeskConfiguration'][_0x05fa('0x109')](db[_0x05fa('0x99')],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x1a6')});db[_0x05fa('0x9b')][_0x05fa('0x10b')](db[_0x05fa('0x7f')],{'through':_0x05fa('0x1b4')});db[_0x05fa('0x9c')][_0x05fa('0xfe')](db[_0x05fa('0x9c')],{'as':_0x05fa('0x1ad'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0x9c')]['hasMany'](db[_0x05fa('0x9c')],{'as':_0x05fa('0x1b3'),'foreignKey':_0x05fa('0x1ab')});db[_0x05fa('0x9c')][_0x05fa('0xfe')](db['DeskField'],{'as':'Field','foreignKey':_0x05fa('0x1ac')});db[_0x05fa('0x9c')][_0x05fa('0x109')](db[_0x05fa('0x85')],{'as':_0x05fa('0x85'),'foreignKey':'VariableId'});db[_0x05fa('0x9e')][_0x05fa('0xfe')](db[_0x05fa('0xa0')],{'as':_0x05fa('0x1b1'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x05fa('0xa0')][_0x05fa('0xfe')](db[_0x05fa('0x1b5')],{'as':'Subjects','onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0xa0')][_0x05fa('0xfe')](db[_0x05fa('0x1b5')],{'as':_0x05fa('0x1aa'),'onDelete':_0x05fa('0xfc'),'foreignKey':'DescriptionId'});db[_0x05fa('0xa0')][_0x05fa('0xfe')](db['ZohoField'],{'as':'Fields','onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1ac')});db[_0x05fa('0xa0')][_0x05fa('0x109')](db[_0x05fa('0x9e')],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x1a6')});db[_0x05fa('0x1b5')][_0x05fa('0xfe')](db[_0x05fa('0x1b5')],{'as':'Subject','foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0x1b5')][_0x05fa('0xfe')](db[_0x05fa('0x1b5')],{'as':_0x05fa('0x1b3'),'foreignKey':_0x05fa('0x1ab')});db[_0x05fa('0x1b5')]['hasMany'](db['ZohoField'],{'as':_0x05fa('0x1ae'),'foreignKey':_0x05fa('0x1ac')});db[_0x05fa('0x1b5')]['belongsTo'](db['Variable'],{'as':_0x05fa('0x85'),'foreignKey':_0x05fa('0x1af')});db['ZendeskAccount'][_0x05fa('0xfe')](db['ZendeskConfiguration'],{'as':_0x05fa('0x1b1'),'onDelete':'cascade','foreignKey':_0x05fa('0x1a6')});db[_0x05fa('0x1b6')][_0x05fa('0xfe')](db[_0x05fa('0xa5')],{'as':'Subjects','foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0x1b6')][_0x05fa('0xfe')](db['ZendeskField'],{'as':_0x05fa('0x1aa'),'foreignKey':_0x05fa('0x1ab')});db[_0x05fa('0x1b6')][_0x05fa('0xfe')](db['ZendeskField'],{'as':_0x05fa('0x1a2'),'foreignKey':_0x05fa('0x1ac')});db['ZendeskConfiguration'][_0x05fa('0x109')](db[_0x05fa('0xa3')],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x1a6')});db[_0x05fa('0x1b6')]['belongsToMany'](db[_0x05fa('0x7f')],{'through':_0x05fa('0x1b7')});db['ZendeskField'][_0x05fa('0xfe')](db[_0x05fa('0xa5')],{'as':_0x05fa('0x1ad'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0xa5')]['hasMany'](db[_0x05fa('0xa5')],{'as':_0x05fa('0x1b3'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x05fa('0xfe')](db[_0x05fa('0xa5')],{'as':_0x05fa('0x1ae'),'foreignKey':_0x05fa('0x1ac')});db[_0x05fa('0xa5')][_0x05fa('0x109')](db[_0x05fa('0x85')],{'as':'Variable','foreignKey':_0x05fa('0x1af')});db[_0x05fa('0xa7')][_0x05fa('0xfe')](db['FreshdeskConfiguration'],{'as':_0x05fa('0x1b1'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1a6')});db['FreshdeskConfiguration']['hasMany'](db[_0x05fa('0xab')],{'as':'Subjects','onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0xa9')]['hasMany'](db[_0x05fa('0xab')],{'as':_0x05fa('0x1aa'),'onDelete':'cascade','foreignKey':_0x05fa('0x1ab')});db[_0x05fa('0xa9')][_0x05fa('0xfe')](db['FreshdeskField'],{'as':_0x05fa('0x1a2'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1ac')});db[_0x05fa('0xa9')][_0x05fa('0x109')](db[_0x05fa('0xa7')],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x1a6')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x05fa('0x7f')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0x05fa('0xfe')](db['FreshdeskField'],{'as':_0x05fa('0x1ad'),'foreignKey':'SubjectId'});db['FreshdeskField']['hasMany'](db[_0x05fa('0xab')],{'as':'Description','foreignKey':_0x05fa('0x1ab')});db[_0x05fa('0xab')][_0x05fa('0xfe')](db[_0x05fa('0xab')],{'as':_0x05fa('0x1ae'),'foreignKey':_0x05fa('0x1ac')});db[_0x05fa('0xab')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x05fa('0x1af')});db[_0x05fa('0xad')][_0x05fa('0xfe')](db['VtigerConfiguration'],{'as':_0x05fa('0x1b1'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1a6')});db['VtigerConfiguration']['hasMany'](db[_0x05fa('0x1b8')],{'as':'Subjects','foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0x1b9')][_0x05fa('0xfe')](db[_0x05fa('0x1b8')],{'as':_0x05fa('0x1aa'),'foreignKey':_0x05fa('0x1ab')});db[_0x05fa('0x1b9')]['hasMany'](db[_0x05fa('0x1b8')],{'as':_0x05fa('0x1a2'),'foreignKey':_0x05fa('0x1ac')});db[_0x05fa('0x1b9')]['belongsTo'](db[_0x05fa('0xad')],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x1a6')});db['VtigerField'][_0x05fa('0xfe')](db[_0x05fa('0x1b8')],{'as':_0x05fa('0x1ad'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0x1b8')]['hasMany'](db[_0x05fa('0x1b8')],{'as':_0x05fa('0x1b3'),'foreignKey':_0x05fa('0x1ab')});db[_0x05fa('0x1b8')][_0x05fa('0xfe')](db[_0x05fa('0x1b8')],{'as':_0x05fa('0x1ae'),'foreignKey':_0x05fa('0x1ac')});db[_0x05fa('0x1b8')][_0x05fa('0x109')](db[_0x05fa('0x85')],{'as':_0x05fa('0x85'),'foreignKey':'VariableId'});db[_0x05fa('0xb1')][_0x05fa('0xfe')](db[_0x05fa('0xb3')],{'as':_0x05fa('0x1b1'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1a6')});db[_0x05fa('0xb3')]['hasMany'](db['ServicenowField'],{'as':_0x05fa('0x1a7'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0xb3')][_0x05fa('0xfe')](db[_0x05fa('0xb5')],{'as':'Descriptions','foreignKey':_0x05fa('0x1ab')});db['ServicenowConfiguration'][_0x05fa('0xfe')](db[_0x05fa('0xb5')],{'as':'Fields','foreignKey':_0x05fa('0x1ac')});db[_0x05fa('0xb3')]['belongsTo'](db[_0x05fa('0xb1')],{'as':_0x05fa('0x152'),'foreignKey':'AccountId'});db[_0x05fa('0xb5')][_0x05fa('0xfe')](db['ServicenowField'],{'as':_0x05fa('0x1ad'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0xb5')][_0x05fa('0xfe')](db[_0x05fa('0xb5')],{'as':_0x05fa('0x1b3'),'foreignKey':'DescriptionId'});db[_0x05fa('0xb5')]['hasMany'](db[_0x05fa('0xb5')],{'as':_0x05fa('0x1ae'),'foreignKey':'FieldId'});db[_0x05fa('0xb5')][_0x05fa('0x109')](db[_0x05fa('0x85')],{'as':_0x05fa('0x85'),'foreignKey':_0x05fa('0x1af')});db[_0x05fa('0xb6')][_0x05fa('0xfe')](db[_0x05fa('0xb8')],{'as':_0x05fa('0x1b1'),'onDelete':'cascade','foreignKey':_0x05fa('0x1a6')});db[_0x05fa('0xb8')][_0x05fa('0xfe')](db[_0x05fa('0xb9')],{'as':_0x05fa('0x1a7'),'onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x05fa('0xfe')](db[_0x05fa('0xb9')],{'as':'Descriptions','onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1ab')});db[_0x05fa('0xb8')][_0x05fa('0xfe')](db[_0x05fa('0xb9')],{'as':_0x05fa('0x1a2'),'onDelete':_0x05fa('0xfc'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x05fa('0x109')](db[_0x05fa('0xb6')],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x1a6')});db[_0x05fa('0xb9')][_0x05fa('0xfe')](db[_0x05fa('0xb9')],{'as':_0x05fa('0x1ad'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0xb9')][_0x05fa('0xfe')](db['Dynamics365Field'],{'as':_0x05fa('0x1b3'),'foreignKey':'DescriptionId'});db[_0x05fa('0xb9')][_0x05fa('0xfe')](db['Dynamics365Field'],{'as':_0x05fa('0x1ae'),'foreignKey':_0x05fa('0x1ac')});db['Dynamics365Field'][_0x05fa('0x109')](db['Variable'],{'as':_0x05fa('0x85'),'foreignKey':_0x05fa('0x1af')});db['FreshsalesAccount'][_0x05fa('0xfe')](db['FreshsalesConfiguration'],{'as':_0x05fa('0x1b1'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1a6')});db[_0x05fa('0xbd')]['hasMany'](db[_0x05fa('0xbf')],{'as':_0x05fa('0x1a7'),'foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0xbd')][_0x05fa('0xfe')](db['FreshsalesField'],{'as':_0x05fa('0x1aa'),'foreignKey':'DescriptionId'});db[_0x05fa('0xbd')][_0x05fa('0xfe')](db[_0x05fa('0xbf')],{'as':_0x05fa('0x1a2'),'foreignKey':_0x05fa('0x1ac')});db[_0x05fa('0xbd')][_0x05fa('0x109')](db['FreshsalesAccount'],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x1a6')});db['FreshsalesField'][_0x05fa('0xfe')](db[_0x05fa('0xbf')],{'as':'Subject','foreignKey':_0x05fa('0x1a8')});db[_0x05fa('0xbf')][_0x05fa('0xfe')](db['FreshsalesField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x05fa('0xbf')]['hasMany'](db[_0x05fa('0xbf')],{'as':_0x05fa('0x1ae'),'foreignKey':'FieldId'});db[_0x05fa('0xbf')]['belongsTo'](db[_0x05fa('0x85')],{'as':_0x05fa('0x85'),'foreignKey':_0x05fa('0x1af')});db['ChatQueueReport'][_0x05fa('0x109')](db[_0x05fa('0x58')],{});db[_0x05fa('0x1ba')][_0x05fa('0x109')](db['CmList'],{'as':_0x05fa('0x14f'),'foreignKey':_0x05fa('0x150')});db[_0x05fa('0x1ba')]['belongsTo'](db['CmContact'],{'as':_0x05fa('0x153'),'foreignKey':_0x05fa('0x148')});db[_0x05fa('0x1ba')][_0x05fa('0x109')](db[_0x05fa('0x5b')],{});db['ChatQueueReport']['belongsTo'](db[_0x05fa('0x5d')],{});db[_0x05fa('0x1ba')][_0x05fa('0x109')](db[_0x05fa('0x10')],{});db[_0x05fa('0x1ba')][_0x05fa('0x109')](db[_0x05fa('0x60')],{});db[_0x05fa('0x183')]['belongsTo'](db[_0x05fa('0x10')],{'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1bb')});db['ChatInternalMessage'][_0x05fa('0x109')](db['User'],{'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x1bc')});db['JscriptySessionReport'][_0x05fa('0xfe')](db[_0x05fa('0x1bd')],{'foreignKey':_0x05fa('0x1be'),'onDelete':_0x05fa('0xfc')});db['JscriptySessionReport'][_0x05fa('0xfe')](db[_0x05fa('0xc4')],{'foreignKey':_0x05fa('0x1be'),'onDelete':_0x05fa('0xfc')});db['SmsQueueReport'][_0x05fa('0x109')](db[_0x05fa('0x127')],{});db[_0x05fa('0x1bf')][_0x05fa('0x109')](db['CmList'],{'as':'List','foreignKey':_0x05fa('0x150')});db['SmsQueueReport'][_0x05fa('0x109')](db['CmContact'],{'as':_0x05fa('0x153'),'foreignKey':_0x05fa('0x148')});db[_0x05fa('0x1bf')][_0x05fa('0x109')](db[_0x05fa('0x4f')],{});db[_0x05fa('0x1bf')][_0x05fa('0x109')](db[_0x05fa('0x16b')],{});db[_0x05fa('0x1bf')][_0x05fa('0x109')](db[_0x05fa('0x10')],{});db[_0x05fa('0x1bf')][_0x05fa('0x109')](db[_0x05fa('0x16a')],{});db['JscriptyProject']['hasMany'](db[_0x05fa('0x189')],{'foreignKey':'ProjectId'});db[_0x05fa('0xcb')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x05fa('0x1c0')});db['JscriptyProject'][_0x05fa('0xfe')](db['JscriptyAnswerReport'],{'foreignKey':_0x05fa('0x1c0')});db[_0x05fa('0xd0')][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':_0x05fa('0x16d'),'through':_0x05fa('0x12c')});db[_0x05fa('0x151')][_0x05fa('0x10b')](db['User'],{'as':'Agents','through':'user_has_teams'});db['Team']['belongsToMany'](db[_0x05fa('0x18')],{'through':_0x05fa('0xf7'),'as':_0x05fa('0x1c1')});db['Team']['belongsToMany'](db[_0x05fa('0x115')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x05fa('0x151')]['belongsToMany'](db[_0x05fa('0x60')],{'through':_0x05fa('0x182'),'as':_0x05fa('0x117')});db[_0x05fa('0x151')][_0x05fa('0x10b')](db[_0x05fa('0x49')],{'through':'team_has_fax_queues','as':_0x05fa('0x118')});db[_0x05fa('0x151')][_0x05fa('0x10b')](db[_0x05fa('0x16a')],{'through':_0x05fa('0x16f'),'as':_0x05fa('0x11a')});db[_0x05fa('0x151')][_0x05fa('0x10b')](db['OpenchannelQueue'],{'through':_0x05fa('0x176'),'as':_0x05fa('0x11d')});db[_0x05fa('0x151')][_0x05fa('0x10b')](db[_0x05fa('0x11e')],{'through':_0x05fa('0x1c2'),'as':'WhatsappQueues'});db[_0x05fa('0x151')][_0x05fa('0x10b')](db[_0x05fa('0xe3')],{'through':_0x05fa('0xf8'),'as':_0x05fa('0x114')});db[_0x05fa('0xd5')][_0x05fa('0xfe')](db['CmHopper'],{'as':_0x05fa('0x132'),'foreignKey':_0x05fa('0x18d')});db[_0x05fa('0xd5')][_0x05fa('0xfe')](db[_0x05fa('0x100')],{'as':_0x05fa('0x101'),'foreignKey':'CampaignId'});db['Campaign'][_0x05fa('0xfe')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0x05fa('0xd5')][_0x05fa('0xfe')](db[_0x05fa('0x69')],{'as':_0x05fa('0x134'),'foreignKey':'CampaignId'});db[_0x05fa('0xd5')][_0x05fa('0x109')](db[_0x05fa('0x136')],{'as':_0x05fa('0x136'),'foreignKey':'TrunkId'});db[_0x05fa('0xd5')]['belongsTo'](db[_0x05fa('0x136')],{'as':'TrunkBackup','foreignKey':_0x05fa('0x139')});db['Campaign'][_0x05fa('0x109')](db['Interval'],{'as':_0x05fa('0x75'),'foreignKey':'IntervalId'});db['Campaign'][_0x05fa('0x109')](db[_0x05fa('0xd0')],{'as':_0x05fa('0xd0'),'foreignKey':'SquareProjectId'});db['Campaign'][_0x05fa('0x10b')](db['CmList'],{'as':_0x05fa('0x13c'),'through':'campaigns_has_cm_lists'});db[_0x05fa('0xd5')]['belongsToMany'](db['CmList'],{'as':_0x05fa('0x13f'),'through':'campaigns_has_cm_blacklists'});db['Attachment']['belongsTo'](db[_0x05fa('0x5f')],{'as':_0x05fa('0x5f'),'foreignKey':_0x05fa('0x181')});db['MailTransferReport'][_0x05fa('0x109')](db['MailMessage'],{});db[_0x05fa('0xdb')]['belongsTo'](db[_0x05fa('0x3b')],{});db[_0x05fa('0xdb')][_0x05fa('0x109')](db[_0x05fa('0x36')],{'foreignKey':_0x05fa('0x1c3'),'as':_0x05fa('0x1c4')});db[_0x05fa('0xdb')][_0x05fa('0x109')](db['User'],{'foreignKey':_0x05fa('0x1c5'),'as':'FromAgent'});db[_0x05fa('0xdb')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'foreignKey':_0x05fa('0x1c6'),'as':_0x05fa('0x1c7')});db[_0x05fa('0xdb')]['belongsTo'](db[_0x05fa('0x115')],{'foreignKey':_0x05fa('0x1c8'),'as':_0x05fa('0x1c9')});db[_0x05fa('0xdb')][_0x05fa('0x109')](db[_0x05fa('0x36')],{'foreignKey':_0x05fa('0x1ca'),'as':_0x05fa('0x1cb')});db['ChatTransferReport']['belongsTo'](db[_0x05fa('0x5d')],{});db[_0x05fa('0xdc')]['belongsTo'](db['ChatInteraction'],{});db['ChatTransferReport'][_0x05fa('0x109')](db[_0x05fa('0x58')],{'foreignKey':_0x05fa('0x1cc'),'as':_0x05fa('0x1c4')});db[_0x05fa('0xdc')][_0x05fa('0x109')](db['User'],{'foreignKey':_0x05fa('0x1c5'),'as':'FromAgent'});db[_0x05fa('0xdc')]['belongsTo'](db[_0x05fa('0x10')],{'foreignKey':_0x05fa('0x1c6'),'as':_0x05fa('0x1c7')});db[_0x05fa('0xdc')]['belongsTo'](db[_0x05fa('0x60')],{'foreignKey':_0x05fa('0x1cd'),'as':_0x05fa('0x1c9')});db[_0x05fa('0xdc')]['belongsTo'](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x05fa('0x1cb')});db['FaxTransferReport']['belongsTo'](db['FaxMessage'],{});db[_0x05fa('0xde')]['belongsTo'](db[_0x05fa('0x45')],{});db[_0x05fa('0xde')][_0x05fa('0x109')](db['FaxAccount'],{'foreignKey':_0x05fa('0x1ce'),'as':'FromAccount'});db[_0x05fa('0xde')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'foreignKey':_0x05fa('0x1c5'),'as':_0x05fa('0x1cf')});db['FaxTransferReport']['belongsTo'](db[_0x05fa('0x10')],{'foreignKey':_0x05fa('0x1c6'),'as':_0x05fa('0x1c7')});db[_0x05fa('0xde')][_0x05fa('0x109')](db[_0x05fa('0x49')],{'foreignKey':_0x05fa('0x1d0'),'as':'ToQueue'});db[_0x05fa('0xde')][_0x05fa('0x109')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0x05fa('0x1cb')});db[_0x05fa('0xe0')][_0x05fa('0x109')](db[_0x05fa('0x56')],{});db[_0x05fa('0xe0')][_0x05fa('0x109')](db[_0x05fa('0x54')],{});db[_0x05fa('0xe0')][_0x05fa('0x109')](db[_0x05fa('0x51')],{'foreignKey':_0x05fa('0x1d1'),'as':_0x05fa('0x1c4')});db[_0x05fa('0xe0')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'foreignKey':_0x05fa('0x1c5'),'as':_0x05fa('0x1cf')});db['OpenchannelTransferReport']['belongsTo'](db[_0x05fa('0x10')],{'foreignKey':'ToUserId','as':_0x05fa('0x1c7')});db['OpenchannelTransferReport'][_0x05fa('0x109')](db[_0x05fa('0x11c')],{'foreignKey':_0x05fa('0x1d2'),'as':_0x05fa('0x1c9')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x05fa('0x1d3'),'as':_0x05fa('0x1cb')});db[_0x05fa('0xe2')][_0x05fa('0x109')](db['SmsMessage'],{});db[_0x05fa('0xe2')][_0x05fa('0x109')](db['SmsInteraction'],{});db[_0x05fa('0xe2')]['belongsTo'](db[_0x05fa('0x127')],{'foreignKey':_0x05fa('0x1d4'),'as':_0x05fa('0x1c4')});db[_0x05fa('0xe2')]['belongsTo'](db['User'],{'foreignKey':_0x05fa('0x1c5'),'as':'FromAgent'});db[_0x05fa('0xe2')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x05fa('0xe2')][_0x05fa('0x109')](db[_0x05fa('0x16a')],{'foreignKey':_0x05fa('0x1d5'),'as':'ToQueue'});db[_0x05fa('0xe2')][_0x05fa('0x109')](db[_0x05fa('0x127')],{'foreignKey':_0x05fa('0x1d6'),'as':_0x05fa('0x1cb')});db[_0x05fa('0x120')]['hasMany'](db[_0x05fa('0x15e')],{'as':_0x05fa('0x14b'),'foreignKey':_0x05fa('0x150'),'onDelete':_0x05fa('0xfc')});db[_0x05fa('0x120')][_0x05fa('0xfe')](db[_0x05fa('0x6d')],{'as':_0x05fa('0x1d7'),'foreignKey':_0x05fa('0x150')});db[_0x05fa('0x120')][_0x05fa('0xfe')](db[_0x05fa('0x66')],{'as':_0x05fa('0x10c'),'onDelete':_0x05fa('0xfc'),'foreignKey':_0x05fa('0x150')});db[_0x05fa('0x120')]['hasMany'](db[_0x05fa('0x100')],{'as':_0x05fa('0x101'),'foreignKey':'ListId'});db[_0x05fa('0x120')]['hasMany'](db[_0x05fa('0x6c')],{'as':_0x05fa('0x102'),'foreignKey':_0x05fa('0x150')});db[_0x05fa('0x120')][_0x05fa('0xfe')](db[_0x05fa('0x103')],{'as':_0x05fa('0x103'),'foreignKey':_0x05fa('0x150')});db[_0x05fa('0x120')][_0x05fa('0x10b')](db['VoiceQueue'],{'as':_0x05fa('0x1d8'),'through':_0x05fa('0x13d')});db[_0x05fa('0x120')][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':_0x05fa('0x160'),'through':'cm_user_has_lists'});db[_0x05fa('0xe3')]['hasMany'](db[_0x05fa('0x15')],{'as':'Extensions','onDelete':_0x05fa('0xfc')});db[_0x05fa('0xe3')][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':'Agents','through':'UserVoicePrefix'});db[_0x05fa('0xe3')]['belongsToMany'](db[_0x05fa('0x151')],{'through':_0x05fa('0xf8'),'as':_0x05fa('0x13e')});db['UserProfile'][_0x05fa('0xfe')](db[_0x05fa('0x10')],{'as':_0x05fa('0x16d'),'foreignKey':_0x05fa('0x10a')});db['UserProfile'][_0x05fa('0xfe')](db[_0x05fa('0xe7')],{'as':_0x05fa('0x1d9'),'foreignKey':_0x05fa('0x10a'),'onDelete':_0x05fa('0xfc')});db[_0x05fa('0xe7')]['hasMany'](db[_0x05fa('0x1da')],{'as':_0x05fa('0x1db'),'foreignKey':_0x05fa('0x1dc'),'onDelete':'cascade'});db[_0x05fa('0xea')]['hasMany'](db[_0x05fa('0x15e')],{'as':'Dispositions','foreignKey':_0x05fa('0x1dd'),'onDelete':_0x05fa('0xfc')});db['WhatsappAccount'][_0x05fa('0xfe')](db['CannedAnswer'],{'as':_0x05fa('0x14c'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x05fa('0xfe')](db[_0x05fa('0x1de')],{'as':'Messages','foreignKey':_0x05fa('0x1dd')});db[_0x05fa('0xea')][_0x05fa('0xfe')](db['WhatsappInteraction'],{'as':'Interactions'});db['WhatsappAccount'][_0x05fa('0xfe')](db[_0x05fa('0x1df')],{'as':_0x05fa('0x12e')});db[_0x05fa('0xea')][_0x05fa('0x109')](db[_0x05fa('0x120')],{'as':_0x05fa('0x14f'),'foreignKey':_0x05fa('0x150')});db['WhatsappAccount'][_0x05fa('0x109')](db[_0x05fa('0x76')],{'as':_0x05fa('0x168'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount']['belongsToMany'](db[_0x05fa('0x10')],{'as':_0x05fa('0x160'),'through':_0x05fa('0x12a')});db['WhatsappApplication']['belongsTo'](db[_0x05fa('0x10')],{'onDelete':'restrict'});db[_0x05fa('0x1df')]['belongsTo'](db[_0x05fa('0x11e')],{'onDelete':_0x05fa('0x15a')});db[_0x05fa('0x1df')]['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x05fa('0x15a')});db[_0x05fa('0x1df')][_0x05fa('0x109')](db[_0x05fa('0x75')],{'onDelete':_0x05fa('0x15a'),'foreignKey':'IntervalId'});db[_0x05fa('0x1df')]['belongsTo'](db['Tag'],{'onDelete':_0x05fa('0x15a'),'foreignKey':_0x05fa('0x15b')});db['WhatsappInteraction']['hasMany'](db['WhatsappMessage'],{'as':_0x05fa('0x141'),'onDelete':'cascade','foreignKey':_0x05fa('0x1e0')});db['WhatsappInteraction'][_0x05fa('0x109')](db[_0x05fa('0xea')],{'as':'Account','foreignKey':_0x05fa('0x1dd')});db[_0x05fa('0xed')][_0x05fa('0x109')](db[_0x05fa('0x66')],{'as':_0x05fa('0x153'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x05fa('0x109')](db[_0x05fa('0x10')],{'as':'Owner','foreignKey':_0x05fa('0xfd')});db[_0x05fa('0xed')][_0x05fa('0x10b')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x05fa('0x163')});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':_0x05fa('0x1e1'),'as':'ThroughTags'});db[_0x05fa('0xed')][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':'Users','through':_0x05fa('0x1e2'),'foreignKey':_0x05fa('0x1e0')});db[_0x05fa('0x1de')]['belongsTo'](db[_0x05fa('0x10')],{'as':_0x05fa('0x10')});db[_0x05fa('0x1de')][_0x05fa('0x109')](db['CmContact'],{'onDelete':'cascade','as':_0x05fa('0x153')});db[_0x05fa('0x1de')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x05fa('0x159'),'foreignKey':_0x05fa('0x1e0')});db[_0x05fa('0x1de')][_0x05fa('0x109')](db[_0x05fa('0xea')],{'as':_0x05fa('0x152'),'foreignKey':_0x05fa('0x1dd')});db[_0x05fa('0xf0')][_0x05fa('0x109')](db[_0x05fa('0xea')],{});db[_0x05fa('0xf0')]['belongsTo'](db[_0x05fa('0x120')],{'as':_0x05fa('0x14f'),'foreignKey':_0x05fa('0x150')});db[_0x05fa('0xf0')]['belongsTo'](db[_0x05fa('0x66')],{'as':_0x05fa('0x153'),'foreignKey':_0x05fa('0x148')});db[_0x05fa('0xf0')][_0x05fa('0x109')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x05fa('0x11e')],{});db['WhatsappQueueReport'][_0x05fa('0x109')](db[_0x05fa('0x1de')],{});db['WhatsappQueueReport'][_0x05fa('0x109')](db[_0x05fa('0x10')],{});db[_0x05fa('0xf2')][_0x05fa('0x109')](db['WhatsappMessage'],{});db[_0x05fa('0xf2')][_0x05fa('0x109')](db[_0x05fa('0xed')],{});db['WhatsappTransferReport'][_0x05fa('0x109')](db['WhatsappAccount'],{'foreignKey':_0x05fa('0x1e3'),'as':'FromAccount'});db[_0x05fa('0xf2')][_0x05fa('0x109')](db['WhatsappAccount'],{'foreignKey':_0x05fa('0x1e4'),'as':_0x05fa('0x1cb')});db[_0x05fa('0xf2')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x05fa('0x1e5'),'as':_0x05fa('0x1c9')});db[_0x05fa('0xf2')][_0x05fa('0x109')](db[_0x05fa('0x10')],{'foreignKey':'FromUserId','as':_0x05fa('0x1cf')});db['WhatsappTransferReport'][_0x05fa('0x109')](db[_0x05fa('0x10')],{'foreignKey':_0x05fa('0x1c6'),'as':_0x05fa('0x1c7')});db['WhatsappQueue'][_0x05fa('0x10b')](db[_0x05fa('0x10')],{'as':_0x05fa('0x160'),'through':_0x05fa('0x31'),'foreignKey':_0x05fa('0x1e6')});db['WhatsappQueue']['belongsToMany'](db[_0x05fa('0x151')],{'through':'team_has_whatsapp_queues','as':_0x05fa('0x13e')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x2109=['Smtp','Dispositions','Answers','List','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Interaction','ChatWebsiteId','restrict','TagId','MailQueueReport','DashboardItem','Items','FaxAccountId','Interactions','FaxApplication','Exntensions','ListId','FaxInteractionId','fax_interaction_has_tags','team_has_fax_queues','SmsAccountId','SmsMessage','SmsApplication','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','AttachmentId','team_has_openchannel_queues','ChatProactiveAction','user_has_chat_websites','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CompanyId','ChatInteractions','Company','cm_contact_has_tags','Agent','CampaignId','OneAll','AutomationAllId','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticCustomReport','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Field','FieldId','SugarcrmConfiguration','SugarcrmField','int_desk_configuration_has_tags','Description','VariableId','ZohoField','ZohoConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowAccount','FreshsalesConfiguration','FreshsalesField','FromId','ToId','SessionId','ProjectId','VoiceQueues','SmsQueues','team_has_whatsapp_queues','TeamVoicePrefix','HopperBlacks','SquareProjectId','campaigns_has_cm_blacklists','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromChatWebsiteId','FromUserId','ToChatQueueId','ToAccount','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CmCustomField','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','options','password','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','SmsInteraction','../api/smsMessage/smsMessage.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','cascade','hasMany','VoiceRecording','Recordings','UserId','UserVoiceQueueRt','VoiceQueuesRt','VoiceExtension','Extensions','CmHopperFinal','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','MailInteraction','MailInteractions','UserNotification','UserNotifications','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteractions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueue','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','VoiceContext','Applications','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','AgentReports','CmContact','Contact','MailAccountId','hasOne','Imap'];(function(_0x21b4cb,_0x2bd0c3){var _0x21318b=function(_0x4bf488){while(--_0x4bf488){_0x21b4cb['push'](_0x21b4cb['shift']());}};_0x21318b(++_0x2bd0c3);}(_0x2109,0x93));var _0x9210=function(_0x1c7851,_0x34cd7e){_0x1c7851=_0x1c7851-0x0;var _0x47a721=_0x2109[_0x1c7851];return _0x47a721;};'use strict';var config=require(_0x9210('0x0'));var Sequelize=require(_0x9210('0x1'));var _=require(_0x9210('0x2'));var jstz=require(_0x9210('0x3'));var timezone=jstz[_0x9210('0x4')]();config[_0x9210('0x1')]=_[_0x9210('0x5')](config['sequelize'],{'database':_0x9210('0x6'),'username':_0x9210('0x7'),'password':'xC@LL1234','options':{'host':_0x9210('0x8'),'port':0xcea,'dialect':_0x9210('0x9'),'dialectOptions':{'charset':_0x9210('0xa')},'logging':![],'timezone':timezone[_0x9210('0xb')](),'define':{'charset':_0x9210('0xc'),'collate':_0x9210('0xd')}}});config[_0x9210('0xe')]=_[_0x9210('0x5')](config[_0x9210('0xe')],{'database':_0x9210('0x6'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x9210('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x9210('0xc'),'collate':_0x9210('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9210('0x1')][_0x9210('0xf')],config[_0x9210('0x1')]['username'],config[_0x9210('0x1')]['password'],config[_0x9210('0x1')][_0x9210('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x9210('0xf')],config[_0x9210('0xe')]['username'],config[_0x9210('0xe')][_0x9210('0x11')],config['sequelizeHistory'][_0x9210('0x10')])};db[_0x9210('0x12')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/user/user.model');db[_0x9210('0x14')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x15'));db['VoiceContext']=db[_0x9210('0x1')][_0x9210('0x13')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db['sequelize']['import'](_0x9210('0x16'));db[_0x9210('0x17')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x18'));db[_0x9210('0x19')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x1a'));db['VoiceRecording']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x1b'));db[_0x9210('0x1c')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x1d'));db[_0x9210('0x1e')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x1f'));db[_0x9210('0x20')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x21'));db['VoiceCallReport']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x22'));db[_0x9210('0x23')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x24'));db[_0x9210('0x25')]=db['sequelize'][_0x9210('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x9210('0x26')]=db['sequelize']['import'](_0x9210('0x27'));db[_0x9210('0x28')]=db[_0x9210('0x1')]['import'](_0x9210('0x29'));db[_0x9210('0x2a')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x2b'));db['VoiceTransferReport']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x2c'));db['UserVoiceQueueRt']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x2d'));db[_0x9210('0x2e')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x2f'));db[_0x9210('0x30')]=db[_0x9210('0x1')]['import'](_0x9210('0x31'));db[_0x9210('0x32')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x33'));db[_0x9210('0x34')]=db[_0x9210('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x35'));db[_0x9210('0x36')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x37'));db[_0x9210('0x38')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x39'));db[_0x9210('0x3a')]=db[_0x9210('0x1')]['import'](_0x9210('0x3b'));db[_0x9210('0x3c')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x3d'));db[_0x9210('0x3e')]=db[_0x9210('0x1')]['import'](_0x9210('0x3f'));db[_0x9210('0x40')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x41'));db[_0x9210('0x42')]=db[_0x9210('0x1')]['import'](_0x9210('0x43'));db['MailInteraction']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x44'));db[_0x9210('0x45')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x46'));db[_0x9210('0x47')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x48'));db['MailQueueReport']=db[_0x9210('0x1')]['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x9210('0x49')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x4a'));db['DashboardItem']=db['sequelize']['import'](_0x9210('0x4b'));db[_0x9210('0x4c')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x4d'));db[_0x9210('0x4e')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x9210('0x4f')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x50'));db[_0x9210('0x51')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x52'));db[_0x9210('0x53')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0x9210('0x54')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x9210('0x1')][_0x9210('0x13')]('../api/smsApplication/smsApplication.model');db[_0x9210('0x55')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x9210('0x1')]['import'](_0x9210('0x56'));db['SmsQueue']=db[_0x9210('0x1')][_0x9210('0x13')]('../api/smsQueue/smsQueue.model');db[_0x9210('0x57')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x58'));db[_0x9210('0x59')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x5a'));db[_0x9210('0x5b')]=db[_0x9210('0x1')]['import'](_0x9210('0x5c'));db[_0x9210('0x5d')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x5e'));db[_0x9210('0x5f')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x60'));db[_0x9210('0x61')]=db['sequelize']['import'](_0x9210('0x62'));db[_0x9210('0x63')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x64'));db[_0x9210('0x65')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x66'));db[_0x9210('0x67')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x68'));db[_0x9210('0x69')]=db['sequelize'][_0x9210('0x13')]('../api/chatMessage/chatMessage.model');db[_0x9210('0x6a')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x6b'));db[_0x9210('0x6c')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x6d'));db['ChatGroup']=db[_0x9210('0x1')][_0x9210('0x13')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0x9210('0x1')][_0x9210('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x9210('0x6e')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x6f'));db['CmContact']=db[_0x9210('0x1')]['import'](_0x9210('0x70'));db[_0x9210('0x71')]=db[_0x9210('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0x9210('0x72')]=db['sequelize']['import']('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db['sequelize']['import'](_0x9210('0x73'));db['CmHopperHistory']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x74'));db[_0x9210('0x75')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x76'));db['CmCustomField']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x77'));db[_0x9210('0x78')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/action/action.model');db[_0x9210('0x79')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/automation/automation.model');db[_0x9210('0x7a')]=db[_0x9210('0x1')]['import'](_0x9210('0x7b'));db[_0x9210('0x7c')]=db['sequelize'][_0x9210('0x13')]('../api/disposition/disposition.model');db[_0x9210('0x7d')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x7e'));db[_0x9210('0x7f')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x80'));db[_0x9210('0x81')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/pause/pause.model');db[_0x9210('0x82')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x83'));db[_0x9210('0x84')]=db['sequelize']['import'](_0x9210('0x85'));db[_0x9210('0x86')]=db[_0x9210('0x1')]['import'](_0x9210('0x87'));db[_0x9210('0x88')]=db['sequelize'][_0x9210('0x13')]('../api/tag/tag.model');db['Template']=db[_0x9210('0x1')]['import'](_0x9210('0x89'));db['Trigger']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x8a'));db[_0x9210('0x8b')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x8c'));db[_0x9210('0x8d')]=db['sequelize'][_0x9210('0x13')]('../api/integration/integration.model');db[_0x9210('0x8e')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x8f'));db['AnalyticCustomReport']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x90'));db[_0x9210('0x91')]=db['sequelize'][_0x9210('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x9210('0x92')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x93'));db['AnalyticMetric']=db['sequelize'][_0x9210('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x9210('0x94')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x95'));db[_0x9210('0x96')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x97'));db[_0x9210('0x98')]=db[_0x9210('0x1')]['import'](_0x9210('0x99'));db[_0x9210('0x9a')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x9b'));db[_0x9210('0x9c')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x9d'));db[_0x9210('0x9e')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x9210('0x1')][_0x9210('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x9f'));db[_0x9210('0xa0')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xa1'));db[_0x9210('0xa2')]=db['sequelize'][_0x9210('0x13')](_0x9210('0xa3'));db[_0x9210('0xa4')]=db[_0x9210('0x1')]['import'](_0x9210('0xa5'));db[_0x9210('0xa6')]=db[_0x9210('0x1')]['import'](_0x9210('0xa7'));db['ZohoConfiguration']=db['sequelize'][_0x9210('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db['sequelize'][_0x9210('0x13')](_0x9210('0xa8'));db['ZendeskAccount']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xa9'));db[_0x9210('0xaa')]=db[_0x9210('0x1')]['import'](_0x9210('0xab'));db[_0x9210('0xac')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0x9210('0xad')]=db[_0x9210('0x1')]['import'](_0x9210('0xae'));db[_0x9210('0xaf')]=db[_0x9210('0x1')]['import'](_0x9210('0xb0'));db[_0x9210('0xb1')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xb2'));db['VtigerAccount']=db[_0x9210('0x1')]['import'](_0x9210('0xb3'));db[_0x9210('0xb4')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xb5'));db[_0x9210('0xb6')]=db[_0x9210('0x1')]['import'](_0x9210('0xb7'));db['ServicenowAccount']=db['sequelize'][_0x9210('0x13')](_0x9210('0xb8'));db[_0x9210('0xb9')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xba'));db[_0x9210('0xbb')]=db['sequelize']['import'](_0x9210('0xbc'));db[_0x9210('0xbd')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xbe'));db[_0x9210('0xbf')]=db['sequelize'][_0x9210('0x13')](_0x9210('0xc0'));db[_0x9210('0xc1')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x9210('0xc2')]=db['sequelize']['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x9210('0x1')][_0x9210('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db['sequelize'][_0x9210('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x9210('0x8d')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xc3'));db[_0x9210('0xc4')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xc5'));db[_0x9210('0xc6')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xc7'));db['ChatInternalMessage']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xc8'));db[_0x9210('0xc9')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xca'));db[_0x9210('0xcb')]=db['sequelize'][_0x9210('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x9210('0xcc')]=db[_0x9210('0x1')]['import'](_0x9210('0xcd'));db[_0x9210('0xce')]=db['sequelize'][_0x9210('0x13')]('../api/smsQueueReport/smsQueueReport.model');db[_0x9210('0xcf')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xd0'));db[_0x9210('0xd1')]=db[_0x9210('0x1')]['import'](_0x9210('0xd2'));db[_0x9210('0xd3')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db['sequelize'][_0x9210('0x13')](_0x9210('0xd4'));db[_0x9210('0xd5')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xd6'));db[_0x9210('0xd7')]=db['sequelize'][_0x9210('0x13')](_0x9210('0xd8'));db[_0x9210('0xd9')]=db['sequelize'][_0x9210('0x13')](_0x9210('0xda'));db[_0x9210('0xdb')]=db['sequelize'][_0x9210('0x13')](_0x9210('0xdc'));db[_0x9210('0xdd')]=db[_0x9210('0x1')]['import']('../api/team/team.model');db[_0x9210('0xde')]=db['sequelize'][_0x9210('0x13')](_0x9210('0xdf'));db[_0x9210('0xe0')]=db[_0x9210('0x1')]['import'](_0x9210('0xe1'));db[_0x9210('0xe2')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xe3'));db[_0x9210('0xe4')]=db[_0x9210('0x1')]['import'](_0x9210('0xe5'));db[_0x9210('0xe6')]=db['sequelize']['import'](_0x9210('0xe7'));db[_0x9210('0xe8')]=db['sequelize'][_0x9210('0x13')](_0x9210('0xe9'));db[_0x9210('0xea')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xeb'));db[_0x9210('0xec')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xed'));db[_0x9210('0xee')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x9210('0xef')]=db[_0x9210('0x1')]['import'](_0x9210('0xf0'));db[_0x9210('0xf1')]=db[_0x9210('0x1')]['import'](_0x9210('0xf2'));db[_0x9210('0xf3')]=db[_0x9210('0x1')]['import']('../api/voicePrefix/voicePrefix.model');db[_0x9210('0xf4')]=db[_0x9210('0x1')][_0x9210('0x13')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xf5'));db[_0x9210('0xf6')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xf7'));db['UserNotification']=db['sequelize'][_0x9210('0x13')](_0x9210('0xf8'));db['WhatsappAccount']=db['sequelize'][_0x9210('0x13')](_0x9210('0xf9'));db[_0x9210('0xfa')]=db[_0x9210('0x1')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0x9210('0xfb')]=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xfc'));db['WhatsappMessage']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xfd'));db['WhatsappQueueReport']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0xfe'));db[_0x9210('0xff')]=db[_0x9210('0x1')]['import'](_0x9210('0x100'));db[_0x9210('0x101')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x102'));db['CloudProvider']=db[_0x9210('0x1')][_0x9210('0x13')](_0x9210('0x103'));db[_0x9210('0x104')]=db['sequelize'][_0x9210('0x13')](_0x9210('0x105'));db['TeamVoicePrefix']=db['sequelize'][_0x9210('0x13')](_0x9210('0x106'));db[_0x9210('0x107')]=db['sequelize']['import']('../api/userVoicePrefix/userVoicePrefix.model');db['User']['hasOne'](db[_0x9210('0x1e')],{'as':_0x9210('0x1e'),'onDelete':_0x9210('0x108'),'foreignKey':'UserId'});db[_0x9210('0x12')][_0x9210('0x109')](db[_0x9210('0x10a')],{'as':_0x9210('0x10b'),'foreignKey':_0x9210('0x10c')});db['User'][_0x9210('0x109')](db[_0x9210('0x10d')],{'as':_0x9210('0x10e'),'foreignKey':_0x9210('0x10c')});db['User']['hasMany'](db[_0x9210('0x10f')],{'as':_0x9210('0x110'),'onDelete':'cascade','hooks':!![]});db[_0x9210('0x12')][_0x9210('0x109')](db[_0x9210('0x111')],{'as':_0x9210('0x112'),'foreignKey':_0x9210('0x10c')});db[_0x9210('0x12')][_0x9210('0x109')](db[_0x9210('0x113')],{'as':_0x9210('0x114'),'foreignKey':_0x9210('0x10c')});db['User']['hasMany'](db[_0x9210('0x75')],{'as':'ReportAgentPreview','foreignKey':_0x9210('0x10c')});db['User']['hasMany'](db[_0x9210('0x5b')],{'as':_0x9210('0x115'),'foreignKey':_0x9210('0x10c')});db[_0x9210('0x12')][_0x9210('0x109')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x9210('0x10c')});db[_0x9210('0x12')][_0x9210('0x109')](db[_0x9210('0x55')],{'as':'SmsInteractions','foreignKey':_0x9210('0x10c')});db[_0x9210('0x12')][_0x9210('0x109')](db[_0x9210('0x4e')],{'as':'FaxInteractions','foreignKey':_0x9210('0x10c')});db['User'][_0x9210('0x109')](db[_0x9210('0x116')],{'as':_0x9210('0x117'),'foreignKey':_0x9210('0x10c')});db[_0x9210('0x12')][_0x9210('0x109')](db[_0x9210('0xfb')],{'as':'WhatsappInteractions','foreignKey':_0x9210('0x10c')});db['User']['hasMany'](db[_0x9210('0x118')],{'as':_0x9210('0x119'),'foreignKey':'SenderId'});db['User']['belongsTo'](db[_0x9210('0xf4')],{'as':_0x9210('0xf4'),'foreignKey':_0x9210('0x11a')});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x11c')],{'as':'Groups','through':_0x9210('0x11d')});db[_0x9210('0x12')][_0x9210('0x11b')](db['CmContact'],{'as':_0x9210('0x11e'),'through':_0x9210('0x11f')});db[_0x9210('0x12')]['belongsToMany'](db[_0x9210('0xf1')],{'as':_0x9210('0x120'),'through':_0x9210('0x121')});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0xdd')],{'through':_0x9210('0x122')});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x116')],{'as':_0x9210('0x117'),'through':_0x9210('0x123')});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x67')],{'as':'ChatInteractions','through':_0x9210('0x124')});db[_0x9210('0x12')]['belongsToMany'](db[_0x9210('0x4e')],{'as':_0x9210('0x125'),'through':_0x9210('0x126')});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x55')],{'as':_0x9210('0x127'),'through':'user_has_sms_interactions'});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x5b')],{'as':_0x9210('0x115'),'through':_0x9210('0x128')});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0xfb')],{'as':_0x9210('0x129'),'through':_0x9210('0x12a')});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x19')],{'as':'VoiceQueues','through':_0x9210('0x2e'),'required':![]});db[_0x9210('0x12')]['belongsToMany'](db[_0x9210('0xf3')],{'as':_0x9210('0x12b'),'through':_0x9210('0x107'),'required':![]});db['User'][_0x9210('0x11b')](db['MailQueue'],{'as':_0x9210('0x12c'),'through':_0x9210('0x32'),'required':![]});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x6c')],{'as':_0x9210('0x12d'),'through':_0x9210('0x30'),'required':![],'hooks':!![]});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x51')],{'as':_0x9210('0x12e'),'through':_0x9210('0x34'),'required':![]});db['User']['belongsToMany'](db[_0x9210('0x12f')],{'as':'SmsQueues','through':_0x9210('0x130'),'required':![]});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x5f')],{'as':_0x9210('0x131'),'through':_0x9210('0x36'),'required':![]});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x101')],{'as':_0x9210('0x132'),'through':_0x9210('0x38'),'required':![]});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0xf1')],{'through':_0x9210('0x121')});db[_0x9210('0x12')]['belongsToMany'](db[_0x9210('0xf3')],{'as':_0x9210('0x12b'),'through':'user_has_voice_prefixes','required':![]});db['User']['belongsToMany'](db[_0x9210('0x61')],{'as':_0x9210('0x133'),'through':'user_has_chat_websites'});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x4c')],{'as':_0x9210('0x134'),'through':_0x9210('0x135')});db[_0x9210('0x12')]['belongsToMany'](db['MailAccount'],{'as':_0x9210('0x136'),'through':_0x9210('0x137')});db[_0x9210('0x12')][_0x9210('0x11b')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x9210('0x138')});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x54')],{'as':_0x9210('0x139'),'through':_0x9210('0x13a')});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0x13b')],{'as':_0x9210('0x13c'),'through':_0x9210('0x13d')});db[_0x9210('0x12')][_0x9210('0x11b')](db[_0x9210('0xd7')],{'as':_0x9210('0x13e'),'through':_0x9210('0x13f')});db[_0x9210('0x14')]['hasMany'](db[_0x9210('0x10f')],{'as':'SpiedAgents','onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x140')});db[_0x9210('0x141')][_0x9210('0x109')](db[_0x9210('0x10f')],{'onDelete':_0x9210('0x108')});db['VoiceExtension'][_0x9210('0x109')](db['VoiceExtension'],{'as':_0x9210('0x142'),'onDelete':_0x9210('0x108')});db[_0x9210('0x17')][_0x9210('0x11b')](db[_0x9210('0x86')],{'as':'Sounds','through':_0x9210('0x143')});db[_0x9210('0x19')][_0x9210('0x109')](db[_0x9210('0x10d')],{'as':_0x9210('0x144'),'foreignKey':_0x9210('0x145')});db[_0x9210('0x19')][_0x9210('0x109')](db['CmHopper'],{'as':_0x9210('0x146'),'foreignKey':_0x9210('0x145')});db[_0x9210('0x19')]['hasMany'](db[_0x9210('0x111')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x9210('0x19')][_0x9210('0x109')](db[_0x9210('0x113')],{'as':_0x9210('0x147'),'foreignKey':_0x9210('0x145')});db[_0x9210('0x19')][_0x9210('0x109')](db[_0x9210('0x75')],{'as':_0x9210('0x75'),'foreignKey':_0x9210('0x145')});db[_0x9210('0x19')][_0x9210('0x109')](db[_0x9210('0x72')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x9210('0x19')][_0x9210('0x109')](db[_0x9210('0xcc')],{'as':_0x9210('0x148'),'foreignKey':_0x9210('0x145')});db[_0x9210('0x19')][_0x9210('0x149')](db['Trunk'],{'as':_0x9210('0x2a'),'foreignKey':_0x9210('0x14a')});db[_0x9210('0x19')]['belongsTo'](db[_0x9210('0x2a')],{'as':_0x9210('0x14b'),'foreignKey':_0x9210('0x14c')});db[_0x9210('0x19')][_0x9210('0x149')](db[_0x9210('0x7f')],{'as':_0x9210('0x7f'),'foreignKey':_0x9210('0x14d')});db[_0x9210('0x19')][_0x9210('0x149')](db[_0x9210('0x81')],{'as':_0x9210('0x14e'),'foreignKey':_0x9210('0x14f')});db[_0x9210('0x19')]['belongsToMany'](db[_0x9210('0xf1')],{'as':_0x9210('0x120'),'through':_0x9210('0x150')});db[_0x9210('0x19')]['belongsToMany'](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':_0x9210('0x2e')});db['VoiceQueue']['belongsToMany'](db['Team'],{'as':_0x9210('0x152'),'through':_0x9210('0x104')});db[_0x9210('0x19')]['belongsToMany'](db[_0x9210('0xf1')],{'as':_0x9210('0x153'),'through':_0x9210('0x154')});db[_0x9210('0x10a')][_0x9210('0x149')](db[_0x9210('0x12')],{'as':_0x9210('0x12'),'foreignKey':'UserId'});db['ScreenRecording'][_0x9210('0x149')](db[_0x9210('0x12')],{'as':_0x9210('0x12'),'foreignKey':_0x9210('0x10c')});db[_0x9210('0x1e')][_0x9210('0x109')](db[_0x9210('0x20')],{'as':_0x9210('0x155'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x156'),'sourceKey':'mailbox'});db[_0x9210('0x20')][_0x9210('0x149')](db[_0x9210('0x1e')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0x9210('0x157')][_0x9210('0x109')](db[_0x9210('0x26')],{'as':_0x9210('0x158'),'foreignKey':_0x9210('0x159'),'constraints':![]});db[_0x9210('0x157')][_0x9210('0x109')](db[_0x9210('0x25')],{'as':_0x9210('0x15a'),'foreignKey':_0x9210('0x159'),'constraints':![]});db[_0x9210('0x157')]['belongsTo'](db[_0x9210('0x12')],{'as':'User','foreignKey':_0x9210('0x10c')});db[_0x9210('0x157')][_0x9210('0x149')](db[_0x9210('0x15b')],{'as':_0x9210('0x15c'),'foreignKey':'ContactId'});db[_0x9210('0x3a')][_0x9210('0x149')](db['MailAccount'],{'as':_0x9210('0x3e'),'foreignKey':_0x9210('0x15d')});db[_0x9210('0x3c')][_0x9210('0x149')](db[_0x9210('0x3e')],{'as':'MailAccount','foreignKey':_0x9210('0x15d')});db[_0x9210('0x3e')][_0x9210('0x15e')](db[_0x9210('0x3a')],{'as':_0x9210('0x15f'),'onDelete':'cascade'});db['MailAccount'][_0x9210('0x15e')](db[_0x9210('0x3c')],{'as':_0x9210('0x160'),'onDelete':_0x9210('0x108')});db[_0x9210('0x3e')][_0x9210('0x109')](db['Disposition'],{'as':_0x9210('0x161'),'foreignKey':_0x9210('0x15d'),'onDelete':_0x9210('0x108')});db['MailAccount'][_0x9210('0x109')](db[_0x9210('0x7a')],{'as':_0x9210('0x162'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x9210('0x109')](db[_0x9210('0x45')],{'as':_0x9210('0x155'),'foreignKey':_0x9210('0x15d')});db[_0x9210('0x3e')][_0x9210('0x109')](db['MailInteraction'],{'as':'Interactions'});db[_0x9210('0x3e')]['hasMany'](db[_0x9210('0x47')],{'as':'Applications'});db[_0x9210('0x3e')][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':_0x9210('0x163'),'foreignKey':'ListId'});db['MailAccount'][_0x9210('0x149')](db['Template'],{'as':_0x9210('0x164'),'foreignKey':_0x9210('0x165')});db[_0x9210('0x3e')][_0x9210('0x149')](db[_0x9210('0x81')],{'as':_0x9210('0x14e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9210('0x3e')]['belongsToMany'](db['User'],{'as':_0x9210('0x151'),'through':_0x9210('0x137')});db[_0x9210('0x40')]['belongsToMany'](db['User'],{'as':_0x9210('0x151'),'through':_0x9210('0x32')});db[_0x9210('0x40')][_0x9210('0x11b')](db[_0x9210('0xdd')],{'through':_0x9210('0x166'),'as':_0x9210('0x152')});db[_0x9210('0x116')][_0x9210('0x109')](db['MailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x9210('0x167')});db[_0x9210('0x116')][_0x9210('0x149')](db[_0x9210('0x3e')],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x15d')});db[_0x9210('0x116')][_0x9210('0x149')](db[_0x9210('0x15b')],{'as':_0x9210('0x15c'),'foreignKey':_0x9210('0x169')});db['MailInteraction']['belongsTo'](db[_0x9210('0x12')],{'as':_0x9210('0x16a'),'foreignKey':_0x9210('0x10c')});db[_0x9210('0x116')][_0x9210('0x11b')](db[_0x9210('0x88')],{'through':_0x9210('0x16b'),'as':_0x9210('0x16c')});db[_0x9210('0x116')][_0x9210('0x11b')](db[_0x9210('0x88')],{'through':_0x9210('0x16b'),'as':_0x9210('0x16d')});db[_0x9210('0x116')][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x16e'),'through':_0x9210('0x123'),'foreignKey':_0x9210('0x167')});db[_0x9210('0x45')][_0x9210('0x109')](db['Attachment'],{'as':'Attachments','onDelete':_0x9210('0x108')});db[_0x9210('0x45')][_0x9210('0x149')](db[_0x9210('0x12')],{'as':_0x9210('0x12')});db[_0x9210('0x45')]['belongsTo'](db[_0x9210('0x15b')],{'onDelete':'cascade','as':_0x9210('0x15c')});db[_0x9210('0x45')][_0x9210('0x149')](db[_0x9210('0x116')],{'as':_0x9210('0x16f'),'foreignKey':_0x9210('0x167')});db[_0x9210('0x45')][_0x9210('0x149')](db['MailAccount'],{'as':_0x9210('0x168'),'foreignKey':'MailAccountId'});db[_0x9210('0x45')]['belongsTo'](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0x9210('0x170')});db[_0x9210('0x45')][_0x9210('0x149')](db[_0x9210('0x6a')],{'as':_0x9210('0x6a'),'foreignKey':'ChatOfflineMessageId'});db[_0x9210('0x47')][_0x9210('0x149')](db[_0x9210('0x12')],{'onDelete':_0x9210('0x171')});db[_0x9210('0x47')]['belongsTo'](db[_0x9210('0x40')],{'onDelete':'restrict'});db[_0x9210('0x47')][_0x9210('0x149')](db[_0x9210('0x3e')],{'onDelete':_0x9210('0x171')});db[_0x9210('0x47')][_0x9210('0x149')](db['Interval'],{'onDelete':_0x9210('0x171'),'foreignKey':_0x9210('0x14d')});db[_0x9210('0x47')][_0x9210('0x149')](db['Tag'],{'onDelete':_0x9210('0x171'),'foreignKey':_0x9210('0x172')});db['MailQueueReport'][_0x9210('0x149')](db['MailAccount'],{});db['MailQueueReport'][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':_0x9210('0x163'),'foreignKey':'ListId'});db[_0x9210('0x173')][_0x9210('0x149')](db[_0x9210('0x15b')],{'as':_0x9210('0x15c'),'foreignKey':_0x9210('0x169')});db[_0x9210('0x173')][_0x9210('0x149')](db[_0x9210('0x116')],{});db[_0x9210('0x173')][_0x9210('0x149')](db[_0x9210('0x45')],{});db[_0x9210('0x173')]['belongsTo'](db[_0x9210('0x12')],{});db['MailQueueReport'][_0x9210('0x149')](db[_0x9210('0x40')],{});db[_0x9210('0x49')]['hasMany'](db[_0x9210('0x174')],{'as':_0x9210('0x175'),'onDelete':_0x9210('0x108')});db[_0x9210('0x4c')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x9210('0x4c')][_0x9210('0x109')](db['CannedAnswer'],{'as':_0x9210('0x162'),'foreignKey':_0x9210('0x176')});db[_0x9210('0x4c')]['hasMany'](db[_0x9210('0x4e')],{'as':_0x9210('0x177')});db[_0x9210('0x4c')][_0x9210('0x109')](db[_0x9210('0x178')],{'as':_0x9210('0x142')});db[_0x9210('0x4c')]['hasMany'](db[_0x9210('0x10f')],{'as':_0x9210('0x179'),'onDelete':_0x9210('0x108')});db[_0x9210('0x4c')][_0x9210('0x109')](db[_0x9210('0x4f')],{'as':_0x9210('0x155')});db['FaxAccount'][_0x9210('0x149')](db['Trunk'],{'as':'Trunk'});db[_0x9210('0x4c')][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':_0x9210('0x163'),'foreignKey':_0x9210('0x17a')});db['FaxAccount'][_0x9210('0x149')](db[_0x9210('0x81')],{'as':_0x9210('0x14e'),'foreignKey':_0x9210('0x14f')});db[_0x9210('0x4c')][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':'user_has_fax_accounts'});db[_0x9210('0x178')][_0x9210('0x149')](db[_0x9210('0x12')],{'onDelete':_0x9210('0x171')});db[_0x9210('0x178')]['belongsTo'](db[_0x9210('0x51')],{'onDelete':_0x9210('0x171')});db[_0x9210('0x178')][_0x9210('0x149')](db[_0x9210('0x4c')],{'onDelete':_0x9210('0x171')});db[_0x9210('0x178')][_0x9210('0x149')](db[_0x9210('0x88')],{'onDelete':_0x9210('0x171'),'foreignKey':_0x9210('0x172')});db[_0x9210('0x4e')][_0x9210('0x109')](db['FaxMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x9210('0x17b')});db[_0x9210('0x4e')]['belongsTo'](db[_0x9210('0x4c')],{'as':_0x9210('0x168'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x9210('0x149')](db[_0x9210('0x15b')],{'as':_0x9210('0x15c'),'foreignKey':_0x9210('0x169')});db[_0x9210('0x4e')][_0x9210('0x149')](db[_0x9210('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0x9210('0x4e')][_0x9210('0x11b')](db[_0x9210('0x88')],{'through':'fax_interaction_has_tags','as':'Tags'});db['FaxInteraction'][_0x9210('0x11b')](db[_0x9210('0x88')],{'through':_0x9210('0x17c'),'as':'ThroughTags'});db['FaxInteraction']['belongsToMany'](db['User'],{'as':_0x9210('0x16e'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0x9210('0x4f')][_0x9210('0x149')](db[_0x9210('0x12')],{'onDelete':'cascade','as':_0x9210('0x12')});db[_0x9210('0x4f')][_0x9210('0x149')](db[_0x9210('0x4e')],{'as':_0x9210('0x16f'),'foreignKey':_0x9210('0x17b')});db[_0x9210('0x4f')]['belongsTo'](db[_0x9210('0x15b')],{'onDelete':_0x9210('0x108'),'as':_0x9210('0x15c')});db[_0x9210('0x4f')][_0x9210('0x149')](db['Attachment'],{'as':_0x9210('0xe4'),'foreignKey':'AttachmentId'});db[_0x9210('0x4f')][_0x9210('0x149')](db[_0x9210('0x4c')],{'as':'Account','foreignKey':_0x9210('0x176')});db['FaxQueue'][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':'UserFaxQueue'});db['FaxQueue'][_0x9210('0x11b')](db[_0x9210('0xdd')],{'through':_0x9210('0x17d'),'as':_0x9210('0x152')});db['FaxQueueReport']['belongsTo'](db['FaxAccount'],{});db[_0x9210('0x53')][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':_0x9210('0x163'),'foreignKey':_0x9210('0x17a')});db['FaxQueueReport'][_0x9210('0x149')](db[_0x9210('0x15b')],{'as':_0x9210('0x15c'),'foreignKey':_0x9210('0x169')});db['FaxQueueReport'][_0x9210('0x149')](db['FaxInteraction'],{});db[_0x9210('0x53')][_0x9210('0x149')](db[_0x9210('0x4f')],{});db[_0x9210('0x53')][_0x9210('0x149')](db[_0x9210('0x12')],{});db[_0x9210('0x53')][_0x9210('0x149')](db[_0x9210('0x51')],{});db[_0x9210('0x54')][_0x9210('0x109')](db[_0x9210('0x7c')],{'as':_0x9210('0x161'),'foreignKey':_0x9210('0x17e'),'onDelete':_0x9210('0x108')});db[_0x9210('0x54')][_0x9210('0x109')](db[_0x9210('0x7a')],{'as':_0x9210('0x162'),'foreignKey':_0x9210('0x17e')});db[_0x9210('0x54')][_0x9210('0x109')](db[_0x9210('0x17f')],{'as':_0x9210('0x155'),'foreignKey':_0x9210('0x17e')});db[_0x9210('0x54')][_0x9210('0x109')](db[_0x9210('0x55')],{'as':'Interactions'});db[_0x9210('0x54')][_0x9210('0x109')](db['SmsApplication'],{'as':_0x9210('0x142')});db[_0x9210('0x54')][_0x9210('0x149')](db['CmList'],{'as':_0x9210('0x163'),'foreignKey':_0x9210('0x17a')});db[_0x9210('0x54')][_0x9210('0x149')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9210('0x14f')});db['SmsAccount'][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':_0x9210('0x13a')});db[_0x9210('0x180')][_0x9210('0x149')](db[_0x9210('0x12')],{'onDelete':_0x9210('0x171')});db[_0x9210('0x180')][_0x9210('0x149')](db['SmsQueue'],{'onDelete':_0x9210('0x171')});db[_0x9210('0x180')][_0x9210('0x149')](db[_0x9210('0x54')],{'onDelete':_0x9210('0x171')});db[_0x9210('0x180')][_0x9210('0x149')](db[_0x9210('0x7f')],{'onDelete':_0x9210('0x171'),'foreignKey':_0x9210('0x14d')});db[_0x9210('0x180')]['belongsTo'](db[_0x9210('0x88')],{'onDelete':_0x9210('0x171'),'foreignKey':_0x9210('0x172')});db['SmsInteraction'][_0x9210('0x109')](db[_0x9210('0x17f')],{'as':_0x9210('0x155'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x181')});db['SmsInteraction'][_0x9210('0x149')](db[_0x9210('0x54')],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x17e')});db[_0x9210('0x55')]['belongsTo'](db['CmContact'],{'as':_0x9210('0x15c'),'foreignKey':_0x9210('0x169')});db[_0x9210('0x55')][_0x9210('0x149')](db['User'],{'as':_0x9210('0x16a'),'foreignKey':_0x9210('0x10c')});db[_0x9210('0x55')]['belongsToMany'](db['Tag'],{'through':_0x9210('0x182'),'as':_0x9210('0x16c')});db[_0x9210('0x55')][_0x9210('0x11b')](db[_0x9210('0x88')],{'through':_0x9210('0x182'),'as':_0x9210('0x16d')});db[_0x9210('0x55')][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x16e'),'through':_0x9210('0x183'),'foreignKey':_0x9210('0x181')});db[_0x9210('0x17f')][_0x9210('0x149')](db[_0x9210('0x12')],{'as':_0x9210('0x12')});db[_0x9210('0x17f')]['belongsTo'](db[_0x9210('0x15b')],{'onDelete':'cascade','as':_0x9210('0x15c')});db['SmsMessage'][_0x9210('0x149')](db[_0x9210('0x55')],{'onDelete':_0x9210('0x108'),'as':_0x9210('0x16f'),'foreignKey':_0x9210('0x181')});db[_0x9210('0x17f')][_0x9210('0x149')](db[_0x9210('0x54')],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x17e')});db[_0x9210('0x12f')][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':'UserSmsQueue','foreignKey':_0x9210('0x184')});db[_0x9210('0x12f')][_0x9210('0x11b')](db[_0x9210('0xdd')],{'through':_0x9210('0x185'),'as':'Teams'});db['OpenchannelAccount'][_0x9210('0x109')](db[_0x9210('0x7c')],{'as':_0x9210('0x161'),'foreignKey':_0x9210('0x186'),'onDelete':_0x9210('0x108')});db[_0x9210('0x57')][_0x9210('0x109')](db['CannedAnswer'],{'as':_0x9210('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0x9210('0x57')][_0x9210('0x109')](db[_0x9210('0x5b')],{'as':_0x9210('0x177'),'foreignKey':_0x9210('0x186')});db[_0x9210('0x57')][_0x9210('0x109')](db[_0x9210('0x5d')],{'as':_0x9210('0x155'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x9210('0x109')](db[_0x9210('0x59')],{'as':_0x9210('0x142'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':_0x9210('0x163'),'foreignKey':_0x9210('0x17a')});db['OpenchannelAccount'][_0x9210('0x149')](db[_0x9210('0x81')],{'as':_0x9210('0x14e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9210('0x57')][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':_0x9210('0x138')});db[_0x9210('0x59')]['belongsTo'](db['User'],{'onDelete':_0x9210('0x171')});db['OpenchannelApplication']['belongsTo'](db[_0x9210('0x5f')],{'onDelete':'restrict','foreignKey':_0x9210('0x187')});db[_0x9210('0x59')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x9210('0x186')});db[_0x9210('0x59')][_0x9210('0x149')](db['Interval'],{'onDelete':_0x9210('0x171'),'foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x9210('0x149')](db[_0x9210('0x88')],{'onDelete':'restrict','foreignKey':_0x9210('0x172')});db[_0x9210('0x5b')][_0x9210('0x109')](db[_0x9210('0x5d')],{'as':_0x9210('0x155'),'onDelete':_0x9210('0x108'),'foreignKey':'OpenchannelInteractionId'});db[_0x9210('0x5b')][_0x9210('0x149')](db[_0x9210('0x57')],{'as':'Account','foreignKey':_0x9210('0x186')});db[_0x9210('0x5b')]['belongsTo'](db['CmContact'],{'as':_0x9210('0x15c'),'foreignKey':'ContactId'});db[_0x9210('0x5b')]['belongsTo'](db[_0x9210('0x12')],{'as':'Owner','foreignKey':_0x9210('0x10c')});db[_0x9210('0x5b')][_0x9210('0x11b')](db[_0x9210('0x88')],{'through':_0x9210('0x188'),'as':_0x9210('0x16c')});db[_0x9210('0x5b')][_0x9210('0x11b')](db[_0x9210('0x88')],{'through':'openchannel_interaction_has_tags','as':_0x9210('0x16d')});db[_0x9210('0x5b')]['belongsToMany'](db['User'],{'as':_0x9210('0x16e'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x9210('0x5d')][_0x9210('0x149')](db[_0x9210('0x12')],{'onDelete':_0x9210('0x108'),'as':'User'});db[_0x9210('0x5d')][_0x9210('0x149')](db['CmContact'],{'onDelete':_0x9210('0x108'),'as':_0x9210('0x15c')});db[_0x9210('0x5d')]['belongsTo'](db[_0x9210('0x5b')],{'onDelete':_0x9210('0x108'),'as':_0x9210('0x16f'),'foreignKey':_0x9210('0x189')});db[_0x9210('0x5d')][_0x9210('0x149')](db[_0x9210('0xe4')],{'as':_0x9210('0xe4'),'foreignKey':_0x9210('0x18a')});db[_0x9210('0x5d')][_0x9210('0x149')](db[_0x9210('0x57')],{'as':'Account','foreignKey':_0x9210('0x186')});db[_0x9210('0x5f')]['belongsToMany'](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':_0x9210('0x36'),'foreignKey':_0x9210('0x187')});db[_0x9210('0x5f')][_0x9210('0x11b')](db['Team'],{'through':_0x9210('0x18b'),'as':_0x9210('0x152')});db[_0x9210('0x61')][_0x9210('0x109')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x9210('0x170'),'onDelete':_0x9210('0x108')});db[_0x9210('0x61')][_0x9210('0x109')](db[_0x9210('0x7a')],{'as':_0x9210('0x162'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x9210('0x109')](db[_0x9210('0x18c')],{'as':'ProactiveActions'});db[_0x9210('0x61')]['hasMany'](db['ChatInteraction'],{'as':'Interactions'});db[_0x9210('0x61')]['hasMany'](db[_0x9210('0x65')],{'as':_0x9210('0x142')});db[_0x9210('0x61')][_0x9210('0x109')](db[_0x9210('0x69')],{'as':_0x9210('0x155')});db[_0x9210('0x61')][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':_0x9210('0x163'),'foreignKey':'ListId'});db[_0x9210('0x61')][_0x9210('0x149')](db[_0x9210('0x7f')],{'as':_0x9210('0x7f'),'foreignKey':'IntervalId'});db['ChatWebsite'][_0x9210('0x149')](db['MailAccount'],{'as':_0x9210('0x3e'),'foreignKey':_0x9210('0x15d')});db[_0x9210('0x61')][_0x9210('0x149')](db[_0x9210('0x81')],{'as':_0x9210('0x14e'),'foreignKey':_0x9210('0x14f')});db[_0x9210('0x61')][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':_0x9210('0x18d')});db[_0x9210('0x63')][_0x9210('0x149')](db['OpenchannelAccount'],{});db[_0x9210('0x63')][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':_0x9210('0x163'),'foreignKey':_0x9210('0x17a')});db['OpenchannelQueueReport']['belongsTo'](db['CmContact'],{'as':_0x9210('0x15c'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0x9210('0x149')](db[_0x9210('0x5b')],{});db[_0x9210('0x63')][_0x9210('0x149')](db[_0x9210('0x5d')],{});db[_0x9210('0x63')]['belongsTo'](db['User'],{});db[_0x9210('0x63')][_0x9210('0x149')](db['OpenchannelQueue'],{});db['ChatApplication'][_0x9210('0x149')](db[_0x9210('0x12')],{'as':'Agent','foreignKey':_0x9210('0x10c'),'onDelete':_0x9210('0x171')});db[_0x9210('0x65')][_0x9210('0x149')](db[_0x9210('0x6c')],{'as':_0x9210('0x18e'),'foreignKey':_0x9210('0x18f'),'onDelete':_0x9210('0x171')});db[_0x9210('0x65')]['belongsTo'](db['ChatWebsite'],{'as':_0x9210('0x190'),'foreignKey':_0x9210('0x170'),'onDelete':_0x9210('0x171')});db[_0x9210('0x65')][_0x9210('0x149')](db['Tag'],{'onDelete':_0x9210('0x171'),'foreignKey':_0x9210('0x172')});db['ChatInteraction'][_0x9210('0x109')](db[_0x9210('0x69')],{'as':_0x9210('0x155'),'onDelete':'cascade','foreignKey':_0x9210('0x191')});db[_0x9210('0x67')][_0x9210('0x149')](db['ChatWebsite'],{'as':_0x9210('0x168'),'foreignKey':'ChatWebsiteId'});db[_0x9210('0x67')]['belongsTo'](db[_0x9210('0x15b')],{'as':_0x9210('0x15c'),'foreignKey':'ContactId'});db[_0x9210('0x67')][_0x9210('0x149')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x9210('0x67')][_0x9210('0x11b')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x9210('0x16c')});db['ChatInteraction'][_0x9210('0x11b')](db[_0x9210('0x88')],{'through':_0x9210('0x192'),'as':_0x9210('0x16d')});db['ChatInteraction'][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x16e'),'through':_0x9210('0x124'),'foreignKey':_0x9210('0x191')});db['ChatMessage'][_0x9210('0x149')](db['User'],{'onDelete':'cascade','as':_0x9210('0x12')});db[_0x9210('0x69')]['belongsTo'](db[_0x9210('0x15b')],{'onDelete':_0x9210('0x108'),'as':_0x9210('0x15c'),'foreignKey':_0x9210('0x169')});db[_0x9210('0x69')][_0x9210('0x149')](db[_0x9210('0x67')],{'onDelete':_0x9210('0x108'),'as':'Interaction','foreignKey':_0x9210('0x191')});db[_0x9210('0x69')]['belongsTo'](db['Attachment'],{'as':_0x9210('0xe4'),'foreignKey':_0x9210('0x18a')});db['ChatMessage'][_0x9210('0x149')](db['ChatWebsite'],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x170')});db[_0x9210('0x6a')]['hasMany'](db[_0x9210('0xe4')],{'as':_0x9210('0x193'),'foreignKey':_0x9210('0x194'),'onDelete':_0x9210('0x108'),'hooks':!![]});db[_0x9210('0x6a')]['belongsTo'](db[_0x9210('0x15b')],{'onDelete':_0x9210('0x108'),'as':_0x9210('0x15c'),'foreignKey':_0x9210('0x169')});db[_0x9210('0x6a')][_0x9210('0x149')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x9210('0x170')});db['ChatQueue']['belongsToMany'](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':_0x9210('0x30'),'hooks':!![]});db[_0x9210('0x6c')][_0x9210('0x11b')](db[_0x9210('0xdd')],{'through':_0x9210('0x195'),'as':_0x9210('0x152')});db[_0x9210('0x11c')][_0x9210('0x109')](db[_0x9210('0x196')],{'as':_0x9210('0x155'),'foreignKey':_0x9210('0x197'),'onDelete':_0x9210('0x108')});db[_0x9210('0x11c')][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x144'),'through':_0x9210('0x11d')});db[_0x9210('0x18c')][_0x9210('0x149')](db['ChatWebsite'],{'as':_0x9210('0x190'),'foreignKey':_0x9210('0x170')});db['CmCompany'][_0x9210('0x109')](db['CmContact'],{'as':_0x9210('0x11e'),'foreignKey':_0x9210('0x198')});db[_0x9210('0x15b')][_0x9210('0x109')](db[_0x9210('0x71')],{'as':_0x9210('0x146'),'foreignKey':_0x9210('0x169')});db[_0x9210('0x15b')]['hasMany'](db[_0x9210('0x111')],{'as':'HopperFinals','foreignKey':_0x9210('0x169')});db[_0x9210('0x15b')]['hasMany'](db[_0x9210('0x113')],{'as':_0x9210('0x147'),'foreignKey':'ContactId'});db[_0x9210('0x15b')][_0x9210('0x109')](db[_0x9210('0x75')],{'as':_0x9210('0x75'),'foreignKey':_0x9210('0x169')});db[_0x9210('0x15b')][_0x9210('0x109')](db[_0x9210('0xcc')],{'as':_0x9210('0x148'),'foreignKey':_0x9210('0x169')});db[_0x9210('0x15b')]['hasMany'](db[_0x9210('0x5b')],{'as':_0x9210('0x115'),'foreignKey':_0x9210('0x169'),'onDelete':_0x9210('0x171')});db['CmContact']['hasMany'](db[_0x9210('0x67')],{'as':_0x9210('0x199'),'foreignKey':'ContactId','onDelete':_0x9210('0x171')});db[_0x9210('0x15b')][_0x9210('0x109')](db[_0x9210('0x55')],{'as':_0x9210('0x127'),'foreignKey':'ContactId','onDelete':_0x9210('0x171')});db[_0x9210('0x15b')]['hasMany'](db[_0x9210('0x4e')],{'as':_0x9210('0x125'),'foreignKey':_0x9210('0x169'),'onDelete':_0x9210('0x171')});db['CmContact'][_0x9210('0x109')](db[_0x9210('0x116')],{'as':_0x9210('0x117'),'foreignKey':_0x9210('0x169'),'onDelete':_0x9210('0x171')});db[_0x9210('0x15b')][_0x9210('0x149')](db[_0x9210('0x6e')],{'as':_0x9210('0x19a'),'foreignKey':'CompanyId'});db['CmContact'][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':_0x9210('0x163'),'foreignKey':_0x9210('0x17a'),'onDelete':_0x9210('0x108')});db[_0x9210('0x15b')]['belongsToMany'](db[_0x9210('0x12')],{'as':_0x9210('0x16e'),'through':_0x9210('0x11f')});db[_0x9210('0x15b')][_0x9210('0x11b')](db[_0x9210('0x88')],{'as':_0x9210('0x16c'),'through':_0x9210('0x19b')});db[_0x9210('0x15b')]['belongsToMany'](db['Tag'],{'through':_0x9210('0x19b'),'as':_0x9210('0x16d')});db['CmHopper']['belongsTo'](db[_0x9210('0x15b')],{'as':_0x9210('0x15c'),'foreignKey':_0x9210('0x169'),'onDelete':_0x9210('0x108')});db[_0x9210('0x71')][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':_0x9210('0x163'),'foreignKey':_0x9210('0x17a'),'onDelete':_0x9210('0x108')});db[_0x9210('0x71')][_0x9210('0x149')](db[_0x9210('0x12')],{'as':_0x9210('0x19c'),'foreignKey':_0x9210('0x10c')});db[_0x9210('0x71')][_0x9210('0x149')](db['VoiceQueue'],{'as':_0x9210('0x18e'),'foreignKey':_0x9210('0x145'),'onDelete':_0x9210('0x108')});db[_0x9210('0x71')][_0x9210('0x149')](db[_0x9210('0xe0')],{'as':_0x9210('0xe0'),'foreignKey':_0x9210('0x19d'),'onDelete':_0x9210('0x108')});db[_0x9210('0x71')][_0x9210('0x149')](db['User'],{'as':_0x9210('0x16a'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0x9210('0x149')](db[_0x9210('0x15b')],{'as':_0x9210('0x15c'),'foreignKey':_0x9210('0x169'),'onDelete':'cascade'});db[_0x9210('0x72')][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':'List','foreignKey':'ListId','onDelete':_0x9210('0x108')});db['CmHopperBlack'][_0x9210('0x149')](db[_0x9210('0x19')],{'as':'Queue','foreignKey':_0x9210('0x145'),'onDelete':_0x9210('0x108')});db[_0x9210('0x72')][_0x9210('0x149')](db[_0x9210('0xe0')],{'as':_0x9210('0xe0'),'foreignKey':'CampaignId','onDelete':_0x9210('0x108')});db['Automation']['hasMany'](db[_0x9210('0x7d')],{'as':{'plural':'All','singular':_0x9210('0x19e')},'foreignKey':_0x9210('0x19f'),'onDelete':_0x9210('0x108'),'hooks':!![]});db[_0x9210('0x79')]['hasMany'](db[_0x9210('0x7d')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x9210('0x108'),'hooks':!![]});db['Automation']['hasMany'](db[_0x9210('0x78')],{'as':'Actions','foreignKey':_0x9210('0x1a0'),'onDelete':_0x9210('0x108'),'hooks':!![]});db[_0x9210('0x7c')][_0x9210('0x109')](db[_0x9210('0x7c')],{'as':'Dispositions','foreignKey':_0x9210('0x1a1'),'onDelete':_0x9210('0x108')});db[_0x9210('0x7f')][_0x9210('0x109')](db[_0x9210('0x7f')],{'as':_0x9210('0x1a2'),'foreignKey':_0x9210('0x14d'),'onDelete':_0x9210('0x108'),'hooks':!![],'required':![]});db['Interval'][_0x9210('0x109')](db[_0x9210('0x10f')],{'as':_0x9210('0x110'),'foreignKey':_0x9210('0x14d'),'onDelete':_0x9210('0x171')});db['Interval'][_0x9210('0x109')](db[_0x9210('0x47')],{'as':'MailApplications','foreignKey':_0x9210('0x14d')});db[_0x9210('0x7f')][_0x9210('0x109')](db[_0x9210('0x65')],{'as':_0x9210('0x1a3'),'foreignKey':_0x9210('0x14d')});db[_0x9210('0x7f')]['hasMany'](db[_0x9210('0x178')],{'as':_0x9210('0x1a4'),'foreignKey':'IntervalId'});db[_0x9210('0x7f')][_0x9210('0x109')](db[_0x9210('0x180')],{'as':'SmsApplications','foreignKey':_0x9210('0x14d')});db[_0x9210('0x84')][_0x9210('0x149')](db[_0x9210('0x3e')],{});db[_0x9210('0x84')][_0x9210('0x149')](db['AnalyticDefaultReport'],{'foreignKey':_0x9210('0x1a5')});db[_0x9210('0x84')][_0x9210('0x149')](db['AnalyticCustomReport'],{'foreignKey':_0x9210('0x1a6')});db[_0x9210('0x86')][_0x9210('0x11b')](db['VoiceMusicOnHold'],{'as':_0x9210('0x1a7'),'through':_0x9210('0x143'),'onDelete':_0x9210('0x171')});db[_0x9210('0x88')][_0x9210('0x11b')](db['CmContact'],{'through':_0x9210('0x19b')});db[_0x9210('0x88')][_0x9210('0x11b')](db[_0x9210('0x67')],{'through':'chat_interaction_has_tags'});db[_0x9210('0x88')][_0x9210('0x11b')](db[_0x9210('0x116')],{'through':_0x9210('0x16b')});db[_0x9210('0x88')][_0x9210('0x11b')](db[_0x9210('0x55')],{'through':_0x9210('0x182')});db['Tag'][_0x9210('0x11b')](db[_0x9210('0x4e')],{'through':'fax_interaction_has_tags'});db[_0x9210('0x88')][_0x9210('0x11b')](db[_0x9210('0x5b')],{'through':_0x9210('0x188')});db[_0x9210('0x88')][_0x9210('0x11b')](db[_0x9210('0xfb')],{'through':_0x9210('0x1a8')});db[_0x9210('0x1a9')]['hasMany'](db[_0x9210('0x7d')],{'as':{'plural':_0x9210('0x1aa'),'singular':'AllCondition'},'foreignKey':_0x9210('0x1ab'),'onDelete':_0x9210('0x108'),'hooks':!![]});db['Trigger'][_0x9210('0x109')](db[_0x9210('0x7d')],{'as':{'plural':_0x9210('0x1ac'),'singular':_0x9210('0x1ad')},'foreignKey':_0x9210('0x1ae'),'onDelete':_0x9210('0x108'),'hooks':!![]});db[_0x9210('0x1a9')]['hasMany'](db[_0x9210('0x78')],{'as':'Actions','foreignKey':_0x9210('0x1af'),'onDelete':_0x9210('0x108'),'hooks':!![]});db[_0x9210('0x1b0')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x9210('0x1b1'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1a6'),'hooks':!![]});db[_0x9210('0x91')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1a5')});db[_0x9210('0x1b2')]['hasMany'](db[_0x9210('0x94')],{'as':_0x9210('0x1b1'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b3')});db[_0x9210('0x94')]['belongsTo'](db[_0x9210('0x1b2')],{'foreignKey':_0x9210('0x1b3')});db[_0x9210('0x98')][_0x9210('0x109')](db[_0x9210('0x9a')],{'as':_0x9210('0x1b4'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b5')});db['SalesforceConfiguration'][_0x9210('0x109')](db[_0x9210('0x9c')],{'as':_0x9210('0x1b6'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b7')});db[_0x9210('0x9a')][_0x9210('0x109')](db[_0x9210('0x9c')],{'as':_0x9210('0x1b8'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b9')});db[_0x9210('0x9a')][_0x9210('0x109')](db[_0x9210('0x9c')],{'as':_0x9210('0x1b1'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x9210('0x9a')][_0x9210('0x149')](db['SalesforceAccount'],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x1b5')});db[_0x9210('0x9c')]['hasMany'](db['SalesforceField'],{'as':_0x9210('0x1ba'),'foreignKey':_0x9210('0x1b7')});db[_0x9210('0x9c')]['hasMany'](db[_0x9210('0x9c')],{'as':'Description','foreignKey':_0x9210('0x1b9')});db['SalesforceField'][_0x9210('0x109')](db[_0x9210('0x9c')],{'as':_0x9210('0x1bb'),'foreignKey':_0x9210('0x1bc')});db['SalesforceField'][_0x9210('0x149')](db[_0x9210('0x8b')],{'as':'Variable','foreignKey':'VariableId'});db[_0x9210('0x9e')][_0x9210('0x109')](db[_0x9210('0x1bd')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0x9210('0x109')](db['SugarcrmField'],{'as':_0x9210('0x1b6'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b7')});db['SugarcrmConfiguration'][_0x9210('0x109')](db['SugarcrmField'],{'as':_0x9210('0x1b8'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b9')});db[_0x9210('0x1bd')][_0x9210('0x109')](db[_0x9210('0x1be')],{'as':_0x9210('0x1b1'),'onDelete':_0x9210('0x108'),'foreignKey':'FieldId'});db[_0x9210('0x1bd')]['belongsTo'](db[_0x9210('0x9e')],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x1b5')});db[_0x9210('0x1be')][_0x9210('0x109')](db[_0x9210('0x1be')],{'as':_0x9210('0x1ba'),'foreignKey':'SubjectId'});db['SugarcrmField']['hasMany'](db[_0x9210('0x1be')],{'as':'Description','foreignKey':_0x9210('0x1b9')});db[_0x9210('0x1be')][_0x9210('0x109')](db[_0x9210('0x1be')],{'as':'Field','foreignKey':'FieldId'});db[_0x9210('0x1be')][_0x9210('0x149')](db[_0x9210('0x8b')],{'as':_0x9210('0x8b'),'foreignKey':'VariableId'});db[_0x9210('0xa0')][_0x9210('0x109')](db[_0x9210('0xa2')],{'as':_0x9210('0x1b4'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b5')});db['DeskConfiguration'][_0x9210('0x109')](db[_0x9210('0xa4')],{'as':_0x9210('0x1b6'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b7')});db['DeskConfiguration'][_0x9210('0x109')](db['DeskField'],{'as':_0x9210('0x1b8'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b9')});db[_0x9210('0xa2')][_0x9210('0x109')](db['DeskField'],{'as':_0x9210('0x1b1'),'onDelete':_0x9210('0x108'),'foreignKey':'FieldId'});db['DeskConfiguration']['belongsTo'](db[_0x9210('0xa0')],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x1b5')});db[_0x9210('0xa2')][_0x9210('0x11b')](db['Tag'],{'through':_0x9210('0x1bf')});db[_0x9210('0xa4')][_0x9210('0x109')](db[_0x9210('0xa4')],{'as':'Subject','foreignKey':'SubjectId'});db['DeskField'][_0x9210('0x109')](db['DeskField'],{'as':_0x9210('0x1c0'),'foreignKey':'DescriptionId'});db[_0x9210('0xa4')][_0x9210('0x109')](db[_0x9210('0xa4')],{'as':'Field','foreignKey':_0x9210('0x1bc')});db[_0x9210('0xa4')][_0x9210('0x149')](db['Variable'],{'as':_0x9210('0x8b'),'foreignKey':_0x9210('0x1c1')});db[_0x9210('0xa6')]['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x9210('0x1b5')});db['ZohoConfiguration']['hasMany'](db[_0x9210('0x1c2')],{'as':_0x9210('0x1b6'),'onDelete':'cascade','foreignKey':_0x9210('0x1b7')});db['ZohoConfiguration']['hasMany'](db[_0x9210('0x1c2')],{'as':_0x9210('0x1b8'),'onDelete':_0x9210('0x108'),'foreignKey':'DescriptionId'});db[_0x9210('0x1c3')][_0x9210('0x109')](db[_0x9210('0x1c2')],{'as':'Fields','onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1bc')});db['ZohoConfiguration']['belongsTo'](db['ZohoAccount'],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x1b5')});db[_0x9210('0x1c2')][_0x9210('0x109')](db[_0x9210('0x1c2')],{'as':_0x9210('0x1ba'),'foreignKey':_0x9210('0x1b7')});db[_0x9210('0x1c2')][_0x9210('0x109')](db[_0x9210('0x1c2')],{'as':_0x9210('0x1c0'),'foreignKey':'DescriptionId'});db[_0x9210('0x1c2')][_0x9210('0x109')](db[_0x9210('0x1c2')],{'as':'Field','foreignKey':_0x9210('0x1bc')});db[_0x9210('0x1c2')][_0x9210('0x149')](db[_0x9210('0x8b')],{'as':_0x9210('0x8b'),'foreignKey':_0x9210('0x1c1')});db['ZendeskAccount'][_0x9210('0x109')](db[_0x9210('0xaa')],{'as':_0x9210('0x1b4'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b5')});db['ZendeskConfiguration'][_0x9210('0x109')](db[_0x9210('0xac')],{'as':_0x9210('0x1b6'),'foreignKey':_0x9210('0x1b7')});db[_0x9210('0xaa')][_0x9210('0x109')](db['ZendeskField'],{'as':_0x9210('0x1b8'),'foreignKey':_0x9210('0x1b9')});db[_0x9210('0xaa')]['hasMany'](db[_0x9210('0xac')],{'as':_0x9210('0x1b1'),'foreignKey':_0x9210('0x1bc')});db[_0x9210('0xaa')][_0x9210('0x149')](db[_0x9210('0x1c4')],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x1b5')});db[_0x9210('0xaa')][_0x9210('0x11b')](db[_0x9210('0x88')],{'through':_0x9210('0x1c5')});db[_0x9210('0xac')][_0x9210('0x109')](db[_0x9210('0xac')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9210('0xac')][_0x9210('0x109')](db['ZendeskField'],{'as':_0x9210('0x1c0'),'foreignKey':_0x9210('0x1b9')});db[_0x9210('0xac')][_0x9210('0x109')](db[_0x9210('0xac')],{'as':'Field','foreignKey':'FieldId'});db[_0x9210('0xac')][_0x9210('0x149')](db[_0x9210('0x8b')],{'as':_0x9210('0x8b'),'foreignKey':_0x9210('0x1c1')});db[_0x9210('0xad')][_0x9210('0x109')](db[_0x9210('0xaf')],{'as':_0x9210('0x1b4'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b5')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0x9210('0x1b6'),'onDelete':'cascade','foreignKey':_0x9210('0x1b7')});db['FreshdeskConfiguration'][_0x9210('0x109')](db[_0x9210('0xb1')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x9210('0x1b9')});db['FreshdeskConfiguration'][_0x9210('0x109')](db[_0x9210('0xb1')],{'as':'Fields','onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1bc')});db[_0x9210('0xaf')][_0x9210('0x149')](db[_0x9210('0xad')],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x1b5')});db[_0x9210('0xaf')][_0x9210('0x11b')](db[_0x9210('0x88')],{'through':_0x9210('0x1c6')});db[_0x9210('0xb1')][_0x9210('0x109')](db['FreshdeskField'],{'as':_0x9210('0x1ba'),'foreignKey':_0x9210('0x1b7')});db[_0x9210('0xb1')][_0x9210('0x109')](db[_0x9210('0xb1')],{'as':_0x9210('0x1c0'),'foreignKey':'DescriptionId'});db[_0x9210('0xb1')][_0x9210('0x109')](db[_0x9210('0xb1')],{'as':_0x9210('0x1bb'),'foreignKey':_0x9210('0x1bc')});db['FreshdeskField'][_0x9210('0x149')](db[_0x9210('0x8b')],{'as':'Variable','foreignKey':_0x9210('0x1c1')});db[_0x9210('0x1c7')][_0x9210('0x109')](db[_0x9210('0xb4')],{'as':_0x9210('0x1b4'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b5')});db[_0x9210('0xb4')][_0x9210('0x109')](db['VtigerField'],{'as':_0x9210('0x1b6'),'foreignKey':_0x9210('0x1b7')});db[_0x9210('0xb4')][_0x9210('0x109')](db[_0x9210('0xb6')],{'as':'Descriptions','foreignKey':_0x9210('0x1b9')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':'Fields','foreignKey':_0x9210('0x1bc')});db[_0x9210('0xb4')][_0x9210('0x149')](db['VtigerAccount'],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x1b5')});db[_0x9210('0xb6')][_0x9210('0x109')](db['VtigerField'],{'as':'Subject','foreignKey':_0x9210('0x1b7')});db[_0x9210('0xb6')]['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':_0x9210('0x1b9')});db[_0x9210('0xb6')][_0x9210('0x109')](db[_0x9210('0xb6')],{'as':_0x9210('0x1bb'),'foreignKey':_0x9210('0x1bc')});db[_0x9210('0xb6')][_0x9210('0x149')](db[_0x9210('0x8b')],{'as':_0x9210('0x8b'),'foreignKey':_0x9210('0x1c1')});db[_0x9210('0x1c8')][_0x9210('0x109')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b5')});db[_0x9210('0xb9')]['hasMany'](db['ServicenowField'],{'as':'Subjects','foreignKey':_0x9210('0x1b7')});db['ServicenowConfiguration'][_0x9210('0x109')](db[_0x9210('0xbb')],{'as':_0x9210('0x1b8'),'foreignKey':_0x9210('0x1b9')});db[_0x9210('0xb9')][_0x9210('0x109')](db[_0x9210('0xbb')],{'as':'Fields','foreignKey':'FieldId'});db[_0x9210('0xb9')][_0x9210('0x149')](db[_0x9210('0x1c8')],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x1b5')});db['ServicenowField'][_0x9210('0x109')](db[_0x9210('0xbb')],{'as':_0x9210('0x1ba'),'foreignKey':_0x9210('0x1b7')});db['ServicenowField']['hasMany'](db[_0x9210('0xbb')],{'as':_0x9210('0x1c0'),'foreignKey':_0x9210('0x1b9')});db[_0x9210('0xbb')][_0x9210('0x109')](db[_0x9210('0xbb')],{'as':'Field','foreignKey':_0x9210('0x1bc')});db[_0x9210('0xbb')][_0x9210('0x149')](db['Variable'],{'as':_0x9210('0x8b'),'foreignKey':'VariableId'});db['Dynamics365Account']['hasMany'](db['Dynamics365Configuration'],{'as':_0x9210('0x1b4'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b5')});db['Dynamics365Configuration']['hasMany'](db[_0x9210('0xc1')],{'as':_0x9210('0x1b6'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b7')});db[_0x9210('0xbf')][_0x9210('0x109')](db[_0x9210('0xc1')],{'as':_0x9210('0x1b8'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b9')});db[_0x9210('0xbf')][_0x9210('0x109')](db['Dynamics365Field'],{'as':_0x9210('0x1b1'),'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1bc')});db[_0x9210('0xbf')][_0x9210('0x149')](db['Dynamics365Account'],{'as':_0x9210('0x168'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0x9210('0x109')](db[_0x9210('0xc1')],{'as':_0x9210('0x1ba'),'foreignKey':_0x9210('0x1b7')});db[_0x9210('0xc1')]['hasMany'](db['Dynamics365Field'],{'as':_0x9210('0x1c0'),'foreignKey':_0x9210('0x1b9')});db[_0x9210('0xc1')][_0x9210('0x109')](db[_0x9210('0xc1')],{'as':_0x9210('0x1bb'),'foreignKey':_0x9210('0x1bc')});db[_0x9210('0xc1')]['belongsTo'](db[_0x9210('0x8b')],{'as':'Variable','foreignKey':_0x9210('0x1c1')});db[_0x9210('0xc2')][_0x9210('0x109')](db[_0x9210('0x1c9')],{'as':'Configurations','onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1b5')});db[_0x9210('0x1c9')][_0x9210('0x109')](db['FreshsalesField'],{'as':_0x9210('0x1b6'),'foreignKey':_0x9210('0x1b7')});db['FreshsalesConfiguration'][_0x9210('0x109')](db[_0x9210('0x1ca')],{'as':_0x9210('0x1b8'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db[_0x9210('0x1ca')],{'as':_0x9210('0x1b1'),'foreignKey':_0x9210('0x1bc')});db['FreshsalesConfiguration'][_0x9210('0x149')](db[_0x9210('0xc2')],{'as':'Account','foreignKey':_0x9210('0x1b5')});db[_0x9210('0x1ca')][_0x9210('0x109')](db[_0x9210('0x1ca')],{'as':_0x9210('0x1ba'),'foreignKey':_0x9210('0x1b7')});db['FreshsalesField'][_0x9210('0x109')](db[_0x9210('0x1ca')],{'as':_0x9210('0x1c0'),'foreignKey':_0x9210('0x1b9')});db[_0x9210('0x1ca')][_0x9210('0x109')](db[_0x9210('0x1ca')],{'as':_0x9210('0x1bb'),'foreignKey':_0x9210('0x1bc')});db[_0x9210('0x1ca')][_0x9210('0x149')](db[_0x9210('0x8b')],{'as':_0x9210('0x8b'),'foreignKey':_0x9210('0x1c1')});db['ChatQueueReport'][_0x9210('0x149')](db[_0x9210('0x61')],{});db[_0x9210('0xc6')][_0x9210('0x149')](db['CmList'],{'as':'List','foreignKey':_0x9210('0x17a')});db[_0x9210('0xc6')][_0x9210('0x149')](db['CmContact'],{'as':_0x9210('0x15c'),'foreignKey':_0x9210('0x169')});db[_0x9210('0xc6')][_0x9210('0x149')](db[_0x9210('0x67')],{});db['ChatQueueReport'][_0x9210('0x149')](db[_0x9210('0x69')],{});db[_0x9210('0xc6')]['belongsTo'](db['User'],{});db['ChatQueueReport'][_0x9210('0x149')](db[_0x9210('0x6c')],{});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1cb')});db[_0x9210('0x196')][_0x9210('0x149')](db['User'],{'onDelete':_0x9210('0x108'),'foreignKey':_0x9210('0x1cc')});db[_0x9210('0xcc')][_0x9210('0x109')](db[_0x9210('0xcb')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x9210('0xcc')][_0x9210('0x109')](db['JscriptyAnswerReport'],{'foreignKey':_0x9210('0x1cd'),'onDelete':'cascade'});db['SmsQueueReport']['belongsTo'](db['SmsAccount'],{});db['SmsQueueReport'][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':_0x9210('0x163'),'foreignKey':'ListId'});db[_0x9210('0xce')][_0x9210('0x149')](db[_0x9210('0x15b')],{'as':_0x9210('0x15c'),'foreignKey':'ContactId'});db[_0x9210('0xce')][_0x9210('0x149')](db['SmsInteraction'],{});db['SmsQueueReport'][_0x9210('0x149')](db[_0x9210('0x17f')],{});db['SmsQueueReport']['belongsTo'](db[_0x9210('0x12')],{});db[_0x9210('0xce')][_0x9210('0x149')](db[_0x9210('0x12f')],{});db[_0x9210('0xd3')]['hasMany'](db[_0x9210('0xcc')],{'foreignKey':_0x9210('0x1ce')});db[_0x9210('0xd3')][_0x9210('0x109')](db[_0x9210('0xcb')],{'foreignKey':_0x9210('0x1ce')});db[_0x9210('0xd3')][_0x9210('0x109')](db[_0x9210('0xc9')],{'foreignKey':_0x9210('0x1ce')});db[_0x9210('0xd7')][_0x9210('0x11b')](db['User'],{'as':_0x9210('0x16e'),'through':_0x9210('0x13f')});db[_0x9210('0xdd')][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':_0x9210('0x122')});db[_0x9210('0xdd')][_0x9210('0x11b')](db[_0x9210('0x19')],{'through':_0x9210('0x104'),'as':_0x9210('0x1cf')});db['Team'][_0x9210('0x11b')](db['MailQueue'],{'through':_0x9210('0x166'),'as':_0x9210('0x12c')});db[_0x9210('0xdd')]['belongsToMany'](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x9210('0x12d')});db['Team']['belongsToMany'](db['FaxQueue'],{'through':_0x9210('0x17d'),'as':_0x9210('0x12e')});db[_0x9210('0xdd')][_0x9210('0x11b')](db[_0x9210('0x12f')],{'through':_0x9210('0x185'),'as':_0x9210('0x1d0')});db[_0x9210('0xdd')]['belongsToMany'](db[_0x9210('0x5f')],{'through':_0x9210('0x18b'),'as':_0x9210('0x131')});db['Team'][_0x9210('0x11b')](db[_0x9210('0x101')],{'through':_0x9210('0x1d1'),'as':'WhatsappQueues'});db['Team'][_0x9210('0x11b')](db['VoicePrefix'],{'through':_0x9210('0x1d2'),'as':'VoicePrefixes'});db[_0x9210('0xe0')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x9210('0x19d')});db['Campaign'][_0x9210('0x109')](db[_0x9210('0x111')],{'as':_0x9210('0x112'),'foreignKey':'CampaignId'});db[_0x9210('0xe0')][_0x9210('0x109')](db[_0x9210('0x113')],{'as':_0x9210('0x147'),'foreignKey':_0x9210('0x19d')});db[_0x9210('0xe0')][_0x9210('0x109')](db[_0x9210('0x72')],{'as':_0x9210('0x1d3'),'foreignKey':_0x9210('0x19d')});db[_0x9210('0xe0')][_0x9210('0x149')](db[_0x9210('0x2a')],{'as':_0x9210('0x2a'),'foreignKey':_0x9210('0x14a')});db['Campaign'][_0x9210('0x149')](db['Trunk'],{'as':_0x9210('0x14b'),'foreignKey':'TrunkBackupId'});db[_0x9210('0xe0')][_0x9210('0x149')](db[_0x9210('0x7f')],{'as':_0x9210('0x7f'),'foreignKey':_0x9210('0x14d')});db[_0x9210('0xe0')][_0x9210('0x149')](db[_0x9210('0xd7')],{'as':_0x9210('0xd7'),'foreignKey':_0x9210('0x1d4')});db[_0x9210('0xe0')][_0x9210('0x11b')](db[_0x9210('0xf1')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0x9210('0xe0')][_0x9210('0x11b')](db[_0x9210('0xf1')],{'as':_0x9210('0x153'),'through':_0x9210('0x1d5')});db['Attachment'][_0x9210('0x149')](db[_0x9210('0x6a')],{'as':_0x9210('0x6a'),'foreignKey':_0x9210('0x194')});db[_0x9210('0xe8')]['belongsTo'](db[_0x9210('0x45')],{});db['MailTransferReport'][_0x9210('0x149')](db['MailInteraction'],{});db['MailTransferReport'][_0x9210('0x149')](db[_0x9210('0x3e')],{'foreignKey':'FromMailAccountId','as':_0x9210('0x1d6')});db[_0x9210('0xe8')][_0x9210('0x149')](db[_0x9210('0x12')],{'foreignKey':'FromUserId','as':_0x9210('0x1d7')});db[_0x9210('0xe8')][_0x9210('0x149')](db[_0x9210('0x12')],{'foreignKey':_0x9210('0x1d8'),'as':_0x9210('0x1d9')});db[_0x9210('0xe8')][_0x9210('0x149')](db['MailQueue'],{'foreignKey':_0x9210('0x1da'),'as':_0x9210('0x1db')});db['MailTransferReport'][_0x9210('0x149')](db[_0x9210('0x3e')],{'foreignKey':_0x9210('0x1dc'),'as':'ToAccount'});db[_0x9210('0xea')]['belongsTo'](db[_0x9210('0x69')],{});db[_0x9210('0xea')][_0x9210('0x149')](db[_0x9210('0x67')],{});db[_0x9210('0xea')][_0x9210('0x149')](db[_0x9210('0x61')],{'foreignKey':_0x9210('0x1dd'),'as':_0x9210('0x1d6')});db['ChatTransferReport'][_0x9210('0x149')](db['User'],{'foreignKey':_0x9210('0x1de'),'as':_0x9210('0x1d7')});db[_0x9210('0xea')][_0x9210('0x149')](db[_0x9210('0x12')],{'foreignKey':'ToUserId','as':_0x9210('0x1d9')});db['ChatTransferReport'][_0x9210('0x149')](db[_0x9210('0x6c')],{'foreignKey':_0x9210('0x1df'),'as':_0x9210('0x1db')});db[_0x9210('0xea')][_0x9210('0x149')](db[_0x9210('0x61')],{'foreignKey':'ToChatWebsiteId','as':_0x9210('0x1e0')});db[_0x9210('0xec')][_0x9210('0x149')](db[_0x9210('0x4f')],{});db[_0x9210('0xec')][_0x9210('0x149')](db[_0x9210('0x4e')],{});db['FaxTransferReport'][_0x9210('0x149')](db[_0x9210('0x4c')],{'foreignKey':'FromFaxAccountId','as':_0x9210('0x1d6')});db[_0x9210('0xec')][_0x9210('0x149')](db['User'],{'foreignKey':_0x9210('0x1de'),'as':'FromAgent'});db[_0x9210('0xec')][_0x9210('0x149')](db[_0x9210('0x12')],{'foreignKey':_0x9210('0x1d8'),'as':_0x9210('0x1d9')});db[_0x9210('0xec')][_0x9210('0x149')](db[_0x9210('0x51')],{'foreignKey':_0x9210('0x1e1'),'as':_0x9210('0x1db')});db[_0x9210('0xec')][_0x9210('0x149')](db[_0x9210('0x4c')],{'foreignKey':_0x9210('0x1e2'),'as':_0x9210('0x1e0')});db['OpenchannelTransferReport'][_0x9210('0x149')](db['OpenchannelMessage'],{});db[_0x9210('0xee')]['belongsTo'](db[_0x9210('0x5b')],{});db[_0x9210('0xee')]['belongsTo'](db[_0x9210('0x57')],{'foreignKey':_0x9210('0x1e3'),'as':_0x9210('0x1d6')});db[_0x9210('0xee')]['belongsTo'](db[_0x9210('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x9210('0xee')][_0x9210('0x149')](db['User'],{'foreignKey':'ToUserId','as':_0x9210('0x1d9')});db['OpenchannelTransferReport'][_0x9210('0x149')](db['OpenchannelQueue'],{'foreignKey':_0x9210('0x1e4'),'as':'ToQueue'});db[_0x9210('0xee')][_0x9210('0x149')](db[_0x9210('0x57')],{'foreignKey':'ToOpenchannelAccountId','as':_0x9210('0x1e0')});db[_0x9210('0xef')]['belongsTo'](db[_0x9210('0x17f')],{});db[_0x9210('0xef')]['belongsTo'](db['SmsInteraction'],{});db[_0x9210('0xef')][_0x9210('0x149')](db[_0x9210('0x54')],{'foreignKey':_0x9210('0x1e5'),'as':_0x9210('0x1d6')});db[_0x9210('0xef')][_0x9210('0x149')](db[_0x9210('0x12')],{'foreignKey':_0x9210('0x1de'),'as':'FromAgent'});db[_0x9210('0xef')][_0x9210('0x149')](db[_0x9210('0x12')],{'foreignKey':_0x9210('0x1d8'),'as':'ToAgent'});db['SmsTransferReport'][_0x9210('0x149')](db[_0x9210('0x12f')],{'foreignKey':_0x9210('0x1e6'),'as':_0x9210('0x1db')});db['SmsTransferReport']['belongsTo'](db[_0x9210('0x54')],{'foreignKey':'ToSmsAccountId','as':_0x9210('0x1e0')});db[_0x9210('0xf1')][_0x9210('0x109')](db[_0x9210('0x7c')],{'as':_0x9210('0x161'),'foreignKey':_0x9210('0x17a'),'onDelete':_0x9210('0x108')});db['CmList'][_0x9210('0x109')](db[_0x9210('0x1e7')],{'as':'CustomFields','foreignKey':_0x9210('0x17a')});db['CmList'][_0x9210('0x109')](db[_0x9210('0x15b')],{'as':_0x9210('0x11e'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x9210('0xf1')][_0x9210('0x109')](db['CmHopperFinal'],{'as':_0x9210('0x112'),'foreignKey':_0x9210('0x17a')});db[_0x9210('0xf1')][_0x9210('0x109')](db[_0x9210('0x113')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0x9210('0xf1')][_0x9210('0x109')](db['ReportAgentPreview'],{'as':_0x9210('0x75'),'foreignKey':_0x9210('0x17a')});db['CmList']['belongsToMany'](db[_0x9210('0x19')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0x9210('0xf1')][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':_0x9210('0x121')});db[_0x9210('0xf3')][_0x9210('0x109')](db[_0x9210('0x10f')],{'as':_0x9210('0x110'),'onDelete':_0x9210('0x108')});db['VoicePrefix']['belongsToMany'](db['User'],{'as':_0x9210('0x151'),'through':_0x9210('0x107')});db[_0x9210('0xf3')][_0x9210('0x11b')](db['Team'],{'through':'TeamVoicePrefix','as':_0x9210('0x152')});db[_0x9210('0xf4')][_0x9210('0x109')](db[_0x9210('0x12')],{'as':_0x9210('0x16e'),'foreignKey':_0x9210('0x11a')});db[_0x9210('0xf4')][_0x9210('0x109')](db[_0x9210('0x1e8')],{'as':'UserProfileSections','foreignKey':_0x9210('0x11a'),'onDelete':_0x9210('0x108')});db['UserProfileSection']['hasMany'](db[_0x9210('0xf6')],{'as':_0x9210('0x1e9'),'foreignKey':_0x9210('0x1ea'),'onDelete':_0x9210('0x108')});db[_0x9210('0x13b')][_0x9210('0x109')](db[_0x9210('0x7c')],{'as':_0x9210('0x161'),'foreignKey':_0x9210('0x1eb'),'onDelete':_0x9210('0x108')});db['WhatsappAccount'][_0x9210('0x109')](db['CannedAnswer'],{'as':_0x9210('0x162'),'foreignKey':_0x9210('0x1eb')});db[_0x9210('0x13b')][_0x9210('0x109')](db[_0x9210('0x1ec')],{'as':_0x9210('0x155'),'foreignKey':_0x9210('0x1eb')});db['WhatsappAccount'][_0x9210('0x109')](db['WhatsappInteraction'],{'as':_0x9210('0x177')});db[_0x9210('0x13b')][_0x9210('0x109')](db['WhatsappApplication'],{'as':'Applications'});db[_0x9210('0x13b')][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':_0x9210('0x163'),'foreignKey':_0x9210('0x17a')});db[_0x9210('0x13b')][_0x9210('0x149')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9210('0x14f')});db[_0x9210('0x13b')][_0x9210('0x11b')](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':_0x9210('0x13d')});db[_0x9210('0xfa')][_0x9210('0x149')](db['User'],{'onDelete':_0x9210('0x171')});db[_0x9210('0xfa')][_0x9210('0x149')](db['WhatsappQueue'],{'onDelete':_0x9210('0x171')});db[_0x9210('0xfa')][_0x9210('0x149')](db[_0x9210('0x13b')],{'onDelete':_0x9210('0x171')});db['WhatsappApplication'][_0x9210('0x149')](db[_0x9210('0x7f')],{'onDelete':_0x9210('0x171'),'foreignKey':_0x9210('0x14d')});db[_0x9210('0xfa')]['belongsTo'](db[_0x9210('0x88')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x9210('0xfb')][_0x9210('0x109')](db[_0x9210('0x1ec')],{'as':_0x9210('0x155'),'onDelete':_0x9210('0x108'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction']['belongsTo'](db['WhatsappAccount'],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x1eb')});db[_0x9210('0xfb')][_0x9210('0x149')](db[_0x9210('0x15b')],{'as':'Contact','foreignKey':'ContactId'});db[_0x9210('0xfb')][_0x9210('0x149')](db['User'],{'as':'Owner','foreignKey':_0x9210('0x10c')});db[_0x9210('0xfb')]['belongsToMany'](db[_0x9210('0x88')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0x9210('0xfb')][_0x9210('0x11b')](db[_0x9210('0x88')],{'through':_0x9210('0x1a8'),'as':_0x9210('0x16d')});db[_0x9210('0xfb')][_0x9210('0x11b')](db['User'],{'as':'Users','through':_0x9210('0x12a'),'foreignKey':_0x9210('0x1ed')});db[_0x9210('0x1ec')][_0x9210('0x149')](db[_0x9210('0x12')],{'as':_0x9210('0x12')});db[_0x9210('0x1ec')][_0x9210('0x149')](db[_0x9210('0x15b')],{'onDelete':_0x9210('0x108'),'as':_0x9210('0x15c')});db[_0x9210('0x1ec')]['belongsTo'](db[_0x9210('0xfb')],{'onDelete':'cascade','as':_0x9210('0x16f'),'foreignKey':_0x9210('0x1ed')});db[_0x9210('0x1ec')][_0x9210('0x149')](db['WhatsappAccount'],{'as':_0x9210('0x168'),'foreignKey':_0x9210('0x1eb')});db[_0x9210('0x1ee')][_0x9210('0x149')](db[_0x9210('0x13b')],{});db[_0x9210('0x1ee')][_0x9210('0x149')](db[_0x9210('0xf1')],{'as':_0x9210('0x163'),'foreignKey':_0x9210('0x17a')});db[_0x9210('0x1ee')]['belongsTo'](db[_0x9210('0x15b')],{'as':_0x9210('0x15c'),'foreignKey':_0x9210('0x169')});db[_0x9210('0x1ee')][_0x9210('0x149')](db[_0x9210('0xfb')],{});db[_0x9210('0x1ee')]['belongsTo'](db[_0x9210('0x101')],{});db[_0x9210('0x1ee')]['belongsTo'](db[_0x9210('0x1ec')],{});db[_0x9210('0x1ee')][_0x9210('0x149')](db[_0x9210('0x12')],{});db[_0x9210('0xff')]['belongsTo'](db[_0x9210('0x1ec')],{});db[_0x9210('0xff')][_0x9210('0x149')](db[_0x9210('0xfb')],{});db[_0x9210('0xff')]['belongsTo'](db[_0x9210('0x13b')],{'foreignKey':_0x9210('0x1ef'),'as':_0x9210('0x1d6')});db[_0x9210('0xff')][_0x9210('0x149')](db[_0x9210('0x13b')],{'foreignKey':_0x9210('0x1f0'),'as':'ToAccount'});db['WhatsappTransferReport'][_0x9210('0x149')](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x9210('0xff')][_0x9210('0x149')](db[_0x9210('0x12')],{'foreignKey':_0x9210('0x1de'),'as':_0x9210('0x1d7')});db[_0x9210('0xff')]['belongsTo'](db[_0x9210('0x12')],{'foreignKey':_0x9210('0x1d8'),'as':_0x9210('0x1d9')});db['WhatsappQueue']['belongsToMany'](db[_0x9210('0x12')],{'as':_0x9210('0x151'),'through':_0x9210('0x38'),'foreignKey':_0x9210('0x1f1')});db[_0x9210('0x101')][_0x9210('0x11b')](db[_0x9210('0xdd')],{'through':_0x9210('0x1d1'),'as':_0x9210('0x152')});module[_0x9210('0x1f2')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 8e19b09..9a9dffe 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e25=['/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','./api/cannedAnswer','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/mail/reports/transfer','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','./api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','root','/apidoc','join','/www','/demo','3.0.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','phone','mobile','fax','email','clientSecret','securityToken','code','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','accesskeyid','key','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','isString','replace','@@{','lodash','util','./errors','./config/environment','./config/logger','api','auth','default','use','%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','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelMessage','./api/chatWebsite','/api/openchannel/reports/queue'];(function(_0x3373aa,_0x52901c){var _0x26e25c=function(_0x422e19){while(--_0x422e19){_0x3373aa['push'](_0x3373aa['shift']());}};_0x26e25c(++_0x52901c);}(_0x9e25,0xda));var _0x59e2=function(_0x196f12,_0x1a0696){_0x196f12=_0x196f12-0x0;var _0x1807e8=_0x9e25[_0x196f12];return _0x1807e8;};'use strict';var _=require(_0x59e2('0x0'));var path=require('path');var express=require('express');var ewinston=require('express-winston');var util=require(_0x59e2('0x1'));var errors=require(_0x59e2('0x2'));var config=require(_0x59e2('0x3'));var logger=require(_0x59e2('0x4'))(_0x59e2('0x5'));var authLogger=require(_0x59e2('0x4'))(_0x59e2('0x6'));exports[_0x59e2('0x7')]=function(_0x3a8f09){_0x3a8f09[_0x59e2('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x23c0bb,_0x4b31b3){var _0x1c52aa=_0x59e2('0x9');if(!_[_0x59e2('0xa')](_0x23c0bb[_0x59e2('0xb')])){_0x1c52aa+=_0x59e2('0xc');var _0xb623d9=_0x23c0bb[_0x59e2('0xb')];maskSensitiveData(_0xb623d9);}return util[_0x59e2('0xd')](_0x1c52aa,_0x23c0bb[_0x59e2('0xe')],_0x23c0bb[_0x59e2('0xf')][_0x59e2('0x10')]?_0x23c0bb['headers'][_0x59e2('0x10')]:_0x23c0bb[_0x59e2('0x11')][_0x59e2('0x12')]||_0x23c0bb['ip'],_0x23c0bb[_0x59e2('0x13')],_0x4b31b3[_0x59e2('0x14')],_0x4b31b3[_0x59e2('0x15')],_0x23c0bb[_0x59e2('0x16')]?_0x23c0bb[_0x59e2('0x16')]['id']:null,_0x23c0bb[_0x59e2('0x16')]?_0x23c0bb['user'][_0x59e2('0x17')]:null,_0x23c0bb['user']?_0x23c0bb[_0x59e2('0x16')][_0x59e2('0x18')]:null,_0xb623d9?util[_0x59e2('0x19')](_0xb623d9,![],null):'');}}));_0x3a8f09[_0x59e2('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1c0ef5,_0x61bc55){var _0x158936=_0x59e2('0x1a');if(_0x1c0ef5[_0x59e2('0xb')]&&_0x1c0ef5[_0x59e2('0xb')][_0x59e2('0x1b')]&&_0x1c0ef5['body'][_0x59e2('0x1c')]){_0x158936=_0x59e2('0x1d');}return util[_0x59e2('0xd')](_0x158936,_0x1c0ef5[_0x59e2('0xe')],_0x1c0ef5[_0x59e2('0xf')]['x-forwarded-for']?_0x1c0ef5[_0x59e2('0xf')]['x-forwarded-for']:_0x1c0ef5[_0x59e2('0x11')][_0x59e2('0x12')]||_0x1c0ef5['ip'],_0x1c0ef5['url'],_0x61bc55[_0x59e2('0x14')],_0x61bc55[_0x59e2('0x15')],_0x1c0ef5[_0x59e2('0x16')]?_0x1c0ef5[_0x59e2('0x16')]['id']:null,_0x1c0ef5[_0x59e2('0x16')]?_0x1c0ef5[_0x59e2('0x16')]['name']:null,_0x1c0ef5[_0x59e2('0x16')]?_0x1c0ef5[_0x59e2('0x16')]['role']:null,_0x1c0ef5['body']&&_0x1c0ef5[_0x59e2('0xb')][_0x59e2('0x1b')]?_0x1c0ef5['body'][_0x59e2('0x1b')]:'other',_0x1c0ef5[_0x59e2('0xb')]&&_0x1c0ef5[_0x59e2('0xb')][_0x59e2('0x1c')]?_0x1c0ef5['body'][_0x59e2('0x1c')]:'',_0x1c0ef5['body']&&_0x1c0ef5['body']['agent_name']?_0x1c0ef5[_0x59e2('0xb')]['agent_name']:'');},'ignoreRoute':function(_0x5b51ed){var _0x1ce5c2=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1ce5c2[_0x59e2('0x1e')](_0x5b51ed[_0x59e2('0x13')]);}}));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x1f'),require(_0x59e2('0x20')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x21'),require(_0x59e2('0x22')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x23'),require('./api/voiceContext'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x24'),require(_0x59e2('0x25')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x26'),require(_0x59e2('0x27')));_0x3a8f09['use']('/api/voice/queues',require('./api/voiceQueue'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x28'),require(_0x59e2('0x29')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x2a'),require(_0x59e2('0x2b')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x2c'),require('./api/voiceMail'));_0x3a8f09[_0x59e2('0x8')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x2d'),require(_0x59e2('0x2e')));_0x3a8f09[_0x59e2('0x8')]('/api/voice/dials/reports',require(_0x59e2('0x2f')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x30'),require(_0x59e2('0x31')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x32'),require(_0x59e2('0x33')));_0x3a8f09['use'](_0x59e2('0x34'),require(_0x59e2('0x35')));_0x3a8f09[_0x59e2('0x8')]('/api/trunks',require(_0x59e2('0x36')));_0x3a8f09[_0x59e2('0x8')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x3a8f09['use'](_0x59e2('0x37'),require('./api/mailServerOut'));_0x3a8f09['use'](_0x59e2('0x38'),require(_0x59e2('0x39')));_0x3a8f09['use'](_0x59e2('0x3a'),require(_0x59e2('0x3b')));_0x3a8f09[_0x59e2('0x8')]('/api/mail/substatuses',require(_0x59e2('0x3c')));_0x3a8f09['use'](_0x59e2('0x3d'),require('./api/mailInteraction'));_0x3a8f09[_0x59e2('0x8')]('/api/mail/messages',require('./api/mailMessage'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x3e'),require(_0x59e2('0x3f')));_0x3a8f09['use'](_0x59e2('0x40'),require(_0x59e2('0x41')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x42'),require(_0x59e2('0x43')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x44'),require('./api/dashboardItem'));_0x3a8f09['use'](_0x59e2('0x45'),require(_0x59e2('0x46')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x47'),require(_0x59e2('0x48')));_0x3a8f09[_0x59e2('0x8')]('/api/fax/interactions',require(_0x59e2('0x49')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x4a'),require(_0x59e2('0x4b')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x4c'),require(_0x59e2('0x4d')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x4e'),require(_0x59e2('0x4f')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x50'),require(_0x59e2('0x51')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x52'),require(_0x59e2('0x53')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x54'),require(_0x59e2('0x55')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x56'),require('./api/smsMessage'));_0x3a8f09[_0x59e2('0x8')]('/api/sms/queues',require(_0x59e2('0x57')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x58'),require(_0x59e2('0x59')));_0x3a8f09['use'](_0x59e2('0x5a'),require(_0x59e2('0x5b')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x5c'),require('./api/openchannelInteraction'));_0x3a8f09[_0x59e2('0x8')]('/api/openchannel/messages',require(_0x59e2('0x5d')));_0x3a8f09['use']('/api/openchannel/queues',require('./api/openchannelQueue'));_0x3a8f09[_0x59e2('0x8')]('/api/chat/websites',require(_0x59e2('0x5e')));_0x3a8f09['use'](_0x59e2('0x5f'),require('./api/openchannelQueueReport'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x60'),require(_0x59e2('0x61')));_0x3a8f09['use'](_0x59e2('0x62'),require(_0x59e2('0x63')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x64'),require(_0x59e2('0x65')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x66'),require(_0x59e2('0x67')));_0x3a8f09['use'](_0x59e2('0x68'),require(_0x59e2('0x69')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x6a'),require(_0x59e2('0x6b')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x6c'),require(_0x59e2('0x6d')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x6e'),require(_0x59e2('0x6f')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x70'),require(_0x59e2('0x71')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x72'),require(_0x59e2('0x73')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x74'),require('./api/cmHopperBlack'));_0x3a8f09['use'](_0x59e2('0x75'),require(_0x59e2('0x76')));_0x3a8f09[_0x59e2('0x8')]('/api/cm/hopper_history',require(_0x59e2('0x77')));_0x3a8f09[_0x59e2('0x8')]('/api/cm/custom_fields',require(_0x59e2('0x78')));_0x3a8f09[_0x59e2('0x8')]('/api/actions',require(_0x59e2('0x79')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x7a'),require('./api/automation'));_0x3a8f09['use']('/api/canned_answers',require(_0x59e2('0x7b')));_0x3a8f09[_0x59e2('0x8')]('/api/dispositions',require('./api/disposition'));_0x3a8f09[_0x59e2('0x8')]('/api/conditions',require(_0x59e2('0x7c')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x7d'),require(_0x59e2('0x7e')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x7f'),require(_0x59e2('0x80')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x81'),require('./api/cdr'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x82'),require(_0x59e2('0x83')));_0x3a8f09['use']('/api/schedules',require(_0x59e2('0x84')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x85'),require(_0x59e2('0x86')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x87'),require('./api/tag'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x88'),require(_0x59e2('0x89')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x8a'),require(_0x59e2('0x8b')));_0x3a8f09['use'](_0x59e2('0x8c'),require(_0x59e2('0x8d')));_0x3a8f09[_0x59e2('0x8')]('/api/integrations',require(_0x59e2('0x8e')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x8f'),require(_0x59e2('0x90')));_0x3a8f09['use'](_0x59e2('0x91'),require(_0x59e2('0x92')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x93'),require(_0x59e2('0x94')));_0x3a8f09['use']('/api/analytics/extracted_reports',require(_0x59e2('0x95')));_0x3a8f09[_0x59e2('0x8')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x3a8f09['use'](_0x59e2('0x96'),require(_0x59e2('0x97')));_0x3a8f09['use'](_0x59e2('0x98'),require(_0x59e2('0x99')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x9a'),require(_0x59e2('0x9b')));_0x3a8f09[_0x59e2('0x8')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x9c'),require(_0x59e2('0x9d')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x9e'),require('./api/intSugarcrmAccount'));_0x3a8f09['use'](_0x59e2('0x9f'),require(_0x59e2('0xa0')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xa1'),require(_0x59e2('0xa2')));_0x3a8f09['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x3a8f09['use']('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x3a8f09[_0x59e2('0x8')]('/api/integrations/desk/fields',require(_0x59e2('0xa3')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xa4'),require('./api/intZohoAccount'));_0x3a8f09[_0x59e2('0x8')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x3a8f09['use']('/api/integrations/zoho/fields',require(_0x59e2('0xa5')));_0x3a8f09[_0x59e2('0x8')]('/api/integrations/zendesk/accounts',require(_0x59e2('0xa6')));_0x3a8f09['use'](_0x59e2('0xa7'),require(_0x59e2('0xa8')));_0x3a8f09['use'](_0x59e2('0xa9'),require('./api/intZendeskField'));_0x3a8f09['use']('/api/integrations/freshdesk/accounts',require(_0x59e2('0xaa')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xab'),require(_0x59e2('0xac')));_0x3a8f09[_0x59e2('0x8')]('/api/integrations/freshdesk/fields',require(_0x59e2('0xad')));_0x3a8f09[_0x59e2('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xae'),require('./api/intVtigerConfiguration'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xaf'),require(_0x59e2('0xb0')));_0x3a8f09[_0x59e2('0x8')]('/api/integrations/servicenow/accounts',require(_0x59e2('0xb1')));_0x3a8f09[_0x59e2('0x8')]('/api/integrations/servicenow/configurations',require(_0x59e2('0xb2')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xb3'),require('./api/intServicenowField'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xb4'),require(_0x59e2('0xb5')));_0x3a8f09[_0x59e2('0x8')]('/api/integrations/dynamics365/configurations',require(_0x59e2('0xb6')));_0x3a8f09['use'](_0x59e2('0xb7'),require(_0x59e2('0xb8')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xb9'),require('./api/intFreshsalesAccount'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xba'),require('./api/intFreshsalesConfiguration'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xbb'),require(_0x59e2('0xbc')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xbd'),require('./api/network'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xbe'),require('./api/chatQueueReport'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xbf'),require(_0x59e2('0xc0')));_0x3a8f09['use'](_0x59e2('0xc1'),require(_0x59e2('0xc2')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xc3'),require(_0x59e2('0xc4')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xc5'),require(_0x59e2('0xc6')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xc7'),require('./api/smsQueueReport'));_0x3a8f09['use']('/api/square/reports',require('./api/squareReport'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xc8'),require(_0x59e2('0xc9')));_0x3a8f09['use'](_0x59e2('0xca'),require(_0x59e2('0xcb')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xcc'),require(_0x59e2('0xcd')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xce'),require(_0x59e2('0xcf')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xd0'),require(_0x59e2('0xd1')));_0x3a8f09['use'](_0x59e2('0xd2'),require(_0x59e2('0xd3')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xd4'),require(_0x59e2('0xd5')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xd6'),require('./api/team'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xd7'),require(_0x59e2('0xd8')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xd9'),require('./api/campaign'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xda'),require(_0x59e2('0xdb')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xdc'),require(_0x59e2('0xdd')));_0x3a8f09[_0x59e2('0x8')]('/api/plugins',require('./api/plugin'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xde'),require('./api/mailTransferReport'));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xdf'),require('./api/chatTransferReport'));_0x3a8f09['use'](_0x59e2('0xe0'),require(_0x59e2('0xe1')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xe2'),require(_0x59e2('0xe3')));_0x3a8f09['use']('/api/sms/reports/transfer',require(_0x59e2('0xe4')));_0x3a8f09[_0x59e2('0x8')]('/api/cm/lists',require(_0x59e2('0xe5')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xe6'),require(_0x59e2('0xe7')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xe8'),require(_0x59e2('0xe9')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xea'),require(_0x59e2('0xeb')));_0x3a8f09['use']('/api/userProfile/resources',require(_0x59e2('0xec')));_0x3a8f09[_0x59e2('0x8')]('/api/userNotifications',require(_0x59e2('0xed')));_0x3a8f09['use'](_0x59e2('0xee'),require(_0x59e2('0xef')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xf0'),require(_0x59e2('0xf1')));_0x3a8f09[_0x59e2('0x8')]('/api/whatsapp/interactions',require(_0x59e2('0xf2')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xf3'),require(_0x59e2('0xf4')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xf5'),require(_0x59e2('0xf6')));_0x3a8f09['use'](_0x59e2('0xf7'),require('./api/whatsappTransferReport'));_0x3a8f09['use']('/api/whatsapp/queues',require(_0x59e2('0xf8')));_0x3a8f09[_0x59e2('0x8')]('/api/cloudProviders',require(_0x59e2('0xf9')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xfa'),require(_0x59e2('0xfb')));_0x3a8f09[_0x59e2('0x8')]('/api/auth/local',require(_0x59e2('0xfc')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xfd'),require('./api/authGoogle'));_0x3a8f09[_0x59e2('0x8')]('/api/jira',require(_0x59e2('0xfe')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0xff'),require(_0x59e2('0x100')));_0x3a8f09['use']('/api/version',require(_0x59e2('0x101')));_0x3a8f09[_0x59e2('0x8')]('/api/system',require(_0x59e2('0x102')));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x103'),require(_0x59e2('0x104')));_0x3a8f09['use'](_0x59e2('0x105'),require(_0x59e2('0x106')));_0x3a8f09[_0x59e2('0x8')]('/apidoc',express[_0x59e2('0x107')](path['join'](config[_0x59e2('0x108')],_0x59e2('0x109'))));_0x3a8f09['use']('/www',express[_0x59e2('0x107')](path[_0x59e2('0x10a')](config['root'],_0x59e2('0x10b'))));_0x3a8f09['use'](_0x59e2('0x10c'),express['static'](path[_0x59e2('0x10a')](config[_0x59e2('0x108')],'/demo')));_0x3a8f09[_0x59e2('0x8')]('/snippet',express[_0x59e2('0x107')](path[_0x59e2('0x10a')](config['root'],'snippet',_0x59e2('0x10d'))));_0x3a8f09[_0x59e2('0x8')](_0x59e2('0x10e'),express['static'](path[_0x59e2('0x10a')](config[_0x59e2('0x108')],_0x59e2('0x10f'))));_0x3a8f09['route'](_0x59e2('0x110'))[_0x59e2('0x111')](errors[0x194]);_0x3a8f09['route']('/*')[_0x59e2('0x111')](function(_0x2f1212,_0x1246e3){_0x1246e3[_0x59e2('0x112')](path['resolve'](_0x3a8f09[_0x59e2('0x111')](_0x59e2('0x113'))+_0x59e2('0x114')));});};var sensitiveFields=[_0x59e2('0x115'),_0x59e2('0x116'),_0x59e2('0x117'),_0x59e2('0x118'),_0x59e2('0x119'),_0x59e2('0x11a'),'street',_0x59e2('0x11b'),_0x59e2('0x11c'),_0x59e2('0x11d'),_0x59e2('0x11e'),'clientId',_0x59e2('0x11f'),_0x59e2('0x120'),_0x59e2('0x121'),'accessKey','tenantId',_0x59e2('0x122'),_0x59e2('0x123'),_0x59e2('0x124'),_0x59e2('0x125'),'authToken',_0x59e2('0x126'),_0x59e2('0x127'),_0x59e2('0x128'),_0x59e2('0x129'),_0x59e2('0x12a'),_0x59e2('0x12b'),_0x59e2('0x12c'),'clientEmail','privateKey',_0x59e2('0x12d'),'secretaccesskey',_0x59e2('0x12e'),_0x59e2('0x16'),_0x59e2('0x12f'),'accountSid',_0x59e2('0x130'),_0x59e2('0x131'),_0x59e2('0x132'),_0x59e2('0x133'),_0x59e2('0x134')];function maskSensitiveData(_0x8c6953){var _0x5878dc=/(?!^)[\s\S](?!$)/g;if(!_[_0x59e2('0x135')](_0x8c6953))return;for(var _0x269e6c in _0x8c6953){if(_[_0x59e2('0x136')](_0x8c6953[_0x269e6c])){for(var _0x5a8df8=0x0;_0x5a8df8<_0x8c6953[_0x269e6c]['length'];_0x5a8df8++){maskSensitiveData(_0x8c6953[_0x269e6c][_0x5a8df8]);}}else if(_[_0x59e2('0x135')](_0x8c6953[_0x269e6c])){maskSensitiveData(_0x8c6953[_0x269e6c]);}else if(_[_0x59e2('0x137')](_0x8c6953[_0x269e6c])){_0x8c6953[_0x269e6c]=_0x8c6953[_0x269e6c][_0x59e2('0x138')](/{{{/g,_0x59e2('0x139'))[_0x59e2('0x138')](/}}}/g,'}@@')[_0x59e2('0x138')](/{{/g,'@{')[_0x59e2('0x138')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x269e6c)){_0x8c6953[_0x269e6c]=_0x8c6953[_0x269e6c][_0x59e2('0x138')](_0x5878dc,'*');}}}} \ No newline at end of file +var _0x3d62=['./api/whatsappMessage','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','/www','root','/demo','/snippet','static','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','username','password','newPassword','apiKey','lastName','street','phone','mobile','fax','clientSecret','securityToken','code','tenantId','token','channelSecret','accessTokenSecret','authToken','consumerSecret','membername','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','dsn','registry','oldPassword','length','isPlainObject','replace','@@{','}@@','express','express-winston','./errors','./config/environment','./config/logger','default','logger','isEmpty','body','method','x-forwarded-for','headers','connection','url','statusCode','responseTime','user','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','remoteAddress','other','agent_id','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/voice/mails','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./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/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./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/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages'];(function(_0x1dec7d,_0x3d3c6f){var _0xfede51=function(_0x46f16d){while(--_0x46f16d){_0x1dec7d['push'](_0x1dec7d['shift']());}};_0xfede51(++_0x3d3c6f);}(_0x3d62,0x18f));var _0x23d6=function(_0x29d50f,_0x4a65d4){_0x29d50f=_0x29d50f-0x0;var _0x34fe99=_0x3d62[_0x29d50f];return _0x34fe99;};'use strict';var _=require('lodash');var path=require('path');var express=require(_0x23d6('0x0'));var ewinston=require(_0x23d6('0x1'));var util=require('util');var errors=require(_0x23d6('0x2'));var config=require(_0x23d6('0x3'));var logger=require(_0x23d6('0x4'))('api');var authLogger=require(_0x23d6('0x4'))('auth');exports[_0x23d6('0x5')]=function(_0x68d9d3){_0x68d9d3['use'](ewinston[_0x23d6('0x6')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x58243f,_0x7bcdf3){var _0x2024cd='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x23d6('0x7')](_0x58243f[_0x23d6('0x8')])){_0x2024cd+='\x20body=%s';var _0x49eee9=_0x58243f[_0x23d6('0x8')];maskSensitiveData(_0x49eee9);}return util['format'](_0x2024cd,_0x58243f[_0x23d6('0x9')],_0x58243f['headers'][_0x23d6('0xa')]?_0x58243f[_0x23d6('0xb')][_0x23d6('0xa')]:_0x58243f[_0x23d6('0xc')]['remoteAddress']||_0x58243f['ip'],_0x58243f[_0x23d6('0xd')],_0x7bcdf3[_0x23d6('0xe')],_0x7bcdf3[_0x23d6('0xf')],_0x58243f[_0x23d6('0x10')]?_0x58243f[_0x23d6('0x10')]['id']:null,_0x58243f['user']?_0x58243f[_0x23d6('0x10')]['name']:null,_0x58243f[_0x23d6('0x10')]?_0x58243f[_0x23d6('0x10')]['role']:null,_0x49eee9?util[_0x23d6('0x11')](_0x49eee9,![],null):'');}}));_0x68d9d3[_0x23d6('0x12')](ewinston[_0x23d6('0x6')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x31ddaa,_0x4a402a){var _0x2e9cee=_0x23d6('0x13');if(_0x31ddaa[_0x23d6('0x8')]&&_0x31ddaa[_0x23d6('0x8')][_0x23d6('0x14')]&&_0x31ddaa['body']['agent_id']){_0x2e9cee=_0x23d6('0x15');}return util[_0x23d6('0x16')](_0x2e9cee,_0x31ddaa[_0x23d6('0x9')],_0x31ddaa['headers'][_0x23d6('0xa')]?_0x31ddaa['headers']['x-forwarded-for']:_0x31ddaa['connection'][_0x23d6('0x17')]||_0x31ddaa['ip'],_0x31ddaa['url'],_0x4a402a[_0x23d6('0xe')],_0x4a402a[_0x23d6('0xf')],_0x31ddaa[_0x23d6('0x10')]?_0x31ddaa['user']['id']:null,_0x31ddaa[_0x23d6('0x10')]?_0x31ddaa['user']['name']:null,_0x31ddaa[_0x23d6('0x10')]?_0x31ddaa[_0x23d6('0x10')]['role']:null,_0x31ddaa[_0x23d6('0x8')]&&_0x31ddaa['body'][_0x23d6('0x14')]?_0x31ddaa[_0x23d6('0x8')][_0x23d6('0x14')]:_0x23d6('0x18'),_0x31ddaa['body']&&_0x31ddaa[_0x23d6('0x8')]['agent_id']?_0x31ddaa[_0x23d6('0x8')][_0x23d6('0x19')]:'',_0x31ddaa['body']&&_0x31ddaa['body']['agent_name']?_0x31ddaa[_0x23d6('0x8')][_0x23d6('0x1a')]:'');},'ignoreRoute':function(_0x317aeb){var _0x462b32=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x462b32[_0x23d6('0x1b')](_0x317aeb[_0x23d6('0xd')]);}}));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x1c'),require(_0x23d6('0x1d')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x1e'),require(_0x23d6('0x1f')));_0x68d9d3[_0x23d6('0x12')]('/api/voice/contexts',require(_0x23d6('0x20')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x21'),require(_0x23d6('0x22')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x23'),require(_0x23d6('0x24')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x25'),require(_0x23d6('0x26')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x27'),require(_0x23d6('0x28')));_0x68d9d3[_0x23d6('0x12')]('/api/screen/recordings',require('./api/screenRecording'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x29'),require('./api/voiceMail'));_0x68d9d3[_0x23d6('0x12')]('/api/voice/mails/messages',require(_0x23d6('0x2a')));_0x68d9d3[_0x23d6('0x12')]('/api/voice/calls/reports',require(_0x23d6('0x2b')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x2c'),require(_0x23d6('0x2d')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x2e'),require(_0x23d6('0x2f')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x30'),require(_0x23d6('0x31')));_0x68d9d3['use'](_0x23d6('0x32'),require(_0x23d6('0x33')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x34'),require(_0x23d6('0x35')));_0x68d9d3['use'](_0x23d6('0x36'),require(_0x23d6('0x37')));_0x68d9d3[_0x23d6('0x12')]('/api/mail/out_servers',require(_0x23d6('0x38')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x39'),require(_0x23d6('0x3a')));_0x68d9d3['use']('/api/mail/queues',require(_0x23d6('0x3b')));_0x68d9d3['use'](_0x23d6('0x3c'),require(_0x23d6('0x3d')));_0x68d9d3['use'](_0x23d6('0x3e'),require('./api/mailInteraction'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x3f'),require(_0x23d6('0x40')));_0x68d9d3['use'](_0x23d6('0x41'),require(_0x23d6('0x42')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x43'),require('./api/mailQueueReport'));_0x68d9d3[_0x23d6('0x12')]('/api/dashboards',require(_0x23d6('0x44')));_0x68d9d3[_0x23d6('0x12')]('/api/dashboards/items',require(_0x23d6('0x45')));_0x68d9d3['use'](_0x23d6('0x46'),require(_0x23d6('0x47')));_0x68d9d3[_0x23d6('0x12')]('/api/fax/applications',require('./api/faxApplication'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x48'),require('./api/faxInteraction'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x49'),require(_0x23d6('0x4a')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x4b'),require(_0x23d6('0x4c')));_0x68d9d3['use'](_0x23d6('0x4d'),require('./api/faxQueueReport'));_0x68d9d3[_0x23d6('0x12')]('/api/sms/accounts',require('./api/smsAccount'));_0x68d9d3[_0x23d6('0x12')]('/api/sms/applications',require(_0x23d6('0x4e')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x4f'),require('./api/smsInteraction'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x50'),require(_0x23d6('0x51')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x52'),require('./api/smsQueue'));_0x68d9d3['use'](_0x23d6('0x53'),require(_0x23d6('0x54')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x55'),require(_0x23d6('0x56')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x57'),require(_0x23d6('0x58')));_0x68d9d3[_0x23d6('0x12')]('/api/openchannel/messages',require(_0x23d6('0x59')));_0x68d9d3['use'](_0x23d6('0x5a'),require(_0x23d6('0x5b')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x5c'),require(_0x23d6('0x5d')));_0x68d9d3['use'](_0x23d6('0x5e'),require(_0x23d6('0x5f')));_0x68d9d3[_0x23d6('0x12')]('/api/chat/applications',require(_0x23d6('0x60')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x61'),require(_0x23d6('0x62')));_0x68d9d3['use'](_0x23d6('0x63'),require('./api/chatMessage'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x64'),require('./api/chatOfflineMessage'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x65'),require(_0x23d6('0x66')));_0x68d9d3[_0x23d6('0x12')]('/api/chat/groups',require('./api/chatGroup'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x67'),require(_0x23d6('0x68')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x69'),require(_0x23d6('0x6a')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x6b'),require(_0x23d6('0x6c')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x6d'),require(_0x23d6('0x6e')));_0x68d9d3['use'](_0x23d6('0x6f'),require(_0x23d6('0x70')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x71'),require(_0x23d6('0x72')));_0x68d9d3[_0x23d6('0x12')]('/api/cm/hopper_history',require(_0x23d6('0x73')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x74'),require('./api/cmCustomField'));_0x68d9d3[_0x23d6('0x12')]('/api/actions',require('./api/action'));_0x68d9d3['use'](_0x23d6('0x75'),require(_0x23d6('0x76')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x77'),require(_0x23d6('0x78')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x79'),require('./api/disposition'));_0x68d9d3[_0x23d6('0x12')]('/api/conditions',require(_0x23d6('0x7a')));_0x68d9d3[_0x23d6('0x12')]('/api/intervals',require(_0x23d6('0x7b')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x7c'),require(_0x23d6('0x7d')));_0x68d9d3[_0x23d6('0x12')]('/api/cdr',require('./api/cdr'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x7e'),require('./api/voiceQueuesLog'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x7f'),require(_0x23d6('0x80')));_0x68d9d3[_0x23d6('0x12')]('/api/sounds',require(_0x23d6('0x81')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x82'),require('./api/tag'));_0x68d9d3['use'](_0x23d6('0x83'),require(_0x23d6('0x84')));_0x68d9d3['use'](_0x23d6('0x85'),require(_0x23d6('0x86')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x87'),require('./api/variable'));_0x68d9d3['use'](_0x23d6('0x88'),require(_0x23d6('0x89')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x8a'),require(_0x23d6('0x8b')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x8c'),require(_0x23d6('0x8d')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x8e'),require(_0x23d6('0x8f')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x90'),require(_0x23d6('0x91')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x92'),require(_0x23d6('0x93')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x94'),require(_0x23d6('0x95')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x96'),require(_0x23d6('0x97')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x98'),require(_0x23d6('0x99')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x9a'),require('./api/intSalesforceConfiguration'));_0x68d9d3['use']('/api/integrations/salesforce/fields',require(_0x23d6('0x9b')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x9c'),require(_0x23d6('0x9d')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x9e'),require('./api/intSugarcrmConfiguration'));_0x68d9d3[_0x23d6('0x12')]('/api/integrations/sugarcrm/fields',require(_0x23d6('0x9f')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xa0'),require(_0x23d6('0xa1')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xa2'),require('./api/intDeskConfiguration'));_0x68d9d3['use']('/api/integrations/desk/fields',require(_0x23d6('0xa3')));_0x68d9d3['use'](_0x23d6('0xa4'),require(_0x23d6('0xa5')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xa6'),require(_0x23d6('0xa7')));_0x68d9d3[_0x23d6('0x12')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xa8'),require('./api/intZendeskAccount'));_0x68d9d3['use'](_0x23d6('0xa9'),require(_0x23d6('0xaa')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xab'),require(_0x23d6('0xac')));_0x68d9d3['use'](_0x23d6('0xad'),require(_0x23d6('0xae')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xaf'),require(_0x23d6('0xb0')));_0x68d9d3['use'](_0x23d6('0xb1'),require(_0x23d6('0xb2')));_0x68d9d3['use']('/api/integrations/vtiger/accounts',require(_0x23d6('0xb3')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xb4'),require('./api/intVtigerConfiguration'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xb5'),require(_0x23d6('0xb6')));_0x68d9d3[_0x23d6('0x12')]('/api/integrations/servicenow/accounts',require(_0x23d6('0xb7')));_0x68d9d3[_0x23d6('0x12')]('/api/integrations/servicenow/configurations',require(_0x23d6('0xb8')));_0x68d9d3['use'](_0x23d6('0xb9'),require(_0x23d6('0xba')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xbb'),require(_0x23d6('0xbc')));_0x68d9d3[_0x23d6('0x12')]('/api/integrations/dynamics365/configurations',require(_0x23d6('0xbd')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xbe'),require(_0x23d6('0xbf')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xc0'),require(_0x23d6('0xc1')));_0x68d9d3['use'](_0x23d6('0xc2'),require(_0x23d6('0xc3')));_0x68d9d3['use'](_0x23d6('0xc4'),require(_0x23d6('0xc5')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xc6'),require('./api/network'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xc7'),require('./api/chatQueueReport'));_0x68d9d3['use'](_0x23d6('0xc8'),require(_0x23d6('0xc9')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xca'),require(_0x23d6('0xcb')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xcc'),require(_0x23d6('0xcd')));_0x68d9d3['use'](_0x23d6('0xce'),require('./api/jscriptySessionReport'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xcf'),require(_0x23d6('0xd0')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xd1'),require(_0x23d6('0xd2')));_0x68d9d3['use']('/api/square/details/reports',require(_0x23d6('0xd3')));_0x68d9d3[_0x23d6('0x12')]('/api/jscripty/projects',require(_0x23d6('0xd4')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xd5'),require('./api/setting'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xd6'),require(_0x23d6('0xd7')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xd8'),require(_0x23d6('0xd9')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xda'),require(_0x23d6('0xdb')));_0x68d9d3[_0x23d6('0x12')]('/api/square/messages',require(_0x23d6('0xdc')));_0x68d9d3['use']('/api/teams',require(_0x23d6('0xdd')));_0x68d9d3[_0x23d6('0x12')]('/api/license',require(_0x23d6('0xde')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xdf'),require(_0x23d6('0xe0')));_0x68d9d3[_0x23d6('0x12')]('/api/migrations',require(_0x23d6('0xe1')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xe2'),require(_0x23d6('0xe3')));_0x68d9d3['use']('/api/plugins',require(_0x23d6('0xe4')));_0x68d9d3['use'](_0x23d6('0xe5'),require(_0x23d6('0xe6')));_0x68d9d3[_0x23d6('0x12')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xe7'),require(_0x23d6('0xe8')));_0x68d9d3['use'](_0x23d6('0xe9'),require(_0x23d6('0xea')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xeb'),require(_0x23d6('0xec')));_0x68d9d3['use'](_0x23d6('0xed'),require('./api/cmList'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xee'),require(_0x23d6('0xef')));_0x68d9d3[_0x23d6('0x12')]('/api/userProfiles',require('./api/userProfile'));_0x68d9d3[_0x23d6('0x12')]('/api/userProfile/sections',require(_0x23d6('0xf0')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xf1'),require(_0x23d6('0xf2')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xf3'),require(_0x23d6('0xf4')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xf5'),require(_0x23d6('0xf6')));_0x68d9d3['use'](_0x23d6('0xf7'),require('./api/whatsappApplication'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xf8'),require(_0x23d6('0xf9')));_0x68d9d3['use'](_0x23d6('0xfa'),require(_0x23d6('0xfb')));_0x68d9d3[_0x23d6('0x12')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0xfc'),require(_0x23d6('0xfd')));_0x68d9d3['use'](_0x23d6('0xfe'),require(_0x23d6('0xff')));_0x68d9d3['use'](_0x23d6('0x100'),require(_0x23d6('0x101')));_0x68d9d3['use'](_0x23d6('0x102'),require(_0x23d6('0x103')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x104'),require(_0x23d6('0x105')));_0x68d9d3['use'](_0x23d6('0x106'),require('./api/authGoogle'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x107'),require(_0x23d6('0x108')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x109'),require(_0x23d6('0x10a')));_0x68d9d3[_0x23d6('0x12')]('/api/version',require(_0x23d6('0x10b')));_0x68d9d3['use'](_0x23d6('0x10c'),require('./api/system'));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x10d'),require(_0x23d6('0x10e')));_0x68d9d3['use'](_0x23d6('0x10f'),require(_0x23d6('0x110')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x111'),express['static'](path[_0x23d6('0x112')](config['root'],'/apidoc')));_0x68d9d3['use'](_0x23d6('0x113'),express['static'](path['join'](config[_0x23d6('0x114')],_0x23d6('0x113'))));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x115'),express['static'](path['join'](config[_0x23d6('0x114')],'/demo')));_0x68d9d3[_0x23d6('0x12')](_0x23d6('0x116'),express[_0x23d6('0x117')](path['join'](config[_0x23d6('0x114')],_0x23d6('0x118'),_0x23d6('0x119'))));_0x68d9d3['use'](_0x23d6('0x11a'),express[_0x23d6('0x117')](path['join'](config[_0x23d6('0x114')],_0x23d6('0x11b'))));_0x68d9d3[_0x23d6('0x11c')](_0x23d6('0x11d'))[_0x23d6('0x11e')](errors[0x194]);_0x68d9d3[_0x23d6('0x11c')]('/*')[_0x23d6('0x11e')](function(_0x12409b,_0x1a3528){_0x1a3528[_0x23d6('0x11f')](path['resolve'](_0x68d9d3[_0x23d6('0x11e')](_0x23d6('0x120'))+_0x23d6('0x121')));});};var sensitiveFields=[_0x23d6('0x122'),_0x23d6('0x123'),_0x23d6('0x124'),_0x23d6('0x125'),'firstName',_0x23d6('0x126'),_0x23d6('0x127'),_0x23d6('0x128'),_0x23d6('0x129'),_0x23d6('0x12a'),'email','clientId',_0x23d6('0x12b'),_0x23d6('0x12c'),_0x23d6('0x12d'),'accessKey',_0x23d6('0x12e'),_0x23d6('0x12f'),_0x23d6('0x130'),'accessToken',_0x23d6('0x131'),_0x23d6('0x132'),'consumerKey',_0x23d6('0x133'),_0x23d6('0x134'),'calleridname',_0x23d6('0x135'),_0x23d6('0x136'),_0x23d6('0x137'),_0x23d6('0x138'),_0x23d6('0x139'),_0x23d6('0x13a'),_0x23d6('0x13b'),_0x23d6('0x13c'),_0x23d6('0x10'),'pass','accountSid','localstationid',_0x23d6('0x13d'),'secret',_0x23d6('0x13e'),_0x23d6('0x13f')];function maskSensitiveData(_0x2772e6){var _0x5e66bb=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x2772e6))return;for(var _0x28f283 in _0x2772e6){if(_['isArray'](_0x2772e6[_0x28f283])){for(var _0x2d6c1f=0x0;_0x2d6c1f<_0x2772e6[_0x28f283][_0x23d6('0x140')];_0x2d6c1f++){maskSensitiveData(_0x2772e6[_0x28f283][_0x2d6c1f]);}}else if(_[_0x23d6('0x141')](_0x2772e6[_0x28f283])){maskSensitiveData(_0x2772e6[_0x28f283]);}else if(_['isString'](_0x2772e6[_0x28f283])){_0x2772e6[_0x28f283]=_0x2772e6[_0x28f283][_0x23d6('0x142')](/{{{/g,_0x23d6('0x143'))['replace'](/}}}/g,_0x23d6('0x144'))[_0x23d6('0x142')](/{{/g,'@{')[_0x23d6('0x142')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x28f283)){_0x2772e6[_0x28f283]=_0x2772e6[_0x28f283][_0x23d6('0x142')](_0x5e66bb,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a8c38eb..bf23fac 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x975d=['../api/whatsappQueue/whatsappQueue.rpc','server','port','rpc','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc'];(function(_0x1bda37,_0x2f4799){var _0x15fa7f=function(_0x4b0b96){while(--_0x4b0b96){_0x1bda37['push'](_0x1bda37['shift']());}};_0x15fa7f(++_0x2f4799);}(_0x975d,0x195));var _0xd975=function(_0x3a1eb9,_0x39ce80){_0x3a1eb9=_0x3a1eb9-0x0;var _0x439a29=_0x975d[_0x3a1eb9];return _0x439a29;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd975('0x0'));var _=require(_0xd975('0x1'));var config=require(_0xd975('0x2'));exports[_0xd975('0x3')]=function(){return new BPromise(function(_0x4948c9,_0x3ccd10){var _0xc9b29={};_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/user/user.rpc'));_0xc9b29=_['merge'](_0xc9b29,require(_0xd975('0x5')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x6')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x7')));_0xc9b29=_['merge'](_0xc9b29,require(_0xd975('0x8')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x9')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0xa')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/memberReport/memberReport.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0xb')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0xc')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/mailServerIn/mailServerIn.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0xd')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0xe')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/mailInteraction/mailInteraction.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0xf')));_0xc9b29=_['merge'](_0xc9b29,require('../api/mailApplication/mailApplication.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x10')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x11')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x12')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x13')));_0xc9b29=_['merge'](_0xc9b29,require(_0xd975('0x14')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x15')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x16')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x17')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/smsInteraction/smsInteraction.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/smsMessage/smsMessage.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x18')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x19')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0xc9b29=_['merge'](_0xc9b29,require('../api/openchannelMessage/openchannelMessage.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x1a')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x1b')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x1c')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/chatMessage/chatMessage.rpc'));_0xc9b29=_['merge'](_0xc9b29,require('../api/chatQueue/chatQueue.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x1d')));_0xc9b29=_['merge'](_0xc9b29,require(_0xd975('0x1e')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0xc9b29=_['merge'](_0xc9b29,require(_0xd975('0x1f')));_0xc9b29=_['merge'](_0xc9b29,require(_0xd975('0x20')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x21')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x22')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x23')));_0xc9b29=_['merge'](_0xc9b29,require(_0xd975('0x24')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x25')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/trigger/trigger.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/variable/variable.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x26')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x27')));_0xc9b29=_['merge'](_0xc9b29,require(_0xd975('0x28')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x29')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x2a')));_0xc9b29=_['merge'](_0xc9b29,require(_0xd975('0x2b')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xc9b29=_['merge'](_0xc9b29,require(_0xd975('0x2c')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x2d')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x2e')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/squareReport/squareReport.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x2f')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x30')));_0xc9b29=_['merge'](_0xc9b29,require('../api/squareOdbc/squareOdbc.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x31')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x32')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/squareMessage/squareMessage.rpc'));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x33')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require('../api/attachment/attachment.rpc'));_0xc9b29=_['merge'](_0xc9b29,require(_0xd975('0x34')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x35')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x36')));_0xc9b29=_['merge'](_0xc9b29,require(_0xd975('0x37')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x38')));_0xc9b29=_[_0xd975('0x4')](_0xc9b29,require(_0xd975('0x39')));var _0x2733d1=jayson[_0xd975('0x3a')](_0xc9b29)['http']();var _0x19d3f1=config['rpc'][_0xd975('0x3b')]||config['port']+0x1;var _0x33bf38=config[_0xd975('0x3c')]['ip']||'localhost';_0x2733d1['on'](_0xd975('0x3d'),function(_0x331758){return _0x3ccd10(_0x331758);});_0x2733d1['listen'](_0x19d3f1,_0x33bf38,function(){console[_0xd975('0x3e')](_0xd975('0x3f'),_0x33bf38,_0x19d3f1);require(_0xd975('0x40'))['default']();return _0x4948c9(_0xd975('0x41')+_0x33bf38+':'+_0x19d3f1);});});}; \ No newline at end of file +var _0x3ab7=['log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.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/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3ab7,0x8d));var _0x73ab=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0x3ab7[_0x1ac6e5];return _0x5877dc;};'use strict';var jayson=require(_0x73ab('0x0'));var BPromise=require(_0x73ab('0x1'));var _=require(_0x73ab('0x2'));var config=require(_0x73ab('0x3'));exports[_0x73ab('0x4')]=function(){return new BPromise(function(_0x2e0c55,_0x5b68bf){var _0x503c49={};_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x6')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x7')));_0x503c49=_['merge'](_0x503c49,require(_0x73ab('0x8')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/voiceRecording/voiceRecording.rpc'));_0x503c49=_['merge'](_0x503c49,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x9')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0xa')));_0x503c49=_['merge'](_0x503c49,require('../api/memberReport/memberReport.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0xb')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0xc')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0xd')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/mailServerIn/mailServerIn.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/mailAccount/mailAccount.rpc'));_0x503c49=_['merge'](_0x503c49,require(_0x73ab('0xe')));_0x503c49=_['merge'](_0x503c49,require(_0x73ab('0xf')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x10')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/mailApplication/mailApplication.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x11')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/faxApplication/faxApplication.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x12')));_0x503c49=_['merge'](_0x503c49,require('../api/faxMessage/faxMessage.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x13')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x14')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/smsAccount/smsAccount.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x15')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/smsMessage/smsMessage.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x16')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x503c49=_['merge'](_0x503c49,require(_0x73ab('0x17')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x18')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x19')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x1a')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/chatInteraction/chatInteraction.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x1b')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x1c')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x1d')));_0x503c49=_['merge'](_0x503c49,require('../api/cmHopper/cmHopper.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x1e')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x1f')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x20')));_0x503c49=_['merge'](_0x503c49,require(_0x73ab('0x21')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x22')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x23')));_0x503c49=_['merge'](_0x503c49,require(_0x73ab('0x24')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/template/template.rpc'));_0x503c49=_['merge'](_0x503c49,require(_0x73ab('0x25')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/variable/variable.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x26')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x27')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x28')));_0x503c49=_['merge'](_0x503c49,require(_0x73ab('0x29')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x2a')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x2b')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x2c')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x2d')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x2e')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x2f')));_0x503c49=_['merge'](_0x503c49,require(_0x73ab('0x30')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require('../api/squareReport/squareReport.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x31')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x32')));_0x503c49=_['merge'](_0x503c49,require(_0x73ab('0x33')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x34')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x35')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x36')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x37')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x38')));_0x503c49=_['merge'](_0x503c49,require('../api/plugin/plugin.rpc'));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x39')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x3a')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x3b')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x3c')));_0x503c49=_[_0x73ab('0x5')](_0x503c49,require(_0x73ab('0x3d')));var _0x5b449f=jayson[_0x73ab('0x3e')](_0x503c49)[_0x73ab('0x3f')]();var _0x51aec4=config['rpc'][_0x73ab('0x40')]||config[_0x73ab('0x40')]+0x1;var _0x2aea4e=config[_0x73ab('0x41')]['ip']||'localhost';_0x5b449f['on']('error',function(_0x45ccdf){return _0x5b68bf(_0x45ccdf);});_0x5b449f[_0x73ab('0x4')](_0x51aec4,_0x2aea4e,function(){console[_0x73ab('0x42')](_0x73ab('0x43'),_0x2aea4e,_0x51aec4);require(_0x73ab('0x44'))['default']();return _0x2e0c55('RPC\x20listening\x20on\x20'+_0x2aea4e+':'+_0x51aec4);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 3c7d0d5..7c620d2 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 _0x2369=['E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','streamFile','agi','exec','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./reply','setEncoding','utf8','setTimeout','headers','ready','toLowerCase','emit','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','result=','substr','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close'];(function(_0x2f3412,_0x2b8d24){var _0x4071d6=function(_0x5af33d){while(--_0x5af33d){_0x2f3412['push'](_0x2f3412['shift']());}};_0x4071d6(++_0x2b8d24);}(_0x2369,0x16a));var _0x9236=function(_0x5d8e3b,_0x59e6aa){_0x5d8e3b=_0x5d8e3b-0x0;var _0x42e192=_0x2369[_0x5d8e3b];return _0x42e192;};'use strict';var util=require(_0x9236('0x0'));var _=require(_0x9236('0x1'));var EventEmitter=require(_0x9236('0x2'))[_0x9236('0x3')];var AGIReply=require(_0x9236('0x4'));var AGIError=require('./error');function AGIChannel(_0x4398ed){var _0x312543=this,_0x3d118=new AGIReply(),_0x280cb7=![],_0x956706={};EventEmitter['call'](_0x312543);_0x4398ed[_0x9236('0x5')](_0x9236('0x6'));_0x4398ed[_0x9236('0x7')](0x8*0x3c*0x3c*0x3e8);_0x3d118[_0x9236('0x5')](_0x9236('0x6'));_0x3d118['on'](_0x9236('0x8'),function(_0x26cf07){for(var _0x5bd0da in _0x26cf07){_0x312543[_0x5bd0da]=_0x26cf07[_0x5bd0da];}_0x312543['emit'](_0x9236('0x9'));});_0x3d118['on']('line',function(_0x4db4ec){if(_0x4db4ec[_0x9236('0xa')]()=='hangup'){_0x312543[_0x9236('0xb')](_0x9236('0xc'));return;}if(_0x4db4ec[_0x9236('0xd')](0x0,0xb)=='520-Invalid'){_0x280cb7=!![];}if(_0x280cb7){_0x956706['rx']+=_0x4db4ec+'\x0a';if(_0x4db4ec[_0x9236('0xe')](_0x9236('0xf'))!=-0x1){_0x280cb7=![];}}else{_0x956706['rx']=_0x4db4ec;}if(_0x280cb7){return;}if(typeof _0x956706['cb']==_0x9236('0x10')){var _0x1e99ac=_0x956706['rx'][_0x9236('0xd')](0x0,0x3),_0x54af82=null,_0x4bbbf7=null;_0x1e99ac=parseInt(_0x1e99ac);if(isNaN(_0x1e99ac)){_0x956706['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9236('0x11')});return;}if(_0x1e99ac!=0xc8){_0x956706['cb'](null,{'code':_0x1e99ac,'result':-0x1,'extra':'KO'});return;}_0x54af82=_0x956706['rx'][_0x9236('0xd')](0x4)['replace'](_0x9236('0x12'),'');if(_0x54af82['indexOf']('\x20')!=-0x1){_0x54af82=_0x54af82[_0x9236('0x13')](0x0,_0x54af82[_0x9236('0x14')]('\x20'));}if(_[_0x9236('0x15')](_0x54af82,'-1')){_0x54af82=parseInt(_0x54af82);}_0x4bbbf7=_0x956706['rx'][_0x9236('0x16')]('\x20');if(_0x4bbbf7[_0x9236('0x17')]==0x3){_0x4bbbf7=_0x4bbbf7[0x2][_0x9236('0xd')](0x1,_0x4bbbf7[0x2][_0x9236('0x17')]-0x1);}else if(_0x4bbbf7['length']>0x3){var _0x1eed60=/\((.+)\)/;var _0x20e7c0=_0x956706['rx']['match'](_0x1eed60);if(_0x20e7c0){_0x4bbbf7=_0x20e7c0[0x1];}else{_0x4bbbf7=null;}}else{_0x4bbbf7=null;}_0x956706['cb'](null,{'code':_0x1e99ac,'result':_0x54af82,'extra':_0x4bbbf7});}});_0x4398ed['on']('error',function(_0x2973ca){_0x312543['emit'](_0x9236('0x18'),new AGIError(_0x9236('0x19'),_0x2973ca[_0x9236('0x1a')]));});_0x4398ed['on'](_0x9236('0x1b'),function(){_0x312543[_0x9236('0xb')](_0x9236('0x1b'),new AGIError(_0x9236('0x1c')));});_0x4398ed['on'](_0x9236('0x1d'),function(){_0x312543[_0x9236('0xb')]('timeout',new AGIError(_0x9236('0x1e')));_0x4398ed[_0x9236('0x1f')]();});_0x4398ed['pipe'](_0x3d118);this[_0x9236('0x20')]=function(_0x5698fd,_0x19a9db){var _0x5698fd=_0x5698fd||'',_0x19a9db=typeof _0x19a9db=='function'?_0x19a9db:new Function();_0x956706={'tx':_0x5698fd,'rx':'','cb':_0x19a9db};_0x4398ed[_0x9236('0x21')](_0x5698fd+'\x0a');},this[_0x9236('0x1b')]=function(){_0x4398ed[_0x9236('0x1f')]();};}util[_0x9236('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x9236('0x23')][_0x9236('0x24')]=function(_0x4f63c3){return this[_0x9236('0x20')][_0x9236('0x25')](this,_0x4f63c3);};AGIChannel['prototype'][_0x9236('0x26')]=function(){return this[_0x9236('0x24')](_0x9236('0x27'));};AGIChannel[_0x9236('0x23')][_0x9236('0x28')]=function(_0x368dc4,_0x71d224,_0x2758aa){_0x368dc4=_0x368dc4===undefined?_0x9236('0x29'):_0x368dc4;_0x71d224=_0x71d224===undefined?'5':_0x71d224;_0x2758aa=_0x2758aa===undefined?'1':_0x2758aa;return this[_0x9236('0x24')](util['format'](_0x9236('0x2a'),_0x368dc4,_0x71d224*0x3e8,_0x2758aa));};AGIChannel[_0x9236('0x23')][_0x9236('0x2b')]=function(_0x1cac0c){_0x1cac0c=_0x1cac0c||_0x9236('0x2c');return this[_0x9236('0x24')](util[_0x9236('0x2d')](_0x9236('0x2e'),_0x1cac0c));};AGIChannel[_0x9236('0x23')]['exec']=function(_0x20f328,_0x5afb6d){if(_[_0x9236('0x2f')](_0x5afb6d)){return this[_0x9236('0x24')](util[_0x9236('0x2d')](_0x9236('0x30'),_0x20f328,_0x5afb6d[_0x9236('0x31')](',')));}return this[_0x9236('0x24')](util[_0x9236('0x2d')](_0x9236('0x30'),_0x20f328,_0x5afb6d));};AGIChannel['prototype'][_0x9236('0x32')]=function(_0x49aa03){return this[_0x9236('0x24')](util[_0x9236('0x2d')]('SET\x20CONTEXT\x20%s',_0x49aa03));};AGIChannel[_0x9236('0x23')][_0x9236('0x33')]=function(_0x581cf3){return this[_0x9236('0x24')](util[_0x9236('0x2d')](_0x9236('0x34'),_0x581cf3));};AGIChannel['prototype']['setPriority']=function(_0x3de1a6){return this[_0x9236('0x24')](util[_0x9236('0x2d')](_0x9236('0x35'),_0x3de1a6));};AGIChannel[_0x9236('0x23')][_0x9236('0xc')]=function(){return this[_0x9236('0x24')](_0x9236('0x36'));};AGIChannel[_0x9236('0x23')][_0x9236('0x37')]=function(_0x3c67e6,_0x4b2c75){var _0x4cdc40=_[_0x9236('0x38')](_0x4b2c75)||_[_0x9236('0x39')](_0x4b2c75)?_0x4b2c75[_0x9236('0x3a')]():_0x4b2c75;return this[_0x9236('0x24')](util[_0x9236('0x2d')](_0x9236('0x3b'),_0x3c67e6,_0x4cdc40?_0x4cdc40['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9236('0x23')][_0x9236('0x3c')]=function(_0x48886d,_0x12b52b){return this[_0x9236('0x24')](util['format'](_0x9236('0x3d'),_0x48886d,_0x12b52b));};AGIChannel[_0x9236('0x23')][_0x9236('0x3e')]=function(_0x4b6d28,_0x292295){return this[_0x9236('0x24')](util[_0x9236('0x2d')](_0x9236('0x3f'),_0x4b6d28,_0x292295));};AGIChannel['prototype'][_0x9236('0x40')]=function(_0x3202c8,_0x55a7f2){return this[_0x9236('0x24')](util[_0x9236('0x2d')](_0x9236('0x41'),_0x3202c8,_0x55a7f2));};AGIChannel[_0x9236('0x23')][_0x9236('0x42')]=function(_0x30c573,_0x444aa1,_0x215106){_0x444aa1=_0x444aa1||this['extension'];_0x215106=_0x215106||0x1;this['setContext'](_0x30c573);this[_0x9236('0x33')](_0x444aa1);this['setPriority'](_0x215106);return this[_0x9236('0x2b')](util[_0x9236('0x2d')](_0x9236('0x43'),_0x30c573,_0x444aa1,_0x215106));};AGIChannel[_0x9236('0x23')][_0x9236('0x44')]=function(_0x580a16){return this[_0x9236('0x24')](util[_0x9236('0x2d')](_0x9236('0x45'),_0x580a16));};AGIChannel['prototype'][_0x9236('0x46')]=function(_0x417a12,_0x166678,_0x5672cf,_0x28f3ce,_0x2080aa,_0x399c8a){_0x166678=_0x166678||'wav';_0x5672cf=_0x5672cf||'';_0x28f3ce=_0x28f3ce===undefined?-0x1:_0x28f3ce==='-1'?-0x1:_0x28f3ce*0x3e8;_0x2080aa=_0x2080aa===undefined?'':'s='+_0x2080aa;_0x399c8a=_0x399c8a?'BEEP':'';return this[_0x9236('0x24')](util[_0x9236('0x2d')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x417a12,_0x166678,_0x5672cf,_0x28f3ce,_0x399c8a,_0x2080aa));};AGIChannel[_0x9236('0x23')][_0x9236('0x47')]=function(_0x4a6899,_0x4e6fbe){_0x4e6fbe=_0x4e6fbe||'';return this[_0x9236('0x24')](util[_0x9236('0x2d')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4a6899,_0x4e6fbe));};AGIChannel[_0x9236('0x23')][_0x9236('0x48')]=function(_0x37312c){return this[_0x9236('0x49')](_0x9236('0x4a'),_0x37312c);};AGIChannel['prototype'][_0x9236('0x4b')]=function(_0x1a3024){return this[_0x9236('0x49')]('WAIT',_0x1a3024);};AGIChannel[_0x9236('0x23')]['error']=function(_0x316f94,_0x2cd4c0){this[_0x9236('0x2b')](util[_0x9236('0x2d')](_0x9236('0x4c'),_0x316f94['id'],_0x316f94['label'],_0x2cd4c0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9236('0x4d')]=AGIChannel; \ No newline at end of file +var _0x5993=['exports','util','lodash','events','./error','call','setEncoding','headers','emit','ready','line','toLowerCase','substring','520-Invalid','replace','result=','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','command','function','write','destroy','inherits','sendRequest','prototype','getData','format','noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','hangup','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','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','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s'];(function(_0x3fc6b1,_0x284913){var _0x5dd89b=function(_0x3b09e7){while(--_0x3b09e7){_0x3fc6b1['push'](_0x3fc6b1['shift']());}};_0x5dd89b(++_0x284913);}(_0x5993,0x1ab));var _0x3599=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x5993[_0x55e08b];return _0xd1a7ff;};'use strict';var util=require(_0x3599('0x0'));var _=require(_0x3599('0x1'));var EventEmitter=require(_0x3599('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x3599('0x3'));function AGIChannel(_0x3baf11){var _0x5dc63d=this,_0x14522f=new AGIReply(),_0xd3f533=![],_0x27cdc8={};EventEmitter[_0x3599('0x4')](_0x5dc63d);_0x3baf11[_0x3599('0x5')]('utf8');_0x3baf11['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x14522f[_0x3599('0x5')]('utf8');_0x14522f['on'](_0x3599('0x6'),function(_0x195e42){for(var _0xfb16e9 in _0x195e42){_0x5dc63d[_0xfb16e9]=_0x195e42[_0xfb16e9];}_0x5dc63d[_0x3599('0x7')](_0x3599('0x8'));});_0x14522f['on'](_0x3599('0x9'),function(_0x58f85e){if(_0x58f85e[_0x3599('0xa')]()=='hangup'){_0x5dc63d[_0x3599('0x7')]('hangup');return;}if(_0x58f85e[_0x3599('0xb')](0x0,0xb)==_0x3599('0xc')){_0xd3f533=!![];}if(_0xd3f533){_0x27cdc8['rx']+=_0x58f85e+'\x0a';if(_0x58f85e['search']('520\x20End\x20of\x20proper')!=-0x1){_0xd3f533=![];}}else{_0x27cdc8['rx']=_0x58f85e;}if(_0xd3f533){return;}if(typeof _0x27cdc8['cb']=='function'){var _0x16a0b8=_0x27cdc8['rx'][_0x3599('0xb')](0x0,0x3),_0x2c13b6=null,_0x1b3533=null;_0x16a0b8=parseInt(_0x16a0b8);if(isNaN(_0x16a0b8)){_0x27cdc8['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x16a0b8!=0xc8){_0x27cdc8['cb'](null,{'code':_0x16a0b8,'result':-0x1,'extra':'KO'});return;}_0x2c13b6=_0x27cdc8['rx'][_0x3599('0xb')](0x4)[_0x3599('0xd')](_0x3599('0xe'),'');if(_0x2c13b6[_0x3599('0xf')]('\x20')!=-0x1){_0x2c13b6=_0x2c13b6[_0x3599('0x10')](0x0,_0x2c13b6[_0x3599('0xf')]('\x20'));}if(_[_0x3599('0x11')](_0x2c13b6,'-1')){_0x2c13b6=parseInt(_0x2c13b6);}_0x1b3533=_0x27cdc8['rx']['split']('\x20');if(_0x1b3533[_0x3599('0x12')]==0x3){_0x1b3533=_0x1b3533[0x2][_0x3599('0xb')](0x1,_0x1b3533[0x2][_0x3599('0x12')]-0x1);}else if(_0x1b3533['length']>0x3){var _0x1232f8=/\((.+)\)/;var _0x55a909=_0x27cdc8['rx']['match'](_0x1232f8);if(_0x55a909){_0x1b3533=_0x55a909[0x1];}else{_0x1b3533=null;}}else{_0x1b3533=null;}_0x27cdc8['cb'](null,{'code':_0x16a0b8,'result':_0x2c13b6,'extra':_0x1b3533});}});_0x3baf11['on'](_0x3599('0x13'),function(_0x4d8cc5){_0x5dc63d[_0x3599('0x7')](_0x3599('0x13'),new AGIError(_0x3599('0x14'),_0x4d8cc5[_0x3599('0x15')]));});_0x3baf11['on'](_0x3599('0x16'),function(){_0x5dc63d['emit'](_0x3599('0x16'),new AGIError(_0x3599('0x17')));});_0x3baf11['on'](_0x3599('0x18'),function(){_0x5dc63d['emit'](_0x3599('0x18'),new AGIError(_0x3599('0x19')));_0x3baf11['destroy']();});_0x3baf11['pipe'](_0x14522f);this[_0x3599('0x1a')]=function(_0xd203a5,_0x22f77a){var _0xd203a5=_0xd203a5||'',_0x22f77a=typeof _0x22f77a==_0x3599('0x1b')?_0x22f77a:new Function();_0x27cdc8={'tx':_0xd203a5,'rx':'','cb':_0x22f77a};_0x3baf11[_0x3599('0x1c')](_0xd203a5+'\x0a');},this[_0x3599('0x16')]=function(){_0x3baf11[_0x3599('0x1d')]();};}util[_0x3599('0x1e')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x3599('0x1f')]=function(_0x5fc8c2){return this[_0x3599('0x1a')]['sync'](this,_0x5fc8c2);};AGIChannel[_0x3599('0x20')]['answer']=function(){return this[_0x3599('0x1f')]('ANSWER');};AGIChannel[_0x3599('0x20')][_0x3599('0x21')]=function(_0x4f388f,_0x140e97,_0x4ec224){_0x4f388f=_0x4f388f===undefined?'beep':_0x4f388f;_0x140e97=_0x140e97===undefined?'5':_0x140e97;_0x4ec224=_0x4ec224===undefined?'1':_0x4ec224;return this[_0x3599('0x1f')](util[_0x3599('0x22')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x4f388f,_0x140e97*0x3e8,_0x4ec224));};AGIChannel[_0x3599('0x20')][_0x3599('0x23')]=function(_0x5cbfe1){_0x5cbfe1=_0x5cbfe1||_0x3599('0x24');return this['sendRequest'](util[_0x3599('0x22')]('VERBOSE\x20\x22%s\x22',_0x5cbfe1));};AGIChannel[_0x3599('0x20')][_0x3599('0x25')]=function(_0x483973,_0x46cd63){if(_[_0x3599('0x26')](_0x46cd63)){return this[_0x3599('0x1f')](util['format'](_0x3599('0x27'),_0x483973,_0x46cd63[_0x3599('0x28')](',')));}return this[_0x3599('0x1f')](util[_0x3599('0x22')](_0x3599('0x27'),_0x483973,_0x46cd63));};AGIChannel['prototype'][_0x3599('0x29')]=function(_0x1705e2){return this[_0x3599('0x1f')](util['format']('SET\x20CONTEXT\x20%s',_0x1705e2));};AGIChannel[_0x3599('0x20')][_0x3599('0x2a')]=function(_0x5b8505){return this[_0x3599('0x1f')](util[_0x3599('0x22')](_0x3599('0x2b'),_0x5b8505));};AGIChannel[_0x3599('0x20')][_0x3599('0x2c')]=function(_0x4faee2){return this[_0x3599('0x1f')](util[_0x3599('0x22')]('SET\x20PRIORITY\x20%s',_0x4faee2));};AGIChannel['prototype'][_0x3599('0x2d')]=function(){return this[_0x3599('0x1f')]('HANGUP');};AGIChannel['prototype']['setVariable']=function(_0x27127a,_0xc6c48b){var _0x28e5bd=_['isBoolean'](_0xc6c48b)||_[_0x3599('0x2e')](_0xc6c48b)?_0xc6c48b[_0x3599('0x2f')]():_0xc6c48b;return this[_0x3599('0x1f')](util[_0x3599('0x22')](_0x3599('0x30'),_0x27127a,_0x28e5bd?_0x28e5bd[_0x3599('0x2f')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3599('0x20')][_0x3599('0x31')]=function(_0x4c5cfe,_0x4920f9){return this[_0x3599('0x1f')](util[_0x3599('0x22')](_0x3599('0x32'),_0x4c5cfe,_0x4920f9));};AGIChannel['prototype'][_0x3599('0x33')]=function(_0x183104,_0x36dfda){return this['sendRequest'](util[_0x3599('0x22')](_0x3599('0x34'),_0x183104,_0x36dfda));};AGIChannel[_0x3599('0x20')][_0x3599('0x35')]=function(_0x224e2f,_0x127422){return this[_0x3599('0x1f')](util[_0x3599('0x22')](_0x3599('0x36'),_0x224e2f,_0x127422));};AGIChannel['prototype'][_0x3599('0x37')]=function(_0x1730e0,_0x13dcd3,_0x19cae2){_0x13dcd3=_0x13dcd3||this[_0x3599('0x38')];_0x19cae2=_0x19cae2||0x1;this['setContext'](_0x1730e0);this[_0x3599('0x2a')](_0x13dcd3);this[_0x3599('0x2c')](_0x19cae2);return this[_0x3599('0x23')](util[_0x3599('0x22')](_0x3599('0x39'),_0x1730e0,_0x13dcd3,_0x19cae2));};AGIChannel[_0x3599('0x20')][_0x3599('0x3a')]=function(_0x4ee689){return this[_0x3599('0x1f')](util[_0x3599('0x22')](_0x3599('0x3b'),_0x4ee689));};AGIChannel['prototype'][_0x3599('0x3c')]=function(_0x1714b9,_0x342856,_0x584a0b,_0x17f8c5,_0xa87f1e,_0x42bb9a){_0x342856=_0x342856||_0x3599('0x3d');_0x584a0b=_0x584a0b||'';_0x17f8c5=_0x17f8c5===undefined?-0x1:_0x17f8c5==='-1'?-0x1:_0x17f8c5*0x3e8;_0xa87f1e=_0xa87f1e===undefined?'':'s='+_0xa87f1e;_0x42bb9a=_0x42bb9a?_0x3599('0x3e'):'';return this['sendRequest'](util[_0x3599('0x22')](_0x3599('0x3f'),_0x1714b9,_0x342856,_0x584a0b,_0x17f8c5,_0x42bb9a,_0xa87f1e));};AGIChannel[_0x3599('0x20')]['streamFile']=function(_0x278ad5,_0x3ae71d){_0x3ae71d=_0x3ae71d||'';return this[_0x3599('0x1f')](util[_0x3599('0x22')](_0x3599('0x40'),_0x278ad5,_0x3ae71d));};AGIChannel[_0x3599('0x20')][_0x3599('0x41')]=function(_0x35eb8f){return this['exec'](_0x3599('0x42'),_0x35eb8f);};AGIChannel['prototype'][_0x3599('0x43')]=function(_0x2bbe16){return this['exec'](_0x3599('0x44'),_0x2bbe16);};AGIChannel['prototype']['error']=function(_0x24c0c4,_0x668209){this['noop'](util[_0x3599('0x22')](_0x3599('0x45'),_0x24c0c4['id'],_0x24c0c4['label'],_0x668209));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3599('0x46')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index cf3a31a..ef82a14 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 _0x9157=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','message','name','exports','Undefined\x20error.'];(function(_0x4b0e44,_0x1a8677){var _0x3c1b24=function(_0x598244){while(--_0x598244){_0x4b0e44['push'](_0x4b0e44['shift']());}};_0x3c1b24(++_0x1a8677);}(_0x9157,0x1bf));var _0x7915=function(_0x256422,_0x367394){_0x256422=_0x256422-0x0;var _0x55dddc=_0x9157[_0x256422];return _0x55dddc;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x7915('0x0'),'E_AGI_ARGUMENT_PORT':_0x7915('0x1'),'E_AGI_SERVER_ERROR':_0x7915('0x2'),'E_AGI_SERVER_CLOSE':_0x7915('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x7915('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x7915('0x5'),'E_AGI_SOCKET_ERROR':_0x7915('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x7915('0x7'),'E_AGI_COMMAND_EMPTY':_0x7915('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7915('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x11d1a2){var _0x11d1a2=_0x11d1a2||null,_0x2c7bb4=_0x2c7bb4||[],_0x5a006a=0x1,_0x35dbe4='';if(!error[_0x11d1a2]){_0x11d1a2=_0x7915('0xa');}_0x2c7bb4[_0x7915('0xb')](error[_0x11d1a2]);while(arguments[_0x5a006a]){_0x2c7bb4[_0x7915('0xb')](arguments[_0x5a006a]);_0x5a006a++;}_0x35dbe4=util['format'][_0x7915('0xc')](util,_0x2c7bb4);this[_0x7915('0xd')]=_0x35dbe4;this[_0x7915('0xe')]=_0x11d1a2;}module[_0x7915('0xf')]=AGIError; \ No newline at end of file +var _0xa568=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','name','exports','util'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0xa568,0x77));var _0x8a56=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xa568[_0x1cc8fe];return _0x230054;};'use strict';var util=require(_0x8a56('0x0'));var error={'E_AGI_UNDEFINED':_0x8a56('0x1'),'E_AGI_ARGUMENT_PORT':_0x8a56('0x2'),'E_AGI_SERVER_ERROR':_0x8a56('0x3'),'E_AGI_SERVER_CLOSE':_0x8a56('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x8a56('0x5'),'E_AGI_SOCKET_ERROR':_0x8a56('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x8a56('0x7'),'E_AGI_COMMAND_EMPTY':_0x8a56('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8a56('0x9'),'E_AGI_IVR_ENTRY':_0x8a56('0xa')};function AGIError(_0x2ce885){var _0x2ce885=_0x2ce885||null,_0x15dacb=_0x15dacb||[],_0x2c62f6=0x1,_0x53e72d='';if(!error[_0x2ce885]){_0x2ce885=_0x8a56('0xb');}_0x15dacb['push'](error[_0x2ce885]);while(arguments[_0x2c62f6]){_0x15dacb['push'](arguments[_0x2c62f6]);_0x2c62f6++;}_0x53e72d=util[_0x8a56('0xc')]['apply'](util,_0x15dacb);this['message']=_0x53e72d;this[_0x8a56('0xd')]=_0x2ce885;}module[_0x8a56('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index ccc9f2c..999087e 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 _0x5ba6=['condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','menu','getdigits','getsecretdigits','numberOfEdges','prototype','addVertex','vertices','edges','addEdge','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available'];(function(_0x407f35,_0x3c91a9){var _0x213efb=function(_0x329ebc){while(--_0x329ebc){_0x407f35['push'](_0x407f35['shift']());}};_0x213efb(++_0x3c91a9);}(_0x5ba6,0x1be));var _0x65ba=function(_0x2f6205,_0x3ba5ea){_0x2f6205=_0x2f6205-0x0;var _0xb1ded7=_0x5ba6[_0x2f6205];return _0xb1ded7;};'use strict';var _=require(_0x65ba('0x0'));var logger=require(_0x65ba('0x1'))('agi');var verticesWithRetry=[_0x65ba('0x2'),_0x65ba('0x3'),_0x65ba('0x4')];var Graph=function(){this['vertices']={};this['edges']={};this[_0x65ba('0x5')]=0x0;};Graph[_0x65ba('0x6')][_0x65ba('0x7')]=function(_0xb9067a){this[_0x65ba('0x8')][_0xb9067a['id']]=_0xb9067a;this[_0x65ba('0x9')][_0xb9067a['id']]=[];};Graph[_0x65ba('0x6')][_0x65ba('0xa')]=function(_0x7cab2b,_0x5aef4e,_0x3c726b){this[_0x65ba('0x9')][_0x7cab2b]['push']({'target':_0x5aef4e,'condition':_0x3c726b});this[_0x65ba('0x5')]+=0x1;};Graph[_0x65ba('0x6')][_0x65ba('0xb')]=function(){return _[_0x65ba('0xb')](this['vertices']);};Graph[_0x65ba('0x6')][_0x65ba('0xc')]=function(){return this[_0x65ba('0x5')];};Graph[_0x65ba('0x6')][_0x65ba('0xd')]=function(_0x36d152){return this['vertices'][_0x36d152];};Graph['prototype'][_0x65ba('0xe')]=function(_0x5e0a41,_0x10cff5){if(!this[_0x65ba('0x8')][_0x5e0a41]){return logger[_0x65ba('0xf')]('no\x20vertex\x20found');}var _0x194d89=_0x10cff5(this['vertices'][_0x5e0a41]);if(!_0x194d89){return logger[_0x65ba('0xf')](_0x65ba('0x10'));}if(this['edges'][_0x5e0a41][_0x65ba('0x11')]===0x0){return logger['info'](_0x65ba('0x12'));}for(var _0x20aece=0x0,_0x5f004b=[],_0x481198=![];_0x20aece\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','addEdge','getSquareProject','then','createSquareReport','catch','indexOf','agi_','substring','inspect','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','clear','agicommand','context','extension','priority','response','result','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','lodash','syncho','util','moment'];(function(_0x330740,_0x58c0c0){var _0x1cb5f2=function(_0xa5c99a){while(--_0xa5c99a){_0x330740['push'](_0x330740['shift']());}};_0x1cb5f2(++_0x58c0c0);}(_0x7422,0x1b8));var _0x2742=function(_0x2efea1,_0x338a72){_0x2efea1=_0x2efea1-0x0;var _0x21ec08=_0x7422[_0x2efea1];return _0x21ec08;};'use strict';var parser=require(_0x2742('0x0'));var _=require(_0x2742('0x1'));var syncho=require(_0x2742('0x2'));var util=require(_0x2742('0x3'));var moment=require(_0x2742('0x4'));var config=require('../../config/environment');var logger=require(_0x2742('0x5'))(_0x2742('0x6'));var utilLicense=require(_0x2742('0x7'));var rpc=require(_0x2742('0x8'));var mailRpc=require(_0x2742('0x9'));var Graph=require(_0x2742('0xa'));var Vertices=require(_0x2742('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x2742('0x6')]=_[_0x2742('0xc')](config[_0x2742('0x6')],{'ip':_0x2742('0xd'),'port':0x11dd});function connectionHandler(_0x5eb915){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5eb915);agiHandler(_0x5eb915);}catch(_0x302436){logger[_0x2742('0xe')](_0x302436[_0x2742('0xf')]);}});});}function listeningHandler(){console[_0x2742('0x10')](_0x2742('0x11'),config[_0x2742('0x6')][_0x2742('0x12')]);logger[_0x2742('0x13')](util[_0x2742('0x14')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x2742('0x6')]['ip'],config[_0x2742('0x6')][_0x2742('0x12')]));}function errorHandler(_0x4fc442){if(_0x4fc442&&_0x4fc442['name']&&_0x4fc442['message']){logger[_0x2742('0xe')](util['format'](_0x2742('0x15'),_0x4fc442['name'],_0x4fc442[_0x2742('0x16')]));}else{logger[_0x2742('0xe')](util[_0x2742('0x14')](_0x2742('0x17'),_0x4fc442[_0x2742('0xf')]));}}function closeHandler(){logger[_0x2742('0x13')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2742('0x18')],this[_0x2742('0x19')],this[_0x2742('0x1a')],this[_0x2742('0x1b')],this[_0x2742('0x1c')]));try{createSquareReport(this);}catch(_0x2ca726){logger[_0x2742('0xe')](_0x2ca726[_0x2742('0xf')]);}}function timeoutHandler(){logger['info'](util[_0x2742('0x14')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2742('0x18')],this['calleridname'],this[_0x2742('0x1a')],this['dnid'],this[_0x2742('0x1c')]));}function hangupHandler(){logger[_0x2742('0x13')](util['format'](_0x2742('0x1d'),this[_0x2742('0x18')],this[_0x2742('0x19')],this[_0x2742('0x1a')],this['dnid'],this[_0x2742('0x1c')]));this[_0x2742('0x1e')]=!![];}function getRoot(_0x54c9df){return parser[_0x2742('0x1f')](_0x54c9df,{'object':!![]})[_0x2742('0x20')][_0x2742('0x21')];}function addVertex(_0x345d7d,_0x100121,_0x5447c3){_0x100121['agicommand']=_0x5447c3;if(_0x100121[_0x2742('0x22')](_0x2742('0x23'))){_0x100121[_0x2742('0x24')]=parseInt(_0x100121[_0x2742('0x23')],0xa);}_0x345d7d[_0x2742('0x25')](_[_0x2742('0x26')](_0x100121,_0x2742('0x27')));}function initGraph(_0x32ab90,_0x2b1d9f){var _0x4c4dd1=new Graph();for(var _0x1cbc03 in _0x32ab90){if(_0x32ab90[_0x2742('0x22')](_0x1cbc03)){if(_['isArray'](_0x32ab90[_0x1cbc03])){for(var _0x3d528f=0x0;_0x3d528f<_0x32ab90[_0x1cbc03][_0x2742('0x28')];_0x3d528f+=0x1){addVertex(_0x4c4dd1,_0x32ab90[_0x1cbc03][_0x3d528f],_0x1cbc03);}}else{addVertex(_0x4c4dd1,_0x32ab90[_0x1cbc03],_0x1cbc03);}}}for(var _0x3e32ed=0x0;_0x3e32ed<_0x2b1d9f['length'];_0x3e32ed+=0x1){if(_0x2b1d9f[_0x3e32ed][_0x2742('0x29')]&&_0x2b1d9f[_0x3e32ed][_0x2742('0x2a')]){_0x4c4dd1[_0x2742('0x2b')](_0x2b1d9f[_0x3e32ed]['source'],_0x2b1d9f[_0x3e32ed]['target'],_0x2b1d9f[_0x3e32ed]['value']);}}return _0x4c4dd1;}function getSquareProject(_0x3b65bc,_0x3e3582){rpc[_0x2742('0x2c')](_0x3b65bc)[_0x2742('0x2d')](function(_0x5dc8e3){_0x3e3582(null,_0x5dc8e3);})['catch'](function(_0x1afaad){_0x3e3582(null,_0x1afaad);});}function createSquareReport(_0x13d11b,_0x388eff){rpc[_0x2742('0x2e')](_0x13d11b)[_0x2742('0x2d')](function(_0x252f80){if(_0x388eff){_0x388eff(null,_0x252f80);}})[_0x2742('0x2f')](function(_0x3698db){if(_0x388eff){_0x388eff(null,_0x3698db);}});}function setChannelVariables(_0x4a4134){for(var _0x294b31 in _0x4a4134){if(_0x4a4134[_0x2742('0x22')](_0x294b31)){if(_0x294b31[_0x2742('0x30')](_0x2742('0x31'))===0x0){_0x4a4134[_0x294b31[_0x2742('0x32')](0x4)]=_0x4a4134[_0x294b31];delete _0x4a4134[_0x294b31];}}}}function getLogFromObject(_0x36b719){return util[_0x2742('0x33')](_0x36b719,{'showHidden':![],'depth':null});}function agiHandler(_0x9b853f){var _0xfa3e30,_0x53d069,_0x5090db,_0x5850b1,_0x3ce6da;logger[_0x2742('0x34')](_0x2742('0x35'),JSON['stringify'](_0x9b853f,null,0x2));logger[_0x2742('0x13')](util[_0x2742('0x14')](_0x2742('0x36'),_0x9b853f[_0x2742('0x18')],_0x9b853f['calleridname'],_0x9b853f[_0x2742('0x1a')],_0x9b853f[_0x2742('0x1b')],_0x9b853f['uniqueid']));_0x9b853f['on'](_0x2742('0xe'),errorHandler);_0x9b853f['on'](_0x2742('0x37'),closeHandler);_0x9b853f['on'](_0x2742('0x38'),timeoutHandler);_0x9b853f[_0x2742('0x1e')]=![];_0x9b853f['on'](_0x2742('0x39'),hangupHandler);var _0x4c1084=getSquareProject[_0x2742('0x3a')](null,_0x9b853f[_0x2742('0x18')]);if(_0x4c1084){if(_0x4c1084['production']){_0xfa3e30=getRoot(_0x4c1084[_0x2742('0x3b')]);if(_0xfa3e30&&_0xfa3e30[_0x2742('0x3c')]){logger[_0x2742('0x34')](_0x2742('0x21'),JSON[_0x2742('0x3d')](_0xfa3e30,null,0x2));_0x9b853f[_0x2742('0x3e')]=moment()[_0x2742('0x14')](_0x2742('0x3f'));_0x53d069=initGraph(_['omit'](_0xfa3e30,'mxCell'),_0xfa3e30['mxCell']);_0x5090db=new Vertices(_0x9b853f,rpc,mailRpc);logger['info'](util[_0x2742('0x14')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x9b853f['arg_1'],_0x9b853f['calleridname'],_0x9b853f[_0x2742('0x1a')],_0x9b853f[_0x2742('0x1b')],_0x9b853f[_0x2742('0x1c')]));_0x53d069['traverseBFS'](_0xfa3e30[_0x2742('0x3c')]['id'],function(_0x19c5d9){try{_0x19c5d9=_0x5090db[_0x2742('0x40')](_0x19c5d9);logger[_0x2742('0x34')]('vertex',JSON[_0x2742('0x3d')](_0x19c5d9,null,0x2));if(_0x19c5d9[_0x2742('0x41')]==='gotoc'){logger[_0x2742('0x13')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x9b853f[_0x2742('0x42')]=_0x19c5d9[_0x2742('0x42')]||_0x9b853f[_0x2742('0x42')];_0x9b853f[_0x2742('0x43')]=_0x19c5d9[_0x2742('0x43')];_0x9b853f[_0x2742('0x44')]=_0x19c5d9[_0x2742('0x44')]?_0x19c5d9[_0x2742('0x44')]-0x1:0x1;return null;}else if(_0x19c5d9&&_0x5090db[_0x19c5d9[_0x2742('0x41')]]){_0x3ce6da=_0x5090db[_0x19c5d9['agicommand']](_0x19c5d9);logger['info'](_0x2742('0x45'),JSON['stringify'](_0x3ce6da,null,0x2));if(_0x3ce6da&&_0x3ce6da['code']===AGI_CODE_SUCCESS&&_0x3ce6da[_0x2742('0x46')]!==AGI_RESULT_ERROR&&!_0x9b853f['evtHangup']){logger[_0x2742('0x34')](_0x2742('0x45'),getLogFromObject(_0x3ce6da));return _[_0x2742('0x47')](_0x3ce6da[_0x2742('0x46')])?null:_0x3ce6da[_0x2742('0x46')][_0x2742('0x48')]();}else{logger[_0x2742('0xe')](_0x2742('0x45'),getLogFromObject(_0x3ce6da));return null;}}else{logger[_0x2742('0xe')]('agicommand\x20not\x20found');return null;}}catch(_0x5575af){logger['error'](_0x5575af[_0x2742('0xf')]);return null;}});if(_0xfa3e30[_0x2742('0x49')]){logger[_0x2742('0x13')](util[_0x2742('0x14')](_0x2742('0x4a'),_0x9b853f[_0x2742('0x18')],_0x9b853f[_0x2742('0x19')],_0x9b853f[_0x2742('0x1a')],_0x9b853f['dnid'],_0x9b853f[_0x2742('0x1c')]));_0x53d069[_0x2742('0x4b')](_0xfa3e30[_0x2742('0x49')]['id'],function(_0x4fbb49){try{_0x4fbb49=_0x5090db[_0x2742('0x40')](_0x4fbb49);logger[_0x2742('0x34')](_0x2742('0x4c'),JSON[_0x2742('0x3d')](_0x4fbb49,null,0x2));if(_0x4fbb49&&_0x5090db[_0x4fbb49[_0x2742('0x41')]]){_0x3ce6da=_0x5090db[_0x4fbb49[_0x2742('0x41')]](_0x4fbb49);if(_0x3ce6da){logger[_0x2742('0x34')](_0x2742('0x45'),getLogFromObject(_0x3ce6da));return _[_0x2742('0x47')](_0x3ce6da[_0x2742('0x46')])?null:_0x3ce6da[_0x2742('0x46')]['toString']();}else{logger[_0x2742('0xe')](_0x2742('0x45'),getLogFromObject(_0x3ce6da));return null;}}else{logger['error'](_0x2742('0x4d'));return null;}}catch(_0x508690){logger[_0x2742('0xe')](_0x508690[_0x2742('0xf')]);return null;}});}logger[_0x2742('0x13')](util['format'](_0x2742('0x4e'),_0x9b853f['arg_1'],_0x9b853f[_0x2742('0x19')],_0x9b853f[_0x2742('0x1a')],_0x9b853f[_0x2742('0x1b')],_0x9b853f[_0x2742('0x1c')]));logger[_0x2742('0x13')](util['format'](_0x2742('0x4f'),_0x9b853f[_0x2742('0x42')],_0x9b853f[_0x2742('0x43')],parseInt(_0x9b853f[_0x2742('0x44')],0xa)+0x1));_0x9b853f['continueAt'](_0x9b853f['context'],_0x9b853f['extension'],parseInt(_0x9b853f[_0x2742('0x44')],0xa)+0x1);_0x9b853f[_0x2742('0x37')]();}}else{logger[_0x2742('0xe')](util[_0x2742('0x14')](_0x2742('0x50'),_0x9b853f[_0x2742('0x18')]));_0x9b853f['continueAt'](_0x9b853f[_0x2742('0x42')],_0x9b853f[_0x2742('0x43')],parseInt(_0x9b853f['priority'],0xa)+0x1);_0x9b853f[_0x2742('0x37')]();}}else{logger[_0x2742('0xe')](util['format'](_0x2742('0x51'),_0x9b853f[_0x2742('0x18')]));_0x9b853f['continueAt'](_0x9b853f[_0x2742('0x42')],_0x9b853f[_0x2742('0x43')],parseInt(_0x9b853f[_0x2742('0x44')],0xa)+0x1);_0x9b853f[_0x2742('0x37')]();}}function main(){var _0x326b0f;return utilLicense[_0x2742('0x52')]()[_0x2742('0x2d')](function(_0x4f5f5b){if(_0x4f5f5b){if(_0x4f5f5b[_0x2742('0x53')]){if(_0x4f5f5b[_0x2742('0x54')]&&_0x4f5f5b[_0x2742('0x54')]>0x0){logger[_0x2742('0x13')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x4f5f5b['callysquare']));_0x326b0f=_0x4f5f5b[_0x2742('0x54')];}else{logger[_0x2742('0x13')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x2742('0x13')](_0x2742('0x55'));_0x326b0f=-0x1;}}})[_0x2742('0x2f')](function(_0x15fdbe){logger[_0x2742('0xe')](_0x2742('0x56'),_0x15fdbe[_0x2742('0xf')]);})[_0x2742('0x49')](function(){var _0x2f0f7d=require('./server')(config[_0x2742('0x6')][_0x2742('0x12')],config[_0x2742('0x6')]['ip'],_0x326b0f);_0x2f0f7d['on']('error',errorHandler);_0x2f0f7d['on'](_0x2742('0x57'),listeningHandler);_0x2f0f7d['on'](_0x2742('0x58'),connectionHandler);_0x2f0f7d['on'](_0x2742('0x37'),closeHandler);});}main(); \ No newline at end of file +var _0x5642=['callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','omit','mxCell','isArray','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','port','listening','lodash','syncho','moment','../../config/logger','agi','./rpc','./mailRpc','./vertices','defaults','nextTick','error','stack','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','format','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x710012,_0x1e01ba){var _0x45a7b8=function(_0x341f27){while(--_0x341f27){_0x710012['push'](_0x710012['shift']());}};_0x45a7b8(++_0x1e01ba);}(_0x5642,0x1a1));var _0x2564=function(_0x20853d,_0x124c96){_0x20853d=_0x20853d-0x0;var _0x31abf2=_0x5642[_0x20853d];return _0x31abf2;};'use strict';var parser=require('xml2json');var _=require(_0x2564('0x0'));var syncho=require(_0x2564('0x1'));var util=require('util');var moment=require(_0x2564('0x2'));var config=require('../../config/environment');var logger=require(_0x2564('0x3'))(_0x2564('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x2564('0x5'));var mailRpc=require(_0x2564('0x6'));var Graph=require('./graph');var Vertices=require(_0x2564('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x2564('0x8')](config[_0x2564('0x4')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0xf332b2){process[_0x2564('0x9')](function(){syncho(function(){try{setChannelVariables(_0xf332b2);agiHandler(_0xf332b2);}catch(_0x486d05){logger[_0x2564('0xa')](_0x486d05[_0x2564('0xb')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x2564('0x4')]['port']);logger[_0x2564('0xc')](util['format'](_0x2564('0xd'),config[_0x2564('0x4')]['ip'],config[_0x2564('0x4')]['port']));}function errorHandler(_0x2d041e){if(_0x2d041e&&_0x2d041e['name']&&_0x2d041e['message']){logger[_0x2564('0xa')](util[_0x2564('0xe')]('[%s]\x20%s',_0x2d041e['name'],_0x2d041e[_0x2564('0xf')]));}else{logger[_0x2564('0xa')](util[_0x2564('0xe')](_0x2564('0x10'),_0x2d041e[_0x2564('0xb')]));}}function closeHandler(){logger['info'](util[_0x2564('0xe')](_0x2564('0x11'),this[_0x2564('0x12')],this[_0x2564('0x13')],this['callerid'],this[_0x2564('0x14')],this[_0x2564('0x15')]));try{createSquareReport(this);}catch(_0x2868cb){logger[_0x2564('0xa')](_0x2868cb[_0x2564('0xb')]);}}function timeoutHandler(){logger['info'](util['format'](_0x2564('0x16'),this['arg_1'],this[_0x2564('0x13')],this[_0x2564('0x17')],this['dnid'],this[_0x2564('0x15')]));}function hangupHandler(){logger[_0x2564('0xc')](util[_0x2564('0xe')](_0x2564('0x18'),this[_0x2564('0x12')],this[_0x2564('0x13')],this['callerid'],this[_0x2564('0x14')],this['uniqueid']));this[_0x2564('0x19')]=!![];}function getRoot(_0x58ca63){return parser[_0x2564('0x1a')](_0x58ca63,{'object':!![]})[_0x2564('0x1b')][_0x2564('0x1c')];}function addVertex(_0x3d10e6,_0x543245,_0x59c7a8){_0x543245[_0x2564('0x1d')]=_0x59c7a8;if(_0x543245[_0x2564('0x1e')]('retry')){_0x543245[_0x2564('0x1f')]=parseInt(_0x543245[_0x2564('0x20')],0xa);}_0x3d10e6['addVertex'](_[_0x2564('0x21')](_0x543245,_0x2564('0x22')));}function initGraph(_0x304037,_0xdaecaf){var _0x16cc0f=new Graph();for(var _0x5e433c in _0x304037){if(_0x304037['hasOwnProperty'](_0x5e433c)){if(_[_0x2564('0x23')](_0x304037[_0x5e433c])){for(var _0x315a66=0x0;_0x315a66<_0x304037[_0x5e433c]['length'];_0x315a66+=0x1){addVertex(_0x16cc0f,_0x304037[_0x5e433c][_0x315a66],_0x5e433c);}}else{addVertex(_0x16cc0f,_0x304037[_0x5e433c],_0x5e433c);}}}for(var _0x3c8033=0x0;_0x3c8033<_0xdaecaf['length'];_0x3c8033+=0x1){if(_0xdaecaf[_0x3c8033][_0x2564('0x24')]&&_0xdaecaf[_0x3c8033][_0x2564('0x25')]){_0x16cc0f[_0x2564('0x26')](_0xdaecaf[_0x3c8033]['source'],_0xdaecaf[_0x3c8033][_0x2564('0x25')],_0xdaecaf[_0x3c8033][_0x2564('0x27')]);}}return _0x16cc0f;}function getSquareProject(_0x1dcbd9,_0x19e154){rpc[_0x2564('0x28')](_0x1dcbd9)[_0x2564('0x29')](function(_0x4a2121){_0x19e154(null,_0x4a2121);})[_0x2564('0x2a')](function(_0x1d67d1){_0x19e154(null,_0x1d67d1);});}function createSquareReport(_0x192412,_0x315ec5){rpc[_0x2564('0x2b')](_0x192412)[_0x2564('0x29')](function(_0x131121){if(_0x315ec5){_0x315ec5(null,_0x131121);}})[_0x2564('0x2a')](function(_0x4f184f){if(_0x315ec5){_0x315ec5(null,_0x4f184f);}});}function setChannelVariables(_0x45670d){for(var _0x114166 in _0x45670d){if(_0x45670d[_0x2564('0x1e')](_0x114166)){if(_0x114166[_0x2564('0x2c')](_0x2564('0x2d'))===0x0){_0x45670d[_0x114166[_0x2564('0x2e')](0x4)]=_0x45670d[_0x114166];delete _0x45670d[_0x114166];}}}}function getLogFromObject(_0x12a1e3){return util[_0x2564('0x2f')](_0x12a1e3,{'showHidden':![],'depth':null});}function agiHandler(_0x445875){var _0x26c575,_0x51a54e,_0x2ad86b,_0x52efa4,_0x26dbc3;logger[_0x2564('0x30')]('variables',JSON[_0x2564('0x31')](_0x445875,null,0x2));logger['info'](util[_0x2564('0xe')](_0x2564('0x32'),_0x445875[_0x2564('0x12')],_0x445875[_0x2564('0x13')],_0x445875['callerid'],_0x445875[_0x2564('0x14')],_0x445875[_0x2564('0x15')]));_0x445875['on']('error',errorHandler);_0x445875['on'](_0x2564('0x33'),closeHandler);_0x445875['on'](_0x2564('0x34'),timeoutHandler);_0x445875['evtHangup']=![];_0x445875['on'](_0x2564('0x35'),hangupHandler);var _0x462c60=getSquareProject[_0x2564('0x36')](null,_0x445875[_0x2564('0x12')]);if(_0x462c60){if(_0x462c60[_0x2564('0x37')]){_0x26c575=getRoot(_0x462c60[_0x2564('0x37')]);if(_0x26c575&&_0x26c575['start']){logger['debug'](_0x2564('0x1c'),JSON[_0x2564('0x31')](_0x26c575,null,0x2));_0x445875[_0x2564('0x38')]=moment()[_0x2564('0xe')](_0x2564('0x39'));_0x51a54e=initGraph(_[_0x2564('0x21')](_0x26c575,_0x2564('0x22')),_0x26c575[_0x2564('0x22')]);_0x2ad86b=new Vertices(_0x445875,rpc,mailRpc);logger[_0x2564('0xc')](util[_0x2564('0xe')](_0x2564('0x3a'),_0x445875[_0x2564('0x12')],_0x445875[_0x2564('0x13')],_0x445875[_0x2564('0x17')],_0x445875[_0x2564('0x14')],_0x445875['uniqueid']));_0x51a54e[_0x2564('0x3b')](_0x26c575[_0x2564('0x3c')]['id'],function(_0xdeebea){try{_0xdeebea=_0x2ad86b[_0x2564('0x3d')](_0xdeebea);logger[_0x2564('0x30')](_0x2564('0x3e'),JSON[_0x2564('0x31')](_0xdeebea,null,0x2));if(_0xdeebea[_0x2564('0x1d')]==='gotoc'){logger[_0x2564('0xc')](_0x2564('0x3f'));_0x445875[_0x2564('0x40')]=_0xdeebea[_0x2564('0x40')]||_0x445875[_0x2564('0x40')];_0x445875[_0x2564('0x41')]=_0xdeebea['extension'];_0x445875[_0x2564('0x42')]=_0xdeebea['priority']?_0xdeebea[_0x2564('0x42')]-0x1:0x1;return null;}else if(_0xdeebea&&_0x2ad86b[_0xdeebea[_0x2564('0x1d')]]){_0x26dbc3=_0x2ad86b[_0xdeebea[_0x2564('0x1d')]](_0xdeebea);logger[_0x2564('0xc')](_0x2564('0x43'),JSON[_0x2564('0x31')](_0x26dbc3,null,0x2));if(_0x26dbc3&&_0x26dbc3[_0x2564('0x44')]===AGI_CODE_SUCCESS&&_0x26dbc3['result']!==AGI_RESULT_ERROR&&!_0x445875[_0x2564('0x19')]){logger['debug'](_0x2564('0x43'),getLogFromObject(_0x26dbc3));return _[_0x2564('0x45')](_0x26dbc3[_0x2564('0x46')])?null:_0x26dbc3[_0x2564('0x46')][_0x2564('0x47')]();}else{logger[_0x2564('0xa')]('response',getLogFromObject(_0x26dbc3));return null;}}else{logger[_0x2564('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x18049b){logger[_0x2564('0xa')](_0x18049b[_0x2564('0xb')]);return null;}});if(_0x26c575[_0x2564('0x48')]){logger['info'](util[_0x2564('0xe')](_0x2564('0x49'),_0x445875[_0x2564('0x12')],_0x445875[_0x2564('0x13')],_0x445875[_0x2564('0x17')],_0x445875[_0x2564('0x14')],_0x445875[_0x2564('0x15')]));_0x51a54e['traverseBFS'](_0x26c575['finally']['id'],function(_0x3ecb6a){try{_0x3ecb6a=_0x2ad86b['clear'](_0x3ecb6a);logger[_0x2564('0x30')](_0x2564('0x3e'),JSON[_0x2564('0x31')](_0x3ecb6a,null,0x2));if(_0x3ecb6a&&_0x2ad86b[_0x3ecb6a['agicommand']]){_0x26dbc3=_0x2ad86b[_0x3ecb6a[_0x2564('0x1d')]](_0x3ecb6a);if(_0x26dbc3){logger['debug'](_0x2564('0x43'),getLogFromObject(_0x26dbc3));return _[_0x2564('0x45')](_0x26dbc3[_0x2564('0x46')])?null:_0x26dbc3[_0x2564('0x46')][_0x2564('0x47')]();}else{logger[_0x2564('0xa')](_0x2564('0x43'),getLogFromObject(_0x26dbc3));return null;}}else{logger[_0x2564('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x91c87a){logger[_0x2564('0xa')](_0x91c87a[_0x2564('0xb')]);return null;}});}logger[_0x2564('0xc')](util[_0x2564('0xe')](_0x2564('0x4a'),_0x445875[_0x2564('0x12')],_0x445875[_0x2564('0x13')],_0x445875['callerid'],_0x445875[_0x2564('0x14')],_0x445875['uniqueid']));logger[_0x2564('0xc')](util[_0x2564('0xe')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x445875['context'],_0x445875[_0x2564('0x41')],parseInt(_0x445875[_0x2564('0x42')],0xa)+0x1));_0x445875[_0x2564('0x4b')](_0x445875['context'],_0x445875[_0x2564('0x41')],parseInt(_0x445875[_0x2564('0x42')],0xa)+0x1);_0x445875[_0x2564('0x33')]();}}else{logger['error'](util[_0x2564('0xe')](_0x2564('0x4c'),_0x445875[_0x2564('0x12')]));_0x445875['continueAt'](_0x445875[_0x2564('0x40')],_0x445875['extension'],parseInt(_0x445875[_0x2564('0x42')],0xa)+0x1);_0x445875[_0x2564('0x33')]();}}else{logger[_0x2564('0xa')](util[_0x2564('0xe')](_0x2564('0x4d'),_0x445875[_0x2564('0x12')]));_0x445875[_0x2564('0x4b')](_0x445875[_0x2564('0x40')],_0x445875['extension'],parseInt(_0x445875['priority'],0xa)+0x1);_0x445875[_0x2564('0x33')]();}}function main(){var _0x1d60bc;return utilLicense[_0x2564('0x4e')]()['then'](function(_0x3e15d9){if(_0x3e15d9){if(_0x3e15d9[_0x2564('0x4f')]){if(_0x3e15d9[_0x2564('0x50')]&&_0x3e15d9[_0x2564('0x50')]>0x0){logger['info'](util[_0x2564('0xe')](_0x2564('0x51'),_0x3e15d9[_0x2564('0x50')]));_0x1d60bc=_0x3e15d9[_0x2564('0x50')];}else{logger[_0x2564('0xc')](_0x2564('0x52'));}}else{logger[_0x2564('0xc')](_0x2564('0x53'));_0x1d60bc=-0x1;}}})[_0x2564('0x2a')](function(_0x44f5e3){logger[_0x2564('0xa')](_0x2564('0x54'),_0x44f5e3[_0x2564('0xb')]);})[_0x2564('0x48')](function(){var _0x362d6d=require(_0x2564('0x55'))(config['agi'][_0x2564('0x56')],config['agi']['ip'],_0x1d60bc);_0x362d6d['on']('error',errorHandler);_0x362d6d['on'](_0x2564('0x57'),listeningHandler);_0x362d6d['on']('connection',connectionHandler);_0x362d6d['on'](_0x2564('0x33'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index d204645..36cbc63 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 _0x672b=['error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http','request','then'];(function(_0x2dcce3,_0x5b838f){var _0x35511b=function(_0x5da840){while(--_0x5da840){_0x2dcce3['push'](_0x2dcce3['shift']());}};_0x35511b(++_0x5b838f);}(_0x672b,0x19f));var _0xb672=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x672b[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xb672('0x0'));var jayson=require(_0xb672('0x1'));var client=jayson['client'][_0xb672('0x2')]({'port':0x232b});function request(_0x3f1183,_0x21fe1e){return new BPromise(function(_0x139cd8,_0x1ab487){return client[_0xb672('0x3')](_0x3f1183,_0x21fe1e)[_0xb672('0x4')](function(_0x3ce55b){if(_0x3ce55b[_0xb672('0x5')]){return _0x1ab487(_0x3ce55b[_0xb672('0x5')][_0xb672('0x6')]);}else{return _0x139cd8(_0x3ce55b['result']);}})[_0xb672('0x7')](function(_0x5d8cbc){return _0x1ab487(_0x5d8cbc);});});}exports[_0xb672('0x8')]=function(_0x37bb70,_0x22c40a){return request(_0xb672('0x9'),{'account':_0x37bb70,'message':_0x22c40a});}; \ No newline at end of file +var _0x1ec9=['then','error','result','catch','bluebird','http','request'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0x1ec9,0x107));var _0x91ec=function(_0x3a9efe,_0x1e3a95){_0x3a9efe=_0x3a9efe-0x0;var _0x2ea9d2=_0x1ec9[_0x3a9efe];return _0x2ea9d2;};'use strict';var BPromise=require(_0x91ec('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x91ec('0x1')]({'port':0x232b});function request(_0x148f60,_0x289dd1){return new BPromise(function(_0x1c8469,_0x7860c4){return client[_0x91ec('0x2')](_0x148f60,_0x289dd1)[_0x91ec('0x3')](function(_0x93dfc2){if(_0x93dfc2['error']){return _0x7860c4(_0x93dfc2[_0x91ec('0x4')]['message']);}else{return _0x1c8469(_0x93dfc2[_0x91ec('0x5')]);}})[_0x91ec('0x6')](function(_0x260e48){return _0x7860c4(_0x260e48);});});}exports['sendMailMessage']=function(_0x589ba3,_0x59a59c){return request('SendMail',{'account':_0x589ba3,'message':_0x59a59c});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 8caa65c..825903f 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 _0x22a4=['util','stream','Transform','call','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','slice','trim','emit','headers','line'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x22a4,0x1cb));var _0x422a=function(_0x26f8bc,_0x4d9bec){_0x26f8bc=_0x26f8bc-0x0;var _0x2a2c49=_0x22a4[_0x26f8bc];return _0x2a2c49;};'use strict';var util=require(_0x422a('0x0'));var Transform=require(_0x422a('0x1'))[_0x422a('0x2')];function AGIReply(_0x3d7f34){Transform[_0x422a('0x3')](this,_0x3d7f34);this[_0x422a('0x4')]='';this[_0x422a('0x5')]=![];}util[_0x422a('0x6')](AGIReply,Transform);AGIReply['prototype'][_0x422a('0x7')]=function(_0x10cc65,_0x1d5d59,_0x33e51c){var _0x28deaa='\x0a',_0x5e8fe2=['\x0a\x0a',_0x422a('0x8')],_0x3b5c92=-0x1,_0x1b4b08=-0x1,_0x23b1b0='',_0x392224=0x0,_0x3f785b='',_0x3ad391='';this[_0x422a('0x4')]+=_0x10cc65['toString']();_0x3f785b=this['_localBuffer'];if(!this[_0x422a('0x5')]){_0x392224=0x0;while(_0x5e8fe2[_0x392224]){while((_0x1b4b08=_0x3f785b[_0x422a('0x9')](_0x5e8fe2[_0x392224]))!=-0x1){_0x23b1b0=_0x5e8fe2[_0x392224];_0x3ad391=_0x3f785b[_0x422a('0xa')](0x0,_0x1b4b08);_0x3f785b=_0x3f785b[_0x422a('0xa')](_0x1b4b08+_0x23b1b0[_0x422a('0xb')]);var _0x1aa133=_0x3ad391['split'](_0x28deaa),_0x48c0a2=0x0,_0x489953={},_0xebe70d='',_0x4dbed1='',_0x5a0c59=-0x1;while(_0x1aa133[_0x48c0a2]){_0x5a0c59=_0x1aa133[_0x48c0a2][_0x422a('0x9')](':');if(_0x5a0c59!=-0x1){_0xebe70d=_0x1aa133[_0x48c0a2][_0x422a('0xc')](0x0,_0x5a0c59)[_0x422a('0xd')]();_0x4dbed1=_0x1aa133[_0x48c0a2][_0x422a('0xc')](_0x5a0c59+0x1)[_0x422a('0xd')]();if(_0xebe70d[_0x422a('0xb')]>0x0){_0x489953[_0xebe70d]=_0x4dbed1;}}else{}_0x48c0a2++;}this[_0x422a('0xe')](_0x422a('0xf'),_0x489953);this[_0x422a('0x5')]=!![];}_0x392224++;}this[_0x422a('0x4')]=_0x3f785b;}else{while((_0x3b5c92=_0x3f785b[_0x422a('0x9')](_0x28deaa))!=-0x1){_0x3ad391=_0x3f785b[_0x422a('0xa')](0x0,_0x3b5c92);this[_0x422a('0xe')](_0x422a('0x10'),_0x3ad391);_0x3f785b=_0x3f785b[_0x422a('0xa')](_0x3b5c92+_0x28deaa[_0x422a('0xb')]);}this[_0x422a('0x4')]=_0x3f785b;}_0x33e51c();};module['exports']=AGIReply; \ No newline at end of file +var _0xac8d=['toString','_localBuffer','indexOf','substring','length','split','slice','trim','emit','headers','line','exports','util','stream','Transform','call','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a'];(function(_0xce4c70,_0x3412c8){var _0x1502c9=function(_0x3739b5){while(--_0x3739b5){_0xce4c70['push'](_0xce4c70['shift']());}};_0x1502c9(++_0x3412c8);}(_0xac8d,0x1d8));var _0xdac8=function(_0x1fd2db,_0x315332){_0x1fd2db=_0x1fd2db-0x0;var _0x2256a5=_0xac8d[_0x1fd2db];return _0x2256a5;};'use strict';var util=require(_0xdac8('0x0'));var Transform=require(_0xdac8('0x1'))[_0xdac8('0x2')];function AGIReply(_0x406ff2){Transform[_0xdac8('0x3')](this,_0x406ff2);this['_localBuffer']='';this[_0xdac8('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xdac8('0x5')][_0xdac8('0x6')]=function(_0x2e6c8a,_0x13d49b,_0x1b5d36){var _0x3613e3='\x0a',_0x40186e=['\x0a\x0a',_0xdac8('0x7')],_0x3aad78=-0x1,_0x3738ca=-0x1,_0x4bdba1='',_0x1653ea=0x0,_0x4ebaa0='',_0x8d02eb='';this['_localBuffer']+=_0x2e6c8a[_0xdac8('0x8')]();_0x4ebaa0=this[_0xdac8('0x9')];if(!this['_inBody']){_0x1653ea=0x0;while(_0x40186e[_0x1653ea]){while((_0x3738ca=_0x4ebaa0[_0xdac8('0xa')](_0x40186e[_0x1653ea]))!=-0x1){_0x4bdba1=_0x40186e[_0x1653ea];_0x8d02eb=_0x4ebaa0[_0xdac8('0xb')](0x0,_0x3738ca);_0x4ebaa0=_0x4ebaa0['substring'](_0x3738ca+_0x4bdba1[_0xdac8('0xc')]);var _0x447f50=_0x8d02eb[_0xdac8('0xd')](_0x3613e3),_0x5431f5=0x0,_0x4894d8={},_0x140c24='',_0x2b187c='',_0x272916=-0x1;while(_0x447f50[_0x5431f5]){_0x272916=_0x447f50[_0x5431f5][_0xdac8('0xa')](':');if(_0x272916!=-0x1){_0x140c24=_0x447f50[_0x5431f5][_0xdac8('0xe')](0x0,_0x272916)['trim']();_0x2b187c=_0x447f50[_0x5431f5]['slice'](_0x272916+0x1)[_0xdac8('0xf')]();if(_0x140c24[_0xdac8('0xc')]>0x0){_0x4894d8[_0x140c24]=_0x2b187c;}}else{}_0x5431f5++;}this[_0xdac8('0x10')](_0xdac8('0x11'),_0x4894d8);this['_inBody']=!![];}_0x1653ea++;}this[_0xdac8('0x9')]=_0x4ebaa0;}else{while((_0x3aad78=_0x4ebaa0[_0xdac8('0xa')](_0x3613e3))!=-0x1){_0x8d02eb=_0x4ebaa0['substring'](0x0,_0x3aad78);this['emit'](_0xdac8('0x12'),_0x8d02eb);_0x4ebaa0=_0x4ebaa0[_0xdac8('0xb')](_0x3aad78+_0x3613e3[_0xdac8('0xc')]);}this[_0xdac8('0x9')]=_0x4ebaa0;}_0x1b5d36();};module[_0xdac8('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 8bfb614..3cde90c 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 _0xced9=['UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowUser','ShowTrunk','getSoundById','ShowSound','ShowInterval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause'];(function(_0x53377b,_0x166f23){var _0x39cba9=function(_0x4be07d){while(--_0x4be07d){_0x53377b['push'](_0x53377b['shift']());}};_0x39cba9(++_0x166f23);}(_0xced9,0x11b));var _0x9ced=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xced9[_0x10004e];return _0x5af990;};'use strict';var BPromise=require('bluebird');var moment=require(_0x9ced('0x0'));var _=require(_0x9ced('0x1'));var util=require(_0x9ced('0x2'));var jayson=require(_0x9ced('0x3'));var client=jayson[_0x9ced('0x4')][_0x9ced('0x5')]({'port':0x2329});function request(_0x3d46cd,_0x5b60d5){return new BPromise(function(_0x4e9528,_0x817188){return client[_0x9ced('0x6')](_0x3d46cd,_0x5b60d5)[_0x9ced('0x7')](function(_0x56464d){if(_0x56464d[_0x9ced('0x8')]){return _0x817188(_0x56464d['error'][_0x9ced('0x9')]);}else{return _0x4e9528(_0x56464d[_0x9ced('0xa')]);}})[_0x9ced('0xb')](function(_0x2a4fd0){return _0x817188(_0x2a4fd0);});});}exports['getSquareProject']=function(_0x3e3a22){return request(_0x9ced('0xc'),{'options':{'raw':![],'where':{'name':_0x3e3a22},'attributes':[_0x9ced('0xd')]}});};exports[_0x9ced('0xe')]=function(_0x121eea){return request(_0x9ced('0xf'),{'options':{'raw':![],'where':{'id':_0x121eea},'include':[{'model':_0x9ced('0x10'),'as':'Smtp'}],'attributes':['id',_0x9ced('0x11'),_0x9ced('0x12')]}});};exports[_0x9ced('0x13')]=function(_0x5c0f85){return request(_0x9ced('0xc'),{'options':{'where':{'id':_0x5c0f85},'attributes':[_0x9ced('0x11')]}});};exports['getVoiceQueueById']=function(_0x4072bc){return request(_0x9ced('0x14'),{'options':{'where':{'id':_0x4072bc},'attributes':[_0x9ced('0x11')]}});};exports[_0x9ced('0x15')]=function(_0x5cce14){return request(_0x9ced('0x16'),{'options':{'where':{'id':_0x5cce14},'attributes':[_0x9ced('0x11')]}});};exports[_0x9ced('0x17')]=function(_0x3a4729){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3a4729},'attributes':['dsn']}});};exports['getUserById']=function(_0x116703){return request(_0x9ced('0x18'),{'options':{'where':{'id':_0x116703},'attributes':[_0x9ced('0x11')]}});};exports['getTrunkById']=function(_0xa28cb0){return request(_0x9ced('0x19'),{'options':{'where':{'id':_0xa28cb0},'attributes':['name']}});};exports[_0x9ced('0x1a')]=function(_0x7573fa){return request(_0x9ced('0x1b'),{'options':{'where':{'id':_0x7573fa},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x3ee109){return request(_0x9ced('0x1c'),{'options':{'raw':![],'where':{'id':_0x3ee109},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x9ced('0x1d')]=function(_0x424e11){return request(_0x9ced('0x1e'),{'options':{'where':{'id':_0x424e11},'attributes':['id','name']}});};exports[_0x9ced('0x1f')]=function(_0x1e2b82){return request(_0x9ced('0x20'),{'body':_0x1e2b82});};exports[_0x9ced('0x21')]=function(_0x193592){return request(_0x9ced('0x22'),{'body':_0x193592});};exports['createSquareReport']=function(_0x2e1735){return request(_0x9ced('0x23'),{'body':_[_0x9ced('0x24')](_0x2e1735,{'project_name':_0x2e1735[_0x9ced('0x25')],'prev_project_name':_0x2e1735[_0x9ced('0x26')]||'','is_subproject':_0x2e1735['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x9ced('0x27'))})});};exports[_0x9ced('0x28')]=function(_0x2d0685){return request(_0x9ced('0x29'),{'body':_0x2d0685});};exports[_0x9ced('0x2a')]=function(_0x44586b){return request('CreateSquareMessage',{'body':_0x44586b});};exports[_0x9ced('0x2b')]=function(_0x1e5c1b){return request(_0x9ced('0x2c'),{'options':{'raw':![],'where':{'phone':_0x1e5c1b[_0x9ced('0x2d')],'ListId':_0x1e5c1b['ListId']}}})[_0x9ced('0x7')](function(_0x53c946){if(_0x53c946){return _0x53c946;}return request(_0x9ced('0x2e'),{'body':_0x1e5c1b});});};exports[_0x9ced('0x2f')]=function(_0xebfae3){return request(_0x9ced('0x30'),{'options':{'where':{'id':_0xebfae3},'attributes':[_0x9ced('0x11')]}});};exports[_0x9ced('0x31')]=function(_0x48c527,_0x19abcb){return request(_0x9ced('0x32'),{'body':{'interface':_0x19abcb},'options':{'where':_0x48c527}});};exports[_0x9ced('0x33')]=function(_0x5ddaa0,_0x1f77e7,_0x5ea26b){return request('PauseUser',{'body':{'type':_0x1f77e7,'uniqueid':_0x5ea26b},'options':{'where':_0x5ddaa0}});};exports[_0x9ced('0x34')]=function(_0x383f89){return request(_0x9ced('0x35'),{'body':{},'options':{'where':_0x383f89}});};exports[_0x9ced('0x36')]=function(_0x1ba6bf){return request(_0x9ced('0x37'),{'body':{},'options':{'where':_0x1ba6bf}});}; \ No newline at end of file +var _0xa4d9=['ShowVoiceQueue','name','getVariableById','ShowVariable','dsn','ShowUser','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareMessage','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','http','request','then','error','message','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','getSquareProjectById','getVoiceQueueById'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xa4d9,0xf4));var _0x9a4d=function(_0x13853f,_0x51ac7e){_0x13853f=_0x13853f-0x0;var _0x5d0126=_0xa4d9[_0x13853f];return _0x5d0126;};'use strict';var BPromise=require('bluebird');var moment=require(_0x9a4d('0x0'));var _=require(_0x9a4d('0x1'));var util=require(_0x9a4d('0x2'));var jayson=require(_0x9a4d('0x3'));var client=jayson['client'][_0x9a4d('0x4')]({'port':0x2329});function request(_0x1bf1cd,_0x5b8f4c){return new BPromise(function(_0x33e02a,_0x185894){return client[_0x9a4d('0x5')](_0x1bf1cd,_0x5b8f4c)[_0x9a4d('0x6')](function(_0x28570d){if(_0x28570d[_0x9a4d('0x7')]){return _0x185894(_0x28570d['error'][_0x9a4d('0x8')]);}else{return _0x33e02a(_0x28570d['result']);}})['catch'](function(_0x4cec0c){return _0x185894(_0x4cec0c);});});}exports[_0x9a4d('0x9')]=function(_0x3a6db9){return request(_0x9a4d('0xa'),{'options':{'raw':![],'where':{'name':_0x3a6db9},'attributes':['production']}});};exports[_0x9a4d('0xb')]=function(_0x68e5e1){return request(_0x9a4d('0xc'),{'options':{'raw':![],'where':{'id':_0x68e5e1},'include':[{'model':_0x9a4d('0xd'),'as':'Smtp'}],'attributes':['id','name','email']}});};exports[_0x9a4d('0xe')]=function(_0x5d1243){return request(_0x9a4d('0xa'),{'options':{'where':{'id':_0x5d1243},'attributes':['name']}});};exports[_0x9a4d('0xf')]=function(_0xd9f580){return request(_0x9a4d('0x10'),{'options':{'where':{'id':_0xd9f580},'attributes':[_0x9a4d('0x11')]}});};exports[_0x9a4d('0x12')]=function(_0x260d27){return request(_0x9a4d('0x13'),{'options':{'where':{'id':_0x260d27},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x5206e1){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5206e1},'attributes':[_0x9a4d('0x14')]}});};exports['getUserById']=function(_0x6c617){return request(_0x9a4d('0x15'),{'options':{'where':{'id':_0x6c617},'attributes':[_0x9a4d('0x11')]}});};exports[_0x9a4d('0x16')]=function(_0x3d1442){return request('ShowTrunk',{'options':{'where':{'id':_0x3d1442},'attributes':[_0x9a4d('0x11')]}});};exports[_0x9a4d('0x17')]=function(_0x50500a){return request(_0x9a4d('0x18'),{'options':{'where':{'id':_0x50500a},'attributes':[_0x9a4d('0x19')]}});};exports[_0x9a4d('0x1a')]=function(_0x3cac0e){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3cac0e},'include':[{'model':'Interval','as':_0x9a4d('0x1b')}]}});};exports[_0x9a4d('0x1c')]=function(_0x257b95){return request(_0x9a4d('0x1d'),{'options':{'where':{'id':_0x257b95},'attributes':['id',_0x9a4d('0x11')]}});};exports['createSmsMessage']=function(_0x13dd35){return request(_0x9a4d('0x1e'),{'body':_0x13dd35});};exports['createSquareDetailsReport']=function(_0x568b88){return request(_0x9a4d('0x1f'),{'body':_0x568b88});};exports[_0x9a4d('0x20')]=function(_0x53a185){return request(_0x9a4d('0x21'),{'body':_[_0x9a4d('0x22')](_0x53a185,{'project_name':_0x53a185[_0x9a4d('0x23')],'prev_project_name':_0x53a185['arg_2']||'','is_subproject':_0x53a185[_0x9a4d('0x24')]?!![]:![],'leaveAt':moment()[_0x9a4d('0x25')](_0x9a4d('0x26'))})});};exports[_0x9a4d('0x27')]=function(_0x114516){return request('CreateSquareRecording',{'body':_0x114516});};exports['createSquareMessage']=function(_0x38fdd1){return request(_0x9a4d('0x28'),{'body':_0x38fdd1});};exports['createCmContact']=function(_0x52a44f){return request(_0x9a4d('0x29'),{'options':{'raw':![],'where':{'phone':_0x52a44f[_0x9a4d('0x2a')],'ListId':_0x52a44f[_0x9a4d('0x2b')]}}})[_0x9a4d('0x6')](function(_0x5aa903){if(_0x5aa903){return _0x5aa903;}return request('CreateCmContact',{'body':_0x52a44f});});};exports[_0x9a4d('0x2c')]=function(_0x551fb8){return request(_0x9a4d('0x2d'),{'options':{'where':{'id':_0x551fb8},'attributes':[_0x9a4d('0x11')]}});};exports[_0x9a4d('0x2e')]=function(_0x4ae308,_0x5244cf){return request('LoginUser',{'body':{'interface':_0x5244cf},'options':{'where':_0x4ae308}});};exports['agentPause']=function(_0x276b24,_0x3d8c95,_0x4040e3){return request(_0x9a4d('0x2f'),{'body':{'type':_0x3d8c95,'uniqueid':_0x4040e3},'options':{'where':_0x276b24}});};exports[_0x9a4d('0x30')]=function(_0x5e40f4){return request(_0x9a4d('0x31'),{'body':{},'options':{'where':_0x5e40f4}});};exports[_0x9a4d('0x32')]=function(_0x420c0c){return request(_0x9a4d('0x33'),{'body':{},'options':{'where':_0x420c0c}});}; \ 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 2ff9817..86047cd 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 _0xbedb=['./polly','exports'];(function(_0x10903d,_0x468301){var _0x277e7e=function(_0x199879){while(--_0x199879){_0x10903d['push'](_0x10903d['shift']());}};_0x277e7e(++_0x468301);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};var polly=require(_0xbbed('0x0'));var lex=require('./lex');module[_0xbbed('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xa498=['./lex','exports','./polly'];(function(_0x43e4b3,_0x1444de){var _0x10c655=function(_0x56c01d){while(--_0x56c01d){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x10c655(++_0x1444de);}(_0xa498,0x179));var _0x8a49=function(_0x295ea9,_0x19d658){_0x295ea9=_0x295ea9-0x0;var _0x59a3fe=_0xa498[_0x295ea9];return _0x59a3fe;};var polly=require(_0x8a49('0x0'));var lex=require(_0x8a49('0x1'));module[_0x8a49('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 2a79e7a..1b00a40 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['exports'];(function(_0x2bfe4b,_0x3f43fd){var _0x424019=function(_0x1b2dc9){while(--_0x1b2dc9){_0x2bfe4b['push'](_0x2bfe4b['shift']());}};_0x424019(++_0x3f43fd);}(_0x9bde,0xe1));var _0xe9bd=function(_0xd1f1db,_0x9b189a){_0xd1f1db=_0xd1f1db-0x0;var _0x1e8ce9=_0x9bde[_0xd1f1db];return _0x1e8ce9;};'use strict';var lex=require('./lib/api');module[_0xe9bd('0x0')]=function(_0x4defda,_0xc79e0b,_0x4c63ca,_0x51786f,_0x3005aa,_0x131f6a){return lex(_0x4defda,_0xc79e0b,_0x4c63ca,_0x51786f,_0x3005aa,_0x131f6a);}; \ No newline at end of file +var _0xac4a=['exports','./lib/api'];(function(_0x4b79be,_0x3daa9d){var _0x557a45=function(_0x1e11d4){while(--_0x1e11d4){_0x4b79be['push'](_0x4b79be['shift']());}};_0x557a45(++_0x3daa9d);}(_0xac4a,0x13f));var _0xaac4=function(_0xf1246c,_0x2b7a26){_0xf1246c=_0xf1246c-0x0;var _0x2a3db5=_0xac4a[_0xf1246c];return _0x2a3db5;};'use strict';var lex=require(_0xaac4('0x0'));module[_0xaac4('0x1')]=function(_0x2e2ad0,_0x132fc3,_0x38f4f4,_0x1dc251,_0x5aeb7d,_0x58626e){return lex(_0x2e2ad0,_0x132fc3,_0x38f4f4,_0x1dc251,_0x5aeb7d,_0x58626e);}; \ 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 4988327..4fef2a8 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(_0x42e324,_0x500bb7){var _0x2ae2e3=function(_0x1a8188){while(--_0x1a8188){_0x42e324['push'](_0x42e324['shift']());}};_0x2ae2e3(++_0x500bb7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x778fd5,_0x3feb6f){var _0x52d76a=function(_0x34f2d4){while(--_0x34f2d4){_0x778fd5['push'](_0x778fd5['shift']());}};_0x52d76a(++_0x3feb6f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 5c9d38c..50077db 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 _0x7b2c=['exports','./lib/api'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x7b2c,0x83));var _0xc7b2=function(_0x226e49,_0x48a014){_0x226e49=_0x226e49-0x0;var _0x30c40c=_0x7b2c[_0x226e49];return _0x30c40c;};'use strict';var polly=require(_0xc7b2('0x0'));module[_0xc7b2('0x1')]=function(_0x1f061b,_0x1ac7ac,_0x350e39,_0x490043,_0x2b0b58,_0x172465,_0x2dc907){return polly(_0x1f061b,_0x1ac7ac,_0x350e39,_0x490043,_0x2b0b58,_0x172465,_0x2dc907);}; \ No newline at end of file +var _0xee5a=['./lib/api'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xee5a,0x146));var _0xaee5=function(_0x44f9d0,_0x2eaf6a){_0x44f9d0=_0x44f9d0-0x0;var _0xc9636a=_0xee5a[_0x44f9d0];return _0xc9636a;};'use strict';var polly=require(_0xaee5('0x0'));module['exports']=function(_0x30f42c,_0x464ad9,_0x9f2994,_0x59ba00,_0x3a066a,_0x52b0b0,_0x50ccfc){return polly(_0x30f42c,_0x464ad9,_0x9f2994,_0x59ba00,_0x3a066a,_0x52b0b0,_0x50ccfc);}; \ 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 bfab6c6..545b845 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 _0x4c3a=['Polly','text','mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0xe5e3fb,_0x2fa636){var _0xdc5834=function(_0x5960b7){while(--_0x5960b7){_0xe5e3fb['push'](_0xe5e3fb['shift']());}};_0xdc5834(++_0x2fa636);}(_0x4c3a,0x13e));var _0xa4c3=function(_0x4dbe5c,_0x36ed26){_0x4dbe5c=_0x4dbe5c-0x0;var _0x57bd05=_0x4c3a[_0x4dbe5c];return _0x57bd05;};'use strict';var fs=require('fs');var path=require(_0xa4c3('0x0'));var BPromise=require(_0xa4c3('0x1'));var rs=require('randomstring');var AWS=require(_0xa4c3('0x2'));function pollyResult(_0x1f35af,_0x1ed109,_0x5c6c14){return new BPromise(function(_0x1b06db,_0x4cb732){_0x1f35af[_0xa4c3('0x3')](_0x1ed109,function(_0x3a5e7b,_0xd91032){if(_0x3a5e7b){_0x4cb732(_0x3a5e7b);}else if(_0xd91032){if(_0xd91032[_0xa4c3('0x4')]instanceof Buffer){fs['writeFile'](_0x5c6c14,_0xd91032[_0xa4c3('0x4')],function(_0x5305f5){if(_0x5305f5){_0x4cb732(_0x5305f5);}else{_0x1b06db();}});}else{_0x4cb732(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x4cb732(new Error(_0xa4c3('0x5')));}});});}module['exports']=function(_0x5e90d6,_0x27c9dd,_0x521566,_0x556baf,_0x4b7949,_0x22dc72,_0x383d98){var _0x376a30=new AWS[(_0xa4c3('0x6'))]({'accessKeyId':_0x5e90d6,'secretAccessKey':_0x27c9dd,'region':_0x521566});var _0x12fbb8={'Text':_0x4b7949,'TextType':_0x22dc72||_0xa4c3('0x7'),'OutputFormat':_0xa4c3('0x8'),'VoiceId':_0x556baf};return pollyResult(_0x376a30,_0x12fbb8,_0x383d98);}; \ No newline at end of file +var _0xe804=['exports','text','mp3','path','bluebird','aws-sdk','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x2a4bff,_0x10d01f){var _0x167d1e=function(_0x59b365){while(--_0x59b365){_0x2a4bff['push'](_0x2a4bff['shift']());}};_0x167d1e(++_0x10d01f);}(_0xe804,0x1bb));var _0x4e80=function(_0x10316b,_0x3d68fa){_0x10316b=_0x10316b-0x0;var _0x53c33c=_0xe804[_0x10316b];return _0x53c33c;};'use strict';var fs=require('fs');var path=require(_0x4e80('0x0'));var BPromise=require(_0x4e80('0x1'));var rs=require('randomstring');var AWS=require(_0x4e80('0x2'));function pollyResult(_0x50634e,_0x55c8eb,_0x3d831c){return new BPromise(function(_0x5e45a8,_0x29addc){_0x50634e['synthesizeSpeech'](_0x55c8eb,function(_0x17c649,_0x52f919){if(_0x17c649){_0x29addc(_0x17c649);}else if(_0x52f919){if(_0x52f919['AudioStream']instanceof Buffer){fs['writeFile'](_0x3d831c,_0x52f919[_0x4e80('0x3')],function(_0x469ebc){if(_0x469ebc){_0x29addc(_0x469ebc);}else{_0x5e45a8();}});}else{_0x29addc(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x29addc(new Error(_0x4e80('0x4')));}});});}module[_0x4e80('0x5')]=function(_0x5ab6d0,_0x2bfe07,_0x40a57c,_0x21d243,_0x210fda,_0x1bfb33,_0x35cfe2){var _0x532fa8=new AWS['Polly']({'accessKeyId':_0x5ab6d0,'secretAccessKey':_0x2bfe07,'region':_0x40a57c});var _0x44ac79={'Text':_0x210fda,'TextType':_0x1bfb33||_0x4e80('0x6'),'OutputFormat':_0x4e80('0x7'),'VoiceId':_0x21d243};return pollyResult(_0x532fa8,_0x44ac79,_0x35cfe2);}; \ 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 41a4e2d..01ad35e 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x275dfa,_0x39d0da,_0x2cba4c,_0x329139){return asr(_0x275dfa,_0x39d0da,_0x2cba4c);}; \ No newline at end of file +var _0x82cb=['./lib/api','exports'];(function(_0x1bbc5a,_0x49ddfd){var _0x2c8bef=function(_0x574686){while(--_0x574686){_0x1bbc5a['push'](_0x1bbc5a['shift']());}};_0x2c8bef(++_0x49ddfd);}(_0x82cb,0x120));var _0xb82c=function(_0x39d436,_0x1a65e1){_0x39d436=_0x39d436-0x0;var _0x254325=_0x82cb[_0x39d436];return _0x254325;};'use strict';var asr=require(_0xb82c('0x0'));module[_0xb82c('0x1')]=function(_0x4ae5c6,_0x36b222,_0x58fd1a,_0x1898ed){return asr(_0x4ae5c6,_0x36b222,_0x58fd1a);}; \ 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 dee5b72..8ec0ca9 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 _0x630e=['LINEAR16','8000','url','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','/v1/speech:recognize?key='];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x630e,0x1af));var _0xe630=function(_0x18e3ca,_0x1c3af9){_0x18e3ca=_0x18e3ca-0x0;var _0x388b7f=_0x630e[_0x18e3ca];return _0x388b7f;};'use strict';var url=require(_0xe630('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xe630('0x1');module['exports']=function(_0x559334,_0x36902e,_0x143cb6){return new BPromise(function(_0x12449c,_0x5c5606){var _0x2f3a0f;if(typeof _0x559334!==_0xe630('0x2')||_0x559334[_0xe630('0x3')]===0x0){return _0x5c5606(_0xe630('0x4'));}if(typeof _0x36902e!==_0xe630('0x2')||_0x36902e['length']===0x0){return _0x5c5606(_0xe630('0x5'));}if(typeof _0x143cb6!==_0xe630('0x6')&&(typeof _0x143cb6!=='string'||_0x143cb6[_0xe630('0x3')]===0x0)){return _0x5c5606('lang\x20should\x20be\x20a\x20string');}try{_0x2f3a0f=fs[_0xe630('0x7')](_0x559334)[_0xe630('0x8')](_0xe630('0x9'));}catch(_0x5a3a70){return _0x5c5606(_0x5a3a70);}return _0x12449c({'method':'POST','uri':host+_0xe630('0xa')+_0x36902e,'body':{'config':{'encoding':_0xe630('0xb'),'sampleRateHertz':_0xe630('0xc'),'languageCode':_0x143cb6},'audio':{'content':_0x2f3a0f}},'json':!![]});});}; \ No newline at end of file +var _0xfc4c=['undefined','length','base64','/v1/speech:recognize?key=','url','bluebird','https://speech.googleapis.com','string','key\x20should\x20be\x20a\x20string'];(function(_0x1300b7,_0x212873){var _0x4f7cdd=function(_0x1e6cd9){while(--_0x1e6cd9){_0x1300b7['push'](_0x1300b7['shift']());}};_0x4f7cdd(++_0x212873);}(_0xfc4c,0xca));var _0xcfc4=function(_0x39577e,_0x2d755e){_0x39577e=_0x39577e-0x0;var _0x297638=_0xfc4c[_0x39577e];return _0x297638;};'use strict';var url=require(_0xcfc4('0x0'));var BPromise=require(_0xcfc4('0x1'));var fs=require('fs');var host=_0xcfc4('0x2');module['exports']=function(_0x29323d,_0xb8f67b,_0x3a0bd9){return new BPromise(function(_0x54bee8,_0x57bf8a){var _0x436d9b;if(typeof _0x29323d!==_0xcfc4('0x3')||_0x29323d['length']===0x0){return _0x57bf8a('filepath\x20should\x20be\x20a\x20string');}if(typeof _0xb8f67b!==_0xcfc4('0x3')||_0xb8f67b['length']===0x0){return _0x57bf8a(_0xcfc4('0x4'));}if(typeof _0x3a0bd9!==_0xcfc4('0x5')&&(typeof _0x3a0bd9!=='string'||_0x3a0bd9[_0xcfc4('0x6')]===0x0)){return _0x57bf8a('lang\x20should\x20be\x20a\x20string');}try{_0x436d9b=fs['readFileSync'](_0x29323d)['toString'](_0xcfc4('0x7'));}catch(_0x2d8256){return _0x57bf8a(_0x2d8256);}return _0x54bee8({'method':'POST','uri':host+_0xcfc4('0x8')+_0xb8f67b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x3a0bd9},'audio':{'content':_0x436d9b}},'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 51b2693..ffd5b7a 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 _0xf026=['exports','./asr'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0xf026,0xa9));var _0x6f02=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xf026[_0x54defc];return _0x1955d3;};var asr=require(_0x6f02('0x0'));module[_0x6f02('0x1')]={'asr':asr}; \ No newline at end of file +var _0x6a67=['exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x6a67,0x10f));var _0x76a6=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x6a67[_0x1dac7a];return _0x4cb363;};var asr=require('./asr');module[_0x76a6('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 0a1ed2f..2244711 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 _0xb924=['format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','sestekNDA','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','get','request\x20to\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','error','end','host','\x20failed,\x20status\x20code\x20=\x20','data','transcode','wav','finish\x20to\x20convert','start','resolve','generate','.wav','base64','then','unlink','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','tmp','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','jQ1olc','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','writeFileSync','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','result','resolvedQuery','actionIncomplete','speech','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','Tilde\x20ASR\x20confidence','awsPolly','lex','ispeechTTS'];(function(_0x4efa98,_0x2aecd5){var _0x1bc9b3=function(_0x806a40){while(--_0x806a40){_0x4efa98['push'](_0x4efa98['shift']());}};_0x1bc9b3(++_0x2aecd5);}(_0xb924,0x114));var _0x4b92=function(_0x1877af,_0x166407){_0x1877af=_0x1877af-0x0;var _0x52b4a2=_0xb924[_0x1877af];return _0x52b4a2;};'use strict';var apiai=require(_0x4b92('0x0'));var BPromise=require(_0x4b92('0x1'));var dialogflow=require(_0x4b92('0x2'));var fs=require('fs');var http=require(_0x4b92('0x3'));var https=require(_0x4b92('0x4'));var md5=require(_0x4b92('0x5'));var path=require(_0x4b92('0x6'));var querystring=require(_0x4b92('0x7'));var rp=require(_0x4b92('0x8'));var rs=require(_0x4b92('0x9'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0x4b92('0xa'))[_0x4b92('0xb')];var util=require(_0x4b92('0xc'));var aws=require('./aws');var google=require(_0x4b92('0xd'));var sestek=require(_0x4b92('0xe'));var tilde=require(_0x4b92('0xf'));var logger=require(_0x4b92('0x10'))(_0x4b92('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x438c02,_0x342974){return new BPromise(function(_0x536d17,_0x374d58){var _0x8f821a=urlParse(_0x438c02);var _0x1df44d=_0x8f821a[_0x4b92('0x12')]===_0x4b92('0x13')?https:http;var _0x452f2b={'host':_0x8f821a['host'],'path':_0x8f821a[_0x4b92('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x1df44d[_0x4b92('0x14')](_0x452f2b,function(_0x589cdb){if(_0x589cdb['statusCode']!==0xc8){logger['error'](_0x4b92('0x15')+_0x438c02+'\x20failed,\x20status\x20code\x20=\x20'+_0x589cdb['statusCode']+'\x20('+_0x589cdb['statusMessage']+')');_0x374d58(new Error(_0x4b92('0x15')+_0x438c02+'\x20failed,\x20status\x20code\x20=\x20'+_0x589cdb[_0x4b92('0x16')]+'\x20('+_0x589cdb[_0x4b92('0x17')]+')'));return;}var _0x2b271e=fs[_0x4b92('0x18')](_0x342974);_0x2b271e['on'](_0x4b92('0x19'),function(){logger[_0x4b92('0x1a')](_0x4b92('0x1b'));_0x2b271e[_0x4b92('0x1c')](_0x536d17);});_0x2b271e['on']('error',function(_0xf9420d){fs['unlink'](_0x342974);logger['error'](_0x4b92('0x1d'),_0xf9420d);_0x374d58(_0xf9420d);});_0x589cdb[_0x4b92('0x1e')](_0x2b271e);})['on'](_0x4b92('0x1f'),function(_0x18251b){logger[_0x4b92('0x1f')](_0x18251b);_0x374d58(_0x18251b);})[_0x4b92('0x20')]();});}function uploadFile(_0x2d08d0){return new BPromise(function(_0x35c9c0,_0x5b7566){var _0x3fb480=urlParse(_0x2d08d0);var _0x25cfce=_0x3fb480['protocol']===_0x4b92('0x13')?https:http;var _0x512522={'host':_0x3fb480[_0x4b92('0x21')],'path':_0x3fb480[_0x4b92('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x25cfce[_0x4b92('0x14')](_0x512522,function(_0x222597){if(_0x222597['statusCode']!==0xc8){_0x5b7566(new Error(_0x4b92('0x15')+_0x2d08d0+_0x4b92('0x22')+_0x222597[_0x4b92('0x16')]+'\x20('+_0x222597[_0x4b92('0x17')]+')'));return;}var _0x4b8ee7='';_0x222597['on'](_0x4b92('0x23'),function(_0x33c72d){_0x4b8ee7+=_0x33c72d;});_0x222597['on']('end',function(){_0x35c9c0(_0x4b8ee7);});})['on'](_0x4b92('0x1f'),function(_0x157b12){_0x5b7566(_0x157b12);})['end']();});}function convertFile(_0x188259,_0x1ad5ff){return new BPromise(function(_0x21434c,_0x35b329){var _0x2c60f7=sox[_0x4b92('0x24')](_0x188259,_0x1ad5ff,{'sampleRate':0x1f40,'format':_0x4b92('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2c60f7['on'](_0x4b92('0x1f'),function(_0x192143){logger['error']('error\x20convert',_0x192143);_0x35b329(_0x192143);});_0x2c60f7['on'](_0x4b92('0x20'),function(){logger[_0x4b92('0x1a')](_0x4b92('0x26'));_0x21434c();});_0x2c60f7[_0x4b92('0x27')]();});}function base64Decode(_0x327716,_0x41252c){var _0x44e866=path[_0x4b92('0x28')](__dirname,'tmp',rs[_0x4b92('0x29')](0x4)+_0x4b92('0x2a'));fs['writeFileSync'](_0x44e866,_0x327716,_0x4b92('0x2b'));return convertFile(_0x44e866,_0x41252c)[_0x4b92('0x2c')](function(){try{fs[_0x4b92('0x2d')](_0x44e866);fs[_0x4b92('0x2e')](_0x41252c,_0x4b92('0x2f'));}catch(_0x432022){logger[_0x4b92('0x1f')](_0x432022);}return _0x41252c[_0x4b92('0x30')]('.')[0x0];});}function base64Encode(_0xac4f58){var _0xaf7ebb=fs[_0x4b92('0x31')](_0xac4f58);return new Buffer(_0xaf7ebb)[_0x4b92('0x32')](_0x4b92('0x2b'));}exports[_0x4b92('0x33')]=function(_0x2bb730,_0x12eb05,_0x421103,_0x5ee00e,_0x1a7fde,_0x532ddc){var _0x49322b,_0x3fd5c5;var _0x1eb11f='https://texttospeech.googleapis.com/v1/';var _0x352960=_0x4b92('0x34')+_0x2bb730;var _0x5d0c0d={};if(_0x12eb05===_0x4b92('0x35')){_0x5d0c0d[_0x4b92('0x36')]={'ssml':_0x421103};}else{_0x5d0c0d['input']={'text':_0x421103};};_0x5d0c0d[_0x4b92('0x37')]={'languageCode':_0x5ee00e,'ssmlGender':_0x1a7fde};_0x5d0c0d[_0x4b92('0x38')]={'audioEncoding':_0x4b92('0x39'),'sampleRateHertz':0x1f40};var _0x489dc2={'url':_0x1eb11f+_0x4b92('0x3a')+_0x352960,'method':_0x4b92('0x3b'),'json':!![],'body':_0x5d0c0d};return rp(_0x489dc2)['then'](function(_0xdfd563){return new BPromise(function(_0x1ce4c7,_0x38a10){_0x49322b=path[_0x4b92('0x28')](__dirname,_0x4b92('0x3c'),rs[_0x4b92('0x29')](0x4)+_0x4b92('0x3d'));var _0xd8a661=Buffer[_0x4b92('0x3e')](_0xdfd563[_0x4b92('0x3f')],'base64');return fs[_0x4b92('0x40')](_0x49322b,_0xd8a661,function(_0x183940){_0x38a10(_0x183940);},function(_0x559c8f){fs[_0x4b92('0x2e')](_0x49322b,_0x4b92('0x2f'));_0x1ce4c7(_0x559c8f);});});})[_0x4b92('0x2c')](function(_0x289757){_0x3fd5c5=path[_0x4b92('0x28')](__dirname,_0x4b92('0x3c'),rs['generate'](0x4)+_0x4b92('0x2a'));return convertFile(_0x49322b,_0x3fd5c5);})[_0x4b92('0x2c')](function(){try{fs[_0x4b92('0x2d')](_0x49322b);fs['chmodSync'](_0x3fd5c5,'777');}catch(_0x330483){logger[_0x4b92('0x1f')](_0x330483);}logger[_0x4b92('0x1a')](_0x4b92('0x41'),_0x3fd5c5[_0x4b92('0x30')]('.')[0x0]);return _0x3fd5c5[_0x4b92('0x30')]('.')[0x0];});};exports[_0x4b92('0x42')]=function(_0x257b9a,_0x4b65e4){var _0x486c36='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x440589,_0x24b922;var _0x24f0e5;var _0x95aa6={'encoding':_0x4b92('0x43'),'method':_0x4b92('0x3b'),'timeout':0x2710,'url':_0x486c36,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0x4b92('0x44'),JSON[_0x4b92('0x45')]([_0x257b9a,_0x4b65e4||'en',![],'null']),null,_0x4b92('0x46')]]]))};return rp(_0x95aa6)['then'](function(_0x4ab2e3){try{_0x24f0e5=eval(_0x4ab2e3[_0x4b92('0x47')](0x5))[0x0][0x2];}catch(_0x4a8fbc){throw new Error(_0x4b92('0x48')+_0x4ab2e3[_0x4b92('0x23')]);}if(!_0x24f0e5){if(_0x257b9a[_0x4b92('0x49')]>0xc8){throw new Error(_0x4b92('0x4a'));}else{throw new Error(_0x4b92('0x4b')+_0x4b65e4+'\x22\x20might\x20not\x20exist');}}try{_0x24f0e5=eval(_0x24f0e5)[0x0];}catch(_0x1d48da){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x4b92('0x23')]);}const _0x4755bc=_0x24f0e5;_0x440589=path[_0x4b92('0x28')](__dirname,_0x4b92('0x3c'),rs[_0x4b92('0x29')](0x4)+_0x4b92('0x3d'));fs[_0x4b92('0x4c')](_0x440589,_0x24f0e5,{'encoding':_0x4b92('0x2b')});_0x24b922=path['resolve'](__dirname,_0x4b92('0x3c'),rs[_0x4b92('0x29')](0x4)+_0x4b92('0x2a'));return convertFile(_0x440589,_0x24b922);})[_0x4b92('0x2c')](function(){try{fs[_0x4b92('0x2d')](_0x440589);fs[_0x4b92('0x2e')](_0x24b922,_0x4b92('0x2f'));}catch(_0xfe8b45){logger[_0x4b92('0x1f')](_0xfe8b45);}logger[_0x4b92('0x1a')](_0x4b92('0x4d'),_0x24b922[_0x4b92('0x30')]('.')[0x0]);return _0x24b922[_0x4b92('0x30')]('.')[0x0];});};exports['googleASR']=function(_0x1537f3,_0x14169c,_0x35128e){return google[_0x4b92('0x4e')](_0x1537f3,_0x14169c,_0x35128e)[_0x4b92('0x2c')](function(_0xaba3fc){logger[_0x4b92('0x1a')](_0xaba3fc[_0x4b92('0x4f')]);return rp(_0xaba3fc);})['then'](function(_0x35b34e){var _0x1d7786='';var _0x100730=0x0;try{fs[_0x4b92('0x2d')](_0x1537f3);}catch(_0x44d0d2){logger[_0x4b92('0x1f')](_0x44d0d2);}if(_0x35b34e&&_0x35b34e['results']){_0x1d7786=_0x35b34e[_0x4b92('0x50')][_0x4b92('0x51')](function(_0x1afd4){return _0x1afd4&&_0x1afd4[_0x4b92('0x52')][0x0]&&_0x1afd4[_0x4b92('0x52')][0x0][_0x4b92('0x53')]?_0x1afd4[_0x4b92('0x52')][0x0][_0x4b92('0x53')]:'';})[_0x4b92('0x54')]('\x0a');_0x100730=_0x35b34e[_0x4b92('0x50')][_0x4b92('0x51')](function(_0x249d34){return _0x249d34&&_0x249d34[_0x4b92('0x52')][0x0]&&_0x249d34[_0x4b92('0x52')][0x0][_0x4b92('0x55')]?_0x249d34[_0x4b92('0x52')][0x0][_0x4b92('0x55')]:0x0;})['join']('\x0a');}logger[_0x4b92('0x1a')](_0x4b92('0x56'),_0x1d7786);logger[_0x4b92('0x1a')]('googleASR\x20confidence',_0x100730);return{'transcript':_0x1d7786,'confidence':_0x100730};})[_0x4b92('0x57')](function(_0x554e6f){logger['error'](_0x4b92('0x58'),_0x554e6f['statusCode'],_0x554e6f[_0x4b92('0x59')],_0x554e6f[_0x4b92('0x5a')]);});};exports['googleDialogflow']=function(_0x511666,_0x46ce8f,_0x130506,_0x1b49a0){var _0x54ffb7=apiai(_0x46ce8f,{'language':_0x1b49a0||'en'});return _0x54ffb7['textRequest'](_0x130506,{'sessionId':md5(_0x511666)})[_0x4b92('0x2c')](function(_0x348bdf){logger[_0x4b92('0x1a')](JSON[_0x4b92('0x45')](_0x348bdf));return{'source':_0x348bdf[_0x4b92('0x5b')]['source'],'resolvedQuery':_0x348bdf['result'][_0x4b92('0x5c')],'action':_0x348bdf[_0x4b92('0x5b')]['action'],'actionIncomplete':_0x348bdf[_0x4b92('0x5b')][_0x4b92('0x5d')],'speech':_0x348bdf['result']['fulfillment'][_0x4b92('0x5e')],'score':_0x348bdf[_0x4b92('0x5b')]['score'],'statusCode':_0x348bdf['status'][_0x4b92('0x5f')],'endConversation':_0x348bdf[_0x4b92('0x5b')]['metadata'][_0x4b92('0x60')]||![],'isFallbackIntent':_0x348bdf[_0x4b92('0x5b')][_0x4b92('0x61')][_0x4b92('0x62')]};});};exports[_0x4b92('0x63')]=function(_0x5c82c6,_0x574e0c,_0x3b60fd,_0x1638bd,_0x300637,_0x9e888b){var _0x3bba2f=_0x1638bd[_0x4b92('0x64')](/\\n/g,'\x0a');var _0x472399={'credentials':{'private_key':_0x3bba2f,'client_email':_0x3b60fd}};var _0x30ccaa=new dialogflow[(_0x4b92('0x65'))](_0x472399);var _0x46a6f4=_0x30ccaa[_0x4b92('0x66')](_0x574e0c,md5(_0x5c82c6));var _0x4ca6c0={'session':_0x46a6f4,'queryInput':{'text':{'text':_0x300637,'languageCode':_0x9e888b}}};return _0x30ccaa[_0x4b92('0x67')](_0x4ca6c0)[_0x4b92('0x2c')](function(_0xc1f031){if(_0xc1f031&&_0xc1f031['length']){logger['info'](_0x4b92('0x68'),JSON[_0x4b92('0x45')](_0xc1f031));var _0x2067ef=_0xc1f031[0x0];if(_0x2067ef){var _0x574d61={'action':_0x2067ef[_0x4b92('0x69')]['action'],'allRequiredParamsPresent':_0x2067ef['queryResult']['allRequiredParamsPresent'],'endConversation':_0x2067ef['queryResult'][_0x4b92('0x6a')]&&_0x2067ef[_0x4b92('0x69')][_0x4b92('0x6a')][_0x4b92('0x6b')]?_0x2067ef[_0x4b92('0x69')][_0x4b92('0x6a')]['fields']['end_conversation'][_0x4b92('0x6c')]:![],'fulfillmentText':_0x2067ef['queryResult'][_0x4b92('0x6d')],'intentName':_0x2067ef['queryResult']['intent']['name'],'intentDisplayName':_0x2067ef[_0x4b92('0x69')][_0x4b92('0x6e')][_0x4b92('0x6f')],'isFallbackIntent':_0x2067ef[_0x4b92('0x69')][_0x4b92('0x6e')][_0x4b92('0x70')],'languageCode':_0x2067ef[_0x4b92('0x69')][_0x4b92('0x71')],'queryText':_0x2067ef[_0x4b92('0x69')]['queryText'],'responseId':_0x2067ef[_0x4b92('0x72')],'score':_0x2067ef['queryResult'][_0x4b92('0x73')],'speech':_0x2067ef[_0x4b92('0x69')][_0x4b92('0x6d')],'providerResponse':JSON[_0x4b92('0x45')](_0xc1f031)};return _0x574d61;}}});};exports['tildeASR']=function(_0x531aeb,_0x245792,_0x5bfd2b,_0x336af3){return tilde[_0x4b92('0x4e')](_0x531aeb,_0x245792,_0x5bfd2b,_0x336af3)[_0x4b92('0x2c')](function(_0x473d9c){try{fs[_0x4b92('0x2d')](_0x531aeb);}catch(_0x3eb270){logger['error'](_0x3eb270);}logger[_0x4b92('0x1a')]('Tilde\x20ASR\x20transcription',_0x473d9c[_0x4b92('0x53')]);logger['info'](_0x4b92('0x74'),_0x473d9c[_0x4b92('0x55')]);return _0x473d9c;});};exports[_0x4b92('0x75')]=function(_0x49f931,_0x1e849d,_0x2dd201,_0x2776c6,_0x3a5b5d,_0x35158e){var _0x300770=path[_0x4b92('0x28')](__dirname,_0x4b92('0x3c'),rs[_0x4b92('0x29')](0x4)+_0x4b92('0x3d'));var _0x2db310;return aws['polly'](_0x49f931,_0x1e849d,_0x2dd201,_0x2776c6,_0x3a5b5d,_0x35158e,_0x300770)['then'](function(){_0x2db310=path[_0x4b92('0x28')](__dirname,_0x4b92('0x3c'),rs[_0x4b92('0x29')](0x4)+'.wav');return convertFile(_0x300770,_0x2db310);})['then'](function(){try{fs[_0x4b92('0x2d')](_0x300770);fs['chmodSync'](_0x2db310,'777');}catch(_0x2c577d){logger[_0x4b92('0x1f')](_0x2c577d);}return _0x2db310[_0x4b92('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x4df578,_0x16afaa,_0x3b8e5d,_0x30e681,_0x170bce,_0x1f0ad3){return aws[_0x4b92('0x76')](_0x4df578,_0x16afaa,_0x3b8e5d,_0x30e681,_0x170bce,_0x1f0ad3)[_0x4b92('0x2c')](function(_0x5f38fb){logger[_0x4b92('0x1a')](JSON[_0x4b92('0x45')](_0x5f38fb));return _0x5f38fb;});};exports[_0x4b92('0x77')]=function(_0x4fb232,_0x55de2c,_0x581fd4,_0xc72ff4){var _0xa3a48a=util[_0x4b92('0x78')](_0x4b92('0x79'),ISPEECH_API,_0x4fb232,encodeURIComponent(_0x55de2c),_0x581fd4,_0xc72ff4);var _0x2d21e7=path['resolve'](__dirname,_0x4b92('0x3c'),rs[_0x4b92('0x29')](0x4)+'.mp3');var _0x11b7d7;return downloadFile(_0xa3a48a,_0x2d21e7)[_0x4b92('0x2c')](function(){_0x11b7d7=path[_0x4b92('0x28')](__dirname,_0x4b92('0x3c'),rs[_0x4b92('0x29')](0x4)+_0x4b92('0x2a'));return convertFile(_0x2d21e7,_0x11b7d7);})[_0x4b92('0x2c')](function(){try{fs[_0x4b92('0x2d')](_0x2d21e7);fs['chmodSync'](_0x11b7d7,'777');}catch(_0x309063){logger['error'](_0x309063);}return _0x11b7d7[_0x4b92('0x30')]('.')[0x0];});};exports[_0x4b92('0x7a')]=function(_0x52b3e5,_0x231dd9,_0x4fa4c6,_0x1e7c40){var _0x353322=util[_0x4b92('0x78')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x231dd9,_0x4fa4c6,base64Encode(_0x52b3e5),_0x1e7c40?util['format'](_0x4b92('0x7b'),encodeURIComponent(_0x1e7c40)):'freeform=3');return uploadFile(_0x353322)['then'](function(_0x458322){return querystring[_0x4b92('0xb')](_0x458322);});};exports[_0x4b92('0x7c')]=function(_0x4ea4a9,_0x13a094){return sestek['nda'](_0x4ea4a9,_0x13a094)[_0x4b92('0x2c')](function(_0x1ace54){logger[_0x4b92('0x1a')](JSON[_0x4b92('0x45')](_0x1ace54));var _0x20fe28={'speech':_0x1ace54[_0x4b92('0x7d')],'action':_0x1ace54[_0x4b92('0x7e')]?_0x1ace54[_0x4b92('0x7e')]['CustomAction']:undefined,'actiondata':_0x1ace54[_0x4b92('0x7e')]?_0x1ace54['channelData'][_0x4b92('0x7f')]:undefined};if(_0x1ace54[_0x4b92('0x7e')]&&_0x1ace54[_0x4b92('0x7e')]['AudioFromTts']){return base64Decode(_0x1ace54['channelData'][_0x4b92('0x80')][_0x4b92('0x81')],path['resolve'](__dirname,_0x4b92('0x3c'),rs[_0x4b92('0x29')](0x4)+_0x4b92('0x2a')))[_0x4b92('0x2c')](function(_0x269934){_0x20fe28[_0x4b92('0x82')]=_0x269934;return _0x20fe28;});}return _0x20fe28;});};exports[_0x4b92('0x83')]=function(){return __dirname;}; \ No newline at end of file +var _0x2cf9=['fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','text','channelData','CustomActionData','AudioFromTts','audiofile','dirName','bluebird','dialogflow','https','path','querystring','sox','google-tts-api','url','util','./aws','./google','../../../config/logger','agi','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','download\x20error','end','protocol','https:','data','transcode','wav','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','777','googleTTS','application/x-www-form-urlencoded','f.req=','stringify','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','googleDialogflowV2','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x2cf9,0x11f));var _0x92cf=function(_0x3b541e,_0x14a851){_0x3b541e=_0x3b541e-0x0;var _0x1b54ae=_0x2cf9[_0x3b541e];return _0x1b54ae;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x92cf('0x0'));var dialogflow=require(_0x92cf('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x92cf('0x2'));var md5=require('md5');var path=require(_0x92cf('0x3'));var querystring=require(_0x92cf('0x4'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x92cf('0x5'));var tts=require(_0x92cf('0x6'));var urlParse=require(_0x92cf('0x7'))['parse'];var util=require(_0x92cf('0x8'));var aws=require(_0x92cf('0x9'));var google=require(_0x92cf('0xa'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0x92cf('0xb'))(_0x92cf('0xc'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x401e37,_0xf18fc0){return new BPromise(function(_0x2181fc,_0xd2584a){var _0x183f83=urlParse(_0x401e37);var _0x146193=_0x183f83['protocol']==='https:'?https:http;var _0x14f185={'host':_0x183f83[_0x92cf('0xd')],'path':_0x183f83[_0x92cf('0x3')],'headers':{'user-agent':_0x92cf('0xe')}};_0x146193[_0x92cf('0xf')](_0x14f185,function(_0x4107e2){if(_0x4107e2['statusCode']!==0xc8){logger[_0x92cf('0x10')](_0x92cf('0x11')+_0x401e37+_0x92cf('0x12')+_0x4107e2[_0x92cf('0x13')]+'\x20('+_0x4107e2[_0x92cf('0x14')]+')');_0xd2584a(new Error('request\x20to\x20'+_0x401e37+_0x92cf('0x12')+_0x4107e2[_0x92cf('0x13')]+'\x20('+_0x4107e2['statusMessage']+')'));return;}var _0x122bf6=fs[_0x92cf('0x15')](_0xf18fc0);_0x122bf6['on'](_0x92cf('0x16'),function(){logger[_0x92cf('0x17')](_0x92cf('0x18'));_0x122bf6['close'](_0x2181fc);});_0x122bf6['on'](_0x92cf('0x10'),function(_0x3ec411){fs['unlink'](_0xf18fc0);logger[_0x92cf('0x10')](_0x92cf('0x19'),_0x3ec411);_0xd2584a(_0x3ec411);});_0x4107e2['pipe'](_0x122bf6);})['on'](_0x92cf('0x10'),function(_0x531a00){logger[_0x92cf('0x10')](_0x531a00);_0xd2584a(_0x531a00);})[_0x92cf('0x1a')]();});}function uploadFile(_0x127af9){return new BPromise(function(_0x38f4ad,_0x507895){var _0x55b5f9=urlParse(_0x127af9);var _0x57130b=_0x55b5f9[_0x92cf('0x1b')]===_0x92cf('0x1c')?https:http;var _0x9e10e7={'host':_0x55b5f9['host'],'path':_0x55b5f9[_0x92cf('0x3')],'headers':{'user-agent':_0x92cf('0xe')}};_0x57130b['get'](_0x9e10e7,function(_0x7eff11){if(_0x7eff11[_0x92cf('0x13')]!==0xc8){_0x507895(new Error('request\x20to\x20'+_0x127af9+_0x92cf('0x12')+_0x7eff11[_0x92cf('0x13')]+'\x20('+_0x7eff11[_0x92cf('0x14')]+')'));return;}var _0x2df412='';_0x7eff11['on'](_0x92cf('0x1d'),function(_0x159d8a){_0x2df412+=_0x159d8a;});_0x7eff11['on'](_0x92cf('0x1a'),function(){_0x38f4ad(_0x2df412);});})['on'](_0x92cf('0x10'),function(_0x186324){_0x507895(_0x186324);})[_0x92cf('0x1a')]();});}function convertFile(_0x256f48,_0x554561){return new BPromise(function(_0x21bcd9,_0x964835){var _0x2e30d4=sox[_0x92cf('0x1e')](_0x256f48,_0x554561,{'sampleRate':0x1f40,'format':_0x92cf('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2e30d4['on'](_0x92cf('0x10'),function(_0x56a264){logger[_0x92cf('0x10')]('error\x20convert',_0x56a264);_0x964835(_0x56a264);});_0x2e30d4['on'](_0x92cf('0x1a'),function(){logger['info'](_0x92cf('0x20'));_0x21bcd9();});_0x2e30d4[_0x92cf('0x21')]();});}function base64Decode(_0x73eddf,_0x80c523){var _0x4d6abe=path[_0x92cf('0x22')](__dirname,_0x92cf('0x23'),rs[_0x92cf('0x24')](0x4)+_0x92cf('0x25'));fs[_0x92cf('0x26')](_0x4d6abe,_0x73eddf,_0x92cf('0x27'));return convertFile(_0x4d6abe,_0x80c523)[_0x92cf('0x28')](function(){try{fs[_0x92cf('0x29')](_0x4d6abe);fs[_0x92cf('0x2a')](_0x80c523,'777');}catch(_0x3769d3){logger[_0x92cf('0x10')](_0x3769d3);}return _0x80c523[_0x92cf('0x2b')]('.')[0x0];});}function base64Encode(_0x5003b2){var _0x2475d6=fs[_0x92cf('0x2c')](_0x5003b2);return new Buffer(_0x2475d6)[_0x92cf('0x2d')](_0x92cf('0x27'));}exports[_0x92cf('0x2e')]=function(_0x10dc54,_0x56fcea,_0x5551d5,_0x585847,_0x322873,_0x1d7de7){var _0x4e91f0,_0x21b9c5;var _0x28c192=_0x92cf('0x2f');var _0x49aa1e=_0x92cf('0x30')+_0x10dc54;var _0x598b7c={};if(_0x56fcea===_0x92cf('0x31')){_0x598b7c[_0x92cf('0x32')]={'ssml':_0x5551d5};}else{_0x598b7c[_0x92cf('0x32')]={'text':_0x5551d5};};_0x598b7c['voice']={'languageCode':_0x585847,'ssmlGender':_0x322873};_0x598b7c['audioConfig']={'audioEncoding':_0x92cf('0x33'),'sampleRateHertz':0x1f40};var _0x3b2417={'url':_0x28c192+_0x92cf('0x34')+_0x49aa1e,'method':_0x92cf('0x35'),'json':!![],'body':_0x598b7c};return rp(_0x3b2417)[_0x92cf('0x28')](function(_0x2fd35a){return new BPromise(function(_0x28ca06,_0x59ec0f){_0x4e91f0=path[_0x92cf('0x22')](__dirname,_0x92cf('0x23'),rs[_0x92cf('0x24')](0x4)+_0x92cf('0x36'));var _0x38b4d2=Buffer[_0x92cf('0x37')](_0x2fd35a[_0x92cf('0x38')],_0x92cf('0x27'));return fs[_0x92cf('0x39')](_0x4e91f0,_0x38b4d2,function(_0x132c36){_0x59ec0f(_0x132c36);},function(_0x3ec2a5){fs[_0x92cf('0x2a')](_0x4e91f0,_0x92cf('0x3a'));_0x28ca06(_0x3ec2a5);});});})[_0x92cf('0x28')](function(_0x3d919c){_0x21b9c5=path[_0x92cf('0x22')](__dirname,'tmp',rs['generate'](0x4)+_0x92cf('0x25'));return convertFile(_0x4e91f0,_0x21b9c5);})[_0x92cf('0x28')](function(){try{fs['unlink'](_0x4e91f0);fs[_0x92cf('0x2a')](_0x21b9c5,'777');}catch(_0x533f5c){logger[_0x92cf('0x10')](_0x533f5c);}logger['info']('googleCloudTTS\x20path',_0x21b9c5[_0x92cf('0x2b')]('.')[0x0]);return _0x21b9c5[_0x92cf('0x2b')]('.')[0x0];});};exports[_0x92cf('0x3b')]=function(_0x23aa50,_0x28299f){var _0x2c44ed='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x17f7c7,_0x266f11;var _0x58fd94;var _0x4f496a={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x2c44ed,'headers':{'Content-Type':_0x92cf('0x3c')},'body':_0x92cf('0x3d')+encodeURIComponent(JSON[_0x92cf('0x3e')]([[['jQ1olc',JSON['stringify']([_0x23aa50,_0x28299f||'en',![],'null']),null,'generic']]]))};return rp(_0x4f496a)[_0x92cf('0x28')](function(_0xad9c02){try{_0x58fd94=eval(_0xad9c02[_0x92cf('0x3f')](0x5))[0x0][0x2];}catch(_0x436e7d){throw new Error(_0x92cf('0x40')+_0xad9c02['data']);}if(!_0x58fd94){if(_0x23aa50['length']>0xc8){throw new Error(_0x92cf('0x41'));}else{throw new Error('lang\x20\x22'+_0x28299f+_0x92cf('0x42'));}}try{_0x58fd94=eval(_0x58fd94)[0x0];}catch(_0x45ba66){throw new Error(_0x92cf('0x40')+res[_0x92cf('0x1d')]);}const _0x3e1f56=_0x58fd94;_0x17f7c7=path[_0x92cf('0x22')](__dirname,_0x92cf('0x23'),rs[_0x92cf('0x24')](0x4)+_0x92cf('0x36'));fs[_0x92cf('0x26')](_0x17f7c7,_0x58fd94,{'encoding':'base64'});_0x266f11=path[_0x92cf('0x22')](__dirname,_0x92cf('0x23'),rs[_0x92cf('0x24')](0x4)+'.wav');return convertFile(_0x17f7c7,_0x266f11);})[_0x92cf('0x28')](function(){try{fs[_0x92cf('0x29')](_0x17f7c7);fs[_0x92cf('0x2a')](_0x266f11,_0x92cf('0x3a'));}catch(_0x508fd6){logger[_0x92cf('0x10')](_0x508fd6);}logger['info'](_0x92cf('0x43'),_0x266f11[_0x92cf('0x2b')]('.')[0x0]);return _0x266f11['split']('.')[0x0];});};exports[_0x92cf('0x44')]=function(_0x2e9760,_0x2759b0,_0x3e84a1){return google[_0x92cf('0x45')](_0x2e9760,_0x2759b0,_0x3e84a1)['then'](function(_0x1abbec){logger[_0x92cf('0x17')](_0x1abbec[_0x92cf('0x46')]);return rp(_0x1abbec);})[_0x92cf('0x28')](function(_0x985a52){var _0x20e868='';var _0x462d5d=0x0;try{fs[_0x92cf('0x29')](_0x2e9760);}catch(_0x3a71d7){logger[_0x92cf('0x10')](_0x3a71d7);}if(_0x985a52&&_0x985a52[_0x92cf('0x47')]){_0x20e868=_0x985a52['results'][_0x92cf('0x48')](function(_0x323424){return _0x323424&&_0x323424[_0x92cf('0x49')][0x0]&&_0x323424[_0x92cf('0x49')][0x0][_0x92cf('0x4a')]?_0x323424['alternatives'][0x0][_0x92cf('0x4a')]:'';})[_0x92cf('0x4b')]('\x0a');_0x462d5d=_0x985a52[_0x92cf('0x47')][_0x92cf('0x48')](function(_0xc2c19a){return _0xc2c19a&&_0xc2c19a[_0x92cf('0x49')][0x0]&&_0xc2c19a['alternatives'][0x0][_0x92cf('0x4c')]?_0xc2c19a[_0x92cf('0x49')][0x0]['confidence']:0x0;})[_0x92cf('0x4b')]('\x0a');}logger[_0x92cf('0x17')](_0x92cf('0x4d'),_0x20e868);logger[_0x92cf('0x17')]('googleASR\x20confidence',_0x462d5d);return{'transcript':_0x20e868,'confidence':_0x462d5d};})['catch'](function(_0xf89e2b){logger[_0x92cf('0x10')](_0x92cf('0x4e'),_0xf89e2b['statusCode'],_0xf89e2b[_0x92cf('0x4f')],_0xf89e2b['message']);});};exports[_0x92cf('0x50')]=function(_0x4357b0,_0x4241c6,_0x316d77,_0x1a7884){var _0x28ec21=apiai(_0x4241c6,{'language':_0x1a7884||'en'});return _0x28ec21[_0x92cf('0x51')](_0x316d77,{'sessionId':md5(_0x4357b0)})[_0x92cf('0x28')](function(_0x2e58b0){logger[_0x92cf('0x17')](JSON['stringify'](_0x2e58b0));return{'source':_0x2e58b0[_0x92cf('0x52')][_0x92cf('0x53')],'resolvedQuery':_0x2e58b0[_0x92cf('0x52')][_0x92cf('0x54')],'action':_0x2e58b0['result'][_0x92cf('0x55')],'actionIncomplete':_0x2e58b0[_0x92cf('0x52')][_0x92cf('0x56')],'speech':_0x2e58b0[_0x92cf('0x52')][_0x92cf('0x57')][_0x92cf('0x58')],'score':_0x2e58b0[_0x92cf('0x52')][_0x92cf('0x59')],'statusCode':_0x2e58b0[_0x92cf('0x5a')][_0x92cf('0x5b')],'endConversation':_0x2e58b0['result'][_0x92cf('0x5c')][_0x92cf('0x5d')]||![],'isFallbackIntent':_0x2e58b0[_0x92cf('0x52')]['metadata']['isFallbackIntent']};});};exports[_0x92cf('0x5e')]=function(_0x204e17,_0x45db4b,_0x418ab1,_0x58ff17,_0x2096bf,_0x35886f){var _0xa6519d=_0x58ff17['replace'](/\\n/g,'\x0a');var _0x341b1d={'credentials':{'private_key':_0xa6519d,'client_email':_0x418ab1}};var _0x714d7a=new dialogflow['SessionsClient'](_0x341b1d);var _0x57c482=_0x714d7a['sessionPath'](_0x45db4b,md5(_0x204e17));var _0x376429={'session':_0x57c482,'queryInput':{'text':{'text':_0x2096bf,'languageCode':_0x35886f}}};return _0x714d7a[_0x92cf('0x5f')](_0x376429)[_0x92cf('0x28')](function(_0x313a53){if(_0x313a53&&_0x313a53[_0x92cf('0x60')]){logger[_0x92cf('0x17')](_0x92cf('0x61'),JSON['stringify'](_0x313a53));var _0x961130=_0x313a53[0x0];if(_0x961130){var _0x38eb79={'action':_0x961130['queryResult']['action'],'allRequiredParamsPresent':_0x961130[_0x92cf('0x62')]['allRequiredParamsPresent'],'endConversation':_0x961130[_0x92cf('0x62')][_0x92cf('0x63')]&&_0x961130['queryResult']['diagnosticInfo'][_0x92cf('0x64')]?_0x961130[_0x92cf('0x62')]['diagnosticInfo'][_0x92cf('0x64')][_0x92cf('0x65')][_0x92cf('0x66')]:![],'fulfillmentText':_0x961130[_0x92cf('0x62')][_0x92cf('0x67')],'intentName':_0x961130[_0x92cf('0x62')]['intent'][_0x92cf('0x4f')],'intentDisplayName':_0x961130[_0x92cf('0x62')][_0x92cf('0x68')][_0x92cf('0x69')],'isFallbackIntent':_0x961130[_0x92cf('0x62')][_0x92cf('0x68')][_0x92cf('0x6a')],'languageCode':_0x961130[_0x92cf('0x62')][_0x92cf('0x6b')],'queryText':_0x961130[_0x92cf('0x62')][_0x92cf('0x6c')],'responseId':_0x961130[_0x92cf('0x6d')],'score':_0x961130[_0x92cf('0x62')][_0x92cf('0x6e')],'speech':_0x961130[_0x92cf('0x62')][_0x92cf('0x67')],'providerResponse':JSON['stringify'](_0x313a53)};return _0x38eb79;}}});};exports[_0x92cf('0x6f')]=function(_0x531fec,_0x14448f,_0x5b713c,_0x34fc5b){return tilde['asr'](_0x531fec,_0x14448f,_0x5b713c,_0x34fc5b)[_0x92cf('0x28')](function(_0x44e0bb){try{fs['unlink'](_0x531fec);}catch(_0x2e8586){logger[_0x92cf('0x10')](_0x2e8586);}logger[_0x92cf('0x17')](_0x92cf('0x70'),_0x44e0bb[_0x92cf('0x4a')]);logger[_0x92cf('0x17')](_0x92cf('0x71'),_0x44e0bb[_0x92cf('0x4c')]);return _0x44e0bb;});};exports[_0x92cf('0x72')]=function(_0x149629,_0x155dde,_0x37c45a,_0x26e91e,_0x3c012e,_0x4933d0){var _0x2cff19=path['resolve'](__dirname,'tmp',rs[_0x92cf('0x24')](0x4)+'.mp3');var _0x8d307a;return aws['polly'](_0x149629,_0x155dde,_0x37c45a,_0x26e91e,_0x3c012e,_0x4933d0,_0x2cff19)['then'](function(){_0x8d307a=path[_0x92cf('0x22')](__dirname,_0x92cf('0x23'),rs['generate'](0x4)+_0x92cf('0x25'));return convertFile(_0x2cff19,_0x8d307a);})[_0x92cf('0x28')](function(){try{fs[_0x92cf('0x29')](_0x2cff19);fs[_0x92cf('0x2a')](_0x8d307a,_0x92cf('0x3a'));}catch(_0x37ff52){logger[_0x92cf('0x10')](_0x37ff52);}return _0x8d307a[_0x92cf('0x2b')]('.')[0x0];});};exports[_0x92cf('0x73')]=function(_0x43d60a,_0x40e5b1,_0x2f8fb0,_0x24a320,_0x19fb44,_0x966071){return aws['lex'](_0x43d60a,_0x40e5b1,_0x2f8fb0,_0x24a320,_0x19fb44,_0x966071)[_0x92cf('0x28')](function(_0x537efe){logger[_0x92cf('0x17')](JSON[_0x92cf('0x3e')](_0x537efe));return _0x537efe;});};exports['ispeechTTS']=function(_0x4240a7,_0x37b473,_0x553ffe,_0xa39a2d){var _0x5c306c=util['format'](_0x92cf('0x74'),ISPEECH_API,_0x4240a7,encodeURIComponent(_0x37b473),_0x553ffe,_0xa39a2d);var _0x5c06fe=path[_0x92cf('0x22')](__dirname,'tmp',rs[_0x92cf('0x24')](0x4)+_0x92cf('0x36'));var _0x12a2a6;return downloadFile(_0x5c306c,_0x5c06fe)[_0x92cf('0x28')](function(){_0x12a2a6=path[_0x92cf('0x22')](__dirname,_0x92cf('0x23'),rs[_0x92cf('0x24')](0x4)+_0x92cf('0x25'));return convertFile(_0x5c06fe,_0x12a2a6);})[_0x92cf('0x28')](function(){try{fs[_0x92cf('0x29')](_0x5c06fe);fs['chmodSync'](_0x12a2a6,'777');}catch(_0x4ddfe7){logger[_0x92cf('0x10')](_0x4ddfe7);}return _0x12a2a6['split']('.')[0x0];});};exports[_0x92cf('0x75')]=function(_0x266ba7,_0x26072d,_0x119738,_0x347918){var _0x41d52f=util[_0x92cf('0x76')](_0x92cf('0x77'),ISPEECH_API,_0x26072d,_0x119738,base64Encode(_0x266ba7),_0x347918?util['format'](_0x92cf('0x78'),encodeURIComponent(_0x347918)):_0x92cf('0x79'));return uploadFile(_0x41d52f)[_0x92cf('0x28')](function(_0x59f2dd){return querystring[_0x92cf('0x7a')](_0x59f2dd);});};exports[_0x92cf('0x7b')]=function(_0x539573,_0x22f3f8){return sestek['nda'](_0x539573,_0x22f3f8)['then'](function(_0x1e9a74){logger[_0x92cf('0x17')](JSON[_0x92cf('0x3e')](_0x1e9a74));var _0x40cfb2={'speech':_0x1e9a74[_0x92cf('0x7c')],'action':_0x1e9a74['channelData']?_0x1e9a74['channelData']['CustomAction']:undefined,'actiondata':_0x1e9a74[_0x92cf('0x7d')]?_0x1e9a74[_0x92cf('0x7d')][_0x92cf('0x7e')]:undefined};if(_0x1e9a74[_0x92cf('0x7d')]&&_0x1e9a74[_0x92cf('0x7d')][_0x92cf('0x7f')]){return base64Decode(_0x1e9a74[_0x92cf('0x7d')][_0x92cf('0x7f')]['Data'],path[_0x92cf('0x22')](__dirname,_0x92cf('0x23'),rs[_0x92cf('0x24')](0x4)+'.wav'))[_0x92cf('0x28')](function(_0x4b1336){_0x40cfb2[_0x92cf('0x80')]=_0x4b1336;return _0x40cfb2;});}return _0x40cfb2;});};exports[_0x92cf('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 d622156..fecc1b9 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 _0x3ff4=['./nda','exports'];(function(_0x110cbb,_0x186ee7){var _0x145f91=function(_0x3d2195){while(--_0x3d2195){_0x110cbb['push'](_0x110cbb['shift']());}};_0x145f91(++_0x186ee7);}(_0x3ff4,0x1da));var _0x43ff=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x3ff4[_0x138adb];return _0x1b27f2;};var nda=require(_0x43ff('0x0'));module[_0x43ff('0x1')]={'nda':nda}; \ No newline at end of file +var _0x814f=['./nda','exports'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0x814f,0x1a2));var _0xf814=function(_0x1953d9,_0x2a5fff){_0x1953d9=_0x1953d9-0x0;var _0x112105=_0x814f[_0x1953d9];return _0x112105;};var nda=require(_0xf814('0x0'));module[_0xf814('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 1eba531..faeaeb0 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 _0x8b2b=['ndaactivity_type','Nda','calleridname','dnid','extension','text','Bearer\x20','access_token','body','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','channelData','custom_action_data','CustomActionData','request-promise','url','../../../../../config/logger','exports','POST','resolve','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x3733cf,_0x467c22){_0x3733cf=_0x3733cf-0x0;var _0xfe10c2=_0x8b2b[_0x3733cf];return _0xfe10c2;};'use strict';var rp=require(_0xb8b2('0x0'));var url=require(_0xb8b2('0x1'));var logger=require(_0xb8b2('0x2'))('agi');module[_0xb8b2('0x3')]=function(_0x415a60,_0x3beb9e){var _0x407738={'method':_0xb8b2('0x4'),'uri':url[_0xb8b2('0x5')](_0x3beb9e['ndauth_url'],'/token'),'form':{'grant_type':_0xb8b2('0x6'),'username':_0x3beb9e[_0xb8b2('0x7')],'password':_0x3beb9e[_0xb8b2('0x6')]},'json':!![]};return rp(_0x407738)[_0xb8b2('0x8')](function(_0x4a4c69){var _0x541b1b={'method':_0xb8b2('0x4'),'uri':url[_0xb8b2('0x5')](_0x3beb9e[_0xb8b2('0x9')],_0xb8b2('0xa')),'body':{'type':_0x3beb9e[_0xb8b2('0xb')]||'message','channelId':_0xb8b2('0xc'),'conversation':{'id':_0x415a60['uniqueid']},'from':{'id':_0x415a60['callerid'],'name':_0x415a60[_0xb8b2('0xd')]},'recipient':{'id':_0x415a60[_0xb8b2('0xe')],'name':_0x415a60[_0xb8b2('0xf')]},'text':_0x3beb9e[_0xb8b2('0x10')],'channelData':{}},'headers':{'Authorization':_0xb8b2('0x11')+_0x4a4c69[_0xb8b2('0x12')]},'json':!![]};if(_0x3beb9e['project']){_0x541b1b[_0xb8b2('0x13')]['channelData']['ProjectName']=_0x3beb9e['project'];}if(_0x3beb9e[_0xb8b2('0x14')]=='1'){_0x541b1b[_0xb8b2('0x13')]['channelData'][_0xb8b2('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb8b2('0x16')};}if(_0x3beb9e[_0xb8b2('0x17')]){_0x541b1b[_0xb8b2('0x13')][_0xb8b2('0x18')]['CustomAction']=_0x3beb9e['custom_action'];if(_0x3beb9e[_0xb8b2('0x19')]){_0x541b1b[_0xb8b2('0x13')][_0xb8b2('0x18')][_0xb8b2('0x1a')]=_0x3beb9e[_0xb8b2('0x19')];}}logger['info'](JSON['stringify'](_0x541b1b));return rp(_0x541b1b);});}; \ No newline at end of file +var _0x8278=['resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','dnid','extension','Bearer\x20','body','channelData','ProjectName','project','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','POST'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x8827('0x0'));var url=require(_0x8827('0x1'));var logger=require(_0x8827('0x2'))(_0x8827('0x3'));module['exports']=function(_0x5be177,_0x1b1dff){var _0x3479bf={'method':_0x8827('0x4'),'uri':url[_0x8827('0x5')](_0x1b1dff['ndauth_url'],_0x8827('0x6')),'form':{'grant_type':_0x8827('0x7'),'username':_0x1b1dff[_0x8827('0x8')],'password':_0x1b1dff[_0x8827('0x7')]},'json':!![]};return rp(_0x3479bf)[_0x8827('0x9')](function(_0xfb36a9){var _0xb78af={'method':_0x8827('0x4'),'uri':url[_0x8827('0x5')](_0x1b1dff[_0x8827('0xa')],_0x8827('0xb')),'body':{'type':_0x1b1dff[_0x8827('0xc')]||_0x8827('0xd'),'channelId':'Nda','conversation':{'id':_0x5be177[_0x8827('0xe')]},'from':{'id':_0x5be177[_0x8827('0xf')],'name':_0x5be177['calleridname']},'recipient':{'id':_0x5be177[_0x8827('0x10')],'name':_0x5be177[_0x8827('0x11')]},'text':_0x1b1dff['text'],'channelData':{}},'headers':{'Authorization':_0x8827('0x12')+_0xfb36a9['access_token']},'json':!![]};if(_0x1b1dff['project']){_0xb78af[_0x8827('0x13')][_0x8827('0x14')][_0x8827('0x15')]=_0x1b1dff[_0x8827('0x16')];}if(_0x1b1dff['ndagenerate_audio']=='1'){_0xb78af[_0x8827('0x13')][_0x8827('0x14')][_0x8827('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8827('0x18')};}if(_0x1b1dff[_0x8827('0x19')]){_0xb78af[_0x8827('0x13')][_0x8827('0x14')]['CustomAction']=_0x1b1dff[_0x8827('0x19')];if(_0x1b1dff[_0x8827('0x1a')]){_0xb78af[_0x8827('0x13')]['channelData'][_0x8827('0x1b')]=_0x1b1dff[_0x8827('0x1a')];}}logger[_0x8827('0x1c')](JSON['stringify'](_0xb78af));return rp(_0xb78af);});}; \ 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 42208c9..a2511ff 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 _0xc211=['./lib/api'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0xc211,0x19f));var _0x1c21=function(_0x33fc15,_0x405a34){_0x33fc15=_0x33fc15-0x0;var _0x3c558c=_0xc211[_0x33fc15];return _0x3c558c;};'use strict';var asr=require(_0x1c21('0x0'));module['exports']=function(_0x4439c7,_0x22cd12,_0x53652d,_0x13acea){return asr(_0x4439c7,_0x22cd12,_0x53652d,_0x13acea);}; \ No newline at end of file +var _0xa747=['exports','./lib/api'];(function(_0x3b534c,_0x2c614f){var _0x449ef9=function(_0x285279){while(--_0x285279){_0x3b534c['push'](_0x3b534c['shift']());}};_0x449ef9(++_0x2c614f);}(_0xa747,0x161));var _0x7a74=function(_0x150872,_0xde35d2){_0x150872=_0x150872-0x0;var _0x5c8ca6=_0xa747[_0x150872];return _0x5c8ca6;};'use strict';var asr=require(_0x7a74('0x0'));module[_0x7a74('0x1')]=function(_0x10a6ac,_0x245e2f,_0xfe5c80,_0xfbfad3){return asr(_0x10a6ac,_0x245e2f,_0xfe5c80,_0xfbfad3);}; \ 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 1f24495..fe2f1f6 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 _0xf932=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','unix','stringify','createReadStream','data','close','send','EOS','error','terminate','status','result','final','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','lodash','moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf932,0x1c0));var _0x2f93=function(_0x57f6de,_0x183a0b){_0x57f6de=_0x57f6de-0x0;var _0x5b3b46=_0xf932[_0x57f6de];return _0x5b3b46;};'use strict';var BPromise=require('bluebird');var _=require(_0x2f93('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2f93('0x1'));var crypto=require(_0x2f93('0x2'));var logger=require('../../../../../../config/logger')(_0x2f93('0x3'));module[_0x2f93('0x4')]=function(_0x329756,_0x4485cd,_0x278dd7,_0x534af2){return new BPromise(function(_0x4745ca,_0xfba075){logger[_0x2f93('0x5')](_0x2f93('0x6'),_0x534af2||_0x2f93('0x7'));var _0x169d52=new WebSocket(_0x534af2||_0x2f93('0x7'),{'perMessageDeflate':![]});var _0x53a396='';var _0x387ec3='0';var _0x261584='1';var _0x2cbea3=_0x2f93('0x8');function _0x52fe18(_0x3e774c){var _0x17265c=crypto['createHash'](_0x2f93('0x9'));_0x17265c[_0x2f93('0xa')](_0x3e774c);return _0x17265c[_0x2f93('0xb')](_0x2f93('0xc'));}function _0xaf5b2a(){try{logger[_0x2f93('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x2b923d=moment()[_0x2f93('0xd')]();var _0x5cbb45=_0x52fe18(_0x2b923d+_0x4485cd+_0x278dd7);_0x169d52['send'](JSON[_0x2f93('0xe')]({'appID':_0x4485cd,'timestamp':_0x2b923d,'appKey':_0x5cbb45}));var _0x3e56ce=fs[_0x2f93('0xf')](_0x329756);_0x3e56ce['on'](_0x2f93('0x10'),function(_0xa1c95b){_0x169d52['send'](_0xa1c95b);});_0x3e56ce['on'](_0x2f93('0x11'),function(){_0x169d52[_0x2f93('0x12')](_0x2f93('0x13'));});}catch(_0x58931b){logger[_0x2f93('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x2f93('0xe')](_0x58931b));_0x169d52[_0x2f93('0x15')]();}}function _0x13e6ce(_0xb1f470){try{if(_0xb1f470){var _0x37d14a=JSON['parse'](_0xb1f470);switch(_0x37d14a[_0x2f93('0x16')]){case 0x0:if(_0x37d14a[_0x2f93('0x17')]){if(_0x37d14a['result'][_0x2f93('0x18')]){logger[_0x2f93('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x2f93('0xe')](_0x37d14a[_0x2f93('0x17')]['hypotheses']));_0x53a396=_0x37d14a[_0x2f93('0x17')][_0x2f93('0x19')][0x0][_0x2f93('0x1a')];_0x387ec3=_0x37d14a['result'][_0x2f93('0x19')][0x0][_0x2f93('0x1b')];_0x261584='0';_0x2cbea3='Success.';_0x169d52[_0x2f93('0x15')]();}}break;case 0x1:logger[_0x2f93('0x5')](_0x2f93('0x8'));_0x261584='1';_0x2cbea3=_0x2f93('0x8');break;case 0x2:logger[_0x2f93('0x5')](_0x2f93('0x1c'));_0x261584='2';_0x2cbea3=_0x2f93('0x1c');break;case 0x9:logger[_0x2f93('0x5')](_0x2f93('0x1d'));_0x261584='9';_0x2cbea3='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x2f93('0x5')](_0x2f93('0x1e'));_0x261584='10';_0x2cbea3=_0x2f93('0x1e');break;case 0xb:logger[_0x2f93('0x5')](_0x2f93('0x1f'));_0x261584='11';_0x2cbea3=_0x2f93('0x1f');}}}catch(_0x1a9934){logger[_0x2f93('0x14')](_0x2f93('0x20'),JSON[_0x2f93('0xe')](_0x1a9934));_0x169d52['terminate']();}}function _0x175ded(){logger[_0x2f93('0x5')](_0x2f93('0x21'));_0x4745ca({'transcript':_0x53a396,'confidence':_0x387ec3,'status':_0x261584,'status_message':_0x2cbea3});}function _0x32c5e1(_0x4e7d9d){logger[_0x2f93('0x14')](_0x2f93('0x22'));if(!_[_0x2f93('0x23')](_0x4e7d9d)){logger['error'](_['isObject'](_0x4e7d9d)?JSON[_0x2f93('0xe')](_0x4e7d9d):_0x4e7d9d);}}_0x169d52['on'](_0x2f93('0x24'),_0xaf5b2a);_0x169d52['on'](_0x2f93('0x25'),_0x13e6ce);_0x169d52['on'](_0x2f93('0x11'),_0x175ded);_0x169d52['on']('error',_0x32c5e1);});}; \ No newline at end of file +var _0xbc74=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','Open\x20Tilde\x20ASR\x20socket','stringify','createReadStream','data','close','send','EOS','error','parse','status','result','hypotheses','transcript','likelihood','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','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0x5d4033,_0x419b2d){var _0x461849=function(_0x39dd63){while(--_0x39dd63){_0x5d4033['push'](_0x5d4033['shift']());}};_0x461849(++_0x419b2d);}(_0xbc74,0xdb));var _0x4bc7=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xbc74[_0x409353];return _0x4f4b59;};'use strict';var BPromise=require(_0x4bc7('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x4bc7('0x1'));var crypto=require(_0x4bc7('0x2'));var logger=require(_0x4bc7('0x3'))(_0x4bc7('0x4'));module[_0x4bc7('0x5')]=function(_0x11cfc9,_0x6751ab,_0x21d4cd,_0x21eaa6){return new BPromise(function(_0x7d5be7,_0x2fc521){logger[_0x4bc7('0x6')](_0x4bc7('0x7'),_0x21eaa6||_0x4bc7('0x8'));var _0x57e180=new WebSocket(_0x21eaa6||_0x4bc7('0x8'),{'perMessageDeflate':![]});var _0x5bd7a1='';var _0x9b4a34='0';var _0x4e6eeb='1';var _0x5aecbe=_0x4bc7('0x9');function _0x3c48da(_0x2a9dcc){var _0x2323bd=crypto[_0x4bc7('0xa')](_0x4bc7('0xb'));_0x2323bd['update'](_0x2a9dcc);return _0x2323bd[_0x4bc7('0xc')]('hex');}function _0x3d084c(){try{logger[_0x4bc7('0x6')](_0x4bc7('0xd'));var _0x411f49=moment()['unix']();var _0x47f2b2=_0x3c48da(_0x411f49+_0x6751ab+_0x21d4cd);_0x57e180['send'](JSON[_0x4bc7('0xe')]({'appID':_0x6751ab,'timestamp':_0x411f49,'appKey':_0x47f2b2}));var _0x8b7fb9=fs[_0x4bc7('0xf')](_0x11cfc9);_0x8b7fb9['on'](_0x4bc7('0x10'),function(_0x571bff){_0x57e180['send'](_0x571bff);});_0x8b7fb9['on'](_0x4bc7('0x11'),function(){_0x57e180[_0x4bc7('0x12')](_0x4bc7('0x13'));});}catch(_0x2a05c5){logger[_0x4bc7('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x4bc7('0xe')](_0x2a05c5));_0x57e180['terminate']();}}function _0x502706(_0x3481a8){try{if(_0x3481a8){var _0x5230f1=JSON[_0x4bc7('0x15')](_0x3481a8);switch(_0x5230f1[_0x4bc7('0x16')]){case 0x0:if(_0x5230f1[_0x4bc7('0x17')]){if(_0x5230f1[_0x4bc7('0x17')]['final']){logger[_0x4bc7('0x6')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x5230f1[_0x4bc7('0x17')]['hypotheses']));_0x5bd7a1=_0x5230f1[_0x4bc7('0x17')][_0x4bc7('0x18')][0x0][_0x4bc7('0x19')];_0x9b4a34=_0x5230f1[_0x4bc7('0x17')][_0x4bc7('0x18')][0x0][_0x4bc7('0x1a')];_0x4e6eeb='0';_0x5aecbe='Success.';_0x57e180[_0x4bc7('0x1b')]();}}break;case 0x1:logger[_0x4bc7('0x6')](_0x4bc7('0x9'));_0x4e6eeb='1';_0x5aecbe=_0x4bc7('0x9');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x4e6eeb='2';_0x5aecbe=_0x4bc7('0x1c');break;case 0x9:logger[_0x4bc7('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x4e6eeb='9';_0x5aecbe=_0x4bc7('0x1d');break;case 0xa:logger[_0x4bc7('0x6')](_0x4bc7('0x1e'));_0x4e6eeb='10';_0x5aecbe=_0x4bc7('0x1e');break;case 0xb:logger[_0x4bc7('0x6')](_0x4bc7('0x1f'));_0x4e6eeb='11';_0x5aecbe=_0x4bc7('0x1f');}}}catch(_0x3756e2){logger['error'](_0x4bc7('0x20'),JSON[_0x4bc7('0xe')](_0x3756e2));_0x57e180[_0x4bc7('0x1b')]();}}function _0xea8656(){logger[_0x4bc7('0x6')](_0x4bc7('0x21'));_0x7d5be7({'transcript':_0x5bd7a1,'confidence':_0x9b4a34,'status':_0x4e6eeb,'status_message':_0x5aecbe});}function _0x13bced(_0x48df7a){logger[_0x4bc7('0x14')](_0x4bc7('0x22'));if(!_['isNil'](_0x48df7a)){logger[_0x4bc7('0x14')](_[_0x4bc7('0x23')](_0x48df7a)?JSON[_0x4bc7('0xe')](_0x48df7a):_0x48df7a);}}_0x57e180['on'](_0x4bc7('0x24'),_0x3d084c);_0x57e180['on'](_0x4bc7('0x25'),_0x502706);_0x57e180['on'](_0x4bc7('0x11'),_0xea8656);_0x57e180['on'](_0x4bc7('0x14'),_0x13bced);});}; \ 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 a446add..fff041e 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 _0x2b40=['exports','./asr'];(function(_0xd61fb5,_0x2714d6){var _0x18116e=function(_0x3be427){while(--_0x3be427){_0xd61fb5['push'](_0xd61fb5['shift']());}};_0x18116e(++_0x2714d6);}(_0x2b40,0xbd));var _0x02b4=function(_0x3a55a7,_0x1c2b0a){_0x3a55a7=_0x3a55a7-0x0;var _0x5caec0=_0x2b40[_0x3a55a7];return _0x5caec0;};var asr=require(_0x02b4('0x0'));module[_0x02b4('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe159=['./asr','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe159,0xda));var _0x9e15=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe159[_0x3ab51d];return _0x29a04e;};var asr=require(_0x9e15('0x0'));module[_0x9e15('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index ab5d78e..1cca78b 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 _0x1fc2=['events','EventEmitter','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util'];(function(_0x2db215,_0x47920c){var _0x43f903=function(_0x4c6c3d){while(--_0x4c6c3d){_0x2db215['push'](_0x2db215['shift']());}};_0x43f903(++_0x47920c);}(_0x1fc2,0xe6));var _0x21fc=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x1fc2[_0x2070da];return _0x4f9fe1;};'use strict';var util=require(_0x21fc('0x0'));var net=require('net');var EventEmitter=require(_0x21fc('0x1'))[_0x21fc('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x21fc('0x3'));var AGIServer=function(_0x2d98be,_0x5c7383,_0x5c9941){var _0x454d48=this,_0x2d98be=_0x2d98be||0x11dd,_0x5c7383=_0x5c7383||_0x21fc('0x4'),_0x33e723=null,_0x3c93c3=0x0;EventEmitter[_0x21fc('0x5')](_0x454d48);function _0x2a3084(){if(!_0x2d98be){_0x454d48[_0x21fc('0x6')](_0x21fc('0x7'),new AGIError(_0x21fc('0x8')));return![];}_0x33e723=net['createServer']();_0x33e723[_0x21fc('0x9')](_0x2d98be,_0x5c7383);_0x33e723['on'](_0x21fc('0xa'),function(){_0x454d48[_0x21fc('0x6')]('listening');});_0x33e723['on'](_0x21fc('0xb'),function(_0x6b4a53){_0x33e723['getConnections'](function(_0xb29d87,_0x541c39){if(_0xb29d87){_0x454d48[_0x21fc('0x6')](_0x21fc('0x7'),new AGIError(_0x21fc('0xc'),_0xb29d87));}else if(_0x5c9941&&_0x5c9941<0x0){_0x454d48['emit'](_0x21fc('0x7'),new AGIError(_0x21fc('0xd')));_0x6b4a53[_0x21fc('0xe')]();}else if(_0x5c9941&&_0x5c9941>0x0&&_0x5c9941<_0x541c39){_0x3c93c3+=0x1;_0x454d48[_0x21fc('0x6')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x3c93c3));_0x6b4a53[_0x21fc('0xe')]();}else{var _0x4b4fd0=new AGIChannel(_0x6b4a53);_0x4b4fd0['on']('ready',function(){_0x454d48['emit'](_0x21fc('0xb'),_0x4b4fd0);});}});});_0x33e723['on'](_0x21fc('0x7'),function(_0xb6e8aa){_0x454d48['emit'](_0x21fc('0x7'),new AGIError(_0x21fc('0xc'),_0xb6e8aa[_0x21fc('0xf')]));});_0x33e723['on']('close',function(){_0x454d48[_0x21fc('0x6')](_0x21fc('0x10'),new AGIError(_0x21fc('0x11')));});}process[_0x21fc('0x12')](function(){_0x2a3084();});};util[_0x21fc('0x13')](AGIServer,EventEmitter);module[_0x21fc('0x14')]=function(_0x228324,_0x459028,_0x50551e){return new AGIServer(_0x228324,_0x459028,_0x50551e);}; \ No newline at end of file +var _0xef03=['ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','util','net','events','EventEmitter','./error','call','error','E_AGI_ARGUMENT_PORT','createServer','listening','emit','connection','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION'];(function(_0x47876e,_0x367c79){var _0x5ecd1f=function(_0x4a6f35){while(--_0x4a6f35){_0x47876e['push'](_0x47876e['shift']());}};_0x5ecd1f(++_0x367c79);}(_0xef03,0x117));var _0x3ef0=function(_0x33977a,_0x3dbc0d){_0x33977a=_0x33977a-0x0;var _0x23cda7=_0xef03[_0x33977a];return _0x23cda7;};'use strict';var util=require(_0x3ef0('0x0'));var net=require(_0x3ef0('0x1'));var EventEmitter=require(_0x3ef0('0x2'))[_0x3ef0('0x3')];var AGIError=require(_0x3ef0('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x44b740,_0x4d4b49,_0x1d7a0a){var _0x5173bc=this,_0x44b740=_0x44b740||0x11dd,_0x4d4b49=_0x4d4b49||'127.0.0.1',_0x542be7=null,_0x30c002=0x0;EventEmitter[_0x3ef0('0x5')](_0x5173bc);function _0x31ebc3(){if(!_0x44b740){_0x5173bc['emit'](_0x3ef0('0x6'),new AGIError(_0x3ef0('0x7')));return![];}_0x542be7=net[_0x3ef0('0x8')]();_0x542be7['listen'](_0x44b740,_0x4d4b49);_0x542be7['on'](_0x3ef0('0x9'),function(){_0x5173bc[_0x3ef0('0xa')](_0x3ef0('0x9'));});_0x542be7['on'](_0x3ef0('0xb'),function(_0x5b18ac){_0x542be7[_0x3ef0('0xc')](function(_0x140ea1,_0x2c0905){if(_0x140ea1){_0x5173bc[_0x3ef0('0xa')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x140ea1));}else if(_0x1d7a0a&&_0x1d7a0a<0x0){_0x5173bc[_0x3ef0('0xa')](_0x3ef0('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5b18ac[_0x3ef0('0xd')]();}else if(_0x1d7a0a&&_0x1d7a0a>0x0&&_0x1d7a0a<_0x2c0905){_0x30c002+=0x1;_0x5173bc['emit']('error',new AGIError(_0x3ef0('0xe'),_0x30c002));_0x5b18ac[_0x3ef0('0xd')]();}else{var _0x97de33=new AGIChannel(_0x5b18ac);_0x97de33['on'](_0x3ef0('0xf'),function(){_0x5173bc['emit'](_0x3ef0('0xb'),_0x97de33);});}});});_0x542be7['on'](_0x3ef0('0x6'),function(_0x20d764){_0x5173bc[_0x3ef0('0xa')](_0x3ef0('0x6'),new AGIError(_0x3ef0('0x10'),_0x20d764[_0x3ef0('0x11')]));});_0x542be7['on'](_0x3ef0('0x12'),function(){_0x5173bc[_0x3ef0('0xa')]('close',new AGIError(_0x3ef0('0x13')));});}process[_0x3ef0('0x14')](function(){_0x31ebc3();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x42fcfa,_0x3c4e60,_0x462d8f){return new AGIServer(_0x42fcfa,_0x3c4e60,_0x462d8f);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 78604b7..423d90c 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 _0x3134=['no\x20project_id\x20configured','client_email','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','providerResponse','speech','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','.wav','SestekNDA\x20is\x20unreachable','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','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','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','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','streamFile','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','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','operation','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','getPause','pause_id','no\x20file\x20audio\x20found','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','replace','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','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','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','getSquareProject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','shelljs','odbc','randomstring','moment','mustache','agi','../../config/environment','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getSound','getSoundById','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','getSoundPath','format','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','arg_1','createSquareMessage','createCmContact','isNil','callback_','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','includes','POST','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','parse','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','clear','agicommand','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','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','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','url','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','no\x20text\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x3134,0xdf));var _0x4313=function(_0x5b7cd1,_0x130457){_0x5b7cd1=_0x5b7cd1-0x0;var _0x25cc75=_0x3134[_0x5b7cd1];return _0x25cc75;};'use strict';var fs=require('fs');var path=require(_0x4313('0x0'));var util=require('util');var _=require('lodash');var sh=require(_0x4313('0x1'));var odbc=require(_0x4313('0x2'))();var rs=require(_0x4313('0x3'));var moment=require(_0x4313('0x4'));var Mustache=require(_0x4313('0x5'));var rp=require('request-promise');var logger=require('../../config/logger')(_0x4313('0x6'));var config=require(_0x4313('0x7'));var scripts=require('./scripts');var FILES_PATH=_0x4313('0x8');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0x4313('0x9'),_0x4313('0xa'),_0x4313('0xb')];var AGIVertices=function(_0x16b5e7,_0x44fd7b,_0x2de23d){this[_0x4313('0xc')]=_0x16b5e7;this[_0x4313('0xd')]=_0x44fd7b;this[_0x4313('0xe')]=_0x2de23d;};AGIVertices['prototype'][_0x4313('0xf')]=function(_0x11329a,_0x7d6c8){this['rpc'][_0x4313('0x10')](_0x11329a)[_0x4313('0x11')](function(_0x2013b5){_0x7d6c8(null,_0x2013b5?_0x2013b5[_0x4313('0x12')]:![]);})[_0x4313('0x13')](function(_0x3986a5){_0x7d6c8(_0x3986a5);});};AGIVertices[_0x4313('0x14')][_0x4313('0x15')]=function(_0x443117,_0x1805c1){this[_0x4313('0xd')][_0x4313('0x16')](_0x443117)[_0x4313('0x11')](function(_0x31c601){_0x1805c1(null,_0x31c601?_0x31c601[_0x4313('0x12')]:![]);})[_0x4313('0x13')](function(_0x3a262e){_0x1805c1(_0x3a262e);});};AGIVertices[_0x4313('0x14')]['getSquareProject']=function(_0x3eaf4a,_0x22b223){this['rpc'][_0x4313('0x17')](_0x3eaf4a)['then'](function(_0x3e2aae){_0x22b223(null,_0x3e2aae?_0x3e2aae[_0x4313('0x12')]:![]);})[_0x4313('0x13')](function(_0x2d3683){_0x22b223(_0x2d3683);});};AGIVertices[_0x4313('0x14')][_0x4313('0x18')]=function(_0xf84b8d,_0x20d36a){this['rpc'][_0x4313('0x19')](_0xf84b8d)[_0x4313('0x11')](function(_0x2ecec2){_0x20d36a(null,_0x2ecec2?_0x2ecec2['dsn']:![]);})[_0x4313('0x13')](function(_0x497272){_0x20d36a(_0x497272);});};AGIVertices[_0x4313('0x14')]['getUser']=function(_0x2bf29b,_0x5e21f6){this[_0x4313('0xd')]['getUserById'](_0x2bf29b)[_0x4313('0x11')](function(_0x2f8e99){_0x5e21f6(null,_0x2f8e99?_0x2f8e99[_0x4313('0x12')]:![]);})[_0x4313('0x13')](function(_0x47ffc7){_0x5e21f6(_0x47ffc7);});};AGIVertices[_0x4313('0x14')]['getTrunk']=function(_0x28ed3b,_0x451d9a){this[_0x4313('0xd')]['getTrunkById'](_0x28ed3b)[_0x4313('0x11')](function(_0x29209e){_0x451d9a(null,_0x29209e?_0x29209e[_0x4313('0x12')]:![]);})[_0x4313('0x13')](function(_0x7bfba3){_0x451d9a(_0x7bfba3);});};AGIVertices[_0x4313('0x14')][_0x4313('0x1a')]=function(_0x270419,_0x47c2cb){var _0x456a49=this;this[_0x4313('0xd')][_0x4313('0x1b')](_0x270419)[_0x4313('0x11')](function(_0x4fd186){_0x47c2cb(null,_0x4fd186?_0x456a49['getSoundPath'](_0x4fd186[_0x4313('0x1c')]):![]);})[_0x4313('0x13')](function(_0x4c0d86){_0x47c2cb(_0x4c0d86);});};AGIVertices[_0x4313('0x14')]['getMailAccount']=function(_0x31f8d8,_0x288464){this[_0x4313('0xd')][_0x4313('0x1d')](_0x31f8d8)[_0x4313('0x11')](function(_0x5e5860){_0x288464(null,_0x5e5860?_0x5e5860:![]);})[_0x4313('0x13')](function(_0x329062){_0x288464(_0x329062);});};AGIVertices[_0x4313('0x14')]['sendMailMessage']=function(_0x49dc73,_0x378a7a,_0x1ed4a1){this[_0x4313('0xe')][_0x4313('0x1e')](_0x49dc73,_0x378a7a)['then'](function(){_0x1ed4a1(null);})[_0x4313('0x13')](function(_0x844a6){_0x1ed4a1(_0x844a6);});};AGIVertices[_0x4313('0x14')][_0x4313('0x1f')]=function(_0xe99de4,_0x3cdf6b){this[_0x4313('0xd')][_0x4313('0x20')](_0xe99de4)['then'](function(_0x19b0e3){if(_0x19b0e3){if(_0x19b0e3[_0x4313('0x21')]){_0x3cdf6b(null,[_0x19b0e3[_0x4313('0x22')]]);}else{_0x3cdf6b(null,_[_0x4313('0x23')](_0x19b0e3['Intervals'],_0x4313('0x22')));}}else{_0x3cdf6b(null,![]);}})[_0x4313('0x13')](function(_0x4a64ad){_0x3cdf6b(_0x4a64ad);});};AGIVertices[_0x4313('0x14')][_0x4313('0x24')]=function(_0x51a047){return util[_0x4313('0x25')]('%s/sounds/converted/%s',FILES_PATH,_0x51a047);};AGIVertices['prototype'][_0x4313('0x26')]=function(_0x328488,_0x55806d,_0x4dcdc1){odbc['open'](_0x328488,function(_0x5e61f8){if(_0x5e61f8){logger['error'](_0x4313('0x27'),_0x5e61f8);_0x4dcdc1(_0x5e61f8);}else{logger[_0x4313('0x28')]('ODBC\x20connection\x20successfully');odbc[_0x4313('0x29')](_0x55806d,function(_0x3e88ba,_0x1629d1){if(_0x3e88ba){logger[_0x4313('0x28')](_0x4313('0x2a'),_0x55806d);_0x4dcdc1(_0x3e88ba);}else{logger[_0x4313('0x28')](_0x4313('0x2b'),_0x55806d);odbc[_0x4313('0x2c')](function(_0x38db7c){if(_0x38db7c){logger[_0x4313('0x2d')](_0x4313('0x2e'),_0x38db7c);}_0x4dcdc1(null,_0x1629d1);});}});}});};AGIVertices[_0x4313('0x14')][_0x4313('0x2f')]=function(_0x1a6507,_0x29dbdd){this['rpc'][_0x4313('0x30')](_0x1a6507)[_0x4313('0x11')](function(_0x2ab743){_0x29dbdd(null,_0x2ab743?_0x2ab743:![]);})[_0x4313('0x13')](function(_0x23bc8a){_0x29dbdd(_0x23bc8a);});};AGIVertices[_0x4313('0x14')]['createSmsMessage']=function(_0x3cd3c7,_0x1f34aa){this[_0x4313('0xd')][_0x4313('0x31')](_0x3cd3c7)[_0x4313('0x11')](function(_0x24dd6a){_0x1f34aa(null,_0x24dd6a);})['catch'](function(_0x1e29b5){_0x1f34aa(_0x1e29b5);});};AGIVertices['prototype'][_0x4313('0x32')]=function(_0x28902f,_0x4d59d3,_0x58c0c4){this['rpc'][_0x4313('0x32')]({'uniqueid':this[_0x4313('0xc')][_0x4313('0x33')],'node':_0x28902f[_0x4313('0x34')],'application':_0x28902f['agicommand'],'data':_0x4d59d3||null,'project_name':this['channel']['arg_1'],'callerid':this['channel'][_0x4313('0x35')]})['then'](function(_0x143b84){if(_0x58c0c4){_0x58c0c4(null,_0x143b84);}})['catch'](function(_0x36e751){if(_0x58c0c4){_0x58c0c4(_0x36e751);}});};AGIVertices[_0x4313('0x14')][_0x4313('0x36')]=function(_0x3ddd95,_0x925ed3,_0x336f73,_0x33db0c){this[_0x4313('0xd')]['createSquareRecording']({'uniqueid':this['channel'][_0x4313('0x33')],'callerid':this[_0x4313('0xc')][_0x4313('0x35')],'calleridname':this[_0x4313('0xc')][_0x4313('0x37')],'context':this[_0x4313('0xc')][_0x4313('0x38')],'extension':this['channel'][_0x4313('0x39')],'priority':this[_0x4313('0xc')][_0x4313('0x3a')],'accountcode':this[_0x4313('0xc')][_0x4313('0x3b')],'dnid':this[_0x4313('0xc')]['dnid'],'projectName':this[_0x4313('0xc')][_0x4313('0x3c')],'saveName':_0x925ed3,'filename':_0x3ddd95['file']||_0x925ed3,'savePath':_0x336f73})[_0x4313('0x11')](function(_0x323dc6){_0x33db0c(null,_0x323dc6);})['catch'](function(_0x58404b){_0x33db0c(_0x58404b);});};AGIVertices[_0x4313('0x14')][_0x4313('0x3d')]=function(_0x5e1210,_0x26a18c,_0x2da012,_0x15c92d,_0x35c693){this[_0x4313('0xd')][_0x4313('0x3d')]({'uniqueid':this[_0x4313('0xc')][_0x4313('0x33')],'body':_0x5e1210,'direction':_0x26a18c,'providerName':_0x2da012,'providerResponse':_0x15c92d})[_0x4313('0x11')](function(_0x5b8e93){if(_0x35c693){_0x35c693(null,_0x5b8e93);}})[_0x4313('0x13')](function(_0x109f77){if(_0x35c693){_0x35c693(_0x109f77);}});};AGIVertices[_0x4313('0x14')][_0x4313('0x3e')]=function(_0x29df1d,_0x35a831){this[_0x4313('0xd')][_0x4313('0x3e')]({'firstName':_['isEmpty'](_0x29df1d['name'])||_[_0x4313('0x3f')](_0x29df1d[_0x4313('0x12')])?_0x4313('0x40')+Math['random']():_0x29df1d[_0x4313('0x12')],'lastName':_[_0x4313('0x41')](_0x29df1d[_0x4313('0x42')])||_['isNil'](_0x29df1d[_0x4313('0x42')])?null:_0x29df1d[_0x4313('0x42')],'phone':_0x29df1d[_0x4313('0x43')],'ListId':_0x29df1d[_0x4313('0x44')],'scheduledat':_0x29df1d[_0x4313('0x45')],'callbackUniqueid':this[_0x4313('0xc')][_0x4313('0x33')],'tags':_0x4313('0x46'),'description':_0x4313('0x47')+_0x29df1d[_0x4313('0x45')][_0x4313('0x48')](),'priority':_0x29df1d[_0x4313('0x49')]})[_0x4313('0x11')](function(_0x15b234){_0x35a831(null,_0x15b234);})['catch'](function(_0x2ae308){_0x35a831(_0x2ae308);});};AGIVertices[_0x4313('0x14')]['getPause']=function(_0xb82161,_0x36bb91){this[_0x4313('0xd')][_0x4313('0x4a')](_0xb82161)['then'](function(_0x2068c4){_0x36bb91(null,_0x2068c4?_0x2068c4['name']:![]);})[_0x4313('0x13')](function(_0x1f34a1){_0x36bb91(_0x1f34a1);});};AGIVertices['prototype']['agentPause']=function(_0x365fd4,_0x1b579e,_0x57323b){var _0x373c72={'role':_0x4313('0x4b')};_0x373c72[_0x365fd4]=this[_0x4313('0xc')][_0x4313('0x35')];this[_0x4313('0xd')][_0x4313('0x4c')](_0x373c72,_0x1b579e,this[_0x4313('0xc')][_0x4313('0x33')])['then'](function(_0x12af60){_0x57323b(null,_[_0x4313('0x3f')](_0x12af60)?![]:!![]);})[_0x4313('0x13')](function(_0x1a536d){logger[_0x4313('0x2d')](_0x1a536d);_0x57323b(null,![]);});};AGIVertices[_0x4313('0x14')][_0x4313('0x4d')]=function(_0x47d6a1,_0x8f68d){var _0x500479={'role':_0x4313('0x4b')};_0x500479[_0x47d6a1]=this[_0x4313('0xc')]['callerid'];this['rpc'][_0x4313('0x4d')](_0x500479)['then'](function(_0x3e2b48){_0x8f68d(null,_[_0x4313('0x3f')](_0x3e2b48)?![]:!![]);})[_0x4313('0x13')](function(_0x74fd57){logger[_0x4313('0x2d')](_0x74fd57);_0x8f68d(null,![]);});};AGIVertices[_0x4313('0x14')]['agentLogout']=function(_0x4f344d,_0x412630){var _0x2585b9={'role':'agent'};_0x2585b9[_0x4f344d]=this[_0x4313('0xc')]['callerid'];this[_0x4313('0xd')][_0x4313('0x4e')](_0x2585b9)['then'](function(_0x4612f2){_0x412630(null,_[_0x4313('0x3f')](_0x4612f2)?![]:!![]);})[_0x4313('0x13')](function(_0x2964dc){logger['error'](_0x2964dc);_0x412630(null,![]);});};AGIVertices[_0x4313('0x14')][_0x4313('0x4f')]=function(_0x805bec,_0x224378){var _0x27faba={'role':_0x4313('0x4b')};_0x27faba[_0x805bec]=this[_0x4313('0xc')][_0x4313('0x35')];var _0x3d717f=_0x805bec!=_0x4313('0x50')?util[_0x4313('0x25')](_0x4313('0x51'),'LOCAL',this['channel'][_0x4313('0x35')]):undefined;this[_0x4313('0xd')]['agentLogin'](_0x27faba,_0x3d717f)[_0x4313('0x11')](function(_0x1f0c40){_0x224378(null,_[_0x4313('0x3f')](_0x1f0c40)?![]:!![]);})[_0x4313('0x13')](function(_0x3e33e4){logger['error'](_0x3e33e4);_0x224378(null,![]);});};AGIVertices[_0x4313('0x14')][_0x4313('0x52')]=function(_0x868265,_0x1c7add){sh[_0x4313('0x53')](_[_0x4313('0x54')](_0x868265),function(_0x542d94,_0x38e711){var _0x27c7e2=_0x38e711['replace'](/(\r\n|\n|\r)/gm,'');_0x1c7add(null,_0x27c7e2);});};AGIVertices[_0x4313('0x14')]['googleCloudTTS']=function(_0x4d960c,_0x41c123){scripts['googleCloudTTS'](_0x4d960c[_0x4313('0x55')],_0x4d960c[_0x4313('0x56')]||_0x4313('0x57'),_0x4d960c['text'],_0x4d960c['languageCode']||_0x4313('0x58'),_0x4d960c[_0x4313('0x59')]||_0x4313('0x5a'),_0x4d960c[_0x4313('0x5b')]||_0x4313('0x5c'))['then'](function(_0x269b73){_0x41c123(null,_0x269b73);})[_0x4313('0x13')](function(_0x4a36c5){_0x41c123(_0x4a36c5);});};AGIVertices['prototype'][_0x4313('0x5d')]=function(_0x1f958d,_0xd5e450){scripts[_0x4313('0x5d')](_0x1f958d['text'],_0x1f958d[_0x4313('0x5e')]||'en',0x1)[_0x4313('0x11')](function(_0x211787){_0xd5e450(null,_0x211787);})[_0x4313('0x13')](function(_0x1c780a){_0xd5e450(_0x1c780a);});};AGIVertices[_0x4313('0x14')][_0x4313('0x5f')]=function(_0x4b5717,_0xadb840){var _0x5ba28e={'uri':_0x4b5717['url'],'method':_0x4b5717[_0x4313('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4b5717['timeout'])==='number'&&parseInt(_0x4b5717[_0x4313('0x61')])>=0x1?parseInt(_0x4b5717[_0x4313('0x61')])*0x3e8:0x5*0x3e8};if(_[_0x4313('0x62')]([_0x4313('0x63'),'PUT'],_0x5ba28e['method']['toUpperCase']())){try{_0x5ba28e[_0x4313('0x64')]=_0x4b5717['rawBody']?JSON['parse'](_0x4b5717['rawBody']):{};}catch(_0x5ba1c6){logger['error'](_0x4313('0x65'),_0x5ba1c6);}}try{_0x5ba28e[_0x4313('0x66')]=_0x4b5717['rawHeaders']?JSON['parse'](_0x4b5717[_0x4313('0x67')]):{};}catch(_0x2a9597){logger[_0x4313('0x2d')](_0x4313('0x68'),_0x2a9597);}if(_0x4b5717['computedVariables']){try{var _0x6864b9=require(_0x4b5717[_0x4313('0x69')])[_0x4313('0x6a')](this,_0x5ba28e);_0x5ba28e[_0x4313('0x6b')]=Mustache['render'](_0x4b5717['url'],_0x6864b9,{},['$$','$$']);if(_0x5ba28e[_0x4313('0x66')]){_0x5ba28e[_0x4313('0x66')]=JSON[_0x4313('0x6c')](Mustache[_0x4313('0x6d')](JSON[_0x4313('0x6e')](_0x5ba28e[_0x4313('0x66')]),_0x6864b9,{},['$$','$$']));}if(_0x5ba28e['body']){_0x5ba28e['body']=JSON[_0x4313('0x6c')](Mustache['render'](JSON[_0x4313('0x6e')](_0x5ba28e['body']),_0x6864b9,{},['$$','$$']));}}catch(_0x23d6b4){logger[_0x4313('0x2d')](_0x4313('0x6f'),_0x23d6b4);}}rp(_0x5ba28e)[_0x4313('0x11')](function(_0x13343a){var _0x17015f={'statusCode':_0x13343a[_0x4313('0x70')]||0xc8,'statusMessage':_0x13343a['statusMessage']||'OK','headers':_0x13343a['headers']||{},'body':_0x13343a[_0x4313('0x64')]||{}};_0xadb840(null,_0x17015f);})[_0x4313('0x13')](function(_0x4fa664){var _0x525b89={'statusCode':_0x4fa664[_0x4313('0x70')]||0x1f4,'statusMessage':_0x4fa664[_0x4313('0x71')]||_0x4313('0x72'),'headers':_0x4fa664[_0x4313('0x73')][_0x4313('0x66')]||{},'body':_0x4fa664[_0x4313('0x73')][_0x4313('0x64')]||{}};_0xadb840(null,_0x525b89);});};AGIVertices[_0x4313('0x14')][_0x4313('0x74')]=function(_0xfb7e08,_0x3eb5ac){scripts[_0x4313('0x74')](this[_0x4313('0xc')]['uniqueid'],_0xfb7e08[_0x4313('0x75')],_0xfb7e08['text'],_0xfb7e08[_0x4313('0x76')]||'en')[_0x4313('0x11')](function(_0x4fdb51){_0x3eb5ac(null,_0x4fdb51);})[_0x4313('0x13')](function(_0x210048){_0x3eb5ac(_0x210048);});};AGIVertices[_0x4313('0x14')]['googleDialogflowV2']=function(_0x313ab6,_0x3355e3){scripts[_0x4313('0x77')](this[_0x4313('0xc')][_0x4313('0x33')],_0x313ab6[_0x4313('0x78')],_0x313ab6['client_email'],_0x313ab6[_0x4313('0x79')],_0x313ab6[_0x4313('0x57')],_0x313ab6[_0x4313('0x7a')]||'en')['then'](function(_0x2b9a04){_0x3355e3(null,_0x2b9a04);})[_0x4313('0x13')](function(_0x40da07){_0x3355e3(_0x40da07);});};AGIVertices[_0x4313('0x14')][_0x4313('0x7b')]=function(_0x381cb6,_0x2bb7b4){scripts[_0x4313('0x7b')](this[_0x4313('0xc')],_0x381cb6)[_0x4313('0x11')](function(_0x38e9e8){_0x2bb7b4(null,_0x38e9e8);})[_0x4313('0x13')](function(_0x55c2d7){_0x2bb7b4(_0x55c2d7);});};AGIVertices[_0x4313('0x14')]['ispeechTTS']=function(_0x551882,_0x3450ab){scripts[_0x4313('0x7c')](_0x551882[_0x4313('0x75')],_0x551882[_0x4313('0x57')],_0x551882['ispeech_tts_language']||'en-US',_0x551882[_0x4313('0x7d')])[_0x4313('0x11')](function(_0x21bef3){_0x3450ab(null,_0x21bef3);})['catch'](function(_0x2f7dc1){_0x3450ab(_0x2f7dc1);});};AGIVertices[_0x4313('0x14')][_0x4313('0x7e')]=function(_0x381fed,_0x5bbd97,_0x3c51d0){scripts[_0x4313('0x7e')](_0x5bbd97,_0x381fed[_0x4313('0x75')],_0x381fed[_0x4313('0x7f')]||_0x4313('0x58'),this[_0x4313('0x80')](_0x381fed[_0x4313('0x81')])?_0x381fed[_0x4313('0x81')]:undefined)[_0x4313('0x11')](function(_0xcbdbad){_0x3c51d0(null,_0xcbdbad);})[_0x4313('0x13')](function(_0x3aeae6){_0x3c51d0(_0x3aeae6);});};AGIVertices[_0x4313('0x14')][_0x4313('0x82')]=function(_0x3a41a1,_0x1150de){scripts[_0x4313('0x82')](_0x3a41a1[_0x4313('0x83')],_0x3a41a1[_0x4313('0x84')],_0x3a41a1[_0x4313('0x85')],_0x3a41a1['aws_polly_voice']||_0x4313('0x86'),_0x3a41a1[_0x4313('0x57')],_0x3a41a1['aws_text_type']||_0x4313('0x57'))['then'](function(_0x2766e3){_0x1150de(null,_0x2766e3);})[_0x4313('0x13')](function(_0x236659){_0x1150de(_0x236659);});};AGIVertices[_0x4313('0x14')][_0x4313('0x87')]=function(_0x4c0101,_0x1f90ef){scripts[_0x4313('0x87')](this[_0x4313('0xc')][_0x4313('0x33')],_0x4c0101['aws_access_key_id'],_0x4c0101[_0x4313('0x84')],_0x4c0101[_0x4313('0x88')],_0x4c0101[_0x4313('0x57')],_0x4c0101[_0x4313('0x89')])[_0x4313('0x11')](function(_0xbb2803){_0x1f90ef(null,_0xbb2803);})[_0x4313('0x13')](function(_0x132635){_0x1f90ef(_0x132635);});};AGIVertices['prototype'][_0x4313('0x8a')]=function(_0x460918,_0x319523,_0x33b2a9){scripts[_0x4313('0x8a')](_0x319523,_0x460918[_0x4313('0x75')],_0x460918['google_asr_language']||_0x4313('0x58'))[_0x4313('0x11')](function(_0x2c7607){_0x33b2a9(null,_0x2c7607);})[_0x4313('0x13')](function(_0x121393){_0x33b2a9(_0x121393);});};AGIVertices[_0x4313('0x14')][_0x4313('0x8b')]=function(_0x108abb,_0x34ba9e,_0x441b1c){scripts[_0x4313('0x8b')](_0x34ba9e,_0x108abb[_0x4313('0x8c')],_0x108abb['appsecret'],_0x108abb['uri'])['then'](function(_0x334fef){_0x441b1c(null,_0x334fef);})['catch'](function(_0x324925){_0x441b1c(_0x324925);});};AGIVertices[_0x4313('0x14')][_0x4313('0x8d')]=function(_0x3da774){var _0x36cd8c=_[_0x4313('0x62')](verticesWithRetry,_0x3da774[_0x4313('0x8e')])?_0x3da774:_[_0x4313('0x8f')](_0x3da774);for(var _0x4b7e35 in _0x36cd8c){if(_0x36cd8c[_0x4313('0x90')](_0x4b7e35)){if(_0x36cd8c[_0x4b7e35]&&_[_0x4313('0x91')](_0x36cd8c[_0x4b7e35])){if(_[_0x4313('0x62')](recursiveMapAttributes,_0x4b7e35)){_0x36cd8c[_0x4b7e35]=this['replaceObjectAllVariables'](_0x36cd8c[_0x4b7e35]);}else{_0x36cd8c[_0x4b7e35]=this[_0x4313('0x92')](_0x36cd8c[_0x4b7e35]);}}}}return _0x36cd8c;};AGIVertices[_0x4313('0x14')][_0x4313('0x93')]=function(_0x5d5fd3){for(var _0x39b247 in _0x5d5fd3){if(_0x5d5fd3[_0x4313('0x90')](_0x39b247)){if(_[_0x4313('0x94')](_0x5d5fd3[_0x39b247])){this[_0x4313('0x93')](_0x5d5fd3[_0x39b247]);}else if(_[_0x4313('0x95')](_0x5d5fd3[_0x39b247])){for(var _0xdd2aa9=0x0;_0xdd2aa9<_0x5d5fd3[_0x39b247][_0x4313('0x96')];_0xdd2aa9++){this['recursiveNodeIndex'](_0x5d5fd3[_0x39b247][_0xdd2aa9]);}}else if(_[_0x4313('0x91')](_0x5d5fd3[_0x39b247])){_0x5d5fd3[_0x39b247]=this['replaceAllVariables'](_0x5d5fd3[_0x39b247]);}}}};AGIVertices[_0x4313('0x14')][_0x4313('0x97')]=function(_0x25da6f,_0x214ef7){for(var _0xf1eb3 in _0x25da6f){if(_0x25da6f['hasOwnProperty'](_0xf1eb3)){if(_[_0x4313('0x94')](_0x25da6f[_0xf1eb3])){if(!_[_0x4313('0x41')](_0x25da6f[_0xf1eb3])){this[_0x4313('0x97')](_0x25da6f[_0xf1eb3],util[_0x4313('0x25')](_0x4313('0x98'),_0x214ef7,_0xf1eb3));}}else if(_['isArray'](_0x25da6f[_0xf1eb3])){for(var _0x24a2fa=0x0;_0x24a2fa<_0x25da6f[_0xf1eb3][_0x4313('0x96')];_0x24a2fa++){this[_0x4313('0x97')](_0x25da6f[_0xf1eb3][_0x24a2fa],util['format'](_0x4313('0x98'),_0x214ef7,_0xf1eb3+'['+_0x24a2fa+']'));}}else{if(!_[_0x4313('0x3f')](_0x25da6f[_0xf1eb3])){this[_0x4313('0xc')][_0x4313('0x99')](util[_0x4313('0x25')]('%s.%s',_0x214ef7,_0xf1eb3),_0x25da6f[_0xf1eb3]);}}}}};AGIVertices[_0x4313('0x14')]['replaceObjectAllVariables']=function(_0x57da86){try{var _0x44411c=JSON[_0x4313('0x6c')](_0x57da86);this[_0x4313('0x93')](_0x44411c);return JSON[_0x4313('0x6e')](_0x44411c);}catch(_0x1b2e71){return this[_0x4313('0x92')](_0x57da86);}};AGIVertices[_0x4313('0x14')][_0x4313('0x92')]=function(_0x53197d){var _0x5408fc=_0x53197d['split']('{');for(var _0x7d0fb=0x1;_0x7d0fb<_0x5408fc[_0x4313('0x96')];_0x7d0fb+=0x1){var _0x95f31e=_0x5408fc[_0x7d0fb][_0x4313('0x9a')]('}');if(_0x95f31e['length']>0x1){_0x53197d=_0x53197d[_0x4313('0x9b')]('{'+_0x95f31e[0x0]+'}',this['channel'][_0x4313('0xf')](_0x95f31e[0x0])['extra']||_0x95f31e[0x0]);}}if(_0x5408fc['length']===0x1){return _0x53197d[_0x4313('0x48')]();}return this['replaceAllVariables'](_0x53197d);};AGIVertices[_0x4313('0x14')][_0x4313('0x9c')]=function(_0x8b300e,_0x2beb26){var _0x6c36fc=this[_0x4313('0xc')][_0x4313('0xf')](_0x8b300e);if(_0x6c36fc[_0x4313('0x9d')]===-0x1){return _0x6c36fc;}logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x9e'),_0x2beb26,_0x6c36fc[_0x4313('0x9f')]));return this[_0x4313('0xc')][_0x4313('0x99')](_0x2beb26,_0x6c36fc[_0x4313('0x9f')]);};AGIVertices[_0x4313('0x14')][_0x4313('0x80')]=function(_0x5417d4){return _0x5417d4&&_0x5417d4!=='0'&&_0x5417d4!=='-1'&&_0x5417d4!=='';};AGIVertices['prototype'][_0x4313('0xa0')]=function(_0x330dfe){this[_0x4313('0x32')]['sync'](this,_0x330dfe,'-');_0x330dfe[_0x4313('0xa1')]=_0x330dfe[_0x4313('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4313('0x14')][_0x4313('0xa2')]=function(_0x4acb3a){logger[_0x4313('0x28')](util['format'](_0x4313('0xa3'),_0x4acb3a[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x4acb3a[_0x4313('0x57')])){return this[_0x4313('0xc')][_0x4313('0xa4')]('no\x20text\x20configured');}var _0x49e125='\x22'+_0x4acb3a[_0x4313('0x57')]+'\x22';if(this[_0x4313('0x80')](_0x4acb3a[_0x4313('0x73')])){_0x49e125+=','+_0x4acb3a[_0x4313('0x73')];}var _0x482cae=this[_0x4313('0xc')][_0x4313('0x53')](_0x4313('0xa5'),_0x49e125);if(_0x482cae[_0x4313('0x9d')]===-0x1){return _0x482cae;}return this['channel'][_0x4313('0xa4')](util['format'](_0x4313('0xa6'),_0x49e125));};AGIVertices[_0x4313('0x14')]['mrcprecog']=function(_0x26db62){logger[_0x4313('0x28')](util['format'](_0x4313('0xa7'),_0x26db62[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x26db62[_0x4313('0xa8')])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0xa9'));}var _0xb9c433=_0x26db62[_0x4313('0xa8')];if(this[_0x4313('0x80')](_0x26db62['options'])){_0xb9c433+=','+_0x26db62[_0x4313('0x73')];}var _0x3fd200=this[_0x4313('0xc')][_0x4313('0x53')]('MRCPRecog',_0xb9c433);if(_0x3fd200['result']===-0x1){return _0x3fd200;}var _0x52d36d=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x4313('0xaa'));if(_0x52d36d['result']===-0x1){return _0x52d36d;}var _0x26511c=this[_0x4313('0x9c')]('RECOG_INPUT()',_0x4313('0xab'));if(_0x26511c[_0x4313('0x9d')]===-0x1){return _0x26511c;}var _0x1f5ce3=this[_0x4313('0x9c')](_0x4313('0xac'),_0x4313('0xad'));if(_0x1f5ce3[_0x4313('0x9d')]===-0x1){return _0x1f5ce3;}return this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0xae'),_0xb9c433));};AGIVertices[_0x4313('0x14')][_0x4313('0x6')]=function(_0x31b408){logger['info'](util['format'](_0x4313('0xaf'),_0x31b408[_0x4313('0x34')]));return this[_0x4313('0xc')][_0x4313('0x6')]([_0x31b408[_0x4313('0xb0')],_0x31b408['args']]);};AGIVertices['prototype'][_0x4313('0xb1')]=function(_0x26f311){logger[_0x4313('0x28')](util['format'](_0x4313('0xb2'),_0x26f311[_0x4313('0x34')]));if(this[_0x4313('0x80')](_0x26f311['timeout'])){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0xb3'),_0x26f311[_0x4313('0x61')]));var _0x3f2880=this['channel'][_0x4313('0xb4')](_0x26f311[_0x4313('0x61')]);if(_0x3f2880['result']===-0x1){return _0x3f2880;}}return this[_0x4313('0xc')][_0x4313('0xb1')]();};AGIVertices[_0x4313('0x14')][_0x4313('0x46')]=function(_0xa98963){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0xb5'),_0xa98963[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0xa98963['list_id'])){return this['channel'][_0x4313('0x2d')](_0xa98963,_0x4313('0xb6'));}_0xa98963['scheduledAt']=moment();if(this[_0x4313('0x80')](_0xa98963[_0x4313('0xb7')])){_0xa98963[_0x4313('0x45')]=moment()[_0x4313('0xb8')](_0xa98963[_0x4313('0xb7')],_0x4313('0xb9'));}if(!this[_0x4313('0x80')](_0xa98963[_0x4313('0x49')])){_0xa98963[_0x4313('0x49')]=0x2;}this['createCmContact'][_0x4313('0x6a')](this,_0xa98963);return this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0xba'),_0xa98963[_0x4313('0x43')],_0xa98963[_0x4313('0x44')],_0xa98963[_0x4313('0x45')]));};AGIVertices[_0x4313('0x14')]['custom_app']=function(_0x3617cb){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0xbb'),_0x3617cb[_0x4313('0x34')]));var _0xf38a6e=this[_0x4313('0xc')][_0x4313('0x53')](_0x3617cb[_0x4313('0xbc')],_0x3617cb[_0x4313('0x73')]);if(_0xf38a6e[_0x4313('0x9d')]===-0x1){return _0xf38a6e;}return this[_0x4313('0xc')]['noop'](util[_0x4313('0x25')](_0x4313('0xbd'),_0x3617cb[_0x4313('0xbc')],_0x3617cb[_0x4313('0x73')]));};AGIVertices[_0x4313('0x14')]['lumenvoxtts']=function(_0x24408b){logger['info'](util[_0x4313('0x25')](_0x4313('0xbe'),_0x24408b[_0x4313('0x34')]));if(!this['isConfigured'](_0x24408b[_0x4313('0x57')])){return this['channel'][_0x4313('0xa4')]('no\x20text\x20configured');}var _0x2fab43='\x22'+_0x24408b[_0x4313('0x57')]+'\x22';if(this[_0x4313('0x80')](_0x24408b[_0x4313('0x73')])){_0x2fab43+=','+_0x24408b[_0x4313('0x73')];}var _0x5b3cca=this[_0x4313('0xc')]['exec']('MRCPSynth',_0x2fab43);if(_0x5b3cca[_0x4313('0x9d')]===-0x1){return _0x5b3cca;}return this[_0x4313('0xc')]['noop'](util[_0x4313('0x25')](_0x4313('0xa6'),_0x2fab43));};AGIVertices[_0x4313('0x14')][_0x4313('0xbf')]=function(_0x16da09){logger[_0x4313('0x28')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x16da09[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x16da09[_0x4313('0x57')])){return this[_0x4313('0xc')]['noop']('no\x20text\x20configured');}var _0x4e264d='\x22'+_0x16da09['text']+'\x22';if(this[_0x4313('0x80')](_0x16da09[_0x4313('0x73')])){_0x4e264d+=','+_0x16da09['options'];}var _0x123bae=this[_0x4313('0xc')]['exec'](_0x4313('0xa5'),_0x4e264d);if(_0x123bae['result']===-0x1){return _0x123bae;}return this['channel'][_0x4313('0xa4')](util['format'](_0x4313('0xa6'),_0x4e264d));};AGIVertices[_0x4313('0x14')][_0x4313('0xc0')]=function(_0x44b4dd){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0xc1'),_0x44b4dd[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x44b4dd[_0x4313('0xa8')])){return this[_0x4313('0xc')]['noop'](_0x4313('0xa9'));}var _0x458ce3=_0x44b4dd['grammar'];if(this['isConfigured'](_0x44b4dd[_0x4313('0x73')])){_0x458ce3+=','+_0x44b4dd[_0x4313('0x73')];}var _0x3eeab0=this['channel'][_0x4313('0x53')](_0x4313('0xc2'),_0x458ce3);if(_0x3eeab0[_0x4313('0x9d')]===-0x1){return _0x3eeab0;}var _0x2e4f9f=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x4313('0xc3'));if(_0x2e4f9f[_0x4313('0x9d')]===-0x1){return _0x2e4f9f;}var _0x1f845f=this[_0x4313('0x9c')](_0x4313('0xc4'),_0x4313('0xc5'));if(_0x1f845f['result']===-0x1){return _0x1f845f;}var _0x2f0da9=this[_0x4313('0x9c')](_0x4313('0xac'),'LUMENVOX_ASR_INSTANCE');if(_0x2f0da9['result']===-0x1){return _0x2f0da9;}return this[_0x4313('0xc')]['noop'](util[_0x4313('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x458ce3));};AGIVertices[_0x4313('0x14')]['sestekasr']=function(_0x156f88){logger[_0x4313('0x28')](util['format'](_0x4313('0xc6'),_0x156f88['label']));if(!this[_0x4313('0x80')](_0x156f88['grammar'])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0xa9'));}var _0x3aab86=_0x156f88[_0x4313('0xa8')];if(this[_0x4313('0x80')](_0x156f88[_0x4313('0x73')])){_0x3aab86+=','+_0x156f88['options'];}var _0x5b87e7=this[_0x4313('0xc')][_0x4313('0x53')](_0x4313('0xc2'),_0x3aab86);if(_0x5b87e7[_0x4313('0x9d')]===-0x1){return _0x5b87e7;}var _0x176cd0=this[_0x4313('0x9c')](_0x4313('0xc7'),_0x4313('0xc8'));if(_0x176cd0[_0x4313('0x9d')]===-0x1){return _0x176cd0;}var _0x21664d=this['getAndSetVariable'](_0x4313('0xc4'),_0x4313('0xc9'));if(_0x21664d[_0x4313('0x9d')]===-0x1){return _0x21664d;}var _0x5efc63=this[_0x4313('0x9c')](_0x4313('0xac'),_0x4313('0xca'));if(_0x5efc63['result']===-0x1){return _0x5efc63;}return this['channel']['noop'](util['format'](_0x4313('0xae'),_0x3aab86));};AGIVertices[_0x4313('0x14')][_0x4313('0xcb')]=function(_0x51bb4f){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0xcc'),_0x51bb4f[_0x4313('0x34')]));if(!this['isConfigured'](_0x51bb4f[_0x4313('0xcd')])){return this[_0x4313('0xc')]['error'](_0x51bb4f,_0x4313('0xce'));}var _0x512bf2=this[_0x4313('0x18')][_0x4313('0x6a')](this,_0x51bb4f[_0x4313('0xcd')]);if(!_0x512bf2){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x51bb4f,_0x4313('0xcf'));}if(!this[_0x4313('0x80')](_0x51bb4f[_0x4313('0x29')])){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x51bb4f,_0x4313('0xd0'));}var _0x4fff3f=_0x51bb4f[_0x4313('0x29')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0xd1'),_0x4fff3f));var _0x47e03f=this[_0x4313('0x26')][_0x4313('0x6a')](this,_0x512bf2,_0x4fff3f);this[_0x4313('0x32')]['sync'](this,_0x51bb4f,_0x4fff3f);if(!this[_0x4313('0x80')](_0x51bb4f['variable_id'])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0xd2'));}var _0x145e77=this[_0x4313('0xf')][_0x4313('0x6a')](this,_0x51bb4f[_0x4313('0xd3')]);if(!_0x145e77){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x51bb4f,_0x4313('0xd4'));}var _0x34f754=this;_0x47e03f[_0x4313('0xd5')](function(_0x50e29f,_0xbb03a7){Object[_0x4313('0xd6')](_0x50e29f)[_0x4313('0xd5')](function(_0x4946ef){_0x34f754[_0x4313('0xc')][_0x4313('0x99')](util[_0x4313('0x25')]('%s[%s][%s]',_0x145e77,_0xbb03a7,_0x4946ef),_0x50e29f[_0x4946ef]);});});this[_0x4313('0xc')][_0x4313('0x99')](util[_0x4313('0x25')](_0x4313('0xd7'),_0x145e77),_0x47e03f[_0x4313('0x96')]);return this[_0x4313('0xc')]['noop'](util[_0x4313('0x25')]('variable\x20%s\x20set',_0x145e77));};AGIVertices[_0x4313('0x14')][_0x4313('0xd8')]=function(_0x270429){logger[_0x4313('0xd9')](util[_0x4313('0x25')](_0x4313('0xda'),_0x270429[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x270429[_0x4313('0xdb')])){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x270429,_0x4313('0xdc'));}var _0x44658b=this['getUser'][_0x4313('0x6a')](this,_0x270429[_0x4313('0xdb')]);if(!_0x44658b){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x270429,'no\x20user\x20found');}var _0x4c8550=this[_0x4313('0xc')][_0x4313('0x53')](_0x4313('0xdd'),[util[_0x4313('0x25')](_0x4313('0xde'),_0x44658b),_0x270429[_0x4313('0x61')],_0x270429[_0x4313('0xdf')],_0x270429[_0x4313('0xe0')]]);if(_0x4c8550['result']===-0x1){return _0x4c8550;}return this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')]('Executed\x20command\x20%s',_0x4313('0xdd')));};AGIVertices['prototype'][_0x4313('0xe1')]=function(_0x1a6cfb){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0xe2'),_0x1a6cfb[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x1a6cfb[_0x4313('0x75')])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0xe3'));}if(!this[_0x4313('0x80')](_0x1a6cfb[_0x4313('0x57')])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0xe4'));}this[_0x4313('0xc')]['bot']=!![];this[_0x4313('0x32')](_0x1a6cfb);this['createSquareMessage'](_0x1a6cfb[_0x4313('0x57')],'in','','');this['channel'][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0xe5'),_0x1a6cfb[_0x4313('0x57')]));var _0x103cad=this[_0x4313('0x74')]['sync'](this,_0x1a6cfb);if(_0x103cad){for(var _0x1f126b in _0x103cad){if(_0x103cad[_0x4313('0x90')](_0x1f126b)){this[_0x4313('0xc')][_0x4313('0x99')](util['format'](_0x4313('0xe6'),_0x1f126b[_0x4313('0xe7')]()),_0x103cad[_0x1f126b]);}}this[_0x4313('0x3d')](_0x103cad['speech'],_0x4313('0xe8'),_0x4313('0xe1'),'');return this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')]('Dialogflow\x20Result\x20%s',_0x103cad['speech']));}return this[_0x4313('0xc')]['error'](_0x1a6cfb,_0x4313('0xe9'));};AGIVertices[_0x4313('0x14')][_0x4313('0xea')]=function(_0x3d80c5){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0xeb'),_0x3d80c5[_0x4313('0x34')]));if(!this['isConfigured'](_0x3d80c5[_0x4313('0x78')])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0xec'));}if(!this[_0x4313('0x80')](_0x3d80c5[_0x4313('0xed')])){return this['channel']['noop']('no\x20client_email\x20configured');}if(!this[_0x4313('0x80')](_0x3d80c5['private_key'])){return this['channel']['noop'](_0x4313('0xee'));}if(!this['isConfigured'](_0x3d80c5[_0x4313('0x7a')])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0xef'));}if(!this[_0x4313('0x80')](_0x3d80c5['text'])){return this[_0x4313('0xc')][_0x4313('0xa4')]('no\x20text\x20configured');}this['channel'][_0x4313('0xf0')]=!![];this[_0x4313('0x32')](_0x3d80c5);this[_0x4313('0x3d')](_0x3d80c5[_0x4313('0x57')],'in','','');this[_0x4313('0xc')]['noop'](util[_0x4313('0x25')]('Trying\x20DialogflowV2:\x20%s',_0x3d80c5['text']));var _0x52e8ae=this['googleDialogflowV2'][_0x4313('0x6a')](this,_0x3d80c5);if(_0x52e8ae){for(var _0x56b79a in _0x52e8ae){if(_0x52e8ae[_0x4313('0x90')](_0x56b79a)){if(_0x56b79a!==_0x4313('0xf1')){this[_0x4313('0xc')]['setVariable'](util['format']('DIALOGFLOW_%s',_0x56b79a[_0x4313('0xe7')]()),_0x52e8ae[_0x56b79a]);}}}this['createSquareMessage'](_0x52e8ae[_0x4313('0xf2')],_0x4313('0xe8'),_0x4313('0xea'),_0x52e8ae[_0x4313('0xf1')]);return this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0xf3'),_0x52e8ae['speech']));}return this[_0x4313('0xc')][_0x4313('0x2d')](_0x3d80c5,_0x4313('0xf4'));};AGIVertices[_0x4313('0x14')][_0x4313('0xf5')]=function(_0xa6b78){logger[_0x4313('0x28')](util[_0x4313('0x25')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xa6b78['label']));if(!this[_0x4313('0x80')](_0xa6b78['ndauth_url'])){return this['channel'][_0x4313('0xa4')](_0x4313('0xf6'));}if(!this[_0x4313('0x80')](_0xa6b78[_0x4313('0xf7')])){return this[_0x4313('0xc')]['noop'](_0x4313('0xf8'));}if(!this[_0x4313('0x80')](_0xa6b78['password'])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0xf9'));}if(!this[_0x4313('0x80')](_0xa6b78[_0x4313('0xfa')])){return this['channel'][_0x4313('0xa4')](_0x4313('0xe4'));}this[_0x4313('0xc')][_0x4313('0xf0')]=!![];this[_0x4313('0x32')](_0xa6b78);this[_0x4313('0x3d')](_0xa6b78[_0x4313('0x57')],'in','','');this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0xfb'),_0xa6b78['text']));var _0x232445=this[_0x4313('0x7b')]['sync'](this,_0xa6b78);if(_0x232445){for(var _0x52cdfc in _0x232445){if(_0x232445[_0x4313('0x90')](_0x52cdfc)){this[_0x4313('0xc')][_0x4313('0x99')](util[_0x4313('0x25')](_0x4313('0xfc'),_0x52cdfc[_0x4313('0xe7')]()),_0x232445[_0x52cdfc]);}}this['createSquareMessage'](_0x232445[_0x4313('0xf2')],'out','sesteknda','');if(_0x232445[_0x4313('0xfd')]){this[_0x4313('0xc')][_0x4313('0xa4')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x232445['audiofile']));var _0x25e07a=this[_0x4313('0xc')]['streamFile'](_0x232445[_0x4313('0xfd')]);try{fs[_0x4313('0xfe')](_0x232445['audiofile']+_0x4313('0xff'));}catch(_0x1ef37d){logger[_0x4313('0x2d')](_0x1ef37d);}return _0x25e07a;}else{return this[_0x4313('0xc')]['noop'](util[_0x4313('0x25')]('SestekNDA\x20Result\x20%s',_0x232445[_0x4313('0xf2')]));}}return this['channel'][_0x4313('0x2d')](_0xa6b78,_0x4313('0x100'));};AGIVertices['prototype']['end']=function(_0x3fd14b){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x101'),_0x3fd14b[_0x4313('0x34')]));return this[_0x4313('0xc')]['noop'](_0x4313('0x102'));};AGIVertices[_0x4313('0x14')][_0x4313('0x103')]=function(_0x889e9a){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x104'),_0x889e9a[_0x4313('0x34')]));var _0x4d91c8='';if(_0x889e9a['trunk_id']){if(!this[_0x4313('0x80')](_0x889e9a[_0x4313('0x105')])){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x889e9a,_0x4313('0x106'));}else{var _0x1eca3c=parseInt(_0x889e9a[_0x4313('0x105')],0xa);if(isNaN(_0x1eca3c)){_0x4d91c8=_0x889e9a[_0x4313('0x105')];}else{_0x4d91c8=this[_0x4313('0x107')][_0x4313('0x6a')](this,_0x889e9a[_0x4313('0x105')]);if(!_0x4d91c8){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x889e9a,_0x4313('0x108'));}}}}else if(_0x889e9a[_0x4313('0x109')]){_0x4d91c8=_0x889e9a[_0x4313('0x109')];}else{return this[_0x4313('0xc')][_0x4313('0x2d')](_0x889e9a,_0x4313('0x106'));}var _0x431500=this[_0x4313('0xc')]['exec'](_0x4313('0xdd'),[util[_0x4313('0x25')](_0x4313('0x10a'),_0x4d91c8,_0x889e9a[_0x4313('0x43')]),_0x889e9a['timeout'],_0x889e9a[_0x4313('0xdf')],_0x889e9a[_0x4313('0xe0')]]);if(_0x431500[_0x4313('0x9d')]===-0x1){return _0x431500;}return this['channel'][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x10b'),_0x4313('0xdd')));};AGIVertices[_0x4313('0x14')]['finally']=function(_0x106e4b){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x10c'),_0x106e4b[_0x4313('0x34')]));return this['channel']['noop'](_0x4313('0x10d'));};AGIVertices[_0x4313('0x14')]['getdigits']=function(_0x356c22){logger[_0x4313('0x28')](util[_0x4313('0x25')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x356c22['label']));if(_0x356c22['retry']===0x0){return this[_0x4313('0xa0')](_0x356c22);}_0x356c22[_0x4313('0xa1')]-=0x1;if(!this['isConfigured'](_0x356c22[_0x4313('0x10e')])){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x356c22,_0x4313('0x10f'));}var _0x238410=this['getSound'][_0x4313('0x6a')](this,_0x356c22[_0x4313('0x10e')]);if(!_0x238410){return this[_0x4313('0xc')]['error'](_0x356c22,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x356c22[_0x4313('0xd3')])){return this[_0x4313('0xc')]['error'](_0x4313('0xd2'));}var _0x5c213f=this[_0x4313('0xc')][_0x4313('0x110')](_0x238410,_0x356c22[_0x4313('0x111')],_0x356c22[_0x4313('0x112')]);var _0x4b843c=_0x5c213f['result']?_0x5c213f[_0x4313('0x9d')][_0x4313('0x48')]():'';logger[_0x4313('0x28')](_0x4313('0x113'),JSON[_0x4313('0x6e')](_0x5c213f));if(_0x5c213f[_0x4313('0x9d')]===-0x1){this[_0x4313('0x32')][_0x4313('0x6a')](this,_0x356c22,_0x4b843c);return _0x5c213f;}else if(_0x5c213f[_0x4313('0x9f')]===_0x4313('0x61')){_0x5c213f['result']=_0x4b843c['length']>=parseInt(_0x356c22[_0x4313('0x114')])?'x':'i';}else{_0x5c213f[_0x4313('0x9d')]=_0x4b843c[_0x4313('0x96')]>=parseInt(_0x356c22['mindigit'])&&_0x4b843c[_0x4313('0x96')]<=parseInt(_0x356c22[_0x4313('0x112')])?'x':'i';}var _0x25bf32=this[_0x4313('0xf')][_0x4313('0x6a')](this,_0x356c22['variable_id']);if(!_0x25bf32){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x356c22,'no\x20variable\x20found');}this[_0x4313('0xc')][_0x4313('0x99')](_0x25bf32,_0x4b843c);if(this[_0x4313('0x80')](_0x356c22[_0x4313('0x115')])){var _0x242886=parseInt(_0x356c22[_0x4313('0x115')],0xa);var _0x3f166c=rs[_0x4313('0x116')]({'charset':'*','length':_0x242886});var _0x607650=_0x4b843c[_0x4313('0x96')];if(_0x607650>0x0){if(_0x607650>_0x242886){this[_0x4313('0x32')][_0x4313('0x6a')](this,_0x356c22,_0x356c22[_0x4313('0x117')]===_0x4313('0x118')?_0x3f166c+_0x4b843c[_0x4313('0x119')](_0x242886):_0x4b843c[_0x4313('0x119')](0x0,_0x607650-_0x242886)+_0x3f166c);}else{this[_0x4313('0x32')][_0x4313('0x6a')](this,_0x356c22,rs[_0x4313('0x116')]({'charset':'*','length':_0x607650}));}}else{this[_0x4313('0x32')][_0x4313('0x6a')](this,_0x356c22,'');}}else{this[_0x4313('0x32')][_0x4313('0x6a')](this,_0x356c22,_0x4b843c);}return _0x5c213f;};AGIVertices[_0x4313('0x14')][_0x4313('0xb')]=function(_0x3c695e){logger[_0x4313('0x28')](util[_0x4313('0x25')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x3c695e[_0x4313('0x34')]));return this[_0x4313('0xa')](_0x3c695e);};AGIVertices[_0x4313('0x14')][_0x4313('0x11a')]=function(_0x5ab905){logger['info'](util['format'](_0x4313('0x11b'),_0x5ab905['label']));this[_0x4313('0x32')][_0x4313('0x6a')](this,_0x5ab905,_0x5ab905[_0x4313('0x11c')]);return this[_0x4313('0xc')]['noop'](util[_0x4313('0x25')]('GOAL\x20%s',_0x5ab905['goalname']));};AGIVertices[_0x4313('0x14')][_0x4313('0x11d')]=function(_0x3f8753){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x11e'),_0x3f8753[_0x4313('0x34')]));if(!this['isConfigured'](_0x3f8753['aws_access_key_id'])||!this['isConfigured'](_0x3f8753[_0x4313('0x84')])){return this['channel'][_0x4313('0xa4')](_0x4313('0x11f'));}if(!this[_0x4313('0x80')](_0x3f8753[_0x4313('0x57')])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0xe4'));}this['channel'][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x120'),_0x3f8753[_0x4313('0x57')]));var _0x41b84d=this[_0x4313('0x82')][_0x4313('0x6a')](this,_0x3f8753);if(_0x41b84d){this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x121'),_0x41b84d));var _0x3c8336=this[_0x4313('0xc')]['streamFile'](_0x41b84d);try{fs[_0x4313('0xfe')](_0x41b84d+_0x4313('0xff'));}catch(_0x3e8b07){logger[_0x4313('0x2d')](_0x3e8b07);}return _0x3c8336;}return this[_0x4313('0xc')][_0x4313('0x2d')](_0x3f8753,_0x4313('0x122'));};AGIVertices[_0x4313('0x14')]['awslex']=function(_0x46a783){logger[_0x4313('0x28')](util[_0x4313('0x25')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x46a783['label']));if(!this[_0x4313('0x80')](_0x46a783[_0x4313('0x83')])||!this[_0x4313('0x80')](_0x46a783[_0x4313('0x84')])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0x11f'));}if(!this[_0x4313('0x80')](_0x46a783['aws_bot_name'])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0x123'));}if(!this[_0x4313('0x80')](_0x46a783[_0x4313('0x57')])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0xe4'));}this['channel']['bot']=!![];this[_0x4313('0x32')](_0x46a783);this[_0x4313('0x3d')](_0x46a783[_0x4313('0x57')],'in','','');this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x124'),_0x46a783['text']));var _0x37ba5f=this['awsLex'][_0x4313('0x6a')](this,_0x46a783);if(_0x37ba5f){for(var _0x464614 in _0x37ba5f){if(_0x37ba5f[_0x4313('0x90')](_0x464614)&&_[_0x4313('0x91')](_0x37ba5f[_0x464614])){this['channel'][_0x4313('0x99')](util[_0x4313('0x25')]('AWS_LEX_%s',_0x464614[_0x4313('0xe7')]()),_0x37ba5f[_0x464614]);}}if(_[_0x4313('0x3f')](_0x37ba5f['message'])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0x125'));}else{this['createSquareMessage'](_0x37ba5f['message'],_0x4313('0xe8'),_0x4313('0x126'),'');return this[_0x4313('0xc')][_0x4313('0xa4')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x37ba5f[_0x4313('0x71')]));}}return this[_0x4313('0xc')][_0x4313('0x2d')](_0x46a783,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x4313('0x14')][_0x4313('0x127')]=function(_0x5b5b44){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x128'),_0x5b5b44[_0x4313('0x34')],_0x5b5b44[_0x4313('0x61')]));if(!this[_0x4313('0x80')](_0x5b5b44[_0x4313('0x75')])){return this['channel'][_0x4313('0xa4')]('no\x20key\x20configured');}var _0x37a8c3=_0x4313('0x129');var _0x45d52e=util[_0x4313('0x25')](_0x4313('0x12a'),FILES_PATH,rs[_0x4313('0x116')](0x4));var _0x1dca8c=util[_0x4313('0x25')](_0x4313('0x98'),_0x45d52e,_0x37a8c3);var _0x1fcc98=!![];if(_0x5b5b44[_0x4313('0x12b')]===_0x4313('0x12c')){_0x1fcc98=![];}var _0x9f9533=this[_0x4313('0xc')][_0x4313('0x12d')](_0x45d52e,_0x37a8c3,_0x5b5b44[_0x4313('0x12e')],_0x5b5b44['timeout'],undefined,_0x1fcc98);if(_0x9f9533[_0x4313('0x9d')]!==-0x1){this['channel'][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x12f'),_0x1dca8c));var _0x133154=this[_0x4313('0x8a')][_0x4313('0x6a')](this,_0x5b5b44,_0x1dca8c);if(_0x133154){for(var _0x4cf5f2 in _0x133154){if(_0x133154['hasOwnProperty'](_0x4cf5f2)){this[_0x4313('0xc')][_0x4313('0x99')](util[_0x4313('0x25')]('GOOGLE_ASR_%s',_0x4cf5f2[_0x4313('0xe7')]()),_0x133154[_0x4cf5f2]);}}return this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x130'),JSON['stringify'](_0x133154)));}}return _0x9f9533;};AGIVertices['prototype']['tildeasr']=function(_0x27d0bd){logger[_0x4313('0x28')](util['format'](_0x4313('0x131'),_0x27d0bd[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x27d0bd['appid'])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0x132'));}if(!this[_0x4313('0x80')](_0x27d0bd[_0x4313('0x133')])){return this[_0x4313('0xc')]['noop'](_0x4313('0x134'));}var _0x1b0252=_0x4313('0x129');var _0x4bea48=util['format'](_0x4313('0x12a'),FILES_PATH,rs['generate'](0x4));var _0x172b76=util[_0x4313('0x25')](_0x4313('0x98'),_0x4bea48,_0x1b0252);var _0x680173=!![];if(_0x27d0bd[_0x4313('0x12b')]==='NOBEEP'){_0x680173=![];}var _0x2c5532=this['channel'][_0x4313('0x12d')](_0x4bea48,_0x1b0252,_0x27d0bd['intKey'],_0x27d0bd[_0x4313('0x61')],undefined,_0x680173);if(_0x2c5532[_0x4313('0x9d')]!==-0x1){this['channel'][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x135'),_0x172b76));var _0x4abe61=this[_0x4313('0x8b')][_0x4313('0x6a')](this,_0x27d0bd,_0x172b76);if(_0x4abe61){for(var _0x2a1e4c in _0x4abe61){if(_0x4abe61[_0x4313('0x90')](_0x2a1e4c)){this[_0x4313('0xc')][_0x4313('0x99')](util[_0x4313('0x25')](_0x4313('0x136'),_0x2a1e4c['toUpperCase']()),_0x4abe61[_0x2a1e4c]);}}return this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x137'),JSON[_0x4313('0x6e')](_0x4abe61)));}}return _0x2c5532;};AGIVertices['prototype'][_0x4313('0x138')]=function(_0x2f4527){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x139'),_0x2f4527[_0x4313('0x34')]));return this[_0x4313('0xc')]['continueAt'](_0x2f4527[_0x4313('0x38')],_0x2f4527['extension'],_0x2f4527['priority']);};AGIVertices[_0x4313('0x14')]['gotoif']=function(_0x2fde5d){logger[_0x4313('0x28')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2fde5d[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x2fde5d[_0x4313('0x13a')])){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x2fde5d,_0x4313('0x13b'));}try{var _0x1d49a5=eval(_0x2fde5d['condition'])?_0x4313('0x13c'):_0x4313('0x13d');this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')]('EVAL\x20CONDITION\x20%s\x20%s',_0x2fde5d[_0x4313('0x13a')],_0x1d49a5));return{'code':0xc8,'result':_0x1d49a5};}catch(_0x1e29ef){return{'code':0xc8,'result':_0x4313('0x13d')};}};AGIVertices[_0x4313('0x14')][_0x4313('0x13e')]=function(_0x1797b0){logger[_0x4313('0x28')](util[_0x4313('0x25')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1797b0[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x1797b0[_0x4313('0x13f')])){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x1797b0,_0x4313('0x140'));}var _0x2207cf=this['getIntervals'][_0x4313('0x6a')](this,_0x1797b0[_0x4313('0x13f')]);if(!_0x2207cf){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x1797b0,_0x4313('0x141'));}for(var _0x32a552=0x0;_0x32a552<_0x2207cf[_0x4313('0x96')];_0x32a552+=0x1){var _0xbac312=this[_0x4313('0xc')][_0x4313('0xf')](util[_0x4313('0x25')](_0x4313('0x142'),_0x2207cf[_0x32a552]));if(_0xbac312[_0x4313('0x9d')]===-0x1){return _0xbac312;}logger['info'](util[_0x4313('0x25')]('IFTIME\x20%s\x20%s',_0x2207cf[_0x32a552],_0xbac312[_0x4313('0x9f')]));if(_0xbac312[_0x4313('0x9f')]==='true'){logger[_0x4313('0x28')](util['format']('IFTIME\x20%s\x20%s',_0x2207cf[_0x32a552],_0x4313('0x13c')));this[_0x4313('0xc')][_0x4313('0xa4')](util['format'](_0x4313('0x143'),_0x2207cf[_0x32a552],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x143'),_0x2207cf[_0x32a552],_0x4313('0x13d')));this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x143'),_0x2207cf[_0x32a552],'false'));}}return{'code':0xc8,'result':_0x4313('0x13d')};};AGIVertices[_0x4313('0x14')][_0x4313('0x144')]=function(_0x4659f1){logger['info'](util[_0x4313('0x25')](_0x4313('0x145'),_0x4659f1[_0x4313('0x34')]));return this[_0x4313('0xc')]['hangup']();};AGIVertices[_0x4313('0x14')][_0x4313('0x146')]=function(_0x5285d0){logger['info'](util['format'](_0x4313('0x147'),_0x5285d0[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x5285d0[_0x4313('0x75')])){return this[_0x4313('0xc')]['noop'](_0x4313('0xe3'));}var _0x4ec059=_0x4313('0x129');var _0x7be8c8=util[_0x4313('0x25')](_0x4313('0x12a'),FILES_PATH,rs[_0x4313('0x116')](0x4));var _0x349443=util[_0x4313('0x25')](_0x4313('0x98'),_0x7be8c8,_0x4ec059);var _0xa80811=!![];if(_0x5285d0[_0x4313('0x12b')]===_0x4313('0x12c')){_0xa80811=![];}var _0x3c1a1a=this[_0x4313('0xc')]['recordFile'](_0x7be8c8,_0x4ec059,_0x5285d0[_0x4313('0x12e')],_0x5285d0[_0x4313('0x61')],undefined,_0xa80811);if(_0x3c1a1a[_0x4313('0x9d')]!==-0x1){this[_0x4313('0xc')][_0x4313('0xa4')](util['format']('ispeech\x20%s\x20file\x20created',_0x349443));var _0x2ee792=this[_0x4313('0x7e')]['sync'](this,_0x5285d0,_0x349443);if(_0x2ee792){for(var _0x49acaf in _0x2ee792){if(_0x2ee792[_0x4313('0x90')](_0x49acaf)){this[_0x4313('0xc')][_0x4313('0x99')](util[_0x4313('0x25')]('ISPEECH_ASR_%s',_0x49acaf[_0x4313('0xe7')]()),_0x2ee792[_0x49acaf]);}}return this['channel'][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x148'),JSON[_0x4313('0x6e')](_0x2ee792)));}}return _0x3c1a1a;};AGIVertices[_0x4313('0x14')][_0x4313('0x149')]=function(_0x3081c5){logger[_0x4313('0x28')](util['format'](_0x4313('0x14a'),_0x3081c5[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x3081c5[_0x4313('0x75')])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0xe3'));}if(!this[_0x4313('0x80')](_0x3081c5[_0x4313('0x57')])){return this[_0x4313('0xc')]['noop'](_0x4313('0xe4'));}this['channel']['noop'](util[_0x4313('0x25')](_0x4313('0x14b'),_0x3081c5[_0x4313('0x57')]));var _0x544567=this['ispeechTTS']['sync'](this,_0x3081c5);if(_0x544567){this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x14c'),_0x544567));var _0x359cc3=this['channel'][_0x4313('0x14d')](_0x544567,_0x3081c5['intKey']);try{fs[_0x4313('0xfe')](_0x544567+_0x4313('0xff'));}catch(_0x10a0d8){logger[_0x4313('0x2d')](_0x10a0d8);}return _0x359cc3;}return this[_0x4313('0xc')][_0x4313('0x2d')](_0x3081c5,_0x4313('0x14e'));};AGIVertices[_0x4313('0x14')][_0x4313('0x14f')]=function(_0x4ae82f){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x150'),_0x4ae82f[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x4ae82f[_0x4313('0x151')])){return this['channel'][_0x4313('0x2d')](_0x4ae82f,'no\x20find\x20by\x20configured');}logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x152'),this[_0x4313('0xc')][_0x4313('0x35')],_0x4ae82f['findBy']));var _0x581184=this['agentLogin'][_0x4313('0x6a')](this,_0x4ae82f[_0x4313('0x151')]);if(_0x581184){logger['info'](util[_0x4313('0x25')](_0x4313('0x153'),this[_0x4313('0xc')][_0x4313('0x35')],_0x4ae82f['findBy']));this['channel'][_0x4313('0xa4')](util['format'](_0x4313('0x153'),this['channel'][_0x4313('0x35')],_0x4ae82f['findBy']));return{'code':0xc8,'result':_0x4313('0x154')};}else{logger['info'](util[_0x4313('0x25')](_0x4313('0x155'),this[_0x4313('0xc')][_0x4313('0x35')],_0x4ae82f[_0x4313('0x151')]));this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x155'),this['channel'][_0x4313('0x35')],_0x4ae82f[_0x4313('0x151')]));return{'code':0xc8,'result':_0x4313('0x156')};}};AGIVertices['prototype'][_0x4313('0x157')]=function(_0x5effeb){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x158'),_0x5effeb[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x5effeb[_0x4313('0x151')])){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x5effeb,_0x4313('0x159'));}logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x152'),this[_0x4313('0xc')]['callerid'],_0x5effeb[_0x4313('0x151')]));var _0x2b0e8b=this[_0x4313('0x4e')]['sync'](this,_0x5effeb[_0x4313('0x151')]);if(_0x2b0e8b){logger[_0x4313('0x28')](util['format'](_0x4313('0x153'),this[_0x4313('0xc')][_0x4313('0x35')],_0x5effeb[_0x4313('0x151')]));this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x153'),this['channel']['callerid'],_0x5effeb[_0x4313('0x151')]));return{'code':0xc8,'result':_0x4313('0x154')};}else{logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x155'),this[_0x4313('0xc')][_0x4313('0x35')],_0x5effeb[_0x4313('0x151')]));this['channel'][_0x4313('0xa4')](util['format'](_0x4313('0x155'),this['channel'][_0x4313('0x35')],_0x5effeb[_0x4313('0x151')]));return{'code':0xc8,'result':_0x4313('0x156')};}};AGIVertices['prototype'][_0x4313('0x15a')]=function(_0x4a76e3){logger[_0x4313('0x28')](util[_0x4313('0x25')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x4a76e3[_0x4313('0x34')]));if(!this['isConfigured'](_0x4a76e3[_0x4313('0x15b')])){return this[_0x4313('0xc')]['error'](_0x4a76e3,'no\x20operation\x20configured');}this['channel'][_0x4313('0xa4')](util[_0x4313('0x25')]('math\x20%s',_0x4a76e3['operation']));var _0x3e0d03=eval(_0x4a76e3[_0x4313('0x15b')]);if(!this[_0x4313('0x80')](_0x4a76e3[_0x4313('0xd3')])){return this[_0x4313('0xc')]['noop'](_0x4313('0xd2'));}var _0x3b885d=this[_0x4313('0xf')][_0x4313('0x6a')](this,_0x4a76e3[_0x4313('0xd3')]);if(!_0x3b885d){return this['channel'][_0x4313('0x2d')](_0x4a76e3,'no\x20variable\x20found');}if(_[_0x4313('0x95')](_0x3e0d03)){var _0x3882b2=this;_0x3e0d03[_0x4313('0xd5')](function(_0x8a5fa7,_0x459446){_0x3882b2[_0x4313('0xc')][_0x4313('0x99')](util[_0x4313('0x25')](_0x4313('0x15c'),_0x3b885d,_0x459446),_0x8a5fa7);});return this[_0x4313('0xc')]['noop'](util[_0x4313('0x25')]('variable\x20%s[key]\x20set',_0x3b885d));}else{return this['channel'][_0x4313('0x99')](_0x3b885d,_0x3e0d03);}};AGIVertices[_0x4313('0x14')]['menu']=function(_0x4232e8){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x15d'),_0x4232e8[_0x4313('0x34')]));if(_0x4232e8[_0x4313('0xa1')]===0x0){return this[_0x4313('0xa0')](_0x4232e8);}_0x4232e8['retry']-=0x1;if(!this[_0x4313('0x80')](_0x4232e8[_0x4313('0x10e')])){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x4232e8,_0x4313('0x10f'));}var _0x47f1d8=this['getSound']['sync'](this,_0x4232e8[_0x4313('0x10e')]);if(!_0x47f1d8){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x4232e8,'no\x20file\x20audio\x20found');}var _0xb5a9ab=this['channel']['getData'](_0x47f1d8,_0x4232e8[_0x4313('0x111')],_0x4232e8['digit']);var _0x1270ac=_0xb5a9ab['result'];if(_0xb5a9ab[_0x4313('0x9d')]===-0x1){this[_0x4313('0x32')][_0x4313('0x6a')](this,_0x4232e8,'-1');return _0xb5a9ab;}else if(_0xb5a9ab[_0x4313('0x9f')]===_0x4313('0x61')){_0xb5a9ab['result']=_0xb5a9ab[_0x4313('0x9d')][_0x4313('0x96')]>0x0?_0xb5a9ab[_0x4313('0x9d')]:'t';}else if(_[_0x4313('0x41')](_0xb5a9ab[_0x4313('0x9d')])){_0xb5a9ab[_0x4313('0x9d')]='#';_0x1270ac='#';}if(!this[_0x4313('0x80')](_0x4232e8[_0x4313('0xd3')])){this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0xd2'));}else{var _0x2d1707=this['getVariable']['sync'](this,_0x4232e8[_0x4313('0xd3')]);if(!_0x2d1707){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x4232e8,_0x4313('0xd4'));}this[_0x4313('0xc')][_0x4313('0x99')](_0x2d1707,_0x1270ac);}this[_0x4313('0x32')]['sync'](this,_0x4232e8,_0x1270ac);return _0xb5a9ab;};AGIVertices[_0x4313('0x14')][_0x4313('0xa4')]=function(_0x348169){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x15e'),_0x348169[_0x4313('0x34')]));return this[_0x4313('0xc')]['noop'](_0x348169[_0x4313('0x15f')]||_0x348169[_0x4313('0x34')]);};AGIVertices[_0x4313('0x14')][_0x4313('0x160')]=function(_0x45b53f){logger[_0x4313('0x28')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x45b53f[_0x4313('0x34')]));if(!this['isConfigured'](_0x45b53f[_0x4313('0x151')])){return this['channel']['error'](_0x45b53f,'no\x20find\x20by\x20configured');}logger['info'](util[_0x4313('0x25')](_0x4313('0x152'),this[_0x4313('0xc')][_0x4313('0x35')],_0x45b53f[_0x4313('0x151')]));var _0x4a91ae=this[_0x4313('0x161')]['sync'](this,_0x45b53f[_0x4313('0x162')]);var _0x22d391=this['agentPause'][_0x4313('0x6a')](this,_0x45b53f[_0x4313('0x151')],_0x4a91ae);if(_0x22d391){logger[_0x4313('0x28')](util[_0x4313('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x4313('0x35')],_0x45b53f[_0x4313('0x151')]));this['channel'][_0x4313('0xa4')](util[_0x4313('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4313('0xc')][_0x4313('0x35')],_0x45b53f['findBy']));return{'code':0xc8,'result':_0x4313('0x154')};}else{logger[_0x4313('0x28')](util['format'](_0x4313('0x155'),this[_0x4313('0xc')][_0x4313('0x35')],_0x45b53f[_0x4313('0x151')]));this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x153'),this['channel'][_0x4313('0x35')],_0x45b53f['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4313('0x14')]['playback']=function(_0x322fb4){logger[_0x4313('0x28')](util[_0x4313('0x25')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x322fb4[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x322fb4['file_id'])){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x322fb4,_0x4313('0x10f'));}var _0x3f8cbd=this[_0x4313('0x1a')][_0x4313('0x6a')](this,_0x322fb4['file_id']);if(!_0x3f8cbd){return this['channel'][_0x4313('0x2d')](_0x322fb4,_0x4313('0x163'));}var _0x4cc68d=this[_0x4313('0xc')]['exec'](_0x4313('0x164'),[_0x3f8cbd,_0x322fb4[_0x4313('0xdf')]]);if(_0x4cc68d[_0x4313('0x9d')]===-0x1){return _0x4cc68d;}return this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0xbd'),_0x4313('0x164'),_0x3f8cbd));};AGIVertices[_0x4313('0x14')][_0x4313('0x165')]=function(_0x2cd079){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x166'),_0x2cd079[_0x4313('0x34')]));if(!this['isConfigured'](_0x2cd079[_0x4313('0x167')])){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x2cd079,'no\x20queue\x20selected');}var _0x5c1d58='';var _0x36d532=parseInt(_0x2cd079[_0x4313('0x167')],0xa);if(isNaN(_0x36d532)){_0x5c1d58=_0x2cd079[_0x4313('0x167')];}else{_0x5c1d58=this[_0x4313('0x15')][_0x4313('0x6a')](this,_0x2cd079[_0x4313('0x167')]);if(!_0x5c1d58){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x2cd079,_0x4313('0x168'));}}var _0x472c04='';if(this[_0x4313('0x80')](_0x2cd079[_0x4313('0x10e')])){var _0x53e4ad=this['getSound']['sync'](this,_0x2cd079[_0x4313('0x10e')]);if(_0x53e4ad){_0x472c04=_0x53e4ad;}}this['createSquareDetailsReport'][_0x4313('0x6a')](this,_0x2cd079,_0x5c1d58);if(_0x2cd079[_0x4313('0xdf')]['indexOf']('x')<0x0){_0x2cd079['opts']+='x';}if(_0x2cd079['opts']['indexOf']('X')<0x0){_0x2cd079[_0x4313('0xdf')]+='X';}this[_0x4313('0xc')][_0x4313('0x99')](_0x4313('0x169'),_0x5c1d58?_0x5c1d58[_0x4313('0x16a')]():'');var _0x44e160=this[_0x4313('0xc')][_0x4313('0x53')](_0x4313('0x16b'),[_0x5c1d58,_0x2cd079[_0x4313('0xdf')],_0x2cd079['url'],_0x472c04,_0x2cd079[_0x4313('0x61')],_0x2cd079['agi'],_0x2cd079[_0x4313('0x16c')],_0x2cd079[_0x4313('0x16d')],'',_0x2cd079[_0x4313('0x16e')]]);if(_0x44e160[_0x4313('0x9d')]===-0x1){return _0x44e160;}return this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0xbd'),_0x4313('0x16b'),_0x5c1d58));};AGIVertices[_0x4313('0x14')][_0x4313('0x16f')]=function(_0x110848){logger[_0x4313('0x28')](util['format'](_0x4313('0x170'),_0x110848[_0x4313('0x34')]));var _0x13ad56=_0x110848[_0x4313('0x171')]||_0x4313('0x129');var _0x27f68b=util[_0x4313('0x25')]('%s_%s',this['channel'][_0x4313('0x33')],rs[_0x4313('0x116')](0x5));var _0x2227f8=util[_0x4313('0x25')](_0x4313('0x172'),FILES_PATH,_0x27f68b,_0x13ad56);var _0x3f2712=util['format'](_0x4313('0x12a'),FILES_PATH,_0x27f68b);this['createSquareRecording'][_0x4313('0x6a')](this,_0x110848,_0x27f68b,_0x2227f8);this['channel'][_0x4313('0x99')](_0x4313('0x173'),_0x27f68b);logger[_0x4313('0x28')](_0x4313('0x174'),_0x3f2712,_0x13ad56,_0x110848[_0x4313('0x175')],_0x110848['timeout']);return this['channel'][_0x4313('0x12d')](_0x3f2712,_0x13ad56,_0x110848['escape_digits'],_0x110848[_0x4313('0x61')],undefined,!![]);};AGIVertices[_0x4313('0x14')]['restapi']=function(_0x520675){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x176'),_0x520675['label']));if(!this['isConfigured'](_0x520675[_0x4313('0xe0')])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0x177'));}var _0x116967=this['restAPI']['sync'](this,_0x520675);logger[_0x4313('0x28')](util['format']('Response:',util[_0x4313('0x178')](_0x116967,{'showHidden':![],'depth':null})));if(!this[_0x4313('0x80')](_0x520675[_0x4313('0xd3')])){return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0x179'));}var _0x4451f9=this[_0x4313('0xf')][_0x4313('0x6a')](this,_0x520675[_0x4313('0xd3')]);if(!_0x4451f9){return this['channel'][_0x4313('0x2d')](_0x520675,_0x4313('0xd4'));}this[_0x4313('0xc')][_0x4313('0x99')](util[_0x4313('0x25')](_0x4313('0x17a'),_0x4451f9),_0x116967['statusCode']?_0x116967[_0x4313('0x70')]:_0x4313('0x17b'));this['channel'][_0x4313('0x99')](util[_0x4313('0x25')](_0x4313('0x17c'),_0x4451f9),_0x116967[_0x4313('0x17d')]?_0x116967[_0x4313('0x17d')]:'OK');if(_0x116967['body']){try{this[_0x4313('0x97')](_0x116967[_0x4313('0x64')],_0x4451f9);}catch(_0x2e8019){logger[_0x4313('0x2d')](util[_0x4313('0x25')](_0x4313('0x17e'),_0x4451f9));}}return this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x17f'),_0x4451f9));};AGIVertices['prototype'][_0x4313('0x180')]=function(_0x1e5cff){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x181'),_0x1e5cff[_0x4313('0x34')]));return this[_0x4313('0xc')]['sayDigits'](_0x1e5cff[_0x4313('0x182')]['replace'](/\s+/g,''),_0x1e5cff['escape_digits']);};AGIVertices[_0x4313('0x14')]['saynumber']=function(_0x3317e8){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x183'),_0x3317e8[_0x4313('0x34')]));return this['channel'][_0x4313('0x184')](_0x3317e8['number'][_0x4313('0x185')](/\s+/g,''),_0x3317e8[_0x4313('0x175')]);};AGIVertices[_0x4313('0x14')][_0x4313('0x186')]=function(_0xbf2a4b){logger[_0x4313('0x28')](util['format'](_0x4313('0x187'),_0xbf2a4b[_0x4313('0x34')]));return this[_0x4313('0xc')][_0x4313('0x188')](_0xbf2a4b[_0x4313('0x57')],_0xbf2a4b[_0x4313('0x175')]);};AGIVertices[_0x4313('0x14')][_0x4313('0x189')]=function(_0x2f9ad7){logger[_0x4313('0x28')](util[_0x4313('0x25')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2f9ad7[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x2f9ad7[_0x4313('0x18a')])){return this['channel'][_0x4313('0xa4')](_0x4313('0x18b'));}var _0x54af1e=this[_0x4313('0x18c')][_0x4313('0x6a')](this,_0x2f9ad7[_0x4313('0x18a')]);if(!_0x54af1e||!_0x54af1e[_0x4313('0x18d')]){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x2f9ad7,_0x4313('0x18e'));}var _0x512b54={'from':util[_0x4313('0x25')]('\x22%s\x22\x20<%s>',_0x54af1e[_0x4313('0x12')],_0x54af1e[_0x4313('0x18f')]||_0x54af1e[_0x4313('0x18d')][_0x4313('0x190')]),'to':_0x2f9ad7['to']||'','cc':_0x2f9ad7['cc']||'','bcc':_0x2f9ad7[_0x4313('0x191')]||'','subject':_0x2f9ad7[_0x4313('0x192')],'html':_0x2f9ad7[_0x4313('0x57')],'text':_0x2f9ad7['text']};var _0x22ff1d={'tls':{'rejectUnauthorized':![]}};if(_0x54af1e['Smtp'][_0x4313('0x193')]){_0x22ff1d[_0x4313('0x193')]=_0x54af1e[_0x4313('0x18d')][_0x4313('0x193')];}else{_0x22ff1d[_0x4313('0x194')]=_0x54af1e[_0x4313('0x18d')][_0x4313('0x194')];_0x22ff1d[_0x4313('0x195')]=_0x54af1e[_0x4313('0x18d')][_0x4313('0x195')];_0x22ff1d[_0x4313('0x196')]=_0x54af1e[_0x4313('0x18d')][_0x4313('0x196')];}if(_0x54af1e['Smtp'][_0x4313('0x197')]){_0x22ff1d[_0x4313('0x198')]={'user':_0x54af1e['Smtp'][_0x4313('0x190')],'pass':_0x54af1e[_0x4313('0x18d')][_0x4313('0x199')]};}if(this[_0x4313('0x80')](_0x2f9ad7[_0x4313('0x19a')])){}logger[_0x4313('0xd9')]('sendMail\x20message',JSON[_0x4313('0x6e')](_0x512b54));this[_0x4313('0x32')]['sync'](this,_0x2f9ad7,_0x2f9ad7[_0x4313('0x18a')]);this[_0x4313('0xc')]['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x54af1e[_0x4313('0x12')]));this[_0x4313('0x1e')][_0x4313('0x6a')](this,_0x22ff1d,_0x512b54);return this['channel'][_0x4313('0xa4')](_0x4313('0x19b'));};AGIVertices[_0x4313('0x14')][_0x4313('0x19c')]=function(_0x12f43a){logger['info'](util[_0x4313('0x25')](_0x4313('0x19d'),_0x12f43a[_0x4313('0x34')]));return this['channel'][_0x4313('0xa4')](_0x4313('0x19e'));};AGIVertices[_0x4313('0x14')]['sendSMS']=function(_0x461da4){logger['info'](util[_0x4313('0x25')](_0x4313('0x19f'),_0x461da4[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x461da4[_0x4313('0x1a0')])){return this[_0x4313('0xc')]['noop'](_0x4313('0x1a1'));}var _0x15cc76=this['getSmsAccount'][_0x4313('0x6a')](this,_0x461da4['sms_account_id']);if(!_0x15cc76){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x461da4,_0x4313('0x1a2'));}var _0xf63e9f={'body':_0x461da4[_0x4313('0x1a3')],'phone':_0x461da4['to']||'','SmsAccountId':_0x15cc76['id']};logger[_0x4313('0xd9')](_0x4313('0x1a4'),JSON[_0x4313('0x6e')](_0xf63e9f));this[_0x4313('0x32')][_0x4313('0x6a')](this,_0x461da4,_0x461da4[_0x4313('0x1a0')]);this[_0x4313('0xc')][_0x4313('0xa4')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x15cc76[_0x4313('0x12')]));this[_0x4313('0x31')]['sync'](this,_0xf63e9f);return this[_0x4313('0xc')][_0x4313('0xa4')](_0x4313('0x1a5'));};AGIVertices['prototype'][_0x4313('0x1a6')]=function(_0x242afd){logger['info'](util[_0x4313('0x25')](_0x4313('0x1a7'),_0x242afd['label']));if(!this['isConfigured'](_0x242afd[_0x4313('0xd3')])){return this[_0x4313('0xc')]['error'](_0x242afd,_0x4313('0x1a8'));}var _0x3f0fea=this[_0x4313('0xf')][_0x4313('0x6a')](this,_0x242afd[_0x4313('0xd3')]);if(!_0x3f0fea){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x242afd,_0x4313('0xd4'));}return this['channel'][_0x4313('0x99')](_0x3f0fea,_0x242afd[_0x4313('0x1a9')]);};AGIVertices['prototype'][_0x4313('0x1aa')]=function(_0x31ed45){logger[_0x4313('0x28')](util[_0x4313('0x25')]('Enter\x20in\x20START\x20(%s)\x20block',_0x31ed45[_0x4313('0x34')]));this['channel'][_0x4313('0xa4')](_0x4313('0x1ab'));if(_0x31ed45['answer']===_0x4313('0x1ac')){this[_0x4313('0xc')][_0x4313('0xa4')]('Answer');return this[_0x4313('0xc')][_0x4313('0xb1')]();}return this[_0x4313('0xc')][_0x4313('0xa4')]('Skipped\x20Answer');};AGIVertices['prototype'][_0x4313('0x1ad')]=function(_0x272b4d){logger['info'](util[_0x4313('0x25')](_0x4313('0x1ae'),_0x272b4d[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x272b4d['project_id'])){return this['channel'][_0x4313('0x2d')](_0x272b4d,_0x4313('0x1af'));}var _0x4c2d9b=this[_0x4313('0x1b0')][_0x4313('0x6a')](this,_0x272b4d[_0x4313('0x1b1')]);if(!this[_0x4313('0x80')](_0x4c2d9b)){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x272b4d,util['format'](_0x4313('0x1b2'),_0x272b4d[_0x4313('0x1b1')]));}if(_0x4c2d9b===this[_0x4313('0xc')][_0x4313('0x3c')]){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x272b4d,_0x4313('0x1b3'));}this[_0x4313('0x32')][_0x4313('0x6a')](this,_0x272b4d,_0x4c2d9b);var _0x3a4b59=this[_0x4313('0xc')][_0x4313('0x53')](_0x4313('0x1b4'),util[_0x4313('0x25')](_0x4313('0x1b5'),config['agi']['host']||'127.0.0.1',_0x4c2d9b,this[_0x4313('0xc')]['arg_1']));if(_0x3a4b59[_0x4313('0x9d')]===-0x1){return _0x3a4b59;}return this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0xbd'),_0x4313('0x1b4'),_0x4c2d9b));};AGIVertices[_0x4313('0x14')]['system']=function(_0xbf8f95){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x1b6'),_0xbf8f95[_0x4313('0x34')]));var _0x53c6ad=this[_0x4313('0x52')][_0x4313('0x6a')](this,_0xbf8f95[_0x4313('0xb0')]);this[_0x4313('0x32')][_0x4313('0x6a')](this,_0xbf8f95,_0xbf8f95[_0x4313('0xb0')]);if(this['isConfigured'](_0xbf8f95[_0x4313('0xd3')])){var _0x23466d=this[_0x4313('0xf')][_0x4313('0x6a')](this,_0xbf8f95['variable_id']);if(_0x23466d){this[_0x4313('0xc')]['setVariable'](_0x23466d,_0x53c6ad);return this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x1b7'),_0xbf8f95[_0x4313('0xb0')],_0x23466d));}}return this[_0x4313('0xc')]['noop'](util[_0x4313('0x25')](_0x4313('0x1b8'),_0xbf8f95[_0x4313('0xb0')]));};AGIVertices[_0x4313('0x14')][_0x4313('0x1b9')]=function(_0x3c282b){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x1ba'),_0x3c282b[_0x4313('0x34')]));_0x3c282b['text']=_0x3c282b['text'][_0x4313('0x185')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3c282b['apiKey'])){return this[_0x4313('0xc')]['noop'](_0x4313('0x1bb'));}if(!this[_0x4313('0x80')](_0x3c282b[_0x4313('0x57')])){return this[_0x4313('0xc')]['noop'](_0x4313('0xe4'));}this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x1bc'),_0x3c282b[_0x4313('0x57')]));var _0x112eb0=this[_0x4313('0x1bd')][_0x4313('0x6a')](this,_0x3c282b);if(_0x112eb0){this['channel'][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x1be'),_0x112eb0));var _0x2d2d6c=this['channel'][_0x4313('0x14d')](_0x112eb0);try{fs[_0x4313('0xfe')](_0x112eb0+'.wav');}catch(_0x52613f){logger[_0x4313('0x2d')](_0x52613f);}return _0x2d2d6c;}return this['channel'][_0x4313('0x2d')](_0x3c282b,_0x4313('0x1bf'));};AGIVertices[_0x4313('0x14')][_0x4313('0x1c0')]=function(_0x1795f9){logger[_0x4313('0x28')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1795f9[_0x4313('0x34')]));_0x1795f9[_0x4313('0x57')]=_0x1795f9[_0x4313('0x57')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4313('0x80')](_0x1795f9[_0x4313('0x57')])){return this[_0x4313('0xc')][_0x4313('0xa4')]('no\x20text\x20configured');}this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x1c1'),_0x1795f9[_0x4313('0x57')]));var _0x46bb50=this[_0x4313('0x5d')][_0x4313('0x6a')](this,_0x1795f9);if(_0x46bb50){this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')](_0x4313('0x1c2'),_0x46bb50));var _0x23727f=this['channel'][_0x4313('0x14d')](_0x46bb50);try{fs[_0x4313('0xfe')](_0x46bb50+'.wav');}catch(_0x3722b7){logger[_0x4313('0x2d')](_0x3722b7);}return _0x23727f;}return this[_0x4313('0xc')]['error'](_0x1795f9,_0x4313('0x1c3'));};AGIVertices[_0x4313('0x14')]['unpause']=function(_0xe7621e){logger[_0x4313('0x28')](util[_0x4313('0x25')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0xe7621e[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0xe7621e[_0x4313('0x151')])){return this['channel'][_0x4313('0x2d')](_0xe7621e,_0x4313('0x159'));}logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x152'),this[_0x4313('0xc')][_0x4313('0x35')],_0xe7621e[_0x4313('0x151')]));var _0x5abea2=this[_0x4313('0x4d')][_0x4313('0x6a')](this,_0xe7621e[_0x4313('0x151')]);if(_0x5abea2){logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x153'),this[_0x4313('0xc')][_0x4313('0x35')],_0xe7621e['findBy']));this[_0x4313('0xc')]['noop'](util[_0x4313('0x25')](_0x4313('0x153'),this[_0x4313('0xc')][_0x4313('0x35')],_0xe7621e['findBy']));return{'code':0xc8,'result':_0x4313('0x154')};}else{logger[_0x4313('0x28')](util[_0x4313('0x25')](_0x4313('0x155'),this[_0x4313('0xc')][_0x4313('0x35')],_0xe7621e['findBy']));this[_0x4313('0xc')][_0x4313('0xa4')](util[_0x4313('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4313('0xc')][_0x4313('0x35')],_0xe7621e['findBy']));return{'code':0xc8,'result':_0x4313('0x156')};}};AGIVertices[_0x4313('0x14')][_0x4313('0x1c4')]=function(_0x5977b1){logger['info'](util[_0x4313('0x25')](_0x4313('0x1c5'),_0x5977b1['label']));var _0x3d9d7e=this[_0x4313('0xc')][_0x4313('0x53')](_0x4313('0x1c6'),[_0x5977b1[_0x4313('0x1c7')],_0x5977b1[_0x4313('0x73')]]);if(_0x3d9d7e[_0x4313('0x9d')]===-0x1){return _0x3d9d7e;}return this['channel']['noop'](util[_0x4313('0x25')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x5977b1['mailbox']));};AGIVertices[_0x4313('0x14')][_0x4313('0x1c8')]=function(_0x18495a){logger[_0x4313('0x28')](util['format'](_0x4313('0x1c9'),_0x18495a[_0x4313('0x34')]));if(!this[_0x4313('0x80')](_0x18495a[_0x4313('0xd3')])){return this[_0x4313('0xc')][_0x4313('0x2d')](_0x18495a,'no\x20variable\x20selected');}var _0x5a2aaa=this[_0x4313('0xf')][_0x4313('0x6a')](this,_0x18495a[_0x4313('0xd3')]);if(!_0x5a2aaa){return this[_0x4313('0xc')]['error'](_0x18495a,'no\x20variable\x20found');}var _0x4c4c78=this[_0x4313('0xc')][_0x4313('0xf')](_0x5a2aaa);return{'code':0xc8,'result':_0x4c4c78[_0x4313('0x9f')]?_0x4c4c78[_0x4313('0x9f')]:'-'};};String['prototype'][_0x4313('0x9b')]=function(_0x495ff7,_0x15b420){return this[_0x4313('0x9a')](_0x495ff7)[_0x4313('0x1ca')](_0x15b420);};module['exports']=AGIVertices; \ No newline at end of file +var _0xf29d=['Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','TildeASR\x20Result\x20%s','gotoc','continueAt','context','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','opts','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','agi','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','service','host','port','secure','auth','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','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','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','arg_1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','join','path','util','shelljs','odbc','randomstring','moment','mustache','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','channel','prototype','getVariable','rpc','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getSound','getSoundPath','save_name','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','callerid','createSquareRecording','calleridname','extension','dnid','file','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','shellCommand','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','googleTTS','restAPI','method','number','timeout','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','uri','url','stringify','render','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_text_type','awsLex','googleASR','tildeASR','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','length','saveRestApiResult','%s.%s','isArray','setVariable','replaceAll','extra','getAndSetVariable','result','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','label','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','no\x20grammar\x20configured','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','speech','out','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block'];(function(_0x142f74,_0x48e9f3){var _0x1372aa=function(_0x762ff4){while(--_0x762ff4){_0x142f74['push'](_0x142f74['shift']());}};_0x1372aa(++_0x48e9f3);}(_0xf29d,0xc4));var _0xdf29=function(_0x1b87a6,_0x4b11a0){_0x1b87a6=_0x1b87a6-0x0;var _0x3f2b76=_0xf29d[_0x1b87a6];return _0x3f2b76;};'use strict';var fs=require('fs');var path=require(_0xdf29('0x0'));var util=require(_0xdf29('0x1'));var _=require('lodash');var sh=require(_0xdf29('0x2'));var odbc=require(_0xdf29('0x3'))();var rs=require(_0xdf29('0x4'));var moment=require(_0xdf29('0x5'));var Mustache=require(_0xdf29('0x6'));var rp=require('request-promise');var logger=require('../../config/logger')('agi');var config=require(_0xdf29('0x7'));var scripts=require(_0xdf29('0x8'));var FILES_PATH=_0xdf29('0x9');var recursiveMapAttributes=['rawHeaders',_0xdf29('0xa')];var verticesWithRetry=[_0xdf29('0xb'),_0xdf29('0xc'),'getsecretdigits'];var AGIVertices=function(_0x3c4597,_0x2eb0b1,_0x1fb3f1){this[_0xdf29('0xd')]=_0x3c4597;this['rpc']=_0x2eb0b1;this['mailRpc']=_0x1fb3f1;};AGIVertices[_0xdf29('0xe')][_0xdf29('0xf')]=function(_0x57d91b,_0x3f2853){this[_0xdf29('0x10')][_0xdf29('0x11')](_0x57d91b)[_0xdf29('0x12')](function(_0x122b7e){_0x3f2853(null,_0x122b7e?_0x122b7e['name']:![]);})[_0xdf29('0x13')](function(_0x4f0875){_0x3f2853(_0x4f0875);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x14')]=function(_0x11bf94,_0x478d8a){this[_0xdf29('0x10')][_0xdf29('0x15')](_0x11bf94)['then'](function(_0xcf93bd){_0x478d8a(null,_0xcf93bd?_0xcf93bd[_0xdf29('0x16')]:![]);})[_0xdf29('0x13')](function(_0x598f2a){_0x478d8a(_0x598f2a);});};AGIVertices[_0xdf29('0xe')]['getSquareProject']=function(_0x4ef166,_0x1c993b){this[_0xdf29('0x10')]['getSquareProjectById'](_0x4ef166)['then'](function(_0x11dc19){_0x1c993b(null,_0x11dc19?_0x11dc19[_0xdf29('0x16')]:![]);})['catch'](function(_0x207daa){_0x1c993b(_0x207daa);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x17')]=function(_0x3e13db,_0x2e1755){this[_0xdf29('0x10')][_0xdf29('0x18')](_0x3e13db)[_0xdf29('0x12')](function(_0x15501e){_0x2e1755(null,_0x15501e?_0x15501e[_0xdf29('0x19')]:![]);})[_0xdf29('0x13')](function(_0x2767a7){_0x2e1755(_0x2767a7);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x1a')]=function(_0x3370dd,_0xd09fa6){this['rpc']['getUserById'](_0x3370dd)[_0xdf29('0x12')](function(_0x468285){_0xd09fa6(null,_0x468285?_0x468285[_0xdf29('0x16')]:![]);})[_0xdf29('0x13')](function(_0x1e311b){_0xd09fa6(_0x1e311b);});};AGIVertices['prototype'][_0xdf29('0x1b')]=function(_0x20907f,_0x3c93e2){this[_0xdf29('0x10')]['getTrunkById'](_0x20907f)[_0xdf29('0x12')](function(_0x503cd4){_0x3c93e2(null,_0x503cd4?_0x503cd4['name']:![]);})['catch'](function(_0x484989){_0x3c93e2(_0x484989);});};AGIVertices['prototype'][_0xdf29('0x1c')]=function(_0x5ae2de,_0xc7c1e6){var _0x4da675=this;this['rpc']['getSoundById'](_0x5ae2de)[_0xdf29('0x12')](function(_0x3cdca4){_0xc7c1e6(null,_0x3cdca4?_0x4da675[_0xdf29('0x1d')](_0x3cdca4[_0xdf29('0x1e')]):![]);})[_0xdf29('0x13')](function(_0xd2b43c){_0xc7c1e6(_0xd2b43c);});};AGIVertices['prototype']['getMailAccount']=function(_0x1cf013,_0x24253e){this[_0xdf29('0x10')][_0xdf29('0x1f')](_0x1cf013)[_0xdf29('0x12')](function(_0x304b61){_0x24253e(null,_0x304b61?_0x304b61:![]);})[_0xdf29('0x13')](function(_0x281d6f){_0x24253e(_0x281d6f);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x20')]=function(_0x1bb3ce,_0x38ad0d,_0x15141e){this[_0xdf29('0x21')][_0xdf29('0x20')](_0x1bb3ce,_0x38ad0d)['then'](function(){_0x15141e(null);})[_0xdf29('0x13')](function(_0x29151b){_0x15141e(_0x29151b);});};AGIVertices['prototype'][_0xdf29('0x22')]=function(_0x6ddc2d,_0x3ab315){this['rpc'][_0xdf29('0x23')](_0x6ddc2d)[_0xdf29('0x12')](function(_0x10d72f){if(_0x10d72f){if(_0x10d72f[_0xdf29('0x24')]){_0x3ab315(null,[_0x10d72f['interval']]);}else{_0x3ab315(null,_[_0xdf29('0x25')](_0x10d72f[_0xdf29('0x26')],'interval'));}}else{_0x3ab315(null,![]);}})[_0xdf29('0x13')](function(_0x55d25c){_0x3ab315(_0x55d25c);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x1d')]=function(_0x33af6a){return util[_0xdf29('0x27')](_0xdf29('0x28'),FILES_PATH,_0x33af6a);};AGIVertices[_0xdf29('0xe')][_0xdf29('0x29')]=function(_0x331d66,_0x2cb012,_0x54b71c){odbc[_0xdf29('0x2a')](_0x331d66,function(_0x2469db){if(_0x2469db){logger[_0xdf29('0x2b')](_0xdf29('0x2c'),_0x2469db);_0x54b71c(_0x2469db);}else{logger[_0xdf29('0x2d')](_0xdf29('0x2e'));odbc[_0xdf29('0x2f')](_0x2cb012,function(_0x26818d,_0x5a36dd){if(_0x26818d){logger['info'](_0xdf29('0x30'),_0x2cb012);_0x54b71c(_0x26818d);}else{logger['info'](_0xdf29('0x31'),_0x2cb012);odbc[_0xdf29('0x32')](function(_0xf4135a){if(_0xf4135a){logger[_0xdf29('0x2b')](_0xdf29('0x33'),_0xf4135a);}_0x54b71c(null,_0x5a36dd);});}});}});};AGIVertices['prototype'][_0xdf29('0x34')]=function(_0x46fdec,_0x49b950){this[_0xdf29('0x10')][_0xdf29('0x35')](_0x46fdec)[_0xdf29('0x12')](function(_0x534fa4){_0x49b950(null,_0x534fa4?_0x534fa4:![]);})[_0xdf29('0x13')](function(_0x319cee){_0x49b950(_0x319cee);});};AGIVertices[_0xdf29('0xe')]['createSmsMessage']=function(_0x151374,_0x5b5fed){this['rpc'][_0xdf29('0x36')](_0x151374)[_0xdf29('0x12')](function(_0x1f6199){_0x5b5fed(null,_0x1f6199);})[_0xdf29('0x13')](function(_0x4a3572){_0x5b5fed(_0x4a3572);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x37')]=function(_0x28a198,_0x209739,_0x4330c5){this['rpc'][_0xdf29('0x37')]({'uniqueid':this[_0xdf29('0xd')][_0xdf29('0x38')],'node':_0x28a198['label'],'application':_0x28a198[_0xdf29('0x39')],'data':_0x209739||null,'project_name':this[_0xdf29('0xd')]['arg_1'],'callerid':this[_0xdf29('0xd')][_0xdf29('0x3a')]})[_0xdf29('0x12')](function(_0x42e22c){if(_0x4330c5){_0x4330c5(null,_0x42e22c);}})['catch'](function(_0x26f857){if(_0x4330c5){_0x4330c5(_0x26f857);}});};AGIVertices['prototype'][_0xdf29('0x3b')]=function(_0xf81aa7,_0x3c11eb,_0x44a4ae,_0xb1f6ae){this[_0xdf29('0x10')][_0xdf29('0x3b')]({'uniqueid':this[_0xdf29('0xd')][_0xdf29('0x38')],'callerid':this[_0xdf29('0xd')][_0xdf29('0x3a')],'calleridname':this[_0xdf29('0xd')][_0xdf29('0x3c')],'context':this['channel']['context'],'extension':this[_0xdf29('0xd')][_0xdf29('0x3d')],'priority':this['channel']['priority'],'accountcode':this[_0xdf29('0xd')]['accountcode'],'dnid':this[_0xdf29('0xd')][_0xdf29('0x3e')],'projectName':this[_0xdf29('0xd')]['arg_1'],'saveName':_0x3c11eb,'filename':_0xf81aa7[_0xdf29('0x3f')]||_0x3c11eb,'savePath':_0x44a4ae})[_0xdf29('0x12')](function(_0x330295){_0xb1f6ae(null,_0x330295);})[_0xdf29('0x13')](function(_0x395aea){_0xb1f6ae(_0x395aea);});};AGIVertices[_0xdf29('0xe')]['createSquareMessage']=function(_0x3c26bf,_0x1a2fd0,_0x34c889,_0x266aa4,_0x470871){this['rpc'][_0xdf29('0x40')]({'uniqueid':this[_0xdf29('0xd')]['uniqueid'],'body':_0x3c26bf,'direction':_0x1a2fd0,'providerName':_0x34c889,'providerResponse':_0x266aa4})[_0xdf29('0x12')](function(_0x315a7c){if(_0x470871){_0x470871(null,_0x315a7c);}})['catch'](function(_0x5115fc){if(_0x470871){_0x470871(_0x5115fc);}});};AGIVertices['prototype'][_0xdf29('0x41')]=function(_0x283287,_0x51442a){this[_0xdf29('0x10')]['createCmContact']({'firstName':_['isEmpty'](_0x283287['name'])||_[_0xdf29('0x42')](_0x283287['name'])?'callback_'+Math[_0xdf29('0x43')]():_0x283287[_0xdf29('0x16')],'lastName':_[_0xdf29('0x44')](_0x283287[_0xdf29('0x45')])||_[_0xdf29('0x42')](_0x283287[_0xdf29('0x45')])?null:_0x283287[_0xdf29('0x45')],'phone':_0x283287[_0xdf29('0x46')],'ListId':_0x283287[_0xdf29('0x47')],'scheduledat':_0x283287['scheduledAt'],'callbackUniqueid':this['channel'][_0xdf29('0x38')],'tags':_0xdf29('0x48'),'description':_0xdf29('0x49')+_0x283287[_0xdf29('0x4a')][_0xdf29('0x4b')](),'priority':_0x283287[_0xdf29('0x4c')]})['then'](function(_0x3b6c01){_0x51442a(null,_0x3b6c01);})[_0xdf29('0x13')](function(_0x1a163e){_0x51442a(_0x1a163e);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x4d')]=function(_0x30af6c,_0x3b7557){this[_0xdf29('0x10')][_0xdf29('0x4e')](_0x30af6c)[_0xdf29('0x12')](function(_0x30b57f){_0x3b7557(null,_0x30b57f?_0x30b57f[_0xdf29('0x16')]:![]);})[_0xdf29('0x13')](function(_0x208795){_0x3b7557(_0x208795);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x4f')]=function(_0x1a2050,_0x382e1d,_0x2f8184){var _0x5c799a={'role':'agent'};_0x5c799a[_0x1a2050]=this['channel'][_0xdf29('0x3a')];this[_0xdf29('0x10')][_0xdf29('0x4f')](_0x5c799a,_0x382e1d,this[_0xdf29('0xd')]['uniqueid'])[_0xdf29('0x12')](function(_0x234cb8){_0x2f8184(null,_[_0xdf29('0x42')](_0x234cb8)?![]:!![]);})[_0xdf29('0x13')](function(_0xd7a6b4){logger[_0xdf29('0x2b')](_0xd7a6b4);_0x2f8184(null,![]);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x50')]=function(_0xb94d86,_0x3f080b){var _0x6be96a={'role':'agent'};_0x6be96a[_0xb94d86]=this['channel']['callerid'];this[_0xdf29('0x10')][_0xdf29('0x50')](_0x6be96a)[_0xdf29('0x12')](function(_0x1c39bb){_0x3f080b(null,_['isNil'](_0x1c39bb)?![]:!![]);})[_0xdf29('0x13')](function(_0x571a5d){logger['error'](_0x571a5d);_0x3f080b(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x46629d,_0x1e2e80){var _0x308727={'role':_0xdf29('0x51')};_0x308727[_0x46629d]=this[_0xdf29('0xd')][_0xdf29('0x3a')];this[_0xdf29('0x10')][_0xdf29('0x52')](_0x308727)[_0xdf29('0x12')](function(_0x125ad0){_0x1e2e80(null,_['isNil'](_0x125ad0)?![]:!![]);})[_0xdf29('0x13')](function(_0x401181){logger[_0xdf29('0x2b')](_0x401181);_0x1e2e80(null,![]);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x53')]=function(_0x17f3f2,_0x2b70af){var _0xe636a1={'role':_0xdf29('0x51')};_0xe636a1[_0x17f3f2]=this['channel']['callerid'];var _0x22c1f4=_0x17f3f2!=_0xdf29('0x54')?util[_0xdf29('0x27')]('%s/%s@from-sip/n','LOCAL',this[_0xdf29('0xd')]['callerid']):undefined;this['rpc'][_0xdf29('0x53')](_0xe636a1,_0x22c1f4)['then'](function(_0x5ca996){_0x2b70af(null,_[_0xdf29('0x42')](_0x5ca996)?![]:!![]);})[_0xdf29('0x13')](function(_0x12a956){logger[_0xdf29('0x2b')](_0x12a956);_0x2b70af(null,![]);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x55')]=function(_0x3ede51,_0x3c825a){sh['exec'](_[_0xdf29('0x56')](_0x3ede51),function(_0x136e56,_0x39aa32){var _0x133631=_0x39aa32[_0xdf29('0x57')](/(\r\n|\n|\r)/gm,'');_0x3c825a(null,_0x133631);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x58')]=function(_0x38f076,_0x3b59e0){scripts['googleCloudTTS'](_0x38f076['apiKey'],_0x38f076[_0xdf29('0x59')]||_0xdf29('0x5a'),_0x38f076[_0xdf29('0x5a')],_0x38f076[_0xdf29('0x5b')]||_0xdf29('0x5c'),_0x38f076['ssmlGender']||_0xdf29('0x5d'),_0x38f076[_0xdf29('0x5e')]||'MP3')[_0xdf29('0x12')](function(_0x255c44){_0x3b59e0(null,_0x255c44);})[_0xdf29('0x13')](function(_0x4c217d){_0x3b59e0(_0x4c217d);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x5f')]=function(_0x4715f0,_0x329489){scripts[_0xdf29('0x5f')](_0x4715f0[_0xdf29('0x5a')],_0x4715f0['google_tts_language']||'en',0x1)['then'](function(_0x324420){_0x329489(null,_0x324420);})['catch'](function(_0x3f7018){_0x329489(_0x3f7018);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x60')]=function(_0x514830,_0x245df9){var _0x351d52={'uri':_0x514830['url'],'method':_0x514830[_0xdf29('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x514830['timeout'])===_0xdf29('0x62')&&parseInt(_0x514830['timeout'])>=0x1?parseInt(_0x514830[_0xdf29('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xdf29('0x64'),_0xdf29('0x65')],_0x351d52[_0xdf29('0x61')][_0xdf29('0x66')]())){try{_0x351d52['body']=_0x514830['rawBody']?JSON[_0xdf29('0x67')](_0x514830[_0xdf29('0xa')]):{};}catch(_0x47c6b4){logger[_0xdf29('0x2b')](_0xdf29('0x68'),_0x47c6b4);}}try{_0x351d52[_0xdf29('0x69')]=_0x514830[_0xdf29('0x6a')]?JSON['parse'](_0x514830[_0xdf29('0x6a')]):{};}catch(_0x3fdbc8){logger[_0xdf29('0x2b')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3fdbc8);}if(_0x514830[_0xdf29('0x6b')]){try{var _0x46b6ad=require(_0x514830[_0xdf29('0x6b')])['sync'](this,_0x351d52);_0x351d52[_0xdf29('0x6c')]=Mustache['render'](_0x514830[_0xdf29('0x6d')],_0x46b6ad,{},['$$','$$']);if(_0x351d52[_0xdf29('0x69')]){_0x351d52[_0xdf29('0x69')]=JSON['parse'](Mustache['render'](JSON[_0xdf29('0x6e')](_0x351d52[_0xdf29('0x69')]),_0x46b6ad,{},['$$','$$']));}if(_0x351d52['body']){_0x351d52['body']=JSON[_0xdf29('0x67')](Mustache[_0xdf29('0x6f')](JSON['stringify'](_0x351d52[_0xdf29('0x70')]),_0x46b6ad,{},['$$','$$']));}}catch(_0x45e849){logger['error'](_0xdf29('0x71'),_0x45e849);}}rp(_0x351d52)['then'](function(_0x39d2aa){var _0x1d5905={'statusCode':_0x39d2aa[_0xdf29('0x72')]||0xc8,'statusMessage':_0x39d2aa[_0xdf29('0x73')]||'OK','headers':_0x39d2aa[_0xdf29('0x69')]||{},'body':_0x39d2aa[_0xdf29('0x70')]||{}};_0x245df9(null,_0x1d5905);})['catch'](function(_0x4e8b92){var _0x314e6d={'statusCode':_0x4e8b92[_0xdf29('0x72')]||0x1f4,'statusMessage':_0x4e8b92[_0xdf29('0x74')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x4e8b92['options'][_0xdf29('0x69')]||{},'body':_0x4e8b92[_0xdf29('0x75')][_0xdf29('0x70')]||{}};_0x245df9(null,_0x314e6d);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x76')]=function(_0xcb59d9,_0xfc4c86){scripts['googleDialogflow'](this['channel']['uniqueid'],_0xcb59d9[_0xdf29('0x77')],_0xcb59d9[_0xdf29('0x5a')],_0xcb59d9[_0xdf29('0x78')]||'en')['then'](function(_0xb31905){_0xfc4c86(null,_0xb31905);})['catch'](function(_0x75fbb0){_0xfc4c86(_0x75fbb0);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x79')]=function(_0xbc22ff,_0x36927c){scripts[_0xdf29('0x79')](this[_0xdf29('0xd')][_0xdf29('0x38')],_0xbc22ff[_0xdf29('0x7a')],_0xbc22ff[_0xdf29('0x7b')],_0xbc22ff['private_key'],_0xbc22ff[_0xdf29('0x5a')],_0xbc22ff[_0xdf29('0x7c')]||'en')[_0xdf29('0x12')](function(_0x1c65e6){_0x36927c(null,_0x1c65e6);})[_0xdf29('0x13')](function(_0xb680d3){_0x36927c(_0xb680d3);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x7d')]=function(_0x2b160f,_0x554082){scripts[_0xdf29('0x7d')](this['channel'],_0x2b160f)[_0xdf29('0x12')](function(_0x516a2e){_0x554082(null,_0x516a2e);})[_0xdf29('0x13')](function(_0x38d949){_0x554082(_0x38d949);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x7e')]=function(_0x542407,_0x1b20e6){scripts[_0xdf29('0x7e')](_0x542407[_0xdf29('0x77')],_0x542407['text'],_0x542407[_0xdf29('0x7f')]||'en-US',_0x542407[_0xdf29('0x80')])[_0xdf29('0x12')](function(_0x2f645b){_0x1b20e6(null,_0x2f645b);})['catch'](function(_0x3d4337){_0x1b20e6(_0x3d4337);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x81')]=function(_0x1327e9,_0x3a3c30,_0x2f879f){scripts[_0xdf29('0x81')](_0x3a3c30,_0x1327e9[_0xdf29('0x77')],_0x1327e9[_0xdf29('0x82')]||_0xdf29('0x5c'),this[_0xdf29('0x83')](_0x1327e9[_0xdf29('0x84')])?_0x1327e9[_0xdf29('0x84')]:undefined)[_0xdf29('0x12')](function(_0x55ff39){_0x2f879f(null,_0x55ff39);})['catch'](function(_0x5765d9){_0x2f879f(_0x5765d9);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x85')]=function(_0x59f2d8,_0x43c552){scripts[_0xdf29('0x85')](_0x59f2d8[_0xdf29('0x86')],_0x59f2d8[_0xdf29('0x87')],_0x59f2d8[_0xdf29('0x88')],_0x59f2d8['aws_polly_voice']||'Amy',_0x59f2d8['text'],_0x59f2d8[_0xdf29('0x89')]||_0xdf29('0x5a'))[_0xdf29('0x12')](function(_0x4f00ee){_0x43c552(null,_0x4f00ee);})[_0xdf29('0x13')](function(_0x5ebd2b){_0x43c552(_0x5ebd2b);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x8a')]=function(_0x364dab,_0x1785cb){scripts['awsLex'](this[_0xdf29('0xd')]['uniqueid'],_0x364dab[_0xdf29('0x86')],_0x364dab[_0xdf29('0x87')],_0x364dab['aws_lex_region'],_0x364dab[_0xdf29('0x5a')],_0x364dab['aws_bot_name'])[_0xdf29('0x12')](function(_0x5645e6){_0x1785cb(null,_0x5645e6);})[_0xdf29('0x13')](function(_0x4e33d0){_0x1785cb(_0x4e33d0);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x8b')]=function(_0x5dcf05,_0x55a469,_0x45b7e7){scripts[_0xdf29('0x8b')](_0x55a469,_0x5dcf05[_0xdf29('0x77')],_0x5dcf05['google_asr_language']||_0xdf29('0x5c'))[_0xdf29('0x12')](function(_0x13432d){_0x45b7e7(null,_0x13432d);})[_0xdf29('0x13')](function(_0x4eb4ef){_0x45b7e7(_0x4eb4ef);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x8c')]=function(_0x3234e5,_0x561e46,_0x2ea7d6){scripts[_0xdf29('0x8c')](_0x561e46,_0x3234e5['appid'],_0x3234e5['appsecret'],_0x3234e5[_0xdf29('0x6c')])['then'](function(_0x489d9d){_0x2ea7d6(null,_0x489d9d);})[_0xdf29('0x13')](function(_0xf8b83f){_0x2ea7d6(_0xf8b83f);});};AGIVertices[_0xdf29('0xe')][_0xdf29('0x8d')]=function(_0x5ae4ef){var _0x5e6851=_[_0xdf29('0x8e')](verticesWithRetry,_0x5ae4ef[_0xdf29('0x39')])?_0x5ae4ef:_[_0xdf29('0x8f')](_0x5ae4ef);for(var _0x159f32 in _0x5e6851){if(_0x5e6851[_0xdf29('0x90')](_0x159f32)){if(_0x5e6851[_0x159f32]&&_[_0xdf29('0x91')](_0x5e6851[_0x159f32])){if(_[_0xdf29('0x8e')](recursiveMapAttributes,_0x159f32)){_0x5e6851[_0x159f32]=this[_0xdf29('0x92')](_0x5e6851[_0x159f32]);}else{_0x5e6851[_0x159f32]=this[_0xdf29('0x93')](_0x5e6851[_0x159f32]);}}}}return _0x5e6851;};AGIVertices[_0xdf29('0xe')]['recursiveNodeIndex']=function(_0x1affee){for(var _0x3c6bfa in _0x1affee){if(_0x1affee[_0xdf29('0x90')](_0x3c6bfa)){if(_[_0xdf29('0x94')](_0x1affee[_0x3c6bfa])){this[_0xdf29('0x95')](_0x1affee[_0x3c6bfa]);}else if(_['isArray'](_0x1affee[_0x3c6bfa])){for(var _0x1303ad=0x0;_0x1303ad<_0x1affee[_0x3c6bfa][_0xdf29('0x96')];_0x1303ad++){this['recursiveNodeIndex'](_0x1affee[_0x3c6bfa][_0x1303ad]);}}else if(_[_0xdf29('0x91')](_0x1affee[_0x3c6bfa])){_0x1affee[_0x3c6bfa]=this['replaceAllVariables'](_0x1affee[_0x3c6bfa]);}}}};AGIVertices[_0xdf29('0xe')][_0xdf29('0x97')]=function(_0x5a4074,_0x3abfe0){for(var _0x4f30f6 in _0x5a4074){if(_0x5a4074[_0xdf29('0x90')](_0x4f30f6)){if(_[_0xdf29('0x94')](_0x5a4074[_0x4f30f6])){if(!_[_0xdf29('0x44')](_0x5a4074[_0x4f30f6])){this[_0xdf29('0x97')](_0x5a4074[_0x4f30f6],util['format'](_0xdf29('0x98'),_0x3abfe0,_0x4f30f6));}}else if(_[_0xdf29('0x99')](_0x5a4074[_0x4f30f6])){for(var _0x45afda=0x0;_0x45afda<_0x5a4074[_0x4f30f6][_0xdf29('0x96')];_0x45afda++){this['saveRestApiResult'](_0x5a4074[_0x4f30f6][_0x45afda],util[_0xdf29('0x27')](_0xdf29('0x98'),_0x3abfe0,_0x4f30f6+'['+_0x45afda+']'));}}else{if(!_[_0xdf29('0x42')](_0x5a4074[_0x4f30f6])){this['channel'][_0xdf29('0x9a')](util[_0xdf29('0x27')]('%s.%s',_0x3abfe0,_0x4f30f6),_0x5a4074[_0x4f30f6]);}}}}};AGIVertices[_0xdf29('0xe')][_0xdf29('0x92')]=function(_0x35b37e){try{var _0x3795c4=JSON[_0xdf29('0x67')](_0x35b37e);this[_0xdf29('0x95')](_0x3795c4);return JSON[_0xdf29('0x6e')](_0x3795c4);}catch(_0x6851c6){return this[_0xdf29('0x93')](_0x35b37e);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x4a4685){var _0x16922d=_0x4a4685['split']('{');for(var _0x5610f5=0x1;_0x5610f5<_0x16922d[_0xdf29('0x96')];_0x5610f5+=0x1){var _0x1e805f=_0x16922d[_0x5610f5]['split']('}');if(_0x1e805f[_0xdf29('0x96')]>0x1){_0x4a4685=_0x4a4685[_0xdf29('0x9b')]('{'+_0x1e805f[0x0]+'}',this['channel'][_0xdf29('0xf')](_0x1e805f[0x0])[_0xdf29('0x9c')]||_0x1e805f[0x0]);}}if(_0x16922d[_0xdf29('0x96')]===0x1){return _0x4a4685[_0xdf29('0x4b')]();}return this[_0xdf29('0x93')](_0x4a4685);};AGIVertices[_0xdf29('0xe')][_0xdf29('0x9d')]=function(_0xed7461,_0xbd7675){var _0x4a0182=this['channel']['getVariable'](_0xed7461);if(_0x4a0182[_0xdf29('0x9e')]===-0x1){return _0x4a0182;}logger[_0xdf29('0x2d')](util[_0xdf29('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0xbd7675,_0x4a0182['extra']));return this['channel'][_0xdf29('0x9a')](_0xbd7675,_0x4a0182['extra']);};AGIVertices['prototype']['isConfigured']=function(_0x3a8df8){return _0x3a8df8&&_0x3a8df8!=='0'&&_0x3a8df8!=='-1'&&_0x3a8df8!=='';};AGIVertices[_0xdf29('0xe')][_0xdf29('0x9f')]=function(_0x23814c){this[_0xdf29('0x37')][_0xdf29('0xa0')](this,_0x23814c,'-');_0x23814c[_0xdf29('0xa1')]=_0x23814c[_0xdf29('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xdf29('0xa2')]=function(_0x1d0a00){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0xa3'),_0x1d0a00['label']));if(!this[_0xdf29('0x83')](_0x1d0a00[_0xdf29('0x5a')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0xa5'));}var _0x577b35='\x22'+_0x1d0a00[_0xdf29('0x5a')]+'\x22';if(this[_0xdf29('0x83')](_0x1d0a00[_0xdf29('0x75')])){_0x577b35+=','+_0x1d0a00[_0xdf29('0x75')];}var _0x4fcf7e=this['channel'][_0xdf29('0xa6')]('MRCPSynth',_0x577b35);if(_0x4fcf7e[_0xdf29('0x9e')]===-0x1){return _0x4fcf7e;}return this['channel']['noop'](util[_0xdf29('0x27')](_0xdf29('0xa7'),_0x577b35));};AGIVertices['prototype'][_0xdf29('0xa8')]=function(_0x3dfc4e){logger['info'](util[_0xdf29('0x27')](_0xdf29('0xa9'),_0x3dfc4e[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0x3dfc4e[_0xdf29('0xab')])){return this[_0xdf29('0xd')]['noop']('no\x20grammar\x20configured');}var _0x4cac3e=_0x3dfc4e[_0xdf29('0xab')];if(this[_0xdf29('0x83')](_0x3dfc4e[_0xdf29('0x75')])){_0x4cac3e+=','+_0x3dfc4e[_0xdf29('0x75')];}var _0x548b27=this[_0xdf29('0xd')][_0xdf29('0xa6')](_0xdf29('0xac'),_0x4cac3e);if(_0x548b27[_0xdf29('0x9e')]===-0x1){return _0x548b27;}var _0x44b3bb=this[_0xdf29('0x9d')](_0xdf29('0xad'),_0xdf29('0xae'));if(_0x44b3bb[_0xdf29('0x9e')]===-0x1){return _0x44b3bb;}var _0x2a5168=this[_0xdf29('0x9d')](_0xdf29('0xaf'),_0xdf29('0xb0'));if(_0x2a5168['result']===-0x1){return _0x2a5168;}var _0x51bd5b=this[_0xdf29('0x9d')](_0xdf29('0xb1'),_0xdf29('0xb2'));if(_0x51bd5b[_0xdf29('0x9e')]===-0x1){return _0x51bd5b;}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util['format'](_0xdf29('0xb3'),_0x4cac3e));};AGIVertices['prototype']['agi']=function(_0x1f83ce){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1f83ce[_0xdf29('0xaa')]));return this[_0xdf29('0xd')]['agi']([_0x1f83ce[_0xdf29('0xb4')],_0x1f83ce[_0xdf29('0xb5')]]);};AGIVertices[_0xdf29('0xe')][_0xdf29('0xb6')]=function(_0x558048){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0xb7'),_0x558048['label']));if(this[_0xdf29('0x83')](_0x558048[_0xdf29('0x63')])){logger['info'](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x558048[_0xdf29('0x63')]));var _0xbbac2a=this['channel']['wait'](_0x558048[_0xdf29('0x63')]);if(_0xbbac2a[_0xdf29('0x9e')]===-0x1){return _0xbbac2a;}}return this[_0xdf29('0xd')][_0xdf29('0xb6')]();};AGIVertices[_0xdf29('0xe')]['callback']=function(_0x4d1bce){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0xb8'),_0x4d1bce[_0xdf29('0xaa')]));if(!this['isConfigured'](_0x4d1bce[_0xdf29('0x47')])){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x4d1bce,_0xdf29('0xb9'));}_0x4d1bce[_0xdf29('0x4a')]=moment();if(this[_0xdf29('0x83')](_0x4d1bce[_0xdf29('0xba')])){_0x4d1bce[_0xdf29('0x4a')]=moment()[_0xdf29('0xbb')](_0x4d1bce[_0xdf29('0xba')],_0xdf29('0xbc'));}if(!this[_0xdf29('0x83')](_0x4d1bce[_0xdf29('0x4c')])){_0x4d1bce[_0xdf29('0x4c')]=0x2;}this['createCmContact']['sync'](this,_0x4d1bce);return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0xbd'),_0x4d1bce[_0xdf29('0x46')],_0x4d1bce['list_id'],_0x4d1bce[_0xdf29('0x4a')]));};AGIVertices[_0xdf29('0xe')][_0xdf29('0xbe')]=function(_0x217c9a){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0xbf'),_0x217c9a['label']));var _0x30e939=this[_0xdf29('0xd')][_0xdf29('0xa6')](_0x217c9a[_0xdf29('0xc0')],_0x217c9a[_0xdf29('0x75')]);if(_0x30e939[_0xdf29('0x9e')]===-0x1){return _0x30e939;}return this['channel']['noop'](util[_0xdf29('0x27')]('Executed\x20command\x20%s\x20%s',_0x217c9a['application'],_0x217c9a[_0xdf29('0x75')]));};AGIVertices[_0xdf29('0xe')][_0xdf29('0xc1')]=function(_0x5e5c5d){logger['info'](util[_0xdf29('0x27')](_0xdf29('0xc2'),_0x5e5c5d[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0x5e5c5d[_0xdf29('0x5a')])){return this['channel'][_0xdf29('0xa4')](_0xdf29('0xa5'));}var _0x44aa50='\x22'+_0x5e5c5d[_0xdf29('0x5a')]+'\x22';if(this[_0xdf29('0x83')](_0x5e5c5d[_0xdf29('0x75')])){_0x44aa50+=','+_0x5e5c5d['options'];}var _0x32d925=this[_0xdf29('0xd')][_0xdf29('0xa6')]('MRCPSynth',_0x44aa50);if(_0x32d925[_0xdf29('0x9e')]===-0x1){return _0x32d925;}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0xa7'),_0x44aa50));};AGIVertices[_0xdf29('0xe')][_0xdf29('0xc3')]=function(_0x5aa72e){logger['info'](util[_0xdf29('0x27')](_0xdf29('0xc4'),_0x5aa72e[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0x5aa72e[_0xdf29('0x5a')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0xa5'));}var _0x2208bf='\x22'+_0x5aa72e[_0xdf29('0x5a')]+'\x22';if(this['isConfigured'](_0x5aa72e[_0xdf29('0x75')])){_0x2208bf+=','+_0x5aa72e['options'];}var _0xb4e605=this[_0xdf29('0xd')][_0xdf29('0xa6')]('MRCPSynth',_0x2208bf);if(_0xb4e605[_0xdf29('0x9e')]===-0x1){return _0xb4e605;}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util['format'](_0xdf29('0xa7'),_0x2208bf));};AGIVertices[_0xdf29('0xe')][_0xdf29('0xc5')]=function(_0x29b406){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x29b406['label']));if(!this['isConfigured'](_0x29b406[_0xdf29('0xab')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0xc6'));}var _0xa31bca=_0x29b406[_0xdf29('0xab')];if(this['isConfigured'](_0x29b406['options'])){_0xa31bca+=','+_0x29b406[_0xdf29('0x75')];}var _0x24335d=this[_0xdf29('0xd')][_0xdf29('0xa6')](_0xdf29('0xac'),_0xa31bca);if(_0x24335d[_0xdf29('0x9e')]===-0x1){return _0x24335d;}var _0x22f8f5=this[_0xdf29('0x9d')](_0xdf29('0xad'),'LUMENVOX_ASR_CONFIDENCE');if(_0x22f8f5[_0xdf29('0x9e')]===-0x1){return _0x22f8f5;}var _0x148f57=this[_0xdf29('0x9d')]('RECOG_INPUT()',_0xdf29('0xc7'));if(_0x148f57[_0xdf29('0x9e')]===-0x1){return _0x148f57;}var _0x55d448=this[_0xdf29('0x9d')](_0xdf29('0xb1'),_0xdf29('0xc8'));if(_0x55d448[_0xdf29('0x9e')]===-0x1){return _0x55d448;}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0xb3'),_0xa31bca));};AGIVertices['prototype']['sestekasr']=function(_0x5caccd){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0xc9'),_0x5caccd['label']));if(!this[_0xdf29('0x83')](_0x5caccd[_0xdf29('0xab')])){return this[_0xdf29('0xd')]['noop'](_0xdf29('0xc6'));}var _0xad6f41=_0x5caccd[_0xdf29('0xab')];if(this['isConfigured'](_0x5caccd[_0xdf29('0x75')])){_0xad6f41+=','+_0x5caccd[_0xdf29('0x75')];}var _0x42b24e=this[_0xdf29('0xd')]['exec']('MRCPRecog',_0xad6f41);if(_0x42b24e['result']===-0x1){return _0x42b24e;}var _0x5d1360=this['getAndSetVariable'](_0xdf29('0xad'),_0xdf29('0xca'));if(_0x5d1360[_0xdf29('0x9e')]===-0x1){return _0x5d1360;}var _0x20bdcd=this[_0xdf29('0x9d')]('RECOG_INPUT()',_0xdf29('0xcb'));if(_0x20bdcd[_0xdf29('0x9e')]===-0x1){return _0x20bdcd;}var _0x18cc85=this['getAndSetVariable'](_0xdf29('0xb1'),_0xdf29('0xcc'));if(_0x18cc85[_0xdf29('0x9e')]===-0x1){return _0x18cc85;}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0xad6f41));};AGIVertices[_0xdf29('0xe')][_0xdf29('0xcd')]=function(_0x38801e){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0xce'),_0x38801e['label']));if(!this[_0xdf29('0x83')](_0x38801e['odbc_id'])){return this['channel'][_0xdf29('0x2b')](_0x38801e,'no\x20database\x20selected');}var _0x2b3534=this['getSquareOdbc'][_0xdf29('0xa0')](this,_0x38801e[_0xdf29('0xcf')]);if(!_0x2b3534){return this['channel'][_0xdf29('0x2b')](_0x38801e,_0xdf29('0xd0'));}if(!this[_0xdf29('0x83')](_0x38801e[_0xdf29('0x2f')])){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x38801e,_0xdf29('0xd1'));}var _0x506218=_0x38801e['query'][_0xdf29('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xdf29('0xd')]['noop'](util[_0xdf29('0x27')]('query:\x20%s',_0x506218));var _0x5d17fb=this['getQueryOdbc'][_0xdf29('0xa0')](this,_0x2b3534,_0x506218);this[_0xdf29('0x37')]['sync'](this,_0x38801e,_0x506218);if(!this['isConfigured'](_0x38801e['variable_id'])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0xd2'));}var _0x5c0529=this[_0xdf29('0xf')][_0xdf29('0xa0')](this,_0x38801e[_0xdf29('0xd3')]);if(!_0x5c0529){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x38801e,'no\x20variable\x20found');}var _0x1b048c=this;_0x5d17fb['forEach'](function(_0x37e797,_0x13e409){Object[_0xdf29('0xd4')](_0x37e797)[_0xdf29('0xd5')](function(_0x5f55e6){_0x1b048c[_0xdf29('0xd')]['setVariable'](util[_0xdf29('0x27')](_0xdf29('0xd6'),_0x5c0529,_0x13e409,_0x5f55e6),_0x37e797[_0x5f55e6]);});});this['channel'][_0xdf29('0x9a')](util[_0xdf29('0x27')](_0xdf29('0xd7'),_0x5c0529),_0x5d17fb[_0xdf29('0x96')]);return this['channel']['noop'](util['format'](_0xdf29('0xd8'),_0x5c0529));};AGIVertices[_0xdf29('0xe')][_0xdf29('0xd9')]=function(_0x50006d){logger[_0xdf29('0xda')](util[_0xdf29('0x27')](_0xdf29('0xdb'),_0x50006d[_0xdf29('0xaa')]));if(!this['isConfigured'](_0x50006d[_0xdf29('0xdc')])){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x50006d,'no\x20user\x20selected');}var _0x150de5=this[_0xdf29('0x1a')][_0xdf29('0xa0')](this,_0x50006d[_0xdf29('0xdc')]);if(!_0x150de5){return this['channel'][_0xdf29('0x2b')](_0x50006d,_0xdf29('0xdd'));}var _0x40b6c2=this[_0xdf29('0xd')][_0xdf29('0xa6')](_0xdf29('0xde'),[util[_0xdf29('0x27')]('SIP/%s',_0x150de5),_0x50006d['timeout'],_0x50006d['opts'],_0x50006d[_0xdf29('0x6d')]]);if(_0x40b6c2[_0xdf29('0x9e')]===-0x1){return _0x40b6c2;}return this['channel'][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0xdf'),_0xdf29('0xde')));};AGIVertices[_0xdf29('0xe')][_0xdf29('0xe0')]=function(_0x2c89d8){logger['info'](util[_0xdf29('0x27')](_0xdf29('0xe1'),_0x2c89d8[_0xdf29('0xaa')]));if(!this['isConfigured'](_0x2c89d8['key'])){return this[_0xdf29('0xd')][_0xdf29('0xa4')]('no\x20key\x20configured');}if(!this[_0xdf29('0x83')](_0x2c89d8[_0xdf29('0x5a')])){return this[_0xdf29('0xd')]['noop'](_0xdf29('0xa5'));}this[_0xdf29('0xd')][_0xdf29('0xe2')]=!![];this[_0xdf29('0x37')](_0x2c89d8);this['createSquareMessage'](_0x2c89d8[_0xdf29('0x5a')],'in','','');this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0xe3'),_0x2c89d8[_0xdf29('0x5a')]));var _0x2e3a6c=this[_0xdf29('0x76')]['sync'](this,_0x2c89d8);if(_0x2e3a6c){for(var _0x1a2311 in _0x2e3a6c){if(_0x2e3a6c[_0xdf29('0x90')](_0x1a2311)){this['channel'][_0xdf29('0x9a')](util['format']('DIALOGFLOW_%s',_0x1a2311[_0xdf29('0x66')]()),_0x2e3a6c[_0x1a2311]);}}this[_0xdf29('0x40')](_0x2e3a6c[_0xdf29('0xe4')],_0xdf29('0xe5'),_0xdf29('0xe0'),'');return this['channel'][_0xdf29('0xa4')](util[_0xdf29('0x27')]('Dialogflow\x20Result\x20%s',_0x2e3a6c[_0xdf29('0xe4')]));}return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x2c89d8,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xdf29('0xe6')]=function(_0x5a00ce){logger['info'](util['format'](_0xdf29('0xe7'),_0x5a00ce['label']));if(!this[_0xdf29('0x83')](_0x5a00ce[_0xdf29('0x7a')])){return this['channel'][_0xdf29('0xa4')]('no\x20project_id\x20configured');}if(!this[_0xdf29('0x83')](_0x5a00ce[_0xdf29('0x7b')])){return this['channel']['noop'](_0xdf29('0xe8'));}if(!this[_0xdf29('0x83')](_0x5a00ce['private_key'])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0xe9'));}if(!this['isConfigured'](_0x5a00ce['dialogflowV2_language'])){return this[_0xdf29('0xd')][_0xdf29('0xa4')]('no\x20anguage\x20configured');}if(!this[_0xdf29('0x83')](_0x5a00ce['text'])){return this[_0xdf29('0xd')][_0xdf29('0xa4')]('no\x20text\x20configured');}this[_0xdf29('0xd')][_0xdf29('0xe2')]=!![];this[_0xdf29('0x37')](_0x5a00ce);this[_0xdf29('0x40')](_0x5a00ce[_0xdf29('0x5a')],'in','','');this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0xea'),_0x5a00ce[_0xdf29('0x5a')]));var _0x2e900b=this[_0xdf29('0x79')][_0xdf29('0xa0')](this,_0x5a00ce);if(_0x2e900b){for(var _0x242e77 in _0x2e900b){if(_0x2e900b[_0xdf29('0x90')](_0x242e77)){if(_0x242e77!=='providerResponse'){this[_0xdf29('0xd')]['setVariable'](util[_0xdf29('0x27')]('DIALOGFLOW_%s',_0x242e77[_0xdf29('0x66')]()),_0x2e900b[_0x242e77]);}}}this[_0xdf29('0x40')](_0x2e900b[_0xdf29('0xe4')],_0xdf29('0xe5'),_0xdf29('0xe6'),_0x2e900b[_0xdf29('0xeb')]);return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0xec'),_0x2e900b[_0xdf29('0xe4')]));}return this['channel'][_0xdf29('0x2b')](_0x5a00ce,_0xdf29('0xed'));};AGIVertices[_0xdf29('0xe')][_0xdf29('0xee')]=function(_0x484d58){logger[_0xdf29('0x2d')](util['format'](_0xdf29('0xef'),_0x484d58[_0xdf29('0xaa')]));if(!this['isConfigured'](_0x484d58[_0xdf29('0xf0')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0xf1'));}if(!this[_0xdf29('0x83')](_0x484d58[_0xdf29('0xf2')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0xf3'));}if(!this[_0xdf29('0x83')](_0x484d58[_0xdf29('0xf4')])){return this['channel'][_0xdf29('0xa4')](_0xdf29('0xf5'));}if(!this[_0xdf29('0x83')](_0x484d58[_0xdf29('0xf6')])){return this[_0xdf29('0xd')]['noop']('no\x20text\x20configured');}this[_0xdf29('0xd')]['bot']=!![];this[_0xdf29('0x37')](_0x484d58);this[_0xdf29('0x40')](_0x484d58['text'],'in','','');this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0xf7'),_0x484d58[_0xdf29('0x5a')]));var _0x272a51=this[_0xdf29('0x7d')][_0xdf29('0xa0')](this,_0x484d58);if(_0x272a51){for(var _0x23f056 in _0x272a51){if(_0x272a51[_0xdf29('0x90')](_0x23f056)){this[_0xdf29('0xd')][_0xdf29('0x9a')](util[_0xdf29('0x27')]('SESTEK_NDA_%s',_0x23f056[_0xdf29('0x66')]()),_0x272a51[_0x23f056]);}}this[_0xdf29('0x40')](_0x272a51[_0xdf29('0xe4')],_0xdf29('0xe5'),_0xdf29('0xee'),'');if(_0x272a51[_0xdf29('0xf8')]){this['channel']['noop'](util[_0xdf29('0x27')](_0xdf29('0xf9'),_0x272a51[_0xdf29('0xf8')]));var _0x3cdbcf=this[_0xdf29('0xd')]['streamFile'](_0x272a51['audiofile']);try{fs[_0xdf29('0xfa')](_0x272a51[_0xdf29('0xf8')]+'.wav');}catch(_0x48e03d){logger[_0xdf29('0x2b')](_0x48e03d);}return _0x3cdbcf;}else{return this[_0xdf29('0xd')]['noop'](util['format'](_0xdf29('0xfb'),_0x272a51[_0xdf29('0xe4')]));}}return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x484d58,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xdf29('0xe')][_0xdf29('0xfc')]=function(_0x3042ef){logger[_0xdf29('0x2d')](util['format'](_0xdf29('0xfd'),_0x3042ef[_0xdf29('0xaa')]));return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0xfc'));};AGIVertices[_0xdf29('0xe')]['ext_dial']=function(_0x5f361e){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0xfe'),_0x5f361e[_0xdf29('0xaa')]));var _0x525c99='';if(_0x5f361e[_0xdf29('0xff')]){if(!this[_0xdf29('0x83')](_0x5f361e[_0xdf29('0xff')])){return this['channel'][_0xdf29('0x2b')](_0x5f361e,'no\x20trunk\x20selected');}else{var _0x4e5af1=parseInt(_0x5f361e[_0xdf29('0xff')],0xa);if(isNaN(_0x4e5af1)){_0x525c99=_0x5f361e[_0xdf29('0xff')];}else{_0x525c99=this['getTrunk'][_0xdf29('0xa0')](this,_0x5f361e[_0xdf29('0xff')]);if(!_0x525c99){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x5f361e,_0xdf29('0x100'));}}}}else if(_0x5f361e[_0xdf29('0x101')]){_0x525c99=_0x5f361e['trunk_name'];}else{return this['channel']['error'](_0x5f361e,_0xdf29('0x102'));}var _0x494a0d=this['channel'][_0xdf29('0xa6')](_0xdf29('0xde'),[util['format']('SIP/%s/%s',_0x525c99,_0x5f361e[_0xdf29('0x46')]),_0x5f361e['timeout'],_0x5f361e['opts'],_0x5f361e['url']]);if(_0x494a0d[_0xdf29('0x9e')]===-0x1){return _0x494a0d;}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util['format'](_0xdf29('0xdf'),_0xdf29('0xde')));};AGIVertices[_0xdf29('0xe')][_0xdf29('0x103')]=function(_0x11730b){logger[_0xdf29('0x2d')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x11730b[_0xdf29('0xaa')]));return this['channel']['noop'](_0xdf29('0x103'));};AGIVertices['prototype'][_0xdf29('0xc')]=function(_0x525148){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x104'),_0x525148[_0xdf29('0xaa')]));if(_0x525148['retry']===0x0){return this[_0xdf29('0x9f')](_0x525148);}_0x525148[_0xdf29('0xa1')]-=0x1;if(!this['isConfigured'](_0x525148[_0xdf29('0x105')])){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x525148,_0xdf29('0x106'));}var _0x4796a2=this[_0xdf29('0x1c')][_0xdf29('0xa0')](this,_0x525148[_0xdf29('0x105')]);if(!_0x4796a2){return this[_0xdf29('0xd')]['error'](_0x525148,_0xdf29('0x107'));}if(!this[_0xdf29('0x83')](_0x525148[_0xdf29('0xd3')])){return this['channel'][_0xdf29('0x2b')](_0xdf29('0xd2'));}var _0x38718e=this[_0xdf29('0xd')][_0xdf29('0x108')](_0x4796a2,_0x525148[_0xdf29('0x109')],_0x525148['maxdigit']);var _0x18a5a7=_0x38718e[_0xdf29('0x9e')]?_0x38718e[_0xdf29('0x9e')][_0xdf29('0x4b')]():'';logger[_0xdf29('0x2d')](_0xdf29('0x10a'),JSON[_0xdf29('0x6e')](_0x38718e));if(_0x38718e['result']===-0x1){this[_0xdf29('0x37')][_0xdf29('0xa0')](this,_0x525148,_0x18a5a7);return _0x38718e;}else if(_0x38718e[_0xdf29('0x9c')]===_0xdf29('0x63')){_0x38718e['result']=_0x18a5a7[_0xdf29('0x96')]>=parseInt(_0x525148['mindigit'])?'x':'i';}else{_0x38718e['result']=_0x18a5a7[_0xdf29('0x96')]>=parseInt(_0x525148[_0xdf29('0x10b')])&&_0x18a5a7[_0xdf29('0x96')]<=parseInt(_0x525148[_0xdf29('0x10c')])?'x':'i';}var _0x26203f=this[_0xdf29('0xf')][_0xdf29('0xa0')](this,_0x525148[_0xdf29('0xd3')]);if(!_0x26203f){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x525148,_0xdf29('0x10d'));}this['channel'][_0xdf29('0x9a')](_0x26203f,_0x18a5a7);if(this[_0xdf29('0x83')](_0x525148['hiddendigitsnum'])){var _0x5d398f=parseInt(_0x525148[_0xdf29('0x10e')],0xa);var _0x2c6fc1=rs[_0xdf29('0x10f')]({'charset':'*','length':_0x5d398f});var _0x327ca8=_0x18a5a7[_0xdf29('0x96')];if(_0x327ca8>0x0){if(_0x327ca8>_0x5d398f){this[_0xdf29('0x37')][_0xdf29('0xa0')](this,_0x525148,_0x525148[_0xdf29('0x110')]==='first'?_0x2c6fc1+_0x18a5a7[_0xdf29('0x111')](_0x5d398f):_0x18a5a7['substr'](0x0,_0x327ca8-_0x5d398f)+_0x2c6fc1);}else{this[_0xdf29('0x37')][_0xdf29('0xa0')](this,_0x525148,rs[_0xdf29('0x10f')]({'charset':'*','length':_0x327ca8}));}}else{this['createSquareDetailsReport'][_0xdf29('0xa0')](this,_0x525148,'');}}else{this[_0xdf29('0x37')][_0xdf29('0xa0')](this,_0x525148,_0x18a5a7);}return _0x38718e;};AGIVertices['prototype'][_0xdf29('0x112')]=function(_0x31c1ad){logger['info'](util['format'](_0xdf29('0x113'),_0x31c1ad[_0xdf29('0xaa')]));return this['getdigits'](_0x31c1ad);};AGIVertices[_0xdf29('0xe')]['goal']=function(_0x1977b1){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x114'),_0x1977b1[_0xdf29('0xaa')]));this['createSquareDetailsReport'][_0xdf29('0xa0')](this,_0x1977b1,_0x1977b1[_0xdf29('0x115')]);return this[_0xdf29('0xd')]['noop'](util[_0xdf29('0x27')](_0xdf29('0x116'),_0x1977b1['goalname']));};AGIVertices['prototype'][_0xdf29('0x117')]=function(_0x465f48){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x465f48[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0x465f48['aws_access_key_id'])||!this[_0xdf29('0x83')](_0x465f48[_0xdf29('0x87')])){return this[_0xdf29('0xd')]['noop'](_0xdf29('0x118'));}if(!this[_0xdf29('0x83')](_0x465f48['text'])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0xa5'));}this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x119'),_0x465f48[_0xdf29('0x5a')]));var _0x3ff611=this[_0xdf29('0x85')][_0xdf29('0xa0')](this,_0x465f48);if(_0x3ff611){this[_0xdf29('0xd')][_0xdf29('0xa4')](util['format'](_0xdf29('0x11a'),_0x3ff611));var _0xe399e7=this[_0xdf29('0xd')][_0xdf29('0x11b')](_0x3ff611);try{fs['unlink'](_0x3ff611+_0xdf29('0x11c'));}catch(_0x1f4798){logger[_0xdf29('0x2b')](_0x1f4798);}return _0xe399e7;}return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x465f48,_0xdf29('0x11d'));};AGIVertices[_0xdf29('0xe')][_0xdf29('0x11e')]=function(_0xbddcea){logger[_0xdf29('0x2d')](util['format'](_0xdf29('0x11f'),_0xbddcea[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0xbddcea['aws_access_key_id'])||!this[_0xdf29('0x83')](_0xbddcea[_0xdf29('0x87')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0x118'));}if(!this[_0xdf29('0x83')](_0xbddcea[_0xdf29('0x120')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0x121'));}if(!this[_0xdf29('0x83')](_0xbddcea['text'])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0xa5'));}this[_0xdf29('0xd')][_0xdf29('0xe2')]=!![];this[_0xdf29('0x37')](_0xbddcea);this['createSquareMessage'](_0xbddcea[_0xdf29('0x5a')],'in','','');this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x122'),_0xbddcea[_0xdf29('0x5a')]));var _0x1c5c54=this['awsLex']['sync'](this,_0xbddcea);if(_0x1c5c54){for(var _0x1b872a in _0x1c5c54){if(_0x1c5c54[_0xdf29('0x90')](_0x1b872a)&&_['isString'](_0x1c5c54[_0x1b872a])){this['channel'][_0xdf29('0x9a')](util[_0xdf29('0x27')](_0xdf29('0x123'),_0x1b872a[_0xdf29('0x66')]()),_0x1c5c54[_0x1b872a]);}}if(_[_0xdf29('0x42')](_0x1c5c54[_0xdf29('0x74')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0x124'));}else{this[_0xdf29('0x40')](_0x1c5c54[_0xdf29('0x74')],_0xdf29('0xe5'),'amazonlex','');return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x125'),_0x1c5c54[_0xdf29('0x74')]));}}return this['channel']['error'](_0xbddcea,_0xdf29('0x126'));};AGIVertices[_0xdf29('0xe')][_0xdf29('0x127')]=function(_0x2a5847){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x128'),_0x2a5847['label'],_0x2a5847[_0xdf29('0x63')]));if(!this[_0xdf29('0x83')](_0x2a5847[_0xdf29('0x77')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0x129'));}var _0x3728b7=_0xdf29('0x12a');var _0x94b5c3=util[_0xdf29('0x27')](_0xdf29('0x12b'),FILES_PATH,rs[_0xdf29('0x10f')](0x4));var _0x279ec3=util[_0xdf29('0x27')](_0xdf29('0x98'),_0x94b5c3,_0x3728b7);var _0x1a5517=!![];if(_0x2a5847[_0xdf29('0x12c')]==='NOBEEP'){_0x1a5517=![];}var _0x1b9fe4=this[_0xdf29('0xd')][_0xdf29('0x12d')](_0x94b5c3,_0x3728b7,_0x2a5847[_0xdf29('0x12e')],_0x2a5847['timeout'],undefined,_0x1a5517);if(_0x1b9fe4[_0xdf29('0x9e')]!==-0x1){this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x12f'),_0x279ec3));var _0x362862=this['googleASR'][_0xdf29('0xa0')](this,_0x2a5847,_0x279ec3);if(_0x362862){for(var _0xcc0eb8 in _0x362862){if(_0x362862[_0xdf29('0x90')](_0xcc0eb8)){this[_0xdf29('0xd')]['setVariable'](util['format'](_0xdf29('0x130'),_0xcc0eb8[_0xdf29('0x66')]()),_0x362862[_0xcc0eb8]);}}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x131'),JSON[_0xdf29('0x6e')](_0x362862)));}}return _0x1b9fe4;};AGIVertices[_0xdf29('0xe')][_0xdf29('0x132')]=function(_0xcd67b6){logger['info'](util[_0xdf29('0x27')](_0xdf29('0x133'),_0xcd67b6[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0xcd67b6['appid'])){return this[_0xdf29('0xd')]['noop'](_0xdf29('0x134'));}if(!this[_0xdf29('0x83')](_0xcd67b6['appsecret'])){return this['channel']['noop'](_0xdf29('0x135'));}var _0x45dc54=_0xdf29('0x12a');var _0x22ec48=util['format'](_0xdf29('0x12b'),FILES_PATH,rs[_0xdf29('0x10f')](0x4));var _0x38f6a3=util[_0xdf29('0x27')](_0xdf29('0x98'),_0x22ec48,_0x45dc54);var _0x560488=!![];if(_0xcd67b6[_0xdf29('0x12c')]===_0xdf29('0x136')){_0x560488=![];}var _0x4a0972=this[_0xdf29('0xd')][_0xdf29('0x12d')](_0x22ec48,_0x45dc54,_0xcd67b6[_0xdf29('0x12e')],_0xcd67b6[_0xdf29('0x63')],undefined,_0x560488);if(_0x4a0972['result']!==-0x1){this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')]('tilde\x20%s\x20file\x20created',_0x38f6a3));var _0x4d734e=this[_0xdf29('0x8c')][_0xdf29('0xa0')](this,_0xcd67b6,_0x38f6a3);if(_0x4d734e){for(var _0x5ad7b8 in _0x4d734e){if(_0x4d734e['hasOwnProperty'](_0x5ad7b8)){this[_0xdf29('0xd')][_0xdf29('0x9a')](util[_0xdf29('0x27')]('TILDE_ASR_%s',_0x5ad7b8[_0xdf29('0x66')]()),_0x4d734e[_0x5ad7b8]);}}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x137'),JSON[_0xdf29('0x6e')](_0x4d734e)));}}return _0x4a0972;};AGIVertices[_0xdf29('0xe')][_0xdf29('0x138')]=function(_0x43b638){logger[_0xdf29('0x2d')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x43b638[_0xdf29('0xaa')]));return this[_0xdf29('0xd')][_0xdf29('0x139')](_0x43b638[_0xdf29('0x13a')],_0x43b638[_0xdf29('0x3d')],_0x43b638[_0xdf29('0x13b')]);};AGIVertices[_0xdf29('0xe')]['gotoif']=function(_0x298a7d){logger['info'](util[_0xdf29('0x27')](_0xdf29('0x13c'),_0x298a7d[_0xdf29('0xaa')]));if(!this['isConfigured'](_0x298a7d[_0xdf29('0x13d')])){return this['channel'][_0xdf29('0x2b')](_0x298a7d,'no\x20condition\x20configured');}try{var _0x546d1c=eval(_0x298a7d[_0xdf29('0x13d')])?_0xdf29('0x13e'):_0xdf29('0x13f');this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')]('EVAL\x20CONDITION\x20%s\x20%s',_0x298a7d['condition'],_0x546d1c));return{'code':0xc8,'result':_0x546d1c};}catch(_0x565526){return{'code':0xc8,'result':_0xdf29('0x13f')};}};AGIVertices[_0xdf29('0xe')][_0xdf29('0x140')]=function(_0x7e825e){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x141'),_0x7e825e[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0x7e825e['interval_id'])){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x7e825e,_0xdf29('0x142'));}var _0x20da78=this[_0xdf29('0x22')][_0xdf29('0xa0')](this,_0x7e825e[_0xdf29('0x143')]);if(!_0x20da78){return this[_0xdf29('0xd')]['error'](_0x7e825e,_0xdf29('0x144'));}for(var _0x45c54b=0x0;_0x45c54b<_0x20da78[_0xdf29('0x96')];_0x45c54b+=0x1){var _0xf5f9dd=this[_0xdf29('0xd')][_0xdf29('0xf')](util[_0xdf29('0x27')](_0xdf29('0x145'),_0x20da78[_0x45c54b]));if(_0xf5f9dd['result']===-0x1){return _0xf5f9dd;}logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x146'),_0x20da78[_0x45c54b],_0xf5f9dd['extra']));if(_0xf5f9dd['extra']===_0xdf29('0x13e')){logger['info'](util[_0xdf29('0x27')]('IFTIME\x20%s\x20%s',_0x20da78[_0x45c54b],_0xdf29('0x13e')));this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')]('IFTIME\x20%s\x20%s',_0x20da78[_0x45c54b],_0xdf29('0x13e')));return{'code':0xc8,'result':_0xdf29('0x13e')};}else{logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x146'),_0x20da78[_0x45c54b],_0xdf29('0x13f')));this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x146'),_0x20da78[_0x45c54b],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xdf29('0xe')][_0xdf29('0x147')]=function(_0x3d5ce0){logger['info'](util[_0xdf29('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3d5ce0['label']));return this[_0xdf29('0xd')][_0xdf29('0x147')]();};AGIVertices[_0xdf29('0xe')][_0xdf29('0x148')]=function(_0x27511a){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x149'),_0x27511a[_0xdf29('0xaa')]));if(!this['isConfigured'](_0x27511a['key'])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0x129'));}var _0x70143=_0xdf29('0x12a');var _0x246aec=util[_0xdf29('0x27')](_0xdf29('0x12b'),FILES_PATH,rs[_0xdf29('0x10f')](0x4));var _0x552a09=util[_0xdf29('0x27')](_0xdf29('0x98'),_0x246aec,_0x70143);var _0x882cfb=!![];if(_0x27511a[_0xdf29('0x12c')]===_0xdf29('0x136')){_0x882cfb=![];}var _0x311618=this[_0xdf29('0xd')]['recordFile'](_0x246aec,_0x70143,_0x27511a[_0xdf29('0x12e')],_0x27511a[_0xdf29('0x63')],undefined,_0x882cfb);if(_0x311618[_0xdf29('0x9e')]!==-0x1){this[_0xdf29('0xd')]['noop'](util[_0xdf29('0x27')]('ispeech\x20%s\x20file\x20created',_0x552a09));var _0x204236=this[_0xdf29('0x81')][_0xdf29('0xa0')](this,_0x27511a,_0x552a09);if(_0x204236){for(var _0x2018dd in _0x204236){if(_0x204236[_0xdf29('0x90')](_0x2018dd)){this[_0xdf29('0xd')]['setVariable'](util[_0xdf29('0x27')](_0xdf29('0x14a'),_0x2018dd[_0xdf29('0x66')]()),_0x204236[_0x2018dd]);}}return this[_0xdf29('0xd')]['noop'](util[_0xdf29('0x27')]('IspeechASR\x20Result\x20%s',JSON[_0xdf29('0x6e')](_0x204236)));}}return _0x311618;};AGIVertices[_0xdf29('0xe')]['ispeechtts']=function(_0x534e1e){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x14b'),_0x534e1e['label']));if(!this[_0xdf29('0x83')](_0x534e1e[_0xdf29('0x77')])){return this['channel'][_0xdf29('0xa4')](_0xdf29('0x129'));}if(!this[_0xdf29('0x83')](_0x534e1e[_0xdf29('0x5a')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')]('no\x20text\x20configured');}this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x14c'),_0x534e1e[_0xdf29('0x5a')]));var _0x496321=this[_0xdf29('0x7e')][_0xdf29('0xa0')](this,_0x534e1e);if(_0x496321){this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')]('ispeech\x20%s\x20file\x20created',_0x496321));var _0x4c8961=this[_0xdf29('0xd')][_0xdf29('0x11b')](_0x496321,_0x534e1e[_0xdf29('0x12e')]);try{fs[_0xdf29('0xfa')](_0x496321+_0xdf29('0x11c'));}catch(_0x540838){logger[_0xdf29('0x2b')](_0x540838);}return _0x4c8961;}return this[_0xdf29('0xd')]['error'](_0x534e1e,_0xdf29('0x14d'));};AGIVertices[_0xdf29('0xe')][_0xdf29('0x14e')]=function(_0x34ee1b){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x14f'),_0x34ee1b[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0x34ee1b[_0xdf29('0x150')])){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x34ee1b,_0xdf29('0x151'));}logger[_0xdf29('0x2d')](util[_0xdf29('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xdf29('0x3a')],_0x34ee1b[_0xdf29('0x150')]));var _0x59962f=this[_0xdf29('0x53')][_0xdf29('0xa0')](this,_0x34ee1b[_0xdf29('0x150')]);if(_0x59962f){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x152'),this['channel'][_0xdf29('0x3a')],_0x34ee1b['findBy']));this[_0xdf29('0xd')][_0xdf29('0xa4')](util['format'](_0xdf29('0x152'),this[_0xdf29('0xd')][_0xdf29('0x3a')],_0x34ee1b['findBy']));return{'code':0xc8,'result':_0xdf29('0x153')};}else{logger['info'](util['format'](_0xdf29('0x154'),this[_0xdf29('0xd')][_0xdf29('0x3a')],_0x34ee1b[_0xdf29('0x150')]));this['channel'][_0xdf29('0xa4')](util[_0xdf29('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xdf29('0xd')][_0xdf29('0x3a')],_0x34ee1b[_0xdf29('0x150')]));return{'code':0xc8,'result':_0xdf29('0x155')};}};AGIVertices[_0xdf29('0xe')][_0xdf29('0x156')]=function(_0x4be024){logger['info'](util[_0xdf29('0x27')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x4be024[_0xdf29('0xaa')]));if(!this['isConfigured'](_0x4be024['findBy'])){return this['channel'][_0xdf29('0x2b')](_0x4be024,_0xdf29('0x151'));}logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x157'),this[_0xdf29('0xd')][_0xdf29('0x3a')],_0x4be024[_0xdf29('0x150')]));var _0x4dd885=this[_0xdf29('0x52')][_0xdf29('0xa0')](this,_0x4be024[_0xdf29('0x150')]);if(_0x4dd885){logger['info'](util[_0xdf29('0x27')](_0xdf29('0x152'),this[_0xdf29('0xd')][_0xdf29('0x3a')],_0x4be024[_0xdf29('0x150')]));this[_0xdf29('0xd')]['noop'](util[_0xdf29('0x27')](_0xdf29('0x152'),this['channel'][_0xdf29('0x3a')],_0x4be024[_0xdf29('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0xdf29('0x2d')](util['format'](_0xdf29('0x154'),this[_0xdf29('0xd')][_0xdf29('0x3a')],_0x4be024[_0xdf29('0x150')]));this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x154'),this[_0xdf29('0xd')][_0xdf29('0x3a')],_0x4be024['findBy']));return{'code':0xc8,'result':_0xdf29('0x155')};}};AGIVertices[_0xdf29('0xe')][_0xdf29('0x158')]=function(_0x2b078a){logger['info'](util[_0xdf29('0x27')](_0xdf29('0x159'),_0x2b078a['label']));if(!this[_0xdf29('0x83')](_0x2b078a[_0xdf29('0x15a')])){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x2b078a,_0xdf29('0x15b'));}this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')]('math\x20%s',_0x2b078a['operation']));var _0xf96d19=eval(_0x2b078a[_0xdf29('0x15a')]);if(!this[_0xdf29('0x83')](_0x2b078a[_0xdf29('0xd3')])){return this[_0xdf29('0xd')]['noop'](_0xdf29('0xd2'));}var _0x21707d=this[_0xdf29('0xf')][_0xdf29('0xa0')](this,_0x2b078a[_0xdf29('0xd3')]);if(!_0x21707d){return this['channel'][_0xdf29('0x2b')](_0x2b078a,_0xdf29('0x10d'));}if(_[_0xdf29('0x99')](_0xf96d19)){var _0x363fbc=this;_0xf96d19[_0xdf29('0xd5')](function(_0x7e5061,_0x2ee8dc){_0x363fbc['channel'][_0xdf29('0x9a')](util[_0xdf29('0x27')](_0xdf29('0x15c'),_0x21707d,_0x2ee8dc),_0x7e5061);});return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x15d'),_0x21707d));}else{return this[_0xdf29('0xd')][_0xdf29('0x9a')](_0x21707d,_0xf96d19);}};AGIVertices[_0xdf29('0xe')]['menu']=function(_0x4ec52d){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x4ec52d[_0xdf29('0xaa')]));if(_0x4ec52d['retry']===0x0){return this[_0xdf29('0x9f')](_0x4ec52d);}_0x4ec52d[_0xdf29('0xa1')]-=0x1;if(!this[_0xdf29('0x83')](_0x4ec52d[_0xdf29('0x105')])){return this[_0xdf29('0xd')]['error'](_0x4ec52d,_0xdf29('0x106'));}var _0x551b49=this[_0xdf29('0x1c')][_0xdf29('0xa0')](this,_0x4ec52d[_0xdf29('0x105')]);if(!_0x551b49){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x4ec52d,'no\x20file\x20audio\x20found');}var _0x1247b3=this['channel'][_0xdf29('0x108')](_0x551b49,_0x4ec52d['response'],_0x4ec52d[_0xdf29('0x15e')]);var _0xe8258b=_0x1247b3[_0xdf29('0x9e')];if(_0x1247b3[_0xdf29('0x9e')]===-0x1){this[_0xdf29('0x37')][_0xdf29('0xa0')](this,_0x4ec52d,'-1');return _0x1247b3;}else if(_0x1247b3[_0xdf29('0x9c')]===_0xdf29('0x63')){_0x1247b3[_0xdf29('0x9e')]=_0x1247b3[_0xdf29('0x9e')][_0xdf29('0x96')]>0x0?_0x1247b3['result']:'t';}else if(_[_0xdf29('0x44')](_0x1247b3[_0xdf29('0x9e')])){_0x1247b3[_0xdf29('0x9e')]='#';_0xe8258b='#';}if(!this[_0xdf29('0x83')](_0x4ec52d[_0xdf29('0xd3')])){this['channel'][_0xdf29('0xa4')](_0xdf29('0xd2'));}else{var _0x40b15d=this[_0xdf29('0xf')][_0xdf29('0xa0')](this,_0x4ec52d[_0xdf29('0xd3')]);if(!_0x40b15d){return this[_0xdf29('0xd')]['error'](_0x4ec52d,_0xdf29('0x10d'));}this[_0xdf29('0xd')][_0xdf29('0x9a')](_0x40b15d,_0xe8258b);}this[_0xdf29('0x37')][_0xdf29('0xa0')](this,_0x4ec52d,_0xe8258b);return _0x1247b3;};AGIVertices[_0xdf29('0xe')][_0xdf29('0xa4')]=function(_0x5c8dc8){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x15f'),_0x5c8dc8[_0xdf29('0xaa')]));return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0x5c8dc8[_0xdf29('0x160')]||_0x5c8dc8['label']);};AGIVertices[_0xdf29('0xe')]['pause']=function(_0x2acac3){logger['info'](util[_0xdf29('0x27')](_0xdf29('0x161'),_0x2acac3[_0xdf29('0xaa')]));if(!this['isConfigured'](_0x2acac3['findBy'])){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x2acac3,_0xdf29('0x151'));}logger['info'](util[_0xdf29('0x27')](_0xdf29('0x157'),this[_0xdf29('0xd')][_0xdf29('0x3a')],_0x2acac3['findBy']));var _0x1f5fb6=this[_0xdf29('0x4d')][_0xdf29('0xa0')](this,_0x2acac3[_0xdf29('0x162')]);var _0x563e1a=this[_0xdf29('0x4f')][_0xdf29('0xa0')](this,_0x2acac3['findBy'],_0x1f5fb6);if(_0x563e1a){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x152'),this['channel'][_0xdf29('0x3a')],_0x2acac3['findBy']));this['channel'][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x152'),this['channel'][_0xdf29('0x3a')],_0x2acac3[_0xdf29('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x154'),this[_0xdf29('0xd')][_0xdf29('0x3a')],_0x2acac3[_0xdf29('0x150')]));this['channel']['noop'](util['format'](_0xdf29('0x152'),this[_0xdf29('0xd')][_0xdf29('0x3a')],_0x2acac3['findBy']));return{'code':0xc8,'result':_0xdf29('0x155')};}};AGIVertices[_0xdf29('0xe')][_0xdf29('0x163')]=function(_0x2a182c){logger['info'](util[_0xdf29('0x27')](_0xdf29('0x164'),_0x2a182c[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0x2a182c['file_id'])){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x2a182c,_0xdf29('0x106'));}var _0x30bb37=this[_0xdf29('0x1c')]['sync'](this,_0x2a182c[_0xdf29('0x105')]);if(!_0x30bb37){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x2a182c,_0xdf29('0x107'));}var _0x245c60=this[_0xdf29('0xd')][_0xdf29('0xa6')](_0xdf29('0x165'),[_0x30bb37,_0x2a182c[_0xdf29('0x166')]]);if(_0x245c60[_0xdf29('0x9e')]===-0x1){return _0x245c60;}return this['channel']['noop'](util[_0xdf29('0x27')](_0xdf29('0x167'),_0xdf29('0x165'),_0x30bb37));};AGIVertices[_0xdf29('0xe')][_0xdf29('0x168')]=function(_0x16b8e8){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x16b8e8[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0x16b8e8[_0xdf29('0x169')])){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x16b8e8,_0xdf29('0x16a'));}var _0x11aedc='';var _0xecb460=parseInt(_0x16b8e8['queue_id'],0xa);if(isNaN(_0xecb460)){_0x11aedc=_0x16b8e8[_0xdf29('0x169')];}else{_0x11aedc=this[_0xdf29('0x14')]['sync'](this,_0x16b8e8[_0xdf29('0x169')]);if(!_0x11aedc){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x16b8e8,_0xdf29('0x16b'));}}var _0x23b7e3='';if(this[_0xdf29('0x83')](_0x16b8e8[_0xdf29('0x105')])){var _0x1fef7c=this[_0xdf29('0x1c')][_0xdf29('0xa0')](this,_0x16b8e8['file_id']);if(_0x1fef7c){_0x23b7e3=_0x1fef7c;}}this[_0xdf29('0x37')][_0xdf29('0xa0')](this,_0x16b8e8,_0x11aedc);if(_0x16b8e8['opts'][_0xdf29('0x16c')]('x')<0x0){_0x16b8e8[_0xdf29('0x166')]+='x';}if(_0x16b8e8['opts'][_0xdf29('0x16c')]('X')<0x0){_0x16b8e8[_0xdf29('0x166')]+='X';}this['channel'][_0xdf29('0x9a')]('XMCS-QUEUE',_0x11aedc?_0x11aedc[_0xdf29('0x16d')]():'');var _0x42876a=this[_0xdf29('0xd')][_0xdf29('0xa6')](_0xdf29('0x16e'),[_0x11aedc,_0x16b8e8[_0xdf29('0x166')],_0x16b8e8['url'],_0x23b7e3,_0x16b8e8['timeout'],_0x16b8e8[_0xdf29('0x16f')],_0x16b8e8['macro'],_0x16b8e8[_0xdf29('0x170')],'',_0x16b8e8[_0xdf29('0x171')]]);if(_0x42876a[_0xdf29('0x9e')]===-0x1){return _0x42876a;}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x167'),_0xdf29('0x16e'),_0x11aedc));};AGIVertices[_0xdf29('0xe')][_0xdf29('0x172')]=function(_0x39c33c){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x173'),_0x39c33c[_0xdf29('0xaa')]));var _0x4ded13=_0x39c33c[_0xdf29('0x174')]||_0xdf29('0x12a');var _0x771d18=util['format'](_0xdf29('0x175'),this[_0xdf29('0xd')][_0xdf29('0x38')],rs[_0xdf29('0x10f')](0x5));var _0x282de3=util['format'](_0xdf29('0x176'),FILES_PATH,_0x771d18,_0x4ded13);var _0x4f711=util[_0xdf29('0x27')]('%s/recordings/%s',FILES_PATH,_0x771d18);this[_0xdf29('0x3b')][_0xdf29('0xa0')](this,_0x39c33c,_0x771d18,_0x282de3);this[_0xdf29('0xd')][_0xdf29('0x9a')]('RECORDING_SAVENAME',_0x771d18);logger[_0xdf29('0x2d')](_0xdf29('0x177'),_0x4f711,_0x4ded13,_0x39c33c[_0xdf29('0x178')],_0x39c33c['timeout']);return this[_0xdf29('0xd')]['recordFile'](_0x4f711,_0x4ded13,_0x39c33c['escape_digits'],_0x39c33c[_0xdf29('0x63')],undefined,!![]);};AGIVertices[_0xdf29('0xe')][_0xdf29('0x179')]=function(_0x46ac28){logger[_0xdf29('0x2d')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x46ac28[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0x46ac28['url'])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0x17a'));}var _0x19013c=this[_0xdf29('0x60')][_0xdf29('0xa0')](this,_0x46ac28);logger['info'](util['format'](_0xdf29('0x17b'),util['inspect'](_0x19013c,{'showHidden':![],'depth':null})));if(!this[_0xdf29('0x83')](_0x46ac28[_0xdf29('0xd3')])){return this[_0xdf29('0xd')]['noop'](_0xdf29('0x17c'));}var _0x34fa98=this['getVariable'][_0xdf29('0xa0')](this,_0x46ac28['variable_id']);if(!_0x34fa98){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x46ac28,'no\x20variable\x20found');}this[_0xdf29('0xd')][_0xdf29('0x9a')](util[_0xdf29('0x27')](_0xdf29('0x17d'),_0x34fa98),_0x19013c[_0xdf29('0x72')]?_0x19013c[_0xdf29('0x72')]:'200');this[_0xdf29('0xd')][_0xdf29('0x9a')](util[_0xdf29('0x27')](_0xdf29('0x17e'),_0x34fa98),_0x19013c[_0xdf29('0x73')]?_0x19013c[_0xdf29('0x73')]:'OK');if(_0x19013c[_0xdf29('0x70')]){try{this[_0xdf29('0x97')](_0x19013c['body'],_0x34fa98);}catch(_0x1d9f33){logger[_0xdf29('0x2b')](util[_0xdf29('0x27')](_0xdf29('0x17f'),_0x34fa98));}}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')]('variable\x20%s\x20set',_0x34fa98));};AGIVertices[_0xdf29('0xe')][_0xdf29('0x180')]=function(_0x521108){logger[_0xdf29('0x2d')](util['format'](_0xdf29('0x181'),_0x521108[_0xdf29('0xaa')]));return this[_0xdf29('0xd')][_0xdf29('0x182')](_0x521108[_0xdf29('0x183')]['replace'](/\s+/g,''),_0x521108[_0xdf29('0x178')]);};AGIVertices[_0xdf29('0xe')]['saynumber']=function(_0x390280){logger['info'](util[_0xdf29('0x27')](_0xdf29('0x184'),_0x390280['label']));return this[_0xdf29('0xd')]['sayNumber'](_0x390280[_0xdf29('0x62')][_0xdf29('0x57')](/\s+/g,''),_0x390280[_0xdf29('0x178')]);};AGIVertices[_0xdf29('0xe')][_0xdf29('0x185')]=function(_0x4138c8){logger[_0xdf29('0x2d')](util['format'](_0xdf29('0x186'),_0x4138c8[_0xdf29('0xaa')]));return this[_0xdf29('0xd')][_0xdf29('0x187')](_0x4138c8[_0xdf29('0x5a')],_0x4138c8['escape_digits']);};AGIVertices['prototype'][_0xdf29('0x188')]=function(_0x5c7dce){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x189'),_0x5c7dce[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0x5c7dce[_0xdf29('0x18a')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')]('no\x20mail\x20account\x20configured');}var _0x4a58b3=this[_0xdf29('0x18b')][_0xdf29('0xa0')](this,_0x5c7dce[_0xdf29('0x18a')]);if(!_0x4a58b3||!_0x4a58b3[_0xdf29('0x18c')]){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x5c7dce,_0xdf29('0x18d'));}var _0x5f2b68={'from':util[_0xdf29('0x27')](_0xdf29('0x18e'),_0x4a58b3[_0xdf29('0x16')],_0x4a58b3[_0xdf29('0x18f')]||_0x4a58b3[_0xdf29('0x18c')][_0xdf29('0x190')]),'to':_0x5c7dce['to']||'','cc':_0x5c7dce['cc']||'','bcc':_0x5c7dce[_0xdf29('0x191')]||'','subject':_0x5c7dce['subject'],'html':_0x5c7dce[_0xdf29('0x5a')],'text':_0x5c7dce[_0xdf29('0x5a')]};var _0x38d768={'tls':{'rejectUnauthorized':![]}};if(_0x4a58b3[_0xdf29('0x18c')][_0xdf29('0x192')]){_0x38d768[_0xdf29('0x192')]=_0x4a58b3[_0xdf29('0x18c')]['service'];}else{_0x38d768[_0xdf29('0x193')]=_0x4a58b3[_0xdf29('0x18c')][_0xdf29('0x193')];_0x38d768['port']=_0x4a58b3[_0xdf29('0x18c')][_0xdf29('0x194')];_0x38d768[_0xdf29('0x195')]=_0x4a58b3['Smtp'][_0xdf29('0x195')];}if(_0x4a58b3[_0xdf29('0x18c')]['authentication']){_0x38d768[_0xdf29('0x196')]={'user':_0x4a58b3[_0xdf29('0x18c')][_0xdf29('0x190')],'pass':_0x4a58b3['Smtp']['pass']};}if(this[_0xdf29('0x83')](_0x5c7dce['template_id'])){}logger[_0xdf29('0xda')]('sendMail\x20message',JSON[_0xdf29('0x6e')](_0x5f2b68));this[_0xdf29('0x37')][_0xdf29('0xa0')](this,_0x5c7dce,_0x5c7dce['account_id']);this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x4a58b3['name']));this['sendMailMessage'][_0xdf29('0xa0')](this,_0x38d768,_0x5f2b68);return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0x197'));};AGIVertices[_0xdf29('0xe')]['sendFax']=function(_0x342b0a){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x198'),_0x342b0a[_0xdf29('0xaa')]));return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0x199'));};AGIVertices['prototype'][_0xdf29('0x19a')]=function(_0x1608ef){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x1608ef[_0xdf29('0xaa')]));if(!this['isConfigured'](_0x1608ef[_0xdf29('0x19b')])){return this[_0xdf29('0xd')]['noop'](_0xdf29('0x19c'));}var _0x5ba89a=this[_0xdf29('0x34')][_0xdf29('0xa0')](this,_0x1608ef['sms_account_id']);if(!_0x5ba89a){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x1608ef,_0xdf29('0x19d'));}var _0x1dc547={'body':_0x1608ef['sms_text'],'phone':_0x1608ef['to']||'','SmsAccountId':_0x5ba89a['id']};logger['debug'](_0xdf29('0x19e'),JSON[_0xdf29('0x6e')](_0x1dc547));this['createSquareDetailsReport'][_0xdf29('0xa0')](this,_0x1608ef,_0x1608ef[_0xdf29('0x19b')]);this['channel']['noop'](util[_0xdf29('0x27')](_0xdf29('0x19f'),_0x5ba89a[_0xdf29('0x16')]));this[_0xdf29('0x36')][_0xdf29('0xa0')](this,_0x1dc547);return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0x1a0'));};AGIVertices[_0xdf29('0xe')]['set']=function(_0x150799){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x150799[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0x150799[_0xdf29('0xd3')])){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x150799,_0xdf29('0x1a1'));}var _0x48cec1=this['getVariable'][_0xdf29('0xa0')](this,_0x150799['variable_id']);if(!_0x48cec1){return this['channel'][_0xdf29('0x2b')](_0x150799,_0xdf29('0x10d'));}return this[_0xdf29('0xd')][_0xdf29('0x9a')](_0x48cec1,_0x150799[_0xdf29('0x1a2')]);};AGIVertices[_0xdf29('0xe')][_0xdf29('0x1a3')]=function(_0xf27c53){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x1a4'),_0xf27c53[_0xdf29('0xaa')]));this['channel']['noop']('START\x20CALLY\x20SQUARE');if(_0xf27c53[_0xdf29('0xb6')]==='yes'){this['channel']['noop'](_0xdf29('0x1a5'));return this[_0xdf29('0xd')]['answer']();}return this['channel'][_0xdf29('0xa4')]('Skipped\x20Answer');};AGIVertices[_0xdf29('0xe')][_0xdf29('0x1a6')]=function(_0x5ae497){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x1a7'),_0x5ae497['label']));if(!this['isConfigured'](_0x5ae497[_0xdf29('0x1a8')])){return this['channel']['error'](_0x5ae497,_0xdf29('0x1a9'));}var _0x245910=this[_0xdf29('0x1aa')][_0xdf29('0xa0')](this,_0x5ae497[_0xdf29('0x1a8')]);if(!this[_0xdf29('0x83')](_0x245910)){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x5ae497,util[_0xdf29('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5ae497[_0xdf29('0x1a8')]));}if(_0x245910===this['channel']['arg_1']){return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x5ae497,_0xdf29('0x1ab'));}this[_0xdf29('0x37')][_0xdf29('0xa0')](this,_0x5ae497,_0x245910);var _0x39ae8c=this[_0xdf29('0xd')][_0xdf29('0xa6')]('AGI',util[_0xdf29('0x27')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi']['host']||'127.0.0.1',_0x245910,this[_0xdf29('0xd')][_0xdf29('0x1ac')]));if(_0x39ae8c[_0xdf29('0x9e')]===-0x1){return _0x39ae8c;}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util['format'](_0xdf29('0x167'),_0xdf29('0x1ad'),_0x245910));};AGIVertices['prototype'][_0xdf29('0x1ae')]=function(_0x2e8308){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x1af'),_0x2e8308[_0xdf29('0xaa')]));var _0x4fcdb1=this[_0xdf29('0x55')]['sync'](this,_0x2e8308[_0xdf29('0xb4')]);this[_0xdf29('0x37')][_0xdf29('0xa0')](this,_0x2e8308,_0x2e8308['command']);if(this[_0xdf29('0x83')](_0x2e8308[_0xdf29('0xd3')])){var _0x22a762=this['getVariable'][_0xdf29('0xa0')](this,_0x2e8308[_0xdf29('0xd3')]);if(_0x22a762){this[_0xdf29('0xd')]['setVariable'](_0x22a762,_0x4fcdb1);return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x1b0'),_0x2e8308[_0xdf29('0xb4')],_0x22a762));}}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x1b1'),_0x2e8308[_0xdf29('0xb4')]));};AGIVertices[_0xdf29('0xe')][_0xdf29('0x1b2')]=function(_0x40a9aa){logger[_0xdf29('0x2d')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x40a9aa['label']));_0x40a9aa[_0xdf29('0x5a')]=_0x40a9aa['text'][_0xdf29('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xdf29('0x83')](_0x40a9aa[_0xdf29('0x1b3')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0x1b4'));}if(!this[_0xdf29('0x83')](_0x40a9aa['text'])){return this[_0xdf29('0xd')][_0xdf29('0xa4')]('no\x20text\x20configured');}this['channel']['noop'](util[_0xdf29('0x27')](_0xdf29('0x1b5'),_0x40a9aa[_0xdf29('0x5a')]));var _0x3e9696=this[_0xdf29('0x58')][_0xdf29('0xa0')](this,_0x40a9aa);if(_0x3e9696){this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x3e9696));var _0x353a98=this[_0xdf29('0xd')][_0xdf29('0x11b')](_0x3e9696);try{fs[_0xdf29('0xfa')](_0x3e9696+_0xdf29('0x11c'));}catch(_0x453512){logger[_0xdf29('0x2b')](_0x453512);}return _0x353a98;}return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x40a9aa,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xdf29('0xe')][_0xdf29('0x1b6')]=function(_0x249820){logger['info'](util[_0xdf29('0x27')](_0xdf29('0x1b7'),_0x249820[_0xdf29('0xaa')]));_0x249820[_0xdf29('0x5a')]=_0x249820[_0xdf29('0x5a')][_0xdf29('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xdf29('0x83')](_0x249820[_0xdf29('0x5a')])){return this[_0xdf29('0xd')][_0xdf29('0xa4')](_0xdf29('0xa5'));}this[_0xdf29('0xd')]['noop'](util[_0xdf29('0x27')](_0xdf29('0x1b8'),_0x249820[_0xdf29('0x5a')]));var _0x43b9d5=this[_0xdf29('0x5f')][_0xdf29('0xa0')](this,_0x249820);if(_0x43b9d5){this[_0xdf29('0xd')][_0xdf29('0xa4')](util['format'](_0xdf29('0x1b9'),_0x43b9d5));var _0x1e1cf4=this[_0xdf29('0xd')][_0xdf29('0x11b')](_0x43b9d5);try{fs[_0xdf29('0xfa')](_0x43b9d5+_0xdf29('0x11c'));}catch(_0x9def61){logger['error'](_0x9def61);}return _0x1e1cf4;}return this[_0xdf29('0xd')][_0xdf29('0x2b')](_0x249820,_0xdf29('0x1ba'));};AGIVertices[_0xdf29('0xe')][_0xdf29('0x1bb')]=function(_0xffd508){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x1bc'),_0xffd508[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0xffd508[_0xdf29('0x150')])){return this[_0xdf29('0xd')]['error'](_0xffd508,_0xdf29('0x151'));}logger['info'](util[_0xdf29('0x27')](_0xdf29('0x157'),this[_0xdf29('0xd')][_0xdf29('0x3a')],_0xffd508[_0xdf29('0x150')]));var _0x42b12a=this['agentUnpause']['sync'](this,_0xffd508['findBy']);if(_0x42b12a){logger[_0xdf29('0x2d')](util['format'](_0xdf29('0x152'),this[_0xdf29('0xd')]['callerid'],_0xffd508[_0xdf29('0x150')]));this['channel'][_0xdf29('0xa4')](util[_0xdf29('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xdf29('0xd')]['callerid'],_0xffd508['findBy']));return{'code':0xc8,'result':_0xdf29('0x153')};}else{logger['info'](util[_0xdf29('0x27')](_0xdf29('0x154'),this[_0xdf29('0xd')][_0xdf29('0x3a')],_0xffd508[_0xdf29('0x150')]));this['channel'][_0xdf29('0xa4')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xdf29('0xd')][_0xdf29('0x3a')],_0xffd508[_0xdf29('0x150')]));return{'code':0xc8,'result':_0xdf29('0x155')};}};AGIVertices[_0xdf29('0xe')][_0xdf29('0x1bd')]=function(_0x251bfa){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')](_0xdf29('0x1be'),_0x251bfa[_0xdf29('0xaa')]));var _0x16fdd0=this['channel'][_0xdf29('0xa6')]('VOICEMAIL',[_0x251bfa['mailbox'],_0x251bfa[_0xdf29('0x75')]]);if(_0x16fdd0[_0xdf29('0x9e')]===-0x1){return _0x16fdd0;}return this[_0xdf29('0xd')][_0xdf29('0xa4')](util[_0xdf29('0x27')](_0xdf29('0x167'),_0xdf29('0x1bf'),_0x251bfa[_0xdf29('0x1c0')]));};AGIVertices[_0xdf29('0xe')]['vswitch']=function(_0x190f95){logger[_0xdf29('0x2d')](util[_0xdf29('0x27')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x190f95[_0xdf29('0xaa')]));if(!this[_0xdf29('0x83')](_0x190f95[_0xdf29('0xd3')])){return this['channel'][_0xdf29('0x2b')](_0x190f95,_0xdf29('0x1a1'));}var _0x12a840=this['getVariable']['sync'](this,_0x190f95['variable_id']);if(!_0x12a840){return this['channel'][_0xdf29('0x2b')](_0x190f95,_0xdf29('0x10d'));}var _0x49613c=this[_0xdf29('0xd')][_0xdf29('0xf')](_0x12a840);return{'code':0xc8,'result':_0x49613c[_0xdf29('0x9c')]?_0x49613c[_0xdf29('0x9c')]:'-'};};String[_0xdf29('0xe')][_0xdf29('0x9b')]=function(_0x3df4df,_0x3d57d9){return this['split'](_0x3df4df)[_0xdf29('0x1c1')](_0x3d57d9);};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 fcf90c5..8805fdc 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 _0x0e4d=['hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','update','uniqueid','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','acw','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','exports','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x0e4d,0x142));var _0xd0e4=function(_0x5b7fda,_0x8d98d){_0x5b7fda=_0x5b7fda-0x0;var _0x5724b2=_0x0e4d[_0x5b7fda];return _0x5724b2;};'use strict';var util=require(_0xd0e4('0x0'));var _=require(_0xd0e4('0x1'));var moment=require(_0xd0e4('0x2'));var ami=require(_0xd0e4('0x3'));var logger=require(_0xd0e4('0x4'))('acw');var RpcUser=require(_0xd0e4('0x5'));var RpcVoiceAgentReport=require(_0xd0e4('0x6'));function Acw(_0x5511ee){this[_0xd0e4('0x7')]=_0x5511ee[_0xd0e4('0x7')];this[_0xd0e4('0x8')]=_0x5511ee[_0xd0e4('0x8')];this[_0xd0e4('0x9')]=_0x5511ee[_0xd0e4('0x9')];this[_0xd0e4('0xa')]={};ami['on'](_0xd0e4('0xb'),this[_0xd0e4('0xc')][_0xd0e4('0xd')](this));ami['on'](_0xd0e4('0xe'),this[_0xd0e4('0xf')]['bind'](this));ami['on'](_0xd0e4('0x10'),this['syncHangup'][_0xd0e4('0xd')](this));ami['on'](_0xd0e4('0x11'),this[_0xd0e4('0x12')][_0xd0e4('0xd')](this));ami['on'](_0xd0e4('0x13'),this['syncAttendedTransfer'][_0xd0e4('0xd')](this));ami['on']('blindtransfer',this[_0xd0e4('0x14')][_0xd0e4('0xd')](this));ami['on'](_0xd0e4('0x15'),this[_0xd0e4('0x16')][_0xd0e4('0xd')](this));}function getDiff(_0x414da9){var _0x2a8162=moment()['milliseconds'](0x0);var _0x3c7a17=moment(_0x414da9)[_0xd0e4('0x17')](0x0);return _0x2a8162['diff'](_0x3c7a17,_0xd0e4('0x18'));}Acw[_0xd0e4('0x19')][_0xd0e4('0x1a')]=function(_0x51a67c){try{var _0x400f01=this;var _0x50d2a0=this[_0xd0e4('0xa')][_0x51a67c][_0xd0e4('0x1b')];var _0x390eda=this[_0xd0e4('0xa')][_0x51a67c][_0xd0e4('0x1c')];var _0x47c742=this['voiceQueues'][_0x390eda];var _0x42a6a5=![];var _0xe77d3b=_0xd0e4('0x1d');if(_0x47c742['mandatoryDisposition']){if(_0x47c742['mandatoryDispositionPause'][_0xd0e4('0x1e')]){_0x42a6a5=!![];_0xe77d3b=_0x47c742[_0xd0e4('0x1f')][_0xd0e4('0x1e')];}}ami[_0xd0e4('0x20')]({'action':_0xd0e4('0x21'),'interface':_0x50d2a0,'paused':!![],'reason':_0xe77d3b})[_0xd0e4('0x22')](function(_0x3aab0a){if(_0x400f01[_0xd0e4('0x8')][_0x50d2a0]){return RpcUser[_0xd0e4('0x23')](_0x400f01[_0xd0e4('0x8')][_0x50d2a0]['id'])[_0xd0e4('0x22')](function(_0x56b5f5){if(_0x56b5f5&&!_0x56b5f5[_0xd0e4('0x24')]){logger[_0xd0e4('0x25')](_0xd0e4('0x26'),_0x51a67c,_0x50d2a0,_0x390eda);var _0x1e0844=_0x400f01[_0xd0e4('0xa')][_0x51a67c][_0xd0e4('0x27')]&&_0x400f01[_0xd0e4('0xa')][_0x51a67c][_0xd0e4('0x28')]?_0x400f01['channels'][_0x51a67c][_0xd0e4('0x28')]:_0x51a67c;return RpcUser['savePause'](_0x400f01[_0xd0e4('0x8')][_0x50d2a0],_0xe77d3b,_0x1e0844)[_0xd0e4('0x22')](function(_0x2eb878){if(!_0x42a6a5){_0x400f01[_0xd0e4('0x9')][_0x50d2a0]={};logger[_0xd0e4('0x25')](_0xd0e4('0x29'),_0x51a67c,_0x400f01['voiceQueues'][_0x390eda][_0xd0e4('0x2a')],_0x50d2a0,_0x390eda);_0x400f01[_0xd0e4('0x9')][_0x50d2a0][_0xd0e4('0x2b')]=setTimeout(_0x400f01['stopAcw'][_0xd0e4('0xd')](_0x400f01,_0x50d2a0),_0x400f01[_0xd0e4('0x7')][_0x390eda][_0xd0e4('0x2a')]*0x3e8);_0x400f01[_0xd0e4('0x9')][_0x50d2a0][_0xd0e4('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x400f01['timers'][_0x50d2a0]['uniqueid']=_0x51a67c;_0x400f01[_0xd0e4('0x9')][_0x50d2a0][_0xd0e4('0x1c')]=_0x390eda;_0x400f01[_0xd0e4('0x9')][_0x50d2a0]['updateAcw']=function(){var _0x48484d=getDiff(_0x400f01[_0xd0e4('0x9')][_0x50d2a0][_0xd0e4('0x2c')]);clearTimeout(_0x400f01['timers'][_0x50d2a0]['timer']);_0x400f01[_0xd0e4('0x9')][_0x50d2a0][_0xd0e4('0x2b')]=![];RpcVoiceAgentReport[_0xd0e4('0x2d')]({'acwtime':_0x48484d},_0x400f01['timers'][_0x50d2a0][_0xd0e4('0x2e')],_0x50d2a0)[_0xd0e4('0x22')](function(_0x1422f6){logger[_0xd0e4('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x51a67c,_0x48484d,_0x1422f6);})[_0xd0e4('0x2f')](function(_0x166f5b){logger[_0xd0e4('0x30')](_0xd0e4('0x31'),_0x51a67c,_0x166f5b);});delete _0x400f01[_0xd0e4('0x9')][_0x50d2a0];};}});}else{logger[_0xd0e4('0x25')](_0xd0e4('0x32'),_0x51a67c,_0x50d2a0,_0x390eda);}});}})[_0xd0e4('0x2f')](function(_0x505ec0){logger[_0xd0e4('0x30')](_0xd0e4('0x29'),_0x51a67c,_0x400f01['voiceQueues'][_0x390eda][_0xd0e4('0x2a')],_0x50d2a0,_0x390eda);})[_0xd0e4('0x33')](function(){delete _0x400f01[_0xd0e4('0xa')][_0x51a67c];});}catch(_0x24624b){logger['error'](_0xd0e4('0x34'),_0x24624b[_0xd0e4('0x35')]);}};Acw[_0xd0e4('0x19')][_0xd0e4('0x36')]=function(_0x34dc2c){try{var _0x27cda7=this;if(_0x27cda7[_0xd0e4('0x9')][_0x34dc2c]){_0x27cda7[_0xd0e4('0x9')][_0x34dc2c][_0xd0e4('0x2b')]=![];var _0x285367=_0x27cda7[_0xd0e4('0x9')][_0x34dc2c][_0xd0e4('0x2e')];var _0x7721d=_0x27cda7['timers'][_0x34dc2c]['queue'];var _0x8cb437=_0x27cda7['voiceQueues'][_0x7721d][_0xd0e4('0x2a')];logger['info'](_0xd0e4('0x37'),_0x285367,_0x34dc2c);RpcUser['saveUnpause'](this['agents'][_0x34dc2c]);RpcVoiceAgentReport[_0xd0e4('0x2d')]({'acwtime':_0x8cb437,'agentacw':!![]},_0x285367,_0x34dc2c)[_0xd0e4('0x22')](function(_0x1c8cc8){logger[_0xd0e4('0x25')](_0xd0e4('0x38'),_0x285367,_0x8cb437,_0x1c8cc8);})[_0xd0e4('0x2f')](function(_0x6633f5){logger[_0xd0e4('0x30')](_0xd0e4('0x31'),_0x285367,_0x6633f5);});}else{logger['error'](_0xd0e4('0x39'),_0x34dc2c);if(_0x27cda7['timers']){logger['info'](_0xd0e4('0x3a'),JSON['stringify'](_0x27cda7[_0xd0e4('0x9')]));}}}catch(_0x16f1f8){logger['error']('[ACW][STOP]\x20%s',_0x16f1f8[_0xd0e4('0x35')]);}};Acw['prototype'][_0xd0e4('0xc')]=function(_0x2d2d41){try{if(this[_0xd0e4('0x7')][_0x2d2d41[_0xd0e4('0x1c')]]&&(this[_0xd0e4('0x7')][_0x2d2d41[_0xd0e4('0x1c')]]['acw']||this['voiceQueues'][_0x2d2d41[_0xd0e4('0x1c')]]['mandatoryDisposition'])){if(this[_0xd0e4('0x8')][_0x2d2d41[_0xd0e4('0x1b')]]){this[_0xd0e4('0xa')][_0x2d2d41[_0xd0e4('0x2e')]]={'queue':_0x2d2d41[_0xd0e4('0x1c')],'interface':_0x2d2d41[_0xd0e4('0x1b')],'destlinkedid':_0x2d2d41[_0xd0e4('0x28')]};}}}catch(_0x144c73){logger[_0xd0e4('0x30')]('[ACW][syncAgentConnect]\x20%s',_0x144c73[_0xd0e4('0x35')]);}};Acw[_0xd0e4('0x19')]['syncAgentConnectPreview']=function(_0x5a99c0){try{if(this[_0xd0e4('0x7')][_0x5a99c0[_0xd0e4('0x1c')]]&&(this[_0xd0e4('0x7')][_0x5a99c0[_0xd0e4('0x1c')]][_0xd0e4('0x3b')]||this[_0xd0e4('0x7')][_0x5a99c0[_0xd0e4('0x1c')]][_0xd0e4('0x3c')])){if(this['agents'][_0x5a99c0[_0xd0e4('0x1b')]]){this[_0xd0e4('0xa')][_0x5a99c0[_0xd0e4('0x2e')]]={'queue':_0x5a99c0[_0xd0e4('0x1c')],'interface':_0x5a99c0[_0xd0e4('0x1b')]};}}}catch(_0x35bc92){logger['error'](_0xd0e4('0x3d'),_0x35bc92[_0xd0e4('0x35')]);}};Acw['prototype'][_0xd0e4('0xf')]=function(_0x3f6818){try{if(this['channels'][_0x3f6818[_0xd0e4('0x2e')]]&&_[_0xd0e4('0x3e')](this[_0xd0e4('0xa')][_0x3f6818['uniqueid']][_0xd0e4('0x27')])){logger[_0xd0e4('0x25')]('[%s][HANGUP:UNIQUEID]',_0x3f6818[_0xd0e4('0x2e')]);this[_0xd0e4('0x1a')](_0x3f6818[_0xd0e4('0x2e')]);}else if(this[_0xd0e4('0xa')][_0x3f6818[_0xd0e4('0x3f')]]&&_['isUndefined'](this['channels'][_0x3f6818[_0xd0e4('0x3f')]][_0xd0e4('0x27')])){logger[_0xd0e4('0x25')]('[%s][HANGUP:LINKEDID]',_0x3f6818[_0xd0e4('0x3f')]);this[_0xd0e4('0x1a')](_0x3f6818[_0xd0e4('0x3f')]);}}catch(_0x50fa0f){logger['error'](_0xd0e4('0x40'),_0x50fa0f[_0xd0e4('0x35')]);}};Acw[_0xd0e4('0x19')]['syncHangup']=function(_0x21e07f){try{if(this['channels'][_0x21e07f[_0xd0e4('0x2e')]]&&this['channels'][_0x21e07f[_0xd0e4('0x2e')]]['attended']){logger['info'](_0xd0e4('0x41'),_0x21e07f[_0xd0e4('0x2e')]);this[_0xd0e4('0x1a')](_0x21e07f[_0xd0e4('0x2e')]);}else if(this['channels'][_0x21e07f[_0xd0e4('0x3f')]]&&this[_0xd0e4('0xa')][_0x21e07f[_0xd0e4('0x3f')]][_0xd0e4('0x27')]){logger[_0xd0e4('0x25')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x21e07f['linkedid']);this[_0xd0e4('0x1a')](_0x21e07f['linkedid']);}}catch(_0x2dae45){logger[_0xd0e4('0x30')](_0xd0e4('0x42'),_0x2dae45['message']);}};Acw[_0xd0e4('0x19')][_0xd0e4('0x43')]=function(_0x349312){try{if(!_['isNil'](this[_0xd0e4('0xa')][_0x349312[_0xd0e4('0x44')]])){this[_0xd0e4('0x1a')](_0x349312['transfereeuniqueid']);if(this[_0xd0e4('0xa')][_0x349312[_0xd0e4('0x45')]]){this[_0xd0e4('0xa')][_0x349312['secondtransfereruniqueid']][_0xd0e4('0x27')]=!![];this[_0xd0e4('0xa')][_0x349312[_0xd0e4('0x46')]]=this[_0xd0e4('0xa')][_0x349312[_0xd0e4('0x45')]];delete this[_0xd0e4('0xa')][_0x349312[_0xd0e4('0x45')]];}}else if(!_[_0xd0e4('0x47')](this[_0xd0e4('0xa')][_0x349312['transfertargetuniqueid']])){this[_0xd0e4('0x1a')](_0x349312[_0xd0e4('0x46')]);if(this[_0xd0e4('0xa')][_0x349312[_0xd0e4('0x48')]]){this[_0xd0e4('0xa')][_0x349312[_0xd0e4('0x48')]][_0xd0e4('0x27')]=!![];this[_0xd0e4('0xa')][_0x349312[_0xd0e4('0x44')]]=this[_0xd0e4('0xa')][_0x349312[_0xd0e4('0x48')]];delete this[_0xd0e4('0xa')][_0x349312['origtransfereruniqueid']];}}}catch(_0x2dc2ba){logger[_0xd0e4('0x30')]('[ACW][syncAttendedTransfer]\x20%s',_0x2dc2ba[_0xd0e4('0x35')]);}};Acw[_0xd0e4('0x19')][_0xd0e4('0x14')]=function(_0x1b744b){try{if(this[_0xd0e4('0xa')][_0x1b744b[_0xd0e4('0x49')]]){logger[_0xd0e4('0x25')](_0xd0e4('0x4a'),JSON[_0xd0e4('0x4b')](_0x1b744b[_0xd0e4('0x49')]));this['startAcw'](_0x1b744b[_0xd0e4('0x49')]);}else if(this[_0xd0e4('0xa')][_0x1b744b[_0xd0e4('0x4c')]]){logger[_0xd0e4('0x25')](_0xd0e4('0x4d'),JSON[_0xd0e4('0x4b')](_0x1b744b[_0xd0e4('0x4c')]));this['startAcw'](_0x1b744b[_0xd0e4('0x4c')]);}}catch(_0x49d953){logger[_0xd0e4('0x30')](_0xd0e4('0x4e'),_0x49d953[_0xd0e4('0x35')]);}};Acw['prototype'][_0xd0e4('0x12')]=function(_0x12bc4a){try{if(this[_0xd0e4('0x7')][_0x12bc4a[_0xd0e4('0x1c')]]&&this[_0xd0e4('0x7')][_0x12bc4a[_0xd0e4('0x1c')]][_0xd0e4('0x4f')]==='all'){if(this['agents'][_0x12bc4a['interface']]){logger[_0xd0e4('0x25')](_0xd0e4('0x50'),_0x12bc4a[_0xd0e4('0x2e')],_0x12bc4a[_0xd0e4('0x1b')],_0x12bc4a['queue']);return RpcUser[_0xd0e4('0x51')](this[_0xd0e4('0x8')][_0x12bc4a['interface']],_0xd0e4('0x52'),_0x12bc4a[_0xd0e4('0x2e')]);}}}catch(_0x2176b9){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x2176b9[_0xd0e4('0x35')]);}};module[_0xd0e4('0x53')]=Acw; \ No newline at end of file +var _0x1c9e=['[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../../../config/logger','voiceQueues','agents','timers','syncAgentConnect','bind','syncHangupRequest','syncHangup','syncAttendedTransfer','blindtransfer','syncBlindTransfer','milliseconds','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','finally'];(function(_0x4f2e34,_0x213133){var _0x39701a=function(_0x5d5e79){while(--_0x5d5e79){_0x4f2e34['push'](_0x4f2e34['shift']());}};_0x39701a(++_0x213133);}(_0x1c9e,0x1f3));var _0xe1c9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1c9e[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var _=require(_0xe1c9('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require(_0xe1c9('0x1'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x35d3b7){this[_0xe1c9('0x2')]=_0x35d3b7[_0xe1c9('0x2')];this[_0xe1c9('0x3')]=_0x35d3b7['agents'];this['timers']=_0x35d3b7[_0xe1c9('0x4')];this['channels']={};ami['on']('agentconnect',this[_0xe1c9('0x5')][_0xe1c9('0x6')](this));ami['on']('hanguprequest',this[_0xe1c9('0x7')]['bind'](this));ami['on']('hangup',this[_0xe1c9('0x8')][_0xe1c9('0x6')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xe1c9('0x6')](this));ami['on']('attendedtransfer',this[_0xe1c9('0x9')]['bind'](this));ami['on'](_0xe1c9('0xa'),this[_0xe1c9('0xb')][_0xe1c9('0x6')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0xe1c9('0x6')](this));}function getDiff(_0x596d75){var _0x291bf1=moment()[_0xe1c9('0xc')](0x0);var _0x36b53d=moment(_0x596d75)[_0xe1c9('0xc')](0x0);return _0x291bf1['diff'](_0x36b53d,'seconds');}Acw['prototype']['startAcw']=function(_0x2d1844){try{var _0x66d257=this;var _0xd2c6ed=this['channels'][_0x2d1844]['interface'];var _0x38f361=this[_0xe1c9('0xd')][_0x2d1844][_0xe1c9('0xe')];var _0x57644d=this[_0xe1c9('0x2')][_0x38f361];var _0x32e98b=![];var _0xcacd41=_0xe1c9('0xf');if(_0x57644d[_0xe1c9('0x10')]){if(_0x57644d[_0xe1c9('0x11')][_0xe1c9('0x12')]){_0x32e98b=!![];_0xcacd41=_0x57644d[_0xe1c9('0x11')]['name'];}}ami[_0xe1c9('0x13')]({'action':_0xe1c9('0x14'),'interface':_0xd2c6ed,'paused':!![],'reason':_0xcacd41})[_0xe1c9('0x15')](function(_0xaee0a2){if(_0x66d257[_0xe1c9('0x3')][_0xd2c6ed]){return RpcUser['getAgent'](_0x66d257[_0xe1c9('0x3')][_0xd2c6ed]['id'])[_0xe1c9('0x15')](function(_0xf978ef){if(_0xf978ef&&!_0xf978ef['voicePause']){logger[_0xe1c9('0x16')](_0xe1c9('0x17'),_0x2d1844,_0xd2c6ed,_0x38f361);var _0x1a2c6=_0x66d257['channels'][_0x2d1844][_0xe1c9('0x18')]&&_0x66d257[_0xe1c9('0xd')][_0x2d1844]['destlinkedid']?_0x66d257[_0xe1c9('0xd')][_0x2d1844][_0xe1c9('0x19')]:_0x2d1844;return RpcUser['savePause'](_0x66d257[_0xe1c9('0x3')][_0xd2c6ed],_0xcacd41,_0x1a2c6)['then'](function(_0x5d3f89){if(!_0x32e98b){_0x66d257['timers'][_0xd2c6ed]={};logger[_0xe1c9('0x16')](_0xe1c9('0x1a'),_0x2d1844,_0x66d257[_0xe1c9('0x2')][_0x38f361][_0xe1c9('0x1b')],_0xd2c6ed,_0x38f361);_0x66d257[_0xe1c9('0x4')][_0xd2c6ed][_0xe1c9('0x1c')]=setTimeout(_0x66d257[_0xe1c9('0x1d')][_0xe1c9('0x6')](_0x66d257,_0xd2c6ed),_0x66d257[_0xe1c9('0x2')][_0x38f361][_0xe1c9('0x1b')]*0x3e8);_0x66d257[_0xe1c9('0x4')][_0xd2c6ed][_0xe1c9('0x1e')]=moment()[_0xe1c9('0x1f')](_0xe1c9('0x20'));_0x66d257[_0xe1c9('0x4')][_0xd2c6ed][_0xe1c9('0x21')]=_0x2d1844;_0x66d257['timers'][_0xd2c6ed][_0xe1c9('0xe')]=_0x38f361;_0x66d257['timers'][_0xd2c6ed][_0xe1c9('0x22')]=function(){var _0x4f87f2=getDiff(_0x66d257['timers'][_0xd2c6ed][_0xe1c9('0x1e')]);clearTimeout(_0x66d257[_0xe1c9('0x4')][_0xd2c6ed][_0xe1c9('0x1c')]);_0x66d257[_0xe1c9('0x4')][_0xd2c6ed][_0xe1c9('0x1c')]=![];RpcVoiceAgentReport[_0xe1c9('0x23')]({'acwtime':_0x4f87f2},_0x66d257[_0xe1c9('0x4')][_0xd2c6ed][_0xe1c9('0x21')],_0xd2c6ed)[_0xe1c9('0x15')](function(_0x5f21cd){logger[_0xe1c9('0x16')]('[%s][UPDATE][ACWTIME:%s]',_0x2d1844,_0x4f87f2,_0x5f21cd);})[_0xe1c9('0x24')](function(_0x33052f){logger[_0xe1c9('0x25')](_0xe1c9('0x26'),_0x2d1844,_0x33052f);});delete _0x66d257[_0xe1c9('0x4')][_0xd2c6ed];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2d1844,_0xd2c6ed,_0x38f361);}});}})[_0xe1c9('0x24')](function(_0x3210c9){logger[_0xe1c9('0x25')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2d1844,_0x66d257[_0xe1c9('0x2')][_0x38f361][_0xe1c9('0x1b')],_0xd2c6ed,_0x38f361);})[_0xe1c9('0x27')](function(){delete _0x66d257['channels'][_0x2d1844];});}catch(_0x34634f){logger[_0xe1c9('0x25')](_0xe1c9('0x28'),_0x34634f[_0xe1c9('0x29')]);}};Acw[_0xe1c9('0x2a')][_0xe1c9('0x1d')]=function(_0x13e3d2){try{var _0x5290dd=this;if(_0x5290dd[_0xe1c9('0x4')][_0x13e3d2]){_0x5290dd[_0xe1c9('0x4')][_0x13e3d2]['timer']=![];var _0x1e7cd1=_0x5290dd[_0xe1c9('0x4')][_0x13e3d2][_0xe1c9('0x21')];var _0x10b612=_0x5290dd['timers'][_0x13e3d2][_0xe1c9('0xe')];var _0x486b93=_0x5290dd[_0xe1c9('0x2')][_0x10b612][_0xe1c9('0x1b')];logger[_0xe1c9('0x16')](_0xe1c9('0x2b'),_0x1e7cd1,_0x13e3d2);RpcUser[_0xe1c9('0x2c')](this['agents'][_0x13e3d2]);RpcVoiceAgentReport['update']({'acwtime':_0x486b93,'agentacw':!![]},_0x1e7cd1,_0x13e3d2)[_0xe1c9('0x15')](function(_0x16d1f5){logger[_0xe1c9('0x16')](_0xe1c9('0x2d'),_0x1e7cd1,_0x486b93,_0x16d1f5);})[_0xe1c9('0x24')](function(_0x5defc6){logger[_0xe1c9('0x25')](_0xe1c9('0x26'),_0x1e7cd1,_0x5defc6);});}else{logger[_0xe1c9('0x25')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x13e3d2);if(_0x5290dd[_0xe1c9('0x4')]){logger[_0xe1c9('0x16')](_0xe1c9('0x2e'),JSON[_0xe1c9('0x2f')](_0x5290dd['timers']));}}}catch(_0x11f711){logger['error'](_0xe1c9('0x30'),_0x11f711['message']);}};Acw[_0xe1c9('0x2a')][_0xe1c9('0x5')]=function(_0x4b0723){try{if(this[_0xe1c9('0x2')][_0x4b0723[_0xe1c9('0xe')]]&&(this[_0xe1c9('0x2')][_0x4b0723['queue']][_0xe1c9('0x31')]||this[_0xe1c9('0x2')][_0x4b0723[_0xe1c9('0xe')]][_0xe1c9('0x10')])){if(this[_0xe1c9('0x3')][_0x4b0723['interface']]){this['channels'][_0x4b0723['uniqueid']]={'queue':_0x4b0723['queue'],'interface':_0x4b0723[_0xe1c9('0x32')],'destlinkedid':_0x4b0723['destlinkedid']};}}}catch(_0x11a364){logger[_0xe1c9('0x25')](_0xe1c9('0x33'),_0x11a364['message']);}};Acw[_0xe1c9('0x2a')][_0xe1c9('0x34')]=function(_0x35bb0c){try{if(this[_0xe1c9('0x2')][_0x35bb0c[_0xe1c9('0xe')]]&&(this[_0xe1c9('0x2')][_0x35bb0c[_0xe1c9('0xe')]][_0xe1c9('0x31')]||this[_0xe1c9('0x2')][_0x35bb0c['queue']]['mandatoryDisposition'])){if(this[_0xe1c9('0x3')][_0x35bb0c[_0xe1c9('0x32')]]){this[_0xe1c9('0xd')][_0x35bb0c[_0xe1c9('0x21')]]={'queue':_0x35bb0c['queue'],'interface':_0x35bb0c[_0xe1c9('0x32')]};}}}catch(_0x241ec1){logger[_0xe1c9('0x25')](_0xe1c9('0x35'),_0x241ec1[_0xe1c9('0x29')]);}};Acw[_0xe1c9('0x2a')][_0xe1c9('0x7')]=function(_0x2e195e){try{if(this['channels'][_0x2e195e[_0xe1c9('0x21')]]&&_[_0xe1c9('0x36')](this[_0xe1c9('0xd')][_0x2e195e[_0xe1c9('0x21')]][_0xe1c9('0x18')])){logger[_0xe1c9('0x16')](_0xe1c9('0x37'),_0x2e195e[_0xe1c9('0x21')]);this['startAcw'](_0x2e195e[_0xe1c9('0x21')]);}else if(this[_0xe1c9('0xd')][_0x2e195e[_0xe1c9('0x38')]]&&_[_0xe1c9('0x36')](this[_0xe1c9('0xd')][_0x2e195e[_0xe1c9('0x38')]][_0xe1c9('0x18')])){logger[_0xe1c9('0x16')](_0xe1c9('0x39'),_0x2e195e[_0xe1c9('0x38')]);this[_0xe1c9('0x3a')](_0x2e195e[_0xe1c9('0x38')]);}}catch(_0x3789c8){logger[_0xe1c9('0x25')](_0xe1c9('0x3b'),_0x3789c8[_0xe1c9('0x29')]);}};Acw[_0xe1c9('0x2a')][_0xe1c9('0x8')]=function(_0x209f0a){try{if(this['channels'][_0x209f0a[_0xe1c9('0x21')]]&&this['channels'][_0x209f0a[_0xe1c9('0x21')]][_0xe1c9('0x18')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x209f0a[_0xe1c9('0x21')]);this['startAcw'](_0x209f0a[_0xe1c9('0x21')]);}else if(this[_0xe1c9('0xd')][_0x209f0a[_0xe1c9('0x38')]]&&this[_0xe1c9('0xd')][_0x209f0a['linkedid']]['attended']){logger[_0xe1c9('0x16')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x209f0a['linkedid']);this['startAcw'](_0x209f0a[_0xe1c9('0x38')]);}}catch(_0x42884d){logger[_0xe1c9('0x25')]('[ACW][syncHangup]\x20%s',_0x42884d[_0xe1c9('0x29')]);}};Acw[_0xe1c9('0x2a')][_0xe1c9('0x9')]=function(_0x1e5a8c){try{if(!_['isNil'](this[_0xe1c9('0xd')][_0x1e5a8c[_0xe1c9('0x3c')]])){this['startAcw'](_0x1e5a8c['transfereeuniqueid']);if(this['channels'][_0x1e5a8c[_0xe1c9('0x3d')]]){this[_0xe1c9('0xd')][_0x1e5a8c['secondtransfereruniqueid']][_0xe1c9('0x18')]=!![];this[_0xe1c9('0xd')][_0x1e5a8c[_0xe1c9('0x3e')]]=this['channels'][_0x1e5a8c['secondtransfereruniqueid']];delete this['channels'][_0x1e5a8c[_0xe1c9('0x3d')]];}}else if(!_['isNil'](this[_0xe1c9('0xd')][_0x1e5a8c[_0xe1c9('0x3e')]])){this[_0xe1c9('0x3a')](_0x1e5a8c[_0xe1c9('0x3e')]);if(this[_0xe1c9('0xd')][_0x1e5a8c[_0xe1c9('0x3f')]]){this['channels'][_0x1e5a8c[_0xe1c9('0x3f')]][_0xe1c9('0x18')]=!![];this[_0xe1c9('0xd')][_0x1e5a8c['transfereeuniqueid']]=this[_0xe1c9('0xd')][_0x1e5a8c[_0xe1c9('0x3f')]];delete this['channels'][_0x1e5a8c[_0xe1c9('0x3f')]];}}}catch(_0x14fd68){logger[_0xe1c9('0x25')](_0xe1c9('0x40'),_0x14fd68['message']);}};Acw[_0xe1c9('0x2a')][_0xe1c9('0xb')]=function(_0x2946b5){try{if(this['channels'][_0x2946b5['transfereruniqueid']]){logger[_0xe1c9('0x16')](_0xe1c9('0x41'),JSON['stringify'](_0x2946b5[_0xe1c9('0x42')]));this[_0xe1c9('0x3a')](_0x2946b5[_0xe1c9('0x42')]);}else if(this[_0xe1c9('0xd')][_0x2946b5[_0xe1c9('0x43')]]){logger['info'](_0xe1c9('0x44'),JSON[_0xe1c9('0x2f')](_0x2946b5[_0xe1c9('0x43')]));this[_0xe1c9('0x3a')](_0x2946b5[_0xe1c9('0x43')]);}}catch(_0xdc48ff){logger[_0xe1c9('0x25')](_0xe1c9('0x45'),_0xdc48ff[_0xe1c9('0x29')]);}};Acw['prototype'][_0xe1c9('0x46')]=function(_0x16753f){try{if(this[_0xe1c9('0x2')][_0x16753f['queue']]&&this['voiceQueues'][_0x16753f['queue']][_0xe1c9('0x47')]===_0xe1c9('0x48')){if(this[_0xe1c9('0x3')][_0x16753f[_0xe1c9('0x32')]]){logger['info'](_0xe1c9('0x49'),_0x16753f['uniqueid'],_0x16753f[_0xe1c9('0x32')],_0x16753f[_0xe1c9('0xe')]);return RpcUser[_0xe1c9('0x4a')](this[_0xe1c9('0x3')][_0x16753f[_0xe1c9('0x32')]],'Auto-Pause',_0x16753f['uniqueid']);}}}catch(_0x346fcb){logger[_0xe1c9('0x25')](_0xe1c9('0x4b'),_0x346fcb[_0xe1c9('0x29')]);}};module[_0xe1c9('0x4c')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index da0ab2c..6b18c6d 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 _0xe43d=['format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','actionSipShowRegistry','actionSipPeerStatus','catch','log','exports','asterisk-manager','bluebird','util','lodash','../../config/logger','ami','../../config/environment','asterisk','password','Action','promisify','action','error'];(function(_0x2f349c,_0x34751f){var _0x51932a=function(_0x5056ae){while(--_0x5056ae){_0x2f349c['push'](_0x2f349c['shift']());}};_0x51932a(++_0x34751f);}(_0xe43d,0xdd));var _0xde43=function(_0x15a99d,_0x4486ea){_0x15a99d=_0x15a99d-0x0;var _0x2cb908=_0xe43d[_0x15a99d];return _0x2cb908;};'use strict';var Manager=require(_0xde43('0x0'));var BPromise=require(_0xde43('0x1'));var moment=require('moment');var util=require(_0xde43('0x2'));var _=require(_0xde43('0x3'));var logger=require(_0xde43('0x4'))(_0xde43('0x5'));var config=require(_0xde43('0x6'));var ami=new Manager(config[_0xde43('0x7')]['port'],config[_0xde43('0x7')]['ip'],config['asterisk']['username'],config[_0xde43('0x7')][_0xde43('0x8')],!![]);ami['keepConnected']();ami[_0xde43('0x9')]=BPromise[_0xde43('0xa')](ami[_0xde43('0xb')]);function error(_0x178dd6){logger[_0xde43('0xc')](util[_0xde43('0xd')](_0xde43('0xe'),config['asterisk']['username'],config[_0xde43('0x7')]['ip'],config[_0xde43('0x7')][_0xde43('0xf')],util[_0xde43('0x10')](_0x178dd6,![],null)));}function close(){logger[_0xde43('0xc')](util[_0xde43('0xd')](_0xde43('0x11'),config[_0xde43('0x7')][_0xde43('0x12')],config['asterisk']['ip'],config[_0xde43('0x7')][_0xde43('0xf')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xde43('0x9')]({'action':_0xde43('0x13')});};};ami[_0xde43('0x14')]=function(){return function(){return ami[_0xde43('0x9')]({'action':_0xde43('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xde43('0x9')]({'action':'sippeerstatus'});};};ami[_0xde43('0x16')]=function(){return function(){return ami[_0xde43('0x9')]({'action':_0xde43('0x17')});};};ami[_0xde43('0x18')]=function(){return function(){return ami[_0xde43('0x9')]({'action':'coreshowchannels'});};};function connect(_0x2e4e44){logger[_0xde43('0x19')](util[_0xde43('0xd')](_0xde43('0x1a'),config[_0xde43('0x7')][_0xde43('0x12')],config[_0xde43('0x7')]['ip'],config[_0xde43('0x7')][_0xde43('0xf')]));ami['once'](_0xde43('0xc'),error);ami[_0xde43('0x1b')](_0xde43('0x1c'),close);}ami['on'](_0xde43('0x1d'),connect);ami['on'](_0xde43('0x1e'),function(_0x27334f){logger[_0xde43('0x19')](util[_0xde43('0xd')](_0xde43('0x1f'),config[_0xde43('0x7')][_0xde43('0x12')],config[_0xde43('0x7')]['ip'],config['asterisk'][_0xde43('0xf')],util['inspect'](_0x27334f,![],null)));});ami['on']('fullybooted',function(_0x510693){logger['info'](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xde43('0x7')][_0xde43('0x12')],config['asterisk']['ip'],config['asterisk'][_0xde43('0xf')]));return BPromise[_0xde43('0x20')]()[_0xde43('0x21')](ami[_0xde43('0x22')]())['then'](ami[_0xde43('0x14')]())['then'](ami[_0xde43('0x23')]())[_0xde43('0x21')](ami['actionQueueSummary']())[_0xde43('0x21')](ami[_0xde43('0x18')]())[_0xde43('0x24')](function(_0x57b11b){console[_0xde43('0x25')](_0x57b11b);});});ami['once'](_0xde43('0xc'),error);ami['once'](_0xde43('0x1c'),close);module[_0xde43('0x26')]=ami; \ No newline at end of file +var _0xf8a8=['connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','actionCoreShowChannels','log','bluebird','moment','lodash','../../config/logger','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close'];(function(_0x118139,_0x7ce965){var _0x2fece9=function(_0xd145a4){while(--_0xd145a4){_0x118139['push'](_0x118139['shift']());}};_0x2fece9(++_0x7ce965);}(_0xf8a8,0x93));var _0x8f8a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf8a8[_0x1035c1];return _0x308d67;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x8f8a('0x0'));var moment=require(_0x8f8a('0x1'));var util=require('util');var _=require(_0x8f8a('0x2'));var logger=require(_0x8f8a('0x3'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x8f8a('0x4')][_0x8f8a('0x5')],config[_0x8f8a('0x4')]['ip'],config['asterisk'][_0x8f8a('0x6')],config[_0x8f8a('0x4')][_0x8f8a('0x7')],!![]);ami[_0x8f8a('0x8')]();ami[_0x8f8a('0x9')]=BPromise[_0x8f8a('0xa')](ami[_0x8f8a('0xb')]);function error(_0xf13744){logger[_0x8f8a('0xc')](util[_0x8f8a('0xd')](_0x8f8a('0xe'),config[_0x8f8a('0x4')][_0x8f8a('0x6')],config[_0x8f8a('0x4')]['ip'],config['asterisk'][_0x8f8a('0x5')],util[_0x8f8a('0xf')](_0xf13744,![],null)));}function close(){logger[_0x8f8a('0xc')](util[_0x8f8a('0xd')](_0x8f8a('0x10'),config['asterisk']['username'],config[_0x8f8a('0x4')]['ip'],config[_0x8f8a('0x4')]['port']));}ami[_0x8f8a('0x11')]=function(){return function(){return ami['Action']({'action':_0x8f8a('0x12')});};};ami[_0x8f8a('0x13')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x8f8a('0x14')]=function(){return function(){return ami[_0x8f8a('0x9')]({'action':_0x8f8a('0x15')});};};ami[_0x8f8a('0x16')]=function(){return function(){return ami[_0x8f8a('0x9')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x8f8a('0x9')]({'action':_0x8f8a('0x17')});};};function connect(_0x555e66){logger[_0x8f8a('0x18')](util[_0x8f8a('0xd')](_0x8f8a('0x19'),config['asterisk'][_0x8f8a('0x6')],config[_0x8f8a('0x4')]['ip'],config[_0x8f8a('0x4')][_0x8f8a('0x5')]));ami['once'](_0x8f8a('0xc'),error);ami[_0x8f8a('0x1a')](_0x8f8a('0x1b'),close);}ami['on'](_0x8f8a('0x1c'),connect);ami['on'](_0x8f8a('0x1d'),function(_0x236b21){logger[_0x8f8a('0x18')](util[_0x8f8a('0xd')](_0x8f8a('0x1e'),config[_0x8f8a('0x4')]['username'],config['asterisk']['ip'],config[_0x8f8a('0x4')][_0x8f8a('0x5')],util[_0x8f8a('0xf')](_0x236b21,![],null)));});ami['on']('fullybooted',function(_0x4d3497){logger[_0x8f8a('0x18')](util[_0x8f8a('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x8f8a('0x4')][_0x8f8a('0x6')],config[_0x8f8a('0x4')]['ip'],config[_0x8f8a('0x4')]['port']));return BPromise[_0x8f8a('0x1f')]()['then'](ami[_0x8f8a('0x11')]())[_0x8f8a('0x20')](ami[_0x8f8a('0x13')]())[_0x8f8a('0x20')](ami[_0x8f8a('0x14')]())[_0x8f8a('0x20')](ami[_0x8f8a('0x16')]())[_0x8f8a('0x20')](ami[_0x8f8a('0x21')]())['catch'](function(_0x193ea2){console[_0x8f8a('0x22')](_0x193ea2);});});ami['once'](_0x8f8a('0xc'),error);ami[_0x8f8a('0x1a')]('close',close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 517cc31..ffb5fcb 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 _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x107f31,_0x1bcd53){var _0x10560c=function(_0x5e1fc4){while(--_0x5e1fc4){_0x107f31['push'](_0x107f31['shift']());}};_0x10560c(++_0x1bcd53);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4a96c2,_0x310023){_0x4a96c2=_0x4a96c2-0x0;var _0x1f0d09=_0xb43b[_0x4a96c2];return _0x1f0d09;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb7e7[_0x2ec461];return _0x28603d;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index df904a4..006f1e1 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x603d=['prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','exports','util','lodash','moment','isNil','string','voiceQueue','name','phone','Contact','firstName','lastName','number','queue','type','dialQueueTimeout','scheduledat','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x603d,0x108));var _0xd603=function(_0xca4631,_0x52ec14){_0xca4631=_0xca4631-0x0;var _0x4d480a=_0x603d[_0xca4631];return _0x4d480a;};'use strict';var util=require(_0xd603('0x0'));var _=require(_0xd603('0x1'));var moment=require(_0xd603('0x2'));function checkNameSurname(_0x357fa5,_0x48eb96,_0x1138d7){var _0x46b149='';if(!_[_0xd603('0x3')](_0x48eb96)&&_0xd603('0x4')===typeof _0x48eb96){_0x46b149+=_0x48eb96;}if(!_[_0xd603('0x3')](_0x1138d7)&&_0xd603('0x4')===typeof _0x1138d7){_0x46b149+='\x20'+_0x1138d7;}if(_0x46b149!==''){return _0x46b149;}return _0x357fa5;}function Action(_0x426c4d,_0x922f60,_0x4d4382){this[_0xd603('0x5')]=_0x426c4d;this['uniqueid']=_0x4d4382||undefined;this[_0xd603('0x6')]=checkNameSurname(_0x922f60['Contact'][_0xd603('0x7')],_0x922f60[_0xd603('0x8')][_0xd603('0x9')],_0x922f60[_0xd603('0x8')][_0xd603('0xa')]);this[_0xd603('0xb')]=_0x922f60[_0xd603('0x8')][_0xd603('0x7')];this[_0xd603('0xc')]=_0x426c4d[_0xd603('0x6')];this['active']=_0x922f60['active']||![];this[_0xd603('0xd')]=_0x426c4d[_0xd603('0xd')];this[_0xd603('0xe')]=_0x426c4d[_0xd603('0xe')]||0x3;this[_0xd603('0xf')]=_0x922f60[_0xd603('0xf')];this['countbusyretry']=_0x922f60['countbusyretry'];this['countcongestionretry']=_0x922f60['countcongestionretry'];this[_0xd603('0x10')]=_0x922f60[_0xd603('0x10')];this[_0xd603('0x11')]=_0x922f60['countnosuchnumberretry'];this['countdropretry']=_0x922f60[_0xd603('0x12')];this[_0xd603('0x13')]=_0x922f60['countabandonedretry'];this['countmachineretry']=_0x922f60[_0xd603('0x14')];this[_0xd603('0x15')]=_0x922f60[_0xd603('0x15')];this['ContactId']=_0x922f60['ContactId'];this['ListId']=_0x922f60[_0xd603('0x16')];this[_0xd603('0x17')]=_0x922f60[_0xd603('0x17')];this['VoiceQueueId']=_0x922f60['VoiceQueueId'];this['CampaignId']=_0x922f60['CampaignId'];this['idHopper']=_0x922f60['id'];this[_0xd603('0x18')]=_0x922f60[_0xd603('0x8')][_0xd603('0x9')]||'';this['starttime']=moment()[_0xd603('0x19')](_0xd603('0x1a'));this[_0xd603('0x1b')]=_0x922f60[_0xd603('0x1b')];this[_0xd603('0x1c')]=_0x922f60[_0xd603('0x1c')];this[_0xd603('0x1d')]=_0x922f60['callbackat'];this[_0xd603('0x1e')]=_0x922f60[_0xd603('0x1e')];this[_0xd603('0x1f')]='';this['originatecalleridname']='';}Action[_0xd603('0x20')][_0xd603('0x21')]=function(){return util[_0xd603('0x19')](_0xd603('0x22'),this['name'],this[_0xd603('0x5')][_0xd603('0x23')]>0x0?this[_0xd603('0xb')]['substring'](this['voiceQueue'][_0xd603('0x23')]):this[_0xd603('0xb')]);};Action[_0xd603('0x20')]['getQueue']=function(){return this[_0xd603('0xc')];};module[_0xd603('0x24')]=Action; \ No newline at end of file +var _0x7ec3=['callbackat','recallme','originatecalleridname','prototype','getCaller','format','number','substring','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','lastName','queue','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','idHopper','ContactFirstName','firstName','starttime','callback','callbackuniqueid'];(function(_0x546de3,_0x59d56c){var _0x2f7a9d=function(_0x58094e){while(--_0x58094e){_0x546de3['push'](_0x546de3['shift']());}};_0x2f7a9d(++_0x59d56c);}(_0x7ec3,0x1b6));var _0x37ec=function(_0x445986,_0x350b69){_0x445986=_0x445986-0x0;var _0x586acd=_0x7ec3[_0x445986];return _0x586acd;};'use strict';var util=require(_0x37ec('0x0'));var _=require('lodash');var moment=require(_0x37ec('0x1'));function checkNameSurname(_0x1fcac2,_0x5a4bbe,_0x488225){var _0x49c099='';if(!_[_0x37ec('0x2')](_0x5a4bbe)&&_0x37ec('0x3')===typeof _0x5a4bbe){_0x49c099+=_0x5a4bbe;}if(!_['isNil'](_0x488225)&&_0x37ec('0x3')===typeof _0x488225){_0x49c099+='\x20'+_0x488225;}if(_0x49c099!==''){return _0x49c099;}return _0x1fcac2;}function Action(_0x540dad,_0x5cc692,_0x1fc2ba){this[_0x37ec('0x4')]=_0x540dad;this[_0x37ec('0x5')]=_0x1fc2ba||undefined;this[_0x37ec('0x6')]=checkNameSurname(_0x5cc692[_0x37ec('0x7')]['phone'],_0x5cc692[_0x37ec('0x7')]['firstName'],_0x5cc692['Contact'][_0x37ec('0x8')]);this['number']=_0x5cc692['Contact']['phone'];this[_0x37ec('0x9')]=_0x540dad[_0x37ec('0x6')];this['active']=_0x5cc692[_0x37ec('0xa')]||![];this[_0x37ec('0xb')]=_0x540dad[_0x37ec('0xb')];this['dialQueueTimeout']=_0x540dad['dialQueueTimeout']||0x3;this[_0x37ec('0xc')]=_0x5cc692[_0x37ec('0xc')];this[_0x37ec('0xd')]=_0x5cc692['countbusyretry'];this[_0x37ec('0xe')]=_0x5cc692['countcongestionretry'];this[_0x37ec('0xf')]=_0x5cc692[_0x37ec('0xf')];this[_0x37ec('0x10')]=_0x5cc692['countnosuchnumberretry'];this['countdropretry']=_0x5cc692[_0x37ec('0x11')];this[_0x37ec('0x12')]=_0x5cc692[_0x37ec('0x12')];this['countmachineretry']=_0x5cc692['countmachineretry'];this[_0x37ec('0x13')]=_0x5cc692[_0x37ec('0x13')];this[_0x37ec('0x14')]=_0x5cc692[_0x37ec('0x14')];this[_0x37ec('0x15')]=_0x5cc692[_0x37ec('0x15')];this[_0x37ec('0x16')]=_0x5cc692[_0x37ec('0x16')];this['VoiceQueueId']=_0x5cc692['VoiceQueueId'];this[_0x37ec('0x17')]=_0x5cc692[_0x37ec('0x17')];this[_0x37ec('0x18')]=_0x5cc692['id'];this[_0x37ec('0x19')]=_0x5cc692[_0x37ec('0x7')][_0x37ec('0x1a')]||'';this[_0x37ec('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x37ec('0x1c')]=_0x5cc692[_0x37ec('0x1c')];this[_0x37ec('0x1d')]=_0x5cc692[_0x37ec('0x1d')];this[_0x37ec('0x1e')]=_0x5cc692[_0x37ec('0x1e')];this[_0x37ec('0x1f')]=_0x5cc692[_0x37ec('0x1f')];this['originatecalleridnum']='';this[_0x37ec('0x20')]='';}Action[_0x37ec('0x21')][_0x37ec('0x22')]=function(){return util[_0x37ec('0x23')]('\x22%s\x22\x20<%s>',this['name'],this[_0x37ec('0x4')]['dialCutDigit']>0x0?this[_0x37ec('0x24')][_0x37ec('0x25')](this['voiceQueue']['dialCutDigit']):this[_0x37ec('0x24')]);};Action[_0x37ec('0x21')]['getQueue']=function(){return this['queue'];};module[_0x37ec('0x26')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index fd32471..d17381e 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c03=['calleridnum','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','answertime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0x8c03,0x152));var _0x38c0=function(_0x28bbb8,_0x18b705){_0x28bbb8=_0x28bbb8-0x0;var _0x53d6cf=_0x8c03[_0x28bbb8];return _0x53d6cf;};'use strict';var util=require(_0x38c0('0x0'));var _=require('lodash');var moment=require(_0x38c0('0x1'));function getSeconds(_0x5c69ff,_0x580c17){var _0xed94f2=moment(_0x5c69ff)[_0x38c0('0x2')](0x0);var _0x3aa10e=moment(_0x580c17)[_0x38c0('0x2')](0x0);return _0xed94f2[_0x38c0('0x3')](_0x3aa10e,'seconds');}function AgentComplete(_0xff0f43,_0x3a8c22){this['state']=0x4;this[_0x38c0('0x4')]=_0x38c0('0x5');this['scheduledat']=_0xff0f43[_0x38c0('0x6')];this[_0x38c0('0x7')]=_0xff0f43[_0x38c0('0x7')];this[_0x38c0('0x8')]=_0xff0f43[_0x38c0('0x7')]===_0x38c0('0x9')?_0x38c0('0xa'):_0xff0f43['type'];this[_0x38c0('0xb')]=_0xff0f43[_0x38c0('0xb')];this[_0x38c0('0xc')]=_0xff0f43[_0x38c0('0xc')];this[_0x38c0('0xd')]=_0xff0f43[_0x38c0('0xd')];this[_0x38c0('0xe')]=_0xff0f43[_0x38c0('0xb')]+_0xff0f43['countcongestionretry']+_0xff0f43[_0x38c0('0xd')]+_0xff0f43[_0x38c0('0xf')]+_0xff0f43[_0x38c0('0x10')]+_0xff0f43[_0x38c0('0x11')]+_0xff0f43['countmachineretry']+_0xff0f43[_0x38c0('0x12')];this[_0x38c0('0xf')]=_0xff0f43[_0x38c0('0xf')];this[_0x38c0('0x10')]=_0xff0f43[_0x38c0('0x10')];this[_0x38c0('0x11')]=_0xff0f43[_0x38c0('0x11')];this[_0x38c0('0x13')]=_0xff0f43['countmachineretry'];this[_0x38c0('0x12')]=_0xff0f43[_0x38c0('0x12')];this[_0x38c0('0x14')]=_0x3a8c22[_0x38c0('0x14')];this['calleridname']=_0xff0f43[_0x38c0('0x15')];this[_0x38c0('0x16')]=_0xff0f43['number'];this[_0x38c0('0x17')]=_0xff0f43['starttime'];this['responsetime']=_0xff0f43['responsetime'];this['answertime']=_0xff0f43['answertime'];this[_0x38c0('0x18')]=moment()[_0x38c0('0x19')](_0x38c0('0x1a'));this[_0x38c0('0x1b')]=getSeconds(_0xff0f43[_0x38c0('0x1c')],_0xff0f43[_0x38c0('0x17')]);this[_0x38c0('0x1d')]=getSeconds(_0xff0f43[_0x38c0('0x1e')],_0xff0f43[_0x38c0('0x1c')]);this[_0x38c0('0x1f')]=getSeconds(this['endtime'],_0xff0f43[_0x38c0('0x1e')]);this['queue']=_0x3a8c22['queue'];this['membername']=_0x3a8c22[_0x38c0('0x20')];this[_0x38c0('0x21')]=_0x3a8c22['reason'];this[_0x38c0('0x22')]=_0xff0f43[_0x38c0('0x22')];this['callbackuniqueid']=_0xff0f43[_0x38c0('0x23')];this[_0x38c0('0x24')]=_0xff0f43[_0x38c0('0x24')];this[_0x38c0('0x25')]=_0xff0f43[_0x38c0('0x25')];this[_0x38c0('0x26')]=_0xff0f43[_0x38c0('0x26')];this[_0x38c0('0x27')]=_0xff0f43['ListId'];this[_0x38c0('0x28')]=_0xff0f43['UserId'];this[_0x38c0('0x29')]=_0xff0f43['VoiceQueueId'];this['CampaignId']=_0xff0f43[_0x38c0('0x2a')];this[_0x38c0('0x2b')]=_0xff0f43['originatecalleridnum']||'';this['originatecalleridname']=_0xff0f43[_0x38c0('0x2c')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xfa91=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x3bf931,_0x43865d){var _0x213d85=function(_0x5550b9){while(--_0x5550b9){_0x3bf931['push'](_0x3bf931['shift']());}};_0x213d85(++_0x43865d);}(_0xfa91,0x1cd));var _0x1fa9=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xfa91[_0x5317b5];return _0x3b7ce2;};'use strict';var util=require(_0x1fa9('0x0'));var _=require(_0x1fa9('0x1'));var moment=require(_0x1fa9('0x2'));function getSeconds(_0x3dc31d,_0x5cd1f5){var _0x504c27=moment(_0x3dc31d)[_0x1fa9('0x3')](0x0);var _0x33a1d3=moment(_0x5cd1f5)[_0x1fa9('0x3')](0x0);return _0x504c27['diff'](_0x33a1d3,_0x1fa9('0x4'));}function AgentComplete(_0x359f40,_0x364954){this[_0x1fa9('0x5')]=0x4;this[_0x1fa9('0x6')]=_0x1fa9('0x7');this[_0x1fa9('0x8')]=_0x359f40[_0x1fa9('0x8')];this[_0x1fa9('0x9')]=_0x359f40['type'];this['campaigntype']=_0x359f40[_0x1fa9('0x9')]===_0x1fa9('0xa')?'queue':_0x359f40[_0x1fa9('0x9')];this[_0x1fa9('0xb')]=_0x359f40[_0x1fa9('0xb')];this['countcongestionretry']=_0x359f40[_0x1fa9('0xc')];this[_0x1fa9('0xd')]=_0x359f40[_0x1fa9('0xd')];this['countglobal']=_0x359f40[_0x1fa9('0xb')]+_0x359f40[_0x1fa9('0xc')]+_0x359f40[_0x1fa9('0xd')]+_0x359f40[_0x1fa9('0xe')]+_0x359f40[_0x1fa9('0xf')]+_0x359f40[_0x1fa9('0x10')]+_0x359f40[_0x1fa9('0x11')]+_0x359f40[_0x1fa9('0x12')];this[_0x1fa9('0xe')]=_0x359f40[_0x1fa9('0xe')];this[_0x1fa9('0xf')]=_0x359f40[_0x1fa9('0xf')];this[_0x1fa9('0x10')]=_0x359f40[_0x1fa9('0x10')];this[_0x1fa9('0x11')]=_0x359f40[_0x1fa9('0x11')];this[_0x1fa9('0x12')]=_0x359f40[_0x1fa9('0x12')];this[_0x1fa9('0x13')]=_0x364954['uniqueid'];this[_0x1fa9('0x14')]=_0x359f40[_0x1fa9('0x15')];this[_0x1fa9('0x16')]=_0x359f40[_0x1fa9('0x17')];this[_0x1fa9('0x18')]=_0x359f40[_0x1fa9('0x18')];this['responsetime']=_0x359f40[_0x1fa9('0x19')];this['answertime']=_0x359f40[_0x1fa9('0x1a')];this['endtime']=moment()[_0x1fa9('0x1b')](_0x1fa9('0x1c'));this[_0x1fa9('0x1d')]=getSeconds(_0x359f40[_0x1fa9('0x19')],_0x359f40[_0x1fa9('0x18')]);this[_0x1fa9('0x1e')]=getSeconds(_0x359f40['answertime'],_0x359f40[_0x1fa9('0x19')]);this[_0x1fa9('0x1f')]=getSeconds(this[_0x1fa9('0x20')],_0x359f40[_0x1fa9('0x1a')]);this[_0x1fa9('0x21')]=_0x364954[_0x1fa9('0x21')];this[_0x1fa9('0x22')]=_0x364954[_0x1fa9('0x22')];this['reason']=_0x364954[_0x1fa9('0x23')];this[_0x1fa9('0x24')]=_0x359f40[_0x1fa9('0x24')];this[_0x1fa9('0x25')]=_0x359f40[_0x1fa9('0x25')];this[_0x1fa9('0x26')]=_0x359f40[_0x1fa9('0x26')];this['recallme']=_0x359f40[_0x1fa9('0x27')];this[_0x1fa9('0x28')]=_0x359f40[_0x1fa9('0x28')];this[_0x1fa9('0x29')]=_0x359f40[_0x1fa9('0x29')];this[_0x1fa9('0x2a')]=_0x359f40[_0x1fa9('0x2a')];this[_0x1fa9('0x2b')]=_0x359f40[_0x1fa9('0x2b')];this[_0x1fa9('0x2c')]=_0x359f40[_0x1fa9('0x2c')];this['originatecalleridnum']=_0x359f40[_0x1fa9('0x2d')]||'';this[_0x1fa9('0x2e')]=_0x359f40[_0x1fa9('0x2e')]||'';}module[_0x1fa9('0x2f')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 03f24b0..0758abc 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23f4=['countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry'];(function(_0x587051,_0x295a37){var _0x56dfa3=function(_0x5b04a3){while(--_0x5b04a3){_0x587051['push'](_0x587051['shift']());}};_0x56dfa3(++_0x295a37);}(_0x23f4,0x1ee));var _0x423f=function(_0x24730b,_0x381c37){_0x24730b=_0x24730b-0x0;var _0x3e2b07=_0x23f4[_0x24730b];return _0x3e2b07;};'use strict';var util=require('util');var _=require(_0x423f('0x0'));var moment=require('moment');function getSeconds(_0x5813cb,_0x409cd1){var _0xc151c6=moment(_0x5813cb)[_0x423f('0x1')](0x0);var _0x3503a0=moment(_0x409cd1)[_0x423f('0x1')](0x0);return _0xc151c6[_0x423f('0x2')](_0x3503a0,_0x423f('0x3'));}function Final(_0x384d72){this[_0x423f('0x4')]=_0x384d72['uniqueid'];this[_0x423f('0x5')]=_0x384d72[_0x423f('0x5')];this['type']=_0x384d72[_0x423f('0x6')];this[_0x423f('0x7')]=_0x384d72[_0x423f('0x6')]==='outbound'?'queue':_0x384d72['type'];this[_0x423f('0x8')]=_0x384d72['countbusyretry'];this[_0x423f('0x9')]=_0x384d72[_0x423f('0x9')];this[_0x423f('0xa')]=_0x384d72[_0x423f('0xa')];this['countglobal']=_0x384d72[_0x423f('0x8')]+_0x384d72[_0x423f('0x9')]+_0x384d72[_0x423f('0xa')]+_0x384d72[_0x423f('0xb')]+_0x384d72[_0x423f('0xc')]+_0x384d72['countabandonedretry']+_0x384d72[_0x423f('0xd')]+_0x384d72[_0x423f('0xe')];this[_0x423f('0xb')]=_0x384d72[_0x423f('0xb')];this[_0x423f('0xc')]=_0x384d72[_0x423f('0xc')];this[_0x423f('0xf')]=_0x384d72[_0x423f('0xf')];this[_0x423f('0xd')]=_0x384d72[_0x423f('0xd')];this[_0x423f('0xe')]=_0x384d72[_0x423f('0xe')];this[_0x423f('0x10')]=_0x384d72[_0x423f('0x10')];this[_0x423f('0x11')]=_0x384d72[_0x423f('0x11')];this[_0x423f('0x12')]=_0x384d72[_0x423f('0x12')];this[_0x423f('0x13')]=_0x384d72['starttime'];this[_0x423f('0x14')]=_0x384d72['responsetime'];this['endtime']=_0x384d72[_0x423f('0x14')];this['ringtime']=_0x384d72[_0x423f('0x15')]||0x0;this[_0x423f('0x16')]=_0x384d72['holdtime']||0x0;this[_0x423f('0x17')]=_0x384d72[_0x423f('0x17')]||0x0;this['callback']=_0x384d72[_0x423f('0x18')];this[_0x423f('0x19')]=_0x384d72['callbackuniqueid'];this[_0x423f('0x1a')]=_0x384d72[_0x423f('0x1a')];this['recallme']=_0x384d72[_0x423f('0x1b')];this['ContactId']=_0x384d72[_0x423f('0x1c')];this[_0x423f('0x1d')]=_0x384d72[_0x423f('0x1d')];this[_0x423f('0x1e')]=_0x384d72[_0x423f('0x1e')];this[_0x423f('0x1f')]=_0x384d72[_0x423f('0x1f')];this[_0x423f('0x20')]=_0x384d72[_0x423f('0x20')];this[_0x423f('0x21')]=_0x384d72[_0x423f('0x21')]||'';this[_0x423f('0x22')]=_0x384d72[_0x423f('0x22')]||'';}module[_0x423f('0x23')]=Final; \ No newline at end of file +var _0x08d9=['moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util'];(function(_0x168bfd,_0x5cbeb0){var _0x234619=function(_0x2c3dfe){while(--_0x2c3dfe){_0x168bfd['push'](_0x168bfd['shift']());}};_0x234619(++_0x5cbeb0);}(_0x08d9,0xc2));var _0x908d=function(_0xe6199b,_0x3a36f2){_0xe6199b=_0xe6199b-0x0;var _0x30da80=_0x08d9[_0xe6199b];return _0x30da80;};'use strict';var util=require(_0x908d('0x0'));var _=require('lodash');var moment=require(_0x908d('0x1'));function getSeconds(_0x488ec0,_0x1557c3){var _0x739218=moment(_0x488ec0)[_0x908d('0x2')](0x0);var _0x5228dd=moment(_0x1557c3)['milliseconds'](0x0);return _0x739218[_0x908d('0x3')](_0x5228dd,_0x908d('0x4'));}function Final(_0x1fa63e){this[_0x908d('0x5')]=_0x1fa63e[_0x908d('0x5')];this['scheduledat']=_0x1fa63e[_0x908d('0x6')];this[_0x908d('0x7')]=_0x1fa63e[_0x908d('0x7')];this[_0x908d('0x8')]=_0x1fa63e[_0x908d('0x7')]===_0x908d('0x9')?_0x908d('0xa'):_0x1fa63e[_0x908d('0x7')];this[_0x908d('0xb')]=_0x1fa63e[_0x908d('0xb')];this['countcongestionretry']=_0x1fa63e[_0x908d('0xc')];this[_0x908d('0xd')]=_0x1fa63e[_0x908d('0xd')];this[_0x908d('0xe')]=_0x1fa63e[_0x908d('0xb')]+_0x1fa63e['countcongestionretry']+_0x1fa63e['countnoanswerretry']+_0x1fa63e['countnosuchnumberretry']+_0x1fa63e[_0x908d('0xf')]+_0x1fa63e[_0x908d('0x10')]+_0x1fa63e[_0x908d('0x11')]+_0x1fa63e[_0x908d('0x12')];this[_0x908d('0x13')]=_0x1fa63e[_0x908d('0x13')];this[_0x908d('0xf')]=_0x1fa63e['countdropretry'];this['countabandonedretry']=_0x1fa63e[_0x908d('0x10')];this[_0x908d('0x11')]=_0x1fa63e[_0x908d('0x11')];this[_0x908d('0x12')]=_0x1fa63e['countagentrejectretry'];this['queue']=_0x1fa63e[_0x908d('0xa')];this[_0x908d('0x14')]=_0x1fa63e[_0x908d('0x14')];this[_0x908d('0x15')]=_0x1fa63e['calleridnum'];this[_0x908d('0x16')]=_0x1fa63e[_0x908d('0x16')];this[_0x908d('0x17')]=_0x1fa63e[_0x908d('0x17')];this[_0x908d('0x18')]=_0x1fa63e[_0x908d('0x17')];this[_0x908d('0x19')]=_0x1fa63e['ringtime']||0x0;this[_0x908d('0x1a')]=_0x1fa63e[_0x908d('0x1a')]||0x0;this[_0x908d('0x1b')]=_0x1fa63e['talktime']||0x0;this[_0x908d('0x1c')]=_0x1fa63e[_0x908d('0x1c')];this[_0x908d('0x1d')]=_0x1fa63e[_0x908d('0x1d')];this[_0x908d('0x1e')]=_0x1fa63e['callbackat'];this[_0x908d('0x1f')]=_0x1fa63e['recallme'];this[_0x908d('0x20')]=_0x1fa63e[_0x908d('0x20')];this[_0x908d('0x21')]=_0x1fa63e[_0x908d('0x21')];this[_0x908d('0x22')]=_0x1fa63e[_0x908d('0x22')];this[_0x908d('0x23')]=_0x1fa63e[_0x908d('0x23')];this['CampaignId']=_0x1fa63e[_0x908d('0x24')];this[_0x908d('0x25')]=_0x1fa63e[_0x908d('0x25')]||'';this[_0x908d('0x26')]=_0x1fa63e[_0x908d('0x26')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 34a4ce7..b1d7789 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9156=['YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','reason','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format'];(function(_0x17a094,_0x328f49){var _0x20c5b7=function(_0xcf7e6d){while(--_0xcf7e6d){_0x17a094['push'](_0x17a094['shift']());}};_0x20c5b7(++_0x328f49);}(_0x9156,0x194));var _0x6915=function(_0x12d26c,_0x5ef8e6){_0x12d26c=_0x12d26c-0x0;var _0x3a1f4a=_0x9156[_0x12d26c];return _0x3a1f4a;};'use strict';var util=require(_0x6915('0x0'));var _=require(_0x6915('0x1'));var moment=require('moment');function getSeconds(_0x163c3c,_0x254eb3){var _0x5420de=moment(_0x163c3c)['milliseconds'](0x0);var _0x5b4e1e=moment(_0x254eb3)[_0x6915('0x2')](0x0);return _0x5420de[_0x6915('0x3')](_0x5b4e1e,_0x6915('0x4'));}function Hangup(_0x493f4a,_0x24e560){this['state']=0x4;this['statedesc']='Answer';this[_0x6915('0x5')]=_0x493f4a[_0x6915('0x5')];this[_0x6915('0x6')]=_0x493f4a[_0x6915('0x6')];this[_0x6915('0x7')]=_0x493f4a[_0x6915('0x6')]===_0x6915('0x8')?_0x6915('0x9'):_0x493f4a[_0x6915('0x6')];this[_0x6915('0xa')]=_0x493f4a[_0x6915('0xa')];this[_0x6915('0xb')]=_0x493f4a[_0x6915('0xb')];this[_0x6915('0xc')]=_0x493f4a[_0x6915('0xc')];this['countglobal']=_0x493f4a[_0x6915('0xa')]+_0x493f4a[_0x6915('0xb')]+_0x493f4a[_0x6915('0xc')]+_0x493f4a[_0x6915('0xd')]+_0x493f4a[_0x6915('0xe')]+_0x493f4a[_0x6915('0xf')]+_0x493f4a[_0x6915('0x10')]+_0x493f4a[_0x6915('0x11')];this['countnosuchnumberretry']=_0x493f4a['countnosuchnumberretry'];this['countdropretry']=_0x493f4a[_0x6915('0xe')];this[_0x6915('0xf')]=_0x493f4a[_0x6915('0xf')];this['countmachineretry']=_0x493f4a[_0x6915('0x10')];this[_0x6915('0x11')]=_0x493f4a['countagentrejectretry'];this[_0x6915('0x12')]=_0x24e560[_0x6915('0x12')];this[_0x6915('0x13')]=_0x493f4a[_0x6915('0x14')];this[_0x6915('0x15')]=_0x493f4a[_0x6915('0x16')];this['starttime']=_0x493f4a[_0x6915('0x17')];this[_0x6915('0x18')]=_0x493f4a[_0x6915('0x18')];this['endtime']=moment()[_0x6915('0x19')](_0x6915('0x1a'));this[_0x6915('0x1b')]=getSeconds(_0x493f4a[_0x6915('0x18')],_0x493f4a[_0x6915('0x17')]);this[_0x6915('0x1c')]=0x0;this[_0x6915('0x1d')]=getSeconds(this[_0x6915('0x1e')],_0x493f4a[_0x6915('0x18')]);this[_0x6915('0x9')]=_0x493f4a[_0x6915('0x9')];this[_0x6915('0x1f')]='IVR';this[_0x6915('0x20')]=_0x24e560[_0x6915('0x21')];this['callback']=_0x493f4a['callback'];this[_0x6915('0x22')]=_0x493f4a[_0x6915('0x22')];this[_0x6915('0x23')]=_0x493f4a[_0x6915('0x23')];this[_0x6915('0x24')]=_0x493f4a[_0x6915('0x24')];this[_0x6915('0x25')]=_0x493f4a[_0x6915('0x25')];this['ListId']=_0x493f4a[_0x6915('0x26')];this[_0x6915('0x27')]=_0x493f4a[_0x6915('0x27')];this[_0x6915('0x28')]=_0x493f4a[_0x6915('0x28')];this[_0x6915('0x29')]=_0x493f4a['CampaignId'];}module[_0x6915('0x2a')]=Hangup; \ No newline at end of file +var _0xb017=['VoiceQueueId','CampaignId','exports','milliseconds','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','name','calleridnum','number','starttime','responsetime','endtime','format','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId'];(function(_0x3ed909,_0x33d446){var _0x82ed00=function(_0x379eb4){while(--_0x379eb4){_0x3ed909['push'](_0x3ed909['shift']());}};_0x82ed00(++_0x33d446);}(_0xb017,0x13e));var _0x7b01=function(_0x2281f8,_0x16c669){_0x2281f8=_0x2281f8-0x0;var _0x53064a=_0xb017[_0x2281f8];return _0x53064a;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x3dcbc0,_0x445d20){var _0x3b2382=moment(_0x3dcbc0)[_0x7b01('0x0')](0x0);var _0x1d4b97=moment(_0x445d20)[_0x7b01('0x0')](0x0);return _0x3b2382['diff'](_0x1d4b97,'seconds');}function Hangup(_0x497261,_0xa67a63){this['state']=0x4;this[_0x7b01('0x1')]='Answer';this[_0x7b01('0x2')]=_0x497261[_0x7b01('0x2')];this[_0x7b01('0x3')]=_0x497261[_0x7b01('0x3')];this[_0x7b01('0x4')]=_0x497261[_0x7b01('0x3')]==='outbound'?_0x7b01('0x5'):_0x497261['type'];this[_0x7b01('0x6')]=_0x497261[_0x7b01('0x6')];this[_0x7b01('0x7')]=_0x497261[_0x7b01('0x7')];this[_0x7b01('0x8')]=_0x497261[_0x7b01('0x8')];this['countglobal']=_0x497261[_0x7b01('0x6')]+_0x497261[_0x7b01('0x7')]+_0x497261[_0x7b01('0x8')]+_0x497261['countnosuchnumberretry']+_0x497261[_0x7b01('0x9')]+_0x497261[_0x7b01('0xa')]+_0x497261['countmachineretry']+_0x497261[_0x7b01('0xb')];this['countnosuchnumberretry']=_0x497261[_0x7b01('0xc')];this[_0x7b01('0x9')]=_0x497261[_0x7b01('0x9')];this['countabandonedretry']=_0x497261['countabandonedretry'];this['countmachineretry']=_0x497261[_0x7b01('0xd')];this[_0x7b01('0xb')]=_0x497261['countagentrejectretry'];this['uniqueid']=_0xa67a63['uniqueid'];this['calleridname']=_0x497261[_0x7b01('0xe')];this[_0x7b01('0xf')]=_0x497261[_0x7b01('0x10')];this[_0x7b01('0x11')]=_0x497261['starttime'];this[_0x7b01('0x12')]=_0x497261['responsetime'];this[_0x7b01('0x13')]=moment()[_0x7b01('0x14')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x497261[_0x7b01('0x12')],_0x497261['starttime']);this[_0x7b01('0x15')]=0x0;this[_0x7b01('0x16')]=getSeconds(this[_0x7b01('0x13')],_0x497261[_0x7b01('0x12')]);this['queue']=_0x497261[_0x7b01('0x5')];this[_0x7b01('0x17')]='IVR';this[_0x7b01('0x18')]=_0xa67a63[_0x7b01('0x19')];this[_0x7b01('0x1a')]=_0x497261[_0x7b01('0x1a')];this[_0x7b01('0x1b')]=_0x497261[_0x7b01('0x1b')];this[_0x7b01('0x1c')]=_0x497261['callbackat'];this['recallme']=_0x497261['recallme'];this[_0x7b01('0x1d')]=_0x497261[_0x7b01('0x1d')];this[_0x7b01('0x1e')]=_0x497261[_0x7b01('0x1e')];this[_0x7b01('0x1f')]=_0x497261[_0x7b01('0x1f')];this[_0x7b01('0x20')]=_0x497261['VoiceQueueId'];this[_0x7b01('0x21')]=_0x497261[_0x7b01('0x21')];}module[_0x7b01('0x22')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 2a55687..4d6029e 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x542d=['callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x7ec937,_0xbe3b08){var _0x150040=function(_0x4a5d8e){while(--_0x4a5d8e){_0x7ec937['push'](_0x7ec937['shift']());}};_0x150040(++_0xbe3b08);}(_0x542d,0x9b));var _0xd542=function(_0x1a8907,_0x4a73fd){_0x1a8907=_0x1a8907-0x0;var _0x47258a=_0x542d[_0x1a8907];return _0x47258a;};'use strict';var util=require(_0xd542('0x0'));var _=require('lodash');var moment=require(_0xd542('0x1'));function getSeconds(_0x4713ec,_0x284e98){var _0x522033=moment(_0x4713ec)[_0xd542('0x2')](0x0);var _0x58d515=moment(_0x284e98)[_0xd542('0x2')](0x0);return _0x522033[_0xd542('0x3')](_0x58d515,_0xd542('0x4'));}function History(_0x5e8b20){this[_0xd542('0x5')]=_0x5e8b20['uniqueid'];this['scheduledat']=_0x5e8b20[_0xd542('0x6')]||undefined;this['type']=_0x5e8b20[_0xd542('0x7')];this[_0xd542('0x8')]=_0x5e8b20[_0xd542('0x7')]===_0xd542('0x9')?_0xd542('0xa'):_0x5e8b20[_0xd542('0x7')];this[_0xd542('0xb')]=_0x5e8b20['countbusyretry'];this[_0xd542('0xc')]=_0x5e8b20[_0xd542('0xc')];this['countnoanswerretry']=_0x5e8b20['countnoanswerretry'];this[_0xd542('0xd')]=_0x5e8b20[_0xd542('0xb')]+_0x5e8b20[_0xd542('0xc')]+_0x5e8b20['countnoanswerretry']+_0x5e8b20[_0xd542('0xe')]+_0x5e8b20[_0xd542('0xf')]+_0x5e8b20['countabandonedretry']+_0x5e8b20[_0xd542('0x10')]+_0x5e8b20[_0xd542('0x11')];this[_0xd542('0xe')]=_0x5e8b20[_0xd542('0xe')];this[_0xd542('0xf')]=_0x5e8b20['countdropretry'];this[_0xd542('0x12')]=_0x5e8b20[_0xd542('0x12')];this[_0xd542('0x10')]=_0x5e8b20['countmachineretry'];this[_0xd542('0x11')]=_0x5e8b20[_0xd542('0x11')];this[_0xd542('0xa')]=_0x5e8b20['queue'];this[_0xd542('0x13')]=_0x5e8b20[_0xd542('0x14')];this['calleridnum']=_0x5e8b20[_0xd542('0x15')];this['starttime']=_0x5e8b20[_0xd542('0x16')];this[_0xd542('0x17')]=_0x5e8b20['responsetime'];this[_0xd542('0x18')]=_0x5e8b20[_0xd542('0x17')];this[_0xd542('0x19')]=getSeconds(_0x5e8b20['responsetime'],_0x5e8b20['starttime']);this[_0xd542('0x1a')]=0x0;this[_0xd542('0x1b')]=0x0;this[_0xd542('0x1c')]=_0x5e8b20[_0xd542('0x1c')];this[_0xd542('0x1d')]=_0x5e8b20[_0xd542('0x1d')];this[_0xd542('0x1e')]=_0x5e8b20[_0xd542('0x1e')];this[_0xd542('0x1f')]=_0x5e8b20['recallme'];this['ContactId']=_0x5e8b20['ContactId'];this[_0xd542('0x20')]=_0x5e8b20[_0xd542('0x20')];this[_0xd542('0x21')]=_0x5e8b20[_0xd542('0x21')];this[_0xd542('0x22')]=_0x5e8b20[_0xd542('0x22')];this['CampaignId']=_0x5e8b20['CampaignId'];this[_0xd542('0x23')]=_0x5e8b20[_0xd542('0x23')]||'';this[_0xd542('0x24')]=_0x5e8b20[_0xd542('0x24')]||'';}module['exports']=History; \ No newline at end of file +var _0x8b33=['countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x688ca3,_0x1389c5){var _0x572f09=function(_0x8f5ca2){while(--_0x8f5ca2){_0x688ca3['push'](_0x688ca3['shift']());}};_0x572f09(++_0x1389c5);}(_0x8b33,0x12f));var _0x38b3=function(_0x13fe97,_0x3e94dc){_0x13fe97=_0x13fe97-0x0;var _0x18833f=_0x8b33[_0x13fe97];return _0x18833f;};'use strict';var util=require(_0x38b3('0x0'));var _=require(_0x38b3('0x1'));var moment=require('moment');function getSeconds(_0x25b51e,_0x5b2876){var _0x53857d=moment(_0x25b51e)['milliseconds'](0x0);var _0xa07359=moment(_0x5b2876)[_0x38b3('0x2')](0x0);return _0x53857d[_0x38b3('0x3')](_0xa07359,_0x38b3('0x4'));}function History(_0x5206b4){this[_0x38b3('0x5')]=_0x5206b4['uniqueid'];this[_0x38b3('0x6')]=_0x5206b4[_0x38b3('0x6')]||undefined;this[_0x38b3('0x7')]=_0x5206b4[_0x38b3('0x7')];this[_0x38b3('0x8')]=_0x5206b4['type']===_0x38b3('0x9')?_0x38b3('0xa'):_0x5206b4[_0x38b3('0x7')];this[_0x38b3('0xb')]=_0x5206b4['countbusyretry'];this[_0x38b3('0xc')]=_0x5206b4[_0x38b3('0xc')];this[_0x38b3('0xd')]=_0x5206b4[_0x38b3('0xd')];this[_0x38b3('0xe')]=_0x5206b4['countbusyretry']+_0x5206b4[_0x38b3('0xc')]+_0x5206b4[_0x38b3('0xd')]+_0x5206b4[_0x38b3('0xf')]+_0x5206b4[_0x38b3('0x10')]+_0x5206b4[_0x38b3('0x11')]+_0x5206b4['countmachineretry']+_0x5206b4[_0x38b3('0x12')];this[_0x38b3('0xf')]=_0x5206b4[_0x38b3('0xf')];this['countdropretry']=_0x5206b4['countdropretry'];this[_0x38b3('0x11')]=_0x5206b4[_0x38b3('0x11')];this[_0x38b3('0x13')]=_0x5206b4[_0x38b3('0x13')];this['countagentrejectretry']=_0x5206b4[_0x38b3('0x12')];this['queue']=_0x5206b4['queue'];this[_0x38b3('0x14')]=_0x5206b4[_0x38b3('0x15')];this['calleridnum']=_0x5206b4['number'];this['starttime']=_0x5206b4[_0x38b3('0x16')];this[_0x38b3('0x17')]=_0x5206b4[_0x38b3('0x17')];this[_0x38b3('0x18')]=_0x5206b4[_0x38b3('0x17')];this[_0x38b3('0x19')]=getSeconds(_0x5206b4['responsetime'],_0x5206b4['starttime']);this[_0x38b3('0x1a')]=0x0;this[_0x38b3('0x1b')]=0x0;this[_0x38b3('0x1c')]=_0x5206b4[_0x38b3('0x1c')];this['callbackuniqueid']=_0x5206b4[_0x38b3('0x1d')];this['callbackat']=_0x5206b4[_0x38b3('0x1e')];this[_0x38b3('0x1f')]=_0x5206b4[_0x38b3('0x1f')];this[_0x38b3('0x20')]=_0x5206b4[_0x38b3('0x20')];this[_0x38b3('0x21')]=_0x5206b4[_0x38b3('0x21')];this['UserId']=_0x5206b4[_0x38b3('0x22')];this[_0x38b3('0x23')]=_0x5206b4[_0x38b3('0x23')];this[_0x38b3('0x24')]=_0x5206b4[_0x38b3('0x24')];this['originatecalleridnum']=_0x5206b4[_0x38b3('0x25')]||'';this['originatecalleridname']=_0x5206b4[_0x38b3('0x26')]||'';}module[_0x38b3('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 8134a49..bb51501 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 _0x2d58=['clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22\x22\x20<>','error','inspect','length','undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','pTalking','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','catch','updateOriginated','queue','[Dialer][checkChannel]','ivr','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','status','reachable','SIP/%s','unmonitored','uniqueid','variable','exten','xcally-motion-dialer','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','countglobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','value','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countcongestionretry','add','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','channel','actionid','locked','stateinterface','push','idHopper','paused','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','content','indexOf','true','some','[ifTime][promiseAll]','checkDialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','outboundBusyCallsDay','custom:agentbusy','busy','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','checkContactBlack','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','ACTIVE','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./history','./final','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','sumBillable','sumHoldTime','talking','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialPrefix','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2d58,0x186));var _0x82d5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2d58[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x82d5('0x0'));var _=require(_0x82d5('0x1'));var BPromise=require(_0x82d5('0x2'));var uuid=require('uuid');var moment=require(_0x82d5('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x82d5('0x4'));var ut=require(_0x82d5('0x5'));var config=require(_0x82d5('0x6'));var logger=require(_0x82d5('0x7'))(_0x82d5('0x8'));var loggerBooked=require(_0x82d5('0x7'))(_0x82d5('0x9'));var loggerPredictive=require('../../../config/logger')(_0x82d5('0xa'));var loggerPredictiveCalls=require(_0x82d5('0x7'))(_0x82d5('0xb'));var loggerSyncQueueSummary=require(_0x82d5('0x7'))(_0x82d5('0xc'));var ami=require(_0x82d5('0xd'));config[_0x82d5('0xe')]=_[_0x82d5('0xf')](config[_0x82d5('0xe')],{'host':_0x82d5('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x82d5('0xe')]));var cmHopper=require(_0x82d5('0x11'));var cmHopperHistory=require(_0x82d5('0x12'));var cmHopperBlack=require(_0x82d5('0x13'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0x82d5('0x14'));var Final=require(_0x82d5('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x82d5('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0x82d5('0x17')][_0x82d5('0x18')]||_0x82d5('0x19');var strategy={'rrmemory':_0x82d5('0x1a'),'roundrobin':_0x82d5('0x1b')};var Sequence=function(){};Sequence[_0x82d5('0x1c')][_0x82d5('0x1d')]=function(_0x43801d){this['tail']=this[_0x82d5('0x1e')]?this[_0x82d5('0x1e')]['finally'](_0x43801d):_0x43801d();};function Dialer(_0x6ad68c,_0x2194c6){this[_0x82d5('0x1f')]=new Sequence();this[_0x82d5('0x20')]=_0x2194c6;this[_0x82d5('0x21')]=_0x6ad68c['voiceQueues'];this[_0x82d5('0x22')]=_0x6ad68c[_0x82d5('0x22')];this[_0x82d5('0x23')]=_0x6ad68c[_0x82d5('0x23')];this[_0x82d5('0x24')]=_0x6ad68c[_0x82d5('0x24')];this[_0x82d5('0x25')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x82d5('0x26')]={};this[_0x82d5('0x27')]={};this[_0x82d5('0x28')]={};this[_0x82d5('0x29')]={};this[_0x82d5('0x2a')]={};this[_0x82d5('0x2b')]={};this[_0x82d5('0x2c')]={};this[_0x82d5('0x2d')]={};this['queueBookedRR']={};ami['on'](_0x82d5('0x2e'),this[_0x82d5('0x2f')][_0x82d5('0x30')](this));ami['on'](_0x82d5('0x31'),this['syncQueueCallerAbandon'][_0x82d5('0x30')](this));ami['on']('originateresponse',this[_0x82d5('0x32')][_0x82d5('0x30')](this));ami['on'](_0x82d5('0x33'),this[_0x82d5('0x34')][_0x82d5('0x30')](this));ami['on'](_0x82d5('0x35'),this['syncQueueSummary'][_0x82d5('0x30')](this));ami['on']('hangup',this['syncHangup'][_0x82d5('0x30')](this));ami['on']('newexten',this[_0x82d5('0x36')][_0x82d5('0x30')](this));ami['on'](_0x82d5('0x37'),this['syncVarSet'][_0x82d5('0x30')](this));ami['on'](_0x82d5('0x38'),this[_0x82d5('0x39')]['bind'](this));ami['on'](_0x82d5('0x3a'),this['syncQueueStatusComplete'][_0x82d5('0x30')](this));this[_0x82d5('0x3b')]();this[_0x82d5('0x3c')]();}function isNotNull(_0x5cf951){return _0x5cf951!==null&&!_[_0x82d5('0x3d')](_0x5cf951);}function checkIsLoggedIn(_0x5cf853,_0x199a63){return function(){if(_0x199a63<=0x0){_0x5cf853[_0x82d5('0x3e')]=_0x82d5('0x3f');throw _0x5cf853[_0x82d5('0x40')]+_0x82d5('0x41');}};}function isActive(_0x598e7c){return _0x598e7c;}function checkIsActive(_0x24da11,_0x1fe45e){return function(){if(!isActive(_0x1fe45e)){_0x24da11[_0x82d5('0x3e')]='NOT_ACTIVE';throw _0x24da11[_0x82d5('0x40')]+_0x82d5('0x42');}};}function checkInterval(_0x53c26b){return function(){if(!isNotNull(_0x53c26b[_0x82d5('0x43')])){_0x53c26b[_0x82d5('0x3e')]=_0x82d5('0x44');throw _0x53c26b[_0x82d5('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x53c26b[_0x82d5('0x43')][_0x82d5('0x45')])){_0x53c26b[_0x82d5('0x3e')]=_0x82d5('0x44');throw _0x53c26b[_0x82d5('0x40')]+_0x82d5('0x46');}if(!isNotNull(_[_0x82d5('0x47')](_0x53c26b[_0x82d5('0x43')]['Intervals']))){_0x53c26b['message']=_0x82d5('0x44');throw _0x53c26b[_0x82d5('0x40')]+_0x82d5('0x46');}};}function msgResponse(_0x1913f4,_0xe58764,_0xdb5796){return{'action':_0x1913f4,'response':_0xe58764,'message':_0xdb5796,'stack':_0xdb5796};}function myreject(_0x2aea0f){return function(_0x443e2f){return _0x2aea0f(msgResponse(_0x82d5('0x48'),_0x82d5('0x49'),JSON[_0x82d5('0x4a')](_0x443e2f)));};}function getSeconds(_0x243444,_0x21fb67){var _0x4cdfc5=moment(_0x243444)['milliseconds'](0x0);var _0x320043=moment(_0x21fb67)[_0x82d5('0x4b')](0x0);return _0x4cdfc5[_0x82d5('0x4c')](_0x320043,_0x82d5('0x4d'));}function emit(_0x3165f4,_0x54a051,_0x3d1b77){io['to'](_0x3165f4)[_0x82d5('0x4e')](_0x54a051,_0x3d1b77);}function emitVoiceQueueSummary(_0x2074c9){if(_0x2074c9['type']===_0x82d5('0x4f')){var _0x24b322={'id':_0x2074c9['id'],'name':_0x2074c9[_0x82d5('0x40')],'strategy':_0x2074c9[_0x82d5('0x50')],'answered':_0x2074c9[_0x82d5('0x51')],'available':_0x2074c9[_0x82d5('0x52')],'loggedIn':_0x2074c9['loggedIn'],'pTalking':_0x2074c9['pTalking'],'sumBillable':_0x2074c9[_0x82d5('0x53')],'sumDuration':_0x2074c9['sumDuration'],'sumHoldTime':_0x2074c9[_0x82d5('0x54')]||0x0,'talking':_0x2074c9[_0x82d5('0x55')],'total':_0x2074c9['total'],'type':_0x2074c9[_0x82d5('0x56')],'unmanaged':_0x2074c9[_0x82d5('0x57')],'abandoned':_0x2074c9['abandoned'],'waiting':_0x2074c9[_0x82d5('0x58')],'loggedInDb':_0x2074c9[_0x82d5('0x59')],'dialActive':_0x2074c9[_0x82d5('0x5a')],'dialMethod':_0x2074c9[_0x82d5('0x5b')],'dialOriginateCallerIdName':_0x2074c9['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x2074c9['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x2074c9['dialOriginateTimeout'],'dialPrefix':_0x2074c9[_0x82d5('0x5c')],'outboundAnswerAgiCallsDay':_0x2074c9[_0x82d5('0x5d')],'outboundAnswerCallsDay':_0x2074c9['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x2074c9['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x2074c9['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2074c9[_0x82d5('0x5e')],'outboundDropCallsDayACS':_0x2074c9[_0x82d5('0x5f')],'outboundDropCallsDayCallersExit':_0x2074c9[_0x82d5('0x60')],'outboundDropCallsDayTimeout':_0x2074c9[_0x82d5('0x61')],'outboundNoAnswerCallsDay':_0x2074c9['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x2074c9['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x2074c9[_0x82d5('0x62')],'outboundReCallsDay':_0x2074c9['outboundReCallsDay'],'outboundRejectCallsDay':_0x2074c9[_0x82d5('0x63')],'outboundUnknownCallsDay':_0x2074c9[_0x82d5('0x64')],'predictiveIntervalAnsweredCalls':_0x2074c9[_0x82d5('0x65')],'predictiveIntervalAvgHoldtime':_0x2074c9['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x2074c9[_0x82d5('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x2074c9[_0x82d5('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x2074c9[_0x82d5('0x68')],'predictiveIntervalErlangCalls':_0x2074c9[_0x82d5('0x69')],'predictiveIntervalErlangCallsDroppedCalls':_0x2074c9[_0x82d5('0x6a')],'predictiveIntervalHitRate':_0x2074c9[_0x82d5('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x2074c9[_0x82d5('0x6c')],'predictiveIntervalPauses':_0x2074c9['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2074c9[_0x82d5('0x6d')],'predictiveIntervalTotalCalls':_0x2074c9['predictiveIntervalTotalCalls'],'message':_0x2074c9[_0x82d5('0x3e')],'originated':_0x2074c9[_0x82d5('0x6e')],'erlangCalls':_0x2074c9['erlangCalls'],'erlangCallToSecond':_0x2074c9[_0x82d5('0x6f')],'erlangAbandonmentRate':_0x2074c9[_0x82d5('0x70')],'erlangBusyFactor':_0x2074c9[_0x82d5('0x71')],'startPredictive':_0x2074c9[_0x82d5('0x2a')],'startProgressive':_0x2074c9[_0x82d5('0x2b')]};if(_0x2074c9[_0x82d5('0x72')]){_0x24b322[_0x82d5('0x72')]={'id':_0x2074c9['Trunk']['id'],'name':_0x2074c9['Trunk']['name'],'active':_0x2074c9[_0x82d5('0x72')][_0x82d5('0x73')],'callerid':_0x2074c9['Trunk'][_0x82d5('0x74')]};}if(_0x2074c9[_0x82d5('0x43')]){_0x24b322['Interval']={'id':_0x2074c9['Interval']['id'],'name':_0x2074c9[_0x82d5('0x43')][_0x82d5('0x40')]};}var _0x4db992=md5(JSON[_0x82d5('0x4a')](_0x24b322));if(_0x2074c9[_0x82d5('0x75')]!==_0x4db992){_0x2074c9[_0x82d5('0x75')]=_0x4db992;emit(util[_0x82d5('0x76')](_0x82d5('0x77'),_0x24b322['name']),_0x82d5('0x78'),_0x24b322);}}}function emitCampaignSummary(_0x192b12){if(_0x192b12[_0x82d5('0x56')]==='ivr'){emit(util[_0x82d5('0x76')](_0x82d5('0x79'),_0x192b12['name']),_0x82d5('0x7a'),_0x192b12);}}function checkGetDataPredictive(_0x3d9c44){if(isNotNull(_0x3d9c44)&&!_[_0x82d5('0x47')](_0x3d9c44)){loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x7c'));loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x7d'),_0x3d9c44['predictiveIntervalTotalCalls']);loggerPredictive[_0x82d5('0x7b')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d9c44['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x7e'),_0x3d9c44[_0x82d5('0x68')]);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x7f'),_0x3d9c44['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x80'),_0x3d9c44[_0x82d5('0x81')]);loggerPredictive[_0x82d5('0x7b')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d9c44[_0x82d5('0x66')]);loggerPredictive['info'](_0x82d5('0x82'));if(_0x3d9c44[_0x82d5('0x83')]>0x0){if(!_[_0x82d5('0x3d')](_0x3d9c44['predictiveIntervalAvgTalktime'])&&_0x3d9c44[_0x82d5('0x66')]>0x0){return!![];}loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x84'));if(!_['isUndefined'](_0x3d9c44['predictiveIntervalAvgHoldtime'])&&_0x3d9c44['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x85'));}else{loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x86'));}}else{loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x87'));}return![];}function mergeDataErlangB(_0x189363){return function(_0x4743db){loggerPredictive['info'](_0x82d5('0x88'));loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x89'),_0x4743db[_0x82d5('0x8a')]);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x8b'),_0x4743db[_0x82d5('0x6f')]);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x8c'),_0x4743db[_0x82d5('0x70')]);loggerPredictive[_0x82d5('0x7b')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4743db[_0x82d5('0x71')]);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x8c'),_0x4743db[_0x82d5('0x70')]);loggerPredictive['info'](_0x82d5('0x82'));_['merge'](_0x189363,_0x4743db);};}function getDiff(_0x582005){var _0x4d67b4=moment()[_0x82d5('0x4b')](0x0);var _0x4361d2=moment(_0x582005)[_0x82d5('0x4b')](0x0);return _0x4d67b4['diff'](_0x4361d2,_0x82d5('0x4d'));}function ifInterval(_0x52b13d,_0x1f6e2c){if(_['isUndefined'](_0x1f6e2c)){return![];}return getDiff(_0x1f6e2c)<_0x52b13d*0x3c;}function freeVariablesPredictive(_0x2ae27f){if(isNotNull(_0x2ae27f)){if(!_[_0x82d5('0x3d')](_0x2ae27f[_0x82d5('0x2b')])){_0x2ae27f['startProgressive']=undefined;loggerPredictive['info'](_0x2ae27f[_0x82d5('0x40')],_0x82d5('0x8d'));}if(!_['isUndefined'](_0x2ae27f['startPredictive'])){_0x2ae27f[_0x82d5('0x2a')]=undefined;loggerPredictive[_0x82d5('0x7b')](_0x2ae27f[_0x82d5('0x40')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x2ae27f['handlePredictive'])){clearInterval(_0x2ae27f[_0x82d5('0x8e')]);_0x2ae27f[_0x82d5('0x8e')]=undefined;loggerPredictive[_0x82d5('0x7b')](_0x2ae27f[_0x82d5('0x40')],_0x82d5('0x8f'));}}}function erlangb(_0x4097f2,_0x4a226b){if(_0x4a226b===0x0){return 0x0;}var _0x27113d=0x1;for(var _0x224546=0x1;_0x224546<=_0x4a226b;_0x224546+=0x1){_0x27113d=0x1+_0x27113d*_0x224546/_0x4097f2;}return 0x1/_0x27113d;}function isVoiceQueueOutbound(_0x25c243){return _0x25c243===_0x82d5('0x4f');}function isNotPreview(_0x158918){return _0x158918!==_0x82d5('0x20');}function isCampaignIvr(_0x44845d){return _0x44845d==='ivr';}function getCallerId(_0x4526af,_0x261950,_0x57cb83){if(!_[_0x82d5('0x3d')](_0x57cb83)&&typeof _0x57cb83===_0x82d5('0x90')&&!_[_0x82d5('0x47')](_0x57cb83)){if(!_['isUndefined'](_0x261950)&&typeof _0x261950===_0x82d5('0x90')&&!_[_0x82d5('0x47')](_0x261950)){return util[_0x82d5('0x76')]('\x22%s\x22\x20<%s>',_0x261950,_0x57cb83);}return util[_0x82d5('0x76')]('\x22%s\x22\x20<%s>',_0x57cb83,_0x57cb83);}if(!_[_0x82d5('0x3d')](_0x4526af)&&typeof _0x4526af===_0x82d5('0x90')&&!_[_0x82d5('0x47')](_0x4526af)){return _0x4526af;}return _0x82d5('0x91');}function loggerCatchQueueSummary(_0x4f315a,_0x441a73){return function(_0x59890a){freeVariablesPredictive(_0x441a73);emitVoiceQueueSummary(_0x441a73);emitCampaignSummary(_0x441a73);loggerSyncQueueSummary[_0x82d5('0x92')](_0x4f315a,util[_0x82d5('0x93')](_0x59890a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1a6411,_0x32129e){return function(_0x1f6156){loggerPredictive[_0x82d5('0x92')](_0x32129e[_0x82d5('0x40')],_0x1a6411);loggerPredictive[_0x82d5('0x92')](_0x1f6156['stack']);freeVariablesPredictive(_0x32129e);};}function loggerCatch(_0x57c55c){return function(_0x596d8c){logger[_0x82d5('0x92')](_0x57c55c,util['inspect'](_0x596d8c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x46551f){return _0x46551f&&!_['isUndefined'](_0x46551f)&&_0x46551f[_0x82d5('0x94')]>0x0;}function decremetOriginate(_0x4ba6fc){if(!_[_0x82d5('0x3d')](_0x4ba6fc)&&_0x4ba6fc!==null){if(typeof _0x4ba6fc[_0x82d5('0x6e')]!==_0x82d5('0x95')){if(_0x4ba6fc[_0x82d5('0x6e')]>0x0){_0x4ba6fc[_0x82d5('0x6e')]-=0x1;}else{logger[_0x82d5('0x92')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x82d5('0x92')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x531f7d,_0xef2094,_0x47cf3c){if(_0xef2094>_0x47cf3c){for(var _0x5db2e6=0x0;_0x5db2e6<_0xef2094-_0x47cf3c;_0x5db2e6+=0x1){decremetOriginate(_0x531f7d);}}}function loggerGetContactDialer(_0x4a0d9c,_0x1ac38a,_0x211f5a){return function(_0x53a894){checkContactLowerLimitOriginate(_0x1ac38a,_0x211f5a,0x0);logger[_0x82d5('0x92')](_0x4a0d9c,util['inspect'](_0x53a894,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x189509){return function(_0x35cee2){if(isNotNull(_0x35cee2)&&isNotNull(_0x35cee2[0x0])){if(_0x35cee2[0x0][_0x82d5('0x96')]>0x0){_0x189509[_0x82d5('0x3e')]='RESCHEDULED_CONTACTS';logger[_0x82d5('0x7b')](_0x82d5('0x97')+_0x189509[_0x82d5('0x40')],_0x35cee2[0x0][_0x82d5('0x96')],'contacts');}else{_0x189509[_0x82d5('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x82d5('0x7b')](_0x82d5('0x98')+_0x189509[_0x82d5('0x40')]);}}};}function notSendMessagesQueue(_0x4cf92b){if(_0x4cf92b['sendMessageOneNotActive']){freeVariablesPredictive(_0x4cf92b);if(_0x4cf92b[_0x82d5('0x6e')]===0x0&&_0x4cf92b[_0x82d5('0x55')]===0x0&&_0x4cf92b[_0x82d5('0x58')]===0x0&&(_0x4cf92b[_0x82d5('0x99')]||0x0)===0x0){_0x4cf92b['sendMessageOneNotActive']=![];_0x4cf92b['available']=0x0;_0x4cf92b['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x82d5('0x92')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4cf92b[_0x82d5('0x40')],_0x82d5('0x9a'));}else{_0x4cf92b[_0x82d5('0x3e')]=_0x82d5('0x9b');loggerSyncQueueSummary[_0x82d5('0x92')](_0x82d5('0x9c'),_0x4cf92b[_0x82d5('0x40')],'is\x20disactive');}emitVoiceQueueSummary(_0x4cf92b);}}function notSendMessagesCampaign(_0x59cf8d){if(_0x59cf8d[_0x82d5('0x9d')]){if(_0x59cf8d[_0x82d5('0x6e')]===0x0){_0x59cf8d[_0x82d5('0x9d')]=![];_0x59cf8d[_0x82d5('0x3e')]=_0x82d5('0x9e');loggerSyncQueueSummary[_0x82d5('0x92')](_0x82d5('0x9f'),_0x59cf8d[_0x82d5('0x40')],_0x82d5('0x9a'));}else{_0x59cf8d[_0x82d5('0x3e')]=_0x82d5('0x9b');loggerSyncQueueSummary['error'](_0x82d5('0x9f'),_0x59cf8d[_0x82d5('0x40')],_0x82d5('0xa0'));}emitCampaignSummary(_0x59cf8d);}}function createObjHistory(_0x58e4b,_0xe1d313,_0x57e649,_0x4d13bd,_0x439387){_0x58e4b[_0x82d5('0x3e')]=_0x57e649;var _0x1c339d=new Action(_0x58e4b,_0xe1d313);var _0x321316=new History(_0x1c339d);_0x321316[_0x82d5('0xa1')]=_0x4d13bd;_0x321316[_0x82d5('0xa2')]=_0x439387;_0x321316[_0x82d5('0xa3')]=_0x1c339d[_0x82d5('0xa4')];return _0x321316;}Dialer[_0x82d5('0x1c')][_0x82d5('0x3c')]=function(){var _0x37a5c8=this;setInterval(function(){_0x37a5c8[_0x82d5('0xa5')](_0x37a5c8[_0x82d5('0x28')],_0x82d5('0xa6'));_0x37a5c8['clearZombieChannels'](_0x37a5c8[_0x82d5('0x26')],_0x82d5('0xa7'));},0x32c8);};Dialer[_0x82d5('0x1c')][_0x82d5('0xa5')]=function(_0xf75509,_0x128162){var _0x28157a=this;for(var _0x5925f6 in _0xf75509){if(typeof _0xf75509[_0x5925f6]!=='undefined'){this[_0x82d5('0x1f')][_0x82d5('0x1d')](function(){if(!_[_0x82d5('0xa8')](_0xf75509[_0x5925f6])){return ami[_0x82d5('0xa9')]({'action':'status','channel':_0xf75509[_0x5925f6]['channel']})[_0x82d5('0xaa')](function(_0xbd40fa){if(_0xbd40fa['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0xf75509[_0x5925f6]&&_0xf75509[_0x5925f6][_0x82d5('0x56')]!=='ivr'){_0x28157a[_0x82d5('0xab')](_0x28157a['voiceQueues'][_0xf75509[_0x5925f6][_0x82d5('0xac')]]);logger[_0x82d5('0x92')](_0x82d5('0xad'),_0x128162,_0x5925f6,_0xf75509[_0x5925f6][_0x82d5('0xac')]);delete _0xf75509[_0x5925f6];}if(_0xf75509[_0x5925f6]&&_0xf75509[_0x5925f6][_0x82d5('0x56')]===_0x82d5('0xae')){_0x28157a[_0x82d5('0xab')](_0x28157a['campaigns'][_0xf75509[_0x5925f6][_0x82d5('0xac')]]);logger[_0x82d5('0x92')](_0x82d5('0xaf'),_0x128162,_0x5925f6,_0xf75509[_0x5925f6]['queue']);delete _0xf75509[_0x5925f6];}},0x2328);}});}});}}};Dialer['prototype'][_0x82d5('0xb0')]=function(_0x383229){return BPromise[_0x82d5('0xb1')]()[_0x82d5('0xb2')](cmHopper[_0x82d5('0xb0')](_0x383229))[_0x82d5('0xaa')](loggerCatch(_0x82d5('0xb3')));};Dialer['prototype']['checkIsBlackList']=function(_0x4e8ce3){return BPromise['resolve']()[_0x82d5('0xb2')](cmHopperBlack[_0x82d5('0xb4')](_0x4e8ce3))['catch'](loggerCatch(_0x82d5('0xb5')));};Dialer[_0x82d5('0x1c')][_0x82d5('0xb6')]=function(_0x2e25ce){return BPromise['resolve']()['then'](cmHopperBlack[_0x82d5('0xb6')](_0x2e25ce))[_0x82d5('0xaa')](loggerCatch(_0x82d5('0xb7')));};Dialer[_0x82d5('0x1c')][_0x82d5('0xb8')]=function(_0x18fe9e){return BPromise[_0x82d5('0xb1')]()[_0x82d5('0xb2')](cmHopperHistory[_0x82d5('0xb9')](_0x18fe9e))[_0x82d5('0xaa')](loggerCatch(_0x82d5('0xba')));};Dialer['prototype'][_0x82d5('0xbb')]=function(_0x22d4c6){return BPromise[_0x82d5('0xb1')]()[_0x82d5('0xb2')](cmHopper[_0x82d5('0xbb')](_0x22d4c6))[_0x82d5('0xaa')](loggerCatch(_0x82d5('0xbc')));};Dialer[_0x82d5('0x1c')]['unlockContact']=function(_0x42206b,_0x1a12cf,_0x59e52d){return BPromise[_0x82d5('0xb1')]()[_0x82d5('0xb2')](cmHopper['unlockContact'](_0x42206b,_0x1a12cf,_0x59e52d))['catch'](loggerCatch('[unlockContact]\x20'));};Dialer[_0x82d5('0x1c')][_0x82d5('0xbd')]=function(_0x4a4b54,_0x4447e2,_0x2e23f3,_0x1ff96e,_0x2ed80b){return BPromise['resolve']()[_0x82d5('0xb2')](cmHopper[_0x82d5('0xbd')](_0x4a4b54,_0x4447e2,_0x2e23f3,_0x1ff96e))[_0x82d5('0xaa')](function(_0x3a09fa){_0x2ed80b[_0x82d5('0xbe')]-=_0x2e23f3;_0x2ed80b[_0x82d5('0xbe')]=_0x2ed80b[_0x82d5('0xbe')]>0x0?_0x2ed80b[_0x82d5('0xbe')]:0x0;loggerCatch(_0x82d5('0xbf'))(_0x3a09fa);});};Dialer['prototype'][_0x82d5('0xc0')]=function(_0xf07ef9,_0x781e32,_0x82571f,_0x589ece){return BPromise[_0x82d5('0xb1')]()[_0x82d5('0xb2')](cmHopper['getContactDialerIvr'](_0xf07ef9,_0x781e32,_0x82571f))[_0x82d5('0xaa')](function(_0x331d18){_0x589ece[_0x82d5('0xbe')]-=_0x781e32;_0x589ece[_0x82d5('0xbe')]=_0x589ece[_0x82d5('0xbe')]>0x0?_0x589ece[_0x82d5('0xbe')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x331d18);});};Dialer[_0x82d5('0x1c')][_0x82d5('0xc1')]=function(_0x3c1d21){return BPromise[_0x82d5('0xb1')]()['then'](voiceQueueRt[_0x82d5('0xc1')](_0x3c1d21))[_0x82d5('0xaa')](loggerCatch(_0x82d5('0xc2')));};Dialer[_0x82d5('0x1c')][_0x82d5('0xc3')]=function(_0x3dfe57){return BPromise[_0x82d5('0xb1')]()[_0x82d5('0xb2')](cmHopper[_0x82d5('0xc3')](_0x3dfe57))[_0x82d5('0xaa')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x82d5('0x1c')]['createHistory']=function(_0x4c98b8){return BPromise['resolve']()[_0x82d5('0xb2')](cmHopperHistory[_0x82d5('0xc4')](_0x4c98b8))[_0x82d5('0xaa')](loggerCatch('[createHistory]\x20'));};Dialer[_0x82d5('0x1c')][_0x82d5('0xab')]=function(_0x27e2d9){if(!_[_0x82d5('0x3d')](_0x27e2d9)&&_0x27e2d9!==null){if(typeof _0x27e2d9[_0x82d5('0x6e')]!==_0x82d5('0x95')){if(_0x27e2d9[_0x82d5('0x6e')]>0x0){_0x27e2d9[_0x82d5('0x6e')]-=0x1;}else{logger[_0x82d5('0x92')](_0x82d5('0xc5'));}}}else{logger[_0x82d5('0x92')](_0x82d5('0xc6'));}};Dialer[_0x82d5('0x1c')][_0x82d5('0xc7')]=function(_0x24a863,_0x16121c){var _0x3d668e=this;return function(_0x1eea80){_0x3d668e[_0x82d5('0xab')](_0x16121c);logger['error'](_0x24a863,util[_0x82d5('0x93')](_0x1eea80,{'showHidden':![],'depth':null}));};};Dialer[_0x82d5('0x1c')][_0x82d5('0xc8')]=function(_0x487b18,_0xc83737,_0x10b8d9){var _0x3b8e28={'state':0x19,'statedesc':_0x82d5('0xc9')};this[_0x82d5('0xab')](_0xc83737);this[_0x82d5('0xca')](_[_0x82d5('0xcb')](_0x3b8e28,_[_0x82d5('0xcc')](_0x10b8d9,[_0x82d5('0xcd'),_0x82d5('0xce'),_0x82d5('0xcf'),'VoiceQueueId',_0x82d5('0xd0')])),_0x82d5('0xd1'),_0x82d5('0xd2'));logger[_0x82d5('0x92')](_0x487b18);};Dialer[_0x82d5('0x1c')][_0x82d5('0xd3')]=function(_0x24dca3){return _0x24dca3===_0x82d5('0xd4');};Dialer[_0x82d5('0x1c')][_0x82d5('0xd5')]=function(_0x4e5207){return!_[_0x82d5('0x3d')](_0x4e5207)&&_0x4e5207&&!_['isUndefined'](_0x4e5207[_0x82d5('0x40')])&&!_[_0x82d5('0x3d')](_0x4e5207[_0x82d5('0x73')])&&_0x4e5207[_0x82d5('0x73')]&&(this[_0x82d5('0x24')][util[_0x82d5('0x76')]('SIP/%s',_0x4e5207[_0x82d5('0x40')])][_0x82d5('0xd6')]===_0x82d5('0xd7')||this[_0x82d5('0x24')][util['format'](_0x82d5('0xd8'),_0x4e5207[_0x82d5('0x40')])][_0x82d5('0xd6')]===_0x82d5('0xd9'));};Dialer[_0x82d5('0x1c')]['saveInDb']=function(_0x486510,_0x23dd9f,_0x304a95){this[_0x82d5('0xc4')](_0x486510)[_0x82d5('0xaa')](loggerCatch(_0x23dd9f));this[_0x82d5('0xc3')](_0x486510)[_0x82d5('0xaa')](loggerCatch(_0x304a95));};Dialer[_0x82d5('0x1c')]['syncVarSet']=function(_0x22967f){var _0x1a45c3=this[_0x82d5('0x28')][_0x22967f[_0x82d5('0xda')]];var _0x185b67;if(!_[_0x82d5('0xa8')](_0x22967f)&&!_[_0x82d5('0xa8')](_0x22967f['variable'])&&!_[_0x82d5('0xa8')](_0x22967f[_0x82d5('0xdb')]['amdstatus'])&&_0x22967f[_0x82d5('0xdc')]===_0x82d5('0xdd')&&_0x1a45c3){if(_0x1a45c3[_0x82d5('0x56')]!=='ivr'&&this[_0x82d5('0x21')][_0x1a45c3[_0x82d5('0xac')]]['dialAMDActive']&&_0x22967f['value']===_0x82d5('0xde')){delete this['uniqueId'][_0x22967f['uniqueid']];this['updateOriginated'](this[_0x82d5('0x21')][_0x1a45c3[_0x82d5('0xac')]]);this[_0x82d5('0x21')][_0x1a45c3[_0x82d5('0xac')]][_0x82d5('0xdf')]+=0x1;this[_0x82d5('0x21')][_0x1a45c3['queue']][_0x82d5('0x5d')]+=0x1;_0x185b67=new Hangup(_0x1a45c3,_0x22967f);_0x185b67[_0x82d5('0xa1')]=0x12;_0x185b67['statedesc']=_0x82d5('0xe0');_0x185b67[_0x82d5('0xe1')]=_0x82d5('0xe2');ami[_0x82d5('0x4e')](_0x82d5('0xe3'),ut[_0x82d5('0xe4')](_0x185b67,_0x82d5('0xe5')));this[_0x82d5('0xca')](_0x185b67,'[syncHangupInAMD][createHistory]',_0x82d5('0xe6'));}if(_0x1a45c3[_0x82d5('0x56')]!==_0x82d5('0xae')&&this[_0x82d5('0x21')][_0x1a45c3['queue']][_0x82d5('0xe7')]&&_0x22967f['value']===_0x82d5('0xe8')){var _0x45e9d1=this;return new BPromise(function(_0x3567d3,_0x52f2a9){delete _0x45e9d1['uniqueId'][_0x22967f[_0x82d5('0xda')]];_0x45e9d1[_0x82d5('0xab')](_0x45e9d1['voiceQueues'][_0x1a45c3[_0x82d5('0xac')]]);_0x45e9d1[_0x82d5('0x21')][_0x1a45c3['queue']][_0x82d5('0xdf')]+=0x1;_0x45e9d1[_0x82d5('0x21')][_0x1a45c3[_0x82d5('0xac')]][_0x82d5('0x5d')]+=0x1;var _0x11ae89=_0x45e9d1[_0x82d5('0x21')][_0x1a45c3['queue']];var _0xec332e=new Hangup(_0x1a45c3,_0x22967f);_0xec332e[_0x82d5('0xa1')]=0x13;_0xec332e[_0x82d5('0xa2')]=_0x82d5('0xe9');_0xec332e[_0x82d5('0xe1')]=_0x82d5('0xe2');_0xec332e[_0x82d5('0xea')]+=0x1;_0xec332e[_0x82d5('0xeb')]+=0x1;_0xec332e[_0x82d5('0xe5')]=!![];ami['emit'](_0x82d5('0xe3'),ut['buildObj'](_0xec332e,_0x82d5('0xe5')));_0x45e9d1[_0x82d5('0xc4')](_0xec332e)[_0x82d5('0xaa')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xec332e[_0x82d5('0xec')]+_0xec332e['countcongestionretry']+_0xec332e[_0x82d5('0xed')]+_0xec332e[_0x82d5('0xee')]+_0xec332e[_0x82d5('0xef')]+_0xec332e[_0x82d5('0xf0')]+_0xec332e[_0x82d5('0xea')]+_0xec332e[_0x82d5('0xf1')]>=_0x11ae89[_0x82d5('0xf2')]){_0x45e9d1[_0x82d5('0xf3')](_0xec332e,_0x3567d3,_0x52f2a9,_0x82d5('0xf4'));}else{if(_0xec332e['countmachineretry']>=_0x11ae89[_0x82d5('0xf5')]){_0x45e9d1[_0x82d5('0xf6')](_0xec332e,_0x3567d3,_0x52f2a9,_0x82d5('0xf7'));}else{_0x45e9d1[_0x82d5('0xbb')]({'active':![],'countmachineretry':_0xec332e[_0x82d5('0xea')],'scheduledat':moment()['add'](_0x11ae89['dialMachineRetryFrequency'],_0x82d5('0xf8'))['format'](_0x82d5('0xf9')),'ContactId':_0xec332e['ContactId'],'ListId':_0xec332e[_0x82d5('0xce')],'VoiceQueueId':_0xec332e[_0x82d5('0xfa')]||undefined,'CampaignId':_0xec332e[_0x82d5('0xd0')]||undefined})[_0x82d5('0xaa')](loggerCatch(_0x82d5('0xfb')));_0x3567d3({'reschedule':0x1});}}});}if(_0x1a45c3[_0x82d5('0x56')]==='ivr'&&this[_0x82d5('0x22')][_0x1a45c3[_0x82d5('0xac')]][_0x82d5('0xe7')]&&_0x22967f[_0x82d5('0xfc')]===_0x82d5('0xde')){delete this[_0x82d5('0x28')][_0x22967f[_0x82d5('0xda')]];this[_0x82d5('0xab')](this[_0x82d5('0x22')][_0x1a45c3[_0x82d5('0xac')]]);_0x185b67=new Hangup(_0x1a45c3,_0x22967f);_0x185b67[_0x82d5('0xa1')]=0x12;_0x185b67[_0x82d5('0xa2')]=_0x82d5('0xe0');_0x185b67[_0x82d5('0xe1')]='AMD';ami[_0x82d5('0x4e')](_0x82d5('0xe3'),ut[_0x82d5('0xe4')](_0x185b67,_0x82d5('0xe5')));this[_0x82d5('0xca')](_0x185b67,_0x82d5('0xfd'),_0x82d5('0xfe'));}if(_0x1a45c3[_0x82d5('0x56')]===_0x82d5('0xae')&&this[_0x82d5('0x22')][_0x1a45c3['queue']]['dialAMDActive']&&_0x22967f[_0x82d5('0xfc')]===_0x82d5('0xe8')){var _0x45e9d1=this;return new BPromise(function(_0xc23627,_0x76ce6f){delete _0x45e9d1[_0x82d5('0x28')][_0x22967f[_0x82d5('0xda')]];_0x45e9d1[_0x82d5('0xab')](_0x45e9d1[_0x82d5('0x22')][_0x1a45c3[_0x82d5('0xac')]]);_0x45e9d1['campaigns'][_0x1a45c3[_0x82d5('0xac')]][_0x82d5('0xdf')]+=0x1;_0x45e9d1[_0x82d5('0x22')][_0x1a45c3[_0x82d5('0xac')]][_0x82d5('0x5d')]+=0x1;var _0x256eeb=_0x45e9d1[_0x82d5('0x22')][_0x1a45c3[_0x82d5('0xac')]];var _0x403191=new Hangup(_0x1a45c3,_0x22967f);_0x403191[_0x82d5('0xa1')]=0x13;_0x403191[_0x82d5('0xa2')]=_0x82d5('0xe9');_0x403191[_0x82d5('0xe1')]=_0x82d5('0xe2');_0x403191[_0x82d5('0xea')]+=0x1;_0x403191[_0x82d5('0xeb')]+=0x1;_0x403191['amd']=!![];ami[_0x82d5('0x4e')](_0x82d5('0xe3'),ut[_0x82d5('0xe4')](_0x403191,_0x82d5('0xe5')));_0x45e9d1[_0x82d5('0xc4')](_0x403191)['catch'](loggerCatch(_0x82d5('0xff')));if(_0x403191[_0x82d5('0xec')]+_0x403191[_0x82d5('0x100')]+_0x403191[_0x82d5('0xed')]+_0x403191[_0x82d5('0xee')]+_0x403191[_0x82d5('0xef')]+_0x403191[_0x82d5('0xf0')]+_0x403191['countmachineretry']+_0x403191['countagentrejectretry']>=_0x256eeb[_0x82d5('0xf2')]){_0x45e9d1[_0x82d5('0xf3')](_0x403191,_0xc23627,_0x76ce6f,_0x82d5('0xf4'));}else{if(_0x403191[_0x82d5('0xea')]>=_0x256eeb[_0x82d5('0xf5')]){_0x45e9d1[_0x82d5('0xf6')](_0x403191,_0xc23627,_0x76ce6f,'reason\x2019\x20machine....');}else{_0x45e9d1[_0x82d5('0xbb')]({'active':![],'countmachineretry':_0x403191[_0x82d5('0xea')],'scheduledat':moment()[_0x82d5('0x101')](_0x256eeb['dialMachineRetryFrequency'],_0x82d5('0xf8'))[_0x82d5('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x403191[_0x82d5('0xcd')],'ListId':_0x403191[_0x82d5('0xce')],'VoiceQueueId':_0x403191[_0x82d5('0xfa')]||undefined,'CampaignId':_0x403191[_0x82d5('0xd0')]||undefined})[_0x82d5('0xaa')](loggerCatch(_0x82d5('0xfb')));_0xc23627({'reschedule':0x1});}}});}}};Dialer[_0x82d5('0x1c')]['syncHangup']=function(_0x72d787){var _0x412de6=this[_0x82d5('0x28')][_0x72d787[_0x82d5('0xda')]];var _0x1e99e5=this;var _0x220875;if(_0x412de6&&_0x412de6[_0x82d5('0x56')]===_0x82d5('0xae')){delete this[_0x82d5('0x28')][_0x72d787['uniqueid']];this['updateOriginated'](this[_0x82d5('0x22')][_0x412de6[_0x82d5('0xac')]]);this['campaigns'][_0x412de6[_0x82d5('0xac')]][_0x82d5('0x102')]+=0x1;_0x220875=new Hangup(_0x412de6,_0x72d787);this['createHistory'](_0x220875)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x103')));this[_0x82d5('0xc3')](_0x220875)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x412de6&&_0x412de6['type']!==_0x82d5('0xae')&&isNotNull(this[_0x82d5('0x21')][_0x412de6[_0x82d5('0xac')]][_0x82d5('0x104')])){delete this[_0x82d5('0x28')][_0x72d787[_0x82d5('0xda')]];this[_0x82d5('0xab')](this['voiceQueues'][_0x412de6[_0x82d5('0xac')]]);this['voiceQueues'][_0x412de6[_0x82d5('0xac')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x412de6[_0x82d5('0xac')]][_0x82d5('0x5d')]+=0x1;_0x220875=new Hangup(_0x412de6,_0x72d787);_0x220875[_0x82d5('0xa1')]=0x10;_0x220875[_0x82d5('0xa2')]=_0x82d5('0x105');_0x220875[_0x82d5('0xe1')]=_0x82d5('0x106');this['createHistory'](_0x220875)[_0x82d5('0xaa')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x220875)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x107')));}if(_0x412de6&&_0x412de6[_0x82d5('0x56')]!==_0x82d5('0xae')&&!isNotNull(this[_0x82d5('0x21')][_0x412de6[_0x82d5('0xac')]][_0x82d5('0x104')])){delete this[_0x82d5('0x28')][_0x72d787[_0x82d5('0xda')]];this[_0x82d5('0xab')](this['voiceQueues'][_0x412de6[_0x82d5('0xac')]]);this[_0x82d5('0x21')][_0x412de6[_0x82d5('0xac')]][_0x82d5('0x64')]+=0x1;_0x220875=new Hangup(_0x412de6,_0x72d787);_0x220875[_0x82d5('0xa1')]=0xc;_0x220875[_0x82d5('0xa2')]=_0x72d787[_0x82d5('0x108')];_0x220875[_0x82d5('0xe1')]=_0x82d5('0x109');this[_0x82d5('0xc4')](_0x220875)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x103')));this[_0x82d5('0xc3')](_0x220875)[_0x82d5('0xaa')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x82d5('0x1c')][_0x82d5('0x34')]=function(_0xe992c){var _0x37ed52=this[_0x82d5('0x28')][_0xe992c[_0x82d5('0xda')]];var _0xcae885=this;if(this[_0x82d5('0x21')][_0xe992c['queue']]){if(_0x37ed52&&_0x37ed52[_0x82d5('0x56')]!==_0x82d5('0xae')){delete this[_0x82d5('0x28')][_0xe992c[_0x82d5('0xda')]];this[_0x82d5('0x21')][_0xe992c[_0x82d5('0xac')]][_0x82d5('0xdf')]+=0x1;var _0x4e2083=new AgentComplete(_0x37ed52,_0xe992c);if(_0xe992c[_0x82d5('0x10a')]===_0x82d5('0x10b')){_0x4e2083[_0x82d5('0x10c')]=this[_0x82d5('0x21')][_0xe992c['queue']]['dialQueueProject2']&&this[_0x82d5('0x21')][_0xe992c[_0x82d5('0xac')]][_0x82d5('0x10d')]?moment()[_0x82d5('0x76')](_0x82d5('0xf9')):undefined;}this[_0x82d5('0xc4')](_0x4e2083)[_0x82d5('0xaa')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x4e2083)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x10e')));}}};Dialer[_0x82d5('0x1c')][_0x82d5('0x2f')]=function(_0x43847f){if(this[_0x82d5('0x21')][_0x43847f[_0x82d5('0xac')]]){if(this[_0x82d5('0x28')][_0x43847f['uniqueid']]&&this['uniqueId'][_0x43847f[_0x82d5('0xda')]]['type']!==_0x82d5('0xae')){this[_0x82d5('0xab')](this[_0x82d5('0x21')][_0x43847f['queue']]);this[_0x82d5('0x28')][_0x43847f[_0x82d5('0xda')]][_0x82d5('0x10f')]=moment()[_0x82d5('0x76')](_0x82d5('0xf9'));}}};Dialer[_0x82d5('0x1c')][_0x82d5('0x110')]=function(_0x2a05a1){this[_0x82d5('0xc4')](_0x2a05a1)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x111')));this[_0x82d5('0xc3')](_0x2a05a1)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x112')));};Dialer[_0x82d5('0x1c')][_0x82d5('0x113')]=function(_0x17a2f9){var _0x354511=this[_0x82d5('0x28')][_0x17a2f9[_0x82d5('0xda')]];var _0x4e4962=this;if(this[_0x82d5('0x21')][_0x17a2f9['queue']]){if(_0x354511&&_0x354511[_0x82d5('0x56')]!==_0x82d5('0xae')){delete this[_0x82d5('0x28')][_0x17a2f9[_0x82d5('0xda')]];this['updateOriginated'](this['voiceQueues'][_0x17a2f9[_0x82d5('0xac')]]);_0x354511[_0x82d5('0x114')]=moment()[_0x82d5('0x76')](_0x82d5('0xf9'));var _0x12e8f8=new QueueCallerAbandon(_0x354511,_0x17a2f9);if(getSeconds(_0x354511[_0x82d5('0x114')],_0x354511['responsetime'])>=_0x354511[_0x82d5('0x115')]){this['voiceQueues'][_0x17a2f9[_0x82d5('0xac')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x17a2f9['queue']][_0x82d5('0x61')]+=0x1;this['voiceQueues'][_0x17a2f9[_0x82d5('0xac')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x12e8f8['state']=0xa;_0x12e8f8['statedesc']=_0x82d5('0x116');_0x12e8f8[_0x82d5('0x117')]=_0x82d5('0x118');_0x12e8f8[_0x82d5('0x10c')]=this[_0x82d5('0x21')][_0x17a2f9[_0x82d5('0xac')]][_0x82d5('0x119')]?moment()['format'](_0x82d5('0xf9')):undefined;_0x12e8f8[_0x82d5('0xef')]+=0x1;_0x12e8f8[_0x82d5('0xeb')]+=0x1;if(_0x12e8f8[_0x82d5('0xef')]>=this[_0x82d5('0x21')][_0x17a2f9[_0x82d5('0xac')]][_0x82d5('0x11a')]){this['queueCallerAbandonCreateState'](_0x12e8f8);}else{this[_0x82d5('0xbb')]({'active':![],'countdropretry':_0x12e8f8['countdropretry'],'scheduledat':moment()['add'](this[_0x82d5('0x21')][_0x17a2f9[_0x82d5('0xac')]][_0x82d5('0x11b')],'minutes')[_0x82d5('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x354511[_0x82d5('0xcd')],'ListId':_0x354511[_0x82d5('0xce')],'VoiceQueueId':_0x354511[_0x82d5('0xfa')]||undefined,'CampaignId':_0x354511[_0x82d5('0xd0')]||undefined})[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x11c')));var _0x2f55a4=new History(_0x12e8f8);_0x2f55a4['state']=0xa;_0x2f55a4[_0x82d5('0xa2')]=_0x82d5('0x116');_0x2f55a4[_0x82d5('0xa4')]=moment()[_0x82d5('0x76')](_0x82d5('0xf9'));_0x2f55a4[_0x82d5('0xa3')]=_0x2f55a4[_0x82d5('0xa4')];_0x2f55a4['calleridname']=_0x12e8f8['calleridname'];_0x2f55a4[_0x82d5('0x11d')]=_0x12e8f8[_0x82d5('0x11d')];this['createHistory'](_0x2f55a4)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x11e')));}}else{this[_0x82d5('0x21')][_0x17a2f9['queue']][_0x82d5('0x67')]+=0x1;this[_0x82d5('0x21')][_0x17a2f9['queue']][_0x82d5('0x60')]+=0x1;_0x12e8f8[_0x82d5('0xa1')]=0xb;_0x12e8f8[_0x82d5('0xa2')]=_0x82d5('0x11f');_0x12e8f8[_0x82d5('0x117')]=_0x82d5('0x120');_0x12e8f8[_0x82d5('0xf0')]+=0x1;_0x12e8f8['countglobal']+=0x1;if(_0x12e8f8[_0x82d5('0xf0')]>=this[_0x82d5('0x21')][_0x17a2f9[_0x82d5('0xac')]]['dialAbandonedMaxRetry']){this[_0x82d5('0x110')](_0x12e8f8);}else{this[_0x82d5('0xbb')]({'active':![],'countabandonedretry':_0x12e8f8['countabandonedretry'],'scheduledat':moment()[_0x82d5('0x101')](this[_0x82d5('0x21')][_0x17a2f9[_0x82d5('0xac')]][_0x82d5('0x121')],_0x82d5('0xf8'))[_0x82d5('0x76')](_0x82d5('0xf9')),'ContactId':_0x354511[_0x82d5('0xcd')],'ListId':_0x354511[_0x82d5('0xce')],'VoiceQueueId':_0x354511[_0x82d5('0xfa')]||undefined,'CampaignId':_0x354511['CampaignId']||undefined})['catch'](loggerCatch(_0x82d5('0x122')));var _0x2f55a4=new History(_0x12e8f8);_0x2f55a4[_0x82d5('0xa1')]=0xb;_0x2f55a4['statedesc']=_0x82d5('0x11f');_0x2f55a4[_0x82d5('0xa4')]=moment()[_0x82d5('0x76')](_0x82d5('0xf9'));_0x2f55a4['endtime']=_0x2f55a4[_0x82d5('0xa4')];_0x2f55a4[_0x82d5('0x123')]=_0x12e8f8['calleridname'];_0x2f55a4[_0x82d5('0x11d')]=_0x12e8f8['calleridnum'];this[_0x82d5('0xc4')](_0x2f55a4)['catch'](loggerCatch(_0x82d5('0x124')));}}}}};Dialer[_0x82d5('0x1c')][_0x82d5('0x36')]=function(_0x329cc9){if(this['actions'][_0x329cc9[_0x82d5('0xda')]]){this['actions'][_0x329cc9['uniqueid']][_0x82d5('0x125')]=_0x329cc9[_0x82d5('0x125')];}if(this[_0x82d5('0x28')][_0x329cc9[_0x82d5('0xda')]]){this[_0x82d5('0x28')][_0x329cc9[_0x82d5('0xda')]]['channel']=_0x329cc9[_0x82d5('0x125')];}};Dialer['prototype'][_0x82d5('0x39')]=function(_0x513263){if(strategy[this[_0x82d5('0x21')][this[_0x82d5('0x26')][_0x513263['actionid']]['queue']][_0x82d5('0x50')]]==='roundrobin'){if(this['actions'][_0x513263[_0x82d5('0x126')]]&&_['isNil'](this[_0x82d5('0x26')][_0x513263['actionid']][_0x82d5('0x127')])&&_0x513263['status']==='1'&&_0x513263['paused']==='0'){if(this[_0x82d5('0x23')][_0x513263['stateinterface']]){if(!this[_0x82d5('0x23')][_0x513263[_0x82d5('0x128')]]['locked']){this[_0x82d5('0x23')][_0x513263[_0x82d5('0x128')]][_0x82d5('0x127')]=!![];this[_0x82d5('0x26')][_0x513263[_0x82d5('0x126')]][_0x82d5('0x127')]=!![];this['actions'][_0x513263[_0x82d5('0x126')]][_0x82d5('0x128')]=_0x513263[_0x82d5('0x128')];}}}}else if((strategy[this[_0x82d5('0x21')][this[_0x82d5('0x26')][_0x513263[_0x82d5('0x126')]][_0x82d5('0xac')]]['strategy']]||_0x82d5('0x1a'))===_0x82d5('0x1a')){if(this[_0x82d5('0x26')][_0x513263[_0x82d5('0x126')]]){if(this[_0x82d5('0x23')][_0x513263[_0x82d5('0x128')]]){this['actions'][_0x513263[_0x82d5('0x126')]][_0x82d5('0x128')]=_0x513263['stateinterface'];if(_[_0x82d5('0xa8')](this[_0x82d5('0x2d')][this['actions'][_0x513263[_0x82d5('0x126')]][_0x82d5('0xac')]])){this[_0x82d5('0x2d')][this['actions'][_0x513263[_0x82d5('0x126')]][_0x82d5('0xac')]]=[];}this[_0x82d5('0x2d')][this['actions'][_0x513263['actionid']][_0x82d5('0xac')]][_0x82d5('0x129')](_['merge'](_[_0x82d5('0xcc')](this[_0x82d5('0x26')][_0x513263[_0x82d5('0x126')]],[_0x82d5('0x12a'),_0x82d5('0x128')]),{'status':_0x513263['status'],'paused':_0x513263[_0x82d5('0x12b')]}));}}}};function unlockQueueStatus(_0x1921fc,_0x4204d2){setTimeout(function(){if(_[_0x82d5('0x3d')](_0x1921fc['queueStatusComplete'])){loggerBooked[_0x82d5('0x92')]('[unlockQueueStatus][undefined]',_0x4204d2);}_0x1921fc[_0x82d5('0x12c')]=!![];loggerBooked[_0x82d5('0x7b')](_0x82d5('0x12d'),_0x4204d2,JSON[_0x82d5('0x4a')](_[_0x82d5('0xcc')](_0x1921fc,[_0x82d5('0x40'),_0x82d5('0x12c')])));},0x1f3);}Dialer[_0x82d5('0x1c')][_0x82d5('0x12e')]=function(_0xc9501c){var _0x4d7d41=this;var _0x979a90=_0x4d7d41[_0x82d5('0x21')][_0x4d7d41[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xac')]];if(strategy[this['voiceQueues'][this['actions'][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xac')]][_0x82d5('0x50')]]===_0x82d5('0x1b')){if(this[_0x82d5('0x26')][_0xc9501c['actionid']]&&this[_0x82d5('0x26')][_0xc9501c['actionid']][_0x82d5('0x128')]){this[_0x82d5('0x20')][_0x82d5('0x12f')](this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0x12a')],this['actions'][_0xc9501c[_0x82d5('0x126')]]['stateinterface'])[_0x82d5('0xaa')](function(_0x3223d1){logger['error'](_0x82d5('0x130'),util[_0x82d5('0x93')](_0x3223d1,{'showHidden':![],'depth':null}));})[_0x82d5('0x131')](function(){_0x4d7d41[_0x82d5('0xab')](_0x4d7d41[_0x82d5('0x21')][_0x4d7d41[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xac')]]);_0x4d7d41[_0x82d5('0x23')][_0x4d7d41['actions'][_0xc9501c[_0x82d5('0x126')]]['stateinterface']][_0x82d5('0x127')]=![];delete _0x4d7d41[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]];unlockQueueStatus(_0x979a90);});}else{this['updateOriginated'](this[_0x82d5('0x21')][this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xac')]]);this[_0x82d5('0xbb')]({'active':![],'ContactId':this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]]['ContactId'],'ListId':this['actions'][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xce')],'VoiceQueueId':this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xfa')]||undefined,'CampaignId':this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xd0')]||undefined})[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x132')));delete this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]];unlockQueueStatus(_0x979a90);}}else if((strategy[this[_0x82d5('0x21')][this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]]['queue']][_0x82d5('0x50')]]||'rrmemory')==='rrmemory'){var _0x456e43;if(this['actions'][_0xc9501c[_0x82d5('0x126')]]&&!_[_0x82d5('0x47')](this[_0x82d5('0x2d')][this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xac')]])){if(this[_0x82d5('0x133')][_0x4d7d41[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xac')]]){this[_0x82d5('0x133')][_0x4d7d41[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]]['queue']]=this[_0x82d5('0x133')][this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xac')]]?this['queueBookedRR'][this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xac')]]:this[_0x82d5('0x2d')][this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xac')]]?this[_0x82d5('0x2d')][this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]]['queue']][_0x82d5('0x134')]||0x0:0x0;}this['queueBooked'][this[_0x82d5('0x26')][_0xc9501c[_0x82d5('0x126')]][_0x82d5('0xac')]][_0x82d5('0x134')]=this['queueBookedRR'][this[_0x82d5('0x26')][_0xc9501c['actionid']]['queue']];for(var _0x15071d=0x0;_0x15071d=0x0;})['catch'](myreject(_0x641a7a)));}}else{_0x34461f['push'](ami[_0x82d5('0xa9')]({'action':_0x82d5('0x14d'),'command':util[_0x82d5('0x76')]('iftime\x20%s,%s',_0xf11e34,!_[_0x82d5('0x3d')](config[_0x82d5('0x149')][_0x1feb84])?_0x1feb84:'')})[_0x82d5('0xb2')](function(_0x5d6de8){return _0x5d6de8[_0x82d5('0x14e')][_0x82d5('0x14f')](_0x82d5('0x150'))>=0x0;})[_0x82d5('0xaa')](myreject(_0x641a7a)));}BPromise['all'](_0x34461f)[_0x82d5('0xb2')](function(_0x4df544){var _0x3706b0=_[_0x82d5('0x151')](_0x4df544);if(_0x3706b0){return _0x5ce0e3(_0x3706b0);}else{_0x15433f[_0x82d5('0x3e')]=_0x42bcd0?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0x641a7a(msgResponse(_0x82d5('0x152'),_0x82d5('0x146'),'Global:\x20'+_0x42bcd0+'\x20'+_0x2d620a+'\x20Interval\x20is\x20overtime:\x20'+util[_0x82d5('0x93')](_0xf11e34,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1feb84));}})[_0x82d5('0xaa')](function(_0xf5b34b){return _0x641a7a(msgResponse(_0x82d5('0x144'),_0x82d5('0x146'),JSON[_0x82d5('0x4a')](_0xf5b34b)));});});};Dialer['prototype'][_0x82d5('0x153')]=function(_0x46bef4){var _0x42b175=this;return function(){switch(_0x46bef4[_0x82d5('0x5b')]){case _0x82d5('0x154'):freeVariablesPredictive(_0x46bef4);_0x42b175[_0x82d5('0x155')](_0x46bef4,0x1);break;case _0x82d5('0x156'):freeVariablesPredictive(_0x46bef4);_0x42b175['handlePower'](_0x46bef4,_0x46bef4[_0x82d5('0x157')]);break;case'predictive':_0x42b175[_0x82d5('0xa')](_0x46bef4);break;case'booked':freeVariablesPredictive(_0x46bef4);_0x42b175[_0x82d5('0x155')](_0x46bef4,0x1);break;default:freeVariablesPredictive(_0x46bef4);logger['error']('Queue',_0x46bef4[_0x82d5('0x40')],_0x82d5('0x158'));}};};Dialer[_0x82d5('0x1c')][_0x82d5('0x159')]=function(_0x3d5975){var _0x639cdd=this;return function(){_0x639cdd[_0x82d5('0x15a')](_0x3d5975);};};Dialer[_0x82d5('0x1c')][_0x82d5('0xc')]=function(_0x19ad69){var _0x438d43=this;if(isNotPreview(_0x19ad69[_0x82d5('0x5b')])){if(isVoiceQueueOutbound(_0x19ad69[_0x82d5('0x56')])&&isActive(_0x19ad69[_0x82d5('0x5a')])){_0x19ad69[_0x82d5('0x9d')]=!![];BPromise[_0x82d5('0xb1')]()[_0x82d5('0xb2')](checkIsLoggedIn(_0x19ad69,_0x19ad69[_0x82d5('0x15b')]))[_0x82d5('0xb2')](checkIsActive(_0x19ad69,_0x19ad69['dialActive']))[_0x82d5('0xb2')](checkInterval(_0x19ad69))[_0x82d5('0xb2')](_0x438d43[_0x82d5('0x13f')](_0x19ad69))[_0x82d5('0xb2')](_0x438d43[_0x82d5('0x143')](_0x19ad69[_0x82d5('0x15c')],_0x19ad69[_0x82d5('0x15d')],_0x19ad69['name'],_0x19ad69))[_0x82d5('0xb2')](_0x438d43[_0x82d5('0x145')](_0x19ad69['Interval'],_0x19ad69['dialTimezone'],_0x19ad69['name'],_0x19ad69))[_0x82d5('0xb2')](_0x438d43[_0x82d5('0x153')](_0x19ad69))[_0x82d5('0xaa')](loggerCatchQueueSummary(_0x82d5('0x15e'),_0x19ad69));}else{notSendMessagesQueue(_0x19ad69);}}else{freeVariablesPredictive(_0x19ad69);}};Dialer['prototype'][_0x82d5('0x15f')]=function(){var _0xa030f0=this;var _0x36b389;for(var _0x138410 in this[_0x82d5('0x22')]){if(typeof this[_0x82d5('0x22')][_0x138410]!==_0x82d5('0x95')){_0x36b389=this[_0x82d5('0x22')][_0x138410];if(isCampaignIvr(_0x36b389[_0x82d5('0x56')])&&isActive(_0x36b389[_0x82d5('0x73')])){_0x36b389['sendMessageOneNotActive']=!![];BPromise[_0x82d5('0xb1')]()[_0x82d5('0xb2')](checkIsActive(_0x36b389,_0x36b389[_0x82d5('0x73')]))[_0x82d5('0xb2')](checkInterval(_0x36b389))[_0x82d5('0xb2')](_0xa030f0[_0x82d5('0x13f')](_0x36b389))[_0x82d5('0xb2')](_0xa030f0[_0x82d5('0x143')](_0x36b389[_0x82d5('0x15c')],_0x36b389[_0x82d5('0x15d')],_0x36b389['name'],_0x36b389))[_0x82d5('0xb2')](_0xa030f0[_0x82d5('0x145')](_0x36b389[_0x82d5('0x43')],_0x36b389[_0x82d5('0x15d')],_0x36b389[_0x82d5('0x40')],_0x36b389))[_0x82d5('0xb2')](_0xa030f0[_0x82d5('0x159')](_0x36b389))['catch'](loggerCatchQueueSummary(_0x82d5('0x160'),_0x36b389));}else{notSendMessagesCampaign(_0x36b389);}}}};function getCallerIdRandom(_0x3f738a,_0x2aaa42){var _0x1b8bd3;var _0x3bffad;var _0x5abaf1;if(_0x2aaa42<=0x0){_0x2aaa42=0x1;}_0x1b8bd3=new RegExp(_0x82d5('0x161')+_0x2aaa42+'}$');_0x3bffad=Math[_0x82d5('0x162')](0xa,_0x2aaa42-0x1);_0x5abaf1=Math[_0x82d5('0x162')](0xa,_0x2aaa42)-0x1;return util[_0x82d5('0x76')]('%s',_['replace'](_0x3f738a,_0x1b8bd3,_[_0x82d5('0x163')](_0x3bffad,_0x5abaf1)));}function extractCalleridName(_0x170574){var _0x5e94cd=_0x170574[_0x82d5('0x164')](/"(.*?)"/);return _0x5e94cd?_0x5e94cd[0x1]:_0x170574;}function extractCalleridNumber(_0x56b8b4){var _0x3b87df=_0x56b8b4['match'](/<(.*?)>/);return _0x3b87df?_0x3b87df[0x1]:_0x56b8b4;}Dialer[_0x82d5('0x1c')][_0x82d5('0x165')]=function(_0x4837f0,_0x5b4ff0){var _0x41cb2f=this;var _0x47eb3f=uuid['v4']();this[_0x82d5('0x26')][_0x47eb3f]=new Action(_0x4837f0,_0x5b4ff0,_0x47eb3f);return new BPromise(function(_0x2dfb7b,_0xdb8e06){if(_['isUndefined'](_0x4837f0)&&typeof _0x4837f0!==_0x82d5('0x166')){return _0xdb8e06(msgResponse(_0x82d5('0x167'),_0x82d5('0x146'),_0x82d5('0x168')));}if(_[_0x82d5('0x3d')](_0x5b4ff0[_0x82d5('0x169')][_0x82d5('0x16a')])||_0x5b4ff0[_0x82d5('0x169')][_0x82d5('0x16a')]===null){return _0xdb8e06(msgResponse('originate',_0x82d5('0x146'),_0x82d5('0x16b')));}var _0x383525={'XMD-CALLERID':_0x41cb2f[_0x82d5('0x26')][_0x47eb3f][_0x82d5('0x16c')](),'XMD-AGI':_0x4837f0['dialQueueProject']?util['format'](_0x82d5('0x16d'),ipAgi,_0x4837f0[_0x82d5('0x104')]):_0x82d5('0x16e'),'XMD-AGIAFTER':_0x4837f0[_0x82d5('0x119')]?util[_0x82d5('0x76')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4837f0[_0x82d5('0x119')]):_0x82d5('0x16e'),'XMD-QUEUE':_0x4837f0[_0x82d5('0x56')]===_0x82d5('0x4f')?util['format'](_0x82d5('0x16f'),_0x4837f0['name'],_0x4837f0[_0x82d5('0x170')]||'',_0x4837f0[_0x82d5('0x10d')]?'c':'',_0x4837f0[_0x82d5('0x115')]||0x3):_0x82d5('0x16e'),'XMD-CONTACTID':_0x5b4ff0['ContactId'],'XMD-CDRTYPE':_0x82d5('0x8'),'CALLERID(all)':_0x41cb2f[_0x82d5('0x26')][_0x47eb3f][_0x82d5('0x16c')](),'XMD-AMD':_0x4837f0[_0x82d5('0xe7')]?'ACTIVE':'NONE','XMD-DESTINATION':_0x82d5('0xdd')};if(_0x4837f0[_0x82d5('0xe7')]){_0x383525['XMD-AMDINITIALSILENCE']=_0x4837f0['dialAMDInitialSilence']||0x9c4;_0x383525[_0x82d5('0x171')]=_0x4837f0[_0x82d5('0x172')]||0x5dc;_0x383525['XMD-AMDAFTERGREETINGSILENCE']=_0x4837f0['dialAMDAfterGreetingSilence']||0x320;_0x383525[_0x82d5('0x173')]=_0x4837f0[_0x82d5('0x174')]||0x1388;_0x383525[_0x82d5('0x175')]=_0x4837f0[_0x82d5('0x176')]||0x64;_0x383525['XMD-AMDBETWEENWORDSSILENCE']=_0x4837f0[_0x82d5('0x177')]||0x32;_0x383525[_0x82d5('0x178')]=_0x4837f0[_0x82d5('0x179')]||0x3;_0x383525[_0x82d5('0x17a')]=_0x4837f0[_0x82d5('0x17b')]||0x100;_0x383525[_0x82d5('0x17c')]=_0x4837f0['dialAMDMaximumWordLength']||0x1388;}if(_0x4837f0[_0x82d5('0x56')]===_0x82d5('0x4f')){_0x383525[_0x82d5('0x17d')]=_0x5b4ff0[_0x82d5('0xfa')];}else{_0x383525['XMD-CAMPAIGNID']=_0x5b4ff0[_0x82d5('0xd0')];}for(var _0x162a58 in _0x5b4ff0[_0x82d5('0x169')]){if(typeof _0x5b4ff0[_0x82d5('0x169')][_0x162a58]!=='undefined'){if(isNotNull(_0x5b4ff0[_0x82d5('0x169')][_0x162a58])&&_0x162a58!=='id'&&_0x162a58!==_0x82d5('0x17e')&&_0x162a58!==_0x82d5('0x17f')&&_0x162a58!==_0x82d5('0x180')){_0x383525[util[_0x82d5('0x76')](_0x82d5('0x181'),'XMD-',_[_0x82d5('0x182')](_0x162a58))]=_0x5b4ff0[_0x82d5('0x169')][_0x162a58];}}}var _0x307c6c=_0x41cb2f[_0x82d5('0xd5')](_0x4837f0['Trunk'])?getCallerId(_0x4837f0['Trunk'][_0x82d5('0x74')],_0x4837f0[_0x82d5('0x183')],_0x4837f0[_0x82d5('0x184')]>0x0?getCallerIdRandom(_0x4837f0[_0x82d5('0x185')],_0x4837f0[_0x82d5('0x184')]):_0x4837f0['dialOriginateCallerIdNumber']):getCallerId(_[_0x82d5('0xa8')](_0x4837f0[_0x82d5('0x140')])?_0x4837f0[_0x82d5('0x72')][_0x82d5('0x74')]:_0x4837f0[_0x82d5('0x140')][_0x82d5('0x74')],_0x4837f0['dialOriginateCallerIdName'],_0x4837f0[_0x82d5('0x184')]>0x0?getCallerIdRandom(_0x4837f0[_0x82d5('0x185')],_0x4837f0[_0x82d5('0x184')]):_0x4837f0[_0x82d5('0x185')]);if(_0x307c6c){_0x383525[_0x82d5('0x186')]=_0x41cb2f[_0x82d5('0x26')][_0x47eb3f][_0x82d5('0x187')]=extractCalleridName(_0x307c6c);_0x383525[_0x82d5('0x188')]=_0x41cb2f[_0x82d5('0x26')][_0x47eb3f]['originatecalleridnum']=extractCalleridNumber(_0x307c6c);}return ami[_0x82d5('0xa9')]({'actionid':_0x47eb3f,'action':_0x82d5('0x167'),'channel':_0x41cb2f[_0x82d5('0xd5')](_0x4837f0[_0x82d5('0x72')])?util['format'](_0x82d5('0x189'),_0x4837f0[_0x82d5('0x72')][_0x82d5('0x40')],isNotNull(_0x4837f0[_0x82d5('0x5c')])?_0x4837f0[_0x82d5('0x5c')][_0x82d5('0x18a')]()||'':'',_0x4837f0[_0x82d5('0x18b')]>0x0?_0x5b4ff0[_0x82d5('0x169')][_0x82d5('0x16a')][_0x82d5('0x18c')](_0x4837f0['dialCutDigit']):_0x5b4ff0[_0x82d5('0x169')]['phone']):util[_0x82d5('0x76')]('SIP/%s/%s%s',_['isNil'](_0x4837f0['TrunkBackup'])?_0x4837f0[_0x82d5('0x72')]['name']:_0x4837f0[_0x82d5('0x140')][_0x82d5('0x40')],isNotNull(_0x4837f0[_0x82d5('0x5c')])?_0x4837f0[_0x82d5('0x5c')][_0x82d5('0x18a')]()||'':'',_0x4837f0[_0x82d5('0x18b')]>0x0?_0x5b4ff0['Contact'][_0x82d5('0x16a')][_0x82d5('0x18c')](_0x4837f0[_0x82d5('0x18b')]):_0x5b4ff0[_0x82d5('0x169')]['phone']),'callerid':_0x307c6c,'Exten':_0x82d5('0xdd'),'Context':_0x82d5('0x18d'),'Priority':'1','variable':_0x383525,'timeout':(_0x4837f0[_0x82d5('0x18e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x47eb3f})[_0x82d5('0xb2')](function(_0x330c97){return _0x2dfb7b(_0x330c97);})['catch'](function(_0x5be17d){_0x4837f0[_0x82d5('0x62')]+=0x1;var _0x121fa9=new History(_0x41cb2f[_0x82d5('0x26')][_0x47eb3f]);logger[_0x82d5('0x92')](util[_0x82d5('0x76')]('[originateError]:\x20%s',JSON[_0x82d5('0x4a')](_0x5be17d)));_0x121fa9[_0x82d5('0xa1')]=0xe;_0x121fa9[_0x82d5('0xa2')]='OriginateError';_0x121fa9[_0x82d5('0xa4')]=moment()[_0x82d5('0x76')](_0x82d5('0xf9'));_0x121fa9[_0x82d5('0xa3')]=_0x121fa9[_0x82d5('0xa4')];_0x41cb2f[_0x82d5('0xc4')](_0x121fa9)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x18f')));_0x41cb2f[_0x82d5('0xc3')](_0x121fa9)[_0x82d5('0xaa')](loggerCatch('[originate][error]'))[_0x82d5('0x131')](function(){delete _0x41cb2f['actions'][_0x47eb3f];return _0xdb8e06(msgResponse(_0x82d5('0x167'),'Error',_0x82d5('0x190')));});});});};Dialer[_0x82d5('0x1c')][_0x82d5('0x32')]=function(_0x4b9fde){var _0x43f2ce=this[_0x82d5('0x26')][_0x4b9fde['actionid']];if(_0x43f2ce){delete this[_0x82d5('0x26')][_0x4b9fde[_0x82d5('0x126')]];_0x43f2ce[_0x82d5('0x191')]=moment()[_0x82d5('0x76')](_0x82d5('0xf9'));var _0xa781a4=_0x43f2ce['type']===_0x82d5('0xae')?this['campaigns'][_0x43f2ce[_0x82d5('0xac')]]:this['voiceQueues'][_0x43f2ce[_0x82d5('0x192')]()];if(!this[_0x82d5('0xd3')](_0x4b9fde[_0x82d5('0x193')])){this[_0x82d5('0xab')](_0xa781a4);return this[_0x82d5('0x194')](_0x43f2ce,_0xa781a4,_0x4b9fde)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0x82d5('0x28')][_0x4b9fde[_0x82d5('0xda')]]=_0x43f2ce;}};Dialer[_0x82d5('0x1c')]['checkRetriveMax']=function(_0x1803a5,_0x3797dd,_0x4e6ab1){var _0x49b457=new History(_0x3797dd);if(_0x49b457[_0x82d5('0xec')]+_0x49b457[_0x82d5('0x100')]+_0x49b457[_0x82d5('0xed')]+_0x49b457[_0x82d5('0xee')]+_0x49b457[_0x82d5('0xef')]+_0x49b457['countabandonedretry']+_0x49b457['countmachineretry']+_0x49b457[_0x82d5('0xf1')]>=_0x4e6ab1[_0x82d5('0xf2')]-0x1){return!![];}switch(_0x1803a5){case 0x3:if(_0x49b457['countnoanswerretry']>=_0x4e6ab1[_0x82d5('0x195')]-0x1){return!![];}this[_0x82d5('0xbb')]({'active':![],'countnoanswerretry':_0x49b457[_0x82d5('0xed')]+=0x1,'scheduledat':moment()[_0x82d5('0x101')](_0x4e6ab1[_0x82d5('0x196')],'minutes')[_0x82d5('0x76')](_0x82d5('0xf9')),'ContactId':_0x49b457[_0x82d5('0xcd')],'ListId':_0x49b457['ListId'],'VoiceQueueId':_0x49b457['VoiceQueueId']||undefined,'CampaignId':_0x49b457['CampaignId']||undefined})[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x197')));break;case 0x5:if(_0x49b457[_0x82d5('0xec')]>=_0x4e6ab1[_0x82d5('0x198')]-0x1){return!![];}this[_0x82d5('0xbb')]({'active':![],'countbusyretry':_0x49b457[_0x82d5('0xec')]+=0x1,'scheduledat':moment()[_0x82d5('0x101')](_0x4e6ab1[_0x82d5('0x199')],_0x82d5('0xf8'))['format'](_0x82d5('0xf9')),'ContactId':_0x49b457[_0x82d5('0xcd')],'ListId':_0x49b457[_0x82d5('0xce')],'VoiceQueueId':_0x49b457[_0x82d5('0xfa')]||undefined,'CampaignId':_0x49b457[_0x82d5('0xd0')]||undefined})[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x19a')));break;case 0x8:if(_0x49b457[_0x82d5('0x100')]>=_0x4e6ab1[_0x82d5('0x19b')]-0x1){return!![];}this[_0x82d5('0xbb')]({'active':![],'countcongestionretry':_0x49b457['countcongestionretry']+=0x1,'scheduledat':moment()[_0x82d5('0x101')](_0x4e6ab1[_0x82d5('0x19c')],_0x82d5('0xf8'))[_0x82d5('0x76')](_0x82d5('0xf9')),'ContactId':_0x49b457[_0x82d5('0xcd')],'ListId':_0x49b457['ListId'],'VoiceQueueId':_0x49b457[_0x82d5('0xfa')]||undefined,'CampaignId':_0x49b457[_0x82d5('0xd0')]||undefined})[_0x82d5('0xaa')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x49b457[_0x82d5('0xee')]>=_0x4e6ab1['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x49b457['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x4e6ab1[_0x82d5('0x19d')],_0x82d5('0xf8'))[_0x82d5('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x49b457[_0x82d5('0xcd')],'ListId':_0x49b457[_0x82d5('0xce')],'VoiceQueueId':_0x49b457[_0x82d5('0xfa')]||undefined,'CampaignId':_0x49b457['CampaignId']||undefined})[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x19e')));}break;case 0xa:if(_0x49b457[_0x82d5('0xef')]>=_0x4e6ab1['dialDropMaxRetry']-0x1){return!![];}this[_0x82d5('0xbb')]({'active':![],'countdropretry':_0x49b457[_0x82d5('0xef')]+=0x1,'scheduledat':moment()[_0x82d5('0x101')](_0x4e6ab1['dialDropRetryFrequency'],_0x82d5('0xf8'))[_0x82d5('0x76')](_0x82d5('0xf9')),'ContactId':_0x49b457[_0x82d5('0xcd')],'ListId':_0x49b457['ListId'],'VoiceQueueId':_0x49b457[_0x82d5('0xfa')]||undefined,'CampaignId':_0x49b457[_0x82d5('0xd0')]||undefined})[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x11c')));break;case 0xb:if(_0x49b457['countabandonedretry']>=_0x4e6ab1[_0x82d5('0x19f')]-0x1){return!![];}this[_0x82d5('0xbb')]({'active':![],'countabandonedretry':_0x49b457[_0x82d5('0xf0')]+=0x1,'scheduledat':moment()[_0x82d5('0x101')](_0x4e6ab1[_0x82d5('0x121')],_0x82d5('0xf8'))[_0x82d5('0x76')](_0x82d5('0xf9')),'ContactId':_0x49b457[_0x82d5('0xcd')],'ListId':_0x49b457[_0x82d5('0xce')],'VoiceQueueId':_0x49b457['VoiceQueueId']||undefined,'CampaignId':_0x49b457['CampaignId']||undefined})[_0x82d5('0xaa')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x49b457[_0x82d5('0xea')]>=_0x4e6ab1[_0x82d5('0xf5')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x49b457[_0x82d5('0xea')]+=0x1,'scheduledat':moment()['add'](_0x4e6ab1[_0x82d5('0x1a0')],'minutes')['format'](_0x82d5('0xf9')),'ContactId':_0x49b457[_0x82d5('0xcd')],'ListId':_0x49b457[_0x82d5('0xce')],'VoiceQueueId':_0x49b457[_0x82d5('0xfa')]||undefined,'CampaignId':_0x49b457[_0x82d5('0xd0')]||undefined})['catch'](loggerCatch(_0x82d5('0xfb')));break;case 0x14:if(_0x49b457[_0x82d5('0xf1')]>=_0x4e6ab1[_0x82d5('0x1a1')]-0x1){return!![];}this[_0x82d5('0xbb')]({'active':![],'countagentrejectretry':_0x49b457[_0x82d5('0xf1')]+=0x1,'scheduledat':moment()[_0x82d5('0x101')](_0x4e6ab1[_0x82d5('0x1a2')],_0x82d5('0xf8'))[_0x82d5('0x76')](_0x82d5('0xf9')),'ContactId':_0x49b457[_0x82d5('0xcd')],'ListId':_0x49b457['ListId'],'VoiceQueueId':_0x49b457['VoiceQueueId']||undefined,'CampaignId':_0x49b457[_0x82d5('0xd0')]||undefined})[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x1a3')));break;default:return!![];}};Dialer[_0x82d5('0x1c')][_0x82d5('0x194')]=function(_0x109f92,_0xfad8ef,_0x105d09){var _0x1c9ef5=this;var _0x15a6ba=new History(_0x109f92);return new BPromise(function(_0x2e5677,_0xa1d60){if(_[_0x82d5('0x3d')](_0xfad8ef)&&typeof _0xfad8ef!=='object'){return _0xa1d60(msgResponse(_0x82d5('0x1a4'),'Failure',_0x82d5('0x1a5')));}if(_[_0x82d5('0x3d')](_0x105d09)&&typeof _0x105d09!=='object'){return _0xa1d60(msgResponse(_0x82d5('0x1a4'),_0x82d5('0x146'),_0x82d5('0x1a6')));}switch(_0x105d09[_0x82d5('0x10a')]){case'0':_0xfad8ef['outboundNoSuchCallsDay']+=0x1;_0x15a6ba['state']=0x0;_0x15a6ba[_0x82d5('0xa2')]=_0x82d5('0x1a7');_0x15a6ba['countnosuchnumberretry']+=0x1;_0x15a6ba[_0x82d5('0xeb')]+=0x1;ami[_0x82d5('0x4e')](_0x82d5('0x1a8'),ut[_0x82d5('0xe4')](_0x109f92,_0x82d5('0x1a9')));_0x1c9ef5['createHistory'](_0x15a6ba)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0xff')));if(_0x1c9ef5[_0x82d5('0x1aa')](0x0,_0x109f92,_0xfad8ef)){if(_0x15a6ba[_0x82d5('0xee')]>=_0xfad8ef[_0x82d5('0x1ab')]){_0x1c9ef5[_0x82d5('0xf6')](_0x15a6ba,_0x2e5677,_0xa1d60,_0x82d5('0x1ac'));}else{_0x1c9ef5['stateGlobal'](_0x15a6ba,_0x2e5677,_0xa1d60,_0x82d5('0x1ac'));}}break;case'3':_0xfad8ef['outboundNoAnswerCallsDay']+=0x1;_0x15a6ba['state']=0x3;_0x15a6ba[_0x82d5('0xa2')]='NoAnswer';_0x15a6ba[_0x82d5('0xed')]+=0x1;_0x15a6ba[_0x82d5('0xeb')]+=0x1;ami[_0x82d5('0x4e')](_0x82d5('0x1ad'),ut['buildObj'](_0x109f92,_0x82d5('0x1ae')));_0x1c9ef5[_0x82d5('0xc4')](_0x15a6ba)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x1af')));if(_0x1c9ef5['checkRetriveMax'](0x3,_0x109f92,_0xfad8ef)){if(_0x15a6ba[_0x82d5('0xed')]>=_0xfad8ef['dialNoAnswerMaxRetry']){_0x1c9ef5[_0x82d5('0xf6')](_0x15a6ba,_0x2e5677,_0xa1d60,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1c9ef5[_0x82d5('0xf3')](_0x15a6ba,_0x2e5677,_0xa1d60,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xfad8ef[_0x82d5('0x1b0')]+=0x1;_0x15a6ba[_0x82d5('0xa1')]=0x5;_0x15a6ba[_0x82d5('0xa2')]='Busy';_0x15a6ba[_0x82d5('0xec')]+=0x1;_0x15a6ba[_0x82d5('0xeb')]+=0x1;ami[_0x82d5('0x4e')](_0x82d5('0x1b1'),ut[_0x82d5('0xe4')](_0x109f92,_0x82d5('0x1b2')));_0x1c9ef5['createHistory'](_0x15a6ba)[_0x82d5('0xaa')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x1c9ef5['checkRetriveMax'](0x5,_0x109f92,_0xfad8ef)){if(_0x15a6ba[_0x82d5('0xec')]>=_0xfad8ef[_0x82d5('0x198')]){_0x1c9ef5['createStateFinal'](_0x15a6ba,_0x2e5677,_0xa1d60,_0x82d5('0x1b3'));}else{_0x1c9ef5[_0x82d5('0xf3')](_0x15a6ba,_0x2e5677,_0xa1d60,'reason\x205\x20busy');}}break;case'8':_0xfad8ef['outboundCongestionCallsDay']+=0x1;_0x15a6ba[_0x82d5('0xa1')]=0x8;_0x15a6ba[_0x82d5('0xa2')]='Congestion';_0x15a6ba['countcongestionretry']+=0x1;_0x15a6ba[_0x82d5('0xeb')]+=0x1;ami[_0x82d5('0x4e')](_0x82d5('0x1b4'),ut['buildObj'](_0x109f92,_0x82d5('0x1b5')));_0x1c9ef5[_0x82d5('0xc4')](_0x15a6ba)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x1b6')));if(_0x1c9ef5[_0x82d5('0x1aa')](0x8,_0x109f92,_0xfad8ef)){if(_0x15a6ba[_0x82d5('0x100')]>=_0xfad8ef[_0x82d5('0x19b')]){_0x1c9ef5['createStateFinal'](_0x15a6ba,_0x2e5677,_0xa1d60,_0x82d5('0x1b7'));}else{_0x1c9ef5['stateGlobal'](_0x15a6ba,_0x2e5677,_0xa1d60,_0x82d5('0x1b7'));}}break;case'11':_0xfad8ef['outboundAbandonedCallsDay']+=0x1;_0x15a6ba[_0x82d5('0xa1')]=0xb;_0x15a6ba[_0x82d5('0xa2')]=_0x82d5('0x11f');_0x15a6ba['countabandonedretry']+=0x1;_0x15a6ba['countglobal']+=0x1;_0x1c9ef5['createHistory'](_0x15a6ba)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x124')));if(_0x1c9ef5[_0x82d5('0x1aa')](0xb,_0x109f92,_0xfad8ef)){if(_0x15a6ba['countabandonedretry']>=_0xfad8ef[_0x82d5('0x19f')]){_0x1c9ef5[_0x82d5('0xf6')](_0x15a6ba,_0x2e5677,_0xa1d60,_0x82d5('0x1b8'));}else{_0x1c9ef5['stateGlobal'](_0x15a6ba,_0x2e5677,_0xa1d60,_0x82d5('0x1b8'));}}break;case'20':_0xfad8ef['outboundRejectCallsDay']+=0x1;_0x15a6ba[_0x82d5('0xa1')]=0x14;_0x15a6ba['statedesc']='AgentReject';_0x15a6ba[_0x82d5('0xf1')]+=0x1;_0x15a6ba[_0x82d5('0xeb')]+=0x1;ami[_0x82d5('0x4e')]('custom:agentreject',ut['buildObj'](_0x109f92,_0x82d5('0x1b9')));_0x1c9ef5['createHistory'](_0x15a6ba)[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x1ba')));if(_0x1c9ef5[_0x82d5('0x1aa')](0x14,_0x109f92,_0xfad8ef)){if(_0x15a6ba['countagentrejectretry']>=_0xfad8ef[_0x82d5('0x1a1')]){_0x1c9ef5[_0x82d5('0xf6')](_0x15a6ba,_0x2e5677,_0xa1d60,_0x82d5('0x1bb'));}else{_0x1c9ef5[_0x82d5('0xf3')](_0x15a6ba,_0x2e5677,_0xa1d60,'reason\x2020\x20agentreject');}}break;default:_0xfad8ef[_0x82d5('0x64')]+=0x1;_0x15a6ba['state']=0xc;_0x15a6ba[_0x82d5('0xa2')]=_0x105d09['reason'];_0x1c9ef5[_0x82d5('0xc4')](_0x15a6ba)[_0x82d5('0xaa')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x1c9ef5[_0x82d5('0x1aa')](_0x105d09['reason'],_0x109f92,_0xfad8ef)){if(_0x15a6ba[_0x82d5('0xec')]+_0x15a6ba[_0x82d5('0x100')]+_0x15a6ba[_0x82d5('0xed')]+_0x15a6ba[_0x82d5('0xee')]+_0x15a6ba[_0x82d5('0xef')]+_0x15a6ba[_0x82d5('0xf0')]+_0x15a6ba[_0x82d5('0xea')]+_0x15a6ba['countagentrejectretry']>=_0xfad8ef[_0x82d5('0xf2')]){_0x1c9ef5[_0x82d5('0xf3')](_0x15a6ba,_0x2e5677,_0xa1d60,_0x105d09[_0x82d5('0x10a')]);}else{_0x1c9ef5[_0x82d5('0xf6')](_0x15a6ba,_0x2e5677,_0xa1d60,_0x105d09[_0x82d5('0x10a')]);}}}});};Dialer[_0x82d5('0x1c')][_0x82d5('0xf3')]=function(_0x277fe1,_0x409720,_0x5c62a6,_0x7a2b9b){var _0x5ed3c7=new Final(_0x277fe1);_0x5ed3c7[_0x82d5('0xa1')]=0xf;_0x5ed3c7['statedesc']='Global';this[_0x82d5('0xf6')](_0x5ed3c7,_0x409720,_0x5c62a6,_0x7a2b9b);};Dialer[_0x82d5('0x1c')]['createStateFinal']=function(_0x230743,_0x5bb269,_0x597572,_0x1e0d4a){this[_0x82d5('0xc3')](_0x230743)[_0x82d5('0xb2')](function(){return _0x5bb269(msgResponse('[callProgressDetecting]','Success',_0x1e0d4a));})['catch'](function(){return _0x597572(msgResponse(_0x82d5('0x1bc'),_0x82d5('0x146'),_0x82d5('0x1bd')));});};Dialer[_0x82d5('0x1c')]['predictive']=function(_0x1717df){var _0x546fca=_0x1717df[_0x82d5('0x1be')]/0x64;var _0x1bd273=_0x1717df[_0x82d5('0x61')]/(_0x1717df[_0x82d5('0x61')]+_0x1717df[_0x82d5('0xdf')]);var _0x561bef=Math[_0x82d5('0x1bf')](_0x1717df[_0x82d5('0x6d')]*(_0x1717df[_0x82d5('0x1c0')]/0x64));var _0x3a724f=Math[_0x82d5('0x1bf')](_0x1717df['predictiveIntervalAvailable']*(_0x1717df[_0x82d5('0x1c1')]/0x64));var _0x4bb6c2=_0x1717df[_0x82d5('0x52')]+_0x1717df['talking'];var _0x4f6dfe=Math[_0x82d5('0x1c2')](_0x1717df['erlangCalls']*_0x1717df[_0x82d5('0x70')]*_0x1717df['predictiveIntervalHitRate']*_0x1717df[_0x82d5('0x6c')]);if(_[_0x82d5('0x3d')](_0x1717df['startProgressive'])){if(!_[_0x82d5('0x3d')](_0x1717df[_0x82d5('0x2a')])){_0x1717df[_0x82d5('0x2a')]=undefined;loggerPredictive[_0x82d5('0x92')]('[startMethodPredictive][StartProgressive]',_0x82d5('0x1c3'));}if(!_['isUndefined'](_0x1717df[_0x82d5('0x8e')])){loggerPredictive[_0x82d5('0x92')](_0x82d5('0x1c4'),_0x82d5('0x1c5'));clearInterval(_0x1717df[_0x82d5('0x8e')]);_0x1717df[_0x82d5('0x8e')]=undefined;}_0x1717df[_0x82d5('0x2b')]=moment()[_0x82d5('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x82d5('0x7b')](_0x1717df['name'],_0x82d5('0x1c6'),_0x1717df['startProgressive']);this[_0x82d5('0x155')](_0x1717df,0x1);}else if(ifInterval(_0x1717df[_0x82d5('0x1c7')],_0x1717df[_0x82d5('0x2b')])){this[_0x82d5('0x155')](_0x1717df,0x1);loggerPredictiveCalls[_0x82d5('0x7b')](_0x82d5('0x1c8'),_0x1717df[_0x82d5('0x2b')],_0x1717df[_0x82d5('0x40')]);_0x1717df[_0x82d5('0x8a')]=0x0;_0x1717df[_0x82d5('0x6a')]=0x0;}else if(_0x546fca<_0x1bd273&&_0x1717df[_0x82d5('0x1c9')]===_0x82d5('0x1ca')){freeVariablesPredictive(_0x1717df);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x1bd273,_0x82d5('0x2b'),_0x1717df[_0x82d5('0x40')]);}else if(_0x4f6dfe<_0x1717df[_0x82d5('0x6a')]&&_0x1717df['dialPredictiveOptimization']===_0x82d5('0x1ca')){freeVariablesPredictive(_0x1717df);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x1cb'),_0x82d5('0x1cc'),_0x4f6dfe,_0x82d5('0x1cd'),_0x1717df['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x1717df[_0x82d5('0x40')]);}else if(!ifInterval(_0x1717df['dialPredictiveInterval'],_0x1717df[_0x82d5('0x2b')])&&_[_0x82d5('0x3d')](_0x1717df[_0x82d5('0x2a')])&&!_[_0x82d5('0x3d')](_0x1717df[_0x82d5('0x2b')])){_0x1717df['startPredictive']=moment()[_0x82d5('0x76')](_0x82d5('0xf9'));loggerPredictive[_0x82d5('0x7b')](_0x1717df[_0x82d5('0x40')],_0x82d5('0x1ce'),_0x1717df[_0x82d5('0x2a')]);this['averageHandleTime'](_0x1717df[_0x82d5('0x1c7')])[_0x82d5('0xb2')](this[_0x82d5('0x1cf')](_0x1717df))[_0x82d5('0xb2')](mergeDataErlangB(_0x1717df))['then'](this[_0x82d5('0x1d0')](_0x1717df))[_0x82d5('0xaa')](loggerCatchPredictive(_0x82d5('0x1d1'),_0x1717df));}else if(!ifInterval(_0x1717df['dialPredictiveInterval'],_0x1717df[_0x82d5('0x2a')])){_0x1717df[_0x82d5('0x6a')]=0x0;_0x1717df[_0x82d5('0x2a')]=moment()[_0x82d5('0x76')](_0x82d5('0xf9'));loggerPredictive['info'](_0x1717df['name'],'recalculate\x20predictive\x20at',_0x1717df[_0x82d5('0x2a')]);clearInterval(_0x1717df[_0x82d5('0x8e')]);_0x1717df[_0x82d5('0x8e')]=undefined;this[_0x82d5('0xb8')](_0x1717df['dialPredictiveInterval'])[_0x82d5('0xb2')](this[_0x82d5('0x1cf')](_0x1717df))[_0x82d5('0xb2')](mergeDataErlangB(_0x1717df))['then'](this['startMethodPredictive'](_0x1717df))[_0x82d5('0xaa')](loggerCatchPredictive(_0x82d5('0x1d2'),_0x1717df));}else if(_0x1717df[_0x82d5('0x6d')]&&_0x4bb6c2<_0x1717df[_0x82d5('0x6d')]-_0x3a724f){freeVariablesPredictive(_0x1717df);loggerPredictive[_0x82d5('0x7b')](_0x1717df[_0x82d5('0x40')],_0x82d5('0x1d3'),_0x4bb6c2,_0x82d5('0x1d4'),_0x1717df[_0x82d5('0x6d')],'-',_0x3a724f,'=',_0x1717df[_0x82d5('0x6d')]-_0x3a724f,')');}else if(_0x1717df[_0x82d5('0x6d')]&&_0x4bb6c2>_0x1717df[_0x82d5('0x6d')]+_0x561bef){freeVariablesPredictive(_0x1717df);loggerPredictive[_0x82d5('0x7b')](_0x1717df[_0x82d5('0x40')],_0x82d5('0x1d3'),_0x4bb6c2,_0x82d5('0x1d5'),_0x1717df[_0x82d5('0x6d')],'+',_0x561bef,'=',_0x1717df['predictiveIntervalAvailable']+_0x561bef,')');}};Dialer[_0x82d5('0x1c')][_0x82d5('0x1cf')]=function(_0x17ae33){var _0x3ff256=this;return function(_0x30b775){return new BPromise(function(_0x47db08,_0x3d6b2d){_['merge'](_0x17ae33,_0x30b775[0x0]);if(checkGetDataPredictive(_0x30b775[0x0])){var _0xc7f7a2=_0x17ae33[_0x82d5('0x6d')]=_0x17ae33[_0x82d5('0x55')]+_0x17ae33[_0x82d5('0x52')];var _0x29518=_0x17ae33[_0x82d5('0x1c7')]*0x3c;var _0x411d6c=_0x30b775[0x0][_0x82d5('0x66')]+_0x30b775[0x0][_0x82d5('0x81')];var _0x5effa9=(_0x30b775[0x0][_0x82d5('0x65')]+_0x30b775[0x0][_0x82d5('0x68')]+_0x30b775[0x0][_0x82d5('0x67')])/_0x30b775[0x0]['predictiveIntervalTotalCalls'];_0x17ae33[_0x82d5('0x6b')]=_0x5effa9>0x0?_0x5effa9:0x1;switch(_0x17ae33[_0x82d5('0x1c9')]){case _0x82d5('0x1ca'):var _0x74e191=_0x17ae33[_0x82d5('0x1be')]/0x64;return _0x3ff256[_0x82d5('0x1d6')](_0xc7f7a2,_0x29518,_0x411d6c,_0x5effa9,_0x74e191)[_0x82d5('0xb2')](function(_0x4109df){return _0x47db08(_0x4109df);});case _0x82d5('0x1d7'):var _0x172195=_0x17ae33[_0x82d5('0x1be')]/0x64;return _0x3ff256[_0x82d5('0x1d8')](_0xc7f7a2,_0x29518,_0x411d6c,_0x5effa9,_0x172195)[_0x82d5('0xb2')](function(_0x44d5d4){return _0x47db08(_0x44d5d4);});default:return _0x3d6b2d(msgResponse(_0x82d5('0x1d9'),'Failure',_0x82d5('0x1da')));}}else{return _0x3d6b2d(msgResponse('[getDataPredictive]',_0x82d5('0x146'),_0x82d5('0x1db')));}});};};Dialer[_0x82d5('0x1c')]['getDataPredictiveOld']=function(_0x52eeaa){var _0x2218cb=this;return function(_0x14950d){return new BPromise(function(_0x5cf2b5,_0x3a90fd){_['merge'](_0x52eeaa,_0x14950d[0x0]);if(checkGetDataPredictive(_0x14950d[0x0])){loggerPredictive[_0x82d5('0x7b')](JSON['stringify'](_0x14950d[0x0]));if(_0x52eeaa[_0x82d5('0x1c9')]===_0x82d5('0x1ca')){return _0x2218cb[_0x82d5('0xc1')](_0x52eeaa['id'])[_0x82d5('0xb2')](function(_0x1208b9){var _0x4f772f=_0x52eeaa['loggedIn']-_0x1208b9[0x0][_0x82d5('0x1dc')];var _0x5d26bc=_0x52eeaa['dialPredictiveInterval']*0x3c;var _0x5e030f=_0x14950d[0x0]['predictiveIntervalAvgTalktime']+_0x14950d[0x0]['predictiveIntervalAvgHoldtime'];var _0x452a75=(_0x14950d[0x0][_0x82d5('0x65')]+_0x14950d[0x0][_0x82d5('0x68')]+_0x14950d[0x0][_0x82d5('0x67')])/_0x14950d[0x0]['predictiveIntervalTotalCalls'];var _0x457e13=_0x52eeaa['dialPredictiveOptimizationPercentage']/0x64;_0x52eeaa[_0x82d5('0x1dd')]=_0x1208b9[0x0][_0x82d5('0x1dc')]||0x0;_0x52eeaa[_0x82d5('0x6b')]=_0x452a75>0x0?_0x452a75:0x1;return _0x2218cb[_0x82d5('0x1d6')](_0x4f772f,_0x5d26bc,_0x5e030f,_0x452a75,_0x457e13);})[_0x82d5('0xb2')](function(_0x13e543){return _0x5cf2b5(_0x13e543);})['catch'](function(_0x2d7180){return _0x3a90fd(msgResponse(_0x82d5('0x1de'),'Failure',JSON[_0x82d5('0x4a')](_0x2d7180)));});}if(_0x52eeaa['dialPredictiveOptimization']===_0x82d5('0x1d7')){return _0x2218cb[_0x82d5('0xc1')](_0x52eeaa['id'])['then'](function(_0x4337f6){var _0x47c96a=_0x52eeaa[_0x82d5('0x15b')]-_0x4337f6[0x0][_0x82d5('0x1dc')];var _0x39b77c=_0x52eeaa[_0x82d5('0x1c7')]*0x3c;var _0x3786bc=_0x14950d[0x0][_0x82d5('0x66')]+_0x14950d[0x0][_0x82d5('0x81')];var _0x1a579a=(_0x14950d[0x0][_0x82d5('0x65')]+_0x14950d[0x0][_0x82d5('0x68')]+_0x14950d[0x0][_0x82d5('0x67')])/_0x14950d[0x0][_0x82d5('0x83')];var _0x4c3a37=_0x52eeaa[_0x82d5('0x1be')]/0x64;_0x52eeaa[_0x82d5('0x1dd')]=_0x4337f6[0x0]['outboundQueuePauses']||0x0;_0x52eeaa[_0x82d5('0x6b')]=_0x1a579a>0x0?_0x1a579a:0x1;return _0x2218cb[_0x82d5('0x1d8')](_0x47c96a,_0x39b77c,_0x3786bc,_0x1a579a,_0x4c3a37);})['then'](function(_0x3c3705){return _0x5cf2b5(_0x3c3705);})[_0x82d5('0xaa')](function(_0x2b5983){return _0x3a90fd(msgResponse(_0x82d5('0x1de'),'Failure',JSON[_0x82d5('0x4a')](_0x2b5983)));});}}else{return _0x3a90fd(msgResponse(_0x82d5('0x1d9'),_0x82d5('0x146'),_0x82d5('0x1db')));}});};};Dialer[_0x82d5('0x1c')][_0x82d5('0x1d0')]=function(_0x4d4d34){var _0x41934b=this;return function(){var _0x125817=0x0;var _0x1a778f=Math[_0x82d5('0x1c2')](_0x4d4d34[_0x82d5('0x6f')]*0x3e8);if(_0x1a778f>0x0){_0x1a778f=_0x1a778f<0x64?0x64:_0x1a778f;loggerPredictive[_0x82d5('0x7b')](_0x4d4d34[_0x82d5('0x40')],_0x82d5('0x1df'),_0x1a778f,_0x82d5('0x4b'));_0x4d4d34[_0x82d5('0x8e')]=setInterval(function(){_0x41934b[_0x82d5('0x8e')](_0x4d4d34);loggerPredictiveCalls[_0x82d5('0x7b')]('[handlePredictive]',_0x125817+=0x1);},_0x1a778f);}else{loggerPredictive[_0x82d5('0x7b')](_0x4d4d34[_0x82d5('0x40')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x82d5('0x1c')][_0x82d5('0x1e0')]=function(_0x205ed5,_0x3ebc3c){var _0x14ebd1=this;return function(_0x3a7062){if(_[_0x82d5('0x47')](_0x3a7062)){if(_['isNil'](_0x3ebc3c[_0x82d5('0xcf')])||!_0x3ebc3c['recallme']){if(_0x205ed5[_0x82d5('0x5b')]===_0x82d5('0x9')){_0x205ed5[_0x82d5('0x12c')]=_[_0x82d5('0x3d')](_0x205ed5[_0x82d5('0x12c')])?!![]:_0x205ed5[_0x82d5('0x12c')];var _0x1618dd=uuid['v4']();_0x14ebd1[_0x82d5('0x26')][_0x1618dd]=new Action(_0x205ed5,_0x3ebc3c,_0x1618dd);loggerBooked[_0x82d5('0x7b')]('[booked][checkContactBlack]',_0x1618dd,'queueStatusComplete:\x20',JSON[_0x82d5('0x4a')](_0x205ed5['queueStatusComplete']),_0x82d5('0x1e1'),_0x205ed5[_0x82d5('0x40')]);if(_0x205ed5[_0x82d5('0x12c')]){_0x205ed5[_0x82d5('0x12c')]=![];_0x14ebd1[_0x82d5('0x2d')][_0x14ebd1['actions'][_0x1618dd]['queue']]=[];ami[_0x82d5('0xa9')]({'actionid':_0x1618dd,'action':_0x82d5('0x1e2'),'queue':_0x205ed5['name']})[_0x82d5('0xaa')](function(){_0x14ebd1[_0x82d5('0xab')](_0x205ed5);_0x14ebd1[_0x82d5('0xbb')]({'active':![],'ContactId':_0x14ebd1['actions'][_0x1618dd][_0x82d5('0xcd')],'ListId':_0x14ebd1[_0x82d5('0x26')][_0x1618dd][_0x82d5('0xce')],'VoiceQueueId':_0x14ebd1[_0x82d5('0x26')][_0x1618dd]['VoiceQueueId']||undefined,'CampaignId':_0x14ebd1[_0x82d5('0x26')][_0x1618dd][_0x82d5('0xd0')]||undefined})[_0x82d5('0xaa')](loggerCatch(_0x82d5('0x1e3')));delete _0x14ebd1['actions'][_0x1618dd];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x82d5('0x4a')](_0x205ed5[_0x82d5('0x12c')]),_0x82d5('0x1e1'),_0x205ed5[_0x82d5('0x40')]);_0x14ebd1['updateOriginated'](_0x205ed5);_0x14ebd1[_0x82d5('0xbb')]({'active':![],'ContactId':_0x14ebd1[_0x82d5('0x26')][_0x1618dd][_0x82d5('0xcd')],'ListId':_0x14ebd1[_0x82d5('0x26')][_0x1618dd][_0x82d5('0xce')],'VoiceQueueId':_0x14ebd1[_0x82d5('0x26')][_0x1618dd][_0x82d5('0xfa')]||undefined,'CampaignId':_0x14ebd1[_0x82d5('0x26')][_0x1618dd][_0x82d5('0xd0')]||undefined})[_0x82d5('0xaa')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x14ebd1[_0x82d5('0x26')][_0x1618dd];}}else{return _0x14ebd1[_0x82d5('0x165')](_0x205ed5,_0x3ebc3c);}}else{if(getDiff(_0x3ebc3c['scheduledat'])<_0x205ed5[_0x82d5('0x1e4')]*0x3c){if(_0x3ebc3c['Agent']&&!_0x3ebc3c['Agent']['voicePause']){_0x14ebd1[_0x82d5('0x20')][_0x82d5('0x12f')](_0x3ebc3c['id'])[_0x82d5('0x131')](function(){_0x14ebd1[_0x82d5('0xab')](_0x205ed5);});}else{_0x14ebd1[_0x82d5('0x1e5')]({'active':![]},_0x3ebc3c['id'],0x1)[_0x82d5('0x131')](function(){_0x14ebd1[_0x82d5('0xab')](_0x205ed5);});}}else{_0x205ed5['outboundReCallsDay']+=0x1;_0x14ebd1[_0x82d5('0xab')](_0x205ed5);if(_0x205ed5[_0x82d5('0x1e6')]){_0x14ebd1[_0x82d5('0xbb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ebc3c[_0x82d5('0xcd')],'ListId':_0x3ebc3c[_0x82d5('0xce')],'VoiceQueueId':_0x3ebc3c[_0x82d5('0xfa')]||undefined,'CampaignId':_0x3ebc3c[_0x82d5('0xd0')]||undefined})['catch'](loggerCatch(_0x82d5('0x1e7')));_0x14ebd1[_0x82d5('0xc4')](createObjHistory(_0x205ed5,_0x3ebc3c,_0x82d5('0x1e8'),0x17,_0x82d5('0x1e9')))[_0x82d5('0xaa')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x14ebd1[_0x82d5('0xca')](createObjHistory(_0x205ed5,_0x3ebc3c,_0x82d5('0x1ea'),0x16,_0x82d5('0x1eb')),_0x82d5('0x1ec'),_0x82d5('0x1ed'));}}}}else{_0x205ed5[_0x82d5('0x1ee')]+=0x1;_0x14ebd1[_0x82d5('0xca')](createObjHistory(_0x205ed5,_0x3ebc3c,'BLACKLIST',0xd,_0x82d5('0x1ef')),_0x82d5('0x1f0'),_0x82d5('0x1f1'));throw _0x82d5('0x1f2');}};};Dialer[_0x82d5('0x1c')][_0x82d5('0x15a')]=function(_0x48d45b){var _0x30fb71=this;var _0x54ec5c=_0x48d45b[_0x82d5('0x1f3')]-_0x48d45b[_0x82d5('0x6e')]-_0x48d45b['temp'];emitCampaignSummary(_0x48d45b);if(_0x54ec5c>0x0){if(_0x54ec5c>this[_0x82d5('0x25')]){_0x54ec5c=this['maxNumberOriginate'];}_0x48d45b[_0x82d5('0xbe')]+=_0x54ec5c;this[_0x82d5('0xc0')](_0x48d45b['id'],_0x54ec5c,_0x48d45b[_0x82d5('0x1f4')],_0x48d45b)[_0x82d5('0xb2')](function(_0x5ec306){_0x48d45b[_0x82d5('0xbe')]-=_0x54ec5c;_0x48d45b[_0x82d5('0xbe')]=_0x48d45b[_0x82d5('0xbe')]>0x0?_0x48d45b[_0x82d5('0xbe')]:0x0;if(!checkContactEmpty(_0x5ec306)){_0x48d45b[_0x82d5('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x82d5('0x7b')](_0x82d5('0x1f5')+_0x48d45b[_0x82d5('0x40')]);}else{_0x48d45b[_0x82d5('0x6e')]+=_0x5ec306[_0x82d5('0x94')];_0x48d45b[_0x82d5('0x3e')]=_0x82d5('0x1f6');for(var _0xda6d5a=0x0;_0xda6d5a<_0x5ec306[_0x82d5('0x94')];_0xda6d5a+=0x1){_0x48d45b[_0x82d5('0x1f7')]+=0x1;if(_['isNil'](_0x5ec306[_0xda6d5a])||_[_0x82d5('0xa8')](_0x5ec306[_0xda6d5a][_0x82d5('0x169')])||_[_0x82d5('0xa8')](_0x5ec306[_0xda6d5a][_0x82d5('0x169')]['phone'])){_0x30fb71['emptyContact'](_0x82d5('0x1f8'),_0x48d45b,_0x5ec306[_0xda6d5a]);}else{_0x30fb71[_0x82d5('0xb6')](_['pick'](_0x5ec306[_0xda6d5a],[_0x82d5('0xd0'),'Contact.phone']))[_0x82d5('0xb2')](_0x30fb71[_0x82d5('0x1e0')](_0x48d45b,_0x5ec306[_0xda6d5a]))[_0x82d5('0xaa')](_0x30fb71[_0x82d5('0xc7')](_0x82d5('0x1f9'),_0x48d45b));}}}})[_0x82d5('0xaa')](loggerGetContactDialer(_0x82d5('0x1fa'),_0x48d45b,_0x54ec5c));}};Dialer[_0x82d5('0x1c')][_0x82d5('0x155')]=function(_0x1e94ca,_0x26045d){var _0x26b512=this;var _0x2f757a=[];var _0x1e8ab7=_0x26045d>=0x1?_0x26045d:0x1;if(_0x1e94ca['dialMethod']==='booked'){_0x1e8ab7=0x1;}var _0x10b1b0=Math[_0x82d5('0x1c2')](_0x1e94ca[_0x82d5('0x52')]*_0x1e8ab7)-_0x1e94ca[_0x82d5('0x6e')]-_0x1e94ca[_0x82d5('0xbe')];emitVoiceQueueSummary(_0x1e94ca);if(_0x1e94ca[_0x82d5('0x1fb')]>0x0){var _0x172eee=_0x1e94ca[_0x82d5('0x1fb')]-_0x1e94ca[_0x82d5('0x6e')]-_0x1e94ca[_0x82d5('0x55')]-_0x1e94ca[_0x82d5('0xbe')]-_0x1e94ca[_0x82d5('0x99')];if(_0x10b1b0>_0x172eee){_0x10b1b0=_0x172eee;}}if(_0x10b1b0>0x0){if(_0x1e94ca[_0x82d5('0x5b')]==='booked'){_0x10b1b0=0x1;}if(_0x10b1b0>this['maxNumberOriginate']){_0x10b1b0=this[_0x82d5('0x25')];}_0x1e94ca['temp']+=_0x10b1b0;for(var _0x2a96f6 in this['agents']){if(typeof this[_0x82d5('0x23')][_0x2a96f6]!==_0x82d5('0x95')){if(this['agents'][_0x2a96f6][_0x82d5('0xa1')]===_0x82d5('0x1fc')&&this[_0x82d5('0x23')][_0x2a96f6][_0x82d5('0xd6')]===_0x82d5('0xd7')){_0x2f757a[_0x82d5('0x129')](this[_0x82d5('0x23')][_0x2a96f6]['id']);}}}this[_0x82d5('0xbd')](_0x1e94ca['id'],_0x2f757a,_0x10b1b0,_0x1e94ca[_0x82d5('0x1f4')],_0x1e94ca)[_0x82d5('0xb2')](function(_0x23ae1a){_0x1e94ca[_0x82d5('0xbe')]-=_0x10b1b0;_0x1e94ca['temp']=_0x1e94ca['temp']>0x0?_0x1e94ca['temp']:0x0;if(!checkContactEmpty(_0x23ae1a)){_0x26b512['countReScheduled'](_0x1e94ca)['then'](sendMessageReschedule(_0x1e94ca))[_0x82d5('0xaa')](loggerCatch(_0x82d5('0xb3')));}else{_0x1e94ca[_0x82d5('0x6e')]+=_0x23ae1a[_0x82d5('0x94')];_0x1e94ca[_0x82d5('0x3e')]=_0x1e94ca['dialMethod']===_0x82d5('0x9')?_0x82d5('0x1fd'):_0x82d5('0x1f6');for(var _0x2a721f=0x0;_0x2a721f<_0x23ae1a['length'];_0x2a721f+=0x1){if(_['isNil'](_0x23ae1a[_0x2a721f])||_[_0x82d5('0xa8')](_0x23ae1a[_0x2a721f][_0x82d5('0x169')])||_[_0x82d5('0xa8')](_0x23ae1a[_0x2a721f][_0x82d5('0x169')][_0x82d5('0x16a')])){_0x26b512[_0x82d5('0xc8')](_0x82d5('0x1f8'),_0x1e94ca,_0x23ae1a[_0x2a721f]);}else{_0x26b512[_0x82d5('0xb4')](_['pick'](_0x23ae1a[_0x2a721f],['VoiceQueueId',_0x82d5('0x1fe')]))[_0x82d5('0xb2')](_0x26b512[_0x82d5('0x1e0')](_0x1e94ca,_0x23ae1a[_0x2a721f]))[_0x82d5('0xaa')](_0x26b512[_0x82d5('0xc7')](_0x82d5('0x1f8'),_0x1e94ca));}}}})[_0x82d5('0xaa')](loggerGetContactDialer(_0x82d5('0x1ff'),_0x1e94ca,_0x10b1b0));}};Dialer[_0x82d5('0x1c')]['handlePredictive']=function(_0x40f472){if(_0x40f472['dialLimitQueue']>0x0){var _0x53a10c=_0x40f472['dialLimitQueue']-_0x40f472[_0x82d5('0x6e')]-_0x40f472[_0x82d5('0x55')];if(_0x53a10c>0x0){this[_0x82d5('0x200')](_0x40f472);}else{loggerPredictiveCalls[_0x82d5('0x7b')](_0x82d5('0x201'));}}else{this[_0x82d5('0x200')](_0x40f472);}};Dialer['prototype'][_0x82d5('0x200')]=function(_0xf04b7d){var _0x3b1636=this;var _0x3ee018=[];_0xf04b7d[_0x82d5('0x6e')]+=0x1;for(var _0x5c785a in this[_0x82d5('0x23')]){if(typeof this[_0x82d5('0x23')][_0x5c785a]!==_0x82d5('0x95')){if(this[_0x82d5('0x23')][_0x5c785a][_0x82d5('0xa1')]===_0x82d5('0x1fc')&&this[_0x82d5('0x23')][_0x5c785a][_0x82d5('0xd6')]===_0x82d5('0xd7')){_0x3ee018[_0x82d5('0x129')](this[_0x82d5('0x23')][_0x5c785a]['id']);}}}this[_0x82d5('0xbd')](_0xf04b7d['id'],_0x3ee018,0x1,_0xf04b7d[_0x82d5('0x1f4')],_0xf04b7d)[_0x82d5('0xb2')](function(_0xa48812){if(!checkContactEmpty(_0xa48812)){checkContactLowerLimitOriginate(_0xf04b7d,0x1,0x0);_0x3b1636['countReScheduled'](_0xf04b7d)[_0x82d5('0xb2')](sendMessageReschedule(_0xf04b7d))['catch'](loggerCatch(_0x82d5('0xb3')));}else{_0xf04b7d[_0x82d5('0x3e')]=_0x82d5('0x1f6');if(_[_0x82d5('0xa8')](_0xa48812[0x0])||_[_0x82d5('0xa8')](_0xa48812[0x0][_0x82d5('0x169')])||_[_0x82d5('0xa8')](_0xa48812[0x0][_0x82d5('0x169')][_0x82d5('0x16a')])){_0x3b1636[_0x82d5('0xc8')](_0x82d5('0x1f8'),_0xf04b7d,_0xa48812[0x0]);}else{_0x3b1636[_0x82d5('0xb4')](_['pick'](_0xa48812[0x0],[_0x82d5('0xfa'),_0x82d5('0x1fe')]))[_0x82d5('0xb2')](_0x3b1636[_0x82d5('0x1e0')](_0xf04b7d,_0xa48812[0x0]))[_0x82d5('0xaa')](_0x3b1636[_0x82d5('0xc7')]('[actionOriginatePredictive]\x20',_0xf04b7d));}}})[_0x82d5('0xaa')](loggerGetContactDialer(_0x82d5('0x202'),_0xf04b7d,0x1));emitVoiceQueueSummary(_0xf04b7d);};Dialer['prototype']['abandonmentRate']=function(_0xaa10e1,_0xe43752,_0x2c574d,_0x5be16f,_0x5759cc,_0x43f9a0){loggerPredictive['info'](_0x82d5('0x203'));loggerPredictive['info']('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',_0xaa10e1);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x204'),_0xe43752);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x205'),_0x2c574d);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5be16f);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x206'),_0x5759cc);loggerPredictive['info'](_0x82d5('0x82'));return new BPromise(function(_0x31e571,_0x18950f){if(_0xaa10e1<=0x0||isNaN(_0xaa10e1)){return _0x18950f(msgResponse(_0x82d5('0x207'),_0x82d5('0x49'),_0x82d5('0x208')+_0xaa10e1));}if(_0x2c574d<=0x0||isNaN(_0x2c574d)){return _0x18950f(msgResponse(_0x82d5('0x207'),_0x82d5('0x49'),_0x82d5('0x209')+_0x2c574d));}if(_0x5be16f<=0x0||isNaN(_0x5be16f)){return _0x18950f(msgResponse(_0x82d5('0x207'),_0x82d5('0x49'),'p\x20=\x20'+_0x5be16f));}if(_0xe43752<=0x0||isNaN(_0xe43752)){return _0x18950f(msgResponse('[abandonmentRate]',_0x82d5('0x49'),_0x82d5('0x20a')+_0xe43752));}if(_0x5759cc<=0x0||isNaN(_0x5759cc)){return _0x18950f(msgResponse(_0x82d5('0x207'),_0x82d5('0x49'),'Amax\x20=\x20'+_0x5759cc));}_0x43f9a0=_0x43f9a0||0x0;var _0x1068da=0x1/_0x2c574d;var _0x4010ea=0x0;var _0x40e224=0x0;var _0x568a34=0x0;var _0x2bf2b8=0x0;for(var _0x388492=0x0;_0x568a34<_0x5759cc;_0x388492+=0x1){_0x40e224=_0x388492/_0xe43752;_0x4010ea=(_0x5be16f*_0x40e224+_0x43f9a0)/_0x1068da;_0x568a34=erlangb(_0x4010ea,_0xaa10e1);_0x2bf2b8=_0x4010ea/_0xaa10e1*(0x1-erlangb(_0x4010ea,_0xaa10e1));}return _0x31e571({'erlangCalls':_0x388492,'erlangCallToSecond':_0xe43752/_0x388492,'erlangAbandonmentRate':_0x568a34,'erlangBusyFactor':_0x2bf2b8});});};Dialer[_0x82d5('0x1c')][_0x82d5('0x1d8')]=function(_0x3e9960,_0x720c21,_0x19578d,_0xd1d98f,_0x2fc00f,_0x1c2a2d){loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x20b'));loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x20c'),_0x3e9960);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x204'),_0x720c21);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x205'),_0x19578d);loggerPredictive[_0x82d5('0x7b')](_0x82d5('0x20d'),_0xd1d98f);loggerPredictive['info'](_0x82d5('0x20e'),_0x2fc00f);loggerPredictive['info'](_0x82d5('0x82'));return new BPromise(function(_0x18788c,_0x32ab78){if(_0x3e9960<=0x0||isNaN(_0x3e9960)){return _0x32ab78(msgResponse(_0x82d5('0x20f'),_0x82d5('0x49'),_0x82d5('0x208')+_0x3e9960));}if(_0x19578d<=0x0||isNaN(_0x19578d)){return _0x32ab78(msgResponse('[busyFactor]',_0x82d5('0x49'),'Ts\x20=\x20'+_0x19578d));}if(_0xd1d98f<=0x0||isNaN(_0xd1d98f)){return _0x32ab78(msgResponse(_0x82d5('0x20f'),'Error',_0x82d5('0x210')+_0xd1d98f));}if(_0x720c21<=0x0||isNaN(_0x720c21)){return _0x32ab78(msgResponse('[busyFactor]',_0x82d5('0x49'),_0x82d5('0x20a')+_0x720c21));}if(_0x2fc00f<=0x0||isNaN(_0x2fc00f)){return _0x32ab78(msgResponse('[busyFactor]','Error',_0x82d5('0x211')+_0x2fc00f));}_0x1c2a2d=_0x1c2a2d||0x0;var _0x4640f0=0x1/_0x19578d;var _0x441566=0x0;var _0x3d9513=0x0;var _0x12066c=0x0;var _0x549f3=0x0;for(var _0x37d390=0x0;_0x549f3<_0x2fc00f;_0x37d390+=0x1){_0x3d9513=_0x37d390/_0x720c21;_0x441566=(_0xd1d98f*_0x3d9513+_0x1c2a2d)/_0x4640f0;_0x12066c=erlangb(_0x441566,_0x3e9960);_0x549f3=_0x441566/_0x3e9960*(0x1-erlangb(_0x441566,_0x3e9960));}return _0x18788c({'erlangCalls':_0x37d390,'erlangCallToSecond':_0x720c21/_0x37d390,'erlangAbandonmentRate':_0x12066c,'erlangBusyFactor':_0x549f3});});};module[_0x82d5('0x212')]=Dialer; \ No newline at end of file +var _0xb4e6=['trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','newexten','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','Error','stringify','milliseconds','diff','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startProgressive','Trunk','active','callerid','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','prototype','clearZombieChannels','[uniqueid]','actions','[actions]','sequence','isNil','Action','status','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','saveInDb','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','HangupInAMD','membername','emit','custom:amd','buildObj','amd','[syncHangupInAMD]','dialAMDActive','outboundAnswerCallsDay','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ListId','AMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countdropretry','stateGlobal','reason19\x20machine....','reason\x2019\x20machine....','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','cause-txt','Unknow','reason','agiafterat','[syncAgentComplete][createHistory]','answertime','droptime','responsetime','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','dropreason','dialAbandonedMaxRetry','queueCallerAbandonCreateState','dialAbandonedRetryFrequency','minutes','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','paused','locked','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','syncQueueSummary','dialMethod','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialQueueTimeout','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','tags','createdAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','substring','trim','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','averageHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','m\x20=\x20','Ts\x20=\x20','[abandonmentRate]','interval\x20=\x20','Amax\x20=\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','enqueue','tail','finally','voiceQueues','campaigns','agents'];(function(_0x123e09,_0x26ea63){var _0x4e59ba=function(_0x3c6498){while(--_0x3c6498){_0x123e09['push'](_0x123e09['shift']());}};_0x4e59ba(++_0x26ea63);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x543242,_0xeac9fd){_0x543242=_0x543242-0x0;var _0x4c99b6=_0xb4e6[_0x543242];return _0x4c99b6;};'use strict';var util=require(_0x6b4e('0x0'));var _=require('lodash');var BPromise=require(_0x6b4e('0x1'));var uuid=require(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var rr=require('rr');var md5=require(_0x6b4e('0x4'));var Redis=require(_0x6b4e('0x5'));var ut=require(_0x6b4e('0x6'));var config=require(_0x6b4e('0x7'));var logger=require('../../../config/logger')(_0x6b4e('0x8'));var loggerBooked=require(_0x6b4e('0x9'))(_0x6b4e('0xa'));var loggerPredictive=require('../../../config/logger')(_0x6b4e('0xb'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x6b4e('0x9'))('syncQueueSummary');var ami=require('../ami');config[_0x6b4e('0xc')]=_[_0x6b4e('0xd')](config[_0x6b4e('0xc')],{'host':_0x6b4e('0xe'),'port':0x18eb});var io=require(_0x6b4e('0xf'))(new Redis(config[_0x6b4e('0xc')]));var cmHopper=require(_0x6b4e('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x6b4e('0x11'));var voiceQueueRt=require(_0x6b4e('0x12'));var Action=require('./action');var History=require(_0x6b4e('0x13'));var Final=require(_0x6b4e('0x14'));var AgentComplete=require(_0x6b4e('0x15'));var QueueCallerAbandon=require(_0x6b4e('0x16'));var Hangup=require(_0x6b4e('0x17'));var ipAgi=process[_0x6b4e('0x18')][_0x6b4e('0x19')]||'127.0.0.1';var strategy={'rrmemory':_0x6b4e('0x1a'),'roundrobin':_0x6b4e('0x1b')};var Sequence=function(){};Sequence['prototype'][_0x6b4e('0x1c')]=function(_0x4b62ad){this[_0x6b4e('0x1d')]=this[_0x6b4e('0x1d')]?this[_0x6b4e('0x1d')][_0x6b4e('0x1e')](_0x4b62ad):_0x4b62ad();};function Dialer(_0x28c3ba,_0x135568){this['sequence']=new Sequence();this['preview']=_0x135568;this[_0x6b4e('0x1f')]=_0x28c3ba[_0x6b4e('0x1f')];this[_0x6b4e('0x20')]=_0x28c3ba[_0x6b4e('0x20')];this[_0x6b4e('0x21')]=_0x28c3ba[_0x6b4e('0x21')];this[_0x6b4e('0x22')]=_0x28c3ba[_0x6b4e('0x22')];this[_0x6b4e('0x23')]=config[_0x6b4e('0x23')]||0x2;this[_0x6b4e('0x24')]={};this['actions']={};this[_0x6b4e('0x25')]={};this[_0x6b4e('0x26')]={};this[_0x6b4e('0x27')]={};this[_0x6b4e('0x28')]={};this['startProgressive']={};this[_0x6b4e('0x29')]={};this['queueBooked']={};this[_0x6b4e('0x2a')]={};ami['on'](_0x6b4e('0x2b'),this[_0x6b4e('0x2c')][_0x6b4e('0x2d')](this));ami['on'](_0x6b4e('0x2e'),this[_0x6b4e('0x2f')][_0x6b4e('0x2d')](this));ami['on']('originateresponse',this[_0x6b4e('0x30')]['bind'](this));ami['on'](_0x6b4e('0x31'),this[_0x6b4e('0x32')][_0x6b4e('0x2d')](this));ami['on'](_0x6b4e('0x33'),this['syncQueueSummary'][_0x6b4e('0x2d')](this));ami['on'](_0x6b4e('0x34'),this['syncHangup'][_0x6b4e('0x2d')](this));ami['on'](_0x6b4e('0x35'),this[_0x6b4e('0x36')][_0x6b4e('0x2d')](this));ami['on']('varset',this[_0x6b4e('0x37')][_0x6b4e('0x2d')](this));ami['on']('queuemember',this[_0x6b4e('0x38')][_0x6b4e('0x2d')](this));ami['on'](_0x6b4e('0x39'),this[_0x6b4e('0x3a')]['bind'](this));this[_0x6b4e('0x3b')]();this[_0x6b4e('0x3c')]();}function isNotNull(_0x47ab11){return _0x47ab11!==null&&!_[_0x6b4e('0x3d')](_0x47ab11);}function checkIsLoggedIn(_0x3f9868,_0x37b636){return function(){if(_0x37b636<=0x0){_0x3f9868['message']='AGENTS_NOT_LOGGED';throw _0x3f9868[_0x6b4e('0x3e')]+_0x6b4e('0x3f');}};}function isActive(_0x3ec877){return _0x3ec877;}function checkIsActive(_0x5261bf,_0x2a1a29){return function(){if(!isActive(_0x2a1a29)){_0x5261bf[_0x6b4e('0x40')]=_0x6b4e('0x41');throw _0x5261bf['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x2bff51){return function(){if(!isNotNull(_0x2bff51['Interval'])){_0x2bff51[_0x6b4e('0x40')]=_0x6b4e('0x42');throw _0x2bff51['name']+_0x6b4e('0x43');}if(!isNotNull(_0x2bff51[_0x6b4e('0x44')][_0x6b4e('0x45')])){_0x2bff51[_0x6b4e('0x40')]='INTERVAL_IS_NULL';throw _0x2bff51['name']+_0x6b4e('0x43');}if(!isNotNull(_[_0x6b4e('0x46')](_0x2bff51[_0x6b4e('0x44')][_0x6b4e('0x45')]))){_0x2bff51[_0x6b4e('0x40')]=_0x6b4e('0x42');throw _0x2bff51[_0x6b4e('0x3e')]+_0x6b4e('0x43');}};}function msgResponse(_0x144954,_0x3785d5,_0x2707d4){return{'action':_0x144954,'response':_0x3785d5,'message':_0x2707d4,'stack':_0x2707d4};}function myreject(_0x42eca4){return function(_0x39b955){return _0x42eca4(msgResponse('[ifTime][Action]',_0x6b4e('0x47'),JSON[_0x6b4e('0x48')](_0x39b955)));};}function getSeconds(_0x3f2c1d,_0x4c8639){var _0x287e74=moment(_0x3f2c1d)['milliseconds'](0x0);var _0x1271bc=moment(_0x4c8639)[_0x6b4e('0x49')](0x0);return _0x287e74[_0x6b4e('0x4a')](_0x1271bc,'seconds');}function emit(_0x550a12,_0x2b160f,_0x112ca3){io['to'](_0x550a12)['emit'](_0x2b160f,_0x112ca3);}function emitVoiceQueueSummary(_0x4d61dc){if(_0x4d61dc[_0x6b4e('0x4b')]===_0x6b4e('0x4c')){var _0x303507={'id':_0x4d61dc['id'],'name':_0x4d61dc[_0x6b4e('0x3e')],'strategy':_0x4d61dc[_0x6b4e('0x4d')],'answered':_0x4d61dc[_0x6b4e('0x4e')],'available':_0x4d61dc[_0x6b4e('0x4f')],'loggedIn':_0x4d61dc[_0x6b4e('0x50')],'pTalking':_0x4d61dc[_0x6b4e('0x51')],'sumBillable':_0x4d61dc[_0x6b4e('0x52')],'sumDuration':_0x4d61dc[_0x6b4e('0x53')],'sumHoldTime':_0x4d61dc['sumHoldTime']||0x0,'talking':_0x4d61dc[_0x6b4e('0x54')],'total':_0x4d61dc[_0x6b4e('0x55')],'type':_0x4d61dc['type'],'unmanaged':_0x4d61dc[_0x6b4e('0x56')],'abandoned':_0x4d61dc[_0x6b4e('0x57')],'waiting':_0x4d61dc[_0x6b4e('0x58')],'loggedInDb':_0x4d61dc[_0x6b4e('0x59')],'dialActive':_0x4d61dc[_0x6b4e('0x5a')],'dialMethod':_0x4d61dc['dialMethod'],'dialOriginateCallerIdName':_0x4d61dc['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4d61dc[_0x6b4e('0x5b')],'dialOriginateTimeout':_0x4d61dc['dialOriginateTimeout'],'dialPrefix':_0x4d61dc[_0x6b4e('0x5c')],'outboundAnswerAgiCallsDay':_0x4d61dc[_0x6b4e('0x5d')],'outboundAnswerCallsDay':_0x4d61dc['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4d61dc[_0x6b4e('0x5e')],'outboundBusyCallsDay':_0x4d61dc['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4d61dc[_0x6b4e('0x5f')],'outboundDropCallsDayACS':_0x4d61dc['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4d61dc[_0x6b4e('0x60')],'outboundDropCallsDayTimeout':_0x4d61dc[_0x6b4e('0x61')],'outboundNoAnswerCallsDay':_0x4d61dc[_0x6b4e('0x62')],'outboundNoSuchCallsDay':_0x4d61dc[_0x6b4e('0x63')],'outboundOriginateFailureCallsDay':_0x4d61dc['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4d61dc[_0x6b4e('0x64')],'outboundRejectCallsDay':_0x4d61dc[_0x6b4e('0x65')],'outboundUnknownCallsDay':_0x4d61dc[_0x6b4e('0x66')],'predictiveIntervalAnsweredCalls':_0x4d61dc['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4d61dc[_0x6b4e('0x67')],'predictiveIntervalAvgTalktime':_0x4d61dc[_0x6b4e('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x4d61dc[_0x6b4e('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x4d61dc[_0x6b4e('0x6a')],'predictiveIntervalErlangCalls':_0x4d61dc[_0x6b4e('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x4d61dc[_0x6b4e('0x6c')],'predictiveIntervalHitRate':_0x4d61dc[_0x6b4e('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x4d61dc[_0x6b4e('0x6e')],'predictiveIntervalPauses':_0x4d61dc[_0x6b4e('0x6f')],'predictiveIntervalAvailable':_0x4d61dc['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4d61dc[_0x6b4e('0x70')],'message':_0x4d61dc[_0x6b4e('0x40')],'originated':_0x4d61dc[_0x6b4e('0x71')],'erlangCalls':_0x4d61dc[_0x6b4e('0x72')],'erlangCallToSecond':_0x4d61dc[_0x6b4e('0x73')],'erlangAbandonmentRate':_0x4d61dc['erlangAbandonmentRate'],'erlangBusyFactor':_0x4d61dc[_0x6b4e('0x74')],'startPredictive':_0x4d61dc['startPredictive'],'startProgressive':_0x4d61dc[_0x6b4e('0x75')]};if(_0x4d61dc[_0x6b4e('0x76')]){_0x303507[_0x6b4e('0x76')]={'id':_0x4d61dc[_0x6b4e('0x76')]['id'],'name':_0x4d61dc['Trunk'][_0x6b4e('0x3e')],'active':_0x4d61dc[_0x6b4e('0x76')][_0x6b4e('0x77')],'callerid':_0x4d61dc['Trunk'][_0x6b4e('0x78')]};}if(_0x4d61dc[_0x6b4e('0x44')]){_0x303507[_0x6b4e('0x44')]={'id':_0x4d61dc[_0x6b4e('0x44')]['id'],'name':_0x4d61dc[_0x6b4e('0x44')][_0x6b4e('0x3e')]};}var _0x289dfa=md5(JSON[_0x6b4e('0x48')](_0x303507));if(_0x4d61dc[_0x6b4e('0x4')]!==_0x289dfa){_0x4d61dc[_0x6b4e('0x4')]=_0x289dfa;emit(util['format'](_0x6b4e('0x79'),_0x303507[_0x6b4e('0x3e')]),_0x6b4e('0x7a'),_0x303507);}}}function emitCampaignSummary(_0x4c0e29){if(_0x4c0e29[_0x6b4e('0x4b')]===_0x6b4e('0x7b')){emit(util[_0x6b4e('0x7c')](_0x6b4e('0x7d'),_0x4c0e29[_0x6b4e('0x3e')]),_0x6b4e('0x7e'),_0x4c0e29);}}function checkGetDataPredictive(_0x29ea90){if(isNotNull(_0x29ea90)&&!_[_0x6b4e('0x46')](_0x29ea90)){loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x80'));loggerPredictive[_0x6b4e('0x7f')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x29ea90['predictiveIntervalTotalCalls']);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x81'),_0x29ea90[_0x6b4e('0x82')]);loggerPredictive[_0x6b4e('0x7f')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x29ea90[_0x6b4e('0x6a')]);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x83'),_0x29ea90['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x84'),_0x29ea90[_0x6b4e('0x67')]);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x85'),_0x29ea90['predictiveIntervalAvgTalktime']);loggerPredictive[_0x6b4e('0x7f')]('---------------------------');if(_0x29ea90[_0x6b4e('0x70')]>0x0){if(!_[_0x6b4e('0x3d')](_0x29ea90['predictiveIntervalAvgTalktime'])&&_0x29ea90[_0x6b4e('0x68')]>0x0){return!![];}loggerPredictive['info'](_0x6b4e('0x86'));if(!_[_0x6b4e('0x3d')](_0x29ea90[_0x6b4e('0x67')])&&_0x29ea90[_0x6b4e('0x67')]>0x0){return!![];}loggerPredictive[_0x6b4e('0x7f')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x87'));}}else{loggerPredictive[_0x6b4e('0x7f')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5b45f1){return function(_0x2f5e4e){loggerPredictive[_0x6b4e('0x7f')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x88'),_0x2f5e4e[_0x6b4e('0x72')]);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x89'),_0x2f5e4e['erlangCallToSecond']);loggerPredictive['info'](_0x6b4e('0x8a'),_0x2f5e4e[_0x6b4e('0x8b')]);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x8c'),_0x2f5e4e[_0x6b4e('0x74')]);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x8a'),_0x2f5e4e[_0x6b4e('0x8b')]);loggerPredictive[_0x6b4e('0x7f')]('---------------------------');_[_0x6b4e('0x8d')](_0x5b45f1,_0x2f5e4e);};}function getDiff(_0x4427da){var _0xa4a5cc=moment()['milliseconds'](0x0);var _0x5ebf49=moment(_0x4427da)[_0x6b4e('0x49')](0x0);return _0xa4a5cc[_0x6b4e('0x4a')](_0x5ebf49,_0x6b4e('0x8e'));}function ifInterval(_0x158c28,_0x17f45b){if(_['isUndefined'](_0x17f45b)){return![];}return getDiff(_0x17f45b)<_0x158c28*0x3c;}function freeVariablesPredictive(_0x15d205){if(isNotNull(_0x15d205)){if(!_[_0x6b4e('0x3d')](_0x15d205[_0x6b4e('0x75')])){_0x15d205['startProgressive']=undefined;loggerPredictive[_0x6b4e('0x7f')](_0x15d205[_0x6b4e('0x3e')],_0x6b4e('0x8f'));}if(!_['isUndefined'](_0x15d205[_0x6b4e('0x28')])){_0x15d205[_0x6b4e('0x28')]=undefined;loggerPredictive['info'](_0x15d205[_0x6b4e('0x3e')],_0x6b4e('0x90'));}if(!_[_0x6b4e('0x3d')](_0x15d205[_0x6b4e('0x91')])){clearInterval(_0x15d205[_0x6b4e('0x91')]);_0x15d205[_0x6b4e('0x91')]=undefined;loggerPredictive[_0x6b4e('0x7f')](_0x15d205['name'],_0x6b4e('0x92'));}}}function erlangb(_0x184fc6,_0x1de27f){if(_0x1de27f===0x0){return 0x0;}var _0x13bddb=0x1;for(var _0x30a848=0x1;_0x30a848<=_0x1de27f;_0x30a848+=0x1){_0x13bddb=0x1+_0x13bddb*_0x30a848/_0x184fc6;}return 0x1/_0x13bddb;}function isVoiceQueueOutbound(_0x5ab4b8){return _0x5ab4b8===_0x6b4e('0x4c');}function isNotPreview(_0x20b212){return _0x20b212!==_0x6b4e('0x93');}function isCampaignIvr(_0x2960ad){return _0x2960ad===_0x6b4e('0x7b');}function getCallerId(_0x4ed029,_0xa1246f,_0x5d6996){if(!_[_0x6b4e('0x3d')](_0x5d6996)&&typeof _0x5d6996===_0x6b4e('0x94')&&!_[_0x6b4e('0x46')](_0x5d6996)){if(!_[_0x6b4e('0x3d')](_0xa1246f)&&typeof _0xa1246f==='string'&&!_[_0x6b4e('0x46')](_0xa1246f)){return util[_0x6b4e('0x7c')](_0x6b4e('0x95'),_0xa1246f,_0x5d6996);}return util[_0x6b4e('0x7c')](_0x6b4e('0x95'),_0x5d6996,_0x5d6996);}if(!_[_0x6b4e('0x3d')](_0x4ed029)&&typeof _0x4ed029===_0x6b4e('0x94')&&!_['isEmpty'](_0x4ed029)){return _0x4ed029;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4cdc08,_0x381e06){return function(_0xde1d1f){freeVariablesPredictive(_0x381e06);emitVoiceQueueSummary(_0x381e06);emitCampaignSummary(_0x381e06);loggerSyncQueueSummary[_0x6b4e('0x96')](_0x4cdc08,util[_0x6b4e('0x97')](_0xde1d1f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x15d6d1,_0x381045){return function(_0x5882b8){loggerPredictive['error'](_0x381045[_0x6b4e('0x3e')],_0x15d6d1);loggerPredictive[_0x6b4e('0x96')](_0x5882b8[_0x6b4e('0x98')]);freeVariablesPredictive(_0x381045);};}function loggerCatch(_0x266efd){return function(_0x4aa727){logger[_0x6b4e('0x96')](_0x266efd,util['inspect'](_0x4aa727,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x141b35){return _0x141b35&&!_[_0x6b4e('0x3d')](_0x141b35)&&_0x141b35[_0x6b4e('0x99')]>0x0;}function decremetOriginate(_0x3bf4c9){if(!_['isUndefined'](_0x3bf4c9)&&_0x3bf4c9!==null){if(typeof _0x3bf4c9[_0x6b4e('0x71')]!=='undefined'){if(_0x3bf4c9[_0x6b4e('0x71')]>0x0){_0x3bf4c9['originated']-=0x1;}else{logger[_0x6b4e('0x96')](_0x6b4e('0x9a'));}}}else{logger['error'](_0x6b4e('0x9b'));}}function checkContactLowerLimitOriginate(_0x58bb75,_0xbf5337,_0x25c1b0){if(_0xbf5337>_0x25c1b0){for(var _0xdc238e=0x0;_0xdc238e<_0xbf5337-_0x25c1b0;_0xdc238e+=0x1){decremetOriginate(_0x58bb75);}}}function loggerGetContactDialer(_0x29a432,_0x53c912,_0x509840){return function(_0x5313be){checkContactLowerLimitOriginate(_0x53c912,_0x509840,0x0);logger[_0x6b4e('0x96')](_0x29a432,util[_0x6b4e('0x97')](_0x5313be,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x591b4b){return function(_0x28c5d7){if(isNotNull(_0x28c5d7)&&isNotNull(_0x28c5d7[0x0])){if(_0x28c5d7[0x0][_0x6b4e('0x9c')]>0x0){_0x591b4b[_0x6b4e('0x40')]=_0x6b4e('0x9d');logger[_0x6b4e('0x7f')](_0x6b4e('0x9e')+_0x591b4b[_0x6b4e('0x3e')],_0x28c5d7[0x0][_0x6b4e('0x9c')],_0x6b4e('0x9f'));}else{_0x591b4b[_0x6b4e('0x40')]=_0x6b4e('0xa0');logger['info'](_0x6b4e('0xa1')+_0x591b4b[_0x6b4e('0x3e')]);}}};}function notSendMessagesQueue(_0x29f58e){if(_0x29f58e[_0x6b4e('0xa2')]){freeVariablesPredictive(_0x29f58e);if(_0x29f58e[_0x6b4e('0x71')]===0x0&&_0x29f58e[_0x6b4e('0x54')]===0x0&&_0x29f58e[_0x6b4e('0x58')]===0x0&&(_0x29f58e[_0x6b4e('0x51')]||0x0)===0x0){_0x29f58e[_0x6b4e('0xa2')]=![];_0x29f58e['available']=0x0;_0x29f58e['message']='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0x6b4e('0xa3'),_0x29f58e[_0x6b4e('0x3e')],_0x6b4e('0xa4'));}else{_0x29f58e[_0x6b4e('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x6b4e('0x96')](_0x6b4e('0xa3'),_0x29f58e['name'],_0x6b4e('0xa5'));}emitVoiceQueueSummary(_0x29f58e);}}function notSendMessagesCampaign(_0x2be5b4){if(_0x2be5b4[_0x6b4e('0xa2')]){if(_0x2be5b4[_0x6b4e('0x71')]===0x0){_0x2be5b4['sendMessageOneNotActive']=![];_0x2be5b4[_0x6b4e('0x40')]=_0x6b4e('0x41');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2be5b4[_0x6b4e('0x3e')],'is\x20not\x20active');}else{_0x2be5b4[_0x6b4e('0x40')]=_0x6b4e('0xa6');loggerSyncQueueSummary['error'](_0x6b4e('0xa7'),_0x2be5b4[_0x6b4e('0x3e')],_0x6b4e('0xa5'));}emitCampaignSummary(_0x2be5b4);}}function createObjHistory(_0xae3060,_0x15d893,_0x57fa98,_0x5117a2,_0x190706){_0xae3060[_0x6b4e('0x40')]=_0x57fa98;var _0xeb573c=new Action(_0xae3060,_0x15d893);var _0x3b6f52=new History(_0xeb573c);_0x3b6f52[_0x6b4e('0xa8')]=_0x5117a2;_0x3b6f52[_0x6b4e('0xa9')]=_0x190706;_0x3b6f52[_0x6b4e('0xaa')]=_0xeb573c[_0x6b4e('0xab')];return _0x3b6f52;}Dialer[_0x6b4e('0xac')]['loopClearZombieChannels']=function(){var _0x397148=this;setInterval(function(){_0x397148[_0x6b4e('0xad')](_0x397148[_0x6b4e('0x26')],_0x6b4e('0xae'));_0x397148[_0x6b4e('0xad')](_0x397148[_0x6b4e('0xaf')],_0x6b4e('0xb0'));},0x32c8);};Dialer[_0x6b4e('0xac')][_0x6b4e('0xad')]=function(_0x1e2607,_0x45829d){var _0x33f44a=this;for(var _0x5a3b9e in _0x1e2607){if(typeof _0x1e2607[_0x5a3b9e]!=='undefined'){this[_0x6b4e('0xb1')][_0x6b4e('0x1c')](function(){if(!_[_0x6b4e('0xb2')](_0x1e2607[_0x5a3b9e])){return ami[_0x6b4e('0xb3')]({'action':_0x6b4e('0xb4'),'channel':_0x1e2607[_0x5a3b9e]['channel']})[_0x6b4e('0xb5')](function(_0x3802ce){if(_0x3802ce[_0x6b4e('0x40')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1e2607[_0x5a3b9e]&&_0x1e2607[_0x5a3b9e][_0x6b4e('0x4b')]!==_0x6b4e('0x7b')){_0x33f44a[_0x6b4e('0xb6')](_0x33f44a[_0x6b4e('0x1f')][_0x1e2607[_0x5a3b9e][_0x6b4e('0xb7')]]);logger[_0x6b4e('0x96')](_0x6b4e('0xb8'),_0x45829d,_0x5a3b9e,_0x1e2607[_0x5a3b9e]['queue']);delete _0x1e2607[_0x5a3b9e];}if(_0x1e2607[_0x5a3b9e]&&_0x1e2607[_0x5a3b9e][_0x6b4e('0x4b')]===_0x6b4e('0x7b')){_0x33f44a[_0x6b4e('0xb6')](_0x33f44a['campaigns'][_0x1e2607[_0x5a3b9e]['queue']]);logger['error'](_0x6b4e('0xb9'),_0x45829d,_0x5a3b9e,_0x1e2607[_0x5a3b9e]['queue']);delete _0x1e2607[_0x5a3b9e];}},0x2328);}});}});}}};Dialer[_0x6b4e('0xac')][_0x6b4e('0xba')]=function(_0x282a42){return BPromise[_0x6b4e('0xbb')]()[_0x6b4e('0xbc')](cmHopper[_0x6b4e('0xba')](_0x282a42))[_0x6b4e('0xb5')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x6b4e('0xac')]['checkIsBlackList']=function(_0x5eacc4){return BPromise[_0x6b4e('0xbb')]()[_0x6b4e('0xbc')](cmHopperBlack[_0x6b4e('0xbd')](_0x5eacc4))['catch'](loggerCatch(_0x6b4e('0xbe')));};Dialer['prototype'][_0x6b4e('0xbf')]=function(_0x985eb8){return BPromise[_0x6b4e('0xbb')]()[_0x6b4e('0xbc')](cmHopperBlack[_0x6b4e('0xbf')](_0x985eb8))[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0xc0')));};Dialer[_0x6b4e('0xac')]['averageHandleTime']=function(_0x1e622d){return BPromise['resolve']()[_0x6b4e('0xbc')](cmHopperHistory['avgHandleTime'](_0x1e622d))[_0x6b4e('0xb5')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x6b4e('0xac')][_0x6b4e('0xc1')]=function(_0x3e6420){return BPromise[_0x6b4e('0xbb')]()[_0x6b4e('0xbc')](cmHopper[_0x6b4e('0xc1')](_0x3e6420))[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0xc2')));};Dialer[_0x6b4e('0xac')][_0x6b4e('0xc3')]=function(_0x178f37,_0x3bca59,_0x3da685){return BPromise[_0x6b4e('0xbb')]()[_0x6b4e('0xbc')](cmHopper[_0x6b4e('0xc3')](_0x178f37,_0x3bca59,_0x3da685))['catch'](loggerCatch(_0x6b4e('0xc4')));};Dialer['prototype'][_0x6b4e('0xc5')]=function(_0x58f55a,_0x8e850b,_0x1cf856,_0x7500cb,_0x342dd3){return BPromise['resolve']()[_0x6b4e('0xbc')](cmHopper[_0x6b4e('0xc5')](_0x58f55a,_0x8e850b,_0x1cf856,_0x7500cb))[_0x6b4e('0xb5')](function(_0x3a17f5){_0x342dd3['temp']-=_0x1cf856;_0x342dd3[_0x6b4e('0xc6')]=_0x342dd3['temp']>0x0?_0x342dd3[_0x6b4e('0xc6')]:0x0;loggerCatch(_0x6b4e('0xc7'))(_0x3a17f5);});};Dialer[_0x6b4e('0xac')][_0x6b4e('0xc8')]=function(_0x3a882f,_0x397ffc,_0x45b7b7,_0x3a8709){return BPromise[_0x6b4e('0xbb')]()[_0x6b4e('0xbc')](cmHopper[_0x6b4e('0xc8')](_0x3a882f,_0x397ffc,_0x45b7b7))[_0x6b4e('0xb5')](function(_0x385f0d){_0x3a8709[_0x6b4e('0xc6')]-=_0x397ffc;_0x3a8709[_0x6b4e('0xc6')]=_0x3a8709[_0x6b4e('0xc6')]>0x0?_0x3a8709['temp']:0x0;loggerCatch(_0x6b4e('0xc9'))(_0x385f0d);});};Dialer[_0x6b4e('0xac')][_0x6b4e('0xca')]=function(_0x2f8611){return BPromise['resolve']()[_0x6b4e('0xbc')](voiceQueueRt[_0x6b4e('0xca')](_0x2f8611))[_0x6b4e('0xb5')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x6b4e('0xac')][_0x6b4e('0xcb')]=function(_0x3c7b22){return BPromise[_0x6b4e('0xbb')]()['then'](cmHopper['moveContactManagedDialer'](_0x3c7b22))[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0xcc')));};Dialer['prototype'][_0x6b4e('0xcd')]=function(_0x2e6d9d){return BPromise[_0x6b4e('0xbb')]()[_0x6b4e('0xbc')](cmHopperHistory[_0x6b4e('0xcd')](_0x2e6d9d))[_0x6b4e('0xb5')](loggerCatch('[createHistory]\x20'));};Dialer[_0x6b4e('0xac')][_0x6b4e('0xb6')]=function(_0x1122e1){if(!_[_0x6b4e('0x3d')](_0x1122e1)&&_0x1122e1!==null){if(typeof _0x1122e1[_0x6b4e('0x71')]!==_0x6b4e('0xce')){if(_0x1122e1[_0x6b4e('0x71')]>0x0){_0x1122e1[_0x6b4e('0x71')]-=0x1;}else{logger[_0x6b4e('0x96')](_0x6b4e('0xcf'));}}}else{logger[_0x6b4e('0x96')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x6b4e('0xac')]['loggerHandler']=function(_0x570085,_0x3c0a3e){var _0x115f91=this;return function(_0x4c8f6c){_0x115f91['updateOriginated'](_0x3c0a3e);logger[_0x6b4e('0x96')](_0x570085,util[_0x6b4e('0x97')](_0x4c8f6c,{'showHidden':![],'depth':null}));};};Dialer[_0x6b4e('0xac')][_0x6b4e('0xd0')]=function(_0x3fec39,_0x497d51,_0x1df74a){var _0x23d62d={'state':0x19,'statedesc':_0x6b4e('0xd1')};this[_0x6b4e('0xb6')](_0x497d51);this[_0x6b4e('0xd2')](_[_0x6b4e('0x8d')](_0x23d62d,_[_0x6b4e('0xd3')](_0x1df74a,[_0x6b4e('0xd4'),'ListId',_0x6b4e('0xd5'),_0x6b4e('0xd6'),_0x6b4e('0xd7')])),_0x6b4e('0xd8'),_0x6b4e('0xd9'));logger[_0x6b4e('0x96')](_0x3fec39);};Dialer[_0x6b4e('0xac')][_0x6b4e('0xda')]=function(_0x300daf){return _0x300daf===_0x6b4e('0xdb');};Dialer['prototype'][_0x6b4e('0xdc')]=function(_0x138e64){return!_[_0x6b4e('0x3d')](_0x138e64)&&_0x138e64&&!_[_0x6b4e('0x3d')](_0x138e64['name'])&&!_[_0x6b4e('0x3d')](_0x138e64['active'])&&_0x138e64[_0x6b4e('0x77')]&&(this[_0x6b4e('0x22')][util[_0x6b4e('0x7c')](_0x6b4e('0xdd'),_0x138e64[_0x6b4e('0x3e')])][_0x6b4e('0xb4')]===_0x6b4e('0xde')||this[_0x6b4e('0x22')][util[_0x6b4e('0x7c')]('SIP/%s',_0x138e64[_0x6b4e('0x3e')])]['status']==='unmonitored');};Dialer[_0x6b4e('0xac')][_0x6b4e('0xd2')]=function(_0x47b930,_0x451f99,_0x1f2c79){this[_0x6b4e('0xcd')](_0x47b930)['catch'](loggerCatch(_0x451f99));this[_0x6b4e('0xcb')](_0x47b930)[_0x6b4e('0xb5')](loggerCatch(_0x1f2c79));};Dialer[_0x6b4e('0xac')][_0x6b4e('0x37')]=function(_0x1fca5c){var _0x2a9ee1=this[_0x6b4e('0x26')][_0x1fca5c[_0x6b4e('0xdf')]];var _0x3a64e0;if(!_[_0x6b4e('0xb2')](_0x1fca5c)&&!_['isNil'](_0x1fca5c[_0x6b4e('0xe0')])&&!_[_0x6b4e('0xb2')](_0x1fca5c[_0x6b4e('0xe0')][_0x6b4e('0xe1')])&&_0x1fca5c[_0x6b4e('0xe2')]===_0x6b4e('0xe3')&&_0x2a9ee1){if(_0x2a9ee1[_0x6b4e('0x4b')]!==_0x6b4e('0x7b')&&this['voiceQueues'][_0x2a9ee1[_0x6b4e('0xb7')]]['dialAMDActive']&&_0x1fca5c[_0x6b4e('0xe4')]===_0x6b4e('0xe5')){delete this[_0x6b4e('0x26')][_0x1fca5c['uniqueid']];this[_0x6b4e('0xb6')](this[_0x6b4e('0x1f')][_0x2a9ee1[_0x6b4e('0xb7')]]);this[_0x6b4e('0x1f')][_0x2a9ee1['queue']]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x2a9ee1[_0x6b4e('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;_0x3a64e0=new Hangup(_0x2a9ee1,_0x1fca5c);_0x3a64e0[_0x6b4e('0xa8')]=0x12;_0x3a64e0[_0x6b4e('0xa9')]=_0x6b4e('0xe6');_0x3a64e0[_0x6b4e('0xe7')]='AMD';ami[_0x6b4e('0xe8')](_0x6b4e('0xe9'),ut[_0x6b4e('0xea')](_0x3a64e0,_0x6b4e('0xeb')));this[_0x6b4e('0xd2')](_0x3a64e0,'[syncHangupInAMD][createHistory]',_0x6b4e('0xec'));}if(_0x2a9ee1['type']!==_0x6b4e('0x7b')&&this[_0x6b4e('0x1f')][_0x2a9ee1['queue']][_0x6b4e('0xed')]&&_0x1fca5c[_0x6b4e('0xe4')]==='MACHINE'){var _0x499e6b=this;return new BPromise(function(_0x56fbd4,_0x397420){delete _0x499e6b['uniqueId'][_0x1fca5c[_0x6b4e('0xdf')]];_0x499e6b[_0x6b4e('0xb6')](_0x499e6b[_0x6b4e('0x1f')][_0x2a9ee1['queue']]);_0x499e6b[_0x6b4e('0x1f')][_0x2a9ee1['queue']][_0x6b4e('0xee')]+=0x1;_0x499e6b[_0x6b4e('0x1f')][_0x2a9ee1[_0x6b4e('0xb7')]][_0x6b4e('0x5d')]+=0x1;var _0x5e6407=_0x499e6b[_0x6b4e('0x1f')][_0x2a9ee1[_0x6b4e('0xb7')]];var _0x709906=new Hangup(_0x2a9ee1,_0x1fca5c);_0x709906[_0x6b4e('0xa8')]=0x13;_0x709906[_0x6b4e('0xa9')]=_0x6b4e('0xef');_0x709906[_0x6b4e('0xe7')]='AMD';_0x709906['countmachineretry']+=0x1;_0x709906[_0x6b4e('0xf0')]+=0x1;_0x709906['amd']=!![];ami[_0x6b4e('0xe8')](_0x6b4e('0xe9'),ut['buildObj'](_0x709906,_0x6b4e('0xeb')));_0x499e6b[_0x6b4e('0xcd')](_0x709906)[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0xf1')));if(_0x709906[_0x6b4e('0xf2')]+_0x709906[_0x6b4e('0xf3')]+_0x709906[_0x6b4e('0xf4')]+_0x709906[_0x6b4e('0xf5')]+_0x709906['countdropretry']+_0x709906[_0x6b4e('0xf6')]+_0x709906[_0x6b4e('0xf7')]+_0x709906[_0x6b4e('0xf8')]>=_0x5e6407[_0x6b4e('0xf9')]){_0x499e6b['stateGlobal'](_0x709906,_0x56fbd4,_0x397420,'reason19\x20machine....');}else{if(_0x709906[_0x6b4e('0xf7')]>=_0x5e6407[_0x6b4e('0xfa')]){_0x499e6b[_0x6b4e('0xfb')](_0x709906,_0x56fbd4,_0x397420,'reason\x2019\x20machine....');}else{_0x499e6b[_0x6b4e('0xc1')]({'active':![],'countmachineretry':_0x709906[_0x6b4e('0xf7')],'scheduledat':moment()[_0x6b4e('0xfc')](_0x5e6407[_0x6b4e('0xfd')],'minutes')[_0x6b4e('0x7c')](_0x6b4e('0xfe')),'ContactId':_0x709906[_0x6b4e('0xd4')],'ListId':_0x709906[_0x6b4e('0xff')],'VoiceQueueId':_0x709906[_0x6b4e('0xd6')]||undefined,'CampaignId':_0x709906[_0x6b4e('0xd7')]||undefined})[_0x6b4e('0xb5')](loggerCatch('[rescheduleContact][Machine]'));_0x56fbd4({'reschedule':0x1});}}});}if(_0x2a9ee1['type']===_0x6b4e('0x7b')&&this[_0x6b4e('0x20')][_0x2a9ee1['queue']]['dialAMDActive']&&_0x1fca5c[_0x6b4e('0xe4')]==='HANGUP'){delete this[_0x6b4e('0x26')][_0x1fca5c[_0x6b4e('0xdf')]];this[_0x6b4e('0xb6')](this[_0x6b4e('0x20')][_0x2a9ee1[_0x6b4e('0xb7')]]);_0x3a64e0=new Hangup(_0x2a9ee1,_0x1fca5c);_0x3a64e0[_0x6b4e('0xa8')]=0x12;_0x3a64e0[_0x6b4e('0xa9')]=_0x6b4e('0xe6');_0x3a64e0['membername']=_0x6b4e('0x100');ami[_0x6b4e('0xe8')](_0x6b4e('0xe9'),ut[_0x6b4e('0xea')](_0x3a64e0,_0x6b4e('0xeb')));this[_0x6b4e('0xd2')](_0x3a64e0,_0x6b4e('0x101'),_0x6b4e('0x102'));}if(_0x2a9ee1[_0x6b4e('0x4b')]==='ivr'&&this['campaigns'][_0x2a9ee1[_0x6b4e('0xb7')]]['dialAMDActive']&&_0x1fca5c[_0x6b4e('0xe4')]===_0x6b4e('0x103')){var _0x499e6b=this;return new BPromise(function(_0x36480c,_0x8f5d54){delete _0x499e6b[_0x6b4e('0x26')][_0x1fca5c[_0x6b4e('0xdf')]];_0x499e6b[_0x6b4e('0xb6')](_0x499e6b[_0x6b4e('0x20')][_0x2a9ee1['queue']]);_0x499e6b['campaigns'][_0x2a9ee1[_0x6b4e('0xb7')]][_0x6b4e('0xee')]+=0x1;_0x499e6b[_0x6b4e('0x20')][_0x2a9ee1[_0x6b4e('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3f24a3=_0x499e6b[_0x6b4e('0x20')][_0x2a9ee1[_0x6b4e('0xb7')]];var _0x1e1389=new Hangup(_0x2a9ee1,_0x1fca5c);_0x1e1389[_0x6b4e('0xa8')]=0x13;_0x1e1389[_0x6b4e('0xa9')]=_0x6b4e('0xef');_0x1e1389[_0x6b4e('0xe7')]='AMD';_0x1e1389[_0x6b4e('0xf7')]+=0x1;_0x1e1389['countglobal']+=0x1;_0x1e1389[_0x6b4e('0xeb')]=!![];ami[_0x6b4e('0xe8')]('custom:amd',ut['buildObj'](_0x1e1389,'amd'));_0x499e6b[_0x6b4e('0xcd')](_0x1e1389)[_0x6b4e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1e1389[_0x6b4e('0xf2')]+_0x1e1389['countcongestionretry']+_0x1e1389[_0x6b4e('0xf4')]+_0x1e1389[_0x6b4e('0xf5')]+_0x1e1389[_0x6b4e('0x104')]+_0x1e1389[_0x6b4e('0xf6')]+_0x1e1389[_0x6b4e('0xf7')]+_0x1e1389[_0x6b4e('0xf8')]>=_0x3f24a3['dialGlobalMaxRetry']){_0x499e6b[_0x6b4e('0x105')](_0x1e1389,_0x36480c,_0x8f5d54,_0x6b4e('0x106'));}else{if(_0x1e1389['countmachineretry']>=_0x3f24a3['dialMachineMaxRetry']){_0x499e6b[_0x6b4e('0xfb')](_0x1e1389,_0x36480c,_0x8f5d54,_0x6b4e('0x107'));}else{_0x499e6b[_0x6b4e('0xc1')]({'active':![],'countmachineretry':_0x1e1389['countmachineretry'],'scheduledat':moment()['add'](_0x3f24a3[_0x6b4e('0xfd')],'minutes')[_0x6b4e('0x7c')](_0x6b4e('0xfe')),'ContactId':_0x1e1389[_0x6b4e('0xd4')],'ListId':_0x1e1389['ListId'],'VoiceQueueId':_0x1e1389[_0x6b4e('0xd6')]||undefined,'CampaignId':_0x1e1389[_0x6b4e('0xd7')]||undefined})[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x108')));_0x36480c({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x6b4e('0x109')]=function(_0x1cf160){var _0x46d7ed=this[_0x6b4e('0x26')][_0x1cf160[_0x6b4e('0xdf')]];var _0x15f341=this;var _0x1e061b;if(_0x46d7ed&&_0x46d7ed['type']===_0x6b4e('0x7b')){delete this[_0x6b4e('0x26')][_0x1cf160[_0x6b4e('0xdf')]];this['updateOriginated'](this[_0x6b4e('0x20')][_0x46d7ed[_0x6b4e('0xb7')]]);this[_0x6b4e('0x20')][_0x46d7ed['queue']][_0x6b4e('0x10a')]+=0x1;_0x1e061b=new Hangup(_0x46d7ed,_0x1cf160);this[_0x6b4e('0xcd')](_0x1e061b)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x6b4e('0xcb')](_0x1e061b)[_0x6b4e('0xb5')](loggerCatch('[syncHangupIvr]'));}if(_0x46d7ed&&_0x46d7ed[_0x6b4e('0x4b')]!=='ivr'&&isNotNull(this[_0x6b4e('0x1f')][_0x46d7ed['queue']][_0x6b4e('0x10b')])){delete this[_0x6b4e('0x26')][_0x1cf160['uniqueid']];this[_0x6b4e('0xb6')](this[_0x6b4e('0x1f')][_0x46d7ed['queue']]);this[_0x6b4e('0x1f')][_0x46d7ed[_0x6b4e('0xb7')]]['outboundAnswerCallsDay']+=0x1;this[_0x6b4e('0x1f')][_0x46d7ed[_0x6b4e('0xb7')]][_0x6b4e('0x5d')]+=0x1;_0x1e061b=new Hangup(_0x46d7ed,_0x1cf160);_0x1e061b[_0x6b4e('0xa8')]=0x10;_0x1e061b[_0x6b4e('0xa9')]=_0x6b4e('0x10c');_0x1e061b['membername']='AGI';this[_0x6b4e('0xcd')](_0x1e061b)[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x10d')));this[_0x6b4e('0xcb')](_0x1e061b)[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x10e')));}if(_0x46d7ed&&_0x46d7ed[_0x6b4e('0x4b')]!=='ivr'&&!isNotNull(this[_0x6b4e('0x1f')][_0x46d7ed[_0x6b4e('0xb7')]]['dialQueueProject'])){delete this[_0x6b4e('0x26')][_0x1cf160['uniqueid']];this[_0x6b4e('0xb6')](this[_0x6b4e('0x1f')][_0x46d7ed[_0x6b4e('0xb7')]]);this[_0x6b4e('0x1f')][_0x46d7ed['queue']][_0x6b4e('0x66')]+=0x1;_0x1e061b=new Hangup(_0x46d7ed,_0x1cf160);_0x1e061b['state']=0xc;_0x1e061b[_0x6b4e('0xa9')]=_0x1cf160[_0x6b4e('0x10f')];_0x1e061b[_0x6b4e('0xe7')]=_0x6b4e('0x110');this[_0x6b4e('0xcd')](_0x1e061b)[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x10d')));this[_0x6b4e('0xcb')](_0x1e061b)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x6b4e('0xac')][_0x6b4e('0x32')]=function(_0x48cea3){var _0xa2b1cb=this[_0x6b4e('0x26')][_0x48cea3[_0x6b4e('0xdf')]];var _0x3de02f=this;if(this['voiceQueues'][_0x48cea3[_0x6b4e('0xb7')]]){if(_0xa2b1cb&&_0xa2b1cb[_0x6b4e('0x4b')]!=='ivr'){delete this[_0x6b4e('0x26')][_0x48cea3[_0x6b4e('0xdf')]];this[_0x6b4e('0x1f')][_0x48cea3[_0x6b4e('0xb7')]][_0x6b4e('0xee')]+=0x1;var _0x129025=new AgentComplete(_0xa2b1cb,_0x48cea3);if(_0x48cea3[_0x6b4e('0x111')]==='agent'){_0x129025[_0x6b4e('0x112')]=this[_0x6b4e('0x1f')][_0x48cea3[_0x6b4e('0xb7')]]['dialQueueProject2']&&this[_0x6b4e('0x1f')][_0x48cea3[_0x6b4e('0xb7')]]['dialAgiAfterHangupAgent']?moment()[_0x6b4e('0x7c')](_0x6b4e('0xfe')):undefined;}this[_0x6b4e('0xcd')](_0x129025)['catch'](loggerCatch(_0x6b4e('0x113')));this[_0x6b4e('0xcb')](_0x129025)[_0x6b4e('0xb5')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x6b4e('0xac')][_0x6b4e('0x2c')]=function(_0x418bf6){if(this[_0x6b4e('0x1f')][_0x418bf6['queue']]){if(this[_0x6b4e('0x26')][_0x418bf6['uniqueid']]&&this[_0x6b4e('0x26')][_0x418bf6[_0x6b4e('0xdf')]][_0x6b4e('0x4b')]!==_0x6b4e('0x7b')){this[_0x6b4e('0xb6')](this[_0x6b4e('0x1f')][_0x418bf6[_0x6b4e('0xb7')]]);this[_0x6b4e('0x26')][_0x418bf6['uniqueid']][_0x6b4e('0x114')]=moment()[_0x6b4e('0x7c')](_0x6b4e('0xfe'));}}};Dialer[_0x6b4e('0xac')]['queueCallerAbandonCreateState']=function(_0x4c0fe4){this[_0x6b4e('0xcd')](_0x4c0fe4)['catch'](loggerCatch(_0x6b4e('0x113')));this['moveContactManagedDialer'](_0x4c0fe4)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x6b4e('0xac')][_0x6b4e('0x2f')]=function(_0x28889a){var _0x5e126a=this[_0x6b4e('0x26')][_0x28889a[_0x6b4e('0xdf')]];var _0x40ce84=this;if(this[_0x6b4e('0x1f')][_0x28889a[_0x6b4e('0xb7')]]){if(_0x5e126a&&_0x5e126a[_0x6b4e('0x4b')]!==_0x6b4e('0x7b')){delete this[_0x6b4e('0x26')][_0x28889a[_0x6b4e('0xdf')]];this['updateOriginated'](this[_0x6b4e('0x1f')][_0x28889a['queue']]);_0x5e126a[_0x6b4e('0x115')]=moment()[_0x6b4e('0x7c')](_0x6b4e('0xfe'));var _0x24d955=new QueueCallerAbandon(_0x5e126a,_0x28889a);if(getSeconds(_0x5e126a[_0x6b4e('0x115')],_0x5e126a[_0x6b4e('0x116')])>=_0x5e126a['dialQueueTimeout']){this[_0x6b4e('0x1f')][_0x28889a[_0x6b4e('0xb7')]][_0x6b4e('0x6a')]+=0x1;this[_0x6b4e('0x1f')][_0x28889a[_0x6b4e('0xb7')]][_0x6b4e('0x61')]+=0x1;this['voiceQueues'][_0x28889a[_0x6b4e('0xb7')]][_0x6b4e('0x6c')]+=0x1;_0x24d955[_0x6b4e('0xa8')]=0xa;_0x24d955[_0x6b4e('0xa9')]='Drop';_0x24d955['dropreason']='TIMEOUT';_0x24d955[_0x6b4e('0x112')]=this[_0x6b4e('0x1f')][_0x28889a[_0x6b4e('0xb7')]][_0x6b4e('0x117')]?moment()[_0x6b4e('0x7c')](_0x6b4e('0xfe')):undefined;_0x24d955['countdropretry']+=0x1;_0x24d955[_0x6b4e('0xf0')]+=0x1;if(_0x24d955[_0x6b4e('0x104')]>=this['voiceQueues'][_0x28889a['queue']][_0x6b4e('0x118')]){this['queueCallerAbandonCreateState'](_0x24d955);}else{this[_0x6b4e('0xc1')]({'active':![],'countdropretry':_0x24d955['countdropretry'],'scheduledat':moment()[_0x6b4e('0xfc')](this['voiceQueues'][_0x28889a['queue']][_0x6b4e('0x119')],'minutes')[_0x6b4e('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5e126a[_0x6b4e('0xd4')],'ListId':_0x5e126a[_0x6b4e('0xff')],'VoiceQueueId':_0x5e126a[_0x6b4e('0xd6')]||undefined,'CampaignId':_0x5e126a[_0x6b4e('0xd7')]||undefined})['catch'](loggerCatch(_0x6b4e('0x11a')));var _0x43b972=new History(_0x24d955);_0x43b972[_0x6b4e('0xa8')]=0xa;_0x43b972['statedesc']='Drop';_0x43b972[_0x6b4e('0xab')]=moment()['format'](_0x6b4e('0xfe'));_0x43b972[_0x6b4e('0xaa')]=_0x43b972['starttime'];_0x43b972['calleridname']=_0x24d955[_0x6b4e('0x11b')];_0x43b972[_0x6b4e('0x11c')]=_0x24d955[_0x6b4e('0x11c')];this['createHistory'](_0x43b972)['catch'](loggerCatch(_0x6b4e('0x11d')));}}else{this[_0x6b4e('0x1f')][_0x28889a['queue']][_0x6b4e('0x69')]+=0x1;this['voiceQueues'][_0x28889a[_0x6b4e('0xb7')]]['outboundDropCallsDayCallersExit']+=0x1;_0x24d955[_0x6b4e('0xa8')]=0xb;_0x24d955[_0x6b4e('0xa9')]='Abandoned';_0x24d955[_0x6b4e('0x11e')]='CALLEREXIT';_0x24d955[_0x6b4e('0xf6')]+=0x1;_0x24d955[_0x6b4e('0xf0')]+=0x1;if(_0x24d955[_0x6b4e('0xf6')]>=this['voiceQueues'][_0x28889a['queue']][_0x6b4e('0x11f')]){this[_0x6b4e('0x120')](_0x24d955);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x24d955[_0x6b4e('0xf6')],'scheduledat':moment()[_0x6b4e('0xfc')](this['voiceQueues'][_0x28889a[_0x6b4e('0xb7')]][_0x6b4e('0x121')],_0x6b4e('0x122'))[_0x6b4e('0x7c')](_0x6b4e('0xfe')),'ContactId':_0x5e126a[_0x6b4e('0xd4')],'ListId':_0x5e126a[_0x6b4e('0xff')],'VoiceQueueId':_0x5e126a[_0x6b4e('0xd6')]||undefined,'CampaignId':_0x5e126a['CampaignId']||undefined})['catch'](loggerCatch(_0x6b4e('0x123')));var _0x43b972=new History(_0x24d955);_0x43b972['state']=0xb;_0x43b972['statedesc']=_0x6b4e('0x124');_0x43b972[_0x6b4e('0xab')]=moment()[_0x6b4e('0x7c')](_0x6b4e('0xfe'));_0x43b972[_0x6b4e('0xaa')]=_0x43b972[_0x6b4e('0xab')];_0x43b972[_0x6b4e('0x11b')]=_0x24d955[_0x6b4e('0x11b')];_0x43b972[_0x6b4e('0x11c')]=_0x24d955[_0x6b4e('0x11c')];this[_0x6b4e('0xcd')](_0x43b972)['catch'](loggerCatch(_0x6b4e('0x125')));}}}}};Dialer['prototype'][_0x6b4e('0x36')]=function(_0x29d243){if(this[_0x6b4e('0xaf')][_0x29d243[_0x6b4e('0xdf')]]){this['actions'][_0x29d243[_0x6b4e('0xdf')]][_0x6b4e('0x126')]=_0x29d243[_0x6b4e('0x126')];}if(this[_0x6b4e('0x26')][_0x29d243[_0x6b4e('0xdf')]]){this[_0x6b4e('0x26')][_0x29d243[_0x6b4e('0xdf')]][_0x6b4e('0x126')]=_0x29d243[_0x6b4e('0x126')];}};Dialer['prototype'][_0x6b4e('0x38')]=function(_0x51fa9f){if(strategy[this[_0x6b4e('0x1f')][this['actions'][_0x51fa9f[_0x6b4e('0x127')]][_0x6b4e('0xb7')]][_0x6b4e('0x4d')]]==='roundrobin'){if(this[_0x6b4e('0xaf')][_0x51fa9f[_0x6b4e('0x127')]]&&_[_0x6b4e('0xb2')](this[_0x6b4e('0xaf')][_0x51fa9f[_0x6b4e('0x127')]]['locked'])&&_0x51fa9f[_0x6b4e('0xb4')]==='1'&&_0x51fa9f[_0x6b4e('0x128')]==='0'){if(this['agents'][_0x51fa9f['stateinterface']]){if(!this[_0x6b4e('0x21')][_0x51fa9f['stateinterface']][_0x6b4e('0x129')]){this[_0x6b4e('0x21')][_0x51fa9f['stateinterface']][_0x6b4e('0x129')]=!![];this[_0x6b4e('0xaf')][_0x51fa9f['actionid']][_0x6b4e('0x129')]=!![];this[_0x6b4e('0xaf')][_0x51fa9f[_0x6b4e('0x127')]][_0x6b4e('0x12a')]=_0x51fa9f[_0x6b4e('0x12a')];}}}}else if((strategy[this[_0x6b4e('0x1f')][this[_0x6b4e('0xaf')][_0x51fa9f[_0x6b4e('0x127')]][_0x6b4e('0xb7')]]['strategy']]||'rrmemory')===_0x6b4e('0x1a')){if(this[_0x6b4e('0xaf')][_0x51fa9f[_0x6b4e('0x127')]]){if(this['agents'][_0x51fa9f[_0x6b4e('0x12a')]]){this[_0x6b4e('0xaf')][_0x51fa9f[_0x6b4e('0x127')]][_0x6b4e('0x12a')]=_0x51fa9f[_0x6b4e('0x12a')];if(_[_0x6b4e('0xb2')](this[_0x6b4e('0x12b')][this['actions'][_0x51fa9f[_0x6b4e('0x127')]][_0x6b4e('0xb7')]])){this[_0x6b4e('0x12b')][this[_0x6b4e('0xaf')][_0x51fa9f[_0x6b4e('0x127')]][_0x6b4e('0xb7')]]=[];}this[_0x6b4e('0x12b')][this[_0x6b4e('0xaf')][_0x51fa9f[_0x6b4e('0x127')]][_0x6b4e('0xb7')]][_0x6b4e('0x12c')](_[_0x6b4e('0x8d')](_[_0x6b4e('0xd3')](this[_0x6b4e('0xaf')][_0x51fa9f[_0x6b4e('0x127')]],[_0x6b4e('0x12d'),_0x6b4e('0x12a')]),{'status':_0x51fa9f['status'],'paused':_0x51fa9f['paused']}));}}}};function unlockQueueStatus(_0xeba240,_0x84cd32){setTimeout(function(){if(_[_0x6b4e('0x3d')](_0xeba240[_0x6b4e('0x12e')])){loggerBooked[_0x6b4e('0x96')](_0x6b4e('0x12f'),_0x84cd32);}_0xeba240[_0x6b4e('0x12e')]=!![];loggerBooked[_0x6b4e('0x7f')](_0x6b4e('0x130'),_0x84cd32,JSON[_0x6b4e('0x48')](_[_0x6b4e('0xd3')](_0xeba240,[_0x6b4e('0x3e'),_0x6b4e('0x12e')])));},0x1f3);}Dialer[_0x6b4e('0xac')][_0x6b4e('0x3a')]=function(_0x431b6d){var _0x43be8a=this;var _0x328bca=_0x43be8a[_0x6b4e('0x1f')][_0x43be8a['actions'][_0x431b6d['actionid']][_0x6b4e('0xb7')]];if(strategy[this[_0x6b4e('0x1f')][this[_0x6b4e('0xaf')][_0x431b6d['actionid']][_0x6b4e('0xb7')]][_0x6b4e('0x4d')]]===_0x6b4e('0x1b')){if(this[_0x6b4e('0xaf')][_0x431b6d['actionid']]&&this[_0x6b4e('0xaf')][_0x431b6d['actionid']][_0x6b4e('0x12a')]){this[_0x6b4e('0x93')][_0x6b4e('0x131')](this[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]][_0x6b4e('0x12d')],this['actions'][_0x431b6d[_0x6b4e('0x127')]]['stateinterface'])['catch'](function(_0x3f6c72){logger['error'](_0x6b4e('0x132'),util['inspect'](_0x3f6c72,{'showHidden':![],'depth':null}));})[_0x6b4e('0x1e')](function(){_0x43be8a[_0x6b4e('0xb6')](_0x43be8a[_0x6b4e('0x1f')][_0x43be8a[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]][_0x6b4e('0xb7')]]);_0x43be8a[_0x6b4e('0x21')][_0x43be8a[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]][_0x6b4e('0x12a')]][_0x6b4e('0x129')]=![];delete _0x43be8a[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]];unlockQueueStatus(_0x328bca);});}else{this['updateOriginated'](this[_0x6b4e('0x1f')][this[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]]['queue']]);this[_0x6b4e('0xc1')]({'active':![],'ContactId':this[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]]['ContactId'],'ListId':this[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]][_0x6b4e('0xff')],'VoiceQueueId':this['actions'][_0x431b6d[_0x6b4e('0x127')]][_0x6b4e('0xd6')]||undefined,'CampaignId':this[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]][_0x6b4e('0xd7')]||undefined})[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x133')));delete this[_0x6b4e('0xaf')][_0x431b6d['actionid']];unlockQueueStatus(_0x328bca);}}else if((strategy[this['voiceQueues'][this[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]][_0x6b4e('0xb7')]]['strategy']]||'rrmemory')===_0x6b4e('0x1a')){var _0x50512e;if(this[_0x6b4e('0xaf')][_0x431b6d['actionid']]&&!_[_0x6b4e('0x46')](this['queueBooked'][this[_0x6b4e('0xaf')][_0x431b6d['actionid']][_0x6b4e('0xb7')]])){if(this[_0x6b4e('0x2a')][_0x43be8a[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]][_0x6b4e('0xb7')]]){this[_0x6b4e('0x2a')][_0x43be8a[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]][_0x6b4e('0xb7')]]=this['queueBookedRR'][this['actions'][_0x431b6d[_0x6b4e('0x127')]][_0x6b4e('0xb7')]]?this[_0x6b4e('0x2a')][this[_0x6b4e('0xaf')][_0x431b6d['actionid']][_0x6b4e('0xb7')]]:this[_0x6b4e('0x12b')][this[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]][_0x6b4e('0xb7')]]?this[_0x6b4e('0x12b')][this['actions'][_0x431b6d['actionid']][_0x6b4e('0xb7')]]['_rr']||0x0:0x0;}this[_0x6b4e('0x12b')][this[_0x6b4e('0xaf')][_0x431b6d[_0x6b4e('0x127')]]['queue']][_0x6b4e('0x134')]=this[_0x6b4e('0x2a')][this['actions'][_0x431b6d['actionid']][_0x6b4e('0xb7')]];for(var _0x8eb9a6=0x0;_0x8eb9a6=0x0;})[_0x6b4e('0xb5')](myreject(_0x596f15)));}}else{_0x5e9aaf[_0x6b4e('0x12c')](ami[_0x6b4e('0xb3')]({'action':_0x6b4e('0x14a'),'command':util[_0x6b4e('0x7c')]('iftime\x20%s,%s',_0x5d25cc,!_['isUndefined'](config['timezones'][_0x144067])?_0x144067:'')})[_0x6b4e('0xbc')](function(_0x5c99f6){return _0x5c99f6[_0x6b4e('0x14d')][_0x6b4e('0x14e')](_0x6b4e('0x14f'))>=0x0;})[_0x6b4e('0xb5')](myreject(_0x596f15)));}BPromise[_0x6b4e('0x150')](_0x5e9aaf)['then'](function(_0x38eab0){var _0x2b5516=_['some'](_0x38eab0);if(_0x2b5516){return _0x50e40d(_0x2b5516);}else{_0x16912a[_0x6b4e('0x40')]=_0x7efc19?_0x6b4e('0x151'):_0x6b4e('0x152');return _0x596f15(msgResponse(_0x6b4e('0x153'),_0x6b4e('0x143'),'Global:\x20'+_0x7efc19+'\x20'+_0x3e1872+_0x6b4e('0x154')+util[_0x6b4e('0x97')](_0x5d25cc,{'showHidden':![],'depth':null})+_0x6b4e('0x155')+_0x144067));}})['catch'](function(_0x1d8331){return _0x596f15(msgResponse(_0x6b4e('0x142'),_0x6b4e('0x143'),JSON[_0x6b4e('0x48')](_0x1d8331)));});});};Dialer['prototype'][_0x6b4e('0x156')]=function(_0x593e84){var _0x520c08=this;return function(){switch(_0x593e84['dialMethod']){case _0x6b4e('0x157'):freeVariablesPredictive(_0x593e84);_0x520c08[_0x6b4e('0x158')](_0x593e84,0x1);break;case _0x6b4e('0x159'):freeVariablesPredictive(_0x593e84);_0x520c08[_0x6b4e('0x158')](_0x593e84,_0x593e84[_0x6b4e('0x15a')]);break;case _0x6b4e('0xb'):_0x520c08['predictive'](_0x593e84);break;case _0x6b4e('0xa'):freeVariablesPredictive(_0x593e84);_0x520c08[_0x6b4e('0x158')](_0x593e84,0x1);break;default:freeVariablesPredictive(_0x593e84);logger[_0x6b4e('0x96')](_0x6b4e('0x15b'),_0x593e84[_0x6b4e('0x3e')],'method\x20not\x20recognized');}};};Dialer[_0x6b4e('0xac')]['launchHandleIvr']=function(_0x56651b){var _0x41143=this;return function(){_0x41143['handleIvr'](_0x56651b);};};Dialer[_0x6b4e('0xac')][_0x6b4e('0x15c')]=function(_0x503043){var _0x3db153=this;if(isNotPreview(_0x503043[_0x6b4e('0x15d')])){if(isVoiceQueueOutbound(_0x503043['type'])&&isActive(_0x503043[_0x6b4e('0x5a')])){_0x503043['sendMessageOneNotActive']=!![];BPromise[_0x6b4e('0xbb')]()[_0x6b4e('0xbc')](checkIsLoggedIn(_0x503043,_0x503043['loggedIn']))[_0x6b4e('0xbc')](checkIsActive(_0x503043,_0x503043['dialActive']))['then'](checkInterval(_0x503043))[_0x6b4e('0xbc')](_0x3db153[_0x6b4e('0x13f')](_0x503043))[_0x6b4e('0xbc')](_0x3db153['checkIfTime'](_0x503043[_0x6b4e('0x15e')],_0x503043[_0x6b4e('0x15f')],_0x503043[_0x6b4e('0x3e')],_0x503043))['then'](_0x3db153[_0x6b4e('0x160')](_0x503043[_0x6b4e('0x44')],_0x503043[_0x6b4e('0x15f')],_0x503043[_0x6b4e('0x3e')],_0x503043))[_0x6b4e('0xbc')](_0x3db153['checkDialMethod'](_0x503043))['catch'](loggerCatchQueueSummary(_0x6b4e('0x161'),_0x503043));}else{notSendMessagesQueue(_0x503043);}}else{freeVariablesPredictive(_0x503043);}};Dialer[_0x6b4e('0xac')][_0x6b4e('0x13e')]=function(){var _0x1804c9=this;var _0x4da36b;for(var _0x15a2d5 in this[_0x6b4e('0x20')]){if(typeof this[_0x6b4e('0x20')][_0x15a2d5]!==_0x6b4e('0xce')){_0x4da36b=this[_0x6b4e('0x20')][_0x15a2d5];if(isCampaignIvr(_0x4da36b['type'])&&isActive(_0x4da36b[_0x6b4e('0x77')])){_0x4da36b[_0x6b4e('0xa2')]=!![];BPromise[_0x6b4e('0xbb')]()['then'](checkIsActive(_0x4da36b,_0x4da36b['active']))[_0x6b4e('0xbc')](checkInterval(_0x4da36b))['then'](_0x1804c9[_0x6b4e('0x13f')](_0x4da36b))[_0x6b4e('0xbc')](_0x1804c9[_0x6b4e('0x141')](_0x4da36b['dialGlobalInterval'],_0x4da36b['dialTimezone'],_0x4da36b[_0x6b4e('0x3e')],_0x4da36b))[_0x6b4e('0xbc')](_0x1804c9[_0x6b4e('0x160')](_0x4da36b[_0x6b4e('0x44')],_0x4da36b[_0x6b4e('0x15f')],_0x4da36b[_0x6b4e('0x3e')],_0x4da36b))[_0x6b4e('0xbc')](_0x1804c9['launchHandleIvr'](_0x4da36b))[_0x6b4e('0xb5')](loggerCatchQueueSummary(_0x6b4e('0x162'),_0x4da36b));}else{notSendMessagesCampaign(_0x4da36b);}}}};function getCallerIdRandom(_0x2e3235,_0x5caf2f){var _0x483531;var _0x52cb09;var _0x2168cc;if(_0x5caf2f<=0x0){_0x5caf2f=0x1;}_0x483531=new RegExp(_0x6b4e('0x163')+_0x5caf2f+'}$');_0x52cb09=Math[_0x6b4e('0x164')](0xa,_0x5caf2f-0x1);_0x2168cc=Math[_0x6b4e('0x164')](0xa,_0x5caf2f)-0x1;return util[_0x6b4e('0x7c')]('%s',_[_0x6b4e('0x165')](_0x2e3235,_0x483531,_[_0x6b4e('0x166')](_0x52cb09,_0x2168cc)));}function extractCalleridName(_0x4da9c1){var _0x2af6d0=_0x4da9c1['match'](/"(.*?)"/);return _0x2af6d0?_0x2af6d0[0x1]:_0x4da9c1;}function extractCalleridNumber(_0x312b07){var _0x427080=_0x312b07['match'](/<(.*?)>/);return _0x427080?_0x427080[0x1]:_0x312b07;}Dialer[_0x6b4e('0xac')][_0x6b4e('0x167')]=function(_0x38b1ce,_0x3fe7f1){var _0xac8e9d=this;var _0x41217e=uuid['v4']();this[_0x6b4e('0xaf')][_0x41217e]=new Action(_0x38b1ce,_0x3fe7f1,_0x41217e);return new BPromise(function(_0xb71221,_0x4c478c){if(_[_0x6b4e('0x3d')](_0x38b1ce)&&typeof _0x38b1ce!==_0x6b4e('0x168')){return _0x4c478c(msgResponse(_0x6b4e('0x169'),'Failure',_0x6b4e('0x16a')));}if(_[_0x6b4e('0x3d')](_0x3fe7f1[_0x6b4e('0x16b')][_0x6b4e('0x16c')])||_0x3fe7f1[_0x6b4e('0x16b')][_0x6b4e('0x16c')]===null){return _0x4c478c(msgResponse('originate',_0x6b4e('0x143'),_0x6b4e('0x16d')));}var _0x286758={'XMD-CALLERID':_0xac8e9d[_0x6b4e('0xaf')][_0x41217e][_0x6b4e('0x16e')](),'XMD-AGI':_0x38b1ce[_0x6b4e('0x10b')]?util[_0x6b4e('0x7c')]('\x22agi://%s/square,%s\x22',ipAgi,_0x38b1ce[_0x6b4e('0x10b')]):_0x6b4e('0x16f'),'XMD-AGIAFTER':_0x38b1ce[_0x6b4e('0x117')]?util['format'](_0x6b4e('0x170'),ipAgi,_0x38b1ce[_0x6b4e('0x117')]):_0x6b4e('0x16f'),'XMD-QUEUE':_0x38b1ce[_0x6b4e('0x4b')]===_0x6b4e('0x4c')?util[_0x6b4e('0x7c')]('\x22%s,%s%s,,,%s\x22',_0x38b1ce['name'],_0x38b1ce[_0x6b4e('0x171')]||'',_0x38b1ce[_0x6b4e('0x172')]?'c':'',_0x38b1ce[_0x6b4e('0x173')]||0x3):_0x6b4e('0x16f'),'XMD-CONTACTID':_0x3fe7f1[_0x6b4e('0xd4')],'XMD-CDRTYPE':_0x6b4e('0x8'),'CALLERID(all)':_0xac8e9d[_0x6b4e('0xaf')][_0x41217e][_0x6b4e('0x16e')](),'XMD-AMD':_0x38b1ce[_0x6b4e('0xed')]?_0x6b4e('0x174'):'NONE','XMD-DESTINATION':_0x6b4e('0xe3')};if(_0x38b1ce[_0x6b4e('0xed')]){_0x286758['XMD-AMDINITIALSILENCE']=_0x38b1ce[_0x6b4e('0x175')]||0x9c4;_0x286758[_0x6b4e('0x176')]=_0x38b1ce[_0x6b4e('0x177')]||0x5dc;_0x286758[_0x6b4e('0x178')]=_0x38b1ce[_0x6b4e('0x179')]||0x320;_0x286758[_0x6b4e('0x17a')]=_0x38b1ce['dialAMDTotalAnalysisTime']||0x1388;_0x286758[_0x6b4e('0x17b')]=_0x38b1ce['dialAMDMinWordLength']||0x64;_0x286758['XMD-AMDBETWEENWORDSSILENCE']=_0x38b1ce[_0x6b4e('0x17c')]||0x32;_0x286758[_0x6b4e('0x17d')]=_0x38b1ce[_0x6b4e('0x17e')]||0x3;_0x286758[_0x6b4e('0x17f')]=_0x38b1ce['dialAMDSilenceThreshold']||0x100;_0x286758['XMD-AMDMAXIMUMWORDLENGTH']=_0x38b1ce['dialAMDMaximumWordLength']||0x1388;}if(_0x38b1ce['type']===_0x6b4e('0x4c')){_0x286758['XMD-VOICEQUEUEID']=_0x3fe7f1[_0x6b4e('0xd6')];}else{_0x286758['XMD-CAMPAIGNID']=_0x3fe7f1['CampaignId'];}for(var _0x59470b in _0x3fe7f1[_0x6b4e('0x16b')]){if(typeof _0x3fe7f1[_0x6b4e('0x16b')][_0x59470b]!==_0x6b4e('0xce')){if(isNotNull(_0x3fe7f1[_0x6b4e('0x16b')][_0x59470b])&&_0x59470b!=='id'&&_0x59470b!==_0x6b4e('0x180')&&_0x59470b!==_0x6b4e('0x181')&&_0x59470b!=='updatedAt'){_0x286758[util[_0x6b4e('0x7c')](_0x6b4e('0x182'),_0x6b4e('0x183'),_[_0x6b4e('0x184')](_0x59470b))]=_0x3fe7f1[_0x6b4e('0x16b')][_0x59470b];}}}var _0xc0f2b1=_0xac8e9d['isTrunkReachable'](_0x38b1ce[_0x6b4e('0x76')])?getCallerId(_0x38b1ce[_0x6b4e('0x76')][_0x6b4e('0x78')],_0x38b1ce[_0x6b4e('0x185')],_0x38b1ce[_0x6b4e('0x186')]>0x0?getCallerIdRandom(_0x38b1ce['dialOriginateCallerIdNumber'],_0x38b1ce['dialRandomLastDigitCallerIdNumber']):_0x38b1ce[_0x6b4e('0x5b')]):getCallerId(_['isNil'](_0x38b1ce['TrunkBackup'])?_0x38b1ce[_0x6b4e('0x76')]['callerid']:_0x38b1ce[_0x6b4e('0x187')][_0x6b4e('0x78')],_0x38b1ce[_0x6b4e('0x185')],_0x38b1ce[_0x6b4e('0x186')]>0x0?getCallerIdRandom(_0x38b1ce[_0x6b4e('0x5b')],_0x38b1ce[_0x6b4e('0x186')]):_0x38b1ce[_0x6b4e('0x5b')]);if(_0xc0f2b1){_0x286758[_0x6b4e('0x188')]=_0xac8e9d[_0x6b4e('0xaf')][_0x41217e]['originatecalleridname']=extractCalleridName(_0xc0f2b1);_0x286758['XMD-ORIGINATECALLERIDNUM']=_0xac8e9d['actions'][_0x41217e][_0x6b4e('0x189')]=extractCalleridNumber(_0xc0f2b1);}return ami['Action']({'actionid':_0x41217e,'action':'originate','channel':_0xac8e9d[_0x6b4e('0xdc')](_0x38b1ce['Trunk'])?util[_0x6b4e('0x7c')](_0x6b4e('0x18a'),_0x38b1ce[_0x6b4e('0x76')]['name'],isNotNull(_0x38b1ce[_0x6b4e('0x5c')])?_0x38b1ce[_0x6b4e('0x5c')]['trim']()||'':'',_0x38b1ce[_0x6b4e('0x18b')]>0x0?_0x3fe7f1[_0x6b4e('0x16b')][_0x6b4e('0x16c')][_0x6b4e('0x18c')](_0x38b1ce[_0x6b4e('0x18b')]):_0x3fe7f1[_0x6b4e('0x16b')][_0x6b4e('0x16c')]):util[_0x6b4e('0x7c')](_0x6b4e('0x18a'),_['isNil'](_0x38b1ce['TrunkBackup'])?_0x38b1ce[_0x6b4e('0x76')][_0x6b4e('0x3e')]:_0x38b1ce['TrunkBackup'][_0x6b4e('0x3e')],isNotNull(_0x38b1ce[_0x6b4e('0x5c')])?_0x38b1ce['dialPrefix'][_0x6b4e('0x18d')]()||'':'',_0x38b1ce[_0x6b4e('0x18b')]>0x0?_0x3fe7f1[_0x6b4e('0x16b')]['phone'][_0x6b4e('0x18c')](_0x38b1ce[_0x6b4e('0x18b')]):_0x3fe7f1[_0x6b4e('0x16b')]['phone']),'callerid':_0xc0f2b1,'Exten':_0x6b4e('0xe3'),'Context':_0x6b4e('0x18e'),'Priority':'1','variable':_0x286758,'timeout':(_0x38b1ce['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x41217e})[_0x6b4e('0xbc')](function(_0x35c25){return _0xb71221(_0x35c25);})['catch'](function(_0x3ea7bb){_0x38b1ce[_0x6b4e('0x18f')]+=0x1;var _0x4ac122=new History(_0xac8e9d[_0x6b4e('0xaf')][_0x41217e]);logger['error'](util[_0x6b4e('0x7c')](_0x6b4e('0x190'),JSON['stringify'](_0x3ea7bb)));_0x4ac122['state']=0xe;_0x4ac122['statedesc']='OriginateError';_0x4ac122[_0x6b4e('0xab')]=moment()[_0x6b4e('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ac122[_0x6b4e('0xaa')]=_0x4ac122[_0x6b4e('0xab')];_0xac8e9d[_0x6b4e('0xcd')](_0x4ac122)['catch'](loggerCatch(_0x6b4e('0x191')));_0xac8e9d['moveContactManagedDialer'](_0x4ac122)[_0x6b4e('0xb5')](loggerCatch('[originate][error]'))['finally'](function(){delete _0xac8e9d[_0x6b4e('0xaf')][_0x41217e];return _0x4c478c(msgResponse(_0x6b4e('0x169'),_0x6b4e('0x47'),_0x6b4e('0x192')));});});});};Dialer[_0x6b4e('0xac')]['syncOriginateResponse']=function(_0x1ff12e){var _0x543472=this['actions'][_0x1ff12e[_0x6b4e('0x127')]];if(_0x543472){delete this[_0x6b4e('0xaf')][_0x1ff12e[_0x6b4e('0x127')]];_0x543472['responsetime']=moment()[_0x6b4e('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x306222=_0x543472[_0x6b4e('0x4b')]===_0x6b4e('0x7b')?this['campaigns'][_0x543472['queue']]:this['voiceQueues'][_0x543472['getQueue']()];if(!this[_0x6b4e('0xda')](_0x1ff12e[_0x6b4e('0x193')])){this[_0x6b4e('0xb6')](_0x306222);return this[_0x6b4e('0x194')](_0x543472,_0x306222,_0x1ff12e)[_0x6b4e('0xb5')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x6b4e('0x26')][_0x1ff12e[_0x6b4e('0xdf')]]=_0x543472;}};Dialer['prototype'][_0x6b4e('0x195')]=function(_0xb4e115,_0x3bb09b,_0x4dc5ba){var _0x4f7df0=new History(_0x3bb09b);if(_0x4f7df0[_0x6b4e('0xf2')]+_0x4f7df0[_0x6b4e('0xf3')]+_0x4f7df0[_0x6b4e('0xf4')]+_0x4f7df0[_0x6b4e('0xf5')]+_0x4f7df0[_0x6b4e('0x104')]+_0x4f7df0[_0x6b4e('0xf6')]+_0x4f7df0[_0x6b4e('0xf7')]+_0x4f7df0[_0x6b4e('0xf8')]>=_0x4dc5ba[_0x6b4e('0xf9')]-0x1){return!![];}switch(_0xb4e115){case 0x3:if(_0x4f7df0['countnoanswerretry']>=_0x4dc5ba[_0x6b4e('0x196')]-0x1){return!![];}this[_0x6b4e('0xc1')]({'active':![],'countnoanswerretry':_0x4f7df0[_0x6b4e('0xf4')]+=0x1,'scheduledat':moment()[_0x6b4e('0xfc')](_0x4dc5ba[_0x6b4e('0x197')],'minutes')[_0x6b4e('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f7df0['ContactId'],'ListId':_0x4f7df0[_0x6b4e('0xff')],'VoiceQueueId':_0x4f7df0[_0x6b4e('0xd6')]||undefined,'CampaignId':_0x4f7df0['CampaignId']||undefined})[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x198')));break;case 0x5:if(_0x4f7df0[_0x6b4e('0xf2')]>=_0x4dc5ba[_0x6b4e('0x199')]-0x1){return!![];}this[_0x6b4e('0xc1')]({'active':![],'countbusyretry':_0x4f7df0['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x4dc5ba[_0x6b4e('0x19a')],'minutes')[_0x6b4e('0x7c')](_0x6b4e('0xfe')),'ContactId':_0x4f7df0[_0x6b4e('0xd4')],'ListId':_0x4f7df0['ListId'],'VoiceQueueId':_0x4f7df0[_0x6b4e('0xd6')]||undefined,'CampaignId':_0x4f7df0[_0x6b4e('0xd7')]||undefined})[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x19b')));break;case 0x8:if(_0x4f7df0[_0x6b4e('0xf3')]>=_0x4dc5ba[_0x6b4e('0x19c')]-0x1){return!![];}this[_0x6b4e('0xc1')]({'active':![],'countcongestionretry':_0x4f7df0[_0x6b4e('0xf3')]+=0x1,'scheduledat':moment()[_0x6b4e('0xfc')](_0x4dc5ba[_0x6b4e('0x19d')],_0x6b4e('0x122'))[_0x6b4e('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f7df0[_0x6b4e('0xd4')],'ListId':_0x4f7df0['ListId'],'VoiceQueueId':_0x4f7df0['VoiceQueueId']||undefined,'CampaignId':_0x4f7df0[_0x6b4e('0xd7')]||undefined})[_0x6b4e('0xb5')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x4f7df0[_0x6b4e('0xf5')]>=_0x4dc5ba[_0x6b4e('0x19e')]-0x1){return!![];}else{this[_0x6b4e('0xc1')]({'active':![],'countnosuchnumberretry':_0x4f7df0[_0x6b4e('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x4dc5ba[_0x6b4e('0x19f')],_0x6b4e('0x122'))[_0x6b4e('0x7c')](_0x6b4e('0xfe')),'ContactId':_0x4f7df0['ContactId'],'ListId':_0x4f7df0[_0x6b4e('0xff')],'VoiceQueueId':_0x4f7df0['VoiceQueueId']||undefined,'CampaignId':_0x4f7df0['CampaignId']||undefined})[_0x6b4e('0xb5')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x4f7df0[_0x6b4e('0x104')]>=_0x4dc5ba[_0x6b4e('0x118')]-0x1){return!![];}this[_0x6b4e('0xc1')]({'active':![],'countdropretry':_0x4f7df0[_0x6b4e('0x104')]+=0x1,'scheduledat':moment()[_0x6b4e('0xfc')](_0x4dc5ba[_0x6b4e('0x119')],_0x6b4e('0x122'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f7df0['ContactId'],'ListId':_0x4f7df0[_0x6b4e('0xff')],'VoiceQueueId':_0x4f7df0[_0x6b4e('0xd6')]||undefined,'CampaignId':_0x4f7df0[_0x6b4e('0xd7')]||undefined})[_0x6b4e('0xb5')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x4f7df0[_0x6b4e('0xf6')]>=_0x4dc5ba['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x6b4e('0xc1')]({'active':![],'countabandonedretry':_0x4f7df0[_0x6b4e('0xf6')]+=0x1,'scheduledat':moment()[_0x6b4e('0xfc')](_0x4dc5ba[_0x6b4e('0x121')],_0x6b4e('0x122'))['format'](_0x6b4e('0xfe')),'ContactId':_0x4f7df0['ContactId'],'ListId':_0x4f7df0[_0x6b4e('0xff')],'VoiceQueueId':_0x4f7df0[_0x6b4e('0xd6')]||undefined,'CampaignId':_0x4f7df0['CampaignId']||undefined})[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x123')));break;case 0x13:if(_0x4f7df0[_0x6b4e('0xf7')]>=_0x4dc5ba[_0x6b4e('0xfa')]-0x1){return!![];}this[_0x6b4e('0xc1')]({'active':![],'countmachineretry':_0x4f7df0['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x4dc5ba[_0x6b4e('0xfd')],_0x6b4e('0x122'))[_0x6b4e('0x7c')](_0x6b4e('0xfe')),'ContactId':_0x4f7df0[_0x6b4e('0xd4')],'ListId':_0x4f7df0[_0x6b4e('0xff')],'VoiceQueueId':_0x4f7df0['VoiceQueueId']||undefined,'CampaignId':_0x4f7df0[_0x6b4e('0xd7')]||undefined})[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x108')));break;case 0x14:if(_0x4f7df0[_0x6b4e('0xf8')]>=_0x4dc5ba[_0x6b4e('0x1a0')]-0x1){return!![];}this[_0x6b4e('0xc1')]({'active':![],'countagentrejectretry':_0x4f7df0[_0x6b4e('0xf8')]+=0x1,'scheduledat':moment()[_0x6b4e('0xfc')](_0x4dc5ba[_0x6b4e('0x1a1')],'minutes')[_0x6b4e('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f7df0[_0x6b4e('0xd4')],'ListId':_0x4f7df0[_0x6b4e('0xff')],'VoiceQueueId':_0x4f7df0[_0x6b4e('0xd6')]||undefined,'CampaignId':_0x4f7df0['CampaignId']||undefined})[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x1a2')));break;default:return!![];}};Dialer[_0x6b4e('0xac')][_0x6b4e('0x194')]=function(_0x3ca5c0,_0x5c22f7,_0x5b9aaa){var _0x2fec99=this;var _0x1092e3=new History(_0x3ca5c0);return new BPromise(function(_0x467884,_0x4a3bc8){if(_['isUndefined'](_0x5c22f7)&&typeof _0x5c22f7!==_0x6b4e('0x168')){return _0x4a3bc8(msgResponse(_0x6b4e('0x1a3'),_0x6b4e('0x143'),_0x6b4e('0x1a4')));}if(_['isUndefined'](_0x5b9aaa)&&typeof _0x5b9aaa!==_0x6b4e('0x168')){return _0x4a3bc8(msgResponse(_0x6b4e('0x1a3'),_0x6b4e('0x143'),_0x6b4e('0x1a5')));}switch(_0x5b9aaa[_0x6b4e('0x111')]){case'0':_0x5c22f7['outboundNoSuchCallsDay']+=0x1;_0x1092e3[_0x6b4e('0xa8')]=0x0;_0x1092e3[_0x6b4e('0xa9')]=_0x6b4e('0x1a6');_0x1092e3['countnosuchnumberretry']+=0x1;_0x1092e3['countglobal']+=0x1;ami[_0x6b4e('0xe8')](_0x6b4e('0x1a7'),ut['buildObj'](_0x3ca5c0,'nosuchnumber'));_0x2fec99[_0x6b4e('0xcd')](_0x1092e3)['catch'](loggerCatch(_0x6b4e('0xf1')));if(_0x2fec99[_0x6b4e('0x195')](0x0,_0x3ca5c0,_0x5c22f7)){if(_0x1092e3[_0x6b4e('0xf5')]>=_0x5c22f7[_0x6b4e('0x19e')]){_0x2fec99[_0x6b4e('0xfb')](_0x1092e3,_0x467884,_0x4a3bc8,_0x6b4e('0x1a8'));}else{_0x2fec99[_0x6b4e('0x105')](_0x1092e3,_0x467884,_0x4a3bc8,_0x6b4e('0x1a8'));}}break;case'3':_0x5c22f7['outboundNoAnswerCallsDay']+=0x1;_0x1092e3[_0x6b4e('0xa8')]=0x3;_0x1092e3[_0x6b4e('0xa9')]=_0x6b4e('0x1a9');_0x1092e3[_0x6b4e('0xf4')]+=0x1;_0x1092e3[_0x6b4e('0xf0')]+=0x1;ami[_0x6b4e('0xe8')]('custom:agentnoanswer',ut[_0x6b4e('0xea')](_0x3ca5c0,_0x6b4e('0x1aa')));_0x2fec99[_0x6b4e('0xcd')](_0x1092e3)['catch'](loggerCatch(_0x6b4e('0x1ab')));if(_0x2fec99[_0x6b4e('0x195')](0x3,_0x3ca5c0,_0x5c22f7)){if(_0x1092e3[_0x6b4e('0xf4')]>=_0x5c22f7[_0x6b4e('0x196')]){_0x2fec99['createStateFinal'](_0x1092e3,_0x467884,_0x4a3bc8,_0x6b4e('0x1ac'));}else{_0x2fec99[_0x6b4e('0x105')](_0x1092e3,_0x467884,_0x4a3bc8,_0x6b4e('0x1ac'));}}break;case'5':_0x5c22f7['outboundBusyCallsDay']+=0x1;_0x1092e3[_0x6b4e('0xa8')]=0x5;_0x1092e3['statedesc']=_0x6b4e('0x1ad');_0x1092e3[_0x6b4e('0xf2')]+=0x1;_0x1092e3[_0x6b4e('0xf0')]+=0x1;ami['emit'](_0x6b4e('0x1ae'),ut[_0x6b4e('0xea')](_0x3ca5c0,_0x6b4e('0x1af')));_0x2fec99['createHistory'](_0x1092e3)[_0x6b4e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2fec99[_0x6b4e('0x195')](0x5,_0x3ca5c0,_0x5c22f7)){if(_0x1092e3[_0x6b4e('0xf2')]>=_0x5c22f7[_0x6b4e('0x199')]){_0x2fec99[_0x6b4e('0xfb')](_0x1092e3,_0x467884,_0x4a3bc8,_0x6b4e('0x1b0'));}else{_0x2fec99[_0x6b4e('0x105')](_0x1092e3,_0x467884,_0x4a3bc8,_0x6b4e('0x1b0'));}}break;case'8':_0x5c22f7[_0x6b4e('0x5f')]+=0x1;_0x1092e3[_0x6b4e('0xa8')]=0x8;_0x1092e3[_0x6b4e('0xa9')]=_0x6b4e('0x1b1');_0x1092e3[_0x6b4e('0xf3')]+=0x1;_0x1092e3[_0x6b4e('0xf0')]+=0x1;ami[_0x6b4e('0xe8')]('custom:agentcongestion',ut['buildObj'](_0x3ca5c0,_0x6b4e('0x1b2')));_0x2fec99[_0x6b4e('0xcd')](_0x1092e3)[_0x6b4e('0xb5')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x2fec99[_0x6b4e('0x195')](0x8,_0x3ca5c0,_0x5c22f7)){if(_0x1092e3[_0x6b4e('0xf3')]>=_0x5c22f7['dialCongestionMaxRetry']){_0x2fec99[_0x6b4e('0xfb')](_0x1092e3,_0x467884,_0x4a3bc8,_0x6b4e('0x1b3'));}else{_0x2fec99[_0x6b4e('0x105')](_0x1092e3,_0x467884,_0x4a3bc8,'reason\x208\x20congestion');}}break;case'11':_0x5c22f7[_0x6b4e('0x1b4')]+=0x1;_0x1092e3[_0x6b4e('0xa8')]=0xb;_0x1092e3[_0x6b4e('0xa9')]=_0x6b4e('0x124');_0x1092e3['countabandonedretry']+=0x1;_0x1092e3[_0x6b4e('0xf0')]+=0x1;_0x2fec99[_0x6b4e('0xcd')](_0x1092e3)[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x125')));if(_0x2fec99[_0x6b4e('0x195')](0xb,_0x3ca5c0,_0x5c22f7)){if(_0x1092e3[_0x6b4e('0xf6')]>=_0x5c22f7['dialAbandonedMaxRetry']){_0x2fec99[_0x6b4e('0xfb')](_0x1092e3,_0x467884,_0x4a3bc8,_0x6b4e('0x1b5'));}else{_0x2fec99['stateGlobal'](_0x1092e3,_0x467884,_0x4a3bc8,_0x6b4e('0x1b5'));}}break;case'20':_0x5c22f7['outboundRejectCallsDay']+=0x1;_0x1092e3[_0x6b4e('0xa8')]=0x14;_0x1092e3[_0x6b4e('0xa9')]=_0x6b4e('0x1b6');_0x1092e3[_0x6b4e('0xf8')]+=0x1;_0x1092e3[_0x6b4e('0xf0')]+=0x1;ami[_0x6b4e('0xe8')](_0x6b4e('0x1b7'),ut[_0x6b4e('0xea')](_0x3ca5c0,'agentreject'));_0x2fec99[_0x6b4e('0xcd')](_0x1092e3)[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x1b8')));if(_0x2fec99[_0x6b4e('0x195')](0x14,_0x3ca5c0,_0x5c22f7)){if(_0x1092e3['countagentrejectretry']>=_0x5c22f7['dialAgentRejectMaxRetry']){_0x2fec99[_0x6b4e('0xfb')](_0x1092e3,_0x467884,_0x4a3bc8,_0x6b4e('0x1b9'));}else{_0x2fec99[_0x6b4e('0x105')](_0x1092e3,_0x467884,_0x4a3bc8,_0x6b4e('0x1b9'));}}break;default:_0x5c22f7[_0x6b4e('0x66')]+=0x1;_0x1092e3['state']=0xc;_0x1092e3[_0x6b4e('0xa9')]=_0x5b9aaa[_0x6b4e('0x111')];_0x2fec99[_0x6b4e('0xcd')](_0x1092e3)['catch'](loggerCatch(_0x6b4e('0x1ba')));if(_0x2fec99[_0x6b4e('0x195')](_0x5b9aaa[_0x6b4e('0x111')],_0x3ca5c0,_0x5c22f7)){if(_0x1092e3[_0x6b4e('0xf2')]+_0x1092e3[_0x6b4e('0xf3')]+_0x1092e3['countnoanswerretry']+_0x1092e3[_0x6b4e('0xf5')]+_0x1092e3[_0x6b4e('0x104')]+_0x1092e3[_0x6b4e('0xf6')]+_0x1092e3[_0x6b4e('0xf7')]+_0x1092e3['countagentrejectretry']>=_0x5c22f7[_0x6b4e('0xf9')]){_0x2fec99['stateGlobal'](_0x1092e3,_0x467884,_0x4a3bc8,_0x5b9aaa[_0x6b4e('0x111')]);}else{_0x2fec99['createStateFinal'](_0x1092e3,_0x467884,_0x4a3bc8,_0x5b9aaa[_0x6b4e('0x111')]);}}}});};Dialer[_0x6b4e('0xac')][_0x6b4e('0x105')]=function(_0xf24547,_0x283c85,_0x593296,_0x147ebb){var _0x207d40=new Final(_0xf24547);_0x207d40['state']=0xf;_0x207d40[_0x6b4e('0xa9')]='Global';this[_0x6b4e('0xfb')](_0x207d40,_0x283c85,_0x593296,_0x147ebb);};Dialer[_0x6b4e('0xac')][_0x6b4e('0xfb')]=function(_0x5d4a25,_0x5cde1d,_0x2df1f3,_0x4c4d53){this[_0x6b4e('0xcb')](_0x5d4a25)[_0x6b4e('0xbc')](function(){return _0x5cde1d(msgResponse(_0x6b4e('0x1a3'),_0x6b4e('0xdb'),_0x4c4d53));})[_0x6b4e('0xb5')](function(){return _0x2df1f3(msgResponse('[moveContactManagedDialer][0]','Failure',_0x6b4e('0x1bb')));});};Dialer[_0x6b4e('0xac')][_0x6b4e('0xb')]=function(_0x4903ea){var _0x2bccf4=_0x4903ea['dialPredictiveOptimizationPercentage']/0x64;var _0x2a34f5=_0x4903ea[_0x6b4e('0x61')]/(_0x4903ea['outboundDropCallsDayTimeout']+_0x4903ea[_0x6b4e('0xee')]);var _0x9314ba=Math[_0x6b4e('0x1bc')](_0x4903ea[_0x6b4e('0x1bd')]*(_0x4903ea[_0x6b4e('0x1be')]/0x64));var _0x126bf8=Math[_0x6b4e('0x1bc')](_0x4903ea[_0x6b4e('0x1bd')]*(_0x4903ea[_0x6b4e('0x1bf')]/0x64));var _0x59a787=_0x4903ea[_0x6b4e('0x4f')]+_0x4903ea['talking'];var _0x3d3251=Math[_0x6b4e('0x1c0')](_0x4903ea['erlangCalls']*_0x4903ea[_0x6b4e('0x8b')]*_0x4903ea['predictiveIntervalHitRate']*_0x4903ea['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x4903ea['startProgressive'])){if(!_[_0x6b4e('0x3d')](_0x4903ea[_0x6b4e('0x28')])){_0x4903ea[_0x6b4e('0x28')]=undefined;loggerPredictive[_0x6b4e('0x96')]('[startMethodPredictive][StartProgressive]',_0x6b4e('0x1c1'));}if(!_['isUndefined'](_0x4903ea[_0x6b4e('0x91')])){loggerPredictive['error'](_0x6b4e('0x1c2'),_0x6b4e('0x1c3'));clearInterval(_0x4903ea[_0x6b4e('0x91')]);_0x4903ea[_0x6b4e('0x91')]=undefined;}_0x4903ea[_0x6b4e('0x75')]=moment()[_0x6b4e('0x7c')](_0x6b4e('0xfe'));loggerPredictive[_0x6b4e('0x7f')](_0x4903ea['name'],_0x6b4e('0x1c4'),_0x4903ea[_0x6b4e('0x75')]);this['handlePower'](_0x4903ea,0x1);}else if(ifInterval(_0x4903ea[_0x6b4e('0x1c5')],_0x4903ea[_0x6b4e('0x75')])){this['handlePower'](_0x4903ea,0x1);loggerPredictiveCalls[_0x6b4e('0x7f')](_0x6b4e('0x1c6'),_0x4903ea[_0x6b4e('0x75')],_0x4903ea[_0x6b4e('0x3e')]);_0x4903ea[_0x6b4e('0x72')]=0x0;_0x4903ea[_0x6b4e('0x6c')]=0x0;}else if(_0x2bccf4<_0x2a34f5&&_0x4903ea[_0x6b4e('0x1c7')]===_0x6b4e('0x1c8')){freeVariablesPredictive(_0x4903ea);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x1c9'),_0x6b4e('0x1ca'),_0x2a34f5,_0x6b4e('0x75'),_0x4903ea[_0x6b4e('0x3e')]);}else if(_0x3d3251<_0x4903ea[_0x6b4e('0x6c')]&&_0x4903ea['dialPredictiveOptimization']===_0x6b4e('0x1c8')){freeVariablesPredictive(_0x4903ea);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x1cb'),_0x6b4e('0x1cc'),_0x3d3251,'Drop\x20in\x20this\x20interval',_0x4903ea['predictiveIntervalErlangCallsDroppedCalls'],_0x6b4e('0x75'),_0x4903ea[_0x6b4e('0x3e')]);}else if(!ifInterval(_0x4903ea[_0x6b4e('0x1c5')],_0x4903ea[_0x6b4e('0x75')])&&_['isUndefined'](_0x4903ea['startPredictive'])&&!_[_0x6b4e('0x3d')](_0x4903ea[_0x6b4e('0x75')])){_0x4903ea[_0x6b4e('0x28')]=moment()[_0x6b4e('0x7c')](_0x6b4e('0xfe'));loggerPredictive[_0x6b4e('0x7f')](_0x4903ea['name'],_0x6b4e('0x1cd'),_0x4903ea[_0x6b4e('0x28')]);this['averageHandleTime'](_0x4903ea['dialPredictiveInterval'])['then'](this[_0x6b4e('0x1ce')](_0x4903ea))[_0x6b4e('0xbc')](mergeDataErlangB(_0x4903ea))['then'](this[_0x6b4e('0x1cf')](_0x4903ea))[_0x6b4e('0xb5')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x4903ea));}else if(!ifInterval(_0x4903ea[_0x6b4e('0x1c5')],_0x4903ea[_0x6b4e('0x28')])){_0x4903ea[_0x6b4e('0x6c')]=0x0;_0x4903ea[_0x6b4e('0x28')]=moment()[_0x6b4e('0x7c')](_0x6b4e('0xfe'));loggerPredictive[_0x6b4e('0x7f')](_0x4903ea['name'],_0x6b4e('0x1d0'),_0x4903ea[_0x6b4e('0x28')]);clearInterval(_0x4903ea[_0x6b4e('0x91')]);_0x4903ea[_0x6b4e('0x91')]=undefined;this[_0x6b4e('0x1d1')](_0x4903ea['dialPredictiveInterval'])[_0x6b4e('0xbc')](this[_0x6b4e('0x1ce')](_0x4903ea))['then'](mergeDataErlangB(_0x4903ea))[_0x6b4e('0xbc')](this[_0x6b4e('0x1cf')](_0x4903ea))[_0x6b4e('0xb5')](loggerCatchPredictive(_0x6b4e('0x1d2'),_0x4903ea));}else if(_0x4903ea['predictiveIntervalAvailable']&&_0x59a787<_0x4903ea['predictiveIntervalAvailable']-_0x126bf8){freeVariablesPredictive(_0x4903ea);loggerPredictive[_0x6b4e('0x7f')](_0x4903ea[_0x6b4e('0x3e')],_0x6b4e('0x1d3'),_0x59a787,')\x20are\x20less\x20than\x20threshold\x20(',_0x4903ea[_0x6b4e('0x1bd')],'-',_0x126bf8,'=',_0x4903ea['predictiveIntervalAvailable']-_0x126bf8,')');}else if(_0x4903ea[_0x6b4e('0x1bd')]&&_0x59a787>_0x4903ea[_0x6b4e('0x1bd')]+_0x9314ba){freeVariablesPredictive(_0x4903ea);loggerPredictive[_0x6b4e('0x7f')](_0x4903ea['name'],_0x6b4e('0x1d3'),_0x59a787,_0x6b4e('0x1d4'),_0x4903ea[_0x6b4e('0x1bd')],'+',_0x9314ba,'=',_0x4903ea['predictiveIntervalAvailable']+_0x9314ba,')');}};Dialer[_0x6b4e('0xac')][_0x6b4e('0x1ce')]=function(_0x23d38c){var _0x3cdc33=this;return function(_0xf8f669){return new BPromise(function(_0x45fa4b,_0x252a76){_[_0x6b4e('0x8d')](_0x23d38c,_0xf8f669[0x0]);if(checkGetDataPredictive(_0xf8f669[0x0])){var _0x3cb156=_0x23d38c[_0x6b4e('0x1bd')]=_0x23d38c[_0x6b4e('0x54')]+_0x23d38c[_0x6b4e('0x4f')];var _0xbd6847=_0x23d38c[_0x6b4e('0x1c5')]*0x3c;var _0x5e9590=_0xf8f669[0x0][_0x6b4e('0x68')]+_0xf8f669[0x0][_0x6b4e('0x67')];var _0x2229f9=(_0xf8f669[0x0][_0x6b4e('0x82')]+_0xf8f669[0x0][_0x6b4e('0x6a')]+_0xf8f669[0x0][_0x6b4e('0x69')])/_0xf8f669[0x0][_0x6b4e('0x70')];_0x23d38c[_0x6b4e('0x6d')]=_0x2229f9>0x0?_0x2229f9:0x1;switch(_0x23d38c[_0x6b4e('0x1c7')]){case _0x6b4e('0x1c8'):var _0x548662=_0x23d38c[_0x6b4e('0x1d5')]/0x64;return _0x3cdc33[_0x6b4e('0x1d6')](_0x3cb156,_0xbd6847,_0x5e9590,_0x2229f9,_0x548662)[_0x6b4e('0xbc')](function(_0x1ecb32){return _0x45fa4b(_0x1ecb32);});case _0x6b4e('0x1d7'):var _0x304201=_0x23d38c[_0x6b4e('0x1d5')]/0x64;return _0x3cdc33[_0x6b4e('0x1d8')](_0x3cb156,_0xbd6847,_0x5e9590,_0x2229f9,_0x304201)[_0x6b4e('0xbc')](function(_0xba33d4){return _0x45fa4b(_0xba33d4);});default:return _0x252a76(msgResponse('[getDataPredictive]',_0x6b4e('0x143'),'Unknown\x20Predictive'));}}else{return _0x252a76(msgResponse(_0x6b4e('0x1d9'),_0x6b4e('0x143'),_0x6b4e('0x1da')));}});};};Dialer[_0x6b4e('0xac')]['getDataPredictiveOld']=function(_0x12dd0f){var _0x293552=this;return function(_0x5004fc){return new BPromise(function(_0x1a0ec1,_0x118422){_['merge'](_0x12dd0f,_0x5004fc[0x0]);if(checkGetDataPredictive(_0x5004fc[0x0])){loggerPredictive[_0x6b4e('0x7f')](JSON[_0x6b4e('0x48')](_0x5004fc[0x0]));if(_0x12dd0f[_0x6b4e('0x1c7')]===_0x6b4e('0x1c8')){return _0x293552[_0x6b4e('0xca')](_0x12dd0f['id'])['then'](function(_0x15ca24){var _0x4059ff=_0x12dd0f[_0x6b4e('0x50')]-_0x15ca24[0x0][_0x6b4e('0x1db')];var _0x41888f=_0x12dd0f[_0x6b4e('0x1c5')]*0x3c;var _0x1eb836=_0x5004fc[0x0][_0x6b4e('0x68')]+_0x5004fc[0x0][_0x6b4e('0x67')];var _0x5d16a6=(_0x5004fc[0x0][_0x6b4e('0x82')]+_0x5004fc[0x0][_0x6b4e('0x6a')]+_0x5004fc[0x0][_0x6b4e('0x69')])/_0x5004fc[0x0]['predictiveIntervalTotalCalls'];var _0x12911e=_0x12dd0f['dialPredictiveOptimizationPercentage']/0x64;_0x12dd0f['predictiveIntervalPauses']=_0x15ca24[0x0][_0x6b4e('0x1db')]||0x0;_0x12dd0f[_0x6b4e('0x6d')]=_0x5d16a6>0x0?_0x5d16a6:0x1;return _0x293552[_0x6b4e('0x1d6')](_0x4059ff,_0x41888f,_0x1eb836,_0x5d16a6,_0x12911e);})[_0x6b4e('0xbc')](function(_0x5182c1){return _0x1a0ec1(_0x5182c1);})[_0x6b4e('0xb5')](function(_0x5b3dba){return _0x118422(msgResponse('[CatchErlangB]',_0x6b4e('0x143'),JSON['stringify'](_0x5b3dba)));});}if(_0x12dd0f[_0x6b4e('0x1c7')]===_0x6b4e('0x1d7')){return _0x293552['getVoiceQueueRtPauses'](_0x12dd0f['id'])[_0x6b4e('0xbc')](function(_0x3f8dad){var _0x5682ac=_0x12dd0f[_0x6b4e('0x50')]-_0x3f8dad[0x0]['outboundQueuePauses'];var _0x129d4a=_0x12dd0f[_0x6b4e('0x1c5')]*0x3c;var _0x3b588c=_0x5004fc[0x0][_0x6b4e('0x68')]+_0x5004fc[0x0]['predictiveIntervalAvgHoldtime'];var _0x5be886=(_0x5004fc[0x0][_0x6b4e('0x82')]+_0x5004fc[0x0][_0x6b4e('0x6a')]+_0x5004fc[0x0][_0x6b4e('0x69')])/_0x5004fc[0x0]['predictiveIntervalTotalCalls'];var _0x598dc8=_0x12dd0f[_0x6b4e('0x1d5')]/0x64;_0x12dd0f['predictiveIntervalPauses']=_0x3f8dad[0x0][_0x6b4e('0x1db')]||0x0;_0x12dd0f['predictiveIntervalHitRate']=_0x5be886>0x0?_0x5be886:0x1;return _0x293552[_0x6b4e('0x1d8')](_0x5682ac,_0x129d4a,_0x3b588c,_0x5be886,_0x598dc8);})[_0x6b4e('0xbc')](function(_0x50ae1f){return _0x1a0ec1(_0x50ae1f);})[_0x6b4e('0xb5')](function(_0xac8d02){return _0x118422(msgResponse(_0x6b4e('0x1dc'),'Failure',JSON['stringify'](_0xac8d02)));});}}else{return _0x118422(msgResponse(_0x6b4e('0x1d9'),_0x6b4e('0x143'),_0x6b4e('0x1da')));}});};};Dialer['prototype'][_0x6b4e('0x1cf')]=function(_0x1ffe8a){var _0x22d0ca=this;return function(){var _0x3429b5=0x0;var _0x361773=Math[_0x6b4e('0x1c0')](_0x1ffe8a['erlangCallToSecond']*0x3e8);if(_0x361773>0x0){_0x361773=_0x361773<0x64?0x64:_0x361773;loggerPredictive['info'](_0x1ffe8a[_0x6b4e('0x3e')],_0x6b4e('0x1dd'),_0x361773,_0x6b4e('0x49'));_0x1ffe8a['handlePredictive']=setInterval(function(){_0x22d0ca[_0x6b4e('0x91')](_0x1ffe8a);loggerPredictiveCalls['info'](_0x6b4e('0x1de'),_0x3429b5+=0x1);},_0x361773);}else{loggerPredictive['info'](_0x1ffe8a[_0x6b4e('0x3e')],_0x6b4e('0x1df'));}};};Dialer[_0x6b4e('0xac')][_0x6b4e('0x1e0')]=function(_0x58a5eb,_0x36edd8){var _0x472c=this;return function(_0xda5109){if(_[_0x6b4e('0x46')](_0xda5109)){if(_[_0x6b4e('0xb2')](_0x36edd8[_0x6b4e('0xd5')])||!_0x36edd8[_0x6b4e('0x1e1')]){if(_0x58a5eb[_0x6b4e('0x15d')]===_0x6b4e('0xa')){_0x58a5eb[_0x6b4e('0x12e')]=_['isUndefined'](_0x58a5eb['queueStatusComplete'])?!![]:_0x58a5eb[_0x6b4e('0x12e')];var _0x2f6fc8=uuid['v4']();_0x472c[_0x6b4e('0xaf')][_0x2f6fc8]=new Action(_0x58a5eb,_0x36edd8,_0x2f6fc8);loggerBooked[_0x6b4e('0x7f')]('[booked][checkContactBlack]',_0x2f6fc8,_0x6b4e('0x1e2'),JSON[_0x6b4e('0x48')](_0x58a5eb[_0x6b4e('0x12e')]),_0x6b4e('0x1e3'),_0x58a5eb[_0x6b4e('0x3e')]);if(_0x58a5eb[_0x6b4e('0x12e')]){_0x58a5eb[_0x6b4e('0x12e')]=![];_0x472c[_0x6b4e('0x12b')][_0x472c[_0x6b4e('0xaf')][_0x2f6fc8][_0x6b4e('0xb7')]]=[];ami[_0x6b4e('0xb3')]({'actionid':_0x2f6fc8,'action':'queuestatus','queue':_0x58a5eb[_0x6b4e('0x3e')]})[_0x6b4e('0xb5')](function(){_0x472c[_0x6b4e('0xb6')](_0x58a5eb);_0x472c[_0x6b4e('0xc1')]({'active':![],'ContactId':_0x472c[_0x6b4e('0xaf')][_0x2f6fc8][_0x6b4e('0xd4')],'ListId':_0x472c['actions'][_0x2f6fc8][_0x6b4e('0xff')],'VoiceQueueId':_0x472c[_0x6b4e('0xaf')][_0x2f6fc8][_0x6b4e('0xd6')]||undefined,'CampaignId':_0x472c[_0x6b4e('0xaf')][_0x2f6fc8][_0x6b4e('0xd7')]||undefined})[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x1e4')));delete _0x472c[_0x6b4e('0xaf')][_0x2f6fc8];});}else{loggerBooked[_0x6b4e('0x7f')](_0x6b4e('0x1e5'),JSON[_0x6b4e('0x48')](_0x58a5eb[_0x6b4e('0x12e')]),_0x6b4e('0x1e3'),_0x58a5eb['name']);_0x472c[_0x6b4e('0xb6')](_0x58a5eb);_0x472c['rescheduleContact']({'active':![],'ContactId':_0x472c[_0x6b4e('0xaf')][_0x2f6fc8][_0x6b4e('0xd4')],'ListId':_0x472c[_0x6b4e('0xaf')][_0x2f6fc8][_0x6b4e('0xff')],'VoiceQueueId':_0x472c[_0x6b4e('0xaf')][_0x2f6fc8][_0x6b4e('0xd6')]||undefined,'CampaignId':_0x472c[_0x6b4e('0xaf')][_0x2f6fc8][_0x6b4e('0xd7')]||undefined})[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x1e4')));delete _0x472c[_0x6b4e('0xaf')][_0x2f6fc8];}}else{return _0x472c[_0x6b4e('0x167')](_0x58a5eb,_0x36edd8);}}else{if(getDiff(_0x36edd8[_0x6b4e('0x1e6')])<_0x58a5eb[_0x6b4e('0x1e7')]*0x3c){if(_0x36edd8[_0x6b4e('0x1e8')]&&!_0x36edd8[_0x6b4e('0x1e8')][_0x6b4e('0x1e9')]){_0x472c[_0x6b4e('0x93')][_0x6b4e('0x131')](_0x36edd8['id'])['finally'](function(){_0x472c[_0x6b4e('0xb6')](_0x58a5eb);});}else{_0x472c['unlockContact']({'active':![]},_0x36edd8['id'],0x1)[_0x6b4e('0x1e')](function(){_0x472c['updateOriginated'](_0x58a5eb);});}}else{_0x58a5eb[_0x6b4e('0x64')]+=0x1;_0x472c[_0x6b4e('0xb6')](_0x58a5eb);if(_0x58a5eb[_0x6b4e('0x1ea')]){_0x472c[_0x6b4e('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x36edd8[_0x6b4e('0xd4')],'ListId':_0x36edd8[_0x6b4e('0xff')],'VoiceQueueId':_0x36edd8[_0x6b4e('0xd6')]||undefined,'CampaignId':_0x36edd8['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x472c['createHistory'](createObjHistory(_0x58a5eb,_0x36edd8,_0x6b4e('0x1eb'),0x17,'RecallInQueue'))[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x1ec')));}else{_0x472c['saveInDb'](createObjHistory(_0x58a5eb,_0x36edd8,'RECALLFAILEDTIMEOUT',0x16,_0x6b4e('0x1ed')),_0x6b4e('0x1ee'),_0x6b4e('0x1ef'));}}}}else{_0x58a5eb[_0x6b4e('0x5e')]+=0x1;_0x472c['saveInDb'](createObjHistory(_0x58a5eb,_0x36edd8,_0x6b4e('0x1f0'),0xd,_0x6b4e('0x1f1')),_0x6b4e('0x1f2'),'[Originate][MoveBlacklist]');throw _0x6b4e('0x1f3');}};};Dialer['prototype']['handleIvr']=function(_0x3594be){var _0x290f6a=this;var _0x110b9e=_0x3594be[_0x6b4e('0x1f4')]-_0x3594be['originated']-_0x3594be['temp'];emitCampaignSummary(_0x3594be);if(_0x110b9e>0x0){if(_0x110b9e>this[_0x6b4e('0x23')]){_0x110b9e=this['maxNumberOriginate'];}_0x3594be['temp']+=_0x110b9e;this[_0x6b4e('0xc8')](_0x3594be['id'],_0x110b9e,_0x3594be[_0x6b4e('0x1f5')],_0x3594be)['then'](function(_0x521a98){_0x3594be['temp']-=_0x110b9e;_0x3594be[_0x6b4e('0xc6')]=_0x3594be[_0x6b4e('0xc6')]>0x0?_0x3594be[_0x6b4e('0xc6')]:0x0;if(!checkContactEmpty(_0x521a98)){_0x3594be['message']=_0x6b4e('0xa0');logger[_0x6b4e('0x7f')](_0x6b4e('0x1f6')+_0x3594be['name']);}else{_0x3594be[_0x6b4e('0x71')]+=_0x521a98[_0x6b4e('0x99')];_0x3594be[_0x6b4e('0x40')]=_0x6b4e('0x1f7');for(var _0x409f6e=0x0;_0x409f6e<_0x521a98[_0x6b4e('0x99')];_0x409f6e+=0x1){_0x3594be[_0x6b4e('0x1f8')]+=0x1;if(_[_0x6b4e('0xb2')](_0x521a98[_0x409f6e])||_['isNil'](_0x521a98[_0x409f6e]['Contact'])||_[_0x6b4e('0xb2')](_0x521a98[_0x409f6e]['Contact'][_0x6b4e('0x16c')])){_0x290f6a['emptyContact'](_0x6b4e('0x1f9'),_0x3594be,_0x521a98[_0x409f6e]);}else{_0x290f6a[_0x6b4e('0xbf')](_[_0x6b4e('0xd3')](_0x521a98[_0x409f6e],['CampaignId',_0x6b4e('0x1fa')]))[_0x6b4e('0xbc')](_0x290f6a[_0x6b4e('0x1e0')](_0x3594be,_0x521a98[_0x409f6e]))[_0x6b4e('0xb5')](_0x290f6a['loggerHandler'](_0x6b4e('0x1fb'),_0x3594be));}}}})[_0x6b4e('0xb5')](loggerGetContactDialer(_0x6b4e('0x1fc'),_0x3594be,_0x110b9e));}};Dialer['prototype'][_0x6b4e('0x158')]=function(_0xbe9bcd,_0x5b4c3d){var _0x1f64d1=this;var _0x519b5c=[];var _0x2fb260=_0x5b4c3d>=0x1?_0x5b4c3d:0x1;if(_0xbe9bcd[_0x6b4e('0x15d')]==='booked'){_0x2fb260=0x1;}var _0x3a4b74=Math[_0x6b4e('0x1c0')](_0xbe9bcd['available']*_0x2fb260)-_0xbe9bcd[_0x6b4e('0x71')]-_0xbe9bcd['temp'];emitVoiceQueueSummary(_0xbe9bcd);if(_0xbe9bcd[_0x6b4e('0x1fd')]>0x0){var _0x5f1b76=_0xbe9bcd['dialLimitQueue']-_0xbe9bcd[_0x6b4e('0x71')]-_0xbe9bcd[_0x6b4e('0x54')]-_0xbe9bcd[_0x6b4e('0xc6')]-_0xbe9bcd[_0x6b4e('0x51')];if(_0x3a4b74>_0x5f1b76){_0x3a4b74=_0x5f1b76;}}if(_0x3a4b74>0x0){if(_0xbe9bcd['dialMethod']===_0x6b4e('0xa')){_0x3a4b74=0x1;}if(_0x3a4b74>this[_0x6b4e('0x23')]){_0x3a4b74=this[_0x6b4e('0x23')];}_0xbe9bcd[_0x6b4e('0xc6')]+=_0x3a4b74;for(var _0x5319d0 in this[_0x6b4e('0x21')]){if(typeof this[_0x6b4e('0x21')][_0x5319d0]!=='undefined'){if(this[_0x6b4e('0x21')][_0x5319d0][_0x6b4e('0xa8')]===_0x6b4e('0x1fe')&&this[_0x6b4e('0x21')][_0x5319d0][_0x6b4e('0xb4')]==='reachable'){_0x519b5c[_0x6b4e('0x12c')](this[_0x6b4e('0x21')][_0x5319d0]['id']);}}}this['getContactDialer'](_0xbe9bcd['id'],_0x519b5c,_0x3a4b74,_0xbe9bcd[_0x6b4e('0x1f5')],_0xbe9bcd)[_0x6b4e('0xbc')](function(_0x2c4219){_0xbe9bcd['temp']-=_0x3a4b74;_0xbe9bcd[_0x6b4e('0xc6')]=_0xbe9bcd[_0x6b4e('0xc6')]>0x0?_0xbe9bcd[_0x6b4e('0xc6')]:0x0;if(!checkContactEmpty(_0x2c4219)){_0x1f64d1[_0x6b4e('0xba')](_0xbe9bcd)['then'](sendMessageReschedule(_0xbe9bcd))[_0x6b4e('0xb5')](loggerCatch(_0x6b4e('0x1ff')));}else{_0xbe9bcd[_0x6b4e('0x71')]+=_0x2c4219[_0x6b4e('0x99')];_0xbe9bcd[_0x6b4e('0x40')]=_0xbe9bcd[_0x6b4e('0x15d')]==='booked'?'ACTIVE':_0x6b4e('0x1f7');for(var _0x10b68f=0x0;_0x10b68f<_0x2c4219[_0x6b4e('0x99')];_0x10b68f+=0x1){if(_[_0x6b4e('0xb2')](_0x2c4219[_0x10b68f])||_[_0x6b4e('0xb2')](_0x2c4219[_0x10b68f][_0x6b4e('0x16b')])||_['isNil'](_0x2c4219[_0x10b68f][_0x6b4e('0x16b')][_0x6b4e('0x16c')])){_0x1f64d1[_0x6b4e('0xd0')](_0x6b4e('0x1f9'),_0xbe9bcd,_0x2c4219[_0x10b68f]);}else{_0x1f64d1[_0x6b4e('0xbd')](_[_0x6b4e('0xd3')](_0x2c4219[_0x10b68f],['VoiceQueueId',_0x6b4e('0x1fa')]))[_0x6b4e('0xbc')](_0x1f64d1[_0x6b4e('0x1e0')](_0xbe9bcd,_0x2c4219[_0x10b68f]))[_0x6b4e('0xb5')](_0x1f64d1[_0x6b4e('0x200')](_0x6b4e('0x1f9'),_0xbe9bcd));}}}})[_0x6b4e('0xb5')](loggerGetContactDialer(_0x6b4e('0x201'),_0xbe9bcd,_0x3a4b74));}};Dialer['prototype'][_0x6b4e('0x91')]=function(_0x58693c){if(_0x58693c['dialLimitQueue']>0x0){var _0x2b2fe4=_0x58693c[_0x6b4e('0x1fd')]-_0x58693c['originated']-_0x58693c['talking'];if(_0x2b2fe4>0x0){this[_0x6b4e('0x202')](_0x58693c);}else{loggerPredictiveCalls[_0x6b4e('0x7f')](_0x6b4e('0x203'));}}else{this[_0x6b4e('0x202')](_0x58693c);}};Dialer[_0x6b4e('0xac')]['tryOriginatePredictive']=function(_0x216de5){var _0x5c9ceb=this;var _0x3f2b53=[];_0x216de5[_0x6b4e('0x71')]+=0x1;for(var _0x536ca5 in this[_0x6b4e('0x21')]){if(typeof this[_0x6b4e('0x21')][_0x536ca5]!==_0x6b4e('0xce')){if(this[_0x6b4e('0x21')][_0x536ca5][_0x6b4e('0xa8')]===_0x6b4e('0x1fe')&&this[_0x6b4e('0x21')][_0x536ca5][_0x6b4e('0xb4')]===_0x6b4e('0xde')){_0x3f2b53[_0x6b4e('0x12c')](this[_0x6b4e('0x21')][_0x536ca5]['id']);}}}this['getContactDialer'](_0x216de5['id'],_0x3f2b53,0x1,_0x216de5[_0x6b4e('0x1f5')],_0x216de5)[_0x6b4e('0xbc')](function(_0x5697ef){if(!checkContactEmpty(_0x5697ef)){checkContactLowerLimitOriginate(_0x216de5,0x1,0x0);_0x5c9ceb[_0x6b4e('0xba')](_0x216de5)[_0x6b4e('0xbc')](sendMessageReschedule(_0x216de5))[_0x6b4e('0xb5')](loggerCatch('[countReScheduled]\x20'));}else{_0x216de5[_0x6b4e('0x40')]=_0x6b4e('0x1f7');if(_['isNil'](_0x5697ef[0x0])||_['isNil'](_0x5697ef[0x0][_0x6b4e('0x16b')])||_['isNil'](_0x5697ef[0x0][_0x6b4e('0x16b')][_0x6b4e('0x16c')])){_0x5c9ceb[_0x6b4e('0xd0')](_0x6b4e('0x1f9'),_0x216de5,_0x5697ef[0x0]);}else{_0x5c9ceb[_0x6b4e('0xbd')](_['pick'](_0x5697ef[0x0],[_0x6b4e('0xd6'),_0x6b4e('0x1fa')]))[_0x6b4e('0xbc')](_0x5c9ceb[_0x6b4e('0x1e0')](_0x216de5,_0x5697ef[0x0]))[_0x6b4e('0xb5')](_0x5c9ceb[_0x6b4e('0x200')](_0x6b4e('0x204'),_0x216de5));}}})['catch'](loggerGetContactDialer(_0x6b4e('0x205'),_0x216de5,0x1));emitVoiceQueueSummary(_0x216de5);};Dialer[_0x6b4e('0xac')]['abandonmentRate']=function(_0x3cad34,_0x329c76,_0xb9fe0d,_0x4aa3fb,_0x292b64,_0xdb35f4){loggerPredictive['info'](_0x6b4e('0x206'));loggerPredictive['info'](_0x6b4e('0x207'),_0x3cad34);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x208'),_0x329c76);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x209'),_0xb9fe0d);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x20a'),_0x4aa3fb);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x20b'),_0x292b64);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x20c'));return new BPromise(function(_0x22f32c,_0x10c33a){if(_0x3cad34<=0x0||isNaN(_0x3cad34)){return _0x10c33a(msgResponse('[abandonmentRate]',_0x6b4e('0x47'),_0x6b4e('0x20d')+_0x3cad34));}if(_0xb9fe0d<=0x0||isNaN(_0xb9fe0d)){return _0x10c33a(msgResponse('[abandonmentRate]',_0x6b4e('0x47'),_0x6b4e('0x20e')+_0xb9fe0d));}if(_0x4aa3fb<=0x0||isNaN(_0x4aa3fb)){return _0x10c33a(msgResponse(_0x6b4e('0x20f'),_0x6b4e('0x47'),'p\x20=\x20'+_0x4aa3fb));}if(_0x329c76<=0x0||isNaN(_0x329c76)){return _0x10c33a(msgResponse(_0x6b4e('0x20f'),_0x6b4e('0x47'),_0x6b4e('0x210')+_0x329c76));}if(_0x292b64<=0x0||isNaN(_0x292b64)){return _0x10c33a(msgResponse('[abandonmentRate]',_0x6b4e('0x47'),_0x6b4e('0x211')+_0x292b64));}_0xdb35f4=_0xdb35f4||0x0;var _0x4bbffd=0x1/_0xb9fe0d;var _0x257143=0x0;var _0x2e6fec=0x0;var _0x275590=0x0;var _0x43585c=0x0;for(var _0x2e01b2=0x0;_0x275590<_0x292b64;_0x2e01b2+=0x1){_0x2e6fec=_0x2e01b2/_0x329c76;_0x257143=(_0x4aa3fb*_0x2e6fec+_0xdb35f4)/_0x4bbffd;_0x275590=erlangb(_0x257143,_0x3cad34);_0x43585c=_0x257143/_0x3cad34*(0x1-erlangb(_0x257143,_0x3cad34));}return _0x22f32c({'erlangCalls':_0x2e01b2,'erlangCallToSecond':_0x329c76/_0x2e01b2,'erlangAbandonmentRate':_0x275590,'erlangBusyFactor':_0x43585c});});};Dialer[_0x6b4e('0xac')][_0x6b4e('0x1d8')]=function(_0x2f843a,_0x5de375,_0x1653e4,_0x414d34,_0x34c3b2,_0xbc7c22){loggerPredictive[_0x6b4e('0x7f')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x207'),_0x2f843a);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5de375);loggerPredictive['info'](_0x6b4e('0x209'),_0x1653e4);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x20a'),_0x414d34);loggerPredictive['info'](_0x6b4e('0x212'),_0x34c3b2);loggerPredictive[_0x6b4e('0x7f')](_0x6b4e('0x20c'));return new BPromise(function(_0x38860f,_0x43153c){if(_0x2f843a<=0x0||isNaN(_0x2f843a)){return _0x43153c(msgResponse(_0x6b4e('0x213'),'Error','m\x20=\x20'+_0x2f843a));}if(_0x1653e4<=0x0||isNaN(_0x1653e4)){return _0x43153c(msgResponse(_0x6b4e('0x213'),_0x6b4e('0x47'),_0x6b4e('0x20e')+_0x1653e4));}if(_0x414d34<=0x0||isNaN(_0x414d34)){return _0x43153c(msgResponse(_0x6b4e('0x213'),_0x6b4e('0x47'),'p\x20=\x20'+_0x414d34));}if(_0x5de375<=0x0||isNaN(_0x5de375)){return _0x43153c(msgResponse('[busyFactor]','Error',_0x6b4e('0x210')+_0x5de375));}if(_0x34c3b2<=0x0||isNaN(_0x34c3b2)){return _0x43153c(msgResponse(_0x6b4e('0x213'),_0x6b4e('0x47'),_0x6b4e('0x214')+_0x34c3b2));}_0xbc7c22=_0xbc7c22||0x0;var _0x54fe44=0x1/_0x1653e4;var _0x4094b5=0x0;var _0x585bd5=0x0;var _0x4d5e33=0x0;var _0xb6454a=0x0;for(var _0x23c98f=0x0;_0xb6454a<_0x34c3b2;_0x23c98f+=0x1){_0x585bd5=_0x23c98f/_0x5de375;_0x4094b5=(_0x414d34*_0x585bd5+_0xbc7c22)/_0x54fe44;_0x4d5e33=erlangb(_0x4094b5,_0x2f843a);_0xb6454a=_0x4094b5/_0x2f843a*(0x1-erlangb(_0x4094b5,_0x2f843a));}return _0x38860f({'erlangCalls':_0x23c98f,'erlangCallToSecond':_0x5de375/_0x23c98f,'erlangAbandonmentRate':_0x4d5e33,'erlangBusyFactor':_0xb6454a});});};module[_0x6b4e('0x215')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index f4a9e89..2dce958 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f2c=['originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x2f2c,0x1c5));var _0xc2f2=function(_0x298fe8,_0x54662d){_0x298fe8=_0x298fe8-0x0;var _0x35566c=_0x2f2c[_0x298fe8];return _0x35566c;};'use strict';var util=require(_0xc2f2('0x0'));var _=require(_0xc2f2('0x1'));var moment=require(_0xc2f2('0x2'));function getSeconds(_0x58f4c3,_0x37d60a){var _0x4136db=moment(_0x58f4c3)['milliseconds'](0x0);var _0x4ed6e5=moment(_0x37d60a)[_0xc2f2('0x3')](0x0);return _0x4136db['diff'](_0x4ed6e5,_0xc2f2('0x4'));}function QueueCallerAbandon(_0x5bf750,_0x12a2ff){this[_0xc2f2('0x5')]=_0x5bf750[_0xc2f2('0x5')];this['type']=_0x5bf750[_0xc2f2('0x6')];this[_0xc2f2('0x7')]=_0x5bf750[_0xc2f2('0x6')]===_0xc2f2('0x8')?_0xc2f2('0x9'):_0x5bf750['type'];this['countbusyretry']=_0x5bf750[_0xc2f2('0xa')];this['countcongestionretry']=_0x5bf750[_0xc2f2('0xb')];this[_0xc2f2('0xc')]=_0x5bf750[_0xc2f2('0xc')];this[_0xc2f2('0xd')]=_0x5bf750['countbusyretry']+_0x5bf750[_0xc2f2('0xb')]+_0x5bf750[_0xc2f2('0xc')]+_0x5bf750['countnosuchnumberretry']+_0x5bf750[_0xc2f2('0xe')]+_0x5bf750['countabandonedretry']+_0x5bf750[_0xc2f2('0xf')]+_0x5bf750[_0xc2f2('0x10')];this['countnosuchnumberretry']=_0x5bf750[_0xc2f2('0x11')];this[_0xc2f2('0xe')]=_0x5bf750['countdropretry'];this[_0xc2f2('0x12')]=_0x5bf750[_0xc2f2('0x12')];this['countmachineretry']=_0x5bf750['countmachineretry'];this[_0xc2f2('0x10')]=_0x5bf750[_0xc2f2('0x10')];this['uniqueid']=_0x12a2ff[_0xc2f2('0x13')];this[_0xc2f2('0x14')]=_0x5bf750['name'];this[_0xc2f2('0x15')]=_0x5bf750[_0xc2f2('0x16')];this[_0xc2f2('0x17')]=_0x5bf750[_0xc2f2('0x17')];this['responsetime']=_0x5bf750[_0xc2f2('0x18')];this['droptime']=_0x5bf750[_0xc2f2('0x19')];this[_0xc2f2('0x1a')]=this[_0xc2f2('0x19')];this[_0xc2f2('0x1b')]=getSeconds(_0x5bf750[_0xc2f2('0x18')],_0x5bf750[_0xc2f2('0x17')]);this[_0xc2f2('0x1c')]=getSeconds(this[_0xc2f2('0x19')],_0x5bf750['responsetime']);this[_0xc2f2('0x1d')]=0x0;this[_0xc2f2('0x9')]=_0x12a2ff[_0xc2f2('0x9')];this[_0xc2f2('0x1e')]=_0x12a2ff[_0xc2f2('0x1f')];this[_0xc2f2('0x20')]=_0x12a2ff[_0xc2f2('0x20')];this[_0xc2f2('0x21')]=_0x5bf750[_0xc2f2('0x21')];this[_0xc2f2('0x22')]=_0x5bf750['callbackuniqueid'];this[_0xc2f2('0x23')]=_0x5bf750['callbackat'];this['recallme']=_0x5bf750[_0xc2f2('0x24')];this[_0xc2f2('0x25')]=_0x5bf750[_0xc2f2('0x25')];this[_0xc2f2('0x26')]=_0x5bf750['ListId'];this[_0xc2f2('0x27')]=_0x5bf750[_0xc2f2('0x27')];this[_0xc2f2('0x28')]=_0x5bf750['VoiceQueueId'];this[_0xc2f2('0x29')]=_0x5bf750[_0xc2f2('0x29')];this['originatecalleridnum']=_0x5bf750[_0xc2f2('0x2a')]||'';this[_0xc2f2('0x2b')]=_0x5bf750[_0xc2f2('0x2b')]||'';}module[_0xc2f2('0x2c')]=QueueCallerAbandon; \ No newline at end of file +var _0x662a=['uniqueid','calleridname','name','number','starttime','responsetime','droptime','ringtime','holdtime','queue','connectedlinename','reason','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0x662a,0xae));var _0xa662=function(_0x4d9a67,_0x47ec8c){_0x4d9a67=_0x4d9a67-0x0;var _0x4030d7=_0x662a[_0x4d9a67];return _0x4030d7;};'use strict';var util=require('util');var _=require(_0xa662('0x0'));var moment=require(_0xa662('0x1'));function getSeconds(_0x194733,_0x2afeff){var _0x5eda9e=moment(_0x194733)[_0xa662('0x2')](0x0);var _0x249f2f=moment(_0x2afeff)[_0xa662('0x2')](0x0);return _0x5eda9e['diff'](_0x249f2f,'seconds');}function QueueCallerAbandon(_0x39de67,_0xb0848f){this[_0xa662('0x3')]=_0x39de67[_0xa662('0x3')];this[_0xa662('0x4')]=_0x39de67[_0xa662('0x4')];this[_0xa662('0x5')]=_0x39de67[_0xa662('0x4')]===_0xa662('0x6')?'queue':_0x39de67[_0xa662('0x4')];this['countbusyretry']=_0x39de67[_0xa662('0x7')];this[_0xa662('0x8')]=_0x39de67[_0xa662('0x8')];this['countnoanswerretry']=_0x39de67[_0xa662('0x9')];this[_0xa662('0xa')]=_0x39de67['countbusyretry']+_0x39de67[_0xa662('0x8')]+_0x39de67[_0xa662('0x9')]+_0x39de67[_0xa662('0xb')]+_0x39de67[_0xa662('0xc')]+_0x39de67[_0xa662('0xd')]+_0x39de67[_0xa662('0xe')]+_0x39de67[_0xa662('0xf')];this[_0xa662('0xb')]=_0x39de67['countnosuchnumberretry'];this[_0xa662('0xc')]=_0x39de67[_0xa662('0xc')];this['countabandonedretry']=_0x39de67[_0xa662('0xd')];this[_0xa662('0xe')]=_0x39de67['countmachineretry'];this[_0xa662('0xf')]=_0x39de67[_0xa662('0xf')];this[_0xa662('0x10')]=_0xb0848f[_0xa662('0x10')];this[_0xa662('0x11')]=_0x39de67[_0xa662('0x12')];this['calleridnum']=_0x39de67[_0xa662('0x13')];this[_0xa662('0x14')]=_0x39de67['starttime'];this[_0xa662('0x15')]=_0x39de67[_0xa662('0x15')];this[_0xa662('0x16')]=_0x39de67[_0xa662('0x16')];this['endtime']=this[_0xa662('0x16')];this[_0xa662('0x17')]=getSeconds(_0x39de67[_0xa662('0x15')],_0x39de67[_0xa662('0x14')]);this[_0xa662('0x18')]=getSeconds(this[_0xa662('0x16')],_0x39de67[_0xa662('0x15')]);this['talktime']=0x0;this['queue']=_0xb0848f[_0xa662('0x19')];this['membername']=_0xb0848f[_0xa662('0x1a')];this['reason']=_0xb0848f[_0xa662('0x1b')];this['callback']=_0x39de67['callback'];this[_0xa662('0x1c')]=_0x39de67['callbackuniqueid'];this[_0xa662('0x1d')]=_0x39de67[_0xa662('0x1d')];this['recallme']=_0x39de67['recallme'];this[_0xa662('0x1e')]=_0x39de67[_0xa662('0x1e')];this[_0xa662('0x1f')]=_0x39de67[_0xa662('0x1f')];this[_0xa662('0x20')]=_0x39de67['UserId'];this['VoiceQueueId']=_0x39de67[_0xa662('0x21')];this['CampaignId']=_0x39de67[_0xa662('0x22')];this[_0xa662('0x23')]=_0x39de67[_0xa662('0x23')]||'';this['originatecalleridname']=_0x39de67[_0xa662('0x24')]||'';}module[_0xa662('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 2081edc..db20c5e 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(_0x4b2f55,_0x58a005){var _0x5d4a4e=function(_0x169ea6){while(--_0x169ea6){_0x4b2f55['push'](_0x4b2f55['shift']());}};_0x5d4a4e(++_0x58a005);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x1df7b8,_0x1ea2df){var _0x4e57c3=function(_0x519925){while(--_0x519925){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x4e57c3(++_0x1ea2df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 338ddbb..56bd30b 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 _0xb3c4=['./util/gs','../../../config/logger','./rpcDb','./channel','./util/util','./action','../rpc/attachment','channels','faxAccounts','trunks','actions','varset','syncVarSet','newstate','syncNewState','bind','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','prototype','variable','channelstate','channelstatedesc','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','fax','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','lodash','bluebird','uuid','moment'];(function(_0x3f2868,_0x153f4c){var _0x4ddd77=function(_0x3d59b5){while(--_0x3d59b5){_0x3f2868['push'](_0x3f2868['shift']());}};_0x4ddd77(++_0x153f4c);}(_0xb3c4,0xe6));var _0x4b3c=function(_0x415ed8,_0x53bf49){_0x415ed8=_0x415ed8-0x0;var _0xf00600=_0xb3c4[_0x415ed8];return _0xf00600;};'use strict';var util=require('util');var _=require(_0x4b3c('0x0'));var BPromise=require(_0x4b3c('0x1'));var uuid=require(_0x4b3c('0x2'));var moment=require(_0x4b3c('0x3'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x4b3c('0x4'));var logger=require(_0x4b3c('0x5'))('fax');var ami=require('../ami');var rpcDb=require(_0x4b3c('0x6'));var Channel=require(_0x4b3c('0x7'));var ut=require(_0x4b3c('0x8'));var Action=require(_0x4b3c('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x4b3c('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x9e01b7){this[_0x4b3c('0xb')]={};this[_0x4b3c('0xc')]=_0x9e01b7[_0x4b3c('0xc')];this[_0x4b3c('0xd')]=_0x9e01b7[_0x4b3c('0xd')];this[_0x4b3c('0xe')]={};ami['on']('newchannel',this['syncNewchannel']['bind'](this));ami['on'](_0x4b3c('0xf'),this[_0x4b3c('0x10')]['bind'](this));ami['on'](_0x4b3c('0x11'),this[_0x4b3c('0x12')][_0x4b3c('0x13')](this));ami['on'](_0x4b3c('0x14'),this[_0x4b3c('0x15')][_0x4b3c('0x13')](this));ami['on'](_0x4b3c('0x16'),this[_0x4b3c('0x17')]['bind'](this));ami['on'](_0x4b3c('0x18'),this[_0x4b3c('0x19')][_0x4b3c('0x13')](this));ami['on'](_0x4b3c('0x1a'),this[_0x4b3c('0x1b')][_0x4b3c('0x13')](this));ami['on'](_0x4b3c('0x1c'),this[_0x4b3c('0x1d')][_0x4b3c('0x13')](this));}Fax['prototype'][_0x4b3c('0x1e')]=function(_0x258990){if(_0x258990[_0x4b3c('0x1f')]===_0x4b3c('0x20')){for(var _0x504ed2 in this[_0x4b3c('0xc')]){if(this[_0x4b3c('0xc')][_0x4b3c('0x21')](_0x504ed2)){if(_0x258990[_0x4b3c('0x22')]===this[_0x4b3c('0xc')][_0x504ed2][_0x4b3c('0x23')]){this[_0x4b3c('0xb')][_0x258990[_0x4b3c('0x24')]]={};this[_0x4b3c('0xb')][_0x258990[_0x4b3c('0x24')]][_0x4b3c('0x25')]=_0x258990['channel'];this['channels'][_0x258990[_0x4b3c('0x24')]]['id']=this[_0x4b3c('0xc')][_0x504ed2]['id'];this[_0x4b3c('0xb')][_0x258990[_0x4b3c('0x24')]][_0x4b3c('0x26')]=this[_0x4b3c('0xc')][_0x504ed2][_0x4b3c('0x26')];logger[_0x4b3c('0x27')](_0x258990[_0x4b3c('0x24')],'\x20syncNewchannel\x20');}}}}if(this[_0x4b3c('0xe')][_0x258990[_0x4b3c('0x24')]]){this[_0x4b3c('0xb')][_0x258990[_0x4b3c('0x24')]]={};this[_0x4b3c('0xb')][_0x258990[_0x4b3c('0x24')]][_0x4b3c('0x25')]=_0x258990[_0x4b3c('0x25')];logger['info'](_0x258990[_0x4b3c('0x24')],'\x20syncNewchannel\x20');}};Fax[_0x4b3c('0x28')][_0x4b3c('0x10')]=function(_0x5ca300){if(this[_0x4b3c('0xb')][_0x5ca300[_0x4b3c('0x24')]]){for(var _0x1f83df in _0x5ca300[_0x4b3c('0x29')]){if(_0x5ca300[_0x4b3c('0x29')][_0x4b3c('0x21')](_0x1f83df)){this[_0x4b3c('0xb')][_0x5ca300[_0x4b3c('0x24')]][_0x1f83df]=_0x5ca300['value'];}}}};Fax[_0x4b3c('0x28')][_0x4b3c('0x12')]=function(_0x16c976){if(this['channels'][_0x16c976[_0x4b3c('0x24')]]){this[_0x4b3c('0xb')][_0x16c976[_0x4b3c('0x24')]][_0x4b3c('0x2a')]=_0x16c976['channelstate'];this[_0x4b3c('0xb')][_0x16c976[_0x4b3c('0x24')]][_0x4b3c('0x2b')]=_0x16c976[_0x4b3c('0x2b')];}};Fax[_0x4b3c('0x28')][_0x4b3c('0x15')]=function(_0x876d29){if(this[_0x4b3c('0xb')][_0x876d29['uniqueid']]){for(var _0x597cc5 in _0x876d29[_0x4b3c('0x29')]){if(_0x876d29['variable'][_0x4b3c('0x21')](_0x597cc5)){this[_0x4b3c('0xb')][_0x876d29[_0x4b3c('0x24')]][_0x597cc5]=_0x876d29['value'];}}}};Fax[_0x4b3c('0x28')][_0x4b3c('0x17')]=function(_0x153959){if(this[_0x4b3c('0xb')][_0x153959['uniqueid']]){this[_0x4b3c('0xb')][_0x153959[_0x4b3c('0x24')]]['operation']=_0x153959['operation'];this['channels'][_0x153959['uniqueid']]['status']=_0x153959[_0x4b3c('0x2c')];this['channels'][_0x153959[_0x4b3c('0x24')]]['localstationid']=_0x153959[_0x4b3c('0x23')];this[_0x4b3c('0xb')][_0x153959[_0x4b3c('0x24')]][_0x4b3c('0x2d')]=_0x153959[_0x4b3c('0x2d')];logger['info'](_0x153959[_0x4b3c('0x24')],'\x20syncFaxStatus\x20');}};Fax[_0x4b3c('0x28')]['syncReceiveFax']=function(_0x35ef47){var _0x3f0792=this;if(this[_0x4b3c('0xb')][_0x35ef47[_0x4b3c('0x24')]]){var _0x106f44=this[_0x4b3c('0xb')][_0x35ef47[_0x4b3c('0x24')]]['id'];this['channels'][_0x35ef47['uniqueid']]['remotestationid']=_0x35ef47[_0x4b3c('0x2e')];this[_0x4b3c('0xb')][_0x35ef47[_0x4b3c('0x24')]][_0x4b3c('0x2f')]=_0x35ef47[_0x4b3c('0x2f')];this[_0x4b3c('0xb')][_0x35ef47[_0x4b3c('0x24')]]['localstationid']=_0x35ef47['localstationid'];this[_0x4b3c('0xb')][_0x35ef47[_0x4b3c('0x24')]][_0x4b3c('0x30')]=_0x35ef47[_0x4b3c('0x30')];this['channels'][_0x35ef47[_0x4b3c('0x24')]]['transferrate']=_0x35ef47[_0x4b3c('0x31')];this['channels'][_0x35ef47['uniqueid']][_0x4b3c('0x2d')]=_0x35ef47[_0x4b3c('0x2d')];this['channels'][_0x35ef47[_0x4b3c('0x24')]][_0x4b3c('0x32')]=_0x35ef47[_0x4b3c('0x32')];if(this[_0x4b3c('0xb')][_0x35ef47[_0x4b3c('0x24')]][_0x4b3c('0x2f')]>0x0){tiff2pdf(_0x35ef47[_0x4b3c('0x2d')],'/var/opt/motion2/server/files/attachments/',function(_0x5971b1){logger[_0x4b3c('0x27')](_0x35ef47['uniqueid'],_0x4b3c('0x33'),_0x5971b1[_0x4b3c('0x34')]);attachment['create']({'name':path[_0x4b3c('0x35')](_0x35ef47[_0x4b3c('0x2d')])[_0x4b3c('0x26')],'basename':path['parse'](_0x35ef47[_0x4b3c('0x2d')])[_0x4b3c('0x26')]+_0x4b3c('0x36'),'type':_0x4b3c('0x37')})[_0x4b3c('0x38')](function(_0x4a92ec){faxAccount[_0x4b3c('0x39')](_0x106f44,{'from':_0x35ef47[_0x4b3c('0x32')],'mapKey':_0x4b3c('0x3a'),'body':path['parse'](_0x35ef47['filename'])['name']+_0x4b3c('0x36'),'AttachmentId':_0x4a92ec['id']})[_0x4b3c('0x3b')](function(_0x5f230b){logger['error'](_0x35ef47[_0x4b3c('0x24')],_0x4b3c('0x3c'),JSON[_0x4b3c('0x3d')](_0x5f230b));});})['catch'](function(_0x186cd9){logger[_0x4b3c('0x3e')](_0x35ef47[_0x4b3c('0x24')],_0x4b3c('0x3f'),JSON[_0x4b3c('0x3d')](_0x186cd9));});});}logger[_0x4b3c('0x27')](_0x35ef47[_0x4b3c('0x24')],'\x20receiveFax\x20');}};Fax[_0x4b3c('0x28')]['syncOriginateResponse']=function(_0x18d6f3){if(this['actions'][_0x18d6f3[_0x4b3c('0x24')]]){_[_0x4b3c('0x40')](this[_0x4b3c('0xb')][_0x18d6f3[_0x4b3c('0x24')]],_[_0x4b3c('0x41')](_0x18d6f3,[_0x4b3c('0x42'),_0x4b3c('0x43')]));}};function updateStatus(_0x1a8e89){if(_0x1a8e89[_0x4b3c('0x44')]){faxMessage[_0x4b3c('0x45')](_0x1a8e89[_0x4b3c('0x44')],{'failMessage':_0x4b3c('0x46')})[_0x4b3c('0x38')](function(_0x58ea78){ut[_0x4b3c('0x47')](_0x4b3c('0x48'),_0x58ea78);})[_0x4b3c('0x3b')](function(_0x3ce162){ut[_0x4b3c('0x47')](_0x4b3c('0x49'),_0x3ce162);});}else{ut[_0x4b3c('0x47')](_0x4b3c('0x4a'));}}Fax[_0x4b3c('0x28')]['updateStatus']=function(_0x213334,_0x3b1b25,_0x5236ec){var _0x486680=this;var _0x37136b={};if(_0x3b1b25){_0x37136b={'read':_0x3b1b25};}else{_0x37136b={'failMessage':_0x5236ec};}if(this['actions'][_0x213334]['AttachmentId']){faxMessage[_0x4b3c('0x45')](this[_0x4b3c('0xe')][_0x213334][_0x4b3c('0x44')],_0x37136b)[_0x4b3c('0x38')](function(_0x3a6426){ut[_0x4b3c('0x47')](_0x4b3c('0x4b'),_0x3a6426);})[_0x4b3c('0x3b')](function(_0x3c36a5){ut[_0x4b3c('0x47')](_0x4b3c('0x4c'),_0x3c36a5);})[_0x4b3c('0x4d')](function(){delete _0x486680[_0x4b3c('0xb')][_0x213334];delete _0x486680[_0x4b3c('0xe')][_0x213334];});}else{ut[_0x4b3c('0x47')](_0x4b3c('0x4e'));delete this['channels'][_0x213334];delete this[_0x4b3c('0xe')][_0x213334];}};Fax[_0x4b3c('0x28')]['syncHangup']=function(_0x4bace5){var _0xb7f24d=this;if(this[_0x4b3c('0xb')][_0x4bace5[_0x4b3c('0x24')]]){if(this[_0x4b3c('0xe')][_0x4bace5[_0x4b3c('0x24')]]){this['channels'][_0x4bace5['uniqueid']]['id']=this['actions'][_0x4bace5['uniqueid']]['id'];this['channels'][_0x4bace5[_0x4b3c('0x24')]][_0x4b3c('0x26')]=this[_0x4b3c('0xe')][_0x4bace5[_0x4b3c('0x24')]][_0x4b3c('0x26')];}logger['info'](_0x4bace5['uniqueid'],this['actions'][_0x4bace5[_0x4b3c('0x24')]]?'\x20hangup\x20sendFile\x20':_0x4b3c('0x4f'),JSON[_0x4b3c('0x3d')](this[_0x4b3c('0xb')][_0x4bace5['uniqueid']]));if(this['actions'][_0x4bace5[_0x4b3c('0x24')]]){if(this[_0x4b3c('0xb')][_0x4bace5['uniqueid']][_0x4b3c('0x50')]>0x0&&this[_0x4b3c('0xb')][_0x4bace5[_0x4b3c('0x24')]][_0x4b3c('0x16')]===_0x4b3c('0x51')){this[_0x4b3c('0x52')](_0x4bace5[_0x4b3c('0x24')],!![]);}else{this[_0x4b3c('0x52')](_0x4bace5[_0x4b3c('0x24')],![],this[_0x4b3c('0xb')][_0x4bace5[_0x4b3c('0x24')]][_0x4b3c('0x53')]?_0x4b3c('0x54')+this[_0x4b3c('0xb')][_0x4bace5['uniqueid']][_0x4b3c('0x53')]:_0x4b3c('0x55'));}}}};Fax['prototype']['send']=function(_0x3f2f58){var _0x522ef2=this;return new BPromise(function(_0x3cfa63,_0x1d9bdd){_0x522ef2[_0x4b3c('0x56')](_0x3f2f58,_0x522ef2[_0x4b3c('0xc')][_0x3f2f58[_0x4b3c('0x57')]])[_0x4b3c('0x38')](function(_0x44483e){ut[_0x4b3c('0x47')](_0x4b3c('0x58'),_0x44483e);_0x3cfa63(ut[_0x4b3c('0x34')](_0x4b3c('0x59')));})['catch'](function(_0x570b28){ut['logger'](_0x4b3c('0x5a'),_0x570b28);updateStatus(_0x3f2f58);_0x1d9bdd(ut[_0x4b3c('0x34')](_0x4b3c('0x5b')));});});};Fax['prototype'][_0x4b3c('0x5c')]=function(_0x3f4f84){var _0x41ce6b=this;return new BPromise(function(_0x303e6e,_0x91a4a1){var _0x59fce8=_0x41ce6b['checkTrunk'](_0x41ce6b[_0x4b3c('0xc')][_0x3f4f84[_0x4b3c('0x57')]][_0x4b3c('0x5d')],_0x3f4f84);if(_0x59fce8[_0x4b3c('0x5e')]){_0x303e6e(ut[_0x4b3c('0x34')]('Trunk\x20Reachable'));}else{_0x91a4a1(ut[_0x4b3c('0x34')](_0x59fce8[_0x4b3c('0x34')]));}});};function originate(_0x3bcfd6,_0x523b35,_0x3f858a){return new BPromise(function(_0x57d3f9,_0x45399b){if(_0x3f858a){var _0x462832=util[_0x4b3c('0x5f')](_0x4b3c('0x60'),path['parse'](_0x3bcfd6[_0x4b3c('0x61')])[_0x4b3c('0x26')],_0x3bcfd6[_0x4b3c('0x61')]);gs[_0x4b3c('0x62')](_0x462832)[_0x4b3c('0x38')](function(){_0x3bcfd6[_0x4b3c('0x61')]=util[_0x4b3c('0x5f')](_0x4b3c('0x63'),path[_0x4b3c('0x35')](_0x3bcfd6[_0x4b3c('0x61')])[_0x4b3c('0x64')],path['parse'](_0x3bcfd6[_0x4b3c('0x61')])[_0x4b3c('0x26')]);_0x523b35[_0x4b3c('0x65')]=_0x3bcfd6[_0x4b3c('0x61')];ut['logger'](_0x4b3c('0x66'),'');ami[_0x4b3c('0x67')](ut[_0x4b3c('0x68')](_0x3bcfd6,_0x523b35))[_0x4b3c('0x38')](function(_0x37c0ef){_0x57d3f9(_0x37c0ef);})[_0x4b3c('0x3b')](function(_0x10c0d7){_0x45399b(_0x10c0d7);});})[_0x4b3c('0x3b')](function(_0x197a72){_0x45399b(_0x197a72);});}else{ami[_0x4b3c('0x67')](ut[_0x4b3c('0x68')](_0x3bcfd6,_0x523b35))[_0x4b3c('0x38')](function(_0x57270b){_0x57d3f9(_0x57270b);})['catch'](function(_0x520553){_0x45399b(_0x520553);});}});}Fax[_0x4b3c('0x28')]['execOriginate']=function(_0x230bbe,_0x1bb843){var _0xba579f=this;return new BPromise(function(_0x3308a6,_0x23a0b5){var _0x371769=uuid['v4']();var _0x1f3a72=ut['addVariables'](_0x230bbe,_0x1bb843);_0xba579f[_0x4b3c('0xe')][_0x371769]=new Action(_0x371769,_0x1bb843,_0x230bbe);var _0x3db7f6=_0xba579f[_0x4b3c('0xe')][_0x371769];if(path[_0x4b3c('0x35')](_0x230bbe[_0x4b3c('0x61')])['ext']==='.pdf'){originate(_0x3db7f6,_0x1f3a72,!![])[_0x4b3c('0x38')](function(_0x2e1eaf){_0x3308a6(_0x2e1eaf);})['catch'](function(_0x35e0b6){_0x23a0b5(_0x35e0b6);});}else{originate(_0x3db7f6,_0x1f3a72,![])[_0x4b3c('0x38')](function(_0xb551e3){_0x3308a6(_0xb551e3);})[_0x4b3c('0x3b')](function(_0xb7075c){_0x23a0b5(_0xb7075c);});}});};Fax[_0x4b3c('0x28')][_0x4b3c('0x69')]=function(_0x398565){return!_['isNil'](_0x398565)&&!_[_0x4b3c('0x6a')](_0x398565[_0x4b3c('0x26')])&&!_[_0x4b3c('0x6a')](_0x398565['active'])&&_0x398565[_0x4b3c('0x6b')]&&!_[_0x4b3c('0x6a')](this['trunks'][util['format']('SIP/%s',_0x398565[_0x4b3c('0x26')])])&&!_[_0x4b3c('0x6a')](this[_0x4b3c('0xd')][util[_0x4b3c('0x5f')](_0x4b3c('0x6c'),_0x398565[_0x4b3c('0x26')])][_0x4b3c('0x2c')])&&(this['trunks'][util[_0x4b3c('0x5f')](_0x4b3c('0x6c'),_0x398565['name'])][_0x4b3c('0x2c')]===_0x4b3c('0x6d')||this['trunks'][util['format']('SIP/%s',_0x398565[_0x4b3c('0x26')])][_0x4b3c('0x2c')]===_0x4b3c('0x6e'));};Fax[_0x4b3c('0x28')]['checkTrunk']=function(_0x38567b,_0x189f21){if(!this[_0x4b3c('0x69')](_0x38567b)){ut['logger'](_0x4b3c('0x6f'),_[_0x4b3c('0x6a')](_0x38567b)?'':_0x38567b[_0x4b3c('0x26')]+_0x4b3c('0x70'));return{'isValid':![],'message':_0x4b3c('0x71')};}if(_[_0x4b3c('0x6a')](_0x189f21['fax'])){ut[_0x4b3c('0x47')](_0x4b3c('0x72'),JSON[_0x4b3c('0x3d')](_0x189f21));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x4b3c('0x6a')](_0x189f21[_0x4b3c('0x61')])){ut[_0x4b3c('0x47')](_0x4b3c('0x73'),JSON[_0x4b3c('0x3d')](_0x189f21));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x4b3c('0x74')};};module['exports']=Fax; \ No newline at end of file +var _0xb4f9=['calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','faxstatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','message','Fax\x20received','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','status','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','bind','syncVarSet','newstate','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','from-voip-provider','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','syncNewState','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate'];(function(_0x13a900,_0x43b7be){var _0x5e613d=function(_0x5ccf09){while(--_0x5ccf09){_0x13a900['push'](_0x13a900['shift']());}};_0x5e613d(++_0x43b7be);}(_0xb4f9,0x19c));var _0x9b4f=function(_0x32d9fe,_0x213473){_0x32d9fe=_0x32d9fe-0x0;var _0x1b8f8e=_0xb4f9[_0x32d9fe];return _0x1b8f8e;};'use strict';var util=require(_0x9b4f('0x0'));var _=require(_0x9b4f('0x1'));var BPromise=require('bluebird');var uuid=require(_0x9b4f('0x2'));var moment=require(_0x9b4f('0x3'));var path=require('path');var tiff2pdf=require(_0x9b4f('0x4'));var gs=require(_0x9b4f('0x5'));var logger=require(_0x9b4f('0x6'))(_0x9b4f('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x9b4f('0x8'));var ut=require(_0x9b4f('0x9'));var Action=require(_0x9b4f('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x9b4f('0xb'));var faxMessage=require(_0x9b4f('0xc'));function Fax(_0x1e063a){this[_0x9b4f('0xd')]={};this[_0x9b4f('0xe')]=_0x1e063a[_0x9b4f('0xe')];this['trunks']=_0x1e063a[_0x9b4f('0xf')];this[_0x9b4f('0x10')]={};ami['on']('newchannel',this['syncNewchannel'][_0x9b4f('0x11')](this));ami['on']('varset',this[_0x9b4f('0x12')][_0x9b4f('0x11')](this));ami['on'](_0x9b4f('0x13'),this['syncNewState'][_0x9b4f('0x11')](this));ami['on']('newexten',this[_0x9b4f('0x14')]['bind'](this));ami['on']('faxstatus',this[_0x9b4f('0x15')][_0x9b4f('0x11')](this));ami['on'](_0x9b4f('0x16'),this[_0x9b4f('0x17')][_0x9b4f('0x11')](this));ami['on'](_0x9b4f('0x18'),this[_0x9b4f('0x19')][_0x9b4f('0x11')](this));ami['on'](_0x9b4f('0x1a'),this['syncOriginateResponse'][_0x9b4f('0x11')](this));}Fax[_0x9b4f('0x1b')]['syncNewchannel']=function(_0x55a1ad){if(_0x55a1ad['context']===_0x9b4f('0x1c')){for(var _0x55cc8c in this[_0x9b4f('0xe')]){if(this[_0x9b4f('0xe')]['hasOwnProperty'](_0x55cc8c)){if(_0x55a1ad['exten']===this[_0x9b4f('0xe')][_0x55cc8c][_0x9b4f('0x1d')]){this['channels'][_0x55a1ad[_0x9b4f('0x1e')]]={};this[_0x9b4f('0xd')][_0x55a1ad['uniqueid']][_0x9b4f('0x1f')]=_0x55a1ad[_0x9b4f('0x1f')];this[_0x9b4f('0xd')][_0x55a1ad[_0x9b4f('0x1e')]]['id']=this[_0x9b4f('0xe')][_0x55cc8c]['id'];this[_0x9b4f('0xd')][_0x55a1ad[_0x9b4f('0x1e')]][_0x9b4f('0x20')]=this[_0x9b4f('0xe')][_0x55cc8c]['name'];logger[_0x9b4f('0x21')](_0x55a1ad[_0x9b4f('0x1e')],_0x9b4f('0x22'));}}}}if(this[_0x9b4f('0x10')][_0x55a1ad[_0x9b4f('0x1e')]]){this[_0x9b4f('0xd')][_0x55a1ad[_0x9b4f('0x1e')]]={};this['channels'][_0x55a1ad[_0x9b4f('0x1e')]][_0x9b4f('0x1f')]=_0x55a1ad[_0x9b4f('0x1f')];logger[_0x9b4f('0x21')](_0x55a1ad[_0x9b4f('0x1e')],_0x9b4f('0x22'));}};Fax[_0x9b4f('0x1b')][_0x9b4f('0x12')]=function(_0x2fcf8e){if(this[_0x9b4f('0xd')][_0x2fcf8e[_0x9b4f('0x1e')]]){for(var _0x26bd5b in _0x2fcf8e[_0x9b4f('0x23')]){if(_0x2fcf8e['variable'][_0x9b4f('0x24')](_0x26bd5b)){this[_0x9b4f('0xd')][_0x2fcf8e[_0x9b4f('0x1e')]][_0x26bd5b]=_0x2fcf8e[_0x9b4f('0x25')];}}}};Fax[_0x9b4f('0x1b')][_0x9b4f('0x26')]=function(_0x434c9f){if(this[_0x9b4f('0xd')][_0x434c9f['uniqueid']]){this[_0x9b4f('0xd')][_0x434c9f[_0x9b4f('0x1e')]][_0x9b4f('0x27')]=_0x434c9f['channelstate'];this['channels'][_0x434c9f[_0x9b4f('0x1e')]]['channelstatedesc']=_0x434c9f[_0x9b4f('0x28')];}};Fax[_0x9b4f('0x1b')][_0x9b4f('0x14')]=function(_0x592c8a){if(this[_0x9b4f('0xd')][_0x592c8a['uniqueid']]){for(var _0x570b55 in _0x592c8a['variable']){if(_0x592c8a['variable']['hasOwnProperty'](_0x570b55)){this[_0x9b4f('0xd')][_0x592c8a['uniqueid']][_0x570b55]=_0x592c8a['value'];}}}};Fax[_0x9b4f('0x1b')]['syncFaxStatus']=function(_0x98e379){if(this[_0x9b4f('0xd')][_0x98e379[_0x9b4f('0x1e')]]){this['channels'][_0x98e379['uniqueid']]['operation']=_0x98e379[_0x9b4f('0x29')];this[_0x9b4f('0xd')][_0x98e379[_0x9b4f('0x1e')]]['status']=_0x98e379['status'];this['channels'][_0x98e379['uniqueid']]['localstationid']=_0x98e379['localstationid'];this[_0x9b4f('0xd')][_0x98e379[_0x9b4f('0x1e')]][_0x9b4f('0x2a')]=_0x98e379[_0x9b4f('0x2a')];logger[_0x9b4f('0x21')](_0x98e379[_0x9b4f('0x1e')],_0x9b4f('0x2b'));}};Fax[_0x9b4f('0x1b')]['syncReceiveFax']=function(_0x23d38b){var _0x2c0da0=this;if(this['channels'][_0x23d38b[_0x9b4f('0x1e')]]){var _0x2965d2=this[_0x9b4f('0xd')][_0x23d38b[_0x9b4f('0x1e')]]['id'];this[_0x9b4f('0xd')][_0x23d38b[_0x9b4f('0x1e')]]['remotestationid']=_0x23d38b[_0x9b4f('0x2c')];this['channels'][_0x23d38b[_0x9b4f('0x1e')]][_0x9b4f('0x2d')]=_0x23d38b['pagestransferred'];this[_0x9b4f('0xd')][_0x23d38b[_0x9b4f('0x1e')]][_0x9b4f('0x1d')]=_0x23d38b[_0x9b4f('0x1d')];this[_0x9b4f('0xd')][_0x23d38b[_0x9b4f('0x1e')]][_0x9b4f('0x2e')]=_0x23d38b[_0x9b4f('0x2e')];this[_0x9b4f('0xd')][_0x23d38b[_0x9b4f('0x1e')]][_0x9b4f('0x2f')]=_0x23d38b[_0x9b4f('0x2f')];this[_0x9b4f('0xd')][_0x23d38b[_0x9b4f('0x1e')]][_0x9b4f('0x2a')]=_0x23d38b[_0x9b4f('0x2a')];this[_0x9b4f('0xd')][_0x23d38b[_0x9b4f('0x1e')]][_0x9b4f('0x30')]=_0x23d38b[_0x9b4f('0x30')];if(this[_0x9b4f('0xd')][_0x23d38b[_0x9b4f('0x1e')]][_0x9b4f('0x2d')]>0x0){tiff2pdf(_0x23d38b['filename'],_0x9b4f('0x31'),function(_0x5784eb){logger['info'](_0x23d38b[_0x9b4f('0x1e')],_0x9b4f('0x32'),_0x5784eb['message']);attachment[_0x9b4f('0x33')]({'name':path['parse'](_0x23d38b['filename'])['name'],'basename':path[_0x9b4f('0x34')](_0x23d38b[_0x9b4f('0x2a')])[_0x9b4f('0x20')]+_0x9b4f('0x35'),'type':_0x9b4f('0x36')})[_0x9b4f('0x37')](function(_0x1d8bed){faxAccount[_0x9b4f('0x38')](_0x2965d2,{'from':_0x23d38b[_0x9b4f('0x30')],'mapKey':_0x9b4f('0x7'),'body':path[_0x9b4f('0x34')](_0x23d38b[_0x9b4f('0x2a')])['name']+_0x9b4f('0x35'),'AttachmentId':_0x1d8bed['id']})[_0x9b4f('0x39')](function(_0x357e24){logger[_0x9b4f('0x3a')](_0x23d38b[_0x9b4f('0x1e')],_0x9b4f('0x3b'),JSON[_0x9b4f('0x3c')](_0x357e24));});})['catch'](function(_0x5dced8){logger[_0x9b4f('0x3a')](_0x23d38b[_0x9b4f('0x1e')],_0x9b4f('0x3d'),JSON['stringify'](_0x5dced8));});});}logger[_0x9b4f('0x21')](_0x23d38b[_0x9b4f('0x1e')],'\x20receiveFax\x20');}};Fax[_0x9b4f('0x1b')][_0x9b4f('0x3e')]=function(_0x26fb72){if(this[_0x9b4f('0x10')][_0x26fb72[_0x9b4f('0x1e')]]){_['merge'](this['channels'][_0x26fb72[_0x9b4f('0x1e')]],_[_0x9b4f('0x3f')](_0x26fb72,[_0x9b4f('0x40'),_0x9b4f('0x41')]));}};function updateStatus(_0x128db8){if(_0x128db8[_0x9b4f('0x42')]){faxMessage[_0x9b4f('0x43')](_0x128db8[_0x9b4f('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x9b4f('0x37')](function(_0x26e843){ut[_0x9b4f('0x44')](_0x9b4f('0x45'),_0x26e843);})['catch'](function(_0x23e4c7){ut[_0x9b4f('0x44')]('[Fax][Message][Error][NoUpdate1]',_0x23e4c7);});}else{ut[_0x9b4f('0x44')](_0x9b4f('0x46'));}}Fax[_0x9b4f('0x1b')][_0x9b4f('0x47')]=function(_0xaefb4c,_0x499052,_0x733be0){var _0x4203b8=this;var _0x3022d0={};if(_0x499052){_0x3022d0={'read':_0x499052};}else{_0x3022d0={'failMessage':_0x733be0};}if(this[_0x9b4f('0x10')][_0xaefb4c][_0x9b4f('0x42')]){faxMessage[_0x9b4f('0x43')](this[_0x9b4f('0x10')][_0xaefb4c]['AttachmentId'],_0x3022d0)[_0x9b4f('0x37')](function(_0x586428){ut[_0x9b4f('0x44')](_0x9b4f('0x48'),_0x586428);})[_0x9b4f('0x39')](function(_0x12dae9){ut['logger'](_0x9b4f('0x49'),_0x12dae9);})[_0x9b4f('0x4a')](function(){delete _0x4203b8[_0x9b4f('0xd')][_0xaefb4c];delete _0x4203b8[_0x9b4f('0x10')][_0xaefb4c];});}else{ut[_0x9b4f('0x44')](_0x9b4f('0x4b'));delete this[_0x9b4f('0xd')][_0xaefb4c];delete this['actions'][_0xaefb4c];}};Fax[_0x9b4f('0x1b')][_0x9b4f('0x19')]=function(_0x5b63f7){var _0x288282=this;if(this['channels'][_0x5b63f7['uniqueid']]){if(this[_0x9b4f('0x10')][_0x5b63f7[_0x9b4f('0x1e')]]){this[_0x9b4f('0xd')][_0x5b63f7[_0x9b4f('0x1e')]]['id']=this['actions'][_0x5b63f7['uniqueid']]['id'];this['channels'][_0x5b63f7[_0x9b4f('0x1e')]][_0x9b4f('0x20')]=this[_0x9b4f('0x10')][_0x5b63f7[_0x9b4f('0x1e')]]['name'];}logger['info'](_0x5b63f7[_0x9b4f('0x1e')],this[_0x9b4f('0x10')][_0x5b63f7['uniqueid']]?_0x9b4f('0x4c'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this['channels'][_0x5b63f7[_0x9b4f('0x1e')]]));if(this['actions'][_0x5b63f7[_0x9b4f('0x1e')]]){if(this['channels'][_0x5b63f7[_0x9b4f('0x1e')]][_0x9b4f('0x4d')]>0x0&&this[_0x9b4f('0xd')][_0x5b63f7['uniqueid']][_0x9b4f('0x4e')]==='SUCCESS'){this[_0x9b4f('0x47')](_0x5b63f7[_0x9b4f('0x1e')],!![]);}else{this[_0x9b4f('0x47')](_0x5b63f7['uniqueid'],![],this[_0x9b4f('0xd')][_0x5b63f7['uniqueid']][_0x9b4f('0x4f')]?_0x9b4f('0x50')+this[_0x9b4f('0xd')][_0x5b63f7[_0x9b4f('0x1e')]][_0x9b4f('0x4f')]:_0x9b4f('0x51'));}}}};Fax[_0x9b4f('0x1b')][_0x9b4f('0x52')]=function(_0x3ed6f8){var _0x5d55e7=this;return new BPromise(function(_0x3f84e3,_0x3d76f6){_0x5d55e7[_0x9b4f('0x53')](_0x3ed6f8,_0x5d55e7[_0x9b4f('0xe')][_0x3ed6f8[_0x9b4f('0x54')]])[_0x9b4f('0x37')](function(_0x2c004a){ut['logger']('[Fax][execOriginate][success]',_0x2c004a);_0x3f84e3(ut[_0x9b4f('0x55')](_0x9b4f('0x56')));})[_0x9b4f('0x39')](function(_0x37c468){ut['logger']('[Fax][execOriginate][failure]',_0x37c468);updateStatus(_0x3ed6f8);_0x3d76f6(ut[_0x9b4f('0x55')]('Fax\x20failed'));});});};Fax['prototype'][_0x9b4f('0x57')]=function(_0x3f2d39){var _0x2ff51=this;return new BPromise(function(_0x312c97,_0x4ff814){var _0x236ee9=_0x2ff51[_0x9b4f('0x58')](_0x2ff51['faxAccounts'][_0x3f2d39[_0x9b4f('0x54')]][_0x9b4f('0x59')],_0x3f2d39);if(_0x236ee9[_0x9b4f('0x5a')]){_0x312c97(ut[_0x9b4f('0x55')](_0x9b4f('0x5b')));}else{_0x4ff814(ut['message'](_0x236ee9[_0x9b4f('0x55')]));}});};function originate(_0x86641f,_0x49c357,_0x2d3003){return new BPromise(function(_0x395861,_0x29f7e4){if(_0x2d3003){var _0x4fb65e=util[_0x9b4f('0x5c')](_0x9b4f('0x5d'),path[_0x9b4f('0x34')](_0x86641f[_0x9b4f('0x5e')])[_0x9b4f('0x20')],_0x86641f[_0x9b4f('0x5e')]);gs[_0x9b4f('0x5f')](_0x4fb65e)['then'](function(){_0x86641f[_0x9b4f('0x5e')]=util[_0x9b4f('0x5c')](_0x9b4f('0x60'),path[_0x9b4f('0x34')](_0x86641f[_0x9b4f('0x5e')])[_0x9b4f('0x61')],path['parse'](_0x86641f[_0x9b4f('0x5e')])[_0x9b4f('0x20')]);_0x49c357['XMF-PATH']=_0x86641f[_0x9b4f('0x5e')];ut[_0x9b4f('0x44')](_0x9b4f('0x62'),'');ami[_0x9b4f('0x63')](ut[_0x9b4f('0x64')](_0x86641f,_0x49c357))[_0x9b4f('0x37')](function(_0x40420e){_0x395861(_0x40420e);})[_0x9b4f('0x39')](function(_0x835502){_0x29f7e4(_0x835502);});})[_0x9b4f('0x39')](function(_0x51d0f8){_0x29f7e4(_0x51d0f8);});}else{ami[_0x9b4f('0x63')](ut[_0x9b4f('0x64')](_0x86641f,_0x49c357))[_0x9b4f('0x37')](function(_0x971f6){_0x395861(_0x971f6);})['catch'](function(_0x27c136){_0x29f7e4(_0x27c136);});}});}Fax[_0x9b4f('0x1b')][_0x9b4f('0x53')]=function(_0x2dd208,_0x34c2d1){var _0x348eaf=this;return new BPromise(function(_0x191d5f,_0x3e5d2e){var _0x49bf28=uuid['v4']();var _0x226cd2=ut['addVariables'](_0x2dd208,_0x34c2d1);_0x348eaf[_0x9b4f('0x10')][_0x49bf28]=new Action(_0x49bf28,_0x34c2d1,_0x2dd208);var _0xa2f9b0=_0x348eaf[_0x9b4f('0x10')][_0x49bf28];if(path[_0x9b4f('0x34')](_0x2dd208[_0x9b4f('0x5e')])[_0x9b4f('0x65')]===_0x9b4f('0x35')){originate(_0xa2f9b0,_0x226cd2,!![])[_0x9b4f('0x37')](function(_0x37ec6f){_0x191d5f(_0x37ec6f);})[_0x9b4f('0x39')](function(_0x55451c){_0x3e5d2e(_0x55451c);});}else{originate(_0xa2f9b0,_0x226cd2,![])[_0x9b4f('0x37')](function(_0x4cefda){_0x191d5f(_0x4cefda);})['catch'](function(_0xd612de){_0x3e5d2e(_0xd612de);});}});};Fax[_0x9b4f('0x1b')][_0x9b4f('0x66')]=function(_0x456c61){return!_[_0x9b4f('0x67')](_0x456c61)&&!_[_0x9b4f('0x67')](_0x456c61[_0x9b4f('0x20')])&&!_['isNil'](_0x456c61[_0x9b4f('0x68')])&&_0x456c61[_0x9b4f('0x68')]&&!_['isNil'](this[_0x9b4f('0xf')][util[_0x9b4f('0x5c')](_0x9b4f('0x69'),_0x456c61[_0x9b4f('0x20')])])&&!_[_0x9b4f('0x67')](this['trunks'][util['format'](_0x9b4f('0x69'),_0x456c61[_0x9b4f('0x20')])][_0x9b4f('0x6a')])&&(this[_0x9b4f('0xf')][util['format'](_0x9b4f('0x69'),_0x456c61[_0x9b4f('0x20')])][_0x9b4f('0x6a')]===_0x9b4f('0x6b')||this[_0x9b4f('0xf')][util[_0x9b4f('0x5c')]('SIP/%s',_0x456c61[_0x9b4f('0x20')])][_0x9b4f('0x6a')]===_0x9b4f('0x6c'));};Fax['prototype'][_0x9b4f('0x58')]=function(_0x4244cf,_0x20c240){if(!this[_0x9b4f('0x66')](_0x4244cf)){ut['logger'](_0x9b4f('0x6d'),_[_0x9b4f('0x67')](_0x4244cf)?'':_0x4244cf[_0x9b4f('0x20')]+_0x9b4f('0x6e'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x9b4f('0x67')](_0x20c240[_0x9b4f('0x7')])){ut[_0x9b4f('0x44')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x9b4f('0x3c')](_0x20c240));return{'isValid':![],'message':_0x9b4f('0x6f')};}if(_['isNil'](_0x20c240[_0x9b4f('0x5e')])){ut[_0x9b4f('0x44')](_0x9b4f('0x70'),JSON['stringify'](_0x20c240));return{'isValid':![],'message':_0x9b4f('0x71')};}return{'isValid':!![],'message':_0x9b4f('0x72')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 5376848..81073c4 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 _0xde9e=['error','inspect','notify','resolve','then','catch','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0xde9e,0x96));var _0xede9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde9e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xede9('0x0'));var BPromise=require(_0xede9('0x1'));var logger=require(_0xede9('0x2'))(_0xede9('0x3'));var _=require(_0xede9('0x4'));var faxAccount=require(_0xede9('0x5'));function loggerCatch(_0x42e38c){return function(_0x3d3aa7){logger[_0xede9('0x6')](_0x42e38c,util[_0xede9('0x7')](_0x3d3aa7,{'showHidden':![],'depth':null}));};}exports[_0xede9('0x8')]=function(_0x283cd3,_0x437ced){return BPromise[_0xede9('0x9')]()[_0xede9('0xa')](faxAccount['notify'](_0x283cd3,_0x437ced))[_0xede9('0xb')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x0266=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve','catch','[Notify]\x20','util','bluebird'];(function(_0x5b9581,_0x483755){var _0x5c300c=function(_0x4eb134){while(--_0x4eb134){_0x5b9581['push'](_0x5b9581['shift']());}};_0x5c300c(++_0x483755);}(_0x0266,0x1ab));var _0x6026=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x0266[_0x4792c8];return _0x35edb1;};'use strict';var util=require(_0x6026('0x0'));var BPromise=require(_0x6026('0x1'));var logger=require(_0x6026('0x2'))(_0x6026('0x3'));var _=require(_0x6026('0x4'));var faxAccount=require(_0x6026('0x5'));function loggerCatch(_0x61597a){return function(_0x279f2a){logger[_0x6026('0x6')](_0x61597a,util[_0x6026('0x7')](_0x279f2a,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x5d6000,_0x487757){return BPromise[_0x6026('0x8')]()['then'](faxAccount['notify'](_0x5d6000,_0x487757))[_0x6026('0x9')](loggerCatch(_0x6026('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 a31e097..05f90c3 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 _0xa107=['inspect','../../../../config/logger','fax','child_process','exec','execute','Exec\x20gs','\x20Error\x20:'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0xa107,0x1d9));var _0x7a10=function(_0x4091d8,_0x489b3e){_0x4091d8=_0x4091d8-0x0;var _0x2bf27e=_0xa107[_0x4091d8];return _0x2bf27e;};'use strict';var util=require('util');var logger=require(_0x7a10('0x0'))(_0x7a10('0x1'));var BPromise=require('bluebird');var exec=require(_0x7a10('0x2'))[_0x7a10('0x3')];exports[_0x7a10('0x4')]=function(_0x268913){return new BPromise(function(_0x44c9d3,_0xb5e345){exec(_0x268913,function(_0x4a81ad,_0x501cf2,_0x462106){logger['info'](_0x7a10('0x5'),_0x501cf2);if(_0x4a81ad){logger['info'](_0x7a10('0x5'),_0x7a10('0x6'),util[_0x7a10('0x7')](_0x4a81ad,{'showHidden':![],'depth':null}),_0x501cf2,_0x462106);_0xb5e345(_0x4a81ad);}_0x44c9d3(_0x501cf2);});});}; \ No newline at end of file +var _0xd324=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','exec','execute','info','Exec\x20gs'];(function(_0x13fdb3,_0x493557){var _0x212e46=function(_0x47b3e0){while(--_0x47b3e0){_0x13fdb3['push'](_0x13fdb3['shift']());}};_0x212e46(++_0x493557);}(_0xd324,0x124));var _0x4d32=function(_0x31ddba,_0x28ec26){_0x31ddba=_0x31ddba-0x0;var _0x3f014c=_0xd324[_0x31ddba];return _0x3f014c;};'use strict';var util=require(_0x4d32('0x0'));var logger=require(_0x4d32('0x1'))(_0x4d32('0x2'));var BPromise=require(_0x4d32('0x3'));var exec=require('child_process')[_0x4d32('0x4')];exports[_0x4d32('0x5')]=function(_0x34cfb2){return new BPromise(function(_0x279397,_0x5b1ce2){exec(_0x34cfb2,function(_0x1b1c91,_0x384c57,_0x34494e){logger[_0x4d32('0x6')]('Exec\x20gs',_0x384c57);if(_0x1b1c91){logger['info'](_0x4d32('0x7'),_0x4d32('0x8'),util[_0x4d32('0x9')](_0x1b1c91,{'showHidden':![],'depth':null}),_0x384c57,_0x34494e);_0x5b1ce2(_0x1b1c91);}_0x279397(_0x384c57);});});}; \ 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 dfb307a..a39cb8c 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 _0xba8c=['util','lodash','moment','fax','message','logger','info','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','t38timeout','path','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','localstationid'];(function(_0x25b528,_0x19be4a){var _0x412487=function(_0x381cbd){while(--_0x381cbd){_0x25b528['push'](_0x25b528['shift']());}};_0x412487(++_0x19be4a);}(_0xba8c,0x1b8));var _0xcba8=function(_0x19c849,_0x457f40){_0x19c849=_0x19c849-0x0;var _0x34f2c8=_0xba8c[_0x19c849];return _0x34f2c8;};'use strict';var util=require(_0xcba8('0x0'));var _=require(_0xcba8('0x1'));var moment=require(_0xcba8('0x2'));var logger=require('../../../../config/logger')(_0xcba8('0x3'));exports[_0xcba8('0x4')]=function(_0x4a02d5){return{'message':_0x4a02d5};};exports[_0xcba8('0x5')]=function(_0x485ce5,_0x469494){logger[_0xcba8('0x6')](_0x485ce5,util['inspect'](_0x469494,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x260fc0,_0x2bfb8e){var _0x53e68f={'XMF-ECM':_0x2bfb8e[_0xcba8('0x7')],'XMF-HEADERINFO':_0x2bfb8e[_0xcba8('0x8')],'XMF-MINRATE':_0x2bfb8e[_0xcba8('0x9')],'XMF-MAXRATE':_0x2bfb8e[_0xcba8('0xa')],'XMF-MODEM':util[_0xcba8('0xb')](_0xcba8('0xc'),_0x2bfb8e[_0xcba8('0xd')]),'XMF-GATEWAY':_0x2bfb8e['gateway'],'XMF-FAXDETECT':_0x2bfb8e['faxdetect'],'XMF-T38TIMEOUT':_0x2bfb8e[_0xcba8('0xe')],'XMF-LOCALSTATIONID':_0x2bfb8e['localstationid'],'XMF-PATH':_0x260fc0[_0xcba8('0xf')]};return _0x53e68f;};exports[_0xcba8('0x10')]=function(_0x5eb794,_0x6ba9d2){return{'actionid':_0x5eb794[_0xcba8('0x11')],'action':'originate','channel':_0x5eb794[_0xcba8('0x12')],'Exten':_0xcba8('0x13'),'Context':_0xcba8('0x14'),'Priority':'1','callerid':util[_0xcba8('0xb')]('\x22%s\x22\x20<%s>',_0x5eb794[_0xcba8('0x8')]?_0x5eb794[_0xcba8('0x8')]:'',_0x5eb794[_0xcba8('0x15')]),'variable':_0x6ba9d2,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5eb794['uniqueid']};}; \ No newline at end of file +var _0x6cfb=['headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','format','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','../../../../config/logger','logger','info','inspect','addVariables'];(function(_0x20ceb5,_0x5ed3ba){var _0x37ca60=function(_0x2be3ad){while(--_0x2be3ad){_0x20ceb5['push'](_0x20ceb5['shift']());}};_0x37ca60(++_0x5ed3ba);}(_0x6cfb,0x130));var _0xb6cf=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x6cfb[_0x14e27a];return _0x288688;};'use strict';var util=require(_0xb6cf('0x0'));var _=require(_0xb6cf('0x1'));var moment=require(_0xb6cf('0x2'));var logger=require(_0xb6cf('0x3'))('fax');exports['message']=function(_0xd6999c){return{'message':_0xd6999c};};exports[_0xb6cf('0x4')]=function(_0x5d59f0,_0x41780e){logger[_0xb6cf('0x5')](_0x5d59f0,util[_0xb6cf('0x6')](_0x41780e,{'showHidden':![],'depth':null}));};exports[_0xb6cf('0x7')]=function(_0xa63f82,_0xa13883){var _0x5204ab={'XMF-ECM':_0xa13883['ecm'],'XMF-HEADERINFO':_0xa13883[_0xb6cf('0x8')],'XMF-MINRATE':_0xa13883[_0xb6cf('0x9')],'XMF-MAXRATE':_0xa13883[_0xb6cf('0xa')],'XMF-MODEM':util['format'](_0xb6cf('0xb'),_0xa13883[_0xb6cf('0xc')]),'XMF-GATEWAY':_0xa13883[_0xb6cf('0xd')],'XMF-FAXDETECT':_0xa13883['faxdetect'],'XMF-T38TIMEOUT':_0xa13883[_0xb6cf('0xe')],'XMF-LOCALSTATIONID':_0xa13883[_0xb6cf('0xf')],'XMF-PATH':_0xa63f82[_0xb6cf('0x10')]};return _0x5204ab;};exports[_0xb6cf('0x11')]=function(_0x370882,_0x38378b){return{'actionid':_0x370882['uniqueid'],'action':_0xb6cf('0x12'),'channel':_0x370882[_0xb6cf('0x13')],'Exten':_0xb6cf('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0xb6cf('0x15')](_0xb6cf('0x16'),_0x370882[_0xb6cf('0x8')]?_0x370882[_0xb6cf('0x8')]:'',_0x370882[_0xb6cf('0xf')]),'variable':_0x38378b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x370882[_0xb6cf('0x17')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 6656588..81a2df5 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 _0xb470=['initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','catch','log','listen','sync','bluebird','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','get','resolve','getAgents','then','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts'];(function(_0x5d6644,_0x4658dd){var _0x1f73f8=function(_0x2893f0){while(--_0x2893f0){_0x5d6644['push'](_0x5d6644['shift']());}};_0x1f73f8(++_0x4658dd);}(_0xb470,0x114));var _0x0b47=function(_0x4e60a2,_0x5c8078){_0x4e60a2=_0x4e60a2-0x0;var _0x522c32=_0xb470[_0x4e60a2];return _0x522c32;};'use strict';var BPromise=require(_0x0b47('0x0'));var util=require('util');var moment=require('moment');var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x0b47('0x1'));var Acw=require(_0x0b47('0x2'));var Trigger=require(_0x0b47('0x3'));var Dialer=require(_0x0b47('0x4'));var Preview=require(_0x0b47('0x5'));var Fax=require(_0x0b47('0x6'));var user=require(_0x0b47('0x7'));var voiceQueue=require(_0x0b47('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x0b47('0x9'));var trunk=require(_0x0b47('0xa'));var trigger=require(_0x0b47('0xb'));var template=require(_0x0b47('0xc'));var cmHopperHistory=require(_0x0b47('0xd'));var campaign=require(_0x0b47('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x0b47('0xf'));var zendesk=require(_0x0b47('0x10'));var salesforce=require(_0x0b47('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x0b47('0x12'));var desk=require(_0x0b47('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x0b47('0x14'));var freshsales=require(_0x0b47('0x15'));var servicenow=require(_0x0b47('0x16'));var dynamics365=require(_0x0b47('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x0b47('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0b47('0x19')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0b47('0x1a')]()['then'](user[_0x0b47('0x1b')]())[_0x0b47('0x1c')](realtime[_0x0b47('0x1d')]())['then'](user[_0x0b47('0x1e')]())[_0x0b47('0x1c')](realtime[_0x0b47('0x1f')]())[_0x0b47('0x1c')](trunk['getTrunks']())[_0x0b47('0x1c')](realtime[_0x0b47('0x20')]())['then'](voiceQueue[_0x0b47('0x21')]())[_0x0b47('0x1c')](realtime[_0x0b47('0x22')]())[_0x0b47('0x1c')](trigger[_0x0b47('0x23')]())[_0x0b47('0x1c')](realtime[_0x0b47('0x24')]())[_0x0b47('0x1c')](template['getTemplates']())[_0x0b47('0x1c')](realtime[_0x0b47('0x25')]())[_0x0b47('0x1c')](zendesk[_0x0b47('0x26')]())[_0x0b47('0x1c')](realtime[_0x0b47('0x27')]())['then'](salesforce[_0x0b47('0x28')]())[_0x0b47('0x1c')](realtime[_0x0b47('0x29')]())[_0x0b47('0x1c')](sugarcrm[_0x0b47('0x2a')]())[_0x0b47('0x1c')](realtime[_0x0b47('0x2b')]())[_0x0b47('0x1c')](freshdesk[_0x0b47('0x2c')]())[_0x0b47('0x1c')](realtime['initFreshdeskAccounts']())[_0x0b47('0x1c')](desk[_0x0b47('0x2d')]())['then'](realtime[_0x0b47('0x2e')]())['then'](zoho[_0x0b47('0x2f')]())[_0x0b47('0x1c')](realtime['initZohoAccounts']())[_0x0b47('0x1c')](vtiger[_0x0b47('0x30')]())[_0x0b47('0x1c')](realtime[_0x0b47('0x31')]())[_0x0b47('0x1c')](freshsales[_0x0b47('0x32')]())['then'](realtime['initFreshsalesAccounts']())[_0x0b47('0x1c')](servicenow[_0x0b47('0x33')]())[_0x0b47('0x1c')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x0b47('0x34')]())[_0x0b47('0x1c')](realtime[_0x0b47('0x35')]())[_0x0b47('0x1c')](campaign[_0x0b47('0x36')]())[_0x0b47('0x1c')](realtime[_0x0b47('0x37')]())[_0x0b47('0x1c')](voiceExtension['getVoiceExtensions']())['then'](realtime['initVoiceExtensions']())[_0x0b47('0x1c')](faxAccount[_0x0b47('0x38')]())[_0x0b47('0x1c')](realtime[_0x0b47('0x39')]())[_0x0b47('0x1c')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x0b47('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0x0b47('0x1c')](realtime['initVoiceQueueReports']())[_0x0b47('0x1c')](cmHopperHistory[_0x0b47('0x3a')]())['then'](realtime[_0x0b47('0x3b')]())[_0x0b47('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0x0b47('0x1c')](realtime[_0x0b47('0x3c')]())[_0x0b47('0x1c')](voiceCallReport['getVoiceCallReports']())['then'](realtime['initVoiceCallReports']())[_0x0b47('0x1c')](function(_0x2f3883){})[_0x0b47('0x3d')](function(_0xe1b2ae){console[_0x0b47('0x3e')](_0xe1b2ae);});}function main(){return server[_0x0b47('0x3f')](realtime,preview,fax)[_0x0b47('0x1c')](function(_0x327858){return initRealtime();})[_0x0b47('0x1c')](function(){return initParams();})['then'](function(){report[_0x0b47('0x40')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x2d5acf){console[_0x0b47('0x3e')](_0x2d5acf);});}main(); \ No newline at end of file +var _0x2549=['./report','./trigger','./dialer','./fax','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/freshsales','hour','get','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','listen','catch','log','bluebird','util','moment','./server','./realtime'];(function(_0x4bdd75,_0x95cd2b){var _0x352303=function(_0x4c25e6){while(--_0x4c25e6){_0x4bdd75['push'](_0x4bdd75['shift']());}};_0x352303(++_0x95cd2b);}(_0x2549,0x181));var _0x9254=function(_0x1ec8d4,_0x193a61){_0x1ec8d4=_0x1ec8d4-0x0;var _0x5d57aa=_0x2549[_0x1ec8d4];return _0x5d57aa;};'use strict';var BPromise=require(_0x9254('0x0'));var util=require(_0x9254('0x1'));var moment=require(_0x9254('0x2'));var server=require(_0x9254('0x3'));var Realtime=require(_0x9254('0x4'));var Report=require(_0x9254('0x5'));var Acw=require('./acw');var Trigger=require(_0x9254('0x6'));var Dialer=require(_0x9254('0x7'));var Preview=require('./preview');var Fax=require(_0x9254('0x8'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x9254('0x9'));var voiceCallReport=require(_0x9254('0xa'));var trunk=require(_0x9254('0xb'));var trigger=require(_0x9254('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0x9254('0xd'));var campaign=require(_0x9254('0xe'));var voiceExtension=require(_0x9254('0xf'));var faxAccount=require(_0x9254('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x9254('0x11'));var sugarcrm=require(_0x9254('0x12'));var freshdesk=require(_0x9254('0x13'));var desk=require(_0x9254('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x9254('0x15'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x9254('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9254('0x17')](_0x9254('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x9254('0x18')]()[_0x9254('0x19')](user['getAgents']())[_0x9254('0x19')](realtime[_0x9254('0x1a')]())['then'](user[_0x9254('0x1b')]())[_0x9254('0x19')](realtime[_0x9254('0x1c')]())[_0x9254('0x19')](trunk[_0x9254('0x1d')]())[_0x9254('0x19')](realtime[_0x9254('0x1e')]())[_0x9254('0x19')](voiceQueue[_0x9254('0x1f')]())[_0x9254('0x19')](realtime[_0x9254('0x20')]())[_0x9254('0x19')](trigger[_0x9254('0x21')]())['then'](realtime[_0x9254('0x22')]())[_0x9254('0x19')](template[_0x9254('0x23')]())[_0x9254('0x19')](realtime[_0x9254('0x24')]())['then'](zendesk[_0x9254('0x25')]())[_0x9254('0x19')](realtime['initZendeskAccounts']())['then'](salesforce['getSalesforceAccounts']())[_0x9254('0x19')](realtime[_0x9254('0x26')]())[_0x9254('0x19')](sugarcrm[_0x9254('0x27')]())[_0x9254('0x19')](realtime[_0x9254('0x28')]())[_0x9254('0x19')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x9254('0x29')]())[_0x9254('0x19')](desk['getDeskAccounts']())[_0x9254('0x19')](realtime[_0x9254('0x2a')]())[_0x9254('0x19')](zoho[_0x9254('0x2b')]())[_0x9254('0x19')](realtime[_0x9254('0x2c')]())[_0x9254('0x19')](vtiger['getVtigerAccounts']())[_0x9254('0x19')](realtime['initVtigerAccounts']())[_0x9254('0x19')](freshsales[_0x9254('0x2d')]())[_0x9254('0x19')](realtime[_0x9254('0x2e')]())[_0x9254('0x19')](servicenow[_0x9254('0x2f')]())[_0x9254('0x19')](realtime[_0x9254('0x30')]())[_0x9254('0x19')](dynamics365[_0x9254('0x31')]())['then'](realtime[_0x9254('0x32')]())[_0x9254('0x19')](campaign[_0x9254('0x33')]())[_0x9254('0x19')](realtime[_0x9254('0x34')]())[_0x9254('0x19')](voiceExtension[_0x9254('0x35')]())[_0x9254('0x19')](realtime['initVoiceExtensions']())[_0x9254('0x19')](faxAccount[_0x9254('0x36')]())['then'](realtime[_0x9254('0x37')]())[_0x9254('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0x9254('0x18')]()[_0x9254('0x19')](voiceQueueReport[_0x9254('0x38')]())[_0x9254('0x19')](realtime[_0x9254('0x39')]())[_0x9254('0x19')](cmHopperHistory[_0x9254('0x3a')]())[_0x9254('0x19')](realtime[_0x9254('0x3b')]())[_0x9254('0x19')](cmHopperHistory[_0x9254('0x3c')]())[_0x9254('0x19')](realtime[_0x9254('0x3d')]())[_0x9254('0x19')](voiceCallReport['getVoiceCallReports']())[_0x9254('0x19')](realtime['initVoiceCallReports']())[_0x9254('0x19')](function(_0x4ec540){})['catch'](function(_0x47e3a0){console['log'](_0x47e3a0);});}function main(){return server[_0x9254('0x3e')](realtime,preview,fax)[_0x9254('0x19')](function(_0x565973){return initRealtime();})[_0x9254('0x19')](function(){return initParams();})[_0x9254('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x9254('0x3f')](function(_0x44ac2b){console[_0x9254('0x40')](_0x44ac2b);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 74f5959..78b4424 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 _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xedd9,0xfc));var _0x9edd=function(_0xf3018d,_0x5bb55c){_0xf3018d=_0xf3018d-0x0;var _0xe217e1=_0xedd9[_0xf3018d];return _0xe217e1;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file +var _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x58dc44,_0xb3dbea){var _0x9f6ddc=function(_0x588697){while(--_0x588697){_0x58dc44['push'](_0x58dc44['shift']());}};_0x9f6ddc(++_0xb3dbea);}(_0x70e0,0x17b));var _0x070e=function(_0x38cf96,_0x2b9072){_0x38cf96=_0x38cf96-0x0;var _0x4b3783=_0x70e0[_0x38cf96];return _0x4b3783;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b7ca7ff..3b174be 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 _0xf8a8=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x123be2,_0x547a9e){var _0x47fd4c=function(_0x133bbb){while(--_0x133bbb){_0x123be2['push'](_0x123be2['shift']());}};_0x47fd4c(++_0x547a9e);}(_0xf8a8,0x1eb));var _0x8f8a=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xf8a8[_0x397cfb];return _0x15fed9;};'use strict';function Campaign(_0x737981){this['id']=_0x737981['id']||0x0;this['name']=_0x737981[_0x8f8a('0x0')]||'';this[_0x8f8a('0x1')]=_0x737981[_0x8f8a('0x1')]||'campaign';this[_0x8f8a('0x2')]=0x0;this[_0x8f8a('0x3')]=0x0;this[_0x8f8a('0x4')]=0x0;this[_0x8f8a('0x5')]=0x0;this[_0x8f8a('0x6')]='';this[_0x8f8a('0x7')]=!![];this[_0x8f8a('0x8')]=_0x737981[_0x8f8a('0x8')];this[_0x8f8a('0x9')]=_0x737981[_0x8f8a('0x9')];this[_0x8f8a('0xa')]=_0x737981[_0x8f8a('0xa')]||null;this[_0x8f8a('0xb')]=_0x737981[_0x8f8a('0xb')]?_0x737981[_0x8f8a('0xb')]:null;this[_0x8f8a('0xc')]=_0x737981[_0x8f8a('0xc')];this[_0x8f8a('0xd')]=_0x737981['dialOriginateCallerIdNumber'];this[_0x8f8a('0xe')]=_0x737981[_0x8f8a('0xe')]||0x1e;this[_0x8f8a('0xf')]=_0x737981[_0x8f8a('0xf')];this[_0x8f8a('0x10')]=_0x737981[_0x8f8a('0x10')];this['dialBusyMaxRetry']=_0x737981[_0x8f8a('0x11')];this[_0x8f8a('0x12')]=_0x737981[_0x8f8a('0x12')];this[_0x8f8a('0x13')]=_0x737981[_0x8f8a('0x13')];this[_0x8f8a('0x14')]=_0x737981[_0x8f8a('0x14')];this['dialGlobalMaxRetry']=_0x737981['dialGlobalMaxRetry'];this[_0x8f8a('0x15')]=_0x737981['dialNoSuchNumberMaxRetry']||0x3;this[_0x8f8a('0x16')]=_0x737981[_0x8f8a('0x16')]||0x96;this[_0x8f8a('0x17')]=_0x737981[_0x8f8a('0x17')]||0x3;this[_0x8f8a('0x18')]=_0x737981[_0x8f8a('0x18')]||0x96;this[_0x8f8a('0x19')]=_0x737981['dialAbandonedMaxRetry']||0x3;this[_0x8f8a('0x1a')]=_0x737981[_0x8f8a('0x1a')]||0x96;this[_0x8f8a('0x1b')]=_0x737981['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x737981[_0x8f8a('0x1c')]||0x96;this[_0x8f8a('0x1d')]=_0x737981[_0x8f8a('0x1d')]||0x3;this[_0x8f8a('0x1e')]=_0x737981['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x737981[_0x8f8a('0x1f')]||_0x8f8a('0x20');this[_0x8f8a('0x21')]=_0x737981[_0x8f8a('0x21')]||undefined;this[_0x8f8a('0x22')]=_0x737981[_0x8f8a('0x22')]||undefined;this['dialCutDigit']=_0x737981[_0x8f8a('0x23')]||undefined;this['TrunkBackup']=_0x737981[_0x8f8a('0x24')]?_0x737981[_0x8f8a('0x24')]:undefined;this[_0x8f8a('0x25')]=_0x737981[_0x8f8a('0x25')]?_0x737981[_0x8f8a('0x25')]:undefined;this[_0x8f8a('0x26')]=_0x737981[_0x8f8a('0x26')]?_0x737981[_0x8f8a('0x26')]:undefined;this[_0x8f8a('0x27')]=_0x737981[_0x8f8a('0x27')]?_0x737981[_0x8f8a('0x27')]:undefined;this[_0x8f8a('0x28')]=_0x737981[_0x8f8a('0x27')]?_0x737981[_0x8f8a('0x27')]['name']:undefined;this[_0x8f8a('0x29')]=_0x737981['dialAMDActive']||![];this[_0x8f8a('0x2a')]=_0x737981[_0x8f8a('0x2a')];this[_0x8f8a('0x2b')]=_0x737981[_0x8f8a('0x2b')];this['dialAMDAfterGreetingSilence']=_0x737981[_0x8f8a('0x2c')];this[_0x8f8a('0x2d')]=_0x737981['dialAMDTotalAnalysisTime'];this[_0x8f8a('0x2e')]=_0x737981[_0x8f8a('0x2e')];this['dialAMDBetweenWordsSilence']=_0x737981[_0x8f8a('0x2f')];this[_0x8f8a('0x30')]=_0x737981['dialAMDMaximumNumberOfWords'];this[_0x8f8a('0x31')]=_0x737981['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x737981[_0x8f8a('0x32')];}module[_0x8f8a('0x33')]=Campaign; \ No newline at end of file +var _0x2595=['temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign'];(function(_0x194801,_0x147ece){var _0x18c56c=function(_0x236640){while(--_0x236640){_0x194801['push'](_0x194801['shift']());}};_0x18c56c(++_0x147ece);}(_0x2595,0x93));var _0x5259=function(_0x568a61,_0x2124f8){_0x568a61=_0x568a61-0x0;var _0x334c3b=_0x2595[_0x568a61];return _0x334c3b;};'use strict';function Campaign(_0x3b7db8){this['id']=_0x3b7db8['id']||0x0;this[_0x5259('0x0')]=_0x3b7db8[_0x5259('0x0')]||'';this[_0x5259('0x1')]=_0x3b7db8['type']||_0x5259('0x2');this['originated']=0x0;this[_0x5259('0x3')]=0x0;this[_0x5259('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x5259('0x5')]=!![];this[_0x5259('0x6')]=_0x3b7db8['active'];this['limitCalls']=_0x3b7db8[_0x5259('0x7')];this[_0x5259('0x8')]=_0x3b7db8['dialTimezone']||null;this[_0x5259('0x9')]=_0x3b7db8[_0x5259('0x9')]?_0x3b7db8[_0x5259('0x9')]:null;this[_0x5259('0xa')]=_0x3b7db8[_0x5259('0xa')];this['dialOriginateCallerIdNumber']=_0x3b7db8[_0x5259('0xb')];this[_0x5259('0xc')]=_0x3b7db8[_0x5259('0xc')]||0x1e;this[_0x5259('0xd')]=_0x3b7db8['dialCongestionMaxRetry'];this[_0x5259('0xe')]=_0x3b7db8[_0x5259('0xe')];this[_0x5259('0xf')]=_0x3b7db8[_0x5259('0xf')];this['dialBusyRetryFrequency']=_0x3b7db8[_0x5259('0x10')];this[_0x5259('0x11')]=_0x3b7db8['dialNoAnswerMaxRetry'];this[_0x5259('0x12')]=_0x3b7db8['dialNoAnswerRetryFrequency'];this[_0x5259('0x13')]=_0x3b7db8[_0x5259('0x13')];this[_0x5259('0x14')]=_0x3b7db8[_0x5259('0x14')]||0x3;this[_0x5259('0x15')]=_0x3b7db8[_0x5259('0x15')]||0x96;this['dialDropMaxRetry']=_0x3b7db8['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x3b7db8[_0x5259('0x16')]||0x96;this[_0x5259('0x17')]=_0x3b7db8['dialAbandonedMaxRetry']||0x3;this[_0x5259('0x18')]=_0x3b7db8['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x3b7db8[_0x5259('0x19')]||0x3;this[_0x5259('0x1a')]=_0x3b7db8[_0x5259('0x1a')]||0x96;this[_0x5259('0x1b')]=_0x3b7db8[_0x5259('0x1b')]||0x3;this[_0x5259('0x1c')]=_0x3b7db8[_0x5259('0x1c')]||0x96;this[_0x5259('0x1d')]=_0x3b7db8['dialOrderByScheduledAt']||_0x5259('0x1e');this[_0x5259('0x1f')]=_0x3b7db8['dialPrefix']||undefined;this[_0x5259('0x20')]=_0x3b7db8[_0x5259('0x20')]||undefined;this[_0x5259('0x21')]=_0x3b7db8[_0x5259('0x21')]||undefined;this['TrunkBackup']=_0x3b7db8[_0x5259('0x22')]?_0x3b7db8['TrunkBackup']:undefined;this[_0x5259('0x23')]=_0x3b7db8[_0x5259('0x23')]?_0x3b7db8[_0x5259('0x23')]:undefined;this[_0x5259('0x24')]=_0x3b7db8['Interval']?_0x3b7db8['Interval']:undefined;this['SquareProject']=_0x3b7db8[_0x5259('0x25')]?_0x3b7db8['SquareProject']:undefined;this[_0x5259('0x26')]=_0x3b7db8[_0x5259('0x25')]?_0x3b7db8[_0x5259('0x25')][_0x5259('0x0')]:undefined;this[_0x5259('0x27')]=_0x3b7db8['dialAMDActive']||![];this[_0x5259('0x28')]=_0x3b7db8[_0x5259('0x28')];this[_0x5259('0x29')]=_0x3b7db8[_0x5259('0x29')];this[_0x5259('0x2a')]=_0x3b7db8[_0x5259('0x2a')];this['dialAMDTotalAnalysisTime']=_0x3b7db8[_0x5259('0x2b')];this['dialAMDMinWordLength']=_0x3b7db8[_0x5259('0x2c')];this[_0x5259('0x2d')]=_0x3b7db8['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x3b7db8[_0x5259('0x2e')];this[_0x5259('0x2f')]=_0x3b7db8[_0x5259('0x2f')];this[_0x5259('0x30')]=_0x3b7db8[_0x5259('0x30')];}module[_0x5259('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index eb6e145..8ac693e 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 _0x2cfd=['transferconnectedlinenum','transferType','exports','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','linkedid','exten','answertime','endtime','unmanaged','abandoned','duration','billableseconds','tag','disposition','monitor','queue','monitors','transfercalleridnum'];(function(_0x4ca764,_0x572b2a){var _0x39292d=function(_0x377500){while(--_0x377500){_0x4ca764['push'](_0x4ca764['shift']());}};_0x39292d(++_0x572b2a);}(_0x2cfd,0x179));var _0xd2cf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2cfd[_0x20a584];return _0x4b41a8;};'use strict';function Channel(){this['starttime']=null;this[_0xd2cf('0x0')]='';this[_0xd2cf('0x1')]='';this[_0xd2cf('0x2')]=0x0;this['calleridname']='';this[_0xd2cf('0x3')]=undefined;this[_0xd2cf('0x4')]=undefined;this['accountcode']=0x0;this['context']='';this['uniqueid']=0x0;this[_0xd2cf('0x5')]=0x0;this[_0xd2cf('0x6')]=0x0;this['answered']=![];this[_0xd2cf('0x7')]=null;this[_0xd2cf('0x8')]=null;this[_0xd2cf('0x9')]=![];this[_0xd2cf('0xa')]=![];this['lastapplication']='';this['lastdata']='';this[_0xd2cf('0xb')]=0x0;this[_0xd2cf('0xc')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0xd2cf('0xd')]=null;this[_0xd2cf('0xe')]=null;this[_0xd2cf('0xf')]=![];this['monitorFilename']=null;this[_0xd2cf('0x10')]=null;this[_0xd2cf('0x11')]=[];this[_0xd2cf('0x12')]=undefined;this[_0xd2cf('0x13')]=undefined;this[_0xd2cf('0x14')]=undefined;this['mohtime']=0x0;}module[_0xd2cf('0x15')]=Channel; \ No newline at end of file +var _0x639a=['type','disposition','monitor','queue','monitors','transferconnectedlinenum','transferType','exports','starttime','channel','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime'];(function(_0x1b450e,_0x3874ca){var _0xd655d8=function(_0x2846dc){while(--_0x2846dc){_0x1b450e['push'](_0x1b450e['shift']());}};_0xd655d8(++_0x3874ca);}(_0x639a,0x1e8));var _0xa639=function(_0x10abd3,_0x136b8b){_0x10abd3=_0x10abd3-0x0;var _0x2146c1=_0x639a[_0x10abd3];return _0x2146c1;};'use strict';function Channel(){this[_0xa639('0x0')]=null;this[_0xa639('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0xa639('0x2')]='';this[_0xa639('0x3')]=undefined;this['connectedlinename']=undefined;this[_0xa639('0x4')]=0x0;this[_0xa639('0x5')]='';this[_0xa639('0x6')]=0x0;this[_0xa639('0x7')]=0x0;this['exten']=0x0;this[_0xa639('0x8')]=![];this['answertime']=null;this[_0xa639('0x9')]=null;this[_0xa639('0xa')]=![];this[_0xa639('0xb')]=![];this[_0xa639('0xc')]='';this[_0xa639('0xd')]='';this['duration']=0x0;this[_0xa639('0xe')]=0x0;this[_0xa639('0xf')]=0x0;this[_0xa639('0x10')]=null;this['tag']=null;this[_0xa639('0x11')]=null;this[_0xa639('0x12')]=![];this['monitorFilename']=null;this[_0xa639('0x13')]=null;this[_0xa639('0x14')]=[];this['transfercalleridnum']=undefined;this[_0xa639('0x15')]=undefined;this[_0xa639('0x16')]=undefined;this['mohtime']=0x0;}module[_0xa639('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 91a9e66..bb80f9b 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 _0x7d6d=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x7d6d,0x1ca));var _0xd7d6=function(_0x13647a,_0x23799f){_0x13647a=_0x13647a-0x0;var _0x41f50c=_0x7d6d[_0x13647a];return _0x41f50c;};'use strict';function DeskAccount(_0x1bddb7){this['id']=_0x1bddb7['id']||0x0;this[_0xd7d6('0x0')]=_0x1bddb7[_0xd7d6('0x0')]||'';this[_0xd7d6('0x1')]=_0x1bddb7[_0xd7d6('0x1')]||'';this[_0xd7d6('0x2')]=_0x1bddb7['remoteUri']||'';this[_0xd7d6('0x3')]=_0x1bddb7[_0xd7d6('0x3')]||'';this[_0xd7d6('0x4')]=_0x1bddb7[_0xd7d6('0x4')]||'';this[_0xd7d6('0x5')]=_0x1bddb7[_0xd7d6('0x5')]||'';this['consumerSecret']=_0x1bddb7[_0xd7d6('0x6')]||'';this[_0xd7d6('0x7')]=_0x1bddb7['token']||'';this[_0xd7d6('0x8')]=_0x1bddb7[_0xd7d6('0x8')]||'';this[_0xd7d6('0x9')]=_0x1bddb7[_0xd7d6('0x9')]||'';this[_0xd7d6('0xa')]=_0x1bddb7[_0xd7d6('0xa')]||'';this[_0xd7d6('0xb')]=_0x1bddb7[_0xd7d6('0xb')]||{};}module[_0xd7d6('0xc')]=DeskAccount; \ No newline at end of file +var _0xbe4d=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x3c5caf,_0x49e971){var _0x23d2df=function(_0x19bff3){while(--_0x19bff3){_0x3c5caf['push'](_0x3c5caf['shift']());}};_0x23d2df(++_0x49e971);}(_0xbe4d,0x7e));var _0xdbe4=function(_0x183e92,_0x437dfe){_0x183e92=_0x183e92-0x0;var _0x186eca=_0xbe4d[_0x183e92];return _0x186eca;};'use strict';function DeskAccount(_0x22b270){this['id']=_0x22b270['id']||0x0;this[_0xdbe4('0x0')]=_0x22b270[_0xdbe4('0x0')]||'';this[_0xdbe4('0x1')]=_0x22b270[_0xdbe4('0x1')]||'';this[_0xdbe4('0x2')]=_0x22b270[_0xdbe4('0x2')]||'';this[_0xdbe4('0x3')]=_0x22b270[_0xdbe4('0x3')]||'';this['password']=_0x22b270[_0xdbe4('0x4')]||'';this[_0xdbe4('0x5')]=_0x22b270[_0xdbe4('0x5')]||'';this[_0xdbe4('0x6')]=_0x22b270[_0xdbe4('0x6')]||'';this[_0xdbe4('0x7')]=_0x22b270[_0xdbe4('0x7')]||'';this[_0xdbe4('0x8')]=_0x22b270['tokenSecret']||'';this[_0xdbe4('0x9')]=_0x22b270[_0xdbe4('0x9')]||'';this[_0xdbe4('0xa')]=_0x22b270[_0xdbe4('0xa')]||'';this[_0xdbe4('0xb')]=_0x22b270[_0xdbe4('0xb')]||{};}module[_0xdbe4('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 ccd854e..2e432a3 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 _0x34b7=['Configurations','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x34b7,0x196));var _0x734b=function(_0x1efed4,_0x3e803b){_0x1efed4=_0x1efed4-0x0;var _0x2e76e9=_0x34b7[_0x1efed4];return _0x2e76e9;};'use strict';function Dynamics365Account(_0x3573c4){this['id']=_0x3573c4['id']||0x0;this['name']=_0x3573c4[_0x734b('0x0')]||'';this[_0x734b('0x1')]=_0x3573c4[_0x734b('0x1')]||'';this[_0x734b('0x2')]=_0x3573c4[_0x734b('0x2')]||'';this[_0x734b('0x3')]=_0x3573c4['remoteUri']||'';this['tenantId']=_0x3573c4[_0x734b('0x4')]||'';this[_0x734b('0x5')]=_0x3573c4[_0x734b('0x5')]||'';this[_0x734b('0x6')]=_0x3573c4[_0x734b('0x6')]||{};this[_0x734b('0x7')]=_0x3573c4['serverUrl']||'';this[_0x734b('0x8')]=_0x3573c4[_0x734b('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x6c76=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','Configurations'];(function(_0x1d606e,_0x438c6a){var _0x528543=function(_0x5c0cf7){while(--_0x5c0cf7){_0x1d606e['push'](_0x1d606e['shift']());}};_0x528543(++_0x438c6a);}(_0x6c76,0x184));var _0x66c7=function(_0x2c09ee,_0x12794b){_0x2c09ee=_0x2c09ee-0x0;var _0x3a27a5=_0x6c76[_0x2c09ee];return _0x3a27a5;};'use strict';function Dynamics365Account(_0x4d4f77){this['id']=_0x4d4f77['id']||0x0;this[_0x66c7('0x0')]=_0x4d4f77[_0x66c7('0x0')]||'';this['username']=_0x4d4f77[_0x66c7('0x1')]||'';this[_0x66c7('0x2')]=_0x4d4f77['password']||'';this['remoteUri']=_0x4d4f77[_0x66c7('0x3')]||'';this[_0x66c7('0x4')]=_0x4d4f77['tenantId']||'';this[_0x66c7('0x5')]=_0x4d4f77[_0x66c7('0x5')]||'';this['clientSecret']=_0x4d4f77[_0x66c7('0x6')]||{};this['serverUrl']=_0x4d4f77['serverUrl']||'';this[_0x66c7('0x7')]=_0x4d4f77[_0x66c7('0x7')]||{};}module[_0x66c7('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index c22c003..d9fdfdb 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 _0x9ac0=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name'];(function(_0x562f67,_0x22b5d6){var _0x4ede70=function(_0x48edb8){while(--_0x48edb8){_0x562f67['push'](_0x562f67['shift']());}};_0x4ede70(++_0x22b5d6);}(_0x9ac0,0x1ec));var _0x09ac=function(_0x124661,_0xc504af){_0x124661=_0x124661-0x0;var _0x4bbc6d=_0x9ac0[_0x124661];return _0x4bbc6d;};'use strict';function FaxAccount(_0x5d861b){this['id']=_0x5d861b['id']||0x0;this[_0x09ac('0x0')]=_0x5d861b['name']||'';this[_0x09ac('0x1')]=_0x5d861b[_0x09ac('0x1')];this[_0x09ac('0x2')]=_0x5d861b[_0x09ac('0x2')];this['headerinfo']=_0x5d861b[_0x09ac('0x3')];this[_0x09ac('0x4')]=_0x5d861b[_0x09ac('0x4')];this[_0x09ac('0x5')]=_0x5d861b[_0x09ac('0x5')]||0x960;this[_0x09ac('0x6')]=_0x5d861b[_0x09ac('0x6')]||0x3840;this[_0x09ac('0x7')]=_0x5d861b[_0x09ac('0x7')]||_0x09ac('0x8');this['gateway']=_0x5d861b[_0x09ac('0x9')]||'no';this[_0x09ac('0xa')]=_0x5d861b[_0x09ac('0xa')]||'no';this[_0x09ac('0xb')]=_0x5d861b[_0x09ac('0xb')]||0x1388;this[_0x09ac('0xc')]=_0x5d861b[_0x09ac('0xc')]||_0x09ac('0xd');this[_0x09ac('0xe')]=_0x5d861b['Trunk']?_0x5d861b[_0x09ac('0xe')]:undefined;this[_0x09ac('0xf')]=_0x5d861b[_0x09ac('0xf')];this[_0x09ac('0x10')]=_0x5d861b['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x9c87=['Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0x153cb8,_0x556ced){var _0x4c96d4=function(_0x5309d4){while(--_0x5309d4){_0x153cb8['push'](_0x153cb8['shift']());}};_0x4c96d4(++_0x556ced);}(_0x9c87,0x1b3));var _0x79c8=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0x9c87[_0x4169d8];return _0x32084a;};'use strict';function FaxAccount(_0x3a0673){this['id']=_0x3a0673['id']||0x0;this[_0x79c8('0x0')]=_0x3a0673[_0x79c8('0x0')]||'';this[_0x79c8('0x1')]=_0x3a0673['description'];this[_0x79c8('0x2')]=_0x3a0673[_0x79c8('0x2')];this[_0x79c8('0x3')]=_0x3a0673[_0x79c8('0x3')];this[_0x79c8('0x4')]=_0x3a0673['localstationid'];this['minrate']=_0x3a0673[_0x79c8('0x5')]||0x960;this[_0x79c8('0x6')]=_0x3a0673[_0x79c8('0x6')]||0x3840;this['modem']=_0x3a0673[_0x79c8('0x7')]||_0x79c8('0x8');this[_0x79c8('0x9')]=_0x3a0673['gateway']||'no';this['faxdetect']=_0x3a0673[_0x79c8('0xa')]||'no';this[_0x79c8('0xb')]=_0x3a0673[_0x79c8('0xb')]||0x1388;this[_0x79c8('0xc')]=_0x3a0673[_0x79c8('0xc')]||'SIP';this['Trunk']=_0x3a0673[_0x79c8('0xd')]?_0x3a0673[_0x79c8('0xd')]:undefined;this['ListId']=_0x3a0673[_0x79c8('0xe')];this['key']=_0x3a0673[_0x79c8('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index f6e07fe..ff845a3 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 _0x0fdb=['exports','name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x4128c4,_0x5d8910){var _0x4c0eca=function(_0x2f9540){while(--_0x2f9540){_0x4128c4['push'](_0x4128c4['shift']());}};_0x4c0eca(++_0x5d8910);}(_0x0fdb,0xef));var _0xb0fd=function(_0x2bf40f,_0x36c9da){_0x2bf40f=_0x2bf40f-0x0;var _0x57c391=_0x0fdb[_0x2bf40f];return _0x57c391;};'use strict';function FreshdeskAccount(_0x4e3c3a){this['id']=_0x4e3c3a['id']||0x0;this[_0xb0fd('0x0')]=_0x4e3c3a['name']||'';this[_0xb0fd('0x1')]=_0x4e3c3a[_0xb0fd('0x1')]||'';this[_0xb0fd('0x2')]=_0x4e3c3a['token']||'';this[_0xb0fd('0x3')]=_0x4e3c3a[_0xb0fd('0x3')]||'';this[_0xb0fd('0x4')]=_0x4e3c3a['serverUrl']||'';this[_0xb0fd('0x5')]=_0x4e3c3a[_0xb0fd('0x5')]||{};}module[_0xb0fd('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x4d24=['remoteUri','serverUrl','exports','name','username'];(function(_0x51d6db,_0x3b06ec){var _0x5babe0=function(_0x10a289){while(--_0x10a289){_0x51d6db['push'](_0x51d6db['shift']());}};_0x5babe0(++_0x3b06ec);}(_0x4d24,0xa3));var _0x44d2=function(_0x7fe434,_0x522c37){_0x7fe434=_0x7fe434-0x0;var _0x38c0ab=_0x4d24[_0x7fe434];return _0x38c0ab;};'use strict';function FreshdeskAccount(_0x1eb4c9){this['id']=_0x1eb4c9['id']||0x0;this[_0x44d2('0x0')]=_0x1eb4c9[_0x44d2('0x0')]||'';this['username']=_0x1eb4c9[_0x44d2('0x1')]||'';this['apiKey']=_0x1eb4c9['token']||'';this[_0x44d2('0x2')]=_0x1eb4c9[_0x44d2('0x2')]||'';this[_0x44d2('0x3')]=_0x1eb4c9['serverUrl']||'';this['Configurations']=_0x1eb4c9['Configurations']||{};}module[_0x44d2('0x4')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 0b0edf2..6afd863 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 _0x43fd=['name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x362dbb,_0x110bc3){var _0x493434=function(_0xf6a6fe){while(--_0xf6a6fe){_0x362dbb['push'](_0x362dbb['shift']());}};_0x493434(++_0x110bc3);}(_0x43fd,0x1ec));var _0xd43f=function(_0x43e055,_0x658445){_0x43e055=_0x43e055-0x0;var _0x3fd13d=_0x43fd[_0x43e055];return _0x3fd13d;};'use strict';function FreshsalesAccount(_0xa81b26){this['id']=_0xa81b26['id']||0x0;this[_0xd43f('0x0')]=_0xa81b26['name']||'';this['username']=_0xa81b26[_0xd43f('0x1')]||'';this[_0xd43f('0x2')]=_0xa81b26['token']||'';this[_0xd43f('0x3')]=_0xa81b26['remoteUri']||'';this[_0xd43f('0x4')]=_0xa81b26[_0xd43f('0x4')]||'';this[_0xd43f('0x5')]=_0xa81b26[_0xd43f('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xaf79=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x2c3514,_0x5604d4){var _0x22ab07=function(_0x21acce){while(--_0x21acce){_0x2c3514['push'](_0x2c3514['shift']());}};_0x22ab07(++_0x5604d4);}(_0xaf79,0x82));var _0x9af7=function(_0x5a7cfe,_0x25f9cf){_0x5a7cfe=_0x5a7cfe-0x0;var _0x5079bd=_0xaf79[_0x5a7cfe];return _0x5079bd;};'use strict';function FreshsalesAccount(_0x1cfecb){this['id']=_0x1cfecb['id']||0x0;this[_0x9af7('0x0')]=_0x1cfecb[_0x9af7('0x0')]||'';this[_0x9af7('0x1')]=_0x1cfecb[_0x9af7('0x1')]||'';this[_0x9af7('0x2')]=_0x1cfecb[_0x9af7('0x3')]||'';this['remoteUri']=_0x1cfecb[_0x9af7('0x4')]||'';this[_0x9af7('0x5')]=_0x1cfecb[_0x9af7('0x5')]||'';this[_0x9af7('0x6')]=_0x1cfecb['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 24f6f7b..aba9dfa 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 _0x542c=['count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','connectedlinenum','accountcode','exten','holdtime','assigned','lastAssignedTo','motionChannel','voice','exports','type','calleridnum','calleridname','position'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x542c,0xf3));var _0xc542=function(_0x3e49f4,_0x3f77db){_0x3e49f4=_0x3e49f4-0x0;var _0x454688=_0x542c[_0x3e49f4];return _0x454688;};'use strict';function QueueReport(){this[_0xc542('0x0')]='inbound';this['uniqueid']='';this[_0xc542('0x1')]='';this[_0xc542('0x2')]='';this['queue']='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xc542('0x3')]=0x1;this[_0xc542('0x4')]=0x1;this[_0xc542('0x5')]=![];this['queuecallerabandonAt']=null;this[_0xc542('0x6')]=![];this[_0xc542('0x7')]=null;this[_0xc542('0x8')]=![];this['queuecallerexitAt']=null;this[_0xc542('0x9')]=0x1;this['channel']='';this[_0xc542('0xa')]='';this['connectedlinename']='';this[_0xc542('0xb')]='';this['context']='';this[_0xc542('0xc')]='';this['priority']='';this[_0xc542('0xd')]=0x0;this[_0xc542('0xe')]=![];this[_0xc542('0xf')]='';this[_0xc542('0x10')]=_0xc542('0x11');this['mohtime']=0x0;this['variables']={};}module[_0xc542('0x12')]=QueueReport; \ No newline at end of file +var _0xc38b=['count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','accountcode','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x234098,_0xa827eb){var _0xee0fa5=function(_0x19afb0){while(--_0x19afb0){_0x234098['push'](_0x234098['shift']());}};_0xee0fa5(++_0xa827eb);}(_0xc38b,0x89));var _0xbc38=function(_0x4b04d6,_0x20afa0){_0x4b04d6=_0x4b04d6-0x0;var _0x1d3c98=_0xc38b[_0x4b04d6];return _0x1d3c98;};'use strict';function QueueReport(){this[_0xbc38('0x0')]=_0xbc38('0x1');this[_0xbc38('0x2')]='';this[_0xbc38('0x3')]='';this['calleridname']='';this[_0xbc38('0x4')]='';this[_0xbc38('0x5')]=null;this[_0xbc38('0x6')]=null;this['position']=0x1;this[_0xbc38('0x7')]=0x1;this[_0xbc38('0x8')]=![];this[_0xbc38('0x9')]=null;this['queuecallercomplete']=![];this[_0xbc38('0xa')]=null;this[_0xbc38('0xb')]=![];this[_0xbc38('0xc')]=null;this[_0xbc38('0xd')]=0x1;this['channel']='';this[_0xbc38('0xe')]='';this['connectedlinename']='';this[_0xbc38('0xf')]='';this['context']='';this['exten']='';this['priority']='';this[_0xbc38('0x10')]=0x0;this[_0xbc38('0x11')]=![];this[_0xbc38('0x12')]='';this[_0xbc38('0x13')]=_0xbc38('0x14');this[_0xbc38('0x15')]=0x0;this[_0xbc38('0x16')]={};}module[_0xbc38('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 8806804..10adbba 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 _0xc75f=['password','clientId','clientSecret','securityToken','type','integrationTab','Configurations','exports','name','username','remoteUri'];(function(_0x41ecc3,_0x1d8d5c){var _0x36143b=function(_0x44b7d9){while(--_0x44b7d9){_0x41ecc3['push'](_0x41ecc3['shift']());}};_0x36143b(++_0x1d8d5c);}(_0xc75f,0xb8));var _0xfc75=function(_0x3c07e9,_0x151b19){_0x3c07e9=_0x3c07e9-0x0;var _0x4e5ae7=_0xc75f[_0x3c07e9];return _0x4e5ae7;};'use strict';function SalesforceAccount(_0x1e5418){this['id']=_0x1e5418['id']||0x0;this['name']=_0x1e5418[_0xfc75('0x0')]||'';this[_0xfc75('0x1')]=_0x1e5418['username']||'';this[_0xfc75('0x2')]=_0x1e5418['remoteUri']||'';this[_0xfc75('0x3')]=_0x1e5418[_0xfc75('0x3')]||'';this[_0xfc75('0x4')]=_0x1e5418['clientId']||'';this['clientSecret']=_0x1e5418[_0xfc75('0x5')]||'';this[_0xfc75('0x6')]=_0x1e5418['securityToken']||'';this[_0xfc75('0x7')]=_0x1e5418[_0xfc75('0x7')]||_0xfc75('0x8');this['serverUrl']=_0x1e5418['serverUrl']||'';this[_0xfc75('0x9')]=_0x1e5418[_0xfc75('0x9')]||{};}module[_0xfc75('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xb258=['securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x347a06,_0x5bcca9){var _0xdebdb=function(_0x5dd4af){while(--_0x5dd4af){_0x347a06['push'](_0x347a06['shift']());}};_0xdebdb(++_0x5bcca9);}(_0xb258,0x19c));var _0x8b25=function(_0x4e8960,_0xa05150){_0x4e8960=_0x4e8960-0x0;var _0x3d96e4=_0xb258[_0x4e8960];return _0x3d96e4;};'use strict';function SalesforceAccount(_0x5dbfea){this['id']=_0x5dbfea['id']||0x0;this[_0x8b25('0x0')]=_0x5dbfea[_0x8b25('0x0')]||'';this['username']=_0x5dbfea[_0x8b25('0x1')]||'';this[_0x8b25('0x2')]=_0x5dbfea[_0x8b25('0x2')]||'';this['password']=_0x5dbfea[_0x8b25('0x3')]||'';this[_0x8b25('0x4')]=_0x5dbfea[_0x8b25('0x4')]||'';this[_0x8b25('0x5')]=_0x5dbfea[_0x8b25('0x5')]||'';this['securityToken']=_0x5dbfea[_0x8b25('0x6')]||'';this['type']=_0x5dbfea[_0x8b25('0x7')]||_0x8b25('0x8');this['serverUrl']=_0x5dbfea[_0x8b25('0x9')]||'';this[_0x8b25('0xa')]=_0x5dbfea[_0x8b25('0xa')]||{};}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 5fa129d..6b21c93 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 _0x3acb=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0xac1a49,_0x4be61f){var _0x193108=function(_0x30db62){while(--_0x30db62){_0xac1a49['push'](_0xac1a49['shift']());}};_0x193108(++_0x4be61f);}(_0x3acb,0x17b));var _0xb3ac=function(_0x1f8765,_0x39d76d){_0x1f8765=_0x1f8765-0x0;var _0x310399=_0x3acb[_0x1f8765];return _0x310399;};'use strict';function ServicenowAccount(_0x3546c0){this['id']=_0x3546c0['id']||0x0;this[_0xb3ac('0x0')]=_0x3546c0[_0xb3ac('0x0')]||'';this['username']=_0x3546c0[_0xb3ac('0x1')]||'';this[_0xb3ac('0x2')]=_0x3546c0[_0xb3ac('0x2')]||'';this['remoteUri']=_0x3546c0[_0xb3ac('0x3')]||'';this[_0xb3ac('0x4')]=_0x3546c0['serverUrl']||'';this[_0xb3ac('0x5')]=_0x3546c0[_0xb3ac('0x5')]||{};}module[_0xb3ac('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x4802=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x14c5bd,_0x4cab37){var _0x125ab8=function(_0x476367){while(--_0x476367){_0x14c5bd['push'](_0x14c5bd['shift']());}};_0x125ab8(++_0x4cab37);}(_0x4802,0x16b));var _0x2480=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x4802[_0x273c39];return _0x46d6b5;};'use strict';function ServicenowAccount(_0xa4f38c){this['id']=_0xa4f38c['id']||0x0;this['name']=_0xa4f38c[_0x2480('0x0')]||'';this[_0x2480('0x1')]=_0xa4f38c[_0x2480('0x1')]||'';this[_0x2480('0x2')]=_0xa4f38c[_0x2480('0x2')]||'';this[_0x2480('0x3')]=_0xa4f38c[_0x2480('0x3')]||'';this[_0x2480('0x4')]=_0xa4f38c[_0x2480('0x4')]||'';this[_0x2480('0x5')]=_0xa4f38c['Configurations']||{};}module[_0x2480('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 8e574fd..b641311 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 _0x146e=['Configurations','exports','username','remoteUri','serverUrl'];(function(_0x226261,_0x133709){var _0x591c55=function(_0x47ce6e){while(--_0x47ce6e){_0x226261['push'](_0x226261['shift']());}};_0x591c55(++_0x133709);}(_0x146e,0x110));var _0xe146=function(_0x123a48,_0x45d8d9){_0x123a48=_0x123a48-0x0;var _0x235b7b=_0x146e[_0x123a48];return _0x235b7b;};'use strict';function SugarcrmAccount(_0xb4ec77){this['id']=_0xb4ec77['id']||0x0;this['name']=_0xb4ec77['name']||'';this[_0xe146('0x0')]=_0xb4ec77[_0xe146('0x0')]||'';this['password']=_0xb4ec77['password']||'';this[_0xe146('0x1')]=_0xb4ec77[_0xe146('0x1')]||'';this[_0xe146('0x2')]=_0xb4ec77[_0xe146('0x2')]||'';this[_0xe146('0x3')]=_0xb4ec77[_0xe146('0x3')]||{};}module[_0xe146('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0x4a1d=['password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x5425a8,_0x4ee32a){var _0xefad2b=function(_0x3327d0){while(--_0x3327d0){_0x5425a8['push'](_0x5425a8['shift']());}};_0xefad2b(++_0x4ee32a);}(_0x4a1d,0x113));var _0xd4a1=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4a1d[_0x4243a3];return _0x1b2a33;};'use strict';function SugarcrmAccount(_0x5c9ae1){this['id']=_0x5c9ae1['id']||0x0;this[_0xd4a1('0x0')]=_0x5c9ae1[_0xd4a1('0x0')]||'';this['username']=_0x5c9ae1['username']||'';this['password']=_0x5c9ae1[_0xd4a1('0x1')]||'';this['remoteUri']=_0x5c9ae1[_0xd4a1('0x2')]||'';this[_0xd4a1('0x3')]=_0x5c9ae1[_0xd4a1('0x3')]||'';this['Configurations']=_0x5c9ae1[_0xd4a1('0x4')]||{};}module[_0xd4a1('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 4cb2451..27c82d3 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 _0x9a1b=['stateTime','address','accountcode','state','unknown'];(function(_0x332a78,_0x4d38b3){var _0x537ac5=function(_0x1a7526){while(--_0x1a7526){_0x332a78['push'](_0x332a78['shift']());}};_0x537ac5(++_0x4d38b3);}(_0x9a1b,0x1ba));var _0xb9a1=function(_0x3c2125,_0x524e15){_0x3c2125=_0x3c2125-0x0;var _0x25f6c4=_0x9a1b[_0x3c2125];return _0x25f6c4;};'use strict';function Telephone(_0x1bca0b){this['id']=_0x1bca0b['id']||0x0;this['name']=_0x1bca0b['name']||'';this['accountcode']=_0x1bca0b[_0xb9a1('0x0')]||'';this[_0xb9a1('0x1')]=_0xb9a1('0x2');this[_0xb9a1('0x3')]=0x0;this['status']=_0xb9a1('0x2');this[_0xb9a1('0x4')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x3b57=['exports','name','accountcode','state','unknown','stateTime'];(function(_0x5222d4,_0x31c0e1){var _0x132f04=function(_0x505f17){while(--_0x505f17){_0x5222d4['push'](_0x5222d4['shift']());}};_0x132f04(++_0x31c0e1);}(_0x3b57,0x103));var _0x73b5=function(_0x3ba64a,_0x2629dd){_0x3ba64a=_0x3ba64a-0x0;var _0x14cf09=_0x3b57[_0x3ba64a];return _0x14cf09;};'use strict';function Telephone(_0x3c5f83){this['id']=_0x3c5f83['id']||0x0;this['name']=_0x3c5f83[_0x73b5('0x0')]||'';this[_0x73b5('0x1')]=_0x3c5f83['accountcode']||'';this[_0x73b5('0x2')]=_0x73b5('0x3');this[_0x73b5('0x4')]=0x0;this['status']=_0x73b5('0x3');this['address']='';}module[_0x73b5('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 cb4d08f..d3babb6 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(_0x3c51d3,_0x206ddf){var _0x2816a7=function(_0x418bca){while(--_0x418bca){_0x3c51d3['push'](_0x3c51d3['shift']());}};_0x2816a7(++_0x206ddf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x4bf7c7,_0x3d9191){var _0x19b4e6=function(_0x4003c2){while(--_0x4003c2){_0x4bf7c7['push'](_0x4bf7c7['shift']());}};_0x19b4e6(++_0x3d9191);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index c023103..8eee672 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 _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1a85,0x178));var _0x51a8=function(_0x42c341,_0x31d467){_0x42c341=_0x42c341-0x0;var _0x43621b=_0x1a85[_0x42c341];return _0x43621b;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x42003f,_0x1ac84a){var _0x371c69=function(_0x358814){while(--_0x358814){_0x42003f['push'](_0x42003f['shift']());}};_0x371c69(++_0x1ac84a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb7e7[_0x38a7ac];return _0x53061a;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 1db4ddc..4ef27ca 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 _0x272e=['stateTime','status','registry','port','domain','domainport','refresh','stateRegistry','registrationtime','address','active','name','state','unknown'];(function(_0x3e6339,_0x3a07a0){var _0x26f95d=function(_0x18c776){while(--_0x18c776){_0x3e6339['push'](_0x3e6339['shift']());}};_0x26f95d(++_0x3a07a0);}(_0x272e,0xb2));var _0xe272=function(_0x570556,_0x40ea1e){_0x570556=_0x570556-0x0;var _0x5402f2=_0x272e[_0x570556];return _0x5402f2;};'use strict';function Trunk(_0x58bfc7){this['id']=_0x58bfc7['id']||0x0;this['active']=_0x58bfc7[_0xe272('0x0')]||![];this[_0xe272('0x1')]=_0x58bfc7[_0xe272('0x1')]||'';this[_0xe272('0x2')]=_0xe272('0x3');this[_0xe272('0x4')]=0x0;this[_0xe272('0x5')]='unknown';this[_0xe272('0x6')]=_0x58bfc7[_0xe272('0x6')]&&_0x58bfc7[_0xe272('0x6')]['indexOf'](':')?_0x58bfc7[_0xe272('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0xe272('0x7')]='';this[_0xe272('0x8')]='';this[_0xe272('0x9')]='';this[_0xe272('0xa')]='';this[_0xe272('0xb')]=_0xe272('0x3');this[_0xe272('0xc')]='';this[_0xe272('0xd')]='';this['defaultuser']=_0x58bfc7['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file +var _0x62b6=['defaultuser','exports','name','state','stateTime','status','registry','indexOf','split','port','domain','domainport','unknown','address'];(function(_0x4041a1,_0xbb856c){var _0x5ea4da=function(_0x4d7346){while(--_0x4d7346){_0x4041a1['push'](_0x4041a1['shift']());}};_0x5ea4da(++_0xbb856c);}(_0x62b6,0x144));var _0x662b=function(_0xef7aa0,_0x4da101){_0xef7aa0=_0xef7aa0-0x0;var _0x544042=_0x62b6[_0xef7aa0];return _0x544042;};'use strict';function Trunk(_0x191251){this['id']=_0x191251['id']||0x0;this['active']=_0x191251['active']||![];this['name']=_0x191251[_0x662b('0x0')]||'';this[_0x662b('0x1')]='unknown';this[_0x662b('0x2')]=0x0;this[_0x662b('0x3')]='unknown';this[_0x662b('0x4')]=_0x191251[_0x662b('0x4')]&&_0x191251[_0x662b('0x4')][_0x662b('0x5')](':')?_0x191251[_0x662b('0x4')][_0x662b('0x6')](':')[0x0]:'';this['host']='';this[_0x662b('0x7')]='';this[_0x662b('0x8')]='';this[_0x662b('0x9')]='';this['refresh']='';this['stateRegistry']=_0x662b('0xa');this['registrationtime']='';this[_0x662b('0xb')]='';this[_0x662b('0xc')]=_0x191251['defaultuser']||'';}module[_0x662b('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 8c67220..70c8a84 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 _0xba9c=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x52696d,_0x4fb6b9){var _0x1f5c93=function(_0x1ff8df){while(--_0x1ff8df){_0x52696d['push'](_0x52696d['shift']());}};_0x1f5c93(++_0x4fb6b9);}(_0xba9c,0x10b));var _0xcba9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba9c[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x1044e9){this['id']=_0x1044e9['id']||0x0;this[_0xcba9('0x0')]=_0x1044e9['exten']||'';this['recordingFormat']=_0x1044e9[_0xcba9('0x1')]||_0xcba9('0x2');this[_0xcba9('0x3')]=_0x1044e9[_0xcba9('0x3')]||![];}module[_0xcba9('0x4')]=voiceExtension; \ No newline at end of file +var _0x0958=['recordingFormat','none','mandatoryDisposition'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0958,0x195));var _0x8095=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0958[_0x2641f9];return _0x585741;};'use strict';function voiceExtension(_0x212b82){this['id']=_0x212b82['id']||0x0;this['exten']=_0x212b82['exten']||'';this[_0x8095('0x0')]=_0x212b82[_0x8095('0x0')]||_0x8095('0x1');this[_0x8095('0x2')]=_0x212b82[_0x8095('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 13caf4c..9fe56ba 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 _0x8a85=['acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','busy','invalid','ringinuse','onhold','wav','wav49','gsm','name','monitor_format','type','inbound','waiting','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw'];(function(_0x192aab,_0x4303da){var _0x18a0bc=function(_0x302005){while(--_0x302005){_0x192aab['push'](_0x192aab['shift']());}};_0x18a0bc(++_0x4303da);}(_0x8a85,0x64));var _0x58a8=function(_0x2efb6d,_0x39e994){_0x2efb6d=_0x2efb6d-0x0;var _0x419735=_0x8a85[_0x2efb6d];return _0x419735;};'use strict';var statusDesc=['unknown',_0x58a8('0x0'),'inuse',_0x58a8('0x1'),_0x58a8('0x2'),'unavailable','ringing',_0x58a8('0x3'),_0x58a8('0x4')];var monitorFormat={'wav':_0x58a8('0x5'),'wav49':_0x58a8('0x6'),'gsm':_0x58a8('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x2b35d4){this['id']=_0x2b35d4['id']||0x0;this[_0x58a8('0x8')]=_0x2b35d4[_0x58a8('0x8')]||'';this[_0x58a8('0x9')]=_0x2b35d4[_0x58a8('0x9')]||'';this['type']=_0x2b35d4[_0x58a8('0xa')]||_0x58a8('0xb');this[_0x58a8('0xc')]=0x0;this['talking']=0x0;this['total']=0x0;this['answered']=0x0;this[_0x58a8('0xd')]=0x0;this[_0x58a8('0xe')]=0x0;this[_0x58a8('0xf')]=0x0;this[_0x58a8('0x10')]=0x0;this[_0x58a8('0x11')]=0x0;this[_0x58a8('0x12')]=0x0;this[_0x58a8('0x13')]=0x0;this[_0x58a8('0x14')]=_0x2b35d4['acw']||![];this[_0x58a8('0x15')]=_0x2b35d4[_0x58a8('0x15')]||0xa;this[_0x58a8('0x16')]=_0x2b35d4[_0x58a8('0x16')]||'no';this['sendMessageOneNotActive']=!![];this[_0x58a8('0x17')]='';this[_0x58a8('0x18')]=0x0;this[_0x58a8('0x19')]=0x0;this['dialTimezone']=_0x2b35d4[_0x58a8('0x1a')]||null;this[_0x58a8('0x1b')]=_0x2b35d4[_0x58a8('0x1b')]?_0x2b35d4[_0x58a8('0x1b')]:null;this[_0x58a8('0x1c')]=_0x2b35d4['dialActive'];this[_0x58a8('0x1d')]=_0x2b35d4['dialMethod']||_0x58a8('0x1e');this[_0x58a8('0x1f')]=_0x2b35d4[_0x58a8('0x1f')]||0x0;this[_0x58a8('0x20')]=_0x2b35d4[_0x58a8('0x20')]||0x0;this[_0x58a8('0x21')]=_0x2b35d4['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x2b35d4[_0x58a8('0x22')]||_0x58a8('0x23');this[_0x58a8('0x24')]=_0x2b35d4[_0x58a8('0x24')]||0.03;this[_0x58a8('0x25')]=_0x2b35d4[_0x58a8('0x25')]||0x258;this[_0x58a8('0x26')]=_0x2b35d4[_0x58a8('0x26')]||_0x58a8('0x27');this[_0x58a8('0x28')]=_0x2b35d4['dialOriginateCallerIdNumber']||_0x58a8('0x27');this['dialOriginateTimeout']=_0x2b35d4[_0x58a8('0x29')]||0x1e;this['dialQueueOptions']=_0x2b35d4[_0x58a8('0x2a')]||_0x58a8('0x2b');this[_0x58a8('0x2c')]=_0x2b35d4[_0x58a8('0x2c')]||0x3;this[_0x58a8('0x2d')]=_0x2b35d4['dialQueueProject']||undefined;this[_0x58a8('0x2e')]=_0x2b35d4[_0x58a8('0x2e')]||0x3;this[_0x58a8('0x2f')]=_0x2b35d4[_0x58a8('0x2f')]||0x96;this['dialBusyMaxRetry']=_0x2b35d4['dialBusyMaxRetry']||0x3;this[_0x58a8('0x30')]=_0x2b35d4[_0x58a8('0x30')]||0x96;this['dialNoAnswerMaxRetry']=_0x2b35d4[_0x58a8('0x31')]||0x3;this[_0x58a8('0x32')]=_0x2b35d4[_0x58a8('0x32')]||0x96;this[_0x58a8('0x33')]=_0x2b35d4[_0x58a8('0x33')]||0x3;this[_0x58a8('0x34')]=_0x2b35d4[_0x58a8('0x34')]||0x96;this[_0x58a8('0x35')]=_0x2b35d4['dialDropMaxRetry']||0x3;this[_0x58a8('0x36')]=_0x2b35d4[_0x58a8('0x36')]||0x96;this[_0x58a8('0x37')]=_0x2b35d4[_0x58a8('0x37')]||0x3;this[_0x58a8('0x38')]=_0x2b35d4['dialAbandonedRetryFrequency']||0x96;this[_0x58a8('0x39')]=_0x2b35d4[_0x58a8('0x39')]||0x3;this[_0x58a8('0x3a')]=_0x2b35d4[_0x58a8('0x3a')]||0x96;this['dialAgentRejectMaxRetry']=_0x2b35d4[_0x58a8('0x3b')]||0x3;this[_0x58a8('0x3c')]=_0x2b35d4[_0x58a8('0x3c')]||0x96;this[_0x58a8('0x3d')]=_0x2b35d4[_0x58a8('0x3d')]||0x4;this['Trunk']=_0x2b35d4[_0x58a8('0x3e')]?_0x2b35d4['Trunk']:undefined;this['TrunkBackup']=_0x2b35d4['TrunkBackup']?_0x2b35d4['TrunkBackup']:undefined;this[_0x58a8('0x3f')]=_0x2b35d4['dialPrefix']||undefined;this[_0x58a8('0x40')]=_0x2b35d4[_0x58a8('0x40')]?_0x2b35d4[_0x58a8('0x40')]:undefined;this[_0x58a8('0x41')]=_0x2b35d4[_0x58a8('0x41')]||_0x58a8('0x42');this[_0x58a8('0x43')]=_0x2b35d4[_0x58a8('0x43')]||undefined;this[_0x58a8('0x44')]=_0x2b35d4[_0x58a8('0x44')]||undefined;this[_0x58a8('0x45')]=strategy[_0x2b35d4[_0x58a8('0x45')]]||_0x58a8('0x46');this[_0x58a8('0x47')]=!![];this[_0x58a8('0x48')]=_0x2b35d4[_0x58a8('0x48')]||![];this[_0x58a8('0x49')]=_0x2b35d4['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x2b35d4['dialAMDGreeting'];this[_0x58a8('0x4a')]=_0x2b35d4['dialAMDAfterGreetingSilence'];this[_0x58a8('0x4b')]=_0x2b35d4[_0x58a8('0x4b')];this[_0x58a8('0x4c')]=_0x2b35d4[_0x58a8('0x4c')];this['dialAMDBetweenWordsSilence']=_0x2b35d4[_0x58a8('0x4d')];this[_0x58a8('0x4e')]=_0x2b35d4[_0x58a8('0x4e')];this[_0x58a8('0x4f')]=_0x2b35d4[_0x58a8('0x4f')];this['dialAMDMaximumWordLength']=_0x2b35d4[_0x58a8('0x50')];this[_0x58a8('0x51')]=0x0;this['pTalking']=0x0;this[_0x58a8('0x52')]=_0x2b35d4[_0x58a8('0x52')];this[_0x58a8('0x53')]=0x0;this[_0x58a8('0x54')]=0x0;this[_0x58a8('0x55')]=0x0;this[_0x58a8('0x56')]=0x0;this[_0x58a8('0x57')]=0x0;this[_0x58a8('0x58')]=0x0;this[_0x58a8('0x59')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x58a8('0x5a')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x58a8('0x5b')]=0x0;this[_0x58a8('0x5c')]=0x0;this[_0x58a8('0x5d')]=0x0;this[_0x58a8('0x5e')]=0x0;this[_0x58a8('0x5f')]=undefined;this['startPredictive']=undefined;this[_0x58a8('0x60')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x58a8('0x61')]=0x0;this[_0x58a8('0x62')]=0x0;this[_0x58a8('0x63')]=0x0;this[_0x58a8('0x64')]=0x0;this[_0x58a8('0x65')]=0x0;this[_0x58a8('0x66')]=0x0;this[_0x58a8('0x67')]=0x0;this[_0x58a8('0x68')]=0x0;this[_0x58a8('0x69')]=_0x2b35d4[_0x58a8('0x6a')]||0x14;this[_0x58a8('0x6b')]=_0x2b35d4[_0x58a8('0x6a')]||0xa;this[_0x58a8('0x6c')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x58a8('0x6d')]=0x1;this[_0x58a8('0x6e')]=0x0;this[_0x58a8('0x6f')]=0x0;this[_0x58a8('0x70')]=0x0;this[_0x58a8('0x71')]=0x0;this[_0x58a8('0x72')]=_0x2b35d4[_0x58a8('0x72')]||0x1e;this[_0x58a8('0x73')]=_0x2b35d4[_0x58a8('0x73')]||![];this['dialQueueProject2']=_0x2b35d4['dialQueueProject2']||undefined;this[_0x58a8('0x74')]=_0x2b35d4['dialAgiAfterHangupClient']||![];this[_0x58a8('0x75')]=_0x2b35d4[_0x58a8('0x75')]||![];this[_0x58a8('0x9')]=monitorFormat[_0x2b35d4[_0x58a8('0x9')]]?monitorFormat[_0x2b35d4[_0x58a8('0x9')]]:undefined;this[_0x58a8('0x76')]=_0x2b35d4['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x2b35d4[_0x58a8('0x77')]?_0x2b35d4[_0x58a8('0x77')]:undefined;}module[_0x58a8('0x78')]=VoiceQueue; \ No newline at end of file +var _0xc165=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','wav','gsm','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','sumDuration','sumHoldTime','unmanaged','abandoned','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject'];(function(_0x274ae7,_0xe88de2){var _0x2ead35=function(_0x1221b6){while(--_0x1221b6){_0x274ae7['push'](_0x274ae7['shift']());}};_0x2ead35(++_0xe88de2);}(_0xc165,0x199));var _0x5c16=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xc165[_0x1da04e];return _0xdd8c41;};'use strict';var statusDesc=[_0x5c16('0x0'),_0x5c16('0x1'),_0x5c16('0x2'),_0x5c16('0x3'),_0x5c16('0x4'),_0x5c16('0x5'),'ringing',_0x5c16('0x6'),_0x5c16('0x7')];var monitorFormat={'wav':_0x5c16('0x8'),'wav49':'wav49','gsm':_0x5c16('0x9')};var strategy={'rrmemory':_0x5c16('0xa'),'roundrobin':'roundrobin'};function VoiceQueue(_0x27ba5b){this['id']=_0x27ba5b['id']||0x0;this[_0x5c16('0xb')]=_0x27ba5b[_0x5c16('0xb')]||'';this[_0x5c16('0xc')]=_0x27ba5b[_0x5c16('0xc')]||'';this['type']=_0x27ba5b[_0x5c16('0xd')]||_0x5c16('0xe');this[_0x5c16('0xf')]=0x0;this[_0x5c16('0x10')]=0x0;this[_0x5c16('0x11')]=0x0;this['answered']=0x0;this[_0x5c16('0x12')]=0x0;this[_0x5c16('0x13')]=0x0;this['sumBillable']=0x0;this[_0x5c16('0x14')]=0x0;this[_0x5c16('0x15')]=0x0;this['loggedIn']=0x0;this[_0x5c16('0x16')]=0x0;this[_0x5c16('0x17')]=_0x27ba5b['acw']||![];this[_0x5c16('0x18')]=_0x27ba5b[_0x5c16('0x18')]||0xa;this[_0x5c16('0x19')]=_0x27ba5b[_0x5c16('0x19')]||'no';this['sendMessageOneNotActive']=!![];this[_0x5c16('0x1a')]='';this[_0x5c16('0x1b')]=0x0;this[_0x5c16('0x1c')]=0x0;this[_0x5c16('0x1d')]=_0x27ba5b['dialTimezone']||null;this[_0x5c16('0x1e')]=_0x27ba5b[_0x5c16('0x1e')]?_0x27ba5b[_0x5c16('0x1e')]:null;this[_0x5c16('0x1f')]=_0x27ba5b[_0x5c16('0x1f')];this[_0x5c16('0x20')]=_0x27ba5b[_0x5c16('0x20')]||_0x5c16('0x21');this['dialLimitChannel']=_0x27ba5b[_0x5c16('0x22')]||0x0;this[_0x5c16('0x23')]=_0x27ba5b[_0x5c16('0x23')]||0x0;this[_0x5c16('0x24')]=_0x27ba5b['dialPowerLevel']||0x1;this[_0x5c16('0x25')]=_0x27ba5b[_0x5c16('0x25')]||_0x5c16('0x26');this[_0x5c16('0x27')]=_0x27ba5b[_0x5c16('0x27')]||0.03;this['dialPredictiveInterval']=_0x27ba5b[_0x5c16('0x28')]||0x258;this[_0x5c16('0x29')]=_0x27ba5b[_0x5c16('0x29')]||_0x5c16('0x2a');this['dialOriginateCallerIdNumber']=_0x27ba5b['dialOriginateCallerIdNumber']||_0x5c16('0x2a');this[_0x5c16('0x2b')]=_0x27ba5b[_0x5c16('0x2b')]||0x1e;this['dialQueueOptions']=_0x27ba5b[_0x5c16('0x2c')]||'tTxX';this[_0x5c16('0x2d')]=_0x27ba5b[_0x5c16('0x2d')]||0x3;this[_0x5c16('0x2e')]=_0x27ba5b[_0x5c16('0x2e')]||undefined;this[_0x5c16('0x2f')]=_0x27ba5b[_0x5c16('0x2f')]||0x3;this[_0x5c16('0x30')]=_0x27ba5b[_0x5c16('0x30')]||0x96;this[_0x5c16('0x31')]=_0x27ba5b[_0x5c16('0x31')]||0x3;this[_0x5c16('0x32')]=_0x27ba5b[_0x5c16('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x27ba5b['dialNoAnswerMaxRetry']||0x3;this[_0x5c16('0x33')]=_0x27ba5b[_0x5c16('0x33')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x27ba5b['dialNoSuchNumberMaxRetry']||0x3;this[_0x5c16('0x34')]=_0x27ba5b[_0x5c16('0x34')]||0x96;this['dialDropMaxRetry']=_0x27ba5b[_0x5c16('0x35')]||0x3;this['dialDropRetryFrequency']=_0x27ba5b[_0x5c16('0x36')]||0x96;this[_0x5c16('0x37')]=_0x27ba5b[_0x5c16('0x37')]||0x3;this[_0x5c16('0x38')]=_0x27ba5b[_0x5c16('0x38')]||0x96;this['dialMachineMaxRetry']=_0x27ba5b['dialMachineMaxRetry']||0x3;this[_0x5c16('0x39')]=_0x27ba5b[_0x5c16('0x39')]||0x96;this[_0x5c16('0x3a')]=_0x27ba5b[_0x5c16('0x3a')]||0x3;this[_0x5c16('0x3b')]=_0x27ba5b[_0x5c16('0x3b')]||0x96;this[_0x5c16('0x3c')]=_0x27ba5b['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x27ba5b[_0x5c16('0x3d')]?_0x27ba5b[_0x5c16('0x3d')]:undefined;this['TrunkBackup']=_0x27ba5b[_0x5c16('0x3e')]?_0x27ba5b[_0x5c16('0x3e')]:undefined;this[_0x5c16('0x3f')]=_0x27ba5b[_0x5c16('0x3f')]||undefined;this[_0x5c16('0x40')]=_0x27ba5b[_0x5c16('0x40')]?_0x27ba5b[_0x5c16('0x40')]:undefined;this[_0x5c16('0x41')]=_0x27ba5b[_0x5c16('0x41')]||_0x5c16('0x42');this[_0x5c16('0x43')]=_0x27ba5b[_0x5c16('0x43')]||undefined;this[_0x5c16('0x44')]=_0x27ba5b[_0x5c16('0x44')]||undefined;this[_0x5c16('0x45')]=strategy[_0x27ba5b[_0x5c16('0x45')]]||_0x5c16('0xa');this[_0x5c16('0x46')]=!![];this[_0x5c16('0x47')]=_0x27ba5b[_0x5c16('0x47')]||![];this['dialAMDInitialSilence']=_0x27ba5b[_0x5c16('0x48')];this['dialAMDGreeting']=_0x27ba5b[_0x5c16('0x49')];this['dialAMDAfterGreetingSilence']=_0x27ba5b[_0x5c16('0x4a')];this['dialAMDTotalAnalysisTime']=_0x27ba5b[_0x5c16('0x4b')];this[_0x5c16('0x4c')]=_0x27ba5b[_0x5c16('0x4c')];this[_0x5c16('0x4d')]=_0x27ba5b['dialAMDBetweenWordsSilence'];this[_0x5c16('0x4e')]=_0x27ba5b[_0x5c16('0x4e')];this[_0x5c16('0x4f')]=_0x27ba5b[_0x5c16('0x4f')];this[_0x5c16('0x50')]=_0x27ba5b[_0x5c16('0x50')];this[_0x5c16('0x51')]=0x0;this[_0x5c16('0x52')]=0x0;this[_0x5c16('0x53')]=_0x27ba5b[_0x5c16('0x53')];this[_0x5c16('0x54')]=0x0;this[_0x5c16('0x55')]=0x0;this[_0x5c16('0x56')]=0x0;this[_0x5c16('0x57')]=0x0;this[_0x5c16('0x58')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x5c16('0x59')]=0x0;this[_0x5c16('0x5a')]=0x0;this[_0x5c16('0x5b')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x5c16('0x5c')]=0x0;this[_0x5c16('0x5d')]=0x0;this[_0x5c16('0x5e')]=0x0;this['startProgressive']=undefined;this[_0x5c16('0x5f')]=undefined;this[_0x5c16('0x60')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x5c16('0x61')]=0x0;this[_0x5c16('0x62')]=0x0;this[_0x5c16('0x63')]=0x0;this[_0x5c16('0x64')]=0x0;this[_0x5c16('0x65')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x5c16('0x66')]=0x0;this['predictiveIntervalMaxThreshold']=_0x27ba5b['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x5c16('0x67')]=_0x27ba5b[_0x5c16('0x68')]||0xa;this[_0x5c16('0x69')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0x5c16('0x6a')]=0x0;this[_0x5c16('0x6b')]=0x0;this['dialRecallMeTimeout']=_0x27ba5b[_0x5c16('0x6c')]||0x1e;this['dialRecallInQueue']=_0x27ba5b['dialRecallInQueue']||![];this[_0x5c16('0x6d')]=_0x27ba5b[_0x5c16('0x6d')]||undefined;this[_0x5c16('0x6e')]=_0x27ba5b[_0x5c16('0x6e')]||![];this['dialAgiAfterHangupAgent']=_0x27ba5b['dialAgiAfterHangupAgent']||![];this[_0x5c16('0xc')]=monitorFormat[_0x27ba5b[_0x5c16('0xc')]]?monitorFormat[_0x27ba5b[_0x5c16('0xc')]]:undefined;this['mandatoryDisposition']=_0x27ba5b[_0x5c16('0x6f')]||![];this[_0x5c16('0x70')]=_0x27ba5b[_0x5c16('0x70')]?_0x27ba5b['mandatoryDispositionPause']:undefined;}module[_0x5c16('0x71')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index b9507ad..9cce647 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 _0xd67a=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x527e65,_0x20c73f){var _0x22286d=function(_0x6ab45){while(--_0x6ab45){_0x527e65['push'](_0x527e65['shift']());}};_0x22286d(++_0x20c73f);}(_0xd67a,0x160));var _0xad67=function(_0x23f51c,_0x5decb0){_0x23f51c=_0x23f51c-0x0;var _0x40063e=_0xd67a[_0x23f51c];return _0x40063e;};'use strict';function VtigerAccount(_0x4300b4){this['id']=_0x4300b4['id']||0x0;this[_0xad67('0x0')]=_0x4300b4[_0xad67('0x0')]||'';this['username']=_0x4300b4[_0xad67('0x1')]||'';this['accessKey']=_0x4300b4[_0xad67('0x2')]||'';this[_0xad67('0x3')]=_0x4300b4[_0xad67('0x3')]||'';this[_0xad67('0x4')]=_0x4300b4['serverUrl']||'';this[_0xad67('0x5')]=_0x4300b4[_0xad67('0x5')]||{};}module[_0xad67('0x6')]=VtigerAccount; \ No newline at end of file +var _0xb0a4=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb0a4,0x127));var _0x4b0a=function(_0x408ab5,_0xc1b5a6){_0x408ab5=_0x408ab5-0x0;var _0x8550c=_0xb0a4[_0x408ab5];return _0x8550c;};'use strict';function VtigerAccount(_0x13308a){this['id']=_0x13308a['id']||0x0;this[_0x4b0a('0x0')]=_0x13308a[_0x4b0a('0x0')]||'';this[_0x4b0a('0x1')]=_0x13308a['username']||'';this[_0x4b0a('0x2')]=_0x13308a[_0x4b0a('0x2')]||'';this[_0x4b0a('0x3')]=_0x13308a['remoteUri']||'';this[_0x4b0a('0x4')]=_0x13308a['serverUrl']||'';this[_0x4b0a('0x5')]=_0x13308a[_0x4b0a('0x5')]||{};}module[_0x4b0a('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 ce5ce4d..772aed2 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 _0xac33=['token','remoteUri','authType','type','serverUrl','Configurations','exports','name','username','password'];(function(_0x10e840,_0x5b3935){var _0x405caa=function(_0x46b707){while(--_0x46b707){_0x10e840['push'](_0x10e840['shift']());}};_0x405caa(++_0x5b3935);}(_0xac33,0x151));var _0x3ac3=function(_0x937aa9,_0x47613c){_0x937aa9=_0x937aa9-0x0;var _0x53a038=_0xac33[_0x937aa9];return _0x53a038;};'use strict';function ZendeskAccount(_0x45b3ea){this['id']=_0x45b3ea['id']||0x0;this[_0x3ac3('0x0')]=_0x45b3ea['name']||'';this['username']=_0x45b3ea[_0x3ac3('0x1')]||'';this['password']=_0x45b3ea[_0x3ac3('0x2')]||'';this[_0x3ac3('0x3')]=_0x45b3ea[_0x3ac3('0x3')]||'';this['remoteUri']=_0x45b3ea[_0x3ac3('0x4')]||'';this[_0x3ac3('0x5')]=_0x45b3ea[_0x3ac3('0x5')]||'';this[_0x3ac3('0x6')]=_0x45b3ea[_0x3ac3('0x6')]||'integrationTab';this[_0x3ac3('0x7')]=_0x45b3ea[_0x3ac3('0x7')]||'';this['Configurations']=_0x45b3ea[_0x3ac3('0x8')]||{};}module[_0x3ac3('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x03b5=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x249ebf,_0x49de0b){var _0x5ab9cf=function(_0x5cdd65){while(--_0x5cdd65){_0x249ebf['push'](_0x249ebf['shift']());}};_0x5ab9cf(++_0x49de0b);}(_0x03b5,0x1a6));var _0x503b=function(_0x1cfe9a,_0x134cac){_0x1cfe9a=_0x1cfe9a-0x0;var _0x12f822=_0x03b5[_0x1cfe9a];return _0x12f822;};'use strict';function ZendeskAccount(_0x312c66){this['id']=_0x312c66['id']||0x0;this[_0x503b('0x0')]=_0x312c66[_0x503b('0x0')]||'';this['username']=_0x312c66[_0x503b('0x1')]||'';this[_0x503b('0x2')]=_0x312c66['password']||'';this[_0x503b('0x3')]=_0x312c66[_0x503b('0x3')]||'';this[_0x503b('0x4')]=_0x312c66[_0x503b('0x4')]||'';this[_0x503b('0x5')]=_0x312c66[_0x503b('0x5')]||'';this[_0x503b('0x6')]=_0x312c66[_0x503b('0x6')]||_0x503b('0x7');this[_0x503b('0x8')]=_0x312c66[_0x503b('0x8')]||'';this[_0x503b('0x9')]=_0x312c66[_0x503b('0x9')]||{};}module[_0x503b('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 bb8af97..d5db377 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 _0x516f=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x13623f,_0x12f3e5){var _0x26b734=function(_0x169632){while(--_0x169632){_0x13623f['push'](_0x13623f['shift']());}};_0x26b734(++_0x12f3e5);}(_0x516f,0x149));var _0xf516=function(_0x50d08a,_0x56eedc){_0x50d08a=_0x50d08a-0x0;var _0x1cd49a=_0x516f[_0x50d08a];return _0x1cd49a;};'use strict';function ZohoAccount(_0x4a6adf){this['id']=_0x4a6adf['id']||0x0;this[_0xf516('0x0')]=_0x4a6adf[_0xf516('0x0')]||'';this['description']=_0x4a6adf[_0xf516('0x1')]||'';this['host']=_0x4a6adf[_0xf516('0x2')]||'';this[_0xf516('0x3')]=_0x4a6adf['zone']||'';this['clientId']=_0x4a6adf[_0xf516('0x4')]||'';this[_0xf516('0x5')]=_0x4a6adf[_0xf516('0x5')]||'';this[_0xf516('0x6')]=_0x4a6adf[_0xf516('0x6')]||'';this[_0xf516('0x7')]=_0x4a6adf[_0xf516('0x7')]||'';this[_0xf516('0x8')]=_0x4a6adf[_0xf516('0x8')]||'';this[_0xf516('0x9')]=_0x4a6adf['Configurations']||{};}module[_0xf516('0xa')]=ZohoAccount; \ No newline at end of file +var _0x713e=['serverUrl','refreshToken','Configurations','exports','name','description','host','clientId','clientSecret'];(function(_0x1192bc,_0x2e63d2){var _0x1cb479=function(_0x47fe6e){while(--_0x47fe6e){_0x1192bc['push'](_0x1192bc['shift']());}};_0x1cb479(++_0x2e63d2);}(_0x713e,0x1b4));var _0xe713=function(_0x336092,_0x22c0e1){_0x336092=_0x336092-0x0;var _0x57c708=_0x713e[_0x336092];return _0x57c708;};'use strict';function ZohoAccount(_0x294d09){this['id']=_0x294d09['id']||0x0;this['name']=_0x294d09[_0xe713('0x0')]||'';this[_0xe713('0x1')]=_0x294d09['description']||'';this[_0xe713('0x2')]=_0x294d09[_0xe713('0x2')]||'';this['zone']=_0x294d09['zone']||'';this['clientId']=_0x294d09[_0xe713('0x3')]||'';this[_0xe713('0x4')]=_0x294d09[_0xe713('0x4')]||'';this[_0xe713('0x5')]=_0x294d09['serverUrl']||'';this['code']=_0x294d09['code']||'';this[_0xe713('0x6')]=_0x294d09[_0xe713('0x6')]||'';this[_0xe713('0x7')]=_0x294d09[_0xe713('0x7')]||{};}module[_0xe713('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index c01a4b9..75f6dab 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 _0xc2a3=['ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xc2a3,0x69));var _0x3c2a=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0xc2a3[_0x29dda1];return _0x21b0ef;};'use strict';var util=require(_0x3c2a('0x0'));var _=require(_0x3c2a('0x1'));var moment=require(_0x3c2a('0x2'));function checkNameSurname(_0x533d01,_0x4471ac,_0x18c816){var _0x3f7a80='';if(!_[_0x3c2a('0x3')](_0x4471ac)&&_0x3c2a('0x4')===typeof _0x4471ac){_0x3f7a80+=_0x4471ac;}if(!_[_0x3c2a('0x3')](_0x18c816)&&_0x3c2a('0x4')===typeof _0x18c816){_0x3f7a80+='\x20'+_0x18c816;}if(_0x3f7a80!==''){return _0x3f7a80;}return _0x533d01;}function Action(_0x4a62a7,_0x3d336a,_0x254899,_0x391f18,_0x29d2fb){this[_0x3c2a('0x5')]=_0x254899||undefined;this[_0x3c2a('0x6')]=_0x4a62a7['id'];this[_0x3c2a('0x7')]=_0x3d336a[_0x3c2a('0x8')];this[_0x3c2a('0x9')]=_0x3d336a[_0x3c2a('0x9')];this[_0x3c2a('0xa')]='queue';this[_0x3c2a('0xb')]=![];this[_0x3c2a('0xc')]=_[_0x3c2a('0x3')](_0x4a62a7[_0x3c2a('0xd')])?undefined:_0x4a62a7[_0x3c2a('0xd')][_0x3c2a('0x8')];this['channelAgent']=this['membername']?util[_0x3c2a('0xe')](_0x3c2a('0xf'),this[_0x3c2a('0xc')]):_0x391f18||undefined;this['calleridname']=checkNameSurname(_0x4a62a7['Contact'][_0x3c2a('0x10')],_0x4a62a7[_0x3c2a('0x11')][_0x3c2a('0x12')],_0x4a62a7[_0x3c2a('0x11')][_0x3c2a('0x13')]);this[_0x3c2a('0x14')]=_0x4a62a7[_0x3c2a('0x14')]||![];this[_0x3c2a('0x15')]=_0x4a62a7['Contact'][_0x3c2a('0x10')];this[_0x3c2a('0x16')]=_0x4a62a7[_0x3c2a('0x16')];this[_0x3c2a('0x17')]=_0x4a62a7[_0x3c2a('0x17')]||0x0;this[_0x3c2a('0x18')]=_0x4a62a7[_0x3c2a('0x18')]||0x0;this[_0x3c2a('0x19')]=_0x4a62a7['countnoanswerretry']||0x0;this[_0x3c2a('0x1a')]=(_0x4a62a7[_0x3c2a('0x17')]||0x0)+(_0x4a62a7['countcongestionretry']||0x0)+(_0x4a62a7[_0x3c2a('0x19')]||0x0)+(_0x4a62a7[_0x3c2a('0x1b')]||0x0)+(_0x4a62a7[_0x3c2a('0x1c')]||0x0)+(_0x4a62a7[_0x3c2a('0x1d')]||0x0)+(_0x4a62a7['countmachineretry']||0x0)+(_0x4a62a7[_0x3c2a('0x1e')]||0x0);this[_0x3c2a('0x1b')]=_0x4a62a7[_0x3c2a('0x1b')]||0x0;this[_0x3c2a('0x1c')]=_0x4a62a7[_0x3c2a('0x1c')]||0x0;this[_0x3c2a('0x1d')]=_0x4a62a7[_0x3c2a('0x1d')]||0x0;this[_0x3c2a('0x1f')]=_0x4a62a7[_0x3c2a('0x1f')]||0x0;this[_0x3c2a('0x1e')]=_0x4a62a7[_0x3c2a('0x1e')]||0x0;this[_0x3c2a('0x20')]=_0x4a62a7['callback'];this[_0x3c2a('0x21')]=_0x4a62a7['callbackuniqueid'];this[_0x3c2a('0x22')]=_0x4a62a7[_0x3c2a('0x22')];this[_0x3c2a('0x23')]=_0x4a62a7['recallme'];this[_0x3c2a('0x24')]=_0x4a62a7[_0x3c2a('0x24')];this[_0x3c2a('0x25')]=_0x4a62a7[_0x3c2a('0x25')];this[_0x3c2a('0x26')]=_['isNil'](_0x4a62a7[_0x3c2a('0xd')])?_0x4a62a7[_0x3c2a('0x26')]:_0x4a62a7[_0x3c2a('0xd')]['id'];this[_0x3c2a('0x27')]=_0x4a62a7['VoiceQueueId'];this[_0x3c2a('0x28')]='';this[_0x3c2a('0x29')]='';}Action[_0x3c2a('0x2a')][_0x3c2a('0x2b')]=function(){return util['format'](_0x3c2a('0x2c'),this['calleridname'],this[_0x3c2a('0x2d')]);};module[_0x3c2a('0x2e')]=Action; \ No newline at end of file +var _0xd59c=['getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype','membername','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','Agent','VoiceQueueId','originatecalleridnum'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0xd59c,0xe1));var _0xcd59=function(_0x1db98d,_0x5829cf){_0x1db98d=_0x1db98d-0x0;var _0x523bf0=_0xd59c[_0x1db98d];return _0x523bf0;};'use strict';var util=require(_0xcd59('0x0'));var _=require(_0xcd59('0x1'));var moment=require(_0xcd59('0x2'));function checkNameSurname(_0x3fa913,_0x52e903,_0x314acc){var _0x3f15bc='';if(!_[_0xcd59('0x3')](_0x52e903)&&_0xcd59('0x4')===typeof _0x52e903){_0x3f15bc+=_0x52e903;}if(!_[_0xcd59('0x3')](_0x314acc)&&'string'===typeof _0x314acc){_0x3f15bc+='\x20'+_0x314acc;}if(_0x3f15bc!==''){return _0x3f15bc;}return _0x3fa913;}function Action(_0x22862d,_0x5ae29b,_0x421769,_0x4c7b73,_0x4c15f4){this[_0xcd59('0x5')]=_0x421769||undefined;this['idContact']=_0x22862d['id'];this[_0xcd59('0x6')]=_0x5ae29b[_0xcd59('0x7')];this[_0xcd59('0x8')]=_0x5ae29b[_0xcd59('0x8')];this[_0xcd59('0x9')]='queue';this['dialAnswer']=![];this[_0xcd59('0xa')]=_['isNil'](_0x22862d['Agent'])?undefined:_0x22862d['Agent'][_0xcd59('0x7')];this['channelAgent']=this[_0xcd59('0xa')]?util[_0xcd59('0xb')](_0xcd59('0xc'),this[_0xcd59('0xa')]):_0x4c7b73||undefined;this['calleridname']=checkNameSurname(_0x22862d[_0xcd59('0xd')][_0xcd59('0xe')],_0x22862d[_0xcd59('0xd')][_0xcd59('0xf')],_0x22862d[_0xcd59('0xd')][_0xcd59('0x10')]);this[_0xcd59('0x11')]=_0x22862d['active']||![];this[_0xcd59('0x12')]=_0x22862d[_0xcd59('0xd')][_0xcd59('0xe')];this[_0xcd59('0x13')]=_0x22862d[_0xcd59('0x13')];this['countbusyretry']=_0x22862d['countbusyretry']||0x0;this[_0xcd59('0x14')]=_0x22862d[_0xcd59('0x14')]||0x0;this[_0xcd59('0x15')]=_0x22862d[_0xcd59('0x15')]||0x0;this[_0xcd59('0x16')]=(_0x22862d[_0xcd59('0x17')]||0x0)+(_0x22862d[_0xcd59('0x14')]||0x0)+(_0x22862d[_0xcd59('0x15')]||0x0)+(_0x22862d[_0xcd59('0x18')]||0x0)+(_0x22862d['countdropretry']||0x0)+(_0x22862d[_0xcd59('0x19')]||0x0)+(_0x22862d[_0xcd59('0x1a')]||0x0)+(_0x22862d[_0xcd59('0x1b')]||0x0);this[_0xcd59('0x18')]=_0x22862d['countnosuchnumberretry']||0x0;this[_0xcd59('0x1c')]=_0x22862d[_0xcd59('0x1c')]||0x0;this[_0xcd59('0x19')]=_0x22862d[_0xcd59('0x19')]||0x0;this[_0xcd59('0x1a')]=_0x22862d[_0xcd59('0x1a')]||0x0;this['countagentrejectretry']=_0x22862d['countagentrejectretry']||0x0;this[_0xcd59('0x1d')]=_0x22862d['callback'];this[_0xcd59('0x1e')]=_0x22862d[_0xcd59('0x1e')];this[_0xcd59('0x1f')]=_0x22862d[_0xcd59('0x1f')];this[_0xcd59('0x20')]=_0x22862d[_0xcd59('0x20')];this[_0xcd59('0x21')]=_0x22862d['ContactId'];this['ListId']=_0x22862d[_0xcd59('0x22')];this[_0xcd59('0x23')]=_[_0xcd59('0x3')](_0x22862d[_0xcd59('0x24')])?_0x22862d[_0xcd59('0x23')]:_0x22862d['Agent']['id'];this[_0xcd59('0x25')]=_0x22862d[_0xcd59('0x25')];this[_0xcd59('0x26')]='';this['originatecalleridname']='';}Action['prototype'][_0xcd59('0x27')]=function(){return util['format'](_0xcd59('0x28'),this[_0xcd59('0x29')],this[_0xcd59('0x2a')]);};module[_0xcd59('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index abc7945..0d60f27 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 _0x232a=['logger2','[getContactRecallMe]','IsNotLoggedIn','NOT_ACTIVE','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','createCustomerFinal','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','buildAcw','custom:agentcomplete','buildObj','complete','total','decrementTalkink','Answer','[callProgressDetectingCustomer][logAnswer]','talktime','[syncHangup][talking][decrement]','BUSY','custom:agentbusy','busy','cloneAction','Global','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','scheduledAt','dialBusyRetryFrequency','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','Busy','[callProgressDetectingAgent][logCongestion]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','unlockContact','disableContact','execRun','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','TrunkBackup','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','calleridnum','user:%s','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','./rpcDb','defaults','localhost','socket.io-emitter','redis','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','talking','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','message','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','type','clearZombieChannels','setMessage','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]'];(function(_0x3a93ed,_0x2c7ab6){var _0x3453c5=function(_0x4e0d4c){while(--_0x4e0d4c){_0x3a93ed['push'](_0x3a93ed['shift']());}};_0x3453c5(++_0x2c7ab6);}(_0x232a,0xb9));var _0xa232=function(_0x209a02,_0x570eac){_0x209a02=_0x209a02-0x0;var _0x4b9745=_0x232a[_0x209a02];return _0x4b9745;};'use strict';var util=require(_0xa232('0x0'));var _=require('lodash');var BPromise=require(_0xa232('0x1'));var uuid=require(_0xa232('0x2'));var moment=require(_0xa232('0x3'));var md5=require(_0xa232('0x4'));var Redis=require('ioredis');var config=require(_0xa232('0x5'));var logger=require(_0xa232('0x6'))(_0xa232('0x7'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require('../ami');var rpcDb=require(_0xa232('0x8'));var Action=require('./action');var ut=require('./util/util');config['redis']=_[_0xa232('0x9')](config['redis'],{'host':_0xa232('0xa'),'port':0x18eb});var io=require(_0xa232('0xb'))(new Redis(config[_0xa232('0xc')]));var Sequence=function(){};Sequence[_0xa232('0xd')][_0xa232('0xe')]=function(_0x58c44b){this['tail']=this[_0xa232('0xf')]?this[_0xa232('0xf')][_0xa232('0x10')](_0x58c44b):_0x58c44b();};function Preview(_0x8495a){this[_0xa232('0x11')]=new Sequence();this['campaignsPreview']=_0x8495a[_0xa232('0x12')];this[_0xa232('0x13')]=_0x8495a[_0xa232('0x13')];this[_0xa232('0x14')]={};this[_0xa232('0x15')]=_0x8495a[_0xa232('0x15')];this[_0xa232('0x16')]=0x0;ami['on'](_0xa232('0x17'),this[_0xa232('0x18')]['bind'](this));ami['on']('hangup',this[_0xa232('0x19')][_0xa232('0x1a')](this));ami['on'](_0xa232('0x1b'),this[_0xa232('0x1c')][_0xa232('0x1a')](this));ami['on'](_0xa232('0x1d'),this[_0xa232('0x1e')][_0xa232('0x1a')](this));ami['on'](_0xa232('0x1f'),this[_0xa232('0x20')]['bind'](this));ami['on'](_0xa232('0x21'),this[_0xa232('0x22')][_0xa232('0x1a')](this));ami['on'](_0xa232('0x23'),this[_0xa232('0x24')]['bind'](this));ami['on']('blindtransfer',this[_0xa232('0x25')]['bind'](this));this[_0xa232('0x26')](this[_0xa232('0x27')]);}function emit(_0x205db9,_0x589151,_0x4b539b){io['to'](_0x205db9)[_0xa232('0x28')](_0x589151,_0x4b539b);}function emitCampaignPreview(_0x2bf9e7){if(_0x2bf9e7['type']===_0xa232('0x29')){var _0x39a8f5={'id':_0x2bf9e7['id'],'name':_0x2bf9e7[_0xa232('0x2a')],'strategy':_0x2bf9e7[_0xa232('0x2b')],'answered':_0x2bf9e7[_0xa232('0x2c')],'available':_0x2bf9e7['available'],'loggedIn':_0x2bf9e7[_0xa232('0x2d')],'pTalking':_0x2bf9e7[_0xa232('0x2e')],'sumBillable':_0x2bf9e7[_0xa232('0x2f')],'sumDuration':_0x2bf9e7[_0xa232('0x30')],'sumHoldTime':_0x2bf9e7['sumHoldTime']||0x0,'talking':_0x2bf9e7[_0xa232('0x31')],'total':_0x2bf9e7['total'],'type':_0x2bf9e7['type'],'unmanaged':_0x2bf9e7['unmanaged'],'abandoned':_0x2bf9e7[_0xa232('0x32')],'waiting':_0x2bf9e7[_0xa232('0x33')],'loggedInDb':_0x2bf9e7[_0xa232('0x34')],'dialActive':_0x2bf9e7[_0xa232('0x35')],'dialMethod':_0x2bf9e7[_0xa232('0x36')],'dialOriginateCallerIdName':_0x2bf9e7[_0xa232('0x37')],'dialOriginateCallerIdNumber':_0x2bf9e7[_0xa232('0x38')],'dialOriginateTimeout':_0x2bf9e7['dialOriginateTimeout'],'dialPrefix':_0x2bf9e7['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2bf9e7[_0xa232('0x39')],'outboundAnswerCallsDay':_0x2bf9e7[_0xa232('0x3a')],'outboundBlacklistCallsDay':_0x2bf9e7[_0xa232('0x3b')],'outboundBusyCallsDay':_0x2bf9e7[_0xa232('0x3c')],'outboundCongestionCallsDay':_0x2bf9e7['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x2bf9e7[_0xa232('0x3d')],'outboundDropCallsDayCallersExit':_0x2bf9e7['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x2bf9e7[_0xa232('0x3e')],'outboundNoAnswerCallsDay':_0x2bf9e7['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x2bf9e7[_0xa232('0x3f')],'outboundOriginateFailureCallsDay':_0x2bf9e7[_0xa232('0x40')],'outboundReCallsDay':_0x2bf9e7['outboundReCallsDay'],'outboundRejectCallsDay':_0x2bf9e7['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2bf9e7[_0xa232('0x41')],'outboundAbandonedCallsDay':_0x2bf9e7[_0xa232('0x42')],'predictiveIntervalAnsweredCalls':_0x2bf9e7['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x2bf9e7['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x2bf9e7[_0xa232('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x2bf9e7[_0xa232('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x2bf9e7[_0xa232('0x45')],'predictiveIntervalErlangCalls':_0x2bf9e7[_0xa232('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x2bf9e7[_0xa232('0x47')],'predictiveIntervalHitRate':_0x2bf9e7[_0xa232('0x48')],'predictiveIntervalMultiplicativeFactor':_0x2bf9e7[_0xa232('0x49')],'predictiveIntervalPauses':_0x2bf9e7[_0xa232('0x4a')],'predictiveIntervalAvailable':_0x2bf9e7[_0xa232('0x4b')],'predictiveIntervalTotalCalls':_0x2bf9e7[_0xa232('0x4c')],'message':_0x2bf9e7['message'],'originated':_0x2bf9e7[_0xa232('0x4d')],'erlangCalls':_0x2bf9e7[_0xa232('0x4e')],'erlangCallToSecond':_0x2bf9e7['erlangCallToSecond'],'erlangAbandonmentRate':_0x2bf9e7['erlangAbandonmentRate'],'erlangBusyFactor':_0x2bf9e7[_0xa232('0x4f')],'startPredictive':_0x2bf9e7[_0xa232('0x50')],'startProgressive':_0x2bf9e7[_0xa232('0x51')]};if(_0x2bf9e7[_0xa232('0x52')]){_0x39a8f5[_0xa232('0x52')]={'id':_0x2bf9e7[_0xa232('0x52')]['id'],'name':_0x2bf9e7['Trunk'][_0xa232('0x2a')],'active':_0x2bf9e7[_0xa232('0x52')][_0xa232('0x53')],'callerid':_0x2bf9e7[_0xa232('0x52')][_0xa232('0x54')]};}if(_0x2bf9e7[_0xa232('0x55')]){_0x39a8f5['Interval']={'id':_0x2bf9e7['Interval']['id'],'name':_0x2bf9e7['Interval'][_0xa232('0x2a')]};}var _0x5d7831=md5(JSON['stringify'](_0x39a8f5));if(_0x2bf9e7[_0xa232('0x4')]!==_0x5d7831){_0x2bf9e7[_0xa232('0x4')]=_0x5d7831;emit(util[_0xa232('0x56')](_0xa232('0x57'),_0x39a8f5[_0xa232('0x2a')]),'voice_queue:save',_0x39a8f5);}}}function emitVoiceQueueChannelRemove(_0x4c45be){logger[_0xa232('0x58')](_0xa232('0x59'),JSON[_0xa232('0x5a')](_0x4c45be));emit(util[_0xa232('0x56')](_0xa232('0x57'),_0x4c45be[_0xa232('0x2a')]),_0xa232('0x5b'),_0x4c45be);io[_0xa232('0x28')](_0xa232('0x5c'),_0x4c45be);}function notSendMessagesQueue(_0x223758){if(_0x223758[_0xa232('0x5d')]){if(_0x223758['originated']===0x0&&_0x223758['pTalking']===0x0){_0x223758['sendMessageOneNotActive']=![];_0x223758[_0xa232('0x5e')]=0x0;_0x223758[_0xa232('0x5f')]=0x0;_0x223758[_0xa232('0x60')]='NOT_ACTIVE';ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x223758['name']+'\x20is\x20not\x20active');}else{_0x223758[_0xa232('0x60')]='IS_DISACTIVED';ut[_0xa232('0x61')](_0xa232('0x62'),_0x223758['name']+_0xa232('0x63'));}emitCampaignPreview(_0x223758);}}Preview['prototype'][_0xa232('0x26')]=function(){var _0x40f122=this;setInterval(function(){_0x40f122[_0xa232('0x64')]();},0x7cf);};Preview[_0xa232('0xd')][_0xa232('0x64')]=function(){var _0x60c089=this[_0xa232('0x27')];this[_0xa232('0x16')]+=0x1;for(var _0x22f224 in _0x60c089){if(_0x60c089[_0xa232('0x65')](_0x22f224)&&(_0x60c089[_0x22f224][_0xa232('0x36')]==='preview'||_0x60c089[_0x22f224][_0xa232('0x36')]===_0xa232('0x66'))&&_0x60c089[_0x22f224][_0xa232('0x67')]===_0xa232('0x29')){if(this[_0xa232('0x16')]>0x7){this[_0xa232('0x16')]=0x0;this[_0xa232('0x68')]();}}if(_0x60c089['hasOwnProperty'](_0x22f224)&&_0x60c089[_0x22f224]['dialMethod']===_0xa232('0x7')&&_0x60c089[_0x22f224][_0xa232('0x67')]==='outbound'){if(_0x60c089[_0x22f224][_0xa232('0x35')]){this[_0xa232('0x69')](_0x60c089[_0x22f224]);this[_0xa232('0x6a')](_0x60c089[_0x22f224]);}else{notSendMessagesQueue(_0x60c089[_0x22f224]);}}}};Preview['prototype'][_0xa232('0x6b')]=function(_0x1b3198){var _0x5bd140=this;this[_0xa232('0x11')]['enqueue'](function(){if(!_['isNil'](_0x5bd140[_0xa232('0x14')][_0x1b3198])){loggerAction[_0xa232('0x58')](_0xa232('0x6c'),_0x1b3198,_0xa232('0x6d'),_0x5bd140['actions'][_0x1b3198][_0xa232('0x6e')],_0xa232('0x6f'),JSON[_0xa232('0x5a')](_0x5bd140[_0xa232('0x27')][_0x5bd140[_0xa232('0x14')][_0x1b3198][_0xa232('0x6e')]][_0xa232('0x4d')]),_0xa232('0x70'),JSON[_0xa232('0x5a')](_0x5bd140[_0xa232('0x27')][_0x5bd140['actions'][_0x1b3198][_0xa232('0x6e')]][_0xa232('0x2e')]),JSON[_0xa232('0x5a')](_0x5bd140[_0xa232('0x14')][_0x1b3198][_0xa232('0x71')]),JSON[_0xa232('0x5a')](_[_0xa232('0x72')](_0x5bd140[_0xa232('0x14')][_0x1b3198],['contactId',_0xa232('0x73'),_0xa232('0x74'),'ListId'])));return ami[_0xa232('0x75')]({'action':'status','channel':_0x5bd140[_0xa232('0x14')][_0x1b3198][_0xa232('0x76')]})[_0xa232('0x77')](function(_0x380056){if(_0x380056[_0xa232('0x60')]===_0xa232('0x78')){setTimeout(function(){if(_0x5bd140[_0xa232('0x14')][_0x1b3198]){ut[_0xa232('0x79')](_0x5bd140[_0xa232('0x27')][_0x5bd140[_0xa232('0x14')][_0x1b3198]['queue']],_0xa232('0x7a'));if(_0x5bd140['actions'][_0x1b3198][_0xa232('0x71')]===!![]){ut['decrementTalkink'](_0x5bd140[_0xa232('0x27')][_0x5bd140[_0xa232('0x14')][_0x1b3198][_0xa232('0x6e')]],_0xa232('0x7a'));ut[_0xa232('0x7b')](_0xa232('0x7c')+_0x1b3198,_0x5bd140[_0xa232('0x14')][_0x1b3198][_0xa232('0x6e')]);}ut[_0xa232('0x7b')]('[Dialer][checkChannel][Preview]'+_0x1b3198,_0x5bd140[_0xa232('0x14')][_0x1b3198][_0xa232('0x6e')]);delete _0x5bd140[_0xa232('0x14')][_0x1b3198];}},0x2328);}});}});};Preview[_0xa232('0xd')][_0xa232('0x68')]=function(){var _0xfdaec0=this;loggerAction[_0xa232('0x58')](_0xa232('0x7d'),_['size'](this[_0xa232('0x14')]));for(var _0x3427dc in this[_0xa232('0x14')]){if(_0xfdaec0[_0xa232('0x14')][_0xa232('0x65')](_0x3427dc)){_0xfdaec0[_0xa232('0x6b')](_0x3427dc);}}};Preview['prototype'][_0xa232('0x6a')]=function(_0x11a6b1){var _0x12a925=this;rpcDb[_0xa232('0x7e')](_0x11a6b1['id'],ut[_0xa232('0x7f')](this[_0xa232('0x15')]))[_0xa232('0x80')](function(_0x16ec16){if(!_[_0xa232('0x81')](_0x16ec16)){for(var _0x25176f=0x0;_0x25176f<_0x16ec16[_0xa232('0x82')];_0x25176f+=0x1){if(ut[_0xa232('0x83')](_0x16ec16[_0x25176f][_0xa232('0x84')])<_0x11a6b1[_0xa232('0x85')]*0x3c){if(_0x16ec16[_0x25176f][_0xa232('0x86')]&&!_0x16ec16[_0x25176f][_0xa232('0x86')]['voicePause']){_0x12a925[_0xa232('0x87')](_0x16ec16[_0x25176f]['id'])[_0xa232('0x80')](ut['logger2'](_0xa232('0x88')))[_0xa232('0x77')](ut['logger2'](_0xa232('0x88')));}else{rpcDb['disableContact'](_0x16ec16[_0x25176f]['id']);}}else{var _0x8f8d10=new Action(_0x16ec16[_0x25176f],_0x11a6b1);_0x8f8d10[_0xa232('0x89')]=moment()['format'](_0xa232('0x8a'));_0x11a6b1[_0xa232('0x8b')]+=0x1;ut[_0xa232('0x8c')](_0x8f8d10,0x17,_0xa232('0x8d'));if(_0x11a6b1[_0xa232('0x8e')]){rpcDb[_0xa232('0x8f')](ut[_0xa232('0x90')](_0x16ec16[_0x25176f]));rpcDb['createCustomerHistory'](_0x8f8d10,_0xa232('0x91'));}else{ut[_0xa232('0x8c')](_0x8f8d10,0x16,_0xa232('0x92'));rpcDb[_0xa232('0x93')](_0x8f8d10,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x8f8d10,_0xa232('0x94'));}}}}})[_0xa232('0x77')](ut[_0xa232('0x95')](_0xa232('0x96')));};Preview[_0xa232('0xd')]['setMessage']=function(_0x1805ef){_0x1805ef[_0xa232('0x5d')]=!![];if(ut[_0xa232('0x97')](_0x1805ef['loggedIn'])){_0x1805ef['message']='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x1805ef[_0xa232('0x35')])){_0x1805ef['message']=_0xa232('0x98');}else if(!this[_0xa232('0x99')](_0x1805ef[_0xa232('0x52')])){if(!this[_0xa232('0x99')](_0x1805ef['TrunkBackup'])){_0x1805ef[_0xa232('0x60')]='TRUNK_IS_NOT_REACHABLE';}else{_0x1805ef[_0xa232('0x60')]=_0xa232('0x9a');}}else{_0x1805ef[_0xa232('0x60')]=_0xa232('0x9a');}emitCampaignPreview(_0x1805ef);};Preview[_0xa232('0xd')][_0xa232('0x9b')]=function(_0x20a146,_0xe2db34,_0x304032){var _0x4c7dff=this;var _0xeee7e9=this[_0xa232('0x14')][_0xe2db34];var _0x43ef3f=this['campaignsPreview'][_0xeee7e9['queue']];var _0x1dfd22;if(_0x43ef3f){switch(_0x304032){case'1':_0x43ef3f[_0xa232('0x3f')]+=0x1;_0xeee7e9[_0xa232('0x9c')]+=0x1;_0xeee7e9[_0xa232('0x9d')]=ut[_0xa232('0x9e')](_0xeee7e9);ut['logCustomer'](_0xeee7e9,0x0,_0xa232('0x9f'));ami['emit'](_0xa232('0xa0'),ut['buildObj'](_0xeee7e9,_0xa232('0xa1')));rpcDb['createCustomerHistory'](_0xeee7e9,_0xa232('0xa2'));if(ut[_0xa232('0x9e')](_0xeee7e9)>=_0x43ef3f[_0xa232('0xa3')]){_0x1dfd22=ut['cloneAction'](_0xeee7e9,0xf,'Global');rpcDb[_0xa232('0xa4')](_0x1dfd22,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0xeee7e9['countnosuchnumberretry']>=_0x43ef3f[_0xa232('0xa5')]){rpcDb['createCustomerFinal'](_0xeee7e9,_0xa232('0xa6'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0xeee7e9,_0xa232('0x9c'),_0x43ef3f[_0xa232('0xa7')]),_0xeee7e9['unlockAgent'],_0xeee7e9[_0xa232('0xa8')]);}}delete this[_0xa232('0x14')][_0x20a146[_0xa232('0xa9')]];break;case _0xa232('0xaa'):var _0x59b93b=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xeee7e9[_0xa232('0xab')]=_0x59b93b;_0xeee7e9[_0xa232('0xac')]=_0x59b93b;_0xeee7e9[_0xa232('0x71')]=!![];_0x43ef3f[_0xa232('0x2e')]+=0x1;logger[_0xa232('0x58')](_0xa232('0xad'),_0xeee7e9[_0xa232('0xae')],_0xa232('0xaf'),_0x43ef3f[_0xa232('0x2a')],_0xa232('0x70'),_0x43ef3f[_0xa232('0x2e')]);ami[_0xa232('0x28')](_0xa232('0xb0'),ut['buildObj'](_0xeee7e9,_0xa232('0xb1'),this[_0xa232('0x27')][_0xeee7e9[_0xa232('0x6e')]]));if(_0x43ef3f['acw']){ami[_0xa232('0x28')]('custom:agentConnectPreview',ut[_0xa232('0xb2')](_0xeee7e9));}break;case'16':ami[_0xa232('0x28')](_0xa232('0xb3'),ut[_0xa232('0xb4')](_0xeee7e9,_0xa232('0xb5'),this[_0xa232('0x27')][_0xeee7e9[_0xa232('0x6e')]]));emitVoiceQueueChannelRemove(ut[_0xa232('0xb4')](_0xeee7e9,'complete'));_0x43ef3f[_0xa232('0x3a')]+=0x1;_0x43ef3f[_0xa232('0xb6')]+=0x1;_0x43ef3f['answered']+=0x1;ut[_0xa232('0xb7')](_0x43ef3f,'[16]');_0xeee7e9['countglobal']=ut['totalGlobal'](_0xeee7e9);ut[_0xa232('0x8c')](_0xeee7e9,0x4,_0xa232('0xb8'));rpcDb[_0xa232('0x93')](_0xeee7e9,_0xa232('0xb9'));rpcDb[_0xa232('0xa4')](_0xeee7e9,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0xeee7e9);_0x43ef3f['sumDuration']+=_0xeee7e9[_0xa232('0xba')];_0x43ef3f['sumBillable']+=_0xeee7e9['talktime'];logger[_0xa232('0x58')](_0xa232('0xbb'),_0xeee7e9['uniqueid'],_0xa232('0xaf'),_0x43ef3f[_0xa232('0x2a')],_0xa232('0x70'),_0x43ef3f[_0xa232('0x2e')]);delete this['actions'][_0x20a146[_0xa232('0xa9')]];break;case _0xa232('0xbc'):_0x43ef3f[_0xa232('0x3c')]+=0x1;_0xeee7e9['countbusyretry']+=0x1;_0xeee7e9['countglobal']=ut['totalGlobal'](_0xeee7e9);ut[_0xa232('0x8c')](_0xeee7e9,0x5,'Busy');ami['emit'](_0xa232('0xbd'),ut[_0xa232('0xb4')](_0xeee7e9,_0xa232('0xbe')));rpcDb[_0xa232('0x93')](_0xeee7e9,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xa232('0x9e')](_0xeee7e9)>=_0x43ef3f[_0xa232('0xa3')]){_0x1dfd22=ut[_0xa232('0xbf')](_0xeee7e9,0xf,_0xa232('0xc0'));rpcDb[_0xa232('0xa4')](_0x1dfd22,_0xa232('0xc1'));}else{if(_0xeee7e9[_0xa232('0xc2')]>=_0x43ef3f[_0xa232('0xc3')]){rpcDb[_0xa232('0xa4')](_0xeee7e9,_0xa232('0xc4'));}else{rpcDb[_0xa232('0xc5')](ut[_0xa232('0xc6')](_0xeee7e9,_0xa232('0xc2'),_0x43ef3f[_0xa232('0xc7')]),_0xeee7e9[_0xa232('0xc8')],_0xeee7e9['activeContact']);}}break;case _0xa232('0xc9'):_0x43ef3f[_0xa232('0xca')]+=0x1;_0xeee7e9[_0xa232('0xcb')]+=0x1;_0xeee7e9[_0xa232('0x9d')]=ut['totalGlobal'](_0xeee7e9);ut[_0xa232('0x8c')](_0xeee7e9,0x3,_0xa232('0xcc'));ami['emit'](_0xa232('0xcd'),ut[_0xa232('0xb4')](_0xeee7e9,'noanswer'));rpcDb[_0xa232('0x93')](_0xeee7e9,_0xa232('0xce'));if(ut[_0xa232('0x9e')](_0xeee7e9)>=_0x43ef3f[_0xa232('0xa3')]){_0x1dfd22=ut[_0xa232('0xbf')](_0xeee7e9,0xf,'Global');rpcDb[_0xa232('0xa4')](_0x1dfd22,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0xeee7e9['countnoanswerretry']>=_0x43ef3f['dialNoAnswerMaxRetry']){rpcDb[_0xa232('0xa4')](_0xeee7e9,_0xa232('0xce'));}else{rpcDb[_0xa232('0xc5')](ut[_0xa232('0xc6')](_0xeee7e9,_0xa232('0xcb'),_0x43ef3f['dialNoAnswerRetryFrequency']),_0xeee7e9[_0xa232('0xc8')],_0xeee7e9['activeContact']);}}break;case'CONGESTION':_0x43ef3f[_0xa232('0xcf')]+=0x1;_0xeee7e9[_0xa232('0xd0')]+=0x1;_0xeee7e9[_0xa232('0x9d')]=ut['totalGlobal'](_0xeee7e9);ut[_0xa232('0x8c')](_0xeee7e9,0x8,_0xa232('0xd1'));ami['emit'](_0xa232('0xd2'),ut[_0xa232('0xb4')](_0xeee7e9,_0xa232('0xd3')));rpcDb[_0xa232('0x93')](_0xeee7e9,_0xa232('0xd4'));if(ut[_0xa232('0x9e')](_0xeee7e9)>=_0x43ef3f[_0xa232('0xa3')]){_0x1dfd22=ut[_0xa232('0xbf')](_0xeee7e9,0xf,_0xa232('0xc0'));rpcDb[_0xa232('0xa4')](_0x1dfd22,_0xa232('0xd5'));}else{if(_0xeee7e9[_0xa232('0xd0')]>=_0x43ef3f[_0xa232('0xd6')]){rpcDb['createCustomerFinal'](_0xeee7e9,_0xa232('0xd4'));}else{rpcDb[_0xa232('0xc5')](ut[_0xa232('0xc6')](_0xeee7e9,_0xa232('0xd0'),_0x43ef3f[_0xa232('0xc7')]),_0xeee7e9['unlockAgent'],_0xeee7e9[_0xa232('0xa8')]);}}break;case'CANCEL':_0x43ef3f[_0xa232('0xd7')]+=0x1;_0xeee7e9[_0xa232('0xd8')]+=0x1;_0xeee7e9['countglobal']=ut[_0xa232('0x9e')](_0xeee7e9);ut[_0xa232('0x8c')](_0xeee7e9,0x14,_0xa232('0xd9'));ami[_0xa232('0x28')](_0xa232('0xda'),ut['buildObj'](_0xeee7e9,_0xa232('0xdb')));rpcDb[_0xa232('0x93')](_0xeee7e9,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0xeee7e9)>=_0x43ef3f[_0xa232('0xa3')]){_0x1dfd22=ut[_0xa232('0xbf')](_0xeee7e9,0x14,_0xa232('0xd9'));rpcDb['createCustomerFinal'](_0x1dfd22,_0xa232('0xdc'));}else{if(_0xeee7e9[_0xa232('0xd8')]>=_0x43ef3f[_0xa232('0xdd')]){rpcDb[_0xa232('0xa4')](_0xeee7e9,_0xa232('0xdc'));}else{rpcDb[_0xa232('0xc5')](ut[_0xa232('0xc6')](_0xeee7e9,_0xa232('0xd8'),_0x43ef3f[_0xa232('0xde')]),_0xeee7e9[_0xa232('0xc8')],_0xeee7e9[_0xa232('0xa8')]);}}break;case _0xa232('0xdf'):_0x43ef3f[_0xa232('0x42')]+=0x1;_0xeee7e9[_0xa232('0xe0')]+=0x1;_0xeee7e9[_0xa232('0x9d')]=ut[_0xa232('0x9e')](_0xeee7e9);ut['logCustomer'](_0xeee7e9,0xb,_0xa232('0xe1'));rpcDb[_0xa232('0x93')](_0xeee7e9,_0xa232('0xe2'));if(ut['totalGlobal'](_0xeee7e9)>=_0x43ef3f[_0xa232('0xa3')]){_0x1dfd22=ut['cloneAction'](_0xeee7e9,0xf,'Global');rpcDb[_0xa232('0xa4')](_0x1dfd22,_0xa232('0xe2'));}else{if(_0xeee7e9['countabandonedetry']>=_0x43ef3f[_0xa232('0xe3')]){rpcDb['createCustomerFinal'](_0xeee7e9,_0xa232('0xe2'));}else{rpcDb['rescheduleContact'](ut[_0xa232('0xc6')](_0xeee7e9,_0xa232('0xe0'),_0x43ef3f[_0xa232('0xe4')]),_0xeee7e9[_0xa232('0xc8')],_0xeee7e9[_0xa232('0xa8')]);}}break;case'18':_0x43ef3f[_0xa232('0x41')]+=0x1;_0xeee7e9[_0xa232('0xe5')]+=0x1;_0xeee7e9[_0xa232('0x9d')]=ut[_0xa232('0x9e')](_0xeee7e9);ut[_0xa232('0x8c')](_0xeee7e9,0x12,_0x20a146[_0xa232('0xe6')]||_0x20a146[_0xa232('0xe7')]);ami[_0xa232('0x28')]('custom:amd',ut[_0xa232('0xb4')](_0xeee7e9,_0xa232('0xe8')));rpcDb[_0xa232('0x93')](_0xeee7e9,_0xa232('0xe9'));if(ut[_0xa232('0x9e')](_0xeee7e9)>=_0x43ef3f[_0xa232('0xa3')]){_0x1dfd22=ut['cloneAction'](_0xeee7e9,0xf,_0xa232('0xc0'));rpcDb[_0xa232('0xa4')](_0x1dfd22,_0xa232('0xe9'));}else{rpcDb[_0xa232('0xa4')](_0xeee7e9,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xa232('0x14')][_0x20a146[_0xa232('0xa9')]];break;case'19':_0x43ef3f[_0xa232('0x41')]+=0x1;_0xeee7e9[_0xa232('0x9d')]=ut[_0xa232('0x9e')](_0xeee7e9);ut['logCustomer'](_0xeee7e9,0x13,_0x20a146[_0xa232('0xe6')]||_0x20a146[_0xa232('0xe7')]);ami[_0xa232('0x28')](_0xa232('0xea'),ut['buildObj'](_0xeee7e9,_0xa232('0xe8')));rpcDb['createCustomerHistory'](_0xeee7e9,_0xa232('0xeb'));if(ut[_0xa232('0x9e')](_0xeee7e9)>=_0x43ef3f[_0xa232('0xa3')]){_0x1dfd22=ut[_0xa232('0xbf')](_0xeee7e9,0xf,_0xa232('0xc0'));rpcDb[_0xa232('0xa4')](_0x1dfd22,_0xa232('0xeb'));}else{rpcDb[_0xa232('0xa4')](_0xeee7e9,_0xa232('0xeb'));}delete this[_0xa232('0x14')][_0x20a146[_0xa232('0xa9')]];break;default:if(_0xeee7e9[_0xa232('0x71')]){ut[_0xa232('0xb7')](_0x43ef3f,_0xa232('0xec'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x43ef3f[_0xa232('0x2a')],_0x20a146);}_0x43ef3f[_0xa232('0x41')]+=0x1;_0xeee7e9['countglobal']=ut[_0xa232('0x9e')](_0xeee7e9);ut[_0xa232('0x8c')](_0xeee7e9,0xc,_0x20a146[_0xa232('0xe6')]||_0x20a146['dialstatus']);rpcDb[_0xa232('0x93')](_0xeee7e9,_0xa232('0xed'));if(ut[_0xa232('0x9e')](_0xeee7e9)>=_0x43ef3f[_0xa232('0xa3')]){_0x1dfd22=ut[_0xa232('0xbf')](_0xeee7e9,0xf,_0xa232('0xc0'));rpcDb[_0xa232('0xa4')](_0x1dfd22,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xa232('0xa4')](_0xeee7e9,_0xa232('0xee'));}delete this[_0xa232('0x14')][_0x20a146[_0xa232('0xa9')]];}if(!(_0xeee7e9[_0xa232('0x71')]&&_0x304032==='16')){ut[_0xa232('0x79')](_0x43ef3f,'[callProgressDetectingCustomer]');logger[_0xa232('0x58')](_0xa232('0xef'),_0xeee7e9[_0xa232('0xae')],_0xa232('0xaf'),_0x43ef3f[_0xa232('0x2a')],_0xa232('0x6f'),_0x43ef3f[_0xa232('0x4d')]);}if(_0x304032!==_0xa232('0xaa')){delete this[_0xa232('0x14')][_0x20a146[_0xa232('0xa9')]];delete this['actions'][_0x20a146[_0xa232('0xf0')]];}}};Preview[_0xa232('0xd')]['callProgressDetectingAgent']=function(_0x4270db,_0x36d4c9,_0x51bf40){if(_[_0xa232('0xf1')](_0x36d4c9)&&_0xa232('0xf2')!==typeof _0x36d4c9){return;}if(_[_0xa232('0xf1')](_0x51bf40)&&_0xa232('0xf2')!==typeof _0x51bf40){return;}switch(_0x51bf40[_0xa232('0xf3')]){case'0':ut[_0xa232('0xf4')](_0x4270db,0x0,_0xa232('0x9f'));rpcDb[_0xa232('0xf5')](_0x4270db,_0xa232('0xf6'));break;case'3':ut['logAgent'](_0x4270db,0x3,'NoAnswer');rpcDb[_0xa232('0xf5')](_0x4270db,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xa232('0xf4')](_0x4270db,0x5,_0xa232('0xf7'));rpcDb['createAgentHistory'](_0x4270db,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xa232('0xf4')](_0x4270db,0x8,_0xa232('0xd1'));rpcDb[_0xa232('0xf5')](_0x4270db,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xa232('0xf4')](_0x4270db,0x16,'AnswerAGI');rpcDb[_0xa232('0xf5')](_0x4270db,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xa232('0xf4')](_0x4270db,0xc,_0x51bf40[_0xa232('0xf3')]);rpcDb[_0xa232('0xf5')](_0x4270db,_0xa232('0xf8'));}ut[_0xa232('0x79')](_0x36d4c9,'[callProgressDetectingAgent]');logger[_0xa232('0x58')]('[originated][decrement][callProgressDetectingAgent]',_0x4270db[_0xa232('0xae')],_0xa232('0xaf'),_0x36d4c9[_0xa232('0x2a')],_0xa232('0x6f'),_0x36d4c9['originated']);delete this[_0xa232('0x14')][_0x4270db['uniqueid']];};Preview[_0xa232('0xd')][_0xa232('0xf9')]=function(_0x57df42,_0x60f4bd,_0x24ee41,_0x4bc059,_0x5624e1){var _0x12e2fe=this;return new BPromise(function(_0x505902,_0x48fe74){if(_[_0xa232('0x81')](_0x60f4bd)||_[_0xa232('0x81')](_0x60f4bd[_0xa232('0xfa')])||_[_0xa232('0x81')](_0x60f4bd[_0xa232('0xfa')][_0xa232('0xfb')])||_['isNil'](_0x60f4bd[_0xa232('0x74')])){_0x48fe74(ut[_0xa232('0x60')](_0xa232('0xfc'),_0x4bc059,_0x5624e1));return;}var _0x353a15=uuid['v4']();var _0x2960a3=_0x12e2fe['campaignsPreview'][_0x60f4bd[_0xa232('0x6d')][_0xa232('0x2a')]];var _0xaacdf=_0x24ee41?_0x12e2fe[_0xa232('0x15')][_0x24ee41]['id']:undefined;_0x12e2fe[_0xa232('0x14')][_0x353a15]=new Action(_0x60f4bd,_0x2960a3,_0x353a15,_0x24ee41,_0xaacdf);var _0x63ee0=_0x12e2fe['actions'][_0x353a15];_0x63ee0[_0xa232('0xc8')]=_0x4bc059;_0x63ee0[_0xa232('0xa8')]=_0x5624e1;_0x63ee0[_0xa232('0xfd')]=_0x24ee41;if(_[_0xa232('0xfe')](_0x57df42)){_0x12e2fe['execCall'](_0x63ee0,_0x2960a3,_0x60f4bd,_0x24ee41)['then'](function(_0x37b3f8){logger['info'](_0xa232('0xff'),'Queue:\x20'+_0x63ee0[_0xa232('0x6e')]+_0xa232('0x100')+_0x63ee0[_0xa232('0x101')],JSON[_0xa232('0x5a')](_0x37b3f8));ami[_0xa232('0x28')](_0xa232('0x102'),ut[_0xa232('0xb4')](_0x63ee0,_0xa232('0x103'),_0x12e2fe[_0xa232('0x27')][_0x63ee0[_0xa232('0x6e')]]));_0x505902(ut[_0xa232('0x60')](_0xa232('0x104')));})['catch'](function(_0x46df4d){ut[_0xa232('0x61')](_0xa232('0x105'),_0x46df4d);_0x48fe74(ut[_0xa232('0x60')](_0xa232('0x106'),_0x4bc059,_0x5624e1));});}else{_0x2960a3[_0xa232('0x3b')]+=0x1;ut[_0xa232('0x107')](_0x63ee0);rpcDb[_0xa232('0x108')](_0x63ee0,'[Blacklist][error]');delete _0x12e2fe[_0xa232('0x14')][_0x353a15];_0x48fe74(ut[_0xa232('0x60')](_0xa232('0x109'),_0x4bc059,_0x5624e1));}});};Preview['prototype']['isTrunkReachable']=function(_0xdd527c){return!_[_0xa232('0x81')](_0xdd527c)&&!_[_0xa232('0x81')](_0xdd527c[_0xa232('0x2a')])&&!_[_0xa232('0x81')](_0xdd527c[_0xa232('0x53')])&&_0xdd527c[_0xa232('0x53')]&&!_[_0xa232('0x81')](this[_0xa232('0x13')][util[_0xa232('0x56')]('SIP/%s',_0xdd527c['name'])])&&!_['isNil'](this[_0xa232('0x13')][util['format'](_0xa232('0x10a'),_0xdd527c[_0xa232('0x2a')])][_0xa232('0x10b')])&&(this[_0xa232('0x13')][util[_0xa232('0x56')](_0xa232('0x10a'),_0xdd527c['name'])]['status']===_0xa232('0x10c')||this[_0xa232('0x13')][util[_0xa232('0x56')]('SIP/%s',_0xdd527c[_0xa232('0x2a')])]['status']===_0xa232('0x10d'));};Preview[_0xa232('0xd')][_0xa232('0x87')]=function(_0x5a8903,_0x4f9b32){var _0x4bd2cb=this;return new BPromise(function(_0x4fbb8b,_0x229266){_0x4bd2cb['execRun'](_0x5a8903,_0x4f9b32)[_0xa232('0x80')](function(_0x26a7f9){_0x4fbb8b(_[_0xa232('0x72')](_0x26a7f9,['message']));})[_0xa232('0x77')](function(_0x74f3b2){if(_0x74f3b2['unlock']){rpcDb[_0xa232('0x10e')](_0x5a8903);}if(_0x74f3b2[_0xa232('0x53')]){rpcDb[_0xa232('0x10f')](_0x5a8903);}_0x229266(_['pick'](_0x74f3b2,['message']));});});};Preview[_0xa232('0xd')][_0xa232('0x110')]=function(_0x1379c1,_0x49154b){var _0xee02=this;return new BPromise(function(_0x3d32fd,_0x4727b0){var _0x861ac4,_0x1ac3fe;rpcDb['getContactPreview'](_0x1379c1)[_0xa232('0x80')](function(_0x1fba45){if(!_[_0xa232('0x81')](_0x1fba45[0x0])){_0x1ac3fe=_0x1fba45[0x0][_0xa232('0x111')]?![]:!![];_0x861ac4=_0x1fba45[0x0]['recallme']?!![]:![];_0x861ac4=_0x49154b?!![]:_0x861ac4;}var _0x268c31=_0xee02[_0xa232('0x112')](_0x1fba45);if(_0x268c31['isValid']){rpcDb[_0xa232('0x113')](_[_0xa232('0x72')](_0x1fba45[0x0],[_0xa232('0x74'),_0xa232('0x114')]))[_0xa232('0x80')](function(_0x3f321c){_0xee02[_0xa232('0xf9')](_0x3f321c,_0x1fba45[0x0],_0x49154b,_0x1ac3fe,_0x861ac4)['then'](function(_0x53205b){_0x3d32fd(_0x53205b);})[_0xa232('0x77')](function(_0x26ce1f){_0x4727b0(_0x26ce1f);});})[_0xa232('0x77')](function(_0x5684b5){ut[_0xa232('0x61')](_0xa232('0x115'),_0x5684b5);_0x4727b0(ut['message'](_0xa232('0x116'),_0x1ac3fe,_0x861ac4));});}else{_0x4727b0(ut[_0xa232('0x60')](_0x268c31[_0xa232('0x60')],_0x1ac3fe,_0x861ac4));}})[_0xa232('0x77')](function(_0x142077){ut[_0xa232('0x61')](_0xa232('0x117'),_0x142077);_0x4727b0(ut[_0xa232('0x60')]('Call\x20unsuccessful',![],!![]));});});};Preview['prototype'][_0xa232('0x112')]=function(_0x35d235){if(_['isNil'](_0x35d235)||_[_0xa232('0xfe')](_0x35d235)||!_['isNil'](_0x35d235[0x0][_0xa232('0x86')])&&_[_0xa232('0x81')](_0x35d235[0x0][_0xa232('0x86')][_0xa232('0x2a')])){ut[_0xa232('0x61')](_0xa232('0x118'),_0x35d235);return{'isValid':![],'message':_0xa232('0x119')};}var _0x431e5c=this[_0xa232('0x27')][_0x35d235[0x0]['Queue'][_0xa232('0x2a')]];_0x431e5c[_0xa232('0x60')]='ACTIVE';if(_[_0xa232('0x81')](_0x431e5c)){ut['logger'](_0xa232('0x11a'),_0x431e5c);return{'isValid':![],'message':_0xa232('0x11b')};}if(!this[_0xa232('0x99')](_0x431e5c[_0xa232('0x52')])){ut[_0xa232('0x61')](_0xa232('0x11c'),'campaign\x20Name:\x20'+_0x431e5c['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xa232('0x99')](_0x431e5c[_0xa232('0x11d')])){ut[_0xa232('0x61')](_0xa232('0x11c'),_0x431e5c[_0xa232('0x2a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x431e5c['dialActive'])){ut['logger'](_0xa232('0x11e'),_0x431e5c['name']+_0xa232('0x11f'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x431e5c[_0xa232('0x2a')]+_0xa232('0x11f')};}return{'isValid':!![],'message':_0xa232('0x120')};};Preview[_0xa232('0xd')][_0xa232('0x121')]=function(_0x8cb01,_0x4e0d51,_0x2a8f62,_0x1c8d5b){var _0x266ef2=this;return new BPromise(function(_0x5336f6,_0x36f345){var _0x12015d=_0x8cb01['uniqueid'];var _0x976230=_0x266ef2[_0xa232('0x99')](_0x4e0d51[_0xa232('0x52')])?util[_0xa232('0x56')](_0xa232('0x122'),_0x4e0d51['Trunk'][_0xa232('0x2a')],_[_0xa232('0x81')](_0x4e0d51[_0xa232('0x123')])?'':_0x4e0d51[_0xa232('0x123')][_0xa232('0x124')]()||'',_0x4e0d51[_0xa232('0x125')]>0x0?_0x2a8f62['Contact'][_0xa232('0xfb')]['substring'](_0x4e0d51[_0xa232('0x125')]):_0x2a8f62[_0xa232('0xfa')][_0xa232('0xfb')]):util['format'](_0xa232('0x122'),_['isNil'](_0x4e0d51[_0xa232('0x11d')])?_0x4e0d51[_0xa232('0x52')][_0xa232('0x2a')]:_0x4e0d51[_0xa232('0x11d')][_0xa232('0x2a')],_[_0xa232('0x81')](_0x4e0d51['dialPrefix'])?'':_0x4e0d51[_0xa232('0x123')][_0xa232('0x124')]()||'',_0x4e0d51[_0xa232('0x125')]>0x0?_0x2a8f62[_0xa232('0xfa')]['phone']['substring'](_0x4e0d51['dialCutDigit']):_0x2a8f62[_0xa232('0xfa')][_0xa232('0xfb')]);var _0x2dccc1=_0x266ef2[_0xa232('0x99')](_0x4e0d51['Trunk'])?ut[_0xa232('0x126')](_0x4e0d51[_0xa232('0x52')][_0xa232('0x54')],_0x4e0d51['dialOriginateCallerIdName'],_0x4e0d51[_0xa232('0x127')]>0x0?ut['getCallerIdRandom'](_0x4e0d51[_0xa232('0x38')],_0x4e0d51['dialRandomLastDigitCallerIdNumber']):_0x4e0d51[_0xa232('0x38')]):ut['getCallerId'](_[_0xa232('0x81')](_0x4e0d51[_0xa232('0x11d')])?_0x4e0d51[_0xa232('0x52')]['callerid']:_0x4e0d51['TrunkBackup'][_0xa232('0x54')],_0x4e0d51[_0xa232('0x37')],_0x4e0d51[_0xa232('0x127')]>0x0?ut[_0xa232('0x128')](_0x4e0d51[_0xa232('0x38')],_0x4e0d51[_0xa232('0x127')]):_0x4e0d51[_0xa232('0x38')]);if(_0x2dccc1){_0x8cb01['originatecalleridname']=ut[_0xa232('0x129')](_0x2dccc1);_0x8cb01[_0xa232('0x12a')]=ut[_0xa232('0x12b')](_0x2dccc1);}var _0x51ea01=ut[_0xa232('0x12c')](_0x4e0d51,_0x2a8f62,_0x976230,_0x2dccc1,_0x12015d,_0x8cb01);_[_0xa232('0x12d')](_0x8cb01,ut[_0xa232('0x12e')](_0x51ea01));_0x8cb01['starttime']=moment()[_0xa232('0x56')](_0xa232('0x8a'));ami[_0xa232('0x75')](ut['variablesAction'](_0x8cb01,_0x4e0d51,_0x51ea01,_0x8cb01[_0xa232('0xa8')],_0x1c8d5b))[_0xa232('0x80')](function(_0x45728f){var _0x516bd1=_0x8cb01['channelAgent'];if(!_[_0xa232('0x81')](_0x516bd1)){if(!_[_0xa232('0x81')](_0x266ef2[_0xa232('0x15')][_0x516bd1])){_0x266ef2[_0xa232('0x15')][_0x516bd1]['destconnectedlinenum']=_0x8cb01[_0xa232('0x12f')];emit(util[_0xa232('0x56')](_0xa232('0x130'),_0x266ef2[_0xa232('0x15')][_0x516bd1]['name']),'user:agentconnect',{'destaccountcode':_0x266ef2['agents'][_0x516bd1]['accountcode'],'destconnectedlinenum':_0x8cb01[_0xa232('0x12f')]});}}_0x4e0d51[_0xa232('0x4d')]+=0x1;logger[_0xa232('0x58')](_0xa232('0x131'),_0x12015d,_0xa232('0xaf'),_0x4e0d51[_0xa232('0x2a')],'originated:\x20',_0x4e0d51[_0xa232('0x4d')]);_0x5336f6(_0x45728f);})['catch'](function(_0x172a59){ut[_0xa232('0xf4')](_0x8cb01,0xe,_0xa232('0x132'));rpcDb[_0xa232('0xf5')](_0x8cb01,_0xa232('0x133'));_0x36f345(_0x172a59);});});};Preview[_0xa232('0xd')][_0xa232('0x20')]=function(_0x18347c){if(this['actions'][_0x18347c['linkedid']]){this[_0xa232('0x14')][_0x18347c[_0xa232('0xa9')]][_0xa232('0x76')]=_0x18347c['channel'];}};Preview[_0xa232('0xd')][_0xa232('0x18')]=function(_0xe900e3){var _0x2134e2=this;var _0x146584=this['actions'][_0xe900e3['actionid']];if(_0x146584){if(_0x146584[_0xa232('0xfd')]&&this['agents'][_0x146584[_0xa232('0xfd')]]){ut[_0xa232('0x134')](_0x146584,this[_0xa232('0x15')][_0x146584[_0xa232('0xfd')]]['name'],this[_0xa232('0x15')][_0x146584[_0xa232('0xfd')]]['id']);}var _0x7df560=_[_0xa232('0x135')](_0x146584);_0x7df560['responsetime']=moment()[_0xa232('0x56')](_0xa232('0x8a'));var _0x23e960=_0x2134e2[_0xa232('0x27')][_0x146584[_0xa232('0x6e')]];if(ut[_0xa232('0x136')](_0xe900e3[_0xa232('0x137')])){if(_0x146584[_0xa232('0xc8')]){rpcDb['unlockContact'](_0x146584[_0xa232('0x101')]);}if(_0x146584[_0xa232('0xa8')]){rpcDb['disableContact'](_0x146584[_0xa232('0x101')]);}ami[_0xa232('0x28')](_0xa232('0x138'),ut[_0xa232('0xb4')](_0x146584,'rejected',this[_0xa232('0x27')][_0x146584[_0xa232('0x6e')]]));this[_0xa232('0x139')](_0x7df560,_0x23e960,_0xe900e3);}else{_0x146584[_0xa232('0x89')]=moment()[_0xa232('0x56')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xa232('0xf4')](_0x7df560,0x4,'Answer');rpcDb['createAgentHistory'](_0x7df560,_0xa232('0x13a'));}}};Preview[_0xa232('0xd')][_0xa232('0x19')]=function(_0x11226e){var _0x593bc0=this;var _0x791f02=this[_0xa232('0x14')][_0x11226e[_0xa232('0xa9')]];var _0x212d17;if(_0x791f02){_0x212d17=this['campaignsPreview'][_0x791f02[_0xa232('0x6e')]];logger[_0xa232('0x58')](_0xa232('0x13b'),_0x11226e['linkedid'],_0xa232('0xaf'),_0x212d17[_0xa232('0x2a')],_0xa232('0x70'),_0x212d17[_0xa232('0x2e')]);}if(this[_0xa232('0x14')][_0x11226e[_0xa232('0xa9')]]&&_0x11226e[_0xa232('0xa9')]!==_0x11226e[_0xa232('0xae')]){if(_0x11226e[_0xa232('0x13c')]==='16'&&this[_0xa232('0x14')][_0x11226e[_0xa232('0xa9')]][_0xa232('0x71')]){this[_0xa232('0x9b')](_0x11226e,_0x11226e[_0xa232('0xa9')],_0x11226e[_0xa232('0x13c')]);}else if(this[_0xa232('0x14')][_0x11226e[_0xa232('0xa9')]][_0xa232('0x71')]){logger['info'](_0xa232('0x13d'),_0x11226e[_0xa232('0xa9')],_0x11226e[_0xa232('0x13c')],_0xa232('0xaf'),_0x212d17[_0xa232('0x2a')],'pTalking:\x20',_0x212d17[_0xa232('0x2e')]);this[_0xa232('0x9b')](_0x11226e,_0x11226e[_0xa232('0xa9')],_0x11226e[_0xa232('0x13c')]);}}else if(_0x791f02&&_['isNil'](_0x791f02[_0xa232('0x13e')])&&_0x212d17[_0xa232('0x13f')]&&_0x11226e[_0xa232('0xa9')]===_0x11226e[_0xa232('0xae')]&&_['isNil'](_0x11226e[_0xa232('0xf3')])&&_0x11226e[_0xa232('0x13c')]==='16'&&_0x11226e[_0xa232('0x140')]==='6'&&_[_0xa232('0xf1')](_0x791f02[_0xa232('0x141')])){if(_0x791f02[_0xa232('0xc8')]){rpcDb['unlockContact'](_0x791f02[_0xa232('0x101')]);}if(_0x791f02['activeContact']){rpcDb[_0xa232('0x10f')](_0x791f02['idContact']);}_0x11226e[_0xa232('0xf3')]='22';this[_0xa232('0x139')](_0x791f02,_0x212d17,_0x11226e);}else if(_0x791f02&&_0x791f02[_0xa232('0x141')]){if(_0x11226e[_0xa232('0x13c')]==='16'&&this[_0xa232('0x14')][_0x11226e['linkedid']][_0xa232('0x71')]){logger[_0xa232('0x58')]('[syncHangup][talking][transfer]',_0x11226e[_0xa232('0xa9')],_0x11226e['cause'],_0xa232('0xaf'),_0x212d17['name'],_0xa232('0x70'),_0x212d17[_0xa232('0x2e')]);this[_0xa232('0x9b')](_0x11226e,_0x11226e['linkedid'],_0x11226e[_0xa232('0x13c')]);}else if(this[_0xa232('0x14')][_0x11226e[_0xa232('0xa9')]][_0xa232('0x71')]){logger['info'](_0xa232('0x13d'),_0x11226e[_0xa232('0xa9')],_0x11226e[_0xa232('0x13c')],_0xa232('0xaf'),_0x212d17[_0xa232('0x2a')],_0xa232('0x70'),_0x212d17[_0xa232('0x2e')]);this[_0xa232('0x9b')](_0x11226e,_0x11226e[_0xa232('0xa9')],_0x11226e[_0xa232('0x13c')]);}}};Preview[_0xa232('0xd')][_0xa232('0x1e')]=function(_0x3d2908){if(this[_0xa232('0x14')][_0x3d2908['destlinkedid']]&&_0x3d2908[_0xa232('0xf0')]!==_0x3d2908['destuniqueid']){this[_0xa232('0x9b')](_0x3d2908,_0x3d2908[_0xa232('0xf0')],_0x3d2908['dialstatus']);}};Preview[_0xa232('0xd')]['syncHangupRequest']=function(_0x51508b){if(this['actions'][_0x51508b[_0xa232('0xa9')]]&&_0x51508b[_0xa232('0xa9')]!==_0x51508b['uniqueid']&&!this[_0xa232('0x14')][_0x51508b[_0xa232('0xa9')]][_0xa232('0x71')]){if(_0x51508b[_0xa232('0x13c')]==='1'){this['callProgressDetectingCustomer'](_0x51508b,_0x51508b[_0xa232('0xa9')],_0x51508b[_0xa232('0x13c')]);}}};Preview[_0xa232('0xd')]['addVariable']=function(_0x52e80e,_0x5825b0,_0x3f7614){if(this[_0xa232('0x14')][_0x52e80e]){if(_[_0xa232('0x81')](this[_0xa232('0x14')][_0x52e80e]['variables'])){this[_0xa232('0x14')][_0x52e80e][_0xa232('0x142')]={};}this[_0xa232('0x14')][_0x52e80e]['variables'][_0x5825b0]=_0x3f7614;}};Preview[_0xa232('0xd')][_0xa232('0x22')]=function(_0xf2d0c){try{if(!_[_0xa232('0x81')](_0xf2d0c)){if(ut[_0xa232('0x143')](_[_0xa232('0x144')](_0xf2d0c[_0xa232('0x145')])[0x0])){this[_0xa232('0x146')](_0xf2d0c[_0xa232('0xae')],_[_0xa232('0x144')](_0xf2d0c[_0xa232('0x145')])[0x0],_0xf2d0c[_0xa232('0x147')]);}}}catch(_0x1cc1e2){logger[_0xa232('0x148')](_0xa232('0x149'),util[_0xa232('0x14a')](_0x1cc1e2,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xa232('0x24')]=function(_0x1f928f){if(_0x1f928f){if(this[_0xa232('0x14')][_0x1f928f[_0xa232('0x14b')]]){this['actions'][_0x1f928f[_0xa232('0x14b')]][_0xa232('0x141')]=!![];}}};Preview[_0xa232('0xd')][_0xa232('0x25')]=function(_0x1a8988){if(_0x1a8988){if(this[_0xa232('0x14')][_0x1a8988['transfererlinkedid']]){this['actions'][_0x1a8988[_0xa232('0x14c')]]['transfer']=!![];}}};module[_0xa232('0x14d')]=Preview; \ No newline at end of file +var _0xf280=['[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlockContact','recallme','isValid','checkIsBlackList','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','channelAgent','destconnectedlinenum','calleridnum','user:%s','accountcode','[originated][increment]','actionid','logLookAgent','clone','isFailure','rejected','callProgressDetectingAgent','starttime','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','syncBlindTransfer','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','prototype','tail','finally','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','booked','clearZombieChannels','dialActive','setMessage','recallMe','sequence','isNil','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','ANSWER','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','uniqueid','linkedid','countbusyretry','custom:agentbusy','busy','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory'];(function(_0x545e84,_0x1095e0){var _0x5a69ab=function(_0x1c5973){while(--_0x1c5973){_0x545e84['push'](_0x545e84['shift']());}};_0x5a69ab(++_0x1095e0);}(_0xf280,0x1bc));var _0x0f28=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xf280[_0x4fde08];return _0x12e725;};'use strict';var util=require(_0x0f28('0x0'));var _=require(_0x0f28('0x1'));var BPromise=require(_0x0f28('0x2'));var uuid=require(_0x0f28('0x3'));var moment=require(_0x0f28('0x4'));var md5=require(_0x0f28('0x5'));var Redis=require(_0x0f28('0x6'));var config=require(_0x0f28('0x7'));var logger=require(_0x0f28('0x8'))(_0x0f28('0x9'));var loggerAction=require(_0x0f28('0x8'))(_0x0f28('0xa'));var ami=require('../ami');var rpcDb=require(_0x0f28('0xb'));var Action=require(_0x0f28('0xc'));var ut=require(_0x0f28('0xd'));config[_0x0f28('0xe')]=_['defaults'](config['redis'],{'host':_0x0f28('0xf'),'port':0x18eb});var io=require(_0x0f28('0x10'))(new Redis(config[_0x0f28('0xe')]));var Sequence=function(){};Sequence[_0x0f28('0x11')]['enqueue']=function(_0x1c2c15){this[_0x0f28('0x12')]=this[_0x0f28('0x12')]?this['tail'][_0x0f28('0x13')](_0x1c2c15):_0x1c2c15();};function Preview(_0x34c8b0){this['sequence']=new Sequence();this[_0x0f28('0x14')]=_0x34c8b0['voiceQueues'];this['trunks']=_0x34c8b0[_0x0f28('0x15')];this[_0x0f28('0x16')]={};this['agents']=_0x34c8b0[_0x0f28('0x17')];this[_0x0f28('0x18')]=0x0;ami['on'](_0x0f28('0x19'),this[_0x0f28('0x1a')][_0x0f28('0x1b')](this));ami['on']('hangup',this[_0x0f28('0x1c')][_0x0f28('0x1b')](this));ami['on'](_0x0f28('0x1d'),this[_0x0f28('0x1e')]['bind'](this));ami['on'](_0x0f28('0x1f'),this[_0x0f28('0x20')]['bind'](this));ami['on']('newexten',this[_0x0f28('0x21')][_0x0f28('0x1b')](this));ami['on'](_0x0f28('0x22'),this[_0x0f28('0x23')][_0x0f28('0x1b')](this));ami['on'](_0x0f28('0x24'),this[_0x0f28('0x25')][_0x0f28('0x1b')](this));ami['on'](_0x0f28('0x26'),this['syncBlindTransfer'][_0x0f28('0x1b')](this));this[_0x0f28('0x27')](this[_0x0f28('0x14')]);}function emit(_0x25072a,_0x573f31,_0xb73004){io['to'](_0x25072a)[_0x0f28('0x28')](_0x573f31,_0xb73004);}function emitCampaignPreview(_0x306210){if(_0x306210[_0x0f28('0x29')]===_0x0f28('0x2a')){var _0x19140c={'id':_0x306210['id'],'name':_0x306210[_0x0f28('0x2b')],'strategy':_0x306210[_0x0f28('0x2c')],'answered':_0x306210[_0x0f28('0x2d')],'available':_0x306210[_0x0f28('0x2e')],'loggedIn':_0x306210[_0x0f28('0x2f')],'pTalking':_0x306210[_0x0f28('0x30')],'sumBillable':_0x306210[_0x0f28('0x31')],'sumDuration':_0x306210['sumDuration'],'sumHoldTime':_0x306210[_0x0f28('0x32')]||0x0,'talking':_0x306210[_0x0f28('0x33')],'total':_0x306210[_0x0f28('0x34')],'type':_0x306210['type'],'unmanaged':_0x306210[_0x0f28('0x35')],'abandoned':_0x306210['abandoned'],'waiting':_0x306210['waiting'],'loggedInDb':_0x306210['loggedInDb'],'dialActive':_0x306210['dialActive'],'dialMethod':_0x306210['dialMethod'],'dialOriginateCallerIdName':_0x306210[_0x0f28('0x36')],'dialOriginateCallerIdNumber':_0x306210['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x306210[_0x0f28('0x37')],'dialPrefix':_0x306210[_0x0f28('0x38')],'outboundAnswerAgiCallsDay':_0x306210['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x306210[_0x0f28('0x39')],'outboundBlacklistCallsDay':_0x306210[_0x0f28('0x3a')],'outboundBusyCallsDay':_0x306210[_0x0f28('0x3b')],'outboundCongestionCallsDay':_0x306210[_0x0f28('0x3c')],'outboundDropCallsDayACS':_0x306210[_0x0f28('0x3d')],'outboundDropCallsDayCallersExit':_0x306210[_0x0f28('0x3e')],'outboundDropCallsDayTimeout':_0x306210[_0x0f28('0x3f')],'outboundNoAnswerCallsDay':_0x306210[_0x0f28('0x40')],'outboundNoSuchCallsDay':_0x306210[_0x0f28('0x41')],'outboundOriginateFailureCallsDay':_0x306210[_0x0f28('0x42')],'outboundReCallsDay':_0x306210[_0x0f28('0x43')],'outboundRejectCallsDay':_0x306210[_0x0f28('0x44')],'outboundUnknownCallsDay':_0x306210[_0x0f28('0x45')],'outboundAbandonedCallsDay':_0x306210[_0x0f28('0x46')],'predictiveIntervalAnsweredCalls':_0x306210[_0x0f28('0x47')],'predictiveIntervalAvgHoldtime':_0x306210[_0x0f28('0x48')],'predictiveIntervalAvgTalktime':_0x306210[_0x0f28('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x306210[_0x0f28('0x4a')],'predictiveIntervalDroppedCallsTimeout':_0x306210['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x306210[_0x0f28('0x4b')],'predictiveIntervalErlangCallsDroppedCalls':_0x306210['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x306210[_0x0f28('0x4c')],'predictiveIntervalMultiplicativeFactor':_0x306210[_0x0f28('0x4d')],'predictiveIntervalPauses':_0x306210[_0x0f28('0x4e')],'predictiveIntervalAvailable':_0x306210[_0x0f28('0x4f')],'predictiveIntervalTotalCalls':_0x306210[_0x0f28('0x50')],'message':_0x306210[_0x0f28('0x51')],'originated':_0x306210[_0x0f28('0x52')],'erlangCalls':_0x306210[_0x0f28('0x53')],'erlangCallToSecond':_0x306210[_0x0f28('0x54')],'erlangAbandonmentRate':_0x306210[_0x0f28('0x55')],'erlangBusyFactor':_0x306210['erlangBusyFactor'],'startPredictive':_0x306210['startPredictive'],'startProgressive':_0x306210['startProgressive']};if(_0x306210['Trunk']){_0x19140c[_0x0f28('0x56')]={'id':_0x306210[_0x0f28('0x56')]['id'],'name':_0x306210[_0x0f28('0x56')][_0x0f28('0x2b')],'active':_0x306210['Trunk'][_0x0f28('0x57')],'callerid':_0x306210[_0x0f28('0x56')]['callerid']};}if(_0x306210['Interval']){_0x19140c[_0x0f28('0x58')]={'id':_0x306210[_0x0f28('0x58')]['id'],'name':_0x306210[_0x0f28('0x58')]['name']};}var _0x2eb8af=md5(JSON[_0x0f28('0x59')](_0x19140c));if(_0x306210['md5']!==_0x2eb8af){_0x306210[_0x0f28('0x5')]=_0x2eb8af;emit(util[_0x0f28('0x5a')](_0x0f28('0x5b'),_0x19140c[_0x0f28('0x2b')]),_0x0f28('0x5c'),_0x19140c);}}}function emitVoiceQueueChannelRemove(_0x1d265b){logger[_0x0f28('0x5d')](_0x0f28('0x5e'),JSON['stringify'](_0x1d265b));emit(util[_0x0f28('0x5a')](_0x0f28('0x5b'),_0x1d265b[_0x0f28('0x2b')]),_0x0f28('0x5f'),_0x1d265b);io[_0x0f28('0x28')](_0x0f28('0x60'),_0x1d265b);}function notSendMessagesQueue(_0x2130aa){if(_0x2130aa[_0x0f28('0x61')]){if(_0x2130aa[_0x0f28('0x52')]===0x0&&_0x2130aa[_0x0f28('0x30')]===0x0){_0x2130aa[_0x0f28('0x61')]=![];_0x2130aa[_0x0f28('0x2e')]=0x0;_0x2130aa[_0x0f28('0x62')]=0x0;_0x2130aa[_0x0f28('0x51')]=_0x0f28('0x63');ut[_0x0f28('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2130aa['name']+'\x20is\x20not\x20active');}else{_0x2130aa[_0x0f28('0x51')]=_0x0f28('0x65');ut[_0x0f28('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2130aa[_0x0f28('0x2b')]+_0x0f28('0x66'));}emitCampaignPreview(_0x2130aa);}}Preview[_0x0f28('0x11')][_0x0f28('0x27')]=function(){var _0x5ea8c4=this;setInterval(function(){_0x5ea8c4['syncCampaigns']();},0x7cf);};Preview[_0x0f28('0x11')][_0x0f28('0x67')]=function(){var _0xa8a2b8=this[_0x0f28('0x14')];this[_0x0f28('0x18')]+=0x1;for(var _0x1c0cfc in _0xa8a2b8){if(_0xa8a2b8[_0x0f28('0x68')](_0x1c0cfc)&&(_0xa8a2b8[_0x1c0cfc]['dialMethod']==='preview'||_0xa8a2b8[_0x1c0cfc][_0x0f28('0x69')]===_0x0f28('0x6a'))&&_0xa8a2b8[_0x1c0cfc][_0x0f28('0x29')]===_0x0f28('0x2a')){if(this[_0x0f28('0x18')]>0x7){this[_0x0f28('0x18')]=0x0;this[_0x0f28('0x6b')]();}}if(_0xa8a2b8[_0x0f28('0x68')](_0x1c0cfc)&&_0xa8a2b8[_0x1c0cfc]['dialMethod']===_0x0f28('0x9')&&_0xa8a2b8[_0x1c0cfc][_0x0f28('0x29')]===_0x0f28('0x2a')){if(_0xa8a2b8[_0x1c0cfc][_0x0f28('0x6c')]){this[_0x0f28('0x6d')](_0xa8a2b8[_0x1c0cfc]);this[_0x0f28('0x6e')](_0xa8a2b8[_0x1c0cfc]);}else{notSendMessagesQueue(_0xa8a2b8[_0x1c0cfc]);}}}};Preview[_0x0f28('0x11')]['clearZombieChannel']=function(_0x52ad1d){var _0x3d690c=this;this[_0x0f28('0x6f')]['enqueue'](function(){if(!_[_0x0f28('0x70')](_0x3d690c['actions'][_0x52ad1d])){loggerAction['info'](_0x0f28('0x71'),_0x52ad1d,'Queue',_0x3d690c['actions'][_0x52ad1d][_0x0f28('0x72')],'originated:\x20',JSON[_0x0f28('0x59')](_0x3d690c['campaignsPreview'][_0x3d690c[_0x0f28('0x16')][_0x52ad1d][_0x0f28('0x72')]][_0x0f28('0x52')]),_0x0f28('0x73'),JSON['stringify'](_0x3d690c[_0x0f28('0x14')][_0x3d690c['actions'][_0x52ad1d]['queue']][_0x0f28('0x30')]),JSON[_0x0f28('0x59')](_0x3d690c[_0x0f28('0x16')][_0x52ad1d][_0x0f28('0x74')]),JSON['stringify'](_[_0x0f28('0x75')](_0x3d690c[_0x0f28('0x16')][_0x52ad1d],[_0x0f28('0x76'),'UserId',_0x0f28('0x77'),_0x0f28('0x78')])));return ami['Action']({'action':_0x0f28('0x79'),'channel':_0x3d690c[_0x0f28('0x16')][_0x52ad1d][_0x0f28('0x7a')]})[_0x0f28('0x7b')](function(_0x5dd5ac){if(_0x5dd5ac[_0x0f28('0x51')]===_0x0f28('0x7c')){setTimeout(function(){if(_0x3d690c['actions'][_0x52ad1d]){ut[_0x0f28('0x7d')](_0x3d690c[_0x0f28('0x14')][_0x3d690c[_0x0f28('0x16')][_0x52ad1d][_0x0f28('0x72')]],'[clearZombieChannel]');if(_0x3d690c[_0x0f28('0x16')][_0x52ad1d][_0x0f28('0x74')]===!![]){ut[_0x0f28('0x7e')](_0x3d690c['campaignsPreview'][_0x3d690c['actions'][_0x52ad1d][_0x0f28('0x72')]],_0x0f28('0x7f'));ut[_0x0f28('0x80')](_0x0f28('0x81')+_0x52ad1d,_0x3d690c[_0x0f28('0x16')][_0x52ad1d][_0x0f28('0x72')]);}ut[_0x0f28('0x80')](_0x0f28('0x82')+_0x52ad1d,_0x3d690c[_0x0f28('0x16')][_0x52ad1d][_0x0f28('0x72')]);delete _0x3d690c[_0x0f28('0x16')][_0x52ad1d];}},0x2328);}});}});};Preview[_0x0f28('0x11')][_0x0f28('0x6b')]=function(){var _0x2f7904=this;loggerAction[_0x0f28('0x5d')](_0x0f28('0x83'),_[_0x0f28('0x84')](this[_0x0f28('0x16')]));for(var _0x299fcf in this['actions']){if(_0x2f7904['actions'][_0x0f28('0x68')](_0x299fcf)){_0x2f7904[_0x0f28('0x85')](_0x299fcf);}}};Preview[_0x0f28('0x11')]['recallMe']=function(_0x390873){var _0x31e0c0=this;rpcDb[_0x0f28('0x86')](_0x390873['id'],ut[_0x0f28('0x87')](this[_0x0f28('0x17')]))[_0x0f28('0x88')](function(_0x4b06be){if(!_[_0x0f28('0x70')](_0x4b06be)){for(var _0x480a01=0x0;_0x480a01<_0x4b06be[_0x0f28('0x89')];_0x480a01+=0x1){if(ut[_0x0f28('0x8a')](_0x4b06be[_0x480a01][_0x0f28('0x8b')])<_0x390873[_0x0f28('0x8c')]*0x3c){if(_0x4b06be[_0x480a01]['Agent']&&!_0x4b06be[_0x480a01][_0x0f28('0x8d')][_0x0f28('0x8e')]){_0x31e0c0[_0x0f28('0x8f')](_0x4b06be[_0x480a01]['id'])[_0x0f28('0x88')](ut[_0x0f28('0x90')](_0x0f28('0x91')))[_0x0f28('0x7b')](ut['logger2'](_0x0f28('0x91')));}else{rpcDb[_0x0f28('0x92')](_0x4b06be[_0x480a01]['id']);}}else{var _0x556b95=new Action(_0x4b06be[_0x480a01],_0x390873);_0x556b95['starttime']=moment()[_0x0f28('0x5a')](_0x0f28('0x93'));_0x390873[_0x0f28('0x43')]+=0x1;ut['logCustomer'](_0x556b95,0x17,_0x0f28('0x94'));if(_0x390873[_0x0f28('0x95')]){rpcDb[_0x0f28('0x96')](ut['createBody'](_0x4b06be[_0x480a01]));rpcDb[_0x0f28('0x97')](_0x556b95,_0x0f28('0x98'));}else{ut[_0x0f28('0x99')](_0x556b95,0x16,_0x0f28('0x9a'));rpcDb[_0x0f28('0x97')](_0x556b95,_0x0f28('0x9b'));rpcDb[_0x0f28('0x9c')](_0x556b95,_0x0f28('0x9b'));}}}}})['catch'](ut[_0x0f28('0x90')]('[getContactRecallMe]'));};Preview[_0x0f28('0x11')]['setMessage']=function(_0x2ea3f4){_0x2ea3f4[_0x0f28('0x61')]=!![];if(ut[_0x0f28('0x9d')](_0x2ea3f4['loggedIn'])){_0x2ea3f4['message']=_0x0f28('0x9e');}else if(!ut['isActive'](_0x2ea3f4['dialActive'])){_0x2ea3f4[_0x0f28('0x51')]=_0x0f28('0x63');}else if(!this[_0x0f28('0x9f')](_0x2ea3f4[_0x0f28('0x56')])){if(!this[_0x0f28('0x9f')](_0x2ea3f4[_0x0f28('0xa0')])){_0x2ea3f4[_0x0f28('0x51')]=_0x0f28('0xa1');}else{_0x2ea3f4[_0x0f28('0x51')]=_0x0f28('0xa2');}}else{_0x2ea3f4['message']=_0x0f28('0xa2');}emitCampaignPreview(_0x2ea3f4);};Preview[_0x0f28('0x11')][_0x0f28('0xa3')]=function(_0x5a7a29,_0x1ae73b,_0x51a9f2){var _0x157c0e=this;var _0x84408c=this[_0x0f28('0x16')][_0x1ae73b];var _0x48c5f0=this[_0x0f28('0x14')][_0x84408c[_0x0f28('0x72')]];var _0x19d66d;if(_0x48c5f0){switch(_0x51a9f2){case'1':_0x48c5f0['outboundNoSuchCallsDay']+=0x1;_0x84408c[_0x0f28('0xa4')]+=0x1;_0x84408c[_0x0f28('0xa5')]=ut[_0x0f28('0xa6')](_0x84408c);ut[_0x0f28('0x99')](_0x84408c,0x0,_0x0f28('0xa7'));ami[_0x0f28('0x28')](_0x0f28('0xa8'),ut[_0x0f28('0xa9')](_0x84408c,_0x0f28('0xaa')));rpcDb[_0x0f28('0x97')](_0x84408c,_0x0f28('0xab'));if(ut[_0x0f28('0xa6')](_0x84408c)>=_0x48c5f0[_0x0f28('0xac')]){_0x19d66d=ut['cloneAction'](_0x84408c,0xf,_0x0f28('0xad'));rpcDb['createCustomerFinal'](_0x19d66d,_0x0f28('0xae'));}else{if(_0x84408c[_0x0f28('0xa4')]>=_0x48c5f0[_0x0f28('0xaf')]){rpcDb[_0x0f28('0x9c')](_0x84408c,_0x0f28('0xae'));}else{rpcDb['rescheduleContact'](ut[_0x0f28('0xb0')](_0x84408c,'countnosuchnumberretry',_0x48c5f0[_0x0f28('0xb1')]),_0x84408c[_0x0f28('0xb2')],_0x84408c['activeContact']);}}delete this[_0x0f28('0x16')][_0x5a7a29['linkedid']];break;case _0x0f28('0xb3'):var _0x481c75=moment()[_0x0f28('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x84408c[_0x0f28('0xb4')]=_0x481c75;_0x84408c['answertime']=_0x481c75;_0x84408c[_0x0f28('0x74')]=!![];_0x48c5f0['pTalking']+=0x1;logger[_0x0f28('0x5d')](_0x0f28('0xb5'),_0x84408c['uniqueid'],_0x0f28('0xb6'),_0x48c5f0['name'],'pTalking:\x20',_0x48c5f0[_0x0f28('0x30')]);ami[_0x0f28('0x28')](_0x0f28('0xb7'),ut[_0x0f28('0xa9')](_0x84408c,_0x0f28('0xb8'),this[_0x0f28('0x14')][_0x84408c[_0x0f28('0x72')]]));if(_0x48c5f0[_0x0f28('0xb9')]){ami[_0x0f28('0x28')](_0x0f28('0xba'),ut[_0x0f28('0xbb')](_0x84408c));}break;case'16':ami[_0x0f28('0x28')](_0x0f28('0xbc'),ut[_0x0f28('0xa9')](_0x84408c,'complete',this['campaignsPreview'][_0x84408c[_0x0f28('0x72')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x84408c,'complete'));_0x48c5f0[_0x0f28('0x39')]+=0x1;_0x48c5f0['total']+=0x1;_0x48c5f0['answered']+=0x1;ut[_0x0f28('0x7e')](_0x48c5f0,_0x0f28('0xbd'));_0x84408c[_0x0f28('0xa5')]=ut[_0x0f28('0xa6')](_0x84408c);ut[_0x0f28('0x99')](_0x84408c,0x4,_0x0f28('0xbe'));rpcDb[_0x0f28('0x97')](_0x84408c,_0x0f28('0xbf'));rpcDb[_0x0f28('0x9c')](_0x84408c,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x0f28('0xc0')](_0x84408c);_0x48c5f0[_0x0f28('0xc1')]+=_0x84408c[_0x0f28('0xc2')];_0x48c5f0[_0x0f28('0x31')]+=_0x84408c[_0x0f28('0xc2')];logger['info']('[syncHangup][talking][decrement]',_0x84408c[_0x0f28('0xc3')],_0x0f28('0xb6'),_0x48c5f0[_0x0f28('0x2b')],'pTalking:\x20',_0x48c5f0[_0x0f28('0x30')]);delete this[_0x0f28('0x16')][_0x5a7a29[_0x0f28('0xc4')]];break;case'BUSY':_0x48c5f0[_0x0f28('0x3b')]+=0x1;_0x84408c[_0x0f28('0xc5')]+=0x1;_0x84408c[_0x0f28('0xa5')]=ut[_0x0f28('0xa6')](_0x84408c);ut[_0x0f28('0x99')](_0x84408c,0x5,'Busy');ami['emit'](_0x0f28('0xc6'),ut[_0x0f28('0xa9')](_0x84408c,_0x0f28('0xc7')));rpcDb[_0x0f28('0x97')](_0x84408c,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x0f28('0xa6')](_0x84408c)>=_0x48c5f0[_0x0f28('0xac')]){_0x19d66d=ut[_0x0f28('0xc8')](_0x84408c,0xf,_0x0f28('0xad'));rpcDb[_0x0f28('0x9c')](_0x19d66d,_0x0f28('0xc9'));}else{if(_0x84408c['countbusyretry']>=_0x48c5f0[_0x0f28('0xca')]){rpcDb['createCustomerFinal'](_0x84408c,_0x0f28('0xcb'));}else{rpcDb[_0x0f28('0xcc')](ut[_0x0f28('0xb0')](_0x84408c,_0x0f28('0xc5'),_0x48c5f0[_0x0f28('0xcd')]),_0x84408c[_0x0f28('0xb2')],_0x84408c[_0x0f28('0xce')]);}}break;case _0x0f28('0xcf'):_0x48c5f0['outboundNoAnswerCallsDay']+=0x1;_0x84408c[_0x0f28('0xd0')]+=0x1;_0x84408c[_0x0f28('0xa5')]=ut[_0x0f28('0xa6')](_0x84408c);ut[_0x0f28('0x99')](_0x84408c,0x3,_0x0f28('0xd1'));ami[_0x0f28('0x28')]('custom:agentnoanswer',ut[_0x0f28('0xa9')](_0x84408c,_0x0f28('0xd2')));rpcDb['createCustomerHistory'](_0x84408c,_0x0f28('0xd3'));if(ut[_0x0f28('0xa6')](_0x84408c)>=_0x48c5f0[_0x0f28('0xac')]){_0x19d66d=ut[_0x0f28('0xc8')](_0x84408c,0xf,_0x0f28('0xad'));rpcDb[_0x0f28('0x9c')](_0x19d66d,_0x0f28('0xd4'));}else{if(_0x84408c[_0x0f28('0xd0')]>=_0x48c5f0[_0x0f28('0xd5')]){rpcDb[_0x0f28('0x9c')](_0x84408c,_0x0f28('0xd3'));}else{rpcDb[_0x0f28('0xcc')](ut['scheduledAt'](_0x84408c,_0x0f28('0xd0'),_0x48c5f0[_0x0f28('0xd6')]),_0x84408c[_0x0f28('0xb2')],_0x84408c[_0x0f28('0xce')]);}}break;case _0x0f28('0xd7'):_0x48c5f0[_0x0f28('0x3c')]+=0x1;_0x84408c[_0x0f28('0xd8')]+=0x1;_0x84408c[_0x0f28('0xa5')]=ut[_0x0f28('0xa6')](_0x84408c);ut[_0x0f28('0x99')](_0x84408c,0x8,_0x0f28('0xd9'));ami[_0x0f28('0x28')](_0x0f28('0xda'),ut[_0x0f28('0xa9')](_0x84408c,'congestion'));rpcDb['createCustomerHistory'](_0x84408c,_0x0f28('0xdb'));if(ut[_0x0f28('0xa6')](_0x84408c)>=_0x48c5f0['dialGlobalMaxRetry']){_0x19d66d=ut[_0x0f28('0xc8')](_0x84408c,0xf,_0x0f28('0xad'));rpcDb[_0x0f28('0x9c')](_0x19d66d,_0x0f28('0xdc'));}else{if(_0x84408c[_0x0f28('0xd8')]>=_0x48c5f0[_0x0f28('0xdd')]){rpcDb[_0x0f28('0x9c')](_0x84408c,_0x0f28('0xdb'));}else{rpcDb[_0x0f28('0xcc')](ut[_0x0f28('0xb0')](_0x84408c,'countcongestionretry',_0x48c5f0[_0x0f28('0xcd')]),_0x84408c[_0x0f28('0xb2')],_0x84408c[_0x0f28('0xce')]);}}break;case'CANCEL':_0x48c5f0['outboundRejectCallsDay']+=0x1;_0x84408c[_0x0f28('0xde')]+=0x1;_0x84408c[_0x0f28('0xa5')]=ut[_0x0f28('0xa6')](_0x84408c);ut[_0x0f28('0x99')](_0x84408c,0x14,_0x0f28('0xdf'));ami['emit'](_0x0f28('0xe0'),ut[_0x0f28('0xa9')](_0x84408c,_0x0f28('0xe1')));rpcDb[_0x0f28('0x97')](_0x84408c,'[syncHangupRequest][logAgentReject]');if(ut[_0x0f28('0xa6')](_0x84408c)>=_0x48c5f0['dialGlobalMaxRetry']){_0x19d66d=ut[_0x0f28('0xc8')](_0x84408c,0x14,_0x0f28('0xdf'));rpcDb[_0x0f28('0x9c')](_0x19d66d,_0x0f28('0xe2'));}else{if(_0x84408c[_0x0f28('0xde')]>=_0x48c5f0[_0x0f28('0xe3')]){rpcDb[_0x0f28('0x9c')](_0x84408c,_0x0f28('0xe2'));}else{rpcDb[_0x0f28('0xcc')](ut[_0x0f28('0xb0')](_0x84408c,'countagentrejectretry',_0x48c5f0[_0x0f28('0xe4')]),_0x84408c[_0x0f28('0xb2')],_0x84408c['activeContact']);}}break;case _0x0f28('0xe5'):_0x48c5f0[_0x0f28('0x46')]+=0x1;_0x84408c[_0x0f28('0xe6')]+=0x1;_0x84408c['countglobal']=ut[_0x0f28('0xa6')](_0x84408c);ut[_0x0f28('0x99')](_0x84408c,0xb,_0x0f28('0xe7'));rpcDb['createCustomerHistory'](_0x84408c,_0x0f28('0xe8'));if(ut[_0x0f28('0xa6')](_0x84408c)>=_0x48c5f0[_0x0f28('0xac')]){_0x19d66d=ut[_0x0f28('0xc8')](_0x84408c,0xf,'Global');rpcDb[_0x0f28('0x9c')](_0x19d66d,_0x0f28('0xe8'));}else{if(_0x84408c[_0x0f28('0xe9')]>=_0x48c5f0['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x84408c,_0x0f28('0xe8'));}else{rpcDb[_0x0f28('0xcc')](ut['scheduledAt'](_0x84408c,_0x0f28('0xe6'),_0x48c5f0['dialAbandonedRetryFrequency']),_0x84408c['unlockAgent'],_0x84408c[_0x0f28('0xce')]);}}break;case'18':_0x48c5f0[_0x0f28('0x45')]+=0x1;_0x84408c[_0x0f28('0xea')]+=0x1;_0x84408c[_0x0f28('0xa5')]=ut[_0x0f28('0xa6')](_0x84408c);ut['logCustomer'](_0x84408c,0x12,_0x5a7a29['cause-txt']||_0x5a7a29[_0x0f28('0xeb')]);ami[_0x0f28('0x28')](_0x0f28('0xec'),ut[_0x0f28('0xa9')](_0x84408c,_0x0f28('0xed')));rpcDb[_0x0f28('0x97')](_0x84408c,_0x0f28('0xee'));if(ut['totalGlobal'](_0x84408c)>=_0x48c5f0[_0x0f28('0xac')]){_0x19d66d=ut[_0x0f28('0xc8')](_0x84408c,0xf,_0x0f28('0xad'));rpcDb[_0x0f28('0x9c')](_0x19d66d,_0x0f28('0xee'));}else{rpcDb[_0x0f28('0x9c')](_0x84408c,_0x0f28('0xee'));}delete this[_0x0f28('0x16')][_0x5a7a29['linkedid']];break;case'19':_0x48c5f0[_0x0f28('0x45')]+=0x1;_0x84408c[_0x0f28('0xa5')]=ut['totalGlobal'](_0x84408c);ut[_0x0f28('0x99')](_0x84408c,0x13,_0x5a7a29['cause-txt']||_0x5a7a29[_0x0f28('0xeb')]);ami['emit']('custom:amd',ut[_0x0f28('0xa9')](_0x84408c,_0x0f28('0xed')));rpcDb['createCustomerHistory'](_0x84408c,_0x0f28('0xef'));if(ut[_0x0f28('0xa6')](_0x84408c)>=_0x48c5f0['dialGlobalMaxRetry']){_0x19d66d=ut[_0x0f28('0xc8')](_0x84408c,0xf,_0x0f28('0xad'));rpcDb[_0x0f28('0x9c')](_0x19d66d,_0x0f28('0xef'));}else{rpcDb[_0x0f28('0x9c')](_0x84408c,_0x0f28('0xef'));}delete this[_0x0f28('0x16')][_0x5a7a29[_0x0f28('0xc4')]];break;default:if(_0x84408c[_0x0f28('0x74')]){ut['decrementTalkink'](_0x48c5f0,'[default]');ut[_0x0f28('0x80')](_0x0f28('0xf0')+_0x48c5f0[_0x0f28('0x2b')],_0x5a7a29);}_0x48c5f0['outboundUnknownCallsDay']+=0x1;_0x84408c[_0x0f28('0xa5')]=ut['totalGlobal'](_0x84408c);ut[_0x0f28('0x99')](_0x84408c,0xc,_0x5a7a29['cause-txt']||_0x5a7a29['dialstatus']);rpcDb[_0x0f28('0x97')](_0x84408c,_0x0f28('0xf1'));if(ut['totalGlobal'](_0x84408c)>=_0x48c5f0[_0x0f28('0xac')]){_0x19d66d=ut['cloneAction'](_0x84408c,0xf,_0x0f28('0xad'));rpcDb[_0x0f28('0x9c')](_0x19d66d,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0f28('0x9c')](_0x84408c,_0x0f28('0xf2'));}delete this['actions'][_0x5a7a29[_0x0f28('0xc4')]];}if(!(_0x84408c[_0x0f28('0x74')]&&_0x51a9f2==='16')){ut['updateOriginated'](_0x48c5f0,_0x0f28('0xf3'));logger[_0x0f28('0x5d')](_0x0f28('0xf4'),_0x84408c[_0x0f28('0xc3')],_0x0f28('0xb6'),_0x48c5f0[_0x0f28('0x2b')],_0x0f28('0xf5'),_0x48c5f0[_0x0f28('0x52')]);}if(_0x51a9f2!==_0x0f28('0xb3')){delete this[_0x0f28('0x16')][_0x5a7a29[_0x0f28('0xc4')]];delete this['actions'][_0x5a7a29[_0x0f28('0xf6')]];}}};Preview[_0x0f28('0x11')]['callProgressDetectingAgent']=function(_0x3878e5,_0x498c0d,_0x416438){if(_[_0x0f28('0xf7')](_0x498c0d)&&_0x0f28('0xf8')!==typeof _0x498c0d){return;}if(_[_0x0f28('0xf7')](_0x416438)&&'object'!==typeof _0x416438){return;}switch(_0x416438[_0x0f28('0xf9')]){case'0':ut[_0x0f28('0xfa')](_0x3878e5,0x0,'NoSuchNumber');rpcDb[_0x0f28('0xfb')](_0x3878e5,_0x0f28('0xfc'));break;case'3':ut[_0x0f28('0xfa')](_0x3878e5,0x3,_0x0f28('0xd1'));rpcDb['createAgentHistory'](_0x3878e5,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x0f28('0xfa')](_0x3878e5,0x5,'Busy');rpcDb[_0x0f28('0xfb')](_0x3878e5,_0x0f28('0xfd'));break;case'8':ut[_0x0f28('0xfa')](_0x3878e5,0x8,_0x0f28('0xd9'));rpcDb[_0x0f28('0xfb')](_0x3878e5,_0x0f28('0xfe'));break;case'22':ut[_0x0f28('0xfa')](_0x3878e5,0x16,_0x0f28('0xff'));rpcDb[_0x0f28('0xfb')](_0x3878e5,_0x0f28('0x100'));break;default:ut[_0x0f28('0xfa')](_0x3878e5,0xc,_0x416438['reason']);rpcDb[_0x0f28('0xfb')](_0x3878e5,_0x0f28('0xfe'));}ut[_0x0f28('0x7d')](_0x498c0d,_0x0f28('0x101'));logger[_0x0f28('0x5d')](_0x0f28('0x102'),_0x3878e5[_0x0f28('0xc3')],'\x20Queue',_0x498c0d['name'],_0x0f28('0xf5'),_0x498c0d[_0x0f28('0x52')]);delete this[_0x0f28('0x16')][_0x3878e5['uniqueid']];};Preview['prototype'][_0x0f28('0x103')]=function(_0x563a0b,_0x2675ee,_0x2c98d4,_0x495d07,_0x2d6b71){var _0x409727=this;return new BPromise(function(_0x15e1c0,_0x46170d){if(_[_0x0f28('0x70')](_0x2675ee)||_[_0x0f28('0x70')](_0x2675ee[_0x0f28('0x104')])||_[_0x0f28('0x70')](_0x2675ee[_0x0f28('0x104')][_0x0f28('0x105')])||_[_0x0f28('0x70')](_0x2675ee[_0x0f28('0x77')])){_0x46170d(ut[_0x0f28('0x51')](_0x0f28('0x106'),_0x495d07,_0x2d6b71));return;}var _0x49b9de=uuid['v4']();var _0x1253dd=_0x409727[_0x0f28('0x14')][_0x2675ee[_0x0f28('0x107')]['name']];var _0x46e622=_0x2c98d4?_0x409727[_0x0f28('0x17')][_0x2c98d4]['id']:undefined;_0x409727['actions'][_0x49b9de]=new Action(_0x2675ee,_0x1253dd,_0x49b9de,_0x2c98d4,_0x46e622);var _0x3b9456=_0x409727[_0x0f28('0x16')][_0x49b9de];_0x3b9456[_0x0f28('0xb2')]=_0x495d07;_0x3b9456[_0x0f28('0xce')]=_0x2d6b71;_0x3b9456[_0x0f28('0x108')]=_0x2c98d4;if(_['isEmpty'](_0x563a0b)){_0x409727[_0x0f28('0x109')](_0x3b9456,_0x1253dd,_0x2675ee,_0x2c98d4)[_0x0f28('0x88')](function(_0x309855){logger['info'](_0x0f28('0x10a'),_0x0f28('0x10b')+_0x3b9456['queue']+'\x20IdHopper:\x20'+_0x3b9456[_0x0f28('0x10c')],JSON[_0x0f28('0x59')](_0x309855));ami[_0x0f28('0x28')](_0x0f28('0x10d'),ut[_0x0f28('0xa9')](_0x3b9456,_0x0f28('0x10e'),_0x409727[_0x0f28('0x14')][_0x3b9456[_0x0f28('0x72')]]));_0x15e1c0(ut[_0x0f28('0x51')](_0x0f28('0x10f')));})[_0x0f28('0x7b')](function(_0x1c815a){ut[_0x0f28('0x64')](_0x0f28('0x110'),_0x1c815a);_0x46170d(ut[_0x0f28('0x51')](_0x0f28('0x111'),_0x495d07,_0x2d6b71));});}else{_0x1253dd[_0x0f28('0x3a')]+=0x1;ut['logBlacklist'](_0x3b9456);rpcDb[_0x0f28('0x112')](_0x3b9456,_0x0f28('0x113'));delete _0x409727[_0x0f28('0x16')][_0x49b9de];_0x46170d(ut['message'](_0x0f28('0x114'),_0x495d07,_0x2d6b71));}});};Preview[_0x0f28('0x11')][_0x0f28('0x9f')]=function(_0x541268){return!_['isNil'](_0x541268)&&!_[_0x0f28('0x70')](_0x541268[_0x0f28('0x2b')])&&!_['isNil'](_0x541268[_0x0f28('0x57')])&&_0x541268[_0x0f28('0x57')]&&!_['isNil'](this[_0x0f28('0x15')][util['format'](_0x0f28('0x115'),_0x541268['name'])])&&!_[_0x0f28('0x70')](this['trunks'][util['format']('SIP/%s',_0x541268[_0x0f28('0x2b')])]['status'])&&(this['trunks'][util[_0x0f28('0x5a')](_0x0f28('0x115'),_0x541268['name'])][_0x0f28('0x79')]===_0x0f28('0x116')||this[_0x0f28('0x15')][util['format'](_0x0f28('0x115'),_0x541268[_0x0f28('0x2b')])][_0x0f28('0x79')]===_0x0f28('0x117'));};Preview[_0x0f28('0x11')][_0x0f28('0x8f')]=function(_0x3955c2,_0x5c4ca7){var _0x3079b6=this;return new BPromise(function(_0x3be915,_0x39d0b1){_0x3079b6[_0x0f28('0x118')](_0x3955c2,_0x5c4ca7)[_0x0f28('0x88')](function(_0x114c54){_0x3be915(_[_0x0f28('0x75')](_0x114c54,['message']));})[_0x0f28('0x7b')](function(_0x81c86e){if(_0x81c86e['unlock']){rpcDb[_0x0f28('0x119')](_0x3955c2);}if(_0x81c86e[_0x0f28('0x57')]){rpcDb['disableContact'](_0x3955c2);}_0x39d0b1(_[_0x0f28('0x75')](_0x81c86e,[_0x0f28('0x51')]));});});};Preview['prototype'][_0x0f28('0x118')]=function(_0x4d1760,_0xe08c00){var _0x1fbc16=this;return new BPromise(function(_0x439ad5,_0x321786){var _0x5a68a2,_0xc93aa1;rpcDb['getContactPreview'](_0x4d1760)[_0x0f28('0x88')](function(_0x24f215){if(!_[_0x0f28('0x70')](_0x24f215[0x0])){_0xc93aa1=_0x24f215[0x0][_0x0f28('0x11a')]?![]:!![];_0x5a68a2=_0x24f215[0x0][_0x0f28('0x11a')]?!![]:![];_0x5a68a2=_0xe08c00?!![]:_0x5a68a2;}var _0x3fabcd=_0x1fbc16['validateContact'](_0x24f215);if(_0x3fabcd[_0x0f28('0x11b')]){rpcDb[_0x0f28('0x11c')](_[_0x0f28('0x75')](_0x24f215[0x0],[_0x0f28('0x77'),_0x0f28('0x11d')]))[_0x0f28('0x88')](function(_0x44275a){_0x1fbc16[_0x0f28('0x103')](_0x44275a,_0x24f215[0x0],_0xe08c00,_0xc93aa1,_0x5a68a2)[_0x0f28('0x88')](function(_0xef02){_0x439ad5(_0xef02);})['catch'](function(_0x241863){_0x321786(_0x241863);});})['catch'](function(_0x34143f){ut[_0x0f28('0x64')]('[Preview][checkIsBlackList]',_0x34143f);_0x321786(ut[_0x0f28('0x51')](_0x0f28('0x11e'),_0xc93aa1,_0x5a68a2));});}else{_0x321786(ut['message'](_0x3fabcd[_0x0f28('0x51')],_0xc93aa1,_0x5a68a2));}})['catch'](function(_0x143032){ut[_0x0f28('0x64')](_0x0f28('0x11f'),_0x143032);_0x321786(ut[_0x0f28('0x51')](_0x0f28('0x11e'),![],!![]));});});};Preview[_0x0f28('0x11')][_0x0f28('0x120')]=function(_0x143a8c){if(_[_0x0f28('0x70')](_0x143a8c)||_['isEmpty'](_0x143a8c)||!_['isNil'](_0x143a8c[0x0][_0x0f28('0x8d')])&&_[_0x0f28('0x70')](_0x143a8c[0x0][_0x0f28('0x8d')][_0x0f28('0x2b')])){ut[_0x0f28('0x64')](_0x0f28('0x121'),_0x143a8c);return{'isValid':![],'message':_0x0f28('0x122')};}var _0x170a97=this[_0x0f28('0x14')][_0x143a8c[0x0][_0x0f28('0x107')][_0x0f28('0x2b')]];_0x170a97[_0x0f28('0x51')]=_0x0f28('0xa2');if(_[_0x0f28('0x70')](_0x170a97)){ut[_0x0f28('0x64')](_0x0f28('0x123'),_0x170a97);return{'isValid':![],'message':_0x0f28('0x124')};}if(!this[_0x0f28('0x9f')](_0x170a97[_0x0f28('0x56')])){ut[_0x0f28('0x64')](_0x0f28('0x125'),_0x0f28('0x126')+_0x170a97[_0x0f28('0x2b')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x0f28('0x9f')](_0x170a97[_0x0f28('0xa0')])){ut[_0x0f28('0x64')](_0x0f28('0x125'),_0x170a97[_0x0f28('0x2b')]+_0x0f28('0x127'));return{'isValid':![],'message':_0x0f28('0x128')};}}if(!ut[_0x0f28('0x129')](_0x170a97[_0x0f28('0x6c')])){ut[_0x0f28('0x64')]('[Preview][validateContact][Campaign\x20Active]',_0x170a97[_0x0f28('0x2b')]+_0x0f28('0x12a'));return{'isValid':![],'message':_0x0f28('0x126')+_0x170a97[_0x0f28('0x2b')]+_0x0f28('0x12a')};}return{'isValid':!![],'message':_0x0f28('0x12b')};};Preview[_0x0f28('0x11')]['execCall']=function(_0x10e872,_0x34916e,_0x1d0dce,_0x4841b7){var _0x3f22ea=this;return new BPromise(function(_0x388518,_0x3fac6e){var _0x3b6f28=_0x10e872[_0x0f28('0xc3')];var _0x434be7=_0x3f22ea[_0x0f28('0x9f')](_0x34916e[_0x0f28('0x56')])?util['format'](_0x0f28('0x12c'),_0x34916e['Trunk'][_0x0f28('0x2b')],_[_0x0f28('0x70')](_0x34916e[_0x0f28('0x38')])?'':_0x34916e['dialPrefix'][_0x0f28('0x12d')]()||'',_0x34916e[_0x0f28('0x12e')]>0x0?_0x1d0dce[_0x0f28('0x104')][_0x0f28('0x105')][_0x0f28('0x12f')](_0x34916e[_0x0f28('0x12e')]):_0x1d0dce[_0x0f28('0x104')][_0x0f28('0x105')]):util['format'](_0x0f28('0x12c'),_[_0x0f28('0x70')](_0x34916e[_0x0f28('0xa0')])?_0x34916e[_0x0f28('0x56')]['name']:_0x34916e['TrunkBackup'][_0x0f28('0x2b')],_[_0x0f28('0x70')](_0x34916e[_0x0f28('0x38')])?'':_0x34916e[_0x0f28('0x38')][_0x0f28('0x12d')]()||'',_0x34916e['dialCutDigit']>0x0?_0x1d0dce[_0x0f28('0x104')][_0x0f28('0x105')][_0x0f28('0x12f')](_0x34916e['dialCutDigit']):_0x1d0dce[_0x0f28('0x104')][_0x0f28('0x105')]);var _0x5b626e=_0x3f22ea[_0x0f28('0x9f')](_0x34916e[_0x0f28('0x56')])?ut[_0x0f28('0x130')](_0x34916e[_0x0f28('0x56')][_0x0f28('0x131')],_0x34916e['dialOriginateCallerIdName'],_0x34916e[_0x0f28('0x132')]>0x0?ut['getCallerIdRandom'](_0x34916e[_0x0f28('0x133')],_0x34916e[_0x0f28('0x132')]):_0x34916e[_0x0f28('0x133')]):ut[_0x0f28('0x130')](_[_0x0f28('0x70')](_0x34916e[_0x0f28('0xa0')])?_0x34916e['Trunk'][_0x0f28('0x131')]:_0x34916e[_0x0f28('0xa0')][_0x0f28('0x131')],_0x34916e[_0x0f28('0x36')],_0x34916e[_0x0f28('0x132')]>0x0?ut[_0x0f28('0x134')](_0x34916e[_0x0f28('0x133')],_0x34916e[_0x0f28('0x132')]):_0x34916e[_0x0f28('0x133')]);if(_0x5b626e){_0x10e872[_0x0f28('0x135')]=ut[_0x0f28('0x136')](_0x5b626e);_0x10e872[_0x0f28('0x137')]=ut[_0x0f28('0x138')](_0x5b626e);}var _0x45af9a=ut[_0x0f28('0x139')](_0x34916e,_0x1d0dce,_0x434be7,_0x5b626e,_0x3b6f28,_0x10e872);_[_0x0f28('0x13a')](_0x10e872,ut[_0x0f28('0x13b')](_0x45af9a));_0x10e872['starttime']=moment()[_0x0f28('0x5a')](_0x0f28('0x93'));ami[_0x0f28('0x13c')](ut['variablesAction'](_0x10e872,_0x34916e,_0x45af9a,_0x10e872[_0x0f28('0xce')],_0x4841b7))['then'](function(_0x59ea95){var _0x4d6521=_0x10e872[_0x0f28('0x13d')];if(!_['isNil'](_0x4d6521)){if(!_[_0x0f28('0x70')](_0x3f22ea['agents'][_0x4d6521])){_0x3f22ea[_0x0f28('0x17')][_0x4d6521][_0x0f28('0x13e')]=_0x10e872[_0x0f28('0x13f')];emit(util[_0x0f28('0x5a')](_0x0f28('0x140'),_0x3f22ea[_0x0f28('0x17')][_0x4d6521]['name']),'user:agentconnect',{'destaccountcode':_0x3f22ea[_0x0f28('0x17')][_0x4d6521][_0x0f28('0x141')],'destconnectedlinenum':_0x10e872['calleridnum']});}}_0x34916e[_0x0f28('0x52')]+=0x1;logger['info'](_0x0f28('0x142'),_0x3b6f28,'\x20Queue',_0x34916e[_0x0f28('0x2b')],'originated:\x20',_0x34916e['originated']);_0x388518(_0x59ea95);})['catch'](function(_0x4c624f){ut['logAgent'](_0x10e872,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x10e872,'[originateFailure][logOriginateFailure]');_0x3fac6e(_0x4c624f);});});};Preview[_0x0f28('0x11')][_0x0f28('0x21')]=function(_0xeff475){if(this['actions'][_0xeff475[_0x0f28('0xc4')]]){this['actions'][_0xeff475[_0x0f28('0xc4')]][_0x0f28('0x7a')]=_0xeff475[_0x0f28('0x7a')];}};Preview[_0x0f28('0x11')][_0x0f28('0x1a')]=function(_0x50e694){var _0x2d3b87=this;var _0x4b2f22=this['actions'][_0x50e694[_0x0f28('0x143')]];if(_0x4b2f22){if(_0x4b2f22['lookAgent']&&this[_0x0f28('0x17')][_0x4b2f22[_0x0f28('0x108')]]){ut[_0x0f28('0x144')](_0x4b2f22,this['agents'][_0x4b2f22[_0x0f28('0x108')]][_0x0f28('0x2b')],this[_0x0f28('0x17')][_0x4b2f22[_0x0f28('0x108')]]['id']);}var _0x30b3bf=_[_0x0f28('0x145')](_0x4b2f22);_0x30b3bf[_0x0f28('0xb4')]=moment()[_0x0f28('0x5a')](_0x0f28('0x93'));var _0x255e8f=_0x2d3b87[_0x0f28('0x14')][_0x4b2f22['queue']];if(ut[_0x0f28('0x146')](_0x50e694['response'])){if(_0x4b2f22[_0x0f28('0xb2')]){rpcDb[_0x0f28('0x119')](_0x4b2f22[_0x0f28('0x10c')]);}if(_0x4b2f22[_0x0f28('0xce')]){rpcDb['disableContact'](_0x4b2f22[_0x0f28('0x10c')]);}ami[_0x0f28('0x28')]('custom:agentringnoanswer',ut[_0x0f28('0xa9')](_0x4b2f22,_0x0f28('0x147'),this[_0x0f28('0x14')][_0x4b2f22[_0x0f28('0x72')]]));this[_0x0f28('0x148')](_0x30b3bf,_0x255e8f,_0x50e694);}else{_0x4b2f22[_0x0f28('0x149')]=moment()[_0x0f28('0x5a')](_0x0f28('0x93'));ut[_0x0f28('0xfa')](_0x30b3bf,0x4,_0x0f28('0xbe'));rpcDb['createAgentHistory'](_0x30b3bf,_0x0f28('0x14a'));}}};Preview['prototype'][_0x0f28('0x1c')]=function(_0x20cd4d){var _0x48df41=this;var _0x3c4a84=this[_0x0f28('0x16')][_0x20cd4d[_0x0f28('0xc4')]];var _0x58f427;if(_0x3c4a84){_0x58f427=this[_0x0f28('0x14')][_0x3c4a84[_0x0f28('0x72')]];logger[_0x0f28('0x5d')]('[syncHangup][talking]',_0x20cd4d[_0x0f28('0xc4')],'\x20Queue',_0x58f427[_0x0f28('0x2b')],_0x0f28('0x73'),_0x58f427[_0x0f28('0x30')]);}if(this[_0x0f28('0x16')][_0x20cd4d['linkedid']]&&_0x20cd4d['linkedid']!==_0x20cd4d['uniqueid']){if(_0x20cd4d[_0x0f28('0x14b')]==='16'&&this[_0x0f28('0x16')][_0x20cd4d[_0x0f28('0xc4')]][_0x0f28('0x74')]){this['callProgressDetectingCustomer'](_0x20cd4d,_0x20cd4d[_0x0f28('0xc4')],_0x20cd4d[_0x0f28('0x14b')]);}else if(this[_0x0f28('0x16')][_0x20cd4d[_0x0f28('0xc4')]][_0x0f28('0x74')]){logger['info'](_0x0f28('0x14c'),_0x20cd4d[_0x0f28('0xc4')],_0x20cd4d[_0x0f28('0x14b')],_0x0f28('0xb6'),_0x58f427[_0x0f28('0x2b')],_0x0f28('0x73'),_0x58f427[_0x0f28('0x30')]);this['callProgressDetectingCustomer'](_0x20cd4d,_0x20cd4d[_0x0f28('0xc4')],_0x20cd4d[_0x0f28('0x14b')]);}}else if(_0x3c4a84&&_[_0x0f28('0x70')](_0x3c4a84['statedesc'])&&_0x58f427[_0x0f28('0x14d')]&&_0x20cd4d[_0x0f28('0xc4')]===_0x20cd4d['uniqueid']&&_['isNil'](_0x20cd4d[_0x0f28('0xf9')])&&_0x20cd4d[_0x0f28('0x14b')]==='16'&&_0x20cd4d[_0x0f28('0x14e')]==='6'&&_[_0x0f28('0xf7')](_0x3c4a84[_0x0f28('0x14f')])){if(_0x3c4a84[_0x0f28('0xb2')]){rpcDb['unlockContact'](_0x3c4a84['idContact']);}if(_0x3c4a84[_0x0f28('0xce')]){rpcDb['disableContact'](_0x3c4a84[_0x0f28('0x10c')]);}_0x20cd4d[_0x0f28('0xf9')]='22';this[_0x0f28('0x148')](_0x3c4a84,_0x58f427,_0x20cd4d);}else if(_0x3c4a84&&_0x3c4a84[_0x0f28('0x14f')]){if(_0x20cd4d['cause']==='16'&&this['actions'][_0x20cd4d[_0x0f28('0xc4')]][_0x0f28('0x74')]){logger[_0x0f28('0x5d')](_0x0f28('0x150'),_0x20cd4d[_0x0f28('0xc4')],_0x20cd4d[_0x0f28('0x14b')],_0x0f28('0xb6'),_0x58f427[_0x0f28('0x2b')],_0x0f28('0x73'),_0x58f427[_0x0f28('0x30')]);this[_0x0f28('0xa3')](_0x20cd4d,_0x20cd4d['linkedid'],_0x20cd4d['cause']);}else if(this['actions'][_0x20cd4d[_0x0f28('0xc4')]][_0x0f28('0x74')]){logger[_0x0f28('0x5d')]('[syncHangup][talking][cause]',_0x20cd4d['linkedid'],_0x20cd4d[_0x0f28('0x14b')],_0x0f28('0xb6'),_0x58f427[_0x0f28('0x2b')],_0x0f28('0x73'),_0x58f427[_0x0f28('0x30')]);this[_0x0f28('0xa3')](_0x20cd4d,_0x20cd4d['linkedid'],_0x20cd4d[_0x0f28('0x14b')]);}}};Preview[_0x0f28('0x11')][_0x0f28('0x20')]=function(_0x3e9296){if(this['actions'][_0x3e9296[_0x0f28('0xf6')]]&&_0x3e9296[_0x0f28('0xf6')]!==_0x3e9296[_0x0f28('0x151')]){this[_0x0f28('0xa3')](_0x3e9296,_0x3e9296[_0x0f28('0xf6')],_0x3e9296[_0x0f28('0xeb')]);}};Preview['prototype'][_0x0f28('0x1e')]=function(_0x59a97b){if(this[_0x0f28('0x16')][_0x59a97b[_0x0f28('0xc4')]]&&_0x59a97b['linkedid']!==_0x59a97b['uniqueid']&&!this['actions'][_0x59a97b[_0x0f28('0xc4')]][_0x0f28('0x74')]){if(_0x59a97b[_0x0f28('0x14b')]==='1'){this[_0x0f28('0xa3')](_0x59a97b,_0x59a97b['linkedid'],_0x59a97b['cause']);}}};Preview['prototype'][_0x0f28('0x152')]=function(_0x3ae711,_0x295269,_0x10895a){if(this[_0x0f28('0x16')][_0x3ae711]){if(_[_0x0f28('0x70')](this[_0x0f28('0x16')][_0x3ae711][_0x0f28('0x153')])){this[_0x0f28('0x16')][_0x3ae711][_0x0f28('0x153')]={};}this[_0x0f28('0x16')][_0x3ae711][_0x0f28('0x153')][_0x295269]=_0x10895a;}};Preview['prototype'][_0x0f28('0x23')]=function(_0x58ce62){try{if(!_['isNil'](_0x58ce62)){if(ut[_0x0f28('0x154')](_[_0x0f28('0x155')](_0x58ce62[_0x0f28('0x156')])[0x0])){this[_0x0f28('0x152')](_0x58ce62[_0x0f28('0xc3')],_['keys'](_0x58ce62[_0x0f28('0x156')])[0x0],_0x58ce62[_0x0f28('0x157')]);}}}catch(_0x302c62){logger[_0x0f28('0x158')]('[syncVarSet][Preview]',util[_0x0f28('0x159')](_0x302c62,{'showHidden':![],'depth':null}));}};Preview[_0x0f28('0x11')][_0x0f28('0x25')]=function(_0x5eae68){if(_0x5eae68){if(this[_0x0f28('0x16')][_0x5eae68['transfertargetlinkedid']]){this[_0x0f28('0x16')][_0x5eae68[_0x0f28('0x15a')]][_0x0f28('0x14f')]=!![];}}};Preview[_0x0f28('0x11')][_0x0f28('0x15b')]=function(_0x26d4a0){if(_0x26d4a0){if(this[_0x0f28('0x16')][_0x26d4a0['transfererlinkedid']]){this[_0x0f28('0x16')][_0x26d4a0['transfererlinkedid']][_0x0f28('0x14f')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 923b9fa..46a7a11 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 _0x30c3=['from-sip','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','bluebird','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','endtime','connectedlinename','context'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x30c3,0x191));var _0x330c=function(_0x1bfd60,_0x11cad){_0x1bfd60=_0x1bfd60-0x0;var _0x168c28=_0x30c3[_0x1bfd60];return _0x168c28;};'use strict';var util=require('util');var BPromise=require(_0x330c('0x0'));var logger=require('../../../config/logger')('preview');var _=require(_0x330c('0x1'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x330c('0x2'));var cmHopperHistory=require(_0x330c('0x3'));var cmHopperBlack=require(_0x330c('0x4'));var voiceQueueRt=require(_0x330c('0x5'));var agentReportPreview=require(_0x330c('0x6'));var voiceQueueReport=require(_0x330c('0x7'));function loggerCatch(_0x224036){return function(_0x5e8c28){logger[_0x330c('0x8')](_0x224036,util[_0x330c('0x9')](_0x5e8c28,{'showHidden':![],'depth':null}));};}function create(_0x49416d){return BPromise[_0x330c('0xa')]()['then'](cmHopperHistory[_0x330c('0xb')](_0x49416d))[_0x330c('0xc')](loggerCatch(_0x330c('0xd')));}function createAgent(_0x35f65c){return BPromise[_0x330c('0xa')]()[_0x330c('0xe')](agentReportPreview['createHistory'](_0x35f65c))[_0x330c('0xc')](loggerCatch(_0x330c('0xd')));}function moveContact(_0x3bde5a){return BPromise[_0x330c('0xa')]()['then'](cmHopper['moveContactManagedDialer'](_0x3bde5a,!![]))[_0x330c('0xc')](loggerCatch(_0x330c('0xf')));}exports[_0x330c('0x10')]=function(_0x198e8f){return BPromise[_0x330c('0xa')]()[_0x330c('0xe')](cmHopperBlack[_0x330c('0x10')](_0x198e8f))[_0x330c('0xc')](loggerCatch(_0x330c('0x11')));};exports[_0x330c('0x12')]=function(_0x35118f){return BPromise[_0x330c('0xa')]()[_0x330c('0xe')](cmHopper[_0x330c('0x12')](_0x35118f))['catch'](loggerCatch(_0x330c('0x13')));};exports[_0x330c('0xb')]=function(_0x4dae99,_0x5f3898){create(_0x4dae99)[_0x330c('0xc')](loggerCatch(_0x5f3898));moveContact(_0x4dae99)[_0x330c('0xc')](loggerCatch(_0x5f3898));};exports['createAgentHistory']=function(_0x59101e,_0x33d09f){createAgent(_0x59101e)['catch'](loggerCatch(_0x33d09f));};exports[_0x330c('0x14')]=function(_0xa82779,_0x4617f5){create(_0xa82779)[_0x330c('0xc')](loggerCatch(_0x4617f5));};exports[_0x330c('0x15')]=function(_0x5f2425,_0x2cb7ae){moveContact(_0x5f2425)[_0x330c('0xc')](loggerCatch(_0x2cb7ae));};exports[_0x330c('0x16')]=function(_0x18c93e,_0x3e8896,_0x58efd2){if(_0x3e8896){_0x18c93e[_0x330c('0x17')]=null;}if(_0x58efd2){_0x18c93e['active']=![];}return BPromise[_0x330c('0xa')]()[_0x330c('0xe')](cmHopper[_0x330c('0x16')](_0x18c93e))[_0x330c('0xc')](loggerCatch(_0x330c('0x18')));};exports[_0x330c('0x19')]=function(_0x37170f){return BPromise[_0x330c('0xa')]()[_0x330c('0xe')](cmHopper[_0x330c('0x19')](_0x37170f))[_0x330c('0xc')](loggerCatch(_0x330c('0x1a')));};exports[_0x330c('0x1b')]=function(_0x20b51b){return BPromise[_0x330c('0xa')]()[_0x330c('0xe')](cmHopper[_0x330c('0x1b')]({'UserId':null},_0x20b51b,0x1))['catch'](loggerCatch(_0x330c('0x1c')));};exports['disableContact']=function(_0x109050){return BPromise[_0x330c('0xa')]()[_0x330c('0xe')](cmHopper[_0x330c('0x1b')]({'active':![]},_0x109050,0x1))[_0x330c('0xc')](loggerCatch(_0x330c('0x1d')));};exports['crateCustomerReportQueue']=function(_0x2fe399){var _0x277945={};_0x277945[_0x330c('0x1e')]=_0x2fe399[_0x330c('0x1e')];_0x277945[_0x330c('0x1f')]=_0x2fe399[_0x330c('0x1f')];_0x277945[_0x330c('0x20')]=_0x2fe399[_0x330c('0x20')];_0x277945['calleridname']=_0x2fe399[_0x330c('0x21')];_0x277945[_0x330c('0x22')]=_0x2fe399['queue'];_0x277945[_0x330c('0x23')]=_0x2fe399['answertime'];_0x277945['queuecallerleaveAt']=_0x2fe399[_0x330c('0x24')];_0x277945['queuecallercomplete']=0x1;_0x277945['queuecallercompleteAt']=_0x2fe399[_0x330c('0x25')];_0x277945[_0x330c('0x26')]=_0x2fe399['membername'];_0x277945[_0x330c('0x27')]=_0x330c('0x28');_0x277945['exten']='xcally-motion-preview';_0x277945[_0x330c('0x29')]=0x0;_0x277945['assigned']=0x1;_0x277945[_0x330c('0x2a')]=_0x2fe399[_0x330c('0x2b')];_0x277945[_0x330c('0x2c')]=_0x330c('0x2d');return BPromise['resolve']()['then'](voiceQueueReport['create'](_0x277945))[_0x330c('0xc')](loggerCatch(_0x330c('0x2e')));};exports[_0x330c('0x2f')]=function(_0x58b081,_0x4f0af3){return BPromise['resolve']()['then'](cmHopper[_0x330c('0x2f')](_0x58b081,_0x4f0af3))[_0x330c('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x2e89cf){return BPromise[_0x330c('0xa')]()[_0x330c('0xe')](cmHopper[_0x330c('0x16')](_0x2e89cf,!![],!![]))[_0x330c('0xc')](loggerCatch(_0x330c('0x30')));}; \ No newline at end of file +var _0x2446=['[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','active','countReScheduled'];(function(_0x3cafa7,_0x2c72cd){var _0x53a989=function(_0x146259){while(--_0x146259){_0x3cafa7['push'](_0x3cafa7['shift']());}};_0x53a989(++_0x2c72cd);}(_0x2446,0x161));var _0x6244=function(_0x154de1,_0x5c85b6){_0x154de1=_0x154de1-0x0;var _0xb333c4=_0x2446[_0x154de1];return _0xb333c4;};'use strict';var util=require(_0x6244('0x0'));var BPromise=require(_0x6244('0x1'));var logger=require('../../../config/logger')(_0x6244('0x2'));var _=require(_0x6244('0x3'));var cmHopper=require(_0x6244('0x4'));var cmHopperFinal=require(_0x6244('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x6244('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x6244('0x7'));var voiceQueueReport=require(_0x6244('0x8'));function loggerCatch(_0x113acb){return function(_0x3c1c38){logger[_0x6244('0x9')](_0x113acb,util[_0x6244('0xa')](_0x3c1c38,{'showHidden':![],'depth':null}));};}function create(_0x20cb03){return BPromise[_0x6244('0xb')]()[_0x6244('0xc')](cmHopperHistory[_0x6244('0xd')](_0x20cb03))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x21b681){return BPromise['resolve']()['then'](agentReportPreview[_0x6244('0xd')](_0x21b681))[_0x6244('0xe')](loggerCatch(_0x6244('0xf')));}function moveContact(_0x93a073){return BPromise[_0x6244('0xb')]()['then'](cmHopper[_0x6244('0x10')](_0x93a073,!![]))[_0x6244('0xe')](loggerCatch(_0x6244('0x11')));}exports['checkIsBlackList']=function(_0x4f7bda){return BPromise[_0x6244('0xb')]()['then'](cmHopperBlack[_0x6244('0x12')](_0x4f7bda))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x6244('0x13')]=function(_0x38d1){return BPromise[_0x6244('0xb')]()[_0x6244('0xc')](cmHopper['getContactPreview'](_0x38d1))[_0x6244('0xe')](loggerCatch('[getContactPreview]\x20'));};exports[_0x6244('0xd')]=function(_0x5a3837,_0x21a663){create(_0x5a3837)['catch'](loggerCatch(_0x21a663));moveContact(_0x5a3837)['catch'](loggerCatch(_0x21a663));};exports[_0x6244('0x14')]=function(_0xa13be7,_0x3970db){createAgent(_0xa13be7)['catch'](loggerCatch(_0x3970db));};exports['createCustomerHistory']=function(_0x260c4c,_0x369ac6){create(_0x260c4c)[_0x6244('0xe')](loggerCatch(_0x369ac6));};exports[_0x6244('0x15')]=function(_0x1a2a5c,_0x378c2b){moveContact(_0x1a2a5c)['catch'](loggerCatch(_0x378c2b));};exports[_0x6244('0x16')]=function(_0x2193f0,_0x467344,_0x565e3c){if(_0x467344){_0x2193f0['UserId']=null;}if(_0x565e3c){_0x2193f0[_0x6244('0x17')]=![];}return BPromise[_0x6244('0xb')]()[_0x6244('0xc')](cmHopper[_0x6244('0x16')](_0x2193f0))[_0x6244('0xe')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x6244('0x18')]=function(_0x2c4846){return BPromise[_0x6244('0xb')]()[_0x6244('0xc')](cmHopper[_0x6244('0x18')](_0x2c4846))[_0x6244('0xe')](loggerCatch(_0x6244('0x19')));};exports['unlockContact']=function(_0x106259){return BPromise[_0x6244('0xb')]()[_0x6244('0xc')](cmHopper[_0x6244('0x1a')]({'UserId':null},_0x106259,0x1))[_0x6244('0xe')](loggerCatch(_0x6244('0x1b')));};exports[_0x6244('0x1c')]=function(_0x4ce9c5){return BPromise['resolve']()[_0x6244('0xc')](cmHopper[_0x6244('0x1a')]({'active':![]},_0x4ce9c5,0x1))[_0x6244('0xe')](loggerCatch(_0x6244('0x1d')));};exports['crateCustomerReportQueue']=function(_0x228c50){var _0x116541={};_0x116541[_0x6244('0x1e')]=_0x228c50[_0x6244('0x1e')];_0x116541[_0x6244('0x1f')]=_0x228c50[_0x6244('0x1f')];_0x116541[_0x6244('0x20')]=_0x228c50[_0x6244('0x20')];_0x116541[_0x6244('0x21')]=_0x228c50['calleridname'];_0x116541[_0x6244('0x22')]=_0x228c50[_0x6244('0x22')];_0x116541[_0x6244('0x23')]=_0x228c50['answertime'];_0x116541['queuecallerleaveAt']=_0x228c50[_0x6244('0x24')];_0x116541[_0x6244('0x25')]=0x1;_0x116541[_0x6244('0x26')]=_0x228c50[_0x6244('0x27')];_0x116541[_0x6244('0x28')]=_0x228c50[_0x6244('0x29')];_0x116541['context']=_0x6244('0x2a');_0x116541[_0x6244('0x2b')]=_0x6244('0x2c');_0x116541[_0x6244('0x2d')]=0x0;_0x116541[_0x6244('0x2e')]=0x1;_0x116541[_0x6244('0x2f')]=_0x228c50[_0x6244('0x29')];_0x116541[_0x6244('0x30')]=_0x6244('0x31');return BPromise[_0x6244('0xb')]()['then'](voiceQueueReport[_0x6244('0x32')](_0x116541))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x6244('0x33')]=function(_0x35fcc6,_0x502cf9){return BPromise[_0x6244('0xb')]()['then'](cmHopper[_0x6244('0x33')](_0x35fcc6,_0x502cf9))[_0x6244('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x6244('0x34')]=function(_0x1a9d11){return BPromise[_0x6244('0xb')]()['then'](cmHopper[_0x6244('0x16')](_0x1a9d11,!![],!![]))[_0x6244('0xe')](loggerCatch(_0x6244('0x35')));}; \ 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 eddaf50..36bc887 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 _0x3121=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','diff','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','Queue','calleridname','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','statedesc','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','originate','channelAgent','calleridnum','from-sip','uniqueid','countbusyretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','interface','motionChannel','voice','mandatoryDisposition','buildAcw','queue','not_inuse','push','milliseconds','CampaignId','filterKey','idContact','type','campaigntype','scheduledat','countcongestionretry','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0x3121,0x90));var _0x1312=function(_0x82be1,_0x4df006){_0x82be1=_0x82be1-0x0;var _0x382c91=_0x3121[_0x82be1];return _0x382c91;};'use strict';var util=require(_0x1312('0x0'));var _=require('lodash');var moment=require(_0x1312('0x1'));var logger=require(_0x1312('0x2'))(_0x1312('0x3'));var ipAgi=process[_0x1312('0x4')][_0x1312('0x5')]||'127.0.0.1';function getSeconds(_0x3a2c0f,_0x2c78ca){var _0x285f0e=moment(_0x3a2c0f)['milliseconds'](0x0);var _0x354a4=moment(_0x2c78ca)['milliseconds'](0x0);return _0x285f0e[_0x1312('0x6')](_0x354a4,_0x1312('0x7'));}exports[_0x1312('0x8')]=function(_0x28362a){return function(_0x50d496){logger[_0x1312('0x9')](_0x28362a,util[_0x1312('0xa')](_0x50d496,{'showHidden':![],'depth':null}));};};exports[_0x1312('0xb')]=function(_0x5b6a18,_0x36583e){logger['info'](_0x5b6a18,util[_0x1312('0xa')](_0x36583e,{'showHidden':![],'depth':null}));};exports[_0x1312('0xc')]=function(_0x3826aa,_0x4509b0){logger[_0x1312('0x9')](_0x3826aa,util[_0x1312('0xa')](_0x4509b0,{'showHidden':![],'depth':null}));};exports[_0x1312('0xd')]=function(_0x62a4e4){return function(_0x2a5c25){logger[_0x1312('0xe')](_0x62a4e4,util['inspect'](_0x2a5c25,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x3e4a28,_0x3da634,_0x5d51c7){return{'message':_0x3e4a28,'unlock':_0x3da634,'active':_0x5d51c7};};exports[_0x1312('0xf')]=function(_0x3eef89,_0x5c0eb0,_0x15c045){if(!_[_0x1312('0x10')](_0x15c045)&&_0x1312('0x11')===typeof _0x15c045&&!_[_0x1312('0x12')](_0x15c045)){if(!_[_0x1312('0x10')](_0x5c0eb0)&&_0x1312('0x11')===typeof _0x5c0eb0&&!_[_0x1312('0x12')](_0x5c0eb0)){return util[_0x1312('0x13')](_0x1312('0x14'),_0x5c0eb0,_0x15c045);}return util[_0x1312('0x13')](_0x1312('0x14'),_0x15c045,_0x15c045);}if(!_[_0x1312('0x10')](_0x3eef89)&&_0x1312('0x11')===typeof _0x3eef89&&!_[_0x1312('0x12')](_0x3eef89)){return _0x3eef89;}return'\x22\x22\x20<>';};exports[_0x1312('0x15')]=function(_0xb8cfc7){if(_[_0x1312('0x16')](_0xb8cfc7)){return![];}return _0xb8cfc7;};exports['addVariables']=function(_0x57369b,_0x3f67fe,_0x7578d7,_0x2341b9,_0x47fc0c,_0x4dc5f0){var _0xccffe6={'XMD-QUEUE':_0x3f67fe['Queue']?_0x3f67fe[_0x1312('0x17')]['name']:'','XMD-CALLERID':_0x2341b9,'XMD-CALLERID-PREVIEW':_0x4dc5f0?util[_0x1312('0x13')](_0x1312('0x14'),_0x4dc5f0[_0x1312('0x18')],_0x4dc5f0['calleridnum']):_0x2341b9,'XMD-DIALID':_0x47fc0c,'XMD-CONTACTID':_0x3f67fe[_0x1312('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2341b9,'XMD-VOICEQUEUEID':_0x3f67fe[_0x1312('0x1a')],'XMD-DIALCHANNEL':_0x7578d7,'XMD-DIALTIMEOUT':_0x57369b[_0x1312('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x1312('0x13')](_0x1312('0x1c'),_0x57369b[_0x1312('0x1d')]?'g':'',_[_0x1312('0x12')](_0x57369b['monitor_format'])?'':_0x1312('0x1e')),'XMD-DIALURL':_0x57369b[_0x1312('0x1f')]||'','XMD-AGI':_0x57369b[_0x1312('0x20')]?util[_0x1312('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x57369b[_0x1312('0x20')]):_0x1312('0x21'),'XMD-AGIAFTER':_0x57369b['dialQueueProject2']?util[_0x1312('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x57369b[_0x1312('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4dc5f0?_0x4dc5f0['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x4dc5f0?_0x4dc5f0[_0x1312('0x22')]:'','XMD-DESTINATION':_0x1312('0x23')};if(!_[_0x1312('0x12')](_0x57369b['monitor_format'])){_0xccffe6[util[_0x1312('0x13')]('%s',_0x1312('0x24'))]=_0x57369b['monitor_format'];_0xccffe6[util[_0x1312('0x13')]('%s',_0x1312('0x25'))]=_0x47fc0c;}if(_0x3f67fe&&_0x3f67fe[_0x1312('0x26')]){for(var _0x179a85 in _0x3f67fe[_0x1312('0x26')]){if(_0x3f67fe[_0x1312('0x26')][_0x1312('0x27')](_0x179a85)){if(!_[_0x1312('0x16')](_0x3f67fe[_0x1312('0x26')][_0x179a85])&&_0x179a85!=='id'&&_0x179a85!==_0x1312('0x28')&&_0x179a85!==_0x1312('0x29')&&_0x179a85!==_0x1312('0x2a')){_0xccffe6[util['format'](_0x1312('0x2b'),_0x1312('0x2c'),_[_0x1312('0x2d')](_0x179a85))]=_0x3f67fe[_0x1312('0x26')][_0x179a85];}}}}return _0xccffe6;};exports[_0x1312('0x2e')]=function(_0x4dea22){var _0x3dd7e9={};for(var _0x4a40a4 in _0x4dea22){if(_0x4dea22['hasOwnProperty'](_0x4a40a4)){_0x3dd7e9[util[_0x1312('0x13')]('%s',_[_0x1312('0x2f')](_0x4a40a4))]=_0x4dea22[_0x4a40a4];}}return{'variables':_0x3dd7e9};};exports['updateOriginated']=function(_0x29359f,_0x179de3){if(!_[_0x1312('0x16')](_0x29359f)){if(_0x29359f[_0x1312('0x27')]('originated')){if(_0x29359f[_0x1312('0x30')]>0x0){_0x29359f[_0x1312('0x30')]-=0x1;}else{logger[_0x1312('0x9')](_0x1312('0x31'),_0x179de3);}}}else{logger[_0x1312('0x9')](_0x1312('0x32'),_0x179de3);}};exports['logBlacklist']=function(_0x406d2e){var _0x1ca6f8=moment()[_0x1312('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x406d2e['state']=0xd;_0x406d2e[_0x1312('0x33')]='Blacklist';_0x406d2e[_0x1312('0x34')]=_0x1ca6f8;_0x406d2e[_0x1312('0x35')]=_0x1ca6f8;_0x406d2e[_0x1312('0x36')]=_0x1ca6f8;};exports[_0x1312('0x37')]=function(_0x13dd79,_0x41f3cb,_0x3644cb){var _0x45870f=moment()[_0x1312('0x13')](_0x1312('0x38'));_0x13dd79[_0x1312('0x39')]=_0x41f3cb;_0x13dd79['statedesc']=_0x3644cb;_0x13dd79[_0x1312('0x35')]=_0x45870f;_0x13dd79['ringtime']=getSeconds(_0x13dd79[_0x1312('0x35')],_0x13dd79[_0x1312('0x34')]);};exports[_0x1312('0x3a')]=function(_0x2e3265,_0x478c6c,_0x2fee5d){_0x2e3265[_0x1312('0x3b')]=_0x478c6c;_0x2e3265[_0x1312('0x3c')]=_0x2fee5d;};exports[_0x1312('0x3d')]=function(_0x593fe9,_0x48bb89,_0x17cd71){var _0x4894b6=moment()[_0x1312('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x593fe9[_0x1312('0x39')]=_0x48bb89;_0x593fe9['statedesc']=_0x17cd71;_0x593fe9['responsetime']=_0x593fe9[_0x1312('0x35')]?_0x593fe9[_0x1312('0x35')]:_0x4894b6;_0x593fe9['endtime']=_0x593fe9[_0x1312('0x36')]?_0x593fe9['endtime']:_0x4894b6;_0x593fe9['ringtime']=getSeconds(_0x593fe9['responsetime']||0x0,_0x593fe9['starttime']||0x0);_0x593fe9[_0x1312('0x3e')]=_0x593fe9[_0x1312('0x3f')]?getSeconds(_0x593fe9['endtime'],_0x593fe9[_0x1312('0x3f')]):0x0;};exports[_0x1312('0x40')]=function(_0x12edaa){return _0x12edaa===_0x1312('0x41');};exports[_0x1312('0x42')]=function(_0x3b1d50,_0x3f60ff,_0x34dbdb,_0xf9d6a2,_0x43b0d8){var _0x2f9b79=_0xf9d6a2?'RECALL':_0x3b1d50['calleridname'];_0x2f9b79=_0x43b0d8?_0x1312('0x43'):_0x2f9b79;return{'actionid':_0x3b1d50['uniqueid'],'action':_0x1312('0x44'),'channel':_0x3b1d50[_0x1312('0x45')],'callerid':util['format'](_0x1312('0x14'),_0x2f9b79,_0x3b1d50[_0x1312('0x46')]),'Exten':_0x1312('0x23'),'Context':_0x1312('0x47'),'Priority':'1','variable':_0x34dbdb,'timeout':(_0x3f60ff['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3b1d50[_0x1312('0x48')]};};exports['totalGlobal']=function(_0x2ee5c3){return _0x2ee5c3[_0x1312('0x49')]+_0x2ee5c3['countcongestionretry']+_0x2ee5c3['countnoanswerretry']+_0x2ee5c3['countagentrejectretry']+_0x2ee5c3[_0x1312('0x4a')];};exports[_0x1312('0x4b')]=function(_0x17f89e){var _0x1a8919=_[_0x1312('0x4c')](_0x17f89e);_0x1a8919[_0x1312('0x39')]=0xf;_0x1a8919[_0x1312('0x33')]='Global';return _0x1a8919;};exports[_0x1312('0x4d')]=function(_0x4b0709,_0x4ae49a,_0x3001f8){var _0x3a4409={};_0x3a4409[_0x4ae49a]=_0x4b0709[_0x4ae49a];_0x3a4409[_0x1312('0x4e')]=![];_0x3a4409['scheduledat']=moment()['add'](_0x3001f8,_0x1312('0x4f'))[_0x1312('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a4409[_0x1312('0x19')]=_0x4b0709[_0x1312('0x19')];_0x3a4409[_0x1312('0x50')]=_0x4b0709['ListId'];_0x3a4409['VoiceQueueId']=_0x4b0709['VoiceQueueId']||undefined;return _0x3a4409;};exports['decrementTalkink']=function(_0x5ce8f4,_0x6ca583){if(!_[_0x1312('0x16')](_0x5ce8f4)){if(_0x5ce8f4[_0x1312('0x51')]>0x0){_0x5ce8f4['pTalking']-=0x1;}else{logger[_0x1312('0x9')](_0x6ca583,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x6ca583,_0x1312('0x52'));}};exports['IsNotLoggedIn']=function(_0x38f25f){if(_0x38f25f<=0x0){return!![];}return![];};exports['buildObj']=function(_0xc96660,_0x158452,_0x1c5176){_0xc96660[_0x1312('0x53')]=_0x158452;_0xc96660[_0x1312('0x54')]=_0xc96660['queue'];_0xc96660[_0x1312('0x55')]=_0xc96660[_0x1312('0x45')];_0xc96660[_0x1312('0x56')]=_0x1312('0x57');if(_0x1c5176){_0xc96660[_0x1312('0x58')]=_0x1c5176['mandatoryDisposition'];}return _0xc96660;};exports[_0x1312('0x59')]=function(_0x2b93a3){var _0x53c0cb={};_0x53c0cb['queue']=_0x2b93a3[_0x1312('0x5a')];_0x53c0cb['interface']=_0x2b93a3[_0x1312('0x45')];_0x53c0cb['uniqueid']=_0x2b93a3[_0x1312('0x48')];return _0x53c0cb;};exports['agentReadyId']=function(_0x31630d){var _0x11c7c0=[];for(var _0x4bbac0 in _0x31630d){if(_0x31630d[_0x1312('0x27')](_0x4bbac0)){if(!_[_0x1312('0x16')](_0x31630d[_0x4bbac0])&&_0x31630d[_0x4bbac0]['state']===_0x1312('0x5b')&&_0x31630d[_0x4bbac0]['status']==='reachable'){_0x11c7c0[_0x1312('0x5c')](_0x31630d[_0x4bbac0]['id']);}}}return _0x11c7c0;};exports['getDiff']=function(_0x5ce30b){var _0x1aa422=moment()[_0x1312('0x5d')](0x0);var _0x4a26a3=moment(_0x5ce30b)[_0x1312('0x5d')](0x0);return _0x1aa422[_0x1312('0x6')](_0x4a26a3,_0x1312('0x7'));};exports['createBody']=function(_0x1e4924){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1e4924[_0x1312('0x19')],'ListId':_0x1e4924[_0x1312('0x50')],'VoiceQueueId':_0x1e4924[_0x1312('0x1a')]||undefined,'CampaignId':_0x1e4924[_0x1312('0x5e')]||undefined};};exports[_0x1312('0x5f')]=function(_0xe21d58){if(_0xe21d58===_0x1312('0x48')||_0xe21d58===_0x1312('0x60')||_0xe21d58===_0x1312('0x5a')||_0xe21d58===_0x1312('0x61')||_0xe21d58===_0x1312('0x62')||_0xe21d58==='dialAnswer'||_0xe21d58===_0x1312('0x3b')||_0xe21d58===_0x1312('0x45')||_0xe21d58===_0x1312('0x18')||_0xe21d58==='active'||_0xe21d58==='calleridnum'||_0xe21d58===_0x1312('0x63')||_0xe21d58===_0x1312('0x49')||_0xe21d58===_0x1312('0x64')||_0xe21d58==='countnoanswerretry'||_0xe21d58==='countglobal'||_0xe21d58==='callback'||_0xe21d58===_0x1312('0x65')||_0xe21d58===_0x1312('0x66')||_0xe21d58===_0x1312('0x67')||_0xe21d58==='ContactId'||_0xe21d58==='ListId'||_0xe21d58==='UserId'||_0xe21d58===_0x1312('0x1a')||_0xe21d58===_0x1312('0x68')||_0xe21d58==='xmd-voicequeueid'||_0xe21d58===_0x1312('0x69')||_0xe21d58===_0x1312('0x6a')||_0xe21d58===_0x1312('0x6b')||_0xe21d58==='xmd-dialurl'||_0xe21d58==='xmd-dialtimeout'||_0xe21d58==='xmd-dialoptions'||_0xe21d58===_0x1312('0x6c')||_0xe21d58===_0x1312('0x6d')||_0xe21d58===_0x1312('0x6e')||_0xe21d58===_0x1312('0x6f')||_0xe21d58===_0x1312('0x70')||_0xe21d58==='xmd-agiafter'||_0xe21d58===_0x1312('0x71')||_0xe21d58===_0x1312('0x72')||_0xe21d58===_0x1312('0x73')||_0xe21d58===_0x1312('0x74')||_0xe21d58===_0x1312('0x75')||_0xe21d58===_0x1312('0x76')||_0xe21d58===_0x1312('0x77')||_0xe21d58==='rtpaudioqosrtt'||_0xe21d58===_0x1312('0x78')||_0xe21d58===_0x1312('0x72')||_0xe21d58===_0x1312('0x73')||_0xe21d58==='rtpaudioqosjitter'||_0xe21d58===_0x1312('0x75')||_0xe21d58===_0x1312('0x76')||_0xe21d58==='rtpaudioqoslossbridged'||_0xe21d58===_0x1312('0x79')||_0xe21d58===_0x1312('0x78')||_0xe21d58==='bridgepeer'||_0xe21d58==='bridgepvtcallid'||_0xe21d58==='state'||_0xe21d58===_0x1312('0x33')){return![];}return!![];};exports[_0x1312('0x7a')]=function(_0x2dd500,_0x5c27fb){var _0x3a02e6,_0x3ee578,_0x677163;if(_0x5c27fb<=0x0){_0x5c27fb=0x1;}_0x3a02e6=new RegExp('\x5cw{0,'+_0x5c27fb+'}$');_0x3ee578=Math[_0x1312('0x7b')](0xa,_0x5c27fb-0x1);_0x677163=Math[_0x1312('0x7b')](0xa,_0x5c27fb)-0x1;return util[_0x1312('0x13')]('%s',_[_0x1312('0x7c')](_0x2dd500,_0x3a02e6,_[_0x1312('0x7d')](_0x3ee578,_0x677163)));};exports[_0x1312('0x7e')]=function(_0x1ad85c){var _0x408816=_0x1ad85c[_0x1312('0x7f')](/"(.*?)"/);return _0x408816?_0x408816[0x1]:_0x1ad85c;};exports[_0x1312('0x80')]=function(_0x41ae45){var _0x2d6de0=_0x41ae45[_0x1312('0x7f')](/<(.*?)>/);return _0x2d6de0?_0x2d6de0[0x1]:_0x41ae45;}; \ No newline at end of file +var _0x2005=['clone','Global','scheduledat','add','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','not_inuse','reachable','push','getDiff','createBody','idContact','campaigntype','dialAnswer','membername','active','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','random','extractCalleridName','extractCalleridNumber','match','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','logLookAgent','UserId','ringtime','talktime','answertime','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry'];(function(_0x2ccd5e,_0x3deb44){var _0x1a758e=function(_0x535991){while(--_0x535991){_0x2ccd5e['push'](_0x2ccd5e['shift']());}};_0x1a758e(++_0x3deb44);}(_0x2005,0x14a));var _0x5200=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0x2005[_0x2f37e0];return _0x43ccce;};'use strict';var util=require(_0x5200('0x0'));var _=require(_0x5200('0x1'));var moment=require('moment');var logger=require(_0x5200('0x2'))(_0x5200('0x3'));var ipAgi=process[_0x5200('0x4')][_0x5200('0x5')]||_0x5200('0x6');function getSeconds(_0x15df2c,_0x16ffe3){var _0x3cc3f9=moment(_0x15df2c)[_0x5200('0x7')](0x0);var _0x39698a=moment(_0x16ffe3)[_0x5200('0x7')](0x0);return _0x3cc3f9[_0x5200('0x8')](_0x39698a,_0x5200('0x9'));}exports[_0x5200('0xa')]=function(_0x3c3993){return function(_0x5b2475){logger[_0x5200('0xb')](_0x3c3993,util[_0x5200('0xc')](_0x5b2475,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5ae267,_0x401dc4){logger[_0x5200('0xd')](_0x5ae267,util['inspect'](_0x401dc4,{'showHidden':![],'depth':null}));};exports[_0x5200('0xe')]=function(_0x405ebe,_0x5caa65){logger[_0x5200('0xb')](_0x405ebe,util[_0x5200('0xc')](_0x5caa65,{'showHidden':![],'depth':null}));};exports[_0x5200('0xf')]=function(_0x3d477a){return function(_0xd13b6c){logger[_0x5200('0xd')](_0x3d477a,util[_0x5200('0xc')](_0xd13b6c,{'showHidden':![],'depth':null}));};};exports[_0x5200('0x10')]=function(_0x1f05eb,_0x2f1d55,_0x5ef899){return{'message':_0x1f05eb,'unlock':_0x2f1d55,'active':_0x5ef899};};exports[_0x5200('0x11')]=function(_0x4e41c3,_0xa2bacf,_0x367d96){if(!_[_0x5200('0x12')](_0x367d96)&&_0x5200('0x13')===typeof _0x367d96&&!_[_0x5200('0x14')](_0x367d96)){if(!_[_0x5200('0x12')](_0xa2bacf)&&_0x5200('0x13')===typeof _0xa2bacf&&!_[_0x5200('0x14')](_0xa2bacf)){return util[_0x5200('0x15')](_0x5200('0x16'),_0xa2bacf,_0x367d96);}return util[_0x5200('0x15')]('\x22%s\x22\x20<%s>',_0x367d96,_0x367d96);}if(!_[_0x5200('0x12')](_0x4e41c3)&&_0x5200('0x13')===typeof _0x4e41c3&&!_[_0x5200('0x14')](_0x4e41c3)){return _0x4e41c3;}return _0x5200('0x17');};exports[_0x5200('0x18')]=function(_0x20ab44){if(_[_0x5200('0x19')](_0x20ab44)){return![];}return _0x20ab44;};exports[_0x5200('0x1a')]=function(_0xd94ffe,_0x4b567e,_0x3db0f1,_0x3b56de,_0x23b888,_0x298f84){var _0x56dbcd={'XMD-QUEUE':_0x4b567e[_0x5200('0x1b')]?_0x4b567e[_0x5200('0x1b')][_0x5200('0x1c')]:'','XMD-CALLERID':_0x3b56de,'XMD-CALLERID-PREVIEW':_0x298f84?util[_0x5200('0x15')](_0x5200('0x16'),_0x298f84['calleridname'],_0x298f84[_0x5200('0x1d')]):_0x3b56de,'XMD-DIALID':_0x23b888,'XMD-CONTACTID':_0x4b567e[_0x5200('0x1e')],'XMD-CDRTYPE':_0x5200('0x1f'),'CALLERID(all)':_0x3b56de,'XMD-VOICEQUEUEID':_0x4b567e[_0x5200('0x20')],'XMD-DIALCHANNEL':_0x3db0f1,'XMD-DIALTIMEOUT':_0xd94ffe[_0x5200('0x21')]||0x1e,'XMD-DIALOPTIONS':util[_0x5200('0x15')](_0x5200('0x22'),_0xd94ffe[_0x5200('0x23')]?'g':'',_['isEmpty'](_0xd94ffe[_0x5200('0x24')])?'':_0x5200('0x25')),'XMD-DIALURL':_0xd94ffe[_0x5200('0x26')]||'','XMD-AGI':_0xd94ffe['dialQueueProject']?util['format'](_0x5200('0x27'),ipAgi,_0xd94ffe[_0x5200('0x28')]):_0x5200('0x29'),'XMD-AGIAFTER':_0xd94ffe[_0x5200('0x23')]?util[_0x5200('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0xd94ffe[_0x5200('0x23')]):_0x5200('0x29'),'XMD-ORIGINATECALLERIDNUM':_0x298f84?_0x298f84[_0x5200('0x2a')]:'','XMD-ORIGINATECALLERIDNAME':_0x298f84?_0x298f84['originatecalleridname']:'','XMD-DESTINATION':_0x5200('0x2b')};if(!_[_0x5200('0x14')](_0xd94ffe[_0x5200('0x24')])){_0x56dbcd[util[_0x5200('0x15')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0xd94ffe[_0x5200('0x24')];_0x56dbcd[util['format']('%s',_0x5200('0x2c'))]=_0x23b888;}if(_0x4b567e&&_0x4b567e[_0x5200('0x2d')]){for(var _0x71d18a in _0x4b567e[_0x5200('0x2d')]){if(_0x4b567e[_0x5200('0x2d')][_0x5200('0x2e')](_0x71d18a)){if(!_[_0x5200('0x19')](_0x4b567e['Contact'][_0x71d18a])&&_0x71d18a!=='id'&&_0x71d18a!==_0x5200('0x2f')&&_0x71d18a!==_0x5200('0x30')&&_0x71d18a!=='updatedAt'){_0x56dbcd[util['format'](_0x5200('0x31'),_0x5200('0x32'),_['toUpper'](_0x71d18a))]=_0x4b567e[_0x5200('0x2d')][_0x71d18a];}}}}return _0x56dbcd;};exports[_0x5200('0x33')]=function(_0x2102b9){var _0x4982a2={};for(var _0x598cc9 in _0x2102b9){if(_0x2102b9[_0x5200('0x2e')](_0x598cc9)){_0x4982a2[util[_0x5200('0x15')]('%s',_[_0x5200('0x34')](_0x598cc9))]=_0x2102b9[_0x598cc9];}}return{'variables':_0x4982a2};};exports[_0x5200('0x35')]=function(_0x144a1d,_0x1a8995){if(!_[_0x5200('0x19')](_0x144a1d)){if(_0x144a1d[_0x5200('0x2e')](_0x5200('0x36'))){if(_0x144a1d[_0x5200('0x36')]>0x0){_0x144a1d['originated']-=0x1;}else{logger[_0x5200('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1a8995);}}}else{logger[_0x5200('0xb')](_0x5200('0x37'),_0x1a8995);}};exports['logBlacklist']=function(_0x52d63c){var _0x5997f3=moment()[_0x5200('0x15')](_0x5200('0x38'));_0x52d63c[_0x5200('0x39')]=0xd;_0x52d63c[_0x5200('0x3a')]=_0x5200('0x3b');_0x52d63c[_0x5200('0x3c')]=_0x5997f3;_0x52d63c[_0x5200('0x3d')]=_0x5997f3;_0x52d63c[_0x5200('0x3e')]=_0x5997f3;};exports[_0x5200('0x3f')]=function(_0x1a8c82,_0x119a9d,_0x342b4b){var _0x5b080a=moment()[_0x5200('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a8c82[_0x5200('0x39')]=_0x119a9d;_0x1a8c82[_0x5200('0x3a')]=_0x342b4b;_0x1a8c82[_0x5200('0x3d')]=_0x5b080a;_0x1a8c82['ringtime']=getSeconds(_0x1a8c82[_0x5200('0x3d')],_0x1a8c82['starttime']);};exports[_0x5200('0x40')]=function(_0x468b86,_0x4a6aa0,_0x4be939){_0x468b86['membername']=_0x4a6aa0;_0x468b86[_0x5200('0x41')]=_0x4be939;};exports['logCustomer']=function(_0x44450a,_0x1a761f,_0xbc03d0){var _0x5a8707=moment()[_0x5200('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x44450a[_0x5200('0x39')]=_0x1a761f;_0x44450a['statedesc']=_0xbc03d0;_0x44450a[_0x5200('0x3d')]=_0x44450a[_0x5200('0x3d')]?_0x44450a[_0x5200('0x3d')]:_0x5a8707;_0x44450a[_0x5200('0x3e')]=_0x44450a[_0x5200('0x3e')]?_0x44450a['endtime']:_0x5a8707;_0x44450a[_0x5200('0x42')]=getSeconds(_0x44450a[_0x5200('0x3d')]||0x0,_0x44450a['starttime']||0x0);_0x44450a[_0x5200('0x43')]=_0x44450a[_0x5200('0x44')]?getSeconds(_0x44450a[_0x5200('0x3e')],_0x44450a[_0x5200('0x44')]):0x0;};exports['isFailure']=function(_0x4acae5){return _0x4acae5==='Failure';};exports[_0x5200('0x45')]=function(_0x4165c6,_0x3087ba,_0x133e43,_0x1d5eb3,_0x3035f9){var _0x143a34=_0x1d5eb3?_0x5200('0x46'):_0x4165c6[_0x5200('0x47')];_0x143a34=_0x3035f9?_0x5200('0x48'):_0x143a34;return{'actionid':_0x4165c6[_0x5200('0x49')],'action':_0x5200('0x4a'),'channel':_0x4165c6[_0x5200('0x4b')],'callerid':util[_0x5200('0x15')](_0x5200('0x16'),_0x143a34,_0x4165c6[_0x5200('0x1d')]),'Exten':_0x5200('0x2b'),'Context':_0x5200('0x4c'),'Priority':'1','variable':_0x133e43,'timeout':(_0x3087ba['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4165c6[_0x5200('0x49')]};};exports[_0x5200('0x4d')]=function(_0x2868c2){return _0x2868c2[_0x5200('0x4e')]+_0x2868c2[_0x5200('0x4f')]+_0x2868c2['countnoanswerretry']+_0x2868c2[_0x5200('0x50')]+_0x2868c2['countnosuchnumberretry'];};exports['cloneAction']=function(_0x5cd966){var _0x4ff185=_[_0x5200('0x51')](_0x5cd966);_0x4ff185['state']=0xf;_0x4ff185[_0x5200('0x3a')]=_0x5200('0x52');return _0x4ff185;};exports['scheduledAt']=function(_0x49aaa8,_0x2fe006,_0x5bcf80){var _0x46446c={};_0x46446c[_0x2fe006]=_0x49aaa8[_0x2fe006];_0x46446c['active']=![];_0x46446c[_0x5200('0x53')]=moment()[_0x5200('0x54')](_0x5bcf80,'minutes')[_0x5200('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x46446c[_0x5200('0x1e')]=_0x49aaa8[_0x5200('0x1e')];_0x46446c[_0x5200('0x55')]=_0x49aaa8['ListId'];_0x46446c[_0x5200('0x20')]=_0x49aaa8[_0x5200('0x20')]||undefined;return _0x46446c;};exports['decrementTalkink']=function(_0x174d04,_0xec64e2){if(!_['isNil'](_0x174d04)){if(_0x174d04[_0x5200('0x56')]>0x0){_0x174d04[_0x5200('0x56')]-=0x1;}else{logger['error'](_0xec64e2,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x5200('0xb')](_0xec64e2,_0x5200('0x57'));}};exports['IsNotLoggedIn']=function(_0x179db0){if(_0x179db0<=0x0){return!![];}return![];};exports[_0x5200('0x58')]=function(_0x26934a,_0x407751,_0x1f306e){_0x26934a[_0x5200('0x59')]=_0x407751;_0x26934a[_0x5200('0x1c')]=_0x26934a[_0x5200('0x5a')];_0x26934a[_0x5200('0x5b')]=_0x26934a[_0x5200('0x4b')];_0x26934a[_0x5200('0x5c')]=_0x5200('0x5d');if(_0x1f306e){_0x26934a['mandatoryDisposition']=_0x1f306e[_0x5200('0x5e')];}return _0x26934a;};exports[_0x5200('0x5f')]=function(_0x1cad42){var _0x2e26a0={};_0x2e26a0[_0x5200('0x5a')]=_0x1cad42[_0x5200('0x5a')];_0x2e26a0['interface']=_0x1cad42[_0x5200('0x4b')];_0x2e26a0['uniqueid']=_0x1cad42[_0x5200('0x49')];return _0x2e26a0;};exports['agentReadyId']=function(_0x597c3e){var _0x393d55=[];for(var _0x11889b in _0x597c3e){if(_0x597c3e[_0x5200('0x2e')](_0x11889b)){if(!_[_0x5200('0x19')](_0x597c3e[_0x11889b])&&_0x597c3e[_0x11889b][_0x5200('0x39')]===_0x5200('0x60')&&_0x597c3e[_0x11889b]['status']===_0x5200('0x61')){_0x393d55[_0x5200('0x62')](_0x597c3e[_0x11889b]['id']);}}}return _0x393d55;};exports[_0x5200('0x63')]=function(_0x385158){var _0x4d053f=moment()[_0x5200('0x7')](0x0);var _0x107277=moment(_0x385158)[_0x5200('0x7')](0x0);return _0x4d053f['diff'](_0x107277,_0x5200('0x9'));};exports[_0x5200('0x64')]=function(_0x365864){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x365864[_0x5200('0x1e')],'ListId':_0x365864[_0x5200('0x55')],'VoiceQueueId':_0x365864['VoiceQueueId']||undefined,'CampaignId':_0x365864['CampaignId']||undefined};};exports['filterKey']=function(_0x220297){if(_0x220297===_0x5200('0x49')||_0x220297===_0x5200('0x65')||_0x220297===_0x5200('0x5a')||_0x220297==='type'||_0x220297===_0x5200('0x66')||_0x220297===_0x5200('0x67')||_0x220297===_0x5200('0x68')||_0x220297==='channelAgent'||_0x220297===_0x5200('0x47')||_0x220297===_0x5200('0x69')||_0x220297===_0x5200('0x1d')||_0x220297===_0x5200('0x53')||_0x220297===_0x5200('0x4e')||_0x220297===_0x5200('0x4f')||_0x220297==='countnoanswerretry'||_0x220297===_0x5200('0x6a')||_0x220297===_0x5200('0x6b')||_0x220297===_0x5200('0x6c')||_0x220297===_0x5200('0x6d')||_0x220297==='recallme'||_0x220297===_0x5200('0x1e')||_0x220297===_0x5200('0x55')||_0x220297===_0x5200('0x41')||_0x220297==='VoiceQueueId'||_0x220297===_0x5200('0x6e')||_0x220297===_0x5200('0x6f')||_0x220297==='xmd-queue'||_0x220297===_0x5200('0x70')||_0x220297===_0x5200('0x71')||_0x220297===_0x5200('0x72')||_0x220297===_0x5200('0x73')||_0x220297===_0x5200('0x74')||_0x220297===_0x5200('0x75')||_0x220297==='xmd-dialchannel'||_0x220297===_0x5200('0x76')||_0x220297===_0x5200('0x77')||_0x220297==='xmd-callerid'||_0x220297==='xmd-agiafter'||_0x220297===_0x5200('0x78')||_0x220297===_0x5200('0x79')||_0x220297===_0x5200('0x7a')||_0x220297==='rtpaudioqosjitter'||_0x220297===_0x5200('0x7b')||_0x220297===_0x5200('0x7c')||_0x220297===_0x5200('0x7d')||_0x220297==='rtpaudioqosrtt'||_0x220297===_0x5200('0x7e')||_0x220297===_0x5200('0x79')||_0x220297==='rtpaudioqosbridged'||_0x220297==='rtpaudioqosjitter'||_0x220297===_0x5200('0x7b')||_0x220297===_0x5200('0x7c')||_0x220297===_0x5200('0x7d')||_0x220297===_0x5200('0x7f')||_0x220297==='rtpaudioqosrttbridged'||_0x220297===_0x5200('0x80')||_0x220297===_0x5200('0x81')||_0x220297===_0x5200('0x39')||_0x220297===_0x5200('0x3a')){return![];}return!![];};exports[_0x5200('0x82')]=function(_0x324e49,_0xaca5d5){var _0x2afa4a,_0x3e2f8a,_0x17dbf1;if(_0xaca5d5<=0x0){_0xaca5d5=0x1;}_0x2afa4a=new RegExp(_0x5200('0x83')+_0xaca5d5+'}$');_0x3e2f8a=Math['pow'](0xa,_0xaca5d5-0x1);_0x17dbf1=Math['pow'](0xa,_0xaca5d5)-0x1;return util[_0x5200('0x15')]('%s',_[_0x5200('0x84')](_0x324e49,_0x2afa4a,_[_0x5200('0x85')](_0x3e2f8a,_0x17dbf1)));};exports[_0x5200('0x86')]=function(_0x4244af){var _0x51cf93=_0x4244af['match'](/"(.*?)"/);return _0x51cf93?_0x51cf93[0x1]:_0x4244af;};exports[_0x5200('0x87')]=function(_0x51bc86){var _0x51513c=_0x51bc86[_0x5200('0x88')](/<(.*?)>/);return _0x51513c?_0x51513c[0x1]:_0x51bc86;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8dfed0f..41ea691 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 _0x6418=['string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd'];(function(_0x47add3,_0x480505){var _0x326e46=function(_0x530ddc){while(--_0x530ddc){_0x47add3['push'](_0x47add3['shift']());}};_0x326e46(++_0x480505);}(_0x6418,0xb3));var _0x8641=function(_0xd494d,_0x2458fb){_0xd494d=_0xd494d-0x0;var _0x144d18=_0x6418[_0xd494d];return _0x144d18;};'use strict';exports[_0x8641('0x0')]={'queue':{'type':_0x8641('0x1'),'required':!![]},'interface':{'type':_0x8641('0x1'),'required':!![]},'membername':{'type':_0x8641('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x8641('0x2'),'required':![]}};exports[_0x8641('0x3')]={'queue':{'type':_0x8641('0x1'),'required':!![]},'interface':{'type':_0x8641('0x1'),'required':!![]}};exports[_0x8641('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x8641('0x2')},'reason':{'type':_0x8641('0x1'),'required':![]}};exports[_0x8641('0x5')]={'module':{'type':_0x8641('0x1'),'required':![]}};exports[_0x8641('0x6')]={'uniqueid':{'type':_0x8641('0x1'),'required':!![]}};exports[_0x8641('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x8641('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x8641('0x1')}};exports[_0x8641('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x8641('0x1'),'required':!![]},'context':{'type':_0x8641('0x1')}}; \ No newline at end of file +var _0x06fd=['voicechannel','voicequeuechannelredirect','queueadd','string','number','boolean','queuepause','reload'];(function(_0x5275b8,_0x51e5dd){var _0x568a9b=function(_0x583a71){while(--_0x583a71){_0x5275b8['push'](_0x5275b8['shift']());}};_0x568a9b(++_0x51e5dd);}(_0x06fd,0xd2));var _0xd06f=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x06fd[_0x5ecadc];return _0x565037;};'use strict';exports[_0xd06f('0x0')]={'queue':{'type':_0xd06f('0x1'),'required':!![]},'interface':{'type':_0xd06f('0x1'),'required':!![]},'membername':{'type':_0xd06f('0x1'),'required':!![]},'penalty':{'type':_0xd06f('0x2'),'required':![]},'paused':{'type':_0xd06f('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0xd06f('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xd06f('0x4')]={'interface':{'type':_0xd06f('0x1'),'required':!![]},'paused':{'type':_0xd06f('0x3')},'reason':{'type':_0xd06f('0x1'),'required':![]}};exports[_0xd06f('0x5')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports[_0xd06f('0x6')]={'uniqueid':{'type':_0xd06f('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0xd06f('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xd06f('0x1'),'required':!![]}};exports[_0xd06f('0x7')]={'uniqueid':{'type':_0xd06f('0x1'),'required':!![]},'exten':{'type':_0xd06f('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 37295f3..7892d6d 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 _0xdb6b=['../model/agent','../model/trunk','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','SIP/%s','name','isNil','interface','format','hasOwnProperty','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','isUndefined','initTelephones','length','initTrunks','trunks','initTriggers','initTemplates','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','outbound','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','moment'];(function(_0x282f94,_0x2a9e04){var _0x1c0d5e=function(_0xe869a3){while(--_0xe869a3){_0x282f94['push'](_0x282f94['shift']());}};_0x1c0d5e(++_0x2a9e04);}(_0xdb6b,0x140));var _0xbdb6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdb6b[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xbdb6('0x0'));var util=require(_0xbdb6('0x1'));var _=require(_0xbdb6('0x2'));var moment=require(_0xbdb6('0x3'));var Agent=require(_0xbdb6('0x4'));var Telephone=require('../model/telephone');var Trunk=require(_0xbdb6('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xbdb6('0x6'));var Template=require(_0xbdb6('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xbdb6('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xbdb6('0x9'));var FreshdeskAccount=require(_0xbdb6('0xa'));var SugarcrmAccount=require(_0xbdb6('0xb'));var ZohoAccount=require(_0xbdb6('0xc'));var DeskAccount=require(_0xbdb6('0xd'));var VtigerAccount=require(_0xbdb6('0xe'));var ServicenowAccount=require(_0xbdb6('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xbdb6('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xbdb6('0x11')]={};this[_0xbdb6('0x12')]={};this['trunks']={};this[_0xbdb6('0x13')]={};this[_0xbdb6('0x14')]={};this[_0xbdb6('0x15')]={};this[_0xbdb6('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbdb6('0x17')]={};this[_0xbdb6('0x18')]={};this[_0xbdb6('0x19')]={};this[_0xbdb6('0x1a')]={};this['timers']={};this[_0xbdb6('0x1b')]={};this[_0xbdb6('0x1c')]={};this[_0xbdb6('0x1d')]={};this[_0xbdb6('0x1e')]={};this[_0xbdb6('0x1f')]={};this[_0xbdb6('0x20')]={};this[_0xbdb6('0x21')]={};this[_0xbdb6('0x22')]={};this[_0xbdb6('0x23')]={};this['dynamics365Accounts']={};this[_0xbdb6('0x24')]={};this['faxAccounts']={};};function freeIsNotKey(_0x2a32de,_0x49d2a0,_0x596bec){var _0x258158=_[_0xbdb6('0x25')](_0x2a32de,function(_0x590e2f,_0x148423){return _0x590e2f[_0x596bec];});for(var _0x5f0906 in _0x49d2a0){if(_0x49d2a0['hasOwnProperty'](_0x5f0906)){if(!_0x258158[_0x5f0906]){delete _0x49d2a0[_0x5f0906];}}}}function freeIsNotKeySip(_0x5141ed,_0x442d98){var _0x2e119d=_[_0xbdb6('0x25')](_0x5141ed,function(_0x53c6f7,_0x5e3d94){return util['format'](_0xbdb6('0x26'),_0x53c6f7[_0xbdb6('0x27')]);});for(var _0x318cc8 in _0x442d98){if(_0x442d98['hasOwnProperty'](_0x318cc8)){if(!_0x2e119d[_0x318cc8]){delete _0x442d98[_0x318cc8];}}}}function freeIsNotKeyAgent(_0x3c91d7,_0x21b248){var _0x53b323=_['mapKeys'](_0x3c91d7,function(_0x15a91f,_0x194905){var _0x40d978=_[_0xbdb6('0x28')](_0x15a91f[_0xbdb6('0x29')])?util[_0xbdb6('0x2a')](_0xbdb6('0x26'),_0x15a91f[_0xbdb6('0x27')]):_0x15a91f[_0xbdb6('0x29')];return _0x40d978;});for(var _0x121bc8 in _0x21b248){if(_0x21b248[_0xbdb6('0x2b')](_0x121bc8)){if(!_0x53b323[_0x121bc8]){delete _0x21b248[_0x121bc8];}}}}function clearVoiceCallReports(_0x454462){_0x454462[_0xbdb6('0x2c')]=0x0;_0x454462[_0xbdb6('0x2d')]=0x0;_0x454462[_0xbdb6('0x2e')]=0x0;_0x454462[_0xbdb6('0x2f')]=0x0;_0x454462[_0xbdb6('0x30')]=0x0;}function clearCampaigns(_0x47e847){if(!_[_0xbdb6('0x31')](_0x47e847)){for(var _0x3efaac in _0x47e847){if(_0x47e847[_0xbdb6('0x2b')](_0x3efaac)){_0x47e847[_0x3efaac][_0xbdb6('0x32')]=0x0;_0x47e847[_0x3efaac][_0xbdb6('0x33')]=0x0;}}}}function clearVoiceQueues(_0x3a05a8){if(!_[_0xbdb6('0x31')](_0x3a05a8)){for(var _0x34da47 in _0x3a05a8){if(_0x3a05a8[_0xbdb6('0x2b')](_0x34da47)){_0x3a05a8[_0x34da47]['total']=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x2d')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x34')]=0x0;_0x3a05a8[_0x34da47]['abandoned']=0x0;_0x3a05a8[_0x34da47]['sumHoldTime']=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x2f')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x30')]=0x0;_0x3a05a8[_0x34da47]['outboundAnswerAgiCallsDay']=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x35')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x36')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x37')]=0x0;_0x3a05a8[_0x34da47]['outboundNoSuchCallsDay']=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x38')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x39')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x3a')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x3b')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x3c')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x3d')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x3e')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x3f')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x40')]=0x0;_0x3a05a8[_0x34da47][_0xbdb6('0x41')]=!![];}}}}Realtime[_0xbdb6('0x42')][_0xbdb6('0x43')]=function(_0x40c477,_0x1e9821){for(var _0x17b025 in _0x1e9821){if(_0x40c477['hasOwnProperty'](_0x17b025)){_0x40c477[_0x17b025]=_0x1e9821[_0x17b025];}}};Realtime[_0xbdb6('0x42')]['initAgents']=function(){var _0x4e69f7=this;return function(_0x5ca09b){if(_0x5ca09b){freeIsNotKeyAgent(_0x5ca09b,_0x4e69f7[_0xbdb6('0x11')]);for(var _0x53b3e7=0x0,_0x2592d0={},_0xbfef2={};_0x53b3e7<_0x5ca09b['length'];_0x53b3e7+=0x1){_0x2592d0=_0x5ca09b[_0x53b3e7];var _0x5af696=_['isNil'](_0x2592d0['interface'])?util[_0xbdb6('0x2a')](_0xbdb6('0x26'),_0x2592d0[_0xbdb6('0x27')]):_0x2592d0[_0xbdb6('0x29')];if(_[_0xbdb6('0x44')](_0x4e69f7[_0xbdb6('0x11')][_0x5af696])){_0x4e69f7[_0xbdb6('0x11')][_0x5af696]=new Agent(_0x2592d0);}else{_0x4e69f7[_0xbdb6('0x43')](_0x4e69f7[_0xbdb6('0x11')][_0x5af696],_0x2592d0);}}}return _0x4e69f7[_0xbdb6('0x11')];};};Realtime['prototype'][_0xbdb6('0x45')]=function(){var _0x35fc9d=this;return function(_0x4f82d3){if(_0x4f82d3){freeIsNotKeySip(_0x4f82d3,_0x35fc9d[_0xbdb6('0x12')]);for(var _0x36524b=0x0,_0x2d4fb6={},_0x4b05ff={};_0x36524b<_0x4f82d3[_0xbdb6('0x46')];_0x36524b+=0x1){_0x2d4fb6=_0x4f82d3[_0x36524b];if(_[_0xbdb6('0x44')](_0x35fc9d['telephones'][util[_0xbdb6('0x2a')](_0xbdb6('0x26'),_0x2d4fb6[_0xbdb6('0x27')])])){_0x35fc9d[_0xbdb6('0x12')][util[_0xbdb6('0x2a')](_0xbdb6('0x26'),_0x2d4fb6[_0xbdb6('0x27')])]=new Telephone(_0x2d4fb6);}else{_0x35fc9d[_0xbdb6('0x43')](_0x35fc9d[_0xbdb6('0x12')][util[_0xbdb6('0x2a')](_0xbdb6('0x26'),_0x2d4fb6['name'])],_0x2d4fb6);}}}return _0x35fc9d[_0xbdb6('0x12')];};};Realtime[_0xbdb6('0x42')][_0xbdb6('0x47')]=function(){var _0x51eeec=this;return function(_0x3d8c99){if(_0x3d8c99){freeIsNotKeySip(_0x3d8c99,_0x51eeec[_0xbdb6('0x48')]);for(var _0x23bbe2=0x0,_0x5b7acb={},_0x137860={};_0x23bbe2<_0x3d8c99[_0xbdb6('0x46')];_0x23bbe2+=0x1){_0x5b7acb=_0x3d8c99[_0x23bbe2];if(_[_0xbdb6('0x44')](_0x51eeec[_0xbdb6('0x48')][util[_0xbdb6('0x2a')](_0xbdb6('0x26'),_0x5b7acb[_0xbdb6('0x27')])])){_0x51eeec[_0xbdb6('0x48')][util[_0xbdb6('0x2a')](_0xbdb6('0x26'),_0x5b7acb[_0xbdb6('0x27')])]=new Trunk(_0x5b7acb);}else{_0x51eeec[_0xbdb6('0x43')](_0x51eeec[_0xbdb6('0x48')][util[_0xbdb6('0x2a')]('SIP/%s',_0x5b7acb[_0xbdb6('0x27')])],_0x5b7acb);}}}return _0x51eeec[_0xbdb6('0x48')];};};Realtime[_0xbdb6('0x42')]['initVoiceQueues']=function(){var _0x2eb2d1=this;return function(_0x3bd37d){if(_0x3bd37d){freeIsNotKey(_0x3bd37d,_0x2eb2d1[_0xbdb6('0x13')],_0xbdb6('0x27'));for(var _0x2baa00=0x0,_0x10a5d5={},_0x394354={};_0x2baa00<_0x3bd37d[_0xbdb6('0x46')];_0x2baa00+=0x1){_0x10a5d5=_0x3bd37d[_0x2baa00];if(_[_0xbdb6('0x44')](_0x2eb2d1[_0xbdb6('0x13')][_0x10a5d5[_0xbdb6('0x27')]])){_0x2eb2d1['voiceQueues'][_0x10a5d5[_0xbdb6('0x27')]]=new VoiceQueue(_0x10a5d5);}else{_0x2eb2d1[_0xbdb6('0x43')](_0x2eb2d1[_0xbdb6('0x13')][_0x10a5d5[_0xbdb6('0x27')]],_0x10a5d5);}}}return _0x2eb2d1[_0xbdb6('0x13')];};};Realtime[_0xbdb6('0x42')][_0xbdb6('0x49')]=function(){var _0x401dd0=this;return function(_0x1ce61f){if(_0x1ce61f){freeIsNotKey(_0x1ce61f,_0x401dd0[_0xbdb6('0x14')],'id');for(var _0x309690=0x0,_0x2e5bc8={},_0x550577={};_0x309690<_0x1ce61f[_0xbdb6('0x46')];_0x309690+=0x1){_0x2e5bc8=_0x1ce61f[_0x309690];if(_['isUndefined'](_0x401dd0[_0xbdb6('0x14')][_0x2e5bc8['id']])){_0x401dd0[_0xbdb6('0x14')][_0x2e5bc8['id']]=new Trigger(_0x2e5bc8);}else{_0x401dd0[_0xbdb6('0x43')](_0x401dd0[_0xbdb6('0x14')][_0x2e5bc8['id']],_0x2e5bc8);}}}return _0x401dd0[_0xbdb6('0x14')];};};Realtime['prototype'][_0xbdb6('0x4a')]=function(){var _0x42226f=this;return function(_0x38841f){if(_0x38841f){freeIsNotKey(_0x38841f,_0x42226f['templates'],'id');for(var _0x30845e=0x0,_0x1ca885={},_0x8d3b6={};_0x30845e<_0x38841f[_0xbdb6('0x46')];_0x30845e+=0x1){_0x1ca885=_0x38841f[_0x30845e];if(_['isUndefined'](_0x42226f[_0xbdb6('0x16')][_0x1ca885['id']])){_0x42226f[_0xbdb6('0x16')][_0x1ca885['id']]=new Template(_0x1ca885);}else{_0x42226f['mergeFromDatabase'](_0x42226f['templates'][_0x1ca885['id']],_0x1ca885);}}}return _0x42226f['templates'];};};Realtime[_0xbdb6('0x42')]['initZendeskAccounts']=function(){var _0x45fcde=this;return function(_0x3eb09c){if(_0x3eb09c){freeIsNotKey(_0x3eb09c,_0x45fcde['zendeskAccounts'],'id');for(var _0x3c7ae0=0x0,_0x52884f={},_0x139efb={};_0x3c7ae0<_0x3eb09c[_0xbdb6('0x46')];_0x3c7ae0+=0x1){_0x52884f=_0x3eb09c[_0x3c7ae0];if(_[_0xbdb6('0x44')](_0x45fcde[_0xbdb6('0x1c')][_0x52884f['id']])){_0x45fcde[_0xbdb6('0x1c')][_0x52884f['id']]=new ZendeskAccount(_0x52884f);}else{_0x45fcde[_0xbdb6('0x43')](_0x45fcde[_0xbdb6('0x1c')][_0x52884f['id']],_0x52884f);}}}return _0x45fcde['zendeskAccounts'];};};Realtime[_0xbdb6('0x42')]['initSalesforceAccounts']=function(){var _0x5d9804=this;return function(_0x55862a){if(_0x55862a){freeIsNotKey(_0x55862a,_0x5d9804[_0xbdb6('0x1d')],'id');for(var _0xeefe10=0x0,_0x18dff9={},_0x3a79d3={};_0xeefe10<_0x55862a[_0xbdb6('0x46')];_0xeefe10+=0x1){_0x18dff9=_0x55862a[_0xeefe10];if(_[_0xbdb6('0x44')](_0x5d9804[_0xbdb6('0x1d')][_0x18dff9['id']])){_0x5d9804[_0xbdb6('0x1d')][_0x18dff9['id']]=new SalesforceAccount(_0x18dff9);}else{_0x5d9804[_0xbdb6('0x43')](_0x5d9804[_0xbdb6('0x1d')][_0x18dff9['id']],_0x18dff9);}}}return _0x5d9804[_0xbdb6('0x1d')];};};Realtime['prototype'][_0xbdb6('0x4b')]=function(){var _0x439772=this;return function(_0x4ca83a){if(_0x4ca83a){freeIsNotKey(_0x4ca83a,_0x439772['freshdeskAccounts'],'id');for(var _0x15a8a3=0x0,_0x2b613d={},_0x44e8ac={};_0x15a8a3<_0x4ca83a[_0xbdb6('0x46')];_0x15a8a3+=0x1){_0x2b613d=_0x4ca83a[_0x15a8a3];if(_['isUndefined'](_0x439772[_0xbdb6('0x1f')][_0x2b613d['id']])){_0x439772[_0xbdb6('0x1f')][_0x2b613d['id']]=new FreshdeskAccount(_0x2b613d);}else{_0x439772[_0xbdb6('0x43')](_0x439772[_0xbdb6('0x1f')][_0x2b613d['id']],_0x2b613d);}}}return _0x439772['freshdeskAccounts'];};};Realtime[_0xbdb6('0x42')][_0xbdb6('0x4c')]=function(){var _0x5471f5=this;return function(_0x15102e){if(_0x15102e){freeIsNotKey(_0x15102e,_0x5471f5[_0xbdb6('0x20')],'id');for(var _0x281910=0x0,_0x55b24a={},_0x5949f0={};_0x281910<_0x15102e[_0xbdb6('0x46')];_0x281910+=0x1){_0x55b24a=_0x15102e[_0x281910];if(_[_0xbdb6('0x44')](_0x5471f5[_0xbdb6('0x20')][_0x55b24a['id']])){_0x5471f5['zohoAccounts'][_0x55b24a['id']]=new ZohoAccount(_0x55b24a);}else{_0x5471f5[_0xbdb6('0x43')](_0x5471f5[_0xbdb6('0x20')][_0x55b24a['id']],_0x55b24a);}}}return _0x5471f5[_0xbdb6('0x20')];};};Realtime[_0xbdb6('0x42')][_0xbdb6('0x4d')]=function(){var _0x4731d1=this;return function(_0x2a06a0){if(_0x2a06a0){freeIsNotKey(_0x2a06a0,_0x4731d1[_0xbdb6('0x21')],'id');for(var _0xe5cf36=0x0,_0x382f34={},_0x21c19c={};_0xe5cf36<_0x2a06a0[_0xbdb6('0x46')];_0xe5cf36+=0x1){_0x382f34=_0x2a06a0[_0xe5cf36];if(_[_0xbdb6('0x44')](_0x4731d1[_0xbdb6('0x21')][_0x382f34['id']])){_0x4731d1[_0xbdb6('0x21')][_0x382f34['id']]=new DeskAccount(_0x382f34);}else{_0x4731d1[_0xbdb6('0x43')](_0x4731d1[_0xbdb6('0x21')][_0x382f34['id']],_0x382f34);}}}return _0x4731d1[_0xbdb6('0x21')];};};Realtime[_0xbdb6('0x42')][_0xbdb6('0x4e')]=function(){var _0x17b4d6=this;return function(_0x230e3b){if(_0x230e3b){freeIsNotKey(_0x230e3b,_0x17b4d6['sugarcrmAccounts'],'id');for(var _0x54b57a=0x0,_0x290196={},_0x318013={};_0x54b57a<_0x230e3b[_0xbdb6('0x46')];_0x54b57a+=0x1){_0x290196=_0x230e3b[_0x54b57a];if(_[_0xbdb6('0x44')](_0x17b4d6[_0xbdb6('0x1e')][_0x290196['id']])){_0x17b4d6[_0xbdb6('0x1e')][_0x290196['id']]=new SugarcrmAccount(_0x290196);}else{_0x17b4d6[_0xbdb6('0x43')](_0x17b4d6[_0xbdb6('0x1e')][_0x290196['id']],_0x290196);}}}return _0x17b4d6[_0xbdb6('0x1e')];};};Realtime[_0xbdb6('0x42')][_0xbdb6('0x4f')]=function(){var _0x233456=this;return function(_0x54a918){if(_0x54a918){freeIsNotKey(_0x54a918,_0x233456[_0xbdb6('0x22')],'id');for(var _0x441366=0x0,_0x54c21d={},_0x332704={};_0x441366<_0x54a918[_0xbdb6('0x46')];_0x441366+=0x1){_0x54c21d=_0x54a918[_0x441366];if(_[_0xbdb6('0x44')](_0x233456[_0xbdb6('0x22')][_0x54c21d['id']])){_0x233456[_0xbdb6('0x22')][_0x54c21d['id']]=new VtigerAccount(_0x54c21d);}else{_0x233456['mergeFromDatabase'](_0x233456[_0xbdb6('0x22')][_0x54c21d['id']],_0x54c21d);}}}return _0x233456['vtigerAccounts'];};};Realtime[_0xbdb6('0x42')]['initServicenowAccounts']=function(){var _0x484d86=this;return function(_0x29782b){if(_0x29782b){freeIsNotKey(_0x29782b,_0x484d86['servicenowAccounts'],'id');for(var _0x5c536f=0x0,_0x18e2c8={},_0x24cfde={};_0x5c536f<_0x29782b[_0xbdb6('0x46')];_0x5c536f+=0x1){_0x18e2c8=_0x29782b[_0x5c536f];if(_[_0xbdb6('0x44')](_0x484d86[_0xbdb6('0x23')][_0x18e2c8['id']])){_0x484d86['servicenowAccounts'][_0x18e2c8['id']]=new ServicenowAccount(_0x18e2c8);}else{_0x484d86['mergeFromDatabase'](_0x484d86['servicenowAccounts'][_0x18e2c8['id']],_0x18e2c8);}}}return _0x484d86[_0xbdb6('0x23')];};};Realtime['prototype'][_0xbdb6('0x50')]=function(){var _0x311808=this;return function(_0x24fed7){if(_0x24fed7){freeIsNotKey(_0x24fed7,_0x311808[_0xbdb6('0x51')],'id');for(var _0x4cfd38=0x0,_0x53c69c={},_0x48c035={};_0x4cfd38<_0x24fed7[_0xbdb6('0x46')];_0x4cfd38+=0x1){_0x53c69c=_0x24fed7[_0x4cfd38];if(_[_0xbdb6('0x44')](_0x311808[_0xbdb6('0x51')][_0x53c69c['id']])){_0x311808[_0xbdb6('0x51')][_0x53c69c['id']]=new Dynamics365Account(_0x53c69c);}else{_0x311808[_0xbdb6('0x43')](_0x311808[_0xbdb6('0x51')][_0x53c69c['id']],_0x53c69c);}}}return _0x311808['dynamics365Accounts'];};};Realtime['prototype'][_0xbdb6('0x52')]=function(){var _0x3ca993=this;return function(_0x4067a9){if(_0x4067a9){freeIsNotKey(_0x4067a9,_0x3ca993[_0xbdb6('0x24')],'id');for(var _0x1a72fe=0x0,_0x4ee615={},_0x280469={};_0x1a72fe<_0x4067a9[_0xbdb6('0x46')];_0x1a72fe+=0x1){_0x4ee615=_0x4067a9[_0x1a72fe];if(_[_0xbdb6('0x44')](_0x3ca993['freshsalesAccounts'][_0x4ee615['id']])){_0x3ca993['freshsalesAccounts'][_0x4ee615['id']]=new FreshsalesAccount(_0x4ee615);}else{_0x3ca993[_0xbdb6('0x43')](_0x3ca993[_0xbdb6('0x24')][_0x4ee615['id']],_0x4ee615);}}}return _0x3ca993[_0xbdb6('0x24')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x1b3070=this;return function(_0x851f69){for(var _0x1f825a=0x0;_0x1f825a<_0x851f69[_0xbdb6('0x46')];_0x1f825a+=0x1){_[_0xbdb6('0x53')](_0x1b3070[_0xbdb6('0x13')][_0x851f69[_0x1f825a][_0xbdb6('0x27')]],_0x851f69[_0x1f825a]);}return _0x1b3070[_0xbdb6('0x13')];};};Realtime[_0xbdb6('0x42')][_0xbdb6('0x54')]=function(){var _0x17bf61=this;return function(_0x376aac){clearVoiceQueues(_0x17bf61[_0xbdb6('0x13')]);if(_0x376aac){_0x376aac=_[_0xbdb6('0x55')](_0x376aac,_0xbdb6('0x56'));for(var _0x410666 in _0x376aac){if(_0x376aac[_0xbdb6('0x2b')](_0x410666)){var _0x199d00={};for(var _0x7c1548=0x0;_0x7c1548<_0x376aac[_0x410666][_0xbdb6('0x46')];_0x7c1548+=0x1){var _0x20f76b=_0x376aac[_0x410666][_0x7c1548][_0xbdb6('0x57')];if(_0x17bf61[_0xbdb6('0x13')][_0x20f76b]){if(_0x376aac[_0x410666][_0x7c1548][_0xbdb6('0x58')]){_0x17bf61[_0xbdb6('0x13')][_0x20f76b][_0xbdb6('0x34')]+=0x1;}if(_0x376aac[_0x410666][_0x7c1548]['queuecallerabandon']){_0x17bf61[_0xbdb6('0x13')][_0x20f76b][_0xbdb6('0x59')]+=0x1;}_0x17bf61[_0xbdb6('0x13')][_0x20f76b][_0xbdb6('0x2e')]+=moment(_0x376aac[_0x410666][_0x7c1548][_0xbdb6('0x5a')])[_0xbdb6('0x5b')](moment(_0x376aac[_0x410666][_0x7c1548][_0xbdb6('0x5c')]),_0xbdb6('0x5d'))||0x0;if(_0x7c1548===_0x376aac[_0x410666][_0xbdb6('0x46')]-0x1){_0x17bf61[_0xbdb6('0x13')][_0x20f76b][_0xbdb6('0x2f')]+=moment(_0x376aac[_0x410666][_0x7c1548][_0xbdb6('0x5e')]||_0x376aac[_0x410666][_0x7c1548][_0xbdb6('0x5f')]||_0x376aac[_0x410666][_0x7c1548]['queuecallerexitAt'])[_0xbdb6('0x5b')](moment(_0x376aac[_0x410666][_0x7c1548][_0xbdb6('0x5c')]),_0xbdb6('0x5d'))||0x0;_0x17bf61['voiceQueues'][_0x20f76b][_0xbdb6('0x2c')]+=0x1;if(_0x376aac[_0x410666][_0x7c1548][_0xbdb6('0x60')]){_0x17bf61[_0xbdb6('0x13')][_0x20f76b][_0xbdb6('0x2d')]+=0x1;_0x17bf61['voiceQueues'][_0x20f76b]['sumBillable']+=moment(_0x376aac[_0x410666][_0x7c1548][_0xbdb6('0x5e')])[_0xbdb6('0x5b')](moment(_0x376aac[_0x410666][_0x7c1548][_0xbdb6('0x5a')]),_0xbdb6('0x5d'))||0x0;}}else{_0x17bf61[_0xbdb6('0x13')][_0x20f76b][_0xbdb6('0x2f')]+=_0x17bf61[_0xbdb6('0x13')][_0x20f76b][_0xbdb6('0x2e')]||0x0;}}}}}}return _0x17bf61[_0xbdb6('0x13')];};};Realtime[_0xbdb6('0x42')]['initVoiceCallReports']=function(){var _0x4d0d33=this;return function(_0x109731){clearVoiceCallReports(_0x4d0d33[_0xbdb6('0x61')]);if(_0x109731){for(var _0x37b54c=0x0;_0x37b54c<_0x109731[_0xbdb6('0x46')];_0x37b54c+=0x1){_0x4d0d33[_0xbdb6('0x61')][_0xbdb6('0x2c')]+=0x1;_0x4d0d33[_0xbdb6('0x61')]['sumDuration']+=_0x109731[_0x37b54c]['duration'];if(_0x109731[_0x37b54c]['disposition']===_0xbdb6('0x62')){_0x4d0d33[_0xbdb6('0x61')][_0xbdb6('0x2d')]+=0x1;_0x4d0d33['outbound'][_0xbdb6('0x2e')]+=_0x109731[_0x37b54c]['duration']-_0x109731[_0x37b54c][_0xbdb6('0x63')]||0x0;_0x4d0d33[_0xbdb6('0x61')]['sumBillable']+=_0x109731[_0x37b54c][_0xbdb6('0x63')];}}}return _0x4d0d33[_0xbdb6('0x61')];};};Realtime['prototype'][_0xbdb6('0x64')]=function(){var _0xf5bbb3=this;return function(_0x43afa4){if(_0x43afa4){freeIsNotKey(_0x43afa4,_0xf5bbb3['campaigns'],_0xbdb6('0x27'));for(var _0x961ed8=0x0,_0x177171={};_0x961ed8<_0x43afa4['length'];_0x961ed8+=0x1){_0x177171=_0x43afa4[_0x961ed8];if(_[_0xbdb6('0x44')](_0xf5bbb3[_0xbdb6('0x15')][_0x177171['name']])){_0xf5bbb3['campaigns'][_0x177171['name']]=new Campaign(_0x177171);}else{_0xf5bbb3[_0xbdb6('0x43')](_0xf5bbb3[_0xbdb6('0x15')][_0x177171['name']],_0x177171);_0xf5bbb3[_0xbdb6('0x15')][_0x177171[_0xbdb6('0x27')]][_0xbdb6('0x65')]=_0x177171[_0xbdb6('0x66')]?_0x177171[_0xbdb6('0x66')]['name']:undefined;}}}return _0xf5bbb3[_0xbdb6('0x15')];};};Realtime[_0xbdb6('0x42')][_0xbdb6('0x67')]=function(){var _0x481695=this;return function(_0x15f9cd){if(_0x15f9cd){freeIsNotKey(_0x15f9cd,_0x481695[_0xbdb6('0x17')],'id');for(var _0xc8401c=0x0,_0x55be8d={};_0xc8401c<_0x15f9cd[_0xbdb6('0x46')];_0xc8401c+=0x1){_0x55be8d=_0x15f9cd[_0xc8401c];if(_['isUndefined'](_0x481695['voiceExtensions'][_0x55be8d['id']])){_0x481695[_0xbdb6('0x17')][_0x55be8d['id']]=new VoiceExtension(_0x55be8d);}else{_0x481695['mergeFromDatabase'](_0x481695['voiceExtensions'][_0x55be8d['id']],_0x55be8d);}}}return _0x481695[_0xbdb6('0x17')];};};Realtime[_0xbdb6('0x42')][_0xbdb6('0x68')]=function(){var _0x121f67=this;return function(_0x44d25c){clearCampaigns(_0x121f67[_0xbdb6('0x15')]);for(var _0x52ba89=0x0;_0x52ba89<_0x44d25c[_0xbdb6('0x46')];_0x52ba89+=0x1){_[_0xbdb6('0x53')](_0x121f67[_0xbdb6('0x15')][_0x44d25c[_0x52ba89][_0xbdb6('0x27')]],_0x44d25c[_0x52ba89]);}return _0x121f67[_0xbdb6('0x15')];};};Realtime[_0xbdb6('0x42')][_0xbdb6('0x69')]=function(){var _0x245bfd=this;return function(_0x38f3e7){if(_0x38f3e7){freeIsNotKey(_0x38f3e7,_0x245bfd['faxAccounts'],'id');for(var _0x3bf040=0x0,_0x4a15ea={},_0x111104={};_0x3bf040<_0x38f3e7[_0xbdb6('0x46')];_0x3bf040+=0x1){_0x4a15ea=_0x38f3e7[_0x3bf040];if(_[_0xbdb6('0x44')](_0x245bfd[_0xbdb6('0x6a')][_0x4a15ea['id']])){_0x245bfd['faxAccounts'][_0x4a15ea['id']]=new FaxAccount(_0x4a15ea);}else{_0x245bfd['mergeFromDatabase'](_0x245bfd[_0xbdb6('0x6a')][_0x4a15ea['id']],_0x4a15ea);}}}return _0x245bfd[_0xbdb6('0x6a')];};};module[_0xbdb6('0x6b')]=Realtime; \ No newline at end of file +var _0x4851=['../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','SIP/%s','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','mergeFromDatabase','prototype','initAgents','length','name','isUndefined','initTelephones','initTrunks','initVoiceQueues','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','answered','queuecallercompleteAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk'];(function(_0x55e45c,_0x3fd637){var _0x5d304e=function(_0x419e03){while(--_0x419e03){_0x55e45c['push'](_0x55e45c['shift']());}};_0x5d304e(++_0x3fd637);}(_0x4851,0x14d));var _0x1485=function(_0xffa10f,_0x36ee14){_0xffa10f=_0xffa10f-0x0;var _0x1924ca=_0x4851[_0xffa10f];return _0x1924ca;};'use strict';var BPromise=require(_0x1485('0x0'));var util=require(_0x1485('0x1'));var _=require('lodash');var moment=require(_0x1485('0x2'));var Agent=require(_0x1485('0x3'));var Telephone=require(_0x1485('0x4'));var Trunk=require(_0x1485('0x5'));var VoiceQueue=require(_0x1485('0x6'));var Trigger=require(_0x1485('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0x1485('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x1485('0x9'));var FreshdeskAccount=require(_0x1485('0xa'));var SugarcrmAccount=require(_0x1485('0xb'));var ZohoAccount=require(_0x1485('0xc'));var DeskAccount=require(_0x1485('0xd'));var VtigerAccount=require(_0x1485('0xe'));var ServicenowAccount=require(_0x1485('0xf'));var Dynamics365Account=require(_0x1485('0x10'));var FreshsalesAccount=require(_0x1485('0x11'));var FaxAccount=require(_0x1485('0x12'));var Realtime=function(){this[_0x1485('0x13')]={};this[_0x1485('0x14')]={};this[_0x1485('0x15')]={};this[_0x1485('0x16')]={};this[_0x1485('0x17')]={};this[_0x1485('0x18')]={};this[_0x1485('0x19')]={};this[_0x1485('0x1a')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x1485('0x1b')]={};this[_0x1485('0x1c')]={};this[_0x1485('0x1d')]={};this[_0x1485('0x1e')]={};this['timers']={};this[_0x1485('0x1f')]={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x1485('0x20')]={};this[_0x1485('0x21')]={};this['zohoAccounts']={};this[_0x1485('0x22')]={};this[_0x1485('0x23')]={};this[_0x1485('0x24')]={};this[_0x1485('0x25')]={};this['freshsalesAccounts']={};this[_0x1485('0x26')]={};};function freeIsNotKey(_0x8186,_0x1cd219,_0x355898){var _0x3e2175=_[_0x1485('0x27')](_0x8186,function(_0x1f7b82,_0x16c108){return _0x1f7b82[_0x355898];});for(var _0x1ef9ab in _0x1cd219){if(_0x1cd219['hasOwnProperty'](_0x1ef9ab)){if(!_0x3e2175[_0x1ef9ab]){delete _0x1cd219[_0x1ef9ab];}}}}function freeIsNotKeySip(_0x27ce5c,_0x105c52){var _0xfa0948=_['mapKeys'](_0x27ce5c,function(_0x5b1095,_0x114b15){return util['format']('SIP/%s',_0x5b1095['name']);});for(var _0x2ef30d in _0x105c52){if(_0x105c52[_0x1485('0x28')](_0x2ef30d)){if(!_0xfa0948[_0x2ef30d]){delete _0x105c52[_0x2ef30d];}}}}function freeIsNotKeyAgent(_0x1e23b4,_0x25220f){var _0x2dd529=_[_0x1485('0x27')](_0x1e23b4,function(_0x201ad6,_0x271d74){var _0x1bfd8d=_[_0x1485('0x29')](_0x201ad6['interface'])?util[_0x1485('0x2a')](_0x1485('0x2b'),_0x201ad6['name']):_0x201ad6[_0x1485('0x2c')];return _0x1bfd8d;});for(var _0x565584 in _0x25220f){if(_0x25220f[_0x1485('0x28')](_0x565584)){if(!_0x2dd529[_0x565584]){delete _0x25220f[_0x565584];}}}}function clearVoiceCallReports(_0x95d57d){_0x95d57d['total']=0x0;_0x95d57d['answered']=0x0;_0x95d57d[_0x1485('0x2d')]=0x0;_0x95d57d[_0x1485('0x2e')]=0x0;_0x95d57d[_0x1485('0x2f')]=0x0;}function clearCampaigns(_0xf3c217){if(!_[_0x1485('0x30')](_0xf3c217)){for(var _0x54a988 in _0xf3c217){if(_0xf3c217[_0x1485('0x28')](_0x54a988)){_0xf3c217[_0x54a988][_0x1485('0x31')]=0x0;_0xf3c217[_0x54a988][_0x1485('0x32')]=0x0;}}}}function clearVoiceQueues(_0x3d5cad){if(!_[_0x1485('0x30')](_0x3d5cad)){for(var _0x726b70 in _0x3d5cad){if(_0x3d5cad['hasOwnProperty'](_0x726b70)){_0x3d5cad[_0x726b70][_0x1485('0x33')]=0x0;_0x3d5cad[_0x726b70]['answered']=0x0;_0x3d5cad[_0x726b70]['unmanaged']=0x0;_0x3d5cad[_0x726b70][_0x1485('0x34')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x2d')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x2e')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x2f')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x35')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x36')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x37')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x38')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x39')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x3a')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x3b')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x3c')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x3d')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x3e')]=0x0;_0x3d5cad[_0x726b70]['outboundRejectCallsDay']=0x0;_0x3d5cad[_0x726b70][_0x1485('0x3f')]=0x0;_0x3d5cad[_0x726b70][_0x1485('0x35')]=0x0;_0x3d5cad[_0x726b70]['outboundAnswerCallsDay']=0x0;_0x3d5cad[_0x726b70]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0x1485('0x40')]=function(_0x30a7b7,_0x2c59e4){for(var _0x15e91a in _0x2c59e4){if(_0x30a7b7[_0x1485('0x28')](_0x15e91a)){_0x30a7b7[_0x15e91a]=_0x2c59e4[_0x15e91a];}}};Realtime[_0x1485('0x41')][_0x1485('0x42')]=function(){var _0x195ab0=this;return function(_0x8af7d7){if(_0x8af7d7){freeIsNotKeyAgent(_0x8af7d7,_0x195ab0[_0x1485('0x13')]);for(var _0x310cfa=0x0,_0x5edc3a={},_0x14de4e={};_0x310cfa<_0x8af7d7[_0x1485('0x43')];_0x310cfa+=0x1){_0x5edc3a=_0x8af7d7[_0x310cfa];var _0x56357a=_[_0x1485('0x29')](_0x5edc3a[_0x1485('0x2c')])?util['format'](_0x1485('0x2b'),_0x5edc3a[_0x1485('0x44')]):_0x5edc3a[_0x1485('0x2c')];if(_[_0x1485('0x45')](_0x195ab0[_0x1485('0x13')][_0x56357a])){_0x195ab0[_0x1485('0x13')][_0x56357a]=new Agent(_0x5edc3a);}else{_0x195ab0[_0x1485('0x40')](_0x195ab0[_0x1485('0x13')][_0x56357a],_0x5edc3a);}}}return _0x195ab0[_0x1485('0x13')];};};Realtime[_0x1485('0x41')][_0x1485('0x46')]=function(){var _0x25fa2d=this;return function(_0x26c73c){if(_0x26c73c){freeIsNotKeySip(_0x26c73c,_0x25fa2d['telephones']);for(var _0x4e48be=0x0,_0x341971={},_0x2ae6f4={};_0x4e48be<_0x26c73c[_0x1485('0x43')];_0x4e48be+=0x1){_0x341971=_0x26c73c[_0x4e48be];if(_[_0x1485('0x45')](_0x25fa2d[_0x1485('0x14')][util[_0x1485('0x2a')]('SIP/%s',_0x341971[_0x1485('0x44')])])){_0x25fa2d[_0x1485('0x14')][util['format']('SIP/%s',_0x341971['name'])]=new Telephone(_0x341971);}else{_0x25fa2d['mergeFromDatabase'](_0x25fa2d[_0x1485('0x14')][util[_0x1485('0x2a')](_0x1485('0x2b'),_0x341971['name'])],_0x341971);}}}return _0x25fa2d[_0x1485('0x14')];};};Realtime[_0x1485('0x41')][_0x1485('0x47')]=function(){var _0x4726fc=this;return function(_0xd44873){if(_0xd44873){freeIsNotKeySip(_0xd44873,_0x4726fc['trunks']);for(var _0x1be21c=0x0,_0x457526={},_0x5bf1ad={};_0x1be21c<_0xd44873[_0x1485('0x43')];_0x1be21c+=0x1){_0x457526=_0xd44873[_0x1be21c];if(_['isUndefined'](_0x4726fc['trunks'][util[_0x1485('0x2a')](_0x1485('0x2b'),_0x457526[_0x1485('0x44')])])){_0x4726fc['trunks'][util[_0x1485('0x2a')](_0x1485('0x2b'),_0x457526[_0x1485('0x44')])]=new Trunk(_0x457526);}else{_0x4726fc['mergeFromDatabase'](_0x4726fc[_0x1485('0x15')][util[_0x1485('0x2a')]('SIP/%s',_0x457526['name'])],_0x457526);}}}return _0x4726fc[_0x1485('0x15')];};};Realtime[_0x1485('0x41')][_0x1485('0x48')]=function(){var _0x37684b=this;return function(_0x7f2001){if(_0x7f2001){freeIsNotKey(_0x7f2001,_0x37684b[_0x1485('0x16')],_0x1485('0x44'));for(var _0x40e385=0x0,_0xe952ca={},_0xb8c987={};_0x40e385<_0x7f2001[_0x1485('0x43')];_0x40e385+=0x1){_0xe952ca=_0x7f2001[_0x40e385];if(_[_0x1485('0x45')](_0x37684b[_0x1485('0x16')][_0xe952ca['name']])){_0x37684b['voiceQueues'][_0xe952ca['name']]=new VoiceQueue(_0xe952ca);}else{_0x37684b['mergeFromDatabase'](_0x37684b[_0x1485('0x16')][_0xe952ca[_0x1485('0x44')]],_0xe952ca);}}}return _0x37684b[_0x1485('0x16')];};};Realtime[_0x1485('0x41')]['initTriggers']=function(){var _0x5453e8=this;return function(_0x411abf){if(_0x411abf){freeIsNotKey(_0x411abf,_0x5453e8['triggers'],'id');for(var _0x3ee624=0x0,_0x11ec52={},_0x277505={};_0x3ee624<_0x411abf['length'];_0x3ee624+=0x1){_0x11ec52=_0x411abf[_0x3ee624];if(_[_0x1485('0x45')](_0x5453e8['triggers'][_0x11ec52['id']])){_0x5453e8[_0x1485('0x17')][_0x11ec52['id']]=new Trigger(_0x11ec52);}else{_0x5453e8[_0x1485('0x40')](_0x5453e8[_0x1485('0x17')][_0x11ec52['id']],_0x11ec52);}}}return _0x5453e8['triggers'];};};Realtime[_0x1485('0x41')]['initTemplates']=function(){var _0x2c61e6=this;return function(_0x5eae31){if(_0x5eae31){freeIsNotKey(_0x5eae31,_0x2c61e6[_0x1485('0x19')],'id');for(var _0x3f4bc5=0x0,_0x4bc1e9={},_0x2b6b55={};_0x3f4bc5<_0x5eae31[_0x1485('0x43')];_0x3f4bc5+=0x1){_0x4bc1e9=_0x5eae31[_0x3f4bc5];if(_['isUndefined'](_0x2c61e6[_0x1485('0x19')][_0x4bc1e9['id']])){_0x2c61e6['templates'][_0x4bc1e9['id']]=new Template(_0x4bc1e9);}else{_0x2c61e6[_0x1485('0x40')](_0x2c61e6[_0x1485('0x19')][_0x4bc1e9['id']],_0x4bc1e9);}}}return _0x2c61e6[_0x1485('0x19')];};};Realtime[_0x1485('0x41')][_0x1485('0x49')]=function(){var _0x476bab=this;return function(_0x24e2c2){if(_0x24e2c2){freeIsNotKey(_0x24e2c2,_0x476bab['zendeskAccounts'],'id');for(var _0x5dcae0=0x0,_0x3fe8fa={},_0x2bcdde={};_0x5dcae0<_0x24e2c2[_0x1485('0x43')];_0x5dcae0+=0x1){_0x3fe8fa=_0x24e2c2[_0x5dcae0];if(_[_0x1485('0x45')](_0x476bab['zendeskAccounts'][_0x3fe8fa['id']])){_0x476bab[_0x1485('0x4a')][_0x3fe8fa['id']]=new ZendeskAccount(_0x3fe8fa);}else{_0x476bab[_0x1485('0x40')](_0x476bab['zendeskAccounts'][_0x3fe8fa['id']],_0x3fe8fa);}}}return _0x476bab[_0x1485('0x4a')];};};Realtime[_0x1485('0x41')][_0x1485('0x4b')]=function(){var _0xcf430=this;return function(_0x5908ab){if(_0x5908ab){freeIsNotKey(_0x5908ab,_0xcf430[_0x1485('0x4c')],'id');for(var _0x1fd792=0x0,_0xce4af={},_0x5c8536={};_0x1fd792<_0x5908ab[_0x1485('0x43')];_0x1fd792+=0x1){_0xce4af=_0x5908ab[_0x1fd792];if(_[_0x1485('0x45')](_0xcf430[_0x1485('0x4c')][_0xce4af['id']])){_0xcf430[_0x1485('0x4c')][_0xce4af['id']]=new SalesforceAccount(_0xce4af);}else{_0xcf430[_0x1485('0x40')](_0xcf430['salesforceAccounts'][_0xce4af['id']],_0xce4af);}}}return _0xcf430[_0x1485('0x4c')];};};Realtime[_0x1485('0x41')][_0x1485('0x4d')]=function(){var _0x4267e2=this;return function(_0x5a96f2){if(_0x5a96f2){freeIsNotKey(_0x5a96f2,_0x4267e2[_0x1485('0x21')],'id');for(var _0x2f6e25=0x0,_0x31f951={},_0x4eb809={};_0x2f6e25<_0x5a96f2[_0x1485('0x43')];_0x2f6e25+=0x1){_0x31f951=_0x5a96f2[_0x2f6e25];if(_[_0x1485('0x45')](_0x4267e2[_0x1485('0x21')][_0x31f951['id']])){_0x4267e2[_0x1485('0x21')][_0x31f951['id']]=new FreshdeskAccount(_0x31f951);}else{_0x4267e2['mergeFromDatabase'](_0x4267e2[_0x1485('0x21')][_0x31f951['id']],_0x31f951);}}}return _0x4267e2['freshdeskAccounts'];};};Realtime[_0x1485('0x41')][_0x1485('0x4e')]=function(){var _0x59c92e=this;return function(_0x1c9868){if(_0x1c9868){freeIsNotKey(_0x1c9868,_0x59c92e[_0x1485('0x4f')],'id');for(var _0xa0da72=0x0,_0x582f14={},_0x266644={};_0xa0da72<_0x1c9868[_0x1485('0x43')];_0xa0da72+=0x1){_0x582f14=_0x1c9868[_0xa0da72];if(_[_0x1485('0x45')](_0x59c92e[_0x1485('0x4f')][_0x582f14['id']])){_0x59c92e[_0x1485('0x4f')][_0x582f14['id']]=new ZohoAccount(_0x582f14);}else{_0x59c92e[_0x1485('0x40')](_0x59c92e['zohoAccounts'][_0x582f14['id']],_0x582f14);}}}return _0x59c92e[_0x1485('0x4f')];};};Realtime[_0x1485('0x41')][_0x1485('0x50')]=function(){var _0x3a5a54=this;return function(_0x5ddd8c){if(_0x5ddd8c){freeIsNotKey(_0x5ddd8c,_0x3a5a54[_0x1485('0x22')],'id');for(var _0x7cb4ff=0x0,_0x314945={},_0x4ed713={};_0x7cb4ff<_0x5ddd8c[_0x1485('0x43')];_0x7cb4ff+=0x1){_0x314945=_0x5ddd8c[_0x7cb4ff];if(_['isUndefined'](_0x3a5a54['deskAccounts'][_0x314945['id']])){_0x3a5a54[_0x1485('0x22')][_0x314945['id']]=new DeskAccount(_0x314945);}else{_0x3a5a54[_0x1485('0x40')](_0x3a5a54[_0x1485('0x22')][_0x314945['id']],_0x314945);}}}return _0x3a5a54[_0x1485('0x22')];};};Realtime[_0x1485('0x41')][_0x1485('0x51')]=function(){var _0x4179e3=this;return function(_0x31e27f){if(_0x31e27f){freeIsNotKey(_0x31e27f,_0x4179e3['sugarcrmAccounts'],'id');for(var _0x1e3b56=0x0,_0x5e0cec={},_0x32f6b5={};_0x1e3b56<_0x31e27f['length'];_0x1e3b56+=0x1){_0x5e0cec=_0x31e27f[_0x1e3b56];if(_[_0x1485('0x45')](_0x4179e3['sugarcrmAccounts'][_0x5e0cec['id']])){_0x4179e3[_0x1485('0x20')][_0x5e0cec['id']]=new SugarcrmAccount(_0x5e0cec);}else{_0x4179e3[_0x1485('0x40')](_0x4179e3['sugarcrmAccounts'][_0x5e0cec['id']],_0x5e0cec);}}}return _0x4179e3[_0x1485('0x20')];};};Realtime['prototype'][_0x1485('0x52')]=function(){var _0x3502bd=this;return function(_0x4d0a3b){if(_0x4d0a3b){freeIsNotKey(_0x4d0a3b,_0x3502bd[_0x1485('0x23')],'id');for(var _0x2192a1=0x0,_0x5b2e28={},_0x1bde91={};_0x2192a1<_0x4d0a3b[_0x1485('0x43')];_0x2192a1+=0x1){_0x5b2e28=_0x4d0a3b[_0x2192a1];if(_[_0x1485('0x45')](_0x3502bd[_0x1485('0x23')][_0x5b2e28['id']])){_0x3502bd[_0x1485('0x23')][_0x5b2e28['id']]=new VtigerAccount(_0x5b2e28);}else{_0x3502bd[_0x1485('0x40')](_0x3502bd[_0x1485('0x23')][_0x5b2e28['id']],_0x5b2e28);}}}return _0x3502bd[_0x1485('0x23')];};};Realtime[_0x1485('0x41')][_0x1485('0x53')]=function(){var _0x5e1b74=this;return function(_0x4f8f1b){if(_0x4f8f1b){freeIsNotKey(_0x4f8f1b,_0x5e1b74[_0x1485('0x24')],'id');for(var _0x5124ac=0x0,_0x4cbc4e={},_0x4abf4f={};_0x5124ac<_0x4f8f1b['length'];_0x5124ac+=0x1){_0x4cbc4e=_0x4f8f1b[_0x5124ac];if(_['isUndefined'](_0x5e1b74[_0x1485('0x24')][_0x4cbc4e['id']])){_0x5e1b74[_0x1485('0x24')][_0x4cbc4e['id']]=new ServicenowAccount(_0x4cbc4e);}else{_0x5e1b74['mergeFromDatabase'](_0x5e1b74[_0x1485('0x24')][_0x4cbc4e['id']],_0x4cbc4e);}}}return _0x5e1b74['servicenowAccounts'];};};Realtime[_0x1485('0x41')]['initDynamics365Accounts']=function(){var _0x16ea3e=this;return function(_0x2acf38){if(_0x2acf38){freeIsNotKey(_0x2acf38,_0x16ea3e['dynamics365Accounts'],'id');for(var _0x710efa=0x0,_0x44a996={},_0x3a336a={};_0x710efa<_0x2acf38['length'];_0x710efa+=0x1){_0x44a996=_0x2acf38[_0x710efa];if(_[_0x1485('0x45')](_0x16ea3e[_0x1485('0x25')][_0x44a996['id']])){_0x16ea3e[_0x1485('0x25')][_0x44a996['id']]=new Dynamics365Account(_0x44a996);}else{_0x16ea3e['mergeFromDatabase'](_0x16ea3e[_0x1485('0x25')][_0x44a996['id']],_0x44a996);}}}return _0x16ea3e['dynamics365Accounts'];};};Realtime[_0x1485('0x41')][_0x1485('0x54')]=function(){var _0xbc49a2=this;return function(_0x31765a){if(_0x31765a){freeIsNotKey(_0x31765a,_0xbc49a2[_0x1485('0x55')],'id');for(var _0x20f578=0x0,_0x1ba998={},_0x4cb2a6={};_0x20f578<_0x31765a[_0x1485('0x43')];_0x20f578+=0x1){_0x1ba998=_0x31765a[_0x20f578];if(_[_0x1485('0x45')](_0xbc49a2['freshsalesAccounts'][_0x1ba998['id']])){_0xbc49a2[_0x1485('0x55')][_0x1ba998['id']]=new FreshsalesAccount(_0x1ba998);}else{_0xbc49a2[_0x1485('0x40')](_0xbc49a2[_0x1485('0x55')][_0x1ba998['id']],_0x1ba998);}}}return _0xbc49a2[_0x1485('0x55')];};};Realtime[_0x1485('0x41')]['initVoiceQueueHopperHistory']=function(){var _0xd0d0d6=this;return function(_0x4f9cc9){for(var _0xabca27=0x0;_0xabca27<_0x4f9cc9[_0x1485('0x43')];_0xabca27+=0x1){_[_0x1485('0x56')](_0xd0d0d6[_0x1485('0x16')][_0x4f9cc9[_0xabca27][_0x1485('0x44')]],_0x4f9cc9[_0xabca27]);}return _0xd0d0d6['voiceQueues'];};};Realtime[_0x1485('0x41')][_0x1485('0x57')]=function(){var _0x21464c=this;return function(_0x2b076e){clearVoiceQueues(_0x21464c['voiceQueues']);if(_0x2b076e){_0x2b076e=_[_0x1485('0x58')](_0x2b076e,_0x1485('0x59'));for(var _0x22a7ae in _0x2b076e){if(_0x2b076e[_0x1485('0x28')](_0x22a7ae)){var _0xb6e6a6={};for(var _0x222bbe=0x0;_0x222bbe<_0x2b076e[_0x22a7ae]['length'];_0x222bbe+=0x1){var _0x444bf4=_0x2b076e[_0x22a7ae][_0x222bbe][_0x1485('0x5a')];if(_0x21464c['voiceQueues'][_0x444bf4]){if(_0x2b076e[_0x22a7ae][_0x222bbe]['queuecallerexit']){_0x21464c['voiceQueues'][_0x444bf4][_0x1485('0x5b')]+=0x1;}if(_0x2b076e[_0x22a7ae][_0x222bbe][_0x1485('0x5c')]){_0x21464c[_0x1485('0x16')][_0x444bf4][_0x1485('0x34')]+=0x1;}_0x21464c[_0x1485('0x16')][_0x444bf4][_0x1485('0x2d')]+=moment(_0x2b076e[_0x22a7ae][_0x222bbe][_0x1485('0x5d')])[_0x1485('0x5e')](moment(_0x2b076e[_0x22a7ae][_0x222bbe][_0x1485('0x5f')]),_0x1485('0x60'))||0x0;if(_0x222bbe===_0x2b076e[_0x22a7ae][_0x1485('0x43')]-0x1){_0x21464c[_0x1485('0x16')][_0x444bf4][_0x1485('0x2e')]+=moment(_0x2b076e[_0x22a7ae][_0x222bbe]['queuecallercompleteAt']||_0x2b076e[_0x22a7ae][_0x222bbe][_0x1485('0x61')]||_0x2b076e[_0x22a7ae][_0x222bbe][_0x1485('0x62')])['diff'](moment(_0x2b076e[_0x22a7ae][_0x222bbe][_0x1485('0x5f')]),_0x1485('0x60'))||0x0;_0x21464c[_0x1485('0x16')][_0x444bf4]['total']+=0x1;if(_0x2b076e[_0x22a7ae][_0x222bbe][_0x1485('0x63')]){_0x21464c['voiceQueues'][_0x444bf4][_0x1485('0x64')]+=0x1;_0x21464c[_0x1485('0x16')][_0x444bf4]['sumBillable']+=moment(_0x2b076e[_0x22a7ae][_0x222bbe][_0x1485('0x65')])[_0x1485('0x5e')](moment(_0x2b076e[_0x22a7ae][_0x222bbe]['queuecallerleaveAt']),_0x1485('0x60'))||0x0;}}else{_0x21464c[_0x1485('0x16')][_0x444bf4]['sumDuration']+=_0x21464c[_0x1485('0x16')][_0x444bf4][_0x1485('0x2d')]||0x0;}}}}}}return _0x21464c['voiceQueues'];};};Realtime[_0x1485('0x41')][_0x1485('0x66')]=function(){var _0x589912=this;return function(_0x5c6f0d){clearVoiceCallReports(_0x589912[_0x1485('0x1a')]);if(_0x5c6f0d){for(var _0x237aef=0x0;_0x237aef<_0x5c6f0d[_0x1485('0x43')];_0x237aef+=0x1){_0x589912[_0x1485('0x1a')][_0x1485('0x33')]+=0x1;_0x589912[_0x1485('0x1a')][_0x1485('0x2e')]+=_0x5c6f0d[_0x237aef][_0x1485('0x67')];if(_0x5c6f0d[_0x237aef][_0x1485('0x68')]===_0x1485('0x69')){_0x589912[_0x1485('0x1a')][_0x1485('0x64')]+=0x1;_0x589912['outbound'][_0x1485('0x2d')]+=_0x5c6f0d[_0x237aef][_0x1485('0x67')]-_0x5c6f0d[_0x237aef][_0x1485('0x6a')]||0x0;_0x589912[_0x1485('0x1a')]['sumBillable']+=_0x5c6f0d[_0x237aef][_0x1485('0x6a')];}}}return _0x589912[_0x1485('0x1a')];};};Realtime[_0x1485('0x41')][_0x1485('0x6b')]=function(){var _0x5609f8=this;return function(_0x4a098a){if(_0x4a098a){freeIsNotKey(_0x4a098a,_0x5609f8[_0x1485('0x18')],_0x1485('0x44'));for(var _0x15d521=0x0,_0x2664aa={};_0x15d521<_0x4a098a[_0x1485('0x43')];_0x15d521+=0x1){_0x2664aa=_0x4a098a[_0x15d521];if(_[_0x1485('0x45')](_0x5609f8[_0x1485('0x18')][_0x2664aa[_0x1485('0x44')]])){_0x5609f8[_0x1485('0x18')][_0x2664aa['name']]=new Campaign(_0x2664aa);}else{_0x5609f8[_0x1485('0x40')](_0x5609f8[_0x1485('0x18')][_0x2664aa[_0x1485('0x44')]],_0x2664aa);_0x5609f8[_0x1485('0x18')][_0x2664aa[_0x1485('0x44')]]['dialQueueProject']=_0x2664aa[_0x1485('0x6c')]?_0x2664aa[_0x1485('0x6c')][_0x1485('0x44')]:undefined;}}}return _0x5609f8['campaigns'];};};Realtime[_0x1485('0x41')][_0x1485('0x6d')]=function(){var _0x55cc58=this;return function(_0x163e70){if(_0x163e70){freeIsNotKey(_0x163e70,_0x55cc58['voiceExtensions'],'id');for(var _0x3baea7=0x0,_0x193465={};_0x3baea7<_0x163e70['length'];_0x3baea7+=0x1){_0x193465=_0x163e70[_0x3baea7];if(_[_0x1485('0x45')](_0x55cc58[_0x1485('0x1b')][_0x193465['id']])){_0x55cc58[_0x1485('0x1b')][_0x193465['id']]=new VoiceExtension(_0x193465);}else{_0x55cc58[_0x1485('0x40')](_0x55cc58[_0x1485('0x1b')][_0x193465['id']],_0x193465);}}}return _0x55cc58[_0x1485('0x1b')];};};Realtime[_0x1485('0x41')][_0x1485('0x6e')]=function(){var _0x171a9c=this;return function(_0x58fdb7){clearCampaigns(_0x171a9c[_0x1485('0x18')]);for(var _0x406d8d=0x0;_0x406d8d<_0x58fdb7[_0x1485('0x43')];_0x406d8d+=0x1){_['merge'](_0x171a9c[_0x1485('0x18')][_0x58fdb7[_0x406d8d][_0x1485('0x44')]],_0x58fdb7[_0x406d8d]);}return _0x171a9c[_0x1485('0x18')];};};Realtime['prototype'][_0x1485('0x6f')]=function(){var _0x40972d=this;return function(_0x3e7f58){if(_0x3e7f58){freeIsNotKey(_0x3e7f58,_0x40972d['faxAccounts'],'id');for(var _0x2dfec0=0x0,_0x2ae609={},_0x9c229d={};_0x2dfec0<_0x3e7f58[_0x1485('0x43')];_0x2dfec0+=0x1){_0x2ae609=_0x3e7f58[_0x2dfec0];if(_['isUndefined'](_0x40972d['faxAccounts'][_0x2ae609['id']])){_0x40972d['faxAccounts'][_0x2ae609['id']]=new FaxAccount(_0x2ae609);}else{_0x40972d['mergeFromDatabase'](_0x40972d['faxAccounts'][_0x2ae609['id']],_0x2ae609);}}}return _0x40972d[_0x1485('0x26')];};};module[_0x1485('0x70')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index b0e4278..e7eecf2 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 _0x42b3=['voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','connectedlinename','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','substring','indexOf','mobile','phone','lastIndexOf','SIP/%s','membername','transfererlinkedid','exports','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled'];(function(_0x15da5f,_0x3fce0e){var _0x1992f1=function(_0x1bf2be){while(--_0x1bf2be){_0x15da5f['push'](_0x15da5f['shift']());}};_0x1992f1(++_0x3fce0e);}(_0x42b3,0x159));var _0x342b=function(_0x8e7772,_0x9d77b0){_0x8e7772=_0x8e7772-0x0;var _0x408200=_0x42b3[_0x8e7772];return _0x408200;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x342b('0x0'));var config=require('../../../config/environment');var ami=require(_0x342b('0x1'));var RpcVoiceAgentReport=require(_0x342b('0x2'));var RpcVoiceCallReport=require(_0x342b('0x3'));var RpcVoiceDialReport=require(_0x342b('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x342b('0x5'));var RpcVoiceRecording=require(_0x342b('0x6'));var RpcVoiceTransferReport=require(_0x342b('0x7'));var VoiceQueueReport=require(_0x342b('0x8'));var VoiceCallReport=require(_0x342b('0x9'));var VoiceAgentReport=require(_0x342b('0xa'));var VoiceDialReport=require(_0x342b('0xb'));var UserReport=require('./userReport');function Report(_0x11e42f){this[_0x342b('0xc')]=_0x11e42f;this[_0x342b('0xd')]=_0x11e42f[_0x342b('0xd')];this[_0x342b('0xe')]=_0x11e42f[_0x342b('0xe')];}Report[_0x342b('0xf')][_0x342b('0x10')]=function(_0x172715){var _0x3225b9=new VoiceQueueReport(this[_0x342b('0xc')]);var _0xff5a2f=new VoiceAgentReport(this[_0x342b('0xc')]);var _0x40a19c=new VoiceDialReport(this['realtime']);var _0x452137=new VoiceCallReport(this[_0x342b('0xc')]);var _0x354f49=new UserReport(this[_0x342b('0xc')]);if(config[_0x342b('0x11')]&&config[_0x342b('0x11')][_0x342b('0x12')]){ami['on']('custom:voiceQueueReport',this[_0x342b('0x13')][_0x342b('0x14')](this));ami['on']('custom:voiceCallReport',this[_0x342b('0x15')]['bind'](this));ami['on'](_0x342b('0x16'),this[_0x342b('0x17')][_0x342b('0x14')](this));ami['on'](_0x342b('0x18'),this['voiceDialReport'][_0x342b('0x14')](this));ami['on'](_0x342b('0x19'),this[_0x342b('0x1a')][_0x342b('0x14')](this));ami['on'](_0x342b('0x1b'),this[_0x342b('0x1c')][_0x342b('0x14')](this));}};Report[_0x342b('0xf')][_0x342b('0x1d')]=function(_0x3b6c0e){var _0x516ece;_0x516ece=_[_0x342b('0x1e')](this['agents'],function(_0x385ad6){return _0x385ad6[_0x342b('0x1f')]==_0x3b6c0e||_0x385ad6[_0x342b('0x20')]==_0x3b6c0e;});if(_[_0x342b('0x21')](_0x516ece)){var _0x47ae4a=_[_0x342b('0x1e')](this[_0x342b('0xe')],function(_0x173354){return _0x173354[_0x342b('0x1f')]==_0x3b6c0e||_0x173354['name']==_0x3b6c0e;});if(_0x47ae4a){_0x516ece=_[_0x342b('0x1e')](this[_0x342b('0xd')],function(_0x19512d){return _0x19512d[_0x342b('0x22')]==util[_0x342b('0x23')]('SIP/%s',_0x47ae4a[_0x342b('0x20')]);});}}return _0x516ece;};Report['prototype'][_0x342b('0x13')]=function(_0x481b1a){for(var _0x1fe25b=0x0;_0x1fe25b<_0x481b1a[_0x342b('0x24')];_0x1fe25b+=0x1){var _0x31ba15=this['findAgent'](_0x481b1a[_0x1fe25b][_0x342b('0x25')]);if(_0x31ba15){_0x481b1a[_0x1fe25b][_0x342b('0x1f')]=_0x31ba15[_0x342b('0x1f')];_0x481b1a[_0x1fe25b][_0x342b('0x26')]=!![];_0x481b1a[_0x1fe25b][_0x342b('0x27')]=_0x31ba15[_0x342b('0x20')];_0x481b1a[_0x1fe25b][_0x342b('0x22')]=_[_0x342b('0x21')](_0x31ba15[_0x342b('0x22')])?util[_0x342b('0x23')]('SIP/%s',_0x31ba15[_0x342b('0x20')]):_0x31ba15['interface'];if(_0x481b1a[_0x1fe25b][_0x342b('0x28')]){_0x481b1a[_0x1fe25b][_0x342b('0x29')]=moment()[_0x342b('0x23')](_0x342b('0x2a'));}if(_0x481b1a[_0x1fe25b][_0x342b('0x2b')]){_0x481b1a[_0x1fe25b][_0x342b('0x2c')]=moment()[_0x342b('0x23')](_0x342b('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x481b1a[_0x1fe25b]);}RpcVoiceQueueReport[_0x342b('0x2d')](_0x481b1a[_0x1fe25b]);}};function extractCalleridNumber(_0x4e2bb4){var _0x2eb700=_0x4e2bb4[_0x342b('0x2e')](/<(.*?)>/);return _0x2eb700?_0x2eb700[0x1]:_0x4e2bb4;}Report[_0x342b('0xf')][_0x342b('0x15')]=function(_0xf61b98){_0xf61b98[_0x342b('0x2f')]=_0xf61b98[_0x342b('0x2f')]||_0xf61b98[_0x342b('0x30')];if(_0xf61b98[_0x342b('0x31')]==_0x342b('0x32')){_0xf61b98[_0x342b('0x33')]=_0x342b('0x34');_0xf61b98[_0x342b('0x35')]=_0xf61b98['queue'];if(_0xf61b98[_0x342b('0x36')]==_0x342b('0x37')){_0xf61b98[_0x342b('0x1f')]='';_0xf61b98[_0x342b('0x2f')]=extractCalleridNumber(_0xf61b98[_0x342b('0x38')]);}else if(_0xf61b98['context']==_0x342b('0x39')){if(_0xf61b98[_0x342b('0x2f')]==_0x342b('0x3a')){_0xf61b98[_0x342b('0x2f')]=extractCalleridNumber(_0xf61b98[_0x342b('0x3b')]);_0xf61b98[_0x342b('0x3c')]=_0xf61b98[_0x342b('0x3d')];_0xf61b98[_0x342b('0x3e')]=[_0xf61b98[_0x342b('0x3f')],_0xf61b98[_0x342b('0x3f')]=_0xf61b98[_0x342b('0x3e')]][0x0];_0xf61b98[_0x342b('0x38')]=_0xf61b98[_0x342b('0x3b')];}else{_0xf61b98['destination']=_0xf61b98['calleridnum'];_0xf61b98[_0x342b('0x3c')]=_0xf61b98[_0x342b('0x3d')];if(_0xf61b98[_0x342b('0x40')]==_0x342b('0x41')){_0xf61b98[_0x342b('0x1f')]=_0xf61b98['connectedlinenum'];}else{_0xf61b98[_0x342b('0x1f')]='';}}}}else{_0xf61b98[_0x342b('0x38')]=util[_0x342b('0x23')](_0x342b('0x42'),_0xf61b98[_0x342b('0x43')],_0xf61b98['calleridnum']);}if(RpcVoiceTransferReport[_0x342b('0x44')][_0xf61b98[_0x342b('0x45')]]){var _0x40e8eb=RpcVoiceTransferReport[_0x342b('0x44')][_0xf61b98['linkedid']];_0x40e8eb[_0x342b('0x46')]=_0xf61b98[_0x342b('0x47')];RpcVoiceTransferReport['blindTransfer'](_0x40e8eb);delete RpcVoiceTransferReport[_0x342b('0x44')][_0xf61b98['linkedid']];}RpcVoiceCallReport[_0x342b('0x2d')](_0xf61b98);if(_0xf61b98[_0x342b('0x48')]){for(var _0x44a581=0x0;_0x44a581<_0xf61b98[_0x342b('0x49')][_0x342b('0x24')];_0x44a581+=0x1){_0xf61b98[_0x342b('0x4a')]=_0xf61b98[_0x342b('0x49')][_0x44a581][_0x342b('0x4b')];_0xf61b98['createdAt']=_0xf61b98[_0x342b('0x49')][_0x44a581]['createdAt'];if(_0xf61b98[_0x342b('0x30')]=='xcally-motion-preview'){_0xf61b98[_0x342b('0x3c')]=_0xf61b98['connectedlinenum'];_0xf61b98[_0x342b('0x43')]=_0xf61b98[_0x342b('0x4c')];_0xf61b98[_0x342b('0x25')]=_0xf61b98[_0x342b('0x1f')];_0xf61b98[_0x342b('0x4c')]=_0xf61b98['membername'];_0xf61b98['exten']=_0xf61b98[_0x342b('0x3d')];}else if(_0xf61b98[_0x342b('0x30')]==_0x342b('0x4d')){_0xf61b98[_0x342b('0x3c')]=_0xf61b98[_0x342b('0x2f')];_0xf61b98[_0x342b('0x30')]=_0xf61b98[_0x342b('0x3d')];}RpcVoiceRecording[_0x342b('0x2d')](_0xf61b98);}}};Report[_0x342b('0xf')]['voiceAgentReport']=function(_0x144447){if(_[_0x342b('0x4e')](_0x144447)){_0x144447[_0x342b('0x4f')](function(_0x5169bf){RpcVoiceAgentReport['create'](_0x5169bf);});}else{RpcVoiceAgentReport[_0x342b('0x2d')](_0x144447);}};Report[_0x342b('0xf')][_0x342b('0x50')]=function(_0xa3aa28){RpcVoiceDialReport[_0x342b('0x2d')](_0xa3aa28);var _0x1a364f;var _0x550b1d;var _0x23701e=_0xa3aa28['channel'];if(_[_0x342b('0x51')](_0x23701e,'Local')){_0x550b1d=_0x23701e[_0x342b('0x52')](_0x23701e[_0x342b('0x53')]('/')+0x1,_0x23701e[_0x342b('0x53')]('@'));_0x1a364f=_[_0x342b('0x1e')](this['agents'],function(_0x45d7a6){return _0x45d7a6[_0x342b('0x54')]==_0x550b1d||_0x45d7a6[_0x342b('0x55')]==_0x550b1d||_0x45d7a6[_0x342b('0x1f')]==_0x550b1d;});}else{_0x550b1d=_0x23701e[_0x342b('0x52')](_0x23701e['indexOf']('/')+0x1,_0x23701e[_0x342b('0x56')]('-'));_0x1a364f=this['findAgent'](_0x550b1d);}if(_0x1a364f){_0xa3aa28[_0x342b('0x22')]=_[_0x342b('0x21')](_0x1a364f[_0x342b('0x22')])?util[_0x342b('0x23')](_0x342b('0x57'),_0x1a364f['name']):_0x1a364f[_0x342b('0x22')];_0xa3aa28[_0x342b('0x58')]=_0x1a364f[_0x342b('0x20')];_0xa3aa28['accountcode']=_0x1a364f['accountcode'];RpcMemberReport[_0x342b('0x50')](_0xa3aa28);}};Report[_0x342b('0xf')][_0x342b('0x1a')]=function(_0xb65eff){RpcVoiceTransferReport[_0x342b('0x44')][_0xb65eff[_0x342b('0x59')]]=_0xb65eff;};Report[_0x342b('0xf')][_0x342b('0x1c')]=function(_0x2c9b27){RpcVoiceTransferReport[_0x342b('0x1c')](_0x2c9b27);};module[_0x342b('0x5a')]=Report; \ No newline at end of file +var _0xf748=['blindTransfer','create','monitor','monitors','monitorFilename','createdAt','connectedlinename','membername','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','lastIndexOf','attendedTransfer','exports','moment','util','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','attendedtransfer','prototype','findAgent','accountcode','name','find','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','isNil','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid'];(function(_0x41e15b,_0x39a90d){var _0x2b7868=function(_0x203d96){while(--_0x203d96){_0x41e15b['push'](_0x41e15b['shift']());}};_0x2b7868(++_0x39a90d);}(_0xf748,0x6b));var _0x8f74=function(_0xbc7f09,_0x3d9044){_0xbc7f09=_0xbc7f09-0x0;var _0x1d8134=_0xf748[_0xbc7f09];return _0x1d8134;};'use strict';var _=require('lodash');var moment=require(_0x8f74('0x0'));var util=require(_0x8f74('0x1'));var config=require('../../../config/environment');var ami=require(_0x8f74('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x8f74('0x3'));var RpcVoiceDialReport=require(_0x8f74('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x8f74('0x5'));var RpcVoiceRecording=require(_0x8f74('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x8f74('0x7'));var VoiceCallReport=require(_0x8f74('0x8'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x8f74('0x9'));var UserReport=require(_0x8f74('0xa'));function Report(_0xb3e693){this[_0x8f74('0xb')]=_0xb3e693;this[_0x8f74('0xc')]=_0xb3e693[_0x8f74('0xc')];this[_0x8f74('0xd')]=_0xb3e693['telephones'];}Report['prototype']['sync']=function(_0x3153b2){var _0x5e912d=new VoiceQueueReport(this[_0x8f74('0xb')]);var _0x120b91=new VoiceAgentReport(this[_0x8f74('0xb')]);var _0x1cc1b8=new VoiceDialReport(this[_0x8f74('0xb')]);var _0x4980d4=new VoiceCallReport(this[_0x8f74('0xb')]);var _0x35b4a3=new UserReport(this['realtime']);if(config[_0x8f74('0xe')]&&config['xdr'][_0x8f74('0xf')]){ami['on'](_0x8f74('0x10'),this[_0x8f74('0x11')][_0x8f74('0x12')](this));ami['on'](_0x8f74('0x13'),this[_0x8f74('0x14')]['bind'](this));ami['on'](_0x8f74('0x15'),this[_0x8f74('0x16')][_0x8f74('0x12')](this));ami['on'](_0x8f74('0x17'),this['voiceDialReport'][_0x8f74('0x12')](this));ami['on'](_0x8f74('0x18'),this['blindTransfer'][_0x8f74('0x12')](this));ami['on'](_0x8f74('0x19'),this['attendedTransfer'][_0x8f74('0x12')](this));}};Report[_0x8f74('0x1a')][_0x8f74('0x1b')]=function(_0x477de0){var _0x78a771;_0x78a771=_['find'](this['agents'],function(_0x19a431){return _0x19a431[_0x8f74('0x1c')]==_0x477de0||_0x19a431[_0x8f74('0x1d')]==_0x477de0;});if(_['isNil'](_0x78a771)){var _0x1ce5ec=_['find'](this[_0x8f74('0xd')],function(_0xa9e67c){return _0xa9e67c[_0x8f74('0x1c')]==_0x477de0||_0xa9e67c[_0x8f74('0x1d')]==_0x477de0;});if(_0x1ce5ec){_0x78a771=_[_0x8f74('0x1e')](this[_0x8f74('0xc')],function(_0x78e21a){return _0x78e21a['interface']==util[_0x8f74('0x1f')](_0x8f74('0x20'),_0x1ce5ec['name']);});}}return _0x78a771;};Report[_0x8f74('0x1a')][_0x8f74('0x11')]=function(_0xb714f7){for(var _0x5d1398=0x0;_0x5d1398<_0xb714f7[_0x8f74('0x21')];_0x5d1398+=0x1){var _0x564834=this[_0x8f74('0x1b')](_0xb714f7[_0x5d1398][_0x8f74('0x22')]);if(_0x564834){_0xb714f7[_0x5d1398][_0x8f74('0x1c')]=_0x564834['accountcode'];_0xb714f7[_0x5d1398][_0x8f74('0x23')]=!![];_0xb714f7[_0x5d1398][_0x8f74('0x24')]=_0x564834[_0x8f74('0x1d')];_0xb714f7[_0x5d1398]['interface']=_[_0x8f74('0x25')](_0x564834[_0x8f74('0x26')])?util[_0x8f74('0x1f')](_0x8f74('0x20'),_0x564834[_0x8f74('0x1d')]):_0x564834[_0x8f74('0x26')];if(_0xb714f7[_0x5d1398][_0x8f74('0x27')]){_0xb714f7[_0x5d1398][_0x8f74('0x28')]=moment()[_0x8f74('0x1f')](_0x8f74('0x29'));}if(_0xb714f7[_0x5d1398][_0x8f74('0x2a')]){_0xb714f7[_0x5d1398][_0x8f74('0x2b')]=moment()[_0x8f74('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x8f74('0x11')](_0xb714f7[_0x5d1398]);}RpcVoiceQueueReport['create'](_0xb714f7[_0x5d1398]);}};function extractCalleridNumber(_0x517085){var _0x350e34=_0x517085[_0x8f74('0x2c')](/<(.*?)>/);return _0x350e34?_0x350e34[0x1]:_0x517085;}Report['prototype']['voiceCallReport']=function(_0x584a28){_0x584a28[_0x8f74('0x2d')]=_0x584a28[_0x8f74('0x2d')]||_0x584a28[_0x8f74('0x2e')];if(_0x584a28[_0x8f74('0x2f')]=='dialer'){_0x584a28[_0x8f74('0x30')]=_0x8f74('0x31');_0x584a28[_0x8f74('0x32')]=_0x584a28[_0x8f74('0x31')];if(_0x584a28[_0x8f74('0x33')]==_0x8f74('0x34')){_0x584a28[_0x8f74('0x1c')]='';_0x584a28['destination']=extractCalleridNumber(_0x584a28[_0x8f74('0x35')]);}else if(_0x584a28['context']==_0x8f74('0x36')){if(_0x584a28[_0x8f74('0x2d')]==_0x8f74('0x37')){_0x584a28[_0x8f74('0x2d')]=extractCalleridNumber(_0x584a28['calleridpreview']);_0x584a28[_0x8f74('0x38')]=_0x584a28[_0x8f74('0x39')];_0x584a28[_0x8f74('0x3a')]=[_0x584a28[_0x8f74('0x3b')],_0x584a28[_0x8f74('0x3b')]=_0x584a28[_0x8f74('0x3a')]][0x0];_0x584a28[_0x8f74('0x35')]=_0x584a28[_0x8f74('0x3c')];}else{_0x584a28[_0x8f74('0x2d')]=_0x584a28[_0x8f74('0x38')];_0x584a28['calleridnum']=_0x584a28[_0x8f74('0x39')];if(_0x584a28[_0x8f74('0x3d')]==_0x8f74('0x3e')){_0x584a28[_0x8f74('0x1c')]=_0x584a28[_0x8f74('0x22')];}else{_0x584a28[_0x8f74('0x1c')]='';}}}}else{_0x584a28[_0x8f74('0x35')]=util[_0x8f74('0x1f')](_0x8f74('0x3f'),_0x584a28[_0x8f74('0x40')],_0x584a28[_0x8f74('0x38')]);}if(RpcVoiceTransferReport[_0x8f74('0x41')][_0x584a28[_0x8f74('0x42')]]){var _0x25e7ee=RpcVoiceTransferReport['transfers'][_0x584a28[_0x8f74('0x42')]];_0x25e7ee[_0x8f74('0x43')]=_0x584a28[_0x8f74('0x44')];RpcVoiceTransferReport[_0x8f74('0x45')](_0x25e7ee);delete RpcVoiceTransferReport['transfers'][_0x584a28['linkedid']];}RpcVoiceCallReport[_0x8f74('0x46')](_0x584a28);if(_0x584a28[_0x8f74('0x47')]){for(var _0x3b2218=0x0;_0x3b2218<_0x584a28[_0x8f74('0x48')][_0x8f74('0x21')];_0x3b2218+=0x1){_0x584a28[_0x8f74('0x49')]=_0x584a28[_0x8f74('0x48')][_0x3b2218]['filename'];_0x584a28['createdAt']=_0x584a28[_0x8f74('0x48')][_0x3b2218][_0x8f74('0x4a')];if(_0x584a28[_0x8f74('0x2e')]==_0x8f74('0x37')){_0x584a28[_0x8f74('0x38')]=_0x584a28['connectedlinenum'];_0x584a28[_0x8f74('0x40')]=_0x584a28[_0x8f74('0x4b')];_0x584a28[_0x8f74('0x22')]=_0x584a28[_0x8f74('0x1c')];_0x584a28[_0x8f74('0x4b')]=_0x584a28[_0x8f74('0x4c')];_0x584a28[_0x8f74('0x2e')]=_0x584a28['originatecalleridnum'];}else if(_0x584a28[_0x8f74('0x2e')]=='xcally-motion-dialer'){_0x584a28[_0x8f74('0x38')]=_0x584a28[_0x8f74('0x2d')];_0x584a28[_0x8f74('0x2e')]=_0x584a28[_0x8f74('0x39')];}RpcVoiceRecording[_0x8f74('0x46')](_0x584a28);}}};Report[_0x8f74('0x1a')]['voiceAgentReport']=function(_0x1d47cc){if(_[_0x8f74('0x4d')](_0x1d47cc)){_0x1d47cc[_0x8f74('0x4e')](function(_0x43ec8d){RpcVoiceAgentReport[_0x8f74('0x46')](_0x43ec8d);});}else{RpcVoiceAgentReport[_0x8f74('0x46')](_0x1d47cc);}};Report[_0x8f74('0x1a')][_0x8f74('0x4f')]=function(_0x7e6075){RpcVoiceDialReport[_0x8f74('0x46')](_0x7e6075);var _0x159dd1;var _0x471de1;var _0xa58a7a=_0x7e6075[_0x8f74('0x3b')];if(_[_0x8f74('0x50')](_0xa58a7a,_0x8f74('0x51'))){_0x471de1=_0xa58a7a[_0x8f74('0x52')](_0xa58a7a[_0x8f74('0x53')]('/')+0x1,_0xa58a7a[_0x8f74('0x53')]('@'));_0x159dd1=_[_0x8f74('0x1e')](this[_0x8f74('0xc')],function(_0x4cc127){return _0x4cc127[_0x8f74('0x54')]==_0x471de1||_0x4cc127['phone']==_0x471de1||_0x4cc127[_0x8f74('0x1c')]==_0x471de1;});}else{_0x471de1=_0xa58a7a[_0x8f74('0x52')](_0xa58a7a[_0x8f74('0x53')]('/')+0x1,_0xa58a7a[_0x8f74('0x55')]('-'));_0x159dd1=this[_0x8f74('0x1b')](_0x471de1);}if(_0x159dd1){_0x7e6075[_0x8f74('0x26')]=_[_0x8f74('0x25')](_0x159dd1[_0x8f74('0x26')])?util[_0x8f74('0x1f')](_0x8f74('0x20'),_0x159dd1[_0x8f74('0x1d')]):_0x159dd1[_0x8f74('0x26')];_0x7e6075[_0x8f74('0x4c')]=_0x159dd1['name'];_0x7e6075[_0x8f74('0x1c')]=_0x159dd1['accountcode'];RpcMemberReport[_0x8f74('0x4f')](_0x7e6075);}};Report[_0x8f74('0x1a')][_0x8f74('0x45')]=function(_0x8e685d){RpcVoiceTransferReport[_0x8f74('0x41')][_0x8e685d['transfererlinkedid']]=_0x8e685d;};Report['prototype'][_0x8f74('0x56')]=function(_0x37e12c){RpcVoiceTransferReport['attendedTransfer'](_0x37e12c);};module[_0x8f74('0x57')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index bf3d7d7..576e99f 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8867=['syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','[userReport][registry]','find','username','stateRegistry','event','actionid','state','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephones','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus'];(function(_0x37e2aa,_0x52adb8){var _0x3a1707=function(_0x7c141e){while(--_0x7c141e){_0x37e2aa['push'](_0x37e2aa['shift']());}};_0x3a1707(++_0x52adb8);}(_0x8867,0x11e));var _0x7886=function(_0x554e9e,_0xcb21e5){_0x554e9e=_0x554e9e-0x0;var _0x1ba47c=_0x8867[_0x554e9e];return _0x1ba47c;};'use strict';var _=require(_0x7886('0x0'));var moment=require(_0x7886('0x1'));var util=require(_0x7886('0x2'));var Redis=require(_0x7886('0x3'));var BPromise=require(_0x7886('0x4'));var config=require(_0x7886('0x5'));var logger=require('../../../config/logger')(_0x7886('0x6'));var ami=require(_0x7886('0x7'));config['redis']=_[_0x7886('0x8')](config[_0x7886('0x9')],{'host':_0x7886('0xa'),'port':0x18eb});var io=require(_0x7886('0xb'))(new Redis(config['redis']));function UserReport(_0x568876){this[_0x7886('0xc')]=_0x568876['trunks'];this[_0x7886('0xd')]=_0x568876[_0x7886('0xd')];this['telephones']=_0x568876['telephones'];ami['on'](_0x7886('0xe'),this[_0x7886('0xf')][_0x7886('0x10')](this));ami['on'](_0x7886('0x11'),this[_0x7886('0xf')][_0x7886('0x10')](this));ami['on'](_0x7886('0x12'),this[_0x7886('0x13')][_0x7886('0x10')](this));ami['on'](_0x7886('0x14'),this[_0x7886('0x15')][_0x7886('0x10')](this));return this[_0x7886('0x16')]();}function showSipRegistrations(){Promise[_0x7886('0x17')]()[_0x7886('0x18')](ami[_0x7886('0x19')]())[_0x7886('0x1a')](function(_0xfdf345){logger[_0x7886('0x1b')](_0x7886('0x1c'),util[_0x7886('0x1d')](_0xfdf345,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x7886('0x17')]()[_0x7886('0x18')](ami[_0x7886('0x1e')]())[_0x7886('0x1a')](function(_0x12ee0e){logger[_0x7886('0x1b')](_0x7886('0x1f'),util[_0x7886('0x1d')](_0x12ee0e,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami[_0x7886('0x20')]())[_0x7886('0x1a')](function(_0x55a097){logger['error']('[userReport][sippeerstatus]',util[_0x7886('0x1d')](_0x55a097,{'showHidden':![],'depth':null}));});}UserReport[_0x7886('0x21')][_0x7886('0x16')]=function(){setInterval(function(){BPromise[_0x7886('0x17')]()[_0x7886('0x18')](showSipRegistrations())[_0x7886('0x18')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x7886('0x22')]=function(_0x420e26){return _0x420e26!==null&&!_[_0x7886('0x23')](_0x420e26);};UserReport[_0x7886('0x21')]['emit']=function(_0x484245,_0x462506,_0x2605ee){io['to'](_0x484245)[_0x7886('0x24')](_0x462506,_0x2605ee);};UserReport[_0x7886('0x21')][_0x7886('0xf')]=function(_0x3f35f5){try{if(this['isNotNull'](_0x3f35f5)){logger[_0x7886('0x25')](_0x7886('0x26'),_0x3f35f5['username'],_0x3f35f5['state']);logger['debug'](_0x7886('0x27'),util[_0x7886('0x1d')](_0x3f35f5,{'showHidden':![],'depth':null}));var _0x1623c8=_[_0x7886('0x28')](this[_0x7886('0xc')],{'defaultuser':_0x3f35f5[_0x7886('0x29')]});if(_0x1623c8){_0x3f35f5[_0x7886('0x2a')]=_0x3f35f5['state'];_['merge'](_0x1623c8,_['omit'](_0x3f35f5,[_0x7886('0x2b'),_0x7886('0x2c'),_0x7886('0x29'),_0x7886('0x2d')]));logger[_0x7886('0x2e')](_0x7886('0x2f'),util['inspect'](_0x1623c8,{'showHidden':![],'depth':null}));this[_0x7886('0x24')](util[_0x7886('0x30')](_0x7886('0x31'),_0x1623c8[_0x7886('0x32')]),_0x7886('0x33'),_0x1623c8);}}}catch(_0x50007b){logger[_0x7886('0x1b')]('[userReport][registry]',util[_0x7886('0x1d')](_0x50007b,{'showHidden':![],'depth':null}));}};UserReport[_0x7886('0x21')][_0x7886('0x13')]=function(_0x3c7f55){try{if(this[_0x7886('0x22')](_0x3c7f55)){logger[_0x7886('0x25')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x3c7f55[_0x7886('0x34')],_0x3c7f55[_0x7886('0x2d')]);logger['debug']('[userReport][devicestatechange]',util[_0x7886('0x1d')](_0x3c7f55,{'showHidden':![],'depth':null}));if(this[_0x7886('0xd')][_0x3c7f55['device']]){if(!this['agents'][_0x3c7f55[_0x7886('0x34')]][_0x7886('0x35')]||_0x3c7f55[_0x7886('0x2d')][_0x7886('0x36')]()==_0x7886('0x37')){this['agents'][_0x3c7f55[_0x7886('0x34')]][_0x7886('0x35')]=![];if(this[_0x7886('0xd')][_0x3c7f55['device']][_0x7886('0x2d')]!==_0x3c7f55[_0x7886('0x2d')]['toLowerCase']()){this[_0x7886('0xd')][_0x3c7f55[_0x7886('0x34')]][_0x7886('0x38')]=_[_0x7886('0x39')](moment()[_0x7886('0x30')]('x'));}this[_0x7886('0xd')][_0x3c7f55[_0x7886('0x34')]][_0x7886('0x2d')]=_0x3c7f55[_0x7886('0x2d')][_0x7886('0x36')]();this[_0x7886('0xd')][_0x3c7f55['device']][_0x7886('0x3a')](_0x3c7f55);}}else if(this[_0x7886('0x3b')][_0x3c7f55[_0x7886('0x34')]]){if(this[_0x7886('0x3b')][_0x3c7f55[_0x7886('0x34')]][_0x7886('0x2d')]!==_0x3c7f55[_0x7886('0x2d')][_0x7886('0x36')]()){this[_0x7886('0x3b')][_0x3c7f55[_0x7886('0x34')]]['stateTime']=_[_0x7886('0x39')](moment()[_0x7886('0x30')]('x'));}this[_0x7886('0x3b')][_0x3c7f55[_0x7886('0x34')]][_0x7886('0x2d')]=_0x3c7f55['state'][_0x7886('0x36')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x7886('0x1d')](this[_0x7886('0x3b')][_0x3c7f55[_0x7886('0x34')]],{'showHidden':![],'depth':null}));this[_0x7886('0x24')](util[_0x7886('0x30')]('telephone:%s',this['telephones'][_0x3c7f55[_0x7886('0x34')]][_0x7886('0x32')]),'telephone:save',this[_0x7886('0x3b')][_0x3c7f55[_0x7886('0x34')]]);}else if(this[_0x7886('0xc')][_0x3c7f55[_0x7886('0x34')]]){if(this['trunks'][_0x3c7f55['device']]['state']!==_0x3c7f55[_0x7886('0x2d')]['toLowerCase']()){this[_0x7886('0xc')][_0x3c7f55['device']][_0x7886('0x38')]=_[_0x7886('0x39')](moment()[_0x7886('0x30')]('x'));}this[_0x7886('0xc')][_0x3c7f55['device']][_0x7886('0x2d')]=_0x3c7f55[_0x7886('0x2d')]['toLowerCase']();logger[_0x7886('0x2e')](_0x7886('0x3c'),util[_0x7886('0x1d')](this[_0x7886('0xc')][_0x3c7f55[_0x7886('0x34')]],{'showHidden':![],'depth':null}));this[_0x7886('0x24')](util[_0x7886('0x30')](_0x7886('0x31'),this[_0x7886('0xc')][_0x3c7f55[_0x7886('0x34')]][_0x7886('0x32')]),'trunk:save',this['trunks'][_0x3c7f55[_0x7886('0x34')]]);}else if(_['startsWith'](_0x3c7f55['device'],_0x7886('0x3d'))){var _0x519329=_0x3c7f55[_0x7886('0x34')];var _0x146efe=_0x519329[_0x7886('0x3e')](_0x519329['indexOf']('/')+0x1,_0x519329[_0x7886('0x3f')]('@'));var _0x3c999e=_['find'](this['agents'],function(_0x1f6224){return _0x1f6224[_0x7886('0x40')]==_0x146efe||_0x1f6224[_0x7886('0x41')]==_0x146efe||_0x1f6224[_0x7886('0x42')]==_0x146efe;});if(_0x3c999e){if(_0x3c999e[_0x7886('0x2d')]!==_0x3c7f55[_0x7886('0x2d')][_0x7886('0x36')]()){_0x3c999e[_0x7886('0x38')]=_[_0x7886('0x39')](moment()[_0x7886('0x30')]('x'));}_0x3c999e[_0x7886('0x2d')]=_0x3c7f55['state'][_0x7886('0x36')]();_0x3c999e[_0x7886('0x35')]=!![];_0x3c999e[_0x7886('0x3a')](_0x3c7f55);}}}}catch(_0x37747){logger[_0x7886('0x1b')](_0x7886('0x43'),util[_0x7886('0x1d')](_0x37747,{'showHidden':![],'depth':null}));}};UserReport[_0x7886('0x21')][_0x7886('0x15')]=function(_0x2fb454){try{if(this[_0x7886('0x22')](_0x2fb454)&&this[_0x7886('0x22')](_0x2fb454[_0x7886('0x14')])){logger['info'](_0x7886('0x44'),_0x2fb454[_0x7886('0x45')],_0x2fb454[_0x7886('0x46')],_0x2fb454['peerstatus']);logger[_0x7886('0x2e')](_0x7886('0x47'),util[_0x7886('0x1d')](_0x2fb454,{'showHidden':![],'depth':null}));if(this[_0x7886('0xd')][_0x2fb454[_0x7886('0x45')]]){if(!this[_0x7886('0xd')][_0x2fb454[_0x7886('0x45')]]['local']||_0x2fb454[_0x7886('0x14')][_0x7886('0x36')]()==_0x7886('0x48')){this['agents'][_0x2fb454['peer']]['local']=![];this['agents'][_0x2fb454[_0x7886('0x45')]][_0x7886('0x49')]=_0x2fb454[_0x7886('0x14')][_0x7886('0x36')]();this[_0x7886('0xd')][_0x2fb454[_0x7886('0x45')]][_0x7886('0x46')]=_0x2fb454['address'];this[_0x7886('0xd')][_0x2fb454['peer']][_0x7886('0x3a')](_0x2fb454);}}else if(this['telephones'][_0x2fb454[_0x7886('0x45')]]){this[_0x7886('0x3b')][_0x2fb454[_0x7886('0x45')]][_0x7886('0x49')]=_0x2fb454[_0x7886('0x14')]['toLowerCase']();this['telephones'][_0x2fb454['peer']][_0x7886('0x46')]=_0x2fb454[_0x7886('0x46')];logger['debug']('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x7886('0x1d')](this[_0x7886('0x3b')][_0x2fb454[_0x7886('0x45')]],{'showHidden':![],'depth':null}));this[_0x7886('0x24')](util[_0x7886('0x30')](_0x7886('0x4a'),this[_0x7886('0x3b')][_0x2fb454[_0x7886('0x45')]][_0x7886('0x32')]),'telephone:save',this['telephones'][_0x2fb454[_0x7886('0x45')]]);}else if(this['trunks'][_0x2fb454['peer']]){this[_0x7886('0xc')][_0x2fb454['peer']][_0x7886('0x49')]=_0x2fb454[_0x7886('0x14')]['toLowerCase']();this[_0x7886('0xc')][_0x2fb454[_0x7886('0x45')]]['address']=_0x2fb454[_0x7886('0x46')];logger[_0x7886('0x2e')](_0x7886('0x4b'),util[_0x7886('0x1d')](this['trunks'][_0x2fb454[_0x7886('0x45')]],{'showHidden':![],'depth':null}));this[_0x7886('0x24')](util[_0x7886('0x30')]('trunk:%s',this['trunks'][_0x2fb454[_0x7886('0x45')]][_0x7886('0x32')]),_0x7886('0x33'),this[_0x7886('0xc')][_0x2fb454[_0x7886('0x45')]]);}}}catch(_0x3baa59){logger['error'](_0x7886('0x47'),util[_0x7886('0x1d')](_0x3baa59,{'showHidden':![],'depth':null}));}};module[_0x7886('0x4c')]=UserReport; \ No newline at end of file +var _0x7d80=['peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','[userReport][devicestatelist]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','find','merge','omit','state','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','inuse','toLowerCase','stateTime','updateStatusRealtime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','exports','lodash','moment','util','ioredis','bluebird','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d80,0xc8));var _0x07d8=function(_0x417950,_0x114b76){_0x417950=_0x417950-0x0;var _0x1bf8ff=_0x7d80[_0x417950];return _0x1bf8ff;};'use strict';var _=require(_0x07d8('0x0'));var moment=require(_0x07d8('0x1'));var util=require(_0x07d8('0x2'));var Redis=require(_0x07d8('0x3'));var BPromise=require(_0x07d8('0x4'));var config=require('../../../config/environment');var logger=require(_0x07d8('0x5'))(_0x07d8('0x6'));var ami=require(_0x07d8('0x7'));config[_0x07d8('0x8')]=_['defaults'](config[_0x07d8('0x8')],{'host':_0x07d8('0x9'),'port':0x18eb});var io=require(_0x07d8('0xa'))(new Redis(config[_0x07d8('0x8')]));function UserReport(_0x21248b){this[_0x07d8('0xb')]=_0x21248b[_0x07d8('0xb')];this[_0x07d8('0xc')]=_0x21248b[_0x07d8('0xc')];this[_0x07d8('0xd')]=_0x21248b[_0x07d8('0xd')];ami['on']('registryentry',this[_0x07d8('0xe')][_0x07d8('0xf')](this));ami['on'](_0x07d8('0x10'),this[_0x07d8('0xe')]['bind'](this));ami['on'](_0x07d8('0x11'),this[_0x07d8('0x12')]['bind'](this));ami['on'](_0x07d8('0x13'),this[_0x07d8('0x14')][_0x07d8('0xf')](this));return this[_0x07d8('0x15')]();}function showSipRegistrations(){Promise[_0x07d8('0x16')]()[_0x07d8('0x17')](ami[_0x07d8('0x18')]())[_0x07d8('0x19')](function(_0x5456fc){logger[_0x07d8('0x1a')](_0x07d8('0x1b'),util[_0x07d8('0x1c')](_0x5456fc,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x07d8('0x16')]()[_0x07d8('0x17')](ami['actionDeviceStateList']())[_0x07d8('0x19')](function(_0x3fdc27){logger[_0x07d8('0x1a')](_0x07d8('0x1d'),util[_0x07d8('0x1c')](_0x3fdc27,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x07d8('0x16')]()[_0x07d8('0x17')](ami['actionSipPeerStatus']())[_0x07d8('0x19')](function(_0x195a94){logger[_0x07d8('0x1a')]('[userReport][sippeerstatus]',util[_0x07d8('0x1c')](_0x195a94,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x07d8('0x15')]=function(){setInterval(function(){BPromise[_0x07d8('0x16')]()[_0x07d8('0x17')](showSipRegistrations())[_0x07d8('0x17')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x07d8('0x1e')][_0x07d8('0x1f')]=function(_0x5872fd){return _0x5872fd!==null&&!_['isUndefined'](_0x5872fd);};UserReport['prototype']['emit']=function(_0x4058b0,_0x375791,_0x587a84){io['to'](_0x4058b0)[_0x07d8('0x20')](_0x375791,_0x587a84);};UserReport[_0x07d8('0x1e')][_0x07d8('0xe')]=function(_0x2e02b1){try{if(this[_0x07d8('0x1f')](_0x2e02b1)){logger[_0x07d8('0x21')](_0x07d8('0x22'),_0x2e02b1[_0x07d8('0x23')],_0x2e02b1['state']);logger[_0x07d8('0x24')](_0x07d8('0x25'),util[_0x07d8('0x1c')](_0x2e02b1,{'showHidden':![],'depth':null}));var _0x4cd3aa=_[_0x07d8('0x26')](this[_0x07d8('0xb')],{'defaultuser':_0x2e02b1['username']});if(_0x4cd3aa){_0x2e02b1['stateRegistry']=_0x2e02b1['state'];_[_0x07d8('0x27')](_0x4cd3aa,_[_0x07d8('0x28')](_0x2e02b1,['event','actionid','username',_0x07d8('0x29')]));logger[_0x07d8('0x24')](_0x07d8('0x2a'),util[_0x07d8('0x1c')](_0x4cd3aa,{'showHidden':![],'depth':null}));this['emit'](util[_0x07d8('0x2b')](_0x07d8('0x2c'),_0x4cd3aa[_0x07d8('0x2d')]),_0x07d8('0x2e'),_0x4cd3aa);}}}catch(_0x188256){logger[_0x07d8('0x1a')](_0x07d8('0x25'),util[_0x07d8('0x1c')](_0x188256,{'showHidden':![],'depth':null}));}};UserReport[_0x07d8('0x1e')][_0x07d8('0x12')]=function(_0x35e5ca){try{if(this['isNotNull'](_0x35e5ca)){logger[_0x07d8('0x21')](_0x07d8('0x2f'),_0x35e5ca[_0x07d8('0x30')],_0x35e5ca[_0x07d8('0x29')]);logger['debug'](_0x07d8('0x31'),util['inspect'](_0x35e5ca,{'showHidden':![],'depth':null}));if(this['agents'][_0x35e5ca[_0x07d8('0x30')]]){if(!this['agents'][_0x35e5ca[_0x07d8('0x30')]][_0x07d8('0x32')]||_0x35e5ca[_0x07d8('0x29')]['toLowerCase']()==_0x07d8('0x33')){this[_0x07d8('0xc')][_0x35e5ca[_0x07d8('0x30')]][_0x07d8('0x32')]=![];if(this[_0x07d8('0xc')][_0x35e5ca[_0x07d8('0x30')]][_0x07d8('0x29')]!==_0x35e5ca[_0x07d8('0x29')][_0x07d8('0x34')]()){this[_0x07d8('0xc')][_0x35e5ca[_0x07d8('0x30')]][_0x07d8('0x35')]=_['toNumber'](moment()[_0x07d8('0x2b')]('x'));}this['agents'][_0x35e5ca[_0x07d8('0x30')]][_0x07d8('0x29')]=_0x35e5ca['state'][_0x07d8('0x34')]();this[_0x07d8('0xc')][_0x35e5ca[_0x07d8('0x30')]][_0x07d8('0x36')](_0x35e5ca);}}else if(this['telephones'][_0x35e5ca[_0x07d8('0x30')]]){if(this[_0x07d8('0xd')][_0x35e5ca[_0x07d8('0x30')]][_0x07d8('0x29')]!==_0x35e5ca[_0x07d8('0x29')][_0x07d8('0x34')]()){this[_0x07d8('0xd')][_0x35e5ca[_0x07d8('0x30')]][_0x07d8('0x35')]=_[_0x07d8('0x37')](moment()['format']('x'));}this['telephones'][_0x35e5ca[_0x07d8('0x30')]][_0x07d8('0x29')]=_0x35e5ca[_0x07d8('0x29')][_0x07d8('0x34')]();logger[_0x07d8('0x24')](_0x07d8('0x38'),util[_0x07d8('0x1c')](this['telephones'][_0x35e5ca[_0x07d8('0x30')]],{'showHidden':![],'depth':null}));this[_0x07d8('0x20')](util[_0x07d8('0x2b')](_0x07d8('0x39'),this[_0x07d8('0xd')][_0x35e5ca[_0x07d8('0x30')]][_0x07d8('0x2d')]),'telephone:save',this[_0x07d8('0xd')][_0x35e5ca[_0x07d8('0x30')]]);}else if(this[_0x07d8('0xb')][_0x35e5ca[_0x07d8('0x30')]]){if(this[_0x07d8('0xb')][_0x35e5ca['device']][_0x07d8('0x29')]!==_0x35e5ca['state'][_0x07d8('0x34')]()){this[_0x07d8('0xb')][_0x35e5ca['device']]['stateTime']=_[_0x07d8('0x37')](moment()['format']('x'));}this[_0x07d8('0xb')][_0x35e5ca['device']][_0x07d8('0x29')]=_0x35e5ca[_0x07d8('0x29')]['toLowerCase']();logger[_0x07d8('0x24')](_0x07d8('0x3a'),util[_0x07d8('0x1c')](this[_0x07d8('0xb')][_0x35e5ca['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0x07d8('0x2b')](_0x07d8('0x2c'),this[_0x07d8('0xb')][_0x35e5ca['device']][_0x07d8('0x2d')]),_0x07d8('0x2e'),this[_0x07d8('0xb')][_0x35e5ca[_0x07d8('0x30')]]);}else if(_[_0x07d8('0x3b')](_0x35e5ca[_0x07d8('0x30')],_0x07d8('0x3c'))){var _0x3e85b9=_0x35e5ca['device'];var _0x1c570a=_0x3e85b9[_0x07d8('0x3d')](_0x3e85b9[_0x07d8('0x3e')]('/')+0x1,_0x3e85b9[_0x07d8('0x3e')]('@'));var _0x221c90=_['find'](this[_0x07d8('0xc')],function(_0x431cbd){return _0x431cbd[_0x07d8('0x3f')]==_0x1c570a||_0x431cbd['phone']==_0x1c570a||_0x431cbd[_0x07d8('0x40')]==_0x1c570a;});if(_0x221c90){if(_0x221c90[_0x07d8('0x29')]!==_0x35e5ca[_0x07d8('0x29')][_0x07d8('0x34')]()){_0x221c90['stateTime']=_[_0x07d8('0x37')](moment()[_0x07d8('0x2b')]('x'));}_0x221c90['state']=_0x35e5ca[_0x07d8('0x29')][_0x07d8('0x34')]();_0x221c90[_0x07d8('0x32')]=!![];_0x221c90[_0x07d8('0x36')](_0x35e5ca);}}}}catch(_0x44cc1c){logger[_0x07d8('0x1a')](_0x07d8('0x31'),util[_0x07d8('0x1c')](_0x44cc1c,{'showHidden':![],'depth':null}));}};UserReport[_0x07d8('0x1e')][_0x07d8('0x14')]=function(_0x3397b2){try{if(this[_0x07d8('0x1f')](_0x3397b2)&&this['isNotNull'](_0x3397b2['peerstatus'])){logger[_0x07d8('0x21')](_0x07d8('0x41'),_0x3397b2[_0x07d8('0x42')],_0x3397b2[_0x07d8('0x43')],_0x3397b2[_0x07d8('0x13')]);logger['debug']('[userReport][peerstatus]',util[_0x07d8('0x1c')](_0x3397b2,{'showHidden':![],'depth':null}));if(this[_0x07d8('0xc')][_0x3397b2['peer']]){if(!this[_0x07d8('0xc')][_0x3397b2['peer']]['local']||_0x3397b2[_0x07d8('0x13')][_0x07d8('0x34')]()==_0x07d8('0x44')){this[_0x07d8('0xc')][_0x3397b2[_0x07d8('0x42')]][_0x07d8('0x32')]=![];this[_0x07d8('0xc')][_0x3397b2[_0x07d8('0x42')]]['status']=_0x3397b2['peerstatus'][_0x07d8('0x34')]();this[_0x07d8('0xc')][_0x3397b2[_0x07d8('0x42')]][_0x07d8('0x43')]=_0x3397b2[_0x07d8('0x43')];this['agents'][_0x3397b2[_0x07d8('0x42')]]['updateStatusRealtime'](_0x3397b2);}}else if(this[_0x07d8('0xd')][_0x3397b2[_0x07d8('0x42')]]){this[_0x07d8('0xd')][_0x3397b2[_0x07d8('0x42')]][_0x07d8('0x45')]=_0x3397b2[_0x07d8('0x13')][_0x07d8('0x34')]();this[_0x07d8('0xd')][_0x3397b2['peer']][_0x07d8('0x43')]=_0x3397b2['address'];logger['debug'](_0x07d8('0x46'),util[_0x07d8('0x1c')](this[_0x07d8('0xd')][_0x3397b2[_0x07d8('0x42')]],{'showHidden':![],'depth':null}));this[_0x07d8('0x20')](util[_0x07d8('0x2b')]('telephone:%s',this[_0x07d8('0xd')][_0x3397b2[_0x07d8('0x42')]][_0x07d8('0x2d')]),_0x07d8('0x47'),this['telephones'][_0x3397b2[_0x07d8('0x42')]]);}else if(this[_0x07d8('0xb')][_0x3397b2[_0x07d8('0x42')]]){this['trunks'][_0x3397b2[_0x07d8('0x42')]][_0x07d8('0x45')]=_0x3397b2[_0x07d8('0x13')][_0x07d8('0x34')]();this[_0x07d8('0xb')][_0x3397b2[_0x07d8('0x42')]][_0x07d8('0x43')]=_0x3397b2[_0x07d8('0x43')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x07d8('0x1c')](this[_0x07d8('0xb')][_0x3397b2['peer']],{'showHidden':![],'depth':null}));this[_0x07d8('0x20')](util[_0x07d8('0x2b')](_0x07d8('0x2c'),this[_0x07d8('0xb')][_0x3397b2['peer']][_0x07d8('0x2d')]),'trunk:save',this['trunks'][_0x3397b2[_0x07d8('0x42')]]);}}}catch(_0x11332e){logger['error']('[userReport][peerstatus]',util[_0x07d8('0x1c')](_0x11332e,{'showHidden':![],'depth':null}));}};module[_0x07d8('0x48')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 71a2e0e..f983881 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4f2=['syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','syncAgentCalled','info','uniqueid','membername','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','merge','omit','event','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','routealias','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheremembername','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','transfer','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentconnect','syncAgentConnect','bind','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStop'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb4f2,0x196));var _0x2b4f=function(_0x28afba,_0x3c929d){_0x28afba=_0x28afba-0x0;var _0x48ca07=_0xb4f2[_0x28afba];return _0x48ca07;};'use strict';var _=require(_0x2b4f('0x0'));var moment=require('moment');var util=require(_0x2b4f('0x1'));var Redis=require(_0x2b4f('0x2'));var config=require(_0x2b4f('0x3'));var logger=require(_0x2b4f('0x4'))(_0x2b4f('0x5'));var ami=require(_0x2b4f('0x6'));config[_0x2b4f('0x7')]=_[_0x2b4f('0x8')](config[_0x2b4f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2b4f('0x9'))(new Redis(config[_0x2b4f('0x7')]));function VoiceAgentReport(_0x23d28d){this[_0x2b4f('0xa')]={};this[_0x2b4f('0xb')]=_0x23d28d['channels'];this[_0x2b4f('0xc')]=_0x23d28d[_0x2b4f('0xc')];this['agents']=_0x23d28d[_0x2b4f('0xd')];this[_0x2b4f('0xe')]={};ami['on']('agentcalled',this['syncAgentCalled']['bind'](this));ami['on'](_0x2b4f('0xf'),this[_0x2b4f('0x10')][_0x2b4f('0x11')](this));ami['on'](_0x2b4f('0x12'),this['syncAgentRingNoAnswer'][_0x2b4f('0x11')](this));ami['on'](_0x2b4f('0x13'),this[_0x2b4f('0x14')][_0x2b4f('0x11')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x2b4f('0x11')](this));ami['on'](_0x2b4f('0x15'),this['syncVarSet'][_0x2b4f('0x11')](this));ami['on'](_0x2b4f('0x16'),this[_0x2b4f('0x17')][_0x2b4f('0x11')](this));ami['on'](_0x2b4f('0x18'),this['syncMusicOnHoldStart'][_0x2b4f('0x11')](this));ami['on']('musiconholdstop',this[_0x2b4f('0x19')]['bind'](this));ami['on']('attendedtransfer',this[_0x2b4f('0x1a')][_0x2b4f('0x11')](this));ami['on'](_0x2b4f('0x1b'),this[_0x2b4f('0x1c')][_0x2b4f('0x11')](this));}VoiceAgentReport['prototype']['emit']=function(_0x49706f,_0x1ce743,_0xd03085){io['to'](_0x49706f)[_0x2b4f('0x1d')](_0x1ce743,_0xd03085);};VoiceAgentReport[_0x2b4f('0x1e')][_0x2b4f('0x1f')]=function(_0x41e3e5){return _0x41e3e5!==null&&!_[_0x2b4f('0x20')](_0x41e3e5);};VoiceAgentReport[_0x2b4f('0x1e')][_0x2b4f('0x21')]=function(_0x15c7ca){try{if(this['isNotNull'](_0x15c7ca)){logger[_0x2b4f('0x22')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x15c7ca[_0x2b4f('0x23')],_0x15c7ca[_0x2b4f('0x24')],_0x15c7ca['destuniqueid']);logger['debug'](_0x2b4f('0x25'),_0x15c7ca['uniqueid'],util[_0x2b4f('0x26')](_0x15c7ca,{'showHidden':![],'depth':null}));if(_[_0x2b4f('0x20')](this['channels'][_0x15c7ca[_0x2b4f('0x23')]])){this[_0x2b4f('0xa')][_0x15c7ca[_0x2b4f('0x23')]]={};}if(_[_0x2b4f('0x20')](this['channels'][_0x15c7ca['uniqueid']][_0x15c7ca['destuniqueid']])){this['channels'][_0x15c7ca[_0x2b4f('0x23')]][_0x15c7ca[_0x2b4f('0x27')]]={'agentcalledAt':moment()[_0x2b4f('0x28')](_0x2b4f('0x29')),'lastevent':_0x2b4f('0x2a'),'mandatoryDisposition':this[_0x2b4f('0xc')][_0x15c7ca[_0x2b4f('0x2b')]]?this[_0x2b4f('0xc')][_0x15c7ca[_0x2b4f('0x2b')]][_0x2b4f('0x2c')]||![]:![],'type':this[_0x2b4f('0xc')][_0x15c7ca[_0x2b4f('0x2b')]]?this[_0x2b4f('0xc')][_0x15c7ca[_0x2b4f('0x2b')]]['type']||_0x2b4f('0x2d'):'inbound','variables':this['variables'][_0x15c7ca[_0x2b4f('0x23')]],'motionChannel':'voice'};}_[_0x2b4f('0x2e')](this[_0x2b4f('0xa')][_0x15c7ca['uniqueid']][_0x15c7ca[_0x2b4f('0x27')]],_[_0x2b4f('0x2f')](_0x15c7ca,[_0x2b4f('0x30'),'privilege']));logger[_0x2b4f('0x31')](_0x2b4f('0x32'),_0x15c7ca['uniqueid'],util[_0x2b4f('0x26')](this[_0x2b4f('0xa')][_0x15c7ca[_0x2b4f('0x23')]][_0x15c7ca[_0x2b4f('0x27')]],{'showHidden':![],'depth':null}));ami[_0x2b4f('0x1d')]('custom:agentcalled',this[_0x2b4f('0xa')][_0x15c7ca[_0x2b4f('0x23')]][_0x15c7ca[_0x2b4f('0x27')]]);logger[_0x2b4f('0x31')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x15c7ca[_0x2b4f('0x23')],util[_0x2b4f('0x26')](this[_0x2b4f('0xa')][_0x15c7ca['uniqueid']][_0x15c7ca['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x2b4f('0x1d')](util[_0x2b4f('0x28')](_0x2b4f('0x33'),_0x15c7ca[_0x2b4f('0x24')]),_0x2b4f('0x34'),this[_0x2b4f('0xa')][_0x15c7ca[_0x2b4f('0x23')]][_0x15c7ca[_0x2b4f('0x27')]]);}}catch(_0x19c55f){logger[_0x2b4f('0x35')](_0x2b4f('0x36'),_0x15c7ca[_0x2b4f('0x23')],util['inspect'](_0x19c55f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2b4f('0x10')]=function(_0x45481){try{if(this[_0x2b4f('0x1f')](_0x45481)){if(this['channels'][_0x45481[_0x2b4f('0x23')]]){logger[_0x2b4f('0x31')](_0x2b4f('0x37'),_0x45481[_0x2b4f('0x23')],util[_0x2b4f('0x26')](_0x45481,{'showHidden':![],'depth':null}));for(var _0x593b74 in this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]]){if(this['channels'][_0x45481['uniqueid']][_0x2b4f('0x38')](_0x593b74)){if(_0x45481[_0x2b4f('0x27')]===_0x593b74){logger['info'](_0x2b4f('0x39'),_0x45481[_0x2b4f('0x23')],_0x45481[_0x2b4f('0x24')],_0x45481[_0x2b4f('0x27')]);this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x593b74][_0x2b4f('0x3a')]=moment()['format'](_0x2b4f('0x29'));this['channels'][_0x45481['uniqueid']][_0x593b74][_0x2b4f('0x3b')]=_0x45481['connectedlinename'];this['channels'][_0x45481[_0x2b4f('0x23')]][_0x593b74][_0x2b4f('0x3c')]=_0x45481[_0x2b4f('0x3c')];this['channels'][_0x45481[_0x2b4f('0x23')]][_0x593b74]['destchannelstate']=_0x45481[_0x2b4f('0x3d')];this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x593b74][_0x2b4f('0x3e')]=_0x45481[_0x2b4f('0x3e')];this['channels'][_0x45481[_0x2b4f('0x23')]][_0x593b74][_0x2b4f('0x3f')]=_0x45481[_0x2b4f('0x3f')];this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x593b74][_0x2b4f('0x40')]='connect';if(this[_0x2b4f('0xb')][this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x593b74][_0x2b4f('0x23')]]){var _0x3e3369=this[_0x2b4f('0xb')][this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x593b74][_0x2b4f('0x23')]][_0x2b4f('0x41')];this['channels'][_0x45481[_0x2b4f('0x23')]][_0x593b74]['routealias']=_0x3e3369;_0x45481['routealias']=_0x3e3369;}_[_0x2b4f('0x2e')](this[_0x2b4f('0xd')][_0x45481[_0x2b4f('0x42')]],_[_0x2b4f('0x43')](_0x45481,[_0x2b4f('0x2b'),_0x2b4f('0x44'),_0x2b4f('0x41')]));logger[_0x2b4f('0x31')](_0x2b4f('0x45'),_0x45481[_0x2b4f('0x23')],util[_0x2b4f('0x26')](this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x45481[_0x2b4f('0x27')]],{'showHidden':![],'depth':null}));ami['emit'](_0x2b4f('0x46'),this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x45481[_0x2b4f('0x27')]]);logger[_0x2b4f('0x31')](_0x2b4f('0x47'),_0x45481[_0x2b4f('0x23')],util[_0x2b4f('0x26')](this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x45481[_0x2b4f('0x27')]],{'showHidden':![],'depth':null}));this[_0x2b4f('0x1d')](util[_0x2b4f('0x28')](_0x2b4f('0x33'),_0x45481[_0x2b4f('0x24')]),_0x2b4f('0x48'),this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x45481[_0x2b4f('0x27')]]);}else if(!this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x593b74][_0x2b4f('0x12')]&&!this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x593b74][_0x2b4f('0x49')]){logger[_0x2b4f('0x22')](_0x2b4f('0x4a'),_0x45481[_0x2b4f('0x23')],this[_0x2b4f('0xa')][_0x45481['uniqueid']][_0x593b74][_0x2b4f('0x24')],_0x593b74);this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x593b74][_0x2b4f('0x12')]=!![];this[_0x2b4f('0xa')][_0x45481['uniqueid']][_0x593b74]['agentringnoanswerAt']=moment()['format'](_0x2b4f('0x29'));this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x593b74]['answeredelsewheredestinationuniqueid']=_0x45481[_0x2b4f('0x27')];this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x593b74][_0x2b4f('0x4b')]=_0x45481[_0x2b4f('0x24')];this['channels'][_0x45481[_0x2b4f('0x23')]][_0x593b74]['lastevent']='answered_elsewhere';this['channels'][_0x45481['uniqueid']][_0x593b74][_0x2b4f('0x4c')]='answered_elsewhere';logger[_0x2b4f('0x31')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x45481[_0x2b4f('0x23')],util[_0x2b4f('0x26')](this[_0x2b4f('0xa')][_0x45481[_0x2b4f('0x23')]][_0x593b74],{'showHidden':![],'depth':null}));ami['emit'](_0x2b4f('0x4d'),this['channels'][_0x45481[_0x2b4f('0x23')]][_0x593b74]);}}}}}}catch(_0x5e11f7){logger[_0x2b4f('0x35')](_0x2b4f('0x4e'),_0x45481[_0x2b4f('0x23')],util[_0x2b4f('0x26')](_0x5e11f7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x2623c0){try{if(this['isNotNull'](_0x2623c0)){logger['debug'](_0x2b4f('0x4f'),_0x2623c0[_0x2b4f('0x23')],util['inspect'](_0x2623c0,{'showHidden':![],'depth':null}));if(this[_0x2b4f('0xa')][_0x2623c0[_0x2b4f('0x23')]]&&this[_0x2b4f('0xa')][_0x2623c0[_0x2b4f('0x23')]][_0x2623c0[_0x2b4f('0x27')]]){logger[_0x2b4f('0x22')](_0x2b4f('0x50'),_0x2623c0[_0x2b4f('0x23')],_0x2623c0['membername'],_0x2623c0[_0x2b4f('0x27')]);this[_0x2b4f('0xa')][_0x2623c0[_0x2b4f('0x23')]][_0x2623c0[_0x2b4f('0x27')]][_0x2b4f('0x12')]=!![];this[_0x2b4f('0xa')][_0x2623c0[_0x2b4f('0x23')]][_0x2623c0[_0x2b4f('0x27')]][_0x2b4f('0x51')]=moment()['format'](_0x2b4f('0x29'));this[_0x2b4f('0xa')][_0x2623c0[_0x2b4f('0x23')]][_0x2623c0[_0x2b4f('0x27')]]['lastevent']=_0x2b4f('0x52');this[_0x2b4f('0xa')][_0x2623c0[_0x2b4f('0x23')]][_0x2623c0[_0x2b4f('0x27')]][_0x2b4f('0x4c')]=_0x2b4f('0x52');logger[_0x2b4f('0x31')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x2623c0[_0x2b4f('0x23')],util[_0x2b4f('0x26')](this[_0x2b4f('0xa')][_0x2623c0[_0x2b4f('0x23')]][_0x2623c0[_0x2b4f('0x27')]],{'showHidden':![],'depth':null}));ami[_0x2b4f('0x1d')](_0x2b4f('0x53'),this[_0x2b4f('0xa')][_0x2623c0['uniqueid']][_0x2623c0['destuniqueid']]);}}}catch(_0x1eed2a){logger[_0x2b4f('0x35')]('[%s][voiceAgentReport][agentringnoanswer]',_0x2623c0['uniqueid'],util[_0x2b4f('0x26')](_0x1eed2a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2b4f('0x1e')]['syncQueueCallerAbandon']=function(_0x2b309f){try{if(this[_0x2b4f('0x1f')](_0x2b309f)){logger[_0x2b4f('0x31')](_0x2b4f('0x54'),_0x2b309f[_0x2b4f('0x23')],util[_0x2b4f('0x26')](_0x2b309f,{'showHidden':![],'depth':null}));if(this['channels'][_0x2b309f['uniqueid']]){for(var _0x3292ee in this[_0x2b4f('0xa')][_0x2b309f[_0x2b4f('0x23')]]){if(this[_0x2b4f('0xa')][_0x2b309f[_0x2b4f('0x23')]]['hasOwnProperty'](_0x3292ee)&&!this['channels'][_0x2b309f[_0x2b4f('0x23')]][_0x3292ee][_0x2b4f('0x12')]&&!this[_0x2b4f('0xa')][_0x2b309f['uniqueid']][_0x3292ee][_0x2b4f('0x49')]){logger[_0x2b4f('0x22')](_0x2b4f('0x55'),_0x2b309f[_0x2b4f('0x23')],this[_0x2b4f('0xa')][_0x2b309f['uniqueid']][_0x3292ee][_0x2b4f('0x24')],_0x3292ee);this['channels'][_0x2b309f['uniqueid']][_0x3292ee][_0x2b4f('0x12')]=!![];this[_0x2b4f('0xa')][_0x2b309f[_0x2b4f('0x23')]][_0x3292ee][_0x2b4f('0x51')]=moment()[_0x2b4f('0x28')](_0x2b4f('0x29'));this['channels'][_0x2b309f[_0x2b4f('0x23')]][_0x3292ee][_0x2b4f('0x40')]=_0x2b4f('0x56');this['channels'][_0x2b309f['uniqueid']][_0x3292ee][_0x2b4f('0x4c')]=_0x2b4f('0x56');logger[_0x2b4f('0x31')](_0x2b4f('0x57'),_0x2b309f[_0x2b4f('0x23')],util[_0x2b4f('0x26')](this[_0x2b4f('0xa')][_0x2b309f[_0x2b4f('0x23')]][_0x3292ee],{'showHidden':![],'depth':null}));ami[_0x2b4f('0x1d')]('custom:agentqueuecallerabandon',this['channels'][_0x2b309f[_0x2b4f('0x23')]][_0x3292ee]);}}}}}catch(_0x1b53f9){logger[_0x2b4f('0x35')]('[%s][voiceAgentReport][queuecallerabandon]',_0x2b309f['uniqueid'],util[_0x2b4f('0x26')](_0x1b53f9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2b4f('0x58')]=function(_0x336a48){try{if(this[_0x2b4f('0x1f')](_0x336a48)){logger[_0x2b4f('0x31')](_0x2b4f('0x59'),_0x336a48[_0x2b4f('0x23')],util[_0x2b4f('0x26')](_0x336a48,{'showHidden':![],'depth':null}));if(this[_0x2b4f('0xa')][_0x336a48[_0x2b4f('0x23')]]){for(var _0x42cdc7 in this[_0x2b4f('0xa')][_0x336a48['uniqueid']]){if(this[_0x2b4f('0xa')][_0x336a48[_0x2b4f('0x23')]][_0x2b4f('0x38')](_0x42cdc7)){if(this[_0x2b4f('0xa')][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7][_0x2b4f('0x3a')]&&!this[_0x2b4f('0xa')][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7][_0x2b4f('0x49')]){logger[_0x2b4f('0x22')](_0x2b4f('0x5a'),_0x336a48[_0x2b4f('0x23')],this[_0x2b4f('0xa')][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7][_0x2b4f('0x24')],_0x42cdc7);this['channels'][_0x336a48['uniqueid']][_0x42cdc7][_0x2b4f('0x49')]=!![];this['channels'][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7][_0x2b4f('0x5b')]=moment()[_0x2b4f('0x28')](_0x2b4f('0x29'));this[_0x2b4f('0xa')][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7]['lastevent']=_0x2b4f('0x5c');this['channels'][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7][_0x2b4f('0x4c')]=_0x336a48[_0x2b4f('0x4c')]=='transfer'?_0x2b4f('0x5d'):_0x336a48[_0x2b4f('0x4c')];this[_0x2b4f('0xa')][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7][_0x2b4f('0x5e')]=_0x336a48['talktime'];if(this[_0x2b4f('0xc')][_0x336a48[_0x2b4f('0x2b')]]&&this[_0x2b4f('0xc')][_0x336a48['queue']]['acw']){this['channels'][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7][_0x2b4f('0x5f')]=this[_0x2b4f('0xc')][_0x336a48[_0x2b4f('0x2b')]][_0x2b4f('0x60')];this[_0x2b4f('0xa')][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7][_0x2b4f('0x61')]=!![];}this['agents'][_0x336a48[_0x2b4f('0x42')]]=_[_0x2b4f('0x2f')](this[_0x2b4f('0xd')][_0x336a48['interface']],[_0x2b4f('0x2b'),'destconnectedlinenum']);logger['debug'](_0x2b4f('0x62'),_0x336a48[_0x2b4f('0x23')],util[_0x2b4f('0x26')](this['channels'][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7],{'showHidden':![],'depth':null}));ami['emit'](_0x2b4f('0x63'),this['channels'][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x336a48[_0x2b4f('0x23')],util['inspect'](this[_0x2b4f('0xa')][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7],{'showHidden':![],'depth':null}));this[_0x2b4f('0x1d')](util[_0x2b4f('0x28')]('user:%s',_0x336a48['membername']),'user:agentcomplete',this[_0x2b4f('0xa')][_0x336a48[_0x2b4f('0x23')]][_0x42cdc7]);}}}}}}catch(_0x40f87b){logger['error']('[%s][voiceAgentReport][agentcomplete]',_0x336a48[_0x2b4f('0x23')],util[_0x2b4f('0x26')](_0x40f87b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2b4f('0x1e')][_0x2b4f('0x64')]=function(_0x53570d){try{if(this['isNotNull'](_0x53570d)){logger['debug'](_0x2b4f('0x65'),_0x53570d[_0x2b4f('0x23')],util[_0x2b4f('0x26')](_0x53570d,{'showHidden':![],'depth':null}));this[_0x2b4f('0x66')](_0x53570d['uniqueid'],_[_0x2b4f('0x67')](_0x53570d[_0x2b4f('0x68')])[0x0],_0x53570d[_0x2b4f('0x69')]);if(this[_0x2b4f('0xa')][_0x53570d[_0x2b4f('0x23')]]){for(var _0x5cead4 in this[_0x2b4f('0xa')][_0x53570d[_0x2b4f('0x23')]]){if(this['channels'][_0x53570d[_0x2b4f('0x23')]][_0x2b4f('0x38')](_0x5cead4)){logger[_0x2b4f('0x22')](_0x2b4f('0x6a'),_0x53570d['uniqueid'],_0x5cead4,_[_0x2b4f('0x67')](_0x53570d['variable'])[0x0],_0x53570d[_0x2b4f('0x69')]);if(_['isUndefined'](this[_0x2b4f('0xa')][_0x53570d[_0x2b4f('0x23')]][_0x5cead4][_0x2b4f('0xe')])){this['channels'][_0x53570d['uniqueid']][_0x5cead4][_0x2b4f('0xe')]={};}this['channels'][_0x53570d[_0x2b4f('0x23')]][_0x5cead4]['variables']=this[_0x2b4f('0xe')][_0x53570d[_0x2b4f('0x23')]];}}}}}catch(_0x1b516c){logger['error'](_0x2b4f('0x6b'),_0x53570d[_0x2b4f('0x23')],util[_0x2b4f('0x26')](_0x1b516c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2b4f('0x1e')][_0x2b4f('0x66')]=function(_0x47b1b3,_0x47b753,_0x5b858a){var _0x5c691d=['rtpaudioqos',_0x2b4f('0x6c'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x2b4f('0x6d'),_0x2b4f('0x6e'),_0x2b4f('0x6f'),_0x2b4f('0x70'),_0x2b4f('0x71'),_0x2b4f('0x72'),_0x2b4f('0x73'),'bridgepvtcallid','membercalls',_0x2b4f('0x74'),_0x2b4f('0x75'),'memberlastcall',_0x2b4f('0x24'),_0x2b4f('0x76'),_0x2b4f('0x77')];if(!_[_0x2b4f('0x78')](_0x47b753)&&!_['includes'](_0x5c691d,_0x47b753)){if(_[_0x2b4f('0x20')](this['variables'][_0x47b1b3])){this[_0x2b4f('0xe')][_0x47b1b3]={};}this['variables'][_0x47b1b3][_0x47b753]=_0x5b858a;}};VoiceAgentReport[_0x2b4f('0x1e')][_0x2b4f('0x17')]=function(_0x2469da){try{if(this[_0x2b4f('0x1f')](_0x2469da)){logger['debug'](_0x2b4f('0x79'),_0x2469da['uniqueid'],util[_0x2b4f('0x26')](_0x2469da,{'showHidden':![],'depth':null}));if(this[_0x2b4f('0xa')][_0x2469da[_0x2b4f('0x23')]]){for(var _0x386e93 in this['channels'][_0x2469da[_0x2b4f('0x23')]]){if(this[_0x2b4f('0xa')][_0x2469da[_0x2b4f('0x23')]][_0x2b4f('0x38')](_0x386e93)){if(this[_0x2b4f('0xa')][_0x2469da[_0x2b4f('0x23')]][_0x386e93][_0x2b4f('0x4c')]==_0x2b4f('0x7a')&&this[_0x2b4f('0xa')][_0x2469da['uniqueid']][_0x386e93][_0x2b4f('0x49')]){logger[_0x2b4f('0x22')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x2469da['uniqueid'],_0x386e93);this[_0x2b4f('0xa')][_0x2469da[_0x2b4f('0x23')]][_0x386e93][_0x2b4f('0x5b')]=moment()[_0x2b4f('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x2b4f('0x31')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x2469da['uniqueid'],util['inspect'](_[_0x2b4f('0x7b')](this[_0x2b4f('0xa')][_0x2469da[_0x2b4f('0x23')]]),{'showHidden':![],'depth':null}));ami[_0x2b4f('0x1d')](_0x2b4f('0x7c'),_[_0x2b4f('0x7b')](this[_0x2b4f('0xa')][_0x2469da[_0x2b4f('0x23')]]));delete this[_0x2b4f('0xa')][_0x2469da[_0x2b4f('0x23')]];}if(this[_0x2b4f('0xe')][_0x2469da[_0x2b4f('0x23')]]){delete this[_0x2b4f('0xe')][_0x2469da[_0x2b4f('0x23')]];}}}catch(_0x49e628){logger[_0x2b4f('0x35')](_0x2b4f('0x7d'),_0x2469da[_0x2b4f('0x23')],util[_0x2b4f('0x26')](_0x49e628,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAttendedTransfer']=function(_0x4764ed){try{if(this[_0x2b4f('0x1f')](_0x4764ed)){logger[_0x2b4f('0x31')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x4764ed[_0x2b4f('0x23')],util['inspect'](_0x4764ed,{'showHidden':![],'depth':null}));if(this[_0x2b4f('0xa')][_0x4764ed[_0x2b4f('0x7e')]]){for(var _0x5da8fe in this[_0x2b4f('0xa')][_0x4764ed[_0x2b4f('0x7e')]]){if(this[_0x2b4f('0xa')][_0x4764ed[_0x2b4f('0x7e')]][_0x2b4f('0x38')](_0x5da8fe)){if(_0x4764ed['origtransfereruniqueid']===_0x5da8fe){logger[_0x2b4f('0x22')](_0x2b4f('0x7f'),_0x4764ed[_0x2b4f('0x23')],this[_0x2b4f('0xa')][_0x4764ed[_0x2b4f('0x7e')]][_0x5da8fe][_0x2b4f('0x24')],_0x5da8fe);var _0x2d9b4c=moment();this[_0x2b4f('0xa')][_0x4764ed[_0x2b4f('0x7e')]][_0x5da8fe]['agentcomplete']=!![];this[_0x2b4f('0xa')][_0x4764ed['transfereeuniqueid']][_0x5da8fe][_0x2b4f('0x5b')]=moment()[_0x2b4f('0x28')](_0x2b4f('0x29'));this[_0x2b4f('0xa')][_0x4764ed[_0x2b4f('0x7e')]][_0x5da8fe][_0x2b4f('0x40')]=_0x2b4f('0x5c');this[_0x2b4f('0xa')][_0x4764ed[_0x2b4f('0x7e')]][_0x5da8fe][_0x2b4f('0x4c')]='transfer';this[_0x2b4f('0xa')][_0x4764ed['transfereeuniqueid']][_0x5da8fe]['talktime']=_0x2d9b4c[_0x2b4f('0x80')](this[_0x2b4f('0xa')][_0x4764ed[_0x2b4f('0x7e')]][_0x5da8fe][_0x2b4f('0x3a')],_0x2b4f('0x81'));}}}}if(this['channels'][_0x4764ed[_0x2b4f('0x82')]]){var _0x5b095f=this[_0x2b4f('0xa')][_0x4764ed[_0x2b4f('0x82')]];this['channels'][_0x4764ed[_0x2b4f('0x82')]]=this[_0x2b4f('0xa')][_0x4764ed['transfereeuniqueid']];this[_0x2b4f('0xa')][_0x4764ed[_0x2b4f('0x7e')]]=_0x5b095f;}}}catch(_0x57c1fe){logger[_0x2b4f('0x35')]('[%s][voiceAgentReport][attendedtransfer]',_0x4764ed[_0x2b4f('0x23')],util['inspect'](_0x57c1fe,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2b4f('0x1e')][_0x2b4f('0x1c')]=function(_0x3702f1){try{if(this[_0x2b4f('0x1f')](_0x3702f1)){logger[_0x2b4f('0x31')](_0x2b4f('0x83'),_0x3702f1[_0x2b4f('0x23')],util[_0x2b4f('0x26')](_0x3702f1,{'showHidden':![],'depth':null}));if(this[_0x2b4f('0xa')][_0x3702f1['transfereeuniqueid']]){for(var _0x43659d in this[_0x2b4f('0xa')][_0x3702f1['transfereeuniqueid']]){if(this[_0x2b4f('0xa')][_0x3702f1[_0x2b4f('0x7e')]][_0x2b4f('0x38')](_0x43659d)){if(_0x3702f1['transfereruniqueid']===_0x43659d){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3702f1[_0x2b4f('0x23')],this[_0x2b4f('0xa')][_0x3702f1[_0x2b4f('0x7e')]][_0x43659d][_0x2b4f('0x24')],_0x43659d);var _0x455498=moment();this[_0x2b4f('0xa')][_0x3702f1[_0x2b4f('0x7e')]][_0x43659d]['agentcomplete']=!![];this[_0x2b4f('0xa')][_0x3702f1[_0x2b4f('0x7e')]][_0x43659d][_0x2b4f('0x5b')]=_0x455498;this[_0x2b4f('0xa')][_0x3702f1[_0x2b4f('0x7e')]][_0x43659d][_0x2b4f('0x40')]=_0x2b4f('0x5c');this[_0x2b4f('0xa')][_0x3702f1['transfereeuniqueid']][_0x43659d]['reason']='transfer';this[_0x2b4f('0xa')][_0x3702f1[_0x2b4f('0x7e')]][_0x43659d]['talktime']=_0x455498[_0x2b4f('0x80')](this[_0x2b4f('0xa')][_0x3702f1['transfereeuniqueid']][_0x43659d][_0x2b4f('0x3a')],_0x2b4f('0x81'));}}}}}}catch(_0xfadff8){logger['error'](_0x2b4f('0x84'),_0x3702f1[_0x2b4f('0x23')],util['inspect'](_0xfadff8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2b4f('0x1e')]['syncMusicOnHoldStart']=function(_0x204e4c){var _0x423d72='';try{if(this[_0x2b4f('0x1f')](_0x204e4c)){logger[_0x2b4f('0x31')](_0x2b4f('0x85'),_0x204e4c[_0x2b4f('0x23')],util[_0x2b4f('0x26')](_0x204e4c,{'showHidden':![],'depth':null}));if(_0x204e4c[_0x2b4f('0x86')]){_0x423d72=_0x204e4c[_0x2b4f('0x86')][_0x2b4f('0x87')](0x0,_0x204e4c[_0x2b4f('0x86')][_0x2b4f('0x88')]('-'));if(this['agents'][_0x423d72]){logger['info'](_0x2b4f('0x89'),_0x204e4c[_0x2b4f('0x23')],_0x423d72);this[_0x2b4f('0xd')][_0x423d72][_0x2b4f('0x8a')]=!![];}}}}catch(_0x59405f){logger[_0x2b4f('0x35')](_0x2b4f('0x8b'),_0x204e4c[_0x2b4f('0x23')],util[_0x2b4f('0x26')](_0x59405f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2b4f('0x1e')][_0x2b4f('0x19')]=function(_0x5fdd8a){var _0x4ea62e='';try{if(this['isNotNull'](_0x5fdd8a)){logger[_0x2b4f('0x31')](_0x2b4f('0x8c'),_0x5fdd8a[_0x2b4f('0x23')],util[_0x2b4f('0x26')](_0x5fdd8a,{'showHidden':![],'depth':null}));if(_0x5fdd8a[_0x2b4f('0x86')]){_0x4ea62e=_0x5fdd8a[_0x2b4f('0x86')]['substring'](0x0,_0x5fdd8a[_0x2b4f('0x86')]['lastIndexOf']('-'));if(this[_0x2b4f('0xd')][_0x4ea62e]){logger['info'](_0x2b4f('0x8d'),_0x5fdd8a[_0x2b4f('0x23')],_0x4ea62e);this[_0x2b4f('0xd')][_0x4ea62e][_0x2b4f('0x8a')]=![];}}}}catch(_0x24a820){logger[_0x2b4f('0x35')](_0x2b4f('0x8e'),_0x5fdd8a['uniqueid'],util[_0x2b4f('0x26')](_0x24a820,{'showHidden':![],'depth':null}));}};module[_0x2b4f('0x8f')]=VoiceAgentReport; \ No newline at end of file +var _0xe3a2=['transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','util','ioredis','ami','redis','defaults','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','isNotNull','isUndefined','prototype','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','voice','merge','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','emit','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','keys','variable','value','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe3a2,0x1de));var _0x2e3a=function(_0x57913b,_0x41bb78){_0x57913b=_0x57913b-0x0;var _0x5ce491=_0xe3a2[_0x57913b];return _0x5ce491;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x2e3a('0x0'));var Redis=require(_0x2e3a('0x1'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x2e3a('0x2'));var ami=require('../ami');config[_0x2e3a('0x3')]=_[_0x2e3a('0x4')](config[_0x2e3a('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x2e3a('0x5'))(new Redis(config[_0x2e3a('0x3')]));function VoiceAgentReport(_0xf1ac6e){this[_0x2e3a('0x6')]={};this[_0x2e3a('0x7')]=_0xf1ac6e[_0x2e3a('0x6')];this[_0x2e3a('0x8')]=_0xf1ac6e[_0x2e3a('0x8')];this[_0x2e3a('0x9')]=_0xf1ac6e[_0x2e3a('0x9')];this[_0x2e3a('0xa')]={};ami['on'](_0x2e3a('0xb'),this['syncAgentCalled'][_0x2e3a('0xc')](this));ami['on'](_0x2e3a('0xd'),this[_0x2e3a('0xe')][_0x2e3a('0xc')](this));ami['on']('agentringnoanswer',this[_0x2e3a('0xf')][_0x2e3a('0xc')](this));ami['on'](_0x2e3a('0x10'),this[_0x2e3a('0x11')][_0x2e3a('0xc')](this));ami['on'](_0x2e3a('0x12'),this['syncAgentComplete'][_0x2e3a('0xc')](this));ami['on'](_0x2e3a('0x13'),this[_0x2e3a('0x14')]['bind'](this));ami['on'](_0x2e3a('0x15'),this[_0x2e3a('0x16')][_0x2e3a('0xc')](this));ami['on'](_0x2e3a('0x17'),this[_0x2e3a('0x18')][_0x2e3a('0xc')](this));ami['on']('musiconholdstop',this[_0x2e3a('0x19')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x2e3a('0xc')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x2e3a('0xc')](this));}VoiceAgentReport['prototype']['emit']=function(_0xd1a57a,_0x23ab2d,_0xbd4989){io['to'](_0xd1a57a)['emit'](_0x23ab2d,_0xbd4989);};VoiceAgentReport['prototype'][_0x2e3a('0x1a')]=function(_0x3c1a17){return _0x3c1a17!==null&&!_[_0x2e3a('0x1b')](_0x3c1a17);};VoiceAgentReport[_0x2e3a('0x1c')][_0x2e3a('0x1d')]=function(_0x4fddaf){try{if(this[_0x2e3a('0x1a')](_0x4fddaf)){logger[_0x2e3a('0x1e')](_0x2e3a('0x1f'),_0x4fddaf[_0x2e3a('0x20')],_0x4fddaf[_0x2e3a('0x21')],_0x4fddaf['destuniqueid']);logger[_0x2e3a('0x22')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x4fddaf[_0x2e3a('0x20')],util['inspect'](_0x4fddaf,{'showHidden':![],'depth':null}));if(_[_0x2e3a('0x1b')](this[_0x2e3a('0x6')][_0x4fddaf[_0x2e3a('0x20')]])){this['channels'][_0x4fddaf['uniqueid']]={};}if(_[_0x2e3a('0x1b')](this[_0x2e3a('0x6')][_0x4fddaf[_0x2e3a('0x20')]][_0x4fddaf[_0x2e3a('0x23')]])){this['channels'][_0x4fddaf[_0x2e3a('0x20')]][_0x4fddaf[_0x2e3a('0x23')]]={'agentcalledAt':moment()[_0x2e3a('0x24')](_0x2e3a('0x25')),'lastevent':_0x2e3a('0x26'),'mandatoryDisposition':this[_0x2e3a('0x8')][_0x4fddaf[_0x2e3a('0x27')]]?this[_0x2e3a('0x8')][_0x4fddaf[_0x2e3a('0x27')]][_0x2e3a('0x28')]||![]:![],'type':this[_0x2e3a('0x8')][_0x4fddaf['queue']]?this[_0x2e3a('0x8')][_0x4fddaf[_0x2e3a('0x27')]][_0x2e3a('0x29')]||'inbound':_0x2e3a('0x2a'),'variables':this['variables'][_0x4fddaf[_0x2e3a('0x20')]],'motionChannel':_0x2e3a('0x2b')};}_[_0x2e3a('0x2c')](this[_0x2e3a('0x6')][_0x4fddaf[_0x2e3a('0x20')]][_0x4fddaf[_0x2e3a('0x23')]],_['omit'](_0x4fddaf,['event',_0x2e3a('0x2d')]));logger[_0x2e3a('0x22')](_0x2e3a('0x2e'),_0x4fddaf['uniqueid'],util[_0x2e3a('0x2f')](this['channels'][_0x4fddaf[_0x2e3a('0x20')]][_0x4fddaf[_0x2e3a('0x23')]],{'showHidden':![],'depth':null}));ami[_0x2e3a('0x30')]('custom:agentcalled',this['channels'][_0x4fddaf[_0x2e3a('0x20')]][_0x4fddaf[_0x2e3a('0x23')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x4fddaf['uniqueid'],util[_0x2e3a('0x2f')](this['channels'][_0x4fddaf['uniqueid']][_0x4fddaf[_0x2e3a('0x23')]],{'showHidden':![],'depth':null}));this[_0x2e3a('0x30')](util['format'](_0x2e3a('0x31'),_0x4fddaf['membername']),_0x2e3a('0x32'),this[_0x2e3a('0x6')][_0x4fddaf[_0x2e3a('0x20')]][_0x4fddaf[_0x2e3a('0x23')]]);}}catch(_0x14e5b7){logger[_0x2e3a('0x33')](_0x2e3a('0x34'),_0x4fddaf[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_0x14e5b7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2e3a('0x1c')][_0x2e3a('0xe')]=function(_0x25e73d){try{if(this[_0x2e3a('0x1a')](_0x25e73d)){if(this['channels'][_0x25e73d[_0x2e3a('0x20')]]){logger[_0x2e3a('0x22')](_0x2e3a('0x35'),_0x25e73d[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_0x25e73d,{'showHidden':![],'depth':null}));for(var _0x39e9a0 in this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]]){if(this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x2e3a('0x36')](_0x39e9a0)){if(_0x25e73d[_0x2e3a('0x23')]===_0x39e9a0){logger[_0x2e3a('0x1e')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x25e73d[_0x2e3a('0x20')],_0x25e73d[_0x2e3a('0x21')],_0x25e73d[_0x2e3a('0x23')]);this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x37')]=moment()[_0x2e3a('0x24')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0]['connectedlinename']=_0x25e73d[_0x2e3a('0x38')];this['channels'][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x39')]=_0x25e73d['connectedlinenum'];this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x3a')]=_0x25e73d[_0x2e3a('0x3a')];this[_0x2e3a('0x6')][_0x25e73d['uniqueid']][_0x39e9a0][_0x2e3a('0x3b')]=_0x25e73d[_0x2e3a('0x3b')];this['channels'][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x3c')]=_0x25e73d[_0x2e3a('0x3c')];this[_0x2e3a('0x6')][_0x25e73d['uniqueid']][_0x39e9a0][_0x2e3a('0x3d')]=_0x2e3a('0x3e');if(this[_0x2e3a('0x7')][this['channels'][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x20')]]){var _0x1ed196=this[_0x2e3a('0x7')][this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x20')]][_0x2e3a('0x3f')];this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x3f')]=_0x1ed196;_0x25e73d[_0x2e3a('0x3f')]=_0x1ed196;}_[_0x2e3a('0x2c')](this[_0x2e3a('0x9')][_0x25e73d[_0x2e3a('0x40')]],_['pick'](_0x25e73d,[_0x2e3a('0x27'),_0x2e3a('0x41'),_0x2e3a('0x3f')]));logger[_0x2e3a('0x22')](_0x2e3a('0x42'),_0x25e73d[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](this['channels'][_0x25e73d['uniqueid']][_0x25e73d['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x2e3a('0x43'),this[_0x2e3a('0x6')][_0x25e73d['uniqueid']][_0x25e73d[_0x2e3a('0x23')]]);logger[_0x2e3a('0x22')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x25e73d['uniqueid'],util[_0x2e3a('0x2f')](this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x25e73d[_0x2e3a('0x23')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x2e3a('0x24')](_0x2e3a('0x31'),_0x25e73d[_0x2e3a('0x21')]),_0x2e3a('0x44'),this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x25e73d[_0x2e3a('0x23')]]);}else if(!this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x45')]&&!this[_0x2e3a('0x6')][_0x25e73d['uniqueid']][_0x39e9a0][_0x2e3a('0x12')]){logger[_0x2e3a('0x1e')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x25e73d[_0x2e3a('0x20')],this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x21')],_0x39e9a0);this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x45')]=!![];this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x46')]=moment()['format'](_0x2e3a('0x25'));this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x47')]=_0x25e73d['destuniqueid'];this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x48')]=_0x25e73d['membername'];this['channels'][_0x25e73d['uniqueid']][_0x39e9a0][_0x2e3a('0x3d')]='answered_elsewhere';this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0][_0x2e3a('0x49')]=_0x2e3a('0x4a');logger[_0x2e3a('0x22')](_0x2e3a('0x4b'),_0x25e73d[_0x2e3a('0x20')],util['inspect'](this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0],{'showHidden':![],'depth':null}));ami[_0x2e3a('0x30')](_0x2e3a('0x4c'),this[_0x2e3a('0x6')][_0x25e73d[_0x2e3a('0x20')]][_0x39e9a0]);}}}}}}catch(_0x2ebb5a){logger['error'](_0x2e3a('0x4d'),_0x25e73d['uniqueid'],util['inspect'](_0x2ebb5a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2e3a('0x1c')][_0x2e3a('0xf')]=function(_0xe1b39a){try{if(this[_0x2e3a('0x1a')](_0xe1b39a)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0xe1b39a[_0x2e3a('0x20')],util['inspect'](_0xe1b39a,{'showHidden':![],'depth':null}));if(this[_0x2e3a('0x6')][_0xe1b39a['uniqueid']]&&this[_0x2e3a('0x6')][_0xe1b39a[_0x2e3a('0x20')]][_0xe1b39a[_0x2e3a('0x23')]]){logger[_0x2e3a('0x1e')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0xe1b39a[_0x2e3a('0x20')],_0xe1b39a['membername'],_0xe1b39a[_0x2e3a('0x23')]);this[_0x2e3a('0x6')][_0xe1b39a[_0x2e3a('0x20')]][_0xe1b39a[_0x2e3a('0x23')]]['agentringnoanswer']=!![];this['channels'][_0xe1b39a[_0x2e3a('0x20')]][_0xe1b39a[_0x2e3a('0x23')]][_0x2e3a('0x46')]=moment()['format'](_0x2e3a('0x25'));this['channels'][_0xe1b39a[_0x2e3a('0x20')]][_0xe1b39a[_0x2e3a('0x23')]]['lastevent']=_0x2e3a('0x4e');this[_0x2e3a('0x6')][_0xe1b39a[_0x2e3a('0x20')]][_0xe1b39a[_0x2e3a('0x23')]]['reason']='rejected';logger[_0x2e3a('0x22')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0xe1b39a[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](this[_0x2e3a('0x6')][_0xe1b39a[_0x2e3a('0x20')]][_0xe1b39a[_0x2e3a('0x23')]],{'showHidden':![],'depth':null}));ami['emit'](_0x2e3a('0x4f'),this[_0x2e3a('0x6')][_0xe1b39a[_0x2e3a('0x20')]][_0xe1b39a[_0x2e3a('0x23')]]);}}}catch(_0x2c93a6){logger[_0x2e3a('0x33')](_0x2e3a('0x50'),_0xe1b39a[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_0x2c93a6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2e3a('0x1c')]['syncQueueCallerAbandon']=function(_0x1a6fc8){try{if(this[_0x2e3a('0x1a')](_0x1a6fc8)){logger[_0x2e3a('0x22')](_0x2e3a('0x51'),_0x1a6fc8[_0x2e3a('0x20')],util['inspect'](_0x1a6fc8,{'showHidden':![],'depth':null}));if(this[_0x2e3a('0x6')][_0x1a6fc8[_0x2e3a('0x20')]]){for(var _0x2d7eea in this['channels'][_0x1a6fc8['uniqueid']]){if(this[_0x2e3a('0x6')][_0x1a6fc8[_0x2e3a('0x20')]][_0x2e3a('0x36')](_0x2d7eea)&&!this[_0x2e3a('0x6')][_0x1a6fc8[_0x2e3a('0x20')]][_0x2d7eea][_0x2e3a('0x45')]&&!this[_0x2e3a('0x6')][_0x1a6fc8['uniqueid']][_0x2d7eea][_0x2e3a('0x12')]){logger['info'](_0x2e3a('0x52'),_0x1a6fc8['uniqueid'],this[_0x2e3a('0x6')][_0x1a6fc8[_0x2e3a('0x20')]][_0x2d7eea][_0x2e3a('0x21')],_0x2d7eea);this[_0x2e3a('0x6')][_0x1a6fc8[_0x2e3a('0x20')]][_0x2d7eea][_0x2e3a('0x45')]=!![];this[_0x2e3a('0x6')][_0x1a6fc8['uniqueid']][_0x2d7eea][_0x2e3a('0x46')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x2e3a('0x6')][_0x1a6fc8[_0x2e3a('0x20')]][_0x2d7eea]['lastevent']=_0x2e3a('0x53');this[_0x2e3a('0x6')][_0x1a6fc8[_0x2e3a('0x20')]][_0x2d7eea]['reason']='abandoned';logger[_0x2e3a('0x22')](_0x2e3a('0x54'),_0x1a6fc8[_0x2e3a('0x20')],util['inspect'](this['channels'][_0x1a6fc8[_0x2e3a('0x20')]][_0x2d7eea],{'showHidden':![],'depth':null}));ami[_0x2e3a('0x30')](_0x2e3a('0x55'),this[_0x2e3a('0x6')][_0x1a6fc8[_0x2e3a('0x20')]][_0x2d7eea]);}}}}}catch(_0x4c32cc){logger[_0x2e3a('0x33')](_0x2e3a('0x56'),_0x1a6fc8[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_0x4c32cc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2e3a('0x1c')]['syncAgentComplete']=function(_0x2f4049){try{if(this['isNotNull'](_0x2f4049)){logger['debug'](_0x2e3a('0x57'),_0x2f4049['uniqueid'],util['inspect'](_0x2f4049,{'showHidden':![],'depth':null}));if(this[_0x2e3a('0x6')][_0x2f4049[_0x2e3a('0x20')]]){for(var _0x40ed4d in this[_0x2e3a('0x6')][_0x2f4049[_0x2e3a('0x20')]]){if(this['channels'][_0x2f4049[_0x2e3a('0x20')]][_0x2e3a('0x36')](_0x40ed4d)){if(this[_0x2e3a('0x6')][_0x2f4049[_0x2e3a('0x20')]][_0x40ed4d][_0x2e3a('0x37')]&&!this[_0x2e3a('0x6')][_0x2f4049[_0x2e3a('0x20')]][_0x40ed4d]['agentcomplete']){logger[_0x2e3a('0x1e')](_0x2e3a('0x58'),_0x2f4049[_0x2e3a('0x20')],this[_0x2e3a('0x6')][_0x2f4049[_0x2e3a('0x20')]][_0x40ed4d][_0x2e3a('0x21')],_0x40ed4d);this[_0x2e3a('0x6')][_0x2f4049[_0x2e3a('0x20')]][_0x40ed4d][_0x2e3a('0x12')]=!![];this[_0x2e3a('0x6')][_0x2f4049[_0x2e3a('0x20')]][_0x40ed4d][_0x2e3a('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x2e3a('0x6')][_0x2f4049['uniqueid']][_0x40ed4d]['lastevent']=_0x2e3a('0x5a');this[_0x2e3a('0x6')][_0x2f4049[_0x2e3a('0x20')]][_0x40ed4d][_0x2e3a('0x49')]=_0x2f4049[_0x2e3a('0x49')]==_0x2e3a('0x5b')?_0x2e3a('0x5c'):_0x2f4049['reason'];this[_0x2e3a('0x6')][_0x2f4049[_0x2e3a('0x20')]][_0x40ed4d][_0x2e3a('0x5d')]=_0x2f4049['talktime'];if(this[_0x2e3a('0x8')][_0x2f4049[_0x2e3a('0x27')]]&&this[_0x2e3a('0x8')][_0x2f4049['queue']][_0x2e3a('0x5e')]){this[_0x2e3a('0x6')][_0x2f4049['uniqueid']][_0x40ed4d][_0x2e3a('0x5f')]=this[_0x2e3a('0x8')][_0x2f4049[_0x2e3a('0x27')]][_0x2e3a('0x60')];this[_0x2e3a('0x6')][_0x2f4049[_0x2e3a('0x20')]][_0x40ed4d][_0x2e3a('0x61')]=!![];}this[_0x2e3a('0x9')][_0x2f4049[_0x2e3a('0x40')]]=_['omit'](this[_0x2e3a('0x9')][_0x2f4049['interface']],[_0x2e3a('0x27'),'destconnectedlinenum']);logger[_0x2e3a('0x22')](_0x2e3a('0x62'),_0x2f4049[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](this[_0x2e3a('0x6')][_0x2f4049[_0x2e3a('0x20')]][_0x40ed4d],{'showHidden':![],'depth':null}));ami['emit'](_0x2e3a('0x63'),this['channels'][_0x2f4049[_0x2e3a('0x20')]][_0x40ed4d]);logger[_0x2e3a('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2f4049['uniqueid'],util[_0x2e3a('0x2f')](this['channels'][_0x2f4049['uniqueid']][_0x40ed4d],{'showHidden':![],'depth':null}));this[_0x2e3a('0x30')](util[_0x2e3a('0x24')]('user:%s',_0x2f4049['membername']),_0x2e3a('0x64'),this[_0x2e3a('0x6')][_0x2f4049['uniqueid']][_0x40ed4d]);}}}}}}catch(_0x1a701d){logger[_0x2e3a('0x33')](_0x2e3a('0x65'),_0x2f4049[_0x2e3a('0x20')],util['inspect'](_0x1a701d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2e3a('0x14')]=function(_0x2ca55e){try{if(this['isNotNull'](_0x2ca55e)){logger[_0x2e3a('0x22')]('[%s][voiceAgentReport][varset]\x20event:',_0x2ca55e[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_0x2ca55e,{'showHidden':![],'depth':null}));this['addVariable'](_0x2ca55e[_0x2e3a('0x20')],_[_0x2e3a('0x66')](_0x2ca55e[_0x2e3a('0x67')])[0x0],_0x2ca55e[_0x2e3a('0x68')]);if(this['channels'][_0x2ca55e[_0x2e3a('0x20')]]){for(var _0x4ad5aa in this[_0x2e3a('0x6')][_0x2ca55e[_0x2e3a('0x20')]]){if(this[_0x2e3a('0x6')][_0x2ca55e[_0x2e3a('0x20')]][_0x2e3a('0x36')](_0x4ad5aa)){logger[_0x2e3a('0x1e')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x2ca55e[_0x2e3a('0x20')],_0x4ad5aa,_[_0x2e3a('0x66')](_0x2ca55e[_0x2e3a('0x67')])[0x0],_0x2ca55e['value']);if(_[_0x2e3a('0x1b')](this[_0x2e3a('0x6')][_0x2ca55e[_0x2e3a('0x20')]][_0x4ad5aa]['variables'])){this['channels'][_0x2ca55e[_0x2e3a('0x20')]][_0x4ad5aa]['variables']={};}this[_0x2e3a('0x6')][_0x2ca55e[_0x2e3a('0x20')]][_0x4ad5aa]['variables']=this[_0x2e3a('0xa')][_0x2ca55e[_0x2e3a('0x20')]];}}}}}catch(_0x52d38d){logger['error']('[%s][voiceAgentReport][varset]',_0x2ca55e[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_0x52d38d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2e3a('0x1c')]['addVariable']=function(_0x5df0dd,_0x32fa19,_0x560780){var _0x18822d=[_0x2e3a('0x69'),_0x2e3a('0x6a'),_0x2e3a('0x6b'),_0x2e3a('0x6c'),_0x2e3a('0x6d'),_0x2e3a('0x6e'),_0x2e3a('0x6f'),_0x2e3a('0x70'),_0x2e3a('0x71'),'sipuri','bridgepeer',_0x2e3a('0x72'),_0x2e3a('0x73'),_0x2e3a('0x74'),_0x2e3a('0x75'),_0x2e3a('0x76'),_0x2e3a('0x21'),_0x2e3a('0x77'),_0x2e3a('0x78')];if(!_[_0x2e3a('0x79')](_0x32fa19)&&!_[_0x2e3a('0x7a')](_0x18822d,_0x32fa19)){if(_[_0x2e3a('0x1b')](this[_0x2e3a('0xa')][_0x5df0dd])){this[_0x2e3a('0xa')][_0x5df0dd]={};}this['variables'][_0x5df0dd][_0x32fa19]=_0x560780;}};VoiceAgentReport[_0x2e3a('0x1c')]['syncHangup']=function(_0x39fefa){try{if(this['isNotNull'](_0x39fefa)){logger[_0x2e3a('0x22')](_0x2e3a('0x7b'),_0x39fefa[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_0x39fefa,{'showHidden':![],'depth':null}));if(this['channels'][_0x39fefa[_0x2e3a('0x20')]]){for(var _0x4fc664 in this['channels'][_0x39fefa[_0x2e3a('0x20')]]){if(this[_0x2e3a('0x6')][_0x39fefa[_0x2e3a('0x20')]]['hasOwnProperty'](_0x4fc664)){if(this['channels'][_0x39fefa[_0x2e3a('0x20')]][_0x4fc664][_0x2e3a('0x49')]=='transfer'&&this['channels'][_0x39fefa[_0x2e3a('0x20')]][_0x4fc664]['agentcomplete']){logger[_0x2e3a('0x1e')](_0x2e3a('0x7c'),_0x39fefa[_0x2e3a('0x20')],_0x4fc664);this[_0x2e3a('0x6')][_0x39fefa[_0x2e3a('0x20')]][_0x4fc664][_0x2e3a('0x59')]=moment()[_0x2e3a('0x24')](_0x2e3a('0x25'));}}}logger[_0x2e3a('0x22')](_0x2e3a('0x7d'),_0x39fefa[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_[_0x2e3a('0x7e')](this[_0x2e3a('0x6')][_0x39fefa[_0x2e3a('0x20')]]),{'showHidden':![],'depth':null}));ami[_0x2e3a('0x30')]('custom:voiceAgentReport',_[_0x2e3a('0x7e')](this[_0x2e3a('0x6')][_0x39fefa['uniqueid']]));delete this[_0x2e3a('0x6')][_0x39fefa['uniqueid']];}if(this[_0x2e3a('0xa')][_0x39fefa[_0x2e3a('0x20')]]){delete this[_0x2e3a('0xa')][_0x39fefa[_0x2e3a('0x20')]];}}}catch(_0x301498){logger[_0x2e3a('0x33')](_0x2e3a('0x7f'),_0x39fefa[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_0x301498,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2e3a('0x1c')][_0x2e3a('0x80')]=function(_0x430e2c){try{if(this[_0x2e3a('0x1a')](_0x430e2c)){logger[_0x2e3a('0x22')](_0x2e3a('0x81'),_0x430e2c[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_0x430e2c,{'showHidden':![],'depth':null}));if(this['channels'][_0x430e2c[_0x2e3a('0x82')]]){for(var _0x3a0359 in this['channels'][_0x430e2c[_0x2e3a('0x82')]]){if(this[_0x2e3a('0x6')][_0x430e2c[_0x2e3a('0x82')]]['hasOwnProperty'](_0x3a0359)){if(_0x430e2c[_0x2e3a('0x83')]===_0x3a0359){logger['info'](_0x2e3a('0x84'),_0x430e2c['uniqueid'],this[_0x2e3a('0x6')][_0x430e2c[_0x2e3a('0x82')]][_0x3a0359][_0x2e3a('0x21')],_0x3a0359);var _0x15171d=moment();this[_0x2e3a('0x6')][_0x430e2c['transfereeuniqueid']][_0x3a0359][_0x2e3a('0x12')]=!![];this[_0x2e3a('0x6')][_0x430e2c[_0x2e3a('0x82')]][_0x3a0359]['agentcompleteAt']=moment()[_0x2e3a('0x24')](_0x2e3a('0x25'));this[_0x2e3a('0x6')][_0x430e2c[_0x2e3a('0x82')]][_0x3a0359][_0x2e3a('0x3d')]=_0x2e3a('0x5a');this[_0x2e3a('0x6')][_0x430e2c[_0x2e3a('0x82')]][_0x3a0359][_0x2e3a('0x49')]=_0x2e3a('0x5b');this[_0x2e3a('0x6')][_0x430e2c['transfereeuniqueid']][_0x3a0359][_0x2e3a('0x5d')]=_0x15171d[_0x2e3a('0x85')](this[_0x2e3a('0x6')][_0x430e2c[_0x2e3a('0x82')]][_0x3a0359][_0x2e3a('0x37')],'seconds');}}}}if(this['channels'][_0x430e2c[_0x2e3a('0x86')]]){var _0xafc8b3=this['channels'][_0x430e2c['secondtransfereruniqueid']];this[_0x2e3a('0x6')][_0x430e2c[_0x2e3a('0x86')]]=this[_0x2e3a('0x6')][_0x430e2c[_0x2e3a('0x82')]];this[_0x2e3a('0x6')][_0x430e2c[_0x2e3a('0x82')]]=_0xafc8b3;}}}catch(_0x4edfd){logger['error'](_0x2e3a('0x87'),_0x430e2c[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_0x4edfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2e3a('0x1c')][_0x2e3a('0x88')]=function(_0x1b5c57){try{if(this[_0x2e3a('0x1a')](_0x1b5c57)){logger[_0x2e3a('0x22')](_0x2e3a('0x89'),_0x1b5c57['uniqueid'],util['inspect'](_0x1b5c57,{'showHidden':![],'depth':null}));if(this[_0x2e3a('0x6')][_0x1b5c57[_0x2e3a('0x82')]]){for(var _0x27fee7 in this[_0x2e3a('0x6')][_0x1b5c57[_0x2e3a('0x82')]]){if(this['channels'][_0x1b5c57[_0x2e3a('0x82')]][_0x2e3a('0x36')](_0x27fee7)){if(_0x1b5c57[_0x2e3a('0x8a')]===_0x27fee7){logger[_0x2e3a('0x1e')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1b5c57[_0x2e3a('0x20')],this[_0x2e3a('0x6')][_0x1b5c57[_0x2e3a('0x82')]][_0x27fee7][_0x2e3a('0x21')],_0x27fee7);var _0x18bb74=moment();this[_0x2e3a('0x6')][_0x1b5c57[_0x2e3a('0x82')]][_0x27fee7]['agentcomplete']=!![];this['channels'][_0x1b5c57[_0x2e3a('0x82')]][_0x27fee7][_0x2e3a('0x59')]=_0x18bb74;this['channels'][_0x1b5c57['transfereeuniqueid']][_0x27fee7][_0x2e3a('0x3d')]='complete';this[_0x2e3a('0x6')][_0x1b5c57[_0x2e3a('0x82')]][_0x27fee7][_0x2e3a('0x49')]=_0x2e3a('0x5b');this[_0x2e3a('0x6')][_0x1b5c57[_0x2e3a('0x82')]][_0x27fee7][_0x2e3a('0x5d')]=_0x18bb74['diff'](this[_0x2e3a('0x6')][_0x1b5c57['transfereeuniqueid']][_0x27fee7]['agentconnectAt'],_0x2e3a('0x8b'));}}}}}}catch(_0x5c0a15){logger['error'](_0x2e3a('0x8c'),_0x1b5c57[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_0x5c0a15,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2e3a('0x1c')][_0x2e3a('0x18')]=function(_0x599be7){var _0x2f2651='';try{if(this[_0x2e3a('0x1a')](_0x599be7)){logger['debug'](_0x2e3a('0x8d'),_0x599be7['uniqueid'],util[_0x2e3a('0x2f')](_0x599be7,{'showHidden':![],'depth':null}));if(_0x599be7[_0x2e3a('0x8e')]){_0x2f2651=_0x599be7[_0x2e3a('0x8e')][_0x2e3a('0x8f')](0x0,_0x599be7[_0x2e3a('0x8e')][_0x2e3a('0x90')]('-'));if(this[_0x2e3a('0x9')][_0x2f2651]){logger[_0x2e3a('0x1e')](_0x2e3a('0x91'),_0x599be7[_0x2e3a('0x20')],_0x2f2651);this[_0x2e3a('0x9')][_0x2f2651][_0x2e3a('0x92')]=!![];}}}}catch(_0x19189a){logger['error'](_0x2e3a('0x93'),_0x599be7[_0x2e3a('0x20')],util['inspect'](_0x19189a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2e3a('0x1c')][_0x2e3a('0x19')]=function(_0x1286c0){var _0x2f659b='';try{if(this[_0x2e3a('0x1a')](_0x1286c0)){logger[_0x2e3a('0x22')](_0x2e3a('0x94'),_0x1286c0['uniqueid'],util['inspect'](_0x1286c0,{'showHidden':![],'depth':null}));if(_0x1286c0[_0x2e3a('0x8e')]){_0x2f659b=_0x1286c0['channel']['substring'](0x0,_0x1286c0[_0x2e3a('0x8e')]['lastIndexOf']('-'));if(this['agents'][_0x2f659b]){logger['info'](_0x2e3a('0x95'),_0x1286c0['uniqueid'],_0x2f659b);this[_0x2e3a('0x9')][_0x2f659b][_0x2e3a('0x92')]=![];}}}}catch(_0x51b7ba){logger[_0x2e3a('0x33')](_0x2e3a('0x96'),_0x1286c0[_0x2e3a('0x20')],util[_0x2e3a('0x2f')](_0x51b7ba,{'showHidden':![],'depth':null}));}};module[_0x2e3a('0x97')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 52f8ac3..f0d5fbc 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf53f=['calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','from-sip','channel','destconnectedlinenum','format','split','name','user:agentconnect','accountcode','connectedlinenum','[%s][voiceCallReport][newcallerid]','inspect','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','lastapplication','lastdata','cdr(','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','diff','xcally-motion-preview','destinationchannel','UserId','routealias','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','monitorFilename','monitors','isNil','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','holdtime','omit','user:%s','user:agentcomplete','resolve','then','transferType','isEmpty','getSettings','stopRecordingOnTransfer','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','not_inuse','inuse','invalid','unavailable','ringinuse','onhold','set','queue','dial','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname'];(function(_0x590755,_0x1f18cd){var _0x3d1f25=function(_0x4ed74f){while(--_0x4ed74f){_0x590755['push'](_0x590755['shift']());}};_0x3d1f25(++_0x1f18cd);}(_0xf53f,0x150));var _0xff53=function(_0x243c44,_0x11d8ed){_0x243c44=_0x243c44-0x0;var _0x25cb9d=_0xf53f[_0x243c44];return _0x25cb9d;};'use strict';var BPromise=require('bluebird');var _=require(_0xff53('0x0'));var moment=require('moment');var util=require(_0xff53('0x1'));var path=require(_0xff53('0x2'));var Redis=require(_0xff53('0x3'));var config=require(_0xff53('0x4'));var logger=require(_0xff53('0x5'))(_0xff53('0x6'));var ami=require('../ami');var Channel=require(_0xff53('0x7'));var RpcSetting=require(_0xff53('0x8'));var statusDesc=['unknown',_0xff53('0x9'),_0xff53('0xa'),'busy',_0xff53('0xb'),_0xff53('0xc'),'ringing',_0xff53('0xd'),_0xff53('0xe')];var applications=[_0xff53('0xf'),_0xff53('0x10'),'agi',_0xff53('0x11'),'playback','voicemail'];var dispositions=[_0xff53('0x12'),'FAILED',_0xff53('0x13'),_0xff53('0x12'),_0xff53('0x12'),_0xff53('0x12'),_0xff53('0x14'),_0xff53('0x15'),_0xff53('0x13'),_0xff53('0x13'),_0xff53('0x13')];var actions={};config[_0xff53('0x16')]=_[_0xff53('0x17')](config[_0xff53('0x16')],{'host':_0xff53('0x18'),'port':0x18eb});var io=require(_0xff53('0x19'))(new Redis(config[_0xff53('0x16')]));function VoiceCallReport(_0x35df4c){this[_0xff53('0x1a')]=_0x35df4c[_0xff53('0x1a')];this[_0xff53('0x1b')]=_0x35df4c[_0xff53('0x1b')];this[_0xff53('0x1c')]={};ami['on']('coreshowchannel',this[_0xff53('0x1d')][_0xff53('0x1e')](this));ami['on']('newexten',this[_0xff53('0x1d')][_0xff53('0x1e')](this));ami['on'](_0xff53('0x1f'),this[_0xff53('0x20')]['bind'](this));ami['on'](_0xff53('0x21'),this['syncNewState'][_0xff53('0x1e')](this));ami['on'](_0xff53('0x22'),this[_0xff53('0x23')][_0xff53('0x1e')](this));ami['on'](_0xff53('0x24'),this[_0xff53('0x25')]['bind'](this));ami['on'](_0xff53('0x26'),this[_0xff53('0x27')]['bind'](this));ami['on'](_0xff53('0x28'),this[_0xff53('0x29')][_0xff53('0x1e')](this));ami['on'](_0xff53('0x2a'),this[_0xff53('0x2b')][_0xff53('0x1e')](this));ami['on'](_0xff53('0x2c'),this['syncMusicOnHoldStart']['bind'](this));ami['on']('musiconholdstop',this[_0xff53('0x2d')]['bind'](this));try{logger[_0xff53('0x2e')](_0xff53('0x2f'));ami[_0xff53('0x30')]();}catch(_0x1a1801){logger[_0xff53('0x31')](_0xff53('0x32'),util['inspect'](_0x1a1801,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xff53('0x33')][_0xff53('0x34')]=function(_0x463a78){return _0x463a78!==null&&!_[_0xff53('0x35')](_0x463a78);};VoiceCallReport['prototype'][_0xff53('0x36')]=function(_0x1a879c,_0x164e0a,_0x15029b){io['to'](_0x1a879c)[_0xff53('0x36')](_0x164e0a,_0x15029b);};VoiceCallReport[_0xff53('0x33')][_0xff53('0x27')]=function(_0x5553e5){try{if(this[_0xff53('0x34')](_0x5553e5)){logger[_0xff53('0x2e')](_0xff53('0x37'),_0x5553e5[_0xff53('0x38')],_0x5553e5[_0xff53('0x39')],_0x5553e5[_0xff53('0x3a')]);logger[_0xff53('0x3b')](_0xff53('0x3c'),_0x5553e5[_0xff53('0x38')],util['inspect'](_0x5553e5,{'showHidden':![],'depth':null}));if(_0x5553e5[_0xff53('0x38')]===_0x5553e5[_0xff53('0x3d')]){if(!_[_0xff53('0x35')](this[_0xff53('0x1a')][_0x5553e5[_0xff53('0x38')]])){_[_0xff53('0x3e')](this[_0xff53('0x1a')][_0x5553e5[_0xff53('0x38')]],_[_0xff53('0x3f')](_0x5553e5,_[_0xff53('0x40')](this[_0xff53('0x1a')][_0x5553e5[_0xff53('0x38')]])));}}if(_0x5553e5[_0xff53('0x41')]===_0xff53('0x42')){if(this['agents'][_0x5553e5[_0xff53('0x43')]['split']('-')[0x0]]){if(_0x5553e5['exten']=='xcally-motion-preview'){this[_0xff53('0x1b')][_0x5553e5['channel']['split']('-')[0x0]][_0xff53('0x44')]=_0x5553e5['connectedlinenum'];this['emit'](util[_0xff53('0x45')]('user:%s',this['agents'][_0x5553e5[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]][_0xff53('0x47')]),_0xff53('0x48'),{'destaccountcode':this[_0xff53('0x1b')][_0x5553e5['channel'][_0xff53('0x46')]('-')[0x0]][_0xff53('0x49')],'destconnectedlinenum':_0x5553e5[_0xff53('0x4a')]});}}}}}catch(_0x541ec3){logger['error'](_0xff53('0x4b'),_0x5553e5[_0xff53('0x38')],util[_0xff53('0x4c')](_0x541ec3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff53('0x33')][_0xff53('0x20')]=function(_0x48c057){try{if(this[_0xff53('0x34')](_0x48c057)){logger[_0xff53('0x3b')]('[%s][voiceCallReport][newchannel]\x20event:',_0x48c057[_0xff53('0x38')],util[_0xff53('0x4c')](_0x48c057,{'showHidden':![],'depth':null}));if(_0x48c057[_0xff53('0x38')]===_0x48c057[_0xff53('0x3d')]&&_0x48c057[_0xff53('0x43')]!=_0xff53('0x4d')){if(_[_0xff53('0x35')](this[_0xff53('0x1a')][_0x48c057[_0xff53('0x38')]])){logger[_0xff53('0x2e')](_0xff53('0x4e'),_0x48c057[_0xff53('0x38')],_0x48c057[_0xff53('0x41')],_0x48c057['exten']);this[_0xff53('0x1a')][_0x48c057['uniqueid']]=new Channel();this[_0xff53('0x1a')][_0x48c057[_0xff53('0x38')]]['starttime']=moment()['format'](_0xff53('0x4f'));this[_0xff53('0x1a')][_0x48c057[_0xff53('0x38')]][_0xff53('0x50')]=dispositions[_[_0xff53('0x51')](_0x48c057['channelstate'])];_[_0xff53('0x3e')](this[_0xff53('0x1a')][_0x48c057[_0xff53('0x38')]],_[_0xff53('0x3f')](_0x48c057,_['keys'](this[_0xff53('0x1a')][_0x48c057[_0xff53('0x38')]])));if(_0x48c057['context']===_0xff53('0x42')){if(this[_0xff53('0x1b')][_0x48c057['channel'][_0xff53('0x46')]('-')[0x0]]){if(_[_0xff53('0x35')](this[_0xff53('0x1b')][_0x48c057['channel'][_0xff53('0x46')]('-')[0x0]]['destconnectedlinenum'])){this[_0xff53('0x1b')][_0x48c057[_0xff53('0x43')]['split']('-')[0x0]][_0xff53('0x44')]=_0x48c057[_0xff53('0x52')];logger[_0xff53('0x3b')](_0xff53('0x53'),_0x48c057['uniqueid'],util[_0xff53('0x4c')]({'destaccountcode':this[_0xff53('0x1b')][_0x48c057[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x48c057[_0xff53('0x52')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xff53('0x45')]('user:%s',this[_0xff53('0x1b')][_0x48c057['channel'][_0xff53('0x46')]('-')[0x0]][_0xff53('0x47')]),_0xff53('0x48'),{'destaccountcode':this[_0xff53('0x1b')][_0x48c057[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]][_0xff53('0x49')],'destconnectedlinenum':_0x48c057[_0xff53('0x52')]});}}}}}}}catch(_0x42b4b7){logger[_0xff53('0x31')](_0xff53('0x54'),_0x48c057['uniqueid'],util[_0xff53('0x4c')](_0x42b4b7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff53('0x33')][_0xff53('0x1d')]=function(_0x34c190){try{if(this[_0xff53('0x34')](_0x34c190)){logger[_0xff53('0x3b')](_0xff53('0x55'),_0x34c190[_0xff53('0x38')],util[_0xff53('0x4c')](_0x34c190,{'showHidden':![],'depth':null}));if(_0x34c190[_0xff53('0x38')]===_0x34c190['linkedid']&&_0x34c190[_0xff53('0x52')]!='h'&&_0x34c190['channel']!=_0xff53('0x4d')){_0x34c190[_0xff53('0x56')]=_0x34c190[_0xff53('0x56')][_0xff53('0x57')]();_0x34c190[_0xff53('0x58')]=_0x34c190[_0xff53('0x59')]&&_0x34c190[_0xff53('0x59')][_0xff53('0x5a')](_0xff53('0x5b'))?_0x34c190[_0xff53('0x59')]:(_0x34c190[_0xff53('0x59')]||_0x34c190[_0xff53('0x58')])[_0xff53('0x57')]();logger[_0xff53('0x2e')](_0xff53('0x5c'),_0x34c190[_0xff53('0x38')],_0x34c190['application'],_0x34c190['applicationdata']);if(_[_0xff53('0x35')](this[_0xff53('0x1a')][_0x34c190[_0xff53('0x38')]])){this['channels'][_0x34c190[_0xff53('0x38')]]=new Channel();this[_0xff53('0x1a')][_0x34c190[_0xff53('0x38')]][_0xff53('0x5d')]=_0x34c190[_0xff53('0x5e')]?moment()[_0xff53('0x5f')](moment[_0xff53('0x5e')](_0x34c190['duration'])[_0xff53('0x60')](),'seconds')[_0xff53('0x45')](_0xff53('0x4f')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xff53('0x1a')][_0x34c190[_0xff53('0x38')]][_0xff53('0x50')]=_0xff53('0x12');}_[_0xff53('0x3e')](this['channels'][_0x34c190[_0xff53('0x38')]],_['pick'](_0x34c190,_[_0xff53('0x40')](this[_0xff53('0x1a')][_0x34c190['uniqueid']])));if(_['includes'](applications,_0x34c190['application'])){this[_0xff53('0x1a')][_0x34c190[_0xff53('0x38')]][_0xff53('0x61')]=_0x34c190['application'];this['channels'][_0x34c190['uniqueid']][_0xff53('0x62')]=_0x34c190[_0xff53('0x58')];if(_0x34c190[_0xff53('0x56')]===_0xff53('0xf')&&_['startsWith'](_0x34c190[_0xff53('0x58')][_0xff53('0x57')](),_0xff53('0x63'))){var _0x357241=_0x34c190['applicationdata']['split']('=');var _0x5100df=_0x357241[0x0]['toLowerCase']()['match'](/cdr\((.*)\)/);if(_0x5100df){this['channels'][_0x34c190[_0xff53('0x38')]][_0x5100df[0x1]]=_0x357241[0x1];}}else if(_0x34c190[_0xff53('0x56')]===_0xff53('0x10')){this['channels'][_0x34c190[_0xff53('0x38')]][_0xff53('0x10')]=_0x34c190[_0xff53('0x58')][_0xff53('0x46')](',')[0x0];}}}}}catch(_0x21b14f){logger['error']('[%s][voiceCallReport][newexten]',_0x34c190['uniqueid'],util[_0xff53('0x4c')](_0x21b14f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x1add2d){try{if(this[_0xff53('0x34')](_0x1add2d)){logger[_0xff53('0x2e')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x1add2d['uniqueid'],_0x1add2d[_0xff53('0x3d')],_0x1add2d[_0xff53('0x39')],_0x1add2d[_0xff53('0x3a')]);logger[_0xff53('0x3b')](_0xff53('0x64'),_0x1add2d['uniqueid'],util[_0xff53('0x4c')](_0x1add2d,{'showHidden':![],'depth':null}));if(_0x1add2d[_0xff53('0x38')]!==_0x1add2d[_0xff53('0x3d')]){if(this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x3d')]]){if(_0x1add2d[_0xff53('0x65')]==='6'){if(!this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x3d')]]['answered']){var _0x10e9c5=moment();this[_0xff53('0x1a')][_0x1add2d['linkedid']][_0xff53('0x66')]=!![];this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x3d')]][_0xff53('0x67')]=_0x10e9c5[_0xff53('0x45')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x3d')]][_0xff53('0x5d')]){this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x3d')]]['holdtime']=_0x10e9c5[_0xff53('0x68')](this['channels'][_0x1add2d['linkedid']]['starttime'],_0xff53('0x60'));}}this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x3d')]][_0xff53('0x3d')]=_0x1add2d[_0xff53('0x38')];if(_0x1add2d['calleridnum']!==_0xff53('0x69')){this[_0xff53('0x1a')][_0x1add2d['linkedid']][_0xff53('0x4a')]=_0x1add2d[_0xff53('0x3a')];}this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x3d')]]['connectedlinename']=_0x1add2d[_0xff53('0x39')];this['channels'][_0x1add2d[_0xff53('0x3d')]][_0xff53('0x6a')]=_0x1add2d['channel'];this['channels'][_0x1add2d[_0xff53('0x3d')]][_0xff53('0x50')]=dispositions[_[_0xff53('0x51')](_0x1add2d['channelstate'])];if(this[_0xff53('0x1b')][_0x1add2d[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]]){this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x3d')]][_0xff53('0x6b')]=this['agents'][_0x1add2d[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]]['id'];this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x3d')]]['membername']=this[_0xff53('0x1b')][_0x1add2d['channel'][_0xff53('0x46')]('-')[0x0]][_0xff53('0x47')];}}}}else{if(this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x38')]]){if(_0x1add2d[_0xff53('0x65')]==='6'){if(this[_0xff53('0x1b')][_0x1add2d[_0xff53('0x43')]['split']('-')[0x0]]){this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x38')]]['UserId']=this[_0xff53('0x1b')][_0x1add2d[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]]['id'];this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x38')]]['membername']=this[_0xff53('0x1b')][_0x1add2d['channel'][_0xff53('0x46')]('-')[0x0]][_0xff53('0x47')];}}}}if(_0x1add2d[_0xff53('0x65')]==='6'&&_0x1add2d['context']===_0xff53('0x42')){if(this[_0xff53('0x1b')][_0x1add2d['channel']['split']('-')[0x0]]){this[_0xff53('0x1b')][_0x1add2d[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]][_0xff53('0x44')]=_0x1add2d[_0xff53('0x52')];var _0x39ff0a;if(this['channels'][_0x1add2d['uniqueid']])_0x39ff0a=this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x38')]]['routealias'];else if(this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x3d')]])_0x39ff0a=this[_0xff53('0x1a')][_0x1add2d[_0xff53('0x3d')]][_0xff53('0x6c')];logger[_0xff53('0x3b')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x1add2d[_0xff53('0x38')],util[_0xff53('0x4c')]({'destaccountcode':this[_0xff53('0x1b')][_0x1add2d[_0xff53('0x43')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x1add2d['exten'],'routealias':_0x39ff0a},{'showHidden':![],'depth':null}));this['emit'](util[_0xff53('0x45')]('user:%s',this[_0xff53('0x1b')][_0x1add2d[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]][_0xff53('0x47')]),'user:agentconnect',{'destaccountcode':this[_0xff53('0x1b')][_0x1add2d['channel'][_0xff53('0x46')]('-')[0x0]][_0xff53('0x49')],'destconnectedlinenum':_0x1add2d[_0xff53('0x52')],'routealias':_0x39ff0a});}}}}catch(_0x216302){logger[_0xff53('0x31')]('[%s][voiceCallReport][newstate]',_0x1add2d[_0xff53('0x38')],util[_0xff53('0x4c')](_0x216302,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xff53('0x6d')]=function(_0x1f05b7,_0xd12947){try{if(this['channels'][_0x1f05b7]){logger[_0xff53('0x2e')](_0xff53('0x6e'),_0x1f05b7,_0xd12947);this[_0xff53('0x1a')][_0x1f05b7][_0xff53('0x6f')]=!![];if(_['endsWith'](_0xd12947,_0xff53('0x70'))){_0xd12947=_0xd12947[_0xff53('0x71')](_0xff53('0x70'),'.WAV');}this[_0xff53('0x1a')][_0x1f05b7][_0xff53('0x72')]=_0xd12947;var _0x5e337c=_['find'](this['channels'][_0x1f05b7][_0xff53('0x73')],{'filename':_0xd12947});if(_[_0xff53('0x74')](_0x5e337c)){this[_0xff53('0x1a')][_0x1f05b7]['monitors']['push']({'filename':_0xd12947,'createdAt':moment()[_0xff53('0x45')](_0xff53('0x4f')),'mixmonitorid':'','status':'rec'});}}}catch(_0x223b1d){logger[_0xff53('0x31')](_0xff53('0x75'),_0x1f05b7,util[_0xff53('0x4c')](_0x223b1d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff53('0x33')][_0xff53('0x23')]=function(_0x52faae){try{if(this[_0xff53('0x34')](_0x52faae)){logger[_0xff53('0x3b')](_0xff53('0x76'),_0x52faae[_0xff53('0x38')],util['inspect'](_0x52faae,{'showHidden':![],'depth':null}));if(this['channels'][_0x52faae[_0xff53('0x38')]]&&_0x52faae[_0xff53('0x43')]!=_0xff53('0x4d')){if(this[_0xff53('0x34')](_0x52faae[_0xff53('0x77')])){if(this['isNotNull'](_0x52faae[_0xff53('0x77')][_0xff53('0x78')])){logger[_0xff53('0x2e')](_0xff53('0x79'),_0x52faae[_0xff53('0x38')],_0x52faae[_0xff53('0x7a')]);this[_0xff53('0x6d')](_0x52faae['uniqueid'],_0x52faae[_0xff53('0x7a')]);}else if(this['isNotNull'](_0x52faae[_0xff53('0x77')]['xmd-phone'])){logger[_0xff53('0x2e')](_0xff53('0x7b'),_0x52faae[_0xff53('0x38')],_0x52faae[_0xff53('0x7a')]);this[_0xff53('0x1a')][_0x52faae[_0xff53('0x38')]]['calleridnum']=_0x52faae[_0xff53('0x7a')];}else if(this[_0xff53('0x34')](_0x52faae['variable'][_0xff53('0x7c')])){logger['info'](_0xff53('0x7d'),_0x52faae[_0xff53('0x38')],_0x52faae['value']);this['channels'][_0x52faae[_0xff53('0x38')]][_0xff53('0x7e')]=_0x52faae[_0xff53('0x7a')];}else if(this['isNotNull'](_0x52faae[_0xff53('0x77')][_0xff53('0x7f')])){logger[_0xff53('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x52faae[_0xff53('0x38')],_0x52faae['value']);this['channels'][_0x52faae[_0xff53('0x38')]][_0xff53('0x80')]=_0x52faae[_0xff53('0x7a')];}else if(this[_0xff53('0x34')](_0x52faae['variable'][_0xff53('0x81')])){logger['info'](_0xff53('0x82'),_0x52faae[_0xff53('0x38')],_0x52faae[_0xff53('0x7a')][_0xff53('0x46')](',')[0x0]);this[_0xff53('0x1a')][_0x52faae[_0xff53('0x38')]][_0xff53('0x10')]=_0x52faae['value'][_0xff53('0x46')](',')[0x0];}else if(this[_0xff53('0x34')](_0x52faae['variable']['xmd-originatecalleridnum'])){logger[_0xff53('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x52faae['uniqueid'],_0x52faae[_0xff53('0x7a')]);this[_0xff53('0x1a')][_0x52faae[_0xff53('0x38')]]['originatecalleridnum']=_0x52faae[_0xff53('0x7a')];}else if(this['isNotNull'](_0x52faae[_0xff53('0x77')][_0xff53('0x83')])){logger[_0xff53('0x2e')](_0xff53('0x84'),_0x52faae[_0xff53('0x38')],_0x52faae[_0xff53('0x7a')]);this[_0xff53('0x1a')][_0x52faae['uniqueid']][_0xff53('0x85')]=_0x52faae[_0xff53('0x7a')];}else if(this[_0xff53('0x34')](_0x52faae[_0xff53('0x77')][_0xff53('0x86')])){logger[_0xff53('0x2e')](_0xff53('0x87'),_0x52faae[_0xff53('0x38')],_0x52faae['value']);this[_0xff53('0x1a')][_0x52faae[_0xff53('0x38')]]['calleridpreview']=_0x52faae[_0xff53('0x7a')];}else if(this['isNotNull'](_0x52faae[_0xff53('0x77')][_0xff53('0x88')])){logger[_0xff53('0x2e')](_0xff53('0x89'),_0x52faae['uniqueid'],_0x52faae[_0xff53('0x7a')]);this['channels'][_0x52faae[_0xff53('0x38')]][_0xff53('0x10')]=_0x52faae['value'];}else if(this[_0xff53('0x34')](_0x52faae['variable'][_0xff53('0x8a')])){logger[_0xff53('0x2e')](_0xff53('0x8b'),_0x52faae[_0xff53('0x38')],_0x52faae[_0xff53('0x7a')]);this[_0xff53('0x1a')][_0x52faae[_0xff53('0x38')]][_0xff53('0x8c')]=_0x52faae[_0xff53('0x7a')];}}}else if(this['isNotNull'](_0x52faae['variable'][_0xff53('0x78')])){if(_0x52faae[_0xff53('0x7a')]){var _0x49c9f3=path[_0xff53('0x8d')](_0x52faae[_0xff53('0x7a')])[_0xff53('0x47')];logger[_0xff53('0x2e')](_0xff53('0x79'),_0x49c9f3,_0x52faae[_0xff53('0x7a')]);this[_0xff53('0x6d')](_0x49c9f3,_0x52faae[_0xff53('0x7a')]);}}else if(this['channels'][_0x52faae[_0xff53('0x3d')]]){if(this[_0xff53('0x34')](_0x52faae[_0xff53('0x77')])){if(this[_0xff53('0x34')](_0x52faae[_0xff53('0x77')][_0xff53('0x8a')])){logger[_0xff53('0x2e')](_0xff53('0x8b'),_0x52faae[_0xff53('0x3d')],_0x52faae[_0xff53('0x7a')]);this['channels'][_0x52faae[_0xff53('0x3d')]][_0xff53('0x8e')]=_0x52faae[_0xff53('0x7a')];}}}}}catch(_0x689725){logger['error'](_0xff53('0x8f'),_0x52faae[_0xff53('0x38')],util[_0xff53('0x4c')](_0x689725,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff53('0x33')][_0xff53('0x25')]=function(_0x21873d){try{if(this['isNotNull'](_0x21873d)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x21873d['uniqueid'],util[_0xff53('0x4c')](_0x21873d,{'showHidden':![],'depth':null}));if(this['channels'][_0x21873d['uniqueid']]){logger[_0xff53('0x2e')](_0xff53('0x90'),_0x21873d[_0xff53('0x38')],_0x21873d[_0xff53('0x91')]);var _0x18687f=moment();this[_0xff53('0x1a')][_0x21873d[_0xff53('0x38')]][_0xff53('0x92')]=_0x18687f[_0xff53('0x45')](_0xff53('0x4f'));this[_0xff53('0x1a')][_0x21873d['uniqueid']]['duration']=_0x18687f['diff'](this[_0xff53('0x1a')][_0x21873d[_0xff53('0x38')]][_0xff53('0x5d')],_0xff53('0x60'));if(this[_0xff53('0x1a')][_0x21873d[_0xff53('0x38')]]['answered']){this[_0xff53('0x1a')][_0x21873d[_0xff53('0x38')]]['billableseconds']=_0x18687f['diff'](this[_0xff53('0x1a')][_0x21873d[_0xff53('0x38')]][_0xff53('0x67')],_0xff53('0x60'));this[_0xff53('0x1a')][_0x21873d[_0xff53('0x38')]][_0xff53('0x93')]=this[_0xff53('0x1a')][_0x21873d[_0xff53('0x38')]][_0xff53('0x5e')]-this[_0xff53('0x1a')][_0x21873d[_0xff53('0x38')]]['billableseconds'];}if(_0x21873d['context']===_0xff53('0x42')){if(this['agents'][_0x21873d[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]]){this['agents'][_0x21873d['channel'][_0xff53('0x46')]('-')[0x0]]=_[_0xff53('0x94')](this[_0xff53('0x1b')][_0x21873d[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]],[_0xff53('0x44')]);logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x21873d[_0xff53('0x38')],util[_0xff53('0x4c')]({'id':this['agents'][_0x21873d[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]]['id'],'destaccountcode':this[_0xff53('0x1b')][_0x21873d[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0xff53('0x36')](util[_0xff53('0x45')](_0xff53('0x95'),this['agents'][_0x21873d[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]][_0xff53('0x47')]),_0xff53('0x96'),{'id':this[_0xff53('0x1b')][_0x21873d[_0xff53('0x43')][_0xff53('0x46')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x21873d[_0xff53('0x43')]['split']('-')[0x0]][_0xff53('0x49')]});}}var _0x28396e=this;Promise[_0xff53('0x97')]()[_0xff53('0x98')](function(){var _0x1f8ba8=_0x28396e[_0xff53('0x1a')][_0x21873d[_0xff53('0x38')]];if(typeof _0x1f8ba8[_0xff53('0x99')]==='undefined')return;if(_[_0xff53('0x9a')](_0x1f8ba8[_0xff53('0x73')]))return;return RpcSetting[_0xff53('0x9b')]()[_0xff53('0x98')](function(_0x440bac){if(!_0x440bac[_0xff53('0x9c')])return;return Promise['resolve']()[_0xff53('0x98')](function(){return ami[_0xff53('0x9d')]({'action':'StopMixMonitor','channel':_0x1f8ba8[_0xff53('0x43')]})[_0xff53('0x9e')](function(){});})[_0xff53('0x98')](function(){return ami[_0xff53('0x9d')]({'action':_0xff53('0x9f'),'channel':_0x1f8ba8['destinationchannel']})[_0xff53('0x9e')](function(){})[_0xff53('0xa0')](function(){var _0x21ceb9=_0x28396e['agents'][_0x1f8ba8[_0xff53('0x6a')][_0xff53('0x46')]('-')[0x0]];if(!_0x21ceb9)return;io['emit'](_0xff53('0xa1'),{'agentId':_0x21ceb9['id'],'uniqueid':_0x1f8ba8[_0xff53('0x38')]});});});});})[_0xff53('0x98')](function(){if(_0x21873d[_0xff53('0xa2')]===_0xff53('0xa3')){_0x28396e[_0xff53('0x1c')][_0x21873d[_0xff53('0x38')]]=_0x28396e['channels'][_0x21873d[_0xff53('0x38')]];}else{if(_0x28396e['channels'][_0x21873d['uniqueid']]['type']===_0xff53('0xa4')&&_0x28396e[_0xff53('0x1c')][_0x21873d[_0xff53('0x38')]]){_0x28396e[_0xff53('0x1a')][_0x21873d[_0xff53('0x38')]][_0xff53('0x38')]=[_0x28396e['channels'][_0x21873d[_0xff53('0x38')]]['linkedid'],_0x28396e[_0xff53('0x1a')][_0x21873d[_0xff53('0x38')]][_0xff53('0x3d')]=_0x28396e[_0xff53('0x1a')][_0x21873d[_0xff53('0x38')]]['uniqueid']][0x0];delete _0x28396e[_0xff53('0x1c')][_0x21873d[_0xff53('0x38')]];}}logger['debug'](_0xff53('0xa5'),_0x21873d[_0xff53('0x38')],util['inspect'](_0x28396e['channels'][_0x21873d['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xff53('0x36')](_0xff53('0xa6'),_0x28396e[_0xff53('0x1a')][_0x21873d['uniqueid']]);delete _0x28396e['channels'][_0x21873d[_0xff53('0x38')]];});}}}catch(_0x5460e9){logger[_0xff53('0x31')]('[%s][voiceCallReport][hangup]',_0x21873d['uniqueid'],util[_0xff53('0x4c')](_0x5460e9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xff53('0x29')]=function(_0x42388d){try{if(this[_0xff53('0x34')](_0x42388d)){logger[_0xff53('0x2e')](_0xff53('0xa7'),_0x42388d[_0xff53('0x38')],_0x42388d[_0xff53('0xa8')],_0x42388d['transfertargetcalleridnum']);logger[_0xff53('0x3b')](_0xff53('0xa9'),_0x42388d[_0xff53('0x38')],util[_0xff53('0x4c')](_0x42388d,{'showHidden':![],'depth':null}));if(this[_0xff53('0x1a')][_0x42388d[_0xff53('0xaa')]]){this[_0xff53('0x1a')][_0x42388d[_0xff53('0xaa')]][_0xff53('0xab')]=_0x42388d['origtransferercalleridnum'];this[_0xff53('0x1a')][_0x42388d[_0xff53('0xaa')]]['transferconnectedlinenum']=_0x42388d[_0xff53('0xac')];if(this['channels'][_0x42388d['secondtransfereruniqueid']]){var _0x4ed3cf=this[_0xff53('0x1a')][_0x42388d[_0xff53('0xad')]];this['channels'][_0x42388d[_0xff53('0xad')]]=this[_0xff53('0x1a')][_0x42388d[_0xff53('0xaa')]];this['channels'][_0x42388d['transfereeuniqueid']]=_0x4ed3cf;}}else if(this['channels'][_0x42388d[_0xff53('0xae')]]){this[_0xff53('0x1a')][_0x42388d[_0xff53('0xae')]][_0xff53('0xab')]=_0x42388d['origtransferercalleridnum'];this[_0xff53('0x1a')][_0x42388d[_0xff53('0xae')]][_0xff53('0xaf')]=_0x42388d[_0xff53('0xac')];if(this[_0xff53('0x1a')][_0x42388d[_0xff53('0xb0')]]){var _0x4ed3cf=this['channels'][_0x42388d[_0xff53('0xb0')]];this[_0xff53('0x1a')][_0x42388d['origtransfereruniqueid']]=this[_0xff53('0x1a')][_0x42388d[_0xff53('0xae')]];this[_0xff53('0x1a')][_0x42388d[_0xff53('0xae')]]=_0x4ed3cf;}}if((this[_0xff53('0x1a')][_0x42388d[_0xff53('0xb0')]]||this[_0xff53('0x1a')][_0x42388d[_0xff53('0xb1')]])&&this[_0xff53('0x1a')][_0x42388d[_0xff53('0xad')]]){var _0x190092=_['some']([this['channels'][_0x42388d[_0xff53('0xb0')]],this[_0xff53('0x1a')][_0x42388d[_0xff53('0xb1')]],this['channels'][_0x42388d['secondtransfereruniqueid']]],function(_0x1031e3){return _0x1031e3&&_0x1031e3[_0xff53('0x80')]===_0xff53('0xa4')&&_0x1031e3['routeid'];});if(_0x190092){if(this['channels'][_0x42388d[_0xff53('0xb0')]])this[_0xff53('0x1a')][_0x42388d['origtransfereruniqueid']][_0xff53('0x99')]=_0xff53('0xb2');if(this['channels'][_0x42388d[_0xff53('0xb1')]])this['channels'][_0x42388d[_0xff53('0xb1')]][_0xff53('0x99')]=_0xff53('0xb2');this[_0xff53('0x1a')][_0x42388d[_0xff53('0xad')]][_0xff53('0x99')]='ATTENDED';}}}}catch(_0x597421){logger[_0xff53('0x31')](_0xff53('0xb3'),_0x42388d[_0xff53('0x38')],util['inspect'](_0x597421,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff53('0x33')][_0xff53('0x2b')]=function(_0x26b037){try{if(this[_0xff53('0x34')](_0x26b037)){logger[_0xff53('0x2e')](_0xff53('0xb4'),_0x26b037['uniqueid'],_0x26b037[_0xff53('0xb5')],_0x26b037[_0xff53('0xb6')]);logger[_0xff53('0x3b')](_0xff53('0xb7'),_0x26b037[_0xff53('0x38')],util[_0xff53('0x4c')](_0x26b037,{'showHidden':![],'depth':null}));if(this[_0xff53('0x1a')][_0x26b037['transfereeuniqueid']]){this[_0xff53('0x1a')][_0x26b037[_0xff53('0xaa')]][_0xff53('0xab')]=_0x26b037[_0xff53('0xb5')];this['channels'][_0x26b037[_0xff53('0xaa')]][_0xff53('0xaf')]=_0x26b037[_0xff53('0xb6')];this[_0xff53('0x1a')][_0x26b037[_0xff53('0xaa')]][_0xff53('0x99')]=_0xff53('0xb8');this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x26b037[_0xff53('0xaa')],'context':_0x26b037[_0xff53('0x41')],'channel':_0x26b037[_0xff53('0xb9')]});}else{this['channels'][_0x26b037[_0xff53('0xba')]][_0xff53('0x99')]=_0xff53('0xb8');}}}catch(_0x15eee0){logger['error'](_0xff53('0xbb'),_0x26b037[_0xff53('0x38')],util[_0xff53('0x4c')](_0x15eee0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff53('0x33')][_0xff53('0xbc')]=function(_0x234ac5){try{if(this[_0xff53('0x34')](_0x234ac5)){logger['debug'](_0xff53('0xbd'),_0x234ac5[_0xff53('0x38')],util[_0xff53('0x4c')](_0x234ac5,{'showHidden':![],'depth':null}));if(this[_0xff53('0x1a')][_0x234ac5[_0xff53('0x38')]]){if(!_[_0xff53('0x74')](this[_0xff53('0x1a')][_0x234ac5[_0xff53('0x38')]]['answertime'])){this['channels'][_0x234ac5[_0xff53('0x38')]][_0xff53('0xbe')]=moment()['format'](_0xff53('0x4f'));logger[_0xff53('0x2e')](_0xff53('0xbf'),_0x234ac5[_0xff53('0x38')],this[_0xff53('0x1a')][_0x234ac5['uniqueid']][_0xff53('0xbe')]);}}}}catch(_0x3d3a68){logger[_0xff53('0x31')](_0xff53('0xc0'),_0x234ac5[_0xff53('0x38')],util['inspect'](_0x3d3a68,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xff53('0x33')][_0xff53('0x2d')]=function(_0x56a825){try{if(this['isNotNull'](_0x56a825)){logger[_0xff53('0x3b')](_0xff53('0xc1'),_0x56a825[_0xff53('0x38')],util[_0xff53('0x4c')](_0x56a825,{'showHidden':![],'depth':null}));if(this[_0xff53('0x1a')][_0x56a825[_0xff53('0x38')]]){if(!_[_0xff53('0x74')](this[_0xff53('0x1a')][_0x56a825[_0xff53('0x38')]][_0xff53('0xbe')])){this['channels'][_0x56a825[_0xff53('0x38')]][_0xff53('0xc2')]+=moment()['milliseconds'](0x0)[_0xff53('0x68')](this[_0xff53('0x1a')][_0x56a825['uniqueid']][_0xff53('0xbe')],'seconds');logger[_0xff53('0x2e')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x56a825[_0xff53('0x38')],this[_0xff53('0x1a')][_0x56a825[_0xff53('0x38')]]['mohtime']);delete this['channels'][_0x56a825['uniqueid']][_0xff53('0xbe')];}}}}catch(_0x781bad){logger['error'](_0xff53('0xc3'),_0x56a825[_0xff53('0x38')],util[_0xff53('0x4c')](_0x781bad,{'showHidden':![],'depth':null}));}};module[_0xff53('0xc4')]=VoiceCallReport; \ No newline at end of file +var _0x20cf=['destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','diff','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','resolve','then','getSettings','Action','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','transferType','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','BLIND','BlindTransfer','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','lodash','util','path','ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','channels','merge','pick','from-sip','split','exten','xcally-motion-preview','channel','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','toNumber','channelstate','keys','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','disposition','includes','lastapplication','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','answered','answertime','connectedlinename','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','rec','[%s][voiceCallReport][mixMonitorFilename]','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','variable','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination'];(function(_0x41d34b,_0x25761a){var _0x6a64f7=function(_0x3acd19){while(--_0x3acd19){_0x41d34b['push'](_0x41d34b['shift']());}};_0x6a64f7(++_0x25761a);}(_0x20cf,0x108));var _0xf20c=function(_0x13310c,_0x1efe01){_0x13310c=_0x13310c-0x0;var _0x149348=_0x20cf[_0x13310c];return _0x149348;};'use strict';var BPromise=require('bluebird');var _=require(_0xf20c('0x0'));var moment=require('moment');var util=require(_0xf20c('0x1'));var path=require(_0xf20c('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xf20c('0x3'));var ami=require('../ami');var Channel=require(_0xf20c('0x4'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0xf20c('0x5'),_0xf20c('0x6'),_0xf20c('0x7'),_0xf20c('0x8'),_0xf20c('0x9'),_0xf20c('0xa'),_0xf20c('0xb'),_0xf20c('0xc'),_0xf20c('0xd')];var applications=[_0xf20c('0xe'),_0xf20c('0xf'),'agi',_0xf20c('0x10'),_0xf20c('0x11'),_0xf20c('0x12')];var dispositions=[_0xf20c('0x13'),_0xf20c('0x14'),_0xf20c('0x14'),_0xf20c('0x13'),_0xf20c('0x13'),_0xf20c('0x13'),'ANSWERED',_0xf20c('0x15'),_0xf20c('0x14'),_0xf20c('0x14'),_0xf20c('0x14')];var actions={};config[_0xf20c('0x16')]=_[_0xf20c('0x17')](config[_0xf20c('0x16')],{'host':_0xf20c('0x18'),'port':0x18eb});var io=require(_0xf20c('0x19'))(new Redis(config[_0xf20c('0x16')]));function VoiceCallReport(_0x506855){this['channels']=_0x506855['channels'];this[_0xf20c('0x1a')]=_0x506855[_0xf20c('0x1a')];this[_0xf20c('0x1b')]={};ami['on']('coreshowchannel',this[_0xf20c('0x1c')][_0xf20c('0x1d')](this));ami['on'](_0xf20c('0x1e'),this['syncNewExten']['bind'](this));ami['on'](_0xf20c('0x1f'),this[_0xf20c('0x20')][_0xf20c('0x1d')](this));ami['on'](_0xf20c('0x21'),this[_0xf20c('0x22')]['bind'](this));ami['on'](_0xf20c('0x23'),this[_0xf20c('0x24')][_0xf20c('0x1d')](this));ami['on'](_0xf20c('0x25'),this[_0xf20c('0x26')]['bind'](this));ami['on'](_0xf20c('0x27'),this[_0xf20c('0x28')][_0xf20c('0x1d')](this));ami['on'](_0xf20c('0x29'),this[_0xf20c('0x2a')][_0xf20c('0x1d')](this));ami['on'](_0xf20c('0x2b'),this[_0xf20c('0x2c')][_0xf20c('0x1d')](this));ami['on'](_0xf20c('0x2d'),this[_0xf20c('0x2e')]['bind'](this));ami['on'](_0xf20c('0x2f'),this[_0xf20c('0x30')][_0xf20c('0x1d')](this));try{logger['info'](_0xf20c('0x31'));ami[_0xf20c('0x32')]();}catch(_0x541e44){logger[_0xf20c('0x33')](_0xf20c('0x34'),util[_0xf20c('0x35')](_0x541e44,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf20c('0x36')]['isNotNull']=function(_0x1d8417){return _0x1d8417!==null&&!_['isUndefined'](_0x1d8417);};VoiceCallReport[_0xf20c('0x36')][_0xf20c('0x37')]=function(_0x2098c9,_0x48e390,_0x32e610){io['to'](_0x2098c9)[_0xf20c('0x37')](_0x48e390,_0x32e610);};VoiceCallReport[_0xf20c('0x36')][_0xf20c('0x28')]=function(_0x3a26c4){try{if(this['isNotNull'](_0x3a26c4)){logger[_0xf20c('0x38')](_0xf20c('0x39'),_0x3a26c4[_0xf20c('0x3a')],_0x3a26c4['calleridname'],_0x3a26c4[_0xf20c('0x3b')]);logger[_0xf20c('0x3c')](_0xf20c('0x3d'),_0x3a26c4[_0xf20c('0x3a')],util['inspect'](_0x3a26c4,{'showHidden':![],'depth':null}));if(_0x3a26c4[_0xf20c('0x3a')]===_0x3a26c4[_0xf20c('0x3e')]){if(!_[_0xf20c('0x3f')](this[_0xf20c('0x40')][_0x3a26c4['uniqueid']])){_[_0xf20c('0x41')](this[_0xf20c('0x40')][_0x3a26c4['uniqueid']],_[_0xf20c('0x42')](_0x3a26c4,_['keys'](this[_0xf20c('0x40')][_0x3a26c4[_0xf20c('0x3a')]])));}}if(_0x3a26c4['context']===_0xf20c('0x43')){if(this[_0xf20c('0x1a')][_0x3a26c4['channel'][_0xf20c('0x44')]('-')[0x0]]){if(_0x3a26c4[_0xf20c('0x45')]==_0xf20c('0x46')){this['agents'][_0x3a26c4[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]][_0xf20c('0x48')]=_0x3a26c4[_0xf20c('0x49')];this['emit'](util[_0xf20c('0x4a')](_0xf20c('0x4b'),this['agents'][_0x3a26c4[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]][_0xf20c('0x4c')]),_0xf20c('0x4d'),{'destaccountcode':this['agents'][_0x3a26c4[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]][_0xf20c('0x4e')],'destconnectedlinenum':_0x3a26c4['connectedlinenum']});}}}}}catch(_0x49c7ac){logger[_0xf20c('0x33')](_0xf20c('0x4f'),_0x3a26c4['uniqueid'],util[_0xf20c('0x35')](_0x49c7ac,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf20c('0x20')]=function(_0x5a620e){try{if(this[_0xf20c('0x50')](_0x5a620e)){logger[_0xf20c('0x3c')](_0xf20c('0x51'),_0x5a620e[_0xf20c('0x3a')],util[_0xf20c('0x35')](_0x5a620e,{'showHidden':![],'depth':null}));if(_0x5a620e[_0xf20c('0x3a')]===_0x5a620e[_0xf20c('0x3e')]&&_0x5a620e[_0xf20c('0x47')]!=_0xf20c('0x52')){if(_[_0xf20c('0x3f')](this[_0xf20c('0x40')][_0x5a620e[_0xf20c('0x3a')]])){logger['info'](_0xf20c('0x53'),_0x5a620e[_0xf20c('0x3a')],_0x5a620e[_0xf20c('0x54')],_0x5a620e[_0xf20c('0x45')]);this[_0xf20c('0x40')][_0x5a620e[_0xf20c('0x3a')]]=new Channel();this['channels'][_0x5a620e[_0xf20c('0x3a')]][_0xf20c('0x55')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xf20c('0x40')][_0x5a620e[_0xf20c('0x3a')]]['disposition']=dispositions[_[_0xf20c('0x56')](_0x5a620e[_0xf20c('0x57')])];_[_0xf20c('0x41')](this['channels'][_0x5a620e[_0xf20c('0x3a')]],_[_0xf20c('0x42')](_0x5a620e,_[_0xf20c('0x58')](this[_0xf20c('0x40')][_0x5a620e[_0xf20c('0x3a')]])));if(_0x5a620e[_0xf20c('0x54')]==='from-sip'){if(this[_0xf20c('0x1a')][_0x5a620e['channel'][_0xf20c('0x44')]('-')[0x0]]){if(_[_0xf20c('0x3f')](this[_0xf20c('0x1a')][_0x5a620e[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]][_0xf20c('0x48')])){this['agents'][_0x5a620e[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]][_0xf20c('0x48')]=_0x5a620e[_0xf20c('0x45')];logger[_0xf20c('0x3c')](_0xf20c('0x59'),_0x5a620e[_0xf20c('0x3a')],util['inspect']({'destaccountcode':this[_0xf20c('0x1a')][_0x5a620e['channel'][_0xf20c('0x44')]('-')[0x0]][_0xf20c('0x4e')],'destconnectedlinenum':_0x5a620e[_0xf20c('0x45')]},{'showHidden':![],'depth':null}));this[_0xf20c('0x37')](util['format']('user:%s',this[_0xf20c('0x1a')][_0x5a620e[_0xf20c('0x47')]['split']('-')[0x0]]['name']),_0xf20c('0x4d'),{'destaccountcode':this[_0xf20c('0x1a')][_0x5a620e[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5a620e['exten']});}}}}}}}catch(_0x487f35){logger[_0xf20c('0x33')]('[%s][voiceCallReport][newchannel]',_0x5a620e[_0xf20c('0x3a')],util[_0xf20c('0x35')](_0x487f35,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf20c('0x36')][_0xf20c('0x1c')]=function(_0x9f73ad){try{if(this[_0xf20c('0x50')](_0x9f73ad)){logger[_0xf20c('0x3c')]('[%s][voiceCallReport][newexten]\x20event:',_0x9f73ad[_0xf20c('0x3a')],util['inspect'](_0x9f73ad,{'showHidden':![],'depth':null}));if(_0x9f73ad[_0xf20c('0x3a')]===_0x9f73ad['linkedid']&&_0x9f73ad['exten']!='h'&&_0x9f73ad[_0xf20c('0x47')]!=_0xf20c('0x52')){_0x9f73ad[_0xf20c('0x5a')]=_0x9f73ad[_0xf20c('0x5a')][_0xf20c('0x5b')]();_0x9f73ad[_0xf20c('0x5c')]=_0x9f73ad[_0xf20c('0x5d')]&&_0x9f73ad[_0xf20c('0x5d')]['startsWith']('CDR(routeAlias)')?_0x9f73ad[_0xf20c('0x5d')]:(_0x9f73ad[_0xf20c('0x5d')]||_0x9f73ad['applicationdata'])[_0xf20c('0x5b')]();logger[_0xf20c('0x38')](_0xf20c('0x5e'),_0x9f73ad[_0xf20c('0x3a')],_0x9f73ad[_0xf20c('0x5a')],_0x9f73ad[_0xf20c('0x5c')]);if(_['isUndefined'](this['channels'][_0x9f73ad[_0xf20c('0x3a')]])){this['channels'][_0x9f73ad[_0xf20c('0x3a')]]=new Channel();this[_0xf20c('0x40')][_0x9f73ad[_0xf20c('0x3a')]][_0xf20c('0x55')]=_0x9f73ad[_0xf20c('0x5f')]?moment()[_0xf20c('0x60')](moment[_0xf20c('0x5f')](_0x9f73ad[_0xf20c('0x5f')])['seconds'](),_0xf20c('0x61'))[_0xf20c('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format'](_0xf20c('0x62'));this[_0xf20c('0x40')][_0x9f73ad['uniqueid']][_0xf20c('0x63')]=_0xf20c('0x13');}_[_0xf20c('0x41')](this[_0xf20c('0x40')][_0x9f73ad[_0xf20c('0x3a')]],_[_0xf20c('0x42')](_0x9f73ad,_[_0xf20c('0x58')](this[_0xf20c('0x40')][_0x9f73ad[_0xf20c('0x3a')]])));if(_[_0xf20c('0x64')](applications,_0x9f73ad[_0xf20c('0x5a')])){this[_0xf20c('0x40')][_0x9f73ad[_0xf20c('0x3a')]][_0xf20c('0x65')]=_0x9f73ad[_0xf20c('0x5a')];this[_0xf20c('0x40')][_0x9f73ad[_0xf20c('0x3a')]]['lastdata']=_0x9f73ad[_0xf20c('0x5c')];if(_0x9f73ad[_0xf20c('0x5a')]===_0xf20c('0xe')&&_[_0xf20c('0x66')](_0x9f73ad['applicationdata'][_0xf20c('0x5b')](),_0xf20c('0x67'))){var _0x4716e4=_0x9f73ad[_0xf20c('0x5c')]['split']('=');var _0x842363=_0x4716e4[0x0][_0xf20c('0x5b')]()[_0xf20c('0x68')](/cdr\((.*)\)/);if(_0x842363){this[_0xf20c('0x40')][_0x9f73ad['uniqueid']][_0x842363[0x1]]=_0x4716e4[0x1];}}else if(_0x9f73ad[_0xf20c('0x5a')]===_0xf20c('0xf')){this[_0xf20c('0x40')][_0x9f73ad[_0xf20c('0x3a')]][_0xf20c('0xf')]=_0x9f73ad['applicationdata']['split'](',')[0x0];}}}}}catch(_0x1b0736){logger[_0xf20c('0x33')](_0xf20c('0x69'),_0x9f73ad[_0xf20c('0x3a')],util[_0xf20c('0x35')](_0x1b0736,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf20c('0x36')]['syncNewState']=function(_0x3984e3){try{if(this[_0xf20c('0x50')](_0x3984e3)){logger['info'](_0xf20c('0x6a'),_0x3984e3[_0xf20c('0x3a')],_0x3984e3[_0xf20c('0x3e')],_0x3984e3[_0xf20c('0x6b')],_0x3984e3[_0xf20c('0x3b')]);logger[_0xf20c('0x3c')]('[%s][voiceCallReport][newstate]\x20event:',_0x3984e3['uniqueid'],util['inspect'](_0x3984e3,{'showHidden':![],'depth':null}));if(_0x3984e3[_0xf20c('0x3a')]!==_0x3984e3[_0xf20c('0x3e')]){if(this[_0xf20c('0x40')][_0x3984e3['linkedid']]){if(_0x3984e3[_0xf20c('0x57')]==='6'){if(!this[_0xf20c('0x40')][_0x3984e3[_0xf20c('0x3e')]][_0xf20c('0x6c')]){var _0x1f93c1=moment();this[_0xf20c('0x40')][_0x3984e3[_0xf20c('0x3e')]][_0xf20c('0x6c')]=!![];this['channels'][_0x3984e3['linkedid']][_0xf20c('0x6d')]=_0x1f93c1[_0xf20c('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x3984e3[_0xf20c('0x3e')]]['starttime']){this[_0xf20c('0x40')][_0x3984e3[_0xf20c('0x3e')]]['holdtime']=_0x1f93c1['diff'](this['channels'][_0x3984e3[_0xf20c('0x3e')]][_0xf20c('0x55')],_0xf20c('0x61'));}}this[_0xf20c('0x40')][_0x3984e3[_0xf20c('0x3e')]]['linkedid']=_0x3984e3[_0xf20c('0x3a')];if(_0x3984e3[_0xf20c('0x3b')]!==_0xf20c('0x46')){this['channels'][_0x3984e3[_0xf20c('0x3e')]]['connectedlinenum']=_0x3984e3[_0xf20c('0x3b')];}this[_0xf20c('0x40')][_0x3984e3[_0xf20c('0x3e')]][_0xf20c('0x6e')]=_0x3984e3[_0xf20c('0x6b')];this['channels'][_0x3984e3[_0xf20c('0x3e')]][_0xf20c('0x6f')]=_0x3984e3[_0xf20c('0x47')];this[_0xf20c('0x40')][_0x3984e3[_0xf20c('0x3e')]][_0xf20c('0x63')]=dispositions[_['toNumber'](_0x3984e3['channelstate'])];if(this[_0xf20c('0x1a')][_0x3984e3[_0xf20c('0x47')]['split']('-')[0x0]]){this[_0xf20c('0x40')][_0x3984e3[_0xf20c('0x3e')]][_0xf20c('0x70')]=this[_0xf20c('0x1a')][_0x3984e3['channel'][_0xf20c('0x44')]('-')[0x0]]['id'];this['channels'][_0x3984e3[_0xf20c('0x3e')]][_0xf20c('0x71')]=this[_0xf20c('0x1a')][_0x3984e3[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x3984e3[_0xf20c('0x3a')]]){if(_0x3984e3[_0xf20c('0x57')]==='6'){if(this['agents'][_0x3984e3[_0xf20c('0x47')]['split']('-')[0x0]]){this[_0xf20c('0x40')][_0x3984e3['uniqueid']]['UserId']=this[_0xf20c('0x1a')][_0x3984e3[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]]['id'];this['channels'][_0x3984e3[_0xf20c('0x3a')]][_0xf20c('0x71')]=this[_0xf20c('0x1a')][_0x3984e3['channel'][_0xf20c('0x44')]('-')[0x0]][_0xf20c('0x4c')];}}}}if(_0x3984e3[_0xf20c('0x57')]==='6'&&_0x3984e3[_0xf20c('0x54')]===_0xf20c('0x43')){if(this[_0xf20c('0x1a')][_0x3984e3[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]]){this['agents'][_0x3984e3[_0xf20c('0x47')]['split']('-')[0x0]][_0xf20c('0x48')]=_0x3984e3[_0xf20c('0x45')];var _0x15b97e;if(this[_0xf20c('0x40')][_0x3984e3[_0xf20c('0x3a')]])_0x15b97e=this[_0xf20c('0x40')][_0x3984e3[_0xf20c('0x3a')]]['routealias'];else if(this[_0xf20c('0x40')][_0x3984e3[_0xf20c('0x3e')]])_0x15b97e=this['channels'][_0x3984e3['linkedid']][_0xf20c('0x72')];logger[_0xf20c('0x3c')](_0xf20c('0x73'),_0x3984e3[_0xf20c('0x3a')],util['inspect']({'destaccountcode':this['agents'][_0x3984e3[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x3984e3[_0xf20c('0x45')],'routealias':_0x15b97e},{'showHidden':![],'depth':null}));this[_0xf20c('0x37')](util['format'](_0xf20c('0x4b'),this[_0xf20c('0x1a')][_0x3984e3['channel'][_0xf20c('0x44')]('-')[0x0]]['name']),_0xf20c('0x4d'),{'destaccountcode':this[_0xf20c('0x1a')][_0x3984e3[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]][_0xf20c('0x4e')],'destconnectedlinenum':_0x3984e3[_0xf20c('0x45')],'routealias':_0x15b97e});}}}}catch(_0x40544f){logger[_0xf20c('0x33')](_0xf20c('0x74'),_0x3984e3['uniqueid'],util[_0xf20c('0x35')](_0x40544f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf20c('0x75')]=function(_0x46d78f,_0x7c3a20){try{if(this['channels'][_0x46d78f]){logger['info'](_0xf20c('0x76'),_0x46d78f,_0x7c3a20);this[_0xf20c('0x40')][_0x46d78f][_0xf20c('0x77')]=!![];if(_[_0xf20c('0x78')](_0x7c3a20,_0xf20c('0x79'))){_0x7c3a20=_0x7c3a20[_0xf20c('0x7a')](_0xf20c('0x79'),_0xf20c('0x7b'));}this[_0xf20c('0x40')][_0x46d78f][_0xf20c('0x7c')]=_0x7c3a20;var _0x9635ba=_[_0xf20c('0x7d')](this[_0xf20c('0x40')][_0x46d78f][_0xf20c('0x7e')],{'filename':_0x7c3a20});if(_[_0xf20c('0x7f')](_0x9635ba)){this[_0xf20c('0x40')][_0x46d78f][_0xf20c('0x7e')]['push']({'filename':_0x7c3a20,'createdAt':moment()[_0xf20c('0x4a')](_0xf20c('0x62')),'mixmonitorid':'','status':_0xf20c('0x80')});}}}catch(_0x3c70aa){logger[_0xf20c('0x33')](_0xf20c('0x81'),_0x46d78f,util[_0xf20c('0x35')](_0x3c70aa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf20c('0x36')]['syncVarSet']=function(_0xac0780){try{if(this[_0xf20c('0x50')](_0xac0780)){logger[_0xf20c('0x3c')]('[%s][voiceCallReport][varset]\x20event:',_0xac0780[_0xf20c('0x3a')],util['inspect'](_0xac0780,{'showHidden':![],'depth':null}));if(this[_0xf20c('0x40')][_0xac0780[_0xf20c('0x3a')]]&&_0xac0780[_0xf20c('0x47')]!=_0xf20c('0x52')){if(this['isNotNull'](_0xac0780['variable'])){if(this[_0xf20c('0x50')](_0xac0780['variable'][_0xf20c('0x82')])){logger['info'](_0xf20c('0x83'),_0xac0780[_0xf20c('0x3a')],_0xac0780[_0xf20c('0x84')]);this[_0xf20c('0x75')](_0xac0780[_0xf20c('0x3a')],_0xac0780[_0xf20c('0x84')]);}else if(this['isNotNull'](_0xac0780[_0xf20c('0x85')]['xmd-phone'])){logger[_0xf20c('0x38')](_0xf20c('0x86'),_0xac0780[_0xf20c('0x3a')],_0xac0780[_0xf20c('0x84')]);this[_0xf20c('0x40')][_0xac0780['uniqueid']][_0xf20c('0x3b')]=_0xac0780[_0xf20c('0x84')];}else if(this[_0xf20c('0x50')](_0xac0780['variable'][_0xf20c('0x87')])){logger[_0xf20c('0x38')](_0xf20c('0x88'),_0xac0780[_0xf20c('0x3a')],_0xac0780[_0xf20c('0x84')]);this[_0xf20c('0x40')][_0xac0780[_0xf20c('0x3a')]]['callerid']=_0xac0780[_0xf20c('0x84')];}else if(this['isNotNull'](_0xac0780['variable']['xmd-cdrtype'])){logger[_0xf20c('0x38')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xac0780[_0xf20c('0x3a')],_0xac0780[_0xf20c('0x84')]);this[_0xf20c('0x40')][_0xac0780[_0xf20c('0x3a')]][_0xf20c('0x89')]=_0xac0780[_0xf20c('0x84')];}else if(this[_0xf20c('0x50')](_0xac0780[_0xf20c('0x85')]['xmd-queue'])){logger[_0xf20c('0x38')](_0xf20c('0x8a'),_0xac0780['uniqueid'],_0xac0780[_0xf20c('0x84')]['split'](',')[0x0]);this[_0xf20c('0x40')][_0xac0780['uniqueid']][_0xf20c('0xf')]=_0xac0780[_0xf20c('0x84')][_0xf20c('0x44')](',')[0x0];}else if(this['isNotNull'](_0xac0780[_0xf20c('0x85')]['xmd-originatecalleridnum'])){logger[_0xf20c('0x38')](_0xf20c('0x8b'),_0xac0780[_0xf20c('0x3a')],_0xac0780[_0xf20c('0x84')]);this[_0xf20c('0x40')][_0xac0780[_0xf20c('0x3a')]][_0xf20c('0x8c')]=_0xac0780[_0xf20c('0x84')];}else if(this['isNotNull'](_0xac0780[_0xf20c('0x85')][_0xf20c('0x8d')])){logger[_0xf20c('0x38')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0xac0780[_0xf20c('0x3a')],_0xac0780[_0xf20c('0x84')]);this[_0xf20c('0x40')][_0xac0780[_0xf20c('0x3a')]][_0xf20c('0x8e')]=_0xac0780[_0xf20c('0x84')];}else if(this[_0xf20c('0x50')](_0xac0780[_0xf20c('0x85')][_0xf20c('0x8f')])){logger[_0xf20c('0x38')](_0xf20c('0x90'),_0xac0780[_0xf20c('0x3a')],_0xac0780[_0xf20c('0x84')]);this['channels'][_0xac0780[_0xf20c('0x3a')]][_0xf20c('0x91')]=_0xac0780[_0xf20c('0x84')];}else if(this['isNotNull'](_0xac0780[_0xf20c('0x85')][_0xf20c('0x92')])){logger[_0xf20c('0x38')](_0xf20c('0x93'),_0xac0780['uniqueid'],_0xac0780[_0xf20c('0x84')]);this['channels'][_0xac0780['uniqueid']]['queue']=_0xac0780['value'];}else if(this['isNotNull'](_0xac0780[_0xf20c('0x85')]['sipcallid'])){logger[_0xf20c('0x38')](_0xf20c('0x94'),_0xac0780[_0xf20c('0x3a')],_0xac0780[_0xf20c('0x84')]);this['channels'][_0xac0780[_0xf20c('0x3a')]][_0xf20c('0x95')]=_0xac0780[_0xf20c('0x84')];}}}else if(this['isNotNull'](_0xac0780['variable'][_0xf20c('0x82')])){if(_0xac0780[_0xf20c('0x84')]){var _0xf6ff54=path[_0xf20c('0x96')](_0xac0780[_0xf20c('0x84')])['name'];logger[_0xf20c('0x38')](_0xf20c('0x83'),_0xf6ff54,_0xac0780[_0xf20c('0x84')]);this['syncMixMonitorFilename'](_0xf6ff54,_0xac0780[_0xf20c('0x84')]);}}else if(this[_0xf20c('0x40')][_0xac0780['linkedid']]){if(this[_0xf20c('0x50')](_0xac0780[_0xf20c('0x85')])){if(this[_0xf20c('0x50')](_0xac0780['variable'][_0xf20c('0x97')])){logger[_0xf20c('0x38')](_0xf20c('0x94'),_0xac0780['linkedid'],_0xac0780[_0xf20c('0x84')]);this[_0xf20c('0x40')][_0xac0780[_0xf20c('0x3e')]][_0xf20c('0x98')]=_0xac0780['value'];}}}}}catch(_0x23f943){logger[_0xf20c('0x33')](_0xf20c('0x99'),_0xac0780[_0xf20c('0x3a')],util['inspect'](_0x23f943,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x4bffe4){try{if(this['isNotNull'](_0x4bffe4)){logger[_0xf20c('0x3c')](_0xf20c('0x9a'),_0x4bffe4['uniqueid'],util[_0xf20c('0x35')](_0x4bffe4,{'showHidden':![],'depth':null}));if(this[_0xf20c('0x40')][_0x4bffe4['uniqueid']]){logger[_0xf20c('0x38')](_0xf20c('0x9b'),_0x4bffe4[_0xf20c('0x3a')],_0x4bffe4[_0xf20c('0x9c')]);var _0x291cb8=moment();this['channels'][_0x4bffe4[_0xf20c('0x3a')]][_0xf20c('0x9d')]=_0x291cb8['format'](_0xf20c('0x62'));this[_0xf20c('0x40')][_0x4bffe4[_0xf20c('0x3a')]][_0xf20c('0x5f')]=_0x291cb8['diff'](this[_0xf20c('0x40')][_0x4bffe4[_0xf20c('0x3a')]][_0xf20c('0x55')],_0xf20c('0x61'));if(this['channels'][_0x4bffe4[_0xf20c('0x3a')]][_0xf20c('0x6c')]){this[_0xf20c('0x40')][_0x4bffe4[_0xf20c('0x3a')]][_0xf20c('0x9e')]=_0x291cb8[_0xf20c('0x9f')](this['channels'][_0x4bffe4[_0xf20c('0x3a')]][_0xf20c('0x6d')],_0xf20c('0x61'));this['channels'][_0x4bffe4[_0xf20c('0x3a')]][_0xf20c('0xa0')]=this[_0xf20c('0x40')][_0x4bffe4['uniqueid']][_0xf20c('0x5f')]-this['channels'][_0x4bffe4[_0xf20c('0x3a')]][_0xf20c('0x9e')];}if(_0x4bffe4['context']===_0xf20c('0x43')){if(this[_0xf20c('0x1a')][_0x4bffe4[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]]){this[_0xf20c('0x1a')][_0x4bffe4[_0xf20c('0x47')]['split']('-')[0x0]]=_[_0xf20c('0xa1')](this[_0xf20c('0x1a')][_0x4bffe4[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]],[_0xf20c('0x48')]);logger[_0xf20c('0x3c')](_0xf20c('0xa2'),_0x4bffe4[_0xf20c('0x3a')],util['inspect']({'id':this[_0xf20c('0x1a')][_0x4bffe4['channel'][_0xf20c('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0xf20c('0x1a')][_0x4bffe4[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0xf20c('0x37')](util['format']('user:%s',this['agents'][_0x4bffe4['channel'][_0xf20c('0x44')]('-')[0x0]]['name']),'user:agentcomplete',{'id':this[_0xf20c('0x1a')][_0x4bffe4[_0xf20c('0x47')][_0xf20c('0x44')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x4bffe4[_0xf20c('0x47')]['split']('-')[0x0]][_0xf20c('0x4e')]});}}var _0x4559ff=this;Promise[_0xf20c('0xa3')]()[_0xf20c('0xa4')](function(){var _0x5f2f75=_0x4559ff[_0xf20c('0x40')][_0x4bffe4[_0xf20c('0x3a')]];if(typeof _0x5f2f75['transferType']==='undefined')return;if(_['isEmpty'](_0x5f2f75[_0xf20c('0x7e')]))return;return RpcSetting[_0xf20c('0xa5')]()['then'](function(_0x32b4e7){if(!_0x32b4e7['stopRecordingOnTransfer'])return;return Promise[_0xf20c('0xa3')]()[_0xf20c('0xa4')](function(){return ami[_0xf20c('0xa6')]({'action':'StopMixMonitor','channel':_0x5f2f75[_0xf20c('0x47')]})['catch'](function(){});})[_0xf20c('0xa4')](function(){return ami[_0xf20c('0xa6')]({'action':'StopMixMonitor','channel':_0x5f2f75['destinationchannel']})['catch'](function(){})[_0xf20c('0xa7')](function(){var _0x476d71=_0x4559ff[_0xf20c('0x1a')][_0x5f2f75['destinationchannel']['split']('-')[0x0]];if(!_0x476d71)return;io[_0xf20c('0x37')](_0xf20c('0xa8'),{'agentId':_0x476d71['id'],'uniqueid':_0x5f2f75[_0xf20c('0x3a')]});});});});})['then'](function(){if(_0x4bffe4[_0xf20c('0xa9')]==='BlindTransfer'){_0x4559ff['blindTransfers'][_0x4bffe4[_0xf20c('0x3a')]]=_0x4559ff[_0xf20c('0x40')][_0x4bffe4[_0xf20c('0x3a')]];}else{if(_0x4559ff[_0xf20c('0x40')][_0x4bffe4[_0xf20c('0x3a')]][_0xf20c('0x89')]===_0xf20c('0xaa')&&_0x4559ff[_0xf20c('0x1b')][_0x4bffe4[_0xf20c('0x3a')]]){_0x4559ff['channels'][_0x4bffe4[_0xf20c('0x3a')]][_0xf20c('0x3a')]=[_0x4559ff[_0xf20c('0x40')][_0x4bffe4[_0xf20c('0x3a')]][_0xf20c('0x3e')],_0x4559ff['channels'][_0x4bffe4[_0xf20c('0x3a')]][_0xf20c('0x3e')]=_0x4559ff['channels'][_0x4bffe4['uniqueid']]['uniqueid']][0x0];delete _0x4559ff['blindTransfers'][_0x4bffe4[_0xf20c('0x3a')]];}}logger['debug'](_0xf20c('0xab'),_0x4bffe4[_0xf20c('0x3a')],util['inspect'](_0x4559ff[_0xf20c('0x40')][_0x4bffe4[_0xf20c('0x3a')]],{'showHidden':![],'depth':null}));ami[_0xf20c('0x37')]('custom:voiceCallReport',_0x4559ff[_0xf20c('0x40')][_0x4bffe4['uniqueid']]);delete _0x4559ff[_0xf20c('0x40')][_0x4bffe4[_0xf20c('0x3a')]];});}}}catch(_0x15f11a){logger[_0xf20c('0x33')](_0xf20c('0xac'),_0x4bffe4[_0xf20c('0x3a')],util[_0xf20c('0x35')](_0x15f11a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf20c('0x36')][_0xf20c('0x2a')]=function(_0x49bb51){try{if(this['isNotNull'](_0x49bb51)){logger[_0xf20c('0x38')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x49bb51[_0xf20c('0x3a')],_0x49bb51[_0xf20c('0xad')],_0x49bb51[_0xf20c('0xae')]);logger[_0xf20c('0x3c')](_0xf20c('0xaf'),_0x49bb51[_0xf20c('0x3a')],util[_0xf20c('0x35')](_0x49bb51,{'showHidden':![],'depth':null}));if(this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb0')]]){this[_0xf20c('0x40')][_0x49bb51['transfereeuniqueid']]['transfercalleridnum']=_0x49bb51[_0xf20c('0xad')];this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb0')]][_0xf20c('0xb1')]=_0x49bb51[_0xf20c('0xae')];if(this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb2')]]){var _0x2d7b4d=this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb2')]];this['channels'][_0x49bb51['secondtransfereruniqueid']]=this['channels'][_0x49bb51[_0xf20c('0xb0')]];this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb0')]]=_0x2d7b4d;}}else if(this['channels'][_0x49bb51[_0xf20c('0xb3')]]){this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb3')]][_0xf20c('0xb4')]=_0x49bb51[_0xf20c('0xad')];this['channels'][_0x49bb51[_0xf20c('0xb3')]][_0xf20c('0xb1')]=_0x49bb51[_0xf20c('0xae')];if(this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb5')]]){var _0x2d7b4d=this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb5')]];this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb5')]]=this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb3')]];this['channels'][_0x49bb51[_0xf20c('0xb3')]]=_0x2d7b4d;}}if((this[_0xf20c('0x40')][_0x49bb51['origtransfereruniqueid']]||this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb6')]])&&this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb2')]]){var _0x6cea29=_[_0xf20c('0xb7')]([this['channels'][_0x49bb51[_0xf20c('0xb5')]],this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb6')]],this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb2')]]],function(_0x32fca4){return _0x32fca4&&_0x32fca4[_0xf20c('0x89')]===_0xf20c('0xaa')&&_0x32fca4[_0xf20c('0xb8')];});if(_0x6cea29){if(this[_0xf20c('0x40')][_0x49bb51['origtransfereruniqueid']])this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb5')]]['transferType']=_0xf20c('0xb9');if(this['channels'][_0x49bb51[_0xf20c('0xb6')]])this['channels'][_0x49bb51[_0xf20c('0xb6')]][_0xf20c('0xba')]=_0xf20c('0xb9');this[_0xf20c('0x40')][_0x49bb51[_0xf20c('0xb2')]][_0xf20c('0xba')]=_0xf20c('0xb9');}}}}catch(_0x3e3b99){logger[_0xf20c('0x33')](_0xf20c('0xbb'),_0x49bb51[_0xf20c('0x3a')],util[_0xf20c('0x35')](_0x3e3b99,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf20c('0x36')][_0xf20c('0x2c')]=function(_0x2ae564){try{if(this[_0xf20c('0x50')](_0x2ae564)){logger[_0xf20c('0x38')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x2ae564[_0xf20c('0x3a')],_0x2ae564[_0xf20c('0xbc')],_0x2ae564[_0xf20c('0xbd')]);logger[_0xf20c('0x3c')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x2ae564[_0xf20c('0x3a')],util[_0xf20c('0x35')](_0x2ae564,{'showHidden':![],'depth':null}));if(this[_0xf20c('0x40')][_0x2ae564['transfereeuniqueid']]){this[_0xf20c('0x40')][_0x2ae564[_0xf20c('0xb0')]][_0xf20c('0xb4')]=_0x2ae564[_0xf20c('0xbc')];this[_0xf20c('0x40')][_0x2ae564['transfereeuniqueid']][_0xf20c('0xb1')]=_0x2ae564[_0xf20c('0xbd')];this['channels'][_0x2ae564['transfereeuniqueid']]['transferType']=_0xf20c('0xbe');this[_0xf20c('0x26')]({'event':_0xf20c('0xbf'),'uniqueid':_0x2ae564[_0xf20c('0xb0')],'context':_0x2ae564['context'],'channel':_0x2ae564['transfererchannel']});}else{this['channels'][_0x2ae564[_0xf20c('0xc0')]]['transferType']=_0xf20c('0xbe');}}}catch(_0x1e334e){logger[_0xf20c('0x33')](_0xf20c('0xc1'),_0x2ae564[_0xf20c('0x3a')],util[_0xf20c('0x35')](_0x1e334e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf20c('0x36')]['syncMusicOnHoldStart']=function(_0x1b79ff){try{if(this[_0xf20c('0x50')](_0x1b79ff)){logger[_0xf20c('0x3c')](_0xf20c('0xc2'),_0x1b79ff[_0xf20c('0x3a')],util['inspect'](_0x1b79ff,{'showHidden':![],'depth':null}));if(this[_0xf20c('0x40')][_0x1b79ff[_0xf20c('0x3a')]]){if(!_[_0xf20c('0x7f')](this[_0xf20c('0x40')][_0x1b79ff['uniqueid']][_0xf20c('0x6d')])){this[_0xf20c('0x40')][_0x1b79ff[_0xf20c('0x3a')]][_0xf20c('0xc3')]=moment()[_0xf20c('0x4a')](_0xf20c('0x62'));logger[_0xf20c('0x38')](_0xf20c('0xc4'),_0x1b79ff['uniqueid'],this[_0xf20c('0x40')][_0x1b79ff['uniqueid']][_0xf20c('0xc3')]);}}}}catch(_0x1ed7a0){logger[_0xf20c('0x33')](_0xf20c('0xc5'),_0x1b79ff[_0xf20c('0x3a')],util[_0xf20c('0x35')](_0x1ed7a0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf20c('0x36')][_0xf20c('0x30')]=function(_0x4cea6a){try{if(this[_0xf20c('0x50')](_0x4cea6a)){logger[_0xf20c('0x3c')](_0xf20c('0xc6'),_0x4cea6a['uniqueid'],util[_0xf20c('0x35')](_0x4cea6a,{'showHidden':![],'depth':null}));if(this[_0xf20c('0x40')][_0x4cea6a[_0xf20c('0x3a')]]){if(!_[_0xf20c('0x7f')](this[_0xf20c('0x40')][_0x4cea6a[_0xf20c('0x3a')]]['mohstarttime'])){this[_0xf20c('0x40')][_0x4cea6a[_0xf20c('0x3a')]][_0xf20c('0xc7')]+=moment()[_0xf20c('0xc8')](0x0)[_0xf20c('0x9f')](this[_0xf20c('0x40')][_0x4cea6a[_0xf20c('0x3a')]][_0xf20c('0xc3')],'seconds');logger[_0xf20c('0x38')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x4cea6a[_0xf20c('0x3a')],this[_0xf20c('0x40')][_0x4cea6a[_0xf20c('0x3a')]][_0xf20c('0xc7')]);delete this[_0xf20c('0x40')][_0x4cea6a[_0xf20c('0x3a')]][_0xf20c('0xc3')];}}}}catch(_0x1809d3){logger[_0xf20c('0x33')](_0xf20c('0xc9'),_0x4cea6a[_0xf20c('0x3a')],util['inspect'](_0x1809d3,{'showHidden':![],'depth':null}));}};module[_0xf20c('0xca')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 25e89e7..a7fd354 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf05e=['memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','answered','holdtime','billableseconds','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','channels','outboundChannels','outbound','applications','variables','bind','dialend','varset','syncVarSet','newexten','syncNewExten','hangup','prototype','isUndefined','emit','isNotNull','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','voice:outbound','variable','outboundrouteid','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty'];(function(_0x35f926,_0x62e90d){var _0x14023a=function(_0xbe67b4){while(--_0xbe67b4){_0x35f926['push'](_0x35f926['shift']());}};_0x14023a(++_0x62e90d);}(_0xf05e,0x17a));var _0xef05=function(_0x385fd6,_0x36adfd){_0x385fd6=_0x385fd6-0x0;var _0x3145c1=_0xf05e[_0x385fd6];return _0x3145c1;};'use strict';var _=require(_0xef05('0x0'));var moment=require(_0xef05('0x1'));var util=require(_0xef05('0x2'));var Redis=require(_0xef05('0x3'));var config=require(_0xef05('0x4'));var logger=require(_0xef05('0x5'))(_0xef05('0x6'));var ami=require(_0xef05('0x7'));config[_0xef05('0x8')]=_[_0xef05('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x2fa84f){this[_0xef05('0xa')]=_0x2fa84f[_0xef05('0xb')];this[_0xef05('0xc')]=_0x2fa84f[_0xef05('0xc')];this[_0xef05('0xd')]={};this[_0xef05('0xe')]={};ami['on']('dialbegin',this['syncDialBegin'][_0xef05('0xf')](this));ami['on'](_0xef05('0x10'),this['syncDialEnd'][_0xef05('0xf')](this));ami['on'](_0xef05('0x11'),this[_0xef05('0x12')]['bind'](this));ami['on'](_0xef05('0x13'),this[_0xef05('0x14')][_0xef05('0xf')](this));ami['on'](_0xef05('0x15'),this['syncHangup'][_0xef05('0xf')](this));}VoiceDialReport[_0xef05('0x16')]['isNotNull']=function(_0x3e7982){return _0x3e7982!==null&&!_[_0xef05('0x17')](_0x3e7982);};VoiceDialReport[_0xef05('0x16')][_0xef05('0x18')]=function(_0x560dfb,_0x1d6eaf,_0x56cc1e){io['to'](_0x560dfb)['emit'](_0x1d6eaf,_0x56cc1e);};VoiceDialReport[_0xef05('0x16')]['syncDialBegin']=function(_0x315976){try{if(this[_0xef05('0x19')](_0x315976)){logger[_0xef05('0x1a')](_0xef05('0x1b'),_0x315976[_0xef05('0x1c')],util['inspect'](_0x315976,{'showHidden':![],'depth':null}));if(this[_0xef05('0xa')][_0x315976[_0xef05('0x1c')]]){_[_0xef05('0x1d')](this[_0xef05('0xa')][_0x315976['uniqueid']],{'starttime':moment()['format'](_0xef05('0x1e')),'lastevent':'called','interface':_0x315976[_0xef05('0x1f')]['substring'](0x0,_0x315976['channel'][_0xef05('0x20')]('-')),'membername':_0x315976[_0xef05('0x1f')][_0xef05('0x21')](_0x315976[_0xef05('0x1f')][_0xef05('0x20')]('/')+0x1,_0x315976[_0xef05('0x1f')][_0xef05('0x20')]('-'))},_[_0xef05('0x22')](_0x315976,[_0xef05('0x23'),_0xef05('0x24')]));logger[_0xef05('0x25')](_0xef05('0x26'),_0x315976['uniqueid'],this[_0xef05('0xa')][_0x315976['uniqueid']][_0xef05('0x27')],this[_0xef05('0xa')][_0x315976[_0xef05('0x1c')]]['interface']);logger['debug'](_0xef05('0x28'),_0x315976[_0xef05('0x1c')],util['inspect'](this[_0xef05('0xa')][_0x315976['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0xef05('0xd')][_0x315976['uniqueid']])_[_0xef05('0x1d')](this[_0xef05('0xa')][_0x315976['uniqueid']],this[_0xef05('0xd')][_0x315976[_0xef05('0x1c')]]);this[_0xef05('0x18')]('voice:outbound','voice_outbound_channel:save',this['channels'][_0x315976[_0xef05('0x1c')]]);logger[_0xef05('0x1a')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x315976[_0xef05('0x1c')],util[_0xef05('0x29')](this[_0xef05('0xa')][_0x315976[_0xef05('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xef05('0x18')]('custom:dialbegin',this[_0xef05('0xa')][_0x315976['uniqueid']]);}}}catch(_0x289b11){logger[_0xef05('0x2a')](_0xef05('0x2b'),_0x315976[_0xef05('0x1c')],util[_0xef05('0x29')](_0x289b11,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xef05('0x2c')]=function(_0x11daad){try{if(this[_0xef05('0x19')](_0x11daad)){logger[_0xef05('0x1a')](_0xef05('0x2d'),_0x11daad[_0xef05('0x1c')],util[_0xef05('0x29')](_0x11daad,{'showHidden':![],'depth':null}));if(this[_0xef05('0xa')][_0x11daad[_0xef05('0x1c')]]){this['channels'][_0x11daad[_0xef05('0x1c')]]['dialstatus']=_0x11daad[_0xef05('0x2e')];if(_0x11daad[_0xef05('0x2e')]==='ANSWER'){this[_0xef05('0xa')][_0x11daad[_0xef05('0x1c')]][_0xef05('0x2f')]=_0x11daad[_0xef05('0x2f')];this[_0xef05('0xa')][_0x11daad[_0xef05('0x1c')]]['connectedlinename']=_0x11daad[_0xef05('0x30')];this[_0xef05('0xa')][_0x11daad['uniqueid']][_0xef05('0x31')]=moment()['format'](_0xef05('0x1e'));this['channels'][_0x11daad[_0xef05('0x1c')]]['lastevent']='connect';logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x11daad[_0xef05('0x1c')],_0x11daad[_0xef05('0x1f')][_0xef05('0x21')](_0x11daad['channel'][_0xef05('0x20')]('/')+0x1,_0x11daad[_0xef05('0x1f')][_0xef05('0x20')]('-')));logger[_0xef05('0x1a')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x11daad['uniqueid'],util[_0xef05('0x29')](this[_0xef05('0xa')][_0x11daad['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:dialconnect',this[_0xef05('0xa')][_0x11daad['uniqueid']]);}logger[_0xef05('0x1a')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x11daad['uniqueid'],util[_0xef05('0x29')](this[_0xef05('0xa')][_0x11daad['uniqueid']],{'showHidden':![],'depth':null}));this[_0xef05('0x18')](_0xef05('0x32'),'voice_outbound_channel:save',this[_0xef05('0xa')][_0x11daad['uniqueid']]);}}}catch(_0x3f86a1){logger[_0xef05('0x2a')]('[%s][voiceDialReport][dialend]',_0x11daad[_0xef05('0x1c')],util['inspect'](_0x3f86a1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xef05('0x16')][_0xef05('0x12')]=function(_0x45fefa){try{if(this[_0xef05('0x19')](_0x45fefa)){logger[_0xef05('0x1a')]('[%s][voiceDialReport][varset]\x20event:',_0x45fefa[_0xef05('0x1c')],util[_0xef05('0x29')](_0x45fefa,{'showHidden':![],'depth':null}));this['addVariable'](_0x45fefa[_0xef05('0x1c')],_['keys'](_0x45fefa[_0xef05('0x33')])[0x0],_0x45fefa['value']);if(this['isNotNull'](_0x45fefa[_0xef05('0x33')])&&this[_0xef05('0x19')](_0x45fefa[_0xef05('0x33')][_0xef05('0x34')])){if(_[_0xef05('0x17')](this['channels'][_0x45fefa[_0xef05('0x1c')]])){this[_0xef05('0xa')][_0x45fefa[_0xef05('0x1c')]]={'routeId':_0x45fefa[_0xef05('0x35')],'variables':this[_0xef05('0xe')][_0x45fefa[_0xef05('0x1c')]],'motionChannel':_0xef05('0x36')};logger['info'](_0xef05('0x37'),_0x45fefa[_0xef05('0x1c')],_0x45fefa[_0xef05('0x33')]['outboundrouteid'],_[_0xef05('0x38')](_0x45fefa[_0xef05('0x33')])[0x0],_0x45fefa[_0xef05('0x35')]);logger[_0xef05('0x1a')](_0xef05('0x39'),_0x45fefa['uniqueid'],util[_0xef05('0x29')](this[_0xef05('0xa')][_0x45fefa[_0xef05('0x1c')]],{'showHidden':![],'depth':null}));this[_0xef05('0x18')](_0xef05('0x32'),_0xef05('0x3a'),this[_0xef05('0xa')][_0x45fefa[_0xef05('0x1c')]]);}}}}catch(_0x606d7f){logger[_0xef05('0x2a')]('[%s][voiceDialReport][varset]',_0x45fefa['uniqueid'],util[_0xef05('0x29')](_0x606d7f,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x56315b,_0x1ace0f,_0x854113){var _0x181724=[_0xef05('0x3b'),_0xef05('0x3c'),_0xef05('0x3d'),_0xef05('0x3e'),_0xef05('0x3f'),_0xef05('0x40'),_0xef05('0x41'),_0xef05('0x42'),'sipcallid',_0xef05('0x43'),_0xef05('0x44'),_0xef05('0x45'),_0xef05('0x46'),'memberdynamic',_0xef05('0x47'),_0xef05('0x48'),'membername',_0xef05('0x49'),_0xef05('0x4a')];if(!_[_0xef05('0x4b')](_0x1ace0f)&&!_[_0xef05('0x4c')](_0x181724,_0x1ace0f)){if(_[_0xef05('0x17')](this[_0xef05('0xe')][_0x56315b])){this[_0xef05('0xe')][_0x56315b]={};}this[_0xef05('0xe')][_0x56315b][_0x1ace0f]=_0x854113;}};VoiceDialReport[_0xef05('0x16')]['syncHangup']=function(_0x26f6f3){try{if(this['isNotNull'](_0x26f6f3)){logger[_0xef05('0x1a')]('[%s][voiceDialReport][hangup]\x20event:',_0x26f6f3[_0xef05('0x1c')],util[_0xef05('0x29')](_0x26f6f3,{'showHidden':![],'depth':null}));if(this[_0xef05('0xa')][_0x26f6f3['uniqueid']]){logger[_0xef05('0x25')](_0xef05('0x4d'),_0x26f6f3[_0xef05('0x1c')],_0x26f6f3[_0xef05('0x4e')]);this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]][_0xef05('0x4f')]=moment()['format'](_0xef05('0x1e'));this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]][_0xef05('0x50')]=moment(this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]][_0xef05('0x4f')])[_0xef05('0x51')](this['channels'][_0x26f6f3[_0xef05('0x1c')]][_0xef05('0x52')],_0xef05('0x53'));this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]]['lastevent']=_0xef05('0x54');this['outbound'][_0xef05('0x55')]+=0x1;if(this['channels'][_0x26f6f3[_0xef05('0x1c')]]['answertime']){this[_0xef05('0xc')][_0xef05('0x56')]+=0x1;this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]][_0xef05('0x57')]=moment(this['channels'][_0x26f6f3[_0xef05('0x1c')]][_0xef05('0x31')])['diff'](this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]][_0xef05('0x52')],'seconds');this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]][_0xef05('0x58')]=moment(this['channels'][_0x26f6f3[_0xef05('0x1c')]][_0xef05('0x4f')])[_0xef05('0x51')](this[_0xef05('0xa')][_0x26f6f3['uniqueid']][_0xef05('0x31')],_0xef05('0x53'));this[_0xef05('0xc')]['sumHoldTime']+=this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]][_0xef05('0x57')]||0x0;this[_0xef05('0xc')][_0xef05('0x59')]+=this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]]['billableseconds'];}this[_0xef05('0xc')][_0xef05('0x5a')]+=this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]][_0xef05('0x50')];logger[_0xef05('0x1a')](_0xef05('0x5b'),_0x26f6f3['uniqueid'],util[_0xef05('0x29')](this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceDialReport',this['channels'][_0x26f6f3[_0xef05('0x1c')]]);logger[_0xef05('0x1a')](_0xef05('0x5c'),_0x26f6f3['uniqueid'],util[_0xef05('0x29')](this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xef05('0x18')](_0xef05('0x5d'),this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]]);logger[_0xef05('0x1a')](_0xef05('0x5e'),_0x26f6f3[_0xef05('0x1c')],util['inspect'](this[_0xef05('0xa')][_0x26f6f3['uniqueid']],{'showHidden':![],'depth':null}));this[_0xef05('0x18')](_0xef05('0x32'),_0xef05('0x5f'),this[_0xef05('0xc')]);logger[_0xef05('0x25')](_0xef05('0x60'),JSON['stringify'](this['channels'][_0x26f6f3[_0xef05('0x1c')]]));logger[_0xef05('0x1a')](_0xef05('0x61'),_0x26f6f3['uniqueid'],util[_0xef05('0x29')](this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0xef05('0x62'),this[_0xef05('0xa')][_0x26f6f3['uniqueid']]);delete this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x1c')]];}else if(this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x63')]]){this['channels'][_0x26f6f3[_0xef05('0x63')]][_0xef05('0x1c')]=this[_0xef05('0xa')][_0x26f6f3[_0xef05('0x63')]][_0xef05('0x64')];}if(this[_0xef05('0xe')][_0x26f6f3[_0xef05('0x1c')]]){delete this['variables'][_0x26f6f3[_0xef05('0x1c')]];}}}catch(_0x216646){logger[_0xef05('0x2a')](_0xef05('0x65'),_0x26f6f3['uniqueid'],util[_0xef05('0x29')](_0x216646,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xef05('0x14')]=function(_0x530393){try{if(this[_0xef05('0x19')](_0x530393)){logger[_0xef05('0x1a')](_0xef05('0x66'),_0x530393[_0xef05('0x1c')],util[_0xef05('0x29')](_0x530393,{'showHidden':![],'depth':null}));if(_0x530393[_0xef05('0x67')][_0xef05('0x68')]()===_0xef05('0x69')){_0x530393[_0xef05('0x6a')]=(_0x530393[_0xef05('0x6b')]||_0x530393[_0xef05('0x6a')])[_0xef05('0x68')]();if(_['startsWith'](_0x530393[_0xef05('0x6a')],'cdr(')){if(_['isUndefined'](this[_0xef05('0xd')][_0x530393[_0xef05('0x1c')]]))this[_0xef05('0xd')][_0x530393[_0xef05('0x1c')]]={};logger[_0xef05('0x25')](_0xef05('0x6c'),_0x530393[_0xef05('0x1c')],_0x530393['application'],_0x530393[_0xef05('0x6a')]);var _0x4d1354=_0x530393[_0xef05('0x6a')][_0xef05('0x6d')]('=');var _0x56035d=_0x4d1354[0x0][_0xef05('0x6e')](/cdr\((.*)\)/);if(_0x56035d)this[_0xef05('0xd')][_0x530393[_0xef05('0x1c')]][_0x56035d[0x1]]=_0x4d1354[0x1];}}}}catch(_0x48db96){logger['error'](_0xef05('0x6f'),_0x530393[_0xef05('0x1c')],util['inspect'](_0x48db96,{'showHidden':![],'depth':null}));}};module[_0xef05('0x70')]=VoiceDialReport; \ No newline at end of file +var _0x23a6=['rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','diff','starttime','total','answered','holdtime','seconds','billableseconds','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceDialReport][newexten]','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','syncDialEnd','bind','varset','syncVarSet','syncNewExten','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','inspect','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','substring','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','value','variable','outboundrouteid','voice','info','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','addVariable','rtpaudioqos','rtpaudioqosbridged'];(function(_0x28ad8b,_0x47975a){var _0x30d0b9=function(_0xa859a5){while(--_0xa859a5){_0x28ad8b['push'](_0x28ad8b['shift']());}};_0x30d0b9(++_0x47975a);}(_0x23a6,0x118));var _0x623a=function(_0x13249b,_0x4e625e){_0x13249b=_0x13249b-0x0;var _0x12c1bc=_0x23a6[_0x13249b];return _0x12c1bc;};'use strict';var _=require(_0x623a('0x0'));var moment=require(_0x623a('0x1'));var util=require(_0x623a('0x2'));var Redis=require(_0x623a('0x3'));var config=require('../../../config/environment');var logger=require(_0x623a('0x4'))(_0x623a('0x5'));var ami=require(_0x623a('0x6'));config[_0x623a('0x7')]=_['defaults'](config['redis'],{'host':_0x623a('0x8'),'port':0x18eb});var io=require(_0x623a('0x9'))(new Redis(config[_0x623a('0x7')]));function VoiceDialReport(_0x4874b1){this[_0x623a('0xa')]=_0x4874b1[_0x623a('0xb')];this[_0x623a('0xc')]=_0x4874b1['outbound'];this[_0x623a('0xd')]={};this[_0x623a('0xe')]={};ami['on'](_0x623a('0xf'),this[_0x623a('0x10')]['bind'](this));ami['on']('dialend',this[_0x623a('0x11')][_0x623a('0x12')](this));ami['on'](_0x623a('0x13'),this[_0x623a('0x14')]['bind'](this));ami['on']('newexten',this[_0x623a('0x15')][_0x623a('0x12')](this));ami['on'](_0x623a('0x16'),this[_0x623a('0x17')][_0x623a('0x12')](this));}VoiceDialReport[_0x623a('0x18')][_0x623a('0x19')]=function(_0x2f1878){return _0x2f1878!==null&&!_[_0x623a('0x1a')](_0x2f1878);};VoiceDialReport[_0x623a('0x18')][_0x623a('0x1b')]=function(_0x1751ee,_0x3aeb0d,_0x4a43e7){io['to'](_0x1751ee)[_0x623a('0x1b')](_0x3aeb0d,_0x4a43e7);};VoiceDialReport[_0x623a('0x18')][_0x623a('0x10')]=function(_0x59369e){try{if(this[_0x623a('0x19')](_0x59369e)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x59369e[_0x623a('0x1c')],util['inspect'](_0x59369e,{'showHidden':![],'depth':null}));if(this[_0x623a('0xa')][_0x59369e[_0x623a('0x1c')]]){_[_0x623a('0x1d')](this[_0x623a('0xa')][_0x59369e[_0x623a('0x1c')]],{'starttime':moment()[_0x623a('0x1e')](_0x623a('0x1f')),'lastevent':'called','interface':_0x59369e[_0x623a('0x20')]['substring'](0x0,_0x59369e['channel'][_0x623a('0x21')]('-')),'membername':_0x59369e[_0x623a('0x20')]['substring'](_0x59369e[_0x623a('0x20')][_0x623a('0x21')]('/')+0x1,_0x59369e[_0x623a('0x20')]['lastIndexOf']('-'))},_['omit'](_0x59369e,[_0x623a('0x22'),_0x623a('0x23')]));logger['info'](_0x623a('0x24'),_0x59369e[_0x623a('0x1c')],this['channels'][_0x59369e[_0x623a('0x1c')]][_0x623a('0x25')],this['channels'][_0x59369e[_0x623a('0x1c')]][_0x623a('0x26')]);logger[_0x623a('0x27')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x59369e[_0x623a('0x1c')],util[_0x623a('0x28')](this[_0x623a('0xa')][_0x59369e[_0x623a('0x1c')]],{'showHidden':![],'depth':null}));if(this[_0x623a('0xd')][_0x59369e[_0x623a('0x1c')]])_['merge'](this['channels'][_0x59369e[_0x623a('0x1c')]],this['applications'][_0x59369e['uniqueid']]);this[_0x623a('0x1b')]('voice:outbound',_0x623a('0x29'),this[_0x623a('0xa')][_0x59369e['uniqueid']]);logger[_0x623a('0x27')](_0x623a('0x2a'),_0x59369e[_0x623a('0x1c')],util[_0x623a('0x28')](this[_0x623a('0xa')][_0x59369e['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x623a('0x1b')](_0x623a('0x2b'),this[_0x623a('0xa')][_0x59369e[_0x623a('0x1c')]]);}}}catch(_0x45f0b6){logger[_0x623a('0x2c')]('[%s][voiceDialReport][dialbegin]',_0x59369e[_0x623a('0x1c')],util['inspect'](_0x45f0b6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x623a('0x18')][_0x623a('0x11')]=function(_0x18ab24){try{if(this[_0x623a('0x19')](_0x18ab24)){logger[_0x623a('0x27')](_0x623a('0x2d'),_0x18ab24['uniqueid'],util[_0x623a('0x28')](_0x18ab24,{'showHidden':![],'depth':null}));if(this['channels'][_0x18ab24[_0x623a('0x1c')]]){this[_0x623a('0xa')][_0x18ab24['uniqueid']][_0x623a('0x2e')]=_0x18ab24['dialstatus'];if(_0x18ab24[_0x623a('0x2e')]===_0x623a('0x2f')){this[_0x623a('0xa')][_0x18ab24[_0x623a('0x1c')]][_0x623a('0x30')]=_0x18ab24[_0x623a('0x30')];this['channels'][_0x18ab24[_0x623a('0x1c')]][_0x623a('0x31')]=_0x18ab24['connectedlinename'];this[_0x623a('0xa')][_0x18ab24[_0x623a('0x1c')]][_0x623a('0x32')]=moment()[_0x623a('0x1e')](_0x623a('0x1f'));this[_0x623a('0xa')][_0x18ab24['uniqueid']][_0x623a('0x33')]=_0x623a('0x34');logger['info'](_0x623a('0x35'),_0x18ab24[_0x623a('0x1c')],_0x18ab24['channel'][_0x623a('0x36')](_0x18ab24['channel']['lastIndexOf']('/')+0x1,_0x18ab24[_0x623a('0x20')][_0x623a('0x21')]('-')));logger[_0x623a('0x27')](_0x623a('0x37'),_0x18ab24[_0x623a('0x1c')],util[_0x623a('0x28')](this[_0x623a('0xa')][_0x18ab24[_0x623a('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x623a('0x1b')]('custom:dialconnect',this['channels'][_0x18ab24[_0x623a('0x1c')]]);}logger[_0x623a('0x27')](_0x623a('0x38'),_0x18ab24[_0x623a('0x1c')],util[_0x623a('0x28')](this[_0x623a('0xa')][_0x18ab24['uniqueid']],{'showHidden':![],'depth':null}));this[_0x623a('0x1b')](_0x623a('0x39'),_0x623a('0x29'),this[_0x623a('0xa')][_0x18ab24['uniqueid']]);}}}catch(_0x1f7f7a){logger[_0x623a('0x2c')](_0x623a('0x3a'),_0x18ab24[_0x623a('0x1c')],util[_0x623a('0x28')](_0x1f7f7a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x623a('0x18')][_0x623a('0x14')]=function(_0x4069a1){try{if(this['isNotNull'](_0x4069a1)){logger[_0x623a('0x27')](_0x623a('0x3b'),_0x4069a1[_0x623a('0x1c')],util[_0x623a('0x28')](_0x4069a1,{'showHidden':![],'depth':null}));this['addVariable'](_0x4069a1[_0x623a('0x1c')],_[_0x623a('0x3c')](_0x4069a1['variable'])[0x0],_0x4069a1[_0x623a('0x3d')]);if(this['isNotNull'](_0x4069a1[_0x623a('0x3e')])&&this[_0x623a('0x19')](_0x4069a1['variable'][_0x623a('0x3f')])){if(_['isUndefined'](this[_0x623a('0xa')][_0x4069a1[_0x623a('0x1c')]])){this[_0x623a('0xa')][_0x4069a1[_0x623a('0x1c')]]={'routeId':_0x4069a1['value'],'variables':this['variables'][_0x4069a1[_0x623a('0x1c')]],'motionChannel':_0x623a('0x40')};logger[_0x623a('0x41')](_0x623a('0x42'),_0x4069a1[_0x623a('0x1c')],_0x4069a1[_0x623a('0x3e')][_0x623a('0x3f')],_[_0x623a('0x3c')](_0x4069a1[_0x623a('0x3e')])[0x0],_0x4069a1[_0x623a('0x3d')]);logger['debug'](_0x623a('0x43'),_0x4069a1[_0x623a('0x1c')],util[_0x623a('0x28')](this[_0x623a('0xa')][_0x4069a1['uniqueid']],{'showHidden':![],'depth':null}));this[_0x623a('0x1b')](_0x623a('0x39'),_0x623a('0x29'),this[_0x623a('0xa')][_0x4069a1[_0x623a('0x1c')]]);}}}}catch(_0x202182){logger[_0x623a('0x2c')]('[%s][voiceDialReport][varset]',_0x4069a1[_0x623a('0x1c')],util['inspect'](_0x202182,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x623a('0x18')][_0x623a('0x44')]=function(_0x520239,_0x597a22,_0x28fde5){var _0x137364=[_0x623a('0x45'),_0x623a('0x46'),_0x623a('0x47'),_0x623a('0x48'),'rtpaudioqosloss',_0x623a('0x49'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x623a('0x4a'),_0x623a('0x4b'),'bridgepeer',_0x623a('0x4c'),_0x623a('0x4d'),'memberdynamic',_0x623a('0x4e'),_0x623a('0x4f'),'membername',_0x623a('0x50'),'memberrealtime'];if(!_[_0x623a('0x51')](_0x597a22)&&!_[_0x623a('0x52')](_0x137364,_0x597a22)){if(_[_0x623a('0x1a')](this['variables'][_0x520239])){this[_0x623a('0xe')][_0x520239]={};}this[_0x623a('0xe')][_0x520239][_0x597a22]=_0x28fde5;}};VoiceDialReport['prototype'][_0x623a('0x17')]=function(_0x866585){try{if(this['isNotNull'](_0x866585)){logger[_0x623a('0x27')](_0x623a('0x53'),_0x866585['uniqueid'],util[_0x623a('0x28')](_0x866585,{'showHidden':![],'depth':null}));if(this['channels'][_0x866585[_0x623a('0x1c')]]){logger[_0x623a('0x41')](_0x623a('0x54'),_0x866585['uniqueid'],_0x866585[_0x623a('0x55')]);this['channels'][_0x866585[_0x623a('0x1c')]]['endtime']=moment()[_0x623a('0x1e')](_0x623a('0x1f'));this[_0x623a('0xa')][_0x866585[_0x623a('0x1c')]][_0x623a('0x56')]=moment(this[_0x623a('0xa')][_0x866585[_0x623a('0x1c')]][_0x623a('0x57')])[_0x623a('0x58')](this[_0x623a('0xa')][_0x866585[_0x623a('0x1c')]][_0x623a('0x59')],'seconds');this['channels'][_0x866585[_0x623a('0x1c')]][_0x623a('0x33')]='complete';this[_0x623a('0xc')][_0x623a('0x5a')]+=0x1;if(this[_0x623a('0xa')][_0x866585[_0x623a('0x1c')]][_0x623a('0x32')]){this[_0x623a('0xc')][_0x623a('0x5b')]+=0x1;this[_0x623a('0xa')][_0x866585[_0x623a('0x1c')]][_0x623a('0x5c')]=moment(this[_0x623a('0xa')][_0x866585[_0x623a('0x1c')]][_0x623a('0x32')])[_0x623a('0x58')](this['channels'][_0x866585[_0x623a('0x1c')]][_0x623a('0x59')],_0x623a('0x5d'));this['channels'][_0x866585[_0x623a('0x1c')]][_0x623a('0x5e')]=moment(this['channels'][_0x866585['uniqueid']][_0x623a('0x57')])[_0x623a('0x58')](this[_0x623a('0xa')][_0x866585[_0x623a('0x1c')]][_0x623a('0x32')],'seconds');this[_0x623a('0xc')]['sumHoldTime']+=this[_0x623a('0xa')][_0x866585['uniqueid']]['holdtime']||0x0;this[_0x623a('0xc')][_0x623a('0x5f')]+=this[_0x623a('0xa')][_0x866585['uniqueid']]['billableseconds'];}this[_0x623a('0xc')]['sumDuration']+=this[_0x623a('0xa')][_0x866585[_0x623a('0x1c')]]['duration'];logger[_0x623a('0x27')](_0x623a('0x60'),_0x866585['uniqueid'],util[_0x623a('0x28')](this[_0x623a('0xa')][_0x866585['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x623a('0x61'),this[_0x623a('0xa')][_0x866585['uniqueid']]);logger[_0x623a('0x27')](_0x623a('0x62'),_0x866585[_0x623a('0x1c')],util[_0x623a('0x28')](this[_0x623a('0xa')][_0x866585[_0x623a('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0x623a('0x63'),this[_0x623a('0xa')][_0x866585[_0x623a('0x1c')]]);logger['debug'](_0x623a('0x64'),_0x866585[_0x623a('0x1c')],util[_0x623a('0x28')](this[_0x623a('0xa')][_0x866585[_0x623a('0x1c')]],{'showHidden':![],'depth':null}));this[_0x623a('0x1b')](_0x623a('0x39'),_0x623a('0x65'),this[_0x623a('0xc')]);logger[_0x623a('0x41')](_0x623a('0x66'),JSON[_0x623a('0x67')](this['channels'][_0x866585[_0x623a('0x1c')]]));logger[_0x623a('0x27')](_0x623a('0x68'),_0x866585[_0x623a('0x1c')],util[_0x623a('0x28')](this[_0x623a('0xa')][_0x866585[_0x623a('0x1c')]],{'showHidden':![],'depth':null}));this[_0x623a('0x1b')]('voice:outbound',_0x623a('0x69'),this['channels'][_0x866585[_0x623a('0x1c')]]);delete this['channels'][_0x866585[_0x623a('0x1c')]];}else if(this['channels'][_0x866585[_0x623a('0x6a')]]){this['channels'][_0x866585[_0x623a('0x6a')]][_0x623a('0x1c')]=this[_0x623a('0xa')][_0x866585[_0x623a('0x6a')]]['destuniqueid'];}if(this['variables'][_0x866585[_0x623a('0x1c')]]){delete this[_0x623a('0xe')][_0x866585[_0x623a('0x1c')]];}}}catch(_0x12bb52){logger[_0x623a('0x2c')]('[%s][voiceDialReport][hangup]',_0x866585[_0x623a('0x1c')],util[_0x623a('0x28')](_0x12bb52,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x623a('0x18')]['syncNewExten']=function(_0x214f93){try{if(this['isNotNull'](_0x214f93)){logger['debug'](_0x623a('0x6b'),_0x214f93[_0x623a('0x1c')],util[_0x623a('0x28')](_0x214f93,{'showHidden':![],'depth':null}));if(_0x214f93[_0x623a('0x6c')][_0x623a('0x6d')]()===_0x623a('0x6e')){_0x214f93[_0x623a('0x6f')]=(_0x214f93[_0x623a('0x70')]||_0x214f93[_0x623a('0x6f')])['toLowerCase']();if(_['startsWith'](_0x214f93[_0x623a('0x6f')],_0x623a('0x71'))){if(_[_0x623a('0x1a')](this[_0x623a('0xd')][_0x214f93[_0x623a('0x1c')]]))this[_0x623a('0xd')][_0x214f93[_0x623a('0x1c')]]={};logger[_0x623a('0x41')](_0x623a('0x72'),_0x214f93['uniqueid'],_0x214f93[_0x623a('0x6c')],_0x214f93[_0x623a('0x6f')]);var _0x436546=_0x214f93['applicationdata']['split']('=');var _0x155cff=_0x436546[0x0][_0x623a('0x73')](/cdr\((.*)\)/);if(_0x155cff)this[_0x623a('0xd')][_0x214f93[_0x623a('0x1c')]][_0x155cff[0x1]]=_0x436546[0x1];}}}}catch(_0x5dbd0f){logger[_0x623a('0x2c')](_0x623a('0x74'),_0x214f93[_0x623a('0x1c')],util[_0x623a('0x28')](_0x5dbd0f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index ec50b23..94da5aa 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x115a=['stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice:queue:%s','isNotNull','isUndefined','clearZombieChannels','queues','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','available','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','keys','push','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','last','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallercomplete','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','queuecallerjoinAt','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','queuestatus','value','CONTINUE','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','varset','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','syncHangup','diff','length','sumDuration','milliseconds','total','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedtransfer]','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','context','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohstarttime','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','lodash','moment','util','md5','ioredis','../../../config/logger','../ami','../model/queueReport','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','hangup','fullybooted','syncFullyBooted','newexten','syncNewExten','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','waiting','queueStatusComplete','unlockRR','switch','isNil','Action','status','catch','message','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','name','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','answered','loggedIn','pTalking','sumBillable','talking','unmanaged','abandoned','Trunk','active','Interval'];(function(_0xa4cb0,_0x34d537){var _0x48542b=function(_0x2fd3a2){while(--_0x2fd3a2){_0xa4cb0['push'](_0xa4cb0['shift']());}};_0x48542b(++_0x34d537);}(_0x115a,0x91));var _0xa115=function(_0x2bc959,_0x5a71d1){_0x2bc959=_0x2bc959-0x0;var _0x421934=_0x115a[_0x2bc959];return _0x421934;};'use strict';var _=require(_0xa115('0x0'));var moment=require(_0xa115('0x1'));var util=require(_0xa115('0x2'));var md5=require(_0xa115('0x3'));var Redis=require(_0xa115('0x4'));var config=require('../../../config/environment');var logger=require(_0xa115('0x5'))('ami');var ami=require(_0xa115('0x6'));var QueueReport=require(_0xa115('0x7'));config[_0xa115('0x8')]=_[_0xa115('0x9')](config[_0xa115('0x8')],{'host':_0xa115('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa115('0x8')]));var Sequence=function(){};Sequence[_0xa115('0xb')][_0xa115('0xc')]=function(_0x2a7527){this[_0xa115('0xd')]=this[_0xa115('0xd')]?this[_0xa115('0xd')][_0xa115('0xe')](_0x2a7527):_0x2a7527();};function VoiceQueueReport(_0x3ba292){this[_0xa115('0xf')]=new Sequence();this[_0xa115('0x10')]={};this['agents']=_0x3ba292[_0xa115('0x11')];this[_0xa115('0x12')]=_0x3ba292[_0xa115('0x13')];this[_0xa115('0x14')]=_0x3ba292['voiceQueues'];this[_0xa115('0x15')]=!![];this[_0xa115('0x16')]=_0x3ba292[_0xa115('0x16')];this[_0xa115('0x17')]={};ami['on'](_0xa115('0x18'),this[_0xa115('0x19')][_0xa115('0x1a')](this));ami['on']('queuesummarycomplete',this[_0xa115('0x1b')][_0xa115('0x1a')](this));ami['on'](_0xa115('0x1c'),this[_0xa115('0x1d')][_0xa115('0x1a')](this));ami['on'](_0xa115('0x1e'),this[_0xa115('0x1f')][_0xa115('0x1a')](this));ami['on'](_0xa115('0x20'),this[_0xa115('0x21')][_0xa115('0x1a')](this));ami['on'](_0xa115('0x22'),this[_0xa115('0x23')]['bind'](this));ami['on'](_0xa115('0x24'),this[_0xa115('0x25')][_0xa115('0x1a')](this));ami['on']('varset',this['syncVarSet'][_0xa115('0x1a')](this));ami['on'](_0xa115('0x26'),this['syncHangup'][_0xa115('0x1a')](this));ami['on'](_0xa115('0x27'),this[_0xa115('0x28')][_0xa115('0x1a')](this));ami['on'](_0xa115('0x29'),this[_0xa115('0x2a')][_0xa115('0x1a')](this));ami['on'](_0xa115('0x2b'),this[_0xa115('0x2c')][_0xa115('0x1a')](this));ami['on']('musiconholdstop',this[_0xa115('0x2d')][_0xa115('0x1a')](this));ami['on'](_0xa115('0x2e'),this[_0xa115('0x2f')][_0xa115('0x1a')](this));ami['on'](_0xa115('0x30'),this[_0xa115('0x31')][_0xa115('0x1a')](this));this[_0xa115('0x32')]();this['loopQueueShow']();}function clearChannels(_0x58316c){if(!_[_0xa115('0x33')](_0x58316c)){for(var _0x5a3c5b in _0x58316c){if(_0x58316c[_0xa115('0x34')](_0x5a3c5b)){delete _0x58316c[_0x5a3c5b];}}}}function clearCampaigns(_0x42ff51){if(!_[_0xa115('0x33')](_0x42ff51)){for(var _0x43f164 in _0x42ff51){if(_0x42ff51[_0xa115('0x34')](_0x43f164)){_0x42ff51[_0x43f164]['originated']=0x0;}}}}function clearVoiceQueues(_0x27f411){if(!_[_0xa115('0x33')](_0x27f411)){for(var _0x15bc3e in _0x27f411){if(_0x27f411['hasOwnProperty'](_0x15bc3e)){_0x27f411[_0x15bc3e][_0xa115('0x35')]=0x0;_0x27f411[_0x15bc3e]['talking']=0x0;_0x27f411[_0x15bc3e]['pTalking']=0x0;_0x27f411[_0x15bc3e][_0xa115('0x36')]=0x0;_0x27f411[_0x15bc3e][_0xa115('0x37')]=!![];}}}}function clearAgentBooked(_0x3ea09e){if(!_['isEmpty'](_0x3ea09e)){for(var _0x53c6f7 in _0x3ea09e){if(_0x3ea09e['hasOwnProperty'](_0x53c6f7)){_0x3ea09e[_0x53c6f7][_0xa115('0x38')]=!![];}}}}VoiceQueueReport[_0xa115('0xb')]['clearZombieChannels']=function(){var _0x4c486d=this;for(var _0x477b35 in this['channels']){if(this[_0xa115('0x12')][_0xa115('0x34')](_0x477b35)&&!this[_0xa115('0x12')][_0x477b35][_0xa115('0x39')]){this[_0xa115('0xf')]['enqueue'](function(){if(!_[_0xa115('0x3a')](_0x4c486d[_0xa115('0x12')][_0x477b35])){return ami[_0xa115('0x3b')]({'action':_0xa115('0x3c'),'channel':_0x4c486d['channels'][_0x477b35]['channel']})[_0xa115('0x3d')](function(_0x3ac80f){if(_0x3ac80f[_0xa115('0x3e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4c486d[_0xa115('0x12')][_0x477b35]){delete _0x4c486d[_0xa115('0x12')][_0x477b35];logger[_0xa115('0x3f')](_0xa115('0x40'),_0x477b35,util[_0xa115('0x41')](_0x3ac80f,{'showHidden':![],'depth':null}));}if(_0x4c486d[_0xa115('0x10')][_0x477b35]){delete _0x4c486d['queueReports'][_0x477b35];logger['error'](_0xa115('0x42'),_0x477b35,util[_0xa115('0x41')](_0x3ac80f,{'showHidden':![],'depth':null}));}if(_0x4c486d[_0xa115('0x17')][_0x477b35]){delete _0x4c486d[_0xa115('0x17')][_0x477b35];logger[_0xa115('0x3f')]('[%s][voiceQueueReport][checkVariables]',_0x477b35,util['inspect'](_0x3ac80f,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xa115('0x28')]=function(){logger[_0xa115('0x3f')](_0xa115('0x43'));clearChannels(this[_0xa115('0x12')]);this[_0xa115('0x44')](this['queueReports']);clearAgentBooked(this[_0xa115('0x11')]);clearVoiceQueues(this[_0xa115('0x14')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0xa115('0xb')][_0xa115('0x44')]=function(_0xe7fd57){var _0x1bbb76=this;if(!_[_0xa115('0x33')](_0xe7fd57)){for(var _0x4dfaf5 in _0xe7fd57){if(_0xe7fd57[_0xa115('0x34')](_0x4dfaf5)){_0x1bbb76[_0xa115('0x45')](_0xe7fd57[_0x4dfaf5],_0xa115('0x46'));delete _0xe7fd57[_0x4dfaf5];}}}};VoiceQueueReport[_0xa115('0xb')][_0xa115('0x47')]=function(_0x10cb4b,_0x34a129,_0x485b1e){io['to'](_0x10cb4b)[_0xa115('0x47')](_0x34a129,_0x485b1e);};VoiceQueueReport[_0xa115('0xb')][_0xa115('0x48')]=function(_0x1656dc,_0x28c203){logger[_0xa115('0x49')](_0xa115('0x4a')+_0x28c203+_0xa115('0x4b'),_0x1656dc[_0xa115('0x4c')],util['inspect'](_0x1656dc,{'showHidden':![],'depth':null}));this['emit'](util[_0xa115('0x4d')]('voice:queue:%s',_0x1656dc['name']),_0xa115('0x4e'),_0x1656dc);io[_0xa115('0x47')]('voice_queue_presence:save',_0x1656dc);};VoiceQueueReport[_0xa115('0xb')][_0xa115('0x45')]=function(_0x3ed185,_0x3a56e4){logger[_0xa115('0x49')](_0xa115('0x4a')+_0x3a56e4+_0xa115('0x4f'),_0x3ed185[_0xa115('0x4c')],util[_0xa115('0x41')](_0x3ed185,{'showHidden':![],'depth':null}));this[_0xa115('0x47')](util['format']('voice:queue:%s',_0x3ed185[_0xa115('0x50')]),_0xa115('0x51'),_0x3ed185);io[_0xa115('0x47')](_0xa115('0x52'),_0x3ed185);};VoiceQueueReport[_0xa115('0xb')][_0xa115('0x53')]=function(_0x284d7f,_0x4da3d7){if(_0x284d7f[_0xa115('0x54')]===_0xa115('0x55')){var _0x9ae9e8={'id':_0x284d7f['id'],'name':_0x284d7f['name'],'strategy':_0x284d7f['strategy'],'answered':_0x284d7f[_0xa115('0x56')],'available':_0x284d7f['available'],'loggedIn':_0x284d7f[_0xa115('0x57')],'pTalking':_0x284d7f[_0xa115('0x58')],'sumBillable':_0x284d7f[_0xa115('0x59')],'sumDuration':_0x284d7f['sumDuration'],'sumHoldTime':_0x284d7f['sumHoldTime']||0x0,'talking':_0x284d7f[_0xa115('0x5a')],'total':_0x284d7f['total'],'type':_0x284d7f[_0xa115('0x54')],'unmanaged':_0x284d7f[_0xa115('0x5b')],'abandoned':_0x284d7f[_0xa115('0x5c')],'waiting':_0x284d7f[_0xa115('0x36')]};if(_0x284d7f[_0xa115('0x5d')]){_0x9ae9e8[_0xa115('0x5d')]={'id':_0x284d7f[_0xa115('0x5d')]['id'],'name':_0x284d7f[_0xa115('0x5d')][_0xa115('0x50')],'active':_0x284d7f[_0xa115('0x5d')][_0xa115('0x5e')],'callerid':_0x284d7f[_0xa115('0x5d')]['callerid']};}if(_0x284d7f['Interval']){_0x9ae9e8[_0xa115('0x5f')]={'id':_0x284d7f[_0xa115('0x5f')]['id'],'name':_0x284d7f[_0xa115('0x5f')]['name']};}var _0x2b465f=md5(JSON[_0xa115('0x60')](_0x9ae9e8));if(_0x284d7f['md5']!==_0x2b465f){_0x284d7f[_0xa115('0x3')]=_0x2b465f;logger['debug'](_0xa115('0x61')+_0x4da3d7+_0xa115('0x62'),util[_0xa115('0x41')](_0x9ae9e8,{'showHidden':![],'depth':null}));this[_0xa115('0x47')](util[_0xa115('0x4d')](_0xa115('0x63'),_0x9ae9e8['name']),'voice_queue:save',_0x9ae9e8);}}};VoiceQueueReport['prototype'][_0xa115('0x64')]=function(_0x29ff16){return _0x29ff16!==null&&!_[_0xa115('0x65')](_0x29ff16);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x492481=this;setInterval(function(){_0x492481[_0xa115('0x66')]();ami['Action']({'action':_0xa115('0x67')})['catch'](function(_0x13792a){logger[_0xa115('0x3f')]('[voiceQueueReport][queues]',util[_0xa115('0x41')](_0x13792a,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xa115('0xb')]['loopQueueSummary']=function(){var _0x14c5a6=this;setInterval(function(){if(_0x14c5a6['flagQueueSummary']){return ami[_0xa115('0x3b')]({'action':'queuesummary'})['then'](function(_0x1e52a6){_0x14c5a6[_0xa115('0x15')]=![];})['catch'](function(_0xc21592){logger[_0xa115('0x3f')](_0xa115('0x68'),util[_0xa115('0x41')](_0xc21592,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0xa115('0x19')]=function(_0x336507){try{if(this[_0xa115('0x64')](_0x336507)&&this[_0xa115('0x64')](_0x336507['queue'])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0xa115('0x41')](_0x336507,{'showHidden':![],'depth':null}));if(this[_0xa115('0x14')][_0x336507[_0xa115('0x69')]]){logger['info'](_0xa115('0x6a'),_0x336507[_0xa115('0x69')]);var _0x74e76c=_[_0xa115('0x6b')](this[_0xa115('0x12')],_0xa115('0x69'))[_0x336507[_0xa115('0x69')]]||0x0;var _0x1575ed=_0x74e76c-_0x336507[_0xa115('0x6c')];if(this[_0xa115('0x14')][_0x336507['queue']]['waiting']!==_[_0xa115('0x6d')](_0x336507[_0xa115('0x6c')])||this[_0xa115('0x14')][_0x336507['queue']]['loggedIn']!==_[_0xa115('0x6d')](_0x336507[_0xa115('0x6e')])||this[_0xa115('0x14')][_0x336507[_0xa115('0x69')]][_0xa115('0x6f')]!==_[_0xa115('0x6d')](_0x336507[_0xa115('0x6f')])||this[_0xa115('0x14')][_0x336507['queue']]['talking']!==_0x1575ed){this[_0xa115('0x14')][_0x336507[_0xa115('0x69')]]['waiting']=_[_0xa115('0x6d')](_0x336507[_0xa115('0x6c')]);this[_0xa115('0x14')][_0x336507[_0xa115('0x69')]]['loggedIn']=_['toNumber'](_0x336507[_0xa115('0x6e')]);this[_0xa115('0x14')][_0x336507[_0xa115('0x69')]][_0xa115('0x6f')]=_[_0xa115('0x6d')](_0x336507[_0xa115('0x6f')]);this['voiceQueues'][_0x336507[_0xa115('0x69')]][_0xa115('0x5a')]=_0x1575ed>0x0?_0x1575ed:0x0;this[_0xa115('0x14')][_0x336507[_0xa115('0x69')]][_0xa115('0x5a')]=this[_0xa115('0x14')][_0x336507[_0xa115('0x69')]][_0xa115('0x5a')]>_['toNumber'](_0x336507[_0xa115('0x6e')])?_[_0xa115('0x6d')](_0x336507[_0xa115('0x6e')]):this['voiceQueues'][_0x336507[_0xa115('0x69')]][_0xa115('0x5a')];this[_0xa115('0x53')](this[_0xa115('0x14')][_0x336507[_0xa115('0x69')]],_0xa115('0x18'));}logger[_0xa115('0x49')](_0xa115('0x70'),util[_0xa115('0x41')](this[_0xa115('0x14')][_0x336507['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0xa115('0x71'),this[_0xa115('0x14')][_0x336507[_0xa115('0x69')]]);}}}catch(_0x383d69){logger[_0xa115('0x3f')](_0xa115('0x68'),util[_0xa115('0x41')](_0x383d69,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa115('0xb')]['syncQueueSummaryComplete']=function(_0x2e6c91){logger[_0xa115('0x49')](_0xa115('0x72'),util[_0xa115('0x41')](_0x2e6c91,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xa115('0xb')][_0xa115('0x1d')]=function(_0x233516){try{if(this[_0xa115('0x64')](_0x233516)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x233516[_0xa115('0x4c')],util[_0xa115('0x41')](_0x233516,{'showHidden':![],'depth':null}));if(_[_0xa115('0x65')](this[_0xa115('0x10')][_0x233516['uniqueid']]))this[_0xa115('0x10')][_0x233516[_0xa115('0x4c')]]=[];if(_[_0xa115('0x65')](this[_0xa115('0x12')][_0x233516[_0xa115('0x4c')]]))this[_0xa115('0x12')][_0x233516['uniqueid']]={};var _0x19dfdf=new QueueReport();_0x19dfdf[_0xa115('0x50')]=_0x233516['queue'];_0x19dfdf[_0xa115('0x54')]=this[_0xa115('0x14')][_0x19dfdf[_0xa115('0x50')]]&&this[_0xa115('0x14')][_0x19dfdf['name']][_0xa115('0x54')]?this[_0xa115('0x14')][_0x19dfdf[_0xa115('0x50')]][_0xa115('0x54')]||_0xa115('0x55'):_0xa115('0x55');_0x19dfdf[_0xa115('0x69')]=_0x233516[_0xa115('0x69')];_0x19dfdf['queuecallerjoinAt']=moment()[_0xa115('0x4d')](_0xa115('0x73'));_0x19dfdf[_0xa115('0x74')]=_0x233516[_0xa115('0x74')];_0x19dfdf['count']=_0x233516[_0xa115('0x75')];_0x19dfdf['uniqueid']=_0x233516['uniqueid'];_0x19dfdf[_0xa115('0x76')]=this['channels'][_0x233516[_0xa115('0x4c')]][_0xa115('0x76')];logger[_0xa115('0x77')](_0xa115('0x78'),_0x19dfdf[_0xa115('0x50')],_0x19dfdf[_0xa115('0x54')]);_[_0xa115('0x79')](_0x19dfdf,_['pick'](_0x233516,_[_0xa115('0x7a')](_0x19dfdf)));this[_0xa115('0x10')][_0x233516[_0xa115('0x4c')]][_0xa115('0x7b')](_0x19dfdf);this[_0xa115('0x12')][_0x233516[_0xa115('0x4c')]]=_0x19dfdf;this[_0xa115('0x48')](_0x19dfdf,_0xa115('0x1c'));}}catch(_0x1face5){logger[_0xa115('0x3f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x233516[_0xa115('0x4c')],util[_0xa115('0x41')](_0x1face5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa115('0xb')][_0xa115('0x1f')]=function(_0x4b6e56){try{if(this[_0xa115('0x64')](_0x4b6e56)){logger[_0xa115('0x49')](_0xa115('0x7c'),_0x4b6e56[_0xa115('0x4c')],util['inspect'](_0x4b6e56,{'showHidden':![],'depth':null}));if(this[_0xa115('0x10')][_0x4b6e56[_0xa115('0x4c')]]){var _0x72d698=_['last'](this[_0xa115('0x10')][_0x4b6e56[_0xa115('0x4c')]]);_0x72d698['queuecallercomplete']=![];_0x72d698[_0xa115('0x7d')]=null;_0x72d698['holdtime']=_0x4b6e56[_0xa115('0x7e')];_0x72d698[_0xa115('0x7f')]=_0x4b6e56['originalposition'];_0x72d698[_0xa115('0x1e')]=!![];_0x72d698[_0xa115('0x80')]=moment()[_0xa115('0x4d')](_0xa115('0x73'));_0x72d698[_0xa115('0x81')]=_0xa115('0x82');_0x72d698[_0xa115('0x83')]=null;logger[_0xa115('0x77')](_0xa115('0x84'),_0x72d698[_0xa115('0x50')],_0x72d698[_0xa115('0x54')]);this[_0xa115('0x12')][_0x4b6e56[_0xa115('0x4c')]]=_0x72d698;this[_0xa115('0x45')](_0x72d698,_0xa115('0x1e'));}}}catch(_0x4032e3){logger[_0xa115('0x3f')](_0xa115('0x7c'),_0x4b6e56[_0xa115('0x4c')],util[_0xa115('0x41')](_0x4032e3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa115('0xb')][_0xa115('0x21')]=function(_0x30fa66){try{if(this[_0xa115('0x64')](_0x30fa66)){logger[_0xa115('0x49')](_0xa115('0x85'),_0x30fa66[_0xa115('0x4c')],util['inspect'](_0x30fa66,{'showHidden':![],'depth':null}));if(this[_0xa115('0x10')][_0x30fa66['uniqueid']]){var _0xaec586=_['last'](this[_0xa115('0x10')][_0x30fa66[_0xa115('0x4c')]]);_0xaec586[_0xa115('0x86')]=moment()[_0xa115('0x4d')](_0xa115('0x73'));_0xaec586[_0xa115('0x87')]=_0x30fa66[_0xa115('0x87')];_0xaec586[_0xa115('0x88')]=_0x30fa66[_0xa115('0x88')];logger[_0xa115('0x77')](_0xa115('0x89'),_0xaec586[_0xa115('0x50')],_0xaec586[_0xa115('0x54')],_0x30fa66[_0xa115('0x87')],_0x30fa66[_0xa115('0x88')]);this[_0xa115('0x12')][_0x30fa66[_0xa115('0x4c')]]=_0xaec586;this[_0xa115('0x48')](_0xaec586,'queuecallerleave');}}}catch(_0x573e1b){logger[_0xa115('0x3f')]('[%s][voiceQueueReport][queuecallerleave]',_0x30fa66[_0xa115('0x4c')],util[_0xa115('0x41')](_0x573e1b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa115('0x25')]=function(_0x334d4c){try{if(this['isNotNull'](_0x334d4c)){logger[_0xa115('0x49')]('[%s][voiceQueueReport][agentconnect]',_0x334d4c['uniqueid'],util[_0xa115('0x41')](_0x334d4c,{'showHidden':![],'depth':null}));if(this[_0xa115('0x10')][_0x334d4c[_0xa115('0x4c')]]){var _0x1e67c2=_[_0xa115('0x8a')](this[_0xa115('0x10')][_0x334d4c[_0xa115('0x4c')]]);_0x1e67c2['queuecallercomplete']=!![];_0x1e67c2[_0xa115('0x81')]=_0xa115('0x8b');logger[_0xa115('0x77')](_0xa115('0x8c'),_0x1e67c2[_0xa115('0x50')],_0x1e67c2['type']);}}}catch(_0x1a9174){logger[_0xa115('0x3f')]('[%s][voiceQueueReport][agentconnect]',_0x334d4c['uniqueid'],util[_0xa115('0x41')](_0x1a9174,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa115('0x23')]=function(_0x1c20c8){try{if(this[_0xa115('0x64')](_0x1c20c8)){logger[_0xa115('0x49')](_0xa115('0x8d'),_0x1c20c8[_0xa115('0x4c')],util[_0xa115('0x41')](_0x1c20c8,{'showHidden':![],'depth':null}));if(this[_0xa115('0x10')][_0x1c20c8['uniqueid']]){var _0x31d88=_[_0xa115('0x8a')](this['queueReports'][_0x1c20c8[_0xa115('0x4c')]]);_0x31d88[_0xa115('0x1e')]=![];_0x31d88[_0xa115('0x80')]=null;_0x31d88[_0xa115('0x8e')]=!![];_0x31d88[_0xa115('0x83')]=_0x1c20c8['membername'];_0x31d88[_0xa115('0x7e')]=_0x1c20c8[_0xa115('0x7e')];_0x31d88[_0xa115('0x8f')]=!![];_0x31d88[_0xa115('0x90')]=![];_0x31d88[_0xa115('0x91')]=null;if(!_0x31d88[_0xa115('0x92')]){if(_0x1c20c8['reason']==_0xa115('0x92')){_0x31d88[_0xa115('0x81')]=_0xa115('0x93');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x31d88[_0xa115('0x50')],_0x31d88['type']);}else{if(_[_0xa115('0x94')](_0x1c20c8[_0xa115('0x95')][_0xa115('0x96')](),_0xa115('0x97'))){if(this[_0xa115('0x10')][_0x1c20c8[_0xa115('0x98')]]){var _0x21ff88=_[_0xa115('0x8a')](this[_0xa115('0x10')][_0x1c20c8['linkedid']]);_0x21ff88[_0xa115('0x8f')]=![];_0x21ff88[_0xa115('0x90')]=!![];_0x21ff88[_0xa115('0x91')]=moment(_0x31d88[_0xa115('0x99')])['add'](_0x1c20c8[_0xa115('0x7e')],_0xa115('0x9a'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x21ff88['queuecallerexitreason']=_0xa115('0x9b');_0x21ff88[_0xa115('0x92')]=!![];_0x21ff88[_0xa115('0x9c')]=_0xa115('0x9d');_0x21ff88[_0xa115('0x9e')]=_0x1c20c8[_0xa115('0x9f')];_0x21ff88['transferuniqueid']=_0x1c20c8[_0xa115('0x4c')];logger[_0xa115('0x77')](_0xa115('0xa0'),_0x21ff88[_0xa115('0x50')],_0x21ff88[_0xa115('0x54')]);var _0x58b15e=this[_0xa115('0x10')][_0x1c20c8['linkedid']];this[_0xa115('0x10')][_0x1c20c8[_0xa115('0x98')]]=this[_0xa115('0x10')][_0x1c20c8['uniqueid']];this['queueReports'][_0x1c20c8[_0xa115('0x4c')]]=_0x58b15e;}}else{_0x31d88[_0xa115('0x81')]='COMPLETEDBY'+_0x1c20c8[_0xa115('0xa1')][_0xa115('0xa2')]();logger[_0xa115('0x77')](_0xa115('0xa3'),_0x31d88[_0xa115('0x50')],_0x31d88[_0xa115('0x54')],_0x31d88[_0xa115('0x81')]);}}}this[_0xa115('0x12')][_0x1c20c8['uniqueid']]=_0x31d88;this['emitVoiceQueueChannelRemove'](_0x31d88,'agentcomplete');}}}catch(_0x22bbd0){logger[_0xa115('0x3f')]('[%s][voiceQueueReport][agentcomplete]',_0x1c20c8[_0xa115('0x4c')],util[_0xa115('0x41')](_0x22bbd0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa115('0xb')][_0xa115('0xa4')]=function(_0xce2431){try{if(this[_0xa115('0x64')](_0xce2431)){logger[_0xa115('0x49')](_0xa115('0xa5'),_0xce2431[_0xa115('0x4c')],util[_0xa115('0x41')](_0xce2431,{'showHidden':![],'depth':null}));this[_0xa115('0xa6')](_0xce2431[_0xa115('0x4c')],_[_0xa115('0x7a')](_0xce2431[_0xa115('0xa7')])[0x0],_0xce2431['value']);if(this[_0xa115('0x10')][_0xce2431['uniqueid']]){var _0x284f59=_[_0xa115('0x8a')](this[_0xa115('0x10')][_0xce2431[_0xa115('0x4c')]]);if(_0x284f59){if(this[_0xa115('0x64')](_0xce2431[_0xa115('0xa7')])&&this[_0xa115('0x64')](_0xce2431['variable'][_0xa115('0xa8')])){switch(_0xce2431[_0xa115('0xa9')]){case _0xa115('0xaa'):_0x284f59[_0xa115('0x90')]=![];_0x284f59['queuecallerexitAt']=null;break;case'TIMEOUT':_0x284f59['lastevent']='timeout';_0x284f59[_0xa115('0x90')]=!![];_0x284f59[_0xa115('0x91')]=moment()[_0xa115('0x4d')](_0xa115('0x73'));_0x284f59['queuecallerleaveAt']=moment()[_0xa115('0x4d')](_0xa115('0x73'));logger[_0xa115('0x49')](_0xa115('0xab'),_0xce2431[_0xa115('0x4c')],util['inspect'](_0x284f59,{'showHidden':![],'depth':null}));ami['emit'](_0xa115('0xac'),_0x284f59);break;default:_0x284f59['queuecallerexit']=!![];_0x284f59[_0xa115('0x91')]=moment()[_0xa115('0x4d')](_0xa115('0x73'));_0x284f59[_0xa115('0x86')]=moment()[_0xa115('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');}_0x284f59[_0xa115('0x1e')]=![];_0x284f59[_0xa115('0x80')]=null;_0x284f59['queuecallerexitreason']=_0xce2431[_0xa115('0xa9')];this['channels'][_0xce2431[_0xa115('0x4c')]]=_0x284f59;this[_0xa115('0x45')](_0x284f59,_0xa115('0xad'));}else if(this['isNotNull'](_0xce2431[_0xa115('0xa7')])&&this[_0xa115('0x64')](_0xce2431[_0xa115('0xa7')][_0xa115('0xae')])){if(!_0x284f59[_0xa115('0x1e')]){_0x284f59[_0xa115('0x90')]=!![];_0x284f59['queuecallerexitAt']=moment()['format'](_0xa115('0x73'));_0x284f59['queuecallerexitreason']=_0xa115('0xaf');_0x284f59[_0xa115('0x86')]=moment()[_0xa115('0x4d')](_0xa115('0x73'));this[_0xa115('0x12')][_0xce2431[_0xa115('0x4c')]]=_0x284f59;}}logger[_0xa115('0x77')](_0xa115('0xb0'),_0xce2431[_0xa115('0x4c')],_0x284f59[_0xa115('0x50')],_0x284f59[_0xa115('0x54')],_[_0xa115('0x7a')](_0xce2431[_0xa115('0xa7')])[0x0],_0xce2431[_0xa115('0xa9')]);_0x284f59[_0xa115('0x17')]=this['variables'][_0xce2431[_0xa115('0x4c')]];}}}}catch(_0x553c83){logger[_0xa115('0x3f')](_0xa115('0xa5'),_0xce2431[_0xa115('0x4c')],util[_0xa115('0x41')](_0x553c83,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa115('0xb')][_0xa115('0xa6')]=function(_0x1d6b52,_0x260d96,_0x538086){var _0x3d5b03=[_0xa115('0xb1'),_0xa115('0xb2'),_0xa115('0xb3'),_0xa115('0xb4'),_0xa115('0xb5'),'rtpaudioqoslossbridged',_0xa115('0xb6'),_0xa115('0xb7'),_0xa115('0xb8'),_0xa115('0xb9'),'bridgepeer','bridgepvtcallid',_0xa115('0xba'),_0xa115('0xbb'),_0xa115('0xbc'),_0xa115('0xbd'),'membername',_0xa115('0xbe'),_0xa115('0xbf')];if(!_[_0xa115('0x3a')](_0x260d96)&&!_[_0xa115('0xc0')](_0x3d5b03,_0x260d96)){if(_[_0xa115('0x65')](this['variables'][_0x1d6b52])){this['variables'][_0x1d6b52]={};}this['variables'][_0x1d6b52][_0x260d96]=_0x538086;}};VoiceQueueReport['prototype'][_0xa115('0xc1')]=function(_0x2e33db){try{if(this['isNotNull'](_0x2e33db)){logger[_0xa115('0x49')]('[%s][voiceQueueReport][hangup]',_0x2e33db[_0xa115('0x4c')],util[_0xa115('0x41')](_0x2e33db,{'showHidden':![],'depth':null}));if(this[_0xa115('0x10')][_0x2e33db[_0xa115('0x4c')]]){for(var _0x406551=0x0,_0x68413={};_0x4065510x0?_0x94aed4:0x0;this['voiceQueues'][_0x49a204[_0x82f6('0x6f')]][_0x82f6('0x5e')]=this[_0x82f6('0xf')][_0x49a204['queue']]['talking']>_[_0x82f6('0x74')](_0x49a204[_0x82f6('0x75')])?_['toNumber'](_0x49a204['loggedin']):this[_0x82f6('0xf')][_0x49a204[_0x82f6('0x6f')]][_0x82f6('0x5e')];this[_0x82f6('0x55')](this[_0x82f6('0xf')][_0x49a204[_0x82f6('0x6f')]],_0x82f6('0x13'));}logger[_0x82f6('0x4a')](_0x82f6('0x76'),util[_0x82f6('0x43')](this[_0x82f6('0xf')][_0x49a204[_0x82f6('0x6f')]],{'showHidden':![],'depth':null}));ami['emit'](_0x82f6('0x77'),this[_0x82f6('0xf')][_0x49a204[_0x82f6('0x6f')]]);}}}catch(_0x27b160){logger[_0x82f6('0x40')]('[voiceQueueReport][queuesummary]',util[_0x82f6('0x43')](_0x27b160,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x82f6('0x35')][_0x82f6('0x17')]=function(_0x566192){logger[_0x82f6('0x4a')](_0x82f6('0x78'),util[_0x82f6('0x43')](_0x566192,{'showHidden':![],'depth':null}));this[_0x82f6('0x10')]=!![];};VoiceQueueReport[_0x82f6('0x35')][_0x82f6('0x19')]=function(_0x2c6e37){try{if(this['isNotNull'](_0x2c6e37)){logger[_0x82f6('0x4a')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2c6e37[_0x82f6('0x4d')],util[_0x82f6('0x43')](_0x2c6e37,{'showHidden':![],'depth':null}));if(_[_0x82f6('0x6a')](this[_0x82f6('0xb')][_0x2c6e37[_0x82f6('0x4d')]]))this[_0x82f6('0xb')][_0x2c6e37[_0x82f6('0x4d')]]=[];if(_[_0x82f6('0x6a')](this[_0x82f6('0xd')][_0x2c6e37['uniqueid']]))this[_0x82f6('0xd')][_0x2c6e37[_0x82f6('0x4d')]]={};var _0x33cc55=new QueueReport();_0x33cc55[_0x82f6('0x4f')]=_0x2c6e37[_0x82f6('0x6f')];_0x33cc55[_0x82f6('0x56')]=this['voiceQueues'][_0x33cc55[_0x82f6('0x4f')]]&&this[_0x82f6('0xf')][_0x33cc55['name']]['type']?this[_0x82f6('0xf')][_0x33cc55[_0x82f6('0x4f')]][_0x82f6('0x56')]||_0x82f6('0x57'):_0x82f6('0x57');_0x33cc55[_0x82f6('0x6f')]=_0x2c6e37['queue'];_0x33cc55[_0x82f6('0x79')]=moment()['format'](_0x82f6('0x7a'));_0x33cc55['position']=_0x2c6e37[_0x82f6('0x7b')];_0x33cc55['count']=_0x2c6e37[_0x82f6('0x7c')];_0x33cc55[_0x82f6('0x4d')]=_0x2c6e37[_0x82f6('0x4d')];_0x33cc55['routealias']=this[_0x82f6('0xd')][_0x2c6e37['uniqueid']][_0x82f6('0x7d')];logger[_0x82f6('0x70')](_0x82f6('0x7e'),_0x33cc55['name'],_0x33cc55[_0x82f6('0x56')]);_[_0x82f6('0x7f')](_0x33cc55,_[_0x82f6('0x80')](_0x2c6e37,_['keys'](_0x33cc55)));this['queueReports'][_0x2c6e37[_0x82f6('0x4d')]][_0x82f6('0x81')](_0x33cc55);this[_0x82f6('0xd')][_0x2c6e37[_0x82f6('0x4d')]]=_0x33cc55;this[_0x82f6('0x49')](_0x33cc55,_0x82f6('0x18'));}}catch(_0x15cfa7){logger[_0x82f6('0x40')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2c6e37[_0x82f6('0x4d')],util[_0x82f6('0x43')](_0x15cfa7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x82f6('0x82')]=function(_0x18d828){try{if(this[_0x82f6('0x6e')](_0x18d828)){logger['debug'](_0x82f6('0x83'),_0x18d828[_0x82f6('0x4d')],util[_0x82f6('0x43')](_0x18d828,{'showHidden':![],'depth':null}));if(this[_0x82f6('0xb')][_0x18d828['uniqueid']]){var _0x18d9f4=_[_0x82f6('0x84')](this[_0x82f6('0xb')][_0x18d828[_0x82f6('0x4d')]]);_0x18d9f4[_0x82f6('0x85')]=![];_0x18d9f4[_0x82f6('0x86')]=null;_0x18d9f4['holdtime']=_0x18d828[_0x82f6('0x87')];_0x18d9f4[_0x82f6('0x88')]=_0x18d828[_0x82f6('0x88')];_0x18d9f4[_0x82f6('0x1a')]=!![];_0x18d9f4[_0x82f6('0x89')]=moment()['format'](_0x82f6('0x7a'));_0x18d9f4['queuecallerexitreason']=_0x82f6('0x8a');_0x18d9f4[_0x82f6('0x8b')]=null;logger[_0x82f6('0x70')](_0x82f6('0x8c'),_0x18d9f4[_0x82f6('0x4f')],_0x18d9f4[_0x82f6('0x56')]);this[_0x82f6('0xd')][_0x18d828['uniqueid']]=_0x18d9f4;this[_0x82f6('0x47')](_0x18d9f4,_0x82f6('0x1a'));}}}catch(_0x5e35a0){logger[_0x82f6('0x40')](_0x82f6('0x83'),_0x18d828[_0x82f6('0x4d')],util['inspect'](_0x5e35a0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x82f6('0x35')]['syncQueueCallerLeave']=function(_0x191d30){try{if(this[_0x82f6('0x6e')](_0x191d30)){logger['debug'](_0x82f6('0x8d'),_0x191d30[_0x82f6('0x4d')],util[_0x82f6('0x43')](_0x191d30,{'showHidden':![],'depth':null}));if(this[_0x82f6('0xb')][_0x191d30['uniqueid']]){var _0x353f91=_['last'](this['queueReports'][_0x191d30[_0x82f6('0x4d')]]);_0x353f91[_0x82f6('0x8e')]=moment()[_0x82f6('0x4e')](_0x82f6('0x7a'));_0x353f91[_0x82f6('0x8f')]=_0x191d30['connectedlinenum'];_0x353f91['connectedlinename']=_0x191d30[_0x82f6('0x90')];logger['info'](_0x82f6('0x91'),_0x353f91[_0x82f6('0x4f')],_0x353f91[_0x82f6('0x56')],_0x191d30['connectedlinenum'],_0x191d30[_0x82f6('0x90')]);this[_0x82f6('0xd')][_0x191d30[_0x82f6('0x4d')]]=_0x353f91;this[_0x82f6('0x49')](_0x353f91,'queuecallerleave');}}}catch(_0x120eae){logger[_0x82f6('0x40')](_0x82f6('0x8d'),_0x191d30[_0x82f6('0x4d')],util['inspect'](_0x120eae,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x82f6('0x20')]=function(_0x259008){try{if(this[_0x82f6('0x6e')](_0x259008)){logger[_0x82f6('0x4a')](_0x82f6('0x92'),_0x259008[_0x82f6('0x4d')],util[_0x82f6('0x43')](_0x259008,{'showHidden':![],'depth':null}));if(this[_0x82f6('0xb')][_0x259008[_0x82f6('0x4d')]]){var _0x31ff74=_['last'](this['queueReports'][_0x259008[_0x82f6('0x4d')]]);_0x31ff74[_0x82f6('0x85')]=!![];_0x31ff74[_0x82f6('0x93')]=_0x82f6('0x94');logger[_0x82f6('0x70')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x31ff74[_0x82f6('0x4f')],_0x31ff74[_0x82f6('0x56')]);}}}catch(_0x3f34a2){logger[_0x82f6('0x40')](_0x82f6('0x92'),_0x259008['uniqueid'],util['inspect'](_0x3f34a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x82f6('0x35')]['syncAgentComplete']=function(_0x344db8){try{if(this[_0x82f6('0x6e')](_0x344db8)){logger[_0x82f6('0x4a')](_0x82f6('0x95'),_0x344db8[_0x82f6('0x4d')],util['inspect'](_0x344db8,{'showHidden':![],'depth':null}));if(this[_0x82f6('0xb')][_0x344db8[_0x82f6('0x4d')]]){var _0x2c3984=_['last'](this[_0x82f6('0xb')][_0x344db8[_0x82f6('0x4d')]]);_0x2c3984['queuecallerabandon']=![];_0x2c3984[_0x82f6('0x89')]=null;_0x2c3984[_0x82f6('0x96')]=!![];_0x2c3984[_0x82f6('0x8b')]=_0x344db8[_0x82f6('0x97')];_0x2c3984['holdtime']=_0x344db8[_0x82f6('0x87')];_0x2c3984[_0x82f6('0x85')]=!![];_0x2c3984['queuecallerexit']=![];_0x2c3984[_0x82f6('0x98')]=null;if(!_0x2c3984[_0x82f6('0x99')]){if(_0x344db8[_0x82f6('0x9a')]==_0x82f6('0x99')){_0x2c3984[_0x82f6('0x93')]=_0x82f6('0x9b');logger[_0x82f6('0x70')](_0x82f6('0x9c'),_0x2c3984['name'],_0x2c3984[_0x82f6('0x56')]);}else{if(_['startsWith'](_0x344db8[_0x82f6('0x3c')]['toLowerCase'](),'local/')){if(this[_0x82f6('0xb')][_0x344db8['linkedid']]){var _0x2b2521=_[_0x82f6('0x84')](this[_0x82f6('0xb')][_0x344db8[_0x82f6('0x9d')]]);_0x2b2521['queuecallercomplete']=![];_0x2b2521[_0x82f6('0x9e')]=!![];_0x2b2521[_0x82f6('0x98')]=moment(_0x2c3984[_0x82f6('0x79')])[_0x82f6('0x9f')](_0x344db8[_0x82f6('0x87')],_0x82f6('0xa0'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2b2521[_0x82f6('0x93')]=_0x82f6('0xa1');_0x2b2521[_0x82f6('0x99')]=!![];_0x2b2521['transfertype']=_0x82f6('0xa2');_0x2b2521[_0x82f6('0xa3')]=_0x344db8[_0x82f6('0xa4')];_0x2b2521[_0x82f6('0xa5')]=_0x344db8[_0x82f6('0x4d')];logger[_0x82f6('0x70')](_0x82f6('0xa6'),_0x2b2521['name'],_0x2b2521[_0x82f6('0x56')]);var _0x28143a=this[_0x82f6('0xb')][_0x344db8[_0x82f6('0x9d')]];this[_0x82f6('0xb')][_0x344db8['linkedid']]=this[_0x82f6('0xb')][_0x344db8[_0x82f6('0x4d')]];this[_0x82f6('0xb')][_0x344db8[_0x82f6('0x4d')]]=_0x28143a;}}else{_0x2c3984[_0x82f6('0x93')]='COMPLETEDBY'+_0x344db8[_0x82f6('0x9a')][_0x82f6('0xa7')]();logger[_0x82f6('0x70')](_0x82f6('0xa8'),_0x2c3984[_0x82f6('0x4f')],_0x2c3984['type'],_0x2c3984[_0x82f6('0x93')]);}}}this[_0x82f6('0xd')][_0x344db8['uniqueid']]=_0x2c3984;this[_0x82f6('0x47')](_0x2c3984,_0x82f6('0x1d'));}}}catch(_0x294c30){logger['error'](_0x82f6('0x95'),_0x344db8[_0x82f6('0x4d')],util[_0x82f6('0x43')](_0x294c30,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x82f6('0x35')][_0x82f6('0x22')]=function(_0x43bad5){try{if(this[_0x82f6('0x6e')](_0x43bad5)){logger[_0x82f6('0x4a')](_0x82f6('0xa9'),_0x43bad5[_0x82f6('0x4d')],util[_0x82f6('0x43')](_0x43bad5,{'showHidden':![],'depth':null}));this['addVariable'](_0x43bad5[_0x82f6('0x4d')],_['keys'](_0x43bad5['variable'])[0x0],_0x43bad5[_0x82f6('0xaa')]);if(this[_0x82f6('0xb')][_0x43bad5[_0x82f6('0x4d')]]){var _0x26a4e9=_[_0x82f6('0x84')](this[_0x82f6('0xb')][_0x43bad5[_0x82f6('0x4d')]]);if(_0x26a4e9){if(this[_0x82f6('0x6e')](_0x43bad5[_0x82f6('0xab')])&&this['isNotNull'](_0x43bad5['variable'][_0x82f6('0xac')])){switch(_0x43bad5[_0x82f6('0xaa')]){case _0x82f6('0xad'):_0x26a4e9[_0x82f6('0x9e')]=![];_0x26a4e9['queuecallerexitAt']=null;break;case _0x82f6('0xae'):_0x26a4e9[_0x82f6('0xaf')]=_0x82f6('0xb0');_0x26a4e9[_0x82f6('0x9e')]=!![];_0x26a4e9[_0x82f6('0x98')]=moment()[_0x82f6('0x4e')](_0x82f6('0x7a'));_0x26a4e9[_0x82f6('0x8e')]=moment()['format'](_0x82f6('0x7a'));logger[_0x82f6('0x4a')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x43bad5['uniqueid'],util[_0x82f6('0x43')](_0x26a4e9,{'showHidden':![],'depth':null}));ami[_0x82f6('0x48')](_0x82f6('0xb1'),_0x26a4e9);break;default:_0x26a4e9[_0x82f6('0x9e')]=!![];_0x26a4e9[_0x82f6('0x98')]=moment()['format'](_0x82f6('0x7a'));_0x26a4e9[_0x82f6('0x8e')]=moment()['format'](_0x82f6('0x7a'));}_0x26a4e9['queuecallerabandon']=![];_0x26a4e9['queuecallerabandonAt']=null;_0x26a4e9[_0x82f6('0x93')]=_0x43bad5[_0x82f6('0xaa')];this['channels'][_0x43bad5[_0x82f6('0x4d')]]=_0x26a4e9;this[_0x82f6('0x47')](_0x26a4e9,_0x82f6('0x21'));}else if(this[_0x82f6('0x6e')](_0x43bad5[_0x82f6('0xab')])&&this[_0x82f6('0x6e')](_0x43bad5[_0x82f6('0xab')]['queueposition'])){if(!_0x26a4e9[_0x82f6('0x1a')]){_0x26a4e9['queuecallerexit']=!![];_0x26a4e9[_0x82f6('0x98')]=moment()[_0x82f6('0x4e')](_0x82f6('0x7a'));_0x26a4e9[_0x82f6('0x93')]=_0x82f6('0xb2');_0x26a4e9[_0x82f6('0x8e')]=moment()['format'](_0x82f6('0x7a'));this['channels'][_0x43bad5[_0x82f6('0x4d')]]=_0x26a4e9;}}logger[_0x82f6('0x70')](_0x82f6('0xb3'),_0x43bad5[_0x82f6('0x4d')],_0x26a4e9[_0x82f6('0x4f')],_0x26a4e9['type'],_[_0x82f6('0xb4')](_0x43bad5[_0x82f6('0xab')])[0x0],_0x43bad5['value']);_0x26a4e9['variables']=this['variables'][_0x43bad5['uniqueid']];}}}}catch(_0x265d8f){logger['error']('[%s][voiceQueueReport][varset]',_0x43bad5[_0x82f6('0x4d')],util[_0x82f6('0x43')](_0x265d8f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x82f6('0x35')][_0x82f6('0xb5')]=function(_0x514641,_0x35d518,_0x121c2e){var _0x1acb0f=[_0x82f6('0xb6'),_0x82f6('0xb7'),'rtpaudioqosjitter',_0x82f6('0xb8'),'rtpaudioqosloss',_0x82f6('0xb9'),_0x82f6('0xba'),_0x82f6('0xbb'),'sipcallid',_0x82f6('0xbc'),_0x82f6('0xbd'),_0x82f6('0xbe'),'membercalls',_0x82f6('0xbf'),_0x82f6('0xc0'),_0x82f6('0xc1'),_0x82f6('0x97'),_0x82f6('0xc2'),_0x82f6('0xc3')];if(!_['isNil'](_0x35d518)&&!_[_0x82f6('0xc4')](_0x1acb0f,_0x35d518)){if(_['isUndefined'](this[_0x82f6('0x12')][_0x514641])){this[_0x82f6('0x12')][_0x514641]={};}this[_0x82f6('0x12')][_0x514641][_0x35d518]=_0x121c2e;}};VoiceQueueReport[_0x82f6('0x35')]['syncHangup']=function(_0x266062){try{if(this[_0x82f6('0x6e')](_0x266062)){logger[_0x82f6('0x4a')](_0x82f6('0xc5'),_0x266062[_0x82f6('0x4d')],util[_0x82f6('0x43')](_0x266062,{'showHidden':![],'depth':null}));if(this[_0x82f6('0xb')][_0x266062[_0x82f6('0x4d')]]){for(var _0x554b0d=0x0,_0x2d4ef6={};_0x554b0d=0x0?moment(_0x41f383['endtime'])[_0xe955('0x17')](_0x41f383['starttime'],_0xe955('0xc')):null,'data1':'outbound','data2':_0x41f383[_0xe955('0x12')],'data3':_0x41f383[_0xe955('0xe')],'data4':_0x41f383['dialstring']||null,'role':_0xe955('0x10'),'internal':_0x41f383['accountcode']?_[_0xe955('0x11')](_0x41f383[_0xe955('0x12')]):undefined,'uniqueid':_0x41f383['uniqueid']},'log':_0xe955('0x4')});}; \ No newline at end of file +var _0xe895=['starttime','seconds','outbound','dialstring','agent','toNumber','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','SIP/%s','queuecallerleaveAt','diff','inbound','calleridnum','exten','queue','accountcode','voiceDialReport','voice','membername','TALKING','endtime'];(function(_0xb24e3a,_0x340c31){var _0x25ba1a=function(_0x145c3b){while(--_0x145c3b){_0xb24e3a['push'](_0xb24e3a['shift']());}};_0x25ba1a(++_0x340c31);}(_0xe895,0x162));var _0x5e89=function(_0x343065,_0x169907){_0x343065=_0x343065-0x0;var _0x1d208b=_0xe895[_0x343065];return _0x1d208b;};'use strict';var moment=require('moment');var _=require(_0x5e89('0x0'));var util=require(_0x5e89('0x1'));var client=require(_0x5e89('0x2'));exports[_0x5e89('0x3')]=function(_0x563b20){var _0x1ea0ed=_0x563b20[_0x5e89('0x4')]||_0x563b20['queuecallerexitAt'];return client[_0x5e89('0x5')](_0x5e89('0x6'),{'body':{'channel':'voice','membername':_0x563b20[_0x5e89('0x7')],'interface':_[_0x5e89('0x8')](_0x563b20[_0x5e89('0x9')])?util['format'](_0x5e89('0xa'),_0x563b20[_0x5e89('0x7')]):_0x563b20[_0x5e89('0x9')],'type':'TALKING','enterAt':_0x563b20[_0x5e89('0xb')],'exitAt':_0x1ea0ed,'duration':moment(_0x1ea0ed)[_0x5e89('0xc')](_0x563b20[_0x5e89('0xb')],'seconds'),'data1':_0x5e89('0xd'),'data2':_0x563b20[_0x5e89('0xe')],'data3':_0x563b20[_0x5e89('0xf')],'data4':null,'data5':_0x563b20[_0x5e89('0x10')],'role':'agent','internal':_0x563b20[_0x5e89('0x11')]?_['toNumber'](_0x563b20[_0x5e89('0x11')]):undefined,'uniqueid':_0x563b20['uniqueid']},'log':_0x5e89('0x6')});};exports[_0x5e89('0x12')]=function(_0x5d2b01){return client[_0x5e89('0x5')](_0x5e89('0x6'),{'body':{'channel':_0x5e89('0x13'),'membername':_0x5d2b01[_0x5e89('0x14')],'interface':_0x5d2b01[_0x5e89('0x9')],'type':_0x5e89('0x15'),'enterAt':_0x5d2b01['starttime'],'exitAt':_0x5d2b01[_0x5e89('0x16')],'duration':moment(_0x5d2b01[_0x5e89('0x16')])[_0x5e89('0xc')](_0x5d2b01[_0x5e89('0x17')],_0x5e89('0x18'))>=0x0?moment(_0x5d2b01[_0x5e89('0x16')])[_0x5e89('0xc')](_0x5d2b01['starttime'],'seconds'):null,'data1':_0x5e89('0x19'),'data2':_0x5d2b01[_0x5e89('0x11')],'data3':_0x5d2b01[_0x5e89('0xf')],'data4':_0x5d2b01[_0x5e89('0x1a')]||null,'role':_0x5e89('0x1b'),'internal':_0x5d2b01[_0x5e89('0x11')]?_[_0x5e89('0x1c')](_0x5d2b01[_0x5e89('0x11')]):undefined,'uniqueid':_0x5d2b01['uniqueid']},'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 d14b2ee..de41db7 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 _0xc686=['Request','stopRecordingOnTransfer'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xc686,0x148));var _0x6c68=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xc686[_0x2b5eae];return _0x5f3ac9;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x6c68('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6c68('0x1')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x89e3=['ShowSetting','stopRecordingOnTransfer','getSettings','Request'];(function(_0x538475,_0x1b41ad){var _0x14c421=function(_0x176e0e){while(--_0x176e0e){_0x538475['push'](_0x538475['shift']());}};_0x14c421(++_0x1b41ad);}(_0x89e3,0x66));var _0x389e=function(_0xf0ac00,_0x1d189a){_0xf0ac00=_0xf0ac00-0x0;var _0x3f5734=_0x89e3[_0xf0ac00];return _0x3f5734;};'use strict';var client=require('../client');exports[_0x389e('0x0')]=function(){return client[_0x389e('0x1')](_0x389e('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x389e('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 80a72ea..84e7893 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 _0x783c=['Request','name','GetTemplate','../client'];(function(_0x20f48a,_0x3561fe){var _0x335a9e=function(_0x4b8264){while(--_0x4b8264){_0x20f48a['push'](_0x20f48a['shift']());}};_0x335a9e(++_0x3561fe);}(_0x783c,0xaf));var _0xc783=function(_0xd318c4,_0x3258ef){_0xd318c4=_0xd318c4-0x0;var _0x204607=_0x783c[_0xd318c4];return _0x204607;};'use strict';var client=require(_0xc783('0x0'));exports['getTemplates']=function(_0x2d3072){return function(_0x43127a){return client[_0xc783('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xc783('0x2'),'html']},'log':_0xc783('0x3')});};}; \ No newline at end of file +var _0x8102=['html','../client','getTemplates','Request','GetTemplate'];(function(_0x4d250b,_0x71a237){var _0xe7fa12=function(_0x3854dc){while(--_0x3854dc){_0x4d250b['push'](_0x4d250b['shift']());}};_0xe7fa12(++_0x71a237);}(_0x8102,0x9c));var _0x2810=function(_0x12ef40,_0x4396fa){_0x12ef40=_0x12ef40-0x0;var _0x5e9de7=_0x8102[_0x12ef40];return _0x5e9de7;};'use strict';var client=require(_0x2810('0x0'));exports[_0x2810('0x1')]=function(_0x5ad42e){return function(_0x317be0){return client[_0x2810('0x2')](_0x2810('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x2810('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 84c17ec..12e8645 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 _0x2f5d=['data4','data5','data6','../client','getTriggers','name','channel','status','AllConditions','field','Condition','AnyConditions','Action','Actions','action','data1','data2','data3'];(function(_0x5b138f,_0x294e8d){var _0x55bc73=function(_0x106442){while(--_0x106442){_0x5b138f['push'](_0x5b138f['shift']());}};_0x55bc73(++_0x294e8d);}(_0x2f5d,0xc9));var _0xd2f5=function(_0x3757f8,_0x25a57d){_0x3757f8=_0x3757f8-0x0;var _0x24f682=_0x2f5d[_0x3757f8];return _0x24f682;};'use strict';var client=require(_0xd2f5('0x0'));exports[_0xd2f5('0x1')]=function(_0x11b720){return function(_0xa8ce5c){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xd2f5('0x2'),_0xd2f5('0x3'),_0xd2f5('0x4')],'include':[{'model':'Condition','as':_0xd2f5('0x5'),'attributes':['id',_0xd2f5('0x6'),'operator','value']},{'model':_0xd2f5('0x7'),'as':_0xd2f5('0x8'),'attributes':['id','field','operator','value']},{'model':_0xd2f5('0x9'),'as':_0xd2f5('0xa'),'attributes':['id',_0xd2f5('0xb'),_0xd2f5('0xc'),_0xd2f5('0xd'),_0xd2f5('0xe'),_0xd2f5('0xf'),_0xd2f5('0x10'),_0xd2f5('0x11'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x7fef=['Condition','AllConditions','operator','value','Action','Actions','action','data1','data2','data3','data4','GetTrigger','../client','name','channel','status'];(function(_0x4c7cca,_0x178ea4){var _0x59ec0c=function(_0x279de7){while(--_0x279de7){_0x4c7cca['push'](_0x4c7cca['shift']());}};_0x59ec0c(++_0x178ea4);}(_0x7fef,0x16c));var _0xf7fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7fef[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf7fe('0x0'));exports['getTriggers']=function(_0x492555){return function(_0x3d9342){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xf7fe('0x1'),_0xf7fe('0x2'),_0xf7fe('0x3')],'include':[{'model':_0xf7fe('0x4'),'as':_0xf7fe('0x5'),'attributes':['id','field',_0xf7fe('0x6'),'value']},{'model':'Condition','as':'AnyConditions','attributes':['id','field',_0xf7fe('0x6'),_0xf7fe('0x7')]},{'model':_0xf7fe('0x8'),'as':_0xf7fe('0x9'),'attributes':['id',_0xf7fe('0xa'),_0xf7fe('0xb'),_0xf7fe('0xc'),_0xf7fe('0xd'),_0xf7fe('0xe'),'data5','data6','data7']}]},'log':_0xf7fe('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 9ec43c7..da356af 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 _0x7132=['GetTrunk','getTrunks','registry'];(function(_0x2f0e33,_0xad64cd){var _0x4f3d6e=function(_0x50ed95){while(--_0x50ed95){_0x2f0e33['push'](_0x2f0e33['shift']());}};_0x4f3d6e(++_0xad64cd);}(_0x7132,0x1cf));var _0x2713=function(_0x4cf8d4,_0x5aee73){_0x4cf8d4=_0x4cf8d4-0x0;var _0x2c1beb=_0x7132[_0x4cf8d4];return _0x2c1beb;};'use strict';var client=require('../client');exports[_0x2713('0x0')]=function(_0xb6cbfd){return function(_0x36eb3c){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x2713('0x1'),'defaultuser']},'log':_0x2713('0x2')});};}; \ No newline at end of file +var _0xdc91=['name','registry','defaultuser','../client','getTrunks','Request'];(function(_0x27edba,_0x3b8b4f){var _0x4d2d31=function(_0x30d5ca){while(--_0x30d5ca){_0x27edba['push'](_0x27edba['shift']());}};_0x4d2d31(++_0x3b8b4f);}(_0xdc91,0x183));var _0x1dc9=function(_0x3ab0c2,_0x3eb25d){_0x3ab0c2=_0x3ab0c2-0x0;var _0x59980f=_0xdc91[_0x3ab0c2];return _0x59980f;};'use strict';var client=require(_0x1dc9('0x0'));exports[_0x1dc9('0x1')]=function(_0x3c95f3){return function(_0x2b4f65){return client[_0x1dc9('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1dc9('0x3'),_0x1dc9('0x4'),_0x1dc9('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 0bdac6c..c8c4e5f 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 0ec37fd..aaa5540 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 _0xae82=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x2e1f61,_0x26c6af){var _0x5af51f=function(_0x460e47){while(--_0x460e47){_0x2e1f61['push'](_0x2e1f61['shift']());}};_0x5af51f(++_0x26c6af);}(_0xae82,0x101));var _0x2ae8=function(_0x109af5,_0x3628f0){_0x109af5=_0x109af5-0x0;var _0x1949bd=_0xae82[_0x109af5];return _0x1949bd;};'use strict';var client=require(_0x2ae8('0x0'));exports[_0x2ae8('0x1')]=function(_0x2e0e66){return client[_0x2ae8('0x2')]('CreateVoiceAgentReport',{'body':_0x2e0e66,'log':_0x2ae8('0x3')});};exports['update']=function(_0x1f6d8,_0x5b3537,_0x3db44e){return client[_0x2ae8('0x2')]('UpdateVoiceAgentReport',{'body':_0x1f6d8,'options':{'where':{'uniqueid':_0x5b3537,'interface':_0x3db44e,'agentcomplete':!![]}},'log':_0x2ae8('0x4')});}; \ No newline at end of file +var _0x1a66=['../client','create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x21e635,_0x245373){var _0x2df927=function(_0x5a16f3){while(--_0x5a16f3){_0x21e635['push'](_0x21e635['shift']());}};_0x2df927(++_0x245373);}(_0x1a66,0x82));var _0x61a6=function(_0x41de39,_0x4da077){_0x41de39=_0x41de39-0x0;var _0x13153d=_0x1a66[_0x41de39];return _0x13153d;};'use strict';var client=require(_0x61a6('0x0'));exports[_0x61a6('0x1')]=function(_0x5becdf){return client[_0x61a6('0x2')](_0x61a6('0x3'),{'body':_0x5becdf,'log':_0x61a6('0x3')});};exports['update']=function(_0x3e3f28,_0x37f706,_0x4d802d){return client[_0x61a6('0x2')](_0x61a6('0x4'),{'body':_0x3e3f28,'options':{'where':{'uniqueid':_0x37f706,'interface':_0x4d802d,'agentcomplete':!![]}},'log':_0x61a6('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 259e9be..defa6ee 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 _0xecd0=['util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','Request','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','duration'];(function(_0xc298ad,_0xea4dc2){var _0x11b2e6=function(_0xe2314f){while(--_0xe2314f){_0xc298ad['push'](_0xc298ad['shift']());}};_0x11b2e6(++_0xea4dc2);}(_0xecd0,0x18c));var _0x0ecd=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0xecd0[_0x22b39b];return _0x280e1d;};'use strict';var moment=require('moment');var util=require(_0x0ecd('0x0'));var _=require(_0x0ecd('0x1'));var client=require(_0x0ecd('0x2'));exports[_0x0ecd('0x3')]=function(_0x544b1c){return client['Request'](_0x0ecd('0x4'),{'body':_[_0x0ecd('0x5')](_0x544b1c,{'source':_0x544b1c[_0x0ecd('0x6')],'destinationcontext':_0x544b1c[_0x0ecd('0x7')],'callerid':_0x544b1c[_0x0ecd('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x0ecd('0x4')});};exports[_0x0ecd('0x9')]=function(){return function(){return client[_0x0ecd('0xa')](_0x0ecd('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x0ecd('0xc')](_0x0ecd('0xd'))[_0x0ecd('0xe')](_0x0ecd('0xf')),moment()['endOf']('day')['format'](_0x0ecd('0xf'))]}},'attributes':[_0x0ecd('0x10'),'disposition',_0x0ecd('0x11'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xd11a=['create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client'];(function(_0xfb9c6f,_0x42d549){var _0x558c6b=function(_0x172e0b){while(--_0x172e0b){_0xfb9c6f['push'](_0xfb9c6f['shift']());}};_0x558c6b(++_0x42d549);}(_0xd11a,0xba));var _0xad11=function(_0x2c5563,_0x16c27e){_0x2c5563=_0x2c5563-0x0;var _0x30c4bd=_0xd11a[_0x2c5563];return _0x30c4bd;};'use strict';var moment=require(_0xad11('0x0'));var util=require('util');var _=require(_0xad11('0x1'));var client=require(_0xad11('0x2'));exports[_0xad11('0x3')]=function(_0x27f1e7){return client[_0xad11('0x4')](_0xad11('0x5'),{'body':_[_0xad11('0x6')](_0x27f1e7,{'source':_0x27f1e7[_0xad11('0x7')],'destinationcontext':_0x27f1e7[_0xad11('0x8')],'callerid':_0x27f1e7[_0xad11('0x9')],'amaflags':_0xad11('0xa')}),'log':'CreateVoiceCallReport'});};exports[_0xad11('0xb')]=function(){return function(){return client[_0xad11('0x4')](_0xad11('0xc'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xad11('0xd')](_0xad11('0xe'))['format'](_0xad11('0xf')),moment()[_0xad11('0x10')](_0xad11('0xe'))['format'](_0xad11('0xf'))]}},'attributes':[_0xad11('0x11'),'disposition',_0xad11('0x12'),_0xad11('0x13')]},'log':_0xad11('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 97e7a96..58eabc4 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 _0xda8e=['create','Request','../client'];(function(_0x4aa285,_0x1fe00d){var _0x2777ee=function(_0x181d0f){while(--_0x181d0f){_0x4aa285['push'](_0x4aa285['shift']());}};_0x2777ee(++_0x1fe00d);}(_0xda8e,0x9e));var _0xeda8=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xda8e[_0x487b0c];return _0x1adbdc;};'use strict';var client=require(_0xeda8('0x0'));exports[_0xeda8('0x1')]=function(_0x4a0358){return client[_0xeda8('0x2')]('CreateVoiceDialReport',{'body':_0x4a0358,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x6854=['CreateVoiceDialReport','Request'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x6854,0xa3));var _0x4685=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x6854[_0x32b993];return _0x482780;};'use strict';var client=require('../client');exports['create']=function(_0x2455f7){return client[_0x4685('0x0')]('CreateVoiceDialReport',{'body':_0x2455f7,'log':_0x4685('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index f3aa526..e3602f3 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 _0xd547=['recordingFormat','Request','GetVoiceExtension','exten'];(function(_0x9c5e44,_0x5223ee){var _0x787564=function(_0x148cdd){while(--_0x148cdd){_0x9c5e44['push'](_0x9c5e44['shift']());}};_0x787564(++_0x5223ee);}(_0xd547,0x1c1));var _0x7d54=function(_0x5e5c4c,_0x21abba){_0x5e5c4c=_0x5e5c4c-0x0;var _0x176148=_0xd547[_0x5e5c4c];return _0x176148;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x7d54('0x0')](_0x7d54('0x1'),{'options':{'raw':!![],'attributes':['id',_0x7d54('0x2'),_0x7d54('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x9086=['exten','recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9086,0x10b));var _0x6908=function(_0x534bf5,_0x4bcdf3){_0x534bf5=_0x534bf5-0x0;var _0x3cf307=_0x9086[_0x534bf5];return _0x3cf307;};'use strict';var client=require(_0x6908('0x0'));exports[_0x6908('0x1')]=function(){return function(){return client['Request'](_0x6908('0x2'),{'options':{'raw':!![],'attributes':['id',_0x6908('0x3'),_0x6908('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x6908('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 13720b9..bae850d 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 _0x898c=['dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x196461,_0x1ff2ac){var _0x560281=function(_0x441ba7){while(--_0x441ba7){_0x196461['push'](_0x196461['shift']());}};_0x560281(++_0x1ff2ac);}(_0x898c,0xbf));var _0xc898=function(_0x5755bf,_0x5a50ba){_0x5755bf=_0x5755bf-0x0;var _0x156408=_0x898c[_0x5755bf];return _0x156408;};'use strict';var client=require(_0xc898('0x0'));exports[_0xc898('0x1')]=function(){return function(){return client[_0xc898('0x2')](_0xc898('0x3'),{'options':{'raw':![],'attributes':['id',_0xc898('0x4'),_0xc898('0x5'),_0xc898('0x6'),'autopause',_0xc898('0x7'),_0xc898('0x8'),_0xc898('0x9'),_0xc898('0xa'),_0xc898('0xb'),_0xc898('0xc'),_0xc898('0xd'),'dialPredictiveOptimization',_0xc898('0xe'),_0xc898('0xf'),_0xc898('0x10'),_0xc898('0x11'),_0xc898('0x12'),_0xc898('0x13'),_0xc898('0x14'),'dialQueueProject','dialCongestionMaxRetry',_0xc898('0x15'),_0xc898('0x16'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0xc898('0x17'),_0xc898('0x18'),_0xc898('0x19'),'dialGlobalInterval','dialPrefix',_0xc898('0x1a'),_0xc898('0x1b'),_0xc898('0x1c'),_0xc898('0x1d'),_0xc898('0x1e'),_0xc898('0x1f'),_0xc898('0x20'),_0xc898('0x21'),'dialAMDMaximumNumberOfWords',_0xc898('0x22'),_0xc898('0x23'),_0xc898('0x24'),'dialRecallMeTimeout',_0xc898('0x25'),_0xc898('0x26'),_0xc898('0x27'),'dialAgiAfterHangupClient','dialQueueProject2',_0xc898('0x7'),_0xc898('0x28'),_0xc898('0x29'),_0xc898('0x2a'),_0xc898('0x2b'),_0xc898('0x2c'),_0xc898('0x2d'),_0xc898('0x2e'),'dialAbandonedMaxRetry',_0xc898('0x2f'),_0xc898('0x30'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0xc898('0x31'),_0xc898('0x32'),_0xc898('0x33'),_0xc898('0x34')],'include':[{'model':_0xc898('0x35'),'as':_0xc898('0x35'),'attributes':['id',_0xc898('0x4'),_0xc898('0x36'),_0xc898('0x37')]},{'model':_0xc898('0x38'),'as':_0xc898('0x39'),'attributes':['id',_0xc898('0x4')]},{'model':_0xc898('0x35'),'as':_0xc898('0x3a'),'attributes':['id',_0xc898('0x4'),_0xc898('0x36'),_0xc898('0x37')]},{'model':_0xc898('0x3b'),'as':_0xc898('0x3b'),'attributes':['id',_0xc898('0x4')],'include':[{'model':_0xc898('0x3b'),'as':'Intervals','attributes':['id','name','interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x4808=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x45088e,_0x5eecf0){var _0x677f8=function(_0x31cdd2){while(--_0x31cdd2){_0x45088e['push'](_0x45088e['shift']());}};_0x677f8(++_0x5eecf0);}(_0x4808,0x101));var _0x8480=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4808[_0x167cc1];return _0x10bc4b;};'use strict';var client=require('../client');exports[_0x8480('0x0')]=function(){return function(){return client[_0x8480('0x1')](_0x8480('0x2'),{'options':{'raw':![],'attributes':['id','name','acw',_0x8480('0x3'),_0x8480('0x4'),_0x8480('0x5'),_0x8480('0x6'),'dialActive',_0x8480('0x7'),_0x8480('0x8'),_0x8480('0x9'),'dialPowerLevel','dialPredictiveOptimization',_0x8480('0xa'),_0x8480('0xb'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x8480('0xc'),_0x8480('0xd'),_0x8480('0xe'),_0x8480('0xf'),_0x8480('0x10'),_0x8480('0x11'),_0x8480('0x12'),_0x8480('0x13'),_0x8480('0x14'),_0x8480('0x15'),'dialGlobalMaxRetry',_0x8480('0x16'),_0x8480('0x17'),'dialPrefix',_0x8480('0x18'),_0x8480('0x19'),'dialAMDInitialSilence','dialAMDGreeting',_0x8480('0x1a'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x8480('0x1b'),_0x8480('0x1c'),_0x8480('0x1d'),_0x8480('0x1e'),_0x8480('0x1f'),_0x8480('0x20'),'dialRecallInQueue','dialOrderByScheduledAt',_0x8480('0x21'),_0x8480('0x22'),_0x8480('0x23'),_0x8480('0x5'),_0x8480('0x24'),_0x8480('0x25'),_0x8480('0x26'),_0x8480('0x27'),'dialNoSuchNumberRetryFrequency',_0x8480('0x28'),_0x8480('0x29'),_0x8480('0x2a'),'dialAbandonedRetryFrequency',_0x8480('0x2b'),_0x8480('0x2c'),_0x8480('0x2d'),_0x8480('0x2e'),_0x8480('0x2f'),_0x8480('0x30'),_0x8480('0x31')],'include':[{'model':_0x8480('0x32'),'as':_0x8480('0x32'),'attributes':['id',_0x8480('0x33'),_0x8480('0x34'),_0x8480('0x35')]},{'model':_0x8480('0x36'),'as':_0x8480('0x37'),'attributes':['id',_0x8480('0x33')]},{'model':'Trunk','as':_0x8480('0x38'),'attributes':['id',_0x8480('0x33'),'callerid','active']},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':_0x8480('0x39'),'as':_0x8480('0x3a'),'attributes':['id',_0x8480('0x33'),_0x8480('0x3b')]}]}]},'log':_0x8480('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 56a2de7..09feed5 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(_0x52e07e,_0x4b2458){var _0x157de8=function(_0x50fbdf){while(--_0x50fbdf){_0x52e07e['push'](_0x52e07e['shift']());}};_0x157de8(++_0x4b2458);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x3a1390,_0x386512){var _0x4a0984=function(_0x138dd4){while(--_0x138dd4){_0x3a1390['push'](_0x3a1390['shift']());}};_0x4a0984(++_0x386512);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 bfd3067..0e8a3e4 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 _0xb318=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x19a040,_0x2b1801){var _0x17974b=function(_0x132409){while(--_0x132409){_0x19a040['push'](_0x19a040['shift']());}};_0x17974b(++_0x2b1801);}(_0xb318,0xed));var _0x8b31=function(_0x487576,_0x160e15){_0x487576=_0x487576-0x0;var _0x2ec945=_0xb318[_0x487576];return _0x2ec945;};'use strict';var client=require(_0x8b31('0x0'));exports[_0x8b31('0x1')]=function(_0xa7902f){return function(){return client[_0x8b31('0x2')](_0x8b31('0x3'),{'options':{'where':{'VoiceQueueId':_0xa7902f,'paused':!![]},'raw':!![]},'log':_0x8b31('0x1')});};}; \ No newline at end of file +var _0xf64c=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x54abbb,_0x39e88c){var _0x53aaef=function(_0xc2181f){while(--_0xc2181f){_0x54abbb['push'](_0x54abbb['shift']());}};_0x53aaef(++_0x39e88c);}(_0xf64c,0x1c5));var _0xcf64=function(_0x559f30,_0x4bf6dc){_0x559f30=_0x559f30-0x0;var _0x575514=_0xf64c[_0x559f30];return _0x575514;};'use strict';var client=require(_0xcf64('0x0'));exports[_0xcf64('0x1')]=function(_0x383a46){return function(){return client[_0xcf64('0x2')](_0xcf64('0x3'),{'options':{'where':{'VoiceQueueId':_0x383a46,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 9c61d5f..ef0d7b9 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(_0x263730,_0x4b6cd3){var _0xcb72de=function(_0x2fd104){while(--_0x2fd104){_0x263730['push'](_0x263730['shift']());}};_0xcb72de(++_0x4b6cd3);}(_0x7a54,0x106));var _0x47a5=function(_0x323c86,_0x28e439){_0x323c86=_0x323c86-0x0;var _0x3cb9f2=_0x7a54[_0x323c86];return _0x3cb9f2;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x14c3a1,_0x706e62){var _0x1fa073=function(_0x1c8336){while(--_0x1c8336){_0x14c3a1['push'](_0x14c3a1['shift']());}};_0x1fa073(++_0x706e62);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 7d6a590..82e7c4c 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 _0x2b05=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname'];(function(_0x2e068a,_0x3801ec){var _0x36c7d5=function(_0xb9cffc){while(--_0xb9cffc){_0x2e068a['push'](_0x2e068a['shift']());}};_0x36c7d5(++_0x3801ec);}(_0x2b05,0x1bd));var _0x52b0=function(_0x2c5490,_0x5d2ee0){_0x2c5490=_0x2c5490-0x0;var _0x527dc8=_0x2b05[_0x2c5490];return _0x527dc8;};'use strict';var client=require(_0x52b0('0x0'));exports['transfers']={};exports[_0x52b0('0x1')]=function(_0x1be868){return client['Request'](_0x52b0('0x2'),{'body':{'result':_0x1be868[_0x52b0('0x3')],'transfererchannel':_0x1be868[_0x52b0('0x4')],'transferercalleridnum':_0x1be868[_0x52b0('0x5')],'transferercalleridname':_0x1be868[_0x52b0('0x6')],'transfererconnectedlinenum':_0x1be868[_0x52b0('0x7')],'transfererconnectedlinename':_0x1be868['transfererconnectedlinename'],'transfereraccountcode':_0x1be868[_0x52b0('0x8')],'transferercontext':_0x1be868[_0x52b0('0x9')],'transfererexten':_0x1be868['transfererexten'],'transfererlinkedid':_0x1be868['transfererlinkedid'],'transfereechannel':_0x1be868[_0x52b0('0xa')],'transfereecalleridnum':_0x1be868[_0x52b0('0xb')],'transfereecalleridname':_0x1be868[_0x52b0('0xc')],'transfereeconnectedlinenum':_0x1be868[_0x52b0('0xd')],'transfereeconnectedlinename':_0x1be868[_0x52b0('0xe')],'transfereeaccountcode':_0x1be868[_0x52b0('0xf')],'transfereecontext':_0x1be868[_0x52b0('0x10')],'transfereeexten':_0x1be868[_0x52b0('0x11')],'transfereelinkedid':_0x1be868[_0x52b0('0x12')],'isexternal':_0x1be868[_0x52b0('0x13')],'context':_0x1be868[_0x52b0('0x14')],'extension':_0x1be868[_0x52b0('0x15')],'type':_0x52b0('0x16')},'log':_0x52b0('0x2')});};exports[_0x52b0('0x17')]=function(_0x3a4198){return client[_0x52b0('0x18')](_0x52b0('0x2'),{'body':{'result':_0x3a4198[_0x52b0('0x3')],'transfererchannel':_0x3a4198[_0x52b0('0x19')],'transferercalleridnum':_0x3a4198[_0x52b0('0x1a')],'transferercalleridname':_0x3a4198[_0x52b0('0x1b')],'transfererconnectedlinenum':_0x3a4198[_0x52b0('0x1c')],'transfererconnectedlinename':_0x3a4198[_0x52b0('0x1d')],'transfereraccountcode':_0x3a4198[_0x52b0('0x1e')],'transferercontext':_0x3a4198['secondtransferercontext'],'transfererexten':_0x3a4198[_0x52b0('0x1f')],'transfererlinkedid':_0x3a4198[_0x52b0('0x20')],'transfereechannel':_0x3a4198[_0x52b0('0x21')],'transfereecalleridnum':_0x3a4198[_0x52b0('0x22')],'transfereecalleridname':_0x3a4198[_0x52b0('0x23')],'transfereeconnectedlinenum':_0x3a4198[_0x52b0('0x24')],'transfereeconnectedlinename':_0x3a4198[_0x52b0('0x25')],'transfereeaccountcode':_0x3a4198['transfertargetaccountcode'],'transfereecontext':_0x3a4198[_0x52b0('0x26')],'transfereeexten':_0x3a4198[_0x52b0('0x27')],'transfereelinkedid':_0x3a4198[_0x52b0('0x28')],'isexternal':_0x3a4198[_0x52b0('0x13')],'context':_0x3a4198[_0x52b0('0x29')],'extension':_0x3a4198['origtransfererexten'],'type':_0x52b0('0x2a')},'log':_0x52b0('0x2')});}; \ No newline at end of file +var _0xa71e=['transfereecontext','transfereelinkedid','isexternal','extension','blind','attendedTransfer','Request','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransfererexten','../client','transfers','blindTransfer','CreateVoiceTransferReport','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode'];(function(_0x1a2e73,_0x1d3a95){var _0x12355d=function(_0x4c2c41){while(--_0x4c2c41){_0x1a2e73['push'](_0x1a2e73['shift']());}};_0x12355d(++_0x1d3a95);}(_0xa71e,0xa2));var _0xea71=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0xa71e[_0xb8cfbe];return _0x227d51;};'use strict';var client=require(_0xea71('0x0'));exports[_0xea71('0x1')]={};exports[_0xea71('0x2')]=function(_0x22b0c1){return client['Request'](_0xea71('0x3'),{'body':{'result':_0x22b0c1['result'],'transfererchannel':_0x22b0c1['transfererchannel'],'transferercalleridnum':_0x22b0c1[_0xea71('0x4')],'transferercalleridname':_0x22b0c1[_0xea71('0x5')],'transfererconnectedlinenum':_0x22b0c1[_0xea71('0x6')],'transfererconnectedlinename':_0x22b0c1[_0xea71('0x7')],'transfereraccountcode':_0x22b0c1[_0xea71('0x8')],'transferercontext':_0x22b0c1[_0xea71('0x9')],'transfererexten':_0x22b0c1[_0xea71('0xa')],'transfererlinkedid':_0x22b0c1[_0xea71('0xb')],'transfereechannel':_0x22b0c1[_0xea71('0xc')],'transfereecalleridnum':_0x22b0c1[_0xea71('0xd')],'transfereecalleridname':_0x22b0c1[_0xea71('0xe')],'transfereeconnectedlinenum':_0x22b0c1[_0xea71('0xf')],'transfereeconnectedlinename':_0x22b0c1[_0xea71('0x10')],'transfereeaccountcode':_0x22b0c1[_0xea71('0x11')],'transfereecontext':_0x22b0c1[_0xea71('0x12')],'transfereeexten':_0x22b0c1['transfereeexten'],'transfereelinkedid':_0x22b0c1[_0xea71('0x13')],'isexternal':_0x22b0c1[_0xea71('0x14')],'context':_0x22b0c1['context'],'extension':_0x22b0c1[_0xea71('0x15')],'type':_0xea71('0x16')},'log':_0xea71('0x3')});};exports[_0xea71('0x17')]=function(_0x22103d){return client[_0xea71('0x18')](_0xea71('0x3'),{'body':{'result':_0x22103d['result'],'transfererchannel':_0x22103d['origtransfererchannel'],'transferercalleridnum':_0x22103d['origtransferercalleridnum'],'transferercalleridname':_0x22103d['origtransferercalleridname'],'transfererconnectedlinenum':_0x22103d['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x22103d[_0xea71('0x19')],'transfereraccountcode':_0x22103d['origtransfereraccountcode'],'transferercontext':_0x22103d[_0xea71('0x1a')],'transfererexten':_0x22103d[_0xea71('0x1b')],'transfererlinkedid':_0x22103d['origtransfererlinkedid'],'transfereechannel':_0x22103d['transfertargetchannel'],'transfereecalleridnum':_0x22103d[_0xea71('0x1c')],'transfereecalleridname':_0x22103d[_0xea71('0x1d')],'transfereeconnectedlinenum':_0x22103d[_0xea71('0x1e')],'transfereeconnectedlinename':_0x22103d[_0xea71('0x1f')],'transfereeaccountcode':_0x22103d[_0xea71('0x20')],'transfereecontext':_0x22103d['transfertargetcontext'],'transfereeexten':_0x22103d[_0xea71('0x21')],'transfereelinkedid':_0x22103d[_0xea71('0x22')],'isexternal':_0x22103d[_0xea71('0x14')],'context':_0x22103d['origtransferercontext'],'extension':_0x22103d[_0xea71('0x23')],'type':'attended'},'log':_0xea71('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c3ff66e..e1b5da9 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 _0xa6b0=['map','channels','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','StopMixMonitor','destinationchannel','stop','%s.%s','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','trunks','outboundChannels','run','emit','custom:','event','faxAccounts','send','server','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','moment','../../../config/environment','../ami','listen','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','then','message','catch','command','Command','Action','content','voiceQueues','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','length','find','omit','undefined','values','voicechannel','validate'];(function(_0x24fe8e,_0x3fa991){var _0xe063e8=function(_0x4b6c33){while(--_0x4b6c33){_0x24fe8e['push'](_0x24fe8e['shift']());}};_0xe063e8(++_0x3fa991);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x9e1fef,_0x5e5223){_0x9e1fef=_0x9e1fef-0x0;var _0x56cf3d=_0xa6b0[_0x9e1fef];return _0x56cf3d;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x0a6b('0x2'));var moment=require(_0x0a6b('0x3'));var config=require(_0x0a6b('0x4'));var properties=require('../properties');var ami=require(_0x0a6b('0x5'));exports[_0x0a6b('0x6')]=function(_0x195697,_0xc7140c,_0x3dc2b0){return new BPromise(function(_0x3b6967,_0x1b5fb5){var _0xa908dd={'QueuePause':function(_0x26f761){return new Promise(function(_0x340a33,_0x8e89f){var _0xdcc3e5=util['format']('%s/%s',_0x0a6b('0x7'),_0x26f761[_0x0a6b('0x8')]);if(_0x195697[_0x0a6b('0x9')]&&_0x195697[_0x0a6b('0x9')][_0xdcc3e5]&&_0x195697[_0x0a6b('0x9')][_0xdcc3e5][_0x0a6b('0xa')]){_0x195697[_0x0a6b('0x9')][_0xdcc3e5][_0x0a6b('0xb')]();}if(_0x195697[_0x0a6b('0xc')][_0xdcc3e5]){_0x195697[_0x0a6b('0xc')][_0xdcc3e5][_0x0a6b('0xd')]({'statePause':_0x26f761[_0x0a6b('0xe')]?!![]:![]});}_0x340a33({'code':0xc8,'message':_0x0a6b('0xf')});});},'Reload':function(_0x3cd9a4){var _0x592872=this;return new Promise(function(_0x5e59a5,_0x9afc84){if(ami[_0x0a6b('0x10')]()==![]){return _0x9afc84(_0x592872[_0x0a6b('0x11')](0x1f4,[config[_0x0a6b('0x12')]['ip'],config[_0x0a6b('0x12')][_0x0a6b('0x13')],_0x0a6b('0x14')][_0x0a6b('0x15')]('\x20')));}_0x3cd9a4=_[_0x0a6b('0x16')](_0x3cd9a4,_[_0x0a6b('0x17')](properties['module']));_0x3cd9a4[_0x0a6b('0x18')]=_0x0a6b('0x19');return ami['Action'](_0x3cd9a4)[_0x0a6b('0x1a')](function(_0x4d0e3b){_0x5e59a5({'code':0xc8,'message':_0x4d0e3b[_0x0a6b('0x1b')]});})[_0x0a6b('0x1c')](function(_0x2cb10b){_0x9afc84(_0x592872[_0x0a6b('0x11')](0x1f5,_0x2cb10b['message']));});});},'Command':function(_0x33c278){var _0x296162=this;return new Promise(function(_0x4aadfe,_0x19848c){if(ami[_0x0a6b('0x10')]()==![]){return _0x19848c(_0x296162[_0x0a6b('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x0a6b('0x12')][_0x0a6b('0x13')],_0x0a6b('0x14')]['join']('\x20')));}_0x33c278=_[_0x0a6b('0x16')](_0x33c278,_0x0a6b('0x1d'));_0x33c278[_0x0a6b('0x18')]=_0x0a6b('0x1e');return ami[_0x0a6b('0x1f')](_0x33c278)['then'](function(_0x1e5065){_0x4aadfe({'code':0xc8,'message':_0x1e5065[_0x0a6b('0x20')]});})[_0x0a6b('0x1c')](function(_0x5c77fb){_0x19848c(_0x296162[_0x0a6b('0x11')](0x1f5,_0x5c77fb[_0x0a6b('0x1b')]));});});},'VoiceQueues':function(_0x1bbb0f){return new Promise(function(_0x1b8b78,_0x3b12a2){var _0x5b2229=[];for(var _0x3e6a1d in _0x195697[_0x0a6b('0x21')]){if(_0x195697[_0x0a6b('0x21')]['hasOwnProperty'](_0x3e6a1d)){var _0x3a9092=_0x195697['voiceQueues'][_0x3e6a1d];var _0xecbf0c={'id':_0x3a9092['id'],'name':_0x3a9092[_0x0a6b('0x8')],'strategy':_0x3a9092[_0x0a6b('0x22')],'answered':_0x3a9092['answered'],'available':_0x3a9092['available'],'loggedIn':_0x3a9092[_0x0a6b('0x23')],'pTalking':_0x3a9092[_0x0a6b('0x24')],'sumBillable':_0x3a9092[_0x0a6b('0x25')],'sumDuration':_0x3a9092[_0x0a6b('0x26')],'sumHoldTime':_0x3a9092[_0x0a6b('0x27')]||0x0,'talking':_0x3a9092[_0x0a6b('0x28')],'total':_0x3a9092['total'],'type':_0x3a9092[_0x0a6b('0x29')],'unmanaged':_0x3a9092[_0x0a6b('0x2a')],'abandoned':_0x3a9092['abandoned'],'waiting':_0x3a9092[_0x0a6b('0x2b')],'loggedInDb':_0x3a9092['loggedInDb']};if(_0x3a9092['type']===_0x0a6b('0x2c')){_0xecbf0c[_0x0a6b('0x2d')]=_0x3a9092[_0x0a6b('0x2d')];_0xecbf0c[_0x0a6b('0x2e')]=_0x3a9092[_0x0a6b('0x2e')];_0xecbf0c['dialOriginateCallerIdName']=_0x3a9092['dialOriginateCallerIdName'];_0xecbf0c[_0x0a6b('0x2f')]=_0x3a9092[_0x0a6b('0x2f')];_0xecbf0c[_0x0a6b('0x30')]=_0x3a9092[_0x0a6b('0x30')];_0xecbf0c['dialPrefix']=_0x3a9092[_0x0a6b('0x31')];_0xecbf0c[_0x0a6b('0x32')]=_0x3a9092['temp'];_0xecbf0c['outboundAnswerAgiCallsDay']=_0x3a9092[_0x0a6b('0x33')];_0xecbf0c[_0x0a6b('0x34')]=_0x3a9092['outboundAnswerCallsDay'];_0xecbf0c[_0x0a6b('0x35')]=_0x3a9092[_0x0a6b('0x35')];_0xecbf0c[_0x0a6b('0x36')]=_0x3a9092[_0x0a6b('0x36')];_0xecbf0c[_0x0a6b('0x37')]=_0x3a9092[_0x0a6b('0x37')];_0xecbf0c[_0x0a6b('0x38')]=_0x3a9092[_0x0a6b('0x38')];_0xecbf0c[_0x0a6b('0x39')]=_0x3a9092[_0x0a6b('0x39')];_0xecbf0c[_0x0a6b('0x3a')]=_0x3a9092[_0x0a6b('0x3a')];_0xecbf0c['outboundNoAnswerCallsDay']=_0x3a9092[_0x0a6b('0x3b')];_0xecbf0c[_0x0a6b('0x3c')]=_0x3a9092['outboundNoSuchCallsDay'];_0xecbf0c[_0x0a6b('0x3d')]=_0x3a9092[_0x0a6b('0x3d')];_0xecbf0c[_0x0a6b('0x3e')]=_0x3a9092[_0x0a6b('0x3e')];_0xecbf0c[_0x0a6b('0x3f')]=_0x3a9092[_0x0a6b('0x3f')];_0xecbf0c[_0x0a6b('0x40')]=_0x3a9092[_0x0a6b('0x40')];_0xecbf0c[_0x0a6b('0x41')]=_0x3a9092['predictiveIntervalAnsweredCalls'];_0xecbf0c[_0x0a6b('0x42')]=_0x3a9092[_0x0a6b('0x42')];_0xecbf0c[_0x0a6b('0x43')]=_0x3a9092[_0x0a6b('0x43')];_0xecbf0c[_0x0a6b('0x44')]=_0x3a9092[_0x0a6b('0x44')];_0xecbf0c[_0x0a6b('0x45')]=_0x3a9092[_0x0a6b('0x45')];_0xecbf0c[_0x0a6b('0x46')]=_0x3a9092['predictiveIntervalErlangCalls'];_0xecbf0c[_0x0a6b('0x47')]=_0x3a9092[_0x0a6b('0x47')];_0xecbf0c[_0x0a6b('0x48')]=_0x3a9092[_0x0a6b('0x48')];_0xecbf0c[_0x0a6b('0x49')]=_0x3a9092[_0x0a6b('0x49')];_0xecbf0c[_0x0a6b('0x4a')]=_0x3a9092[_0x0a6b('0x4a')];_0xecbf0c[_0x0a6b('0x4b')]=_0x3a9092['predictiveIntervalAvailable'];_0xecbf0c[_0x0a6b('0x4c')]=_0x3a9092['predictiveIntervalTotalCalls'];_0xecbf0c['message']=_0x3a9092[_0x0a6b('0x1b')];_0xecbf0c['originated']=_0x3a9092['originated'];_0xecbf0c[_0x0a6b('0x4d')]=_0x3a9092[_0x0a6b('0x4d')];_0xecbf0c[_0x0a6b('0x4e')]=_0x3a9092['erlangCallToSecond'];_0xecbf0c[_0x0a6b('0x4f')]=_0x3a9092['erlangAbandonmentRate'];_0xecbf0c['erlangBusyFactor']=_0x3a9092[_0x0a6b('0x50')];_0xecbf0c['startPredictive']=_0x3a9092[_0x0a6b('0x51')];_0xecbf0c['startProgressive']=_0x3a9092[_0x0a6b('0x52')];}if(_0x3a9092['Trunk']){_0xecbf0c['Trunk']={'id':_0x3a9092[_0x0a6b('0x53')]['id'],'name':_0x3a9092[_0x0a6b('0x53')][_0x0a6b('0x8')],'active':_0x3a9092[_0x0a6b('0x53')]['active'],'callerid':_0x3a9092[_0x0a6b('0x53')][_0x0a6b('0x54')]};}if(_0x3a9092[_0x0a6b('0x55')]){_0xecbf0c[_0x0a6b('0x55')]={'id':_0x3a9092[_0x0a6b('0x55')]['id'],'name':_0x3a9092[_0x0a6b('0x55')][_0x0a6b('0x8')]};}_0x5b2229['push'](_0xecbf0c);}}_0x1b8b78({'count':_0x5b2229[_0x0a6b('0x56')],'rows':_0x5b2229});});},'UpdateVoiceQueue':function(_0x35061e){return new Promise(function(_0x3a189b,_0x1510a4){var _0x1ca269=_[_0x0a6b('0x57')](_0x195697[_0x0a6b('0x21')],{'id':parseInt(_0x35061e['id'])});var _0x22c339=_[_0x0a6b('0x58')](_0x35061e,['id']);if(_0x1ca269){for(var _0x5ab75f in _0x22c339){if(typeof _0x22c339[_0x5ab75f]!==_0x0a6b('0x59')&&typeof _0x1ca269[_0x5ab75f]!==_0x0a6b('0x59')){_0x1ca269[_0x5ab75f]=_0x22c339[_0x5ab75f];}}_0x3a189b(_0x1ca269);}else{_0x1510a4();}});},'VoiceChannels':function(_0x2f4ddf){return new Promise(function(_0x11e179,_0xdbf937){var _0x638ba8=_[_0x0a6b('0x5a')](_0x195697['channels']);_0x11e179({'count':_0x638ba8['length'],'rows':_0x638ba8});});},'VoiceChannelMixMonitor':function(_0x2ba6f2){var _0x341ebe=this;return new Promise(function(_0x3da85c,_0x46352e){if(ami[_0x0a6b('0x10')]()==![]){return _0x46352e(_0x341ebe[_0x0a6b('0x11')](0x1f4,[config[_0x0a6b('0x12')]['ip'],config[_0x0a6b('0x12')][_0x0a6b('0x13')],'ami\x20disconnected'][_0x0a6b('0x15')]('\x20')));}var _0x2118f4=schema(properties[_0x0a6b('0x5b')])[_0x0a6b('0x5c')](_0x2ba6f2);if(_0x2118f4[_0x0a6b('0x56')]>0x0){return _0x46352e(_0x341ebe['error'](0x1f4,_[_0x0a6b('0x5d')](_0x2118f4,_0x0a6b('0x1b'))[_0x0a6b('0x15')](',\x20')));}var _0x5fb0c3=_[_0x0a6b('0x57')](_0x195697[_0x0a6b('0x5e')],{'uniqueid':_0x2ba6f2[_0x0a6b('0x5f')]});if(_0x5fb0c3&&_0x5fb0c3[_0x0a6b('0x60')]){var _0x2a01df=util[_0x0a6b('0x61')]('%s.%s',_0x2ba6f2['filename']||_0x2ba6f2[_0x0a6b('0x5f')],_0x2ba6f2['format']||_0x0a6b('0x62'));return ami['Action']({'action':_0x0a6b('0x63'),'channel':_0x5fb0c3[_0x0a6b('0x60')],'file':_0x2a01df,'options':_0x0a6b('0x64')})['then'](function(_0x4473de){var _0x2a0e28=_['find'](_0x5fb0c3[_0x0a6b('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x2a01df[_0x0a6b('0x66')]()});if(_[_0x0a6b('0x67')](_0x2a0e28)){_0x5fb0c3['monitors'][_0x0a6b('0x68')]({'filename':'/var/spool/asterisk/monitor/'+_0x2a01df[_0x0a6b('0x66')](),'createdAt':moment()[_0x0a6b('0x61')](_0x0a6b('0x69')),'mixmonitorid':_0x4473de['mixmonitorid'],'status':_0x0a6b('0x6a')});}else{_0x2a0e28[_0x0a6b('0x6b')]=_0x4473de[_0x0a6b('0x6b')];_0x2a0e28[_0x0a6b('0x6c')]=_0x0a6b('0x6a');}_0x3da85c({'code':0xc8,'message':[_0x2ba6f2[_0x0a6b('0x5f')],'MixMonitor\x20Success',_0x4473de['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x4473de[_0x0a6b('0x6b')]});})['catch'](function(_0x3048f1){_0x46352e(_0x341ebe[_0x0a6b('0x11')](0x1f5,[_0x2ba6f2['uniqueid'],_0x3048f1['message']['toLowerCase']()][_0x0a6b('0x15')]('\x20')));});}else{return _0x46352e(_0x341ebe[_0x0a6b('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0xb84ccf){var _0x3e4c4e=this;return new Promise(function(_0x2d5fbc,_0x296cb9){if(ami[_0x0a6b('0x10')]()==![]){return _0x296cb9(_0x3e4c4e['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x0a6b('0x13')],_0x0a6b('0x14')]['join']('\x20')));}var _0x385059=schema(properties['voicechannel'])[_0x0a6b('0x5c')](_0xb84ccf);if(_0x385059[_0x0a6b('0x56')]>0x0){return _0x296cb9(_0x3e4c4e[_0x0a6b('0x11')](0x1f4,_[_0x0a6b('0x5d')](_0x385059,_0x0a6b('0x1b'))['join'](',\x20')));}var _0x1570ad=_[_0x0a6b('0x57')](_0x195697[_0x0a6b('0x5e')],{'uniqueid':_0xb84ccf[_0x0a6b('0x5f')]});if(_0x1570ad){return BPromise['resolve']()[_0x0a6b('0x1a')](function(){if(_0x1570ad[_0x0a6b('0x60')]){return ami[_0x0a6b('0x1f')]({'action':_0x0a6b('0x6d'),'channel':_0x1570ad[_0x0a6b('0x60')],'mixmonitorid':_0xb84ccf['mixmonitorid']})[_0x0a6b('0x1c')](function(_0x22312f){});}})[_0x0a6b('0x1a')](function(){if(_0x1570ad[_0x0a6b('0x6e')]){return ami[_0x0a6b('0x1f')]({'action':_0x0a6b('0x6d'),'channel':_0x1570ad[_0x0a6b('0x6e')],'mixmonitorid':_0xb84ccf[_0x0a6b('0x6b')]})['catch'](function(_0x3b0dba){});}})[_0x0a6b('0x1a')](function(_0x2e5f86){var _0x1048ac=_['find'](_0x1570ad[_0x0a6b('0x65')],{'mixmonitorid':_0xb84ccf[_0x0a6b('0x6b')]});if(_0x1048ac){_0x1048ac[_0x0a6b('0x6c')]=_0x0a6b('0x6f');}})[_0x0a6b('0x1a')](function(){var _0x3b69d6=util[_0x0a6b('0x61')](_0x0a6b('0x70'),_0xb84ccf[_0x0a6b('0x71')]||_0xb84ccf[_0x0a6b('0x5f')],_0xb84ccf[_0x0a6b('0x61')]||_0x0a6b('0x62'));var _0x2f5ef9=_[_0x0a6b('0x57')](_0x1570ad[_0x0a6b('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x3b69d6['toLowerCase']()});if(_0x2f5ef9){_0x2f5ef9[_0x0a6b('0x6c')]=_0x0a6b('0x6f');}})['then'](function(){_0x2d5fbc({'code':0xc8,'message':[_0xb84ccf[_0x0a6b('0x5f')],_0x0a6b('0x72')][_0x0a6b('0x15')]('\x20')});})[_0x0a6b('0x1c')](function(_0x3702fe){_0x296cb9(_0x3e4c4e[_0x0a6b('0x11')](0x1f5,[_0xb84ccf[_0x0a6b('0x5f')],_0x3702fe[_0x0a6b('0x1b')][_0x0a6b('0x66')]()][_0x0a6b('0x15')]('\x20')));});}else{return _0x296cb9(_0x3e4c4e[_0x0a6b('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x3b6b10){return new Promise(function(_0x5430eb,_0xd05912){var _0x12295c=_[_0x0a6b('0x5a')](_0x195697[_0x0a6b('0x73')]);_0x5430eb({'count':_0x12295c[_0x0a6b('0x56')],'rows':_0x12295c});});},'VoiceQueuesChannel':function(_0x3181c7){var _0x362a70=this;return new Promise(function(_0x5e1dc0,_0x2137a5){var _0x3d65b6=schema(properties[_0x0a6b('0x74')])[_0x0a6b('0x5c')](_0x3181c7);if(_0x3d65b6[_0x0a6b('0x56')]>0x0){return _0x2137a5(_0x362a70['error'](0x1f4,_[_0x0a6b('0x5d')](_0x3d65b6,'message')['join'](',\x20')));}var _0xaa13ee=_[_0x0a6b('0x57')](_0x195697[_0x0a6b('0x73')],{'uniqueid':_0x3181c7[_0x0a6b('0x5f')]});if(_0xaa13ee){_0x5e1dc0(_0xaa13ee);}else{return _0x2137a5(_0x362a70[_0x0a6b('0x11')](0x1f5,_0x0a6b('0x75')));}});},'VoiceQueuesChannelHangup':function(_0x1e8d41){var _0x18c85f=this;return new Promise(function(_0x1c00ab,_0x1011fa){if(ami[_0x0a6b('0x10')]()==![]){return _0x1011fa(_0x18c85f[_0x0a6b('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x0a6b('0x12')][_0x0a6b('0x13')],_0x0a6b('0x14')][_0x0a6b('0x15')]('\x20')));}var _0x48c704=schema(properties[_0x0a6b('0x76')])['validate'](_0x1e8d41);if(_0x48c704[_0x0a6b('0x56')]>0x0){return _0x1011fa(_0x18c85f[_0x0a6b('0x11')](0x1f4,_['map'](_0x48c704,'message')[_0x0a6b('0x15')](',\x20')));}var _0x4da8c2=_[_0x0a6b('0x57')](_0x195697['queueChannels'],{'uniqueid':_0x1e8d41[_0x0a6b('0x5f')]});if(_0x4da8c2&&_0x4da8c2['channel']){return ami[_0x0a6b('0x1f')]({'action':_0x0a6b('0x77'),'channel':_0x4da8c2['channel']})['then'](function(_0xc3571a){_0x1c00ab({'code':0xc8,'message':[_0x1e8d41[_0x0a6b('0x5f')],_0xc3571a[_0x0a6b('0x1b')][_0x0a6b('0x66')]()]['join']('\x20')});})[_0x0a6b('0x1c')](function(_0x54c4da){_0x1011fa(_0x18c85f[_0x0a6b('0x11')](0x1f5,[_0x1e8d41[_0x0a6b('0x5f')],_0x54c4da[_0x0a6b('0x1b')][_0x0a6b('0x66')]()][_0x0a6b('0x15')]('\x20')));});}else{return _0x1011fa(_0x18c85f[_0x0a6b('0x11')](0x1f5,_0x0a6b('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x422891){var _0x50649f=this;return new Promise(function(_0x2a3fdc,_0x5e565a){if(ami[_0x0a6b('0x10')]()==![]){return _0x5e565a(_0x50649f[_0x0a6b('0x11')](0x1f4,[config[_0x0a6b('0x12')]['ip'],config[_0x0a6b('0x12')]['username'],_0x0a6b('0x14')][_0x0a6b('0x15')]('\x20')));}var _0x4c2fec=schema(properties[_0x0a6b('0x78')])['validate'](_0x422891);if(_0x4c2fec[_0x0a6b('0x56')]>0x0){return _0x5e565a(_0x50649f[_0x0a6b('0x11')](0x1f4,_['map'](_0x4c2fec,'message')[_0x0a6b('0x15')](',\x20')));}var _0x12408c=_['find'](_0x195697[_0x0a6b('0x73')],{'uniqueid':_0x422891[_0x0a6b('0x5f')]});if(_0x12408c&&_0x12408c['channel']){return ami[_0x0a6b('0x1f')]({'action':_0x0a6b('0x79'),'channel':_0x12408c[_0x0a6b('0x60')],'exten':_0x422891['exten'],'context':_0x422891[_0x0a6b('0x7a')]||_0x12408c[_0x0a6b('0x7a')],'priority':0x1})[_0x0a6b('0x1a')](function(_0x44e891){_0x2a3fdc({'code':0xc8,'message':[_0x422891['uniqueid'],_0x44e891[_0x0a6b('0x1b')]['toLowerCase']()]['join']('\x20')});})[_0x0a6b('0x1c')](function(_0x204626){_0x5e565a(_0x50649f[_0x0a6b('0x11')](0x1f5,[_0x422891[_0x0a6b('0x5f')],_0x204626['message'][_0x0a6b('0x66')]()][_0x0a6b('0x15')]('\x20')));});}else{return _0x5e565a(_0x50649f[_0x0a6b('0x11')](0x1f5,_0x0a6b('0x75')));}});},'Agents':function(_0xbb7140){return new Promise(function(_0x2cabec,_0x2d25ac){var _0xd5e4ad=_[_0x0a6b('0x5a')](_0x195697[_0x0a6b('0xc')]);_0x2cabec({'count':_0xd5e4ad[_0x0a6b('0x56')],'rows':_0xd5e4ad});});},'Telephones':function(_0x33ce34){return new Promise(function(_0xdf0acc,_0x516170){var _0x482878=_[_0x0a6b('0x5a')](_0x195697['telephones']);_0xdf0acc({'count':_0x482878[_0x0a6b('0x56')],'rows':_0x482878});});},'Trunks':function(_0xb5e93d){return new Promise(function(_0x5004fb,_0x42e0eb){var _0x689a96=_[_0x0a6b('0x5a')](_0x195697[_0x0a6b('0x7b')]);_0x5004fb({'count':_0x689a96['length'],'rows':_0x689a96});});},'OutboundChannels':function(_0x3a88a3){return new Promise(function(_0x4d868a,_0x16d728){var _0x2f83f6=_[_0x0a6b('0x5a')](_0x195697[_0x0a6b('0x7c')]);_0x4d868a({'count':_0x2f83f6[_0x0a6b('0x56')],'rows':_0x2f83f6});});},'Outbound':function(_0x465edc){return new Promise(function(_0x2c1785,_0x1dfd6d){_0x2c1785(_0x195697[_0x0a6b('0x2c')]);});},'Campaigns':function(_0x44c00a){return new Promise(function(_0x382bc9,_0xb56cff){var _0x1729b3=_[_0x0a6b('0x5a')](_0x195697['campaigns']);_0x382bc9({'count':_0x1729b3[_0x0a6b('0x56')],'rows':_0x1729b3});});},'VoiceQueuesPreview':function(_0x3b837d){var _0x47c16d=this;return new Promise(function(_0xb295b7,_0x9d06ab){_0xc7140c[_0x0a6b('0x7d')](_0x3b837d['id'])['then'](function(_0x63e98b){_0xb295b7({'code':0xc8,'message':_0x63e98b[_0x0a6b('0x1b')]});})[_0x0a6b('0x1c')](function(_0x4d8e1e){_0x9d06ab(_0x47c16d[_0x0a6b('0x11')](0x1f4,_0x4d8e1e['message']));});});},'EventManager':function(_0x1f745a){var _0x59b482=this;return new Promise(function(_0x42b1c0,_0xe5279b){if(!_0x1f745a['event']){return _0xe5279b(_0x59b482['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x0a6b('0x7e')](_0x0a6b('0x7f')+_0x1f745a[_0x0a6b('0x80')],_0x1f745a[_0x0a6b('0x1b')]);_0x42b1c0({'code':0xc8,'message':_0x1f745a});});},'FaxAccounts':function(_0x40a0d1){return new Promise(function(_0x430dbd,_0x443e13){var _0x4b9e79=_[_0x0a6b('0x5a')](_0x195697[_0x0a6b('0x81')]);_0x430dbd({'count':_0x4b9e79['length'],'rows':_0x4b9e79});});},'SendFax':function(_0x1d9118){var _0x4e7641=this;return new Promise(function(_0x5b8e37,_0x25a602){_0x3dc2b0[_0x0a6b('0x82')](_0x1d9118)['then'](function(_0x436477){_0x5b8e37({'code':0xc8,'message':_0x436477[_0x0a6b('0x1b')]});})[_0x0a6b('0x1c')](function(_0x4ebc86){_0x25a602(_0x4e7641[_0x0a6b('0x11')](0x1f4,_0x4ebc86[_0x0a6b('0x1b')]));});});},'CheckAfterSend':function(_0x1ea868){var _0x27aa04=this;return new Promise(function(_0x42d319,_0xeed3d8){_0x3dc2b0['checkAfterSend'](_0x1ea868)[_0x0a6b('0x1a')](function(_0x4e042f){_0x42d319({'code':0xc8,'message':_0x4e042f[_0x0a6b('0x1b')]});})[_0x0a6b('0x1c')](function(_0x16ecc5){_0xeed3d8(_0x27aa04[_0x0a6b('0x11')](0x1f4,_0x16ecc5['message']));});});}};var _0x1cf756=jayson[_0x0a6b('0x83')](_0xa908dd)['http']();_0x1cf756['on'](_0x0a6b('0x11'),function(_0x435151){return _0x1b5fb5(_0x435151);});_0x1cf756[_0x0a6b('0x6')](0x232a,_0x0a6b('0x84'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3b6967(_0x0a6b('0x85')+0x232a);});});}; \ No newline at end of file +var _0xed1c=['outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','find','omit','undefined','channels','validate','length','map','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','status','catch','uniqueid','voicechannel','resolve','StopMixMonitor','destinationchannel','monitors','stop','filename','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Channel\x20doesn\x27t\x20exist','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','emit','custom:','faxAccounts','send','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','../../../config/environment','../properties','../ami','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','module','action','Reload','Action','then','message','pick','Command','content','voiceQueues','name','strategy','answered','available','pTalking','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay'];(function(_0x8735cc,_0x2ec709){var _0x1f8608=function(_0x57a397){while(--_0x57a397){_0x8735cc['push'](_0x8735cc['shift']());}};_0x1f8608(++_0x2ec709);}(_0xed1c,0xe4));var _0xced1=function(_0x51536e,_0x31ba57){_0x51536e=_0x51536e-0x0;var _0x3cd30f=_0xed1c[_0x51536e];return _0x3cd30f;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require('bluebird');var moment=require('moment');var config=require(_0xced1('0x2'));var properties=require(_0xced1('0x3'));var ami=require(_0xced1('0x4'));exports['listen']=function(_0x1e23a9,_0x445160,_0x466657){return new BPromise(function(_0x37b22b,_0x59399e){var _0x2bcf42={'QueuePause':function(_0x38bca8){return new Promise(function(_0x39d5df,_0x1fb40b){var _0x354203=util[_0xced1('0x5')](_0xced1('0x6'),_0xced1('0x7'),_0x38bca8['name']);if(_0x1e23a9[_0xced1('0x8')]&&_0x1e23a9['timers'][_0x354203]&&_0x1e23a9[_0xced1('0x8')][_0x354203][_0xced1('0x9')]){_0x1e23a9[_0xced1('0x8')][_0x354203][_0xced1('0xa')]();}if(_0x1e23a9[_0xced1('0xb')][_0x354203]){_0x1e23a9[_0xced1('0xb')][_0x354203][_0xced1('0xc')]({'statePause':_0x38bca8['pause']?!![]:![]});}_0x39d5df({'code':0xc8,'message':_0xced1('0xd')});});},'Reload':function(_0x2a5cd6){var _0x1b7a33=this;return new Promise(function(_0x52d96a,_0x564e17){if(ami[_0xced1('0xe')]()==![]){return _0x564e17(_0x1b7a33[_0xced1('0xf')](0x1f4,[config['asterisk']['ip'],config[_0xced1('0x10')][_0xced1('0x11')],_0xced1('0x12')][_0xced1('0x13')]('\x20')));}_0x2a5cd6=_['pick'](_0x2a5cd6,_['keys'](properties[_0xced1('0x14')]));_0x2a5cd6[_0xced1('0x15')]=_0xced1('0x16');return ami[_0xced1('0x17')](_0x2a5cd6)[_0xced1('0x18')](function(_0x292997){_0x52d96a({'code':0xc8,'message':_0x292997['message']});})['catch'](function(_0x2a92c8){_0x564e17(_0x1b7a33[_0xced1('0xf')](0x1f5,_0x2a92c8[_0xced1('0x19')]));});});},'Command':function(_0x5257e7){var _0x1eac14=this;return new Promise(function(_0x25f0df,_0x3e51e4){if(ami['isConnected']()==![]){return _0x3e51e4(_0x1eac14[_0xced1('0xf')](0x1f4,[config[_0xced1('0x10')]['ip'],config[_0xced1('0x10')]['username'],_0xced1('0x12')][_0xced1('0x13')]('\x20')));}_0x5257e7=_[_0xced1('0x1a')](_0x5257e7,'command');_0x5257e7['action']=_0xced1('0x1b');return ami[_0xced1('0x17')](_0x5257e7)[_0xced1('0x18')](function(_0x20dcb4){_0x25f0df({'code':0xc8,'message':_0x20dcb4[_0xced1('0x1c')]});})['catch'](function(_0x14f47e){_0x3e51e4(_0x1eac14[_0xced1('0xf')](0x1f5,_0x14f47e['message']));});});},'VoiceQueues':function(_0x5f2018){return new Promise(function(_0x38f738,_0x258c9a){var _0x3af9c0=[];for(var _0x3912fe in _0x1e23a9[_0xced1('0x1d')]){if(_0x1e23a9[_0xced1('0x1d')]['hasOwnProperty'](_0x3912fe)){var _0x181f6e=_0x1e23a9[_0xced1('0x1d')][_0x3912fe];var _0x43cdec={'id':_0x181f6e['id'],'name':_0x181f6e[_0xced1('0x1e')],'strategy':_0x181f6e[_0xced1('0x1f')],'answered':_0x181f6e[_0xced1('0x20')],'available':_0x181f6e[_0xced1('0x21')],'loggedIn':_0x181f6e['loggedIn'],'pTalking':_0x181f6e[_0xced1('0x22')],'sumBillable':_0x181f6e['sumBillable'],'sumDuration':_0x181f6e[_0xced1('0x23')],'sumHoldTime':_0x181f6e[_0xced1('0x24')]||0x0,'talking':_0x181f6e[_0xced1('0x25')],'total':_0x181f6e[_0xced1('0x26')],'type':_0x181f6e['type'],'unmanaged':_0x181f6e['unmanaged'],'abandoned':_0x181f6e[_0xced1('0x27')],'waiting':_0x181f6e[_0xced1('0x28')],'loggedInDb':_0x181f6e[_0xced1('0x29')]};if(_0x181f6e['type']==='outbound'){_0x43cdec['dialActive']=_0x181f6e[_0xced1('0x2a')];_0x43cdec[_0xced1('0x2b')]=_0x181f6e[_0xced1('0x2b')];_0x43cdec[_0xced1('0x2c')]=_0x181f6e['dialOriginateCallerIdName'];_0x43cdec[_0xced1('0x2d')]=_0x181f6e[_0xced1('0x2d')];_0x43cdec[_0xced1('0x2e')]=_0x181f6e[_0xced1('0x2e')];_0x43cdec[_0xced1('0x2f')]=_0x181f6e[_0xced1('0x2f')];_0x43cdec[_0xced1('0x30')]=_0x181f6e['temp'];_0x43cdec['outboundAnswerAgiCallsDay']=_0x181f6e[_0xced1('0x31')];_0x43cdec[_0xced1('0x32')]=_0x181f6e[_0xced1('0x32')];_0x43cdec[_0xced1('0x33')]=_0x181f6e[_0xced1('0x33')];_0x43cdec[_0xced1('0x34')]=_0x181f6e['outboundBusyCallsDay'];_0x43cdec['outboundCongestionCallsDay']=_0x181f6e['outboundCongestionCallsDay'];_0x43cdec['outboundDropCallsDayACS']=_0x181f6e[_0xced1('0x35')];_0x43cdec[_0xced1('0x36')]=_0x181f6e[_0xced1('0x36')];_0x43cdec[_0xced1('0x37')]=_0x181f6e[_0xced1('0x37')];_0x43cdec[_0xced1('0x38')]=_0x181f6e[_0xced1('0x38')];_0x43cdec[_0xced1('0x39')]=_0x181f6e[_0xced1('0x39')];_0x43cdec[_0xced1('0x3a')]=_0x181f6e[_0xced1('0x3a')];_0x43cdec[_0xced1('0x3b')]=_0x181f6e[_0xced1('0x3b')];_0x43cdec['outboundRejectCallsDay']=_0x181f6e[_0xced1('0x3c')];_0x43cdec[_0xced1('0x3d')]=_0x181f6e[_0xced1('0x3d')];_0x43cdec[_0xced1('0x3e')]=_0x181f6e[_0xced1('0x3e')];_0x43cdec[_0xced1('0x3f')]=_0x181f6e['predictiveIntervalAvgHoldtime'];_0x43cdec[_0xced1('0x40')]=_0x181f6e[_0xced1('0x40')];_0x43cdec[_0xced1('0x41')]=_0x181f6e[_0xced1('0x41')];_0x43cdec[_0xced1('0x42')]=_0x181f6e[_0xced1('0x42')];_0x43cdec[_0xced1('0x43')]=_0x181f6e[_0xced1('0x43')];_0x43cdec[_0xced1('0x44')]=_0x181f6e[_0xced1('0x44')];_0x43cdec[_0xced1('0x45')]=_0x181f6e['predictiveIntervalHitRate'];_0x43cdec['predictiveIntervalMultiplicativeFactor']=_0x181f6e[_0xced1('0x46')];_0x43cdec[_0xced1('0x47')]=_0x181f6e[_0xced1('0x47')];_0x43cdec['predictiveIntervalAvailable']=_0x181f6e[_0xced1('0x48')];_0x43cdec[_0xced1('0x49')]=_0x181f6e[_0xced1('0x49')];_0x43cdec['message']=_0x181f6e[_0xced1('0x19')];_0x43cdec[_0xced1('0x4a')]=_0x181f6e['originated'];_0x43cdec[_0xced1('0x4b')]=_0x181f6e['erlangCalls'];_0x43cdec[_0xced1('0x4c')]=_0x181f6e[_0xced1('0x4c')];_0x43cdec['erlangAbandonmentRate']=_0x181f6e[_0xced1('0x4d')];_0x43cdec[_0xced1('0x4e')]=_0x181f6e[_0xced1('0x4e')];_0x43cdec['startPredictive']=_0x181f6e[_0xced1('0x4f')];_0x43cdec[_0xced1('0x50')]=_0x181f6e['startProgressive'];}if(_0x181f6e[_0xced1('0x51')]){_0x43cdec['Trunk']={'id':_0x181f6e['Trunk']['id'],'name':_0x181f6e[_0xced1('0x51')]['name'],'active':_0x181f6e[_0xced1('0x51')][_0xced1('0x52')],'callerid':_0x181f6e[_0xced1('0x51')]['callerid']};}if(_0x181f6e[_0xced1('0x53')]){_0x43cdec['Interval']={'id':_0x181f6e[_0xced1('0x53')]['id'],'name':_0x181f6e[_0xced1('0x53')][_0xced1('0x1e')]};}_0x3af9c0[_0xced1('0x54')](_0x43cdec);}}_0x38f738({'count':_0x3af9c0['length'],'rows':_0x3af9c0});});},'UpdateVoiceQueue':function(_0x19906c){return new Promise(function(_0x1d5034,_0x54c62c){var _0x4733f0=_[_0xced1('0x55')](_0x1e23a9['voiceQueues'],{'id':parseInt(_0x19906c['id'])});var _0x1800c8=_[_0xced1('0x56')](_0x19906c,['id']);if(_0x4733f0){for(var _0x1646df in _0x1800c8){if(typeof _0x1800c8[_0x1646df]!=='undefined'&&typeof _0x4733f0[_0x1646df]!==_0xced1('0x57')){_0x4733f0[_0x1646df]=_0x1800c8[_0x1646df];}}_0x1d5034(_0x4733f0);}else{_0x54c62c();}});},'VoiceChannels':function(_0xcfbed8){return new Promise(function(_0x39fc4a,_0x3333e6){var _0x376619=_['values'](_0x1e23a9[_0xced1('0x58')]);_0x39fc4a({'count':_0x376619['length'],'rows':_0x376619});});},'VoiceChannelMixMonitor':function(_0x31fb76){var _0x646987=this;return new Promise(function(_0xf06f87,_0x24cce1){if(ami[_0xced1('0xe')]()==![]){return _0x24cce1(_0x646987[_0xced1('0xf')](0x1f4,[config['asterisk']['ip'],config[_0xced1('0x10')][_0xced1('0x11')],'ami\x20disconnected'][_0xced1('0x13')]('\x20')));}var _0x5a717a=schema(properties['voicechannel'])[_0xced1('0x59')](_0x31fb76);if(_0x5a717a[_0xced1('0x5a')]>0x0){return _0x24cce1(_0x646987[_0xced1('0xf')](0x1f4,_[_0xced1('0x5b')](_0x5a717a,'message')[_0xced1('0x13')](',\x20')));}var _0x33a8a6=_[_0xced1('0x55')](_0x1e23a9['channels'],{'uniqueid':_0x31fb76['uniqueid']});if(_0x33a8a6&&_0x33a8a6[_0xced1('0x5c')]){var _0x1c51a6=util[_0xced1('0x5')](_0xced1('0x5d'),_0x31fb76['filename']||_0x31fb76['uniqueid'],_0x31fb76['format']||_0xced1('0x5e'));return ami[_0xced1('0x17')]({'action':_0xced1('0x5f'),'channel':_0x33a8a6[_0xced1('0x5c')],'file':_0x1c51a6,'options':_0xced1('0x60')})[_0xced1('0x18')](function(_0x211fd0){var _0x323b32=_[_0xced1('0x55')](_0x33a8a6['monitors'],{'filename':_0xced1('0x61')+_0x1c51a6[_0xced1('0x62')]()});if(_[_0xced1('0x63')](_0x323b32)){_0x33a8a6['monitors'][_0xced1('0x54')]({'filename':_0xced1('0x61')+_0x1c51a6[_0xced1('0x62')](),'createdAt':moment()[_0xced1('0x5')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x211fd0[_0xced1('0x64')],'status':'rec'});}else{_0x323b32['mixmonitorid']=_0x211fd0[_0xced1('0x64')];_0x323b32[_0xced1('0x65')]='rec';}_0xf06f87({'code':0xc8,'message':[_0x31fb76['uniqueid'],'MixMonitor\x20Success',_0x211fd0[_0xced1('0x64')]]['join']('\x20'),'mixmonitorid':_0x211fd0[_0xced1('0x64')]});})[_0xced1('0x66')](function(_0x12241d){_0x24cce1(_0x646987[_0xced1('0xf')](0x1f5,[_0x31fb76[_0xced1('0x67')],_0x12241d[_0xced1('0x19')][_0xced1('0x62')]()][_0xced1('0x13')]('\x20')));});}else{return _0x24cce1(_0x646987['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4832d2){var _0x45e587=this;return new Promise(function(_0x235651,_0x34262e){if(ami['isConnected']()==![]){return _0x34262e(_0x45e587[_0xced1('0xf')](0x1f4,[config[_0xced1('0x10')]['ip'],config[_0xced1('0x10')][_0xced1('0x11')],'ami\x20disconnected'][_0xced1('0x13')]('\x20')));}var _0x2abd02=schema(properties[_0xced1('0x68')])[_0xced1('0x59')](_0x4832d2);if(_0x2abd02[_0xced1('0x5a')]>0x0){return _0x34262e(_0x45e587[_0xced1('0xf')](0x1f4,_[_0xced1('0x5b')](_0x2abd02,_0xced1('0x19'))['join'](',\x20')));}var _0x4bebc8=_['find'](_0x1e23a9[_0xced1('0x58')],{'uniqueid':_0x4832d2['uniqueid']});if(_0x4bebc8){return BPromise[_0xced1('0x69')]()['then'](function(){if(_0x4bebc8['channel']){return ami[_0xced1('0x17')]({'action':_0xced1('0x6a'),'channel':_0x4bebc8[_0xced1('0x5c')],'mixmonitorid':_0x4832d2[_0xced1('0x64')]})[_0xced1('0x66')](function(_0x466da1){});}})[_0xced1('0x18')](function(){if(_0x4bebc8[_0xced1('0x6b')]){return ami[_0xced1('0x17')]({'action':_0xced1('0x6a'),'channel':_0x4bebc8[_0xced1('0x6b')],'mixmonitorid':_0x4832d2['mixmonitorid']})[_0xced1('0x66')](function(_0x168e5b){});}})['then'](function(_0x8b38ce){var _0x26f154=_['find'](_0x4bebc8[_0xced1('0x6c')],{'mixmonitorid':_0x4832d2[_0xced1('0x64')]});if(_0x26f154){_0x26f154[_0xced1('0x65')]=_0xced1('0x6d');}})[_0xced1('0x18')](function(){var _0x5c9a6d=util['format']('%s.%s',_0x4832d2[_0xced1('0x6e')]||_0x4832d2[_0xced1('0x67')],_0x4832d2['format']||_0xced1('0x5e'));var _0x10447b=_[_0xced1('0x55')](_0x4bebc8['monitors'],{'filename':_0xced1('0x61')+_0x5c9a6d[_0xced1('0x62')]()});if(_0x10447b){_0x10447b['status']=_0xced1('0x6d');}})['then'](function(){_0x235651({'code':0xc8,'message':[_0x4832d2[_0xced1('0x67')],_0xced1('0x6f')][_0xced1('0x13')]('\x20')});})[_0xced1('0x66')](function(_0x286695){_0x34262e(_0x45e587[_0xced1('0xf')](0x1f5,[_0x4832d2[_0xced1('0x67')],_0x286695['message'][_0xced1('0x62')]()][_0xced1('0x13')]('\x20')));});}else{return _0x34262e(_0x45e587[_0xced1('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5c2567){return new Promise(function(_0x27f1f1,_0x1fdf2c){var _0x552de8=_[_0xced1('0x70')](_0x1e23a9[_0xced1('0x71')]);_0x27f1f1({'count':_0x552de8[_0xced1('0x5a')],'rows':_0x552de8});});},'VoiceQueuesChannel':function(_0x51c879){var _0x57107b=this;return new Promise(function(_0x13689f,_0x4f9981){var _0x76f5df=schema(properties[_0xced1('0x72')])[_0xced1('0x59')](_0x51c879);if(_0x76f5df[_0xced1('0x5a')]>0x0){return _0x4f9981(_0x57107b['error'](0x1f4,_[_0xced1('0x5b')](_0x76f5df,'message')['join'](',\x20')));}var _0x5973e4=_['find'](_0x1e23a9[_0xced1('0x71')],{'uniqueid':_0x51c879[_0xced1('0x67')]});if(_0x5973e4){_0x13689f(_0x5973e4);}else{return _0x4f9981(_0x57107b['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x334928){var _0x1e9956=this;return new Promise(function(_0x4eefea,_0x591f11){if(ami[_0xced1('0xe')]()==![]){return _0x591f11(_0x1e9956[_0xced1('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0xced1('0x13')]('\x20')));}var _0x135f0f=schema(properties[_0xced1('0x73')])[_0xced1('0x59')](_0x334928);if(_0x135f0f[_0xced1('0x5a')]>0x0){return _0x591f11(_0x1e9956[_0xced1('0xf')](0x1f4,_['map'](_0x135f0f,_0xced1('0x19'))[_0xced1('0x13')](',\x20')));}var _0x2d5b26=_[_0xced1('0x55')](_0x1e23a9[_0xced1('0x71')],{'uniqueid':_0x334928[_0xced1('0x67')]});if(_0x2d5b26&&_0x2d5b26[_0xced1('0x5c')]){return ami[_0xced1('0x17')]({'action':_0xced1('0x74'),'channel':_0x2d5b26['channel']})['then'](function(_0x607728){_0x4eefea({'code':0xc8,'message':[_0x334928['uniqueid'],_0x607728[_0xced1('0x19')]['toLowerCase']()][_0xced1('0x13')]('\x20')});})[_0xced1('0x66')](function(_0x70bc63){_0x591f11(_0x1e9956[_0xced1('0xf')](0x1f5,[_0x334928[_0xced1('0x67')],_0x70bc63[_0xced1('0x19')]['toLowerCase']()][_0xced1('0x13')]('\x20')));});}else{return _0x591f11(_0x1e9956[_0xced1('0xf')](0x1f5,_0xced1('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x3e7070){var _0x137460=this;return new Promise(function(_0x2ec441,_0x4fc259){if(ami['isConnected']()==![]){return _0x4fc259(_0x137460[_0xced1('0xf')](0x1f4,[config[_0xced1('0x10')]['ip'],config[_0xced1('0x10')][_0xced1('0x11')],_0xced1('0x12')]['join']('\x20')));}var _0x73ba9a=schema(properties[_0xced1('0x76')])[_0xced1('0x59')](_0x3e7070);if(_0x73ba9a[_0xced1('0x5a')]>0x0){return _0x4fc259(_0x137460['error'](0x1f4,_[_0xced1('0x5b')](_0x73ba9a,_0xced1('0x19'))['join'](',\x20')));}var _0x470053=_['find'](_0x1e23a9[_0xced1('0x71')],{'uniqueid':_0x3e7070[_0xced1('0x67')]});if(_0x470053&&_0x470053[_0xced1('0x5c')]){return ami[_0xced1('0x17')]({'action':_0xced1('0x77'),'channel':_0x470053[_0xced1('0x5c')],'exten':_0x3e7070[_0xced1('0x78')],'context':_0x3e7070[_0xced1('0x79')]||_0x470053[_0xced1('0x79')],'priority':0x1})[_0xced1('0x18')](function(_0x525e46){_0x2ec441({'code':0xc8,'message':[_0x3e7070[_0xced1('0x67')],_0x525e46[_0xced1('0x19')][_0xced1('0x62')]()][_0xced1('0x13')]('\x20')});})['catch'](function(_0x35ff8d){_0x4fc259(_0x137460[_0xced1('0xf')](0x1f5,[_0x3e7070[_0xced1('0x67')],_0x35ff8d[_0xced1('0x19')]['toLowerCase']()][_0xced1('0x13')]('\x20')));});}else{return _0x4fc259(_0x137460[_0xced1('0xf')](0x1f5,_0xced1('0x75')));}});},'Agents':function(_0x265b76){return new Promise(function(_0x3beefd,_0x4fa469){var _0x5d9a97=_['values'](_0x1e23a9[_0xced1('0xb')]);_0x3beefd({'count':_0x5d9a97[_0xced1('0x5a')],'rows':_0x5d9a97});});},'Telephones':function(_0x1abc72){return new Promise(function(_0x4dde74,_0x41d724){var _0x328079=_['values'](_0x1e23a9[_0xced1('0x7a')]);_0x4dde74({'count':_0x328079['length'],'rows':_0x328079});});},'Trunks':function(_0xc4a5c8){return new Promise(function(_0x16bcaa,_0x2b8d1b){var _0x5aeea4=_['values'](_0x1e23a9[_0xced1('0x7b')]);_0x16bcaa({'count':_0x5aeea4[_0xced1('0x5a')],'rows':_0x5aeea4});});},'OutboundChannels':function(_0x3a4bd6){return new Promise(function(_0x20e68a,_0x1f539f){var _0x5f3a8d=_['values'](_0x1e23a9[_0xced1('0x7c')]);_0x20e68a({'count':_0x5f3a8d[_0xced1('0x5a')],'rows':_0x5f3a8d});});},'Outbound':function(_0x410c40){return new Promise(function(_0x4cf606,_0x25fabe){_0x4cf606(_0x1e23a9['outbound']);});},'Campaigns':function(_0x535aaf){return new Promise(function(_0xd54ed3,_0x5a63bf){var _0x18a6a9=_['values'](_0x1e23a9[_0xced1('0x7d')]);_0xd54ed3({'count':_0x18a6a9[_0xced1('0x5a')],'rows':_0x18a6a9});});},'VoiceQueuesPreview':function(_0xb153dc){var _0x19bfcf=this;return new Promise(function(_0x1eac74,_0x4536df){_0x445160[_0xced1('0x7e')](_0xb153dc['id'])['then'](function(_0x4b3511){_0x1eac74({'code':0xc8,'message':_0x4b3511[_0xced1('0x19')]});})[_0xced1('0x66')](function(_0x23d0d4){_0x4536df(_0x19bfcf[_0xced1('0xf')](0x1f4,_0x23d0d4['message']));});});},'EventManager':function(_0x51107f){var _0x36358b=this;return new Promise(function(_0x4f61bb,_0x1f13af){if(!_0x51107f[_0xced1('0x7f')]){return _0x1f13af(_0x36358b[_0xced1('0xf')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xced1('0x80')](_0xced1('0x81')+_0x51107f['event'],_0x51107f[_0xced1('0x19')]);_0x4f61bb({'code':0xc8,'message':_0x51107f});});},'FaxAccounts':function(_0x25128f){return new Promise(function(_0x3173cc,_0x5e3a52){var _0x2f4f7a=_[_0xced1('0x70')](_0x1e23a9[_0xced1('0x82')]);_0x3173cc({'count':_0x2f4f7a[_0xced1('0x5a')],'rows':_0x2f4f7a});});},'SendFax':function(_0xce8b5){var _0x4725eb=this;return new Promise(function(_0x53fca5,_0x5126d2){_0x466657[_0xced1('0x83')](_0xce8b5)[_0xced1('0x18')](function(_0x455b4e){_0x53fca5({'code':0xc8,'message':_0x455b4e[_0xced1('0x19')]});})[_0xced1('0x66')](function(_0xd997a5){_0x5126d2(_0x4725eb[_0xced1('0xf')](0x1f4,_0xd997a5[_0xced1('0x19')]));});});},'CheckAfterSend':function(_0x401ed5){var _0x43b907=this;return new Promise(function(_0x7b033d,_0x4f22eb){_0x466657['checkAfterSend'](_0x401ed5)[_0xced1('0x18')](function(_0x3a0044){_0x7b033d({'code':0xc8,'message':_0x3a0044[_0xced1('0x19')]});})[_0xced1('0x66')](function(_0x128817){_0x4f22eb(_0x43b907[_0xced1('0xf')](0x1f4,_0x128817[_0xced1('0x19')]));});});}};var _0x14cbf1=jayson[_0xced1('0x84')](_0x2bcf42)[_0xced1('0x85')]();_0x14cbf1['on'](_0xced1('0xf'),function(_0xd39989){return _0x59399e(_0xd39989);});_0x14cbf1[_0xced1('0x86')](0x232a,_0xced1('0x87'),function(){console[_0xced1('0x88')](_0xced1('0x89'),0x232a);return _0x37b22b(_0xced1('0x8a')+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 959abd4..cb7a8fc 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 _0x15d2=['createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','calleridnum','format','user:%s','name','action','toLowerCase','merge','lodash','ioredis','util','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data2','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','lastName','mobile','fax'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x15d2,0x177));var _0x215d=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x15d2[_0x358806];return _0x19fdcb;};'use strict';var _=require(_0x215d('0x0'));var BPromise=require('bluebird');var Redis=require(_0x215d('0x1'));var util=require(_0x215d('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x215d('0x3'));var cmContactRpc=require(_0x215d('0x4'));config[_0x215d('0x5')]=_['defaults'](config[_0x215d('0x5')],{'host':_0x215d('0x6'),'port':0x18eb});var io=require(_0x215d('0x7'))(new Redis(config[_0x215d('0x5')]));function emit(_0xa89030,_0x1854d5,_0x2d0887,_0x4cc217,_0x4319f6){logger[_0x215d('0x8')](_0x215d('0x9'),_0xa89030,_0x1854d5['id'],_0x2d0887,_0x4cc217,JSON[_0x215d('0xa')](_0x4319f6));io['to'](_0x2d0887)['emit'](_0x4cc217,_0x4319f6);}exports[_0x215d('0xb')]=function(_0x1fd388,_0x5bca12,_0x2bb2ff,_0x28cc3d){var _0x3eba5d,_0x301e43;var _0x454ed1={};var _0x2a4531=Number(_0x2bb2ff['data1']);var _0x42046e=_0x2bb2ff[_0x215d('0xc')]?Boolean(Number(_0x2bb2ff[_0x215d('0xc')])):![];var _0x327285;if(_0x28cc3d[_0x215d('0xd')]){_0x454ed1['id']=_0x28cc3d[_0x215d('0xd')];}if(!_0x454ed1['id']){_0x454ed1[_0x215d('0xe')]=_0x2a4531;_0x327285=_0x2bb2ff[_0x215d('0xf')]&&_0x2bb2ff[_0x215d('0xf')]!=='0'?_0x2bb2ff[_0x215d('0xf')][_0x215d('0x10')](','):[_0x215d('0x11')];_0x454ed1[_0x215d('0x12')]=_['map'](_0x327285,function(_0x7c5962){var _0xbddcc9={};_0xbddcc9[_0x7c5962]=_0x28cc3d[_0x215d('0x13')]?_0x28cc3d[_0x215d('0x14')]:_0x28cc3d['calleridnum'];return _0xbddcc9;});}var _0x5143d3=['id','firstName',_0x215d('0x15'),_0x215d('0x11'),_0x215d('0x16'),_0x215d('0x17'),'ListId',_0x215d('0x18'),_0x215d('0x19'),_0x215d('0x1a')];var _0x1e3fa6=_[_0x215d('0x1b')](_0x5143d3,_0x327285);BPromise[_0x215d('0x1c')]()[_0x215d('0x1d')](cmContactRpc[_0x215d('0x1e')]({'attributes':_0x1e3fa6,'where':_0x454ed1}))['then'](function(_0x815da9){_0x301e43=_0x815da9;if(!_[_0x215d('0x1f')](_0x301e43)){if(_0x301e43[_0x215d('0x20')]===0x1){_0x3eba5d=_0x301e43[0x0];logger[_0x215d('0x8')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x28cc3d[_0x215d('0x21')],_0x5bca12['id'],_0x3eba5d['id']);}else{logger['info'](_0x215d('0x22'),_0x28cc3d['uniqueid'],_0x5bca12['id'],_[_0x215d('0x23')](_0x301e43,'id')[_0x215d('0x24')](','));}return;}else{logger[_0x215d('0x8')](_0x215d('0x25'),_0x28cc3d[_0x215d('0x21')],_0x5bca12['id']);var _0x2dc1c4={'ListId':_0x2a4531};var _0x4ad99a=_0x2bb2ff[_0x215d('0x26')]&&_0x2bb2ff[_0x215d('0x26')]!=='0'?_0x2bb2ff[_0x215d('0x26')]:'phone';if(_0x42046e){logger[_0x215d('0x8')](_0x215d('0x27'),_0x28cc3d[_0x215d('0x21')],_0x5bca12['id']);_0x2dc1c4[_0x4ad99a]=_[_0x215d('0x28')](_0x28cc3d['routeId'])?_0x28cc3d['calleridnum']:_0x28cc3d['destcalleridnum'];if(_['isNil'](_0x28cc3d[_0x215d('0x13')])){_0x2dc1c4[_0x215d('0x29')]=_0x28cc3d['calleridname']&&_0x28cc3d[_0x215d('0x2a')]!==_0x215d('0x2b')?_0x28cc3d['calleridname']:'Unknown';}else{_0x2dc1c4['firstName']=_0x28cc3d[_0x215d('0x2c')]&&_0x28cc3d[_0x215d('0x2c')]!==''?_0x28cc3d[_0x215d('0x2c')]:_0x215d('0x2d');}return BPromise['resolve']()[_0x215d('0x1d')](cmContactRpc[_0x215d('0x2e')](_0x2dc1c4))['then'](function(_0x47ff79){_0x3eba5d=_0x47ff79;_0x301e43[_0x215d('0x2f')](_0x47ff79);if(_0x3eba5d){logger[_0x215d('0x8')](_0x215d('0x30'),_0x28cc3d[_0x215d('0x21')],_0x5bca12['id'],_0x3eba5d['id']);}return;});}else{logger['info'](_0x215d('0x31'),_0x28cc3d[_0x215d('0x21')],_0x5bca12['id']);_0x2dc1c4[_0x4ad99a]=_['isNil'](_0x28cc3d[_0x215d('0x13')])?_0x28cc3d[_0x215d('0x32')]:_0x28cc3d[_0x215d('0x14')];if(_[_0x215d('0x28')](_0x28cc3d[_0x215d('0x13')])){_0x2dc1c4[_0x215d('0x29')]=_0x28cc3d[_0x215d('0x2a')]&&_0x28cc3d['calleridname']!==_0x215d('0x2b')?_0x28cc3d[_0x215d('0x2a')]:'Unknown';}else{_0x2dc1c4[_0x215d('0x29')]=_0x28cc3d[_0x215d('0x2c')]&&_0x28cc3d[_0x215d('0x2c')]!==_0x215d('0x2b')?_0x28cc3d['destcalleridname']:_0x215d('0x2d');}_0x3eba5d=_0x2dc1c4;_0x301e43[_0x215d('0x2f')](_0x2dc1c4);return;}}})[_0x215d('0x1d')](function(){if(_0x1fd388){emit(_0x28cc3d[_0x215d('0x21')],_0x5bca12,util[_0x215d('0x33')](_0x215d('0x34'),_0x1fd388[_0x215d('0x35')]),util[_0x215d('0x33')]('trigger:%s',_0x2bb2ff[_0x215d('0x36')][_0x215d('0x37')]()),{'evt':_[_0x215d('0x38')](_0x28cc3d,{'autoCreate':_0x42046e}),'contact':_0x3eba5d===undefined?{}:_0x3eba5d,'contacts':_0x301e43[_0x215d('0x20')]===0x0?undefined:_0x301e43});}});}; \ No newline at end of file +var _0x55ee=['','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','../../../../config/environment','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname'];(function(_0x43c62a,_0x125d82){var _0x367fb8=function(_0x163f52){while(--_0x163f52){_0x43c62a['push'](_0x43c62a['shift']());}};_0x367fb8(++_0x125d82);}(_0x55ee,0x7b));var _0xe55e=function(_0x3a13b8,_0x1568f5){_0x3a13b8=_0x3a13b8-0x0;var _0x123710=_0x55ee[_0x3a13b8];return _0x123710;};'use strict';var _=require('lodash');var BPromise=require(_0xe55e('0x0'));var Redis=require(_0xe55e('0x1'));var util=require('util');var config=require(_0xe55e('0x2'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xe55e('0x3'));config[_0xe55e('0x4')]=_[_0xe55e('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe55e('0x6'))(new Redis(config[_0xe55e('0x4')]));function emit(_0x35c8dc,_0xf4c9b3,_0x235fb3,_0x8f1e3c,_0x4b08a6){logger[_0xe55e('0x7')](_0xe55e('0x8'),_0x35c8dc,_0xf4c9b3['id'],_0x235fb3,_0x8f1e3c,JSON[_0xe55e('0x9')](_0x4b08a6));io['to'](_0x235fb3)['emit'](_0x8f1e3c,_0x4b08a6);}exports[_0xe55e('0xa')]=function(_0x5a17f1,_0x1b6489,_0x2b7a92,_0x475737){var _0x4df4ca,_0x1b01b7;var _0x3e5c67={};var _0x172dbf=Number(_0x2b7a92[_0xe55e('0xb')]);var _0x59b588=_0x2b7a92[_0xe55e('0xc')]?Boolean(Number(_0x2b7a92[_0xe55e('0xc')])):![];var _0x1ddf80;if(_0x475737[_0xe55e('0xd')]){_0x3e5c67['id']=_0x475737[_0xe55e('0xd')];}if(!_0x3e5c67['id']){_0x3e5c67[_0xe55e('0xe')]=_0x172dbf;_0x1ddf80=_0x2b7a92[_0xe55e('0xf')]&&_0x2b7a92['data3']!=='0'?_0x2b7a92[_0xe55e('0xf')][_0xe55e('0x10')](','):['phone'];_0x3e5c67[_0xe55e('0x11')]=_[_0xe55e('0x12')](_0x1ddf80,function(_0x56282){var _0x780012={};_0x780012[_0x56282]=_0x475737[_0xe55e('0x13')]?_0x475737[_0xe55e('0x14')]:_0x475737[_0xe55e('0x15')];return _0x780012;});}var _0x176a67=['id',_0xe55e('0x16'),_0xe55e('0x17'),'phone',_0xe55e('0x18'),'fax',_0xe55e('0xe'),_0xe55e('0x19'),_0xe55e('0x1a'),'updatedAt'];var _0x5499d6=_[_0xe55e('0x1b')](_0x176a67,_0x1ddf80);BPromise[_0xe55e('0x1c')]()['then'](cmContactRpc[_0xe55e('0x1d')]({'attributes':_0x5499d6,'where':_0x3e5c67}))[_0xe55e('0x1e')](function(_0x4c57ee){_0x1b01b7=_0x4c57ee;if(!_[_0xe55e('0x1f')](_0x1b01b7)){if(_0x1b01b7[_0xe55e('0x20')]===0x1){_0x4df4ca=_0x1b01b7[0x0];logger[_0xe55e('0x7')](_0xe55e('0x21'),_0x475737[_0xe55e('0x22')],_0x1b6489['id'],_0x4df4ca['id']);}else{logger[_0xe55e('0x7')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x475737[_0xe55e('0x22')],_0x1b6489['id'],_[_0xe55e('0x12')](_0x1b01b7,'id')[_0xe55e('0x23')](','));}return;}else{logger[_0xe55e('0x7')](_0xe55e('0x24'),_0x475737[_0xe55e('0x22')],_0x1b6489['id']);var _0x1d6621={'ListId':_0x172dbf};var _0x110106=_0x2b7a92[_0xe55e('0x25')]&&_0x2b7a92[_0xe55e('0x25')]!=='0'?_0x2b7a92[_0xe55e('0x25')]:_0xe55e('0x26');if(_0x59b588){logger[_0xe55e('0x7')](_0xe55e('0x27'),_0x475737[_0xe55e('0x22')],_0x1b6489['id']);_0x1d6621[_0x110106]=_[_0xe55e('0x28')](_0x475737['routeId'])?_0x475737[_0xe55e('0x15')]:_0x475737[_0xe55e('0x14')];if(_[_0xe55e('0x28')](_0x475737[_0xe55e('0x13')])){_0x1d6621['firstName']=_0x475737[_0xe55e('0x29')]&&_0x475737['calleridname']!==_0xe55e('0x2a')?_0x475737[_0xe55e('0x29')]:_0xe55e('0x2b');}else{_0x1d6621[_0xe55e('0x16')]=_0x475737['destcalleridname']&&_0x475737[_0xe55e('0x2c')]!==_0xe55e('0x2a')?_0x475737[_0xe55e('0x2c')]:_0xe55e('0x2b');}return BPromise[_0xe55e('0x1c')]()[_0xe55e('0x1e')](cmContactRpc[_0xe55e('0x2d')](_0x1d6621))[_0xe55e('0x1e')](function(_0x3f1aba){_0x4df4ca=_0x3f1aba;_0x1b01b7[_0xe55e('0x2e')](_0x3f1aba);if(_0x4df4ca){logger[_0xe55e('0x7')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x475737['uniqueid'],_0x1b6489['id'],_0x4df4ca['id']);}return;});}else{logger[_0xe55e('0x7')](_0xe55e('0x2f'),_0x475737['uniqueid'],_0x1b6489['id']);_0x1d6621[_0x110106]=_[_0xe55e('0x28')](_0x475737[_0xe55e('0x13')])?_0x475737[_0xe55e('0x15')]:_0x475737['destcalleridnum'];if(_['isNil'](_0x475737[_0xe55e('0x13')])){_0x1d6621[_0xe55e('0x16')]=_0x475737[_0xe55e('0x29')]&&_0x475737[_0xe55e('0x29')]!==_0xe55e('0x2a')?_0x475737['calleridname']:_0xe55e('0x2b');}else{_0x1d6621[_0xe55e('0x16')]=_0x475737[_0xe55e('0x2c')]&&_0x475737[_0xe55e('0x2c')]!==''?_0x475737[_0xe55e('0x2c')]:_0xe55e('0x2b');}_0x4df4ca=_0x1d6621;_0x1b01b7['push'](_0x1d6621);return;}}})[_0xe55e('0x1e')](function(){if(_0x5a17f1){emit(_0x475737[_0xe55e('0x22')],_0x1b6489,util[_0xe55e('0x30')](_0xe55e('0x31'),_0x5a17f1[_0xe55e('0x32')]),util[_0xe55e('0x30')](_0xe55e('0x33'),_0x2b7a92[_0xe55e('0x34')][_0xe55e('0x35')]()),{'evt':_[_0xe55e('0x36')](_0x475737,{'autoCreate':_0x59b588}),'contact':_0x4df4ca===undefined?{}:_0x4df4ca,'contacts':_0x1b01b7[_0xe55e('0x20')]===0x0?undefined:_0x1b01b7});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6ddb916..3150c9a 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 _0x6abf=['custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','stringify','emit','clone','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','status','merge','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','winApplication','winArguments','format','user:%s','trigger:%s:%s','jscripty','name','exec','routeId','script','query','search','channel','AllConditions','every','AnyConditions','some','checkConditions','field','ChatWebsiteId','operator','upperFirst','value','interaction','message','event','queue','membername','lastevent','exports','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','defaults','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x6abf,0x1b5));var _0xf6ab=function(_0x5a71bd,_0x58e69f){_0x5a71bd=_0x5a71bd-0x0;var _0x42418d=_0x6abf[_0x5a71bd];return _0x42418d;};'use strict';var util=require('util');var _=require(_0xf6ab('0x0'));var url=require('url');var Mustache=require(_0xf6ab('0x1'));var Redis=require(_0xf6ab('0x2'));var urlforward=require(_0xf6ab('0x3'));var integration=require(_0xf6ab('0x4'));var cmContact=require(_0xf6ab('0x5'));var script=require(_0xf6ab('0x6'));var config=require(_0xf6ab('0x7'));var logger=require('../../../config/logger')(_0xf6ab('0x8'));var ami=require(_0xf6ab('0x9'));config[_0xf6ab('0xa')]=_[_0xf6ab('0xb')](config[_0xf6ab('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf6ab('0xc'))(new Redis(config[_0xf6ab('0xa')]));var operators={'equals':function(_0xd1576e,_0xacea5){return _0xd1576e==_0xacea5;},'not_equals':function(_0x14ad8f,_0x4e44dc){return _0x14ad8f!=_0x4e44dc;}};var barAndWebActions=[_0xf6ab('0xd'),_0xf6ab('0xe'),_0xf6ab('0xf')];function Trigger(_0x22de22){this[_0xf6ab('0x10')]=_0x22de22['triggers'];this[_0xf6ab('0x11')]=_0x22de22[_0xf6ab('0x11')];this[_0xf6ab('0x12')]=_0x22de22[_0xf6ab('0x12')];this[_0xf6ab('0x13')]=_0x22de22[_0xf6ab('0x13')];this[_0xf6ab('0x14')]=_0x22de22[_0xf6ab('0x14')];this['zendeskAccounts']=_0x22de22[_0xf6ab('0x15')];this['freshdeskAccounts']=_0x22de22[_0xf6ab('0x16')];this[_0xf6ab('0x17')]=_0x22de22[_0xf6ab('0x17')];this[_0xf6ab('0x18')]=_0x22de22[_0xf6ab('0x18')];this[_0xf6ab('0x19')]=_0x22de22[_0xf6ab('0x19')];this[_0xf6ab('0x1a')]=_0x22de22['deskAccounts'];this[_0xf6ab('0x1b')]=_0x22de22[_0xf6ab('0x1b')];this['servicenowAccounts']=_0x22de22[_0xf6ab('0x1c')];this['dynamics365Accounts']=_0x22de22[_0xf6ab('0x1d')];this[_0xf6ab('0x1e')]=_0x22de22['freshsalesAccounts'];this[_0xf6ab('0x1f')]={'zendesk':this[_0xf6ab('0x15')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xf6ab('0x18')],'zoho':this[_0xf6ab('0x19')],'desk':this[_0xf6ab('0x1a')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xf6ab('0x1d')],'freshsales':this[_0xf6ab('0x1e')],'servicenow':this[_0xf6ab('0x1c')]};ami['on'](_0xf6ab('0x20'),this[_0xf6ab('0x21')][_0xf6ab('0x22')](this));ami['on'](_0xf6ab('0x23'),this['syncCustomEvent'][_0xf6ab('0x22')](this));ami['on'](_0xf6ab('0x24'),this[_0xf6ab('0x21')][_0xf6ab('0x22')](this));ami['on'](_0xf6ab('0x25'),this[_0xf6ab('0x21')][_0xf6ab('0x22')](this));ami['on']('custom:agentnosuchnumber',this[_0xf6ab('0x21')][_0xf6ab('0x22')](this));ami['on'](_0xf6ab('0x26'),this[_0xf6ab('0x21')]['bind'](this));ami['on'](_0xf6ab('0x27'),this[_0xf6ab('0x21')][_0xf6ab('0x22')](this));ami['on'](_0xf6ab('0x28'),this[_0xf6ab('0x21')][_0xf6ab('0x22')](this));ami['on']('custom:agentreject',this['syncCustomEvent']['bind'](this));ami['on'](_0xf6ab('0x29'),this[_0xf6ab('0x21')]['bind'](this));ami['on'](_0xf6ab('0x2a'),this[_0xf6ab('0x21')]['bind'](this));ami['on'](_0xf6ab('0x2b'),this[_0xf6ab('0x21')][_0xf6ab('0x22')](this));ami['on'](_0xf6ab('0x2c'),this[_0xf6ab('0x2d')][_0xf6ab('0x22')](this));ami['on']('custom:dialconnect',this[_0xf6ab('0x2d')]['bind'](this));ami['on']('custom:dialend',this[_0xf6ab('0x2d')][_0xf6ab('0x22')](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0xf6ab('0x22')](this));ami['on'](_0xf6ab('0x2e'),this[_0xf6ab('0x21')][_0xf6ab('0x22')](this));ami['on'](_0xf6ab('0x2f'),this[_0xf6ab('0x21')][_0xf6ab('0x22')](this));ami['on'](_0xf6ab('0x30'),this[_0xf6ab('0x21')]['bind'](this));ami['on'](_0xf6ab('0x31'),this[_0xf6ab('0x21')][_0xf6ab('0x22')](this));ami['on'](_0xf6ab('0x32'),this[_0xf6ab('0x21')][_0xf6ab('0x22')](this));ami['on'](_0xf6ab('0x33'),this[_0xf6ab('0x21')][_0xf6ab('0x22')](this));}Trigger[_0xf6ab('0x34')]['emit']=function(_0x10fc21,_0x329c2f,_0x263e58){logger[_0xf6ab('0x35')](_0x10fc21,_0x329c2f,JSON[_0xf6ab('0x36')](_0x263e58));io['to'](_0x10fc21)[_0xf6ab('0x37')](_0x329c2f,_0x263e58);};Trigger[_0xf6ab('0x34')][_0xf6ab('0x21')]=function(_0x268184){var _0x3d7575=_[_0xf6ab('0x38')](_0x268184);if(typeof _0x3d7575[_0xf6ab('0x39')]===_0xf6ab('0x3a')){_0x3d7575['motionChannel']=_0xf6ab('0x3b');}this[_0xf6ab('0x3c')](_0x3d7575);};Trigger[_0xf6ab('0x34')]['syncAgentDial']=function(_0x157d06){if(this[_0xf6ab('0x11')][_0x157d06[_0xf6ab('0x3d')]]){this[_0xf6ab('0x21')](_0x157d06);}};Trigger[_0xf6ab('0x34')][_0xf6ab('0x3c')]=function(_0x2e2b64){var _0x2bf207;for(var _0x189097 in this[_0xf6ab('0x10')]){if(this[_0xf6ab('0x10')][_0xf6ab('0x3e')](_0x189097)){if(this['triggers'][_0x189097][_0xf6ab('0x3f')]){_0x2bf207=this['checkTrigger'](this['triggers'][_0x189097],_0x2e2b64);if(_0x2bf207){_[_0xf6ab('0x40')](_0x2e2b64,_0x2e2b64['variables']);for(var _0x973d0f=0x0,_0x3ce71b,_0x320cae,_0x31535f;_0x973d0f0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x17d484,_0x3ce82b){var _0x2c2f6a=function(_0x1fbcf6){while(--_0x1fbcf6){_0x17d484['push'](_0x17d484['shift']());}};_0x2c2f6a(++_0x3ce82b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index f030c7e..8fbf1dd 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 _0x40d0=['callDirection','queue','/contacts(','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','dynamics365','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','destcalleridnum','calleridnum','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','telephone1','contactid',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Fields','phonecalls','Descriptions'];(function(_0x5cf46c,_0x2614fe){var _0x2716ff=function(_0x25e21a){while(--_0x25e21a){_0x5cf46c['push'](_0x5cf46c['shift']());}};_0x2716ff(++_0x2614fe);}(_0x40d0,0x14c));var _0x040d=function(_0x1e834a,_0x247926){_0x1e834a=_0x1e834a-0x0;var _0x58d9e0=_0x40d0[_0x1e834a];return _0x58d9e0;};'use strict';var _=require(_0x040d('0x0'));var BPromise=require(_0x040d('0x1'));var rp=require(_0x040d('0x2'));var util=require(_0x040d('0x3'));var intUtil=require(_0x040d('0x4'));var md5=require(_0x040d('0x5'));var Redis=require(_0x040d('0x6'));var logger=require('../../../../config/logger')(_0x040d('0x7'));var config=require('../../../../config/environment');config[_0x040d('0x8')]=_[_0x040d('0x9')](config['redis'],{'host':_0x040d('0xa'),'port':0x18eb});var io=require(_0x040d('0xb'))(new Redis(config[_0x040d('0x8')]));function getAuthToken(_0x3cea4e,_0x5dc4fe,_0x2a5493){var _0x40b632={'method':_0x040d('0xc'),'uri':_0x5dc4fe,'form':{'client_id':_0x3cea4e[_0x040d('0xd')],'resource':_0x3cea4e[_0x040d('0xe')],'username':_0x3cea4e[_0x040d('0xf')],'password':_0x3cea4e['password'],'grant_type':_0x040d('0x10'),'client_secret':_0x3cea4e[_0x040d('0x11')]},'json':!![]};return rp(_0x40b632)[_0x040d('0x12')](function(_0x33aef3){return _0x33aef3[_0x040d('0x13')];})[_0x040d('0x14')](function(_0x1ac740){logger['error']('['+[_0x2a5493[_0x040d('0x15')]()]+_0x040d('0x16'));return _0x1ac740[_0x040d('0x17')];});}function getUser(_0x5e9496,_0x1d9e29,_0x3a953d,_0x51f407,_0x33ec2a,_0x5d50fc){return new BPromise(function(_0x3cb17e,_0x346db4){return getAuthToken(_0x1d9e29,_0x51f407,_0x5d50fc)[_0x040d('0x12')](function(_0x42ac64){var _0x3f2d25={'method':_0x040d('0x18'),'uri':_0x33ec2a+_0x040d('0x19'),'headers':{'Authorization':_0x040d('0x1a')+_0x42ac64,'OData-Version':_0x040d('0x1b')},'json':!![]};return rp(_0x3f2d25);})['then'](function(_0x48d7b8){var _0x4ca12c=_0x48d7b8[_0x040d('0x1c')];var _0x39eaf7=![];var _0x5f29f6=null;if(!_[_0x040d('0x1d')](_0x3a953d)){if(intUtil['validateEmail'](_0x3a953d[_0x040d('0x1e')])){_0x5e9496[_0x040d('0x1f')]=_0x3a953d[_0x040d('0x1e')];for(_0x5f29f6=0x0;_0x5f29f6<_0x4ca12c[_0x040d('0x20')];_0x5f29f6++){if(_0x4ca12c[_0x5f29f6][_0x040d('0x21')]===_0x3a953d[_0x040d('0x1e')]&&!_0x4ca12c[_0x5f29f6][_0x040d('0x22')]){_0x39eaf7=!![];logger[_0x040d('0x23')]('['+[_0x5d50fc[_0x040d('0x15')]()]+']\x20Agent\x20found\x20'+_0x4ca12c[_0x5f29f6][_0x040d('0x24')]+'!');_0x5e9496[_0x040d('0x25')]=_0x4ca12c[_0x5f29f6][_0x040d('0x24')];}}}}if(!_0x39eaf7){logger[_0x040d('0x23')]('['+[_0x5d50fc['toUpperCase']()]+_0x040d('0x26'));_0x5e9496[_0x040d('0x1f')]=_0x1d9e29['username'];for(_0x5f29f6=0x0;_0x5f29f6<_0x4ca12c[_0x040d('0x20')];_0x5f29f6++){if(_0x4ca12c[_0x5f29f6]['internalemailaddress']===_0x1d9e29[_0x040d('0xf')]){_0x5e9496['userId']=_0x4ca12c[_0x5f29f6][_0x040d('0x24')];}}}_0x3cb17e(_0x5e9496);})[_0x040d('0x14')](function(_0x28cdff){_0x346db4(_0x28cdff['message']);});});}function createEndUser(_0x353c34,_0x4b2375,_0x18ce47,_0x148e63,_0x1c8cc8,_0x106872){return new BPromise(function(_0x43cc62,_0x3b120d){return getAuthToken(_0x4b2375,_0x18ce47,_0x106872)[_0x040d('0x12')](function(_0x3cc941){var _0x42793b=_0x106872['toLowerCase']()===_0x040d('0x27')?_0x1c8cc8[_0x040d('0x28')]:_0x1c8cc8[_0x040d('0x29')];var _0x40eecc={'method':'POST','uri':_0x148e63+'contacts','body':{'telephone1':_0x42793b,'fullname':_0x42793b,'firstname':_0x42793b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x040d('0x2a')+_0x353c34[_0x040d('0x25')]+')'},'headers':{'Authorization':_0x040d('0x1a')+_0x3cc941,'OData-Version':_0x040d('0x1b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x40eecc);})[_0x040d('0x12')](function(_0x2a2e62){var _0x59c0f6=_0x2a2e62[_0x040d('0x2b')][_0x040d('0x2c')];var _0x2c53ca=_0x59c0f6[_0x040d('0x2d')](_0x59c0f6[_0x040d('0x2e')]('(')+0x1,_0x59c0f6[_0x040d('0x2e')](')'));_0x353c34[_0x040d('0x2f')]=_0x2c53ca;_0x43cc62(_0x353c34);})[_0x040d('0x14')](function(_0x5e4ab9){_0x3b120d(_0x5e4ab9[_0x040d('0x17')]);});});}function getEndUser(_0x3122b8,_0x2f3764,_0x4439ae,_0x4f12bb,_0x4e146a,_0x1aeb02){return new BPromise(function(_0x4de73c,_0x182857){var _0xe14edb=_0x1aeb02[_0x040d('0x30')]()===_0x040d('0x27')?_0x4e146a[_0x040d('0x28')]:_0x4e146a[_0x040d('0x29')];return getAuthToken(_0x2f3764,_0x4439ae,_0x1aeb02)[_0x040d('0x12')](function(_0x31e701){var _0x229998={'method':_0x040d('0x18'),'uri':_0x4f12bb+_0x040d('0x31')+_0xe14edb[_0x040d('0x32')]('+','%2b')+'\x27','headers':{'Authorization':_0x040d('0x1a')+_0x31e701,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x229998);})['then'](function(_0x24aa7d){var _0x27503b=null;if(_0x24aa7d){var _0x34d0c6=_0x24aa7d[_0x040d('0x1c')];var _0x44c378=![];for(_0x27503b=0x0;_0x27503b<_0x34d0c6[_0x040d('0x20')];_0x27503b++){if(_0x34d0c6[_0x27503b][_0x040d('0x33')]===_0xe14edb){_0x44c378=!![];_0x3122b8['enduserId']=_0x34d0c6[_0x27503b][_0x040d('0x34')];}}if(_0x44c378){_0x4de73c(_0x3122b8);}else{return createEndUser(_0x3122b8,_0x2f3764,_0x4439ae,_0x4f12bb,_0x4e146a,_0x1aeb02)[_0x040d('0x12')](function(_0x409360){logger['info']('['+[_0x1aeb02[_0x040d('0x15')]()]+']\x20Enduser\x20created!',_0x409360['enduserId']);_0x4de73c(_0x409360);});}}else{return createEndUser(_0x3122b8,_0x2f3764,_0x4439ae,_0x4f12bb,_0x4e146a,_0x1aeb02)['then'](function(_0x32a307){logger[_0x040d('0x23')]('['+[_0x1aeb02[_0x040d('0x15')]()]+_0x040d('0x35'),_0x32a307['enduserId']);_0x4de73c(_0x32a307);});}});});}function getCustomFields(_0x1df0d0,_0xa9e87,_0x4e10b2){var _0x781564={};if(_0x1df0d0[_0x040d('0x20')]>0x0){_[_0x040d('0x36')](_0x1df0d0,function(_0x1ef25f){if(_[_0x040d('0x37')]([_0x040d('0x38'),_0x040d('0x39')],_0x1ef25f[_0x040d('0x3a')])&&_0x1ef25f[_0x040d('0x3b')]&&!_0x1ef25f['customField']){var _0x473e6c=_0x1ef25f[_0x040d('0x3c')][_0x040d('0x30')]();var _0x5e1531=_0x473e6c[_0x040d('0x2d')](0x0,_0x473e6c[_0x040d('0x3d')]('_'));var _0x4a0a12=_0x473e6c[_0x040d('0x2d')](_0x473e6c[_0x040d('0x3d')]('_')+0x1);if(_0x5e1531===_0x4e10b2){_0x781564[_0x4a0a12]=_0x1ef25f[_0x040d('0x3e')];}}});}return _0x781564;}function getTicket(_0x48169e,_0x14bc98,_0x31e136,_0x11cb0a,_0x38b029,_0x41be7b,_0x27df3e){return new BPromise(function(_0x179fac,_0xe8057f){var _0x5e9511;return getAuthToken(_0x14bc98,_0x31e136,_0x27df3e)[_0x040d('0x12')](function(_0x3786f3){if(_0x41be7b[_0x040d('0x3f')]===_0x040d('0x40')){_0x5e9511={'method':'POST','uri':_0x11cb0a+_0x040d('0x41'),'body':Object[_0x040d('0x42')]({},{'title':intUtil[_0x040d('0x43')](_0x41be7b[_0x040d('0x44')],_0x38b029,'\x20'),'description':intUtil[_0x040d('0x43')](_0x41be7b['Descriptions'],_0x38b029,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x48169e[_0x040d('0x2f')]+')','ownerid@odata.bind':_0x040d('0x2a')+_0x48169e[_0x040d('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x41be7b[_0x040d('0x45')],_0x38b029,_0x41be7b[_0x040d('0x3f')])),'headers':{'Authorization':_0x040d('0x1a')+_0x3786f3,'OData-Version':_0x040d('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x41be7b[_0x040d('0x3f')]==='phonecall'){_0x5e9511={'method':_0x040d('0xc'),'uri':_0x11cb0a+_0x040d('0x46'),'body':Object[_0x040d('0x42')]({},{'subject':intUtil[_0x040d('0x43')](_0x41be7b[_0x040d('0x44')],_0x38b029,'\x20'),'phonenumber':String(_0x38b029[_0x040d('0x29')]),'description':intUtil[_0x040d('0x43')](_0x41be7b[_0x040d('0x47')],_0x38b029,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x48169e[_0x040d('0x2f')]+')','ownerid@odata.bind':_0x040d('0x2a')+_0x48169e[_0x040d('0x25')]+')','directioncode':_0x48169e[_0x040d('0x48')]===_0x040d('0x49')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x040d('0x2a')+_0x48169e[_0x040d('0x25')]+')','participationtypemask':_0x48169e[_0x040d('0x48')]===_0x040d('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x040d('0x4a')+_0x48169e[_0x040d('0x2f')]+')','participationtypemask':_0x48169e[_0x040d('0x48')]===_0x040d('0x49')?0x1:0x2}]},getCustomFields(_0x41be7b[_0x040d('0x45')],_0x38b029,_0x41be7b[_0x040d('0x3f')])),'headers':{'Authorization':'Bearer\x20'+_0x3786f3,'OData-Version':_0x040d('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5e9511);})[_0x040d('0x12')](function(_0x1736fb){var _0x20ab39=_0x1736fb['headers'][_0x040d('0x2c')];var _0x3bc181=_0x20ab39[_0x040d('0x2d')](_0x20ab39[_0x040d('0x2e')]('(')+0x1,_0x20ab39[_0x040d('0x2e')](')'));_0x48169e['ticketId']=_0x3bc181;_0x179fac(_0x48169e);})['catch'](function(_0x14b499){_0xe8057f(_0x14b499['message']);});});}function emit(_0x1b862d,_0x5a601e,_0x550421,_0xdc198b){var _0x1a3961={'uri':util[_0x040d('0x4b')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1b862d,_0x550421,_0xdc198b)};io['to'](util[_0x040d('0x4b')]('user:%s',_0x5a601e))[_0x040d('0x4c')](_0x040d('0x4d'),_0x1a3961);}exports['cs']=function(_0x1318ad,_0x1316f4,_0x18e3a7,_0x461f5b,_0x236da3,_0x3c8aa1,_0x634349,_0x3dcd84){var _0x5208f3={};_0x3c8aa1[_0x040d('0xe')]=intUtil[_0x040d('0x4e')](_0x3c8aa1['remoteUri']);_0x3c8aa1[_0x040d('0x4f')]=intUtil['stripTrailingSlash'](_0x3c8aa1[_0x040d('0x4f')]);_0x5208f3[_0x040d('0x48')]=_0x3dcd84===_0x040d('0x49')||_0x3dcd84===_0x040d('0x50')?_0x040d('0x49'):_0x040d('0x27');var _0x48cd31=util[_0x040d('0x4b')](_0x040d('0x51'),_0x3c8aa1['remoteUri']);var _0x2dd60=util[_0x040d('0x4b')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3c8aa1[_0x040d('0x52')]);var _0x138a68=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c8aa1['serverUrl'],_0x1316f4[_0x040d('0x53')],md5(_0x1316f4[_0x040d('0x53')]));if(_0x236da3&&_0x236da3[_0x040d('0x54')]){logger[_0x040d('0x23')](_0x040d('0x55'),_0x040d('0x56'));_0x1316f4[_0x040d('0x57')]=_0x138a68;}else if(_0x634349&&_0x634349[_0x040d('0x58')]&&_0x634349[_0x040d('0x58')]!==_0x040d('0x59')){logger[_0x040d('0x23')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1316f4[_0x040d('0x57')]=_0x138a68;}else{_0x1316f4[_0x040d('0x57')]='';}return getUser(_0x5208f3,_0x3c8aa1,_0x461f5b,_0x2dd60,_0x48cd31,_0x3dcd84)[_0x040d('0x12')](function(_0x5ad766){logger[_0x040d('0x23')]('['+_0x3dcd84[_0x040d('0x15')]()+_0x040d('0x5a'),_0x5ad766['userId']);logger[_0x040d('0x23')]('['+_0x3dcd84[_0x040d('0x15')]()+_0x040d('0x5b'),_0x5ad766['userEmail']);return getEndUser(_0x5ad766,_0x3c8aa1,_0x2dd60,_0x48cd31,_0x1316f4,_0x3dcd84);})[_0x040d('0x12')](function(_0x1d6002){logger[_0x040d('0x23')]('['+_0x3dcd84[_0x040d('0x15')]()+_0x040d('0x5c'),_0x1d6002[_0x040d('0x2f')]);logger[_0x040d('0x23')]('['+_0x3dcd84['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x1316f4['calleridnum']);return getTicket(_0x1d6002,_0x3c8aa1,_0x2dd60,_0x48cd31,_0x1316f4,_0x18e3a7,_0x3dcd84);})[_0x040d('0x12')](function(_0x2d1a9c){logger[_0x040d('0x23')](util[_0x040d('0x4b')]('['+_0x3dcd84[_0x040d('0x15')]()+_0x040d('0x5d'),_0x18e3a7['ticketType'],_0x2d1a9c[_0x040d('0x5e')]));logger[_0x040d('0x23')](util[_0x040d('0x4b')]('['+_0x3dcd84[_0x040d('0x15')]()+_0x040d('0x5f'),_0x3dcd84));if(_0x3dcd84!==_0x040d('0x50')){logger[_0x040d('0x23')]('['+_0x3dcd84[_0x040d('0x15')]()+']',_0x040d('0x60'));emit(_0x3c8aa1[_0x040d('0xe')],_0x461f5b[_0x040d('0x61')],_0x18e3a7[_0x040d('0x3f')],_0x2d1a9c[_0x040d('0x5e')]);}})['catch'](function(_0x25ae8c){logger[_0x040d('0x62')]('['+_0x3dcd84[_0x040d('0x15')]()+_0x040d('0x63'),util[_0x040d('0x64')](_0x25ae8c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7b5b=['userEmail','internalemailaddress','email','isdisabled','systemuserid','userId','info','length','catch','toLowerCase','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','Bearer\x20','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','picklist','type','nameField','indexOf','content','incident','incidents','assign','getString','Descriptions','/contacts(','ticketType','phonecall','phonecalls','Subjects','callDirection','queue','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','outbound','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','defaults','localhost','socket.io-emitter','POST','remoteUri','username','password','then','access_token','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil'];(function(_0x3b68d2,_0xd40127){var _0x24b9aa=function(_0x422137){while(--_0x422137){_0x3b68d2['push'](_0x3b68d2['shift']());}};_0x24b9aa(++_0xd40127);}(_0x7b5b,0xa9));var _0xb7b5=function(_0x4b2aff,_0x586a9f){_0x4b2aff=_0x4b2aff-0x0;var _0x30099a=_0x7b5b[_0x4b2aff];return _0x30099a;};'use strict';var _=require(_0xb7b5('0x0'));var BPromise=require('bluebird');var rp=require(_0xb7b5('0x1'));var util=require(_0xb7b5('0x2'));var intUtil=require(_0xb7b5('0x3'));var md5=require(_0xb7b5('0x4'));var Redis=require('ioredis');var logger=require(_0xb7b5('0x5'))(_0xb7b5('0x6'));var config=require(_0xb7b5('0x7'));config['redis']=_[_0xb7b5('0x8')](config['redis'],{'host':_0xb7b5('0x9'),'port':0x18eb});var io=require(_0xb7b5('0xa'))(new Redis(config['redis']));function getAuthToken(_0x3f53f0,_0x210e37,_0x434393){var _0x55fed0={'method':_0xb7b5('0xb'),'uri':_0x210e37,'form':{'client_id':_0x3f53f0['clientId'],'resource':_0x3f53f0[_0xb7b5('0xc')],'username':_0x3f53f0[_0xb7b5('0xd')],'password':_0x3f53f0[_0xb7b5('0xe')],'grant_type':'password','client_secret':_0x3f53f0['clientSecret']},'json':!![]};return rp(_0x55fed0)[_0xb7b5('0xf')](function(_0x3bab5d){return _0x3bab5d[_0xb7b5('0x10')];})['catch'](function(_0xb10ebd){logger[_0xb7b5('0x11')]('['+[_0x434393[_0xb7b5('0x12')]()]+']\x20Wrong\x20credentials!');return _0xb10ebd[_0xb7b5('0x13')];});}function getUser(_0x283ba3,_0x1f8de6,_0x5135d9,_0x1ec8a0,_0xb1f50,_0x4c0199){return new BPromise(function(_0x491ba7,_0x5bc734){return getAuthToken(_0x1f8de6,_0x1ec8a0,_0x4c0199)[_0xb7b5('0xf')](function(_0x4822c5){var _0x2b2361={'method':_0xb7b5('0x14'),'uri':_0xb1f50+_0xb7b5('0x15'),'headers':{'Authorization':'Bearer\x20'+_0x4822c5,'OData-Version':_0xb7b5('0x16')},'json':!![]};return rp(_0x2b2361);})[_0xb7b5('0xf')](function(_0xa104b4){var _0x542cf6=_0xa104b4[_0xb7b5('0x17')];var _0xd09fef=![];var _0x22a7b7=null;if(!_[_0xb7b5('0x18')](_0x5135d9)){if(intUtil['validateEmail'](_0x5135d9['email'])){_0x283ba3[_0xb7b5('0x19')]=_0x5135d9['email'];for(_0x22a7b7=0x0;_0x22a7b7<_0x542cf6['length'];_0x22a7b7++){if(_0x542cf6[_0x22a7b7][_0xb7b5('0x1a')]===_0x5135d9[_0xb7b5('0x1b')]&&!_0x542cf6[_0x22a7b7][_0xb7b5('0x1c')]){_0xd09fef=!![];logger['info']('['+[_0x4c0199[_0xb7b5('0x12')]()]+']\x20Agent\x20found\x20'+_0x542cf6[_0x22a7b7][_0xb7b5('0x1d')]+'!');_0x283ba3[_0xb7b5('0x1e')]=_0x542cf6[_0x22a7b7]['systemuserid'];}}}}if(!_0xd09fef){logger[_0xb7b5('0x1f')]('['+[_0x4c0199[_0xb7b5('0x12')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x283ba3[_0xb7b5('0x19')]=_0x1f8de6[_0xb7b5('0xd')];for(_0x22a7b7=0x0;_0x22a7b7<_0x542cf6[_0xb7b5('0x20')];_0x22a7b7++){if(_0x542cf6[_0x22a7b7][_0xb7b5('0x1a')]===_0x1f8de6[_0xb7b5('0xd')]){_0x283ba3[_0xb7b5('0x1e')]=_0x542cf6[_0x22a7b7][_0xb7b5('0x1d')];}}}_0x491ba7(_0x283ba3);})[_0xb7b5('0x21')](function(_0x450065){_0x5bc734(_0x450065['message']);});});}function createEndUser(_0x3bef18,_0x51d33a,_0x51f756,_0x3207b2,_0xffad1a,_0x4945bc){return new BPromise(function(_0x520f10,_0x43b07f){return getAuthToken(_0x51d33a,_0x51f756,_0x4945bc)[_0xb7b5('0xf')](function(_0x5457d1){var _0x408037=_0x4945bc[_0xb7b5('0x22')]()==='outbound'?_0xffad1a['destcalleridnum']:_0xffad1a[_0xb7b5('0x23')];var _0x1a4016={'method':'POST','uri':_0x3207b2+_0xb7b5('0x24'),'body':{'telephone1':_0x408037,'fullname':_0x408037,'firstname':_0x408037,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb7b5('0x25')+_0x3bef18[_0xb7b5('0x1e')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x5457d1,'OData-Version':_0xb7b5('0x16')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1a4016);})[_0xb7b5('0xf')](function(_0x4c957e){var _0xc4fb96=_0x4c957e[_0xb7b5('0x26')][_0xb7b5('0x27')];var _0x20a164=_0xc4fb96[_0xb7b5('0x28')](_0xc4fb96[_0xb7b5('0x29')]('(')+0x1,_0xc4fb96[_0xb7b5('0x29')](')'));_0x3bef18[_0xb7b5('0x2a')]=_0x20a164;_0x520f10(_0x3bef18);})[_0xb7b5('0x21')](function(_0x547a63){_0x43b07f(_0x547a63[_0xb7b5('0x13')]);});});}function getEndUser(_0x265f8e,_0x46f6d1,_0x511bea,_0x240ccf,_0x3a1910,_0x174b49){return new BPromise(function(_0x3f5ac8,_0x32fefa){var _0x3f26f1=_0x174b49['toLowerCase']()==='outbound'?_0x3a1910['destcalleridnum']:_0x3a1910[_0xb7b5('0x23')];return getAuthToken(_0x46f6d1,_0x511bea,_0x174b49)[_0xb7b5('0xf')](function(_0x46d8a9){var _0x599ce5={'method':_0xb7b5('0x14'),'uri':_0x240ccf+_0xb7b5('0x2b')+_0x3f26f1[_0xb7b5('0x2c')]('+','%2b')+'\x27','headers':{'Authorization':_0xb7b5('0x2d')+_0x46d8a9,'If-None-Match':null,'OData-Version':_0xb7b5('0x16')},'json':!![]};return rp(_0x599ce5);})[_0xb7b5('0xf')](function(_0x468970){var _0x1d062d=null;if(_0x468970){var _0x1c39e7=_0x468970['value'];var _0x53e15b=![];for(_0x1d062d=0x0;_0x1d062d<_0x1c39e7[_0xb7b5('0x20')];_0x1d062d++){if(_0x1c39e7[_0x1d062d][_0xb7b5('0x2e')]===_0x3f26f1){_0x53e15b=!![];_0x265f8e[_0xb7b5('0x2a')]=_0x1c39e7[_0x1d062d][_0xb7b5('0x2f')];}}if(_0x53e15b){_0x3f5ac8(_0x265f8e);}else{return createEndUser(_0x265f8e,_0x46f6d1,_0x511bea,_0x240ccf,_0x3a1910,_0x174b49)[_0xb7b5('0xf')](function(_0x813b63){logger['info']('['+[_0x174b49[_0xb7b5('0x12')]()]+_0xb7b5('0x30'),_0x813b63[_0xb7b5('0x2a')]);_0x3f5ac8(_0x813b63);});}}else{return createEndUser(_0x265f8e,_0x46f6d1,_0x511bea,_0x240ccf,_0x3a1910,_0x174b49)[_0xb7b5('0xf')](function(_0x13148a){logger['info']('['+[_0x174b49[_0xb7b5('0x12')]()]+_0xb7b5('0x31'),_0x13148a[_0xb7b5('0x2a')]);_0x3f5ac8(_0x13148a);});}});});}function getCustomFields(_0x4999be,_0x1f79ea,_0x265342){var _0x30b447={};if(_0x4999be[_0xb7b5('0x20')]>0x0){_[_0xb7b5('0x32')](_0x4999be,function(_0x2b3027){if(_[_0xb7b5('0x33')](['string',_0xb7b5('0x34')],_0x2b3027[_0xb7b5('0x35')])&&_0x2b3027[_0xb7b5('0x36')]&&!_0x2b3027['customField']){var _0x1bd872=_0x2b3027['idField'][_0xb7b5('0x22')]();var _0x37ff2e=_0x1bd872[_0xb7b5('0x28')](0x0,_0x1bd872[_0xb7b5('0x37')]('_'));var _0x38684c=_0x1bd872[_0xb7b5('0x28')](_0x1bd872[_0xb7b5('0x37')]('_')+0x1);if(_0x37ff2e===_0x265342){_0x30b447[_0x38684c]=_0x2b3027[_0xb7b5('0x38')];}}});}return _0x30b447;}function getTicket(_0x2dbc69,_0x41c72c,_0x20f083,_0x43658e,_0x4a88b8,_0x5dc91a,_0x59da68){return new BPromise(function(_0x34850b,_0x28b1ad){var _0x4769de;return getAuthToken(_0x41c72c,_0x20f083,_0x59da68)[_0xb7b5('0xf')](function(_0x3a4317){if(_0x5dc91a['ticketType']===_0xb7b5('0x39')){_0x4769de={'method':_0xb7b5('0xb'),'uri':_0x43658e+_0xb7b5('0x3a'),'body':Object[_0xb7b5('0x3b')]({},{'title':intUtil[_0xb7b5('0x3c')](_0x5dc91a['Subjects'],_0x4a88b8,'\x20'),'description':intUtil[_0xb7b5('0x3c')](_0x5dc91a[_0xb7b5('0x3d')],_0x4a88b8,'\x0a'),'customerid_contact@odata.bind':_0xb7b5('0x3e')+_0x2dbc69[_0xb7b5('0x2a')]+')','ownerid@odata.bind':_0xb7b5('0x25')+_0x2dbc69[_0xb7b5('0x1e')]+')','caseorigincode':'1'},getCustomFields(_0x5dc91a['Fields'],_0x4a88b8,_0x5dc91a[_0xb7b5('0x3f')])),'headers':{'Authorization':_0xb7b5('0x2d')+_0x3a4317,'OData-Version':_0xb7b5('0x16')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5dc91a[_0xb7b5('0x3f')]===_0xb7b5('0x40')){_0x4769de={'method':_0xb7b5('0xb'),'uri':_0x43658e+_0xb7b5('0x41'),'body':Object[_0xb7b5('0x3b')]({},{'subject':intUtil[_0xb7b5('0x3c')](_0x5dc91a[_0xb7b5('0x42')],_0x4a88b8,'\x20'),'phonenumber':String(_0x4a88b8[_0xb7b5('0x23')]),'description':intUtil['getString'](_0x5dc91a[_0xb7b5('0x3d')],_0x4a88b8,'\x0a'),'regardingobjectid_contact@odata.bind':_0xb7b5('0x3e')+_0x2dbc69[_0xb7b5('0x2a')]+')','ownerid@odata.bind':_0xb7b5('0x25')+_0x2dbc69[_0xb7b5('0x1e')]+')','directioncode':_0x2dbc69[_0xb7b5('0x43')]===_0xb7b5('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2dbc69['userId']+')','participationtypemask':_0x2dbc69[_0xb7b5('0x43')]===_0xb7b5('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0xb7b5('0x3e')+_0x2dbc69['enduserId']+')','participationtypemask':_0x2dbc69[_0xb7b5('0x43')]===_0xb7b5('0x44')?0x1:0x2}]},getCustomFields(_0x5dc91a['Fields'],_0x4a88b8,_0x5dc91a[_0xb7b5('0x3f')])),'headers':{'Authorization':'Bearer\x20'+_0x3a4317,'OData-Version':_0xb7b5('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4769de);})['then'](function(_0x41a057){var _0x592b58=_0x41a057[_0xb7b5('0x26')]['odata-entityid'];var _0x4db4c5=_0x592b58['substring'](_0x592b58[_0xb7b5('0x29')]('(')+0x1,_0x592b58['lastIndexOf'](')'));_0x2dbc69[_0xb7b5('0x45')]=_0x4db4c5;_0x34850b(_0x2dbc69);})[_0xb7b5('0x21')](function(_0x11528b){_0x28b1ad(_0x11528b[_0xb7b5('0x13')]);});});}function emit(_0x5a1d06,_0x3370fa,_0x18d30f,_0x292b81){var _0x4252cf={'uri':util[_0xb7b5('0x46')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x5a1d06,_0x18d30f,_0x292b81)};io['to'](util[_0xb7b5('0x46')](_0xb7b5('0x47'),_0x3370fa))[_0xb7b5('0x48')](_0xb7b5('0x49'),_0x4252cf);}exports['cs']=function(_0x542e42,_0x58607d,_0x14963c,_0x528f0c,_0x5d53bd,_0x592d68,_0x19a6c9,_0x490869){var _0x5bb782={};_0x592d68[_0xb7b5('0xc')]=intUtil[_0xb7b5('0x4a')](_0x592d68[_0xb7b5('0xc')]);_0x592d68[_0xb7b5('0x4b')]=intUtil['stripTrailingSlash'](_0x592d68[_0xb7b5('0x4b')]);_0x5bb782['callDirection']=_0x490869===_0xb7b5('0x44')||_0x490869==='unmanaged'?_0xb7b5('0x44'):_0xb7b5('0x4c');var _0x41d956=util[_0xb7b5('0x46')]('%s/api/data/v9.0/',_0x592d68[_0xb7b5('0xc')]);var _0x1bc966=util[_0xb7b5('0x46')](_0xb7b5('0x4d'),_0x592d68[_0xb7b5('0x4e')]);var _0x2cdd87=util['format'](_0xb7b5('0x4f'),_0x592d68[_0xb7b5('0x4b')],_0x58607d[_0xb7b5('0x50')],md5(_0x58607d[_0xb7b5('0x50')]));if(_0x5d53bd&&_0x5d53bd[_0xb7b5('0x51')]){logger[_0xb7b5('0x1f')](_0xb7b5('0x52'),_0xb7b5('0x53'));_0x58607d[_0xb7b5('0x54')]=_0x2cdd87;}else if(_0x19a6c9&&_0x19a6c9[_0xb7b5('0x55')]&&_0x19a6c9[_0xb7b5('0x55')]!==_0xb7b5('0x56')){logger['info'](_0xb7b5('0x57'),'Recording\x20is\x20enabled!');_0x58607d[_0xb7b5('0x54')]=_0x2cdd87;}else{_0x58607d['recordingURL']='';}return getUser(_0x5bb782,_0x592d68,_0x528f0c,_0x1bc966,_0x41d956,_0x490869)[_0xb7b5('0xf')](function(_0x369253){logger[_0xb7b5('0x1f')]('['+_0x490869['toUpperCase']()+_0xb7b5('0x58'),_0x369253[_0xb7b5('0x1e')]);logger[_0xb7b5('0x1f')]('['+_0x490869[_0xb7b5('0x12')]()+_0xb7b5('0x59'),_0x369253['userEmail']);return getEndUser(_0x369253,_0x592d68,_0x1bc966,_0x41d956,_0x58607d,_0x490869);})[_0xb7b5('0xf')](function(_0x5ad81e){logger[_0xb7b5('0x1f')]('['+_0x490869[_0xb7b5('0x12')]()+_0xb7b5('0x5a'),_0x5ad81e[_0xb7b5('0x2a')]);logger[_0xb7b5('0x1f')]('['+_0x490869[_0xb7b5('0x12')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x58607d[_0xb7b5('0x23')]);return getTicket(_0x5ad81e,_0x592d68,_0x1bc966,_0x41d956,_0x58607d,_0x14963c,_0x490869);})[_0xb7b5('0xf')](function(_0x2df962){logger[_0xb7b5('0x1f')](util[_0xb7b5('0x46')]('['+_0x490869[_0xb7b5('0x12')]()+_0xb7b5('0x5b'),_0x14963c[_0xb7b5('0x3f')],_0x2df962['ticketId']));logger[_0xb7b5('0x1f')](util[_0xb7b5('0x46')]('['+_0x490869['toUpperCase']()+_0xb7b5('0x5c'),_0x490869));if(_0x490869!==_0xb7b5('0x5d')){logger[_0xb7b5('0x1f')]('['+_0x490869['toUpperCase']()+']',_0xb7b5('0x5e'));emit(_0x592d68['remoteUri'],_0x528f0c[_0xb7b5('0x5f')],_0x14963c[_0xb7b5('0x3f')],_0x2df962['ticketId']);}})[_0xb7b5('0x21')](function(_0x10822a){logger[_0xb7b5('0x11')]('['+_0x490869[_0xb7b5('0x12')]()+_0xb7b5('0x60'),util['inspect'](_0x10822a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 3bd1095..0e035b4 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 _0xf0e0=['%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','stringify','map','forEach','string','type','nameField','toLowerCase','picklist','idField','customField','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','unmanaged','toUpperCase','recordingURL','Authorization','lastevent','lodash','request-promise','md5','util','ioredis','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','getString','Tags','name','custom_fields','mapValues','keyBy','value','format','remoteUri','POST','Ticket\x20created!','validateEmail','then','Agent\x20found!','find','contact','email'];(function(_0x1adf40,_0x4a6c4c){var _0x37263d=function(_0x3ca62c){while(--_0x3ca62c){_0x1adf40['push'](_0x1adf40['shift']());}};_0x37263d(++_0x4a6c4c);}(_0xf0e0,0x13f));var _0x0f0e=function(_0x2faaa2,_0x3bd7fe){_0x2faaa2=_0x2faaa2-0x0;var _0x274d28=_0xf0e0[_0x2faaa2];return _0x274d28;};'use strict';var _=require(_0x0f0e('0x0'));var rp=require(_0x0f0e('0x1'));var md5=require(_0x0f0e('0x2'));var util=require(_0x0f0e('0x3'));var Redis=require(_0x0f0e('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x0f0e('0x5'))(_0x0f0e('0x6'));config[_0x0f0e('0x7')]=_[_0x0f0e('0x8')](config[_0x0f0e('0x7')],{'host':_0x0f0e('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x0f0e('0xa'),'Accept':_0x0f0e('0xa')};function emit(_0x3433cc,_0x3d7a4a,_0x8326fa){io['to'](_0x3433cc)['emit'](_0x3d7a4a,_0x8326fa);}function getTicket(_0x1f9dff,_0x49c17c,_0x5f4bf0,_0x58b853,_0x3824d5){logger[_0x0f0e('0xb')](_0x0f0e('0xc'));var _0x3857b6=_[_0x0f0e('0xd')]({'responder_id':_0x49c17c['id'],'requester_id':_0x5f4bf0['id'],'name':util['format'](_0x0f0e('0xe'),_0x3824d5[_0x0f0e('0xf')]),'phone':_0x3824d5['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x0f0e('0x10')](_0x58b853['Subjects'],_0x3824d5,'\x20'),'description':intUtil[_0x0f0e('0x10')](_0x58b853['Descriptions'],_0x3824d5,'
'),'tags':getTags(_0x58b853[_0x0f0e('0x11')],_0x0f0e('0x12'))},getCustomFields(_0x58b853['Fields'],_0x3824d5));_0x3857b6[_0x0f0e('0x13')]=_[_0x0f0e('0x14')](_[_0x0f0e('0x15')](_0x3857b6['custom_fields'],'id'),_0x0f0e('0x16'));return request({'uri':util[_0x0f0e('0x17')]('%s/api/v2/tickets',_0x1f9dff[_0x0f0e('0x18')]),'method':_0x0f0e('0x19'),'body':_0x3857b6})['then'](function(_0x20ada5){logger[_0x0f0e('0xb')](_0x0f0e('0x1a'));return _0x20ada5;});}function getUser(_0x511a60,_0x2edfe4){if(intUtil[_0x0f0e('0x1b')](_0x2edfe4)){return request({'uri':util['format']('%s/api/v2/agents',_0x511a60['remoteUri']),'qs':{'email':_0x2edfe4}})[_0x0f0e('0x1c')](function(_0x4ab11a){if(_0x4ab11a['length']){logger['info'](_0x0f0e('0x1d'));return _[_0x0f0e('0x1e')](_0x4ab11a,function(_0x66f18c){return _0x66f18c[_0x0f0e('0x1f')][_0x0f0e('0x20')]===_0x2edfe4;});}else{logger[_0x0f0e('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x0f0e('0x17')](_0x0f0e('0x21'),_0x511a60['remoteUri'])})[_0x0f0e('0x1c')](function(_0x5aad58){logger[_0x0f0e('0xb')](_0x0f0e('0x22'));return _0x5aad58;});}});}else{logger[_0x0f0e('0xb')](_0x0f0e('0x23'));return request({'uri':util[_0x0f0e('0x17')](_0x0f0e('0x21'),_0x511a60['remoteUri'])})[_0x0f0e('0x1c')](function(_0x18347c){logger[_0x0f0e('0xb')](_0x0f0e('0x22'));return _0x18347c;});}}function getEndUser(_0x37fe5e,_0x406ff6,_0xc8db57){logger[_0x0f0e('0xb')](_0x0f0e('0x24'),_0xc8db57);return request({'uri':util['format'](_0x0f0e('0x25'),_0x37fe5e['remoteUri']),'qs':{'phone':_0xc8db57}})[_0x0f0e('0x1c')](function(_0x13c44b){if(_0x13c44b[_0x0f0e('0x26')]){logger[_0x0f0e('0xb')]('Enduser\x20found!');return _[_0x0f0e('0x1e')](_0x13c44b,{'phone':_0xc8db57});}else{logger[_0x0f0e('0xb')](_0x0f0e('0x27'));return request({'uri':util['format'](_0x0f0e('0x25'),_0x37fe5e[_0x0f0e('0x18')]),'method':'POST','body':{'name':_0x406ff6,'phone':_0xc8db57}})[_0x0f0e('0x1c')](function(_0x518fae){logger[_0x0f0e('0xb')](_0x0f0e('0x28'));return _0x518fae;});}});}function getAuth(_0x3caf73){return util['format']('Basic\x20%s',new Buffer(_0x3caf73[_0x0f0e('0x29')]+':X')[_0x0f0e('0x2a')](_0x0f0e('0x2b')));}function request(_0x418227){logger[_0x0f0e('0x2c')]('[HTTP]',JSON[_0x0f0e('0x2d')](_0x418227));return rp(_[_0x0f0e('0x8')](_0x418227,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x39c67d,_0x50199d){var _0x5b0d26=[];if(_0x39c67d&&_0x39c67d[_0x0f0e('0x26')]>0x0){_0x5b0d26=_[_0x0f0e('0x2e')](_0x39c67d,_0x50199d);}return _0x5b0d26;}function getCustomFields(_0x34ba6f,_0x8500e7){var _0x18f482=[];var _0x1a1d63={'custom_fields':[]};if(_0x34ba6f[_0x0f0e('0x26')]>0x0){_[_0x0f0e('0x2f')](_0x34ba6f,function(_0x5e3a68){if(_['includes']([_0x0f0e('0x30'),'picklist'],_0x5e3a68[_0x0f0e('0x31')])&&_0x5e3a68[_0x0f0e('0x32')]&&!_0x5e3a68['customField']){_0x1a1d63[_0x5e3a68[_0x0f0e('0x32')][_0x0f0e('0x33')]()]=_0x5e3a68['content']['toString']();}else if(_['includes']([_0x0f0e('0x30'),_0x0f0e('0x34')],_0x5e3a68[_0x0f0e('0x31')])&&_0x5e3a68[_0x0f0e('0x35')]&&_0x5e3a68[_0x0f0e('0x36')]){_0x1a1d63['custom_fields'][_0x0f0e('0x37')]({'id':_0x5e3a68[_0x0f0e('0x35')],'value':_0x5e3a68[_0x0f0e('0x38')]['toString']()});}else if(_0x5e3a68[_0x0f0e('0x31')]===_0x0f0e('0x39')&&_0x5e3a68['variableName']&&_0x5e3a68[_0x0f0e('0x35')]&&_0x5e3a68[_0x0f0e('0x36')]){_0x8500e7[_0x5e3a68[_0x0f0e('0x3a')]]&&_0x1a1d63[_0x0f0e('0x13')][_0x0f0e('0x37')]({'id':_0x5e3a68[_0x0f0e('0x35')],'value':_0x8500e7[_0x5e3a68[_0x0f0e('0x3a')]][_0x0f0e('0x2a')]()});}else if(_0x5e3a68[_0x0f0e('0x31')]===_0x0f0e('0x3b')&&_0x5e3a68[_0x0f0e('0x3c')]&&_0x5e3a68[_0x0f0e('0x3c')][_0x0f0e('0x12')]&&_0x5e3a68[_0x0f0e('0x35')]&&_0x5e3a68['customField']){_0x8500e7[_0x5e3a68['Variable']['name'][_0x0f0e('0x33')]()]&&_0x1a1d63[_0x0f0e('0x13')][_0x0f0e('0x37')]({'id':_0x5e3a68[_0x0f0e('0x35')],'value':_0x8500e7[_0x5e3a68[_0x0f0e('0x3c')][_0x0f0e('0x12')][_0x0f0e('0x33')]()][_0x0f0e('0x2a')]()});}});}return _0x1a1d63;}exports[_0x0f0e('0x3d')]=function(_0x36b19b,_0xcf8585,_0x1fb460,_0x5a30cb,_0x5c18cf,_0x225093){var _0x392e60,_0x371deb;_0x225093[_0x0f0e('0x18')]=intUtil[_0x0f0e('0x3e')](_0x225093[_0x0f0e('0x18')]);_0x225093[_0x0f0e('0x3f')]=intUtil['stripTrailingSlash'](_0x225093[_0x0f0e('0x3f')]);if(_0x5c18cf&&_0x5c18cf[_0x0f0e('0x40')]){logger[_0x0f0e('0xb')](_0x0f0e('0x41'),_0x0f0e('0x42'));_0xcf8585['recordingURL']=util[_0x0f0e('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x225093['serverUrl'],_0xcf8585[_0x0f0e('0x43')],md5(_0xcf8585[_0x0f0e('0x43')]));}else{_0xcf8585['recordingURL']='';}headers['Authorization']=getAuth(_0x225093);return getUser(_0x225093,_0x5a30cb['email'])[_0x0f0e('0x1c')](function(_0x2fbeb){_0x392e60=_0x2fbeb;logger[_0x0f0e('0xb')](_0x0f0e('0x44'),_0x392e60['id']);return getEndUser(_0x225093,_0xcf8585['calleridname'],_0xcf8585[_0x0f0e('0x45')]);})[_0x0f0e('0x1c')](function(_0x5122d3){_0x371deb=_0x5122d3;logger['info']('The\x20Enduser\x20ID\x20is:',_0x371deb['id']);return getTicket(_0x225093,_0x392e60,_0x371deb,_0x1fb460,_0xcf8585);})[_0x0f0e('0x1c')](function(_0x19eda1){if(_0x19eda1&&_0x19eda1['id']){logger[_0x0f0e('0xb')](_0x0f0e('0x1a'));logger[_0x0f0e('0xb')](_0x0f0e('0x46'),_0x19eda1['id']);logger[_0x0f0e('0xb')](_0x0f0e('0x41'),_0x0f0e('0x47'));emit(util[_0x0f0e('0x17')]('user:%s',_0x5a30cb[_0x0f0e('0x12')]),_0x0f0e('0x48'),{'uri':util[_0x0f0e('0x17')](_0x0f0e('0x49'),_0x225093[_0x0f0e('0x18')],_0x19eda1['id'])});}})[_0x0f0e('0x4a')](function(_0x1a452f){logger[_0x0f0e('0x4b')]('[QUEUE]',JSON[_0x0f0e('0x2d')](_0x1a452f));});};exports[_0x0f0e('0x4c')]=function(_0x13702c,_0x2ecf5e,_0x5a7495,_0x1afe3d,_0x10dd87,_0x46a274,_0x5ef2e2){var _0x555e6a,_0x387b60;_0x46a274[_0x0f0e('0x18')]=intUtil[_0x0f0e('0x3e')](_0x46a274['remoteUri']);_0x46a274['serverUrl']=intUtil['stripTrailingSlash'](_0x46a274[_0x0f0e('0x3f')]);if(_0x5ef2e2&&_0x5ef2e2[_0x0f0e('0x4d')]&&_0x5ef2e2['recordingFormat']!=='none'){logger['info'](_0x0f0e('0x4e'),'Recording\x20is\x20enabled!');_0x2ecf5e['recordingURL']=util['format'](_0x0f0e('0x4f'),_0x46a274[_0x0f0e('0x3f')],_0x2ecf5e[_0x0f0e('0x43')],md5(_0x2ecf5e[_0x0f0e('0x43')]));}headers['Authorization']=getAuth(_0x46a274);return getUser(_0x46a274,_0x1afe3d[_0x0f0e('0x20')])[_0x0f0e('0x1c')](function(_0x580694){_0x555e6a=_0x580694;logger[_0x0f0e('0xb')](_0x0f0e('0x44'),_0x555e6a['id']);return getEndUser(_0x46a274,_0x2ecf5e[_0x0f0e('0x50')],_0x2ecf5e[_0x0f0e('0x51')]);})[_0x0f0e('0x1c')](function(_0x253085){_0x387b60=_0x253085;logger[_0x0f0e('0xb')](_0x0f0e('0x52'),_0x387b60['id']);return getTicket(_0x46a274,_0x555e6a,_0x387b60,_0x5a7495,_0x2ecf5e);})['then'](function(_0x31dd0a){if(_0x31dd0a&&_0x31dd0a['id']){logger[_0x0f0e('0xb')](_0x0f0e('0x1a'));logger['info'](_0x0f0e('0x46'),_0x31dd0a['id']);logger[_0x0f0e('0xb')](_0x0f0e('0x4e'),_0x0f0e('0x47'));emit(util['format']('user:%s',_0x1afe3d[_0x0f0e('0x12')]),'trigger:browser:url',{'uri':util['format'](_0x0f0e('0x49'),_0x46a274['remoteUri'],_0x31dd0a['id'])});}})[_0x0f0e('0x4a')](function(_0x70d506){logger['error'](_0x0f0e('0x4e'),JSON[_0x0f0e('0x2d')](_0x70d506));});};exports[_0x0f0e('0x53')]=function(_0x5fb3be,_0x2754ee,_0x133378,_0x1b48fd,_0x2dee26,_0x3d4b11){var _0x5a2775,_0x37c4fa;_0x3d4b11['remoteUri']=intUtil[_0x0f0e('0x3e')](_0x3d4b11[_0x0f0e('0x18')]);_0x3d4b11[_0x0f0e('0x3f')]=intUtil[_0x0f0e('0x3e')](_0x3d4b11[_0x0f0e('0x3f')]);if(_0x2dee26&&_0x2dee26[_0x0f0e('0x40')]){logger[_0x0f0e('0xb')]('['+_0x2754ee['lastevent'][_0x0f0e('0x54')]()+']','Recording\x20is\x20enabled!');_0x2754ee[_0x0f0e('0x55')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3d4b11[_0x0f0e('0x3f')],_0x2754ee[_0x0f0e('0x43')],md5(_0x2754ee['uniqueid']));}else{_0x2754ee[_0x0f0e('0x55')]='';}headers[_0x0f0e('0x56')]=getAuth(_0x3d4b11);return getUser(_0x3d4b11,'')[_0x0f0e('0x1c')](function(_0x345ba5){_0x5a2775=_0x345ba5;logger[_0x0f0e('0xb')](_0x0f0e('0x44'),_0x5a2775['id']);return getEndUser(_0x3d4b11,_0x2754ee[_0x0f0e('0xf')],_0x2754ee[_0x0f0e('0x45')]);})['then'](function(_0x21340d){_0x37c4fa=_0x21340d;logger[_0x0f0e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x37c4fa['id']);return getTicket(_0x3d4b11,_0x5a2775,_0x37c4fa,_0x133378,_0x2754ee);})[_0x0f0e('0x1c')](function(_0x1d3ed0){if(_0x1d3ed0){logger[_0x0f0e('0xb')](_0x0f0e('0x1a'));logger[_0x0f0e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1d3ed0['id']);}})['catch'](function(_0x124158){logger[_0x0f0e('0x4b')]('['+_0x2754ee[_0x0f0e('0x57')][_0x0f0e('0x54')]()+']',JSON[_0x0f0e('0x2d')](_0x124158));});}; \ No newline at end of file +var _0x7029=['outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','unmanaged','lastevent','toUpperCase','stringify','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','emit','info','format','calleridname','getString','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','find','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','defaults','GET','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error'];(function(_0x1b68ff,_0x5e68a2){var _0x4b3b07=function(_0x465dd9){while(--_0x465dd9){_0x1b68ff['push'](_0x1b68ff['shift']());}};_0x4b3b07(++_0x5e68a2);}(_0x7029,0x6c));var _0x9702=function(_0xa00e5f,_0x479b3c){_0xa00e5f=_0xa00e5f-0x0;var _0x1f8f4f=_0x7029[_0xa00e5f];return _0x1f8f4f;};'use strict';var _=require(_0x9702('0x0'));var rp=require(_0x9702('0x1'));var md5=require(_0x9702('0x2'));var util=require(_0x9702('0x3'));var Redis=require(_0x9702('0x4'));var intUtil=require(_0x9702('0x5'));var config=require(_0x9702('0x6'));var logger=require(_0x9702('0x7'))(_0x9702('0x8'));config[_0x9702('0x9')]=_['defaults'](config[_0x9702('0x9')],{'host':_0x9702('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9702('0x9')]));var headers={'Content-Type':_0x9702('0xb'),'Accept':_0x9702('0xb')};function emit(_0x12c750,_0x25e463,_0x41cd4f){io['to'](_0x12c750)[_0x9702('0xc')](_0x25e463,_0x41cd4f);}function getTicket(_0x4c77e7,_0x541311,_0x1444fc,_0x49639d,_0x23e6c5){logger[_0x9702('0xd')]('Creating\x20new\x20ticket...');var _0x477a5c=_['merge']({'responder_id':_0x541311['id'],'requester_id':_0x1444fc['id'],'name':util[_0x9702('0xe')]('Caller\x20-\x20%s',_0x23e6c5[_0x9702('0xf')]),'phone':_0x23e6c5['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9702('0x10')](_0x49639d['Subjects'],_0x23e6c5,'\x20'),'description':intUtil[_0x9702('0x10')](_0x49639d['Descriptions'],_0x23e6c5,'
'),'tags':getTags(_0x49639d[_0x9702('0x11')],_0x9702('0x12'))},getCustomFields(_0x49639d[_0x9702('0x13')],_0x23e6c5));_0x477a5c[_0x9702('0x14')]=_['mapValues'](_[_0x9702('0x15')](_0x477a5c[_0x9702('0x14')],'id'),_0x9702('0x16'));return request({'uri':util[_0x9702('0xe')](_0x9702('0x17'),_0x4c77e7['remoteUri']),'method':_0x9702('0x18'),'body':_0x477a5c})['then'](function(_0x511d7b){logger[_0x9702('0xd')](_0x9702('0x19'));return _0x511d7b;});}function getUser(_0x20bf64,_0x23ff67){if(intUtil[_0x9702('0x1a')](_0x23ff67)){return request({'uri':util[_0x9702('0xe')](_0x9702('0x1b'),_0x20bf64[_0x9702('0x1c')]),'qs':{'email':_0x23ff67}})[_0x9702('0x1d')](function(_0x2b04f6){if(_0x2b04f6[_0x9702('0x1e')]){logger[_0x9702('0xd')](_0x9702('0x1f'));return _[_0x9702('0x20')](_0x2b04f6,function(_0x544ace){return _0x544ace['contact'][_0x9702('0x21')]===_0x23ff67;});}else{logger[_0x9702('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9702('0xe')](_0x9702('0x22'),_0x20bf64[_0x9702('0x1c')])})[_0x9702('0x1d')](function(_0x237d15){logger[_0x9702('0xd')]('Admin\x20account\x20selected.');return _0x237d15;});}});}else{logger[_0x9702('0xd')](_0x9702('0x23'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x20bf64[_0x9702('0x1c')])})[_0x9702('0x1d')](function(_0x5e18ef){logger[_0x9702('0xd')](_0x9702('0x24'));return _0x5e18ef;});}}function getEndUser(_0x4dd5e6,_0x5f2f02,_0x106254){logger[_0x9702('0xd')](_0x9702('0x25'),_0x106254);return request({'uri':util[_0x9702('0xe')](_0x9702('0x26'),_0x4dd5e6[_0x9702('0x1c')]),'qs':{'phone':_0x106254}})[_0x9702('0x1d')](function(_0x3d7ad0){if(_0x3d7ad0['length']){logger[_0x9702('0xd')](_0x9702('0x27'));return _[_0x9702('0x20')](_0x3d7ad0,{'phone':_0x106254});}else{logger[_0x9702('0xd')](_0x9702('0x28'));return request({'uri':util['format'](_0x9702('0x26'),_0x4dd5e6['remoteUri']),'method':_0x9702('0x18'),'body':{'name':_0x5f2f02,'phone':_0x106254}})[_0x9702('0x1d')](function(_0x1c3438){logger[_0x9702('0xd')](_0x9702('0x29'));return _0x1c3438;});}});}function getAuth(_0x479487){return util[_0x9702('0xe')](_0x9702('0x2a'),new Buffer(_0x479487['apiKey']+':X')[_0x9702('0x2b')](_0x9702('0x2c')));}function request(_0x4468a8){logger[_0x9702('0x2d')]('[HTTP]',JSON['stringify'](_0x4468a8));return rp(_[_0x9702('0x2e')](_0x4468a8,{'method':_0x9702('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x274a6d,_0x5c7247){var _0x323376=[];if(_0x274a6d&&_0x274a6d[_0x9702('0x1e')]>0x0){_0x323376=_[_0x9702('0x30')](_0x274a6d,_0x5c7247);}return _0x323376;}function getCustomFields(_0xaf89f3,_0x3603bd){var _0x289be5=[];var _0x391d54={'custom_fields':[]};if(_0xaf89f3[_0x9702('0x1e')]>0x0){_[_0x9702('0x31')](_0xaf89f3,function(_0x269a10){if(_['includes']([_0x9702('0x32'),_0x9702('0x33')],_0x269a10[_0x9702('0x34')])&&_0x269a10[_0x9702('0x35')]&&!_0x269a10[_0x9702('0x36')]){_0x391d54[_0x269a10[_0x9702('0x35')][_0x9702('0x37')]()]=_0x269a10[_0x9702('0x38')][_0x9702('0x2b')]();}else if(_[_0x9702('0x39')]([_0x9702('0x32'),_0x9702('0x33')],_0x269a10[_0x9702('0x34')])&&_0x269a10[_0x9702('0x3a')]&&_0x269a10[_0x9702('0x36')]){_0x391d54['custom_fields'][_0x9702('0x3b')]({'id':_0x269a10[_0x9702('0x3a')],'value':_0x269a10[_0x9702('0x38')][_0x9702('0x2b')]()});}else if(_0x269a10[_0x9702('0x34')]==='variable'&&_0x269a10[_0x9702('0x3c')]&&_0x269a10[_0x9702('0x3a')]&&_0x269a10[_0x9702('0x36')]){_0x3603bd[_0x269a10['variableName']]&&_0x391d54[_0x9702('0x14')][_0x9702('0x3b')]({'id':_0x269a10[_0x9702('0x3a')],'value':_0x3603bd[_0x269a10[_0x9702('0x3c')]][_0x9702('0x2b')]()});}else if(_0x269a10[_0x9702('0x34')]===_0x9702('0x3d')&&_0x269a10['Variable']&&_0x269a10['Variable']['name']&&_0x269a10['idField']&&_0x269a10[_0x9702('0x36')]){_0x3603bd[_0x269a10[_0x9702('0x3e')]['name'][_0x9702('0x37')]()]&&_0x391d54[_0x9702('0x14')][_0x9702('0x3b')]({'id':_0x269a10[_0x9702('0x3a')],'value':_0x3603bd[_0x269a10['Variable'][_0x9702('0x12')]['toLowerCase']()][_0x9702('0x2b')]()});}});}return _0x391d54;}exports[_0x9702('0x3f')]=function(_0x1df32c,_0x1f8526,_0x174b2a,_0x1ff5fd,_0x523fb0,_0x2f70f8){var _0x5914c1,_0x22bceb;_0x2f70f8[_0x9702('0x1c')]=intUtil[_0x9702('0x40')](_0x2f70f8[_0x9702('0x1c')]);_0x2f70f8[_0x9702('0x41')]=intUtil[_0x9702('0x40')](_0x2f70f8[_0x9702('0x41')]);if(_0x523fb0&&_0x523fb0[_0x9702('0x42')]){logger[_0x9702('0xd')]('[QUEUE]',_0x9702('0x43'));_0x1f8526[_0x9702('0x44')]=util[_0x9702('0xe')](_0x9702('0x45'),_0x2f70f8[_0x9702('0x41')],_0x1f8526[_0x9702('0x46')],md5(_0x1f8526['uniqueid']));}else{_0x1f8526[_0x9702('0x44')]='';}headers[_0x9702('0x47')]=getAuth(_0x2f70f8);return getUser(_0x2f70f8,_0x1ff5fd['email'])[_0x9702('0x1d')](function(_0x47754b){_0x5914c1=_0x47754b;logger['info'](_0x9702('0x48'),_0x5914c1['id']);return getEndUser(_0x2f70f8,_0x1f8526[_0x9702('0xf')],_0x1f8526[_0x9702('0x49')]);})['then'](function(_0x5ea70c){_0x22bceb=_0x5ea70c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x22bceb['id']);return getTicket(_0x2f70f8,_0x5914c1,_0x22bceb,_0x174b2a,_0x1f8526);})['then'](function(_0x156f73){if(_0x156f73&&_0x156f73['id']){logger[_0x9702('0xd')](_0x9702('0x19'));logger[_0x9702('0xd')](_0x9702('0x4a'),_0x156f73['id']);logger[_0x9702('0xd')](_0x9702('0x4b'),_0x9702('0x4c'));emit(util[_0x9702('0xe')]('user:%s',_0x1ff5fd[_0x9702('0x12')]),'trigger:browser:url',{'uri':util[_0x9702('0xe')]('%s/helpdesk/tickets/%d',_0x2f70f8[_0x9702('0x1c')],_0x156f73['id'])});}})['catch'](function(_0x31a5e4){logger[_0x9702('0x4d')](_0x9702('0x4b'),JSON['stringify'](_0x31a5e4));});};exports[_0x9702('0x4e')]=function(_0x1d2809,_0x3b89f2,_0x3de21e,_0x4be9f6,_0x5c6efe,_0x5b195d,_0x5946e0){var _0x40ebe8,_0x49c3ce;_0x5b195d[_0x9702('0x1c')]=intUtil['stripTrailingSlash'](_0x5b195d[_0x9702('0x1c')]);_0x5b195d[_0x9702('0x41')]=intUtil[_0x9702('0x40')](_0x5b195d[_0x9702('0x41')]);if(_0x5946e0&&_0x5946e0['recordingFormat']&&_0x5946e0[_0x9702('0x4f')]!==_0x9702('0x50')){logger[_0x9702('0xd')]('[OUTBOUND]',_0x9702('0x43'));_0x3b89f2[_0x9702('0x44')]=util[_0x9702('0xe')](_0x9702('0x45'),_0x5b195d['serverUrl'],_0x3b89f2[_0x9702('0x46')],md5(_0x3b89f2[_0x9702('0x46')]));}headers[_0x9702('0x47')]=getAuth(_0x5b195d);return getUser(_0x5b195d,_0x4be9f6['email'])[_0x9702('0x1d')](function(_0x56f504){_0x40ebe8=_0x56f504;logger[_0x9702('0xd')]('The\x20User\x20ID\x20is:',_0x40ebe8['id']);return getEndUser(_0x5b195d,_0x3b89f2[_0x9702('0x51')],_0x3b89f2[_0x9702('0x52')]);})['then'](function(_0x738c0d){_0x49c3ce=_0x738c0d;logger['info'](_0x9702('0x53'),_0x49c3ce['id']);return getTicket(_0x5b195d,_0x40ebe8,_0x49c3ce,_0x3de21e,_0x3b89f2);})['then'](function(_0x46253e){if(_0x46253e&&_0x46253e['id']){logger['info'](_0x9702('0x19'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x46253e['id']);logger[_0x9702('0xd')](_0x9702('0x54'),_0x9702('0x4c'));emit(util['format'](_0x9702('0x55'),_0x4be9f6[_0x9702('0x12')]),_0x9702('0x56'),{'uri':util[_0x9702('0xe')](_0x9702('0x57'),_0x5b195d['remoteUri'],_0x46253e['id'])});}})[_0x9702('0x58')](function(_0x468fb7){logger[_0x9702('0x4d')](_0x9702('0x54'),JSON['stringify'](_0x468fb7));});};exports[_0x9702('0x59')]=function(_0x45f8b2,_0x1d3f5e,_0x593481,_0x4d080c,_0x43b4b7,_0x4a64f5){var _0x165c71,_0x26c328;_0x4a64f5[_0x9702('0x1c')]=intUtil['stripTrailingSlash'](_0x4a64f5[_0x9702('0x1c')]);_0x4a64f5[_0x9702('0x41')]=intUtil[_0x9702('0x40')](_0x4a64f5[_0x9702('0x41')]);if(_0x43b4b7&&_0x43b4b7['monitor_format']){logger[_0x9702('0xd')]('['+_0x1d3f5e[_0x9702('0x5a')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1d3f5e[_0x9702('0x44')]=util[_0x9702('0xe')](_0x9702('0x45'),_0x4a64f5['serverUrl'],_0x1d3f5e[_0x9702('0x46')],md5(_0x1d3f5e[_0x9702('0x46')]));}else{_0x1d3f5e[_0x9702('0x44')]='';}headers[_0x9702('0x47')]=getAuth(_0x4a64f5);return getUser(_0x4a64f5,'')[_0x9702('0x1d')](function(_0x4168bf){_0x165c71=_0x4168bf;logger[_0x9702('0xd')]('The\x20User\x20ID\x20is:',_0x165c71['id']);return getEndUser(_0x4a64f5,_0x1d3f5e[_0x9702('0xf')],_0x1d3f5e[_0x9702('0x49')]);})[_0x9702('0x1d')](function(_0x3e5ccf){_0x26c328=_0x3e5ccf;logger['info'](_0x9702('0x53'),_0x26c328['id']);return getTicket(_0x4a64f5,_0x165c71,_0x26c328,_0x593481,_0x1d3f5e);})[_0x9702('0x1d')](function(_0x4a2679){if(_0x4a2679){logger[_0x9702('0xd')]('Ticket\x20created!');logger[_0x9702('0xd')](_0x9702('0x4a'),_0x4a2679['id']);}})[_0x9702('0x58')](function(_0x1b7119){logger[_0x9702('0x4d')]('['+_0x1d3f5e[_0x9702('0x5a')][_0x9702('0x5b')]()+']',JSON[_0x9702('0x5c')](_0x1b7119));});}; \ 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 e9a9d24..f6a807c 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 _0xcecd=['emit','trigger:browser:url','Token\x20token=','remoteUri','serverUrl','username','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','./util','../../../../config/logger','defaults','redis','localhost','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminId','catch','error','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','adminEmail','toUpperCase','message','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','Contact\x20found\x20mobile_number:','endUserId','POST','/api/contacts','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','Task\x20created:','user:%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcecd,0xfb));var _0xdcec=function(_0x24ae1e,_0x277f45){_0x24ae1e=_0x24ae1e-0x0;var _0x4598e4=_0xcecd[_0x24ae1e];return _0x4598e4;};'use strict';var _=require(_0xdcec('0x0'));var rp=require(_0xdcec('0x1'));var md5=require('md5');var util=require(_0xdcec('0x2'));var moment=require(_0xdcec('0x3'));var Promise=require(_0xdcec('0x4'));var Redis=require('ioredis');var intUtil=require(_0xdcec('0x5'));var config=require('../../../../config/environment');var logger=require(_0xdcec('0x6'))('freshsales');config['redis']=_[_0xdcec('0x7')](config[_0xdcec('0x8')],{'host':_0xdcec('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x2e49c3,_0x2983df,_0x4404c4,_0x17768f){return new Promise(function(_0x4fbed3,_0x5152ed){var _0x48813f=![];var _0x1c7ea0={'method':'GET','uri':_0x17768f+_0xdcec('0xa'),'json':!![]};_0x1c7ea0[_0xdcec('0xb')]=_0x4404c4;logger[_0xdcec('0xc')](_0xdcec('0xd'));return rp(_0x1c7ea0)[_0xdcec('0xe')](function(_0x3f0c7c){if(_0x3f0c7c){var _0x2ed013=_0x3f0c7c[_0xdcec('0xf')];var _0x15492c=null;for(_0x15492c=0x0;_0x15492c<_0x2ed013[_0xdcec('0x10')];_0x15492c++){if(_0x2ed013[_0x15492c]['email']===_0x2e49c3['adminEmail']){_0x2e49c3[_0xdcec('0x11')]=_0x2ed013[_0x15492c]['id'];_0x48813f=!![];}}if(_0x48813f){logger[_0xdcec('0xc')]('Admin\x20found:',_0x2e49c3[_0xdcec('0x11')]);_0x4fbed3(_0x2e49c3);}else{_0x5152ed({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5152ed({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xdcec('0x12')](function(_0x53f169){logger[_0xdcec('0x13')]('['+[_0x2983df['toUpperCase']()]+']',_0x53f169['message']);_0x5152ed(_0x53f169);});});}function getUser(_0x4f8cff,_0x39cbb5,_0x70c60c){return function(_0x1f60e6){return new Promise(function(_0x32d345,_0x1ec5db){var _0x507a95={'method':_0xdcec('0x14'),'uri':_0x70c60c+_0xdcec('0xa'),'json':!![]};_0x507a95['headers']=_0x39cbb5;logger['info'](_0xdcec('0x15'));return rp(_0x507a95)[_0xdcec('0xe')](function(_0x4a0b3d){if(_0x4a0b3d){var _0x36d2c2=_0x4a0b3d['users'];var _0x23f2db=![];var _0x2ab6e4=null;if(_0x1f60e6[_0xdcec('0x16')]!==null){logger[_0xdcec('0xc')](_0xdcec('0x17'),_0x1f60e6[_0xdcec('0x16')]);_0x1f60e6['userEmail']=_0x1f60e6[_0xdcec('0x16')];for(_0x2ab6e4=0x0;_0x2ab6e4<_0x36d2c2['length'];_0x2ab6e4++){if(_0x36d2c2[_0x2ab6e4]['email']===_0x1f60e6[_0xdcec('0x16')]){_0x23f2db=!![];_0x1f60e6[_0xdcec('0x18')]=_0x36d2c2[_0x2ab6e4]['id'];logger['info'](_0xdcec('0x19'),_0x1f60e6[_0xdcec('0x18')]);}}}if(!_0x23f2db){logger[_0xdcec('0xc')](_0xdcec('0x1a'));_0x1f60e6['userEmail']=_0x1f60e6[_0xdcec('0x1b')];_0x1f60e6[_0xdcec('0x18')]=_0x1f60e6[_0xdcec('0x11')];_0x23f2db=!![];}if(_0x23f2db){_0x32d345(_0x1f60e6);}else{_0x1ec5db({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1ec5db({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xdcec('0x12')](function(_0xfb9e8a){logger[_0xdcec('0x13')]('['+[_0x4f8cff[_0xdcec('0x1c')]()]+']',_0xfb9e8a[_0xdcec('0x1d')]);_0x1ec5db(_0xfb9e8a);});});};}function searchContact(_0x39e0e7,_0xedfb7e,_0x4017cd,_0x866e34){return new Promise(function(_0x2792da,_0x48d785){var _0x4718c3={'method':_0xdcec('0x14'),'headers':_0xedfb7e,'uri':_0x39e0e7+_0xdcec('0x1e')+_0x866e34+_0xdcec('0x1f')+_0x4017cd+_0xdcec('0x20'),'json':!![]};rp(_0x4718c3)['then'](function(_0x5b9afc){var _0x2b658c=_['find'](_0x5b9afc[_0xdcec('0x21')][_0xdcec('0x21')],[_0x4017cd,_0x866e34]);_0x2792da(_0x2b658c);})['catch'](function(_0x55f5bc){_0x48d785(_0x55f5bc);});});}function getEndUser(_0x3f4a67,_0x10a362,_0x1eeb2b){return function(_0x3888f4){return new Promise(function(_0x4581bc,_0x4c7a03){logger[_0xdcec('0xc')](util[_0xdcec('0x22')](_0xdcec('0x23'),_0x3888f4['contactNumber']));searchContact(_0x1eeb2b,_0x10a362,_0xdcec('0x24'),_0x3888f4[_0xdcec('0x25')])['then'](function(_0x46954d){if(_0x46954d){_0x3888f4['endUserId']=_0x46954d['id'];logger[_0xdcec('0xc')](_0xdcec('0x26'),_0x3888f4[_0xdcec('0x27')]);return _0x4581bc(_0x3888f4);}searchContact(_0x1eeb2b,_0x10a362,'work_number',_0x3888f4['contactNumber'])[_0xdcec('0xe')](function(_0x9fcaf){if(_0x9fcaf){_0x3888f4[_0xdcec('0x27')]=_0x9fcaf['id'];logger['info']('Contact\x20found\x20work_number:',_0x3888f4['endUserId']);return _0x4581bc(_0x3888f4);}createEndUser(_0x3888f4,_0x3f4a67,_0x10a362,_0x1eeb2b)['then'](function(_0x307c8d){logger[_0xdcec('0xc')]('Contact\x20created:',_0x307c8d[_0xdcec('0x27')]);return _0x4581bc(_0x307c8d);});});})[_0xdcec('0x12')](function(_0x4c5447){_0x4c7a03(_0x4c5447);});});};}function createEndUser(_0x11d741,_0x4830a6,_0x42869a,_0x17f641){return new Promise(function(_0x1e2320,_0x3ff8df){var _0x44e68b=moment();var _0x42cb29={'method':_0xdcec('0x28'),'uri':_0x17f641+_0xdcec('0x29'),'body':{'contact':{'last_name':_0x11d741['contactNumber'],'work_number':_0x11d741[_0xdcec('0x25')],'mobile_number':_0x11d741[_0xdcec('0x25')],'owner_id':_0x11d741[_0xdcec('0x18')],'created_at':_0x44e68b['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x42cb29[_0xdcec('0xb')]=_0x42869a;logger[_0xdcec('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x42cb29)[_0xdcec('0xe')](function(_0x59d6e2){_0x11d741[_0xdcec('0x27')]=_0x59d6e2['contact']['id'];_0x1e2320(_0x11d741);})[_0xdcec('0x12')](function(_0x5da1af){logger['error']('['+[_0x4830a6['toUpperCase']()]+']',_0x5da1af[_0xdcec('0x1d')]);_0x3ff8df(_0x5da1af[_0xdcec('0x1d')]);});});}function getTicket(_0x2a5f1e,_0x43fb80,_0x4cfc59,_0x5ca3f0,_0x43ce55){return function(_0x489aaa){logger[_0xdcec('0xc')](_0xdcec('0x2a'));return new Promise(function(_0x1c1d34,_0x4705b4){var _0x5c93e7=moment();var _0x46cd7c={'method':_0xdcec('0x28'),'uri':_0x4cfc59+_0xdcec('0x2b'),'body':{'title':intUtil[_0xdcec('0x2c')](_0x5ca3f0[_0xdcec('0x2d')],_0x43ce55,'\x20'),'description':intUtil[_0xdcec('0x2c')](_0x5ca3f0[_0xdcec('0x2e')],_0x43ce55,'\x0a'),'owner_id':_0x489aaa[_0xdcec('0x18')],'creater_id':_0x489aaa[_0xdcec('0x11')],'targetable_id':_0x489aaa['endUserId'],'targetable_type':_0xdcec('0x2f'),'created_at':_0x5c93e7[_0xdcec('0x22')](_0xdcec('0x30')),'due_date':_0x5c93e7[_0xdcec('0x31')](0x1e,'m')[_0xdcec('0x22')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x46cd7c[_0xdcec('0xb')]=_0x43fb80;return rp(_0x46cd7c)[_0xdcec('0xe')](function(_0x40ac33){_0x489aaa[_0xdcec('0x32')]=_0x40ac33['task']['id'];logger[_0xdcec('0xc')](_0xdcec('0x33'),_0x489aaa[_0xdcec('0x32')]);_0x1c1d34(_0x489aaa);})['catch'](function(_0x5c9589){logger[_0xdcec('0x13')]('['+[_0x2a5f1e[_0xdcec('0x1c')]()]+']',_0x5c9589[_0xdcec('0x1d')]);_0x4705b4(_0x5c9589['message']);});});};}function emit(_0x1086e0,_0x4f4ef2,_0x26784c){var _0x4c082f={'uri':_0x1086e0+'/contacts/'+_0x26784c};io['to'](util[_0xdcec('0x22')](_0xdcec('0x34'),_0x4f4ef2))[_0xdcec('0x35')](_0xdcec('0x36'),_0x4c082f);}exports['cs']=function(_0x4fbf8d,_0x25750e,_0xf511f,_0x3dd88a,_0x532972,_0x28545e,_0x3a455b,_0x5bf376){var _0x4047d4={};var _0x1af6a4={'Authorization':_0xdcec('0x37')+_0x28545e['apiKey']};_0x28545e[_0xdcec('0x38')]=intUtil['stripTrailingSlash'](_0x28545e[_0xdcec('0x38')]);_0x28545e[_0xdcec('0x39')]=intUtil['stripTrailingSlash'](_0x28545e['serverUrl']);var _0x237e26=_0x28545e[_0xdcec('0x38')];_0x4047d4[_0xdcec('0x1b')]=_0x28545e[_0xdcec('0x3a')];_0x4047d4[_0xdcec('0x25')]=_0x5bf376['toLowerCase']()===_0xdcec('0x3b')?_0x25750e['destcalleridnum']:_0x25750e[_0xdcec('0x3c')];_0x4047d4[_0xdcec('0x3d')]=_0x5bf376===_0xdcec('0x3e')||_0x5bf376===_0xdcec('0x3f')?'queue':_0xdcec('0x3b');if(_0x3dd88a){_0x4047d4[_0xdcec('0x16')]=_0x3dd88a['email'];}var _0x45fc94=util[_0xdcec('0x22')](_0xdcec('0x40'),_0x28545e[_0xdcec('0x39')],_0x25750e[_0xdcec('0x41')],md5(_0x25750e[_0xdcec('0x41')]));if(_0x532972&&_0x532972[_0xdcec('0x42')]){logger['info'](_0xdcec('0x43'),'Recording\x20is\x20enabled!');_0x25750e[_0xdcec('0x44')]=_0x45fc94;}else if(_0x3a455b&&_0x3a455b[_0xdcec('0x45')]&&_0x3a455b[_0xdcec('0x45')]!==_0xdcec('0x46')){logger[_0xdcec('0xc')](_0xdcec('0x47'),_0xdcec('0x48'));_0x25750e[_0xdcec('0x44')]=_0x45fc94;}else{_0x25750e['recordingURL']='';}return getAdminId(_0x4047d4,_0x5bf376,_0x1af6a4,_0x237e26)['then'](getUser(_0x5bf376,_0x1af6a4,_0x237e26))['then'](getEndUser(_0x5bf376,_0x1af6a4,_0x237e26))[_0xdcec('0xe')](getTicket(_0x5bf376,_0x1af6a4,_0x237e26,_0xf511f,_0x25750e))[_0xdcec('0xe')](function(_0x120fed){logger['info'](util[_0xdcec('0x22')](_0xdcec('0x49'),_0x120fed[_0xdcec('0x32')]));if(_0x5bf376!==_0xdcec('0x3f')){logger[_0xdcec('0xc')]('['+[_0x5bf376[_0xdcec('0x1c')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x237e26,_0x3dd88a[_0xdcec('0x4a')],_0x120fed[_0xdcec('0x27')]);}})[_0xdcec('0x12')](function(_0x5c7054){logger[_0xdcec('0x13')]('['+[_0x5bf376[_0xdcec('0x1c')]()]+_0xdcec('0x4b'),util['inspect'](_0x5c7054,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x18e7=['task','Task\x20created:','ticketId','error','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','bluebird','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','&f=','find','contacts','format','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x18e7,0x166));var _0x718e=function(_0x19be78,_0x42687f){_0x19be78=_0x19be78-0x0;var _0x3a066b=_0x18e7[_0x19be78];return _0x3a066b;};'use strict';var _=require(_0x718e('0x0'));var rp=require(_0x718e('0x1'));var md5=require(_0x718e('0x2'));var util=require('util');var moment=require('moment');var Promise=require(_0x718e('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x718e('0x4'));var logger=require('../../../../config/logger')('freshsales');config['redis']=_[_0x718e('0x5')](config[_0x718e('0x6')],{'host':_0x718e('0x7'),'port':0x18eb});var io=require(_0x718e('0x8'))(new Redis(config[_0x718e('0x6')]));function getAdminId(_0x76952d,_0x56b3ee,_0x3ee423,_0x18ef1c){return new Promise(function(_0x2ed13d,_0x55d211){var _0x44f534=![];var _0x5cf0d0={'method':_0x718e('0x9'),'uri':_0x18ef1c+_0x718e('0xa'),'json':!![]};_0x5cf0d0[_0x718e('0xb')]=_0x3ee423;logger[_0x718e('0xc')](_0x718e('0xd'));return rp(_0x5cf0d0)[_0x718e('0xe')](function(_0xd1d2cc){if(_0xd1d2cc){var _0x1384d2=_0xd1d2cc['users'];var _0x6bca65=null;for(_0x6bca65=0x0;_0x6bca65<_0x1384d2[_0x718e('0xf')];_0x6bca65++){if(_0x1384d2[_0x6bca65][_0x718e('0x10')]===_0x76952d[_0x718e('0x11')]){_0x76952d[_0x718e('0x12')]=_0x1384d2[_0x6bca65]['id'];_0x44f534=!![];}}if(_0x44f534){logger[_0x718e('0xc')](_0x718e('0x13'),_0x76952d['adminId']);_0x2ed13d(_0x76952d);}else{_0x55d211({'statusCode':0x194,'message':_0x718e('0x14')});}}else{_0x55d211({'statusCode':0x194,'message':_0x718e('0x14')});}})[_0x718e('0x15')](function(_0x14a33b){logger['error']('['+[_0x56b3ee[_0x718e('0x16')]()]+']',_0x14a33b[_0x718e('0x17')]);_0x55d211(_0x14a33b);});});}function getUser(_0x1147c2,_0x3caa5e,_0x45c461){return function(_0x2da29f){return new Promise(function(_0x1f27db,_0x5a8e65){var _0x20b136={'method':'GET','uri':_0x45c461+_0x718e('0xa'),'json':!![]};_0x20b136['headers']=_0x3caa5e;logger[_0x718e('0xc')](_0x718e('0x18'));return rp(_0x20b136)[_0x718e('0xe')](function(_0x9f1dc0){if(_0x9f1dc0){var _0x3a1b92=_0x9f1dc0[_0x718e('0x19')];var _0x44d9e0=![];var _0x4fe388=null;if(_0x2da29f[_0x718e('0x1a')]!==null){logger[_0x718e('0xc')](_0x718e('0x1b'),_0x2da29f[_0x718e('0x1a')]);_0x2da29f[_0x718e('0x1c')]=_0x2da29f[_0x718e('0x1a')];for(_0x4fe388=0x0;_0x4fe388<_0x3a1b92[_0x718e('0xf')];_0x4fe388++){if(_0x3a1b92[_0x4fe388][_0x718e('0x10')]===_0x2da29f[_0x718e('0x1a')]){_0x44d9e0=!![];_0x2da29f[_0x718e('0x1d')]=_0x3a1b92[_0x4fe388]['id'];logger[_0x718e('0xc')]('User\x20found:',_0x2da29f[_0x718e('0x1d')]);}}}if(!_0x44d9e0){logger[_0x718e('0xc')](_0x718e('0x1e'));_0x2da29f[_0x718e('0x1c')]=_0x2da29f['adminEmail'];_0x2da29f[_0x718e('0x1d')]=_0x2da29f[_0x718e('0x12')];_0x44d9e0=!![];}if(_0x44d9e0){_0x1f27db(_0x2da29f);}else{_0x5a8e65({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5a8e65({'statusCode':0x194,'message':_0x718e('0x14')});}})[_0x718e('0x15')](function(_0x563b9b){logger['error']('['+[_0x1147c2['toUpperCase']()]+']',_0x563b9b[_0x718e('0x17')]);_0x5a8e65(_0x563b9b);});});};}function searchContact(_0xedd5ea,_0x2a4f1c,_0x92f8e5,_0x5c498f){return new Promise(function(_0x2eb9c9,_0x1a61ba){var _0x19c3ff={'method':_0x718e('0x9'),'headers':_0x2a4f1c,'uri':_0xedd5ea+'/api/lookup?q='+_0x5c498f+_0x718e('0x1f')+_0x92f8e5+'&entities=contact','json':!![]};rp(_0x19c3ff)[_0x718e('0xe')](function(_0x322172){var _0x3ea388=_[_0x718e('0x20')](_0x322172[_0x718e('0x21')][_0x718e('0x21')],[_0x92f8e5,_0x5c498f]);_0x2eb9c9(_0x3ea388);})[_0x718e('0x15')](function(_0x30ca03){_0x1a61ba(_0x30ca03);});});}function getEndUser(_0x2687e0,_0x3b34b5,_0x56787c){return function(_0x3c3b6e){return new Promise(function(_0x59dea1,_0x25d202){logger['info'](util[_0x718e('0x22')]('Searching\x20contact\x20with\x20phone\x20%s',_0x3c3b6e[_0x718e('0x23')]));searchContact(_0x56787c,_0x3b34b5,_0x718e('0x24'),_0x3c3b6e[_0x718e('0x23')])[_0x718e('0xe')](function(_0x2e822d){if(_0x2e822d){_0x3c3b6e['endUserId']=_0x2e822d['id'];logger[_0x718e('0xc')](_0x718e('0x25'),_0x3c3b6e[_0x718e('0x26')]);return _0x59dea1(_0x3c3b6e);}searchContact(_0x56787c,_0x3b34b5,_0x718e('0x27'),_0x3c3b6e[_0x718e('0x23')])[_0x718e('0xe')](function(_0x2fe9c9){if(_0x2fe9c9){_0x3c3b6e[_0x718e('0x26')]=_0x2fe9c9['id'];logger[_0x718e('0xc')](_0x718e('0x28'),_0x3c3b6e[_0x718e('0x26')]);return _0x59dea1(_0x3c3b6e);}createEndUser(_0x3c3b6e,_0x2687e0,_0x3b34b5,_0x56787c)[_0x718e('0xe')](function(_0x37f4db){logger[_0x718e('0xc')](_0x718e('0x29'),_0x37f4db[_0x718e('0x26')]);return _0x59dea1(_0x37f4db);});});})['catch'](function(_0xe4b331){_0x25d202(_0xe4b331);});});};}function createEndUser(_0x58b9ab,_0xc5944b,_0x29a1fe,_0x3047b9){return new Promise(function(_0x4dd559,_0x53da16){var _0x4311cd=moment();var _0x5bcef2={'method':_0x718e('0x2a'),'uri':_0x3047b9+_0x718e('0x2b'),'body':{'contact':{'last_name':_0x58b9ab[_0x718e('0x23')],'work_number':_0x58b9ab[_0x718e('0x23')],'mobile_number':_0x58b9ab['contactNumber'],'owner_id':_0x58b9ab[_0x718e('0x1d')],'created_at':_0x4311cd[_0x718e('0x22')](_0x718e('0x2c'))}},'json':!![]};_0x5bcef2[_0x718e('0xb')]=_0x29a1fe;logger['info'](_0x718e('0x2d'));return rp(_0x5bcef2)[_0x718e('0xe')](function(_0x537fad){_0x58b9ab[_0x718e('0x26')]=_0x537fad[_0x718e('0x2e')]['id'];_0x4dd559(_0x58b9ab);})[_0x718e('0x15')](function(_0x517825){logger['error']('['+[_0xc5944b[_0x718e('0x16')]()]+']',_0x517825['message']);_0x53da16(_0x517825['message']);});});}function getTicket(_0x2cd078,_0x1e8b92,_0x18dc13,_0x2f684f,_0x317db7){return function(_0x1b38d1){logger[_0x718e('0xc')](_0x718e('0x2f'));return new Promise(function(_0x263541,_0x3a4a50){var _0x1480a6=moment();var _0x4acb50={'method':_0x718e('0x2a'),'uri':_0x18dc13+_0x718e('0x30'),'body':{'title':intUtil[_0x718e('0x31')](_0x2f684f[_0x718e('0x32')],_0x317db7,'\x20'),'description':intUtil[_0x718e('0x31')](_0x2f684f['Descriptions'],_0x317db7,'\x0a'),'owner_id':_0x1b38d1[_0x718e('0x1d')],'creater_id':_0x1b38d1[_0x718e('0x12')],'targetable_id':_0x1b38d1[_0x718e('0x26')],'targetable_type':_0x718e('0x33'),'created_at':_0x1480a6['format'](_0x718e('0x2c')),'due_date':_0x1480a6['add'](0x1e,'m')[_0x718e('0x22')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4acb50[_0x718e('0xb')]=_0x1e8b92;return rp(_0x4acb50)['then'](function(_0x32eecd){_0x1b38d1['ticketId']=_0x32eecd[_0x718e('0x34')]['id'];logger[_0x718e('0xc')](_0x718e('0x35'),_0x1b38d1[_0x718e('0x36')]);_0x263541(_0x1b38d1);})[_0x718e('0x15')](function(_0x17c6e8){logger[_0x718e('0x37')]('['+[_0x2cd078[_0x718e('0x16')]()]+']',_0x17c6e8['message']);_0x3a4a50(_0x17c6e8[_0x718e('0x17')]);});});};}function emit(_0x22b15e,_0x39f3ed,_0x5e1be8){var _0x198545={'uri':_0x22b15e+_0x718e('0x38')+_0x5e1be8};io['to'](util[_0x718e('0x22')](_0x718e('0x39'),_0x39f3ed))['emit'](_0x718e('0x3a'),_0x198545);}exports['cs']=function(_0x48b23a,_0x7d42f6,_0x39870e,_0x4e1d9a,_0x1b3462,_0x33aba7,_0x3d99d7,_0xeeee2f){var _0xc85f2e={};var _0x5f1dcc={'Authorization':_0x718e('0x3b')+_0x33aba7[_0x718e('0x3c')]};_0x33aba7['remoteUri']=intUtil[_0x718e('0x3d')](_0x33aba7[_0x718e('0x3e')]);_0x33aba7[_0x718e('0x3f')]=intUtil[_0x718e('0x3d')](_0x33aba7[_0x718e('0x3f')]);var _0x409959=_0x33aba7[_0x718e('0x3e')];_0xc85f2e['adminEmail']=_0x33aba7[_0x718e('0x40')];_0xc85f2e[_0x718e('0x23')]=_0xeeee2f[_0x718e('0x41')]()==='outbound'?_0x7d42f6[_0x718e('0x42')]:_0x7d42f6[_0x718e('0x43')];_0xc85f2e[_0x718e('0x44')]=_0xeeee2f==='queue'||_0xeeee2f===_0x718e('0x45')?_0x718e('0x46'):'outbound';if(_0x4e1d9a){_0xc85f2e[_0x718e('0x1a')]=_0x4e1d9a[_0x718e('0x10')];}var _0x54b78c=util['format'](_0x718e('0x47'),_0x33aba7['serverUrl'],_0x7d42f6[_0x718e('0x48')],md5(_0x7d42f6['uniqueid']));if(_0x1b3462&&_0x1b3462[_0x718e('0x49')]){logger[_0x718e('0xc')](_0x718e('0x4a'),_0x718e('0x4b'));_0x7d42f6[_0x718e('0x4c')]=_0x54b78c;}else if(_0x3d99d7&&_0x3d99d7[_0x718e('0x4d')]&&_0x3d99d7[_0x718e('0x4d')]!=='none'){logger[_0x718e('0xc')](_0x718e('0x4e'),_0x718e('0x4b'));_0x7d42f6[_0x718e('0x4c')]=_0x54b78c;}else{_0x7d42f6['recordingURL']='';}return getAdminId(_0xc85f2e,_0xeeee2f,_0x5f1dcc,_0x409959)[_0x718e('0xe')](getUser(_0xeeee2f,_0x5f1dcc,_0x409959))[_0x718e('0xe')](getEndUser(_0xeeee2f,_0x5f1dcc,_0x409959))[_0x718e('0xe')](getTicket(_0xeeee2f,_0x5f1dcc,_0x409959,_0x39870e,_0x7d42f6))[_0x718e('0xe')](function(_0x14d18c){logger[_0x718e('0xc')](util[_0x718e('0x22')](_0x718e('0x4f'),_0x14d18c[_0x718e('0x36')]));if(_0xeeee2f!==_0x718e('0x45')){logger['info']('['+[_0xeeee2f[_0x718e('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x409959,_0x4e1d9a['name'],_0x14d18c[_0x718e('0x26')]);}})['catch'](function(_0x4be2fd){logger[_0x718e('0x37')]('['+[_0xeeee2f[_0x718e('0x16')]()]+_0x718e('0x50'),util[_0x718e('0x51')](_0x4be2fd,{'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 31dbe69..2acc1c2 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 _0x6a2b=['toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','unknown\x20integration','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','data2','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','data1'];(function(_0x1190d0,_0x45596c){var _0x3f715e=function(_0x1ee180){while(--_0x1ee180){_0x1190d0['push'](_0x1190d0['shift']());}};_0x3f715e(++_0x45596c);}(_0x6a2b,0x107));var _0xb6a2=function(_0x491c1e,_0x32710a){_0x491c1e=_0x491c1e-0x0;var _0x30d20b=_0x6a2b[_0x491c1e];return _0x30d20b;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xb6a2('0x0'));var sugarcrm=require(_0xb6a2('0x1'));var freshdesk=require(_0xb6a2('0x2'));var zoho=require('./zoho');var desk=require(_0xb6a2('0x3'));var vtiger=require(_0xb6a2('0x4'));var servicenow=require(_0xb6a2('0x5'));var dynamics365=require(_0xb6a2('0x6'));var freshsales=require('./freshsales');var integrations=['zendesk',_0xb6a2('0x7'),_0xb6a2('0x8'),_0xb6a2('0x9'),_0xb6a2('0xa'),'desk',_0xb6a2('0xb'),_0xb6a2('0xc'),_0xb6a2('0xd'),_0xb6a2('0xe')];exports[_0xb6a2('0xf')]=function(_0x361d40,_0x38704e,_0x42504a,_0x4a6c45,_0x1bf8c8,_0x4a5ffa){if(_0x42504a){if(_['includes'](integrations,_0x361d40[_0xb6a2('0x10')][_0xb6a2('0x11')]())){try{var _0x852d36=null;var _0x3ae42a='';var _0x4d0ae8=_0x42504a[_0x361d40['data1'][_0xb6a2('0x11')]()];if(_0x4d0ae8){var _0x427d09=_0x4d0ae8[_0x361d40['data2']];if(_0x427d09){var _0x397138=_[_0xb6a2('0x12')](_0x427d09[_0xb6a2('0x13')],{'id':parseInt(_0x361d40[_0xb6a2('0x14')],0xa)});if(_0x397138){if(_0x4a6c45){if(_0x1bf8c8&&_0x38704e[_0xb6a2('0x15')]){_0x3ae42a=_0xb6a2('0x15');}else if(_0x38704e[_0xb6a2('0x16')]){_0x3ae42a=_0xb6a2('0x17');}else{console[_0xb6a2('0x18')](_0xb6a2('0x19'),_0x38704e);}}else{_0x3ae42a=_0xb6a2('0x1a');}switch(_0x361d40[_0xb6a2('0x10')][_0xb6a2('0x11')]()){case'zendesk':zendesk[_0x3ae42a](_0x361d40,_0x38704e,_0x397138,_0x4a6c45,_0x1bf8c8,_0x427d09,_0x4a5ffa);break;case _0xb6a2('0x7'):salesforce[_0x3ae42a](_0x361d40,_0x38704e,_0x397138,_0x4a6c45,_0x1bf8c8,_0x427d09,_0x4a5ffa);break;case'sugarcrm':sugarcrm[_0x3ae42a](_0x361d40,_0x38704e,_0x397138,_0x4a6c45,_0x1bf8c8,_0x427d09,_0x4a5ffa);break;case'freshdesk':freshdesk[_0x3ae42a](_0x361d40,_0x38704e,_0x397138,_0x4a6c45,_0x1bf8c8,_0x427d09,_0x4a5ffa);break;case _0xb6a2('0xa'):zoho[_0x3ae42a](_0x361d40,_0x38704e,_0x397138,_0x4a6c45,_0x1bf8c8,_0x427d09,_0x4a5ffa);break;case _0xb6a2('0x1b'):desk[_0x3ae42a](_0x361d40,_0x38704e,_0x397138,_0x4a6c45,_0x1bf8c8,_0x427d09,_0x4a5ffa);break;case _0xb6a2('0xb'):vtiger[_0x3ae42a](_0x361d40,_0x38704e,_0x397138,_0x4a6c45,_0x1bf8c8,_0x427d09,_0x4a5ffa);break;case'freshsales':freshsales['cs'](_0x361d40,_0x38704e,_0x397138,_0x4a6c45,_0x1bf8c8,_0x427d09,_0x4a5ffa,_0x3ae42a);break;case _0xb6a2('0xe'):servicenow['cs'](_0x361d40,_0x38704e,_0x397138,_0x4a6c45,_0x1bf8c8,_0x427d09,_0x4a5ffa,_0x3ae42a);break;case _0xb6a2('0xc'):dynamics365['cs'](_0x361d40,_0x38704e,_0x397138,_0x4a6c45,_0x1bf8c8,_0x427d09,_0x4a5ffa,_0x3ae42a);break;default:console['log'](_0xb6a2('0x1c'));}}else{_0x852d36=require('../../../../config/logger')(_0x361d40['data1'][_0xb6a2('0x11')]());_0x852d36[_0xb6a2('0x1d')]('[EXEC]',util[_0xb6a2('0x1e')](_0xb6a2('0x1f'),_0x361d40[_0xb6a2('0x10')][_0xb6a2('0x11')](),_0x361d40[_0xb6a2('0x14')]));}}else{_0x852d36=require('../../../../config/logger')(_0x361d40[_0xb6a2('0x10')][_0xb6a2('0x11')]());_0x852d36[_0xb6a2('0x1d')](_0xb6a2('0x20'),util[_0xb6a2('0x1e')](_0xb6a2('0x21'),_0x361d40[_0xb6a2('0x10')][_0xb6a2('0x11')](),_0x361d40[_0xb6a2('0x22')]));}}else{}}catch(_0x5b8691){console[_0xb6a2('0x1d')](_0x5b8691);}}}}; \ No newline at end of file +var _0xa6ff=['./vtiger','./freshsales','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','salesforce','log','unknown\x20integration','../../../../config/logger','format','error','[EXEC]','lodash','util','./salesforce','./zoho','./desk'];(function(_0x35eb4a,_0x5d57bf){var _0x4b1492=function(_0x7cb654){while(--_0x7cb654){_0x35eb4a['push'](_0x35eb4a['shift']());}};_0x4b1492(++_0x5d57bf);}(_0xa6ff,0xa0));var _0xfa6f=function(_0x5ccca8,_0xf6e74a){_0x5ccca8=_0x5ccca8-0x0;var _0x1d96e9=_0xa6ff[_0x5ccca8];return _0x1d96e9;};'use strict';var _=require(_0xfa6f('0x0'));var util=require(_0xfa6f('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0xfa6f('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xfa6f('0x3'));var desk=require(_0xfa6f('0x4'));var vtiger=require(_0xfa6f('0x5'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0xfa6f('0x6'));var integrations=['zendesk','salesforce','sugarcrm',_0xfa6f('0x7'),_0xfa6f('0x8'),_0xfa6f('0x9'),_0xfa6f('0xa'),_0xfa6f('0xb'),_0xfa6f('0xc'),_0xfa6f('0xd')];exports['exec']=function(_0x3193f7,_0x302af7,_0x597815,_0x4811b3,_0x5ba2f6,_0x3a7b5a){if(_0x597815){if(_['includes'](integrations,_0x3193f7[_0xfa6f('0xe')][_0xfa6f('0xf')]())){try{var _0x4c98a0=null;var _0x1ea169='';var _0x3fe4ba=_0x597815[_0x3193f7['data1'][_0xfa6f('0xf')]()];if(_0x3fe4ba){var _0x1bb194=_0x3fe4ba[_0x3193f7[_0xfa6f('0x10')]];if(_0x1bb194){var _0x4e9d51=_[_0xfa6f('0x11')](_0x1bb194[_0xfa6f('0x12')],{'id':parseInt(_0x3193f7[_0xfa6f('0x13')],0xa)});if(_0x4e9d51){if(_0x4811b3){if(_0x5ba2f6&&_0x302af7[_0xfa6f('0x14')]){_0x1ea169=_0xfa6f('0x14');}else if(_0x302af7[_0xfa6f('0x15')]){_0x1ea169=_0xfa6f('0x16');}else{console['log'](_0xfa6f('0x17'),_0x302af7);}}else{_0x1ea169=_0xfa6f('0x18');}switch(_0x3193f7[_0xfa6f('0xe')][_0xfa6f('0xf')]()){case _0xfa6f('0x19'):zendesk[_0x1ea169](_0x3193f7,_0x302af7,_0x4e9d51,_0x4811b3,_0x5ba2f6,_0x1bb194,_0x3a7b5a);break;case _0xfa6f('0x1a'):salesforce[_0x1ea169](_0x3193f7,_0x302af7,_0x4e9d51,_0x4811b3,_0x5ba2f6,_0x1bb194,_0x3a7b5a);break;case'sugarcrm':sugarcrm[_0x1ea169](_0x3193f7,_0x302af7,_0x4e9d51,_0x4811b3,_0x5ba2f6,_0x1bb194,_0x3a7b5a);break;case'freshdesk':freshdesk[_0x1ea169](_0x3193f7,_0x302af7,_0x4e9d51,_0x4811b3,_0x5ba2f6,_0x1bb194,_0x3a7b5a);break;case _0xfa6f('0x8'):zoho[_0x1ea169](_0x3193f7,_0x302af7,_0x4e9d51,_0x4811b3,_0x5ba2f6,_0x1bb194,_0x3a7b5a);break;case _0xfa6f('0x9'):desk[_0x1ea169](_0x3193f7,_0x302af7,_0x4e9d51,_0x4811b3,_0x5ba2f6,_0x1bb194,_0x3a7b5a);break;case'vtiger':vtiger[_0x1ea169](_0x3193f7,_0x302af7,_0x4e9d51,_0x4811b3,_0x5ba2f6,_0x1bb194,_0x3a7b5a);break;case'freshsales':freshsales['cs'](_0x3193f7,_0x302af7,_0x4e9d51,_0x4811b3,_0x5ba2f6,_0x1bb194,_0x3a7b5a,_0x1ea169);break;case _0xfa6f('0xd'):servicenow['cs'](_0x3193f7,_0x302af7,_0x4e9d51,_0x4811b3,_0x5ba2f6,_0x1bb194,_0x3a7b5a,_0x1ea169);break;case _0xfa6f('0xb'):dynamics365['cs'](_0x3193f7,_0x302af7,_0x4e9d51,_0x4811b3,_0x5ba2f6,_0x1bb194,_0x3a7b5a,_0x1ea169);break;default:console[_0xfa6f('0x1b')](_0xfa6f('0x1c'));}}else{_0x4c98a0=require(_0xfa6f('0x1d'))(_0x3193f7[_0xfa6f('0xe')][_0xfa6f('0xf')]());_0x4c98a0['error']('[EXEC]',util[_0xfa6f('0x1e')]('%s\x20configuration\x20#%s\x20not\x20found',_0x3193f7[_0xfa6f('0xe')][_0xfa6f('0xf')](),_0x3193f7[_0xfa6f('0x13')]));}}else{_0x4c98a0=require(_0xfa6f('0x1d'))(_0x3193f7['data1'][_0xfa6f('0xf')]());_0x4c98a0[_0xfa6f('0x1f')](_0xfa6f('0x20'),util[_0xfa6f('0x1e')]('%s\x20account\x20#%s\x20not\x20found',_0x3193f7[_0xfa6f('0xe')][_0xfa6f('0xf')](),_0x3193f7['data2']));}}else{}}catch(_0x4fb5e3){console['error'](_0x4fb5e3);}}}}; \ 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 46b0ddf..362c64a 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 _0x5cb4=['getString','Subjects','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','length','find','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','LastName','','No\x20Company','upperFirst','forEach','string','picklist','idField','variable','variableName','toString','customVariable','Variable','name','password','concat','securityToken','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','recordingFormat','[OUTBOUND]','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','calleridname','Fields',']\x20Integration\x20account\x20type\x20%s.','lastevent','lodash','request-promise','bluebird','jsforce','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit'];(function(_0x509880,_0x462c05){var _0x243e82=function(_0x4d88a8){while(--_0x4d88a8){_0x509880['push'](_0x509880['shift']());}};_0x243e82(++_0x462c05);}(_0x5cb4,0x1e4));var _0x45cb=function(_0xc31583,_0x34136d){_0xc31583=_0xc31583-0x0;var _0x1fb182=_0x5cb4[_0xc31583];return _0x1fb182;};'use strict';var _=require(_0x45cb('0x0'));var rp=require(_0x45cb('0x1'));var moment=require('moment');var BPromise=require(_0x45cb('0x2'));var md5=require('md5');var jsforce=require(_0x45cb('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x45cb('0x4'));var config=require(_0x45cb('0x5'));var logger=require(_0x45cb('0x6'))(_0x45cb('0x7'));config[_0x45cb('0x8')]=_['defaults'](config[_0x45cb('0x8')],{'host':_0x45cb('0x9'),'port':0x18eb});var io=require(_0x45cb('0xa'))(new Redis(config[_0x45cb('0x8')]));function emit(_0xc7dcee,_0x546755,_0x36335b){io['to'](_0xc7dcee)[_0x45cb('0xb')](_0x546755,_0x36335b);}function getTicket(_0x3505b3,_0x532766,_0x1d383d,_0x240f15,_0x2ebf28,_0x4730cd,_0x5a2960,_0x3857d7){var _0x22deb7=Object['assign']({},{'OwnerId':_0x532766['id'],'Subject':intUtil[_0x45cb('0xc')](_0x240f15[_0x45cb('0xd')],_0x2ebf28,'\x20'),'Description':intUtil[_0x45cb('0xc')](_0x240f15[_0x45cb('0xe')],_0x2ebf28,'\x0a')},getCustomFields(_0x4730cd,_0x2ebf28));if(_0x1d383d){if(_0x240f15[_0x45cb('0xf')]===_0x45cb('0x10')){_0x22deb7['ActivityDate']=moment[_0x45cb('0x11')]();_0x22deb7[_0x45cb('0x12')]=![];_0x22deb7[_0x45cb('0x13')]=![];if(_0x1d383d[_0x45cb('0x14')]===_0x45cb('0x15')||_0x1d383d[_0x45cb('0x14')]===_0x45cb('0x16')){_0x22deb7[_0x45cb('0x17')]=_0x1d383d['id'];}else if(_0x1d383d[_0x45cb('0x14')]===_0x45cb('0x18')){_0x22deb7[_0x45cb('0x19')]=_0x1d383d['id'];}}else if(_0x240f15[_0x45cb('0xf')]===_0x45cb('0x1a')){if(_0x1d383d[_0x45cb('0x14')]==='contact'){_0x22deb7[_0x45cb('0x1b')]=_0x1d383d['id'];}else if(_0x1d383d[_0x45cb('0x14')]==='account'){_0x22deb7['AccountId']=_0x1d383d['id'];}else if(_0x1d383d['endUserType']==='lead'&&_0x240f15[_0x45cb('0x1c')]){_0x22deb7[_0x240f15[_0x45cb('0x1c')]]=_0x1d383d['id'];}else{logger[_0x45cb('0x1d')](_0x45cb('0x1e'));}}}return _0x5a2960[_0x45cb('0x1f')](_0x240f15[_0x45cb('0xf')])[_0x45cb('0x20')](_0x22deb7);}function getUser(_0x5dc71b,_0xc3a955,_0x29a9f4){if(!_[_0x45cb('0x21')](_0xc3a955)&&intUtil[_0x45cb('0x22')](_0xc3a955)){var _0x2946a9={'Email':_0xc3a955};var _0x220949={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x29a9f4[_0x45cb('0x1f')](_0x45cb('0x23'))['find'](_0x2946a9,_0x220949)[_0x45cb('0x24')]()[_0x45cb('0x25')](function(_0x13c277){if(_0x13c277[_0x45cb('0x26')]){var _0x18c8c4=_[_0x45cb('0x27')](_0x13c277,function(_0x5b1ddf){return _0x5b1ddf[_0x45cb('0x28')]===_0xc3a955;});if(_0x18c8c4){logger[_0x45cb('0x1d')](_0x45cb('0x29'),_0xc3a955);return BPromise[_0x45cb('0x2a')]({'id':_0x18c8c4['Id'],'name':_0x18c8c4['Name']});}}else{logger[_0x45cb('0x1d')](_0x45cb('0x2b'),_0xc3a955);return _0x29a9f4['identity']()[_0x45cb('0x25')](function(_0x3360a1){return BPromise[_0x45cb('0x2a')]({'id':_0x3360a1[_0x45cb('0x2c')],'name':_0x3360a1[_0x45cb('0x2d')]});});}});}else{logger[_0x45cb('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xc3a955);return _0x29a9f4['identity']()['then'](function(_0x2a1c47){return BPromise[_0x45cb('0x2a')]({'id':_0x2a1c47[_0x45cb('0x2c')],'name':_0x2a1c47[_0x45cb('0x2d')]});});}}function getEndUser(_0x17b69b,_0x3deaeb,_0x109a24,_0x4c486f,_0x138b00){var _0x2e6bc7={'$or':{'Phone':_0x4c486f}};var _0x494e9d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x45cb('0x2a')]()[_0x45cb('0x25')](function(){logger[_0x45cb('0x1d')](_0x45cb('0x2e'),_0x4c486f,_0x3deaeb[_0x45cb('0x2f')]);switch(_0x3deaeb['moduleSearch']){case'contact_lead':var _0x5891cd=_[_0x45cb('0x30')](_0x2e6bc7);if(_0x3deaeb[_0x45cb('0x31')]){var _0x2dc1ab={};_0x2dc1ab[_0x3deaeb['additionalSearchContact']]=_0x4c486f;_[_0x45cb('0x32')](_0x5891cd[_0x45cb('0x33')],_0x2dc1ab);}return _0x138b00[_0x45cb('0x1f')](_0x45cb('0x34'))[_0x45cb('0x27')](_0x5891cd,_0x494e9d)[_0x45cb('0x24')]()[_0x45cb('0x25')](function(_0x4d31c3){if(_0x4d31c3&&_0x4d31c3[_0x45cb('0x26')]){return _0x4d31c3;}else{var _0x1c1672=_[_0x45cb('0x30')](_0x2e6bc7);if(_0x3deaeb[_0x45cb('0x35')]){var _0x1d75f9={};_0x1d75f9[_0x3deaeb[_0x45cb('0x35')]]=_0x4c486f;_[_0x45cb('0x32')](_0x1c1672[_0x45cb('0x33')],_0x1d75f9);}return _0x138b00[_0x45cb('0x1f')](_0x45cb('0x36'))[_0x45cb('0x27')](_0x1c1672,_0x494e9d);}});case _0x45cb('0x37'):var _0xbc072f=_[_0x45cb('0x30')](_0x2e6bc7);if(_0x3deaeb[_0x45cb('0x38')]){var _0x2dc1ab={};_0x2dc1ab[_0x3deaeb[_0x45cb('0x38')]]=_0x4c486f;_['merge'](_0xbc072f[_0x45cb('0x33')],_0x2dc1ab);}return _0x138b00[_0x45cb('0x1f')](_0x45cb('0x39'))[_0x45cb('0x27')](_0xbc072f,_0x494e9d)[_0x45cb('0x24')]()[_0x45cb('0x25')](function(_0x40982b){if(_0x40982b&&_0x40982b['length']){return _0x40982b;}else{var _0x53db98=_['cloneDeep'](_0x2e6bc7);if(_0x3deaeb['additionalSearchContact']){var _0x111926={};_0x111926[_0x3deaeb[_0x45cb('0x31')]]=_0x4c486f;_[_0x45cb('0x32')](_0x53db98[_0x45cb('0x33')],_0x111926);}return _0x138b00[_0x45cb('0x1f')](_0x45cb('0x34'))[_0x45cb('0x27')](_0x53db98,_0x494e9d)[_0x45cb('0x25')](function(_0x1e8418){if(_0x1e8418&&_0x1e8418[_0x45cb('0x26')]){return _0x1e8418;}else{var _0x74afef=_[_0x45cb('0x30')](_0x2e6bc7);if(_0x3deaeb['additionalSearchLead']){var _0x531201={};_0x531201[_0x3deaeb[_0x45cb('0x35')]]=_0x4c486f;_['merge'](_0x74afef['$or'],_0x531201);}return _0x138b00['sobject'](_0x45cb('0x36'))['find'](_0x74afef,_0x494e9d);}});}});case _0x45cb('0x15'):var _0x5891cd=_['cloneDeep'](_0x2e6bc7);if(_0x3deaeb[_0x45cb('0x31')]){var _0x2dc1ab={};_0x2dc1ab[_0x3deaeb[_0x45cb('0x31')]]=_0x4c486f;_[_0x45cb('0x32')](_0x5891cd[_0x45cb('0x33')],_0x2dc1ab);}return _0x138b00['sobject'](_0x45cb('0x34'))['find'](_0x5891cd,_0x494e9d)[_0x45cb('0x24')]();case _0x45cb('0x16'):var _0x4250e0=_['cloneDeep'](_0x2e6bc7);if(_0x3deaeb[_0x45cb('0x35')]){var _0x2dc1ab={};_0x2dc1ab[_0x3deaeb['additionalSearchLead']]=_0x4c486f;_[_0x45cb('0x32')](_0x4250e0[_0x45cb('0x33')],_0x2dc1ab);}return _0x138b00[_0x45cb('0x1f')](_0x45cb('0x36'))[_0x45cb('0x27')](_0x4250e0,_0x494e9d);case _0x45cb('0x18'):var _0xbc072f=_['cloneDeep'](_0x2e6bc7);if(_0x3deaeb['additionalSearchAccount']){var _0x2dc1ab={};_0x2dc1ab[_0x3deaeb['additionalSearchAccount']]=_0x4c486f;_[_0x45cb('0x32')](_0xbc072f[_0x45cb('0x33')],_0x2dc1ab);}return _0x138b00[_0x45cb('0x1f')](_0x45cb('0x39'))[_0x45cb('0x27')](_0xbc072f,_0x494e9d);default:return null;}})[_0x45cb('0x25')](function(_0x332a46){if(_0x332a46&&_0x332a46[_0x45cb('0x26')]){var _0x25109f=_[_0x45cb('0x3a')](_0x332a46);if(_0x25109f){return BPromise[_0x45cb('0x2a')]({'id':_0x25109f['Id'],'name':_0x25109f[_0x45cb('0x3b')],'phone':_0x25109f['Phone'],'endUserType':_0x25109f[_0x45cb('0x3c')][_0x45cb('0x3d')][_0x45cb('0x3e')]()});}}})[_0x45cb('0x25')](function(_0x372b7f){if(_0x372b7f){logger[_0x45cb('0x1d')](_0x45cb('0x3f'),_0x372b7f[_0x45cb('0x14')],_0x4c486f);return BPromise['resolve'](_0x372b7f);}else{logger[_0x45cb('0x1d')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x4c486f);var _0x5996e1={'Phone':_0x4c486f};if(_0x3deaeb[_0x45cb('0x40')]){if(_0x3deaeb[_0x45cb('0x40')]===_0x45cb('0x15')){logger[_0x45cb('0x1d')](_0x45cb('0x41'),_0x4c486f,_0x3deaeb[_0x45cb('0x40')]);_0x5996e1['LastName']=_0x109a24!==''?_0x109a24:util[_0x45cb('0x42')](_0x45cb('0x43'),_0x4c486f);}else if(_0x3deaeb[_0x45cb('0x40')]===_0x45cb('0x16')){logger['info'](_0x45cb('0x41'),_0x4c486f,_0x3deaeb[_0x45cb('0x40')]);_0x5996e1[_0x45cb('0x44')]=_0x109a24!==_0x45cb('0x45')?_0x109a24:util[_0x45cb('0x42')]('Caller\x20-\x20%s',_0x4c486f);_0x5996e1['Company']=_0x45cb('0x46');}else if(_0x3deaeb[_0x45cb('0x40')]==='account'){logger[_0x45cb('0x1d')](_0x45cb('0x41'),_0x4c486f,_0x3deaeb[_0x45cb('0x40')]);_0x5996e1['Name']=_0x109a24!==''?_0x109a24:util[_0x45cb('0x42')](_0x45cb('0x43'),_0x4c486f);}else{return null;}}return _0x138b00[_0x45cb('0x1f')](_[_0x45cb('0x47')](_0x3deaeb[_0x45cb('0x40')]))[_0x45cb('0x20')](_0x5996e1)[_0x45cb('0x25')](function(_0x6fde61){return BPromise[_0x45cb('0x2a')]({'id':_0x6fde61['id'],'endUserType':_0x3deaeb[_0x45cb('0x40')]});});}});}function getCustomFields(_0x2dc664,_0x34626d){var _0x55a86e={};if(_0x2dc664[_0x45cb('0x26')]>0x0){_[_0x45cb('0x48')](_0x2dc664,function(_0x943a2e){if(_['includes']([_0x45cb('0x49'),_0x45cb('0x4a')],_0x943a2e[_0x45cb('0x3d')])&&_0x943a2e[_0x45cb('0x4b')]){_0x55a86e[_0x943a2e[_0x45cb('0x4b')]]=_0x943a2e['content']['toString']();}else if(_0x943a2e[_0x45cb('0x3d')]===_0x45cb('0x4c')&&_0x943a2e['variableName']&&_0x943a2e[_0x45cb('0x4b')]){_0x34626d[_0x943a2e['variableName']]&&(_0x55a86e[_0x943a2e[_0x45cb('0x4b')]]=_0x34626d[_0x943a2e[_0x45cb('0x4d')]][_0x45cb('0x4e')]());}else if(_0x943a2e['type']===_0x45cb('0x4f')&&_0x943a2e[_0x45cb('0x50')]&&_0x943a2e['Variable'][_0x45cb('0x51')]&&_0x943a2e[_0x45cb('0x4b')]){_0x34626d[_0x943a2e[_0x45cb('0x50')][_0x45cb('0x51')][_0x45cb('0x3e')]()]&&(_0x55a86e[_0x943a2e[_0x45cb('0x4b')]]=_0x34626d[_0x943a2e[_0x45cb('0x50')][_0x45cb('0x51')][_0x45cb('0x3e')]()][_0x45cb('0x4e')]());}});}return _0x55a86e;}function getConnection(_0x297988){var _0x4fd745=_0x297988[_0x45cb('0x52')][_0x45cb('0x53')](_0x297988[_0x45cb('0x54')]);var _0x500af3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x297988['remoteUri']||'https://login.salesforce.com','clientId':_0x297988[_0x45cb('0x55')],'clientSecret':_0x297988[_0x45cb('0x56')]}});return _0x500af3[_0x45cb('0x57')](_0x297988[_0x45cb('0x58')],_0x4fd745)['then'](function(){logger[_0x45cb('0x1d')](_0x45cb('0x59'));return _0x500af3;});}exports[_0x45cb('0x5a')]=function(_0x37af64,_0x2db2ad,_0xbc3fb3,_0x1f2f37,_0x2d9b36,_0x683dd){var _0x5ba8c0,_0x13cf2b,_0x51d379,_0x1311d2;_0x683dd[_0x45cb('0x5b')]=intUtil[_0x45cb('0x5c')](_0x683dd[_0x45cb('0x5b')]);_0x683dd[_0x45cb('0x5d')]=intUtil[_0x45cb('0x5c')](_0x683dd[_0x45cb('0x5d')]);if(_0x2d9b36&&_0x2d9b36[_0x45cb('0x5e')]){logger['info'](_0x45cb('0x5f'),_0x45cb('0x60'));_0x2db2ad[_0x45cb('0x61')]=util[_0x45cb('0x42')](_0x45cb('0x62'),_0x683dd['serverUrl'],_0x2db2ad[_0x45cb('0x63')],md5(_0x2db2ad['uniqueid']));}else{_0x2db2ad['recordingURL']='';}return getConnection(_0x683dd)[_0x45cb('0x25')](function(_0x4b4c92){_0x1311d2=_0x4b4c92;return getUser(_0x683dd,_0x1f2f37[_0x45cb('0x64')],_0x1311d2);})[_0x45cb('0x25')](function(_0x4e9e12){_0x5ba8c0=_0x4e9e12;return getEndUser(_0x683dd,_0xbc3fb3,_0x2db2ad['calleridname'],_0x2db2ad[_0x45cb('0x65')],_0x1311d2);})['then'](function(_0x45d5f3){_0x13cf2b=_0x45d5f3;return getTicket(_0x683dd,_0x5ba8c0,_0x13cf2b,_0xbc3fb3,_0x2db2ad,_0xbc3fb3['Fields'],_0x1311d2,_0x45cb('0x5a'));})[_0x45cb('0x25')](function(_0x52395c){_0x51d379=_0x52395c;logger[_0x45cb('0x1d')](_0x45cb('0x66'),_0x51d379['id']);logger[_0x45cb('0x1d')](_0x45cb('0x67'),_0x51d379['id'],_0x1f2f37[_0x45cb('0x51')],_0x683dd['type']);switch(_0x683dd['type']){case _0x45cb('0x68'):emit(util[_0x45cb('0x42')](_0x45cb('0x69'),_0x1f2f37[_0x45cb('0x51')]),'trigger:salesforce:display',{'recordId':_0x51d379['id']});break;case _0x45cb('0x6a'):emit(util[_0x45cb('0x42')](_0x45cb('0x69'),_0x1f2f37[_0x45cb('0x51')]),_0x45cb('0x6b'),{'uri':util[_0x45cb('0x42')](_0x45cb('0x6c'),_0x1311d2[_0x45cb('0x6d')],_0x51d379['id'])});break;default:logger[_0x45cb('0x6e')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x45cb('0x6f')](function(_0x3ddf54){logger[_0x45cb('0x6e')](_0x45cb('0x5f'),_0x3ddf54);});};exports['outbound']=function(_0x3f4d9e,_0x5abb83,_0x5c202d,_0x42fdb3,_0x3e512f,_0x1aebf3,_0x4ea3c4){var _0x193191,_0x420c1a,_0x2d2b4c,_0x22d26e;_0x1aebf3[_0x45cb('0x5b')]=intUtil['stripTrailingSlash'](_0x1aebf3['serverUrl']);_0x1aebf3['remoteUri']=intUtil['stripTrailingSlash'](_0x1aebf3[_0x45cb('0x5d')]);if(_0x4ea3c4&&_0x4ea3c4[_0x45cb('0x70')]&&_0x4ea3c4[_0x45cb('0x70')]!=='none'){logger['info'](_0x45cb('0x71'),'Recording\x20is\x20enabled!');_0x5abb83[_0x45cb('0x61')]=util[_0x45cb('0x42')](_0x45cb('0x62'),_0x1aebf3[_0x45cb('0x5b')],_0x5abb83[_0x45cb('0x63')],md5(_0x5abb83[_0x45cb('0x63')]));}return getConnection(_0x1aebf3)[_0x45cb('0x25')](function(_0x553fc9){_0x22d26e=_0x553fc9;return getUser(_0x1aebf3,_0x42fdb3[_0x45cb('0x64')],_0x22d26e);})[_0x45cb('0x25')](function(_0x10a13c){_0x193191=_0x10a13c;return getEndUser(_0x1aebf3,_0x5c202d,_0x5abb83[_0x45cb('0x72')],_0x5abb83['destcalleridnum'],_0x22d26e);})[_0x45cb('0x25')](function(_0x174015){_0x420c1a=_0x174015;return getTicket(_0x1aebf3,_0x193191,_0x420c1a,_0x5c202d,_0x5abb83,_0x5c202d['Fields'],_0x22d26e,_0x45cb('0x73'));})[_0x45cb('0x25')](function(_0x274574){_0x2d2b4c=_0x274574;logger[_0x45cb('0x1d')](_0x45cb('0x74'),_0x2d2b4c['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2d2b4c['id'],_0x42fdb3['name'],_0x1aebf3[_0x45cb('0x3d')]);switch(_0x1aebf3[_0x45cb('0x3d')]){case _0x45cb('0x68'):emit(util[_0x45cb('0x42')]('user:%s',_0x42fdb3['name']),'trigger:salesforce:display',{'recordId':_0x2d2b4c['id']});break;case'newTab':emit(util['format'](_0x45cb('0x69'),_0x42fdb3[_0x45cb('0x51')]),_0x45cb('0x6b'),{'uri':util[_0x45cb('0x42')](_0x45cb('0x6c'),_0x22d26e[_0x45cb('0x6d')],_0x2d2b4c['id'])});break;default:logger['error'](_0x45cb('0x71'),_0x45cb('0x75'));}})['catch'](function(_0x11d6b5){logger[_0x45cb('0x6e')](_0x45cb('0x71'),_0x11d6b5);});};exports[_0x45cb('0x76')]=function(_0x1ab765,_0x5816df,_0x4a22f9,_0x4ca138,_0x28ac6a,_0x5dddec){var _0x14460c,_0x63ea55,_0x1d0e11,_0x12ec27;_0x5dddec[_0x45cb('0x5b')]=intUtil[_0x45cb('0x5c')](_0x5dddec[_0x45cb('0x5b')]);_0x5dddec[_0x45cb('0x5d')]=intUtil['stripTrailingSlash'](_0x5dddec[_0x45cb('0x5d')]);if(_0x28ac6a&&_0x28ac6a[_0x45cb('0x5e')]){logger[_0x45cb('0x1d')]('['+_0x5816df['lastevent'][_0x45cb('0x77')]()+']','Recording\x20is\x20enabled!');_0x5816df[_0x45cb('0x61')]=util['format'](_0x45cb('0x62'),_0x5dddec['serverUrl'],_0x5816df[_0x45cb('0x63')],md5(_0x5816df[_0x45cb('0x63')]));}else{_0x5816df[_0x45cb('0x61')]='';}return getConnection(_0x5dddec)[_0x45cb('0x25')](function(_0x20bacd){_0x12ec27=_0x20bacd;if(!_['isNil'](_0x4ca138)){return getUser(_0x5dddec,_0x4ca138[_0x45cb('0x51')],_0x12ec27);}else{return getUser(_0x5dddec,null,_0x12ec27);}})[_0x45cb('0x25')](function(_0x139e95){_0x14460c=_0x139e95;return getEndUser(_0x5dddec,_0x4a22f9,_0x5816df[_0x45cb('0x78')],_0x5816df[_0x45cb('0x65')],_0x12ec27);})[_0x45cb('0x25')](function(_0x4cf0a4){_0x63ea55=_0x4cf0a4;return getTicket(_0x5dddec,_0x14460c,_0x63ea55,_0x4a22f9,_0x5816df,_0x4a22f9[_0x45cb('0x79')],_0x12ec27);})[_0x45cb('0x25')](function(_0x366bad){_0x1d0e11=_0x366bad;logger['info']('['+_0x5816df['lastevent'][_0x45cb('0x77')]()+']\x20Ticket\x20%s\x20created.',_0x1d0e11['id']);logger[_0x45cb('0x1d')]('['+_0x5816df['lastevent']['toUpperCase']()+_0x45cb('0x7a'),_0x5dddec[_0x45cb('0x3d')]);})['catch'](function(_0x8c343b){logger[_0x45cb('0x6e')]('['+_0x5816df[_0x45cb('0x7b')][_0x45cb('0x77')]()+']',_0x8c343b);});}; \ No newline at end of file +var _0x343c=['localhost','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','account','Case','ContactId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','additionalSearchAccount','Lead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','forEach','includes','string','picklist','idField','content','variable','variableName','customVariable','name','Variable','toString','password','concat','securityToken','remoteUri','clientId','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','instanceUrl','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x343c,0xf0));var _0xc343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x343c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var rp=require(_0xc343('0x0'));var moment=require('moment');var BPromise=require(_0xc343('0x1'));var md5=require(_0xc343('0x2'));var jsforce=require(_0xc343('0x3'));var util=require(_0xc343('0x4'));var Redis=require(_0xc343('0x5'));var intUtil=require(_0xc343('0x6'));var config=require(_0xc343('0x7'));var logger=require(_0xc343('0x8'))('salesforce');config[_0xc343('0x9')]=_['defaults'](config[_0xc343('0x9')],{'host':_0xc343('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc343('0x9')]));function emit(_0x3b1a1e,_0x8a2df1,_0x4843f3){io['to'](_0x3b1a1e)['emit'](_0x8a2df1,_0x4843f3);}function getTicket(_0x1e081d,_0x45baa4,_0x631d9e,_0x37597c,_0x40d402,_0x10173a,_0x4bdf5e,_0xc3fb20){var _0x233d21=Object[_0xc343('0xb')]({},{'OwnerId':_0x45baa4['id'],'Subject':intUtil[_0xc343('0xc')](_0x37597c[_0xc343('0xd')],_0x40d402,'\x20'),'Description':intUtil[_0xc343('0xc')](_0x37597c[_0xc343('0xe')],_0x40d402,'\x0a')},getCustomFields(_0x10173a,_0x40d402));if(_0x631d9e){if(_0x37597c[_0xc343('0xf')]===_0xc343('0x10')){_0x233d21[_0xc343('0x11')]=moment[_0xc343('0x12')]();_0x233d21[_0xc343('0x13')]=![];_0x233d21[_0xc343('0x14')]=![];if(_0x631d9e[_0xc343('0x15')]===_0xc343('0x16')||_0x631d9e['endUserType']==='lead'){_0x233d21['WhoId']=_0x631d9e['id'];}else if(_0x631d9e[_0xc343('0x15')]===_0xc343('0x17')){_0x233d21['WhatId']=_0x631d9e['id'];}}else if(_0x37597c[_0xc343('0xf')]===_0xc343('0x18')){if(_0x631d9e[_0xc343('0x15')]===_0xc343('0x16')){_0x233d21[_0xc343('0x19')]=_0x631d9e['id'];}else if(_0x631d9e[_0xc343('0x15')]===_0xc343('0x17')){_0x233d21['AccountId']=_0x631d9e['id'];}else if(_0x631d9e['endUserType']===_0xc343('0x1a')&&_0x37597c[_0xc343('0x1b')]){_0x233d21[_0x37597c['leadId']]=_0x631d9e['id'];}else{logger[_0xc343('0x1c')](_0xc343('0x1d'));}}}return _0x4bdf5e[_0xc343('0x1e')](_0x37597c[_0xc343('0xf')])[_0xc343('0x1f')](_0x233d21);}function getUser(_0x50479a,_0x17a4ee,_0x12e82d){if(!_[_0xc343('0x20')](_0x17a4ee)&&intUtil[_0xc343('0x21')](_0x17a4ee)){var _0x2d13ac={'Email':_0x17a4ee};var _0x10761c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x12e82d[_0xc343('0x1e')]('User')[_0xc343('0x22')](_0x2d13ac,_0x10761c)['execute']()[_0xc343('0x23')](function(_0x538568){if(_0x538568[_0xc343('0x24')]){var _0x1d8488=_[_0xc343('0x22')](_0x538568,function(_0x1a1cfc){return _0x1a1cfc[_0xc343('0x25')]===_0x17a4ee;});if(_0x1d8488){logger[_0xc343('0x1c')](_0xc343('0x26'),_0x17a4ee);return BPromise[_0xc343('0x27')]({'id':_0x1d8488['Id'],'name':_0x1d8488[_0xc343('0x28')]});}}else{logger[_0xc343('0x1c')](_0xc343('0x29'),_0x17a4ee);return _0x12e82d['identity']()['then'](function(_0xdf1501){return BPromise[_0xc343('0x27')]({'id':_0xdf1501['user_id'],'name':_0xdf1501[_0xc343('0x2a')]});});}});}else{logger[_0xc343('0x1c')](_0xc343('0x29'),_0x17a4ee);return _0x12e82d[_0xc343('0x2b')]()[_0xc343('0x23')](function(_0x1e5549){return BPromise[_0xc343('0x27')]({'id':_0x1e5549['user_id'],'name':_0x1e5549[_0xc343('0x2a')]});});}}function getEndUser(_0x5e94f4,_0x4fb103,_0x24d933,_0x313207,_0x258838){var _0x3987f9={'$or':{'Phone':_0x313207}};var _0xe0989c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xc343('0x23')](function(){logger[_0xc343('0x1c')](_0xc343('0x2c'),_0x313207,_0x4fb103[_0xc343('0x2d')]);switch(_0x4fb103[_0xc343('0x2d')]){case _0xc343('0x2e'):var _0x2d15be=_[_0xc343('0x2f')](_0x3987f9);if(_0x4fb103[_0xc343('0x30')]){var _0x29bf68={};_0x29bf68[_0x4fb103[_0xc343('0x30')]]=_0x313207;_[_0xc343('0x31')](_0x2d15be[_0xc343('0x32')],_0x29bf68);}return _0x258838['sobject'](_0xc343('0x33'))[_0xc343('0x22')](_0x2d15be,_0xe0989c)[_0xc343('0x34')]()[_0xc343('0x23')](function(_0x5842fa){if(_0x5842fa&&_0x5842fa[_0xc343('0x24')]){return _0x5842fa;}else{var _0xaaf7b6=_[_0xc343('0x2f')](_0x3987f9);if(_0x4fb103[_0xc343('0x35')]){var _0x14848c={};_0x14848c[_0x4fb103[_0xc343('0x35')]]=_0x313207;_[_0xc343('0x31')](_0xaaf7b6[_0xc343('0x32')],_0x14848c);}return _0x258838[_0xc343('0x1e')]('Lead')[_0xc343('0x22')](_0xaaf7b6,_0xe0989c);}});case'account_contact_lead':var _0x3e481f=_[_0xc343('0x2f')](_0x3987f9);if(_0x4fb103[_0xc343('0x36')]){var _0x29bf68={};_0x29bf68[_0x4fb103['additionalSearchAccount']]=_0x313207;_[_0xc343('0x31')](_0x3e481f['$or'],_0x29bf68);}return _0x258838[_0xc343('0x1e')]('Account')[_0xc343('0x22')](_0x3e481f,_0xe0989c)['execute']()[_0xc343('0x23')](function(_0x1cfeed){if(_0x1cfeed&&_0x1cfeed[_0xc343('0x24')]){return _0x1cfeed;}else{var _0x47bd98=_['cloneDeep'](_0x3987f9);if(_0x4fb103[_0xc343('0x30')]){var _0x33c379={};_0x33c379[_0x4fb103[_0xc343('0x30')]]=_0x313207;_[_0xc343('0x31')](_0x47bd98[_0xc343('0x32')],_0x33c379);}return _0x258838[_0xc343('0x1e')](_0xc343('0x33'))[_0xc343('0x22')](_0x47bd98,_0xe0989c)['then'](function(_0x2a7a87){if(_0x2a7a87&&_0x2a7a87['length']){return _0x2a7a87;}else{var _0x28bd08=_[_0xc343('0x2f')](_0x3987f9);if(_0x4fb103['additionalSearchLead']){var _0xcfb00e={};_0xcfb00e[_0x4fb103['additionalSearchLead']]=_0x313207;_['merge'](_0x28bd08[_0xc343('0x32')],_0xcfb00e);}return _0x258838[_0xc343('0x1e')]('Lead')['find'](_0x28bd08,_0xe0989c);}});}});case _0xc343('0x16'):var _0x2d15be=_[_0xc343('0x2f')](_0x3987f9);if(_0x4fb103[_0xc343('0x30')]){var _0x29bf68={};_0x29bf68[_0x4fb103['additionalSearchContact']]=_0x313207;_[_0xc343('0x31')](_0x2d15be[_0xc343('0x32')],_0x29bf68);}return _0x258838['sobject'](_0xc343('0x33'))['find'](_0x2d15be,_0xe0989c)[_0xc343('0x34')]();case'lead':var _0x3a36b3=_[_0xc343('0x2f')](_0x3987f9);if(_0x4fb103[_0xc343('0x35')]){var _0x29bf68={};_0x29bf68[_0x4fb103[_0xc343('0x35')]]=_0x313207;_[_0xc343('0x31')](_0x3a36b3[_0xc343('0x32')],_0x29bf68);}return _0x258838[_0xc343('0x1e')](_0xc343('0x37'))[_0xc343('0x22')](_0x3a36b3,_0xe0989c);case _0xc343('0x17'):var _0x3e481f=_[_0xc343('0x2f')](_0x3987f9);if(_0x4fb103[_0xc343('0x36')]){var _0x29bf68={};_0x29bf68[_0x4fb103[_0xc343('0x36')]]=_0x313207;_[_0xc343('0x31')](_0x3e481f[_0xc343('0x32')],_0x29bf68);}return _0x258838['sobject']('Account')['find'](_0x3e481f,_0xe0989c);default:return null;}})[_0xc343('0x23')](function(_0x571ae6){if(_0x571ae6&&_0x571ae6[_0xc343('0x24')]){var _0x4552ca=_[_0xc343('0x38')](_0x571ae6);if(_0x4552ca){return BPromise[_0xc343('0x27')]({'id':_0x4552ca['Id'],'name':_0x4552ca['Name'],'phone':_0x4552ca[_0xc343('0x39')],'endUserType':_0x4552ca[_0xc343('0x3a')][_0xc343('0x3b')][_0xc343('0x3c')]()});}}})[_0xc343('0x23')](function(_0x227486){if(_0x227486){logger[_0xc343('0x1c')](_0xc343('0x3d'),_0x227486[_0xc343('0x15')],_0x313207);return BPromise['resolve'](_0x227486);}else{logger[_0xc343('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x313207);var _0x292769={'Phone':_0x313207};if(_0x4fb103[_0xc343('0x3e')]){if(_0x4fb103[_0xc343('0x3e')]===_0xc343('0x16')){logger[_0xc343('0x1c')](_0xc343('0x3f'),_0x313207,_0x4fb103[_0xc343('0x3e')]);_0x292769[_0xc343('0x40')]=_0x24d933!==_0xc343('0x41')?_0x24d933:util[_0xc343('0x42')](_0xc343('0x43'),_0x313207);}else if(_0x4fb103['moduleCreate']===_0xc343('0x1a')){logger[_0xc343('0x1c')](_0xc343('0x3f'),_0x313207,_0x4fb103[_0xc343('0x3e')]);_0x292769[_0xc343('0x40')]=_0x24d933!==_0xc343('0x41')?_0x24d933:util[_0xc343('0x42')]('Caller\x20-\x20%s',_0x313207);_0x292769[_0xc343('0x44')]=_0xc343('0x45');}else if(_0x4fb103[_0xc343('0x3e')]===_0xc343('0x17')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x313207,_0x4fb103[_0xc343('0x3e')]);_0x292769[_0xc343('0x28')]=_0x24d933!==_0xc343('0x41')?_0x24d933:util[_0xc343('0x42')](_0xc343('0x43'),_0x313207);}else{return null;}}return _0x258838[_0xc343('0x1e')](_['upperFirst'](_0x4fb103[_0xc343('0x3e')]))[_0xc343('0x1f')](_0x292769)[_0xc343('0x23')](function(_0x17d248){return BPromise[_0xc343('0x27')]({'id':_0x17d248['id'],'endUserType':_0x4fb103['moduleCreate']});});}});}function getCustomFields(_0x38a047,_0x36ee2d){var _0x2faf8c={};if(_0x38a047['length']>0x0){_[_0xc343('0x46')](_0x38a047,function(_0x48dace){if(_[_0xc343('0x47')]([_0xc343('0x48'),_0xc343('0x49')],_0x48dace[_0xc343('0x3b')])&&_0x48dace[_0xc343('0x4a')]){_0x2faf8c[_0x48dace[_0xc343('0x4a')]]=_0x48dace[_0xc343('0x4b')]['toString']();}else if(_0x48dace[_0xc343('0x3b')]===_0xc343('0x4c')&&_0x48dace[_0xc343('0x4d')]&&_0x48dace[_0xc343('0x4a')]){_0x36ee2d[_0x48dace['variableName']]&&(_0x2faf8c[_0x48dace[_0xc343('0x4a')]]=_0x36ee2d[_0x48dace[_0xc343('0x4d')]]['toString']());}else if(_0x48dace['type']===_0xc343('0x4e')&&_0x48dace['Variable']&&_0x48dace['Variable'][_0xc343('0x4f')]&&_0x48dace['idField']){_0x36ee2d[_0x48dace[_0xc343('0x50')][_0xc343('0x4f')]['toLowerCase']()]&&(_0x2faf8c[_0x48dace[_0xc343('0x4a')]]=_0x36ee2d[_0x48dace[_0xc343('0x50')][_0xc343('0x4f')][_0xc343('0x3c')]()][_0xc343('0x51')]());}});}return _0x2faf8c;}function getConnection(_0x5dc0f6){var _0x1dfdb8=_0x5dc0f6[_0xc343('0x52')][_0xc343('0x53')](_0x5dc0f6[_0xc343('0x54')]);var _0x5229c0=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5dc0f6[_0xc343('0x55')]||'https://login.salesforce.com','clientId':_0x5dc0f6[_0xc343('0x56')],'clientSecret':_0x5dc0f6['clientSecret']}});return _0x5229c0['login'](_0x5dc0f6[_0xc343('0x57')],_0x1dfdb8)['then'](function(){logger[_0xc343('0x1c')](_0xc343('0x58'));return _0x5229c0;});}exports[_0xc343('0x59')]=function(_0x14ffbb,_0x6a1d8c,_0x3d513a,_0x2dd8fd,_0x4592bc,_0x2bf293){var _0x542f4a,_0x3e33ad,_0x21f253,_0x49651f;_0x2bf293[_0xc343('0x5a')]=intUtil[_0xc343('0x5b')](_0x2bf293['serverUrl']);_0x2bf293['remoteUri']=intUtil[_0xc343('0x5b')](_0x2bf293[_0xc343('0x55')]);if(_0x4592bc&&_0x4592bc[_0xc343('0x5c')]){logger['info'](_0xc343('0x5d'),_0xc343('0x5e'));_0x6a1d8c[_0xc343('0x5f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2bf293[_0xc343('0x5a')],_0x6a1d8c['uniqueid'],md5(_0x6a1d8c[_0xc343('0x60')]));}else{_0x6a1d8c[_0xc343('0x5f')]='';}return getConnection(_0x2bf293)[_0xc343('0x23')](function(_0x6a0020){_0x49651f=_0x6a0020;return getUser(_0x2bf293,_0x2dd8fd[_0xc343('0x61')],_0x49651f);})[_0xc343('0x23')](function(_0x2a060a){_0x542f4a=_0x2a060a;return getEndUser(_0x2bf293,_0x3d513a,_0x6a1d8c[_0xc343('0x62')],_0x6a1d8c[_0xc343('0x63')],_0x49651f);})['then'](function(_0x229a33){_0x3e33ad=_0x229a33;return getTicket(_0x2bf293,_0x542f4a,_0x3e33ad,_0x3d513a,_0x6a1d8c,_0x3d513a['Fields'],_0x49651f,_0xc343('0x59'));})[_0xc343('0x23')](function(_0x30259b){_0x21f253=_0x30259b;logger[_0xc343('0x1c')](_0xc343('0x64'),_0x21f253['id']);logger[_0xc343('0x1c')](_0xc343('0x65'),_0x21f253['id'],_0x2dd8fd[_0xc343('0x4f')],_0x2bf293[_0xc343('0x3b')]);switch(_0x2bf293[_0xc343('0x3b')]){case _0xc343('0x66'):emit(util['format'](_0xc343('0x67'),_0x2dd8fd[_0xc343('0x4f')]),_0xc343('0x68'),{'recordId':_0x21f253['id']});break;case'newTab':emit(util[_0xc343('0x42')](_0xc343('0x67'),_0x2dd8fd[_0xc343('0x4f')]),'trigger:browser:url',{'uri':util[_0xc343('0x42')](_0xc343('0x69'),_0x49651f['instanceUrl'],_0x21f253['id'])});break;default:logger[_0xc343('0x6a')](_0xc343('0x6b'));}})[_0xc343('0x6c')](function(_0x287a40){logger[_0xc343('0x6a')](_0xc343('0x5d'),_0x287a40);});};exports[_0xc343('0x6d')]=function(_0x5bf92a,_0x10d53a,_0xf54aa0,_0x4008f9,_0x8f2a00,_0xa07653,_0xfc7530){var _0x5091b9,_0x2ab72b,_0x47a761,_0x4008e5;_0xa07653[_0xc343('0x5a')]=intUtil[_0xc343('0x5b')](_0xa07653['serverUrl']);_0xa07653[_0xc343('0x55')]=intUtil[_0xc343('0x5b')](_0xa07653['remoteUri']);if(_0xfc7530&&_0xfc7530[_0xc343('0x6e')]&&_0xfc7530[_0xc343('0x6e')]!==_0xc343('0x6f')){logger['info'](_0xc343('0x70'),_0xc343('0x5e'));_0x10d53a[_0xc343('0x5f')]=util['format'](_0xc343('0x71'),_0xa07653[_0xc343('0x5a')],_0x10d53a[_0xc343('0x60')],md5(_0x10d53a[_0xc343('0x60')]));}return getConnection(_0xa07653)[_0xc343('0x23')](function(_0x2e0317){_0x4008e5=_0x2e0317;return getUser(_0xa07653,_0x4008f9[_0xc343('0x61')],_0x4008e5);})['then'](function(_0x61d381){_0x5091b9=_0x61d381;return getEndUser(_0xa07653,_0xf54aa0,_0x10d53a['destcalleridname'],_0x10d53a[_0xc343('0x72')],_0x4008e5);})[_0xc343('0x23')](function(_0x557829){_0x2ab72b=_0x557829;return getTicket(_0xa07653,_0x5091b9,_0x2ab72b,_0xf54aa0,_0x10d53a,_0xf54aa0[_0xc343('0x73')],_0x4008e5,_0xc343('0x6d'));})[_0xc343('0x23')](function(_0x494a0c){_0x47a761=_0x494a0c;logger[_0xc343('0x1c')](_0xc343('0x74'),_0x47a761['id']);logger[_0xc343('0x1c')](_0xc343('0x75'),_0x47a761['id'],_0x4008f9[_0xc343('0x4f')],_0xa07653[_0xc343('0x3b')]);switch(_0xa07653['type']){case _0xc343('0x66'):emit(util[_0xc343('0x42')](_0xc343('0x67'),_0x4008f9['name']),'trigger:salesforce:display',{'recordId':_0x47a761['id']});break;case _0xc343('0x76'):emit(util[_0xc343('0x42')](_0xc343('0x67'),_0x4008f9[_0xc343('0x4f')]),_0xc343('0x77'),{'uri':util['format'](_0xc343('0x69'),_0x4008e5[_0xc343('0x78')],_0x47a761['id'])});break;default:logger[_0xc343('0x6a')](_0xc343('0x70'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xc343('0x6c')](function(_0x3d4b25){logger['error'](_0xc343('0x70'),_0x3d4b25);});};exports['unmanaged']=function(_0x302cc2,_0x20d78d,_0x3e0d49,_0x27fe2e,_0x199aea,_0x4975a1){var _0x180ad0,_0x1837a0,_0x1781bd,_0x320859;_0x4975a1[_0xc343('0x5a')]=intUtil['stripTrailingSlash'](_0x4975a1['serverUrl']);_0x4975a1[_0xc343('0x55')]=intUtil['stripTrailingSlash'](_0x4975a1[_0xc343('0x55')]);if(_0x199aea&&_0x199aea[_0xc343('0x5c')]){logger[_0xc343('0x1c')]('['+_0x20d78d[_0xc343('0x79')][_0xc343('0x7a')]()+']',_0xc343('0x5e'));_0x20d78d[_0xc343('0x5f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4975a1[_0xc343('0x5a')],_0x20d78d[_0xc343('0x60')],md5(_0x20d78d[_0xc343('0x60')]));}else{_0x20d78d[_0xc343('0x5f')]='';}return getConnection(_0x4975a1)[_0xc343('0x23')](function(_0x365566){_0x320859=_0x365566;if(!_['isNil'](_0x27fe2e)){return getUser(_0x4975a1,_0x27fe2e[_0xc343('0x4f')],_0x320859);}else{return getUser(_0x4975a1,null,_0x320859);}})['then'](function(_0x7473a2){_0x180ad0=_0x7473a2;return getEndUser(_0x4975a1,_0x3e0d49,_0x20d78d['calleridname'],_0x20d78d['calleridnum'],_0x320859);})[_0xc343('0x23')](function(_0x521904){_0x1837a0=_0x521904;return getTicket(_0x4975a1,_0x180ad0,_0x1837a0,_0x3e0d49,_0x20d78d,_0x3e0d49[_0xc343('0x73')],_0x320859);})['then'](function(_0x3d5ecc){_0x1781bd=_0x3d5ecc;logger['info']('['+_0x20d78d[_0xc343('0x79')][_0xc343('0x7a')]()+_0xc343('0x7b'),_0x1781bd['id']);logger[_0xc343('0x1c')]('['+_0x20d78d[_0xc343('0x79')][_0xc343('0x7a')]()+_0xc343('0x7c'),_0x4975a1['type']);})['catch'](function(_0x52b11f){logger[_0xc343('0x6a')]('['+_0x20d78d[_0xc343('0x79')]['toUpperCase']()+']',_0x52b11f);});}; \ 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 164051d..13c06be 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 _0x8f64=[']\x20getTicket\x20crm','label','incident','Incident','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','serverUrl','remoteUri','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','toString','customVariable','Variable','name','outbound','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number'];(function(_0x18f1d4,_0x21034f){var _0x3b25de=function(_0x4fee7e){while(--_0x4fee7e){_0x18f1d4['push'](_0x18f1d4['shift']());}};_0x3b25de(++_0x21034f);}(_0x8f64,0x166));var _0x48f6=function(_0x27ae57,_0x46c968){_0x27ae57=_0x27ae57-0x0;var _0x55bed4=_0x8f64[_0x27ae57];return _0x55bed4;};'use strict';var _=require('lodash');var Promise=require(_0x48f6('0x0'));var rp=require(_0x48f6('0x1'));var util=require(_0x48f6('0x2'));var md5=require(_0x48f6('0x3'));var Redis=require('ioredis');var intUtil=require(_0x48f6('0x4'));var config=require(_0x48f6('0x5'));var logger=require(_0x48f6('0x6'))('servicenow');config[_0x48f6('0x7')]=_['defaults'](config[_0x48f6('0x7')],{'host':_0x48f6('0x8'),'port':0x18eb});var io=require(_0x48f6('0x9'))(new Redis(config[_0x48f6('0x7')]));function getAdminUser(_0x2de803,_0x462f4d,_0x52d86d,_0x165d96,_0x30fe6a,_0x13452d){return new Promise(function(_0x3b65d3,_0x3c6387){var _0x5e33dd={'method':_0x48f6('0xa'),'uri':_0x165d96+_0x48f6('0xb')+'&'+_0x30fe6a+'&'+_0x13452d,'auth':_0x462f4d,'json':!![]};return rp(_0x5e33dd)[_0x48f6('0xc')](function(_0xe18f0d){if(_0xe18f0d[_0x48f6('0xd')][_0x48f6('0xe')]>0x0){_0x52d86d[_0x48f6('0xf')]=_0xe18f0d['result'][0x0]['sys_id'];}logger[_0x48f6('0x10')]('['+[_0x2de803[_0x48f6('0x11')]()]+_0x48f6('0x12'),_0x52d86d);_0x3b65d3(_0x52d86d);})[_0x48f6('0x13')](function(_0x40a95c){logger[_0x48f6('0x14')]('['+[_0x2de803[_0x48f6('0x11')]()]+']',_0x40a95c[_0x48f6('0x15')]);_0x3c6387(_0x40a95c[_0x48f6('0x15')]);});});}function getUser(_0x428e50,_0x2dfed8,_0x3514aa,_0x468000,_0x2e02d1){return function(_0x4fcd31){logger[_0x48f6('0x10')]('['+[_0x428e50[_0x48f6('0x11')]()]+_0x48f6('0x16'),_0x4fcd31);return new Promise(function(_0x25e95c,_0x5b8cd0){if(intUtil[_0x48f6('0x17')](_0x4fcd31['userEmail'])){var _0x3f2e32={'method':_0x48f6('0xa'),'uri':_0x3514aa+_0x48f6('0x18')+_0x4fcd31[_0x48f6('0x19')]+'&'+_0x468000+'&'+_0x2e02d1,'auth':_0x2dfed8,'json':!![]};logger[_0x48f6('0x10')]('['+[_0x428e50['toUpperCase']()]+_0x48f6('0x1a'),_0x3f2e32);return rp(_0x3f2e32)['then'](function(_0x5db334){logger[_0x48f6('0x10')]('['+[_0x428e50['toUpperCase']()]+_0x48f6('0x1b'),_0x5db334);if(_0x5db334[_0x48f6('0xd')][_0x48f6('0xe')]>0x0&&String(_0x5db334[_0x48f6('0xd')][0x0][_0x48f6('0x1c')])===_0x48f6('0x1d')){_0x4fcd31[_0x48f6('0x1e')]=_0x5db334[_0x48f6('0xd')][0x0][_0x48f6('0x1f')];}else{_0x4fcd31[_0x48f6('0x1e')]=_0x4fcd31[_0x48f6('0xf')];_0x4fcd31[_0x48f6('0x19')]=_0x4fcd31[_0x48f6('0x20')];}logger[_0x48f6('0x10')]('['+[_0x428e50[_0x48f6('0x11')]()]+'],\x20getUser\x20crm',_0x4fcd31);_0x25e95c(_0x4fcd31);})[_0x48f6('0x13')](function(_0x520134){logger[_0x48f6('0x14')]('['+[_0x428e50['toUpperCase']()]+']',_0x520134[_0x48f6('0x15')]);_0x5b8cd0(_0x520134[_0x48f6('0x15')]);});}else{logger[_0x48f6('0x10')]('['+[_0x428e50[_0x48f6('0x11')]()]+_0x48f6('0x21'));_0x4fcd31['userId']=_0x4fcd31[_0x48f6('0xf')];_0x4fcd31[_0x48f6('0x19')]=_0x4fcd31[_0x48f6('0x20')];_0x25e95c(_0x4fcd31);}});};}function createEndUser(_0x3e232e,_0x123642,_0x36c275,_0x3684fd,_0xb54d18){logger['info']('['+[_0x3e232e[_0x48f6('0x11')]()]+_0x48f6('0x22'),_0x36c275);return new Promise(function(_0x161770,_0x45b8ce){var _0x468ca1={'method':_0x48f6('0x23'),'uri':_0x3684fd+_0x48f6('0x24')+_0xb54d18,'body':{'user_name':_0x36c275[_0x48f6('0x25')],'roles':_0x48f6('0x26'),'first_name':_0x36c275['endUserNumber'],'active':_0x48f6('0x1d'),'date_format':_0x48f6('0x27'),'phone':_0x36c275[_0x48f6('0x25')]},'auth':_0x123642,'json':!![]};return rp(_0x468ca1)[_0x48f6('0xc')](function(_0x1fafa2){logger[_0x48f6('0x10')]('['+[_0x3e232e['toUpperCase']()]+_0x48f6('0x28'),_0x1fafa2[_0x48f6('0xd')]);_0x36c275[_0x48f6('0x29')]=_0x1fafa2[_0x48f6('0xd')]['sys_id'];_0x161770(_0x36c275);})[_0x48f6('0x13')](function(_0x28a9be){logger['error']('['+[_0x3e232e['toUpperCase']()]+']',_0x28a9be[_0x48f6('0x15')]);_0x45b8ce(_0x28a9be[_0x48f6('0x15')]);});});}function getEndUser(_0xbf0fd0,_0xd97c25,_0x2aa3ec,_0x58e647,_0x4f2664){return function(_0x524748){logger[_0x48f6('0x10')]('['+[_0xbf0fd0[_0x48f6('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x524748);return new Promise(function(_0x2b6f7e,_0x16acc2){var _0x546881={'method':_0x48f6('0xa'),'uri':_0x2aa3ec+_0x48f6('0x2a')+_0x524748[_0x48f6('0x25')]+'&'+_0x58e647+'&'+_0x4f2664,'auth':_0xd97c25,'json':!![]};return rp(_0x546881)['then'](function(_0xe3ef95){if(_0xe3ef95[_0x48f6('0xd')]['length']>0x0){_0x524748['endUserId']=_0xe3ef95['result'][0x0]['sys_id'];logger[_0x48f6('0x10')]('['+[_0xbf0fd0[_0x48f6('0x11')]()]+_0x48f6('0x2b'),_0x524748);_0x2b6f7e(_0x524748);}else{return createEndUser(_0xbf0fd0,_0xd97c25,_0x524748,_0x2aa3ec,_0x58e647)['then'](function(_0x26f262){logger[_0x48f6('0x10')]('['+[_0xbf0fd0[_0x48f6('0x11')]()]+'],\x20createEndUser\x20crm',_0x26f262);_0x2b6f7e(_0x26f262);});}})[_0x48f6('0x13')](function(_0xd7ee1c){logger[_0x48f6('0x14')]('['+[_0xbf0fd0[_0x48f6('0x11')]()]+']',_0xd7ee1c['message']);_0x16acc2(_0xd7ee1c[_0x48f6('0x15')]);});});};}function getCustomFields(_0x2eec81,_0x36b74){var _0x45948c={};if(_0x2eec81[_0x48f6('0xe')]>0x0){_[_0x48f6('0x2c')](_0x2eec81,function(_0x337088){if(_[_0x48f6('0x2d')]([_0x48f6('0x2e'),_0x48f6('0x2f')],_0x337088[_0x48f6('0x30')])&&_0x337088[_0x48f6('0x31')]&&!_0x337088[_0x48f6('0x32')]){_0x45948c[_0x337088[_0x48f6('0x31')][_0x48f6('0x33')]()]=_0x337088[_0x48f6('0x34')]['toString']();}else if(_[_0x48f6('0x2d')]([_0x48f6('0x2e'),_0x48f6('0x2f')],_0x337088['type'])&&_0x337088[_0x48f6('0x35')]&&_0x337088[_0x48f6('0x32')]){_0x45948c[_0x337088[_0x48f6('0x35')]['toLowerCase']()]=_0x337088[_0x48f6('0x34')]['toString']();}else if(_0x337088[_0x48f6('0x30')]===_0x48f6('0x36')&&_0x337088[_0x48f6('0x37')]&&_0x337088[_0x48f6('0x35')]&&_0x337088[_0x48f6('0x32')]){_0x45948c[_0x337088[_0x48f6('0x35')][_0x48f6('0x33')]()]=_0x36b74[_0x337088[_0x48f6('0x37')]][_0x48f6('0x38')]();}else if(_0x337088[_0x48f6('0x30')]===_0x48f6('0x39')&&_0x337088[_0x48f6('0x3a')]&&_0x337088[_0x48f6('0x3a')][_0x48f6('0x3b')]&&_0x337088['idField']&&_0x337088[_0x48f6('0x32')]){_0x45948c[_0x337088[_0x48f6('0x35')][_0x48f6('0x33')]()]=_0x36b74[_0x337088[_0x48f6('0x3a')][_0x48f6('0x3b')]['toLowerCase']()][_0x48f6('0x38')]();}});}return _0x45948c;}function getTicket(_0x1ea67a,_0x221a74,_0x307dd6,_0x210702,_0x522516,_0x3c16b6){return function(_0x21973c){logger[_0x48f6('0x10')]('['+[_0x1ea67a['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x21973c);return new Promise(function(_0x3e10c0,_0x140d58){var _0x576bf6=_0x1ea67a[_0x48f6('0x33')]()===_0x48f6('0x3c')?_0x21973c[_0x48f6('0x1e')]:_0x21973c['endUserId'];var _0x51360d={'method':_0x48f6('0x23'),'uri':_0x307dd6+'incident'+'?'+_0x3c16b6,'body':Object[_0x48f6('0x3d')]({},{'active':'true','caller_id':_0x576bf6,'assigned_to':_0x21973c['userId'],'short_description':intUtil['getString'](_0x210702[_0x48f6('0x3e')],_0x522516,'\x20'),'description':intUtil[_0x48f6('0x3f')](_0x210702[_0x48f6('0x40')],_0x522516,'\x0a')},getCustomFields(_0x210702[_0x48f6('0x41')],_0x522516)),'auth':_0x221a74,'json':!![]};return rp(_0x51360d)['then'](function(_0x14fb66){logger[_0x48f6('0x10')]('['+[_0x1ea67a[_0x48f6('0x11')]()]+_0x48f6('0x42'),_0x14fb66['result']);_0x21973c[_0x48f6('0x43')]=_0x14fb66[_0x48f6('0xd')][_0x48f6('0x1f')];_0x21973c[_0x48f6('0x44')]=_0x14fb66[_0x48f6('0xd')][_0x48f6('0x45')];logger[_0x48f6('0x10')]('['+[_0x1ea67a[_0x48f6('0x11')]()]+_0x48f6('0x46'),_0x21973c);_0x3e10c0(_0x21973c);})[_0x48f6('0x13')](function(_0x108503){logger[_0x48f6('0x14')]('['+[_0x1ea67a[_0x48f6('0x11')]()]+']',_0x108503[_0x48f6('0x15')]);_0x140d58(_0x108503[_0x48f6('0x15')]);});});};}function createRemoteTag(_0x5ed34e,_0x3fbff1,_0xaed8f9,_0x2b1e35){return new Promise(function(_0x4f8144,_0x522bed){var _0x5d2e42={'method':_0x48f6('0x23'),'uri':_0xaed8f9+'label'+'?'+_0x2b1e35,'body':{'short_description':_0x5ed34e,'global':!![],'active':!![],'name':_0x5ed34e},'auth':_0x3fbff1,'json':!![]};return rp(_0x5d2e42)['then'](function(_0xecd587){var _0x79c180=_0xecd587[_0x48f6('0xd')][_0x48f6('0x1f')];_0x4f8144(_0x79c180);});});}function getRemoteTag(_0x5ef1d4,_0x439fa9,_0xa5e772,_0x1bc591,_0x480bb9){return new Promise(function(_0x450395,_0x16deb7){var _0x14eec8={'method':_0x48f6('0xa'),'uri':_0xa5e772+_0x48f6('0x47')+'?sysparm_query=name%3D'+_0x5ef1d4+'&'+_0x1bc591,'auth':_0x439fa9,'json':!![]};return rp(_0x14eec8)[_0x48f6('0xc')](function(_0x4e8ef9){if(_0x4e8ef9[_0x48f6('0xd')][_0x48f6('0xe')]>0x0){var _0x46e0ba=_0x4e8ef9[_0x48f6('0xd')][0x0][_0x48f6('0x1f')];_0x450395(_0x46e0ba);}else{return createRemoteTag(_0x5ef1d4,_0x439fa9,_0xa5e772,_0x1bc591)[_0x48f6('0xc')](function(_0x906b33){_0x450395(_0x906b33);});}});});}function assignTagToIncident(_0x1012da,_0x50d99a,_0x1ff169,_0x19e3fc,_0xa30ace){return new Promise(function(_0x69885a,_0x1bb9e0){var _0x2c06dc={'method':'POST','uri':_0x1ff169+'label_entry'+'?'+_0xa30ace,'body':{'label':_0x1012da,'table':_0x48f6('0x48'),'id_type':_0x48f6('0x49'),'table_key':_0x19e3fc['ticketId'],'title':'Incident\x20-\x20'+_0x19e3fc[_0x48f6('0x44')],'id_display':_0x19e3fc[_0x48f6('0x44')]},'auth':_0x50d99a,'json':!![]};return rp(_0x2c06dc)[_0x48f6('0xc')](function(_0x5e92b3){_0x69885a();})[_0x48f6('0x13')](function(){_0x69885a();});});}function manageTags(_0x15189c,_0x269aa5,_0x58c40a,_0x8bbf71,_0x30be3d,_0x449f05,_0x4d7c06){return new Promise(function(_0x2b540b,_0x3dea50){var _0x543c89=[];_0x269aa5[_0x48f6('0x2c')](function(_0x503abe){_0x543c89['push'](getRemoteTag(_0x503abe,_0x58c40a,_0x8bbf71,_0x449f05,_0x4d7c06));});return Promise[_0x48f6('0x4a')](_0x543c89)[_0x48f6('0xc')](function(_0x432553){if(_0x432553['length']){logger[_0x48f6('0x10')]('['+[_0x15189c[_0x48f6('0x11')]()]+_0x48f6('0x4b'),_0x432553);var _0x3492d9=[];_0x432553[_0x48f6('0x2c')](function(_0x49b18f){_0x3492d9['push'](assignTagToIncident(_0x49b18f,_0x58c40a,_0x8bbf71,_0x30be3d,_0x449f05));});return Promise[_0x48f6('0x4a')](_0x3492d9)[_0x48f6('0xc')](function(){_0x2b540b();})[_0x48f6('0x13')](function(){_0x2b540b();});}else{_0x2b540b();}});});}function getTags(_0x54b54c,_0x13490b,_0x1c37b5,_0x70a698,_0x1f6a4b,_0x107d75){return function(_0x29325b){return new Promise(function(_0x297ea3,_0x399b3c){var _0x1d08f4=[];var _0x524b29=_0x70a698['Tags'];if(_0x524b29&&_0x524b29[_0x48f6('0xe')]>0x0){_0x1d08f4=_[_0x48f6('0x4c')](_0x524b29,_0x48f6('0x3b'));}if(_0x1d08f4[_0x48f6('0xe')]>0x0){return manageTags(_0x54b54c,_0x1d08f4,_0x13490b,_0x1c37b5,_0x29325b,_0x1f6a4b,_0x107d75)[_0x48f6('0xc')](function(){_0x297ea3(_0x29325b);});}else{_0x297ea3(_0x29325b);}});};}function emit(_0x57829a,_0x51adb7,_0x400fd7){var _0x39e85e='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x48f6('0x4d')+_0x48f6('0x4e');var _0x4a9bfd={'uri':_0x57829a+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x400fd7+_0x39e85e};io['to'](util[_0x48f6('0x4f')](_0x48f6('0x50'),_0x51adb7))[_0x48f6('0x51')](_0x48f6('0x52'),_0x4a9bfd);}exports['cs']=function(_0x55ac8b,_0x278432,_0xb41b7a,_0x3507e0,_0x552c45,_0x52937a,_0x360166,_0x4fb272){var _0x3aa12c={};var _0x83e306={'user':_0x52937a['username'],'pass':_0x52937a[_0x48f6('0x53')]};var _0x580765=_0x48f6('0x54');var _0x23d6f0=_0x48f6('0x55');_0x52937a['remoteUri']=intUtil[_0x48f6('0x56')](_0x52937a['remoteUri']);_0x52937a[_0x48f6('0x57')]=intUtil[_0x48f6('0x56')](_0x52937a[_0x48f6('0x57')]);var _0xa000af=util[_0x48f6('0x4f')]('%s/api/now/table/',_0x52937a[_0x48f6('0x58')]);_0x3aa12c[_0x48f6('0x19')]=!_[_0x48f6('0x59')](_0x3507e0)?_0x3507e0[_0x48f6('0x5a')]:null;_0x3aa12c[_0x48f6('0x20')]=_0x52937a[_0x48f6('0x5a')];_0x3aa12c[_0x48f6('0x25')]=_0x4fb272['toLowerCase']()===_0x48f6('0x3c')?_0x278432[_0x48f6('0x5b')]:_0x278432[_0x48f6('0x5c')];_0x3aa12c[_0x48f6('0x5d')]=_0x4fb272===_0x48f6('0x5e')||_0x4fb272==='unmanaged'?_0x48f6('0x5e'):'outbound';var _0x83892e=util[_0x48f6('0x4f')](_0x48f6('0x5f'),_0x52937a[_0x48f6('0x57')],_0x278432['uniqueid'],md5(_0x278432[_0x48f6('0x60')]));if(_0x552c45&&_0x552c45[_0x48f6('0x61')]){logger[_0x48f6('0x10')](_0x48f6('0x62'),_0x48f6('0x63'));_0x278432[_0x48f6('0x64')]=_0x83892e;}else if(_0x360166&&_0x360166[_0x48f6('0x65')]&&_0x360166['recordingFormat']!==_0x48f6('0x66')){logger[_0x48f6('0x10')]('[OUTBOUND]',_0x48f6('0x63'));_0x278432[_0x48f6('0x64')]=_0x83892e;}else{_0x278432[_0x48f6('0x64')]='';}return getAdminUser(_0x4fb272,_0x83e306,_0x3aa12c,_0xa000af,_0x23d6f0,_0x580765)[_0x48f6('0xc')](getUser(_0x4fb272,_0x83e306,_0xa000af,_0x23d6f0,_0x580765))['then'](getEndUser(_0x4fb272,_0x83e306,_0xa000af,_0x23d6f0,_0x580765))[_0x48f6('0xc')](getTicket(_0x4fb272,_0x83e306,_0xa000af,_0xb41b7a,_0x278432,_0x23d6f0))['then'](function(_0x37c560){logger['info'](util[_0x48f6('0x4f')](_0x48f6('0x67'),_0x37c560[_0x48f6('0x43')]));logger[_0x48f6('0x10')](util[_0x48f6('0x4f')]('call\x20direction:\x20%s',_0x4fb272));if(_0x4fb272!=='unmanaged'){logger[_0x48f6('0x10')]('['+[_0x4fb272[_0x48f6('0x11')]()]+']',_0x48f6('0x68'));emit(_0x52937a[_0x48f6('0x58')],_0x3507e0[_0x48f6('0x3b')],_0x37c560[_0x48f6('0x43')]);}})['catch'](function(_0x59eded){logger[_0x48f6('0x14')]('['+[_0x4fb272[_0x48f6('0x11')]()]+_0x48f6('0x69'),util[_0x48f6('0x6a')](_0x59eded,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xefe4=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','remoteUri',']\x20Error\x20running\x20ServiceNow\x20integration','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20entity','active','true','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','System','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','customField','toString','idField','toLowerCase','content','type','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x349f58,_0x43c6ef){var _0x2555c3=function(_0x59ef75){while(--_0x59ef75){_0x349f58['push'](_0x349f58['shift']());}};_0x2555c3(++_0x43c6ef);}(_0xefe4,0xf0));var _0x4efe=function(_0x39251d,_0x780acd){_0x39251d=_0x39251d-0x0;var _0x431962=_0xefe4[_0x39251d];return _0x431962;};'use strict';var _=require('lodash');var Promise=require(_0x4efe('0x0'));var rp=require(_0x4efe('0x1'));var util=require(_0x4efe('0x2'));var md5=require(_0x4efe('0x3'));var Redis=require(_0x4efe('0x4'));var intUtil=require(_0x4efe('0x5'));var config=require(_0x4efe('0x6'));var logger=require(_0x4efe('0x7'))(_0x4efe('0x8'));config[_0x4efe('0x9')]=_[_0x4efe('0xa')](config['redis'],{'host':_0x4efe('0xb'),'port':0x18eb});var io=require(_0x4efe('0xc'))(new Redis(config[_0x4efe('0x9')]));function getAdminUser(_0x334239,_0x3d1ab6,_0x309287,_0x2c7197,_0x29b907,_0x76d652){return new Promise(function(_0x4afc1d,_0x59610b){var _0x6b758c={'method':_0x4efe('0xd'),'uri':_0x2c7197+_0x4efe('0xe')+'&'+_0x29b907+'&'+_0x76d652,'auth':_0x3d1ab6,'json':!![]};return rp(_0x6b758c)[_0x4efe('0xf')](function(_0x3e031d){if(_0x3e031d[_0x4efe('0x10')][_0x4efe('0x11')]>0x0){_0x309287['adminId']=_0x3e031d[_0x4efe('0x10')][0x0][_0x4efe('0x12')];}logger[_0x4efe('0x13')]('['+[_0x334239[_0x4efe('0x14')]()]+'],\x20getAdminUser\x20crm',_0x309287);_0x4afc1d(_0x309287);})[_0x4efe('0x15')](function(_0x59913c){logger[_0x4efe('0x16')]('['+[_0x334239[_0x4efe('0x14')]()]+']',_0x59913c['message']);_0x59610b(_0x59913c[_0x4efe('0x17')]);});});}function getUser(_0x10763d,_0x2a7542,_0x20e884,_0x4a90b8,_0x533285){return function(_0x272f53){logger[_0x4efe('0x13')]('['+[_0x10763d[_0x4efe('0x14')]()]+_0x4efe('0x18'),_0x272f53);return new Promise(function(_0x5124b9,_0x499fb0){if(intUtil[_0x4efe('0x19')](_0x272f53[_0x4efe('0x1a')])){var _0x2062aa={'method':'GET','uri':_0x20e884+'sys_user?sysparm_query=email%3D'+_0x272f53['userEmail']+'&'+_0x4a90b8+'&'+_0x533285,'auth':_0x2a7542,'json':!![]};logger[_0x4efe('0x13')]('['+[_0x10763d[_0x4efe('0x14')]()]+'],\x20getUser\x20rp\x20obj',_0x2062aa);return rp(_0x2062aa)['then'](function(_0xcb9e9){logger['info']('['+[_0x10763d['toUpperCase']()]+_0x4efe('0x1b'),_0xcb9e9);if(_0xcb9e9[_0x4efe('0x10')]['length']>0x0&&String(_0xcb9e9[_0x4efe('0x10')][0x0][_0x4efe('0x1c')])===_0x4efe('0x1d')){_0x272f53['userId']=_0xcb9e9[_0x4efe('0x10')][0x0]['sys_id'];}else{_0x272f53[_0x4efe('0x1e')]=_0x272f53[_0x4efe('0x1f')];_0x272f53['userEmail']=_0x272f53[_0x4efe('0x20')];}logger[_0x4efe('0x13')]('['+[_0x10763d['toUpperCase']()]+_0x4efe('0x21'),_0x272f53);_0x5124b9(_0x272f53);})[_0x4efe('0x15')](function(_0x2b8b56){logger[_0x4efe('0x16')]('['+[_0x10763d[_0x4efe('0x14')]()]+']',_0x2b8b56[_0x4efe('0x17')]);_0x499fb0(_0x2b8b56[_0x4efe('0x17')]);});}else{logger[_0x4efe('0x13')]('['+[_0x10763d[_0x4efe('0x14')]()]+_0x4efe('0x22'));_0x272f53[_0x4efe('0x1e')]=_0x272f53[_0x4efe('0x1f')];_0x272f53[_0x4efe('0x1a')]=_0x272f53[_0x4efe('0x20')];_0x5124b9(_0x272f53);}});};}function createEndUser(_0x553cfc,_0x167c05,_0x3a93cf,_0x3210c4,_0x511be3){logger['info']('['+[_0x553cfc['toUpperCase']()]+_0x4efe('0x23'),_0x3a93cf);return new Promise(function(_0x59c4cb,_0x4c26e6){var _0x162dda={'method':_0x4efe('0x24'),'uri':_0x3210c4+_0x4efe('0x25')+_0x511be3,'body':{'user_name':_0x3a93cf['endUserNumber'],'roles':_0x4efe('0x26'),'first_name':_0x3a93cf['endUserNumber'],'active':'true','date_format':_0x4efe('0x27'),'phone':_0x3a93cf[_0x4efe('0x28')]},'auth':_0x167c05,'json':!![]};return rp(_0x162dda)[_0x4efe('0xf')](function(_0x12c43d){logger[_0x4efe('0x13')]('['+[_0x553cfc['toUpperCase']()]+_0x4efe('0x29'),_0x12c43d[_0x4efe('0x10')]);_0x3a93cf[_0x4efe('0x2a')]=_0x12c43d[_0x4efe('0x10')][_0x4efe('0x12')];_0x59c4cb(_0x3a93cf);})['catch'](function(_0x10f156){logger[_0x4efe('0x16')]('['+[_0x553cfc[_0x4efe('0x14')]()]+']',_0x10f156[_0x4efe('0x17')]);_0x4c26e6(_0x10f156['message']);});});}function getEndUser(_0x21dda2,_0x55cd48,_0x2c4751,_0x54ec2d,_0x443366){return function(_0x31285a){logger[_0x4efe('0x13')]('['+[_0x21dda2['toUpperCase']()]+_0x4efe('0x2b'),_0x31285a);return new Promise(function(_0xef7378,_0x53bed0){var _0x51c1bc={'method':_0x4efe('0xd'),'uri':_0x2c4751+_0x4efe('0x2c')+_0x31285a[_0x4efe('0x28')]+'&'+_0x54ec2d+'&'+_0x443366,'auth':_0x55cd48,'json':!![]};return rp(_0x51c1bc)[_0x4efe('0xf')](function(_0x145c60){if(_0x145c60[_0x4efe('0x10')][_0x4efe('0x11')]>0x0){_0x31285a['endUserId']=_0x145c60['result'][0x0][_0x4efe('0x12')];logger[_0x4efe('0x13')]('['+[_0x21dda2[_0x4efe('0x14')]()]+_0x4efe('0x2d'),_0x31285a);_0xef7378(_0x31285a);}else{return createEndUser(_0x21dda2,_0x55cd48,_0x31285a,_0x2c4751,_0x54ec2d)['then'](function(_0x2c9dfd){logger['info']('['+[_0x21dda2['toUpperCase']()]+_0x4efe('0x2e'),_0x2c9dfd);_0xef7378(_0x2c9dfd);});}})['catch'](function(_0x4c1a4d){logger[_0x4efe('0x16')]('['+[_0x21dda2['toUpperCase']()]+']',_0x4c1a4d[_0x4efe('0x17')]);_0x53bed0(_0x4c1a4d[_0x4efe('0x17')]);});});};}function getCustomFields(_0x5a0b32,_0x44d200){var _0x2ca0a6={};if(_0x5a0b32['length']>0x0){_[_0x4efe('0x2f')](_0x5a0b32,function(_0x25026c){if(_[_0x4efe('0x30')]([_0x4efe('0x31'),_0x4efe('0x32')],_0x25026c['type'])&&_0x25026c[_0x4efe('0x33')]&&!_0x25026c[_0x4efe('0x34')]){_0x2ca0a6[_0x25026c[_0x4efe('0x33')]['toLowerCase']()]=_0x25026c['content'][_0x4efe('0x35')]();}else if(_['includes']([_0x4efe('0x31'),_0x4efe('0x32')],_0x25026c['type'])&&_0x25026c[_0x4efe('0x36')]&&_0x25026c[_0x4efe('0x34')]){_0x2ca0a6[_0x25026c['idField'][_0x4efe('0x37')]()]=_0x25026c[_0x4efe('0x38')][_0x4efe('0x35')]();}else if(_0x25026c[_0x4efe('0x39')]===_0x4efe('0x3a')&&_0x25026c[_0x4efe('0x3b')]&&_0x25026c['idField']&&_0x25026c[_0x4efe('0x34')]){_0x2ca0a6[_0x25026c[_0x4efe('0x36')][_0x4efe('0x37')]()]=_0x44d200[_0x25026c[_0x4efe('0x3b')]][_0x4efe('0x35')]();}else if(_0x25026c[_0x4efe('0x39')]===_0x4efe('0x3c')&&_0x25026c[_0x4efe('0x3d')]&&_0x25026c[_0x4efe('0x3d')][_0x4efe('0x3e')]&&_0x25026c[_0x4efe('0x36')]&&_0x25026c[_0x4efe('0x34')]){_0x2ca0a6[_0x25026c[_0x4efe('0x36')][_0x4efe('0x37')]()]=_0x44d200[_0x25026c[_0x4efe('0x3d')][_0x4efe('0x3e')][_0x4efe('0x37')]()]['toString']();}});}return _0x2ca0a6;}function getTicket(_0x29336e,_0xd12b9c,_0x1fbdf0,_0x5a7555,_0x458de6,_0x473f08){return function(_0x362c26){logger[_0x4efe('0x13')]('['+[_0x29336e[_0x4efe('0x14')]()]+_0x4efe('0x3f'),_0x362c26);return new Promise(function(_0x4a4aab,_0xb4600b){var _0x2c79f8=_0x29336e['toLowerCase']()===_0x4efe('0x40')?_0x362c26[_0x4efe('0x1e')]:_0x362c26[_0x4efe('0x2a')];var _0x50b109={'method':_0x4efe('0x24'),'uri':_0x1fbdf0+_0x4efe('0x41')+'?'+_0x473f08,'body':Object[_0x4efe('0x42')]({},{'active':_0x4efe('0x1d'),'caller_id':_0x2c79f8,'assigned_to':_0x362c26[_0x4efe('0x1e')],'short_description':intUtil[_0x4efe('0x43')](_0x5a7555['Subjects'],_0x458de6,'\x20'),'description':intUtil[_0x4efe('0x43')](_0x5a7555[_0x4efe('0x44')],_0x458de6,'\x0a')},getCustomFields(_0x5a7555[_0x4efe('0x45')],_0x458de6)),'auth':_0xd12b9c,'json':!![]};return rp(_0x50b109)[_0x4efe('0xf')](function(_0x5a1bc5){logger[_0x4efe('0x13')]('['+[_0x29336e[_0x4efe('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x5a1bc5[_0x4efe('0x10')]);_0x362c26['ticketId']=_0x5a1bc5['result'][_0x4efe('0x12')];_0x362c26[_0x4efe('0x46')]=_0x5a1bc5['result']['number'];logger[_0x4efe('0x13')]('['+[_0x29336e[_0x4efe('0x14')]()]+_0x4efe('0x47'),_0x362c26);_0x4a4aab(_0x362c26);})['catch'](function(_0x3568ff){logger['error']('['+[_0x29336e['toUpperCase']()]+']',_0x3568ff[_0x4efe('0x17')]);_0xb4600b(_0x3568ff[_0x4efe('0x17')]);});});};}function createRemoteTag(_0x516e22,_0x172998,_0x162e5c,_0x4ef1b1){return new Promise(function(_0x4cbc5a,_0x320554){var _0x22b6f5={'method':'POST','uri':_0x162e5c+_0x4efe('0x48')+'?'+_0x4ef1b1,'body':{'short_description':_0x516e22,'global':!![],'active':!![],'name':_0x516e22},'auth':_0x172998,'json':!![]};return rp(_0x22b6f5)[_0x4efe('0xf')](function(_0x1eae15){var _0x500a97=_0x1eae15['result'][_0x4efe('0x12')];_0x4cbc5a(_0x500a97);});});}function getRemoteTag(_0x59aec6,_0x434a3b,_0x41f065,_0x5eaaed,_0x49224d){return new Promise(function(_0x2d1545,_0x1027c1){var _0x50a2e7={'method':_0x4efe('0xd'),'uri':_0x41f065+_0x4efe('0x48')+_0x4efe('0x49')+_0x59aec6+'&'+_0x5eaaed,'auth':_0x434a3b,'json':!![]};return rp(_0x50a2e7)[_0x4efe('0xf')](function(_0x662187){if(_0x662187[_0x4efe('0x10')]['length']>0x0){var _0x3f21dd=_0x662187[_0x4efe('0x10')][0x0][_0x4efe('0x12')];_0x2d1545(_0x3f21dd);}else{return createRemoteTag(_0x59aec6,_0x434a3b,_0x41f065,_0x5eaaed)[_0x4efe('0xf')](function(_0x5917a3){_0x2d1545(_0x5917a3);});}});});}function assignTagToIncident(_0x19fd74,_0x38dc9b,_0x5d4389,_0x37616c,_0x2515bc){return new Promise(function(_0x2cefb6,_0x3c446b){var _0x313c57={'method':_0x4efe('0x24'),'uri':_0x5d4389+_0x4efe('0x4a')+'?'+_0x2515bc,'body':{'label':_0x19fd74,'table':_0x4efe('0x41'),'id_type':_0x4efe('0x4b'),'table_key':_0x37616c['ticketId'],'title':_0x4efe('0x4c')+_0x37616c[_0x4efe('0x46')],'id_display':_0x37616c[_0x4efe('0x46')]},'auth':_0x38dc9b,'json':!![]};return rp(_0x313c57)['then'](function(_0x32bda4){_0x2cefb6();})[_0x4efe('0x15')](function(){_0x2cefb6();});});}function manageTags(_0x4a9529,_0x7b3811,_0x1dc6af,_0x1e1f0d,_0x16f106,_0xfef2b9,_0x5deec4){return new Promise(function(_0x57687a,_0x49906f){var _0x30e75a=[];_0x7b3811['forEach'](function(_0x5a24c5){_0x30e75a[_0x4efe('0x4d')](getRemoteTag(_0x5a24c5,_0x1dc6af,_0x1e1f0d,_0xfef2b9,_0x5deec4));});return Promise['all'](_0x30e75a)[_0x4efe('0xf')](function(_0x1480db){if(_0x1480db['length']){logger[_0x4efe('0x13')]('['+[_0x4a9529['toUpperCase']()]+_0x4efe('0x4e'),_0x1480db);var _0x8c2ee5=[];_0x1480db[_0x4efe('0x2f')](function(_0x4e0181){_0x8c2ee5[_0x4efe('0x4d')](assignTagToIncident(_0x4e0181,_0x1dc6af,_0x1e1f0d,_0x16f106,_0xfef2b9));});return Promise['all'](_0x8c2ee5)[_0x4efe('0xf')](function(){_0x57687a();})['catch'](function(){_0x57687a();});}else{_0x57687a();}});});}function getTags(_0xfd6a39,_0x473d1d,_0x135524,_0xbe5ce2,_0x1b24dc,_0x31f869){return function(_0x299c11){return new Promise(function(_0x2a04cc,_0x60b092){var _0x477a2d=[];var _0x34b108=_0xbe5ce2[_0x4efe('0x4f')];if(_0x34b108&&_0x34b108[_0x4efe('0x11')]>0x0){_0x477a2d=_[_0x4efe('0x50')](_0x34b108,_0x4efe('0x3e'));}if(_0x477a2d[_0x4efe('0x11')]>0x0){return manageTags(_0xfd6a39,_0x477a2d,_0x473d1d,_0x135524,_0x299c11,_0x1b24dc,_0x31f869)[_0x4efe('0xf')](function(){_0x2a04cc(_0x299c11);});}else{_0x2a04cc(_0x299c11);}});};}function emit(_0x3afa99,_0x451202,_0x1c5c2b){var _0x3f8f59=_0x4efe('0x51')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x4efe('0x52')+_0x4efe('0x53');var _0x5660c9={'uri':_0x3afa99+_0x4efe('0x54')+_0x1c5c2b+_0x3f8f59};io['to'](util[_0x4efe('0x55')]('user:%s',_0x451202))[_0x4efe('0x56')](_0x4efe('0x57'),_0x5660c9);}exports['cs']=function(_0x44a776,_0x450493,_0x572591,_0x14efa3,_0xa2e80a,_0x40c3f0,_0x396d71,_0x5da347){var _0x547b80={};var _0x405c98={'user':_0x40c3f0[_0x4efe('0x58')],'pass':_0x40c3f0['password']};var _0x457efe=_0x4efe('0x59');var _0x5db92d=_0x4efe('0x5a');_0x40c3f0['remoteUri']=intUtil[_0x4efe('0x5b')](_0x40c3f0['remoteUri']);_0x40c3f0[_0x4efe('0x5c')]=intUtil[_0x4efe('0x5b')](_0x40c3f0[_0x4efe('0x5c')]);var _0x448e18=util[_0x4efe('0x55')]('%s/api/now/table/',_0x40c3f0['remoteUri']);_0x547b80['userEmail']=!_[_0x4efe('0x5d')](_0x14efa3)?_0x14efa3['email']:null;_0x547b80[_0x4efe('0x20')]=_0x40c3f0[_0x4efe('0x5e')];_0x547b80[_0x4efe('0x28')]=_0x5da347[_0x4efe('0x37')]()==='outbound'?_0x450493[_0x4efe('0x5f')]:_0x450493[_0x4efe('0x60')];_0x547b80[_0x4efe('0x61')]=_0x5da347===_0x4efe('0x62')||_0x5da347===_0x4efe('0x63')?'queue':_0x4efe('0x40');var _0x34f60a=util[_0x4efe('0x55')](_0x4efe('0x64'),_0x40c3f0[_0x4efe('0x5c')],_0x450493[_0x4efe('0x65')],md5(_0x450493['uniqueid']));if(_0xa2e80a&&_0xa2e80a[_0x4efe('0x66')]){logger['info'](_0x4efe('0x67'),_0x4efe('0x68'));_0x450493[_0x4efe('0x69')]=_0x34f60a;}else if(_0x396d71&&_0x396d71[_0x4efe('0x6a')]&&_0x396d71[_0x4efe('0x6a')]!==_0x4efe('0x6b')){logger['info'](_0x4efe('0x6c'),_0x4efe('0x68'));_0x450493[_0x4efe('0x69')]=_0x34f60a;}else{_0x450493['recordingURL']='';}return getAdminUser(_0x5da347,_0x405c98,_0x547b80,_0x448e18,_0x5db92d,_0x457efe)[_0x4efe('0xf')](getUser(_0x5da347,_0x405c98,_0x448e18,_0x5db92d,_0x457efe))[_0x4efe('0xf')](getEndUser(_0x5da347,_0x405c98,_0x448e18,_0x5db92d,_0x457efe))[_0x4efe('0xf')](getTicket(_0x5da347,_0x405c98,_0x448e18,_0x572591,_0x450493,_0x5db92d))[_0x4efe('0xf')](function(_0x3466d3){logger[_0x4efe('0x13')](util[_0x4efe('0x55')](_0x4efe('0x6d'),_0x3466d3[_0x4efe('0x6e')]));logger[_0x4efe('0x13')](util['format'](_0x4efe('0x6f'),_0x5da347));if(_0x5da347!==_0x4efe('0x63')){logger['info']('['+[_0x5da347[_0x4efe('0x14')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x40c3f0[_0x4efe('0x70')],_0x14efa3[_0x4efe('0x3e')],_0x3466d3['ticketId']);}})[_0x4efe('0x15')](function(_0x1ded0b){logger[_0x4efe('0x16')]('['+[_0x5da347[_0x4efe('0x14')]()]+_0x4efe('0x71'),util['inspect'](_0x1ded0b,{'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 fc4885e..c2b95bf 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 _0x59d7=['assigned_user_id','created_by','getString','Descriptions','date_start','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','find','value','Agent\x20found!','resolve','name_value_list','user_id','Searching\x20enduser\x20with\x20phone','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','phone_home','then','debug','merge','map','forEach','string','nameField','customField','content','type','variable','custom_fields','customVariable','Variable','toLowerCase','login','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','users','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','unmanaged','uri','lastevent','toUpperCase','Recording\x20is\x20enabled!','The\x20Enduser\x20ID\x20is:','Inbound','lodash','request-promise','bluebird','md5','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','info','name','Subjects'];(function(_0x1c2e29,_0x3ad48a){var _0x39174d=function(_0x2a3689){while(--_0x2a3689){_0x1c2e29['push'](_0x1c2e29['shift']());}};_0x39174d(++_0x3ad48a);}(_0x59d7,0xe1));var _0x759d=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0x59d7[_0x51674a];return _0x13fca6;};'use strict';var _=require(_0x759d('0x0'));var rp=require(_0x759d('0x1'));var BPromise=require(_0x759d('0x2'));var md5=require(_0x759d('0x3'));var util=require('util');var Redis=require(_0x759d('0x4'));var intUtil=require('./util');var config=require(_0x759d('0x5'));var logger=require(_0x759d('0x6'))(_0x759d('0x7'));config[_0x759d('0x8')]=_[_0x759d('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x759d('0xa'))(new Redis(config[_0x759d('0x8')]));var def={'method':_0x759d('0xb'),'json':!![]};function emit(_0x139eb2,_0x3ec217,_0x6822fc){io['to'](_0x139eb2)['emit'](_0x3ec217,_0x6822fc);}function getTicket(_0x55a960,_0x34161c,_0x1a0049,_0x1a6dc8,_0x41749e,_0x1bab87,_0x56e100,_0x1c581e){logger[_0x759d('0xc')]('Creating\x20new\x20ticket...');var _0x33277f=new Date();var _0x17b432=[{'name':_0x759d('0xd'),'value':intUtil['getString'](_0x1a6dc8[_0x759d('0xe')],_0x41749e,'\x20')},{'name':_0x759d('0xf'),'value':_0x34161c['id']},{'name':_0x759d('0x10'),'value':_0x34161c['id']},{'name':'description','value':intUtil[_0x759d('0x11')](_0x1a6dc8[_0x759d('0x12')],_0x41749e,'\x0a')},{'name':_0x759d('0x13'),'value':_0x33277f['toISOString']()[_0x759d('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0x759d('0x15'),'value':'0'},{'name':_0x759d('0x16'),'value':'15'},{'name':_0x759d('0x17'),'value':_0x1a0049['id']},{'name':_0x759d('0x18'),'value':_0x759d('0x19')},{'name':_0x759d('0x1a'),'value':_0x1a0049[_0x759d('0xd')]},{'name':_0x759d('0x1b'),'value':_0x1c581e}];if(_0x1bab87[_0x759d('0x1c')]){_['forEach'](_0x1bab87,function(_0x54ab33){if(_0x41749e[_0x54ab33[_0x759d('0x1d')]]){_0x17b432[_0x759d('0x1e')]({'name':_0x54ab33[_0x759d('0x1f')],'value':_0x41749e[_0x54ab33['variableName']]});}});}return request({'form':{'method':_0x759d('0x20'),'input_type':_0x759d('0x21'),'response_type':_0x759d('0x21'),'rest_data':JSON[_0x759d('0x22')]({'session':_0x56e100['id'],'module_name':_0x759d('0x23'),'name_value_list':_0x17b432})}});}function getAuth(_0x9d289d){return util[_0x759d('0x24')](_0x759d('0x25'),new Buffer(_0x9d289d[_0x759d('0x26')]+':X')[_0x759d('0x27')](_0x759d('0x28')));}function getServerInfo(_0x5ae54e){return request({'form':{'method':_0x759d('0x29'),'input_type':_0x759d('0x21'),'response_type':_0x759d('0x21'),'rest_data':JSON[_0x759d('0x22')]({'session':_0x5ae54e['id']})}});}function getUser(_0x3966be,_0x2e01e6,_0x270ed9){if(!_[_0x759d('0x2a')](_0x2e01e6)){logger['info'](_0x759d('0x2b'),_0x2e01e6);return request({'form':{'method':_0x759d('0x2c'),'input_type':'JSON','response_type':_0x759d('0x21'),'rest_data':JSON[_0x759d('0x22')]({'session':_0x270ed9['id'],'module_name':_0x759d('0x2d'),'query':util['format'](_0x759d('0x2e'),_0x2e01e6),'order_by':'','offset':'0','select_fields':['id',_0x759d('0xd'),_0x759d('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x36dcb7){if(_0x36dcb7['entry_list'][_0x759d('0x1c')]){var _0x4af568=_[_0x759d('0x30')](_0x36dcb7['entry_list'],function(_0x3258e8){return _0x3258e8['name_value_list'][_0x759d('0x2f')][_0x759d('0x31')]===_0x2e01e6;});if(_0x4af568){logger['info'](_0x759d('0x32'));return BPromise[_0x759d('0x33')]({'id':_0x4af568[_0x759d('0x34')]['id'][_0x759d('0x31')],'name':_0x4af568[_0x759d('0x34')]['name'][_0x759d('0x31')]});}}logger[_0x759d('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x270ed9[_0x759d('0x34')]['user_id'][_0x759d('0x31')],'name':_0x270ed9[_0x759d('0x34')][_0x759d('0x2f')][_0x759d('0x31')]});});}else{logger[_0x759d('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x270ed9[_0x759d('0x34')][_0x759d('0x35')][_0x759d('0x31')],'name':_0x270ed9[_0x759d('0x34')][_0x759d('0x2f')][_0x759d('0x31')]});}}function getEndUser(_0x41605f,_0x128c84,_0xa149de,_0xf807e){logger['info'](_0x759d('0x36'),_0xa149de);return request({'form':{'method':'get_entry_list','input_type':_0x759d('0x21'),'response_type':_0x759d('0x21'),'rest_data':JSON['stringify']({'session':_0xf807e['id'],'module_name':_0x759d('0x19'),'query':util[_0x759d('0x24')]('contacts.phone_home\x20=\x20\x22%s\x22',_0xa149de),'order_by':'','offset':'0','select_fields':['id',_0x759d('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x18bf75){if(_0x18bf75[_0x759d('0x37')]['length']){var _0x205a1a=_['find'](_0x18bf75[_0x759d('0x37')],function(_0xc6b95c){return _0xc6b95c[_0x759d('0x34')]['phone_home'][_0x759d('0x31')]===_0xa149de;});if(_0x205a1a){logger[_0x759d('0xc')](_0x759d('0x38'));return BPromise[_0x759d('0x33')]({'id':_0x205a1a['name_value_list']['id'][_0x759d('0x31')],'name':_0x205a1a[_0x759d('0x34')][_0x759d('0xd')]['value'],'phone':_0x205a1a[_0x759d('0x34')]['phone_home'][_0x759d('0x31')]});}}else{logger[_0x759d('0xc')](_0x759d('0x39'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x759d('0x22')]({'session':_0xf807e['id'],'module_name':_0x759d('0x19'),'name_value_list':[{'name':_0x759d('0x3a'),'value':_0x128c84!==_0x759d('0x3b')?_0x128c84:util[_0x759d('0x24')](_0x759d('0x3c'),_0xa149de)},{'name':_0x759d('0x3d'),'value':_0xa149de}]})}})[_0x759d('0x3e')](function(_0x5a1ee8){logger[_0x759d('0xc')]('Enduser\x20created.');return BPromise[_0x759d('0x33')]({'id':_0x5a1ee8['id'],'name':_0x5a1ee8[_0x759d('0x37')][_0x759d('0x3a')][_0x759d('0x31')],'phone':_0x5a1ee8[_0x759d('0x37')]['phone_home']['value']});});}});}function request(_0x2175db){logger[_0x759d('0x3f')]('[HTTP]',JSON[_0x759d('0x22')](_0x2175db));return rp(_[_0x759d('0x40')](def,_0x2175db));}function getTags(_0x4211d6,_0x2914cc){var _0x1e355f=[];if(_0x4211d6&&_0x4211d6[_0x759d('0x1c')]>0x0){_0x1e355f=_[_0x759d('0x41')](_0x4211d6,_0x2914cc);}return _0x1e355f;}function getCustomFields(_0x463d7b,_0x54efd3){var _0x1151c2=[];var _0x3e78f6={'custom_fields':[]};if(_0x463d7b[_0x759d('0x1c')]>0x0){_[_0x759d('0x42')](_0x463d7b,function(_0x3641f3){if(_0x3641f3['type']===_0x759d('0x43')&&_0x3641f3[_0x759d('0x44')]&&!_0x3641f3[_0x759d('0x45')]){_0x3e78f6[_0x3641f3[_0x759d('0x44')]['toLowerCase']()]=_0x3641f3[_0x759d('0x46')][_0x759d('0x27')]();}else if(_0x3641f3[_0x759d('0x47')]===_0x759d('0x43')&&_0x3641f3['idField']&&_0x3641f3[_0x759d('0x45')]){_0x3e78f6['custom_fields'][_0x759d('0x1e')]({'id':_0x3641f3[_0x759d('0x1f')],'value':_0x3641f3[_0x759d('0x46')][_0x759d('0x27')]()});}else if(_0x3641f3[_0x759d('0x47')]===_0x759d('0x48')&&_0x3641f3['variableName']&&_0x3641f3[_0x759d('0x1f')]&&_0x3641f3['customField']){_0x54efd3[_0x3641f3['variableName']]&&_0x3e78f6[_0x759d('0x49')][_0x759d('0x1e')]({'id':_0x3641f3[_0x759d('0x1f')],'value':_0x54efd3[_0x3641f3[_0x759d('0x1d')]][_0x759d('0x27')]()});}else if(_0x3641f3[_0x759d('0x47')]===_0x759d('0x4a')&&_0x3641f3[_0x759d('0x4b')]&&_0x3641f3[_0x759d('0x4b')]['name']&&_0x3641f3[_0x759d('0x1f')]&&_0x3641f3['customField']){_0x54efd3[_0x3641f3['Variable'][_0x759d('0xd')][_0x759d('0x4c')]()]&&_0x3e78f6[_0x759d('0x49')][_0x759d('0x1e')]({'id':_0x3641f3[_0x759d('0x1f')],'value':_0x54efd3[_0x3641f3[_0x759d('0x4b')][_0x759d('0xd')][_0x759d('0x4c')]()][_0x759d('0x27')]()});}});}return _0x3e78f6;}function getConnection(_0x256b31){return request({'method':'POST','form':{'method':_0x759d('0x4d'),'input_type':_0x759d('0x21'),'response_type':'JSON','rest_data':JSON[_0x759d('0x22')]({'user_auth':{'user_name':_0x256b31['username'],'password':_0x256b31['password'],'encryption':_0x759d('0x4e')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x759d('0x3e')](function(_0x51054d){var _0x2819c5=_0x51054d;if(_0x2819c5['id']){def[_0x759d('0x4f')]=_0x2819c5['id'];return BPromise['resolve'](_0x2819c5);}else{throw new Error(util['format'](_0x759d('0x50'),_0x256b31['id']));}});}function setRelationship(_0x8b75e6,_0x1bc66d,_0x25ae8a,_0x119990){return request({'form':{'method':_0x759d('0x51'),'input_type':'JSON','response_type':_0x759d('0x21'),'rest_data':JSON[_0x759d('0x22')]({'session':_0x8b75e6['id'],'module_name':_0x759d('0x23'),'module_id':_0x25ae8a['id'],'link_field_name':_0x119990,'related_ids':[_0x1bc66d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x759d('0x52')]=function(_0x3f4c97,_0x3f88e1,_0x3e5579,_0x3ea7e9,_0x9ca9d,_0x5932a7){var _0x284571,_0x48408b,_0x50ebbc,_0xf46003;_0x5932a7[_0x759d('0x53')]=intUtil[_0x759d('0x54')](_0x5932a7['remoteUri']);_0x5932a7[_0x759d('0x55')]=intUtil['stripTrailingSlash'](_0x5932a7[_0x759d('0x55')]);def['uri']=util[_0x759d('0x24')]('%s/service/v4_1/rest.php',_0x5932a7[_0x759d('0x53')]);if(_0x9ca9d&&_0x9ca9d[_0x759d('0x56')]){logger[_0x759d('0xc')](_0x759d('0x57'),'Recording\x20is\x20enabled!');_0x3f88e1[_0x759d('0x58')]=util[_0x759d('0x24')](_0x759d('0x59'),_0x5932a7['serverUrl'],_0x3f88e1['uniqueid'],md5(_0x3f88e1[_0x759d('0x5a')]));}else{_0x3f88e1['recordingURL']='';}return getConnection(_0x5932a7)[_0x759d('0x3e')](function(_0xabd824){_0xf46003=_0xabd824;return getUser(_0x5932a7,_0x3ea7e9['name'],_0xf46003);})[_0x759d('0x3e')](function(_0xdf3b9c){_0x284571=_0xdf3b9c;logger[_0x759d('0xc')](_0x759d('0x5b'),_0x284571['id']);return getEndUser(_0x5932a7,_0x3f88e1[_0x759d('0x5c')],_0x3f88e1[_0x759d('0x5d')],_0xf46003);})['then'](function(_0x3dcb21){_0x48408b=_0x3dcb21;logger['info']('The\x20Enduser\x20ID\x20is:',_0x48408b['id']);return getTicket(_0x5932a7,_0x284571,_0x48408b,_0x3e5579,_0x3f88e1,_0x3e5579[_0x759d('0x5e')],_0xf46003,'Inbound');})[_0x759d('0x3e')](function(_0x3c58ca){_0x50ebbc=_0x3c58ca;logger[_0x759d('0xc')](_0x759d('0x5f'));logger['info'](_0x759d('0x60'),_0x50ebbc['id']);return setRelationship(_0xf46003,_0x284571,_0x50ebbc,'users');})[_0x759d('0x3e')](function(){return setRelationship(_0xf46003,_0x48408b,_0x50ebbc,_0x759d('0x61'));})[_0x759d('0x3e')](function(){return getServerInfo(_0xf46003);})['then'](function(_0xefa46c){var _0x3d5c3a=parseInt(_0xefa46c['version']['charAt'](0x0));var _0x1ca55c=util[_0x759d('0x24')](_0x759d('0x62'),_0x5932a7[_0x759d('0x53')],_0x50ebbc['id']);if(_0x3d5c3a>0x6){_0x1ca55c=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5932a7['remoteUri'],_0x50ebbc['id']);}logger['info'](_0x759d('0x57'),_0x759d('0x63'));emit(util['format']('user:%s',_0x3ea7e9['name']),_0x759d('0x64'),{'uri':_0x1ca55c});})[_0x759d('0x65')](function(_0x46a582){logger[_0x759d('0x66')]('[QUEUE]',JSON[_0x759d('0x22')](_0x46a582));});};exports[_0x759d('0x67')]=function(_0x5cca6f,_0x1716d1,_0x39d906,_0x248a35,_0x5831bc,_0x2892da,_0xa2939e){var _0x55322b,_0x14d183,_0x2f5d90,_0x290352;_0x2892da['remoteUri']=intUtil[_0x759d('0x54')](_0x2892da[_0x759d('0x53')]);_0x2892da[_0x759d('0x55')]=intUtil['stripTrailingSlash'](_0x2892da[_0x759d('0x55')]);def['uri']=util[_0x759d('0x24')](_0x759d('0x68'),_0x2892da[_0x759d('0x53')]);if(_0xa2939e&&_0xa2939e['recordingFormat']&&_0xa2939e[_0x759d('0x69')]!=='none'){logger['info'](_0x759d('0x6a'),'Recording\x20is\x20enabled!');_0x1716d1[_0x759d('0x58')]=util[_0x759d('0x24')](_0x759d('0x59'),_0x2892da['serverUrl'],_0x1716d1[_0x759d('0x5a')],md5(_0x1716d1[_0x759d('0x5a')]));}return getConnection(_0x2892da)[_0x759d('0x3e')](function(_0xb4d9ea){_0x290352=_0xb4d9ea;return getUser(_0x2892da,_0x248a35['name'],_0x290352);})['then'](function(_0x4ab8d2){_0x55322b=_0x4ab8d2;logger['info'](_0x759d('0x5b'),_0x55322b['id']);return getEndUser(_0x2892da,_0x1716d1[_0x759d('0x6b')],_0x1716d1['destcalleridnum'],_0x290352);})[_0x759d('0x3e')](function(_0x14396d){_0x14d183=_0x14396d;logger[_0x759d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x14d183['id']);return getTicket(_0x2892da,_0x55322b,_0x14d183,_0x39d906,_0x1716d1,_0x39d906['Fields'],_0x290352,_0x759d('0x6c'));})[_0x759d('0x3e')](function(_0x266d02){_0x2f5d90=_0x266d02;logger[_0x759d('0xc')](_0x759d('0x5f'));logger[_0x759d('0xc')]('The\x20Ticket\x20ID\x20is:',_0x2f5d90['id']);return setRelationship(_0x290352,_0x55322b,_0x2f5d90,_0x759d('0x6d'));})[_0x759d('0x3e')](function(){return setRelationship(_0x290352,_0x14d183,_0x2f5d90,_0x759d('0x61'));})[_0x759d('0x3e')](function(){return getServerInfo(_0x290352);})['then'](function(_0x4b27af){var _0x3088d7=parseInt(_0x4b27af[_0x759d('0x6e')]['charAt'](0x0));var _0x55ed7d=util[_0x759d('0x24')](_0x759d('0x62'),_0x2892da['remoteUri'],_0x2f5d90['id']);if(_0x3088d7>0x6){_0x55ed7d=util['format'](_0x759d('0x6f'),_0x2892da[_0x759d('0x53')],_0x2f5d90['id']);}logger[_0x759d('0xc')](_0x759d('0x6a'),_0x759d('0x63'));emit(util[_0x759d('0x24')](_0x759d('0x70'),_0x248a35[_0x759d('0xd')]),_0x759d('0x64'),{'uri':_0x55ed7d});})[_0x759d('0x65')](function(_0x3fec95){logger[_0x759d('0x66')]('[OUTBOUND]',JSON['stringify'](_0x3fec95));});};exports[_0x759d('0x71')]=function(_0x4baa66,_0x59141f,_0x55cd9e,_0x274788,_0x5e4b29,_0x2475d8){var _0xc42b72,_0x50aefc,_0x72726f,_0x18e10d;_0x2475d8[_0x759d('0x53')]=intUtil[_0x759d('0x54')](_0x2475d8[_0x759d('0x53')]);_0x2475d8['serverUrl']=intUtil[_0x759d('0x54')](_0x2475d8[_0x759d('0x55')]);def[_0x759d('0x72')]=util[_0x759d('0x24')]('%s/service/v4_1/rest.php',_0x2475d8[_0x759d('0x53')]);if(_0x5e4b29&&_0x5e4b29[_0x759d('0x56')]){logger[_0x759d('0xc')]('['+_0x59141f[_0x759d('0x73')][_0x759d('0x74')]()+']',_0x759d('0x75'));_0x59141f[_0x759d('0x58')]=util['format'](_0x759d('0x59'),_0x2475d8[_0x759d('0x55')],_0x59141f[_0x759d('0x5a')],md5(_0x59141f[_0x759d('0x5a')]));}else{_0x59141f['recordingURL']='';}return getConnection(_0x2475d8)['then'](function(_0x3a54fa){_0x18e10d=_0x3a54fa;if(!_[_0x759d('0x2a')](_0x274788)){return getUser(_0x2475d8,_0x274788[_0x759d('0xd')],_0x18e10d);}else{return getUser(_0x2475d8,null,_0x18e10d);}})[_0x759d('0x3e')](function(_0x1bd87c){_0xc42b72=_0x1bd87c;logger[_0x759d('0xc')]('The\x20User\x20ID\x20is:',_0xc42b72['id']);return getEndUser(_0x2475d8,_0x59141f[_0x759d('0x5c')],_0x59141f['calleridnum'],_0x18e10d);})['then'](function(_0x20a889){_0x50aefc=_0x20a889;logger['info'](_0x759d('0x76'),_0x50aefc['id']);return getTicket(_0x2475d8,_0xc42b72,_0x50aefc,_0x55cd9e,_0x59141f,_0x55cd9e['Fields'],_0x18e10d,_0x759d('0x77'));})[_0x759d('0x3e')](function(_0x5a8068){_0x72726f=_0x5a8068;logger[_0x759d('0xc')]('Ticket\x20created!');logger[_0x759d('0xc')](_0x759d('0x60'),_0x72726f['id']);return setRelationship(_0x18e10d,_0xc42b72,_0x72726f,_0x759d('0x6d'));})['then'](function(){return setRelationship(_0x18e10d,_0x50aefc,_0x72726f,_0x759d('0x61'));})[_0x759d('0x3e')](function(){return getServerInfo(_0x18e10d);})['catch'](function(_0x22ac41){logger[_0x759d('0x66')]('['+_0x59141f[_0x759d('0x73')][_0x759d('0x74')]()+']',JSON[_0x759d('0x22')](_0x22ac41));});}; \ No newline at end of file +var _0x66ac=['toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','find','name_value_list','user_name','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','remoteUri','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Outbound','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_type','Contacts','direction','length','forEach','push','idField','variableName','set_entry','JSON','stringify','Basic\x20%s','apiKey'];(function(_0x17a647,_0x2bbe12){var _0x219a38=function(_0x131c5d){while(--_0x131c5d){_0x17a647['push'](_0x17a647['shift']());}};_0x219a38(++_0x2bbe12);}(_0x66ac,0xcd));var _0xc66a=function(_0x5af66b,_0x359201){_0x5af66b=_0x5af66b-0x0;var _0x36a023=_0x66ac[_0x5af66b];return _0x36a023;};'use strict';var _=require(_0xc66a('0x0'));var rp=require(_0xc66a('0x1'));var BPromise=require(_0xc66a('0x2'));var md5=require(_0xc66a('0x3'));var util=require(_0xc66a('0x4'));var Redis=require(_0xc66a('0x5'));var intUtil=require(_0xc66a('0x6'));var config=require(_0xc66a('0x7'));var logger=require(_0xc66a('0x8'))(_0xc66a('0x9'));config[_0xc66a('0xa')]=_[_0xc66a('0xb')](config[_0xc66a('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xc66a('0xc'))(new Redis(config[_0xc66a('0xa')]));var def={'method':_0xc66a('0xd'),'json':!![]};function emit(_0x3f6676,_0x193df4,_0x4d6df3){io['to'](_0x3f6676)[_0xc66a('0xe')](_0x193df4,_0x4d6df3);}function getTicket(_0x1d42e6,_0x49d214,_0x3d59e6,_0x2d1f38,_0x380d64,_0x40ee37,_0x2562ee,_0x3e3d0d){logger[_0xc66a('0xf')](_0xc66a('0x10'));var _0x148523=new Date();var _0x5acd7e=[{'name':_0xc66a('0x11'),'value':intUtil[_0xc66a('0x12')](_0x2d1f38['Subjects'],_0x380d64,'\x20')},{'name':_0xc66a('0x13'),'value':_0x49d214['id']},{'name':_0xc66a('0x14'),'value':_0x49d214['id']},{'name':_0xc66a('0x15'),'value':intUtil[_0xc66a('0x12')](_0x2d1f38[_0xc66a('0x16')],_0x380d64,'\x0a')},{'name':_0xc66a('0x17'),'value':_0x148523[_0xc66a('0x18')]()[_0xc66a('0x19')](0x0,0x13)[_0xc66a('0x1a')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xc66a('0x1b'),'value':'15'},{'name':'parent_id','value':_0x3d59e6['id']},{'name':_0xc66a('0x1c'),'value':_0xc66a('0x1d')},{'name':'parent_name','value':_0x3d59e6['name']},{'name':_0xc66a('0x1e'),'value':_0x3e3d0d}];if(_0x40ee37[_0xc66a('0x1f')]){_[_0xc66a('0x20')](_0x40ee37,function(_0x21d4cb){if(_0x380d64[_0x21d4cb['variableName']]){_0x5acd7e[_0xc66a('0x21')]({'name':_0x21d4cb[_0xc66a('0x22')],'value':_0x380d64[_0x21d4cb[_0xc66a('0x23')]]});}});}return request({'form':{'method':_0xc66a('0x24'),'input_type':_0xc66a('0x25'),'response_type':'JSON','rest_data':JSON[_0xc66a('0x26')]({'session':_0x2562ee['id'],'module_name':'Calls','name_value_list':_0x5acd7e})}});}function getAuth(_0x57e114){return util['format'](_0xc66a('0x27'),new Buffer(_0x57e114[_0xc66a('0x28')]+':X')[_0xc66a('0x29')](_0xc66a('0x2a')));}function getServerInfo(_0x50f60d){return request({'form':{'method':_0xc66a('0x2b'),'input_type':_0xc66a('0x25'),'response_type':_0xc66a('0x25'),'rest_data':JSON[_0xc66a('0x26')]({'session':_0x50f60d['id']})}});}function getUser(_0x1380a,_0x3d48a4,_0x2dfddb){if(!_[_0xc66a('0x2c')](_0x3d48a4)){logger[_0xc66a('0xf')](_0xc66a('0x2d'),_0x3d48a4);return request({'form':{'method':_0xc66a('0x2e'),'input_type':_0xc66a('0x25'),'response_type':'JSON','rest_data':JSON[_0xc66a('0x26')]({'session':_0x2dfddb['id'],'module_name':_0xc66a('0x2f'),'query':util[_0xc66a('0x30')](_0xc66a('0x31'),_0x3d48a4),'order_by':'','offset':'0','select_fields':['id',_0xc66a('0x11'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x212eb6){if(_0x212eb6[_0xc66a('0x32')]['length']){var _0x2166bc=_[_0xc66a('0x33')](_0x212eb6[_0xc66a('0x32')],function(_0x11d330){return _0x11d330[_0xc66a('0x34')][_0xc66a('0x35')][_0xc66a('0x36')]===_0x3d48a4;});if(_0x2166bc){logger[_0xc66a('0xf')]('Agent\x20found!');return BPromise[_0xc66a('0x37')]({'id':_0x2166bc[_0xc66a('0x34')]['id'][_0xc66a('0x36')],'name':_0x2166bc[_0xc66a('0x34')][_0xc66a('0x11')][_0xc66a('0x36')]});}}logger[_0xc66a('0xf')](_0xc66a('0x38'));return BPromise[_0xc66a('0x37')]({'id':_0x2dfddb[_0xc66a('0x34')][_0xc66a('0x39')]['value'],'name':_0x2dfddb[_0xc66a('0x34')][_0xc66a('0x35')][_0xc66a('0x36')]});});}else{logger[_0xc66a('0xf')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xc66a('0x37')]({'id':_0x2dfddb[_0xc66a('0x34')][_0xc66a('0x39')][_0xc66a('0x36')],'name':_0x2dfddb[_0xc66a('0x34')][_0xc66a('0x35')][_0xc66a('0x36')]});}}function getEndUser(_0x37349d,_0x54a1d6,_0x4161f1,_0x34891b){logger['info']('Searching\x20enduser\x20with\x20phone',_0x4161f1);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xc66a('0x25'),'rest_data':JSON['stringify']({'session':_0x34891b['id'],'module_name':_0xc66a('0x1d'),'query':util['format'](_0xc66a('0x3a'),_0x4161f1),'order_by':'','offset':'0','select_fields':['id',_0xc66a('0x11'),_0xc66a('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc66a('0x3c')](function(_0x4d7769){if(_0x4d7769['entry_list']['length']){var _0x5383c6=_['find'](_0x4d7769['entry_list'],function(_0x2edc72){return _0x2edc72['name_value_list'][_0xc66a('0x3b')][_0xc66a('0x36')]===_0x4161f1;});if(_0x5383c6){logger[_0xc66a('0xf')](_0xc66a('0x3d'));return BPromise[_0xc66a('0x37')]({'id':_0x5383c6[_0xc66a('0x34')]['id'][_0xc66a('0x36')],'name':_0x5383c6['name_value_list'][_0xc66a('0x11')][_0xc66a('0x36')],'phone':_0x5383c6[_0xc66a('0x34')][_0xc66a('0x3b')]['value']});}}else{logger[_0xc66a('0xf')](_0xc66a('0x3e'));return request({'form':{'method':'set_entry','input_type':_0xc66a('0x25'),'response_type':_0xc66a('0x25'),'rest_data':JSON[_0xc66a('0x26')]({'session':_0x34891b['id'],'module_name':_0xc66a('0x1d'),'name_value_list':[{'name':_0xc66a('0x3f'),'value':_0x54a1d6!==_0xc66a('0x40')?_0x54a1d6:util[_0xc66a('0x30')]('Caller\x20-\x20%s',_0x4161f1)},{'name':'phone_home','value':_0x4161f1}]})}})[_0xc66a('0x3c')](function(_0x5bb617){logger[_0xc66a('0xf')](_0xc66a('0x41'));return BPromise['resolve']({'id':_0x5bb617['id'],'name':_0x5bb617['entry_list']['first_name'][_0xc66a('0x36')],'phone':_0x5bb617[_0xc66a('0x32')][_0xc66a('0x3b')][_0xc66a('0x36')]});});}});}function request(_0x2a9aa5){logger[_0xc66a('0x42')](_0xc66a('0x43'),JSON['stringify'](_0x2a9aa5));return rp(_[_0xc66a('0x44')](def,_0x2a9aa5));}function getTags(_0x2df4cd,_0x13dadb){var _0x55603b=[];if(_0x2df4cd&&_0x2df4cd[_0xc66a('0x1f')]>0x0){_0x55603b=_[_0xc66a('0x45')](_0x2df4cd,_0x13dadb);}return _0x55603b;}function getCustomFields(_0x419219,_0x253b37){var _0x5e52d0=[];var _0x3fd18b={'custom_fields':[]};if(_0x419219[_0xc66a('0x1f')]>0x0){_[_0xc66a('0x20')](_0x419219,function(_0x43b549){if(_0x43b549[_0xc66a('0x46')]==='string'&&_0x43b549[_0xc66a('0x47')]&&!_0x43b549[_0xc66a('0x48')]){_0x3fd18b[_0x43b549['nameField'][_0xc66a('0x49')]()]=_0x43b549[_0xc66a('0x4a')][_0xc66a('0x29')]();}else if(_0x43b549[_0xc66a('0x46')]==='string'&&_0x43b549[_0xc66a('0x22')]&&_0x43b549[_0xc66a('0x48')]){_0x3fd18b[_0xc66a('0x4b')][_0xc66a('0x21')]({'id':_0x43b549[_0xc66a('0x22')],'value':_0x43b549[_0xc66a('0x4a')][_0xc66a('0x29')]()});}else if(_0x43b549[_0xc66a('0x46')]===_0xc66a('0x4c')&&_0x43b549[_0xc66a('0x23')]&&_0x43b549['idField']&&_0x43b549['customField']){_0x253b37[_0x43b549['variableName']]&&_0x3fd18b[_0xc66a('0x4b')][_0xc66a('0x21')]({'id':_0x43b549[_0xc66a('0x22')],'value':_0x253b37[_0x43b549[_0xc66a('0x23')]]['toString']()});}else if(_0x43b549[_0xc66a('0x46')]===_0xc66a('0x4d')&&_0x43b549[_0xc66a('0x4e')]&&_0x43b549[_0xc66a('0x4e')][_0xc66a('0x11')]&&_0x43b549[_0xc66a('0x22')]&&_0x43b549[_0xc66a('0x48')]){_0x253b37[_0x43b549[_0xc66a('0x4e')][_0xc66a('0x11')][_0xc66a('0x49')]()]&&_0x3fd18b[_0xc66a('0x4b')][_0xc66a('0x21')]({'id':_0x43b549[_0xc66a('0x22')],'value':_0x253b37[_0x43b549[_0xc66a('0x4e')][_0xc66a('0x11')]['toLowerCase']()][_0xc66a('0x29')]()});}});}return _0x3fd18b;}function getConnection(_0x5d842f){return request({'method':'POST','form':{'method':_0xc66a('0x4f'),'input_type':'JSON','response_type':_0xc66a('0x25'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5d842f[_0xc66a('0x50')],'password':_0x5d842f[_0xc66a('0x51')],'encryption':'PLAIN'},'application':_0xc66a('0x52')})}})[_0xc66a('0x3c')](function(_0xb467c4){var _0x4ede73=_0xb467c4;if(_0x4ede73['id']){def[_0xc66a('0x53')]=_0x4ede73['id'];return BPromise['resolve'](_0x4ede73);}else{throw new Error(util[_0xc66a('0x30')](_0xc66a('0x54'),_0x5d842f['id']));}});}function setRelationship(_0x4cef12,_0x4f28b3,_0x4b8eea,_0x5d90b2){return request({'form':{'method':_0xc66a('0x55'),'input_type':_0xc66a('0x25'),'response_type':'JSON','rest_data':JSON[_0xc66a('0x26')]({'session':_0x4cef12['id'],'module_name':'Calls','module_id':_0x4b8eea['id'],'link_field_name':_0x5d90b2,'related_ids':[_0x4f28b3['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x262b0f,_0x3d5818,_0x4e1b77,_0x19d2a5,_0x5d1bc8,_0x35be6a){var _0x1a30ef,_0x2329fa,_0x52257e,_0x3b6c30;_0x35be6a['remoteUri']=intUtil['stripTrailingSlash'](_0x35be6a['remoteUri']);_0x35be6a[_0xc66a('0x56')]=intUtil[_0xc66a('0x57')](_0x35be6a[_0xc66a('0x56')]);def[_0xc66a('0x58')]=util[_0xc66a('0x30')](_0xc66a('0x59'),_0x35be6a['remoteUri']);if(_0x5d1bc8&&_0x5d1bc8[_0xc66a('0x5a')]){logger[_0xc66a('0xf')](_0xc66a('0x5b'),'Recording\x20is\x20enabled!');_0x3d5818[_0xc66a('0x5c')]=util[_0xc66a('0x30')](_0xc66a('0x5d'),_0x35be6a[_0xc66a('0x56')],_0x3d5818['uniqueid'],md5(_0x3d5818[_0xc66a('0x5e')]));}else{_0x3d5818['recordingURL']='';}return getConnection(_0x35be6a)[_0xc66a('0x3c')](function(_0x1ab738){_0x3b6c30=_0x1ab738;return getUser(_0x35be6a,_0x19d2a5[_0xc66a('0x11')],_0x3b6c30);})[_0xc66a('0x3c')](function(_0x45db6e){_0x1a30ef=_0x45db6e;logger['info'](_0xc66a('0x5f'),_0x1a30ef['id']);return getEndUser(_0x35be6a,_0x3d5818[_0xc66a('0x60')],_0x3d5818[_0xc66a('0x61')],_0x3b6c30);})[_0xc66a('0x3c')](function(_0x3621e5){_0x2329fa=_0x3621e5;logger[_0xc66a('0xf')](_0xc66a('0x62'),_0x2329fa['id']);return getTicket(_0x35be6a,_0x1a30ef,_0x2329fa,_0x4e1b77,_0x3d5818,_0x4e1b77[_0xc66a('0x63')],_0x3b6c30,_0xc66a('0x64'));})[_0xc66a('0x3c')](function(_0x457e70){_0x52257e=_0x457e70;logger[_0xc66a('0xf')](_0xc66a('0x65'));logger[_0xc66a('0xf')](_0xc66a('0x66'),_0x52257e['id']);return setRelationship(_0x3b6c30,_0x1a30ef,_0x52257e,_0xc66a('0x67'));})[_0xc66a('0x3c')](function(){return setRelationship(_0x3b6c30,_0x2329fa,_0x52257e,_0xc66a('0x68'));})[_0xc66a('0x3c')](function(){return getServerInfo(_0x3b6c30);})[_0xc66a('0x3c')](function(_0x11d0f6){var _0x48e818=parseInt(_0x11d0f6[_0xc66a('0x69')][_0xc66a('0x6a')](0x0));var _0x326dda=util[_0xc66a('0x30')](_0xc66a('0x6b'),_0x35be6a[_0xc66a('0x6c')],_0x52257e['id']);if(_0x48e818>0x6){_0x326dda=util[_0xc66a('0x30')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x35be6a[_0xc66a('0x6c')],_0x52257e['id']);}logger[_0xc66a('0xf')](_0xc66a('0x5b'),_0xc66a('0x6d'));emit(util[_0xc66a('0x30')](_0xc66a('0x6e'),_0x19d2a5[_0xc66a('0x11')]),'trigger:browser:url',{'uri':_0x326dda});})[_0xc66a('0x6f')](function(_0xf0d83c){logger['error'](_0xc66a('0x5b'),JSON['stringify'](_0xf0d83c));});};exports[_0xc66a('0x70')]=function(_0x15882d,_0x449355,_0x507a01,_0x857f4f,_0x789b60,_0x3b9c1b,_0x3af60a){var _0x189881,_0x4ad1af,_0x4abc3e,_0x296ebf;_0x3b9c1b[_0xc66a('0x6c')]=intUtil[_0xc66a('0x57')](_0x3b9c1b[_0xc66a('0x6c')]);_0x3b9c1b['serverUrl']=intUtil[_0xc66a('0x57')](_0x3b9c1b[_0xc66a('0x56')]);def[_0xc66a('0x58')]=util[_0xc66a('0x30')]('%s/service/v4_1/rest.php',_0x3b9c1b[_0xc66a('0x6c')]);if(_0x3af60a&&_0x3af60a[_0xc66a('0x71')]&&_0x3af60a['recordingFormat']!==_0xc66a('0x72')){logger[_0xc66a('0xf')](_0xc66a('0x73'),_0xc66a('0x74'));_0x449355['recordingURL']=util[_0xc66a('0x30')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b9c1b[_0xc66a('0x56')],_0x449355[_0xc66a('0x5e')],md5(_0x449355[_0xc66a('0x5e')]));}return getConnection(_0x3b9c1b)[_0xc66a('0x3c')](function(_0x6629cd){_0x296ebf=_0x6629cd;return getUser(_0x3b9c1b,_0x857f4f[_0xc66a('0x11')],_0x296ebf);})[_0xc66a('0x3c')](function(_0xb758bb){_0x189881=_0xb758bb;logger['info'](_0xc66a('0x5f'),_0x189881['id']);return getEndUser(_0x3b9c1b,_0x449355['destcalleridname'],_0x449355[_0xc66a('0x75')],_0x296ebf);})['then'](function(_0x5e28c4){_0x4ad1af=_0x5e28c4;logger[_0xc66a('0xf')](_0xc66a('0x62'),_0x4ad1af['id']);return getTicket(_0x3b9c1b,_0x189881,_0x4ad1af,_0x507a01,_0x449355,_0x507a01[_0xc66a('0x63')],_0x296ebf,_0xc66a('0x76'));})[_0xc66a('0x3c')](function(_0x2537d9){_0x4abc3e=_0x2537d9;logger[_0xc66a('0xf')]('Ticket\x20created!');logger[_0xc66a('0xf')](_0xc66a('0x66'),_0x4abc3e['id']);return setRelationship(_0x296ebf,_0x189881,_0x4abc3e,_0xc66a('0x67'));})[_0xc66a('0x3c')](function(){return setRelationship(_0x296ebf,_0x4ad1af,_0x4abc3e,_0xc66a('0x68'));})[_0xc66a('0x3c')](function(){return getServerInfo(_0x296ebf);})[_0xc66a('0x3c')](function(_0x34215d){var _0x19ba3d=parseInt(_0x34215d[_0xc66a('0x69')][_0xc66a('0x6a')](0x0));var _0x2755e4=util[_0xc66a('0x30')](_0xc66a('0x6b'),_0x3b9c1b['remoteUri'],_0x4abc3e['id']);if(_0x19ba3d>0x6){_0x2755e4=util[_0xc66a('0x30')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3b9c1b[_0xc66a('0x6c')],_0x4abc3e['id']);}logger['info'](_0xc66a('0x73'),_0xc66a('0x6d'));emit(util[_0xc66a('0x30')](_0xc66a('0x6e'),_0x857f4f['name']),'trigger:browser:url',{'uri':_0x2755e4});})[_0xc66a('0x6f')](function(_0x5b4cca){logger[_0xc66a('0x77')](_0xc66a('0x73'),JSON[_0xc66a('0x26')](_0x5b4cca));});};exports[_0xc66a('0x78')]=function(_0x154162,_0x4ce49d,_0x5dbe6c,_0xb99758,_0x14adcd,_0x4b9856){var _0x2ccc73,_0x1a01f9,_0x15a193,_0x53d31c;_0x4b9856['remoteUri']=intUtil['stripTrailingSlash'](_0x4b9856['remoteUri']);_0x4b9856[_0xc66a('0x56')]=intUtil[_0xc66a('0x57')](_0x4b9856[_0xc66a('0x56')]);def[_0xc66a('0x58')]=util['format']('%s/service/v4_1/rest.php',_0x4b9856[_0xc66a('0x6c')]);if(_0x14adcd&&_0x14adcd[_0xc66a('0x5a')]){logger['info']('['+_0x4ce49d[_0xc66a('0x79')][_0xc66a('0x7a')]()+']',_0xc66a('0x74'));_0x4ce49d[_0xc66a('0x5c')]=util[_0xc66a('0x30')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b9856[_0xc66a('0x56')],_0x4ce49d[_0xc66a('0x5e')],md5(_0x4ce49d[_0xc66a('0x5e')]));}else{_0x4ce49d[_0xc66a('0x5c')]='';}return getConnection(_0x4b9856)['then'](function(_0x1675c2){_0x53d31c=_0x1675c2;if(!_['isNil'](_0xb99758)){return getUser(_0x4b9856,_0xb99758[_0xc66a('0x11')],_0x53d31c);}else{return getUser(_0x4b9856,null,_0x53d31c);}})['then'](function(_0x370df1){_0x2ccc73=_0x370df1;logger[_0xc66a('0xf')](_0xc66a('0x5f'),_0x2ccc73['id']);return getEndUser(_0x4b9856,_0x4ce49d['calleridname'],_0x4ce49d[_0xc66a('0x61')],_0x53d31c);})[_0xc66a('0x3c')](function(_0x3dc172){_0x1a01f9=_0x3dc172;logger[_0xc66a('0xf')]('The\x20Enduser\x20ID\x20is:',_0x1a01f9['id']);return getTicket(_0x4b9856,_0x2ccc73,_0x1a01f9,_0x5dbe6c,_0x4ce49d,_0x5dbe6c[_0xc66a('0x63')],_0x53d31c,_0xc66a('0x64'));})[_0xc66a('0x3c')](function(_0x40dcee){_0x15a193=_0x40dcee;logger[_0xc66a('0xf')](_0xc66a('0x65'));logger[_0xc66a('0xf')]('The\x20Ticket\x20ID\x20is:',_0x15a193['id']);return setRelationship(_0x53d31c,_0x2ccc73,_0x15a193,_0xc66a('0x67'));})[_0xc66a('0x3c')](function(){return setRelationship(_0x53d31c,_0x1a01f9,_0x15a193,_0xc66a('0x68'));})[_0xc66a('0x3c')](function(){return getServerInfo(_0x53d31c);})['catch'](function(_0x22fd7c){logger[_0xc66a('0x77')]('['+_0x4ce49d[_0xc66a('0x79')][_0xc66a('0x7a')]()+']',JSON['stringify'](_0x22fd7c));});}; \ 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 a9b777d..8aaa64e 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 _0xd322=['format','%s:\x20%s','keyContent','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','string','push','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key'];(function(_0x49333a,_0x5aa0db){var _0x5db050=function(_0x194493){while(--_0x194493){_0x49333a['push'](_0x49333a['shift']());}};_0x5db050(++_0x5aa0db);}(_0xd322,0x14e));var _0x2d32=function(_0x5299db,_0x4da9ad){_0x5299db=_0x5299db-0x0;var _0x2251f8=_0xd322[_0x5299db];return _0x2251f8;};'use strict';var _=require(_0x2d32('0x0'));var util=require(_0x2d32('0x1'));exports[_0x2d32('0x2')]=function(_0x333272,_0x5e6682,_0x1d7916){var _0x146208=[];if(_0x333272[_0x2d32('0x3')]>0x0){var _0x415b25=_[_0x2d32('0x4')](_0x333272,['id']);for(var _0x34b0d1=0x0;_0x34b0d1<_0x415b25[_0x2d32('0x3')];_0x34b0d1++){var _0x9e9344=_0x415b25[_0x34b0d1];if(_0x9e9344['type']===_0x2d32('0x5')){_0x146208[_0x2d32('0x6')](_0x9e9344['content']);}else if(_0x9e9344[_0x2d32('0x7')]===_0x2d32('0x8')&&_0x9e9344['variableName']){_0x5e6682[_0x9e9344[_0x2d32('0x9')]]&&_0x146208[_0x2d32('0x6')](_0x5e6682[_0x9e9344[_0x2d32('0x9')]][_0x2d32('0xa')]());}else if(_0x9e9344['type']===_0x2d32('0xb')&&_0x9e9344[_0x2d32('0xc')]&&_0x9e9344[_0x2d32('0xc')][_0x2d32('0xd')]){_0x5e6682[_0x9e9344[_0x2d32('0xc')][_0x2d32('0xd')][_0x2d32('0xe')]()]&&_0x146208[_0x2d32('0x6')](_0x5e6682[_0x9e9344[_0x2d32('0xc')][_0x2d32('0xd')]['toLowerCase']()]['toString']());}else if(_0x9e9344[_0x2d32('0x7')]==='keyValue'){if(_0x9e9344[_0x2d32('0xf')]===_0x2d32('0x5')&&_0x9e9344[_0x2d32('0x10')]){_0x146208[_0x2d32('0x6')](util[_0x2d32('0x11')](_0x2d32('0x12'),_0x9e9344[_0x2d32('0x10')],_0x9e9344[_0x2d32('0x13')]));}else if(_0x9e9344[_0x2d32('0xf')]===_0x2d32('0x8')&&_0x9e9344[_0x2d32('0x9')]&&_0x9e9344[_0x2d32('0x10')]){_0x5e6682[_0x9e9344[_0x2d32('0x9')]]&&_0x146208[_0x2d32('0x6')](util[_0x2d32('0x11')]('%s:\x20%s',_0x9e9344[_0x2d32('0x10')],_0x5e6682[_0x9e9344[_0x2d32('0x9')]]));}else if(_0x9e9344[_0x2d32('0xf')]==='customVariable'&&_0x9e9344['Variable']&&_0x9e9344[_0x2d32('0xc')]['name']&&_0x9e9344[_0x2d32('0x10')]){_0x5e6682[_0x9e9344[_0x2d32('0xc')][_0x2d32('0xd')][_0x2d32('0xe')]()]&&_0x146208[_0x2d32('0x6')](util['format'](_0x2d32('0x12'),_0x9e9344[_0x2d32('0x10')],_0x5e6682[_0x9e9344[_0x2d32('0xc')]['name'][_0x2d32('0xe')]()]));}}}}return _0x146208[_0x2d32('0x14')](_0x1d7916);};exports[_0x2d32('0x15')]=function(_0x1185bd){var _0x4d4003=_0x1185bd['slice'](-0x1);if(_0x4d4003==='/'){_0x1185bd=_0x1185bd[_0x2d32('0x16')](0x0,_0x1185bd[_0x2d32('0x17')](_0x4d4003));}return _0x1185bd;};exports[_0x2d32('0x18')]=function(_0x53b807){if(!_[_0x2d32('0x19')](_0x53b807)&&_0x53b807!==''){var _0x35faf5=/^(([^<>()\[\]\\.,;:\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 _0x35faf5[_0x2d32('0x1a')](String(_0x53b807)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x614b=['variableName','customVariable','Variable','name','toLowerCase','toString','type','keyValue','keyType','key','format','variable','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','util','getString','length','string','push'];(function(_0x58af4d,_0x40118a){var _0x2475b0=function(_0x4b1bf6){while(--_0x4b1bf6){_0x58af4d['push'](_0x58af4d['shift']());}};_0x2475b0(++_0x40118a);}(_0x614b,0x1b4));var _0xb614=function(_0x43b1a5,_0x2e1794){_0x43b1a5=_0x43b1a5-0x0;var _0xe98826=_0x614b[_0x43b1a5];return _0xe98826;};'use strict';var _=require(_0xb614('0x0'));var util=require(_0xb614('0x1'));exports[_0xb614('0x2')]=function(_0x250799,_0x338524,_0x34fb8b){var _0x226586=[];if(_0x250799[_0xb614('0x3')]>0x0){var _0x2cdca0=_['sortBy'](_0x250799,['id']);for(var _0x4b1939=0x0;_0x4b1939<_0x2cdca0['length'];_0x4b1939++){var _0x2ce2a4=_0x2cdca0[_0x4b1939];if(_0x2ce2a4['type']===_0xb614('0x4')){_0x226586[_0xb614('0x5')](_0x2ce2a4['content']);}else if(_0x2ce2a4['type']==='variable'&&_0x2ce2a4[_0xb614('0x6')]){_0x338524[_0x2ce2a4[_0xb614('0x6')]]&&_0x226586[_0xb614('0x5')](_0x338524[_0x2ce2a4[_0xb614('0x6')]]['toString']());}else if(_0x2ce2a4['type']===_0xb614('0x7')&&_0x2ce2a4[_0xb614('0x8')]&&_0x2ce2a4[_0xb614('0x8')]['name']){_0x338524[_0x2ce2a4[_0xb614('0x8')][_0xb614('0x9')][_0xb614('0xa')]()]&&_0x226586[_0xb614('0x5')](_0x338524[_0x2ce2a4['Variable'][_0xb614('0x9')]['toLowerCase']()][_0xb614('0xb')]());}else if(_0x2ce2a4[_0xb614('0xc')]===_0xb614('0xd')){if(_0x2ce2a4[_0xb614('0xe')]===_0xb614('0x4')&&_0x2ce2a4[_0xb614('0xf')]){_0x226586[_0xb614('0x5')](util[_0xb614('0x10')]('%s:\x20%s',_0x2ce2a4[_0xb614('0xf')],_0x2ce2a4['keyContent']));}else if(_0x2ce2a4[_0xb614('0xe')]===_0xb614('0x11')&&_0x2ce2a4[_0xb614('0x6')]&&_0x2ce2a4[_0xb614('0xf')]){_0x338524[_0x2ce2a4[_0xb614('0x6')]]&&_0x226586['push'](util[_0xb614('0x10')](_0xb614('0x12'),_0x2ce2a4[_0xb614('0xf')],_0x338524[_0x2ce2a4[_0xb614('0x6')]]));}else if(_0x2ce2a4[_0xb614('0xe')]==='customVariable'&&_0x2ce2a4[_0xb614('0x8')]&&_0x2ce2a4[_0xb614('0x8')][_0xb614('0x9')]&&_0x2ce2a4['key']){_0x338524[_0x2ce2a4[_0xb614('0x8')]['name'][_0xb614('0xa')]()]&&_0x226586[_0xb614('0x5')](util[_0xb614('0x10')](_0xb614('0x12'),_0x2ce2a4[_0xb614('0xf')],_0x338524[_0x2ce2a4[_0xb614('0x8')][_0xb614('0x9')][_0xb614('0xa')]()]));}}}}return _0x226586[_0xb614('0x13')](_0x34fb8b);};exports[_0xb614('0x14')]=function(_0x5ecfc3){var _0x53ded3=_0x5ecfc3[_0xb614('0x15')](-0x1);if(_0x53ded3==='/'){_0x5ecfc3=_0x5ecfc3[_0xb614('0x16')](0x0,_0x5ecfc3[_0xb614('0x17')](_0x53ded3));}return _0x5ecfc3;};exports[_0xb614('0x18')]=function(_0x56e7a8){if(!_['isNil'](_0x56e7a8)&&_0x56e7a8!==''){var _0x3ce17a=/^(([^<>()\[\]\\.,;:\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 _0x3ce17a[_0xb614('0x19')](String(_0x56e7a8)['toLowerCase']());}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 fc3b1bd..b198ff1 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x29b14a,_0x23413f){var _0xc6d984=function(_0x4f2295){while(--_0x4f2295){_0x29b14a['push'](_0x29b14a['shift']());}};_0xc6d984(++_0x23413f);}(_0x34e8,0x12c));var _0x834e=function(_0xc129a6,_0x2b38f6){_0xc129a6=_0xc129a6-0x0;var _0x1259f=_0x34e8[_0xc129a6];return _0x1259f;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 2b4928d..fc6208b 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 _0x0587=['zendesk','defaults','localhost','socket.io-emitter','redis','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','type','nameField','customField','picklist','idField','custom_fields','push','content','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','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','./util','../../../../config/environment'];(function(_0x5c01aa,_0x5e5b59){var _0x4d155e=function(_0x1e96be){while(--_0x1e96be){_0x5c01aa['push'](_0x5c01aa['shift']());}};_0x4d155e(++_0x5e5b59);}(_0x0587,0x6e));var _0x7058=function(_0x86ce09,_0x2c3244){_0x86ce09=_0x86ce09-0x0;var _0x5c00ef=_0x0587[_0x86ce09];return _0x5c00ef;};'use strict';var _=require(_0x7058('0x0'));var rp=require('request-promise');var md5=require(_0x7058('0x1'));var util=require(_0x7058('0x2'));var Redis=require('ioredis');var intUtil=require(_0x7058('0x3'));var config=require(_0x7058('0x4'));var logger=require('../../../../config/logger')(_0x7058('0x5'));config['redis']=_[_0x7058('0x6')](config['redis'],{'host':_0x7058('0x7'),'port':0x18eb});var io=require(_0x7058('0x8'))(new Redis(config[_0x7058('0x9')]));function emit(_0x23837a,_0x2aed22,_0x19818c){io['to'](_0x23837a)[_0x7058('0xa')](_0x2aed22,_0x19818c);}var headers={'Content-Type':'application/json','Accept':_0x7058('0xb')};function getTicket(_0x110bdf,_0x22f8ad,_0xde5183,_0x34af8f,_0x354403){logger[_0x7058('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x7058('0xd')](_0x7058('0xe'),_0x110bdf[_0x7058('0xf')]),'method':_0x7058('0x10'),'body':{'ticket':_[_0x7058('0x11')]({'requester_id':_0xde5183['id'],'submitter_id':_0x22f8ad?_0x22f8ad['id']:undefined,'assignee_id':_0x22f8ad?_0x22f8ad['id']:undefined,'tags':getTags(_0x34af8f[_0x7058('0x12')],_0x7058('0x13')),'subject':intUtil[_0x7058('0x14')](_0x34af8f[_0x7058('0x15')],_0x354403,'\x20'),'description':intUtil['getString'](_0x34af8f['Descriptions'],_0x354403,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7058('0x14')](_0x34af8f[_0x7058('0x16')],_0x354403,'\x0a')}},getCustomFields(_0x34af8f[_0x7058('0x17')],_0x354403))}})['then'](function(_0x453a22){logger[_0x7058('0xc')](_0x7058('0x18'));return _0x453a22[_0x7058('0x19')];});}function getUser(_0x4047a7,_0x4d24cb){if(intUtil[_0x7058('0x1a')](_0x4d24cb)){logger[_0x7058('0xc')](_0x7058('0x1b'),_0x4d24cb);return request({'uri':util[_0x7058('0xd')](_0x7058('0x1c'),_0x4047a7[_0x7058('0xf')]),'qs':{'query':util[_0x7058('0xd')](_0x7058('0x1d'),_0x4d24cb)}})['then'](function(_0x44178a){if(_0x44178a['count']){logger[_0x7058('0xc')](_0x7058('0x1e'));return _[_0x7058('0x1f')](_0x44178a[_0x7058('0x20')],{'email':_0x4d24cb,'role':_0x7058('0x21')});}else{logger[_0x7058('0xc')](_0x7058('0x22'));return request({'uri':util[_0x7058('0xd')](_0x7058('0x23'),_0x4047a7['remoteUri'])})[_0x7058('0x24')](function(_0x534d9f){logger[_0x7058('0xc')](_0x7058('0x25'));return _0x534d9f[_0x7058('0x26')];});}});}else{logger['info'](_0x7058('0x22'));return request({'uri':util[_0x7058('0xd')](_0x7058('0x23'),_0x4047a7[_0x7058('0xf')])})['then'](function(_0x442379){logger[_0x7058('0xc')](_0x7058('0x25'));return _0x442379[_0x7058('0x26')];});}}function getEndUser(_0x3e0b03,_0x1462aa,_0x237ead){logger[_0x7058('0xc')](_0x7058('0x27'),_0x237ead);return request({'uri':util['format'](_0x7058('0x1c'),_0x3e0b03['remoteUri']),'qs':{'query':util[_0x7058('0xd')](_0x7058('0x28'),_0x237ead)}})[_0x7058('0x24')](function(_0x49b9f9){var _0x27982a;if(_0x49b9f9[_0x7058('0x20')][_0x7058('0x29')]){_0x49b9f9['results']=_[_0x7058('0x2a')](_0x49b9f9[_0x7058('0x20')],{'suspended':![],'role':_0x7058('0x2b')});if(_0x49b9f9[_0x7058('0x20')][_0x7058('0x29')]){_0x27982a=_['first'](_0x49b9f9[_0x7058('0x20')]);}}if(_0x27982a){logger[_0x7058('0xc')](_0x7058('0x2c'));return _0x27982a;}else{logger[_0x7058('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x7058('0x2d'),_0x3e0b03[_0x7058('0xf')]),'method':_0x7058('0x10'),'body':{'user':{'role':_0x7058('0x2b'),'name':util[_0x7058('0xd')]('Caller\x20-\x20%s',_0x1462aa||_0x237ead),'phone':_0x237ead}}})[_0x7058('0x24')](function(_0x452a94){logger['info'](_0x7058('0x2e'));return _0x452a94[_0x7058('0x26')];});}});}function getAuth(_0x49f8e8){var _0x95e456;if(_0x49f8e8[_0x7058('0x2f')]===_0x7058('0x30')){_0x95e456=util[_0x7058('0xd')](_0x7058('0x31'),_0x49f8e8[_0x7058('0x32')],_0x49f8e8[_0x7058('0x30')]);}else if(_0x49f8e8[_0x7058('0x2f')]===_0x7058('0x33')){_0x95e456=util[_0x7058('0xd')]('%s/token:%s',_0x49f8e8[_0x7058('0x32')],_0x49f8e8['token']);}return util[_0x7058('0xd')](_0x7058('0x34'),new Buffer(_0x95e456)[_0x7058('0x35')](_0x7058('0x36')));}function request(_0x272864){logger[_0x7058('0x37')](_0x7058('0x38'),JSON[_0x7058('0x39')](_0x272864));return rp(_['defaults'](_0x272864,{'method':_0x7058('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x500820,_0xa52429){var _0x11647e=[];if(_0x500820&&_0x500820['length']>0x0){_0x11647e=_[_0x7058('0x3b')](_0x500820,_0xa52429);}return _0x11647e;}function getCustomFields(_0x4579dc,_0x300fc5){var _0xf95304=[];var _0x29cb40={'custom_fields':[]};if(_0x4579dc[_0x7058('0x29')]>0x0){_[_0x7058('0x3c')](_0x4579dc,function(_0x55b0f3){if(_[_0x7058('0x3d')]([_0x7058('0x3e'),'picklist'],_0x55b0f3[_0x7058('0x3f')])&&_0x55b0f3[_0x7058('0x40')]&&!_0x55b0f3[_0x7058('0x41')]){_0x29cb40[_0x55b0f3['nameField']['toLowerCase']()]=_0x55b0f3['content'][_0x7058('0x35')]();}else if(_['includes']([_0x7058('0x3e'),_0x7058('0x42')],_0x55b0f3[_0x7058('0x3f')])&&_0x55b0f3[_0x7058('0x43')]&&_0x55b0f3[_0x7058('0x41')]){_0x29cb40[_0x7058('0x44')][_0x7058('0x45')]({'id':_0x55b0f3['idField'],'value':_0x55b0f3[_0x7058('0x46')][_0x7058('0x35')]()});}else if(_0x55b0f3[_0x7058('0x3f')]===_0x7058('0x47')&&_0x55b0f3[_0x7058('0x48')]&&_0x55b0f3[_0x7058('0x43')]&&_0x55b0f3[_0x7058('0x41')]){_0x300fc5[_0x55b0f3[_0x7058('0x48')]]&&_0x29cb40['custom_fields'][_0x7058('0x45')]({'id':_0x55b0f3[_0x7058('0x43')],'value':_0x300fc5[_0x55b0f3[_0x7058('0x48')]][_0x7058('0x35')]()});}else if(_0x55b0f3[_0x7058('0x3f')]===_0x7058('0x49')&&_0x55b0f3['Variable']&&_0x55b0f3[_0x7058('0x4a')][_0x7058('0x13')]&&_0x55b0f3[_0x7058('0x43')]&&_0x55b0f3[_0x7058('0x41')]){_0x300fc5[_0x55b0f3[_0x7058('0x4a')][_0x7058('0x13')]['toLowerCase']()]&&_0x29cb40[_0x7058('0x44')][_0x7058('0x45')]({'id':_0x55b0f3[_0x7058('0x43')],'value':_0x300fc5[_0x55b0f3[_0x7058('0x4a')][_0x7058('0x13')][_0x7058('0x4b')]()]['toString']()});}});}return _0x29cb40;}exports[_0x7058('0x4c')]=function(_0x133077,_0x18e43f,_0x1b8c74,_0x5ee57f,_0x55c047,_0x3cac6a){var _0x417618,_0x4b274e;_0x3cac6a[_0x7058('0xf')]=intUtil[_0x7058('0x4d')](_0x3cac6a[_0x7058('0xf')]);_0x3cac6a[_0x7058('0x4e')]=intUtil[_0x7058('0x4d')](_0x3cac6a[_0x7058('0x4e')]);if(_0x55c047&&_0x55c047[_0x7058('0x4f')]){logger[_0x7058('0xc')]('[QUEUE]',_0x7058('0x50'));_0x18e43f[_0x7058('0x51')]=util[_0x7058('0xd')](_0x7058('0x52'),_0x3cac6a[_0x7058('0x4e')],_0x18e43f['uniqueid'],md5(_0x18e43f[_0x7058('0x53')]));}else{_0x18e43f[_0x7058('0x51')]='';}headers[_0x7058('0x54')]=getAuth(_0x3cac6a);return getUser(_0x3cac6a,_0x5ee57f['email'])['then'](function(_0x529dc8){_0x417618=_0x529dc8;logger[_0x7058('0xc')](_0x7058('0x55'),_0x417618['id']);return getEndUser(_0x3cac6a,_0x18e43f[_0x7058('0x56')],_0x18e43f['calleridnum']);})[_0x7058('0x24')](function(_0xcb13aa){_0x4b274e=_0xcb13aa;logger['info'](_0x7058('0x57'),_0x4b274e['id']);return getTicket(_0x3cac6a,_0x417618,_0x4b274e,_0x1b8c74,_0x18e43f);})[_0x7058('0x24')](function(_0x3edfbb){if(_0x3edfbb){logger[_0x7058('0xc')](_0x7058('0x58'),_0x3edfbb['id']);switch(_0x3cac6a[_0x7058('0x3f')]){case _0x7058('0x59'):logger[_0x7058('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x7058('0x5a'),_0x3cac6a[_0x7058('0xf')],_0x417618['id'],_0x3edfbb['id']),'method':_0x7058('0x10')});case _0x7058('0x5b'):logger[_0x7058('0xc')](_0x7058('0x5c'),_0x7058('0x5d'));emit(util[_0x7058('0xd')](_0x7058('0x5e'),_0x5ee57f['name']),_0x7058('0x5f'),{'uri':util[_0x7058('0xd')](_0x7058('0x60'),_0x3cac6a[_0x7058('0xf')]['replace']('/api/v2',''),_0x3edfbb['id'])});break;default:logger[_0x7058('0x61')](_0x7058('0x5c'),_0x7058('0x62'));}}})[_0x7058('0x63')](function(_0x58b9ed){logger[_0x7058('0x61')](_0x7058('0x64'),util[_0x7058('0x65')](_0x58b9ed,{'showHidden':!![],'depth':null}));});};exports[_0x7058('0x66')]=function(_0x6c770b,_0x4ce653,_0x3d808d,_0x37a37b,_0x579085,_0x501a97,_0x596d95){var _0x3135dd,_0x59d551;_0x501a97[_0x7058('0xf')]=intUtil[_0x7058('0x4d')](_0x501a97['remoteUri']);_0x501a97[_0x7058('0x4e')]=intUtil[_0x7058('0x4d')](_0x501a97[_0x7058('0x4e')]);if(_0x596d95&&_0x596d95[_0x7058('0x67')]&&_0x596d95[_0x7058('0x67')]!==_0x7058('0x68')){logger[_0x7058('0xc')](_0x7058('0x69'),_0x7058('0x50'));_0x4ce653['recordingURL']=util[_0x7058('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x501a97[_0x7058('0x4e')],_0x4ce653[_0x7058('0x53')],md5(_0x4ce653[_0x7058('0x53')]));}headers['Authorization']=getAuth(_0x501a97);return getUser(_0x501a97,_0x37a37b['email'])['then'](function(_0x8e886c){_0x3135dd=_0x8e886c;logger[_0x7058('0xc')]('The\x20User\x20ID\x20is:',_0x3135dd['id']);return getEndUser(_0x501a97,_0x4ce653[_0x7058('0x6a')],_0x4ce653[_0x7058('0x6b')]);})['then'](function(_0x3cc3d5){_0x59d551=_0x3cc3d5;logger[_0x7058('0xc')]('The\x20Enduser\x20ID\x20is:',_0x59d551['id']);return getTicket(_0x501a97,_0x3135dd,_0x59d551,_0x3d808d,_0x4ce653);})['then'](function(_0x455394){if(_0x455394){logger[_0x7058('0xc')](_0x7058('0x58'),_0x455394['id']);switch(_0x501a97[_0x7058('0x3f')]){case _0x7058('0x59'):logger['info'](_0x7058('0x69'),_0x7058('0x6c'));return request({'uri':util[_0x7058('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x501a97[_0x7058('0xf')],_0x3135dd['id'],_0x455394['id']),'method':_0x7058('0x10')});case'newTab':logger[_0x7058('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7058('0xd')]('user:%s',_0x37a37b[_0x7058('0x13')]),'trigger:browser:url',{'uri':util['format'](_0x7058('0x60'),_0x501a97[_0x7058('0xf')]['replace']('/api/v2',''),_0x455394['id'])});break;default:logger['error'](_0x7058('0x69'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7058('0x63')](function(_0x249d51){logger['error'](_0x7058('0x6d'),util[_0x7058('0x65')](_0x249d51,{'showHidden':!![],'depth':null}));});};exports[_0x7058('0x6e')]=function(_0x5c2f66,_0xa98720,_0x11c713,_0x3531aa,_0x1b5adb,_0x276921){var _0x3f7225,_0x1d30d2;_0x276921[_0x7058('0xf')]=intUtil['stripTrailingSlash'](_0x276921[_0x7058('0xf')]);_0x276921['serverUrl']=intUtil['stripTrailingSlash'](_0x276921[_0x7058('0x4e')]);if(_0x1b5adb&&_0x1b5adb[_0x7058('0x4f')]){logger[_0x7058('0xc')]('['+_0xa98720[_0x7058('0x6f')][_0x7058('0x70')]()+']',_0x7058('0x50'));_0xa98720['recordingURL']=util[_0x7058('0xd')](_0x7058('0x52'),_0x276921['serverUrl'],_0xa98720['uniqueid'],md5(_0xa98720[_0x7058('0x53')]));}else{_0xa98720[_0x7058('0x51')]='';}headers['Authorization']=getAuth(_0x276921);return getUser(_0x276921)[_0x7058('0x24')](function(_0x2ad8b4){_0x3f7225=_0x2ad8b4;logger[_0x7058('0xc')](_0x7058('0x55'),_0x3f7225['id']);return getEndUser(_0x276921,_0xa98720[_0x7058('0x56')],_0xa98720[_0x7058('0x71')]);})[_0x7058('0x24')](function(_0x25674d){_0x1d30d2=_0x25674d;logger[_0x7058('0xc')](_0x7058('0x57'),_0x1d30d2['id']);return getTicket(_0x276921,_0x3f7225,_0x1d30d2,_0x11c713,_0xa98720);})['then'](function(_0x2f3718){if(_0x2f3718){logger[_0x7058('0xc')]('The\x20Ticket\x20ID\x20is:',_0x2f3718['id']);}})['catch'](function(_0x3c2209){logger[_0x7058('0x61')]('['+_0xa98720['lastevent'][_0x7058('0x70')]()+']'+_0x7058('0x72'),util[_0x7058('0x65')](_0x3c2209,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x11fd=['Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','remoteUri','POST','getString','Subjects','Descriptions','Fields','then','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','%s:%s','password','token','%s/token:%s','username','Basic\x20%s','toString','[HTTP]','defaults','map','forEach','includes','picklist','nameField','toLowerCase','content','string','type','idField','customField','push','variable','variableName','customVariable','Variable','name','custom_fields','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x11fd,0xf6));var _0xd11f=function(_0x37f53c,_0x30083e){_0x37f53c=_0x37f53c-0x0;var _0x55438=_0x11fd[_0x37f53c];return _0x55438;};'use strict';var _=require(_0xd11f('0x0'));var rp=require(_0xd11f('0x1'));var md5=require(_0xd11f('0x2'));var util=require(_0xd11f('0x3'));var Redis=require(_0xd11f('0x4'));var intUtil=require(_0xd11f('0x5'));var config=require('../../../../config/environment');var logger=require(_0xd11f('0x6'))(_0xd11f('0x7'));config['redis']=_['defaults'](config[_0xd11f('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xd11f('0x9'))(new Redis(config['redis']));function emit(_0x2162a8,_0x127475,_0x533338){io['to'](_0x2162a8)[_0xd11f('0xa')](_0x127475,_0x533338);}var headers={'Content-Type':'application/json','Accept':_0xd11f('0xb')};function getTicket(_0xa718c2,_0x204d83,_0x2d2696,_0x5b6496,_0x414791){logger[_0xd11f('0xc')](_0xd11f('0xd'));return request({'uri':util['format']('%s/tickets.json',_0xa718c2[_0xd11f('0xe')]),'method':_0xd11f('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x2d2696['id'],'submitter_id':_0x204d83?_0x204d83['id']:undefined,'assignee_id':_0x204d83?_0x204d83['id']:undefined,'tags':getTags(_0x5b6496['Tags'],'name'),'subject':intUtil[_0xd11f('0x10')](_0x5b6496[_0xd11f('0x11')],_0x414791,'\x20'),'description':intUtil['getString'](_0x5b6496[_0xd11f('0x12')],_0x414791,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x5b6496[_0xd11f('0x12')],_0x414791,'\x0a')}},getCustomFields(_0x5b6496[_0xd11f('0x13')],_0x414791))}})[_0xd11f('0x14')](function(_0x390bb9){logger['info']('Ticket\x20created!');return _0x390bb9['ticket'];});}function getUser(_0x165a15,_0x4d438f){if(intUtil['validateEmail'](_0x4d438f)){logger['info'](_0xd11f('0x15'),_0x4d438f);return request({'uri':util[_0xd11f('0x16')](_0xd11f('0x17'),_0x165a15[_0xd11f('0xe')]),'qs':{'query':util[_0xd11f('0x16')](_0xd11f('0x18'),_0x4d438f)}})[_0xd11f('0x14')](function(_0x5f05f7){if(_0x5f05f7[_0xd11f('0x19')]){logger[_0xd11f('0xc')](_0xd11f('0x1a'));return _['find'](_0x5f05f7['results'],{'email':_0x4d438f,'role':_0xd11f('0x1b')});}else{logger[_0xd11f('0xc')](_0xd11f('0x1c'));return request({'uri':util[_0xd11f('0x16')]('%s/users/me.json',_0x165a15[_0xd11f('0xe')])})[_0xd11f('0x14')](function(_0x50fa89){logger[_0xd11f('0xc')](_0xd11f('0x1d'));return _0x50fa89[_0xd11f('0x1e')];});}});}else{logger[_0xd11f('0xc')](_0xd11f('0x1c'));return request({'uri':util['format'](_0xd11f('0x1f'),_0x165a15[_0xd11f('0xe')])})[_0xd11f('0x14')](function(_0x1eec24){logger[_0xd11f('0xc')](_0xd11f('0x1d'));return _0x1eec24[_0xd11f('0x1e')];});}}function getEndUser(_0x56a180,_0x5f3da3,_0x4adb3f){logger[_0xd11f('0xc')](_0xd11f('0x20'),_0x4adb3f);return request({'uri':util[_0xd11f('0x16')](_0xd11f('0x17'),_0x56a180[_0xd11f('0xe')]),'qs':{'query':util[_0xd11f('0x16')](_0xd11f('0x21'),_0x4adb3f)}})[_0xd11f('0x14')](function(_0x5584ac){var _0x456cda;if(_0x5584ac[_0xd11f('0x22')][_0xd11f('0x23')]){_0x5584ac['results']=_[_0xd11f('0x24')](_0x5584ac[_0xd11f('0x22')],{'suspended':![],'role':_0xd11f('0x25')});if(_0x5584ac['results']['length']){_0x456cda=_[_0xd11f('0x26')](_0x5584ac[_0xd11f('0x22')]);}}if(_0x456cda){logger[_0xd11f('0xc')](_0xd11f('0x27'));return _0x456cda;}else{logger['info'](_0xd11f('0x28'));return request({'uri':util[_0xd11f('0x16')](_0xd11f('0x29'),_0x56a180[_0xd11f('0xe')]),'method':_0xd11f('0xf'),'body':{'user':{'role':_0xd11f('0x25'),'name':util[_0xd11f('0x16')]('Caller\x20-\x20%s',_0x5f3da3||_0x4adb3f),'phone':_0x4adb3f}}})[_0xd11f('0x14')](function(_0x4d7263){logger['info'](_0xd11f('0x2a'));return _0x4d7263[_0xd11f('0x1e')];});}});}function getAuth(_0x7b025e){var _0x2e9db8;if(_0x7b025e['authType']==='password'){_0x2e9db8=util['format'](_0xd11f('0x2b'),_0x7b025e['username'],_0x7b025e[_0xd11f('0x2c')]);}else if(_0x7b025e['authType']===_0xd11f('0x2d')){_0x2e9db8=util[_0xd11f('0x16')](_0xd11f('0x2e'),_0x7b025e[_0xd11f('0x2f')],_0x7b025e[_0xd11f('0x2d')]);}return util[_0xd11f('0x16')](_0xd11f('0x30'),new Buffer(_0x2e9db8)[_0xd11f('0x31')]('base64'));}function request(_0x526985){logger['debug'](_0xd11f('0x32'),JSON['stringify'](_0x526985));return rp(_[_0xd11f('0x33')](_0x526985,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x585175,_0x1381dc){var _0x4dd161=[];if(_0x585175&&_0x585175[_0xd11f('0x23')]>0x0){_0x4dd161=_[_0xd11f('0x34')](_0x585175,_0x1381dc);}return _0x4dd161;}function getCustomFields(_0x2ff87c,_0x294dfe){var _0x5d535a=[];var _0x29661f={'custom_fields':[]};if(_0x2ff87c['length']>0x0){_[_0xd11f('0x35')](_0x2ff87c,function(_0x4cdeb2){if(_[_0xd11f('0x36')](['string',_0xd11f('0x37')],_0x4cdeb2['type'])&&_0x4cdeb2[_0xd11f('0x38')]&&!_0x4cdeb2['customField']){_0x29661f[_0x4cdeb2[_0xd11f('0x38')][_0xd11f('0x39')]()]=_0x4cdeb2[_0xd11f('0x3a')]['toString']();}else if(_[_0xd11f('0x36')]([_0xd11f('0x3b'),'picklist'],_0x4cdeb2[_0xd11f('0x3c')])&&_0x4cdeb2[_0xd11f('0x3d')]&&_0x4cdeb2[_0xd11f('0x3e')]){_0x29661f['custom_fields'][_0xd11f('0x3f')]({'id':_0x4cdeb2['idField'],'value':_0x4cdeb2['content']['toString']()});}else if(_0x4cdeb2[_0xd11f('0x3c')]===_0xd11f('0x40')&&_0x4cdeb2[_0xd11f('0x41')]&&_0x4cdeb2[_0xd11f('0x3d')]&&_0x4cdeb2['customField']){_0x294dfe[_0x4cdeb2[_0xd11f('0x41')]]&&_0x29661f['custom_fields']['push']({'id':_0x4cdeb2[_0xd11f('0x3d')],'value':_0x294dfe[_0x4cdeb2[_0xd11f('0x41')]]['toString']()});}else if(_0x4cdeb2[_0xd11f('0x3c')]===_0xd11f('0x42')&&_0x4cdeb2[_0xd11f('0x43')]&&_0x4cdeb2[_0xd11f('0x43')]['name']&&_0x4cdeb2[_0xd11f('0x3d')]&&_0x4cdeb2['customField']){_0x294dfe[_0x4cdeb2[_0xd11f('0x43')][_0xd11f('0x44')]['toLowerCase']()]&&_0x29661f[_0xd11f('0x45')]['push']({'id':_0x4cdeb2['idField'],'value':_0x294dfe[_0x4cdeb2[_0xd11f('0x43')][_0xd11f('0x44')][_0xd11f('0x39')]()][_0xd11f('0x31')]()});}});}return _0x29661f;}exports['queue']=function(_0x49fcf3,_0x195b7e,_0x35ebd7,_0x3ce190,_0x39753e,_0x5b9f42){var _0x3e8e18,_0x3bbd05;_0x5b9f42[_0xd11f('0xe')]=intUtil['stripTrailingSlash'](_0x5b9f42[_0xd11f('0xe')]);_0x5b9f42['serverUrl']=intUtil[_0xd11f('0x46')](_0x5b9f42[_0xd11f('0x47')]);if(_0x39753e&&_0x39753e[_0xd11f('0x48')]){logger[_0xd11f('0xc')](_0xd11f('0x49'),_0xd11f('0x4a'));_0x195b7e[_0xd11f('0x4b')]=util['format'](_0xd11f('0x4c'),_0x5b9f42[_0xd11f('0x47')],_0x195b7e['uniqueid'],md5(_0x195b7e[_0xd11f('0x4d')]));}else{_0x195b7e[_0xd11f('0x4b')]='';}headers[_0xd11f('0x4e')]=getAuth(_0x5b9f42);return getUser(_0x5b9f42,_0x3ce190[_0xd11f('0x4f')])['then'](function(_0x124258){_0x3e8e18=_0x124258;logger['info'](_0xd11f('0x50'),_0x3e8e18['id']);return getEndUser(_0x5b9f42,_0x195b7e[_0xd11f('0x51')],_0x195b7e['calleridnum']);})['then'](function(_0x1eb024){_0x3bbd05=_0x1eb024;logger['info'](_0xd11f('0x52'),_0x3bbd05['id']);return getTicket(_0x5b9f42,_0x3e8e18,_0x3bbd05,_0x35ebd7,_0x195b7e);})[_0xd11f('0x14')](function(_0x1bf5d5){if(_0x1bf5d5){logger[_0xd11f('0xc')](_0xd11f('0x53'),_0x1bf5d5['id']);switch(_0x5b9f42[_0xd11f('0x3c')]){case _0xd11f('0x54'):logger[_0xd11f('0xc')](_0xd11f('0x49'),_0xd11f('0x55'));return request({'uri':util[_0xd11f('0x16')](_0xd11f('0x56'),_0x5b9f42['remoteUri'],_0x3e8e18['id'],_0x1bf5d5['id']),'method':_0xd11f('0xf')});case _0xd11f('0x57'):logger[_0xd11f('0xc')](_0xd11f('0x49'),_0xd11f('0x58'));emit(util[_0xd11f('0x16')](_0xd11f('0x59'),_0x3ce190[_0xd11f('0x44')]),_0xd11f('0x5a'),{'uri':util[_0xd11f('0x16')](_0xd11f('0x5b'),_0x5b9f42[_0xd11f('0xe')]['replace'](_0xd11f('0x5c'),''),_0x1bf5d5['id'])});break;default:logger[_0xd11f('0x5d')](_0xd11f('0x49'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd11f('0x5e')](function(_0xf67137){logger[_0xd11f('0x5d')](_0xd11f('0x5f'),util['inspect'](_0xf67137,{'showHidden':!![],'depth':null}));});};exports[_0xd11f('0x60')]=function(_0x1898e4,_0x17d36f,_0x269cc8,_0x3f034a,_0x4c0f2c,_0x448c65,_0x3fceaa){var _0x461200,_0x1526f8;_0x448c65[_0xd11f('0xe')]=intUtil['stripTrailingSlash'](_0x448c65[_0xd11f('0xe')]);_0x448c65[_0xd11f('0x47')]=intUtil[_0xd11f('0x46')](_0x448c65['serverUrl']);if(_0x3fceaa&&_0x3fceaa[_0xd11f('0x61')]&&_0x3fceaa[_0xd11f('0x61')]!==_0xd11f('0x62')){logger[_0xd11f('0xc')]('[OUTBOUND]',_0xd11f('0x4a'));_0x17d36f['recordingURL']=util['format'](_0xd11f('0x4c'),_0x448c65[_0xd11f('0x47')],_0x17d36f[_0xd11f('0x4d')],md5(_0x17d36f[_0xd11f('0x4d')]));}headers['Authorization']=getAuth(_0x448c65);return getUser(_0x448c65,_0x3f034a[_0xd11f('0x4f')])[_0xd11f('0x14')](function(_0x12c4aa){_0x461200=_0x12c4aa;logger[_0xd11f('0xc')](_0xd11f('0x50'),_0x461200['id']);return getEndUser(_0x448c65,_0x17d36f[_0xd11f('0x63')],_0x17d36f[_0xd11f('0x64')]);})[_0xd11f('0x14')](function(_0x3d9846){_0x1526f8=_0x3d9846;logger[_0xd11f('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1526f8['id']);return getTicket(_0x448c65,_0x461200,_0x1526f8,_0x269cc8,_0x17d36f);})[_0xd11f('0x14')](function(_0x128cc1){if(_0x128cc1){logger[_0xd11f('0xc')](_0xd11f('0x53'),_0x128cc1['id']);switch(_0x448c65[_0xd11f('0x3c')]){case _0xd11f('0x54'):logger[_0xd11f('0xc')](_0xd11f('0x65'),_0xd11f('0x55'));return request({'uri':util[_0xd11f('0x16')](_0xd11f('0x56'),_0x448c65[_0xd11f('0xe')],_0x461200['id'],_0x128cc1['id']),'method':_0xd11f('0xf')});case _0xd11f('0x57'):logger[_0xd11f('0xc')]('[OUTBOUND]',_0xd11f('0x58'));emit(util['format'](_0xd11f('0x59'),_0x3f034a[_0xd11f('0x44')]),_0xd11f('0x5a'),{'uri':util[_0xd11f('0x16')](_0xd11f('0x5b'),_0x448c65[_0xd11f('0xe')][_0xd11f('0x66')](_0xd11f('0x5c'),''),_0x128cc1['id'])});break;default:logger[_0xd11f('0x5d')](_0xd11f('0x65'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd11f('0x5e')](function(_0x5aaf0f){logger[_0xd11f('0x5d')](_0xd11f('0x67'),util[_0xd11f('0x68')](_0x5aaf0f,{'showHidden':!![],'depth':null}));});};exports[_0xd11f('0x69')]=function(_0x1635af,_0x47c917,_0x2be840,_0x4a736a,_0x1a2ab4,_0x3facb2){var _0x52f085,_0x4883b6;_0x3facb2['remoteUri']=intUtil[_0xd11f('0x46')](_0x3facb2[_0xd11f('0xe')]);_0x3facb2['serverUrl']=intUtil['stripTrailingSlash'](_0x3facb2[_0xd11f('0x47')]);if(_0x1a2ab4&&_0x1a2ab4['monitor_format']){logger['info']('['+_0x47c917[_0xd11f('0x6a')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x47c917[_0xd11f('0x4b')]=util[_0xd11f('0x16')](_0xd11f('0x4c'),_0x3facb2[_0xd11f('0x47')],_0x47c917[_0xd11f('0x4d')],md5(_0x47c917[_0xd11f('0x4d')]));}else{_0x47c917[_0xd11f('0x4b')]='';}headers[_0xd11f('0x4e')]=getAuth(_0x3facb2);return getUser(_0x3facb2)[_0xd11f('0x14')](function(_0x4acf1b){_0x52f085=_0x4acf1b;logger[_0xd11f('0xc')]('The\x20User\x20ID\x20is:',_0x52f085['id']);return getEndUser(_0x3facb2,_0x47c917[_0xd11f('0x51')],_0x47c917['calleridnum']);})[_0xd11f('0x14')](function(_0x2b713c){_0x4883b6=_0x2b713c;logger[_0xd11f('0xc')](_0xd11f('0x52'),_0x4883b6['id']);return getTicket(_0x3facb2,_0x52f085,_0x4883b6,_0x2be840,_0x47c917);})['then'](function(_0x1b7ba6){if(_0x1b7ba6){logger[_0xd11f('0xc')](_0xd11f('0x53'),_0x1b7ba6['id']);}})[_0xd11f('0x5e')](function(_0xd234c1){logger[_0xd11f('0x5d')]('['+_0x47c917[_0xd11f('0x6a')]['toUpperCase']()+']'+_0xd11f('0x6b'),util[_0xd11f('0x68')](_0xd234c1,{'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 75b9d3c..16df233 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 _0x6037=['nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','mm:ss','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','Timeout','Call_Start_Time','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','stack','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','./util','ioredis','bluebird','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','forEach','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','seconds','error','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','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','Contacts','uri','Leads'];(function(_0x16d369,_0xbbaa52){var _0x53c1ca=function(_0x49908d){while(--_0x49908d){_0x16d369['push'](_0x16d369['shift']());}};_0x53c1ca(++_0xbbaa52);}(_0x6037,0xe2));var _0x7603=function(_0x469a03,_0x1a9cf8){_0x469a03=_0x469a03-0x0;var _0x32764a=_0x6037[_0x469a03];return _0x32764a;};'use strict';var _=require(_0x7603('0x0'));var rp=require(_0x7603('0x1'));var md5=require(_0x7603('0x2'));var util=require('util');var intUtil=require(_0x7603('0x3'));var moment=require('moment');var Redis=require(_0x7603('0x4'));var BPromise=require(_0x7603('0x5'));var config=require('../../../../config/environment');var logger=require(_0x7603('0x6'))(_0x7603('0x7'));config['redis']=_[_0x7603('0x8')](config[_0x7603('0x9')],{'host':_0x7603('0xa'),'port':0x18eb});var io=require(_0x7603('0xb'))(new Redis(config[_0x7603('0x9')]));function emit(_0x2795f3,_0x3a35f0,_0x4833b0){io['to'](_0x2795f3)[_0x7603('0xc')](_0x3a35f0,_0x4833b0);}function request(_0x4799b0){logger[_0x7603('0xd')]('[HTTP]',JSON['stringify'](_0x4799b0));return rp(_0x4799b0);}function getCustomFields(_0x2a7070,_0xe6c7fe){var _0x593c49={};if(_0x2a7070['length']>0x0){_[_0x7603('0xe')](_0x2a7070,function(_0x5b6248){if(_['includes']([_0x7603('0xf'),_0x7603('0x10')],_0x5b6248[_0x7603('0x11')])&&_0x5b6248[_0x7603('0x12')]){_0x593c49[_0x5b6248[_0x7603('0x12')]]=_0x5b6248['content'][_0x7603('0x13')]();}else if(_0x5b6248[_0x7603('0x11')]===_0x7603('0x14')&&_0x5b6248[_0x7603('0x15')]&&_0x5b6248['idField']&&_0xe6c7fe[_0x5b6248[_0x7603('0x15')]]){_0x593c49[_0x5b6248['idField']]=_0xe6c7fe[_0x5b6248[_0x7603('0x15')]][_0x7603('0x13')]();}else if(_0x5b6248[_0x7603('0x11')]===_0x7603('0x16')&&_0x5b6248[_0x7603('0x17')]&&_0x5b6248['Variable'][_0x7603('0x18')]&&_0x5b6248['idField']&&_0xe6c7fe[_0x5b6248['Variable'][_0x7603('0x18')][_0x7603('0x19')]()]){_0x593c49[_0x5b6248[_0x7603('0x12')]]=_0xe6c7fe[_0x5b6248[_0x7603('0x17')][_0x7603('0x18')]['toLowerCase']()][_0x7603('0x13')]();}});}return _0x593c49;}function getName(_0x339651){if(_0x339651[_0x7603('0x1a')]('\x20')>0x0){var _0x4640d0=_0x339651['split'](/ (.+)/);if(_0x4640d0[0x1]){return _0x4640d0;}}return[_0x339651,_0x339651];}var accountsTokens={};function getAccessToken(_0x47a111){return new Promise(function(_0x5dc468,_0x1495ce){if(!_[_0x7603('0x1b')](accountsTokens[_0x47a111['id']])&&!_[_0x7603('0x1b')](accountsTokens[_0x47a111['id']][_0x7603('0x1c')])){if(moment()[_0x7603('0x1d')](accountsTokens[_0x47a111['id']][_0x7603('0x1e')])){_0x5dc468(accountsTokens[_0x47a111['id']][_0x7603('0x1c')]);}}var _0x3e24da;switch(_0x47a111[_0x7603('0x1f')]){case'US':_0x3e24da=_0x7603('0x20');break;case'AU':_0x3e24da='https://accounts.zoho.com.au';break;case'EU':_0x3e24da=_0x7603('0x21');break;case'IN':_0x3e24da=_0x7603('0x22');break;case'CN':_0x3e24da=_0x7603('0x23');break;default:_0x3e24da=_0x7603('0x21');break;}var _0x584e6e={'method':_0x7603('0x24'),'uri':_0x3e24da+_0x7603('0x25'),'qs':{'refresh_token':_0x47a111[_0x7603('0x26')],'client_id':_0x47a111[_0x7603('0x27')],'client_secret':_0x47a111[_0x7603('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x584e6e)[_0x7603('0x29')](function(_0x59935c){accountsTokens[_0x47a111['id']]={'access_token':_0x59935c[_0x7603('0x1c')],'expires_in':moment()['add'](_0x59935c[_0x7603('0x1e')],_0x7603('0x2a'))};_0x5dc468(_0x59935c['access_token']);})['catch'](function(_0x316b43){logger[_0x7603('0x2b')](_0x7603('0x2c'),_0x316b43['stack']);_0x1495ce(_0x316b43);});});}function getUser(_0x5ade9b,_0x24872e,_0x22f752,_0x23a373){logger[_0x7603('0x2d')](_0x7603('0x2e'));return request({'method':_0x7603('0x2f'),'uri':util[_0x7603('0x30')](_0x7603('0x31'),_0x24872e),'qs':{'type':_0x7603('0x32')},'headers':{'Authorization':_0x7603('0x33')+_0x5ade9b},'json':!![]})['then'](function(_0x52e4fa){if(_0x52e4fa[_0x7603('0x34')]){var _0x2ab5d0=-0x1;if(_[_0x7603('0x35')](_0x52e4fa[_0x7603('0x34')])){if(!_[_0x7603('0x1b')](_0x23a373)){_0x2ab5d0=_[_0x7603('0x36')](_0x52e4fa['users'],function(_0x4f4002){return _0x4f4002[_0x7603('0x37')]===_0x23a373;});}if(_0x2ab5d0>=0x0){logger[_0x7603('0x2d')](_0x7603('0x38'));}else{logger[_0x7603('0x2d')](_0x7603('0x39'));_0x2ab5d0=_[_0x7603('0x36')](_0x52e4fa[_0x7603('0x34')],function(_0x121d69){return _0x121d69[_0x7603('0x3a')][_0x7603('0x18')]==='Administrator';});}return _0x52e4fa[_0x7603('0x34')][_0x2ab5d0];}else{if(_0x52e4fa[_0x7603('0x3b')][_0x7603('0x3a')][_0x7603('0x18')]==='Administrator'){logger[_0x7603('0x2d')]('Using\x20the\x20admin\x20account!');user=_0x52e4fa[_0x7603('0x3b')];return user;}else{logger[_0x7603('0x2b')]('The\x20failing\x20result\x20is',JSON[_0x7603('0x3c')](_0x52e4fa));throw new Error(_0x7603('0x3d')+JSON[_0x7603('0x3c')](_0x52e4fa));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x7603('0x3c')](_0x52e4fa));throw new Error(_0x7603('0x3d')+JSON[_0x7603('0x3c')](_0x52e4fa));}})[_0x7603('0x3e')](function(_0x246fb8){console[_0x7603('0x2b')](_0x246fb8);});}function getZohoUser(_0x5911dd,_0x1fed12){return new BPromise(function(_0x5d41a0,_0x4106d6){request(_0x5911dd)['then'](function(_0x1e7adb){var _0x49921e=null;if(_0x1e7adb){_0x49921e=_0x1e7adb[_0x7603('0x3f')][0x0];_0x49921e[_0x7603('0x40')]=_0x1fed12;}_0x5d41a0(_0x49921e);})['catch'](function(_0x575b4b){_0x4106d6(_0x575b4b);});});}function createEndUser(_0x26f9ed,_0x932342,_0x4fc5b8,_0x3fc594,_0x510465,_0x39e299){var _0x4fc5b8=getName(_0x4fc5b8);return request({'method':_0x7603('0x24'),'uri':_0x7603('0x41')+_0x932342+'/crm/v2/'+_[_0x7603('0x42')](_0x39e299[_0x7603('0x43')])+'s','body':{'data':[{'Last_Name':_0x4fc5b8[0x1],'First_Name':_0x4fc5b8[0x0],'Phone':_0x3fc594,'Owner':{'name':!_[_0x7603('0x1b')](_0x510465[_0x7603('0x44')][_0x7603('0x18')])?_0x510465[_0x7603('0x44')][_0x7603('0x18')]:!_['isNil'](_0x510465[_0x7603('0x45')])?_0x510465['first_name']+'\x20'+_0x510465[_0x7603('0x46')]:_0x510465[_0x7603('0x46')],'id':_0x510465['id']}}]},'headers':{'Authorization':_0x7603('0x33')+_0x26f9ed},'json':!![]})[_0x7603('0x29')](function(_0x2d4b8a){if(_0x2d4b8a&&_0x2d4b8a[_0x7603('0x3f')][0x0][_0x7603('0x47')]===_0x7603('0x48')){var _0xde243e=_0x2d4b8a[_0x7603('0x3f')][0x0][_0x7603('0x49')];_0xde243e[_0x7603('0x40')]=_[_0x7603('0x42')](_0x39e299[_0x7603('0x43')])+'s';return _0xde243e;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x7603('0x3c')](data));throw new Error(_0x7603('0x4a')+JSON['stringify'](data));})[_0x7603('0x3e')](function(_0x15c144){console[_0x7603('0x4b')](_0x7603('0x4c'),_0x15c144);});}function getEndUser(_0x42189c,_0x31836a,_0x147a99,_0x489f31,_0x53f446,_0x5d6be1,_0x506a3e){var _0x2db15a={'method':'GET','uri':'','headers':{'Authorization':_0x7603('0x33')+_0x42189c},'json':!![]};switch(_0x506a3e[_0x7603('0x4d')]){case _0x7603('0x4e'):_0x2db15a['uri']=_0x7603('0x41')+_0x31836a+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x53f446+'))';return getZohoUser(_0x2db15a,_0x7603('0x4f'))[_0x7603('0x29')](function(_0x2ebc6e){if(_0x2ebc6e)return _0x2ebc6e;_0x2db15a[_0x7603('0x50')]=_0x7603('0x41')+_0x31836a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x53f446+'))';return getZohoUser(_0x2db15a,_0x7603('0x51'))[_0x7603('0x29')](function(_0x342292){if(_0x342292)return _0x342292;if(_0x506a3e[_0x7603('0x43')]!=_0x7603('0x52')){return createEndUser(_0x42189c,_0x31836a,_0x489f31,_0x53f446,_0x5d6be1,_0x506a3e);}else{return{};}});});break;case'contact':_0x2db15a[_0x7603('0x50')]=_0x7603('0x41')+_0x31836a+_0x7603('0x53')+_0x53f446+'))';return getZohoUser(_0x2db15a,'Contacts')[_0x7603('0x29')](function(_0x25f8dc){if(_0x25f8dc)return _0x25f8dc;if(_0x506a3e[_0x7603('0x43')]!=_0x7603('0x52')){return createEndUser(_0x42189c,_0x31836a,_0x489f31,_0x53f446,_0x5d6be1,_0x506a3e);}else{return{};}});break;case _0x7603('0x54'):_0x2db15a[_0x7603('0x50')]=_0x7603('0x41')+_0x31836a+_0x7603('0x55')+_0x53f446+'))';return getZohoUser(_0x2db15a,_0x7603('0x51'))[_0x7603('0x29')](function(_0x11fb03){if(_0x11fb03)return _0x11fb03;if(_0x506a3e[_0x7603('0x43')]!=_0x7603('0x52')){return createEndUser(_0x42189c,_0x31836a,_0x489f31,_0x53f446,_0x5d6be1,_0x506a3e);}else{return{};}});break;}}function getCall(_0x325b91,_0x489f68,_0x24fb21,_0x21a5ca,_0x2cb0b4,_0x4ad27c,_0x284a57,_0x2eb790){logger['info'](_0x7603('0x56'));var _0xc0b9f={};_0xc0b9f['Owner']={'name':!_['isNil'](_0x21a5ca[_0x7603('0x44')][_0x7603('0x18')])&&!_['isNil'](_0x21a5ca[_0x7603('0x3a')][_0x7603('0x18')])&&_0x21a5ca['profile'][_0x7603('0x18')]==='administrator'?_0x21a5ca[_0x7603('0x44')][_0x7603('0x18')]:!_['isNil'](_0x21a5ca[_0x7603('0x45')])?_0x21a5ca[_0x7603('0x45')]+'\x20'+_0x21a5ca['last_name']:_0x21a5ca[_0x7603('0x46')],'id':_0x21a5ca['id']};_0xc0b9f[_0x7603('0x57')]=intUtil[_0x7603('0x58')](_0x4ad27c[_0x7603('0x59')],_0x284a57,'\x20');_0xc0b9f[_0x7603('0x5a')]=intUtil['getString'](_0x4ad27c[_0x7603('0x5b')],_0x284a57,'\x0a');if(_0x2cb0b4[_0x7603('0x40')]===_0x7603('0x4f')){_0xc0b9f[_0x7603('0x5c')]={'name':!_['isNil'](_0x2cb0b4['Full_Name'])?_0x2cb0b4[_0x7603('0x5d')]:!_[_0x7603('0x1b')](_0x2cb0b4[_0x7603('0x5e')])?_0x2cb0b4[_0x7603('0x5e')]+'\x20'+_0x2cb0b4[_0x7603('0x5f')]:_0x2cb0b4[_0x7603('0x5f')],'id':_0x2cb0b4['id']};}if(_0x2cb0b4[_0x7603('0x40')]===_0x7603('0x51')){_0xc0b9f[_0x7603('0x60')]={'name':!_['isNil'](_0x2cb0b4['Full_Name'])?_0x2cb0b4[_0x7603('0x5d')]:!_[_0x7603('0x1b')](_0x2cb0b4[_0x7603('0x5e')])?_0x2cb0b4['First_Name']+'\x20'+_0x2cb0b4[_0x7603('0x5f')]:_0x2cb0b4['Last_Name'],'id':_0x2cb0b4['id']};_0xc0b9f[_0x7603('0x61')]=_['startCase'](_0x2cb0b4[_0x7603('0x40')]);}if(_0x284a57[_0x7603('0x62')]){_0xc0b9f['Call_Duration']=moment[_0x7603('0x63')](parseInt(_0x284a57[_0x7603('0x62')])*0x3e8)[_0x7603('0x30')]('mm:ss');}else if(_0x284a57[_0x7603('0x64')]&&_0x284a57[_0x7603('0x65')]){_0xc0b9f[_0x7603('0x66')]=moment['utc'](moment(_0x284a57[_0x7603('0x65')],_0x7603('0x67'))[_0x7603('0x68')](moment(_0x284a57['starttime'],_0x7603('0x67'))))['format'](_0x7603('0x69'));}switch(_0x284a57['lastevent']){case _0x7603('0x6a'):_0xc0b9f[_0x7603('0x6b')]=_0x7603('0x6c');break;case _0x7603('0x6d'):case _0x7603('0x6e'):_0xc0b9f[_0x7603('0x6b')]=_0x7603('0x6f');break;case _0x7603('0x70'):_0xc0b9f[_0x7603('0x6b')]='Rejected';break;case _0x7603('0x71'):_0xc0b9f[_0x7603('0x6b')]=_0x7603('0x72');break;case'timeout':_0xc0b9f[_0x7603('0x6b')]=_0x7603('0x73');default:}_0xc0b9f[_0x7603('0x74')]=(_0x2eb790==='outbound'?moment(_0x284a57[_0x7603('0x75')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x284a57[_0x7603('0x76')])[_0x7603('0x30')](_0x7603('0x67')))||moment()['format'](_0x7603('0x67'));_0xc0b9f[_0x7603('0x77')]=_0x2eb790||_0x7603('0x78');_0xc0b9f=_[_0x7603('0x79')](_0xc0b9f,getCustomFields(_0x4ad27c[_0x7603('0x7a')],_0x284a57));return request({'method':_0x7603('0x24'),'uri':_0x7603('0x41')+_0x489f68+_0x7603('0x7b'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x325b91},'body':{'data':[_0xc0b9f]},'json':!![]})[_0x7603('0x29')](function(_0x5f3b56){if(_0x5f3b56&&_0x5f3b56['data'][0x0][_0x7603('0x47')]===_0x7603('0x48')){logger['info'](_0x7603('0x7c'));return{'id':_0x5f3b56['data'][0x0]['details']['id']};}})[_0x7603('0x3e')](function(_0x1b52f9){logger[_0x7603('0x2d')](_0x7603('0x7d'),_0x1b52f9[_0x7603('0x7e')]);console[_0x7603('0x4b')](_0x7603('0x7d'),_0x1b52f9);});}exports['queue']=function(_0x200394,_0x56514c,_0x5ea18a,_0x38ec2f,_0x152c9a,_0x4f0268){var _0x16c814,_0x4c260a,_0x28d4ec;_0x4f0268['host']=intUtil[_0x7603('0x7f')](_0x4f0268[_0x7603('0x80')]);_0x4f0268[_0x7603('0x81')]=intUtil[_0x7603('0x7f')](_0x4f0268['serverUrl']);if(_0x152c9a&&_0x152c9a[_0x7603('0x82')]){logger[_0x7603('0x2d')](_0x7603('0x83'),_0x7603('0x84'));_0x56514c[_0x7603('0x85')]=_0x4f0268['serverUrl']+_0x7603('0x86')+_0x56514c[_0x7603('0x87')]+_0x7603('0x88')+md5(_0x56514c['uniqueid']);}else{_0x56514c['recordingURL']='';}var _0x30d2a4=_0x4f0268[_0x7603('0x80')]===_0x7603('0x89')?'eu':_0x7603('0x8a');return getAccessToken(_0x4f0268)[_0x7603('0x29')](function(_0x13d574){_0x28d4ec=_0x13d574;return getUser(_0x28d4ec,_0x30d2a4,_0x4f0268,_0x38ec2f[_0x7603('0x37')]);})[_0x7603('0x29')](function(_0x33fe4d){_0x16c814=_0x33fe4d;logger[_0x7603('0x2d')]('The\x20User\x20ID\x20is:',_0x16c814['id']);return getEndUser(_0x28d4ec,_0x30d2a4,_0x4f0268,_0x56514c[_0x7603('0x8b')],_0x56514c[_0x7603('0x8c')],_0x16c814,_0x5ea18a);})[_0x7603('0x29')](function(_0x41ed32){_0x4c260a=_0x41ed32;return getCall(_0x28d4ec,_0x30d2a4,_0x4f0268,_0x16c814,_0x4c260a,_0x5ea18a,_0x56514c,_0x7603('0x78'));})[_0x7603('0x29')](function(_0x2e50da){if(_0x2e50da){logger[_0x7603('0x2d')](_0x7603('0x8d'),_0x2e50da['id']);logger[_0x7603('0x2d')](_0x7603('0x83'),_0x7603('0x8e'));emit(util[_0x7603('0x30')](_0x7603('0x8f'),_0x38ec2f[_0x7603('0x18')]),'trigger:browser:url',{'uri':_0x7603('0x90')+_0x4f0268[_0x7603('0x80')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2e50da['id']});}})[_0x7603('0x3e')](function(_0x255866){logger['error'](_0x7603('0x83'),JSON['stringify'](_0x255866));});};exports['outbound']=function(_0x109a5a,_0x11a4eb,_0x514b5e,_0x2b397e,_0x49868b,_0x23803a,_0x40d15c){var _0x7df448,_0x1bb5cd,_0x2a3b7d;_0x23803a['host']=intUtil[_0x7603('0x7f')](_0x23803a['host']);_0x23803a['serverUrl']=intUtil[_0x7603('0x7f')](_0x23803a[_0x7603('0x81')]);if(_0x40d15c&&_0x40d15c[_0x7603('0x91')]&&_0x40d15c[_0x7603('0x91')]!=='none'){logger[_0x7603('0x2d')](_0x7603('0x92'),_0x7603('0x84'));_0x11a4eb['recordingURL']=_0x23803a[_0x7603('0x81')]+'/api/voice/recordings/'+_0x11a4eb[_0x7603('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x11a4eb['uniqueid']);}var _0x1313fa=_0x23803a[_0x7603('0x80')]==='zoho.eu'?'eu':_0x7603('0x8a');return getAccessToken(_0x23803a)[_0x7603('0x29')](function(_0x38aacf){_0x2a3b7d=_0x38aacf;return getUser(_0x2a3b7d,_0x1313fa,_0x23803a,_0x2b397e[_0x7603('0x37')]);})[_0x7603('0x29')](function(_0x2a6132){_0x7df448=_0x2a6132;logger[_0x7603('0x2d')](_0x7603('0x93'),_0x7df448['id']);return getEndUser(_0x2a3b7d,_0x1313fa,_0x23803a,_0x11a4eb[_0x7603('0x94')],_0x11a4eb['destcalleridnum'],_0x7df448,_0x514b5e);})[_0x7603('0x29')](function(_0x4fbd44){_0x1bb5cd=_0x4fbd44;return getCall(_0x2a3b7d,_0x1313fa,_0x23803a,_0x7df448,_0x1bb5cd,_0x514b5e,_0x11a4eb,'Outbound');})[_0x7603('0x29')](function(_0x38abf5){if(_0x38abf5){logger['info'](_0x7603('0x8d'),_0x38abf5['id']);logger[_0x7603('0x2d')](_0x7603('0x92'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7603('0x8f'),_0x2b397e['name']),_0x7603('0x95'),{'uri':_0x7603('0x90')+_0x23803a['host']+_0x7603('0x96')+_0x38abf5['id']});}})[_0x7603('0x3e')](function(_0x42592d){logger[_0x7603('0x2b')](_0x7603('0x92'),JSON['stringify'](_0x42592d));});};exports[_0x7603('0x97')]=function(_0x28c455,_0x566bc4,_0xddb815,_0x489f6b,_0x1af4ee,_0xe369cb){var _0x34f897,_0x2bf476,_0x47e1e1;_0xe369cb[_0x7603('0x80')]=intUtil[_0x7603('0x7f')](_0xe369cb[_0x7603('0x80')]);_0xe369cb[_0x7603('0x81')]=intUtil[_0x7603('0x7f')](_0xe369cb[_0x7603('0x81')]);if(_0x1af4ee&&_0x1af4ee['monitor_format']){logger[_0x7603('0x2d')]('['+_0x566bc4[_0x7603('0x98')][_0x7603('0x99')]()+']',_0x7603('0x84'));_0x566bc4[_0x7603('0x85')]=_0xe369cb[_0x7603('0x81')]+'/api/voice/recordings/'+_0x566bc4['uniqueid']+_0x7603('0x88')+md5(_0x566bc4[_0x7603('0x87')]);}else{_0x566bc4[_0x7603('0x85')]='';}var _0x339fb3=_0xe369cb['host']===_0x7603('0x89')?'eu':'com';return getAccessToken(_0xe369cb)[_0x7603('0x29')](function(_0x79eb4a){_0x47e1e1=_0x79eb4a;return getUser(_0x47e1e1,_0x339fb3,_0xe369cb);})[_0x7603('0x29')](function(_0x33df92){_0x34f897=_0x33df92;logger[_0x7603('0x2d')]('The\x20User\x20ID\x20is:',_0x34f897['id']);return getEndUser(_0x47e1e1,_0x339fb3,_0xe369cb,_0x566bc4[_0x7603('0x8b')],_0x566bc4['calleridnum'],_0x34f897,_0xddb815);})[_0x7603('0x29')](function(_0x57bfb8){_0x2bf476=_0x57bfb8;return getCall(_0x47e1e1,_0x339fb3,_0xe369cb,_0x34f897,_0x2bf476,_0xddb815,_0x566bc4,_0x7603('0x78'));})[_0x7603('0x29')](function(_0x41b02c){if(_0x41b02c){logger[_0x7603('0x2d')](_0x7603('0x8d'),_0x41b02c['id']);}})[_0x7603('0x3e')](function(_0x17d1a1){logger['error']('['+_0x566bc4[_0x7603('0x98')]['toUpperCase']()+']',JSON['stringify'](_0x17d1a1));});}; \ No newline at end of file +var _0x8452=['complete','connect','Call_Result','Answered','rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','unmanaged','toUpperCase','lodash','md5','util','moment','bluebird','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','[HTTP]','stringify','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','POST','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','data','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','Subject','Subjects','getString','Descriptions','Full_Name','First_Name','Last_Name','talktime','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called'];(function(_0x22f339,_0x13b74b){var _0x591832=function(_0x5e8084){while(--_0x5e8084){_0x22f339['push'](_0x22f339['shift']());}};_0x591832(++_0x13b74b);}(_0x8452,0x154));var _0x2845=function(_0x45d1b1,_0x328cb0){_0x45d1b1=_0x45d1b1-0x0;var _0x313c30=_0x8452[_0x45d1b1];return _0x313c30;};'use strict';var _=require(_0x2845('0x0'));var rp=require('request-promise');var md5=require(_0x2845('0x1'));var util=require(_0x2845('0x2'));var intUtil=require('./util');var moment=require(_0x2845('0x3'));var Redis=require('ioredis');var BPromise=require(_0x2845('0x4'));var config=require(_0x2845('0x5'));var logger=require('../../../../config/logger')('zoho');config[_0x2845('0x6')]=_[_0x2845('0x7')](config[_0x2845('0x6')],{'host':_0x2845('0x8'),'port':0x18eb});var io=require(_0x2845('0x9'))(new Redis(config[_0x2845('0x6')]));function emit(_0x6c81c6,_0x1d2725,_0x37c159){io['to'](_0x6c81c6)['emit'](_0x1d2725,_0x37c159);}function request(_0x3468de){logger['debug'](_0x2845('0xa'),JSON[_0x2845('0xb')](_0x3468de));return rp(_0x3468de);}function getCustomFields(_0x240376,_0x56f02b){var _0xeeedb1={};if(_0x240376['length']>0x0){_[_0x2845('0xc')](_0x240376,function(_0x2dabc6){if(_[_0x2845('0xd')]([_0x2845('0xe'),'picklist'],_0x2dabc6[_0x2845('0xf')])&&_0x2dabc6[_0x2845('0x10')]){_0xeeedb1[_0x2dabc6[_0x2845('0x10')]]=_0x2dabc6[_0x2845('0x11')][_0x2845('0x12')]();}else if(_0x2dabc6[_0x2845('0xf')]===_0x2845('0x13')&&_0x2dabc6[_0x2845('0x14')]&&_0x2dabc6[_0x2845('0x10')]&&_0x56f02b[_0x2dabc6[_0x2845('0x14')]]){_0xeeedb1[_0x2dabc6['idField']]=_0x56f02b[_0x2dabc6[_0x2845('0x14')]]['toString']();}else if(_0x2dabc6[_0x2845('0xf')]===_0x2845('0x15')&&_0x2dabc6['Variable']&&_0x2dabc6[_0x2845('0x16')][_0x2845('0x17')]&&_0x2dabc6['idField']&&_0x56f02b[_0x2dabc6[_0x2845('0x16')]['name']['toLowerCase']()]){_0xeeedb1[_0x2dabc6[_0x2845('0x10')]]=_0x56f02b[_0x2dabc6[_0x2845('0x16')][_0x2845('0x17')][_0x2845('0x18')]()][_0x2845('0x12')]();}});}return _0xeeedb1;}function getName(_0x542406){if(_0x542406[_0x2845('0x19')]('\x20')>0x0){var _0x4ac2f1=_0x542406['split'](/ (.+)/);if(_0x4ac2f1[0x1]){return _0x4ac2f1;}}return[_0x542406,_0x542406];}var accountsTokens={};function getAccessToken(_0x5c956b){return new Promise(function(_0x26b21f,_0x4e7078){if(!_[_0x2845('0x1a')](accountsTokens[_0x5c956b['id']])&&!_[_0x2845('0x1a')](accountsTokens[_0x5c956b['id']]['access_token'])){if(moment()[_0x2845('0x1b')](accountsTokens[_0x5c956b['id']][_0x2845('0x1c')])){_0x26b21f(accountsTokens[_0x5c956b['id']][_0x2845('0x1d')]);}}var _0x29d4d5;switch(_0x5c956b[_0x2845('0x1e')]){case'US':_0x29d4d5=_0x2845('0x1f');break;case'AU':_0x29d4d5=_0x2845('0x20');break;case'EU':_0x29d4d5=_0x2845('0x21');break;case'IN':_0x29d4d5=_0x2845('0x22');break;case'CN':_0x29d4d5=_0x2845('0x23');break;default:_0x29d4d5=_0x2845('0x21');break;}var _0x1aa28={'method':'POST','uri':_0x29d4d5+_0x2845('0x24'),'qs':{'refresh_token':_0x5c956b[_0x2845('0x25')],'client_id':_0x5c956b[_0x2845('0x26')],'client_secret':_0x5c956b['clientSecret'],'grant_type':_0x2845('0x27')},'json':!![]};return rp(_0x1aa28)[_0x2845('0x28')](function(_0x1fd756){accountsTokens[_0x5c956b['id']]={'access_token':_0x1fd756[_0x2845('0x1d')],'expires_in':moment()[_0x2845('0x29')](_0x1fd756[_0x2845('0x1c')],_0x2845('0x2a'))};_0x26b21f(_0x1fd756[_0x2845('0x1d')]);})['catch'](function(_0x2ecb8b){logger[_0x2845('0x2b')](_0x2845('0x2c'),_0x2ecb8b[_0x2845('0x2d')]);_0x4e7078(_0x2ecb8b);});});}function getUser(_0x1e01c0,_0x3e12bc,_0x8a3d08,_0x1c9daa){logger[_0x2845('0x2e')](_0x2845('0x2f'));return request({'method':_0x2845('0x30'),'uri':util[_0x2845('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x3e12bc),'qs':{'type':_0x2845('0x32')},'headers':{'Authorization':_0x2845('0x33')+_0x1e01c0},'json':!![]})[_0x2845('0x28')](function(_0x3b190f){if(_0x3b190f[_0x2845('0x34')]){var _0x351d83=-0x1;if(_['isArrayLikeObject'](_0x3b190f[_0x2845('0x34')])){if(!_[_0x2845('0x1a')](_0x1c9daa)){_0x351d83=_[_0x2845('0x35')](_0x3b190f['users'],function(_0x4d8c52){return _0x4d8c52[_0x2845('0x36')]===_0x1c9daa;});}if(_0x351d83>=0x0){logger[_0x2845('0x2e')](_0x2845('0x37'));}else{logger['info'](_0x2845('0x38'));_0x351d83=_[_0x2845('0x35')](_0x3b190f['users'],function(_0x564871){return _0x564871[_0x2845('0x39')][_0x2845('0x17')]==='Administrator';});}return _0x3b190f['users'][_0x351d83];}else{if(_0x3b190f['user'][_0x2845('0x39')][_0x2845('0x17')]===_0x2845('0x3a')){logger['info'](_0x2845('0x38'));user=_0x3b190f[_0x2845('0x3b')];return user;}else{logger[_0x2845('0x2b')](_0x2845('0x3c'),JSON[_0x2845('0xb')](_0x3b190f));throw new Error(_0x2845('0x3d')+JSON[_0x2845('0xb')](_0x3b190f));}}}else{logger[_0x2845('0x2b')](_0x2845('0x3c'),JSON[_0x2845('0xb')](_0x3b190f));throw new Error(_0x2845('0x3d')+JSON['stringify'](_0x3b190f));}})[_0x2845('0x3e')](function(_0xe93a53){console['error'](_0xe93a53);});}function getZohoUser(_0x2b0312,_0x5c3da1){return new BPromise(function(_0x1fa3b2,_0x4debe7){request(_0x2b0312)[_0x2845('0x28')](function(_0x2aa3f1){var _0x433920=null;if(_0x2aa3f1){_0x433920=_0x2aa3f1['data'][0x0];_0x433920[_0x2845('0x3f')]=_0x5c3da1;}_0x1fa3b2(_0x433920);})[_0x2845('0x3e')](function(_0x49973b){_0x4debe7(_0x49973b);});});}function createEndUser(_0x4bb92b,_0x4b884d,_0x2de92d,_0x2a8975,_0x3472b3,_0x1b4e65){var _0x2de92d=getName(_0x2de92d);return request({'method':_0x2845('0x40'),'uri':_0x2845('0x41')+_0x4b884d+'/crm/v2/'+_[_0x2845('0x42')](_0x1b4e65[_0x2845('0x43')])+'s','body':{'data':[{'Last_Name':_0x2de92d[0x1],'First_Name':_0x2de92d[0x0],'Phone':_0x2a8975,'Owner':{'name':!_[_0x2845('0x1a')](_0x3472b3[_0x2845('0x44')][_0x2845('0x17')])?_0x3472b3[_0x2845('0x44')][_0x2845('0x17')]:!_[_0x2845('0x1a')](_0x3472b3[_0x2845('0x45')])?_0x3472b3[_0x2845('0x45')]+'\x20'+_0x3472b3['last_name']:_0x3472b3[_0x2845('0x46')],'id':_0x3472b3['id']}}]},'headers':{'Authorization':_0x2845('0x33')+_0x4bb92b},'json':!![]})['then'](function(_0x3750d8){if(_0x3750d8&&_0x3750d8[_0x2845('0x47')][0x0][_0x2845('0x48')]==='SUCCESS'){var _0x47210a=_0x3750d8[_0x2845('0x47')][0x0][_0x2845('0x49')];_0x47210a[_0x2845('0x3f')]=_[_0x2845('0x42')](_0x1b4e65['moduleCreate'])+'s';return _0x47210a;}logger[_0x2845('0x2b')](_0x2845('0x3c'),JSON[_0x2845('0xb')](data));throw new Error(_0x2845('0x4a')+JSON['stringify'](data));})[_0x2845('0x3e')](function(_0x59f279){console[_0x2845('0x4b')](_0x2845('0x4c'),_0x59f279);});}function getEndUser(_0x411abc,_0x4068da,_0x4bdc95,_0x1d66f4,_0x2b11f1,_0x1ec60f,_0x461010){var _0x51a2e4={'method':'GET','uri':'','headers':{'Authorization':_0x2845('0x33')+_0x411abc},'json':!![]};switch(_0x461010[_0x2845('0x4d')]){case _0x2845('0x4e'):_0x51a2e4[_0x2845('0x4f')]=_0x2845('0x41')+_0x4068da+_0x2845('0x50')+_0x2b11f1+'))';return getZohoUser(_0x51a2e4,'Contacts')[_0x2845('0x28')](function(_0x340057){if(_0x340057)return _0x340057;_0x51a2e4[_0x2845('0x4f')]=_0x2845('0x41')+_0x4068da+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2b11f1+'))';return getZohoUser(_0x51a2e4,_0x2845('0x51'))[_0x2845('0x28')](function(_0x3bd15a){if(_0x3bd15a)return _0x3bd15a;if(_0x461010[_0x2845('0x43')]!=_0x2845('0x52')){return createEndUser(_0x411abc,_0x4068da,_0x1d66f4,_0x2b11f1,_0x1ec60f,_0x461010);}else{return{};}});});break;case _0x2845('0x53'):_0x51a2e4[_0x2845('0x4f')]=_0x2845('0x41')+_0x4068da+_0x2845('0x50')+_0x2b11f1+'))';return getZohoUser(_0x51a2e4,'Contacts')[_0x2845('0x28')](function(_0x3bb54f){if(_0x3bb54f)return _0x3bb54f;if(_0x461010['moduleCreate']!=_0x2845('0x52')){return createEndUser(_0x411abc,_0x4068da,_0x1d66f4,_0x2b11f1,_0x1ec60f,_0x461010);}else{return{};}});break;case _0x2845('0x54'):_0x51a2e4[_0x2845('0x4f')]=_0x2845('0x41')+_0x4068da+_0x2845('0x55')+_0x2b11f1+'))';return getZohoUser(_0x51a2e4,_0x2845('0x51'))[_0x2845('0x28')](function(_0x1b5dd9){if(_0x1b5dd9)return _0x1b5dd9;if(_0x461010[_0x2845('0x43')]!=_0x2845('0x52')){return createEndUser(_0x411abc,_0x4068da,_0x1d66f4,_0x2b11f1,_0x1ec60f,_0x461010);}else{return{};}});break;}}function getCall(_0x72d2d0,_0x4e7d74,_0x19ca98,_0x357e58,_0x3f11bf,_0x2f8bf7,_0x5e3654,_0x1c03a6){logger['info'](_0x2845('0x56'));var _0x7ef43a={};_0x7ef43a['Owner']={'name':!_[_0x2845('0x1a')](_0x357e58[_0x2845('0x44')][_0x2845('0x17')])&&!_[_0x2845('0x1a')](_0x357e58[_0x2845('0x39')][_0x2845('0x17')])&&_0x357e58[_0x2845('0x39')][_0x2845('0x17')]===_0x2845('0x57')?_0x357e58[_0x2845('0x44')][_0x2845('0x17')]:!_[_0x2845('0x1a')](_0x357e58[_0x2845('0x45')])?_0x357e58[_0x2845('0x45')]+'\x20'+_0x357e58[_0x2845('0x46')]:_0x357e58[_0x2845('0x46')],'id':_0x357e58['id']};_0x7ef43a[_0x2845('0x58')]=intUtil['getString'](_0x2f8bf7[_0x2845('0x59')],_0x5e3654,'\x20');_0x7ef43a['Description']=intUtil[_0x2845('0x5a')](_0x2f8bf7[_0x2845('0x5b')],_0x5e3654,'\x0a');if(_0x3f11bf[_0x2845('0x3f')]==='Contacts'){_0x7ef43a['Who_Id']={'name':!_['isNil'](_0x3f11bf[_0x2845('0x5c')])?_0x3f11bf[_0x2845('0x5c')]:!_['isNil'](_0x3f11bf[_0x2845('0x5d')])?_0x3f11bf['First_Name']+'\x20'+_0x3f11bf[_0x2845('0x5e')]:_0x3f11bf[_0x2845('0x5e')],'id':_0x3f11bf['id']};}if(_0x3f11bf[_0x2845('0x3f')]===_0x2845('0x51')){_0x7ef43a['What_Id']={'name':!_[_0x2845('0x1a')](_0x3f11bf['Full_Name'])?_0x3f11bf[_0x2845('0x5c')]:!_[_0x2845('0x1a')](_0x3f11bf[_0x2845('0x5d')])?_0x3f11bf[_0x2845('0x5d')]+'\x20'+_0x3f11bf[_0x2845('0x5e')]:_0x3f11bf[_0x2845('0x5e')],'id':_0x3f11bf['id']};_0x7ef43a['$se_module']=_[_0x2845('0x42')](_0x3f11bf[_0x2845('0x3f')]);}if(_0x5e3654[_0x2845('0x5f')]){_0x7ef43a[_0x2845('0x60')]=moment['utc'](parseInt(_0x5e3654[_0x2845('0x5f')])*0x3e8)['format'](_0x2845('0x61'));}else if(_0x5e3654[_0x2845('0x62')]&&_0x5e3654[_0x2845('0x63')]){_0x7ef43a[_0x2845('0x60')]=moment[_0x2845('0x64')](moment(_0x5e3654['endtime'],_0x2845('0x65'))[_0x2845('0x66')](moment(_0x5e3654[_0x2845('0x67')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x2845('0x61'));}switch(_0x5e3654[_0x2845('0x68')]){case _0x2845('0x69'):_0x7ef43a['Call_Result']=_0x2845('0x6a');break;case _0x2845('0x6b'):case _0x2845('0x6c'):_0x7ef43a[_0x2845('0x6d')]=_0x2845('0x6e');break;case _0x2845('0x6f'):_0x7ef43a['Call_Result']='Rejected';break;case _0x2845('0x70'):_0x7ef43a[_0x2845('0x6d')]=_0x2845('0x71');break;case _0x2845('0x72'):_0x7ef43a[_0x2845('0x6d')]=_0x2845('0x73');default:}_0x7ef43a['Call_Start_Time']=(_0x1c03a6===_0x2845('0x74')?moment(_0x5e3654[_0x2845('0x67')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x5e3654[_0x2845('0x75')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x2845('0x31')]('YYYY-MM-DDTHH:mm:ss');_0x7ef43a['Call_Type']=_0x1c03a6||_0x2845('0x76');_0x7ef43a=_[_0x2845('0x77')](_0x7ef43a,getCustomFields(_0x2f8bf7[_0x2845('0x78')],_0x5e3654));return request({'method':'POST','uri':_0x2845('0x41')+_0x4e7d74+_0x2845('0x79'),'headers':{'Authorization':_0x2845('0x33')+_0x72d2d0},'body':{'data':[_0x7ef43a]},'json':!![]})[_0x2845('0x28')](function(_0x2c34fa){if(_0x2c34fa&&_0x2c34fa[_0x2845('0x47')][0x0][_0x2845('0x48')]==='SUCCESS'){logger[_0x2845('0x2e')](_0x2845('0x7a'));return{'id':_0x2c34fa[_0x2845('0x47')][0x0][_0x2845('0x49')]['id']};}})[_0x2845('0x3e')](function(_0x2d9325){logger[_0x2845('0x2e')](_0x2845('0x7b'),_0x2d9325[_0x2845('0x2d')]);console['log'](_0x2845('0x7b'),_0x2d9325);});}exports[_0x2845('0x7c')]=function(_0x3b9463,_0x265e68,_0x1e81b3,_0xdc20d8,_0x2e2597,_0x33ee64){var _0x259824,_0x20874e,_0x26c55b;_0x33ee64[_0x2845('0x7d')]=intUtil[_0x2845('0x7e')](_0x33ee64['host']);_0x33ee64[_0x2845('0x7f')]=intUtil[_0x2845('0x7e')](_0x33ee64[_0x2845('0x7f')]);if(_0x2e2597&&_0x2e2597['monitor_format']){logger[_0x2845('0x2e')](_0x2845('0x80'),_0x2845('0x81'));_0x265e68[_0x2845('0x82')]=_0x33ee64['serverUrl']+_0x2845('0x83')+_0x265e68[_0x2845('0x84')]+_0x2845('0x85')+md5(_0x265e68[_0x2845('0x84')]);}else{_0x265e68[_0x2845('0x82')]='';}var _0x4c2dc7=_0x33ee64[_0x2845('0x7d')]==='zoho.eu'?'eu':_0x2845('0x86');return getAccessToken(_0x33ee64)[_0x2845('0x28')](function(_0x86e844){_0x26c55b=_0x86e844;return getUser(_0x26c55b,_0x4c2dc7,_0x33ee64,_0xdc20d8[_0x2845('0x36')]);})['then'](function(_0x36dabb){_0x259824=_0x36dabb;logger[_0x2845('0x2e')](_0x2845('0x87'),_0x259824['id']);return getEndUser(_0x26c55b,_0x4c2dc7,_0x33ee64,_0x265e68['calleridname'],_0x265e68[_0x2845('0x88')],_0x259824,_0x1e81b3);})['then'](function(_0x4414b6){_0x20874e=_0x4414b6;return getCall(_0x26c55b,_0x4c2dc7,_0x33ee64,_0x259824,_0x20874e,_0x1e81b3,_0x265e68,_0x2845('0x76'));})[_0x2845('0x28')](function(_0x4bb705){if(_0x4bb705){logger[_0x2845('0x2e')](_0x2845('0x89'),_0x4bb705['id']);logger['info'](_0x2845('0x80'),_0x2845('0x8a'));emit(util[_0x2845('0x31')](_0x2845('0x8b'),_0xdc20d8['name']),_0x2845('0x8c'),{'uri':'https://crm.'+_0x33ee64[_0x2845('0x7d')]+_0x2845('0x8d')+_0x4bb705['id']});}})['catch'](function(_0x485a8f){logger[_0x2845('0x2b')]('[QUEUE]',JSON[_0x2845('0xb')](_0x485a8f));});};exports[_0x2845('0x74')]=function(_0x5b52ab,_0x458388,_0x43f4f4,_0xb819de,_0x1c9950,_0x148325,_0x53de30){var _0x2acd06,_0x824033,_0x2785a4;_0x148325[_0x2845('0x7d')]=intUtil[_0x2845('0x7e')](_0x148325[_0x2845('0x7d')]);_0x148325[_0x2845('0x7f')]=intUtil[_0x2845('0x7e')](_0x148325[_0x2845('0x7f')]);if(_0x53de30&&_0x53de30[_0x2845('0x8e')]&&_0x53de30[_0x2845('0x8e')]!==_0x2845('0x8f')){logger[_0x2845('0x2e')](_0x2845('0x90'),_0x2845('0x81'));_0x458388[_0x2845('0x82')]=_0x148325['serverUrl']+_0x2845('0x83')+_0x458388[_0x2845('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x458388[_0x2845('0x84')]);}var _0x3446e0=_0x148325[_0x2845('0x7d')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x148325)[_0x2845('0x28')](function(_0x154c1f){_0x2785a4=_0x154c1f;return getUser(_0x2785a4,_0x3446e0,_0x148325,_0xb819de[_0x2845('0x36')]);})[_0x2845('0x28')](function(_0x872250){_0x2acd06=_0x872250;logger[_0x2845('0x2e')](_0x2845('0x87'),_0x2acd06['id']);return getEndUser(_0x2785a4,_0x3446e0,_0x148325,_0x458388['destcalleridname'],_0x458388[_0x2845('0x91')],_0x2acd06,_0x43f4f4);})[_0x2845('0x28')](function(_0x17a20d){_0x824033=_0x17a20d;return getCall(_0x2785a4,_0x3446e0,_0x148325,_0x2acd06,_0x824033,_0x43f4f4,_0x458388,_0x2845('0x92'));})[_0x2845('0x28')](function(_0x1b8a37){if(_0x1b8a37){logger[_0x2845('0x2e')](_0x2845('0x89'),_0x1b8a37['id']);logger[_0x2845('0x2e')]('[OUTBOUND]',_0x2845('0x8a'));emit(util[_0x2845('0x31')](_0x2845('0x8b'),_0xb819de['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x148325['host']+_0x2845('0x8d')+_0x1b8a37['id']});}})[_0x2845('0x3e')](function(_0x256dae){logger[_0x2845('0x2b')]('[OUTBOUND]',JSON[_0x2845('0xb')](_0x256dae));});};exports[_0x2845('0x93')]=function(_0xcd052b,_0x260b08,_0x3d59b9,_0x1ea98e,_0x515ced,_0x8632d7){var _0x1aaa25,_0x5be41c,_0x27477c;_0x8632d7[_0x2845('0x7d')]=intUtil['stripTrailingSlash'](_0x8632d7[_0x2845('0x7d')]);_0x8632d7[_0x2845('0x7f')]=intUtil[_0x2845('0x7e')](_0x8632d7['serverUrl']);if(_0x515ced&&_0x515ced['monitor_format']){logger[_0x2845('0x2e')]('['+_0x260b08[_0x2845('0x68')]['toUpperCase']()+']',_0x2845('0x81'));_0x260b08[_0x2845('0x82')]=_0x8632d7[_0x2845('0x7f')]+_0x2845('0x83')+_0x260b08[_0x2845('0x84')]+_0x2845('0x85')+md5(_0x260b08[_0x2845('0x84')]);}else{_0x260b08[_0x2845('0x82')]='';}var _0x1b7e00=_0x8632d7[_0x2845('0x7d')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x8632d7)[_0x2845('0x28')](function(_0x1d0a87){_0x27477c=_0x1d0a87;return getUser(_0x27477c,_0x1b7e00,_0x8632d7);})[_0x2845('0x28')](function(_0x1e6528){_0x1aaa25=_0x1e6528;logger[_0x2845('0x2e')](_0x2845('0x87'),_0x1aaa25['id']);return getEndUser(_0x27477c,_0x1b7e00,_0x8632d7,_0x260b08['calleridname'],_0x260b08[_0x2845('0x88')],_0x1aaa25,_0x3d59b9);})[_0x2845('0x28')](function(_0x55f539){_0x5be41c=_0x55f539;return getCall(_0x27477c,_0x1b7e00,_0x8632d7,_0x1aaa25,_0x5be41c,_0x3d59b9,_0x260b08,'Inbound');})['then'](function(_0x398bec){if(_0x398bec){logger['info'](_0x2845('0x89'),_0x398bec['id']);}})[_0x2845('0x3e')](function(_0x573ae2){logger[_0x2845('0x2b')]('['+_0x260b08['lastevent'][_0x2845('0x94')]()+']',JSON[_0x2845('0xb')](_0x573ae2));});}; \ 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 140d58a..2c96591 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 _0x155a=['../../../../config/logger','trigger','exec','data2','data3','error','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache'];(function(_0x33d59e,_0xcbe0e3){var _0x465442=function(_0x225071){while(--_0x225071){_0x33d59e['push'](_0x33d59e['shift']());}};_0x465442(++_0xcbe0e3);}(_0x155a,0xe5));var _0xa155=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x155a[_0x59ee6f];return _0x4c0979;};'use strict';var util=require('util');var sh=require(_0xa155('0x0'));var Mustache=require(_0xa155('0x1'));var logger=require(_0xa155('0x2'))(_0xa155('0x3'));exports[_0xa155('0x4')]=function(_0x5d5bba,_0x289373){var _0x43cd43=_0x5d5bba['data2']?_0x5d5bba[_0xa155('0x5')]:'Script';var _0x4948ae=_0x5d5bba[_0xa155('0x6')]?Mustache['render'](_0x5d5bba[_0xa155('0x6')],_0x289373):_0x289373;sh[_0xa155('0x4')](_0x4948ae,function(_0x37ad2a,_0x201949,_0x23503e){if(_0x37ad2a!==0x0){logger[_0xa155('0x7')](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x43cd43,_0x4948ae,_0x37ad2a,_0x23503e));}else{logger[_0xa155('0x8')](util[_0xa155('0x9')](_0xa155('0xa'),_0x43cd43,_0x4948ae,_0x201949));}});}; \ No newline at end of file +var _0xc60c=['info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','trigger','exec','data2','render','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x15fe68,_0xddc145){var _0x1d144c=function(_0x408370){while(--_0x408370){_0x15fe68['push'](_0x15fe68['shift']());}};_0x1d144c(++_0xddc145);}(_0xc60c,0x193));var _0xcc60=function(_0x2faa2e,_0x198332){_0x2faa2e=_0x2faa2e-0x0;var _0x4d165d=_0xc60c[_0x2faa2e];return _0x4d165d;};'use strict';var util=require('util');var sh=require(_0xcc60('0x0'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xcc60('0x1'));exports[_0xcc60('0x2')]=function(_0x5d6674,_0x2cac5c){var _0x5f19c7=_0x5d6674[_0xcc60('0x3')]?_0x5d6674['data2']:'Script';var _0x3be27d=_0x5d6674['data3']?Mustache[_0xcc60('0x4')](_0x5d6674[_0xcc60('0x5')],_0x2cac5c):_0x2cac5c;sh[_0xcc60('0x2')](_0x3be27d,function(_0x2d68d8,_0x300219,_0x30c7cd){if(_0x2d68d8!==0x0){logger['error'](util['format'](_0xcc60('0x6'),_0x5f19c7,_0x3be27d,_0x2d68d8,_0x30c7cd));}else{logger[_0xcc60('0x7')](util[_0xcc60('0x8')](_0xcc60('0x9'),_0x5f19c7,_0x3be27d,_0x300219));}});}; \ 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 7ef5f6f..35cb695 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 _0x11ed=['toUpperCase','GET','DELETE','POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','lodash','mustache','data1','render','data2','data5','number','headers','data6','parse','error','stack'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0x11ed,0x1d3));var _0xd11e=function(_0x5005bf,_0x2cb288){_0x5005bf=_0x5005bf-0x0;var _0x930975=_0x11ed[_0x5005bf];return _0x930975;};'use strict';var rp=require(_0xd11e('0x0'));var util=require('util');var _=require(_0xd11e('0x1'));var Mustache=require(_0xd11e('0x2'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0xcab0d3,_0x41905b){var _0x422ad7,_0x21088f;var _0x13ba49={'method':_0xcab0d3[_0xd11e('0x3')]['toUpperCase'](),'uri':Mustache[_0xd11e('0x4')](_0xcab0d3[_0xd11e('0x5')],_0x41905b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xcab0d3[_0xd11e('0x6')])===_0xd11e('0x7')&&parseInt(_0xcab0d3['data5'])>=0x1&&parseInt(_0xcab0d3['data5'])<=0xa?parseInt(_0xcab0d3[_0xd11e('0x6')])*0x3e8:0x5*0x3e8};try{_0x13ba49[_0xd11e('0x8')]=_0xcab0d3[_0xd11e('0x9')]?JSON[_0xd11e('0xa')](Mustache[_0xd11e('0x4')](_0xcab0d3[_0xd11e('0x9')],_0x41905b)):{};}catch(_0x2699e1){logger[_0xd11e('0xb')](_0x2699e1[_0xd11e('0xc')]);}switch(_0xcab0d3[_0xd11e('0x3')][_0xd11e('0xd')]()){case _0xd11e('0xe'):case _0xd11e('0xf'):_0x422ad7=null;_0x13ba49['qs']=_0x41905b;break;case _0xd11e('0x10'):case'PUT':if(_0xcab0d3[_0xd11e('0x11')]){try{_0x422ad7=JSON['parse'](Mustache[_0xd11e('0x4')](_0xcab0d3[_0xd11e('0x11')],_0x41905b));_0x13ba49[_0xd11e('0x12')]=_0x422ad7;}catch(_0x1f56c6){logger[_0xd11e('0xb')](_0x1f56c6[_0xd11e('0xc')]);logger[_0xd11e('0xb')](_0xd11e('0x13'));}}else{_0x422ad7=_0x41905b;_0x13ba49[_0xd11e('0x12')]=_0x422ad7;}break;}logger[_0xd11e('0x14')](util[_0xd11e('0x15')](_0xd11e('0x16'),_0xcab0d3[_0xd11e('0x3')],_0xcab0d3['data2'],JSON['stringify'](_0x13ba49)));rp(_0x13ba49)[_0xd11e('0x17')](function(_0x3dc397){_0x422ad7=!_['isNil'](_0x422ad7)?_0xd11e('0x18')+_0x422ad7:'';_0x21088f=typeof _0x3dc397[_0xd11e('0x12')]===_0xd11e('0x19')?JSON['stringify'](_0x3dc397['body']):_0x3dc397['body'];logger[_0xd11e('0x14')](util[_0xd11e('0x15')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0xcab0d3[_0xd11e('0x3')],_0xcab0d3['data2'],_0x3dc397['statusCode'],_0x21088f));})['catch'](function(_0x5d49ec){logger[_0xd11e('0xb')](util['format'](_0xd11e('0x1a'),_0xcab0d3[_0xd11e('0x3')],_0xcab0d3['data2'],_0x5d49ec[_0xd11e('0x1b')],_0x5d49ec[_0xd11e('0x1c')],_0x5d49ec[_0xd11e('0x1d')]));});}; \ No newline at end of file +var _0x5b56=['stringify','then','isNil',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','mustache','../../../../config/logger','exec','toUpperCase','render','data2','data5','number','headers','parse','data6','data1','GET','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s'];(function(_0x351417,_0x19d405){var _0x27e1ee=function(_0x4420e4){while(--_0x4420e4){_0x351417['push'](_0x351417['shift']());}};_0x27e1ee(++_0x19d405);}(_0x5b56,0xac));var _0x65b5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5b56[_0x17d9e3];return _0x14192d;};'use strict';var rp=require(_0x65b5('0x0'));var util=require('util');var _=require('lodash');var Mustache=require(_0x65b5('0x1'));var logger=require(_0x65b5('0x2'))('trigger');exports[_0x65b5('0x3')]=function(_0x501844,_0x11ad7c){var _0x297e9c,_0x1f41ed;var _0x1f113d={'method':_0x501844['data1'][_0x65b5('0x4')](),'uri':Mustache[_0x65b5('0x5')](_0x501844[_0x65b5('0x6')],_0x11ad7c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x501844[_0x65b5('0x7')])===_0x65b5('0x8')&&parseInt(_0x501844[_0x65b5('0x7')])>=0x1&&parseInt(_0x501844['data5'])<=0xa?parseInt(_0x501844['data5'])*0x3e8:0x5*0x3e8};try{_0x1f113d[_0x65b5('0x9')]=_0x501844['data6']?JSON[_0x65b5('0xa')](Mustache[_0x65b5('0x5')](_0x501844[_0x65b5('0xb')],_0x11ad7c)):{};}catch(_0x57e2fa){logger['error'](_0x57e2fa['stack']);}switch(_0x501844[_0x65b5('0xc')][_0x65b5('0x4')]()){case _0x65b5('0xd'):case'DELETE':_0x297e9c=null;_0x1f113d['qs']=_0x11ad7c;break;case'POST':case'PUT':if(_0x501844[_0x65b5('0xe')]){try{_0x297e9c=JSON[_0x65b5('0xa')](Mustache['render'](_0x501844[_0x65b5('0xe')],_0x11ad7c));_0x1f113d[_0x65b5('0xf')]=_0x297e9c;}catch(_0x11e7bb){logger[_0x65b5('0x10')](_0x11e7bb['stack']);logger[_0x65b5('0x10')](_0x65b5('0x11'));}}else{_0x297e9c=_0x11ad7c;_0x1f113d['body']=_0x297e9c;}break;}logger[_0x65b5('0x12')](util['format'](_0x65b5('0x13'),_0x501844[_0x65b5('0xc')],_0x501844[_0x65b5('0x6')],JSON[_0x65b5('0x14')](_0x1f113d)));rp(_0x1f113d)[_0x65b5('0x15')](function(_0x2fb437){_0x297e9c=!_[_0x65b5('0x16')](_0x297e9c)?_0x65b5('0x17')+_0x297e9c:'';_0x1f41ed=typeof _0x2fb437[_0x65b5('0xf')]===_0x65b5('0x18')?JSON[_0x65b5('0x14')](_0x2fb437[_0x65b5('0xf')]):_0x2fb437['body'];logger[_0x65b5('0x12')](util[_0x65b5('0x19')](_0x65b5('0x1a'),_0x501844[_0x65b5('0xc')],_0x501844[_0x65b5('0x6')],_0x2fb437[_0x65b5('0x1b')],_0x1f41ed));})[_0x65b5('0x1c')](function(_0x3364d3){logger[_0x65b5('0x10')](util['format'](_0x65b5('0x1d'),_0x501844['data1'],_0x501844[_0x65b5('0x6')],_0x3364d3[_0x65b5('0x1b')],_0x3364d3[_0x65b5('0x1e')],_0x3364d3[_0x65b5('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 5eb71e8..ff221f5 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 _0x190f=['message','catch','exports','../../config/logger','routing','client','request','then','debug','error','rpc'];(function(_0x5070a4,_0x1db896){var _0x179668=function(_0x43b757){while(--_0x43b757){_0x5070a4['push'](_0x5070a4['shift']());}};_0x179668(++_0x1db896);}(_0x190f,0x179));var _0xf190=function(_0x4871dc,_0x2f781f){_0x4871dc=_0x4871dc-0x0;var _0x16f7a2=_0x190f[_0x4871dc];return _0x16f7a2;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xf190('0x0'))(_0xf190('0x1'));var client=jayson[_0xf190('0x2')]['http']({'port':0x2329});client['Request']=function(_0x26d15b,_0x4ef6f0){return new BPromise(function(_0x301894,_0xc4dfd4){return client[_0xf190('0x3')](_0x26d15b,_0x4ef6f0)[_0xf190('0x4')](function(_0x4e2c9c){logger[_0xf190('0x5')]('rpc',_0xf190('0x1'),_0x26d15b,_0x4ef6f0,_0x4e2c9c);if(_0x4e2c9c[_0xf190('0x6')]){logger[_0xf190('0x6')](_0xf190('0x7'),_0xf190('0x1'),_0x26d15b,_0x4e2c9c[_0xf190('0x6')][_0xf190('0x8')],_0x4ef6f0);return _0xc4dfd4(_0x4e2c9c[_0xf190('0x6')]['message']);}else{return _0x301894(_0x4e2c9c['result']);}})[_0xf190('0x9')](function(_0x11759f){logger['error'](_0xf190('0x7'),_0xf190('0x1'),_0x26d15b,_0x11759f,_0x4ef6f0);return _0xc4dfd4(_0x11759f);});});};module[_0xf190('0xa')]=client; \ No newline at end of file +var _0xdbab=['http','Request','request','then','debug','rpc','error','message','result','jayson/promise','bluebird','routing','client'];(function(_0x1163d8,_0x3d2325){var _0x44ab79=function(_0x2ba1e5){while(--_0x2ba1e5){_0x1163d8['push'](_0x1163d8['shift']());}};_0x44ab79(++_0x3d2325);}(_0xdbab,0xa5));var _0xbdba=function(_0x57f8eb,_0x484ee9){_0x57f8eb=_0x57f8eb-0x0;var _0xc72795=_0xdbab[_0x57f8eb];return _0xc72795;};'use strict';var jayson=require(_0xbdba('0x0'));var BPromise=require(_0xbdba('0x1'));var logger=require('../../config/logger')(_0xbdba('0x2'));var client=jayson[_0xbdba('0x3')][_0xbdba('0x4')]({'port':0x2329});client[_0xbdba('0x5')]=function(_0x36398b,_0x3022f0){return new BPromise(function(_0x25a6ca,_0x31c9fa){return client[_0xbdba('0x6')](_0x36398b,_0x3022f0)[_0xbdba('0x7')](function(_0x3a46a6){logger[_0xbdba('0x8')](_0xbdba('0x9'),'routing',_0x36398b,_0x3022f0,_0x3a46a6);if(_0x3a46a6['error']){logger[_0xbdba('0xa')](_0xbdba('0x9'),_0xbdba('0x2'),_0x36398b,_0x3a46a6[_0xbdba('0xa')]['message'],_0x3022f0);return _0x31c9fa(_0x3a46a6[_0xbdba('0xa')][_0xbdba('0xb')]);}else{return _0x25a6ca(_0x3a46a6[_0xbdba('0xc')]);}})['catch'](function(_0x5931fa){logger[_0xbdba('0xa')](_0xbdba('0x9'),'routing',_0x36398b,_0x5931fa,_0x3022f0);return _0x31c9fa(_0x5931fa);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f81feea..d44c55a 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 _0xa1f5=['catch','log','bluebird','./realtime','./rpc/setting','resolve','then','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x40ee20,_0x1c40a9){var _0x9828e3=function(_0xf227cd){while(--_0xf227cd){_0x40ee20['push'](_0x40ee20['shift']());}};_0x9828e3(++_0x1c40a9);}(_0xa1f5,0xce));var _0x5a1f=function(_0x467ed1,_0x3840f5){_0x467ed1=_0x467ed1-0x0;var _0x310959=_0xa1f5[_0x467ed1];return _0x310959;};'use strict';var BPromise=require(_0x5a1f('0x0'));var server=require('./server');var Realtime=require(_0x5a1f('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0x5a1f('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x5a1f('0x3')]()['then'](mailAccount['getMailAccounts']())[_0x5a1f('0x4')](realtime[_0x5a1f('0x5')]())[_0x5a1f('0x4')](function(){email['refresh'](realtime[_0x5a1f('0x6')]);return realtime;});}function main(){return server[_0x5a1f('0x7')](realtime,email)[_0x5a1f('0x4')](function(){return initRealtime();})[_0x5a1f('0x4')](function(){return setting[_0x5a1f('0x8')]();})[_0x5a1f('0x4')](function(_0x3f0d9e){return setInterval(initRealtime,_0x3f0d9e[_0x5a1f('0x9')]*0x3e8);})[_0x5a1f('0xa')](function(_0x5178fe){console[_0x5a1f('0xb')](_0x5178fe);});}main(); \ No newline at end of file +var _0x7336=['./server','./realtime','./rpc/setting','resolve','then','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','log','bluebird'];(function(_0x2f5983,_0x56ede5){var _0x51d985=function(_0x267083){while(--_0x267083){_0x2f5983['push'](_0x2f5983['shift']());}};_0x51d985(++_0x56ede5);}(_0x7336,0x141));var _0x6733=function(_0x1efd14,_0x43f283){_0x1efd14=_0x1efd14-0x0;var _0x422160=_0x7336[_0x1efd14];return _0x422160;};'use strict';var BPromise=require(_0x6733('0x0'));var server=require(_0x6733('0x1'));var Realtime=require(_0x6733('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0x6733('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x6733('0x4')]()[_0x6733('0x5')](mailAccount['getMailAccounts']())[_0x6733('0x5')](realtime[_0x6733('0x6')]())[_0x6733('0x5')](function(){email[_0x6733('0x7')](realtime[_0x6733('0x8')]);return realtime;});}function main(){return server[_0x6733('0x9')](realtime,email)[_0x6733('0x5')](function(){return initRealtime();})[_0x6733('0x5')](function(){return setting[_0x6733('0xa')]();})['then'](function(_0x362268){return setInterval(initRealtime,_0x362268[_0x6733('0xb')]*0x3e8);})[_0x6733('0xc')](function(_0x51dda3){console[_0x6733('0xd')](_0x51dda3);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index f417d15..ea57ec8 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 _0x996e=['box','handleImapBox','bind','error','handleImapError','disabled','connected','messages','handleImapEmail','firstName','lastName','from','notify','then','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','messageStatus','Imap','total','isNil','stringify','md5','hasOwnProperty'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x996e,0x11a));var _0xe996=function(_0x35b1a6,_0x22006a){_0x35b1a6=_0x35b1a6-0x0;var _0x395d75=_0x996e[_0x35b1a6];return _0x395d75;};'use strict';var _=require(_0xe996('0x0'));var moment=require(_0xe996('0x1'));var BPromise=require(_0xe996('0x2'));var md5=require('md5');var Redis=require(_0xe996('0x3'));var config=require(_0xe996('0x4'));var logger=require(_0xe996('0x5'))(_0xe996('0x6'));config[_0xe996('0x7')]=_[_0xe996('0x8')](config[_0xe996('0x7')],{'host':_0xe996('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xe996('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xe996('0xb'));var md5Accounts={};function EmailChannel(_0x167f20){logger[_0xe996('0xc')](_0xe996('0xd'));this[_0xe996('0xe')]=_0x167f20[_0xe996('0xe')];this[_0xe996('0xf')]={};this[_0xe996('0x10')]=new EmailSmtp();}EmailChannel[_0xe996('0x11')][_0xe996('0x12')]=function(_0xa13ca6){var _0x73cd98=this['mailAccounts'][_0xa13ca6];var _0x2c59a9={'id':_0x73cd98['id'],'name':_0x73cd98[_0xe996('0x13')],'key':_0x73cd98[_0xe996('0x14')],'active':_0x73cd98[_0xe996('0x15')],'Imap':{'status':_0x73cd98['Imap'][_0xe996('0x16')],'messageStatus':_0x73cd98['Imap'][_0xe996('0x17')],'total':_0x73cd98[_0xe996('0x18')][_0xe996('0x19')]}};if(_[_0xe996('0x1a')](md5Accounts[_0xa13ca6])){md5Accounts[_0xa13ca6]={};}var _0x3677a4=md5(JSON[_0xe996('0x1b')](_0x2c59a9));if(md5Accounts[_0xa13ca6][_0xe996('0x1c')]!==_0x3677a4){md5Accounts[_0xa13ca6]['md5']=_0x3677a4;io['emit']('mailAccount:update',_0x2c59a9);}};EmailChannel[_0xe996('0x11')]['refresh']=function(_0x2d595b){for(var _0x11209b in _0x2d595b){if(_0x2d595b[_0xe996('0x1d')](_0x11209b)){if(_0x2d595b[_0x11209b]['Imap']&&_0x2d595b[_0x11209b][_0xe996('0x15')]){var _0x3fb706=_0x2d595b[_0x11209b][_0xe996('0x18')];if(!this[_0xe996('0xf')][_0xe996('0x1d')](_0x3fb706['id'])){this[_0xe996('0xf')][_0x3fb706['id']]=new EmailImap(_0x3fb706,_0x2d595b[_0x11209b]['email']);this['imapAccounts'][_0x3fb706['id']]['on'](_0xe996('0x1e'),this[_0xe996('0x1f')][_0xe996('0x20')](this,_0x11209b));this['imapAccounts'][_0x3fb706['id']]['on'](_0xe996('0x6'),this['handleImapEmail'][_0xe996('0x20')](this,_0x11209b));this[_0xe996('0xf')][_0x3fb706['id']]['on']('end',this['handleImapEnd'][_0xe996('0x20')](this,_0x11209b));this['imapAccounts'][_0x3fb706['id']]['on'](_0xe996('0x21'),this[_0xe996('0x22')][_0xe996('0x20')](this,_0x11209b));}}else{if(_[_0xe996('0x1a')](this['mailAccounts'][_0x11209b][_0xe996('0x18')])){this[_0xe996('0xe')][_0x11209b][_0xe996('0x18')]={};}this['mailAccounts'][_0x11209b][_0xe996('0x18')][_0xe996('0x16')]=_0xe996('0x23');this['mailAccounts'][_0x11209b][_0xe996('0x18')][_0xe996('0x17')]='';this[_0xe996('0x12')](_0x11209b);}}}};EmailChannel[_0xe996('0x11')][_0xe996('0x1f')]=function(_0x5ebaf7,_0x279527){if(this[_0xe996('0xe')][_0x5ebaf7]){this[_0xe996('0xe')][_0x5ebaf7]['Imap'][_0xe996('0x16')]=_0xe996('0x24');this[_0xe996('0xe')][_0x5ebaf7][_0xe996('0x18')]['messageStatus']=_0x279527['name'];if(_0x279527[_0xe996('0x25')]){this[_0xe996('0xe')][_0x5ebaf7][_0xe996('0x18')][_0xe996('0x19')]=_0x279527[_0xe996('0x25')][_0xe996('0x19')];}return this[_0xe996('0x12')](_0x5ebaf7);}};EmailChannel[_0xe996('0x11')][_0xe996('0x26')]=function(_0x48484f,_0x4f7e7c){logger[_0xe996('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x4f7e7c[_0xe996('0x27')],_0x4f7e7c[_0xe996('0x28')],_0x4f7e7c[_0xe996('0x29')],_0x48484f);if(this[_0xe996('0xe')][_0x48484f]){return mailAccount[_0xe996('0x2a')](_0x48484f,_0x4f7e7c)[_0xe996('0x2b')](function(_0x108da3){if(_0x108da3){logger['info']('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x2b5a39){logger[_0xe996('0x21')](_0xe996('0x2c'),JSON['stringify'](_0x2b5a39));});}};EmailChannel[_0xe996('0x11')]['handleImapEnd']=function(_0x52dc25){if(this['mailAccounts'][_0x52dc25]&&this[_0xe996('0xe')][_0x52dc25][_0xe996('0x18')]){if(this[_0xe996('0xf')][this['mailAccounts'][_0x52dc25][_0xe996('0x18')]['id']]){delete this[_0xe996('0xf')][this[_0xe996('0xe')][_0x52dc25][_0xe996('0x18')]['id']];}this[_0xe996('0xe')][_0x52dc25][_0xe996('0x18')][_0xe996('0x2d')]=moment();this[_0xe996('0x12')](_0x52dc25);}};EmailChannel[_0xe996('0x11')]['handleImapError']=function(_0x3fdf1f,_0x156a13){if(this[_0xe996('0xe')][_0x3fdf1f]){this[_0xe996('0xe')][_0x3fdf1f][_0xe996('0x18')]['status']='error';this[_0xe996('0xe')][_0x3fdf1f][_0xe996('0x18')][_0xe996('0x17')]=_0x156a13;return this[_0xe996('0x12')](_0x3fdf1f);}};EmailChannel[_0xe996('0x11')][_0xe996('0x2e')]=function(_0x4204d9,_0x3c371e){return this[_0xe996('0x10')]['send'](_0x4204d9,_0x3c371e);};EmailChannel['prototype'][_0xe996('0x2f')]=function(_0x2d62e7){var _0x207851=this;if(this['mailAccounts'][_0x2d62e7['id']]){if(_['isNil'](this['mailAccounts'][_0x2d62e7['id']]['Smtp'])){this[_0xe996('0xe')][_0x2d62e7['id']][_0xe996('0x30')]={};}this[_0xe996('0xe')][_0x2d62e7['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x16eb36,_0x3d21c6){return _0x207851[_0xe996('0x10')][_0xe996('0x31')](_0x2d62e7)[_0xe996('0x2b')](function(_0xfaa53e){_0x207851[_0xe996('0xe')][_0x2d62e7['id']][_0xe996('0x30')][_0xe996('0x16')]=_0xe996('0x32');_0x207851['mailAccounts'][_0x2d62e7['id']][_0xe996('0x30')]['messageStatus']='';_0x207851[_0xe996('0x12')](_0x2d62e7['id']);_0x16eb36(_0xfaa53e);})['catch'](function(_0x154f49){_0x207851['mailAccounts'][_0x2d62e7['id']][_0xe996('0x30')][_0xe996('0x16')]=_0xe996('0x21');_0x207851['mailAccounts'][_0x2d62e7['id']][_0xe996('0x30')][_0xe996('0x17')]=_0x154f49;_0x207851[_0xe996('0x12')](_0x2d62e7['id']);_0x3d21c6(_0x154f49);});});}return this[_0xe996('0x10')][_0xe996('0x31')](_0x2d62e7);};module[_0xe996('0x33')]=EmailChannel; \ No newline at end of file +var _0xcb4e=['exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','prototype','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd','handleImapError','handleImapBox','connected','messages','firstName','from','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','then','verified'];(function(_0x4f0766,_0x1a6894){var _0x502c8a=function(_0x33774e){while(--_0x33774e){_0x4f0766['push'](_0x4f0766['shift']());}};_0x502c8a(++_0x1a6894);}(_0xcb4e,0xd9));var _0xecb4=function(_0x1a4c9e,_0x45c0d9){_0x1a4c9e=_0x1a4c9e-0x0;var _0x2501f0=_0xcb4e[_0x1a4c9e];return _0x2501f0;};'use strict';var _=require(_0xecb4('0x0'));var moment=require(_0xecb4('0x1'));var BPromise=require(_0xecb4('0x2'));var md5=require(_0xecb4('0x3'));var Redis=require('ioredis');var config=require(_0xecb4('0x4'));var logger=require(_0xecb4('0x5'))(_0xecb4('0x6'));config['redis']=_[_0xecb4('0x7')](config[_0xecb4('0x8')],{'host':_0xecb4('0x9'),'port':0x18eb});var io=require(_0xecb4('0xa'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0xecb4('0xb'));var md5Accounts={};function EmailChannel(_0x46406d){logger[_0xecb4('0xc')](_0xecb4('0xd'));this[_0xecb4('0xe')]=_0x46406d[_0xecb4('0xe')];this[_0xecb4('0xf')]={};this[_0xecb4('0x10')]=new EmailSmtp();}EmailChannel['prototype'][_0xecb4('0x11')]=function(_0x4e572b){var _0x442974=this[_0xecb4('0xe')][_0x4e572b];var _0x3719ff={'id':_0x442974['id'],'name':_0x442974[_0xecb4('0x12')],'key':_0x442974[_0xecb4('0x13')],'active':_0x442974[_0xecb4('0x14')],'Imap':{'status':_0x442974['Imap'][_0xecb4('0x15')],'messageStatus':_0x442974[_0xecb4('0x16')][_0xecb4('0x17')],'total':_0x442974[_0xecb4('0x16')][_0xecb4('0x18')]}};if(_[_0xecb4('0x19')](md5Accounts[_0x4e572b])){md5Accounts[_0x4e572b]={};}var _0x4d59e0=md5(JSON[_0xecb4('0x1a')](_0x3719ff));if(md5Accounts[_0x4e572b][_0xecb4('0x3')]!==_0x4d59e0){md5Accounts[_0x4e572b][_0xecb4('0x3')]=_0x4d59e0;io[_0xecb4('0x11')](_0xecb4('0x1b'),_0x3719ff);}};EmailChannel[_0xecb4('0x1c')]['refresh']=function(_0xa0e23c){for(var _0x4df4fc in _0xa0e23c){if(_0xa0e23c[_0xecb4('0x1d')](_0x4df4fc)){if(_0xa0e23c[_0x4df4fc]['Imap']&&_0xa0e23c[_0x4df4fc][_0xecb4('0x14')]){var _0x48678b=_0xa0e23c[_0x4df4fc][_0xecb4('0x16')];if(!this[_0xecb4('0xf')][_0xecb4('0x1d')](_0x48678b['id'])){this[_0xecb4('0xf')][_0x48678b['id']]=new EmailImap(_0x48678b,_0xa0e23c[_0x4df4fc]['email']);this[_0xecb4('0xf')][_0x48678b['id']]['on'](_0xecb4('0x1e'),this['handleImapBox'][_0xecb4('0x1f')](this,_0x4df4fc));this[_0xecb4('0xf')][_0x48678b['id']]['on'](_0xecb4('0x6'),this[_0xecb4('0x20')][_0xecb4('0x1f')](this,_0x4df4fc));this[_0xecb4('0xf')][_0x48678b['id']]['on'](_0xecb4('0x21'),this[_0xecb4('0x22')][_0xecb4('0x1f')](this,_0x4df4fc));this['imapAccounts'][_0x48678b['id']]['on']('error',this[_0xecb4('0x23')]['bind'](this,_0x4df4fc));}}else{if(_[_0xecb4('0x19')](this[_0xecb4('0xe')][_0x4df4fc][_0xecb4('0x16')])){this['mailAccounts'][_0x4df4fc][_0xecb4('0x16')]={};}this[_0xecb4('0xe')][_0x4df4fc][_0xecb4('0x16')][_0xecb4('0x15')]='disabled';this[_0xecb4('0xe')][_0x4df4fc][_0xecb4('0x16')][_0xecb4('0x17')]='';this[_0xecb4('0x11')](_0x4df4fc);}}}};EmailChannel[_0xecb4('0x1c')][_0xecb4('0x24')]=function(_0x58dd6f,_0x285136){if(this[_0xecb4('0xe')][_0x58dd6f]){this[_0xecb4('0xe')][_0x58dd6f][_0xecb4('0x16')]['status']=_0xecb4('0x25');this[_0xecb4('0xe')][_0x58dd6f][_0xecb4('0x16')][_0xecb4('0x17')]=_0x285136['name'];if(_0x285136[_0xecb4('0x26')]){this['mailAccounts'][_0x58dd6f][_0xecb4('0x16')]['total']=_0x285136['messages'][_0xecb4('0x18')];}return this[_0xecb4('0x11')](_0x58dd6f);}};EmailChannel[_0xecb4('0x1c')][_0xecb4('0x20')]=function(_0x1262bc,_0x431071){logger[_0xecb4('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x431071[_0xecb4('0x27')],_0x431071['lastName'],_0x431071[_0xecb4('0x28')],_0x1262bc);if(this[_0xecb4('0xe')][_0x1262bc]){return mailAccount['notify'](_0x1262bc,_0x431071)['then'](function(_0x487a11){if(_0x487a11){logger[_0xecb4('0xc')](_0xecb4('0x29'));}})[_0xecb4('0x2a')](function(_0x59fa21){logger[_0xecb4('0x2b')](_0xecb4('0x2c'),JSON[_0xecb4('0x1a')](_0x59fa21));});}};EmailChannel[_0xecb4('0x1c')]['handleImapEnd']=function(_0x4799c9){if(this['mailAccounts'][_0x4799c9]&&this['mailAccounts'][_0x4799c9][_0xecb4('0x16')]){if(this[_0xecb4('0xf')][this[_0xecb4('0xe')][_0x4799c9][_0xecb4('0x16')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x4799c9][_0xecb4('0x16')]['id']];}this['mailAccounts'][_0x4799c9][_0xecb4('0x16')][_0xecb4('0x2d')]=moment();this[_0xecb4('0x11')](_0x4799c9);}};EmailChannel[_0xecb4('0x1c')]['handleImapError']=function(_0x4646f2,_0x3a81b5){if(this[_0xecb4('0xe')][_0x4646f2]){this['mailAccounts'][_0x4646f2][_0xecb4('0x16')]['status']=_0xecb4('0x2b');this['mailAccounts'][_0x4646f2][_0xecb4('0x16')][_0xecb4('0x17')]=_0x3a81b5;return this[_0xecb4('0x11')](_0x4646f2);}};EmailChannel['prototype'][_0xecb4('0x2e')]=function(_0x2f1192,_0x4b7261){return this['smtp'][_0xecb4('0x2f')](_0x2f1192,_0x4b7261);};EmailChannel[_0xecb4('0x1c')][_0xecb4('0x30')]=function(_0x56a775){var _0x535a70=this;if(this[_0xecb4('0xe')][_0x56a775['id']]){if(_[_0xecb4('0x19')](this[_0xecb4('0xe')][_0x56a775['id']][_0xecb4('0x31')])){this[_0xecb4('0xe')][_0x56a775['id']][_0xecb4('0x31')]={};}this[_0xecb4('0xe')][_0x56a775['id']][_0xecb4('0x31')][_0xecb4('0x2d')]=moment();return new BPromise(function(_0x465de6,_0x458acb){return _0x535a70[_0xecb4('0x10')][_0xecb4('0x32')](_0x56a775)[_0xecb4('0x33')](function(_0x285578){_0x535a70[_0xecb4('0xe')][_0x56a775['id']]['Smtp']['status']=_0xecb4('0x34');_0x535a70['mailAccounts'][_0x56a775['id']][_0xecb4('0x31')][_0xecb4('0x17')]='';_0x535a70[_0xecb4('0x11')](_0x56a775['id']);_0x465de6(_0x285578);})[_0xecb4('0x2a')](function(_0x395efc){_0x535a70[_0xecb4('0xe')][_0x56a775['id']][_0xecb4('0x31')]['status']=_0xecb4('0x2b');_0x535a70[_0xecb4('0xe')][_0x56a775['id']]['Smtp']['messageStatus']=_0x395efc;_0x535a70[_0xecb4('0x11')](_0x56a775['id']);_0x458acb(_0x395efc);});});}return this['smtp']['verify'](_0x56a775);};module[_0xecb4('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 0985c36..fe13e87 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 _0xf3a9=['simpleParser','Iconv','events','EventEmitter','email','mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','error','handleError','connect','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','service','anonymous@xcally.com','openBox','handleOpenBox','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleEnd','stringify','textCode','hasOwnProperty','exports','util','imap','lodash','randomstring','mailparser'];(function(_0x4a32a8,_0x5eac0e){var _0x115f35=function(_0x374732){while(--_0x374732){_0x4a32a8['push'](_0x4a32a8['shift']());}};_0x115f35(++_0x5eac0e);}(_0xf3a9,0xb8));var _0x9f3a=function(_0x3ff28d,_0x27f95e){_0x3ff28d=_0x3ff28d-0x0;var _0x2d1234=_0xf3a9[_0x3ff28d];return _0x2d1234;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x9f3a('0x0'));var Imap=require(_0x9f3a('0x1'));var _=require(_0x9f3a('0x2'));var rs=require(_0x9f3a('0x3'));var simpleParser=require(_0x9f3a('0x4'))[_0x9f3a('0x5')];var Iconv=require('iconv')[_0x9f3a('0x6')];var EventEmitter=require(_0x9f3a('0x7'))[_0x9f3a('0x8')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x9f3a('0x9'));function EmailImap(_0x366f1b,_0x3e5474){this[_0x9f3a('0xa')]=_0x9f3a('0xb');this['account']=this[_0x9f3a('0xc')](_0x366f1b,_0x3e5474);this[_0x9f3a('0x1')]=new Imap(this[_0x9f3a('0xd')]);this[_0x9f3a('0x1')][_0x9f3a('0xe')](_0x9f3a('0xf'),this[_0x9f3a('0x10')][_0x9f3a('0x11')](this));this[_0x9f3a('0x1')][_0x9f3a('0xe')]('end',this['handleEnd'][_0x9f3a('0x11')](this));this[_0x9f3a('0x1')]['on'](_0x9f3a('0x12'),this[_0x9f3a('0x13')]['bind'](this));this[_0x9f3a('0x1')][_0x9f3a('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x9f3a('0x15')]['getAccount']=function(_0x562f47,_0x2e25b7){var _0x136553={'connTimeout':_0x562f47[_0x9f3a('0x16')]?_0x562f47[_0x9f3a('0x16')]*0x3e8:0x2710,'authTimeout':_0x562f47[_0x9f3a('0x17')]?_0x562f47[_0x9f3a('0x17')]*0x3e8:0x1388};if(_[_0x9f3a('0x18')](_0x562f47['service'])){if(_0x562f47[_0x9f3a('0x19')]){_0x136553[_0x9f3a('0x1a')]=_0x562f47['user'];_0x136553[_0x9f3a('0x1b')]=_0x562f47[_0x9f3a('0x1b')];}_0x136553[_0x9f3a('0x1c')]=_0x562f47[_0x9f3a('0x1c')];_0x136553[_0x9f3a('0x1d')]=_0x562f47[_0x9f3a('0x1d')]||0x3e1;if(_0x562f47['tls']){_0x136553['tls']=!![];}else{_0x136553[_0x9f3a('0x1e')]=![];_0x136553[_0x9f3a('0x1f')]=_0x9f3a('0x20');}}else{_0x136553[_0x9f3a('0x1a')]=_0x562f47[_0x9f3a('0x1a')];_0x136553[_0x9f3a('0x1b')]=_0x562f47[_0x9f3a('0x1b')];_0x136553[_0x9f3a('0x1c')]=utils['getHost'](_0x562f47[_0x9f3a('0x21')]);_0x136553[_0x9f3a('0x1d')]=0x3e1;_0x136553[_0x9f3a('0x1e')]=!![];}_0x136553[_0x9f3a('0x9')]=_0x2e25b7||_0x562f47[_0x9f3a('0x1a')]||_0x9f3a('0x22');return _0x136553;};EmailImap[_0x9f3a('0x15')][_0x9f3a('0x10')]=function(){this[_0x9f3a('0x1')][_0x9f3a('0x23')](this[_0x9f3a('0xa')],![],this['handleOpenBox'][_0x9f3a('0x11')](this));};EmailImap[_0x9f3a('0x15')][_0x9f3a('0x24')]=function(_0x37d01b,_0x2f31b4){if(_0x37d01b){this['handleError'](_0x37d01b,!![]);}else{this['emit'](_0x9f3a('0x25'),_0x2f31b4);this[_0x9f3a('0x26')]();}};EmailImap[_0x9f3a('0x15')][_0x9f3a('0x27')]=function(_0x1ca5f8){if(_0x1ca5f8){this[_0x9f3a('0x13')](_0x1ca5f8,!![]);}else{this[_0x9f3a('0x1')][_0x9f3a('0x28')]();}};EmailImap[_0x9f3a('0x15')]['readUnseen']=function(){this[_0x9f3a('0x1')][_0x9f3a('0x29')]([_0x9f3a('0x2a')],this[_0x9f3a('0x2b')][_0x9f3a('0x11')](this));};EmailImap[_0x9f3a('0x15')][_0x9f3a('0x2b')]=function(_0x19de24,_0xfdee38){if(_0x19de24){this[_0x9f3a('0x13')](_0x19de24,!![]);}else{if(_0xfdee38[_0x9f3a('0x2c')]){try{var _0x233e02=this[_0x9f3a('0x1')][_0x9f3a('0x2d')](_0xfdee38,{'bodies':'','markSeen':!![]});_0x233e02['on'](_0x9f3a('0x2e'),this['handleFetchMessage']['bind'](this));_0x233e02[_0x9f3a('0xe')](_0x9f3a('0x12'),this[_0x9f3a('0x2f')]['bind'](this));_0x233e02[_0x9f3a('0xe')](_0x9f3a('0x28'),this[_0x9f3a('0x30')][_0x9f3a('0x11')](this));}catch(_0x1c490f){logger[_0x9f3a('0x12')](_0x1c490f);}}else{this[_0x9f3a('0x1')][_0x9f3a('0x31')](!![],this[_0x9f3a('0x27')][_0x9f3a('0x11')](this));}}};EmailImap[_0x9f3a('0x15')][_0x9f3a('0x32')]=function(_0x4d680d,_0x5deee5){_0x4d680d['on']('body',this[_0x9f3a('0x33')][_0x9f3a('0x11')](this));_0x4d680d[_0x9f3a('0xe')](_0x9f3a('0x34'),this[_0x9f3a('0x35')]['bind'](this));_0x4d680d['once'](_0x9f3a('0x28'),this[_0x9f3a('0x36')][_0x9f3a('0x11')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x484513,_0x17d95c){simpleParser(_0x484513,{'Iconv':Iconv},this[_0x9f3a('0x37')][_0x9f3a('0x11')](this));};EmailImap['prototype'][_0x9f3a('0x35')]=function(_0x2e5e7c){};EmailImap[_0x9f3a('0x15')][_0x9f3a('0x36')]=function(){};EmailImap[_0x9f3a('0x15')]['handleSimpleParser']=function(_0x4670bf,_0x460102){if(_0x4670bf){logger[_0x9f3a('0x12')](_0x4670bf);}else{var _0x585cd2=this;utils[_0x9f3a('0x38')](this['account'],_0x460102,function(_0x107388){_0x585cd2[_0x9f3a('0x39')](_0x9f3a('0x9'),_0x107388);});}};EmailImap[_0x9f3a('0x15')][_0x9f3a('0x30')]=function(){this[_0x9f3a('0x1')][_0x9f3a('0x31')](!![],this[_0x9f3a('0x27')]['bind'](this));};EmailImap['prototype'][_0x9f3a('0x2f')]=function(_0x18c28b){this['handleError'](_0x18c28b);this[_0x9f3a('0x1')][_0x9f3a('0x31')](!![],this['handleCloseBox'][_0x9f3a('0x11')](this));};EmailImap[_0x9f3a('0x15')][_0x9f3a('0x3a')]=function(){this['emit'](_0x9f3a('0x28'));};EmailImap['prototype'][_0x9f3a('0x13')]=function(_0x1e6307,_0x3730e5){logger[_0x9f3a('0x12')](_0x9f3a('0x13'),this[_0x9f3a('0xd')][_0x9f3a('0x9')],JSON[_0x9f3a('0x3b')](_0x1e6307));var _0xad44f0='';if(_0x1e6307){if(_0x1e6307['textCode']){_0xad44f0=_0x1e6307[_0x9f3a('0x3c')];}else{for(var _0x250873 in _0x1e6307){if(_0x1e6307[_0x9f3a('0x3d')](_0x250873)){_0xad44f0+=_['upperFirst'](_0x250873)+':\x20'+_0x1e6307[_0x250873]+'\x0a';}}}}if(_0x3730e5){this[_0x9f3a('0x1')][_0x9f3a('0x28')]();}else{this[_0x9f3a('0x39')](_0x9f3a('0x12'),_0xad44f0);this[_0x9f3a('0x39')](_0x9f3a('0x28'));}};module[_0x9f3a('0x3e')]=EmailImap; \ No newline at end of file +var _0x3339=['mailparser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','ready','bind','once','end','handleError','connect','inherits','connTimeout','authTimeout','authentication','user','password','host','port','tls','autotls','getHost','service','anonymous@xcally.com','prototype','handleReady','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','closeBox','handleEnd','stringify','textCode','upperFirst','path','imap','lodash','randomstring'];(function(_0x1b6504,_0x329254){var _0x425e6d=function(_0x459482){while(--_0x459482){_0x1b6504['push'](_0x1b6504['shift']());}};_0x425e6d(++_0x329254);}(_0x3339,0x1a7));var _0x9333=function(_0x2cdab4,_0x5992ad){_0x2cdab4=_0x2cdab4-0x0;var _0x2a0ee7=_0x3339[_0x2cdab4];return _0x2a0ee7;};'use strict';var fs=require('fs');var path=require(_0x9333('0x0'));var util=require('util');var Imap=require(_0x9333('0x1'));var _=require(_0x9333('0x2'));var rs=require(_0x9333('0x3'));var simpleParser=require(_0x9333('0x4'))['simpleParser'];var Iconv=require(_0x9333('0x5'))['Iconv'];var EventEmitter=require(_0x9333('0x6'))[_0x9333('0x7')];var utils=require(_0x9333('0x8'));var logger=require(_0x9333('0x9'))(_0x9333('0xa'));function EmailImap(_0x1e5510,_0x303ff7){this[_0x9333('0xb')]=_0x9333('0xc');this[_0x9333('0xd')]=this[_0x9333('0xe')](_0x1e5510,_0x303ff7);this[_0x9333('0x1')]=new Imap(this['account']);this[_0x9333('0x1')]['once'](_0x9333('0xf'),this['handleReady'][_0x9333('0x10')](this));this[_0x9333('0x1')][_0x9333('0x11')](_0x9333('0x12'),this['handleEnd'][_0x9333('0x10')](this));this[_0x9333('0x1')]['on']('error',this[_0x9333('0x13')]['bind'](this));this[_0x9333('0x1')][_0x9333('0x14')]();}util[_0x9333('0x15')](EmailImap,EventEmitter);EmailImap['prototype'][_0x9333('0xe')]=function(_0x3b9075,_0x12462f){var _0x517398={'connTimeout':_0x3b9075[_0x9333('0x16')]?_0x3b9075[_0x9333('0x16')]*0x3e8:0x2710,'authTimeout':_0x3b9075[_0x9333('0x17')]?_0x3b9075['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x3b9075['service'])){if(_0x3b9075[_0x9333('0x18')]){_0x517398[_0x9333('0x19')]=_0x3b9075['user'];_0x517398['password']=_0x3b9075[_0x9333('0x1a')];}_0x517398['host']=_0x3b9075[_0x9333('0x1b')];_0x517398['port']=_0x3b9075[_0x9333('0x1c')]||0x3e1;if(_0x3b9075[_0x9333('0x1d')]){_0x517398[_0x9333('0x1d')]=!![];}else{_0x517398[_0x9333('0x1d')]=![];_0x517398[_0x9333('0x1e')]='required';}}else{_0x517398[_0x9333('0x19')]=_0x3b9075[_0x9333('0x19')];_0x517398[_0x9333('0x1a')]=_0x3b9075[_0x9333('0x1a')];_0x517398[_0x9333('0x1b')]=utils[_0x9333('0x1f')](_0x3b9075[_0x9333('0x20')]);_0x517398['port']=0x3e1;_0x517398[_0x9333('0x1d')]=!![];}_0x517398[_0x9333('0xa')]=_0x12462f||_0x3b9075[_0x9333('0x19')]||_0x9333('0x21');return _0x517398;};EmailImap[_0x9333('0x22')][_0x9333('0x23')]=function(){this[_0x9333('0x1')][_0x9333('0x24')](this['mailbox'],![],this['handleOpenBox'][_0x9333('0x10')](this));};EmailImap[_0x9333('0x22')][_0x9333('0x25')]=function(_0x22e2d9,_0x4605cf){if(_0x22e2d9){this['handleError'](_0x22e2d9,!![]);}else{this[_0x9333('0x26')](_0x9333('0x27'),_0x4605cf);this[_0x9333('0x28')]();}};EmailImap[_0x9333('0x22')][_0x9333('0x29')]=function(_0x51ffff){if(_0x51ffff){this[_0x9333('0x13')](_0x51ffff,!![]);}else{this[_0x9333('0x1')][_0x9333('0x12')]();}};EmailImap[_0x9333('0x22')]['readUnseen']=function(){this['imap'][_0x9333('0x2a')]([_0x9333('0x2b')],this[_0x9333('0x2c')][_0x9333('0x10')](this));};EmailImap['prototype'][_0x9333('0x2c')]=function(_0x5e4bd0,_0x5d406b){if(_0x5e4bd0){this[_0x9333('0x13')](_0x5e4bd0,!![]);}else{if(_0x5d406b['length']){try{var _0x22ab4f=this[_0x9333('0x1')]['fetch'](_0x5d406b,{'bodies':'','markSeen':!![]});_0x22ab4f['on'](_0x9333('0x2d'),this[_0x9333('0x2e')][_0x9333('0x10')](this));_0x22ab4f[_0x9333('0x11')](_0x9333('0x2f'),this[_0x9333('0x30')][_0x9333('0x10')](this));_0x22ab4f['once'](_0x9333('0x12'),this[_0x9333('0x31')][_0x9333('0x10')](this));}catch(_0x307642){logger[_0x9333('0x2f')](_0x307642);}}else{this[_0x9333('0x1')]['closeBox'](!![],this[_0x9333('0x29')][_0x9333('0x10')](this));}}};EmailImap['prototype'][_0x9333('0x2e')]=function(_0x252dbc,_0x378b1c){_0x252dbc['on'](_0x9333('0x32'),this[_0x9333('0x33')][_0x9333('0x10')](this));_0x252dbc[_0x9333('0x11')](_0x9333('0x34'),this[_0x9333('0x35')][_0x9333('0x10')](this));_0x252dbc['once'](_0x9333('0x12'),this[_0x9333('0x36')][_0x9333('0x10')](this));};EmailImap[_0x9333('0x22')]['handleMessageBody']=function(_0x302140,_0x56dccd){simpleParser(_0x302140,{'Iconv':Iconv},this[_0x9333('0x37')]['bind'](this));};EmailImap['prototype'][_0x9333('0x35')]=function(_0xb47671){};EmailImap['prototype'][_0x9333('0x36')]=function(){};EmailImap[_0x9333('0x22')][_0x9333('0x37')]=function(_0x1b7229,_0x205060){if(_0x1b7229){logger[_0x9333('0x2f')](_0x1b7229);}else{var _0x8f773=this;utils['parser'](this[_0x9333('0xd')],_0x205060,function(_0x1c74a1){_0x8f773[_0x9333('0x26')]('email',_0x1c74a1);});}};EmailImap['prototype'][_0x9333('0x31')]=function(){this[_0x9333('0x1')][_0x9333('0x38')](!![],this[_0x9333('0x29')]['bind'](this));};EmailImap[_0x9333('0x22')][_0x9333('0x30')]=function(_0x7be911){this[_0x9333('0x13')](_0x7be911);this['imap'][_0x9333('0x38')](!![],this[_0x9333('0x29')][_0x9333('0x10')](this));};EmailImap[_0x9333('0x22')][_0x9333('0x39')]=function(){this[_0x9333('0x26')](_0x9333('0x12'));};EmailImap['prototype'][_0x9333('0x13')]=function(_0x4f5a14,_0x56d168){logger[_0x9333('0x2f')]('handleError',this[_0x9333('0xd')][_0x9333('0xa')],JSON[_0x9333('0x3a')](_0x4f5a14));var _0x192cad='';if(_0x4f5a14){if(_0x4f5a14[_0x9333('0x3b')]){_0x192cad=_0x4f5a14[_0x9333('0x3b')];}else{for(var _0x308f4e in _0x4f5a14){if(_0x4f5a14['hasOwnProperty'](_0x308f4e)){_0x192cad+=_[_0x9333('0x3c')](_0x308f4e)+':\x20'+_0x4f5a14[_0x308f4e]+'\x0a';}}}}if(_0x56d168){this[_0x9333('0x1')][_0x9333('0x12')]();}else{this[_0x9333('0x26')](_0x9333('0x2f'),_0x192cad);this[_0x9333('0x26')](_0x9333('0x12'));}};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 c0169a5..b7294b4 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 _0xc50c=['bluebird','nodemailer-plugin-inline-base64','prototype','use','sendMail','toString','verify','createTransport','Not\x20verifired','nodemailer'];(function(_0x1bf8cc,_0x118778){var _0x322d20=function(_0x36953d){while(--_0x36953d){_0x1bf8cc['push'](_0x1bf8cc['shift']());}};_0x322d20(++_0x118778);}(_0xc50c,0x8b));var _0xcc50=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xc50c[_0x243b59];return _0x3e1676;};'use strict';var nodemailer=require(_0xcc50('0x0'));var BPromise=require(_0xcc50('0x1'));var inlineBase64=require(_0xcc50('0x2'));function EmailSmtp(){}EmailSmtp[_0xcc50('0x3')]['send']=function(_0x47e5e4,_0x507e10){return new BPromise(function(_0x1ac61e,_0x1b9fac){var _0x38cf55=nodemailer['createTransport'](_0x47e5e4);_0x38cf55[_0xcc50('0x4')]('compile',inlineBase64());_0x38cf55[_0xcc50('0x5')](_0x507e10,function(_0x870e78,_0x47f4ad){if(_0x870e78){_0x1b9fac(_0x870e78[_0xcc50('0x6')]());}else{_0x1ac61e(_0x47f4ad);}});});};EmailSmtp['prototype'][_0xcc50('0x7')]=function(_0x1b0fa7){return new BPromise(function(_0xe039d4,_0x1e806a){var _0x5f53f1=nodemailer[_0xcc50('0x8')](_0x1b0fa7);_0x5f53f1['verify'](function(_0xe1a639,_0x250f89){if(_0xe1a639){_0x1e806a(_0xe1a639[_0xcc50('0x6')]());}else{if(_0x250f89){_0xe039d4(_0x250f89);}else{_0x1e806a(_0xcc50('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xca4c=['nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','createTransport','compile','sendMail','verify','toString','Not\x20verifired'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca4c,0x6e));var _0xcca4=function(_0x23a11d,_0x24442c){_0x23a11d=_0x23a11d-0x0;var _0x2e593c=_0xca4c[_0x23a11d];return _0x2e593c;};'use strict';var nodemailer=require(_0xcca4('0x0'));var BPromise=require(_0xcca4('0x1'));var inlineBase64=require(_0xcca4('0x2'));function EmailSmtp(){}EmailSmtp[_0xcca4('0x3')]['send']=function(_0x37fc2f,_0x2b6c43){return new BPromise(function(_0x1c5728,_0x81d1d4){var _0x272d04=nodemailer[_0xcca4('0x4')](_0x37fc2f);_0x272d04['use'](_0xcca4('0x5'),inlineBase64());_0x272d04[_0xcca4('0x6')](_0x2b6c43,function(_0x83d654,_0xf98297){if(_0x83d654){_0x81d1d4(_0x83d654['toString']());}else{_0x1c5728(_0xf98297);}});});};EmailSmtp[_0xcca4('0x3')]['verify']=function(_0x249d3e){return new BPromise(function(_0x24439b,_0x6780ae){var _0x349457=nodemailer[_0xcca4('0x4')](_0x249d3e);_0x349457[_0xcca4('0x7')](function(_0x1cda59,_0x15f970){if(_0x1cda59){_0x6780ae(_0x1cda59[_0xcca4('0x8')]());}else{if(_0x15f970){_0x24439b(_0x15f970);}else{_0x6780ae(_0xcca4('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 987aa5a..eadf58b 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 _0x6209=['line','isAutoreply','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','value','address','anonymous','head','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','html','test','includes','','body','textAsHtml','message','email','originCc','originTo','bcc','attach','type','attachment','format','%s-%s','now','root','server/files/attachments/','contentType','headerLines'];(function(_0x2c4634,_0xe91ff6){var _0x2c99a1=function(_0x3d805f){while(--_0x3d805f){_0x2c4634['push'](_0x2c4634['shift']());}};_0x2c99a1(++_0xe91ff6);}(_0x6209,0x1e8));var _0x9620=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x6209[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x9620('0x0'));var moment=require(_0x9620('0x1'));var random=require(_0x9620('0x2'));var fs=require('fs');var path=require(_0x9620('0x3'));var util=require(_0x9620('0x4'));var tnef=require(_0x9620('0x5'));var logger=require(_0x9620('0x6'))('email');var config=require(_0x9620('0x7'));function getAddress(_0x17dc92){var _0x2fa00b=_['head'](_0x17dc92[_0x9620('0x8')]);return _0x2fa00b&&_0x2fa00b[_0x9620('0x9')]?_0x2fa00b[_0x9620('0x9')]:_0x9620('0xa')+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x11af3d){var _0x5dff8a=_[_0x9620('0xb')](_0x11af3d[_0x9620('0x8')]);if(_0x5dff8a&&_0x5dff8a[_0x9620('0xc')]){if(_0x5dff8a[_0x9620('0xc')]==_0x5dff8a[_0x9620('0x9')]){return _0x5dff8a[_0x9620('0xc')][_0x9620('0xd')](0x0,_0x5dff8a['name'][_0x9620('0xe')]('@'));}var _0x52bb7c=_0x5dff8a[_0x9620('0xc')][_0x9620('0xf')](/\s+/);return _0x52bb7c[_0x9620('0x10')]>0x1?_0x52bb7c[_0x9620('0x11')](0x0,-0x1)[_0x9620('0x12')]('\x20'):_0x5dff8a[_0x9620('0xc')];}return _0x9620('0x13');}function getLastName(_0x463512){var _0x659cc7=_[_0x9620('0xb')](_0x463512['value']);if(_0x659cc7&&_0x659cc7['name']){var _0x2b144b=_0x659cc7[_0x9620('0xc')]['split'](/\s+/);return _0x2b144b[_0x9620('0x10')]>0x1?_0x2b144b[_0x9620('0x14')]():'';}return'';}function getMails(_0x34168b,_0x1a75d8){var _0x4f399c='';for(var _0x2cb40e=0x0;_0x2cb40e<_0x1a75d8[_0x9620('0x8')]['length'];_0x2cb40e+=0x1){if(_0x1a75d8[_0x9620('0x8')][_0x2cb40e]['address']!==_0x34168b){if(!_[_0x9620('0x15')](_0x4f399c)){_0x4f399c+=',';}_0x4f399c+=_0x1a75d8[_0x9620('0x8')][_0x2cb40e][_0x9620('0xc')]||_0x1a75d8[_0x9620('0x8')][_0x2cb40e][_0x9620('0x9')]||'';_0x4f399c+='\x20<';_0x4f399c+=_0x1a75d8['value'][_0x2cb40e][_0x9620('0x9')]?_0x1a75d8['value'][_0x2cb40e]['address']:'anonymous'+random['generate'](0x6)+'@xcally.com';_0x4f399c+='>';}}return _0x4f399c;}function parseEmail(_0x293ecf,_0x5b62f5,_0x3fc674){if(_0x5b62f5[_0x9620('0x16')]){var _0xe60a48=/)<[^<]*)*<\/script>/gi;while(_0xe60a48[_0x9620('0x17')](_0x5b62f5[_0x9620('0x16')])){_0x5b62f5[_0x9620('0x16')]=_0x5b62f5[_0x9620('0x16')]['replace'](_0xe60a48,'');}if(_0x5b62f5['html'][_0x9620('0x18')](_0x9620('0x19'))){var _0x50386a=[];_0x5b62f5[_0x9620('0x1a')][_0x9620('0x1b')](_0x3dcbca=>{_0x50386a[_0x9620('0x1c')](_0x3dcbca[_0x9620('0x1d')]);});var _0x42520d=/]+>/g;var _0x2edc88=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1527bd=_0x5b62f5[_0x9620('0x16')][_0x9620('0x1e')](_0x2edc88,_0x9620('0x1f'));var _0x4907ea=_0x1527bd[_0x9620('0x1e')](_0x42520d,_0x9620('0x20'));for(let _0x1a7eeb=0x0;_0x1a7eeb<_0x50386a[_0x9620('0x10')];_0x1a7eeb++){var _0x499e26=_0x4907ea['replace'](_0x9620('0x20'),'\x20[Attachment:\x20'+_0x50386a[_0x1a7eeb]+_0x9620('0x21'));_0x4907ea=_0x499e26;}_0x5b62f5['html']=_0x4907ea;}_0x3fc674['body']=_0x5b62f5[_0x9620('0x16')];}else{_0x3fc674[_0x9620('0x22')]=_0x5b62f5[_0x9620('0x23')];}if(_0x3fc674['body']){_0x3fc674[_0x9620('0x22')]=_0x3fc674[_0x9620('0x22')][_0x9620('0x1e')](/0x0){var _0x20b422=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x20217a=0x0;_0x20217a<_0x5b62f5['headerLines'][_0x9620('0x10')];_0x20217a++){var _0x5d09e1=_['indexOf'](_0x20b422,_0x5b62f5[_0x9620('0x32')][_0x20217a][_0x9620('0x33')]);if(_0x5d09e1>=0x0){_0x3fc674[_0x9620('0x34')]=!![];}}}return _0x3fc674;}exports['parser']=function(_0x3e5b60,_0x1b2ab0,_0xb99aee){var _0x1af6e8={'from':getAddress(_0x1b2ab0[_0x9620('0x35')]),'firstName':getFirstName(_0x1b2ab0[_0x9620('0x35')]),'lastName':getLastName(_0x1b2ab0[_0x9620('0x35')]),'mapKey':_0x9620('0x25'),'message':{'from':getMails(_0x3e5b60[_0x9620('0x25')],_0x1b2ab0[_0x9620('0x35')]),'to':_0x3e5b60['email'],'cc':'','subject':_0x1b2ab0[_0x9620('0x36')]||'','messageId':_0x1b2ab0[_0x9620('0x37')],'inReplyTo':_0x1b2ab0[_0x9620('0x38')],'sentAt':moment(_0x1b2ab0[_0x9620('0x39')])[_0x9620('0x2c')](_0x9620('0x3a')),'attach':![],'attachments':[]}};if(!_0x1b2ab0[_0x9620('0x16')]&&!_0x1b2ab0['textAsHtml']){var _0x4d151b=_['filter'](_0x1b2ab0[_0x9620('0x1a')],{'contentType':_0x9620('0x3b')});if(_0x4d151b[_0x9620('0x10')]){logger[_0x9620('0x3c')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1b2ab0['messageId']));tnef[_0x9620('0x3d')](_[_0x9620('0x3e')](_0x4d151b)['content'],function(_0x254d28,_0x3866aa){if(_0x3866aa){_0x1b2ab0['html']=_0x3866aa[_0x9620('0x3f')]||_0x9620('0x40');if(_0x3866aa['Attachments']){for(var _0x327911=0x0;_0x327911<_0x3866aa[_0x9620('0x41')]['length'];_0x327911++){var _0x22d88b=_0x3866aa['Attachments'][_0x327911];_0x1af6e8[_0x9620('0x24')]['attachments'][_0x9620('0x1c')]({'filename':_0x22d88b['Title'],'content':Buffer[_0x9620('0x35')](_0x22d88b[_0x9620('0x42')])});}}}_0xb99aee(parseEmail(_0x3e5b60,_0x1b2ab0,_0x1af6e8));});}else{_0x1b2ab0[_0x9620('0x16')]='

Empty\x20message

';_0xb99aee(parseEmail(_0x3e5b60,_0x1b2ab0,_0x1af6e8));}}else{_0xb99aee(parseEmail(_0x3e5b60,_0x1b2ab0,_0x1af6e8));}};exports[_0x9620('0x43')]=function(_0x1d35a0){switch(_0x1d35a0){case _0x9620('0x44'):return _0x9620('0x45');case _0x9620('0x46'):return _0x9620('0x47');case _0x9620('0x48'):return _0x9620('0x49');case _0x9620('0x4a'):return _0x9620('0x4b');}return _0x9620('0x4c');}; \ No newline at end of file +var _0x0a05=['filter','info','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','value','address','generate','@xcally.com','name','length','slice','join','Anonymous','head','isEmpty','anonymous','html','replace','includes','','body','0x1?_0x58080b[_0x50a0('0xe')](0x0,-0x1)[_0x50a0('0xf')]('\x20'):_0x2ea146[_0x50a0('0xc')];}return _0x50a0('0x10');}function getLastName(_0x5eadb1){var _0x255159=_[_0x50a0('0x11')](_0x5eadb1[_0x50a0('0x8')]);if(_0x255159&&_0x255159[_0x50a0('0xc')]){var _0x113142=_0x255159['name']['split'](/\s+/);return _0x113142['length']>0x1?_0x113142['pop']():'';}return'';}function getMails(_0x2a4ce7,_0x2b6b20){var _0x3c641e='';for(var _0x3a0e4d=0x0;_0x3a0e4d<_0x2b6b20[_0x50a0('0x8')][_0x50a0('0xd')];_0x3a0e4d+=0x1){if(_0x2b6b20['value'][_0x3a0e4d]['address']!==_0x2a4ce7){if(!_[_0x50a0('0x12')](_0x3c641e)){_0x3c641e+=',';}_0x3c641e+=_0x2b6b20[_0x50a0('0x8')][_0x3a0e4d][_0x50a0('0xc')]||_0x2b6b20[_0x50a0('0x8')][_0x3a0e4d][_0x50a0('0x9')]||'';_0x3c641e+='\x20<';_0x3c641e+=_0x2b6b20['value'][_0x3a0e4d][_0x50a0('0x9')]?_0x2b6b20['value'][_0x3a0e4d][_0x50a0('0x9')]:_0x50a0('0x13')+random[_0x50a0('0xa')](0x6)+_0x50a0('0xb');_0x3c641e+='>';}}return _0x3c641e;}function parseEmail(_0x5447ad,_0x62c40a,_0x5bfbab){if(_0x62c40a[_0x50a0('0x14')]){var _0x3c7e89=/)<[^<]*)*<\/script>/gi;while(_0x3c7e89['test'](_0x62c40a[_0x50a0('0x14')])){_0x62c40a[_0x50a0('0x14')]=_0x62c40a[_0x50a0('0x14')][_0x50a0('0x15')](_0x3c7e89,'');}if(_0x62c40a[_0x50a0('0x14')][_0x50a0('0x16')](_0x50a0('0x17'))){var _0x263c00=[];_0x62c40a['attachments']['forEach'](_0x3378e2=>{_0x263c00[_0x50a0('0x18')](_0x3378e2[_0x50a0('0x19')]);});var _0x4c9d9b=/]+>/g;var _0x40b91c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1ff89a=_0x62c40a[_0x50a0('0x14')]['replace'](_0x40b91c,_0x50a0('0x1a'));var _0x498a52=_0x1ff89a[_0x50a0('0x15')](_0x4c9d9b,_0x50a0('0x1b'));for(let _0xd31d0=0x0;_0xd31d0<_0x263c00['length'];_0xd31d0++){var _0xde56f1=_0x498a52[_0x50a0('0x15')](_0x50a0('0x1b'),'\x20[Attachment:\x20'+_0x263c00[_0xd31d0]+_0x50a0('0x1c'));_0x498a52=_0xde56f1;}_0x62c40a[_0x50a0('0x14')]=_0x498a52;}_0x5bfbab[_0x50a0('0x1d')]=_0x62c40a[_0x50a0('0x14')];}else{_0x5bfbab['body']=_0x62c40a['textAsHtml'];}if(_0x5bfbab['body']){_0x5bfbab['body']=_0x5bfbab[_0x50a0('0x1d')][_0x50a0('0x15')](/0x0){var _0x1d4208=['Auto-Submitted:\x20auto-replied',_0x50a0('0x2f'),_0x50a0('0x30')];for(var _0x3ea1be=0x0;_0x3ea1be<_0x62c40a['headerLines'][_0x50a0('0xd')];_0x3ea1be++){var _0xf18319=_['indexOf'](_0x1d4208,_0x62c40a['headerLines'][_0x3ea1be][_0x50a0('0x31')]);if(_0xf18319>=0x0){_0x5bfbab[_0x50a0('0x32')]=!![];}}}return _0x5bfbab;}exports[_0x50a0('0x33')]=function(_0x47816b,_0x15d601,_0x525fb2){var _0x38947b={'from':getAddress(_0x15d601[_0x50a0('0x34')]),'firstName':getFirstName(_0x15d601['from']),'lastName':getLastName(_0x15d601[_0x50a0('0x34')]),'mapKey':'email','message':{'from':getMails(_0x47816b['email'],_0x15d601['from']),'to':_0x47816b[_0x50a0('0x21')],'cc':'','subject':_0x15d601['subject']||'','messageId':_0x15d601[_0x50a0('0x35')],'inReplyTo':_0x15d601[_0x50a0('0x36')],'sentAt':moment(_0x15d601[_0x50a0('0x37')])[_0x50a0('0x28')](_0x50a0('0x38')),'attach':![],'attachments':[]}};if(!_0x15d601[_0x50a0('0x14')]&&!_0x15d601[_0x50a0('0x39')]){var _0x538816=_[_0x50a0('0x3a')](_0x15d601[_0x50a0('0x23')],{'contentType':'application/ms-tnef'});if(_0x538816[_0x50a0('0xd')]){logger[_0x50a0('0x3b')](util[_0x50a0('0x28')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x15d601[_0x50a0('0x35')]));tnef[_0x50a0('0x3c')](_['first'](_0x538816)['content'],function(_0x4de799,_0x231590){if(_0x231590){_0x15d601[_0x50a0('0x14')]=_0x231590[_0x50a0('0x3d')]||_0x50a0('0x3e');if(_0x231590[_0x50a0('0x3f')]){for(var _0x169753=0x0;_0x169753<_0x231590[_0x50a0('0x3f')][_0x50a0('0xd')];_0x169753++){var _0x1427f4=_0x231590[_0x50a0('0x3f')][_0x169753];_0x38947b['message'][_0x50a0('0x23')][_0x50a0('0x18')]({'filename':_0x1427f4[_0x50a0('0x40')],'content':Buffer[_0x50a0('0x34')](_0x1427f4['Data'])});}}}_0x525fb2(parseEmail(_0x47816b,_0x15d601,_0x38947b));});}else{_0x15d601[_0x50a0('0x14')]='

Empty\x20message

';_0x525fb2(parseEmail(_0x47816b,_0x15d601,_0x38947b));}}else{_0x525fb2(parseEmail(_0x47816b,_0x15d601,_0x38947b));}};exports[_0x50a0('0x41')]=function(_0x532000){switch(_0x532000){case _0x50a0('0x42'):return _0x50a0('0x43');case'yahoo':return'imap.mail.yahoo.com';case _0x50a0('0x44'):return _0x50a0('0x45');case _0x50a0('0x46'):return _0x50a0('0x47');}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 3a63ffe..cd87fed 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 _0x990d=['key','SERV','active','Imap','Smtp','exports','Service'];(function(_0x2dc70d,_0x26e805){var _0x3b9ecc=function(_0x52f7ef){while(--_0x52f7ef){_0x2dc70d['push'](_0x2dc70d['shift']());}};_0x3b9ecc(++_0x26e805);}(_0x990d,0xf4));var _0xd990=function(_0x10e631,_0x5e63ca){_0x10e631=_0x10e631-0x0;var _0x23edb2=_0x990d[_0x10e631];return _0x23edb2;};'use strict';var _=require('lodash');function MailAccount(_0x102a3e){this['id']=_0x102a3e['id']||0x0;this['name']=_0x102a3e['name']||_0xd990('0x0');this[_0xd990('0x1')]=_0x102a3e['key']||_0xd990('0x2');this['active']=_0x102a3e[_0xd990('0x3')]||![];this['Imap']=_0x102a3e[_0xd990('0x4')]||[];this[_0xd990('0x5')]=_0x102a3e['Smtp']||[];}module[_0xd990('0x6')]=MailAccount; \ No newline at end of file +var _0xdcf3=['name','Service','key','SERV','active','Imap','Smtp','lodash'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0xdcf3,0x15f));var _0x3dcf=function(_0x1c1754,_0x2b176d){_0x1c1754=_0x1c1754-0x0;var _0x208716=_0xdcf3[_0x1c1754];return _0x208716;};'use strict';var _=require(_0x3dcf('0x0'));function MailAccount(_0x3408f8){this['id']=_0x3408f8['id']||0x0;this[_0x3dcf('0x1')]=_0x3408f8[_0x3dcf('0x1')]||_0x3dcf('0x2');this[_0x3dcf('0x3')]=_0x3408f8[_0x3dcf('0x3')]||_0x3dcf('0x4');this[_0x3dcf('0x5')]=_0x3408f8[_0x3dcf('0x5')]||![];this['Imap']=_0x3408f8[_0x3dcf('0x6')]||[];this[_0x3dcf('0x7')]=_0x3408f8[_0x3dcf('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index b0941f1..38840c6 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 _0xfaf4=['merge','exports','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','length'];(function(_0x4dbe85,_0x3a650e){var _0x4cd71e=function(_0x123d0a){while(--_0x123d0a){_0x4dbe85['push'](_0x4dbe85['shift']());}};_0x4cd71e(++_0x3a650e);}(_0xfaf4,0x1ca));var _0x4faf=function(_0x2ac2ec,_0xbff361){_0x2ac2ec=_0x2ac2ec-0x0;var _0x1d520b=_0xfaf4[_0x2ac2ec];return _0x1d520b;};'use strict';var _=require('lodash');var MailAccount=require(_0x4faf('0x0'));var Realtime=function(){this[_0x4faf('0x1')]={};};function freeIsNotKey(_0x291a28,_0x217673,_0x458e68){var _0x477b75=_['mapKeys'](_0x291a28,function(_0x4b91f4,_0x49f2a0){return _0x4b91f4[_0x458e68];});for(var _0x4337d2 in _0x217673){if(_0x217673[_0x4faf('0x2')](_0x4337d2)){if(!_0x477b75[_0x4337d2]){delete _0x217673[_0x4337d2];}}}}Realtime[_0x4faf('0x3')][_0x4faf('0x4')]=function(_0x9406b,_0x2244c2){for(var _0x1f592a in _0x2244c2){if(_0x9406b[_0x4faf('0x2')](_0x1f592a)){_0x9406b[_0x1f592a]=_0x2244c2[_0x1f592a];}}};Realtime[_0x4faf('0x3')]['initMailAccounts']=function(){var _0x631003=this;return function(_0x41347b){if(_0x41347b){freeIsNotKey(_0x41347b,_0x631003['mailAccounts'],'id');for(var _0x292e2e=0x0,_0x1e8b0e={},_0x4e1a80={};_0x292e2e<_0x41347b[_0x4faf('0x5')];_0x292e2e+=0x1){_0x1e8b0e=_0x41347b[_0x292e2e];if(_['isUndefined'](_0x631003[_0x4faf('0x1')][_0x1e8b0e['id']])){_0x631003['mailAccounts'][_0x1e8b0e['id']]=new MailAccount(_0x1e8b0e);}else{_[_0x4faf('0x6')](_0x631003[_0x4faf('0x1')][_0x1e8b0e['id']],_0x1e8b0e);}}}return _0x631003[_0x4faf('0x1')];};};module[_0x4faf('0x7')]=Realtime; \ No newline at end of file +var _0xc44f=['../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','mailAccounts','length','isUndefined','merge','exports','lodash'];(function(_0x341fbb,_0x576aac){var _0x5a5d25=function(_0x7d3860){while(--_0x7d3860){_0x341fbb['push'](_0x341fbb['shift']());}};_0x5a5d25(++_0x576aac);}(_0xc44f,0x154));var _0xfc44=function(_0x1c07af,_0x422ebd){_0x1c07af=_0x1c07af-0x0;var _0x5ce7c0=_0xc44f[_0x1c07af];return _0x5ce7c0;};'use strict';var _=require(_0xfc44('0x0'));var MailAccount=require(_0xfc44('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x1b9b85,_0x4e75b8,_0x4c7ea9){var _0x24a9ad=_[_0xfc44('0x2')](_0x1b9b85,function(_0x25c98d,_0x3e42b8){return _0x25c98d[_0x4c7ea9];});for(var _0x2e739c in _0x4e75b8){if(_0x4e75b8[_0xfc44('0x3')](_0x2e739c)){if(!_0x24a9ad[_0x2e739c]){delete _0x4e75b8[_0x2e739c];}}}}Realtime[_0xfc44('0x4')][_0xfc44('0x5')]=function(_0x4f2ea1,_0x5ac3cc){for(var _0x5ce90f in _0x5ac3cc){if(_0x4f2ea1[_0xfc44('0x3')](_0x5ce90f)){_0x4f2ea1[_0x5ce90f]=_0x5ac3cc[_0x5ce90f];}}};Realtime[_0xfc44('0x4')]['initMailAccounts']=function(){var _0x361a89=this;return function(_0x365451){if(_0x365451){freeIsNotKey(_0x365451,_0x361a89[_0xfc44('0x6')],'id');for(var _0x53f5df=0x0,_0x34eeaa={},_0x4a8c50={};_0x53f5df<_0x365451[_0xfc44('0x7')];_0x53f5df+=0x1){_0x34eeaa=_0x365451[_0x53f5df];if(_[_0xfc44('0x8')](_0x361a89['mailAccounts'][_0x34eeaa['id']])){_0x361a89[_0xfc44('0x6')][_0x34eeaa['id']]=new MailAccount(_0x34eeaa);}else{_[_0xfc44('0x9')](_0x361a89['mailAccounts'][_0x34eeaa['id']],_0x34eeaa);}}}return _0x361a89['mailAccounts'];};};module[_0xfc44('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 1e248f4..c2a5ea3 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 _0xc9c3=['ListId','TemplateId','Smtp','getMailAccount','notify','NotifyMailAccount','Request','name','service','email','active','key'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xc9c3,0x96));var _0x3c9c=function(_0x5b9da1,_0x5a1871){_0x5b9da1=_0x5b9da1-0x0;var _0x5d111a=_0xc9c3[_0x5b9da1];return _0x5d111a;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x3c9c('0x0')]('GetMailAccount',{'options':{'attributes':['id',_0x3c9c('0x1'),_0x3c9c('0x2'),_0x3c9c('0x3'),_0x3c9c('0x4'),_0x3c9c('0x5'),_0x3c9c('0x6'),_0x3c9c('0x7')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap'},{'model':'MailServerOut','as':_0x3c9c('0x8')}]},'log':_0x3c9c('0x9')});};};exports[_0x3c9c('0xa')]=function(_0x2eb946,_0x3e5ccb){return client[_0x3c9c('0x0')](_0x3c9c('0xb'),{'account':{'id':_0x2eb946},'body':_0x3e5ccb,'log':_0x3c9c('0xb')});}; \ No newline at end of file +var _0xb422=['key','TemplateId','Imap','MailServerOut','Smtp','notify','NotifyMailAccount','GetMailAccount','email'];(function(_0x4fa610,_0xdb4144){var _0x136d5d=function(_0x544559){while(--_0x544559){_0x4fa610['push'](_0x4fa610['shift']());}};_0x136d5d(++_0xdb4144);}(_0xb422,0x85));var _0x2b42=function(_0x395c24,_0x48d2cb){_0x395c24=_0x395c24-0x0;var _0x1d708b=_0xb422[_0x395c24];return _0x1d708b;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client['Request'](_0x2b42('0x0'),{'options':{'attributes':['id','name','service',_0x2b42('0x1'),'active',_0x2b42('0x2'),'ListId',_0x2b42('0x3')],'raw':![],'include':[{'model':'MailServerIn','as':_0x2b42('0x4')},{'model':_0x2b42('0x5'),'as':_0x2b42('0x6')}]},'log':'getMailAccount'});};};exports[_0x2b42('0x7')]=function(_0x1b64f7,_0x12b303){return client['Request']('NotifyMailAccount',{'account':{'id':_0x1b64f7},'body':_0x12b303,'log':_0x2b42('0x8')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 9fce947..7143dc1 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 _0x1f7c=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x4073c0,_0x10c162){var _0x4f5601=function(_0x1ace9d){while(--_0x1ace9d){_0x4073c0['push'](_0x4073c0['shift']());}};_0x4f5601(++_0x10c162);}(_0x1f7c,0xc1));var _0xc1f7=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0x1f7c[_0x593564];return _0x211a89;};'use strict';var client=require(_0xc1f7('0x0'));exports[_0xc1f7('0x1')]=function(){return client[_0xc1f7('0x2')](_0xc1f7('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc1f7('0x4')]},'log':_0xc1f7('0x5')});}; \ No newline at end of file +var _0x3318=['Request','ShowSetting','loginMailFrequency','../client','getSettings'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0x3318,0x139));var _0x8331=function(_0x240df3,_0x515368){_0x240df3=_0x240df3-0x0;var _0x4a2815=_0x3318[_0x240df3];return _0x4a2815;};'use strict';var client=require(_0x8331('0x0'));exports[_0x8331('0x1')]=function(){return client[_0x8331('0x2')](_0x8331('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8331('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 5609dde..5923d73 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 467b532..06256c1 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 _0x4129=['ioredis','../../config/environment','timeout','listen','port','socket.io','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x4129,0x11b));var _0x9412=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4129[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9412('0x0'));var http=require('http');var express=require(_0x9412('0x1'));var sticky=require(_0x9412('0x2'));var Redis=require(_0x9412('0x3'));var config=require(_0x9412('0x4'));var app=express();var server=http['createServer'](app);server[_0x9412('0x5')]=0xdbba0;if(sticky[_0x9412('0x6')](server,config[_0x9412('0x7')])){var socketio=require(_0x9412('0x8'))(server,{'transports':['websocket',_0x9412('0x9')]});config[_0x9412('0xa')]=_[_0x9412('0xb')](config[_0x9412('0xa')],{'host':'localhost','port':0x18eb});socketio[_0x9412('0xc')](require(_0x9412('0xd'))({'pubClient':new Redis(config[_0x9412('0xa')]),'subClient':new Redis(config[_0x9412('0xa')])}));require(_0x9412('0xe'))[_0x9412('0xf')]();require(_0x9412('0x10'))['default'](socketio);require(_0x9412('0x11'))['default'](app);require(_0x9412('0x12'))[_0x9412('0xf')](app);}else{server[_0x9412('0x13')]('listening',function(){console['log'](_0x9412('0x14'),config['port']);});}exports=module[_0x9412('0x15')]=app; \ No newline at end of file +var _0x12af=['localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','websocket','polling','redis'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x12af,0xe6));var _0xf12a=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x12af[_0x265003];return _0x33c743;};'use strict';var _=require(_0xf12a('0x0'));var http=require('http');var express=require(_0xf12a('0x1'));var sticky=require(_0xf12a('0x2'));var Redis=require(_0xf12a('0x3'));var config=require(_0xf12a('0x4'));var app=express();var server=http[_0xf12a('0x5')](app);server[_0xf12a('0x6')]=0xdbba0;if(sticky[_0xf12a('0x7')](server,config[_0xf12a('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0xf12a('0x9'),_0xf12a('0xa')]});config[_0xf12a('0xb')]=_['defaults'](config['redis'],{'host':_0xf12a('0xc'),'port':0x18eb});socketio['adapter'](require(_0xf12a('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xf12a('0xb')])}));require(_0xf12a('0xe'))[_0xf12a('0xf')]();require(_0xf12a('0x10'))[_0xf12a('0xf')](socketio);require('../../config/express')[_0xf12a('0xf')](app);require('../../routes')['default'](app);}else{server[_0xf12a('0x11')](_0xf12a('0x12'),function(){console[_0xf12a('0x13')](_0xf12a('0x14'),config['port']);});}exports=module[_0xf12a('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index a1bd8c0..ecdcb9b 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 _0xe2bc=['client','request','then','debug','rpc','routing','error','message','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x52e252,_0x5a49e2){var _0x41c21a=function(_0x5f19d6){while(--_0x5f19d6){_0x52e252['push'](_0x52e252['shift']());}};_0x41c21a(++_0x5a49e2);}(_0xe2bc,0x1aa));var _0xce2b=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xe2bc[_0x9fd887];return _0x1a54ab;};'use strict';var jayson=require(_0xce2b('0x0'));var BPromise=require(_0xce2b('0x1'));var logger=require(_0xce2b('0x2'))('routing');var client=jayson[_0xce2b('0x3')]['http']({'port':0x2329});client['Request']=function(_0x5bb36b,_0x470671){return new BPromise(function(_0x3bbf38,_0x3b6830){return client[_0xce2b('0x4')](_0x5bb36b,_0x470671)[_0xce2b('0x5')](function(_0x95f274){logger[_0xce2b('0x6')](_0xce2b('0x7'),_0xce2b('0x8'),_0x5bb36b,_0x470671,_0x95f274);if(_0x95f274[_0xce2b('0x9')]){logger['error'](_0xce2b('0x7'),_0xce2b('0x8'),_0x5bb36b,_0x95f274[_0xce2b('0x9')][_0xce2b('0xa')],_0x470671);return _0x3b6830(_0x95f274[_0xce2b('0x9')][_0xce2b('0xa')]);}else{return _0x3bbf38(_0x95f274['result']);}})[_0xce2b('0xb')](function(_0x1b7d58){logger[_0xce2b('0x9')](_0xce2b('0x7'),_0xce2b('0x8'),_0x5bb36b,_0x1b7d58,_0x470671);return _0x3b6830(_0x1b7d58);});});};module[_0xce2b('0xc')]=client; \ No newline at end of file +var _0x8743=['error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc'];(function(_0x5ae470,_0x5a8457){var _0x212806=function(_0x402825){while(--_0x402825){_0x5ae470['push'](_0x5ae470['shift']());}};_0x212806(++_0x5a8457);}(_0x8743,0x115));var _0x3874=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x8743[_0x28947d];return _0x12d2ee;};'use strict';var jayson=require(_0x3874('0x0'));var BPromise=require(_0x3874('0x1'));var logger=require(_0x3874('0x2'))(_0x3874('0x3'));var client=jayson[_0x3874('0x4')][_0x3874('0x5')]({'port':0x2329});client[_0x3874('0x6')]=function(_0x447ca9,_0x1f3e2a){return new BPromise(function(_0x2f40b4,_0x1a2858){return client[_0x3874('0x7')](_0x447ca9,_0x1f3e2a)[_0x3874('0x8')](function(_0x2ec902){logger[_0x3874('0x9')](_0x3874('0xa'),'routing',_0x447ca9,_0x1f3e2a,_0x2ec902);if(_0x2ec902[_0x3874('0xb')]){logger[_0x3874('0xb')]('rpc',_0x3874('0x3'),_0x447ca9,_0x2ec902['error'][_0x3874('0xc')],_0x1f3e2a);return _0x1a2858(_0x2ec902[_0x3874('0xb')][_0x3874('0xc')]);}else{return _0x2f40b4(_0x2ec902[_0x3874('0xd')]);}})[_0x3874('0xe')](function(_0xbbdb8a){logger[_0x3874('0xb')](_0x3874('0xa'),'routing',_0x447ca9,_0xbbdb8a,_0x1f3e2a);return _0x1a2858(_0xbbdb8a);});});};module[_0x3874('0xf')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index a47e1d0..4bbbafb 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 _0x5d4d=['listen','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues'];(function(_0xab1f4d,_0x3557df){var _0x2f2411=function(_0x17f3a1){while(--_0x17f3a1){_0xab1f4d['push'](_0xab1f4d['shift']());}};_0x2f2411(++_0x3557df);}(_0x5d4d,0x1b3));var _0xd5d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d4d[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var server=require(_0xd5d4('0x0'));var Realtime=require(_0xd5d4('0x1'));var user=require(_0xd5d4('0x2'));var interval=require(_0xd5d4('0x3'));var openchannelQueue=require(_0xd5d4('0x4'));var chatQueue=require(_0xd5d4('0x5'));var smsQueue=require(_0xd5d4('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xd5d4('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xd5d4('0x8')]()[_0xd5d4('0x9')](user[_0xd5d4('0xa')]())[_0xd5d4('0x9')](realtime[_0xd5d4('0xb')]())['then'](interval[_0xd5d4('0xc')]())[_0xd5d4('0x9')](realtime[_0xd5d4('0xd')]())[_0xd5d4('0x9')](openchannelQueue[_0xd5d4('0xe')]())['then'](realtime['initOpenchannelQueues']())[_0xd5d4('0x9')](chatQueue['getChatQueues']())['then'](realtime[_0xd5d4('0xf')]())[_0xd5d4('0x9')](smsQueue[_0xd5d4('0x10')]())[_0xd5d4('0x9')](realtime[_0xd5d4('0x11')]())['then'](mailQueue[_0xd5d4('0x12')]())[_0xd5d4('0x9')](realtime[_0xd5d4('0x13')]())['then'](faxQueue[_0xd5d4('0x14')]())[_0xd5d4('0x9')](realtime[_0xd5d4('0x15')]())['then'](whatsappQueue[_0xd5d4('0x16')]())[_0xd5d4('0x9')](realtime[_0xd5d4('0x17')]())['then'](function(){return realtime;});}function main(){return server[_0xd5d4('0x18')](realtime)[_0xd5d4('0x9')](function(_0x304ae9){return initRealtime();})[_0xd5d4('0x9')](function(_0xffc4f0){return setInterval(initRealtime,0x1388);})[_0xd5d4('0x19')](function(_0x7869f5){console[_0xd5d4('0x1a')](_0x7869f5);});}main(); \ No newline at end of file +var _0x6b0b=['./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird'];(function(_0x38faff,_0x163d9c){var _0x23c5b5=function(_0x120a7d){while(--_0x120a7d){_0x38faff['push'](_0x38faff['shift']());}};_0x23c5b5(++_0x163d9c);}(_0x6b0b,0x194));var _0xb6b0=function(_0x3b8f1c,_0x4f0f58){_0x3b8f1c=_0x3b8f1c-0x0;var _0x418afb=_0x6b0b[_0x3b8f1c];return _0x418afb;};'use strict';var BPromise=require(_0xb6b0('0x0'));var server=require('./server');var Realtime=require(_0xb6b0('0x1'));var user=require(_0xb6b0('0x2'));var interval=require(_0xb6b0('0x3'));var openchannelQueue=require(_0xb6b0('0x4'));var chatQueue=require(_0xb6b0('0x5'));var smsQueue=require(_0xb6b0('0x6'));var mailQueue=require(_0xb6b0('0x7'));var faxQueue=require(_0xb6b0('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xb6b0('0x9')]()['then'](user[_0xb6b0('0xa')]())[_0xb6b0('0xb')](realtime[_0xb6b0('0xc')]())[_0xb6b0('0xb')](interval[_0xb6b0('0xd')]())[_0xb6b0('0xb')](realtime[_0xb6b0('0xe')]())[_0xb6b0('0xb')](openchannelQueue['getOpenchannelQueues']())[_0xb6b0('0xb')](realtime[_0xb6b0('0xf')]())[_0xb6b0('0xb')](chatQueue[_0xb6b0('0x10')]())[_0xb6b0('0xb')](realtime['initChatQueues']())[_0xb6b0('0xb')](smsQueue[_0xb6b0('0x11')]())[_0xb6b0('0xb')](realtime[_0xb6b0('0x12')]())[_0xb6b0('0xb')](mailQueue[_0xb6b0('0x13')]())[_0xb6b0('0xb')](realtime[_0xb6b0('0x14')]())['then'](faxQueue['getFaxQueues']())[_0xb6b0('0xb')](realtime[_0xb6b0('0x15')]())[_0xb6b0('0xb')](whatsappQueue[_0xb6b0('0x16')]())[_0xb6b0('0xb')](realtime[_0xb6b0('0x17')]())[_0xb6b0('0xb')](function(){return realtime;});}function main(){return server[_0xb6b0('0x18')](realtime)[_0xb6b0('0xb')](function(_0x36719f){return initRealtime();})[_0xb6b0('0xb')](function(_0x2249cd){return setInterval(initRealtime,0x1388);})[_0xb6b0('0x19')](function(_0x6ff476){console[_0xb6b0('0x1a')](_0x6ff476);});}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 4d0ed5a..f557619 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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x29ab8e,_0x67c0c1){var _0xc602a3=function(_0x2782b5){while(--_0x2782b5){_0x29ab8e['push'](_0x29ab8e['shift']());}};_0xc602a3(++_0x67c0c1);}(_0x326f,0xd1));var _0xf326=function(_0x5ee682,_0x25fca0){_0x5ee682=_0x5ee682-0x0;var _0x56476e=_0x326f[_0x5ee682];return _0x56476e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x45e299,_0x37704d){var _0x1a895f=function(_0x5c12ac){while(--_0x5c12ac){_0x45e299['push'](_0x45e299['shift']());}};_0x1a895f(++_0x37704d);}(_0x326f,0xd1));var _0xf326=function(_0x6bbbd1,_0x26e35b){_0x6bbbd1=_0x6bbbd1-0x0;var _0x1a7b0a=_0x326f[_0x6bbbd1];return _0x1a7b0a;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};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 9e7b46c..6ab6605 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 _0x9e75=['http','request','then','error','message','result','catch','SendMail','jayson/promise','client'];(function(_0x373d6c,_0x100736){var _0x444d89=function(_0x853a9b){while(--_0x853a9b){_0x373d6c['push'](_0x373d6c['shift']());}};_0x444d89(++_0x100736);}(_0x9e75,0x1ac));var _0x59e7=function(_0x3a8185,_0x3a0e67){_0x3a8185=_0x3a8185-0x0;var _0x380c7c=_0x9e75[_0x3a8185];return _0x380c7c;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x59e7('0x0'));var client=jayson[_0x59e7('0x1')][_0x59e7('0x2')]({'port':0x232b});function request(_0x52bea7,_0x132eef){return new BPromise(function(_0x596c16,_0x33187c){return client[_0x59e7('0x3')](_0x52bea7,_0x132eef)[_0x59e7('0x4')](function(_0x2b06ef){if(_0x2b06ef[_0x59e7('0x5')]){return _0x33187c(_0x2b06ef[_0x59e7('0x5')][_0x59e7('0x6')]);}else{return _0x596c16(_0x2b06ef[_0x59e7('0x7')]);}})[_0x59e7('0x8')](function(_0x16d52e){return _0x33187c(_0x16d52e);});});}exports['sendMailMessage']=function(_0x3ad3db,_0x4a3101){return request(_0x59e7('0x9'),{'account':_0x3ad3db,'message':_0x4a3101});}; \ No newline at end of file +var _0xfc99=['request','then','error','message','result','sendMailMessage','jayson/promise','client','http'];(function(_0xbf3882,_0x5d212b){var _0x25a10f=function(_0x2f8df7){while(--_0x2f8df7){_0xbf3882['push'](_0xbf3882['shift']());}};_0x25a10f(++_0x5d212b);}(_0xfc99,0x11d));var _0x9fc9=function(_0x14e9a7,_0x660024){_0x14e9a7=_0x14e9a7-0x0;var _0x52d8e0=_0xfc99[_0x14e9a7];return _0x52d8e0;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x9fc9('0x0'));var client=jayson[_0x9fc9('0x1')][_0x9fc9('0x2')]({'port':0x232b});function request(_0x23b78d,_0x446af4){return new BPromise(function(_0x2e94b8,_0x113f4b){return client[_0x9fc9('0x3')](_0x23b78d,_0x446af4)[_0x9fc9('0x4')](function(_0x426cf8){if(_0x426cf8['error']){return _0x113f4b(_0x426cf8[_0x9fc9('0x5')][_0x9fc9('0x6')]);}else{return _0x2e94b8(_0x426cf8[_0x9fc9('0x7')]);}})['catch'](function(_0x9e163d){return _0x113f4b(_0x9e163d);});});}exports[_0x9fc9('0x8')]=function(_0x275d78,_0x19e41c){return request('SendMail',{'account':_0x275d78,'message':_0x19e41c});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 37bab6f..392a29c 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 _0x29e5=['updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','openchannel','fax','length','StatusTime','toNumber','format','Status','chatStatus','chatStatusTime','chatCurrentCapacity','faxStatus','smsStatusTime','openchannelStatus','openchannelStatusTime','stringify','emit','user:save','lodash','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x29e5,0x8f));var _0x529e=function(_0x4b231f,_0xcbfae4){_0x4b231f=_0x4b231f-0x0;var _0x1b49bf=_0x29e5[_0x4b231f];return _0x1b49bf;};'use strict';var _=require(_0x529e('0x0'));var moment=require(_0x529e('0x1'));var md5=require(_0x529e('0x2'));var Redis=require(_0x529e('0x3'));var config=require('../../../config/environment');config[_0x529e('0x4')]=_[_0x529e('0x5')](config[_0x529e('0x4')],{'host':_0x529e('0x6'),'port':0x18eb});var io=require(_0x529e('0x7'))(new Redis(config[_0x529e('0x4')]));function Agent(_0x2524ca){this['id']=_0x2524ca['id']||0x0;this[_0x529e('0x8')]=_0x2524ca[_0x529e('0x8')]||'';this[_0x529e('0x9')]=_0x2524ca['online']||!![];this[_0x529e('0xa')]=_0x2524ca[_0x529e('0xa')]||![];this[_0x529e('0xb')]=_0x2524ca[_0x529e('0xb')]||![];this[_0x529e('0xc')]=_0x2524ca['mailPause']||![];this[_0x529e('0xd')]=_0x2524ca[_0x529e('0xd')]||![];this[_0x529e('0xe')]=_0x2524ca[_0x529e('0xe')]||![];this[_0x529e('0xf')]=_0x2524ca['openchannelPause']||![];this['chatStatus']=_0x529e('0x10');this['chatStatusTime']=0x0;this[_0x529e('0x11')]=_0x2524ca[_0x529e('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x529e('0x10');this['mailStatusTime']=0x0;this[_0x529e('0x12')]=_0x2524ca[_0x529e('0x12')]||0x0;this[_0x529e('0x13')]=0x0;this['faxStatus']=_0x529e('0x10');this[_0x529e('0x14')]=0x0;this[_0x529e('0x15')]=_0x2524ca[_0x529e('0x15')]||0x0;this[_0x529e('0x16')]=0x0;this[_0x529e('0x17')]=_0x529e('0x10');this['smsStatusTime']=0x0;this[_0x529e('0x18')]=_0x2524ca['smsCapacity']||0x0;this[_0x529e('0x19')]=0x0;this[_0x529e('0x1a')]=_0x529e('0x10');this[_0x529e('0x1b')]=0x0;this[_0x529e('0x1c')]=_0x2524ca[_0x529e('0x1c')]||0x0;this[_0x529e('0x1d')]=0x0;this['openchannelStatus']=_0x529e('0x10');this['openchannelStatusTime']=0x0;this[_0x529e('0x1e')]=_0x2524ca[_0x529e('0x1e')]||0x0;this[_0x529e('0x1f')]=0x0;this[_0x529e('0x20')]=![];this[_0x529e('0x21')]=undefined;this[_0x529e('0x2')]='';this[_0x529e('0x22')]();}Agent[_0x529e('0x23')][_0x529e('0x24')]=function(_0x1c84bb){if(this[_0x1c84bb+_0x529e('0x25')]>0x0){if(this[_0x1c84bb+_0x529e('0x26')]>0x0&&this[_0x1c84bb+_0x529e('0x25')]>=this[_0x1c84bb+_0x529e('0x26')]){return'maxcapacity';}else{return _0x529e('0x27');}}else{return _0x529e('0x28');}};Agent[_0x529e('0x23')][_0x529e('0x22')]=function(){var _0x5410f5=[_0x529e('0x29'),'chat',_0x529e('0x2a'),_0x529e('0x2b'),'sms','whatsapp'];for(var _0x55056f=0x0;_0x55056f<_0x5410f5[_0x529e('0x2c')];_0x55056f+=0x1){var _0x55501d=this[_0x529e('0x24')](_0x5410f5[_0x55056f]);if(this[_0x5410f5[_0x55056f]+'Status']!==_0x55501d){this[_0x5410f5[_0x55056f]+_0x529e('0x2d')]=_[_0x529e('0x2e')](moment()[_0x529e('0x2f')]('x'));}this[_0x5410f5[_0x55056f]+_0x529e('0x30')]=_0x55501d;}var _0x1fca56={'id':this['id'],'name':this[_0x529e('0x8')],'online':this[_0x529e('0x9')],'voicePause':this[_0x529e('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x529e('0xe')],'faxPause':this[_0x529e('0xd')],'openchannelPause':this[_0x529e('0xf')],'chatStatus':this[_0x529e('0x31')],'chatStatusTime':this[_0x529e('0x32')],'chatCapacity':this[_0x529e('0x11')],'chatCurrentCapacity':this[_0x529e('0x33')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x529e('0x34')],'faxStatusTime':this[_0x529e('0x14')],'faxCapacity':this[_0x529e('0x15')],'faxCurrentCapacity':this[_0x529e('0x16')],'smsStatus':this[_0x529e('0x17')],'smsStatusTime':this[_0x529e('0x35')],'smsCapacity':this[_0x529e('0x18')],'smsCurrentCapacity':this[_0x529e('0x19')],'whatsappStatus':this[_0x529e('0x1a')],'whatsappStatusTime':this[_0x529e('0x1b')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x529e('0x36')],'openchannelStatusTime':this[_0x529e('0x37')],'openchannelCapacity':this[_0x529e('0x1e')],'openchannelCurrentCapacity':this[_0x529e('0x1f')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x47b54b=md5(JSON[_0x529e('0x38')](_0x1fca56));if(this[_0x529e('0x2')]!==_0x47b54b){this['md5']=_0x47b54b;io[_0x529e('0x39')](_0x529e('0x3a'),_0x1fca56);}};module['exports']=Agent; \ No newline at end of file +var _0x3868=['faxStatus','openchannelCurrentCapacity','stringify','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busyQueue','updateRealtime','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','whatsapp','length','getChannelStatus','toNumber','mailStatus'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x3868,0x118));var _0x8386=function(_0x733263,_0x491085){_0x733263=_0x733263-0x0;var _0x240031=_0x3868[_0x733263];return _0x240031;};'use strict';var _=require('lodash');var moment=require(_0x8386('0x0'));var md5=require(_0x8386('0x1'));var Redis=require(_0x8386('0x2'));var config=require(_0x8386('0x3'));config[_0x8386('0x4')]=_[_0x8386('0x5')](config[_0x8386('0x4')],{'host':_0x8386('0x6'),'port':0x18eb});var io=require(_0x8386('0x7'))(new Redis(config['redis']));function Agent(_0x55a8e4){this['id']=_0x55a8e4['id']||0x0;this[_0x8386('0x8')]=_0x55a8e4[_0x8386('0x8')]||'';this[_0x8386('0x9')]=_0x55a8e4[_0x8386('0x9')]||!![];this[_0x8386('0xa')]=_0x55a8e4[_0x8386('0xa')]||![];this[_0x8386('0xb')]=_0x55a8e4['chatPause']||![];this[_0x8386('0xc')]=_0x55a8e4['mailPause']||![];this[_0x8386('0xd')]=_0x55a8e4['faxPause']||![];this[_0x8386('0xe')]=_0x55a8e4[_0x8386('0xe')]||![];this[_0x8386('0xf')]=_0x55a8e4['openchannelPause']||![];this[_0x8386('0x10')]=_0x8386('0x11');this[_0x8386('0x12')]=0x0;this[_0x8386('0x13')]=_0x55a8e4[_0x8386('0x13')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x8386('0x11');this[_0x8386('0x14')]=0x0;this['mailCapacity']=_0x55a8e4[_0x8386('0x15')]||0x0;this[_0x8386('0x16')]=0x0;this['faxStatus']=_0x8386('0x11');this[_0x8386('0x17')]=0x0;this[_0x8386('0x18')]=_0x55a8e4[_0x8386('0x18')]||0x0;this[_0x8386('0x19')]=0x0;this[_0x8386('0x1a')]=_0x8386('0x11');this[_0x8386('0x1b')]=0x0;this['smsCapacity']=_0x55a8e4[_0x8386('0x1c')]||0x0;this[_0x8386('0x1d')]=0x0;this['whatsappStatus']=_0x8386('0x11');this[_0x8386('0x1e')]=0x0;this[_0x8386('0x1f')]=_0x55a8e4[_0x8386('0x1f')]||0x0;this[_0x8386('0x20')]=0x0;this[_0x8386('0x21')]=_0x8386('0x11');this[_0x8386('0x22')]=0x0;this['openchannelCapacity']=_0x55a8e4[_0x8386('0x23')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x8386('0x24')]=undefined;this['md5']='';this[_0x8386('0x25')]();}Agent['prototype']['getChannelStatus']=function(_0x8c0bcd){if(this[_0x8c0bcd+_0x8386('0x26')]>0x0){if(this[_0x8c0bcd+'Capacity']>0x0&&this[_0x8c0bcd+'CurrentCapacity']>=this[_0x8c0bcd+_0x8386('0x27')]){return'maxcapacity';}else{return _0x8386('0x28');}}else{return _0x8386('0x29');}};Agent['prototype']['updateRealtime']=function(){var _0x28aac5=[_0x8386('0x2a'),_0x8386('0x2b'),_0x8386('0x2c'),'fax','sms',_0x8386('0x2d')];for(var _0x40feb3=0x0;_0x40feb3<_0x28aac5[_0x8386('0x2e')];_0x40feb3+=0x1){var _0x5260a7=this[_0x8386('0x2f')](_0x28aac5[_0x40feb3]);if(this[_0x28aac5[_0x40feb3]+'Status']!==_0x5260a7){this[_0x28aac5[_0x40feb3]+'StatusTime']=_[_0x8386('0x30')](moment()['format']('x'));}this[_0x28aac5[_0x40feb3]+'Status']=_0x5260a7;}var _0x5c28b7={'id':this['id'],'name':this[_0x8386('0x8')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x8386('0xb')],'mailPause':this[_0x8386('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x8386('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x8386('0x10')],'chatStatusTime':this[_0x8386('0x12')],'chatCapacity':this[_0x8386('0x13')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x8386('0x31')],'mailStatusTime':this[_0x8386('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x8386('0x16')],'faxStatus':this[_0x8386('0x32')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x8386('0x18')],'faxCurrentCapacity':this[_0x8386('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x8386('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x8386('0x1e')],'whatsappCapacity':this[_0x8386('0x1f')],'whatsappCurrentCapacity':this[_0x8386('0x20')],'openchannelStatus':this[_0x8386('0x21')],'openchannelStatusTime':this[_0x8386('0x22')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x8386('0x33')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x5209a9=md5(JSON[_0x8386('0x34')](_0x5c28b7));if(this[_0x8386('0x1')]!==_0x5209a9){this['md5']=_0x5209a9;io['emit'](_0x8386('0x35'),_0x5c28b7);}};module[_0x8386('0x36')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index ee9abe6..ea44085 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 _0xca37=['mapAgentsId','updateRouting','updateRealtime','_rr','map','loggedIn','length','chatPause','paused','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents'];(function(_0x5833f6,_0x3f15f5){var _0xffb95d=function(_0x3b6f09){while(--_0x3b6f09){_0x5833f6['push'](_0x5833f6['shift']());}};_0xffb95d(++_0x3f15f5);}(_0xca37,0x1d0));var _0x7ca3=function(_0x1d92ec,_0x48e12a){_0x1d92ec=_0x1d92ec-0x0;var _0x359b61=_0xca37[_0x1d92ec];return _0x359b61;};'use strict';var _=require(_0x7ca3('0x0'));var md5=require(_0x7ca3('0x1'));var util=require(_0x7ca3('0x2'));var Redis=require('ioredis');var config=require(_0x7ca3('0x3'));config['redis']=_[_0x7ca3('0x4')](config[_0x7ca3('0x5')],{'host':_0x7ca3('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x34da35){this['id']=_0x34da35['id']||0x0;this[_0x7ca3('0x7')]=_0x34da35[_0x7ca3('0x7')]||'';this[_0x7ca3('0x8')]=_0x34da35[_0x7ca3('0x8')]||0xa;this[_0x7ca3('0x9')]=_0x34da35['strategy']||_0x7ca3('0xa');this['Agents']=_0x34da35[_0x7ca3('0xb')];this[_0x7ca3('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x7ca3('0xd')]();this[_0x7ca3('0xe')]();}ChatQueue['prototype'][_0x7ca3('0xd')]=function(){var _0x45ff75=this['mapAgentsId'][_0x7ca3('0xf')];this['mapAgentsId']=_[_0x7ca3('0x10')](this['Agents'],'id');this['mapAgentsId'][_0x7ca3('0xf')]=_0x45ff75;};ChatQueue['prototype'][_0x7ca3('0xe')]=function(){this[_0x7ca3('0x11')]=0x0;this['paused']=0x0;for(var _0xe3c82a=0x0;_0xe3c82a=0x0?this[_0x7ca3('0x15')]:0x0;var _0x18040d={'id':this['id'],'available':this[_0x7ca3('0x15')],'loggedIn':this[_0x7ca3('0x11')],'name':this[_0x7ca3('0x7')],'paused':this[_0x7ca3('0x14')],'waiting':this[_0x7ca3('0x16')]};var _0x1e7fe9=md5(JSON[_0x7ca3('0x17')](_0x18040d));if(this['md5']!==_0x1e7fe9){this[_0x7ca3('0x1')]=_0x1e7fe9;io['to'](util[_0x7ca3('0x18')](_0x7ca3('0x19'),_0x18040d['name']))[_0x7ca3('0x1a')](_0x7ca3('0x1b'),_0x18040d);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xac90=['timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','paused','length','online','loggedIn','chatPause','available','waiting','stringify','md5','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name'];(function(_0x5d7940,_0x1ae605){var _0x51530a=function(_0x47ae48){while(--_0x47ae48){_0x5d7940['push'](_0x5d7940['shift']());}};_0x51530a(++_0x1ae605);}(_0xac90,0x74));var _0x0ac9=function(_0x425877,_0x1774f1){_0x425877=_0x425877-0x0;var _0x193345=_0xac90[_0x425877];return _0x193345;};'use strict';var _=require(_0x0ac9('0x0'));var md5=require('md5');var util=require(_0x0ac9('0x1'));var Redis=require(_0x0ac9('0x2'));var config=require(_0x0ac9('0x3'));config[_0x0ac9('0x4')]=_[_0x0ac9('0x5')](config[_0x0ac9('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x0ac9('0x6'))(new Redis(config['redis']));function ChatQueue(_0x561ad8){this['id']=_0x561ad8['id']||0x0;this[_0x0ac9('0x7')]=_0x561ad8[_0x0ac9('0x7')]||'';this[_0x0ac9('0x8')]=_0x561ad8['timeout']||0xa;this[_0x0ac9('0x9')]=_0x561ad8[_0x0ac9('0x9')]||_0x0ac9('0xa');this['Agents']=_0x561ad8[_0x0ac9('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x0ac9('0xc')]();this[_0x0ac9('0xd')]();}ChatQueue[_0x0ac9('0xe')][_0x0ac9('0xc')]=function(){var _0x1e9d39=this[_0x0ac9('0xf')]['_rr'];this[_0x0ac9('0xf')]=_[_0x0ac9('0x10')](this[_0x0ac9('0xb')],'id');this[_0x0ac9('0xf')][_0x0ac9('0x11')]=_0x1e9d39;};ChatQueue[_0x0ac9('0xe')][_0x0ac9('0xd')]=function(){this['loggedIn']=0x0;this[_0x0ac9('0x12')]=0x0;for(var _0x1cd0b6=0x0;_0x1cd0b6=0x0?this[_0x0ac9('0x17')]:0x0;var _0x4355c6={'id':this['id'],'available':this[_0x0ac9('0x17')],'loggedIn':this[_0x0ac9('0x15')],'name':this['name'],'paused':this[_0x0ac9('0x12')],'waiting':this[_0x0ac9('0x18')]};var _0x38fa84=md5(JSON[_0x0ac9('0x19')](_0x4355c6));if(this[_0x0ac9('0x1a')]!==_0x38fa84){this[_0x0ac9('0x1a')]=_0x38fa84;io['to'](util['format'](_0x0ac9('0x1b'),_0x4355c6[_0x0ac9('0x7')]))[_0x0ac9('0x1c')](_0x0ac9('0x1d'),_0x4355c6);}};module[_0x0ac9('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 301f35f..a2436d2 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 _0x86a3=['waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','faxPause','available','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x34e4f1,_0x57b35d){var _0x1a7e8e=function(_0x54384f){while(--_0x54384f){_0x34e4f1['push'](_0x34e4f1['shift']());}};_0x1a7e8e(++_0x57b35d);}(_0x86a3,0x68));var _0x386a=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x86a3[_0x5d4f12];return _0x4eb577;};'use strict';var _=require(_0x386a('0x0'));var md5=require(_0x386a('0x1'));var util=require(_0x386a('0x2'));var Redis=require(_0x386a('0x3'));var config=require(_0x386a('0x4'));config[_0x386a('0x5')]=_['defaults'](config[_0x386a('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x386a('0x6'))(new Redis(config[_0x386a('0x5')]));function FaxQueue(_0x5f3f01){this['id']=_0x5f3f01['id']||0x0;this[_0x386a('0x7')]=_0x5f3f01[_0x386a('0x7')]||'';this[_0x386a('0x8')]=_0x5f3f01[_0x386a('0x8')]||0xa;this[_0x386a('0x9')]=_0x5f3f01['strategy']||_0x386a('0xa');this[_0x386a('0xb')]=_0x5f3f01[_0x386a('0xb')];this['mapAgentsId']={};this[_0x386a('0xc')]=0x0;this[_0x386a('0x1')]='';this[_0x386a('0xd')]();this[_0x386a('0xe')]();}FaxQueue[_0x386a('0xf')]['updateRouting']=function(){var _0x28870f=this[_0x386a('0x10')][_0x386a('0x11')];this[_0x386a('0x10')]=_[_0x386a('0x12')](this['Agents'],'id');this['mapAgentsId'][_0x386a('0x11')]=_0x28870f;};FaxQueue[_0x386a('0xf')]['updateRealtime']=function(){this[_0x386a('0x13')]=0x0;this[_0x386a('0x14')]=0x0;for(var _0x113372=0x0;_0x113372=0x0?this[_0x386a('0x18')]:0x0;var _0x145685={'id':this['id'],'available':this[_0x386a('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x386a('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x31684a=md5(JSON['stringify'](_0x145685));if(this[_0x386a('0x1')]!==_0x31684a){this[_0x386a('0x1')]=_0x31684a;io['to'](util['format'](_0x386a('0x19'),_0x145685[_0x386a('0x7')]))[_0x386a('0x1a')](_0x386a('0x1b'),_0x145685);}};module[_0x386a('0x1c')]=FaxQueue; \ No newline at end of file +var _0xf4bf=['updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xf4bf,0x85));var _0xff4b=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0xf4bf[_0x28407a];return _0x8bd6ef;};'use strict';var _=require(_0xff4b('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0xff4b('0x1'));config[_0xff4b('0x2')]=_['defaults'](config[_0xff4b('0x2')],{'host':_0xff4b('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xff4b('0x2')]));function FaxQueue(_0xd29b41){this['id']=_0xd29b41['id']||0x0;this[_0xff4b('0x4')]=_0xd29b41['name']||'';this[_0xff4b('0x5')]=_0xd29b41[_0xff4b('0x5')]||0xa;this[_0xff4b('0x6')]=_0xd29b41[_0xff4b('0x6')]||_0xff4b('0x7');this[_0xff4b('0x8')]=_0xd29b41[_0xff4b('0x8')];this[_0xff4b('0x9')]={};this[_0xff4b('0xa')]=0x0;this[_0xff4b('0xb')]='';this[_0xff4b('0xc')]();this[_0xff4b('0xd')]();}FaxQueue['prototype'][_0xff4b('0xc')]=function(){var _0x44dd5f=this['mapAgentsId'][_0xff4b('0xe')];this[_0xff4b('0x9')]=_[_0xff4b('0xf')](this[_0xff4b('0x8')],'id');this['mapAgentsId'][_0xff4b('0xe')]=_0x44dd5f;};FaxQueue[_0xff4b('0x10')][_0xff4b('0xd')]=function(){this[_0xff4b('0x11')]=0x0;this[_0xff4b('0x12')]=0x0;for(var _0x492665=0x0;_0x492665=0x0?this[_0xff4b('0x16')]:0x0;var _0x5042cb={'id':this['id'],'available':this[_0xff4b('0x16')],'loggedIn':this[_0xff4b('0x11')],'name':this[_0xff4b('0x4')],'paused':this[_0xff4b('0x12')],'waiting':this[_0xff4b('0xa')]};var _0x9a71bc=md5(JSON[_0xff4b('0x17')](_0x5042cb));if(this[_0xff4b('0xb')]!==_0x9a71bc){this[_0xff4b('0xb')]=_0x9a71bc;io['to'](util[_0xff4b('0x18')](_0xff4b('0x19'),_0x5042cb[_0xff4b('0x4')]))[_0xff4b('0x1a')](_0xff4b('0x1b'),_0x5042cb);}};module[_0xff4b('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 2cda523..3a2f3ca 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 _0x76f4=['exports','name','Intervals'];(function(_0x4a73da,_0x1aca4e){var _0x464e48=function(_0x17fc22){while(--_0x17fc22){_0x4a73da['push'](_0x4a73da['shift']());}};_0x464e48(++_0x1aca4e);}(_0x76f4,0x115));var _0x476f=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x76f4[_0x1d1779];return _0x2377e9;};'use strict';function Interval(_0x514e00){this['id']=_0x514e00['id']||0x0;this[_0x476f('0x0')]=_0x514e00[_0x476f('0x0')]||'';this[_0x476f('0x1')]=_0x514e00['Intervals']||{};}module[_0x476f('0x2')]=Interval; \ No newline at end of file +var _0x1347=['Intervals','name'];(function(_0x2bffee,_0x285292){var _0x49cef1=function(_0x4304be){while(--_0x4304be){_0x2bffee['push'](_0x2bffee['shift']());}};_0x49cef1(++_0x285292);}(_0x1347,0x1b3));var _0x7134=function(_0x38c7e3,_0x34b4bc){_0x38c7e3=_0x38c7e3-0x0;var _0x34b66f=_0x1347[_0x38c7e3];return _0x34b66f;};'use strict';function Interval(_0x1a9478){this['id']=_0x1a9478['id']||0x0;this[_0x7134('0x0')]=_0x1a9478[_0x7134('0x0')]||'';this[_0x7134('0x1')]=_0x1a9478[_0x7134('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index b4e5732..775d7c5 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 _0xadc7=['md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','lodash'];(function(_0x51352f,_0x3f8caa){var _0x21db5c=function(_0x255700){while(--_0x255700){_0x51352f['push'](_0x51352f['shift']());}};_0x21db5c(++_0x3f8caa);}(_0xadc7,0x15b));var _0x7adc=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0xadc7[_0x1fdb40];return _0x281f93;};'use strict';var _=require(_0x7adc('0x0'));var md5=require(_0x7adc('0x1'));var util=require(_0x7adc('0x2'));var Redis=require('ioredis');var config=require(_0x7adc('0x3'));config[_0x7adc('0x4')]=_[_0x7adc('0x5')](config['redis'],{'host':_0x7adc('0x6'),'port':0x18eb});var io=require(_0x7adc('0x7'))(new Redis(config[_0x7adc('0x4')]));function MailQueue(_0x3765e7){this['id']=_0x3765e7['id']||0x0;this[_0x7adc('0x8')]=_0x3765e7[_0x7adc('0x8')]||'';this[_0x7adc('0x9')]=_0x3765e7[_0x7adc('0x9')]||0xa;this[_0x7adc('0xa')]=_0x3765e7[_0x7adc('0xa')]||_0x7adc('0xb');this[_0x7adc('0xc')]=_0x3765e7['Agents'];this[_0x7adc('0xd')]={};this[_0x7adc('0xe')]=0x0;this[_0x7adc('0x1')]='';this[_0x7adc('0xf')]();this[_0x7adc('0x10')]();}MailQueue[_0x7adc('0x11')][_0x7adc('0xf')]=function(){var _0x39c5a2=this[_0x7adc('0xd')]['_rr'];this[_0x7adc('0xd')]=_[_0x7adc('0x12')](this[_0x7adc('0xc')],'id');this[_0x7adc('0xd')][_0x7adc('0x13')]=_0x39c5a2;};MailQueue['prototype'][_0x7adc('0x10')]=function(){this[_0x7adc('0x14')]=0x0;this['paused']=0x0;for(var _0x42976=0x0;_0x42976=0x0?this[_0x7adc('0x19')]:0x0;var _0x5572bd={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7adc('0x14')],'name':this[_0x7adc('0x8')],'paused':this[_0x7adc('0x18')],'waiting':this['waiting']};var _0x492c24=md5(JSON[_0x7adc('0x1a')](_0x5572bd));if(this[_0x7adc('0x1')]!==_0x492c24){this['md5']=_0x492c24;io['to'](util[_0x7adc('0x1b')](_0x7adc('0x1c'),_0x5572bd[_0x7adc('0x8')]))['emit']('mail_queue:save',_0x5572bd);}};module['exports']=MailQueue; \ No newline at end of file +var _0x4e0c=['redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util'];(function(_0x17d12e,_0x29de54){var _0x1317c5=function(_0x199b46){while(--_0x199b46){_0x17d12e['push'](_0x17d12e['shift']());}};_0x1317c5(++_0x29de54);}(_0x4e0c,0x69));var _0xc4e0=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x4e0c[_0x189305];return _0xea3406;};'use strict';var _=require(_0xc4e0('0x0'));var md5=require(_0xc4e0('0x1'));var util=require(_0xc4e0('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xc4e0('0x3')]=_[_0xc4e0('0x4')](config[_0xc4e0('0x3')],{'host':_0xc4e0('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x21a4a4){this['id']=_0x21a4a4['id']||0x0;this[_0xc4e0('0x6')]=_0x21a4a4['name']||'';this[_0xc4e0('0x7')]=_0x21a4a4['timeout']||0xa;this[_0xc4e0('0x8')]=_0x21a4a4[_0xc4e0('0x8')]||_0xc4e0('0x9');this[_0xc4e0('0xa')]=_0x21a4a4['Agents'];this[_0xc4e0('0xb')]={};this['waiting']=0x0;this[_0xc4e0('0x1')]='';this[_0xc4e0('0xc')]();this[_0xc4e0('0xd')]();}MailQueue[_0xc4e0('0xe')]['updateRouting']=function(){var _0x233a93=this[_0xc4e0('0xb')][_0xc4e0('0xf')];this[_0xc4e0('0xb')]=_['map'](this[_0xc4e0('0xa')],'id');this[_0xc4e0('0xb')][_0xc4e0('0xf')]=_0x233a93;};MailQueue[_0xc4e0('0xe')][_0xc4e0('0xd')]=function(){this[_0xc4e0('0x10')]=0x0;this['paused']=0x0;for(var _0x564bc4=0x0;_0x564bc4=0x0?this[_0xc4e0('0x15')]:0x0;var _0x5979ec={'id':this['id'],'available':this[_0xc4e0('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xc4e0('0x6')],'paused':this[_0xc4e0('0x14')],'waiting':this['waiting']};var _0x3d2599=md5(JSON[_0xc4e0('0x16')](_0x5979ec));if(this['md5']!==_0x3d2599){this[_0xc4e0('0x1')]=_0x3d2599;io['to'](util[_0xc4e0('0x17')](_0xc4e0('0x18'),_0x5979ec[_0xc4e0('0x6')]))['emit'](_0xc4e0('0x19'),_0x5979ec);}};module[_0xc4e0('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ff560ea..27d8afc 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x2d018f,_0x5427cb){var _0x121b62=function(_0x4d9a08){while(--_0x4d9a08){_0x2d018f['push'](_0x2d018f['shift']());}};_0x121b62(++_0x5427cb);}(_0x814b,0x1a2));var _0xb814=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x814b[_0x265aa2];return _0x447a3a;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _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(_0x50d17b,_0x17cc5e){var _0x35038b=function(_0x24c078){while(--_0x24c078){_0x50d17b['push'](_0x50d17b['shift']());}};_0x35038b(++_0x17cc5e);}(_0xadb5,0xad));var _0x5adb=function(_0x45e1d7,_0x687ae3){_0x45e1d7=_0x45e1d7-0x0;var _0x5848fa=_0xadb5[_0x45e1d7];return _0x5848fa;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 6c7df5d..e1dd2d7 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 _0x0884=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','smsPause','available','stringify','sms_queue:save','exports','lodash'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4088('0x0'));var md5=require(_0x4088('0x1'));var util=require(_0x4088('0x2'));var Redis=require(_0x4088('0x3'));var config=require(_0x4088('0x4'));config[_0x4088('0x5')]=_[_0x4088('0x6')](config['redis'],{'host':_0x4088('0x7'),'port':0x18eb});var io=require(_0x4088('0x8'))(new Redis(config[_0x4088('0x5')]));function SmsQueue(_0x426db2){this['id']=_0x426db2['id']||0x0;this[_0x4088('0x9')]=_0x426db2['name']||'';this['timeout']=_0x426db2[_0x4088('0xa')]||0xa;this['strategy']=_0x426db2[_0x4088('0xb')]||_0x4088('0xc');this[_0x4088('0xd')]=_0x426db2[_0x4088('0xd')];this[_0x4088('0xe')]={};this[_0x4088('0xf')]=0x0;this[_0x4088('0x1')]='';this[_0x4088('0x10')]();this[_0x4088('0x11')]();}SmsQueue['prototype'][_0x4088('0x10')]=function(){var _0x25194b=this[_0x4088('0xe')]['_rr'];this[_0x4088('0xe')]=_[_0x4088('0x12')](this['Agents'],'id');this[_0x4088('0xe')][_0x4088('0x13')]=_0x25194b;};SmsQueue[_0x4088('0x14')][_0x4088('0x11')]=function(){this[_0x4088('0x15')]=0x0;this[_0x4088('0x16')]=0x0;for(var _0x10fde4=0x0;_0x10fde4=0x0?this[_0x4088('0x1a')]:0x0;var _0xc7fc8e={'id':this['id'],'available':this[_0x4088('0x1a')],'loggedIn':this[_0x4088('0x15')],'name':this[_0x4088('0x9')],'paused':this[_0x4088('0x16')],'waiting':this[_0x4088('0xf')]};var _0x38a626=md5(JSON[_0x4088('0x1b')](_0xc7fc8e));if(this['md5']!==_0x38a626){this[_0x4088('0x1')]=_0x38a626;io['to'](util['format']('sms:queue:%s',_0xc7fc8e['name']))['emit'](_0x4088('0x1c'),_0xc7fc8e);}};module[_0x4088('0x1d')]=SmsQueue; \ No newline at end of file +var _0x195e=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRouting','updateRealtime','mapAgentsId','map','_rr','prototype','paused','Agents','loggedIn','available','stringify','sms:queue:%s','emit','sms_queue:save','lodash'];(function(_0x3360de,_0x24ee38){var _0x17e4d6=function(_0x4b446c){while(--_0x4b446c){_0x3360de['push'](_0x3360de['shift']());}};_0x17e4d6(++_0x24ee38);}(_0x195e,0xfb));var _0xe195=function(_0x43d1e9,_0x11281f){_0x43d1e9=_0x43d1e9-0x0;var _0x3f3714=_0x195e[_0x43d1e9];return _0x3f3714;};'use strict';var _=require(_0xe195('0x0'));var md5=require(_0xe195('0x1'));var util=require(_0xe195('0x2'));var Redis=require(_0xe195('0x3'));var config=require(_0xe195('0x4'));config[_0xe195('0x5')]=_[_0xe195('0x6')](config[_0xe195('0x5')],{'host':_0xe195('0x7'),'port':0x18eb});var io=require(_0xe195('0x8'))(new Redis(config[_0xe195('0x5')]));function SmsQueue(_0x2d1fa7){this['id']=_0x2d1fa7['id']||0x0;this[_0xe195('0x9')]=_0x2d1fa7['name']||'';this[_0xe195('0xa')]=_0x2d1fa7[_0xe195('0xa')]||0xa;this[_0xe195('0xb')]=_0x2d1fa7[_0xe195('0xb')]||_0xe195('0xc');this['Agents']=_0x2d1fa7['Agents'];this['mapAgentsId']={};this[_0xe195('0xd')]=0x0;this[_0xe195('0x1')]='';this[_0xe195('0xe')]();this[_0xe195('0xf')]();}SmsQueue['prototype'][_0xe195('0xe')]=function(){var _0x267721=this[_0xe195('0x10')]['_rr'];this[_0xe195('0x10')]=_[_0xe195('0x11')](this['Agents'],'id');this[_0xe195('0x10')][_0xe195('0x12')]=_0x267721;};SmsQueue[_0xe195('0x13')][_0xe195('0xf')]=function(){this['loggedIn']=0x0;this[_0xe195('0x14')]=0x0;for(var _0x2e82d1=0x0;_0x2e82d1=0x0?this[_0xe195('0x17')]:0x0;var _0x41265d={'id':this['id'],'available':this[_0xe195('0x17')],'loggedIn':this[_0xe195('0x16')],'name':this['name'],'paused':this[_0xe195('0x14')],'waiting':this[_0xe195('0xd')]};var _0xdf735a=md5(JSON[_0xe195('0x18')](_0x41265d));if(this[_0xe195('0x1')]!==_0xdf735a){this[_0xe195('0x1')]=_0xdf735a;io['to'](util['format'](_0xe195('0x19'),_0x41265d[_0xe195('0x9')]))[_0xe195('0x1a')](_0xe195('0x1b'),_0x41265d);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index d6f2cec..2f9f48f 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 _0x74e7=['format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','defaults','localhost','socket.io-emitter','redis','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify'];(function(_0x3c640e,_0xdf16d8){var _0x43dba1=function(_0x89c717){while(--_0x89c717){_0x3c640e['push'](_0x3c640e['shift']());}};_0x43dba1(++_0xdf16d8);}(_0x74e7,0xd0));var _0x774e=function(_0x3de2ca,_0x51e1ba){_0x3de2ca=_0x3de2ca-0x0;var _0x2e9106=_0x74e7[_0x3de2ca];return _0x2e9106;};'use strict';var _=require('lodash');var md5=require(_0x774e('0x0'));var util=require(_0x774e('0x1'));var Redis=require(_0x774e('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x774e('0x3')](config['redis'],{'host':_0x774e('0x4'),'port':0x18eb});var io=require(_0x774e('0x5'))(new Redis(config[_0x774e('0x6')]));function WhatsappQueue(_0xda659d){this['id']=_0xda659d['id']||0x0;this[_0x774e('0x7')]=_0xda659d[_0x774e('0x7')]||'';this['timeout']=_0xda659d['timeout']||0xa;this[_0x774e('0x8')]=_0xda659d['strategy']||_0x774e('0x9');this[_0x774e('0xa')]=_0xda659d[_0x774e('0xa')];this[_0x774e('0xb')]={};this[_0x774e('0xc')]=0x0;this[_0x774e('0x0')]='';this[_0x774e('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x774e('0xe')][_0x774e('0xd')]=function(){var _0x2f6428=this[_0x774e('0xb')][_0x774e('0xf')];this[_0x774e('0xb')]=_[_0x774e('0x10')](this['Agents'],'id');this[_0x774e('0xb')][_0x774e('0xf')]=_0x2f6428;};WhatsappQueue[_0x774e('0xe')]['updateRealtime']=function(){this[_0x774e('0x11')]=0x0;this[_0x774e('0x12')]=0x0;for(var _0x4ee116=0x0;_0x4ee116=0x0?this[_0x774e('0x16')]:0x0;var _0x35d306={'id':this['id'],'available':this[_0x774e('0x16')],'loggedIn':this[_0x774e('0x11')],'name':this[_0x774e('0x7')],'paused':this[_0x774e('0x12')],'waiting':this[_0x774e('0xc')]};var _0x13a4e5=md5(JSON[_0x774e('0x17')](_0x35d306));if(this[_0x774e('0x0')]!==_0x13a4e5){this[_0x774e('0x0')]=_0x13a4e5;io['to'](util[_0x774e('0x18')](_0x774e('0x19'),_0x35d306[_0x774e('0x7')]))[_0x774e('0x1a')](_0x774e('0x1b'),_0x35d306);}};module[_0x774e('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x63f4=['whatsapp_queue:save','exports','lodash','md5','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit'];(function(_0x17afd2,_0x4deb5e){var _0x3c7fec=function(_0x10a031){while(--_0x10a031){_0x17afd2['push'](_0x17afd2['shift']());}};_0x3c7fec(++_0x4deb5e);}(_0x63f4,0x17b));var _0x463f=function(_0x371a86,_0x3e2221){_0x371a86=_0x371a86-0x0;var _0x5c32b8=_0x63f4[_0x371a86];return _0x5c32b8;};'use strict';var _=require(_0x463f('0x0'));var md5=require(_0x463f('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x463f('0x2'));config['redis']=_[_0x463f('0x3')](config[_0x463f('0x4')],{'host':_0x463f('0x5'),'port':0x18eb});var io=require(_0x463f('0x6'))(new Redis(config[_0x463f('0x4')]));function WhatsappQueue(_0x42e0fc){this['id']=_0x42e0fc['id']||0x0;this['name']=_0x42e0fc[_0x463f('0x7')]||'';this[_0x463f('0x8')]=_0x42e0fc[_0x463f('0x8')]||0xa;this[_0x463f('0x9')]=_0x42e0fc[_0x463f('0x9')]||'beepall';this[_0x463f('0xa')]=_0x42e0fc[_0x463f('0xa')];this[_0x463f('0xb')]={};this[_0x463f('0xc')]=0x0;this[_0x463f('0x1')]='';this['updateRouting']();this[_0x463f('0xd')]();}WhatsappQueue[_0x463f('0xe')][_0x463f('0xf')]=function(){var _0x211093=this['mapAgentsId'][_0x463f('0x10')];this[_0x463f('0xb')]=_[_0x463f('0x11')](this[_0x463f('0xa')],'id');this['mapAgentsId']['_rr']=_0x211093;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x463f('0x12')]=0x0;this[_0x463f('0x13')]=0x0;for(var _0x43399f=0x0;_0x43399f=0x0?this['available']:0x0;var _0x198665={'id':this['id'],'available':this[_0x463f('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x463f('0x13')],'waiting':this[_0x463f('0xc')]};var _0x3c28e9=md5(JSON[_0x463f('0x18')](_0x198665));if(this[_0x463f('0x1')]!==_0x3c28e9){this[_0x463f('0x1')]=_0x3c28e9;io['to'](util['format'](_0x463f('0x19'),_0x198665[_0x463f('0x7')]))[_0x463f('0x1a')](_0x463f('0x1b'),_0x198665);}};module[_0x463f('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index a19847b..22e2fbd 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 3f8dffb..c82b059 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 _0xd603=['addTags','AddTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction'];(function(_0x4fe19c,_0x45d0fe){var _0x952ac7=function(_0x274a16){while(--_0x274a16){_0x4fe19c['push'](_0x4fe19c['shift']());}};_0x952ac7(++_0x45d0fe);}(_0xd603,0x158));var _0x3d60=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd603[_0x8c43de];return _0xa6591b;};'use strict';var client=require(_0x3d60('0x0'));exports[_0x3d60('0x1')]=function(_0x293de2,_0x37c3f7){return client['Request'](_0x3d60('0x2'),{'body':_0x37c3f7,'options':{'where':{'id':_0x293de2}},'log':_0x3d60('0x3')});};exports[_0x3d60('0x4')]=function(_0x1a8227,_0x3812bb){return client['Request'](_0x3d60('0x5'),{'body':_0x3812bb,'options':{'where':{'id':_0x1a8227}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x8907=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','updateChatInteraction','addTags'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8907,0x152));var _0x7890=function(_0x5dbc7d,_0x1e0053){_0x5dbc7d=_0x5dbc7d-0x0;var _0x3eaf2b=_0x8907[_0x5dbc7d];return _0x3eaf2b;};'use strict';var client=require(_0x7890('0x0'));exports[_0x7890('0x1')]=function(_0x1a7433,_0x5f5536){return client[_0x7890('0x2')]('UpdateChatInteraction',{'body':_0x5f5536,'options':{'where':{'id':_0x1a7433}},'log':_0x7890('0x3')});};exports[_0x7890('0x4')]=function(_0x46ca40,_0x1ef28d){return client[_0x7890('0x2')](_0x7890('0x5'),{'body':_0x1ef28d,'options':{'where':{'id':_0x46ca40}},'log':_0x7890('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 415283d..5f60b59 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 _0x4ac4=['createChatMessage','../client','CreateChatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ac4,0xee));var _0x44ac=function(_0x553178,_0x3b742f){_0x553178=_0x553178-0x0;var _0x5dd8ea=_0x4ac4[_0x553178];return _0x5dd8ea;};'use strict';var client=require(_0x44ac('0x0'));exports['create']=function(_0x553799){return client['Request'](_0x44ac('0x1'),{'body':_0x553799,'log':_0x44ac('0x2')});}; \ No newline at end of file +var _0xacf2=['../client','CreateChatMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xacf2,0x140));var _0x2acf=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xacf2[_0x2df507];return _0x1f7167;};'use strict';var client=require(_0x2acf('0x0'));exports['create']=function(_0x7e4ba1){return client['Request'](_0x2acf('0x1'),{'body':_0x7e4ba1,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ab1de78..b0fcb11 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 _0x0207=['strategy','User','Agents','online','getChatQueues','name','timeout'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x0207,0x162));var _0x7020=function(_0xfb8e9c,_0x4bfaec){_0xfb8e9c=_0xfb8e9c-0x0;var _0x432968=_0x0207[_0xfb8e9c];return _0x432968;};'use strict';var client=require('../client');exports[_0x7020('0x0')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x7020('0x1'),_0x7020('0x2'),_0x7020('0x3')],'include':[{'model':_0x7020('0x4'),'as':_0x7020('0x5'),'attributes':['id',_0x7020('0x1'),_0x7020('0x6'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x99fb=['chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy','Agents'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x99fb,0x92));var _0xb99f=function(_0x1b244e,_0x5c9290){_0x1b244e=_0x1b244e-0x0;var _0x538add=_0x99fb[_0x1b244e];return _0x538add;};'use strict';var client=require(_0xb99f('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xb99f('0x1')](_0xb99f('0x2'),{'options':{'raw':![],'attributes':['id',_0xb99f('0x3'),_0xb99f('0x4'),_0xb99f('0x5')],'include':[{'model':'User','as':_0xb99f('0x6'),'attributes':['id',_0xb99f('0x3'),'online',_0xb99f('0x7')]}]},'log':_0xb99f('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e867ca4..3432e10 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 _0xe107=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x325769,_0x1b5e99){var _0xda9643=function(_0x48fbc1){while(--_0x48fbc1){_0x325769['push'](_0x325769['shift']());}};_0xda9643(++_0x1b5e99);}(_0xe107,0xb3));var _0x7e10=function(_0x538b44,_0x3a583e){_0x538b44=_0x538b44-0x0;var _0xa76d43=_0xe107[_0x538b44];return _0xa76d43;};'use strict';var client=require(_0x7e10('0x0'));exports['create']=function(_0x2ae2a8){return client[_0x7e10('0x1')](_0x7e10('0x2'),{'body':_0x2ae2a8,'log':'CreateChatQueueReport'});};exports[_0x7e10('0x3')]=function(_0x56db00,_0x4db676){return client[_0x7e10('0x1')](_0x7e10('0x4'),{'body':_0x4db676,'options':{'where':{'uniqueid':_0x56db00},'order':[['id',_0x7e10('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xd845=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x1d617b,_0x525787){var _0x525cb1=function(_0x24df2f){while(--_0x24df2f){_0x1d617b['push'](_0x1d617b['shift']());}};_0x525cb1(++_0x525787);}(_0xd845,0x135));var _0x5d84=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xd845[_0xea8947];return _0x2455e9;};'use strict';var client=require(_0x5d84('0x0'));exports[_0x5d84('0x1')]=function(_0xc6e9bc){return client[_0x5d84('0x2')]('CreateChatQueueReport',{'body':_0xc6e9bc,'log':_0x5d84('0x3')});};exports[_0x5d84('0x4')]=function(_0x918317,_0x11abe5){return client['Request'](_0x5d84('0x5'),{'body':_0x11abe5,'options':{'where':{'uniqueid':_0x918317},'order':[['id',_0x5d84('0x6')]],'limit':0x1},'log':_0x5d84('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 9ef327a..135eb68 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(_0x31c402,_0x24f479){var _0x59e2a4=function(_0x5c4b03){while(--_0x5c4b03){_0x31c402['push'](_0x31c402['shift']());}};_0x59e2a4(++_0x24f479);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x7a54,0x106));var _0x47a5=function(_0x2d9c39,_0x41222a){_0x2d9c39=_0x2d9c39-0x0;var _0x5f12e9=_0x7a54[_0x2d9c39];return _0x5f12e9;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index f01a03e..907378c 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 _0xfa68=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x3d560b,_0x3730a4){var _0x5c0b56=function(_0x53eb37){while(--_0x53eb37){_0x3d560b['push'](_0x3d560b['shift']());}};_0x5c0b56(++_0x3730a4);}(_0xfa68,0x1a8));var _0x8fa6=function(_0x5cb934,_0x1c2bdd){_0x5cb934=_0x5cb934-0x0;var _0x2611bc=_0xfa68[_0x5cb934];return _0x2611bc;};'use strict';var client=require(_0x8fa6('0x0'));exports[_0x8fa6('0x1')]=function(_0x1ffb98){return client[_0x8fa6('0x2')](_0x8fa6('0x3'),{'body':_0x1ffb98,'log':_0x8fa6('0x4')});}; \ No newline at end of file +var _0x5fd6=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0x5860cc,_0x30e2ca){var _0x8d74ed=function(_0x4c70ee){while(--_0x4c70ee){_0x5860cc['push'](_0x5860cc['shift']());}};_0x8d74ed(++_0x30e2ca);}(_0x5fd6,0x19c));var _0x65fd=function(_0x2adc6c,_0xf9bf99){_0x2adc6c=_0x2adc6c-0x0;var _0x118ef5=_0x5fd6[_0x2adc6c];return _0x118ef5;};'use strict';var client=require(_0x65fd('0x0'));exports[_0x65fd('0x1')]=function(_0x3131ae){return client['Request'](_0x65fd('0x2'),{'body':_0x3131ae,'log':_0x65fd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 7c62f0f..9fc5915 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 _0xb700=['User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x406e73,_0x3a3f65){var _0x5ca6f2=function(_0x34b2b3){while(--_0x34b2b3){_0x406e73['push'](_0x406e73['shift']());}};_0x5ca6f2(++_0x3a3f65);}(_0xb700,0x1b1));var _0x0b70=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0xb700[_0x1b1f88];return _0x5045b9;};'use strict';var client=require(_0x0b70('0x0'));exports[_0x0b70('0x1')]=function(){return function(){return client[_0x0b70('0x2')](_0x0b70('0x3'),{'options':{'raw':![],'attributes':['id',_0x0b70('0x4'),_0x0b70('0x5'),_0x0b70('0x6')],'include':[{'model':_0x0b70('0x7'),'as':_0x0b70('0x8'),'attributes':['id','name',_0x0b70('0x9'),_0x0b70('0xa')]}]},'log':_0x0b70('0x1')});};}; \ No newline at end of file +var _0x9a28=['strategy','User','Agents','faxPause','getFaxQueues','GetFaxQueue','name','timeout'];(function(_0x3e0349,_0x4112b8){var _0x38f710=function(_0x6e7c24){while(--_0x6e7c24){_0x3e0349['push'](_0x3e0349['shift']());}};_0x38f710(++_0x4112b8);}(_0x9a28,0x13c));var _0x89a2=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x9a28[_0x17928f];return _0x500b63;};'use strict';var client=require('../client');exports[_0x89a2('0x0')]=function(){return function(){return client['Request'](_0x89a2('0x1'),{'options':{'raw':![],'attributes':['id',_0x89a2('0x2'),_0x89a2('0x3'),_0x89a2('0x4')],'include':[{'model':_0x89a2('0x5'),'as':_0x89a2('0x6'),'attributes':['id','name','online',_0x89a2('0x7')]}]},'log':_0x89a2('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 7c9c1fd..817a970 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 _0xc18b=['Request','UpdateFaxQueueReport','CreateFaxQueueReport','update'];(function(_0x564512,_0x50b138){var _0x72fd5f=function(_0x173755){while(--_0x173755){_0x564512['push'](_0x564512['shift']());}};_0x72fd5f(++_0x50b138);}(_0xc18b,0x13e));var _0xbc18=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xc18b[_0x238671];return _0x474844;};'use strict';var client=require('../client');exports['create']=function(_0x93c577){return client['Request'](_0xbc18('0x0'),{'body':_0x93c577,'log':_0xbc18('0x0')});};exports[_0xbc18('0x1')]=function(_0xf26c13,_0x20f776){return client[_0xbc18('0x2')](_0xbc18('0x3'),{'body':_0x20f776,'options':{'where':{'uniqueid':_0xf26c13},'order':[['id','DESC']],'limit':0x1},'log':_0xbc18('0x3')});}; \ No newline at end of file +var _0xb5f0=['update','DESC','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x3a7298,_0x27058){var _0x2504e8=function(_0x1932ec){while(--_0x1932ec){_0x3a7298['push'](_0x3a7298['shift']());}};_0x2504e8(++_0x27058);}(_0xb5f0,0x16f));var _0x0b5f=function(_0x55d23f,_0x3b0f70){_0x55d23f=_0x55d23f-0x0;var _0x1043b0=_0xb5f0[_0x55d23f];return _0x1043b0;};'use strict';var client=require(_0x0b5f('0x0'));exports[_0x0b5f('0x1')]=function(_0x30512d){return client[_0x0b5f('0x2')](_0x0b5f('0x3'),{'body':_0x30512d,'log':_0x0b5f('0x3')});};exports[_0x0b5f('0x4')]=function(_0x36b02d,_0x3024f4){return client[_0x0b5f('0x2')]('UpdateFaxQueueReport',{'body':_0x3024f4,'options':{'where':{'uniqueid':_0x36b02d},'order':[['id',_0x0b5f('0x5')]],'limit':0x1},'log':_0x0b5f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 977f067..b1b4066 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 _0x0a37=['interval','../client','getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0a37,0x109));var _0x70a3=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x0a37[_0x1992f1];return _0x413dfe;};'use strict';var client=require(_0x70a3('0x0'));exports[_0x70a3('0x1')]=function(){return function(){return client[_0x70a3('0x2')](_0x70a3('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x70a3('0x4')],'include':[{'model':_0x70a3('0x5'),'as':_0x70a3('0x6'),'attributes':['id','name',_0x70a3('0x7')]}]},'log':_0x70a3('0x1')});};}; \ No newline at end of file +var _0x3c9c=['Intervals','interval','getIntervals','Request','GetInterval','name','Interval'];(function(_0x5a0349,_0xaa3aac){var _0x2b3020=function(_0x3fd692){while(--_0x3fd692){_0x5a0349['push'](_0x5a0349['shift']());}};_0x2b3020(++_0xaa3aac);}(_0x3c9c,0x168));var _0xc3c9=function(_0x351237,_0x346117){_0x351237=_0x351237-0x0;var _0x5cf412=_0x3c9c[_0x351237];return _0x5cf412;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0xc3c9('0x0')](_0xc3c9('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xc3c9('0x2')],'include':[{'model':_0xc3c9('0x3'),'as':_0xc3c9('0x4'),'attributes':['id',_0xc3c9('0x2'),_0xc3c9('0x5')]}]},'log':_0xc3c9('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 5497a49..d38475a 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 _0xa30a=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x466a51,_0x69913c){var _0x509325=function(_0x5dd83e){while(--_0x5dd83e){_0x466a51['push'](_0x466a51['shift']());}};_0x509325(++_0x69913c);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xaa30('0x0'));exports[_0xaa30('0x1')]=function(_0x25634b,_0x4dfa7e){return client[_0xaa30('0x2')](_0xaa30('0x3'),{'body':_0x4dfa7e,'options':{'where':{'id':_0x25634b}},'log':_0xaa30('0x4')});};exports[_0xaa30('0x5')]=function(_0x2a9b06,_0x271425){return client[_0xaa30('0x2')]('AddTagsToMailInteraction',{'body':_0x271425,'options':{'where':{'id':_0x2a9b06}},'log':_0xaa30('0x6')});}; \ No newline at end of file +var _0x4888=['AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x3f0806,_0x3ac6c9){var _0x5a57c8=function(_0x4a21cd){while(--_0x4a21cd){_0x3f0806['push'](_0x3f0806['shift']());}};_0x5a57c8(++_0x3ac6c9);}(_0x4888,0x198));var _0x8488=function(_0x325673,_0x13c10b){_0x325673=_0x325673-0x0;var _0x741c5b=_0x4888[_0x325673];return _0x741c5b;};'use strict';var client=require('../client');exports[_0x8488('0x0')]=function(_0x1f0e53,_0x2af900){return client[_0x8488('0x1')](_0x8488('0x2'),{'body':_0x2af900,'options':{'where':{'id':_0x1f0e53}},'log':_0x8488('0x3')});};exports[_0x8488('0x4')]=function(_0x571e4b,_0x267093){return client[_0x8488('0x1')](_0x8488('0x5'),{'body':_0x267093,'options':{'where':{'id':_0x571e4b}},'log':_0x8488('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 15453ff..2cfde7f 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 _0x2279=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x13e4d6,_0x4d647f){var _0x395c06=function(_0x55ce7f){while(--_0x55ce7f){_0x13e4d6['push'](_0x13e4d6['shift']());}};_0x395c06(++_0x4d647f);}(_0x2279,0x7e));var _0x9227=function(_0xc98ed1,_0x492df4){_0xc98ed1=_0xc98ed1-0x0;var _0x516c4c=_0x2279[_0xc98ed1];return _0x516c4c;};'use strict';var client=require(_0x9227('0x0'));exports[_0x9227('0x1')]=function(_0x330718){return client[_0x9227('0x2')](_0x9227('0x3'),{'body':_0x330718,'log':_0x9227('0x4')});}; \ No newline at end of file +var _0xe210=['create','Request','CreateMailMessage','../client'];(function(_0x426dfc,_0x119406){var _0x31a876=function(_0x4e2ee0){while(--_0x4e2ee0){_0x426dfc['push'](_0x426dfc['shift']());}};_0x31a876(++_0x119406);}(_0xe210,0x17b));var _0x0e21=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xe210[_0xc4001c];return _0x49f7bc;};'use strict';var client=require(_0x0e21('0x0'));exports[_0x0e21('0x1')]=function(_0x5708b2){return client[_0x0e21('0x2')](_0x0e21('0x3'),{'body':_0x5708b2,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index fd1982a..711a8aa 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 _0xc281=['Agents','mailPause','../client','getMailQueues','name','timeout','strategy','User'];(function(_0x3a9376,_0x5a0f26){var _0x2b962b=function(_0x419281){while(--_0x419281){_0x3a9376['push'](_0x3a9376['shift']());}};_0x2b962b(++_0x5a0f26);}(_0xc281,0x1b2));var _0x1c28=function(_0x10b863,_0x4027c2){_0x10b863=_0x10b863-0x0;var _0x498d2a=_0xc281[_0x10b863];return _0x498d2a;};'use strict';var client=require(_0x1c28('0x0'));exports[_0x1c28('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x1c28('0x2'),_0x1c28('0x3'),_0x1c28('0x4')],'include':[{'model':_0x1c28('0x5'),'as':_0x1c28('0x6'),'attributes':['id','name','online',_0x1c28('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x7bf2=['mailPause','getMailQueues','../client','Request','GetMailQueue','name','timeout','strategy','Agents','online'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7bf2,0x1b0));var _0x27bf=function(_0x125847,_0x49a6b8){_0x125847=_0x125847-0x0;var _0x3fc9c5=_0x7bf2[_0x125847];return _0x3fc9c5;};'use strict';var client=require(_0x27bf('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x27bf('0x1')](_0x27bf('0x2'),{'options':{'raw':![],'attributes':['id',_0x27bf('0x3'),_0x27bf('0x4'),_0x27bf('0x5')],'include':[{'model':'User','as':_0x27bf('0x6'),'attributes':['id',_0x27bf('0x3'),_0x27bf('0x7'),_0x27bf('0x8')]}]},'log':_0x27bf('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index c3c49a0..d458603 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 _0x3d0b=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','create','Request'];(function(_0x2be104,_0x4bf5d0){var _0x31c115=function(_0x41d524){while(--_0x41d524){_0x2be104['push'](_0x2be104['shift']());}};_0x31c115(++_0x4bf5d0);}(_0x3d0b,0x100));var _0xb3d0=function(_0x411e71,_0xf9652){_0x411e71=_0x411e71-0x0;var _0x226ae3=_0x3d0b[_0x411e71];return _0x226ae3;};'use strict';var client=require('../client');exports[_0xb3d0('0x0')]=function(_0x206a62){return client[_0xb3d0('0x1')](_0xb3d0('0x2'),{'body':_0x206a62,'log':_0xb3d0('0x2')});};exports[_0xb3d0('0x3')]=function(_0x467422,_0x537d5b){return client[_0xb3d0('0x1')](_0xb3d0('0x4'),{'body':_0x537d5b,'options':{'where':{'uniqueid':_0x467422},'order':[['id',_0xb3d0('0x5')]],'limit':0x1},'log':_0xb3d0('0x4')});}; \ No newline at end of file +var _0xb815=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x3f7e42,_0x47fafe){var _0x3bfbe8=function(_0x415f62){while(--_0x415f62){_0x3f7e42['push'](_0x3f7e42['shift']());}};_0x3bfbe8(++_0x47fafe);}(_0xb815,0xa0));var _0x5b81=function(_0xd76974,_0x1526e2){_0xd76974=_0xd76974-0x0;var _0x3b4a03=_0xb815[_0xd76974];return _0x3b4a03;};'use strict';var client=require(_0x5b81('0x0'));exports[_0x5b81('0x1')]=function(_0x17e0c5){return client[_0x5b81('0x2')](_0x5b81('0x3'),{'body':_0x17e0c5,'log':_0x5b81('0x3')});};exports[_0x5b81('0x4')]=function(_0x514d29,_0x11ab56){return client[_0x5b81('0x2')](_0x5b81('0x5'),{'body':_0x11ab56,'options':{'where':{'uniqueid':_0x514d29},'order':[['id',_0x5b81('0x6')]],'limit':0x1},'log':_0x5b81('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index eb7ca4e..8d07be1 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 _0xade5=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','updateOpenchannelInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xade5,0xe3));var _0x5ade=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xade5[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x5ade('0x0'));exports['update']=function(_0x23f451,_0x2d066c){return client[_0x5ade('0x1')]('UpdateOpenchannelInteraction',{'body':_0x2d066c,'options':{'where':{'id':_0x23f451}},'log':_0x5ade('0x2')});};exports['addTags']=function(_0x1ef434,_0x48efd){return client['Request'](_0x5ade('0x3'),{'body':_0x48efd,'options':{'where':{'id':_0x1ef434}},'log':_0x5ade('0x4')});}; \ No newline at end of file +var _0x68b4=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','update','Request'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0x68b4,0x66));var _0x468b=function(_0x2c7dab,_0x479b4c){_0x2c7dab=_0x2c7dab-0x0;var _0x514b4d=_0x68b4[_0x2c7dab];return _0x514b4d;};'use strict';var client=require(_0x468b('0x0'));exports[_0x468b('0x1')]=function(_0x1afca4,_0x54ef13){return client[_0x468b('0x2')](_0x468b('0x3'),{'body':_0x54ef13,'options':{'where':{'id':_0x1afca4}},'log':_0x468b('0x4')});};exports[_0x468b('0x5')]=function(_0x5e2925,_0x546ca2){return client[_0x468b('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x546ca2,'options':{'where':{'id':_0x5e2925}},'log':_0x468b('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2a6d973..e586211 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 _0x56ce=['CreateOpenchannelMessage','createOpenchannelMessage','create','Request'];(function(_0x434010,_0x591dd5){var _0x37cab1=function(_0x4fab0b){while(--_0x4fab0b){_0x434010['push'](_0x434010['shift']());}};_0x37cab1(++_0x591dd5);}(_0x56ce,0x1ba));var _0xe56c=function(_0x2419e1,_0xac57a6){_0x2419e1=_0x2419e1-0x0;var _0x52345c=_0x56ce[_0x2419e1];return _0x52345c;};'use strict';var client=require('../client');exports[_0xe56c('0x0')]=function(_0x3741f0){return client[_0xe56c('0x1')](_0xe56c('0x2'),{'body':_0x3741f0,'log':_0xe56c('0x3')});}; \ No newline at end of file +var _0x9908=['createOpenchannelMessage','create','Request','CreateOpenchannelMessage'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x9908,0x8d));var _0x8990=function(_0x3cc8b9,_0x5c95f9){_0x3cc8b9=_0x3cc8b9-0x0;var _0x44d63f=_0x9908[_0x3cc8b9];return _0x44d63f;};'use strict';var client=require('../client');exports[_0x8990('0x0')]=function(_0x414a09){return client[_0x8990('0x1')](_0x8990('0x2'),{'body':_0x414a09,'log':_0x8990('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index fe2ad7e..20b68dd 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 _0x8f41=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x48cde6,_0x15ea22){var _0x552f35=function(_0x3a6835){while(--_0x3a6835){_0x48cde6['push'](_0x48cde6['shift']());}};_0x552f35(++_0x15ea22);}(_0x8f41,0x138));var _0x18f4=function(_0x54ec9a,_0xfd1d53){_0x54ec9a=_0x54ec9a-0x0;var _0x2c9032=_0x8f41[_0x54ec9a];return _0x2c9032;};'use strict';var client=require(_0x18f4('0x0'));exports[_0x18f4('0x1')]=function(){return function(){return client[_0x18f4('0x2')](_0x18f4('0x3'),{'options':{'raw':![],'attributes':['id',_0x18f4('0x4'),_0x18f4('0x5'),_0x18f4('0x6')],'include':[{'model':_0x18f4('0x7'),'as':'Agents','attributes':['id',_0x18f4('0x4'),_0x18f4('0x8'),_0x18f4('0x9')]}]},'log':_0x18f4('0x1')});};}; \ No newline at end of file +var _0x0179=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','online'];(function(_0x4df092,_0xb62285){var _0x19a060=function(_0x172803){while(--_0x172803){_0x4df092['push'](_0x4df092['shift']());}};_0x19a060(++_0xb62285);}(_0x0179,0x1f1));var _0x9017=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0179[_0x47aa64];return _0x549c7a;};'use strict';var client=require(_0x9017('0x0'));exports[_0x9017('0x1')]=function(){return function(){return client[_0x9017('0x2')](_0x9017('0x3'),{'options':{'raw':![],'attributes':['id',_0x9017('0x4'),_0x9017('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x9017('0x4'),_0x9017('0x6'),_0x9017('0x7')]}]},'log':_0x9017('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index d4ed47f..49aaaf8 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 _0x325b=['create','CreateOpenchannelQueueReport','Request','UpdateOpenchannelQueueReport','../client'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0x325b,0x8b));var _0xb325=function(_0x1534a3,_0x1f9e9b){_0x1534a3=_0x1534a3-0x0;var _0x136a77=_0x325b[_0x1534a3];return _0x136a77;};'use strict';var client=require(_0xb325('0x0'));exports[_0xb325('0x1')]=function(_0x3d1323){return client['Request'](_0xb325('0x2'),{'body':_0x3d1323,'log':_0xb325('0x2')});};exports['update']=function(_0x4dd27f,_0x3a6c20){return client[_0xb325('0x3')](_0xb325('0x4'),{'body':_0x3a6c20,'options':{'where':{'uniqueid':_0x4dd27f},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xfe9d=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x228b77,_0x480b88){var _0xb15d59=function(_0x51308c){while(--_0x51308c){_0x228b77['push'](_0x228b77['shift']());}};_0xb15d59(++_0x480b88);}(_0xfe9d,0x10e));var _0xdfe9=function(_0x3af760,_0x465fd2){_0x3af760=_0x3af760-0x0;var _0x455daf=_0xfe9d[_0x3af760];return _0x455daf;};'use strict';var client=require(_0xdfe9('0x0'));exports[_0xdfe9('0x1')]=function(_0x75737a){return client[_0xdfe9('0x2')](_0xdfe9('0x3'),{'body':_0x75737a,'log':'CreateOpenchannelQueueReport'});};exports[_0xdfe9('0x4')]=function(_0x4c71d5,_0x1144b0){return client[_0xdfe9('0x2')](_0xdfe9('0x5'),{'body':_0x1144b0,'options':{'where':{'uniqueid':_0x4c71d5},'order':[['id',_0xdfe9('0x6')]],'limit':0x1},'log':_0xdfe9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index edf4ce1..c97cb59 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 _0xec46=['updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','../client','update'];(function(_0x118b8a,_0x2277cf){var _0x3dbdd6=function(_0xc51a90){while(--_0xc51a90){_0x118b8a['push'](_0x118b8a['shift']());}};_0x3dbdd6(++_0x2277cf);}(_0xec46,0x19c));var _0x6ec4=function(_0x4f7014,_0x3649ef){_0x4f7014=_0x4f7014-0x0;var _0x8fa130=_0xec46[_0x4f7014];return _0x8fa130;};'use strict';var client=require(_0x6ec4('0x0'));exports[_0x6ec4('0x1')]=function(_0x455c4a,_0x181058){return client['Request']('UpdateSmsInteraction',{'body':_0x181058,'options':{'where':{'id':_0x455c4a}},'log':_0x6ec4('0x2')});};exports[_0x6ec4('0x3')]=function(_0x86b9f8,_0x53bbed){return client[_0x6ec4('0x4')](_0x6ec4('0x5'),{'body':_0x53bbed,'options':{'where':{'id':_0x86b9f8}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x4aa3=['../client','update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x384ee9,_0x22411d){var _0xc4e31c=function(_0x40133a){while(--_0x40133a){_0x384ee9['push'](_0x384ee9['shift']());}};_0xc4e31c(++_0x22411d);}(_0x4aa3,0x174));var _0x34aa=function(_0x4fd722,_0x534dcf){_0x4fd722=_0x4fd722-0x0;var _0x3233a1=_0x4aa3[_0x4fd722];return _0x3233a1;};'use strict';var client=require(_0x34aa('0x0'));exports[_0x34aa('0x1')]=function(_0x5944d7,_0x44cd16){return client[_0x34aa('0x2')]('UpdateSmsInteraction',{'body':_0x44cd16,'options':{'where':{'id':_0x5944d7}},'log':_0x34aa('0x3')});};exports[_0x34aa('0x4')]=function(_0x4a81e7,_0x3f367e){return client[_0x34aa('0x2')](_0x34aa('0x5'),{'body':_0x3f367e,'options':{'where':{'id':_0x4a81e7}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index b32f1b2..d049ea1 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 _0xf5b3=['../client','create','CreateSmsMessage'];(function(_0x180512,_0x2fba15){var _0xa20dea=function(_0x3b5e78){while(--_0x3b5e78){_0x180512['push'](_0x180512['shift']());}};_0xa20dea(++_0x2fba15);}(_0xf5b3,0xc9));var _0x3f5b=function(_0x4c2cd2,_0x280f2a){_0x4c2cd2=_0x4c2cd2-0x0;var _0x28fc7a=_0xf5b3[_0x4c2cd2];return _0x28fc7a;};'use strict';var client=require(_0x3f5b('0x0'));exports[_0x3f5b('0x1')]=function(_0x24bc1b){return client['Request'](_0x3f5b('0x2'),{'body':_0x24bc1b,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x0e02=['create','CreateSmsMessage','createSmsMessage'];(function(_0x4728a8,_0x4cddac){var _0x598a9a=function(_0xa1f20d){while(--_0xa1f20d){_0x4728a8['push'](_0x4728a8['shift']());}};_0x598a9a(++_0x4cddac);}(_0x0e02,0x120));var _0x20e0=function(_0x1950ba,_0x19f10c){_0x1950ba=_0x1950ba-0x0;var _0x4d4d2a=_0x0e02[_0x1950ba];return _0x4d4d2a;};'use strict';var client=require('../client');exports[_0x20e0('0x0')]=function(_0x5ef911){return client['Request'](_0x20e0('0x1'),{'body':_0x5ef911,'log':_0x20e0('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 030b1c9..47b9ec6 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x53a3cc,_0x3d7944){var _0x2832da=function(_0x2306ca){while(--_0x2306ca){_0x53a3cc['push'](_0x53a3cc['shift']());}};_0x2832da(++_0x3d7944);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x2aac8a,_0x67b289){var _0xd36db9=function(_0xd2ce12){while(--_0xd2ce12){_0x2aac8a['push'](_0x2aac8a['shift']());}};_0xd36db9(++_0x67b289);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 06f954b..68c6961 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0xbc86fc,_0x1bb24d){var _0x549976=function(_0x530436){while(--_0x530436){_0xbc86fc['push'](_0xbc86fc['shift']());}};_0x549976(++_0x1bb24d);}(_0x008c,0x188));var _0xc008=function(_0x4a1835,_0xe4a237){_0x4a1835=_0x4a1835-0x0;var _0x203f1b=_0x008c[_0x4a1835];return _0x203f1b;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xedd9,0xfc));var _0x9edd=function(_0x214d3f,_0x499389){_0x214d3f=_0x214d3f-0x0;var _0x5561d4=_0xedd9[_0x214d3f];return _0x5561d4;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6266715..b00f8e1 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(_0x519881,_0x1ef7ca){var _0x43fca6=function(_0x266ebd){while(--_0x266ebd){_0x519881['push'](_0x519881['shift']());}};_0x43fca6(++_0x1ef7ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x59bce1,_0x2f3f07){var _0x12dd2d=function(_0x5c19a6){while(--_0x5c19a6){_0x59bce1['push'](_0x59bce1['shift']());}};_0x12dd2d(++_0x2f3f07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 9ace2a6..4563b51 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 _0xb511=['../client','update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x1581bd,_0xa63592){var _0x5e7a4e=function(_0x2f9485){while(--_0x2f9485){_0x1581bd['push'](_0x1581bd['shift']());}};_0x5e7a4e(++_0xa63592);}(_0xb511,0x165));var _0x1b51=function(_0x212d6b,_0x183614){_0x212d6b=_0x212d6b-0x0;var _0x3e4293=_0xb511[_0x212d6b];return _0x3e4293;};'use strict';var client=require(_0x1b51('0x0'));exports[_0x1b51('0x1')]=function(_0x15178f,_0x56baac){return client[_0x1b51('0x2')](_0x1b51('0x3'),{'body':_0x56baac,'options':{'where':{'id':_0x15178f}},'log':'updateWhatsappInteraction'});};exports[_0x1b51('0x4')]=function(_0x439eca,_0x110e7f){return client['Request'](_0x1b51('0x5'),{'body':_0x110e7f,'options':{'where':{'id':_0x439eca}},'log':_0x1b51('0x6')});}; \ No newline at end of file +var _0xdf55=['Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf55,0x83));var _0x5df5=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0xdf55[_0xb24fad];return _0x173226;};'use strict';var client=require(_0x5df5('0x0'));exports[_0x5df5('0x1')]=function(_0x4d02f3,_0x20db42){return client[_0x5df5('0x2')]('UpdateWhatsappInteraction',{'body':_0x20db42,'options':{'where':{'id':_0x4d02f3}},'log':_0x5df5('0x3')});};exports[_0x5df5('0x4')]=function(_0x381a4c,_0x521007){return client[_0x5df5('0x2')](_0x5df5('0x5'),{'body':_0x521007,'options':{'where':{'id':_0x381a4c}},'log':_0x5df5('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index f59f060..d6e1711 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 _0x42c9=['Request','CreateWhatsappMessage','create'];(function(_0x286279,_0x5f4e7c){var _0x315fb=function(_0x4ee0f7){while(--_0x4ee0f7){_0x286279['push'](_0x286279['shift']());}};_0x315fb(++_0x5f4e7c);}(_0x42c9,0x158));var _0x942c=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0x42c9[_0x1b25c1];return _0x1e4447;};'use strict';var client=require('../client');exports[_0x942c('0x0')]=function(_0x2c72a3){return client[_0x942c('0x1')](_0x942c('0x2'),{'body':_0x2c72a3,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x2c94=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x4038cf,_0x5a8a72){var _0x3027db=function(_0x3251b8){while(--_0x3251b8){_0x4038cf['push'](_0x4038cf['shift']());}};_0x3027db(++_0x5a8a72);}(_0x2c94,0xc3));var _0x42c9=function(_0x3e1205,_0x492e5e){_0x3e1205=_0x3e1205-0x0;var _0x45cf77=_0x2c94[_0x3e1205];return _0x45cf77;};'use strict';var client=require(_0x42c9('0x0'));exports[_0x42c9('0x1')]=function(_0x367110){return client[_0x42c9('0x2')](_0x42c9('0x3'),{'body':_0x367110,'log':_0x42c9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 0f37ad5..5d98451 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 _0xd06e=['../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause'];(function(_0x570673,_0x47bf60){var _0x43fbad=function(_0x2caf12){while(--_0x2caf12){_0x570673['push'](_0x570673['shift']());}};_0x43fbad(++_0x47bf60);}(_0xd06e,0x155));var _0xed06=function(_0x2a418e,_0x20ea05){_0x2a418e=_0x2a418e-0x0;var _0x345aa7=_0xd06e[_0x2a418e];return _0x345aa7;};'use strict';var client=require(_0xed06('0x0'));exports[_0xed06('0x1')]=function(){return function(){return client[_0xed06('0x2')](_0xed06('0x3'),{'options':{'raw':![],'attributes':['id',_0xed06('0x4'),_0xed06('0x5'),_0xed06('0x6')],'include':[{'model':_0xed06('0x7'),'as':_0xed06('0x8'),'attributes':['id',_0xed06('0x4'),_0xed06('0x9'),_0xed06('0xa')]}]},'log':_0xed06('0x1')});};}; \ No newline at end of file +var _0xd4b4=['../client','getWhatsappQueues','Request','name','timeout','strategy','User','online'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd4b4,0x148));var _0x4d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4d4b('0x0'));exports[_0x4d4b('0x1')]=function(){return function(){return client[_0x4d4b('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x4d4b('0x3'),_0x4d4b('0x4'),_0x4d4b('0x5')],'include':[{'model':_0x4d4b('0x6'),'as':'Agents','attributes':['id',_0x4d4b('0x3'),_0x4d4b('0x7'),'whatsappPause']}]},'log':_0x4d4b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 280be67..ac6e809 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 _0xb96c=['update','DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x1eb5b4,_0x31358a){var _0x434394=function(_0x2b3a45){while(--_0x2b3a45){_0x1eb5b4['push'](_0x1eb5b4['shift']());}};_0x434394(++_0x31358a);}(_0xb96c,0xc0));var _0xcb96=function(_0x395327,_0x3a7b63){_0x395327=_0x395327-0x0;var _0x2774b7=_0xb96c[_0x395327];return _0x2774b7;};'use strict';var client=require(_0xcb96('0x0'));exports[_0xcb96('0x1')]=function(_0x107b3b){return client[_0xcb96('0x2')](_0xcb96('0x3'),{'body':_0x107b3b,'log':_0xcb96('0x3')});};exports[_0xcb96('0x4')]=function(_0x4b6e56,_0x986814){return client[_0xcb96('0x2')]('UpdateWhatsappQueueReport',{'body':_0x986814,'options':{'where':{'uniqueid':_0x4b6e56},'order':[['id',_0xcb96('0x5')]],'limit':0x1},'log':_0xcb96('0x6')});}; \ No newline at end of file +var _0x5c5d=['Request','DESC','UpdateWhatsappQueueReport','../client','create','CreateWhatsappQueueReport','update'];(function(_0x873d48,_0x3cf3c0){var _0x50c8ca=function(_0x954fd0){while(--_0x954fd0){_0x873d48['push'](_0x873d48['shift']());}};_0x50c8ca(++_0x3cf3c0);}(_0x5c5d,0xce));var _0xd5c5=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5c5d[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0xd5c5('0x0'));exports[_0xd5c5('0x1')]=function(_0x4ab29e){return client['Request']('CreateWhatsappQueueReport',{'body':_0x4ab29e,'log':_0xd5c5('0x2')});};exports[_0xd5c5('0x3')]=function(_0x2fae26,_0x1b9c13){return client[_0xd5c5('0x4')]('UpdateWhatsappQueueReport',{'body':_0x1b9c13,'options':{'where':{'uniqueid':_0x2fae26},'order':[['id',_0xd5c5('0x5')]],'limit':0x1},'log':_0xd5c5('0x6')});}; \ 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 e2a2e2c..1dbc687 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 _0x20ad=['lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','atimeout','START:%s','info','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','complete','close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate'];(function(_0x44d304,_0x355a59){var _0x50ac22=function(_0x4cc1a9){while(--_0x4cc1a9){_0x44d304['push'](_0x44d304['shift']());}};_0x50ac22(++_0x355a59);}(_0x20ad,0x13a));var _0xd20a=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x20ad[_0x59c301];return _0x3866b9;};'use strict';var schema=require(_0xd20a('0x0'));var _=require(_0xd20a('0x1'));var util=require(_0xd20a('0x2'));var seqqueue=require(_0xd20a('0x3'));var logger=require('../../../../config/logger')(_0xd20a('0x4'));var strategy=require(_0xd20a('0x5'));var queue=schema({'name':{'type':_0xd20a('0x6'),'required':!![],'message':_0xd20a('0x7')},'timeout':{'type':_0xd20a('0x8'),'message':_0xd20a('0x9')}});function writeLog(_0x44290f,_0x26be33,_0x1c71e){return logger['info'](util[_0xd20a('0xa')](_0xd20a('0xb'),_0x44290f,_0x26be33['name'],_0x1c71e));}function handleFindAgent(_0x2a5a70){return function(_0x192155){return _0x192155[_0xd20a('0xc')][_0xd20a('0xd')]()===_0x2a5a70[_0xd20a('0xd')]();};}exports[_0xd20a('0xe')]=function(_0x2996a0,_0x227e01,_0x480d43,_0x2973da){return function(_0x5c12a0){try{var _0x424c73={'name':_0x227e01[0x0],'timeout':_0x227e01[0x1]};var _0x4a5f11=queue[_0xd20a('0x0')](_0x424c73,{'typecast':!![]});if(_0x4a5f11[_0xd20a('0xf')]){logger[_0xd20a('0x10')](_0xd20a('0x11'),_0x2996a0,_[_0xd20a('0x12')](_0x4a5f11,_0xd20a('0x13'))[_0xd20a('0x14')](',\x20'));_0x5c12a0[_0xd20a('0x15')]();}else{var _0x5d7cef=_[_0xd20a('0x16')](_0x480d43[_0xd20a('0x17')],handleFindAgent(_0x424c73[_0xd20a('0xc')]));if(_0x5d7cef){var _0x5b53ce=(_0x424c73[_0xd20a('0x18')]||0xa)*0x3e8;var _0x194408,_0x1286f1;var _0x1dde7d=seqqueue['createQueue'](_0x5b53ce);_0x1dde7d['id']=_0x2996a0;_0x1dde7d[_0xd20a('0x19')]=_0x5b53ce;_0x1dde7d['channel']=_0x2973da['channel'];writeLog(_0x2996a0,_0x5d7cef,util[_0xd20a('0xa')](_0xd20a('0x1a'),_0x5b53ce));_0x480d43['rules'][_0x2996a0]['on']('end',function(){logger[_0xd20a('0x1b')](_0xd20a('0x1c'),_0x2996a0);clearTimeout(_0x1286f1);_0x1286f1=undefined;_0x1dde7d['close']();if(_0x480d43['rules'][_0x2996a0]){delete _0x480d43[_0xd20a('0x1d')][_0x2996a0];}_0x5c12a0['stop']();});_0x480d43[_0xd20a('0x1d')][_0x2996a0]['on'](_0xd20a('0x1e'),function(){if(_0x480d43[_0xd20a('0x1d')][_0x2996a0]){delete _0x480d43[_0xd20a('0x1d')][_0x2996a0];}});_0x1286f1=setTimeout(function(){logger[_0xd20a('0x1b')]('[%s][AGENT]\x20ROUTING\x20END',_0x2996a0);clearTimeout(_0x1286f1);_0x1dde7d[_0xd20a('0x1f')]();_0x5c12a0['next']();},_0x5b53ce);strategy[_0xd20a('0x20')](_0x1dde7d,_0x5d7cef,_0x480d43,_0x2973da);}else{logger[_0xd20a('0x10')](_0xd20a('0x21'),_0x2996a0,_0x424c73[_0xd20a('0xc')]);_0x5c12a0[_0xd20a('0x15')]();}}}catch(_0x146aba){console['log'](_0x146aba);logger['error']('[%s][QUEUE]\x20%s',_0x2996a0,_0x146aba[_0xd20a('0x22')]);_0x5c12a0[_0xd20a('0x15')]();}};}; \ No newline at end of file +var _0x255f=['agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','log','[%s][QUEUE]\x20%s','stack','validate','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','length','[%s][AGENT]\x20%s','join','find'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x255f,0xea));var _0xf255=function(_0x467467,_0x53b464){_0x467467=_0x467467-0x0;var _0x2d8d3d=_0x255f[_0x467467];return _0x2d8d3d;};'use strict';var schema=require(_0xf255('0x0'));var _=require('lodash');var util=require(_0xf255('0x1'));var seqqueue=require('seq-queue');var logger=require(_0xf255('0x2'))(_0xf255('0x3'));var strategy=require(_0xf255('0x4'));var queue=schema({'name':{'type':_0xf255('0x5'),'required':!![],'message':_0xf255('0x6')},'timeout':{'type':_0xf255('0x7'),'message':_0xf255('0x8')}});function writeLog(_0x4d445a,_0x546964,_0x39e504){return logger[_0xf255('0x9')](util[_0xf255('0xa')](_0xf255('0xb'),_0x4d445a,_0x546964['name'],_0x39e504));}function handleFindAgent(_0x6731a5){return function(_0x32177b){return _0x32177b[_0xf255('0xc')]['toLowerCase']()===_0x6731a5['toLowerCase']();};}exports[_0xf255('0xd')]=function(_0x1e0f0c,_0x510284,_0x14d24c,_0x53b6a5){return function(_0x593fe){try{var _0x45d3b9={'name':_0x510284[0x0],'timeout':_0x510284[0x1]};var _0x51d9ef=queue[_0xf255('0x0')](_0x45d3b9,{'typecast':!![]});if(_0x51d9ef[_0xf255('0xe')]){logger['error'](_0xf255('0xf'),_0x1e0f0c,_['map'](_0x51d9ef,'message')[_0xf255('0x10')](',\x20'));_0x593fe['stop']();}else{var _0x1d2708=_[_0xf255('0x11')](_0x14d24c[_0xf255('0x12')],handleFindAgent(_0x45d3b9[_0xf255('0xc')]));if(_0x1d2708){var _0x4680de=(_0x45d3b9[_0xf255('0x13')]||0xa)*0x3e8;var _0x4e1b4c,_0x46bdab;var _0x45cf9c=seqqueue[_0xf255('0x14')](_0x4680de);_0x45cf9c['id']=_0x1e0f0c;_0x45cf9c['atimeout']=_0x4680de;_0x45cf9c[_0xf255('0x15')]=_0x53b6a5[_0xf255('0x15')];writeLog(_0x1e0f0c,_0x1d2708,util[_0xf255('0xa')](_0xf255('0x16'),_0x4680de));_0x14d24c[_0xf255('0x17')][_0x1e0f0c]['on'](_0xf255('0x18'),function(){logger[_0xf255('0x9')](_0xf255('0x19'),_0x1e0f0c);clearTimeout(_0x46bdab);_0x46bdab=undefined;_0x45cf9c[_0xf255('0x1a')]();if(_0x14d24c[_0xf255('0x17')][_0x1e0f0c]){delete _0x14d24c[_0xf255('0x17')][_0x1e0f0c];}_0x593fe['stop']();});_0x14d24c[_0xf255('0x17')][_0x1e0f0c]['on'](_0xf255('0x1b'),function(){if(_0x14d24c[_0xf255('0x17')][_0x1e0f0c]){delete _0x14d24c[_0xf255('0x17')][_0x1e0f0c];}});_0x46bdab=setTimeout(function(){logger[_0xf255('0x9')](_0xf255('0x1c'),_0x1e0f0c);clearTimeout(_0x46bdab);_0x45cf9c['close']();_0x593fe[_0xf255('0x1d')]();},_0x4680de);strategy['agent'](_0x45cf9c,_0x1d2708,_0x14d24c,_0x53b6a5);}else{logger[_0xf255('0x1e')](_0xf255('0x1f'),_0x1e0f0c,_0x45d3b9[_0xf255('0xc')]);_0x593fe[_0xf255('0x20')]();}}}catch(_0xaf199d){console[_0xf255('0x21')](_0xaf199d);logger[_0xf255('0x1e')](_0xf255('0x22'),_0x1e0f0c,_0xaf199d[_0xf255('0x23')]);_0x593fe['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index c659908..bd69131 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 _0x42b8=['../../rpc/faxMessage','consequence','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','interaction','phone','chat','ChatWebsiteId','account','upperFirst','body','getMustacheRender','Message','create','then','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','error','amazonlex','providerName','providerResponse','stringify','Failed','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x272282,_0x2e94a0){var _0xedf511=function(_0x5d1ab6){while(--_0x5d1ab6){_0x272282['push'](_0x272282['shift']());}};_0xedf511(++_0x2e94a0);}(_0x42b8,0xba));var _0x842b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x42b8[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x842b('0x0'));var moment=require(_0x842b('0x1'));var AWS=require(_0x842b('0x2'));var utils=require(_0x842b('0x3'));var logger=require(_0x842b('0x4'))(_0x842b('0x5'));var rpc={'chatMessage':require(_0x842b('0x6')),'openchannelMessage':require(_0x842b('0x7')),'mailMessage':require(_0x842b('0x8')),'smsMessage':require(_0x842b('0x9')),'faxMessage':require(_0x842b('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x842b('0xb')]=function(_0x4bc7e2,_0x22869f){return function(_0x49562d){try{if(!_['isNil'](this['interaction'][_0x842b('0xc')])){logger[_0x842b('0xd')](_0x842b('0xe'),_0x4bc7e2,_0x842b('0xf'));return _0x49562d[_0x842b('0x10')]();}var _0x258c6e={'ContactId':this['contact']['id'],'sentAt':moment()[_0x842b('0x11')](_0x842b('0x12')),'direction':_0x842b('0x13')};if(this['channel']===_0x842b('0x14')||this[_0x842b('0x15')]===_0x842b('0x16')){_0x258c6e['phone']=this[_0x842b('0x17')][_0x842b('0x18')];}var _0x20cf6a=this[_0x842b('0x15')];if(_0x20cf6a===_0x842b('0x19')){_0x258c6e[_0x842b('0x1a')]=this[_0x842b('0x1b')]['id'];}else{_0x258c6e[_[_0x842b('0x1c')](_0x20cf6a)+'AccountId']=this['account']['id'];}_0x258c6e[_[_0x842b('0x1c')](_0x20cf6a)+'InteractionId']=this[_0x842b('0x17')]['id'];if(this[_0x842b('0x17')]['created']){var _0x2df252=_0x22869f[0x4];if(!_['isEmpty'](_0x2df252)){_0x258c6e[_0x842b('0x1d')]=utils[_0x842b('0x1e')](_0x2df252,this);return rpc[_0x20cf6a+_0x842b('0x1f')][_0x842b('0x20')](_0x258c6e)[_0x842b('0x21')](function(_0x16452c){logger[_0x842b('0xd')](_0x842b('0xe'),_0x4bc7e2,_0x258c6e[_0x842b('0x1d')]);})['catch'](function(_0x10770b){logger['error']('[%s][AMAZONLEX]\x20%s',_0x4bc7e2,JSON['stringify'](_0x10770b));})[_0x842b('0x22')](function(){logger[_0x842b('0xd')](_0x842b('0x23'),_0x4bc7e2);_0x49562d[_0x842b('0x24')]();});}else{logger[_0x842b('0xd')](_0x842b('0x25'),_0x4bc7e2);_0x49562d[_0x842b('0x24')]();}}else{var _0x55e9ea=this;var _0x457eee=new AWS['LexRuntime']({'accessKeyId':_0x22869f[0x0],'secretAccessKey':_0x22869f[0x1],'region':_0x22869f[0x2]});var _0x28feb9={'botAlias':_0x842b('0x26'),'botName':_0x22869f[0x3],'inputText':this[_0x842b('0x27')][_0x842b('0x1d')],'userId':this[_0x842b('0x15')]+':'+this['interaction']['id'][_0x842b('0x28')]()};_0x457eee[_0x842b('0x29')](_0x28feb9,function(_0x560191,_0x228dc4){if(_0x560191){logger[_0x842b('0x2a')](_0x842b('0xe'),_0x4bc7e2,_0x560191[_0x842b('0x27')]);_0x49562d['next']();}else if(_0x228dc4&&_0x228dc4['message']){_0x55e9ea[_0x842b('0x1d')][_0x842b('0x2b')]=_0x228dc4;_0x258c6e[_0x842b('0x1d')]=_0x228dc4[_0x842b('0x27')];_0x258c6e[_0x842b('0x2c')]=_0x842b('0x2b');_0x258c6e[_0x842b('0x2d')]=JSON[_0x842b('0x2e')](_0x228dc4);return rpc[_0x20cf6a+_0x842b('0x1f')][_0x842b('0x20')](_0x258c6e)[_0x842b('0x21')](function(_0x4c60cd){logger['info'](_0x842b('0xe'),_0x4bc7e2,_0x258c6e[_0x842b('0x1d')]);if(_0x228dc4['dialogState']==_0x842b('0x2f')){_0x49562d[_0x842b('0x10')]();}else{_0x49562d[_0x842b('0x24')]();}})[_0x842b('0x30')](function(_0x58a7ac){logger[_0x842b('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x4bc7e2,JSON[_0x842b('0x2e')](_0x58a7ac));_0x49562d[_0x842b('0x10')]();});}else{_0x49562d[_0x842b('0x10')]();}});}}catch(_0x578844){logger['error']('[%s][AMAZONLEX]\x20%s',_0x4bc7e2,JSON[_0x842b('0x2e')](_0x578844));_0x49562d['stop']();}};}; \ No newline at end of file +var _0x123d=['moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','sms','channel','whatsapp','phone','interaction','chat','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','amazonlex','providerName','providerResponse','then','dialogState','Failed','lodash'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x123d,0x148));var _0xd123=function(_0x590dd0,_0x393441){_0x590dd0=_0x590dd0-0x0;var _0x333036=_0x123d[_0x590dd0];return _0x333036;};'use strict';var _=require(_0xd123('0x0'));var moment=require(_0xd123('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xd123('0x2'))(_0xd123('0x3'));var rpc={'chatMessage':require(_0xd123('0x4')),'openchannelMessage':require(_0xd123('0x5')),'mailMessage':require(_0xd123('0x6')),'smsMessage':require(_0xd123('0x7')),'faxMessage':require(_0xd123('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xd123('0x9')]=function(_0x347d9b,_0x252d62){return function(_0x2a6cdd){try{if(!_[_0xd123('0xa')](this['interaction']['UserId'])){logger[_0xd123('0xb')](_0xd123('0xc'),_0x347d9b,_0xd123('0xd'));return _0x2a6cdd[_0xd123('0xe')]();}var _0x5be1c0={'ContactId':this[_0xd123('0xf')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xd123('0x10')};if(this['channel']===_0xd123('0x11')||this[_0xd123('0x12')]===_0xd123('0x13')){_0x5be1c0[_0xd123('0x14')]=this[_0xd123('0x15')][_0xd123('0x14')];}var _0xd02464=this[_0xd123('0x12')];if(_0xd02464===_0xd123('0x16')){_0x5be1c0['ChatWebsiteId']=this[_0xd123('0x17')]['id'];}else{_0x5be1c0[_[_0xd123('0x18')](_0xd02464)+'AccountId']=this['account']['id'];}_0x5be1c0[_[_0xd123('0x18')](_0xd02464)+_0xd123('0x19')]=this[_0xd123('0x15')]['id'];if(this['interaction'][_0xd123('0x1a')]){var _0x5ca8dc=_0x252d62[0x4];if(!_[_0xd123('0x1b')](_0x5ca8dc)){_0x5be1c0[_0xd123('0x1c')]=utils[_0xd123('0x1d')](_0x5ca8dc,this);return rpc[_0xd02464+_0xd123('0x1e')][_0xd123('0x1f')](_0x5be1c0)['then'](function(_0x18718e){logger[_0xd123('0xb')](_0xd123('0xc'),_0x347d9b,_0x5be1c0[_0xd123('0x1c')]);})[_0xd123('0x20')](function(_0x2d0f22){logger[_0xd123('0x21')](_0xd123('0xc'),_0x347d9b,JSON[_0xd123('0x22')](_0x2d0f22));})[_0xd123('0x23')](function(){logger[_0xd123('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x347d9b);_0x2a6cdd[_0xd123('0x24')]();});}else{logger['info'](_0xd123('0x25'),_0x347d9b);_0x2a6cdd['stop']();}}else{var _0x2ecc43=this;var _0x2dd25f=new AWS['LexRuntime']({'accessKeyId':_0x252d62[0x0],'secretAccessKey':_0x252d62[0x1],'region':_0x252d62[0x2]});var _0x96f6fc={'botAlias':_0xd123('0x26'),'botName':_0x252d62[0x3],'inputText':this[_0xd123('0x27')][_0xd123('0x1c')],'userId':this[_0xd123('0x12')]+':'+this[_0xd123('0x15')]['id'][_0xd123('0x28')]()};_0x2dd25f['postText'](_0x96f6fc,function(_0x32b61e,_0x258b8a){if(_0x32b61e){logger[_0xd123('0x21')](_0xd123('0xc'),_0x347d9b,_0x32b61e[_0xd123('0x27')]);_0x2a6cdd['next']();}else if(_0x258b8a&&_0x258b8a[_0xd123('0x27')]){_0x2ecc43[_0xd123('0x1c')][_0xd123('0x29')]=_0x258b8a;_0x5be1c0[_0xd123('0x1c')]=_0x258b8a['message'];_0x5be1c0[_0xd123('0x2a')]='amazonlex';_0x5be1c0[_0xd123('0x2b')]=JSON[_0xd123('0x22')](_0x258b8a);return rpc[_0xd02464+_0xd123('0x1e')]['create'](_0x5be1c0)[_0xd123('0x2c')](function(_0x2a76d8){logger['info']('[%s][AMAZONLEX]\x20%s',_0x347d9b,_0x5be1c0['body']);if(_0x258b8a[_0xd123('0x2d')]==_0xd123('0x2e')){_0x2a6cdd[_0xd123('0xe')]();}else{_0x2a6cdd['stop']();}})[_0xd123('0x20')](function(_0x480faa){logger[_0xd123('0x21')](_0xd123('0xc'),_0x347d9b,JSON[_0xd123('0x22')](_0x480faa));_0x2a6cdd['next']();});}else{_0x2a6cdd[_0xd123('0xe')]();}});}}catch(_0x1ca139){logger[_0xd123('0x21')](_0xd123('0xc'),_0x347d9b,JSON['stringify'](_0x1ca139));_0x2a6cdd[_0xd123('0x24')]();}};}; \ 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 9dc7d63..61d7824 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 _0x62ec=['../../rpc/whatsappInteraction','../../mailRpc','consequence','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','created','interaction','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','getMustacheRender','from','message','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','InteractionId','Message','service','host','port','secure','Smtp','authentication','auth','user','pass','inReplyTo','','replace','';_0x190573[_0xc62e('0x3b')]={'Auto-Submitted':_0xc62e('0x3c'),'X-Auto-Response-Suppress':_0xc62e('0x3d'),'Precedence':'auto_reply'};return mailRpc[_0xc62e('0x3e')](_0x1dda5c,_0x190573)[_0xc62e('0x3f')](function(_0x46a3e7){logger[_0xc62e('0x11')](_0xc62e('0x40'),_0x344f9f);_0x190573[_0xc62e('0x41')]=_0x46a3e7[_0xc62e('0x21')][_0xc62e('0x41')];return rpc[_0x254468+'Message'][_0xc62e('0x42')](_0x190573);})[_0xc62e('0x3f')](function(_0x1b6218){logger[_0xc62e('0x11')](_0xc62e('0x12'),_0x344f9f,JSON[_0xc62e('0x43')](_0x1b6218));})['catch'](function(_0x3263e4){logger[_0xc62e('0x44')]('[RPC][%s][AUTOREPLY]\x20%s',_0x344f9f,JSON[_0xc62e('0x43')](_0x3263e4));})['finally'](function(){Promise[_0xc62e('0x45')]()['then'](function(){if(_0x46dacc[0x0]!=='2'||_0xc292e['autoreplyExecuted'])return;return rpc[_0x254468+_0xc62e('0x46')][_0xc62e('0x47')](_0xc292e['id'],{'autoreplyExecuted':!![]})[_0xc62e('0x3f')](function(_0x40c431){logger[_0xc62e('0x11')](_0xc62e('0x48'),_0x344f9f,JSON[_0xc62e('0x43')](_0x40c431));})[_0xc62e('0x49')](function(_0x1b4a73){logger['error'](_0xc62e('0x4a'),_0x344f9f,JSON[_0xc62e('0x43')](_0x1b4a73));});})[_0xc62e('0x3f')](function(){_0x1776e3[_0xc62e('0x14')]();});});}else{return rpc[this[_0xc62e('0x1d')]+_0xc62e('0x2d')][_0xc62e('0x42')](_0x190573)['then'](function(_0x56a91c){logger[_0xc62e('0x11')]('[%s][AUTOREPLY]\x20%s',_0x344f9f,_0x190573[_0xc62e('0xf')]);})['catch'](function(_0x33c8b2){logger[_0xc62e('0x44')](_0xc62e('0x12'),_0x344f9f,JSON['stringify'](_0x33c8b2));})[_0xc62e('0x4b')](function(){Promise[_0xc62e('0x45')]()[_0xc62e('0x3f')](function(){if(_0x46dacc[0x0]!=='2'||_0xc292e[_0xc62e('0x17')])return;return rpc[_0x254468+_0xc62e('0x46')][_0xc62e('0x47')](_0xc292e['id'],{'autoreplyExecuted':!![]})['then'](function(_0x41bcd8){logger[_0xc62e('0x11')](_0xc62e('0x48'),_0x344f9f,JSON[_0xc62e('0x43')](_0x41bcd8));})['catch'](function(_0x5be12b){logger[_0xc62e('0x44')](_0xc62e('0x4a'),_0x344f9f,JSON['stringify'](_0x5be12b));});})[_0xc62e('0x3f')](function(){_0x1776e3[_0xc62e('0x14')]();});});}}}catch(_0x3d1f54){logger[_0xc62e('0x44')](_0xc62e('0x12'),_0x344f9f,JSON[_0xc62e('0x43')](_0x3d1f54));_0x1776e3[_0xc62e('0x4c')]();}};}; \ No newline at end of file +var _0xdf1a=['authentication','auth','user','messageId','html','','','headers','All','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','getMustacheRender','body','message','from','channel','mail','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','InteractionId','interaction','Smtp','service','host','port','secure'];(function(_0xeeb6dd,_0x3e5f7b){var _0x95d347=function(_0x48de04){while(--_0x48de04){_0xeeb6dd['push'](_0xeeb6dd['shift']());}};_0x95d347(++_0x3e5f7b);}(_0xdf1a,0xb3));var _0xadf1=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0xdf1a[_0x118afa];return _0x167d76;};'use strict';var _=require('lodash');var moment=require(_0xadf1('0x0'));var utils=require(_0xadf1('0x1'));var logger=require(_0xadf1('0x2'))('routing');var rpc={'chatMessage':require(_0xadf1('0x3')),'openchannelMessage':require(_0xadf1('0x4')),'mailMessage':require(_0xadf1('0x5')),'smsMessage':require(_0xadf1('0x6')),'faxMessage':require(_0xadf1('0x7')),'whatsappMessage':require(_0xadf1('0x8')),'chatInteraction':require(_0xadf1('0x9')),'openchannelInteraction':require(_0xadf1('0xa')),'mailInteraction':require(_0xadf1('0xb')),'smsInteraction':require(_0xadf1('0xc')),'faxInteraction':require(_0xadf1('0xd')),'whatsappInteraction':require(_0xadf1('0xe'))};var mailRpc=require(_0xadf1('0xf'));exports[_0xadf1('0x10')]=function(_0x5ed46a,_0x17fc09,_0x470130,_0x5823f7){return function(_0x1038ae){try{var _0x467219=this['channel'];if(_0x467219==='mail'&&_0x5823f7['body'][_0xadf1('0x11')]){logger[_0xadf1('0x12')](_0xadf1('0x13'),_0x5ed46a,_0xadf1('0x14'));return _0x1038ae[_0xadf1('0x15')]();}if(_0x17fc09[0x0]==='1'&&(_[_0xadf1('0x16')](this['interaction']['created'])||!this['interaction']['created'])){logger[_0xadf1('0x12')](_0xadf1('0x13'),_0x5ed46a,_0xadf1('0x17'));return _0x1038ae[_0xadf1('0x15')]();}if(_0x17fc09[0x0]==='2'&&this['interaction'][_0xadf1('0x18')]){logger[_0xadf1('0x12')](_0xadf1('0x19'),_0x5ed46a,_0xadf1('0x1a'));return _0x1038ae[_0xadf1('0x15')]();}var _0x5b42ba={'ContactId':this[_0xadf1('0x1b')]['id'],'sentAt':moment()[_0xadf1('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xadf1('0x1d')};if(this['channel']==='mail'){_0x5b42ba['body']=utils[_0xadf1('0x1e')](_0x17fc09[0x2],this);}else{_0x5b42ba[_0xadf1('0x1f')]=utils[_0xadf1('0x1e')](_0x17fc09[0x1],this);}if(this[_0xadf1('0x20')]){_0x5b42ba['to']=this[_0xadf1('0x20')][_0xadf1('0x21')]||'';if(this[_0xadf1('0x22')]===_0xadf1('0x23')&&_0x17fc09[0x1]==='1'){_0x5b42ba['cc']=this[_0xadf1('0x20')]['cc']||'';}_0x5b42ba[_0xadf1('0x21')]=this[_0xadf1('0x20')]['to']||'';_0x5b42ba[_0xadf1('0x24')]=this[_0xadf1('0x20')][_0xadf1('0x24')]||'';_0x5b42ba[_0xadf1('0x25')]=!![];if(this[_0xadf1('0x20')][_0xadf1('0x26')]){_0x5b42ba[_0xadf1('0x26')]='';_0x5b42ba[_0xadf1('0x26')]+=_['startsWith'](this[_0xadf1('0x20')]['subject'],_0xadf1('0x27'))?'':_0xadf1('0x28');_0x5b42ba[_0xadf1('0x26')]+=this['message'][_0xadf1('0x26')];}}if(this['channel']===_0xadf1('0x29')){_0x5b42ba[_0xadf1('0x2a')]=this[_0xadf1('0x2b')]['id'];}else{_0x5b42ba[_['upperFirst'](this[_0xadf1('0x22')])+_0xadf1('0x2c')]=this['account']['id'];}_0x5b42ba[_['upperFirst'](this['channel'])+_0xadf1('0x2d')]=this[_0xadf1('0x2e')]['id'];var _0x58e042=this['interaction'];if(rpc[this[_0xadf1('0x22')]+'Message']){if(this[_0xadf1('0x22')]===_0xadf1('0x23')){var _0x4e9716={'tls':{'rejectUnauthorized':![]}};if(this[_0xadf1('0x2b')][_0xadf1('0x2f')][_0xadf1('0x30')]){_0x4e9716['service']=this[_0xadf1('0x2b')][_0xadf1('0x2f')]['service'];}else{_0x4e9716[_0xadf1('0x31')]=this['account']['Smtp'][_0xadf1('0x31')];_0x4e9716[_0xadf1('0x32')]=this[_0xadf1('0x2b')][_0xadf1('0x2f')][_0xadf1('0x32')];_0x4e9716[_0xadf1('0x33')]=this[_0xadf1('0x2b')][_0xadf1('0x2f')][_0xadf1('0x33')];}if(this[_0xadf1('0x2b')][_0xadf1('0x2f')][_0xadf1('0x34')]){_0x4e9716[_0xadf1('0x35')]={'user':this['account']['Smtp'][_0xadf1('0x36')],'pass':this[_0xadf1('0x2b')][_0xadf1('0x2f')]['pass']};}_0x5b42ba['inReplyTo']=this[_0xadf1('0x20')][_0xadf1('0x37')];_0x5b42ba[_0xadf1('0x38')]=_0xadf1('0x39')+_['replace'](_0x5b42ba[_0xadf1('0x1f')],_0xadf1('0x3a'),_0xadf1('0x3b'))+_0xadf1('0x3c');_0x5b42ba[_0xadf1('0x3d')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xadf1('0x3e'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x4e9716,_0x5b42ba)[_0xadf1('0x3f')](function(_0x4347ad){logger[_0xadf1('0x12')](_0xadf1('0x40'),_0x5ed46a);_0x5b42ba[_0xadf1('0x37')]=_0x4347ad[_0xadf1('0x20')][_0xadf1('0x37')];return rpc[_0x467219+_0xadf1('0x41')][_0xadf1('0x42')](_0x5b42ba);})['then'](function(_0x318717){logger['info'](_0xadf1('0x13'),_0x5ed46a,JSON[_0xadf1('0x43')](_0x318717));})[_0xadf1('0x44')](function(_0x13f3c0){logger[_0xadf1('0x45')](_0xadf1('0x46'),_0x5ed46a,JSON[_0xadf1('0x43')](_0x13f3c0));})[_0xadf1('0x47')](function(){Promise[_0xadf1('0x48')]()[_0xadf1('0x3f')](function(){if(_0x17fc09[0x0]!=='2'||_0x58e042[_0xadf1('0x18')])return;return rpc[_0x467219+_0xadf1('0x49')][_0xadf1('0x4a')](_0x58e042['id'],{'autoreplyExecuted':!![]})[_0xadf1('0x3f')](function(_0x1a9468){logger[_0xadf1('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5ed46a,JSON[_0xadf1('0x43')](_0x1a9468));})[_0xadf1('0x44')](function(_0x169969){logger[_0xadf1('0x45')](_0xadf1('0x4b'),_0x5ed46a,JSON[_0xadf1('0x43')](_0x169969));});})[_0xadf1('0x3f')](function(){_0x1038ae['next']();});});}else{return rpc[this[_0xadf1('0x22')]+_0xadf1('0x41')][_0xadf1('0x42')](_0x5b42ba)['then'](function(_0x37d747){logger['info'](_0xadf1('0x13'),_0x5ed46a,_0x5b42ba[_0xadf1('0x1f')]);})['catch'](function(_0x10a65f){logger['error'](_0xadf1('0x13'),_0x5ed46a,JSON[_0xadf1('0x43')](_0x10a65f));})[_0xadf1('0x47')](function(){Promise[_0xadf1('0x48')]()[_0xadf1('0x3f')](function(){if(_0x17fc09[0x0]!=='2'||_0x58e042['autoreplyExecuted'])return;return rpc[_0x467219+_0xadf1('0x49')][_0xadf1('0x4a')](_0x58e042['id'],{'autoreplyExecuted':!![]})['then'](function(_0x2ab90b){logger['info'](_0xadf1('0x19'),_0x5ed46a,JSON[_0xadf1('0x43')](_0x2ab90b));})['catch'](function(_0x213c4e){logger[_0xadf1('0x45')](_0xadf1('0x4b'),_0x5ed46a,JSON[_0xadf1('0x43')](_0x213c4e));});})['then'](function(){_0x1038ae[_0xadf1('0x15')]();});});}}}catch(_0x28c931){logger[_0xadf1('0x45')]('[%s][AUTOREPLY]\x20%s',_0x5ed46a,JSON[_0xadf1('0x43')](_0x28c931));_0x1038ae[_0xadf1('0x4c')]();}};}; \ 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 d9a465a..4692700 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 _0x1579=['[%s][CLOSE]\x20%s','finally','stringify','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','channel','update','interaction','then','error'];(function(_0x27ecaf,_0x5ea6b4){var _0x4b879e=function(_0x589a56){while(--_0x589a56){_0x27ecaf['push'](_0x27ecaf['shift']());}};_0x4b879e(++_0x5ea6b4);}(_0x1579,0x122));var _0x9157=function(_0x28076e,_0x109858){_0x28076e=_0x28076e-0x0;var _0x968f2b=_0x1579[_0x28076e];return _0x968f2b;};'use strict';var moment=require(_0x9157('0x0'));var logger=require(_0x9157('0x1'))(_0x9157('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x9157('0x3')),'smsInteraction':require(_0x9157('0x4')),'mailInteraction':require(_0x9157('0x5')),'faxInteraction':require(_0x9157('0x6')),'whatsappInteraction':require(_0x9157('0x7'))};exports['consequence']=function(_0x5a4fc9,_0xaa170d,_0x1402b6,_0x3d36a3){return function(_0x2c42b3){try{logger[_0x9157('0x8')](_0x9157('0x9'),_0x5a4fc9,_0xaa170d[0x0]);var _0xac08b7={'closed':0x1,'closedAt':moment()[_0x9157('0xa')](_0x9157('0xb')),'closeReason':'system','disposition':_0xaa170d[0x0]};if(rpc[_0x3d36a3['channel']+_0x9157('0xc')]){rpc[_0x3d36a3[_0x9157('0xd')]+'Interaction'][_0x9157('0xe')](_0x3d36a3[_0x9157('0xf')]['id'],_0xac08b7)[_0x9157('0x10')](function(_0x1b0cea){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x5a4fc9,_0x3d36a3['interaction']['id']);})['catch'](function(_0x5a414d){logger[_0x9157('0x11')](_0x9157('0x12'),_0x5a4fc9,JSON['stringify'](_0x5a414d));})[_0x9157('0x13')](function(){_0x2c42b3['stop']();});}}catch(_0x24b45b){logger[_0x9157('0x11')](_0x9157('0x12'),_0x5a4fc9,JSON[_0x9157('0x14')](_0x24b45b));_0x2c42b3[_0x9157('0x15')]();}};}; \ No newline at end of file +var _0x0681=['interaction','then','catch','finally','stop','error','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','Interaction'];(function(_0x514989,_0x2437bb){var _0x132218=function(_0x2c93c2){while(--_0x2c93c2){_0x514989['push'](_0x514989['shift']());}};_0x132218(++_0x2437bb);}(_0x0681,0x15b));var _0x1068=function(_0x2377a3,_0x7b4522){_0x2377a3=_0x2377a3-0x0;var _0x538284=_0x0681[_0x2377a3];return _0x538284;};'use strict';var moment=require(_0x1068('0x0'));var logger=require(_0x1068('0x1'))(_0x1068('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x1068('0x3')),'smsInteraction':require(_0x1068('0x4')),'mailInteraction':require(_0x1068('0x5')),'faxInteraction':require(_0x1068('0x6')),'whatsappInteraction':require(_0x1068('0x7'))};exports[_0x1068('0x8')]=function(_0x1179f1,_0xbba981,_0x2f0b7f,_0x2fe5c5){return function(_0x46a62a){try{logger[_0x1068('0x9')](_0x1068('0xa'),_0x1179f1,_0xbba981[0x0]);var _0x43077d={'closed':0x1,'closedAt':moment()['format'](_0x1068('0xb')),'closeReason':'system','disposition':_0xbba981[0x0]};if(rpc[_0x2fe5c5['channel']+_0x1068('0xc')]){rpc[_0x2fe5c5['channel']+_0x1068('0xc')]['update'](_0x2fe5c5[_0x1068('0xd')]['id'],_0x43077d)[_0x1068('0xe')](function(_0x10c76a){logger[_0x1068('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x1179f1,_0x2fe5c5[_0x1068('0xd')]['id']);})[_0x1068('0xf')](function(_0x490f0b){logger['error']('[%s][CLOSE]\x20%s',_0x1179f1,JSON['stringify'](_0x490f0b));})[_0x1068('0x10')](function(){_0x46a62a[_0x1068('0x11')]();});}}catch(_0x5b8d04){logger[_0x1068('0x12')](_0x1068('0x13'),_0x1179f1,JSON['stringify'](_0x5b8d04));_0x46a62a[_0x1068('0x11')]();}};}; \ 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 069c5e8..d4efabb 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 _0x8efc=['stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','body','dialogflow','result','fulfillment','providerResponse','metadata','endConversation','apiai-promise','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','getMustacheRender','Message','create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0x511bde,_0x256fe7){var _0x39bbdb=function(_0x2243a7){while(--_0x2243a7){_0x511bde['push'](_0x511bde['shift']());}};_0x39bbdb(++_0x256fe7);}(_0x8efc,0x8f));var _0xc8ef=function(_0x3b9b2e,_0x1d3afe){_0x3b9b2e=_0x3b9b2e-0x0;var _0x3e1a74=_0x8efc[_0x3b9b2e];return _0x3e1a74;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0xc8ef('0x0'));var md5=require('md5');var utils=require(_0xc8ef('0x1'));var logger=require('../../../../config/logger')(_0xc8ef('0x2'));var rpc={'chatMessage':require(_0xc8ef('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc8ef('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc8ef('0x5'))};exports[_0xc8ef('0x6')]=function(_0x1648ac,_0x1f7596){return function(_0x819e70){try{if(!_['isNil'](this[_0xc8ef('0x7')]['UserId'])){logger[_0xc8ef('0x8')](_0xc8ef('0x9'),_0x1648ac,_0xc8ef('0xa'));return _0x819e70[_0xc8ef('0xb')]();}var _0x49f653={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xc8ef('0xc')),'direction':_0xc8ef('0xd')};if(this[_0xc8ef('0xe')]===_0xc8ef('0xf')||this['channel']===_0xc8ef('0x10')){_0x49f653[_0xc8ef('0x11')]=this[_0xc8ef('0x7')][_0xc8ef('0x11')];}var _0x27e741=this[_0xc8ef('0xe')];if(_0x27e741===_0xc8ef('0x12')){_0x49f653[_0xc8ef('0x13')]=this['account']['id'];}else{_0x49f653[_['upperFirst'](_0x27e741)+_0xc8ef('0x14')]=this[_0xc8ef('0x15')]['id'];}_0x49f653[_[_0xc8ef('0x16')](_0x27e741)+_0xc8ef('0x17')]=this[_0xc8ef('0x7')]['id'];if(this[_0xc8ef('0x7')][_0xc8ef('0x18')]){var _0x4026c6=_0x1f7596[0x2];if(!_['isEmpty'](_0x4026c6)){_0x49f653['body']=utils[_0xc8ef('0x19')](_0x4026c6,this);return rpc[_0x27e741+_0xc8ef('0x1a')][_0xc8ef('0x1b')](_0x49f653)[_0xc8ef('0x1c')](function(_0x5a2815){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1648ac,_0x49f653['body']);})[_0xc8ef('0x1d')](function(_0x4ee9df){logger[_0xc8ef('0x1e')](_0xc8ef('0x9'),_0x1648ac,JSON[_0xc8ef('0x1f')](_0x4ee9df));})['finally'](function(){logger[_0xc8ef('0x8')](_0xc8ef('0x20'),_0x1648ac);_0x819e70[_0xc8ef('0x21')]();});}else{logger[_0xc8ef('0x8')](_0xc8ef('0x22'),_0x1648ac);_0x819e70[_0xc8ef('0x21')]();}}else{var _0x1db74d=this;var _0x16bf51=apiai(_0x1f7596[0x0],{'language':_0x1f7596[0x1]||'en'});return _0x16bf51[_0xc8ef('0x23')](this[_0xc8ef('0x24')][_0xc8ef('0x25')],{'sessionId':md5(this[_0xc8ef('0x7')]['id'])})['then'](function(_0x509619){_0x1db74d[_0xc8ef('0x25')][_0xc8ef('0x26')]=_0x509619;_0x49f653[_0xc8ef('0x25')]=_0x509619[_0xc8ef('0x27')][_0xc8ef('0x28')]['speech'];_0x49f653['providerName']=_0xc8ef('0x26');_0x49f653[_0xc8ef('0x29')]=JSON[_0xc8ef('0x1f')](_0x509619);return rpc[_0x27e741+'Message'][_0xc8ef('0x1b')](_0x49f653)[_0xc8ef('0x1c')](function(_0xf285d9){logger[_0xc8ef('0x8')]('[%s][DIALOGFLOW]\x20%s',_0x1648ac,_0x49f653['body']);if(_0x509619[_0xc8ef('0x27')][_0xc8ef('0x2a')][_0xc8ef('0x2b')]){_0x819e70['next']();}else{_0x819e70[_0xc8ef('0x21')]();}})[_0xc8ef('0x1d')](function(_0x199af5){logger['error'](_0xc8ef('0x9'),_0x1648ac,JSON[_0xc8ef('0x1f')](_0x199af5));_0x819e70[_0xc8ef('0xb')]();});})[_0xc8ef('0x1d')](function(_0x17c07c){logger['error'](_0xc8ef('0x9'),_0x1648ac,_0x17c07c['message']);_0x819e70['next']();});}}catch(_0x46745d){logger['error'](_0xc8ef('0x9'),_0x1648ac,JSON['stringify'](_0x46745d));_0x819e70['stop']();}};}; \ No newline at end of file +var _0xb182=['../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then','body','error','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','stringify','metadata','endConversation','catch','moment','apiai-promise','md5','routing','../../rpc/chatMessage'];(function(_0x1de97d,_0x67c46d){var _0x2fa15b=function(_0x54e867){while(--_0x54e867){_0x1de97d['push'](_0x1de97d['shift']());}};_0x2fa15b(++_0x67c46d);}(_0xb182,0x121));var _0x2b18=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0xb182[_0x591cfd];return _0x4d0100;};'use strict';var _=require('lodash');var moment=require(_0x2b18('0x0'));var apiai=require(_0x2b18('0x1'));var md5=require(_0x2b18('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2b18('0x3'));var rpc={'chatMessage':require(_0x2b18('0x4')),'openchannelMessage':require(_0x2b18('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2b18('0x6')),'faxMessage':require(_0x2b18('0x7')),'whatsappMessage':require(_0x2b18('0x8'))};exports[_0x2b18('0x9')]=function(_0x3444c2,_0x25a701){return function(_0xcfa0){try{if(!_['isNil'](this[_0x2b18('0xa')][_0x2b18('0xb')])){logger[_0x2b18('0xc')](_0x2b18('0xd'),_0x3444c2,_0x2b18('0xe'));return _0xcfa0[_0x2b18('0xf')]();}var _0x1311ad={'ContactId':this[_0x2b18('0x10')]['id'],'sentAt':moment()[_0x2b18('0x11')](_0x2b18('0x12')),'direction':_0x2b18('0x13')};if(this[_0x2b18('0x14')]===_0x2b18('0x15')||this['channel']===_0x2b18('0x16')){_0x1311ad[_0x2b18('0x17')]=this['interaction']['phone'];}var _0x310481=this[_0x2b18('0x14')];if(_0x310481===_0x2b18('0x18')){_0x1311ad[_0x2b18('0x19')]=this[_0x2b18('0x1a')]['id'];}else{_0x1311ad[_[_0x2b18('0x1b')](_0x310481)+_0x2b18('0x1c')]=this[_0x2b18('0x1a')]['id'];}_0x1311ad[_['upperFirst'](_0x310481)+_0x2b18('0x1d')]=this[_0x2b18('0xa')]['id'];if(this[_0x2b18('0xa')]['created']){var _0x3f7086=_0x25a701[0x2];if(!_['isEmpty'](_0x3f7086)){_0x1311ad['body']=utils['getMustacheRender'](_0x3f7086,this);return rpc[_0x310481+_0x2b18('0x1e')][_0x2b18('0x1f')](_0x1311ad)[_0x2b18('0x20')](function(_0x149ee0){logger[_0x2b18('0xc')](_0x2b18('0xd'),_0x3444c2,_0x1311ad[_0x2b18('0x21')]);})['catch'](function(_0x349557){logger[_0x2b18('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x3444c2,JSON['stringify'](_0x349557));})[_0x2b18('0x23')](function(){logger[_0x2b18('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3444c2);_0xcfa0[_0x2b18('0x24')]();});}else{logger[_0x2b18('0xc')](_0x2b18('0x25'),_0x3444c2);_0xcfa0[_0x2b18('0x24')]();}}else{var _0x4e45d0=this;var _0x1b1635=apiai(_0x25a701[0x0],{'language':_0x25a701[0x1]||'en'});return _0x1b1635['textRequest'](this[_0x2b18('0x26')][_0x2b18('0x21')],{'sessionId':md5(this[_0x2b18('0xa')]['id'])})['then'](function(_0x571121){_0x4e45d0['body'][_0x2b18('0x27')]=_0x571121;_0x1311ad[_0x2b18('0x21')]=_0x571121[_0x2b18('0x28')][_0x2b18('0x29')][_0x2b18('0x2a')];_0x1311ad[_0x2b18('0x2b')]=_0x2b18('0x27');_0x1311ad[_0x2b18('0x2c')]=JSON[_0x2b18('0x2d')](_0x571121);return rpc[_0x310481+_0x2b18('0x1e')][_0x2b18('0x1f')](_0x1311ad)[_0x2b18('0x20')](function(_0xadfdfd){logger[_0x2b18('0xc')](_0x2b18('0xd'),_0x3444c2,_0x1311ad[_0x2b18('0x21')]);if(_0x571121[_0x2b18('0x28')][_0x2b18('0x2e')][_0x2b18('0x2f')]){_0xcfa0[_0x2b18('0xf')]();}else{_0xcfa0[_0x2b18('0x24')]();}})[_0x2b18('0x30')](function(_0x161709){logger[_0x2b18('0x22')](_0x2b18('0xd'),_0x3444c2,JSON[_0x2b18('0x2d')](_0x161709));_0xcfa0[_0x2b18('0xf')]();});})[_0x2b18('0x30')](function(_0x17c058){logger[_0x2b18('0x22')](_0x2b18('0xd'),_0x3444c2,_0x17c058[_0x2b18('0x26')]);_0xcfa0['next']();});}}catch(_0x3d1ba0){logger[_0x2b18('0x22')](_0x2b18('0xd'),_0x3444c2,JSON[_0x2b18('0x2d')](_0x3d1ba0));_0xcfa0['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 cb1d423..af6451f 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 _0x2929=['ChatWebsiteId','account','upperFirst','InteractionId','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','name','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','catch','stringify','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','error','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','phone','interaction','chat'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2929,0x1ab));var _0x9292=function(_0x5e3fee,_0x3e96e5){_0x5e3fee=_0x5e3fee-0x0;var _0x2b43a6=_0x2929[_0x5e3fee];return _0x2b43a6;};'use strict';var _=require(_0x9292('0x0'));var dialogflow=require(_0x9292('0x1'));var md5=require(_0x9292('0x2'));var moment=require(_0x9292('0x3'));var Promise=require(_0x9292('0x4'));var logger=require(_0x9292('0x5'))(_0x9292('0x6'));var utils=require(_0x9292('0x7'));var rpc={'chatMessage':require(_0x9292('0x8')),'openchannelMessage':require(_0x9292('0x9')),'mailMessage':require(_0x9292('0xa')),'smsMessage':require(_0x9292('0xb')),'faxMessage':require(_0x9292('0xc')),'whatsappMessage':require(_0x9292('0xd'))};function createMessage(_0x37f9c7,_0x2f20e0,_0x527531,_0x2c5d5a){return new Promise(function(_0x45eb88,_0x56c2c2){var _0x4a9981=_[_0x9292('0xe')](_0x527531);_0x4a9981['body']=_0x2c5d5a;return rpc[_0x2f20e0+_0x9292('0xf')][_0x9292('0x10')](_0x4a9981)[_0x9292('0x11')](function(){logger[_0x9292('0x12')](_0x9292('0x13'),_0x37f9c7,_0x4a9981[_0x9292('0x14')]);_0x45eb88();})['catch'](function(_0x101811){logger[_0x9292('0x15')](_0x9292('0x13'),_0x37f9c7,JSON['stringify'](_0x101811));_0x56c2c2(_0x101811);});});}exports[_0x9292('0x16')]=function(_0x2303f3,_0xa3015d){return function(_0x23b9f9){try{if(!_[_0x9292('0x17')](this['interaction'][_0x9292('0x18')])){logger[_0x9292('0x12')](_0x9292('0x13'),_0x2303f3,_0x9292('0x19'));return _0x23b9f9[_0x9292('0x1a')]();}var _0x101e3f={'ContactId':this[_0x9292('0x1b')]['id'],'sentAt':moment()[_0x9292('0x1c')](_0x9292('0x1d')),'direction':'out'};if(this['channel']===_0x9292('0x1e')||this[_0x9292('0x1f')]==='whatsapp'){_0x101e3f[_0x9292('0x20')]=this[_0x9292('0x21')][_0x9292('0x20')];}var _0x5f0c7c=this['channel'];if(_0x5f0c7c===_0x9292('0x22')){_0x101e3f[_0x9292('0x23')]=this[_0x9292('0x24')]['id'];}else{_0x101e3f[_['upperFirst'](_0x5f0c7c)+'AccountId']=this[_0x9292('0x24')]['id'];}_0x101e3f[_[_0x9292('0x25')](_0x5f0c7c)+_0x9292('0x26')]=this['interaction']['id'];if(this[_0x9292('0x21')]['created']){var _0x440e36=_0xa3015d[0x4];if(!_[_0x9292('0x27')](_0x440e36)){_0x101e3f['body']=utils[_0x9292('0x28')](_0x440e36,this);return rpc[_0x5f0c7c+_0x9292('0xf')][_0x9292('0x10')](_0x101e3f)['then'](function(_0x38c218){logger[_0x9292('0x12')](_0x9292('0x13'),_0x2303f3,_0x101e3f[_0x9292('0x14')]);})['catch'](function(_0x3c1b5e){logger[_0x9292('0x15')]('[%s][DIALOGFLOWV2]\x20%s',_0x2303f3,JSON['stringify'](_0x3c1b5e));})[_0x9292('0x29')](function(){logger[_0x9292('0x12')](_0x9292('0x2a'),_0x2303f3);_0x23b9f9[_0x9292('0x2b')]();});}else{logger[_0x9292('0x12')](_0x9292('0x2c'),_0x2303f3);_0x23b9f9['stop']();}}else{var _0x515615=this;var _0x2a2000=_0xa3015d[0x2][_0x9292('0x2d')](/\\n/g,'\x0a');var _0x271c31={'credentials':{'private_key':_0x2a2000,'client_email':_0xa3015d[0x1]}};var _0x29ac68=new dialogflow[(_0x9292('0x2e'))](_0x271c31);var _0xbda5d4=_0x29ac68[_0x9292('0x2f')](_0xa3015d[0x0],md5(_0x515615['interaction']['id']));var _0x411dbf={'session':_0xbda5d4,'queryInput':{'text':{'text':_0x515615[_0x9292('0x30')][_0x9292('0x14')],'languageCode':_0xa3015d[0x3]||'en'}}};return _0x29ac68[_0x9292('0x31')](_0x411dbf)[_0x9292('0x11')](function(_0x3a59b6){if(_0x3a59b6&&_0x3a59b6[_0x9292('0x32')]){_0x515615[_0x9292('0x14')][_0x9292('0x33')]=_0x3a59b6;var _0x2d68ba=_0x3a59b6[0x0];var _0x115eb6=_0x2d68ba[_0x9292('0x34')][_0x9292('0x35')]&&_0x2d68ba[_0x9292('0x34')]['diagnosticInfo'][_0x9292('0x36')]?_0x2d68ba[_0x9292('0x34')][_0x9292('0x35')]['fields'][_0x9292('0x37')][_0x9292('0x38')]:![];_0x515615[_0x9292('0x14')]['DIALOGFLOWV2_ACTION']=_0x2d68ba[_0x9292('0x34')][_0x9292('0x39')];_0x515615[_0x9292('0x14')][_0x9292('0x3a')]=_0x2d68ba[_0x9292('0x34')][_0x9292('0x3b')];_0x515615[_0x9292('0x14')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x2d68ba[_0x9292('0x34')][_0x9292('0x35')]&&_0x2d68ba[_0x9292('0x34')][_0x9292('0x35')][_0x9292('0x36')]?_0x2d68ba[_0x9292('0x34')][_0x9292('0x35')][_0x9292('0x36')][_0x9292('0x37')][_0x9292('0x38')]:![];_0x515615['body'][_0x9292('0x3c')]=_0x2d68ba['queryResult']['intent'][_0x9292('0x3d')];_0x515615[_0x9292('0x14')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x2d68ba['queryResult'][_0x9292('0x3e')][_0x9292('0x3f')];_0x515615[_0x9292('0x14')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x2d68ba[_0x9292('0x34')][_0x9292('0x3e')][_0x9292('0x40')];_0x515615[_0x9292('0x14')][_0x9292('0x41')]=_0x2d68ba[_0x9292('0x34')][_0x9292('0x42')];_0x515615[_0x9292('0x14')][_0x9292('0x43')]=_0x2d68ba['queryResult'][_0x9292('0x44')];_0x515615['body'][_0x9292('0x45')]=_0x2d68ba[_0x9292('0x34')][_0x9292('0x46')];_0x101e3f[_0x9292('0x47')]=_0x9292('0x33');_0x101e3f[_0x9292('0x48')]=JSON['stringify'](_0x3a59b6);var _0x37d8c0=[];for(var _0x5e12ac=0x0;_0x5e12ac<_0x3a59b6[_0x9292('0x32')];_0x5e12ac++){var _0x14dab1=_0x3a59b6[_0x5e12ac];if(_0x14dab1&&_0x14dab1[_0x9292('0x34')]&&_0x14dab1[_0x9292('0x34')][_0x9292('0x49')]){_0x37d8c0[_0x9292('0x4a')](createMessage(_0x2303f3,_0x5f0c7c,_0x101e3f,_0x14dab1[_0x9292('0x34')]['fulfillmentText']));}}return Promise['all'](_0x37d8c0)[_0x9292('0x11')](function(){if(_0x115eb6){_0x23b9f9[_0x9292('0x1a')]();}else{_0x23b9f9[_0x9292('0x2b')]();}})[_0x9292('0x4b')](function(_0x3545be){logger[_0x9292('0x15')](_0x9292('0x13'),_0x2303f3,JSON[_0x9292('0x4c')](_0x3545be));_0x23b9f9['next']();});}})[_0x9292('0x4b')](function(_0x54137b){logger[_0x9292('0x15')]('[%s][DIALOGFLOWV2]\x20%s',_0x2303f3,_0x54137b['message']);_0x23b9f9[_0x9292('0x1a')]();});}}catch(_0x442441){logger[_0x9292('0x15')](_0x9292('0x13'),_0x2303f3,JSON[_0x9292('0x4c')](_0x442441));_0x23b9f9[_0x9292('0x2b')]();}};}; \ No newline at end of file +var _0xe62a=['message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_SCORE','providerName','providerResponse','length','fulfillmentText','lodash','dialogflow','md5','moment','bluebird','./utils','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','InteractionId','created','Message','create','then','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath'];(function(_0x108f72,_0x55e43e){var _0x207973=function(_0x5c6db8){while(--_0x5c6db8){_0x108f72['push'](_0x108f72['shift']());}};_0x207973(++_0x55e43e);}(_0xe62a,0x16b));var _0xae62=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe62a[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xae62('0x0'));var dialogflow=require(_0xae62('0x1'));var md5=require(_0xae62('0x2'));var moment=require(_0xae62('0x3'));var Promise=require(_0xae62('0x4'));var logger=require('../../../../config/logger')('routing');var utils=require(_0xae62('0x5'));var rpc={'chatMessage':require(_0xae62('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xae62('0x7')),'faxMessage':require(_0xae62('0x8')),'whatsappMessage':require(_0xae62('0x9'))};function createMessage(_0x596405,_0x51a7e0,_0x56407b,_0x53c755){return new Promise(function(_0x5c14cb,_0x1738fa){var _0x241943=_[_0xae62('0xa')](_0x56407b);_0x241943[_0xae62('0xb')]=_0x53c755;return rpc[_0x51a7e0+'Message']['create'](_0x241943)['then'](function(){logger[_0xae62('0xc')](_0xae62('0xd'),_0x596405,_0x241943['body']);_0x5c14cb();})[_0xae62('0xe')](function(_0x59a689){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x596405,JSON[_0xae62('0xf')](_0x59a689));_0x1738fa(_0x59a689);});});}exports[_0xae62('0x10')]=function(_0x425609,_0x1564a7){return function(_0x1dfe5a){try{if(!_[_0xae62('0x11')](this[_0xae62('0x12')]['UserId'])){logger[_0xae62('0xc')](_0xae62('0xd'),_0x425609,_0xae62('0x13'));return _0x1dfe5a[_0xae62('0x14')]();}var _0x4c6bf4={'ContactId':this[_0xae62('0x15')]['id'],'sentAt':moment()[_0xae62('0x16')](_0xae62('0x17')),'direction':_0xae62('0x18')};if(this[_0xae62('0x19')]===_0xae62('0x1a')||this[_0xae62('0x19')]===_0xae62('0x1b')){_0x4c6bf4[_0xae62('0x1c')]=this[_0xae62('0x12')]['phone'];}var _0x4ec637=this[_0xae62('0x19')];if(_0x4ec637===_0xae62('0x1d')){_0x4c6bf4[_0xae62('0x1e')]=this['account']['id'];}else{_0x4c6bf4[_[_0xae62('0x1f')](_0x4ec637)+'AccountId']=this['account']['id'];}_0x4c6bf4[_[_0xae62('0x1f')](_0x4ec637)+_0xae62('0x20')]=this['interaction']['id'];if(this[_0xae62('0x12')][_0xae62('0x21')]){var _0x283d99=_0x1564a7[0x4];if(!_['isEmpty'](_0x283d99)){_0x4c6bf4[_0xae62('0xb')]=utils['getMustacheRender'](_0x283d99,this);return rpc[_0x4ec637+_0xae62('0x22')][_0xae62('0x23')](_0x4c6bf4)[_0xae62('0x24')](function(_0x5d7566){logger[_0xae62('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x425609,_0x4c6bf4[_0xae62('0xb')]);})[_0xae62('0xe')](function(_0x17e6c7){logger[_0xae62('0x25')](_0xae62('0xd'),_0x425609,JSON['stringify'](_0x17e6c7));})[_0xae62('0x26')](function(){logger[_0xae62('0xc')](_0xae62('0x27'),_0x425609);_0x1dfe5a['stop']();});}else{logger[_0xae62('0xc')](_0xae62('0x28'),_0x425609);_0x1dfe5a[_0xae62('0x29')]();}}else{var _0xea1a9b=this;var _0x366cf9=_0x1564a7[0x2][_0xae62('0x2a')](/\\n/g,'\x0a');var _0x2e0387={'credentials':{'private_key':_0x366cf9,'client_email':_0x1564a7[0x1]}};var _0xd0ff22=new dialogflow[(_0xae62('0x2b'))](_0x2e0387);var _0x15dc40=_0xd0ff22[_0xae62('0x2c')](_0x1564a7[0x0],md5(_0xea1a9b[_0xae62('0x12')]['id']));var _0x24f4bc={'session':_0x15dc40,'queryInput':{'text':{'text':_0xea1a9b[_0xae62('0x2d')][_0xae62('0xb')],'languageCode':_0x1564a7[0x3]||'en'}}};return _0xd0ff22[_0xae62('0x2e')](_0x24f4bc)[_0xae62('0x24')](function(_0x534a37){if(_0x534a37&&_0x534a37['length']){_0xea1a9b['body'][_0xae62('0x2f')]=_0x534a37;var _0x1e7828=_0x534a37[0x0];var _0x133ff6=_0x1e7828[_0xae62('0x30')][_0xae62('0x31')]&&_0x1e7828[_0xae62('0x30')][_0xae62('0x31')][_0xae62('0x32')]?_0x1e7828[_0xae62('0x30')][_0xae62('0x31')]['fields'][_0xae62('0x33')][_0xae62('0x34')]:![];_0xea1a9b['body']['DIALOGFLOWV2_ACTION']=_0x1e7828['queryResult'][_0xae62('0x35')];_0xea1a9b[_0xae62('0xb')][_0xae62('0x36')]=_0x1e7828['queryResult'][_0xae62('0x37')];_0xea1a9b[_0xae62('0xb')][_0xae62('0x38')]=_0x1e7828[_0xae62('0x30')][_0xae62('0x31')]&&_0x1e7828[_0xae62('0x30')]['diagnosticInfo'][_0xae62('0x32')]?_0x1e7828[_0xae62('0x30')][_0xae62('0x31')][_0xae62('0x32')][_0xae62('0x33')][_0xae62('0x34')]:![];_0xea1a9b[_0xae62('0xb')][_0xae62('0x39')]=_0x1e7828[_0xae62('0x30')]['intent'][_0xae62('0x3a')];_0xea1a9b['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x1e7828[_0xae62('0x30')][_0xae62('0x3b')]['displayName'];_0xea1a9b['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x1e7828[_0xae62('0x30')]['intent'][_0xae62('0x3c')];_0xea1a9b[_0xae62('0xb')][_0xae62('0x3d')]=_0x1e7828['queryResult'][_0xae62('0x3e')];_0xea1a9b['body']['DIALOGFLOWV2_QUERYTEXT']=_0x1e7828[_0xae62('0x30')]['queryText'];_0xea1a9b[_0xae62('0xb')][_0xae62('0x3f')]=_0x1e7828[_0xae62('0x30')]['intentDetectionConfidence'];_0x4c6bf4[_0xae62('0x40')]=_0xae62('0x2f');_0x4c6bf4[_0xae62('0x41')]=JSON[_0xae62('0xf')](_0x534a37);var _0x1bf703=[];for(var _0x34825f=0x0;_0x34825f<_0x534a37[_0xae62('0x42')];_0x34825f++){var _0x598187=_0x534a37[_0x34825f];if(_0x598187&&_0x598187[_0xae62('0x30')]&&_0x598187[_0xae62('0x30')][_0xae62('0x43')]){_0x1bf703['push'](createMessage(_0x425609,_0x4ec637,_0x4c6bf4,_0x598187[_0xae62('0x30')][_0xae62('0x43')]));}}return Promise['all'](_0x1bf703)[_0xae62('0x24')](function(){if(_0x133ff6){_0x1dfe5a[_0xae62('0x14')]();}else{_0x1dfe5a[_0xae62('0x29')]();}})[_0xae62('0xe')](function(_0x29874f){logger[_0xae62('0x25')]('[%s][DIALOGFLOWV2]\x20%s',_0x425609,JSON[_0xae62('0xf')](_0x29874f));_0x1dfe5a[_0xae62('0x14')]();});}})[_0xae62('0xe')](function(_0x2e89ac){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x425609,_0x2e89ac[_0xae62('0x2d')]);_0x1dfe5a['next']();});}}catch(_0x12eaac){logger[_0xae62('0x25')](_0xae62('0xd'),_0x425609,JSON[_0xae62('0xf')](_0x12eaac));_0x1dfe5a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 9b8e692..0f50aba 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 _0x63a3=['lodash','../../../../config/logger','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','error','stringify','validate'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x63a3,0x1a3));var _0x363a=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x63a3[_0x6a0266];return _0x309e00;};'use strict';var schema=require(_0x363a('0x0'));var _=require(_0x363a('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0x363a('0x2'))('routing');var gotoif=schema({'condition':{'type':_0x363a('0x3'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x363a('0x4'),'message':_0x363a('0x5')},'priorityFalse':{'type':_0x363a('0x4'),'message':_0x363a('0x6')}});exports[_0x363a('0x7')]=function(_0x32f7ce,_0x5ed386){return function(_0x40156e){try{var _0x396081={'condition':htmlToText[_0x363a('0x8')](utils[_0x363a('0x9')](_0x5ed386[0x0],this),{'wordwrap':![]})[_0x363a('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5ed386[0x1],'priorityFalse':_0x5ed386[0x2]};var _0x1f8d85=gotoif[_0x363a('0x0')](_0x396081,{'typecast':!![]});if(_0x1f8d85[_0x363a('0xb')]){logger['error'](_0x363a('0xc'),_0x32f7ce,_[_0x363a('0xd')](_0x1f8d85,_0x363a('0xe'))[_0x363a('0xf')](',\x20'));_0x40156e[_0x363a('0x10')]();}else{try{var _0x45cb68=eval('('+_0x396081['condition']+')');var _0x180ed2=_0x45cb68?_0x396081['priorityTrue']:_0x396081[_0x363a('0x11')];logger[_0x363a('0x12')](_0x363a('0x13'),_0x32f7ce,_0x396081[_0x363a('0x14')],_0x45cb68,_0x180ed2||'next');if(_0x180ed2){var _0x9079f1=_[_0x363a('0x15')](_0x40156e['rules'](),{'p':_0x180ed2});if(_0x9079f1>=0x0){logger['info'](_0x363a('0x16'),_0x32f7ce,_0x180ed2||_0x363a('0x17'),_0x9079f1);_0x40156e[_0x363a('0x17')](_0x9079f1);}else{logger[_0x363a('0x12')](_0x363a('0x18'),_0x32f7ce,_0x180ed2||_0x363a('0x17'));_0x40156e[_0x363a('0x10')]();}}else{_0x40156e[_0x363a('0x17')]();}}catch(_0x2cb4ad){logger['error'](_0x363a('0x19'),_0x32f7ce,_0x2cb4ad[_0x363a('0xe')]);_0x40156e['stop']();}}}catch(_0x935fa0){logger[_0x363a('0x1a')](_0x363a('0xc'),_0x32f7ce,JSON[_0x363a('0x1b')](_0x935fa0));_0x40156e[_0x363a('0x10')]();}};}; \ No newline at end of file +var _0xb0ce=['info','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','string','priority\x20true\x20is\x20a\x20number','number','fromString','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x2b9cf5,_0x2a7804){var _0xd0cf15=function(_0x92a896){while(--_0x92a896){_0x2b9cf5['push'](_0x2b9cf5['shift']());}};_0xd0cf15(++_0x2a7804);}(_0xb0ce,0x1d7));var _0xeb0c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb0ce[_0xa464c9];return _0x3d73c4;};'use strict';var schema=require(_0xeb0c('0x0'));var _=require(_0xeb0c('0x1'));var htmlToText=require(_0xeb0c('0x2'));var utils=require(_0xeb0c('0x3'));var logger=require(_0xeb0c('0x4'))('routing');var gotoif=schema({'condition':{'type':_0xeb0c('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0xeb0c('0x6')},'priorityFalse':{'type':_0xeb0c('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x57c12d,_0x4fe7f0){return function(_0x417b18){try{var _0x5aa166={'condition':htmlToText[_0xeb0c('0x8')](utils[_0xeb0c('0x9')](_0x4fe7f0[0x0],this),{'wordwrap':![]})[_0xeb0c('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4fe7f0[0x1],'priorityFalse':_0x4fe7f0[0x2]};var _0x20c3aa=gotoif[_0xeb0c('0x0')](_0x5aa166,{'typecast':!![]});if(_0x20c3aa['length']){logger[_0xeb0c('0xb')](_0xeb0c('0xc'),_0x57c12d,_[_0xeb0c('0xd')](_0x20c3aa,'message')[_0xeb0c('0xe')](',\x20'));_0x417b18[_0xeb0c('0xf')]();}else{try{var _0x598f6b=eval('('+_0x5aa166['condition']+')');var _0x401e6d=_0x598f6b?_0x5aa166[_0xeb0c('0x10')]:_0x5aa166[_0xeb0c('0x11')];logger['info'](_0xeb0c('0x12'),_0x57c12d,_0x5aa166[_0xeb0c('0x13')],_0x598f6b,_0x401e6d||_0xeb0c('0x14'));if(_0x401e6d){var _0x37d2e5=_['findIndex'](_0x417b18[_0xeb0c('0x15')](),{'p':_0x401e6d});if(_0x37d2e5>=0x0){logger['info'](_0xeb0c('0x16'),_0x57c12d,_0x401e6d||_0xeb0c('0x14'),_0x37d2e5);_0x417b18[_0xeb0c('0x14')](_0x37d2e5);}else{logger[_0xeb0c('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x57c12d,_0x401e6d||_0xeb0c('0x14'));_0x417b18[_0xeb0c('0xf')]();}}else{_0x417b18[_0xeb0c('0x14')]();}}catch(_0x52690a){logger[_0xeb0c('0xb')](_0xeb0c('0x18'),_0x57c12d,_0x52690a['message']);_0x417b18[_0xeb0c('0xf')]();}}}catch(_0x2e22cd){logger[_0xeb0c('0xb')]('[%s][GOTOIF]\x20%s',_0x57c12d,JSON[_0xeb0c('0x19')](_0x2e22cd));_0x417b18[_0xeb0c('0xf')]();}};}; \ 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 5e4c0da..5621c00 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 _0x5254=['error','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x5254,0x156));var _0x4525=function(_0x53a8c2,_0x24cc08){_0x53a8c2=_0x53a8c2-0x0;var _0x1fe6b2=_0x5254[_0x53a8c2];return _0x1fe6b2;};'use strict';var schema=require(_0x4525('0x0'));var _=require(_0x4525('0x1'));var logger=require(_0x4525('0x2'))('routing');var gotop=schema({'priority':{'type':_0x4525('0x3'),'required':!![],'message':_0x4525('0x4')}});exports[_0x4525('0x5')]=function(_0x3102c1,_0x32ec84){return function(_0x2bd2c6){try{var _0x5d9486={'priority':_0x32ec84[0x0]};var _0x4666e8=gotop[_0x4525('0x0')](_0x5d9486,{'typecast':!![]});if(_0x4666e8[_0x4525('0x6')]){logger['error'](_0x4525('0x7'),_0x3102c1,_['map'](_0x4666e8,_0x4525('0x8'))[_0x4525('0x9')](',\x20'));_0x2bd2c6[_0x4525('0xa')]();}else{logger['info'](_0x4525('0xb'),_0x3102c1,_0x5d9486[_0x4525('0xc')]);if(_0x5d9486[_0x4525('0xc')]){var _0x220eab=_[_0x4525('0xd')](_0x2bd2c6['rules'](),{'p':_0x5d9486[_0x4525('0xc')]});if(_0x220eab>=0x0){logger[_0x4525('0xe')](_0x4525('0xf'),_0x3102c1,_0x5d9486['priority']||'next',_0x220eab);_0x2bd2c6[_0x4525('0x10')](_0x220eab);}else{logger[_0x4525('0xe')](_0x4525('0x11'),_0x3102c1,_0x5d9486[_0x4525('0xc')]||_0x4525('0x10'));_0x2bd2c6[_0x4525('0xa')]();}}else{_0x2bd2c6[_0x4525('0x10')]();}}}catch(_0x15aa9f){logger[_0x4525('0x12')]('[%s][GOTOP]\x20%s',_0x3102c1,JSON[_0x4525('0x13')](_0x15aa9f));_0x2bd2c6[_0x4525('0xa')]();}};}; \ No newline at end of file +var _0xa820=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','length','error','[%s][GOTOP]\x20%s','message','join','stop'];(function(_0x42c587,_0x224d2a){var _0x3410cc=function(_0x4c8815){while(--_0x4c8815){_0x42c587['push'](_0x42c587['shift']());}};_0x3410cc(++_0x224d2a);}(_0xa820,0xa9));var _0x0a82=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0xa820[_0x29c3b2];return _0x4b3aa7;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0x0a82('0x0'))(_0x0a82('0x1'));var gotop=schema({'priority':{'type':_0x0a82('0x2'),'required':!![],'message':_0x0a82('0x3')}});exports['consequence']=function(_0x2453f0,_0x5903a9){return function(_0x114dfe){try{var _0x23f384={'priority':_0x5903a9[0x0]};var _0x5e37ef=gotop[_0x0a82('0x4')](_0x23f384,{'typecast':!![]});if(_0x5e37ef[_0x0a82('0x5')]){logger[_0x0a82('0x6')](_0x0a82('0x7'),_0x2453f0,_['map'](_0x5e37ef,_0x0a82('0x8'))[_0x0a82('0x9')](',\x20'));_0x114dfe[_0x0a82('0xa')]();}else{logger['info'](_0x0a82('0xb'),_0x2453f0,_0x23f384['priority']);if(_0x23f384[_0x0a82('0xc')]){var _0x20d09d=_[_0x0a82('0xd')](_0x114dfe[_0x0a82('0xe')](),{'p':_0x23f384[_0x0a82('0xc')]});if(_0x20d09d>=0x0){logger['info'](_0x0a82('0xf'),_0x2453f0,_0x23f384[_0x0a82('0xc')]||_0x0a82('0x10'),_0x20d09d);_0x114dfe[_0x0a82('0x10')](_0x20d09d);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x2453f0,_0x23f384[_0x0a82('0xc')]||_0x0a82('0x10'));_0x114dfe['stop']();}}else{_0x114dfe[_0x0a82('0x10')]();}}}catch(_0x505da5){logger['error']('[%s][GOTOP]\x20%s',_0x2453f0,JSON[_0x0a82('0x11')](_0x505da5));_0x114dfe[_0x0a82('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index c5b561c..fd32fb9 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 _0x9d11=['create','info','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','upperFirst','account','Message'];(function(_0x3270b6,_0x5d5b6c){var _0x6f24a=function(_0x39ef0e){while(--_0x39ef0e){_0x3270b6['push'](_0x3270b6['shift']());}};_0x6f24a(++_0x5d5b6c);}(_0x9d11,0xb7));var _0x19d1=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x9d11[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x19d1('0x0'));var utils=require(_0x19d1('0x1'));var logger=require(_0x19d1('0x2'))(_0x19d1('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x19d1('0x4')),'mailMessage':require(_0x19d1('0x5')),'smsMessage':require(_0x19d1('0x6')),'faxMessage':require(_0x19d1('0x7')),'whatsappMessage':require(_0x19d1('0x8'))};exports[_0x19d1('0x9')]=function(_0x4dcf38,_0x2a1c16){return function(_0x396c3a){try{var _0x4b624c={'body':utils[_0x19d1('0xa')](_0x2a1c16[0x0],this),'ContactId':this[_0x19d1('0xb')]['id']};if(this[_0x19d1('0xc')]===_0x19d1('0xd')){_0x4b624c['ChatWebsiteId']=this['account']['id'];}else{_0x4b624c[_[_0x19d1('0xe')](this[_0x19d1('0xc')])+'AccountId']=this[_0x19d1('0xf')]['id'];}_0x4b624c[_[_0x19d1('0xe')](this[_0x19d1('0xc')])+'InteractionId']=this['interaction']['id'];if(rpc[this['channel']+_0x19d1('0x10')]){return rpc[this[_0x19d1('0xc')]+_0x19d1('0x10')][_0x19d1('0x11')](_0x4b624c)['then'](function(_0x4aed3e){logger[_0x19d1('0x12')]('[%s][MESSAGE]\x20%s',_0x4dcf38,_0x4b624c['body']);_0x396c3a[_0x19d1('0x13')]();})[_0x19d1('0x14')](function(_0x116b36){logger[_0x19d1('0x15')](_0x19d1('0x16'),_0x4dcf38,JSON[_0x19d1('0x17')](_0x116b36));_0x396c3a[_0x19d1('0x18')]();});}}catch(_0x578764){logger[_0x19d1('0x15')](_0x19d1('0x16'),_0x4dcf38,JSON[_0x19d1('0x17')](_0x578764));_0x396c3a['stop']();}};}; \ No newline at end of file +var _0x28a6=['[%s][MESSAGE]\x20%s','body','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','create','then','info'];(function(_0x5b57ee,_0x3b0e93){var _0x4e3c88=function(_0x4b8c57){while(--_0x4b8c57){_0x5b57ee['push'](_0x5b57ee['shift']());}};_0x4e3c88(++_0x3b0e93);}(_0x28a6,0x8f));var _0x628a=function(_0x417baa,_0x3923d0){_0x417baa=_0x417baa-0x0;var _0x42724f=_0x28a6[_0x417baa];return _0x42724f;};'use strict';var _=require(_0x628a('0x0'));var utils=require(_0x628a('0x1'));var logger=require(_0x628a('0x2'))(_0x628a('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x628a('0x4')),'smsMessage':require(_0x628a('0x5')),'faxMessage':require(_0x628a('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x14d67b,_0xc788a){return function(_0x31b69f){try{var _0x1f4e2d={'body':utils[_0x628a('0x7')](_0xc788a[0x0],this),'ContactId':this[_0x628a('0x8')]['id']};if(this['channel']===_0x628a('0x9')){_0x1f4e2d[_0x628a('0xa')]=this[_0x628a('0xb')]['id'];}else{_0x1f4e2d[_['upperFirst'](this['channel'])+'AccountId']=this[_0x628a('0xb')]['id'];}_0x1f4e2d[_[_0x628a('0xc')](this['channel'])+_0x628a('0xd')]=this['interaction']['id'];if(rpc[this['channel']+'Message']){return rpc[this['channel']+_0x628a('0xe')][_0x628a('0xf')](_0x1f4e2d)[_0x628a('0x10')](function(_0x4871de){logger[_0x628a('0x11')](_0x628a('0x12'),_0x14d67b,_0x1f4e2d[_0x628a('0x13')]);_0x31b69f['next']();})['catch'](function(_0x26b31e){logger[_0x628a('0x14')](_0x628a('0x12'),_0x14d67b,JSON[_0x628a('0x15')](_0x26b31e));_0x31b69f['stop']();});}}catch(_0x3a1bec){logger[_0x628a('0x14')](_0x628a('0x12'),_0x14d67b,JSON['stringify'](_0x3a1bec));_0x31b69f[_0x628a('0x16')]();}};}; \ 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 dd0283a..5ab56aa 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 _0x50a2=['stringify','stop','../../../../config/logger','routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0xb81cdc,_0x77a5c2){var _0x5afff9=function(_0xe3131a){while(--_0xe3131a){_0xb81cdc['push'](_0xb81cdc['shift']());}};_0x5afff9(++_0x77a5c2);}(_0x50a2,0x17c));var _0x250a=function(_0x127a0f,_0x5a4950){_0x127a0f=_0x127a0f-0x0;var _0x3211cb=_0x50a2[_0x127a0f];return _0x3211cb;};'use strict';var utils=require('./utils');var logger=require(_0x250a('0x0'))(_0x250a('0x1'));exports['consequence']=function(_0x5e217e,_0x3f8699){return function(_0x3d96a7){try{logger[_0x250a('0x2')](_0x250a('0x3'),_0x5e217e,utils[_0x250a('0x4')](_0x3f8699[0x0],this));_0x3d96a7[_0x250a('0x5')]();}catch(_0x45848d){logger[_0x250a('0x6')]('[%s][NOOP]\x20%s',_0x5e217e,JSON[_0x250a('0x7')](_0x45848d));_0x3d96a7[_0x250a('0x8')]();}};}; \ No newline at end of file +var _0x4128=['next','./utils','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x2ebd68,_0x10e9cc){var _0x2e68d5=function(_0x57b080){while(--_0x57b080){_0x2ebd68['push'](_0x2ebd68['shift']());}};_0x2e68d5(++_0x10e9cc);}(_0x4128,0x1a5));var _0x8412=function(_0xc7803e,_0x4017f6){_0xc7803e=_0xc7803e-0x0;var _0x3bcfcb=_0x4128[_0xc7803e];return _0x3bcfcb;};'use strict';var utils=require(_0x8412('0x0'));var logger=require(_0x8412('0x1'))(_0x8412('0x2'));exports[_0x8412('0x3')]=function(_0x17c80a,_0x31c3c7){return function(_0x9dcd4e){try{logger['info'](_0x8412('0x4'),_0x17c80a,utils['getMustacheRender'](_0x31c3c7[0x0],this));_0x9dcd4e[_0x8412('0x5')]();}catch(_0x320f32){logger['error'](_0x8412('0x4'),_0x17c80a,JSON['stringify'](_0x320f32));_0x9dcd4e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 3db1326..4181079 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 _0xec5b=['moment','ioredis','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','from','contact','list','channel','QueueId','InteractionId','interaction','upperFirst','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','Queues','createQueue','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stop','log','validate','util'];(function(_0x9731c3,_0x351b45){var _0x11252a=function(_0x58752a){while(--_0x58752a){_0x9731c3['push'](_0x9731c3['shift']());}};_0x11252a(++_0x351b45);}(_0xec5b,0x175));var _0xbec5=function(_0x1d8117,_0x4836b8){_0x1d8117=_0x1d8117-0x0;var _0x23e108=_0xec5b[_0x1d8117];return _0x23e108;};'use strict';var schema=require(_0xbec5('0x0'));var _=require('lodash');var util=require(_0xbec5('0x1'));var seqqueue=require('seq-queue');var moment=require(_0xbec5('0x2'));var Redis=require(_0xbec5('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbec5('0x4'))(_0xbec5('0x5'));var strategy=require(_0xbec5('0x6'));config[_0xbec5('0x7')]=_['defaults'](config[_0xbec5('0x7')],{'host':_0xbec5('0x8'),'port':0x18eb});var io=require(_0xbec5('0x9'))(new Redis(config[_0xbec5('0x7')]));var attributes=['id',_0xbec5('0xa'),_0xbec5('0xb'),_0xbec5('0xc'),'from','joinAt'];function emit(_0x4b6b3d,_0x3c2931,_0x4c04cf){io['to'](_0x4b6b3d)['emit'](_0x3c2931,_0x4c04cf);}function emitChannelQueueInteraction(_0x11c8c7,_0x642043,_0xd7de3c,_0x2caab4,_0x1447e7,_0x261fad,_0x527646,_0xefce6){var _0x3a4a6d=_[_0xbec5('0xd')](_0xd7de3c);_0x3a4a6d['queue_id']=_0xefce6;_0x3a4a6d[_0xbec5('0xc')]=_0x642043;_0x3a4a6d['account']=_0x2caab4;_0x3a4a6d['id']=_0x1447e7;if(_0x261fad){_0x527646[util[_0xbec5('0xe')](_0xbec5('0xf'),_0x11c8c7)][_0x1447e7]=_[_0xbec5('0x10')](_0x3a4a6d,attributes);}else{delete _0x527646[util['format'](_0xbec5('0xf'),_0x11c8c7)][_0x1447e7];}emit(util[_0xbec5('0xe')](_0xbec5('0x11'),_0x11c8c7,_0x642043),util[_0xbec5('0xe')](_0xbec5('0x12'),_0x11c8c7,_0x261fad?_0xbec5('0x13'):_0xbec5('0x14')),_[_0xbec5('0x10')](_0x3a4a6d,attributes));}var rpc={'openchannelQueueReport':require(_0xbec5('0x15')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xbec5('0x16')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xbec5('0x17'))};var queue=schema({'name':{'type':_0xbec5('0x18'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xbec5('0x19'),'message':_0xbec5('0x1a')}});function startRouting(_0x57b3d7,_0xc02c07,_0xc896f4,_0x1f2ec7){if(_0x57b3d7&&_0xc02c07&&_0xc896f4){_0xc02c07[_0xbec5('0x1b')]+=0x1;var _0x1d8193={'uniqueid':_0x57b3d7,'from':_0xc896f4['body']?_0xc896f4[_0xbec5('0x1c')][_0xbec5('0x1d')]:'','joinAt':moment()[_0xbec5('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xc896f4['contact']?_0xc896f4[_0xbec5('0x1e')]['id']:null,'ListId':_0xc896f4[_0xbec5('0x1f')]?_0xc896f4['list']['id']:null};_0x1d8193[_['upperFirst'](_0xc896f4[_0xbec5('0x20')])+_0xbec5('0x21')]=_0xc02c07['id']||null;_0x1d8193[_['upperFirst'](_0xc896f4[_0xbec5('0x20')])+_0xbec5('0x22')]=_0xc896f4[_0xbec5('0x23')]?_0xc896f4[_0xbec5('0x23')]['id']:null;_0x1d8193[_[_0xbec5('0x24')](_0xc896f4[_0xbec5('0x20')])+_0xbec5('0x25')]=_0xc896f4['message']?_0xc896f4[_0xbec5('0x26')]['id']:null;_0x1d8193[_[_0xbec5('0x24')](_0xc896f4['channel'])+(_0xc896f4[_0xbec5('0x20')]!==_0xbec5('0x27')?_0xbec5('0x28'):_0xbec5('0x29'))]=_0xc896f4[_0xbec5('0xb')]?_0xc896f4[_0xbec5('0xb')]['id']:null;logger[_0xbec5('0x2a')](util['format'](_0xbec5('0x2b'),_0x57b3d7,_0xc02c07[_0xbec5('0x2c')]));emitChannelQueueInteraction(_0xc896f4[_0xbec5('0x20')],_0xc02c07[_0xbec5('0x2c')],_0x1d8193,_0xc896f4[_0xbec5('0xb')][_0xbec5('0x2c')],_0xc896f4['message']['id'],!![],_0x1f2ec7,_0xc02c07['id']);if(rpc[_0xc896f4[_0xbec5('0x20')]+_0xbec5('0x2d')]){return rpc[_0xc896f4[_0xbec5('0x20')]+'QueueReport']['create'](_0x1d8193)['catch'](function(_0x32b5d4){logger['error'](_0xbec5('0x2e'));});}}}function stopRouting(_0xed4d2b,_0x4ad7ee,_0x36cff1,_0xe6ad6f){if(_0xed4d2b&&_0x4ad7ee){_0x4ad7ee[_0xbec5('0x1b')]-=0x1;var _0x3abcb3={'leaveAt':moment()[_0xbec5('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0xbec5('0x2f')),'reason':_0xbec5('0x30')};logger['info'](util[_0xbec5('0xe')](_0xbec5('0x31'),_0xed4d2b,_0x4ad7ee['name']));emitChannelQueueInteraction(_0x36cff1[_0xbec5('0x20')],_0x4ad7ee[_0xbec5('0x2c')],_0x36cff1[_0xbec5('0x1c')],_0x36cff1[_0xbec5('0xb')][_0xbec5('0x2c')],_0x36cff1['message']['id'],![],_0xe6ad6f,_0x4ad7ee['id']);if(rpc[_0x36cff1['channel']+_0xbec5('0x2d')]){return rpc[_0x36cff1[_0xbec5('0x20')]+_0xbec5('0x2d')][_0xbec5('0x32')](_0xed4d2b,_0x3abcb3)[_0xbec5('0x33')](function(_0x320cf1){logger[_0xbec5('0x34')](_0xbec5('0x35'));});}}}function endRouting(_0x4a2bb0,_0x4c063e,_0x3e9453,_0x53f4c2){if(_0x4a2bb0&&_0x4c063e){_0x4c063e[_0xbec5('0x1b')]-=0x1;var _0x55bc63={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xbec5('0xe')](_0xbec5('0x2f')),'reason':_0xbec5('0x36')};logger[_0xbec5('0x2a')](util['format'](_0xbec5('0x37'),_0x4a2bb0,_0x4c063e['name']));emitChannelQueueInteraction(_0x3e9453[_0xbec5('0x20')],_0x4c063e[_0xbec5('0x2c')],_0x3e9453[_0xbec5('0x1c')],_0x3e9453[_0xbec5('0xb')][_0xbec5('0x2c')],_0x3e9453[_0xbec5('0x26')]['id'],![],_0x53f4c2);if(rpc[_0x3e9453['channel']+_0xbec5('0x2d')]){return rpc[_0x3e9453[_0xbec5('0x20')]+_0xbec5('0x2d')]['update'](_0x4a2bb0,_0x55bc63)['catch'](function(_0x3925e1){logger[_0xbec5('0x34')](_0xbec5('0x35'));});}}}function handleFindQueue(_0x25cdbe){return function(_0x3846be){return _0x3846be[_0xbec5('0x2c')][_0xbec5('0x38')]()===_0x25cdbe[_0xbec5('0x38')]();};}exports[_0xbec5('0x39')]=function(_0x5c369e,_0x44c80f,_0x2dbbdf,_0xc96e3b){return function(_0x5044d5){try{var _0x46bda5={'name':_0x44c80f[0x0],'timeout':_0x44c80f[0x1]};var _0x479b19=queue['validate'](_0x46bda5,{'typecast':!![]});if(_0x479b19[_0xbec5('0x3a')]){logger[_0xbec5('0x34')](_0xbec5('0x3b'),_0x5c369e,_[_0xbec5('0x3c')](_0x479b19,'message')['join'](',\x20'));_0x5044d5['stop']();}else{var _0x4d9c28=_['find'](_0x2dbbdf[_0xc96e3b[_0xbec5('0x20')]+_0xbec5('0x3d')],handleFindQueue(_0x46bda5['name']));if(_0x4d9c28){startRouting(_0x5c369e,_0x4d9c28,_0xc96e3b,_0x2dbbdf);var _0x5081ad=(_0x4d9c28[_0xbec5('0x36')]||0xa)*0x3e8;var _0x1169c0=(_0x46bda5['timeout']||0x14)*0x3e8;var _0xc48db8,_0x8b2fc4;if(_0x5081ad>_0x1169c0){_0x1169c0=_0x5081ad;}var _0x1d471f=seqqueue[_0xbec5('0x3e')](_0x5081ad);_0x1d471f['id']=_0x5c369e;_0x1d471f['atimeout']=_0x5081ad;_0x1d471f[_0xbec5('0x3f')]=_0x1169c0;_0x1d471f[_0xbec5('0x20')]=_0xc96e3b[_0xbec5('0x20')];_0x2dbbdf[_0xbec5('0x40')][_0x5c369e]['on'](_0xbec5('0x41'),function(){logger[_0xbec5('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x5c369e);stopRouting(_0x5c369e,_0x4d9c28,_0xc96e3b,_0x2dbbdf);clearTimeout(_0xc48db8);_0xc48db8=undefined;_0x1d471f[_0xbec5('0x42')](!![]);if(_0x2dbbdf[_0xbec5('0x40')][_0x5c369e]){delete _0x2dbbdf[_0xbec5('0x40')][_0x5c369e];}_0x5044d5['stop']();});_0x2dbbdf[_0xbec5('0x40')][_0x5c369e]['on'](_0xbec5('0x43'),function(){if(_0x2dbbdf[_0xbec5('0x40')][_0x5c369e]){delete _0x2dbbdf[_0xbec5('0x40')][_0x5c369e];}});_0xc48db8=setTimeout(function(){logger[_0xbec5('0x2a')](_0xbec5('0x44'),_0x5c369e);endRouting(_0x5c369e,_0x4d9c28,_0xc96e3b,_0x2dbbdf);clearTimeout(_0xc48db8);_0x1d471f['close'](!![]);_0x5044d5[_0xbec5('0x45')]();},_0x1169c0);switch(_0x4d9c28[_0xbec5('0x46')]){case _0xbec5('0x47'):strategy[_0xbec5('0x47')](_0x1d471f,_0x4d9c28,_0x2dbbdf,_0xc96e3b);break;default:strategy['beepall'](_0x1d471f,_0x4d9c28,_0x2dbbdf,_0xc96e3b);}}else{logger[_0xbec5('0x34')](_0xbec5('0x48'),_0x5c369e,_0x46bda5[_0xbec5('0x2c')]);_0x5044d5[_0xbec5('0x49')]();}}}catch(_0x560a88){console[_0xbec5('0x4a')](_0x560a88);logger[_0xbec5('0x34')](_0xbec5('0x3b'),_0x5c369e,_0x560a88['stack']);_0x5044d5[_0xbec5('0x49')]();}};}; \ No newline at end of file +var _0xd678=['lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','queue_id','account','queue','from','joinAt','emit','clone','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','contact','upperFirst','channel','interaction','MessageId','message','chat','WebsiteId','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xd678,0x1bb));var _0x8d67=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xd678[_0x96f74c];return _0x379222;};'use strict';var schema=require(_0x8d67('0x0'));var _=require(_0x8d67('0x1'));var util=require(_0x8d67('0x2'));var seqqueue=require(_0x8d67('0x3'));var moment=require('moment');var Redis=require(_0x8d67('0x4'));var config=require(_0x8d67('0x5'));var logger=require(_0x8d67('0x6'))(_0x8d67('0x7'));var strategy=require(_0x8d67('0x8'));config[_0x8d67('0x9')]=_[_0x8d67('0xa')](config[_0x8d67('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x8d67('0xb'),_0x8d67('0xc'),_0x8d67('0xd'),_0x8d67('0xe'),_0x8d67('0xf')];function emit(_0x11bbeb,_0x192f5d,_0xed269e){io['to'](_0x11bbeb)[_0x8d67('0x10')](_0x192f5d,_0xed269e);}function emitChannelQueueInteraction(_0x43b26f,_0x520bfc,_0x3f244d,_0x13fab7,_0x4e035f,_0x3732c9,_0x284da0,_0x434b8e){var _0x20a5cb=_[_0x8d67('0x11')](_0x3f244d);_0x20a5cb[_0x8d67('0xb')]=_0x434b8e;_0x20a5cb['queue']=_0x520bfc;_0x20a5cb['account']=_0x13fab7;_0x20a5cb['id']=_0x4e035f;if(_0x3732c9){_0x284da0[util['format'](_0x8d67('0x12'),_0x43b26f)][_0x4e035f]=_[_0x8d67('0x13')](_0x20a5cb,attributes);}else{delete _0x284da0[util[_0x8d67('0x14')]('%sQueuesWaitingInteractions',_0x43b26f)][_0x4e035f];}emit(util[_0x8d67('0x14')](_0x8d67('0x15'),_0x43b26f,_0x520bfc),util[_0x8d67('0x14')](_0x8d67('0x16'),_0x43b26f,_0x3732c9?'save':_0x8d67('0x17')),_[_0x8d67('0x13')](_0x20a5cb,attributes));}var rpc={'openchannelQueueReport':require(_0x8d67('0x18')),'mailQueueReport':require(_0x8d67('0x19')),'chatQueueReport':require(_0x8d67('0x1a')),'smsQueueReport':require(_0x8d67('0x1b')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x8d67('0x1c'))};var queue=schema({'name':{'type':_0x8d67('0x1d'),'required':!![],'message':_0x8d67('0x1e')},'timeout':{'type':_0x8d67('0x1f'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x110947,_0xb2b120,_0x374a79,_0x74d496){if(_0x110947&&_0xb2b120&&_0x374a79){_0xb2b120[_0x8d67('0x20')]+=0x1;var _0x211761={'uniqueid':_0x110947,'from':_0x374a79[_0x8d67('0x21')]?_0x374a79[_0x8d67('0x21')][_0x8d67('0xe')]:'','joinAt':moment()[_0x8d67('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x374a79[_0x8d67('0x22')]?_0x374a79[_0x8d67('0x22')]['id']:null,'ListId':_0x374a79['list']?_0x374a79['list']['id']:null};_0x211761[_[_0x8d67('0x23')](_0x374a79[_0x8d67('0x24')])+'QueueId']=_0xb2b120['id']||null;_0x211761[_[_0x8d67('0x23')](_0x374a79['channel'])+'InteractionId']=_0x374a79[_0x8d67('0x25')]?_0x374a79[_0x8d67('0x25')]['id']:null;_0x211761[_[_0x8d67('0x23')](_0x374a79[_0x8d67('0x24')])+_0x8d67('0x26')]=_0x374a79['message']?_0x374a79[_0x8d67('0x27')]['id']:null;_0x211761[_[_0x8d67('0x23')](_0x374a79[_0x8d67('0x24')])+(_0x374a79[_0x8d67('0x24')]!==_0x8d67('0x28')?'AccountId':_0x8d67('0x29'))]=_0x374a79[_0x8d67('0xc')]?_0x374a79['account']['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x110947,_0xb2b120[_0x8d67('0x2a')]));emitChannelQueueInteraction(_0x374a79[_0x8d67('0x24')],_0xb2b120[_0x8d67('0x2a')],_0x211761,_0x374a79[_0x8d67('0xc')]['name'],_0x374a79[_0x8d67('0x27')]['id'],!![],_0x74d496,_0xb2b120['id']);if(rpc[_0x374a79[_0x8d67('0x24')]+_0x8d67('0x2b')]){return rpc[_0x374a79[_0x8d67('0x24')]+'QueueReport'][_0x8d67('0x2c')](_0x211761)[_0x8d67('0x2d')](function(_0x8faa3c){logger[_0x8d67('0x2e')](_0x8d67('0x2f'));});}}}function stopRouting(_0x37fae3,_0x592864,_0x474cc5,_0x4a4fc5){if(_0x37fae3&&_0x592864){_0x592864[_0x8d67('0x20')]-=0x1;var _0x59d181={'leaveAt':moment()[_0x8d67('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x8d67('0x14')](_0x8d67('0x30')),'reason':'accepted'};logger[_0x8d67('0x31')](util[_0x8d67('0x14')](_0x8d67('0x32'),_0x37fae3,_0x592864[_0x8d67('0x2a')]));emitChannelQueueInteraction(_0x474cc5['channel'],_0x592864[_0x8d67('0x2a')],_0x474cc5['body'],_0x474cc5[_0x8d67('0xc')][_0x8d67('0x2a')],_0x474cc5[_0x8d67('0x27')]['id'],![],_0x4a4fc5,_0x592864['id']);if(rpc[_0x474cc5[_0x8d67('0x24')]+_0x8d67('0x2b')]){return rpc[_0x474cc5[_0x8d67('0x24')]+_0x8d67('0x2b')][_0x8d67('0x33')](_0x37fae3,_0x59d181)[_0x8d67('0x2d')](function(_0x39f8cc){logger[_0x8d67('0x2e')](_0x8d67('0x34'));});}}}function endRouting(_0x5b0573,_0x5a39da,_0x38eab9,_0x407e85){if(_0x5b0573&&_0x5a39da){_0x5a39da['waiting']-=0x1;var _0x5c2364={'leaveAt':moment()[_0x8d67('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x8d67('0x30')),'reason':_0x8d67('0x35')};logger[_0x8d67('0x31')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x5b0573,_0x5a39da[_0x8d67('0x2a')]));emitChannelQueueInteraction(_0x38eab9[_0x8d67('0x24')],_0x5a39da[_0x8d67('0x2a')],_0x38eab9[_0x8d67('0x21')],_0x38eab9[_0x8d67('0xc')][_0x8d67('0x2a')],_0x38eab9[_0x8d67('0x27')]['id'],![],_0x407e85);if(rpc[_0x38eab9[_0x8d67('0x24')]+_0x8d67('0x2b')]){return rpc[_0x38eab9[_0x8d67('0x24')]+_0x8d67('0x2b')][_0x8d67('0x33')](_0x5b0573,_0x5c2364)[_0x8d67('0x2d')](function(_0x8335ca){logger[_0x8d67('0x2e')](_0x8d67('0x34'));});}}}function handleFindQueue(_0x182b6c){return function(_0x5a868f){return _0x5a868f[_0x8d67('0x2a')][_0x8d67('0x36')]()===_0x182b6c[_0x8d67('0x36')]();};}exports[_0x8d67('0x37')]=function(_0x29ff16,_0x36f3c4,_0xd81d5f,_0x592828){return function(_0x5a1440){try{var _0x1d6d39={'name':_0x36f3c4[0x0],'timeout':_0x36f3c4[0x1]};var _0xd7147c=queue['validate'](_0x1d6d39,{'typecast':!![]});if(_0xd7147c[_0x8d67('0x38')]){logger[_0x8d67('0x2e')](_0x8d67('0x39'),_0x29ff16,_[_0x8d67('0x3a')](_0xd7147c,_0x8d67('0x27'))[_0x8d67('0x3b')](',\x20'));_0x5a1440[_0x8d67('0x3c')]();}else{var _0x15efff=_['find'](_0xd81d5f[_0x592828[_0x8d67('0x24')]+_0x8d67('0x3d')],handleFindQueue(_0x1d6d39[_0x8d67('0x2a')]));if(_0x15efff){startRouting(_0x29ff16,_0x15efff,_0x592828,_0xd81d5f);var _0x8172c=(_0x15efff[_0x8d67('0x35')]||0xa)*0x3e8;var _0x3c7534=(_0x1d6d39[_0x8d67('0x35')]||0x14)*0x3e8;var _0x491604,_0x153881;if(_0x8172c>_0x3c7534){_0x3c7534=_0x8172c;}var _0x45f4cd=seqqueue[_0x8d67('0x3e')](_0x8172c);_0x45f4cd['id']=_0x29ff16;_0x45f4cd['atimeout']=_0x8172c;_0x45f4cd[_0x8d67('0x3f')]=_0x3c7534;_0x45f4cd[_0x8d67('0x24')]=_0x592828[_0x8d67('0x24')];_0xd81d5f[_0x8d67('0x40')][_0x29ff16]['on'](_0x8d67('0x41'),function(){logger[_0x8d67('0x31')](_0x8d67('0x42'),_0x29ff16);stopRouting(_0x29ff16,_0x15efff,_0x592828,_0xd81d5f);clearTimeout(_0x491604);_0x491604=undefined;_0x45f4cd['close'](!![]);if(_0xd81d5f['rules'][_0x29ff16]){delete _0xd81d5f['rules'][_0x29ff16];}_0x5a1440[_0x8d67('0x3c')]();});_0xd81d5f[_0x8d67('0x40')][_0x29ff16]['on']('complete',function(){if(_0xd81d5f[_0x8d67('0x40')][_0x29ff16]){delete _0xd81d5f[_0x8d67('0x40')][_0x29ff16];}});_0x491604=setTimeout(function(){logger['info'](_0x8d67('0x43'),_0x29ff16);endRouting(_0x29ff16,_0x15efff,_0x592828,_0xd81d5f);clearTimeout(_0x491604);_0x45f4cd['close'](!![]);_0x5a1440[_0x8d67('0x44')]();},_0x3c7534);switch(_0x15efff[_0x8d67('0x45')]){case'rrmemory':strategy[_0x8d67('0x46')](_0x45f4cd,_0x15efff,_0xd81d5f,_0x592828);break;default:strategy[_0x8d67('0x47')](_0x45f4cd,_0x15efff,_0xd81d5f,_0x592828);}}else{logger['error'](_0x8d67('0x48'),_0x29ff16,_0x1d6d39['name']);_0x5a1440[_0x8d67('0x3c')]();}}}catch(_0x398cb1){console['log'](_0x398cb1);logger['error']('[%s][QUEUE]\x20%s',_0x29ff16,_0x398cb1[_0x8d67('0x49')]);_0x5a1440[_0x8d67('0x3c')]();}};}; \ 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 26e6d86..1e4dbfb 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 _0xb0dc=['RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','TIMEOUT','exports','lodash','uuid','./util','squeue','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','writeLog'];(function(_0x520bad,_0x3531b6){var _0x3e5dc3=function(_0x2603c5){while(--_0x2603c5){_0x520bad['push'](_0x520bad['shift']());}};_0x3e5dc3(++_0x3531b6);}(_0xb0dc,0x87));var _0xcb0d=function(_0x565552,_0x4d5116){_0x565552=_0x565552-0x0;var _0x39f5aa=_0xb0dc[_0x565552];return _0x39f5aa;};'use strict';var _=require(_0xcb0d('0x0'));var uuid=require(_0xcb0d('0x1'));var util=require(_0xcb0d('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x3244bf,_0x49ee05,_0x180f91,_0x1f31c7){this['notificationId']=uuid['v4']();this[_0xcb0d('0x3')]=_0x3244bf;this['agent']=_0x49ee05;this[_0xcb0d('0x4')]=_0x180f91;this['routing']=_0x1f31c7;this[_0xcb0d('0x3')][_0xcb0d('0x5')](this[_0xcb0d('0x6')][_0xcb0d('0x7')](this),this[_0xcb0d('0x8')][_0xcb0d('0x7')](this));this[_0xcb0d('0x3')]['on']('timeout',this['handleTimeout']['bind'](this));this['squeue']['on'](_0xcb0d('0x9'),this[_0xcb0d('0xa')][_0xcb0d('0x7')](this));};Agent['prototype'][_0xcb0d('0x5')]=function(){this['squeue']['push'](this[_0xcb0d('0x6')][_0xcb0d('0x7')](this),this[_0xcb0d('0x8')][_0xcb0d('0x7')](this));};Agent[_0xcb0d('0xb')]['handleDrained']=function(){this[_0xcb0d('0x8')](!![]);};Agent[_0xcb0d('0xb')]['handleRun']=function(_0x290304){logger[_0xcb0d('0xc')](_0xcb0d('0xd'),this[_0xcb0d('0x3')]['id'],this[_0xcb0d('0xe')]['id']);if(_[_0xcb0d('0xf')](this[_0xcb0d('0x4')][_0xcb0d('0x10')][this['agent']['id']])){logger[_0xcb0d('0xc')](_0xcb0d('0x11'),this[_0xcb0d('0x3')]['id'],this[_0xcb0d('0xe')]['id']);setTimeout(this['push'][_0xcb0d('0x7')](this),0x3e8);}else{if(this[_0xcb0d('0x12')][_0xcb0d('0x13')]||util[_0xcb0d('0x14')](this['squeue']['id'],this[_0xcb0d('0x4')]['agents'][this[_0xcb0d('0xe')]['id']],this[_0xcb0d('0x3')]['channel'],![])){this[_0xcb0d('0x4')][_0xcb0d('0x10')][this[_0xcb0d('0xe')]['id']][_0xcb0d('0x15')]=!![];this[_0xcb0d('0x4')][_0xcb0d('0x10')][this[_0xcb0d('0xe')]['id']][_0xcb0d('0x16')]=undefined;util[_0xcb0d('0x17')](this['notificationId'],this['squeue']['id'],this[_0xcb0d('0x4')][_0xcb0d('0x10')][this[_0xcb0d('0xe')]['id']],null,this[_0xcb0d('0x12')]);util[_0xcb0d('0x18')](this[_0xcb0d('0x3')]['id'],this['realtime'][_0xcb0d('0x10')][this['agent']['id']],_0xcb0d('0x19')+(this[_0xcb0d('0x12')][_0xcb0d('0x13')]?_0xcb0d('0x1a'):''));}else{logger[_0xcb0d('0xc')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xcb0d('0x3')]['id'],this[_0xcb0d('0xe')]['id']);setTimeout(this[_0xcb0d('0x5')]['bind'](this),0x3e8);}}};Agent[_0xcb0d('0xb')]['handleTimeout']=function(_0x5e32b8){if(_[_0xcb0d('0xf')](this['realtime'][_0xcb0d('0x10')][this[_0xcb0d('0xe')]['id']])){return logger[_0xcb0d('0xc')](_0xcb0d('0x11'),this[_0xcb0d('0x3')]['id'],this[_0xcb0d('0xe')]['id']);}else{logger[_0xcb0d('0xc')](_0xcb0d('0x1b'),this[_0xcb0d('0x3')]['id'],this[_0xcb0d('0xe')]['id']);util[_0xcb0d('0x1c')](this[_0xcb0d('0x1d')],this[_0xcb0d('0x3')]['id'],this[_0xcb0d('0x4')][_0xcb0d('0x10')][this[_0xcb0d('0xe')]['id']],null,this['routing']);this[_0xcb0d('0x4')]['agents'][this[_0xcb0d('0xe')]['id']][_0xcb0d('0x15')]=![];this['realtime'][_0xcb0d('0x10')][this[_0xcb0d('0xe')]['id']][_0xcb0d('0x16')]=undefined;util[_0xcb0d('0x18')](this[_0xcb0d('0x3')]['id'],this[_0xcb0d('0x4')][_0xcb0d('0x10')][this['agent']['id']],_0x5e32b8?'STOP':_0xcb0d('0x1e'));}if(!_0x5e32b8){setTimeout(this['push'][_0xcb0d('0x7')](this),0x3e8);}};function agent(_0xc0c9c4,_0x205829,_0x36e4f1,_0x2fc383){return new Agent(_0xc0c9c4,_0x205829,_0x36e4f1,_0x2fc383);}module[_0xcb0d('0x1f')]=agent; \ No newline at end of file +var _0x0434=['notificationId','squeue','agent','realtime','push','handleTimeout','bind','timeout','drained','prototype','handleDrained','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0434,0x1ad));var _0x4043=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0x0434[_0x25701b];return _0x3a8a2c;};'use strict';var _=require(_0x4043('0x0'));var uuid=require(_0x4043('0x1'));var util=require(_0x4043('0x2'));var logger=require(_0x4043('0x3'))(_0x4043('0x4'));var Agent=function(_0x56e8f3,_0x4ca779,_0x2e6bdf,_0xfa9ae8){this[_0x4043('0x5')]=uuid['v4']();this[_0x4043('0x6')]=_0x56e8f3;this[_0x4043('0x7')]=_0x4ca779;this[_0x4043('0x8')]=_0x2e6bdf;this['routing']=_0xfa9ae8;this[_0x4043('0x6')][_0x4043('0x9')](this['handleRun']['bind'](this),this[_0x4043('0xa')][_0x4043('0xb')](this));this[_0x4043('0x6')]['on'](_0x4043('0xc'),this[_0x4043('0xa')][_0x4043('0xb')](this));this[_0x4043('0x6')]['on'](_0x4043('0xd'),this['handleDrained'][_0x4043('0xb')](this));};Agent[_0x4043('0xe')][_0x4043('0x9')]=function(){this[_0x4043('0x6')][_0x4043('0x9')](this['handleRun'][_0x4043('0xb')](this),this[_0x4043('0xa')][_0x4043('0xb')](this));};Agent[_0x4043('0xe')][_0x4043('0xf')]=function(){this['handleTimeout'](!![]);};Agent[_0x4043('0xe')][_0x4043('0x10')]=function(_0x3d91ee){logger[_0x4043('0x11')](_0x4043('0x12'),this[_0x4043('0x6')]['id'],this[_0x4043('0x7')]['id']);if(_[_0x4043('0x13')](this[_0x4043('0x8')][_0x4043('0x14')][this[_0x4043('0x7')]['id']])){logger[_0x4043('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x4043('0x6')]['id'],this[_0x4043('0x7')]['id']);setTimeout(this[_0x4043('0x9')]['bind'](this),0x3e8);}else{if(this[_0x4043('0x4')][_0x4043('0x15')]||util[_0x4043('0x16')](this[_0x4043('0x6')]['id'],this[_0x4043('0x8')]['agents'][this[_0x4043('0x7')]['id']],this['squeue'][_0x4043('0x17')],![])){this[_0x4043('0x8')][_0x4043('0x14')][this[_0x4043('0x7')]['id']][_0x4043('0x18')]=!![];this[_0x4043('0x8')]['agents'][this[_0x4043('0x7')]['id']][_0x4043('0x19')]=undefined;util['showNotification'](this['notificationId'],this[_0x4043('0x6')]['id'],this['realtime']['agents'][this[_0x4043('0x7')]['id']],null,this[_0x4043('0x4')]);util['writeLog'](this[_0x4043('0x6')]['id'],this[_0x4043('0x8')][_0x4043('0x14')][this[_0x4043('0x7')]['id']],_0x4043('0x1a')+(this[_0x4043('0x4')][_0x4043('0x15')]?_0x4043('0x1b'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x4043('0x6')]['id'],this[_0x4043('0x7')]['id']);setTimeout(this[_0x4043('0x9')]['bind'](this),0x3e8);}}};Agent['prototype'][_0x4043('0xa')]=function(_0xd8f24f){if(_['isNil'](this[_0x4043('0x8')][_0x4043('0x14')][this['agent']['id']])){return logger[_0x4043('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x4043('0x6')]['id'],this[_0x4043('0x7')]['id']);}else{logger[_0x4043('0x11')](_0x4043('0x1c'),this[_0x4043('0x6')]['id'],this[_0x4043('0x7')]['id']);util['hideNotification'](this[_0x4043('0x5')],this[_0x4043('0x6')]['id'],this['realtime'][_0x4043('0x14')][this[_0x4043('0x7')]['id']],null,this[_0x4043('0x4')]);this[_0x4043('0x8')][_0x4043('0x14')][this[_0x4043('0x7')]['id']][_0x4043('0x18')]=![];this[_0x4043('0x8')]['agents'][this['agent']['id']]['busyQueue']=undefined;util['writeLog'](this[_0x4043('0x6')]['id'],this[_0x4043('0x8')][_0x4043('0x14')][this['agent']['id']],_0xd8f24f?_0x4043('0x1d'):'TIMEOUT');}if(!_0xd8f24f){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x1fa348,_0x183be3,_0x28f5e8,_0x1eb898){return new Agent(_0x1fa348,_0x183be3,_0x28f5e8,_0x1eb898);}module[_0x4043('0x1e')]=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 8c09c58..2329343 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 _0xbfda=['notificationId','queue','push','bind','handleTimeout','squeue','timeout','drained','handleDrained','prototype','handleRun','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime','channel','writeLog','busy','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing'];(function(_0x1822c5,_0x5d33b0){var _0x3d8bb3=function(_0x2b6c54){while(--_0x2b6c54){_0x1822c5['push'](_0x1822c5['shift']());}};_0x3d8bb3(++_0x5d33b0);}(_0xbfda,0x1dc));var _0xabfd=function(_0x1c7f48,_0x255687){_0x1c7f48=_0x1c7f48-0x0;var _0x274c31=_0xbfda[_0x1c7f48];return _0x274c31;};'use strict';var _=require(_0xabfd('0x0'));var uuid=require(_0xabfd('0x1'));var util=require(_0xabfd('0x2'));var logger=require('../../../../../config/logger')(_0xabfd('0x3'));var Beepall=function(_0x51bb8a,_0x3ba7f2,_0x138c67,_0x384d8e){this[_0xabfd('0x4')]=uuid['v4']();this['squeue']=_0x51bb8a;this[_0xabfd('0x5')]=_0x3ba7f2;this['realtime']=_0x138c67;this[_0xabfd('0x3')]=_0x384d8e;this['squeue'][_0xabfd('0x6')](this['handleRun'][_0xabfd('0x7')](this),this[_0xabfd('0x8')][_0xabfd('0x7')](this));this[_0xabfd('0x9')]['on'](_0xabfd('0xa'),this[_0xabfd('0x8')]['bind'](this));this[_0xabfd('0x9')]['on'](_0xabfd('0xb'),this[_0xabfd('0xc')][_0xabfd('0x7')](this));};Beepall[_0xabfd('0xd')][_0xabfd('0x6')]=function(){this[_0xabfd('0x9')][_0xabfd('0x6')](this[_0xabfd('0xe')][_0xabfd('0x7')](this),this[_0xabfd('0x8')][_0xabfd('0x7')](this));};Beepall[_0xabfd('0xd')]['handleDrained']=function(_0x1c0216){this[_0xabfd('0x8')](!![]);};Beepall['prototype'][_0xabfd('0xe')]=function(_0x39b2d9){var _0xf6bc0d=!![];if(!_[_0xabfd('0xf')](this[_0xabfd('0x5')])&&!_[_0xabfd('0xf')](this[_0xabfd('0x5')][_0xabfd('0x10')])&&this[_0xabfd('0x5')]['Agents'][_0xabfd('0x11')]>0x0){for(var _0x2ae235=0x0,_0x346410;_0x2ae2350x0){for(var _0x2a3fd1=0x0,_0x5360f2;_0x2a3fd10x0&&_0x1e6f9c[_0x725a04+'CurrentCapacity']>=_0x1e6f9c[_0x725a04+_0x9afb('0x21')]){writeLog(_0x50c835,_0x1e6f9c,_0x725a04['toUpperCase']()+_0x9afb('0x24'));return![];}}return!![];};exports['showNotification']=function(_0x5692fa,_0x1e6100,_0x304104,_0x30af1b,_0x13a33e){return sendNotification(!![],_0x5692fa,_0x1e6100,_0x304104,_0x30af1b,_0x13a33e);};exports[_0x9afb('0x25')]=function(_0x3e3f57,_0x46673d,_0x5aabd5,_0x494ef8,_0x1cc791){return sendNotification(![],_0x3e3f57,_0x46673d,_0x5aabd5,_0x494ef8,_0x1cc791);};exports[_0x9afb('0x26')]=writeLog; \ No newline at end of file +var _0xc6ac=['user:%s','name','split','account','notificationSound','body','queue','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit'];(function(_0x36067f,_0xba548e){var _0x44f0b3=function(_0x1954af){while(--_0x1954af){_0x36067f['push'](_0x36067f['shift']());}};_0x44f0b3(++_0xba548e);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2b9edb,_0xc01b4a){_0x2b9edb=_0x2b9edb-0x0;var _0x344b43=_0xc6ac[_0x2b9edb];return _0x344b43;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var utils=require(_0xcc6a('0x2'));var Mustache=require(_0xcc6a('0x3'));var Redis=require(_0xcc6a('0x4'));var config=require(_0xcc6a('0x5'));var logger=require(_0xcc6a('0x6'))(_0xcc6a('0x7'));config[_0xcc6a('0x8')]=_[_0xcc6a('0x9')](config[_0xcc6a('0x8')],{'host':_0xcc6a('0xa'),'port':0x18eb});var io=require(_0xcc6a('0xb'))(new Redis(config[_0xcc6a('0x8')]));function emit(_0x5f3887,_0x3dd497,_0x11b919){io['to'](_0x5f3887)[_0xcc6a('0xc')](_0x3dd497,_0x11b919);}function sendNotification(_0x560cc4,_0x43e3bf,_0x210f63,_0x7806a0,_0x463ebb,_0x3eb04a){io['to'](util['format'](_0xcc6a('0xd'),_0x7806a0[_0xcc6a('0xe')]))[_0xcc6a('0xc')]('user:save',_0x7806a0);var _0x1d91a5=_0x3eb04a||{};var _0x9e9a63=_0x210f63[_0xcc6a('0xf')]('.');var _0x55af93={'uniqueid':_0x43e3bf,'channel':_0x9e9a63[0x0],'id':_0x9e9a63[0x1],'title':_0x9e9a63[0x0]+'\x20interaction','interactionId':_0x9e9a63[0x2],'queue':_0x463ebb?_0x463ebb[_0xcc6a('0xe')]:null,'sound':_0x1d91a5[_0xcc6a('0x10')][_0xcc6a('0x11')],'shake':_0x1d91a5['account']['notificationShake']};try{if(!_0x1d91a5[_0xcc6a('0x12')]){_0x1d91a5[_0xcc6a('0x12')]={};}if(_0x463ebb){_0x1d91a5[_0xcc6a('0x12')][_0xcc6a('0x13')]=_0x463ebb;}else if(_0x1d91a5[_0xcc6a('0x12')][_0xcc6a('0x13')]){delete _0x1d91a5[_0xcc6a('0x12')][_0xcc6a('0x13')];}_0x55af93['msg']=utils['getMustacheRender'](_0x1d91a5['account'][_0xcc6a('0x14')],_0x1d91a5);}catch(_0x44910f){_0x55af93[_0xcc6a('0x15')]=_0xcc6a('0x16');logger[_0xcc6a('0x17')](util[_0xcc6a('0x18')](_0xcc6a('0x19'),_0x43e3bf,_0x44910f[_0xcc6a('0x1a')]));}io['to'](util[_0xcc6a('0x18')](_0xcc6a('0xd'),_0x7806a0[_0xcc6a('0xe')]))['emit'](util[_0xcc6a('0x18')](_0xcc6a('0x1b'),_0x560cc4?_0xcc6a('0x1c'):_0xcc6a('0x1d')),_0x55af93);}function writeLog(_0x1495d8,_0x30b8ed,_0x36c80f){return logger[_0xcc6a('0x1e')](util[_0xcc6a('0x18')](_0xcc6a('0x1f'),_0x1495d8,_0x30b8ed[_0xcc6a('0xe')],_0x36c80f));}exports[_0xcc6a('0x20')]=function(_0x51be9a,_0x41c4c8,_0x3a081e,_0x38f812){if(_0x41c4c8['busy']){writeLog(_0x51be9a,_0x41c4c8,_0xcc6a('0x21'));return![];}if(!_0x41c4c8[_0xcc6a('0x22')]){writeLog(_0x51be9a,_0x41c4c8,_0xcc6a('0x23'));return![];}if(_0x41c4c8[_0x3a081e+_0xcc6a('0x24')]){writeLog(_0x51be9a,_0x41c4c8,_0xcc6a('0x25'));return![];}if(_0x38f812&&_0x41c4c8[_0xcc6a('0x26')](_0x3a081e+'Capacity')&&_0x41c4c8[_0xcc6a('0x26')](_0x3a081e+_0xcc6a('0x27'))){if(_0x41c4c8[_0x3a081e+_0xcc6a('0x28')]>0x0&&_0x41c4c8[_0x3a081e+'CurrentCapacity']>=_0x41c4c8[_0x3a081e+_0xcc6a('0x28')]){writeLog(_0x51be9a,_0x41c4c8,_0x3a081e[_0xcc6a('0x29')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xcc6a('0x2a')]=function(_0x8b1b2b,_0x3233d1,_0x473f88,_0x5d7399,_0x194aab){return sendNotification(!![],_0x8b1b2b,_0x3233d1,_0x473f88,_0x5d7399,_0x194aab);};exports[_0xcc6a('0x2b')]=function(_0x2c6d88,_0x4f176b,_0x2590a2,_0x5308d4,_0x4f67d3){return sendNotification(![],_0x2c6d88,_0x4f176b,_0x2590a2,_0x5308d4,_0x4f67d3);};exports[_0xcc6a('0x2c')]=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 325c1be..736ef61 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 _0x562d=['replace','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','shelljs','lodash','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x562d,0xe1));var _0xd562=function(_0x7971bd,_0x1d2627){_0x7971bd=_0x7971bd-0x0;var _0x44a885=_0x562d[_0x7971bd];return _0x44a885;};'use strict';var schema=require(_0xd562('0x0'));var sh=require(_0xd562('0x1'));var _=require(_0xd562('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xd562('0x3'));var system=schema({'command':{'type':_0xd562('0x4'),'required':!![],'message':_0xd562('0x5')}});exports['consequence']=function(_0xf71ee1,_0x5a8157){return function(_0x5baf1b){try{var _0x1d05e9={'command':_0x5a8157[0x0]};var _0x46bf9b=system[_0xd562('0x0')](_0x1d05e9,{'typecast':!![]});if(_0x46bf9b[_0xd562('0x6')]){logger[_0xd562('0x7')](_0xd562('0x8'),_0xf71ee1,_['map'](_0x46bf9b,_0xd562('0x9'))['join'](',\x20'));logger[_0xd562('0xa')](_0xd562('0xb'),_0xf71ee1);_0x5baf1b[_0xd562('0xc')]();}else{var _0x31e826=this;var _0x22750e=utils[_0xd562('0xd')](_0x5a8157[0x0],this);logger[_0xd562('0xa')](_0xd562('0xe'),_0xf71ee1,_0x22750e);sh[_0xd562('0xf')](_[_0xd562('0x10')](_0x22750e),function(_0x16b301,_0x4a0820){logger[_0xd562('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0xf71ee1,_0x16b301);if(_0x16b301==0x0){var _0x4bff34=_0x4a0820[_0xd562('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x5a8157[0x1])||_[_0xd562('0x12')](_0x5a8157[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0xf71ee1);_0x31e826[_0xd562('0x13')][_0x5a8157[0x1]]=_0x4bff34;}else{logger[_0xd562('0xa')](_0xd562('0x14'),_0xf71ee1,_0x5a8157[0x1],_0x4bff34);_0x31e826[_0xd562('0x13')][_0x5a8157[0x1]]=_0x4bff34;}}_0x5baf1b[_0xd562('0xc')]();});}}catch(_0x4e358e){logger[_0xd562('0x7')](_0xd562('0x8'),_0xf71ee1,_['isObject'](_0x4e358e)?JSON[_0xd562('0x15')](_0x4e358e):_0x4e358e);logger[_0xd562('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xf71ee1);_0x5baf1b[_0xd562('0xc')]();}};}; \ No newline at end of file +var _0x8fed=['error','[%s][SYSTEM]\x20%s','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','stringify','lodash','./utils','../../../../config/logger','routing','string','consequence','validate','length'];(function(_0x3dcb83,_0x38aaea){var _0x4a9f7f=function(_0x132299){while(--_0x132299){_0x3dcb83['push'](_0x3dcb83['shift']());}};_0x4a9f7f(++_0x38aaea);}(_0x8fed,0xf5));var _0xd8fe=function(_0x3f1f1b,_0x3e1e70){_0x3f1f1b=_0x3f1f1b-0x0;var _0xb0c489=_0x8fed[_0x3f1f1b];return _0xb0c489;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xd8fe('0x0'));var utils=require(_0xd8fe('0x1'));var logger=require(_0xd8fe('0x2'))(_0xd8fe('0x3'));var system=schema({'command':{'type':_0xd8fe('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xd8fe('0x5')]=function(_0x3e93f3,_0x193c5d){return function(_0x276c96){try{var _0x2b4285={'command':_0x193c5d[0x0]};var _0x54b0c9=system[_0xd8fe('0x6')](_0x2b4285,{'typecast':!![]});if(_0x54b0c9[_0xd8fe('0x7')]){logger[_0xd8fe('0x8')](_0xd8fe('0x9'),_0x3e93f3,_['map'](_0x54b0c9,_0xd8fe('0xa'))['join'](',\x20'));logger[_0xd8fe('0xb')](_0xd8fe('0xc'),_0x3e93f3);_0x276c96[_0xd8fe('0xd')]();}else{var _0x25c7ac=this;var _0x2a4142=utils['getMustacheRender'](_0x193c5d[0x0],this);logger[_0xd8fe('0xb')](_0xd8fe('0xe'),_0x3e93f3,_0x2a4142);sh[_0xd8fe('0xf')](_['trim'](_0x2a4142),function(_0x2ab4ee,_0x50be7e){logger[_0xd8fe('0xb')](_0xd8fe('0x10'),_0x3e93f3,_0x2ab4ee);if(_0x2ab4ee==0x0){var _0x2a977d=_0x50be7e[_0xd8fe('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xd8fe('0x12')](_0x193c5d[0x1])||_['isEmpty'](_0x193c5d[0x1])){logger[_0xd8fe('0xb')](_0xd8fe('0x13'),_0x3e93f3);_0x25c7ac['body'][_0x193c5d[0x1]]=_0x2a977d;}else{logger[_0xd8fe('0xb')](_0xd8fe('0x14'),_0x3e93f3,_0x193c5d[0x1],_0x2a977d);_0x25c7ac[_0xd8fe('0x15')][_0x193c5d[0x1]]=_0x2a977d;}}_0x276c96[_0xd8fe('0xd')]();});}}catch(_0x237de6){logger[_0xd8fe('0x8')](_0xd8fe('0x9'),_0x3e93f3,_['isObject'](_0x237de6)?JSON[_0xd8fe('0x16')](_0x237de6):_0x237de6);logger['info'](_0xd8fe('0xc'),_0x3e93f3);_0x276c96[_0xd8fe('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index e2c9346..3e14468 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 _0x445f=['consequence','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','finally','isObject','stringify','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number'];(function(_0x1aa8e4,_0x422beb){var _0x335a4d=function(_0x925d56){while(--_0x925d56){_0x1aa8e4['push'](_0x1aa8e4['shift']());}};_0x335a4d(++_0x422beb);}(_0x445f,0x1ba));var _0xf445=function(_0xe2ee84,_0x2e16b4){_0xe2ee84=_0xe2ee84-0x0;var _0x5803f3=_0x445f[_0xe2ee84];return _0x5803f3;};'use strict';var schema=require(_0xf445('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xf445('0x1')),'openchannelInteraction':require(_0xf445('0x2')),'smsInteraction':require(_0xf445('0x3')),'mailInteraction':require(_0xf445('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xf445('0x5'))(_0xf445('0x6'));var tag=schema({'tag':{'type':_0xf445('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xf445('0x8')]=function(_0x54f530,_0x1cd32c,_0x981368,_0x4a972f){return function(_0x256b1f){try{var _0x40c1e5={'tag':_0x1cd32c[0x0]};var _0x299f36=tag[_0xf445('0x0')](_0x40c1e5,{'typecast':!![]});if(_0x299f36[_0xf445('0x9')]){logger[_0xf445('0xa')]('[%s][TAG]\x20%s',_0x54f530,_[_0xf445('0xb')](_0x299f36,_0xf445('0xc'))[_0xf445('0xd')](',\x20'));logger[_0xf445('0xe')](_0xf445('0xf'),_0x54f530);_0x256b1f[_0xf445('0x10')]();}else{var _0x47e8cd={'ids':[_0x1cd32c[0x0]]};if(rpc[_0x4a972f[_0xf445('0x11')]+_0xf445('0x12')]){rpc[_0x4a972f[_0xf445('0x11')]+_0xf445('0x12')]['addTags'](_0x4a972f[_0xf445('0x13')]['id'],_0x47e8cd)['then'](function(_0x13172a){logger[_0xf445('0xe')](_0xf445('0x14'),_0x54f530,_0x1cd32c[0x1],_0x4a972f[_0xf445('0x11')],_0x4a972f['interaction']['id']);})['catch'](function(_0x92245d){logger['error'](_0xf445('0x15'),_0x54f530,JSON['stringify'](_0x92245d));logger[_0xf445('0xe')](_0xf445('0xf'),_0x54f530);})[_0xf445('0x16')](function(){_0x256b1f[_0xf445('0x10')]();});}}}catch(_0x2f56de){logger['error'](_0xf445('0x15'),_0x54f530,_[_0xf445('0x17')](_0x2f56de)?JSON[_0xf445('0x18')](_0x2f56de):_0x2f56de);logger[_0xf445('0xe')](_0xf445('0xf'),_0x54f530);_0x256b1f['next']();}};}; \ No newline at end of file +var _0xad40=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0xad40,0xed));var _0x0ad4=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xad40[_0x6131cd];return _0x47e916;};'use strict';var schema=require(_0x0ad4('0x0'));var _=require(_0x0ad4('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0ad4('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0ad4('0x3'))};var logger=require(_0x0ad4('0x4'))(_0x0ad4('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x0ad4('0x6')}});exports[_0x0ad4('0x7')]=function(_0x289ac5,_0xd72b89,_0xc129ce,_0x46304d){return function(_0x4a4693){try{var _0x404c76={'tag':_0xd72b89[0x0]};var _0x3da5bd=tag[_0x0ad4('0x0')](_0x404c76,{'typecast':!![]});if(_0x3da5bd[_0x0ad4('0x8')]){logger[_0x0ad4('0x9')](_0x0ad4('0xa'),_0x289ac5,_[_0x0ad4('0xb')](_0x3da5bd,'message')[_0x0ad4('0xc')](',\x20'));logger['info'](_0x0ad4('0xd'),_0x289ac5);_0x4a4693[_0x0ad4('0xe')]();}else{var _0x471648={'ids':[_0xd72b89[0x0]]};if(rpc[_0x46304d[_0x0ad4('0xf')]+_0x0ad4('0x10')]){rpc[_0x46304d['channel']+_0x0ad4('0x10')]['addTags'](_0x46304d[_0x0ad4('0x11')]['id'],_0x471648)[_0x0ad4('0x12')](function(_0x591641){logger[_0x0ad4('0x13')](_0x0ad4('0x14'),_0x289ac5,_0xd72b89[0x1],_0x46304d[_0x0ad4('0xf')],_0x46304d[_0x0ad4('0x11')]['id']);})[_0x0ad4('0x15')](function(_0x53ef71){logger['error'](_0x0ad4('0xa'),_0x289ac5,JSON[_0x0ad4('0x16')](_0x53ef71));logger[_0x0ad4('0x13')](_0x0ad4('0xd'),_0x289ac5);})[_0x0ad4('0x17')](function(){_0x4a4693['next']();});}}}catch(_0x4f915d){logger[_0x0ad4('0x9')](_0x0ad4('0xa'),_0x289ac5,_[_0x0ad4('0x18')](_0x4f915d)?JSON[_0x0ad4('0x16')](_0x4f915d):_0x4f915d);logger[_0x0ad4('0x13')](_0x0ad4('0xd'),_0x289ac5);_0x4a4693['next']();}};}; \ 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 3edd6e3..9dae3e0 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x163b39,_0x1cd84b){var _0x11f441=function(_0x215b8e){while(--_0x215b8e){_0x163b39['push'](_0x163b39['shift']());}};_0x11f441(++_0x1cd84b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x3c653a,_0x44592e){var _0x32c1bd=function(_0x2898c7){while(--_0x2898c7){_0x3c653a['push'](_0x3c653a['shift']());}};_0x32c1bd(++_0x44592e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 028bde2..78090a6 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 _0xcc2e=['length','existsSync','join','app','.js','toLowerCase','appdata','mail','push','slice','dialogflowv2','split','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','Push\x20new\x20rule','\x20|\x20','error','execute','info','Applications\x20executed','complete','stack','agent','agents','busy','busyQueue','emit','QueueReport','update','UserId','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray'];(function(_0x2bf6f9,_0x14c39b){var _0xe910af=function(_0x4f7533){while(--_0x4f7533){_0x2bf6f9['push'](_0x2bf6f9['shift']());}};_0xe910af(++_0x14c39b);}(_0xcc2e,0x14e));var _0xecc2=function(_0x135728,_0x1acd68){_0x135728=_0x135728-0x0;var _0x75d48b=_0xcc2e[_0x135728];return _0x75d48b;};'use strict';var _=require(_0xecc2('0x0'));var util=require(_0xecc2('0x1'));var path=require(_0xecc2('0x2'));var fs=require('fs');var jayson=require(_0xecc2('0x3'));var BPromise=require(_0xecc2('0x4'));var uuid=require(_0xecc2('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0xecc2('0x6')),'mailQueueReport':require(_0xecc2('0x7')),'chatQueueReport':require(_0xecc2('0x8')),'smsQueueReport':require(_0xecc2('0x9')),'faxQueueReport':require(_0xecc2('0xa')),'whatsappQueueReport':require(_0xecc2('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0xfc5ff6,_0x2899f5,_0x4304f5){return util[_0xecc2('0xc')](_0xecc2('0xd'),_0xfc5ff6,_0x2899f5||0x0,_0x4304f5||0x0);}function getIntervals(_0x2216b3,_0x49629b){var _0x57c8b5=[];if(!_[_0xecc2('0xe')](_0x49629b[_0xecc2('0xf')])&&!_[_0xecc2('0xe')](_0x2216b3[_0x49629b[_0xecc2('0xf')]])&&!_[_0xecc2('0xe')](_0x2216b3[_0x49629b['IntervalId']][_0xecc2('0x10')])){_0x57c8b5=_[_0xecc2('0x11')](_0x2216b3[_0x49629b['IntervalId']][_0xecc2('0x10')],_0xecc2('0x12'));}else if(!_[_0xecc2('0xe')](_0x49629b[_0xecc2('0x12')])){_0x57c8b5=[_0x49629b[_0xecc2('0x12')]];}return _0x57c8b5;}exports[_0xecc2('0x13')]=function(_0x1881a2){_0x1881a2[_0xecc2('0x14')]={};return new BPromise(function(_0x691cb0,_0x122514){var _0x1b3341={'Start':function(_0x1bbfb1){var _0xf9de3f=this;return new Promise(function(_0x1ddd39,_0x14cf92){if(_0x1bbfb1){try{var _0x3b5232=[];var _0x2b29c2=getId(_0x1bbfb1[_0xecc2('0x15')],_0x1bbfb1[_0xecc2('0x16')]?_0x1bbfb1['message']['id']:0x0,_0x1bbfb1[_0xecc2('0x17')]?_0x1bbfb1[_0xecc2('0x17')]['id']:0x0);if(_0x1bbfb1[_0xecc2('0x18')]&&_[_0xecc2('0x19')](_0x1bbfb1['applications'])&&_0x1bbfb1[_0xecc2('0x18')][_0xecc2('0x1a')]){for(var _0x218641=0x0;_0x218641<_0x1bbfb1[_0xecc2('0x18')][_0xecc2('0x1a')];_0x218641+=0x1){var _0x22310e=_0x1bbfb1[_0xecc2('0x18')][_0x218641];if(fs[_0xecc2('0x1b')](path[_0xecc2('0x1c')](__dirname,_0xecc2('0x18'),_0x22310e[_0xecc2('0x1d')]+_0xecc2('0x1e')))){var _0x5d34b4=[];switch(_0x22310e[_0xecc2('0x1d')][_0xecc2('0x1f')]()){case'autoreply':var _0x455db4=_0x22310e[_0xecc2('0x20')]['split'](',');if(_0x1bbfb1[_0xecc2('0x15')]===_0xecc2('0x21')){_0x5d34b4[_0xecc2('0x22')](_0x455db4[0x0]);_0x5d34b4[_0xecc2('0x22')](_0x455db4[0x1]);_0x5d34b4[_0xecc2('0x22')](_0x455db4[_0xecc2('0x23')](0x2,_0x455db4[_0xecc2('0x1a')])[_0xecc2('0x1c')](','));}else{_0x5d34b4[_0xecc2('0x22')](_0x455db4[0x0]);_0x5d34b4['push'](_0x455db4[_0xecc2('0x23')](0x1,_0x455db4[_0xecc2('0x1a')])[_0xecc2('0x1c')](','));}break;case'dialogflow':var _0x1c196e=_0x22310e[_0xecc2('0x20')]['split'](',');_0x5d34b4[_0xecc2('0x22')](_0x1c196e[0x0]);_0x5d34b4[_0xecc2('0x22')](_0x1c196e[0x1]);_0x5d34b4[_0xecc2('0x22')](_0x1c196e[_0xecc2('0x23')](0x2,_0x1c196e[_0xecc2('0x1a')])[_0xecc2('0x1c')](','));break;case _0xecc2('0x24'):var _0x3ce77f=_0x22310e['appdata'][_0xecc2('0x25')](',');_0x5d34b4[_0xecc2('0x22')](_0x3ce77f[0x0]);_0x5d34b4[_0xecc2('0x22')](_0x3ce77f[0x1]);_0x5d34b4[_0xecc2('0x22')](_0x3ce77f[0x2]);_0x5d34b4[_0xecc2('0x22')](_0x3ce77f[0x3]);_0x5d34b4[_0xecc2('0x22')](_0x3ce77f[_0xecc2('0x23')](0x4,_0x3ce77f[_0xecc2('0x1a')])[_0xecc2('0x1c')](','));break;case _0xecc2('0x26'):var _0x3140f7=_0x22310e['appdata'][_0xecc2('0x25')](',');_0x5d34b4['push'](_0x3140f7[0x0]);_0x5d34b4[_0xecc2('0x22')](_0x3140f7[0x1]);_0x5d34b4['push'](_0x3140f7[0x2]);_0x5d34b4['push'](_0x3140f7[0x3]);_0x5d34b4[_0xecc2('0x22')](_0x3140f7['slice'](0x4,_0x3140f7[_0xecc2('0x1a')])[_0xecc2('0x1c')](','));break;case'message':_0x5d34b4[_0xecc2('0x22')](_0x22310e[_0xecc2('0x20')]);break;case _0xecc2('0x27'):_0x5d34b4['push'](_0x22310e[_0xecc2('0x28')]);_0x5d34b4[_0xecc2('0x22')](_0x22310e['appdata']);break;default:_0x5d34b4=_[_0xecc2('0xe')](_0x22310e[_0xecc2('0x20')])?[]:_0x22310e[_0xecc2('0x20')][_0xecc2('0x25')](',');}var _0x2b1ad1={'id':util[_0xecc2('0xc')](_0xecc2('0x29'),_0x2b29c2,_0x22310e['id'],_0x22310e[_0xecc2('0x1d')]),'condition':require(_0xecc2('0x2a'))[_0xecc2('0x2b')](_0x2b29c2,getIntervals(_0x1881a2[_0xecc2('0x2c')],_0x22310e),_0x1881a2),'consequence':require(_0xecc2('0x2d')+_0x22310e[_0xecc2('0x1d')])[_0xecc2('0x2e')](_0x2b29c2,_0x5d34b4,_0x1881a2,_0x1bbfb1),'p':_0x22310e['priority']||0x0};logger['info'](_0xecc2('0x2f'),_0x2b1ad1['id'],'on\x20interval',getIntervals(_0x1881a2[_0xecc2('0x2c')],_0x22310e)['join'](_0xecc2('0x30')));_0x3b5232[_0xecc2('0x22')](_0x2b1ad1);}else{logger[_0xecc2('0x31')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xecc2('0x1c')](__dirname,_0xecc2('0x18'),_0x22310e[_0xecc2('0x1d')]+_0xecc2('0x1e')));}}_0x1881a2['rules'][_0x2b29c2]=new RuleEngine(_0x3b5232);_0x1881a2[_0xecc2('0x14')][_0x2b29c2][_0xecc2('0x32')](_0x1bbfb1,function(_0x1219f7){logger[_0xecc2('0x33')](_0xecc2('0x34'),JSON['stringify'](_0x1219f7['matchPath']));if(_0x1881a2[_0xecc2('0x14')][_0x2b29c2]){_0x1881a2[_0xecc2('0x14')][_0x2b29c2]['emit'](_0xecc2('0x35'));}});return _0x1ddd39({'code':0xc8,'message':_0x1bbfb1});}else{logger[_0xecc2('0x33')]('No\x20applications\x20to\x20execute');return _0x1ddd39({'code':0xc8,'message':_0x1bbfb1});}}catch(_0x17e656){logger['error'](_0x17e656[_0xecc2('0x36')]);return _0x14cf92(_0xf9de3f[_0xecc2('0x31')](0x1f4,_0x17e656));}}return _0x14cf92('routing\x20is\x20empty');});},'AcceptMessage':function(_0x46b83a){var _0x928132=this;return new Promise(function(_0x671060,_0x45d267){if(_0x46b83a['agent']&&_0x46b83a[_0xecc2('0x37')]['id']){if(_0x1881a2[_0xecc2('0x38')][_0x46b83a['agent']['id']]){_0x1881a2[_0xecc2('0x38')][_0x46b83a[_0xecc2('0x37')]['id']][_0xecc2('0x39')]=![];_0x1881a2[_0xecc2('0x38')][_0x46b83a[_0xecc2('0x37')]['id']][_0xecc2('0x3a')]=undefined;}}if(_0x46b83a[_0xecc2('0x16')]&&_0x46b83a[_0xecc2('0x16')]['id']){try{var _0x39e270=getId(_0x46b83a['channel'],_0x46b83a[_0xecc2('0x16')]?_0x46b83a[_0xecc2('0x16')]['id']:0x0,_0x46b83a[_0xecc2('0x17')]?_0x46b83a['interaction']['id']:0x0);if(_0x1881a2['rules'][_0x39e270]){_0x1881a2[_0xecc2('0x14')][_0x39e270][_0xecc2('0x3b')]('end');if(rpc[_0x46b83a['channel']+_0xecc2('0x3c')]){rpc[_0x46b83a[_0xecc2('0x15')]+_0xecc2('0x3c')][_0xecc2('0x3d')](_0x39e270,{'UserId':_0x46b83a[_0xecc2('0x16')][_0xecc2('0x3e')]})['catch'](function(_0x554c92){logger[_0xecc2('0x31')]('error\x20update\x20queue\x20report');});}}return _0x671060({'code':0xc8,'message':_0x46b83a});}catch(_0x4dcdb8){logger[_0xecc2('0x31')](_0x4dcdb8[_0xecc2('0x36')]);return _0x45d267(_0x928132[_0xecc2('0x31')](0x1f4,_0x4dcdb8));}}logger[_0xecc2('0x31')](_0xecc2('0x3f'));return _0x45d267(_0x928132[_0xecc2('0x31')](0x1f4,_0xecc2('0x3f')));});},'RejectMessage':function(_0x4aa20b){var _0x5bdd4f=this;return new Promise(function(_0x4593cc,_0x5a0d96){if(_0x4aa20b[_0xecc2('0x37')]&&_0x4aa20b[_0xecc2('0x37')]['id']){try{if(_0x1881a2[_0xecc2('0x38')][_0x4aa20b[_0xecc2('0x37')]['id']]){_0x1881a2[_0xecc2('0x38')][_0x4aa20b[_0xecc2('0x37')]['id']][_0xecc2('0x39')]=![];_0x1881a2[_0xecc2('0x38')][_0x4aa20b[_0xecc2('0x37')]['id']][_0xecc2('0x3a')]=undefined;}return _0x4593cc({'code':0xc8,'message':_0x4aa20b});}catch(_0x58568c){logger[_0xecc2('0x31')](_0x58568c['stack']);return _0x5a0d96(_0x5bdd4f[_0xecc2('0x31')](0x1f4,_0x58568c));}}logger[_0xecc2('0x31')](_0xecc2('0x3f'));return _0x5a0d96(_0x5bdd4f[_0xecc2('0x31')](0x1f4,_0xecc2('0x3f')));});},'AbandonInteraction':function(_0x535867){var _0x7939a0=this;return new Promise(function(_0x725bf3,_0x9ff0fe){if(_0x535867[_0xecc2('0x15')]&&_0x535867[_0xecc2('0x17')]&&_0x535867[_0xecc2('0x17')]['id']){try{var _0x2e1ad7=getId(_0x535867[_0xecc2('0x15')],_0x535867['message']?_0x535867[_0xecc2('0x16')]['id']:0x0,_0x535867[_0xecc2('0x17')]?_0x535867[_0xecc2('0x17')]['id']:0x0);if(_0x1881a2[_0xecc2('0x14')][_0x2e1ad7]){_0x1881a2[_0xecc2('0x14')][_0x2e1ad7][_0xecc2('0x3b')](_0xecc2('0x40'));}return _0x725bf3({'code':0xc8,'message':_0x535867});}catch(_0x5837f6){logger[_0xecc2('0x31')](_0x5837f6['stack']);return _0x9ff0fe(_0x7939a0[_0xecc2('0x31')](0x1f4,_0x5837f6));}}logger[_0xecc2('0x31')](_0xecc2('0x3f'));return _0x9ff0fe(_0x7939a0[_0xecc2('0x31')](0x1f4,_0xecc2('0x3f')));});},'AgentCapacity':function(_0x3fdbb7){var _0x55f69a=this;return new Promise(function(_0x14b7c8,_0x5a8866){if(_0x1881a2['agents'][_0xecc2('0x41')](_0x3fdbb7['id'])){for(var _0x318737 in _0x3fdbb7[_0xecc2('0x42')]){if(_0x3fdbb7[_0xecc2('0x42')][_0xecc2('0x41')](_0x318737)){if(_0x1881a2[_0xecc2('0x38')][_0x3fdbb7['id']]['hasOwnProperty'](_0x318737+_0xecc2('0x43'))){_0x1881a2[_0xecc2('0x38')][_0x3fdbb7['id']][_0x318737+_0xecc2('0x43')]=parseInt(_0x3fdbb7[_0xecc2('0x42')][_0x318737],0xa);}}}_0x1881a2[_0xecc2('0x38')][_0x3fdbb7['id']]['updateRealtime']();return _0x14b7c8({'code':0xc8,'message':_0x1881a2[_0xecc2('0x38')][_0x3fdbb7['id']]});}else{return _0x5a8866(_0x55f69a['error'](0x1f4,_0xecc2('0x44')));}});},'Agents':function(_0x59e1e0){return new Promise(function(_0x25b4d0,_0x156d8a){var _0x490981=_['values'](_0x1881a2[_0xecc2('0x38')]);_0x25b4d0({'count':_0x490981[_0xecc2('0x1a')],'rows':_0x490981});});},'ChatQueues':function(_0x11e5bf){return new Promise(function(_0x52af14,_0xb69218){var _0x361607=[];for(var _0x32fcf9 in _0x1881a2[_0xecc2('0x45')]){if(_0x1881a2['chatQueues']['hasOwnProperty'](_0x32fcf9)){var _0x7edb82=_0x1881a2[_0xecc2('0x45')][_0x32fcf9];var _0x26fa7d={'id':_0x7edb82['id'],'available':_0x7edb82[_0xecc2('0x46')],'loggedIn':_0x7edb82[_0xecc2('0x47')],'name':_0x7edb82[_0xecc2('0x48')],'paused':_0x7edb82['paused'],'waiting':_0x7edb82[_0xecc2('0x49')]};_0x361607[_0xecc2('0x22')](_0x26fa7d);}}_0x52af14({'count':_0x361607[_0xecc2('0x1a')],'rows':_0x361607});});},'MailQueues':function(_0x548eca){return new Promise(function(_0x1d7b63,_0x1a1e6e){var _0x3f7238=[];for(var _0x5f78bb in _0x1881a2[_0xecc2('0x4a')]){if(_0x1881a2['mailQueues']['hasOwnProperty'](_0x5f78bb)){var _0xf6a081=_0x1881a2[_0xecc2('0x4a')][_0x5f78bb];var _0x34dda1={'id':_0xf6a081['id'],'available':_0xf6a081['available'],'loggedIn':_0xf6a081[_0xecc2('0x47')],'name':_0xf6a081[_0xecc2('0x48')],'paused':_0xf6a081[_0xecc2('0x4b')],'waiting':_0xf6a081[_0xecc2('0x49')]};_0x3f7238['push'](_0x34dda1);}}_0x1d7b63({'count':_0x3f7238[_0xecc2('0x1a')],'rows':_0x3f7238});});},'OpenchannelQueues':function(_0x4d5a63){return new Promise(function(_0x2d2f1f,_0x4ed2f4){var _0x3477f0=[];for(var _0x145688 in _0x1881a2['openchannelQueues']){if(_0x1881a2[_0xecc2('0x4c')][_0xecc2('0x41')](_0x145688)){var _0x55fa=_0x1881a2[_0xecc2('0x4c')][_0x145688];var _0x4c716e={'id':_0x55fa['id'],'available':_0x55fa['available'],'loggedIn':_0x55fa['loggedIn'],'name':_0x55fa[_0xecc2('0x48')],'paused':_0x55fa[_0xecc2('0x4b')],'waiting':_0x55fa[_0xecc2('0x49')]};_0x3477f0['push'](_0x4c716e);}}_0x2d2f1f({'count':_0x3477f0['length'],'rows':_0x3477f0});});},'SmsQueues':function(_0x1321ca){return new Promise(function(_0x389e35,_0x2cd51b){var _0x20271f=[];for(var _0x3905d7 in _0x1881a2['smsQueues']){if(_0x1881a2['smsQueues'][_0xecc2('0x41')](_0x3905d7)){var _0x1ab61c=_0x1881a2[_0xecc2('0x4d')][_0x3905d7];var _0x5d7b09={'id':_0x1ab61c['id'],'available':_0x1ab61c[_0xecc2('0x46')],'loggedIn':_0x1ab61c[_0xecc2('0x47')],'name':_0x1ab61c['name'],'paused':_0x1ab61c['paused'],'waiting':_0x1ab61c[_0xecc2('0x49')]};_0x20271f['push'](_0x5d7b09);}}_0x389e35({'count':_0x20271f[_0xecc2('0x1a')],'rows':_0x20271f});});},'FaxQueues':function(_0x3df32c){return new Promise(function(_0x1cb7ec,_0x50b2ac){var _0x6b6d46=[];for(var _0x16e176 in _0x1881a2[_0xecc2('0x4e')]){if(_0x1881a2[_0xecc2('0x4e')][_0xecc2('0x41')](_0x16e176)){var _0x2c3966=_0x1881a2[_0xecc2('0x4e')][_0x16e176];var _0x3da3e8={'id':_0x2c3966['id'],'available':_0x2c3966['available'],'loggedIn':_0x2c3966[_0xecc2('0x47')],'name':_0x2c3966['name'],'paused':_0x2c3966[_0xecc2('0x4b')],'waiting':_0x2c3966[_0xecc2('0x49')]};_0x6b6d46[_0xecc2('0x22')](_0x3da3e8);}}_0x1cb7ec({'count':_0x6b6d46[_0xecc2('0x1a')],'rows':_0x6b6d46});});},'WhatsappQueues':function(_0x43d9fd){return new Promise(function(_0x2c55e6,_0x2c5765){var _0x5a1458=[];for(var _0x12d148 in _0x1881a2[_0xecc2('0x4f')]){if(_0x1881a2['whatsappQueues']['hasOwnProperty'](_0x12d148)){var _0x4ca3a9=_0x1881a2['whatsappQueues'][_0x12d148];var _0x535f79={'id':_0x4ca3a9['id'],'available':_0x4ca3a9[_0xecc2('0x46')],'loggedIn':_0x4ca3a9['loggedIn'],'name':_0x4ca3a9[_0xecc2('0x48')],'paused':_0x4ca3a9[_0xecc2('0x4b')],'waiting':_0x4ca3a9['waiting']};_0x5a1458[_0xecc2('0x22')](_0x535f79);}}_0x2c55e6({'count':_0x5a1458[_0xecc2('0x1a')],'rows':_0x5a1458});});},'ChatQueuesWaitingInteractions':function(_0x1284f2){return new Promise(function(_0x59fc75,_0x190905){var _0x5225f0=_[_0xecc2('0x50')](_0x1881a2[_0xecc2('0x51')]);_0x59fc75({'count':_0x5225f0[_0xecc2('0x1a')],'rows':_0x5225f0});});},'MailQueuesWaitingInteractions':function(_0x4f14d7){return new Promise(function(_0x44ee9a,_0x4bc702){var _0x4436c3=_[_0xecc2('0x50')](_0x1881a2[_0xecc2('0x52')]);_0x44ee9a({'count':_0x4436c3['length'],'rows':_0x4436c3});});},'OpenchannelQueuesWaitingInteractions':function(_0x39ae64){return new Promise(function(_0xe5f7de,_0x316729){var _0x5eb2a1=_[_0xecc2('0x50')](_0x1881a2[_0xecc2('0x53')]);_0xe5f7de({'count':_0x5eb2a1[_0xecc2('0x1a')],'rows':_0x5eb2a1});});},'SmsQueuesWaitingInteractions':function(_0x376ea5){return new Promise(function(_0x49d7f9,_0x1bd8e2){var _0xc45df4=_[_0xecc2('0x50')](_0x1881a2[_0xecc2('0x54')]);_0x49d7f9({'count':_0xc45df4['length'],'rows':_0xc45df4});});},'FaxQueuesWaitingInteractions':function(_0x1b107d){return new Promise(function(_0x3a00ba,_0x10626b){var _0x2bcb6b=_['values'](_0x1881a2['faxQueuesWaitingInteractions']);_0x3a00ba({'count':_0x2bcb6b[_0xecc2('0x1a')],'rows':_0x2bcb6b});});},'WhatsappQueuesWaitingInteractions':function(_0x4ae3a8){return new Promise(function(_0x6cdeba,_0x2d45fa){var _0x110fbc=_[_0xecc2('0x50')](_0x1881a2[_0xecc2('0x55')]);_0x6cdeba({'count':_0x110fbc[_0xecc2('0x1a')],'rows':_0x110fbc});});}};var _0x1c484c=jayson[_0xecc2('0x56')](_0x1b3341)[_0xecc2('0x57')]();_0x1c484c['on'](_0xecc2('0x31'),function(_0xa3cd18){logger['error'](JSON['stringify'](_0xa3cd18));return _0x122514(_0xa3cd18);});_0x1c484c[_0xecc2('0x13')](0x232c,'127.0.0.1',function(){console['log'](_0xecc2('0x58'),0x232c);return _0x691cb0(_0xecc2('0x59')+0x232c);});});}; \ No newline at end of file +var _0xbe0f=['available','loggedIn','paused','waiting','mailQueues','openchannelQueues','smsQueues','name','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','bluebird','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','IntervalId','isNil','map','Intervals','interval','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','split','mail','push','slice','dialogflowv2','amazonlex','TagId','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','execute','Applications\x20executed','emit','complete','error','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','stack','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues'];(function(_0xa0f37d,_0x3153ca){var _0x57139c=function(_0x4df0f0){while(--_0x4df0f0){_0xa0f37d['push'](_0xa0f37d['shift']());}};_0x57139c(++_0x3153ca);}(_0xbe0f,0x17e));var _0xfbe0=function(_0xd341b,_0x3100ba){_0xd341b=_0xd341b-0x0;var _0x86bd5a=_0xbe0f[_0xd341b];return _0x86bd5a;};'use strict';var _=require(_0xfbe0('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0xfbe0('0x1'));var BPromise=require(_0xfbe0('0x2'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require(_0xfbe0('0x3'))(_0xfbe0('0x4'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xfbe0('0x5')),'chatQueueReport':require(_0xfbe0('0x6')),'smsQueueReport':require(_0xfbe0('0x7')),'faxQueueReport':require(_0xfbe0('0x8')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x48657a,_0x146358,_0x373736){return util[_0xfbe0('0x9')](_0xfbe0('0xa'),_0x48657a,_0x146358||0x0,_0x373736||0x0);}function getIntervals(_0x3d3eab,_0x54f642){var _0x135498=[];if(!_['isNil'](_0x54f642[_0xfbe0('0xb')])&&!_[_0xfbe0('0xc')](_0x3d3eab[_0x54f642[_0xfbe0('0xb')]])&&!_[_0xfbe0('0xc')](_0x3d3eab[_0x54f642[_0xfbe0('0xb')]]['Intervals'])){_0x135498=_[_0xfbe0('0xd')](_0x3d3eab[_0x54f642['IntervalId']][_0xfbe0('0xe')],_0xfbe0('0xf'));}else if(!_[_0xfbe0('0xc')](_0x54f642[_0xfbe0('0xf')])){_0x135498=[_0x54f642[_0xfbe0('0xf')]];}return _0x135498;}exports['listen']=function(_0x3e39a2){_0x3e39a2[_0xfbe0('0x10')]={};return new BPromise(function(_0x535c1d,_0x17bbfb){var _0x59d7ab={'Start':function(_0x4431b1){var _0x392cd9=this;return new Promise(function(_0x227ee2,_0x2f0dc2){if(_0x4431b1){try{var _0x39ed0=[];var _0x430a95=getId(_0x4431b1[_0xfbe0('0x11')],_0x4431b1[_0xfbe0('0x12')]?_0x4431b1[_0xfbe0('0x12')]['id']:0x0,_0x4431b1[_0xfbe0('0x13')]?_0x4431b1[_0xfbe0('0x13')]['id']:0x0);if(_0x4431b1[_0xfbe0('0x14')]&&_[_0xfbe0('0x15')](_0x4431b1['applications'])&&_0x4431b1[_0xfbe0('0x14')][_0xfbe0('0x16')]){for(var _0x186342=0x0;_0x186342<_0x4431b1[_0xfbe0('0x14')][_0xfbe0('0x16')];_0x186342+=0x1){var _0x2224d5=_0x4431b1[_0xfbe0('0x14')][_0x186342];if(fs[_0xfbe0('0x17')](path[_0xfbe0('0x18')](__dirname,'applications',_0x2224d5[_0xfbe0('0x19')]+_0xfbe0('0x1a')))){var _0x57a6fb=[];switch(_0x2224d5[_0xfbe0('0x19')][_0xfbe0('0x1b')]()){case'autoreply':var _0x35eb91=_0x2224d5[_0xfbe0('0x1c')][_0xfbe0('0x1d')](',');if(_0x4431b1[_0xfbe0('0x11')]===_0xfbe0('0x1e')){_0x57a6fb['push'](_0x35eb91[0x0]);_0x57a6fb[_0xfbe0('0x1f')](_0x35eb91[0x1]);_0x57a6fb['push'](_0x35eb91['slice'](0x2,_0x35eb91[_0xfbe0('0x16')])[_0xfbe0('0x18')](','));}else{_0x57a6fb[_0xfbe0('0x1f')](_0x35eb91[0x0]);_0x57a6fb[_0xfbe0('0x1f')](_0x35eb91[_0xfbe0('0x20')](0x1,_0x35eb91[_0xfbe0('0x16')])['join'](','));}break;case'dialogflow':var _0x1af813=_0x2224d5['appdata'][_0xfbe0('0x1d')](',');_0x57a6fb[_0xfbe0('0x1f')](_0x1af813[0x0]);_0x57a6fb['push'](_0x1af813[0x1]);_0x57a6fb['push'](_0x1af813[_0xfbe0('0x20')](0x2,_0x1af813['length'])['join'](','));break;case _0xfbe0('0x21'):var _0xcda0c7=_0x2224d5['appdata'][_0xfbe0('0x1d')](',');_0x57a6fb['push'](_0xcda0c7[0x0]);_0x57a6fb[_0xfbe0('0x1f')](_0xcda0c7[0x1]);_0x57a6fb[_0xfbe0('0x1f')](_0xcda0c7[0x2]);_0x57a6fb[_0xfbe0('0x1f')](_0xcda0c7[0x3]);_0x57a6fb['push'](_0xcda0c7[_0xfbe0('0x20')](0x4,_0xcda0c7['length'])[_0xfbe0('0x18')](','));break;case _0xfbe0('0x22'):var _0x1494e4=_0x2224d5[_0xfbe0('0x1c')][_0xfbe0('0x1d')](',');_0x57a6fb[_0xfbe0('0x1f')](_0x1494e4[0x0]);_0x57a6fb[_0xfbe0('0x1f')](_0x1494e4[0x1]);_0x57a6fb[_0xfbe0('0x1f')](_0x1494e4[0x2]);_0x57a6fb[_0xfbe0('0x1f')](_0x1494e4[0x3]);_0x57a6fb[_0xfbe0('0x1f')](_0x1494e4[_0xfbe0('0x20')](0x4,_0x1494e4[_0xfbe0('0x16')])[_0xfbe0('0x18')](','));break;case _0xfbe0('0x12'):_0x57a6fb['push'](_0x2224d5['appdata']);break;case'tag':_0x57a6fb[_0xfbe0('0x1f')](_0x2224d5[_0xfbe0('0x23')]);_0x57a6fb[_0xfbe0('0x1f')](_0x2224d5['appdata']);break;default:_0x57a6fb=_[_0xfbe0('0xc')](_0x2224d5['appdata'])?[]:_0x2224d5[_0xfbe0('0x1c')][_0xfbe0('0x1d')](',');}var _0x26724e={'id':util[_0xfbe0('0x9')](_0xfbe0('0x24'),_0x430a95,_0x2224d5['id'],_0x2224d5[_0xfbe0('0x19')]),'condition':require(_0xfbe0('0x25'))['condition'](_0x430a95,getIntervals(_0x3e39a2[_0xfbe0('0x26')],_0x2224d5),_0x3e39a2),'consequence':require(_0xfbe0('0x27')+_0x2224d5[_0xfbe0('0x19')])[_0xfbe0('0x28')](_0x430a95,_0x57a6fb,_0x3e39a2,_0x4431b1),'p':_0x2224d5[_0xfbe0('0x29')]||0x0};logger[_0xfbe0('0x2a')](_0xfbe0('0x2b'),_0x26724e['id'],_0xfbe0('0x2c'),getIntervals(_0x3e39a2[_0xfbe0('0x26')],_0x2224d5)['join']('\x20|\x20'));_0x39ed0[_0xfbe0('0x1f')](_0x26724e);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x2224d5[_0xfbe0('0x19')]+_0xfbe0('0x1a')));}}_0x3e39a2[_0xfbe0('0x10')][_0x430a95]=new RuleEngine(_0x39ed0);_0x3e39a2['rules'][_0x430a95][_0xfbe0('0x2d')](_0x4431b1,function(_0x16bca5){logger[_0xfbe0('0x2a')](_0xfbe0('0x2e'),JSON['stringify'](_0x16bca5['matchPath']));if(_0x3e39a2['rules'][_0x430a95]){_0x3e39a2[_0xfbe0('0x10')][_0x430a95][_0xfbe0('0x2f')](_0xfbe0('0x30'));}});return _0x227ee2({'code':0xc8,'message':_0x4431b1});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x227ee2({'code':0xc8,'message':_0x4431b1});}}catch(_0xdff953){logger[_0xfbe0('0x31')](_0xdff953['stack']);return _0x2f0dc2(_0x392cd9[_0xfbe0('0x31')](0x1f4,_0xdff953));}}return _0x2f0dc2(_0xfbe0('0x32'));});},'AcceptMessage':function(_0x575d0f){var _0x2402c1=this;return new Promise(function(_0x2fa0e2,_0x2f4d20){if(_0x575d0f[_0xfbe0('0x33')]&&_0x575d0f['agent']['id']){if(_0x3e39a2[_0xfbe0('0x34')][_0x575d0f[_0xfbe0('0x33')]['id']]){_0x3e39a2[_0xfbe0('0x34')][_0x575d0f[_0xfbe0('0x33')]['id']]['busy']=![];_0x3e39a2[_0xfbe0('0x34')][_0x575d0f[_0xfbe0('0x33')]['id']][_0xfbe0('0x35')]=undefined;}}if(_0x575d0f[_0xfbe0('0x12')]&&_0x575d0f['message']['id']){try{var _0x16f67c=getId(_0x575d0f['channel'],_0x575d0f['message']?_0x575d0f[_0xfbe0('0x12')]['id']:0x0,_0x575d0f[_0xfbe0('0x13')]?_0x575d0f[_0xfbe0('0x13')]['id']:0x0);if(_0x3e39a2[_0xfbe0('0x10')][_0x16f67c]){_0x3e39a2['rules'][_0x16f67c]['emit'](_0xfbe0('0x36'));if(rpc[_0x575d0f[_0xfbe0('0x11')]+'QueueReport']){rpc[_0x575d0f[_0xfbe0('0x11')]+_0xfbe0('0x37')][_0xfbe0('0x38')](_0x16f67c,{'UserId':_0x575d0f['message'][_0xfbe0('0x39')]})[_0xfbe0('0x3a')](function(_0x6c3701){logger[_0xfbe0('0x31')](_0xfbe0('0x3b'));});}}return _0x2fa0e2({'code':0xc8,'message':_0x575d0f});}catch(_0x466fac){logger[_0xfbe0('0x31')](_0x466fac['stack']);return _0x2f4d20(_0x2402c1[_0xfbe0('0x31')](0x1f4,_0x466fac));}}logger['error'](_0xfbe0('0x3c'));return _0x2f4d20(_0x2402c1[_0xfbe0('0x31')](0x1f4,_0xfbe0('0x3c')));});},'RejectMessage':function(_0x3ef100){var _0x3f71ab=this;return new Promise(function(_0x50be0,_0x483a1e){if(_0x3ef100[_0xfbe0('0x33')]&&_0x3ef100[_0xfbe0('0x33')]['id']){try{if(_0x3e39a2[_0xfbe0('0x34')][_0x3ef100[_0xfbe0('0x33')]['id']]){_0x3e39a2[_0xfbe0('0x34')][_0x3ef100['agent']['id']]['busy']=![];_0x3e39a2[_0xfbe0('0x34')][_0x3ef100[_0xfbe0('0x33')]['id']][_0xfbe0('0x35')]=undefined;}return _0x50be0({'code':0xc8,'message':_0x3ef100});}catch(_0x4fc5bc){logger[_0xfbe0('0x31')](_0x4fc5bc[_0xfbe0('0x3d')]);return _0x483a1e(_0x3f71ab[_0xfbe0('0x31')](0x1f4,_0x4fc5bc));}}logger[_0xfbe0('0x31')]('message\x20is\x20empty');return _0x483a1e(_0x3f71ab[_0xfbe0('0x31')](0x1f4,_0xfbe0('0x3c')));});},'AbandonInteraction':function(_0x5e6de8){var _0x451a2a=this;return new Promise(function(_0x37e535,_0x15da67){if(_0x5e6de8[_0xfbe0('0x11')]&&_0x5e6de8[_0xfbe0('0x13')]&&_0x5e6de8['interaction']['id']){try{var _0x2109ea=getId(_0x5e6de8[_0xfbe0('0x11')],_0x5e6de8[_0xfbe0('0x12')]?_0x5e6de8[_0xfbe0('0x12')]['id']:0x0,_0x5e6de8[_0xfbe0('0x13')]?_0x5e6de8[_0xfbe0('0x13')]['id']:0x0);if(_0x3e39a2['rules'][_0x2109ea]){_0x3e39a2[_0xfbe0('0x10')][_0x2109ea]['emit'](_0xfbe0('0x36'));}return _0x37e535({'code':0xc8,'message':_0x5e6de8});}catch(_0x1418bb){logger[_0xfbe0('0x31')](_0x1418bb[_0xfbe0('0x3d')]);return _0x15da67(_0x451a2a[_0xfbe0('0x31')](0x1f4,_0x1418bb));}}logger[_0xfbe0('0x31')](_0xfbe0('0x3c'));return _0x15da67(_0x451a2a[_0xfbe0('0x31')](0x1f4,_0xfbe0('0x3c')));});},'AgentCapacity':function(_0x3d2974){var _0x408678=this;return new Promise(function(_0x28a45c,_0x16a151){if(_0x3e39a2[_0xfbe0('0x34')][_0xfbe0('0x3e')](_0x3d2974['id'])){for(var _0x55a1d9 in _0x3d2974[_0xfbe0('0x3f')]){if(_0x3d2974['capacity'][_0xfbe0('0x3e')](_0x55a1d9)){if(_0x3e39a2[_0xfbe0('0x34')][_0x3d2974['id']][_0xfbe0('0x3e')](_0x55a1d9+_0xfbe0('0x40'))){_0x3e39a2[_0xfbe0('0x34')][_0x3d2974['id']][_0x55a1d9+_0xfbe0('0x40')]=parseInt(_0x3d2974[_0xfbe0('0x3f')][_0x55a1d9],0xa);}}}_0x3e39a2[_0xfbe0('0x34')][_0x3d2974['id']][_0xfbe0('0x41')]();return _0x28a45c({'code':0xc8,'message':_0x3e39a2[_0xfbe0('0x34')][_0x3d2974['id']]});}else{return _0x16a151(_0x408678['error'](0x1f4,_0xfbe0('0x42')));}});},'Agents':function(_0x5ef3d1){return new Promise(function(_0x20408d,_0x4b5be2){var _0x4a1c67=_['values'](_0x3e39a2[_0xfbe0('0x34')]);_0x20408d({'count':_0x4a1c67['length'],'rows':_0x4a1c67});});},'ChatQueues':function(_0x5f04cc){return new Promise(function(_0x4a263b,_0x415b36){var _0x33236e=[];for(var _0x1f32b3 in _0x3e39a2[_0xfbe0('0x43')]){if(_0x3e39a2[_0xfbe0('0x43')][_0xfbe0('0x3e')](_0x1f32b3)){var _0x3e0eaa=_0x3e39a2[_0xfbe0('0x43')][_0x1f32b3];var _0x6dfa65={'id':_0x3e0eaa['id'],'available':_0x3e0eaa[_0xfbe0('0x44')],'loggedIn':_0x3e0eaa[_0xfbe0('0x45')],'name':_0x3e0eaa['name'],'paused':_0x3e0eaa[_0xfbe0('0x46')],'waiting':_0x3e0eaa[_0xfbe0('0x47')]};_0x33236e[_0xfbe0('0x1f')](_0x6dfa65);}}_0x4a263b({'count':_0x33236e[_0xfbe0('0x16')],'rows':_0x33236e});});},'MailQueues':function(_0x543a47){return new Promise(function(_0xf5a582,_0x22c49d){var _0x109a7d=[];for(var _0x1b9329 in _0x3e39a2[_0xfbe0('0x48')]){if(_0x3e39a2['mailQueues'][_0xfbe0('0x3e')](_0x1b9329)){var _0x532bd7=_0x3e39a2[_0xfbe0('0x48')][_0x1b9329];var _0xe2132c={'id':_0x532bd7['id'],'available':_0x532bd7[_0xfbe0('0x44')],'loggedIn':_0x532bd7[_0xfbe0('0x45')],'name':_0x532bd7['name'],'paused':_0x532bd7['paused'],'waiting':_0x532bd7[_0xfbe0('0x47')]};_0x109a7d[_0xfbe0('0x1f')](_0xe2132c);}}_0xf5a582({'count':_0x109a7d[_0xfbe0('0x16')],'rows':_0x109a7d});});},'OpenchannelQueues':function(_0x463452){return new Promise(function(_0x46b241,_0x23409f){var _0x17bed0=[];for(var _0x668648 in _0x3e39a2[_0xfbe0('0x49')]){if(_0x3e39a2[_0xfbe0('0x49')]['hasOwnProperty'](_0x668648)){var _0x69fc00=_0x3e39a2[_0xfbe0('0x49')][_0x668648];var _0x50475b={'id':_0x69fc00['id'],'available':_0x69fc00['available'],'loggedIn':_0x69fc00[_0xfbe0('0x45')],'name':_0x69fc00['name'],'paused':_0x69fc00[_0xfbe0('0x46')],'waiting':_0x69fc00['waiting']};_0x17bed0[_0xfbe0('0x1f')](_0x50475b);}}_0x46b241({'count':_0x17bed0[_0xfbe0('0x16')],'rows':_0x17bed0});});},'SmsQueues':function(_0xd8eb30){return new Promise(function(_0x2923f5,_0xeaba58){var _0x475894=[];for(var _0x3851c7 in _0x3e39a2[_0xfbe0('0x4a')]){if(_0x3e39a2[_0xfbe0('0x4a')]['hasOwnProperty'](_0x3851c7)){var _0x306b42=_0x3e39a2[_0xfbe0('0x4a')][_0x3851c7];var _0x14af86={'id':_0x306b42['id'],'available':_0x306b42[_0xfbe0('0x44')],'loggedIn':_0x306b42[_0xfbe0('0x45')],'name':_0x306b42[_0xfbe0('0x4b')],'paused':_0x306b42[_0xfbe0('0x46')],'waiting':_0x306b42[_0xfbe0('0x47')]};_0x475894['push'](_0x14af86);}}_0x2923f5({'count':_0x475894['length'],'rows':_0x475894});});},'FaxQueues':function(_0x1af225){return new Promise(function(_0x10f5cd,_0x5758ee){var _0x4e50a6=[];for(var _0x3e428 in _0x3e39a2[_0xfbe0('0x4c')]){if(_0x3e39a2['faxQueues'][_0xfbe0('0x3e')](_0x3e428)){var _0x1d410b=_0x3e39a2[_0xfbe0('0x4c')][_0x3e428];var _0x129c8f={'id':_0x1d410b['id'],'available':_0x1d410b['available'],'loggedIn':_0x1d410b['loggedIn'],'name':_0x1d410b[_0xfbe0('0x4b')],'paused':_0x1d410b[_0xfbe0('0x46')],'waiting':_0x1d410b[_0xfbe0('0x47')]};_0x4e50a6[_0xfbe0('0x1f')](_0x129c8f);}}_0x10f5cd({'count':_0x4e50a6[_0xfbe0('0x16')],'rows':_0x4e50a6});});},'WhatsappQueues':function(_0x43d0b7){return new Promise(function(_0x2d87ce,_0x431274){var _0x39c12d=[];for(var _0x5146c7 in _0x3e39a2[_0xfbe0('0x4d')]){if(_0x3e39a2['whatsappQueues']['hasOwnProperty'](_0x5146c7)){var _0x505d4a=_0x3e39a2[_0xfbe0('0x4d')][_0x5146c7];var _0x4258ce={'id':_0x505d4a['id'],'available':_0x505d4a[_0xfbe0('0x44')],'loggedIn':_0x505d4a['loggedIn'],'name':_0x505d4a[_0xfbe0('0x4b')],'paused':_0x505d4a[_0xfbe0('0x46')],'waiting':_0x505d4a[_0xfbe0('0x47')]};_0x39c12d[_0xfbe0('0x1f')](_0x4258ce);}}_0x2d87ce({'count':_0x39c12d[_0xfbe0('0x16')],'rows':_0x39c12d});});},'ChatQueuesWaitingInteractions':function(_0x2af1bb){return new Promise(function(_0x509471,_0x3f3dbf){var _0x1fe5c1=_['values'](_0x3e39a2[_0xfbe0('0x4e')]);_0x509471({'count':_0x1fe5c1[_0xfbe0('0x16')],'rows':_0x1fe5c1});});},'MailQueuesWaitingInteractions':function(_0x7933fd){return new Promise(function(_0x3548e5,_0x426790){var _0xa06810=_[_0xfbe0('0x4f')](_0x3e39a2[_0xfbe0('0x50')]);_0x3548e5({'count':_0xa06810[_0xfbe0('0x16')],'rows':_0xa06810});});},'OpenchannelQueuesWaitingInteractions':function(_0x4e9644){return new Promise(function(_0x381e70,_0x2ab7fa){var _0x5dab9d=_[_0xfbe0('0x4f')](_0x3e39a2['openchannelQueuesWaitingInteractions']);_0x381e70({'count':_0x5dab9d['length'],'rows':_0x5dab9d});});},'SmsQueuesWaitingInteractions':function(_0x1d783f){return new Promise(function(_0x5402d9,_0x20303f){var _0x18d61e=_[_0xfbe0('0x4f')](_0x3e39a2[_0xfbe0('0x51')]);_0x5402d9({'count':_0x18d61e['length'],'rows':_0x18d61e});});},'FaxQueuesWaitingInteractions':function(_0x2cc6b5){return new Promise(function(_0x5d3fe7,_0x421263){var _0x95ad32=_[_0xfbe0('0x4f')](_0x3e39a2[_0xfbe0('0x52')]);_0x5d3fe7({'count':_0x95ad32[_0xfbe0('0x16')],'rows':_0x95ad32});});},'WhatsappQueuesWaitingInteractions':function(_0xcd4738){return new Promise(function(_0x22d2f4,_0x26c46d){var _0x48c1f7=_[_0xfbe0('0x4f')](_0x3e39a2[_0xfbe0('0x53')]);_0x22d2f4({'count':_0x48c1f7[_0xfbe0('0x16')],'rows':_0x48c1f7});});}};var _0x21e039=jayson[_0xfbe0('0x54')](_0x59d7ab)[_0xfbe0('0x55')]();_0x21e039['on'](_0xfbe0('0x31'),function(_0x541cd7){logger[_0xfbe0('0x31')](JSON[_0xfbe0('0x56')](_0x541cd7));return _0x17bbfb(_0x541cd7);});_0x21e039[_0xfbe0('0x57')](0x232c,_0xfbe0('0x58'),function(){console['log'](_0xfbe0('0x59'),0x232c);return _0x535c1d('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 8ff6541..0b66ff5 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 _0x07d3=['client','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','jayson/promise','lodash','../../../config/logger','routing'];(function(_0x2608ad,_0x352cc5){var _0x18d27f=function(_0x38031c){while(--_0x38031c){_0x2608ad['push'](_0x2608ad['shift']());}};_0x18d27f(++_0x352cc5);}(_0x07d3,0xb5));var _0x307d=function(_0x1406df,_0x92068){_0x1406df=_0x1406df-0x0;var _0x3aec42=_0x07d3[_0x1406df];return _0x3aec42;};'use strict';var util=require(_0x307d('0x0'));var BPromise=require('bluebird');var jayson=require(_0x307d('0x1'));var _=require(_0x307d('0x2'));var logger=require(_0x307d('0x3'))(_0x307d('0x4'));var client=jayson[_0x307d('0x5')]['http']({'port':0x232a});function request(_0x54144e,_0x1b94a6){return new BPromise(function(_0x2faa9d,_0x4c1052){return client[_0x307d('0x6')](_0x54144e,_0x1b94a6)[_0x307d('0x7')](function(_0x354ed3){if(_0x354ed3['error']){return _0x4c1052(_0x354ed3[_0x307d('0x8')][_0x307d('0x9')]);}else{return _0x2faa9d(_0x354ed3[_0x307d('0xa')]);}})[_0x307d('0xb')](function(_0x518254){return _0x4c1052(_0x518254);});});}exports[_0x307d('0xc')]=function(_0x1d3edc,_0x459a2a,_0x2507be){return function(_0xcfbc82){if(_0x2507be[_0x307d('0xd')]&&!_0x2507be[_0x307d('0xd')][_0x1d3edc]){logger[_0x307d('0xe')](_0x307d('0xf'),_0x1d3edc);return _0xcfbc82['stop']();}var _0x24fd52=[];for(var _0x476fa4=0x0;_0x476fa4<_0x459a2a[_0x307d('0x10')];_0x476fa4+=0x1){_0x24fd52[_0x307d('0x11')](request(_0x307d('0x12'),{'command':util[_0x307d('0x13')](_0x307d('0x14'),_0x459a2a[_0x476fa4])})['then'](function(_0x47c0fd){return _0x47c0fd&&_0x47c0fd['message']&&_0x47c0fd[_0x307d('0x9')][_0x307d('0x15')]('true')>=0x0?!![]:![];})['catch'](function(_0x5b0bf6){logger[_0x307d('0x8')](_0x307d('0x16'),_0x1d3edc,_0x459a2a[_0x476fa4]);}));}BPromise[_0x307d('0x17')](_0x24fd52)[_0x307d('0x7')](function(_0x22cbc8){var _0xe7c591=_[_0x307d('0x18')](_0x22cbc8);logger['info'](_0x307d('0x19'),_0x1d3edc,_0x459a2a[_0x307d('0x1a')](_0x307d('0x1b')),_0xe7c591);_0xcfbc82[_0x307d('0x1c')](_0xe7c591);})[_0x307d('0xb')](function(_0x337a1d){console[_0x307d('0x1d')](_0x337a1d);logger[_0x307d('0x8')](_0x307d('0x19'),_0x1d3edc,_0x459a2a[_0x307d('0x1a')](_0x307d('0x1b')),_0x337a1d[_0x307d('0x1e')]);_0xcfbc82['stop']();});};}; \ No newline at end of file +var _0x23d0=['info','join','\x20|\x20','log','[%s][INTERVAL]\x20%s\x20%s','util','bluebird','../../../config/logger','client','http','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x23d0,0x144));var _0x023d=function(_0x41ffbc,_0x40a015){_0x41ffbc=_0x41ffbc-0x0;var _0x3391f6=_0x23d0[_0x41ffbc];return _0x3391f6;};'use strict';var util=require(_0x023d('0x0'));var BPromise=require(_0x023d('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x023d('0x2'))('routing');var client=jayson[_0x023d('0x3')][_0x023d('0x4')]({'port':0x232a});function request(_0x4969b5,_0x36e980){return new BPromise(function(_0x391df8,_0x2512e1){return client['request'](_0x4969b5,_0x36e980)[_0x023d('0x5')](function(_0x20a9c2){if(_0x20a9c2[_0x023d('0x6')]){return _0x2512e1(_0x20a9c2[_0x023d('0x6')][_0x023d('0x7')]);}else{return _0x391df8(_0x20a9c2[_0x023d('0x8')]);}})[_0x023d('0x9')](function(_0x308b55){return _0x2512e1(_0x308b55);});});}exports[_0x023d('0xa')]=function(_0x2bacbc,_0xca88a5,_0x113877){return function(_0x540ade){if(_0x113877[_0x023d('0xb')]&&!_0x113877[_0x023d('0xb')][_0x2bacbc]){logger['info'](_0x023d('0xc'),_0x2bacbc);return _0x540ade[_0x023d('0xd')]();}var _0x1b5343=[];for(var _0x53f4f9=0x0;_0x53f4f9<_0xca88a5[_0x023d('0xe')];_0x53f4f9+=0x1){_0x1b5343[_0x023d('0xf')](request(_0x023d('0x10'),{'command':util[_0x023d('0x11')](_0x023d('0x12'),_0xca88a5[_0x53f4f9])})[_0x023d('0x5')](function(_0x2cb269){return _0x2cb269&&_0x2cb269[_0x023d('0x7')]&&_0x2cb269[_0x023d('0x7')][_0x023d('0x13')](_0x023d('0x14'))>=0x0?!![]:![];})[_0x023d('0x9')](function(_0x1bb27a){logger[_0x023d('0x6')](_0x023d('0x15'),_0x2bacbc,_0xca88a5[_0x53f4f9]);}));}BPromise[_0x023d('0x16')](_0x1b5343)[_0x023d('0x5')](function(_0x5eb402){var _0x2e5212=_[_0x023d('0x17')](_0x5eb402);logger[_0x023d('0x18')]('[%s][INTERVAL]\x20%s\x20%s',_0x2bacbc,_0xca88a5[_0x023d('0x19')](_0x023d('0x1a')),_0x2e5212);_0x540ade['when'](_0x2e5212);})[_0x023d('0x9')](function(_0x5f1de9){console[_0x023d('0x1b')](_0x5f1de9);logger['error'](_0x023d('0x1c'),_0x2bacbc,_0xca88a5[_0x023d('0x19')](_0x023d('0x1a')),_0x5f1de9['stack']);_0x540ade[_0x023d('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e51bf26..2389174 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 _0xbfcc=['now','lastevent','called','connectedlinename','agentringnoanswer','isNil','debug','timeout','reason','holdtime','ringtime','push','error','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','talktime','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererexten','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','info','format','membername','interface','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','uniqueid'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xbfcc[_0x4de586];return _0x46baf5;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1a2fe0,_0x2d1386){utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1a2fe0['uniqueid'],_0x1a2fe0['channel'],_0x1a2fe0['queue'],_0x1a2fe0[_0xcbfc('0x3')],_0x1a2fe0[_0xcbfc('0x4')],_0x1a2fe0['calleridnum'],_0x1a2fe0[_0xcbfc('0x5')],_0x1a2fe0['lastevent']));if(_0x1a2fe0[_0xcbfc('0x6')]){utils[_0xcbfc('0x7')](_0x1a2fe0[_0xcbfc('0x6')])[_0xcbfc('0x8')](function(_0x4eff22){if(_0x4eff22){_0x1a2fe0[_0xcbfc('0x9')]=_0x4eff22[_0xcbfc('0x9')];_0x1a2fe0[_0xcbfc('0xa')]=_0x1a2fe0[_0xcbfc('0xb')]?_0x4eff22[_0xcbfc('0xc')]:![];_0x1a2fe0[_0xcbfc('0xd')]=_0x1a2fe0['agentacw']?_0x4eff22[_0xcbfc('0xe')]:0x0;}utils[_0xcbfc('0xf')](_0xcbfc('0x10'),_0x1a2fe0);});}else{utils[_0xcbfc('0xf')](_0xcbfc('0x10'),_0x1a2fe0);}if(_0x2d1386){delete transfers[_0x1a2fe0['uniqueid']];}else{delete agents[_0x1a2fe0[_0xcbfc('0x11')]];}}exports[_0xcbfc('0x12')]=function(_0x80d08d){try{utils['debug'](util[_0xcbfc('0x2')](_0xcbfc('0x13'),_0x80d08d[_0xcbfc('0x14')]),_0x80d08d);agents[_0x80d08d[_0xcbfc('0x11')]]=_0x80d08d;agents[_0x80d08d[_0xcbfc('0x11')]]['agentcalledAt']=utils[_0xcbfc('0x15')]();agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x16')]=_0xcbfc('0x17');agents[_0x80d08d['destuniqueid']]['connectedlinenum']=null;agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x18')]=null;utils[_0xcbfc('0x1')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x80d08d[_0xcbfc('0x14')],agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x3')],_0x80d08d['destuniqueid']));}catch(_0x3825d5){utils['error'](util[_0xcbfc('0x2')](_0xcbfc('0x13'),_0x80d08d[_0xcbfc('0x14')]),_0x3825d5);}};exports[_0xcbfc('0x19')]=function(_0x25c167){try{if(!_[_0xcbfc('0x1a')](agents[_0x25c167['destuniqueid']])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')]('[%s][agents][agentringnoanswer]',_0x25c167[_0xcbfc('0x14')]),_0x25c167);utils['info'](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x25c167[_0xcbfc('0x14')],agents[_0x25c167['destuniqueid']]['membername'],_0x25c167[_0xcbfc('0x11')]));agents[_0x25c167[_0xcbfc('0x11')]][_0xcbfc('0x19')]=!![];agents[_0x25c167[_0xcbfc('0x11')]]['agentringnoanswerAt']=utils[_0xcbfc('0x15')]();agents[_0x25c167['destuniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x1c');agents[_0x25c167['destuniqueid']][_0xcbfc('0x1d')]=_0xcbfc('0x1c');agents[_0x25c167['destuniqueid']][_0xcbfc('0x1e')]=_0x25c167[_0xcbfc('0x1f')]?parseInt(_0x25c167[_0xcbfc('0x1f')])/0x3e8:0x0;agents[_0x25c167[_0xcbfc('0x11')]]['talktime']=0x0;unanswered[_0xcbfc('0x20')](_0x25c167[_0xcbfc('0x11')]);}}catch(_0x4f632a){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')](_0xcbfc('0x22'),_0x25c167[_0xcbfc('0x14')]),_0x4f632a);}};exports[_0xcbfc('0x23')]=function(_0x19d2e){try{_[_0xcbfc('0x24')](agents,function(_0x5366cf,_0x41b68b){if(_0x5366cf[_0xcbfc('0x14')]==_0x19d2e[_0xcbfc('0x14')]&&!_[_0xcbfc('0x25')](unanswered,_0x5366cf['destuniqueid'])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x26'),_0x19d2e[_0xcbfc('0x14')]),_0x19d2e);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x27'),_0x19d2e['uniqueid'],_0x5366cf[_0xcbfc('0x3')],_0x5366cf[_0xcbfc('0x11')]));_0x5366cf['agentringnoanswer']=!![];_0x5366cf[_0xcbfc('0x28')]=utils[_0xcbfc('0x15')]();_0x5366cf[_0xcbfc('0x16')]='abandoned';_0x5366cf['reason']='abandoned';_0x5366cf[_0xcbfc('0x1e')]=_0x19d2e[_0xcbfc('0x1e')];_0x5366cf[_0xcbfc('0x29')]=0x0;writeDB(_0x5366cf);}});}catch(_0x9c1ff3){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')](_0xcbfc('0x26'),_0x19d2e[_0xcbfc('0x14')]),_0x9c1ff3);}};exports['agentconnect']=function(_0x2f14ff){try{if(agents[_0x2f14ff[_0xcbfc('0x11')]]){utils['debug'](util[_0xcbfc('0x2')]('[%s][agents][agentconnect]',_0x2f14ff[_0xcbfc('0x14')]),_0x2f14ff);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2f14ff[_0xcbfc('0x14')],agents[_0x2f14ff['destuniqueid']]['membername'],_0x2f14ff[_0xcbfc('0x11')]));agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x2a')]=utils[_0xcbfc('0x15')]();agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x5')]=_0x2f14ff[_0xcbfc('0x5')];agents[_0x2f14ff[_0xcbfc('0x11')]]['connectedlinename']=_0x2f14ff[_0xcbfc('0x18')];agents[_0x2f14ff['destuniqueid']][_0xcbfc('0x1e')]=_0x2f14ff[_0xcbfc('0x1f')];agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x16')]='connect';_['forIn'](agents,function(_0x236b66,_0x1c678b){if(_0x236b66[_0xcbfc('0x11')]!=_0x2f14ff[_0xcbfc('0x11')]&&_0x236b66[_0xcbfc('0x14')]==_0x2f14ff['uniqueid']){_0x236b66[_0xcbfc('0x29')]=0x0;_0x236b66[_0xcbfc('0x1e')]=_0x2f14ff[_0xcbfc('0x1f')];_0x236b66['agentringnoanswer']=!![];_0x236b66[_0xcbfc('0x28')]=utils[_0xcbfc('0x15')]();_0x236b66[_0xcbfc('0x16')]='answered_elsewhere';_0x236b66[_0xcbfc('0x1d')]=_0xcbfc('0x2b');_0x236b66[_0xcbfc('0x2c')]=_0x2f14ff[_0xcbfc('0x11')];_0x236b66[_0xcbfc('0x2d')]=_0x2f14ff[_0xcbfc('0x3')];writeDB(_0x236b66);}});}}catch(_0x1e14bb){utils['error'](util[_0xcbfc('0x2')](_0xcbfc('0x2e'),_0x2f14ff['uniqueid']),_0x1e14bb);}};exports[_0xcbfc('0xb')]=function(_0x50a01c){try{if(!_[_0xcbfc('0x1a')](agents[_0x50a01c[_0xcbfc('0x11')]])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x2f'),_0x50a01c[_0xcbfc('0x14')]),_0x50a01c);utils['info'](util[_0xcbfc('0x2')](_0xcbfc('0x30'),_0x50a01c[_0xcbfc('0x14')],agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x3')],_0x50a01c[_0xcbfc('0x11')]));agents[_0x50a01c[_0xcbfc('0x11')]]['agentcomplete']=!![];agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x31')]=utils['now']();agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](agents[_0x50a01c['destuniqueid']][_0xcbfc('0x31')],agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x2a')]);agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x1d')]=_0x50a01c[_0xcbfc('0x1d')];agents[_0x50a01c[_0xcbfc('0x11')]]['lastevent']='complete';writeDB(agents[_0x50a01c[_0xcbfc('0x11')]]);}}catch(_0x94398c){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')]('[%s][agents][agentcomplete]',_0x50a01c['uniqueid']),_0x94398c);}};exports[_0xcbfc('0x33')]=function(_0xe5c5ef){try{if(!_[_0xcbfc('0x1a')](agents[_0xe5c5ef['transfereruniqueid']])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x34'),_0xe5c5ef['uniqueid']),_0xe5c5ef);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x35'),_0xe5c5ef[_0xcbfc('0x14')],agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x3')],agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x14')]));agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x37')]=!![];agents[_0xe5c5ef['transfereruniqueid']][_0xcbfc('0x38')]=_0xcbfc('0x39');agents[_0xe5c5ef[_0xcbfc('0x36')]]['transferexten']=_0xe5c5ef[_0xcbfc('0x3a')];agents[_0xe5c5ef[_0xcbfc('0x36')]]['transferuniqueid']=agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x14')];}}catch(_0x38db76){utils[_0xcbfc('0x21')](util['format'](_0xcbfc('0x34'),_0xe5c5ef[_0xcbfc('0x14')]),_0x38db76);}};exports['attendedtransfer']=function(_0x2fe240){try{utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x3b'),_0x2fe240[_0xcbfc('0x3c')]),_0x2fe240);if(_0x2fe240[_0xcbfc('0x3c')]==_0x2fe240[_0xcbfc('0x3d')]){if(!_[_0xcbfc('0x1a')](agents[_0x2fe240[_0xcbfc('0x3e')]])){utils[_0xcbfc('0x1')](util['format'](_0xcbfc('0x3f'),_0x2fe240['origtransfereruniqueid'],agents[_0x2fe240['secondtransfereruniqueid']]['membername']));agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x37')]=!![];agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x38')]=_0xcbfc('0x40');agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x41')]=_0x2fe240[_0xcbfc('0x42')];agents[_0x2fe240['secondtransfereruniqueid']][_0xcbfc('0x43')]=_0x2fe240[_0xcbfc('0x3c')];}if(_0x2fe240[_0xcbfc('0x44')]&&agents[_0x2fe240['transfereeuniqueid']]){agents[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x45')]=0x1;transfers[_0x2fe240[_0xcbfc('0x44')]]=_[_0xcbfc('0x46')](agents[_0x2fe240[_0xcbfc('0x44')]]);transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x47')]=agents[_0x2fe240['secondtransfereruniqueid']][_0xcbfc('0x47')];transfers[_0x2fe240['transfereeuniqueid']][_0xcbfc('0x48')]=agents[_0x2fe240[_0xcbfc('0x3e')]]['calleridname'];transfers[_0x2fe240[_0xcbfc('0x44')]]['agentcalledAt']=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x2a')]=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x1e')]=0x0;transfers[_0x2fe240['transfereeuniqueid']][_0xcbfc('0x45')]=0x2;}}else if(_0x2fe240[_0xcbfc('0x3e')]==_0x2fe240['secondtransfererlinkedid']){if(!_[_0xcbfc('0x1a')](agents[_0x2fe240[_0xcbfc('0x3c')]])){utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x3f'),_0x2fe240[_0xcbfc('0x3c')],agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x3')]));agents[_0x2fe240['origtransfereruniqueid']][_0xcbfc('0x37')]=!![];agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x38')]=_0xcbfc('0x40');agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x41')]=_0x2fe240[_0xcbfc('0x49')];agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x43')]=_0x2fe240[_0xcbfc('0x3e')];}if(_0x2fe240['transfertargetuniqueid']&&agents[_0x2fe240[_0xcbfc('0x4a')]]){agents[_0x2fe240[_0xcbfc('0x4a')]]['agententerreason']=0x1;transfers[_0x2fe240[_0xcbfc('0x4a')]]=_['clone'](agents[_0x2fe240['transfertargetuniqueid']]);transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x47')]=agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x47')];transfers[_0x2fe240[_0xcbfc('0x4a')]]['calleridname']=agents[_0x2fe240['origtransfereruniqueid']][_0xcbfc('0x48')];transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x4b')]=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x4a')]]['agentconnectAt']=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x1e')]=0x0;transfers[_0x2fe240['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x4c3d4d){utils[_0xcbfc('0x21')](util['format']('[%s][agents][attendedtransfer]',_0x2fe240[_0xcbfc('0x3c')]),_0x4c3d4d);}};exports['hangup']=function(_0x99068f){try{utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x4c'),_0x99068f[_0xcbfc('0x14')]),_0x99068f);if(agents[_0x99068f[_0xcbfc('0x14')]]&&agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]===_0xcbfc('0x1c')){if(_0x99068f['cause']==='21'){agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=_0xcbfc('0x4d');agents[_0x99068f['uniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x4d');}utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x4e'),_0x99068f[_0xcbfc('0x14')],agents[_0x99068f[_0xcbfc('0x14')]]['membername'],agents[_0x99068f[_0xcbfc('0x14')]]['reason'],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]));writeDB(agents[_0x99068f[_0xcbfc('0x14')]]);var _0x51019a=unanswered[_0xcbfc('0x4f')](_0x99068f['uniqueid']);if(_0x51019a>-0x1){unanswered[_0xcbfc('0x50')](_0x51019a,0x1);}}if(transfers[_0x99068f[_0xcbfc('0x14')]]){transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0xb')]=!![];transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x31')]=utils[_0xcbfc('0x15')]();transfers[_0x99068f['uniqueid']][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](transfers[_0x99068f[_0xcbfc('0x14')]]['agentcompleteAt'],transfers[_0x99068f[_0xcbfc('0x14')]]['agentconnectAt']);transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=_0xcbfc('0x51');transfers[_0x99068f['uniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x52');utils['info'](util[_0xcbfc('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x99068f[_0xcbfc('0x14')],transfers[_0x99068f['uniqueid']][_0xcbfc('0x3')],transfers[_0x99068f[_0xcbfc('0x14')]]['reason'],transfers[_0x99068f[_0xcbfc('0x14')]]['lastevent']));writeDB(transfers[_0x99068f[_0xcbfc('0x14')]],!![]);}if(agents[_0x99068f[_0xcbfc('0x14')]]&&agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x2a')]){agents[_0x99068f['uniqueid']][_0xcbfc('0xb')]=!![];agents[_0x99068f['uniqueid']][_0xcbfc('0x31')]=utils[_0xcbfc('0x15')]();agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x31')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x2a')]);agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x37')]?_0xcbfc('0x37'):_0xcbfc('0x51');agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]='complete';utils[_0xcbfc('0x1')](util['format'](_0xcbfc('0x4e'),_0x99068f['uniqueid'],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x3')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]));writeDB(agents[_0x99068f[_0xcbfc('0x14')]]);}}catch(_0x4f38cb){utils[_0xcbfc('0x21')](util['format'](_0xcbfc('0x4c'),_0x99068f[_0xcbfc('0x14')]),_0x4f38cb);}}; \ No newline at end of file +var _0x76dc=['origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','agent','complete','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','info','format','uniqueid','membername','interface','calleridnum','queue','getVoiceQueueByName','type','agentcomplete','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','lastevent','called','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','talktime','queuecallerabandon','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheremembername','isNil','agentcompleteAt','diffTime','agentconnectAt','[%s][agents][agentcomplete]','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid'];(function(_0x2b8388,_0x246b8f){var _0x3ba12a=function(_0x848995){while(--_0x848995){_0x2b8388['push'](_0x2b8388['shift']());}};_0x3ba12a(++_0x246b8f);}(_0x76dc,0x1f2));var _0xc76d=function(_0x625f21,_0x2b36e0){_0x625f21=_0x625f21-0x0;var _0x24241e=_0x76dc[_0x625f21];return _0x24241e;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var utils=require(_0xc76d('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x26e85e,_0x49c651){utils[_0xc76d('0x3')](util[_0xc76d('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x26e85e[_0xc76d('0x5')],_0x26e85e['channel'],_0x26e85e['queue'],_0x26e85e[_0xc76d('0x6')],_0x26e85e[_0xc76d('0x7')],_0x26e85e[_0xc76d('0x8')],_0x26e85e['connectedlinenum'],_0x26e85e['lastevent']));if(_0x26e85e[_0xc76d('0x9')]){utils[_0xc76d('0xa')](_0x26e85e[_0xc76d('0x9')])['then'](function(_0x570197){if(_0x570197){_0x26e85e[_0xc76d('0xb')]=_0x570197[_0xc76d('0xb')];_0x26e85e['agentacw']=_0x26e85e[_0xc76d('0xc')]?_0x570197['acw']:![];_0x26e85e[_0xc76d('0xd')]=_0x26e85e[_0xc76d('0xe')]?_0x570197[_0xc76d('0xf')]:0x0;}utils[_0xc76d('0x10')](_0xc76d('0x11'),_0x26e85e);});}else{utils[_0xc76d('0x10')](_0xc76d('0x11'),_0x26e85e);}if(_0x49c651){delete transfers[_0x26e85e[_0xc76d('0x5')]];}else{delete agents[_0x26e85e[_0xc76d('0x12')]];}}exports[_0xc76d('0x13')]=function(_0x1a7b47){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x15'),_0x1a7b47['uniqueid']),_0x1a7b47);agents[_0x1a7b47[_0xc76d('0x12')]]=_0x1a7b47;agents[_0x1a7b47[_0xc76d('0x12')]]['agentcalledAt']=utils[_0xc76d('0x16')]();agents[_0x1a7b47[_0xc76d('0x12')]][_0xc76d('0x17')]=_0xc76d('0x18');agents[_0x1a7b47['destuniqueid']][_0xc76d('0x19')]=null;agents[_0x1a7b47['destuniqueid']]['connectedlinename']=null;utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x1a'),_0x1a7b47[_0xc76d('0x5')],agents[_0x1a7b47[_0xc76d('0x12')]]['membername'],_0x1a7b47[_0xc76d('0x12')]));}catch(_0x361f42){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x15'),_0x1a7b47['uniqueid']),_0x361f42);}};exports[_0xc76d('0x1c')]=function(_0x324db7){try{if(!_['isNil'](agents[_0x324db7[_0xc76d('0x12')]])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x1d'),_0x324db7[_0xc76d('0x5')]),_0x324db7);utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x1e'),_0x324db7[_0xc76d('0x5')],agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x6')],_0x324db7['destuniqueid']));agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x1c')]=!![];agents[_0x324db7['destuniqueid']][_0xc76d('0x1f')]=utils[_0xc76d('0x16')]();agents[_0x324db7['destuniqueid']][_0xc76d('0x17')]=_0xc76d('0x20');agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x21')]=_0xc76d('0x20');agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x22')]=_0x324db7['ringtime']?parseInt(_0x324db7['ringtime'])/0x3e8:0x0;agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x23')]=0x0;unanswered['push'](_0x324db7[_0xc76d('0x12')]);}}catch(_0x52a79a){utils[_0xc76d('0x1b')](util['format'](_0xc76d('0x1d'),_0x324db7['uniqueid']),_0x52a79a);}};exports[_0xc76d('0x24')]=function(_0x18a7fa){try{_['forIn'](agents,function(_0x3d4076,_0x1c68f3){if(_0x3d4076[_0xc76d('0x5')]==_0x18a7fa[_0xc76d('0x5')]&&!_['includes'](unanswered,_0x3d4076[_0xc76d('0x12')])){utils['debug'](util[_0xc76d('0x4')]('[%s][agents][queuecallerabandon]',_0x18a7fa[_0xc76d('0x5')]),_0x18a7fa);utils[_0xc76d('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x18a7fa['uniqueid'],_0x3d4076['membername'],_0x3d4076[_0xc76d('0x12')]));_0x3d4076[_0xc76d('0x1c')]=!![];_0x3d4076[_0xc76d('0x1f')]=utils[_0xc76d('0x16')]();_0x3d4076[_0xc76d('0x17')]='abandoned';_0x3d4076[_0xc76d('0x21')]='abandoned';_0x3d4076[_0xc76d('0x22')]=_0x18a7fa['holdtime'];_0x3d4076[_0xc76d('0x23')]=0x0;writeDB(_0x3d4076);}});}catch(_0x2332f5){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x25'),_0x18a7fa['uniqueid']),_0x2332f5);}};exports[_0xc76d('0x26')]=function(_0x371306){try{if(agents[_0x371306[_0xc76d('0x12')]]){utils['debug'](util[_0xc76d('0x4')](_0xc76d('0x27'),_0x371306[_0xc76d('0x5')]),_0x371306);utils['info'](util[_0xc76d('0x4')](_0xc76d('0x28'),_0x371306[_0xc76d('0x5')],agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x6')],_0x371306[_0xc76d('0x12')]));agents[_0x371306['destuniqueid']]['agentconnectAt']=utils[_0xc76d('0x16')]();agents[_0x371306['destuniqueid']][_0xc76d('0x19')]=_0x371306[_0xc76d('0x19')];agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x29')]=_0x371306['connectedlinename'];agents[_0x371306['destuniqueid']][_0xc76d('0x22')]=_0x371306[_0xc76d('0x2a')];agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x17')]=_0xc76d('0x2b');_['forIn'](agents,function(_0x42404c,_0xb264b0){if(_0x42404c[_0xc76d('0x12')]!=_0x371306[_0xc76d('0x12')]&&_0x42404c[_0xc76d('0x5')]==_0x371306[_0xc76d('0x5')]){_0x42404c[_0xc76d('0x23')]=0x0;_0x42404c[_0xc76d('0x22')]=_0x371306[_0xc76d('0x2a')];_0x42404c[_0xc76d('0x1c')]=!![];_0x42404c['agentringnoanswerAt']=utils['now']();_0x42404c[_0xc76d('0x17')]=_0xc76d('0x2c');_0x42404c[_0xc76d('0x21')]=_0xc76d('0x2c');_0x42404c['answeredelsewheredestinationuniqueid']=_0x371306['destuniqueid'];_0x42404c[_0xc76d('0x2d')]=_0x371306[_0xc76d('0x6')];writeDB(_0x42404c);}});}}catch(_0x3e471e){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x27'),_0x371306[_0xc76d('0x5')]),_0x3e471e);}};exports[_0xc76d('0xc')]=function(_0x50e922){try{if(!_[_0xc76d('0x2e')](agents[_0x50e922[_0xc76d('0x12')]])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')]('[%s][agents][agentcomplete]',_0x50e922['uniqueid']),_0x50e922);utils['info'](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x50e922['uniqueid'],agents[_0x50e922['destuniqueid']][_0xc76d('0x6')],_0x50e922[_0xc76d('0x12')]));agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0xc')]=!![];agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();agents[_0x50e922[_0xc76d('0x12')]]['talktime']=utils[_0xc76d('0x30')](agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x2f')],agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x31')]);agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x21')]=_0x50e922[_0xc76d('0x21')];agents[_0x50e922[_0xc76d('0x12')]]['lastevent']='complete';writeDB(agents[_0x50e922[_0xc76d('0x12')]]);}}catch(_0x170f47){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x32'),_0x50e922['uniqueid']),_0x170f47);}};exports[_0xc76d('0x33')]=function(_0x1ede13){try{if(!_['isNil'](agents[_0x1ede13['transfereruniqueid']])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')]('[%s][agents][blindtransfer]',_0x1ede13[_0xc76d('0x5')]),_0x1ede13);utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x34'),_0x1ede13[_0xc76d('0x5')],agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x6')],agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x5')]));agents[_0x1ede13[_0xc76d('0x35')]]['transfer']=!![];agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x36')]=_0xc76d('0x37');agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x38')]=_0x1ede13[_0xc76d('0x39')];agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x3a')]=agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x5')];}}catch(_0x12c972){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x3b'),_0x1ede13['uniqueid']),_0x12c972);}};exports['attendedtransfer']=function(_0x5bec6c){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x3c'),_0x5bec6c[_0xc76d('0x3d')]),_0x5bec6c);if(_0x5bec6c[_0xc76d('0x3d')]==_0x5bec6c[_0xc76d('0x3e')]){if(!_['isNil'](agents[_0x5bec6c[_0xc76d('0x3f')]])){utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x40'),_0x5bec6c[_0xc76d('0x3d')],agents[_0x5bec6c['secondtransfereruniqueid']][_0xc76d('0x6')]));agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x41')]=!![];agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x36')]=_0xc76d('0x42');agents[_0x5bec6c['secondtransfereruniqueid']][_0xc76d('0x38')]=_0x5bec6c[_0xc76d('0x43')];agents[_0x5bec6c['secondtransfereruniqueid']]['transferuniqueid']=_0x5bec6c[_0xc76d('0x3d')];}if(_0x5bec6c['transfereeuniqueid']&&agents[_0x5bec6c[_0xc76d('0x44')]]){agents[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x45')]=0x1;transfers[_0x5bec6c[_0xc76d('0x44')]]=_[_0xc76d('0x46')](agents[_0x5bec6c[_0xc76d('0x44')]]);transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x8')]=agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x8')];transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x47')]=agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x47')];transfers[_0x5bec6c['transfereeuniqueid']][_0xc76d('0x48')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x31')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c['transfereeuniqueid']][_0xc76d('0x22')]=0x0;transfers[_0x5bec6c[_0xc76d('0x44')]]['agententerreason']=0x2;}}else if(_0x5bec6c['secondtransfereruniqueid']==_0x5bec6c['secondtransfererlinkedid']){if(!_[_0xc76d('0x2e')](agents[_0x5bec6c[_0xc76d('0x3d')]])){utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x40'),_0x5bec6c[_0xc76d('0x3d')],agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x6')]));agents[_0x5bec6c['origtransfereruniqueid']][_0xc76d('0x41')]=!![];agents[_0x5bec6c['origtransfereruniqueid']]['transfertype']=_0xc76d('0x42');agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x38')]=_0x5bec6c['secondtransfererexten'];agents[_0x5bec6c[_0xc76d('0x3d')]]['transferuniqueid']=_0x5bec6c['secondtransfereruniqueid'];}if(_0x5bec6c['transfertargetuniqueid']&&agents[_0x5bec6c[_0xc76d('0x49')]]){agents[_0x5bec6c[_0xc76d('0x49')]]['agententerreason']=0x1;transfers[_0x5bec6c[_0xc76d('0x49')]]=_[_0xc76d('0x46')](agents[_0x5bec6c[_0xc76d('0x49')]]);transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x8')]=agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x8')];transfers[_0x5bec6c['transfertargetuniqueid']]['calleridname']=agents[_0x5bec6c['origtransfereruniqueid']][_0xc76d('0x47')];transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x48')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x49')]]['agentconnectAt']=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x22')]=0x0;transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x45')]=0x2;}}}catch(_0x2af760){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')]('[%s][agents][attendedtransfer]',_0x5bec6c[_0xc76d('0x3d')]),_0x2af760);}};exports['hangup']=function(_0xa9f2e8){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x4a'),_0xa9f2e8['uniqueid']),_0xa9f2e8);if(agents[_0xa9f2e8[_0xc76d('0x5')]]&&agents[_0xa9f2e8['uniqueid']]['reason']===_0xc76d('0x20')){if(_0xa9f2e8[_0xc76d('0x4b')]==='21'){agents[_0xa9f2e8['uniqueid']][_0xc76d('0x21')]=_0xc76d('0x4c');agents[_0xa9f2e8['uniqueid']][_0xc76d('0x17')]=_0xc76d('0x4c');}utils['info'](util[_0xc76d('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xa9f2e8[_0xc76d('0x5')],agents[_0xa9f2e8[_0xc76d('0x5')]]['membername'],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],agents[_0xa9f2e8['uniqueid']][_0xc76d('0x17')]));writeDB(agents[_0xa9f2e8[_0xc76d('0x5')]]);var _0x277382=unanswered['indexOf'](_0xa9f2e8[_0xc76d('0x5')]);if(_0x277382>-0x1){unanswered['splice'](_0x277382,0x1);}}if(transfers[_0xa9f2e8['uniqueid']]){transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0xc')]=!![];transfers[_0xa9f2e8['uniqueid']][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x23')]=utils[_0xc76d('0x30')](transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]);transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')]=_0xc76d('0x4d');transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x17')]=_0xc76d('0x4e');utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x4f'),_0xa9f2e8[_0xc76d('0x5')],transfers[_0xa9f2e8[_0xc76d('0x5')]]['membername'],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x17')]));writeDB(transfers[_0xa9f2e8[_0xc76d('0x5')]],!![]);}if(agents[_0xa9f2e8[_0xc76d('0x5')]]&&agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]){agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0xc')]=!![];agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x23')]=utils[_0xc76d('0x30')](agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]);agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')]=agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x41')]?'transfer':_0xc76d('0x4d');agents[_0xa9f2e8[_0xc76d('0x5')]]['lastevent']=_0xc76d('0x4e');utils[_0xc76d('0x3')](util['format'](_0xc76d('0x4f'),_0xa9f2e8[_0xc76d('0x5')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x6')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],agents[_0xa9f2e8[_0xc76d('0x5')]]['lastevent']));writeDB(agents[_0xa9f2e8['uniqueid']]);}}catch(_0xe6a1dc){utils[_0xc76d('0x1b')](util['format'](_0xc76d('0x4a'),_0xa9f2e8[_0xc76d('0x5')]),_0xe6a1dc);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9dde204..0da95cd 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 _0xe990=['ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','debug','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','Queue','queue','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','split','substring','lastIndexOf','includes','noop','lastapplication','lastdata','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED'];(function(_0x5828d0,_0x2c3e93){var _0x239b02=function(_0x702fe4){while(--_0x702fe4){_0x5828d0['push'](_0x5828d0['shift']());}};_0x239b02(++_0x2c3e93);}(_0xe990,0x133));var _0x0e99=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xe990[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x0e99('0x0'));var util=require('util');var utils=require(_0x0e99('0x1'));var transfers=require(_0x0e99('0x2'));var dispositions=[_0x0e99('0x3'),_0x0e99('0x4'),_0x0e99('0x4'),_0x0e99('0x3'),'NO\x20ANSWER',_0x0e99('0x3'),_0x0e99('0x5'),_0x0e99('0x6'),_0x0e99('0x4'),_0x0e99('0x4'),_0x0e99('0x4')];var channels={};function writeDB(_0x4ce502){var _0x2d83a1;if(transfers[_0x0e99('0x7')][_0x4ce502[_0x0e99('0x8')]]){_0x2d83a1=_0x4ce502[_0x0e99('0x8')];_0x4ce502[_0x0e99('0x8')]=transfers[_0x0e99('0x7')][_0x4ce502[_0x0e99('0x8')]][_0x0e99('0x9')];}utils[_0x0e99('0xa')](util[_0x0e99('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x4ce502[_0x0e99('0x8')],_0x4ce502[_0x0e99('0xc')],_0x4ce502['queue'],_0x4ce502[_0x0e99('0xd')],_0x4ce502[_0x0e99('0xe')],_0x4ce502[_0x0e99('0xf')],_0x4ce502[_0x0e99('0x10')],_0x4ce502[_0x0e99('0x11')]));if(_0x4ce502[_0x0e99('0x12')]){utils[_0x0e99('0x13')](_0x4ce502[_0x0e99('0x12')])['then'](function(_0x21e16a){if(_0x21e16a){_0x4ce502['UserId']=_0x21e16a['id'];}utils['request']('CreateVoiceCallReport',_0x4ce502);});}else{utils[_0x0e99('0x14')](_0x0e99('0x15'),_0x4ce502);}if(channels[_0x4ce502[_0x0e99('0x8')]]){delete channels[_0x4ce502[_0x0e99('0x8')]];}else if(_0x2d83a1&&channels[_0x2d83a1]){delete transfers[_0x0e99('0x7')][_0x2d83a1];delete channels[_0x2d83a1];}}exports[_0x0e99('0x16')]=function(_0x2edc92){try{utils['debug'](util[_0x0e99('0xb')](_0x0e99('0x17'),_0x2edc92['uniqueid']),_0x2edc92);if(_0x2edc92[_0x0e99('0x8')]==_0x2edc92[_0x0e99('0x18')]&&_0x2edc92[_0x0e99('0xc')]!='OutgoingSpoolFailed'){utils[_0x0e99('0xa')](util[_0x0e99('0xb')](_0x0e99('0x19'),_0x2edc92[_0x0e99('0x8')],_0x2edc92[_0x0e99('0x1a')],_0x2edc92['exten']));channels[_0x2edc92[_0x0e99('0x8')]]={'uniqueid':_0x2edc92[_0x0e99('0x8')],'accountcode':_0x2edc92[_0x0e99('0x12')],'source':_0x2edc92[_0x0e99('0xf')],'destination':_0x2edc92[_0x0e99('0x1b')],'destinationcontext':_0x2edc92[_0x0e99('0x1a')],'channel':_0x2edc92['channel'],'starttime':utils[_0x0e99('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0e99('0x3'),'amaflags':_0x0e99('0x1d')};}}catch(_0xa63b30){utils[_0x0e99('0x1e')](util[_0x0e99('0xb')](_0x0e99('0x17'),_0x2edc92[_0x0e99('0x8')]),_0xa63b30);}};exports['newstate']=function(_0x1e0c9c){try{utils['debug'](util[_0x0e99('0xb')](_0x0e99('0x1f'),_0x1e0c9c[_0x0e99('0x8')]),_0x1e0c9c);if(!_[_0x0e99('0x20')](channels[_0x1e0c9c[_0x0e99('0x8')]])&&_0x1e0c9c[_0x0e99('0x21')]==0x6){utils[_0x0e99('0xa')](util[_0x0e99('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x1e0c9c['uniqueid'],_0x1e0c9c[_0x0e99('0x1a')],_0x1e0c9c[_0x0e99('0xc')]));if(_[_0x0e99('0x20')](channels[_0x1e0c9c[_0x0e99('0x8')]]['systemanswertime'])){channels[_0x1e0c9c[_0x0e99('0x8')]][_0x0e99('0x22')]=utils[_0x0e99('0x1c')]();}}else if(!_['isNil'](channels[_0x1e0c9c[_0x0e99('0x18')]])&&_0x1e0c9c[_0x0e99('0x21')]==0x6&&_0x1e0c9c[_0x0e99('0x1a')]!='transfer'){utils[_0x0e99('0xa')](util[_0x0e99('0xb')](_0x0e99('0x23'),_0x1e0c9c['uniqueid'],_0x1e0c9c[_0x0e99('0x18')],_0x1e0c9c[_0x0e99('0x1a')],_0x1e0c9c['channel']));channels[_0x1e0c9c[_0x0e99('0x18')]]['accountcode']=_0x1e0c9c['accountcode'];channels[_0x1e0c9c[_0x0e99('0x18')]][_0x0e99('0x24')]=_0x1e0c9c[_0x0e99('0xc')];if(_['isNil'](channels[_0x1e0c9c['linkedid']]['answertime'])){channels[_0x1e0c9c[_0x0e99('0x18')]][_0x0e99('0x25')]=utils[_0x0e99('0x1c')]();}channels[_0x1e0c9c[_0x0e99('0x18')]][_0x0e99('0x26')]=dispositions[_[_0x0e99('0x27')](_0x1e0c9c[_0x0e99('0x21')])]||_0x0e99('0x5');}}catch(_0x6c9fd8){utils[_0x0e99('0x1e')](util['format'](_0x0e99('0x1f'),_0x1e0c9c[_0x0e99('0x8')]),_0x6c9fd8);}};exports[_0x0e99('0x28')]=function(_0x5f3f8e){try{if(!_[_0x0e99('0x20')](channels[_0x5f3f8e[_0x0e99('0x8')]])){utils['debug'](util[_0x0e99('0xb')](_0x0e99('0x29'),_0x5f3f8e['uniqueid']),_0x5f3f8e);if(_[_0x0e99('0x20')](channels[_0x5f3f8e[_0x0e99('0x8')]]['callerid'])){channels[_0x5f3f8e[_0x0e99('0x8')]][_0x0e99('0x2a')]=_0x5f3f8e[_0x0e99('0x2b')]+'\x20<'+_0x5f3f8e[_0x0e99('0xf')]+'>';}utils[_0x0e99('0xa')](util[_0x0e99('0xb')](_0x0e99('0x2c'),_0x5f3f8e['uniqueid'],channels[_0x5f3f8e[_0x0e99('0x8')]][_0x0e99('0x2a')],_0x5f3f8e[_0x0e99('0x2d')]));channels[_0x5f3f8e[_0x0e99('0x8')]][_0x0e99('0x2e')]=utils[_0x0e99('0x1c')]();channels[_0x5f3f8e[_0x0e99('0x8')]]['duration']=utils[_0x0e99('0x2f')](channels[_0x5f3f8e[_0x0e99('0x8')]][_0x0e99('0x2e')],channels[_0x5f3f8e['uniqueid']]['starttime']);channels[_0x5f3f8e[_0x0e99('0x8')]]['billableseconds']=channels[_0x5f3f8e['uniqueid']][_0x0e99('0x25')]?utils[_0x0e99('0x2f')](channels[_0x5f3f8e[_0x0e99('0x8')]][_0x0e99('0x2e')],channels[_0x5f3f8e[_0x0e99('0x8')]]['answertime']):0x0;writeDB(channels[_0x5f3f8e[_0x0e99('0x8')]]);}}catch(_0x5d7cef){utils['error'](util[_0x0e99('0xb')](_0x0e99('0x29'),_0x5f3f8e[_0x0e99('0x8')]),_0x5d7cef);}};exports['attendedtransfer']=function(_0x3f07ba){try{if(!_['isNil'](channels[_0x3f07ba[_0x0e99('0x30')]])){utils['debug'](util[_0x0e99('0xb')]('[%s][calls][attendedtransfer]',_0x3f07ba['origtransfereruniqueid']),_0x3f07ba);if(channels[_0x3f07ba[_0x0e99('0x30')]][_0x0e99('0xc')]==_0x3f07ba['transfereechannel']){utils[_0x0e99('0xa')](util[_0x0e99('0xb')](_0x0e99('0x31'),_0x3f07ba[_0x0e99('0x32')],_0x3f07ba[_0x0e99('0x30')],_0x3f07ba['secondtransfererchannel']));channels[_0x3f07ba[_0x0e99('0x30')]][_0x0e99('0x24')]=_0x3f07ba[_0x0e99('0x33')];channels[_0x3f07ba[_0x0e99('0x30')]][_0x0e99('0x34')]=_0x0e99('0x35');}else if(channels[_0x3f07ba[_0x0e99('0x30')]]['channel']=_0x3f07ba[_0x0e99('0x36')]){utils[_0x0e99('0xa')](util[_0x0e99('0xb')](_0x0e99('0x31'),_0x3f07ba[_0x0e99('0x32')],_0x3f07ba[_0x0e99('0x30')],_0x3f07ba[_0x0e99('0x37')]));channels[_0x3f07ba['localtwolinkedid']]['destinationchannel']=_0x3f07ba[_0x0e99('0x37')];channels[_0x3f07ba[_0x0e99('0x30')]][_0x0e99('0x34')]='_attended';}}}catch(_0x540826){utils[_0x0e99('0x1e')](util[_0x0e99('0xb')](_0x0e99('0x38'),_0x3f07ba['origtransfereruniqueid']),_0x540826);}};exports[_0x0e99('0x39')]=function(_0x1e6c84){try{if(!_[_0x0e99('0x20')](channels[_0x1e6c84[_0x0e99('0x8')]])){utils[_0x0e99('0x3a')](util[_0x0e99('0xb')](_0x0e99('0x3b'),_0x1e6c84['uniqueid']),_0x1e6c84);channels[_0x1e6c84['uniqueid']][_0x0e99('0x3c')]=utils[_0x0e99('0x1c')]();utils[_0x0e99('0xa')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x1e6c84['uniqueid'],channels[_0x1e6c84[_0x0e99('0x8')]][_0x0e99('0x3c')]));}}catch(_0x386755){utils['error'](util[_0x0e99('0xb')](_0x0e99('0x3b'),_0x1e6c84['uniqueid']),_0x386755);}};exports[_0x0e99('0x3d')]=function(_0x50faff){try{if(!_[_0x0e99('0x20')](channels[_0x50faff[_0x0e99('0x8')]])){utils['debug'](util[_0x0e99('0xb')]('[%s][calls][musiconholdstop]',_0x50faff[_0x0e99('0x8')]),_0x50faff);if(!_[_0x0e99('0x20')](channels[_0x50faff['uniqueid']]['musiconholdstartAt'])){channels[_0x50faff[_0x0e99('0x8')]][_0x0e99('0x3e')]+=utils[_0x0e99('0x2f')](utils[_0x0e99('0x1c')](),channels[_0x50faff[_0x0e99('0x8')]]['musiconholdstartAt']);utils[_0x0e99('0xa')](util[_0x0e99('0xb')](_0x0e99('0x3f'),_0x50faff[_0x0e99('0x8')],channels[_0x50faff[_0x0e99('0x8')]]['mohtime']));delete channels[_0x50faff[_0x0e99('0x8')]][_0x0e99('0x3c')];}}}catch(_0x501b0b){utils['error'](util[_0x0e99('0xb')](_0x0e99('0x40'),_0x50faff[_0x0e99('0x8')]),_0x501b0b);}};exports[_0x0e99('0x41')]=function(_0x35a5c6){try{if(!_[_0x0e99('0x20')](channels[_0x35a5c6['uniqueid']])){utils['debug'](util[_0x0e99('0xb')](_0x0e99('0x42'),_0x35a5c6[_0x0e99('0x8')]),_0x35a5c6);if(!_[_0x0e99('0x20')](_0x35a5c6[_0x0e99('0x43')]['xmd-originatecalleridnum'])){utils[_0x0e99('0xa')](util[_0x0e99('0xb')](_0x0e99('0x44'),_0x35a5c6[_0x0e99('0x8')],_0x35a5c6[_0x0e99('0x45')]));channels[_0x35a5c6[_0x0e99('0x8')]][_0x0e99('0x46')]=_0x35a5c6[_0x0e99('0x45')];}if(!_['isNil'](_0x35a5c6['variable'][_0x0e99('0x47')])){utils['info'](util[_0x0e99('0xb')](_0x0e99('0x48'),_0x35a5c6[_0x0e99('0x8')],_0x35a5c6[_0x0e99('0x45')]));channels[_0x35a5c6['uniqueid']]['destination']=_0x35a5c6[_0x0e99('0x45')];channels[_0x35a5c6['uniqueid']][_0x0e99('0x2a')]='\x22'+_0x35a5c6[_0x0e99('0x45')]+'\x22\x20<'+_0x35a5c6[_0x0e99('0x45')]+'>';}if(!_[_0x0e99('0x20')](_0x35a5c6[_0x0e99('0x43')][_0x0e99('0x49')])||!_[_0x0e99('0x20')](_0x35a5c6[_0x0e99('0x43')]['xmd-callerid'])){utils[_0x0e99('0xa')](util[_0x0e99('0xb')](_0x0e99('0x4a'),_0x35a5c6[_0x0e99('0x8')],!_[_0x0e99('0x20')](_0x35a5c6[_0x0e99('0x43')][_0x0e99('0x49')])?_0x0e99('0x49'):_0x0e99('0x4b'),_0x35a5c6['value']));channels[_0x35a5c6['uniqueid']][_0x0e99('0x2a')]=_0x35a5c6[_0x0e99('0x45')];}if(!_[_0x0e99('0x20')](_0x35a5c6[_0x0e99('0x43')][_0x0e99('0x4c')])||!_['isNil'](_0x35a5c6['variable'][_0x0e99('0x4d')])){utils['info'](util[_0x0e99('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x35a5c6[_0x0e99('0x8')],!_[_0x0e99('0x20')](_0x35a5c6[_0x0e99('0x43')][_0x0e99('0x4c')])?_0x0e99('0x4c'):'xmcs-queue',_0x35a5c6[_0x0e99('0x45')]));channels[_0x35a5c6['uniqueid']]['lastapplication']=_0x0e99('0x4e');channels[_0x35a5c6[_0x0e99('0x8')]]['lastdata']=_0x35a5c6[_0x0e99('0x45')];channels[_0x35a5c6['uniqueid']][_0x0e99('0x4f')]=!![];}if(!_[_0x0e99('0x20')](_0x35a5c6[_0x0e99('0x43')][_0x0e99('0x50')])){utils[_0x0e99('0xa')](util[_0x0e99('0xb')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x35a5c6[_0x0e99('0x8')],_0x35a5c6[_0x0e99('0x45')]));channels[_0x35a5c6[_0x0e99('0x8')]][_0x0e99('0x51')]=_0x35a5c6[_0x0e99('0x45')];}if(!_[_0x0e99('0x20')](_0x35a5c6[_0x0e99('0x43')][_0x0e99('0x52')])){utils[_0x0e99('0xa')](util[_0x0e99('0xb')](_0x0e99('0x53'),_0x35a5c6[_0x0e99('0x8')],_0x35a5c6[_0x0e99('0x45')]));channels[_0x35a5c6[_0x0e99('0x8')]][_0x0e99('0x54')]=_0x35a5c6[_0x0e99('0x45')];}if(!_[_0x0e99('0x20')](_0x35a5c6[_0x0e99('0x43')][_0x0e99('0x55')])){utils[_0x0e99('0xa')](util['format'](_0x0e99('0x56'),_0x35a5c6[_0x0e99('0x8')],_0x35a5c6[_0x0e99('0x45')]));channels[_0x35a5c6[_0x0e99('0x8')]][_0x0e99('0x57')]=_0x35a5c6['value'];}if(!_[_0x0e99('0x20')](_0x35a5c6[_0x0e99('0x43')][_0x0e99('0x58')])){utils['info'](util[_0x0e99('0xb')](_0x0e99('0x59'),_0x35a5c6['uniqueid'],_0x35a5c6[_0x0e99('0x45')]));channels[_0x35a5c6[_0x0e99('0x8')]][_0x0e99('0x58')]=_0x35a5c6[_0x0e99('0x45')];}}}catch(_0x2233a2){utils['error'](util['format'](_0x0e99('0x42'),_0x35a5c6['uniqueid']),_0x2233a2);}};exports[_0x0e99('0x5a')]=function(_0x153315){try{if(!_[_0x0e99('0x20')](channels[_0x153315['uniqueid']])){utils['debug'](util[_0x0e99('0xb')](_0x0e99('0x5b'),_0x153315['uniqueid']),_0x153315);utils[_0x0e99('0xa')](util[_0x0e99('0xb')](_0x0e99('0x5c'),_0x153315[_0x0e99('0x8')],_0x153315[_0x0e99('0x5d')],_0x153315['appdata']));if(_0x153315['application'][_0x0e99('0x5e')]()==_0x0e99('0x5f')&&_['startsWith'](_0x153315[_0x0e99('0x60')]['toLowerCase'](),'cdr')){var _0x2ea0b2=_0x153315[_0x0e99('0x60')][_0x0e99('0x61')]('=');var _0x59d6a1=_0x2ea0b2[0x0][_0x0e99('0x62')](_0x2ea0b2[0x0][_0x0e99('0x63')]('(')+0x1,_0x2ea0b2[0x0][_0x0e99('0x63')](')'));var _0x56936c=_0x2ea0b2[0x1];channels[_0x153315[_0x0e99('0x8')]][_0x59d6a1]=_0x56936c;}if(!_[_0x0e99('0x64')](['hangup',_0x0e99('0x65'),'execif','set','gotoif'],_0x153315[_0x0e99('0x5d')]['toLowerCase']())){channels[_0x153315[_0x0e99('0x8')]][_0x0e99('0x66')]=_0x153315[_0x0e99('0x5d')];channels[_0x153315[_0x0e99('0x8')]][_0x0e99('0x67')]=_0x153315['appdata'];}}}catch(_0x37eb2b){utils[_0x0e99('0x1e')](util['format'](_0x0e99('0x5b'),_0x153315[_0x0e99('0x8')]),_0x37eb2b);}}; \ No newline at end of file +var _0xcd78=['[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','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','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','noop','[%s][calls][newexten]','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','info','format','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','cause-txt','endtime','duration','diffTime','error','attendedtransfer','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xcd78,0x8e));var _0x8cd7=function(_0x3f47bd,_0xa1b88c){_0x3f47bd=_0x3f47bd-0x0;var _0x133064=_0xcd78[_0x3f47bd];return _0x133064;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x8cd7('0x0'));var transfers=require(_0x8cd7('0x1'));var dispositions=[_0x8cd7('0x2'),'FAILED',_0x8cd7('0x3'),_0x8cd7('0x2'),_0x8cd7('0x2'),_0x8cd7('0x2'),_0x8cd7('0x4'),_0x8cd7('0x5'),_0x8cd7('0x3'),_0x8cd7('0x3'),_0x8cd7('0x3')];var channels={};function writeDB(_0x12f0cd){var _0xe9c42;if(transfers['blinds'][_0x12f0cd[_0x8cd7('0x6')]]){_0xe9c42=_0x12f0cd[_0x8cd7('0x6')];_0x12f0cd[_0x8cd7('0x6')]=transfers[_0x8cd7('0x7')][_0x12f0cd[_0x8cd7('0x6')]]['transfereeuniqueid'];}utils[_0x8cd7('0x8')](util[_0x8cd7('0x9')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x12f0cd[_0x8cd7('0x6')],_0x12f0cd[_0x8cd7('0xa')],_0x12f0cd[_0x8cd7('0xb')],_0x12f0cd[_0x8cd7('0xc')],_0x12f0cd[_0x8cd7('0xd')],_0x12f0cd[_0x8cd7('0xe')],_0x12f0cd[_0x8cd7('0xf')],_0x12f0cd[_0x8cd7('0x10')]));if(_0x12f0cd[_0x8cd7('0x11')]){utils['getUserByInternal'](_0x12f0cd['accountcode'])[_0x8cd7('0x12')](function(_0x391ce2){if(_0x391ce2){_0x12f0cd['UserId']=_0x391ce2['id'];}utils[_0x8cd7('0x13')](_0x8cd7('0x14'),_0x12f0cd);});}else{utils[_0x8cd7('0x13')](_0x8cd7('0x14'),_0x12f0cd);}if(channels[_0x12f0cd['uniqueid']]){delete channels[_0x12f0cd['uniqueid']];}else if(_0xe9c42&&channels[_0xe9c42]){delete transfers[_0x8cd7('0x7')][_0xe9c42];delete channels[_0xe9c42];}}exports[_0x8cd7('0x15')]=function(_0x3710d7){try{utils[_0x8cd7('0x16')](util['format'](_0x8cd7('0x17'),_0x3710d7[_0x8cd7('0x6')]),_0x3710d7);if(_0x3710d7[_0x8cd7('0x6')]==_0x3710d7[_0x8cd7('0x18')]&&_0x3710d7[_0x8cd7('0xa')]!=_0x8cd7('0x19')){utils['info'](util[_0x8cd7('0x9')](_0x8cd7('0x1a'),_0x3710d7['uniqueid'],_0x3710d7['context'],_0x3710d7[_0x8cd7('0x1b')]));channels[_0x3710d7[_0x8cd7('0x6')]]={'uniqueid':_0x3710d7[_0x8cd7('0x6')],'accountcode':_0x3710d7[_0x8cd7('0x11')],'source':_0x3710d7[_0x8cd7('0xe')],'destination':_0x3710d7[_0x8cd7('0x1b')],'destinationcontext':_0x3710d7[_0x8cd7('0x1c')],'channel':_0x3710d7[_0x8cd7('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x8cd7('0x1d')};}}catch(_0x25e02e){utils['error'](util[_0x8cd7('0x9')](_0x8cd7('0x17'),_0x3710d7['uniqueid']),_0x25e02e);}};exports['newstate']=function(_0xf1a056){try{utils[_0x8cd7('0x16')](util['format'](_0x8cd7('0x1e'),_0xf1a056[_0x8cd7('0x6')]),_0xf1a056);if(!_[_0x8cd7('0x1f')](channels[_0xf1a056[_0x8cd7('0x6')]])&&_0xf1a056[_0x8cd7('0x20')]==0x6){utils['info'](util[_0x8cd7('0x9')](_0x8cd7('0x21'),_0xf1a056[_0x8cd7('0x6')],_0xf1a056['context'],_0xf1a056['channel']));if(_['isNil'](channels[_0xf1a056[_0x8cd7('0x6')]][_0x8cd7('0x22')])){channels[_0xf1a056[_0x8cd7('0x6')]][_0x8cd7('0x22')]=utils[_0x8cd7('0x23')]();}}else if(!_[_0x8cd7('0x1f')](channels[_0xf1a056[_0x8cd7('0x18')]])&&_0xf1a056['channelstate']==0x6&&_0xf1a056[_0x8cd7('0x1c')]!=_0x8cd7('0x24')){utils[_0x8cd7('0x8')](util[_0x8cd7('0x9')](_0x8cd7('0x25'),_0xf1a056[_0x8cd7('0x6')],_0xf1a056['linkedid'],_0xf1a056[_0x8cd7('0x1c')],_0xf1a056[_0x8cd7('0xa')]));channels[_0xf1a056[_0x8cd7('0x18')]][_0x8cd7('0x11')]=_0xf1a056[_0x8cd7('0x11')];channels[_0xf1a056[_0x8cd7('0x18')]]['destinationchannel']=_0xf1a056[_0x8cd7('0xa')];if(_['isNil'](channels[_0xf1a056[_0x8cd7('0x18')]][_0x8cd7('0x26')])){channels[_0xf1a056[_0x8cd7('0x18')]][_0x8cd7('0x26')]=utils['now']();}channels[_0xf1a056[_0x8cd7('0x18')]][_0x8cd7('0x27')]=dispositions[_[_0x8cd7('0x28')](_0xf1a056[_0x8cd7('0x20')])]||'ANSWERED';}}catch(_0x2cab15){utils['error'](util[_0x8cd7('0x9')]('[%s][calls][newstate]',_0xf1a056[_0x8cd7('0x6')]),_0x2cab15);}};exports[_0x8cd7('0x29')]=function(_0x4640be){try{if(!_[_0x8cd7('0x1f')](channels[_0x4640be[_0x8cd7('0x6')]])){utils['debug'](util[_0x8cd7('0x9')](_0x8cd7('0x2a'),_0x4640be['uniqueid']),_0x4640be);if(_[_0x8cd7('0x1f')](channels[_0x4640be[_0x8cd7('0x6')]][_0x8cd7('0x2b')])){channels[_0x4640be[_0x8cd7('0x6')]][_0x8cd7('0x2b')]=_0x4640be['calleridname']+'\x20<'+_0x4640be[_0x8cd7('0xe')]+'>';}utils[_0x8cd7('0x8')](util[_0x8cd7('0x9')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x4640be['uniqueid'],channels[_0x4640be[_0x8cd7('0x6')]][_0x8cd7('0x2b')],_0x4640be[_0x8cd7('0x2c')]));channels[_0x4640be['uniqueid']][_0x8cd7('0x2d')]=utils[_0x8cd7('0x23')]();channels[_0x4640be['uniqueid']][_0x8cd7('0x2e')]=utils[_0x8cd7('0x2f')](channels[_0x4640be[_0x8cd7('0x6')]]['endtime'],channels[_0x4640be[_0x8cd7('0x6')]]['starttime']);channels[_0x4640be[_0x8cd7('0x6')]]['billableseconds']=channels[_0x4640be[_0x8cd7('0x6')]][_0x8cd7('0x26')]?utils[_0x8cd7('0x2f')](channels[_0x4640be[_0x8cd7('0x6')]][_0x8cd7('0x2d')],channels[_0x4640be['uniqueid']]['answertime']):0x0;writeDB(channels[_0x4640be[_0x8cd7('0x6')]]);}}catch(_0x498964){utils[_0x8cd7('0x30')](util[_0x8cd7('0x9')](_0x8cd7('0x2a'),_0x4640be[_0x8cd7('0x6')]),_0x498964);}};exports[_0x8cd7('0x31')]=function(_0x5c451e){try{if(!_[_0x8cd7('0x1f')](channels[_0x5c451e[_0x8cd7('0x32')]])){utils[_0x8cd7('0x16')](util[_0x8cd7('0x9')]('[%s][calls][attendedtransfer]',_0x5c451e['origtransfereruniqueid']),_0x5c451e);if(channels[_0x5c451e[_0x8cd7('0x32')]][_0x8cd7('0xa')]==_0x5c451e[_0x8cd7('0x33')]){utils['info'](util['format'](_0x8cd7('0x34'),_0x5c451e['origtransfereruniqueid'],_0x5c451e[_0x8cd7('0x32')],_0x5c451e[_0x8cd7('0x35')]));channels[_0x5c451e['localtwolinkedid']][_0x8cd7('0x36')]=_0x5c451e[_0x8cd7('0x35')];channels[_0x5c451e[_0x8cd7('0x32')]][_0x8cd7('0x37')]=_0x8cd7('0x38');}else if(channels[_0x5c451e[_0x8cd7('0x32')]]['channel']=_0x5c451e[_0x8cd7('0x39')]){utils['info'](util[_0x8cd7('0x9')](_0x8cd7('0x34'),_0x5c451e[_0x8cd7('0x3a')],_0x5c451e['localtwolinkedid'],_0x5c451e[_0x8cd7('0x3b')]));channels[_0x5c451e[_0x8cd7('0x32')]]['destinationchannel']=_0x5c451e[_0x8cd7('0x3b')];channels[_0x5c451e['localtwolinkedid']]['userfield']='_attended';}}}catch(_0x76e4a9){utils[_0x8cd7('0x30')](util[_0x8cd7('0x9')](_0x8cd7('0x3c'),_0x5c451e['origtransfereruniqueid']),_0x76e4a9);}};exports[_0x8cd7('0x3d')]=function(_0x5d5714){try{if(!_[_0x8cd7('0x1f')](channels[_0x5d5714['uniqueid']])){utils[_0x8cd7('0x16')](util[_0x8cd7('0x9')](_0x8cd7('0x3e'),_0x5d5714[_0x8cd7('0x6')]),_0x5d5714);channels[_0x5d5714['uniqueid']][_0x8cd7('0x3f')]=utils[_0x8cd7('0x23')]();utils[_0x8cd7('0x8')](util[_0x8cd7('0x9')](_0x8cd7('0x40'),_0x5d5714['uniqueid'],channels[_0x5d5714[_0x8cd7('0x6')]][_0x8cd7('0x3f')]));}}catch(_0x3faad2){utils[_0x8cd7('0x30')](util[_0x8cd7('0x9')](_0x8cd7('0x3e'),_0x5d5714[_0x8cd7('0x6')]),_0x3faad2);}};exports[_0x8cd7('0x41')]=function(_0x27d09f){try{if(!_[_0x8cd7('0x1f')](channels[_0x27d09f['uniqueid']])){utils['debug'](util[_0x8cd7('0x9')](_0x8cd7('0x42'),_0x27d09f['uniqueid']),_0x27d09f);if(!_['isNil'](channels[_0x27d09f[_0x8cd7('0x6')]]['musiconholdstartAt'])){channels[_0x27d09f[_0x8cd7('0x6')]]['mohtime']+=utils['diffTime'](utils[_0x8cd7('0x23')](),channels[_0x27d09f[_0x8cd7('0x6')]][_0x8cd7('0x3f')]);utils[_0x8cd7('0x8')](util[_0x8cd7('0x9')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x27d09f[_0x8cd7('0x6')],channels[_0x27d09f[_0x8cd7('0x6')]][_0x8cd7('0x43')]));delete channels[_0x27d09f[_0x8cd7('0x6')]][_0x8cd7('0x3f')];}}}catch(_0x10094f){utils[_0x8cd7('0x30')](util[_0x8cd7('0x9')]('[%s][calls][musiconholdstop]',_0x27d09f[_0x8cd7('0x6')]),_0x10094f);}};exports['varset']=function(_0x2b263b){try{if(!_[_0x8cd7('0x1f')](channels[_0x2b263b['uniqueid']])){utils[_0x8cd7('0x16')](util['format'](_0x8cd7('0x44'),_0x2b263b[_0x8cd7('0x6')]),_0x2b263b);if(!_['isNil'](_0x2b263b[_0x8cd7('0x45')][_0x8cd7('0x46')])){utils[_0x8cd7('0x8')](util[_0x8cd7('0x9')](_0x8cd7('0x47'),_0x2b263b[_0x8cd7('0x6')],_0x2b263b['value']));channels[_0x2b263b[_0x8cd7('0x6')]]['source']=_0x2b263b[_0x8cd7('0x48')];}if(!_[_0x8cd7('0x1f')](_0x2b263b[_0x8cd7('0x45')][_0x8cd7('0x49')])){utils[_0x8cd7('0x8')](util[_0x8cd7('0x9')](_0x8cd7('0x4a'),_0x2b263b[_0x8cd7('0x6')],_0x2b263b[_0x8cd7('0x48')]));channels[_0x2b263b[_0x8cd7('0x6')]][_0x8cd7('0x4b')]=_0x2b263b[_0x8cd7('0x48')];channels[_0x2b263b[_0x8cd7('0x6')]]['callerid']='\x22'+_0x2b263b[_0x8cd7('0x48')]+_0x8cd7('0x4c')+_0x2b263b['value']+'>';}if(!_[_0x8cd7('0x1f')](_0x2b263b[_0x8cd7('0x45')]['xmd-callerid-preview'])||!_[_0x8cd7('0x1f')](_0x2b263b['variable'][_0x8cd7('0x4d')])){utils[_0x8cd7('0x8')](util[_0x8cd7('0x9')](_0x8cd7('0x4e'),_0x2b263b['uniqueid'],!_[_0x8cd7('0x1f')](_0x2b263b['variable'][_0x8cd7('0x4f')])?_0x8cd7('0x4f'):_0x8cd7('0x4d'),_0x2b263b[_0x8cd7('0x48')]));channels[_0x2b263b[_0x8cd7('0x6')]]['callerid']=_0x2b263b[_0x8cd7('0x48')];}if(!_['isNil'](_0x2b263b[_0x8cd7('0x45')][_0x8cd7('0x50')])||!_[_0x8cd7('0x1f')](_0x2b263b[_0x8cd7('0x45')][_0x8cd7('0x51')])){utils[_0x8cd7('0x8')](util['format'](_0x8cd7('0x4e'),_0x2b263b[_0x8cd7('0x6')],!_['isNil'](_0x2b263b[_0x8cd7('0x45')][_0x8cd7('0x50')])?'xmd-queue':_0x8cd7('0x51'),_0x2b263b[_0x8cd7('0x48')]));channels[_0x2b263b[_0x8cd7('0x6')]][_0x8cd7('0x52')]='Queue';channels[_0x2b263b['uniqueid']][_0x8cd7('0x53')]=_0x2b263b[_0x8cd7('0x48')];channels[_0x2b263b[_0x8cd7('0x6')]][_0x8cd7('0xb')]=!![];}if(!_[_0x8cd7('0x1f')](_0x2b263b['variable'][_0x8cd7('0x54')])){utils['info'](util[_0x8cd7('0x9')](_0x8cd7('0x55'),_0x2b263b[_0x8cd7('0x6')],_0x2b263b[_0x8cd7('0x48')]));channels[_0x2b263b['uniqueid']][_0x8cd7('0x56')]=_0x2b263b[_0x8cd7('0x48')];}if(!_[_0x8cd7('0x1f')](_0x2b263b['variable'][_0x8cd7('0x57')])){utils[_0x8cd7('0x8')](util[_0x8cd7('0x9')](_0x8cd7('0x58'),_0x2b263b[_0x8cd7('0x6')],_0x2b263b[_0x8cd7('0x48')]));channels[_0x2b263b[_0x8cd7('0x6')]][_0x8cd7('0x59')]=_0x2b263b[_0x8cd7('0x48')];}if(!_[_0x8cd7('0x1f')](_0x2b263b[_0x8cd7('0x45')][_0x8cd7('0x5a')])){utils[_0x8cd7('0x8')](util[_0x8cd7('0x9')](_0x8cd7('0x5b'),_0x2b263b[_0x8cd7('0x6')],_0x2b263b[_0x8cd7('0x48')]));channels[_0x2b263b[_0x8cd7('0x6')]][_0x8cd7('0x5c')]=_0x2b263b[_0x8cd7('0x48')];}if(!_[_0x8cd7('0x1f')](_0x2b263b[_0x8cd7('0x45')][_0x8cd7('0x5d')])){utils[_0x8cd7('0x8')](util[_0x8cd7('0x9')](_0x8cd7('0x5e'),_0x2b263b[_0x8cd7('0x6')],_0x2b263b[_0x8cd7('0x48')]));channels[_0x2b263b[_0x8cd7('0x6')]]['sipcallid']=_0x2b263b[_0x8cd7('0x48')];}}}catch(_0x2f9886){utils[_0x8cd7('0x30')](util[_0x8cd7('0x9')]('[%s][calls][varset]',_0x2b263b[_0x8cd7('0x6')]),_0x2f9886);}};exports[_0x8cd7('0x5f')]=function(_0x402166){try{if(!_[_0x8cd7('0x1f')](channels[_0x402166[_0x8cd7('0x6')]])){utils[_0x8cd7('0x16')](util['format']('[%s][calls][newexten]',_0x402166[_0x8cd7('0x6')]),_0x402166);utils[_0x8cd7('0x8')](util[_0x8cd7('0x9')](_0x8cd7('0x60'),_0x402166[_0x8cd7('0x6')],_0x402166[_0x8cd7('0x61')],_0x402166[_0x8cd7('0x62')]));if(_0x402166['application'][_0x8cd7('0x63')]()==_0x8cd7('0x64')&&_[_0x8cd7('0x65')](_0x402166['appdata'][_0x8cd7('0x63')](),'cdr')){var _0x3a7a42=_0x402166[_0x8cd7('0x62')][_0x8cd7('0x66')]('=');var _0x5bef8c=_0x3a7a42[0x0][_0x8cd7('0x67')](_0x3a7a42[0x0][_0x8cd7('0x68')]('(')+0x1,_0x3a7a42[0x0][_0x8cd7('0x68')](')'));var _0x31baca=_0x3a7a42[0x1];channels[_0x402166[_0x8cd7('0x6')]][_0x5bef8c]=_0x31baca;}if(!_[_0x8cd7('0x69')]([_0x8cd7('0x29'),_0x8cd7('0x6a'),'execif',_0x8cd7('0x64'),'gotoif'],_0x402166[_0x8cd7('0x61')]['toLowerCase']())){channels[_0x402166['uniqueid']]['lastapplication']=_0x402166[_0x8cd7('0x61')];channels[_0x402166[_0x8cd7('0x6')]][_0x8cd7('0x53')]=_0x402166[_0x8cd7('0x62')];}}}catch(_0x123085){utils[_0x8cd7('0x30')](util[_0x8cd7('0x9')](_0x8cd7('0x6b'),_0x402166[_0x8cd7('0x6')]),_0x123085);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 453ca80..0b082b4 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 _0xcc13=['[core]\x20error','close','[core]\x20close','managerevent','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x97bbfd,_0xd00fda){var _0x288aaa=function(_0x21d8a9){while(--_0x21d8a9){_0x97bbfd['push'](_0x97bbfd['shift']());}};_0x288aaa(++_0xd00fda);}(_0xcc13,0x190));var _0x3cc1=function(_0x15dc21,_0x16a085){_0x15dc21=_0x15dc21-0x0;var _0x29a859=_0xcc13[_0x15dc21];return _0x29a859;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x3cc1('0x0')](_0x3cc1('0x1'));};exports[_0x3cc1('0x2')]=function(){utils['info'](_0x3cc1('0x3'));};exports[_0x3cc1('0x4')]=function(){utils[_0x3cc1('0x0')](_0x3cc1('0x5'));};exports[_0x3cc1('0x6')]=function(_0x547ec8){utils[_0x3cc1('0x6')](_0x3cc1('0x7'),_0x547ec8);};exports[_0x3cc1('0x8')]=function(){utils[_0x3cc1('0x0')](_0x3cc1('0x9'));};exports[_0x3cc1('0xa')]=function(_0xfd4b7d){}; \ No newline at end of file +var _0x5757=['[core]\x20connected','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','./utils'];(function(_0x49c73e,_0xb3d48d){var _0x2c539e=function(_0x130ba5){while(--_0x130ba5){_0x49c73e['push'](_0x49c73e['shift']());}};_0x2c539e(++_0xb3d48d);}(_0x5757,0x6d));var _0x7575=function(_0x2f7c95,_0xf84c30){_0x2f7c95=_0x2f7c95-0x0;var _0x3f5382=_0x5757[_0x2f7c95];return _0x3f5382;};'use strict';var utils=require(_0x7575('0x0'));exports['connect']=function(){utils['info'](_0x7575('0x1'));};exports['shutdown']=function(){utils[_0x7575('0x2')](_0x7575('0x3'));};exports[_0x7575('0x4')]=function(){utils[_0x7575('0x2')](_0x7575('0x5'));};exports[_0x7575('0x6')]=function(_0x8a003a){utils[_0x7575('0x6')](_0x7575('0x7'),_0x8a003a);};exports[_0x7575('0x8')]=function(){utils[_0x7575('0x2')]('[core]\x20close');};exports[_0x7575('0x9')]=function(_0x1532d8){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index bb08a0e..90dce93 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 _0x9988=['debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','error','[%s][dials][varset]','variable','value','dialbegin','isNil','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten'];(function(_0x5b8819,_0x333a9b){var _0x39d21d=function(_0x208576){while(--_0x208576){_0x5b8819['push'](_0x5b8819['shift']());}};_0x39d21d(++_0x333a9b);}(_0x9988,0x15f));var _0x8998=function(_0x3ec15a,_0xbcba29){_0x3ec15a=_0x3ec15a-0x0;var _0x401837=_0x9988[_0x3ec15a];return _0x401837;};'use strict';var _=require('lodash');var util=require(_0x8998('0x0'));var utils=require(_0x8998('0x1'));var dials={};function writeDB(_0x5b1ec5){utils[_0x8998('0x2')](util[_0x8998('0x3')](_0x8998('0x4'),_0x5b1ec5[_0x8998('0x5')],_0x5b1ec5['channel'],_0x5b1ec5[_0x8998('0x6')],_0x5b1ec5[_0x8998('0x7')],_0x5b1ec5[_0x8998('0x8')],_0x5b1ec5[_0x8998('0x9')]));utils[_0x8998('0xa')](_0x8998('0xb'),_0x5b1ec5);delete dials[_0x5b1ec5[_0x8998('0x5')]];}exports[_0x8998('0xc')]=function(_0x356e4){try{utils[_0x8998('0xd')](util[_0x8998('0x3')](_0x8998('0xe'),_0x356e4[_0x8998('0x5')]),_0x356e4);utils[_0x8998('0x2')](util[_0x8998('0x3')](_0x8998('0xf'),_0x356e4[_0x8998('0x5')],_0x356e4[_0x8998('0x10')],_0x356e4[_0x8998('0x11')]));if(_0x356e4[_0x8998('0x10')]['toLowerCase']()==_0x8998('0x12')&&_[_0x8998('0x13')](_0x356e4['appdata'][_0x8998('0x14')](),_0x8998('0x15'))){var _0xc255ac=_0x356e4[_0x8998('0x11')][_0x8998('0x16')]('=');dials[_0x356e4[_0x8998('0x5')]]={'routeId':_0xc255ac[0x1]};}}catch(_0x788bad){utils[_0x8998('0x17')](util[_0x8998('0x3')](_0x8998('0xe'),_0x356e4[_0x8998('0x5')]),_0x788bad);}};exports['varset']=function(_0x54801a){try{utils[_0x8998('0xd')](util[_0x8998('0x3')](_0x8998('0x18'),_0x54801a[_0x8998('0x5')]),_0x54801a);if(!_['isNil'](_0x54801a[_0x8998('0x19')]['outboundrouteid'])){utils[_0x8998('0x2')](util[_0x8998('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x54801a[_0x8998('0x5')],_0x54801a[_0x8998('0x1a')]));dials[_0x54801a['uniqueid']]={'routeId':_0x54801a[_0x8998('0x1a')]};}}catch(_0x31c3e6){utils[_0x8998('0x17')](util[_0x8998('0x3')]('[%s][dials][varset]',_0x54801a[_0x8998('0x5')]),_0x31c3e6);}};exports[_0x8998('0x1b')]=function(_0x4c2f7a){try{if(!_[_0x8998('0x1c')](dials[_0x4c2f7a[_0x8998('0x5')]])){utils[_0x8998('0xd')](util[_0x8998('0x3')]('[%s][dials][dialbegin]',_0x4c2f7a['uniqueid']),_0x4c2f7a);dials[_0x4c2f7a[_0x8998('0x5')]]=_[_0x8998('0x1d')](dials[_0x4c2f7a[_0x8998('0x5')]],_0x4c2f7a);dials[_0x4c2f7a[_0x8998('0x5')]][_0x8998('0x1e')]=utils[_0x8998('0x1f')]();dials[_0x4c2f7a[_0x8998('0x5')]][_0x8998('0x20')]=_0x8998('0x21');utils['info'](util[_0x8998('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4c2f7a['uniqueid'],dials[_0x4c2f7a[_0x8998('0x5')]][_0x8998('0x1e')]));}}catch(_0x2fb90d){utils['error'](util['format'](_0x8998('0x22'),_0x4c2f7a['uniqueid']),_0x2fb90d);}};exports[_0x8998('0x23')]=function(_0x3ed174){try{if(!_[_0x8998('0x1c')](dials[_0x3ed174['uniqueid']])){utils[_0x8998('0xd')](util[_0x8998('0x3')](_0x8998('0x24'),_0x3ed174['uniqueid']),_0x3ed174);dials[_0x3ed174['uniqueid']]['dialstatus']=_0x3ed174[_0x8998('0x9')];if(_0x3ed174[_0x8998('0x9')]==_0x8998('0x25')){dials[_0x3ed174[_0x8998('0x5')]]=_[_0x8998('0x1d')](dials[_0x3ed174[_0x8998('0x5')]],_0x3ed174);dials[_0x3ed174['uniqueid']][_0x8998('0x26')]=utils[_0x8998('0x1f')]();dials[_0x3ed174[_0x8998('0x5')]]['lastevent']=_0x8998('0x27');utils['info'](util[_0x8998('0x3')](_0x8998('0x28'),_0x3ed174[_0x8998('0x5')],_0x3ed174[_0x8998('0x9')],dials[_0x3ed174[_0x8998('0x5')]]['answertime']));}else{utils[_0x8998('0x2')](util[_0x8998('0x3')](_0x8998('0x29'),_0x3ed174[_0x8998('0x5')],_0x3ed174[_0x8998('0x9')]));}}}catch(_0x37d983){utils[_0x8998('0x17')](util[_0x8998('0x3')]('[%s][dials][dialend]',_0x3ed174[_0x8998('0x5')]),_0x37d983);}};exports[_0x8998('0x2a')]=function(_0x4f6ca3){try{if(!_['isNil'](dials[_0x4f6ca3[_0x8998('0x5')]])){utils[_0x8998('0xd')](util[_0x8998('0x3')]('[%s][dials][hangup]',_0x4f6ca3[_0x8998('0x5')]),_0x4f6ca3);utils['info'](util[_0x8998('0x3')](_0x8998('0x2b'),_0x4f6ca3[_0x8998('0x5')],_0x4f6ca3['calleridnum'],_0x4f6ca3[_0x8998('0x2c')],_0x4f6ca3[_0x8998('0x2d')]));dials[_0x4f6ca3[_0x8998('0x5')]]=_[_0x8998('0x1d')](dials[_0x4f6ca3[_0x8998('0x5')]],{'endtime':utils[_0x8998('0x1f')](),'lastevent':_0x8998('0x2e')});dials[_0x4f6ca3[_0x8998('0x5')]][_0x8998('0x2f')]=utils[_0x8998('0x30')](dials[_0x4f6ca3['uniqueid']][_0x8998('0x31')],dials[_0x4f6ca3[_0x8998('0x5')]][_0x8998('0x1e')]);dials[_0x4f6ca3[_0x8998('0x5')]][_0x8998('0x32')]=utils[_0x8998('0x30')](dials[_0x4f6ca3[_0x8998('0x5')]][_0x8998('0x26')]||dials[_0x4f6ca3[_0x8998('0x5')]][_0x8998('0x31')],dials[_0x4f6ca3['uniqueid']][_0x8998('0x1e')]);dials[_0x4f6ca3[_0x8998('0x5')]][_0x8998('0x33')]=dials[_0x4f6ca3[_0x8998('0x5')]][_0x8998('0x26')]?utils['diffTime'](dials[_0x4f6ca3[_0x8998('0x5')]][_0x8998('0x31')],dials[_0x4f6ca3['uniqueid']][_0x8998('0x26')]):0x0;writeDB(dials[_0x4f6ca3['uniqueid']]);}}catch(_0x1e00e0){utils['error'](util[_0x8998('0x3')]('[%s][dials][hangup]',_0x4f6ca3[_0x8998('0x5')]),_0x1e00e0);}}; \ No newline at end of file +var _0x82c3=['split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','duration','diffTime','endtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','appdata','application','toLowerCase','set','startsWith','cdr(routeid)'];(function(_0xa1cd78,_0x3673a2){var _0x1f9152=function(_0xcb26e5){while(--_0xcb26e5){_0xa1cd78['push'](_0xa1cd78['shift']());}};_0x1f9152(++_0x3673a2);}(_0x82c3,0x1b6));var _0x382c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x82c3[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x382c('0x0'));var utils=require(_0x382c('0x1'));var dials={};function writeDB(_0x183551){utils[_0x382c('0x2')](util[_0x382c('0x3')](_0x382c('0x4'),_0x183551[_0x382c('0x5')],_0x183551[_0x382c('0x6')],_0x183551[_0x382c('0x7')],_0x183551['calleridnum'],_0x183551[_0x382c('0x8')],_0x183551[_0x382c('0x9')]));utils[_0x382c('0xa')](_0x382c('0xb'),_0x183551);delete dials[_0x183551[_0x382c('0x5')]];}exports[_0x382c('0xc')]=function(_0x2a03d9){try{utils[_0x382c('0xd')](util[_0x382c('0x3')](_0x382c('0xe'),_0x2a03d9[_0x382c('0x5')]),_0x2a03d9);utils[_0x382c('0x2')](util[_0x382c('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x2a03d9[_0x382c('0x5')],_0x2a03d9['application'],_0x2a03d9[_0x382c('0xf')]));if(_0x2a03d9[_0x382c('0x10')][_0x382c('0x11')]()==_0x382c('0x12')&&_[_0x382c('0x13')](_0x2a03d9['appdata'][_0x382c('0x11')](),_0x382c('0x14'))){var _0x19ca9b=_0x2a03d9[_0x382c('0xf')][_0x382c('0x15')]('=');dials[_0x2a03d9[_0x382c('0x5')]]={'routeId':_0x19ca9b[0x1]};}}catch(_0xf23556){utils[_0x382c('0x16')](util[_0x382c('0x3')](_0x382c('0xe'),_0x2a03d9[_0x382c('0x5')]),_0xf23556);}};exports[_0x382c('0x17')]=function(_0x451cf4){try{utils[_0x382c('0xd')](util[_0x382c('0x3')]('[%s][dials][varset]',_0x451cf4[_0x382c('0x5')]),_0x451cf4);if(!_[_0x382c('0x18')](_0x451cf4[_0x382c('0x19')][_0x382c('0x1a')])){utils[_0x382c('0x2')](util[_0x382c('0x3')](_0x382c('0x1b'),_0x451cf4[_0x382c('0x5')],_0x451cf4[_0x382c('0x1c')]));dials[_0x451cf4['uniqueid']]={'routeId':_0x451cf4[_0x382c('0x1c')]};}}catch(_0x2b5cae){utils[_0x382c('0x16')](util[_0x382c('0x3')](_0x382c('0x1d'),_0x451cf4[_0x382c('0x5')]),_0x2b5cae);}};exports[_0x382c('0x1e')]=function(_0x16f108){try{if(!_[_0x382c('0x18')](dials[_0x16f108[_0x382c('0x5')]])){utils[_0x382c('0xd')](util[_0x382c('0x3')](_0x382c('0x1f'),_0x16f108[_0x382c('0x5')]),_0x16f108);dials[_0x16f108[_0x382c('0x5')]]=_[_0x382c('0x20')](dials[_0x16f108[_0x382c('0x5')]],_0x16f108);dials[_0x16f108['uniqueid']][_0x382c('0x21')]=utils[_0x382c('0x22')]();dials[_0x16f108[_0x382c('0x5')]][_0x382c('0x23')]=_0x382c('0x24');utils['info'](util[_0x382c('0x3')](_0x382c('0x25'),_0x16f108[_0x382c('0x5')],dials[_0x16f108['uniqueid']]['starttime']));}}catch(_0x44910a){utils[_0x382c('0x16')](util[_0x382c('0x3')]('[%s][dials][dialbegin]',_0x16f108[_0x382c('0x5')]),_0x44910a);}};exports[_0x382c('0x26')]=function(_0x36bcb7){try{if(!_[_0x382c('0x18')](dials[_0x36bcb7[_0x382c('0x5')]])){utils[_0x382c('0xd')](util['format'](_0x382c('0x27'),_0x36bcb7['uniqueid']),_0x36bcb7);dials[_0x36bcb7['uniqueid']][_0x382c('0x9')]=_0x36bcb7[_0x382c('0x9')];if(_0x36bcb7[_0x382c('0x9')]=='ANSWER'){dials[_0x36bcb7['uniqueid']]=_[_0x382c('0x20')](dials[_0x36bcb7[_0x382c('0x5')]],_0x36bcb7);dials[_0x36bcb7[_0x382c('0x5')]]['answertime']=utils[_0x382c('0x22')]();dials[_0x36bcb7[_0x382c('0x5')]]['lastevent']=_0x382c('0x28');utils[_0x382c('0x2')](util[_0x382c('0x3')](_0x382c('0x29'),_0x36bcb7['uniqueid'],_0x36bcb7[_0x382c('0x9')],dials[_0x36bcb7[_0x382c('0x5')]][_0x382c('0x2a')]));}else{utils[_0x382c('0x2')](util[_0x382c('0x3')](_0x382c('0x2b'),_0x36bcb7[_0x382c('0x5')],_0x36bcb7[_0x382c('0x9')]));}}}catch(_0x5c8402){utils[_0x382c('0x16')](util['format'](_0x382c('0x27'),_0x36bcb7[_0x382c('0x5')]),_0x5c8402);}};exports['hangup']=function(_0x117575){try{if(!_[_0x382c('0x18')](dials[_0x117575['uniqueid']])){utils['debug'](util[_0x382c('0x3')](_0x382c('0x2c'),_0x117575['uniqueid']),_0x117575);utils['info'](util[_0x382c('0x3')](_0x382c('0x2d'),_0x117575[_0x382c('0x5')],_0x117575['calleridnum'],_0x117575['calleridname'],_0x117575[_0x382c('0x2e')]));dials[_0x117575[_0x382c('0x5')]]=_[_0x382c('0x20')](dials[_0x117575['uniqueid']],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x117575[_0x382c('0x5')]][_0x382c('0x2f')]=utils[_0x382c('0x30')](dials[_0x117575[_0x382c('0x5')]][_0x382c('0x31')],dials[_0x117575[_0x382c('0x5')]]['starttime']);dials[_0x117575[_0x382c('0x5')]]['holdtime']=utils['diffTime'](dials[_0x117575[_0x382c('0x5')]]['answertime']||dials[_0x117575['uniqueid']][_0x382c('0x31')],dials[_0x117575[_0x382c('0x5')]][_0x382c('0x21')]);dials[_0x117575['uniqueid']][_0x382c('0x32')]=dials[_0x117575[_0x382c('0x5')]][_0x382c('0x2a')]?utils[_0x382c('0x30')](dials[_0x117575[_0x382c('0x5')]]['endtime'],dials[_0x117575['uniqueid']][_0x382c('0x2a')]):0x0;writeDB(dials[_0x117575[_0x382c('0x5')]]);}}catch(_0x1760e7){utils[_0x382c('0x16')](util[_0x382c('0x3')](_0x382c('0x2c'),_0x117575[_0x382c('0x5')]),_0x1760e7);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 61dd537..de2e08f 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 _0x2e7c=['[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','format','device','devicestatechange','agentcalled','debug','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]'];(function(_0x391e71,_0x56b8d5){var _0x253a91=function(_0x3dd5e2){while(--_0x3dd5e2){_0x391e71['push'](_0x391e71['shift']());}};_0x253a91(++_0x56b8d5);}(_0x2e7c,0x8e));var _0xc2e7=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x2e7c[_0x1ccdf7];return _0x52a0ae;};var AsteriskManager=require('asterisk-manager');var config=require(_0xc2e7('0x0'));var utils=require(_0xc2e7('0x1'));var util=require(_0xc2e7('0x2'));var ami=new AsteriskManager(config[_0xc2e7('0x3')]['port'],config[_0xc2e7('0x3')]['ip'],config[_0xc2e7('0x3')][_0xc2e7('0x4')],config['asterisk'][_0xc2e7('0x5')],!![]);ami[_0xc2e7('0x6')]();if(config[_0xc2e7('0x7')]&&config[_0xc2e7('0x7')][_0xc2e7('0x8')]){utils[_0xc2e7('0x9')](_0xc2e7('0xa'));}else{var agents=require(_0xc2e7('0xb'));var calls=require(_0xc2e7('0xc'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xc2e7('0xd'));var dials=require(_0xc2e7('0xe'));var transfers=require(_0xc2e7('0xf'));var core=require('./core.controller');ami['on'](_0xc2e7('0x10'),core[_0xc2e7('0x10')]);ami['on']('shutdown',core[_0xc2e7('0x11')]);ami['on']('fullybooted',core[_0xc2e7('0x12')]);ami['on']('error',core[_0xc2e7('0x13')]);ami['on'](_0xc2e7('0x14'),core[_0xc2e7('0x14')]);ami['on'](_0xc2e7('0x15'),core[_0xc2e7('0x15')]);ami['on']('devicestatechange',function(_0x38f4a6){try{utils['debug'](util[_0xc2e7('0x16')]('[%s][index][devicestatechange]',_0x38f4a6[_0xc2e7('0x17')]),_0x38f4a6);members[_0xc2e7('0x18')](_0x38f4a6);}catch(_0x578f2a){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')]('[%s][index][devicestatechange]',_0x38f4a6[_0xc2e7('0x17')]),_0x578f2a);}});ami['on'](_0xc2e7('0x19'),function(_0x166aab){try{utils[_0xc2e7('0x1a')](util[_0xc2e7('0x16')](_0xc2e7('0x1b'),_0x166aab[_0xc2e7('0x1c')]),_0x166aab);agents['agentcalled'](_0x166aab);}catch(_0x15d13b){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')](_0xc2e7('0x1b'),_0x166aab['uniqueid']),_0x15d13b);}});ami['on']('agentringnoanswer',function(_0x365420){try{utils['debug'](util[_0xc2e7('0x16')](_0xc2e7('0x1d'),_0x365420['uniqueid']),_0x365420);agents['agentringnoanswer'](_0x365420);}catch(_0x5686a8){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')](_0xc2e7('0x1d'),_0x365420[_0xc2e7('0x1c')]),_0x5686a8);}});ami['on'](_0xc2e7('0x1e'),function(_0x242791){try{utils[_0xc2e7('0x1a')](util[_0xc2e7('0x16')](_0xc2e7('0x1f'),_0x242791[_0xc2e7('0x1c')]),_0x242791);agents[_0xc2e7('0x1e')](_0x242791);queues[_0xc2e7('0x1e')](_0x242791);}catch(_0x45ea94){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')](_0xc2e7('0x1f'),_0x242791[_0xc2e7('0x1c')]),_0x45ea94);}});ami['on']('agentcomplete',function(_0x523e45){try{utils[_0xc2e7('0x1a')](util[_0xc2e7('0x16')](_0xc2e7('0x20'),_0x523e45[_0xc2e7('0x1c')]),_0x523e45);agents[_0xc2e7('0x21')](_0x523e45);queues['agentcomplete'](_0x523e45);members[_0xc2e7('0x21')](_0x523e45);}catch(_0xc6c137){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')](_0xc2e7('0x20'),_0x523e45[_0xc2e7('0x1c')]),_0xc6c137);}});ami['on'](_0xc2e7('0x22'),function(_0x62fd52){try{utils[_0xc2e7('0x1a')](util[_0xc2e7('0x16')](_0xc2e7('0x23'),_0x62fd52[_0xc2e7('0x1c')]),_0x62fd52);agents[_0xc2e7('0x22')](_0x62fd52);queues['queuecallerabandon'](_0x62fd52);}catch(_0x141b4f){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')](_0xc2e7('0x23'),_0x62fd52['uniqueid']),_0x141b4f);}});ami['on'](_0xc2e7('0x24'),function(_0x5e4076){try{utils['debug'](util[_0xc2e7('0x16')](_0xc2e7('0x25'),_0x5e4076['uniqueid']),_0x5e4076);queues[_0xc2e7('0x24')](_0x5e4076);recordings[_0xc2e7('0x24')](_0x5e4076);}catch(_0x3fe8bc){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')](_0xc2e7('0x25'),_0x5e4076[_0xc2e7('0x1c')]),_0x3fe8bc);}});ami['on']('queuecallerleave',function(_0x59ed87){try{utils[_0xc2e7('0x1a')](util[_0xc2e7('0x16')]('[%s][index][queuecallerleave]',_0x59ed87[_0xc2e7('0x1c')]),_0x59ed87);queues[_0xc2e7('0x26')](_0x59ed87);}catch(_0x4a82f8){utils[_0xc2e7('0x13')](util['format'](_0xc2e7('0x27'),_0x59ed87[_0xc2e7('0x1c')]),_0x4a82f8);}});ami['on'](_0xc2e7('0x28'),function(_0x2750ae){try{utils[_0xc2e7('0x1a')](util[_0xc2e7('0x16')](_0xc2e7('0x29'),_0x2750ae['uniqueid']),_0x2750ae);queues[_0xc2e7('0x28')](_0x2750ae);calls[_0xc2e7('0x28')](_0x2750ae);}catch(_0x387213){utils[_0xc2e7('0x13')](util['format'](_0xc2e7('0x29'),_0x2750ae[_0xc2e7('0x1c')]),_0x387213);}});ami['on']('musiconholdstop',function(_0xd16ebc){try{utils[_0xc2e7('0x1a')](util[_0xc2e7('0x16')](_0xc2e7('0x2a'),_0xd16ebc['uniqueid']),_0xd16ebc);queues[_0xc2e7('0x2b')](_0xd16ebc);calls[_0xc2e7('0x2b')](_0xd16ebc);}catch(_0x2a7758){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')](_0xc2e7('0x2a'),_0xd16ebc[_0xc2e7('0x1c')]),_0x2a7758);}});ami['on'](_0xc2e7('0x2c'),function(_0x2da069){try{utils['debug'](util[_0xc2e7('0x16')](_0xc2e7('0x2d'),_0x2da069[_0xc2e7('0x1c')]),_0x2da069);calls[_0xc2e7('0x2c')](_0x2da069);recordings[_0xc2e7('0x2c')](_0x2da069);}catch(_0x3cb1e5){utils[_0xc2e7('0x13')](util['format']('[%s][index][newstate]',_0x2da069['uniqueid']),_0x3cb1e5);}});ami['on'](_0xc2e7('0x2e'),function(_0x404597){try{utils['debug'](util['format'](_0xc2e7('0x2f'),_0x404597[_0xc2e7('0x1c')]),_0x404597);calls[_0xc2e7('0x2e')](_0x404597);recordings['hangup'](_0x404597);dials[_0xc2e7('0x2e')](_0x404597);agents[_0xc2e7('0x2e')](_0x404597);queues['hangup'](_0x404597);}catch(_0x2119a0){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')](_0xc2e7('0x2f'),_0x404597[_0xc2e7('0x1c')]),_0x2119a0);}});ami['on'](_0xc2e7('0x30'),function(_0x1a5b1f){try{utils['debug'](util[_0xc2e7('0x16')](_0xc2e7('0x31'),_0x1a5b1f[_0xc2e7('0x1c')]),_0x1a5b1f);members[_0xc2e7('0x30')](_0x1a5b1f);}catch(_0x5d5a23){utils['error'](util[_0xc2e7('0x16')](_0xc2e7('0x31'),_0x1a5b1f[_0xc2e7('0x1c')]),_0x5d5a23);}});ami['on']('blindtransfer',function(_0x597632){try{utils[_0xc2e7('0x1a')](util['format'](_0xc2e7('0x32'),_0x597632[_0xc2e7('0x1c')]),_0x597632);queues[_0xc2e7('0x33')](_0x597632);agents[_0xc2e7('0x33')](_0x597632);transfers[_0xc2e7('0x33')](_0x597632);}catch(_0x3ebc3e){utils[_0xc2e7('0x13')](util['format']('[%s][index][blindtransfer]',_0x597632[_0xc2e7('0x1c')]),_0x3ebc3e);}});ami['on'](_0xc2e7('0x34'),function(_0x36aff5){try{utils['debug'](util['format']('[%s][index][attendedtransfer]',_0x36aff5[_0xc2e7('0x35')]),_0x36aff5);queues[_0xc2e7('0x34')](_0x36aff5);transfers[_0xc2e7('0x34')](_0x36aff5);agents[_0xc2e7('0x34')](_0x36aff5);calls['attendedtransfer'](_0x36aff5);}catch(_0x12599a){utils['error'](util[_0xc2e7('0x16')]('[%s][index][attendedtransfer]',_0x36aff5[_0xc2e7('0x35')]),_0x12599a);}});ami['on']('varset',function(_0x182be8){try{utils['debug'](util['format'](_0xc2e7('0x36'),_0x182be8['uniqueid']),_0x182be8);queues[_0xc2e7('0x37')](_0x182be8);recordings[_0xc2e7('0x37')](_0x182be8);calls[_0xc2e7('0x37')](_0x182be8);dials[_0xc2e7('0x37')](_0x182be8);}catch(_0x475b17){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')](_0xc2e7('0x36'),_0x182be8[_0xc2e7('0x1c')]),_0x475b17);}});ami['on'](_0xc2e7('0x38'),function(_0x36f71c){try{utils[_0xc2e7('0x1a')](util[_0xc2e7('0x16')](_0xc2e7('0x39'),_0x36f71c['uniqueid']),_0x36f71c);calls[_0xc2e7('0x38')](_0x36f71c);recordings['newexten'](_0x36f71c);dials[_0xc2e7('0x38')](_0x36f71c);}catch(_0x186d8d){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')](_0xc2e7('0x39'),_0x36f71c[_0xc2e7('0x1c')]),_0x186d8d);}});ami['on'](_0xc2e7('0x3a'),function(_0x32a387){try{utils['debug'](util[_0xc2e7('0x16')]('[%s][index][newchannel]',_0x32a387['uniqueid']),_0x32a387);calls['newchannel'](_0x32a387);recordings[_0xc2e7('0x3a')](_0x32a387);}catch(_0x1acd05){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')]('[%s][index][newchannel]',_0x32a387[_0xc2e7('0x1c')]),_0x1acd05);}});ami['on'](_0xc2e7('0x3b'),function(_0x2d1acd){try{utils[_0xc2e7('0x1a')](util[_0xc2e7('0x16')](_0xc2e7('0x3c'),_0x2d1acd[_0xc2e7('0x1c')]),_0x2d1acd);dials['dialbegin'](_0x2d1acd);}catch(_0x45b11e){utils[_0xc2e7('0x13')](util['format'](_0xc2e7('0x3d'),_0x2d1acd['uniqueid']),_0x45b11e);}});ami['on'](_0xc2e7('0x3e'),function(_0xc46b5a){try{utils['debug'](util[_0xc2e7('0x16')](_0xc2e7('0x3f'),_0xc46b5a['uniqueid']),_0xc46b5a);dials[_0xc2e7('0x3e')](_0xc46b5a);}catch(_0x17045c){utils[_0xc2e7('0x13')](util[_0xc2e7('0x16')](_0xc2e7('0x3f'),_0xc46b5a['uniqueid']),_0x17045c);}});} \ No newline at end of file +var _0x591f=['./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','../../config/environment','./utils','port','username','asterisk','password','keepConnected','xdr','info','./calls.controller','./dials.controller','./transfers.controller'];(function(_0x4ef866,_0x55037f){var _0x10af0c=function(_0x5a4297){while(--_0x5a4297){_0x4ef866['push'](_0x4ef866['shift']());}};_0x10af0c(++_0x55037f);}(_0x591f,0x1ad));var _0xf591=function(_0x39b68b,_0x4ad96d){_0x39b68b=_0x39b68b-0x0;var _0xae091f=_0x591f[_0x39b68b];return _0xae091f;};var AsteriskManager=require('asterisk-manager');var config=require(_0xf591('0x0'));var utils=require(_0xf591('0x1'));var util=require('util');var ami=new AsteriskManager(config['asterisk'][_0xf591('0x2')],config['asterisk']['ip'],config['asterisk'][_0xf591('0x3')],config[_0xf591('0x4')][_0xf591('0x5')],!![]);ami[_0xf591('0x6')]();if(config[_0xf591('0x7')]&&config[_0xf591('0x7')]['disabled']){utils[_0xf591('0x8')]('XDR\x20DISABLED');}else{var agents=require('./agents.controller');var calls=require(_0xf591('0x9'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0xf591('0xa'));var transfers=require(_0xf591('0xb'));var core=require(_0xf591('0xc'));ami['on'](_0xf591('0xd'),core['connect']);ami['on'](_0xf591('0xe'),core[_0xf591('0xe')]);ami['on'](_0xf591('0xf'),core['fullybooted']);ami['on'](_0xf591('0x10'),core['error']);ami['on'](_0xf591('0x11'),core['close']);ami['on'](_0xf591('0x12'),core['managerevent']);ami['on'](_0xf591('0x13'),function(_0xdba2f8){try{utils[_0xf591('0x14')](util[_0xf591('0x15')](_0xf591('0x16'),_0xdba2f8[_0xf591('0x17')]),_0xdba2f8);members[_0xf591('0x13')](_0xdba2f8);}catch(_0x239c18){utils[_0xf591('0x10')](util[_0xf591('0x15')](_0xf591('0x16'),_0xdba2f8[_0xf591('0x17')]),_0x239c18);}});ami['on']('agentcalled',function(_0x20f8e1){try{utils[_0xf591('0x14')](util['format'](_0xf591('0x18'),_0x20f8e1[_0xf591('0x19')]),_0x20f8e1);agents[_0xf591('0x1a')](_0x20f8e1);}catch(_0xd33707){utils[_0xf591('0x10')](util['format']('[%s][index][agentcalled]',_0x20f8e1[_0xf591('0x19')]),_0xd33707);}});ami['on']('agentringnoanswer',function(_0x404e91){try{utils['debug'](util[_0xf591('0x15')]('[%s][index][agentringnoanswer]',_0x404e91['uniqueid']),_0x404e91);agents[_0xf591('0x1b')](_0x404e91);}catch(_0x2ef07a){utils[_0xf591('0x10')](util[_0xf591('0x15')](_0xf591('0x1c'),_0x404e91['uniqueid']),_0x2ef07a);}});ami['on'](_0xf591('0x1d'),function(_0x9ebac7){try{utils[_0xf591('0x14')](util['format'](_0xf591('0x1e'),_0x9ebac7['uniqueid']),_0x9ebac7);agents[_0xf591('0x1d')](_0x9ebac7);queues[_0xf591('0x1d')](_0x9ebac7);}catch(_0x4a6bf4){utils['error'](util[_0xf591('0x15')]('[%s][index][agentconnect]',_0x9ebac7['uniqueid']),_0x4a6bf4);}});ami['on'](_0xf591('0x1f'),function(_0x1f7c7a){try{utils[_0xf591('0x14')](util[_0xf591('0x15')](_0xf591('0x20'),_0x1f7c7a[_0xf591('0x19')]),_0x1f7c7a);agents[_0xf591('0x1f')](_0x1f7c7a);queues[_0xf591('0x1f')](_0x1f7c7a);members[_0xf591('0x1f')](_0x1f7c7a);}catch(_0x315f9b){utils[_0xf591('0x10')](util['format'](_0xf591('0x20'),_0x1f7c7a['uniqueid']),_0x315f9b);}});ami['on'](_0xf591('0x21'),function(_0x58582b){try{utils['debug'](util[_0xf591('0x15')](_0xf591('0x22'),_0x58582b['uniqueid']),_0x58582b);agents[_0xf591('0x21')](_0x58582b);queues['queuecallerabandon'](_0x58582b);}catch(_0x1bb6b2){utils[_0xf591('0x10')](util[_0xf591('0x15')]('[%s][index][queuecallerabandon]',_0x58582b['uniqueid']),_0x1bb6b2);}});ami['on'](_0xf591('0x23'),function(_0xa44a8d){try{utils[_0xf591('0x14')](util[_0xf591('0x15')](_0xf591('0x24'),_0xa44a8d[_0xf591('0x19')]),_0xa44a8d);queues[_0xf591('0x23')](_0xa44a8d);recordings[_0xf591('0x23')](_0xa44a8d);}catch(_0x473bb7){utils[_0xf591('0x10')](util[_0xf591('0x15')](_0xf591('0x24'),_0xa44a8d[_0xf591('0x19')]),_0x473bb7);}});ami['on'](_0xf591('0x25'),function(_0x2fe9dd){try{utils['debug'](util[_0xf591('0x15')]('[%s][index][queuecallerleave]',_0x2fe9dd[_0xf591('0x19')]),_0x2fe9dd);queues['queuecallerleave'](_0x2fe9dd);}catch(_0x3dd2db){utils[_0xf591('0x10')](util[_0xf591('0x15')]('[%s][index][queuecallerleave]',_0x2fe9dd[_0xf591('0x19')]),_0x3dd2db);}});ami['on'](_0xf591('0x26'),function(_0x2ca7d7){try{utils['debug'](util['format']('[%s][index][musiconholdstart]',_0x2ca7d7['uniqueid']),_0x2ca7d7);queues[_0xf591('0x26')](_0x2ca7d7);calls['musiconholdstart'](_0x2ca7d7);}catch(_0x4580ca){utils[_0xf591('0x10')](util[_0xf591('0x15')](_0xf591('0x27'),_0x2ca7d7[_0xf591('0x19')]),_0x4580ca);}});ami['on']('musiconholdstop',function(_0x5a6cb7){try{utils[_0xf591('0x14')](util['format'](_0xf591('0x28'),_0x5a6cb7[_0xf591('0x19')]),_0x5a6cb7);queues['musiconholdstop'](_0x5a6cb7);calls[_0xf591('0x29')](_0x5a6cb7);}catch(_0x32ad26){utils[_0xf591('0x10')](util[_0xf591('0x15')]('[%s][index][musiconholdstop]',_0x5a6cb7[_0xf591('0x19')]),_0x32ad26);}});ami['on']('newstate',function(_0x2c3647){try{utils['debug'](util['format'](_0xf591('0x2a'),_0x2c3647[_0xf591('0x19')]),_0x2c3647);calls[_0xf591('0x2b')](_0x2c3647);recordings['newstate'](_0x2c3647);}catch(_0x17256c){utils[_0xf591('0x10')](util[_0xf591('0x15')](_0xf591('0x2a'),_0x2c3647[_0xf591('0x19')]),_0x17256c);}});ami['on'](_0xf591('0x2c'),function(_0x51b96e){try{utils['debug'](util['format']('[%s][index][hangup]',_0x51b96e[_0xf591('0x19')]),_0x51b96e);calls[_0xf591('0x2c')](_0x51b96e);recordings[_0xf591('0x2c')](_0x51b96e);dials[_0xf591('0x2c')](_0x51b96e);agents[_0xf591('0x2c')](_0x51b96e);queues[_0xf591('0x2c')](_0x51b96e);}catch(_0x2b35d1){utils['error'](util[_0xf591('0x15')](_0xf591('0x2d'),_0x51b96e['uniqueid']),_0x2b35d1);}});ami['on'](_0xf591('0x2e'),function(_0x141874){try{utils[_0xf591('0x14')](util[_0xf591('0x15')](_0xf591('0x2f'),_0x141874[_0xf591('0x19')]),_0x141874);members[_0xf591('0x2e')](_0x141874);}catch(_0x4d5e1e){utils['error'](util[_0xf591('0x15')](_0xf591('0x2f'),_0x141874[_0xf591('0x19')]),_0x4d5e1e);}});ami['on'](_0xf591('0x30'),function(_0x43e7cf){try{utils['debug'](util[_0xf591('0x15')]('[%s][index][blindtransfer]',_0x43e7cf[_0xf591('0x19')]),_0x43e7cf);queues[_0xf591('0x30')](_0x43e7cf);agents[_0xf591('0x30')](_0x43e7cf);transfers['blindtransfer'](_0x43e7cf);}catch(_0x42c378){utils[_0xf591('0x10')](util['format'](_0xf591('0x31'),_0x43e7cf['uniqueid']),_0x42c378);}});ami['on'](_0xf591('0x32'),function(_0xba5e29){try{utils[_0xf591('0x14')](util[_0xf591('0x15')]('[%s][index][attendedtransfer]',_0xba5e29[_0xf591('0x33')]),_0xba5e29);queues['attendedtransfer'](_0xba5e29);transfers[_0xf591('0x32')](_0xba5e29);agents[_0xf591('0x32')](_0xba5e29);calls[_0xf591('0x32')](_0xba5e29);}catch(_0x161a3d){utils[_0xf591('0x10')](util[_0xf591('0x15')](_0xf591('0x34'),_0xba5e29[_0xf591('0x33')]),_0x161a3d);}});ami['on'](_0xf591('0x35'),function(_0x560f7c){try{utils[_0xf591('0x14')](util[_0xf591('0x15')](_0xf591('0x36'),_0x560f7c['uniqueid']),_0x560f7c);queues[_0xf591('0x35')](_0x560f7c);recordings[_0xf591('0x35')](_0x560f7c);calls[_0xf591('0x35')](_0x560f7c);dials['varset'](_0x560f7c);}catch(_0x1433a0){utils[_0xf591('0x10')](util[_0xf591('0x15')](_0xf591('0x36'),_0x560f7c[_0xf591('0x19')]),_0x1433a0);}});ami['on']('newexten',function(_0x21eabd){try{utils[_0xf591('0x14')](util['format'](_0xf591('0x37'),_0x21eabd[_0xf591('0x19')]),_0x21eabd);calls[_0xf591('0x38')](_0x21eabd);recordings['newexten'](_0x21eabd);dials[_0xf591('0x38')](_0x21eabd);}catch(_0x3ceab1){utils[_0xf591('0x10')](util['format'](_0xf591('0x37'),_0x21eabd[_0xf591('0x19')]),_0x3ceab1);}});ami['on']('newchannel',function(_0x13fef6){try{utils[_0xf591('0x14')](util[_0xf591('0x15')](_0xf591('0x39'),_0x13fef6[_0xf591('0x19')]),_0x13fef6);calls[_0xf591('0x3a')](_0x13fef6);recordings[_0xf591('0x3a')](_0x13fef6);}catch(_0x4c0b5f){utils[_0xf591('0x10')](util[_0xf591('0x15')](_0xf591('0x39'),_0x13fef6['uniqueid']),_0x4c0b5f);}});ami['on'](_0xf591('0x3b'),function(_0x166141){try{utils[_0xf591('0x14')](util[_0xf591('0x15')]('[%s][index][dialbegin]',_0x166141[_0xf591('0x19')]),_0x166141);dials[_0xf591('0x3b')](_0x166141);}catch(_0x5dfe16){utils[_0xf591('0x10')](util['format'](_0xf591('0x3c'),_0x166141[_0xf591('0x19')]),_0x5dfe16);}});ami['on']('dialend',function(_0x34a013){try{utils['debug'](util['format'](_0xf591('0x3d'),_0x34a013['uniqueid']),_0x34a013);dials[_0xf591('0x3e')](_0x34a013);}catch(_0x26588e){utils[_0xf591('0x10')](util[_0xf591('0x15')](_0xf591('0x3d'),_0x34a013['uniqueid']),_0x26588e);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 05c9bc6..e381481 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 _0xd4a0=['info','state','INUSE','BUSY','TALKING','now','agent','isNil','exitAt','duration','diffTime','agentcomplete','queue','error','[%s][members][agentcomplete]','cdr','assign','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','format','uniqueid','channel','data2','membername','type','interface','then','name','internal','CreateMemberReport','split','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device'];(function(_0x26bc25,_0x1d0345){var _0x2e0666=function(_0x11c84c){while(--_0x11c84c){_0x26bc25['push'](_0x26bc25['shift']());}};_0x2e0666(++_0x1d0345);}(_0xd4a0,0x187));var _0x0d4a=function(_0x5550d1,_0x1b4b33){_0x5550d1=_0x5550d1-0x0;var _0x4539ab=_0xd4a0[_0x5550d1];return _0x4539ab;};'use strict';var _=require(_0x0d4a('0x0'));var util=require(_0x0d4a('0x1'));var utils=require(_0x0d4a('0x2'));var members={};var exclude=[_0x0d4a('0x3'),'Queue:'];function writeDB(_0x40c2f1){utils['info'](util[_0x0d4a('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x40c2f1[_0x0d4a('0x5')],_0x40c2f1['interface'],_0x40c2f1[_0x0d4a('0x6')],_0x40c2f1[_0x0d4a('0x7')],_0x40c2f1[_0x0d4a('0x8')],_0x40c2f1[_0x0d4a('0x9')]));if(_0x40c2f1[_0x0d4a('0xa')]){utils['getUserByInterface'](_0x40c2f1['interface'])[_0x0d4a('0xb')](function(_0xed04f5){if(_0xed04f5){_0x40c2f1[_0x0d4a('0x8')]=_0xed04f5[_0x0d4a('0xc')];_0x40c2f1[_0x0d4a('0xd')]=_0xed04f5[_0x0d4a('0xd')];utils['request'](_0x0d4a('0xe'),_0x40c2f1);}else{utils['getUserByName'](_0x40c2f1['interface'][_0x0d4a('0xf')]('/')[0x1])['then'](function(_0x519eb3){if(_0x519eb3){_0x40c2f1[_0x0d4a('0x8')]=_0x519eb3[_0x0d4a('0xc')];_0x40c2f1['internal']=_0x519eb3[_0x0d4a('0xd')];utils['request'](_0x0d4a('0xe'),_0x40c2f1);}});}})['catch'](function(_0x173478){utils['error'](util[_0x0d4a('0x4')](_0x0d4a('0x10'),_0x40c2f1[_0x0d4a('0x5')]),_0x173478);});}delete members[_0x40c2f1[_0x0d4a('0xa')]];}function startsWith(_0x2cbd45,_0x43cc83){return _[_0x0d4a('0x11')](_0x2cbd45,function(_0x137255){return _[_0x0d4a('0x12')](_0x43cc83,_0x137255);});}exports[_0x0d4a('0x13')]=function(_0x379041){try{utils[_0x0d4a('0x14')](util[_0x0d4a('0x4')](_0x0d4a('0x15'),members[_0x379041[_0x0d4a('0x16')]]?members[_0x379041[_0x0d4a('0x16')]][_0x0d4a('0x5')]:_0x379041[_0x0d4a('0x16')]),_0x379041);utils[_0x0d4a('0x17')](util[_0x0d4a('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x379041['device']]?members[_0x379041[_0x0d4a('0x16')]][_0x0d4a('0x5')]:_0x379041[_0x0d4a('0x16')],_0x379041['state'],_0x379041[_0x0d4a('0x16')]));switch(_0x379041[_0x0d4a('0x18')]){case _0x0d4a('0x19'):case _0x0d4a('0x1a'):if(!startsWith(exclude,_0x379041['device'])){members[_0x379041[_0x0d4a('0x16')]]={'channel':'voice','interface':_0x379041[_0x0d4a('0x16')],'type':_0x0d4a('0x1b'),'enterAt':utils[_0x0d4a('0x1c')](),'role':_0x0d4a('0x1d')};}break;case'NOT_INUSE':if(!_[_0x0d4a('0x1e')](members[_0x379041[_0x0d4a('0x16')]])){members[_0x379041['device']][_0x0d4a('0x1f')]=utils['now']();members[_0x379041[_0x0d4a('0x16')]][_0x0d4a('0x20')]=utils[_0x0d4a('0x21')](members[_0x379041[_0x0d4a('0x16')]][_0x0d4a('0x1f')],members[_0x379041[_0x0d4a('0x16')]]['enterAt']);if(members[_0x379041['device']][_0x0d4a('0x5')]){writeDB(members[_0x379041['device']]);}}break;default:break;}}catch(_0x57a70d){utils['error'](util[_0x0d4a('0x4')]('[%s][members][devicestatechange]',members[_0x379041[_0x0d4a('0x16')]]?members[_0x379041[_0x0d4a('0x16')]][_0x0d4a('0x5')]:_0x379041[_0x0d4a('0x16')]),_0x57a70d);}};exports[_0x0d4a('0x22')]=function(_0x5d73d6){try{if(!_[_0x0d4a('0x1e')](members[_0x5d73d6[_0x0d4a('0xa')]])){utils[_0x0d4a('0x14')](util[_0x0d4a('0x4')]('[%s][members][agentcomplete]',_0x5d73d6[_0x0d4a('0x5')]),_0x5d73d6);utils[_0x0d4a('0x17')](util[_0x0d4a('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x5d73d6[_0x0d4a('0x5')],_0x5d73d6[_0x0d4a('0xa')],_0x5d73d6[_0x0d4a('0x23')]));members[_0x5d73d6['interface']]=_['assign'](members[_0x5d73d6['interface']],{'data4':_0x5d73d6[_0x0d4a('0x23')],'uniqueid':_0x5d73d6['uniqueid']});}}catch(_0x5ecb38){utils[_0x0d4a('0x24')](util[_0x0d4a('0x4')](_0x0d4a('0x25'),_0x5d73d6[_0x0d4a('0x5')]),_0x5ecb38);}};exports[_0x0d4a('0x26')]=function(_0x3bec98){try{utils[_0x0d4a('0x14')](util[_0x0d4a('0x4')]('[%s][members][cdr]',_0x3bec98[_0x0d4a('0x5')]),_0x3bec98);if(_0x3bec98[_0x0d4a('0x6')]){var _0x3b2a2d=_0x3bec98['channel']['split']('-')[0x0];if(!_[_0x0d4a('0x1e')](members[_0x3b2a2d])){members[_0x3b2a2d]=_[_0x0d4a('0x27')](members[_0x3b2a2d],{'data1':members[_0x3b2a2d][_0x0d4a('0x28')]||_0x3bec98['type'],'data2':members[_0x3b2a2d][_0x0d4a('0x7')]||_0x3bec98[_0x0d4a('0x29')],'data3':members[_0x3b2a2d][_0x0d4a('0x2a')]||_0x3bec98[_0x0d4a('0x2b')],'uniqueid':members[_0x3b2a2d][_0x0d4a('0x5')]||_0x3bec98[_0x0d4a('0x5')]});utils[_0x0d4a('0x17')](util['format'](_0x0d4a('0x2c'),_0x3bec98[_0x0d4a('0x5')],members[_0x3b2a2d]['data1'],members[_0x3b2a2d]['data2'],members[_0x3b2a2d]['data3']));if(members[_0x3b2a2d][_0x0d4a('0x1f')]){writeDB(members[_0x3b2a2d]);}}}if(_0x3bec98['destinationchannel']){var _0x33096c=_0x3bec98[_0x0d4a('0x2d')][_0x0d4a('0xf')]('-')[0x0];if(!_['isNil'](members[_0x33096c])){members[_0x33096c]=_[_0x0d4a('0x27')](members[_0x33096c],{'data1':members[_0x33096c][_0x0d4a('0x28')]||_0x3bec98['type'],'data2':members[_0x33096c]['data2']||_0x3bec98[_0x0d4a('0x29')],'data3':members[_0x33096c][_0x0d4a('0x2a')]||_0x3bec98[_0x0d4a('0x2b')],'uniqueid':members[_0x33096c]['uniqueid']||_0x3bec98[_0x0d4a('0x5')]});utils[_0x0d4a('0x17')](util[_0x0d4a('0x4')](_0x0d4a('0x2c'),_0x3bec98[_0x0d4a('0x5')],members[_0x33096c][_0x0d4a('0x28')],members[_0x33096c]['data2'],members[_0x33096c][_0x0d4a('0x2a')]));if(members[_0x33096c][_0x0d4a('0x1f')]){writeDB(members[_0x33096c]);}}}}catch(_0x247544){utils[_0x0d4a('0x24')](util[_0x0d4a('0x4')]('[%s][members][cdr]',_0x3bec98[_0x0d4a('0x5')]),_0x247544);}}; \ No newline at end of file +var _0xbb53=['split','CreateMemberReport','catch','error','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','duration','exitAt','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','channel','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','data2','membername','type','interface','getUserByInterface','name','internal','request'];(function(_0x31c133,_0x3075f7){var _0x596121=function(_0xcb270e){while(--_0xcb270e){_0x31c133['push'](_0x31c133['shift']());}};_0x596121(++_0x3075f7);}(_0xbb53,0x121));var _0x3bb5=function(_0x410418,_0x6a7ee7){_0x410418=_0x410418-0x0;var _0x346771=_0xbb53[_0x410418];return _0x346771;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var utils=require(_0x3bb5('0x2'));var members={};var exclude=[_0x3bb5('0x3'),_0x3bb5('0x4')];function writeDB(_0x226d39){utils[_0x3bb5('0x5')](util[_0x3bb5('0x6')](_0x3bb5('0x7'),_0x226d39[_0x3bb5('0x8')],_0x226d39['interface'],_0x226d39['channel'],_0x226d39[_0x3bb5('0x9')],_0x226d39[_0x3bb5('0xa')],_0x226d39[_0x3bb5('0xb')]));if(_0x226d39[_0x3bb5('0xc')]){utils[_0x3bb5('0xd')](_0x226d39['interface'])['then'](function(_0x4cfdd7){if(_0x4cfdd7){_0x226d39[_0x3bb5('0xa')]=_0x4cfdd7[_0x3bb5('0xe')];_0x226d39[_0x3bb5('0xf')]=_0x4cfdd7['internal'];utils[_0x3bb5('0x10')]('CreateMemberReport',_0x226d39);}else{utils['getUserByName'](_0x226d39[_0x3bb5('0xc')][_0x3bb5('0x11')]('/')[0x1])['then'](function(_0xe00ace){if(_0xe00ace){_0x226d39['membername']=_0xe00ace[_0x3bb5('0xe')];_0x226d39['internal']=_0xe00ace['internal'];utils[_0x3bb5('0x10')](_0x3bb5('0x12'),_0x226d39);}});}})[_0x3bb5('0x13')](function(_0x512be4){utils[_0x3bb5('0x14')](util[_0x3bb5('0x6')]('[%s][members][writeDB]',_0x226d39[_0x3bb5('0x8')]),_0x512be4);});}delete members[_0x226d39[_0x3bb5('0xc')]];}function startsWith(_0x5cec77,_0x5ca99f){return _['some'](_0x5cec77,function(_0x42ef1b){return _[_0x3bb5('0x15')](_0x5ca99f,_0x42ef1b);});}exports['devicestatechange']=function(_0x25d774){try{utils[_0x3bb5('0x16')](util[_0x3bb5('0x6')](_0x3bb5('0x17'),members[_0x25d774['device']]?members[_0x25d774[_0x3bb5('0x18')]][_0x3bb5('0x8')]:_0x25d774[_0x3bb5('0x18')]),_0x25d774);utils['info'](util['format'](_0x3bb5('0x19'),members[_0x25d774[_0x3bb5('0x18')]]?members[_0x25d774[_0x3bb5('0x18')]]['uniqueid']:_0x25d774[_0x3bb5('0x18')],_0x25d774[_0x3bb5('0x1a')],_0x25d774[_0x3bb5('0x18')]));switch(_0x25d774[_0x3bb5('0x1a')]){case _0x3bb5('0x1b'):case _0x3bb5('0x1c'):if(!startsWith(exclude,_0x25d774['device'])){members[_0x25d774[_0x3bb5('0x18')]]={'channel':_0x3bb5('0x1d'),'interface':_0x25d774[_0x3bb5('0x18')],'type':_0x3bb5('0x1e'),'enterAt':utils[_0x3bb5('0x1f')](),'role':_0x3bb5('0x20')};}break;case _0x3bb5('0x21'):if(!_['isNil'](members[_0x25d774[_0x3bb5('0x18')]])){members[_0x25d774[_0x3bb5('0x18')]]['exitAt']=utils['now']();members[_0x25d774[_0x3bb5('0x18')]][_0x3bb5('0x22')]=utils['diffTime'](members[_0x25d774['device']][_0x3bb5('0x23')],members[_0x25d774[_0x3bb5('0x18')]][_0x3bb5('0x24')]);if(members[_0x25d774[_0x3bb5('0x18')]]['uniqueid']){writeDB(members[_0x25d774['device']]);}}break;default:break;}}catch(_0x33e943){utils['error'](util[_0x3bb5('0x6')](_0x3bb5('0x17'),members[_0x25d774[_0x3bb5('0x18')]]?members[_0x25d774['device']]['uniqueid']:_0x25d774[_0x3bb5('0x18')]),_0x33e943);}};exports[_0x3bb5('0x25')]=function(_0x17ada7){try{if(!_[_0x3bb5('0x26')](members[_0x17ada7[_0x3bb5('0xc')]])){utils[_0x3bb5('0x16')](util[_0x3bb5('0x6')]('[%s][members][agentcomplete]',_0x17ada7[_0x3bb5('0x8')]),_0x17ada7);utils[_0x3bb5('0x5')](util[_0x3bb5('0x6')](_0x3bb5('0x27'),_0x17ada7[_0x3bb5('0x8')],_0x17ada7[_0x3bb5('0xc')],_0x17ada7[_0x3bb5('0x28')]));members[_0x17ada7['interface']]=_[_0x3bb5('0x29')](members[_0x17ada7[_0x3bb5('0xc')]],{'data4':_0x17ada7['queue'],'uniqueid':_0x17ada7[_0x3bb5('0x8')]});}}catch(_0x1fa29d){utils[_0x3bb5('0x14')](util[_0x3bb5('0x6')](_0x3bb5('0x2a'),_0x17ada7['uniqueid']),_0x1fa29d);}};exports[_0x3bb5('0x2b')]=function(_0x1df4c6){try{utils[_0x3bb5('0x16')](util[_0x3bb5('0x6')]('[%s][members][cdr]',_0x1df4c6['uniqueid']),_0x1df4c6);if(_0x1df4c6[_0x3bb5('0x2c')]){var _0xeeb452=_0x1df4c6[_0x3bb5('0x2c')][_0x3bb5('0x11')]('-')[0x0];if(!_[_0x3bb5('0x26')](members[_0xeeb452])){members[_0xeeb452]=_[_0x3bb5('0x29')](members[_0xeeb452],{'data1':members[_0xeeb452][_0x3bb5('0x2d')]||_0x1df4c6[_0x3bb5('0xb')],'data2':members[_0xeeb452][_0x3bb5('0x9')]||_0x1df4c6['source'],'data3':members[_0xeeb452][_0x3bb5('0x2e')]||_0x1df4c6[_0x3bb5('0x2f')],'uniqueid':members[_0xeeb452]['uniqueid']||_0x1df4c6['uniqueid']});utils[_0x3bb5('0x5')](util[_0x3bb5('0x6')](_0x3bb5('0x30'),_0x1df4c6[_0x3bb5('0x8')],members[_0xeeb452]['data1'],members[_0xeeb452]['data2'],members[_0xeeb452][_0x3bb5('0x2e')]));if(members[_0xeeb452]['exitAt']){writeDB(members[_0xeeb452]);}}}if(_0x1df4c6[_0x3bb5('0x31')]){var _0x5772e4=_0x1df4c6['destinationchannel'][_0x3bb5('0x11')]('-')[0x0];if(!_['isNil'](members[_0x5772e4])){members[_0x5772e4]=_['assign'](members[_0x5772e4],{'data1':members[_0x5772e4][_0x3bb5('0x2d')]||_0x1df4c6[_0x3bb5('0xb')],'data2':members[_0x5772e4][_0x3bb5('0x9')]||_0x1df4c6['source'],'data3':members[_0x5772e4][_0x3bb5('0x2e')]||_0x1df4c6['destination'],'uniqueid':members[_0x5772e4][_0x3bb5('0x8')]||_0x1df4c6['uniqueid']});utils[_0x3bb5('0x5')](util[_0x3bb5('0x6')](_0x3bb5('0x30'),_0x1df4c6[_0x3bb5('0x8')],members[_0x5772e4][_0x3bb5('0x2d')],members[_0x5772e4][_0x3bb5('0x9')],members[_0x5772e4]['data3']));if(members[_0x5772e4][_0x3bb5('0x23')]){writeDB(members[_0x5772e4]);}}}}catch(_0x7c1b7b){utils['error'](util[_0x3bb5('0x6')](_0x3bb5('0x32'),_0x1df4c6[_0x3bb5('0x8')]),_0x7c1b7b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index a3719a6..df88015 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 _0x5e55=['holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','queuecallerenterreason','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertype','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./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','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','error','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename'];(function(_0x57dc14,_0x1e3526){var _0x53f6e9=function(_0x12f0b8){while(--_0x12f0b8){_0x57dc14['push'](_0x57dc14['shift']());}};_0x53f6e9(++_0x1e3526);}(_0x5e55,0x105));var _0x55e5=function(_0x39b4fc,_0x532cdd){_0x39b4fc=_0x39b4fc-0x0;var _0x4e57c1=_0x5e55[_0x39b4fc];return _0x4e57c1;};'use strict';var _=require(_0x55e5('0x0'));var util=require('util');var utils=require(_0x55e5('0x1'));var queues={};function writeDB(_0x57b3e9){utils['info'](util[_0x55e5('0x2')](_0x55e5('0x3'),_0x57b3e9[_0x55e5('0x4')],_0x57b3e9[_0x55e5('0x5')],_0x57b3e9[_0x55e5('0x6')],_0x57b3e9[_0x55e5('0x7')],_0x57b3e9[_0x55e5('0x8')],_0x57b3e9[_0x55e5('0x9')],_0x57b3e9[_0x55e5('0xa')]));if(_0x57b3e9[_0x55e5('0x6')]){utils[_0x55e5('0xb')](_0x57b3e9[_0x55e5('0x6')])[_0x55e5('0xc')](function(_0x404742){if(_0x404742){_0x57b3e9[_0x55e5('0xd')]=_0x404742[_0x55e5('0xd')];}utils[_0x55e5('0xe')](_0x55e5('0xf'),_0x57b3e9);});}else{utils[_0x55e5('0xe')](_0x55e5('0xf'),_0x57b3e9);}if(_0x57b3e9[_0x55e5('0x10')]){delete queues[_0x57b3e9[_0x55e5('0x10')]];}else{delete queues[_0x57b3e9['uniqueid']];}}exports['queuecallerjoin']=function(_0x12ba86){try{utils[_0x55e5('0x11')](util['format'](_0x55e5('0x12'),_0x12ba86['uniqueid']),_0x12ba86);utils[_0x55e5('0x13')](util[_0x55e5('0x2')](_0x55e5('0x14'),_0x12ba86[_0x55e5('0x4')],_0x12ba86[_0x55e5('0x6')],_0x12ba86[_0x55e5('0x15')]));queues[_0x12ba86[_0x55e5('0x4')]]=_[_0x55e5('0x16')](_0x12ba86,{'originalposition':_0x12ba86[_0x55e5('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5bbf27){utils['error'](util[_0x55e5('0x2')](_0x55e5('0x12'),_0x12ba86[_0x55e5('0x4')]),_0x5bbf27);}};exports[_0x55e5('0x17')]=function(_0x217fe7){try{if(!_[_0x55e5('0x18')](queues[_0x217fe7[_0x55e5('0x4')]])){utils[_0x55e5('0x11')](util[_0x55e5('0x2')](_0x55e5('0x19'),_0x217fe7[_0x55e5('0x4')]),_0x217fe7);if(queues[_0x217fe7[_0x55e5('0x4')]][_0x55e5('0x1a')]){if(!queues[_0x217fe7['uniqueid']]['queuecallerabandon']&&!queues[_0x217fe7[_0x55e5('0x4')]][_0x55e5('0x1b')]){queues[_0x217fe7[_0x55e5('0x4')]][_0x55e5('0x1c')]=!![];queues[_0x217fe7[_0x55e5('0x4')]][_0x55e5('0x1d')]=utils['now']();queues[_0x217fe7[_0x55e5('0x4')]][_0x55e5('0xa')]='COMPLETEDBYAGENT';}utils['info'](util[_0x55e5('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x217fe7['uniqueid'],queues[_0x217fe7[_0x55e5('0x4')]]['name'],queues[_0x217fe7[_0x55e5('0x4')]][_0x55e5('0xa')]));writeDB(queues[_0x217fe7[_0x55e5('0x4')]]);}else if(queues[_0x217fe7[_0x55e5('0x4')]][_0x55e5('0x10')]){utils['info'](util['format'](_0x55e5('0x1e'),_0x217fe7[_0x55e5('0x4')],queues[_0x217fe7[_0x55e5('0x4')]][_0x55e5('0x1f')],queues[_0x217fe7[_0x55e5('0x4')]][_0x55e5('0x10')]));queues[queues[_0x217fe7[_0x55e5('0x4')]][_0x55e5('0x10')]]=queues[_0x217fe7[_0x55e5('0x4')]];queues[queues[_0x217fe7['uniqueid']][_0x55e5('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x217fe7['uniqueid']];}}}catch(_0x27dacb){utils[_0x55e5('0x20')](util[_0x55e5('0x2')](_0x55e5('0x19'),_0x217fe7[_0x55e5('0x4')]),_0x27dacb);}};exports[_0x55e5('0x21')]=function(_0x3a8c52){try{utils[_0x55e5('0x11')](util[_0x55e5('0x2')](_0x55e5('0x22'),_0x3a8c52['uniqueid']),_0x3a8c52);if(!_[_0x55e5('0x18')](_0x3a8c52[_0x55e5('0x23')][_0x55e5('0x24')])&&_0x3a8c52[_0x55e5('0x25')][_0x55e5('0x26')]()!==_0x55e5('0x27')){if(!_['isNil'](queues[_0x3a8c52[_0x55e5('0x4')]])){queues[_0x3a8c52[_0x55e5('0x4')]][_0x55e5('0x28')]=![];queues[_0x3a8c52[_0x55e5('0x4')]][_0x55e5('0x29')]=null;queues[_0x3a8c52[_0x55e5('0x4')]][_0x55e5('0x1b')]=!![];queues[_0x3a8c52['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x3a8c52[_0x55e5('0x4')]][_0x55e5('0xa')]=_0x3a8c52[_0x55e5('0x25')][_0x55e5('0x26')]();utils[_0x55e5('0x13')](util[_0x55e5('0x2')](_0x55e5('0x2a'),_0x3a8c52[_0x55e5('0x4')],queues[_0x3a8c52[_0x55e5('0x4')]][_0x55e5('0x1f')],_0x3a8c52['value'],queues[_0x3a8c52[_0x55e5('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x3a8c52[_0x55e5('0x4')]]);}}else if(!_[_0x55e5('0x18')](_0x3a8c52[_0x55e5('0x23')][_0x55e5('0x2b')])){if(!_[_0x55e5('0x18')](queues[_0x3a8c52[_0x55e5('0x4')]])&&!queues[_0x3a8c52[_0x55e5('0x4')]][_0x55e5('0x28')]){queues[_0x3a8c52[_0x55e5('0x4')]][_0x55e5('0x28')]=![];queues[_0x3a8c52['uniqueid']][_0x55e5('0x29')]=null;queues[_0x3a8c52[_0x55e5('0x4')]][_0x55e5('0x1b')]=!![];queues[_0x3a8c52['uniqueid']][_0x55e5('0x2c')]=utils[_0x55e5('0x2d')]();queues[_0x3a8c52[_0x55e5('0x4')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x55e5('0x13')](util['format'](_0x55e5('0x2e'),_0x3a8c52[_0x55e5('0x4')],queues[_0x3a8c52[_0x55e5('0x4')]][_0x55e5('0x1f')],_0x3a8c52[_0x55e5('0x25')],queues[_0x3a8c52[_0x55e5('0x4')]][_0x55e5('0xa')]));}}}catch(_0xedc1dc){utils['error'](util['format'](_0x55e5('0x22'),_0x3a8c52['uniqueid']),_0xedc1dc);}};exports[_0x55e5('0x28')]=function(_0x343c22){try{if(!_[_0x55e5('0x18')](queues[_0x343c22['uniqueid']])){utils[_0x55e5('0x11')](util['format'](_0x55e5('0x2f'),_0x343c22[_0x55e5('0x4')]),_0x343c22);queues[_0x343c22[_0x55e5('0x4')]][_0x55e5('0x1b')]=![];queues[_0x343c22['uniqueid']]['queuecallerexitAt']=null;queues[_0x343c22[_0x55e5('0x4')]][_0x55e5('0x28')]=!![];queues[_0x343c22[_0x55e5('0x4')]]['queuecallerabandonAt']=utils[_0x55e5('0x2d')]();queues[_0x343c22[_0x55e5('0x4')]]['queuecallerexitreason']=_0x55e5('0x30');utils[_0x55e5('0x13')](util['format'](_0x55e5('0x31'),_0x343c22[_0x55e5('0x4')],queues[_0x343c22[_0x55e5('0x4')]][_0x55e5('0x1f')],queues[_0x343c22[_0x55e5('0x4')]]['queuecallerexitreason']));}}catch(_0x238dbe){utils[_0x55e5('0x20')](util[_0x55e5('0x2')]('[%s][queues][queuecallerabandon]',_0x343c22[_0x55e5('0x4')]),_0x238dbe);}};exports[_0x55e5('0x32')]=function(_0x49b25e){try{if(!_['isNil'](queues[_0x49b25e[_0x55e5('0x4')]])){utils[_0x55e5('0x11')](util[_0x55e5('0x2')](_0x55e5('0x33'),_0x49b25e[_0x55e5('0x4')]),_0x49b25e);utils[_0x55e5('0x13')](util[_0x55e5('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x49b25e[_0x55e5('0x4')],queues[_0x49b25e[_0x55e5('0x4')]][_0x55e5('0x1f')],_0x49b25e[_0x55e5('0x34')],_0x49b25e[_0x55e5('0x35')]));queues[_0x49b25e['uniqueid']][_0x55e5('0x32')]=!![];queues[_0x49b25e[_0x55e5('0x4')]][_0x55e5('0x1a')]=utils[_0x55e5('0x2d')]();queues[_0x49b25e[_0x55e5('0x4')]][_0x55e5('0x36')]=utils[_0x55e5('0x37')](queues[_0x49b25e[_0x55e5('0x4')]][_0x55e5('0x1a')],queues[_0x49b25e[_0x55e5('0x4')]]['queuecallerjoinAt']);queues[_0x49b25e[_0x55e5('0x4')]][_0x55e5('0x15')]=_0x49b25e[_0x55e5('0x15')];queues[_0x49b25e['uniqueid']]['count']=_0x49b25e[_0x55e5('0x38')];queues[_0x49b25e[_0x55e5('0x4')]][_0x55e5('0x34')]=_0x49b25e[_0x55e5('0x34')];queues[_0x49b25e['uniqueid']][_0x55e5('0x35')]=_0x49b25e[_0x55e5('0x35')];}}catch(_0xc9152b){utils[_0x55e5('0x20')](util['format'](_0x55e5('0x33'),_0x49b25e['uniqueid']),_0xc9152b);}};exports[_0x55e5('0x39')]=function(_0x357a78){try{if(!_[_0x55e5('0x18')](queues[_0x357a78[_0x55e5('0x4')]])){utils['debug'](util[_0x55e5('0x2')](_0x55e5('0x3a'),_0x357a78[_0x55e5('0x4')]),_0x357a78);utils[_0x55e5('0x13')](util[_0x55e5('0x2')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x357a78[_0x55e5('0x4')],queues[_0x357a78[_0x55e5('0x4')]]['name'],_0x357a78[_0x55e5('0x3b')],_0x357a78[_0x55e5('0x3c')]));queues[_0x357a78[_0x55e5('0x4')]]['queuecallerabandon']=![];queues[_0x357a78[_0x55e5('0x4')]][_0x55e5('0x28')]=![];queues[_0x357a78[_0x55e5('0x4')]]['queuecallerabandonAt']=null;queues[_0x357a78[_0x55e5('0x4')]]['queuecallerexit']=![];queues[_0x357a78[_0x55e5('0x4')]][_0x55e5('0xa')]=null;queues[_0x357a78[_0x55e5('0x4')]][_0x55e5('0x2c')]=null;queues[_0x357a78[_0x55e5('0x4')]][_0x55e5('0x3d')]=!![];queues[_0x357a78[_0x55e5('0x4')]][_0x55e5('0x9')]=_0x357a78['destaccountcode'];queues[_0x357a78[_0x55e5('0x4')]][_0x55e5('0x7')]=_0x357a78[_0x55e5('0x3b')];}}catch(_0x1122b3){utils[_0x55e5('0x20')](util[_0x55e5('0x2')](_0x55e5('0x3a'),_0x357a78[_0x55e5('0x4')]),_0x1122b3);}};exports[_0x55e5('0x3e')]=function(_0x3cae1c){try{if(!_[_0x55e5('0x18')](queues[_0x3cae1c['uniqueid']])){if(queues[_0x3cae1c[_0x55e5('0x4')]]['queuecallerleaveAt']){utils[_0x55e5('0x11')](util[_0x55e5('0x2')](_0x55e5('0x3f'),_0x3cae1c['uniqueid']),_0x3cae1c);queues[_0x3cae1c[_0x55e5('0x4')]][_0x55e5('0x28')]=![];queues[_0x3cae1c[_0x55e5('0x4')]]['queuecallerabandon']=![];queues[_0x3cae1c['uniqueid']][_0x55e5('0x29')]=null;queues[_0x3cae1c[_0x55e5('0x4')]]['queuecallerexit']=![];queues[_0x3cae1c[_0x55e5('0x4')]][_0x55e5('0x2c')]=null;queues[_0x3cae1c[_0x55e5('0x4')]][_0x55e5('0x3d')]=!![];queues[_0x3cae1c[_0x55e5('0x4')]]['lastAssignedTo']=_0x3cae1c['membername'];queues[_0x3cae1c[_0x55e5('0x4')]][_0x55e5('0x1c')]=!![];queues[_0x3cae1c[_0x55e5('0x4')]][_0x55e5('0x1d')]=utils[_0x55e5('0x2d')]();if(_0x3cae1c[_0x55e5('0x40')]=='transfer'){if(!queues[_0x3cae1c[_0x55e5('0x4')]][_0x55e5('0x41')]){queues[_0x3cae1c[_0x55e5('0x4')]]['queuecallerexitreason']=_0x55e5('0x42');}}else{queues[_0x3cae1c['uniqueid']][_0x55e5('0xa')]=_0x55e5('0x43')+_0x3cae1c[_0x55e5('0x40')][_0x55e5('0x26')]();}utils[_0x55e5('0x13')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x3cae1c[_0x55e5('0x4')],queues[_0x3cae1c[_0x55e5('0x4')]]['name'],_0x3cae1c[_0x55e5('0x3b')],queues[_0x3cae1c[_0x55e5('0x4')]][_0x55e5('0xa')]));writeDB(queues[_0x3cae1c[_0x55e5('0x4')]]);}}}catch(_0x3f246d){utils[_0x55e5('0x20')](util[_0x55e5('0x2')](_0x55e5('0x3f'),_0x3cae1c['uniqueid']),_0x3f246d);}};exports[_0x55e5('0x44')]=function(_0x559bad){try{if(!_['isNil'](queues[_0x559bad[_0x55e5('0x45')]])){utils[_0x55e5('0x11')](util[_0x55e5('0x2')](_0x55e5('0x46'),_0x559bad[_0x55e5('0x4')]),_0x559bad);queues[_0x559bad[_0x55e5('0x45')]][_0x55e5('0x41')]=!![];queues[_0x559bad[_0x55e5('0x45')]]['transfertype']='BLIND';queues[_0x559bad[_0x55e5('0x45')]][_0x55e5('0x47')]=_0x559bad[_0x55e5('0x48')];queues[_0x559bad[_0x55e5('0x45')]]['transferuniqueid']=_0x559bad[_0x55e5('0x45')];queues[_0x559bad['transfereeuniqueid']][_0x55e5('0xa')]=_0x55e5('0x49');utils[_0x55e5('0x13')](util[_0x55e5('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x559bad['uniqueid'],queues[_0x559bad['transfereeuniqueid']]['name'],_0x559bad[_0x55e5('0x45')],_0x559bad['extension']));}}catch(_0x437d26){utils[_0x55e5('0x20')](util[_0x55e5('0x2')](_0x55e5('0x46'),_0x559bad[_0x55e5('0x4')]),_0x437d26);}};exports[_0x55e5('0x4a')]=function(_0x2ff395){try{utils[_0x55e5('0x11')](util['format'](_0x55e5('0x4b'),_0x2ff395[_0x55e5('0x4c')]),_0x2ff395);if(_0x2ff395['origtransfereruniqueid']==_0x2ff395[_0x55e5('0x4d')]){if(!_['isNil'](queues[_0x2ff395[_0x55e5('0x4e')]])){utils['info'](util[_0x55e5('0x2')](_0x55e5('0x4f'),_0x2ff395['origtransfereruniqueid'],queues[_0x2ff395[_0x55e5('0x4e')]]['name'],_0x2ff395[_0x55e5('0x50')]));queues[_0x2ff395[_0x55e5('0x4e')]][_0x55e5('0x41')]=!![];queues[_0x2ff395[_0x55e5('0x4e')]]['transfertype']=_0x55e5('0x51');queues[_0x2ff395[_0x55e5('0x4e')]][_0x55e5('0x47')]=_0x2ff395[_0x55e5('0x50')];queues[_0x2ff395[_0x55e5('0x4e')]][_0x55e5('0x52')]=_0x2ff395[_0x55e5('0x4c')];queues[_0x2ff395['secondtransfererlinkedid']]['queuecallerexitreason']=_0x55e5('0x53');}if(!_[_0x55e5('0x18')](queues[_0x2ff395[_0x55e5('0x4d')]])){if(_0x2ff395[_0x55e5('0x54')]&&queues[_0x2ff395[_0x55e5('0x54')]]){queues[_0x2ff395[_0x55e5('0x54')]]['queuecallerenterreason']=0x1;queues[_0x2ff395[_0x55e5('0x45')]]=_['clone'](queues[_0x2ff395['transfereelinkedid']]);queues[_0x2ff395[_0x55e5('0x45')]][_0x55e5('0x10')]=_0x2ff395[_0x55e5('0x55')];queues[_0x2ff395['transfereeuniqueid']][_0x55e5('0x56')]=0x2;queues[_0x2ff395[_0x55e5('0x45')]]['calleridnum']=queues[_0x2ff395['secondtransfererlinkedid']][_0x55e5('0x8')];queues[_0x2ff395[_0x55e5('0x45')]]['calleridname']=queues[_0x2ff395[_0x55e5('0x4e')]][_0x55e5('0x57')];queues[_0x2ff395[_0x55e5('0x45')]][_0x55e5('0x58')]=utils[_0x55e5('0x2d')]();queues[_0x2ff395[_0x55e5('0x45')]]['queuecallerleaveAt']=utils[_0x55e5('0x2d')]();queues[_0x2ff395[_0x55e5('0x45')]]['holdtime']=0x0;queues[_0x2ff395[_0x55e5('0x45')]][_0x55e5('0x59')]=0x0;utils['info'](util[_0x55e5('0x2')](_0x55e5('0x5a'),_0x2ff395[_0x55e5('0x4c')],queues[_0x2ff395[_0x55e5('0x45')]][_0x55e5('0x1f')],queues[_0x2ff395['transfereeuniqueid']][_0x55e5('0x8')],queues[_0x2ff395[_0x55e5('0x45')]][_0x55e5('0x57')]));}else{utils[_0x55e5('0x13')](util[_0x55e5('0x2')](_0x55e5('0x5b'),_0x2ff395[_0x55e5('0x4c')],queues[_0x2ff395['origtransfererlinkedid']]['name'],_0x2ff395[_0x55e5('0x4e')]));queues[_0x2ff395[_0x55e5('0x4d')]]['transfereduniqueid']=_0x2ff395[_0x55e5('0x4e')];}}}else if(_0x2ff395[_0x55e5('0x5c')]==_0x2ff395['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x2ff395[_0x55e5('0x4d')]])){utils['info'](util['format'](_0x55e5('0x5d'),_0x2ff395[_0x55e5('0x4c')],queues[_0x2ff395[_0x55e5('0x4d')]][_0x55e5('0x1f')],_0x2ff395['secondtransfereruniqueid'],_0x2ff395[_0x55e5('0x5e')]));queues[_0x2ff395[_0x55e5('0x4d')]][_0x55e5('0x41')]=!![];queues[_0x2ff395['origtransfererlinkedid']][_0x55e5('0x5f')]=_0x55e5('0x51');queues[_0x2ff395[_0x55e5('0x4d')]][_0x55e5('0x47')]=_0x2ff395[_0x55e5('0x5e')];queues[_0x2ff395[_0x55e5('0x4d')]][_0x55e5('0x52')]=_0x2ff395[_0x55e5('0x5c')];queues[_0x2ff395[_0x55e5('0x4d')]][_0x55e5('0xa')]=_0x55e5('0x53');}if(!_[_0x55e5('0x18')](queues[_0x2ff395[_0x55e5('0x4e')]])){if(_0x2ff395[_0x55e5('0x60')]&&queues[_0x2ff395[_0x55e5('0x60')]]){queues[_0x2ff395['transfertargetlinkedid']][_0x55e5('0x56')]=0x1;queues[_0x2ff395[_0x55e5('0x55')]]=_[_0x55e5('0x61')](queues[_0x2ff395[_0x55e5('0x60')]]);queues[_0x2ff395[_0x55e5('0x55')]]['transfereduniqueid']=_0x2ff395[_0x55e5('0x55')];queues[_0x2ff395[_0x55e5('0x55')]][_0x55e5('0x56')]=0x2;queues[_0x2ff395['transfertargetuniqueid']]['calleridnum']=queues[_0x2ff395[_0x55e5('0x4d')]][_0x55e5('0x8')];queues[_0x2ff395['transfertargetuniqueid']]['calleridname']=queues[_0x2ff395[_0x55e5('0x4d')]][_0x55e5('0x57')];queues[_0x2ff395[_0x55e5('0x55')]][_0x55e5('0x58')]=utils[_0x55e5('0x2d')]();queues[_0x2ff395['transfertargetuniqueid']][_0x55e5('0x1a')]=utils[_0x55e5('0x2d')]();queues[_0x2ff395[_0x55e5('0x55')]][_0x55e5('0x36')]=0x0;queues[_0x2ff395[_0x55e5('0x55')]][_0x55e5('0x59')]=0x0;utils['info'](util['format'](_0x55e5('0x62'),_0x2ff395[_0x55e5('0x4c')],queues[_0x2ff395[_0x55e5('0x55')]][_0x55e5('0x1f')],queues[_0x2ff395[_0x55e5('0x55')]][_0x55e5('0x10')],queues[_0x2ff395[_0x55e5('0x55')]]['calleridnum'],queues[_0x2ff395[_0x55e5('0x55')]][_0x55e5('0x57')]));}else{utils[_0x55e5('0x13')](util[_0x55e5('0x2')](_0x55e5('0x5b'),_0x2ff395[_0x55e5('0x4c')],queues[_0x2ff395[_0x55e5('0x4e')]][_0x55e5('0x1f')],_0x2ff395['origtransfererlinkedid']));queues[_0x2ff395[_0x55e5('0x4e')]][_0x55e5('0x10')]=_0x2ff395[_0x55e5('0x4d')];}}}}catch(_0x354d95){utils[_0x55e5('0x20')](util[_0x55e5('0x2')](_0x55e5('0x4b'),_0x2ff395[_0x55e5('0x4c')]),_0x354d95);}};exports['musiconholdstart']=function(_0x2d4d58){try{if(!_[_0x55e5('0x18')](queues[_0x2d4d58[_0x55e5('0x4')]])){utils[_0x55e5('0x11')](util[_0x55e5('0x2')]('[%s][queues][musiconholdstart]',_0x2d4d58[_0x55e5('0x4')]),_0x2d4d58);queues[_0x2d4d58['uniqueid']][_0x55e5('0x63')]=utils[_0x55e5('0x2d')]();utils[_0x55e5('0x13')](util['format'](_0x55e5('0x64'),_0x2d4d58[_0x55e5('0x4')],queues[_0x2d4d58[_0x55e5('0x4')]][_0x55e5('0x1f')],queues[_0x2d4d58[_0x55e5('0x4')]][_0x55e5('0x63')]));}}catch(_0x352d3b){utils[_0x55e5('0x20')](util[_0x55e5('0x2')](_0x55e5('0x65'),_0x2d4d58[_0x55e5('0x4')]),_0x352d3b);}};exports[_0x55e5('0x66')]=function(_0x224ffc){try{if(!_[_0x55e5('0x18')](queues[_0x224ffc[_0x55e5('0x4')]])){if(!_[_0x55e5('0x18')](queues[_0x224ffc[_0x55e5('0x4')]][_0x55e5('0x63')])){utils[_0x55e5('0x11')](util[_0x55e5('0x2')](_0x55e5('0x67'),_0x224ffc['uniqueid']),_0x224ffc);queues[_0x224ffc['uniqueid']][_0x55e5('0x59')]+=utils[_0x55e5('0x37')](utils['now'](),queues[_0x224ffc[_0x55e5('0x4')]]['musiconholdstartAt']);utils['info'](util['format'](_0x55e5('0x68'),_0x224ffc[_0x55e5('0x4')],queues[_0x224ffc[_0x55e5('0x4')]][_0x55e5('0x1f')],queues[_0x224ffc[_0x55e5('0x4')]]['mohtime']));delete queues[_0x224ffc[_0x55e5('0x4')]][_0x55e5('0x63')];}}}catch(_0xe49a03){utils[_0x55e5('0x20')](util[_0x55e5('0x2')](_0x55e5('0x67'),_0x224ffc[_0x55e5('0x4')]),_0xe49a03);}}; \ No newline at end of file +var _0x19d6=['[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','info','uniqueid','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','isNil','queuecallerabandon','queuecallercompleteAt','now','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','debug','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','queueposition','queuecallerexit','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandonAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart'];(function(_0xdaa1c1,_0x9909b4){var _0x3754fc=function(_0x5c0e35){while(--_0x5c0e35){_0xdaa1c1['push'](_0xdaa1c1['shift']());}};_0x3754fc(++_0x9909b4);}(_0x19d6,0x69));var _0x619d=function(_0x31885b,_0x1b4ece){_0x31885b=_0x31885b-0x0;var _0x31a92b=_0x19d6[_0x31885b];return _0x31a92b;};'use strict';var _=require(_0x619d('0x0'));var util=require('util');var utils=require(_0x619d('0x1'));var queues={};function writeDB(_0x4fba02){utils[_0x619d('0x2')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x4fba02[_0x619d('0x3')],_0x4fba02['channel'],_0x4fba02[_0x619d('0x4')],_0x4fba02[_0x619d('0x5')],_0x4fba02['calleridnum'],_0x4fba02[_0x619d('0x6')],_0x4fba02[_0x619d('0x7')]));if(_0x4fba02[_0x619d('0x4')]){utils[_0x619d('0x8')](_0x4fba02['queue'])[_0x619d('0x9')](function(_0x5e2a0a){if(_0x5e2a0a){_0x4fba02[_0x619d('0xa')]=_0x5e2a0a[_0x619d('0xa')];}utils[_0x619d('0xb')](_0x619d('0xc'),_0x4fba02);});}else{utils['request'](_0x619d('0xc'),_0x4fba02);}if(_0x4fba02['transfereduniqueid']){delete queues[_0x4fba02[_0x619d('0xd')]];}else{delete queues[_0x4fba02[_0x619d('0x3')]];}}exports[_0x619d('0xe')]=function(_0x39b8e0){try{utils['debug'](util[_0x619d('0xf')](_0x619d('0x10'),_0x39b8e0[_0x619d('0x3')]),_0x39b8e0);utils['info'](util[_0x619d('0xf')](_0x619d('0x11'),_0x39b8e0[_0x619d('0x3')],_0x39b8e0[_0x619d('0x4')],_0x39b8e0[_0x619d('0x12')]));queues[_0x39b8e0[_0x619d('0x3')]]=_[_0x619d('0x13')](_0x39b8e0,{'originalposition':_0x39b8e0[_0x619d('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x274a5b){utils['error'](util[_0x619d('0xf')](_0x619d('0x10'),_0x39b8e0['uniqueid']),_0x274a5b);}};exports['hangup']=function(_0x49fe9a){try{if(!_[_0x619d('0x14')](queues[_0x49fe9a[_0x619d('0x3')]])){utils['debug'](util[_0x619d('0xf')]('[%s][queues][hangup]',_0x49fe9a[_0x619d('0x3')]),_0x49fe9a);if(queues[_0x49fe9a[_0x619d('0x3')]]['queuecallerleaveAt']){if(!queues[_0x49fe9a[_0x619d('0x3')]][_0x619d('0x15')]&&!queues[_0x49fe9a['uniqueid']]['queuecallerexit']){queues[_0x49fe9a['uniqueid']]['queuecallercomplete']=!![];queues[_0x49fe9a['uniqueid']][_0x619d('0x16')]=utils[_0x619d('0x17')]();queues[_0x49fe9a[_0x619d('0x3')]][_0x619d('0x7')]=_0x619d('0x18');}utils[_0x619d('0x2')](util[_0x619d('0xf')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x49fe9a[_0x619d('0x3')],queues[_0x49fe9a['uniqueid']][_0x619d('0x19')],queues[_0x49fe9a[_0x619d('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x49fe9a['uniqueid']]);}else if(queues[_0x49fe9a[_0x619d('0x3')]][_0x619d('0xd')]){utils[_0x619d('0x2')](util[_0x619d('0xf')](_0x619d('0x1a'),_0x49fe9a[_0x619d('0x3')],queues[_0x49fe9a[_0x619d('0x3')]][_0x619d('0x19')],queues[_0x49fe9a[_0x619d('0x3')]][_0x619d('0xd')]));queues[queues[_0x49fe9a['uniqueid']][_0x619d('0xd')]]=queues[_0x49fe9a[_0x619d('0x3')]];queues[queues[_0x49fe9a[_0x619d('0x3')]][_0x619d('0xd')]][_0x619d('0x1b')]=0x2;delete queues[_0x49fe9a['uniqueid']];}}}catch(_0x47d49a){utils[_0x619d('0x1c')](util[_0x619d('0xf')]('[%s][queues][hangup]',_0x49fe9a['uniqueid']),_0x47d49a);}};exports[_0x619d('0x1d')]=function(_0x2af77e){try{utils[_0x619d('0x1e')](util['format'](_0x619d('0x1f'),_0x2af77e[_0x619d('0x3')]),_0x2af77e);if(!_['isNil'](_0x2af77e[_0x619d('0x20')][_0x619d('0x21')])&&_0x2af77e[_0x619d('0x22')][_0x619d('0x23')]()!==_0x619d('0x24')){if(!_[_0x619d('0x14')](queues[_0x2af77e['uniqueid']])){queues[_0x2af77e[_0x619d('0x3')]][_0x619d('0x15')]=![];queues[_0x2af77e[_0x619d('0x3')]]['queuecallerabandonAt']=null;queues[_0x2af77e['uniqueid']]['queuecallerexit']=!![];queues[_0x2af77e[_0x619d('0x3')]][_0x619d('0x25')]=utils['now']();queues[_0x2af77e[_0x619d('0x3')]][_0x619d('0x7')]=_0x2af77e[_0x619d('0x22')][_0x619d('0x23')]();utils['info'](util[_0x619d('0xf')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x2af77e['uniqueid'],queues[_0x2af77e['uniqueid']][_0x619d('0x19')],_0x2af77e[_0x619d('0x22')],queues[_0x2af77e[_0x619d('0x3')]][_0x619d('0x7')]));writeDB(queues[_0x2af77e[_0x619d('0x3')]]);}}else if(!_[_0x619d('0x14')](_0x2af77e[_0x619d('0x20')][_0x619d('0x26')])){if(!_[_0x619d('0x14')](queues[_0x2af77e[_0x619d('0x3')]])&&!queues[_0x2af77e[_0x619d('0x3')]][_0x619d('0x15')]){queues[_0x2af77e[_0x619d('0x3')]]['queuecallerabandon']=![];queues[_0x2af77e['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2af77e['uniqueid']][_0x619d('0x27')]=!![];queues[_0x2af77e['uniqueid']][_0x619d('0x25')]=utils[_0x619d('0x17')]();queues[_0x2af77e[_0x619d('0x3')]][_0x619d('0x7')]=_0x619d('0x28');utils[_0x619d('0x2')](util['format'](_0x619d('0x29'),_0x2af77e[_0x619d('0x3')],queues[_0x2af77e[_0x619d('0x3')]][_0x619d('0x19')],_0x2af77e[_0x619d('0x22')],queues[_0x2af77e[_0x619d('0x3')]][_0x619d('0x7')]));}}}catch(_0x3d840e){utils[_0x619d('0x1c')](util['format']('[%s][queues][varset]',_0x2af77e[_0x619d('0x3')]),_0x3d840e);}};exports[_0x619d('0x15')]=function(_0xeafe7d){try{if(!_[_0x619d('0x14')](queues[_0xeafe7d['uniqueid']])){utils[_0x619d('0x1e')](util[_0x619d('0xf')]('[%s][queues][queuecallerabandon]',_0xeafe7d[_0x619d('0x3')]),_0xeafe7d);queues[_0xeafe7d['uniqueid']][_0x619d('0x27')]=![];queues[_0xeafe7d[_0x619d('0x3')]][_0x619d('0x25')]=null;queues[_0xeafe7d[_0x619d('0x3')]][_0x619d('0x15')]=!![];queues[_0xeafe7d[_0x619d('0x3')]][_0x619d('0x2a')]=utils['now']();queues[_0xeafe7d['uniqueid']]['queuecallerexitreason']=_0x619d('0x2b');utils[_0x619d('0x2')](util['format'](_0x619d('0x2c'),_0xeafe7d['uniqueid'],queues[_0xeafe7d[_0x619d('0x3')]][_0x619d('0x19')],queues[_0xeafe7d[_0x619d('0x3')]][_0x619d('0x7')]));}}catch(_0x5b4be2){utils[_0x619d('0x1c')](util[_0x619d('0xf')]('[%s][queues][queuecallerabandon]',_0xeafe7d[_0x619d('0x3')]),_0x5b4be2);}};exports[_0x619d('0x2d')]=function(_0x252184){try{if(!_['isNil'](queues[_0x252184['uniqueid']])){utils['debug'](util[_0x619d('0xf')](_0x619d('0x2e'),_0x252184[_0x619d('0x3')]),_0x252184);utils[_0x619d('0x2')](util[_0x619d('0xf')](_0x619d('0x2f'),_0x252184[_0x619d('0x3')],queues[_0x252184[_0x619d('0x3')]]['name'],_0x252184[_0x619d('0x30')],_0x252184[_0x619d('0x31')]));queues[_0x252184[_0x619d('0x3')]][_0x619d('0x2d')]=!![];queues[_0x252184[_0x619d('0x3')]][_0x619d('0x32')]=utils[_0x619d('0x17')]();queues[_0x252184['uniqueid']]['holdtime']=utils[_0x619d('0x33')](queues[_0x252184[_0x619d('0x3')]][_0x619d('0x32')],queues[_0x252184[_0x619d('0x3')]][_0x619d('0x34')]);queues[_0x252184['uniqueid']][_0x619d('0x12')]=_0x252184[_0x619d('0x12')];queues[_0x252184['uniqueid']][_0x619d('0x35')]=_0x252184[_0x619d('0x35')];queues[_0x252184[_0x619d('0x3')]][_0x619d('0x30')]=_0x252184['connectedlinenum'];queues[_0x252184['uniqueid']][_0x619d('0x31')]=_0x252184[_0x619d('0x31')];}}catch(_0x364222){utils[_0x619d('0x1c')](util[_0x619d('0xf')]('[%s][queues][queuecallerleave]',_0x252184[_0x619d('0x3')]),_0x364222);}};exports[_0x619d('0x36')]=function(_0x5ef352){try{if(!_[_0x619d('0x14')](queues[_0x5ef352[_0x619d('0x3')]])){utils[_0x619d('0x1e')](util['format'](_0x619d('0x37'),_0x5ef352[_0x619d('0x3')]),_0x5ef352);utils['info'](util[_0x619d('0xf')](_0x619d('0x38'),_0x5ef352[_0x619d('0x3')],queues[_0x5ef352['uniqueid']][_0x619d('0x19')],_0x5ef352[_0x619d('0x39')],_0x5ef352['destaccountcode']));queues[_0x5ef352[_0x619d('0x3')]][_0x619d('0x15')]=![];queues[_0x5ef352[_0x619d('0x3')]][_0x619d('0x15')]=![];queues[_0x5ef352[_0x619d('0x3')]][_0x619d('0x2a')]=null;queues[_0x5ef352[_0x619d('0x3')]][_0x619d('0x27')]=![];queues[_0x5ef352[_0x619d('0x3')]]['queuecallerexitreason']=null;queues[_0x5ef352[_0x619d('0x3')]][_0x619d('0x25')]=null;queues[_0x5ef352['uniqueid']]['assigned']=!![];queues[_0x5ef352[_0x619d('0x3')]][_0x619d('0x6')]=_0x5ef352[_0x619d('0x3a')];queues[_0x5ef352[_0x619d('0x3')]]['lastAssignedTo']=_0x5ef352[_0x619d('0x39')];}}catch(_0x43382e){utils[_0x619d('0x1c')](util['format'](_0x619d('0x37'),_0x5ef352[_0x619d('0x3')]),_0x43382e);}};exports[_0x619d('0x3b')]=function(_0xfe9f7d){try{if(!_[_0x619d('0x14')](queues[_0xfe9f7d[_0x619d('0x3')]])){if(queues[_0xfe9f7d[_0x619d('0x3')]]['queuecallerleaveAt']){utils[_0x619d('0x1e')](util['format'](_0x619d('0x3c'),_0xfe9f7d[_0x619d('0x3')]),_0xfe9f7d);queues[_0xfe9f7d['uniqueid']][_0x619d('0x15')]=![];queues[_0xfe9f7d[_0x619d('0x3')]][_0x619d('0x15')]=![];queues[_0xfe9f7d[_0x619d('0x3')]][_0x619d('0x2a')]=null;queues[_0xfe9f7d[_0x619d('0x3')]][_0x619d('0x27')]=![];queues[_0xfe9f7d[_0x619d('0x3')]]['queuecallerexitAt']=null;queues[_0xfe9f7d['uniqueid']][_0x619d('0x3d')]=!![];queues[_0xfe9f7d['uniqueid']][_0x619d('0x5')]=_0xfe9f7d[_0x619d('0x39')];queues[_0xfe9f7d[_0x619d('0x3')]]['queuecallercomplete']=!![];queues[_0xfe9f7d[_0x619d('0x3')]][_0x619d('0x16')]=utils[_0x619d('0x17')]();if(_0xfe9f7d[_0x619d('0x3e')]==_0x619d('0x3f')){if(!queues[_0xfe9f7d[_0x619d('0x3')]][_0x619d('0x3f')]){queues[_0xfe9f7d[_0x619d('0x3')]][_0x619d('0x7')]='TRANSFER';}}else{queues[_0xfe9f7d['uniqueid']]['queuecallerexitreason']=_0x619d('0x40')+_0xfe9f7d[_0x619d('0x3e')][_0x619d('0x23')]();}utils[_0x619d('0x2')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0xfe9f7d['uniqueid'],queues[_0xfe9f7d[_0x619d('0x3')]]['name'],_0xfe9f7d[_0x619d('0x39')],queues[_0xfe9f7d[_0x619d('0x3')]][_0x619d('0x7')]));writeDB(queues[_0xfe9f7d[_0x619d('0x3')]]);}}}catch(_0x5d77c8){utils['error'](util['format'](_0x619d('0x3c'),_0xfe9f7d[_0x619d('0x3')]),_0x5d77c8);}};exports[_0x619d('0x41')]=function(_0xf6db4d){try{if(!_['isNil'](queues[_0xf6db4d[_0x619d('0x42')]])){utils[_0x619d('0x1e')](util[_0x619d('0xf')](_0x619d('0x43'),_0xf6db4d[_0x619d('0x3')]),_0xf6db4d);queues[_0xf6db4d[_0x619d('0x42')]][_0x619d('0x3f')]=!![];queues[_0xf6db4d['transfereeuniqueid']][_0x619d('0x44')]='BLIND';queues[_0xf6db4d[_0x619d('0x42')]][_0x619d('0x45')]=_0xf6db4d[_0x619d('0x46')];queues[_0xf6db4d['transfereeuniqueid']][_0x619d('0x47')]=_0xf6db4d[_0x619d('0x42')];queues[_0xf6db4d[_0x619d('0x42')]][_0x619d('0x7')]=_0x619d('0x48');utils[_0x619d('0x2')](util['format'](_0x619d('0x49'),_0xf6db4d[_0x619d('0x3')],queues[_0xf6db4d[_0x619d('0x42')]][_0x619d('0x19')],_0xf6db4d[_0x619d('0x42')],_0xf6db4d[_0x619d('0x46')]));}}catch(_0x3de6f3){utils[_0x619d('0x1c')](util[_0x619d('0xf')](_0x619d('0x43'),_0xf6db4d[_0x619d('0x3')]),_0x3de6f3);}};exports['attendedtransfer']=function(_0xa6b69){try{utils['debug'](util[_0x619d('0xf')](_0x619d('0x4a'),_0xa6b69[_0x619d('0x4b')]),_0xa6b69);if(_0xa6b69[_0x619d('0x4b')]==_0xa6b69['origtransfererlinkedid']){if(!_[_0x619d('0x14')](queues[_0xa6b69[_0x619d('0x4c')]])){utils[_0x619d('0x2')](util[_0x619d('0xf')](_0x619d('0x4d'),_0xa6b69[_0x619d('0x4b')],queues[_0xa6b69['secondtransfererlinkedid']][_0x619d('0x19')],_0xa6b69[_0x619d('0x4e')]));queues[_0xa6b69['secondtransfererlinkedid']][_0x619d('0x3f')]=!![];queues[_0xa6b69[_0x619d('0x4c')]]['transfertype']=_0x619d('0x4f');queues[_0xa6b69[_0x619d('0x4c')]]['transferexten']=_0xa6b69[_0x619d('0x4e')];queues[_0xa6b69[_0x619d('0x4c')]][_0x619d('0x47')]=_0xa6b69[_0x619d('0x4b')];queues[_0xa6b69[_0x619d('0x4c')]][_0x619d('0x7')]=_0x619d('0x50');}if(!_[_0x619d('0x14')](queues[_0xa6b69['origtransfererlinkedid']])){if(_0xa6b69[_0x619d('0x51')]&&queues[_0xa6b69['transfereelinkedid']]){queues[_0xa6b69[_0x619d('0x51')]][_0x619d('0x1b')]=0x1;queues[_0xa6b69[_0x619d('0x42')]]=_[_0x619d('0x52')](queues[_0xa6b69['transfereelinkedid']]);queues[_0xa6b69[_0x619d('0x42')]][_0x619d('0xd')]=_0xa6b69[_0x619d('0x53')];queues[_0xa6b69[_0x619d('0x42')]][_0x619d('0x1b')]=0x2;queues[_0xa6b69['transfereeuniqueid']][_0x619d('0x54')]=queues[_0xa6b69[_0x619d('0x4c')]][_0x619d('0x54')];queues[_0xa6b69[_0x619d('0x42')]][_0x619d('0x55')]=queues[_0xa6b69[_0x619d('0x4c')]][_0x619d('0x55')];queues[_0xa6b69['transfereeuniqueid']][_0x619d('0x34')]=utils[_0x619d('0x17')]();queues[_0xa6b69[_0x619d('0x42')]]['queuecallerleaveAt']=utils['now']();queues[_0xa6b69['transfereeuniqueid']][_0x619d('0x56')]=0x0;queues[_0xa6b69[_0x619d('0x42')]]['mohtime']=0x0;utils[_0x619d('0x2')](util[_0x619d('0xf')](_0x619d('0x57'),_0xa6b69[_0x619d('0x4b')],queues[_0xa6b69['transfereeuniqueid']][_0x619d('0x19')],queues[_0xa6b69[_0x619d('0x42')]][_0x619d('0x54')],queues[_0xa6b69[_0x619d('0x42')]][_0x619d('0x55')]));}else{utils[_0x619d('0x2')](util[_0x619d('0xf')](_0x619d('0x58'),_0xa6b69[_0x619d('0x4b')],queues[_0xa6b69[_0x619d('0x59')]][_0x619d('0x19')],_0xa6b69['secondtransfererlinkedid']));queues[_0xa6b69[_0x619d('0x59')]][_0x619d('0xd')]=_0xa6b69[_0x619d('0x4c')];}}}else if(_0xa6b69[_0x619d('0x5a')]==_0xa6b69[_0x619d('0x4c')]){if(!_[_0x619d('0x14')](queues[_0xa6b69[_0x619d('0x59')]])){utils[_0x619d('0x2')](util[_0x619d('0xf')](_0x619d('0x5b'),_0xa6b69[_0x619d('0x4b')],queues[_0xa6b69[_0x619d('0x59')]][_0x619d('0x19')],_0xa6b69['secondtransfereruniqueid'],_0xa6b69[_0x619d('0x5c')]));queues[_0xa6b69[_0x619d('0x59')]][_0x619d('0x3f')]=!![];queues[_0xa6b69[_0x619d('0x59')]][_0x619d('0x44')]=_0x619d('0x4f');queues[_0xa6b69[_0x619d('0x59')]]['transferexten']=_0xa6b69['secondtransfererexten'];queues[_0xa6b69['origtransfererlinkedid']][_0x619d('0x47')]=_0xa6b69[_0x619d('0x5a')];queues[_0xa6b69[_0x619d('0x59')]]['queuecallerexitreason']=_0x619d('0x50');}if(!_[_0x619d('0x14')](queues[_0xa6b69[_0x619d('0x4c')]])){if(_0xa6b69[_0x619d('0x5d')]&&queues[_0xa6b69[_0x619d('0x5d')]]){queues[_0xa6b69[_0x619d('0x5d')]][_0x619d('0x1b')]=0x1;queues[_0xa6b69[_0x619d('0x53')]]=_['clone'](queues[_0xa6b69['transfertargetlinkedid']]);queues[_0xa6b69[_0x619d('0x53')]][_0x619d('0xd')]=_0xa6b69[_0x619d('0x53')];queues[_0xa6b69[_0x619d('0x53')]][_0x619d('0x1b')]=0x2;queues[_0xa6b69[_0x619d('0x53')]][_0x619d('0x54')]=queues[_0xa6b69[_0x619d('0x59')]][_0x619d('0x54')];queues[_0xa6b69[_0x619d('0x53')]]['calleridname']=queues[_0xa6b69[_0x619d('0x59')]][_0x619d('0x55')];queues[_0xa6b69[_0x619d('0x53')]]['queuecallerjoinAt']=utils[_0x619d('0x17')]();queues[_0xa6b69['transfertargetuniqueid']][_0x619d('0x32')]=utils['now']();queues[_0xa6b69[_0x619d('0x53')]][_0x619d('0x56')]=0x0;queues[_0xa6b69[_0x619d('0x53')]][_0x619d('0x5e')]=0x0;utils[_0x619d('0x2')](util[_0x619d('0xf')](_0x619d('0x5f'),_0xa6b69[_0x619d('0x4b')],queues[_0xa6b69[_0x619d('0x53')]][_0x619d('0x19')],queues[_0xa6b69[_0x619d('0x53')]][_0x619d('0xd')],queues[_0xa6b69[_0x619d('0x53')]]['calleridnum'],queues[_0xa6b69[_0x619d('0x53')]][_0x619d('0x55')]));}else{utils[_0x619d('0x2')](util[_0x619d('0xf')](_0x619d('0x58'),_0xa6b69[_0x619d('0x4b')],queues[_0xa6b69[_0x619d('0x4c')]][_0x619d('0x19')],_0xa6b69[_0x619d('0x59')]));queues[_0xa6b69[_0x619d('0x4c')]][_0x619d('0xd')]=_0xa6b69[_0x619d('0x59')];}}}}catch(_0x758320){utils[_0x619d('0x1c')](util['format'](_0x619d('0x4a'),_0xa6b69[_0x619d('0x4b')]),_0x758320);}};exports[_0x619d('0x60')]=function(_0x56d9a9){try{if(!_['isNil'](queues[_0x56d9a9[_0x619d('0x3')]])){utils[_0x619d('0x1e')](util[_0x619d('0xf')](_0x619d('0x61'),_0x56d9a9['uniqueid']),_0x56d9a9);queues[_0x56d9a9[_0x619d('0x3')]][_0x619d('0x62')]=utils[_0x619d('0x17')]();utils[_0x619d('0x2')](util[_0x619d('0xf')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x56d9a9[_0x619d('0x3')],queues[_0x56d9a9[_0x619d('0x3')]][_0x619d('0x19')],queues[_0x56d9a9[_0x619d('0x3')]][_0x619d('0x62')]));}}catch(_0x25023f){utils[_0x619d('0x1c')](util['format'](_0x619d('0x61'),_0x56d9a9[_0x619d('0x3')]),_0x25023f);}};exports['musiconholdstop']=function(_0x2659e4){try{if(!_[_0x619d('0x14')](queues[_0x2659e4[_0x619d('0x3')]])){if(!_[_0x619d('0x14')](queues[_0x2659e4[_0x619d('0x3')]][_0x619d('0x62')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x2659e4[_0x619d('0x3')]),_0x2659e4);queues[_0x2659e4[_0x619d('0x3')]][_0x619d('0x5e')]+=utils[_0x619d('0x33')](utils['now'](),queues[_0x2659e4[_0x619d('0x3')]]['musiconholdstartAt']);utils[_0x619d('0x2')](util['format'](_0x619d('0x63'),_0x2659e4[_0x619d('0x3')],queues[_0x2659e4['uniqueid']]['name'],queues[_0x2659e4[_0x619d('0x3')]][_0x619d('0x5e')]));delete queues[_0x2659e4[_0x619d('0x3')]][_0x619d('0x62')];}}}catch(_0x9178ba){utils[_0x619d('0x1c')](util[_0x619d('0xf')](_0x619d('0x64'),_0x2659e4['uniqueid']),_0x9178ba);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 49a7c92..7fa85d1 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 _0xace3=['context','channel','error','[%s][recordings][newstate]','channelstate','isNil','transfer','varset','variable','mixmonitor_filename','value','.wav49','replace','.WAV','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','format','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid'];(function(_0xc1c20,_0x439dc8){var _0x2bc99b=function(_0x78396f){while(--_0x78396f){_0xc1c20['push'](_0xc1c20['shift']());}};_0x2bc99b(++_0x439dc8);}(_0xace3,0x146));var _0x3ace=function(_0x31d277,_0x450bec){_0x31d277=_0x31d277-0x0;var _0x563f8a=_0xace3[_0x31d277];return _0x563f8a;};'use strict';var _=require(_0x3ace('0x0'));var util=require('util');var utils=require(_0x3ace('0x1'));var recordings={};function writeDB(_0xe7f5bd){utils[_0x3ace('0x2')](util[_0x3ace('0x3')]('[%s][recordings][writeDB]',_0xe7f5bd[_0x3ace('0x4')]));if(_0xe7f5bd[_0x3ace('0x5')]){utils[_0x3ace('0x6')](_0xe7f5bd[_0x3ace('0x5')])['then'](function(_0x259bc4){if(_0x259bc4){_0xe7f5bd[_0x3ace('0x7')]=_0x259bc4[_0x3ace('0x8')];_0xe7f5bd[_0x3ace('0x9')]=_0x259bc4['id'];}utils[_0x3ace('0xa')]('CreateVoiceRecording',_0xe7f5bd);});}else{utils[_0x3ace('0xa')](_0x3ace('0xb'),_0xe7f5bd);}}exports[_0x3ace('0xc')]=function(_0x4012ed){try{utils[_0x3ace('0xd')](util[_0x3ace('0x3')](_0x3ace('0xe'),_0x4012ed['uniqueid']),_0x4012ed);if(_0x4012ed[_0x3ace('0x4')]==_0x4012ed[_0x3ace('0xf')]){utils[_0x3ace('0x2')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x4012ed[_0x3ace('0x4')],_0x4012ed[_0x3ace('0x10')],_0x4012ed['exten']));recordings[_0x4012ed[_0x3ace('0x4')]]={'uniqueid':_0x4012ed['uniqueid'],'accountcode':_0x4012ed[_0x3ace('0x5')],'exten':_0x4012ed['exten'],'context':_0x4012ed[_0x3ace('0x10')],'channel':_0x4012ed[_0x3ace('0x11')],'monitors':[]};}}catch(_0x3314b2){utils[_0x3ace('0x12')](util[_0x3ace('0x3')](_0x3ace('0xe'),_0x4012ed['uniqueid']),_0x3314b2);}};exports['newstate']=function(_0x5d0d7c){try{utils[_0x3ace('0xd')](util['format'](_0x3ace('0x13'),_0x5d0d7c[_0x3ace('0x4')]),_0x5d0d7c);if(!_['isNil'](recordings[_0x5d0d7c[_0x3ace('0x4')]])&&_0x5d0d7c[_0x3ace('0x14')]==0x6){utils[_0x3ace('0x2')](util[_0x3ace('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x5d0d7c[_0x3ace('0x4')],_0x5d0d7c[_0x3ace('0x10')],_0x5d0d7c[_0x3ace('0x11')]));}else if(!_[_0x3ace('0x15')](recordings[_0x5d0d7c['linkedid']])&&_0x5d0d7c[_0x3ace('0x14')]==0x6&&_0x5d0d7c[_0x3ace('0x10')]!=_0x3ace('0x16')){utils[_0x3ace('0x2')](util[_0x3ace('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5d0d7c[_0x3ace('0x4')],_0x5d0d7c[_0x3ace('0xf')],_0x5d0d7c[_0x3ace('0x10')],_0x5d0d7c[_0x3ace('0x11')]));recordings[_0x5d0d7c[_0x3ace('0xf')]][_0x3ace('0x5')]=_0x5d0d7c['accountcode'];}}catch(_0x681415){utils['error'](util[_0x3ace('0x3')](_0x3ace('0x13'),_0x5d0d7c[_0x3ace('0x4')]),_0x681415);}};exports[_0x3ace('0x17')]=function(_0x585620){try{if(!_[_0x3ace('0x15')](_0x585620[_0x3ace('0x18')])&&!_[_0x3ace('0x15')](_0x585620[_0x3ace('0x18')][_0x3ace('0x19')])){utils[_0x3ace('0xd')](util[_0x3ace('0x3')]('[%s][recordings][varset]',_0x585620[_0x3ace('0x4')]),_0x585620);utils['info'](util[_0x3ace('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x585620[_0x3ace('0x4')],_0x585620['variable'],_0x585620[_0x3ace('0x1a')]));if(_['endsWith'](_0x585620[_0x3ace('0x1a')],_0x3ace('0x1b'))){_0x585620[_0x3ace('0x1a')]=_0x585620[_0x3ace('0x1a')][_0x3ace('0x1c')](_0x3ace('0x1b'),_0x3ace('0x1d'));}if(recordings[_0x585620[_0x3ace('0xf')]]){var _0xe6e832=_['find'](recordings[_0x585620['linkedid']][_0x3ace('0x1e')],{'value':_0x585620[_0x3ace('0x1a')]});if(_[_0x3ace('0x15')](_0xe6e832)){recordings[_0x585620[_0x3ace('0xf')]][_0x3ace('0x1e')][_0x3ace('0x1f')]({'value':_0x585620['value']});}}}}catch(_0x55fe8f){utils[_0x3ace('0x12')](util[_0x3ace('0x3')](_0x3ace('0x20'),_0x585620['uniqueid']),_0x55fe8f);}};exports[_0x3ace('0x21')]=function(_0x3d0d24){try{if(!_[_0x3ace('0x15')](recordings[_0x3d0d24[_0x3ace('0x4')]])){utils[_0x3ace('0xd')](util[_0x3ace('0x3')](_0x3ace('0x22'),_0x3d0d24[_0x3ace('0x4')]),_0x3d0d24);utils[_0x3ace('0x2')](util['format'](_0x3ace('0x23'),_0x3d0d24['uniqueid'],_0x3d0d24[_0x3ace('0x24')],_0x3d0d24[_0x3ace('0x25')],_0x3d0d24[_0x3ace('0x26')]));recordings[_0x3d0d24['uniqueid']]['calleridnum']=_0x3d0d24[_0x3ace('0x24')];recordings[_0x3d0d24[_0x3ace('0x4')]]['calleridname']=_0x3d0d24[_0x3ace('0x25')];recordings[_0x3d0d24[_0x3ace('0x4')]][_0x3ace('0x27')]=_0x3d0d24['connectedlinenum'];recordings[_0x3d0d24[_0x3ace('0x4')]][_0x3ace('0x28')]=_0x3d0d24[_0x3ace('0x28')];if(recordings[_0x3d0d24[_0x3ace('0x4')]][_0x3ace('0x29')]=='outbound'&&recordings[_0x3d0d24[_0x3ace('0x4')]]['accountcode']){recordings[_0x3d0d24[_0x3ace('0x4')]][_0x3ace('0x27')]=recordings[_0x3d0d24[_0x3ace('0x4')]][_0x3ace('0x5')];recordings[_0x3d0d24['uniqueid']]['connectedlinename']='';}recordings[_0x3d0d24[_0x3ace('0x4')]]['monitors'][_0x3ace('0x2a')](function(_0x56ef81){var _0x58df2a=_[_0x3ace('0x2b')](recordings[_0x3d0d24[_0x3ace('0x4')]]);_0x58df2a[_0x3ace('0x1a')]=_0x56ef81['value'];writeDB(_0x58df2a);});delete recordings[_0x3d0d24[_0x3ace('0x4')]];}}catch(_0x4abc98){utils['error'](util['format']('[%s][recordings][hangup]',_0x3d0d24[_0x3ace('0x4')]),_0x4abc98);}};exports[_0x3ace('0x2c')]=function(_0x15f519){try{if(!_[_0x3ace('0x15')](recordings[_0x15f519[_0x3ace('0x4')]])){utils[_0x3ace('0xd')](util[_0x3ace('0x3')](_0x3ace('0x2d'),_0x15f519[_0x3ace('0x4')]),_0x15f519);utils[_0x3ace('0x2')](util[_0x3ace('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x15f519[_0x3ace('0x4')],_0x15f519['application'],_0x15f519[_0x3ace('0x2e')]));if(_0x15f519[_0x3ace('0x2f')][_0x3ace('0x30')]()==_0x3ace('0x31')&&_[_0x3ace('0x32')](_0x15f519[_0x3ace('0x2e')][_0x3ace('0x30')](),_0x3ace('0x33'))){var _0x33d446=_0x15f519[_0x3ace('0x2e')][_0x3ace('0x34')]('=');var _0x5abea0=_0x33d446[0x0][_0x3ace('0x35')](_0x33d446[0x0][_0x3ace('0x36')]('(')+0x1,_0x33d446[0x0][_0x3ace('0x36')](')'));var _0xddd743=_0x33d446[0x1];recordings[_0x15f519[_0x3ace('0x4')]][_0x5abea0]=_0xddd743;}}}catch(_0x27d2f9){utils['error'](util[_0x3ace('0x3')](_0x3ace('0x2d'),_0x15f519['uniqueid']),_0x27d2f9);}};exports['queuecallerjoin']=function(_0x4d072c){try{if(!_['isNil'](recordings[_0x4d072c['uniqueid']])){utils[_0x3ace('0xd')](util[_0x3ace('0x3')]('[%s][recordings][queuecallerjoin]',_0x4d072c[_0x3ace('0x4')]),_0x4d072c);utils[_0x3ace('0x2')](util[_0x3ace('0x3')](_0x3ace('0x37'),_0x4d072c[_0x3ace('0x4')],_0x4d072c[_0x3ace('0x38')]));recordings[_0x4d072c[_0x3ace('0x4')]][_0x3ace('0x38')]=_0x4d072c['queue'];}}catch(_0x1f46d3){utils['error'](util['format']('[%s][recordings][queuecallerjoin]',_0x4d072c[_0x3ace('0x4')]),_0x1f46d3);}}; \ No newline at end of file +var _0x3711=['.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','channel','error','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith'];(function(_0x17bccc,_0x4cc003){var _0x16e5fe=function(_0x3f7b2a){while(--_0x3f7b2a){_0x17bccc['push'](_0x17bccc['shift']());}};_0x16e5fe(++_0x4cc003);}(_0x3711,0x198));var _0x1371=function(_0x48fc40,_0x4d25bc){_0x48fc40=_0x48fc40-0x0;var _0x12d7b6=_0x3711[_0x48fc40];return _0x12d7b6;};'use strict';var _=require(_0x1371('0x0'));var util=require(_0x1371('0x1'));var utils=require(_0x1371('0x2'));var recordings={};function writeDB(_0x3c5a4e){utils[_0x1371('0x3')](util[_0x1371('0x4')](_0x1371('0x5'),_0x3c5a4e[_0x1371('0x6')]));if(_0x3c5a4e[_0x1371('0x7')]){utils[_0x1371('0x8')](_0x3c5a4e[_0x1371('0x7')])[_0x1371('0x9')](function(_0x12c94b){if(_0x12c94b){_0x3c5a4e['membername']=_0x12c94b['name'];_0x3c5a4e[_0x1371('0xa')]=_0x12c94b['id'];}utils[_0x1371('0xb')](_0x1371('0xc'),_0x3c5a4e);});}else{utils['request'](_0x1371('0xc'),_0x3c5a4e);}}exports[_0x1371('0xd')]=function(_0x30ed2e){try{utils[_0x1371('0xe')](util[_0x1371('0x4')](_0x1371('0xf'),_0x30ed2e[_0x1371('0x6')]),_0x30ed2e);if(_0x30ed2e['uniqueid']==_0x30ed2e[_0x1371('0x10')]){utils[_0x1371('0x3')](util[_0x1371('0x4')](_0x1371('0x11'),_0x30ed2e['uniqueid'],_0x30ed2e[_0x1371('0x12')],_0x30ed2e[_0x1371('0x13')]));recordings[_0x30ed2e[_0x1371('0x6')]]={'uniqueid':_0x30ed2e[_0x1371('0x6')],'accountcode':_0x30ed2e[_0x1371('0x7')],'exten':_0x30ed2e[_0x1371('0x13')],'context':_0x30ed2e[_0x1371('0x12')],'channel':_0x30ed2e['channel'],'monitors':[]};}}catch(_0x2ef75a){utils['error'](util['format'](_0x1371('0xf'),_0x30ed2e[_0x1371('0x6')]),_0x2ef75a);}};exports[_0x1371('0x14')]=function(_0x2fa475){try{utils[_0x1371('0xe')](util[_0x1371('0x4')](_0x1371('0x15'),_0x2fa475[_0x1371('0x6')]),_0x2fa475);if(!_[_0x1371('0x16')](recordings[_0x2fa475['uniqueid']])&&_0x2fa475[_0x1371('0x17')]==0x6){utils['info'](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x2fa475[_0x1371('0x6')],_0x2fa475['context'],_0x2fa475['channel']));}else if(!_[_0x1371('0x16')](recordings[_0x2fa475['linkedid']])&&_0x2fa475[_0x1371('0x17')]==0x6&&_0x2fa475[_0x1371('0x12')]!=_0x1371('0x18')){utils['info'](util[_0x1371('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2fa475[_0x1371('0x6')],_0x2fa475[_0x1371('0x10')],_0x2fa475[_0x1371('0x12')],_0x2fa475[_0x1371('0x19')]));recordings[_0x2fa475[_0x1371('0x10')]][_0x1371('0x7')]=_0x2fa475['accountcode'];}}catch(_0x475629){utils[_0x1371('0x1a')](util['format']('[%s][recordings][newstate]',_0x2fa475[_0x1371('0x6')]),_0x475629);}};exports['varset']=function(_0x28ed34){try{if(!_[_0x1371('0x16')](_0x28ed34['variable'])&&!_['isNil'](_0x28ed34[_0x1371('0x1b')][_0x1371('0x1c')])){utils['debug'](util['format'](_0x1371('0x1d'),_0x28ed34[_0x1371('0x6')]),_0x28ed34);utils[_0x1371('0x3')](util[_0x1371('0x4')](_0x1371('0x1e'),_0x28ed34['uniqueid'],_0x28ed34['variable'],_0x28ed34[_0x1371('0x1f')]));if(_[_0x1371('0x20')](_0x28ed34['value'],_0x1371('0x21'))){_0x28ed34[_0x1371('0x1f')]=_0x28ed34[_0x1371('0x1f')][_0x1371('0x22')](_0x1371('0x21'),_0x1371('0x23'));}if(recordings[_0x28ed34[_0x1371('0x10')]]){var _0x3e92f1=_[_0x1371('0x24')](recordings[_0x28ed34[_0x1371('0x10')]][_0x1371('0x25')],{'value':_0x28ed34[_0x1371('0x1f')]});if(_['isNil'](_0x3e92f1)){recordings[_0x28ed34[_0x1371('0x10')]][_0x1371('0x25')][_0x1371('0x26')]({'value':_0x28ed34[_0x1371('0x1f')]});}}}}catch(_0x230d17){utils['error'](util['format'](_0x1371('0x1d'),_0x28ed34['uniqueid']),_0x230d17);}};exports[_0x1371('0x27')]=function(_0x331365){try{if(!_[_0x1371('0x16')](recordings[_0x331365['uniqueid']])){utils[_0x1371('0xe')](util[_0x1371('0x4')](_0x1371('0x28'),_0x331365[_0x1371('0x6')]),_0x331365);utils['info'](util[_0x1371('0x4')](_0x1371('0x29'),_0x331365['uniqueid'],_0x331365[_0x1371('0x2a')],_0x331365[_0x1371('0x2b')],_0x331365['cause-txt']));recordings[_0x331365['uniqueid']][_0x1371('0x2a')]=_0x331365[_0x1371('0x2a')];recordings[_0x331365[_0x1371('0x6')]]['calleridname']=_0x331365[_0x1371('0x2b')];recordings[_0x331365[_0x1371('0x6')]][_0x1371('0x2c')]=_0x331365[_0x1371('0x2c')];recordings[_0x331365[_0x1371('0x6')]]['connectedlinename']=_0x331365[_0x1371('0x2d')];if(recordings[_0x331365[_0x1371('0x6')]][_0x1371('0x2e')]==_0x1371('0x2f')&&recordings[_0x331365[_0x1371('0x6')]]['accountcode']){recordings[_0x331365[_0x1371('0x6')]][_0x1371('0x2c')]=recordings[_0x331365[_0x1371('0x6')]][_0x1371('0x7')];recordings[_0x331365[_0x1371('0x6')]][_0x1371('0x2d')]='';}recordings[_0x331365[_0x1371('0x6')]][_0x1371('0x25')][_0x1371('0x30')](function(_0x69d3fa){var _0x7d4d22=_[_0x1371('0x31')](recordings[_0x331365[_0x1371('0x6')]]);_0x7d4d22[_0x1371('0x1f')]=_0x69d3fa[_0x1371('0x1f')];writeDB(_0x7d4d22);});delete recordings[_0x331365['uniqueid']];}}catch(_0x49e898){utils['error'](util['format'](_0x1371('0x28'),_0x331365[_0x1371('0x6')]),_0x49e898);}};exports[_0x1371('0x32')]=function(_0x29697d){try{if(!_[_0x1371('0x16')](recordings[_0x29697d[_0x1371('0x6')]])){utils[_0x1371('0xe')](util[_0x1371('0x4')](_0x1371('0x33'),_0x29697d[_0x1371('0x6')]),_0x29697d);utils['info'](util[_0x1371('0x4')](_0x1371('0x34'),_0x29697d[_0x1371('0x6')],_0x29697d[_0x1371('0x35')],_0x29697d[_0x1371('0x36')]));if(_0x29697d[_0x1371('0x35')][_0x1371('0x37')]()==_0x1371('0x38')&&_[_0x1371('0x39')](_0x29697d[_0x1371('0x36')][_0x1371('0x37')](),'cdr')){var _0x25db35=_0x29697d[_0x1371('0x36')]['split']('=');var _0x75f3e4=_0x25db35[0x0]['substring'](_0x25db35[0x0][_0x1371('0x3a')]('(')+0x1,_0x25db35[0x0]['lastIndexOf'](')'));var _0x23437d=_0x25db35[0x1];recordings[_0x29697d[_0x1371('0x6')]][_0x75f3e4]=_0x23437d;}}}catch(_0x94eed1){utils[_0x1371('0x1a')](util[_0x1371('0x4')](_0x1371('0x33'),_0x29697d[_0x1371('0x6')]),_0x94eed1);}};exports[_0x1371('0x3b')]=function(_0xba21ca){try{if(!_['isNil'](recordings[_0xba21ca[_0x1371('0x6')]])){utils[_0x1371('0xe')](util[_0x1371('0x4')](_0x1371('0x3c'),_0xba21ca[_0x1371('0x6')]),_0xba21ca);utils[_0x1371('0x3')](util['format'](_0x1371('0x3d'),_0xba21ca[_0x1371('0x6')],_0xba21ca['queue']));recordings[_0xba21ca['uniqueid']][_0x1371('0x3e')]=_0xba21ca[_0x1371('0x3e')];}}catch(_0x26b95f){utils[_0x1371('0x1a')](util[_0x1371('0x4')](_0x1371('0x3c'),_0xba21ca[_0x1371('0x6')]),_0x26b95f);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 41b1670..efe193e 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 _0xd94e=['./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','blinds','transfereruniqueid','error','[%s][transfers][blindtransfer]','attendedtransfer','info','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash'];(function(_0x5a93f0,_0x172b1b){var _0x53844d=function(_0x19ba69){while(--_0x19ba69){_0x5a93f0['push'](_0x5a93f0['shift']());}};_0x53844d(++_0x172b1b);}(_0xd94e,0x6e));var _0xed94=function(_0x4c0d2b,_0x2ff906){_0x4c0d2b=_0x4c0d2b-0x0;var _0x58c4fe=_0xd94e[_0x4c0d2b];return _0x58c4fe;};'use strict';var _=require(_0xed94('0x0'));var util=require('util');var utils=require(_0xed94('0x1'));function writeDB(_0x390dd0){utils['info'](util[_0xed94('0x2')](_0xed94('0x3'),_0x390dd0[_0xed94('0x4')]===_0xed94('0x5')?_0x390dd0[_0xed94('0x6')]:_0x390dd0[_0xed94('0x7')],_0x390dd0['type']));utils['request'](_0xed94('0x8'),_0x390dd0);}exports['blinds']={};exports[_0xed94('0x9')]=function(_0x1e0c9c){try{utils[_0xed94('0xa')](util[_0xed94('0x2')]('[%s][transfers][blindtransfer]',_0x1e0c9c[_0xed94('0x7')]),_0x1e0c9c);utils['info'](util['format'](_0xed94('0xb'),_0x1e0c9c[_0xed94('0x7')],_0x1e0c9c[_0xed94('0xc')],_0x1e0c9c[_0xed94('0xd')],_0x1e0c9c['transfereecalleridnum'],_0x1e0c9c[_0xed94('0xe')]));_0x1e0c9c[_0xed94('0x4')]=_0xed94('0xf');exports[_0xed94('0x10')][_0x1e0c9c[_0xed94('0x11')]]=_0x1e0c9c;writeDB(_0x1e0c9c);}catch(_0xc2eb46){utils[_0xed94('0x12')](util[_0xed94('0x2')](_0xed94('0x13'),_0x1e0c9c[_0xed94('0x7')]),_0xc2eb46);}};exports[_0xed94('0x14')]=function(_0x46fefb){try{utils['debug'](util[_0xed94('0x2')]('[%s][transfers][attendedtransfer]',_0x46fefb[_0xed94('0x6')]),_0x46fefb);utils[_0xed94('0x15')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x46fefb[_0xed94('0x6')],_0x46fefb[_0xed94('0x16')],_0x46fefb[_0xed94('0x17')],_0x46fefb[_0xed94('0x18')],_0x46fefb['transfertargetcalleridname']));_0x46fefb=_[_0xed94('0x19')](_0x46fefb,{'transfererchannel':_0x46fefb['origtransfererchannel'],'transferercalleridnum':_0x46fefb[_0xed94('0x16')],'transferercalleridname':_0x46fefb['origtransferercalleridname'],'transfererconnectedlinenum':_0x46fefb['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x46fefb[_0xed94('0x1a')],'transfereraccountcode':_0x46fefb[_0xed94('0x1b')],'transferercontext':_0x46fefb[_0xed94('0x1c')],'transfererexten':_0x46fefb[_0xed94('0x1d')],'transfererlinkedid':_0x46fefb['origtransfererlinkedid'],'context':_0x46fefb['origtransferercontext'],'extension':_0x46fefb['origtransfererexten'],'type':_0xed94('0x5')});if(_[_0xed94('0x1e')](_0x46fefb[_0xed94('0x1f')])){_0x46fefb=_['assign'](_0x46fefb,{'transfereechannel':_0x46fefb['transfertargetchannel'],'transfereecalleridnum':_0x46fefb[_0xed94('0x18')],'transfereecalleridname':_0x46fefb[_0xed94('0x20')],'transfereeconnectedlinenum':_0x46fefb[_0xed94('0x21')],'transfereeconnectedlinename':_0x46fefb['transfertargetconnectedlinename'],'transfereeaccountcode':_0x46fefb['transfertargetaccountcode'],'transfereecontext':_0x46fefb['transfertargetcontext'],'transfereeexten':_0x46fefb[_0xed94('0x22')],'transfereelinkedid':_0x46fefb[_0xed94('0x23')]});}writeDB(_0x46fefb);}catch(_0x201173){utils[_0xed94('0x12')](util[_0xed94('0x2')](_0xed94('0x24'),_0x46fefb[_0xed94('0x6')]),_0x201173);}}; \ No newline at end of file +var _0x6c40=['transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum'];(function(_0x4fe328,_0x5e456d){var _0x11a53b=function(_0x42f8cb){while(--_0x42f8cb){_0x4fe328['push'](_0x4fe328['shift']());}};_0x11a53b(++_0x5e456d);}(_0x6c40,0x132));var _0x06c4=function(_0x174e13,_0x30c55b){_0x174e13=_0x174e13-0x0;var _0x3f87dd=_0x6c40[_0x174e13];return _0x3f87dd;};'use strict';var _=require(_0x06c4('0x0'));var util=require(_0x06c4('0x1'));var utils=require(_0x06c4('0x2'));function writeDB(_0x1769f1){utils[_0x06c4('0x3')](util[_0x06c4('0x4')](_0x06c4('0x5'),_0x1769f1[_0x06c4('0x6')]==='attended'?_0x1769f1['origtransfereruniqueid']:_0x1769f1[_0x06c4('0x7')],_0x1769f1[_0x06c4('0x6')]));utils[_0x06c4('0x8')](_0x06c4('0x9'),_0x1769f1);}exports[_0x06c4('0xa')]={};exports[_0x06c4('0xb')]=function(_0x5e23df){try{utils[_0x06c4('0xc')](util[_0x06c4('0x4')](_0x06c4('0xd'),_0x5e23df[_0x06c4('0x7')]),_0x5e23df);utils[_0x06c4('0x3')](util[_0x06c4('0x4')](_0x06c4('0xe'),_0x5e23df[_0x06c4('0x7')],_0x5e23df[_0x06c4('0xf')],_0x5e23df[_0x06c4('0x10')],_0x5e23df[_0x06c4('0x11')],_0x5e23df[_0x06c4('0x12')]));_0x5e23df['type']=_0x06c4('0x13');exports['blinds'][_0x5e23df[_0x06c4('0x14')]]=_0x5e23df;writeDB(_0x5e23df);}catch(_0x4ea456){utils[_0x06c4('0x15')](util[_0x06c4('0x4')](_0x06c4('0xd'),_0x5e23df[_0x06c4('0x7')]),_0x4ea456);}};exports[_0x06c4('0x16')]=function(_0x54c643){try{utils[_0x06c4('0xc')](util[_0x06c4('0x4')](_0x06c4('0x17'),_0x54c643[_0x06c4('0x18')]),_0x54c643);utils[_0x06c4('0x3')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x54c643[_0x06c4('0x18')],_0x54c643[_0x06c4('0x19')],_0x54c643[_0x06c4('0x1a')],_0x54c643[_0x06c4('0x1b')],_0x54c643[_0x06c4('0x1c')]));_0x54c643=_[_0x06c4('0x1d')](_0x54c643,{'transfererchannel':_0x54c643[_0x06c4('0x1e')],'transferercalleridnum':_0x54c643[_0x06c4('0x19')],'transferercalleridname':_0x54c643[_0x06c4('0x1a')],'transfererconnectedlinenum':_0x54c643[_0x06c4('0x1f')],'transfererconnectedlinename':_0x54c643[_0x06c4('0x20')],'transfereraccountcode':_0x54c643[_0x06c4('0x21')],'transferercontext':_0x54c643[_0x06c4('0x22')],'transfererexten':_0x54c643['secondtransfererexten'],'transfererlinkedid':_0x54c643[_0x06c4('0x23')],'context':_0x54c643[_0x06c4('0x24')],'extension':_0x54c643[_0x06c4('0x25')],'type':_0x06c4('0x26')});if(_[_0x06c4('0x27')](_0x54c643[_0x06c4('0x28')])){_0x54c643=_['assign'](_0x54c643,{'transfereechannel':_0x54c643[_0x06c4('0x29')],'transfereecalleridnum':_0x54c643['transfertargetcalleridnum'],'transfereecalleridname':_0x54c643[_0x06c4('0x1c')],'transfereeconnectedlinenum':_0x54c643[_0x06c4('0x2a')],'transfereeconnectedlinename':_0x54c643[_0x06c4('0x2b')],'transfereeaccountcode':_0x54c643[_0x06c4('0x2c')],'transfereecontext':_0x54c643['transfertargetcontext'],'transfereeexten':_0x54c643['transfertargetexten'],'transfereelinkedid':_0x54c643[_0x06c4('0x2d')]});}writeDB(_0x54c643);}catch(_0x4f5361){utils[_0x06c4('0x15')](util[_0x06c4('0x4')]('[%s][transfers][attendedtransfer]',_0x54c643[_0x06c4('0x18')]),_0x4f5361);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 455f716..3e6eb45 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 _0xe155=['subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','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','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','found','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','seconds','format','subtractTime'];(function(_0x24f649,_0x166a90){var _0x2d6a5a=function(_0x116ba0){while(--_0x116ba0){_0x24f649['push'](_0x24f649['shift']());}};_0x2d6a5a(++_0x166a90);}(_0xe155,0xcf));var _0x5e15=function(_0x2b9c3c,_0x2254f6){_0x2b9c3c=_0x2b9c3c-0x0;var _0x3f76db=_0xe155[_0x2b9c3c];return _0x3f76db;};'use strict';var BPromise=require(_0x5e15('0x0'));var jayson=require(_0x5e15('0x1'));var moment=require(_0x5e15('0x2'));var util=require(_0x5e15('0x3'));var client=jayson[_0x5e15('0x4')][_0x5e15('0x5')]({'port':0x2329});var logger=require(_0x5e15('0x6'))(_0x5e15('0x7'));exports[_0x5e15('0x8')]=function(_0x730ce,_0x165fac){logger[_0x5e15('0x8')](_0x730ce,_0x165fac?util[_0x5e15('0x9')](_0x165fac,{'showHidden':![],'depth':null}):'');};exports[_0x5e15('0xa')]=function(_0x39a690,_0x2eb945){logger[_0x5e15('0xa')](_0x39a690,_0x2eb945?util[_0x5e15('0x9')](_0x2eb945,{'showHidden':![],'depth':null}):'');};exports[_0x5e15('0xb')]=function(_0x155261,_0x47b6f7){logger[_0x5e15('0xb')](_0x155261,_0x47b6f7?util[_0x5e15('0x9')](_0x47b6f7,{'showHidden':![],'depth':null}):'');};exports[_0x5e15('0xc')]=function(_0x99b4f6,_0x412d49){return client[_0x5e15('0xc')](_0x99b4f6,{'body':_0x412d49})[_0x5e15('0xd')](function(_0x17d01c){logger[_0x5e15('0xa')](_0x5e15('0xe'),_0x99b4f6,_0x17d01c?util[_0x5e15('0x9')](_0x17d01c,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x8adca4){logger[_0x5e15('0xb')]('[utils][request]\x20name:%s',_0x99b4f6,_0x8adca4?util[_0x5e15('0x9')](_0x8adca4,{'showHidden':![],'depth':null}):'');});};function getUser(_0x314feb){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0x5e15('0xf'),_0x5e15('0x10'),_0x5e15('0x11')],'where':_0x314feb,'limit':0x1}})[_0x5e15('0xd')](function(_0xc9ff82){logger['debug'](_0x5e15('0x12'),JSON[_0x5e15('0x13')](_0x314feb),_0xc9ff82?util[_0x5e15('0x9')](_0xc9ff82,{'showHidden':![],'depth':null}):'');return _0xc9ff82['result'][_0x5e15('0x14')]?_0xc9ff82[_0x5e15('0x15')][0x0]:null;});}exports[_0x5e15('0x16')]=function(_0x49a589){return new BPromise(function(_0x1dc4f7,_0x2b4536){if(_0x49a589){return getUser({'internal':_0x49a589})[_0x5e15('0xd')](function(_0x4bd1ee){logger[_0x5e15('0x8')](_0x5e15('0x17'),_0x49a589,_0x4bd1ee?'found':'notfound');return _0x1dc4f7(_0x4bd1ee);})[_0x5e15('0x18')](function(_0xda7c63){logger[_0x5e15('0xb')](_0x5e15('0x19'),_0xda7c63?util[_0x5e15('0x9')](_0xda7c63,{'showHidden':![],'depth':null}):'');return _0x1dc4f7(null);});}return _0x1dc4f7(null);});};exports[_0x5e15('0x1a')]=function(_0x4a7fe1){return new BPromise(function(_0xf3bd7c,_0x52f8f0){if(_0x4a7fe1){return getUser({'interface':_0x4a7fe1})[_0x5e15('0xd')](function(_0x3327de){logger[_0x5e15('0x8')](_0x5e15('0x1b'),_0x4a7fe1,_0x3327de?'found':_0x5e15('0x1c'));return _0xf3bd7c(_0x3327de);})[_0x5e15('0x18')](function(_0x12a77b){logger['error'](_0x5e15('0x1d'),_0x12a77b?util[_0x5e15('0x9')](_0x12a77b,{'showHidden':![],'depth':null}):'');return _0xf3bd7c(null);});}return _0xf3bd7c(null);});};exports[_0x5e15('0x1e')]=function(_0x2516f3){return new BPromise(function(_0x5ac110,_0x3a8722){if(_0x2516f3){return getUser({'name':_0x2516f3})[_0x5e15('0xd')](function(_0x28003f){logger[_0x5e15('0x8')](_0x5e15('0x1f'),_0x2516f3,_0x28003f?_0x5e15('0x20'):_0x5e15('0x1c'));return _0x5ac110(_0x28003f);})[_0x5e15('0x18')](function(_0x48ed1b){logger[_0x5e15('0xb')]('[utils][getUserByName]',_0x48ed1b?util['inspect'](_0x48ed1b,{'showHidden':![],'depth':null}):'');return _0x5ac110(null);});}return _0x5ac110(null);});};exports[_0x5e15('0x21')]=function(_0x5c87ce){return new BPromise(function(_0x1cc5cd,_0x39fec2){if(_0x5c87ce){return client[_0x5e15('0xc')](_0x5e15('0x22'),{'options':{'raw':!![],'attributes':['id','name','type',_0x5e15('0x23'),_0x5e15('0x24')],'where':{'name':_0x5c87ce},'limit':0x1}})[_0x5e15('0xd')](function(_0x5a4290){logger['debug'](_0x5e15('0x25'),_0x5c87ce,_0x5a4290?util['inspect'](_0x5a4290,{'showHidden':![],'depth':null}):'');logger[_0x5e15('0x8')](_0x5e15('0x26'),_0x5c87ce,_0x5a4290?_0x5e15('0x20'):'notfound');return _0x1cc5cd(_0x5a4290[_0x5e15('0x15')]['length']?_0x5a4290['result'][0x0]:null);})[_0x5e15('0x18')](function(_0x33e827){logger[_0x5e15('0xb')](_0x5e15('0x27'),_0x33e827?util[_0x5e15('0x9')](_0x33e827,{'showHidden':![],'depth':null}):'');return _0x1cc5cd(null);});}return _0x1cc5cd(null);});};exports['addTime']=function(_0x4d2ecd,_0x54a003){return moment(_0x4d2ecd)['add'](_0x54a003,_0x5e15('0x28'))[_0x5e15('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5e15('0x2a')]=function(_0x1244be,_0xc0cf44){return moment(_0x1244be)[_0x5e15('0x2b')](_0xc0cf44,_0x5e15('0x28'))['format'](_0x5e15('0x2c'));};exports[_0x5e15('0x2d')]=function(_0x59e1fd,_0x4df56c){return moment(_0x59e1fd)[_0x5e15('0x2e')](moment(_0x4df56c),'seconds');};exports['sumTime']=function(_0x3fb497,_0x1f89a2){return parseInt(_0x3fb497,0xa)+parseInt(_0x1f89a2,0xa);};exports[_0x5e15('0x2f')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5e15('0x30')]=function(_0x108712,_0x2bf923){if(_0x2bf923){return moment(_0x108712)['isAfter'](_0x2bf923);}return!![];};exports[_0x5e15('0x31')]=function(_0x56967a,_0x405bee){if(_0x405bee){return moment(_0x56967a)['isBefore'](_0x405bee);}else if(_0x56967a){return!![];}return![];}; \ No newline at end of file +var _0x664c=['acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','format','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','isAfter','jayson/promise','moment','util','client','http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type'];(function(_0x4f3cf6,_0x1d8c0b){var _0x26309f=function(_0x5031c5){while(--_0x5031c5){_0x4f3cf6['push'](_0x4f3cf6['shift']());}};_0x26309f(++_0x1d8c0b);}(_0x664c,0x97));var _0xc664=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x664c[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xc664('0x0'));var moment=require(_0xc664('0x1'));var util=require(_0xc664('0x2'));var client=jayson[_0xc664('0x3')][_0xc664('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0xc664('0x5'));exports[_0xc664('0x6')]=function(_0x531cdb,_0x3207f3){logger[_0xc664('0x6')](_0x531cdb,_0x3207f3?util[_0xc664('0x7')](_0x3207f3,{'showHidden':![],'depth':null}):'');};exports[_0xc664('0x8')]=function(_0x30859b,_0x34d3cb){logger[_0xc664('0x8')](_0x30859b,_0x34d3cb?util[_0xc664('0x7')](_0x34d3cb,{'showHidden':![],'depth':null}):'');};exports[_0xc664('0x9')]=function(_0x45ea4d,_0x1c8a60){logger[_0xc664('0x9')](_0x45ea4d,_0x1c8a60?util['inspect'](_0x1c8a60,{'showHidden':![],'depth':null}):'');};exports[_0xc664('0xa')]=function(_0x9d2aa2,_0x4e01eb){return client['request'](_0x9d2aa2,{'body':_0x4e01eb})[_0xc664('0xb')](function(_0x5c22b6){logger['debug'](_0xc664('0xc'),_0x9d2aa2,_0x5c22b6?util[_0xc664('0x7')](_0x5c22b6,{'showHidden':![],'depth':null}):'');})[_0xc664('0xd')](function(_0x24033f){logger['error'](_0xc664('0xc'),_0x9d2aa2,_0x24033f?util[_0xc664('0x7')](_0x24033f,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3b8291){return client[_0xc664('0xa')](_0xc664('0xe'),{'options':{'raw':!![],'attributes':['id',_0xc664('0xf'),_0xc664('0x10'),_0xc664('0x11')],'where':_0x3b8291,'limit':0x1}})[_0xc664('0xb')](function(_0x19ae9a){logger[_0xc664('0x8')](_0xc664('0x12'),JSON[_0xc664('0x13')](_0x3b8291),_0x19ae9a?util[_0xc664('0x7')](_0x19ae9a,{'showHidden':![],'depth':null}):'');return _0x19ae9a['result'][_0xc664('0x14')]?_0x19ae9a[_0xc664('0x15')][0x0]:null;});}exports['getUserByInternal']=function(_0x429020){return new BPromise(function(_0x48d036,_0xc9b7f7){if(_0x429020){return getUser({'internal':_0x429020})[_0xc664('0xb')](function(_0x38821f){logger['info'](_0xc664('0x16'),_0x429020,_0x38821f?_0xc664('0x17'):_0xc664('0x18'));return _0x48d036(_0x38821f);})['catch'](function(_0x20e1e8){logger[_0xc664('0x9')](_0xc664('0x19'),_0x20e1e8?util[_0xc664('0x7')](_0x20e1e8,{'showHidden':![],'depth':null}):'');return _0x48d036(null);});}return _0x48d036(null);});};exports['getUserByInterface']=function(_0x3a51e9){return new BPromise(function(_0x13be10,_0xa3fb4d){if(_0x3a51e9){return getUser({'interface':_0x3a51e9})['then'](function(_0x578c54){logger[_0xc664('0x6')](_0xc664('0x1a'),_0x3a51e9,_0x578c54?_0xc664('0x17'):_0xc664('0x18'));return _0x13be10(_0x578c54);})[_0xc664('0xd')](function(_0x19c80e){logger[_0xc664('0x9')]('[utils][getUserByInterface]',_0x19c80e?util[_0xc664('0x7')](_0x19c80e,{'showHidden':![],'depth':null}):'');return _0x13be10(null);});}return _0x13be10(null);});};exports[_0xc664('0x1b')]=function(_0x4fb305){return new BPromise(function(_0x413b14,_0x14d4bf){if(_0x4fb305){return getUser({'name':_0x4fb305})[_0xc664('0xb')](function(_0x46857e){logger[_0xc664('0x6')](_0xc664('0x1c'),_0x4fb305,_0x46857e?_0xc664('0x17'):'notfound');return _0x413b14(_0x46857e);})['catch'](function(_0x4a5862){logger[_0xc664('0x9')](_0xc664('0x1d'),_0x4a5862?util['inspect'](_0x4a5862,{'showHidden':![],'depth':null}):'');return _0x413b14(null);});}return _0x413b14(null);});};exports[_0xc664('0x1e')]=function(_0x48d162){return new BPromise(function(_0x5ea86d,_0x3ecedd){if(_0x48d162){return client['request'](_0xc664('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xc664('0x10'),_0xc664('0x20'),_0xc664('0x21'),_0xc664('0x22')],'where':{'name':_0x48d162},'limit':0x1}})[_0xc664('0xb')](function(_0x6ecf7f){logger[_0xc664('0x8')](_0xc664('0x23'),_0x48d162,_0x6ecf7f?util[_0xc664('0x7')](_0x6ecf7f,{'showHidden':![],'depth':null}):'');logger[_0xc664('0x6')](_0xc664('0x24'),_0x48d162,_0x6ecf7f?'found':_0xc664('0x18'));return _0x5ea86d(_0x6ecf7f[_0xc664('0x15')]['length']?_0x6ecf7f['result'][0x0]:null);})[_0xc664('0xd')](function(_0x892f7b){logger[_0xc664('0x9')](_0xc664('0x25'),_0x892f7b?util[_0xc664('0x7')](_0x892f7b,{'showHidden':![],'depth':null}):'');return _0x5ea86d(null);});}return _0x5ea86d(null);});};exports[_0xc664('0x26')]=function(_0x33e453,_0xd0b6c6){return moment(_0x33e453)['add'](_0xd0b6c6,_0xc664('0x27'))[_0xc664('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x148f63,_0x18befc){return moment(_0x148f63)[_0xc664('0x29')](_0x18befc,_0xc664('0x27'))[_0xc664('0x28')](_0xc664('0x2a'));};exports[_0xc664('0x2b')]=function(_0x1db415,_0x1f1079){return moment(_0x1db415)[_0xc664('0x2c')](moment(_0x1f1079),'seconds');};exports['sumTime']=function(_0x1b6800,_0x47a2a6){return parseInt(_0x1b6800,0xa)+parseInt(_0x47a2a6,0xa);};exports['now']=function(){return moment()[_0xc664('0x28')](_0xc664('0x2a'));};exports[_0xc664('0x2d')]=function(_0x37131b,_0x4f293d){if(_0x4f293d){return moment(_0x37131b)['isAfter'](_0x4f293d);}return!![];};exports['isBefore']=function(_0x38ed0d,_0x4a9bb0){if(_0x4a9bb0){return moment(_0x38ed0d)['isBefore'](_0x4a9bb0);}else if(_0x38ed0d){return!![];}return![];}; \ No newline at end of file